This patch should be applied to an un-modified XFree86 version 4.2.0 source tree. It is the fourth of four patches that will will convert the source tree to XFree86 version 4.3.0. To apply this patch, run the following from the directory containing your 'xc' directory: patch -p0 -E < 4.2.0-4.3.0.diff1 patch -p0 -E < 4.2.0-4.3.0.diff2 patch -p0 -E < 4.2.0-4.3.0.diff3 patch -p0 -E < 4.2.0-4.3.0.diff4 rm -f xc/doc/hardcopy/Xext/mit-shm.PS.gz rm -f xc/doc/hardcopy/saver/saver.PS.gz rm -fr xc/fonts/scaled/Ethiopic rm -fr xc/fonts/scaled/Meltho rm -fr xc/programs/Xserver/hw/darwin/bundle rm -f xc/programs/Xserver/hw/hp/input/drivers/XHPKeymaps rm -f xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07 rm -f xc/programs/Xserver/hw/xwin/X.ico rm -fr xc/programs/xcursorgen/redglass rm -fr xc/programs/xcursorgen/whiteglass touch xc/extras/Mesa/src/Trace/tr_attrib.c touch xc/lib/fontconfig/NEWS gzip -d < 4.3.0.tgz | tar vxf - ------------------------------------------------------------------------------- Index: xc/programs/Xserver/hw/xfree86/Domain.note diff -u /dev/null xc/programs/Xserver/hw/xfree86/Domain.note:1.2 --- /dev/null Thu Feb 27 12:29:42 2003 +++ xc/programs/Xserver/hw/xfree86/Domain.note Fri Jan 25 16:55:49 2002 @@ -0,0 +1,159 @@ +The purpose of the changes described here is to implement a more general +framework for multi-head on systems with more than one host-to-PCI bridge. +The changes also implement a basic port of XFree86 to SPARC Solaris. + +These changes are derived from David S. Miller's submission #4653 to the +patch list. David Andrew of Sun Microsystems was also kind enough to +arrange for a hardware loan for development of these changes. + +These changes are known to work on several SPARC SunOS and UltraSPARC +Linux configurations. Linux kernel work is in progress to port these +changes to Linux/PowerPC. + +Several loose ends still need to be addressed before these changes can be +considered stable. The bulk of this note is devoted to enumerating what +remains to be done, along with other notes, broken down into various broad +categories. + +SPARC SunOS (aka Solaris) +------------------------- +- An overview of this XFree86 port is available in README.Solaris. +- The keyboard map code in hw/xfree86/os-support/sunos/sun_kbdEv.c needs + to be extended to handle more than only the sun5 keyboard I targeted it + for. Even for the sun5, the map is incomplete as several keys are not + mapped. What is there is just barely usable. +- On exit, the server will zero out /dev/fb, but that might not be the + right thing to do for all primary adapters. This does however + appear to emulate the behaviour of Sun's commercial servers. It also + eliminates the need for output drivers to save and restore video memory + contents. (They still need to save/restore the mode timing however.) + This also chimes into a long-standing XFree86 policy to not save/restore + video memory contents if the mode on entry is found to be non-VGA, a + policy several existing drivers comply with. +- The SBUS drivers (sunbw2, suncg14, suncg3, suncg6, sunffb, sunleo and + suntcx), the common layer's SBUS code and the fbdev driver have all + only been compile tested. There are likely to be Linux'isms within + them that remain to be dealt with. +- It still needs to be verified whether or not this work adversely + affected support for ix86 Solaris. + +UltraSPARC Linux +---------------- +- Although this code can be compiled using any Linux/SPARC64 kernel, it + can only run successfully using 2.4.12 or later. +- I haven't had time to sufficiently dig into XKB to properly configure it + for sun5 keyboards. Given XFree86 on Linux/SPARC has been around for a + while, it's likely someone has already done this, and I'd appreciate + receiving a copy of a working XF86Config input section. + +PowerPC Linux +------------- +- As mentioned above, kernel work is in progress to port this PCI scheme + to Linux/PowerPC. +- Aside from kernel work, the inX() and outX() definitions in compiler.h + will need to be changed to do something akin to their SPARC definitions, + i.e. consider their port argument to be a virtual address. + +Other Linux ports to multi-domain architectures +----------------------------------------------- +- Comments in os-support/bus/linuxPci.c document the kernel interface + required to port these changes. In short, Linux ports, such as Alpha + and mips, should follow SPARC and PowerPC's lead in providing support to + mmap() PCI devices through their /proc/bus/pci pseudo-files and to treat + such requests for host bridges as requests to mmap() space provided by + these bridges. + +Other OS's +---------- +- In the right hands, either linuxPci.c or sparcPci.c can be used as a + guide for what would need to be done to port this scheme to other OS's. + Perhaps the largest difference between the two (in terms of interface to + the common layer) is that the SunOS port includes internally generated + domain numbers in PCITAG's, whereas the Linux port doesn't need to. The + remainder of the PCI code (which is OS-independent) can handle either + scheme. +- Required entry points are xf86GetPciDomain(), xf86MapDomainMemory(), + xf86MapDomainIO() and xf86ReadDomainMemory(). Replacements for + xf86BusAccWindowsFromOS(), xf86PciBusAccWindowsFromOS() and + xf86AccResFromOS() might also be required. +- Development of these changes has detected the fact that the XFree86 port + to the PowerMax OS is broken, and has been for some time, i.e. since + shortly after its introduction, back in the 3.9* days. + +SPARC PCI (OS-independent) +-------------------------- +- The "Simba" PCI-to-PCI bridge used in SPARC's does not implement VGA + routing, as defined in the PCI specs. Fortunately, OpenPROM seems to + always route VGA resources to the bus with PCI connectors, but this also + causes the common layer to not mark any PCI adapter as primary. + +Multiple PCI domains (architecture- and OS-independent) +------------------------------------------------------- +- This implementation assumes every host-to-PCI bridge provides access to + a separate PCI domain. Each such domain provides three different + "address" spaces: PCI configuration, I/O and memory. The + implementation can also deal with situations where more than one PCI + domain share (different subsets of) the same PCI configuration space. I + have unconfirmed information that suggests it might be necessary to also + allow the sharing of PCI memory spaces. +- This implementation also assumes the CPU's physical address space + includes the entirety of each domain's I/O and memory spaces. I know + this'll need to be changed to deal with the so-called UniNorth bridge, + found on PowerPC's, which allows access to only a subset of the memory + space behind it. +- Ideally, the common layer should mark as primary up to one PCI adapter + per domain. This has yet to be done. +- Something needs to be done about PCI master aborts on primary buses. + For details on this, see my long-winded diatribe in sparcPci.c, and + related comments in linuxPci.c. Suffice it to say here that I see the + eventual implementation of host bridge drivers within XFree86 as + unavoidable at this point. +- DGA is broken on multi-domain platforms. The information passed to the + client to locate the framebuffer still needs to be revised. The best way + to deal with this is to change all drivers' OpenFramebuffer() function to + call a common layer routine to set the device name and displacements to be + returned to the DGA client. + +Output drivers +-------------- +Most drivers currently used on ix86 need(ed) source code changes. +- Calls to xf86ReadBIOS() and xf86MapVidMem() were replaced with calls to + xf86ReadDomainMemory() and xf86MapDomainMemory() respectively. Except + for the "ati" and "atimisc" modules, this has already been done. +- All ix86-style I/O port numbers need to be declared as an IOADDRESS, a + type defined in xf86Pci.h as "unsigned long". Such port numbers also + need to be offset by a displacement which is also defined as an + IOADDRESS. Before a driver's PreInit() is called, the common layer + makes this displacement available in ScrnInfoRec.domainIOBase. For + single-domain architectures, such as ix86, domainIOBase will always be + zero. Current use of vgaHWRec.PIOOffset has also been adjusted + accordingly. Some drivers have been changed to keep a copy of this + displacement in their private structure. Internally, an IOADDRESS is + actually a pointer that has been recasted to an unsigned long, but the + common layer "hides" this fact from the driver ABI, which means that I/O + port numbers, as seen by drivers, remain as integers rather than + addresses. Aside from the ati and atimisc modules, s3, sis and tseng + are the only modules left whose I/O still needs to be converted (I've + temporarily run out of steam). +- Note that these conversions are not necessarily sufficient to produce + drivers that will work on any given multi-domain architecture. A driver + that, for example, had endianness problems, still does. But, at least, + these conversions, along with the supporting common layer changes, make + PCI drivers more widely amenable to porting. +- rdinx(), wrinx(), modinx(), testrg(), testinx() and testinx2() are not + given enough information to allow for the relocation of their I/O. They + are consequently being deleted. The apm and ark drivers, the only + remaining callers of the first three, have been changed to use local + definitions instead. The last three (test*()) were already unused. +- As a temporary measure, these changes completely disable ISA-style + probing on SPARC's and PowerPC's. This means that driver calls to + xf86MatchIsaInstances(), while still valid, will always return detection + failure on SPARC's and PowerPC's. This will be dealt with when a more + general master abort handling scheme is implemented. +- I need to make a decision about the master abort issues mentionned above + before I can convert the "ati" and "atimisc" modules. Consequently, + these modules still need to be compiled with -DAVOID_CPIO on + multi-domain architectures, and support for Mach64 variants as + non-primary heads is not yet available. + +$XFree86: xc/programs/Xserver/hw/xfree86/Domain.note,v 1.2 2002/01/25 21:55:49 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/Imakefile diff -u xc/programs/Xserver/hw/xfree86/Imakefile:3.79 xc/programs/Xserver/hw/xfree86/Imakefile:3.82 --- xc/programs/Xserver/hw/xfree86/Imakefile:3.79 Mon Oct 29 11:51:55 2001 +++ xc/programs/Xserver/hw/xfree86/Imakefile Mon Feb 17 12:06:40 2003 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.79 2001/10/29 16:51:55 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.82 2003/02/17 17:06:40 dawes Exp $ #include #define IHaveSubdirs @@ -67,6 +67,10 @@ INT10DIR = int10 #endif +#if XF86VBE +VBEDIR = vbe +#endif + #if BuildXF86Setup XF86SETUPDIR = XF86Setup #endif @@ -75,7 +79,7 @@ LOADERDIR = loader #endif -#if BuildXInputExt +#if BuildXInputExt && defined(XInputDrivers) INPUTDIR = input #endif @@ -87,10 +91,10 @@ XF86CFGDIRS = xf86cfg xf86config #endif -SUBDIRS = os-support common $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \ +SUBDIRS = os-support common $(I2CDIR) $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \ $(XF8_32BPPDIR) $(XF8_16BPPDIR) $(XF24_32BPPDIR) $(SHADOWFBDIR) \ drivers $(LOADERDIR) $(VGAHWDIR) $(FBDEVHWDIR) $(RAMDACDIR) \ - $(RACDIR) $(I2CDIR) $(DDCDIR) $(INPUTDIR) $(INT10DIR) parser \ + $(RACDIR) $(DDCDIR) $(INPUTDIR) $(INT10DIR) $(VBEDIR) parser \ scanpci doc dummylib $(XF86CFGDIRS) $(XF86SETUPDIR) etc \ $(DRIVERSDK) $(XF8_32WIDDIR) Index: xc/programs/Xserver/hw/xfree86/Options diff -u xc/programs/Xserver/hw/xfree86/Options:1.8 xc/programs/Xserver/hw/xfree86/Options:1.10 --- xc/programs/Xserver/hw/xfree86/Options:1.8 Mon Dec 17 15:52:29 2001 +++ xc/programs/Xserver/hw/xfree86/Options Sat Feb 15 01:46:30 2003 @@ -24,7 +24,7 @@ !! dealings in this Software without prior written authorization from the !! XFree86 Project. !! -!! $XFree86: xc/programs/Xserver/hw/xfree86/Options,v 1.8 2001/12/17 20:52:29 dawes Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/Options,v 1.10 2003/02/15 06:46:30 paulo Exp $ !! XAA options xaa.XaaNoCPUToScreenColorExpandFill:\ @@ -265,6 +265,77 @@ r128.UseFBDev:\ Enable or disable use of on OS-specific fb interface (and is not supported \ on all OSs). See fbdevhw(4) for further information. Default: off. + +r128.DMAForXv:\ +Try or don't try to use DMA for Xv image transfers. This will reduce CPU \ +usage when playing big videos like DVDs, but may cause instabilities. \ +Default: off. + + +!! Radeon options + +radeon.SWcursor:\ +Selects software cursor. Default: off. + +radeon.NoAccel:\ +Disables all hardware acceleration. Default: off. + +radeon.Dac6Bit:\ +Enables or disables the use of 6 bits per color component when in 8 bpp \ +mode (emulates VGA mode). Default: off. + +radeon.VideoKey:\ +This overrides the default pixel value for the YUV video overlay key. \ +Default: undefined. + +radeon.UseFBDev:\ +Enable or disable use of an OS-specific framebuffer device interface \ +(which is not supported on all OSs). Default: off. + +radeon.AGPMode:\ +Set AGP data transfer rate. (used only when DRI is enabled) \ +Valid choices: 1 (default), 2 and 4 + +radeon.AGPFastWrite:\ +Enable AGP fast write. (used only when DRI is enabled) \ +Default: off. + +radeon.ForcePCIMode:\ +Force to use PCI GART for DRI acceleration. (used only when DRI is enabled) \ +Default: off. + +radeon.DDCMode:\ +Force to use the modes queried from the connected monitor. Default: off. + +radeon.CloneDisplay:\ +This option is only used for dual-head cards with only single screen section \ +specified in the configuration file. Valid choices: \ +0 - disable (one CRTC used for both heads) \ +1 - auto-detect (default) \ +2 - force on \ +3 - auto-detect + 2nd head overlay \ +4 - force on + 2nd head overlay \ + +radeon.CloneMode:\ +Set the first mode for the secondary head. It can be different from the modes \ +used for the primary head. If you don't have this line while clone is on, the \ +modes specified for the primary head will be used for the secondary head. + +radeon.CloneHSync:\ +Set the horizontal sync range for the secondary monitor. It is not required if \ +a DDC capable monitor is connected. Default: undefined. + +radeon.CloneVRefresh:\ +Set the vertical refresh range for the secondary monitor. It is not required \ +if a DDC capable monitor is connected. Default: undefined. + +radeon.PanelOff:\ +Disable panel output. Only used when clone is enabled. Default: off. + +radeon.EnablePageFlip:\ +Enable page flipping for 3D acceleration. This will increase performance but \ +not work correctly in some rare cases. Default: off. + !! NeoMagic options Index: xc/programs/Xserver/hw/xfree86/Registry diff -u xc/programs/Xserver/hw/xfree86/Registry:1.17 xc/programs/Xserver/hw/xfree86/Registry:1.19 --- xc/programs/Xserver/hw/xfree86/Registry:1.17 Thu Apr 5 15:29:41 2001 +++ xc/programs/Xserver/hw/xfree86/Registry Wed Feb 19 23:05:12 2003 @@ -6,34 +6,113 @@ Each module is required to have a unique name. Registered names are: +GLcore +acecad +afb +apm +ark ati +atimisc bitmap +bt8xx +calcomp cfb cfb16 cfb24 cfb32 chips +cirrus +citron +cyrix dbe ddc +digitaledge +dmc +dri +drm +dynapro +elo2300 +elographics extmod +fb +fbdev +fbdevhw +fi12x6 +freetype glide glint +glx +hyperpen +i128 i2c +i740 +i810 +imstt +int10 +joystick +keyboard +layer +magellan +magictouch mfb mga +microtouch +mouse +msp34xx +mutouch +neomagic +newport +nv +pcidata +penmount pex5 +r128 +radeon rac ramdac +record +rendition +s3 +s3virge +savage +scanpci +shadow +shadowfb +siliconmotion +sis +spaceorb speedo +summa +sunbw2 +suncg14 +suncg3 +suncg6 +sunffb +sunleo +suntcx +tdfx +tga +trident tseng type1 +v4l +vbe +vesa vga vgahw vmware +void +wacom xaa xf1bpp +xf24_32bpp xf4bpp +xf8_16bpp +xf8_32bpp +xf8_32wid xie +xtrap +xtt 2. External Module Object Symbols. @@ -42,12 +121,15 @@ case. Registered prefixes are: ati +bt8xx cfb chips +fi12x6 glide glint mfb mga +msp34xx neo permedia tseng @@ -132,6 +214,7 @@ BlankTime I F Screen saver timeout (min) DisableModInDev B F disallow changing input devs DisableVidModeExtension B F disable VidMode extension +DontVTSwitch B F disable Ctrl-Alt-Fn DontZap B F disable Ctrl-Alt-BS sequence DontZoom B F disable Ctrl-Alt-+/- NoTrapSignals B F don't trap signals @@ -185,7 +268,8 @@ BlockWrite B V Enable/disable block write ColorKey I V Set the color key for overlay modes CompositeSync B V Composite sync -CRTScreen B V Display on CRT, not LCD +CRTDisplay B V Force display on CRT, not LCD +CRTScreen B V Display on CRT, not LCD (Obsolete) EarlyRasPrecharge O V Early RAS pre-charge FastDRAM O V Fast DRAM FifoAggressive O V Aggressive FIFO setting @@ -214,6 +298,7 @@ MemCfg2 I V ?? MGASDRAM B V Mga card has SDRAM MMIO B V Enable/disable memory mapped I/O +MMIOCache B V Enable/Disable MMIO cache MuxThreshold I V Multiplexing threshold (kHz) NoAccel B V Disable/enable acceleration NoClockChip B V ?? @@ -223,9 +308,11 @@ Overlay A V Enable multi-depth/overlay. An optional string "M,N" may be specified, where M, N are the depths. +PanelDisplay B V Force display on LCD PciBurst B V Enable/disable PCI burst mode PciRetry B V Enable/disable PCI retries ProbeClocks B V Force probe for non-programmable clocks +ReferenceClock Q V Clock generator reference frequency RGBbits I V Number of significant bits per rgb Rotate S V Rotate the virtual display (CW or CCW) SetLCDClk Q V Set LCD clock (MHz) @@ -320,4 +407,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.17 2001/04/05 19:29:41 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.19 2003/02/20 04:05:12 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp diff -u xc/programs/Xserver/hw/xfree86/XF86Conf.cpp:3.44 xc/programs/Xserver/hw/xfree86/XF86Conf.cpp:3.45 --- xc/programs/Xserver/hw/xfree86/XF86Conf.cpp:3.44 Mon Dec 17 15:52:29 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Conf.cpp Wed Feb 19 23:05:12 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp,v 3.44 2001/12/17 20:52:29 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp,v 3.45 2003/02/20 04:05:12 dawes Exp $ XCOMM XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc. XCOMM @@ -106,6 +106,12 @@ XCOMM provide a better stack trace in the core dump to aid in debugging XCOMM Option "NoTrapSignals" + +XCOMM Uncomment this to disable the VT switch sequence +XCOMM (where n is 1 through 12). This allows clients to receive these key +XCOMM events. + +XCOMM Option "DontVTSwitch" XCOMM Uncomment this to disable the server abort sequence XCOMM This allows clients to receive this key event. Index: xc/programs/Xserver/hw/xfree86/XF86Config.man diff -u xc/programs/Xserver/hw/xfree86/XF86Config.man:1.6 xc/programs/Xserver/hw/xfree86/XF86Config.man:1.14 --- xc/programs/Xserver/hw/xfree86/XF86Config.man:1.6 Wed Aug 15 12:25:21 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Config.man Wed Feb 26 13:59:49 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.6 2001/08/15 16:25:21 paulo Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.14 2003/02/26 18:59:49 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH XF86Config __filemansuffix__ __vendorversion__ @@ -13,19 +13,19 @@ .PP .RS 4 .nf -.RI /etc/X11/ -.RI __projectroot__/etc/X11/ -.RB /etc/X11/ $XF86CONFIG -.RB __projectroot__/etc/X11/ $XF86CONFIG -/etc/X11/XF86Config-4 -/etc/X11/XF86Config -/etc/XF86Config -.RI __projectroot__/etc/X11/XF86Config. -__projectroot__/etc/X11/XF86Config-4 -__projectroot__/etc/X11/XF86Config -.RI __projectroot__/lib/X11/XF86Config. -__projectroot__/lib/X11/XF86Config-4 -__projectroot__/lib/X11/XF86Config +.IR /etc/X11/ +.IR __projectroot__/etc/X11/ +.IB /etc/X11/ $XF86CONFIG +.IB __projectroot__/etc/X11/ $XF86CONFIG +.I /etc/X11/XF86Config-4 +.I /etc/X11/XF86Config +.I /etc/XF86Config +.IR __projectroot__/etc/X11/XF86Config. +.I __projectroot__/etc/X11/XF86Config-4 +.I __projectroot__/etc/X11/XF86Config +.IR __projectroot__/lib/X11/XF86Config. +.I __projectroot__/lib/X11/XF86Config-4 +.I __projectroot__/lib/X11/XF86Config .fi .RE .PP @@ -38,29 +38,29 @@ is the relative path (with no ".." components) specified by that environment variable, and .I -is the machines hostname as reported by gethostname(3). +is the machine's hostname as reported by gethostname(3). .PP When the X server is started by the "root" user, the config file search locations are as follows: .PP .RS 4 .nf -.I -.RI /etc/X11/ -.RI __projectroot__/etc/X11/ + +.IR /etc/X11/ +.IR __projectroot__/etc/X11/ .B $XF86CONFIG -.RB /etc/X11/ $XF86CONFIG -.RB __projectroot__/etc/X11/ $XF86CONFIG -.BR $HOME /XF86Config -/etc/X11/XF86Config-4 -/etc/X11/XF86Config -/etc/XF86Config -.RI __projectroot__/etc/X11/XF86Config. -__projectroot__/etc/X11/XF86Config-4 -__projectroot__/etc/X11/XF86Config -.RI __projectroot__/lib/X11/XF86Config. -__projectroot__/lib/X11/XF86Config-4 -__projectroot__/lib/X11/XF86Config +.IB /etc/X11/ $XF86CONFIG +.IB __projectroot__/etc/X11/ $XF86CONFIG +.BI $HOME /XF86Config +.I /etc/X11/XF86Config-4 +.I /etc/X11/XF86Config +.I /etc/XF86Config +.IR __projectroot__/etc/X11/XF86Config. +.I __projectroot__/etc/X11/XF86Config-4 +.I __projectroot__/etc/X11/XF86Config +.IR __projectroot__/lib/X11/XF86Config. +.I __projectroot__/lib/X11/XF86Config-4 +.I __projectroot__/lib/X11/XF86Config .fi .RE .PP @@ -76,7 +76,7 @@ is the path specified by that environment variable (usually the home directory), and .I -is the machines hostname as reported by gethostname(3). +is the machine's hostname as reported by gethostname(3). .PP The .B XF86Config @@ -86,8 +86,6 @@ .PP .RS 4 .nf -.\" Some man macros don't handle quotes in .BI, etc very well -.\" \fBSection "\fP\fISectionName\fP\fB"\fP .BI "Section \*q" SectionName \*q .RI " " SectionEntry ... @@ -157,7 +155,7 @@ names) are also case-insensitive, and insensitive to white space and "_" characters. .PP -Each config file entry usually take up a single line in the file. +Each config file entry usually takes up a single line in the file. They consist of a keyword, which is possibly followed by one or more arguments, with the number and types of the arguments depending on the keyword. The argument types are: @@ -296,12 +294,12 @@ .PP .RS 4 .nf -__projectroot__/lib/X11/fonts/misc/ -__projectroot__/lib/X11/fonts/Speedo/ -__projectroot__/lib/X11/fonts/Type1/ -__projectroot__/lib/X11/fonts/CID/ -__projectroot__/lib/X11/fonts/75dpi/ -__projectroot__/lib/X11/fonts/100dpi/ +.I __projectroot__/lib/X11/fonts/misc/ +.I __projectroot__/lib/X11/fonts/Speedo/ +.I __projectroot__/lib/X11/fonts/Type1/ +.I __projectroot__/lib/X11/fonts/CID/ +.I __projectroot__/lib/X11/fonts/75dpi/ +.I __projectroot__/lib/X11/fonts/100dpi/ .fi .RE .PP @@ -309,15 +307,15 @@ .PP .RS 4 .nf -__projectroot__/lib/X11/fonts/local/ -__projectroot__/lib/X11/fonts/misc/ -__projectroot__/lib/X11/fonts/75dpi/:unscaled -__projectroot__/lib/X11/fonts/100dpi/:unscaled -__projectroot__/lib/X11/fonts/Type1/ -__projectroot__/lib/X11/fonts/CID/ -__projectroot__/lib/X11/fonts/Speedo/ -__projectroot__/lib/X11/fonts/75dpi/ -__projectroot__/lib/X11/fonts/100dpi/ +.I __projectroot__/lib/X11/fonts/local/ +.I __projectroot__/lib/X11/fonts/misc/ +.I __projectroot__/lib/X11/fonts/75dpi/:unscaled +.I __projectroot__/lib/X11/fonts/100dpi/:unscaled +.I __projectroot__/lib/X11/fonts/Type1/ +.I __projectroot__/lib/X11/fonts/CID/ +.I __projectroot__/lib/X11/fonts/Speedo/ +.I __projectroot__/lib/X11/fonts/75dpi/ +.I __projectroot__/lib/X11/fonts/100dpi/ .fi .RE .PP @@ -331,8 +329,13 @@ to the compiled-in default RGB path, which is: .PP .RS 11 -__projectroot__/lib/X11/rgb +.I __projectroot__/lib/X11/rgb .RE +.PP +Note that an implicit +.I .txt +is added to this path if the server was compiled to use text rather than +binary format RGB color databases. .TP 7 .BI "ModulePath \*q" path \*q sets the search path for loadable X server modules. This path is a @@ -367,7 +370,10 @@ using them is discouraged. .PP .B Options -specified in this section may be overridden by +specified in this section (with the exception of the +.B \*qDefaultServerLayout\*q +.BR Option ) +may be overridden by .B Options specified in the active .B ServerLayout @@ -375,14 +381,31 @@ command line equivalent is used. The options recognised by this section are: .TP 7 +.BI "Option \*qDefaultServerLayout\*q \*q" layout-id \*q +This specifies the default +.B ServerLayout +section to use in the absence of the +.B \-layout +command line option. +.TP 7 .BI "Option \*qNoTrapSignals\*q \*q" boolean \*q This prevents the X server from trapping a range of unexpected fatal signals and exiting cleanly. Instead, the X server will die and drop core where the fault occurred. The default behaviour is -for the X server exit cleanly, but still drop a core file. In +for the X server to exit cleanly, but still drop a core file. In general you never want to use this option unless you are debugging an X server problem and know how to deal with the consequences. .TP 7 +.BI "Option \*qDontVTSwitch\*q \*q" boolean \*q +This disallows the use of the +.BI Ctrl+Alt+F n +sequence (where +.RI F n +refers to one of the numbered function keys). That sequence is normally +used to switch to another \(oqvirtual terminal\)cq on operating systems +that have this feature. When this option is enabled, that key sequence has +no special meaning and is passed to clients. Default: off. +.TP 7 .BI "Option \*qDontZap\*q \*q" boolean \*q This disallows the use of the .B Ctrl+Alt+Backspace @@ -440,6 +463,10 @@ This prevents the X server trapping the keys used for the default VT switch sequence, which means that clients can access them. Default: off. +.TP 7 +.BI "Option \*qXkbDisable\*q \*q" boolean \*q +disable/enable the XKEYBOARD extension. The \-kb command line +option overrides this config file option. Default: XKB is enabled. .\" The following four options are "undocumented". .ig .TP 7 @@ -523,7 +550,7 @@ .BI "Option \*qAllowDeactivateGrabs\*q \*q" boolean \*q This option enables the use of the .B Ctrl+Alt+Keypad-Divide -key sequence to desactivate any active keyboard and mouse grabs. +key sequence to deactivate any active keyboard and mouse grabs. Default: off. .TP 7 .BI "Option \*qAllowClosedownGrabs\*q \*q" boolean \*q @@ -531,7 +558,7 @@ .B Ctrl+Alt+Keypad-Multiply key sequence to kill clients with an active keyboard or mouse grab as well as killing any application that may have locked the server, -normally using the XGrabServer(3) Xlib function. +normally using the XGrabServer(__libmansuffix__) Xlib function. Default: off. .br Note that the options @@ -541,6 +568,26 @@ will allow users to remove the grab used by screen saver/locker programs. An API was written to such cases. If you enable this option, make sure your screen saver/locker is updated. +.TP 7 +.BI "Option \*qHandleSpecialKeys\*q \*q" when \*q +This option controls when the server uses the builtin handler +to process special key combinations (such as +.BR Ctrl+Alt+Backspace ). +Normally the XKEYBOARD extension keymaps will provide mappings +for each of the special key combinations, so the builtin handler +is not needed unless the XKEYBOARD extension is disabled. +The value of +.I when +can be +.BR Always , +.BR Never , +or +.BR WhenNeeded . +Default: Use the builtin handler only if needed. The server will +scan the keymap for a mapping to the +.B Terminate +action and, if found, use XKEYBOARD for processing actions, otherwise +the builtin handler will be used. .SH MODULE SECTION The .B Module @@ -1236,6 +1283,7 @@ section. Some are driver-specific and are described in the driver documentation. Others are driver-independent, and will eventually be described here. +.\" XXX These should really be in an xaa man page. .TP 7 .BI "Option \*qAccel\*q" Enables XAA (X Acceleration Architecture), a mechanism that makes video @@ -1246,6 +1294,12 @@ effect if the operation is not accelerated (whether due to lack of support in the hardware or in the driver). .TP 7 +.BI "Option \*qNoMTRR\*q" +Disables MTRR (Memory Type Range Register) support, a feature of modern +processors which can improve video performance by a factor of up to 2.5. +Some hardware has buggy MTRR support, and some video drivers have been +known to exhibit problems when MTRR's are used. +.TP 7 .BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q" Disables accelerated rectangular expansion blits from source patterns stored in system memory (using a memory-mapped aperture). @@ -1474,6 +1528,7 @@ .TP 7 .BI "Black " "red green blue" This optional entry allows the "black" colour to be specified. This +is only supported at depth 1. The default is black. .TP 7 .BI "White " "red green blue" This optional entry allows the "white" colour to be specified. This @@ -1501,7 +1556,12 @@ .B ServerLayout section is considered "active" if it is referenced by the .B \-layout -command line option. If that option is not used, the first +command line option or by an +.B "Option \*qDefaultServerLayout\*q" +entry in the +.B ServerFlags +section (the former takes precedence over the latter). If those options are +not used, the first .B ServerLayout section found in the config file is considered the active one. If no .B ServerLayout @@ -1558,11 +1618,17 @@ a number of different ways that this information can be provided: .RS 7 .TP 4 +.I "x y" +.TP 4 .BI "Absolute " "x y" -This says that the upper left corner's coordinates are +These both specify that the upper left corner's coordinates are .RI ( x , y ). -If the coordinates are omitted or if no positioning information -is given, (0,0) is assumed. +The +.B Absolute +keyword is optional. Some older versions of XFree86 (4.2 and earlier) don't +recognise the +.B Absolute +keyword, so it's safest to just specificy the coorindates without it. .TP 4 .BI "RightOf \*q" screen-id \*q .TP 4 @@ -1573,7 +1639,14 @@ .BI "Below \*q" screen-id \*q .TP 4 .BI "Relative \*q" screen-id \*q " x y" -These give the screen's location relative to another screen. +These give the screen's location relative to another screen. The first four +position the screen immediately to the right, left, above or below the +other screen. When positioning to the right or left, the top edges are +aligned. When positioning above or below, the left edges are aligned. +The +.B Relative +form specifies the offset of the screen's origin (upper left corner) +relative to the origin of another screen. .RE .TP 7 .BI "InputDevice \*q" idev-id "\*q \*q" option \*q " ..." @@ -1588,8 +1661,8 @@ fields may be specified, each in double quotes. The options permitted here are any that may also be given in the .B InputDevice -sections. Normally only session-specific input device options would -be used here. The most commonly used options are: +sections. Normally only session-specific input device options would be +used here. The most commonly used options are: .PP .RS 11 .nf @@ -1652,42 +1725,46 @@ __projectroot__/lib/X11/XF86Config.eg. .fi .SH "SEE ALSO" -X(__miscmansuffix__), Xserver(1), XFree86(1), -apm(__drivermansuffix__), -ati(__drivermansuffix__), -chips(__drivermansuffix__), -cirrus(__drivermansuffix__), -cyrix(__drivermansuffix__), -fbdev(__drivermansuffix__), -glide(__drivermansuffix__), -glint(__drivermansuffix__), -i128(__drivermansuffix__), -i740(__drivermansuffix__), -i810(__drivermansuffix__), -imstt(__drivermansuffix__), -mga(__drivermansuffix__), -neomagic(__drivermansuffix__), -nv(__drivermansuffix__), -r128(__drivermansuffix__), -rendition(__drivermansuffix__), -s3virge(__drivermansuffix__), -siliconmotion(__drivermansuffix__), -sis(__drivermansuffix__), -sunbw2(__drivermansuffix__), -suncg14(__drivermansuffix__), -suncg3(__drivermansuffix__), -suncg6(__drivermansuffix__), -sunffb(__drivermansuffix__), -sunleo(__drivermansuffix__), -suntcx(__drivermansuffix__), -tdfx(__drivermansuffix__), -tga(__drivermansuffix__), -trident(__drivermansuffix__), -tseng(__drivermansuffix__), -v4l(__drivermansuffix__), -vesa(__drivermansuffix__), -vga(__drivermansuffix__), -vmware(__drivermansuffix__), +.IR X(__miscmansuffix__), +.IR Xserver(1), +.IR XFree86(1), +.IR apm(__drivermansuffix__), +.\" .IR ati(__drivermansuffix__), +.IR chips(__drivermansuffix__), +.IR cirrus(__drivermansuffix__), +.IR cyrix(__drivermansuffix__), +.IR fbdev(__drivermansuffix__), +.IR glide(__drivermansuffix__), +.IR glint(__drivermansuffix__), +.IR i128(__drivermansuffix__), +.IR i740(__drivermansuffix__), +.IR i810(__drivermansuffix__), +.IR imstt(__drivermansuffix__), +.IR mga(__drivermansuffix__), +.IR neomagic(__drivermansuffix__), +.IR nv(__drivermansuffix__), +.IR r128(__drivermansuffix__), +.IR rendition(__drivermansuffix__), +.IR savage(__drivermansuffix__), +.IR s3virge(__drivermansuffix__), +.\" .IR shadowfb(__drivermansuffix__), +.IR siliconmotion(__drivermansuffix__), +.IR sis(__drivermansuffix__), +.IR sunbw2(__drivermansuffix__), +.IR suncg14(__drivermansuffix__), +.IR suncg3(__drivermansuffix__), +.IR suncg6(__drivermansuffix__), +.IR sunffb(__drivermansuffix__), +.IR sunleo(__drivermansuffix__), +.IR suntcx(__drivermansuffix__), +.IR tdfx(__drivermansuffix__), +.IR tga(__drivermansuffix__), +.IR trident(__drivermansuffix__), +.IR tseng(__drivermansuffix__), +.IR v4l(__drivermansuffix__), +.IR vesa(__drivermansuffix__), +.IR vga(__drivermansuffix__), +.IR vmware(__drivermansuffix__), .br README .IR , Index: xc/programs/Xserver/hw/xfree86/XFree86.man diff -u xc/programs/Xserver/hw/xfree86/XFree86.man:3.54 xc/programs/Xserver/hw/xfree86/XFree86.man:3.59 --- xc/programs/Xserver/hw/xfree86/XFree86.man:3.54 Thu Jan 17 12:10:37 2002 +++ xc/programs/Xserver/hw/xfree86/XFree86.man Wed Feb 26 13:59:49 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.54 2002/01/17 17:10:37 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.59 2003/02/26 18:59:49 dawes Exp $ .TH XFree86 1 __vendorversion__ .SH NAME XFree86 - X11R6 X server @@ -10,12 +10,12 @@ operating systems running on Intel x86 hardware. It now runs on a wider range of hardware and OS platforms. .PP -This work is derived from +This work was originally derived from .I "X386\ 1.2" which was contributed to X11R5 by Snitily Graphics Consulting Service. -The current XFree86 release is based on X11R6.3. The XFree86 X server -architecture was redesigned for the 4.0 release, and it includes among -other things a loadable module system donated by Metro Link, Inc. +The XFree86 X server architecture was redesigned for the 4.0 release, +and it includes among other things a loadable module system donated by +Metro Link, Inc. The current XFree86 release is compatible with X11R6.6. .SH CONFIGURATIONS .PP .I XFree86 @@ -77,7 +77,7 @@ export if using \fIsh\fP or \fIksh\fP) \fIXLOCAL\fP globally. If you use \fIstartx/xinit\fP, the definition should be at the top of your \fI.xinitrc\fP file. If you use \fIxdm\fP, the definitions should be -early on in the \fI/lib/X11/xdm/Xsession\fP script. +early on in the \fI __projectroot__/lib/X11/xdm/Xsession\fP script. .SH OPTIONS In addition to the normal server options described in the \fIXserver(1)\fP manual page, \fIXFree86\fP accepts the following command line switches: @@ -319,10 +319,10 @@ .B \-showconfig This is the same as the .B \-version -option, and is included for compatibilty reasons. It may be removed in +option, and is included for compatibility reasons. It may be removed in a future release, so the .B \-version -options hould be used instead. +option should be used instead. .TP 8 .B \-weight \fInnn\fP Set RGB weighting at 16 bpp. The default is 565. This applies only to @@ -348,7 +348,25 @@ for files relative to a directory in the config search path for all other users. .SH "KEYBOARD" -Multiple key presses recognized directly by \fIXFree86\fP are: +.PP +The XFree86 server is normally configured to recognize various +special combinations of key presses that instruct the server to +perform some action, rather than just sending the keypress event +to a client application. +The default XKEYBOARD keymap defines the key combinations listed below. +The server also has these key combinations builtin to its event +handler for cases where the XKEYBOARD extension is not being used. +When using the XKEYBOARD extension, which key combinations +perform which actions is completely configurable. +.PP +For more information about when the builtin event handler +is used to recognize the special key combinations, see +the documentation on the +.B HandleSpecialKeys +option in the XF86Config(__filemansuffix__) man page. +.PP +The special combinations of key presses recognized directly +by \fIXFree86\fP are: .TP 8 .B Ctrl+Alt+Backspace Immediately kills the server -- no questions asked. This can be disabled @@ -368,9 +386,26 @@ .B DontZoom XF86Config(__filemansuffix__) file option. .TP 8 +.B Ctrl+Alt+Keypad-Multiply +Not treated specially by default. If the +.B AllowClosedownGrabs +XF86Config(__filemansuffix__) file option is specified, this key sequence +kills clients with an active keyboard or mouse grab as well as killing any +application that may have locked the server, normally using the +XGrabServer(__libmansuffix__) Xlib function. +.TP 8 +.B Ctrl+Alt+Keypad-Divide +Not treated specially by default. If the +.B AllowDeactivateGrabs +XF86Config(__filemansuffix__) file option is specified, this key sequence +deactivates any active keyboard and mouse grabs. +.TP 8 .B Ctrl+Alt+F1...F12 For BSD and Linux systems with virtual terminal support, these keystroke -combinations are used to switch to Virtual Console 1 through 12. +combinations are used to switch to virtual terminals 1 through 12, +respectively. This can be disabled with the +.B DontVTSwitch +XF86Config(__filemansuffix__) file option. .SH SETUP .I XFree86 uses a configuration file called \fBXF86Config\fP for its initial setup. @@ -445,6 +480,7 @@ imstt(__drivermansuffix__), mga(__drivermansuffix__), neomagic(__drivermansuffix__), +nsc(__drivermansuffix__), nv(__drivermansuffix__), r128(__drivermansuffix__), rendition(__drivermansuffix__), @@ -535,8 +571,7 @@ .PP .RS 4 .nf -Stuart Anderson \fIanderson@metrolink.com\fP -Preston Brown \fIpbrown@redhat.com\fP +Stuart Anderson \fIanderson@netsweng.com\fP Robin Cutshaw \fIrobin@xfree86.org\fP David Dawes \fIdawes@xfree86.org\fP Egbert Eich \fIeich@xfree86.org\fP @@ -556,6 +591,7 @@ .RE .PP \fIXFree86\fP source is available from the FTP server -\fI\fP, among others. Documentation +\fI\fP, and from the XFree86 +CVS server \fI\fP. Documentation and other information can be found from the XFree86 web site \fI\fP. Index: xc/programs/Xserver/hw/xfree86/xf86Date.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/xf86Date.h:1.3 --- /dev/null Thu Feb 27 12:29:42 2003 +++ xc/programs/Xserver/hw/xfree86/xf86Date.h Wed Feb 26 23:56:45 2003 @@ -0,0 +1,7 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Date.h,v 1.3 2003/02/27 04:56:45 dawes Exp $ */ + +#ifndef XF86_DATE + +#define XF86_DATE "27 February 2003" + +#endif Index: xc/programs/Xserver/hw/xfree86/xf86Version.h diff -u xc/programs/Xserver/hw/xfree86/xf86Version.h:3.487 xc/programs/Xserver/hw/xfree86/xf86Version.h:3.543 --- xc/programs/Xserver/hw/xfree86/xf86Version.h:3.487 Fri Jan 18 15:09:24 2002 +++ xc/programs/Xserver/hw/xfree86/xf86Version.h Wed Feb 26 23:56:45 2003 @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.487 2002/01/18 20:09:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.543 2003/02/27 04:56:45 dawes Exp $ */ #ifndef XF86_VERSION_CURRENT #define XF86_VERSION_MAJOR 4 -#define XF86_VERSION_MINOR 2 +#define XF86_VERSION_MINOR 3 #define XF86_VERSION_PATCH 0 #define XF86_VERSION_SNAP 0 @@ -11,6 +11,11 @@ #define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap) +#define XF86_GET_MAJOR_VERSION(vers) ((vers) / 10000000) +#define XF86_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000) +#define XF86_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000) +#define XF86_GET_SNAP_VERSION(vers) ((vers) % 1000) + /* Define these for compatibility. They'll be removed at some point. */ #define XF86_VERSION_SUBMINOR XF86_VERSION_PATCH #define XF86_VERSION_BETA 0 @@ -22,9 +27,6 @@ XF86_VERSION_PATCH, \ XF86_VERSION_SNAP, \ 0) - - -#define XF86_DATE "18 January 2002" #endif Index: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man:3.5 xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man:3.6 --- xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man:3.5 Sat Jan 27 13:20:45 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man Sat Oct 12 12:06:43 2002 @@ -1,5 +1,5 @@ .\" $XConsortium: XF86Setup.man /main/3 1996/12/09 17:37:49 kaleb $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man,v 3.5 2001/01/27 18:20:45 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man,v 3.6 2002/10/12 16:06:43 herrb Exp $ .TH XF86Setup 1 __vendorversion__ .SH NAME XF86Setup - Graphical configuration utility for XFree86 @@ -79,14 +79,15 @@ .TP 14 .B XF86SETUPLIB If set, overrides the default location of the library directory -(normally /lib/X11/XF86Setup). +(normally __projectroot__/lib/X11/XF86Setup). .TP 14 .B TMPDIR Directory in which to store temporary files (defaults to /tmp) .SH FILES -/lib/X11/XF86Config +.I __projectroot__/lib/X11/XF86Config .br -\fIor\fP /etc/XF86Config +or +.I /etc/XF86Config .RS 14 Can optionally be read to set default values for configuration settings Index: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c:3.30 xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c:3.31 --- xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c:3.30 Wed Jul 25 11:05:05 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c Fri May 31 14:45:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c,v 3.30 2001/07/25 15:05:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c,v 3.31 2002/05/31 18:45:57 dawes Exp $ */ /* * Copyright 1996,1999 by Joseph V. Moss * @@ -179,7 +179,7 @@ next = path; while (next != NULL) { path_elem = get_path_elem(&next); -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (*path_elem == '/') { dir_elem = (char *)XtCalloc(1, strlen(path_elem) + 1); if ((p1 = strchr(path_elem, ':')) != 0) @@ -212,7 +212,7 @@ if (flag == 0) if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG)) flag = -1; -#ifndef __EMX__ +#ifndef __UNIXOS2__ XtFree(p1); #endif if (flag != 0) { Index: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man:3.5 xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man:3.6 --- xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man:3.5 Sat Jan 27 13:20:45 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man Sat Oct 12 12:06:43 2002 @@ -4,7 +4,7 @@ .\" .\" .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man,v 3.5 2001/01/27 18:20:45 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man,v 3.6 2002/10/12 16:06:43 herrb Exp $ .TH xmseconfig 1 __vendorversion__ .SH NAME xmseconfig - Graphical mouse configuration utility @@ -33,11 +33,12 @@ .TP 14 .B XF86SETUPLIB If set, overrides the default location of the library directory -(normally /lib/X11/XF86Setup). +(normally __projectroot__/lib/X11/XF86Setup). .SH FILES -/lib/X11/XF86Config +.I __projectroot__/lib/X11/XF86Config .br -\fIor\fP /etc/XF86Config +or +.I /etc/XF86Config .RS 14 Used to determine the link to the mouse device .RE Index: xc/programs/Xserver/hw/xfree86/common/Imakefile diff -u xc/programs/Xserver/hw/xfree86/common/Imakefile:3.138 xc/programs/Xserver/hw/xfree86/common/Imakefile:3.148 --- xc/programs/Xserver/hw/xfree86/common/Imakefile:3.138 Tue Oct 9 15:31:05 2001 +++ xc/programs/Xserver/hw/xfree86/common/Imakefile Mon Feb 17 12:06:41 2003 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.138 2001/10/09 19:31:05 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.148 2003/02/17 17:06:41 dawes Exp $ @@ -18,8 +18,7 @@ #endif /* GNUMachArchitecture */ #else # if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \ - || defined(OpenBSDArchitecture) && defined(PpcArchitecture) \ - || defined(NetBSDArchitecture) + || defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) KBD = xf86KbdBSD # else # ifdef LinuxArchitecture @@ -31,8 +30,8 @@ #endif #ifdef SparcArchitecture - SBUSSRC = xf86sbusBus.c - SBUSOBJ = xf86sbusBus.o + SBUSSRC = xf86sbusBus.c + SBUSOBJ = xf86sbusBus.o #endif #if BuildXKB @@ -50,6 +49,12 @@ XF86_XINPUT_OBJ = xf86Xinput.o xisb.o #endif +#if BuildRandR + RANDRINCS = -I../../../randr + RANDRSRC = xf86RandR.c + RANDROBJ = xf86RandR.o +#endif + MODPATHDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" LOGDEFINES = -DDEFAULT_LOGPREFIX=\"$(LOGDIRECTORY)/XLogFile.\" @@ -57,6 +62,10 @@ EXT_MODULES_DEFINES = $(GLX_DEFINES) #endif +#if UseMemLeak +MDEBUGDEFS = -DMEMDEBUG +#endif + #ifndef XF86ExpireServer #define XF86ExpireServer NO #endif @@ -84,6 +93,7 @@ xf86isaBus.c \ xf86pciBus.c \ xf86fbBus.c \ + xf86noBus.c \ xf86IniExt.c \ xf86Config.c \ xf86Cursor.c \ @@ -113,7 +123,8 @@ $(XINPUT_DEV_SRCS) \ $(XKBDDXSRC) \ $(BETASRC) \ - $(SERVERSRCS) + $(SERVERSRCS) \ + $(RANDRSRC) OBJS = \ xf86Configure.o \ @@ -121,6 +132,7 @@ xf86isaBus.o \ xf86pciBus.o \ xf86fbBus.o \ + xf86noBus.o \ xf86Config.o \ xf86Cursor.o \ xf86DGA.o \ @@ -146,8 +158,8 @@ $(XF86_XINPUT_OBJ) \ $(XKBDDXOBJ) \ $(BETAOBJ) \ - $(KBD).o - + $(KBD).o \ + $(RANDROBJ) OFILES = \ xf86Init.o \ @@ -161,8 +173,8 @@ -I$(FONTLIBSRC)/include -I$(FONTINCSRC) \ -I$(XF86SRC) -I$(XF86PARSERSRC) \ -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac \ - -I$(XF86SRC)/scanpci -I$(XF86OSSRC)/vbe -I$(XF86SRC)/int10 \ - -I$(XF86SRC)/ddc + -I$(XF86SRC)/scanpci -I$(XF86SRC)/vbe -I$(XF86SRC)/int10 \ + -I$(XF86SRC)/ddc -I$(SERVERSRC)/render $(RANDRINCS) OSNAME = OSName OSVENDOR = OSVendor @@ -175,6 +187,12 @@ BUILDERSTRING = BuilderString BUILDERMSG = -DBUILDERSTRING='$(BUILDERSTRING)' #endif +#if defined(BuildDate) + BUILD_DATE = BuildDate +#endif + XORGREL = XOrgReleaseString + XORGREL_DEF = -DXORG_RELEASE='"$(XORGREL)"' + CONSDEFINES = XFree86ConsoleDefines EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES) DRIVERS = XF86CardDrivers @@ -190,8 +208,8 @@ AllTarget($(OFILES)) SpecialCObjectRule(xf86Bus,NullParameter,$(BUGMSG) $(VGAINCLUDES)) -SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG) $(BUGMSG) $(CUSTOMVERDEF) $(EXT_DEFINES) $(BETADEFS)) -SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES)) +SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG) $(BUGMSG) $(CUSTOMVERDEF) $(XORGREL_DEF) $(EXT_DEFINES) $(BETADEFS) $(MDEBUGDEFS)) +SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES) $(MDEBUGDEFS)) SpecialCObjectRule(xf86Globals,$(ICONFIGFILES),$(EXT_DEFINES) $(MODPATHDEFINES) $(LOGDEFINES)) SpecialCObjectRule(xf86Config,$(ICONFIGFILES),$(XCONFIGDEFINES)) SpecialCObjectRule(xf86Configure,$(ICONFIGFILES),$(XCONFIGUREDEFINES)) @@ -234,9 +252,24 @@ LinkFile(xf86DefModeSet.c,xf86DefModes.c) #endif -#ifndef OS2Architecture -DependTarget() +includes:: xf86Build.h + +clean:: + RemoveFile(xf86Build.h) + +#if defined(BuildDate) +xf86Build.h: FRC + RemoveFile($@) + echo "#define BUILD_DATE $(BUILD_DATE)" > $@ + +FRC: +#else +xf86Build.h: + RemoveFile($@) + echo "" > $@ #endif + +DependTarget() InstallDriverSDKNonExecFile(compiler.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(fourcc.h,$(DRIVERSDKINCLUDEDIR)) Index: xc/programs/Xserver/hw/xfree86/common/compiler.h diff -u xc/programs/Xserver/hw/xfree86/common/compiler.h:3.88 xc/programs/Xserver/hw/xfree86/common/compiler.h:3.99 --- xc/programs/Xserver/hw/xfree86/common/compiler.h:3.88 Mon Jan 7 15:38:27 2002 +++ xc/programs/Xserver/hw/xfree86/common/compiler.h Wed Jan 29 10:23:20 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.88 2002/01/07 20:38:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.99 2003/01/29 15:23:20 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -25,52 +25,52 @@ #ifndef _COMPILER_H -#if !defined(_XF86_ANSIC_H) && defined(XFree86Module) -# error missing #include "xf86_ansic.h" before #include "compiler.h" -#endif +# if !defined(_XF86_ANSIC_H) && defined(XFree86Module) +# error missing #include "xf86_ansic.h" before #include "compiler.h" +# endif -#define _COMPILER_H +# define _COMPILER_H /* Allow drivers to use the GCC-supported __inline__ and/or __inline. */ -#ifndef __inline__ -# if defined(__GNUC__) - /* gcc has __inline__ */ -# elif defined(__HIGHC__) -# define __inline__ _Inline -# else -# define __inline__ /**/ -# endif -#endif /* __inline__ */ -#ifndef __inline -# if defined(__GNUC__) - /* gcc has __inline */ -# elif defined(__HIGHC__) -# define __inline _Inline -# else -# define __inline /**/ -# endif -#endif /* __inline */ +# ifndef __inline__ +# if defined(__GNUC__) + /* gcc has __inline__ */ +# elif defined(__HIGHC__) +# define __inline__ _Inline +# else +# define __inline__ /**/ +# endif +# endif /* __inline__ */ +# ifndef __inline +# if defined(__GNUC__) + /* gcc has __inline */ +# elif defined(__HIGHC__) +# define __inline _Inline +# else +# define __inline /**/ +# endif +# endif /* __inline */ -#if defined(IODEBUG) && defined(__GNUC__) -#define outb RealOutb -#define outw RealOutw -#define outl RealOutl -#define inb RealInb -#define inw RealInw -#define inl RealInl -#endif +# if defined(IODEBUG) && defined(__GNUC__) +# define outb RealOutb +# define outw RealOutw +# define outl RealOutl +# define inb RealInb +# define inw RealInw +# define inl RealInl +# endif -#if defined(QNX4) /* Do this for now to keep Watcom happy */ -#define outb outp -#define outw outpw -#define outl outpd -#define inb inp -#define inw inpw -#define inl inpd +# if defined(QNX4) /* Do this for now to keep Watcom happy */ +# define outb outp +# define outw outpw +# define outl outpd +# define inb inp +# define inw inpw +# define inl inpd /* Define the ffs function for inlining */ extern int ffs(unsigned long); -#pragma aux ffs_ = \ +# pragma aux ffs_ = \ "bsf edx, eax" \ "jnz bits_set" \ "xor eax, eax" \ @@ -83,11 +83,12 @@ __modify [eax edx] \ __value [eax] \ ; -#endif +# endif -#if defined(NO_INLINE) || defined(DO_PROTOTYPES) +# if defined(NO_INLINE) || defined(DO_PROTOTYPES) -#if !defined(__sparc__) +# if !defined(__sparc__) && !defined(__arm32__) \ + && !(defined(__alpha__) && defined(linux)) extern void outb(unsigned short, unsigned char); extern void outw(unsigned short, unsigned short); @@ -96,7 +97,7 @@ extern unsigned int inw(unsigned short); extern unsigned int inl(unsigned short); -#else /* __sparc__ */ +# else /* __sparc__, __arm32__, __alpha__*/ extern void outb(unsigned long, unsigned char); extern void outw(unsigned long, unsigned short); @@ -105,7 +106,7 @@ extern unsigned int inw(unsigned long); extern unsigned int inl(unsigned long); -#endif /* __sparc__ */ +# endif /* __sparc__, __arm32__, __alpha__ */ extern unsigned long ldq_u(unsigned long *); extern unsigned long ldl_u(unsigned int *); @@ -119,73 +120,67 @@ extern void stw_brx(unsigned short, volatile unsigned char *, int); extern unsigned long ldl_brx(volatile unsigned char *, int); extern unsigned short ldw_brx(volatile unsigned char *, int); -extern unsigned char rdinx(unsigned short, unsigned char); -extern void wrinx(unsigned short, unsigned char, unsigned char); -extern void modinx(unsigned short, unsigned char, unsigned char, unsigned char); -extern int testrg(unsigned short, unsigned char); -extern int testinx2(unsigned short, unsigned char, unsigned char); -extern int testinx(unsigned short, unsigned char); - -#endif - -#ifndef NO_INLINE -#ifdef __GNUC__ +# endif -#if (defined(linux) || defined(__FreeBSD__)) && defined(__alpha__) +# ifndef NO_INLINE +# ifdef __GNUC__ +# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && defined(__alpha__) -#ifdef linux +# ifdef linux /* for Linux on Alpha, we use the LIBC _inx/_outx routines */ /* note that the appropriate setup via "ioperm" needs to be done */ /* *before* any inx/outx is done. */ -extern void _outb(char val, unsigned short port); +extern void (*_alpha_outb)(char val, unsigned long port); static __inline__ void -outb(unsigned short port, unsigned char val) +outb(unsigned long port, unsigned char val) { - _outb(val, port); + _alpha_outb(val, port); } -extern void _outw(short val, unsigned short port); +extern void (*_alpha_outw)(short val, unsigned long port); static __inline__ void -outw(unsigned short port, unsigned short val) +outw(unsigned long port, unsigned short val) { - _outw(val, port); + _alpha_outw(val, port); } -extern void _outl(int val, unsigned short port); +extern void (*_alpha_outl)(int val, unsigned long port); static __inline__ void -outl(unsigned short port, unsigned int val) +outl(unsigned long port, unsigned int val) { - _outl(val, port); + _alpha_outl(val, port); } -extern unsigned int _inb(unsigned short port); +extern unsigned int (*_alpha_inb)(unsigned long port); static __inline__ unsigned int -inb(unsigned short port) +inb(unsigned long port) { - return _inb(port); + return _alpha_inb(port); } -extern unsigned int _inw(unsigned short port); +extern unsigned int (*_alpha_inw)(unsigned long port); static __inline__ unsigned int -inw(unsigned short port) +inw(unsigned long port) { - return _inw(port); + return _alpha_inw(port); } -extern unsigned int _inl(unsigned short port); +extern unsigned int (*_alpha_inl)(unsigned long port); static __inline__ unsigned int -inl(unsigned short port) +inl(unsigned long port) { - return _inl(port); + return _alpha_inl(port); } -#endif /* linux */ +# endif /* linux */ -#if defined(__FreeBSD__) && !defined(DO_PROTOTYPES) +# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \ + && !defined(DO_PROTOTYPES) -/* for FreeBSD on Alpha, we use the libio inx/outx routines */ +/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */ +/* inx/outx routines */ /* note that the appropriate setup via "ioperm" needs to be done */ /* *before* any inx/outx is done. */ @@ -195,8 +190,13 @@ extern unsigned char inb(unsigned int port); extern unsigned short inw(unsigned int port); extern unsigned int inl(unsigned int port); + +# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */ + -#endif /* __FreeBSD__ && !DO_PROTOTYPES */ +#if defined(__NetBSD__) +#include +#endif /* __NetBSD__ */ /* * inline functions to do unaligned accesses @@ -219,10 +219,10 @@ static __inline__ unsigned long ldq_u(unsigned long * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) const struct __una_u64 *ptr = (const struct __una_u64 *) r11; return ptr->x; -#else +# else unsigned long r1,r2; __asm__("ldq_u %0,%3\n\t" "ldq_u %1,%4\n\t" @@ -233,15 +233,15 @@ "m" (*r11), "m" (*(const unsigned long *)(7+(char *) r11))); return r1 | r2; -#endif +# endif } static __inline__ unsigned long ldl_u(unsigned int * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) const struct __una_u32 *ptr = (const struct __una_u32 *) r11; return ptr->x; -#else +# else unsigned long r1,r2; __asm__("ldq_u %0,%3\n\t" "ldq_u %1,%4\n\t" @@ -252,15 +252,15 @@ "m" (*r11), "m" (*(const unsigned long *)(3+(char *) r11))); return r1 | r2; -#endif +# endif } static __inline__ unsigned long ldw_u(unsigned short * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) const struct __una_u16 *ptr = (const struct __una_u16 *) r11; return ptr->x; -#else +# else unsigned long r1,r2; __asm__("ldq_u %0,%3\n\t" "ldq_u %1,%4\n\t" @@ -271,7 +271,7 @@ "m" (*r11), "m" (*(const unsigned long *)(1+(char *) r11))); return r1 | r2; -#endif +# endif } /* @@ -280,10 +280,10 @@ static __inline__ void stq_u(unsigned long r5, unsigned long * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) struct __una_u64 *ptr = (struct __una_u64 *) r11; ptr->x = r5; -#else +# else unsigned long r1,r2,r3,r4; __asm__("ldq_u %3,%1\n\t" @@ -300,15 +300,15 @@ "=m" (*(unsigned long *)(7+(char *) r11)), "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) :"r" (r5), "r" (r11)); -#endif +# endif } static __inline__ void stl_u(unsigned long r5, unsigned int * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) struct __una_u32 *ptr = (struct __una_u32 *) r11; ptr->x = r5; -#else +# else unsigned long r1,r2,r3,r4; __asm__("ldq_u %3,%1\n\t" @@ -325,15 +325,15 @@ "=m" (*(unsigned long *)(3+(char *) r11)), "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) :"r" (r5), "r" (r11)); -#endif +# endif } static __inline__ void stw_u(unsigned long r5, unsigned short * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) struct __una_u16 *ptr = (struct __una_u16 *) r11; ptr->x = r5; -#else +# else unsigned long r1,r2,r3,r4; __asm__("ldq_u %3,%1\n\t" @@ -350,89 +350,89 @@ "=m" (*(unsigned long *)(1+(char *) r11)), "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) :"r" (r5), "r" (r11)); -#endif +# endif } /* to flush the I-cache before jumping to code which just got loaded */ -#define PAL_imb 134 -#define istream_mem_barrier() \ +# define PAL_imb 134 +# define istream_mem_barrier() \ __asm__ __volatile__("call_pal %0 #imb" : : "i" (PAL_imb) : "memory") -#define mem_barrier() __asm__ __volatile__("mb" : : : "memory") -#ifdef __ELF__ -#define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory") -#else /* ECOFF gas 2.6 doesn't know "wmb" :-( */ -#define write_mem_barrier() mem_barrier() -#endif +# define mem_barrier() __asm__ __volatile__("mb" : : : "memory") +# ifdef __ELF__ +# define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory") +# else /* ECOFF gas 2.6 doesn't know "wmb" :-( */ +# define write_mem_barrier() mem_barrier() +# endif -#elif defined(linux) && defined(__ia64__) +# elif defined(linux) && defined(__ia64__) -#include +# include -#include +# include struct __una_u64 { uint64_t x __attribute__((packed)); }; struct __una_u32 { uint32_t x __attribute__((packed)); }; struct __una_u16 { uint16_t x __attribute__((packed)); }; -extern __inline__ unsigned long +static __inline__ unsigned long __uldq (const unsigned long * r11) { const struct __una_u64 *ptr = (const struct __una_u64 *) r11; return ptr->x; } -extern __inline__ unsigned long +static __inline__ unsigned long __uldl (const unsigned int * r11) { const struct __una_u32 *ptr = (const struct __una_u32 *) r11; return ptr->x; } -extern __inline__ unsigned long +static __inline__ unsigned long __uldw (const unsigned short * r11) { const struct __una_u16 *ptr = (const struct __una_u16 *) r11; return ptr->x; } -extern __inline__ void +static __inline__ void __ustq (unsigned long r5, unsigned long * r11) { struct __una_u64 *ptr = (struct __una_u64 *) r11; ptr->x = r5; } -extern __inline__ void +static __inline__ void __ustl (unsigned long r5, unsigned int * r11) { struct __una_u32 *ptr = (struct __una_u32 *) r11; ptr->x = r5; } -extern __inline__ void +static __inline__ void __ustw (unsigned long r5, unsigned short * r11) { struct __una_u16 *ptr = (struct __una_u16 *) r11; ptr->x = r5; } -#define ldq_u(p) __uldq(p) -#define ldl_u(p) __uldl(p) -#define ldw_u(p) __uldw(p) -#define stq_u(v,p) __ustq(v,p) -#define stl_u(v,p) __ustl(v,p) -#define stw_u(v,p) __ustw(v,p) +# define ldq_u(p) __uldq(p) +# define ldl_u(p) __uldl(p) +# define ldw_u(p) __uldw(p) +# define stq_u(v,p) __ustq(v,p) +# define stl_u(v,p) __ustl(v,p) +# define stw_u(v,p) __ustw(v,p) -#define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") -#define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") +# define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") +# define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") /* * This is overkill, but for different reasons depending on where it is used. * This is thus general enough to be used everywhere cache flushes are needed. * It doesn't handle memory access serialisation by other processors, though. */ -#define ia64_flush_cache(Addr) \ +# define ia64_flush_cache(Addr) \ __asm__ __volatile__ ( \ "fc %0;;;" \ "sync.i;;;" \ @@ -440,24 +440,90 @@ "srlz.i;;;" \ :: "r"(Addr) : "memory") -#undef outb -#undef outw -#undef outl +# undef outb +# undef outw +# undef outl -#define outb(a,b) _outb(b,a) -#define outw(a,b) _outw(b,a) -#define outl(a,b) _outl(b,a) - -#elif (defined(linux) || defined(Lynx) || defined(sun)) && defined(__sparc__) - -#if !defined(Lynx) -#ifndef ASI_PL -#define ASI_PL 0x88 -#endif +# define outb(a,b) _outb(b,a) +# define outw(a,b) _outw(b,a) +# define outl(a,b) _outl(b,a) + +# elif defined(linux) && defined(__x86_64__) + +# include -#define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory") +# define ldq_u(p) (*((unsigned long *)(p))) +# define ldl_u(p) (*((unsigned int *)(p))) +# define ldw_u(p) (*((unsigned short *)(p))) +# define stq_u(v,p) (*(unsigned long *)(p)) = (v) +# define stl_u(v,p) (*(unsigned int *)(p)) = (v) +# define stw_u(v,p) (*(unsigned short *)(p)) = (v) + +# define mem_barrier() \ + __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory") +# define write_mem_barrier() \ + __asm__ __volatile__ ("": : :"memory") + static __inline__ void +outb(unsigned short port, unsigned char val) +{ + __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); +} + + +static __inline__ void +outw(unsigned short port, unsigned short val) +{ + __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ void +outl(unsigned short port, unsigned int val) +{ + __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(unsigned short port) +{ + unsigned char ret; + __asm__ __volatile__("inb %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(unsigned short port) +{ + unsigned short ret; + __asm__ __volatile__("inw %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inl(unsigned short port) +{ + unsigned int ret; + __asm__ __volatile__("inl %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__)) && defined(__sparc__) + +# if !defined(Lynx) +# ifndef ASI_PL +# define ASI_PL 0x88 +# endif + +# define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory") + +static __inline__ void outb(unsigned long port, unsigned char val) { __asm__ __volatile__("stba %0, [%1] %2" @@ -689,141 +755,146 @@ : "r" (val), "r" (addr), "i" (ASI_PL)); } -#endif /* !Lynx */ +# endif /* !Lynx */ /* * EGCS 1.1 knows about arbitrary unaligned loads. Define some * packed structures to talk about such things with. */ -#if defined(__arch64__) || defined(__sparcv9) +# if defined(__arch64__) || defined(__sparcv9) struct __una_u64 { unsigned long x __attribute__((packed)); }; -#endif +# endif struct __una_u32 { unsigned int x __attribute__((packed)); }; struct __una_u16 { unsigned short x __attribute__((packed)); }; static __inline__ unsigned long ldq_u(unsigned long *p) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 -#if defined(__arch64__) || defined(__sparcv9) +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) +# if defined(__arch64__) || defined(__sparcv9) const struct __una_u64 *ptr = (const struct __una_u64 *) p; -#else +# else const struct __una_u32 *ptr = (const struct __una_u32 *) p; -#endif +# endif return ptr->x; -#else +# else unsigned long ret; memmove(&ret, p, sizeof(*p)); return ret; -#endif +# endif } static __inline__ unsigned long ldl_u(unsigned int *p) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) const struct __una_u32 *ptr = (const struct __una_u32 *) p; return ptr->x; -#else +# else unsigned int ret; memmove(&ret, p, sizeof(*p)); return ret; -#endif +# endif } static __inline__ unsigned long ldw_u(unsigned short *p) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) const struct __una_u16 *ptr = (const struct __una_u16 *) p; return ptr->x; -#else +# else unsigned short ret; memmove(&ret, p, sizeof(*p)); return ret; -#endif +# endif } static __inline__ void stq_u(unsigned long val, unsigned long *p) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 -#if defined(__arch64__) || defined(__sparcv9) +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) +# if defined(__arch64__) || defined(__sparcv9) struct __una_u64 *ptr = (struct __una_u64 *) p; -#else +# else struct __una_u32 *ptr = (struct __una_u32 *) p; -#endif +# endif ptr->x = val; -#else +# else unsigned long tmp = val; memmove(p, &tmp, sizeof(*p)); -#endif +# endif } static __inline__ void stl_u(unsigned long val, unsigned int *p) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) struct __una_u32 *ptr = (struct __una_u32 *) p; ptr->x = val; -#else +# else unsigned int tmp = val; memmove(p, &tmp, sizeof(*p)); -#endif +# endif } static __inline__ void stw_u(unsigned long val, unsigned short *p) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91)) struct __una_u16 *ptr = (struct __una_u16 *) p; ptr->x = val; -#else +# else unsigned short tmp = val; memmove(p, &tmp, sizeof(*p)); -#endif +# endif } -#define mem_barrier() /* XXX: nop for now */ -#define write_mem_barrier() /* XXX: nop for now */ +# define mem_barrier() /* XXX: nop for now */ +# define write_mem_barrier() /* XXX: nop for now */ -#elif defined(__mips__) || defined(__arm32__) +# elif defined(__mips__) || defined(__arm32__) +#ifdef __arm32__ +#define PORT_SIZE long +#else +#define PORT_SIZE short +#endif unsigned int IOPortBase; /* Memory mapped I/O port area */ static __inline__ void -outb(unsigned short port, unsigned char val) +outb(unsigned PORT_SIZE port, unsigned char val) { - *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val; + *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val; } static __inline__ void -outw(unsigned short port, unsigned short val) +outw(unsigned PORT_SIZE port, unsigned short val) { - *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val; + *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val; } static __inline__ void -outl(unsigned short port, unsigned int val) +outl(unsigned PORT_SIZE port, unsigned int val) { - *(volatile unsigned int*)(((unsigned short)(port))+IOPortBase) = val; + *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val; } static __inline__ unsigned int -inb(unsigned short port) +inb(unsigned PORT_SIZE port) { - return *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase); + return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase); } static __inline__ unsigned int -inw(unsigned short port) +inw(unsigned PORT_SIZE port) { - return *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase); + return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase); } static __inline__ unsigned int -inl(unsigned short port) +inl(unsigned PORT_SIZE port) { - return *(volatile unsigned int*)(((unsigned short)(port))+IOPortBase); + return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase); } -#if defined(__mips__) +# if defined(__mips__) static __inline__ unsigned long ldq_u(unsigned long * r11) { unsigned long r1; @@ -860,7 +931,7 @@ return r1; } -#ifdef linux /* don't mess with other OSs */ +# ifdef linux /* don't mess with other OSs */ /* * EGCS 1.1 knows about arbitrary unaligned loads (and we don't support older @@ -883,7 +954,7 @@ ptr->x = val; } -#if X_BYTE_ORDER == X_BIG_ENDIAN +# if X_BYTE_ORDER == X_BIG_ENDIAN static __inline__ unsigned int xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) { @@ -906,54 +977,55 @@ : /* No outputs */ : "r" (val), "r" (addr)); } -#endif +# endif + +# define mem_barrier() \ + __asm__ __volatile__( \ + "# prevent instructions being moved around\n\t" \ + ".set\tnoreorder\n\t" \ + "# 8 nops to fool the R4400 pipeline\n\t" \ + "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \ + ".set\treorder" \ + : /* no output */ \ + : /* no input */ \ + : "memory") +# define write_mem_barrier() mem_barrier() + +# else /* !linux */ -#define mem_barrier() \ -__asm__ __volatile__( \ - "# prevent instructions being moved around\n\t" \ - ".set\tnoreorder\n\t" \ - "# 8 nops to fool the R4400 pipeline\n\t" \ - "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \ - ".set\treorder" \ - : /* no output */ \ - : /* no input */ \ - : "memory") -#define write_mem_barrier() mem_barrier() - -#else /* !linux */ -#define stq_u(v,p) stl_u(v,p) -#define stl_u(v,p) (*(unsigned char *)(p)) = (v); \ +# define stq_u(v,p) stl_u(v,p) +# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \ (*(unsigned char *)(p)+1) = ((v) >> 8); \ (*(unsigned char *)(p)+2) = ((v) >> 16); \ (*(unsigned char *)(p)+3) = ((v) >> 24) -#define stw_u(v,p) (*(unsigned char *)(p)) = (v); \ - (*(unsigned char *)(p)+1) = ((v) >> 8) +# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \ + (*(unsigned char *)(p)+1) = ((v) >> 8) -#define mem_barrier() /* NOP */ -#endif /* !linux */ -#endif /* __mips__ */ - -#if defined(__arm32__) -#define ldq_u(p) (*((unsigned long *)(p))) -#define ldl_u(p) (*((unsigned int *)(p))) -#define ldw_u(p) (*((unsigned short *)(p))) -#define stq_u(v,p) (*(unsigned long *)(p)) = (v) -#define stl_u(v,p) (*(unsigned int *)(p)) = (v) -#define stw_u(v,p) (*(unsigned short *)(p)) = (v) -#define mem_barrier() /* NOP */ -#define write_mem_barrier() /* NOP */ -#endif /* __arm32__ */ - -#elif (defined(Lynx) || defined(linux) || defined(__OpenBSD__)) && defined(__powerpc__) - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif +# define mem_barrier() /* NOP */ +# endif /* !linux */ +# endif /* __mips__ */ + +# if defined(__arm32__) +# define ldq_u(p) (*((unsigned long *)(p))) +# define ldl_u(p) (*((unsigned int *)(p))) +# define ldw_u(p) (*((unsigned short *)(p))) +# define stq_u(v,p) (*(unsigned long *)(p)) = (v) +# define stl_u(v,p) (*(unsigned int *)(p)) = (v) +# define stw_u(v,p) (*(unsigned short *)(p)) = (v) +# define mem_barrier() /* NOP */ +# define write_mem_barrier() /* NOP */ +# endif /* __arm32__ */ + +# elif (defined(Lynx) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__powerpc__) + +# ifndef MAP_FAILED +# define MAP_FAILED ((void *)-1) +# endif extern volatile unsigned char *ioBase; -#define eieio() __asm__ __volatile__ ("eieio") +# define eieio() __asm__ __volatile__ ("eieio" ::: "memory") static __inline__ unsigned char xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) @@ -1153,38 +1225,38 @@ return xf86ReadMmio32Le((void *)ioBase, port); } -#define ldq_u(p) ldl_u(p) -#define ldl_u(p) ((*(unsigned char *)(p)) | \ +# define ldq_u(p) ldl_u(p) +# define ldl_u(p) ((*(unsigned char *)(p)) | \ (*((unsigned char *)(p)+1)<<8) | \ (*((unsigned char *)(p)+2)<<16) | \ (*((unsigned char *)(p)+3)<<24)) -#define ldw_u(p) ((*(unsigned char *)(p)) | \ +# define ldw_u(p) ((*(unsigned char *)(p)) | \ (*((unsigned char *)(p)+1)<<8)) -#define stq_u(v,p) stl_u(v,p) -#define stl_u(v,p) (*(unsigned char *)(p)) = (v); \ - (*((unsigned char *)(p)+1)) = ((v) >> 8); \ - (*((unsigned char *)(p)+2)) = ((v) >> 16); \ - (*((unsigned char *)(p)+3)) = ((v) >> 24) -#define stw_u(v,p) (*(unsigned char *)(p)) = (v); \ - (*((unsigned char *)(p)+1)) = ((v) >> 8) - -#define mem_barrier() eieio() -#define write_mem_barrier() eieio() - -#else /* ix86 */ - -#define ldq_u(p) (*((unsigned long *)(p))) -#define ldl_u(p) (*((unsigned int *)(p))) -#define ldw_u(p) (*((unsigned short *)(p))) -#define stq_u(v,p) (*(unsigned long *)(p)) = (v) -#define stl_u(v,p) (*(unsigned int *)(p)) = (v) -#define stw_u(v,p) (*(unsigned short *)(p)) = (v) -#define mem_barrier() /* NOP */ -#define write_mem_barrier() /* NOP */ +# define stq_u(v,p) stl_u(v,p) +# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \ + (*((unsigned char *)(p)+1)) = ((v) >> 8); \ + (*((unsigned char *)(p)+2)) = ((v) >> 16); \ + (*((unsigned char *)(p)+3)) = ((v) >> 24) +# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \ + (*((unsigned char *)(p)+1)) = ((v) >> 8) + +# define mem_barrier() eieio() +# define write_mem_barrier() eieio() + +# else /* ix86 */ + +# define ldq_u(p) (*((unsigned long *)(p))) +# define ldl_u(p) (*((unsigned int *)(p))) +# define ldw_u(p) (*((unsigned short *)(p))) +# define stq_u(v,p) (*(unsigned long *)(p)) = (v) +# define stl_u(v,p) (*(unsigned int *)(p)) = (v) +# define stw_u(v,p) (*(unsigned short *)(p)) = (v) +# define mem_barrier() /* NOP */ +# define write_mem_barrier() /* NOP */ -#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) -#ifdef GCCUSESGAS +# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) +# ifdef GCCUSESGAS /* * If gcc uses gas rather than the native assembler, the syntax of these @@ -1240,7 +1312,7 @@ return ret; } -#else /* GCCUSESGAS */ +# else /* GCCUSESGAS */ static __inline__ void outb(unsigned short port, unsigned char val) @@ -1290,9 +1362,9 @@ return ret; } -#endif /* GCCUSESGAS */ +# endif /* GCCUSESGAS */ -#else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) */ +# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)*/ static __inline__ void outb(unsigned short port, unsigned char val) @@ -1327,53 +1399,53 @@ return 0; } -#endif /* FAKEIT */ +# endif /* FAKEIT */ -#endif /* ix86 */ +# endif /* ix86 */ -#elif defined(__powerpc__) /* && !__GNUC__ */ +# elif defined(__powerpc__) /* && !__GNUC__ */ /* * NON-GCC PowerPC - Presumed to be PowerMAX OS for now */ -# ifndef PowerMAX_OS -# error - Non-gcc PowerPC and !PowerMAXOS ??? -# endif +# ifndef PowerMAX_OS +# error - Non-gcc PowerPC and !PowerMAXOS ??? +# endif -#define PPCIO_DEBUG 0 -#define PPCIO_INLINE 1 -#define USE_ABS_MACRO 1 +# define PPCIO_DEBUG 0 +# define PPCIO_INLINE 1 +# define USE_ABS_MACRO 1 /* * Use compiler intrinsics to access certain PPC machine instructions */ -#define eieio() __inst_eieio() -#define stw_brx(val,base,ndx) __inst_sthbrx(val,base,ndx) -#define stl_brx(val,base,ndx) __inst_stwbrx(val,base,ndx) -#define ldw_brx(base,ndx) __inst_lhbrx(base,ndx) -#define ldl_brx(base,ndx) __inst_lwbrx(base,ndx) - -#define ldq_u(p) (*((unsigned long long *)(p))) -#define ldl_u(p) (*((unsigned long *)(p))) -#define ldw_u(p) (*((unsigned short *)(p))) -#define stq_u(v,p) (*(unsigned long long *)(p)) = (v) -#define stl_u(v,p) (*(unsigned long *)(p)) = (v) -#define stw_u(v,p) (*(unsigned short *)(p)) = (v) -#define mem_barrier() eieio() -#define write_mem_barrier() eieio() +# define eieio() __inst_eieio() +# define stw_brx(val,base,ndx) __inst_sthbrx(val,base,ndx) +# define stl_brx(val,base,ndx) __inst_stwbrx(val,base,ndx) +# define ldw_brx(base,ndx) __inst_lhbrx(base,ndx) +# define ldl_brx(base,ndx) __inst_lwbrx(base,ndx) + +# define ldq_u(p) (*((unsigned long long *)(p))) +# define ldl_u(p) (*((unsigned long *)(p))) +# define ldw_u(p) (*((unsigned short *)(p))) +# define stq_u(v,p) (*(unsigned long long *)(p)) = (v) +# define stl_u(v,p) (*(unsigned long *)(p)) = (v) +# define stw_u(v,p) (*(unsigned short *)(p)) = (v) +# define mem_barrier() eieio() +# define write_mem_barrier() eieio() extern volatile unsigned char *ioBase; -#if !defined(abs) && defined(USE_ABS_MACRO) -#define abs(x) ((x) >= 0 ? (x) : -(x)) -#endif +# if !defined(abs) && defined(USE_ABS_MACRO) +# define abs(x) ((x) >= 0 ? (x) : -(x)) +# endif -#undef inb -#undef inw -#undef inl -#undef outb -#undef outw -#undef outl +# undef inb +# undef inw +# undef inl +# undef outb +# undef outw +# undef outl -#if PPCIO_DEBUG +# if PPCIO_DEBUG extern void debug_outb(unsigned int a, unsigned char b, int line, char *file); extern void debug_outw(unsigned int a, unsigned short w, int line, char *file); @@ -1382,217 +1454,119 @@ extern unsigned short debug_inw(unsigned int a, int line, char *file); extern unsigned int debug_inl(unsigned int a, int line, char *file); -#define outb(a,b) debug_outb(a,b, __LINE__, __FILE__) -#define outw(a,w) debug_outw(a,w, __LINE__, __FILE__) -#define outl(a,l) debug_outl(a,l, __LINE__, __FILE__) -#define inb(a) debug_inb(a, __LINE__, __FILE__) -#define inw(a) debug_inw(a, __LINE__, __FILE__) -#define inl(a) debug_inl(a, __LINE__, __FILE__) +# define outb(a,b) debug_outb(a,b, __LINE__, __FILE__) +# define outw(a,w) debug_outw(a,w, __LINE__, __FILE__) +# define outl(a,l) debug_outl(a,l, __LINE__, __FILE__) +# define inb(a) debug_inb(a, __LINE__, __FILE__) +# define inw(a) debug_inw(a, __LINE__, __FILE__) +# define inl(a) debug_inl(a, __LINE__, __FILE__) -#else /* !PPCIO_DEBUG */ +# else /* !PPCIO_DEBUG */ extern unsigned char inb(unsigned int a); extern unsigned short inw(unsigned int a); extern unsigned int inl(unsigned int a); -# if PPCIO_INLINE +# if PPCIO_INLINE -#define outb(a,b) (*((volatile unsigned char *)(ioBase + (a))) = (b), eieio()) -#define outw(a,w) (stw_brx((w),ioBase,(a)), eieio()) -#define outl(a,l) (stl_brx((l),ioBase,(a)), eieio()) +# define outb(a,b) \ + (*((volatile unsigned char *)(ioBase + (a))) = (b), eieio()) +# define outw(a,w) (stw_brx((w),ioBase,(a)), eieio()) +# define outl(a,l) (stl_brx((l),ioBase,(a)), eieio()) -# else /* !PPCIO_INLINE */ +# else /* !PPCIO_INLINE */ extern void outb(unsigned int a, unsigned char b); extern void outw(unsigned int a, unsigned short w); extern void outl(unsigned int a, unsigned int l); -# endif /* PPCIO_INLINE */ +# endif /* PPCIO_INLINE */ -#endif /* !PPCIO_DEBUG */ +# endif /* !PPCIO_DEBUG */ -#else /* !GNUC && !PPC */ -#if !defined(QNX4) -# if defined(__STDC__) && (__STDC__ == 1) -# ifndef asm -# define asm __asm -# endif -# endif -# ifdef SVR4 +# else /* !GNUC && !PPC */ +# if !defined(QNX4) +# if defined(__STDC__) && (__STDC__ == 1) +# ifndef asm +# define asm __asm +# endif +# endif +# ifdef SVR4 #if 0 -# include +# include #endif -# ifndef __HIGHC__ -# ifndef __USLC__ -# define __USLC__ -# endif -# endif -# endif -# ifndef SCO325 -# if defined(USL) -# if defined(IN_MODULE) +# ifndef __HIGHC__ +# ifndef __USLC__ +# define __USLC__ +# endif +# endif +# endif +# ifndef SCO325 +# if defined(USL) +# if defined(IN_MODULE) # /* avoid including for on UnixWare */ -# define ushort unsigned short -# define ushort_t unsigned short -# define ulong unsigned long -# define ulong_t unsigned long -# define uint_t unsigned int -# define uchar_t unsigned char +# define ushort unsigned short +# define ushort_t unsigned short +# define ulong unsigned long +# define ulong_t unsigned long +# define uint_t unsigned int +# define uchar_t unsigned char +# else +# include +# endif /* IN_MODULE */ +# endif /* USL */ +# include # else -# include -# endif /* IN_MODULE */ -# endif /* USL */ -# include -# else -# include "scoasm.h" -# endif - -# if !defined(__HIGHC__) && !defined(SCO325) -# pragma asm partial_optimization outl -# pragma asm partial_optimization outw -# pragma asm partial_optimization outb -# pragma asm partial_optimization inl -# pragma asm partial_optimization inw -# pragma asm partial_optimization inb -# endif -#endif -#define ldq_u(p) (*((unsigned long *)(p))) -#define ldl_u(p) (*((unsigned int *)(p))) -#define ldw_u(p) (*((unsigned short *)(p))) -#define stq_u(v,p) (*(unsigned long *)(p)) = (v) -#define stl_u(v,p) (*(unsigned int *)(p)) = (v) -#define stw_u(v,p) (*(unsigned short *)(p)) = (v) -#define mem_barrier() /* NOP */ -#define write_mem_barrier() /* NOP */ -#endif /* __GNUC__ */ +# include "scoasm.h" +# endif +# if !defined(__HIGHC__) && !defined(SCO325) +# pragma asm partial_optimization outl +# pragma asm partial_optimization outw +# pragma asm partial_optimization outb +# pragma asm partial_optimization inl +# pragma asm partial_optimization inw +# pragma asm partial_optimization inb +# endif +# endif +# define ldq_u(p) (*((unsigned long *)(p))) +# define ldl_u(p) (*((unsigned int *)(p))) +# define ldw_u(p) (*((unsigned short *)(p))) +# define stq_u(v,p) (*(unsigned long *)(p)) = (v) +# define stl_u(v,p) (*(unsigned int *)(p)) = (v) +# define stw_u(v,p) (*(unsigned short *)(p)) = (v) +# define mem_barrier() /* NOP */ +# define write_mem_barrier() /* NOP */ +# endif /* __GNUC__ */ -#if defined(QNX4) -#include +# if defined(QNX4) +# include extern unsigned inb(unsigned port); extern unsigned inw(unsigned port); extern unsigned inl(unsigned port); extern void outb(unsigned port, unsigned val); extern void outw(unsigned port, unsigned val); extern void outl(unsigned port, unsigned val); -#endif /* QNX4 */ - -#if defined(IODEBUG) && defined(__GNUC__) -#undef inb -#undef inw -#undef inl -#undef outb -#undef outw -#undef outl -#define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) -#define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) -#define inl(a) __extension__ ({unsigned int __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) - -#define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b)) -#define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b)) -#define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b)) -#endif - -/* - * This header sometimes gets included where is isn't needed, and on some OSs - * this causes problems because the following functions generate references to - * inx() and outx() which can't be resolved. If you need the extra definitions - * below, #define COMPILER_H_EXTRAS. - */ - -#ifdef COMPILER_H_EXTRAS -/* - *----------------------------------------------------------------------- - * Port manipulation convenience functions - *----------------------------------------------------------------------- - */ - -/* - * rdinx - read the indexed byte port 'port', index 'ind', and return its value - */ -static __inline__ unsigned char -rdinx(unsigned short port, unsigned char ind) -{ - if (port == 0x3C0) /* reset attribute flip-flop */ - (void) inb(0x3DA); - outb(port, ind); - return inb(port+1); -} - -/* - * wrinx - write 'val' to port 'port', index 'ind' - */ -static __inline__ void -wrinx(unsigned short port, unsigned char ind, unsigned char val) -{ - outb(port, ind); - outb(port+1, val); -} +# endif /* QNX4 */ -/* - * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new'; - * the other bits are unchanged. - */ -static __inline__ void -modinx(unsigned short port, unsigned char ind, - unsigned char mask, unsigned char new) -{ - unsigned char tmp; - - tmp = (rdinx(port, ind) & ~mask) | (new & mask); - wrinx(port, ind, tmp); -} - -/* - * tstrg - returns true iff the bits in 'mask' of register 'port' are - * readable & writable. - */ - -static __inline__ int -testrg(unsigned short port, unsigned char mask) -{ - unsigned char old, new1, new2; - - old = inb(port); - outb(port, old & ~mask); - new1 = inb(port) & mask; - outb(port, old | mask); - new2 = inb(port) & mask; - outb(port, old); - return (new1 == 0) && (new2 == mask); -} - -/* - * testinx2 - returns true iff the bits in 'mask' of register 'port', index - * 'ind' are readable & writable. - */ -static __inline__ int -testinx2(unsigned short port, unsigned char ind, unsigned char mask) -{ - unsigned char old, new1, new2; - - old = rdinx(port, ind); - wrinx(port, ind, old & ~mask); - new1 = rdinx(port, ind) & mask; - wrinx(port, ind, old | mask); - new2 = rdinx(port, ind) & mask; - wrinx(port, ind, old); - return (new1 == 0) && (new2 == mask); -} - -/* - * testinx - returns true iff all bits of register 'port', index 'ind' are - * readable & writable. - */ -static __inline__ int -testinx(unsigned short port, unsigned char ind) -{ - return testinx2(port, ind, 0xFF); -} -#endif /* COMPILER_H_EXTRAS */ +# if defined(IODEBUG) && defined(__GNUC__) +# undef inb +# undef inw +# undef inl +# undef outb +# undef outw +# undef outl +# define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) +# define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) +# define inl(a) __extension__ ({unsigned int __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) + +# define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b)) +# define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b)) +# define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b)) +# endif -#endif /* NO_INLINE */ +# endif /* NO_INLINE */ -#ifdef __alpha__ +# ifdef __alpha__ /* entry points for Mmio memory access routines */ extern int (*xf86ReadMmio8)(void *, unsigned long); extern int (*xf86ReadMmio16)(void *, unsigned long); @@ -1610,74 +1584,74 @@ /* Some macros to hide the system dependencies for MMIO accesses */ /* Changed to kill noise generated by gcc's -Wcast-align */ -#define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset) -#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset) -#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset) +# define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset) +# define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset) +# define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset) -# if defined (JENSEN_SUPPORT) -#define MMIO_OUT32(base, offset, val) \ +# if defined (JENSEN_SUPPORT) +# define MMIO_OUT32(base, offset, val) \ (*xf86WriteMmio32)((CARD32)(val), base, offset) -#define MMIO_ONB32(base, offset, val) \ +# define MMIO_ONB32(base, offset, val) \ (*xf86WriteMmioNB32)((CARD32)(val), base, offset) -# else -#define MMIO_OUT32(base, offset, val) \ +# else +# define MMIO_OUT32(base, offset, val) \ do { \ write_mem_barrier(); \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ } while (0) -#define MMIO_ONB32(base, offset, val) \ +# define MMIO_ONB32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) -# endif +# endif -#define MMIO_OUT8(base, offset, val) \ +# define MMIO_OUT8(base, offset, val) \ (*xf86WriteMmio8)((CARD8)(val), base, offset) -#define MMIO_OUT16(base, offset, val) \ +# define MMIO_OUT16(base, offset, val) \ (*xf86WriteMmio16)((CARD16)(val), base, offset) -#define MMIO_ONB8(base, offset, val) \ +# define MMIO_ONB8(base, offset, val) \ (*xf86WriteMmioNB8)((CARD8)(val), base, offset) -#define MMIO_ONB16(base, offset, val) \ +# define MMIO_ONB16(base, offset, val) \ (*xf86WriteMmioNB16)((CARD16)(val), base, offset) -#define MMIO_MOVE32(base, offset, val) \ +# define MMIO_MOVE32(base, offset, val) \ MMIO_OUT32(base, offset, val) -#elif defined(__powerpc__) +# elif defined(__powerpc__) /* * we provide byteswapping and no byteswapping functions here * with byteswapping as default, * drivers that don't need byteswapping should define PPC_MMIO_IS_BE */ -# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) -# define MMIO_OUT8(base, offset, val) \ +# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) +# define MMIO_OUT8(base, offset, val) \ xf86WriteMmio8(base, offset, (CARD8)(val)) -# define MMIO_ONB8(base, offset, val) \ +# define MMIO_ONB8(base, offset, val) \ xf86WriteMmioNB8(base, offset, (CARD8)(val)) -# if defined(PPC_MMIO_IS_BE) /* No byteswapping */ -# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) -# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) -# define MMIO_OUT16(base, offset, val) \ +# if defined(PPC_MMIO_IS_BE) /* No byteswapping */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) +# define MMIO_OUT16(base, offset, val) \ xf86WriteMmio16Be(base, offset, (CARD16)(val)) -# define MMIO_OUT32(base, offset, val) \ +# define MMIO_OUT32(base, offset, val) \ xf86WriteMmio32Be(base, offset, (CARD32)(val)) -# define MMIO_ONB16(base, offset, val) \ +# define MMIO_ONB16(base, offset, val) \ xf86WriteMmioNB16Be(base, offset, (CARD16)(val)) -# define MMIO_ONB32(base, offset, val) \ +# define MMIO_ONB32(base, offset, val) \ xf86WriteMmioNB32Be(base, offset, (CARD32)(val)) -# else /* byteswapping is the default */ -# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) -# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) -# define MMIO_OUT16(base, offset, val) \ - xf86WriteMmio16Le(base, offset, (CARD16)(val)) -# define MMIO_OUT32(base, offset, val) \ - xf86WriteMmio32Le(base, offset, (CARD32)(val)) -# define MMIO_ONB16(base, offset, val) \ - xf86WriteMmioNB16Le(base, offset, (CARD16)(val)) -# define MMIO_ONB32(base, offset, val) \ - xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) -# endif +# else /* byteswapping is the default */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Le(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Le(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmioNB16Le(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) +# endif -#define MMIO_MOVE32(base, offset, val) \ - xf86WriteMmio32Be(base, offset, (CARD32)(val)) +# define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) static __inline__ void ppc_flush_icache(char *addr) { @@ -1690,7 +1664,7 @@ : : "r"(addr) : "memory"); } -#elif defined(__sparc__) +# elif defined(__sparc__) /* * Like powerpc, we provide byteswapping and no byteswapping functions * here with byteswapping as default, drivers that don't need byteswapping @@ -1698,72 +1672,72 @@ * do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places * of drivers?). */ -# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) -# define MMIO_OUT8(base, offset, val) \ +# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) +# define MMIO_OUT8(base, offset, val) \ xf86WriteMmio8(base, offset, (CARD8)(val)) -# define MMIO_ONB8(base, offset, val) \ +# define MMIO_ONB8(base, offset, val) \ xf86WriteMmio8NB(base, offset, (CARD8)(val)) -# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */ -# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) -# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) -# define MMIO_OUT16(base, offset, val) \ - xf86WriteMmio16Be(base, offset, (CARD16)(val)) -# define MMIO_OUT32(base, offset, val) \ - xf86WriteMmio32Be(base, offset, (CARD32)(val)) -# define MMIO_ONB16(base, offset, val) \ - xf86WriteMmio16BeNB(base, offset, (CARD16)(val)) -# define MMIO_ONB32(base, offset, val) \ - xf86WriteMmio32BeNB(base, offset, (CARD32)(val)) -# else /* byteswapping is the default */ -# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) -# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) -# define MMIO_OUT16(base, offset, val) \ - xf86WriteMmio16Le(base, offset, (CARD16)(val)) -# define MMIO_OUT32(base, offset, val) \ - xf86WriteMmio32Le(base, offset, (CARD32)(val)) -# define MMIO_ONB16(base, offset, val) \ - xf86WriteMmio16LeNB(base, offset, (CARD16)(val)) -# define MMIO_ONB32(base, offset, val) \ - xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) -# endif +# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Be(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmio16BeNB(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmio32BeNB(base, offset, (CARD32)(val)) +# else /* byteswapping is the default */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Le(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Le(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmio16LeNB(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) +# endif -#define MMIO_MOVE32(base, offset, val) \ - xf86WriteMmio32Be(base, offset, (CARD32)(val)) +# define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) -#else /* !__alpha__ && !__powerpc__ && !__sparc__ */ +# else /* !__alpha__ && !__powerpc__ && !__sparc__ */ -#define MMIO_IN8(base, offset) \ +# define MMIO_IN8(base, offset) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) -#define MMIO_IN16(base, offset) \ +# define MMIO_IN16(base, offset) \ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) -#define MMIO_IN32(base, offset) \ +# define MMIO_IN32(base, offset) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) -#define MMIO_OUT8(base, offset, val) \ +# define MMIO_OUT8(base, offset, val) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val) -#define MMIO_OUT16(base, offset, val) \ +# define MMIO_OUT16(base, offset, val) \ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val) -#define MMIO_OUT32(base, offset, val) \ +# define MMIO_OUT32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) -#define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val) -#define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) -#define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) +# define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val) +# define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) +# define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) -#define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val) +# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val) -#endif /* __alpha__ */ +# endif /* __alpha__ */ /* * With Intel, the version in os-support/misc/SlowBcopy.s is used. * This avoids port I/O during the copy (which causes problems with * some hardware). */ -#ifdef __alpha__ -#define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count) -#define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count) -#else /* __alpha__ */ -#define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count) -#define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count) -#endif /* __alpha__ */ +# ifdef __alpha__ +# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count) +# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count) +# else /* __alpha__ */ +# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count) +# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count) +# endif /* __alpha__ */ #endif /* _COMPILER_H */ Index: xc/programs/Xserver/hw/xfree86/common/xf86.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86.h:3.157 xc/programs/Xserver/hw/xfree86/common/xf86.h:3.169 --- xc/programs/Xserver/hw/xfree86/common/xf86.h:3.157 Thu Dec 13 13:01:50 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86.h Thu Feb 13 05:49:38 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.157 2001/12/13 18:01:50 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.169 2003/02/13 10:49:38 eich Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -43,6 +43,7 @@ extern Bool sbusSlotClaimed; #endif extern confDRIRec xf86ConfigDRI; +extern Bool xf86inSuspend; #define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) @@ -78,10 +79,9 @@ Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func); Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func); +void xf86FormatPciBusNumber(int busnum, char *buffer); pciVideoPtr *xf86GetPciVideoInfo(void); -#ifdef _XF86PCI_H pciConfigPtr *xf86GetPciConfigInfo(void); -#endif void xf86SetPciVideo(pciVideoPtr, resType); void xf86PrintResList(int verb, resPtr list); resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex); @@ -90,6 +90,7 @@ int xf86GetFbInfoForScreen(int scrnIndex); Bool xf86ParseIsaBusString(const char *busID); int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); +int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); void xf86EnableAccess(ScrnInfoPtr pScrn); void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn); Bool xf86IsPrimaryPci(pciVideoPtr pPci); @@ -114,7 +115,8 @@ Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, pointer); void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type); -resPtr xf86RegisterResources(int entityIndex, resList list, int Access); +resPtr xf86RegisterResources(int entityIndex, resList list, + unsigned long Access); Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base); void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, xf86SetAccessFuncPtr oldFuncs); @@ -139,7 +141,9 @@ char n, pciVideoPtr pvp_exclude); pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, char n, pciVideoPtr pvp_exclude); +#ifdef INCLUDE_DEPRECATED void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable); +#endif void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); #ifdef async @@ -169,10 +173,11 @@ void xf86LockZoom(ScreenPtr pScreen, int lock); void xf86InitViewport(ScrnInfoPtr pScr); void xf86SetViewport(ScreenPtr pScreen, int x, int y); -Bool xf86ZoomLocked(ScreenPtr pScreen); void xf86ZoomViewport(ScreenPtr pScreen, int zoom); +Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode); void *xf86GetPointerScreenFuncs(void); void xf86InitOrigins(void); +void xf86ReconfigureLayout(void); /* xf86DPMS.c */ @@ -193,6 +198,8 @@ void xf86EnableInputHandler(pointer handler); void xf86InterceptSignals(int *signo); Bool xf86EnableVTSwitch(Bool new); +Bool xf86CommonSpecialKey(int key, Bool down, int modifiers); +void xf86ProcessActionEvent(ActionEvent action, void *arg); /* xf86Helper.c */ @@ -237,8 +244,9 @@ void xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), void (*ProtectRegs)(ScrnInfoPtr, Bool), - void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg, - int maskval, int knownclkindex, int knownclkvalue); + void (*BlankScreen)(ScrnInfoPtr, Bool), + IOADDRESS vertsyncreg, int maskval, + int knownclkindex, int knownclkvalue); void xf86SetPriority(Bool up); const char *xf86GetVisualName(int visual); int xf86GetVerbosity(void); @@ -260,6 +268,9 @@ Bool xf86GetModInDevEnabled(void); Bool xf86GetAllowMouseOpenFail(void); Bool xf86IsPc98(void); +void xf86DisableRandR(void); +CARD32 xf86GetVersion(void); +CARD32 xf86GetModuleVersion(pointer module); pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name); pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); pointer xf86LoadOneModule(char *name, pointer optlist); @@ -379,6 +390,13 @@ /* xf86Option.c */ void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts); + + +/* xf86RandR.c */ +#ifdef RANDR +Bool xf86RandRInit (ScreenPtr pScreen); +void xf86RandRSetInitialMode (ScreenPtr pScreen); +#endif /* xf86VidModeExtentionInit.c */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Beta.c:3.8 xc/programs/Xserver/hw/xfree86/common/xf86Beta.c:3.9 --- xc/programs/Xserver/hw/xfree86/common/xf86Beta.c:3.8 Wed Jul 25 11:05:05 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Beta.c Fri May 31 14:45:57 2002 @@ -1,6 +1,6 @@ /* Copyright 1996, The XFree86 Project, Inc */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c,v 3.8 2001/07/25 15:05:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c,v 3.9 2002/05/31 18:45:57 dawes Exp $ */ /* * This is for publicly released beta server binaries. @@ -152,11 +152,9 @@ #if 0 /* This doesn't work when the server is started by xinit */ -#ifndef __EMX__ /* See if /dev/tty can be opened */ m = fopen("/dev/tty", "r+"); #endif -#endif if (m) requireconfirm = TRUE; @@ -221,7 +219,7 @@ } if (writefile) { -#if !defined(__EMX__) +#if !defined(__UNIXOS2__) #if defined(SYSV) || defined(linux) /* Need to fork to change to ruid without loosing euid */ if (getuid() != 0) { @@ -254,9 +252,9 @@ #endif } #endif /* SYSV || linux */ -#else /* __EMX__ */ +#else /* __UNIXOS2__ */ WRITE_BETA_FILE -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ } if (filename) { DEALLOCATE_LOCAL(filename); Index: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.67 xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.76 --- xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.67 Sat Oct 27 23:33:17 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Bus.c Fri Feb 21 12:19:34 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.67 2001/10/28 03:33:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.76 2003/02/21 17:19:34 tsi Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -86,7 +86,7 @@ xf86BusProbe(void) { xf86PciProbe(); -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) xf86SbusProbe(); #endif } @@ -281,6 +281,7 @@ pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList, pScrn->numEntities * sizeof(int)); pScrn->entityInstanceList[pScrn->numEntities - 1] = 0; + pScrn->domainIOBase = xf86Entities[entityIndex]->domainIO; } void @@ -355,35 +356,33 @@ void xf86ClearEntityListForScreen(int scrnIndex) { - int i; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; EntityAccessPtr peacc; + int i, entityIndex; - if (xf86Screens[scrnIndex]->entityList == NULL - || xf86Screens[scrnIndex]->numEntities == 0) return; + if (pScrn->entityList == NULL || pScrn->numEntities == 0) return; - for (i=0; inumEntities; i++) { - xf86Entities[xf86Screens[scrnIndex]->entityList[i]]->inUse = FALSE; + for (i = 0; i < pScrn->numEntities; i++) { + entityIndex = pScrn->entityList[i]; + xf86Entities[entityIndex]->inUse = FALSE; /* disable resource: call the disable function */ - peacc = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]->access; + peacc = xf86Entities[entityIndex]->access; if (peacc->pAccess && peacc->pAccess->AccessDisable) peacc->pAccess->AccessDisable(peacc->pAccess->arg); /* and the fallback function */ if (peacc->fallback && peacc->fallback->AccessDisable) peacc->fallback->AccessDisable(peacc->fallback->arg); /* shared resources are only needed when entity is active: remove */ - xf86DeallocateResourcesForEntity(i, ResShared); + xf86DeallocateResourcesForEntity(entityIndex, ResShared); } - xfree(xf86Screens[scrnIndex]->entityList); - if (xf86Screens[scrnIndex]->entityInstanceList) - xfree(xf86Screens[scrnIndex]->entityInstanceList); - if (xf86Screens[scrnIndex]->CurrentAccess->pIoAccess - == (EntityAccessPtr) xf86Screens[scrnIndex]->access) - xf86Screens[scrnIndex]->CurrentAccess->pIoAccess = NULL; - if (xf86Screens[scrnIndex]->CurrentAccess->pMemAccess - == (EntityAccessPtr) xf86Screens[scrnIndex]->access) - xf86Screens[scrnIndex]->CurrentAccess->pMemAccess = NULL; - xf86Screens[scrnIndex]->entityList = NULL; - xf86Screens[scrnIndex]->entityInstanceList = NULL; + xfree(pScrn->entityList); + xfree(pScrn->entityInstanceList); + if (pScrn->CurrentAccess->pIoAccess == (EntityAccessPtr)pScrn->access) + pScrn->CurrentAccess->pIoAccess = NULL; + if (pScrn->CurrentAccess->pMemAccess == (EntityAccessPtr)pScrn->access) + pScrn->CurrentAccess->pMemAccess = NULL; + pScrn->entityList = NULL; + pScrn->entityInstanceList = NULL; } void @@ -1027,6 +1026,10 @@ int i; BusType loc = BUS_NONE; BusType r_loc = BUS_NONE; + + /* Ignore overlapped ranges that have been nullified */ + if ((pRes->res_type & ResOverlap) && (pRes->block_begin > pRes->block_end)) + return FALSE; if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask)) return FALSE; @@ -1276,14 +1279,17 @@ if ((list->res_type & ResPhysMask) == type) { switch (list->res_type & ResExtMask) { case ResBlock: - xf86ErrorFVerb(verb, "\t[%d] %d\t0x%08x - 0x%08x (0x%x)", - i, list->entityIndex, list->block_begin, - list->block_end, + xf86ErrorFVerb(verb, + "\t[%d] %d\t%d\t0x%08lx - 0x%08lx (0x%lx)", + i, list->entityIndex, + (list->res_type & ResDomain) >> 24, + list->block_begin, list->block_end, list->block_end - list->block_begin + 1); break; case ResSparse: - xf86ErrorFVerb(verb, "\t[%d] %d\t0x%08x - 0x%08x ", + xf86ErrorFVerb(verb, "\t[%d] %d\t%d\t0x%08lx - 0x%08lx ", i, list->entityIndex, + (list->res_type & ResDomain) >> 24, list->sparse_base,list->sparse_mask); break; default: @@ -1321,6 +1327,8 @@ xf86ErrorFVerb(verb, "%s", s); if (list->res_type & ResEstimated) xf86ErrorFVerb(verb, "E"); + if (list->res_type & ResOverlap) + xf86ErrorFVerb(verb, "O"); if (list->res_type & ResInit) xf86ErrorFVerb(verb, "t"); if (list->res_type & ResBios) @@ -1414,17 +1422,26 @@ if (!useEstimated && (pRes->res_type & ResEstimated)) continue; /* * Target should be a larger region than pRes. If pRes fully - * contains target, don't do anything. + * contains target, don't do anything unless target can overlap. */ if (pRes->block_begin <= target->block_begin && - pRes->block_end >= target->block_end) + pRes->block_end >= target->block_end) { + if (target->res_type & ResOverlap) { + /* Nullify range but keep its ResOverlap bit on */ + target->block_end = target->block_begin - 1; + return; + } continue; + } /* * In cases where the target and pRes have the same starting * address, reduce the size of the target (given it's an estimate). */ if (pRes->block_begin == target->block_begin) { - target->block_end = pRes->block_end; + if (target->res_type & ResOverlap) + target->block_end = target->block_begin - 1; + else + target->block_end = pRes->block_end; } /* Otherwise, trim target to remove the overlap */ else if (pRes->block_begin <= target->block_end) { @@ -1710,7 +1727,7 @@ */ resPtr -xf86RegisterResources(int entityIndex, resList list, int access) +xf86RegisterResources(int entityIndex, resList list, unsigned long access) { resPtr res = NULL; resRange range; @@ -1758,165 +1775,6 @@ } -/* - * Server State - */ -#ifdef notanymore1 -static xf86AccessPtr -busTypeSpecific(EntityPtr pEnt, xf86State state) -{ - pciAccPtr *ppaccp; - - switch (pEnt->bus.type) { - case BUS_ISA: - switch (state) { - case SETUP: - return &AccessNULL; - break; - case OPERATING: - if (pEnt->entityProp & NEED_SHARED) - return &AccessNULL; - else /* no conflicts at all */ - return NULL; /* remove from RAC */ - break; - } - break; - case BUS_PCI: - ppaccp = xf86PciAccInfo; - while (*ppaccp) { - if ((*ppaccp)->busnum == pEnt->pciBusId.bus - && (*ppaccp)->devnum == pEnt->pciBusId.device - && (*ppaccp)->funcnum == pEnt->pciBusId.func) { - switch (state) { - case SETUP: - (*ppaccp)->io_memAccess.AccessDisable((*ppaccp)-> - io_memAccess.arg); - return &(*ppaccp)->io_memAccess; - break; - case OPERATING: - if (!(pEnt->entityProp & NEED_MEM_SHARED)){ - if (pEnt->entityProp & NEED_MEM) - (*ppaccp)->memAccess.AccessEnable((*ppaccp)-> - memAccess.arg); - else - (*ppaccp)->memAccess.AccessDisable((*ppaccp)->memAccess.arg); - } - if (!(pEnt->entityProp & NEED_IO_SHARED)) { - if (pEnt->entityProp & NEED_IO) - (*ppaccp)->ioAccess.AccessEnable((*ppaccp)-> - ioAccess.arg); - else - (*ppaccp)->ioAccess.AccessDisable((*ppaccp)-> - ioAccess.arg); - } - switch(pEnt->entityProp & NEED_SHARED) { - case NEED_IO_SHARED: - return &(*ppaccp)->ioAccess; - case NEED_MEM_SHARED: - return &(*ppaccp)->memAccess; - case NEED_SHARED: - return &(*ppaccp)->io_memAccess; - default: /* no conflicts at all */ - return NULL; /* remove from RAC */ - } - break; - } - } - ppaccp++; - } - break; - default: - return NULL; - } - return NULL; -} - -/* - * setAccess() -- sets access functions according to resources - * required. - */ - -static void -setAccess(EntityPtr pEnt, xf86State state) -{ - xf86AccessPtr new = NULL; - - /* set access funcs and access state according to resource requirements */ - pEnt->access->pAccess = busTypeSpecific(pEnt,state); - - if (state == OPERATING) { - switch(pEnt->entityProp & NEED_SHARED) { - case NEED_SHARED: - pEnt->access->rt = MEM_IO; - break; - case NEED_IO_SHARED: - pEnt->access->rt = IO; - break; - case NEED_MEM_SHARED: - pEnt->access->rt = MEM; - break; - default: - pEnt->access->rt = NONE; - } - } else - pEnt->access->rt = MEM_IO; - - /* disable shared resources */ - if (pEnt->access->pAccess - && pEnt->access->pAccess->AccessDisable) - pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg); - - /* - * If device is not under access control it is enabled. - * If it needs bus routing do it here as it isn't bus - * type specific. Any conflicts should be checked at this - * stage - */ - if (!pEnt->access->pAccess - && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP : - NEED_VGA_ROUTED))) - ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc); - - /* do we have a driver replacement for the generic access funcs ?*/ - if (pEnt->rac) { - /* XXX should we use rt here? */ - switch (pEnt->access->rt) { - case MEM_IO: - new = pEnt->rac->io_mem_new; - break; - case IO: - new = pEnt->rac->io_new; - break; - case MEM: - new = pEnt->rac->mem_new; - break; - default: - new = NULL; - break; - } - } - if (new) { - /* does the driver want the old access func? */ - if (pEnt->rac->old) { - /* give it to the driver, leave state disabled */ - (*pEnt->rac->old) = pEnt->access->pAccess; - } else if ((pEnt->access->rt != NONE) && pEnt->access->pAccess - && pEnt->access->pAccess->AccessEnable) { - /* driver doesn't want it - enable generic access */ - pEnt->access->pAccess->AccessEnable(pEnt->access->pAccess->arg); - } - /* now replace access funcs */ - pEnt->access->pAccess = new; - /* call the new disable func just to be shure */ - /* XXX should we do this only if rt != NONE? */ - if (pEnt->access->pAccess && pEnt->access->pAccess->AccessDisable) - pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg); - /* The replacement function needs to handle _all_ shared resources */ - /* unless they are handeled locally and disabled otherwise */ - } -} -#endif - static void busTypeSpecific(EntityPtr pEnt, xf86State state, xf86AccessPtr *acc_mem, xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io) @@ -1997,7 +1855,6 @@ pEnt->access->rt = MEM_IO; } - switch(pEnt->access->rt) { case IO: pEnt->access->pAccess = acc_io; @@ -2023,6 +1880,7 @@ org_io->AccessEnable(org_io->arg); } } + if (org_mem_io) { /* does the driver want the old access func? */ if (pEnt->rac->old) { @@ -2033,6 +1891,7 @@ org_mem_io->AccessEnable(org_mem_io->arg); } } + if (org_mem) { /* does the driver want the old access func? */ if (pEnt->rac->old) { @@ -2046,19 +1905,20 @@ if (!(prop & NEED_MEM_SHARED)){ if (prop & NEED_MEM) { - if (acc_mem->AccessEnable) + if (acc_mem && acc_mem->AccessEnable) acc_mem->AccessEnable(acc_mem->arg); } else { - if (acc_mem->AccessDisable) + if (acc_mem && acc_mem->AccessDisable) acc_mem->AccessDisable(acc_mem->arg); } } + if (!(prop & NEED_IO_SHARED)) { if (prop & NEED_IO) { - if (acc_io->AccessEnable) + if (acc_io && acc_io->AccessEnable) acc_io->AccessEnable(acc_io->arg); } else { - if (acc_io->AccessDisable) + if (acc_io && acc_io->AccessDisable) acc_io->AccessDisable(acc_io->arg); } } @@ -2076,7 +1936,7 @@ */ if (!pEnt->access->pAccess && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP : - NEED_VGA_ROUTED))) + NEED_VGA_ROUTED))) ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc); } @@ -2087,29 +1947,36 @@ typedef enum { TRI_UNSET, TRI_TRUE, TRI_FALSE } TriState; +static void +SetSIGIOForState(xf86State state) +{ + static int sigio_state; + static TriState sigio_blocked = TRI_UNSET; + + if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) { + sigio_state = xf86BlockSIGIO(); + sigio_blocked = TRI_TRUE; + } else if ((state == OPERATING) && (sigio_blocked != TRI_UNSET)) { + xf86UnblockSIGIO(sigio_state); + sigio_blocked = TRI_FALSE; + } +} + void xf86EnterServerState(xf86State state) { EntityPtr pEnt; ScrnInfoPtr pScrn; int i,j; + int needVGA = 0; resType rt; - static int sigio_state; - static TriState sigio_blocked = TRI_UNSET; - /* * This is a good place to block SIGIO during SETUP state. * SIGIO should be blocked in SETUP state otherwise (u)sleep() * might get interrupted early. * We take care not to call xf86BlockSIGIO() twice. */ - if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) { - sigio_state = xf86BlockSIGIO(); - sigio_blocked = TRI_TRUE; - } else if ((state == OPERATING) && (sigio_blocked != TRI_UNSET)) { - xf86UnblockSIGIO(sigio_state); - sigio_blocked = TRI_FALSE; - } + SetSIGIOForState(state); #ifdef DEBUG if (state == SETUP) ErrorF("Entering SETUP state\n"); @@ -2117,7 +1984,7 @@ ErrorF("Entering OPERATING state\n"); #endif - /* When servicing a dump framebuffer we don't need to do anything */ + /* When servicing a dumb framebuffer we don't need to do anything */ if (doFramebufferMode) return; for (i=0; inumEntities; j++) { pEnt = xf86Entities[xf86Screens[i]->entityList[j]]; if (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP - : NEED_VGA_ROUTED)) + : NEED_VGA_ROUTED)) xf86Screens[i]->busAccess = pEnt->busAcc; } + if (xf86Screens[i]->busAccess) + needVGA ++; } /* @@ -2148,18 +2017,13 @@ else notifyStateChange(NOTIFY_OPERATING_TRANSITION); -#ifdef notanymore1 - disableAccess(); -#else clearAccess(); -#endif for (i=0; inumEntities; j++) { pEnt = xf86Entities[xf86Screens[i]->entityList[j]]; - setAccess(pEnt,state); if (pEnt->access->rt != NONE) { @@ -2172,7 +2036,8 @@ xf86Screens[i]->resourceType = rt; if (rt == NONE) { xf86Screens[i]->access = NULL; - xf86Screens[i]->busAccess = NULL; + if (needVGA < 2) + xf86Screens[i]->busAccess = NULL; } #ifdef DEBUG @@ -2388,10 +2253,31 @@ "different buses - deleting\n",i); xf86DeleteScreen(i--,0); } +#ifdef DEBUG + { + resPtr rlist = xf86AddResToList(NULL,&pAcc->val, + pAcc->entityIndex); + xf86MsgVerb(X_INFO,3,"====== %s\n", + state == OPERATING ? "OPERATING" + : "SETUP"); + xf86MsgVerb(X_INFO,3,"%s Resource:\n", + (pAcc->val.type) & ResMem ? "Mem" :"Io"); + xf86PrintResList(3,rlist); + xf86FreeResList(rlist); + xf86MsgVerb(X_INFO,3,"Conflicts with:\n"); + xf86PrintResList(3,pResVGAHost); + xf86MsgVerb(X_INFO,3,"=====\n"); + } +#endif vga = pEnt->busAcc; pEnt->entityProp |= (state == SETUP ? NEED_VGA_ROUTED_SETUP : NEED_VGA_ROUTED); - break; + if (state == OPERATING) { + if (pAcc->val.type & ResMem) + pEnt->entityProp |= NEED_VGA_MEM; + else + pEnt->entityProp |= NEED_VGA_IO; + } } pAcc = pAcc->next; } @@ -2416,7 +2302,7 @@ if (fbSlotClaimed) { if (pciSlotClaimed || isaSlotClaimed -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) || sbusSlotClaimed #endif ) { @@ -2484,8 +2370,12 @@ } xf86FreeResList(acc); -#if !(defined(__alpha__) && defined(linux)) - /* No need to validate on Alpha Linux, trust the kernel. */ +#if !(defined(__alpha__) && defined(linux)) && \ + !(defined(__sparc64__) && defined(__OpenBSD__)) + /* + * No need to validate on Alpha Linux or OpenBSD/sparc64, + * trust the kernel. + */ ValidatePci(); #endif @@ -2596,7 +2486,10 @@ pointer xf86RACInit = NULL; #endif - if (doFramebufferMode) return; + if (doFramebufferMode) { + SetSIGIOForState(OPERATING); + return; + } #ifdef XFree86LOADER if (needRAC) { @@ -2635,7 +2528,19 @@ } if (xf86Screens && needRAC) { + int needRACforVga = 0; + for (i = 0; i < xf86NumScreens; i++) { + for (j = 0; j < xf86Screens[i]->numEntities; j++) { + if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp + & NEED_VGA_ROUTED) { + needRACforVga ++; + break; /* only count each screen once */ + } + } + } + + for (i = 0; i < xf86NumScreens; i++) { Bool needRACforMem = FALSE, needRACforIo = FALSE; for (j = 0; j < xf86Screens[i]->numEntities; j++) { @@ -2645,8 +2550,21 @@ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp & NEED_IO_SHARED) needRACforIo = TRUE; + /* + * We may need RAC although we don't share any resources + * as we need to route VGA to the correct bus. This can + * only be done simultaniously for MEM and IO. + */ + if (needRACforVga > 1) { + if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp + & NEED_VGA_MEM) + needRACforMem = TRUE; + if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp + & NEED_VGA_IO) + needRACforIo = TRUE; + } } - + pScreen = xf86Screens[i]->pScreen; flags = 0; if (needRACforMem) { @@ -3036,8 +2954,10 @@ } +#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) #include "vgaHW.h" #include "compiler.h" +#endif /* * CheckGenericGA() - Check for presence of a VGA device. @@ -3045,20 +2965,21 @@ static void CheckGenericGA() { -#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) /* FIXME ?? */ - CARD16 GenericIOBase = VGAHW_GET_IOBASE(); +/* This needs to be changed for multiple domains */ +#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) + IOADDRESS GenericIOBase = VGAHW_GET_IOBASE(); CARD8 CurrentValue, TestValue; /* VGA CRTC registers are not used here, so don't bother unlocking them */ /* VGA has one more read/write attribute register than EGA */ - (void) inb(GenericIOBase + 0x0AU); /* Reset flip-flop */ - outb(0x3C0, 0x14 | 0x20); - CurrentValue = inb(0x3C1); - outb(0x3C0, CurrentValue ^ 0x0F); - outb(0x3C0, 0x14 | 0x20); - TestValue = inb(0x3C1); - outb(0x3C0, CurrentValue); + (void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */ + outb(VGA_ATTR_INDEX, 0x14 | 0x20); + CurrentValue = inb(VGA_ATTR_DATA_R); + outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F); + outb(VGA_ATTR_INDEX, 0x14 | 0x20); + TestValue = inb(VGA_ATTR_DATA_R); + outb(VGA_ATTR_DATA_W, CurrentValue); if ((CurrentValue ^ 0x0F) == TestValue) { primaryBus.type = BUS_ISA; Index: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Bus.h:1.18 xc/programs/Xserver/hw/xfree86/common/xf86Bus.h:1.21 --- xc/programs/Xserver/hw/xfree86/common/xf86Bus.h:1.18 Sun Feb 11 20:25:23 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Bus.h Mon Nov 25 09:04:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.18 2001/02/12 01:25:23 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.21 2002/11/25 14:04:56 eich Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. */ @@ -44,6 +44,7 @@ DevUnion * entityPrivates; int numInstances; GDevPtr * devices; + IOADDRESS domainIO; } EntityRec, *EntityPtr; /* asynchronous event handling */ @@ -66,6 +67,8 @@ #define ACCEL_IS_SHARABLE 0x0100 #define IS_SHARED_ACCEL 0x0200 #define SA_PRIM_INIT_DONE 0x0400 +#define NEED_VGA_MEM 0x1000 +#define NEED_VGA_IO 0x2000 #define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED) @@ -94,7 +97,7 @@ int bus; int primary_bus; PCITAG acc; - pciBridgeSave save; + pciBridgesSave save; void (*func)(PCITAG,int,CARD32,CARD32); } pci; } busdep; Index: xc/programs/Xserver/hw/xfree86/common/xf86Config.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.254 xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.269 --- xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.254 Mon Jan 14 20:56:55 2002 +++ xc/programs/Xserver/hw/xfree86/common/xf86Config.c Wed Feb 19 23:36:07 2003 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.254 2002/01/15 01:56:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.269 2003/02/20 04:36:07 dawes Exp $ */ /* - * Copyright 1991-1999 by The XFree86 Project, Inc. + * Copyright 1991-2002 by The XFree86 Project, Inc. * Copyright 1997 by Metro Link, Inc. * * Loosely based on code bearing the following copyright: @@ -11,7 +11,7 @@ * * * - * Author: Dirk Hohndel + * Author: Dirk Hohndel and others. */ #ifdef XF86DRI @@ -38,22 +38,16 @@ #include "XKBsrv.h" #endif +#ifdef RENDER +#include "picture.h" +#endif + #if (defined(i386) || defined(__i386__)) && \ (defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \ (defined(SVR4) && !defined(sun)) || defined(__GNU__)) #define SUPPORT_PC98 #endif -#ifdef __EMX__ -#define ROOT_CONFIGPATH "%A," "%R," \ - "%E," \ - "%D/%X," \ - "%&/XFree86/lib/X11/%X-%M," "%&/XFree86/lib/X11/%X," "%&XFree86/lib/X11/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," -#define USER_CONFIGPATH ROOT_CONFIGPATH -#endif - /* * These paths define the way the config file search is done. The escape * sequences are documented in parser/scan.c. @@ -144,13 +138,12 @@ next = path; while (next != NULL) { path_elem = xf86GetPathElem(&next); -#ifndef __EMX__ if (*path_elem == '/') { +#ifndef __UNIXOS2__ dir_elem = xnfcalloc(1, strlen(path_elem) + 1); if ((p1 = strchr(path_elem, ':')) != 0) #else /* OS/2 must prepend X11ROOT */ - if (*path_elem == '/') { path_elem = (char*)__XOS2RedirRoot(path_elem); dir_elem = xnfcalloc(1, strlen(path_elem) + 1); if (p1 = strchr(path_elem+2, ':')) @@ -167,6 +160,7 @@ if (flag != 0) { xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem); xf86ErrorF("\tEntry deleted from font path.\n"); + xfree(dir_elem); continue; } else { @@ -177,7 +171,7 @@ if (flag == 0) if (!S_ISREG(stat_buf.st_mode)) flag = -1; -#ifndef __EMX__ +#ifndef __UNIXOS2__ xfree(p1); #endif if (flag != 0) { @@ -186,6 +180,7 @@ dir_elem); xf86ErrorF("\tEntry deleted from font path.\n"); xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem); + xfree(dir_elem); continue; } } @@ -623,7 +618,7 @@ /* If defaultFontPath is still empty, exit here */ if (! *defaultFontPath) - FatalError("No valid FontPath could be found\n"); + FatalError("No valid FontPath could be found."); xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath); @@ -642,6 +637,13 @@ xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath); + if (fileconf && fileconf->file_inputdevs) { + xf86InputDeviceList = fileconf->file_inputdevs; + xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n", + xf86InputDeviceList); + } + + #ifdef XFree86LOADER /* ModulePath */ @@ -677,6 +679,7 @@ typedef enum { FLAG_NOTRAPSIGNALS, + FLAG_DONTVTSWITCH, FLAG_DONTZAP, FLAG_DONTZOOM, FLAG_DISABLEVIDMODE, @@ -686,10 +689,12 @@ FLAG_ALLOWMOUSEOPENFAIL, FLAG_VTINIT, FLAG_VTSYSREQ, + FLAG_XKBDISABLE, FLAG_PCIPROBE1, FLAG_PCIPROBE2, FLAG_PCIFORCECONFIG1, FLAG_PCIFORCECONFIG2, + FLAG_PCIFORCENONE, FLAG_PCIOSCONFIG, FLAG_SAVER_BLANKTIME, FLAG_DPMS_STANDBYTIME, @@ -702,12 +707,17 @@ FLAG_XINERAMA, FLAG_ALLOW_DEACTIVATE_GRABS, FLAG_ALLOW_CLOSEDOWN_GRABS, - FLAG_SYNCLOG + FLAG_LOG, + FLAG_RENDER_COLORMAP_MODE, + FLAG_HANDLE_SPECIAL_KEYS, + FLAG_RANDR } FlagValues; static OptionInfoRec FlagOptions[] = { { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN, + {0}, FALSE }, { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN, {0}, FALSE }, { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN, @@ -726,6 +736,8 @@ {0}, FALSE }, { FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN, + {0}, FALSE }, { FLAG_PCIPROBE1, "PciProbe1" , OPTV_BOOLEAN, {0}, FALSE }, { FLAG_PCIPROBE2, "PciProbe2", OPTV_BOOLEAN, @@ -734,6 +746,8 @@ {0}, FALSE }, { FLAG_PCIFORCECONFIG2, "PciForceConfig2", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_PCIFORCENONE, "PciForceNone", OPTV_BOOLEAN, + {0}, FALSE }, { FLAG_PCIOSCONFIG, "PciOsConfig", OPTV_BOOLEAN, {0}, FALSE }, { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER, @@ -758,8 +772,14 @@ {0}, FALSE }, { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_SYNCLOG, "SyncLog", OPTV_BOOLEAN, + { FLAG_LOG, "Log", OPTV_STRING, {0}, FALSE }, + { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING, + {0}, FALSE }, + { FLAG_HANDLE_SPECIAL_KEYS, "HandleSpecialKeys", OPTV_STRING, + {0}, FALSE }, + { FLAG_RANDR, "RandR", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -810,6 +830,7 @@ xf86ProcessOptions(-1, optp, FlagOptions); xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals); + xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch); xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); @@ -843,13 +864,23 @@ if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, &value)) { #ifdef USE_VT_SYSREQ xf86Info.vtSysreq = value; - xf86Msg(X_CONFIG, "VTSysReq enabled\n"); + xf86Msg(X_CONFIG, "VTSysReq %s\n", value ? "enabled" : "disabled"); #else if (value) xf86Msg(X_WARNING, "VTSysReq is not supported on this OS\n"); #endif } + if (xf86GetOptValBool(FlagOptions, FLAG_XKBDISABLE, &value)) { +#ifdef XKB + noXkbExtension = value; + xf86Msg(X_CONFIG, "Xkb %s\n", value ? "disabled" : "enabled"); +#else + if (!value) + xf86Msg(X_WARNING, "Xserver doesn't support XKB\n"); +#endif + } + xf86Info.vtinit = xf86GetOptValString(FlagOptions, FLAG_VTINIT); if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1)) @@ -862,15 +893,68 @@ xf86Info.pciFlags = PCIForceConfig2; if (xf86IsOptionSet(FlagOptions, FLAG_PCIOSCONFIG)) xf86Info.pciFlags = PCIOsConfig; + if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCENONE)) + xf86Info.pciFlags = PCIForceNone; xf86Info.pmFlag = TRUE; if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) xf86Info.pmFlag = !value; - if (xf86GetOptValBool(FlagOptions, FLAG_SYNCLOG, &value)) { - xf86Msg(X_CONFIG, "SyncLog %s\n",value?"enabled":"disabled"); - xf86Info.syncLog = value; + { + const char *s; + if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) { + if (!xf86NameCmp(s,"flush")) { + xf86Msg(X_CONFIG, "Flushing logfile enabled\n"); + xf86Info.log = LogFlush; + } else if (!xf86NameCmp(s,"sync")) { + xf86Msg(X_CONFIG, "Syncing logfile enabled\n"); + xf86Info.log = LogSync; + } else { + xf86Msg(X_WARNING,"Unknown Log option\n"); + } + } } +#ifdef RENDER + { + const char *s; + + if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){ + int policy = PictureParseCmapPolicy (s); + if (policy == PictureCmapPolicyInvalid) + xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s); + else + { + xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s); + PictureCmapPolicy = policy; + } + } + } +#endif + { + const char *s; + if ((s = xf86GetOptValString(FlagOptions, FLAG_HANDLE_SPECIAL_KEYS))) { + if (!xf86NameCmp(s,"always")) { + xf86Msg(X_CONFIG, "Always handling special keys in DDX\n"); + xf86Info.ddxSpecialKeys = SKAlways; + } else if (!xf86NameCmp(s,"whenneeded")) { + xf86Msg(X_CONFIG, "Special keys handled in DDX only if needed\n"); + xf86Info.ddxSpecialKeys = SKWhenNeeded; + } else if (!xf86NameCmp(s,"never")) { + xf86Msg(X_CONFIG, "Never handling special keys in DDX\n"); + xf86Info.ddxSpecialKeys = SKNever; + } else { + xf86Msg(X_WARNING,"Unknown HandleSpecialKeys option\n"); + } + } + } +#ifdef RANDR + xf86Info.disableRandR = FALSE; + xf86Info.randRFrom = X_DEFAULT; + if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) { + xf86Info.disableRandR = !value; + xf86Info.randRFrom = X_CONFIG; + } +#endif i = -1; xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i); if (i >= 0) @@ -975,10 +1059,13 @@ xf86Info.panix106 = FALSE; #endif xf86Info.kbdCustomKeycodes = FALSE; +#ifdef WSCONS_SUPPORT + xf86Info.kbdFd = -1; +#endif #ifdef XKB if (!xf86IsPc98()) { xf86Info.xkbrules = "xfree86"; - xf86Info.xkbmodel = "pc101"; + xf86Info.xkbmodel = "pc105"; xf86Info.xkblayout = "us"; xf86Info.xkbvariant = NULL; xf86Info.xkboptions = NULL; @@ -1023,7 +1110,7 @@ " the \"wskbd\" keyboard protocol"); return FALSE; } - xf86Info.kbdFd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); + xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL); if (xf86Info.kbdFd == -1) { xf86ConfigError("cannot open \"%s\"", s); xfree(s); @@ -1051,6 +1138,11 @@ xf86Msg(X_PROBED, "Keyboard type: ADB\n"); break; #endif +#ifdef WSKBD_TYPE_SUN + case WSKBD_TYPE_SUN: + xf86Msg(X_PROBED, "Keyboard type: Sun\n"); + break; +#endif default: xf86ConfigError("Unsupported wskbd type \"%d\"", xf86Info.wsKbdType); @@ -1098,6 +1190,9 @@ if (noXkbExtension) from = X_CMDLINE; else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) { + xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the " + "ServerFlags section instead\n" + "\tof in the \"keyboard\" InputDevice section.\n"); noXkbExtension = xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE); from = X_CONFIG; @@ -1460,12 +1555,14 @@ slp[i].right = slp[j].screen; } } - if (slp[i].where != CONF_ADJ_OBSOLETE - && slp[i].where != CONF_ADJ_ABSOLUTE + if (slp[i].where != PosObsolete + && slp[i].where != PosAbsolute && !slp[i].refscreen) { xf86Msg(X_ERROR,"Screen %s doesn't exist: deleting placement\n", slp[i].refname); - slp[i].where = 0; + slp[i].where = PosAbsolute; + slp[i].x = 0; + slp[i].y = 0; } } @@ -2128,6 +2225,7 @@ filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); if (filename) { xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); + xf86ConfigFile = xnfstrdup(filename); } else { xf86Msg(X_ERROR, "Unable to locate/open config file"); if (xf86ConfigFile) Index: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.68 xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.78 --- xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.68 Mon Jan 7 16:39:18 2002 +++ xc/programs/Xserver/hw/xfree86/common/xf86Configure.c Sat Jan 18 02:27:13 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.68 2002/01/07 21:39:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.78 2003/01/18 07:27:13 paulo Exp $ */ /* - * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. + * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -39,7 +39,7 @@ #include "xf86.h" #include "xf86Config.h" #include "xf86Priv.h" -#include "xf86PciInfo.h" +#include "xf86PciData.h" #define IN_XSERVER #include "xf86Parser.h" #include "xf86tokens.h" @@ -68,7 +68,7 @@ Bool xf86DoConfigurePass1 = TRUE; Bool foundMouse = FALSE; -#if defined(__EMX__) +#if defined(__UNIXOS2__) #define DFLT_MOUSE_DEV "mouse$" #define DFLT_MOUSE_PROTO "OS2Mouse" #elif defined(SCO) @@ -79,46 +79,14 @@ #elif defined(__QNXNTO__) static char *DFLT_MOUSE_PROTO = "OSMouse"; static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0"; +#elif defined(__FreeBSD__) +static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; +static char *DFLT_MOUSE_PROTO = "auto"; #else static char *DFLT_MOUSE_DEV = "/dev/mouse"; static char *DFLT_MOUSE_PROTO = "auto"; #endif -static void -GetPciCard(int vendor, int chipType, int *vendor1, int *vendor2, int *card) -{ - int k, j; - - *vendor1 = 0; - *vendor2 = 0; - *card = 0; - - k = 0; - while (xf86PCIVendorNameInfo[k].token) { - if (xf86PCIVendorNameInfo[k].token == vendor) { - *vendor1 = k; - break; - } - k++; - } - k = 0; - while(xf86PCIVendorInfo[k].VendorID) { - if (xf86PCIVendorInfo[k].VendorID == vendor) { - j = 0; - while (xf86PCIVendorInfo[k].Device[j].DeviceName) { - if (xf86PCIVendorInfo[k].Device[j].DeviceID == chipType) { - *vendor2 = k; - *card = j; - break; - } - j++; - } - break; - } - k++; - } -} - /* * This is called by the driver, either through xf86Match???Instances() or * directly. We allocate a GDevRec and fill it in as much as we can, letting @@ -158,7 +126,7 @@ if (!DevToConfig[i].pVideo) return NULL; break; -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) case BUS_SBUS: for (i = 0; i < nDevToConfig; i++) if (DevToConfig[i].sVideo && @@ -195,36 +163,40 @@ switch (bus) { case BUS_PCI: { - int vendor1, vendor2, card; + const char *VendorName; + const char *CardName; + char busnum[8]; NewDevice.pVideo = pVideo; - GetPciCard(pVideo->vendor, pVideo->chipType, - &vendor1, &vendor2, &card); - - if (vendor1 == 0 || (vendor2 == 0 && card == 0)) { - FatalError("\nXFree86 has found a valid card configuration.\nUnfortunately the appropriate data has not been added to xf86PciInfo.h.\nPlease forward 'scanpci -v' output to XFree86 support team."); + xf86FindPciNamesByDevice(pVideo->vendor, pVideo->chipType, + NOVENDOR, NOSUBSYS, + &VendorName, &CardName, NULL, NULL); + + if (!VendorName) { + VendorName = xnfalloc(15); + sprintf((char*)VendorName, "Unknown Vendor"); } -# define VendorName xf86PCIVendorNameInfo[vendor1].name -# define CardName xf86PCIVendorInfo[vendor2].Device[card].DeviceName + if (!CardName) { + CardName = xnfalloc(14); + sprintf((char*)CardName, "Unknown Board"); + } NewDevice.GDev.identifier = xnfalloc(strlen(VendorName) + strlen(CardName) + 2); sprintf(NewDevice.GDev.identifier, "%s %s", VendorName, CardName); NewDevice.GDev.vendor = (char *)VendorName; - NewDevice.GDev.board = CardName; + NewDevice.GDev.board = (char *)CardName; NewDevice.GDev.busID = xnfalloc(16); - sprintf(NewDevice.GDev.busID, "PCI:%d:%d:%d", - pVideo->bus, pVideo->device, pVideo->func); + xf86FormatPciBusNumber(pVideo->bus, busnum); + sprintf(NewDevice.GDev.busID, "PCI:%s:%d:%d", + busnum, pVideo->device, pVideo->func); NewDevice.GDev.chipID = pVideo->chipType; NewDevice.GDev.chipRev = pVideo->chipRev; -# undef VendorName -# undef CardName - if (chipset < 0) chipset = (pVideo->vendor << 16) | pVideo->chipType; } @@ -233,7 +205,7 @@ NewDevice.GDev.identifier = "ISA Adapter"; NewDevice.GDev.busID = "ISA"; break; -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) case BUS_SBUS: { char *promPath = NULL; NewDevice.sVideo = (sbusDevicePtr) busData; @@ -291,7 +263,8 @@ /* Crude mechanism to auto-detect mouse (os dependent) */ { int fd; -#ifdef linux +#if 0 && defined linux + /* Our autodetection code can do a better job */ int len; char path[32]; @@ -302,9 +275,9 @@ } #endif #ifdef WSCONS_SUPPORT - fd = open("/dev/wsmouse0", 0); + fd = open("/dev/wsmouse", 0); if (fd > 0) { - DFLT_MOUSE_DEV = "/dev/wsmouse0"; + DFLT_MOUSE_DEV = "/dev/wsmouse"; DFLT_MOUSE_PROTO = "wsmouse"; close(fd); } @@ -657,6 +630,8 @@ /* Add only those font backends which are referenced by fontpath */ /* 'strstr(dFP,"/dir")' is meant as 'dFP =~ m(/dir\W)' */ if (defaultFontPath && ( + (strcmp(*el, "xtt") == 0 && + strstr(defaultFontPath, "/TrueType")) || (strcmp(*el, "type1") == 0 && strstr(defaultFontPath, "/Type1")) || (strcmp(*el, "speedo") == 0 && @@ -740,7 +715,8 @@ len = 0; } if ((ptr->mon_comment = - xrealloc(ptr->mon_comment, len+strlen(displaySize_string)))) { + xf86confrealloc(ptr->mon_comment, + len+strlen(displaySize_string)))) { strcpy(ptr->mon_comment + len, displaySize_string); } } @@ -754,9 +730,11 @@ case DS_WHITE_P: break; case DS_NAME: - xfree(ptr->mon_modelname); - ptr->mon_modelname = - strdup((char*)(ConfiguredMonitor->det_mon[i].section.name)); + ptr->mon_modelname = xf86confrealloc(ptr->mon_modelname, + strlen((char*)(ConfiguredMonitor->det_mon[i].section.name)) + + 1); + strcpy(ptr->mon_modelname, + (char*)(ConfiguredMonitor->det_mon[i].section.name)); break; case DS_ASCII_STR: case DS_SERIAL: @@ -859,7 +837,7 @@ if (!(home = getenv("HOME"))) home = "/"; { -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define PATH_MAX 2048 #endif #if defined(SCO) || defined(SCO325) @@ -995,7 +973,7 @@ ErrorF("\nXFree86 is not able to detect your mouse.\n" "Edit the file and correct the Device.\n"); } else { -#ifndef __EMX__ /* OS/2 definitely has a mouse */ +#ifndef __UNIXOS2__ /* OS/2 definitely has a mouse */ ErrorF("\nXFree86 detected your mouse at device %s.\n" "Please check your config if the mouse is still not\n" "operational, as by default XFree86 tries to autodetect\n" Index: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.32 xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.35 --- xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.32 Mon Jul 23 09:15:46 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c Thu Feb 13 05:49:38 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.32 2001/07/23 13:15:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.35 2003/02/13 10:49:38 eich Exp $ */ /* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */ #define NEED_EVENTS @@ -165,95 +165,109 @@ XF86SCRNINFO(pScreen)->zoomLocked = lock; } -Bool -xf86ZoomLocked(ScreenPtr pScreen) -{ - if (xf86Info.dontZoom || XF86SCRNINFO(pScreen)->zoomLocked) - return TRUE; - else - return FALSE; -} - /* - * xf86ZoomViewport -- - * Reinitialize the visual part of the screen for another mode. + * xf86SwitchMode -- + * This is called by both keyboard processing and the VidMode extension to + * set a new mode. */ -void -xf86ZoomViewport (ScreenPtr pScreen, int zoom) +Bool +xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); ScreenPtr pCursorScreen; - Bool tmp; + Bool Switched; int px, py; - - if (pScr->zoomLocked) - return; + + if (!pScr->vtSema || !mode || !pScr->SwitchMode) + return FALSE; #ifdef XFreeXDGA if (DGAActive(pScr->scrnIndex)) - return; + return FALSE; #endif + if (mode == pScr->currentMode) + return TRUE; + + if (mode->HDisplay > pScreen->width || mode->VDisplay > pScreen->height) + return FALSE; + pCursorScreen = miPointerCurrentScreen(); if (pScreen == pCursorScreen) miPointerPosition(&px, &py); - if (pScr->SwitchMode != NULL && - pScr->currentMode != pScr->currentMode->next) { - pScr->currentMode = zoom > 0 ? pScr->currentMode->next - : pScr->currentMode->prev; - - xf86EnterServerState(SETUP); - tmp = (*pScr->SwitchMode)(pScr->scrnIndex, pScr->currentMode, 0); - xf86EnterServerState(OPERATING); - if (tmp) { - /* - * adjust new frame for the displaysize - */ - if (pScreen == pCursorScreen) - pScr->frameX0 = px - (pScr->currentMode->HDisplay / 2) + 1; - else - pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 + 1 - - pScr->currentMode->HDisplay) / 2; - pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1; - - if (pScr->frameX0 < 0) { - pScr->frameX0 = 0; - pScr->frameX1 = pScr->currentMode->HDisplay - 1; - } else if (pScr->frameX1 >= pScr->virtualX) { - pScr->frameX0 = pScr->virtualX - pScr->currentMode->HDisplay; - pScr->frameX1 = pScr->virtualX - 1; - } - - if (pScreen == pCursorScreen) - pScr->frameY0 = py - (pScr->currentMode->VDisplay / 2) + 1; - else - pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 + 1 - - pScr->currentMode->VDisplay) / 2; - pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1; - - if (pScr->frameY0 < 0) { - pScr->frameY0 = 0; - pScr->frameY1 = pScr->currentMode->VDisplay - 1; - } else if (pScr->frameY1 >= pScr->virtualY) { - pScr->frameY0 = pScr->virtualY - pScr->currentMode->VDisplay; - pScr->frameY1 = pScr->virtualY - 1; - } + xf86EnterServerState(SETUP); + Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0); + xf86EnterServerState(OPERATING); + if (Switched) { + pScr->currentMode = mode; + + /* + * Adjust frame for new display size. + */ + if (pScreen == pCursorScreen) + pScr->frameX0 = px - (mode->HDisplay / 2) + 1; + else + pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2; + + if (pScr->frameX0 < 0) + pScr->frameX0 = 0; + + pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1; + if (pScr->frameX1 >= pScr->virtualX) { + pScr->frameX0 = pScr->virtualX - mode->HDisplay; + pScr->frameX1 = pScr->virtualX - 1; + } + + if (pScreen == pCursorScreen) + pScr->frameY0 = py - (mode->VDisplay / 2) + 1; + else + pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2; + + if (pScr->frameY0 < 0) + pScr->frameY0 = 0; + + pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1; + if (pScr->frameY1 >= pScr->virtualY) { + pScr->frameY0 = pScr->virtualY - mode->VDisplay; + pScr->frameY1 = pScr->virtualY - 1; } - else /* switch failed, so go back to old mode */ - pScr->currentMode = zoom > 0 ? pScr->currentMode->prev - : pScr->currentMode->next; } - if (pScr->AdjustFrame != NULL) + if (pScr->AdjustFrame) (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); if (pScreen == pCursorScreen) xf86WarpCursor(pScreen, px, py); + + return Switched; } + +/* + * xf86ZoomViewport -- + * Reinitialize the visual part of the screen for another mode. + */ + +void +xf86ZoomViewport(ScreenPtr pScreen, int zoom) +{ + ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + DisplayModePtr mode; + + if (pScr->zoomLocked || !(mode = pScr->currentMode)) + return; + do { + if (zoom > 0) + mode = mode->next; + else + mode = mode->prev; + } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF)); + (void)xf86SwitchMode(pScreen, mode); +} + static xf86EdgePtr FindEdge(xf86EdgePtr edge, int val) @@ -717,3 +731,22 @@ } } } + +void +xf86ReconfigureLayout(void) +{ + int i; + + for (i = 0; i < MAXSCREENS; i++) { + xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i]; + /* we don't have to zero these, xf86InitOrigins() takes care of that */ + if (sl->left) xfree(sl->left); + if (sl->right) xfree(sl->right); + if (sl->up) xfree(sl->up); + if (sl->down) xfree(sl->down); + } + + xf86InitOrigins(); +} + + Index: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.43 xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.46 --- xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.43 Sun Dec 16 13:30:22 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DGA.c Tue Dec 3 13:17:40 2002 @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.43 2001/12/16 18:30:22 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.46 2002/12/03 18:17:40 tsi Exp $ */ #include "xf86.h" #include "xf86str.h" @@ -13,7 +13,6 @@ #include "colormapst.h" #include "pixmapstr.h" #include "inputstr.h" -#include "XIproto.h" #include "globals.h" #include "servermd.h" #include "micmap.h" @@ -28,6 +27,7 @@ static Bool DGACloseScreen(int i, ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); +static void DGAUninstallColormap(ColormapPtr pmap); static void DGACopyModeInfo( @@ -59,6 +59,7 @@ CloseScreenProcPtr CloseScreen; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; + UninstallColormapProcPtr UninstallColormap; DGADevicePtr current; DGAFunctionPtr funcs; int input; @@ -129,6 +130,8 @@ pScreen->DestroyColormap = DGADestroyColormap; pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = DGAInstallColormap; + pScreenPriv->UninstallColormap = pScreen->UninstallColormap; + pScreen->UninstallColormap = DGAUninstallColormap; /* * This is now set in InitOutput(). @@ -180,6 +183,7 @@ pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->DestroyColormap = pScreenPriv->DestroyColormap; pScreen->InstallColormap = pScreenPriv->InstallColormap; + pScreen->UninstallColormap = pScreenPriv->UninstallColormap; /* DGAShutdown() should have ensured that no DGA screen were active by here */ @@ -237,6 +241,23 @@ pScreen->InstallColormap = DGAInstallColormap; } +static void +DGAUninstallColormap(ColormapPtr pmap) +{ + ScreenPtr pScreen = pmap->pScreen; + DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + + if(pScreenPriv->current && pScreenPriv->dgaColormap) { + if (pmap == pScreenPriv->dgaColormap) { + pScreenPriv->dgaColormap = NULL; + } + } + + pScreen->UninstallColormap = pScreenPriv->UninstallColormap; + (*pScreen->UninstallColormap)(pmap); + pScreen->UninstallColormap = DGAUninstallColormap; +} + int xf86SetDGAMode( int index, @@ -914,7 +935,7 @@ de->u.event.dy = 0; de->u.event.screen = pScreen->myNum; de->u.event.state = keyc->state | (inputInfo.pointer)->button->state; - + /* * Keep the core state in sync by duplicating what * CoreProcessKeyboardEvent does @@ -929,14 +950,16 @@ inputInfo.pointer->valuator->motionHintWindow = NullWindow; *kptr |= bit; keyc->prev_state = keyc->state; - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - { - if (mask & modifiers) + if (noXkbExtension) { + for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { - /* This key affects modifier "i" */ - keyc->modifierKeyCount[i]++; - keyc->state |= mask; - modifiers &= ~mask; + if (mask & modifiers) + { + /* This key affects modifier "i" */ + keyc->modifierKeyCount[i]++; + keyc->state |= mask; + modifiers &= ~mask; + } } } break; @@ -944,20 +967,21 @@ inputInfo.pointer->valuator->motionHintWindow = NullWindow; *kptr &= ~bit; keyc->prev_state = keyc->state; - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - { - if (mask & modifiers) { - /* This key affects modifier "i" */ - if (--keyc->modifierKeyCount[i] <= 0) { - keyc->state &= ~mask; - keyc->modifierKeyCount[i] = 0; + if (noXkbExtension) { + for (i = 0, mask = 1; modifiers; i++, mask <<= 1) + { + if (mask & modifiers) { + /* This key affects modifier "i" */ + if (--keyc->modifierKeyCount[i] <= 0) { + keyc->state &= ~mask; + keyc->modifierKeyCount[i] = 0; + } + modifiers &= ~mask; } - modifiers &= ~mask; } } break; } - /* * Deliver the DGA event */ Index: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.7 xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.8 --- xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.7 Sat Oct 27 23:33:18 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c Wed Feb 12 21:41:09 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.7 2001/10/28 03:33:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.8 2003/02/13 02:41:09 dawes Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -79,7 +79,13 @@ static Bool DPMSClose(int i, ScreenPtr pScreen) { - DPMSPtr pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; + DPMSPtr pDPMS; + + /* This shouldn't happen */ + if (DPMSIndex < 0) + return FALSE; + + pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; /* This shouldn't happen */ if (!pDPMS) @@ -88,7 +94,7 @@ pScreen->CloseScreen = pDPMS->CloseScreen; xfree((pointer)pDPMS); - pDPMS = NULL; + pScreen->devPrivates[DPMSIndex].ptr = NULL; if (--DPMSCount == 0) DPMSIndex = -1; return pScreen->CloseScreen(i, pScreen); Index: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.7 xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.9 --- xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.7 Sat Oct 27 23:33:18 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c Sun Nov 10 23:24:40 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.7 2001/10/28 03:33:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.9 2002/11/11 04:24:40 dawes Exp $ */ /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at * modeline2c.pl */ @@ -122,14 +122,32 @@ /* 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz */ {MODEPREFIX("1920x1440"),297000, 1920,2064,2288,2640,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, {MODEPREFIX("960x720"),148500, 960,1032,1144,1320,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1400x1050 @ 60Hz (VESA GFT) hsync: 65.5kHz */ +/* 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz */ + {MODEPREFIX("832x624"),57284, 832,864,928,1152,0, 624,625,628,667,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("416x312"),28642, 416,432,464,576,0, 312,312,314,333,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz */ + {MODEPREFIX("1152x768"),64995, 1152,1178,1314,1472,0, 768,771,777,806,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("576x384"),32497, 576,589,657,736,0, 384,385,388,403,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz */ {MODEPREFIX("1400x1050"),122000, 1400,1488,1640,1880,0, 1050,1052,1064,1082,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, {MODEPREFIX("700x525"),61000, 700,744,820,940,0, 525,526,532,541,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1400x1050 @ 75Hz (VESA GFT) hsync: 82.2kHz */ +/* 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz */ {MODEPREFIX("1400x1050"),155800, 1400,1464,1784,1912,0, 1050,1052,1064,1090,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, {MODEPREFIX("700x525"),77900, 700,732,892,956,0, 525,526,532,545,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz */ {MODEPREFIX("1600x1024"),106910, 1600,1620,1640,1670,0, 1024,1027,1030,1067,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, {MODEPREFIX("800x512"),53455, 800,810,820,835,0, 512,513,515,533,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz */ + {MODEPREFIX("1920x1440"),341350, 1920,2072,2288,2656,0, 1440,1441,1444,1512,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("960x720"),170675, 960,1036,1144,1328,0, 720,720,722,756,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz */ + {MODEPREFIX("2048x1536"),266950, 2048,2200,2424,2800,0, 1536,1537,1540,1589,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("1024x768"),133475, 1024,1100,1212,1400,0, 768,768,770,794,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz */ + {MODEPREFIX("2048x1536"),340480, 2048,2216,2440,2832,0, 1536,1537,1540,1603,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("1024x768"),170240, 1024,1108,1220,1416,0, 768,768,770,801,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz */ + {MODEPREFIX("2048x1536"),388040, 2048,2216,2440,2832,0, 1536,1537,1540,1612,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("1024x768"),194020, 1024,1108,1220,1416,0, 768,768,770,806,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX} }; Index: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c:1.10 xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c:1.11 --- xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c:1.10 Sat Oct 27 23:33:18 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c Mon Jul 1 22:00:03 2002 @@ -1,5 +1,4 @@ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.10 2001/10/28 03:33:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.11 2002/07/02 02:00:03 tsi Exp $ */ /* * finish setting up the server * Load the driver modules and call their probe functions. @@ -59,13 +58,20 @@ xf86DriverList[i]->driverName); probeResult = (*xf86DriverList[i]->Probe)(xf86DriverList[i], PROBE_DETECT); - ErrorF("Probe in driver `%s' returns %s\n", - xf86DriverList[i]->driverName, BOOLTOSTRING(probeResult)); + if (!probeResult) { + xf86ErrorF("Probe in driver `%s' returns FALSE\n", + xf86DriverList[i]->driverName); + } else { + xf86ErrorF("Probe in driver `%s' returns TRUE\n", + xf86DriverList[i]->driverName); - /* If we have a result, then call driver's Identify function */ - if (probeResult) { + /* If we have a result, then call driver's Identify function */ if (xf86DriverList[i]->Identify != NULL) { + int verbose = xf86Verbose; + + xf86Verbose = 1; (*xf86DriverList[i]->Identify)(0); + xf86Verbose = verbose; } } } Index: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c:1.11 xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c:1.12 --- xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c:1.11 Thu Feb 24 00:36:50 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c Mon Jul 15 16:46:01 2002 @@ -1,10 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.11 2000/02/24 05:36:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.12 2002/07/15 20:46:01 dawes Exp $ */ /* - * finish setting up the server - * call the functions from the scanpci module + * Finish setting up the server. + * Call the functions from the scanpci module. * - * Copyright 1999 by The XFree86 Project, Inc. + * Copyright 1999-2002 by The XFree86 Project, Inc. * */ @@ -19,19 +19,14 @@ #include "xf86.h" #include "xf86Priv.h" #include "xf86Pci.h" -#define DECLARE_CARD_DATASTRUCTURES -#include "xf86PciInfo.h" #include "xf86ScanPci.h" void DoScanPci(int argc, char **argv, int i) { int j,skip,globalVerbose,scanpciVerbose; - typedef void ScanPciFuncType(int); - typedef void DataSetupFuncType(SymTabPtr *, pciVendorDeviceInfo **, - pciVendorCardInfo **); - ScanPciFuncType *xf86ScanPciFunc; - DataSetupFuncType *DataSetupFunc; + ScanPciSetupProcPtr PciSetup; + ScanPciDisplayCardInfoProcPtr DisplayPCICardInfo; #ifdef XFree86LOADER int errmaj, errmin; #endif @@ -82,20 +77,21 @@ /* For now, just a warning */ xf86Msg(X_WARNING, "Some symbols could not be resolved!\n"); } - xf86ScanPciFunc = (ScanPciFuncType *)LoaderSymbol("xf86DisplayPCICardInfo"); - DataSetupFunc = (DataSetupFuncType *)LoaderSymbol("xf86SetupScanPci"); + PciSetup = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds"); + DisplayPCICardInfo = + (ScanPciDisplayCardInfoProcPtr)LoaderSymbol("ScanPciDisplayPCICardInfo"); #else - xf86ScanPciFunc = xf86DisplayPCICardInfo; - DataSetupFunc = xf86SetupScanPci; + PciSetup = ScanPciSetupPciIds; + DisplayPCICardInfo = ScanPciDisplayPCICardInfo; #endif - (*DataSetupFunc)(&xf86PCIVendorNameInfo, &xf86PCIVendorInfo, - &xf86PCICardInfo); - (*xf86ScanPciFunc)(scanpciVerbose); + if (!(*PciSetup)()) + FatalError("ScanPciSetupPciIds() failed\n"); + (*DisplayPCICardInfo)(scanpciVerbose); /* - * that's it; we really should clean things up, but a simple - * exit seems to be all we need + * That's it; we really should clean things up, but a simple + * exit seems to be all we need. */ exit(0); } Index: xc/programs/Xserver/hw/xfree86/common/xf86Events.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.124 xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.146 --- xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.124 Fri Nov 30 07:11:54 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c Wed Feb 19 23:20:52 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.124 2001/11/30 12:11:54 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.146 2003/02/20 04:20:52 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -26,6 +26,7 @@ /* [JCH-96/01/21] Extended std reverse map to four buttons. */ #include "X.h" +#include "Xpoll.h" #include "Xproto.h" #include "misc.h" @@ -35,7 +36,6 @@ #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" -#include "Xpoll.h" #include "atKeynames.h" @@ -46,11 +46,12 @@ #ifdef XINPUT #include "XI.h" #include "XIproto.h" -#include "xf86Xinput.h" #else #include "inputstr.h" #endif +#include "xf86Xinput.h" +#include "mi.h" #include "mipointer.h" #ifdef XF86BIGFONT @@ -103,13 +104,13 @@ #endif /* - * The first of many hack's to get VT switching to work under + * The first of many hacks to get VT switching to work under * Solaris 2.1 for x86. The basic problem is that Solaris is supposed * to be SVR4. It is for the most part, except where the video interface * is concerned. These hacks work around those problems. - * See the comments for Linux, and SCO. + * See the comments for Linux, and SCO. * - * This is a toggleling variable: + * This is a toggling variable: * FALSE = No VT switching keys have been pressed last time around * TRUE = Possible VT switch Pending * (DWH - 12/2/93) @@ -118,9 +119,9 @@ */ #ifdef USE_VT_SYSREQ -static Bool VTSysreqToggle = FALSE; +Bool VTSysreqToggle = FALSE; #endif /* !USE_VT_SYSREQ */ -static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for +Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD and for avoiding VT switches when using the DRI automatic full screen mode.*/ @@ -253,6 +254,103 @@ } /* + * Handle keyboard events that cause some kind of "action" + * (i.e., server termination, video mode changes, VT switches, etc.) + */ +void +xf86ProcessActionEvent(ActionEvent action, void *arg) +{ +#ifdef DEBUG + ErrorF("ProcessActionEvent(%d,%x)\n", (int) action, arg); +#endif + switch (action) { + case ACTION_TERMINATE: + if (!xf86Info.dontZap) { +#ifdef XFreeXDGA + DGAShutdown(); +#endif + GiveUp(0); + } + break; + case ACTION_NEXT_MODE: + if (!xf86Info.dontZoom) + xf86ZoomViewport(xf86Info.currentScreen, 1); + break; + case ACTION_PREV_MODE: + if (!xf86Info.dontZoom) + xf86ZoomViewport(xf86Info.currentScreen, -1); + break; + case ACTION_DISABLEGRAB: + if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { + if (inputInfo.pointer && inputInfo.pointer->grab != NULL && + inputInfo.pointer->DeactivateGrab) + inputInfo.pointer->DeactivateGrab(inputInfo.pointer); + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && + inputInfo.keyboard->DeactivateGrab) + inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard); + } + break; + case ACTION_CLOSECLIENT: + if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) { + ClientPtr pointer, keyboard, server; + + pointer = keyboard = server = NULL; + if (inputInfo.pointer && inputInfo.pointer->grab != NULL) + pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { + keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; + if (keyboard == pointer) + keyboard = NULL; + } + if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) && + (((server = xf86Info.grabInfo.server.client) == pointer) || + (server == keyboard))) + server = NULL; + + if (pointer) + CloseDownClient(pointer); + if (keyboard) + CloseDownClient(keyboard); + if (server) + CloseDownClient(server); + } + break; +#if !defined(__SOL8__) && (!defined(sun) || defined(i386)) + case ACTION_SWITCHSCREEN: + if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) { + int vtno = *((int *) arg); +#if defined(QNX4) + xf86Info.vtRequestsPending = vtno; +#else + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) + ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); +#endif + } + break; + case ACTION_SWITCHSCREEN_NEXT: + if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0) +#if defined(SCO) || (defined(sun) && defined (i386) && defined (SVR4)) + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0) +#else + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0) +#endif + ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + } + break; + case ACTION_SWITCHSCREEN_PREV: + if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0) + ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + } + break; +#endif + default: + break; + } +} + +/* * xf86PostKbdEvent -- * Translate the raw hardware KbdEvent into an XEvent, and tell DIX * about it. Scancode preprocessing and so on is done ... @@ -266,7 +364,7 @@ extern u_char SpecialServerMap[]; #endif -#if !defined(__EMX__) && \ +#if !defined(__UNIXOS2__) && \ !defined(__SOL8__) && \ (!defined(sun) || defined(i386)) void @@ -289,6 +387,9 @@ #if defined(__sparc__) static int kbdSun = -1; #endif + /* Disable any keyboard processing while in suspend */ + if (xf86inSuspend) + return; #if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) if (first_time) @@ -347,8 +448,12 @@ case KEY_Prefix1: #if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS - || xf86Info.consType == PCVT) { + || xf86Info.consType == PCVT +#ifdef WSCONS_SUPPORT + || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents) #endif + ) { +#endif xf86Info.scanPrefix = scanCode; /* special prefixes */ return; #if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) @@ -361,7 +466,12 @@ else if ( #ifdef CSRG_BASED (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS - || xf86Info.consType == PCVT) && + || xf86Info.consType == PCVT +#ifdef WSCONS_SUPPORT + || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != + xf86WSKbdEvents) +#endif + ) && #endif (xf86Info.scanPrefix == KEY_Prefix0)) { xf86Info.scanPrefix = 0; @@ -494,77 +604,42 @@ } #endif /* defined (__sparc__) */ - if ((ModifierDown(ControlMask | AltMask)) || - (ModifierDown(ControlMask | AltLangMask))) +#ifdef XKB + if ((xf86Info.ddxSpecialKeys == SKWhenNeeded && + !xf86Info.ActionKeyBindingsSet) || + noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) { +#endif + if (!(ModifierDown(ShiftMask)) && + ((ModifierDown(ControlMask | AltMask)) || + (ModifierDown(ControlMask | AltLangMask)))) { - switch (specialkey) { case KEY_BackSpace: - if (!xf86Info.dontZap) { -#ifdef XFreeXDGA - DGAShutdown(); -#endif - GiveUp(0); - } + xf86ProcessActionEvent(ACTION_TERMINATE, NULL); break; /* * Check grabs */ case KEY_KP_Divide: - if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { - if (inputInfo.pointer && inputInfo.pointer->grab != NULL && - inputInfo.pointer->DeactivateGrab) - inputInfo.pointer->DeactivateGrab(inputInfo.pointer); - if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && - inputInfo.keyboard->DeactivateGrab) - inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard); - } + xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); break; case KEY_KP_Multiply: - if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) { - ClientPtr pointer, keyboard, server; - - pointer = keyboard = server = NULL; - if (inputInfo.pointer && inputInfo.pointer->grab != NULL) - pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; - if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { - keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; - if (keyboard == pointer) - keyboard = NULL; - } - if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) && - (((server = xf86Info.grabInfo.server.client) == pointer) || - (server == keyboard))) - server = NULL; - - if (pointer) - CloseDownClient(pointer); - if (keyboard) - CloseDownClient(keyboard); - if (server) - CloseDownClient(server); - } + xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); break; - - /* - * The idea here is to pass the scancode down to a list of - * registered routines. There should be some standard conventions - * for processing certain keys. - */ + + /* + * Video mode switches + */ case KEY_KP_Minus: /* Keypad - */ - if (!xf86Info.dontZoom) { - if (down) xf86ZoomViewport(xf86Info.currentScreen, -1); - return; - } + if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); + if (!xf86Info.dontZoom) return; break; case KEY_KP_Plus: /* Keypad + */ - if (!xf86Info.dontZoom) { - if (down) xf86ZoomViewport(xf86Info.currentScreen, 1); - return; - } + if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); + if (!xf86Info.dontZoom) return; break; /* Under QNX4, we set the vtPending flag for VT switching and @@ -581,12 +656,14 @@ case KEY_7: case KEY_8: case KEY_9: - if (down){ - xf86Info.vtRequestsPending = - specialkey - KEY_1 + 1; - return; - } - break; + if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { + if (down) { + int vtno = specialkey - KEY_1 + 1; + xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); + } + return; + } + break; #endif #if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(SCO) @@ -605,37 +682,23 @@ case KEY_F8: case KEY_F9: case KEY_F10: - if (VTSwitchEnabled && !xf86Info.vtSysreq -#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) - && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) -#endif - ) - { - if (down) -#ifdef SCO325 - ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F1); -#else - ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F1 + 1); -#endif - return; - } - break; case KEY_F11: case KEY_F12: - if (VTSwitchEnabled && !xf86Info.vtSysreq + if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) #if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) #endif - ) - { - if (down) + ) { + int vtno = specialkey - KEY_F1 + 1; + if (specialkey == KEY_F11 || specialkey == KEY_F12) + vtno = specialkey - KEY_F11 + 11; #ifdef SCO325 - ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F11 + 10); -#else - ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F11 + 11); + vtno--; #endif - return; - } + if (down) + xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); + return; + } break; #endif /* linux || BSD with VTs */ @@ -655,7 +718,7 @@ */ #ifdef USE_VT_SYSREQ - if (VTSwitchEnabled && xf86Info.vtSysreq) + if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) { switch (specialkey) { @@ -667,7 +730,7 @@ case KEY_H: if (VTSysreqToggle && down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0); + xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL); VTSysreqToggle = 0; return; } @@ -682,8 +745,7 @@ case KEY_N: if (VTSysreqToggle && down) { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1 ) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); VTSysreqToggle = FALSE; return; } @@ -692,9 +754,7 @@ case KEY_P: if (VTSysreqToggle && down) { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1 ) < 0) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); VTSysreqToggle = FALSE; return; } @@ -711,21 +771,13 @@ case KEY_F8: case KEY_F9: case KEY_F10: - if (VTSysreqToggle && down) - { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey-KEY_F1 + 1) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); - VTSysreqToggle = FALSE; - return; - } - break; - case KEY_F11: case KEY_F12: if (VTSysreqToggle && down) - { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey-KEY_F11 + 11) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + { int vtno = specialkey - KEY_F1 + 1; + if (specialkey == KEY_F11 || specialkey == KEY_F12) + vtno = specialkey - KEY_F11 + 11; + xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); VTSysreqToggle = FALSE; return; } @@ -768,14 +820,26 @@ */ if (specialkey == KEY_Print && ModifierDown(ControlMask)) { if (down) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); return; } #endif /* SCO */ +#ifdef XKB + } +#endif /* + * PC keyboards generate separate key codes for + * Alt+Print and Control+Pause but in the X keyboard model + * they need to get the same key code as the base key on the same + * physical keyboard key. + */ + if (scanCode == KEY_SysReqest) + scanCode = KEY_Print; + else if (scanCode == KEY_Break) + scanCode = KEY_Pause; + + /* * Now map the scancodes to real X-keycodes ... */ keycode = scanCode + MIN_KEYCODE; @@ -890,7 +954,7 @@ #endif /* !CSRG_BASED && ... */ } } - if (updateLeds) xf86KbdLeds(); + if (updateLeds) xf86UpdateKbdLeds(); #ifdef XKB } #endif @@ -929,9 +993,50 @@ ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); } } -#endif /* !__EMX__ */ +#endif /* !__UNIXOS2__ */ +#define ModifierIsSet(k) ((modifiers & (k)) == (k)) +Bool +xf86CommonSpecialKey(int key, Bool down, int modifiers) +{ + if ((ModifierIsSet(ControlMask | AltMask)) || + (ModifierIsSet(ControlMask | AltLangMask))) { + switch (key) { + + case KEY_BackSpace: + xf86ProcessActionEvent(ACTION_TERMINATE, NULL); + break; + + /* + * Check grabs + */ + case KEY_KP_Divide: + xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); + break; + case KEY_KP_Multiply: + xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); + break; + + /* + * The idea here is to pass the scancode down to a list of + * registered routines. There should be some standard conventions + * for processing certain keys. + */ + case KEY_KP_Minus: /* Keypad - */ + if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); + if (!xf86Info.dontZoom) return TRUE; + break; + + case KEY_KP_Plus: /* Keypad + */ + if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); + if (!xf86Info.dontZoom) return TRUE; + break; + } + } + return FALSE; +} + /* * xf86Wakeup -- * Os wakeup handler. @@ -941,7 +1046,7 @@ void xf86Wakeup(pointer blockData, int err, pointer pReadmask) { -#if !defined(__EMX__) && !defined(__QNX__) +#if !defined(__UNIXOS2__) && !defined(__QNX__) fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set devicesWithInput; InputInfoPtr pInfo; @@ -950,7 +1055,8 @@ XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices); if (XFD_ANYSET(&devicesWithInput)) { - (xf86Info.kbdEvents)(); + if (xf86Info.kbdEvents) + (xf86Info.kbdEvents)(); pInfo = xf86InputDevs; while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && @@ -969,7 +1075,7 @@ } } } -#else /* __EMX__ and __QNX__ */ +#else /* __UNIXOS2__ and __QNX__ */ InputInfoPtr pInfo; @@ -991,7 +1097,7 @@ pInfo = pInfo->next; } -#endif /* __EMX__ and __QNX__ */ +#endif /* __UNIXOS2__ and __QNX__ */ if (err >= 0) { /* we don't want the handlers called if select() */ IHPtr ih; /* returned with an error condition, do we? */ @@ -1081,10 +1187,23 @@ #if defined(XFree86LOADER) if (xf86Initialising) LoaderCheckUnresolved(LD_RESOLV_IFDONE); + ErrorF("\n" + " *** If unresolved symbols were reported above, they might not\n" + " *** be the reason for the server aborting.\n"); #endif FatalError("Caught signal %d. Server aborting\n", signo); } +#ifdef MEMDEBUG +void +xf86SigMemDebug(int signo) +{ + CheckMemory(); + (void) signal(signo, xf86SigMemDebug); + return; +} +#endif + /* * xf86VTSwitch -- * Handle requests for switching the vt. @@ -1092,14 +1211,14 @@ static void xf86VTSwitch() { - int i; + int i, prevSIGIO; InputInfoPtr pInfo; IHPtr ih; #ifdef DEBUG ErrorF("xf86VTSwitch()\n"); #endif - + #ifdef XFreeXDGA if(!DGAVTSwitch()) return; @@ -1120,7 +1239,7 @@ if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); } -#if !defined(__EMX__) +#if !defined(__UNIXOS2__) /* * Keep the order: Disable Device > LeaveVT @@ -1132,7 +1251,7 @@ DisableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* !__EMX__ */ +#endif /* !__UNIXOS2__ */ xf86EnterServerState(SETUP); for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->LeaveVT(i, 0); @@ -1150,6 +1269,7 @@ #ifdef DEBUG ErrorF("xf86VTSwitch: Leave failed\n"); #endif + prevSIGIO = xf86BlockSIGIO(); xf86AccessEnter(); xf86EnterServerState(SETUP); for (i = 0; i < xf86NumScreens; i++) { @@ -1165,17 +1285,19 @@ } SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); -#if !defined(__EMX__) +#if !defined(__UNIXOS2__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* !__EMX__ */ - for (ih = InputHandlers; ih; ih = ih->next) - xf86EnableInputHandler(ih); +#endif /* !__UNIXOS2__ */ + for (ih = InputHandlers; ih; ih = ih->next) + xf86EnableInputHandler(ih); + xf86UnblockSIGIO(prevSIGIO); + } else { if (xf86OSPMClose) xf86OSPMClose(); @@ -1193,10 +1315,13 @@ xf86DisableIO(); } } else { + #ifdef DEBUG ErrorF("xf86VTSwitch: Entering\n"); #endif if (!xf86VTSwitchTo()) return; + + prevSIGIO = xf86BlockSIGIO(); xf86OSPMClose = xf86OSPMOpen(); xf86EnableIO(); @@ -1216,17 +1341,19 @@ /* Turn screen saver off when switching back */ SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); -#if !defined(__EMX__) +#if !defined(__UNIXOS2__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* !__EMX__ */ +#endif /* !__UNIXOS2__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); + + xf86UnblockSIGIO(prevSIGIO); } } @@ -1389,16 +1516,19 @@ { int type = event->type; int value = event->value; - Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); unsigned int keycode; int blocked; - /* map the scancodes to standard XFree86 scancode */ - keycode = WSKbdToKeycode(value); - if (!down) keycode |= 0x80; - /* It seems better to block SIGIO there */ - blocked = xf86BlockSIGIO(); - xf86PostKbdEvent(keycode); - xf86UnblockSIGIO(blocked); + if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) { + Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); + + /* map the scancodes to standard XFree86 scancode */ + keycode = WSKbdToKeycode(value); + if (!down) keycode |= 0x80; + /* It seems better to block SIGIO there */ + blocked = xf86BlockSIGIO(); + xf86PostKbdEvent(keycode); + xf86UnblockSIGIO(blocked); + } } #endif /* WSCONS_SUPPORT */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.36 xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.40 --- xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.36 Fri Nov 30 07:11:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Globals.c Wed Feb 19 23:05:14 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.36 2001/11/30 12:11:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.40 2003/02/20 04:05:14 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -89,6 +89,8 @@ FALSE, /* modeSwitchLock */ FALSE, /* composeLock */ FALSE, /* vtSysreq */ + SKWhenNeeded, /* ddxSpecialKeys */ + FALSE, /* ActionKeyBindingsSet */ #if defined(SVR4) && defined(i386) FALSE, /* panix106 */ #endif @@ -102,6 +104,7 @@ -1, /* lastEventTime */ FALSE, /* vtRequestsPending */ FALSE, /* inputPending */ + FALSE, /* dontVTSwitch */ FALSE, /* dontZap */ FALSE, /* dontZoom */ FALSE, /* notrapSignals */ @@ -138,11 +141,14 @@ FALSE, /* pc98 */ #endif TRUE, /* pmFlag */ - FALSE, /* syncLog */ + LogNone, /* syncLog */ 0, /* estimateSizesAggressively */ - FALSE /* kbdCustomKeycodes */ + FALSE, /* kbdCustomKeycodes */ + FALSE, /* disableRandR */ + X_DEFAULT /* randRFrom */ }; const char *xf86ConfigFile = NULL; +const char *xf86InputDeviceList = NULL; const char *xf86ModulePath = DEFAULT_MODULE_PATH; MessageType xf86ModPathFrom = X_DEFAULT; const char *xf86LogFile = DEFAULT_LOGPREFIX; @@ -208,6 +214,7 @@ Bool xf86MiscModInDevAllowNonLocal = FALSE; #endif PropertyPtr *xf86RegisteredPropertiesTable = NULL; +Bool xf86inSuspend = FALSE; #ifdef DLOPEN_HACK /* Index: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.120 xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.128 --- xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.120 Tue Dec 4 12:28:58 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Helper.c Wed Feb 26 18:45:24 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.120 2001/12/04 17:28:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.128 2003/02/26 23:45:24 dawes Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -29,6 +29,7 @@ #include "mivalidate.h" #include "xf86RAC.h" #include "xf86Bus.h" +#include "xf86Version.h" /* For xf86GetClocks */ #if defined(CSRG_BASED) || defined(__GNU__) @@ -1003,7 +1004,7 @@ */ static void -xf86SetRootClip (ScreenPtr pScreen, BOOL enable) +xf86SetRootClip (ScreenPtr pScreen, Bool enable) { WindowPtr pWin = WindowTable[pScreen->myNum]; WindowPtr pChild; @@ -1052,8 +1053,13 @@ box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; - REGION_RESET(pScreen, &pWin->borderClip, &box); - REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + REGION_INIT (pScreen, &pWin->winSize, &box, 1); + REGION_INIT (pScreen, &pWin->borderSize, &box, 1); + if (WasViewable) + REGION_RESET(pScreen, &pWin->borderClip, &box); + pWin->drawable.width = pScreen->width; + pWin->drawable.height = pScreen->height; + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); } else { @@ -1213,8 +1219,11 @@ if ((verb < 0 || xf86LogVerbose >= verb) && len > 0) { if (logfile) { fwrite(buffer, len, 1, logfile); - if (xf86Info.syncLog) + if (xf86Info.log) { fflush(logfile); + if (xf86Info.log == LogSync) + fsync(fileno(logfile)); + } } else { /* * Note, this code is used before OsInit() has been called, so @@ -1381,11 +1390,11 @@ void xf86LogInit() { -#ifndef __EMX__ char *lf; #define LOGSUFFIX ".log" - +#define LOGOLDSUFFIX ".old" + /* Get the log file name */ if (xf86LogFileFrom == X_DEFAULT) { /* Append the display number and ".log" */ @@ -1396,6 +1405,20 @@ sprintf(lf, "%s%s" LOGSUFFIX, xf86LogFile, display); xf86LogFile = lf; } + { + struct stat buf; + if (!stat(xf86LogFile,&buf) && S_ISREG(buf.st_mode)) { + char *oldlog = (char *)malloc(strlen(xf86LogFile) + + strlen(LOGOLDSUFFIX)); + if (!oldlog) + FatalError("Cannot allocate space for the log file name\n"); + sprintf(oldlog, "%s" LOGOLDSUFFIX, xf86LogFile); + if (rename(xf86LogFile,oldlog) == -1) + FatalError("Cannot move old logfile \"%s\"\n",oldlog); + free(oldlog); + } + } + if ((logfile = fopen(xf86LogFile, "w")) == NULL) FatalError("Cannot open log file \"%s\"\n", xf86LogFile); xf86LogFileWasOpened = TRUE; @@ -1408,17 +1431,17 @@ /* Flush saved log information */ if (saveBuffer && size > 0) { fwrite(saveBuffer, pos, 1, logfile); - if (xf86Info.syncLog) + if (xf86Info.log) { fflush(logfile); + if (xf86Info.log == LogFlush) + fsync(fileno(logfile)); + } free(saveBuffer); /* Note, must be free(), not xfree() */ saveBuffer = 0; size = 0; } #undef LOGSUFFIX -#else /* __EMX__ */ - xf86LogFile = NULL; -#endif /* __EMX__ */ } void @@ -1718,7 +1741,10 @@ GDevPtr pGDev; int actualcards = 0; for (i = 0; i < allocatedInstances; i++) { + pPci = instances[i].pci; if (instances[i].foundHW) { + if (!xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) + continue; actualcards++; pGDev = xf86AddDeviceToConfigure(drvp->driverName, instances[i].pci, -1); @@ -1808,9 +1834,11 @@ } if (devBus) dev = devBus; /* busID preferred */ if (!dev) { - xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " - "for instance (BusID PCI:%i:%i:%i) found\n", - driverName, pPci->bus, pPci->device, pPci->func); + if (xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) { + xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " + "for instance (BusID PCI:%i:%i:%i) found\n", + driverName, pPci->bus, pPci->device, pPci->func); + } } else { numClaimedInstances++; instances[i].claimed = TRUE; @@ -2030,7 +2058,7 @@ } } -/* Check if the chip type is listed in the chipset table - for sanity*/ + /* Check if the chip type is listed in the chipset table - for sanity*/ if (foundChip >= 0){ for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) { @@ -2067,7 +2095,7 @@ void xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), void (*ProtectRegs)(ScrnInfoPtr, Bool), - void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg, + void (*BlankScreen)(ScrnInfoPtr, Bool), IOADDRESS vertsyncreg, int maskval, int knownclkindex, int knownclkvalue) { register int status = vertsyncreg; @@ -2331,6 +2359,29 @@ return xf86Info.pc98; #else return FALSE; +#endif +} + +void +xf86DisableRandR() +{ + xf86Info.disableRandR = TRUE; + xf86Info.randRFrom = X_PROBED; +} + +CARD32 +xf86GetVersion() +{ + return XF86_VERSION_CURRENT; +} + +CARD32 +xf86GetModuleVersion(pointer module) +{ +#ifdef XFree86LOADER + return (CARD32)LoaderGetModuleVersion(module); +#else + return 0; #endif } Index: xc/programs/Xserver/hw/xfree86/common/xf86Init.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.185 xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.198 --- xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.185 Mon Jan 14 20:56:56 2002 +++ xc/programs/Xserver/hw/xfree86/common/xf86Init.c Wed Feb 26 04:21:38 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.185 2002/01/15 01:56:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.198 2003/02/26 09:21:38 dawes Exp $ */ /* * Copyright 1991-1999 by The XFree86 Project, Inc. @@ -20,6 +20,7 @@ #include "windowstr.h" #include "scrnintstr.h" #include "site.h" +#include "mi.h" #include "compiler.h" @@ -36,6 +37,8 @@ #include "xf86Config.h" #include "xf86_OSlib.h" #include "xf86Version.h" +#include "xf86Date.h" +#include "xf86Build.h" #include "mipointer.h" #ifdef XINPUT #include "XI.h" @@ -43,8 +46,12 @@ #else #include "inputstr.h" #endif +#include "xf86DDC.h" #include "xf86Xinput.h" #include "xf86InPriv.h" +#ifdef RENDER +#include "picturestr.h" +#endif #include "globals.h" @@ -65,7 +72,7 @@ static char *expKey = NULL; #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ extern void os2ServerVideoAccess(); #endif @@ -209,7 +216,7 @@ MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; -#ifdef __EMX__ +#ifdef __UNIXOS2__ os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */ #endif @@ -239,14 +246,13 @@ xf86PrintBanner(); xf86PrintMarkers(); - { + if (xf86LogFile) { time_t t; const char *ct; t = time(NULL); ct = ctime(&t); - if (xf86LogFile) - xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", - xf86LogFile, ct); + xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", + xf86LogFile, ct); } /* Read and parse the config file */ @@ -280,6 +286,9 @@ #ifdef SIGXFSZ signal(SIGXFSZ,xf86SigHandler); #endif +#ifdef MEMDEBUG + signal(SIGUSR2,xf86SigMemDebug); +#endif } xf86OpenConsole(); @@ -843,6 +852,23 @@ = (void*)(xf86Screens[i]->pScreen->CreateWindow); xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow; +#ifdef RENDER + if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown) + { + xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC); + PictureSetSubpixelOrder (xf86Screens[i]->pScreen, + DDC ? + (DDC->features.input_type ? + SubPixelHorizontalRGB : SubPixelNone) : + SubPixelUnknown); + } +#endif +#ifdef RANDR + if (!xf86Info.disableRandR) + xf86RandRInit (screenInfo.screens[scr_index]); + xf86Msg(xf86Info.randRFrom, "RandR %s\n", + xf86Info.disableRandR ? "disabled" : "enabled"); +#endif #ifdef NOT_USED /* * Here we have to let the driver getting access of the VT. Note that @@ -898,7 +924,8 @@ { IDevPtr pDev; InputDriverPtr pDrv; - InputInfoPtr pInfo, coreKeyboard = NULL, corePointer = NULL; + InputInfoPtr pInfo; + static InputInfoPtr coreKeyboard = NULL, corePointer = NULL; xf86Info.vtRequestsPending = FALSE; xf86Info.inputPending = FALSE; @@ -991,6 +1018,7 @@ if (coreKeyboard) { xf86Info.pKeyboard = coreKeyboard->dev; + xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/ } else { xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE); @@ -1003,7 +1031,7 @@ #ifdef XINPUT xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse); #else - mieqInit (xf86Info.pKeyboard, xf86Info.pMouse); + mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse); #endif } @@ -1074,7 +1102,24 @@ void ddxGiveUp() { + int i; + + if (xf86OSPMClose) + xf86OSPMClose(); + xf86OSPMClose = NULL; + xf86AccessLeaveState(); + + for (i = 0; i < xf86NumScreens; i++) { + /* + * zero all access functions to + * trap calls when switched away. + */ + xf86Screens[i]->vtSema = FALSE; + xf86Screens[i]->access = NULL; + xf86Screens[i]->busAccess = NULL; + } + #ifdef USE_XF86_SERVERLOCK xf86UnlockServer(); #endif @@ -1083,9 +1128,6 @@ #endif xf86CloseConsole(); - if (xf86OSPMClose) - xf86OSPMClose(); - xf86OSPMClose = NULL; xf86CloseLog(); @@ -1152,7 +1194,7 @@ "the full server output, not just the last messages.\n"); if (xf86LogFile && xf86LogFileWasOpened) ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile); - ErrorF("Please report problems to %s.\n",BUILDERADDR); + ErrorF("Please report problems to %s.\n", BUILDERADDR); ErrorF("\n"); } @@ -1597,7 +1639,7 @@ "way. Bugs may be reported to XFree86@XFree86.Org and patches submitted\n" "to fixes@XFree86.Org. Before reporting bugs in pre-release versions,\n" "please check the latest version in the XFree86 CVS repository\n" - "(http://www.XFree86.Org/cvs)\n"); + "(http://www.XFree86.Org/cvs).\n"); #endif ErrorF("\nXFree86 Version %d.%d.%d", XF86_VERSION_MAJOR, XF86_VERSION_MINOR, XF86_VERSION_PATCH); @@ -1613,17 +1655,29 @@ #ifdef XF86_CUSTOM_VERSION ErrorF(" (%s)", XF86_CUSTOM_VERSION); #endif - ErrorF(" / X Window System\n"); - ErrorF("(protocol Version %d, revision %d, vendor release %d)\n", - X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE ); - ErrorF("Release Date: %s\n", XF86_DATE); - ErrorF("\tIf the server is older than 6-12 months, or if your card is\n" - "\tnewer than the above date, look for a newer version before\n" - "\treporting problems. (See http://www.XFree86.Org/)\n"); + ErrorF("\nRelease Date: %s\n", XF86_DATE); + ErrorF("X Protocol Version %d, Revision %d, %s\n", + X_PROTOCOL, X_PROTOCOL_REVISION, XORG_RELEASE ); ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR); +#ifdef BUILD_DATE + { + struct tm t; + char buf[100]; + + bzero(&t, sizeof(t)); + bzero(buf, sizeof(buf)); + t.tm_mday = BUILD_DATE % 100; + t.tm_mon = (BUILD_DATE / 100) % 100 - 1; + t.tm_year = BUILD_DATE / 10000 - 1900; + if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) + ErrorF("Build Date: %s\n", buf); + } +#endif #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); #endif + ErrorF("\tBefore reporting problems, check http://www.XFree86.Org/\n" + "\tto make sure that you have the latest version.\n"); #ifdef XFree86LOADER ErrorF("Module Loader present\n"); #endif @@ -1668,7 +1722,7 @@ dup(xf86Info.consoleFd); } } - execl("/bin/sh", "sh", "-c", xf86Info.vtinit, NULL); + execl("/bin/sh", "sh", "-c", xf86Info.vtinit, (void *)NULL); xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n", strerror(errno)); exit(255); Index: xc/programs/Xserver/hw/xfree86/common/xf86Io.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.46 xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.53 --- xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.46 Thu Nov 8 16:49:43 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Io.c Tue Jan 14 22:29:05 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.46 2001/11/08 21:49:43 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.53 2003/01/15 03:29:05 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -72,37 +72,57 @@ } void -xf86KbdLeds () +xf86UpdateKbdLeds() { int leds = 0; -#ifdef XKB - if (!noXkbExtension) { - XkbEventCauseRec cause; - XkbSetCauseUnknown(&cause); - XkbUpdateIndicators((DeviceIntPtr)xf86Info.pKeyboard, - XkbAllIndicatorsMask, False, NULL, &cause); - return; - } -#endif -#ifdef LED_CAP - if (xf86Info.capsLock && !(xf86Info.xleds & XLED1)) - leds |= LED_CAP; + if (xf86Info.capsLock) leds |= XLED1; + if (xf86Info.numLock) leds |= XLED2; + if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3; + if (xf86Info.composeLock) leds |= XLED4; + xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds); + xf86KbdLeds(); +} - if (xf86Info.numLock && !(xf86Info.xleds & XLED2)) - leds |= LED_NUM; +void +xf86KbdLeds () +{ + int leds, real_leds = 0; - if ((xf86Info.scrollLock || - xf86Info.modeSwitchLock || - xf86Info.composeLock) && - !(xf86Info.xleds & XLED3)) - leds |= LED_SCR; - - if ((xf86Info.leds & xf86Info.xleds) & XLED1) leds |= LED_CAP; - if ((xf86Info.leds & xf86Info.xleds) & XLED2) leds |= LED_NUM; - if ((xf86Info.leds & xf86Info.xleds) & XLED3) leds |= LED_SCR; +#if defined (__sparc__) + static int kbdSun = -1; + if (kbdSun == -1) { + if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) || + (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) + kbdSun = 1; + else + kbdSun = 0; + } + if (kbdSun) { + if (xf86Info.leds & 0x08) real_leds |= XLED1; + if (xf86Info.leds & 0x04) real_leds |= XLED3; + if (xf86Info.leds & 0x02) real_leds |= XLED4; + if (xf86Info.leds & 0x01) real_leds |= XLED2; + leds = real_leds; + real_leds = 0; + } else { + leds = xf86Info.leds; + } +#else + leds = xf86Info.leds; +#endif /* defined (__sparc__) */ - xf86SetKbdLeds(leds); -#endif /* LED_CAP */ +#ifdef LED_CAP + if (leds & XLED1) real_leds |= LED_CAP; + if (leds & XLED2) real_leds |= LED_NUM; + if (leds & XLED3) real_leds |= LED_SCR; +#ifdef LED_COMP + if (leds & XLED4) real_leds |= LED_COMP; +#else + if (leds & XLED4) real_leds |= LED_SCR; +#endif +#endif + xf86SetKbdLeds(real_leds); + return; } /* @@ -116,19 +136,30 @@ DevicePtr pKeyboard; /* Keyboard to alter */ KeybdCtrl *ctrl; { + int leds; xf86Info.bell_pitch = ctrl->bell_pitch; xf86Info.bell_duration = ctrl->bell_duration; xf86Info.autoRepeat = ctrl->autoRepeat; - xf86Info.leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR)); xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE; + leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR)); +#ifdef XKB + if (noXkbExtension) { +#endif + xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds); +#ifdef XKB + } else { + xf86Info.leds = leds; + } +#endif + xf86KbdLeds(); } /* * xf86InitKBD -- - * Reinitialize the keyboard. Only set Lockkeys accrding to ours leds. + * Reinitialize the keyboard. Only set Lockkeys according to ours leds. * Depress all other keys. */ @@ -297,7 +328,10 @@ (KbdCtrlProcPtr)xf86KbdCtrl); #ifdef XKB } else { - XkbComponentNamesRec names; + XkbComponentNamesRec names; + XkbDescPtr desc; + Bool foundTerminate = FALSE; + int keyc; if (XkbInitialMap) { if ((xf86Info.xkbkeymap = strchr(XkbInitialMap, '/')) != NULL) xf86Info.xkbkeymap++; @@ -326,12 +360,30 @@ XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel, xf86Info.xkblayout, xf86Info.xkbvariant, xf86Info.xkboptions); + XkbInitKeyboardDeviceStruct(pKeyboard, &names, &keySyms, modMap, xf86KbdBell, (KbdCtrlProcPtr)xf86KbdCtrl); + + /* Search keymap for Terminate action */ + desc = pKeyboard->key->xkbInfo->desc; + for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) { + int i; + for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) { + if (XkbKeyAction(desc, keyc, i) + && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) { + foundTerminate = TRUE; + goto searchdone; + } + } + } +searchdone: + xf86Info.ActionKeyBindingsSet = foundTerminate; + if (!foundTerminate) + xf86Msg(X_INFO, "Server_Terminate keybinding not found\n"); } #endif @@ -350,15 +402,21 @@ * passing on parts of the VT switch sequence. */ sleep(1); - if (kbdFd != -1) { - char buf[16]; - read(kbdFd, buf, 16); +#if defined(WSCONS_SUPPORT) + if (xf86Info.consType != WSCONS) { +#endif + if (kbdFd != -1) { + char buf[16]; + read(kbdFd, buf, 16); + } +#if defined(WSCONS_SUPPORT) } +#endif -#if !defined(__EMX__) /* Under EMX, keyboard cannot be select()'ed */ +#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */ if (kbdFd != -1) AddEnabledDevice(kbdFd); -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ pKeyboard->public.on = TRUE; xf86InitKBD(FALSE); @@ -393,25 +451,20 @@ { struct timeval tp; register CARD32 val; + register INT32 diff; static CARD32 oldval = 0; - static CARD32 skew = 0; + static CARD32 time = 0; gettimeofday(&tp, 0); - val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000) + skew; - /* On some systems the clock is not monothonic */ - if ((val < oldval) && ((oldval - val) < HALFMONTH)) { - /* if clock is not monothonic find out clock skew skew */ - xf86MsgVerb(X_WARNING,4,"System time not monotonic!\n"); - skew += oldval - val; - val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000) + skew; - } else if (skew && ((val - oldval) < HALFMONTH)) { - /* try to reduce skew */ - INT32 diff = skew - (val - oldval); - skew = diff < 0 ? 0 : diff; - val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000) + skew; + val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000); + if (oldval) { + diff = val - oldval; + if (diff > 0) + time += diff; } oldval = val; - return val; + + return time; } #endif /* DDXTIME && !QNX4 */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c:3.23 xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c:3.24 --- xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c:3.23 Sat Oct 27 23:33:19 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c Fri May 31 14:45:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.23 2001/10/28 03:33:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.24 2002/05/31 18:45:58 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -40,13 +40,13 @@ #if defined(KDGKBTYPE) && \ !defined(Lynx) && \ - !defined(__EMX__) && !defined(__mips__) && \ + !defined(__UNIXOS2__) && !defined(__mips__) && \ !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__) #define HAS_GETKBTYPE #endif #if defined(GIO_KEYMAP) && \ !defined(Lynx) && \ - !defined(__EMX__) && !defined(__mips__) && \ + !defined(__UNIXOS2__) && !defined(__mips__) && \ !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \ !defined(__QNX__) #define HAS_GETKEYMAP @@ -270,7 +270,7 @@ pMap = map; #else /* OS/2 sets the keyboard type during xf86OpenKbd */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ xf86Info.kbdType = 0; #endif pMap = map; Index: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.18 xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.20 --- xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.18 Sun Oct 21 08:30:38 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c Wed May 22 17:38:27 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.18 2001/10/21 12:30:38 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.20 2002/05/22 21:38:27 herrb Exp $ */ /* * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -1057,6 +1057,139 @@ /* 223 */ KEY_NOTUSED, }; +static CARD8 wsSunMap[] = { + /* 0x00 */ KEY_NOTUSED, + /* 0x01 */ KEY_NOTUSED, /* stop */ + /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */ + /* 0x03 */ KEY_NOTUSED, /* again */ + /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */ + /* 0x05 */ KEY_F1, + /* 0x06 */ KEY_F2, + /* 0x07 */ KEY_F10, + /* 0x08 */ KEY_F3, + /* 0x09 */ KEY_F11, + /* 0x0a */ KEY_F4, + /* 0x0b */ KEY_F12, + /* 0x0c */ KEY_F5, + /* 0x0d */ KEY_AltLang, + /* 0x0e */ KEY_F6, + /* 0x0f */ KEY_NOTUSED, + /* 0x10 */ KEY_F7, + /* 0x11 */ KEY_F8, + /* 0x12 */ KEY_F9, + /* 0x13 */ KEY_Alt, + /* 0x14 */ KEY_Up, + /* 0x15 */ KEY_Pause, + /* 0x16 */ KEY_Print, + /* 0x17 */ KEY_NOTUSED, /* props */ + /* 0x18 */ KEY_Left, + /* 0x19 */ KEY_ScrollLock, + /* 0x1a */ KEY_NOTUSED, /* undo */ + /* 0x1b */ KEY_Down, + /* 0x1c */ KEY_Right, + /* 0x1d */ KEY_Escape, + /* 0x1e */ KEY_1, + /* 0x1f */ KEY_2, + /* 0x20 */ KEY_3, + /* 0x21 */ KEY_4, + /* 0x22 */ KEY_5, + /* 0x23 */ KEY_6, + /* 0x24 */ KEY_7, + /* 0x25 */ KEY_8, + /* 0x26 */ KEY_9, + /* 0x27 */ KEY_0, + /* 0x28 */ KEY_Minus, + /* 0x29 */ KEY_Equal, + /* 0x2a */ KEY_Tilde, + /* 0x2b */ KEY_BackSpace, + /* 0x2c */ KEY_Insert, + /* 0x2d */ KEY_KP_Equal, + /* 0x2e */ KEY_KP_Divide, + /* 0x2f */ KEY_KP_Multiply, + /* 0x30 */ KEY_NOTUSED, + /* 0x31 */ KEY_NOTUSED, /* front */ + /* 0x32 */ KEY_KP_Decimal, + /* 0x33 */ KEY_NOTUSED, /* copy */ + /* 0x34 */ KEY_Home, + /* 0x35 */ KEY_Tab, + /* 0x36 */ KEY_Q, + /* 0x37 */ KEY_W, + /* 0x38 */ KEY_E, + /* 0x39 */ KEY_R, + /* 0x3a */ KEY_T, + /* 0x3b */ KEY_Y, + /* 0x3c */ KEY_U, + /* 0x3d */ KEY_I, + /* 0x3e */ KEY_O, + /* 0x3f */ KEY_P, + /* 0x40 */ KEY_LBrace, + /* 0x41 */ KEY_RBrace, + /* 0x42 */ KEY_Delete, + /* 0x43 */ KEY_NOTUSED, /* compose */ + /* 0x44 */ KEY_KP_7, + /* 0x45 */ KEY_KP_8, + /* 0x46 */ KEY_KP_9, + /* 0x47 */ KEY_KP_Minus, + /* 0x48 */ KEY_NOTUSED, /* open */ + /* 0x49 */ KEY_NOTUSED, /* paste */ + /* 0x4a */ KEY_End, + /* 0x4b */ KEY_NOTUSED, + /* 0x4c */ KEY_LCtrl, + /* 0x4d */ KEY_A, + /* 0x4e */ KEY_S, + /* 0x4f */ KEY_D, + /* 0x50 */ KEY_F, + /* 0x51 */ KEY_G, + /* 0x52 */ KEY_H, + /* 0x53 */ KEY_J, + /* 0x54 */ KEY_K, + /* 0x55 */ KEY_L, + /* 0x56 */ KEY_SemiColon, + /* 0x57 */ KEY_Quote, + /* 0x58 */ KEY_BSlash, + /* 0x59 */ KEY_Enter, + /* 0x5a */ KEY_KP_Enter, + /* 0x5b */ KEY_KP_4, + /* 0x5c */ KEY_KP_5, + /* 0x5d */ KEY_KP_6, + /* 0x5e */ KEY_KP_0, + /* 0x5f */ KEY_NOTUSED, /* find */ + /* 0x60 */ KEY_PgUp, + /* 0x61 */ KEY_NOTUSED, /* cut */ + /* 0x62 */ KEY_NumLock, + /* 0x63 */ KEY_ShiftL, + /* 0x64 */ KEY_Z, + /* 0x65 */ KEY_X, + /* 0x66 */ KEY_C, + /* 0x67 */ KEY_V, + /* 0x68 */ KEY_B, + /* 0x69 */ KEY_N, + /* 0x6a */ KEY_M, + /* 0x6b */ KEY_Comma, + /* 0x6c */ KEY_Period, + /* 0x6d */ KEY_Slash, + /* 0x6e */ KEY_ShiftR, + /* 0x6f */ KEY_NOTUSED, /* linefeed */ + /* 0x70 */ KEY_KP_1, + /* 0x71 */ KEY_KP_2, + /* 0x72 */ KEY_KP_3, + /* 0x73 */ KEY_NOTUSED, + /* 0x74 */ KEY_NOTUSED, + /* 0x75 */ KEY_NOTUSED, + /* 0x76 */ KEY_NOTUSED, /* help */ + /* 0x77 */ KEY_CapsLock, + /* 0x78 */ KEY_LMeta, + /* 0x79 */ KEY_Space, + /* 0x7a */ KEY_RMeta, + /* 0x7b */ KEY_PgDown, + /* 0x7c */ KEY_NOTUSED, + /* 0x7d */ KEY_KP_Plus, + /* 0x7e */ KEY_NOTUSED, + /* 0x7f */ KEY_NOTUSED +}; + +#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) + #define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) @@ -1084,8 +1217,15 @@ else return wsAdbMap[keycode]; #endif +#ifdef WSKBD_TYPE_SUN + case WSKBD_TYPE_SUN: + if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE) + return KEY_UNKNOWN; + else + return wsSunMap[keycode]; +#endif default: - ErrorF("Unkown wskbd type %d\n", xf86Info.wsKbdType); + ErrorF("Unknown wskbd type %d\n", xf86Info.wsKbdType); return KEY_UNKNOWN; } } Index: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.18 xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.19 --- xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.18 Mon Jul 23 09:15:47 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h Fri May 31 14:45:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.18 2001/07/23 13:15:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.19 2002/05/31 18:45:58 dawes Exp $ */ /* * * For Scancodes see notes in atKeynames.h !!!! @@ -283,7 +283,7 @@ }; #if !defined(Lynx) && \ - !defined(__EMX__) && \ + !defined(__UNIXOS2__) && \ !defined(__mips__) && \ !defined(linux) && \ !defined(CSRG_BASED) && \ Index: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c:1.8 xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c:1.11 --- xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c:1.8 Thu Aug 16 10:33:51 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c Tue Nov 19 23:04:57 2002 @@ -1,7 +1,7 @@ /* * Copyright (c) 1999 by The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.8 2001/08/16 14:33:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.11 2002/11/20 04:04:57 dawes Exp $ */ /* * This file contains the Pointer/Keyboard functions needed by the @@ -75,39 +75,51 @@ The extension should probably be changed to use protocol names instead of ID numbers */ +struct mouse_map { + int mtype; + MouseProtocolID proto; +}; + static int MapMseProto(int proto, MseProtoMapDirection mapping) { - static int MapProto_ToMisc[] = { - MTYPE_MICROSOFT, MTYPE_MOUSESYS, MTYPE_MMSERIES, - MTYPE_LOGITECH, MTYPE_LOGIMAN, MTYPE_MMHIT, - MTYPE_GLIDEPOINT, MTYPE_IMSERIAL, MTYPE_THINKING, - MTYPE_ACECAD, MTYPE_PS_2, MTYPE_IMPS2, - MTYPE_EXPPS2, MTYPE_THINKINGPS2, MTYPE_MMANPLUSPS2, - MTYPE_GLIDEPOINTPS2, MTYPE_NETPS2, MTYPE_NETSCROLLPS2, - MTYPE_BUSMOUSE, MTYPE_AUTOMOUSE, MTYPE_SYSMOUSE - }; - - static MouseProtocolID MapProto_FromMisc[] = { - PROT_MS, PROT_MSC, PROT_MM, PROT_LOGI, - PROT_BM, PROT_LOGIMAN, PROT_PS2, PROT_MMHIT, - PROT_GLIDE, PROT_IMSERIAL, PROT_THINKING, PROT_IMPS2, - PROT_THINKPS2, PROT_MMPS2, PROT_GLIDEPS2, PROT_NETPS2, - PROT_NETSCPS2, PROT_SYSMOUSE, PROT_AUTO, PROT_ACECAD, - PROT_EXPPS2 + int i; + + static struct mouse_map m_map[] = + { + { MTYPE_MICROSOFT, PROT_MS }, + { MTYPE_MOUSESYS, PROT_MSC }, + { MTYPE_MMSERIES, PROT_MM }, + { MTYPE_LOGITECH, PROT_LOGI }, + { MTYPE_LOGIMAN, PROT_LOGIMAN }, + { MTYPE_MMHIT, PROT_MMHIT }, + { MTYPE_GLIDEPOINT, PROT_GLIDE }, + { MTYPE_IMSERIAL, PROT_IMSERIAL }, + { MTYPE_THINKING, PROT_THINKING }, + { MTYPE_ACECAD, PROT_ACECAD }, + { MTYPE_PS_2, PROT_PS2 }, + { MTYPE_IMPS2, PROT_IMPS2 }, + { MTYPE_EXPPS2, PROT_EXPPS2 }, + { MTYPE_THINKINGPS2, PROT_THINKPS2 }, + { MTYPE_MMANPLUSPS2, PROT_MMPS2 }, + { MTYPE_GLIDEPOINTPS2, PROT_GLIDEPS2 }, + { MTYPE_NETPS2, PROT_NETPS2 }, + { MTYPE_NETSCROLLPS2, PROT_NETSCPS2 }, + { MTYPE_BUSMOUSE, PROT_BM }, + { MTYPE_AUTOMOUSE, PROT_AUTO }, + { MTYPE_SYSMOUSE, PROT_SYSMOUSE }, + { MTYPE_UNKNOWN, PROT_UNKNOWN } }; -#define PROT_DEFAULT -2 /* PROT_UNKNOWN */ - + if (mapping == TO_MISC) { - if (proto < 0 || proto >= sizeof(MapProto_ToMisc)/sizeof(int)) - return MTYPE_UNKNOWN; - return MapProto_ToMisc[proto]; + for (i = 0; m_map[i].proto != PROT_UNKNOWN; i++) + if (proto == m_map[i].proto) return m_map[i].mtype; + return MTYPE_UNKNOWN; } else { - if (proto < 0 || proto >= sizeof(MapProto_FromMisc)/sizeof(int)) - return PROT_DEFAULT; - return MapProto_FromMisc[proto]; + for (i = 0; m_map[i].mtype != MTYPE_UNKNOWN; i++) + if (proto == m_map[i].mtype) return m_map[i].proto; + return PROT_UNKNOWN; } -#undef PROT_DEFAULT } Bool @@ -202,18 +214,16 @@ return FALSE; } -/* The misc extension doesn't (yet) call this. */ -#if 0 Bool MiscExtSetMouseDevice(pointer mouse, char* device) { mseParamsPtr mse = mouse; mse->device = device; + return TRUE; } -#endif - + Bool MiscExtGetKbdSettings(pointer *kbd) { @@ -357,12 +367,64 @@ } } +static Bool +MiscExtAuthorizeDevice(InputInfoPtr pInfo, char *device) +{ + Bool authorized = FALSE; + char *elem; + struct stat dev, dev_list; + const char *olddev = xf86FindOptionValue(pInfo->options, "Device"); + + if (stat(device,&dev)) + return FALSE; + + if (!S_ISCHR(dev.st_mode)) + return FALSE; + + if (!stat(olddev,&dev_list)) { + if (dev_list.st_dev == dev.st_dev + && dev_list.st_ino == dev.st_ino) { + authorized = TRUE; + } + } + + if (!authorized) { + char *path; + + if (!xf86InputDeviceList + || (path = strdup(xf86InputDeviceList)) == NULL) + return FALSE; + + elem = strtok(path,","); + + while (elem) { + + if (!stat(elem,&dev_list)) { + if (dev_list.st_dev == dev.st_dev + && dev_list.st_ino == dev.st_ino) { + authorized = TRUE; + break; + + } + } + elem = strtok(NULL,","); + } + xfree(path); + } +#if 0 + ErrorF("AUTHORIZED: %s\n",authorized?"Yes":"No"); +#endif + return (authorized); +} + MiscExtReturn MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) { DEBUG_P("MiscExtApply"); if (mse_or_kbd == MISC_POINTER) { + Bool protoChanged = FALSE; + int oldflags; Bool reopen = FALSE; mseParamsPtr mse = structure; InputInfoPtr pInfo; @@ -374,7 +436,7 @@ return MISC_RET_NOMODULE; #endif if (mse->type < MTYPE_MICROSOFT - || ( mse->type > MTYPE_ACECAD + || ( mse->type > MTYPE_EXPPS2 && (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE))) return MISC_RET_BADMSEPROTO; #ifdef OSMOUSE_ONLY @@ -391,7 +453,9 @@ return MISC_RET_BADVAL; if (mse->type == MTYPE_LOGIMAN - && !(mse->baudrate == 1200 || mse->baudrate == 9600) ) + && !(mse->baudrate == 0 + || mse->baudrate == 1200 + || mse->baudrate == 9600)) return MISC_RET_BADBAUDRATE; if (mse->type == MTYPE_LOGIMAN && mse->samplerate) return MISC_RET_BADCOMBO; @@ -413,7 +477,8 @@ && mse->type != MTYPE_SYSMOUSE) { if (mse->baudrate % 1200 != 0 - || mse->baudrate < 1200 || mse->baudrate > 9600) + || (mse->baudrate != 0 && mse->baudrate < 1200) + || mse->baudrate > 9600) return MISC_RET_BADBAUDRATE; } if ((mse->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS)) @@ -441,17 +506,22 @@ pInfo = mse->private; pMse = pInfo->private; - - if (pMse->protocolID != MapMseProto(mse->type, FROM_MISC) + oldflags = pMse->mouseFlags; + + protoChanged = pMse->protocolID != MapMseProto(mse->type, FROM_MISC); + if (protoChanged || pMse->baudRate != mse->baudrate || pMse->sampleRate != mse->samplerate || pMse->resolution != mse->resolution || pMse->mouseFlags != mse->flags) reopen = TRUE; + if (mse->device) + reopen = TRUE; + if (reopen) (pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE); - + pMse->protocolID = MapMseProto(mse->type, FROM_MISC); pMse->baudRate = mse->baudrate; pMse->sampleRate = mse->samplerate; @@ -468,13 +538,29 @@ #else pMse->protocol = xf86MouseProtocolIDToName(pMse->protocolID); #endif - if (reopen) + + if (mse->device) { + if (MiscExtAuthorizeDevice(pInfo, mse->device)) { + xf86ReplaceStrOption(pInfo->options, "Device", mse->device); + } else { + return MISC_RET_BADVAL; + } + } + + if (reopen) { + /* Only if protocol is changed explicitely disable auto detect */ + if (protoChanged) + pMse->autoProbe = FALSE; (pMse->device->deviceProc)(pMse->device, DEVICE_ON); + } /* Set pInfo->options too */ - if (mse->device) - xf86ReplaceStrOption(pInfo->options, "Device", mse->device); - + if ((oldflags & MF_CLEAR_DTR) != (pMse->mouseFlags & MF_CLEAR_DTR)) + xf86ReplaceBoolOption(pInfo->options, "ClearDTR", + pMse->mouseFlags | MF_CLEAR_DTR); + if ((oldflags & MF_CLEAR_RTS) != (pMse->mouseFlags & MF_CLEAR_RTS)) + xf86ReplaceBoolOption(pInfo->options, "ClearRTS", + pMse->mouseFlags | MF_CLEAR_RTS); } if (mse_or_kbd == MISC_KEYBOARD) { kbdParamsPtr kbd = structure; @@ -507,6 +593,19 @@ #endif } return MISC_RET_SUCCESS; +} + +Bool +MiscExtGetFilePaths(const char **configfile, const char **modulepath, + const char **logfile) +{ + DEBUG_P("MiscExtGetFilePaths"); + + *configfile = xf86ConfigFile; + *modulepath = xf86ModulePath; + *logfile = xf86LogFile; + + return TRUE; } #endif /* XF86MISC */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.48 xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.63 --- xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.48 Thu Dec 6 10:40:27 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Mode.c Wed Jan 22 16:44:09 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.48 2001/12/06 15:40:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.63 2003/01/22 21:44:09 tsi Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -11,6 +11,7 @@ #include "X.h" #include "os.h" +#include "servermd.h" #include "mibank.h" #include "xf86.h" #include "xf86Priv.h" @@ -309,6 +310,8 @@ modep->CrtcVAdjusted = p->CrtcVAdjusted; modep->HSync = p->HSync; modep->VRefresh = p->VRefresh; + modep->Private = p->Private; + modep->PrivSize = p->PrivSize; p->prev = modep; @@ -327,7 +330,8 @@ * scrp ScrnInfoPtr * modep pointer to the returned mode, which must have the name * field filled in. - * clockRanges a list of clock ranges + * clockRanges a list of clock ranges. This is optional when all the + * modes are built-in modes. * strategy how to decide which mode to use from multiple modes with * the same name * @@ -358,7 +362,9 @@ int ModePrivFlags = 0; ModeStatus status = MODE_NOMODE; Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0; - strategy &= ~LOOKUP_CLKDIV2; + Bool haveBuiltin; + + strategy &= ~(LOOKUP_CLKDIV2 | LOOKUP_OPTIONAL_TOLERANCES); /* Some sanity checking */ if (scrp == NULL || scrp->modePool == NULL || @@ -370,16 +376,13 @@ ErrorF("xf86LookupMode: called with invalid modep\n"); return MODE_ERROR; } - if (clockRanges == NULL) { - ErrorF("xf86LookupMode: called with invalid clockRanges\n"); - return MODE_ERROR; - } for (cp = clockRanges; cp != NULL; cp = cp->next) { /* DivFactor and MulFactor must be > 0 */ cp->ClockDivFactor = max(1, cp->ClockDivFactor); cp->ClockMulFactor = max(1, cp->ClockMulFactor); } + haveBuiltin = FALSE; /* Scan the mode pool for matching names */ for (p = scrp->modePool; p != NULL; p = p->next) { if (strcmp(p->name, modep->name) == 0) { @@ -389,9 +392,13 @@ * Since built-in modes always come before user specified * modes it will always be found first. */ - if (p->type & M_T_BUILTIN) - return xf86HandleBuiltinMode(scrp, p,modep, clockRanges, - allowDiv2); + if (p->type & M_T_BUILTIN) { + haveBuiltin = TRUE; + } + + if (haveBuiltin && !(p->type & M_T_BUILTIN)) + continue; + /* Skip over previously rejected modes */ if (p->status != MODE_OK) { if (!found) @@ -403,6 +410,11 @@ if (p->prev) continue; + if (p->type & M_T_BUILTIN) { + return xf86HandleBuiltinMode(scrp, p,modep, clockRanges, + allowDiv2); + } + /* Check clock is in range */ cp = xf86FindClockRangeForMode(clockRanges, p); if (cp == NULL) { @@ -575,6 +587,8 @@ modep->CrtcVAdjusted = bestMode->CrtcVAdjusted; modep->HSync = bestMode->HSync; modep->VRefresh = bestMode->VRefresh; + modep->Private = bestMode->Private; + modep->PrivSize = bestMode->PrivSize; bestMode->prev = modep; @@ -748,6 +762,55 @@ } /* + * xf86CheckModeSize + * + * An internal routine to check if a mode fits in video memory. This tries to + * avoid overflows that would otherwise occur when video memory size is greater + * than 256MB. + */ +static Bool +xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y) +{ + int bpp = scrp->fbFormat.bitsPerPixel, + pad = scrp->fbFormat.scanlinePad; + int lineWidth, lastWidth; + + if (scrp->depth == 4) + pad *= 4; /* 4 planes */ + + /* Sanity check */ + if ((w < 0) || (x < 0) || (y <= 0)) + return FALSE; + + lineWidth = (((w * bpp) + pad - 1) / pad) * pad; + lastWidth = x * bpp; + + /* + * At this point, we need to compare + * + * (lineWidth * (y - 1)) + lastWidth + * + * against + * + * scrp->videoRam * (1024 * 8) + * + * These are bit quantities. To avoid overflows, do the comparison in + * terms of BITMAP_SCANLINE_PAD units. This assumes BITMAP_SCANLINE_PAD + * is a power of 2. We currently use 32, which limits us to a video + * memory size of 8GB. + */ + + lineWidth = (lineWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD; + lastWidth = (lastWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD; + + if ((lineWidth * (y - 1) + lastWidth) > + (scrp->videoRam * ((1024 * 8) / BITMAP_SCANLINE_PAD))) + return FALSE; + + return TRUE; +} + +/* * xf86InitialCheckModeForDriver * * This function checks if a mode satisfies a driver's initial requirements: @@ -784,7 +847,7 @@ int i, needDiv2; /* Sanity checks */ - if (!scrp || !mode || !clockRanges) { + if (!scrp || !mode /*|| !clockRanges*/) { ErrorF("xf86InitialCheckModeForDriver: " "called with invalid parameters\n"); return MODE_ERROR; @@ -804,8 +867,8 @@ mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal) return MODE_V_ILLEGAL; - if (mode->HDisplay * mode->VDisplay * scrp->fbFormat.bitsPerPixel > - scrp->videoRam * (1024 * 8)) + if (!xf86CheckModeSize(scrp, mode->HDisplay, mode->HDisplay, + mode->VDisplay)) return MODE_MEM; if (maxPitch > 0 && mode->HDisplay > maxPitch) @@ -958,10 +1021,6 @@ ErrorF("xf86CheckModeForDriver: called with invalid modep\n"); return MODE_ERROR; } - if (scrp->clockRanges == NULL) { - ErrorF("xf86CheckModeForDriver: called with invalid clockRanges\n"); - return MODE_ERROR; - } /* Check the mode size */ if (mode->HDisplay > scrp->virtualX) @@ -1126,10 +1185,10 @@ ModeStatus status; int linePitch = -1, virtX = 0, virtY = 0; int newLinePitch, newVirtX, newVirtY; - int pixelArea = scrp->videoRam * (1024 * 8); /* in bits */ int modeSize; /* in pixels */ - int bitsPerPixel, pixmapPad; Bool validateAllDefaultModes; + Bool userModes = FALSE; + int saveType; PixmapFormatRec *BankFormat; ClockRangePtr cp; ClockRangesPtr storeClockRanges; @@ -1158,10 +1217,6 @@ ErrorF("xf86ValidateModes: called with invalid pitchInc\n"); return -1; } - if (clockRanges == NULL) { - ErrorF("xf86ValidateModes: called with invalid clockRanges\n"); - return -1; - } if ((virtualX > 0) != (virtualY > 0)) { ErrorF("xf86ValidateModes: called with invalid virtual resolution\n"); return -1; @@ -1308,18 +1363,10 @@ else BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */ - bitsPerPixel = scrp->fbFormat.bitsPerPixel; - pixmapPad = scrp->fbFormat.scanlinePad; - if (scrp->depth == 4) - pixmapPad *= 4; /* 4 planes */ - if (scrp->xInc <= 0) scrp->xInc = 8; /* Suitable for VGA and others */ #define _VIRTUALX(x) ((((x) + scrp->xInc - 1) / scrp->xInc) * scrp->xInc) -#define _VIDEOSIZE(w, x, y) \ - ((((((w) * bitsPerPixel) + pixmapPad - 1) / pixmapPad) * pixmapPad * \ - ((y) - 1)) + ((x) * bitsPerPixel)) /* * Determine maxPitch if it wasn't given explicitly. Note linePitches @@ -1379,7 +1426,7 @@ return -1; } - if (_VIDEOSIZE(linePitch, virtualX, virtualY) > pixelArea) { + if (!xf86CheckModeSize(scrp, linePitch, virtualX, virtualY)) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Virtual size (%dx%d) (pitch %d) exceeds video memory\n", virtualX, virtualY, linePitch); @@ -1459,8 +1506,10 @@ last = NULL; if (modeNames != NULL) { for (i = 0; modeNames[i] != NULL; i++) { + userModes = TRUE; new = xnfcalloc(1, sizeof(DisplayModeRec)); new->prev = last; + new->type = M_T_USERDEF; new->name = xnfalloc(strlen(modeNames[i]) + 1); strcpy(new->name, modeNames[i]); if (new->prev) @@ -1471,8 +1520,10 @@ } /* Lookup each mode */ - validateAllDefaultModes = FALSE; + validateAllDefaultModes = TRUE; for (p = scrp->modes; ; p = p->next) { + Bool repeat; + /* * If the supplied mode names don't produce a valid mode, scan through * unconsidered modePool members until one survives validation. This @@ -1524,6 +1575,8 @@ p = xnfcalloc(1, sizeof(DisplayModeRec)); p->prev = last; p->name = xnfalloc(strlen(r->name) + 1); + if (!userModes) + p->type = M_T_USERDEF; strcpy(p->name, r->name); if (p->prev) p->prev->next = p; @@ -1531,8 +1584,27 @@ endp = &p->next; } + repeat = FALSE; lookupNext: + if (repeat && ((status = p->status) != MODE_OK)) { + if (p->type & M_T_BUILTIN) + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using built-in mode \"%s\" (%s)\n", + p->name, xf86ModeStatusToString(status)); + else if (p->type & M_T_DEFAULT) + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using default mode \"%s\" (%s)\n", p->name, + xf86ModeStatusToString(status)); + else + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using mode \"%s\" (%s)\n", p->name, + xf86ModeStatusToString(status)); + } + saveType = p->type; status = xf86LookupMode(scrp, p, clockRanges, strategy); + if (repeat && status == MODE_NOMODE) { + continue; + } if (status != MODE_OK) { if (p->type & M_T_BUILTIN) xf86DrvMsg(scrp->scrnIndex, X_INFO, @@ -1557,12 +1629,27 @@ p->status = status; continue; } + p->type |= saveType; + repeat = TRUE; newLinePitch = linePitch; newVirtX = virtX; newVirtY = virtY; /* + * Don't let non-user defined modes increase the virtual size + */ + if (!(p->type & M_T_USERDEF)) { + if (p->HDisplay > virtX) { + p->status = MODE_VIRTUAL_X; + goto lookupNext; + } + if (p->VDisplay > virtY) { + p->status = MODE_VIRTUAL_Y; + goto lookupNext; + } + } + /* * Adjust virtual width and height if the mode is too large for the * current values and if they are not fixed. */ @@ -1608,7 +1695,7 @@ * Check that the pixel area required by the new virtual height * and line pitch isn't too large. */ - if (_VIDEOSIZE(newLinePitch, newVirtX, newVirtY) > pixelArea) { + if (!xf86CheckModeSize(scrp, newLinePitch, newVirtX, newVirtY)) { p->status = MODE_MEM_VIRT; goto lookupNext; } @@ -1624,21 +1711,8 @@ scrp->displayWidth = newLinePitch; p->status = (scrp->ValidMode)(scrp->scrnIndex, p, FALSE, MODECHECK_FINAL); - - if (p->status != MODE_OK) { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(p->status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); + if (p->status != MODE_OK) { goto lookupNext; } } @@ -1652,7 +1726,6 @@ } #undef _VIRTUALX -#undef _VIDEOSIZE /* Update the ScrnInfoRec parameters */ @@ -1805,46 +1878,44 @@ static void add(char **p, char *new) { - if (!*p) { - *p = xnfalloc(strlen(new) + 1); - strcpy(*p,new); - } else { - *p = xnfrealloc(*p,((*p)?strlen(*p):0) + strlen(new) + 2); - strcat(*p," "); - strcat(*p,new); - } + *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2); + strcat(*p, " "); + strcat(*p, new); } static void PrintModeline(int scrnIndex,DisplayModePtr mode) { char tmp[256]; - char *flags = NULL; + char *flags = xnfcalloc(1, 1); if (mode->HSkew) { - snprintf(tmp,256,"hskew %i",mode->HSkew); - add(&flags,tmp); + snprintf(tmp, 256, "hskew %i", mode->HSkew); + add(&flags, tmp); } if (mode->VScan) { - snprintf(tmp,256,"vscan %i",mode->VScan); - add(&flags,tmp); + snprintf(tmp, 256, "vscan %i", mode->VScan); + add(&flags, tmp); } - if (mode->Flags & V_INTERLACE) add(&flags,"interlace"); - if (mode->Flags & V_CSYNC) add(&flags,"composite"); - if (mode->Flags & V_DBLSCAN) add(&flags,"doublescan"); - if (mode->Flags & V_BCAST) add(&flags,"bcast"); - if (mode->Flags & V_PHSYNC) add(&flags,"+hsync"); - if (mode->Flags & V_NHSYNC) add(&flags,"-hsync"); - if (mode->Flags & V_PVSYNC) add(&flags,"+vsync"); - if (mode->Flags & V_NVSYNC) add(&flags,"-vsync"); - if (mode->Flags & V_PCSYNC) add(&flags,"+csync"); - if (mode->Flags & V_NCSYNC) add(&flags,"-csync"); - xf86DrvMsgVerb(scrnIndex,X_INFO,3, - "Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i %s\n", - mode->name,mode->Clock/1000., mode->HDisplay, - mode->HSyncStart,mode->HSyncEnd,mode->HTotal, - mode->VDisplay,mode->VSyncStart,mode->VSyncEnd, - mode->VTotal,flags); + if (mode->Flags & V_INTERLACE) add(&flags, "interlace"); + if (mode->Flags & V_CSYNC) add(&flags, "composite"); + if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan"); + if (mode->Flags & V_BCAST) add(&flags, "bcast"); + if (mode->Flags & V_PHSYNC) add(&flags, "+hsync"); + if (mode->Flags & V_NHSYNC) add(&flags, "-hsync"); + if (mode->Flags & V_PVSYNC) add(&flags, "+vsync"); + if (mode->Flags & V_NVSYNC) add(&flags, "-vsync"); + if (mode->Flags & V_PCSYNC) add(&flags, "+csync"); + if (mode->Flags & V_NCSYNC) add(&flags, "-csync"); +#if 0 + if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2"); +#endif + xf86DrvMsgVerb(scrnIndex, X_INFO, 3, + "Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i%s\n", + mode->name, mode->Clock/1000., mode->HDisplay, + mode->HSyncStart, mode->HSyncEnd, mode->HTotal, + mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, + mode->VTotal, flags); xfree(flags); } @@ -1853,7 +1924,7 @@ { DisplayModePtr p; float hsync, refresh = 0; - char *desc, *desc2, *prefix; + char *desc, *desc2, *prefix, *uprefix; if (scrp == NULL) return; @@ -1896,19 +1967,28 @@ prefix = "Default mode"; else prefix = "Mode"; + if (p->type & M_T_USERDEF) + uprefix = "*"; + else + uprefix = " "; if (hsync == 0 || refresh == 0) { - xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "%s \"%s\"\n", prefix, p->name); + if (p->name) + xf86DrvMsg(scrp->scrnIndex, X_CONFIG, + "%s%s \"%s\"\n", uprefix, prefix, p->name); + else + xf86DrvMsg(scrp->scrnIndex, X_PROBED, + "%s%s %dx%d (unnamed)\n", + uprefix, prefix, p->HDisplay, p->VDisplay); } else if (p->Clock == p->SynthClock) { xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n", - prefix, p->name, p->Clock / 1000.0, hsync, refresh, - desc, desc2); + "%s%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n", + uprefix, prefix, p->name, p->Clock / 1000.0, + hsync, refresh, desc, desc2); } else { xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "%s \"%s\": %.1f MHz (scaled from %.1f MHz), " + "%s%s \"%s\": %.1f MHz (scaled from %.1f MHz), " "%.1f kHz, %.1f Hz%s%s\n", - prefix, p->name, p->Clock / 1000.0, + uprefix, prefix, p->name, p->Clock / 1000.0, p->SynthClock / 1000.0, hsync, refresh, desc, desc2); } if (hsync != 0 && refresh != 0) Index: xc/programs/Xserver/hw/xfree86/common/xf86Module.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.31 xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.35 --- xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.31 Thu Aug 16 10:33:52 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Module.h Sat Dec 21 21:03:25 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.31 2001/08/16 14:33:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.35 2002/12/22 02:03:25 dawes Exp $ */ /* * Copyright (c) 1997-2001 by The XFree86 Project, Inc. @@ -61,11 +61,11 @@ * changed. The minor revision mask is 0x0000FFFF and the major revision * mask is 0xFFFF0000. */ -#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 1) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 5) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 3) -#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 1) -#define ABI_FONT_VERSION SET_ABI_VERSION(0, 3) +#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 2) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 6) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 4) +#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 2) +#define ABI_FONT_VERSION SET_ABI_VERSION(0, 4) #define MODINFOSTRING1 0xef23fdc5 #define MODINFOSTRING2 0x10dc023a @@ -146,6 +146,12 @@ #define MINOR_UNSPEC 0xFF #define PATCH_UNSPEC 0xFFFF #define ABI_VERS_UNSPEC 0xFFFFFFFF + +#define MODULE_VERSION_NUMERIC(maj, min, patch) \ + ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) +#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) +#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF) +#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF) #define INITARGS void Index: xc/programs/Xserver/hw/xfree86/common/xf86Option.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Option.c:1.23 xc/programs/Xserver/hw/xfree86/common/xf86Option.c:1.25 --- xc/programs/Xserver/hw/xfree86/common/xf86Option.c:1.23 Fri May 4 15:05:30 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Option.c Tue Sep 10 13:39:28 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.23 2001/05/04 19:05:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.25 2002/09/10 17:39:28 dawes Exp $ */ /* * Copyright (c) 1998 by The XFree86 Project, Inc. @@ -224,8 +224,9 @@ xf86AddNewOption(pointer head, char *name, char *val) { char *tmp = strdup(val); - - return xf86addNewOption(head, name, tmp); + char *tmp_name = strdup(name); + + return xf86addNewOption(head, tmp_name, tmp); } @@ -576,6 +577,11 @@ xf86TokenToOptinfo(const OptionInfoRec *table, int token) { const OptionInfoRec *p; + + if (!table) { + ErrorF("xf86TokenToOptinfo: table is NULL\n"); + return NULL; + } for (p = table; p->token >= 0 && p->token != token; p++) ; Index: xc/programs/Xserver/hw/xfree86/common/xf86PM.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86PM.c:3.6 xc/programs/Xserver/hw/xfree86/common/xf86PM.c:3.8 --- xc/programs/Xserver/hw/xfree86/common/xf86PM.c:3.6 Fri Nov 30 07:11:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86PM.c Sun Sep 29 19:54:34 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.6 2001/11/30 12:11:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.8 2002/09/29 23:54:34 keithp Exp $ */ #include "X.h" @@ -38,6 +38,8 @@ { int i; InputInfoPtr pInfo; + + xf86inSuspend = TRUE; for (i = 0; i < xf86NumScreens; i++) { xf86EnableAccess(xf86Screens[i]); @@ -45,7 +47,6 @@ (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); } #if !defined(__EMX__) - DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { DisableDevice(pInfo->dev); @@ -96,8 +97,8 @@ EnableDevice(pInfo->dev); pInfo = pInfo->next; } - EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); #endif + xf86inSuspend = FALSE; } static void Index: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.119 xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.144 --- xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.119 Tue Jan 15 21:00:43 2002 +++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h Fri Feb 7 15:41:11 2003 @@ -1,1904 +1,573 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.119 2002/01/16 02:00:43 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.144 2003/02/07 20:41:11 martin Exp $ */ /* - * PCI Probe + * Copyright 1995-2002 by The XFree86 Project, Inc. * - * Copyright 1995-2000 by The XFree86 Project, Inc. + * This file contains macros for the PCI Vendor and Device IDs for video + * cards plus a few other things that are needed in drivers or elsewhere. + * This information is used in several ways: + * 1. It is used by drivers and/or other code. + * 2. It is used by the pciid2c.pl script to determine what vendor data to + * include in the pcidata module that the X server loads. + * 3. A side-effect of 2. affects how config-generation works for + * otherwise "unknown" cards. * - * A lot of this comes from Robin Cutshaw's scanpci - * - * Notes -- Jun 6, 2000 -- Kevin Brosius - * Tips on adding Entries: - * scanpci output can contain up to 4 numeric entries, 2 for chip and 2 for card - * some generic cards don't have any valid info in the card field, - * here's what you do; - * - Add a vendor entry for your device if it doesn't already exist. The - * first number of the pair is generally vendor id. Search for it below - * and add a #define for it if it doesn't exist. - * ie. 5333 is the vendor id for S3 - * - Go to xf86PCIVendorNameInfoData[] and add a text name for your vendor id. - * ie. PCI_VENDOR_S3 is "S3" - * - Add an entry to xf86PCIVendorInfoData[], using the PCI_VENDOR define - * you added, and a text description of the chipset. - * - If your device has 0000 in the card field, - * you've probably got a non-video or generic device. Stop here. - * - * - If you have info in the card field, and it's just a duplicate of the chip - * info, then either stop, or add a 'generic' entry to xf86PCICardInfoData[]. - * - If you have different info in the card field, check the first entry, - * does the vendor match and/or already exist? If not, add it. Then - * add an entry describing the card to xf86PCICardInfoData[] - * - If you are adding a video card, add a PCI_CHIP #define matching the second - * entry in your chip field. This gets used in your card driver as the PCI id. - * ie. under the S3 comment, one entry is: PCI_CHIP_VIRGE 0x5631 - * - * Several people recommended http://www.yourvote.com/pci for pci device/vendor info. - * + * Don't add entries here for vendors that don't make video cards, + * or for non-video devices unless they're needed by a driver or elsewhere. + * A comprehensive set of PCI vendor, device and subsystem data is + * auto-generated from the ../etc/pci.ids file using the pciids2c.pl script, + * and is used in both the scanpci module and the scanpci utility. Don't + * modify the pci.ids file. If new/corrected entries are required, add them + * to ../etc/extrapci.ids. */ + #ifndef _XF86_PCIINFO_H #define _XF86_PCIINFO_H -#ifndef SELF_CONTAINED_PCI_INFO -#include "xf86str.h" -#endif - /* PCI Pseudo Vendor */ -#define PCI_VENDOR_GENERIC 0x00FF +#define PCI_VENDOR_GENERIC 0x00FF -#define PCI_VENDOR_REAL3D 0x003D -#define PCI_VENDOR_COMPAQ 0x0E11 -#define PCI_VENDOR_NCR_1 0x1000 -#define PCI_VENDOR_ATI 0x1002 -#define PCI_VENDOR_VLSI 0x1004 -#define PCI_VENDOR_AVANCE 0x1005 -#define PCI_VENDOR_NS 0x100B -#define PCI_VENDOR_TSENG 0x100C -#define PCI_VENDOR_WEITEK 0x100E -#define PCI_VENDOR_VIDEOLOGIC 0x1010 -#define PCI_VENDOR_DIGITAL 0x1011 -#define PCI_VENDOR_CIRRUS 0x1013 -#define PCI_VENDOR_IBM 0x1014 -#define PCI_VENDOR_NCR_2 0x101A -#define PCI_VENDOR_WD 0x101C -#define PCI_VENDOR_AMD 0x1022 -#define PCI_VENDOR_TRIDENT 0x1023 -#define PCI_VENDOR_ALI 0x1025 -#define PCI_VENDOR_MATROX 0x102B -#define PCI_VENDOR_CHIPSTECH 0x102C -#define PCI_VENDOR_MIRO 0x1031 -#define PCI_VENDOR_NEC 0x1033 -#define PCI_VENDOR_FD 0x1036 -#define PCI_VENDOR_SIS 0x1039 -#define PCI_VENDOR_HP 0x103C -#define PCI_VENDOR_SMC_PCTECH 0x1042 -#define PCI_VENDOR_DPT 0x1044 -#define PCI_VENDOR_OPTI 0x1045 -#define PCI_VENDOR_ELSA 0x1048 -#define PCI_VENDOR_SGS 0x104A -#define PCI_VENDOR_BUSLOGIC 0x104B -#define PCI_VENDOR_TI 0x104C -#define PCI_VENDOR_SONY 0x104D -#define PCI_VENDOR_OAK 0x104E -#define PCI_VENDOR_WINBOND 0x1050 -#define PCI_VENDOR_MOTOROLA 0x1057 -#define PCI_VENDOR_PROMISE 0x105A -#define PCI_VENDOR_NUMNINE 0x105D -#define PCI_VENDOR_UMC 0x1060 -#define PCI_VENDOR_X 0x1061 -#define PCI_VENDOR_PICOP 0x1066 -#define PCI_VENDOR_MYLEX 0x1069 -#define PCI_VENDOR_APPLE 0x106B -#define PCI_VENDOR_YAMAHA 0x1073 -#define PCI_VENDOR_NEXGEN 0x1074 -#define PCI_VENDOR_QLOGIC 0x1077 -#define PCI_VENDOR_CYRIX 0x1078 -#define PCI_VENDOR_LEADTEK 0x107D -#define PCI_VENDOR_CONTAQ 0x1080 -#define PCI_VENDOR_FOREX 0x1083 -#define PCI_VENDOR_SBS 0x108A -#define PCI_VENDOR_OLICOM 0x108D -#define PCI_VENDOR_SUN 0x108E -#define PCI_VENDOR_DIAMOND 0x1092 -#define PCI_VENDOR_CMD 0x1095 -#define PCI_VENDOR_APPIAN 0x1097 -#define PCI_VENDOR_VISION 0x1098 -#define PCI_VENDOR_BROOKTREE 0x109E -#define PCI_VENDOR_SIERRA 0x10A8 -#define PCI_VENDOR_ACC 0x10AA -#define PCI_VENDOR_WINBOND_2 0x10AB -#define PCI_VENDOR_DATABOOK 0x10B3 -#define PCI_VENDOR_3COM 0x10B7 -#define PCI_VENDOR_SMC 0x10B8 -#define PCI_VENDOR_ALI_2 0x10B9 -#define PCI_VENDOR_MITSUBISHI 0x10BA -#define PCI_VENDOR_SURECOM 0x10BD -#define PCI_VENDOR_NEOMAGIC 0x10C8 -#define PCI_VENDOR_ASP 0x10CD -#define PCI_VENDOR_CERN 0x10DC -#define PCI_VENDOR_NVIDIA 0x10DE -#define PCI_VENDOR_IMS 0x10E0 -#define PCI_VENDOR_TEKRAM 0x10E1 -#define PCI_VENDOR_TUNDRA 0x10E3 -#define PCI_VENDOR_AMCC 0x10E8 -#define PCI_VENDOR_INTEGRAPHICS 0x10EA -#define PCI_VENDOR_REALTEC 0x10EC -#define PCI_VENDOR_TRUEVISION 0x10FA -#define PCI_VENDOR_INITIO 0x1101 -#define PCI_VENDOR_CREATIVE_2 0x1102 -#define PCI_VENDOR_SIGMADESIGNS_2 0x1105 -#define PCI_VENDOR_VIA 0x1106 -#define PCI_VENDOR_VORTEX 0x1119 -#define PCI_VENDOR_EF 0x111A -#define PCI_VENDOR_FORE 0x1127 -#define PCI_VENDOR_IMAGTEC 0x112F -#define PCI_VENDOR_PLX 0x113C -#define PCI_VENDOR_ALLIANCE 0x1142 -#define PCI_VENDOR_VMIC 0x114A -#define PCI_VENDOR_DIGI 0x114F -#define PCI_VENDOR_MUTECH 0x1159 -#define PCI_VENDOR_RENDITION 0x1163 -#define PCI_VENDOR_TOSHIBA 0x1179 -#define PCI_VENDOR_RICOH 0x1180 -#define PCI_VENDOR_ZEINET 0x1193 -#define PCI_VENDOR_LITEON 0x11AD -#define PCI_VENDOR_SPECIALIX 0x11CB -#define PCI_VENDOR_CONTROL 0x11FE -#define PCI_VENDOR_CYCLADES 0x120E -#define PCI_VENDOR_3DFX 0x121A -#define PCI_VENDOR_SIGMADESIGNS 0x1236 -#define PCI_VENDOR_SMI 0x126f -#define PCI_VENDOR_ENSONIQ 0x1274 -#define PCI_VENDOR_ROCKWELL 0x127A -#define PCI_VENDOR_YOKOGAWA 0x1281 -#define PCI_VENDOR_TRITECH 0x1292 -#define PCI_VENDOR_NVIDIA_SGS 0x12d2 -#define PCI_VENDOR_NETGEAR 0x1385 -#define PCI_VENDOR_VMWARE 0x15AD -#define PCI_VENDOR_SYMPHONY 0x1C1C -#define PCI_VENDOR_TEKRAM_2 0x1DE1 -#define PCI_VENDOR_3DLABS 0x3D3D -#define PCI_VENDOR_AVANCE_2 0x4005 -#define PCI_VENDOR_HERCULES 0x4843 -#define PCI_VENDOR_CREATIVE 0x4942 -#define PCI_VENDOR_S3 0x5333 -#define PCI_VENDOR_INTEL 0x8086 -#define PCI_VENDOR_ADAPTEC 0x9004 -#define PCI_VENDOR_ADAPTEC_2 0x9005 -#define PCI_VENDOR_ATRONICS 0x907F -#define PCI_VENDOR_ARK 0xEDD8 +#define PCI_VENDOR_REAL3D 0x003D +#define PCI_VENDOR_COMPAQ 0x0E11 +#define PCI_VENDOR_ATI 0x1002 +#define PCI_VENDOR_AVANCE 0x1005 +#define PCI_VENDOR_TSENG 0x100C +#define PCI_VENDOR_NS 0x100B +#define PCI_VENDOR_WEITEK 0x100E +#define PCI_VENDOR_VIDEOLOGIC 0x1010 +#define PCI_VENDOR_DIGITAL 0x1011 +#define PCI_VENDOR_CIRRUS 0x1013 +#define PCI_VENDOR_AMD 0x1022 +#define PCI_VENDOR_TRIDENT 0x1023 +#define PCI_VENDOR_ALI 0x1025 +#define PCI_VENDOR_DELL 0x1028 +#define PCI_VENDOR_MATROX 0x102B +#define PCI_VENDOR_CHIPSTECH 0x102C +#define PCI_VENDOR_MIRO 0x1031 +#define PCI_VENDOR_NEC 0x1033 +#define PCI_VENDOR_SIS 0x1039 +#define PCI_VENDOR_HP 0x103C +#define PCI_VENDOR_SGS 0x104A +#define PCI_VENDOR_TI 0x104C +#define PCI_VENDOR_SONY 0x104D +#define PCI_VENDOR_OAK 0x104E +#define PCI_VENDOR_MOTOROLA 0x1057 +#define PCI_VENDOR_NUMNINE 0x105D +#define PCI_VENDOR_CYRIX 0x1078 +#define PCI_VENDOR_SUN 0x108E +#define PCI_VENDOR_DIAMOND 0x1092 +#define PCI_VENDOR_BROOKTREE 0x109E +#define PCI_VENDOR_ALI_2 0x10B9 +#define PCI_VENDOR_NEOMAGIC 0x10C8 +#define PCI_VENDOR_NVIDIA 0x10DE +#define PCI_VENDOR_IMS 0x10E0 +#define PCI_VENDOR_INTEGRAPHICS 0x10EA +#define PCI_VENDOR_VIA 0x1106 +#define PCI_VENDOR_ALLIANCE 0x1142 +#define PCI_VENDOR_RENDITION 0x1163 +#define PCI_VENDOR_3DFX 0x121A +#define PCI_VENDOR_SMI 0x126F +#define PCI_VENDOR_TRITECH 0x1292 +#define PCI_VENDOR_NVIDIA_SGS 0x12D2 +#define PCI_VENDOR_VMWARE 0x15AD +#define PCI_VENDOR_3DLABS 0x3D3D +#define PCI_VENDOR_AVANCE_2 0x4005 +#define PCI_VENDOR_HERCULES 0x4843 +#define PCI_VENDOR_S3 0x5333 +#define PCI_VENDOR_INTEL 0x8086 +#define PCI_VENDOR_ARK 0xEDD8 /* Generic */ -#define PCI_CHIP_VGA 0x0000 -#define PCI_CHIP_8514 0x0001 +#define PCI_CHIP_VGA 0x0000 +#define PCI_CHIP_8514 0x0001 /* Real 3D */ -#define PCI_CHIP_I740_PCI 0x00D1 +#define PCI_CHIP_I740_PCI 0x00D1 /* Compaq */ -#define PCI_CHIP_QV1280 0x3033 -#define PCI_CHIP_SMART 0xAE10 -#define PCI_CHIP_NETELL100 0xAE32 -#define PCI_CHIP_NETELL10 0xAE34 -#define PCI_CHIP_NETFLEX3 0xAE35 -#define PCI_CHIP_NETELL100D 0xAE40 -#define PCI_CHIP_NETELL100PL 0xAE43 -#define PCI_CHIP_NETELL100I 0xB011 -#define PCI_CHIP_THUNDERLAN 0xF130 -#define PCI_CHIP_NETFLEX3BNC 0xF150 - -/* NCR */ -#define PCI_CHIP_53C810 0x0001 -#define PCI_CHIP_53C820 0x0002 -#define PCI_CHIP_53C825 0x0003 -#define PCI_CHIP_53C815 0x0004 -#define PCI_CHIP_53C810AP 0x0005 -#define PCI_CHIP_53C860 0x0006 -#define PCI_CHIP_53C896 0x000B -#define PCI_CHIP_53C895 0x000C -#define PCI_CHIP_53C885 0x000D -#define PCI_CHIP_53C875 0x000F -#define PCI_CHIP_53C875J 0x008F +#define PCI_CHIP_QV1280 0x3033 /* ATI */ -#define PCI_CHIP_MACH32 0x4158 -#define PCI_CHIP_R200_BB 0x4242 -#define PCI_CHIP_MACH64CT 0x4354 -#define PCI_CHIP_MACH64CX 0x4358 -#define PCI_CHIP_MACH64ET 0x4554 -#define PCI_CHIP_MACH64GB 0x4742 -#define PCI_CHIP_MACH64GD 0x4744 -#define PCI_CHIP_MACH64GI 0x4749 -#define PCI_CHIP_MACH64GL 0x474C -#define PCI_CHIP_MACH64GM 0x474D -#define PCI_CHIP_MACH64GN 0x474E -#define PCI_CHIP_MACH64GO 0x474F -#define PCI_CHIP_MACH64GP 0x4750 -#define PCI_CHIP_MACH64GQ 0x4751 -#define PCI_CHIP_MACH64GR 0x4752 -#define PCI_CHIP_MACH64GS 0x4753 -#define PCI_CHIP_MACH64GT 0x4754 -#define PCI_CHIP_MACH64GU 0x4755 -#define PCI_CHIP_MACH64GV 0x4756 -#define PCI_CHIP_MACH64GW 0x4757 -#define PCI_CHIP_MACH64GX 0x4758 -#define PCI_CHIP_MACH64GY 0x4759 -#define PCI_CHIP_MACH64GZ 0x475A -#define PCI_CHIP_MACH64LB 0x4C42 -#define PCI_CHIP_MACH64LD 0x4C44 -#define PCI_CHIP_RAGE128LE 0x4C45 -#define PCI_CHIP_RAGE128LF 0x4C46 -#define PCI_CHIP_MACH64LG 0x4C47 -#define PCI_CHIP_MACH64LI 0x4C49 -#define PCI_CHIP_MACH64LM 0x4C4D -#define PCI_CHIP_MACH64LN 0x4C4E -#define PCI_CHIP_MACH64LP 0x4C50 -#define PCI_CHIP_MACH64LQ 0x4C51 -#define PCI_CHIP_MACH64LR 0x4C52 -#define PCI_CHIP_MACH64LS 0x4C53 -#define PCI_CHIP_RADEON_LW 0x4C57 -#define PCI_CHIP_RADEON_LY 0x4C59 -#define PCI_CHIP_RADEON_LZ 0x4C5A -#define PCI_CHIP_RAGE128MF 0x4D46 -#define PCI_CHIP_RAGE128ML 0x4D4C -#define PCI_CHIP_RAGE128PD 0x5044 -#define PCI_CHIP_RAGE128PF 0x5046 -#define PCI_CHIP_RAGE128PP 0x5050 -#define PCI_CHIP_RAGE128PR 0x5052 -#define PCI_CHIP_RADEON_QD 0x5144 -#define PCI_CHIP_RADEON_QE 0x5145 -#define PCI_CHIP_RADEON_QF 0x5146 -#define PCI_CHIP_RADEON_QG 0x5147 -#define PCI_CHIP_R200_QL 0x514C -#define PCI_CHIP_R200_QN 0x514E -#define PCI_CHIP_R200_QO 0x514F -#define PCI_CHIP_RV200_QW 0x5157 -#define PCI_CHIP_RADEON_QY 0x5159 -#define PCI_CHIP_RADEON_QZ 0x515A -#define PCI_CHIP_R200_Ql 0x516C -#define PCI_CHIP_RAGE128RE 0x5245 -#define PCI_CHIP_RAGE128RF 0x5246 -#define PCI_CHIP_RAGE128RG 0x5247 -#define PCI_CHIP_RAGE128RK 0x524B -#define PCI_CHIP_RAGE128RL 0x524C -#define PCI_CHIP_RAGE128TF 0x5446 -#define PCI_CHIP_RAGE128TL 0x544C -#define PCI_CHIP_RAGE128TR 0x5452 -#define PCI_CHIP_RAGE128SM 0x534D -#define PCI_CHIP_MACH64VT 0x5654 -#define PCI_CHIP_MACH64VU 0x5655 -#define PCI_CHIP_MACH64VV 0x5656 - -/* VLSI */ -#define PCI_CHIP_82C592_FC1 0x0005 -#define PCI_CHIP_82C593_FC1 0x0006 -#define PCI_CHIP_82C594_AFC2 0x0007 -#define PCI_CHIP_82C597_AFC2 0x0009 -#define PCI_CHIP_82C541 0x000C -#define PCI_CHIP_82C543 0x000D -#define PCI_CHIP_VAS96011 0x0702 +#define PCI_CHIP_R300_AD 0x4144 +#define PCI_CHIP_R300_AE 0x4145 +#define PCI_CHIP_R300_AF 0x4146 +#define PCI_CHIP_R300_AG 0x4147 +#define PCI_CHIP_MACH32 0x4158 +#define PCI_CHIP_R200_BB 0x4242 +#define PCI_CHIP_MACH64CT 0x4354 +#define PCI_CHIP_MACH64CX 0x4358 +#define PCI_CHIP_MACH64ET 0x4554 +#define PCI_CHIP_MACH64GB 0x4742 +#define PCI_CHIP_MACH64GD 0x4744 +#define PCI_CHIP_MACH64GI 0x4749 +#define PCI_CHIP_MACH64GL 0x474C +#define PCI_CHIP_MACH64GM 0x474D +#define PCI_CHIP_MACH64GN 0x474E +#define PCI_CHIP_MACH64GO 0x474F +#define PCI_CHIP_MACH64GP 0x4750 +#define PCI_CHIP_MACH64GQ 0x4751 +#define PCI_CHIP_MACH64GR 0x4752 +#define PCI_CHIP_MACH64GS 0x4753 +#define PCI_CHIP_MACH64GT 0x4754 +#define PCI_CHIP_MACH64GU 0x4755 +#define PCI_CHIP_MACH64GV 0x4756 +#define PCI_CHIP_MACH64GW 0x4757 +#define PCI_CHIP_MACH64GX 0x4758 +#define PCI_CHIP_MACH64GY 0x4759 +#define PCI_CHIP_MACH64GZ 0x475A +#define PCI_CHIP_RV250_Id 0x4964 +#define PCI_CHIP_RV250_Ie 0x4965 +#define PCI_CHIP_RV250_If 0x4966 +#define PCI_CHIP_RV250_Ig 0x4967 +#define PCI_CHIP_MACH64LB 0x4C42 +#define PCI_CHIP_MACH64LD 0x4C44 +#define PCI_CHIP_RAGE128LE 0x4C45 +#define PCI_CHIP_RAGE128LF 0x4C46 +#define PCI_CHIP_MACH64LG 0x4C47 +#define PCI_CHIP_MACH64LI 0x4C49 +#define PCI_CHIP_MACH64LM 0x4C4D +#define PCI_CHIP_MACH64LN 0x4C4E +#define PCI_CHIP_MACH64LP 0x4C50 +#define PCI_CHIP_MACH64LQ 0x4C51 +#define PCI_CHIP_MACH64LR 0x4C52 +#define PCI_CHIP_MACH64LS 0x4C53 +#define PCI_CHIP_RADEON_LW 0x4C57 +#define PCI_CHIP_RADEON_LX 0x4C58 +#define PCI_CHIP_RADEON_LY 0x4C59 +#define PCI_CHIP_RADEON_LZ 0x4C5A +#define PCI_CHIP_RV250_Ld 0x4C64 +#define PCI_CHIP_RV250_Le 0x4C65 +#define PCI_CHIP_RV250_Lf 0x4C66 +#define PCI_CHIP_RV250_Lg 0x4C67 +#define PCI_CHIP_RAGE128MF 0x4D46 +#define PCI_CHIP_RAGE128ML 0x4D4C +#define PCI_CHIP_R300_ND 0x4E44 +#define PCI_CHIP_R300_NE 0x4E45 +#define PCI_CHIP_R300_NF 0x4E46 +#define PCI_CHIP_R300_NG 0x4E47 +#define PCI_CHIP_RAGE128PA 0x5041 +#define PCI_CHIP_RAGE128PB 0x5042 +#define PCI_CHIP_RAGE128PC 0x5043 +#define PCI_CHIP_RAGE128PD 0x5044 +#define PCI_CHIP_RAGE128PE 0x5045 +#define PCI_CHIP_RAGE128PF 0x5046 +#define PCI_CHIP_RAGE128PG 0x5047 +#define PCI_CHIP_RAGE128PH 0x5048 +#define PCI_CHIP_RAGE128PI 0x5049 +#define PCI_CHIP_RAGE128PJ 0x504A +#define PCI_CHIP_RAGE128PK 0x504B +#define PCI_CHIP_RAGE128PL 0x504C +#define PCI_CHIP_RAGE128PM 0x504D +#define PCI_CHIP_RAGE128PN 0x504E +#define PCI_CHIP_RAGE128PO 0x504F +#define PCI_CHIP_RAGE128PP 0x5050 +#define PCI_CHIP_RAGE128PQ 0x5051 +#define PCI_CHIP_RAGE128PR 0x5052 +#define PCI_CHIP_RAGE128PS 0x5053 +#define PCI_CHIP_RAGE128PT 0x5054 +#define PCI_CHIP_RAGE128PU 0x5055 +#define PCI_CHIP_RAGE128PV 0x5056 +#define PCI_CHIP_RAGE128PW 0x5057 +#define PCI_CHIP_RAGE128PX 0x5058 +#define PCI_CHIP_RADEON_QD 0x5144 +#define PCI_CHIP_RADEON_QE 0x5145 +#define PCI_CHIP_RADEON_QF 0x5146 +#define PCI_CHIP_RADEON_QG 0x5147 +#define PCI_CHIP_R200_QH 0x5148 +#define PCI_CHIP_R200_QI 0x5149 +#define PCI_CHIP_R200_QJ 0x514A +#define PCI_CHIP_R200_QK 0x514B +#define PCI_CHIP_R200_QL 0x514C +#define PCI_CHIP_R200_QM 0x514D +#define PCI_CHIP_R200_QN 0x514E +#define PCI_CHIP_R200_QO 0x514F +#define PCI_CHIP_RV200_QW 0x5157 +#define PCI_CHIP_RV200_QX 0x5158 +#define PCI_CHIP_RV100_QY 0x5159 +#define PCI_CHIP_RV100_QZ 0x515A +#define PCI_CHIP_R200_Qh 0x5168 +#define PCI_CHIP_R200_Qi 0x5169 +#define PCI_CHIP_R200_Qj 0x516A +#define PCI_CHIP_R200_Qk 0x516B +#define PCI_CHIP_R200_Ql 0x516C /* Undocumented in all ATI manuals */ +#define PCI_CHIP_RAGE128RE 0x5245 +#define PCI_CHIP_RAGE128RF 0x5246 +#define PCI_CHIP_RAGE128RG 0x5247 +#define PCI_CHIP_RAGE128RK 0x524B +#define PCI_CHIP_RAGE128RL 0x524C +#define PCI_CHIP_RAGE128SE 0x5345 +#define PCI_CHIP_RAGE128SF 0x5346 +#define PCI_CHIP_RAGE128SG 0x5347 +#define PCI_CHIP_RAGE128SH 0x5348 +#define PCI_CHIP_RAGE128SK 0x534B +#define PCI_CHIP_RAGE128SL 0x534C +#define PCI_CHIP_RAGE128SM 0x534D +#define PCI_CHIP_RAGE128SN 0x534E +#define PCI_CHIP_RAGE128TF 0x5446 +#define PCI_CHIP_RAGE128TL 0x544C +#define PCI_CHIP_RAGE128TR 0x5452 +#define PCI_CHIP_RAGE128TS 0x5453 +#define PCI_CHIP_RAGE128TT 0x5454 +#define PCI_CHIP_RAGE128TU 0x5455 +#define PCI_CHIP_MACH64VT 0x5654 +#define PCI_CHIP_MACH64VU 0x5655 +#define PCI_CHIP_MACH64VV 0x5656 /* Avance Logic */ -#define PCI_CHIP_ALG2064 0x2064 -#define PCI_CHIP_ALG2301 0x2301 -#define PCI_CHIP_ALG2501 0x2501 - -/* NS */ -#define PCI_CHIP_87415 0x0002 -#define PCI_CHIP_87410 0xD001 +#define PCI_CHIP_ALG2064 0x2064 +#define PCI_CHIP_ALG2301 0x2301 +#define PCI_CHIP_ALG2501 0x2501 /* Tseng */ -#define PCI_CHIP_ET4000_W32P_A 0x3202 -#define PCI_CHIP_ET4000_W32P_B 0x3205 -#define PCI_CHIP_ET4000_W32P_D 0x3206 -#define PCI_CHIP_ET4000_W32P_C 0x3207 -#define PCI_CHIP_ET6000 0x3208 -#define PCI_CHIP_ET6300 0x4702 +#define PCI_CHIP_ET4000_W32P_A 0x3202 +#define PCI_CHIP_ET4000_W32P_B 0x3205 +#define PCI_CHIP_ET4000_W32P_D 0x3206 +#define PCI_CHIP_ET4000_W32P_C 0x3207 +#define PCI_CHIP_ET6000 0x3208 +#define PCI_CHIP_ET6300 0x4702 /* Weitek */ -#define PCI_CHIP_P9000 0x9001 -#define PCI_CHIP_P9100 0x9100 +#define PCI_CHIP_P9000 0x9001 +#define PCI_CHIP_P9100 0x9100 /* Digital */ -#define PCI_CHIP_DC21050 0x0001 -#define PCI_CHIP_DC21040_10 0x0002 -#define PCI_CHIP_DEC21030 0x0004 -#define PCI_CHIP_DC21040_100 0x0009 -#define PCI_CHIP_TGA2 0x000D -#define PCI_CHIP_DEFPA 0x000F -#define PCI_CHIP_DC21041 0x0014 -#define PCI_CHIP_DC21142 0x0019 -#define PCI_CHIP_DC21052 0x0021 -#define PCI_CHIP_DC21152 0x0024 +#define PCI_CHIP_DC21050 0x0001 +#define PCI_CHIP_DEC21030 0x0004 +#define PCI_CHIP_TGA2 0x000D /* Cirrus Logic */ -#define PCI_CHIP_GD7548 0x0038 -#define PCI_CHIP_GD7555 0x0040 -#define PCI_CHIP_GD5430 0x00A0 -#define PCI_CHIP_GD5434_4 0x00A4 -#define PCI_CHIP_GD5434_8 0x00A8 -#define PCI_CHIP_GD5436 0x00AC -#define PCI_CHIP_GD5446 0x00B8 -#define PCI_CHIP_GD5480 0x00BC -#define PCI_CHIP_GD5462 0x00D0 -#define PCI_CHIP_GD5464 0x00D4 -#define PCI_CHIP_GD5464BD 0x00D5 -#define PCI_CHIP_GD5465 0x00D6 -#define PCI_CHIP_6729 0x1100 -#define PCI_CHIP_6832 0x1110 -#define PCI_CHIP_GD7542 0x1200 -#define PCI_CHIP_GD7543 0x1202 -#define PCI_CHIP_GD7541 0x1204 - -/* IBM */ -#define PCI_CHIP_FIRE_CORAL 0x000A -#define PCI_CHIP_TOKEN_RING 0x0018 -#define PCI_CHIP_82G2675 0x001D -#define PCI_CHIP_82351 0x0022 +#define PCI_CHIP_GD7548 0x0038 +#define PCI_CHIP_GD7555 0x0040 +#define PCI_CHIP_GD5430 0x00A0 +#define PCI_CHIP_GD5434_4 0x00A4 +#define PCI_CHIP_GD5434_8 0x00A8 +#define PCI_CHIP_GD5436 0x00AC +#define PCI_CHIP_GD5446 0x00B8 +#define PCI_CHIP_GD5480 0x00BC +#define PCI_CHIP_GD5462 0x00D0 +#define PCI_CHIP_GD5464 0x00D4 +#define PCI_CHIP_GD5464BD 0x00D5 +#define PCI_CHIP_GD5465 0x00D6 +#define PCI_CHIP_6729 0x1100 +#define PCI_CHIP_6832 0x1110 +#define PCI_CHIP_GD7542 0x1200 +#define PCI_CHIP_GD7543 0x1202 +#define PCI_CHIP_GD7541 0x1204 -/* WD */ -#define PCI_CHIP_7197 0x3296 - /* AMD */ -#define PCI_CHIP_79C970 0x2000 -#define PCI_CHIP_53C974 0x2020 +#define PCI_CHIP_AMD761 0x700E /* Trident */ -#define PCI_CHIP_8400 0x8400 -#define PCI_CHIP_8420 0x8420 -#define PCI_CHIP_8500 0x8500 -#define PCI_CHIP_8520 0x8520 -#define PCI_CHIP_8600 0x8600 -#define PCI_CHIP_8620 0x8620 -#define PCI_CHIP_8800 0x8800 -#define PCI_CHIP_8820 0x8820 -#define PCI_CHIP_9320 0x9320 -#define PCI_CHIP_9388 0x9388 -#define PCI_CHIP_9397 0x9397 -#define PCI_CHIP_939A 0x939A -#define PCI_CHIP_9420 0x9420 -#define PCI_CHIP_9440 0x9440 -#define PCI_CHIP_9520 0x9520 -#define PCI_CHIP_9525 0x9525 -#define PCI_CHIP_9540 0x9540 -#define PCI_CHIP_9660 0x9660 -#define PCI_CHIP_9750 0x9750 -#define PCI_CHIP_9850 0x9850 -#define PCI_CHIP_9880 0x9880 -#define PCI_CHIP_9910 0x9910 -#define PCI_CHIP_9930 0x9930 +#define PCI_CHIP_8400 0x8400 +#define PCI_CHIP_8420 0x8420 +#define PCI_CHIP_8500 0x8500 +#define PCI_CHIP_8520 0x8520 +#define PCI_CHIP_8600 0x8600 +#define PCI_CHIP_8620 0x8620 +#define PCI_CHIP_8820 0x8820 +#define PCI_CHIP_9320 0x9320 +#define PCI_CHIP_9388 0x9388 +#define PCI_CHIP_9397 0x9397 +#define PCI_CHIP_939A 0x939A +#define PCI_CHIP_9420 0x9420 +#define PCI_CHIP_9440 0x9440 +#define PCI_CHIP_9520 0x9520 +#define PCI_CHIP_9525 0x9525 +#define PCI_CHIP_9540 0x9540 +#define PCI_CHIP_9660 0x9660 +#define PCI_CHIP_9750 0x9750 +#define PCI_CHIP_9850 0x9850 +#define PCI_CHIP_9880 0x9880 +#define PCI_CHIP_9910 0x9910 /* ALI */ -#define PCI_CHIP_M1435 0x1435 +#define PCI_CHIP_M1435 0x1435 /* Matrox */ -#define PCI_CHIP_MGA2085 0x0518 -#define PCI_CHIP_MGA2064 0x0519 -#define PCI_CHIP_MGA1064 0x051a -#define PCI_CHIP_MGA2164 0x051b -#define PCI_CHIP_MGA2164_AGP 0x051f -#define PCI_CHIP_MGAG200_PCI 0x0520 -#define PCI_CHIP_MGAG200 0x0521 -#define PCI_CHIP_MGAG400 0x0525 -#define PCI_CHIP_MGAG550 0x2527 -#define PCI_CHIP_IMPRESSION 0x0D10 -#define PCI_CHIP_MGAG100_PCI 0x1000 -#define PCI_CHIP_MGAG100 0x1001 - -#define PCI_CARD_G400_TH 0x2179 -#define PCI_CARD_MILL_G200_SD 0xff00 -#define PCI_CARD_PROD_G100_SD 0xff01 -#define PCI_CARD_MYST_G200_SD 0xff02 -#define PCI_CARD_MILL_G200_SG 0xff03 -#define PCI_CARD_MARV_G200_SD 0xff04 +#define PCI_CHIP_MGA2085 0x0518 +#define PCI_CHIP_MGA2064 0x0519 +#define PCI_CHIP_MGA1064 0x051A +#define PCI_CHIP_MGA2164 0x051B +#define PCI_CHIP_MGA2164_AGP 0x051F +#define PCI_CHIP_MGAG200_PCI 0x0520 +#define PCI_CHIP_MGAG200 0x0521 +#define PCI_CHIP_MGAG400 0x0525 +#define PCI_CHIP_MGAG550 0x2527 +#define PCI_CHIP_IMPRESSION 0x0D10 +#define PCI_CHIP_MGAG100_PCI 0x1000 +#define PCI_CHIP_MGAG100 0x1001 + +#define PCI_CARD_G400_TH 0x2179 +#define PCI_CARD_MILL_G200_SD 0xFF00 +#define PCI_CARD_PROD_G100_SD 0xFF01 +#define PCI_CARD_MYST_G200_SD 0xFF02 +#define PCI_CARD_MILL_G200_SG 0xFF03 +#define PCI_CARD_MARV_G200_SD 0xFF04 /* Chips & Tech */ -#define PCI_CHIP_65545 0x00D8 -#define PCI_CHIP_65548 0x00DC -#define PCI_CHIP_65550 0x00E0 -#define PCI_CHIP_65554 0x00E4 -#define PCI_CHIP_65555 0x00E5 -#define PCI_CHIP_68554 0x00F4 -#define PCI_CHIP_69000 0x00C0 -#define PCI_CHIP_69030 0x0C30 +#define PCI_CHIP_65545 0x00D8 +#define PCI_CHIP_65548 0x00DC +#define PCI_CHIP_65550 0x00E0 +#define PCI_CHIP_65554 0x00E4 +#define PCI_CHIP_65555 0x00E5 +#define PCI_CHIP_68554 0x00F4 +#define PCI_CHIP_69000 0x00C0 +#define PCI_CHIP_69030 0x0C30 /* Miro */ -#define PCI_CHIP_ZR36050 0x5601 +#define PCI_CHIP_ZR36050 0x5601 /* NEC */ -#define PCI_CHIP_POWER_VR 0x0046 - -/* FD */ -#define PCI_CHIP_TMC_18C30 0x0000 +#define PCI_CHIP_POWER_VR 0x0046 /* SiS */ -#define PCI_CHIP_SG86C201 0x0001 -#define PCI_CHIP_SG86C202 0x0002 -#define PCI_CHIP_SG85C503 0x0008 -#define PCI_CHIP_SIS5597 0x0200 -#define PCI_CHIP_SG86C205 0x0205 -#define PCI_CHIP_SG86C215 0x0215 -#define PCI_CHIP_SG86C225 0x0225 -#define PCI_CHIP_85C501 0x0406 -#define PCI_CHIP_85C496 0x0496 -#define PCI_CHIP_85C601 0x0601 -#define PCI_CHIP_85C5107 0x5107 -#define PCI_CHIP_85C5511 0x5511 -#define PCI_CHIP_85C5513 0x5513 -#define PCI_CHIP_SIS5571 0x5571 -#define PCI_CHIP_SIS5597_2 0x5597 -#define PCI_CHIP_SIS530 0x6306 -#define PCI_CHIP_SIS6326 0x6326 -#define PCI_CHIP_SIS7001 0x7001 -#define PCI_CHIP_SIS300 0x0300 -#define PCI_CHIP_SIS630 0x6300 -#define PCI_CHIP_SIS540 0x5300 +#define PCI_CHIP_SG86C201 0x0001 +#define PCI_CHIP_SG86C202 0x0002 +#define PCI_CHIP_SG85C503 0x0008 +#define PCI_CHIP_SIS5597 0x0200 /* Agregado por Carlos Duclos & Manuel Jander */ -#define PCI_CHIP_SIS82C204 0x0204 -/* HP */ -#define PCI_CHIP_J2585A 0x1030 -#define PCI_CHIP_J2585B 0x1031 - -/* SMC/PCTECH */ -#define PCI_CHIP_RZ1000 0x1000 -#define PCI_CHIP_RZ1001 0x1001 - -/* DPT */ -#define PCI_CHIP_SMART_CACHE 0xA400 - -/* Opti */ -#define PCI_CHIP_92C178 0xC178 -#define PCI_CHIP_82C557 0xC557 -#define PCI_CHIP_82C558 0xC558 -#define PCI_CHIP_82C621 0xC621 -#define PCI_CHIP_82C700 0xC700 -#define PCI_CHIP_82C701 0xC701 -#define PCI_CHIP_82C814 0xC814 -#define PCI_CHIP_82C822 0xC822 +#define PCI_CHIP_SIS82C204 0x0204 +#define PCI_CHIP_SG86C205 0x0205 +#define PCI_CHIP_SG86C215 0x0215 +#define PCI_CHIP_SG86C225 0x0225 +#define PCI_CHIP_85C501 0x0406 +#define PCI_CHIP_85C496 0x0496 +#define PCI_CHIP_85C601 0x0601 +#define PCI_CHIP_85C5107 0x5107 +#define PCI_CHIP_85C5511 0x5511 +#define PCI_CHIP_85C5513 0x5513 +#define PCI_CHIP_SIS5571 0x5571 +#define PCI_CHIP_SIS5597_2 0x5597 +#define PCI_CHIP_SIS530 0x6306 +#define PCI_CHIP_SIS6326 0x6326 +#define PCI_CHIP_SIS7001 0x7001 +#define PCI_CHIP_SIS300 0x0300 +#define PCI_CHIP_SIS315H 0x0310 +#define PCI_CHIP_SIS315PRO 0x0325 +#define PCI_CHIP_SIS330 0x0330 +#define PCI_CHIP_SIS630 0x6300 +#define PCI_CHIP_SIS540 0x5300 +#define PCI_CHIP_SIS550 0x5315 +#define PCI_CHIP_SIS650 0x6325 +#define PCI_CHIP_SIS730 0x7300 + +/* Hewlett-Packard */ +#define PCI_CHIP_ELROY 0x1054 +#define PCI_CHIP_ZX1_SBA 0x1229 +#define PCI_CHIP_ZX1_IOC 0x122A +#define PCI_CHIP_ZX1_LBA 0x122E /* a.k.a. Mercury */ /* SGS */ -#define PCI_CHIP_STG2000 0x0008 -#define PCI_CHIP_STG1764 0x0009 +#define PCI_CHIP_STG2000 0x0008 +#define PCI_CHIP_STG1764 0x0009 +#define PCI_CHIP_KYROII 0x0010 -/* BusLogic */ -#define PCI_CHIP_946C_01 0x0140 -#define PCI_CHIP_946C_10 0x1040 -#define PCI_CHIP_FLASH_POINT 0x8130 - /* Texas Instruments */ -#define PCI_CHIP_TI_PERMEDIA 0x3d04 -#define PCI_CHIP_TI_PERMEDIA2 0x3d07 -#define PCI_CHIP_PCI_1130 0xAC12 -#define PCI_CHIP_PCI_1131 0xAC15 +#define PCI_CHIP_TI_PERMEDIA 0x3D04 +#define PCI_CHIP_TI_PERMEDIA2 0x3D07 /* Oak */ -#define PCI_CHIP_OTI107 0x0107 - -/* Winbond */ -#define PCI_CHIP_89C940 0x0940 +#define PCI_CHIP_OTI107 0x0107 -/* Motorola */ -#define PCI_CHIP_MPC105_EAGLE 0x0001 -#define PCI_CHIP_MPC105_GRACKLE 0x0002 -#define PCI_CHIP_RAVEN 0x4801 - -/* Promise */ -#define PCI_CHIP_ULTRA_DMA 0x4D33 -#define PCI_CHIP_DC5030 0x5300 - /* Number Nine */ -#define PCI_CHIP_I128 0x2309 -#define PCI_CHIP_I128_2 0x2339 -#define PCI_CHIP_I128_T2R 0x493D -#define PCI_CHIP_I128_T2R4 0x5348 +#define PCI_CHIP_I128 0x2309 +#define PCI_CHIP_I128_2 0x2339 +#define PCI_CHIP_I128_T2R 0x493D +#define PCI_CHIP_I128_T2R4 0x5348 /* Sun */ -#define PCI_CHIP_EBUS 0x1000 -#define PCI_CHIP_HAPPY_MEAL 0x1001 -#define PCI_CHIP_SIMBA 0x5000 -#define PCI_CHIP_PSYCHO 0x8000 -#define PCI_CHIP_SCHIZO 0x8001 -#define PCI_CHIP_SABRE 0xA000 -#define PCI_CHIP_HUMMINGBIRD 0xA001 +#define PCI_CHIP_EBUS 0x1000 +#define PCI_CHIP_HAPPY_MEAL 0x1001 +#define PCI_CHIP_SIMBA 0x5000 +#define PCI_CHIP_PSYCHO 0x8000 +#define PCI_CHIP_SCHIZO 0x8001 +#define PCI_CHIP_SABRE 0xA000 +#define PCI_CHIP_HUMMINGBIRD 0xA001 /* BrookTree */ -#define PCI_CHIP_BT848 0x0350 -#define PCI_CHIP_BT849 0x0351 +#define PCI_CHIP_BT848 0x0350 +#define PCI_CHIP_BT849 0x0351 + +/* Acer Laboratories Inc (ALI_2) */ +#define PCI_CHIP_M1541 0x1541 /* NVIDIA */ -#define PCI_CHIP_NV1 0x0008 -#define PCI_CHIP_DAC64 0x0009 -#define PCI_CHIP_TNT 0x0020 -#define PCI_CHIP_TNT2 0x0028 -#define PCI_CHIP_UTNT2 0x0029 -#define PCI_CHIP_VTNT2 0x002C -#define PCI_CHIP_UVTNT2 0x002D -#define PCI_CHIP_ITNT2 0x00A0 -#define PCI_CHIP_GEFORCE256 0x0100 -#define PCI_CHIP_GEFORCEDDR 0x0101 -#define PCI_CHIP_QUADRO 0x0103 -#define PCI_CHIP_GEFORCE2MX 0x0110 -#define PCI_CHIP_GEFORCE2MXDDR 0x0111 -#define PCI_CHIP_GEFORCE2GO 0x0112 -#define PCI_CHIP_QUADRO2MXR 0x0113 -#define PCI_CHIP_GEFORCE2GTS 0x0150 -#define PCI_CHIP_GEFORCE2GTS_1 0x0151 -#define PCI_CHIP_GEFORCE2ULTRA 0x0152 -#define PCI_CHIP_QUADRO2PRO 0x0153 -#define PCI_CHIP_0x0170 0x0170 -#define PCI_CHIP_0x0171 0x0171 -#define PCI_CHIP_0x0172 0x0172 -#define PCI_CHIP_0x0173 0x0173 -#define PCI_CHIP_0x0174 0x0174 -#define PCI_CHIP_0x0175 0x0175 -#define PCI_CHIP_0x0178 0x0178 -#define PCI_CHIP_0x017A 0x017A -#define PCI_CHIP_0x017B 0x017B -#define PCI_CHIP_0x017C 0x017C -#define PCI_CHIP_IGEFORCE2 0x01A0 -#define PCI_CHIP_GEFORCE3 0x0200 -#define PCI_CHIP_GEFORCE3_1 0x0201 -#define PCI_CHIP_GEFORCE3_2 0x0202 -#define PCI_CHIP_QUADRO_DDC 0x0203 -#define PCI_CHIP_0x0250 0x0250 -#define PCI_CHIP_0x0258 0x0258 +#define PCI_CHIP_NV1 0x0008 +#define PCI_CHIP_DAC64 0x0009 +#define PCI_CHIP_TNT 0x0020 +#define PCI_CHIP_TNT2 0x0028 +#define PCI_CHIP_UTNT2 0x0029 +#define PCI_CHIP_VTNT2 0x002C +#define PCI_CHIP_UVTNT2 0x002D +#define PCI_CHIP_ITNT2 0x00A0 +#define PCI_CHIP_GEFORCE_256 0x0100 +#define PCI_CHIP_GEFORCE_DDR 0x0101 +#define PCI_CHIP_QUADRO 0x0103 +#define PCI_CHIP_GEFORCE2_MX 0x0110 +#define PCI_CHIP_GEFORCE2_MX_100 0x0111 +#define PCI_CHIP_GEFORCE2_GO 0x0112 +#define PCI_CHIP_QUADRO2_MXR 0x0113 +#define PCI_CHIP_GEFORCE2_GTS 0x0150 +#define PCI_CHIP_GEFORCE2_TI 0x0151 +#define PCI_CHIP_GEFORCE2_ULTRA 0x0152 +#define PCI_CHIP_QUADRO2_PRO 0x0153 +#define PCI_CHIP_GEFORCE4_MX_460 0x0170 +#define PCI_CHIP_GEFORCE4_MX_440 0x0171 +#define PCI_CHIP_GEFORCE4_MX_420 0x0172 +#define PCI_CHIP_GEFORCE4_440_GO 0x0174 +#define PCI_CHIP_GEFORCE4_420_GO 0x0175 +#define PCI_CHIP_GEFORCE4_420_GO_M32 0x0176 +#define PCI_CHIP_QUADRO4_500XGL 0x0178 +#define PCI_CHIP_GEFORCE4_440_GO_M64 0x0179 +#define PCI_CHIP_QUADRO4_200 0x017A +#define PCI_CHIP_QUADRO4_550XGL 0x017B +#define PCI_CHIP_QUADRO4_500_GOGL 0x017C +#define PCI_CHIP_IGEFORCE2 0x01A0 +#define PCI_CHIP_GEFORCE3 0x0200 +#define PCI_CHIP_GEFORCE3_TI_200 0x0201 +#define PCI_CHIP_GEFORCE3_TI_500 0x0202 +#define PCI_CHIP_QUADRO_DCC 0x0203 +#define PCI_CHIP_GEFORCE4_TI_4600 0x0250 +#define PCI_CHIP_GEFORCE4_TI_4400 0x0251 +#define PCI_CHIP_GEFORCE4_TI_4200 0x0253 +#define PCI_CHIP_QUADRO4_900XGL 0x0258 +#define PCI_CHIP_QUADRO4_750XGL 0x0259 +#define PCI_CHIP_QUADRO4_700XGL 0x025B /* NVIDIA & SGS */ -#define PCI_CHIP_RIVA128 0x0018 +#define PCI_CHIP_RIVA128 0x0018 /* IMS */ -#define PCI_CHIP_IMSTT128 0x9128 -#define PCI_CHIP_IMSTT3D 0x9135 +#define PCI_CHIP_IMSTT128 0x9128 +#define PCI_CHIP_IMSTT3D 0x9135 +/* VIA Technologies */ +#define PCI_CHIP_APOLLOVP1 0x0585 +#define PCI_CHIP_APOLLOPRO133X 0x0691 + /* Alliance Semiconductor */ -#define PCI_CHIP_AP6410 0x3210 -#define PCI_CHIP_AP6422 0x6422 -#define PCI_CHIP_AT24 0x6424 -#define PCI_CHIP_AT3D 0x643D +#define PCI_CHIP_AP6410 0x3210 +#define PCI_CHIP_AP6422 0x6422 +#define PCI_CHIP_AT24 0x6424 +#define PCI_CHIP_AT3D 0x643D /* 3dfx Interactive */ -#define PCI_CHIP_VOODOO_GRAPHICS 0x0001 -#define PCI_CHIP_VOODOO2 0x0002 -#define PCI_CHIP_BANSHEE 0x0003 -#define PCI_CHIP_VOODOO3 0x0005 -#define PCI_CHIP_VOODOO5 0x0009 +#define PCI_CHIP_VOODOO_GRAPHICS 0x0001 +#define PCI_CHIP_VOODOO2 0x0002 +#define PCI_CHIP_BANSHEE 0x0003 +#define PCI_CHIP_VOODOO3 0x0005 +#define PCI_CHIP_VOODOO5 0x0009 -#define PCI_CARD_VOODOO3_2000 0x0036 -#define PCI_CARD_VOODOO3_3000 0x003a +#define PCI_CARD_VOODOO3_2000 0x0036 +#define PCI_CARD_VOODOO3_3000 0x003A /* Rendition */ -#define PCI_CHIP_V1000 0x0001 -#define PCI_CHIP_V2x00 0x2000 +#define PCI_CHIP_V1000 0x0001 +#define PCI_CHIP_V2x00 0x2000 /* 3Dlabs */ -#define PCI_CHIP_300SX 0x0001 -#define PCI_CHIP_500TX 0x0002 -#define PCI_CHIP_DELTA 0x0003 -#define PCI_CHIP_PERMEDIA 0x0004 -#define PCI_CHIP_MX 0x0006 -#define PCI_CHIP_PERMEDIA2 0x0007 -#define PCI_CHIP_GAMMA 0x0008 -#define PCI_CHIP_PERMEDIA2V 0x0009 -#define PCI_CHIP_PERMEDIA3 0x000A -#define PCI_CHIP_PERMEDIA4 0x000C -#define PCI_CHIP_R4 0x000D -#define PCI_CHIP_GAMMA2 0x000E -#define PCI_CHIP_R4ALT 0x0011 +#define PCI_CHIP_300SX 0x0001 +#define PCI_CHIP_500TX 0x0002 +#define PCI_CHIP_DELTA 0x0003 +#define PCI_CHIP_PERMEDIA 0x0004 +#define PCI_CHIP_MX 0x0006 +#define PCI_CHIP_PERMEDIA2 0x0007 +#define PCI_CHIP_GAMMA 0x0008 +#define PCI_CHIP_PERMEDIA2V 0x0009 +#define PCI_CHIP_PERMEDIA3 0x000A +#define PCI_CHIP_PERMEDIA4 0x000C +#define PCI_CHIP_R4 0x000D +#define PCI_CHIP_GAMMA2 0x000E +#define PCI_CHIP_R4ALT 0x0011 /* S3 */ -#define PCI_CHIP_PLATO 0x0551 -#define PCI_CHIP_VIRGE 0x5631 -#define PCI_CHIP_TRIO 0x8811 -#define PCI_CHIP_AURORA64VP 0x8812 -#define PCI_CHIP_TRIO64UVP 0x8814 -#define PCI_CHIP_VIRGE_VX 0x883D -#define PCI_CHIP_868 0x8880 -#define PCI_CHIP_928 0x88B0 -#define PCI_CHIP_864_0 0x88C0 -#define PCI_CHIP_864_1 0x88C1 -#define PCI_CHIP_964_0 0x88D0 -#define PCI_CHIP_964_1 0x88D1 -#define PCI_CHIP_968 0x88F0 -#define PCI_CHIP_TRIO64V2_DXGX 0x8901 -#define PCI_CHIP_PLATO_PX 0x8902 -#define PCI_CHIP_Trio3D 0x8904 -#define PCI_CHIP_Trio3D_2X 0x8A13 -#define PCI_CHIP_VIRGE_DXGX 0x8A01 -#define PCI_CHIP_VIRGE_GX2 0x8A10 -#define PCI_CHIP_SAVAGE3D 0x8A20 -#define PCI_CHIP_SAVAGE3D_MV 0x8A21 -#define PCI_CHIP_SAVAGE4 0x8A22 -#define PCI_CHIP_SAVAGE2000 0x9102 -#define PCI_CHIP_VIRGE_MX 0x8C01 -#define PCI_CHIP_VIRGE_MXPLUS 0x8C01 -#define PCI_CHIP_VIRGE_MXP 0x8C03 -#define PCI_CHIP_PROSAVAGE_PM 0x8A25 -#define PCI_CHIP_PROSAVAGE_KM 0x8A26 -#define PCI_CHIP_SAVAGE_MX_MV 0x8c10 -#define PCI_CHIP_SAVAGE_MX 0x8c11 -#define PCI_CHIP_SAVAGE_IX_MV 0x8c12 -#define PCI_CHIP_SAVAGE_IX 0x8c13 +#define PCI_CHIP_PLATO 0x0551 +#define PCI_CHIP_VIRGE 0x5631 +#define PCI_CHIP_TRIO 0x8811 +#define PCI_CHIP_AURORA64VP 0x8812 +#define PCI_CHIP_TRIO64UVP 0x8814 +#define PCI_CHIP_VIRGE_VX 0x883D +#define PCI_CHIP_868 0x8880 +#define PCI_CHIP_928 0x88B0 +#define PCI_CHIP_864_0 0x88C0 +#define PCI_CHIP_864_1 0x88C1 +#define PCI_CHIP_964_0 0x88D0 +#define PCI_CHIP_964_1 0x88D1 +#define PCI_CHIP_968 0x88F0 +#define PCI_CHIP_TRIO64V2_DXGX 0x8901 +#define PCI_CHIP_PLATO_PX 0x8902 +#define PCI_CHIP_Trio3D 0x8904 +#define PCI_CHIP_Trio3D_2X 0x8A13 +#define PCI_CHIP_VIRGE_DXGX 0x8A01 +#define PCI_CHIP_VIRGE_GX2 0x8A10 +#define PCI_CHIP_SAVAGE3D 0x8A20 +#define PCI_CHIP_SAVAGE3D_MV 0x8A21 +#define PCI_CHIP_SAVAGE4 0x8A22 +#define PCI_CHIP_VIRGE_MX 0x8C01 +#define PCI_CHIP_VIRGE_MXPLUS 0x8C01 +#define PCI_CHIP_VIRGE_MXP 0x8C03 +#define PCI_CHIP_PROSAVAGE_PM 0x8A25 +#define PCI_CHIP_PROSAVAGE_KM 0x8A26 +#define PCI_CHIP_SAVAGE_MX_MV 0x8C10 +#define PCI_CHIP_SAVAGE_MX 0x8C11 +#define PCI_CHIP_SAVAGE_IX_MV 0x8C12 +#define PCI_CHIP_SAVAGE_IX 0x8C13 +#define PCI_CHIP_SAVAGE2000 0x9102 /* ARK Logic */ -#define PCI_CHIP_1000PV 0xA091 -#define PCI_CHIP_2000PV 0xA099 -#define PCI_CHIP_2000MT 0xA0A1 -#define PCI_CHIP_2000MI 0xA0A9 +#define PCI_CHIP_1000PV 0xA091 +#define PCI_CHIP_2000PV 0xA099 +#define PCI_CHIP_2000MT 0xA0A1 +#define PCI_CHIP_2000MI 0xA0A9 /* Tritech Microelectronics */ -#define PCI_CHIP_TR25202 0xfc02 +#define PCI_CHIP_TR25202 0xFC02 /* Neomagic */ -#define PCI_CHIP_NM2070 0x0001 -#define PCI_CHIP_NM2090 0x0002 -#define PCI_CHIP_NM2093 0x0003 -#define PCI_CHIP_NM2097 0x0083 -#define PCI_CHIP_NM2160 0x0004 -#define PCI_CHIP_NM2200 0x0005 -#define PCI_CHIP_NM2230 0x0025 -#define PCI_CHIP_NM2360 0x0006 -#define PCI_CHIP_NM2380 0x0016 +#define PCI_CHIP_NM2070 0x0001 +#define PCI_CHIP_NM2090 0x0002 +#define PCI_CHIP_NM2093 0x0003 +#define PCI_CHIP_NM2097 0x0083 +#define PCI_CHIP_NM2160 0x0004 +#define PCI_CHIP_NM2200 0x0005 +#define PCI_CHIP_NM2230 0x0025 +#define PCI_CHIP_NM2360 0x0006 +#define PCI_CHIP_NM2380 0x0016 /* Intel */ -#define PCI_CHIP_I830_M_BRIDGE 0x3575 -#define PCI_CHIP_I830_M 0x3577 #define PCI_CHIP_I815_BRIDGE 0x1130 #define PCI_CHIP_I815 0x1132 +#define PCI_CHIP_430HX_BRIDGE 0x1250 +#define PCI_CHIP_82801_P2P 0x244E +#define PCI_CHIP_845_G_BRIDGE 0x2560 +#define PCI_CHIP_845_G 0x2562 +#define PCI_CHIP_I830_M_BRIDGE 0x3575 +#define PCI_CHIP_I830_M 0x3577 #define PCI_CHIP_I810_BRIDGE 0x7120 #define PCI_CHIP_I810 0x7121 #define PCI_CHIP_I810_DC100_BRIDGE 0x7122 #define PCI_CHIP_I810_DC100 0x7123 #define PCI_CHIP_I810_E_BRIDGE 0x7124 #define PCI_CHIP_I810_E 0x7125 +#define PCI_CHIP_440BX_BRIDGE 0x7190 #define PCI_CHIP_I740_AGP 0x7800 +#define PCI_CHIP_460GX_PXB 0x84CB +#define PCI_CHIP_460GX_SAC 0x84E0 +#define PCI_CHIP_460GX_GXB_2 0x84E2 /* PCI function 2 */ +#define PCI_CHIP_460GX_WXB 0x84E6 +#define PCI_CHIP_460GX_GXB_1 0x84EA /* PCI function 1 */ /* Silicon Motion Inc. */ -#define PCI_CHIP_SMI910 0x910 -#define PCI_CHIP_SMI810 0x810 -#define PCI_CHIP_SMI820 0x820 -#define PCI_CHIP_SMI710 0x710 -#define PCI_CHIP_SMI712 0x712 -#define PCI_CHIP_SMI720 0x720 +#define PCI_CHIP_SMI910 0x0910 +#define PCI_CHIP_SMI810 0x0810 +#define PCI_CHIP_SMI820 0x0820 +#define PCI_CHIP_SMI710 0x0710 +#define PCI_CHIP_SMI712 0x0712 +#define PCI_CHIP_SMI720 0x0720 /* VMware */ #define PCI_CHIP_VMWARE0405 0x0405 #define PCI_CHIP_VMWARE0710 0x0710 -/* - * first the VendorId - VendorName mapping - */ -extern SymTabPtr xf86PCIVendorNameInfo; - -#ifdef INIT_PCI_VENDOR_NAME_INFO -static SymTabRec xf86PCIVendorNameInfoData[] = { - {PCI_VENDOR_REAL3D, "Real 3D"}, - {PCI_VENDOR_COMPAQ, "Compaq"}, - {PCI_VENDOR_NCR_1, "NCR"}, - {PCI_VENDOR_ATI, "ATI"}, - {PCI_VENDOR_VLSI, "VLSI"}, - {PCI_VENDOR_AVANCE, "Avance Logic"}, - {PCI_VENDOR_NS, "NS"}, - {PCI_VENDOR_TSENG, "Tseng Labs"}, - {PCI_VENDOR_WEITEK, "Weitek"}, - {PCI_VENDOR_VIDEOLOGIC, "Video Logic"}, - {PCI_VENDOR_DIGITAL, "Digital"}, - {PCI_VENDOR_CIRRUS, "Cirrus Logic"}, - {PCI_VENDOR_IBM, "IBM"}, - {PCI_VENDOR_NCR_2, "NCR"}, - {PCI_VENDOR_WD, "WD*"}, - {PCI_VENDOR_AMD, "AMD"}, - {PCI_VENDOR_TRIDENT, "Trident"}, - {PCI_VENDOR_ALI, "ALI"}, - {PCI_VENDOR_MATROX, "Matrox"}, - {PCI_VENDOR_CHIPSTECH, "C&T"}, - {PCI_VENDOR_MIRO, "Miro"}, - {PCI_VENDOR_NEC, "NEC"}, - {PCI_VENDOR_FD, "FD"}, - {PCI_VENDOR_SIS, "SiS"}, - {PCI_VENDOR_HP, "HP"}, - {PCI_VENDOR_SMC_PCTECH, "SMC/PCTECH"}, - {PCI_VENDOR_DPT, "DPT"}, - {PCI_VENDOR_SGS, "SGS-Thomson"}, - {PCI_VENDOR_BUSLOGIC, "BusLogic"}, - {PCI_VENDOR_TI, "Texas Instruments"}, - {PCI_VENDOR_SONY, "Sony"}, - {PCI_VENDOR_OAK, "Oak"}, - {PCI_VENDOR_WINBOND,"Winbond"}, - {PCI_VENDOR_MOTOROLA, "Motorola"}, - {PCI_VENDOR_OAK, "Promise"}, - {PCI_VENDOR_NUMNINE, "Number Nine"}, - {PCI_VENDOR_UMC, "UMC"}, - {PCI_VENDOR_X , "X"}, - {PCI_VENDOR_PICOP , "PICOP"}, - {PCI_VENDOR_MYLEX, "Mylex"}, - {PCI_VENDOR_APPLE, "Apple"}, - {PCI_VENDOR_NEXGEN, "Nexgen"}, - {PCI_VENDOR_QLOGIC, "QLogic"}, - {PCI_VENDOR_CYRIX, "Cyrix"}, - {PCI_VENDOR_LEADTEK, "Leadtek"}, - {PCI_VENDOR_CONTAQ, "Contaq"}, - {PCI_VENDOR_FOREX, "FOREX"}, - {PCI_VENDOR_SBS, "SBS Technologies"}, /* Formerly Bit 3 Computer Corp */ - {PCI_VENDOR_OLICOM, "Olicom"}, - {PCI_VENDOR_SUN, "Sun"}, - {PCI_VENDOR_DIAMOND, "Diamond"}, - {PCI_VENDOR_CMD, "CMD"}, - {PCI_VENDOR_APPIAN, "Appian Graphics"}, - {PCI_VENDOR_VISION, "Vision"}, - {PCI_VENDOR_BROOKTREE, "BrookTree"}, - {PCI_VENDOR_SIERRA, "Sierra"}, - {PCI_VENDOR_ACC, "ACC"}, - {PCI_VENDOR_WINBOND_2, "Winbond"}, - {PCI_VENDOR_DATABOOK, "Databook"}, - {PCI_VENDOR_3COM, "3COM"}, - {PCI_VENDOR_SMC, "SMC"}, - {PCI_VENDOR_ALI_2, "ALI"}, - {PCI_VENDOR_MITSUBISHI, "Mitsubishi"}, - {PCI_VENDOR_SURECOM, "Surecom"}, - {PCI_VENDOR_NEOMAGIC, "Neomagic"}, - {PCI_VENDOR_ASP, "Advanced System Products"}, - {PCI_VENDOR_CERN, "CERN"}, - {PCI_VENDOR_NVIDIA, "NVidia"}, - {PCI_VENDOR_IMS, "IMS"}, - {PCI_VENDOR_TEKRAM, "Tekram"}, - {PCI_VENDOR_TUNDRA, "Tundra"}, - {PCI_VENDOR_AMCC, "AMCC"}, - {PCI_VENDOR_INTEGRAPHICS, "Intergraphics"}, - {PCI_VENDOR_REALTEC, "Realtek"}, - {PCI_VENDOR_TRUEVISION, "Truevision"}, - {PCI_VENDOR_INITIO, "Initio Corp"}, - {PCI_VENDOR_CREATIVE_2, "Creative Labs"}, - {PCI_VENDOR_SIGMADESIGNS_2, "Sigma Designs"}, - {PCI_VENDOR_VIA, "VIA"}, - {PCI_VENDOR_VORTEX, "Vortex"}, - {PCI_VENDOR_EF, "EF"}, - {PCI_VENDOR_FORE, "Fore Systems"}, - {PCI_VENDOR_IMAGTEC, "Imaging Technology"}, - {PCI_VENDOR_PLX, "PLX"}, - {PCI_VENDOR_NVIDIA_SGS, "NVidia/SGS-Thomson"}, - {PCI_VENDOR_NETGEAR, "Netgear"}, - {PCI_VENDOR_ALLIANCE, "Alliance Semiconductor"}, - {PCI_VENDOR_VMIC, "VMIC"}, - {PCI_VENDOR_DIGI, "DIGI*"}, - {PCI_VENDOR_MUTECH, "Mutech"}, - {PCI_VENDOR_RENDITION, "Rendition"}, - {PCI_VENDOR_TOSHIBA, "Toshiba"}, - {PCI_VENDOR_RICOH, "Ricoh"}, - {PCI_VENDOR_ZEINET, "Zeinet"}, - {PCI_VENDOR_LITEON, "Lite-On"}, - {PCI_VENDOR_3DFX, "3dfx Interactive"}, - {PCI_VENDOR_SIGMADESIGNS, "Sigma Designs"}, - {PCI_VENDOR_ENSONIQ, "Ensoniq"}, - {PCI_VENDOR_ROCKWELL, "Rockwell"}, - {PCI_VENDOR_YOKOGAWA, "YOKOGAWA"}, - {PCI_VENDOR_TRITECH, "Tritech Microelectronics"}, - {PCI_VENDOR_SYMPHONY, "Symphony"}, - {PCI_VENDOR_TEKRAM_2, "Tekram"}, - {PCI_VENDOR_3DLABS, "3Dlabs"}, - {PCI_VENDOR_AVANCE_2, "Avance"}, - {PCI_VENDOR_CREATIVE, "Creative Labs"}, - {PCI_VENDOR_S3, "S3"}, - {PCI_VENDOR_INTEL, "Intel"}, - {PCI_VENDOR_ADAPTEC, "Adaptec"}, - {PCI_VENDOR_ADAPTEC_2, "Adaptec"}, - {PCI_VENDOR_ATRONICS, "Atronics"}, - {PCI_VENDOR_ARK, "ARK Logic"}, - {PCI_VENDOR_YAMAHA, "Yamaha"}, - {PCI_VENDOR_SMI, "Silicon Motion Inc."}, - {PCI_VENDOR_VMWARE, "VMware"}, - {0,NULL} -}; -#endif - -/* Increase this as required */ -#define MAX_DEV_PER_VENDOR 80 - -typedef struct { - unsigned short VendorID; - struct pciDevice { - unsigned short DeviceID; - char *DeviceName; - CARD16 class; - } Device[MAX_DEV_PER_VENDOR]; -} pciVendorDeviceInfo; - -extern pciVendorDeviceInfo* xf86PCIVendorInfo; - -#ifdef INIT_PCI_VENDOR_INFO -static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { - {PCI_VENDOR_REAL3D, { - {PCI_CHIP_I740_PCI, "i740 (PCI)",0}, - {0x0000, NULL,0}}}, - -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_COMPAQ, { - {0x3033, "QVision 1280/p",0 }, - {0xae10, "Smart-2/P RAID Controller",0}, - {0xae32, "Netellignet 10/100",0 }, - {0xae34, "Netellignet 10",0 }, - {0xae35, "NetFlex 3",0 }, - {0xae40, "Netellignet 10/100 Dual",0 }, - {0xae43, "Netellignet 10/100 ProLiant",0 }, - {0xb011, "Netellignet 10/100 Integrated",0 }, - {0xf130, "ThunderLAN",0 }, - {0xf150, "NetFlex 3 BNC",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_NCR_1, { - {PCI_CHIP_53C810, "53c810",0}, - {PCI_CHIP_53C820, "53c820",0}, - {PCI_CHIP_53C825, "53c825",0}, - {PCI_CHIP_53C815, "53c815",0}, - {PCI_CHIP_53C810AP, "53c810AP",0}, - {PCI_CHIP_53C860, "53c860",0}, - {PCI_CHIP_53C896, "53c896",0}, - {PCI_CHIP_53C895, "53c895",0}, - {PCI_CHIP_53C885, "53c885",0}, - {PCI_CHIP_53C875, "53c875",0}, - {PCI_CHIP_53C875J, "53c875J",0}, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_ATI, { - {PCI_CHIP_MACH32, "Mach32",0}, - {PCI_CHIP_R200_BB, "Radeon 8500 BB",0}, - {PCI_CHIP_MACH64CT, "Mach64 CT",0}, - {PCI_CHIP_MACH64CX, "Mach64 CX",0}, - {PCI_CHIP_MACH64ET, "Mach64 ET",0}, - {PCI_CHIP_MACH64GB, "Mach64 GB",0}, - {PCI_CHIP_MACH64GD, "Mach64 GD",0}, - {PCI_CHIP_MACH64GI, "Mach64 GI",0}, - {PCI_CHIP_MACH64GL, "Mach64 GL",0}, - {PCI_CHIP_MACH64GM, "Mach64 GM",0}, - {PCI_CHIP_MACH64GN, "Mach64 GN",0}, - {PCI_CHIP_MACH64GO, "Mach64 GO",0}, - {PCI_CHIP_MACH64GP, "Mach64 GP",0}, - {PCI_CHIP_MACH64GQ, "Mach64 GQ",0}, - {PCI_CHIP_MACH64GR, "Mach64 GR",0}, - {PCI_CHIP_MACH64GS, "Mach64 GS",0}, - {PCI_CHIP_MACH64GT, "Mach64 GT",0}, - {PCI_CHIP_MACH64GU, "Mach64 GU",0}, - {PCI_CHIP_MACH64GV, "Mach64 GV",0}, - {PCI_CHIP_MACH64GW, "Mach64 GW",0}, - {PCI_CHIP_MACH64GX, "Mach64 GX",0}, - {PCI_CHIP_MACH64GY, "Mach64 GY",0}, - {PCI_CHIP_MACH64GZ, "Mach64 GZ",0}, - {PCI_CHIP_MACH64LB, "Mach64 LB",0}, - {PCI_CHIP_MACH64LD, "Mach64 LD",0}, - {PCI_CHIP_RAGE128LE, "Rage 128 Mobility LE",0}, - {PCI_CHIP_RAGE128LF, "Rage 128 Mobility LF",0}, - {PCI_CHIP_MACH64LG, "Mach64 LG",0}, - {PCI_CHIP_MACH64LI, "Mach64 LI",0}, - {PCI_CHIP_MACH64LM, "Mach64 LM",0}, - {PCI_CHIP_MACH64LN, "Mach64 LN",0}, - {PCI_CHIP_MACH64LP, "Mach64 LP",0}, - {PCI_CHIP_MACH64LQ, "Mach64 LQ",0}, - {PCI_CHIP_MACH64LR, "Mach64 LR",0}, - {PCI_CHIP_MACH64LS, "Mach64 LS",0}, - {PCI_CHIP_RAGE128MF, "Rage 128 Mobility MF",0}, - {PCI_CHIP_RAGE128ML, "Rage 128 Mobility ML",0}, - {PCI_CHIP_RAGE128PD, "Rage 128 Pro PD",0}, - {PCI_CHIP_RAGE128PF, "Rage 128 Pro PF",0}, - {PCI_CHIP_RAGE128PP, "Rage 128 Pro PP",0}, - {PCI_CHIP_RAGE128PR, "Rage 128 Pro PR",0}, - {PCI_CHIP_RAGE128TF, "Rage 128 Pro TF",0}, - {PCI_CHIP_RAGE128TL, "Rage 128 Pro TL",0}, - {PCI_CHIP_RAGE128TR, "Rage 128 Pro TR",0}, - {PCI_CHIP_RADEON_QD, "Radeon QD",0}, - {PCI_CHIP_RADEON_QE, "Radeon QE",0}, - {PCI_CHIP_RADEON_QF, "Radeon QF",0}, - {PCI_CHIP_RADEON_QG, "Radeon QG",0}, - {PCI_CHIP_R200_QL, "Radeon 8500 QL",0}, - {PCI_CHIP_R200_QN, "Radeon 8500 QN",0}, - {PCI_CHIP_R200_QO, "Radeon 8500 QO",0}, - {PCI_CHIP_RV200_QW, "Radeon 7500 QW",0}, - {PCI_CHIP_RADEON_QY, "Radeon VE QY",0}, - {PCI_CHIP_RADEON_QZ, "Radeon VE QZ",0}, - {PCI_CHIP_R200_Ql, "Radeon 8500 Ql",0}, - {PCI_CHIP_RADEON_LW, "Radeon Mobility M7 LW",0}, - {PCI_CHIP_RADEON_LY, "Radeon Mobility M6 LY",0}, - {PCI_CHIP_RADEON_LZ, "Radeon Mobility M6 LZ",0}, - {PCI_CHIP_RAGE128SM, "Rage 128 SM",0}, - {PCI_CHIP_RAGE128RE, "Rage 128 RE",0}, - {PCI_CHIP_RAGE128RF, "Rage 128 RF",0}, - {PCI_CHIP_RAGE128RK, "Rage 128 RK",0}, - {PCI_CHIP_RAGE128RL, "Rage 128 RL",0}, - {PCI_CHIP_MACH64VT, "Mach64 VT",0}, - {PCI_CHIP_MACH64VU, "Mach64 VU",0}, - {PCI_CHIP_MACH64VV, "Mach64 VV",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_VLSI, { - {0x0005, "82C592-FC1",0 }, - {0x0006, "82C593-FC1",0 }, - {0x0007, "82C594-AFC2",0 }, - {0x0009, "82C597-AFC2",0 }, - {0x000C, "82C541 Lynx",0 }, - {0x000D, "82C543 Lynx ISA",0 }, - {0x0702, "VAS96011",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_AVANCE, { - {PCI_CHIP_ALG2301, "ALG2301",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_NS, { - {0x0002, "87415",0 }, - {0xD001, "87410",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_TSENG, { - {PCI_CHIP_ET4000_W32P_A, "ET4000W32P revA",0}, - {PCI_CHIP_ET4000_W32P_B, "ET4000W32P revB",0}, - {PCI_CHIP_ET4000_W32P_C, "ET4000W32P revC",0}, - {PCI_CHIP_ET4000_W32P_D, "ET4000W32P revD",0}, - {PCI_CHIP_ET6000, "ET6000/6100",0}, - {PCI_CHIP_ET6300, "ET6300",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_WEITEK, { - {PCI_CHIP_P9000, "P9000",0}, - {PCI_CHIP_P9100, "P9100",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_DIGITAL, { - {PCI_CHIP_DEC21030, "21030/TGA",0}, - {0x0001, "DC21050 PCI-PCI Bridge" - /* print_pcibridge */,0 }, - {0x0002, "DC21040 10Mb/s Ethernet",0 }, - {0x0009, "DC21140 10/100 Mb/s Ethernet",0 }, - {0x000D, "TGA2",0 }, - {0x000F, "DEFPA (FDDI PCI)",0 }, - {0x0014, "DC21041 10Mb/s Ethernet Plus",0 }, - {0x0019, "DC21142 10/100 Mb/s Ethernet",0 }, - {0x0021, "DC21052",0 }, - {0x0024, "DC21152",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_CIRRUS, { - {PCI_CHIP_GD5430, "GD5430",0}, - {PCI_CHIP_GD5434_4, "GD5434",0}, - {PCI_CHIP_GD5434_8, "GD5434",0}, - {PCI_CHIP_GD5436, "GD5436",0}, - {PCI_CHIP_GD5446, "GD5446",0}, - {PCI_CHIP_GD5480, "GD5480",0}, - {PCI_CHIP_GD5462, "GD5462",0}, - {PCI_CHIP_GD5464, "GD5464",0}, - {PCI_CHIP_GD5464BD, "GD5464BD",0}, - {PCI_CHIP_GD5465, "GD5465",0}, - {PCI_CHIP_GD7541, "GD7541",0}, - {PCI_CHIP_GD7542, "GD7542",0}, - {PCI_CHIP_GD7543, "GD7543",0}, - {PCI_CHIP_GD7548, "GD7548",0}, - {PCI_CHIP_GD7555, "GD7555",0}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {0x6001, "CS4236B/CS4611 Audio" ,0}, -#endif - {0x0000, NULL,0}}}, - {PCI_VENDOR_IBM, { - {0x000A, "Fire Coral",0 }, - {0x0018, "Token Ring",0 }, - {0x001D, "82G2675",0 }, - {0x0022, "82351 pci-pci bridge",0 }, - {0x00B7, "256-bit Graphics Rasterizer",0 }, - {0x0170, "RC1000 / GT 1000",0}, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_NCR_2, { - {0x0000, NULL,0}}}, -#endif -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_WD, { - {0x3296, "WD 7197",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_AMD, { - {0x2000, "79C970 Lance",0 }, - {0x2020, "53C974 SCSI",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_TRIDENT, { - {PCI_CHIP_9320, "TGUI 9320",0}, - {PCI_CHIP_9420, "TGUI 9420",0}, - {PCI_CHIP_9440, "TGUI 9440",0}, - {PCI_CHIP_9660, "TGUI 96xx",0}, - {PCI_CHIP_9388, "Cyber 9388",0}, - {PCI_CHIP_9397, "Cyber 9397",0}, - {PCI_CHIP_939A, "Cyber 939A/DVD",0}, - {PCI_CHIP_9520, "Cyber 9520",0}, - {PCI_CHIP_9525, "Cyber 9525/DVD",0}, - {PCI_CHIP_9540, "Cyber 9540",0}, - {PCI_CHIP_9750, "3DImage975",0}, - {PCI_CHIP_9850, "3DImage985",0}, - {PCI_CHIP_9880, "Blade3D",0}, - {PCI_CHIP_9910, "Cyber/BladeXP",0}, - {PCI_CHIP_9930, "CyberBlade/XPm",0}, - {PCI_CHIP_8400, "CyberBlade/i7",0}, - {PCI_CHIP_8420, "CyberBlade/DSTN/i7",0}, - {PCI_CHIP_8500, "CyberBlade/i1",0}, - {PCI_CHIP_8520, "CyberBlade/DSTN/i1",0}, - {PCI_CHIP_8600, "CyberBlade/Ai1",0}, - {PCI_CHIP_8620, "CyberBlade/DSTN/Ai1",0}, - {PCI_CHIP_8800, "CyberBlade/XP/Ai1",0}, - {PCI_CHIP_8820, "CyberBlade/XP/DSTN/Ai1",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_ALI, { - {0x1435, "M1435",0}, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_MATROX, { - {PCI_CHIP_MGA2085, "MGA 2085PX",0}, - {PCI_CHIP_MGA2064, "MGA 2064W",0}, - {PCI_CHIP_MGA1064, "MGA 1064SG",0}, - {PCI_CHIP_MGA2164, "MGA 2164W",0}, - {PCI_CHIP_MGA2164_AGP, "MGA 2164W AGP",0}, - {PCI_CHIP_MGAG200_PCI, "MGA G200 PCI",0}, - {PCI_CHIP_MGAG200, "MGA G200 AGP",0}, - {PCI_CHIP_MGAG400, "MGA G400 AGP",0}, - {PCI_CHIP_MGAG550, "MGA G550 AGP",0}, - {PCI_CHIP_MGAG100_PCI, "MGA G100 PCI",0}, - {PCI_CHIP_MGAG100, "MGA G100 AGP",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_CHIPSTECH, { - {PCI_CHIP_65545, "65545",0}, - {PCI_CHIP_65548, "65548",0}, - {PCI_CHIP_65550, "65550",0}, - {PCI_CHIP_65554, "65554",0}, - {PCI_CHIP_65555, "65555",0}, - {PCI_CHIP_68554, "68554",0}, - {PCI_CHIP_69000, "69000",0}, - {PCI_CHIP_69030, "69030",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_MIRO, { - {0x5601, "ZR36050",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_NEC, { - {0x0046, "PowerVR PCX2",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_FD, { - {0x0000, "TMC-18C30 (36C70)",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_SIS, { - {PCI_CHIP_SG86C201, "SG86C201",0}, - {PCI_CHIP_SG86C202, "SG86C202",0}, - {PCI_CHIP_SG86C205, "SG86C205",0}, - {PCI_CHIP_SG86C215, "SG86C215",0}, - {PCI_CHIP_SG86C225, "SG86C225",0}, - {PCI_CHIP_SIS5597, "5597",0}, - {PCI_CHIP_SIS530, "530",0}, - {PCI_CHIP_SIS6326, "6326",0}, - {PCI_CHIP_SIS300, "300",0}, - {PCI_CHIP_SIS630, "630",0}, - {PCI_CHIP_SIS540, "540",0}, - {PCI_CHIP_SIS82C204, "82C204",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_HP, { - {0x1030, "J2585A",0 }, - {0x1031, "J2585B",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_SMC_PCTECH, { - {0x1000, "FDC 37C665/RZ1000",0 }, - {0x1001, "FDC /RZ1001",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_DPT, { - {0xA400, "SmartCache/Raid",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_SGS, { - {PCI_CHIP_STG2000, "STG2000",0}, - {PCI_CHIP_STG1764, "STG1764",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_BUSLOGIC, { - {PCI_CHIP_946C_01, "946C 01",0}, - {PCI_CHIP_946C_10, "946C 10",0}, - {PCI_CHIP_FLASH_POINT, "FlashPoint",0}, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_TI, { - {PCI_CHIP_TI_PERMEDIA, "Permedia",0}, - {PCI_CHIP_TI_PERMEDIA2, "Permedia 2",0}, - {PCI_CHIP_PCI_1130, "PCI 1130",0}, - {PCI_CHIP_PCI_1131, "PCI 1131",0}, - {0x8019, "TSB12LV23 IEEE1394/FireWire",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_SONY, { - {0x8009, "CXD1947A IEEE1394/Firewire",0}, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_OAK, { - {PCI_CHIP_OTI107, "OTI107",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_WINBOND, { - {PCI_CHIP_89C940, "89C940 NE2000-PCI",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_MOTOROLA, { - {PCI_CHIP_MPC105_EAGLE, "MPC105 Eagle",0}, - {PCI_CHIP_MPC105_GRACKLE,"MPC105 Grackle",0}, - {PCI_CHIP_RAVEN, "Raven",0}, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_OAK, { - {PCI_CHIP_ULTRA_DMA, "IDE UltraDMA/33",0}, - {PCI_CHIP_DC5030, "DC5030",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_NUMNINE, { - {PCI_CHIP_I128, "Imagine 128",0}, - {PCI_CHIP_I128_2, "Imagine 128 II",0}, - {PCI_CHIP_I128_T2R, "Imagine 128 Rev 3D T2R",0}, - {PCI_CHIP_I128_T2R4, "Imagine 128 Rev IV T2R4",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_UMC, { - {0x0101, "UM8673F",0}, - {0x673A, "UM8886BF",0}, - {0x886A, "UM8886A",0}, - {0x8881, "UM8881F",0}, - {0x8886, "UM8886F",0}, - {0x8891, "UM8891A",0}, - {0x9017, "UM9017F",0}, - {0xE886, "UM8886N",0}, - {0xE891, "UM8891N",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_X, { - {0x0001, "ITT AGX016",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_PICOP, { - {0x0001, "PT86C52x Vesuvius",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_MYLEX, { - {0x0010, "RAID Controller",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_APPLE, { - {0x0001, "Bandit",0 }, - {0x0002, "Grand Central",0 }, - {0x000E, "Hydra",0 }, - {0x0019, "Keylargo USB",0 }, - {0x0020, "Uni-North AGP",0 }, - {0x0022, "Keylargo I/O",0 }, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_NEXGEN, { - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_QLOGIC, { - {0x1020, "ISP1020",0 }, - {0x1022, "ISP1022",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_CYRIX, { - {0x0000, "5510",0 }, - {0x0001, "PCI Master",0 }, - {0x0002, "5520",0 }, - {0x0100, "5530 Kahlua Legacy",0 }, - {0x0101, "5530 Kahlua SMI",0 }, - {0x0102, "5530 Kahlua IDE",0 }, - {0x0103, "5530 Kahlua Audio",0 }, - {0x0104, "5530 Kahlua Video",0 }, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_LEADTEK, { - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_CONTAQ, { - {0x0600, "82C599",0 }, - {0xc693, "82C693",0 }, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_FOREX, { - {0x0000, NULL,0}}}, -#endif -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_SBS, { - {0x0040, "dataBLIZZARD",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_OLICOM, { - {0x0001, "OC-3136",0 }, - {0x0011, "OC-2315",0 }, - {0x0012, "OC-2325",0 }, - {0x0013, "OC-2183",0 }, - {0x0014, "OC-2326",0 }, - {0x0021, "OC-6151",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_SUN, { - {PCI_CHIP_EBUS, "EBUS",0 }, - {PCI_CHIP_HAPPY_MEAL, "Happy Meal",0 }, - {PCI_CHIP_SIMBA, "Simba Advanced PCI bridge",0 }, - {PCI_CHIP_PSYCHO, "U2P PCI host bridge (Psycho)",0 }, - {PCI_CHIP_SCHIZO, "PCI host bridge (Schizo)",0 }, - {PCI_CHIP_SABRE, "UltraSPARC IIi host bridge (Sabre)",0 }, - {PCI_CHIP_HUMMINGBIRD, "UltraSPARC IIi host bridge (Hummingbird)",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_CMD, { - {0x0640, "640A",0 }, - {0x0643, "643",0 }, - {0x0646, "646",0 }, - {0x0670, "670",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_APPIAN, { - {0x3D32, "Jeronimo 2000 AGP",0 }, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_VISION, { - {0x0001, "QD 8500",0 }, - {0x0002, "QD 8580",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_BROOKTREE, { - {PCI_CHIP_BT848, "848",0}, - {PCI_CHIP_BT849, "849",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_SIERRA, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_ACC, { - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_WINBOND_2, { - {0x0001, "W83769F",0 }, - {0x0105, "SL82C105",0 }, - {0x0565, "W83C553",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_DATABOOK, { - {0xB106, "DB87144",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_3COM, { - {0x5900, "3C590 10bT",0 }, - {0x5950, "3C595 100bTX",0 }, - {0x5951, "3C595 100bT4",0 }, - {0x5952, "3C595 10b-MII",0 }, - {0x9000, "3C900 10bTPO",0 }, - {0x9001, "3C900 10b Combo",0 }, - /* Is it OK for 2 devices to have the same name ? */ - {0x9005, "3C900 10b Combo",0 }, - {0x9050, "3C905 100bTX",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_SMC, { - {0x0005, "9432 TX",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ALI_2, { - {0x1445, "M1445",0 }, - {0x1449, "M1449",0 }, - {0x1451, "M1451",0 }, - {0x1461, "M1461",0 }, - {0x1489, "M1489",0 }, - {0x1511, "M1511",0 }, - {0x1513, "M1513",0 }, - {0x1521, "M1521",0 }, - {0x1523, "M1523",0 }, - {0x1531, "M1531 Aladdin IV",0 }, - {0x1533, "M1533 Aladdin IV",0 }, - {0x5215, "M4803",0 }, - {0x5219, "M5219",0 }, - {0x5229, "M5229 TXpro",0 }, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_MITSUBISHI, { - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_SURECOM, { - {0x0E34, "NE-34PCI Lan",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_NEOMAGIC, { - {PCI_CHIP_NM2070, "NM2070",0}, - {PCI_CHIP_NM2090, "NM2090",0}, - {PCI_CHIP_NM2093, "NM2093",0}, - {PCI_CHIP_NM2160, "NM2160",0}, - {PCI_CHIP_NM2200, "NM2200",0}, - {PCI_CHIP_NM2230, "NM2230 MagicMedia 256AV+",0}, - {PCI_CHIP_NM2360, "NM2360",0}, - {PCI_CHIP_NM2380, "NM2380",0}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {0x8005, "NM2360 MagicMedia 256ZX Audio",0}, -#endif - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_ASP, { - { 0x1200, "ABP940",0 }, - { 0x1300, "ABP940U",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_CERN, { - { 0x0001, "STAR/RD24 SCI-PCI (PMC)",0 }, - { 0x0002, "STAR/RD24 SCI-PCI (PMC)",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_NVIDIA, { - {PCI_CHIP_NV1, "NV1",0}, - {PCI_CHIP_DAC64, "DAC64",0}, - {PCI_CHIP_TNT, "RIVA TNT",0}, - {PCI_CHIP_TNT2, "RIVA TNT2/TNT2 Pro",0}, - {PCI_CHIP_UTNT2, "RIVA TNT2 Ultra",0}, - {PCI_CHIP_VTNT2, "Vanta",0}, - {PCI_CHIP_UVTNT2, "Riva TNT2 M64",0}, - {PCI_CHIP_ITNT2, "Aladdin TNT2",0}, - {PCI_CHIP_GEFORCE256, "GeForce 256",0}, - {PCI_CHIP_GEFORCEDDR, "GeForce DDR",0}, - {PCI_CHIP_QUADRO, "Quadro",0}, - {PCI_CHIP_GEFORCE2MX, "GeForce2 MX/MX 400",0}, - {PCI_CHIP_GEFORCE2MXDDR,"GeForce2 MX 100/200",0}, - {PCI_CHIP_GEFORCE2GO, "GeForce2 Go", 0}, - {PCI_CHIP_QUADRO2MXR, "Quadro2 MXR",0}, - {PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS/Pro",0}, - {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 Ti",0}, - {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0}, - {PCI_CHIP_QUADRO2PRO, "Quadro2 Pro",0}, - {PCI_CHIP_0x0170, "0x0170",0}, - {PCI_CHIP_0x0171, "0x0171",0}, - {PCI_CHIP_0x0172, "0x0172",0}, - {PCI_CHIP_0x0173, "0x0173",0}, - {PCI_CHIP_0x0174, "0x0174",0}, - {PCI_CHIP_0x0175, "0x0175",0}, - {PCI_CHIP_0x0178, "0x0178",0}, - {PCI_CHIP_0x017A, "0x017A",0}, - {PCI_CHIP_0x017B, "0x017B",0}, - {PCI_CHIP_0x017C, "0x017C",0}, - {PCI_CHIP_IGEFORCE2, "GeForce2 Integrated",0}, - {PCI_CHIP_GEFORCE3, "GeForce3",0}, - {PCI_CHIP_GEFORCE3_1, "GeForce3 Ti 200",0}, - {PCI_CHIP_GEFORCE3_2, "GeForce3 Ti 500",0}, - {PCI_CHIP_QUADRO_DDC, "Quadro DDC",0}, - {PCI_CHIP_0x0250, "0x0250",0}, - {PCI_CHIP_0x0258, "0x0258",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_IMS, { - {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0}, - {PCI_CHIP_IMSTT3D, "TwinTurbo 3D", 0}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {0x8849, "8849",0 }, -#endif - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_TEKRAM, { - {0x690C, "DC690C",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_TUNDRA, { - {0x0000, "CA91C042 Universe",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_AMCC, { - {0x8043, "Myrinet PCI (M2-PCI-32)",0 }, - {0x807D, "S5933 PCI44",0 }, - {0x809C, "S5933 Traquair HEPC3",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_INTEGRAPHICS, { - {0x1680, "IGA-1680",0 }, - {0x1682, "IGA-1682",0 }, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_REALTEC, { - {0x8029, "8029",0 }, - {0x8129, "8129",0 }, - {0x8139, "RTL8139 10/100 Ethernet",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_TRUEVISION, { - {0x000C, "Targa 1000",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_INITIO, { - {0x9100, "320 P",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_SIGMADESIGNS_2, { - {0x8300, "EM8300 MPEG2 decoder", 0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_VIA, { - {0x0501, "VT 8501 MVP4 Host Bridge",0 }, - {0x0505, "VT 82C505",0 }, - {0x0561, "VT 82C505",0 }, - {0x0571, "VT 82C586 MVP3 IDE Bridge",0 }, - {0x0576, "VT 82C576 3V",0 }, - {0x0586, "VT 82C586 MVP3 ISA Bridge",0 }, - {0x0686, "VT 82C686 MVP4 ISA Bridge",0 }, - {0x0597, "VT 82C598 MVP3 Host Bridge",0 }, - {0x3038, "VT 82C586 MVP3 USB Controller",0 }, - {0x3040, "VT 82C586B MVP3 ACPI Bridge",0 }, - {0x3057, "VT 8501 MVP4 ACPI Bridge",0 }, - {0x3058, "VT 8501 MVP4 MultiMedia",0 }, - {0x3068, "VT 8501 MVP4 Modem",0 }, - {0x8501, "VT 8501 MVP4 PCI/AGP Bridge",0 }, - {0x8598, "VT 82C598 MVP3 PCI/AGP Bridge",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_VORTEX, { - {0x0001, "GDT 6000b",0 }, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_EF, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_FORE, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_IMAGTEC, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_PLX, { - {0x0000, NULL,0}}}, -#endif -#endif - {PCI_VENDOR_NVIDIA_SGS, { - {PCI_CHIP_RIVA128, "Riva128",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ALLIANCE, { - {PCI_CHIP_AP6410, "ProMotion 6410",0}, - {PCI_CHIP_AP6422, "ProMotion 6422",0}, - {PCI_CHIP_AT24, "ProMotion AT24",0}, - {PCI_CHIP_AT3D, "ProMotion AT3D",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_VMIC, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_DIGI, { - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_MUTECH, { - {0x0001, "MV1000",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_RENDITION, { - {PCI_CHIP_V1000, "Verite 1000",0}, - {PCI_CHIP_V2x00, "Verite 2100/2200",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_TOSHIBA, { - {0x0000, NULL,0}}}, - { PCI_VENDOR_RICOH, { - { 0x0475, "RL5C475 PCI-CardBus bridge/PCMCIA",0 }, - { 0x0000, NULL,0}}}, - {PCI_VENDOR_ZEINET, { - {0x0001, "1221",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_LITEON, { - {0x0002, "82C168/9 PNIC 10/100BaseTX",0 }, - {0xC115, "LC82C115 PNIC II 10/100BaseTX",0 }, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_SPECIALIX, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_CONTROL, { - {0x0000, NULL,0}}}, - {PCI_VENDOR_CYCLADES, { - {0x0000, NULL,0}}}, -#endif -#endif - {PCI_VENDOR_3DFX, { - {PCI_CHIP_VOODOO_GRAPHICS, "Voodoo Graphics",0}, - {PCI_CHIP_VOODOO2, "Voodoo2",0}, - {PCI_CHIP_BANSHEE, "Banshee",0}, - {PCI_CHIP_VOODOO3, "Voodoo3",0}, - {PCI_CHIP_VOODOO5, "Voodoo5",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_SIGMADESIGNS, { - {0x6401, "REALmagic64/GX (SD 6425)",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ENSONIQ, { - {0x5000, "es1370 (AudioPCI)",0 }, - {0x1371, "es1371",0 }, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_ROCKWELL, { - {0x2005, "RS56/SP-PCI11P1 56K V90 modem/spkrphone",0 }, - {0x0000, NULL,0}}}, -#ifdef INCLUDE_EMPTY_LISTS - {PCI_VENDOR_YOKOGAWA, { - {0x0000, NULL,0}}}, -#endif -#endif - {PCI_VENDOR_TRITECH, { - {PCI_CHIP_TR25202, "Pyramid3D TR25202",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_NVIDIA_SGS, { - {0x0018, "Riva128",0 }, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_SYMPHONY, { - {0x0001, "82C101",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_TEKRAM_2, { - {0xDC29, "DC290",0 }, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_3DLABS, { - {PCI_CHIP_300SX, "GLINT 300SX",0}, - {PCI_CHIP_500TX, "GLINT 500TX",0}, - {PCI_CHIP_DELTA, "GLINT Delta",0}, - {PCI_CHIP_PERMEDIA, "GLINT Permedia",0}, - {PCI_CHIP_MX, "GLINT MX",0}, - {PCI_CHIP_PERMEDIA2, "GLINT Permedia 2",0}, - {PCI_CHIP_GAMMA, "GLINT Gamma",0}, - {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v",0}, - {PCI_CHIP_PERMEDIA3, "GLINT Permedia 3",0}, - {PCI_CHIP_PERMEDIA4, "GLINT Permedia 4",0}, - {PCI_CHIP_R4, "GLINT R4",0}, - {PCI_CHIP_R4ALT, "GLINT R4 (Alt)",0}, - {PCI_CHIP_GAMMA2, "GLINT Gamma 2",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_AVANCE_2, { - {PCI_CHIP_ALG2064, "ALG2064",0}, - {PCI_CHIP_ALG2501, "ALG2501",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_S3, { - {PCI_CHIP_PLATO, "PLATO/PX",0}, - {PCI_CHIP_VIRGE, "ViRGE",0}, - {PCI_CHIP_TRIO, "Trio32/64",0}, - {PCI_CHIP_AURORA64VP, "Aurora64V+",0}, - {PCI_CHIP_TRIO64UVP, "Trio64UV+",0}, - {PCI_CHIP_TRIO64V2_DXGX,"Trio64V2/DX or /GX",0}, - {PCI_CHIP_PLATO_PX, "PLATO/PX",0}, - {PCI_CHIP_Trio3D, "Trio3D",0}, - {PCI_CHIP_Trio3D_2X, "Trio3D/2X",0}, - {PCI_CHIP_VIRGE_VX, "ViRGE/VX",0}, - {PCI_CHIP_VIRGE_DXGX, "ViRGE/DX or /GX",0}, - {PCI_CHIP_VIRGE_GX2, "ViRGE/GX2",0}, - {PCI_CHIP_SAVAGE3D, "Savage3D (86E391)",0}, - {PCI_CHIP_SAVAGE3D_MV, "Savage3D+MacroVision (86E390)",0}, - {PCI_CHIP_SAVAGE4, "Savage4",0}, - {PCI_CHIP_SAVAGE2000, "Savage2000",0}, - {PCI_CHIP_SAVAGE_MX, "Savage/MX",0}, - {PCI_CHIP_SAVAGE_MX_MV, "Savage/MX-MV",0}, - {PCI_CHIP_SAVAGE_IX, "Savage/IX",0}, - {PCI_CHIP_SAVAGE_IX_MV, "Savage/IX-MV",0}, - {PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133",0}, - {PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133",0}, - {PCI_CHIP_VIRGE_MX, "ViRGE/MX",0}, - {PCI_CHIP_VIRGE_MXPLUS, "ViRGE/MX+",0}, - {PCI_CHIP_VIRGE_MXP, "ViRGE/MX+MV",0}, - {PCI_CHIP_868, "868",0}, - {PCI_CHIP_928, "928",0}, - {PCI_CHIP_864_0, "864",0}, - {PCI_CHIP_864_1, "864",0}, - {PCI_CHIP_964_0, "964",0}, - {PCI_CHIP_964_1, "964",0}, - {PCI_CHIP_968, "968",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_INTEL,{ -#ifdef VENDOR_INCLUDE_NONVIDEO - {0x0482, "82375EB pci-eisa bridge",0}, - {0x0483, "82424ZX cache dram controller",0}, - {0x0484, "82378IB/ZB pci-isa bridge",0x0601}, - {0x0486, "82430ZX Aries",0}, - {0x04A3, "82434LX/NX pci cache mem controller",0}, - {0x0960, "960RD processor/bridge",0}, - {0x1221, "82092AA",0}, - {0x1222, "82092AA",0}, - {0x1223, "SAA7116",0}, - {0x1226, "82596",0}, - {0x1227, "82865",0}, - {0x1229, "82557/8/9 10/100MBit network controller",0 }, - {0x122D, "82437 Triton",0}, - {0x122E, "82471 Triton",0}, - {0x1230, "82371 bus-master IDE controller",0}, - {0x1234, "82371MX bus-master IDE controller",0}, - {0x1235, "82437MX",0}, - {0x1237, "82441FX Natoma",0}, - {0x124B, "82380FB",0}, - {0x1250, "82439",0}, - {0x7000, "82371 pci-isa bridge",0}, - {0x7010, "82371 bus-master IDE controller",0}, - {0x7020, "82371 bus-master IDE controller",0}, - {0x7030, "82437VX",0}, - {0x7100, "82439TX",0}, - {0x7110, "82371AB PIIX4 ISA",0}, - {0x7111, "82371AB PIIX4 IDE",0}, - {0x7112, "82371AB PIIX4 USB",0}, - {0x7113, "82371AB PIIX4 ACPI",0}, - {0x7180, "82443LX PAC Host",0}, - {0x7181, "82443LX PAC AGP",0}, - {0x7190, "82443BX Host",0}, - {0x7191, "82443BX AGP",0}, - {0x7192, "82443BX Host (no AGP)",0}, - {0x71a0, "82443GX Host",0}, - {0x71a1, "82443GX AGP",0}, - {0x71a2, "82443GX Host (no AGP)",0}, - {0x84C4, "P6",0}, - {0x84C5, "82450GX20",0}, - {PCI_CHIP_I810_BRIDGE, "i810 Bridge",0}, - {PCI_CHIP_I810_DC100_BRIDGE, "i810-dc100 Bridge",0}, - {PCI_CHIP_I810_E_BRIDGE,"i810e Bridge",0}, - {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0}, - {PCI_CHIP_I830_M_BRIDGE,"i830M Bridge",0}, -#endif - {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, - {PCI_CHIP_I810, "i810",0}, - {PCI_CHIP_I810_DC100, "i810-dc100",0}, - {PCI_CHIP_I810_E, "i810e",0}, - {PCI_CHIP_I815, "i815",0}, - {PCI_CHIP_I830_M, "i830M",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ADAPTEC, { - {0x0010, "2940U2",0 }, - {0x1078, "7810",0 }, - {0x5078, "7850",0 }, - {0x5578, "7855",0 }, - {0x6078, "7860",0 }, - {0x6178, "2940AU",0 }, - {0x7078, "7870",0 }, - {0x7178, "2940",0 }, - {0x7278, "7872",0 }, - {0x7378, "398X",0 }, - {0x7478, "2944",0 }, - {0x7895, "7895",0 }, - {0x8078, "7880",0 }, - {0x8178, "2940U/UW",0 }, - {0x8278, "3940U/UW",0 }, - {0x8378, "389XU",0 }, - {0x8478, "2944U",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ADAPTEC_2, { - {0x001F, "7890/7891",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ATRONICS, { - {0x2015, "IDE-2015PL",0 }, - {0x0000, NULL,0}}}, - {PCI_VENDOR_ARK, { - {PCI_CHIP_1000PV, "1000PV",0}, - {PCI_CHIP_2000PV, "2000PV",0}, - {PCI_CHIP_2000MT, "2000MT",0}, - {PCI_CHIP_2000MI, "2000MI",0}, - {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO - {PCI_VENDOR_YAMAHA, { - {0x000a, "YMF740-V Audio",0}, - {0x0000, NULL,0}}}, -#endif - {PCI_VENDOR_SMI, { - {PCI_CHIP_SMI910, "Lynx",0}, - {PCI_CHIP_SMI810, "LynxE",0}, - {PCI_CHIP_SMI820, "Lynx3D",0}, - {PCI_CHIP_SMI710, "LynxEM",0}, - {PCI_CHIP_SMI712, "LynxEM+",0}, - {PCI_CHIP_SMI720, "Lynx3DM",0}, - {0x0000, NULL,0}}}, - {PCI_VENDOR_VMWARE, { - {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0}, - {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0}, - {0x0000, NULL,0}}}, - {0x0000, { - {0x0000, NULL,0}}}, -}; -#endif - -#ifdef DECLARE_CARD_DATASTRUCTURES - -/* Increase this as required */ -#define MAX_CARD_PER_VENDOR 64 - -typedef void (*pciPrintProcPtr)(pciCfgRegs *); -typedef struct { - unsigned short VendorID; - struct pciCard { - unsigned short SubsystemID; - char *CardName; - CARD16 class; - pciPrintProcPtr printFunc; - } Device[MAX_CARD_PER_VENDOR]; -} pciVendorCardInfo; - -extern pciVendorCardInfo* xf86PCICardInfo; - -#ifdef INIT_PCI_CARD_INFO - -#define NF (pciPrintProcPtr)NULL - -static pciVendorCardInfo xf86PCICardInfoData[] = { -#ifdef VENDOR_INCLUDE_NONVIDEO - { PCI_VENDOR_3COM, { - { 0x9005, "PCI Combo ethernet card",0,NF }, - { 0x0000, (char *)NULL,0, NF } } }, -#endif -#ifdef VENDOR_INCLUDE_NONVIDEO - { PCI_VENDOR_ADAPTEC, { - { 0x7881, "AHA-2940U/UW SCSI",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, -#endif - /* ATI card info deleted; unmaintainable */ -#ifdef VENDOR_INCLUDE_NONVIDEO - { PCI_VENDOR_COMPAQ, { - { 0xC001, "NC3121",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_NCR_1, { - { 0x1000, "SCSI HBA",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_REALTEC, { - { 0x8139, "Generic",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_CREATIVE_2, { - { 0x1017, "3D Blaster Banshee",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - {PCI_VENDOR_DIGITAL, { - { 0x500A, "EtherWORKS 10/100",0, NF}, - { 0x0000, (char *)NULL,0, NF } } }, -#endif - { PCI_VENDOR_SONY, { - { 0x8051, "Vaio Video",0,NF }, -#ifdef VENDOR_INCLUDE_NONVIDEO - { 0x8052, "Vaio Audio",0,NF }, - { 0x8054, "Vaio Firewire",0,NF }, - { 0x8056, "Vaio Modem",0,NF }, - { 0x8057, "Vaio Ethernet",0,NF }, -#endif - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_DIAMOND, { - { 0x0003, "Monster Fusion",0, NF }, - { 0x00b8, "Fire GL1",0, NF }, - { 0x0100, "Stealth II G460",0, NF }, - { 0x0154, "Fire GL 1000 PRO",0, NF }, - { 0x0172, "Fire GL2",0, NF }, - { 0x0173, "Fire GL2",0, NF }, - { 0x0550, "Viper 550",0, NF }, - { 0x1092, "Viper 330",0, NF }, - { 0x1103, "Fire GL 1000",0, NF }, - { 0x2000, "Stealth II S220",0, NF }, - { 0x2110, "Sonic Impact S70",0, NF }, - { 0x4803, "Monster Fusion",0, NF }, - { 0x6820, "Viper 770",0, NF }, - { 0x8000, "C&T 69000",0, NF }, - { 0x8760, "Fireport 40 Dual",0, NF }, - { 0x8a10, "Stealth 3D 4000",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_APPIAN, { - { 0x3d32, "Jeronimo 2000",0, NF }, - { 0x3db3, "Jeronimo Pro",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_3DFX, { - { PCI_CARD_VOODOO3_2000, "Voodoo3 2000",0, NF }, - { PCI_CARD_VOODOO3_3000, "Voodoo3 3000",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_3DLABS, { - { 0x0096, "Permedia",0, NF }, - { 0x0098, "PermediaNT",0, NF }, - { 0x0099, "PermediaLC",0, NF }, - { 0x0100, "Permedia2 PCI",0, NF }, - { 0x0101, "Permedia2 AGP",0, NF }, - { 0x0102, "Oxygen GMX2000 PCI",0, NF }, - { 0x0106, "Oxygen GMX2000 AGP",0, NF }, - { 0x0116, "Oxygen GVX1 AGP",0, NF }, - { 0x0121, "Oxygen VX1 PCI",0, NF }, - { 0x0122, "Oxygen ACX AGP",0, NF }, - { 0x0123, "Oxygen ACX PCI",0, NF }, - { 0x0125, "Oxygen VX1 AGP",0, NF }, - { 0x0127, "Permedia3 Create!",0, NF }, - { 0x0134, "Oxygen GVX1 PCI",0, NF }, - { 0x0136, "Oxygen GVX210 AGP",0, NF }, - { 0x0139, "Oxygen GVX1 Pro AGP",0, NF }, - { 0x0140, "Oxygen VX1-16 AGP",0, NF }, - { 0x0144, "Oxygen VX1-4X AGP",0, NF }, - { 0x0400, "Oxygen GVX420 AGP",0, NF }, - { 0x0800, "Oxygen VX1-1600SW PCI",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_ELSA, { - { 0x0914, "Winner 1000",0, NF }, - { 0x0930, "Winner 1000PRO 864",0, NF }, - { 0x0931, "Winner 1000PRO Trio32",0, NF }, - { 0x0932, "Winner 1000Trio Trio64",0, NF }, - { 0x0933, "Winner 1000TrioV Trio64V+",0, NF }, - { 0x0934, "Victory 3D",0, NF }, - { 0x0935, "Winner 1000 T2D",0, NF }, - { 0x0936, "Winner 1000PRO 868",0, NF }, - { 0x0937, "Winner 1000PRO/X 868",0, NF }, - { 0x0938, "Winner 1000ViRGE",0, NF }, - { 0x0939, "Winner 1000ViRGE/DX",0, NF }, - { 0x093a, "Winner 1000/T2DX",0, NF }, - { 0x093b, "Winner DUO M5",0, NF }, - { 0x093c, "Victory 1000",0, NF }, - { 0x0940, "Winner 2000PRO 964/TVP3020",0, NF }, - { 0x0941, "Winner 2000PRO/X 968/TVP3020",0, NF }, - { 0x0942, "Winner 2000PRO/X 968/TVP3026",0, NF }, - { 0x0943, "Winner 2000AVI 968/TVP3026",0, NF }, - { 0x0948, "Winner 2000PRO-8 964/RGB528",0, NF }, - { 0x094a, "Winner 2000PRO-8 968/RGB528",0, NF }, - { 0x094b, "Winner 2000PRO-8 968/TVP3030",0, NF }, - { 0x0950, "ViRGE/VX",0, NF }, - { 0x0951, "Winner 2000AVI 3D",0, NF }, - { 0x0952, "Winner 2000AVI 220",0, NF }, - { 0x0960, "Winner 3000M",0, NF }, - { 0x0962, "Winner 3000L",0, NF }, - { 0x0964, "Winner 3000XL",0, NF }, - { 0x096a, "Winner 3000Twin",0, NF }, - { 0x096c, "Winner 3000LT",0, NF }, - { 0x0980, "GLoria 4 TVP3026",0, NF }, - { 0x0982, "GLoria 4 TVP3030",0, NF }, - { 0x0981, "GLoria 8",0, NF }, - { 0x0a10, "GLoria M",0, NF }, - { 0x0a14, "GLoria S",0, NF }, - { 0x0a31, "Winner 2000 Office",0, NF }, - { 0x0a32, "GLoria Synergy P2C",0, NF }, - { 0x0a33, "GLoria Synergy P2C",0, NF }, - { 0x0a34, "GLoria Synergy P2V",0, NF }, - { 0x0a35, "GLoria Synergy P2A",0, NF }, - { 0x0a36, "Quad GLoria Synergy P2A",0, NF }, - { 0x0a40, "GLoria MX",0, NF }, - { 0x0a41, "GLoria XL",0, NF }, - { 0x0a42, "GLoria XXL",0, NF }, - { 0x0a43, "Winner 2000 Office P2V",0, NF }, - { 0x0a44, "Winner 2000 Office P2A",0, NF }, - { 0x0a80, "GLoria S MAC",0, NF }, - { 0x0c10, "Victory Erazor 4",0, NF }, - { 0x0c11, "Victory Erazor 8",0, NF }, - { 0x0c12, "Winner 1000 R3D",0, NF }, - { 0x0c13, "Winner 1000 ZX4",0, NF }, - { 0x0c14, "Victory Erazor/LT SGRAM",0, NF }, - { 0x0c15, "Victory Erazor/LT SDRAM",0, NF }, - { 0x0c18, "Erazor II SGRAM",0, NF }, - { 0x0c19, "Erazor II SDRAM video",0, NF }, - { 0x0c1a, "Synergy Pro",0, NF }, - { 0x0c1c, "Erazor II SDRAM",0, NF }, - { 0x0c20, "Synergy II 32",0, NF }, - { 0x0c21, "Synergy II 16",0, NF }, - { 0x0c22, "Erazor III",0, NF }, - { 0x0c23, "Erazor III video",0, NF }, - { 0x0d10, "Victory II SGRAM",0, NF }, - { 0x0d11, "Victory II SDRAM",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_HERCULES, { - { 0x0001, "Thriller3D",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_IBM, { - { 0x00ba, "Thinkpad 600 NeoMagic NM2160",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - {PCI_VENDOR_INTEL, { -#ifdef VENDOR_INCLUDE_NONVIDEO - { 0x0009, "PCI 10/100Mb/s ethernet card",0, NF }, - { 0x0040, "PRO/100 S Desktop Adapter PCI 10/100Mb/s ethernet card",0, NF }, - /* Seattle AL440BX is 0x8080, is anything else ? */ - { 0x8080, "motherboard",0, NF }, - { 0x3013, "Integrated LAN (82562ET)",0, NF }, - { 0x4541, "Eastern (D815EEA) motherboard",0, NF }, - { 0x4d55, "Maui (MU) motherboard",0, NF }, -#endif - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_MATROX, { - { 0x1100, "Mystique",0, NF }, - { 0x1000, "Millennium II",0, NF }, - { 0x0100, "Millennium II",0, NF }, - { 0x1200, "Millennium II",0, NF }, - { PCI_CARD_MILL_G200_SD, "Millennium G200 SD",0, NF }, - { PCI_CARD_PROD_G100_SD, "Produktiva G100 SD",0, NF }, - { PCI_CARD_MYST_G200_SD, "Mystique G200 SD",0, NF }, - { PCI_CARD_MILL_G200_SG, "Millennium G200 SG",0, NF }, - { PCI_CARD_MARV_G200_SD, "Marvel G200 SD",0, NF }, - { 0x1001, "Productiva G100 SG",0, NF }, - { PCI_CARD_G400_TH, "G400 Twin Head",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_SIS, { - { 0x6306, "530 based motherboard",0, NF }, - { 0x6326, "6326 based card",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, -#ifdef VENDOR_INCLUDE_NONVIDEO - { PCI_VENDOR_CREATIVE, { - { 0x4c4c, "Sound Blaster PCI128",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, -#endif - { PCI_VENDOR_S3, { - { 0x8904, "Trio3D",0, NF }, - { 0x8a10, "Generic",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_NUMNINE, { - { 0x8a10, "Reality 334",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_TOSHIBA, { - { 0x0001, "4010CDT CT65555",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, -#ifdef VENDOR_INCLUDE_NONVIDEO - { PCI_VENDOR_LITEON, { - { 0xc001, "LNE100TX Version 2.0",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_BUSLOGIC, { - { 0x1040, "BT958",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, - { PCI_VENDOR_NETGEAR, { - { 0xf004, "FA310-TX Rev. D2",0, NF }, - { 0x0000, (char *)NULL,0, NF } } }, -#endif -#if 0 - { PCI_VENDOR_VMWARE, { - {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0, NF }, - {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0, NF }, - {0x0000, NULL,0, NF } } }, -#endif - {0x0000, { - {0x0000, NULL,0, NF } } }, -}; -#endif -#endif #endif /* _XF86_PCIINFO_H */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.76 xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.80 --- xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.76 Mon Jan 14 20:56:56 2002 +++ xc/programs/Xserver/hw/xfree86/common/xf86Priv.h Thu Dec 12 13:29:10 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.76 2002/01/15 01:56:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.80 2002/12/12 18:29:10 eich Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -57,6 +57,7 @@ /* Other parameters */ extern xf86InfoRec xf86Info; +extern const char *xf86InputDeviceList; extern const char *xf86ModulePath; extern MessageType xf86ModPathFrom; extern const char *xf86LogFile; @@ -155,6 +156,9 @@ void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy); void xf86Wakeup(pointer blockData, int err, pointer pReadmask); void xf86SigHandler(int signo); +#ifdef MEMDEBUG +void xf86SigMemDebug(int signo); +#endif void xf86HandlePMEvents(int fd, pointer data); extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num); extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); @@ -173,6 +177,7 @@ void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl, int unused); void xf86KbdLeds(void); +void xf86UpdateKbdLeds(void); void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl); void xf86InitKBD(Bool init); int xf86KbdProc(DeviceIntPtr pKeyboard, int what); Index: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.30 xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.37 --- xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.30 Fri Nov 30 07:11:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h Wed Feb 19 23:05:14 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.30 2001/11/30 12:11:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.37 2003/02/20 04:05:14 dawes Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -22,9 +22,22 @@ PCIProbe2, PCIForceConfig1, PCIForceConfig2, + PCIForceNone, PCIOsConfig } PciProbeType; +typedef enum { + LogNone, + LogFlush, + LogSync +} Log; + +typedef enum { + SKNever, + SKWhenNeeded, + SKAlways +} SpecialKeysInDDX; + /* * xf86InfoRec contains global parameters which the video drivers never * need to access. Global parameters which the video drivers do need @@ -56,6 +69,8 @@ Bool modeSwitchLock; Bool composeLock; Bool vtSysreq; + SpecialKeysInDDX ddxSpecialKeys; + Bool ActionKeyBindingsSet; #if defined(SVR4) && defined(i386) Bool panix106; #endif /* SVR4 && i386 */ @@ -73,6 +88,7 @@ int lastEventTime; Bool vtRequestsPending; Bool inputPending; + Bool dontVTSwitch; Bool dontZap; Bool dontZoom; Bool notrapSignals; /* don't exit cleanly - die at fault */ @@ -120,10 +136,12 @@ #if defined(i386) || defined(__i386__) Bool pc98; #endif - Bool pmFlag; - Bool syncLog; - int estimateSizesAggressively; - Bool kbdCustomKeycodes; + Bool pmFlag; + Log log; + int estimateSizesAggressively; + Bool kbdCustomKeycodes; + Bool disableRandR; + MessageType randRFrom; struct { Bool disabled; /* enable/disable deactivating * grabs or closing the @@ -180,10 +198,6 @@ #define PCVT 16 #define WSCONS 32 #endif - -/* Values of xf86Info.mouseFlags */ -#define MF_CLEAR_DTR 1 -#define MF_CLEAR_RTS 2 /* Prefix strings for driver messages */ #ifndef X_UNKNOWN_STRING Index: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/common/xf86RandR.c:1.4 --- /dev/null Thu Feb 27 12:30:18 2003 +++ xc/programs/Xserver/hw/xfree86/common/xf86RandR.c Thu Feb 13 05:49:38 2003 @@ -0,0 +1,280 @@ +/* + * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.4 2003/02/13 10:49:38 eich Exp $ + * + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "X.h" +#include "os.h" +#include "mibank.h" +#include "globals.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86DDC.h" +#include "mipointer.h" +#include + +typedef struct _xf86RandRInfo { + CreateScreenResourcesProcPtr CreateScreenResources; + CloseScreenProcPtr CloseScreen; + int virtualX; + int virtualY; +} XF86RandRInfoRec, *XF86RandRInfoPtr; + +static int xf86RandRIndex; +static int xf86RandRGeneration; + +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[xf86RandRIndex].ptr) + +static int +xf86RandRModeRefresh (DisplayModePtr mode) +{ + if (mode->VRefresh) + return (int) mode->VRefresh; + else + return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal); +} + +static Bool +xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +{ + RRScreenSizePtr pSize; + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + DisplayModePtr mode; + Bool reportVirtual = TRUE; + int refresh0 = 60; + + *rotations = RR_Rotate_0; + + for (mode = scrp->modes; ; mode = mode->next) + { + int refresh = xf86RandRModeRefresh (mode); + if (mode == scrp->modes) + refresh0 = refresh; + pSize = RRRegisterSize (pScreen, + mode->HDisplay, mode->VDisplay, + pScreen->mmWidth, pScreen->mmHeight); + if (!pSize) + return FALSE; + if (mode->HDisplay == randrp->virtualX && + mode->VDisplay == randrp->virtualY) + reportVirtual = FALSE; + RRRegisterRate (pScreen, pSize, refresh); + if (mode == scrp->currentMode && + mode->HDisplay == pScreen->width && mode->VDisplay == pScreen->height) + RRSetCurrentConfig (pScreen, RR_Rotate_0, refresh, pSize); + if (mode->next == scrp->modes) + break; + } + if (reportVirtual) + { + mode = scrp->modes; + pSize = RRRegisterSize (pScreen, + randrp->virtualX, randrp->virtualY, + pScreen->mmWidth * randrp->virtualX / mode->HDisplay, + pScreen->mmHeight * randrp->virtualY / mode->VDisplay); + if (!pSize) + return FALSE; + RRRegisterRate (pScreen, pSize, refresh0); + if (pScreen->width == randrp->virtualX && + pScreen->height == randrp->virtualY) + { + RRSetCurrentConfig (pScreen, RR_Rotate_0, refresh0, pSize); + } + } + return TRUE; +} + +static Bool +xf86RandRSetMode (ScreenPtr pScreen, + DisplayModePtr mode, + Bool useVirtual) +{ + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + int oldWidth = pScreen->width; + int oldHeight = pScreen->height; + WindowPtr pRoot = WindowTable[pScreen->myNum]; + + if (pRoot) + xf86EnableDisableFBAccess (pScreen->myNum, FALSE); + if (useVirtual) + { + scrp->virtualX = randrp->virtualX; + scrp->virtualY = randrp->virtualY; + } + else + { + scrp->virtualX = mode->HDisplay; + scrp->virtualY = mode->VDisplay; + } + pScreen->width = scrp->virtualX; + pScreen->height = scrp->virtualY; + if (!xf86SwitchMode (pScreen, mode)) + { + scrp->virtualX = pScreen->width = oldWidth; + scrp->virtualY = pScreen->height = oldHeight; + return FALSE; + } + /* + * Make sure the layout is correct + */ + xf86ReconfigureLayout(); + + /* + * Make sure the whole screen is visible + */ + xf86SetViewport (pScreen, pScreen->width, pScreen->height); + xf86SetViewport (pScreen, 0, 0); + if (pRoot) + xf86EnableDisableFBAccess (pScreen->myNum, TRUE); + return TRUE; +} + +static Bool +xf86RandRSetConfig (ScreenPtr pScreen, + Rotation rotation, + int rate, + RRScreenSizePtr pSize) +{ + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + DisplayModePtr mode; + int px, py; + Bool useVirtual = FALSE; + + miPointerPosition (&px, &py); + for (mode = scrp->modes; ; mode = mode->next) + { + if (mode->HDisplay == pSize->width && + mode->VDisplay == pSize->height && + (rate == 0 || xf86RandRModeRefresh (mode) == rate)) + break; + if (mode->next == scrp->modes) + { + if (pSize->width == randrp->virtualX && + pSize->height == randrp->virtualY) + { + mode = scrp->modes; + useVirtual = TRUE; + break; + } + return FALSE; + } + } + if (!xf86RandRSetMode (pScreen, mode, useVirtual)) + return FALSE; + /* + * Move the cursor back where it belongs; SwitchMode repositions it + */ + if (pScreen == miPointerCurrentScreen ()) + { + if (px < pSize->width && py < pSize->height) + (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); + } + return TRUE; +} + +/* + * Wait until the screen is initialized before whacking the + * sizes around; otherwise the screen pixmap will be allocated + * at the current mode size rather than the maximum size + */ +static Bool +xf86RandRCreateScreenResources (ScreenPtr pScreen) +{ + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + DisplayModePtr mode; + + pScreen->CreateScreenResources = randrp->CreateScreenResources; + if (!(*pScreen->CreateScreenResources) (pScreen)) + return FALSE; + + mode = scrp->currentMode; + if (mode) + xf86RandRSetMode (pScreen, mode, TRUE); + + return TRUE; +} + +/* + * Reset size back to original + */ +static Bool +xf86RandRCloseScreen (int index, ScreenPtr pScreen) +{ + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + + scrp->virtualX = pScreen->width = randrp->virtualX; + scrp->virtualY = pScreen->height = randrp->virtualY; + scrp->currentMode = scrp->modes; + pScreen->CloseScreen = randrp->CloseScreen; + xfree (randrp); + pScreen->devPrivates[xf86RandRIndex].ptr = 0; + return (*pScreen->CloseScreen) (index, pScreen); +} + +Bool +xf86RandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr rp; + XF86RandRInfoPtr randrp; + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + +#ifdef PANORAMIX + /* XXX disable RandR when using Xinerama */ + if (!noPanoramiXExtension) + return TRUE; +#endif + if (xf86RandRGeneration != serverGeneration) + { + xf86RandRIndex = AllocateScreenPrivateIndex(); + xf86RandRGeneration = serverGeneration; + } + + randrp = xalloc (sizeof (XF86RandRInfoRec)); + if (!randrp) + return FALSE; + + if (!RRScreenInit (pScreen)) + { + xfree (randrp); + return FALSE; + } + rp = rrGetScrPriv(pScreen); + rp->rrGetInfo = xf86RandRGetInfo; + rp->rrSetConfig = xf86RandRSetConfig; + + randrp->virtualX = scrp->virtualX; + randrp->virtualY = scrp->virtualY; + + randrp->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = xf86RandRCreateScreenResources; + + randrp->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = xf86RandRCloseScreen; + + pScreen->devPrivates[xf86RandRIndex].ptr = randrp; + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.13 xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.14 --- xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.13 Fri Jun 1 14:43:49 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Resources.h Tue Jul 23 21:47:24 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.13 2001/06/01 18:43:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.14 2002/07/24 01:47:24 tsi Exp $ */ #ifndef _XF86_RESOURCES_H @@ -79,7 +79,7 @@ #define _8514_SHARED \ {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} -/* predefined resources */ +/* Predefined resources */ extern resRange resVgaExclusive[]; extern resRange resVgaShared[]; extern resRange resVgaIoShared[]; @@ -91,11 +91,12 @@ extern resRange res8514Exclusive[]; extern resRange res8514Shared[]; -/* Less misleading aliases for xf86SetOpratingState() */ +/* Less misleading aliases for xf86SetOperatingState() */ #define resVgaMem resVgaMemShared #define resVgaIo resVgaIoShared +#define resVga resVgaShared -/* old style names */ +/* Old style names */ #define RES_EXCLUSIVE_VGA resVgaExclusive #define RES_SHARED_VGA resVgaShared #define RES_EXCLUSIVE_8514 res8514Exclusive Index: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c:1.12 xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c:1.14 --- xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c:1.12 Sun May 6 17:59:07 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c Tue Jan 28 15:52:28 2003 @@ -1,7 +1,7 @@ /* * Copyright (c) 1999 by The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.12 2001/05/06 21:59:07 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.14 2003/01/28 20:52:28 tsi Exp $ */ /* * This file contains the VidMode functions required by the extension. @@ -330,56 +330,16 @@ VidModeSwitchMode(int scrnIndex, pointer mode) { ScrnInfoPtr pScrn; - Bool tmp; - + DEBUG_P("VidModeSwitchMode"); - if ((mode == NULL) || (!VidModeAvailable(scrnIndex))) + if (!VidModeAvailable(scrnIndex)) return FALSE; pScrn = xf86Screens[scrnIndex]; - - /* This is basically the xf86ZoomViewport code reproduced */ - - if (pScrn->SwitchMode == NULL) return FALSE; - - xf86EnterServerState(SETUP); - tmp = pScrn->SwitchMode(scrnIndex, (DisplayModePtr)mode, 0); - xf86EnterServerState(OPERATING); - if (tmp) { - /* - * adjust new frame for the displaysize - */ - pScrn->currentMode = (DisplayModePtr)mode; - pScrn->frameX0 = (pScrn->frameX1 + pScrn->frameX0 - - ((DisplayModePtr)mode)->HDisplay) / 2; - pScrn->frameX1 = pScrn->frameX0 + ((DisplayModePtr)mode)->HDisplay - 1; - - if (pScrn->frameX0 < 0) { - pScrn->frameX0 = 0; - pScrn->frameX1 = pScrn->frameX0 + ((DisplayModePtr)mode)->HDisplay - 1; - } else if (pScrn->frameX1 >= pScrn->virtualX) { - pScrn->frameX0 = pScrn->virtualX - ((DisplayModePtr)mode)->HDisplay; - pScrn->frameX1 = pScrn->frameX0 + ((DisplayModePtr)mode)->HDisplay - 1; - } - - pScrn->frameY0 = (pScrn->frameY1 + pScrn->frameY0 - - ((DisplayModePtr)mode)->VDisplay) / 2; - pScrn->frameY1 = pScrn->frameY0 + ((DisplayModePtr)mode)->VDisplay - 1; - - if (pScrn->frameY0 < 0) { - pScrn->frameY0 = 0; - pScrn->frameY1 = pScrn->frameY0 + ((DisplayModePtr)mode)->VDisplay - 1; - } else if (pScrn->frameY1 >= pScrn->virtualY) { - pScrn->frameY0 = pScrn->virtualY - ((DisplayModePtr)mode)->VDisplay; - pScrn->frameY1 = pScrn->frameY0 + ((DisplayModePtr)mode)->VDisplay - 1; - } - } - - if (pScrn->AdjustFrame != NULL) - (pScrn->AdjustFrame)(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - - return TRUE; + /* Force a mode switch */ + pScrn->currentMode = NULL; + return xf86SwitchMode(pScrn->pScreen, mode); } Bool Index: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86XKB.c:3.10 xc/programs/Xserver/hw/xfree86/common/xf86XKB.c:3.11 --- xc/programs/Xserver/hw/xfree86/common/xf86XKB.c:3.10 Mon Jul 23 09:15:47 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86XKB.c Thu Oct 10 21:40:31 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.10 2001/07/23 13:15:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.11 2002/10/11 01:40:31 dawes Exp $ */ #include #define NEED_EVENTS 1 @@ -48,69 +48,4 @@ void xf86InitXkb(void) { -} - -void -XkbDDXUpdateIndicators(DeviceIntPtr pXDev,CARD32 new) -{ - CARD32 old; -#if defined (__sparc__) - static int kbdSun = -1; - - if (kbdSun == -1) { - if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) - || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) - kbdSun = 1; - else - kbdSun = 0; - } - if (kbdSun) { - old = new; - new = 0; - if (old & 0x08) new |= XLED1; - if (old & 0x04) new |= XLED3; - if (old & 0x02) new |= XLED4; - if (old & 0x01) new |= XLED2; - } -#endif /* defined (__sparc__) */ -#ifdef DEBUG -/* if (xkbDebugFlags)*/ - ErrorF("XkbDDXUpdateIndicators(...,0x%x) -- XFree86 version\n",new); -#endif -#ifdef LED_CAP - old= new; - new= 0; - if (old&XLED1) new|= LED_CAP; - if (old&XLED2) new|= LED_NUM; - if (old&XLED3) new|= LED_SCR; -#ifdef LED_COMP - if (old&XLED4) new|= LED_COMP; -#endif -#endif - xf86SetKbdLeds(new); - return; -} - -void -XkbDDXUpdateDeviceIndicators( DeviceIntPtr dev, - XkbSrvLedInfoPtr sli, - CARD32 new) -{ - if (sli->fb.kf==dev->kbdfeed) - XkbDDXUpdateIndicators(dev,new); - else if (sli->class==KbdFeedbackClass) { - KbdFeedbackPtr kf; - kf= sli->fb.kf; - if (kf && kf->CtrlProc) { - (*kf->CtrlProc)(dev,&kf->ctrl); - } - } - else if (sli->class==LedFeedbackClass) { - LedFeedbackPtr lf; - lf= sli->fb.lf; - if (lf && lf->CtrlProc) { - (*lf->CtrlProc)(dev,&lf->ctrl); - } - } - return; } Index: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.66 xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.68 --- xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.66 Fri Aug 17 09:27:54 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c Thu Oct 10 21:40:31 2002 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.66 2001/08/17 13:27:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.68 2002/10/11 01:40:31 dawes Exp $ */ #include "Xfuncproto.h" #include "Xmd.h" @@ -1306,6 +1306,28 @@ va_end(var); } +void +xf86PostKeyboardEvent(DeviceIntPtr device, + unsigned int key_code, + int is_down) +{ + xEvent xE[2]; + deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE; + + if (xf86IsCoreKeyboard(device)) { + xev->type = is_down ? KeyPress : KeyRelease; + } else { + xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease; + } + xev->detail = key_code; + xf86Info.lastEventTime = xev->time = GetTimeInMillis(); + +#ifdef XFreeXDGA + /* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */ +#endif + ENQUEUE(xE); +} + /* * Motion history management. */ @@ -1317,7 +1339,7 @@ if (!HAS_MOTION_HISTORY(local)) return; - + if (local->motion_history) xfree(local->motion_history); local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time)) * valuator->numMotionEvents); local->first = 0; Index: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:3.34 xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:3.35 --- xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:3.34 Mon Apr 16 17:08:24 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h Thu Oct 10 21:40:31 2002 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.34 2001/04/16 21:08:24 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.35 2002/10/11 01:40:31 dawes Exp $ */ #ifndef _xf86Xinput_h #define _xf86Xinput_h @@ -160,6 +160,8 @@ void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down, int is_absolute, int first_valuator, int num_valuators, ...); +void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, + int is_down); void xf86MotionHistoryAllocate(LocalDevicePtr local); int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff, unsigned long start, unsigned long stop, Index: xc/programs/Xserver/hw/xfree86/common/xf86noBus.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/common/xf86noBus.c:1.1 --- /dev/null Thu Feb 27 12:30:19 2003 +++ xc/programs/Xserver/hw/xfree86/common/xf86noBus.c Wed Sep 18 04:54:55 2002 @@ -0,0 +1,48 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86noBus.c,v 1.1 2002/09/18 08:54:55 eich Exp $ */ + +/* + * Copyright (c) 2000 by The XFree86 Project, Inc. + */ + +/* + * This file contains the interfaces to the bus-specific code + */ + +#include +#include +#include +#include "X.h" +#include "os.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86Resources.h" + +#include "xf86Bus.h" + +#define XF86_OS_PRIVS +#define NEED_OS_RAC_PROTOS +#include "xf86_OSproc.h" + +#include "xf86RAC.h" + +int +xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) +{ + EntityPtr p; + int num; + + num = xf86AllocateEntity(); + p = xf86Entities[num]; + p->driver = drvp; + p->chipset = 0; + p->busType = BUS_NONE; + p->active = active; + p->inUse = FALSE; + xf86AddDevToEntity(num, dev); + p->access = xnfcalloc(1,sizeof(EntityAccessRec)); + p->access->fallback = &AccessNULL; + p->access->pAccess = &AccessNULL; + p->busAcc = NULL; + + return num; +} Index: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.48 xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.68 --- xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.48 Fri Nov 30 07:11:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c Tue Feb 18 10:42:11 2003 @@ -1,11 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.48 2001/11/30 12:11:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.68 2003/02/18 15:42:11 tsi Exp $ */ /* - * Copyright (c) 1997-1999 by The XFree86 Project, Inc. + * Copyright (c) 1997-2002 by The XFree86 Project, Inc. */ /* * This file contains the interfaces to the bus-specific code */ +#define INCLUDE_DEPRECATED 1 + #include #include #include @@ -15,13 +17,9 @@ #include "xf86.h" #include "xf86Priv.h" #include "xf86Resources.h" -#include "xf86ScanPci.h" /* Bus-specific headers */ -#undef DECLARE_CARD_DATASTRUCTURES -#define DECLARE_CARD_DATASTRUCTURES TRUE -#include "xf86PciInfo.h" -#include "xf86ScanPci.h" +#include "xf86PciData.h" #include "xf86Bus.h" @@ -37,6 +35,14 @@ pciVideoPtr *xf86PciVideoInfo = NULL; /* PCI probe for video hw */ pciAccPtr * xf86PciAccInfo = NULL; /* PCI access related */ +/* pcidata globals */ +ScanPciSetupProcPtr xf86SetupPciIds = NULL; +ScanPciCloseProcPtr xf86ClosePciIds = NULL; +ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice = NULL; +ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys = NULL; +ScanPciFindClassBySubsysProcPtr xf86FindPciClassBySubsys = NULL; +ScanPciFindClassByDeviceProcPtr xf86FindPciClassByDevice = NULL; + static resPtr pciAvoidRes = NULL; /* PCI buses */ @@ -92,9 +98,15 @@ ? pciBusAddrToHostAddr(tag,PCI_MEM_SIZE,size) \ : pciBusAddrToHostAddr(tag,PCI_IO_SIZE,size)) #define PCI_M_RANGE(range,tag,begin,end,type) \ - { RANGE(range,B2M(tag,begin),B2M(tag,end),type); } + { \ + RANGE(range, B2M(tag, begin), B2M(tag, end), \ + RANGE_TYPE(type, xf86GetPciDomain(tag))); \ + } #define PCI_I_RANGE(range,tag,begin,end,type) \ - { RANGE(range,B2I(tag,begin),B2I(tag,end),type); } + { \ + RANGE(range, B2I(tag, begin), B2I(tag, end), \ + RANGE_TYPE(type, xf86GetPciDomain(tag))); \ + } #define PCI_X_RANGE(range,tag,begin,end,type) \ { if ((type & ResPhysMask) == ResMem) PCI_M_RANGE(range,tag,begin,end,type); \ else PCI_I_RANGE(range,tag,begin,end,type); } @@ -112,14 +124,19 @@ #define PV_I_RANGE(range,pvp,i,type) \ P_I_RANGE(range,TAG(pvp),pvp->ioBase[i],pvp->size[i],type) -SymTabPtr xf86PCIVendorNameInfo; -pciVendorCardInfo *xf86PCICardInfo; -pciVendorDeviceInfo * xf86PCIVendorInfo; +static void getPciClassFlags(pciConfigPtr *pcrpp); +static void pciConvertListToHost(int bus, int dev, int func, resPtr list); +static PciBusPtr xf86GetPciBridgeInfo(void); -static void -getPciClassFlags(pciConfigPtr *pcrpp); -static void -pciConvertListToHost(int bus, int dev, int func, resPtr list); +void +xf86FormatPciBusNumber(int busnum, char *buffer) +{ + /* 'buffer' should be at least 8 characters long */ + if (busnum < 256) + sprintf(buffer, "%d", busnum); + else + sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8); +} static Bool IsBaseUnassigned(CARD32 base) @@ -151,7 +168,7 @@ xf86PciVideoInfo = NULL; return; } - xf86PciBus = xf86GetPciBridgeInfo(xf86PciInfo); + xf86PciBus = xf86GetPciBridgeInfo(); while ((pcrp = pcrpp[i])) { int baseclass; @@ -187,6 +204,7 @@ info->biosSize = pciGetBaseSize(pcrp->tag, 6, TRUE, NULL); info->thisCard = pcrp; info->validate = FALSE; +#ifdef INCLUDE_XF86_NO_DOMAIN if ((PCISHAREDIOCLASSES(baseclass, subclass)) && (pcrp->pci_command & PCI_CMD_IO_ENABLE) && (pcrp->pci_prog_if == 0)) { @@ -197,28 +215,30 @@ * grok host bridges (and multiple bus trees). */ j = info->bus; - while (j > 0) { + while (TRUE) { PciBusPtr pBus = xf86PciBus; while (pBus && j != pBus->secondary) pBus = pBus->next; if (!pBus || !(pBus->brcontrol & PCI_PCI_BRIDGE_VGA_EN)) break; - j = pBus->brbus; - } - if (j <= 0) { - if (primaryBus.type == BUS_NONE) { - /* assumption: primary bus is always VGA */ - primaryBus.type = BUS_PCI; - primaryBus.id.pci.bus = pcrp->busnum; - primaryBus.id.pci.device = pcrp->devnum; - primaryBus.id.pci.func = pcrp->funcnum; - } else if (primaryBus.type < BUS_last) { - xf86Msg(X_NOTICE, - "More than one primary device found\n"); - primaryBus.type ^= (BusType)(-1); + if (j == pBus->primary) { + if (primaryBus.type == BUS_NONE) { + /* assumption: primary adapter is always VGA */ + primaryBus.type = BUS_PCI; + primaryBus.id.pci.bus = pcrp->busnum; + primaryBus.id.pci.device = pcrp->devnum; + primaryBus.id.pci.func = pcrp->funcnum; + } else if (primaryBus.type < BUS_last) { + xf86Msg(X_NOTICE, + "More than one primary device found\n"); + primaryBus.type ^= (BusType)(-1); + } + break; } + j = pBus->primary; } } +#endif for (j = 0; j < 6; j++) { info->memBase[j] = 0; @@ -262,7 +282,7 @@ info->memBase[0] = (memType)PCIGETMEMORY(pcrp->pci_base0); if (PCI_MAP_IS64BITMEM(pcrp->pci_base0)) { mem64 = TRUE; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) info->memBase[0] |= (memType)PCIGETMEMORY64HIGH(pcrp->pci_base1) << 32; #else @@ -282,7 +302,7 @@ info->memBase[1] = (memType)PCIGETMEMORY(pcrp->pci_base1); if (PCI_MAP_IS64BITMEM(pcrp->pci_base1)) { mem64 = TRUE; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) info->memBase[1] |= (memType)PCIGETMEMORY64HIGH(pcrp->pci_base2) << 32; #else @@ -303,7 +323,7 @@ info->memBase[2] = (memType)PCIGETMEMORY(pcrp->pci_base2); if (PCI_MAP_IS64BITMEM(pcrp->pci_base2)) { mem64 = TRUE; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) info->memBase[2] |= (memType)PCIGETMEMORY64HIGH(pcrp->pci_base3) << 32; #else @@ -324,7 +344,7 @@ info->memBase[3] = (memType)PCIGETMEMORY(pcrp->pci_base3); if (PCI_MAP_IS64BITMEM(pcrp->pci_base3)) { mem64 = TRUE; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) info->memBase[3] |= (memType)PCIGETMEMORY64HIGH(pcrp->pci_base4) << 32; #else @@ -345,7 +365,7 @@ info->memBase[4] = (memType)PCIGETMEMORY(pcrp->pci_base4); if (PCI_MAP_IS64BITMEM(pcrp->pci_base4)) { mem64 = TRUE; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) info->memBase[4] |= (memType)PCIGETMEMORY64HIGH(pcrp->pci_base5) << 32; #else @@ -374,21 +394,14 @@ /* If we haven't found a primary device try a different heuristic */ if (primaryBus.type == BUS_NONE && num) { - i = 0; - while (i < num) { - k = 0; + for (i = 0; i < num; i++) { info = xf86PciVideoInfo[i]; - while ((pcrp = xf86PciInfo[k++])) { - if ( pcrp->busnum == info->bus - && pcrp->devnum == info->device - && pcrp->funcnum == info->func ) - break; - } + pcrp = info->thisCard; - if (pcrp && (num == 1 - || ( info->class == PCI_CLASS_DISPLAY - && info->subclass == PCI_SUBCLASS_DISPLAY_MISC)) - && pcrp->pci_command & PCI_CMD_MEM_ENABLE) { + if ((pcrp->pci_command & PCI_CMD_MEM_ENABLE) && + (num == 1 || + ((info->class == PCI_CLASS_DISPLAY) && + (info->subclass == PCI_SUBCLASS_DISPLAY_MISC)))) { if (primaryBus.type == BUS_NONE) { primaryBus.type = BUS_PCI; primaryBus.id.pci.bus = pcrp->busnum; @@ -400,86 +413,65 @@ primaryBus.type ^= (BusType)(-1); } } - i++; } } /* Print a summary of the video devices found */ - { - for (k = 0; k < num; k++) { - char *vendorname = NULL, *chipname = NULL; - Bool memdone = FALSE, iodone = FALSE; - - i = 0; - info = xf86PciVideoInfo[k]; - while (xf86PCIVendorNameInfo[i].token) { - if (xf86PCIVendorNameInfo[i].token == info->vendor) - vendorname = (char *)xf86PCIVendorNameInfo[i].name; - i++; - } - i = 0; - while(xf86PCIVendorInfo[i].VendorID) { - if (xf86PCIVendorInfo[i].VendorID == info->vendor) { - j = 0; - while (xf86PCIVendorInfo[i].Device[j].DeviceName) { - if (xf86PCIVendorInfo[i].Device[j].DeviceID == - info->chipType) { - chipname = - xf86PCIVendorInfo[i].Device[j].DeviceName; - break; - } - j++; - } - break; - } - i++; - } - if ((!vendorname || !chipname) && - !PCIALWAYSPRINTCLASSES(info->class, info->subclass)) - continue; - if (xf86IsPrimaryPci(info)) - xf86Msg(X_PROBED, "PCI:*(%d:%d:%d) ", info->bus, info->device, - info->func); - else - xf86Msg(X_PROBED, "PCI: (%d:%d:%d) ", info->bus, info->device, - info->func); - if (vendorname) - xf86ErrorF("%s ", vendorname); - else - xf86ErrorF("unknown vendor (0x%04x) ", info->vendor); - if (chipname) - xf86ErrorF("%s ", chipname); - else - xf86ErrorF("unknown chipset (0x%04x) ", info->chipType); - xf86ErrorF("rev %d", info->chipRev); - for (i = 0; i < 6; i++) { - if (info->memBase[i] && - (info->memBase[i] < (memType)(-1 << info->size[i]))) { - if (!memdone) { - xf86ErrorF(", Mem @ "); - memdone = TRUE; - } else - xf86ErrorF(", "); - xf86ErrorF("0x%08x/%d", info->memBase[i], info->size[i]); - } + for (k = 0; k < num; k++) { + const char *vendorname = NULL, *chipname = NULL; + const char *prim = " "; + char busnum[8]; + Bool memdone = FALSE, iodone = FALSE; + + i = 0; + info = xf86PciVideoInfo[k]; + xf86FormatPciBusNumber(info->bus, busnum); + xf86FindPciNamesByDevice(info->vendor, info->chipType, + NOVENDOR, NOSUBSYS, + &vendorname, &chipname, NULL, NULL); + if ((!vendorname || !chipname) && + !PCIALWAYSPRINTCLASSES(info->class, info->subclass)) + continue; + if (xf86IsPrimaryPci(info)) + prim = "*"; + + xf86Msg(X_PROBED, "PCI:%s(%s:%d:%d) ", prim, busnum, info->device, + info->func); + if (vendorname) + xf86ErrorF("%s ", vendorname); + else + xf86ErrorF("unknown vendor (0x%04x) ", info->vendor); + if (chipname) + xf86ErrorF("%s ", chipname); + else + xf86ErrorF("unknown chipset (0x%04x) ", info->chipType); + xf86ErrorF("rev %d", info->chipRev); + for (i = 0; i < 6; i++) { + if (info->memBase[i] && + (info->memBase[i] < (memType)(-1 << info->size[i]))) { + if (!memdone) { + xf86ErrorF(", Mem @ "); + memdone = TRUE; + } else + xf86ErrorF(", "); + xf86ErrorF("0x%08x/%d", info->memBase[i], info->size[i]); } - for (i = 0; i < 6; i++) { - if (info->ioBase[i] && - (info->ioBase[i] < (memType)(-1 << info->size[i]))) { - if (!iodone) { - xf86ErrorF(", I/O @ "); - iodone = TRUE; - } else - xf86ErrorF(", "); - xf86ErrorF("0x%04x/%d", info->ioBase[i], info->size[i]); - } + } + for (i = 0; i < 6; i++) { + if (info->ioBase[i] && + (info->ioBase[i] < (memType)(-1 << info->size[i]))) { + if (!iodone) { + xf86ErrorF(", I/O @ "); + iodone = TRUE; + } else + xf86ErrorF(", "); + xf86ErrorF("0x%04x/%d", info->ioBase[i], info->size[i]); } - if (info->biosBase && - (info->biosBase < (memType)(-1 << info->biosSize))) - xf86ErrorF(", BIOS @ 0x%08x/%d", - info->biosBase, info->biosSize); - xf86ErrorF("\n"); } + if (info->biosBase && + (info->biosBase < (memType)(-1 << info->biosSize))) + xf86ErrorF(", BIOS @ 0x%08x/%d", info->biosBase, info->biosSize); + xf86ErrorF("\n"); } } @@ -566,6 +558,7 @@ /* * IO enable/disable related routines for PCI */ +#define pArg ((pciArg*)arg) #define SETBITS PCI_CMD_IO_ENABLE static void pciIoAccessEnable(void* arg) @@ -573,9 +566,8 @@ #ifdef DEBUG ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif - ((pciArg*)arg)->ctrl |= SETBITS; - ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, - ((pciArg*)arg)->ctrl); + pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; + (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } static void @@ -584,9 +576,8 @@ #ifdef DEBUG ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif - ((pciArg*)arg)->ctrl &= ~SETBITS; - ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, - ((pciArg*)arg)->ctrl); + pArg->ctrl &= ~SETBITS; + (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } #undef SETBITS @@ -597,9 +588,8 @@ #ifdef DEBUG ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif - ((pciArg*)arg)->ctrl |= SETBITS; - ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, - ((pciArg*)arg)->ctrl); + pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; + (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } static void @@ -608,9 +598,8 @@ #ifdef DEBUG ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif - ((pciArg*)arg)->ctrl &= ~SETBITS; - ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, - ((pciArg*)arg)->ctrl); + pArg->ctrl &= ~SETBITS; + (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } #undef SETBITS @@ -621,9 +610,8 @@ #ifdef DEBUG ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif - ((pciArg*)arg)->ctrl |= SETBITS; - ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, - ((pciArg*)arg)->ctrl); + pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; + (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } static void @@ -632,31 +620,69 @@ #ifdef DEBUG ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif - ((pciArg*)arg)->ctrl &= ~SETBITS; - ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, - ((pciArg*)arg)->ctrl); + pArg->ctrl &= ~SETBITS; + (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } #undef SETBITS +#undef pArg + +/* move to OS layer */ #define PCI_PCI_BRDG_CTRL_BASE (PCI_PCI_BRIDGE_CONTROL_REG & 0xFC) #define SHIFT_BITS ((PCI_PCI_BRIDGE_CONTROL_REG & 0x3) << 3) #define SETBITS (CARD32)((PCI_PCI_BRIDGE_VGA_EN) << SHIFT_BITS) static void pciBusAccessEnable(BusAccPtr ptr) { - ptr->busdep.pci.func(ptr->busdep.pci.acc,PCI_PCI_BRDG_CTRL_BASE, - SETBITS,SETBITS); +#ifdef DEBUG + ErrorF("pciBusAccessEnable: bus=%d\n", ptr->busdep.pci.bus); +#endif + (*ptr->busdep.pci.func)(ptr->busdep.pci.acc, PCI_PCI_BRDG_CTRL_BASE, + SETBITS, SETBITS); } +/* move to OS layer */ static void pciBusAccessDisable(BusAccPtr ptr) { - ptr->busdep.pci.func(ptr->busdep.pci.acc,PCI_PCI_BRDG_CTRL_BASE,SETBITS,0); +#ifdef DEBUG + ErrorF("pciBusAccessDisable: bus=%d\n", ptr->busdep.pci.bus); +#endif + (*ptr->busdep.pci.func)(ptr->busdep.pci.acc, PCI_PCI_BRDG_CTRL_BASE, + SETBITS, 0); } #undef SETBITS #undef SHIFT_BITS +/* move to OS layer */ +static void +pciDrvBusAccessEnable(BusAccPtr ptr) +{ + int bus = ptr->busdep.pci.bus; + +#ifdef DEBUG + ErrorF("pciDrvBusAccessEnable: bus=%d\n", bus); +#endif + (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, + PCI_PCI_BRIDGE_VGA_EN, + PCI_PCI_BRIDGE_VGA_EN); +} + +/* move to OS layer */ static void +pciDrvBusAccessDisable(BusAccPtr ptr) +{ + int bus = ptr->busdep.pci.bus; + +#ifdef DEBUG + ErrorF("pciDrvBusAccessDisable: bus=%d\n", bus); +#endif + (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, + PCI_PCI_BRIDGE_VGA_EN, 0); +} + + +static void pciSetBusAccess(BusAccPtr ptr) { #ifdef DEBUG @@ -667,15 +693,16 @@ return; if (ptr->current && ptr->current->disable_f) - ptr->current->disable_f(ptr->current); + (*ptr->current->disable_f)(ptr->current); ptr->current = NULL; /* walk down */ - while (ptr->primary) { /* no enable for top bus */ - if (ptr->primary->current != ptr) { + while (ptr->primary) { /* No enable for root bus */ + if (ptr != ptr->primary->current) { if (ptr->primary->current && ptr->primary->current->disable_f) - ptr->primary->current->disable_f(ptr->primary->current); - if (ptr->enable_f) ptr->enable_f(ptr); + (*ptr->primary->current->disable_f)(ptr->primary->current); + if (ptr->enable_f) + (*ptr->enable_f)(ptr); ptr->primary->current = ptr; } ptr = ptr->primary; @@ -688,10 +715,10 @@ { int i; - ptr->command = pciReadLong(tag,PCI_CMD_STAT_REG); + ptr->command = pciReadLong(tag, PCI_CMD_STAT_REG); for (i=0; i < 6; i++) - ptr->base[i] = pciReadLong(tag,PCI_CMD_BASE_REG + i*4 ); - ptr->biosBase = pciReadLong(tag,PCI_CMD_BIOS_REG); + ptr->base[i] = pciReadLong(tag, PCI_CMD_BASE_REG + i*4); + ptr->biosBase = pciReadLong(tag, PCI_CMD_BIOS_REG); } /* move to OS layer */ @@ -701,46 +728,59 @@ int i; /* disable card before setting anything */ - pciSetBitsLong(tag, PCI_CMD_STAT_REG, PCI_CMD_MEM_ENABLE - | PCI_CMD_IO_ENABLE , 0); - pciWriteLong(tag,PCI_CMD_BIOS_REG,ptr->biosBase); + pciSetBitsLong(tag, PCI_CMD_STAT_REG, + PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE , 0); + pciWriteLong(tag,PCI_CMD_BIOS_REG, ptr->biosBase); for (i=0; i<6; i++) - pciWriteLong(tag,PCI_CMD_BASE_REG + i*4, ptr->base[i]); - pciWriteLong(tag,PCI_CMD_STAT_REG,ptr->command); + pciWriteLong(tag, PCI_CMD_BASE_REG + i*4, ptr->base[i]); + pciWriteLong(tag, PCI_CMD_STAT_REG, ptr->command); } /* move to OS layer */ static void savePciBusState(BusAccPtr ptr) { - ptr->busdep.pci.save.io = - pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_IO_REG); - ptr->busdep.pci.save.mem = - pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_MEM_REG); - ptr->busdep.pci.save.pmem = - pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_PMEM_REG); ptr->busdep.pci.save.control = - pciReadByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG); + pciReadWord(ptr->busdep.pci.acc, PCI_PCI_BRIDGE_CONTROL_REG); /* Allow master aborts to complete normally on non-root buses */ if (ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG, - ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); + pciWriteWord(ptr->busdep.pci.acc, PCI_PCI_BRIDGE_CONTROL_REG, + ptr->busdep.pci.save.control + & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); } /* move to OS layer */ static void restorePciBusState(BusAccPtr ptr) { - pciWriteWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_IO_REG, - ptr->busdep.pci.save.io); - pciWriteWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_MEM_REG, - ptr->busdep.pci.save.mem); - pciWriteWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_PMEM_REG, - ptr->busdep.pci.save.pmem); - pciWriteByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG, + pciWriteWord(ptr->busdep.pci.acc, PCI_PCI_BRIDGE_CONTROL_REG, ptr->busdep.pci.save.control); } +/* move to OS layer */ +static void +savePciDrvBusState(BusAccPtr ptr) +{ + int bus = ptr->busdep.pci.bus; + + ptr->busdep.pci.save.control = + (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, 0, 0); + /* Allow master aborts to complete normally on this bus */ + (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, + PCI_PCI_BRIDGE_MASTER_ABORT_EN, + 0); +} + +/* move to OS layer */ +static void +restorePciDrvBusState(BusAccPtr ptr) +{ + int bus = ptr->busdep.pci.bus; + + (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, (CARD16)(-1), + ptr->busdep.pci.save.control); +} + static void disablePciBios(PCITAG tag) @@ -750,19 +790,20 @@ /* ????? */ static void -correctPciSize(memType base, int oldsize, int newsize, long type) +correctPciSize(memType base, memType oldsize, memType newsize, + unsigned long type) { pciConfigPtr pcrp, *pcrpp; pciVideoPtr pvp, *pvpp; CARD32 *basep; int i; - int old_bits =0, new_bits = 0; + int old_bits = 0, new_bits = 0; - while (oldsize & 1) { + if (oldsize + 1) while (oldsize & 1) { old_bits ++; oldsize >>= 1; } - while (newsize & 1) { + if (newsize + 1) while (newsize & 1) { new_bits ++; newsize >>= 1; } @@ -775,24 +816,27 @@ basep = &pcrp->pci_base0; for (i = 0; i < 6; i++) { - int j = i; - if (basep[i] && (pcrp->basesize[i] == old_bits)) - if ((((type & ResPhysMask) == ResIo) && PCI_MAP_IS_IO(basep[i]) - && (B2I(pcrp->tag,PCIGETIO(basep[i])) == base)) - || (((type & ResPhysMask) == ResMem) && PCI_MAP_IS_MEM(basep[i]) - && (((!PCI_MAP_IS64BITMEM(basep[i])) - && (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) -#if defined LONG64 || defined WORD64 - || (B2M(pcrp->tag,PCIGETMEMORY64(basep[i])) == base) + if (basep[i] && (pcrp->basesize[i] == old_bits)) { + if ((((type & ResPhysMask) == ResIo) && + PCI_MAP_IS_IO(basep[i]) && + B2I(pcrp->tag,PCIGETIO(basep[i]) == base)) || + (((type & ResPhysMask) == ResMem) && + PCI_MAP_IS_MEM(basep[i]) && + (((!PCI_MAP_IS64BITMEM(basep[i])) && + (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) +#if defined(LONG64) || defined(WORD64) + || + (B2M(pcrp->tag,PCIGETMEMORY64(basep[i])) == base) #endif - ))) { - pcrp->basesize[j] = new_bits; - return; + ))) { + pcrp->basesize[i] = new_bits; + break; /* to next device */ } + } } } - if (xf86PciVideoInfo) + if (xf86PciVideoInfo) { for (pvpp = xf86PciVideoInfo, pvp = *pvpp; pvp; pvp = *(++pvpp)) { for (i = 0; i < 6; i++) { @@ -802,11 +846,12 @@ (((type & ResPhysMask) == ResMem) && pvp->memBase[i] && (B2M(TAG(pvp),pvp->memBase[i]) == base))) { pvp->size[i] = new_bits; - return; + break; /* to next device */ } } } } + } } /* ????? */ @@ -817,7 +862,7 @@ resPtr tmp,bridgeRes = NULL; resRange range = target->val; - if (!ResIsEstimated(&target->val)) + if (!ResCanOverlap(&target->val)) return; for (pbp=xf86PciBus; pbp; pbp = pbp->next) { @@ -833,9 +878,13 @@ RemoveOverlaps(target, bridgeRes, TRUE, TRUE); if (range.rEnd > target->block_end) { - correctPciSize(range.rBegin,range.rEnd - range.rBegin, + correctPciSize(range.rBegin, range.rEnd - range.rBegin, target->block_end - target->block_begin, target->res_type); + xf86MsgVerb(X_INFO, 3, + "PCI %s resource overlap reduced 0x%08x from 0x%08x to 0x%08x\n", + ((target->res_type & ResPhysMask) == ResMem) ? "Memory" : "I/O", + range.rBegin, range.rEnd, target->block_end); } xf86FreeResList(bridgeRes); } @@ -907,10 +956,17 @@ for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { resPtr *res; + CARD8 baseclass, subclass; + + if (pcrp->listed_class & 0x0ffff) { + baseclass = pcrp->listed_class >> 8; + subclass = pcrp->listed_class; + } else { + baseclass = pcrp->pci_base_class; + subclass = pcrp->pci_sub_class; + } - if (PCIINFOCLASSES((pcrp->listed_class & 0xffff) ? - ((pcrp->listed_class >> 8) & 0x0ff) : - pcrp->pci_base_class, pcrp->pci_sub_class)) + if (PCIINFOCLASSES(baseclass, subclass)) continue; /* Only process devices with type 0 headers */ @@ -921,6 +977,15 @@ resMisc = ResEstimated; else resMisc = 0; + + /* + * Allow resources allocated to host bridges to overlap. Perhaps, this + * needs to be specific to AGP-capable chipsets. AGP "memory" + * sometimes gets allocated within the range routed to the AGP bus. + */ + if ((baseclass == PCI_CLASS_BRIDGE) && + (subclass == PCI_SUBCLASS_BRIDGE_HOST)) + resMisc |= ResOverlap; if ((pcrp->pci_command & (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE))) res = activeRes; @@ -938,7 +1003,7 @@ pcrp->basesize[i], ResExcMemBlock | resMisc) else { i++; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]), pcrp->basesize[i-1], ResExcMemBlock | resMisc) #else @@ -985,7 +1050,7 @@ if (*activeRes) { /* Check for overlaps */ for (pRes = *activeRes; pRes; pRes = pRes->next) { - if (ResIsEstimated(&pRes->val)) { + if (ResCanOverlap(&pRes->val)) { range = pRes->val; RemoveOverlaps(pRes, *activeRes, TRUE, TRUE); @@ -993,7 +1058,7 @@ (xf86Info.estimateSizesAggressively > 0)); if (range.rEnd > pRes->block_end) { - correctPciSize(range.rBegin,range.rEnd - range.rBegin, + correctPciSize(range.rBegin, range.rEnd - range.rBegin, pRes->block_end - pRes->block_begin, pRes->res_type); xf86MsgVerb(X_INFO, 3, @@ -1013,7 +1078,7 @@ if (*inactiveRes) { /* Check for overlaps */ for (pRes = *inactiveRes; pRes; pRes = pRes->next) { - if (ResIsEstimated(&pRes->val)) { + if (ResCanOverlap(&pRes->val)) { range = pRes->val; RemoveOverlaps(pRes, *activeRes, TRUE, @@ -1022,7 +1087,7 @@ (xf86Info.estimateSizesAggressively > 1)); if (range.rEnd > pRes->block_end) { - correctPciSize(range.rBegin,range.rEnd - range.rBegin, + correctPciSize(range.rBegin, range.rEnd - range.rBegin, pRes->block_end - pRes->block_begin, pRes->res_type); xf86MsgVerb(X_INFO, 3, @@ -1092,7 +1157,7 @@ resPtr resSize = NULL; resPtr w_tmp, w = NULL, w_2nd = NULL; PCITAG tag; - PciBusPtr pbp = xf86PciBus, pbp1 = xf86PciBus; + PciBusPtr pbp = xf86PciBus; pciConfigPtr pcp; resPtr tmp; @@ -1173,23 +1238,17 @@ if (pbp->io) w = xf86FindIntersectOfLists(pbp->io,ResRange); } - - while (pbp1) { - if (pbp1->primary == pvp->bus) { - if ((type & ResPhysMask) == ResMem) { - tmp = xf86DupResList(pbp1->preferred_pmem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->preferred_mem); - avoid = xf86JoinResLists(avoid,tmp); - } else { - tmp = xf86DupResList(pbp1->preferred_io); - avoid = xf86JoinResLists(avoid,tmp); - } - } - pbp1 = pbp1->next; + } else if (pbp->primary == pvp->bus) { + if ((type & ResPhysMask) == ResMem) { + tmp = xf86DupResList(pbp->preferred_pmem); + avoid = xf86JoinResLists(avoid, tmp); + tmp = xf86DupResList(pbp->preferred_mem); + avoid = xf86JoinResLists(avoid, tmp); + } else { + tmp = xf86DupResList(pbp->preferred_io); + avoid = xf86JoinResLists(avoid, tmp); } - break; - } + } pbp = pbp->next; } @@ -1358,7 +1417,7 @@ pciWriteLong(tag, PCI_CMD_BASE_REG + res_n * sizeof(CARD32), ((CARD32 *)(&(pcp->pci_base0)))[res_n]); if (PCI_MAP_IS64BITMEM(p_type)) { -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1] = (CARD32)(*p_base >> 32); pciWriteLong(tag, PCI_CMD_BASE_REG + (res_n + 1) * sizeof(CARD32), @@ -1448,12 +1507,13 @@ getValidBIOSBase(PCITAG tag, int num) { pciVideoPtr pvp = NULL; - PciBusPtr pbp, pbp1; + PciBusPtr pbp; resPtr m = NULL; - resPtr tmp, avoid; + resPtr tmp, avoid, mem = NULL; resRange range; memType ret; int n = 0; + int i; CARD32 biosSize, alignment; if (!xf86PciVideoInfo) return 0; @@ -1469,228 +1529,106 @@ if (biosSize > 24) biosSize = 24; - switch ((romBaseSource)num) { - case ROM_BASE_PRESET: + switch ((romBaseSource)num) { + case ROM_BASE_PRESET: return 0; /* This should not happen */ - case ROM_BASE_BIOS: + case ROM_BASE_BIOS: /* In some cases the BIOS base register contains the size mask */ if ((memType)(-1 << biosSize) == PCIGETROM(pvp->biosBase)) return 0; + /* Make sure we don't conflict with our own mem resources */ + for (i = 0; i < 6; i++) { + if (!pvp->memBase[i]) + continue; + P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i], + ResExcMemBlock); + mem = xf86AddResToList(mem,&range,-1); + } P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock); ret = pvp->biosBase; break; - case ROM_BASE_MEM0: - case ROM_BASE_MEM1: - case ROM_BASE_MEM2: - case ROM_BASE_MEM3: - case ROM_BASE_MEM4: - case ROM_BASE_MEM5: - if (!pvp->memBase[num] || (pvp->size[n] < biosSize)) + case ROM_BASE_MEM0: + case ROM_BASE_MEM1: + case ROM_BASE_MEM2: + case ROM_BASE_MEM3: + case ROM_BASE_MEM4: + case ROM_BASE_MEM5: + if (!pvp->memBase[num] || (pvp->size[num] < biosSize)) return 0; P_M_RANGE(range, TAG(pvp),pvp->memBase[num],biosSize, ResExcMemBlock); ret = pvp->memBase[num]; break; - case ROM_BASE_FIND: + case ROM_BASE_FIND: ret = 0; break; - default: + default: return 0; /* This should not happen */ - } - - /* Now find the ranges for validation */ - avoid = xf86DupResList(pciAvoidRes); - pbp = pbp1 = xf86PciBus; - while (pbp) { - if (pbp->secondary == pvp->bus) { - if (pbp->preferred_pmem) - tmp = xf86DupResList(pbp->preferred_pmem); - else - tmp = xf86DupResList(pbp->pmem); - m = xf86JoinResLists(m,tmp); - if (pbp->preferred_mem) - tmp = xf86DupResList(pbp->preferred_mem); - else - tmp = xf86DupResList(pbp->mem); - m = xf86JoinResLists(m,tmp); - tmp = m; - while (tmp) { - tmp->block_end = MIN(tmp->block_end,PCI_MEM32_LENGTH_MAX); - tmp = tmp->next; - } - } - while (pbp1) { - if (pbp1->primary == pvp->bus) { - tmp = xf86DupResList(pbp1->preferred_pmem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->pmem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->preferred_mem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->mem); - avoid = xf86JoinResLists(avoid,tmp); - } - pbp1 = pbp1->next; - } - pbp = pbp->next; - } - pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); - - if (!ret) { - /* - * Return a possible window. Note that this doesn't deal with - * host bridges yet. But the fix for that belongs elsewhere. - */ - while (m) { - range = xf86GetBlock(ResExcMemBlock, - PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), - m->block_begin, m->block_end, - PCI_SIZE(ResMem, TAG(pvp), alignment), - avoid); - if (range.type != ResEnd) { - ret = M2B(TAG(pvp), range.rBase); - break; - } - m = m->next; - } - } else { - if (!xf86IsSubsetOf(range, m) || - ChkConflict(&range, avoid, SETUP)) - ret = 0; - } - - xf86FreeResList(avoid); - xf86FreeResList(m); - return ret; -} - -#if 0 -memType -getValidBIOSBase(PCITAG tag, int *num) -{ - pciVideoPtr pvp = NULL; - PciBusPtr pbp, pbp1; - resPtr m = NULL; - resPtr tmp, avoid; - resRange range; - int n = 0; - CARD32 biosSize, alignment; - - if (!xf86PciVideoInfo) return 0; - - while ((pvp = xf86PciVideoInfo[n++])) { - if (pciTag(pvp->bus,pvp->device,pvp->func) == tag) - break; } - if (!pvp) return 0; - biosSize = pvp->biosSize; - alignment = (1 << biosSize) - 1; - if (biosSize > 24) - biosSize = 24; + /* Now find the ranges for validation */ avoid = xf86DupResList(pciAvoidRes); - - pbp = pbp1 = xf86PciBus; + pbp = xf86PciBus; while (pbp) { if (pbp->secondary == pvp->bus) { if (pbp->preferred_pmem) - tmp = xf86DupResList(pbp->preferred_pmem); + tmp = xf86DupResList(pbp->preferred_pmem); else - tmp = xf86DupResList(pbp->pmem); + tmp = xf86DupResList(pbp->pmem); m = xf86JoinResLists(m,tmp); if (pbp->preferred_mem) - tmp = xf86DupResList(pbp->preferred_mem); + tmp = xf86DupResList(pbp->preferred_mem); else - tmp = xf86DupResList(pbp->mem); + tmp = xf86DupResList(pbp->mem); m = xf86JoinResLists(m,tmp); tmp = m; while (tmp) { tmp->block_end = MIN(tmp->block_end,PCI_MEM32_LENGTH_MAX); tmp = tmp->next; } + } else if ((pbp->primary == pvp->bus) && + (pbp->secondary >= 0) && + (pbp->primary != pbp->secondary)) { + tmp = xf86DupResList(pbp->preferred_pmem); + avoid = xf86JoinResLists(avoid, tmp); + tmp = xf86DupResList(pbp->pmem); + avoid = xf86JoinResLists(avoid, tmp); + tmp = xf86DupResList(pbp->preferred_mem); + avoid = xf86JoinResLists(avoid, tmp); + tmp = xf86DupResList(pbp->mem); + avoid = xf86JoinResLists(avoid, tmp); } - while (pbp1) { - if (pbp1->primary == pvp->bus) { - tmp = xf86DupResList(pbp1->preferred_pmem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->pmem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->preferred_mem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->mem); - avoid = xf86JoinResLists(avoid,tmp); - } - pbp1 = pbp1->next; - } pbp = pbp->next; } pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); - - if (pvp->biosBase && - (pvp->biosBase < (memType)(-1 << pvp->biosSize))) { - /* try biosBase first */ - P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock); - if (xf86IsSubsetOf(range,m) && ! ChkConflict(&range,avoid,SETUP)) { - xf86FreeResList(avoid); - xf86FreeResList(m); - return pvp->biosBase; - } - } - - /* Validate alternate base, and, on failure, look for another one */ - if ((*num < 0) || (*num > 5) || - !pvp->memBase[*num] || (pvp->size[*num] < biosSize)) { - *num = -1; - } else { - P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], biosSize, - ResExcMemBlock); - if (!xf86IsSubsetOf(range, m) || ChkConflict(&range, avoid, SETUP)) - *num = -1; - } + if (mem) + pciConvertListToHost(pvp->bus,pvp->device,pvp->func, mem); - if (*num < 0) { - for (n = 0; n <= 5; n++) { - if (pvp->memBase[n] && (pvp->size[n] >= biosSize)) { - /* keep bios size ! */ - P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], - biosSize, ResExcMemBlock); - if (xf86IsSubsetOf(range, m) && - !ChkConflict(&range, avoid, SETUP)) { - *num = n; - break; - } + if (!ret) { + /* Return a possible window */ + while (m) { + range = xf86GetBlock(RANGE_TYPE(ResExcMemBlock, xf86GetPciDomain(tag)), + PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), + m->block_begin, m->block_end, + PCI_SIZE(ResMem, TAG(pvp), alignment), + avoid); + if (range.type != ResEnd) { + ret = M2B(TAG(pvp), range.rBase); + break; } + m = m->next; } - } - - /* - * Return a possible window. Note that this doesn't deal with host bridges - * yet. But the fix for that belongs elsewhere. - */ - while (m) { - range = xf86GetBlock(ResExcMemBlock, - PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), - m->block_begin, m->block_end, - PCI_SIZE(ResMem, TAG(pvp), alignment), avoid); - if (range.type != ResEnd) { - xf86FreeResList(avoid); - xf86FreeResList(m); - return M2B(TAG(pvp), range.rBase); - } - m = m->next; + } else { + if (!xf86IsSubsetOf(range, m) || + ChkConflict(&range, avoid, SETUP) + || (mem && ChkConflict(&range, mem, SETUP))) + ret = 0; } xf86FreeResList(avoid); xf86FreeResList(m); - - if (*num >= 0) { - /* then try suggested memBase */ - return pvp->memBase[*num]; - } - - return 0; + return ret; } -#endif /* * xf86Bus.c interface @@ -1699,21 +1637,32 @@ void xf86PciProbe(void) { - typedef void DataSetupFuncType(SymTabPtr *, pciVendorDeviceInfo **, - pciVendorCardInfo **); - DataSetupFuncType *DataSetupFunc; -#ifdef XFree86LOADER - /* - * we need to get the pointer to the pci data structures initialized + /* + * Initialise the pcidata entry points. */ - - DataSetupFunc = (DataSetupFuncType *)LoaderSymbol("xf86SetupPciData"); +#ifdef XFree86LOADER + xf86SetupPciIds = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds"); + xf86ClosePciIds = (ScanPciCloseProcPtr)LoaderSymbol("ScanPciClosePciIds"); + xf86FindPciNamesByDevice = + (ScanPciFindByDeviceProcPtr)LoaderSymbol("ScanPciFindPciNamesByDevice"); + xf86FindPciNamesBySubsys = + (ScanPciFindBySubsysProcPtr)LoaderSymbol("ScanPciFindPciNamesBySubsys"); + xf86FindPciClassBySubsys = + (ScanPciFindClassBySubsysProcPtr)LoaderSymbol("ScanPciFindPciClassBySubsys"); + xf86FindPciClassByDevice = + (ScanPciFindClassByDeviceProcPtr)LoaderSymbol("ScanPciFindPciClassByDevice"); #else - DataSetupFunc = xf86SetupScanPci; + xf86SetupPciIds = ScanPciSetupPciIds; + xf86ClosePciIds = ScanPciClosePciIds; + xf86FindPciNamesByDevice = ScanPciFindPciNamesByDevice; + xf86FindPciNamesBySubsys = ScanPciFindPciNamesBySubsys; + xf86FindPciClassBySubsys = ScanPciFindPciClassBySubsys; + xf86FindPciClassByDevice = ScanPciFindPciClassByDevice; #endif + + if (!xf86SetupPciIds()) + FatalError("xf86SetupPciIds() failed\n"); - (*DataSetupFunc)(&xf86PCIVendorNameInfo, &xf86PCIVendorInfo, & - xf86PCICardInfo); FindPCIVideoInfo(); } @@ -1722,116 +1671,136 @@ static void printBridgeInfo(PciBusPtr PciBus) { - xf86MsgVerb(X_INFO, 3, "Bus %d: bridge is at (%d:%d:%d), " - "(%d,%d,%d), BCTRL: 0x%02x (VGA_EN is %s)\n", - PciBus->secondary,PciBus->brbus, PciBus->brdev, - PciBus->brfunc, PciBus->primary, - PciBus->secondary, PciBus->subordinate, - PciBus->brcontrol, - (PciBus->brcontrol & PCI_PCI_BRIDGE_VGA_EN) - ? "set" : "cleared"); - xf86MsgVerb(X_INFO, 3, "Bus %d I/O range:\n", - PciBus->secondary); - xf86PrintResList(3, PciBus->preferred_io); - xf86MsgVerb(X_INFO, 3, - "Bus %d non-prefetchable memory range:\n", - PciBus->secondary); - xf86PrintResList(3, PciBus->preferred_mem); - xf86MsgVerb(X_INFO, 3, "Bus %d prefetchable memory range:" - "\n",PciBus->secondary); - xf86PrintResList(3, PciBus->preferred_pmem); -} - -/* - * This Sun PCI-->PCI bridge must be handled specially since it does - * not report the decoded I/O and MEM ranges in the usual way. - */ -#define APB_IO_ADDRESS_MAP 0xde -#define APB_MEM_ADDRESS_MAP 0xdf - -static void -get_sun_apb_ranges(PciBusPtr PciBus, pciConfigPtr pcrp) -{ - unsigned char iomap, memmap; - resRange range; - int i; - - iomap = pciReadByte(pcrp->tag, APB_IO_ADDRESS_MAP); - memmap = pciReadByte(pcrp->tag, APB_MEM_ADDRESS_MAP); + char primary[8], secondary[8], subordinate[8], brbus[8]; - if (pcrp->pci_command & PCI_CMD_IO_ENABLE) { - for (i = 0; i < 8; i++) { - if ((iomap & (1 << i)) != 0) { - PCI_I_RANGE(range, pcrp->tag, - (i << 21), (i << 21) + ((1 << 21) - 1), - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = xf86AddResToList(PciBus->preferred_io, &range, -1); - } - } + xf86FormatPciBusNumber(PciBus->primary, primary); + xf86FormatPciBusNumber(PciBus->secondary, secondary); + xf86FormatPciBusNumber(PciBus->subordinate, subordinate); + xf86FormatPciBusNumber(PciBus->brbus, brbus); + + xf86MsgVerb(X_INFO, 3, "Bus %s: bridge is at (%s:%d:%d), (%s,%s,%s)," + " BCTRL: 0x%04x (VGA_EN is %s)\n", + secondary, brbus, PciBus->brdev, PciBus->brfunc, + primary, secondary, subordinate, PciBus->brcontrol, + (PciBus->brcontrol & PCI_PCI_BRIDGE_VGA_EN) ? + "set" : "cleared"); + if (PciBus->preferred_io) { + xf86MsgVerb(X_INFO, 3, + "Bus %s I/O range:\n", secondary); + xf86PrintResList(3, PciBus->preferred_io); } - - if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { - for (i = 0; i < 8; i++) { - if ((memmap & (1 << i)) != 0) { - PCI_M_RANGE(range, pcrp->tag, - (i << 29), (i << 29) + ((1 << 29) - 1), - ResMem | ResBlock | ResExclusive); - PciBus->preferred_mem = xf86AddResToList(PciBus->preferred_mem, &range, -1); - } - } + if (PciBus->preferred_mem) { + xf86MsgVerb(X_INFO, 3, + "Bus %s non-prefetchable memory range:\n", secondary); + xf86PrintResList(3, PciBus->preferred_mem); + } + if (PciBus->preferred_pmem) { + xf86MsgVerb(X_INFO, 3, + "Bus %s prefetchable memory range:\n", secondary); + xf86PrintResList(3, PciBus->preferred_pmem); } } -PciBusPtr -xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo) +static PciBusPtr +xf86GetPciBridgeInfo(void) { const pciConfigPtr *pcrpp; pciConfigPtr pcrp; + pciBusInfo_t *pBusInfo; resRange range; PciBusPtr PciBus, PciBusBase = NULL; PciBusPtr *pnPciBus = &PciBusBase; int MaxBus = 0; - int i; + int i, domain; + int primary, secondary, subordinate; memType base, limit; resPtr pciBusAccWindows = xf86PciBusAccWindowsFromOS(); - if (pciInfo == NULL) return NULL; - - /* Add each PCI-PCI bridge */ - for (pcrpp = pciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) { + if (xf86PciInfo == NULL) + return NULL; + + /* Add each bridge */ + for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) { if (pcrp->busnum > MaxBus) MaxBus = pcrp->busnum; - if ((pcrp->pci_base_class == PCI_CLASS_BRIDGE) - || (((pcrp->listed_class >> 8) & 0xff) == PCI_CLASS_BRIDGE)) { - int sub_class; - sub_class = (pcrp->listed_class & 0xffff) - ? (pcrp->listed_class & 0xff) : pcrp->pci_sub_class; + if ((pcrp->pci_base_class == PCI_CLASS_BRIDGE) || + (((pcrp->listed_class >> 8) & 0xff) == PCI_CLASS_BRIDGE)) { + int sub_class; + sub_class = (pcrp->listed_class & 0xffff) ? + (pcrp->listed_class & 0xff) : pcrp->pci_sub_class; + domain = xf86GetPciDomain(pcrp->tag); + switch (sub_class) { case PCI_SUBCLASS_BRIDGE_PCI: /* something fishy about the header? If so: just ignore! */ if ((pcrp->pci_header_type & 0x7f) != 0x01) { - xf86MsgVerb(3,X_WARNING,"PCI-PCI bridge at %x:%x:%x has " - "funny header: 0x%x",pcrp->busnum,pcrp->devnum, - pcrp->funcnum,pcrp->pci_header_type); + xf86MsgVerb(X_WARNING, 3, "PCI-PCI bridge at %x:%x:%x has" + " unexpected header: 0x%x", + pcrp->busnum, pcrp->devnum, + pcrp->funcnum, pcrp->pci_header_type); + break; + } + + domain = pcrp->busnum & 0x0000FF00; + primary = pcrp->busnum; + secondary = domain | pcrp->pci_secondary_bus_number; + subordinate = domain | pcrp->pci_subordinate_bus_number; + + /* Is this the correct bridge? If not, ignore it */ + pBusInfo = pcrp->businfo; + if (pBusInfo && (pcrp != pBusInfo->bridge)) { + xf86MsgVerb(X_WARNING, 3, "PCI bridge mismatch for bus %x:" + " %x:%x:%x and %x:%x:%x\n", secondary, + pcrp->busnum, pcrp->devnum, pcrp->funcnum, + pBusInfo->bridge->busnum, + pBusInfo->bridge->devnum, + pBusInfo->bridge->funcnum); break; } + + if (pBusInfo && pBusInfo->funcs->pciGetBridgeBusses) + (*pBusInfo->funcs->pciGetBridgeBusses)(secondary, + &primary, + &secondary, + &subordinate); + + if (!pcrp->fakeDevice && (primary >= secondary)) { + xf86MsgVerb(X_WARNING, 3, "Misconfigured PCI bridge" + " %x:%x:%x (%x,%x)\n", + pcrp->busnum, pcrp->devnum, pcrp->funcnum, + primary, secondary); + break; + } + *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); pnPciBus = &PciBus->next; - PciBus->secondary = pcrp->pci_secondary_bus_number; - PciBus->primary = pcrp->pci_primary_bus_number; - PciBus->subordinate = pcrp->pci_subordinate_bus_number; + + PciBus->primary = primary; + PciBus->secondary = secondary; + PciBus->subordinate = subordinate; + PciBus->brbus = pcrp->busnum; PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; + PciBus->subclass = sub_class; PciBus->interface = pcrp->pci_prog_if; - PciBus->brcontrol = pcrp->pci_bridge_control; - if (pcrp->pci_vendor == PCI_VENDOR_SUN && - pcrp->pci_device == 0x5000) { - get_sun_apb_ranges(PciBus, pcrp); - break; + + if (pBusInfo && pBusInfo->funcs->pciControlBridge) + PciBus->brcontrol = + (*pBusInfo->funcs->pciControlBridge)(secondary, 0, 0); + else + PciBus->brcontrol = pcrp->pci_bridge_control; + + if (pBusInfo && pBusInfo->funcs->pciGetBridgeResources) { + (*pBusInfo->funcs->pciGetBridgeResources)(secondary, + (pointer *)&PciBus->preferred_io, + (pointer *)&PciBus->preferred_mem, + (pointer *)&PciBus->preferred_pmem); + break; } + if ((pcrp->pci_command & PCI_CMD_IO_ENABLE) && (pcrp->pci_upper_io_base || pcrp->pci_io_base || pcrp->pci_upper_io_limit || pcrp->pci_io_limit)) { @@ -1848,16 +1817,17 @@ PCI_I_RANGE(range, pcrp->tag, base, base + (CARD8)(-1), ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = xf86AddResToList( - PciBus->preferred_io,&range, -1); + PciBus->preferred_io = + xf86AddResToList(PciBus->preferred_io, + &range, -1); base += 0x0400; } } if (base <= limit) { PCI_I_RANGE(range, pcrp->tag, base, limit, ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = xf86AddResToList( - PciBus->preferred_io, &range, -1); + PciBus->preferred_io = + xf86AddResToList(PciBus->preferred_io, &range, -1); } } if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { @@ -1874,8 +1844,8 @@ PCI_M_RANGE(range, pcrp->tag, base << 16, (limit << 16) | 0x0fffff, ResMem | ResBlock | ResExclusive); - PciBus->preferred_mem - = xf86AddResToList(NULL, &range, -1); + PciBus->preferred_mem = + xf86AddResToList(PciBus->preferred_mem, &range, -1); } } @@ -1893,42 +1863,269 @@ PCI_M_RANGE(range, pcrp->tag, base << 16, (limit << 16) | 0xfffff, ResMem | ResBlock | ResExclusive); - PciBus->preferred_pmem - = xf86AddResToList(NULL, &range, -1); + PciBus->preferred_pmem = + xf86AddResToList(PciBus->preferred_pmem, + &range, -1); } } } break; + + case PCI_SUBCLASS_BRIDGE_CARDBUS: + /* something fishy about the header? If so: just ignore! */ + if ((pcrp->pci_header_type & 0x7f) != 0x02) { + xf86MsgVerb(X_WARNING, 3, "PCI-CardBus bridge at %x:%x:%x" + " has unexpected header: 0x%x", + pcrp->busnum, pcrp->devnum, + pcrp->funcnum, pcrp->pci_header_type); + break; + } + + domain = pcrp->busnum & 0x0000FF00; + primary = pcrp->busnum; + secondary = domain | pcrp->pci_cb_cardbus_bus_number; + subordinate = domain | pcrp->pci_subordinate_bus_number; + + /* Is this the correct bridge? If not, ignore it */ + pBusInfo = pcrp->businfo; + if (pBusInfo && (pcrp != pBusInfo->bridge)) { + xf86MsgVerb(X_WARNING, 3, "CardBus bridge mismatch for bus" + " %x: %x:%x:%x and %x:%x:%x\n", secondary, + pcrp->busnum, pcrp->devnum, pcrp->funcnum, + pBusInfo->bridge->busnum, + pBusInfo->bridge->devnum, + pBusInfo->bridge->funcnum); + break; + } + + if (pBusInfo && pBusInfo->funcs->pciGetBridgeBusses) + (*pBusInfo->funcs->pciGetBridgeBusses)(secondary, + &primary, + &secondary, + &subordinate); + + if (primary >= secondary) { + if (pcrp->pci_cb_cardbus_bus_number != 0) + xf86MsgVerb(X_WARNING, 3, "Misconfigured CardBus" + " bridge %x:%x:%x (%x,%x)\n", + pcrp->busnum, pcrp->devnum, pcrp->funcnum, + primary, secondary); + break; + } + + *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); + pnPciBus = &PciBus->next; + + PciBus->primary = primary; + PciBus->secondary = secondary; + PciBus->subordinate = subordinate; + + PciBus->brbus = pcrp->busnum; + PciBus->brdev = pcrp->devnum; + PciBus->brfunc = pcrp->funcnum; + + PciBus->subclass = sub_class; + PciBus->interface = pcrp->pci_prog_if; + + if (pBusInfo && pBusInfo->funcs->pciControlBridge) + PciBus->brcontrol = + (*pBusInfo->funcs->pciControlBridge)(secondary, 0, 0); + else + PciBus->brcontrol = pcrp->pci_bridge_control; + + if (pBusInfo && pBusInfo->funcs->pciGetBridgeResources) { + (*pBusInfo->funcs->pciGetBridgeResources)(secondary, + (pointer *)&PciBus->preferred_io, + (pointer *)&PciBus->preferred_mem, + (pointer *)&PciBus->preferred_pmem); + break; + } + + if (pcrp->pci_command & PCI_CMD_IO_ENABLE) { + if (pcrp->pci_cb_iobase0) { + base = PCI_CB_IOBASE(pcrp->pci_cb_iobase0); + limit = PCI_CB_IOLIMIT(pcrp->pci_cb_iolimit0); + + /* + * Deal with bridge ISA mode (256-wide ranges spaced 1K + * apart (start to start), but only in the first 64K). + */ + if (pcrp->pci_bridge_control & PCI_PCI_BRIDGE_ISA_EN) { + while ((base <= (CARD16)(-1)) && + (base <= limit)) { + PCI_I_RANGE(range, pcrp->tag, + base, base + (CARD8)(-1), + ResIo | ResBlock | ResExclusive); + PciBus->preferred_io = + xf86AddResToList(PciBus->preferred_io, + &range, -1); + base += 0x0400; + } + } + + if (base <= limit) { + PCI_I_RANGE(range, pcrp->tag, base, limit, + ResIo | ResBlock | ResExclusive); + PciBus->preferred_io = + xf86AddResToList(PciBus->preferred_io, + &range, -1); + } + } + + if (pcrp->pci_cb_iobase1) { + base = PCI_CB_IOBASE(pcrp->pci_cb_iobase1); + limit = PCI_CB_IOLIMIT(pcrp->pci_cb_iolimit1); + + /* + * Deal with bridge ISA mode (256-wide ranges spaced 1K + * apart (start to start), but only in the first 64K). + */ + if (pcrp->pci_bridge_control & PCI_PCI_BRIDGE_ISA_EN) { + while ((base <= (CARD16)(-1)) && + (base <= limit)) { + PCI_I_RANGE(range, pcrp->tag, + base, base + (CARD8)(-1), + ResIo | ResBlock | ResExclusive); + PciBus->preferred_io = + xf86AddResToList(PciBus->preferred_io, + &range, -1); + base += 0x0400; + } + } + + if (base <= limit) { + PCI_I_RANGE(range, pcrp->tag, base, limit, + ResIo | ResBlock | ResExclusive); + PciBus->preferred_io = + xf86AddResToList(PciBus->preferred_io, + &range, -1); + } + } + } + + if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { + if ((pcrp->pci_cb_membase0) && + (pcrp->pci_cb_membase0 <= pcrp->pci_cb_memlimit0)) { + PCI_M_RANGE(range, pcrp->tag, + pcrp->pci_cb_membase0 & ~0x0fff, + pcrp->pci_cb_memlimit0 | 0x0fff, + ResMem | ResBlock | ResExclusive); + if (pcrp->pci_bridge_control & + PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) + PciBus->preferred_pmem = + xf86AddResToList(PciBus->preferred_pmem, + &range, -1); + else + PciBus->preferred_mem = + xf86AddResToList(PciBus->preferred_mem, + &range, -1); + } + if ((pcrp->pci_cb_membase1) && + (pcrp->pci_cb_membase1 <= pcrp->pci_cb_memlimit1)) { + PCI_M_RANGE(range, pcrp->tag, + pcrp->pci_cb_membase1 & ~0x0fff, + pcrp->pci_cb_memlimit1 | 0x0fff, + ResMem | ResBlock | ResExclusive); + if (pcrp->pci_bridge_control & + PCI_CB_BRIDGE_CTL_PREFETCH_MEM1) + PciBus->preferred_pmem = + xf86AddResToList(PciBus->preferred_pmem, + &range, -1); + else + PciBus->preferred_mem = + xf86AddResToList(PciBus->preferred_mem, + &range, -1); + } + } + + break; + case PCI_SUBCLASS_BRIDGE_ISA: + case PCI_SUBCLASS_BRIDGE_EISA: + case PCI_SUBCLASS_BRIDGE_MC: *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); pnPciBus = &PciBus->next; - PciBus->primary = 0; - PciBus->secondary = -1; + PciBus->primary = pcrp->busnum; + PciBus->secondary = PciBus->subordinate = -1; PciBus->brbus = pcrp->busnum; PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; PciBus->subclass = sub_class; PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; - xf86MsgVerb(X_INFO,3,"PCI-to-ISA bridge:\n"); break; + case PCI_SUBCLASS_BRIDGE_HOST: + /* Is this the correct bridge? If not, ignore bus info */ + pBusInfo = pcrp->businfo; + if (pBusInfo == HOST_NO_BUS) + break; + + secondary = 0; + if (pBusInfo) { + /* Find "secondary" bus segment */ + while (pBusInfo != pciBusInfo[secondary]) + secondary++; + if (pcrp != pBusInfo->bridge) { + xf86MsgVerb(X_WARNING, 3, "Host bridge mismatch for" + " bus %x: %x:%x:%x and %x:%x:%x\n", + pBusInfo->primary_bus, + pcrp->busnum, pcrp->devnum, pcrp->funcnum, + pBusInfo->bridge->busnum, + pBusInfo->bridge->devnum, + pBusInfo->bridge->funcnum); + pBusInfo = NULL; + } + } + *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); pnPciBus = &PciBus->next; + PciBus->primary = -1; PciBus->secondary = -1; /* to be set below */ + PciBus->subordinate = pciNumBuses - 1; + + if (pBusInfo) { + PciBus->primary = PciBus->secondary = secondary; + if (pBusInfo->funcs->pciGetBridgeBusses) + (*pBusInfo->funcs->pciGetBridgeBusses) + (secondary, + &PciBus->primary, + &PciBus->secondary, + &PciBus->subordinate); + } + PciBus->brbus = pcrp->busnum; PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; + PciBus->subclass = sub_class; - PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; - PciBus->preferred_io = xf86ExtractTypeFromList( - pciBusAccWindows,ResIo); - PciBus->preferred_mem = xf86ExtractTypeFromList( - pciBusAccWindows,ResMem); - PciBus->preferred_pmem = xf86ExtractTypeFromList( - pciBusAccWindows,ResMem); - xf86MsgVerb(X_INFO,3,"Host-to-PCI bridge:\n"); + + if (pBusInfo && pBusInfo->funcs->pciControlBridge) + PciBus->brcontrol = + (*pBusInfo->funcs->pciControlBridge)(secondary, 0, 0); + else + PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; + + if (pBusInfo && pBusInfo->funcs->pciGetBridgeResources) { + (*pBusInfo->funcs->pciGetBridgeResources) + (secondary, + (pointer *)&PciBus->preferred_io, + (pointer *)&PciBus->preferred_mem, + (pointer *)&PciBus->preferred_pmem); + break; + } + + PciBus->preferred_io = + xf86ExtractTypeFromList(pciBusAccWindows, + RANGE_TYPE(ResIo, domain)); + PciBus->preferred_mem = + xf86ExtractTypeFromList(pciBusAccWindows, + RANGE_TYPE(ResMem, domain)); + PciBus->preferred_pmem = + xf86ExtractTypeFromList(pciBusAccWindows, + RANGE_TYPE(ResMem, domain)); break; + default: break; } @@ -1954,53 +2151,72 @@ minTag = tag; PciBusFound = PciBus; } - if (PciBusFound) + if (PciBusFound) PciBusFound->secondary = i; else { /* if nothing found it may not be visible: create new */ + /* Find a device on this bus */ + domain = 0; + for (pcrpp = xf86PciInfo; (pcrp = *pcrpp); pcrpp++) { + if (pcrp->busnum == i) { + domain = xf86GetPciDomain(pcrp->tag); + break; + } + } *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); pnPciBus = &PciBus->next; PciBus->primary = -1; PciBus->secondary = i; PciBus->subclass = PCI_SUBCLASS_BRIDGE_HOST; - PciBus->preferred_io = xf86ExtractTypeFromList( - pciBusAccWindows,ResIo); - PciBus->preferred_mem = xf86ExtractTypeFromList( - pciBusAccWindows,ResMem); - PciBus->preferred_pmem = xf86ExtractTypeFromList( - pciBusAccWindows,ResMem); - xf86MsgVerb(X_INFO,3,"Host-to-PCI bridge:\n"); + PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; + PciBus->preferred_io = + xf86ExtractTypeFromList(pciBusAccWindows, + RANGE_TYPE(ResIo, domain)); + PciBus->preferred_mem = + xf86ExtractTypeFromList(pciBusAccWindows, + RANGE_TYPE(ResMem, domain)); + PciBus->preferred_pmem = + xf86ExtractTypeFromList(pciBusAccWindows, + RANGE_TYPE(ResMem, domain)); } } } - + for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) { - if (PciBus->subclass == PCI_SUBCLASS_BRIDGE_HOST) { + if (PciBus->primary == PciBus->secondary) { alignBridgeRanges(PciBusBase, PciBus); } } + for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) { - if (PciBus->subclass == PCI_SUBCLASS_BRIDGE_PCI && - PciBus->interface == PCI_IF_BRIDGE_PCI_SUBTRACTIVE) { - PciBusPtr PciBus1; - for (PciBus1 = PciBusBase; PciBus1; PciBus1 = PciBus1->next) { - if (PciBus1->secondary == PciBus->primary) { - PciBus->io = PciBus1->io ? PciBus1->io - : PciBus1->preferred_io; - PciBus->mem = PciBus1->mem ? PciBus1->mem - : PciBus1->preferred_mem; - PciBus->pmem = PciBus1->pmem ? PciBus1->pmem - : PciBus1->preferred_pmem; - xf86MsgVerb(X_INFO,3,"Subtractive PCI-to-PCI bridge:\n"); - break; - } - } + switch (PciBus->subclass) { + case PCI_SUBCLASS_BRIDGE_PCI: + if (PciBus->interface == PCI_IF_BRIDGE_PCI_SUBTRACTIVE) + xf86MsgVerb(X_INFO, 3, "Subtractive PCI-to-PCI bridge:\n"); + else + xf86MsgVerb(X_INFO, 3, "PCI-to-PCI bridge:\n"); + break; + case PCI_SUBCLASS_BRIDGE_CARDBUS: + xf86MsgVerb(X_INFO, 3, "PCI-to-CardBus bridge:\n"); + break; + case PCI_SUBCLASS_BRIDGE_HOST: + xf86MsgVerb(X_INFO, 3, "Host-to-PCI bridge:\n"); + break; + case PCI_SUBCLASS_BRIDGE_ISA: + xf86MsgVerb(X_INFO, 3, "PCI-to-ISA bridge:\n"); + break; + case PCI_SUBCLASS_BRIDGE_EISA: + xf86MsgVerb(X_INFO, 3, "PCI-to-EISA bridge:\n"); + break; + case PCI_SUBCLASS_BRIDGE_MC: + xf86MsgVerb(X_INFO, 3, "PCI-to-MCA bridge:\n"); + break; + default: + break; } printBridgeInfo(PciBus); } - xf86FreeResList(pciBusAccWindows); return PciBusBase; - } static void @@ -2009,23 +2225,44 @@ PciBusPtr PciBus; for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) { - if ((PciBus->primary == primary->secondary) - && (PciBus->subclass == PCI_SUBCLASS_BRIDGE_PCI)) { + if ((PciBus != primary) && (PciBus->primary != -1) + && (PciBus->primary == primary->secondary)) { resPtr tmp; tmp = xf86FindIntersectOfLists(primary->preferred_io, PciBus->preferred_io); - xf86FreeResList(PciBus->preferred_io); - PciBus->preferred_io = tmp; - tmp = xf86FindIntersectOfLists(primary->preferred_pmem, - PciBus->preferred_pmem); - xf86FreeResList(PciBus->preferred_pmem); - PciBus->preferred_pmem = tmp; - tmp = xf86FindIntersectOfLists(primary->preferred_mem, - PciBus->preferred_mem); - xf86FreeResList(PciBus->preferred_mem); - PciBus->preferred_mem = tmp; - xf86MsgVerb(X_INFO,3,"PCI-to-PCI bridge:\n"); - alignBridgeRanges(PciBusBase, PciBus); + xf86FreeResList(PciBus->preferred_io); + PciBus->preferred_io = tmp; + tmp = xf86FindIntersectOfLists(primary->preferred_pmem, + PciBus->preferred_pmem); + xf86FreeResList(PciBus->preferred_pmem); + PciBus->preferred_pmem = tmp; + tmp = xf86FindIntersectOfLists(primary->preferred_mem, + PciBus->preferred_mem); + xf86FreeResList(PciBus->preferred_mem); + PciBus->preferred_mem = tmp; + + /* Deal with subtractive decoding */ + switch (PciBus->subclass) { + case PCI_SUBCLASS_BRIDGE_PCI: + if (PciBus->interface != PCI_IF_BRIDGE_PCI_SUBTRACTIVE) + break; + /* Fall through */ +#if 0 /* Not yet */ + case PCI_SUBCLASS_BRIDGE_ISA: + case PCI_SUBCLASS_BRIDGE_EISA: + case PCI_SUBCLASS_BRIDGE_MC: +#endif + if (!(PciBus->io = primary->io)) + PciBus->io = primary->preferred_io; + if (!(PciBus->mem = primary->mem)) + PciBus->mem = primary->preferred_mem; + if (!(PciBus->pmem = primary->pmem)) + PciBus->pmem = primary->preferred_pmem; + default: + break; + } + + alignBridgeRanges(PciBusBase, PciBus); } } } @@ -2034,7 +2271,7 @@ ValidatePci(void) { pciVideoPtr pvp, pvp1; - PciBusPtr pbp, pbp1; + PciBusPtr pbp; pciConfigPtr pcrp, *pcrpp; CARD32 *basep; resPtr Sys; @@ -2113,7 +2350,7 @@ pcrp->basesize[i], ResExcMemBlock) } else { i++; -#if defined LONG64 || defined WORD64 +#if defined(LONG64) || defined(WORD64) if (!(pcrp->pci_command & PCI_CMD_MEM_ENABLE)) continue; P_M_RANGE(range, pcrp->tag, PCIGETMEMORY64(basep[i-1]), @@ -2170,44 +2407,42 @@ xf86MsgVerb(X_INFO, 3,"NonSys:\n"); xf86PrintResList(3,NonSys); #endif - pbp = pbp1 = xf86PciBus; + pbp = xf86PciBus; while (pbp) { if (pbp->secondary == pvp->bus) { if (pbp->preferred_pmem) { /* keep prefetchable separate */ - res_mp = xf86FindIntersectOfLists(pbp->preferred_pmem, - ResRange); + res_mp = + xf86FindIntersectOfLists(pbp->preferred_pmem, ResRange); } if (pbp->pmem) { res_mp = xf86FindIntersectOfLists(pbp->pmem, ResRange); } if (pbp->preferred_mem) { - res_m_io = xf86FindIntersectOfLists(pbp->preferred_mem, - ResRange); + res_m_io = + xf86FindIntersectOfLists(pbp->preferred_mem, ResRange); } if (pbp->mem) { res_m_io = xf86FindIntersectOfLists(pbp->mem, ResRange); } if (pbp->preferred_io) { res_m_io = xf86JoinResLists(res_m_io, - xf86FindIntersectOfLists(pbp->preferred_io,ResRange)); + xf86FindIntersectOfLists(pbp->preferred_io, ResRange)); } if (pbp->io) { res_m_io = xf86JoinResLists(res_m_io, - xf86FindIntersectOfLists(pbp->preferred_io,ResRange)); + xf86FindIntersectOfLists(pbp->preferred_io, ResRange)); } + } else if ((pbp->primary == pvp->bus) && + (pbp->secondary >= 0) && + (pbp->primary != pbp->secondary)) { + tmp = xf86DupResList(pbp->preferred_pmem); + avoid = xf86JoinResLists(avoid, tmp); + tmp = xf86DupResList(pbp->preferred_mem); + avoid = xf86JoinResLists(avoid, tmp); + tmp = xf86DupResList(pbp->preferred_io); + avoid = xf86JoinResLists(avoid, tmp); } - while (pbp1) { - if (pbp1->primary == pvp->bus) { - tmp = xf86DupResList(pbp1->preferred_pmem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->preferred_mem); - avoid = xf86JoinResLists(avoid,tmp); - tmp = xf86DupResList(pbp1->preferred_io); - avoid = xf86JoinResLists(avoid,tmp); - } - pbp1 = pbp1->next; - } pbp = pbp->next; } if (res_m_io == NULL) @@ -2406,6 +2641,7 @@ { BusAccPtr pbap, pbap_tmp; PciBusPtr pbp = xf86PciBus; + pciBusInfo_t *pBusInfo; while (pbp) { pbap = xnfcalloc(1,sizeof(BusAccRec)); @@ -2413,18 +2649,24 @@ pbap->busdep.pci.primary_bus = pbp->primary; pbap->busdep_type = BUS_PCI; pbap->busdep.pci.acc = PCITAG_SPECIAL; - switch (pbp->subclass) { + + if ((pbp->secondary >= 0) && (pbp->secondary < pciNumBuses) && + (pBusInfo = pciBusInfo[pbp->secondary]) && + pBusInfo->funcs->pciControlBridge) { + pbap->type = BUS_PCI; + pbap->save_f = savePciDrvBusState; + pbap->restore_f = restorePciDrvBusState; + pbap->set_f = pciSetBusAccess; + pbap->enable_f = pciDrvBusAccessEnable; + pbap->disable_f = pciDrvBusAccessDisable; + savePciDrvBusState(pbap); + } else switch (pbp->subclass) { case PCI_SUBCLASS_BRIDGE_HOST: -#ifdef DEBUG - ErrorF("setting up HOST: %i\n",pbap->busdep.pci.bus); -#endif pbap->type = BUS_PCI; pbap->set_f = pciSetBusAccess; break; case PCI_SUBCLASS_BRIDGE_PCI: -#ifdef DEBUG - ErrorF("setting up PCI: %i\n",pbap->busdep.pci.bus); -#endif + case PCI_SUBCLASS_BRIDGE_CARDBUS: pbap->type = BUS_PCI; pbap->save_f = savePciBusState; pbap->restore_f = restorePciBusState; @@ -2437,9 +2679,8 @@ savePciBusState(pbap); break; case PCI_SUBCLASS_BRIDGE_ISA: -#ifdef DEBUG - ErrorF("setting up ISA: %i\n",pbap->busdep.pci.bus); -#endif + case PCI_SUBCLASS_BRIDGE_EISA: + case PCI_SUBCLASS_BRIDGE_MC: pbap->type = BUS_ISA; pbap->set_f = pciSetBusAccess; break; @@ -2448,17 +2689,20 @@ xf86BusAccInfo = pbap; pbp = pbp->next; } - + pbap = xf86BusAccInfo; - + while (pbap) { pbap->primary = NULL; if (pbap->busdep_type == BUS_PCI && pbap->busdep.pci.primary_bus > -1) { pbap_tmp = xf86BusAccInfo; while (pbap_tmp) { - if (pbap_tmp->busdep_type == BUS_PCI && + if (pbap_tmp->busdep_type == BUS_PCI && pbap_tmp->busdep.pci.bus == pbap->busdep.pci.primary_bus) { + /* Don't create loops */ + if (pbap == pbap_tmp) + break; pbap->primary = pbap_tmp; break; } @@ -2637,6 +2881,12 @@ /* in case bios is enabled disable it */ disablePciBios(pciTag(bus,device,func)); pciSlotClaimed = TRUE; + + if (active) { + /* Map in this domain's I/O space */ + p->domainIO = xf86MapDomainIO(-1, VIDMEM_MMIO, + pciTag(bus, device, func), 0, 1); + } return num; } else @@ -2784,12 +3034,12 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func) { /* - * The format is assumed to be "bus:device:func", where bus, device - * and func are decimal integers. func may be omitted and assumed to - * be zero, although it doing this isn't encouraged. + * The format is assumed to be "bus[@domain]:device[:func]", where domain, + * bus, device and func are decimal integers. domain and func may be + * omitted and assumed to be zero, although doing this isn't encouraged. */ - char *p, *s; + char *p, *s, *d; const char *id; int i; @@ -2802,6 +3052,16 @@ xfree(s); return FALSE; } + d = strpbrk(p, "@"); + if (d != NULL) { + *(d++) = 0; + for (i = 0; d[i] != 0; i++) { + if (!isdigit(d[i])) { + xfree(s); + return FALSE; + } + } + } for (i = 0; p[i] != 0; i++) { if (!isdigit(p[i])) { xfree(s); @@ -2809,6 +3069,8 @@ } } *bus = atoi(p); + if (d != NULL && *d != 0) + *bus += atoi(d) << 8; p = strtok(NULL, ":"); if (p == NULL || *p == 0) { xfree(s); @@ -2972,49 +3234,34 @@ } -CARD32 (*FindPCIClassInCardList)( - unsigned short vendorID, unsigned short subsystemID); -CARD32 (*FindPCIClassInDeviceList)( - unsigned short vendorID, unsigned short deviceID); +/* + * This used to load the scanpci module. The pcidata module is now used + * (which the server always loads early). The main difference between the + * two modules is size, and the scanpci module should only ever be loaded + * when the X server is run with the -scanpci flag. + * + * To make sure that the required information is present in the pcidata + * module, add a PCI_VENDOR_* macro for the relevant vendor to xf86PciInfo.h, + * and add the class override data to ../etc/extrapci.ids. + */ static void getPciClassFlags(pciConfigPtr *pcrpp) { pciConfigPtr pcrp; int i = 0; -#ifdef XFree86LOADER - pointer scan_mod = NULL; -#endif if (!pcrpp) return; - -#ifdef XFree86LOADER - if (!(scan_mod = xf86LoadOneModule("scanpci", NULL))) { - xf86Msg(X_WARNING,"Could not load scanpci module\n"); - return; - } else { - FindPCIClassInCardList = (CARD32 (*)(unsigned short, unsigned short)) - LoaderSymbol("xf86FindPCIClassInCardList"); - FindPCIClassInDeviceList = (CARD32 (*)(unsigned short, unsigned short)) - LoaderSymbol("xf86FindPCIClassInDeviceList"); - } -#else - FindPCIClassInCardList = xf86FindPCIClassInCardList; - FindPCIClassInDeviceList = xf86FindPCIClassInDeviceList; -#endif - while ((pcrp = pcrpp[i])) { - if (!(pcrp->listed_class = FindPCIClassInCardList( - pcrp->pci_subsys_vendor,pcrp->pci_subsys_card))) - pcrp->listed_class = FindPCIClassInDeviceList( - pcrp->pci_vendor,pcrp->pci_device); + if (!(pcrp->listed_class = + xf86FindPciClassBySubsys(pcrp->pci_subsys_vendor, + pcrp->pci_subsys_card))) { + pcrp->listed_class = + xf86FindPciClassByDevice(pcrp->pci_vendor, pcrp->pci_device); + } i++; } - -#ifdef XFree86LOADER - UnloadModule(scan_mod); -#endif } /* @@ -3181,7 +3428,10 @@ } break; } - pRange->type &= ~ResBus; + + /* Set domain number */ + pRange->type &= ~(ResDomain | ResBus); + pRange->type |= xf86GetPciDomain(tag) << 24; } static void @@ -3194,6 +3444,19 @@ } } +static void +updateAccessInfoStatusControlInfo(PCITAG tag, CARD32 ctrl) +{ + int i; + + if (!xf86PciAccInfo) + return; + + for (i = 0; xf86PciAccInfo[i] != NULL; i++) { + if (xf86PciAccInfo[i]->arg.tag == tag) + xf86PciAccInfo[i]->arg.ctrl = ctrl; + } +} void pciConvertRange2Host(int entityIndex, resRange *pRange) @@ -3208,6 +3471,7 @@ } +#ifdef INCLUDE_DEPRECATED void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable) { @@ -3218,8 +3482,12 @@ tag = pciTag(pPci->bus, pPci->device, pPci->func); temp = pciReadLong(tag, PCI_CMD_STAT_REG); - if (enable) + if (enable) { + updateAccessInfoStatusControlInfo(tag, temp | PCI_CMD_MASTER_ENABLE); pciWriteLong(tag, PCI_CMD_STAT_REG, temp | PCI_CMD_MASTER_ENABLE); - else + } else { + updateAccessInfoStatusControlInfo(tag, temp & ~PCI_CMD_MASTER_ENABLE); pciWriteLong(tag, PCI_CMD_STAT_REG, temp & ~PCI_CMD_MASTER_ENABLE); + } } +#endif /* INCLUDE_DEPRECATED */ Index: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h:3.5 xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h:3.8 --- xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h:3.5 Tue Sep 19 08:46:13 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h Mon Sep 16 12:55:33 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.5 2000/09/19 12:46:13 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.8 2002/09/16 16:55:33 tsi Exp $ */ #ifndef _XF86_PCI_BUS_H #define _XF86_PCI_BUS_H @@ -6,9 +6,9 @@ #define PCITAG_SPECIAL pciTag(0xFF,0xFF,0xFF) typedef struct { - CARD32 command; - CARD32 base[6]; - CARD32 biosBase; + CARD32 command; + CARD32 base[6]; + CARD32 biosBase; } pciSave, *pciSavePtr; typedef void (*SetBitsProcPtr)(PCITAG, int, CARD32, CARD32); @@ -16,17 +16,14 @@ typedef struct { PCITAG tag; -#ifdef notanymore - SetBitsProcPtr func; -#endif WriteProcPtr func; CARD32 ctrl; } pciArg; -typedef struct pci_io { - int busnum; - int devnum; - int funcnum; +typedef struct { + int busnum; + int devnum; + int funcnum; pciArg arg; xf86AccessRec ioAccess; xf86AccessRec io_memAccess; @@ -36,30 +33,26 @@ Bool ctrl; } pciAccRec, *pciAccPtr; -typedef struct { - CARD16 io; - CARD32 mem; - CARD32 pmem; - CARD8 control; -} pciBridgeSave, *pciBridgeSavePtr; +typedef union { + CARD16 control; +} pciBridgesSave, *pciBridgesSavePtr; typedef struct pciBusRec { int brbus, brdev, brfunc; /* ID of the bridge to this bus */ int primary, secondary, subordinate; - int subclass; /* bridge type */ + int subclass; /* bridge type */ int interface; - resPtr preferred_io; /* I/O range */ - resPtr preferred_mem; /* non-prefetchable memory range */ - resPtr preferred_pmem; /* prefetchable memory range */ - resPtr io; /* for subtractive PCI-PCI bridges */ - resPtr mem; - resPtr pmem; - int brcontrol; /* bridge_control byte */ + resPtr preferred_io; /* I/O range */ + resPtr preferred_mem; /* non-prefetchable memory range */ + resPtr preferred_pmem; /* prefetchable memory range */ + resPtr io; /* for subtractive PCI-PCI bridges */ + resPtr mem; + resPtr pmem; + int brcontrol; /* bridge_control byte */ struct pciBusRec *next; } PciBusRec, *PciBusPtr; void xf86PciProbe(void); -PciBusPtr xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo); void ValidatePci(void); resList GetImplicitPciResources(int entityIndex); void initPciState(void); Index: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h:3.4 xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h:3.5 --- xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h:3.4 Sat Oct 27 23:33:19 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h Mon Dec 9 21:42:35 2002 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h,v 3.4 2001/10/28 03:33:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h,v 3.5 2002/12/10 02:42:35 tsi Exp $ */ #ifndef _XF86_SBUSBUS_H #define _XF86_SBUSBUS_H @@ -80,7 +80,7 @@ void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg); Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp); -int promRootNode; +extern int promRootNode; int promGetSibling(int node); int promGetChild(int node); Index: xc/programs/Xserver/hw/xfree86/common/xf86str.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.83 xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.90 --- xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.83 Fri Nov 30 07:11:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86str.h Mon Nov 25 09:04:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.83 2001/11/30 12:11:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.90 2002/11/25 14:04:56 eich Exp $ */ /* * Copyright (c) 1997-2000 by The XFree86 Project, Inc. @@ -18,6 +18,7 @@ #include "pixmapstr.h" #include "xf86Module.h" #include "xf86Opt.h" +#include "xf86Pci.h" /* * memType is of the size of the addressable memory (machine size) @@ -100,6 +101,7 @@ # define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C) /* built-in mode - configure CRTC and clock */ # define M_T_DEFAULT 0x10 /* (VESA) default modes */ +# define M_T_USERDEF 0x20 /* One of the modes from the config file */ /* Video mode */ typedef struct _DisplayModeRec { @@ -245,6 +247,15 @@ * function prototypes added to xf86.h. */ +/* Tolerate prior #include */ +#if defined(linux) && defined(_INPUT_H) +#undef BUS_NONE +#undef BUS_ISA +#undef BUS_PCI +#undef BUS_SBUS +#undef BUS_last +#endif + typedef enum { BUS_NONE, BUS_ISA, @@ -556,15 +567,20 @@ #define ResBlock 0x0400 #define ResSparse 0x0800 #define ResExtMask 0x0C00 - -#define ResEstimated 0x1000 -#define ResInit 0x2000 -#define ResBios 0x4000 -#define ResMiscMask 0xF000 - -#define ResBus 0x10000 -#define ResDomain 0xff000000ul +#define ResEstimated 0x001000 +#define ResInit 0x002000 +#define ResBios 0x004000 +#define ResMiscMask 0x00F000 + +#define ResBus 0x010000 +#define ResOverlap 0x020000 + +#if defined(__alpha__) && defined(linux) +# define ResDomain 0x1ff000000ul +#else +# define ResDomain 0xff000000ul +#endif #define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */ #define ResEnd ResNone @@ -597,6 +613,7 @@ #define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock) #define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse) #define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated) +#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap)) typedef struct { unsigned long type; /* shared, exclusive, unused etc. */ @@ -604,6 +621,8 @@ memType b; } resRange, *resList; +#define RANGE_TYPE(type, domain) \ + (((unsigned long)(domain) << 24) | ((type) & ~ResBus)) #define RANGE(r,u,v,t) {\ (r).a = (u);\ (r).b = (v);\ @@ -829,7 +848,7 @@ unsigned long biosBase; /* Base address of video BIOS */ unsigned long memPhysBase; /* Physical address of FB */ unsigned long fbOffset; /* Offset of FB in the above */ - unsigned long ioBase; /* I/O or MMIO base adderss */ + IOADDRESS domainIOBase; /* Domain I/O base address */ int memClk; /* memory clock */ int textClockFreq; /* clock of text mode */ Bool flipPixels; /* swap default black/white */ @@ -990,5 +1009,21 @@ #define LD_RESOLV_NOW 1 /* finish one delay step */ #define LD_RESOLV_FORCE 2 /* force checking... */ #endif + +/* Values of xf86Info.mouseFlags */ +#define MF_CLEAR_DTR 1 +#define MF_CLEAR_RTS 2 + +/* Action Events */ +typedef enum { + ACTION_TERMINATE = 0, /* Terminate Server */ + ACTION_NEXT_MODE = 10, /* Switch to next video mode */ + ACTION_PREV_MODE, + ACTION_DISABLEGRAB = 20, /* Cancel server/pointer/kbd grabs */ + ACTION_CLOSECLIENT, /* Kill client holding grab */ + ACTION_SWITCHSCREEN = 100, /* VT switch */ + ACTION_SWITCHSCREEN_NEXT, + ACTION_SWITCHSCREEN_PREV +} ActionEvent; #endif /* _XF86STR_H */ Index: xc/programs/Xserver/hw/xfree86/common/xf86xv.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.32 xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.33 --- xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.32 Wed Aug 22 18:13:43 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xv.c Fri Nov 8 20:18:11 2002 @@ -6,7 +6,7 @@ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.32 2001/08/22 22:13:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.33 2002/11/09 01:18:11 keithp Exp $ */ #include "misc.h" #include "xf86.h" @@ -72,7 +72,6 @@ /* ScreenRec fields */ -static Bool xf86XVCreateWindow(WindowPtr pWin); static Bool xf86XVDestroyWindow(WindowPtr pWin); static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2); static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); @@ -190,7 +189,7 @@ XF86XVGeneration = serverGeneration; } - if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,sizeof(XF86XVWindowRec))) + if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,0)) return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; @@ -220,7 +219,6 @@ ScreenPriv->videoGC = NULL; /* for the helper */ - ScreenPriv->CreateWindow = pScreen->CreateWindow; ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->WindowExposures = pScreen->WindowExposures; ScreenPriv->ClipNotify = pScreen->ClipNotify; @@ -228,7 +226,6 @@ ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->AdjustFrame = pScrn->AdjustFrame; - pScreen->CreateWindow = xf86XVCreateWindow; pScreen->DestroyWindow = xf86XVDestroyWindow; pScreen->WindowExposures = xf86XVWindowExposures; pScreen->ClipNotify = xf86XVClipNotify; @@ -960,24 +957,6 @@ /**** ScreenRec fields ****/ - -static Bool -xf86XVCreateWindow(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - int ret; - - pScreen->CreateWindow = ScreenPriv->CreateWindow; - ret = (*pScreen->CreateWindow)(pWin); - pScreen->CreateWindow = xf86XVCreateWindow; - - if(ret) pWin->devPrivates[XF86XVWindowIndex].ptr = NULL; - - return ret; -} - - static Bool xf86XVDestroyWindow(WindowPtr pWin) { @@ -1150,7 +1129,6 @@ ScreenPriv->videoGC = NULL; } - pScreen->CreateWindow = ScreenPriv->CreateWindow; pScreen->DestroyWindow = ScreenPriv->DestroyWindow; pScreen->WindowExposures = ScreenPriv->WindowExposures; pScreen->ClipNotify = ScreenPriv->ClipNotify; Index: xc/programs/Xserver/hw/xfree86/common/xf86xv.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.22 xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.23 --- xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.22 Sat Jun 16 17:57:42 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xv.h Fri Nov 8 20:18:33 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.22 2001/06/16 21:57:42 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.23 2002/11/09 01:18:33 keithp Exp $ */ #ifndef _XF86XV_H_ #define _XF86XV_H_ @@ -223,7 +223,6 @@ extern int XF86XvScreenIndex; typedef struct { - CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; ClipNotifyProcPtr ClipNotify; WindowExposuresProcPtr WindowExposures; Index: xc/programs/Xserver/hw/xfree86/ddc/ddcPriv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/ddc/ddcPriv.h:1.1 --- /dev/null Thu Feb 27 12:30:21 2003 +++ xc/programs/Xserver/hw/xfree86/ddc/ddcPriv.h Mon Feb 17 11:08:27 2003 @@ -0,0 +1,9 @@ +extern unsigned char *GetEDID_DDC1( + unsigned int * +); + +extern int DDC_checksum( + unsigned char *, + int +); + Index: xc/programs/Xserver/hw/xfree86/ddc/edid.c diff -u xc/programs/Xserver/hw/xfree86/ddc/edid.c:1.3 xc/programs/Xserver/hw/xfree86/ddc/edid.c:1.4 --- xc/programs/Xserver/hw/xfree86/ddc/edid.c:1.3 Fri Nov 3 13:46:08 2000 +++ xc/programs/Xserver/hw/xfree86/ddc/edid.c Mon Feb 17 11:08:27 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.c,v 1.3 2000/11/03 18:46:08 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.c,v 1.4 2003/02/17 16:08:27 dawes Exp $ */ /* edid.c: retrieve EDID record from raw DDC1 data stream: data * is contained in an array of unsigned int each unsigned int @@ -12,8 +12,8 @@ #include "xf86_ansic.h" #include "xf86_OSproc.h" #include "xf86DDC.h" +#include "ddcPriv.h" -int checksum(unsigned char *, int); static int find_start(unsigned int *); static unsigned char * find_header(unsigned char *); static unsigned char * resort(unsigned char *); @@ -44,12 +44,12 @@ d_pos++; } xfree(s_ptr); - if (d_block && checksum(d_block,EDID1_LEN)) return NULL; + if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL; return (resort(d_block)); } int -checksum(unsigned char *block, int len) +DDC_checksum(unsigned char *block, int len) { int i, result = 0; int not_null = 0; Index: xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c diff -u xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c:1.2 xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c:1.3 --- xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c:1.2 Fri Apr 14 08:16:04 2000 +++ xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c Mon Feb 17 11:08:27 2003 @@ -1,7 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c,v 1.2 2000/04/14 12:16:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c,v 1.3 2003/02/17 16:08:27 dawes Exp $ */ #include "vdif.h" #include "misc.h" +#include "xf86DDC.h" static void print_vdif(xf86VdifPtr l, char *s); static void print_timings(xf86VdifTimingPtr *pt); Index: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c diff -u xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.21 xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.23 --- xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.21 Fri May 25 17:43:16 2001 +++ xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c Mon Feb 17 11:08:27 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.21 2001/05/25 21:43:16 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.23 2003/02/17 16:08:27 dawes Exp $ */ /* xf86DDC.c * @@ -9,8 +9,11 @@ #include "xf86_ansic.h" #include "xf86_OSproc.h" #include "xf86DDC.h" +#include "ddcPriv.h" +#ifdef XFree86LOADER static const OptionInfoRec *DDCAvailableOptions(void *unused); +#endif const char *i2cSymbols[] = { "xf86CreateI2CDevRec", @@ -77,15 +80,6 @@ #define RETRIES 4 -extern unsigned char *GetEDID_DDC1( - unsigned int * -); - -extern int checksum( - unsigned char *, - int -); - static unsigned char *EDIDRead_DDC1( ScrnInfoPtr pScrn, void (*)(ScrnInfoPtr,xf86ddcSpeed), @@ -133,12 +127,14 @@ { -1, NULL, OPTV_NONE, {0}, FALSE }, }; +#ifdef XFree86LOADER /*ARGSUSED*/ static const OptionInfoRec * DDCAvailableOptions(void *unused) { return (DDCOptions); } +#endif xf86MonPtr xf86DoEDID_DDC1( @@ -362,7 +358,7 @@ * (len)); for (i=0; i The +CVS tag for this release is "xf-4_3_0", and the tag for the maintenance +branch for this release is "xf-4_3-branch". + +Another method of getting the XFree86 4.3.0 source is to either download the +4.3.0 source tarballs from the XFree86 ftp site. The procedure for this is +as follows: + + o The XFree86 4.3.0 source is contained in the files X430src-1.tgz, + X430src-2.tgz, X430src-3.tgz, X430src-4.tgz, X430src-5.tgz, + X430src-6.tgz and X430src-7.tgz. These can be found at + ftp://ftp.xfree86.org/pub/XFree86/4.3.0/source/ and similar locations on + XFree86 mirror sites. X430src-4.tgz and X430src-5.tgz contains the + fonts. X430src-6.tgz contains the documentation source. X430src-7.tgz + contains the hardcopy documentation. X430src-1.tgz, X430src-2.tgz and + X430src-3.tgz contains everything else. If you don't need the docs or + fonts you can get by with only X430src-1.tgz, X430src-2.tgz and + X430src-3.tgz. o Extract each of these files by running the following from a directory on a filesystem containing enough space (the full source requires around - 270MB, and a similar amount is required in addition to this for the com- + 305MB, and a similar amount is required in addition to this for the com- piled binaries): - gzip -d < X420src-1.tgz | tar vxf - + gzip -d < X430src-1.tgz | tar vxf - - gzip -d < X420src-2.tgz | tar vxf - + gzip -d < X430src-2.tgz | tar vxf - - gzip -d < X420src-3.tgz | tar vxf - + gzip -d < X430src-3.tgz | tar vxf - - o If the release is not a full release, it is available as a patch against - the previous full release in the - ftp://ftp.xfree86.org/pub/XFree86/4.2.0/patches/ directory. Get the - patch file from there and apply it by running the following command: + gzip -d < X430src-4.tgz | tar vxf - - cd the directory containing the xc directory + gzip -d < X430src-5.tgz | tar vxf - - gzip -d < file | patch -s -p0 -E + gzip -d < X430src-6.tgz | tar vxf - - Look for special patching instructions in the Release Notes. + gzip -d < X430src-7.tgz | tar vxf - -Another option is to get the source by anonymous CVS or CVSup. See -http://www.xfree86.org/cvs/ for details on the different procedure available. +Alternatively, if you already have a pristine copy of the XFree86 4.2.0 +source, you can download patches from +ftp://ftp.xfree86.org/pub/XFree86/4.3.0/patches/ that will allow you to con- +vert it to 4.3.0. Information about which patch files to download and how to +apply them can be found in the "How to get XFree86" section of the README for +this release. -All method will produce one main source directory called xc. +All methods will produce one main source directory called xc. 2. Configuring the source before building -It is recommended that you start the configuration process by going to the -xc/config/cf directory, and copying the file xf86site.def to host.def. Then -read through the host.def file (which is heavily commented), and set any -parameters that you want for your configuration. You can usually find out -what the default settings are by checking the .cf file(s) relevant to your -OS. - -Unlike previous versions, imake can now automatically detect and set the var- -ious OS*Version parameters, so you shouldn't need to enter those settings -explicitly. +In most cases it shouldn't be necessary to configure anything before build- +ing. -If you are using just the X420src-1.tgz part of the source dist, you will -need to define BuildFonts to NO. +If you do want to make configuration changes, it is recommended that you +start by going to the xc/config/cf directory, and copying the file +xf86site.def to host.def. Then read through the host.def file (which is +heavily commented), and set any parameters that you want for your configura- +tion. You can usually find out what the default settings are by checking the +.cf file(s) relevant to your OS. + +A general rule to follow is to only change things that you understand and +have a good reason to change. It is easy to create build problems by chang- +ing the default configuration. Many of the configuration parameters are doc- +umented in xc/config/cf/README. +If you are using just the X430src-1.tgz, X430src-2.tgz and X430src-3.tgz +parts of the source dist, you will need to define BuildFonts to NO. + 3. Using a shadow directory of symbolic links for the build A recommended practice is to use a shadow directory of symbolic links to do @@ -85,11 +99,11 @@ trol of CVS. o It is possible to build XFree86 for several different Operating System - or architectures from the same sources, shared by NFS. + or architectures from the same sources, shared by read-only NFS mounts. o It is possible to build XFree86 with different configuration options, - just by putting a real copyhost.def in each build tree and by customiz- - ing it separately in each build tree. + just by putting a real copy of the host.def file in each build tree and + by customizing it separately in each build tree. To make a shadow directory of symbolic links, use the following steps: @@ -100,7 +114,7 @@ mkdir build - o use the lndircommand to make the shadow tree: + o use the "lndir" command to make the shadow tree: lndir ../xc @@ -118,16 +132,24 @@ cp lndir some directory in your PATH +From time to time there may be some stale links in the build tree, for exam- +ple, when files in the source tree are removed or renamed. These can be +cleaned up by running the "cleanlinks" script from the build directory (see +the cleanlinks(1) manual page). Rarely there will be changes that will +require the build tree to be re-created from scratch. A symptom of this can +be mysterious build problems. The best solution for this is to remove the +build tree, and then re-create it using the steps outlined above. + 4. Building and installing the distribution Before building the distribution, read through the OS-specific README file in xc/programs/Xserver/hw/xfree86/doc that is relevant to you. Once those OS- specific details have been taken care of, go your build directory (either the -xc directory or the shadow tree created before) and run ``make World'' with -the BOOTSTRAPCFLAGS set as described in the OS-specific README (if necessary, -but most systems supported by XFree86 don't need BOOTSTRAPCFLAGS). It is -advisable to redirect stdout and stderr to World.Log so that you can track -down problems that might occur during the build. +xc directory or the shadow tree created before) and run "make World" with the +BOOTSTRAPCFLAGS set as described in the OS-specific README (if necessary, but +most systems supported by XFree86 don't need BOOTSTRAPCFLAGS). It is advis- +able to redirect stdout and stderr to World.Log so that you can track down +problems that might occur during the build. With Bourne-like shells (Bash, the Korn shell, zsh, etc.) use a command like: @@ -142,10 +164,28 @@ tail -f World.log in a terminal. + +When the build is finished, you should check the World.Log file to see if +there were any problems. If there weren't any then you can install the bina- +ries. By default the "make World" process will ignore errors and build as +much as possible. If there were problems and they are not corrected at this +stage, the installation process will fail. To restart the build process +after correcting the problems, just run 'make'. If Imakefiles or part of the +build configuration was changed as part of correcting the problem, either re- +run "make World", or run "make Everything". + +If you would prefer "make World" to exit at the first error, run it in the +following way instead of the way described above: + +for Bourne-like shells: + + make WORLDOPTS= World > World.log 2>&1 + +for C-shell variants: + + make WORLDOPTS= World >& World.log -When the build is finished, you should check World.Log to see if there were -any problems. If there weren't any then you can install the binaries. To do -the install, run ``make install'' and ``make install.man''. Make sure you +To do the install, run "make install" and "make install.man". Make sure you have enough space in /usr/X11R6 for the install to succeed. If you want to install on a filesystem other than /usr, make a symbolic link to /usr/X11R6 before installing. @@ -167,7 +207,7 @@ make Makefile make Makefiles - make includes + make includes make depend make @@ -176,7 +216,7 @@ There are some other useful targets defined in the top level Makefileof XFree86: - o Everything after a make World, make Everythingdoes everything a make + o Everything after a make World, make Everything does everything a make World does, except the cleaning of the tree. It is a way to quickly rebuild the tree after a source patch, but it is not 100% bullet proof. There are cases were it is better to force a full build by using make @@ -206,9 +246,9 @@ o VerifyOS displays the detected operating system version. If the numbers shown do not match your system, you probably need to set them manually - in host.def and report the problem to XFree86@XFree86.org. + in host.def and report the problem to . - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.6 2001/11/15 17:32:16 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.11 2003/02/27 01:17:36 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/BUILD,v 3.7 2001/11/15 17:37:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/BUILD,v 3.16 2003/02/27 01:44:03 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/DESIGN diff -u xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.40 xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.47 --- xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.40 Wed Jan 16 15:51:01 2002 +++ xc/programs/Xserver/hw/xfree86/doc/DESIGN Tue Feb 25 16:32:33 2003 @@ -2,7 +2,7 @@ The XFree86 Project, Inc - Last modified 1 August 2001 + Last modified 2003 January 22 NOTE: This is a DRAFT document, and the interfaces described here are subject to change without notice. @@ -1509,8 +1509,6 @@ SymTabPtr chipsets, PciChipsets *PCIchipsets, - GDevPtr *devList, int numDevs, - GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities) @@ -1666,17 +1664,27 @@ Two helper functions are provided to aid configuring entities: ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, + int scrnFlag, int entityIndex, + PciChipsets *p_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private) + ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, + int scrnFlag, int entityIndex, + IsaChipsets *i_chip, resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private) These functions are used to register the non-relocatable @@ -1694,8 +1702,8 @@ pointer private) They are passed the entity index and a pointer to a pri- - vate scratch area. This are can be set up during Probe() - and its address can be passed to xf86ConfigIsaEntity() + vate scratch area. This can be set up during Probe() and + its address can be passed to xf86ConfigIsaEntity() and xf86ConfigPciEntity() as the last argument. These two helper functions make use of several core functions that are avail- @@ -1724,12 +1732,12 @@ 9.3.2 PreInit Phase -During this phase the remaining resource should be registered. PreInit() -should call xf86GetEntityInfo() To obtain a pointer to an EntityInfoRec for +During this phase the remaining resources should be registered. PreInit() +should call xf86GetEntityInfo() to obtain a pointer to an EntityInfoRec for each entity it is able to drive and check if any resource are listed in its resources field. If resources registered in the Probe phase have been -rejected in the post-Probe phase (resources == NULL), then the driver should -decide if it can continue without using these or if it should fail. +rejected in the post-Probe phase (resources is non-NULL), then the driver +should decide if it can continue without using these or if it should fail. EntityInfoPtr xf86GetEntityInfo(int entityIndex) @@ -1742,10 +1750,8 @@ Bool xf86IsEntityPrimary(int entityIndex) This function returns TRUE if the entity referenced by - entityIndex is the display device that primary display - device (i.e., the one initialised at boot time and used - in text mode). - + entityIndex is the primary display device (i.e., the one + initialised at boot time and used in text mode). Bool xf86IsScreenPrimary(int scrnIndex) This function returns TRUE if the primary entity is reg- @@ -1784,10 +1790,11 @@ resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes) This function takes a list of PCI resources that need to - be reallocated and returns a list of the reallocated - resource. This list needs to be passed to xf86Register- - Resources() again to be registered with the broker. If - the reallocation fails, NULL is returned. + be reallocated and returns NULL when all relocations are + successful. xf86RegisterResources() should be called + again to register the relocated resources with the bro- + ker. If the reallocation fails, a list of the resources + that could not be relocated is returned. Two functions are provided to obtain a resource range of a given type: @@ -1804,7 +1811,7 @@ avoided within the window can be supplied. On failure a zero-length range of type ResEnd will be returned. - resRange xf86GetSparse(long type, memType fixed_bits, + resRange xf86GetSparse(long type, memType fixed_bits, memType decode_mask, memType address_mask, @@ -1835,14 +1842,14 @@ parameter contains the number of the PCI base register that needs to be fixed (0-5, and 6 for the BIOS base reg- ister). The size is specified by the alignment. Since - PCI resources need to span an integral range of the size - 2^n the alignment also specifies the number of addresses - that will be decoded. If the driver specifies a type - mask it can override the default type for PCI resources - which is ResShared. The resource broker needs to know - that to find a matching resource range. This function - should be called before calling xf86RegisterResources(). - The return value is TRUE when the function succeeds. + PCI resources need to span an integral range of size 2^n, + the alignment also specifies the number of addresses that + will be decoded. If the driver specifies a type mask it + can override the default type for PCI resources which is + ResShared. The resource broker needs to know that to + find a matching resource range. This function should be + called before calling xf86RegisterResources(). The + return value is TRUE when the function succeeds. Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base) @@ -1853,13 +1860,16 @@ config file) matches an actual value allocated to a device. -The driver may replace the generic access control functions for an entity by -it's own ones. This is done with the xf86SetAccessFuncs(): +The driver may replace the generic access control functions for an entity. +This is done with the xf86SetAccessFuncs(): void xf86SetAccessFuncs(EntityInfoPtr pEnt, + xf86SetAccessFuncPtr funcs, + + xf86SetAccessFuncPtr oldFuncs) - xf86SetAccessFuncPtr oldFuncs) with: + with: typedef struct { xf86AccessPtr mem; @@ -1876,27 +1886,27 @@ access functions are the same it is assumed that I/O can not be controlled independently. If memory and I/O have to be controlled together all three values should be the - same. If a non NULL value is passed as fifth argument it + same. If a non NULL value is passed as third argument it is interpreted as an address where to store the old - access record. If the fifth argument is NULL it will be + access record. If the third argument is NULL it will be assumed that the generic access should be enabled before replacing the access functions. Otherwise it will be disabled. The driver may enable them itself using the - returned values. It should do this from his replacement + returned values. It should do this from its replacement access functions as the generic access may be disabled by the common level on certain occasions. If replacement functions are specified they must control all resources of the specific type registered for the entity. -To find out if specific resource range is conflicting with another resource -the xf86ChkConflict() function may be used: +To find out if a specific resource range conflicts with another resource the +xf86ChkConflict() function may be used: memType xf86ChkConflict(resRange *rgp, int entityIndex) This function checks if the resource range rgp of for the specified entity conflicts with with another resource. - If it a conflict is found, the address of the start of - the conflict is returned. The return value is zero when + If a conflict is found, the address of the start of the + conflict is returned. The return value is zero when there is no conflict. The OPERATING state properties of previously registered fixed resources can @@ -2049,42 +2059,42 @@ The OptionInfoRec is defined as follows: - typedef struct { - double freq; - int units; - } OptFrequency; - - typedef union { - unsigned long num; - char * str; - double realnum; - Bool bool; - OptFrequency freq; - } ValueUnion; - - typedef enum { - OPTV_NONE = 0, - OPTV_INTEGER, - OPTV_STRING, /* a non-empty string */ - OPTV_ANYSTR, /* Any string, including an empty one */ - OPTV_REAL, - OPTV_BOOLEAN, - OPTV_FREQ - } OptionValueType; - - typedef enum { - OPTUNITS_HZ = 1, - OPTUNITS_KHZ, - OPTUNITS_MHZ - } OptFreqUnits; - - typedef struct { - int token; - const char* name; - OptionValueType type; - ValueUnion value; - Bool found; - } OptionInfoRec, *OptionInfoPtr; + typedef struct { + double freq; + int units; + } OptFrequency; + + typedef union { + unsigned long num; + char * str; + double realnum; + Bool bool; + OptFrequency freq; + } ValueUnion; + + typedef enum { + OPTV_NONE = 0, + OPTV_INTEGER, + OPTV_STRING, /* a non-empty string */ + OPTV_ANYSTR, /* Any string, including an empty one */ + OPTV_REAL, + OPTV_BOOLEAN, + OPTV_FREQ + } OptionValueType; + + typedef enum { + OPTUNITS_HZ = 1, + OPTUNITS_KHZ, + OPTUNITS_MHZ + } OptFreqUnits; + + typedef struct { + int token; + const char* name; + OptionValueType type; + ValueUnion value; + Bool found; + } OptionInfoRec, *OptionInfoPtr; OPTV_FREQ can be used for options values that are fre- quencies. These values are a floating point number with @@ -2111,9 +2121,10 @@ would normally be called near the end of the Chip- ScreenInit() function, but only when serverGenera- tion == 1. + + OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, - OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int - token) + int token) Returns a pointer to the OptionInfoRec in table with a token field matching token. Returns NULL if no match is @@ -2443,7 +2454,7 @@ Initialization of the XFree86 framebuffer manager is done via - Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) + Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) FullBox represents the area of the framebuffer that the manager is allowed to manage. This is typically a box with a width of pScrn->displayWidth and a @@ -2529,7 +2540,7 @@ LOCO *colors, VisualPtr pVisual) - LoadPalette() is a driver-provide function for loading a + LoadPalette() is a driver-provided function for loading a colormap into hardware. colors is the array of RGB val- ues that represent the full colormap. indices is a list of index values into the colors array. These indices @@ -2895,6 +2906,7 @@ Bool xf86XVScreenInit( ScreenPtr pScreen, + XF86VideoAdaptorPtr *adaptPtrs, int num) @@ -3105,6 +3117,7 @@ visible. typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, @@ -3125,6 +3138,7 @@ turn on the video. typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, @@ -3135,6 +3149,7 @@ place only one frame from the stream on the screen. typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, @@ -3147,6 +3162,7 @@ rect without reading from an area larger than requested. typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, @@ -3158,6 +3174,7 @@ put stream. typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, + pointer data, Bool cleanup) This indicates the driver should stop displaying the @@ -3178,6 +3195,7 @@ Atom attribute,INT32 value, pointer data) typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, + Atom attribute,INT32 *value, pointer data) A port may have particular attributes such as hue, satu- @@ -3214,6 +3232,7 @@ Bool motion, short vid_w, short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) QueryBestSize provides the client with a way to query @@ -3225,6 +3244,7 @@ important that the driver provide this function. typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, @@ -3443,6 +3463,10 @@ the caller identifies which symbols can safely remain unresolved and which cannot. +NOTE: Now that ISO-C allows pointers to functions and pointers to data to +have different internal representations, some of the following interfaces +will need to be revisited. + 17.2 Semi-private Loader Interface The following is the semi-private loader interface that is available to the @@ -3601,8 +3625,7 @@ An optional pointer to a variable holding the major part or the error code. When provided, - it *errmaj is filled in when LoadModule() - fails. + *errmaj is filled in when LoadModule() fails. errmin @@ -3615,7 +3638,8 @@ dle mod. All child modules are also unloaded recur- sively. This function must not be used to directly unload modules that are child modules (i.e., those that - have been loaded with LoadSubModule()). + have been loaded with the LoadSubModule() described + below). 17.3 Module Requirements @@ -3851,7 +3875,7 @@ This function unloads the module with handle module. If that module itself has children, they are also unloaded. - It is like LoadModule(), except that it is safe to use + It is like UnloadModule(), except that it is safe to use for unloading child modules. pointer LoaderSymbol(const char *symbol) @@ -3904,7 +3928,9 @@ solved symbols with the loader. When LoaderCheckUnre- solved() is run it won't generate warnings for symbols registered in this way unless they were also registered - as required symbols. + as required symbols. The function takes one or more NULL + terminated lists of symbols. The end of the argument + list is indicated by a NULL argument. void LoaderRefSymbols(const char *sym0, ...) @@ -4063,6 +4089,11 @@ No prefix. + X_NOT_IMPLEMENTED + + The message relates to functionality + that is not yet implemented. + xf86MsgVerb(MessageType type, int verb, const char *format, ...) Like xf86Msg(), but with the verbosity level given @@ -4079,11 +4110,11 @@ If scrnIndex is negative, this function behaves exactly like xf86Msg(). NOTE: This function can only be used after the ScrnIn- - foRec and its name field have been allocated. That means - that it can not be used before the END of the ChipProbe() - function. Prior to that, use xf86Msg(), providing the - driver's name explicitly. No screen number can be sup- - plied at that point. + foRec and its name field have been allocated. Normally, + this means that it can not be used before the END of the + ChipProbe() function. Prior to that, use xf86Msg(), pro- + viding the driver's name explicitly. No screen number + can be supplied at that point. xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, @@ -4354,9 +4385,9 @@ linePitches - List of supported line pitches supported by the - driver. This is optional and should be NULL - when not used. + List of line pitches supported by the driver. + This is optional and should be NULL when not + used. minPitch @@ -4662,11 +4693,11 @@ void xf86PrintModes(ScrnInfoPtr scrp) This function prints out the virtual size setting, and - the line pitch being used. It also prints out one line - for each mode being used, including its pixel clock, hor- - izontal sync rate, refresh rate, and whether it is inter- - laced or multiscan. - + the line pitch being used. It also prints out two lines + for each mode being used. The first line includes the + mode's pixel clock, horizontal sync rate, refresh rate, + and whether it is interlaced, doublescanned and/or multi- + scanned. The second line is the mode's Modeline. This function is normally called after calling xf86SetCrtcForModes(). @@ -4821,9 +4852,9 @@ Bool xf86IsUnblank(int mode) - Returns FALSE when the screen saver mode specified by - mode requires the screen be unblanked, and TRUE other- - wise. The screen saver modes that require blanking are + Returns TRUE when the screen saver mode specified by mode + requires the screen be unblanked, and FALSE otherwise. + The screen saver modes that require blanking are SCREEN_SAVER_ON and SCREEN_SAVER_CYCLE, and the screen saver modes that require unblanking are SCREEN_SAVER_OFF and SCREEN_SAVER_FORCER. Drivers may call this helper @@ -4985,20 +5016,10 @@ must be called before attempting to write to those regis- ters. - A macro VGAHW_UNLOCK(base) is also available in vgaHW.h - that does the same thing, and this may be used when the - vgahw module is not loaded (for example, in the Chip- - Probe() function). - void vgaHWLock(vgaHWPtr hwp) This function locks the VGA CRTC[0-7] registers. - A macro VGAHW_LOCK(base) is also available in vgaHW.h - that does the same thing, and this may be used when the - vgahw module is not loaded (for example, in the Chip- - Probe() function). - void vgaHWEnable(vgaHWPtr hwp) This function enables the VGA subsystem. (Note, this @@ -5039,12 +5060,12 @@ vgaHWSave() uses the three functions below in the order vgaHWSaveColormap(), vgaHWSaveMode(), vgaHWSaveFonts() to carry out the different save phases. It is undecided at - this stage whether they will be part of the vgahw mod- - ule's public interface or not. + this stage whether they will remain part of the vgahw + module's public interface or not. void vgaHWSaveMode(ScrnInfoPtr pScrn, vgaRegPtr save) - This functions saves the VGA mode registers. They are + This function saves the VGA mode registers. They are saved to the vgaRegRec pointed to by save. The registers saved are: @@ -5058,13 +5079,15 @@ Sequencer[0-4] + The number of registers actually saved may be modified by + a prior call to vgaHWSetRegCounts(). + void vgaHWSaveFonts(ScrnInfoPtr pScrn, vgaRegPtr save) - This functions saves the text mode font and text data - held in the video memory. If called while in a graphics - mode, no save is done. The VGA memory window must be - mapped with vgaHWMapMem() before to calling this func- - tion. + This function saves the text mode font and text data held + in the video memory. If called while in a graphics mode, + no save is done. The VGA memory window must be mapped + with vgaHWMapMem() before to calling this function. On some platforms, one or more of the font/text plane saves may be no-ops. This is the case when the plat- @@ -5093,12 +5116,13 @@ order vgaHWRestoreFonts(), vgaHWRestoreMode(), vgaHWRe- storeColormap() to carry out the different restore phases. It is undecided at this stage whether they will - be part of the vgahw module's public interface or not. + remain part of the vgahw module's public interface or + not. void vgaHWRestoreMode(ScrnInfoPtr pScrn, vgaRegPtr restore) - This functions restores the VGA mode registers. They are - restore from the data in the vgaRegRec pointed to by + This function restores the VGA mode registers. They are + restored from the data in the vgaRegRec pointed to by restore. The registers restored are: MiscOut @@ -5111,9 +5135,12 @@ Sequencer[0-4] + The number of registers actually restored may be modified + by a prior call to vgaHWSetRegCounts(). + void vgaHWRestoreFonts(ScrnInfoPtr pScrn, vgaRegPtr restore) - This functions restores the text mode font and text data + This function restores the text mode font and text data to the video memory. The VGA memory window must be mapped with vgaHWMapMem() before to calling this func- tion. @@ -5158,12 +5185,12 @@ This function blanks and unblanks the screen. It is blanked when on is FALSE, and unblanked when on is TRUE. This function is provided for use in cases where the - ScrnInfoRec can't be derived from the ScreenRec, like - probing for clocks. + ScrnInfoRec can't be derived from the ScreenRec (while + probing for clocks, for example). 19.3 VGA Colormap Functions -The vgahw modules uses the standard colormap support (see the Colormap Han- +The vgahw module uses the standard colormap support (see the Colormap Han- dling (section 13., page 1) section. This is initialised with the following function: @@ -5400,8 +5427,6 @@ #define ZZZ_MINOR_VERSION #define ZZZ_PATCHLEVEL - XXX Probably want to remove one of these version. - NOTE: ZZZ_DRIVER_NAME should match the name of the driver module without things like the "lib" prefix, the "_drv" suffix or filename extensions. @@ -6310,23 +6335,16 @@ Define the SaveScreen() function (the screen blanking function). When using the vgahw module, this will typically be: -This function is mandatory. Before modifying any hardware register directly -this function needs to make sure that the Xserver is active by checking if - - pScrn - - is non-NULL and for - - pScrn->vtSema == TRUE - -. - static Bool ZZZSaveScreen(ScreenPtr pScreen, int mode) { return vgaHWSaveScreen(pScreen, mode); } +This function is mandatory. Before modifying any hardware register directly +this function needs to make sure that the Xserver is active by checking if +pScrn is non-NULL and for pScrn->vtSema == TRUE. + 20.3.16 FreeScreen Define the FreeScreen() function. This function is optional. It should be @@ -6346,7 +6364,7 @@ ZZZFreeRec(xf86Screens[scrnIndex]); } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.47 2002/01/16 20:38:44 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.52 2003/02/25 19:31:00 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.40 2002/01/16 20:51:01 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.47 2003/02/25 21:32:33 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.79 xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.81 --- xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.79 Thu Nov 15 13:12:50 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Imakefile Mon Dec 9 22:54:15 2002 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.79 2001/11/15 18:12:50 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.81 2002/12/10 03:54:15 dawes Exp $ #include #include @@ -38,7 +38,7 @@ ReadmeFile(OpenBSD) \ /*ReadmeFile(OS2)*/ \ /*OS2.Notes*/ \ - /*ReadmeFile(SCO)*/ \ + ReadmeFile(SCO) \ /*ReadmeFile(Solaris)*/ \ /*ReadmeFile(SOLX86)*/ \ /*ReadmeFile(SVR4)*/ \ @@ -81,11 +81,17 @@ Install Status DESIGN Versions OTHERDOCS = /*VideoModes.doc*/ /*QuickStart.doc*/ /*xinput*/ \ - ReadmeFile(fonts) ReadmeFile(mouse) ReadmeFile(DRI) \ - ReadmeFile(DRIcomp) ReadmeFile(dps) + ReadmeFile(fonts) \ + ReadmeFile(mouse) \ + ReadmeFile(DGA) \ + ReadmeFile(DRI) \ + ReadmeFile(DRIcomp) \ + ReadmeFile(dps) \ + ReadmeFile(XKB-Config) \ + ReadmeFile(XKB-Enhancing) #endif -MISCDOCS = ServersOnly /*LbxproxyOnly*/ $(REPORTFORM) ReadmeFile(DGA) \ +MISCDOCS = ServersOnly /*LbxproxyOnly*/ $(REPORTFORM) \ VideoBoard98 ReadmeFile(rapidaccess) DATABASE = /* modeDB.txt */ /* AccelCards Monitors Devices */ Index: xc/programs/Xserver/hw/xfree86/doc/Install diff -u xc/programs/Xserver/hw/xfree86/doc/Install:1.14 xc/programs/Xserver/hw/xfree86/doc/Install:1.21 --- xc/programs/Xserver/hw/xfree86/doc/Install:1.14 Wed Jan 16 15:51:01 2002 +++ xc/programs/Xserver/hw/xfree86/doc/Install Tue Feb 25 00:29:10 2003 @@ -1,8 +1,8 @@ - Installation Details for XFree86[tm] 4.2.0 + Installation Details for XFree86[tm] 4.3.0 The XFree86 Project, Inc - 16 January 2002 + 24 February 2003 Abstract @@ -18,13 +18,15 @@ "tarballs" identified by the .tgz suffix). Along with the binaries we pro- vide a customized version of the GNU tar utility called "extract" and an installation script. We recommend that these be used to install the bina- -ries. - -2. Downloading the XFree86 4.2.0 binaries - -We provide XFree86 4.2.0 binaries for a range of operating systems at our ftp -site and our web site -. Often during +ries. (The source for this customized version of GNU tar can be found in the +XFree86 CVS repository's "utils" module, and from our ftp site +.) + +2. Downloading the XFree86 4.3.0 binaries + +We provide XFree86 4.3.0 binaries for a range of operating systems at our ftp +site and our web site +. Often during releases our site is heavily loaded. Instead of downloading directly from us we recommend that instead you use one of our mirror sites. @@ -71,9 +73,9 @@ looking soon after the release date. The second possibility is that we won't have it available at all for this release. This is likely if it's still not there about two weeks after the release date. Check here - for information about + for information about updates to our binary distributions, and here - for errata related to + for errata related to this release. Once you're run the Xinstall.sh script and found which binary distribution is @@ -133,9 +135,9 @@ If you miss some and want to install them later, go to the Manual Installa- tion (section 4., page 1) section. -3. Installing XFree86 4.2.0 using the Xinstall.sh script +3. Installing XFree86 4.3.0 using the Xinstall.sh script -We strongly recommend that our XFree86 4.2.0 binaries be installed using the +We strongly recommend that our XFree86 4.3.0 binaries be installed using the Xinstall.sh script that we provide. There are a lot of steps in the manual installation process, and those steps can vary according to the platform and hardware setup. There is a description of the manual installation process @@ -252,7 +254,7 @@ The next step is to configure the X server. That is covered in detail in an as-yet unwritten document :-(. In the meantime, there are three ways to cre- -ate a basic X server configuration file for XFree86 4.2.0. One is to run the +ate a basic X server configuration file for XFree86 4.3.0. One is to run the xf86config utility. Another is to run the xf86cfg utility. The third option is to use the new -configure X server option: @@ -271,9 +273,9 @@ After the X server configuration is done, it may be advisable to reboot, especially if you run xdm (or equivalent) or the font server (xfs). -4. Installing XFree86 4.2.0 manually +4. Installing XFree86 4.3.0 manually -This section contains information about manually installing the XFree86 4.2.0 +This section contains information about manually installing the XFree86 4.3.0 binary distributions. You should only use this method if you know what you're doing. The information here covers some common cases, but not every possible case. It also may not be complete or up to date. Use at your own @@ -378,7 +380,7 @@ /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.13 2002/01/16 20:38:44 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.17 2003/02/24 17:09:16 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.14 2002/01/16 20:51:01 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.21 2003/02/25 05:29:10 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/LICENSE diff -u xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.16 xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.17 --- xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.16 Wed Jan 16 15:51:01 2002 +++ xc/programs/Xserver/hw/xfree86/doc/LICENSE Sun Feb 23 23:03:20 2003 @@ -2,14 +2,14 @@ The XFree86 Project - January 2002 + February 2003 1. XFree86 License XFree86 code without an explicit copyright is covered by the following copy- right/license: -Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved. +Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -618,7 +618,7 @@ info@urwpp.de or design@bigelowandholmes.com - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.11 2002/01/16 20:38:45 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.12 2003/02/24 03:41:16 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.16 2002/01/16 20:51:01 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.17 2003/02/24 04:03:20 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes diff -u xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.19 xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.20 --- xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.19 Sat Jun 30 18:58:09 2001 +++ xc/programs/Xserver/hw/xfree86/doc/OS2.Notes Fri Jan 3 23:28:27 2003 @@ -23,10 +23,11 @@ for OS/2, XFree86-4.0 is considered to be alpha software. If you want to join the XFree86 developer team, e.g. to add support for cer- -tain hardware, please send a request to BOD@XFree86.org. Please think about -such a step carefully before, though, since much work is involved. Please use -the XFree86-4.0 source code as a test example how to compile the system. The -ability to manage that is a basic requirement for becoming a developer. +tain hardware, please send a request to . Please think +about such a step carefully before, though, since much work is involved. +Please use the XFree86-4.0 source code as a test example how to compile the +system. The ability to manage that is a basic requirement for becoming a +developer. 2. Tools required @@ -221,9 +222,7 @@ Well, you see, this was quite easy :-) - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml,v 1.1 2001/06/04 13:50:15 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml,v 1.2 2003/01/04 04:20:23 dawes Exp $ - $XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ - -$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.19 2001/06/30 22:58:09 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.20 2003/01/04 04:28:27 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README diff -u xc/programs/Xserver/hw/xfree86/doc/README:3.116 xc/programs/Xserver/hw/xfree86/doc/README:3.129 --- xc/programs/Xserver/hw/xfree86/doc/README:3.116 Wed Jan 16 15:51:01 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README Wed Feb 26 21:16:18 2003 @@ -1,182 +1,158 @@ - README for XFree86[tm] 4.2.0 + README for XFree86[tm] 4.3.0 The XFree86 Project, Inc - 16 January 2002 + 26 February 2003 Abstract - XFree86 is the Open Source port of X.Org's X11R6.6 release that - supports several UNIX(R) and UNIX-like (such as Linux, the BSDs and - Solaris x86) operating systems on Intel and other platforms. - -1. What is XFree86 4.2.0? - -XFree86 4.2.0 is the fifth full release in the XFree86 4 series. - -XFree86 release 4 is a major re-design of the basic architectural underpin- -nings of XFree86's implementation of the original X Consortium's X Server. -This re-design allows for a modular interaction between the hardware drivers -and the XFree86 core X server. With 4.x, upgrades to the X server with new -and unsupported hardware can be easily done and installed without undergoing -the previous process of rebuilding an X server. All that is required is -installing the new driver module and updating the configuration file. - -The road to XFree86 release 4 began as an architectural concept in mid 1997, -with the serious framework being implemented in code the beginning of 1998. -There were several snapshots on the road to 4.0 which are now part of the 4.0 -base release. The 4.2.0 version is an upgrade to 4.1.0, which include more -hardware ports, code enhancements and bug fixes. - -Release 4 also included the long-awaited integration of the DRI (Direct Ren- -dering Infrastructure). This upgrade into the code base gives XFree86 the -abilities of accelerated direct 3-D graphics rendering, used widely in games -and other visualization programs. - -While some driver available in the old 3.3.x release series have not been -converted over to the 4.x series, those required for most modern video hard- -ware are available. Please check the Driver Status document first to see -whether your hardware is supported before upgrading to the 4.x series. + XFree86 is an Open Source version of the X Window System that sup- + ports many UNIX(R) and UNIX-like operating systems (such as Linux, + FreeBSD, NetBSD, OpenBSD and Solaris x86) on Intel and other plat- + forms. This version is compatible with X11R6.6. + +1. What is XFree86 4.3.0? + +XFree86 4.3.0 is the sixth full release in the XFree86 4.x series. + +XFree86 4.x is the current XFree86 release series. The first release in this +series was in early 2000. The core of XFree86 4.x is a modular X server. +The 4.3.0 version is a new release that includes additional hardware support, +functional enhancements and bug fixes. Specific release enhancements can be +viewed in the Release Notes. + +Most modern PC video hardware is supported in XFree86 4.3.0, and most PC +video hardware that isn't supported explicitly can be used with the "vesa" +driver. The Driver Status document has a summary of what hardware is sup- +ported in 4.3.0 compared with the old 3.3.x (3.3.6) series. It is a good +idea to check there before upgrading if you are currently running 3.3.6 with +older hardware. + +XFree86 is produced by The XFree86 Project, Inc, which is a group of mostly +volunteer independent developers. XFree86 is a non-commercial organisation, +and would not be viable without the invaluable development contributions of +volunteers. This release is dedicated to all who have supported and con- +tributed to XFree86 over the last eleven years. + +2. Pointers to additional information + +The documentation for this release can be found online at the XFree86 web +site . Documentation for the latest +release version can always be found here , and documentation for the latest pre-release snapshot can be found +here . Checking those last two links +is a good way of finding out the latest versions available from XFree86. -Specific release enhancements can be viewed in the Release Notes. - -The XFree86 version numbering system has had some changes as of the 4.0.2 -release. Information about this can be found in the Versions Document. - Information about binary distributions and the attendant installation instructions can be found in the Installation Document. Copyright and Licensing information for this release and all XFree86 releases can be found in the License Document. -2. Joining The Team +The XFree86 version numbering system (including historical information) can +be found in the Versions Document. -2.1 Development +Additional information may be available at the XFree86 web site +, and pointers to other information are avail- +able at the XFree86 support page . -If you would like to work on the development of XFree86 4, either by helping -with the conversion of our older drivers to the new 4.x design, or assisting -in the addition of new drivers or platforms to the code base then send a -request to join the XFree86 development team -. This will give you direct -access to the latest XFree86 related development topics and discussions. -Include in your note, your name, email address, reason for joining (what you -will work on) and, level of expertise (coder, DRI, core, specific driver) and -area of interest. - -2.2 Documentation - -If instead your interests are on the Documentation side of the Project, or -you want to contribute and are not ready for plunging into the code, you can -join the Documentation Team (those hardy souls responsible for the content -you are reading :-). Amongst the Doc Team's activities are converting our -SGML based documentation into an XML based one and updating and creating -technical documentation used by staff and public. If this sounds interesting -then please send a request to join the XFree86 documentation team -. Include in your note, you name, email -address, reason for joining (what you will work on) and level of expertise -and whether you are interested in the tools or content side of the group. - 3. The Public Mailing Lists - -3.1 Newbie - -For those who are new to XFree86 and want to learn more about our Project we -recommend that you join our Newbie list, located at Public Mailing Lists -, where this and other discus- -sions occur with our senior all-volunteer staff. This is great forum to get -introduced to XFree86 and ask for help on how to set up the XServer or -whether your hardware is supported, and why not?, and make suggestions for -future releases of XFree86. This list is supported by our volunteer staff -who needs to know how you are using and interacting with XFree86 and what is -wrong and could be better. Tell them, they want to know! - -3.2 Announce - -For those who just want to know the release schedule this is a good list to -join. -3.3 CVS Commit +3.1 CVS Commit For those who want to see what has been committed recently to our CVS reposi- tory this is the list that will show you those updates. This list is updated dynamically every time the repository is updated after the the commit hap- pens. -3.4 Xpert +3.2 Devel -If instead you are the lone developer who is improving XFree86 on an ad hoc -basis for your particular environment (I want to get my mouse or video card -to work), and need a specific question asked then you should go over to our -Xpert list where such questions are raised and answered by our technical -development staff. Remember you do not have to be a member to write fixes to -our code base and if your changes are discrete and self-contained the volume -of developer mail may just be too noisy. - -Once your work is finished (coded, debugged and documented) please send your -fix to . This will ensure that they are included in -future releases. And thanks! You make this truly an Open group. +This list is available for discussions about XFree86 development and for fol- +lowing up well-defined bug reports. Many experienced XFree86 developers are +present on this list. -4. How to get XFree86 4.2.0 +3.3 XFree86 -XFree86 4.2.0 can be found at the XFree86 ftp server -, and at mirrors of this +This list is available for any discussions and questions related to XFree86. +Support related questions should be sent here. Many experienced XFree86 +developers monitor this list. + +4. Contributing to XFree86 + +If you have any new work or enhancements/bug fixes for existing work, please +submit them to . This will ensure that they are included +in future releases. For new work, it's usually a good idea to discuss it +first on the list. + +5. How to get XFree86 4.3.0 + +XFree86 4.3.0 can be found at the XFree86 ftp server +, and at mirrors of this server. Information about obtaining and installing binary distributions of this release can be found in the Installation Document. Information about obtaining the release in source form is given below. -The source for version 4.2.0 is split into three tarballs: X420src-1.tgz, -X420src-2.tgz, X420src-3.tgz. The first contains everything except the fonts -and general X11 documentation. It is sufficient for building XFree86 if you -already have a set of fonts. The second contains the fonts and the source -for the general X11 documentation. The third contains the general X11 docu- -mentation in hardcopy format. - -A source patch relative to version 4.1.0 is also available. Because of its -size, it is split into four parts. The patch files are 4.1.0-4.2.0.diff1.gz, -4.1.0-4.2.0.diff2.gz, 4.1.0-4.2.0.diff3.gz and 4.1.0-4.2.0.diff4.gz. There +The source for version 4.3.0 is split into seven tarballs: X430src-1.tgz, +X430src-2.tgz, X430src-3.tgz, X430src-4.tgz, X430src-5.tgz, X430src-6.tgz and +X430src-7.tgz. The first three contain everything except the fonts and gen- +eral X11 documentation. Those three are sufficient for building XFree86 if +you already have a set of fonts. The fourth and fifth contain the fonts. +The sixth contains the source for the general X11 documentation. The seventh +contains the general X11 documentation in hardcopy format. + +A source patch relative to version 4.2.0 is also available. Because of its +size, it is split into four parts. The patch files are 4.2.0-4.3.0.diff1.gz, +4.2.0-4.3.0.diff2.gz, 4.2.0-4.3.0.diff3.gz and 4.2.0-4.3.0.diff4.gz. There is also a tarball that contains some files that have components that can't be -included in a diff. It is 4.2.0.tgz. These patches should be applied to a -clean 4.1.0 source tree, working from the directory containing the xc/ direc- +included in a diff. It is 4.3.0.tgz. These patches should be applied to a +clean 4.2.0 source tree, working from the directory containing the xc/ direc- tory. The patches should be applied by running: - - gzip -d < 4.1.0-4.2.0.diff1.gz | patch -p0 -E - gzip -d < 4.1.0-4.2.0.diff2.gz | patch -p0 -E - gzip -d < 4.1.0-4.2.0.diff3.gz | patch -p0 -E - gzip -d < 4.1.0-4.2.0.diff4.gz | patch -p0 -E - - rm -f xc/extras/freetype2/builds/mac/ftlib.prj - rm -fr xc/extras/freetype2/docs/design - rm -fr xc/extras/freetype2/docs/glyphs - rm -fr xc/extras/freetype2/docs/image - rm -fr xc/extras/freetype2/docs/tutorial - rm -f xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib - rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings - rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib - gzip -d < 4.2.0.tgz | tar vxf - + gzip -d < 4.2.0-4.3.0.diff1.gz | patch -p0 -E + gzip -d < 4.2.0-4.3.0.diff2.gz | patch -p0 -E + gzip -d < 4.2.0-4.3.0.diff3.gz | patch -p0 -E + gzip -d < 4.2.0-4.3.0.diff4.gz | patch -p0 -E + + rm -f xc/doc/hardcopy/Xext/mit-shm.PS.gz + rm -f xc/doc/hardcopy/saver/saver.PS.gz + rm -fr xc/fonts/scaled/Ethiopic + rm -fr xc/fonts/scaled/Meltho + rm -fr xc/programs/Xserver/hw/darwin/bundle + rm -f xc/programs/Xserver/hw/hp/input/drivers/XHPKeymaps + rm -f xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07 + rm -f xc/programs/Xserver/hw/xwin/X.ico + rm -fr xc/programs/xcursorgen/redglass + rm -fr xc/programs/xcursorgen/whiteglass + touch xc/extras/Mesa/src/Trace/tr_attrib.c + touch xc/lib/fontconfig/NEWS -The contrib part of the distribution was folded into the main source tree a -while ago, so a separate contrib tarball is not required. + gzip -d < 4.3.0.tgz | tar vxf - To format the XFree86 documentation use the latest version of our doctools -package available as doctools-1.3.tgz. - -The XFree86 source code can also be accessed via the XFree86 CVS repository. -Information about accessing this can be found at the CVS page +package available from the XFree86 CVS repository's "doctools" module, and +from our ftp site . + +The XFree86 source code for this and all releases/snapshots as well as devel- +opment versions can also be accessed via the XFree86 CVS repository. Infor- +mation about accessing this can be found at the CVS page on our web site. It's also possible to browse the XFree86 CVS repository at our CVSWeb server -. +. The CVS tag for this version is +"xf-4_3_0". The CVS tag for the stable branch for this release is +"xf-4_3-branch". To check out the latest development version, don't specify +any tag. -5. Reporting Bugs +6. Reporting Bugs Bugs should be reported to . Before reporting bugs, -please check the X server log file, which can be found at +please check the XFree86 server log file, which can be found at /var/log/XFree86.0.log on most platforms. If you can't resolve the problem yourself, send the entire log file with your bug report but not the operating system core dump. Do not edit the log file as our developers use it to reproduce and debug your problem. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.119 2002/01/16 19:40:48 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.134 2003/02/27 01:19:32 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.116 2002/01/16 20:51:01 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.129 2003/02/27 02:16:18 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DECtga diff -u xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.19 xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.24 --- xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.19 Thu Nov 15 12:37:21 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DECtga Sun Feb 23 23:03:21 2003 @@ -6,7 +6,7 @@ 1. DEC 21030 - o The DEC 21030 is supported by XFree86 4.2.0. The driver is now par- + o The DEC 21030 is supported by XFree86 4.3.0. The driver is now par- tially accelerated. The built-in graphics on the Multia is supported in 8-plane mode, and PCI cards with 8 or 16 MB framebuffers are supported in 24-plane mode. TGA2 (aka PowerStorm 3D30/4D20) cards are not cur- @@ -65,4 +65,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DECtga.sgml,v 3.9 2000/03/06 22:59:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.19 2001/11/15 17:37:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.24 2003/02/24 04:03:21 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DRI diff -u xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.19 xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.21 --- xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.19 Mon Jan 7 17:07:16 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.DRI Sun Feb 16 23:04:07 2003 @@ -30,7 +30,7 @@ 2. Introduction -With XFree86 4.0 and the Direct Rendering Interface (DRI), hardware acceler- +With XFree86 4.x and the Direct Rendering Interface (DRI), hardware acceler- ated 3D graphics can be considered a standard feature on Linux workstations. Support for other operating systems, such as FreeBSD, is underway. @@ -39,9 +39,9 @@ OpenGL. See the resources section at the end for more documentation and software downloads. -This document does not cover compilation or installation of XFree86 4.0. It +This document does not cover compilation or installation of XFree86 4.x. It is assumed that you've already installed a Linux distribution which includes -XFree86 4.0 or that you're an experienced Linux developer who has compiled +XFree86 4.x or that you're an experienced Linux developer who has compiled the DRI for himself. DRI download, compilation and installation instructions can be found at http://dri.sourceforge.net/DRIcompile.html @@ -72,7 +72,7 @@ 3.2 Graphics Hardware -XFree86 4.0 (or later versions) includes 3D acceleration for the following +XFree86 4.2 (or later versions) includes 3D acceleration for the following graphics hardware: o 3dfx, supported on Intel x86, AMD and Alpha: @@ -104,7 +104,7 @@ o Matrox G400 - o Intel i810 (motherboard chipset) + o Intel i810/i815/i830 (motherboard chipsets) o i810 @@ -112,6 +112,10 @@ o i810e + o i815 + + o i830 + o ATI Rage 128, supported on Intel x86, AMD and Alpha: o Rage Fury @@ -139,6 +143,16 @@ o Radeon 32MB SDR PCI (Alpha-based systems) + o Radeon 7000, M6 (RV100) + + o Radeon 7200 (R100) + + o Radeon 7500, M7 (RV200) + + o Radeon 8500, 9100 (R200) + + o Radeon 9000, M9 (RV250) + o 3Dlabs, supported on Intel x86 and AMD: o Oxygen GMX 2000 (MX/Gamma based). Note: this driver is no longer @@ -271,10 +285,10 @@ 8.1 libGL.so Your OpenGL program must link with the libGL.so.1.2 library provided by -XFree86 4.0. The libGL.so.1.2 library contains a GLX protocol encoder for -indirect/remote rendering and DRI code for accessing hardware drivers. In -particular, be sure you're not using libGL.so from another source such as -Mesa or the Utah GLX project. +XFree86. The libGL.so.1.2 library contains a GLX protocol encoder for indi- +rect/remote rendering and DRI code for accessing hardware drivers. In par- +ticular, be sure you're not using libGL.so from another source such as Mesa +or the Utah GLX project. Unless it was built in a special way, the libGL.so library does not contain any 3D hardware driver code. Instead, libGL.so dynamically loads the appro- @@ -1237,7 +1251,7 @@ o In the future there may be IHV and Linux vendor support resources for the DRI. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.27 2002/01/07 22:05:57 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.29 2003/02/17 03:57:29 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.19 2002/01/07 22:07:16 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.21 2003/02/17 04:04:07 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp diff -u xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.13 xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.16 --- xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.13 Mon Jan 7 17:07:16 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp Mon Nov 25 21:24:01 2002 @@ -30,59 +30,55 @@ 2. Introduction -This document describes how to download, compile and install the DRI project. -The DRI provides 3D graphics hardware acceleration for the XFree86 project. -This information is intended for experienced Linux developers. Beginners are +This document describes how to download, compile and install the DRI. The +DRI provides 3D graphics hardware acceleration for the XFree86 project. This +information is intended for experienced Linux developers. Beginners are probably better off installing precompiled packages. Edits, corrections and updates to this document may be mailed to . +stengraphics.com>. +Last updated on 13 February 2002 by Brian Paul. + 3. Prerequisites You'll need the following: + o An installation of XFree86 4.1 or later. The DRI tree has been pruned + down to minimize its size. But in order to build the DRI tree you need + to have recent X header files, etc. already installed. If you don't + have XFree86 4.1 (or later) installed you can probably install it from + RPMs (or another package format). Or, you can download XFree86 as + sources and compile/install it yourself. + o At least 200MB of free disk space. If you compile for debugging (the -g option) then you'll need about 600MB. o GCC compiler and related tools. - o ssh (secure shell) for registered developer downloading of the DRI - source tree + o ssh (secure shell) if you're a DRI developer and don't want to use + anonymous CVS download. - o A recent Linux Kernel. See below for details. + o A 2.4.x Linux Kernel. See below for details. o FreeBSD support is not currently being maintained and may not work. The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How- -ever, there is limited support for Alpha and PowerPC support is underway. - -For 3dfx Voodoo3 hardware, you'll also need: - - o Glide3 headers and runtime library if you want to use the 3dfx driver. - These can be obtained from linux.3dfx.com. - - o A recent Linux 2.4.x kernel. AGP support is not required. - -For Matrox G200/G400 hardware, you'll also need: - - o A recent Linux 2.4.x kernel with AGP support. - -For Intel i810 hardware, you'll also need: - - o A recent Linux 2.4.x kernel with AGP support. - -For ATI Rage 128 and Radeon hardware, you'll also need: +ever, limited support for Alpha and PowerPC support is underway. - o A recent Linux 2.4.x kernel with AGP support. +For 3dfx Voodoo hardware, you'll also need the Glide3 runtime library +(libglide3-v3.so for Voodoo3 or libglide3-v5.so for Voodoo4/5). These can be +downloaded from the DRI website. You can compile them yourself, but it's +often a painful process. + +For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, you'll +also need AGP support in your Linux kernel, either built-in or as a loadable +module. 4. Linux Kernel Preparation -The DRI project closely tracks Linux kernel development. Since the internal -Linux data structures might change in the 2.4 Linux kernel, it's important to -use the most recent Linux kernel and not an old, intermediate development -release. As of this writing (Jan 2001), 2.4.0 is the most recent version of -Linux which the DRI is synchronized to. +Only the Linux 2.4.x kernels are currently supported by the DRI hardware +drivers. 2.5.x kernels may work, but aren't tested. Most of the DRI drivers require AGP support and using Intel Pentium III SSE optimizations also requires an up-to-date Linux kernel. Configuring your @@ -188,10 +184,9 @@ 5.1 Intel Pentium III Features -The Pentium III SSE (Katmai) instructions are used in optimized vertex trans- -formation functions in the Mesa-based DRI drivers. On Linux, SSE requires a -recent kernel (such as 2.4.0-test11 or later) both at compile time and run- -time. +The Pentium III SSE instructions are used in optimized vertex transformation +functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent +kernel (such as 2.4.0-test11 or later) both at compile time and runtime. 5.2 AMD 3DNow! Features @@ -225,9 +220,8 @@ 6. Downloading the XFree86/DRI CVS Sources -The DRI project is hosted by VA Linux Systems' SourceForge. The DRI source -code, which is a subset of the XFree86 source tree, is kept in a CVS reposi- -tory there. +The DRI project is hosted by SourceForge. The DRI source code, which is a +subset of the XFree86 source tree, is kept in a CVS repository there. The DRI CVS sources may be accessed either anonymously or as a registered SourceForge user. It's recommended that you become a registered SourceForge @@ -341,7 +335,6 @@ #define LinuxDistribution LinuxRedHat #define DefaultCCOptions -ansi GccWarningOptions -pipe #define BuildXF86DRI YES - #define HasGlide3 YES /* Optionally turn these on for debugging */ /* #define GlxBuiltInTdfx YES */ /* #define GlxBuiltInMga YES */ @@ -351,24 +344,26 @@ #define SharedLibFont NO The ProjectRoot variable specifies where the XFree86 files will be installed. -You probably don't want to use /usr/X11R6/ because that would overwrite your -default X files. The following is recommended: +We recommend installing the DRI files over your existing XFree86 installation +- it's generally safe to do and less error-prone. This policy is different +than what we used to recommend. - #define ProjectRoot /usr/X11R6-DRI +If XFree86 4.x is not installed in /usr/X11R6/ you'll have to add the follow- +ing to the host.def file: -Especially note the XF86CardDrivers line to be sure your driver is listed. + #define ProjectRoot pathToYourXFree86installation -If you have 3dfx hardware be sure that the Glide 3x headers are installed in -/usr/include/glide3/ and that the Glide 3x library is installed at -/usr/lib/libglide3.so. +Note the XF86CardDrivers line to be sure your card's driver is listed. -If you do not have 3dfx hardware comment out the HasGlide3 line in host.def. - If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you should add the following: #define MesaUse3DNow YES +You don't have to be using an AMD processor in order to enable this option. +The DRI will look for 3DNow! support and runtime and only enable it if appli- +cable. + If you want to enable SSE optimizations in Mesa and the DRI drivers, you must upgrade to a Linux 2.4.x kernel. Mesa will verify that SSE is supported by both your processor and your operating system, but to build Mesa inside the @@ -377,20 +372,20 @@ /usr/src/linux, Mesa will not compile. You have been warned. If you do have a 2.4.x kernel, you should add the following: - #define MesaUseKatmai YES + #define MesaUseSSE YES 8.3 Compilation To compile the complete DRI tree: cd ~/DRI-CVS/build/xc/ - make World >& World.LOG + make World >& world.log Or if you want to watch the compilation progress: cd ~/DRI-CVS/build/xc/ - make World >& World.LOG & - tail -f World.LOG + make World >& world.log & + tail -f world.log With the default compilation flags it's normal to get a lot of warnings dur- ing compilation. @@ -403,7 +398,7 @@ 8.4 Check for compilation errors -Using your text editor, examine World.LOG for errors by searching for the +Using your text editor, examine world.log for errors by searching for the pattern ***. Verify that the DRI kernel module(s) for your system were built: @@ -435,7 +430,7 @@ 8.5 DRI kernel module installation -The DRI kernel modules are in ~/DRI-CVS/build/xc/pro- +The DRI kernel modules will be in ~/DRI-CVS/build/xc/pro- grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/. To load the appropriate DRM module in your running kernel you can either use @@ -450,110 +445,54 @@ 9. Normal Installation and Configuration -Most users will want to install the new X server and use it instead of the -original X server. This section explains how to do that. We assume that the -user is upgrading from XFree86 3.3.x. +Most users will want to install the new X server and use it in place of their +old X server. This section explains how to do that. Developers, on the other hand, may just want to test the X server without actually installing it as their default server. If you want to do that, skip to the next section. -9.1 X Installation +9.1 Installation -You'll need to run as root to do the following commands: +Here are the installation commands: su - -As mentioned above, the installation directory is specified by the Project- -Root variable in the host.def file. Create that directory now if it doesn't -already exist, then run the install commands: - - mkdir /usr/X11R6-DRI cd ~/DRI-CVS/build/xc make install - -9.2 Linker configuration - -Edit your /etc/ld.so.conf file and put /usr/X11R6-DRI/lib as the first line. -Then run: - - ldconfig - -This will ensure that you use the new X libraries when you run X programs. - -9.3 Update Locale Information -To update your X locale information do the following: +9.2 Update the XF86Config File - cd ~/DRI-CVS/build/xc/nls - ../config/util/xmkmf -a - make - make install +You may need to edit your XF86Config file to enable the DRI. The config file +is usually installed as /etc/X11/XF86Config-4. See the DRI User Guide for +details, but basically, you need to load the "glx" and "dri" modules and add +a "DRI" section. -This will prevent a locale error message from being printed when you run Xlib -programs. - -9.4 Setup Miscellaneous Files - -Issue the following commands: - - cd /usr/X11R6-DRI/lib/X11 - ln -s /usr/X11R6/lib/X11/rgb.txt . - ln -s /usr/X11R6/lib/X11/fonts . - ln -s /usr/X11R6/lib/X11/app-defaults . - -This will allow applications to use the fonts and resources that they used in -the past. - -9.5 Disable the Old X Server and Enable the New One - -Assuming that an installation of XFree86 3.3.x is present, we need to disable -the old 3.3.x X server and enable the new 4.0.x X server. +On the DRI web site, in the resources section, you'll find example XF86Config +files for a number of graphics cards. These configuration files also setup +DRI options so it's highly recommended that you look at these examples. -Issue the following commands: +The XFree86 4.x server can generate a basic configuration file itself. Sim- +ply do this: cd /usr/X11R6/bin - mv Xwrapper Xwrapper.old - rm X - ln -s /usr/X11R6-DRI/bin/XFree86 X - -This will cause the new X server to be used instead of the original one. - -9.6 Create the XF86Config File - -Configuration files for XFree86 3.3.x will not work with XFree86 4.0.x. - -The new 4.0.x server can generate a basic configuration file itself. Simply -do this: - - cd /usr/X11R6-DRI/bin ./XFree86 -configure A file named /root/XF86Config.new will be created. It should allow you to try your X server but you'll almost certainly have to edit it. For example, you should add HorizSync and VertRefresh options to the Monitor section and Modes options to the Screen section. Also, the ModulePath option in the -Files section should be set to /usr/X11R6-DRI/lib/modules. - -On the DRI web site, in the resources section, you'll find example XF86Config -files for a number of graphics cards. These configuration files also setup -DRI options so it's highly recommended that you look at these examples. - -In any case, your new XF86Config file should be placed in /etc/X11/XF86Con- -fig-4. This configuration file will be recognized by the 4.0.x server but -not by 3.3.x servers. You can instead name it /etc/X11/XF86Config but -that'll overwrite your old config file, which you may want to preserve. +Files section should be set to /usr/X11R6/lib/modules. -9.7 Start the New X Server +9.3 Start the New X Server The new X server should be ready to use now. Start your X server in your -usual manner. Typically, the startx command is used: +usual manner. Often times the startx command is used: startx 10. Testing the Server Without Installing It -As mentioned at the start of section 8, developers may want to simply run the +As mentioned at the start of section 9, developers may want to simply run the X server without installing it. This can save some time and allow you to keep a number of X servers available for testing. @@ -563,7 +502,7 @@ file for the new server. Put the XF86Config file in your ~/DRI- CVS/build/xc/programs/Xserver directory. -Be sure the ModulePath option is set correctly. +Be sure the ModulePath option in your XF86Config file is set correctly. 10.2 A Startup Script @@ -598,7 +537,7 @@ ated direct rendering. Please read the DRI User Guide for information about trouble shooting and how to use the DRI-enabled X server for 3D applications. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.16 2002/01/07 22:05:57 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 2002/11/26 01:05:50 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.13 2002/01/07 22:07:16 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.16 2002/11/26 02:24:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.Darwin diff -u xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.8 xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.13 --- xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.8 Wed Dec 19 19:15:41 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.Darwin Sun Feb 23 23:03:21 2003 @@ -66,7 +66,7 @@ If you don't feel the need to live on the cutting edge, you can save some time and effort by using the precompiled binaries available on the XFree86 -FTP server at . Fol- +FTP server at . Fol- low the instructions in the Install document to install it. This will create two new directory trees, /usr/X11R6 and /etc/X11 For Mac OS X Quartz support, download the optional Xquartz.tgz tarball. With Quartz support, the XDarwin @@ -187,4 +187,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml,v 1.9 2001/12/13 07:09:05 torrey Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Darwin,v 1.8 2001/12/20 00:15:41 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Darwin,v 1.13 2003/02/24 04:03:21 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS diff -u xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.30 xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.35 --- xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.30 Thu Nov 15 12:37:22 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.LynxOS Sun Feb 23 23:03:21 2003 @@ -1,4 +1,4 @@ - README for XFree86 4.2.0 on LynxOS + README for XFree86 4.3.0 on LynxOS Thomas Mueller @@ -13,19 +13,19 @@ See the Copyright Notice. -The sources for XFree86 4.2.0 are available by anonymous ftp from: +The sources for XFree86 4.3.0 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.2.0 +ftp://ftp.XFree86.org/pub/XFree86/4.3.0 Binaries of XFree86 for LynxOS x86 are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.2.0/binaries/LynxOS +ftp://ftp.XFree86.org/pub/XFree86/4.3.0/binaries/LynxOS A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR- RORS The binaries on the FTP site were built on the latest released LynxOS version -at the time XFree86 4.2.0 was released. In this case it is `LynxOS x86 +at the time XFree86 4.3.0 was released. In this case it is `LynxOS x86 3.0.1'. Because of changes made to the object format they don't run on LynxOS versions earlier than 3.0.0. @@ -37,7 +37,7 @@ 3.1.0' support has to be considered to be in `alpha state'. Initial tests were performed on LynxOS x86 only! -XFree86 4.2.0 supports LynxOS on the x86 and on the PowerPC platform. X +XFree86 4.3.0 supports LynxOS on the x86 and on the PowerPC platform. X servers are currently available only on the x86 platform. The X server may work with some PowerPC platforms supported by LynxOS though this has not (yet) been thoroughly tested. @@ -163,7 +163,7 @@ 3.5 X Server debug diagnostics output and other VT peculiarities Output made by the XFree86 X on its stdout or stderr will be lost after the -server switches to graphics mode. The XFree86 4.2.0 server stores its output +server switches to graphics mode. The XFree86 4.3.0 server stores its output in /usr/adm/XFree86.n.log (where n is the screen number). When the X server is running output made to other consoles will be lost. @@ -266,4 +266,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LynxOS.sgml,v 3.20 2000/06/17 00:27:32 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.30 2001/11/15 17:37:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.35 2003/02/24 04:03:21 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD diff -u xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.80 xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.87 --- xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.80 Wed Jan 16 17:37:23 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.NetBSD Sun Feb 23 23:03:22 2003 @@ -1,23 +1,24 @@ - README for XFree86 4.2.0 on NetBSD + README for XFree86 4.3.0 on NetBSD Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb - Last modified on: 16 January 2002 + Last modified on: 9 November 2002 1. What and Where is XFree86? -XFree86 is the Open Source port of X.Org's X11R6.6 release that supports sev- -eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat- -ing systems on Intel and other platforms. +XFree86 is an Open Source version of the X Window System that supports sev- +eral UNIX(R) and UNIX-like operating systems (such as Linux, the BSDs and +Solaris x86) on Intel and other platforms. This version is compatible with +X11R6.6. See the Copyright Notice. The sources for XFree86 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.2.0 +ftp://ftp.XFree86.org/pub/XFree86/4.3.0 -Binaries for NetBSD 1.4 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.2.0/binaries/NetBSD +Binaries for NetBSD 1.5 and later are available from: +ftp://ftp.XFree86.org/pub/XFree86/4.3.0/binaries/NetBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml @@ -33,7 +34,7 @@ 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.2.0. +See the Release Notes for non-OS dependent new features in XFree86 4.3.0. 3.1 New OS dependent features in 4.2.0 @@ -111,7 +112,7 @@ 5.1 About mouse configuration -XFree86 4.2.0 has support for the mouse driver included in the wscons console +XFree86 4.3.0 has support for the mouse driver included in the wscons console driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the protocol and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're using NetBSD 1.4 or later with a PS/2 mouse. @@ -229,14 +230,14 @@ access to the /dev/mem device when in multi-users mode. But XFree86 servers can take advantage (or require) linear access to the display memory. -Most XFree86 4.2.0 card drivers require linear memory access. There are two +Most XFree86 4.3.0 card drivers require linear memory access. There are two ways to allow XFree86 to access linear memory: The first way is to disable the kernel security feature by adding ``option INSECURE'' in the kernel configuration file and build a new kernel. The second way is to install the aperture driver, included in source form in -xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.2.0 source +xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.3.0 source distribution. Unpack it in a new directory of your choice by running: sh apNetBSD.shar @@ -374,10 +375,11 @@ 10. Thanks Many thanks to all people who contributed to make XFree86 work on *BSD, in -particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, -Nate Williams, Rod Grimes, Jack Velte and Michael Smith. +particular: David Dawes, Todd Fries, Rod Grimes, Charles Hannum, Amancio +Hasty, Christoph Robitschko, Matthias Scheler, Michael Smith, Ignatios Sou- +vatzis, Jack Velte, Nate Williams and Pace Willison. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.63 2002/01/16 22:35:18 herrb Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.68 2003/02/16 17:21:11 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.80 2002/01/16 22:37:23 herrb Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.87 2003/02/24 04:03:22 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD diff -u xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.30 xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.38 --- xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.30 Wed Jan 16 17:37:23 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD Tue Feb 25 16:32:34 2003 @@ -1,29 +1,30 @@ - README for XFree86 4.2.0 on OpenBSD + README for XFree86 4.3.0 on OpenBSD Matthieu Herrb - Last modified on: 16 January 2002 + Last modified on: 9 November 2002 1. What and Where is XFree86? -XFree86 is the Open Source port of X.Org's X11R6.6 release that supports sev- -eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat- -ing systems on Intel and other platforms. +XFree86 is an Open Source version of the X Window System that supports sev- +eral UNIX(R) and UNIX-like operating systems (such as Linux, the BSDs and +Solaris x86) on Intel and other platforms. This version is compatible with +X11R6.6. See the Copyright Notice. -The sources for XFree86 4.2.0 are available by anonymous ftp from: +The sources for XFree86 4.3.0 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.2.0 +ftp://ftp.XFree86.org/pub/XFree86/4.3.0 -Binaries for OpenBSD/i386 3.0 and later are available from: +Binaries for OpenBSD/i386 3.2 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.2.0/binaries/OpenBSD +ftp://ftp.XFree86.org/pub/XFree86/4.3.0/binaries/OpenBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml XFree86 also builds on other OpenBSD architectures. See section Building on -other architectures (section 8.2, page 1) for details. +other architectures (section 8., page 1) for details. 2. Bug Reports for This Document @@ -32,21 +33,25 @@ 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.2.0. +See the Release Notes for non-OS dependent new features in XFree86 4.3.0. -3.1 New OS dependent features in 4.2 +3.1 New OS related features in 4.3 - o Support for OpenBSD/macppc on the ATI Rage128 based Power Macintosh. + o Support for some VGA cards on OpenBSD/alpha +3.2 New OS dependent features in 4.2 + + o Support for OpenBSD/macppc on the ATI Rage128 based Power Macintoshes. + o Support for building clients on OpenBSD/sparc64. -3.2 New OS dependent features in 4.0.3 +3.3 New OS dependent features in 4.0.3 o Support for the wscons console driver in post 2.8 OpenBSD. o A fix for multi-threaded libraries support. -3.3 New OS dependent features in 4.0.2 +3.4 New OS dependent features in 4.0.2 o Support for the OpenBSD ports tree, @@ -57,7 +62,7 @@ o startx now creates an Xauthority magic cookie for the display. -3.4 New OS dependent features in 4.0.1 +3.5 New OS dependent features in 4.0.1 o Several features from the OpenBSD X11 tree were merged into xdm: @@ -76,21 +81,21 @@ o The Xsun server can be built again on OpenBSD/sparc. -3.5 New OS dependent features in 4.0 +3.6 New OS dependent features in 4.0 o Multi-thread safe libraries are built by default on OpenBSD 2.6 and later, o Preliminary APM support. -3.6 New OS dependent features in 3.9.18 +3.7 New OS dependent features in 3.9.18 o Support for USB mices has been added on OpenBSD. o Soft-booting secondary cards through the int10 BIOS interface is now possible using the x86emu real mode emulator. -3.7 New OS dependent features in 3.9.17 +3.8 New OS dependent features in 3.9.17 o Silken mouse is supported for serial mices, and, under post 2.6 OpenBSD- current for PS/2 mices. @@ -128,7 +133,7 @@ 5.1 About mouse configuration -XFree86 4.2.0 has support for the mouse driver included in the new wscons +XFree86 4.3.0 has support for the mouse driver included in the new wscons console driver introduced by OpenBSD-2.9. Specify ``wsmouse'' as the proto- col and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're using OpenBSD-2.9 or later with a PS/2 or USB mouse. @@ -171,7 +176,6 @@ To make sure X support is enabled under OpenBSD, the following line must be in your config file in /sys/arch/i386/conf: - option XSERVER option APERTURE 7.1 Console drivers @@ -217,60 +221,42 @@ OpenBSD supports System V shared memory. If XFree86 detects this support in your kernel, it will support the MIT-SHM extension. -To add support for system V shared memory to your kernel add the lines: - - # System V-like IPC - options SYSVMSG - options SYSVSEM - options SYSVSHM - -to your kernel config file. - 8. Rebuilding the XFree86 Distribution You should configure the distribution by editing xc/config/cf/host.def before compiling. To compile the sources, invoke ``make World'' in the xc directory." - -8.1 Console drivers - -XFree86 has a configuration option to select the console drivers to use in -host.def: - o if you're using pccons only put: - - #define XFree86ConsoleDefines -DPCCONS_SUPPORT - - o if you're using pcvt only put: +Note that OpenBSD project now has its own source tree, based on the XFree86 +source tree, with some local modifications. You may want to start with this +tree to rebuild from sources. The OpenBSD XF4 source tree is available by +anoncvs from all OpenBSD anoncvs servers. See http://www.openbsd.org/anon- +cvs.html for details on anoncvs. - #define XFree86ConsoleDefines -DPCVT_SUPPORT +XFree86 also compiles on other OpenBSD architectures. -If you don't define XFree86ConsoleDefines in host.def the pccons and pcvt -drivers will be supported by default. +8.1 XFree86 on OpenBSD/alpha -Native support for the wscons console driver found on OpenBSD/macppc and on -OpenBSD/i386 2.9 and later is built by adding: +The XFree86 server is known to work on some VGA cards in alpha machines that +support BWX I/O, with OpenBSD 3.2 and higher. - #define XFree86ConsoleDefines -DWSCONS_SUPPORT +The following cards have been successfully tested for now: -to xc/config/host.def before rebuilding the server. + o 3DLabs Permedia 2 (8, 15, 16 and 24 bits depth) -For the i386, you should include both pcvt and wscons support in order to use -the pcvt compatibility mode of wscons: + o ATI Rage Pro (works with 'Option "NoAccel"') - #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT + o Cirrus Logic CL5430 (works with 'Option "NoAccel"') -8.2 Building on other architectures + o Cirrus Logic GD5446 (8, 16 and 24 bits depth) -XFree86 also compiles on other OpenBSD architectures. + o Matrox MGA 2064 (8, 16 and 24 bits depth) -Note that OpenBSD project now has its own source tree, based on the XFree86 -source tree, with some local modifications. You may want to start with this -tree to rebuild from sources. The OpenBSD XF4 source tree is available by -anoncvs from all OpenBSD anoncvs servers. See http://www.openbsd.org/anon- -cvs.html for details on anoncvs. +Note that this version of XFree86 doesn't work on TGA cards. The version +shipped with OpenBSD 3.1 and higher includes an OS-specific driver wsfb that +is used to support TGA cards. -8.2.1 XFree86 on OpenBSD/macppc +8.2 XFree86 on OpenBSD/macppc The XFree86 server is currently known to work on the G4 Macs and new iBooks with ATI Rage 128 cards running OpenBSD 3.0 or later. Other machines are @@ -280,17 +266,22 @@ Use xf86config to build a /etc/X11/XF86Config file before starting the server for the first time. -Tou configure the keyboard, the protocol should be specified as wskbd and the -device as /dev/wskbd0. Using a wsmux device as the keyboard device doesn't -work (yet). Use macintosh as XkbModel. - For the Titanium Powerbook G4, you can try the following mode line in /etc/X11/XF86Config to match the flat panel resolution: + + Modeline "1152x768" 64.995 1152 1213 1349 1472 768 771 777 806 -HSync -VSync + +8.3 XFree86 on OpenBSD/sparc + +OpenBSD 3.2 on sparc switched to the wscons device driver and now uses the OS +specific wsfb driver in the XFree86 server. This driver is not included in +XFree86 4.3. Please use the version shipped with OpenBSD instead. - Modeline "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +HSync +VSync +8.4 XFree86 on OpenBSD/sparc64 -You need to set securelevel to -1 in the /etc/rc.securelevel configuration -file to run XFree86 on OpenBSD/macppc. +This version of XFree68 only has support for X clients on OpenBSD/sparc64. +Note that the version shipped with OpenBSD also has support for the X server +on both SBus and PCI based machines. 9. Building New X Clients @@ -303,10 +294,11 @@ 10. Thanks Many thanks to all people who contributed to make XFree86 work on *BSD, in -particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, -Nate Williams, Rod Grimes, Jack Velte and Michael Smith. +particular: David Dawes, Todd Fries, Rod Grimes, Charles Hannum, Amancio +Hasty, Christoph Robitschko, Matthias Scheler, Michael Smith, Ignatios Sou- +vatzis, Jack Velte, Nate Williams and Pace Willison. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.24 2002/01/16 22:35:17 herrb Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.30 2003/02/25 19:31:01 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.30 2002/01/16 22:37:23 herrb Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.38 2003/02/25 21:32:34 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.SCO diff -u xc/programs/Xserver/hw/xfree86/doc/README.SCO:3.32 xc/programs/Xserver/hw/xfree86/doc/README.SCO:3.34 --- xc/programs/Xserver/hw/xfree86/doc/README.SCO:3.32 Sat Jun 30 18:58:10 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.SCO Mon Feb 17 13:59:41 2003 @@ -2,206 +2,97 @@ J. Kean Johnston (jkj@sco.com) - 21 May 2001 + 14 February 2003 -1. Binary Distribution +1. Requirements -The following files are provided in the binary distribution: +Before you can either compile or execute a binary distribution of XFree86, +the following conditions must be met: - README.SCO - This file. + o Ensure that you are running Release 5.0.4 or later. This is required + because OSS646 is only supported on those platforms. There are no plans + to support XFree86 on earlier releases of OpenServer. + + o Ensure that OSS646, the ``Execution Environment Update'' package is + installed, if appropriate. Check the release notes for that update to + see whether or not your current operating system requires this update. + This supplement will be available to the public in February 2003. + + o Ensure that OSS631, the "Graphics, Web and X11 Libraries" package is + installed. This ships standard with release 5.0.7 and later, and is + only required for 5.0.[456] users. This package will be updated fairly + frequently, and it us always suggested you have the latest possible ver- + sion installed. At some point in the future it may even update the + libraries in 5.0.7, so it is worth checking the release notes for this + supplement. + + o To compile XFree86, you must use the SCO-supported version of the GNU C + Compiler. It is possible that Skunkware versions of the compiler will + work too, but this has not been tested. The ``GNU Development System'' + is available for all releases from (and including) SCO OpenServer + Release 5.0.5. It is provided with the operating system in all versions + from Release 5.0.7, although you need to run ``custom'' to install it + from the media. You can always download the latest latest version of + the GNU Development System from the SCO Web site + . + + o If you are not using OSR 5.0.7 or later, you need to get an updated con- + sole driver. See for details on OpenServer + supplements. If you can't or don't want to upgrade your console driver, + XFree86 will still compile, but you may run into problems with some + cards such as the Riva TNT and ATI Rage cards. The problem with the + console driver in 5.0.6A and earlier is that when the X server sets + graphics mode, the driver does not set a status bit, so any text that is + sent directly to /dev/console, such as kernel warning or notice messages + when you access tape drives or NFS notices, will be sent to the console + video memory. This just happens to be slap bang in the middle of + palette data for the Riva TNT, so you get color map corruption. The + updated console driver also has an improved mechanism for allocating + video memory that XFree86 detects at compile time, and it will use it if + it exists. It is STRONGLY recommended that you get the console driver + update. + +2. Compiling XFree86 + +Using the GNU Development System, compiling XFree86 should be fairly +straightforward. Before attempting to compile the system though, you should +make sure that you have met all of the requirements above. To actually start +the compilation, perform the following steps: + + o Copy the unmodified xf86site.def in xc/config/cf to host.def. Edit + host.def and make any changes you think you need. The most useful + options to change are HasTcl, HasTk, HasXdmAuth if you have the file + WrapHelp.c and GccWarningOptions. Due to the nature of OpenServer's + header files, the default options for this last setting are a bit + aggressive, and I recommend you set this option to -Wpointer-arith. + + o Make sure that the official version of the GNU Development System is + first in your PATH. The official version lives in /usr/gnu/bin, and the + Skunkware version (if any) lives in /usr/local/bin. You must ensure that + /usr/gnu/bin appears first in your PATH. + + o Go to the top level of the source tree and execute the command CC=gcc + make World BOOTSTRAPCFLAGS=-DSCO5 2>&1 | tee world.log. This will do a + full build, and send all of the build results to the file world.log. + + o If the build succeeded, install the new server by executing the command + make install 2>&1 | tee install.log as root. This will send the install + results to the file install.log. - gunzip.Z - The GNU uncompress utility. + o If you want to install the manual pages, execute the command make + install.man 2>&1 | tee -a install.log as root. - *X312Xdoc.tgz - The XFree86 specific documentation. - - X312Mono.tgz - The Mono server - - X312VG16.tgz - The 16 colour VGA server - - X312SVGA.tgz - The Super VGA server - - X312S3.tgz - The S3 server - - X3128514.tgz - The 8514 server - - X312AGX.tgz - The AGX server - - X312Mc32.tgz - The Mach 32 server - - X312Mc64.tgz - The Mach 64 server - - X312Mc8.tgz - The Mach 8 server - - X312P9k.tgz - The P9000 server - - *X312cfg.tgz - The local configuration files for xdm/fs/xinit. - - *X312bin.tgz - The bin directory, contains most executables. - - *X312lib.tgz - The shared and unshared libraries. - - *X312fnt1.tgz - 75dpi and misc fonts. - - X312fnt2.tgz - 100dpi and Speedo fonts. - - *X312inc.tgz - The X11 include files. - - X312man.tgz - The formatted man pages. - - X312lkit.tgz - The server link kit (all drivers + PEX). - - X312util.tgz - Lots of PD utilities provided as is. - - X312pex.tgz - All files relating to PEX including libraries and - header files. The LinkKit is required to obtain - servers capable of running PEX. - -To obtain a minimum XFree86 installation you will require the archives marked -with a `*' above, the server binary best suited to your machine and option- -ally "gunzip.Z". All the files are compressed with "gzip" except of course -"gunzip.Z" which is compressed using the conventional compress program. - -To install the XFree86 binaries just follow these steps. - - 1. Obtain the files you require. - - The rest of this procedure must be done as root. If you do not run the - extraction as root the permissions on the files will not be correct. - For example, the `X' server is s-bit root and will not function cor- - rectly if extracted as an ordinary user. - - 2. create a directory /usr/X11R6, permissions 755 should do nicely. - - 3. cd /usr/X11R6 - - 4. extract the archives, for example: - - gunzip < X312bin.tgz | tar xvpf - - - 5. if you have installed man pages see the later section on setting up man - pages. - - 6. Look through /usr/X11R6/lib/X11/doc/INSTALL, especially section 2 on - configuring and using XFree86. This should allow you to get a server - up and running. Before starting the server check in the later section - Before Running XFree86 (section 3., page 1), in this document, to see - if there are any system requirements you have to make for the server to - operate correctly. - -2. Source Distribution - -The SCO port comes as part of the standard XFree86 distribution. Consult the -XFree86 README for more information on the location of sources. - -Please note that as of XFree86 3.2, Only SCO Open Server Release 5 and -onwards are supported. If you are using a previous version of SCO UNIX and -you want to use XFree86, use the 3.1 series, or be prepared for build fail- -ures. - -For people who want and need to look around the source, there are now two -files in ``xc/config/cf''. Firstly, ``sco.cf'' is the old original SCO con- -figuration file, and ``sco5.cf'', which is the currently used configuration -file. - 3. Before Running XFree86 The SCO xterm terminfo description is not compatible with the xterm in the R5 distribution. To use a Bus/Keyboard or PS2 mouse you should configure the mouse drivers -under SCO as above using 'mkdev mouse'. You may then use the OsMouse option -in your XF86Config to specify that XFree86 should use the SCO mouse drivers. -To do this, set the Protocol to "OsMouse" in the Pointer section of your -XF86Config file. You can also use "OsMouse" for your serial mouse, espe- -cially if you are having trouble getting your mouse to work using the XFree86 -mouse drivers. - -If you do not have the SCO TCP/IP package installed do not panic. XFree86 -will work fine without TCP/IP but you will most likely have to do some or all -of these things: - - o Do not worry about errors from the X server complaining about - ``/dev/socksys''. The X server is configured to run on systems with and - without TCP/IP. This error is just pointing out that you do not have - TCP/IP and that this method of connecting to the server has been dis- - abled. - - o Do worry about errors involving ``/dev/spx'' or the ``sco'' connection - type. This means something is wrong with the streams pipes that are - used for connections on the local machine. First be sure that your - server has the ``s-bit'' set. You can do this by running this command - for the X server you are using: - - ls -al /usr/X11R6/bin/XF86_XXXXXX - - The output should contain the `s' character instead of the `x' charac- - ter. For example: - - -rwsr-xr-x 1 root bin 1074060 Jul 24 11:54 XF86_S3 - - is correct while: - - -rwxr-xr-x 1 root bin 1074060 Jul 24 11:54 XF86_S3 - - is not. - - o you may have to install streams into the kernel with ``mkdev streams'' - Check the SCO Manuals for more information on this. - - o you may have to configure some devices in /dev, check in the "Trouble - Shooting" section of this document for the entry which comments on - ``/dev/spx'' and ``Xsco''. - - o Your streams resources may be configured too low. You should check your - streams parameters against the following values, if the are higher then - you do not need to changes them. To check these values, login as root, - change directory to ``/etc/conf/cf.d'' and then run ``./configure''. - - Once you are running configure, choose the ``Streams Data'' option and - step through the entries. Just press at each prompt unless you - want to change a value. The values to look for, and their minimum val- - ues, are: - - NSTREAM 128 - NQUEUE 512 - NBLK4096 4 - NBLK2048 32 - NBLK1024 32 - NBLK512 32 - NBLK256 64 - NBLK128 256 - NBLK64 256 - NBLK16 256 - NBLK4 128 - NUMSP 128 - - You will not normally need to change any of these, if however you do - have to change some, configure will confirm that you want to save the - changes before exiting, and will give you further instructions on - rebuilding the unix kernel. +using 'mkdev mouse'. You may then use the OsMouse option in your XF86Config +to specify that XFree86 should use the SCO mouse drivers. To do this, set +the Protocol to "OsMouse" in the Pointer section of your XF86Config file. +You can also use "OsMouse" for your serial mouse, especially if you are hav- +ing trouble getting your mouse to work using the XFree86 mouse drivers. 4. Switching Consoles @@ -210,17 +101,21 @@ running on. If this is the last console it will take you to console 1. Ctrl- Alt-FXX, where XX is a function key between F1 and F12 will switch you to the console number assigned to that function key. F1 corresponds to tty01 (or -console 1), F2 corresponds to tty02 (or console 2) etc. Those interested in -modifying the console switching should look in xc/pro- -grams/Xserver/hw/xfree86/common/xf86Events.c. +console 1), F2 corresponds to tty02 (or console 2) etc. +Unlike the SCO X server, the "kill me now" key is Alt+Ctrl+Backspace. This +does not ask for confirmation, it simply kills the X server as immediately as +possible. Use with extreme caution. This may cause applications to termi- +nate in an unpredictable way. You can set the DontZap option in the Server- +Flags section of your XF86Config file to disable this. + 5. Setting up Man Pages After compiling the tree, or after installing the binary distribution you can get man to recognise the XFree86 man pages by adding /usr/X11R6/man to the -MANPATH in /etc/default/man, the line should look similar to: +MANPATH in /etc/default/man. The line should look similar to: - MANPATH=/usr/man:/usr/X11R6/man + MANPATH=/usr/man:/usr/gnu/man:/usr/X11R6/man:/usr/local/man This allows all users to view the X man pages. You may change your own MAN- PATH environment variable if you do not want everyone to access the man @@ -228,325 +123,21 @@ By default the man pages are compressed using ``compress'' to conserve space. If you do not want to compress the man pages change CompressManPages to NO in -your ``xf86site.def'' file. Those using the binary distribution can use -``uncompress'' to uncompress the man pages. +your ``host.def'' file. Those using the binary distribution can use ``uncom- +press'' to uncompress the man pages. Binary distributions contain pre-for- +matted versions of all man pages. If you are compiling the server yourself, +you need to have the GNU Tools package installed to get groff, the GNU nroff +replacement, to format the man pages. Use the manroff script to format the +manual pages yourself. 6. Using SCO binaries/servers. XFree86 will accept connections from SCO binaries (R3 upwards) and the SCO R5 server will also accept connections from XFree86 binaries. This means you may mix and match the two if you have ODT. For example you may still use the -Motif window manager (mwm) if you prefer. - -7. Compiling XFree86 under Open Server 5 - -As of GCC version 2.8.0, Open Server is supported. Configure it by using the -following: - - ./configure i486-sco3.2v5.0 - -There is no reason to modify gcc in any way. It compiles cleanly on Open -Server 5. - -SCO Open Server 5.0 is recognised automatically by XFree86. You do not need -to specify any BOOTSTRAPCFLAGS parameters when doing a make World. You can -ignore the warning message about BOOTSTRAPCFLAGS at the very beginning of a -make World. - - 1. Fine tune ``site.def/xf86site.def'' - - Use GCC if you can. XFree should compile with the DevSys cc, but GCC - has better optimizations, and is guaranteed to work. - - 2. SCO Open Server comes with Visual TCL, which is an old (and incompati- - ble) version of TCL. If you want to use XF86Setup you will have to com- - pile Tcl and Tk yourself. Both are supported well on SCO Open Server 5. - Tcl 7.6 and Tk 4.2 are available from ftp://ftp.smli.com/pub/tcl. - - 3. You may want to disable dynamic loading support. Several users have - reported trouble with this. XIE and PEX5 definitely do not work. If you - want to experiment, try enabling this. Please report successes or fail- - ures to me. - - 4. Do not enable the HasSVR3mmapDrv as you may have done in older versions - of SCO. Open Server 5 has full mmap() support, and this is used for - direct frame buffer access. - - 5. If you know you will not ever be using COFF binaries, and you are short - of space, set ForceNormalLib to NO. Doing this will cause only the ELF - versions of the libraries to be built. ``sco5.cf'' sets this to YES by - default, so you must explicitly set it to NO in ``xf86site.def''. All - binaries are compiled in ELF mode to reduce space. - -8. Relevant Documentation - -Some relevant documentation for SCO Users and Developers can be found in the -following files. - - README - the standard XFree86 README (/usr/X11R6/lib/X11/doc) - - README.SVR3 - Although a lot of this readme is based on Interactive a substan- - tial proportion is still relevant. - - All of the VGA/Config documentation. - /usr/X11R6/lib/X11/doc/VideoModes.doc and the README files for - particular video cards. - -9. Known Problems - - o After running the server you may see some strange characters in your - input to the shell. This is due to some unprocessed scancodes and is of - no concern. This will be fixed in a future release. - - o Not all of the applications in /usr/X11R6/bin have been debugged. - -10. Trouble Shooting - - Problem: - - The server does not start up, and I cannot tell what - is going wrong as it did not print any error messages. - - Causes: - - There can be any number of causes why the server - doesn't start. The first step is to find out what the - server has to say. To do this we have to catch the - error output of the server into a file. This output - contains a log of what the server is finding/doing as - it starts up. To get this output run: - - startx 2> /tmp/errs - - The output of the server will now be in "/tmp/errs". - You should look through this output for possible prob- - lems, and then check here in this document for any - references to the problems you are seeing. - - Problem: - - The server starts up, the screen goes blank, and I - never see anything else. It appears that my machine - has hung. - - Causes: - - Again this can have many causes. Most likely your - XF86Config is wrong. You should be able to kill the - server by typing Ctrl-Alt-BackSpace, if it is still - running. If this does not restore your display then - you may have to drive your system blind. Always keep - another login running at the shell prompt so that you - may switch to that screen and run commands even if you - cannot see anything on the screen. Try these things, - usually in the order given: - - o log out of the login where you started ``X'' and - then change consoles. This will cause the SCO - screen switching code to try to reset the card. - - o run ``vidi v80x25'', this command will also try - to set your card into a viewable mode. - - o shutdown the machine cleanly with ``shutdown'' and - try again. - - When first trying to get XFree86 to run, be sure to - use a simple setup. Get 640x480 working first then - move on to higher resolutions. Always trap the output - of the server as shown earlier. Once you have the - valid clocks for your video card (as provided in the - server output), hard code them into your XF86Config as - this will take some strain off your monitor during - XFree86 startup where it usually probes the various - clock frequencies. Getting the ``X'' screen to appear - can be a painfully slow task. Be patient and read as - much of the doco as you can handle. You will get it to - work. - - Problem: - - Fatal server error: - xf86MapVidMem:No class map defined for (XXXXX,XXXXX) - - Causes: - - 1. Your system does not have the correct - /etc/conf/pack.d/cn/class.h, You can confirm this - by editing the file and looking for the string - "SVGA", if it is not there then you should re- - install this file from the "Extended Utilities" - diskettes provided with your OS. If this is not - possible then installing the "dmmap" driver from - the distribution may allow the server to operate - correctly. - - Problem: - - xf86install does not work. - - Causes: - - You should not be running xf86install when using the - XFree86 server under SCO. It is used for Interactive - (ISC) installations. - - Problem: - - The server starts but the screen is not aligned cor- - rectly or is shaky and impossible to view. - - Causes: - - This is most likely due to an incorrect XF86Config - setup. Look for the files README.Config Video- - Modes.doc (in /usr/X11R6/lib/X11/doc with the binary - distribution). These files explains how to fix up your - video modes. - - Problem: - - 1. Can only run a limited number of xterms. - - 2. xterm does not work but other programs like xclock do work. - - Causes: - - Not enough or no pseudo ttys devices are present on - your system. Run "mkdev ptty" and increase the number - of ptty's. - - Problem: - - When running curses/termcap applications in an xterm - the output gets corrupted especially when scrolling. - - Causes: - - 1. You are running an original 1.3 distribution of XFree86. - Update to the latest version (3.2 or greater). - - 2. You have resized the window and not ran "eval `resize`" - before using your application. The SCO operating system - does not support dynamic resizing of xterms fully so this - command must be run after resizing an xterm in order for - curses/termcap applications to operate correctly. - - Problem: - - 1. When starting X it dies with an error "Cannot access a - needed shared library". - - 2. When starting an X application is dies with the above - error. - - Causes: - - 1. You do not have the binaries installed in the correct - directory. Check that they are in /usr/X11R6 - - 2. You have upgraded to a new binary distribution which has a - new version of the shared libraries which are not compati- - ble with your old binaries. To fix this you will need to - re-install the old shared libraries or recompile your - application against the new libraries. - - Problem: - - When linking against the SCO motif library I get an - unresolved external for "XtDisplayStringConversionWarn- - ing" when using gcc. - - Causes: - - The SCO library is compiled with limited length identi- - fiers. To work around this add the following code to - your application when compiling under XFree86 with gcc - and SCO motif. - - #ifdef SCO - void XtDisplayStringConversionWarnin(dpy, from, toType) - Display* dpy; - String from; - String toType; - { XtDisplayStringConversionWarning(dpy, from, toType); } - #endif - - Problem: - - The server fails to run and prints out a line similar - to: - - XFree86: Cannot open /dev/spx for ???? listener: No - such file or directory - - Causes: - - All SCO unix installations appear to have the Streams - pseudo tty driver installed, but not all the devices - are present. - - 1. there should be a /etc/conf/pack.d/sp directory, - - 2. /etc/conf/sdevice.d/sp should have a 'Y' in it. - - 3. You need a file in /etc/conf/node.d which con- - tains something like: - - clone spx c sp - sp X0S c 127 - sp X0R c 126 - sp X1S c 125 - sp X1R c 124 - sp X2S c 123 - sp X2R c 122 - sp X3S c 121 - sp X3R c 120 - sp X4S c 119 - sp X4R c 118 - sp X5S c 117 - sp X5R c 116 - sp X6S c 115 - sp X6R c 114 - sp X7S c 113 - sp X7R c 112 - - if you don't have something like this (maybe called - "Xsco") then create one and that should fix your prob- - lem. As far as I can tell the streams pseudo tty - driver should be there. - - The simplest way to get the devices if you had to cre- - ate this file is to rebuild the kernel and the environ- - ment. If you don't want to do this then: - - touch /etc/.new_unix - cd /etc/conf/bin - ./idmkenv - - and try it out. - -11. Acknowledgements - -Thanks to the Core team for their previous and continuing help with the SCO -work. Many thanks to Stacey Campbell at SCO for all the advice and insights -provided. Thanks to SCO in general for making information available for -XFree86 development. - -Thanks also to Peter Eubert (peter.eubert@iwb.mw.tu-muenchen.dbp.de) and Kent -Hamilton (kenth@stl.scscom.COM) for input on compiling under 3.2.4 systems. -Larry Plona (faxi@world.std.com) and Didier Poirot (dp@chorus.fr) for their -input on xdm and 3.2.4 compilation under 3.1. And of course the beta list -for its input on everything. - -Special thanks to Jerry Whelan (guru@stasi.bradley.edu) for providing an ftp -site for the binary distribution. - - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.18 2001/06/30 22:41:48 tsi Exp $ +Panning Motif window manager (pmwm) if you prefer. - $XConsortium: SCO.sgml /main/11 1996/10/23 11:45:55 kaleb $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.22 2003/02/17 18:58:07 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SCO,v 3.32 2001/06/30 22:58:10 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SCO,v 3.34 2003/02/17 18:59:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.SOLX86 diff -u xc/programs/Xserver/hw/xfree86/doc/README.SOLX86:3.27 xc/programs/Xserver/hw/xfree86/doc/README.SOLX86:removed --- xc/programs/Xserver/hw/xfree86/doc/README.SOLX86:3.27 Tue Feb 29 20:48:13 2000 +++ xc/programs/Xserver/hw/xfree86/doc/README.SOLX86 Thu Feb 27 12:30:23 2003 @@ -1,231 +0,0 @@ - Information for Solaris for x86 Users - - David Holland - - 25 Feb 1998 - -1. What is XFree86 - -XFree86 is a port of X11R6.3 that supports several versions of Intel-based -Unix. It is derived from X386 1.2 which was the X server distributed with -X11R5. This release consists of many new features and performance improve- -ments as well as many bug fixes. The release is available as source patches -against the X Consortium code, as well as binary distributions for many -architectures. - -The sources for XFree86 are available by anonymous ftp from: - - ftp://ftp.XFree86.org/pub/XFree86/current - -Solaris binaries for XFree86 are available for anonymous ftp from: - - ftp://ftp.XFree86.org/pub/XFree86/current/binaries/Solaris - -2. Solaris for x86, versions on which XFree86 3.3.3 has been tested - -XFree86 3.3.2 has been actively tested on: - - o Solaris 2.5.1 for x86 - - o Solaris 2.6 for x86 - -3. The VT-switching sub-system in Solaris x86 - -The virtual terminal sub-system is a undocumented, and unsupported feature of -Solaris x86. Therefore if you use Virtual Terminals, you do so at YOUR OWN -RISK. - -The virtual terminals of Solaris work basically the same way as most other -Intel based SVR4 VT sub-systems. However, there are a number of limitations -documented below. - -First, if you are running a Solaris 2.4 x86 system, and you want VT's, you -will have to create the necessary devices first, so become root. - -First verify the chanmux device driver's major number is 100: - - # grep -i chanmux /etc/name_to_major - chanmux 100 - # - -If the number after 'chanmux' is anything but 100, I would suggest you imme- -diately abort your attempt to create virtual terminals, and learn to live -without them. - -However, if it is 100, then as root type the following commands to create the -maximum allowable number of virtual terminals. - - # cd /dev - # mknod vt01 c 100 1 - # mknod vt02 c 100 2 - # mknod vt03 c 100 3 - # mknod vt04 c 100 4 - # mknod vt05 c 100 5 - # mknod vt06 c 100 6 - # mknod vt07 c 100 7 - -There is no need for a reconfiguration boot. - -Secondly, for both 2.1, and 2.4 x86 systems, add a few lines to the inittab -to enable logins on them. - -(Note, do NOT make a mistake here, you could lock yourself out of the system) - - --------------------->Snip Snip<----------------------------------------------- - v1:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT01 login: " -T AT386 -d /dev/vt01 -l console - v2:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT02 login: " -T AT386 -d /dev/vt02 -l console - v3:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT03 login: " -T AT386 -d /dev/vt03 -l console - v4:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT04 login: " -T AT386 -d /dev/vt04 -l console - ---------------------->End Here<----------------------------------------------- - -These four lines enable four VT's on Alt-SysReq-F1 through Alt-SysReq-F4. - -Then execute the command 'init q' to immediately enable the virtual termi- -nals. - -The keys used for VT switching are as follows: - - Alt-SysReq-F1 through Alt-SysReq-F7 enable VT screens 1-7 respec- - tively (if the VT is active). - - Alt-SysReq-n enables the next active VT screen. - - Alt-SysReq-p enables the previous active VT screen. - - Alt-SysReq-h returns to the console. - -If you are using virtual terminals, you must leave at least one free for use -by the Xserver. - -Limitations of the virtual terminal sub-system under Solaris x86: - -There are only a total of 8 available VT's (7 normal VT's + 1 console) not -the usual 15. If you have all 8 allocated, and you attempt to allocate a -additional VT you will panic the system. (This bug is worked around in the -Solaris XFree86 Xserver.) - -From a programming stand point, they work pretty much as documented in the -AT&T Unix System V/386 Release 4 Integrated Software Development Guide, how- -ever a number of ioctl() calls are broken. - -4. Notes for building XFree86 on Solaris x86 - - 1. The majority of all modifications you will need to make are now in - ~xc/config/cf/xf86site.def. - - 2. Both Gcc, and ProWorks are supported by XFree86. Gcc-2.5.8 or - gcc-2.7.2.3 are suggested, Gcc-2.6.0 is known not to work. You also - need to set HasGcc2 correctly in ~xc/config/cf/xf86site.def. - - You should also make certain your version of GCC predefines `sun'. - 2.4.5 is known NOT to by default. If needed edit /usr/local/lib/gcc- - lib/*/*/specs, and modify the *predefines: line. - - Note: A Threaded Xlib compiled with GCC has subtle problems. It'll - work 98% of the time, however clients will occasionally exhibit strange - hangs. Most notably image viewers such as xv-3.10 exhibit this problem. - - It is recommended that you set ThreadedX in ~xc/config/cf/sun.cf to NO, - if you are using GCC. ProWorks does not have this problem. - - 3. To build XFree86 with gcc you need gcc and (optionally) c++filt from - GNU binutils. Don't install gas or ld from GNU binutils, use the one - provided by Sun. - - With XFree86 3.3.2, you will need to setup a /opt/SUNWspro/bin direc- - tory containing symbolic links named cc, CC, and c++filt pointing - respectively to the actual gcc, g++ and c++filt commands. - - 4. If you don't have c++filt or if you have troubles in making World with - c++filt, you need to set UseExportLists to NO in ~xc/con- - fig/cf/host.def. - - 5. If you are using ProWorks to compile the XFree86 distribution, you need - to modify your PATH appropriately so the ProWorks tools are available. - Normally, they should be in /opt/SUNWspro/bin - - 6. You MUST put /usr/ccs/bin at the front of your PATH. There are known - problems with some GNU replacements for the utilities found there. So - the /usr/ccs/bin versions of these programs must be found before any - other possible GNU versions. (Most notably GNU 'ar' does not work dur- - ing the build). - - 7. If you wish to use the "memory aperture" feature of the S3, and Mach32 - servers, you need to compile, and install the Solaris x86 aperture - driver for memory mapped I/O support. This driver is REQUIRED for the - I128, P9000 and Mach 64 servers. - - You need to set HasSolx86apertureDrv to YES in ~xc/con- - fig/cf/xf86site.def. - - to enable the aperture driver. - - Under Solaris 2.5 and later, there's a system driver (/dev/xsvc that - provides this functionality. It will be detected automatically by the - server, so you don't need to install the driver. - - For Solaris 2.1 and 2.4, the source for this driver is included in - ~xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar. Building, and - installing the driver is relatively straight forward. Please read its - accompanying README file. - -5. Notes for running XFree86 on Solaris x86 - - 1. If you have not made the Virtual Terminal devices, you will need to - specify the terminal device to run the Xserver on. The correct device - is vt00 so your xinit command would look like so: - - xinit -- vt00 - - If you have made the virtual terminal devices you do not need to spec- - ify the VT to run the Xserver on. - - To be able to run XF86Setup, you must at least create /dev/vt01. Other- - wise XF86Setup won't start. - - 2. For Solaris you will probably want to set your LD_LIBRARY_PATH to - /usr/X11R6/lib:/usr/openwin/lib:/usr/dt/lib. Including /usr/X11R6/lib - in your LD_LIBRARY_PATH is probably not necessary, however it doesn't - hurt. :) - - Including /usr/openwin/lib in the LD_LIBRARY_PATH is recommended - because some Sun supplied binaries were not compiled with LD_RUN_PATH - set properly at compile time. - - Motif and CDE applications may require /usr/dt/lib in your - LD_LIBRARY_PATH too. - - 3. Xqueue is NOT supported under Solaris. The includes necessary for - Xqueue are available, however the driver does not seem to be in the - kernel. (Go figure) - - 4. If you want to use xdm with Solaris, extract the files from the shar - file in /usr/X11R6/lib/X11/etc/XdmConf.svr4 into a temporary directory. - The README file tells where the individual files need to be installed. - Be sure to read through each file and make any site-specific changes - that you need. - -6. Known bugs, and work arounds with Solaris x86 - - 1. The Solaris 2.1 for x86 OpenWindows filemgr does not work against a - X11R5 Xserver, it probably will also not work against a X11R6 Xserver. - Attempting to 'Drag and Drop' a file causes the filemgr to abort with a - 'X error' - - Solaris 2.4 does not have this problem. - - There is no known work around. - -7. Bug Notification - -Bug reports need to be sent to XFree86@XFree86.org, or posted to the -comp.windows.x.i386unix newsgroup. Questions or comments about the Solaris -support, or the Solaris distribution need to be made to davidh@use.com, or -danson@lgc.com. - - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml,v 3.15 1999/08/23 06:38:52 dawes Exp $ - - $XConsortium: SOLX86.sgml /main/7 1996/10/28 05:43:28 kaleb $ - - -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SOLX86,v 3.27 2000/03/01 01:48:13 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.Solaris diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/README.Solaris:1.4 --- /dev/null Thu Feb 27 12:30:23 2003 +++ xc/programs/Xserver/hw/xfree86/doc/README.Solaris Fri Jan 3 23:28:27 2003 @@ -0,0 +1,220 @@ + Information for Solaris + + David Holland, modified by Marc Aurele La France + + 2001 October 01 + +1. What is XFree86 + +XFree86 is a port of X11R6.5.1 that supports several versions of Unix. It is +derived from X386 1.2 which was the X server distributed with X11R5. This +release consists of many new features and performance improvements as well as +many bug fixes. The release is available as a source code distribution, as +well as binary distributions for many architectures. + +The sources for XFree86 are available by anonymous ftp from: + + ftp://ftp.XFree86.org/pub/XFree86/current + +Solaris binaries for XFree86 are available for anonymous ftp at the same +address. Currently, two binary distributions are available: one for Solaris +8 x86, the other for previous Solaris x86 releases. They are not inter- +changeable. No binary distribution is available for Solaris/SPARC as it is +still under development. + +2. The VT-switching sub-system in Solaris x86 + +The virtual terminal sub-system is a undocumented, and unsupported feature of +Solaris x86. Therefore if you use virtual terminals, you do so at YOUR OWN +RISK. + +Virtual terminals are not available in Solaris SPARC, and their availability +has been removed in Solaris8 x86. + +When available, the virtual terminals of Solaris work basically the same way +as most other SVR4 VT sub-systems. However, there are a number of limita- +tions documented below. + +First, if you are running a Solaris 2.4 x86 system, and you want VT's, you +will have to create the necessary devices first, so become root. + +Verify the chanmux device driver's major number is 100: + + # grep -i chanmux /etc/name_to_major + chanmux 100 + # + +If the number after 'chanmux' is anything but 100, I would suggest you imme- +diately abort your attempt to create virtual terminals, and learn to live +without them. + +However, if it is 100, then as root type the following commands to create the +maximum allowable number of virtual terminals. + + # cd /dev + # mknod vt01 c 100 1 + # mknod vt02 c 100 2 + # mknod vt03 c 100 3 + # mknod vt04 c 100 4 + # mknod vt05 c 100 5 + # mknod vt06 c 100 6 + # mknod vt07 c 100 7 + +There is no need for a reconfiguration boot. + +Secondly, for both 2.1, and 2.4 x86 systems, add a few lines to the inittab +to enable logins on them. + +(Note, do NOT make a mistake here, you could lock yourself out of the system) + + --------------------->Snip Snip<----------------------------------------------- + v1:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT01 login: " -T AT386 -d /dev/vt01 -l console + v2:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT02 login: " -T AT386 -d /dev/vt02 -l console + v3:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT03 login: " -T AT386 -d /dev/vt03 -l console + v4:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT04 login: " -T AT386 -d /dev/vt04 -l console + ---------------------->End Here<----------------------------------------------- + +These four lines enable four VT's on Alt-SysReq-F1 through Alt-SysReq-F4. + +Then execute the command 'init q' to immediately enable the virtual termi- +nals. + +The keys used for VT switching are as follows: + + Alt-SysReq-F1 through Alt-SysReq-F7 enable VT screens 1-7 respec- + tively (if the VT is active). + + Alt-SysReq-n enables the next active VT screen. + + Alt-SysReq-p enables the previous active VT screen. + + Alt-SysReq-h returns to the console. + +If you are using virtual terminals, you must leave at least one free for use +by the Xserver. + +Limitations of the virtual terminal sub-system under Solaris x86: + +There are only a total of 8 available VT's (7 normal VT's + 1 console) not +the usual 15. If you have all 8 allocated, and you attempt to allocate a +additional VT you will panic the system. (This bug is worked around in the +Solaris XFree86 Xserver.) + +From a programming stand point, they work pretty much as documented in the +AT&T Unix System V/386 Release 4 Integrated Software Development Guide, how- +ever a number of ioctl() calls are broken. + +3. Notes for building XFree86 on Solaris + + 1. Both GCC, and ProWorks are supported by XFree86. The minimum recom- + mended GCC release is 2.7.2. Some earlier GCC's are known to not work + and should be avoided. + + You should also make certain your version of GCC predefines `sun'. If + needed edit /usr/local/lib/gcc-lib/*/*/specs, and modify the *prede- + fines: line. + + On SPARCs, regardless of the compiler you use, ensure it generates + 32-bit binaries. At this time, 64-bit binaries will probably not work. + + 2. Also on SPARCs, you will need to set BuildXFree86OnSparcSunOS to YES in + ~xc/config/cf/host.def. Otherwise, you can only build the old depre- + cated Xsun* servers. + + 3. A Threaded Xlib compiled with GCC has subtle problems. It'll work 98% + of the time, however clients will occasionally exhibit strange hangs. + Most notably image viewers such as xv-3.10 exhibit this problem. + + It is recommended that you set ThreadedX in ~xc/config/cf/host.def to + NO, if you are using GCC. ProWorks does not have this problem. + Whether this behaviour still exists with newer GCC's has not been veri- + fied. + + 4. To build XFree86 with GCC you need gcc and (optionally) c++filt from + GNU binutils. Don't install gas or ld from GNU binutils, use the one + provided by Sun. + + You might need to setup a /opt/SUNWspro/bin directory containing sym- + bolic links named cc, CC, and c++filt pointing respectively to the + actual gcc, g++ and c++filt commands. + + 5. If you are using ProWorks to compile the XFree86 distribution, you need + to modify your PATH appropriately so the ProWorks tools are available. + Normally, they should be in /opt/SUNWspro/bin + + 6. You MUST put /usr/ccs/bin at the front of your PATH. There are known + problems with some GNU replacements for the utilities found there. So + the /usr/ccs/bin versions of these programs must be found before any + possible GNU versions. (Most notably GNU 'ar' does not work during the + build). + +4. Notes for running XFree86 on Solaris + + 1. Depending on the release or architecture of Solaris you are running, + you might need to install an OS driver for an aperture device. + + Under Solaris x86 2.5 and later, there's a system driver (/dev/xsvc) + that provides this functionality. It will be detected automatically by + the server, so you don't need to install the aperture driver. + + For older Solaris x86 and for Solaris SPARC releases, the source for + this driver is included in xc/programs/Xserver/hw/xfree86/etc/apSo- + laris.shar of the source distribution. This file can usually also be + found in the /usr/X11R6/lib/X11/etc directory when XFree86 is + installed. Building, and installing the driver is relatively straight + forward. Please read its accompanying README file. + + 2. If you have not made the Virtual Terminal devices, you will need to + specify the terminal device to run the Xserver on. The correct device + is vt00 so your xinit command would look like so: + + xinit -- vt00 + + If you have made the virtual terminal devices you do not need to spec- + ify the VT to run the Xserver on. + + 3. For Solaris you will probably want to set your LD_LIBRARY_PATH to + /usr/X11R6/lib:/usr/openwin/lib:/usr/dt/lib. Including /usr/X11R6/lib + in your LD_LIBRARY_PATH is probably not necessary, however it doesn't + hurt. :) + + Including /usr/openwin/lib in the LD_LIBRARY_PATH is recommended + because some Sun supplied binaries were not compiled with LD_RUN_PATH + set properly at compile time. + + Motif and CDE applications may require /usr/dt/lib in your + LD_LIBRARY_PATH too. + + 4. Xqueue is NOT supported under Solaris. The includes necessary for + Xqueue are available, however the driver does not seem to be in the + kernel. (Go figure) + + 5. If you want to use xdm with Solaris, extract the files from the shar + file in /usr/X11R6/lib/X11/etc/XdmConf.svr4 into a temporary directory. + The README file tells where the individual files need to be installed. + Be sure to read through each file and make any site-specific changes + that you need. + +5. Known bugs, and work arounds with Solaris + + 1. The Solaris 2.1 for x86 OpenWindows filemgr does not work against a + X11R5 Xserver, it probably will also not work against a X11R6 Xserver. + Attempting to 'Drag and Drop' a file causes the filemgr to abort with + an 'X error' + + Solaris x86 2.4 does not have this problem. + + There is no known work around. + + 2. The SPARC port is still quite new, so instability is to be expected + (and reported!). It might even have broken some aspects of the x86 + port. + +6. Bug Notification + +Bug reports should be sent to . + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml,v 1.4 2003/01/04 04:20:23 dawes Exp $ + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Solaris,v 1.4 2003/01/04 04:28:27 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.XKB-Config diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/README.XKB-Config:1.2 --- /dev/null Thu Feb 27 12:30:24 2003 +++ xc/programs/Xserver/hw/xfree86/doc/README.XKB-Config Tue Feb 25 16:32:35 2003 @@ -0,0 +1,198 @@ + The XKB Configuration Guide + + Kamil Toman, Ivan U. Pascal + + 25 November 2002 + + Abstract + + This document describes how to configure XFree86 XKB from a user's + point a few. It converts basic configuration syntax and gives also + a few examples. + +1. Overview + +The XKB configuration is decomposed into a number of components. Selecting +proper parts and combining them back you can achieve most of configurations +you might need. Unless you have a completely atypical keyboard you really +don't need to touch any of xkb configuration files. + +2. Selecting XKB Configuration + +The easiest and the most natural way how to specify a keyboard mapping is tu +use rules component. As its name suggests it describes a number of general +rules how to combine all bits and pieces into a valid and useful keyboard +mapping. All you need to do is to select a suitable rules file and then to +feed it with a few parameters that will adjust the keyboard behaviour to ful- +fill your needs. + +The parameters are: + + o XkbRules - files of rules to be used for keyboard mapping composition + + o XkbModel - name of model of your keyboard type + + o XkbLayout - layout(s) you intend to use + + o XkbVariant - variant(s) of layout you intend to use + + o XkbOptions - extra xkb configuration options + +The proper rules file depends on your vendor. In reality, the commonest file +of rules is xfree86. For each rules file there is a description file named +.lst, for instance xfree86.lst which is located in xkb configu- +ration subdirectory rules (for example /etc/X11/xkb/rules). + +2.1 Basic Configuration + +Let's say you want to configure a PC style America keyboard with 104 keys as +described in xfree86.lst. It can be done by simply writing several lines from +below to you XFree86 configuration file (often found as /etc/X11/XF86Config-4 +or /etc/X11/XF86Config): + + Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "pc104" + Option "XkbLayout" "us" + Option "XKbOptions" "" + EndSection + +The values of parameters XkbModel and XkbLayout are really not surprising. +The parameters XkbOptions has been explicitly set to empty set of parameters. +The parameter XkbVariant has been left out. That means the default variant +named basic is loaded. + +Of course, this can be also done at runtime using utility setxkbmap. Shell +command loading the same keyboard mapping would look like: + + setxkbmap -rules xfree86 -model pc104 -layout us -option "" + +The configuration and the shell command would be very analogical for most +other layouts (internationalized mappings). + +2.2 Advanced Configuration + +Since XFree86 4.3.x you can use multi-layouts xkb configuration. What does +it mean? Basically it allows to load up to four different keyboard layouts at +a time. Each such layout would reside in its own group. The groups (unlike +complete keyboard remapping) can be switched very fast from one to another by +a combination of keys. + +Let's say you want to configure your new Logitech cordless desktop keyboard, +you intend to use three different layouts at the same time - us, czech and +german (in this order), and that you are used to Alt-Shift combination for +switching among them. + +Then the configuration snippet could look like this: + + Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "logicordless" + Option "XkbLayout" "us,cz,de" + Option "XKbOptions" "grp:alt_shift_toggle" + EndSection + +Of course, this can be also done at runtime using utility setxkbmap. Shell +command loading the same keyboard mapping would look like: + + setxkmap -rules xfree86 -model logicordless -layout "us,cz,de" \ + -option "grp:alt_shift_toggle" + +2.3 Even More Advanced Configuration + +Okay, let's say you are more demanding. You do like the example above but you +want it to change a bit. Let's imagine you want the czech keyboard mapping to +use another variant but basic. The configuration snippet then changes into: + + Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "logicordless" + Option "XkbLayout" "us,cz,de" + Option "XkbVariant" ",bksl," + Option "XKbOptions" "grp:alt_shift_toggle" + EndSection + +That's seems tricky but it is not. The logic for settings of variants is the +same as for layouts, that means the first and the third variant settings are +left out (set to basic), the second is set to bksl (a special variant with an +enhanced definition of the backslash key). + +Analogically, the loading runtime will change to: + + setxkmap -rules xfree86 -model logicordless -layout "us,cz,de" \ + -variant ",bksl," -option "grp:alt_shift_toggle" + +2.4 Basic Global Options + +See rules/*.lst files. + +3. Direct XKB Configuration + +Generally, you can directly prescribe what configuration of each of basic xkb +components should be used to form the resulting keyboard mapping. This +method is rather "brute force". You precisely need to know the structure and +the meaning of all of used configuration components. + +This method also exposes all xkb configuration details directly into XFree86 +configuration file which is a not very fortunate fact. In rare occasions it +may be needed, though. So how does it work? + +3.1 Basic Components + +There are five basic components used to form a keyboard mapping: + + o key codes - a translation of the scan codes produced by the keyboard + into a suitable symbolic form + + o types - a specification of what various combinations of modifiers pro- + duce + + o key symbols - a translation of symbolic key codes into actual symbols + + o geometry - a description of physical keyboard geometry + + o compatibility maps - a specification of what action should each key pro- + duce in order to preserve compatibility with XKB-unware clients + +3.2 Example Configuration + +Look at the following example: + + Section "InputDevice" + Identifier "Keyboard0" + Driver "Keyboard" + + Option "XkbKeycodes" "xfree86" + Option "XkbTypes" "default" + Option "XkbSymbols" "en_US(pc104)+de+swapcaps" + Option "XkbGeometry" "pc(pc104)" + Option "XkbCompat" "basic+pc+iso9995" + EndSection + +This configuration sets the standard XFree86 default interpretation of key- +board keycodes, sets the default modificator types. The symbol table is com- +posed of extended US keyboard layout in its variant for pc keyboards with 104 +keys plus all keys for german layout are redefined respectively. Also the +logical meaning of Caps-lock and Control keys is swapped. The standard key- +board geometry (physical look) is set to pc style keyboard with 104 keys. The +compatibility map is set to allow basic shifting, to allow Alt keys to be +interpreted and also to allow iso9995 group shifting. + +4. Keymap XKB Configuration + +It is the formerly used way to configure xkb. The user included a special +keymap file which specified the direct xkb configuration. This method has +been obsoleted by previously described rules files which are far more flexi- +ble and allow simpler and more intuitive syntax. It is preserved merely for +compatibility reasons. Avoid using it if it is possible. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Config.sgml,v 1.2 2003/02/25 19:31:02 dawes Exp $ + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.XKB-Config,v 1.2 2003/02/25 21:32:35 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.XKB-Enhancing diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/README.XKB-Enhancing:1.2 --- /dev/null Thu Feb 27 12:30:24 2003 +++ xc/programs/Xserver/hw/xfree86/doc/README.XKB-Enhancing Tue Feb 25 16:32:35 2003 @@ -0,0 +1,511 @@ + How to further enhance XKB configuration + + Kamil Toman, Ivan U. Pascal + + 25 November 2002 + + Abstract + + This guide is aimed to relieve one's labour to create a new (inter- + nationalized) keyboard layout. Unlike other documents this guide + accents the keymap developer's point of view. + +1. Overview + +The developer of a new layout should read the xkb protocol specification (The +X Keyboard Extension: Protocol Specification ) at least to clarify for himself some xkb-specific +terms used in this document and elsewhere in xkb configuration. Also it shows +wise to understand how the X server and a client digest their keyboard inputs +(with and without xkb). + +A useful source is also Ivan Pascal's text about xkb configuration + often referenced throughout this docu- +ment. + +Note that this document covers only enhancements which are to be made to +XFree86 version 4.3.x and above. + +2. The Basics + +At the startup (or at later at user's command) X server starts its xkb key- +board module extension and reads data from a compiled configuration file. + +This compiled configuration file is prepared by the program xkbcomp which +behaves altogether as an ordinary compiler (see man xkbcomp). Its input are +human readable xkb configuration files which are verified and then composed +into a useful xkb configuration. Users don't need to mess with xkbcomp them- +selves, for them it is invisible. Usually, it is started upon X server +startup. + +As you probably already know, the xkb configuration consists of five main +modules: + + Keycodes + Tables that defines translation from keyboard scan codes into + reasonable symbolic names, maximum, minimum legal keycodes, sym- + bolic aliases and description of physically present LED-indica- + tors. The primary sence of this component is to allow definitions + of maps of symbols (see below) to be independent of physical key- + board scancodes. There are two main naming conventions for sym- + bolic names (always four bytes long): + + o names which express some traditional meaning like + (stands for space bar) or + + o names which express some relative positioning on a key- + board, for example (an exclamation mark on US key- + boards), on the right there are keys , etc. + + Types + Types describe how the produced key is changed by active modi- + fiers (like Shift, Control, Alt, ...). There are several prede- + fined types which cover most of used combinations. + + Compat + Compatibility component defines internal behaviour of modifiers. + Using compat component you can assign various actions (elabo- + rately described in xkb specification) to key events. This is + also the place where LED-indicators behaviour is defined. + + Symbols + For i18n purposes, this is the most important table. It defines + what values (=symbols) are assigned to what keycodes (represented + by their symbolic name, see above). There may be defined more + than one value for each key and then it depends on a key type and + on modifiers state (respective compat component) which value will + be the resulting one. + + Geometry + Geometry files aren't used by xkb itself but they may be used by + some external programs to depict a keyboard image. + +All these components have the files located in xkb configuration tree in sub- +directories with the same names (usually in /usr/lib/X11/xkb). + +3. Enhancing XKB Configuration + +Most of xkb enhancements concerns a need to define new output symbols for the +some input key events. In other words, a need to define a new symbol map (for +a new language, standard or just to feel more comfortable when typing text). + +What do you need to do? Generally, you have to define following things: + + o the map of symbols itself + + o the rules to allow users to select the new mapping + + o the description of the new layout + +First of all, it is good to go through existing layouts and to examine them +if there is something you could easily adjust to fit your needs. Even if +there is nothing similar you may get some ideas about basic concepts and used +tricks. + +3.1 Levels And Groups + +Since XFree86 4.3.0 you can use multi-layout concept of xkb configuration. +Though it is still in boundaries of xkb protocol and general ideas, the +keymap designer must obey new rules when creating new maps. In exchange we +get a more powerful and cleaner configuration system. + +Remember that it is the application which must decide which symbol matches +which keycode according to effective modifier state. The X server itself +sends only an input event message to. Of course, usually the general inter- +pretation is processed by Xlib, Xaw, Motif, Qt, Gtk and similar libraries. +The X server only supplies its mapping table (usually upon an application +startup). + +You can think of the X server's symbol table as of a irregular table where +each keycode has its row and where each combination of modifiers determines +exactly one column. The resulting cell then gives the proper symbolic value. +Not all keycodes need to bind different values for different combination of +modifiers. key, for instance, usually doesn't depend on any modi- +fiers so it its row has only one column defined. + +Note that in XKB there is no prior assumption that certain modifiers are +bound to certain columns. By editing proper files (see keytypes (section 4.2, +page 1)) this mapping can be changed as well. + +Unlike the original X protocol the XKB approach is far more flexible. It is +comfortable to add one additional XKB term - group. You can think of a group +as of a vector of columns per each keycode (naturally the dimension of this +vector may differ for different keycodes). What is it good for? The group is +not very useful unless you intend to use more than one logically different +set of symbols (like more than one alphabet) defined in a single mapping +table. But then, the group has a natural meaning - each symbol set has its +own group and changing it means selecting a different one. XKB approach +allows up to four different groups. The columns inside each group are called +(shift) levels. The X server knows the current group and reports it together +with modifier set and with a keycode in key events. + +To sum it up: + + o for each keycode XKB keyboard map contains up to four one-dimensional + tables - groups (logically different symbol sets) + + o for each group of a keycode XKB keyboard map contains some columns - + shift levels (values reached by combinations of Shift, Ctrl, Alt, ... + modifiers) + + o different keycodes can have different number of groups + + o different groups of one keycode can have different number of shift lev- + els + + o the current group number is tracked by X server + +It is clear that if you sanely define levels, groups and sanely bind modi- +fiers and associated actions you can have simultaneously loaded up to four +different symbol sets where each of them would reside in its own group. + +The multi-layout concept provides a facility to manipulate xkb groups and +symbol definitions in a way that allows almost arbitrary composition of pre- +defined symbol tables. To keep it fully functional you have to: + + o define all symbols only in the first group + + o (re)define any modifiers with extra care to avoid strange (anisometric) + behaviour + +4. Defining New Layouts + +See Some Words About XKB internals for explanation of used xkb terms and problems +addressed by XKB extension. + +See Common notes about XKB configuration files language + for more precise +explanation of syntax of xkb configuration files. + +4.1 Predefined XKB Symbol Sets + +If you are about to define some European symbol map extension, you might want +to use on of four predefined latin alphabet layouts. + +Okay, let's assume you want extend an existing keymap and you want to over- +ride a few keys. Let's take a simple U.K. keyboard as an example (defined in +pc/gb): + + partial default alphanumeric_keys + xkb_symbols "basic" { + include "pc/latin" + + name[Group1]="Great Britain"; + + key { [ 2, quotedbl, twosuperior, oneeighth ] }; + key { [ 3, sterling, threesuperior, sterling ] }; + key { [apostrophe, at, dead_circumflex, dead_caron] }; + key { [ grave, notsign, bar, bar ] }; + key { [numbersign, asciitilde, dead_grave, dead_breve ] }; + key { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + + modifier_map Mod5 { }; + }; + +It defines a new layout in basic variant as an extension of common latin +alphabet layout. The layout (symbol set) name is set to "Great Britain". +Then there are redefinitions of a few keycodes and a modifiers binding. As +you can see the number of shift levels is the same for , , +, and keys but it differs from number of shift levels of +. + +Note that the key itself is a binding key for Mod5 and that it serves +like a shift modifier for LevelThree, together with Shift as a multi-key. It +is a good habit to respect this rule in a new similar layout. + +Okay, you could now define more variants of your new layout besides basic +simply by including (augmenting/overriding/...) the basic definition and +altering what may be needed. + +4.2 Key Types + +The differences in the number of columns (shift levels) are caused by a dif- +ferent types of keys (see the types definition in section basics). Most key- +codes have implicitly set the keytype in the included "pc/latin" file to +"FOUR_LEVEL_ALPHABETIC". The only exception is keycode which is +explicitly set "TWO_LEVEL" keytype. + +All those names refer to pre-defined shift level schemes. Usually you can +choose a suitable shift level scheme from default types scheme list in proper +xkb component's subdirectory. + +The most used schemes are: + + ONE_LEVEL + The key does not depend on any modifiers. The symbol from first + level is always chosen. + + TWO_LEVEL + The key uses a modifier Shift and may have two possible values. + The second level may be chosen by Shift modifier. If Lock modi- + fier (usually Caps-lock) applies the symbol is further processed + using system-specific capitalization rules. If both Shift+Lock + modifier apply the symbol from the second level is taken and cap- + italization rules are applied (and usually have no effect). + + ALPHABETIC + The key uses modifiers Shift and Lock. It may have two possible + values. The second level may be chosen by Shift modifier. When + Lock modifier applies, the symbol from the first level is taken + and further processed using system-specific capitalization rules. + If both Shift+Lock modifier apply the symbol from the first level + is taken and no capitalization rules applied. This is often + called shift-cancels-caps behaviour. + + THREE_LEVEL + Is the same as TWO_LEVEL but it considers an extra modifier - + LevelThree which can be used to gain the symbol value from the + third level. If both Shift+LevelThree modifiers apply the value + from the third level is also taken. As in TWO_LEVEL, the Lock + modifier doesn't influence the resulting level. Only Shift and + LevelThree are taken into that consideration. If the Lock modi- + fier is active capitalization rules are applied on the resulting + symbol. + + FOUR_LEVEL + Is the same as THREE_LEVEL but unlike LEVEL_THREE if both + Shift+LevelThree modifiers apply the symbol is taken from the + fourth level. + + FOUR_LEVEL_ALPHABETIC + Is similar to FOUR_LEVEL but also defines shift-cancels-caps + behaviour as in ALPHABETIC. If Lock+LevelThree apply the symbol + from the third level is taken and the capitalization rules are + applied. If Lock+Shift+LevelThree apply the symbol from the + third level is taken and no capitalization rules are applied. + + KEYPAD + As the name suggest this scheme is primarily used for numeric + keypads. The scheme considers two modifiers - Shift and NumLock. + If none of modifiers applies the symbol from the first level is + taken. If either Shift or NumLock modifiers apply the symbol from + the second level is taken. If both Shift+NumLock modifiers apply + the symbol from the first level is taken. Again, shift-cancels- + caps variant. + + FOUR_LEVEL_KEYPAD + Is similar to KEYPAD scheme but considers also LevelThree modi- + fier. If LevelThree modifier applies the symbol from the third + level is taken. If Shift+LevelThree or NumLock+LevelThree apply + the symbol from the fourth level is taken. If all Shift+Num- + Lock+LevelThree modifiers apply the symbol from the third level + is taken. This also, shift-cancels-caps variant. + +Besides that, there are several schemes for special purposes: + + PC_BREAK + It is similar to TWO_LEVEL scheme but it considers the Control + modifier rather than Shift. That means, the symbol from the sec- + ond level is chosen by Control rather than by Shift. + + PC_SYSRQ + It is similar to TWO_LEVEL scheme but it considers the Alt modi- + fier rather than Shift. That means, the symbol from the second + level is chosen by Alt rather than by Shift. + + CTRL+ALT + The key uses modifiers Alt and Control. It may have two possible + values. If only one modifier (Alt or Control) applies the symbol + from the first level is chosen. Only if both Alt+Control modi- + fiers apply the symbol from the second level is chosen. + + SHIFT+ALT + The key uses modifiers Shift and Alt. It may have two possible + values. If only one modifier (Alt or Shift) applies the symbol + from the first level is chosen. Only if both Alt+Shift modifiers + apply the symbol from the second level is chosen. + +If needed, special caps schemes may be used. They redefine the standard +behaviour of all *ALPHABETIC types. The layouts (maps of symbols) with keys +defined in respective types then automatically change their behaviour accord- +ingly. Possible redefinitions are: + + o internal + + o internal_nocancel + + o shift + + o shift_nocancel + +None of these schemes should be used directly. They are defined merely for +'caps:' xkb options (used to globally change the layouts behaviour). + +Don't alter any of existing key types. If you need a different behaviour cre- +ate a new one. + +4.2.1 More On Definitions Of Types + +When the XKB software deals with a separate type description it gets a com- +plete list of modifiers that should be taken into account from the 'modi- +fiers=' list and expects that a set of 'map[]=' instructions that contain the mapping for +each combination of modifiers mentioned in that list. Modifiers that are not +explicitly listed are NOT taken into account when the resulting shift level +is computed. If some combination is omitted the program (subroutine) should +choose the first level for this combination (a quite reasonable behavior). + +Lets consider an example with two modifiers ModOne and ModTwo: + + type "..." { + modifiers = ModOne+ModTwo; + map[None] = Level1; + map[ModOne] = Level2; + }; + +In this case the map statements for ModTwo only and ModOne+ModTwo are omit- +ted. It means that if the ModTwo is active the subroutine can't found +explicit mapping for such combination an will use the default level i.e. +Level1. + +But in the case the type described as: + + type "..." { + modifiers = ModOne; + map[None] = Level1; + map[ModOne] = Level2; + }; + +the ModTwo will not be taken into account and the resulting level depends on +the ModOne state only. That means, ModTwo alone produces the Level1 but the +combination ModOne+ModTwo produces the Level2 as well as ModOne alone. + +What does it mean if the second modifier is the Lock? It means that in the +first case (the Lock itself is included in the list of modifiers but combina- +tions with this modifier aren't mentioned in the map statements) the internal +capitalization rules will be applied to the symbol from the first level. But +in the second case the capitalization will be applied to the symbol chosen +accordingly to he first modifier - and this can be the symbol from the first +as well as from the second level. + +Usually, all modifiers introduced in 'modifiers=' list are +used for shift level calculation and then discarded. Sometimes this is not +desirable. If you want to use a modifier for shift level calculation but you +don't want to discard it, you may list in 'preserve[]='. That means, for a given combination all listed +modifiers will be preserved. If the Lock modifier is preserved then the +resulting symbol is passed to internal capitalization routine regardless +whether it has been used for a shift level calculation or not. + +Any key type description can use both real and virtual modifiers. Since real +modifiers always have standard names it is not necessary to explicitly +declare them. Virtual modifiers can have arbitrary names and can be declared +(prior using them) directly in key type definition: + + virtual_modifiers ; + +as seen in for example basic, pc or mousekeys key type definitions. + +4.3 Rules + +Once you are finished with your symbol map you need to add it to rules file. +The rules file describes how all the five basic keycodes, types, compat, sym- +bols and geometry components should be composed to give a sensible resulting +xkb configuration. + +The main advantage of rules over formerly used keymaps is a possibility to +simply parameterize (once) fixed patterns of configurations and thus to ele- +gantly allow substitutions of various local configurations into predefined +templates. + +A pattern in a rules file (often located in /usr/lib/X11/xkb/rules) can be +parameterized with four other arguments: Model, Layout, Variant and Options. +For most cases parameters model and layout should be sufficient for choosing +a functional keyboard mapping. + +The rules file itself is composed of pattern lines and lines with rules. The +pattern line starts with an exclamation mark ('!') and describes how will the +xkb interpret the following lines (rules). A sample rules file looks like +this: + + ! model = keycodes + macintosh_old = macintosh + ... + * = xfree86 + + ! model = symbols + hp = +inet(%m) + microsoftpro = +inet(%m) + geniuscomfy = +inet(%m) + + ! model layout[1] = symbols + macintosh us = macintosh/us%(v[1]) + * * = pc/pc(%m)+pc/%l[1]%(v[1]) + + ! model layout[2] = symbols + macintosh us = +macintosh/us[2]%(v[2]):2 + * * = +pc/%l[2]%(v[2]):2 + + ! option = types + caps:internal = +caps(internal) + caps:internal_nocancel = +caps(internal_nocancel) + +Each rule defines what certain combination of values on the left side of +equal sign ('=') results in. For example a (keyboard) model macintosh_old +instructs xkb to take definitions of keycodes from file keycodes/macintosh +while the rest of models (represented by a wild card '*') instructs it to +take them from file keycodes/xfree86. The wild card represents all possible +values on the left side which were not found in any of the previous rules. +The more specialized (more complete) rules have higher precedence than gen- +eral ones, i.e. the more general rules supply reasonable default values. + +As you can see some lines contain substitution parameters - the parameters +preceded by the percent sign ('%'). The first alphabetical character after +the percent sign expands to the value which has been found on the left side. +For example +%l%(v) expands into +cz(bksl) if the respective values on the +left side were cz layout in its bksl variant. More, if the layout resp. vari- +ant parameter is followed by a pair of brackets ('[', ']') it means that xkb +should place the layout resp. variant into specified xkb group. If the brack- +ets are omitted the first group is the default value. + +So the second block of rules enhances symbol definitions for some particular +keyboard models with extra keys (for internet, multimedia, ...) . Other mod- +els are left intact. Similarly, the last block overrides some key type defi- +nitions, so the common global behaviour ''shift cancels caps'' or ''shift +doesn't cancel caps'' can be selected. The rest of rules produces special +symbols for each variant us layout of macintosh keyboard and standard pc sym- +bols in appropriate variants as a default. + +4.4 Descriptive Files of Rules + +Now you just need to add a detailed description to .xml description +file so the other users (and external programs which often parse this file) +know what is your work about. + +4.4.1 Old Descriptive Files + +The formerly used descriptive files were named .lst Its structure is +very simple and quite self descriptive but such simplicity had also some cav- +ities, for example there was no way how to describe local variants of layouts +and there were problems with the localization of descriptions. To preserve +compatibility with some older programs, new XML descriptive files can be con- +verted to old format '.lst'. + +For each parameter of rules file should be described its meaning. For the +rules file described above the .lst file could look like: + + ! model + pc104 Generic 104-key PC + microsoft Microsoft Natural + pc98 PC-98xx Series + macintosh Original Macintosh + ... + + ! layout + us U.S. English + cz Czech + de German + ... + + ! option + caps:internal uses internal capitalization. Shift cancels Caps + caps:internal_nocancel uses internal capitalization. Shift doesn't cancel Caps + +And that should be it. Enjoy creating your own xkb mapping. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Enhancing.sgml,v 1.2 2003/02/25 19:31:02 dawes Exp $ + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.XKB-Enhancing,v 1.2 2003/02/25 21:32:35 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.ati diff -u xc/programs/Xserver/hw/xfree86/doc/README.ati:3.59 xc/programs/Xserver/hw/xfree86/doc/README.ati:3.63 --- xc/programs/Xserver/hw/xfree86/doc/README.ati:3.59 Wed Jan 16 15:51:02 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.ati Tue Feb 25 16:32:35 2003 @@ -2,7 +2,7 @@ Marc Aurele La France - 2001 April 10 + 2002 February 12 Abstract @@ -38,6 +38,10 @@ If none of the above conditions are met, the ATI driver will essentially dis- able itself to allow other drivers to examine the system. +Note that I am currently considering removing the driver's support for +generic VGA. If you have any concerns about this, please contact me at +. + 2. A note on acceleration The meaning of ``acceleration'', as used in this document, needs to be clari- @@ -391,9 +395,9 @@ for those that are zero above, or vice-versa. The order of the clocks is very important, although the driver will reorder -the clocks if it deems it appropriate to do so. Mach32 and Mach64 owners -should note that this order is different than what they would use for previ- -ous XFree86 accelerated servers. +the specified clocks if it deems it appropriate to do so. Mach32 and Mach64 +owners should note that this order is different than what they would use for +previous XFree86 accelerated servers. 5.6.4 Clocks for non-ATI adapters @@ -403,22 +407,31 @@ include up to four clock frequencies in your XF86Config to specify the actual values used by the adapter. Any more will be ignored. -5.7 Option ``crt_screen'' +5.7 Option ``nopanel_display'' This specification is only effective when the driver detects that the adapter's BIOS has initialised both the digital flat panel and CRT inter- faces. In such a situation, the driver will normally drive both the panel and the CRT. This specification causes the driver to disable the digital -flat panel and display the screen image on the CRT instead. +flat panel and display the screen image on the CRT instead, which could +potentially allow for larger physical resolutions than the panel can handle. + +5.8 Option ``crt_display'' + +This specification is only effective when the driver detects that the +adapter's BIOS has initialised the digital flat panel interface, but has dis- +abled the CRT interface. In such a situation the driver will normally drive +only the panel. This specification causes the driver to instead display the +same image on both the panel and the CRT. -5.8 Option ``noaccel'' +5.9 Option ``noaccel'' By default, the driver will accelerate draw operations if a Mach64 CRTC is used to drive the display. As implemented in this driver, acceleration does not require a linear video memory aperture. This option disables this accel- eration. -5.9 Option ``nolinear'' +5.10 Option ``nolinear'' By default, the driver will enable a linear video memory aperture for 256-colour and higher depth modes if it is also using a Mach64 accelerator @@ -428,17 +441,18 @@ On non-Intel platforms, the driver requires a linear aperture and, so, this option is ignored. -5.10 Option ``HWCursor'' and Option ``SWCursor'' +5.11 Option ``HWCursor'' and Option ``SWCursor'' Option ``HWCursor'', which is the default, specifies that hardware facilities are to be used to paint the mouse pointer on the screen. Option ``SWCursor'' -specifies that the mouse pointer is to by drawn by software, which is much +specifies that the mouse pointer is to be drawn by software, which is much slower. If both options are specified, option ``SWCursor'' prevails. Cur- rently, these options are only acted upon for 256-colour or higher depth modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is -being used. In all other situations, a software cursor will be used. +being used. In all other situations, a software cursor will be used, regard- +less of what these options specify. -5.11 Option ``SilkenMouse'' +5.12 Option ``SilkenMouse'' This option is only acted upon when a hardware cursor is being used. It specifies that the cursor's position on the screen is to be updated as @@ -446,7 +460,7 @@ If this option is negated, the cursor may lag the mouse when the X server is very busy. -5.12 Option ``shadowfb'' +5.13 Option ``shadowfb'' If this option is enabled, the driver will cause the CPU to do each drawing operation first into a shadow frame buffer in system virtual memory and then @@ -462,19 +476,19 @@ a linear video memory aperture is not enabled, when the frame buffer depth is less than 8, or when acceleration is used. -5.13 Option ``dpms'' +5.14 Option ``dpms'' This option enables the driver's support for VESA's Display Power Management Specification. -5.14 Option ``backingstore'' +5.15 Option ``backingstore'' This is not specifically a driver option. It is used to enable the server's support for backing store, a mechanism by which pixel data for occluded win- dow regions is remembered by the server thereby alleviating the need to send expose events to X clients when the data needs to be redisplayed. -5.15 MemBase address +5.16 MemBase address This specification is only effective for non-PCI Mach64 adapters, and is used to override the CPU address at which the adapter will map its video memory. @@ -488,14 +502,14 @@ requirements of most devices in the system. This means the driver can not easily change the linear aperture address. -5.16 Option ``ReferenceClock'' ``frequency'' +5.17 Option ``ReferenceClock'' ``frequency'' This option is only applicable to non-Intel platforms, where an adapter BIOS is not available to the driver. The option specifies the reference frequency used by the adapter's clock generator. The default is 14.318 MHz, and other typical values are 28.636, or 29.5 MHz. -5.17 ClockChip ``name'' +5.18 ClockChip ``name'' This option is only applicable to non-Intel platforms, where an adapter BIOS is not available to the driver, and the driver cannot reliably determine @@ -523,33 +537,17 @@ resolution the largest usable mode, whether or not the chosen mode is speci- fied in the corresponding ``Monitor'' section. -For a CRT monitor, you should still specify horizontal sync and vertical -refresh rates in the corresponding ``Monitor'' section. Otherwise, the -server will default these to those of a VGA monitor, which will limit resolu- -tions to not much more than 640x480 at 72 Hz. For a digital flat panel, any -sync tolerances should be removed from the corresponding ``Monitor'' section. -The driver will automatically calculate these from the mode that is active on -server entry. The driver also inserts timings for a mode called "Native -panel mode" that represents the panel's native resolution. +For a digital flat panel, any sync tolerances should be removed from the cor- +responding ``Monitor'' section. The driver will automatically calculate +these from the mode that is active on server entry. The driver also inserts +timings for a mode called "Native panel mode" that represents the panel's +native resolution. 7. Known problems and limitations There are several known problems or limitations related to the XFree86 ATI driver. They include: - o A number of system lockups and blank screens have been reported when - using PCI Mach64 adapters. The great majority of these problems have - been found to be due to system aspects that are unrelated to this - driver. As of this writing, these problems can be divided into two gen- - eral areas: - - Improper mouse protocol specification with some recent mice. Try dif- - ferent protocol specifications or another mouse. - - A system conflict with APM. This problem is Linux-specific. There is a - bug in kernels 2.0.31 or earlier that prevents proper APM operation. - Upgrade to a more recent kernel or disable APM support in the kernel. - o When using a Mach64's accelerator CRTC, the virtual resolution must be less than 8192 pixels wide. The VGA CRTC further limits the virtual resolution width to less than 4096 pixels, or to less than 2048 pixels @@ -598,8 +596,23 @@ damage the adapter. o Except as in the previous items, clocks are limited to 80MHz on most - adapters, although many are capable of higher frequencies. This will be - fixed in a future release. + adapters, although many are capable of higher frequencies. This will + eventually be fixed in a future release. + + o The use of a laptop's hot-keys to switch displays while this driver is + active can cause lockups and/or other woes, and is therefore not recom- + mended. It is not currently possible to solve this problem. + + o In situations where the driver is to simultaneously display on both a + panel and a CRT, the same image will be seen on both. In particular, + this means the CRT must be able to synchronise with the timings of the + panel's native resolution. This is quite evident when the panel has + ``odd-ball'' dimensions, such as 1400x1050, a resolution not commonly + possible on CRTs or projection equipment. + + Also, the display of independent images on the panel and CRT is not cur- + rently implemented, and might never be, pending resolution of the previ- + ous item. Support for the following will be added in a future release: @@ -632,8 +645,8 @@ Secondly, please check XFree86's doc directory for additional information. Thirdly, a scan through the comp.windows.x.i386unix and comp.os.linux.x news- -groups using your favourite archiving service can also prove useful in -resolving problems. +groups and the xfree86 mailing list using your favourite archiving service +can also prove useful in resolving problems. If you are still experiencing problems, you can send me non-HTMLised e-mail at . Please be as specific as possible when describing the @@ -650,13 +663,13 @@ on a non-functional ATI driver written by Thomas Roell (currently of Xi Graphics). -Then Doug Evans (dje@cygnus.com) added support for the ATI VGA Wonder XL, -trying in the process to make the driver work with all other ATI adapters -available at the time. - -Rik Faith (faith@precisioninsight.com) obtained the X11R4 driver from Doug -Evans in the summer of 1992 and ported the code to the X386 part of X11R5. -This subsequently became part of XFree86. +Then Doug Evans added support for the ATI VGA Wonder XL, trying in the pro- +cess to make the driver work with all other ATI adapters available at the +time. + +Rik Faith obtained the X11R4 driver from Doug Evans in the summer of 1992 and +ported the code to the X386 part of X11R5. This subsequently became part of +XFree86. I (Marc Aurele La France) took over development and maintenance of the driver in the fall of 1993 after Rik got rid of his VGA Wonder adapter. @@ -690,7 +703,7 @@ The introduction of version 6 is a first swipe at porting the driver to non- Intel architectures. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.39 2002/01/16 16:25:54 tsi Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.43 2003/02/25 19:31:02 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.59 2002/01/16 20:51:02 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.63 2003/02/25 21:32:35 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.chips diff -u xc/programs/Xserver/hw/xfree86/doc/README.chips:3.38 xc/programs/Xserver/hw/xfree86/doc/README.chips:3.43 --- xc/programs/Xserver/hw/xfree86/doc/README.chips:3.38 Thu Nov 15 12:37:22 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.chips Sun Feb 23 23:03:23 2003 @@ -7,7 +7,7 @@ 1. Introduction -With the release of XFree86 version 4.2.0, the Chips and Technologies driver +With the release of XFree86 version 4.3.0, the Chips and Technologies driver has been extensively rewritten and contains many new features. This driver must be considered work in progress, and those users wanting stability are encouraged to use the older XFree86 3.3.x versions. However this version of @@ -956,7 +956,7 @@ startx -- -depth 24 -fbbpp 32 8-8-8 RGB truecolor - however as XFree86 version 4.2.0 allows 32bpp pixmaps to be used + however as XFree86 version 4.3.0 allows 32bpp pixmaps to be used with framebuffers operating in 24bpp, this mode of operating will cost performance for no gain in functionality. @@ -1030,4 +1030,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.38 2001/10/01 13:44:02 eich Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.38 2001/11/15 17:37:22 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.43 2003/02/24 04:03:23 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.dps diff -u xc/programs/Xserver/hw/xfree86/doc/README.dps:1.3 xc/programs/Xserver/hw/xfree86/doc/README.dps:1.4 --- xc/programs/Xserver/hw/xfree86/doc/README.dps:1.3 Fri Jun 1 14:28:42 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.dps Sun Jan 19 23:10:01 2003 @@ -164,7 +164,7 @@ [PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April 1993. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.2 2003/01/20 03:43:07 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.dps,v 1.3 2001/06/01 18:28:42 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.dps,v 1.4 2003/01/20 04:10:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.fonts diff -u xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.19 xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.22 --- xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.19 Wed Dec 19 19:15:41 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.fonts Sun Jan 19 23:10:01 2003 @@ -2,32 +2,189 @@ Juliusz Chroboczek, - 26 November 2001 + 17 January 2003 1. Introduction -This document describes the support for fonts in XFree86. Section Installing -fonts (section 2., page 1) is aimed at the casual user wishing to install -fonts in the X server; the rest of the document describes the font support in -more detail. - -We only describe font support within the core X protocol. Issues relating to -fonts within the RENDER extension, the GLX (OpenGL) extension or the PEX -extension are outside the scope of this document. +This document describes the support for fonts in XFree86. Installing fonts +(section 2., page 1) is aimed at the casual user wishing to install fonts in +XFree86; the rest of the document describes the font support in more detail. We assume some familiarity with digital fonts. If anything is not clear to -you, please consult Appendix Background (section 6., page 1) at the end of +you, please consult Appendix: Background (section 5., page 1) at the end of this document for background information. +1.1 Two font systems + +XFree86 includes two font systems: the core X11 fonts system, which is pre- +sent in all implementations of X11, and the Xft fonts system, which is not +currently distributed with implementations of X11 that are not based on +XFree86 but will hopefully be included by them in the future + +The core X11 fonts system is directly derived from the fonts system included +with X11R1 in 1987, which could only use monochrome bitmap fonts. Over the +years, it has been more or less happily coerced into dealing with scalable +fonts and rotated glyphs. + +Xft was designed from the start to provide good support for scalable fonts, +and do so efficiently. Unlike the core fonts system, it supports features +such as anti-aliasing and sub-pixel rasterisation. Perhaps more importantly, +it gives applications full control over the way glyphs are rendered, making +fine typesetting and WYSIWIG display possible. Finally, it allows applica- +tions to use fonts that are not installed system-wide for displaying docu- +ments with embedded fonts. + +Xft is not compatible with the core fonts system: usage of Xft requires mak- +ing fairly extensive changes to toolkits (user-interface libraries). While +XFree86 will continue to maintain the core fonts system, toolkit authors are +encouraged to switch to Xft as soon as possible. + 2. Installing fonts + +This section explains how to configure both Xft and the core fonts system to +access newly-installed fonts. + +2.1 Configuring Xft + +Xft has no configuration mechanism itself, rather it relies upon the fontcon- +fig library to configure and customize fonts. That library is not specific +to XFree86 or indeed on any particular font output mechanism. This discus- +sion describes how fontconfig, rather than Xft, works. + +2.1.1 Installing fonts in Xft + +Fontconfig looks for fonts in a set of well-known directories that include +all of XFree86's standard font directories (`/usr/X11R6/lib/X11/lib/fonts/*') +by default) as well as a directory called `.fonts/' in the user's home direc- +tory. Installing a font for use by Xft applications is as simple as copying +a font file into one of these directories. + + $ cp lucbr.ttf ~/.fonts/ + +Fontconfig will notice the new font at the next opportunity and rebuild its +list of fonts. If you want to trigger this update from the command line (for +example in order to globally update the system-wide Fontconfig information), +you may run the command `fc-cache'. + + $ fc-cache + +2.1.2 Fine-tuning Xft + +Fontconfig's behaviour is controlled by a set of configuration files: a sys- +tem-wide configuration file, `/etc/fonts/fonts.conf', and a user-specific +file called `.fonts.conf' in the user's home directory (this can be overrid- +den with the `FONTCONFIG_FILE' environment variable). + +Every Fontconfig configuration file must start with the following boiler- +plate: + + + + + +In addition, every Fontconfig configuration file must end with the following +line: + + + +The default Fontconfig configuration file includes the directory `~/.fonts/' +in the list of directories searched for font files, and this is where user- +specific font files should be installed. In the unlikely case that a new +font directory needs to be added, this can be done with the following syntax: + + /usr/local/share/fonts/ + +Another useful option is the ability to disable anti-aliasing (font smooth- +ing) for selected fonts. This can be done with the following syntax: + + + + Lucida Console + + + false + + + +Anti-aliasing can be disabled for all fonts by the following incantation: + + + + false + + + +Xft supports sub-pixel rasterisation on LCD displays. XFree86 should auto- +matically enable this feature on laptops and when using an LCD monitor con- +nected with a DVI cable; you can check whether this was done by typing + + $ xdpyinfo -ext RENDER | grep sub-pixel + +If this doesn't print anything, you will need to configure Render for your +particular LCD hardware manually; this is done with the following syntax: + + + + rgb + + + +The string `rgb' within the `'...`' specifies the order of +pixel components on your display, and should be changed to match your hard- +ware; it can be one of `rgb (normal LCD screen), `bgr' (backwards LCD +screen), `vrgb' (LCD screen rotated clockwise) or `vbgr' (LCD screen rotated +counterclockwise). + +2.1.3 Configuring applications + +Because most current applications use the core fonts system by default, it is +necessary to explicitly configure them to use Xft. How this is done depends +on the application. + +XTerm can be set to use Xft by using the `-fa' command line option or by set- +ting the `XTerm*faceName' resource: + + XTerm*faceName: Courier + +or + + $ xterm -fa "Courier" + +For applications based on GTK+ 2.0 (including GNOME 2 applications), the +environment variable `GDK_USE_XFT' should be set to `1': -Installing fonts in XFree86 is a two step process. First, you need to create -a font directory that contains all the relevant font files as well as some -index files. You then need to inform the X server of the existence of this -new directory by including it in the font path. + $ export GDK_USE_XFT=1 -2.1 Installing bitmap fonts +GTK+ 2.2 uses Xft by default. +For KDE applications, you should select ``Anti-alias fonts'' in the ``Fonts'' +panel of KDE's ``Control Center''. Note that this option is misnamed: it +switches KDE to using Xft but doesn't enable anti-aliasing in case it was +disabled by your Xft configuration file. + +(What about Mozilla?) + +2.1.4 Troubleshooting + +If some Xft-based applications don't seem to notice the changes you are mak- +ing to your configuration files, they may be linked against the XFree86 4.2 +version of Xft. In order to fix the problem, you should relink them against +a current version of Xft; on most systems, it is enough to install the cur- +rent version of the Xft and Fontconfig libraries. + +If, for some reason, you cannot upgrade the shared libraries, please check +the Xft(3) manual page included with XFree86 4.2 for the configuration mecha- +nisms of the previous version of Xft. + +2.2 Configuring the core X11 fonts system + +Installing fonts in the core system is a two step process. First, you need +to create a font directory that contains all the relevant font files as well +as some index files. You then need to inform the X server of the existence +of this new directory by including it in the font path. + +2.2.1 Installing bitmap fonts + The XFree86 server can use bitmap fonts in both the cross-platform BDF format and the somewhat more efficient binary PCF format. (XFree86 also supports the obsolete SNF format.) @@ -39,7 +196,7 @@ $ bdftopcf courier12.bdf -You may then want to compress the resulting PCF font files: +You will then want to compress the resulting PCF font files: $ gzip courier12.pcf @@ -49,20 +206,19 @@ `fonts.dir' by running the command `mkfontdir' (please see the mkfontdir(1) manual page for more information): - $ mkdir /usr/local/share/fonts/bitmap - $ cp *.pcf.gz /usr/local/share/fonts/bitmap - $ cd /usr/local/share/fonts/bitmap - $ mkfontdir + $ mkdir /usr/local/share/fonts/bitmap/ + $ cp *.pcf.gz /usr/local/share/fonts/bitmap/ + $ mkfontdir /usr/local/share/fonts/bitmap/ All that remains is to tell the X server about the existence of the new font -directory; see Section Setting the server font path (section 2.4, page 1). +directory; see Setting the server font path (section 2.2.4, page 1) below. -2.2 Installing scalable fonts +2.2.2 Installing scalable fonts The XFree86 server supports scalable fonts in four formats: Type 1, Speedo, TrueType and CIDFont. This section only applies to the former three; for -information on CIDFonts, please see Section Installing CIDFonts (section 2.3, -page 1) later in this document. +information on CIDFonts, please see Installing CIDFonts (section 2.2.3, page +1) later in this document. Installing scalable fonts is very similar to installing bitmap fonts: you create a directory with the font files, and run `mkfontdir' to create an @@ -70,58 +226,23 @@ There is, however, a big difference: `mkfontdir' cannot automatically recog- nise scalable font files. For that reason, you must first index all the font -files in a file called `fonts.scale'. This file has the same format as a -`fonts.dir' file, and typically looks as follows: +files in a file called `fonts.scale'. While this can be done by hand, it is +best done by using the `mkfontscale' utility. - 4 - cour.pfa -adobe-courier-medium-r-normal-0-0-0-0-p-0-iso8859-1 - cour.pfa -adobe-courier-medium-r-normal-0-0-0-0-p-0-iso8859-2 - couri.pfa -adobe-courier-medium-i-normal-0-0-0-0-p-0-iso8859-1 - couri.pfa -adobe-courier-medium-i-normal-0-0-0-0-p-0-iso8859-2 - -The first line indicates the number of entries in the file. Each line after -the first consists of two fields separated by a space; the first field is the -name of the font file, and the second one is the name under which the font -will appear to the server. This name should obey the X Logical Font Descrip- -tion conventions (see Section The X Logical Font Description (section 6.2, -page 1)). The format of this file is fully described in the mkfontdir(1) -manual page. - -Note that multiple lines may point at the same font file. This is most com- -monly done in order to make a single font available under multiple encodings; -please see Section Fonts and internationalisation (section 4., page 1). - -While it is possible to create the `fonts.scale' file by hand, it is simpler -and more convenient to have it generated automatically. Utilities to perform -this task are available, but are not currently included with XFree86. For -Type 1 fonts, you may use a utility called `type1inst' which is available -from standard Free Software repositories throughout the world. - -For TrueType fonts, you may use `ttmkfdir', available from Joerg Pommnitz's -xfsft page . - -After the `fonts.scale' is created, you may run `mkfontdir' as above; this -time, however, you need to create an index of encoding files called `encod- -ings.dir' in addition to the `fonts.dir' file. This is done by using -`mkfontdir' with the `-e' flag: + $ mkfontscale /usr/local/share/fonts/Type1/ + $ mkfontdir /usr/local/share/fonts/Type1/ - $ cd /usr/local/share/fonts/Type1 - $ mkfontdir -e /usr/X11R6/lib/font/encodings +Under some circumstances, it may be necessary to modify the `fonts.scale' +file generated by mkfontscale; for more information, please see the mkfont- +dir(1) and mkfontscale(1) manual pages and Core fonts and internationalisa- +tion (section 4.1, page 1) later in this document. -For more information, please see the mkfontdir(1) manual page and Section -Fonts and internationalisation (section 4., page 1) later in this document. +2.2.3 Installing CID-keyed fonts -2.3 Installing CID-keyed fonts - The CID-keyed font format was designed by Adobe Systems for fonts with large character sets. A CID-keyed font, or CIDFont for short, contains a collec- tion of glyphs indexed by character ID (CID). -Adobe make some sample CIDFonts and a complete set of CMaps available from -O'Reilly's FTP site . - In order to map such glyphs to meaningful indices, Adobe provide a set of CMap files. The PostScript name of a font generated from a CIDFont consists of the name of the CIDFont and the name of the CMap separated by two dashes. @@ -130,8 +251,8 @@ Munhwa-Regular--UniKS-UCS2-H -The CIDFont support in XFree86 requires a very rigid directory structure. -The main directory must be called `CID' (its location defaults to +The CIDFont code in XFree86 requires a very rigid directory structure. The +main directory must be called `CID' (its location defaults to `/usr/X11R6/lib/X11/fonts/CID' but it may be located anywhere), and it should contain a subdirectory for every CID collection. Every subdirectory must contain subdirectories called CIDFont (containing the actual CIDFont files), @@ -157,8 +278,8 @@ Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \ -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1 -(both names on the same line). As above, running `mkfontdir' creates the -`fonts.dir' file: +(both names on the same line). Running `mkfontdir' creates the `fonts.dir' +file: $ cd /usr/local/share/fonts/CID $ mkfontdir @@ -173,11 +294,11 @@ whenever a change is made to any of the CID-keyed fonts, or when the CID- keyed fonts are copied to a machine with a different architecture. -2.4 Setting the server's font path +2.2.4 Setting the server's font path The list of directories where the server looks for fonts is known as the font path. Informing the server of the existence of a new font directory consists -in putting it on the font path. +of putting it on the font path. The font path is an ordered list; if a client's request matches multiple fonts, the first one in the font path is the one that gets used. When match- @@ -195,7 +316,7 @@ $ xset q -2.4.1 Temporary modification of the font path +2.2.4.1 Temporary modification of the font path The `xset' utility may be used to modify the font path for the current ses- sion. The font path is set with the command xset fp; a new element is added @@ -205,34 +326,36 @@ $ xset fp+ /usr/local/fonts/bitmap Conversely, an element may be removed from the front of the font path with -`xset -fp', and removed from the end with `xset fp-'. +`xset -fp', and removed from the end with `xset fp-'. You may reset the font +path to its default value with `xset fp default'. For more information, please consult the xset(1) manual page. -2.4.2 Permanent modification of the font path +2.2.4.2 Permanent modification of the font path -The default font path (the one used just after server startup) is specified -in the X server's `XF86Config' file. It is computed by appending all the -directories mentioned in the `FontPath' entries of the `Files' section in the -order in which they appear. +The default font path (the one used just after server startup or after `xset +fp default') is specified in the X server's `XF86Config' file. It is com- +puted by appending all the directories mentioned in the `FontPath' entries of +the `Files' section in the order in which they appear. FontPath "/usr/local/fonts/Type1" ... FontPath "/usr/local/fonts/bitmap" -For more information, please consult the `XF86Config'(5) manual page. +For more information, please consult the XF86Config(5) manual page. -2.5 Troubleshooting +2.2.5 Troubleshooting If you seem to be unable to use some of the fonts you have installed, the first thing to check is that the `fonts.dir' files are correct and that they -are readable by the server. If this doesn't help, it is quite possible that +are readable by the server (the X server usually runs as root, beware of NFS- +mounted font directories). If this doesn't help, it is quite possible that you are trying to use a font in a format that is not supported by your server. -XFree86 supports the BDF, PCF, SNF, Type 1, Speedo, TrueType and CIDFont font -formats. However, not all XFree86 servers come with all the font backends -configured in. +XFree86 supports the BDF, PCF, SNF, Type 1, Speedo, TrueType, OpenType and +CIDFont font formats. However, not all XFree86 servers come with all the +font backends configured in. On most platforms, the XFree86 servers are modular: the font backends are included in modules that are loaded at runtime. The modules to be loaded are @@ -247,13 +370,15 @@ o "bitmap": bitmap fonts (`*.bdf', `*.pcf' and `*.snf'); - o "type1": Type 1 fonts (`*.pfa' and `*.pfb') and CIDFonts; + o "freetype": TrueType fonts (`*.ttf' and `*.ttc'), OpenType fonts + (`*.otf' and `*.otc') and Type 1 fonts (`*.pfa' and `*.pfb'); - o "speedo": Bitstream Speedo fonts (`*.spd'); + o "type1": alternate Type 1 backend (`*.pfa' and `*.pfb') and CIDFont + backend; - o "freetype": TrueType fonts (`*.ttf' and `*.ttc'); + o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc'); - o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc'). + o "speedo": Bitstream Speedo fonts (`*.spd'). Please note that the argument of the `Load' directive is case-sensitive. @@ -261,15 +386,15 @@ 3.1 Standard bitmap fonts -The Sample Implementation of X11 comes with a large number of bitmap fonts, -including the `fixed' family, and bitmap versions of Courier, Times and Hel- -vetica. In the SI, these fonts are provided in the ISO 8859-1 encoding (ISO -Latin Western-European). +The Sample Implementation of X11 (SI) comes with a large number of bitmap +fonts, including the `fixed' family, and bitmap versions of Courier, Times, +Helvetica and some members of the Lucida family. In the SI, these fonts are +provided in the ISO 8859-1 encoding (ISO Latin Western-European). In XFree86, a number of these fonts are provided in Unicode-encoded font files instead. At build time, these fonts are split into font files encoded -according to legacy encodings, a process which enables us to provide the -standard fonts in a number of regional encodings with no duplication of work. +according to legacy encodings, a process which allows us to provide the stan- +dard fonts in a number of regional encodings with no duplication of work. For example, the font file @@ -281,7 +406,7 @@ is a Unicode-encoded version of the standard `fixed' font with added support for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA and other scripts -plus numerous technical symbols. It contains over 2800 glyphs, covering all +plus numerous technical symbols. It contains over 2800 glyphs, covering all characters of ISO 8859 parts 1-5, 7-10, 13-15, as well as all European IBM and Microsoft code pages, KOI8, WGL4, and the repertoires of many other char- acter sets. @@ -290,29 +415,14 @@ 6x13-ISO8859-1.bdf 6x13-ISO8859-2.bdf - 6x13-ISO8859-3.bdf - 6x13-ISO8859-4.bdf - 6x13-ISO8859-5.bdf - 6x13-ISO8859-7.bdf - 6x13-ISO8859-8.bdf - 6x13-ISO8859-9.bdf - 6x13-ISO8859-10.bdf - 6x13-ISO8859-13.bdf + ... 6x13-ISO8859-15.bdf 6x13-KOI8-R.bdf with respective XLFDs -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-2 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-3 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-4 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-5 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-7 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-8 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-9 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-10 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-13 + ... -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15 -misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r @@ -320,10 +430,6 @@ -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1 -(The conversion of the standard fonts to Unicode was mainly performed by -Markus Kuhn. Markus is a man of taste, which makes his use of Perl in the -conversion process somewhat surprising.) - 3.2 The ClearlyU Unicode font family The ClearlyU family of fonts provides a set of 12 pt, 100 dpi proportional @@ -361,10 +467,6 @@ The Ligature font contains ligatures for various scripts that may be useful for improved presentation of text. -(The ClearlyU family was designed by Mark Leisher. Mark's usage of the -foundry name mutt predates the mailer of the same name, but he won't say -more.) - 3.3 Standard scalable fonts XFree86 includes all the scalable fonts distributed with X11R6. @@ -403,7 +505,7 @@ XFree86 includes Speedo versions of the Bitstream Courier and Charter fonts. In order to use these fonts, you should ensure that your X server is loading -the `Speedo' font backend; see Section Troubleshooting (section 2.5, page 1). +the `Speedo' font backend; see Troubleshooting (section 2.2.5, page 1). These fonts cover all of ISO 8859-1 and almost all of ISO 8859-2. They have XLFD name @@ -435,12 +537,12 @@ Latin 1 range, as well as the Extended Latin range and some additional punc- tuation characters. In particular, these fonts include all the glyphs needed for ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the -Adobe Standard encoding and the Windows 3.1 character set. +Adobe Standard encoding and the Windows 3.1 character set. The glyph coverage of the Type 1 versions is somewhat reduced, and only cov- ers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding. -The Luxi fonts are original designs by Kris Holmes and Charles Bigelow. Luxi +The Luxi fonts are original designs by Kris Holmes and Charles Bigelow. Luxi fonts include seriffed, sans serif, and monospaced styles, in roman and oblique, and normal and bold weights. The fonts share stem weight, x-height, capital height, ascent and descent, for graphical harmony. @@ -463,14 +565,18 @@ An earlier version of the Luxi fonts was made available under the name Lucidux. This name should no longer be used due to trademark uncertainties, -and all traces of the Lucidux name have been removed from this version of -XFree86. +and all traces of the Lucidux name have been removed from XFree86. + +4. More about core fonts + +This section describes XFree86-specific enhancements to the core X11 fonts +system. -4. Fonts and internationalisation +4.1 Core fonts and internationalisation -The scalable font backends (Type 1, Speedo and TrueType) can now automati- -cally re-encode fonts to the encoding specified in the XLFD in fonts.dir. -For example, a fonts.dir file can contain entries for the Type 1 Courier font +The scalable font backends (Type 1, Speedo and TrueType) can automatically +re-encode fonts to the encoding specified in the XLFD in `fonts.dir'. For +example, a `fonts.dir' file can contain entries for the Type 1 Courier font such as cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 @@ -479,7 +585,7 @@ which will lead to the font being recoded to ISO 8859-1 and ISO 8859-2 respectively. -4.1 The fontenc layer +4.1.1 The fontenc layer Three of the scalable backends (Type 1, Speedo, and the FreeType TrueType backend) use a common fontenc layer for font re-encoding. This allows these @@ -488,10 +594,9 @@ Please note: the X-TrueType (X-TT) backend does not use the fontenc layer, but instead uses its own method for font reencoding. If you are only inter- -ested in X-TT you may want to skip to Section Using Symbol Fonts (section -4.5, page 1), as the intervening information does not apply to X-TT. X-TT -itself is described in more detail in Section X-TrueType (section 5.2, page -1). +ested in X-TT you may want to skip to Using Symbol Fonts (section 4.1.5, page +1), as the intervening information does not apply to X-TT. X-TT itself is +described in more detail in X-TrueType (section 4.2.3, page 1). In the fontenc layer, an encoding is defined by a name (such as iso8859-1), possibly a number of aliases (alternate names), and an ordered collection of @@ -531,7 +636,7 @@ o koi8-u: KOI8 Ukrainian (see RFC 2319); - o koi8-ru: KOI8 Russian/Ukrainian + o koi8-ru: KOI8 Russian/Ukrainian; o koi8-uni: KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian); @@ -547,60 +652,61 @@ file is scanned for the requested encoding, and the relevant encoding defini- tion file is read in. The `mkfontdir' utility, when invoked with the `-e' option followed by the name of a directory containing encoding files, can be -used to automatically build `encodings.dir' files. See the mkfontdir(1) man- -ual page for more details. +used to automatically build `encodings.dir' files. Please see the mkfont- +dir(1) manual page for more details. A number of encoding files for common encodings are included with XFree86. -Information on writing new encoding files can be found in Section Format of -encodings directory files (section 4.3, page 1) and Format of encoding files -(section 4.4, page 1) later in this document. +Information on writing new encoding files can be found in Format of encodings +directory files (section 4.1.3, page 1) and Format of encoding files (section +4.1.4, page 1) later in this document. + +4.1.2 Backend-specific notes about fontenc + +4.1.2.1 The FreeType backend + +For TrueType and OpenType fonts, the FreeType backend scans the mappings in +order. Mappings with a target of PostScript are ignored; mappings with a +TrueType or Unicode target are checked against all the cmaps in the file. +The first applicable mapping is used. + +For Type 1 fonts, the FreeType backend first searches for a mapping with a +target of PostScript. If one is found, it is used. Otherwise, the backend +searches for a mapping with target Unicode, which is then composed with a +built-in table mapping codes to glyph names. Note that this table only cov- +ers part of the Unicode code points that have been assigned names by Adobe. + +Specifying an encoding value of adobe-fontspecific for a Type 1 font disables +the encoding mechanism. This is useful with symbol and incorrectly encoded +fonts (see Incorrectly encoded fonts (section 4.1.6, page 1) below). -4.2 Backend-specific notes about fontenc - -4.2.1 Type 1 - -The Type 1 backend first searches for a mapping with a target of PostScript. -If one is found, it is used. Otherwise, the backend searches for a mapping -with target Unicode, which is then composed with a built-in table mapping -codes to glyph names. Note that this table only covers part of the Unicode -code points that have been assigned names by Adobe. - -If neither a PostScript or Unicode mapping is found, the backend defaults to +If a suitable mapping is not found, the FreeType backend defaults to ISO 8859-1. -Specifying an encoding value of adobe-fontspecific disables the encoding -mechanism. This is useful with symbol and incorrectly encoded fonts (see -Section Incorrectly encoded fonts (section 4.6, page 1) below). +4.1.2.2 Type 1 -The Type 1 backend currently limits all encodings to 8-bit codes. +The Type 1 backend behaves similarly to the FreeType backend with Type 1 +fonts, except that it limits all encodings to 8-bit codes. -4.2.2 Speedo +4.1.2.3 Speedo The Speedo backend searches for a mapping with a target of Unicode, and uses it if found. If none is found, the backend defaults to ISO 8859-1. The Speedo backend limits all encodings to 8-bit codes. - -4.2.3 The FreeType TrueType backend -The TrueType backend scans the mappings in order. Mappings with a target of -PostScript are ignored; mappings with a TrueType or Unicode target are -checked against all the cmaps in the file. The first applicable mapping is -used. +4.1.3 Format of encoding directory files -If you are writing an encoding file to be used with the TrueType backend, you -should ensure that mappings are mentioned in decreasing order of preference. - -4.3 Format of encoding directory files - In order to use a font in an encoding that the font backend does not know -about, you need to have an `encodings.dir' file in the same directory as the -font file used. The `encodings.dir' file has a similar format to -`fonts.dir'. Its first line specifies the number of encodings, while every -successive line has two columns, the name of the encoding, and the name of -the encoding file; this can be relative to the current directory, or abso- -lute. Every encoding name should agree with the encoding name defined in the -encoding file. For example, +about, you need to have an `encodings.dir' file either in the same directory +as the font file used or in a system-wide location +(`/usr/X11R6/lib/X11/fonts/encodings/' by default). + +The `encodings.dir' file has a similar format to `fonts.dir'. Its first line +specifies the number of encodings, while every successive line has two +columns, the name of the encoding, and the name of the encoding file; this +can be relative to the current directory, or absolute. Every encoding name +should agree with the encoding name defined in the encoding file. For exam- +ple, 3 mulearabic-0 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-0.enc @@ -616,7 +722,7 @@ The `encoding.dir' files are best maintained by the `mkfontdir' utility. Please see the mkfontdir(1) manual page for more information. -4.4 Format of encoding files +4.1.4 Format of encoding files The encoding files are ``free form,'' i.e. any string of whitespace is equiv- alent to a single space. Keywords are parsed in a non-case-sensitive manner, @@ -635,7 +741,6 @@ STARTENCODING mulearabic-0 ALIAS arabic-0 - ALIAS something-else The name of the encoding and its aliases should be suitable for use in an XLFD font name, and therefore contain exactly one dash `-'. @@ -755,7 +860,7 @@ with an unknown keyword are silently ignored, as are mapping sections with an unknown target. -4.5 Using symbol fonts +4.1.5 Using symbol fonts Type 1 symbol fonts should be installed using the adobe-fontspecific encod- ing. @@ -768,21 +873,21 @@ In order to guarantee consistent results (especially between Type 1 and True- Type versions of the same font), it is possible to define a special encoding for a given font. This has already been done for the ZapfDingbats font; see -the file encodings/adobe-dingbats.enc. +the file `encodings/adobe-dingbats.enc'. -4.6 Hints about using badly encoded fonts +4.1.6 Hints about using badly encoded fonts A number of text fonts are incorrectly encoded. Incorrect encoding is some- times done by design, in order to make a font for an exotic script appear -like an ordinary Western text font. It is often the result of the font -designer's laziness or incompetence; for some reason, most people seem to -find it easier to invent idiosyncratic glyph names rather than follow the -Adobe glyph list. +like an ordinary Western text font on systems which are not easily extended +with new locale data. It is often the result of the font designer's laziness +or incompetence; for some reason, most people seem to find it easier to +invent idiosyncratic glyph names rather than follow the Adobe glyph list. There are two ways of dealing with such fonts: using them with the encoding they were designed for, and creating an ad hoc encoding file. -4.6.1 Using fonts with the designer's encoding +4.1.6.1 Using fonts with the designer's encoding In the case of Type 1 fonts, the font designer can specify a default encod- ing; this encoding is requested by using the `adobe-fontspecific' encoding in @@ -796,48 +901,42 @@ `microsoft-symbol', `microsoft-cp1252', `microsoft-win3.1', or `apple-roman' should yield reasonable results. -4.6.2 Specifying an ad hoc encoding file +4.1.6.2 Specifying an ad hoc encoding file It is always possible to define an encoding file to put the glyphs in a font in any desired order. Again, see the `encodings/adobe-dingbats.enc' file to see how this is done. -4.6.3 Specifying font aliases +4.1.6.3 Specifying font aliases By following the directions above, you will find yourself with a number of fonts with unusual names --- with encodings such as `adobe-fontspecific', `microsoft-win3.1' etc. In order to use these fonts with standard applica- tions, it may be useful to remap them to their proper names. -This is done by writing a `fonts.alias' file. The format of this file is sim- -ilar to the format of the `fonts.dir' file, except that it maps XLFD names to -XLFD names. A `fonts.alias' file might look as follows: +This is done by writing a `fonts.alias' file. The format of this file is very +simple: it consists of a series of lines each mapping an alias name to a font +name. A `fonts.alias' file might look as follows: - 1 "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \ "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific" (both XLFD names on a single line). The syntax of the `fonts.alias' file is -precisely described in the mkfontdir(1) manual page. - -5. Additional notes about TrueType support +more precisely described in the mkfontdir(1) manual page. -This version of XFree86 comes with two TrueType backends, FreeType (module -`freetype', formerly known as xfsft) and X-TrueType (module `xtt'). These -two backends are not compatible: only one of them can be used at any one -time. +4.2 Additional notes about scalable core fonts -In order to use the FreeType backend, please check that the `Module' section -of your `XF86Config' file contains a line that reads +The FreeType backend (module `freetype', formerly known as xfsft) is able to +deal with both TrueType and Type 1 fonts. This puts it in conflict with the +X-TT and Type 1 backends respectively. - Load "freetype" +If both the FreeType and the Type 1 backends are loaded, the FreeType backend +will be used for Type 1 fonts. If both the FreeType and X-TT backends are +loaded, X-TT will be used for TrueType fonts. -In order to use the X-TrueType backend, replace the line in your XF86Config -file that loads the freetype module with a line that reads +4.2.1 Delayed glyph rasterisation - Load "xtt" - -Both TrueType backends delay glyph rasterisation up to the time at which a +Both FreeType and X-TT delay glyph rasterisation up to the time at which a glyph is first used. For this reason, they only provide an approximate value for the ``average width'' font property. @@ -852,13 +951,15 @@ this optimisation when useful, but be warned that not all monospaced fonts are character-cell fonts. -5.1 The FreeType TrueType backend +4.2.2 About the FreeType backend -The FreeType backend (formerly xfsft) is a backend based on the FreeType -library (see the FreeType web site ) and has -support for the ``fontenc'' style of internationalisation (see Section The -fontenc layer (section 4.1, page 1)). This backend supports TrueType Font -files (`*.ttf') and TrueType Collections (`*.ttc'). +The FreeType backend (formerly xfsft) is a backend based on version 2 of the +FreeType library (see the FreeType web site ) +and has support for the ``fontenc'' style of internationalisation (see The +fontenc layer (section 4.1.1, page 1)). This backend supports TrueType font +files (`*.ttf'), OpenType font files (`*.otf'), TrueType Collections +(`*.ttc'), OpenType Collections (`*.otc') and Type 1 font files (`*.pfa' and +`*.pfb'). In order to access the faces in a TrueType Collection file, the face number must be specified in the fonts.dir file before the filename within colons. @@ -869,20 +970,18 @@ refers to face 2 in the `mincho.ttc' TrueType Collection file. The FreeType backend uses the fontenc layer in order to support recoding of -fonts; this was described in Section The fontenc layer (section 4.1, page 1) -and especially Section FreeType-specific notes about fontenc (section 4.2.3, -page 1) earlier in this document. - -5.2 The X-TrueType TrueType backend - -The `X-TrueType' backend is another backend based on the FreeType library. -X-TrueType doesn't use the `fontenc' layer for managing font encodings, but -instead uses its own database of encodings. However, X-TrueType includes a -large number of encodings, and any encoding you need is likely to be present -in X-TrueType. +fonts; this was described in The fontenc layer (section 4.1.1, page 1) and +especially FreeType-specific notes about fontenc (section 4.1.2.1, page 1) +earlier in this document. + +4.2.3 About the X-TrueType TrueType backend + +The `X-TrueType' backend is a backend based on version 1 of the FreeType +library. X-TrueType doesn't use the `fontenc' layer for managing font encod- +ings, but instead uses its own database of encodings. -X-TrueType extends the `fonts.dir' syntax with a number of options, known as -`TTCap'. A `TTCap' entry follows the general syntax +X-TrueType extends the `fonts.dir' syntax with a number of options, collec- +tively known as `TTCap'. A `TTCap' entry follows the general syntax :option=value: @@ -897,81 +996,87 @@ More information on the TTCap syntax, and on X-TrueType in general, may be found on the X-TrueType home page . -6. Appendix: background and terminology +5. Appendix: background and terminology -6.1 Characters and glyphs +5.1 Characters and glyphs A computer text-processing system inputs keystrokes and outputs glyphs, small pictures that are assembled on paper or on a computer screen. Keystrokes and glyphs do not, in general, coincide: for example, if the system does generate -ligatures, then to the two keystrokes will typically correspond a sin- -gle glyph. Similarly, if the system shapes Arabic glyphs in a reasonable -manner, then multiple different glyphs may correspond to a single keystroke. +ligatures, then to the sequence of two keystrokes will typically cor- +respond a single glyph. Similarly, if the system shapes Arabic glyphs in a +vaguely reasonable manner, then multiple different glyphs may correspond to a +single keystroke. The complex transformation rules from keystrokes to glyphs are usually fac- -tored into two simpler transformations, going through the intermediary of -characters. You may want to think of characters as the basic unit of data -that is stored e.g. in the buffer of your text editor. While the definition -of a character is intrinsically application-specific, a number of standard- -ised collections of characters have been defined. +tored into two simpler transformations, from keystrokes to characters and +from characters to glyphs. You may want to think of characters as the basic +unit of text that is stored e.g. in the buffer of your text editor. While +the definition of a character is intrinsically application-specific, a number +of standardised collections of characters have been defined. A coded character set is a set of characters together with a mapping from integer codes --- known as codepoints --- to characters. Examples of coded character sets include US-ASCII, ISO 8859-1, KOI8-R, and JIS X 0208(1990). -A coded character set need not use 8 bit integers to index characters. Many -early mainframes used 6 bit character sets, while 16 bit (or more) character +A coded character set need not use 8 bit integers to index characters. Many +early systems used 6 bit character sets, while 16 bit (or more) character sets are necessary for ideographic writing systems. -6.2 Font files, fonts, and XLFD +5.2 Font files, fonts, and XLFD Traditionally, typographers speak about typefaces and founts. A typeface is a particular style or design, such as Times Italic, while a fount is a molten-lead incarnation of a given typeface at a given size. -Digital fonts come in font files. A font file contains all the information -necessary for generating glyphs of a given typeface, and applications using -font files may access glyph information in an arbitrary order. +Digital fonts come in font files. A font file contains the information nec- +essary for generating glyphs of a given typeface, and applications using font +files may access glyph information in an arbitrary order. Digital fonts may consist of bitmap data, in which case they are said to be bitmap fonts. They may also consist of a mathematical description of glyph shapes, in which case they are said to be scalable fonts. Common formats for scalable font files are Type 1 (sometimes incorrectly called ATM fonts or -PostScript fonts), Speedo and TrueType. +PostScript fonts), TrueType and Speedo. The glyph data in a digital font needs to be indexed somehow. How this is done depends on the font file format. In the case of Type 1 fonts, glyphs are identified by glyph names. In the case of TrueType fonts, glyphs are indexed by integers corresponding to one of a number of indexing schemes (usually Unicode --- see below). - -The X11 system uses the data in font file to generate font instances, which -are collections of glyphs at a given size indexed according to a given encod- -ing. -X11 font instances are usually specified using a notation known as the X Log- -ical Font Description (XLFD). An XLFD starts with a dash `-', and consists -of fourteen fields separated by dashes, for example +The X11 core fonts system uses the data in a font file to generate font +instances, which are collections of glyphs at a given size indexed according +to a given encoding. + +X11 core font instances are usually specified using a notation known as the X +Logical Font Description (XLFD). An XLFD starts with a dash `-', and con- +sists of fourteen fields separated by dashes, for example: - -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 + -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1 Or particular interest are the last two fields `iso8859-1', which specify the font instance's encoding. +A scalable font is specified by an XLFD which contains zeroes instead of some +fields: + + -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 + X11 font instances may also be specified by short name. Unlike an XLFD, a short name has no structure and is simply a conventional name for a font -instance. Two short names are of particular interest, as they are handled -specially by the server, and the server will not start if font instances with -these names cannot be opened. These are `fixed', which specifies the fall- -back font to use when the requested font cannot be opened, and `cursor', -which specifies the set of glyphs to be used by the mouse pointer. +instance. Two short names are of particular interest, as the server will not +start if font instances with these names cannot be opened. These are +`fixed', which specifies the fallback font to use when the requested font +cannot be opened, and `cursor', which specifies the set of glyphs to be used +by the mouse pointer. -Short names are usually implemented as aliases to XLFDs; the `fixed' and -`cursor' aliases are defined in +Short names are usually implemented as aliases to XLFDs; the standard `fixed' +and `cursor' aliases are defined in /usr/X11R6/lib/X11/font/misc/fonts.alias -6.3 Unicode +5.3 Unicode Unicode () is a coded character set with the goal of uniquely identifying all characters for all scripts, current and histori- @@ -980,34 +1085,46 @@ Unicode is an open character set, meaning that codepoint assignments may be added to Unicode at any time (once specified, though, an assignment can never -be changed). For this reason, a Unicode font will be sparse, and only define -glyphs for a subset of the character registry of Unicode. +be changed). For this reason, a Unicode font will be sparse, meaning that it +only defines glyphs for a subset of the character registry of Unicode. The Unicode standard is defined in parallel with the international standard -ISO 10646. Assignments in the two standards are always equivalent, and this -document uses the terms Unicode and ISO 10646 interchangeably. +ISO 10646. Assignments in the two standards are always equivalent, and we +often use the terms Unicode and ISO 10646 interchangeably. -When used in X11, Unicode-encoded fonts should have the last two fields of -their XLFD set to `iso10646-1'. +When used in the X11 core fonts system, Unicode-encoded fonts should have the +last two fields of their XLFD set to `iso10646-1'. -7. References +6. References XFree86 comes with extensive documentation in the form of manual pages and -typeset documents. Before installing fonts, you really should read the -mkfontdir(1) manual page; other manual pages of interest include X(1), -Xserver(1), xset(1), xlsfonts(1) and showfont(1). In addition, you may want -to read the X Logical Font Description document, by Jim Flowers, which is -provided in the file `xc/doc/xlfd.PS.Z'. +typeset documents. Before installing fonts, you really should read the font- +config(3) and mkfontdir(1) manual pages; other manual pages of interest +include X(7), Xserver(1), xset(1), Xft(3), xlsfonts(1) and showfont(1). In +addition, you may want to read the X Logical Font Description document, by +Jim Flowers, which is provided in the file `xc/doc/xlfd.PS.Z'. + +The latest released version of the XFree86 documentation (including this doc- +ument and all manual pages) is available as current XFree86 documentation +. The comp.fonts FAQ , which is unfortunately no longer being maintained, contains a wealth of information about digital fonts. +Xft and Fontconfig are described on Keith Packard's Fontconfig site +. + The xfsft home page has been superseded by this document, and is now obsolete; you may however -still find some of the information it contains useful. Joerg Pommnitz' xfsft -page is the canonical -source for the `ttmkfdir' utility. +still find some of the information that it contains useful. Joerg Pommnitz' +xfsft page is the +canonical source for the `ttmkfdir' utility, which is the ancestor of +mkfontscale. + +The author's software pages +might or might not contain related scribbles and development versions of +software. The documentation of X-TrueType is available from the X-TrueType home page . @@ -1015,15 +1132,15 @@ A number of East-Asian CIDFonts are available from O'Reilly's FTP site . -The Unicode consortium site may be of interest. -But you are more likely to find what you need on Markus Kuhn's UTF-8 and Uni- -code FAQ . +While the Unicode consortium site may be of +interest, you are more likely to find what you need in Markus Kuhn's UTF-8 +and Unicode FAQ . The IANA RFC documents, available from a number of sites throughout the -world, often provide interesting information about character set issues; my -favourite is RFC 373. +world, often provide interesting information about character set issues; see +for example RFC 373. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.15 2001/12/17 19:25:36 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.20 2003/01/20 03:43:07 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.19 2001/12/20 00:15:41 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.22 2003/01/20 04:10:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.mouse diff -u xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.13 xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.20 --- xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.13 Thu Nov 15 12:37:23 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.mouse Sun Feb 23 23:03:24 2003 @@ -2,11 +2,11 @@ Kazutaka Yokota - 9 February 2000 + 17 December 2002 1. Introduction -This document describes mouse support in XFree86 4.2.0. +This document describes mouse support in XFree86 4.3.0. Mouse configuration has often been mysterious task for novice users. How- ever, once you learn several basics, it is straightforward to write the mouse @@ -311,7 +311,7 @@ o IntelliMouse - o Logictech + o Logitech o Microsoft @@ -451,6 +451,33 @@ Not all mice and OSs can support this option. This option can be set in the XF86Setup program. +5.4 Drag Lock Buttons + +Some people find it difficult or inconvenient to hold a trackball button +down, while at the same time moving the ball. Drag lock buttons simulate the +holding down of another button. When a drag lock button is first pressed, +its target buttons is "locked" down until the second time the lock button is +released, or until the button itself is pressed and released. This allows the +starting of a drag, the movement of the trackball, and the ending of the drag +to be separate operations. + + Option "DragLockButtons" "W X Y Z" + +This option consists of pairs of buttons. Each lock button number is followed +by the number of the button that it locks. In the above, button number "W" is +a drag lock button for button "X" and button number "Y" is a drag lock button +for button "Z". + +It may not be desirable to use multiple buttons as drag locks. Instead, a +"master drag lock button" may be defined. A master drag lock button acts as a +"META" key. After a master lock button is released, the next button pressed +is "locked" and not released until the second time the real button is +released. + + Option "DragLockButtons" "M" + +Since button "M" is unpaired it is a master drag lock button. + 6. Mouse Gallery In all of the examples below, it is assumed that /dev/mouse is a link to the @@ -520,10 +547,10 @@ Option "Protocol" "Auto" -6.3 Kensington Thinking Mouse (serial, PS/2) +6.3 Kensington Thinking Mouse and Kensington Expert Mouse (serial, PS/2) -This mouse has four buttons. Thinking Mouse supports the PnP COM device -specification. +These mice have four buttons. The Kensington Expert Mouse is really a track- +ball. Both Thinking mice support the PnP COM device specification. To use this mouse as a serial device: @@ -924,8 +951,41 @@ The movement of the first wheel is mapped to the button 4 and 5. The second wheel's movement will be reported as the buttons 6 and 7. + +The Kensington Expert mouse is really a trackball. It has 4 buttons arranged +in a rectangle around the ball. + + Section "InputDevice" + Identifier "DLB" + Driver "mouse" + Option "Protocol" "ThinkingMousePS/2" + Option "Buttons" "3" + Option "Emulate3Buttons" + Option "Device" "/dev/mouse" + Option "DragLockButtons" "2 1 4 3" + EndSection + +In this example, button 2 is a drag lock button for button number 1, and but- +ton 4 is a drag lock button for button 3. Since button 2 is above button 1 +and button 4 is above button 3 in the layout of this trackball, this is rea- +sonable. + +Because button 2 is being used as a drag lock, it can not be used as an ordi- +nary button. However, it can be activated by using the "Emulate3Buttons" fea- +ture. However, some people my be unable to press two buttons at the same +time. They may prefer the following InputDevice section which defines button +4 as a master drag lock button, and leaves button 2 free for ordinary use. + + Section "InputDevice" + Identifier "MasterDLB" + Driver "mouse" + Option "Protocol" "ThinkingMousePS/2" + Option "Buttons" "3" + Option "Device" "/dev/mouse" + Option "DragLockButtons" "4" + EndSection - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.11 2000/03/01 00:25:23 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.13 2002/12/17 20:55:22 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.13 2001/11/15 17:37:23 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.20 2003/02/24 04:03:24 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.neomagic diff -u xc/programs/Xserver/hw/xfree86/doc/README.neomagic:1.3 xc/programs/Xserver/hw/xfree86/doc/README.neomagic:1.4 --- xc/programs/Xserver/hw/xfree86/doc/README.neomagic:1.3 Tue Feb 29 20:48:26 2000 +++ xc/programs/Xserver/hw/xfree86/doc/README.neomagic Wed Oct 30 07:52:10 2002 @@ -184,7 +184,7 @@ 8. Authors -Jens Owen jens@precisioninsight.com Kevin E. Martin kevin@precisionin- +Jens Owen jens@tungstengraphics.com Kevin E. Martin kevin@precisionin- sight.com This driver was donated to The XFree86 Project by Precision Insight, Inc. @@ -195,4 +195,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml,v 1.1 1999/08/23 06:59:39 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.neomagic,v 1.3 2000/03/01 01:48:26 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.neomagic,v 1.4 2002/10/30 12:52:10 alanh Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.newport diff -u xc/programs/Xserver/hw/xfree86/doc/README.newport:1.5 xc/programs/Xserver/hw/xfree86/doc/README.newport:1.7 --- xc/programs/Xserver/hw/xfree86/doc/README.newport:1.5 Wed Jan 16 15:51:03 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.newport Tue Feb 25 16:32:35 2003 @@ -2,41 +2,47 @@ Guido Günther - 16 January 2002 + 24 February 2003 1. Supported Hardware -This is an unaccelerated driver for the SGI Indy's newport cards. Both the -8bit and 24bit versions are tested and working. +This is an unaccelerated driver for the SGI newport cards (a.k.a. XL) as +found in the SGI Indy and Indigo2. Both the 8bit and 24bit versions are +tested and working. 2. Features - o support for 8 and 24 bit pixel depths + o Support for 8 and 24 bit pixel depths -3. Notes + o Hardware cursor support to reduce flicker - o X -configure does not generate a XF86Config file +3. Notes - o Restoration of the console fails on some variants of the newport (Cmap - revision C) + o X -configure does not generate a XF86Config file. - o There's only a 1280x1024 mode + o There's only a 1280x1024 mode. 4. Configuration The driver auto-detects all device information necessary to initialize the -card. The only lines you need in the "Device" section of your XF86Config -file are: +card on the Indy. The only lines you need in the "Device" section of your +XF86Config file are: Section "Device" Identifier "SGI newport" Driver "newport" EndSection +Indigo2 users have to use the BusID option as documented below. + However, if you have problems with auto-detection, you can specify: o bitplanes - number of physical bitplanes (8 or 24) + o HWCursor - enable or disable hardware cursor + + o BusID - set this to "1" on the Indigo2 XL + 5. Authors o Guido Guenther @@ -54,7 +60,7 @@ o all the guys who wrote the newport_con linux kernel code - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.4 2002/01/16 18:21:04 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.6 2003/02/25 19:31:02 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.5 2002/01/16 20:51:03 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.7 2003/02/25 21:32:35 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.s3virge diff -u xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.9 xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.15 --- xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.9 Mon Jan 7 17:07:16 2002 +++ xc/programs/Xserver/hw/xfree86/doc/README.s3virge Sun Feb 23 23:03:24 2003 @@ -6,11 +6,10 @@ 1. Supported hardware -The s3virge driver in XFree86 4.2.0 supports the S3 ViRGE, ViRGE DX, GX, GX2, +The s3virge driver in XFree86 4.3.0 supports the S3 ViRGE, ViRGE DX, GX, GX2, MX, MX+, and VX chipsets. It also supports Trio3D and Trio3D/2x chips. A majority of testing is done on ViRGE DX chips, making them the most stable to -date. This release has some stabilization fixes for MX, GX2 and Trio3D, and -XVideo support for MX and GX2. +date. This release has added support for doublescan modes on DX. This driver is moderately stable, however please use caution with any new install. Please report any problems to using the @@ -24,11 +23,15 @@ o supports resolutions up to 2048x2048 - o supports color depths of 8, 15, 16, 24. + o supports color depths of 8, 15, 16 and 24 o full use of video card memory for acceleration caching when visible framebuffer leaves extra memory + o XVideo on DX, GX, GX2, MX, MX+ and Trio3D/2X at depth 16 and 24 + + o Doublescan modes on DX, possibly others (untested) + 3. Configuration: The driver auto-detects RAM size, RAMDAC and ClockChip. Do not bother putting @@ -43,9 +46,8 @@ 5. Support: For support with XFree86 video drivers please refer to our web site at -XFree86 . The web page has a bug reporting form -available. For problems not addressed in the web page please contact our -support email address +XFree86 . For problems not addressed in the web +page please contact our support email address 6. Authors @@ -59,7 +61,7 @@ o Kevin Brosius - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.5 2001/12/21 21:01:57 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.6 2003/02/13 03:21:33 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.9 2002/01/07 22:07:16 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.15 2003/02/24 04:03:24 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/RELNOTES diff -u xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.104 xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.115 --- xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.104 Thu Jan 17 18:27:44 2002 +++ xc/programs/Xserver/hw/xfree86/doc/RELNOTES Wed Feb 26 20:44:03 2003 @@ -1,222 +1,203 @@ - Release Notes for XFree86[tm] 4.2.0 + Release Notes for XFree86[tm] 4.3.0 The XFree86 Project, Inc - 17 January 2002 + 26 February 2003 Abstract This document contains some information about features present in - XFree86 4.2.0 and their status. + XFree86 4.3.0 and their status. 1. Introduction to the 4.x Release Series XFree86 4.0 was the first official release of the new XFree86 4 series. The -current release (4.2.0) is the latest in that series. XFree86 4 represents a +current release (4.3.0) is the latest in that series. XFree86 4 represents a significant redesign of the XFree86 X server. Not all of the hardware -drivers from 3.3.x have been ported to 4.x yet, but conversely, 4.x has some -hardware support not present in 3.3.x. Our Driver Status document summarizes -how the hardware driver support compares between 3.3.6 and 4.2.0. Please -check there first before downloading 4.2.0. +drivers from 3.3.x have been ported to 4.x yet, but conversely, 4.x has sup- +port for a lot of hardware that is not supported in 3.3.x. Our Driver Status +document summarizes how the hardware driver support compares between 3.3.6 +and 4.3.0. Please check there first before downloading 4.3.0. The 4.0.1 release introduced a new graphical configuration tool, "xf86cfg", -and a text mode interface was added to it for the 4.0.2 release. It is work -in progress, but definitely worth trying out. The trusty old text-based tool -"xf86config" can also be used for generating X server config files. In addi- -tion to these tools, we've been working on a configuration tool that is -built-in to the X server. It is included in the release, and it works well -for some hardware. To try it out, just run (as root) "XFree86 -configure". +and a text mode interface was added to it for the 4.0.2 release. It is the +preferred configuration tool provided by with XFree86. The trusty old text- +based tool "xf86config" can also be used for generating X server config +files. In addition to these tools, the XFree86 server has some built in +capabilities for generating a base config file. This works well for most +hardware, and in most cases is the easiest way to get an initial config file. +To try it out, just run (as root): + + XFree86 -configure + Each of these configuration options will give you a reasonable starting point for a suitable configuration file. We've put some effort into documenting -the 4.2.0 config file format, and you can find that information in the -XF86Config manual page. Check that, the driver manual pages and the related -documentation for further information. +the 4.3.0 config file format, and you can find that information in the +XF86Config manual page. Check there and the driver-specific manual pages and +the related documentation for further information. References to this +driver-specific information can be found in the tables below (section 3., +page 1). + +We have plans to make the configuration file optional in a future release. +The XFree86 server is close to being able to automatically determine a com- +plete base configuration for most popular hardware configurations. Before you go to download and install the binary distributions for this release, please have a quick read through the Installation Document. It may save you some time and help you figure out which of the binary releases you need. -The next section describes what is new in the latest version (4.2.0) compared -with the previous full release (4.1.0). The other sections below describe +The next section describes what is new in the latest version (4.3.0) compared +with the previous full release (4.2.0). The other sections below describe some of the new features and changes between 3.3.x and 4.0. There are lot's of new features, and we definitely don't have enough space to cover them all here. -2. Summary of new features in 4.2.0. +2. Summary of new features in 4.3.0. 2.1 Video Driver Enhancements - - o An s3 driver is added, which provides support for many of the older - non-ViRGE and non-Savage S3 chipsets. - - o Some vmware driver problems are fixed, and the driver is updated to - take advantage of VMWare Workstation 3.0 features. These include - improved hardware cursor handling and support for 8 bit emulation. - - o Support added for Trident *BladeXP chipsets (currently not-acceler- - ated). - - o Xv support added for Trident TGUI series chips (not 9440 though). - - o Support added for the older Trident chipsets again for ISA/VLBus (not - tested) - - o Support added to the glint driver for 3DLabs Permedia4, GLINT R4 and - Gamma 2 chipsets. - o Support added to the i810 driver for Intel i830 (tested on Linux only). + o ATI Radeon 9x00 2D support added, and 3D support added for the Radeon + 8500, 9000, 9100, and M9. The 3D support for the Radeon now includes + hardware TCL. - o Support added to the ATI radeon driver for Radeon 7500 (2D and 3D), - Radeon 8500 (2D only), and Rage128ProII. + o Support added to the i810 driver for Intel 845G, 852GM, 855GM and 865G + integrated graphics chipsets, including 2D, 3D (DRI) and XVideo. Sup- + port for the 830M has been improved, and XVideo support added. - o Support added for the Matrox G550 support. This included dual-head - support. + o National Semiconductor SC1x00, GX1, and GX2 chipset support added with + the "nsc" driver. - o Support added for NVIDIA nForce integrated graphics. + o Support added for the NVIDIA nForce2 integrated graphics, GeForce 4, + and GeForce FX. - o The NVIDIA nv driver now has preliminary powerpc support for the NV11 - and NV20. + o Major SiS driver updates for some of the latest chipsets. Unfortu- + nately the SiS 3D driver has had to be disabled because no one has yet + taken up the challenge to port it to Mesa 4.x. - o Support added to the NVIDIA nv driver for interlaced modes on hardware - that supports this, and support for resolutions higher than 1600x1200. + o The s3virge driver now has support for double scan modes on the DX + (with XVideo disabled). - o Fixes for the savage driver on 64-bit platforms, XVideo support for the - SuperSavage, and other savage driver updates. + o Updates to the savage driver, including fixing problems with the + TwisterK, and problems with incorrect memory size detection. - o The ATI r128 driver now uses the CCE DMA engine for 2D acceleration - when direct rendering is enabled, which reduces context switching over- - head and improves stability and performance for XVideo and some 2D oper- - ations. + o 2D acceleration added for the Trident CyberBladeXP/Ai1 chipsets. - o The fbdev driver now supports rotation. + o Support for big endian architectures has been added to the C&T driver. - o Various updates to the apm, ark, chips (C&T), cirrus, i128, neomagic, - newport, s3virge, siliconmotion, sis, tdfx, tseng, vesa, and vga - drivers. + o Various updates and bug fixes have been made to most other drivers. 2.2 Input Driver Enhancements - o The mouse driver now has support for mouse wheel emulation. + o The mouse driver now has automatic protocol detection for PS/2 mice. - o The mouse driver can now handle replug events on Linux for PS/2 mice. + o Several new input drivers have been added, including tek4957, jamstudio + (js_x), fpit, palmax, and ur98 (Linux only). - o The "Min/Max X/Y Position" options in the elographics and mutouch - drivers are changed to "Min/Max X/Y" to be consistent with the other - input drivers. - - o Linux USB keyboard access is fixed when no PS/2 controller is present. - - o Added calcomp input driver. - - o Added DMC input driver. - - o Added hyperpen input driver. - 2.3 X Server and Extension Updates - - o Resynced with X.Org's X11R6.6. - - o Mesa updated to the post-3.4.2 3.4 branch version as of November 2001. - - o DRI drivers resynced with the latest from the DRI project. - o Various updates to the Xft library. - - o The DEC-XTRAP extension is now available. - - o The PEX and XIE extensions are no longer built/distributed by default. - - o A security problem related to glyph clipping for large origins is - fixed. + o Support for the RandR extension has been partially integrated into the + XFree86 server, providing support for resizing the root window at run- + time. - o An i810 XvMC (motion compensation) driver is now available (Linux - only). + o The Mesa version used for OpenGL® 1.3 and DRI driver support has been + updated to 4.0.4. - o A fatal bug XVideo Xineramification bug is fixed. + o The XFree86 server's hot keys (including those for switching modes and + virtual terminals) can now be configured via XKB. Previously they were + hard coded. An X server configuration option has been added to allow + the VT switching hot keys to be disabled. 2.4 Client and Library Updates - o FreeType2 updated to version 2.0.6. + o An Xcursor library providing support for alpha blended (ARGB) and ani- + mated cursors. Two Xcursor themes are provided (redglass and white- + glass), as well as the default "core" theme (the traditional cursors). - o Added libGL man pages. + o Xterm updated to patch level 173, including the following bugfixes: - o Xload now has support for displaying the load of remote hosts. + o Fix two infinite loops (special cases of mouse hilite tracking, + DECUDK parsing). - o Xterm updated to patch level 165. + o Make repainting of the 256-color example work properly. - o SuperProbe is removed. + o Modify parser tables to improve detection of malformed control + sequences, making xterm behave more like a real DEC terminal. - o Sample xtrap clients added. + o Fix a problem with the blinking cursor which occasionally caused + xterm to pause until a key was pressed. -2.5 I18N and Font Updates - - o New Luxi scalable fonts (TrueType and Type 1) from Bigelow & Holmes. - These fonts are original designs by Kris Holmes and Charles Bigelow. - See below (section 4.22, page 1) for further information. + o Fix improper parsing of multiple items in the ttyModes resource. - o More locale/international keyboards supported. + and the following improvements: - o Modularized I18N support in Xlib is included from X11R6.6. + o Modify xterm to invoke luit. - o A problem that caused bdftopcf to sometimes write corrupted fonts is - fixed. + o Add simple session management client capabilities. - o Some problem with Xlib's handling of CTEXT and multi-byte characters - are fixed. + o Add a modifyCursorKeys resource to control how the shift- and sim- + ilar modifiers are used to make a cursor escape sequence. - o The fontenc layer is updated, and the fontenc library is now installed - and available for other applications. + o Check if the printerCommand resource string is empty, and use this + to allow the user to disable printer function. - o Improvements to the input method framework in Xlib for UTF-8 locales. + o Sort the options list which is displayed in help- and syntax-mes- + sages at runtime to simplify maintenance. - o A filter called ``luit'' is added, which provides locale and ISO 2022 - support to any Unicode terminal, notably xterm. Use of luit is still - experimental in this release. - -2.6 OS Support Updates - - o Build problems on both QNX4 and QNX6 are fixed. - - o VT switching problems with the i810 driver on FreeBSD are worked - around. - - o Problems building modules with some enhanced versions of gcc are fixed. +2.5 I18N and Font Updates - o Lots of updates for Darwin/Mac OS X, including: + o FreeType2 updated to version 2.1.1. - o On Mac OS X, a new rootless mode is added to the XDarwin X server. - This allows X clients to display windows on the Aqua desktop. + o The "freetype" X server font backend has undergone a partial rewrite. + The new version is based on FreeType 2, and handles TrueType (including + OpenType/TTF), OpenType/CFF and Type 1 fonts. The old "type1" backend + is now deprecated, and is only used for CIDFonts by default. + + o A new utility called "mkfontscale", which builds fonts.scale files, has + been added. + + o The Xft library has undergone a major restructuring, and is now split + into fontconfig (which deals with font discovery and configuration and + is independent from X), and Xft itself (which uses fontconfig and deals + with font rasterisation and rendering. The format of the Xft font con- + figuration files has changed in an incompatible manner. + + o Support has been added to the Xft library to do rendering with the core + X11 protocol. This allows clients using this library to render to X + servers that don't have support for the RENDER extension. + + o There has been a significant reworking of the XKB support to allow + multi-layout configurations. Multi-layout configurations provide a + flexible way of supporting multiple language layouts and switching + between them. - o Xinerama support added to XDarwin +2.6 OS Support Updates - o With XDarwin in full screen mode, the depth, size, and refresh - rate can now be chosen to be different from the settings used by - Aqua. + o Updates for Darwin/Mac OS X, including: - o GLX support added for Darwin and Mac OS X with software rendering. + o Indirect GLX acceleration added. - o Keymap setup in XDarwin is improved, particularly for interna- - tional keyboards. + o Smaller memory footprint and faster 2-D drawing in rootless mode. - o In addition to English and Japanese, the XDarwin user interface is - now localized in Dutch, French, German, Spanish, and Korean. + o Full screen mode now uses shadowfb for much faster 2-D drawing. - o Lots of Cygwin support updates. + o Native fonts can be used on MacOS X. - o Support added for OpenBSD/powerpc. + o Various Cygwin support updates, including an experimental rootless X + server for Cygwin/XFree86. - o Build support added for Linux on IBM S/390. + o AMD x86-64 support (primarily for Linux so far) has been added. - o Removed stale support for Amoeba and Minix. + o Support added for OpenBSD/sparc64. - o Client-side support added for sparc64 on NetBSD and OpenBSD. + o Major OS/2 support updates. - o Support added for building the X server on Linux/m68k. + o Major SCO OpenServer updates. - o Support added for building on Linux/arm32. + o Multi-head support has been added for 460GX-based Itanium systems, and + for ZX1-based Itanium2 systems. - o Updates to Linux/mips support. + o Experimental support for SunOS/Solaris on UltraSPARC systems. A more complete list of changes can be found in the CHANGELOG that is part of the XFree86 source tree. It can also be viewed online at our CVSweb server @@ -227,49 +208,50 @@ 3.1 Video Drivers -XFree86 4.2.0 includes the following video drivers: +XFree86 4.3.0 includes the following video drivers: -+--------------+--------------------------+----------------------------------+ -|Driver Name | Description | Further Information | -+--------------+--------------------------+----------------------------------+ -|apm | Alliance Pro Motion | README.apm | -|ark | Ark Logic | | -|ati | ATI | README.ati, README.r128, r128(4) | -|chips | Chips & Technologies | README.chips, chips(4) | -|cirrus | Cirrus Logic | | -|cyrix (*) | Cyrix MediaGX | README.cyrix | -|fbdev | Linux framebuffer device | fbdev(4) | -|glide | Glide2x (3Dfx) | glide(4) | -|glint | 3Dlabs, TI | glint(4) | -|i128 | Number Nine | README.I128, i128(4) | -|i740 | Intel i740 | README.i740 | -|i810 | Intel i810 | README.i810, i810(4) | -|imstt | Integrated Micro Solns | | -|mga | Matrox | mga(4) | -|neomagic | NeoMagic | neomagic(4) | -|newport (-) | SGI Newport | README.newport, newport(4) | -|nv | NVIDIA | nv(4) | -|rendition | Rendition | README.rendition, rendition(4) | -|s3 | S3 (not ViRGE or Savage) | | -|s3virge | S3 ViRGE | README.s3virge, s3virge(4) | -|savage | S3 Savage | savage(4) | -|siliconmotion | Silicon Motion | siliconmotion(4) | -|sis | SiS | README.SiS | -|sunbw2 (+) | Sun bw2 | | -|suncg14 (+) | Sun cg14 | | -|suncg3 (+) | Sun cg3 | | -|suncg6 (+) | Sun GX and Turbo GX | | -|sunffb (+) | Sun Creator/3D, Elite 3D | | -|sunleo (+) | Sun Leo (ZX) | | -|suntcx (+) | Sun TCX | | -|tdfx | 3Dfx | | -|tga | DEC TGA | README.DECtga | -|trident | Trident | trident(4) | -|tseng | Tseng Labs | | -|vesa | VESA | vesa(4) | -|vga | Generic VGA | vga(4) | -|vmware | VMWare guest OS | vmware(4) | -+--------------+--------------------------+----------------------------------+ ++--------------+--------------------------+---------------------------------------------+ +|Driver Name | Description | Further Information | ++--------------+--------------------------+---------------------------------------------+ +|apm | Alliance Pro Motion | README.apm | +|ark | Ark Logic | | +|ati | ATI | README.ati, README.r128, r128(4), radeon(4) | +|chips | Chips & Technologies | README.chips, chips(4) | +|cirrus | Cirrus Logic | | +|cyrix (*) | Cyrix MediaGX | README.cyrix | +|fbdev | Linux framebuffer device | fbdev(4) | +|glide | Glide2x (3Dfx) | glide(4) | +|glint | 3Dlabs, TI | glint(4) | +|i128 | Number Nine | README.I128, i128(4) | +|i740 | Intel i740 | README.i740 | +|i810 | Intel i8xx | README.i810, i810(4) | +|imstt | Integrated Micro Solns | | +|mga | Matrox | mga(4) | +|neomagic | NeoMagic | neomagic(4) | +|newport (-) | SGI Newport | README.newport, newport(4) | +|nsc | National Semiconductor | nsc(4) | +|nv | NVIDIA | nv(4) | +|rendition | Rendition | README.rendition, rendition(4) | +|s3 | S3 (not ViRGE or Savage) | | +|s3virge | S3 ViRGE | README.s3virge, s3virge(4) | +|savage | S3 Savage | savage(4) | +|siliconmotion | Silicon Motion | siliconmotion(4) | +|sis | SiS | README.SiS, sis(4) | +|sunbw2 (+) | Sun bw2 | | +|suncg14 (+) | Sun cg14 | | +|suncg3 (+) | Sun cg3 | | +|suncg6 (+) | Sun GX and Turbo GX | | +|sunffb (+) | Sun Creator/3D, Elite 3D | | +|sunleo (+) | Sun Leo (ZX) | | +|suntcx (+) | Sun TCX | | +|tdfx | 3Dfx | tdfx(4) | +|tga | DEC TGA | README.DECtga | +|trident | Trident | trident(4) | +|tseng | Tseng Labs | | +|vesa | VESA | vesa(4) | +|vga | Generic VGA | vga(4) | +|vmware | VMWare guest OS | vmware(4) | ++--------------+--------------------------+---------------------------------------------+ Drivers marked with (*) are present in a preliminary form in this release, but are not complete and/or stable yet. @@ -281,40 +263,49 @@ Darwin/Mac OS X uses IOKit drivers and does not use the module loader drivers listed above. Further information can be found in README.Darwin. -XFree86 4.2.0 includes the following input drivers: +XFree86 4.3.0 includes the following input drivers: 3.2 Input Drivers + + +------------+----------------------------------+---------------------+ + |Driver Name | Description | Further Information | + +------------+----------------------------------+---------------------+ + |calcomp | Calcomp | | + |citron | Citron | citron(4) | + |digitaledge | DigitalEdge | | + |dmc | DMC | dmc(4) | + |dynapro | Dynapro | | + |elographics | EloGraphics | | + |elographics | EloGraphics | | + |fpit | Fujitsu Stylistic Tablet PCs | fpit(4) | + |hyperpen | HyperPen | | + |js_x | JamStudio pentablet | js_x(4) | + |kbd | generic keyboards (alternate) | kbd(4) | + |keyboard | generic keyboards | keyboard(4) | + |microtouch | MicroTouch | | + |mouse | most mouse devices | mouse(4) | + |mutouch | MicroTouch | | + |palmax | Palmax PD1000/PD1100 | palmax(4) | + |penmount | PenMount | | + |spaceorb | SpaceOrb | | + |summa | SummaGraphics | | + |tek4957 | Tektronix 4957 tablet | tek4957(4) | + |ur98(*) | Union Reality UR-F98 headtracker | ur98(4) | + |void | dummy device | void(4) | + |wacom | Wacom tablets | wacom(4) | + +------------+----------------------------------+---------------------+ - +------------+--------------------+---------------------+ - |Driver Name | Description | Further Information | - +------------+--------------------+---------------------+ - |calcomp | Calcomp | | - |citron | Citron | citron(4) | - |digitaledge | DigitalEdge | | - |dmc | DMC | dmc(4) | - |dynapro | Dynapro | | - |elographics | EloGraphics | | - |hyperpen | HyperPen | | - |keyboard | generic keyboards | keyboard(4) | - |microtouch | MicroTouch | | - |mouse | most mouse devices | mouse(4) | - |mutouch | MicroTouch | | - |penmount | PenMount | | - |spaceorb | SpaceOrb | | - |summa | SummaGraphics | | - |void | dummy device | void(4) | - |wacom | Wacom tablets | wacom(4) | - +------------+--------------------+---------------------+ +Drivers marked with (*) are available for Linux only. 4. Overview of XFree86 4.x. Unlike XFree86 3.3.x where there are multiple X server binaries, each of -which drive different hardware, XFree86 4.2.0 has a single X server binary +which drive different hardware, XFree86 4.3.0 has a single X server binary called XFree86. This binary can either have one or more video drivers linked in statically, or, more usually, dynamically load the video drivers and other modules that are needed. -XFree86 4.2.0 has X server support for most UNIX(R) and UNIX-like operating +XFree86 4.3.0 has X server support for most UNIX(R) and UNIX-like operating systems on Intel/x86 platforms, plus support for Linux on Alpha, PowerPC, IA-64, Sparc, and Mips platforms, and for Darwin on PowerPC. Work on support for additional architectures and operating systems is in progress, and is @@ -336,7 +327,7 @@ the future we plan to take advantage of this to provide more frequent driver module updates in between major releases. -The loader in version 4.2.0 has support for Intel (x86), Alpha and PowerPC +The loader in version 4.3.0 has support for Intel (x86), Alpha and PowerPC platforms. It also has preliminary support for Sparc platforms. The X server makes use of modules for video drivers, X server extensions, @@ -442,7 +433,7 @@ The new option AllowDeactivateGrabs allows deactivating any active grab with the key sequence Ctrl+Alt+Keypad-Divide and the new option Allow- - ClosedownGrabs allows closing the conection to the grabbing client with + ClosedownGrabs allows closing the connection to the grabbing client with the key sequence Ctrl+Alt+Keypad-Multiply. Note that these options are off by default as they allow users to remove the grab used by screen saver/locker programs. @@ -517,8 +508,8 @@ Option "BlankTime" "5" EndSection - See the XF86Config man page for a more detailed explanation of the for- - mat of the new ServerLayout section. + See the XF86Config(5) man page for a more detailed explanation of the + format of the new ServerLayout section. The config file search patch has been extended, with the directories /etc/X11 and /usr/X11R6/etc/X11 being added. The full search path details are docu- @@ -684,7 +675,7 @@ 4.7 DGA version 2 -DGA 2.0 is included in 4.2.0, but is not implemented by all drivers. Prelim- +DGA 2.0 is included in 4.3.0, but is not implemented by all drivers. Prelim- inary documentation for the client libraries can be found in the README.DGA document. A good degree of backwards compatibility with version 1.0 is pro- vided. @@ -753,7 +744,7 @@ overlays and other image operations not possible with the core X rendering system. -XFree86 4.2.0 provides a partial implementation of Render sufficient for +XFree86 4.3.0 provides a partial implementation of Render sufficient for drawing anti-aliased text and image composition. Still to be implemented are geometric primitives and affine transformation of images. @@ -784,43 +775,25 @@ The Xft library uses a configuration file, XftConfig, which contains informa- tion about which directories contain font files and also provides a sophisti- cated font aliasing mechanism. Documentation for that file is included in -the Xft man page. +the Xft(3) man page. 4.11.2 FreeType support in Xft -XFree86 4.2.0 includes sources for FreeType version 2.0.1, and, by default, +XFree86 4.3.0 includes sources for FreeType version 2.1.1, and, by default, they are built and installed automatically. -If you prefer, you can configure XFree86 4.2.0 to use an existing Freetype2 -installation by telling XFree86 not to build the internal copy and indicating -where that external version has been installed. Edit (or create) con- -fig/cf/host.def to include: - - o #define BuildFreetype2Library NO - - o #define Freetype2Dir /usr/local - -Note that XFree86 assumes you'll be using a release FreeType no older than -version 2.0.1. Early FreeType version 2 releases used a different header -file installation and aren't compatible with XFree86. Instructions for build- -ing and installing FreeType can be found in the INSTALL file included with -the FreeType release. - 4.11.3 Application Support For Anti-Aliased Text -Only three applications have been modified in XFree86 4.2.0 to work with the +Only three applications have been modified in XFree86 4.3.0 to work with the Render extension and the Xft and FreeType libraries to provide anti-aliased text. Xterm, xditview and x11perf. Migration of other applications may occur in future releases. -By default, xterm uses core fonts through the standard core API. It has two -command line options and associated resources to direct it to use Xft -instead: +By default, xterm uses core fonts through the standard core API. It has a +command line option and associated resource to direct it to use Xft instead: o -fa family / .VT100.faceName: family. Selects the font family to use. - o -fs pointsize / .VT100.faceSize: pointsize. Selects the pointsize. - Xditview will use Xft instead of the core API by default. X11perf includes tests to measure the performance of text rendered in three ways, anti- aliased, anti-aliased with sub-pixel sampling and regular chunky text, but @@ -839,121 +812,32 @@ The xgamma utility makes use of this feature. Compatibility with the 3.3.x version of the extension is provided. The missing parts of this extension and some new features should be completed in a future release. - -4.13 Xaw - -Two versions of the Xaw library are provided with XFree86 4.x. A version with -bug fixes and a few binary compatible improvements and a new version with -several new features. - -New features: - - o A displayList resource is available to all Xaw widgets. It basically - consists of a list of drawing commands, fully described in the Xaw(3) - manual page, that enables a integration of Xaw programs with the new - window/desktop managers that allows for configurable themes. - - o Some new actions were added to all Xaw widgets, to allow more config- - urable control of the widgets, and to allow setting resources at run - time. - - o Since Xpm was integrated into XFree86, programs linked with the new Xaw - library will also link with Xpm. This allows for color background - pixmaps, and also for shaped widgets. - - o The text widget is the widget that will present more changes. These - include: - - o Block cursor. - - o Compile time limit of 16384 undo/redo levels (that will automati- - cally grow if the text is not saved when this mark is reached). - - o Overwrite mode. - - o Text killed is inserted in a kill ring list, this text is not for- - gotten, pressing M-y allows traversing the kill ring list. - - o International support for latin languages is available even if the - international resource is not set. Users will need to properly set - the locale environment to make complete use of this feature. - - o A better multiply interface is provided. Pressing C-u, - (where number can be negative) allows passing parameters for text - actions. - - o Text can be formatted to have left, right, center or full justifi- - cation. - - o Text indentation support is also available. - -Bug fixes: - - o The simple menu widget geometry management code was improved to solve - problems with menu entries not visible in the screen. - - o The form widget geometry code was changed to solve problems with integer - round problems in the child widgets geometry when resizing the parent - form widget. - - o Several bugs were fixed in the text code, while some code was rewritten - from scratch. - -4.14 Xpm - -Version 3.4k of the Xpm (X pixmap) library is now integrated into XFree86. - -4.15 xedit - -Xedit have been changed to use most of the new features added to the new ver- -sion of the Xaw library, and some xedit only features were added. Emacs users -will find that several of the emacs key bindings work with the new version of -xedit. These include: - - o File name tab completion. Including a Emacs dired like window, that will - be shown when there are more than one match, when C-x,d is pressed, or - when a directory name is specified. - - o An unlimited number of files can be edited at the same time. Including - multiple views of the same or different files. - - o The line number of the cursor position is always visible. It can also be - customized to show the column number, the position offset and the cur- - rent size of the file. - - o There is an autoReplace resource, that enables automatic text replace- - ment at the time text is typed. This feature is useful to create simple - macros, or to correct common spelling errors. - - o A fully featured ispell interface is also available. This interface is - expected to provide most of the features of the terminal interface of - the ispell program, with some extra features that include: - o A compile time limit of 16 undo levels. +4.13 xedit - o Terse mode switch. +Xedit has several new features, including: - o Dictionary change. + o An embedded lisp interpreter that allows easier extension of the editor. - o The interface also checks for repeated words. + o Several new syntax highlight modes, and indentation rules for C and + Lisp. - o A first tentative to add programming modes was done. Currently, there is - one mode: + o Flexible search/replace interface that allows regex matches. - o C-mode: this mode is expected to be stable, and fully usable. + o Please refer to xedit(1) for more details. -4.16 Font support +4.14 Font support Details about the font support in XFree86 4.x can be found in the README.fonts document. -4.17 TrueType support +4.15 TrueType support XFree86 4.x comes with two TrueType backends, known as `xfsft' (the "freetype" module) and `X-TrueType' (the "xtt" module). Both of these back- ends are based on the FreeType library. -4.18 CID font support +4.16 CID font support Support for CID-keyed fonts is included in XFree86 4.x. The CID-keyed font format was designed by Adobe Systems for fonts @@ -961,7 +845,7 @@ by SGI . See the LICENSE document for a copy of the CID Font Code Public License. -4.19 Internationalisation of the scalable font backends +4.17 Internationalisation of the scalable font backends XFree86 4.x has a ``fontenc'' layer to allow the scalable font backends to use a common method of font re-encoding. This re-encoding makes it possible @@ -970,14 +854,14 @@ TrueType backend. The `X-TrueType' version of the TrueType backend uses a different re-encoding method based on loadable encoding modules. -4.20 Large font optimisation +4.18 Large font optimisation The glyph metrics array, which all the X clients using a particular font have access to, is placed in shared memory, so as to reduce redundant memory con- sumption. For non-local clients, the glyph metrics array is transmitted in a compressed format. -4.21 Unicode/ISO 10646 support +4.19 Unicode/ISO 10646 support What is included in 4.x: @@ -1010,7 +894,7 @@ o Both the xfsft (the "freetype" module) and the X-TrueType (the "xtt" module) TrueType font backends support Unicode-encoded fonts. -4.22 Luxi fonts from Bigelow and Holmes +4.20 Luxi fonts from Bigelow and Holmes XFree86 now includes the ``Luxi'' family of Type 1 fonts and TrueType fonts. This family consists of the fonts ``Luxi Serif'', ``Luxi Sans'' and @@ -1035,7 +919,7 @@ or , or consult the URW++ web site . -4.23 Directory rearrangements +4.21 Directory rearrangements Some changes to the installed XFree86 directory structure have been imple- mented for 4.x. One important change is a modified search path for the X @@ -1046,7 +930,7 @@ located under the appropriate subdirectories of /var, again with the relevant symbolic links in the old location. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.70 2002/01/17 18:14:59 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.81 2003/02/27 00:45:05 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.104 2002/01/17 23:27:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.115 2003/02/27 01:44:03 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Status diff -u xc/programs/Xserver/hw/xfree86/doc/Status:1.29 xc/programs/Xserver/hw/xfree86/doc/Status:1.40 --- xc/programs/Xserver/hw/xfree86/doc/Status:1.29 Wed Jan 16 15:51:04 2002 +++ xc/programs/Xserver/hw/xfree86/doc/Status Tue Feb 25 16:32:35 2003 @@ -1,24 +1,23 @@ - Driver Status for XFree86[tm] 4.2.0 + Driver Status for XFree86[tm] 4.3.0 The XFree86 Project, Inc - 16 January 2002 + 23 February 2003 Abstract This document provides information about the status of the driver - and hardware support in XFree86 4.2.0 compared with that in XFree86 + and hardware support in XFree86 4.3.0 compared with that in XFree86 3.3.6. Please send updates for this document to - . Please do not send requests for information - or support to that address (they will not be answered). + . 1. Introduction This document contains one section per vendor (organised alphabetically) for -each chipset family that is supported in XFree86 3.3.6 or XFree86 4.2.0. It +each chipset family that is supported in XFree86 3.3.6 or XFree86 4.3.0. It includes information about the status of the drivers and the hardware they support, including a comparison of the level of support between versions -3.3.6 and 4.2.0. Unless otherwise stated, hardware is classified as "sup- +3.3.6 and 4.3.0. Unless otherwise stated, hardware is classified as "sup- ported" if its driver provides basic 2D support. Support for additional fea- tures may or may not be present. @@ -27,9 +26,9 @@ compile time. In other cases, X servers for specific chips (or families of chips) are provided (such as XF86_AGX, XF86_Mach64, etc.). -In XFree86 4.2.0, there is only one X server, called "XFree86", which can +In XFree86 4.3.0, there is only one X server, called "XFree86", which can load driver modules at runtime. Thus there is no specific mention of a -server binary when 4.2.0 is discussed; only the XFree86 server is used. +server binary when 4.3.0 is discussed; only the XFree86 server is used. Third-party vendors (often the manufacturers of various video chipsets) may provide their own drivers for the XFree86 server, but these third-party mod- ules are beyond the scope of this document. @@ -45,7 +44,7 @@ Support (including acceleration) for Voodoo Banshee and Voodoo3 cards is provided by the XF86_SVGA server with the tdfx driver. - 4.2.0: + 4.3.0: Support for Voodoo Graphics and Voodoo2 chips is provided by the "glide" driver (this requires version 2.x of the Glide library, which is not part of the XFree86 distribution). @@ -54,9 +53,9 @@ Voodoo4, and Voodoo5 is provided by the "tdfx" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. The + All hardware supported in 3.3.6 is also supported in 4.3.0. The Voodoo Graphics, Voodoo2, Voodoo4, and Voodoo5 are supported only - in 4.2.0. + in 4.3.0. 3. 3Dlabs @@ -66,16 +65,16 @@ RAMDACs), Permedia with IBM RGB526 RAMDAC, and Permedia 2, 2a, 2v is provided by the XF86_3DLabs server. - 4.2.0: + 4.3.0: Support (including acceleration) for the Permedia series (includ- ing 1, 2, 2a, 2v, 3, and 4) and GLINT series (including 300SX, 500TX, MX, R3 and R4) with the Gamma, Gamma2 or Delta coprocessor is provided by the "glint" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. The + All hardware supported in 3.3.6 is also supported in 4.3.0. The Permedia 3, Permedia 4, GLINT R3, GLINT R4 and Gamma2 are sup- - ported only in 4.2.0. + ported only in 4.3.0. 4. Alliance @@ -83,15 +82,15 @@ Support (including acceleration) for the AT24, AP6422, AT3D is provided by the XF86_SVGA server with the apm driver. - 4.2.0: + 4.3.0: Support (including acceleration) for the AT24, AT25 and AT3D is provided by the "apm" driver. This driver currently has only incomplete support for the AP6422. Summary: - The AP6422 is supported in 3.3.6 but not fully in 4.2.0. All - other hardware supported in 3.3.6 is also supported in 4.2.0. - The AT25 is supported only in 4.2.0. + The AP6422 is supported in 3.3.6 but not fully in 4.3.0. All + other hardware supported in 3.3.6 is also supported in 4.3.0. + The AT25 is supported only in 4.3.0. 5. ARK Logic @@ -100,12 +99,12 @@ and ARK2000MT is provided by the XF86_SVGA server with the ark driver. - 4.2.0: + 4.3.0: Support (including acceleration) for the ARK1000PV, ARK2000PV, and ARK2000MT is provided by the "ark" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. 6. ATI @@ -123,13 +122,13 @@ driver. Accelerated support is provided for the Rage 128 chips by the XF86_SVGA server with the r128 driver. - 4.2.0: + 4.3.0: Accelerated support is provided for Mach64, Rage, Rage 128 and Radeon chips by the "ati" driver, as is unaccelerated support for all of the others except the Mach8 and some early Mach32 chips. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0 except + All hardware supported in 3.3.6 is also supported in 4.3.0 except for Mach8 and some old Mach32 chips. 7. Avance Logic @@ -141,12 +140,12 @@ the others. These drivers reportedly work, but they have no maintainer. - 4.2.0: + 4.3.0: No Avance Logic chips are supported because the old drivers have not been ported. Summary: - No Avance Logic chips are supported in 4.2.0. + No Avance Logic chips are supported in 4.3.0. 8. Chips and Technologies @@ -155,13 +154,13 @@ 65545, 65546, 65548, 65550, 65554, 65555, 68554, 69000, 64200 and 64300 is provided by the XF86_SVGA server with the chips driver. - 4.2.0: + 4.3.0: Support (accelerated) for the 65520, 65525, 65530, 65535, 65540, 65545, 65546, 65548, 65550, 65554, 65555, 68554, 69000, 64200 and 64300 is provided by the "chips" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. 9. Cirrus Logic @@ -173,13 +172,13 @@ 7541, 7542, 7543, 7548, 7555 and 7556 is provided by the XF86_SVGA server with the cirrus driver. - 4.2.0: + 4.3.0: Support (accelerated) for the Alpine (5430, 5434, 5436, 5446, 5480, 7548), and Laguna (5462, 5464, 5465) chips is provided by the "cirrus" driver. Summary: - The following chips are supported in 3.3.6 but not in 4.2.0: + The following chips are supported in 3.3.6 but not in 4.3.0: 6410, 6412, 6420, 6440, 5420, 5422, 5424, 5426, 5428, 5429, 6205, 6215, 6225, 6235, 7541, 7542, 7543, 7555 and 7556. @@ -195,7 +194,7 @@ 24 plane 3D chips (on Alpha platforms) is provided by the XF86_TGA server. - 4.2.0: + 4.3.0: No support exists for the Compaq AVGA (its driver hasn't been ported). @@ -204,8 +203,8 @@ the "tga" driver. Summary: - No Compaq AVGA chips are supported in 4.2.0. DEC TGA support is - equivalent in both 3.3.6 and 4.2.0. + No Compaq AVGA chips are supported in 4.3.0. DEC TGA support is + equivalent in both 3.3.6 and 4.3.0. 11. Cyrix @@ -213,13 +212,13 @@ Support (accelerated) for the Cyrix MediaGX is provided by the XF86_SVGA server with the cyrix driver. - 4.2.0: - The 3.3.6 driver has been ported to 4.2.0, including acceleration + 4.3.0: + The 3.3.6 driver has been ported to 4.3.0, including acceleration support, and is provided by the "cyrix" driver. Feedback is wanted. Summary: - Cyrix MediaGX users are encouraged to test its support in 4.2.0. + Cyrix MediaGX users are encouraged to test its support in 4.3.0. 12. Epson @@ -227,12 +226,12 @@ Support (accelerated) for the Epson SPC8110 is provided by the XF86_SVGA server with the spc8100 driver. - 4.2.0: + 4.3.0: No Epson chips are supported, because the old driver has not been ported. Summary: - No Epson chips are supported in 4.2.0. + No Epson chips are supported in 4.3.0. 13. Genoa @@ -242,12 +241,12 @@ because we don't have any recent test reports, and this driver has no maintainer. - 4.2.0: + 4.3.0: No Genoa chips are supported, because the old driver has not been ported. Summary: - No Genoa chips are supported in 4.2.0. + No Genoa chips are supported in 4.3.0. 14. IBM @@ -262,7 +261,7 @@ Support for the IBM XGA-2 chip is provided by the XF86_AGX server. - 4.2.0: + 4.3.0: Support for the standard IBM VGA chip (and compatibles) is pro- vided by the "vga" driver. @@ -271,7 +270,7 @@ Summary: The standard VGA core is supported in both versions, but there is - no support for the 8514/A or XGA-2 in 4.2.0. + no support for the 8514/A or XGA-2 in 4.3.0. 15. IIT @@ -279,12 +278,12 @@ Support (accelerated) for the AGX-016, AGX-015 and AGX-014 is provided by the XF86_AGX server. - 4.2.0: + 4.3.0: No IIT chips are supported, because the old driver has not been ported. Summary: - No IIT chips are supported in 4.2.0. + No IIT chips are supported in 4.3.0. 16. Integrated Micro Solutions (IMS) @@ -292,12 +291,12 @@ Support (accelerated) for the IMS Twin Turbo 128 and Twin Turbo 3D is provided by the XF86_SVGA server with the imstt driver. - 4.2.0: + 4.3.0: Support (accelerated) for the IMS Twin Turbo 128 and Twin Turbo 3D is provided by the "imstt" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. 17. Intel @@ -308,19 +307,22 @@ requires the agpgart.o kernel module in order to use modes that require more than 1MB of video memory. - 4.2.0: + 4.3.0: Support (accelerated) for the Intel i740 is provided by the - "i740" driver, and support for the Intel i810 (including - i810-dc100 and i810e), i815, and i830 is provided by the "i810" - driver. The "i810" driver is currently supported only on Linux - and FreeBSD (4.1 and later), and requires AGP GART kernel sup- - port. + "i740" driver, and support for the Intel integrated graphics + chipsets i810, i810-dc100, i810e, i815, 830M, 845G, 852GM, 855GM + and 865G is provided by the "i810" driver. The i810 and i815 + chipsets require kernel-level AGP GART support (available on + Linux, FreeBSD, and some other BSDs). The 830M and later can be + used without AGP GART support, but it is required for full func- + tionality. Summary: The i740 and and original i810 are supported in both versions, - but the i810 is supported only on Linux/x86 and recent - FreeBSD/i386 platforms at present. Support for later versions of - the i810 chipset, such as the i815, exists only in 4.2.0. + but the i810/i815 is supported only on Linux, FreeBSD, and some + recent NetBSD/OpenBSD versions at present. platforms at present. + Support for later versions of the i810 chipset, such as the i815, + and for the 830M and later exists only in 4.3.0. 18. Matrox @@ -329,14 +331,14 @@ (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200 and G400 is provided by the XF86_SVGA server with the mga driver. - 4.2.0: + 4.3.0: Support (accelerated) for the MGA2064W (Millennium I), MGA1064SG (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200, G400, G450, and G550 is provided by the "mga" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. The - G450 and G550 are supported only in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. The + G450 and G550 are supported only in 4.3.0. 19. Micronix, Inc. (MX) @@ -346,88 +348,94 @@ is unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.2.0: + 4.3.0: No MX chips are supported, because the old driver has not been ported. Summary: - No MX chips are supported in 4.2.0. + No MX chips are supported in 4.3.0. -20. NCR +20. National Semiconductor + 4.3.0: + Support for the SC1x00, GX1, and GX2 is provided by the "nsc" + driver. + +21. NCR + 3.3.6: Support for the old NCR 77C22 and 77C22E chips is provided by the XF86_SVGA server and the ncr77c22 driver. The status of this support is unknown because we don't have any recent test reports. - 4.2.0: + 4.3.0: No NCR chips are supported, because the old driver has not been ported. Summary: - No NCR chips are supported in 4.2.0. + No NCR chips are supported in 4.3.0. -21. NeoMagic +22. NeoMagic 3.3.6: Support (accelerated) for the NeoMagic NM2070, NM2090, NM2093, NM2097, NM2160 and NM2200 chipsets is provided by the XF86_SVGA server with the neo driver. - 4.2.0: + 4.3.0: Support (accelerated) for the NeoMagic NM2070, NM2090, NM2093, NM2097, NM2160, NM2200, NM2230, NM2360 and NM2380 chipsets is provided by the "neomagic" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. The - NM2230 and later chips are supported only in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. The + NM2230 and later chips are supported only in 4.3.0. -22. NVIDIA +23. NVIDIA 3.3.6: Support (accelerated) for the NV1, Riva 128, 128ZX, TNT, TNT2 (Ultra, Vanta, M64), GeForce (DDR, 256) and Quadro is provided by the XF86_SVGA server and the nv driver. - 4.2.0: + 4.3.0: Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, Vanta, M64), GeForce (DDR, 256), Quadro, GeForce2 (GTS, Ultra, MX), GeForce3, and Quadro2 is provided by the "nv" driver. Summary: All chipsets supported in 3.3.6 except the NV1 are also supported - in 4.2.0. Support for the newer chips listed above (starting - with the GeForce2) is available only in 4.2.0. + in 4.3.0. Support for the newer chips listed above (starting + with the GeForce2) is available only in 4.3.0. -23. Number Nine +24. Number Nine 3.3.6: Support (accelerated) for the Imagine 128, Ticket 2 Ride, Revolu- tion 3D and Revolution IV is provided by the XF86_I128 server. - 4.2.0: + 4.3.0: Support (accelerated) for the Imagine 128, Ticket 2 Ride, Revolu- tion 3D and Revolution IV is provided by the "i128" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. -24. Oak Technologies, Inc. +25. Oak Technologies, Inc. 3.3.6: Support for the OTI067, OTI077, and OTI087 (the latter with some acceleration) is provided by the XF86_SVGA server and the oak driver. - 4.2.0: + 4.3.0: No Oak chips are supported, because the old driver has not been ported. Summary: - No Oak chips are supported in 4.2.0. + No Oak chips are supported in 4.3.0. -25. Paradise/Western Digital +26. Paradise/Western Digital 3.3.6: Support for the Paradise PVGA1 and the Western Digital WD90C00, @@ -436,14 +444,14 @@ port for some of these chipsets is uncertain because we don't have any recent test reports, and this driver has no maintainer. - 4.2.0: + 4.3.0: No Paradise/Western Digital chips are supported, because the old driver has not been ported. Summary: - No Paradise/Western Digital chips are supported in 4.2.0. + No Paradise/Western Digital chips are supported in 4.3.0. -26. RealTek +27. RealTek 3.3.6: Support for the RealTek RTG3106 is provided by the XF86_SVGA @@ -451,27 +459,27 @@ unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.2.0: + 4.3.0: No RealTek chips are supported, because the old driver has not been ported. Summary: - No RealTek chips are supported in 4.2.0. + No RealTek chips are supported in 4.3.0. -27. Rendition/Micron +28. Rendition/Micron 3.3.6: Support for the Verite 1000, 2100 and 2200 is provided by the XF86_SVGA server with the rendition driver. - 4.2.0: + 4.3.0: Support for the Verite 1000, 2100 and 2200 is provided by the "rendition" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. -28. S3 +29. S3 3.3.6: Support (accelerated) for the S3 911, 924, 801, 805, 928, 864, @@ -486,7 +494,7 @@ Savage4, and Savage2000, is provided by the XF86_SVGA server with the s3_savage driver on some OSes (Linux, *BSD). - 4.2.0: + 4.3.0: Support (accelerated) for the 964 (revisions 0 and 1), 968, Trio32, Trio64, Trio64, Trio64V+, Trio64UV+, Aurora64V+, Trio64V2, and PLATO/PX is provided by the "s3" driver (however, @@ -500,61 +508,62 @@ yet been ported. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0 except + All hardware supported in 3.3.6 is also supported in 4.3.0 except for the 911, 924, 801, 805, 928, 864, and 868, and versions of the 964 and 968 that do not use the RAMDAC chips listed above. - The SuperSavage chipset is supported only in 4.2.0. + The SuperSavage chipset is supported only in 4.3.0. -29. Silicon Graphics, Inc. (SGI) +30. Silicon Graphics, Inc. (SGI) 3.3.6: No SGI hardware is supported in 3.3.6. - 4.2.0: + 4.3.0: Unaccelerated support for the SGI Indy's Newport (a.k.a. "XL") cards is provided by the "newport" driver. Summary: - SGI hardware is supported only in 4.2.0. + SGI hardware is supported only in 4.3.0. -30. Silicon Integrated Systems (SiS) +31. Silicon Integrated Systems (SiS) 3.3.6: Support (accelerated) for the SiS 86C201, 86C202, 86C205, 86C215, 86C225, 5597, 5598, 6326, 530, 620, 300, 630 and 540 is provided by the XF86_SVGA server with the sis driver. - 4.2.0: - Support (accelerated) for the SiS - 530, 620, 6326 is provided by the "sis" driver. The 630, 300, - and 540 are also supported, but this code is new and there are - some problems with it in this version. + 4.3.0: + Support (accelerated) for the SiS 5597, 5598, 6326, 530, 620, + 300, 540, 630, 730, 315, 550, 650, 651 and 740 is provided by the + "sis" driver. The Xabre (SiS 330) might be supported by this is + completely untested. Summary: - Support for the 86C201, 86C202, 86C205, 86C215, 86C225, 5597 and - 5598 is currently only available in 3.3.6. + Support for the 86C201, 86C202, 86C205, 86C215 and 86C225 is cur- + rently only available in 3.3.6. Support for some newer chipsets + is only available in 4.3.0. -31. Silicon Motion, Inc. +32. Silicon Motion, Inc. 3.3.6: Support (accelerated) for the Lynx, LynxE, Lynx3D, LynxEM, LynxEM+ and Lynx3DM chips is provided by the XF86_SVGA server with the smi driver. - 4.2.0: + 4.3.0: Support (accelerated) for the Lynx, LynxE, Lynx3D, LynxEM, LynxEM+ and Lynx3DM chips is provided by the "siliconmotion" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.2.0. + All hardware supported in 3.3.6 is also supported in 4.3.0. -32. Sun Microsystems +33. Sun Microsystems 3.3.6: No Sun hardware is supported in 3.3.6. - 4.2.0: + 4.3.0: Sun BW2 framebuffers are supported by the "sunbw2" driver. Sun CG3 framebuffers are supported by the "suncg3" driver. Sun CG6 framebuffers are supported by the "suncg6" driver. Sun CG14 @@ -564,9 +573,9 @@ framebuffers are supported by the "suntcx" driver. Summary: - Sun hardware is supported only in 4.2.0. + Sun hardware is supported only in 4.3.0. -33. Trident Microsystems +34. Trident Microsystems 3.3.6: Support (accelerated where the chip supports it) for the @@ -579,7 +588,7 @@ CyberBlade/DSTN/i7, CyberBlade/i1, and CyberBlade/i7 is provided by the XF86_SVGA server with the tvga8900 driver. - 4.2.0: + 4.3.0: Support (accelerated where the chip supports it) for the TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TVGA8900D, TGUI9440AGi, TGUI9660, TGUI9680, ProVidia @@ -593,9 +602,7 @@ Summary: The following (older) chipsets are supported in 3.3.6 and not in - 4.2.0: TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, - TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, - TGUI9420, and TGUI9430DGi. + 4.3.0: TVGA8200LX, TVGA8800CS, TGUI9420, TGUI9430DGi. The TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9440AGi, TGUI9660, @@ -603,12 +610,12 @@ Blade3D, Cyber9320, Cyber9382, Cyber9385, Cyber9388, Cyber9397, Cyber9397/DVD, CyberBlade/DSTN/i1, CyberBlade/DSTN/i7, CyberBlade/i1 and CyberBlade/i7 are supported in both 3.3.6 and - 4.2.0. + 4.3.0. The CyberBlade/Ai1, CyberBlade/DSTN/Ai1, CyberBlade/e4, - CyberBladeXP, and BladeXP are supported only in 4.2.0. + CyberBladeXP, and BladeXP are supported only in 4.3.0. -34. Tseng Labs +35. Tseng Labs 3.3.6: Support for the ET3000 is provided by the XF86_SVGA server with @@ -618,16 +625,16 @@ driver. Support (accelerated) for the ET4000/W32 series and the ET6000 is also provided by the deprecated XF86_W32 server. - 4.2.0: + 4.3.0: Support for the ET4000AX, and accelerated support for the ET4000/W32, ET4000/W32i, ET4000/W32p, ET6000 and ET6100 is pro- vided by the "tseng" driver. Summary: - All cards supported by 3.3.6 are also supported by 4.2.0 except + All cards supported by 3.3.6 are also supported by 4.3.0 except for the old ET3000. -35. Video 7 +36. Video 7 3.3.6: Support for the Video 7 chipset is provided by the XF86_SVGA @@ -635,28 +642,28 @@ unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.2.0: + 4.3.0: No Video 7 chips are supported, because the old driver has not been ported. Summary: - No Video 7 chips are supported in 4.2.0. + No Video 7 chips are supported in 4.3.0. -36. Weitek +37. Weitek 3.3.6: Support (accelerated) for the P9000 is provided by the XF86_P9000 server and accelerated support for the P9100 is provided by the XF86_SVGA server with the p9x00 driver. - 4.2.0: + 4.3.0: No Weitek chips are supported, because the old drivers have not been ported. Summary: - No Weitek chips are supported in 4.2.0. + No Weitek chips are supported in 4.3.0. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.37 2002/01/16 20:38:45 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.43 2003/02/25 16:32:41 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.29 2002/01/16 20:51:04 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.40 2003/02/25 21:32:35 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Versions diff -u xc/programs/Xserver/hw/xfree86/doc/Versions:1.3 xc/programs/Xserver/hw/xfree86/doc/Versions:1.7 --- xc/programs/Xserver/hw/xfree86/doc/Versions:1.3 Wed Jan 16 15:51:04 2002 +++ xc/programs/Xserver/hw/xfree86/doc/Versions Sun Feb 23 23:03:25 2003 @@ -2,7 +2,7 @@ The XFree86 Project, Inc - 16 January 2002 + 23 February 2003 Abstract @@ -16,9 +16,9 @@ release branches. First is trunk of the CVS repository. This is the main development stream, where all new work and work for future releases is done. -Second is the stable bugfix branch for the latest full release (4.2.0). It +Second is the stable bugfix branch for the latest full release (4.3.0). It is created around the time of the release. The branch for this one is called -"xf-4_2-branch". Fixes for bugs found in the release will be added to this +"xf-4_3-branch". Fixes for bugs found in the release will be added to this branch (as well as the trunk), and updates to this release (if any) will be cut from this branch. Similar stable branches are present for previous full releases. @@ -28,22 +28,22 @@ important post-3.3.6 bug fixes and security updates. Relevant security updates in particular are usually back-ported to this branch. -XFree86 is planning to make full releases from the main development stream -approximately every six months, in late May and November of each year. The -feature freezes for these releases will be 1 April and 1 October respec- -tively. These are target dates, not a binding commitment. How effectively -these dates can be met will depend to a large degree on the resource avail- -able to XFree86. Full releases consist of full source code tarballs, plus -full binary distributions for a range of supported platforms. Update/bugfix -releases will be made on an as-required basis, depending also on the avail- -ability of resources. Update/bugfix releases will not be full releases, and -will consist of source code patches, plus binary updates to be layered on top -of the previous full release. - -The next full release will be version 4.3.0, tentatively scheduled for late -May 2002. There is no scheduled update release. If there is one, the ver- -sion will be 4.2.1. +XFree86 is planning to make full releases from the main development stream at +regular intervals in the 6-12 month range. The feature freezes for these +releases will usually be 2-3 months before the release dates. This general +plan is a goal, not a binding commitment. The actual release intervals and +dates will depend to a large degree on the resource available to XFree86. +Full releases consist of full source code tarballs, plus full binary distri- +butions for a range of supported platforms. Update/bugfix releases will be +made on an as-required basis, depending also on the availability of +resources, and will generally be limited to serious bug and security fixes. +New features will not usually be added in update releases. Update/bugfix +releases will not be full releases, and will consist of source code patches, +plus binary updates to be layered on top of the previous full release. +The next full release will be version 4.4.0. There is no scheduled update +release, but if one is needed, the version will be 4.3.1. + Aside from actual releases, snapshots of the active release branches are tagged in the CVS repository from time to time. Each such snapshot has an identifiable version number. @@ -338,7 +338,7 @@ } } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.2 2002/01/16 20:38:45 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.4 2003/02/24 03:41:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Versions,v 1.3 2002/01/16 20:51:04 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Versions,v 1.7 2003/02/24 04:03:25 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/man/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/man/Imakefile:3.6 xc/programs/Xserver/hw/xfree86/doc/man/Imakefile:3.8 --- xc/programs/Xserver/hw/xfree86/doc/man/Imakefile:3.6 Thu Nov 1 18:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/doc/man/Imakefile Sat Dec 21 19:46:53 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/Imakefile,v 3.6 2001/11/01 23:35:32 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/Imakefile,v 3.8 2002/12/22 00:46:53 dawes Exp $ MANDIR = $(LIBMANDIR) MANSUFFIX = $(LIBMANSUFFIX) @@ -23,9 +23,7 @@ #endif -/* XXX Check if this is up to date */ InstallManPageLong(XF86VM,$(MANDIR),XF86VidMode) #if ExpandManNames -InstallManPageAliases(XF86VidMode,$(MANDIR),XF86VidModeQueryExtension XF86VidModeQueryVersion XF86VidModeGetModeLine XF86VidModeGetAllModeLines XF86VidModeDeleteModeLine XF86VidModeModModeLine XF86VidModeSwitchMode XF86VidModeSwitchToMode XF86VidModeLockModeSwitch XF86VidModeGetMonitor XF86VidModeGetViewPort XF86VidModeSetViewPort XF86VidModeValidateModeLine) +InstallManPageAliases(XF86VidMode,$(MANDIR),XF86VidModeQueryExtension XF86VidModeQueryVersion XF86VidModeGetModeLine XF86VidModeGetAllModeLines XF86VidModeDeleteModeLine XF86VidModeModModeLine XF86VidModeSwitchMode XF86VidModeSwitchToMode XF86VidModeLockModeSwitch XF86VidModeGetMonitor XF86VidModeGetViewPort XF86VidModeSetViewPort XF86VidModeValidateModeLine XF86VidModeSetClientVersion XF86VidModeGetDotClocks XF86VidModeGetGamma XF86VidModeSetGamma XF86VidModeSetGammaRamp XF86VidModeGetGammaRamp XF86VidModeGetGammaRampSize XF86VidModeGetPermissions) #endif - Index: xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man diff -u xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man:3.8 xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man:3.9 --- xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man:3.8 Wed Feb 7 17:35:22 2001 +++ xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man Sat Dec 21 19:46:53 2002 @@ -1,5 +1,5 @@ .\" Copyright (c) 1996 The XFree86 Project -.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man,v 3.8 2001/02/07 22:35:22 tsi Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man,v 3.9 2002/12/22 00:46:53 dawes Exp $ .\" $TOG: XF86DGA.man /main/9 1997/11/11 12:08:52 kaleb $ .\" .de ZN @@ -195,7 +195,7 @@ returns the lowest numbered error and event values assigned to the extension. .SH SEE ALSO -XFree86(1), XF86Config(4/5) +XFree86(1), XF86Config(__filemansuffix__) .SH AUTHORS Jon Tombs, Harm Hanemaayer, Mark Vojkovich. Index: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man diff -u xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man:3.11 xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man:3.12 --- xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man:3.11 Wed Feb 7 17:35:22 2001 +++ xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man Sat Dec 21 19:46:54 2002 @@ -4,7 +4,7 @@ .\" .\" Copyright (c) 1996 Joe Moss, The XFree86 Project .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man,v 3.11 2001/02/07 22:35:22 tsi Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man,v 3.12 2002/12/22 00:46:54 dawes Exp $ .de ZN .ie t \fB\^\\$1\^\fR\\$2 .el \fI\^\\$1\^\fP\\$2 @@ -210,7 +210,7 @@ .IP \fBMF_\fP* 1i Mouse flags .SH "SEE ALSO" -xset(1) +xset(1), XF86Config(__filemansuffix__) .SH AUTHORS Joe Moss and David Dawes, The XFree86 Project, Inc. Index: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man diff -u xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man:3.10 xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man:3.12 --- xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man:3.10 Wed Feb 7 17:35:22 2001 +++ xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man Sat Dec 21 19:46:54 2002 @@ -4,7 +4,7 @@ .\" .\" .\" Copyright (c) 1996 Joe Moss, The XFree86 Project -.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man,v 3.10 2001/02/07 22:35:22 tsi Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man,v 3.12 2002/12/22 00:46:54 dawes Exp $ .\" .de ZN .ie t \fB\^\\$1\^\fR\\$2 @@ -12,7 +12,7 @@ .. .TH XF86VIDMODE 3X11 __vendorversion__ "X FUNCTIONS" .SH NAME -XF86VidModeQueryExtension, XF86VidModeQueryVersion, XF86VidModeGetModeLine, XF86VidModeGetAllModeLines, XF86VidModeDeleteModeLine, XF86VidModeModModeLine, XF86VidModeValidateModeLine, XF86VidModeSwitchMode, XF86VidModeSwitchToMode, XF86VidModeLockModeSwitch, XF86VidModeGetMonitor, XF86VidModeGetViewPort, XF86VidModeSetViewPort \- XFree86-VidMode extension interface functions +XF86VidModeQueryExtension, XF86VidModeQueryVersion, XF86VidModeSetClientVersion, XF86VidModeGetModeLine, XF86VidModeGetAllModeLines, XF86VidModeDeleteModeLine, XF86VidModeModModeLine, XF86VidModeValidateModeLine, XF86VidModeSwitchMode, XF86VidModeSwitchToMode, XF86VidModeLockModeSwitch, XF86VidModeGetMonitor, XF86VidModeGetViewPort, XF86VidModeSetViewPort, XF86VidModeGetDotClocks, XF86VidModeGetGamma, XF86VidModeSetGamma, XF86VidModeGetGammaRamp, XF86VidModeSetGammaRamp, XF86VidModeGetGammaRampSize, XF86VidModeGetPermissions \- XFree86-VidMode extension interface functions .SH SYNTAX .nf .LP @@ -28,6 +28,9 @@ int *\fImajor_version_return\fP\^, int *\fIminor_version_return\fP\^); .LP +Bool XF86VidModeSetClientVersion( + Display *\fIdisplay\fP\^); +.LP Bool XF86VidModeGetModeLine( Display *\fIdisplay\fP\^, int \fIscreen\fP\^, @@ -38,7 +41,7 @@ Display *\fIdisplay\fP\^, int \fIscreen\fP\^, int *\fImodecount_return\fP\^, - XF86VidModeModeInfo **\fImodesinfo\fP\^); + XF86VidModeModeInfo ***\fImodesinfo\fP\^); .ig .LP Bool XF86VidModeAddModeLine( @@ -94,6 +97,45 @@ int \fIscreen\fP\^, int \fIx\fP\^, int \fIy\fP\^); +.LP +XF86VidModeGetDotClocks( + Display *\fIdisplay\fP\^, + int \fIscreen\fP\^, + int *\fIflags return\fP\^, + int *\fInumber of clocks return\fP\^, + int *\fImax dot clock return\fP\^, + int **\fIclocks return\fP\^); +.LP +XF86VidModeGetGamma( + Display *\fIdisplay\fP\^, + int \fIscreen\fP\^, + XF86VidModeGamma *\fIGamma\fP\^); +.LP +XF86VidModeSetGamma( + Display *\fIdisplay\fP\^, + int \fIscreen\fP\^, + XF86VidModeGamma *\fIGamma\fP\^); +.LP +XF86VidModeGetGammaRamp( + Display *\fIdisplay\fP\^, + int \fIscreen\fP\^, + int \fIsize\fP\^, + unsigned short *\fIred array\fP\^, + unsigned short *\fIgreen array\fP\^, + unsigned short *\fIblue array\fP\^); +.LP +XF86VidModeSetGammaRamp( + Display *\fIdisplay\fP\^, + int \fIscreen\fP\^, + int \fIsize\fP\^, + unsigned short *\fIred array\fP\^, + unsigned short *\fIgreen array\fP\^, + unsigned short *\fIblue array\fP\^); +.LP +XF86VidModeGetGammaRampSize( + Display *\fIdisplay\fP\^, + int \fIscreen\fP\^, + int *\fIsize\fP\^); .fi .SH ARGUMENTS .IP \fIdisplay\fP 2i @@ -185,6 +227,24 @@ float hi; /* Top of range */ float lo; /* Bottom of range */ } XF86VidModeSyncRange; +.LP +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent req */ + Display *display; /* Display the event was read from */ + Window root; /* root window of event screen */ + int state; /* What happened */ + int kind; /* What happened */ + Bool forced; /* extents of new region */ + Time time; /* event timestamp */ +} XF86VidModeNotifyEvent; +.LP +typedef struct { + float red; /* Red Gamma value */ + float green; /* Green Gamma value */ + float blue; /* Blue Gamma value */ +} XF86VidModeGamma; .fi .SH DESCRIPTION These functions provide an interface to the server extension @@ -336,8 +396,20 @@ .ZN XF86VidModeQueryExtension returns the lowest numbered error and event values assigned to the extension. +.SH BUGS +The +XF86VidModeSetClientVersion, +XF86VidModeGetDotClocks, +XF86VidModeGetGamma, +XF86VidModeSetGamma, +XF86VidModeSetGammaRamp, +XF86VidModeGetGammaRamp, +XF86VidModeGetGammaRampSize, +and +XF86VidModeGetPermissions +functions need to be documented. In the meantime, check the source +code for information about how to use them. .SH SEE ALSO -XFree86(1), XF86Config(4/5), xvidtune(1) +XFree86(1), XF86Config(__filemansuffix__), xvidtune(1) .SH AUTHORS Kaleb Keithley, Jon Tombs, David Dawes, and Joe Moss - Index: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml:3.6 xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml:3.11 --- xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml:3.6 Thu Nov 15 12:32:16 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml Wed Feb 26 20:17:36 2003 @@ -5,8 +5,12 @@
Building XFree86 from a Source Distribution <author>David Dawes, Matthieu Herrb -<Date>27 May 2001 +<Date>26 February 2003 +<ident> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.11 2003/02/27 01:17:36 dawes Exp $ +</ident> + <abstract> This document describes how to build XFree86 from the <bf>source</bf> distribution. It is designed to @@ -27,69 +31,126 @@ builds with the native compiler for each platform; <sect>How to get the XFree86 &relvers; source - <p> -There are a few starting points for getting the XFree86 source. One option -is to start directly with the XFree86 &relvers; source distribution. In this -case, the procedure is as follows: + +The recommended way of getting the XFree86 &relvers; source is to +get it directly from the XFree86 CVS repository. There are several +ways of doing that, and they are described at our <url name="CVS web page" +url="http://www.xfree86.org/cvs/"> The CVS tag for this release is +"<tt>&reltag;</tt>", and the tag for the maintenance branch for this +release is "<tt>&relbranchtag;</tt>". + +<![ %notsnapshot; [ +Another method of getting the XFree86 &relvers; source is to +either download the &fullrelvers; source tarballs from the XFree86 ftp +site<![ %updaterel; [ and the source patch that updates &fullrelvers; to +&relvers]]>. The procedure for this is as follows: <itemize> - <item>The XFree86 source is contained in files <tt>X&srcvers;src-1.tgz</tt>, - <tt>X&srcvers;src-2.tgz</tt> and <tt>X&srcvers;src-3.tgz</tt>. These can be found - at <htmlurl name="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/source/" - url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/source/"> and similar - locations on XFree86 mirror sites. <tt>X&srcvers;src-2.tgz</tt> contains - the fonts and documentation source. <tt>X&srcvers;src-3.tgz</tt> contains - the hardcopy documentation. <tt>X&srcvers;src-1.tgz</tt> contains - everything else. If you don't need the docs or fonts you can get - by with only <tt>X&srcvers;src-1.tgz</tt>. + <item>The XFree86 &fullrelvers; source is contained in the files + <tt>X&fullsrcvers;src-1.tgz</tt>, <tt>X&fullsrcvers;src-2.tgz</tt>, + <tt>X&fullsrcvers;src-3.tgz</tt>, <tt>X&fullsrcvers;src-4.tgz</tt>, + <tt>X&fullsrcvers;src-5.tgz</tt>, <tt>X&fullsrcvers;src-6.tgz</tt> + and <tt>X&fullsrcvers;src-7.tgz</tt>. These can be found at + <htmlurl + name="ftp://ftp.xfree86.org/pub/XFree86/&fullrelvers;/source/" + url="ftp://ftp.xfree86.org/pub/XFree86/&fullrelvers;/source/"> + and similar locations on XFree86 mirror sites. + <tt>X&fullsrcvers;src-4.tgz</tt> and + <tt>X&fullsrcvers;src-5.tgz</tt> contains the fonts. + <tt>X&fullsrcvers;src-6.tgz</tt> contains the documentation + source. <tt>X&fullsrcvers;src-7.tgz</tt> contains the hardcopy + documentation. <tt>X&fullsrcvers;src-1.tgz</tt>, + <tt>X&fullsrcvers;src-2.tgz</tt> and + <tt>X&fullsrcvers;src-3.tgz</tt> contains everything else. If + you don't need the docs or fonts you can get by with only + <tt>X&fullsrcvers;src-1.tgz</tt>, <tt>X&fullsrcvers;src-2.tgz</tt> + and <tt>X&fullsrcvers;src-3.tgz</tt>. + <item>Extract each of these files by running the following from a directory on a filesystem containing enough space (the full source requires - around 270MB, and a similar amount is required in addition to this + around 305MB, and a similar amount is required in addition to this for the compiled binaries): <quote><tt> - gzip -d < X&srcvers;src-1.tgz | tar vxf -<newline> - gzip -d < X&srcvers;src-2.tgz | tar vxf -<newline> - gzip -d < X&srcvers;src-3.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-1.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-2.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-3.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-4.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-5.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-6.tgz | tar vxf -<newline> + gzip -d < X&fullsrcvers;src-7.tgz | tar vxf -<newline> </tt></quote> - <item>If the release is not a full release, it is available as a - patch against the previous full release in the -<htmlurl -name="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/" -url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/"> -directory. Get the patch file from there and apply it by running the -following command: -<quote><tt> -cd <em>the directory containing the</em> xc <em>directory</em><newline> -gzip -d < <em>file</em> | patch -s -p0 -E -</tt> -</quote> -Look for special patching instructions in the <htmlurl name="Release -Notes" url="http://www.xfree86.org/&relvers;/RELNOTES.html">. + +<![ %updaterel; [ + <item>A patch relative to &fullrelvers is available at + <htmlurl + name="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/" + url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/">. + The patch file is <tt>&fullrelvers;-&relvers;.diff.gz</tt>. + + The patch can be applied by running: + <quote><tt> + cd <em>the directory containing the</em> xc <em>directory</em><newline> + gzip -d < &fullrelvers;-&relvers;.diff.gz | patch -s -p0 -E + </tt> + </quote> + Look for special patching instructions in the "How to get XFree86" + section of the <htmlurl name="README" url="README.html"> for + this release. +]]> </itemize> + +<![ %fullrel; [ +Alternatively, if you already have a pristine copy of the XFree86 +&prevfullrelvers; source, you can download patches from +<htmlurl name="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/" +url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/"> that will allow +you to convert it to &relvers;. Information about which patch files to +download and how to apply them can be found in the "How to get XFree86" +section of the <htmlurl name="README" url="README.html"> for this release. +]]> -Another option is to get the source by anonymous CVS or CVSup. -See <htmlurl name="http://www.xfree86.org/cvs/" -url="http://www.xfree86.org/cvs/"> for details on the different -procedure available. +All methods will produce one main source directory called <tt>xc</tt>. +]]> -All method will produce one main source directory called <tt>xc</tt>. +<![ %snapshot; [ +<p> +The source for the XFree86 &relvers; snapshot is available from the XFree86 +CVS repository. See See <htmlurl name="http://www.xfree86.org/cvs/" +url="http://www.xfree86.org/cvs/"> for details. The tag for this snapshot +is "&reltag;". To get the current development version, don't specify any +tag. +]]> + <sect>Configuring the source before building <p> -It is recommended that you start the configuration process by going to the -<tt>xc/config/cf</tt> directory, and copying the file <tt>xf86site.def</tt> -to <tt>host.def</tt>. Then read through the <tt>host.def</tt> file -(which is heavily commented), and set any parameters that you want for -your configuration. You can usually find out what the default settings -are by checking the <tt>.cf</tt> file(s) relevant to your OS. - -Unlike previous versions, imake can now automatically detect and set -the various <bf>OS*Version</bf> parameters, so you shouldn't need to -enter those settings explicitly. +In most cases it shouldn't be necessary to configure anything before building. -If you are using just the <tt>X&srcvers;src-1.tgz</tt> part of the -source dist, you will need to define <bf>BuildFonts</bf> to +If you do want to make configuration changes, it is recommended that +you start by going to the <tt>xc/config/cf</tt> directory, and copying +the file <tt>xf86site.def</tt> to <tt>host.def</tt>. Then read through +the <tt>host.def</tt> file (which is heavily commented), and set any +parameters that you want for your configuration. You can usually find +out what the default settings are by checking the <tt>.cf</tt> file(s) +relevant to your OS. + +A general rule to follow is to only change things that you understand +and have a good reason to change. It is easy to create build problems +by changing the default configuration. Many of the configuration +parameters are documented in <tt>xc/config/cf/README</tt>. + +<!-- +There's also +a section <ref name="below" id="config_params"> with information about +some configuration settings. +--> + +<![ %notsnapshot; [ +If you are using just the <tt>X&srcvers;src-1.tgz</tt>, +<tt>X&srcvers;src-2.tgz</tt> and <tt>X&srcvers;src-3.tgz</tt> parts of +the source dist, you will need to define <bf>BuildFonts</bf> to <bf>NO</bf>. +]]> <sect>Using a shadow directory of symbolic links for the build <p> @@ -101,10 +162,11 @@ date, the update process is not disturbed by foreign files not under the control of CVS. <item>It is possible to build XFree86 for several different Operating -System or architectures from the same sources, shared by NFS. +System or architectures from the same sources, shared by read-only NFS +mounts. <item>It is possible to build XFree86 with different configuration -options, just by putting a real copy<tt>host.def</tt> in each build -tree and by customizing it separately in each build tree. +options, just by putting a real copy of the <tt>host.def</tt> file in +each build tree and by customizing it separately in each build tree. </itemize> <p> To make a shadow directory of symbolic links, use the following steps: @@ -116,15 +178,16 @@ cd <em>the directory containing the </em>xc<em>directory</em><newline> mkdir build </tt></quote> -<item>use the <tt>lndir</tt>command to make the shadow tree: +<item>use the "<tt>lndir</tt>" command to make the shadow tree: <quote><tt> lndir ../xc </tt></quote> Note that you can refer to the <tt>xc</tt> directory with an absolute path if needed. <p> -See the <htmlurl name="lndir(1) manual page" -url="http://www.xfree86.org/&relvers;/lndir.1.html"> for details. +See the <htmlurl name="lndir(1)" +url="http://www.xfree86.org/&relvers;/lndir.1.html"> manual page for +details. </itemize> If <tt>lndir</tt> is not already installed on your system, you can build it manually from the XFree86 sources by running the following @@ -135,6 +198,15 @@ cp lndir <em>some directory in your PATH</em> </tt></quote> +From time to time there may be some stale links in the build tree, for +example, when files in the source tree are removed or renamed. These can +be cleaned up by running the "<tt>cleanlinks</tt>" script from the build +directory (see the <htmlurl name="cleanlinks(1)" url="cleanlinks.1.html"> +manual page). Rarely there will be changes that will require the build +tree to be re-created from scratch. A symptom of this can be mysterious +build problems. The best solution for this is to remove the build tree, +and then re-create it using the steps outlined above. + <sect>Building and installing the distribution <p> Before building the distribution, read through the OS-specific <tt/README/ @@ -142,7 +214,7 @@ you. Once those OS-specific details have been taken care of, go your build directory (either the <tt/xc/ directory or the shadow tree created before) and -run ``<tt/make World/'' with the <bf/BOOTSTRAPCFLAGS/ +run "<tt/make World/" with the <bf/BOOTSTRAPCFLAGS/ set as described in the OS-specific README (if necessary, but most systems supported by XFree86 don't need <bf/BOOTSTRAPCFLAGS/). It is advisable to redirect stdout and stderr to <tt/World.Log/ so that you @@ -163,16 +235,35 @@ </tt></quote> in a terminal. <p> -When the build is finished, you should check <tt/World.Log/ to see -if there were any problems. If there weren't any then you can install -the binaries. -To do -the install, run ``<tt/make -install/'' and ``<tt/make install.man/''. Make sure you have enough -space in <tt>/usr/X11R6</tt> for the install to succeed. If you want -to install on a filesystem other than <tt>/usr</tt>, make a symbolic -link to <tt>/usr/X11R6</tt> before installing. +When the build is finished, you should check the <tt/World.Log/ file to +see if there were any problems. If there weren't any then you can +install the binaries. By default the "make World" process will ignore +errors and build as much as possible. If there were problems and they +are not corrected at this stage, the installation process will fail. +To restart the build process after correcting the problems, just +run 'make'. If Imakefiles or part of the build configuration was +changed as part of correcting the problem, either re-run "make World", +or run "make Everything". +If you would prefer "make World" to exit at the first error, run it in the +following way instead of the way described above: + +for Bourne-like shells: +<quote><tt> +make WORLDOPTS= World > World.log 2>&1 +</tt></quote> +for C-shell variants: +<quote><tt> +make WORLDOPTS= World >& World.log +</tt></quote> + +To do the install, run "<tt/make install/" and "<tt/make install.man/". +Make sure you have enough space in <tt>/usr/X11R6</tt> for the install +to succeed. If you want to install on a filesystem other than +<tt>/usr</tt>, make a symbolic link to <tt>/usr/X11R6</tt> before +installing. + + <sect>Reconfiguring the server (source distribution) <p> To build a different set of servers or servers with a different set of @@ -190,7 +281,7 @@ <tscreen><verb> make Makefile make Makefiles - make includes + make includes make depend make </verb></tscreen> @@ -201,7 +292,7 @@ <tt>Makefile</tt>of XFree86: <itemize> <item><bf/Everything/ after a <tt>make World</tt>, <tt>make -Everything</tt>does everything a <tt>make World</tt> does, except the +Everything</tt> does everything a <tt>make World</tt> does, except the cleaning of the tree. It is a way to quickly rebuild the tree after a source patch, but it is not 100% bullet proof. There are cases were it is better to force a full build by using <tt>make World</tt>. @@ -236,12 +327,15 @@ <item><bf/VerifyOS/ displays the detected operating system version. If the numbers shown do not match your system, you probably need to set them manually in <tt>host.def</tt> and report the problem to -XFree86@XFree86.org. +<email>XFree86@XFree86.org</email>. </itemize> -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.6 2001/11/15 17:32:16 dawes Exp $ -</verb> +<!-- +<sect>Various Configuration settings<label id="config_params"> +<p> + +Fill in this section. +--> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.47 xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.52 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.47 Wed Jan 16 15:38:44 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml Tue Feb 25 14:31:00 2003 @@ -27,7 +27,7 @@ <title>XFree86 X server ``New Design'' (DRAFT) <author>The XFree86 Project, Inc -<date>Last modified 1 August 2001 +<date>Last modified 2003 January 22 @@ -36,7 +36,7 @@ <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.47 2002/01/16 20:38:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.52 2003/02/25 19:31:00 dawes Exp $ </ident> @@ -369,31 +369,31 @@ cards. Currently HOST-PCI bridges are not yet handled by RAC as they require specific drivers. -<sect2>Entity +<sect2>Entity <p> The smallest independently addressable unit on a system bus is referred to as an entity. So far we know ISA and PCI entities. PCI entities can be located on the PCI bus by an unique ID consisting of the bus, card and function number. - + <sect2>Resource <p> - + ``Resource'' refers to a range of memory or I/O addresses an entity can decode. - + If a device is capable of disabling this decoding the resource is called sharable. For PCI devices a generic method is provided to control resource decoding. Other devices will have to provide a device specific function to control decoding. - + If the entity is capable of decoding this range at a different location this resource is considered relocatable. Resources which start at a specific address and occupy a single continuous range are called block resources. - + Alternatively resource addresses can be decoded in a way that they satisfy the conditions: <quote><verb> @@ -645,13 +645,13 @@ Allocate a &s.code;ScrnInfoRec&e.code; for each active instance of the hardware found, and fill in the basic information, including the - other driver entry points. This is best done with the - &s.code;xf86ConfigIsaEntity()&e.code; helper function for ISA - instances or &s.code;xf86ConfigPciEntity()&e.code; for PCI instances. + other driver entry points. This is best done with the + &s.code;xf86ConfigIsaEntity()&e.code; helper function for ISA + instances or &s.code;xf86ConfigPciEntity()&e.code; for PCI instances. These functions allocate a &s.code;ScrnInfoRec&e.code; for active entities. Optionally &s.code;xf86AllocateScreen()&e.code; function may also be used to allocate the &s.code;ScrnInfoRec&e.code;. - Any of these functions take care of initialising fields to defined + Any of these functions take care of initialising fields to defined ``unused'' values. Claim the entities for each instance of the hardware found. This @@ -851,12 +851,12 @@ Modules may be loaded at any point in this function, and all modules that the driver will need must be loaded before the end - of this function. Either the &s.code;xf86LoadSubModule()&e.code; - or the &s.code;xf86LoadDrvSubModule()&e.code; function should be - used to load modules depending on whether a - &s.code;ScrnInfoRec&e.code; has been set up. A driver may unload - a module within this function if it was only needed temporarily, - and the &s.code;xf86UnloadSubModule()&e.code; function should be used + of this function. Either the &s.code;xf86LoadSubModule()&e.code; + or the &s.code;xf86LoadDrvSubModule()&e.code; function should be + used to load modules depending on whether a + &s.code;ScrnInfoRec&e.code; has been set up. A driver may unload + a module within this function if it was only needed temporarily, + and the &s.code;xf86UnloadSubModule()&e.code; function should be used to do that. Otherwise there is no need to explicitly unload modules because the loader takes care of module dependencies and will unload submodules automatically if/when the driver module is @@ -950,7 +950,7 @@ <quote><p> Unloads the module referenced by &s.code;module&e.code;. &s.code;module&e.code; should be a pointer returned previously - by &s.code;xf86LoadSubModule()&e.code; or + by &s.code;xf86LoadSubModule()&e.code; or &s.code;xf86LoadDrvSubModule()&e.code; . </quote> @@ -1871,7 +1871,6 @@ <quote><p> &s.code;int xf86MatchPciInstances(const char *driverName, int vendorID, &f.indent;SymTabPtr chipsets, PciChipsets *PCIchipsets, - &f.indent;GDevPtr *devList, int numDevs, &f.indent;GDevPtr *devList, int numDevs, DriverPtr drvp, &f.indent;int **foundEntities)&e.code; <quote><p> @@ -2046,26 +2045,26 @@ Two helper functions are provided to aid configuring entities: <quote><p> - &s.code;ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, - &f.indent;int scrnFlag, int entityIndex, - &f.indent;PciChipsets *p_chip, - &f.indent;resList res, EntityProc init, - &f.indent;EntityProc enter, EntityProc leave, + &s.code;ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, + &f.indent;int scrnFlag, int entityIndex, + &f.indent;PciChipsets *p_chip, + &f.indent;resList res, EntityProc init, + &f.indent;EntityProc enter, EntityProc leave, &f.indent;pointer private)&e.code; <p> - &s.code;ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, - &f.indent;int scrnFlag, int entityIndex, + &s.code;ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, + &f.indent;int scrnFlag, int entityIndex, &f.indent;IsaChipsets *i_chip, - &f.indent;resList res, EntityProc init, - &f.indent;EntityProc enter, EntityProc leave, + &f.indent;resList res, EntityProc init, + &f.indent;EntityProc enter, EntityProc leave, &f.indent;pointer private)&e.code; <quote><p> These functions are used to register the non-relocatable resources for an entity, and the optional entity-specific &s.code;Init&e.code;, &s.code;Enter&e.code; and &s.code;Leave&e.code; functions. Usually the list of fixed resources is obtained from the Isa/PciChipsets lists. However an additional list of - resources may be passed. Generally this is not required. - For active entities a &s.code;ScrnInfoRec&e.code; is allocated + resources may be passed. Generally this is not required. + For active entities a &s.code;ScrnInfoRec&e.code; is allocated if the &s.code;pScrn&e.code; argument is &s.code;NULL&e.code;. The return value is &s.code;TRUE&e.code; when successful. The init, enter, leave @@ -2077,9 +2076,9 @@ </quote> They are passed the entity index and a pointer to a private scratch - area. This are can be set up during &s.code;Probe()&e.code; and + area. This can be set up during &s.code;Probe()&e.code; and its address can be passed to - &s.code;xf86ConfigIsaEntity()&e.code; + &s.code;xf86ConfigIsaEntity()&e.code; and &s.code;xf86ConfigPciEntity()&e.code; as the last argument. </quote> @@ -2118,13 +2117,13 @@ <sect2>PreInit Phase <p> -During this phase the remaining resource should be registered. +During this phase the remaining resources should be registered. &s.code;PreInit()&e.code; should call &s.code;xf86GetEntityInfo()&e.code; -To obtain a pointer to an &s.code;EntityInfoRec&e.code; for each entity +to obtain a pointer to an &s.code;EntityInfoRec&e.code; for each entity it is able to drive and check if any resource are listed in its &s.code;resources&e.code; field. If resources registered in the Probe phase have been rejected in the post-Probe phase -(&s.code;resources == NULL&e.code;), then the driver should +(&s.code;resources&e.code; is non-&s.code;NULL&e.code;), then the driver should decide if it can continue without using these or if it should fail. <quote><p> @@ -2142,9 +2141,8 @@ &s.code;Bool xf86IsEntityPrimary(int entityIndex)&e.code; <quote><p> This function returns &s.code;TRUE&e.code; if the entity referenced - by &s.code;entityIndex&e.code; is the display device that primary - display device (i.e., the one initialised at boot time and used - in text mode). + by &s.code;entityIndex&e.code; is the primary display device (i.e., + the one initialised at boot time and used in text mode). </quote> @@ -2193,10 +2191,12 @@ &s.code;resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes)&e.code; <quote><p> This function takes a list of PCI resources that need to be - reallocated and returns a list of the reallocated resource. This - list needs to be passed to &s.code;xf86RegisterResources()&e.code; again to be - registered with the broker. If the reallocation fails, &s.code;NULL&e.code; is - returned. + reallocated and returns &s.code;NULL&e.code when all relocations are + successful. + &s.code;xf86RegisterResources()&e.code; should be called again to + register the relocated resources with the broker. + If the reallocation fails, a list of the resources that could not be + relocated is returned. </quote> </quote> @@ -2216,7 +2216,7 @@ type &s.code;ResEnd&e.code; will be returned. </quote> - &s.code;resRange xf86GetSparse(long type, memType fixed_bits, + &s.code;resRange xf86GetSparse(long type, memType fixed_bits, &f.indent;memType decode_mask, memType address_mask, &f.indent;resPtr avoid)&e.code; <quote><p> @@ -2248,7 +2248,7 @@ register that needs to be fixed (&s.code;0-5&e.code;, and &s.code;6&e.code; for the BIOS base register). The size is specified by the alignment. Since PCI resources need to span an - integral range of the size &s.code;2^n&e.code; the alignment also + integral range of size &s.code;2^n&e.code;, the alignment also specifies the number of addresses that will be decoded. If the driver specifies a type mask it can override the default type for PCI resources which is &s.code;ResShared&e.code;. The resource @@ -2270,13 +2270,15 @@ </quote> </quote> -The driver may replace the generic access control functions for an entity -by it's own ones. This is done with the &s.code;xf86SetAccessFuncs()&e.code;: +The driver may replace the generic access control functions for an entity. +This is done with the &s.code;xf86SetAccessFuncs()&e.code;: <quote><p> - &s.code;void xf86SetAccessFuncs(EntityInfoPtr pEnt, + &s.code;void xf86SetAccessFuncs(EntityInfoPtr pEnt, &f.indent;xf86SetAccessFuncPtr funcs, &f.indent;xf86SetAccessFuncPtr oldFuncs)&e.code; + <quote><p> with: + </quote> <verb> typedef struct { @@ -2295,13 +2297,13 @@ combined access functions are the same it is assumed that I/O can not be controlled independently. If memory and I/O have to be controlled together all three values should be the same. If a - non &s.code;NULL&e.code; value is passed as fifth argument it is + non &s.code;NULL&e.code; value is passed as third argument it is interpreted as an address where to store the old access record. - If the fifth argument is &s.code;NULL&e.code; it will be assumed + If the third argument is &s.code;NULL&e.code; it will be assumed that the generic access should be enabled before replacing the access functions. Otherwise it will be disabled. The driver may enable them itself using the returned values. It should do this - from his replacement access functions as the generic access may + from its replacement access functions as the generic access may be disabled by the common level on certain occasions. If replacement functions are specified they must control all resources of the specific type registered for the entity. @@ -2309,14 +2311,14 @@ </quote> </quote> -To find out if specific resource range is conflicting with another +To find out if a specific resource range conflicts with another resource the &s.code;xf86ChkConflict()&e.code; function may be used: <quote><p> &s.code;memType xf86ChkConflict(resRange *rgp, int entityIndex)&e.code; <quote><p> This function checks if the resource range &s.code;rgp&e.code; of for the specified entity conflicts with with another resource. - If it a conflict is found, the address of the start of the conflict + If a conflict is found, the address of the start of the conflict is returned. The return value is zero when there is no conflict. </quote> @@ -2503,44 +2505,44 @@ The &s.code;OptionInfoRec&e.code; is defined as follows: - <verb> - typedef struct { - double freq; - int units; - } OptFrequency; - - typedef union { - unsigned long num; - char * str; - double realnum; - Bool bool; - OptFrequency freq; - } ValueUnion; - - typedef enum { - OPTV_NONE = 0, - OPTV_INTEGER, - OPTV_STRING, /* a non-empty string */ - OPTV_ANYSTR, /* Any string, including an empty one */ - OPTV_REAL, - OPTV_BOOLEAN, - OPTV_FREQ - } OptionValueType; - - typedef enum { - OPTUNITS_HZ = 1, - OPTUNITS_KHZ, - OPTUNITS_MHZ - } OptFreqUnits; - - typedef struct { - int token; - const char* name; - OptionValueType type; - ValueUnion value; - Bool found; - } OptionInfoRec, *OptionInfoPtr; - </verb> + <verb> + typedef struct { + double freq; + int units; + } OptFrequency; + + typedef union { + unsigned long num; + char * str; + double realnum; + Bool bool; + OptFrequency freq; + } ValueUnion; + + typedef enum { + OPTV_NONE = 0, + OPTV_INTEGER, + OPTV_STRING, /* a non-empty string */ + OPTV_ANYSTR, /* Any string, including an empty one */ + OPTV_REAL, + OPTV_BOOLEAN, + OPTV_FREQ + } OptionValueType; + + typedef enum { + OPTUNITS_HZ = 1, + OPTUNITS_KHZ, + OPTUNITS_MHZ + } OptFreqUnits; + + typedef struct { + int token; + const char* name; + OptionValueType type; + ValueUnion value; + Bool found; + } OptionInfoRec, *OptionInfoPtr; + </verb> &s.code;OPTV_FREQ&e.code; can be used for options values that are frequencies. These values are a floating point number with an @@ -2572,7 +2574,9 @@ </quote> - &s.code;OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token)&e.code; + &s.code;OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, + &f.indent;int token)&e.code; + <quote><p> Returns a pointer to the &s.code;OptionInfoRec&e.code; in &s.code;table&e.code; with a token field matching @@ -2712,7 +2716,7 @@ &s.code;"compiler.h"&e.code; </quote> Note: in drivers, this must be included after &s.code;"xf86_ansic.h"&e.code;. - + Drivers that need to access PCI vendor/device definitions need this: <quote> &s.code;"xf86PciInfo.h"&e.code; @@ -2778,7 +2782,7 @@ &s.code;"xf86fbman.h"&e.code; </quote> </quote> - + Non-driver modules should include &s.code;"xf86_ansic.h"&e.code; to get the correct wrapping of ANSI C/libc functions. @@ -2801,7 +2805,7 @@ Management of offscreen video memory may be handled by the XFree86 framebuffer manager. Once the offscreen memory manager is running, drivers or extensions may allocate, free or resize areas of offscreen -video memory using the following functions (definitions taken from +video memory using the following functions (definitions taken from &s.code;xf86fbman.h&e.code;): <code> @@ -2948,7 +2952,7 @@ Initialization of the XFree86 framebuffer manager is done via <quote> - &s.code;Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)&e.code; + &s.code;Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)&e.code; </quote> &s.code;FullBox&e.code; represents the area of the framebuffer that the @@ -3024,9 +3028,9 @@ reload the colormap automatically after mode switches. This is useful for when the driver is resetting the - hardware during mode switches and + hardware during mode switches and corrupting or erasing the hardware - palette. + palette. </quote> @@ -3045,15 +3049,15 @@ The colormap layer normally reloads the palette after VT enters so it is not necessary for the driver to save and restore the palette when switching VTs. The driver must, however, still save the - initial palette during server start up and restore it during - server exit. + initial palette during server start up and restore it during + server exit. </quote> &s.code;void LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, &f.indent;LOCO *colors, VisualPtr pVisual)&e.code; <quote><p> - &s.code;LoadPalette()&e.code; is a driver-provide function for + &s.code;LoadPalette()&e.code; is a driver-provided function for loading a colormap into hardware. &s.code;colors&e.code; is the array of RGB values that represent the full colormap. &s.code;indices&e.code; is a list of index values into the colors @@ -3138,29 +3142,29 @@ /** The DGAModeRec **/ typedef struct { - int num; + int num; DisplayModePtr mode; - int flags; + int flags; int imageWidth; int imageHeight; int pixmapWidth; - int pixmapHeight; - int bytesPerScanline; - int byteOrder; - int depth; + int pixmapHeight; + int bytesPerScanline; + int byteOrder; + int depth; int bitsPerPixel; unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask; int viewportWidth; int viewportHeight; - int xViewportStep; + int xViewportStep; int yViewportStep; - int maxViewportX; + int maxViewportX; int maxViewportY; - int viewportFlags; - int offset; - unsigned char *address; + int viewportFlags; + int offset; + unsigned char *address; int reserved1; int reserved2; } DGAModeRec, *DGAModePtr; @@ -3198,7 +3202,7 @@ &s.code;DGA_PIXMAP_AVAILABLE&e.code; <quote><p> - Indicates that Xlib may be used on the framebuffer. + Indicates that Xlib may be used on the framebuffer. This flag will usually be set unless the driver wishes to prohibit this for some reason. @@ -3211,12 +3215,11 @@ </quote> </quote> - &s.code;imageWidth&nl; imageHeight&e.code; <quote><p> - These are the dimensions of the linear framebuffer + These are the dimensions of the linear framebuffer accessible by the client. </quote> @@ -3245,7 +3248,7 @@ &s.code;depth&e.code; <quote><p> The depth of the framebuffer in this mode. - + </quote> &s.code;bitsPerPixel&e.code; @@ -3274,15 +3277,15 @@ &s.code;xViewportStep&nl; yViewportStep&e.code; <quote><p> - The granularity of x and y viewport positions that - the driver supports in this mode. + The granularity of x and y viewport positions that + the driver supports in this mode. </quote> &s.code;maxViewportX&nl; maxViewportY&e.code; <quote><p> - The maximum viewport position supported by the + The maximum viewport position supported by the driver in this mode. </quote> @@ -3298,7 +3301,7 @@ </quote> &s.code;DGA_FLIP_RETRACE&e.code; <quote<p> - The driver supports viewport changes at retrace. + The driver supports viewport changes at retrace. </quote> </quote> @@ -3306,7 +3309,7 @@ &s.code;offset&e.code; <quote><p> The offset into the linear framebuffer that corresponds to - pixel (0,0) for this mode. + pixel (0,0) for this mode. </quote> @@ -3322,9 +3325,9 @@ typedef struct { Bool (*OpenFramebuffer)( - ScrnInfoPtr pScrn, + ScrnInfoPtr pScrn, char **name, - unsigned char **mem, + unsigned char **mem, int *size, int *offset, int *extra @@ -3335,20 +3338,20 @@ int (*GetViewport)(ScrnInfoPtr pScrn); void (*Sync)(ScrnInfoPtr); void (*FillRect)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, + ScrnInfoPtr pScrn, + int x, int y, int w, int h, unsigned long color ); void (*BlitRect)( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, int dstx, int dsty ); void (*BlitTransRect)( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, int dstx, int dsty, unsigned long color ); @@ -3496,11 +3499,10 @@ <quote> &s.code;Bool xf86XVScreenInit( - &f.indent;ScreenPtr pScreen, + &f.indent;ScreenPtr pScreen, &f.indent;XF86VideoAdaptorPtr *adaptPtrs, &f.indent;int num)&e.code; </quote> - After doing this, the extension will report video adaptors as being available, providing the data in their respective @@ -3516,13 +3518,13 @@ <quote><p> <verb> typedef struct { - unsigned int type; + unsigned int type; int flags; char *name; int nEncodings; - XF86VideoEncodingPtr pEncodings; + XF86VideoEncodingPtr pEncodings; int nFormats; - XF86VideoFormatPtr pFormats; + XF86VideoFormatPtr pFormats; int nPorts; DevUnion *pPortPrivates; int nAttributes; @@ -3544,7 +3546,7 @@ Each adaptor will have its own XF86VideoAdaptorRec. The fields are as follows: - + &s.code;type&e.code; <quote><p> This can be any of the following flags OR'd together. @@ -3552,7 +3554,7 @@ &s.code;XvInputMask&e.code; &s.code;XvOutputMask&e.code; <quote><p> - These refer to the target drawable and are similar to a Window's + These refer to the target drawable and are similar to a Window's class. &s.code;XvInputMask&e.code; indicates that the adaptor can put video into a drawable. &s.code;XvOutputMask&e.code; indicates that the adaptor can get video from a drawable. @@ -3596,7 +3598,7 @@ &s.code;VIDEO_INVERT_CLIPLIST&e.code; <quote><p> This indicates that the video driver requires the clip - list to contain the regions which are obscured rather + list to contain the regions which are obscured rather than the regions which are are visible. </quote> @@ -3683,7 +3685,7 @@ &s.code;nImages&nl; pImages&e.code; <quote><p> - The number of &s.code;XF86ImageRecs&e.code; supported by the adaptor + The number of &s.code;XF86ImageRecs&e.code; supported by the adaptor and a pointer to the array of &s.code;XF86ImageRecs&e.code;. The &s.code;XF86ImageRec&e.code; is described later on. @@ -3701,8 +3703,8 @@ <enum> <item>&s.code;PutVideo&e.code;, &s.code;PutStill&e.code; and - the image routines &s.code;PutImage&e.code; and - &s.code;QueryImageAttributes&e.code; are not required when the + the image routines &s.code;PutImage&e.code; and + &s.code;QueryImageAttributes&e.code; are not required when the adaptor type does not contain &s.code;XvInputMask&e.code;. <item>&s.code;GetVideo&e.code; and &s.code;GetStill&e.code; @@ -3725,7 +3727,7 @@ With the exception of &s.code;QueryImageAttributes&e.code;, these functions should return &s.code;Success&e.code; if the operation was - completed successfully. They can return &s.code;XvBadAlloc&e.code; + completed successfully. They can return &s.code;XvBadAlloc&e.code; otherwise. &s.code;QueryImageAttributes&e.code; returns the size of the XvImage queried. @@ -3737,14 +3739,14 @@ by &s.code;drw_x&e.code;, &s.code;drw_y&e.code;, &s.code;drw_w&e.code; and &s.code;drw_h&e.code; in the Get/Put function. The boxes are in screen coordinates, are guaranteed - not to overlap and an empty region will never be passed. + not to overlap and an empty region will never be passed. If the driver has specified &s.code;VIDEO_INVERT_CLIPLIST&e.code;, &s.code;clipBoxes&e.code; will indicate the areas of the primitive - which are obscured rather than the areas visible. + which are obscured rather than the areas visible. </quote> - &s.code;typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, + &s.code;typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, &f.indent;short vid_x, short vid_y, short drw_x, short drw_y, &f.indent;short vid_w, short vid_h, short drw_w, short drw_h, &f.indent;RegionPtr clipBoxes, pointer data )&e.code; @@ -3764,17 +3766,17 @@ </quote> - &s.code;typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, + &s.code;typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, &f.indent;short vid_x, short vid_y, short drw_x, short drw_y, &f.indent;short vid_w, short vid_h, short drw_w, short drw_h, &f.indent;RegionPtr clipBoxes, pointer data )&e.code; <quote><p> This is same as &s.code;PutVideo&e.code; except that the driver should place only one frame from the stream on the screen. - + </quote> - &s.code;typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, + &s.code;typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, &f.indent;short vid_x, short vid_y, short drw_x, short drw_y, &f.indent;short vid_w, short vid_h, short drw_w, short drw_h, &f.indent;RegionPtr clipBoxes, pointer data )&e.code; @@ -3786,7 +3788,7 @@ </quote> - &s.code;typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, + &s.code;typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, &f.indent;short vid_x, short vid_y, short drw_x, short drw_y, &f.indent;short vid_w, short vid_h, short drw_w, short drw_h, &f.indent;RegionPtr clipBoxes, pointer data )&e.code; @@ -3797,7 +3799,7 @@ </quote> - &s.code;typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, + &s.code;typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, &f.indent;pointer data, Bool cleanup)&e.code; <quote><p> This indicates the driver should stop displaying the video. @@ -3816,14 +3818,14 @@ &s.code;typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, &f.indent;Atom attribute,INT32 value, pointer data)&e.code; - &s.code;typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, + &s.code;typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, &f.indent;Atom attribute,INT32 *value, pointer data)&e.code; <quote><p> A port may have particular attributes such as hue, saturation, brightness or contrast. Xv clients set and - get these attribute values by sending attribute strings - (Atoms) to the server. Such requests end up at these + get these attribute values by sending attribute strings + (Atoms) to the server. Such requests end up at these driver functions. It is recommended that the driver provide at least the following attributes mentioned in the Xv client library docs: @@ -3849,7 +3851,7 @@ &s.code;typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, &f.indent;Bool motion, short vid_w, short vid_h, - &f.indent;short drw_w, short drw_h, + &f.indent;short drw_w, short drw_h, &f.indent;unsigned int *p_w, unsigned int *p_h, pointer data)&e.code; <quote><p> &s.code;QueryBestSize&e.code; provides the client with a way @@ -3864,23 +3866,23 @@ </quote> - &s.code;typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, + &s.code;typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, &f.indent;short src_x, short src_y, short drw_x, short drw_y, &f.indent;short src_w, short src_h, short drw_w, short drw_h, &f.indent;int image, char *buf, short width, short height, &f.indent;Bool sync, RegionPtr clipBoxes, pointer data )&e.code; <quote><p> This is similar to &s.code;PutStill&e.code; except that the - source of the video is not a port but the data stored in a system - memory buffer at &s.code;buf&e.code;. The data is in the format - indicated by the &s.code;image&e.code; descriptor and represents a + source of the video is not a port but the data stored in a system + memory buffer at &s.code;buf&e.code;. The data is in the format + indicated by the &s.code;image&e.code; descriptor and represents a source of size &s.code;width&e.code; by &s.code;height&e.code;. If &s.code;sync&e.code; is TRUE the driver should not return from this function until it is through reading the data from &s.code;buf&e.code;. Returning when &s.code;sync&e.code; is TRUE indicates that it is safe for the data at &s.code;buf&e.code; to be replaced, freed, or modified. - + </quote> &s.code;typedef int (* QueryImageAttributesFuncPtr)( ScrnInfoPtr pScrn, @@ -3893,17 +3895,17 @@ the size and corrected width and height are needed. In that case &s.code;pitches&e.code; and &s.code;offsets&e.code; are NULL. The size of the memory required for the image is returned - by this function. The &s.code;width&e.code; and + by this function. The &s.code;width&e.code; and &s.code;height&e.code; of the requested image can be altered by the driver to reflect format limitations (such as component - sampling periods that are larger than one). If + sampling periods that are larger than one). If &s.code;pitches&e.code; and &s.code;offsets&e.code; are not NULL, these will be arrays with as many elements in them as there are planes in the &s.code;image&e.code; format. The driver should specify the pitch (in bytes) of each scanline in the particular plane as well as the offset to that plane (in bytes) from the beginning of the image. - + </quote> </quote> @@ -3928,12 +3930,12 @@ </quote> -The XF86VideoFormatRec: +The XF86VideoFormatRec: <quote><p> <verb> typedef struct { - char depth; + char depth; short class; } XF86VideoFormatRec, *XF86VideoFormatPtr; </verb> @@ -3961,10 +3963,10 @@ </verb> Each adaptor may have an array of these advertising the attributes - for its ports. Currently defined flags are &s.code;XvGettable&e.code; - and &s.code;XvSettable&e.code; which may be OR'd together indicating that - attribute is ``gettable'' or ``settable'' by the client. The - &s.code;min&e.code; and &s.code;max&e.code; field specify the valid range + for its ports. Currently defined flags are &s.code;XvGettable&e.code; + and &s.code;XvSettable&e.code; which may be OR'd together indicating that + attribute is ``gettable'' or ``settable'' by the client. The + &s.code;min&e.code; and &s.code;max&e.code; field specify the valid range for the value. &s.code;Name&e.code; is a text string describing the attribute by name. @@ -3978,21 +3980,21 @@ int id; int type; int byte_order; - char guid[16]; + char guid[16]; int bits_per_pixel; int format; int num_planes; /* for RGB formats */ int depth; - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; /* for YUV formats */ unsigned int y_sample_bits; unsigned int u_sample_bits; - unsigned int v_sample_bits; + unsigned int v_sample_bits; unsigned int horz_y_period; unsigned int horz_u_period; unsigned int horz_v_period; @@ -4001,7 +4003,7 @@ unsigned int vert_v_period; char component_order[32]; int scanline_order; -} XF86ImageRec, *XF86ImagePtr; +} XF86ImageRec, *XF86ImagePtr; </verb> XF86ImageRec describes how video source data is laid out in memory. @@ -4010,23 +4012,23 @@ &s.code;id&e.code; <quote><p> This is a unique descriptor for the format. It is often good to - set this value to the FOURCC for the format when applicable. + set this value to the FOURCC for the format when applicable. </quote> &s.code;type&e.code; <quote><p> - This is &s.code;XvRGB&e.code; or &s.code;XvYUV&e.code;. + This is &s.code;XvRGB&e.code; or &s.code;XvYUV&e.code;. </quote> &s.code;byte_order&e.code; <quote><p> - This is &s.code;LSBFirst&e.code; or &s.code;MSBFirst&e.code;. + This is &s.code;LSBFirst&e.code; or &s.code;MSBFirst&e.code;. </quote> &s.code;guid&e.code; <quote><p> This is the Globally Unique IDentifier for the format. When - not applicable, all characters should be NULL. + not applicable, all characters should be NULL. </quote> &s.code;bits_per_pixel&e.code; @@ -4038,7 +4040,7 @@ &s.code;format&e.code; <quote><p> - This is &s.code;XvPlanar&e.code; or &s.code;XvPacked&e.code;. + This is &s.code;XvPlanar&e.code; or &s.code;XvPacked&e.code;. </quote> &s.code;num_planes&e.code; @@ -4083,7 +4085,7 @@ &s.code;component_order&e.code; <quote><p> - Uppercase ascii characters representing the order that + Uppercase ascii characters representing the order that samples are stored within packed formats. For planar formats this represents the ordering of the planes. Unused characters in the 32 byte string should be set to NULL. @@ -4091,12 +4093,12 @@ &s.code;scanline_order&e.code; <quote><p> - This is &s.code;XvTopToBottom&e.code; or &s.code;XvBottomToTop&e.code;. + This is &s.code;XvTopToBottom&e.code; or &s.code;XvBottomToTop&e.code;. </quote> Since some formats (particular some planar YUV formats) may not be completely defined by the parameters above, the guid, when -available, should provide the most accurate description of the +available, should provide the most accurate description of the format. </quote> @@ -4132,6 +4134,10 @@ the caller of the loader. Typically the caller identifies which symbols can safely remain unresolved and which cannot. +NOTE: Now that ISO-C allows pointers to functions and pointers to data to +have different internal representations, some of the following interfaces +will need to be revisited. + <sect1>Semi-private Loader Interface <p> @@ -4277,7 +4283,7 @@ specified and matches. </quote> - &s.code;patchlevel&e.code; + &s.code;patchlevel&e.code; <quote><p> The module's patchlevel must be no less than this value. This comparison @@ -4286,20 +4292,20 @@ specified and matches. </quote> - &s.code;abiclass&e.code; + &s.code;abiclass&e.code; <quote><p> String must match the module's abiclass string. </quote> - &s.code;abiversion&e.code; + &s.code;abiversion&e.code; <quote><p> Must be consistent with the module's abiversion (major equal, minor no older). </quote> - &s.code;moduleclass&e.code; + &s.code;moduleclass&e.code; <quote><p> String must match the module's moduleclass string. @@ -4311,7 +4317,7 @@ &s.code;errmaj&e.code; <quote><p> An optional pointer to a variable holding the major - part or the error code. When provided, it + part or the error code. When provided, &s.code;*errmaj&e.code; is filled in when &s.code;LoadModule()&e.code; fails. @@ -4331,7 +4337,8 @@ This function unloads the module referred to by the handle mod. All child modules are also unloaded recursively. This function must not be used to directly unload modules that are child modules (i.e., - those that have been loaded with &s.code;LoadSubModule()&e.code;). + those that have been loaded with the &s.code;LoadSubModule()&e.code; + described below). </quote> </quote> @@ -4361,7 +4368,7 @@ CARD32 abiversion; /* ABI version */ const char * moduleclass; /* module class */ CARD32 checksum[4]; /* contains a digital signature of the */ - /* version info structure */ + /* version info structure */ } XF86ModuleVersionInfo; </verb> @@ -4547,15 +4554,15 @@ and maybe used by the &s.code;SetupProc&e.code; if it calls other loader functions that require a reference to it. The remaining arguments are those that were passed to the - &s.code;LoadModule()&e.code; (or &s.code;LoadSubModule()&e.code;), - and are described above. When the &s.code;SetupProc&e.code; is - successful it must return a non-&s.code;NULL&e.code; value. The - loader checks this, and if it is &s.code;NULL&e.code; it unloads - the module and reports the failure to the caller of - &s.code;LoadModule()&e.code;. If the &s.code;SetupProc&e.code; - does things that need to be undone when the module is unloaded, - it should define a &s.code;TearDownProc&e.code;, and return a - pointer that the &s.code;TearDownProc&e.code; can use to undo what + &s.code;LoadModule()&e.code; (or &s.code;LoadSubModule()&e.code;), + and are described above. When the &s.code;SetupProc&e.code; is + successful it must return a non-&s.code;NULL&e.code; value. The + loader checks this, and if it is &s.code;NULL&e.code; it unloads + the module and reports the failure to the caller of + &s.code;LoadModule()&e.code;. If the &s.code;SetupProc&e.code; + does things that need to be undone when the module is unloaded, + it should define a &s.code;TearDownProc&e.code;, and return a + pointer that the &s.code;TearDownProc&e.code; can use to undo what has been done. When a module is loaded multiple times, the &s.code;SetupProc&e.code; @@ -4603,7 +4610,7 @@ <quote><p> This function unloads the module with handle &s.code;module&e.code;. If that module itself has children, they are also unloaded. It is - like &s.code;LoadModule()&e.code;, except that it is safe to use + like &s.code;UnloadModule()&e.code;, except that it is safe to use for unloading child modules. </quote> @@ -4644,9 +4651,9 @@ &s.code;LoadSubModule()&e.code;. If any symbols registered in this way are found to be unresolved when &s.code;LoaderCheckUnresolved()&e.code; is called then - &s.code;LoaderCheckUnresolved()&e.code; will report a failure. The - function takes one or more &s.code;NULL&e.code; terminated lists of - symbols. The end of the argument list is indicated by a + &s.code;LoaderCheckUnresolved()&e.code; will report a failure. + The function takes one or more &s.code;NULL&e.code; terminated + lists of symbols. The end of the argument list is indicated by a &s.code;NULL&e.code; argument. </quote> @@ -4668,6 +4675,9 @@ with the loader. When &s.code;LoaderCheckUnresolved()&e.code; is run it won't generate warnings for symbols registered in this way unless they were also registered as required symbols. + The function takes one or more &s.code;NULL&e.code; terminated + lists of symbols. The end of the argument list is indicated by a + &s.code;NULL&e.code; argument. </quote> @@ -4846,6 +4856,9 @@ <quote>Informational message.</quote> &s.code;X_NONE&e.code; <quote>No prefix.</quote> + &s.code;X_NOT_IMPLEMENTED&e.code; + <quote>The message relates to functionality that is not yet + implemented.</quote> </quote> @@ -4871,10 +4884,11 @@ NOTE: This function can only be used after the &s.code;ScrnInfoRec&e.code; and its &s.code;name&e.code; field - have been allocated. That means that it can not be used before - the END of the &s.code;ChipProbe()&e.code; function. Prior to - that, use &s.code;xf86Msg()&e.code;, providing the driver's name - explicitly. No screen number can be supplied at that point. + have been allocated. Normally, this means that it can not be + used before the END of the &s.code;ChipProbe()&e.code; function. + Prior to that, use &s.code;xf86Msg()&e.code;, providing the + driver's name explicitly. No screen number can be supplied at + that point. </quote> @@ -5177,7 +5191,7 @@ </quote> &s.code;linePitches&e.code; <quote><p> - List of supported line pitches supported by the driver. + List of line pitches supported by the driver. This is optional and should be &s.code;NULL&e.code; when not used. @@ -5444,7 +5458,7 @@ to be programmed in the chip when it has a programmable clock, or the clock that will be picked from the clocks list when it is not a programmable one. Thus: - + &s.code;mode->SynthClock = &f.indent;(mode->Clock * ClockMulFactor) / ClockDivFactor&e.code; @@ -5480,9 +5494,10 @@ &s.code;void xf86PrintModes(ScrnInfoPtr scrp)&e.code; <quote><p> This function prints out the virtual size setting, and the line - pitch being used. It also prints out one line for each mode being - used, including its pixel clock, horizontal sync rate, refresh - rate, and whether it is interlaced or multiscan. + pitch being used. It also prints out two lines for each mode being + used. The first line includes the mode's pixel clock, horizontal sync + rate, refresh rate, and whether it is interlaced, doublescanned and/or + multi-scanned. The second line is the mode's Modeline. This function is normally called after calling &s.code;xf86SetCrtcForModes()&e.code;. @@ -5674,9 +5689,9 @@ <quote><p> &s.code;Bool xf86IsUnblank(int mode)&e.code; <quote><p> - Returns &s.code;FALSE&e.code; when the screen saver mode specified + Returns &s.code;TRUE&e.code; when the screen saver mode specified by &s.code;mode&e.code; requires the screen be unblanked, - and &s.code;TRUE&e.code; otherwise. The screen saver modes that + and &s.code;FALSE&e.code; otherwise. The screen saver modes that require blanking are &s.code;SCREEN_SAVER_ON&e.code; and &s.code;SCREEN_SAVER_CYCLE&e.code;, and the screen saver modes that require unblanking are &s.code;SCREEN_SAVER_OFF&e.code; and @@ -5764,7 +5779,7 @@ #define VGA_NUM_GFX 9 #define VGA_NUM_ATTR 21 </verb></quote> - + </quote> &s.code;Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)&e.code; @@ -5861,22 +5876,12 @@ This function unlocks the VGA &s.code;CRTC[0-7]&e.code; registers, and must be called before attempting to write to those registers. - A macro &s.code;VGAHW_UNLOCK(base)&e.code; is also available in - &s.code;vgaHW.h&e.code; that does the same thing, and this may be - used when the vgahw module is not loaded (for example, in the - &s.code;ChipProbe()&e.code; function). - </quote> &s.code;void vgaHWLock(vgaHWPtr hwp)&e.code; <quote><p> This function locks the VGA &s.code;CRTC[0-7]&e.code; registers. - A macro &s.code;VGAHW_LOCK(base)&e.code; is also available in - &s.code;vgaHW.h&e.code; that does the same thing, and this may be - used when the vgahw module is not loaded (for example, in the - &s.code;ChipProbe()&e.code; function). - </quote> &s.code;void vgaHWEnable(vgaHWPtr hwp)&e.code; @@ -5919,14 +5924,14 @@ below in the order &s.code;vgaHWSaveColormap()&e.code;, &s.code;vgaHWSaveMode()&e.code;, &s.code;vgaHWSaveFonts()&e.code; to carry out the different save phases. It is undecided at this - stage whether they will be part of the vgahw module's public + stage whether they will remain part of the vgahw module's public interface or not. </quote> &s.code;void vgaHWSaveMode(ScrnInfoPtr pScrn, vgaRegPtr save)&e.code; <quote><p> - This functions saves the VGA mode registers. They are saved to + This function saves the VGA mode registers. They are saved to the &s.code;vgaRegRec&e.code; pointed to by &s.code;save&e.code;. The registers saved are: @@ -5938,11 +5943,14 @@ Sequencer[0-4]&e.code; </quote> + The number of registers actually saved may be modified by a prior call + to &s.code;vgaHWSetRegCounts()&e.code;. + </quote> &s.code;void vgaHWSaveFonts(ScrnInfoPtr pScrn, vgaRegPtr save)&e.code; <quote><p> - This functions saves the text mode font and text data held in the + This function saves the text mode font and text data held in the video memory. If called while in a graphics mode, no save is done. The VGA memory window must be mapped with &s.code;vgaHWMapMem()&e.code; before to calling this function. @@ -5979,13 +5987,13 @@ &s.code;vgaHWRestoreMode()&e.code;, &s.code;vgaHWRestoreColormap()&e.code; to carry out the different restore phases. It is undecided at this stage whether they will - be part of the vgahw module's public interface or not. + remain part of the vgahw module's public interface or not. </quote> &s.code;void vgaHWRestoreMode(ScrnInfoPtr pScrn, vgaRegPtr restore)&e.code; <quote><p> - This functions restores the VGA mode registers. They are restore + This function restores the VGA mode registers. They are restored from the data in the &s.code;vgaRegRec&e.code; pointed to by &s.code;restore&e.code;. The registers restored are: @@ -5997,11 +6005,14 @@ Sequencer[0-4]&e.code; </quote> + The number of registers actually restored may be modified by a prior call + to &s.code;vgaHWSetRegCounts()&e.code;. + </quote> &s.code;void vgaHWRestoreFonts(ScrnInfoPtr pScrn, vgaRegPtr restore)&e.code; <quote><p> - This functions restores the text mode font and text data to the + This function restores the text mode font and text data to the video memory. The VGA memory window must be mapped with &s.code;vgaHWMapMem()&e.code; before to calling this function. @@ -6060,8 +6071,8 @@ &s.code;on&e.code; is &s.code;FALSE&e.code;, and unblanked when &s.code;on&e.code; is &s.code;TRUE&e.code;. This function is provided for use in cases where the &s.code;ScrnInfoRec&e.code; - can't be derived from the &s.code;ScreenRec&e.code;, like probing - for clocks. + can't be derived from the &s.code;ScreenRec&e.code; (while probing + for clocks, for example). </quote> </quote> @@ -6069,7 +6080,7 @@ <sect1>VGA Colormap Functions <p> - The vgahw modules uses the standard colormap support (see the + The vgahw module uses the standard colormap support (see the <ref id="cmap" name="Colormap Handling"> section. This is initialised with the following function: @@ -6275,7 +6286,7 @@ &s.code;"compiler.h"&e.code; </quote> Note: in drivers, this must be included after &s.code;"xf86_ansic.h"&e.code;. - + Drivers that need to access PCI vendor/device definitions need this: <quote> &s.code;"xf86PciInfo.h"&e.code; @@ -6367,8 +6378,6 @@ #define ZZZ_PATCHLEVEL <int> </code> <p> - XXX Probably want to remove one of these version. -<p> NOTE: &s.code;ZZZ_DRIVER_NAME&e.code; should match the name of the driver module without things like the "lib" prefix, the "_drv" suffix or filename extensions. @@ -6545,10 +6554,10 @@ it is zeroed, and if the allocation fails the server exits. <p> NOTE: - When allocating structures from inside the driver which are defined - on the common level it is important to initialize the structure to - zero. - Only this guarantees that the server remains source compatible to + When allocating structures from inside the driver which are defined + on the common level it is important to initialize the structure to + zero. + Only this guarantees that the server remains source compatible to future changes in common level structures. <code> @@ -6652,7 +6661,7 @@ */ /* test if PCI bus present */ if (xf86GetPciVideoInfo()) { - + numUsed = xf86MatchPciInstances(ZZZ_NAME, PCI_VENDOR_ZZZ, ZZZChipsets, ZZZPciChipsets, devSections, numDevSections, drv, &usedChips); @@ -6660,7 +6669,7 @@ for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; if ((pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i], - ZZZPciChipsets, NULL, NULL, + ZZZPciChipsets, NULL, NULL, NULL, NULL, NULL))) { /* Allocate a ScrnInfoRec */ pScrn->driverVersion = VERSION; @@ -6692,10 +6701,10 @@ devSections, numDevSections, &usedChips); for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; - if ((pScrn = xf86ConfigIsaEntity(pScrn, flags, usedChips[i], - ZZZIsaChipsets, NULL, NULL, NULL, + if ((pScrn = xf86ConfigIsaEntity(pScrn, flags, usedChips[i], + ZZZIsaChipsets, NULL, NULL, NULL, NULL, NULL))) { - pScrn->driverVersion = VERSION; + pScrn->driverVersion = VERSION; pScrn->driverName = ZZZ_DRIVER_NAME; pScrn->name = ZZZ_NAME; pScrn->Probe = ZZZProbe; @@ -7350,7 +7359,7 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; if (pScrn->vtSema) { - ZZZRestore(pScrn); + ZZZRestore(pScrn); ZZZUnmapMem(pScrn); } pScrn->vtSema = FALSE; @@ -7366,11 +7375,6 @@ blanking function). When using the vgahw module, this will typically be: -This function is mandatory. Before modifying any hardware register directly -this function needs to make sure that the Xserver is active by checking -if <code>pScrn</code> is non-NULL and for <code>pScrn->vtSema == TRUE</code>. - - <code> static Bool ZZZSaveScreen(ScreenPtr pScreen, int mode) @@ -7378,6 +7382,11 @@ return vgaHWSaveScreen(pScreen, mode); } </code> + + This function is mandatory. Before modifying any hardware register + directly this function needs to make sure that the Xserver is active + by checking if &s.code;pScrn&e.code; is non-NULL and for + &s.code;pScrn->vtSema == TRUE&e.code;. <sect2>FreeScreen <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.27 xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.29 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.27 Mon Jan 7 17:05:57 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml Sun Feb 16 22:57:29 2003 @@ -13,7 +13,7 @@ <date>15 June 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.27 2002/01/07 22:05:57 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.29 2003/02/17 03:57:29 dawes Exp $ </ident> <toc> @@ -50,7 +50,7 @@ <sect>Introduction <p> - With XFree86 4.0 and the Direct Rendering Interface + With XFree86 4.x and the Direct Rendering Interface (DRI), hardware accelerated 3D graphics can be considered a standard feature on Linux workstations. Support for other operating systems, such as FreeBSD, is underway. @@ -62,9 +62,9 @@ software downloads. <p> This document does not cover compilation or installation of - XFree86 4.0. + XFree86 4.x. It is assumed that you've already installed a Linux distribution which - includes XFree86 4.0 or that you're an experienced Linux developer + includes XFree86 4.x or that you're an experienced Linux developer who has compiled the DRI for himself. DRI download, compilation and installation instructions can be found at <htmlurl url="http://dri.sourceforge.net/doc/DRIcompile.html" @@ -100,7 +100,7 @@ <sect1> Graphics Hardware <p> - XFree86 4.0 (or later versions) includes 3D acceleration for the + XFree86 4.2 (or later versions) includes 3D acceleration for the following graphics hardware: <itemize> @@ -123,11 +123,13 @@ <item>Matrox G200 <item>Matrox G400 </itemize> - <item>Intel i810 (motherboard chipset) + <item>Intel i810/i815/i830 (motherboard chipsets) <itemize> <item>i810 <item>i810-dc100 <item>i810e + <item>i815 + <item>i830 </itemize> <item>ATI Rage 128, supported on Intel x86, AMD and Alpha: <itemize> @@ -146,6 +148,11 @@ <item>Radeon SDR AGP <item>Radeon DDR AGP <item>Radeon 32MB SDR PCI (Alpha-based systems) + <item>Radeon 7000, M6 (RV100) + <item>Radeon 7200 (R100) + <item>Radeon 7500, M7 (RV200) + <item>Radeon 8500, 9100 (R200) + <item>Radeon 9000, M9 (RV250) </itemize> <item>3Dlabs, supported on Intel x86 and AMD: <itemize> @@ -308,7 +315,7 @@ <sect1>libGL.so <p> Your OpenGL program must link with the libGL.so.1.2 library provided - by XFree86 4.0. + by XFree86. The libGL.so.1.2 library contains a GLX protocol encoder for indirect/remote rendering and DRI code for accessing hardware drivers. Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.16 xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.19 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.16 Mon Jan 7 17:05:57 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml Mon Nov 25 20:05:50 2002 @@ -13,7 +13,7 @@ <date>21 April 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.16 2002/01/07 22:05:57 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 2002/11/26 01:05:50 dawes Exp $ </ident> <toc> @@ -52,74 +52,61 @@ <sect>Introduction <p> This document describes how to download, compile and install the - DRI project. + DRI. The DRI provides 3D graphics hardware acceleration for the XFree86 project. This information is intended for experienced Linux developers. Beginners are probably better off installing precompiled packages. <p> Edits, corrections and updates to this document may be mailed - to <email>brian@tungstengrahpics.com</email>. - + to <email>brian@tungstengraphics.com</email>. + <p> + Last updated on 13 February 2002 by Brian Paul. <sect>Prerequisites <p> You'll need the following: <itemize> + <item>An installation of XFree86 4.1 or later. + The DRI tree has been pruned down to minimize its size. + But in order to build the DRI tree you need to have recent X + header files, etc. already installed. + If you don't have XFree86 4.1 (or later) installed you can + probably install it from RPMs (or another package format). + Or, you can download XFree86 as sources and compile/install + it yourself. <item>At least 200MB of free disk space. If you compile for debugging (the -g option) then you'll need about 600MB. <item>GCC compiler and related tools. - <item>ssh (secure shell) for registered developer downloading of the - DRI source tree - <item>A recent Linux Kernel. See below for details. + <item>ssh (secure shell) if you're a DRI developer and don't want + to use anonymous CVS download. + <item>A 2.4.x Linux Kernel. See below for details. <item>FreeBSD support is not currently being maintained and may not work. </itemize> <p> The DRI 3D drivers generally work on systems with Intel or AMD CPUs. - However, there is limited support for Alpha and PowerPC support is - underway. + However, limited support for Alpha and PowerPC support is underway. <p> - For 3dfx Voodoo3 hardware, you'll also need: - <itemize> - <item>Glide3 headers and runtime library if you want to use the - 3dfx driver. - These can be obtained from - <htmlurl url="http://linux.3dfx.com/open_source/glide_kit.htm" - name="linux.3dfx.com">. - <item>A recent Linux 2.4.x kernel. AGP support is not required. - </itemize> + For 3dfx Voodoo hardware, you'll also need the Glide3 runtime + library (libglide3-v3.so for Voodoo3 or libglide3-v5.so for + Voodoo4/5). + These can be downloaded from the DRI website. + You can compile them yourself, but it's often a painful process. <p> - For Matrox G200/G400 hardware, you'll also need: - <itemize> - <item>A recent Linux 2.4.x kernel with AGP support. - </itemize> - - <p> - For Intel i810 hardware, you'll also need: - <itemize> - <item>A recent Linux 2.4.x kernel with AGP support. - </itemize> - - <p> - For ATI Rage 128 and Radeon hardware, you'll also need: - <itemize> - <item>A recent Linux 2.4.x kernel with AGP support. - </itemize> + For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, + you'll also need AGP support in your Linux kernel, either built-in + or as a loadable module. <sect>Linux Kernel Preparation <p> - The DRI project closely tracks Linux kernel development. Since - the internal Linux data structures might change in the 2.4 Linux - kernel, it's important to use the most recent Linux kernel and - not an old, intermediate development release. - As of this writing (Jan 2001), 2.4.0 is the most recent version - of Linux which the DRI is synchronized to. + Only the Linux 2.4.x kernels are currently supported by the DRI + hardware drivers. 2.5.x kernels may work, but aren't tested. <p> Most of the DRI drivers require AGP support and using Intel Pentium III SSE optimizations also requires an up-to-date Linux @@ -222,7 +209,7 @@ <sect1>Intel Pentium III Features <p> - The Pentium III SSE (Katmai) instructions are used in + The Pentium III SSE instructions are used in optimized vertex transformation functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent kernel (such as 2.4.0-test11 @@ -265,8 +252,7 @@ <sect>Downloading the XFree86/DRI CVS Sources <p> - The DRI project is hosted by VA Linux Systems' - <htmlurl url="http://dri.sourceforge.net/" + The DRI project is hosted by <htmlurl url="http://dri.sourceforge.net/" name="SourceForge">. The DRI source code, which is a subset of the XFree86 source tree, is kept in a CVS repository there. @@ -404,7 +390,6 @@ #define LinuxDistribution LinuxRedHat #define DefaultCCOptions -ansi GccWarningOptions -pipe #define BuildXF86DRI YES - #define HasGlide3 YES /* Optionally turn these on for debugging */ /* #define GlxBuiltInTdfx YES */ /* #define GlxBuiltInMga YES */ @@ -415,28 +400,27 @@ </verb> The <tt>ProjectRoot</tt> variable specifies where the XFree86 files will be installed. - You probably don't want to use <tt>/usr/X11R6/</tt> because that - would overwrite your default X files. - The following is recommended: + We recommend installing the DRI files over your existing XFree86 + installation - it's generally safe to do and less error-prone. + This policy is different than what we used to recommend. + <p> + If XFree86 4.x is not installed in /usr/X11R6/ you'll have to + add the following to the <tt>host.def</tt> file: <verb> - #define ProjectRoot /usr/X11R6-DRI + #define ProjectRoot pathToYourXFree86installation </verb> <p> - Especially note the <em>XF86CardDrivers</em> line to be sure your + Note the <em>XF86CardDrivers</em> line to be sure your card's driver is listed. <p> - If you have 3dfx hardware be sure that the Glide 3x headers are - installed in <tt>/usr/include/glide3/</tt> and that the Glide 3x - library is installed at <tt>/usr/lib/libglide3.so</tt>. - <p> - If you do not have 3dfx hardware comment out the <tt>HasGlide3</tt> - line in <tt>host.def</tt>. - <p> If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you should add the following: <verb> #define MesaUse3DNow YES </verb> + You don't have to be using an AMD processor in order to enable + this option. The DRI will look for 3DNow! support and runtime + and only enable it if applicable. <p> If you want to enable SSE optimizations in Mesa and the DRI drivers, you <bf>must</bf> upgrade to a Linux 2.4.x kernel. @@ -448,7 +432,7 @@ <bf>will not compile</bf>. You have been warned. If you do have a 2.4.x kernel, you should add the following: <verb> - #define MesaUseKatmai YES + #define MesaUseSSE YES </verb> <p> @@ -457,13 +441,13 @@ To compile the complete DRI tree: <verb> cd ~/DRI-CVS/build/xc/ - make World >& World.LOG + make World >& world.log </verb> Or if you want to watch the compilation progress: <verb> cd ~/DRI-CVS/build/xc/ - make World >& World.LOG & - tail -f World.LOG + make World >& world.log & + tail -f world.log </verb> With the default compilation flags it's normal to get a lot of warnings during compilation. @@ -477,7 +461,7 @@ <sect1>Check for compilation errors <p> - Using your text editor, examine <tt>World.LOG</tt> for errors + Using your text editor, examine <tt>world.log</tt> for errors by searching for the pattern <tt>***</tt>. <p> Verify that the DRI kernel module(s) for your system were built: @@ -514,7 +498,7 @@ <sect1>DRI kernel module installation <p> - The DRI kernel modules are in + The DRI kernel modules will be in <tt>~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/</tt>. <p> To load the appropriate DRM module in your running kernel you can @@ -531,95 +515,42 @@ <sect>Normal Installation and Configuration <p> - Most users will want to install the new X server and use it instead - of the original X server. + Most users will want to install the new X server and use it in place + of their old X server. This section explains how to do that. - We assume that the user is upgrading from XFree86 3.3.x. <p> Developers, on the other hand, may just want to test the X server without actually installing it as their default server. If you want to do that, skip to the next section. <p> - <sect1>X Installation <p> + <sect1>Installation <p> - You'll need to run as root to do the following commands: + Here are the installation commands: <verb> su - </verb> - As mentioned above, the installation directory is specified by the - <tt>ProjectRoot</tt> variable in the <tt>host.def</tt> file. - Create that directory now if it doesn't already exist, then - run the install commands: - <verb> - mkdir /usr/X11R6-DRI cd ~/DRI-CVS/build/xc make install </verb> - - <sect1>Linker configuration <p> - - Edit your <tt>/etc/ld.so.conf</tt> file and put - <tt>/usr/X11R6-DRI/lib</tt> as the first line. - Then run: - <verb> - ldconfig - </verb> - This will ensure that you use the new X libraries when you run - X programs. - <p> - - <sect1>Update Locale Information <p> - - To update your X locale information do the following: - <verb> - cd ~/DRI-CVS/build/xc/nls - ../config/util/xmkmf -a - make - make install - </verb> - This will prevent a locale error message from being printed - when you run Xlib programs. - - <sect1>Setup Miscellaneous Files <p> - - Issue the following commands: - <verb> - cd /usr/X11R6-DRI/lib/X11 - ln -s /usr/X11R6/lib/X11/rgb.txt . - ln -s /usr/X11R6/lib/X11/fonts . - ln -s /usr/X11R6/lib/X11/app-defaults . - </verb> - - This will allow applications to use the fonts and resources - that they used in the past. - <sect1>Disable the Old X Server and Enable the New One <p> + <sect1>Update the XF86Config File <p> - Assuming that an installation of XFree86 3.3.x is present, we need - to disable the old 3.3.x X server and enable the new 4.0.x X server. - <p> - Issue the following commands: - <verb> - cd /usr/X11R6/bin - mv Xwrapper Xwrapper.old - rm X - ln -s /usr/X11R6-DRI/bin/XFree86 X - </verb> - This will cause the new X server to be used instead of the - original one. + You may need to edit your XF86Config file to enable the DRI. + The config file is usually installed as + <tt>/etc/X11/XF86Config-4</tt>. + See the DRI User Guide for details, but basically, you need + to load the "glx" and "dri" modules and add a "DRI" section. <p> - - <sect1>Create the XF86Config File <p> - - Configuration files for XFree86 3.3.x will not work with - XFree86 4.0.x. + On the DRI web site, in the resources section, you'll find example + XF86Config files for a number of graphics cards. + These configuration files also setup DRI options so it's highly + recommended that you look at these examples. <p> - The new 4.0.x server can generate a basic configuration file + The XFree86 4.x server can generate a basic configuration file itself. Simply do this: <verb> - cd /usr/X11R6-DRI/bin + cd /usr/X11R6/bin ./XFree86 -configure </verb> A file named <tt>/root/XF86Config.new</tt> will be created. @@ -629,27 +560,14 @@ <tt>VertRefresh</tt> options to the <tt>Monitor</tt> section and <tt>Modes</tt> options to the <tt>Screen</tt> section. Also, the <tt>ModulePath</tt> option in the <tt>Files</tt> - section should be set to <tt>/usr/X11R6-DRI/lib/modules</tt>. - <p> - On the DRI web site, in the resources section, you'll find example - XF86Config files for a number of graphics cards. - These configuration files also setup DRI options so it's highly - recommended that you look at these examples. - <p> - In any case, your new XF86Config file should be placed in - <tt>/etc/X11/XF86Config-4</tt>. - This configuration file will be recognized by the 4.0.x server - but not by 3.3.x servers. - You can instead name it <tt>/etc/X11/XF86Config</tt> but - that'll overwrite your old config file, which you may want to - preserve. + section should be set to <tt>/usr/X11R6/lib/modules</tt>. <p> <sect1>Start the New X Server <p> The new X server should be ready to use now. Start your X server in your usual manner. - Typically, the <tt>startx</tt> command is used: + Often times the <tt>startx</tt> command is used: <verb> startx </verb> @@ -657,7 +575,7 @@ <sect>Testing the Server Without Installing It <p> - As mentioned at the start of section 8, developers may want to + As mentioned at the start of section 9, developers may want to simply run the X server without installing it. This can save some time and allow you to keep a number of X servers available for testing. @@ -669,7 +587,8 @@ Put the <tt>XF86Config</tt> file in your <tt>~/DRI-CVS/build/xc/programs/Xserver</tt> directory. <p> - Be sure the <tt>ModulePath</tt> option is set correctly. + Be sure the <tt>ModulePath</tt> option in your XF86Config file + is set correctly. <p> <sect1>A Startup Script <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.78 xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.83 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.78 Thu Nov 15 13:12:50 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile Wed Feb 26 16:59:44 2003 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.78 2001/11/15 18:12:50 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.83 2003/02/26 21:59:44 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> @@ -20,10 +20,11 @@ SGMLDEPENDS = defs.ent MANSGMLDEPENDS = mdefs.ent INDEXLIST = README.sgml $(RELNOTES) Status.sgml LICENSE.sgml Install.sgml \ - DESIGN.sgml Versions.sgml \ + BUILD.sgml DESIGN.sgml Versions.sgml \ mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml dps.sgml \ + XKB-Config.sgml XKB-Enhancing.sgml \ Darwin.sgml isc.sgml LynxOS.sgml NetBSD.sgml OpenBSD.sgml \ - OS2Notes.sgml \ + OS2Notes.sgml SCO.sgml Solaris.sgml \ apm.sgml ati.sgml chips.sgml cyrix.sgml DECtga.sgml \ I128.sgml i740.sgml i810.sgml newport.sgml \ r128.sgml rendition.sgml s3virge.sgml SiS.sgml @@ -47,14 +48,9 @@ LinuxDocReadmeTarget(OS2) #endif LinuxDocTargetLong(OS2Notes.sgml,OS2.Notes,OS2Notes) -#ifdef OUTOFDATE LinuxDocReadmeTarget(SCO) -#endif -#ifdef NOTYET LinuxDocReadmeTarget(Solaris) -#endif #ifdef OUTOFDATE -LinuxDocReadmeTarget(SOLX86) LinuxDocReadmeTarget(SVR4) #endif @@ -135,6 +131,8 @@ LinuxDocReadmeTarget(DRI) LinuxDocReadmeTarget(DRIcomp) LinuxDocReadmeTarget(dps) +LinuxDocReadmeTarget(XKB-Config) +LinuxDocReadmeTarget(XKB-Enhancing) SGMLMANDEFS=-D__drivermansuffix__='"$(DRIVERMANSUFFIX)"' \ -D__filemansuffix__='"$(FILEMANSUFFIX)"' \ @@ -169,4 +167,8 @@ /* Update RELNOTES at top level */ UpdateFormattedDoc(RELNOTES,$(TOP)) #endif + +/* Update the README files in xc/programs/xkbcomp */ +UpdateFormattedDocLong(README.XKB-Config,$(PROGRAMSRC)/xkbcomp,README.config) +UpdateFormattedDocLong(README.XKB-Enhancing,$(PROGRAMSRC)/xkbcomp,README.enhancing) Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.13 xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.17 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.13 Wed Jan 16 15:38:44 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml Mon Feb 24 12:09:16 2003 @@ -6,10 +6,10 @@ <title>Installation Details for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>16 January 2002 +<date>24 February 2003 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.13 2002/01/16 20:38:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.17 2003/02/24 17:09:16 dawes Exp $ </ident> <abstract> @@ -26,13 +26,22 @@ as provided by The XFree86 Project. <p> -The XFree86 binaries that we provide for UNIX-like OS's (Linux, the BSDs, -Solaris, etc) are packaged in a platform-independent gzipped tar format (aka -"tarballs" identified by the <tt>.tgz</tt> suffix). Along with the -binaries we provide a customized version of the GNU tar utility called -"extract" and an installation script. We recommend that these be -used to install the binaries. +The XFree86 binaries that we provide for UNIX-like OS's (Linux, the +BSDs, Solaris, etc) are packaged in a platform-independent gzipped tar +format (aka "tarballs" identified by the <tt>.tgz</tt> suffix). Along +with the binaries we provide a customized version of the GNU tar utility +called "extract" and an installation script. We recommend that these +be used to install the binaries. (The source for this customized version +of GNU tar can be found in the XFree86 CVS repository's "utils" module, +and from our <url name="ftp site" +url="ftp://ftp.xfree86.org/pub/XFree86/misc/utils-&utilsvers;.tgz">.) +<![ %snapshot [ +<p> +Note: for snapshot releases like this one, binaries are only available for +a small number of platforms. +]]> + <sect>Downloading the XFree86 &relvers; binaries <p> @@ -43,7 +52,7 @@ Information about downloading and installing &fullrelvers; can be found in the installation document for that version, which can be found on the <url name="XFree86 web site" -url="http://www.xfree86.org/pub/XFree86/&fullrelvers/Install.html">. +url="http://www.xfree86.org/&fullrelvers/Install.html">. ]]> We provide XFree86 &relvers; <![ %updaterel [update ]]>binaries for a range @@ -129,12 +138,12 @@ Once you're run the <tt>Xinstall.sh</tt> script and found which binary <![ %updaterel; [update ]]>distribution is suitable for your system, -download the necessary files. The <![ %fullrel [twelve (12)]]><![ +download the necessary files. The <![ %fullbinaries [twelve (12)]]><![ %updaterel [four (4)]]> mandatory files for all installations are listed below. If you have not downloaded all of the files, the installer script will complain. -<![ %fullrel [ +<![ %fullbinaries [ <quote><verb> 1. Xinstall.sh The installer script 2. extract The utility for extracting tarballs @@ -167,14 +176,14 @@ version called <tt>extract.exe</tt> instead. This should fix the problem. (This is not a DOS/Windows executable.) -<![ %fullrel [ +<![ %fullbinaries [ <item>A few distributions don't have or require the <tt>Xvar.tgz</tt> tarball. If it is present in the <tt>binaries</tt> sub-directory for your platform, then it is required. ]]> <item>The Darwin/Mac OS X distribution doesn't have or require the - <![ %fullrel [<tt>Xmod.tgz</tt>]]><![ %updaterel + <![ %fullbinaries [<tt>Xmod.tgz</tt>]]><![ %updaterel [<tt>Xdrivers.tgz</tt>]]> tarball. <item>Some distributions may have additional mandatory tarballs. @@ -182,7 +191,7 @@ </itemize> -<![ %fullrel [ +<![ %fullbinaries [ The following eleven (11) tarballs are optional. You should download the ones you want to install. @@ -221,7 +230,7 @@ correctly.]]> There are a lot of steps in the manual installation process, and those steps can vary -according to the platform and hardware setup. <![ %fullrel [There is a description of +according to the platform and hardware setup. <![ %fullbinaries [There is a description of the manual installation process for the most common cases <ref id="manual-install" name="below">.]]> @@ -253,7 +262,7 @@ equivalent if it is running, before continuing. If you ignore this warning and run into problems, well, you were warned! -<![ %fullrel [If you have an existing X installation, you]]> +<![ %fullbinaries [If you have an existing X installation, you]]> <![ %updaterel [You ]]> will be warned that proceeding with this installation will overwrite it. Only those things that are @@ -274,7 +283,7 @@ way of the new installation. It will list which files/directories have been removed. If none are listed, then none were removed. -<![ %fullrel [ +<![ %fullbinaries [ The next step when installing over an existing version is to check for existing configuration files. As of XFree86 version 3.9.18, the run-time configuration files are installed by default under <tt>/etc/X11</tt> @@ -375,7 +384,7 @@ After the X server configuration is done, it may be advisable to reboot, especially if you run xdm (or equivalent) or the font server (xfs). -<![ %fullrel [ +<![ %fullbinaries [ <sect>Installing XFree86 &relvers; manually<label id="manual-install"> <p> This section contains information about manually installing the XFree86 Index: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.11 xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.12 --- xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.11 Wed Jan 16 15:38:45 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml Sun Feb 23 22:41:16 2003 @@ -5,10 +5,10 @@ <article> <title>Licenses The XFree86 Project -January 2002 +February 2003 -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.11 2002/01/16 20:38:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.12 2003/02/24 03:41:16 dawes Exp $ XFree86 License @@ -17,7 +17,7 @@ copyright/license:

-Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved. +Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), Index: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.63 xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.68 --- xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.63 Wed Jan 16 17:35:18 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml Sun Feb 16 12:21:11 2003 @@ -9,10 +9,10 @@ Marc Wandschneider, Mark Weaver, Matthieu Herrb -Last modified on: 16 January 2002 +Last modified on: 9 November 2002 -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.63 2002/01/16 22:35:18 herrb Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.68 2003/02/16 17:21:11 dawes Exp $ @@ -20,18 +20,20 @@ What and Where is XFree86?

-XFree86 is the Open Source port of X.Org's X11R6.6 release that supports -several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) -operating systems on Intel and other platforms. +XFree86 is an Open Source version of the X Window System that supports +several UNIX(R) and UNIX-like operating systems (such as Linux, the BSDs +and Solaris x86) on Intel and other platforms. This version is compatible +with X11R6.6. See the . + -Binaries for NetBSD 1.4 and later are available from: +Binaries for NetBSD 1.5 and later are available from: @@ -39,6 +41,7 @@ A list of mirror sites is provided by +]]> XFree86 also builds on other NetBSD architectures. See section @@ -145,7 +148,7 @@ which can be used as a starting point. For details about the XF86Config(5) manual page. + manual page. Once you've set up a XF86Config file, you can fine tune the video modes with the xvidtune utility. @@ -466,8 +469,18 @@ Thanks

Many thanks to all people who contributed to make XFree86 work on -*BSD, in particular, Index: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml:1.1 xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml:1.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml:1.1 Mon Jun 4 09:50:15 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml Fri Jan 3 23:20:23 2003 @@ -5,6 +5,10 @@ Holger Veit Last modified March 8th, 2000 + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml,v 1.2 2003/01/04 04:20:23 dawes Exp $ + + Preface @@ -27,11 +31,11 @@ Be aware that for OS/2, XFree86-4.0 is considered to be alpha software. If you want to join the XFree86 developer team, e.g. to add support for -certain hardware, please send a request to BOD@XFree86.org. Please -think about such a step carefully before, though, since much work is -involved. Please use the XFree86-4.0 source code as a test example how -to compile the system. The ability to manage that is a basic requirement -for becoming a developer. +certain hardware, please send a request to BOD@XFree86.org. +Please think about such a step carefully before, though, since much work +is involved. Please use the XFree86-4.0 source code as a test example +how to compile the system. The ability to manage that is a basic +requirement for becoming a developer. Tools required @@ -201,14 +205,5 @@ - -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml,v 1.1 2001/06/04 13:50:15 dawes Exp $ - - - - - -$XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ -

Index: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.24 xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.30 --- xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.24 Wed Jan 16 17:35:17 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml Tue Feb 25 14:31:01 2003 @@ -6,10 +6,10 @@ README for XFree86 &relvers; on OpenBSD <author> Matthieu Herrb -<Date>Last modified on: 16 January 2002 +<Date>Last modified on: 9 November 2002 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.24 2002/01/16 22:35:17 herrb Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.30 2003/02/25 19:31:01 dawes Exp $ </ident> <toc> @@ -18,18 +18,20 @@ <sect>What and Where is XFree86? <p> -XFree86 is the Open Source port of X.Org's X11R6.6 release that supports -several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) -operating systems on Intel and other platforms. +XFree86 is an Open Source version of the X Window System that supports +several UNIX(R) and UNIX-like operating systems (such as Linux, the BSDs +and Solaris x86) on Intel and other platforms. This version is compatible +with X11R6.6. See the <htmlurl url="COPYRIGHT.html" name="Copyright Notice">. +<![ %notsnapshot [ The sources for XFree86 &relvers; are available by anonymous ftp from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;"> -Binaries for OpenBSD/i386 3.0 and later are available from: +Binaries for OpenBSD/i386 3.2 and later are available from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/OpenBSD" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/OpenBSD"> @@ -37,6 +39,7 @@ A list of mirror sites is provided by <htmlurl name="http://www.xfree86.org/MIRRORS.shtml" url="http://www.xfree86.org/MIRRORS.shtml"> +]]> <p> @@ -56,11 +59,17 @@ See the <htmlurl url="RELNOTES.html" name="Release Notes"> for non-OS dependent new features in XFree86 &relvers;. +<sect1>New OS related features in 4.3 +<p> +<itemize> +<item>Support for some VGA cards on OpenBSD/alpha +</itemize> + <sect1>New OS dependent features in 4.2 <p> <itemize> <item>Support for OpenBSD/macppc on the ATI Rage128 based -Power Macintosh. +Power Macintoshes. <item>Support for building clients on OpenBSD/sparc64. </itemize> @@ -149,7 +158,7 @@ For details about the <tt/XF86Config/ file format, refer to the -<em>XF86Config(5)</em> manual page. +<em><htmlurl name="XF86Config(5)" url="XF86Config.5.html"></em> manual page. Once you've set up a XF86Config file, you can fine tune the video modes with the <tt>xvidtune</tt> utility. @@ -211,7 +220,6 @@ line must be in your config file in <tt>/sys/arch/i386/conf</tt>: <tscreen> - option XSERVER option APERTURE </tscreen> @@ -267,63 +275,13 @@ detects this support in your kernel, it will support the MIT-SHM extension. -To add support for system V shared memory to your kernel add the -lines: - -<tscreen><verb> - # System V-like IPC - options SYSVMSG - options SYSVSEM - options SYSVSHM -</verb></tscreen> - -to your kernel config file. - <sect> Rebuilding the XFree86 Distribution You should configure the distribution by editing <tt>xc/config/cf/host.def</tt> before compiling. To compile the sources, invoke ``<tt/make World/'' in the xc directory. -<sect1>Console drivers<label id="console-drivers"> - -<p> -XFree86 has a configuration option to select the console -drivers to use in <tt/host.def/: -<itemize> -<item> if you're using pccons only put: -<tscreen><verb> - #define XFree86ConsoleDefines -DPCCONS_SUPPORT -</verb></tscreen> -<item>if you're using pcvt only put: -<tscreen><verb> - #define XFree86ConsoleDefines -DPCVT_SUPPORT -</verb></tscreen> -</itemize> -If you don't define <bf/XFree86ConsoleDefines/ in <tt/host.def/ the -pccons and pcvt drivers will be supported by default. - -<p> -Native support for the wscons console driver found on -OpenBSD/macppc and on OpenBSD/i386 2.9 and later is built -by adding: -<tscreen><verb> - #define XFree86ConsoleDefines -DWSCONS_SUPPORT -</verb></tscreen> -to <tt>xc/config/host.def</tt> before rebuilding the server. -For the i386, you should include both pcvt and wscons support in order -to use the pcvt compatibility mode of wscons: -<tscreen><verb> - #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT -</verb></tscreen> - - -<sect1>Building on other architectures<label id="otherarch"> - -<p> -XFree86 also compiles on other OpenBSD architectures. - <p> Note that OpenBSD project now has its own source tree, based on the XFree86 source tree, with some local modifications. You may want @@ -332,8 +290,30 @@ servers. See <htmlurl url="http://www.openbsd.org/anoncvs.html" name="http://www.openbsd.org/anoncvs.html"> for details on anoncvs. -<sect2>XFree86 on OpenBSD/macppc +<label id="otherarch"> + <p> +XFree86 also compiles on other OpenBSD architectures. +<sect1>XFree86 on OpenBSD/alpha +<p> +The XFree86 server is known to work on some VGA cards in alpha +machines that support BWX I/O, with OpenBSD 3.2 and higher. +<p> +The following cards have been successfully tested for now: +<itemize> +<item>3DLabs Permedia 2 (8, 15, 16 and 24 bits depth) +<item>ATI Rage Pro (works with 'Option "NoAccel"') +<item>Cirrus Logic CL5430 (works with 'Option "NoAccel"') +<item>Cirrus Logic GD5446 (8, 16 and 24 bits depth) +<item>Matrox MGA 2064 (8, 16 and 24 bits depth) +</itemize> +<p> +Note that this version of XFree86 doesn't work on TGA cards. The +version shipped with OpenBSD 3.1 and higher includes an OS-specific +driver <em/wsfb/ that is used to support TGA cards. + +<sect1>XFree86 on OpenBSD/macppc +<p> The XFree86 server is currently known to work on the G4 Macs and new iBooks with ATI Rage 128 cards running OpenBSD 3.0 or later. Other machines are more or less untested. Earlier OpenBSD versions @@ -341,22 +321,26 @@ <p> Use xf86config to build a /etc/X11/XF86Config file before starting the server for the first time. -<p> -Tou configure the keyboard, the protocol should be specified as -<bf/wskbd/ and the device as <tt>/dev/wskbd0</tt>. -Using a wsmux device as the keyboard device doesn't work (yet). Use -<bf/macintosh/ as XkbModel. <p> For the Titanium Powerbook G4, you can try the following mode line in <tt>/etc/X11/XF86Config</tt> to match the flat panel resolution: <tscreen><verb> -Modeline "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +HSync +VSync +Modeline "1152x768" 64.995 1152 1213 1349 1472 768 771 777 806 -HSync -VSync </verb></tscreen> + +<sect1>XFree86 on OpenBSD/sparc <p> -You need to set <tt/securelevel/ to -1 in the -<tt>/etc/rc.securelevel</tt> -configuration file to run XFree86 on OpenBSD/macppc. +OpenBSD 3.2 on sparc switched to the wscons device driver and now uses +the OS specific <em/wsfb/ driver in the XFree86 server. This driver is +not included in XFree86 4.3. Please use the version shipped with +OpenBSD instead. + +<sect1>XFree86 on OpenBSD/sparc64 +<p> +This version of XFree68 only has support for X clients on +OpenBSD/sparc64. Note that the version shipped with OpenBSD also has +support for the X server on both SBus and PCI based machines. <sect>Building New X Clients @@ -372,8 +356,18 @@ <sect> Thanks <p> Many thanks to all people who contributed to make XFree86 work on -*BSD, in particular, <bf/David Dawes/, -<bf/Pace Willison/, <bf/Amancio Hasty/, <bf/Christoph Robitschko/, -<bf/Nate Williams/, <bf/Rod Grimes/, <bf/Jack Velte/ and <bf/Michael Smith/. +*BSD, in particular: +<bf/David Dawes/, +<bf/Todd Fries/, +<bf/Rod Grimes/, +<bf/Charles Hannum/, +<bf/Amancio Hasty/, +<bf/Christoph Robitschko/, +<bf/Matthias Scheler/, +<bf/Michael Smith/, +<bf/Ignatios Souvatzis/, +<bf/Jack Velte/, +<bf/Nate Williams/ and +<bf/Pace Willison/. </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.119 xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.134 --- xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.119 Wed Jan 16 14:40:48 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml Wed Feb 26 20:19:32 2003 @@ -13,17 +13,18 @@ <title>README for XFree86&tm; &relvers; <author>The XFree86 Project, Inc -<date>16 January 2002 +<date>26 February 2003 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.119 2002/01/16 19:40:48 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.134 2003/02/27 01:19:32 dawes Exp $ </ident> <abstract> -XFree86 is the Open Source port of X.Org's X11R6.6 release that supports -several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) -operating systems on Intel and other platforms. +XFree86 is an Open Source version of the X Window System that supports +many UNIX(R) and UNIX-like operating systems (such as Linux, FreeBSD, +NetBSD, OpenBSD and Solaris x86) on Intel and other platforms. This +version is compatible with X11R6.6. </abstract> @@ -36,7 +37,7 @@ XFree86 &relvers; is the &whichupdaterel; update to &fullrelvers;, the &whichfullrel; full release in the <![ %earlyrel; [new]]> -XFree86 4 series. +XFree86 4.x series. Update releases are taken from a stable/maintenance branch. They are designed to be installed on top of the full release that they are @@ -48,166 +49,123 @@ <![ %fullrel [ XFree86 &relvers; is the &whichfullrel; full release in the <![ %earlyrel; [new]]> -XFree86 4 series. +XFree86 4.x series. ]]> -<p> -XFree86 release 4 is a major re-design of the basic architectural -underpinnings of XFree86's implementation of the original X Consortium's -X Server. This re-design allows for a modular interaction between the -hardware drivers and the XFree86 core X server. With 4.x, upgrades to -the X server with new and unsupported hardware can be easily done and -installed without undergoing the previous process of rebuilding an X -server. All that is required is installing the new driver module and -updating the configuration file. - -The road to XFree86 release 4 began as an architectural concept in mid -1997, with the serious framework being implemented in code the beginning -of 1998. There were several snapshots on the road to 4.0 which are now -part of the 4.0 base release. -<![ %fullrel [The &relvers; version is an upgrade to -&prevrelvers;, which include more hardware ports, code enhancements and -bug fixes.]]> - -Release 4 also included the long-awaited integration of the DRI (Direct -Rendering Infrastructure). This upgrade into the code base gives -XFree86 the abilities of accelerated direct 3-D graphics rendering, used -widely in games and other visualization programs. - -While some driver available in the old 3.3.x release series have not -been converted over to the 4.x series, those required for most modern -video hardware are available. Please check the <htmlurl name="Driver -Status document" url="Status.html"> first to see whether your hardware -is supported before upgrading to the 4.x series. - +<![ %snapshot [ +XFree86 &relvers; is a pre-release snapshot of XFree86 &nextfullrelvers;. +<![ %relcandidate [ +This snapshot is release candidate &rcnum; for version &nextfullrelvers;. +]]> +Pre-release snapshots are provided for beta testing. You should only install +snapshots if you're comfortable dealing with possibly unstable beta-level +software. If you find problems with this snapshot, you are encouraged +to report your findings to the public XFree86 mailing list: +<email>XFree86@XFree86.org</email>. + +XFree86 &relvers; is a feature-complete snapshot of XFree86 +&nextfullrelvers;. +]]> + +<p> +XFree86 4.x is the current XFree86 release series. The first release in +this series was in early 2000. The core of XFree86 4.x is a modular +X server. +<![ %fullrel [The &relvers; version is a new release that includes +additional hardware support, functional enhancements and bug fixes.]]> <![ %haverelnotes [ Specific release enhancements can be viewed in the <htmlurl name="Release Notes" url="RELNOTES.html">. ]]> -The XFree86 version numbering system has had some changes as of the -4.0.2 release. Information about this can be found in the -<htmlurl name="Versions Document" url="Versions.html">. - -Information about binary distributions and the attendant installation -instructions can be found in the <htmlurl name="Installation Document" -url="Install.html">. +Most modern PC video hardware is supported in XFree86 &relvers;, and +most PC video hardware that isn't supported explicitly can be used with +the "vesa" driver. The <htmlurl name="Driver Status document" +url="Status.html"> has a summary of what hardware is supported in +&relvers; compared with the old 3.3.x (&legacyvers;) series. It is a +good idea to check there before upgrading if you are currently running +&legacyvers; with older hardware. + +XFree86 is produced by The XFree86 Project, Inc, which is a group of +mostly volunteer independent developers. XFree86 is a non-commercial +organisation, and would not be viable without the invaluable development +contributions of volunteers. This release is dedicated to all who have +supported and contributed to XFree86 over the last eleven years. -Copyright and Licensing information for this release and all XFree86 -releases can be found in the <htmlurl name="License Document" -url="LICENSE.html">. - <![ %snapshot [ -<sect>Redistribution of the Snapshots +<sect>Redistribution of Snapshots <p> While the XFree86 <htmlurl name="License" url="LICENSE.html"> doesn't -prohibit vendors and others redistributing binaries of this release, we -don't recommend it. We ask that if you do distribute such binaries, -you make it clear that people using then should contact you for support -and not XFree86. +prohibit vendors and others redistributing binaries of this snapshot +release, we don't recommend including them in production releases. ]]> -<sect>Joining The Team -<sect1> Development +<sect>Pointers to additional information <p> - -If you would like to work on the development of XFree86 4, either by -helping with the conversion of our older drivers to the new 4.x design, -or assisting in the addition of new drivers or platforms to the code base -then send a request to <url name="join the XFree86 development team" -url="http://www.xfree86.org:/developer.html">. This will give you direct -access to the latest XFree86 related development topics and discussions. -Include in your note, your name, email address, reason for joining (what -you will work on) and, level of expertise (coder, DRI, core, specific -driver) and area of interest. -</sect1> +The documentation for this release can be found online at the <url +name="XFree86 web site" url="http://www.xfree86.org/&relvers;/">. +Documentation for the latest release version can always be found <url +name="here" url="http://www.xfree86.org/current/">, and documentation +for the latest pre-release snapshot can be found <url name="here" +url="http://www.xfree86.org/snapshot/">. Checking those last two links +is a good way of finding out the latest versions available from XFree86. - -<sect1> Documentation -<p> -If instead your interests are on the Documentation side of the Project, -or you want to contribute and are not ready for plunging into the code, -you can join the Documentation Team (those hardy souls responsible for -the content you are reading :-). Amongst the Doc Team's activities are -converting our SGML based documentation into an XML based one and updating -and creating technical documentation used by staff and public. If this -sounds interesting then please send a request to <url name="join the -XFree86 documentation team" url="mailto:signup@xfree86.org">. -Include in your note, you name, email address, reason for joining (what -you will work on) and level of expertise and whether you are interested -in the tools or content side of the group. - -</sect1> -</sect> +Information about binary distributions and the attendant installation +instructions can be found in the <htmlurl name="Installation Document" +url="Install.html">. -<sect> The Public Mailing Lists -<sect1> Newbie -<p> -For those who are new to XFree86 and want to learn more about our -Project we recommend that you join our Newbie list, located at <url name -= "Public Mailing Lists" url = "http://www.xfree86.org/mailman/listinfo">, -where this and other discussions occur with our senior all-volunteer -staff. This is great forum to get introduced to XFree86 and ask for -help on how to set up the XServer or whether your hardware is supported, -and why not?, and make suggestions for future releases of XFree86. -This list is supported by our volunteer staff who needs to know how you -are using and interacting with XFree86 and what is wrong and could be -better. Tell them, they want to know! +Copyright and Licensing information for this release and all XFree86 +releases can be found in the <htmlurl name="License Document" +url="LICENSE.html">. -</sect1> +The XFree86 version numbering system (including historical information) +can be found in the <htmlurl name="Versions Document" url="Versions.html">. -<sect1> Announce -<p> -For those who just want to know the release schedule -this is a good list to join. +Additional information may be available at the <url +name="XFree86 web site" url="http://www.xfree86.org/">, and pointers to +other information are available at the <url name="XFree86 support page" +url="http://www.xfree86.org/support.html">. -<sect1> CVS Commit +<sect>The Public Mailing Lists +<sect1>CVS Commit <p> For those who want to see what has been committed recently to our CVS repository this is the list that will show you those updates. This list is updated dynamically every time the repository is updated after the the commit happens. -<!-- +<sect1>Devel <p> -A followup to the commit list is the soon to be public, patch archives. -This archive will be available on our web-site and will show what patches -have been submitted and will soon be committed. This is helpful for -people who are interested in a specific area and want to know what work -is happening there. When this goes public we will announce it -on our web site and our Announce mailing list, so keep watching. ---> - +This list is available for discussions about XFree86 development and +for following up well-defined bug reports. Many experienced XFree86 +developers are present on this list. -<sect1> Xpert +<sect1>XFree86 <p> -If instead you are the lone developer who is improving XFree86 on an -ad hoc basis for your particular environment (I want to get my mouse or -video card to work), and need a specific question asked then you should -go over to our Xpert list where such questions are raised and answered -by our technical development staff. Remember you do not have to be a -member to write fixes to our code base and if your changes are discrete -and self-contained the volume of developer mail may just be too noisy. +This list is available for any discussions and questions related to XFree86. +Support related questions should be sent here. Many experienced XFree86 +developers monitor this list. - -Once your work is finished (coded, debugged and documented) please send -your fix to <email>fixes@XFree86.org</email>. This will ensure that -they are included in future releases. And thanks! You make this truly -an Open group. - </sect1> </sect> +<sect>Contributing to XFree86 +<p> +If you have any new work or enhancements/bug fixes for existing work, +please submit them to <email>fixes@XFree86.org</email>. This will ensure +that they are included in future releases. For new work, it's usually +a good idea to discuss it first on the <email>devel@XFree86.org</email> +list. + <sect>How to get XFree86 &relvers; <p> <![ %snapshot; [ XFree86 &relvers; can be found at the <url name="XFree86 ftp server" url="ftp://ftp.xfree86.org/pub/XFree86/snapshots/&relvers;/">, and at -mirrors of this server. This snapshot is available primarily in source -form. Binaries for some platforms may be made available at a later -time. +mirrors of this server. This snapshot is available primarily in binary +form for several popular platforms. ]]> <![ %release; [ @@ -239,13 +197,16 @@ ]]> <![ %fullrel [ -The source for version &fullrelvers; is split into three tarballs: +The source for version &fullrelvers; is split into seven tarballs: <tt>X&fullsrcvers;src-1.tgz</tt>, <tt>X&fullsrcvers;src-2.tgz</tt>, -<tt>X&fullsrcvers;src-3.tgz</tt>. The first contains everything except the -fonts and general X11 documentation. It is sufficient for building -XFree86 if you already have a set of fonts. The second contains the -fonts and the source for the general X11 documentation. The third -contains the general X11 documentation in hardcopy format. +<tt>X&fullsrcvers;src-3.tgz</tt>, <tt>X&fullsrcvers;src-4.tgz</tt>, +<tt>X&fullsrcvers;src-5.tgz</tt>, <tt>X&fullsrcvers;src-6.tgz</tt> and +<tt>X&fullsrcvers;src-7.tgz</tt>. The first three contain everything +except the fonts and general X11 documentation. Those three are sufficient +for building XFree86 if you already have a set of fonts. The fourth +and fifth contain the fonts. The sixth contains the source for the +general X11 documentation. The seventh contains the general X11 +documentation in hardcopy format. <![ %onediff; [ A source patch relative to version &prevfullrelvers; is also available. @@ -346,14 +307,18 @@ <![ %difftar; [ <![ %removefiles; [ <tscreen><verb> -rm -f xc/extras/freetype2/builds/mac/ftlib.prj -rm -fr xc/extras/freetype2/docs/design -rm -fr xc/extras/freetype2/docs/glyphs -rm -fr xc/extras/freetype2/docs/image -rm -fr xc/extras/freetype2/docs/tutorial -rm -f xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib -rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings -rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib +rm -f xc/doc/hardcopy/Xext/mit-shm.PS.gz +rm -f xc/doc/hardcopy/saver/saver.PS.gz +rm -fr xc/fonts/scaled/Ethiopic +rm -fr xc/fonts/scaled/Meltho +rm -fr xc/programs/Xserver/hw/darwin/bundle +rm -f xc/programs/Xserver/hw/hp/input/drivers/XHPKeymaps +rm -f xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07 +rm -f xc/programs/Xserver/hw/xwin/X.ico +rm -fr xc/programs/xcursorgen/redglass +rm -fr xc/programs/xcursorgen/whiteglass +touch xc/extras/Mesa/src/Trace/tr_attrib.c +touch xc/lib/fontconfig/NEWS </verb></tscreen> ]]> <tscreen><verb> @@ -362,34 +327,42 @@ ]]> ]]> +<!-- <![ %prevrelwasupdate; [ Patches might also be available relative to &prevrelvers;. If so, the instructions for applying them are the same, except that you should start with a clean &prevrelvers; source tree. ]]> - -The contrib part of the distribution was folded into the main source -tree a while ago, so a separate contrib tarball is not required. +--> To format the XFree86 documentation use the latest version of our doctools -package available as <tt>doctools-&doctoolsvers;.tgz</tt>. +package available from the XFree86 CVS repository's "doctools" module, +and from our <url name="ftp site" +url="ftp://ftp.xfree86.org/pub/XFree86/misc/doctools-&doctoolsvers;.tgz">. ]]> <!-- fullrel --> -The XFree86 source code can also be accessed via the XFree86 CVS repository. +The XFree86 source code for this and all releases/snapshots as well as +development versions can also be accessed via the XFree86 CVS repository. Information about accessing this can be found at the <url name="CVS page" url="http://www.xfree86.org/cvs/"> on our web site. It's also possible to browse the XFree86 CVS repository at our <url name="CVSWeb server" -url="http://cvsweb.xfree86.org/">. +url="http://cvsweb.xfree86.org/">. The CVS tag for this version is +"&reltag;". +<![ %notsnapshot [ +The CVS tag for the stable branch for this release is "&relbranchtag;". +]]> +To check out the latest development version, don't specify any tag. + <sect>Reporting Bugs <p> Bugs should be reported to <email>XFree86@XFree86.org</email>. Before -reporting bugs, please check the X server log file, which can be found -at <tt>/var/log/XFree86.0.log</tt> on most platforms. If you can't -resolve the problem yourself, send the entire log file with your bug -report but not the operating system core dump. Do not edit the log -file as our developers use it to reproduce and debug your problem. +reporting bugs, please check the XFree86 server log file, which can be +found at <tt>/var/log/XFree86.0.log</tt> on most platforms. If you +can't resolve the problem yourself, send the entire log file with your +bug report but not the operating system core dump. Do not edit the +log file as our developers use it to reproduce and debug your problem. Index: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.70 xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.81 --- xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.70 Thu Jan 17 13:14:59 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml Wed Feb 26 19:45:05 2003 @@ -6,10 +6,10 @@ <title>Release Notes for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>17 January 2002 +<date>26 February 2003 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.70 2002/01/17 18:14:59 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.81 2003/02/27 00:45:05 dawes Exp $ </ident> <abstract> @@ -21,6 +21,8 @@ <toc> +<p> + <sect>Introduction to the 4.x Release Series <p> XFree86 4.0 was the first official release of the new XFree86 4 series. @@ -32,35 +34,39 @@ The current release (&relvers;) is the latest in that series. ]]> XFree86 -4 represents a significant redesign of the XFree86 X server. -Not all of the hardware drivers from 3.3.x have been ported to 4.x yet, -but conversely, 4.x has some hardware support not present in 3.3.x. -Our <htmlurl name="Driver Status document" url="Status.html"> summarizes -how the hardware driver support compares between &legacyvers; and &relvers;. -Please check there first before downloading &relvers;. +4 represents a significant redesign of the XFree86 X server. Not all +of the hardware drivers from 3.3.x have been ported to 4.x yet, but +conversely, 4.x has support for a lot of hardware that is not supported +in 3.3.x. Our <htmlurl name="Driver Status document" url="Status.html"> +summarizes how the hardware driver support compares between &legacyvers; +and &relvers;. Please check there first before downloading &relvers;. The 4.0.1 release introduced a new graphical configuration tool, "<tt>xf86cfg</tt>", and a text mode interface was added to it for the -4.0.2 release. It is work in progress, but definitely worth trying out. -The trusty old text-based tool "<tt>xf86config</tt>" can also be used -for generating X server config files. In addition to these tools, we've -been working on a configuration tool that is built-in to the X -server. It is included in the release, and it works well for some -hardware. To try it out, just run (as root) "<tt>XFree86 -configure</tt>". +4.0.2 release. It is the preferred configuration tool provided by with +XFree86. The trusty old text-based tool "<tt>xf86config</tt>" can also +be used for generating X server config files. In addition to these +tools, the XFree86 server has some built in capabilities for generating +a base config file. This works well for most hardware, and in most +cases is the easiest way to get an initial config file. To try it out, +just run (as root): + +<tscreen><verb> +XFree86 -configure +</verb></tscreen> + Each of these configuration options will give you a reasonable starting point for a suitable configuration file. We've put some effort into documenting the &relvers; config file format, and you can find that -information in the XF86Config manual page. Check that, the driver manual -pages and the related documentation for further information. - -<!-- -Oh, another thing you might notice is that our documentation is rather -patchy. Most of what is present should be in reasonable shape, but -there are gaps. We thought it better to leave out docs that were very -out of date rather than providing inaccurate and misleading information. -We are looking for people to also help fill those gaps in <hint hint -:->. ---> +information in the <htmlurl name="XF86Config manual page" +url="XF86Config.5.html">. Check there and the driver-specific manual +pages and the related documentation for further information. References +to this driver-specific information can be found in the <ref id="drivertables" +name="tables below">. + +We have plans to make the configuration file optional in a future release. +The XFree86 server is close to being able to automatically determine +a complete base configuration for most popular hardware configurations. Before you go to download and install the binary distributions for this release, please have a quick read through the <htmlurl @@ -94,137 +100,168 @@ <p> <itemize> -<item> An s3 driver is added, which provides support for many of the - older non-ViRGE and non-Savage S3 chipsets. -<item> Some vmware driver problems are fixed, and the driver is updated - to take advantage of VMWare Workstation 3.0 features. These - include improved hardware cursor handling and support for 8 bit - emulation. -<item> Support added for Trident *BladeXP chipsets (currently not-accelerated). -<item> Xv support added for Trident TGUI series chips (not 9440 though). -<item> Support added for the older Trident chipsets again for ISA/VLBus (not tested) -<item> Support added to the glint driver for 3DLabs Permedia4, GLINT R4 and - Gamma 2 chipsets. -<item> Support added to the i810 driver for Intel i830 (tested on Linux only). -<item> Support added to the ATI radeon driver for Radeon 7500 (2D and 3D), - Radeon 8500 (2D only), and Rage128ProII. -<item> Support added for the Matrox G550 support. This included dual-head - support. -<item> Support added for NVIDIA nForce integrated graphics. -<item> The NVIDIA nv driver now has preliminary powerpc support for the - NV11 and NV20. -<item> Support added to the NVIDIA nv driver for interlaced modes on - hardware that supports this, and support for resolutions higher - than 1600x1200. -<item> Fixes for the savage driver on 64-bit platforms, XVideo support for the - SuperSavage, and other savage driver updates. -<item> The ATI r128 driver now uses the CCE DMA engine for 2D acceleration - when direct rendering is enabled, which reduces context switching - overhead and improves stability and performance for XVideo and some 2D - operations. -<item> The fbdev driver now supports rotation. -<item> Various updates to the apm, ark, chips (C&T), cirrus, i128, - neomagic, newport, s3virge, siliconmotion, sis, tdfx, tseng, vesa, - and vga drivers. +<item> ATI Radeon 9x00 2D support added, and 3D support added for the + Radeon 8500, 9000, 9100, and M9. The 3D support for the Radeon + now includes hardware TCL. + +<item> Support added to the i810 driver for Intel 845G, 852GM, 855GM + and 865G integrated graphics chipsets, including 2D, 3D (DRI) + and XVideo. Support for the 830M has been improved, and XVideo + support added. + +<item> National Semiconductor SC1x00, GX1, and GX2 chipset support added + with the "nsc" driver. + +<item> Support added for the NVIDIA nForce2 integrated graphics, GeForce 4, + and GeForce FX. + +<item> Major SiS driver updates for some of the latest chipsets. Unfortunately + the SiS 3D driver has had to be disabled because no one has yet + taken up the challenge to port it to Mesa 4.x. + +<item> The s3virge driver now has support for double scan modes on the DX + (with XVideo disabled). + +<item> Updates to the savage driver, including fixing problems with the + TwisterK, and problems with incorrect memory size detection. + +<item> 2D acceleration added for the Trident CyberBladeXP/Ai1 chipsets. +<item> Support for big endian architectures has been added to the C&T + driver. + +<item> Various updates and bug fixes have been made to most other drivers. + </itemize> <sect1>Input Driver Enhancements <p> <itemize> -<item> The mouse driver now has support for mouse wheel emulation. -<item> The mouse driver can now handle replug events on Linux for PS/2 mice. -<item> The "Min/Max X/Y Position" options in the elographics and mutouch - drivers are changed to "Min/Max X/Y" to be consistent with the other - input drivers. -<item> Linux USB keyboard access is fixed when no PS/2 controller is present. -<item> Added calcomp input driver. -<item> Added DMC input driver. -<item> Added hyperpen input driver. +<item> The mouse driver now has automatic protocol detection for PS/2 mice. + +<item> Several new input drivers have been added, including tek4957, + jamstudio (js_x), fpit, palmax, and ur98 (Linux only). </itemize> <sect1>X Server and Extension Updates <p> <itemize> -<item> Resynced with X.Org's X11R6.6. -<item> Mesa updated to the post-3.4.2 3.4 branch version as of November 2001. -<item> DRI drivers resynced with the latest from the DRI project. -<item> Various updates to the Xft library. -<item> The DEC-XTRAP extension is now available. -<item> The PEX and XIE extensions are no longer built/distributed by default. -<item> A security problem related to glyph clipping for large origins is fixed. -<item> An i810 XvMC (motion compensation) driver is now available (Linux only). -<item> A fatal bug XVideo Xineramification bug is fixed. +<item> Support for the RandR extension has been partially integrated + into the XFree86 server, providing support for resizing the root + window at run-time. + +<item> The Mesa version used for OpenGL® 1.3 and DRI + driver support has been updated to 4.0.4. + +<item> The XFree86 server's hot keys (including those for switching + modes and virtual terminals) can now be configured via XKB. + Previously they were hard coded. An X server configuration + option has been added to allow the VT switching hot keys to be + disabled. + </itemize> <sect1>Client and Library Updates <p> <itemize> -<item> FreeType2 updated to version 2.0.6. -<item> Added libGL man pages. -<item> Xload now has support for displaying the load of remote hosts. -<item> Xterm updated to patch level 165. -<item> SuperProbe is removed. -<item> Sample xtrap clients added. +<item> An Xcursor library providing support for alpha blended (ARGB) + and animated cursors. Two Xcursor themes are provided (redglass + and whiteglass), as well as the default "core" theme (the traditional + cursors). + +<item> Xterm updated to patch level 173, including the following bugfixes: + <itemize> + <item> Fix two infinite loops (special cases of mouse hilite tracking, + DECUDK parsing). + <item> Make repainting of the 256-color example work properly. + <item> Modify parser tables to improve detection of malformed + control sequences, making xterm behave more like a real + DEC terminal. + <item> Fix a problem with the blinking cursor which occasionally caused + xterm to pause until a key was pressed. + <item> Fix improper parsing of multiple items in the ttyModes resource. + + </itemize> + and the following improvements: + <itemize> + <item> Modify xterm to invoke luit. + <item> Add simple session management client capabilities. + <item> Add a modifyCursorKeys resource to control how the shift- and + similar modifiers are used to make a cursor escape sequence. + <item> Check if the printerCommand resource string is empty, + and use this to allow the user to disable printer function. + <item> Sort the options list which is displayed in help- and + syntax-messages at runtime to simplify maintenance. + </itemize> + </itemize> <sect1>I18N and Font Updates <p> <itemize> -<item> New Luxi scalable fonts (TrueType and Type 1) from Bigelow & - Holmes. - These fonts are original designs by Kris Holmes and Charles Bigelow. - See <ref id="luxi" name="below"> for further information. -<item> More locale/international keyboards supported. -<item> Modularized I18N support in Xlib is included from X11R6.6. -<item> A problem that caused bdftopcf to sometimes write corrupted fonts - is fixed. -<item> Some problem with Xlib's handling of CTEXT and multi-byte - characters are fixed. -<item> The fontenc layer is updated, and the fontenc library is now installed - and available for other applications. -<item> Improvements to the input method framework in Xlib for UTF-8 locales. -<item> A filter called ``luit'' is added, which provides locale and - ISO 2022 support to any Unicode terminal, notably xterm. - Use of luit is still experimental in this release. +<item> FreeType2 updated to version 2.1.1. + +<item> The "freetype" X server font backend has undergone a partial rewrite. + The new version is based on FreeType 2, and handles TrueType + (including OpenType/TTF), OpenType/CFF and Type 1 fonts. The old + "type1" backend is now deprecated, and is only used for CIDFonts + by default. + +<item> A new utility called "mkfontscale", which builds fonts.scale files, + has been added. + +<item> The Xft library has undergone a major restructuring, and is now + split into fontconfig (which deals with font discovery and + configuration and is independent from X), and Xft itself (which + uses fontconfig and deals with font rasterisation and rendering. + The format of the Xft font configuration files has changed in + an incompatible manner. + +<item> Support has been added to the Xft library to do rendering with the + core X11 protocol. This allows clients using this library to + render to X servers that don't have support for the RENDER extension. + +<item> There has been a significant reworking of the XKB support to allow + multi-layout configurations. Multi-layout configurations provide + a flexible way of supporting multiple language layouts and switching + between them. + </itemize> <sect1>OS Support Updates <p> <itemize> -<item> Build problems on both QNX4 and QNX6 are fixed. -<item> VT switching problems with the i810 driver on FreeBSD are worked around. -<item> Problems building modules with some enhanced versions of gcc are fixed. -<item> Lots of updates for Darwin/Mac OS X, including: +<item> Updates for Darwin/Mac OS X, including: <itemize> - <item> On Mac OS X, a new rootless mode is added to the XDarwin - X server. This allows X clients to display windows on - the Aqua desktop. - <item> Xinerama support added to XDarwin - <item> With XDarwin in full screen mode, the depth, size, and refresh - rate can now be chosen to be different from the settings - used by Aqua. - <item> GLX support added for Darwin and Mac OS X with software - rendering. - <item> Keymap setup in XDarwin is improved, particularly for - international keyboards. - <item> In addition to English and Japanese, the XDarwin user - interface is now localized in Dutch, French, German, Spanish, - and Korean. + <item> Indirect GLX acceleration added. + <item> Smaller memory footprint and faster 2-D drawing in rootless + mode. + <item> Full screen mode now uses shadowfb for much faster 2-D drawing. + <item> Native fonts can be used on MacOS X. </itemize> -<item> Lots of Cygwin support updates. -<item> Support added for OpenBSD/powerpc. -<item> Build support added for Linux on IBM S/390. -<item> Removed stale support for Amoeba and Minix. -<item> Client-side support added for sparc64 on NetBSD and OpenBSD. -<item> Support added for building the X server on Linux/m68k. -<item> Support added for building on Linux/arm32. -<item> Updates to Linux/mips support. + +<item> Various Cygwin support updates, including an experimental rootless + X server for Cygwin/XFree86. + +<item> AMD x86-64 support (primarily for Linux so far) has been added. + +<item> Support added for OpenBSD/sparc64. + +<item> Major OS/2 support updates. + +<item> Major SCO OpenServer updates. + +<item> Multi-head support has been added for 460GX-based Itanium systems, + and for ZX1-based Itanium2 systems. + +<item> Experimental support for SunOS/Solaris on UltraSPARC systems. + + </itemize> A more complete list of changes can be found in the CHANGELOG that is @@ -237,7 +274,7 @@ <p> --> -<sect>Drivers +<sect>Drivers<label id="drivertables"> <p> <sect1>Video Drivers @@ -255,7 +292,8 @@ <tabrow><tt>ati</tt><colsep>ATI<colsep><htmlurl name="README.ati" url="ati.html">, <htmlurl name="README.r128" url="r128.html">, <htmlurl - name="r128(4)" url="r128.4.html"></tabrow> + name="r128(4)" url="r128.4.html">, <htmlurl + name="radeon(4)" url="radeon.4.html"></tabrow> <tabrow><tt>chips</tt><colsep>Chips & Technologies<colsep><htmlurl name="README.chips" url="chips.html">, <htmlurl name="chips(4)" url="chips.4.html"></tabrow> @@ -273,7 +311,7 @@ name="i128(4)" url="i128.4.html"></tabrow> <tabrow><tt>i740</tt><colsep>Intel i740<colsep><htmlurl name="README.i740" url="i740.html"></tabrow> - <tabrow><tt>i810</tt><colsep>Intel i810<colsep><htmlurl + <tabrow><tt>i810</tt><colsep>Intel i8xx<colsep><htmlurl name="README.i810" url="i810.html">, <htmlurl name="i810(4)" url="i810.4.html"></tabrow> <tabrow><tt>imstt</tt><colsep>Integrated Micro Solns<colsep> </tabrow> @@ -284,6 +322,8 @@ <tabrow><tt>newport</tt> (-)<colsep>SGI Newport<colsep><htmlurl name="README.newport" url="newport.html">, <htmlurl name="newport(4)" url="newport.4.html"></tabrow> + <tabrow><tt>nsc</tt><colsep>National Semiconductor<colsep><htmlurl + name="nsc(4)" url="nsc.4.html"></tabrow> <tabrow><tt>nv</tt><colsep>NVIDIA<colsep><htmlurl name="nv(4)" url="nv.4.html"></tabrow> <tabrow><tt>rendition</tt><colsep>Rendition<colsep><htmlurl @@ -298,7 +338,8 @@ <tabrow><tt>siliconmotion</tt><colsep>Silicon Motion<colsep><htmlurl name="siliconmotion(4)" url="siliconmotion.4.html"></tabrow> <tabrow><tt>sis</tt><colsep>SiS<colsep><htmlurl - name="README.SiS" url="SiS.html"></tabrow> + name="README.SiS" url="SiS.html">, <htmlurl + name="sis(4)" url="sis.4.html"></tabrow> <tabrow><tt>sunbw2</tt> (+)<colsep>Sun bw2<colsep> </tabrow> <tabrow><tt>suncg14</tt> (+)<colsep>Sun cg14<colsep> </tabrow> <tabrow><tt>suncg3</tt> (+)<colsep>Sun cg3<colsep> </tabrow> @@ -306,7 +347,8 @@ <tabrow><tt>sunffb</tt> (+)<colsep>Sun Creator/3D, Elite 3D<colsep> </tabrow> <tabrow><tt>sunleo</tt> (+)<colsep>Sun Leo (ZX)<colsep> </tabrow> <tabrow><tt>suntcx</tt> (+)<colsep>Sun TCX<colsep> </tabrow> - <tabrow><tt>tdfx</tt><colsep>3Dfx<colsep> </tabrow> + <tabrow><tt>tdfx</tt><colsep>3Dfx<colsep><htmlurl + name="tdfx(4)" url="tdfx.4.html"></tabrow> <tabrow><tt>tga</tt><colsep>DEC TGA<colsep><htmlurl name="README.DECtga" url="DECtga.html"></tabrow> <tabrow><tt>trident</tt><colsep>Trident<colsep><htmlurl @@ -355,16 +397,29 @@ name="dmc(4)" url="dmc.4.html"></tabrow> <tabrow><tt>dynapro</tt><colsep>Dynapro<colsep> </tabrow> <tabrow><tt>elographics</tt><colsep>EloGraphics<colsep> </tabrow> + <tabrow><tt>elographics</tt><colsep>EloGraphics<colsep> </tabrow> + <tabrow><tt>fpit</tt><colsep>Fujitsu Stylistic Tablet PCs<colsep><htmlurl + name="fpit(4)" url="fpit.4.html"></tabrow> <tabrow><tt>hyperpen</tt><colsep>HyperPen<colsep> </tabrow> + <tabrow><tt>js_x</tt><colsep>JamStudio pentablet<colsep><htmlurl + name="js_x(4)" url="js_x.4.html"></tabrow> + <tabrow><tt>kbd</tt><colsep>generic keyboards (alternate)<colsep><htmlurl + name="kbd(4)" url="kbd.4.html"></tabrow> <tabrow><tt>keyboard</tt><colsep>generic keyboards<colsep><htmlurl name="keyboard(4)" url="keyboard.4.html"></tabrow> <tabrow><tt>microtouch</tt><colsep>MicroTouch<colsep> </tabrow> <tabrow><tt>mouse</tt><colsep>most mouse devices<colsep><htmlurl name="mouse(4)" url="mouse.4.html"></tabrow> <tabrow><tt>mutouch</tt><colsep>MicroTouch<colsep> </tabrow> + <tabrow><tt>palmax</tt><colsep>Palmax PD1000/PD1100<colsep><htmlurl + name="palmax(4)" url="palmax.4.html"></tabrow> <tabrow><tt>penmount</tt><colsep>PenMount<colsep> </tabrow> <tabrow><tt>spaceorb</tt><colsep>SpaceOrb<colsep> </tabrow> <tabrow><tt>summa</tt><colsep>SummaGraphics<colsep> </tabrow> + <tabrow><tt>tek4957</tt><colsep>Tektronix 4957 tablet<colsep><htmlurl + name="tek4957(4)" url="tek4957.4.html"></tabrow> + <tabrow><tt>ur98(*)</tt><colsep>Union Reality UR-F98 headtracker<colsep><htmlurl + name="ur98(4)" url="ur98.4.html"></tabrow> <tabrow><tt>void</tt><colsep>dummy device<colsep><htmlurl name="void(4)" url="void.4.html"></tabrow> <tabrow><tt>wacom</tt><colsep>Wacom tablets<colsep><htmlurl @@ -372,6 +427,8 @@ </tabular> </table> +Drivers marked with (*) are available for Linux only. + <sect>Overview of XFree86 4.x. <p> Unlike XFree86 3.3.x where there are multiple X server binaries, each @@ -534,7 +591,7 @@ The new option <tt>AllowDeactivateGrabs</tt> allows deactivating any active grab with the key sequence <tt>Ctrl+Alt+Keypad-Divide</tt> and the new option <tt>AllowClosedownGrabs</tt> allows closing the - conection to the grabbing client with the key sequence + connection to the grabbing client with the key sequence <tt>Ctrl+Alt+Keypad-Multiply</tt>. Note that these options are off by default as they allow users to remove the grab used by screen saver/locker programs. @@ -617,8 +674,9 @@ EndSection </verb></quote> -See the XF86Config man page for a more detailed explanation of the format -of the new ServerLayout section. +See the <htmlurl name="XF86Config(5)" url="XF86Config.5.html"> man page +for a more detailed explanation of the format of the new ServerLayout +section. </itemize> @@ -949,33 +1007,15 @@ The Xft library uses a configuration file, <tt>XftConfig</tt>, which contains information about which directories contain font files and also provides a sophisticated font aliasing mechanism. Documentation for that -file is included in the Xft man page. +file is included in the <htmlurl name="Xft(3)" url="Xft.3.man"> man page. </sect2> <sect2>FreeType support in Xft <p> -XFree86 &relvers; includes sources for FreeType version 2.0.1, and, by +XFree86 &relvers; includes sources for FreeType version 2.1.1, and, by default, they are built and installed automatically. -<p> - -If you prefer, you can configure XFree86 &relvers; to use an existing -Freetype2 installation by telling XFree86 not to build the internal copy and -indicating where that external version has been installed. Edit (or create) -<tt>config/cf/host.def</tt> to include: - -<itemize> - <item><tt>#define BuildFreetype2Library NO</tt> - <item><tt>#define Freetype2Dir /usr/local</tt> -</itemize> - -Note that XFree86 assumes you'll be using a release FreeType no older than -version 2.0.1. Early FreeType version 2 releases used a different header file -installation and aren't compatible with XFree86. Instructions for building and -installing FreeType can be found in the <tt>INSTALL</tt> file included with -the FreeType release. - </sect2> <sect2>Application Support For Anti-Aliased Text @@ -988,13 +1028,11 @@ <p> By default, xterm uses core fonts through the standard core API. It has -two command line options and associated resources to direct it to use +a command line option and associated resource to direct it to use Xft instead: <itemize> <item><tt>-fa</tt> family / <tt>.VT100.faceName:</tt> family. Selects the font family to use. - <item><tt>-fs</tt> pointsize / <tt>.VT100.faceSize:</tt> pointsize. - Selects the pointsize. </itemize> <p> @@ -1026,142 +1064,17 @@ <p> --> -<sect1>Xaw -<p> - -Two versions of the Xaw library are provided with XFree86 4.x. A version with -bug fixes and a few binary compatible improvements and a new version with -several new features. - -New features: - -<itemize> - - <item>A <tt>displayList</tt> resource is available to all Xaw widgets. It - basically consists of a list of drawing commands, fully described in - the <tt>Xaw(3)</tt> manual page, that enables a integration of Xaw - programs with the new window/desktop managers that allows for - configurable themes. - - <item>Some new actions were added to all Xaw widgets, to allow more - configurable control of the widgets, and to allow setting resources - at run time. - - <item>Since Xpm was integrated into XFree86, programs linked with the - new Xaw library will also link with Xpm. This allows for color - background pixmaps, and also for shaped widgets. - - <item>The text widget is the widget that will present more changes. These - include: - - <itemize> - - <item>Block cursor. - - <item>Compile time limit of 16384 undo/redo levels (that will - automatically grow if the text is not saved when this mark is - reached). - - <item>Overwrite mode. - - <item>Text killed is inserted in a kill ring list, this text is not - forgotten, pressing <tt>M-y</tt> allows traversing the kill - ring list. - - <item>International support for latin languages is available even - if the <tt>international</tt> resource is not set. Users will - need to properly set the <it>locale</it> environment to make - complete use of this feature. - - <item>A better <tt>multiply</tt> interface is provided. Pressing - <tt>C-u,<number></tt> (where number can be negative) - allows passing parameters for text actions. - - <item>Text can be formatted to have left, right, center or full - justification. - - <item>Text indentation support is also available. - - </itemize> - -</itemize> - -Bug fixes: - -<itemize> - - <item>The simple menu widget geometry management code was improved to solve - problems with menu entries not visible in the screen. - - <item>The form widget geometry code was changed to solve problems with integer - round problems in the child widgets geometry when resizing the parent - form widget. - - <item>Several bugs were fixed in the text code, while some code was rewritten - from scratch. - -</itemize> - -<p> - -<sect1>Xpm -<p> - -Version 3.4k of the Xpm (X pixmap) library is now integrated into XFree86. - <sect1>xedit <p> -Xedit have been changed to use most of the new features added to the new -version of the Xaw library, and some xedit only features were added. Emacs -users will find that several of the emacs key bindings work with the new -version of xedit. These include: - +Xedit has several new features, including: <itemize> - - <item>File name tab completion. Including a <it>Emacs dired</it> like window, - that will be shown when there are more than one match, when - <tt>C-x,d</tt> is pressed, or when a directory name is specified. - - <item>An unlimited number of files can be edited at the same time. Including - multiple views of the same or different files. - - <item>The line number of the cursor position is always visible. It can also - be customized to show the column number, the position offset and the - current size of the file. - - <item>There is an <tt>autoReplace</tt> resource, that enables automatic text - replacement at the time text is typed. This feature is useful to create - simple macros, or to correct common spelling errors. - - <item>A fully featured ispell interface is also available. This interface - is expected to provide most of the features of the terminal interface - of the ispell program, with some extra features that include: - - <itemize> - - <item>A compile time limit of 16 undo levels. - - <item>Terse mode switch. - - <item>Dictionary change. - - <item>The interface also checks for repeated words. - - </itemize> - - <item>A first tentative to add programming modes was done. Currently, there - is one mode: - <itemize> - - <item><bf>C-mode:</bf> this mode is expected to be stable, and fully - usable. - </itemize> - + <item>An embedded lisp interpreter that allows easier extension of the editor. + <item>Several new syntax highlight modes, and indentation rules for C and Lisp. + <item>Flexible search/replace interface that allows regex matches. + <item>Please refer to <tt><htmlurl name="xedit(1)" url="xedit.1.html"></tt> + for more details. </itemize> - -<p> - <!-- <sect>Fonts and Internationalisation Index: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml:3.19 xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml:3.22 --- xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml:3.19 Fri Aug 10 12:38:13 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml Mon Feb 17 13:58:07 2003 @@ -5,97 +5,99 @@ <title>Information for SCO OpenServer Users <author>J. Kean Johnston (jkj@sco.com) -<date>21 May 2001 +<date>14 February 2003 +<ident> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.22 2003/02/17 18:58:07 dawes Exp $ +</ident> <!-- Table of contents --> <toc> <!-- Begin the document --> -<sect>Binary Distribution<p> +<sect>Requirements<p> -The following files are provided in the binary distribution: -<quote> -<descrip> -<tag/README.SCO/ This file. -<tag/gunzip.Z/ The GNU <tt>uncompress</tt> utility. - -<tag/*X312Xdoc.tgz/ The XFree86 specific documentation. - -<tag/X312Mono.tgz/ The Mono server -<tag/X312VG16.tgz/ The 16 colour VGA server -<tag/X312SVGA.tgz/ The Super VGA server -<tag/X312S3.tgz/ The S3 server -<tag/X3128514.tgz/ The 8514 server -<tag/X312AGX.tgz/ The AGX server -<tag/X312Mc32.tgz/ The Mach 32 server -<tag/X312Mc64.tgz/ The Mach 64 server -<tag/X312Mc8.tgz/ The Mach 8 server -<tag/X312P9k.tgz/ The P9000 server -<tag/*X312cfg.tgz/ The local configuration files for -<tt>xdm/fs/xinit</tt>. -<tag/*X312bin.tgz/ The <tt>bin</tt> directory, contains most executables. -<tag/*X312lib.tgz/ The shared and unshared libraries. -<tag/*X312fnt1.tgz/ <tt>75dpi</tt> and <tt>misc</tt> fonts. -<tag/X312fnt2.tgz/ <tt>100dpi</tt> and <tt>Speedo</tt> fonts. -<tag/*X312inc.tgz/ The X11 include files. -<tag/X312man.tgz/ The formatted man pages. -<tag/X312lkit.tgz/ The server link kit (all drivers + PEX). -<tag/X312util.tgz/ Lots of PD utilities provided as is. -<tag/X312pex.tgz/ All files relating to PEX including libraries - and header files. The LinkKit is required to - obtain servers capable of running PEX. -</descrip></quote> - -To obtain a minimum XFree86 installation you will require the archives -marked with a `*' above, the server binary best suited to your machine -and optionally "<tt>gunzip.Z</tt>". All the files are compressed -with "<tt>gzip</tt>" except -of course "<tt>gunzip.Z</tt>" which is compressed using the -conventional <tt>compress</tt> -program.<p> - -To install the XFree86 binaries just follow these steps. -<enum> -<item>Obtain the files you require.<p> - The rest of this procedure must be done as root. If you do not run - the extraction as root the permissions on the files will not be - correct. For example, the `X' server is s-bit root and will not - function correctly if extracted as an ordinary user. <p> -<item>create a directory <tt>/usr/X11R6</tt>, permissions <tt>755</tt> - should do nicely. -<item>cd <tt>/usr/X11R6</tt> -<item>extract the archives, for example: -<verb> - gunzip < X312bin.tgz | tar xvpf - -</verb> -<item>if you have installed man pages see the later section on - setting up man pages. -<item>Look through <tt>/usr/X11R6/lib/X11/doc/INSTALL</tt>, - especially section 2 - on configuring and using XFree86. This should allow you to get - a server up and running. Before starting the server check in - the later section <ref id="sec-runxf86" name="Before Running XFree86">, - in this document, to - see if there are any system requirements you have to make for the - server to operate correctly. -</enum> - -<sect>Source Distribution<p> - -The SCO port comes as part of the standard XFree86 distribution. Consult -the XFree86 <tt>README</tt> for more information on the location of sources. - -Please note that as of XFree86 3.2, Only SCO Open Server Release 5 and -onwards are supported. If you are using a previous version of SCO UNIX -and you want to use XFree86, use the 3.1 series, or be prepared for build -failures. - -For people who want and need to look around the source, there -are now two files in ``<tt>xc/config/cf</tt>''. Firstly, ``<tt>sco.cf</tt>'' is -the old original SCO configuration file, and ``<tt>sco5.cf</tt>'', which is -the currently used configuration file. +Before you can either compile or execute a binary distribution of +XFree86, the following conditions must be met: +<itemize> + <item>Ensure that you are running Release 5.0.4 or later. This is required + because OSS646 is only supported on those platforms. There are no plans + to support XFree86 on earlier releases of OpenServer. + <item>Ensure that OSS646, the ``Execution Environment Update'' package is + installed, if appropriate. Check the release notes for that update + to see whether or not your current operating system requires this + update. This supplement will be available to the public in February + 2003. + <item>Ensure that OSS631, the "Graphics, Web and X11 Libraries" package + is installed. This ships standard with release 5.0.7 and later, and + is only required for 5.0.[456] users. This package will be updated fairly + frequently, and it us always suggested you have the latest possible + version installed. At some point in the future it may even update the + libraries in 5.0.7, so it is worth checking the release notes for this + supplement. + <item>To compile XFree86, you must use the SCO-supported version of + the GNU C Compiler. It is possible that Skunkware versions of the + compiler will work too, but this has not been tested. The ``GNU + Development System'' is available for all releases from (and including) + SCO OpenServer Release 5.0.5. It is provided with the operating system + in all versions from Release 5.0.7, although you need to run ``custom'' + to install it from the media. You can always download the latest + latest version of the GNU Development System from the <url + name="SCO Web site" url="http://www.sco.com">. + <item>If you are not using OSR 5.0.7 or later, you need to get an updated + console driver. See <url url="http://www.sco.com"> for details on + OpenServer supplements. If you can't or don't want to upgrade your + console driver, XFree86 will still compile, but you may run into + problems with some cards such as the Riva TNT and ATI Rage cards. + The problem with the console driver in 5.0.6A and earlier is that + when the X server sets graphics mode, the driver does not set a + status bit, so any text that is sent directly to <tt>/dev/console</tt>, + such as kernel warning or notice messages when you access tape drives + or NFS notices, will be sent to the console video memory. This just + happens to be slap bang in the middle of palette data for the Riva + TNT, so you get color map corruption. The updated console driver + also has an improved mechanism for allocating video memory that + XFree86 detects at compile time, and it will use it if it exists. + It is STRONGLY recommended that you get the console driver update. + +</itemize> + +<sect>Compiling XFree86<p> + +Using the GNU Development System, compiling XFree86 should be fairly +straightforward. Before attempting to compile the system though, you +should make sure that you have met all of the requirements above. +To actually start the compilation, perform the following steps: + +<itemize> + <item>Copy the unmodified <tt>xf86site.def</tt> in <tt>xc/config/cf</tt> + to <tt>host.def</tt>. Edit <tt>host.def</tt> and make any changes you + think you need. The most useful options to change are <tt>HasTcl</tt>, + <tt>HasTk</tt>, <tt>HasXdmAuth</tt> if you have the file + <tt>WrapHelp.c</tt> and <tt>GccWarningOptions</tt>. Due to the nature + of OpenServer's header files, the default options for this last setting + are a bit aggressive, and I recommend you set this option to + <tt>-Wpointer-arith</tt>. + + <item>Make sure that the official version of the GNU Development System + is first in your <tt>PATH</tt>. The official version lives in + <tt>/usr/gnu/bin</tt>, and the Skunkware version (if any) lives in + <tt>/usr/local/bin</tt>. You must ensure that <tt>/usr/gnu/bin</tt> + appears first in your <tt>PATH</tt>. + + <item>Go to the top level of the source tree and execute the command + <tt>CC=gcc make World BOOTSTRAPCFLAGS=-DSCO5 2>&1 | tee world.log</tt>. + This will do a full build, and send all of the build results to the + file <tt>world.log</tt>. + + <item>If the build succeeded, install the new server by executing the + command <tt>make install 2>&1 | tee install.log</tt> as root. + This will send the install results to the file <tt>install.log</tt>. + + <item>If you want to install the manual pages, execute the command + <tt>make install.man 2>&1 | tee -a install.log</tt> as root. +</itemize> <sect>Before Running XFree86<p><label id="sec-runxf86"> @@ -103,85 +105,13 @@ in the R5 distribution.<p> To use a Bus/Keyboard or PS2 mouse you should configure the mouse drivers -under SCO as above using '<tt>mkdev mouse</tt>'. You may then use the -<tt>OsMouse</tt> option -in your XF86Config to specify that XFree86 should use the SCO mouse drivers. -To do this, set the <tt>Protocol</tt> to "<tt>OsMouse</tt>" in the -Pointer section of your -XF86Config file. You can also use "<tt>OsMouse</tt>" for your -serial mouse, -especially if you are having trouble getting your mouse to work using the -XFree86 mouse drivers.<p> - -If you do not have the SCO TCP/IP package installed do not panic. -XFree86 will work fine without TCP/IP but you will most likely have to do -some or all of these things: -<itemize> - <item>Do not worry about errors from the X server complaining about - ``/dev/socksys''. The X server is configured to run on systems with - and without TCP/IP. This error is just pointing out that you do - not have TCP/IP and that this method of connecting to the server - has been disabled. - - <item>Do worry about errors involving ``/dev/spx'' or the ``sco'' - connection - type. This means something is wrong with the streams pipes that - are used for connections on the local machine. First be sure that - your server has the ``s-bit'' set. You can do this by running this - command for the X server you are using: - - ls -al /usr/X11R6/bin/XF86_XXXXXX - - The output should contain the `s' character instead of the `x' - character. For example: - <quote><verb> --rwsr-xr-x 1 root bin 1074060 Jul 24 11:54 XF86_S3 - </verb></quote> - is correct while: - <quote><verb> --rwxr-xr-x 1 root bin 1074060 Jul 24 11:54 XF86_S3 - </verb></quote> - is not. - - <item>you may have to install streams into the kernel with - ``mkdev streams'' - Check the SCO Manuals for more information on this. - - <item>you may have to configure some devices in /dev, check in the - "Trouble Shooting" section of this document for the entry which - comments on ``/dev/spx'' and ``Xsco''. - - <item>Your streams resources may be configured too low. You should check - your streams parameters against the following values, if the are - higher then you do not need to changes them. To check these - values, login as root, change directory to ``/etc/conf/cf.d'' and - then run ``./configure''. - - Once you are running configure, choose the ``Streams Data'' option - and step through the entries. Just press <ENTER> at each prompt - unless you want to change a value. The values to look for, and - their minimum values, are: - - <quote><verb> - NSTREAM 128 - NQUEUE 512 - NBLK4096 4 - NBLK2048 32 - NBLK1024 32 - NBLK512 32 - NBLK256 64 - NBLK128 256 - NBLK64 256 - NBLK16 256 - NBLK4 128 - NUMSP 128 - </verb></quote> - - You will not normally need to change any of these, if however you - do have to change some, configure will confirm that you want to - save the changes before exiting, and will give you further - instructions on rebuilding the unix kernel. -</itemize> +using '<tt>mkdev mouse</tt>'. You may then use the +<tt>OsMouse</tt> option in your <tt>XF86Config</tt> to specify that XFree86 +should use the SCO mouse drivers. To do this, set the <tt>Protocol</tt> to +"<tt>OsMouse</tt>" in the <tt>Pointer</tt> section of your +<tt>XF86Config</tt> file. You can also use "<tt>OsMouse</tt>" for your +serial mouse, especially if you are having trouble getting your mouse to +work using the XFree86 mouse drivers.<p> <sect>Switching Consoles<p> @@ -192,18 +122,24 @@ key between <tt>F1</tt> and <tt>F12</tt> will switch you to the console number assigned to that function key. <tt>F1</tt> corresponds to <tt>tty01</tt> (or console 1), <tt>F2</tt> corresponds to <tt>tty02</tt> -(or console 2) etc. Those interested in modifying the console switching -should look in <tt>xc/programs/Xserver/hw/xfree86/common/xf86Events.c</tt>. +(or console 2) etc.<p> + +Unlike the SCO X server, the "kill me now" key is <tt>Alt+Ctrl+Backspace</tt>. +This does not ask for confirmation, it simply kills the X server as +immediately as possible. Use with extreme caution. This may cause +applications to terminate in an unpredictable way. You can set the +<tt>DontZap</tt> option in the <tt>ServerFlags</tt> section of your +<tt>XF86Config</tt> file to disable this. <sect>Setting up Man Pages<p> After compiling the tree, or after installing the binary distribution you -can get man to recognise the XFree86 man pages by adding +can get <tt>man</tt> to recognise the XFree86 man pages by adding <tt>/usr/X11R6/man</tt> to -the <tt>MANPATH</tt> in <tt>/etc/default/man</tt>, the line should +the <tt>MANPATH</tt> in <tt>/etc/default/man</tt>. The line should look similar to: <tscreen><verb> - MANPATH=/usr/man:/usr/X11R6/man + MANPATH=/usr/man:/usr/gnu/man:/usr/X11R6/man:/usr/local/man </verb></tscreen> This allows all users to view the X man pages. You may change your own <tt>MANPATH</tt> environment variable if you do not want everyone to access the @@ -211,325 +147,19 @@ By default the man pages are compressed using ``<tt>compress</tt>'' to conserve space. If you do not want to compress the man pages change -<tt>CompressManPages</tt> to <tt>NO</tt> in your ``<tt>xf86site.def</tt>'' +<tt>CompressManPages</tt> to <tt>NO</tt> in your ``<tt>host.def</tt>'' file. Those using the binary distribution can use ``<tt>uncompress</tt>'' -to uncompress the man pages. +to uncompress the man pages. Binary distributions contain pre-formatted +versions of all man pages. If you are compiling the server yourself, you +need to have the GNU Tools package installed to get groff, the GNU +nroff replacement, to format the man pages. Use the <tt>manroff</tt> +script to format the manual pages yourself. <sect>Using SCO binaries/servers.<p> XFree86 will accept connections from SCO binaries (R3 upwards) and the SCO R5 server will also accept connections from XFree86 binaries. This means you may mix and match the two if you have ODT. For example you may -still use the Motif window manager (mwm) if you prefer. - -<sect>Compiling XFree86 under Open Server 5<p> - -As of GCC version 2.8.0, Open Server is supported. Configure it by -using the following: -<tscreen><verb> - ./configure i486-sco3.2v5.0 -</verb></tscreen><p> - -There is no reason to modify gcc in any way. It compiles cleanly on -Open Server 5.<p> - -SCO Open Server 5.0 is recognised automatically by XFree86. You do not -need to specify any <tt>BOOTSTRAPCFLAGS</tt> parameters when doing a -<tt>make World</tt>. You can ignore the warning message about -<tt>BOOTSTRAPCFLAGS</tt> at the very beginning of a <tt>make World</tt>. - -<enum> -<item>Fine tune ``<tt>site.def/xf86site.def</tt>''<p> -Use GCC if you can. XFree86 should compile with the DevSys cc, but GCC has -better optimizations, and is guaranteed to work. - -<item>SCO Open Server comes with Visual -TCL, which is an old (and incompatible) version of TCL. If you want to -use XF86Setup you will have to compile Tcl and Tk yourself. Both are -supported well on SCO Open Server 5. Tcl 7.6 and Tk 4.2 are available -from <tt>ftp://ftp.smli.com/pub/tcl</tt>. - -<item>You may want to disable dynamic loading support. Several users have -reported trouble with this. XIE and PEX5 definitely do not work. If -you want to experiment, try enabling this. Please report successes or -failures to me. - -<item>Do <bf>not</bf> enable the <tt>HasSVR3mmapDrv</tt> as you may have done -in older versions of SCO. Open Server 5 has full mmap() support, and -this is used for direct frame buffer access. - -<item>If you know you will not ever be using COFF binaries, and you are -short of space, set <tt>ForceNormalLib</tt> to <tt>NO</tt>. Doing this -will cause only the ELF versions of the libraries to be built. -``<tt>sco5.cf</tt>'' sets this to <tt>YES</tt> by default, so you must -explicitly set it to <tt>NO</tt> in ``<tt>xf86site.def</tt>''. -All binaries are compiled in ELF mode to reduce space. - -</enum> - -<sect>Relevant Documentation<p> - -Some relevant documentation for SCO Users and Developers can be found in -the following files. -<descrip> -<tag/README/ -the standard XFree86 <tt>README</tt> (<tt>/usr/X11R6/lib/X11/doc</tt>) -<tag/README.SVR3/ Although a lot of this readme is based on Interactive - a substantial proportion is still relevant. -<tag>All of the VGA/Config documentation.</tag> - <tt>/usr/X11R6/lib/X11/doc/VideoModes.doc</tt> and the <tt>README</tt> - files for particular video cards. -</descrip> - -<sect>Known Problems<p> -<itemize> -<item>After running the server you may see some strange characters in your -input to the shell. This is due to some unprocessed scancodes and is -of no concern. This will be fixed in a future release.<p> -<item>Not all of the applications in <tt>/usr/X11R6/bin</tt> have -been debugged.<p> -</itemize> - -<sect>Trouble Shooting<p> -<descrip> -<tag/Problem:/ -<quote> - The server does not start up, and I cannot tell what is going - wrong as it did not print any error messages. -</quote> -<tag/Causes:/ -<quote> - There can be any number of causes why the server doesn't start. - The first step is to find out what the server has to say. To do - this we have to catch the error output of the server into a file. - This output contains a log of what the server is finding/doing as - it starts up. To get this output run: - <verb> - startx 2> /tmp/errs - </verb> - The output of the server will now be in "/tmp/errs". You should - look through this output for possible problems, and then check - here in this document for any references to the problems you are - seeing. -</quote> -<tag/Problem:/ -<quote> - The server starts up, the screen goes blank, and I never see - anything else. It appears that my machine has hung. -</quote> -<tag/Causes:/ -<quote> - Again this can have many causes. Most likely your XF86Config is - wrong. You should be able to kill the server by typing - Ctrl-Alt-BackSpace, if it is still running. If this does not - restore your display then you may have to drive your system blind. - Always keep another login running at the shell prompt so that you - may switch to that screen and run commands even if you cannot see - anything on the screen. Try these things, usually in the order - given: - <itemize> - <item>log out of the login where you started ``X'' and then - change consoles. This will cause the SCO screen - switching code to try to reset the card. - <item>run ``vidi v80x25'', this command will also try to set - your card into a viewable mode. - <item>shutdown the machine cleanly with ``shutdown'' and try - again. - </itemize> - When first trying to get XFree86 to run, be sure to use a simple - setup. Get 640x480 working first then move on to higher - resolutions. Always trap the output of the server as shown earlier. - Once you have the valid clocks for your video card (as provided - in the server output), hard code them into your XF86Config as - this will take some strain off your monitor during XFree86 - startup where it usually probes the various clock frequencies. - Getting the ``X'' screen to appear can be a painfully slow task. - Be patient and read as much of the doco as you can handle. You - will get it to work. -</quote> -<tag/Problem:/ -<quote> -<verb> - Fatal server error: - xf86MapVidMem:No class map defined for (XXXXX,XXXXX) -</verb> -</quote> -<tag/Causes:/ -<quote> -<enum> - <item>Your system does not have the correct - /etc/conf/pack.d/cn/class.h, You can confirm this by - editing the file and looking for the string "SVGA", if it - is not there then you should re-install this file from - the "Extended Utilities" diskettes provided with your OS. - If this is not possible then installing the "dmmap" - driver from the distribution may allow the server to - operate correctly. - -</enum> -</quote> -<tag/Problem:/ -<quote> - <tt>xf86install</tt> does not work. -</quote> -<tag/Causes:/ -<quote> - You should not be running <tt>xf86install</tt> when using the - XFree86 server - under SCO. It is used for Interactive (ISC) installations. -</quote> -<tag/Problem:/ -<quote> - The server starts but the screen is not aligned correctly or is shaky - and impossible to view. -</quote> -<tag/Causes:/ -<quote> - This is most likely due to an incorrect <tt>XF86Config</tt> setup. - Look for the - files <tt>README.Config</tt> <tt>VideoModes.doc</tt> (in - <tt>/usr/X11R6/lib/X11/doc</tt> with - the binary distribution). These files explains how to fix up your - video modes. -</quote> -<tag/Problem:/ -<enum> -<item>Can only run a limited number of xterms. -<item><tt>xterm</tt> does not work but other programs like -<tt>xclock</tt> do work. -</enum> - -<tag/Causes:/ -<quote> - Not enough or no pseudo ttys devices are present on your system. - Run "<tt>mkdev ptty</tt>" and increase the number of ptty's. -</quote> -<tag/Problem:/ -<quote> - When running curses/termcap applications in an <tt>xterm</tt> - the output gets - corrupted especially when scrolling. -</quote> -<tag/Causes:/ -<enum> -<item>You are running an original 1.3 distribution of XFree86. Update - to the latest version (3.2 or greater). -<item>You have resized the window and not ran "<tt>eval `resize`</tt>" - before using - your application. The SCO operating system does not support dynamic - resizing of xterms fully so this command must be run after resizing - an <tt>xterm</tt> in order for curses/termcap applications to operate - correctly. -</enum> -<tag/Problem:/ -<enum> -<item>When starting X it dies with an error "Cannot access a needed shared - library". -<item>When starting an X application is dies with the above error. -</enum> -<tag/Causes:/ -<enum> -<item>You do not have the binaries installed in the correct directory. - Check that they are in <tt>/usr/X11R6</tt> -<item>You have upgraded to a new binary distribution which has a new - version of the shared libraries which are not compatible with your - old binaries. To fix this you will need to re-install the old - shared libraries or recompile your application against the new - libraries. -</enum> -<tag/Problem:/ -<quote> - When linking against the SCO motif library I get an unresolved external - for "<tt>XtDisplayStringConversionWarning</tt>" when using gcc. -</quote> -<tag/Causes:/ -<quote> - The SCO library is compiled with limited length identifiers. To work - around this add the following code to your application when compiling - under XFree86 with gcc and SCO motif. -<verb> - #ifdef SCO - void XtDisplayStringConversionWarnin(dpy, from, toType) - Display* dpy; - String from; - String toType; - { XtDisplayStringConversionWarning(dpy, from, toType); } - #endif -</verb></quote> -<tag/Problem:/ -<quote> - The server fails to run and prints out a line similar to:<p> -<tt>XFree86: Cannot open /dev/spx for ???? listener: No such file or directory -</tt></quote> -<tag/Causes:/ -<quote> - All SCO unix installations appear to have the Streams pseudo tty driver - installed, but not all the devices are present.<p> -<enum> -<item>there should be a <tt>/etc/conf/pack.d/sp</tt> directory, -<item><tt>/etc/conf/sdevice.d/sp</tt> should have a '<tt>Y</tt>' in it. -<item>You need a file in <tt>/etc/conf/node.d</tt> - which contains something like: -<verb> - clone spx c sp - sp X0S c 127 - sp X0R c 126 - sp X1S c 125 - sp X1R c 124 - sp X2S c 123 - sp X2R c 122 - sp X3S c 121 - sp X3R c 120 - sp X4S c 119 - sp X4R c 118 - sp X5S c 117 - sp X5R c 116 - sp X6S c 115 - sp X6R c 114 - sp X7S c 113 - sp X7R c 112 -</verb> -</enum> - if you don't have something like this (maybe called "Xsco") then create - one and that should fix your problem. As far as I can tell the streams - pseudo tty driver should be there.<p> - The simplest way to get the devices if you had to create this file is - to rebuild the kernel and the environment. If you don't want to do this - then: -<verb> - touch /etc/.new_unix - cd /etc/conf/bin - ./idmkenv - </verb> - and try it out. -</quote> -</descrip> -<sect>Acknowledgements<p> - -Thanks to the Core team for their previous and continuing help with the SCO -work. Many thanks to <bf/Stacey Campbell/ at SCO for all the advice and -insights provided. Thanks to SCO in general for making information available -for XFree86 development. - -Thanks also to <bf/Peter Eubert/ (<em/peter.eubert@iwb.mw.tu-muenchen.dbp.de/) -and <bf/Kent Hamilton/ (<em/kenth@stl.scscom.COM/) for -input on compiling under 3.2.4 -systems. <bf/Larry Plona/ (<em/faxi@world.std.com/) and -<bf/Didier Poirot/ (<em/dp@chorus.fr/) -for their input on xdm and 3.2.4 compilation under 3.1. And of course the -beta list for its input on everything. - -Special thanks to <bf/Jerry Whelan/ (<em/guru@stasi.bradley.edu/) -for providing an -ftp site for the binary distribution. - -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.19 2001/08/10 16:38:13 dawes Exp $ - - - - +still use the Panning Motif window manager (pmwm) if you prefer. -$XConsortium: SCO.sgml /main/11 1996/10/23 11:45:55 kaleb $ -</verb> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml:3.15 xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml:removed --- xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml:3.15 Mon Aug 23 02:38:52 1999 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml Thu Feb 27 12:30:32 2003 @@ -1,327 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> -<article> - -<!-- Title information --> - -<title>Information for Solaris for x86 Users -<author>David Holland -<date>25 Feb 1998 - -<!-- Table of contents --> -<toc> - -<!-- Begin the document --> - - -<!--Contents --------- - - 1) What is XFree86 - 2) Solaris versions on which XFree86 has been tested. - 3) The VT-switching sub-system in Solaris x86 - 4) Various notes for building XFree86 on Solaris x86 - 5) Known bugs, and work arounds. - --> - - -<sect>What is XFree86<p> - - XFree86 is a port of X11R6.3 that supports several versions of - Intel-based Unix. It is derived from X386 1.2 which was the X server - distributed with X11R5. This release consists of many new features - and - performance improvements as well as many bug fixes. The release is - available as source patches against the X Consortium code, as well as - binary distributions for many architectures. -<p> -The sources for XFree86 are available by anonymous ftp from: -<quote> - <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/current" - url="ftp://ftp.XFree86.org/pub/XFree86/current"> -</quote> -Solaris binaries for XFree86 are available for anonymous ftp from: -<quote> - <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/current/binaries/Solaris" - url="ftp://ftp.XFree86.org/pub/XFree86/current/binaries/Solaris"><p> -</quote> - -<sect> Solaris for x86, versions on which XFree86 3.3.3 has been tested<p> - -XFree86 3.3.2 has been actively tested on: -<itemize> -<item>Solaris 2.5.1 for x86 -<item>Solaris 2.6 for x86 -</itemize> - -<sect>The VT-switching sub-system in Solaris x86<p> - - The virtual terminal sub-system is a undocumented, and unsupported - feature of Solaris x86. Therefore if you use Virtual Terminals, you - do so at <bf>YOUR OWN RISK</bf>.<p> - - The virtual terminals of Solaris work basically the same way as - most other Intel based SVR4 VT sub-systems. However, there are a - number of limitations documented below.<p> - - First, if you are running a Solaris 2.4 x86 system, and you want VT's, - you will have to create the necessary devices first, so become root.<p> - - First verify the chanmux device driver's major number is 100:<p> -<tscreen><verb> - # grep -i chanmux /etc/name_to_major - chanmux 100 - # -</verb></tscreen> - If the number after 'chanmux' is anything but 100, I would suggest - you immediately abort your attempt to create virtual terminals, and - learn to live without them.<p> - - However, if it is 100, then as root type the following commands to - create the maximum allowable number of virtual terminals.<p> -<tscreen><verb> - # cd /dev - # mknod vt01 c 100 1 - # mknod vt02 c 100 2 - # mknod vt03 c 100 3 - # mknod vt04 c 100 4 - # mknod vt05 c 100 5 - # mknod vt06 c 100 6 - # mknod vt07 c 100 7 -</verb></tscreen> - There is no need for a reconfiguration boot.<p> - - Secondly, for both 2.1, and 2.4 x86 systems, add a few lines to the - <tt/inittab/ to enable logins on them.<p> - -(<bf>Note</bf>, do <bf>NOT</bf> make a mistake here, you could -lock yourself out of the system)<p> -<verb> ---------------------->Snip Snip<----------------------------------------------- -v1:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT01 login: " -T AT386 -d /dev/vt01 -l console -v2:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT02 login: " -T AT386 -d /dev/vt02 -l console -v3:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT03 login: " -T AT386 -d /dev/vt03 -l console -v4:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT04 login: " -T AT386 -d /dev/vt04 -l console ----------------------->End Here<----------------------------------------------- -</verb> - These four lines enable four VT's on Alt-SysReq-F1 through - Alt-SysReq-F4.<p> - - Then execute the command '<tt>init q</tt>' to immediately - enable the virtual - terminals.<p> - -The keys used for VT switching are as follows:<p> - -<quote> - <tt>Alt-SysReq-F1</tt> through <tt>Alt-SysReq-F7</tt> - enable VT screens 1-7 respectively - (if the VT is active).<p> - <tt>Alt-SysReq-n</tt> enables the next active VT screen.<p> - <tt>Alt-SysReq-p</tt> enables the previous active VT screen.<p> - <tt>Alt-SysReq-h</tt> returns to the console.<p> -</quote> - If you are using virtual terminals, you must leave at least one free - for use by the Xserver.<p> - - -Limitations of the virtual terminal sub-system under Solaris x86:<p> - - There are only a total of 8 available VT's (7 normal VT's + 1 console) - not the usual 15. If you have all 8 allocated, and you attempt to - allocate a additional VT you will panic the system. (This bug is - worked around in the Solaris XFree86 Xserver.)<p> - - From a programming stand point, they work pretty much as documented in - the AT&T Unix System V/386 Release 4 Integrated Software - Development - Guide, however a number of <tt>ioctl()</tt> calls are broken.<p> - - -<sect>Notes for building XFree86 on Solaris x86<p> - -<enum> -<item>The majority of all modifications you will need to make are now in - <tt>~xc/config/cf/xf86site.def</tt>. - -<!-- - except one. You will need to set OSName, - and OSMinorVersion correctly in <tt>~xc/config/cf/sun.cf</tt>. - -Under Solaris 2.1 for x86, <tt>sun.cf</tt> needs to read -(near the top of the file) - -<verb> #ifdef SVR4Architecture - #ifdef i386Architecture - #define OSName SunOS 5.1 x86 - XCOMM operating system: OSName - #define OSMajorVersion 5 - #define OSMinorVersion 1 -</verb> - -Under Solaris 2.4 for x86, <tt>sun.cf</tt> needs to read -(near the top of the file) - -<verb> #ifdef SVR4Architecture - #ifdef i386Architecture - #define OSName SunOS 5.4 x86 - XCOMM operating system: OSName - #define OSMajorVersion 5 - #define OSMinorVersion 4 -</verb> ---> - -<item>Both Gcc, and ProWorks are supported by XFree86. Gcc-2.5.8 or - gcc-2.7.2.3 are - suggested, Gcc-2.6.0 is known not to work. You also need to set - HasGcc2 correctly in <tt>~xc/config/cf/xf86site.def</tt>. - - You should also make certain your version of GCC predefines `sun'. - 2.4.5 is known NOT to by default. If needed edit - <tt>/usr/local/lib/gcc-lib/*/*/specs</tt>, and modify the - <tt>*predefines:</tt> line.<p> - - Note: A Threaded Xlib compiled with GCC has subtle problems. - It'll work 98% of the time, however clients will occasionally - exhibit strange hangs. Most notably image viewers such as - xv-3.10 exhibit this problem.<p> - - It is recommended that you set ThreadedX in - <tt>~xc/config/cf/sun.cf</tt> to NO, if you are using GCC. - ProWorks does not have this problem. - -<item> To build XFree86 with gcc you need gcc and (optionally) - c++filt from GNU binutils. Don't install gas or ld from GNU - binutils, use the one provided by Sun. - <p> - With XFree86 3.3.2, you will need to setup a /opt/SUNWspro/bin - directory containing symbolic links named <tt/cc/, <tt/CC/, and - <tt/c++filt/ pointing respectively to the actual <tt/gcc/, - <tt/g++/ and <tt/c++filt/ commands. - -<item>If you don't have c++filt or if you have troubles in making - World with c++filt, you need to set UseExportLists to NO in - <tt>~xc/config/cf/host.def</tt>.<p> - -<!-- - If you use c++filt, you need to check the definition of PATH in - <tt>~xc/config/util/elistgen.sun</tt>.<p> ---> - -<item>If you are using ProWorks to compile the XFree86 distribution, you - need to modify your PATH appropriately so the ProWorks tools are - available. Normally, they should be in <tt>/opt/SUNWspro/bin</tt><p> - - -<item>You <bf>MUST</bf> put <tt>/usr/ccs/bin</tt> - at the front of your PATH. There are known - problems with some GNU replacements for the utilities found there. So - the <tt>/usr/ccs/bin</tt> versions of these programs -must be found before any - other possible GNU versions. (Most notably GNU '<tt/ar/' does not work - during the build).<p> - -<item>If you wish to use the "memory aperture" feature of the S3, and Mach32 - servers, you need to compile, and install the Solaris x86 aperture - driver for memory mapped I/O support. This driver is <bf>REQUIRED</bf> - for the I128, P9000 and Mach 64 servers.<p> - - You need to set HasSolx86apertureDrv to YES in - <tt>~xc/config/cf/xf86site.def</tt>.<p> to enable the aperture - driver. - - Under Solaris 2.5 and later, there's a system driver - (<tt>/dev/xsvc</tt> that provides this functionality. It will - be detected automatically by the server, so you don't need to - install the driver. - - For Solaris 2.1 and 2.4, the source for this driver is included in - <tt>~xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar</tt>. - Building, and - installing the driver is relatively straight forward. Please read - its accompanying README file.<p> - - - -</enum> -<sect> Notes for running XFree86 on Solaris x86<p> - -<enum> -<item>If you have not made the Virtual Terminal devices, you will need to - specify the terminal device to run the Xserver on. The correct - device is vt00 so your <tt>xinit</tt> command would look like so:<p> -<tscreen><verb> - xinit -- vt00 -</verb></tscreen> - If you have made the virtual terminal devices you do not need to - specify the VT to run the Xserver on.<p> - - To be able to run XF86Setup, you must at least create - /dev/vt01. Otherwise XF86Setup won't start. - -<item>For Solaris you will probably want to set your LD_LIBRARY_PATH to - <tt>/usr/X11R6/lib:/usr/openwin/lib:/usr/dt/lib</tt>. - Including <tt>/usr/X11R6/lib</tt> in your - LD_LIBRARY_PATH is probably not necessary, however it doesn't hurt. :) -<p> - Including <tt>/usr/openwin/lib</tt> in the LD_LIBRARY_PATH is - recommended - because some Sun supplied binaries were not compiled with LD_RUN_PATH - set properly at compile time.<p> -<p> - Motif and CDE applications may require <tt>/usr/dt/lib</tt> in your - LD_LIBRARY_PATH too. - -<item>Xqueue is <bf>NOT</bf> supported under Solaris. - The includes necessary for - Xqueue are available, however the driver does not seem to be in the - kernel. (Go figure)<p> - - -<item>If you want to use xdm with Solaris, extract the files from the shar - file in <tt>/usr/X11R6/lib/X11/etc/XdmConf.svr4</tt> into a temporary - directory. The <tt>README</tt> file tells where - the individual files need to - be installed. Be sure to read through each file and make any - site-specific changes that you need.<p> - -</enum> - -<sect> Known bugs, and work arounds with Solaris x86<p> - -<enum> - -<item>The Solaris 2.1 for x86 OpenWindows filemgr does not work against a - X11R5 Xserver, it probably will also not work against a X11R6 -Xserver. - Attempting to 'Drag and Drop' a file causes the filemgr to abort - with a 'X error'<p> - - Solaris 2.4 does not have this problem.<p> - - There is no known work around.<p> - -<!-- -<item>It has been reported that the aperture driver doesn't work - under Solaris 2.5.1. It probably doesn't work either under - 2.5. ---> - -</enum> -<sect> Bug Notification<p> - - Bug reports need to be sent to <bf/XFree86@XFree86.org/, or posted to - the comp.windows.x.i386unix newsgroup. Questions or comments about - the Solaris support, or the Solaris distribution need to be made to - <it/davidh@use.com/, or <it/danson@lgc.com./<p> - - -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml,v 3.15 1999/08/23 06:38:52 dawes Exp $ - - - - - -$XConsortium: SOLX86.sgml /main/7 1996/10/28 05:43:28 kaleb $ -</verb> -</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml:1.2 xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml:1.4 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml:1.2 Thu Nov 15 12:22:55 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml Fri Jan 3 23:20:23 2003 @@ -6,13 +6,16 @@ <author>David Holland, modified by Marc Aurele La France <date>2001 October 01 +<ident> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml,v 1.4 2003/01/04 04:20:23 dawes Exp $ +</ident> + <!-- Table of contents --> <toc> <!-- Begin the document --> <sect>What is XFree86<p> -XFree86 is a port of X11R6.5.1 that supports several versions of Intel-based -Unix. +XFree86 is a port of X11R6.5.1 that supports several versions of Unix. It is derived from X386 1.2 which was the X server distributed with X11R5. This release consists of many new features and performance improvements as well as many bug fixes. @@ -38,7 +41,7 @@ Virtual terminals are not available in Solaris SPARC, and their availability has been removed in Solaris8 x86.<p> When available, the virtual terminals of Solaris work basically the same way as -most other Intel based SVR4 VT sub-systems. +most other SVR4 VT sub-systems. However, there are a number of limitations documented below.<p> First, if you are running a Solaris 2.4 x86 system, and you want VT's, you will have to create the necessary devices first, so become root.<p> @@ -209,10 +212,5 @@ It might even have broken some aspects of the x86 port.<p> </enum> <sect>Bug Notification<p> -Bug reports should be sent to one of the <bf/XFree86@XFree86.org/, -<bf>Xpert@XFree86.org</bf>, or <bf>Newbie@XFree86.org</bf> (depending on your -level of comfort). -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml,v 1.2 2001/11/15 17:22:55 dawes Exp $ -</verb> +Bug reports should be sent to <email>XFree86@XFree86.org</email>. </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.37 xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.43 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.37 Wed Jan 16 15:38:45 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml Tue Feb 25 11:32:41 2003 @@ -6,10 +6,10 @@ <title>Driver Status for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>16 January 2002 +<date>23 February 2003 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.37 2002/01/16 20:38:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.43 2003/02/25 16:32:41 dawes Exp $ </ident> <abstract> @@ -17,8 +17,7 @@ This document provides information about the status of the driver and hardware support in XFree86 &relvers; compared with that in XFree86 &legacyvers;. Please send updates for this document to -<email>fixes@xfree86.org</email>. Please do not send requests for -information or support to that address (they will not be answered). +<email>XFree86@XFree86.org</email>. </abstract> @@ -369,17 +368,21 @@ than 1MB of video memory. <tag>&relvers;:</tag> - Support (accelerated) for the Intel i740 is provided by the "i740" - driver, and support for the Intel i810 (including i810-dc100 and - i810e), i815, and i830 is provided by the "i810" driver. The - "i810" driver is currently supported only on Linux and FreeBSD (4.1 - and later), and requires AGP GART kernel support. + Support (accelerated) for the Intel i740 is provided by the + "i740" driver, and support for the Intel integrated graphics + chipsets i810, i810-dc100, i810e, i815, 830M, 845G, 852GM, 855GM + and 865G is provided by the "i810" driver. The i810 and i815 + chipsets require kernel-level AGP GART support (available on + Linux, FreeBSD, and some other BSDs). The 830M and later can + be used without AGP GART support, but it is required for full + functionality. <tag>Summary:</tag> The i740 and and original i810 are supported in both versions, but - the i810 is supported only on Linux/x86 and recent FreeBSD/i386 - platforms at present. Support for later versions of the i810 - chipset, such as the i815, exists only in &relvers;. + the i810/i815 is supported only on Linux, FreeBSD, and some recent + NetBSD/OpenBSD versions at present. platforms at present. + Support for later versions of the i810 chipset, such as the + i815, and for the 830M and later exists only in &relvers;. </descrip> @@ -420,6 +423,15 @@ </descrip> +<sect>National Semiconductor +<p> +<descrip> +<tag>&relvers;:</tag> + Support for the SC1x00, GX1, and GX2 is provided by the "nsc" + driver. + +</descrip> + <sect>NCR <p> <descrip> @@ -624,14 +636,15 @@ by the XF86_SVGA server with the sis driver. <tag>&relvers;:</tag> - Support (accelerated) for the SiS <!-- 86C205, 86C215, 86C225, --> - <!-- 5597, 5598, --> 530, 620, 6326 is provided by the "sis" driver. - The 630, 300, and 540 are also supported, but this code is new and - there are some problems with it in this version. + Support (accelerated) for the SiS 5597, 5598, 6326, 530, 620, + 300, 540, 630, 730, 315, 550, 650, 651 and 740 is provided by + the "sis" driver. The Xabre (SiS 330) might be supported by this + is completely untested. <tag>Summary:</tag> - Support for the 86C201, 86C202, 86C205, 86C215, 86C225, 5597 and 5598 - is currently only available in &legacyvers;. + Support for the 86C201, 86C202, 86C205, 86C215 and 86C225 is + currently only available in &legacyvers;. Support for some + newer chipsets is only available in &relvers;. </descrip> @@ -702,9 +715,7 @@ <tag>Summary:</tag> The following (older) chipsets are supported in &legacyvers; and - not in &relvers;: TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, - TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, - TGUI9400CXi, TGUI9420, and TGUI9430DGi. + not in &relvers;: TVGA8200LX, TVGA8800CS, TGUI9420, TGUI9430DGi. The TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9440AGi, TGUI9660, Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.2 xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.4 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.2 Wed Jan 16 15:38:45 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml Sun Feb 23 22:41:23 2003 @@ -7,10 +7,10 @@ <title>XFree86 Version Numbering Schemes <author>The XFree86 Project, Inc -<date>16 January 2002 +<date>23 February 2003 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.2 2002/01/16 20:38:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.4 2003/02/24 03:41:23 dawes Exp $ </ident> <abstract> @@ -31,7 +31,7 @@ is done. Second is the stable bugfix branch for the latest full release -(&relvers;). It is created around the time of the release. The branch +(&fullrelvers;). It is created around the time of the release. The branch for this one is called "<tt>&relbranchtag;</tt>". Fixes for bugs found in the release will be added to this branch (as well as the trunk), and updates to this release (if any) will be cut from this branch. Similar @@ -44,19 +44,21 @@ back-ported to this branch. XFree86 is planning to make full releases from the main development -stream approximately every six months, in late May and November of each -year. The feature freezes for these releases will be 1 April and 1 -October respectively. These are target dates, not a binding commitment. -How effectively these dates can be met will depend to a large degree on -the resource available to XFree86. Full releases consist of full source +stream at regular intervals in the 6-12 month range. The feature +freezes for these releases will usually be 2-3 months before the release +dates. This general plan is a goal, not a binding commitment. The +actual release intervals and dates will depend to a large degree on the +resource available to XFree86. Full releases consist of full source code tarballs, plus full binary distributions for a range of supported platforms. Update/bugfix releases will be made on an as-required basis, -depending also on the availability of resources. Update/bugfix releases -will not be full releases, and will consist of source code patches, plus -binary updates to be layered on top of the previous full release. +depending also on the availability of resources, and will generally be +limited to serious bug and security fixes. New features will not usually +be added in update releases. Update/bugfix releases will not be full +releases, and will consist of source code patches, plus binary updates +to be layered on top of the previous full release. -The next full release will be version &nextfullrelvers;, tentatively scheduled for late &nextfullreldate;. -There is no scheduled update release. If there is one, the version will be +The next full release will be version &nextfullrelvers;. There is no +scheduled update release, but if one is needed, the version will be &nextupdrelvers;. <!-- Index: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Config.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Config.sgml:1.2 --- /dev/null Thu Feb 27 12:30:32 2003 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Config.sgml Tue Feb 25 14:31:02 2003 @@ -0,0 +1,221 @@ +<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> + +<article> +<title>The XKB Configuration Guide +<author>Kamil Toman, Ivan U. Pascal +<date>25 November 2002 + +<ident> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Config.sgml,v 1.2 2003/02/25 19:31:02 dawes Exp $ +</ident> + +<abstract> +This document describes how to configure XFree86 XKB from a user's point +a few. It converts basic configuration syntax and gives also a few examples. +</abstract> + +<toc> + +<p> +<sect>Overview +<p> +The XKB configuration is decomposed into a number of components. Selecting +proper parts and combining them back you can achieve most of configurations +you might need. Unless you have a completely atypical keyboard you really don't +need to touch any of xkb configuration files. + +<sect>Selecting XKB Configuration +<p> +The easiest and the most natural way how to specify a keyboard mapping is +tu use <tt>rules</tt> component. As its name suggests it describes a number of general +rules how to combine all bits and pieces into a valid and useful keyboard +mapping. All you need to do is to select a suitable rules file and then to +feed it with a few parameters that will adjust the keyboard behaviour to +fulfill your needs. +<p> +The parameters are: +<itemize> +<item><tt>XkbRules </tt>- files of rules to be used for keyboard mapping +composition +<item><tt>XkbModel </tt>- name of model of your keyboard type +<item><tt>XkbLayout </tt>- layout(s) you intend to use +<item><tt>XkbVariant </tt>- variant(s) of layout you intend to use +<item><tt>XkbOptions </tt>- extra xkb configuration options +</itemize> +<p> +The proper rules file depends on your vendor. In reality, the commonest +file of rules is <tt>xfree86</tt>. For each rules file there is a description +file named <tt><vendor-rules>.lst</tt>, for instance <tt>xfree86.lst</tt> +which is located in xkb configuration subdirectory <tt>rules</tt> (for example +<tt>/etc/X11/xkb/rules</tt>). + +<sect1>Basic Configuration +<p> +Let's say you want to configure a PC style America keyboard with 104 +keys as described in <tt>xfree86.lst</tt>. It can be done by simply writing +several lines from below to you XFree86 configuration file (often +found as <tt>/etc/X11/XF86Config-4</tt> or <tt>/etc/X11/XF86Config</tt>): +<tscreen><verb> +Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "pc104" + Option "XkbLayout" "us" + Option "XKbOptions" "" +EndSection +</verb></tscreen> +The values of parameters <tt>XkbModel</tt> and <tt>XkbLayout</tt> are really +not surprising. The parameters <tt>XkbOptions</tt> has been explicitly set to +empty set of parameters. The parameter <tt>XkbVariant</tt> has been left out. +That means the default variant named <tt>basic</tt> is loaded. +<p> +Of course, this can be also done at runtime using utility setxkbmap. +Shell command loading the same keyboard mapping would look like: +<tscreen><verb> +setxkbmap -rules xfree86 -model pc104 -layout us -option "" +</verb></tscreen> +The configuration and the shell command would be very analogical +for most other layouts (internationalized mappings). + +<sect1>Advanced Configuration +<p> +Since XFree86 4.3.x you can use multi-layouts xkb configuration. +What does it mean? Basically it allows to load up to four different +keyboard layouts at a time. Each such layout would reside in its +own group. The groups (unlike complete keyboard remapping) can be +switched very fast from one to another by a combination of keys. +<p> +Let's say you want to configure your new Logitech cordless desktop +keyboard, you intend to use three different layouts at the same +time - us, czech and german (in this order), and that you are used +to <tt>Alt-Shift</tt> combination for switching among them. +<p> +Then the configuration snippet could look like this: +<tscreen><verb> +Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "logicordless" + Option "XkbLayout" "us,cz,de" + Option "XKbOptions" "grp:alt_shift_toggle" +EndSection +</verb></tscreen> +Of course, this can be also done at runtime using utility setxkbmap. +Shell command loading the same keyboard mapping would look like: +<tscreen><verb> +setxkmap -rules xfree86 -model logicordless -layout "us,cz,de" \ + -option "grp:alt_shift_toggle" +</verb></tscreen> + + +<sect1>Even More Advanced Configuration +<p> +Okay, let's say you are more demanding. You do like the example +above but you want it to change a bit. Let's imagine you want +the czech keyboard mapping to use another variant but basic. +The configuration snippet then changes into: +<tscreen><verb> +Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "logicordless" + Option "XkbLayout" "us,cz,de" + Option "XkbVariant" ",bksl," + Option "XKbOptions" "grp:alt_shift_toggle" +EndSection +</verb></tscreen> +That's seems tricky but it is not. The logic for settings of variants +is the same as for layouts, that means the first and the third variant +settings are left out (set to <tt>basic</tt>), the second is set to +<tt>bksl</tt> (a special variant with an enhanced definition of the backslash +key). +<p> +Analogically, the loading runtime will change to: +<tscreen><verb> +setxkmap -rules xfree86 -model logicordless -layout "us,cz,de" \ + -variant ",bksl," -option "grp:alt_shift_toggle" +</verb></tscreen> + +<sect1>Basic Global Options +<p> +See rules/*.lst files. + +<!-- + TODO: More detailed descriptions of options. User's often get confused. +--> + +<sect>Direct XKB Configuration +<p> +Generally, you can directly prescribe what configuration of each of basic +xkb components should be used to form the resulting keyboard mapping. +This method is rather "brute force". You precisely need to know the structure +and the meaning of all of used configuration components. +<p> +This method also exposes all xkb configuration details directly into XFree86 +configuration file which is a not very fortunate fact. +In rare occasions it may be needed, though. So how does it work? + +<sect1>Basic Components +<p> +There are five basic components used to form a keyboard mapping: +<itemize> +<item><em>key codes</em> - a translation of the scan codes produced by the + keyboard into a suitable symbolic form + +<item><em>types</em> - a specification of what various combinations of +modifiers produce + +<item><em>key symbols</em> - a translation of symbolic key codes into actual +symbols + +<item><em>geometry</em> - a description of physical keyboard geometry + +<item><em>compatibility maps</em> - a specification of what action should +each key produce in order to preserve compatibility with XKB-unware clients +</itemize> + +<sect1>Example Configuration +<p> +Look at the following example: +<tscreen><verb> +Section "InputDevice" + Identifier "Keyboard0" + Driver "Keyboard" + + Option "XkbKeycodes" "xfree86" + Option "XkbTypes" "default" + Option "XkbSymbols" "en_US(pc104)+de+swapcaps" + Option "XkbGeometry" "pc(pc104)" + Option "XkbCompat" "basic+pc+iso9995" +EndSection +</verb></tscreen> + +This configuration sets the standard XFree86 default interpretation of keyboard +keycodes, sets the default modificator types. The +symbol table is composed of extended US keyboard layout in its +variant for pc keyboards with 104 keys plus all keys +for german layout are redefined respectively. Also the logical +meaning of <tt>Caps-lock</tt> and <tt>Control</tt> keys is swapped. +The standard keyboard geometry (physical look) is set to pc style +keyboard with 104 keys. The compatibility map is set to allow +basic shifting, to allow Alt keys to be interpreted and also +to allow iso9995 group shifting. + +<!-- + TODO: add information about layout shifting: + TODO: us+ru(winkeys):2+de:3 +--> + +<sect>Keymap XKB Configuration +<p> +It is the formerly used way to configure xkb. The user included a special +keymap file which specified the direct xkb configuration. This method +has been obsoleted by previously described rules files which are far +more flexible and allow simpler and more intuitive syntax. It is +preserved merely for compatibility reasons. Avoid using it if it is possible. +<p> + +</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Enhancing.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Enhancing.sgml:1.2 --- /dev/null Thu Feb 27 12:30:32 2003 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Enhancing.sgml Tue Feb 25 14:31:02 2003 @@ -0,0 +1,557 @@ +<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> + +<article> +<title>How to further enhance XKB configuration +<author>Kamil Toman, Ivan U. Pascal +<date>25 November 2002 + +<ident> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Enhancing.sgml,v 1.2 2003/02/25 19:31:02 dawes Exp $ +</ident> + +<abstract> +This guide is aimed to relieve one's labour to create a new (internationalized) +keyboard layout. Unlike other documents this guide accents the keymap +developer's point of view. +</abstract> + +<toc> + +<p> + +<sect>Overview +<p> +The developer of a new layout should read the xkb +protocol specification (<url url="http://www.x-docs.org/XKB/XKBproto.pdf" +name="The X Keyboard Extension: Protocol Specification">) at least +to clarify for himself some xkb-specific terms used in this document +and elsewhere in xkb configuration. Also it shows wise to understand +how the X server and a client digest their keyboard inputs +(with and without xkb). +<p> +A useful source is also <url url="http://www.tsu.ru/~pascal/en/xkb" name="Ivan +Pascal's text about xkb configuration"> often referenced throughout this +document. + +<p> +Note that this document covers only enhancements which +are to be made to XFree86 version 4.3.x and above. + + +<sect>The Basics +<p> +At the startup (or at later at user's command) X server starts its xkb +keyboard module extension and reads data from a compiled configuration +file. +<p> +This compiled configuration file is prepared by the program <tt>xkbcomp</tt> +which behaves altogether as an ordinary compiler (see <tt>man xkbcomp</tt>). +Its input are human readable xkb configuration files which are verified and +then composed into a useful xkb configuration. Users don't need to mess with +<tt>xkbcomp</tt> themselves, for them it is invisible. Usually, it is started +upon X server startup. +<p> +As you probably already know, the xkb configuration consists of five +main modules: +<descrip> +<tag/Keycodes/ + Tables that defines translation from keyboard scan codes into reasonable + symbolic names, maximum, minimum legal keycodes, symbolic aliases and + description of physically present LED-indicators. The primary sence of + this component is to allow definitions of maps of symbols (see below) + to be independent of physical keyboard scancodes. There are two main + naming conventions for symbolic names (always four bytes long): + <itemize> + <item> names which express some traditional meaning like + <tt><SPCE></tt> (stands for space bar) or + <item> names which express some relative positioning on a keyboard, for + example <tt><AE01></tt> (an exclamation mark on US keyboards), on + the right there are keys <tt><AE02></tt>, <tt><AE03></tt> + etc. + </itemize> + +<tag/Types/ + Types describe how the produced key is changed by active modifiers (like + Shift, Control, Alt, ...). There are several predefined types which + cover most of used combinations. + +<tag/Compat/ + Compatibility component defines internal behaviour of modifiers. Using + compat component you can assign various actions (elaborately described + in xkb specification) to key events. This is also the place where + LED-indicators behaviour is defined. + +<tag/Symbols/ + For i18n purposes, this is the most important table. It defines what + values (=symbols) are assigned to what keycodes (represented by their + symbolic name, see above). There may be defined more than one value + for each key and then it depends on a key type and on modifiers state + (respective compat component) which value will be the resulting one. + +<tag/Geometry/ + Geometry files aren't used by xkb itself but they may be used by some + external programs to depict a keyboard image. +</descrip> +All these components have the files located in xkb configuration tree +in subdirectories with the same names (usually in <tt>/usr/lib/X11/xkb</tt>). + + +<sect>Enhancing XKB Configuration +<p> +Most of xkb enhancements concerns a need to define new output symbols +for the some input key events. In other words, a need to define a new +symbol map (for a new language, standard or just to feel more comfortable +when typing text). +<p> +What do you need to do? Generally, you have to define following things: +<itemize> +<item> the map of symbols itself +<item> the rules to allow users to select the new mapping +<item> the description of the new layout +</itemize> +<p> +First of all, it is good to go through existing layouts and to examine +them if there is something you could easily adjust to fit your needs. +Even if there is nothing similar you may get some ideas about basic +concepts and used tricks. +<p> +<sect1>Levels And Groups +<p> +Since XFree86 4.3.0 you can use <bf>multi-layout</bf> concept of xkb +configuration. +Though it is still in boundaries of xkb protocol and general ideas, the +keymap designer must obey new rules when creating new maps. In exchange +we get a more powerful and cleaner configuration system. +<p> +Remember that it is the application which must decide which symbol +matches which keycode according to effective modifier state. The X server +itself sends only an input event message to. Of course, usually +the general interpretation is processed by Xlib, Xaw, Motif, Qt, Gtk +and similar libraries. The X server only supplies its mapping table +(usually upon an application startup). +<p> +You can think of the X server's symbol table as of a irregular table where each +keycode has its row and where each combination of modifiers determines exactly +one column. The resulting cell then gives the proper symbolic value. Not all +keycodes need to bind different values for different combination of modifiers. +<tt><ENTER></tt> key, for instance, usually doesn't depend on any +modifiers so it its row has only one column defined. +<p> +Note that in XKB there is no prior assumption that certain modifiers are bound +to certain columns. By editing proper files (see <ref id="keytypes">) this +mapping can be changed as well. +<p> +Unlike the original X protocol the XKB approach is far more +flexible. It is comfortable to add one additional XKB term - group. You can +think of a group as of a vector of columns per each keycode (naturally the +dimension of this vector may differ for different keycodes). What is it good +for? The group is not very useful unless you intend to use more than one +logically different set of symbols (like more than one alphabet) defined in a +single mapping table. But then, the group has a natural meaning - each symbol +set has its own group and changing it means selecting a different one. +XKB approach allows up to four different groups. The columns inside each group +are called (shift) levels. The X server knows the current group and reports it +together with modifier set and with a keycode in key events. +<p> +To sum it up: +<p> +<itemize> +<item> for each keycode XKB keyboard map contains up to four one-dimensional + tables - groups (logically different symbol sets) +<item> for each group of a keycode XKB keyboard map contains some columns + - shift levels (values reached by combinations of Shift, Ctrl, Alt, ... + modifiers) +<item> different keycodes can have different number of groups +<item> different groups of one keycode can have different number of shift levels +<item> the current group number is tracked by X server +</itemize> +<p> +It is clear that if you sanely define levels, groups and sanely bind +modifiers and associated actions you can have simultaneously loaded up to +four different symbol sets where each of them would reside in its own group. +<p> +The multi-layout concept provides a facility to manipulate xkb groups +and symbol definitions in a way that allows almost arbitrary composition of +predefined symbol tables. To keep it fully functional you have to: +<itemize> +<item> define all symbols only in the first group +<item> (re)define any modifiers with extra care to avoid strange (anisometric) + behaviour +</itemize> +<p> +<sect>Defining New Layouts +<p> +<!-- + TODO: It may be better to merge IP01 docs and this guide. +--> +See <url url="http://www.tsu.ru/~pascal/en/xkb/internals.html" name="Some Words +About XKB internals"> for explanation of used xkb terms and problems +addressed by XKB extension. +<p> +See <url url="http://www.tsu.ru/~pascal/en/xkb/gram-common.html" name="Common +notes about XKB configuration files language"> for more precise explanation of +syntax of xkb configuration files. +<p> +<sect1>Predefined XKB Symbol Sets +<p> +If you are about to define some European symbol map extension, you might +want to use on of four predefined latin alphabet layouts. +<!-- + TODO: more details + TODO: something similiar for phonetic layouts + TODO: what are pc/pc layouts good for??? +--> +<p> +Okay, let's assume you want extend an existing keymap and you want to override +a few keys. Let's take a simple U.K. keyboard as an example (defined in +<tt>pc/gb</tt>): +<p> +<tscreen><verb> +partial default alphanumeric_keys +xkb_symbols "basic" { + include "pc/latin" + + name[Group1]="Great Britain"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE03> { [ 3, sterling, threesuperior, sterling ] }; + key <AC11> { [apostrophe, at, dead_circumflex, dead_caron] }; + key <TLDE> { [ grave, notsign, bar, bar ] }; + key <BKSL> { [numbersign, asciitilde, dead_grave, dead_breve ] }; + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + + modifier_map Mod5 { <RALT> }; +}; +</verb></tscreen> +<!-- + TODO: ref IP01 file syntax TODO: some words about symbolic names like + 'sterling' and also about + TODO: unicode characters (for non-latin alphabets), + TODO: ref to compatibility symbolic names vs. unicode +--> +<p> +It defines a new layout in <tt>basic</tt> variant as an extension of common +latin alphabet layout. The layout (symbol set) name is set to "Great Britain". +Then there are redefinitions of a few keycodes and a modifiers binding. As you +can see the number of shift levels is the same for <tt><AE02></tt>, +<tt><AE03></tt>, <tt><AC11></tt>, <tt><TLDE></tt> and +<tt><BKSL></tt> keys but it differs from number of shift levels of +<tt><RALT></tt>. +<p> +Note that the <tt><RALT></tt> key itself is a binding key for Mod5 and +that it +serves like a shift modifier for LevelThree, together with Shift +as a multi-key. It is a good habit to respect this rule in a new similar +layout. +<p> +Okay, you could now define more variants of your new layout besides +<tt>basic</tt> simply by including (augmenting/overriding/...) the basic +definition and altering what may be needed. + +<sect1>Key Types<label id="keytypes"> +<p> + +The differences in the number of columns (shift levels) are caused by +a different types of keys (see the types definition in section basics). Most +keycodes have implicitly set the keytype in the included +<tt>&dquot;pc/latin&dquot;</tt> file to +<tt>&dquot;FOUR_LEVEL_ALPHABETIC&dquot;</tt>. The only exception is +<tt><RALT></tt> keycode which is explicitly set +<tt>&dquot;TWO_LEVEL&dquot;</tt> keytype. +<p> +All those names refer to pre-defined shift level schemes. Usually you can +choose a suitable shift level scheme from <tt>default</tt> types scheme list +in proper xkb component's subdirectory. +<p> +The most used schemes are: +<descrip> +<tag/ONE_LEVEL/ + The key does not depend on any modifiers. The symbol from first level + is always chosen. + +<tag/TWO_LEVEL/ + The key uses a modifier Shift and may have two possible values. + The second level may be chosen by Shift modifier. If Lock modifier + (usually Caps-lock) applies the symbol is further processed using + system-specific capitalization rules. If both Shift+Lock modifier apply the + symbol from the second level is taken and capitalization rules are applied + (and usually have no effect). + +<tag/ALPHABETIC/ + The key uses modifiers Shift and Lock. It may have two possible + values. The second level may be chosen by Shift modifier. When Lock + modifier applies, the symbol from the first level is taken and further + processed using system-specific capitalization rules. If both Shift+Lock + modifier apply the symbol from the first level is taken and no + capitalization rules applied. This is often called shift-cancels-caps + behaviour. + +<tag/THREE_LEVEL/ + Is the same as TWO_LEVEL but it considers an extra modifier - + LevelThree which can be used to gain the symbol value from the third + level. If both Shift+LevelThree modifiers apply the value from the third + level is also taken. As in TWO_LEVEL, the Lock modifier doesn't influence + the resulting level. Only Shift and LevelThree are taken into that + consideration. If the Lock modifier is active capitalization rules + are applied on the resulting symbol. + +<tag/FOUR_LEVEL/ + Is the same as THREE_LEVEL but unlike LEVEL_THREE if both Shift+LevelThree + modifiers apply the symbol is taken from the fourth level. + +<tag/FOUR_LEVEL_ALPHABETIC/ + Is similar to FOUR_LEVEL but also defines shift-cancels-caps behaviour + as in ALPHABETIC. If Lock+LevelThree apply the symbol from the + third level is taken and the capitalization rules are applied. + If Lock+Shift+LevelThree apply the symbol from the third level is taken + and no capitalization rules are applied. + +<tag/KEYPAD/ + As the name suggest this scheme is primarily used for numeric keypads. + The scheme considers two modifiers - Shift and NumLock. If none + of modifiers applies the symbol from the first level is taken. If either + Shift or NumLock modifiers apply the symbol from the second level is taken. + If both Shift+NumLock modifiers apply the symbol from the first level + is taken. Again, shift-cancels-caps variant. + +<tag/FOUR_LEVEL_KEYPAD/ + Is similar to KEYPAD scheme but considers also LevelThree modifier. + If LevelThree modifier applies the symbol from the third level is taken. + If Shift+LevelThree or NumLock+LevelThree apply the symbol from the fourth + level is taken. If all Shift+NumLock+LevelThree modifiers apply the symbol + from the third level is taken. This also, shift-cancels-caps variant. +</descrip> +<p> +Besides that, there are several schemes for special purposes: +<descrip> +<tag/PC_BREAK/ + It is similar to TWO_LEVEL scheme but it considers the Control + modifier rather than Shift. That means, the symbol from the second level + is chosen by Control rather than by Shift. +<tag/PC_SYSRQ/ + It is similar to TWO_LEVEL scheme but it considers the Alt modifier rather + than Shift. That means, the symbol from the second level + is chosen by Alt rather than by Shift. +<tag/CTRL+ALT/ + The key uses modifiers Alt and Control. It may have two possible + values. If only one modifier (Alt or Control) applies the symbol + from the first level is chosen. Only if both Alt+Control modifiers apply + the symbol from the second level is chosen. +<tag/SHIFT+ALT/ + The key uses modifiers Shift and Alt. It may have two possible values. + If only one modifier (Alt or Shift) applies the symbol + from the first level is chosen. Only if both Alt+Shift modifiers apply + the symbol from the second level is chosen. +</descrip> +<p> +If needed, special <tt>caps</tt> schemes may be used. They redefine the +standard behaviour of all <tt>*ALPHABETIC</tt> types. The layouts (maps of +symbols) with keys defined in respective types then automatically change +their behaviour accordingly. Possible redefinitions are: +<itemize> +<item>internal +<item>internal_nocancel +<item>shift +<item>shift_nocancel +</itemize> +None of these schemes should be used directly. They are defined merely +for <tt>'caps:'</tt> xkb options (used to globally change the layouts +behaviour). +<p> +Don't alter any of existing key types. If you need a different behaviour +create a new one. + +<sect2>More On Definitions Of Types +<p> +When the XKB software deals with a separate type description it gets +a complete list of modifiers that should be taken into account from the +<tt>'modifiers=<list of modifiers>'</tt> list and expects that a set +of <tt>'map[<combination of modifiers>]=<list of modifiers>'</tt> +instructions that contain the mapping for each combination of modifiers +mentioned in that list. Modifiers that are not explicitly listed are NOT taken +into account +when the resulting shift level is computed. +If some combination is omitted the program (subroutine) should choose the first +level for this combination (a quite reasonable behavior). +<p> +Lets consider an example with two modifiers <tt>ModOne</tt> and <tt>ModTwo</tt>: +<tscreen><verb> +type "..." { + modifiers = ModOne+ModTwo; + map[None] = Level1; + map[ModOne] = Level2; +}; +</verb></tscreen> +In this case the map statements for <tt>ModTwo</tt> only and +<tt>ModOne+ModTwo</tt> are omitted. It means that if the <tt>ModTwo</tt> is +active the subroutine can't found explicit mapping for such combination an will +use the <em>default level</em> i.e. Level1. +<p> +But in the case the type described as: +<tscreen><verb> +type "..." { + modifiers = ModOne; + map[None] = Level1; + map[ModOne] = Level2; +}; +</verb></tscreen> +the ModTwo will not be taken into account and the resulting level depends on +the ModOne state only. That means, ModTwo alone produces the Level1 but the +combination ModOne+ModTwo produces the Level2 as well as ModOne alone. +<p> +What does it mean if the second modifier is the Lock? It means that in +the first case (the Lock itself is included in the list of modifiers but +combinations with this modifier aren't mentioned in the map statements) +the internal capitalization rules will be applied to the symbol from the first +level. But in the second case the capitalization will be applied to the symbol +chosen accordingly to he first modifier - and this can be the symbol from the +first as well as from the second level. +<p> +Usually, all modifiers introduced in <tt>'modifiers=<list of +modifiers>'</tt> list are used for shift level calculation and then +discarded. Sometimes this is not desirable. If you want to use a modifier +for shift level calculation but you don't want to discard it, you may +list in '<tt>preserve[<combination of modifiers>]=<list of +modifiers>'</tt>. That means, for a given combination all listed modifiers +will be preserved. If the Lock modifier is preserved then the resulting +symbol is passed to internal capitalization routine regardless whether +it has been used for a shift level calculation or not. +<p> +Any key type description can use both real and virtual modifiers. Since real +modifiers always have standard names it is not necessary to explicitly declare +them. Virtual modifiers can have arbitrary names and can be declared (prior +using them) directly in key type definition: +<tscreen><verb> +virtual_modifiers <comma-separated list of modifiers> ; +</verb></tscreen> +as seen in for example <tt>basic</tt>, <tt>pc</tt> or <tt>mousekeys</tt> key +type definitions. + +<sect1>Rules +<p> +Once you are finished with your symbol map you need to add it +to rules file. The rules file describes how all the +five basic keycodes, types, compat, symbols and geometry components +should be composed to give a sensible resulting xkb configuration. +<p> +The main advantage of rules over formerly used keymaps is a possibility +to simply parameterize (once) fixed patterns of configurations and thus +to elegantly allow substitutions of various local configurations +into predefined templates. +<p> +A pattern in a rules file (often located in +<tt>/usr/lib/X11/xkb/rules</tt>) can be parameterized with four other arguments: +<tt>Model</tt>, <tt>Layout</tt>, <tt>Variant</tt> and <tt>Options</tt>. +For most cases parameters <tt>model</tt> and <tt>layout</tt> should +be sufficient for choosing a functional keyboard mapping. +<p> +The rules file itself is composed of pattern lines and lines with rules. The pattern line starts with an exclamation mark ('<tt>!</tt>') +and describes how will the xkb interpret the following lines (rules). A sample +rules file looks like this: +<tscreen><verb> +! model = keycodes + macintosh_old = macintosh + ... + * = xfree86 + +! model = symbols + hp = +inet(%m) + microsoftpro = +inet(%m) + geniuscomfy = +inet(%m) + +! model layout[1] = symbols + macintosh us = macintosh/us%(v[1]) + * * = pc/pc(%m)+pc/%l[1]%(v[1]) + +! model layout[2] = symbols + macintosh us = +macintosh/us[2]%(v[2]):2 + * * = +pc/%l[2]%(v[2]):2 + +! option = types + caps:internal = +caps(internal) + caps:internal_nocancel = +caps(internal_nocancel) +</verb></tscreen> + +Each rule defines what certain combination of values on the left side +of equal sign ('<tt>=</tt>') results in. For example a (keyboard) model +<tt>macintosh_old</tt> instructs xkb to take definitions of keycodes +from file <tt>keycodes/macintosh</tt> while the rest of models +(represented by a wild card '<tt>*</tt>') instructs it to take them from +file <tt>keycodes/xfree86</tt>. The wild card represents all possible +values on the left side which were not found in any of the previous rules. +The more specialized (more complete) rules have higher precedence than general +ones, i.e. the more general rules supply reasonable default values. +<p> +As you can see some lines contain substitution parameters - the parameters +preceded by the percent sign ('<tt>%</tt>'). The first alphabetical character +after the percent sign expands to the value which has been found on the left +side. For example <tt>+%l%(v)</tt> expands into <tt>+cz(bksl)</tt> if the +respective values on the left side were <tt>cz</tt> layout in its <tt>bksl</tt> +variant. More, if the layout resp. variant parameter is followed by a pair of +brackets ('<tt>[</tt>', '<tt>]</tt>') it means that xkb should <em>place the +layout resp. variant into specified xkb group</em>. If the brackets are omitted +the first group is the default value. +<p> +So the second block of rules enhances symbol definitions for some particular +keyboard models with extra keys (for internet, multimedia, ...) . Other models +are left intact. Similarly, the last block overrides some key type definitions, +so the common global behaviour ''shift cancels caps'' or ''shift doesn't cancel +caps'' can be selected. The rest of rules produces special symbols for each +variant <tt>us</tt> layout of <tt>macintosh</tt> keyboard and standard pc +symbols in appropriate variants as a default. + +<!-- + TODO: more words about group switching (XkbOptions grp:...)? +--> + +<!-- + TODO: user & 3rd party xkb tree? + TODO: better and more complex explanation of rules +--> + +<sect1>Descriptive Files of Rules +<p> +Now you just need to add a detailed description to <tt><rules>.xml</tt> +description file so the other users (and external programs which often parse +this file) know what is your work about. + + +<!-- + TODO: format and semantics +--> + +<sect2>Old Descriptive Files +<p> +The formerly used descriptive files were named <tt><rules>.lst</tt> +Its structure is very simple and quite self descriptive but such simplicity +had also some cavities, for example there was no way how to describe local +variants of layouts and there were problems with the localization of +descriptions. To preserve compatibility with some older programs, +new XML descriptive files can be converted to old format '.lst'. +<p> +For each parameter of rules file should be described its meaning. For the rules +file described above the <tt>.lst</tt> file could look like: +<tscreen><verb> +! model + pc104 Generic 104-key PC + microsoft Microsoft Natural + pc98 PC-98xx Series + macintosh Original Macintosh + ... + +! layout + us U.S. English + cz Czech + de German + ... + +! option + caps:internal uses internal capitalization. Shift cancels Caps + caps:internal_nocancel uses internal capitalization. Shift doesn't cancel Caps + +</verb></tscreen> +<p> +And that should be it. Enjoy creating your own xkb mapping. + +</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.39 xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.43 --- xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.39 Wed Jan 16 11:25:54 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml Tue Feb 25 14:31:02 2003 @@ -8,14 +8,14 @@ <title>ATI Adapters README file <author>Marc Aurele La France -<date>2001 April 10 +<date>2002 February 12 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.39 2002/01/16 16:25:54 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.43 2003/02/25 19:31:02 dawes Exp $ </ident> <abstract> @@ -50,6 +50,10 @@ See the <bf>``XF86Config specifications''</bf> section below for details.<p> If none of the above conditions are met, the ATI driver will essentially disable itself to allow other drivers to examine the system.<p> +Note that I am currently considering removing the driver's support for generic +VGA. +If you have any concerns about this, please contact me at +<email>tsi@xfree86.org</email>. <sect>A note on acceleration<p> The meaning of ``acceleration'', as used in this document, needs to be clarified. @@ -366,7 +370,7 @@ said to be clones of one of the above) might generate non-zero frequencies for those that are zero above, or vice-versa.<p> The order of the clocks <it>is</it> very important, although the driver will -reorder the clocks if it deems it appropriate to do so. +reorder the specified clocks if it deems it appropriate to do so. Mach32 and Mach64 owners should note that this order is different than what they would use for previous XFree86 accelerated servers.<p> <sect2>Clocks for non-ATI adapters<p> @@ -376,12 +380,20 @@ You can include up to four clock frequencies in your XF86Config to specify the actual values used by the adapter. Any more will be ignored.<p> -<sect1>Option <it>``crt_screen''</it><p> +<sect1>Option <it>``nopanel_display''</it><p> This specification is only effective when the driver detects that the adapter's BIOS has initialised both the digital flat panel and CRT interfaces. In such a situation, the driver will normally drive both the panel and the CRT. This specification causes the driver to disable the digital flat panel and -display the screen image on the CRT instead.<p> +display the screen image on the CRT instead, which could potentially allow for +larger physical resolutions than the panel can handle.<p> +<sect1>Option <it>``crt_display''</it><p> +This specification is only effective when the driver detects that the adapter's +BIOS has initialised the digital flat panel interface, but has disabled the +CRT interface. +In such a situation the driver will normally drive only the panel. +This specification causes the driver to instead display the same image on both +the panel and the CRT.<p> <sect1>Option <it>``noaccel''</it><p> By default, the driver will accelerate draw operations if a Mach64 CRTC is used to drive the display. @@ -398,13 +410,14 @@ <sect1>Option <it>``HWCursor''</it> and Option <it>``SWCursor''</it><p> Option <it>``HWCursor''</it>, which is the default, specifies that hardware facilities are to be used to paint the mouse pointer on the screen. -Option <it>``SWCursor''</it> specifies that the mouse pointer is to by drawn by +Option <it>``SWCursor''</it> specifies that the mouse pointer is to be drawn by software, which is much slower. If both options are specified, option <it>``SWCursor''</it> prevails. Currently, these options are only acted upon for 256-colour or higher depth modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is being used. -In all other situations, a software cursor will be used.<p> +In all other situations, a software cursor will be used, regardless of what +these options specify.<p> <sect1>Option <it>``SilkenMouse''</it><p> This option is only acted upon when a hardware cursor is being used. It specifies that the cursor's position on the screen is to be updated as @@ -478,10 +491,6 @@ mode), the server will automatically select as a default resolution the largest usable mode, whether or not the chosen mode is specified in the corresponding ``Monitor'' section.<p> -For a CRT monitor, you should still specify horizontal sync and vertical -refresh rates in the corresponding ``Monitor'' section. -Otherwise, the server will default these to those of a VGA monitor, which will -limit resolutions to not much more than 640x480 at 72 Hz. For a digital flat panel, any sync tolerances should be removed from the corresponding ``Monitor'' section. The driver will automatically calculate these from the mode that is active on @@ -493,17 +502,6 @@ driver. They include:<p> <itemize> -<item>A number of system lockups and blank screens have been reported when -using PCI Mach64 adapters. -The great majority of these problems have been found to be due to system -aspects that are unrelated to this driver. -As of this writing, these problems can be divided into two general areas:<p> -Improper mouse protocol specification with some recent mice. -Try different protocol specifications or another mouse.<p> -A system conflict with APM. -This problem is Linux-specific. -There is a bug in kernels 2.0.31 or earlier that prevents proper APM operation. -Upgrade to a more recent kernel or disable APM support in the kernel.<p> <item>When using a Mach64's accelerator CRTC, the virtual resolution must be less than 8192 pixels wide. The VGA CRTC further limits the virtual resolution width to less than 4096 @@ -536,7 +534,8 @@ In the first case, the workaround is to use some other means of restoring the text font. On Linux, this can be accomplished with the kbd or svgalib packages. -In the second case, xrefresh(1) will usually clean up the image. +In the second case, <htmlurl name="xrefresh(1)" url="xrefresh.1.html"> +will usually clean up the image. No complete solution to this problem is currently known. It appears this corruption occurs due to either video memory bandwidth or RAMDAC limitations, and so the driver will limit mode clocks to 40MHz. @@ -549,7 +548,19 @@ Be aware however that doing so is untested and might damage the adapter. <item>Except as in the previous items, clocks are limited to 80MHz on most adapters, although many are capable of higher frequencies. -This will be fixed in a future release. +This will eventually be fixed in a future release. +<item>The use of a laptop's hot-keys to switch displays while this driver is +active can cause lockups and/or other woes, and is therefore not recommended. +It is not currently possible to solve this problem.<p> +<item>In situations where the driver is to simultaneously display on both a +panel and a CRT, the same image will be seen on both. +In particular, this means the CRT must be able to synchronise with the timings +of the panel's native resolution. +This is quite evident when the panel has ``odd-ball'' dimensions, such as +1400x1050, a resolution not commonly possible on CRTs or projection +equipment.<p> +Also, the display of independent images on the panel and CRT is not currently +implemented, and might never be, pending resolution of the previous item.<p> </itemize> Support for the following will be added in a future release: <itemize> @@ -574,13 +585,9 @@ name="ftp://ftp.xfree86.org/pub/XFree86" url="ftp://ftp.xfree86.org/pub/XFree86"> if you are uncertain.<p> Secondly, please check XFree86's doc directory for additional information.<p> -<!-- -Thirdly, do not forget to read <htmlurl name="http://www.xfree86.org/FAQ" -url="http://www.xfree86.org/FAQ">.<p> ---> Thirdly, a scan through the comp.windows.x.i386unix and comp.os.linux.x -newsgroups using your favourite archiving service can also prove useful in -resolving problems.<p> +newsgroups and the xfree86 mailing list using your favourite archiving +service can also prove useful in resolving problems.<p> If you are still experiencing problems, you can send me <it>non-HTMLised</it> e-mail at <email>tsi@xfree86.org</email>. Please be as specific as possible when describing the problem(s), and include @@ -592,11 +599,10 @@ under X386 1.1a. This original driver might have actually been based on a non-functional ATI driver written by Thomas Roell (currently of Xi Graphics).<p> -Then Doug Evans (<it>dje@cygnus.com</it>) added support for the ATI VGA Wonder -XL, trying in the process to make the driver work with all other ATI adapters -available at the time.<p> -Rik Faith (<it>faith@precisioninsight.com</it>) obtained the X11R4 driver from -Doug Evans in the summer of 1992 and ported the code to the X386 part of X11R5. +Then Doug Evans added support for the ATI VGA Wonder XL, trying in the process +to make the driver work with all other ATI adapters available at the time.<p> +Rik Faith obtained the X11R4 driver from Doug Evans in the summer of 1992 and +ported the code to the X386 part of X11R5. This subsequently became part of XFree86.<p> I (Marc Aurele La France) took over development and maintenance of the driver in the fall of 1993 after Rik got rid of his VGA Wonder adapter.<p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.22 xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.29 --- xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.22 Wed Jan 16 15:38:45 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent Wed Feb 26 21:03:07 2003 @@ -1,40 +1,48 @@ -<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.22 2002/01/16 20:38:45 dawes Exp $ --> +<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.29 2003/02/27 02:03:07 dawes Exp $ --> <!-- shared entity definitions for the XFree86 documentation --> <!-- XFree86 version string --> -<!ENTITY relvers CDATA "4.2.0"> -<!ENTITY prevrelvers CDATA "4.1.0"> -<!ENTITY fullrelvers CDATA "4.2.0"> -<!ENTITY prevfullrelvers CDATA "4.1.0"> -<!ENTITY nextfullrelvers CDATA "4.3.0"> -<!ENTITY nextfullreldate CDATA "May 2002"> -<!ENTITY nextupdrelvers CDATA "4.2.1"> -<!ENTITY srcvers CDATA "420"> -<!ENTITY prevsrcvers CDATA "410"> -<!ENTITY fullsrcvers CDATA "420"> -<!ENTITY prevfullsrcvers CDATA "410"> -<!ENTITY whichfullrel CDATA "fifth"> +<!ENTITY relvers CDATA "4.3.0"> +<!ENTITY prevrelvers CDATA "4.2.1"> +<!ENTITY fullrelvers CDATA "4.3.0"> +<!ENTITY prevfullrelvers CDATA "4.2.0"> +<!ENTITY nextfullrelvers CDATA "4.4.0"> +<!ENTITY nextfullreldate CDATA "not scheduled"> +<!ENTITY nextupdrelvers CDATA "4.3.1"> +<!ENTITY srcvers CDATA "430"> +<!ENTITY prevsrcvers CDATA "421"> +<!ENTITY fullsrcvers CDATA "430"> +<!ENTITY prevfullsrcvers CDATA "420"> +<!ENTITY whichfullrel CDATA "sixth"> <!ENTITY whichupdaterel CDATA "none"> -<!ENTITY relbranchtag CDATA "xf-4_2-branch"> +<!ENTITY reltag CDATA "xf-4_3_0"> +<!ENTITY relbranchtag CDATA "xf-4_3-branch"> +<!ENTITY rcnum CDATA "0"> <!-- Version of the most recent 3.3.x release --> <!ENTITY legacyvers CDATA "3.3.6"> <!-- doctools version strings --> -<!ENTITY doctoolsvers CDATA "1.3"> +<!ENTITY doctoolsvers CDATA "1.3.1"> +<!-- utils version strings --> +<!ENTITY utilsvers CDATA "1.1.0"> + <!-- These should be set according to which snapshot/release this is --> <!ENTITY % firstsnap 'IGNORE'> -<!ENTITY % latersnap 'INCLUDE'> +<!ENTITY % latersnap 'IGNORE'> <!ENTITY % snapshot 'IGNORE'> +<!ENTITY % notsnapshot 'INCLUDE'> +<!ENTITY % relcandidate 'IGNORE'> <!ENTITY % release 'INCLUDE'> <!ENTITY % firstrel 'IGNORE'> <!ENTITY % earlyrel 'IGNORE'> <!ENTITY % laterrel 'INCLUDE'> <!ENTITY % fullrel 'INCLUDE'> +<!ENTITY % fullbinaries 'INCLUDE'> <!ENTITY % updaterel 'IGNORE'> -<!ENTITY % prevrelwasupdate 'IGNORE'> +<!ENTITY % prevrelwasupdate 'INCLUDE'> <!-- Set this to INCLUDE when references to the RELNOTES are to be included --> <!ENTITY % haverelnotes 'INCLUDE'> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml:1.1 xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml:1.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml:1.1 Thu Mar 1 21:45:37 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml Sun Jan 19 22:43:07 2003 @@ -8,7 +8,7 @@ <author>Juliusz Chroboczek, <email/jch@xfree86.org/ <date>27 February 2001</date> -<ident>$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $</ident> +<ident>$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.2 2003/01/20 03:43:07 dawes Exp $</ident> <toc> @@ -111,7 +111,8 @@ Its basic operation consists in walking recursively a filesystem tree, noting all resources, and then writing out a ``Unix PostScript Resources,'' file, basically a directory of all the resources found. -This utility is documented in the makepsres(1) manual page. +This utility is documented in the <htmlurl name="makepsres(1)" +url="makepsres.1.html"> manual page. The <tt/pswrap/ utility is a stub generator for PostScript clients. Roughly speaking, it takes as its input textual PostScript code, and Index: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.15 xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.20 --- xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.15 Mon Dec 17 14:25:36 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml Sun Jan 19 22:43:07 2003 @@ -6,42 +6,217 @@ <title>Fonts in XFree86 <author>Juliusz Chroboczek, <email/jch@xfree86.org/ -<date>26 November 2001</date> +<date>17 January 2003</date> <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.15 2001/12/17 19:25:36 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.20 2003/01/20 03:43:07 dawes Exp $ </ident> <toc> <sect>Introduction -<!-- I hate SGML. What's wrong with texinfo? --> - -<p>This document describes the support for fonts in XFree86. Section -<ref id="sec:installing" name="Installing fonts"> is aimed at the -casual user wishing to install fonts in the X server; the rest of the +<p>This document describes the support for fonts in XFree86. <ref +id="sec:installing" name="Installing fonts"> is aimed at the +casual user wishing to install fonts in XFree86; the rest of the document describes the font support in more detail. -We only describe font support within the core X protocol. Issues -relating to fonts within the RENDER extension, the GLX (OpenGL) -extension or the PEX extension are outside the scope of this document. - We assume some familiarity with digital fonts. If anything is not -clear to you, please consult Appendix <ref id="sec:background" -name="Background"> at the end of this document for background +clear to you, please consult <ref id="sec:background" +name="Appendix: Background"> at the end of this document for background information. + +<sect1>Two font systems + +<p>XFree86 includes two font systems: the core X11 fonts system, which +is present in all implementations of X11, and the Xft fonts system, +which is not currently distributed with implementations of X11 that +are not based on XFree86 but will hopefully be included by them in +the future + +The core X11 fonts system is directly derived from the fonts system +included with X11R1 in 1987, which could only use monochrome bitmap +fonts. Over the years, it has been more or less happily coerced into +dealing with scalable fonts and rotated glyphs. + +Xft was designed from the start to provide good support for scalable +fonts, and do so efficiently. Unlike the core fonts system, it +supports features such as anti-aliasing and sub-pixel rasterisation. +Perhaps more importantly, it gives applications full control over the +way glyphs are rendered, making fine typesetting and WYSIWIG display +possible. Finally, it allows applications to use fonts that are not +installed system-wide for displaying documents with embedded fonts. + +Xft is not compatible with the core fonts system: usage of Xft +requires making fairly extensive changes to toolkits (user-interface +libraries). While XFree86 will continue to maintain the core fonts +system, toolkit authors are encouraged to switch to Xft as soon as +possible. + +<sect>Installing fonts<label id="sec:installing"> + +<p>This section explains how to configure both Xft and the core fonts +system to access newly-installed fonts. + +<sect1>Configuring Xft<label id="sec:configuring-xft"> + +<p>Xft has no configuration mechanism itself, rather it relies upon +the fontconfig library to configure and customize fonts. That library +is not specific to XFree86 or indeed on any particular font output +mechanism. This discussion describes how fontconfig, rather than Xft, +works. + +<sect2>Installing fonts in Xft + +<p>Fontconfig looks for fonts in a set of well-known directories that +include all of XFree86's standard font directories +(`<tt>/usr/X11R6/lib/X11/lib/fonts/*</tt>') by default) as well as a +directory called `<tt>.fonts/</tt>' in the user's home directory. +Installing a font for use by Xft applications is as simple +as copying a font file into one of these directories. +<tscreen><verb> +$ cp lucbr.ttf ~/.fonts/ +</verb></tscreen> +Fontconfig will notice the new font at the next opportunity and rebuild its +list of fonts. If you want to trigger this update from the command +line (for example in order to globally update the system-wide Fontconfig +information), you may run the command `<tt/fc-cache/'. +<tscreen><verb> +$ fc-cache +</verb></tscreen> + +<sect2>Fine-tuning Xft + +<p>Fontconfig's behaviour is controlled by a set of configuration files: a +system-wide configuration file, `<tt>/etc/fonts/fonts.conf</tt>', and +a user-specific file called `<tt>.fonts.conf</tt>' in the user's home +directory (this can be overridden with the `<tt/FONTCONFIG_FILE/' +environment variable). -<sect>Installing fonts <label id="sec:installing"> +Every Fontconfig configuration file must start with the following +boilerplate: +<tscreen><verb> +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<fontconfig> +</verb></tscreen> +In addition, every Fontconfig configuration file must end with the +following line: +<tscreen><verb> +</fontconfig> +</verb></tscreen> -<p>Installing fonts in XFree86 is a two step process. First, you need -to create a <it/font directory/ that contains all the relevant font -files as well as some index files. You then need to inform the X -server of the existence of this new directory by including it in the -<it/font path/. +The default Fontconfig configuration file includes the directory +`<tt>~/.fonts/</tt>' in the list of directories searched for font +files, and this is where user-specific font files should be installed. +In the unlikely case that a new font directory needs to be added, this +can be done with the following syntax: +<tscreen><verb> +<dir>/usr/local/share/fonts/</dir> +</verb></tscreen> -<sect1>Installing bitmap fonts +Another useful option is the ability to disable anti-aliasing (font +smoothing) for selected fonts. This can be done with the following +syntax: +<tscreen><verb> +<match target="font"> + <test qual="any" name="family"> + <string>Lucida Console</string> + </test> + <edit name="antialias" mode="assign"> + <bool>false</bool> + </edit> +</match> +</verb></tscreen> +Anti-aliasing can be disabled for all fonts by the following incantation: +<tscreen><verb> +<match target="font"> + <edit name="antialias" mode="assign"> + <bool>false</bool> + </edit> +</match> +</verb></tscreen> +Xft supports sub-pixel rasterisation on LCD displays. XFree86 should +automatically enable this feature on laptops and when using an LCD +monitor connected with a DVI cable; you can check whether this was +done by typing +<tscreen><verb> +$ xdpyinfo -ext RENDER | grep sub-pixel +</verb></tscreen> +If this doesn't print anything, you will need to configure Render for +your particular LCD hardware manually; this is done with the following +syntax: +<tscreen><verb> +<match target="font"> + <edit name="rgba" mode="assign"> + <const>rgb</const> + </edit> +</match> +</verb></tscreen> +The string `<tt/rgb/' within the +`<tt/<const>/'...`<tt></const></tt>' +specifies the order of pixel components on your display, and should be +changed to match your hardware; it can be one of `<tt/rgb/ (normal +LCD screen), `<tt/bgr/' (backwards LCD screen), `<tt/vrgb/' (LCD +screen rotated clockwise) or `<tt/vbgr/' (LCD screen rotated +counterclockwise). + +<sect2>Configuring applications + +<p>Because most current applications use the core fonts system by +default, it is necessary to explicitly configure them to use Xft. +How this is done depends on the application. + +XTerm can be set to use Xft by using the `<tt/-fa/' command line +option or by setting the `<tt/XTerm*faceName/' resource: +<tscreen><verb> +XTerm*faceName: Courier +</verb></tscreen> +or +<tscreen><verb> +$ xterm -fa "Courier" +</verb></tscreen> + +For applications based on GTK+ 2.0 (including GNOME 2 applications), +the environment variable `<tt/GDK_USE_XFT/' should be set to `<tt/1/': +<tscreen><verb> +$ export GDK_USE_XFT=1 +</verb></tscreen> + +GTK+ 2.2 uses Xft by default. + +For KDE applications, you should select ``Anti-alias fonts'' in the +``Fonts'' panel of KDE's ``Control Center''. Note that this option is +misnamed: it switches KDE to using Xft but doesn't enable +anti-aliasing in case it was disabled by your Xft configuration file. + +<it>(What about Mozilla?)</it> + +<sect2>Troubleshooting <label id="sec:troubleshooting-xft"> + +<p>If some Xft-based applications don't seem to notice the changes you +are making to your configuration files, they may be linked against the +XFree86 4.2 version of Xft. In order to fix the problem, you should +relink them against a current version of Xft; on most systems, it is +enough to install the current version of the Xft and Fontconfig +libraries. + +If, for some reason, you cannot upgrade the shared libraries, please +check the <htmlurl name="Xft(3)" url="Xft.3.html"> manual page included +with XFree86 4.2 for the configuration mechanisms of the previous version +of Xft. + +<sect1>Configuring the core X11 fonts system + +<p>Installing fonts in the core system is a two step process. First, +you need to create a <it/font directory/ that contains all the +relevant font files as well as some index files. You then need to +inform the X server of the existence of this new directory by +including it in the <it/font path/. + +<sect2>Installing bitmap fonts + <p>The XFree86 server can use bitmap fonts in both the cross-platform BDF format and the somewhat more efficient binary PCF format. (XFree86 also supports the obsolete SNF format.) @@ -53,7 +228,7 @@ <tscreen><verb> $ bdftopcf courier12.bdf </verb></tscreen> -You may then want to compress the resulting PCF font files: +You will then want to compress the resulting PCF font files: <tscreen><verb> $ gzip courier12.pcf </verb></tscreen> @@ -62,23 +237,23 @@ files that you wish to make available into a arbitrary directory, say `<tt>/usr/local/share/fonts/bitmap/</tt>'. You should then create the index file `<tt/fonts.dir/' by running the command `<tt/mkfontdir/' -(please see the <tt/mkfontdir/(1) manual page for more information): +(please see the <htmlurl name="mkfontdir(1)" url="mkfontdir.1.html"> +manual page for more information): <tscreen><verb> -$ mkdir /usr/local/share/fonts/bitmap -$ cp *.pcf.gz /usr/local/share/fonts/bitmap -$ cd /usr/local/share/fonts/bitmap -$ mkfontdir +$ mkdir /usr/local/share/fonts/bitmap/ +$ cp *.pcf.gz /usr/local/share/fonts/bitmap/ +$ mkfontdir /usr/local/share/fonts/bitmap/ </verb></tscreen> All that remains is to tell the X server about the existence of the -new font directory; see Section <ref id="sec:set-font-path" -name="Setting the server font path">. +new font directory; see <ref id="sec:set-font-path" name="Setting the +server font path"> below. -<sect1>Installing scalable fonts +<sect2>Installing scalable fonts <p>The XFree86 server supports scalable fonts in four formats: Type 1, Speedo, TrueType and CIDFont. This section only applies -to the former three; for information on CIDFonts, please see Section +to the former three; for information on CIDFonts, please see <ref id="sec:cid-fonts" name="Installing CIDFonts"> later in this document. @@ -89,65 +264,26 @@ There is, however, a big difference: `<tt/mkfontdir/' cannot automatically recognise scalable font files. For that reason, you must first index all the font files in a file called -`<tt/fonts.scale/'. This file has the same format as a -`<tt/fonts.dir/' file, and typically looks as follows: +`<tt/fonts.scale/'. While this can be done by hand, it is best done +by using the `<tt/mkfontscale/' utility. <tscreen><verb> -4 -cour.pfa -adobe-courier-medium-r-normal-0-0-0-0-p-0-iso8859-1 -cour.pfa -adobe-courier-medium-r-normal-0-0-0-0-p-0-iso8859-2 -couri.pfa -adobe-courier-medium-i-normal-0-0-0-0-p-0-iso8859-1 -couri.pfa -adobe-courier-medium-i-normal-0-0-0-0-p-0-iso8859-2 -</verb></tscreen> -The first line indicates the number of entries in the file. -Each line after the first consists of two fields separated by a space; -the first field is the name of the font file, and the second one is -the name under which the font will appear to the server. This name -should obey the X Logical Font Description conventions (see Section -<ref id="sec:xlfd" name="The X Logical Font Description">). The -format of this file is fully described in the <tt/mkfontdir/(1) manual -page. - -Note that multiple lines may point at the same font file. This is -most commonly done in order to make a single font available under -multiple encodings; please see Section -<ref id="sec:internationalisation" name="Fonts and internationalisation">. - -While it is possible to create the `<tt/fonts.scale/' file by hand, it -is simpler and more convenient to have it generated automatically. -Utilities to perform this task are available, but are not currently -included with XFree86. For Type 1 fonts, you may use a utility -called `<tt/type1inst/' which is available from -<url url="http://www.ibiblio.org/pub/Linux/X11/xutils/" name="standard -Free Software repositories"> throughout the world. - -For TrueType fonts, you may use `<tt/ttmkfdir/', available from -<url name="Joerg Pommnitz's xfsft page" - url="http://www.joerg-pommnitz.de/TrueType/xfsft.html">. - -After the `<tt/fonts.scale/' is created, you may run `<tt/mkfontdir/' as -above; this time, however, you need to create an index of encoding -files called `<tt>encodings.dir</tt>' in addition to the -`<tt>fonts.dir</tt>' file. This is done by using `<tt/mkfontdir/' with -the `<tt/-e/' flag: -<tscreen><verb> -$ cd /usr/local/share/fonts/Type1 -$ mkfontdir -e /usr/X11R6/lib/font/encodings -</verb></tscreen> -For more information, please see the <tt/mkfontdir/(1) manual page and -Section <ref id="sec:internationalisation" name="Fonts and -internationalisation"> later in this document. +$ mkfontscale /usr/local/share/fonts/Type1/ +$ mkfontdir /usr/local/share/fonts/Type1/ +</verb></tscreen> +Under some circumstances, it may be necessary to modify the +`<tt/fonts.scale/' file generated by <tt/mkfontscale/; for more +information, please see the <htmlurl name="mkfontdir(1)" +url="mkfontdir.1.html"> and <htmlurl name="mkfontscale(1)" +url="mkfontscale.1.html"> manual pages and <ref +id="sec:internationalisation" name="Core fonts and internationalisation"> +later in this document. -<sect1>Installing CID-keyed fonts <label id="sec:cid-fonts"> +<sect2>Installing CID-keyed fonts <label id="sec:cid-fonts"> <p>The CID-keyed font format was designed by Adobe Systems for fonts with large character sets. A CID-keyed font, or CIDFont for short, contains a collection of glyphs indexed by <it/character ID/ (CID). -Adobe make some sample CIDFonts and a complete set of CMaps -available from -<url name="O'Reilly's FTP site" - url="ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/">. - In order to map such glyphs to meaningful indices, Adobe provide a set of <it/CMap/ files. The PostScript name of a font generated from a CIDFont consists of the name of the CIDFont and the name of the CMap @@ -158,7 +294,7 @@ Munhwa-Regular--UniKS-UCS2-H </verb></tscreen> -The CIDFont support in XFree86 requires a very rigid directory +The CIDFont code in XFree86 requires a very rigid directory structure. The main directory must be called `<tt/CID/' (its location defaults to `<tt>/usr/X11R6/lib/X11/fonts/CID</tt>' but it may be located anywhere), and it should contain a subdirectory for every CID @@ -187,7 +323,7 @@ Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \ -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1 </verb></tscreen> -(both names on the same line). As above, running `<tt/mkfontdir/' +(both names on the same line). Running `<tt/mkfontdir/' creates the `<tt/fonts.dir/' file: <tscreen><verb> $ cd /usr/local/share/fonts/CID @@ -205,11 +341,11 @@ fonts, or when the CID-keyed fonts are copied to a machine with a different architecture. -<sect1>Setting the server's font path <label id="sec:set-font-path"> +<sect2>Setting the server's font path <label id="sec:set-font-path"> <p>The list of directories where the server looks for fonts is known as the <it/font path/. Informing the server of the existence of a new -font directory consists in putting it on the font path. +font directory consists of putting it on the font path. The font path is an ordered list; if a client's request matches multiple fonts, the first one in the font path is the one that gets @@ -229,7 +365,7 @@ $ xset q </verb></tscreen> -<sect2>Temporary modification of the font path +<sect3>Temporary modification of the font path <p>The `<tt/xset/' utility may be used to modify the font path for the current session. The font path is set with the command <tt/xset fp/; @@ -242,35 +378,40 @@ Conversely, an element may be removed from the front of the font path with `<tt/xset -fp/', and removed from the end with `<tt/xset fp-/'. +You may reset the font path to its default value with +`<tt/xset fp default/'. -For more information, please consult the <tt/xset/(1) manual page. +For more information, please consult the <htmlurl name="xset(1)" +url="xset.1.html"> manual page. -<sect2>Permanent modification of the font path +<sect3>Permanent modification of the font path -<p>The default font path (the one used just after server startup) is -specified in the X server's `<tt/XF86Config/' file. It is computed by -appending all the directories mentioned in the `<tt/FontPath/' entries -of the `<tt/Files/' section in the order in which they appear. +<p>The default font path (the one used just after server startup or +after `<tt/xset fp default/') is specified in the X server's +`<tt/XF86Config/' file. It is computed by appending all the +directories mentioned in the `<tt/FontPath/' entries of the +`<tt/Files/' section in the order in which they appear. <tscreen><verb> FontPath "/usr/local/fonts/Type1" ... FontPath "/usr/local/fonts/bitmap" </verb></tscreen> -For more information, please consult the `<tt/XF86Config/'(5) manual -page. +For more information, please consult the <htmlurl name="XF86Config(5)" +url="XF86Config.5.html"> manual page. -<sect1>Troubleshooting <label id="sec:troubleshooting"> +<sect2>Troubleshooting <label id="sec:troubleshooting-core"> <p>If you seem to be unable to use some of the fonts you have installed, the first thing to check is that the `<tt/fonts.dir/' files -are correct and that they are readable by the server. If this doesn't -help, it is quite possible that you are trying to use a font in a -format that is not supported by your server. - -XFree86 supports the BDF, PCF, SNF, Type 1, Speedo, TrueType and -CIDFont font formats. However, not all XFree86 servers come with all -the font backends configured in. +are correct and that they are readable by the server (the X server +usually runs as root, beware of NFS-mounted font directories). If +this doesn't help, it is quite possible that you are trying to use a +font in a format that is not supported by your server. + +XFree86 supports the BDF, PCF, SNF, Type 1, Speedo, TrueType, OpenType +and CIDFont font formats. However, not all XFree86 servers come with +all the font backends configured in. On most platforms, the XFree86 servers are <it/modular/: the font backends are included in modules that are loaded at runtime. The @@ -286,12 +427,14 @@ <itemize> <item> <tt/"bitmap"/: bitmap fonts (`<tt/*.bdf/', `<tt/*.pcf/' and `<tt/*.snf/'); -<item> <tt/"type1"/: Type 1 fonts (`<tt/*.pfa/' and -`<tt/*.pfb/') and CIDFonts; -<item> <tt/"speedo"/: Bitstream Speedo fonts (`<tt/*.spd/'); -<item> <tt/"freetype"/: TrueType fonts (`<tt/*.ttf/' and `<tt/*.ttc/'); +<item> <tt/"freetype"/: TrueType fonts (`<tt/*.ttf/' and +`<tt/*.ttc/'), OpenType fonts (`<tt/*.otf/' and `<tt/*.otc/') and +Type 1 fonts (`<tt/*.pfa/' and `<tt/*.pfb/'); +<item> <tt/"type1"/: alternate Type 1 backend (`<tt/*.pfa/' and +`<tt/*.pfb/') and CIDFont backend; <item> <tt/"xtt"/: alternate TrueType backend (`<tt/*.ttf/' and -`<tt/*.ttc/'). +`<tt/*.ttc/'); +<item> <tt/"speedo"/: Bitstream Speedo fonts (`<tt/*.spd/'). </itemize> Please note that the argument of the `<tt/Load/' directive is case-sensitive. @@ -300,14 +443,15 @@ <sect1>Standard bitmap fonts -<p>The Sample Implementation of X11 comes with a large number of +<p>The Sample Implementation of X11 (SI) comes with a large number of bitmap fonts, including the `<tt/fixed/' family, and bitmap versions -of Courier, Times and Helvetica. In the SI, these fonts are provided -in the ISO 8859-1 encoding (ISO Latin Western-European). +of Courier, Times, Helvetica and some members of the Lucida family. In +the SI, these fonts are provided in the ISO 8859-1 encoding (ISO +Latin Western-European). In XFree86, a number of these fonts are provided in Unicode-encoded font files instead. At build time, these fonts are split into font -files encoded according to legacy encodings, a process which enables +files encoded according to legacy encodings, a process which allows us to provide the standard fonts in a number of regional encodings with no duplication of work. @@ -321,7 +465,7 @@ </verb></tscreen> is a Unicode-encoded version of the standard `<tt/fixed/' font with added support for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA -and other scripts plus numerous technical symbols. It contains over +and other scripts plus numerous technical symbols. It contains over 2800 glyphs, covering all characters of ISO 8859 parts 1-5, 7-10, 13-15, as well as all European IBM and Microsoft code pages, KOI8, WGL4, and the repertoires of many other character sets. @@ -330,29 +474,14 @@ <tscreen><verb> 6x13-ISO8859-1.bdf 6x13-ISO8859-2.bdf -6x13-ISO8859-3.bdf -6x13-ISO8859-4.bdf -6x13-ISO8859-5.bdf -6x13-ISO8859-7.bdf -6x13-ISO8859-8.bdf -6x13-ISO8859-9.bdf -6x13-ISO8859-10.bdf -6x13-ISO8859-13.bdf +... 6x13-ISO8859-15.bdf 6x13-KOI8-R.bdf </verb></tscreen> with respective XLFDs <tscreen><verb> -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-2 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-3 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-4 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-5 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-7 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-8 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-9 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-10 --misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-13 +... -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15 -misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r </verb></tscreen> @@ -361,10 +490,6 @@ -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1 </verb></tscreen> -(The conversion of the standard fonts to Unicode was mainly performed -by Markus Kuhn. Markus is a man of taste, which makes his use of Perl -in the conversion process somewhat surprising.) - <sect1>The ClearlyU Unicode font family <p>The ClearlyU family of fonts provides a set of 12 pt, @@ -403,10 +528,6 @@ The <it/Ligature/ font contains ligatures for various scripts that may be useful for improved presentation of text. -(The ClearlyU family was designed by Mark Leisher. Mark's usage of -the foundry name <it/mutt/ predates the mailer of the same name, but -he won't say more.) - <sect1>Standard scalable fonts <p>XFree86 includes all the scalable fonts distributed with X11R6. @@ -449,8 +570,8 @@ <p>XFree86 includes Speedo versions of the Bitstream Courier and Charter fonts. In order to use these fonts, you should ensure that -your X server is loading the `<tt/Speedo/' font backend; see Section -<ref id="sec:troubleshooting" name="Troubleshooting">. +your X server is loading the `<tt/Speedo/' font backend; see +<ref id="sec:troubleshooting-core" name="Troubleshooting">. These fonts cover all of ISO 8859-1 and almost all of ISO 8859-2. They have XLFD name @@ -485,14 +606,14 @@ range and some additional punctuation characters. In particular, these fonts include all the glyphs needed for ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the Adobe Standard -encoding and the Windows 3.1 character set. +encoding and the Windows 3.1 character set. The glyph coverage of the Type 1 versions is somewhat reduced, and only covers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding. The Luxi fonts are original designs by Kris Holmes and Charles -Bigelow. Luxi fonts include seriffed, sans serif, and monospaced +Bigelow. Luxi fonts include seriffed, sans serif, and monospaced styles, in roman and oblique, and normal and bold weights. The fonts share stem weight, x-height, capital height, ascent and descent, for graphical harmony. @@ -519,13 +640,18 @@ An earlier version of the Luxi fonts was made available under the name <em/Lucidux/. This name should no longer be used due to trademark uncertainties, and all traces of the <em/Lucidux/ name have been -removed from this version of XFree86. +removed from XFree86. + +<sect>More about core fonts <label id="sec:more-core"> + +<p>This section describes XFree86-specific enhancements to the core +X11 fonts system. -<sect>Fonts and internationalisation <label id="sec:internationalisation"> +<sect1>Core fonts and internationalisation <label id="sec:internationalisation"> <p>The scalable font backends (Type 1, Speedo and TrueType) can -now automatically re-encode fonts to the encoding specified in the -XLFD in <tt/fonts.dir/. For example, a <tt/fonts.dir/ file can +automatically re-encode fonts to the encoding specified in the +XLFD in `<tt/fonts.dir/'. For example, a `<tt/fonts.dir/' file can contain entries for the Type 1 Courier font such as <tscreen><verb> cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 @@ -534,7 +660,7 @@ which will lead to the font being recoded to ISO 8859-1 and ISO 8859-2 respectively. -<sect1>The <it/fontenc/ layer <label id="sec:fontenc"> +<sect2>The <it/fontenc/ layer <label id="sec:fontenc"> <p>Three of the scalable backends (Type 1, Speedo, and the <it/FreeType/ TrueType backend) use a common <it/fontenc/ layer for @@ -545,10 +671,9 @@ <it/Please note:/ the X-TrueType (X-TT) backend does not use the <it/fontenc/ layer, but instead uses its own method for font reencoding. If you are only interested in X-TT you may want to skip -to Section <ref id="sec:symbol-fonts" name="Using Symbol Fonts">, as +to <ref id="sec:symbol-fonts" name="Using Symbol Fonts">, as the intervening information does not apply to X-TT. X-TT itself is -described in more detail in Section <ref id="sec:X-TT" -name="X-TrueType">. +described in more detail in <ref id="sec:X-TT" name="X-TrueType">. In the <it/fontenc/ layer, an encoding is defined by a name (such as <tt/iso8859-1/), possibly a number of aliases (alternate names), and @@ -576,7 +701,7 @@ Western-European); <item> <tt/koi8-r/: KOI8 Russian; <item> <tt/koi8-u/: KOI8 Ukrainian (see RFC 2319); -<item> <tt/koi8-ru/: KOI8 Russian/Ukrainian +<item> <tt/koi8-ru/: KOI8 Russian/Ukrainian; <item> <tt/koi8-uni/: KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian); <item> <tt/koi8-e/: KOI8 ``European,'' ISO-IR-111, or ECMA-Cyrillic; @@ -592,68 +717,67 @@ the requested encoding, and the relevant encoding definition file is read in. The `<tt/mkfontdir/' utility, when invoked with the `<tt/-e/' option followed by the name of a directory containing -encoding files, can be used to automatically build -`<tt/encodings.dir/' files. See the <tt/mkfontdir/(1) manual page for -more details. +encoding files, can be used to automatically build `<tt/encodings.dir/' +files. Please see the <htmlurl name="mkfontdir(1)" url="mkfontdir.1.html"> +manual page for more details. A number of encoding files for common encodings are included with XFree86. Information on writing new encoding files can be found in -Section <ref id="sec:format-encoding-directory-files" name="Format of +<ref id="sec:format-encoding-directory-files" name="Format of encodings directory files"> and <ref id="sec:format-encoding-files" name="Format of encoding files"> later in this document. -<sect1>Backend-specific notes about fontenc +<sect2>Backend-specific notes about fontenc -<sect2>Type 1 +<sect3>The <it/FreeType/ backend <label id="sec:fontenc-freetype" -<p>The Type 1 backend first searches for a mapping with a target -of PostScript. If one is found, it is used. Otherwise, the -backend searches for a mapping with target Unicode, which is then -composed with a built-in table mapping codes to glyph names. Note -that this table only covers part of the Unicode code points that have -been assigned names by Adobe. +<p>For TrueType and OpenType fonts, the FreeType backend scans the +mappings in order. Mappings with a target of PostScript are ignored; +mappings with a TrueType or Unicode target are checked against all the +cmaps in the file. The first applicable mapping is used. + +For Type 1 fonts, the FreeType backend first searches for a +mapping with a target of PostScript. If one is found, it is used. +Otherwise, the backend searches for a mapping with target Unicode, +which is then composed with a built-in table mapping codes to glyph +names. Note that this table only covers part of the Unicode code +points that have been assigned names by Adobe. + +Specifying an encoding value of <tt/adobe-fontspecific/ for a +Type 1 font disables the encoding mechanism. This is useful with +symbol and incorrectly encoded fonts (see <ref +id="sec:incorrect-encoding" name="Incorrectly encoded fonts"> below). -If neither a PostScript or Unicode mapping is found, the backend -defaults to ISO 8859-1. +If a suitable mapping is not found, the FreeType backend defaults to +ISO 8859-1. -Specifying an encoding value of <tt/adobe-fontspecific/ disables -the encoding mechanism. This is useful with symbol and incorrectly -encoded fonts (see Section -<ref id="sec:incorrect-encoding" name="Incorrectly encoded fonts"> -below). +<sect3>Type 1 -The Type 1 backend currently limits all encodings to 8-bit codes. +<p>The Type 1 backend behaves similarly to the FreeType backend +with Type 1 fonts, except that it limits all encodings to 8-bit +codes. -<sect2>Speedo +<sect3>Speedo <p>The Speedo backend searches for a mapping with a target of Unicode, and uses it if found. If none is found, the backend defaults to ISO 8859-1. The Speedo backend limits all encodings to 8-bit codes. - -<sect2>The <it/FreeType/ TrueType backend <label id="sec:fontenc-freetype" -<p>The TrueType backend scans the mappings in order. Mappings with a -target of PostScript are ignored; mappings with a TrueType or Unicode -target are checked against all the cmaps in the file. The first -applicable mapping is used. - -If you are writing an encoding file to be used with the TrueType -backend, you should ensure that mappings are mentioned in decreasing -order of preference. +<sect2>Format of encoding directory files <label id="sec:format-encoding-directory-files"> -<sect1>Format of encoding directory files <label id="sec:format-encoding-directory-files"> - <p>In order to use a font in an encoding that the font backend does -not know about, you need to have an `<tt/encodings.dir/' file in the -same directory as the font file used. The `<tt/encodings.dir/' file -has a similar format to `<tt/fonts.dir/'. Its first line specifies -the number of encodings, while every successive line has two columns, -the name of the encoding, and the name of the encoding file; this can -be relative to the current directory, or absolute. Every encoding -name should agree with the encoding name defined in the encoding file. -For example, +not know about, you need to have an `<tt/encodings.dir/' file either +in the same directory as the font file used or in a system-wide +location (`<tt>/usr/X11R6/lib/X11/fonts/encodings/</tt>' by default). + +The `<tt/encodings.dir/' file has a similar format to +`<tt/fonts.dir/'. Its first line specifies the number of encodings, +while every successive line has two columns, the name of the encoding, +and the name of the encoding file; this can be relative to the current +directory, or absolute. Every encoding name should agree with the +encoding name defined in the encoding file. For example, <tscreen><verb> 3 @@ -670,10 +794,10 @@ compressed or gzipped. The `<tt/encoding.dir/' files are best maintained by the -`<tt/mkfontdir/' utility. Please see the <tt/mkfontdir/(1) manual -page for more information. +`<tt/mkfontdir/' utility. Please see the <htmlurl name="mkfontdir(1)" +url="mkfontdir.1.html"> manual page for more information. -<sect1>Format of encoding files <label id="sec:format-encoding-files"> +<sect2>Format of encoding files <label id="sec:format-encoding-files"> <p>The encoding files are ``free form,'' <it/i.e./ any string of whitespace is equivalent to a single space. Keywords are parsed in a @@ -693,7 +817,6 @@ <tscreen><verb> STARTENCODING mulearabic-0 ALIAS arabic-0 -ALIAS something-else </verb></tscreen> The name of the encoding and its aliases should be suitable for use in an XLFD font name, and therefore contain exactly one dash `<tt/-/'. @@ -818,7 +941,7 @@ starting with an unknown keyword are silently ignored, as are mapping sections with an unknown target. -<sect1>Using symbol fonts <label id="sec:symbol-fonts"> +<sect2>Using symbol fonts <label id="sec:symbol-fonts"> <p>Type 1 symbol fonts should be installed using the <tt/adobe-fontspecific/ encoding. @@ -833,22 +956,23 @@ Type 1 and TrueType versions of the same font), it is possible to define a special encoding for a given font. This has already been done for the <tt/ZapfDingbats/ font; see the file -<tt>encodings/adobe-dingbats.enc</tt>. +`<tt>encodings/adobe-dingbats.enc</tt>'. -<sect1>Hints about using badly encoded fonts <label id="sec:incorrect-encoding"> +<sect2>Hints about using badly encoded fonts <label id="sec:incorrect-encoding"> <p>A number of text fonts are incorrectly encoded. Incorrect encoding is sometimes done by design, in order to make a font for an exotic -script appear like an ordinary Western text font. It is often the -result of the font designer's laziness or incompetence; for some -reason, most people seem to find it easier to invent idiosyncratic -glyph names rather than follow the Adobe glyph list. +script appear like an ordinary Western text font on systems which are +not easily extended with new locale data. It is often the result of +the font designer's laziness or incompetence; for some reason, most +people seem to find it easier to invent idiosyncratic glyph names +rather than follow the Adobe glyph list. There are two ways of dealing with such fonts: using them with the encoding they were designed for, and creating an <it/ad hoc/ encoding file. -<sect2>Using fonts with the designer's encoding +<sect3>Using fonts with the designer's encoding <p>In the case of Type 1 fonts, the font designer can specify a default encoding; this encoding is requested by using the @@ -865,13 +989,13 @@ `<tt/microsoft-win3.1/', or `<tt/apple-roman/' should yield reasonable results. -<sect2>Specifying an <it/ad hoc/ encoding file +<sect3>Specifying an <it/ad hoc/ encoding file <p>It is always possible to define an encoding file to put the glyphs in a font in any desired order. Again, see the `<tt>encodings/adobe-dingbats.enc</tt>' file to see how this is done. -<sect2>Specifying font aliases +<sect3>Specifying font aliases <p>By following the directions above, you will find yourself with a number of fonts with unusual names --- with encodings such as @@ -880,39 +1004,31 @@ remap them to their proper names. This is done by writing a `<tt/fonts.alias/' file. The format of this file -is similar to the format of the `<tt/fonts.dir/' file, except that it maps -XLFD names to XLFD names. A `<tt/fonts.alias/' file might look as follows: +is very simple: it consists of a series of lines each mapping an alias +name to a font name. A `<tt/fonts.alias/' file might look as follows: <tscreen><verb> -1 "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \ "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific" </verb></tscreen> (both XLFD names on a single line). The syntax of the -`<tt/fonts.alias/' file is precisely described in the -<tt/mkfontdir/(1) manual page. +`<tt/fonts.alias/' file is more precisely described in the +<htmlurl name="mkfontdir(1)" url="mkfontdir.1.html"> manual page. -<sect>Additional notes about TrueType support +<sect1>Additional notes about scalable core fonts -<p>This version of XFree86 comes with two TrueType backends, -<it/FreeType/ (module `<tt/freetype/', formerly known as <it/xfsft/) and -<it/X-TrueType/ (module `<tt/xtt/'). These two backends are <it/not/ -compatible: only one of them can be used at any one time. +<p>The FreeType backend (module `<tt/freetype/', formerly known +as <it/xfsft/) is able to deal with both TrueType and Type 1 +fonts. This puts it in conflict with the X-TT and Type 1 +backends respectively. -In order to use the <it/FreeType/ backend, please check that the -`<tt/Module/' section of your `<tt/XF86Config/' file contains a line -that reads -<tscreen><verb> -Load "freetype" -</verb></tscreen> +If both the FreeType and the Type 1 backends are loaded, the +FreeType backend will be used for Type 1 fonts. If both the +FreeType and X-TT backends are loaded, X-TT will be used for TrueType +fonts. -In order to use the <it/X-TrueType/ backend, replace the line in your -<tt/XF86Config/ file that loads the <tt/freetype/ module with a -line that reads -<tscreen><verb> - Load "xtt" -</verb></tscreen> +<sect2>Delayed glyph rasterisation -Both TrueType backends delay glyph rasterisation up to the time at +<p>Both FreeType and X-TT delay glyph rasterisation up to the time at which a glyph is first used. For this reason, they only provide an approximate value for the ``average width'' font property. @@ -927,14 +1043,17 @@ encouraged to make use of this optimisation when useful, but be warned that not all monospaced fonts are character-cell fonts. -<sect1>The <it/FreeType/ TrueType backend +<sect2>About the <it/FreeType/ backend -<p>The <it/FreeType/ backend (formerly <it/xfsft/) is a backend based on -the FreeType library (see <url url="http://www.freetype.org/" -name="the FreeType web site">) and has support for the ``fontenc'' -style of internationalisation (see Section <ref id="sec:fontenc" -name="The fontenc layer">). This backend supports TrueType Font files -(`<tt/*.ttf/') and TrueType Collections (`<tt/*.ttc/'). +<p>The <it/FreeType/ backend (formerly <it/xfsft/) is a backend based +on version 2 of the FreeType library (see <url +url="http://www.freetype.org/" name="the FreeType web site">) and has +support for the ``fontenc'' style of internationalisation (see +<ref id="sec:fontenc" name="The fontenc layer">). This backend +supports TrueType font files (`<tt/*.ttf/'), OpenType font files +(`<tt/*.otf/'), TrueType Collections (`<tt/*.ttc/'), OpenType +Collections (`<tt/*.otc/') and Type 1 font files (`<tt/*.pfa/' and +`<tt/*.pfb/'). In order to access the faces in a TrueType Collection file, the face number must be specified in the fonts.dir file before the filename @@ -945,21 +1064,21 @@ refers to face 2 in the `<tt/mincho.ttc/' TrueType Collection file. The <it/FreeType/ backend uses the <it/fontenc/ layer in order to -support recoding of fonts; this was described in Section <ref -id="sec:fontenc" name="The fontenc layer"> and especially Section <ref +support recoding of fonts; this was described in <ref +id="sec:fontenc" name="The fontenc layer"> and especially <ref id="sec:fontenc-freetype" name="FreeType-specific notes about fontenc"> earlier in this document. -<sect1>The <it/X-TrueType/ TrueType backend <label id="sec:X-TT"> +<sect2>About the <it/X-TrueType/ TrueType backend <label id="sec:X-TT"> -<p>The `X-TrueType' backend is another backend based on the FreeType -library. X-TrueType doesn't use the `fontenc' layer for managing font -encodings, but instead uses its own database of encodings. However, -X-TrueType includes a large number of encodings, and any encoding you -need is likely to be present in X-TrueType. +<p>The `X-TrueType' backend is a backend based on version 1 of the +FreeType library. X-TrueType doesn't use the `fontenc' layer for +managing font encodings, but instead uses its own database of +encodings. X-TrueType extends the `<tt/fonts.dir/' syntax with a number of options, -known as `TTCap'. A `TTCap' entry follows the general syntax +collectively known as `TTCap'. A `TTCap' entry follows the general +syntax <tscreen><verb> :option=value: </verb></tscreen> @@ -981,29 +1100,28 @@ <p>A computer text-processing system inputs keystrokes and outputs <it/glyphs/, small pictures that are assembled on paper or on a computer screen. Keystrokes and glyphs do not, in general, coincide: -for example, if the system does generate ligatures, then to the two -keystrokes <<tt/f/><<tt/i/> will typically correspond a -single glyph. Similarly, if the system shapes Arabic glyphs in a -reasonable manner, then multiple different glyphs may correspond to -a single keystroke. +for example, if the system does generate ligatures, then to the +sequence of two keystrokes <<tt/f/><<tt/i/> will typically +correspond a single glyph. Similarly, if the system shapes Arabic +glyphs in a vaguely reasonable manner, then multiple different glyphs +may correspond to a single keystroke. The complex transformation rules from keystrokes to glyphs are usually -factored into two simpler transformations, going through the -intermediary of <it/characters/. You may want to think of characters -as the basic unit of data that is stored <it/e.g./ in the buffer of -your text editor. While the definition of a character is intrinsically -application-specific, a number of standardised collections of -characters have been defined. +factored into two simpler transformations, from keystrokes to +<it/characters/ and from characters to glyphs. You may want to think +of characters as the basic unit of text that is stored <it/e.g./ in +the buffer of your text editor. While the definition of a character +is intrinsically application-specific, a number of standardised +collections of characters have been defined. A <it/coded character set/ is a set of characters together with a mapping from integer codes --- known as <it/codepoints/ --- to characters. Examples of coded character sets include US-ASCII, ISO 8859-1, KOI8-R, and JIS X 0208(1990). -A coded character set need not use 8 bit integers to index -characters. Many early mainframes used 6 bit character sets, while -16 bit (or more) character sets are necessary for ideographic writing -systems. +A coded character set need not use 8 bit integers to index characters. +Many early systems used 6 bit character sets, while 16 bit (or more) +character sets are necessary for ideographic writing systems. <sect1>Font files, fonts, and XLFD <label id="sec:xlfd"> @@ -1012,7 +1130,7 @@ Times Italic, while a fount is a molten-lead incarnation of a given typeface at a given size. -Digital fonts come in <it/font files/. A font file contains all the +Digital fonts come in <it/font files/. A font file contains the information necessary for generating glyphs of a given typeface, and applications using font files may access glyph information in an arbitrary order. @@ -1022,7 +1140,7 @@ description of glyph shapes, in which case they are said to be <it/scalable fonts/. Common formats for scalable font files are <it/Type 1/ (sometimes incorrectly called <it/ATM fonts/ or -<it/PostScript fonts/), <it/Speedo/ and <it/TrueType/. +<it/PostScript fonts/), <it/TrueType/ and <it/Speedo/. The glyph data in a digital font needs to be indexed somehow. How this is done depends on the font file format. In the case of @@ -1030,31 +1148,36 @@ case of TrueType fonts, glyphs are indexed by integers corresponding to one of a number of indexing schemes (usually Unicode --- see below). -The X11 system uses the data in font file to generate <it/font -instances/, which are collections of glyphs at a given size indexed -according to a given encoding. - -X11 font instances are usually specified using a notation known as the -<it/X Logical Font Description/ (XLFD). An XLFD starts with a dash -`<tt/-/', and consists of fourteen fields separated by dashes, for -example +The X11 core fonts system uses the data in a font file to generate +<it/font instances/, which are collections of glyphs at a given size +indexed according to a given encoding. + +X11 core font instances are usually specified using a notation known +as the <it/X Logical Font Description/ (XLFD). An XLFD starts with a +dash `<tt/-/', and consists of fourteen fields separated by dashes, +for example: <tscreen><verb> --adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 +-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1 </verb></tscreen> Or particular interest are the last two fields `<tt/iso8859-1/', which specify the font instance's encoding. +A scalable font is specified by an XLFD which contains zeroes instead +of some fields: +<tscreen><verb> +-adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 +</verb></tscreen> + X11 font instances may also be specified by short name. Unlike an XLFD, a short name has no structure and is simply a conventional name for a font instance. Two short names are of particular interest, as -they are handled specially by the server, and the server will not -start if font instances with these names cannot be opened. These are -`<tt/fixed/', which specifies the fallback font to use when the -requested font cannot be opened, and `<tt/cursor/', which specifies -the set of glyphs to be used by the mouse pointer. +the server will not start if font instances with these names cannot be +opened. These are `<tt/fixed/', which specifies the fallback font to +use when the requested font cannot be opened, and `<tt/cursor/', which +specifies the set of glyphs to be used by the mouse pointer. Short names are usually implemented as aliases to XLFDs; the -`<tt/fixed/' and `<tt/cursor/' aliases are defined in +standard `<tt/fixed/' and `<tt/cursor/' aliases are defined in <tscreen><verb> /usr/X11R6/lib/X11/font/misc/fonts.alias </verb></tscreen> @@ -1070,40 +1193,59 @@ Unicode is an <it/open/ character set, meaning that codepoint assignments may be added to Unicode at any time (once specified, though, an assignment can never be changed). For this reason, a -Unicode font will be <it/sparse/, and only define glyphs for a subset -of the character registry of Unicode. +Unicode font will be <it/sparse/, meaning that it only defines glyphs +for a subset of the character registry of Unicode. The Unicode standard is defined in parallel with the international standard ISO 10646. Assignments in the two standards are always -equivalent, and this document uses the terms <it/Unicode/ and +equivalent, and we often use the terms <it/Unicode/ and <it/ISO 10646/ interchangeably. -When used in X11, Unicode-encoded fonts should have the last two -fields of their XLFD set to `<tt/iso10646-1/'. +When used in the X11 core fonts system, Unicode-encoded fonts should +have the last two fields of their XLFD set to `<tt/iso10646-1/'. <sect>References <p>XFree86 comes with extensive documentation in the form of manual -pages and typeset documents. Before installing fonts, you really -should read the <tt/mkfontdir/(1) manual page; other manual pages of -interest include <tt/X/(1), <tt/Xserver/(1), <tt/xset/(1), -<tt/xlsfonts/(1) and <tt/showfont/(1). In addition, you may want to -read the X Logical Font Description document, by Jim Flowers, which is -provided in the file `<tt>xc/doc/xlfd.PS.Z</tt>'. +pages and typeset documents. Before installing fonts, you really should +read the <htmlurl name="fontconfig(3)" url="fontconfig.3.html"> and +<htmlurl name="mkfontdir(1)" url="mkfontdir.1.html"> manual pages; other +manual pages of interest include <htmlurl name="X(7)" url="X.7.html">, +<htmlurl name="Xserver(1)" url="Xserver.1.html">, <htmlurl name="xset(1)" +url="xset.1.html">, <htmlurl name="Xft(3)" url="Xft.3.html">, <htmlurl +name="xlsfonts(1)" url="xlsfonts.1.html"> and <htmlurl name="showfont(1)" +url="showfont.1.html">. In addition, you may want to read the X Logical +Font Description document, by Jim Flowers, which is provided in the file +`<tt>xc/doc/xlfd.PS.Z</tt>'. + +The latest released version of the XFree86 documentation (including +this document and all manual pages) is available as +<url name="current XFree86 documentation" + url="http://www.xfree86.org/current/">. The <url name="comp.fonts FAQ" -url="http://www.netmeg.net/faq/computers/fonts/">, which is -unfortunately no longer being maintained, contains a wealth of -information about digital fonts. + url="http://www.netmeg.net/faq/computers/fonts/">, +which is unfortunately no longer being maintained, contains a wealth +of information about digital fonts. + +Xft and Fontconfig are described on +<url name="Keith Packard's Fontconfig site" + url="http://www.fontconfig.org">. The <url name="xfsft home page" url="http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/"> has been superseded by this document, and is now obsolete; you may -however still find some of the information it contains useful. <url -name="Joerg Pommnitz' xfsft page" -url="http://www.joerg-pommnitz.de/TrueType/xfsft.html"> is the -canonical source for the `<tt/ttmkfdir/' utility. +however still find some of the information that it contains useful. +<url name="Joerg Pommnitz' xfsft page" + url="http://www.joerg-pommnitz.de/TrueType/xfsft.html"> +is the canonical source for the `<tt/ttmkfdir/' utility, which is the +ancestor of <tt/mkfontscale/. + +<url name="The author's software pages" + url="http://www.pps.jussieu.fr/~jch/software/"> +might or might not contain related scribbles and development versions +of software. The documentation of <it/X-TrueType/ is available from <url url="http://x-tt.dsl.gr.jp/" name="the X-TrueType home page">. @@ -1112,15 +1254,14 @@ <url name="O'Reilly's FTP site" url="ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/">. -The <url url="http://www.unicode.org" name="Unicode consortium site"> -may be of interest. But you are more likely to find what you need on +While the <url url="http://www.unicode.org" name="Unicode consortium site"> +may be of interest, you are more likely to find what you need in Markus Kuhn's <url url="http://www.cl.cam.ac.uk/~mgk25/unicode.html" name="UTF-8 and Unicode FAQ">. The IANA RFC documents, available from a number of sites throughout the world, often provide interesting information about character set -issues; my favourite is RFC 373. +issues; see for example RFC 373. </article> -<!-- Who was it who wrote the Linuxdoc DTD, and was he drunk at the - time ? --> +<!-- Who was it who designed Linuxdoc, and was he drunk at the time? --> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre:1.13 xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre:1.19 --- xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre:1.13 Tue Jan 15 16:24:46 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre Sun Feb 23 22:41:25 2003 @@ -8,10 +8,10 @@ <!-- Title information --> <title>Documentation for XFree86™ version &relvers; <author>The XFree86 Project, Inc -<date>18 January 2002 +<date>27 February 2003 <!-- -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre,v 1.13 2002/01/15 21:24:46 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre,v 1.19 2003/02/24 03:41:25 dawes Exp $ --> <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml:1.11 xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml:1.13 --- xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml:1.11 Tue Feb 29 19:25:23 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml Tue Dec 17 15:55:22 2002 @@ -5,10 +5,10 @@ <article> <title>Mouse Support in XFree86 <author>Kazutaka Yokota -<date>9 February 2000 +<date>17 December 2002 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.11 2000/03/01 00:25:23 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.13 2002/12/17 20:55:22 dawes Exp $ </ident> <toc> @@ -350,7 +350,7 @@ <itemize> <item><tt>GlidePoint</tt> <item><tt>IntelliMouse</tt> - <item><tt>Logictech</tt> + <item><tt>Logitech</tt> <item><tt>Microsoft</tt> <item><tt>MMHittab</tt> <item><tt>MMSeries</tt> @@ -493,6 +493,36 @@ Not all mice and OSs can support this option. This option can be set in the <tt>XF86Setup</tt> program. +<sect1>Drag Lock Buttons <p> +Some people find it difficult or inconvenient to hold a trackball +button down, while at the same time moving the ball. Drag lock buttons +simulate the holding down of another button. When a drag lock button +is first pressed, its target buttons is "locked" down until the +second time the lock button is released, or until the button itself +is pressed and released. This allows the starting of a drag, the movement +of the trackball, and the ending of the drag to be separate operations. + +<verb> + Option "DragLockButtons" "W X Y Z" +</verb> + +This option consists of pairs of buttons. Each lock button number +is followed by the number of the button that it locks. In the above, +button number "W" is a drag lock button for button "X" and button number +"Y" is a drag lock button for button "Z". + +It may not be desirable to use multiple buttons as drag locks. +Instead, a "master drag lock button" may be defined. A master drag +lock button acts as a "META" key. After a master lock button is released, +the next button pressed is "locked" and not released until the +second time the real button is released. + +<verb> + Option "DragLockButtons" "M" +</verb> + +Since button "M" is unpaired it is a master drag lock button. + <sect>Mouse Gallery <p> In all of the examples below, it is assumed that <tt>/dev/mouse</tt> is @@ -571,9 +601,10 @@ Option "Protocol" "Auto" </verb> -<sect1>Kensington Thinking Mouse (serial, PS/2) <p> -This mouse has four buttons. -Thinking Mouse supports the PnP COM device specification. +<sect1>Kensington Thinking Mouse and Kensington Expert Mouse (serial, PS/2) <p> +These mice have four buttons. +The Kensington Expert Mouse is really a trackball. +Both Thinking mice support the PnP COM device specification. <p> To use this mouse as a serial device: <verb> @@ -1032,5 +1063,41 @@ The movement of the first wheel is mapped to the button 4 and 5. The second wheel's movement will be reported as the buttons 6 and 7. +The Kensington Expert mouse is really a trackball. It has 4 buttons +arranged in a rectangle around the ball. + +<code> +Section "InputDevice" + Identifier "DLB" + Driver "mouse" + Option "Protocol" "ThinkingMousePS/2" + Option "Buttons" "3" + Option "Emulate3Buttons" + Option "Device" "/dev/mouse" + Option "DragLockButtons" "2 1 4 3" +EndSection +</code> +In this example, button 2 is a drag lock button for button +number 1, and button 4 is a drag lock button for button 3. +Since button 2 is above button 1 and button 4 is above button 3 +in the layout of this trackball, this is reasonable. + +Because button 2 is being used as a drag lock, it can not be +used as an ordinary button. However, it can be activated by +using the "Emulate3Buttons" feature. However, some people my +be unable to press two buttons at the same time. They may +prefer the following <tt>InputDevice</tt> section which +defines button 4 as a master drag lock button, and leaves +button 2 free for ordinary use. +<code> +Section "InputDevice" + Identifier "MasterDLB" + Driver "mouse" + Option "Protocol" "ThinkingMousePS/2" + Option "Buttons" "3" + Option "Device" "/dev/mouse" + Option "DragLockButtons" "4" +EndSection +</code> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml:1.1 xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml:1.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml:1.1 Mon Aug 23 02:59:39 1999 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml Wed Oct 30 07:52:10 2002 @@ -154,7 +154,7 @@ <sect> Authors <p> - Jens Owen <it>jens@precisioninsight.com</it> + Jens Owen <it>jens@tungstengraphics.com</it> Kevin E. Martin <it>kevin@precisioninsight.com</it> This driver was donated to The XFree86 Project by @@ -165,6 +165,6 @@ url="http://www.precisioninsight.com"> <verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml,v 1.1 1999/08/23 06:59:39 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml,v 1.2 2002/10/30 12:52:10 alanh Exp $ </verb> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml:1.4 xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml:1.6 --- xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml:1.4 Wed Jan 16 13:21:04 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml Tue Feb 25 14:31:02 2003 @@ -5,38 +5,37 @@ <article> <title>Information for newport Users <author>Guido Günther -<date>16 January 2002 +<date>24 February 2003 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.4 2002/01/16 18:21:04 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.6 2003/02/25 19:31:02 dawes Exp $ </ident> <toc> <sect>Supported Hardware <p> -This is an unaccelerated driver for the SGI Indy's newport cards. Both the - 8bit and 24bit versions are tested and working. +This is an unaccelerated driver for the SGI newport cards (a.k.a. XL) as found +in the SGI Indy and Indigo2. Both the 8bit and 24bit versions are tested and +working. - <sect>Features <p> <itemize> - <item> support for 8 and 24 bit pixel depths + <item>Support for 8 and 24 bit pixel depths + <item>Hardware cursor support to reduce flicker </itemize> <sect>Notes <p> <itemize> - <item>X -configure does not generate a XF86Config file - <item>Restoration of the console fails on some variants of the newport - (Cmap revision C) - <item>There's only a 1280x1024 mode + <item>X -configure does not generate a XF86Config file. + <item>There's only a 1280x1024 mode. </itemize> <sect>Configuration <p> The driver auto-detects all device information necessary to -initialize the card. The only lines you need in the "Device" +initialize the card on the Indy. The only lines you need in the "Device" section of your XF86Config file are: <verb> Section "Device" @@ -44,10 +43,13 @@ Driver "newport" EndSection </verb> +Indigo2 users have to use the BusID option as documented below. However, if you have problems with auto-detection, you can specify: <itemize> <item>bitplanes - number of physical bitplanes (8 or 24) + <item>HWCursor - enable or disable hardware cursor + <item>BusID - set this to "1" on the Indigo2 XL </itemize> <sect>Authors Index: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml:1.5 xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml:1.6 --- xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml:1.5 Fri Dec 21 16:01:57 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml Wed Feb 12 22:21:33 2003 @@ -8,14 +8,14 @@ <date>19 Dec 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.5 2001/12/21 21:01:57 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.6 2003/02/13 03:21:33 dawes Exp $ </ident> <toc> <sect> Supported hardware <p> -The s3virge driver in XFree86 &relvers; supports the S3 ViRGE, ViRGE DX, GX, GX2, MX, MX+, and VX chipsets. It also supports Trio3D and Trio3D/2x chips. A majority of testing is done on ViRGE DX chips, making them the most stable to date. This release has some stabilization fixes for MX, GX2 and Trio3D, and XVideo support for MX and GX2. +The s3virge driver in XFree86 &relvers; supports the S3 ViRGE, ViRGE DX, GX, GX2, MX, MX+, and VX chipsets. It also supports Trio3D and Trio3D/2x chips. A majority of testing is done on ViRGE DX chips, making them the most stable to date. This release has added support for doublescan modes on DX. This driver is moderately stable, however please use caution with any new install. Please report any problems to <email>XFree86@XFree86.org</email> @@ -28,8 +28,10 @@ <item>Fully accelerated support for S3 ViRGE family video adapters <item>uses linear frame buffer <item>supports resolutions up to 2048x2048 -<item>supports color depths of 8, 15, 16, 24. +<item>supports color depths of 8, 15, 16 and 24 <item>full use of video card memory for acceleration caching when visible framebuffer leaves extra memory +<item>XVideo on DX, GX, GX2, MX, MX+ and Trio3D/2X at depth 16 and 24 +<item>Doublescan modes on DX, possibly others (untested) </itemize> <sect>Configuration: @@ -46,7 +48,7 @@ <sect>Support: <p> -For support with XFree86 video drivers please refer to our web site at <url name="XFree86" url="http://www.XFree86.org">. The web page has a <!-- FAQ and --> bug reporting form available. For problems not addressed in the web page please contact our support email address <email>XFree86@XFree86.org</email> +For support with XFree86 video drivers please refer to our web site at <url name="XFree86" url="http://www.XFree86.org">. For problems not addressed in the web page please contact our support email address <email>XFree86@XFree86.org</email> <sect>Authors <p> Index: xc/programs/Xserver/hw/xfree86/drivers/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.22 xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.22 Mon Jul 2 06:46:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/Imakefile Fri May 31 14:45:59 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.22 2001/07/02 10:46:04 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.23 2002/05/31 18:45:59 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -7,17 +7,7 @@ SUBDIRS = XF86CardDrivers DRIVERS = XF86CardDrivers -#ifndef OS2Architecture OBJS = `cat driver.list` -#else -OBJS = apm/?*_drv.o ati/?*_drv.o chips/?*_drv.o cirrus/?*_drv.o \ - cyrix/?*_drv.o glint/?*_drv.o i128/?*_drv.o i740/?*_drv.o \ - i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \ - nv/?*_drv.o rendition/?*_drv.o s3/?*_drv.o s3virge/?*_drv.o \ - sis/?*_drv.o tdfx/?*_drv.o tga/?*_drv.o trident/?*_drv.o tseng/?*_drv.o \ - vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o vmware/?*_drv.o - -#endif #if DoLoadableServer MakeSubdirs($(SUBDIRS)) Index: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile:1.22 xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile:1.22 Wed Apr 25 13:46:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile Mon Feb 17 12:06:41 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile,v 1.22 2001/04/25 17:46:42 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile,v 1.24 2003/02/17 17:06:41 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -20,14 +20,13 @@ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ - -I$(XF86SRC)/xf24_32bpp \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(XF86SRC)/shadowfb \ -I$(XF86SRC)/i2c -I$(XF86SRC)/ddc \ -I$(SERVERSRC)/Xext -I$(EXTINCSRC) -I$(SERVERSRC)/render \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XF86OSSRC)/vbe -I$(FONTINCSRC) + -I$(XF86SRC)/vbe -I$(FONTINCSRC) #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h:1.17 xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h:1.17 Fri May 4 15:05:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h Tue May 7 08:53:49 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.17 2001/05/04 19:05:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.19 2002/05/07 12:53:49 alanh Exp $ */ /* All drivers should typically include these */ @@ -61,6 +61,15 @@ #endif #define TRUE (1) +#define rdinx(port, ind) (outb((port), (ind)), inb((port) + 1)) +#define wrinx(port, ind, val) outb((port), (ind)), outb((port) + 1, (val)) +#define modinx(port, ind, mask, bits) \ + do { \ + unsigned char tmp; \ + tmp = (rdinx((port), (ind)) & ~(mask)) | ((bits) & (mask)); \ + wrinx((port), (ind), tmp); \ + } while(0) + typedef unsigned char u8; typedef unsigned short u16; typedef unsigned long u32; @@ -108,7 +117,7 @@ char *MemMap; pointer BltMap; Bool UnlockCalled; - int xbase; + IOADDRESS iobase, xport, xbase; unsigned char savedSR10; CARD8 MiscOut; CARD8 c9, d9, db, Rush; @@ -176,6 +185,7 @@ int timerIsOn; Time offTime; OptionInfoPtr Options; + char DPMSMask[4]; } ApmRec, *ApmPtr; #define curr ((unsigned char *)pApm->regcurr) Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man:1.2 Sat Jan 27 13:20:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man Tue May 7 08:53:49 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man,v 1.2 2001/01/27 18:20:46 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man,v 1.3 2002/05/07 12:53:49 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH APM __drivermansuffix__ __vendorversion__ @@ -14,16 +14,92 @@ .fi .SH DESCRIPTION .B apm -is an XFree86 driver for Alliance ProMotion video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. +is an XFree86 driver for Alliance ProMotion video cards. The driver +is accelerated for supported hardware/depth combination. It supports +framebuffer depths of 8, 15, 16, 24 and 32 bits. For 6420, 6422, AT24, +AT3D and AT25, all depths are fully accelerated except 24 bpp for which +only screen to screen copy and rectangle filling is accelerated. .SH SUPPORTED HARDWARE The .B apm -driver supports... +driver supports PCI and ISA video cards on the following Alliance +ProMotion chipsets +.TP 12 +.B ProMotion 6420 +.TP 12 +.B ProMotion 6422 +.TP 12 +.B AT24 +.TP 12 +.B AT3D +.TP 12 +.B AT25 .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"6422", "at24", "at3d". +.PP +The AT25 is Chipset "at3d" and the 6420 is 6422. +.PP +The driver will auto-detect the amount of video memory present for all +chips. The actual amount of video memory can also be specified with a +.B VideoRam +entry in the config file +.B \*qDevice\*q +section. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the hardware cursor. Default: on. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qNoLinear\*q \*q" boolean \*q +Disable or enable use of linear frame buffer. Default: on. +Note: it may or may not work. Tell me if you need it. +.TP +.BI "Option \*qPciRetry\*q \*q" boolean \*q +Enable or disable PCI retries. Default: off. +.TP +.BI "Option \*qRemap_DPMS_On\*q \*q" string \*q +.TP +.BI "Option \*qRemap_DPMS_Standby\*q \*q" string \*q +.TP +.BI "Option \*qRemap_DPMS_Suspend\*q \*q" string \*q +.TP +.BI "Option \*qRemap_DPMS_Off\*q \*q" string \*q +Remaps the corresponding DPMS events. I've found that my +Hercules 128/3D swaps Off and Suspend events. You can correct +that with +.nf +.RS +.RS +.BI "Option \*qRemap_DPMS_Suspend\*q \*qOff\*q" +.BI "Option \*qRemap_DPMS_Off\*q \*qSuspend\*q" +.RE +.fi +in the +.B Device +section of the config file. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Force the software cursor. Default: off. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. Default: off. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.18 Sat Oct 27 23:33:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c Tue Oct 8 18:14:03 2002 @@ -1,7 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.18 2001/10/28 03:33:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.21 2002/10/08 22:14:03 tsi Exp $ */ - -#define COMPILER_H_EXTRAS #include "apm.h" #include "miline.h" @@ -29,8 +27,6 @@ }; -static void Dump(void* start, u32 len); - #include "apm_funcs.c" #define IOP_ACCESS @@ -754,21 +750,4 @@ #undef XAA } } -} - - - -static void -Dump(void* start, u32 len) -{ - u8* i; - int c = 0; - ErrorF("Memory Dump. Start 0x%x length %d\n", (u32)start, len); - for (i = (u8*)start; i < ((u8*)start+len); i++) - { - ErrorF("%02x ", *i); - if (c++ % 25 == 24) - ErrorF("\n"); - } - ErrorF("\n"); } Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c:1.9 Sat Jan 6 16:29:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c Fri Jan 25 16:55:54 2002 @@ -1,11 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c,v 1.9 2001/01/06 21:29:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c,v 1.10 2002/01/25 21:55:54 tsi Exp $ */ /* * file: apm_dga.c * ported from s3virge, ported from mga * */ -#define COMPILER_H_EXTRAS #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -324,8 +323,8 @@ else { tmp = (RDXB_IOP(0xDB) & 0xF4) | 0x0A; WRXB_IOP(0xDB, tmp); - wrinx(0x3C4, 0x1B, 0x20); - wrinx(0x3C4, 0x1C, 0x2F); + wrinx(pApm->xport, 0x1B, 0x20); + wrinx(pApm->xport, 0x1C, 0x2F); } pApm->apmLock = FALSE; } @@ -337,8 +336,8 @@ } else { /* Wait until vertical retrace is in progress. */ - while (inb(0x3DA) & 0x08); - while (!(inb(0x3DA) & 0x08)); + while (inb(pApm->iobase + 0x3DA) & 0x08); + while (!(inb(pApm->iobase + 0x3DA) & 0x08)); } } Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.56 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.61 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.56 Fri Jan 4 16:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c Wed Oct 16 17:13:46 2002 @@ -1,6 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.56 2002/01/04 21:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.61 2002/10/16 21:13:46 dawes Exp $ */ -#define COMPILER_H_EXTRAS #include "apm.h" #include "xf86cmap.h" #include "shadowfb.h" @@ -53,7 +52,7 @@ int ApmPixmapIndex = -1; -static int ApmGeneration = -1; +static unsigned long ApmGeneration = 0; DriverRec APM = { VERSION, @@ -92,6 +91,10 @@ OPTION_NOACCEL, OPTION_SHADOW_FB, OPTION_PCI_BURST, + OPTION_REMAP_DPMS_ON, + OPTION_REMAP_DPMS_STANDBY, + OPTION_REMAP_DPMS_SUSPEND, + OPTION_REMAP_DPMS_OFF, OPTION_PCI_RETRY } ApmOpts; @@ -102,7 +105,7 @@ {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, - {0}, FALSE}, + {0}, TRUE}, {OPTION_NOLINEAR, "NoLinear", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, @@ -111,6 +114,14 @@ {0}, FALSE}, {OPTION_PCI_BURST, "pci_burst", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_REMAP_DPMS_ON, "Remap_DPMS_On", OPTV_ANYSTR, + {0}, FALSE}, + {OPTION_REMAP_DPMS_STANDBY, "Remap_DPMS_Standby", OPTV_ANYSTR, + {0}, FALSE}, + {OPTION_REMAP_DPMS_SUSPEND, "Remap_DPMS_Suspend", OPTV_ANYSTR, + {0}, FALSE}, + {OPTION_REMAP_DPMS_OFF, "Remap_DPMS_Off", OPTV_ANYSTR, + {0}, FALSE}, {OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, @@ -283,7 +294,7 @@ if (pApm->Chipset >= AT3D && !pApm->noLinear) ApmWriteSeq(0x10, 0x12); else - wrinx(0x3C4, 0x10, 0x12); + wrinx(pApm->xport, 0x10, 0x12); } /* lock Alliance registers */ @@ -293,7 +304,7 @@ if (pApm->Chipset >= AT3D && !pApm->noLinear) ApmWriteSeq(0x10, pApm->savedSR10 ? 0 : 0x12); else - wrinx(0x3C4, 0x10, pApm->savedSR10 ? 0 : 0x12); + wrinx(pApm->xport, 0x10, pApm->savedSR10 ? 0 : 0x12); } static void @@ -500,8 +511,9 @@ { APMDECL(pScrn); EntityInfoPtr pEnt; + vgaHWPtr hwp; MessageType from; - char *mod = NULL, *req = NULL; + char *mod = NULL, *req = NULL, *s; ClockRangePtr clockRanges; int i; xf86MonPtr MonInfo = NULL; @@ -559,11 +571,15 @@ if (!vgaHWGetHWRec(pScrn)) return FALSE; - vgaHWGetIOBase(VGAHWPTR(pScrn)); + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + pApm->iobase = hwp->PIOOffset; + pApm->xport = hwp->PIOOffset + 0x3C4; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; + /* XXX: Access funcs */ /* * The first thing we should figure out is the depth, bpp, etc. */ @@ -586,6 +602,7 @@ return FALSE; } } + xf86PrintDepthBpp(pScrn); /* * This must happen after pScrn->display has been set because @@ -674,6 +691,70 @@ else xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"pci_retry\" option requires pci_burst \"on\".\n"); } + pApm->DPMSMask[DPMSModeOn] = DPMSModeOn; + pApm->DPMSMask[DPMSModeStandby] = DPMSModeStandby; + pApm->DPMSMask[DPMSModeSuspend] = DPMSModeSuspend; + pApm->DPMSMask[DPMSModeOff] = DPMSModeOff; + if ((s = xf86GetOptValString(pApm->Options, OPTION_REMAP_DPMS_ON))) { + if (!strcmp(s, "on")) + pApm->DPMSMask[DPMSModeOn] = DPMSModeOn; + else if (!strcmp(s, "standby")) + pApm->DPMSMask[DPMSModeOn] = DPMSModeStandby; + else if (!strcmp(s, "suspend")) + pApm->DPMSMask[DPMSModeOn] = DPMSModeSuspend; + else if (!strcmp(s, "off")) + pApm->DPMSMask[DPMSModeOn] = DPMSModeOff; + else if (s[0] >= '0' && s[0] <= '9') { + pApm->DPMSMask[DPMSModeOn] = strtol(s, NULL, 0); + if (pApm->DPMSMask[DPMSModeOn] > (sizeof pApm->DPMSMask)-1) + pApm->DPMSMask[DPMSModeOn] = (sizeof pApm->DPMSMask) - 1; + } + } + if ((s = xf86GetOptValString(pApm->Options, OPTION_REMAP_DPMS_STANDBY))) { + if (!strcmp(s, "on")) + pApm->DPMSMask[DPMSModeStandby] = DPMSModeOn; + else if (!strcmp(s, "standby")) + pApm->DPMSMask[DPMSModeStandby] = DPMSModeStandby; + else if (!strcmp(s, "suspend")) + pApm->DPMSMask[DPMSModeStandby] = DPMSModeSuspend; + else if (!strcmp(s, "off")) + pApm->DPMSMask[DPMSModeStandby] = DPMSModeOff; + else if (s[0] >= '0' && s[0] <= '9') { + pApm->DPMSMask[DPMSModeStandby] = strtol(s, NULL, 0); + if (pApm->DPMSMask[DPMSModeStandby] > (sizeof pApm->DPMSMask)-1) + pApm->DPMSMask[DPMSModeStandby] = (sizeof pApm->DPMSMask) - 1; + } + } + if ((s = xf86GetOptValString(pApm->Options, OPTION_REMAP_DPMS_SUSPEND))) { + if (!strcmp(s, "on")) + pApm->DPMSMask[DPMSModeSuspend] = DPMSModeOn; + else if (!strcmp(s, "standby")) + pApm->DPMSMask[DPMSModeSuspend] = DPMSModeStandby; + else if (!strcmp(s, "suspend")) + pApm->DPMSMask[DPMSModeSuspend] = DPMSModeSuspend; + else if (!strcmp(s, "off")) + pApm->DPMSMask[DPMSModeSuspend] = DPMSModeOff; + else if (s[0] >= '0' && s[0] <= '9') { + pApm->DPMSMask[DPMSModeSuspend] = strtol(s, NULL, 0); + if (pApm->DPMSMask[DPMSModeSuspend] > (sizeof pApm->DPMSMask)-1) + pApm->DPMSMask[DPMSModeSuspend] = (sizeof pApm->DPMSMask) - 1; + } + } + if ((s = xf86GetOptValString(pApm->Options, OPTION_REMAP_DPMS_OFF))) { + if (!strcmp(s, "on")) + pApm->DPMSMask[DPMSModeOff] = DPMSModeOn; + else if (!strcmp(s, "standby")) + pApm->DPMSMask[DPMSModeOff] = DPMSModeStandby; + else if (!strcmp(s, "suspend")) + pApm->DPMSMask[DPMSModeOff] = DPMSModeSuspend; + else if (!strcmp(s, "off")) + pApm->DPMSMask[DPMSModeOff] = DPMSModeOff; + else if (s[0] >= '0' && s[0] <= '9') { + pApm->DPMSMask[DPMSModeOff] = strtol(s, NULL, 0); + if (pApm->DPMSMask[DPMSModeOff] > (sizeof pApm->DPMSMask)-1) + pApm->DPMSMask[DPMSModeOff] = (sizeof pApm->DPMSMask) - 1; + } + } /* * Set the Chipset and ChipRev, allowing config file entries to @@ -783,7 +864,7 @@ } xf86RegisterResources(pEnt->index, NULL, ResNone); - xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVga, pEnt->index, ResDisableOpr); pScrn->racMemFlags = 0; /* For noLinear, access to 0xA0000 */ if (pApm->VGAMap) pScrn->racIoFlags = 0; @@ -831,11 +912,13 @@ save = pciReadLong(pApm->PciTag, PCI_CMD_STAT_REG); pciWriteLong(pApm->PciTag, PCI_CMD_STAT_REG, save | PCI_CMD_IO_ENABLE);*/ - pApm->savedSR10 = rdinx(0x3C4, 0x10); - wrinx(0x3C4, 0x10, 0x12); - pScrn->videoRam = rdinx(0x3C4, 0x20) * 64; - pApm->xbase = (rdinx(0x3C4, 0x1F) << 8) | rdinx(0x3C4, 0x1E); - wrinx(0x3C4, 0x10, pApm->savedSR10 ? 0 : 0x12); + pApm->savedSR10 = rdinx(pApm->xport, 0x10); + wrinx(pApm->xport, 0x10, 0x12); + pScrn->videoRam = rdinx(pApm->xport, 0x20) * 64; + pApm->xbase = rdinx(pApm->xport, 0x1F) << 8; + pApm->xbase |= rdinx(pApm->xport, 0x1E); + pApm->xbase += pApm->iobase; + wrinx(pApm->xport, 0x10, pApm->savedSR10 ? 0 : 0x12); /*pciWriteLong(pApm->PciTag, PCI_CMD_STAT_REG, save);*/ from = X_PROBED; } @@ -846,8 +929,7 @@ pScrn->videoRam); if (!xf86IsPc98()) { - vgaHWGetIOBase(VGAHWPTR(pScrn)); - VGAHWPTR(pScrn)->MapSize = 0x10000; + hwp->MapSize = 0x10000; vgaHWMapMem(pScrn); if (pApm->I2C) { if (!ApmI2CInit(pScrn)) { @@ -857,7 +939,7 @@ MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex,pApm->I2CPtr); } } - if (!MonInfo) + if (0 && !MonInfo) MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed,ddc1Read); if (MonInfo) xf86PrintEDID(MonInfo); @@ -1232,7 +1314,7 @@ { APMDECL(pScrn); ApmRegPtr ApmReg = &pApm->SavedReg; - vgaHWPtr vgaHWP = VGAHWPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); if (pApm->VGAMap) { ApmReg->SEQ[0x1B] = ApmReadSeq(0x1B); @@ -1241,7 +1323,7 @@ /* * Save fonts */ - if (!(vgaHWP->SavedReg.Attribute[0x10] & 1)) { + if (!(hwp->SavedReg.Attribute[0x10] & 1)) { if (pApm->FontInfo || (pApm->FontInfo = (pointer)xalloc(TEXT_AMOUNT))) { int locked; @@ -1259,7 +1341,7 @@ * This function will handle creating the data structure and filling * in the generic VGA portion. */ - vgaHWSave(pScrn, &vgaHWP->SavedReg, VGA_SR_MODE | VGA_SR_CMAP); + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_CMAP); /* Hardware cursor registers. */ ApmReg->EX[XR140] = RDXL(0x140); @@ -1288,10 +1370,10 @@ * This function will handle creating the data structure and filling * in the generic VGA portion. */ - vgaHWSave(pScrn, &vgaHWP->SavedReg, VGA_SR_ALL); + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); - ApmReg->SEQ[0x1B] = rdinx(0x3C4, 0x1B); - ApmReg->SEQ[0x1C] = rdinx(0x3C4, 0x1C); + ApmReg->SEQ[0x1B] = rdinx(pApm->xport, 0x1B); + ApmReg->SEQ[0x1C] = rdinx(pApm->xport, 0x1C); /* Hardware cursor registers. */ if (pApm->noLinear) { @@ -1307,12 +1389,12 @@ ApmReg->EX[XR14C] = RDXW(0x14C); } - ApmReg->CRT[0x19] = rdinx(0x3D4, 0x19); - ApmReg->CRT[0x1A] = rdinx(0x3D4, 0x1A); - ApmReg->CRT[0x1B] = rdinx(0x3D4, 0x1B); - ApmReg->CRT[0x1C] = rdinx(0x3D4, 0x1C); - ApmReg->CRT[0x1D] = rdinx(0x3D4, 0x1D); - ApmReg->CRT[0x1E] = rdinx(0x3D4, 0x1E); + ApmReg->CRT[0x19] = rdinx(pApm->iobase + 0x3D4, 0x19); + ApmReg->CRT[0x1A] = rdinx(pApm->iobase + 0x3D4, 0x1A); + ApmReg->CRT[0x1B] = rdinx(pApm->iobase + 0x3D4, 0x1B); + ApmReg->CRT[0x1C] = rdinx(pApm->iobase + 0x3D4, 0x1C); + ApmReg->CRT[0x1D] = rdinx(pApm->iobase + 0x3D4, 0x1D); + ApmReg->CRT[0x1E] = rdinx(pApm->iobase + 0x3D4, 0x1E); if (pApm->noLinear) { /* RAMDAC registers. */ @@ -1671,8 +1753,8 @@ /* * Write the extended registers first */ - wrinx(0x3C4, 0x1B, ApmReg->SEQ[0x1B]); - wrinx(0x3C4, 0x1C, ApmReg->SEQ[0x1C]); + wrinx(pApm->xport, 0x1B, ApmReg->SEQ[0x1B]); + wrinx(pApm->xport, 0x1C, ApmReg->SEQ[0x1C]); /* Hardware cursor registers. */ if (pApm->noLinear) { @@ -1688,12 +1770,12 @@ WRXW(0x14C, ApmReg->EX[XR14C]); } - wrinx(0x3D4, 0x19, ApmReg->CRT[0x19]); - wrinx(0x3D4, 0x1A, ApmReg->CRT[0x1A]); - wrinx(0x3D4, 0x1B, ApmReg->CRT[0x1B]); - wrinx(0x3D4, 0x1C, ApmReg->CRT[0x1C]); - wrinx(0x3D4, 0x1D, ApmReg->CRT[0x1D]); - wrinx(0x3D4, 0x1E, ApmReg->CRT[0x1E]); + wrinx(pApm->iobase + 0x3D4, 0x19, ApmReg->CRT[0x19]); + wrinx(pApm->iobase + 0x3D4, 0x1A, ApmReg->CRT[0x1A]); + wrinx(pApm->iobase + 0x3D4, 0x1B, ApmReg->CRT[0x1B]); + wrinx(pApm->iobase + 0x3D4, 0x1C, ApmReg->CRT[0x1C]); + wrinx(pApm->iobase + 0x3D4, 0x1D, ApmReg->CRT[0x1D]); + wrinx(pApm->iobase + 0x3D4, 0x1E, ApmReg->CRT[0x1E]); /* RAMDAC registers. */ if (pApm->noLinear) { @@ -1951,6 +2033,9 @@ pApm->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = ApmCloseScreen; + pScrn->memPhysBase = pApm->LinAddress; + pScrn->fbOffset = (((char *)pApm->FbBase) - ((char *)pApm->LinMap)); + /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -1992,11 +2077,11 @@ for (i = 0; i < numColors; i++) { index = indices[i]; if (index != last) - outb(0x3C8, index); + outb(pApm->iobase + 0x3C8, index); last = index + 1; - outb(0x3C9, colors[index].red); - outb(0x3C9, colors[index].green); - outb(0x3C9, colors[index].blue); + outb(pApm->iobase + 0x3C9, colors[index].red); + outb(pApm->iobase + 0x3C9, colors[index].green); + outb(pApm->iobase + 0x3C9, colors[index].blue); } } } @@ -2037,14 +2122,14 @@ ApmWriteCrtc(0x1C, (ApmReadCrtc(0x1C) & 0xF0) | ((Base & 0x0F0000) >> 16)); } else { - outw(0x3D4, (Base & 0x00FF00) | 0x0C); - outw(0x3D4, ((Base & 0x00FF) << 8) | 0x0D); + outw(pApm->iobase + 0x3D4, (Base & 0x00FF00) | 0x0C); + outw(pApm->iobase + 0x3D4, ((Base & 0x00FF) << 8) | 0x0D); /* * Here the high-order bits are masked and shifted, and put into * the appropriate extended registers. */ - modinx(0x3D4, 0x1C, 0x0F, (Base & 0x0F0000) >> 16); + modinx(pApm->iobase + 0x3D4, 0x1C, 0x0F, (Base & 0x0F0000) >> 16); } } @@ -2097,12 +2182,12 @@ APMDECL(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - ApmRestore(pScrn, &VGAHWPTR(pScrn)->SavedReg, &pApm->SavedReg); + ApmRestore(pScrn, &hwp->SavedReg, &pApm->SavedReg); /* * Reset color mode */ - hwp->writeMiscOut(hwp, pApm->MiscOut); - vgaHWLock(VGAHWPTR(pScrn)); + (*hwp->writeMiscOut)(hwp, pApm->MiscOut); + vgaHWLock(hwp); ApmLock(pApm); if (pApm->Chipset >= AT3D) { if (!pApm->noLinear) { @@ -2134,7 +2219,7 @@ APMDECL(pScrn); if (pScrn->vtSema) { - ApmRestore(pScrn, &VGAHWPTR(pScrn)->SavedReg, &pApm->SavedReg); + ApmRestore(pScrn, &hwp->SavedReg, &pApm->SavedReg); vgaHWLock(hwp); ApmUnmapMem(pScrn); } @@ -2198,6 +2283,9 @@ APMDECL(pScrn); unsigned char dpmsreg, tmp; + if (PowerManagementMode < sizeof pApm->DPMSMask && + PowerManagementMode >= 0) + PowerManagementMode = pApm->DPMSMask[PowerManagementMode]; switch (PowerManagementMode) { case DPMSModeOn: Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c:1.15 Mon Oct 1 09:44:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c Tue May 7 08:53:49 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.15 2001/10/01 13:44:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.17 2002/05/07 12:53:49 alanh Exp $ */ #define FASTER #ifndef PSZ @@ -19,7 +19,7 @@ # define WRXB WRXB_IOP # define WRXW WRXW_IOP # define WRXL WRXL_IOP -# define ApmWriteSeq(i, v) wrinx(0x3C4, i, v) +# define ApmWriteSeq(i, v) wrinx(pApm->xport, i, v) #else # define APM_SUFF_IOP "" #endif @@ -887,7 +887,7 @@ { APMDECL(pScrn); - DPRINTNAME(SetupForImageWriteRect); + DPRINTNAME(SetupForImageWrite); if (trans_color != -1) { #ifndef FASTER @@ -1200,19 +1200,25 @@ int PlusOne = 0, mask, count; DPRINTNAME(WritePixmap); + if (rop == GXnoop) + return; + /* + * The function seems to crash more than it feels good. I hope that a + * good sync will help. This sync is anyway needed for direct write. + */ + (*pApm->AccelInfoRec->Sync)(pScrn); /* * First the fast case : source and dest have same alignment. Doc says * it's faster to do it here, which may be true since one has to read * the chip when CPU to screen-ing. */ - if ((skipleft = (long)src & 3L) == ((long)dst & 3L)) { + if ((skipleft = (long)src & 3L) == ((long)dst & 3L) && rop == GXcopy) { int skipright; if (skipleft) skipleft = 4 - skipleft; dwords = (skipright = w * Bpp - skipleft) >> 2; skipright %= 4; - (*pApm->AccelInfoRec->Sync)(pScrn); if (!skipleft && !skipright) while (h-- > 0) { CARD32 *src2 = (CARD32 *)src; Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c:1.6 Sat Jan 6 16:29:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c Fri Jan 25 16:55:55 2002 @@ -1,6 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.6 2001/01/06 21:29:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.7 2002/01/25 21:55:55 tsi Exp $ */ -#define COMPILER_H_EXTRAS #include "apm.h" #include "apm_regs.h" @@ -32,15 +31,15 @@ unsigned char lock; ApmPtr pApm = ((ApmPtr)b->DriverPrivate.ptr); - lock = rdinx(0x3C4, 0x10); - wrinx(0x3C4, 0x10, 0x12); + lock = rdinx(pApm->xport, 0x10); + wrinx(pApm->xport, 0x10, 0x12); WaitForFifo(pApm, 2); reg = (RDXB_IOP(0xD0) & 0x07) | 0x60; if(clock) reg |= 0x08; if(data) reg |= 0x10; WRXB_IOP(0xD0, reg); if (lock) - wrinx(0x3C4, 0x10, 0); + wrinx(pApm->xport, 0x10, 0); } static void @@ -51,8 +50,8 @@ ApmPtr pApm = ((ApmPtr)b->DriverPrivate.ptr); unsigned char tmp; - lock = rdinx(0x3C4, 0x10); - wrinx(0x3C4, 0x10, 0x12); + lock = rdinx(pApm->xport, 0x10); + wrinx(pApm->xport, 0x10, 0x12); WaitForFifo(pApm, 2); tmp = RDXB_IOP(0xD0); WRXB_IOP(0xD0, tmp & 0x07); @@ -60,7 +59,7 @@ *clock = (reg & STATUS_SCL) != 0; *data = (reg & STATUS_SDA) != 0; if (lock) - wrinx(0x3C4, 0x10, 0); + wrinx(pApm->xport, 0x10, 0); } Bool Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h:1.7 Mon Feb 28 22:09:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h Fri Jan 25 16:55:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h,v 1.7 2000/02/29 03:09:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h,v 1.8 2002/01/25 21:55:55 tsi Exp $ */ @@ -48,27 +48,39 @@ curr32[MIN(((addr) / 4), 0x20)] = (val); }} while (0) /* IO port access to extended registers */ -#define RDXB_IOP(addr) (wrinx(0x3C4, 0x1D, (addr) >> 2),inb(pApm->xbase + ((addr) & 3))) -#define RDXW_IOP(addr) (wrinx(0x3C4, 0x1D, (addr) >> 2),inw(pApm->xbase + ((addr) & 2))) -#define RDXL_IOP(addr) (wrinx(0x3C4, 0x1D, (addr) >> 2),inl(pApm->xbase)) -#define WRXB_IOP(addr,val) do { if (check08((addr), (val))) { \ - wrinx(0x3C4, 0x1D, (addr) >> 2); \ - outb(pApm->xbase + ((addr) & 3), (val)); \ - curr08[MIN((addr), 0x80)] = (val); \ - break; \ - }} while (1) -#define WRXW_IOP(addr,val) do { if (check16((addr), (val))) { \ - wrinx(0x3C4, 0x1D, (addr) >> 2); \ - outw(pApm->xbase + ((addr) & 2), (val)); \ - curr16[MIN(((addr) / 2), 0x40)] = (val); \ - break; \ - }} while (1) -#define WRXL_IOP(addr,val) do { if (check32((addr), (val))) { \ - wrinx(0x3C4, 0x1D, (addr) >> 2); \ - outl(pApm->xbase, (val)); \ - curr32[MIN(((addr) / 4), 0x20)] = (val); \ - break; \ - }} while (1) +#define RDXB_IOP(addr) (wrinx(pApm->xport, 0x1D, (addr) >> 2), \ + inb(pApm->xbase + ((addr) & 3))) +#define RDXW_IOP(addr) (wrinx(pApm->xport, 0x1D, (addr) >> 2), \ + inw(pApm->xbase + ((addr) & 2))) +#define RDXL_IOP(addr) (wrinx(pApm->xport, 0x1D, (addr) >> 2), \ + inl(pApm->xbase)) +#define WRXB_IOP(addr,val) \ + do { \ + if (check08((addr), (val))) { \ + wrinx(pApm->xport, 0x1D, (addr) >> 2); \ + outb(pApm->xbase + ((addr) & 3), (val)); \ + curr08[MIN((addr), 0x80)] = (val); \ + break; \ + } \ + } while (1) +#define WRXW_IOP(addr,val) \ + do { \ + if (check16((addr), (val))) { \ + wrinx(pApm->xport, 0x1D, (addr) >> 2); \ + outw(pApm->xbase + ((addr) & 2), (val)); \ + curr16[MIN(((addr) / 2), 0x40)] = (val); \ + break; \ + } \ + } while (1) +#define WRXL_IOP(addr,val) \ + do { \ + if (check32((addr), (val))) { \ + wrinx(pApm->xport, 0x1D, (addr) >> 2); \ + outl(pApm->xbase, (val)); \ + curr32[MIN(((addr) / 4), 0x20)] = (val); \ + break; \ + } \ + } while (1) #define WRXL WRXL_M #define WRXW WRXW_M Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.10 Wed May 23 16:13:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c Wed Feb 12 16:46:42 2003 @@ -1,9 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.10 2001/05/23 20:13:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.12 2003/02/12 21:46:42 tsi Exp $ */ /* * Copyright Loïc Grenié 1999 */ -#define COMPILER_H_EXTRAS #include "apm.h" #include "xaalocal.h" @@ -271,8 +270,8 @@ db = RDXB_IOP(0xDB); WRXB_IOP(0xDB, (db & 0xF4) | 0x0A); - wrinx(0x3C4, 0x1B, 0x20); - wrinx(0x3C4, 0x1C, 0x2F); + wrinx(pApm->xport, 0x1B, 0x20); + wrinx(pApm->xport, 0x1C, 0x2F); } pApm->apmLock = FALSE; } @@ -327,7 +326,9 @@ static DISPATCH_PROC(ProcXF86RushUnlockPixmap); static DISPATCH_PROC(ProcXF86RushUnlockAllPixmaps); static DISPATCH_PROC(ProcXF86RushSetCopyMode); +#if 0 static DISPATCH_PROC(ProcXF86RushSetPixelStride); +#endif static DISPATCH_PROC(ProcXF86RushOverlayPixmap); static DISPATCH_PROC(ProcXF86RushStatusRegOffset); static DISPATCH_PROC(ProcXF86RushAT3DEnableRegs); @@ -463,6 +464,7 @@ return client->noClientException; } +#if 0 static int ProcXF86RushSetPixelStride(register ClientPtr client) { @@ -472,6 +474,7 @@ APMPTR(xf86Screens[stuff->screen])->pixelStride = stuff->PixelStride; return client->noClientException; } +#endif int ProcXF86RushDispatch (register ClientPtr client) Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h:1.2 Mon Jan 29 10:15:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h Fri Jan 25 16:55:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h,v 1.2 2001/01/29 15:15:44 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h,v 1.3 2002/01/25 21:55:56 tsi Exp $ */ /* * ark */ @@ -68,5 +68,17 @@ #define ATT490 0x101 Bool ARKAccelInit(ScreenPtr pScreen); + +#define rdinx(port, ind) (outb((port), (ind)), inb((port) + 1)) +#define wrinx(port, ind, val) \ + do { \ + outb((port), (ind)); outb((port) + 1, (val)); \ + } while(0) +#define modinx(port, ind, mask, bits) \ + do { \ + unsigned char tmp; \ + tmp = (rdinx((port), (ind)) & ~(mask)) | ((bits) & (mask)); \ + wrinx((port), (ind), tmp); \ + } while(0) #endif /* _ARK_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c:1.5 Mon Jan 29 10:15:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c Wed Dec 11 12:09:39 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c,v 1.5 2001/01/29 15:15:44 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c,v 1.7 2002/12/11 17:09:39 dawes Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -41,13 +41,15 @@ #include "ark_reg.h" -int curx, cury, cmd_flags; +static int curx, cury, cmd_flags; static void ARKSync(ScrnInfoPtr pScrn) { + IOADDRESS port = pScrn->domainIOBase + 0x3cb; + for (;;) { - if (!(inb(0x3cb) & 0x40)) + if (!(inb(port) & 0x40)) break; } } Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.19 Sat Oct 27 23:33:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c Tue Jul 23 21:47:24 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.19 2001/10/28 03:33:22 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.21 2002/07/24 01:47:24 tsi Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -28,7 +28,6 @@ * */ -#define COMPILER_H_EXTRAS #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -73,8 +72,8 @@ static void ARKWriteMode(ScrnInfoPtr pScrn, vgaRegPtr pVga, ARKRegPtr new); /* helpers */ -static unsigned char get_daccomm(void); -static unsigned char set_daccom(unsigned char comm); +static unsigned char get_daccomm(IOADDRESS); +static unsigned char set_daccom(IOADDRESS, unsigned char comm); DriverRec ARK = @@ -350,8 +349,8 @@ pARK->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); - xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); - xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); if (pEnt->device->chipset && *pEnt->device->chipset) { pScrn->chipset = pEnt->device->chipset; @@ -383,14 +382,14 @@ pARK->PciInfo->func); /* unlock CRTC[0-7] */ - outb(hwp->IOBase + 4, 0x11); - tmp = inb(hwp->IOBase + 5); - outb(hwp->IOBase + 5, tmp & 0x7f); - modinx(0x3c4, 0x1d, 0x01, 0x01); + outb(hwp->PIOOffset + hwp->IOBase + 4, 0x11); + tmp = inb(hwp->PIOOffset + hwp->IOBase + 5); + outb(hwp->PIOOffset + hwp->IOBase + 5, tmp & 0x7f); + modinx(hwp->PIOOffset + 0x3c4, 0x1d, 0x01, 0x01); /* use membase's later on ??? */ - pARK->FBAddress = (rdinx(0x3c4, 0x13) << 16) + - (rdinx(0x3c4, 0x14) << 24); + pARK->FBAddress = (rdinx(hwp->PIOOffset + 0x3c4, 0x13) << 16) + + (rdinx(hwp->PIOOffset + 0x3c4, 0x14) << 24); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%x\n", pARK->FBAddress); @@ -401,7 +400,7 @@ if (!pScrn->videoRam) { unsigned char sr10; - sr10 = rdinx(0x3c4, 0x10); + sr10 = rdinx(hwp->PIOOffset + 0x3c4, 0x10); if (pARK->Chipset == PCI_CHIP_1000PV) { if ((sr10 & 0x40) == 0) pScrn->videoRam = 1024; @@ -426,9 +425,9 @@ { int man_id, dev_id; - inb(0x3c6); /* skip command register */ - man_id = inb(0x3c6); /* manufacturer id */ - dev_id = inb(0x3c6); /* device id */ + inb(hwp->PIOOffset + 0x3c6); /* skip cmd register */ + man_id = inb(hwp->PIOOffset + 0x3c6); /* manufacturer id */ + dev_id = inb(hwp->PIOOffset + 0x3c6); /* device id */ if (man_id == 0x84 && dev_id == 0x98) { pARK->ramdac = ZOOMDAC; pARK->dac_width = 16; @@ -605,45 +604,46 @@ ARKPtr pARK = ARKPTR(pScrn); ARKRegPtr save = &pARK->SavedRegs; vgaHWPtr hwp = VGAHWPTR(pScrn); - int vgaIOBase = hwp->IOBase; + IOADDRESS isaIOBase = hwp->PIOOffset; + IOADDRESS vgaIOBase = isaIOBase + hwp->IOBase; vgaHWUnlock(hwp); vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); vgaHWLock(hwp); /* set read and write aperture index to 0 */ - wrinx(0x3c4, 0x15, 0x00); - wrinx(0x3c4, 0x16, 0x00); - outb(0x3c8, 0); /* reset DAC register access mode */ - - save->sr10 = rdinx(0x3c4, 0x10); - save->sr11 = rdinx(0x3c4, 0x11); - save->sr12 = rdinx(0x3c4, 0x12); - save->sr13 = rdinx(0x3c4, 0x13); - save->sr14 = rdinx(0x3c4, 0x14); - save->sr15 = rdinx(0x3c4, 0x15); - save->sr16 = rdinx(0x3c4, 0x16); - save->sr17 = rdinx(0x3c4, 0x17); - save->sr18 = rdinx(0x3c4, 0x18); + wrinx(isaIOBase + 0x3c4, 0x15, 0x00); + wrinx(isaIOBase + 0x3c4, 0x16, 0x00); + outb(isaIOBase + 0x3c8, 0); /* reset DAC register access mode */ + + save->sr10 = rdinx(isaIOBase + 0x3c4, 0x10); + save->sr11 = rdinx(isaIOBase + 0x3c4, 0x11); + save->sr12 = rdinx(isaIOBase + 0x3c4, 0x12); + save->sr13 = rdinx(isaIOBase + 0x3c4, 0x13); + save->sr14 = rdinx(isaIOBase + 0x3c4, 0x14); + save->sr15 = rdinx(isaIOBase + 0x3c4, 0x15); + save->sr16 = rdinx(isaIOBase + 0x3c4, 0x16); + save->sr17 = rdinx(isaIOBase + 0x3c4, 0x17); + save->sr18 = rdinx(isaIOBase + 0x3c4, 0x18); #if 0 - save->sr1d = rdinx(0x3c4, 0x1d); - save->sr1c = rdinx(0x3c4, 0x1c); + save->sr1d = rdinx(isaIOBase + 0x3c4, 0x1d); + save->sr1c = rdinx(isaIOBase + 0x3c4, 0x1c); - save->sr20 = rdinx(0x3c4, 0x20); - save->sr21 = rdinx(0x3c4, 0x21); - save->sr22 = rdinx(0x3c4, 0x22); - save->sr23 = rdinx(0x3c4, 0x23); - save->sr24 = rdinx(0x3c4, 0x24); - save->sr25 = rdinx(0x3c4, 0x25); - save->sr26 = rdinx(0x3c4, 0x26); - save->sr27 = rdinx(0x3c4, 0x27); - save->sr29 = rdinx(0x3c4, 0x29); - save->sr2a = rdinx(0x3c4, 0x2a); + save->sr20 = rdinx(isaIOBase + 0x3c4, 0x20); + save->sr21 = rdinx(isaIOBase + 0x3c4, 0x21); + save->sr22 = rdinx(isaIOBase + 0x3c4, 0x22); + save->sr23 = rdinx(isaIOBase + 0x3c4, 0x23); + save->sr24 = rdinx(isaIOBase + 0x3c4, 0x24); + save->sr25 = rdinx(isaIOBase + 0x3c4, 0x25); + save->sr26 = rdinx(isaIOBase + 0x3c4, 0x26); + save->sr27 = rdinx(isaIOBase + 0x3c4, 0x27); + save->sr29 = rdinx(isaIOBase + 0x3c4, 0x29); + save->sr2a = rdinx(isaIOBase + 0x3c4, 0x2a); if ((pARK->Chipset == PCI_CHIP_2000PV) || (pARK->Chipset == PCI_CHIP_2000MT)) { - save->sr28 = rdinx(0x3c4, 0x28); - save->sr2b = rdinx(0x3c4, 0x2b); + save->sr28 = rdinx(isaIOBase + 0x3c4, 0x28); + save->sr2b = rdinx(isaIOBase + 0x3c4, 0x2b); } #endif @@ -657,7 +657,7 @@ save->cr46 = rdinx(vgaIOBase + 4, 0x46); /* save RAMDAC regs here, based on type */ - save->dac_command = get_daccomm(); + save->dac_command = get_daccomm(isaIOBase); } @@ -669,7 +669,8 @@ int multiplexing, dac16, modepitch; vgaHWPtr hwp = VGAHWPTR(pScrn); vgaRegPtr pVga = &hwp->ModeReg; - int vgaIOBase = hwp->IOBase; + IOADDRESS isaIOBase = hwp->PIOOffset; + IOADDRESS vgaIOBase = isaIOBase + hwp->IOBase; unsigned char tmp; int offset; @@ -772,13 +773,13 @@ new->sr17 &= ~0xc7; new->sr17 |= modepitch; - new->sr10 = rdinx(0x3c4, 0x10) & ~0x1f; + new->sr10 = rdinx(isaIOBase + 0x3c4, 0x10) & ~0x1f; new->sr10 |= 0x1f; new->sr13 = pARK->FBAddress >> 16; new->sr14 = pARK->FBAddress >> 24; - new->sr12 = rdinx(0x3c4, 0x12) & ~0x03; + new->sr12 = rdinx(isaIOBase + 0x3c4, 0x12) & ~0x03; switch (pScrn->videoRam) { case 1024: new->sr12 |= 0x01; @@ -834,7 +835,7 @@ (pScrn->bitsPerPixel / 8); /* 120000 is another guess */ percentused = (bandwidthused * 100) / 120000; - tmp = rdinx(0x3c4, 0x18); + tmp = rdinx(isaIOBase + 0x3c4, 0x18); if (pARK->Chipset == PCI_CHIP_1000PV) { threshold = 4; tmp |= 0x08; /* enable full FIFO (8 deep) */ @@ -884,20 +885,20 @@ #if 0 /* hw cursor regs */ - new->sr20 = rdinx(0x3c4, 0x20); - new->sr21 = rdinx(0x3c4, 0x21); - new->sr22 = rdinx(0x3c4, 0x22); - new->sr23 = rdinx(0x3c4, 0x23); - new->sr24 = rdinx(0x3c4, 0x24); - new->sr25 = rdinx(0x3c4, 0x25); - new->sr26 = rdinx(0x3c4, 0x26); - new->sr27 = rdinx(0x3c4, 0x27); - new->sr29 = rdinx(0x3c4, 0x29); - new->sr2a = rdinx(0x3c4, 0x2a); + new->sr20 = rdinx(isaIOBase + 0x3c4, 0x20); + new->sr21 = rdinx(isaIOBase + 0x3c4, 0x21); + new->sr22 = rdinx(isaIOBase + 0x3c4, 0x22); + new->sr23 = rdinx(isaIOBase + 0x3c4, 0x23); + new->sr24 = rdinx(isaIOBase + 0x3c4, 0x24); + new->sr25 = rdinx(isaIOBase + 0x3c4, 0x25); + new->sr26 = rdinx(isaIOBase + 0x3c4, 0x26); + new->sr27 = rdinx(isaIOBase + 0x3c4, 0x27); + new->sr29 = rdinx(isaIOBase + 0x3c4, 0x29); + new->sr2a = rdinx(isaIOBase + 0x3c4, 0x2a); if ((pARK->Chipset == PCI_CHIP_2000PV) || (pARK->Chipset == PCI_CHIP_2000MT)) { - new->sr28 = rdinx(0x3c4, 0x28); - new->sr2b = rdinx(0x3c4, 0x3b); + new->sr28 = rdinx(isaIOBase + 0x3c4, 0x28); + new->sr2b = rdinx(isaIOBase + 0x3c4, 0x3b); } #endif @@ -913,7 +914,7 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; ARKPtr pARK = ARKPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - int vgaIOBase = hwp->IOBase; + IOADDRESS vgaIOBase = hwp->PIOOffset + hwp->IOBase; int base; base = ((y * pScrn->displayWidth + x) * @@ -940,47 +941,48 @@ { ARKPtr pARK = ARKPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - int vgaIOBase = hwp->IOBase; + IOADDRESS isaIOBase = hwp->PIOOffset; + IOADDRESS vgaIOBase = isaIOBase + hwp->IOBase; vgaHWProtect(pScrn, TRUE); /* set read and write aperture index to 0 */ - wrinx(0x3c4, 0x15, 0x00); - wrinx(0x3c4, 0x16, 0x00); + wrinx(isaIOBase + 0x3c4, 0x15, 0x00); + wrinx(isaIOBase + 0x3c4, 0x16, 0x00); /* write the extended registers first so that textmode font * restoration can suceed */ - wrinx(0x3c4, 0x10, new->sr10); - wrinx(0x3c4, 0x11, new->sr11); - wrinx(0x3c4, 0x12, new->sr12); - wrinx(0x3c4, 0x13, new->sr13); - wrinx(0x3c4, 0x14, new->sr14); - wrinx(0x3c4, 0x15, new->sr15); - wrinx(0x3c4, 0x16, new->sr16); - wrinx(0x3c4, 0x17, new->sr17); + wrinx(isaIOBase + 0x3c4, 0x10, new->sr10); + wrinx(isaIOBase + 0x3c4, 0x11, new->sr11); + wrinx(isaIOBase + 0x3c4, 0x12, new->sr12); + wrinx(isaIOBase + 0x3c4, 0x13, new->sr13); + wrinx(isaIOBase + 0x3c4, 0x14, new->sr14); + wrinx(isaIOBase + 0x3c4, 0x15, new->sr15); + wrinx(isaIOBase + 0x3c4, 0x16, new->sr16); + wrinx(isaIOBase + 0x3c4, 0x17, new->sr17); #if 0 - wrinx(0x3c4, 0x1c, new->sr1c); - wrinx(0x3c4, 0x1d, new->sr1d); + wrinx(isaIOBase + 0x3c4, 0x1c, new->sr1c); + wrinx(isaIOBase + 0x3c4, 0x1d, new->sr1d); /* hw cursor regs */ - wrinx(0x3c4, 0x20, new->sr20); - wrinx(0x3c4, 0x21, new->sr21); - wrinx(0x3c4, 0x22, new->sr22); - wrinx(0x3c4, 0x23, new->sr23); - wrinx(0x3c4, 0x24, new->sr24); - wrinx(0x3c4, 0x25, new->sr25); - wrinx(0x3c4, 0x26, new->sr26); - wrinx(0x3c4, 0x27, new->sr27); - wrinx(0x3c4, 0x29, new->sr29); - wrinx(0x3c4, 0x2a, new->sr2a); + wrinx(isaIOBase + 0x3c4, 0x20, new->sr20); + wrinx(isaIOBase + 0x3c4, 0x21, new->sr21); + wrinx(isaIOBase + 0x3c4, 0x22, new->sr22); + wrinx(isaIOBase + 0x3c4, 0x23, new->sr23); + wrinx(isaIOBase + 0x3c4, 0x24, new->sr24); + wrinx(isaIOBase + 0x3c4, 0x25, new->sr25); + wrinx(isaIOBase + 0x3c4, 0x26, new->sr26); + wrinx(isaIOBase + 0x3c4, 0x27, new->sr27); + wrinx(isaIOBase + 0x3c4, 0x29, new->sr29); + wrinx(isaIOBase + 0x3c4, 0x2a, new->sr2a); #endif if ((pARK->Chipset == PCI_CHIP_2000PV) || (pARK->Chipset == PCI_CHIP_2000MT)) { - wrinx(0x3c4, 0x28, new->sr28); - wrinx(0x3c4, 0x2B, new->sr2b); + wrinx(isaIOBase + 0x3c4, 0x28, new->sr28); + wrinx(isaIOBase + 0x3c4, 0x2B, new->sr2b); } wrinx(vgaIOBase + 4, 0x40, new->cr40); @@ -994,7 +996,7 @@ /* RAMDAC regs */ if (pARK->ramdac == ZOOMDAC) { - set_daccom(new->dac_command); + set_daccom(isaIOBase, new->dac_command); } if (xf86IsPrimaryPci(pARK->PciInfo)) @@ -1003,7 +1005,6 @@ vgaHWRestore(pScrn, pVga, VGA_SR_MODE); vgaHWProtect(pScrn, FALSE); - } @@ -1033,8 +1034,6 @@ vgaHWUnlock(hwp); vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS); vgaHWLock(hwp); - - return; } @@ -1046,8 +1045,8 @@ /* extended to cover MMIO space at 0xB8000 */ hwp->MapSize = 0x20000; - pARK->MMIOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, - 0xb8000, 0x8000); + pARK->MMIOBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO, + pARK->PciTag, 0xb8000, 0x8000); pARK->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pARK->PciTag, pARK->FBAddress, @@ -1071,8 +1070,6 @@ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pARK->FBBase, pScrn->videoRam * 1024); - - return; } @@ -1114,14 +1111,15 @@ int *indicies, LOCO *colors, VisualPtr pVisual) { + IOADDRESS isaIOBase = pScrn->domainIOBase; int i, index; for (i=0; i<numColors; i++) { index = indicies[i]; - outb(0x3c8, index); - outb(0x3c9, colors[index].red); - outb(0x3c9, colors[index].green); - outb(0x3c9, colors[index].blue); + outb(isaIOBase + 0x3c8, index); + outb(isaIOBase + 0x3c9, colors[index].red); + outb(isaIOBase + 0x3c9, colors[index].green); + outb(isaIOBase + 0x3c9, colors[index].blue); } } @@ -1136,39 +1134,39 @@ } -static unsigned char get_daccomm(void) +static unsigned char get_daccomm(IOADDRESS isaIOBase) { unsigned char tmp; - outb(0x3c8, 0); - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - tmp = inb(0x3c6); - outb(0x3c8, 0); + outb(isaIOBase + 0x3c8, 0); + inb(isaIOBase + 0x3c6); + inb(isaIOBase + 0x3c6); + inb(isaIOBase + 0x3c6); + inb(isaIOBase + 0x3c6); + tmp = inb(isaIOBase + 0x3c6); + outb(isaIOBase + 0x3c8, 0); return tmp; } -static unsigned char set_daccom(unsigned char comm) +static unsigned char set_daccom(IOADDRESS isaIOBase, unsigned char comm) { #if 0 - outb(0x3c8, 0); + outb(isaIOBase + 0x3c8, 0); #else - inb(0x3c8); + inb(isaIOBase + 0x3c8); #endif - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - outb(0x3c6, comm); + inb(isaIOBase + 0x3c6); + inb(isaIOBase + 0x3c6); + inb(isaIOBase + 0x3c6); + inb(isaIOBase + 0x3c6); + outb(isaIOBase + 0x3c6, comm); #if 0 - outb(0x3c8, 0); + outb(isaIOBase + 0x3c8, 0); #else - inb(0x3c8); + inb(isaIOBase + 0x3c8); #endif - return inb(0x3c6); + return inb(isaIOBase + 0x3c6); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.36 xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.45 --- xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.36 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile Mon Feb 17 12:06:41 2003 @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.36 2002/01/16 16:22:25 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.45 2003/02/17 17:06:41 dawes Exp $ XCOMM -XCOMM Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org +XCOMM Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org XCOMM XCOMM Permission to use, copy, modify, distribute, and sell this software and XCOMM its documentation for any purpose is hereby granted without fee, provided @@ -83,6 +83,7 @@ */ #if defined(i386Architecture) || \ defined(ia64Architecture) || \ + defined(x86_64Architecture) || \ defined(AlphaArchitecture) # ifndef ATIAvoidCPIO # define ATIAvoidCPIO NO @@ -130,7 +131,7 @@ #endif #ifndef ATIAvoidDGA -#define ATIAVoidDGA NO +#define ATIAvoidDGA NO #endif #if ATIAvoidDGA @@ -177,7 +178,7 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86SRC) \ - -I$(XF86OSSRC)/vbe -I$(XF86SRC)/int10 \ + -I$(XF86SRC)/vbe -I$(XF86SRC)/int10 \ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ -I$(XF86SRC)/rac -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/shadowfb -I$(XF86SRC)/xaa -I$(XF86SRC)/xf24_32bpp \ @@ -185,6 +186,7 @@ -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \ -I$(SERVERSRC)/cfb -I$(SERVERSRC)/mfb \ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/miext/shadow \ -I$(SERVERSRC)/render -I$(SERVERSRC)/Xext -I$(SERVERSRC)/include \ $(DRIINCLUDES) -I$(FONTINCSRC) -I$(EXTINCSRC) -I$(XINCLUDESRC) #endif @@ -211,6 +213,8 @@ InstallModuleManPage(r128) +InstallModuleManPage(radeon) + DependTarget() InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/ati) @@ -309,6 +313,7 @@ InstallDriverSDKNonExecFile(r128_sarea.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_version.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_video.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(r128_common.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_accel.c,$(DRIVERSDKDIR)/drivers/ati) @@ -318,6 +323,7 @@ InstallDriverSDKNonExecFile(radeon_dri.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_dripriv.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_driver.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_macros.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_misc.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_probe.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_probe.h,$(DRIVERSDKDIR)/drivers/ati) @@ -325,6 +331,7 @@ InstallDriverSDKNonExecFile(radeon_sarea.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_version.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_video.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_common.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKObjectModule(ati,$(DRIVERSDKMODULEDIR),drivers) InstallDriverSDKObjectModule(atimisc,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.19 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.19 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.21 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -32,43 +32,16 @@ * exception. Contributions, intentional or not, to this and previous versions * of this driver by the following are hereby acknowledged: * - * Thomas Roell, roell@informatik.tu-muenchen.de - * Per Lindqvist, pgd@compuram.bbt.se - * Doug Evans, dje@cygnus.com - * Rik Faith, faith@precisioninsight.com - * Arthur Tateishi, ruhtra@turing.toronto.edu - * Alain Hebert, aal@broue.rot.qc.ca - * Ton van Rosmalen, ton@stack.urc.tue.nl - * David Chambers, davidc@netcom.com - * William Shubert, wms@ssd.intel.com - * ATI Technologies Incorporated - * Robert Wolff - * David Dawes, dawes@xfree86.org - * Mark Weaver, Mark_Weaver@brown.edu - * Hans Nasten, nasten@everyware.se - * Kevin Martin, martin@precisioninsight.com - * Frederic Rienthaler, root@mojo.synapse.com - * Marc Bolduc, bolduc@cim.mcgill.ca - * Reuben Sumner, rasumner@undergrad.math.uwaterloo.ca - * Benjamin T. Yang, risk@uclink.berkeley.edu - * James Fast Kane, jfk2@engr.uark.edu - * Randall Hopper, rhh@ct.picker.com - * W. Marcus Miller, marcus@llnl.gov - * Henrik Harmsen, ervhch@erv.ericsson.se - * Christian Lupien, lupien@physics.utoronto.ca - * Precision Insight Incorporated - * Mark Vojkovich, mvojkovich@nvidia.com - * Huw D M Davies, h.davies1@physics.ox.ac.uk - * Andrew C Aitchison, A.C.Aitchison@dpmms.cam.ac.uk - * Ani Joshi, ajoshi@shell.unixbox.com - * Kostas Gewrgiou, gewrgiou@imbc.gr - * Jakub Jelinek, jakub@redhat.com - * David S. Miller, davem@redhat.com - * A E Lawrence, adrian.lawrence@computing-services.oxford.ac.uk - * Linus Torvalds, torvalds@transmeta.com - * William Blew, wblew@home.com - * Ignacio Garcia Etxebarria, garetxe@euskalnet.net - * Patrick Chase, pchase2@pacbell.net + * Thomas Roell, Per Lindqvist, Doug Evans, Rik Faith, Arthur Tateishi, + * Alain Hebert, Ton van Rosmalen, David Chambers, William Shubert, + * ATI Technologies Incorporated, Robert Wolff, David Dawes, Mark Weaver, + * Hans Nasten, Kevin Martin, Frederic Rienthaler, Marc Bolduc, Reuben Sumner, + * Benjamin T. Yang, James Fast Kane, Randall Hopper, W. Marcus Miller, + * Henrik Harmsen, Christian Lupien, Precision Insight Incorporated, + * Mark Vojkovich, Huw D M Davies, Andrew C Aitchison, Ani Joshi, + * Kostas Gewrgiou, Jakub Jelinek, David S. Miller, A E Lawrence, + * Linus Torvalds, William Blew, Ignacio Garcia Etxebarria, Patrick Chase, + * Vladimir Dergachev * * ... and, many, many others from around the world. * Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.8 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.8 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.9 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.10 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.10 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.11 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.3 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.3 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.4 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.16 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.16 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.16 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.17 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.9 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.9 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.10 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.13 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.13 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.14 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.7 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h,v 1.7 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h,v 1.8 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.11 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.11 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.12 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.7 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.7 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.8 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.16 xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.16 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c Wed Jan 22 16:44:10 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.16 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.18 2003/01/22 21:44:10 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -136,10 +136,14 @@ #endif /* AVOID_CPIO */ /* Register unshared relocatable resources for inactive adapters */ - pResources = xf86RegisterResources(pATI->iEntity, NULL, ResExclusive); - pResources = xf86ReallocatePciResources(pATI->iEntity, pResources); - if (!pResources) - return; + do + { + pResources = xf86RegisterResources(pATI->iEntity, NULL, ResExclusive); + if (!pResources) + return; + + pResources = xf86ReallocatePciResources(pATI->iEntity, pResources); + } while (!pResources); xf86Msg(X_WARNING, ATI_NAME ": Unable to register the following resources for inactive" Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.9 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.9 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.11 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -53,7 +53,7 @@ extern const char *ATIBusNames[]; -extern int ATIClaimBusSlot FunctionPrototype((DriverPtr, int, GDevPtr, - Bool, ATIPtr)); +extern int ATIClaimBusSlot FunctionPrototype((DriverPtr, int, GDevPtr, Bool, + ATIPtr)); #endif /* ___ATIBUS_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.25 xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.25 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c Wed Feb 19 10:07:46 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.25 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.33 2003/02/19 15:07:46 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -90,6 +90,9 @@ "ATI Radeon Mobility M7", "ATI Radeon 8500", "ATI Radeon 7500", + "ATI Radeon 9000", + "ATI Radeon Mobility M9", + "ATI Radeon 9700", "ATI Rage HDTV" }; @@ -439,7 +442,7 @@ case OldChipID('X', 'X'): case NewChipID('X', 'X'): return ATI_CHIP_68800_6; - case OldChipID('L', 'X'): case NewChipID('L', 'X'): + case OldChipID('L', 'X'): return ATI_CHIP_68800LX; case OldChipID('A', 'X'): case NewChipID('A', 'X'): @@ -534,19 +537,34 @@ case NewChipID('R', 'E'): case NewChipID('R', 'F'): + case NewChipID('R', 'G'): case NewChipID('S', 'K'): case NewChipID('S', 'L'): case NewChipID('S', 'M'): + /* "SN" is listed as ATI_CHIP_RAGE128_4X in ATI docs */ case NewChipID('S', 'N'): return ATI_CHIP_RAGE128GL; case NewChipID('R', 'K'): case NewChipID('R', 'L'): + /* + * ATI documentation lists SE/SF/SG under both ATI_CHIP_RAGE128VR + * and ATI_CHIP_RAGE128_4X, and lists SH/SK/SL under Rage 128 4X only. + * I'm stuffing them here for now until this can be clarified as ATI + * documentation doesn't mention their details. <mharris@redhat.com> + */ case NewChipID('S', 'E'): case NewChipID('S', 'F'): case NewChipID('S', 'G'): + case NewChipID('S', 'H'): return ATI_CHIP_RAGE128VR; + /* case NewChipID('S', 'H'): */ + /* case NewChipID('S', 'K'): */ + /* case NewChipID('S', 'L'): */ + /* case NewChipID('S', 'N'): */ + /* return ATI_CHIP_RAGE128_4X; */ + case NewChipID('P', 'A'): case NewChipID('P', 'B'): case NewChipID('P', 'C'): @@ -578,10 +596,17 @@ case NewChipID('T', 'F'): case NewChipID('T', 'L'): case NewChipID('T', 'R'): + case NewChipID('T', 'S'): + case NewChipID('T', 'T'): + case NewChipID('T', 'U'): return ATI_CHIP_RAGE128PROULTRA; case NewChipID('L', 'E'): case NewChipID('L', 'F'): + /* + * "LK" and "LL" are not in any ATI documentation I can find + * - mharris + */ case NewChipID('L', 'K'): case NewChipID('L', 'L'): return ATI_CHIP_RAGE128MOBILITY3; @@ -605,17 +630,50 @@ return ATI_CHIP_RADEONMOBILITY6; case NewChipID('L', 'W'): + case NewChipID('L', 'X'): return ATI_CHIP_RADEONMOBILITY7; + case NewChipID('Q', 'H'): + case NewChipID('Q', 'I'): + case NewChipID('Q', 'J'): + case NewChipID('Q', 'K'): case NewChipID('Q', 'L'): + case NewChipID('Q', 'M'): case NewChipID('Q', 'N'): case NewChipID('Q', 'O'): + case NewChipID('Q', 'h'): + case NewChipID('Q', 'i'): + case NewChipID('Q', 'j'): + case NewChipID('Q', 'k'): case NewChipID('Q', 'l'): case NewChipID('B', 'B'): return ATI_CHIP_R200; case NewChipID('Q', 'W'): + case NewChipID('Q', 'X'): return ATI_CHIP_RV200; + + case NewChipID('I', 'd'): + case NewChipID('I', 'e'): + case NewChipID('I', 'f'): + case NewChipID('I', 'g'): + return ATI_CHIP_RV250; + + case NewChipID('L', 'd'): + case NewChipID('L', 'e'): + case NewChipID('L', 'f'): + case NewChipID('L', 'g'): + return ATI_CHIP_RADEONMOBILITY9; + + case NewChipID('A', 'D'): + case NewChipID('A', 'E'): + case NewChipID('A', 'F'): + case NewChipID('A', 'G'): + case NewChipID('N', 'D'): + case NewChipID('N', 'E'): + case NewChipID('N', 'F'): + case NewChipID('N', 'G'): + return ATI_CHIP_R300; case NewChipID('H', 'D'): return ATI_CHIP_HDTV; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.20 xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.20 Wed Jan 16 11:22:25 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h Wed Jan 1 14:16:30 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.20 2002/01/16 16:22:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.22 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -92,6 +92,9 @@ ATI_CHIP_RADEONMOBILITY7, /* Radeon M7 */ ATI_CHIP_R200, /* R200 */ ATI_CHIP_RV200, /* RV200 */ + ATI_CHIP_RV250, /* RV250 */ + ATI_CHIP_RADEONMOBILITY9, /* Radeon M9 */ + ATI_CHIP_R300, /* R300 */ ATI_CHIP_HDTV /* HDTV */ } ATIChipType; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.18 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.18 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.20 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -430,7 +430,7 @@ * This function tries to match the XF86Config clocks to one of an array of * clock lines. It returns a clock line number or 0. */ -static const int +static int ATIMatchClockLine ( ScrnInfoPtr pScreenInfo, Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.7 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.7 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.8 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.9 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.12 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -34,9 +34,10 @@ */ typedef enum { - ATI_OPTION_DEVEL, /* Intentionally undocumented */ - ATI_OPTION_SYNC, /* Use XF86Config panel mode porches */ - ATI_OPTION_BLEND /* Force horizontal blending of small modes */ + ATI_OPTION_CRT_SCREEN, /* Legacy negation of "PanelDisplay" */ + ATI_OPTION_DEVEL, /* Intentionally undocumented */ + ATI_OPTION_BLEND, /* Force horizontal blending of small modes */ + ATI_OPTION_SYNC /* Use XF86Config panel mode porches */ } ATIPrivateOptionType; /* @@ -55,13 +56,20 @@ OptionInfoPtr PublicOption = xnfalloc(ATIPublicOptionSize); OptionInfoRec PrivateOption[] = { - { /* ON: Ease exploration of loose ends */ - ATI_OPTION_DEVEL, /* OFF: Fit for public consumption */ - "tsi", + { /* Negation of "PanelDisplay" public option */ + ATI_OPTION_CRT_SCREEN, + "crtscreen", OPTV_BOOLEAN, {0, }, FALSE }, + { /* ON: Horizontally blend most modes */ + ATI_OPTION_BLEND, /* OFF: Use pixel replication more often */ + "lcdblend", + OPTV_BOOLEAN, + {0, }, + FALSE + }, { /* ON: Use XF86Config porch timings */ ATI_OPTION_SYNC, /* OFF: Use porches from mode on entry */ "lcdsync", @@ -69,9 +77,9 @@ {0, }, FALSE }, - { /* ON: Horizontally blend most modes */ - ATI_OPTION_BLEND, /* OFF: Use pixel replication more often */ - "lcdblend", + { /* ON: Ease exploration of loose ends */ + ATI_OPTION_DEVEL, /* OFF: Fit for public consumption */ + "tsi", OPTV_BOOLEAN, {0, }, FALSE @@ -87,24 +95,26 @@ (void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize); -# define Accel PublicOption[ATI_OPTION_ACCEL].value.bool -# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool -# define CRTScreen PublicOption[ATI_OPTION_CRT].value.bool -# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool -# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool -# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool +# define Accel PublicOption[ATI_OPTION_ACCEL].value.bool +# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool +# define CRTDisplay PublicOption[ATI_OPTION_CRT_DISPLAY].value.bool +# define CRTScreen PrivateOption[ATI_OPTION_CRT_SCREEN].value.bool +# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool +# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool +# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool #ifndef AVOID_CPIO -# define Linear PublicOption[ATI_OPTION_LINEAR].value.bool +# define Linear PublicOption[ATI_OPTION_LINEAR].value.bool #endif /* AVOID_CPIO */ -# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool -# define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool -# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool -# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool -# define Sync PrivateOption[ATI_OPTION_SYNC].value.bool +# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool +# define PanelDisplay PublicOption[ATI_OPTION_PANEL_DISPLAY].value.bool +# define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool +# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool +# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool +# define Sync PrivateOption[ATI_OPTION_SYNC].value.bool # define ReferenceClock \ PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq @@ -143,7 +153,7 @@ ShadowFB = TRUE; } - Blend = CSync = /* Sync = */ TRUE; + Blend = PanelDisplay = TRUE; xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, PublicOption); @@ -166,7 +176,7 @@ /* Move option values into driver private structure */ pATI->OptionAccel = Accel; pATI->OptionBlend = Blend; - pATI->OptionCRT = CRTScreen; + pATI->OptionCRTDisplay = CRTDisplay; pATI->OptionCSync = CSync; pATI->OptionDevel = Devel; @@ -180,6 +190,13 @@ pATI->OptionProbeClocks = ProbeClocks; pATI->OptionShadowFB = ShadowFB; pATI->OptionSync = Sync; + + /* "CRTScreen" is now "NoPanelDisplay" */ + if ((PanelDisplay != CRTScreen) || + PublicOption[ATI_OPTION_PANEL_DISPLAY].found) + pATI->OptionPanelDisplay = PanelDisplay; + else + pATI->OptionPanelDisplay = !CRTScreen; /* Validate and set cursor options */ pATI->Cursor = ATI_CURSOR_SOFTWARE; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.3 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h,v 1.3 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h,v 1.5 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -29,7 +29,6 @@ #include "xf86str.h" -extern void ATIProcessOptions FunctionPrototype((ScrnInfoPtr, - ATIPtr)); +extern void ATIProcessOptions FunctionPrototype((ScrnInfoPtr, ATIPtr)); #endif /* ___ATICONFIG_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.19 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.19 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.20 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.8 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.8 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.9 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.7 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.7 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.8 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.2 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.2 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.3 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.2 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.2 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.3 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.14 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c Tue Feb 25 12:58:13 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.14 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.18 2003/02/25 17:58:13 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -29,7 +29,7 @@ /* * RAMDAC-related definitions. */ -const DACRec ATIDACDescriptors[] = +const SymTabRec ATIDACDescriptors[] = { /* Keep this table in ascending DACType order */ {ATI_DAC_ATI68830, "ATI 68830 or similar"}, {ATI_DAC_SC11483, "Sierra 11483 or similar"}, @@ -78,6 +78,7 @@ pATI->CPIO_DAC_MASK = VGA_DAC_MASK; pATI->CPIO_DAC_READ = VGA_DAC_READ; pATI->CPIO_DAC_WRITE = VGA_DAC_WRITE; + pATI->CPIO_DAC_WAIT = GENS1(pATI->CPIO_VGABase); break; case ATI_CRTC_8514: @@ -85,6 +86,7 @@ pATI->CPIO_DAC_MASK = IBM_DAC_MASK; pATI->CPIO_DAC_READ = IBM_DAC_READ; pATI->CPIO_DAC_WRITE = IBM_DAC_WRITE; + pATI->CPIO_DAC_WAIT = pATI->CPIO_DAC_MASK; break; case ATI_CRTC_MACH64: @@ -92,6 +94,7 @@ pATI->CPIO_DAC_MASK = ATIIOPort(DAC_REGS) + 2; pATI->CPIO_DAC_READ = ATIIOPort(DAC_REGS) + 3; pATI->CPIO_DAC_WRITE = ATIIOPort(DAC_REGS) + 0; + pATI->CPIO_DAC_WAIT = pATI->CPIOBase; break; default: Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.11 xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.11 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.11 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.15 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -34,47 +34,44 @@ #include "atipriv.h" #include "atiproto.h" +#include "xf86str.h" + #include "colormapst.h" /* * RAMDAC-related definitions. */ -#define ATI_DAC_MAX_TYPE MaxBits(DACTYPE) -#define ATI_DAC_MAX_SUBTYPE MaxBits(BIOS_INIT_DAC_SUBTYPE) +#define ATI_DAC_MAX_TYPE MaxBits(DACTYPE) +#define ATI_DAC_MAX_SUBTYPE MaxBits(BIOS_INIT_DAC_SUBTYPE) -#define ATI_DAC(_Type, _Subtype) (((_Type) << 4) | (_Subtype)) +#define ATI_DAC(_Type, _Subtype) (((_Type) << 4) | (_Subtype)) -#define ATI_DAC_ATI68830 ATI_DAC(0x0U, 0x0U) -#define ATI_DAC_SC11483 ATI_DAC(0x1U, 0x0U) -#define ATI_DAC_ATI68875 ATI_DAC(0x2U, 0x0U) -#define ATI_DAC_TVP3026_A ATI_DAC(0x2U, 0x7U) -#define ATI_DAC_GENERIC ATI_DAC(0x3U, 0x0U) -#define ATI_DAC_BT481 ATI_DAC(0x4U, 0x0U) -#define ATI_DAC_ATT20C491 ATI_DAC(0x4U, 0x1U) -#define ATI_DAC_SC15026 ATI_DAC(0x4U, 0x2U) -#define ATI_DAC_MU9C1880 ATI_DAC(0x4U, 0x3U) -#define ATI_DAC_IMSG174 ATI_DAC(0x4U, 0x4U) -#define ATI_DAC_ATI68860_B ATI_DAC(0x5U, 0x0U) -#define ATI_DAC_ATI68860_C ATI_DAC(0x5U, 0x1U) -#define ATI_DAC_TVP3026_B ATI_DAC(0x5U, 0x7U) -#define ATI_DAC_STG1700 ATI_DAC(0x6U, 0x0U) -#define ATI_DAC_ATT20C498 ATI_DAC(0x6U, 0x1U) -#define ATI_DAC_STG1702 ATI_DAC(0x7U, 0x0U) -#define ATI_DAC_SC15021 ATI_DAC(0x7U, 0x1U) -#define ATI_DAC_ATT21C498 ATI_DAC(0x7U, 0x2U) -#define ATI_DAC_STG1703 ATI_DAC(0x7U, 0x3U) -#define ATI_DAC_CH8398 ATI_DAC(0x7U, 0x4U) -#define ATI_DAC_ATT20C408 ATI_DAC(0x7U, 0x5U) -#define ATI_DAC_INTERNAL ATI_DAC(0x8U, 0x0U) -#define ATI_DAC_IBMRGB514 ATI_DAC(0x9U, 0x0U) -#define ATI_DAC_UNKNOWN ATI_DAC((ATI_DAC_MAX_TYPE << 2) + 3, \ - ATI_DAC_MAX_SUBTYPE) -typedef struct -{ - const int DACType; - const char *DACName; -} DACRec; -extern const DACRec ATIDACDescriptors[]; +#define ATI_DAC_ATI68830 ATI_DAC(0x0U, 0x0U) +#define ATI_DAC_SC11483 ATI_DAC(0x1U, 0x0U) +#define ATI_DAC_ATI68875 ATI_DAC(0x2U, 0x0U) +#define ATI_DAC_TVP3026_A ATI_DAC(0x2U, 0x7U) +#define ATI_DAC_GENERIC ATI_DAC(0x3U, 0x0U) +#define ATI_DAC_BT481 ATI_DAC(0x4U, 0x0U) +#define ATI_DAC_ATT20C491 ATI_DAC(0x4U, 0x1U) +#define ATI_DAC_SC15026 ATI_DAC(0x4U, 0x2U) +#define ATI_DAC_MU9C1880 ATI_DAC(0x4U, 0x3U) +#define ATI_DAC_IMSG174 ATI_DAC(0x4U, 0x4U) +#define ATI_DAC_ATI68860_B ATI_DAC(0x5U, 0x0U) +#define ATI_DAC_ATI68860_C ATI_DAC(0x5U, 0x1U) +#define ATI_DAC_TVP3026_B ATI_DAC(0x5U, 0x7U) +#define ATI_DAC_STG1700 ATI_DAC(0x6U, 0x0U) +#define ATI_DAC_ATT20C498 ATI_DAC(0x6U, 0x1U) +#define ATI_DAC_STG1702 ATI_DAC(0x7U, 0x0U) +#define ATI_DAC_SC15021 ATI_DAC(0x7U, 0x1U) +#define ATI_DAC_ATT21C498 ATI_DAC(0x7U, 0x2U) +#define ATI_DAC_STG1703 ATI_DAC(0x7U, 0x3U) +#define ATI_DAC_CH8398 ATI_DAC(0x7U, 0x4U) +#define ATI_DAC_ATT20C408 ATI_DAC(0x7U, 0x5U) +#define ATI_DAC_INTERNAL ATI_DAC(0x8U, 0x0U) +#define ATI_DAC_IBMRGB514 ATI_DAC(0x9U, 0x0U) +#define ATI_DAC_UNKNOWN ATI_DAC((ATI_DAC_MAX_TYPE << 2) + 3, \ + ATI_DAC_MAX_SUBTYPE) +extern const SymTabRec ATIDACDescriptors[]; #ifdef AVOID_CPIO @@ -82,24 +79,25 @@ #else /* AVOID_CPIO */ -# define DACDelay \ - do \ - { \ - (void)inb(GENS1(pATI->CPIO_VGABase)); \ - (void)inb(GENS1(pATI->CPIO_VGABase)); \ +# define DACDelay \ + do \ + { \ + (void)inb(pATI->CPIO_DAC_WAIT); \ + (void)inb(pATI->CPIO_DAC_WAIT); \ } while (0) extern void ATISetDACIOPorts FunctionPrototype((ATIPtr, ATICRTCType)); #endif /* AVOID_CPIO */ -extern CARD8 ATIGetDACCmdReg FunctionPrototype((ATIPtr)); +extern CARD8 ATIGetDACCmdReg FunctionPrototype((ATIPtr)); -extern void ATIDACPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); -extern void ATIDACSave FunctionPrototype((ATIPtr, ATIHWPtr)); -extern void ATIDACSet FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIDACPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, + ATIHWPtr)); +extern void ATIDACSave FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIDACSet FunctionPrototype((ATIPtr, ATIHWPtr)); -extern void ATILoadPalette FunctionPrototype((ScrnInfoPtr, int, int *, LOCO *, - VisualPtr)); +extern void ATILoadPalette FunctionPrototype((ScrnInfoPtr, int, int *, + LOCO *, VisualPtr)); #endif /* ___ATIDAC_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.8 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.8 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.9 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.5 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.5 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.6 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.14 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c Wed Jan 1 14:16:31 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.14 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.19 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -73,6 +73,14 @@ pATI->XCLKPostDivider -= GetBits(IOValue, PLL_MFB_TIMES_4_2B); pATI->XCLKFeedbackDivider = ATIGetMach64PLLReg(PLL_MCLK_FB_DIV); + xf86DrvMsgVerb(iScreen, X_INFO, 2, + "Engine XCLK %.3f MHz; Refresh rate code %d.\n", + ATIDivide(pATI->XCLKFeedbackDivider * pATI->ReferenceNumerator, + pATI->XCLKReferenceDivider * pATI->ClockDescriptor.MaxM * + pATI->ReferenceDenominator, 1 - pATI->XCLKPostDivider, 0) / + (double)1000.0, + GetBits(pATI->LockData.mem_cntl, CTL_MEM_REFRESH_RATE_B)); + /* Compute maximum RAS delay and friends */ trp = GetBits(pATI->LockData.mem_cntl, CTL_MEM_TRP); pATI->XCLKPageFaultDelay = GetBits(pATI->LockData.mem_cntl, CTL_MEM_TRCD) + @@ -149,7 +157,7 @@ (!dsp_config || !((dsp_config ^ vga_dsp_config) & DSP_XCLKS_PER_QW)))) { if (ATIDivide(GetBits(vga_dsp_on_off, VGA_DSP_OFF), - GetBits(vga_dsp_config, VGA_DSP_XCLKS_PER_QW), 5, 1) > 23) + GetBits(vga_dsp_config, VGA_DSP_XCLKS_PER_QW), 5, 1) > 24) pATI->DisplayFIFODepth = 32; else pATI->DisplayFIFODepth = 24; @@ -226,7 +234,7 @@ #endif /* AVOID_CPIO */ - if (!pATI->OptionCRT && (pATI->LCDPanelID >= 0)) + if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) { /* Compensate for horizontal stretching */ Multiplier *= pATI->LCDHorizontal; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.9 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.10 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.9 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.11 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -23,6 +23,7 @@ #include "ati.h" #include "atiident.h" +#include "atiutil.h" #include "ativersion.h" #include "r128_probe.h" @@ -79,7 +80,9 @@ ) { xf86PrintChipsets(ATI_NAME, - "ATI driver (version " ATI_VERSION_NAME ") for chipsets", + (NumberOf(ATIPublicChipsetNames) <= 2) ? + "ATI driver (version " ATI_VERSION_NAME ") for chipset" : + "ATI driver (version " ATI_VERSION_NAME ") for chipsets", ATIPublicChipsetNames); R128Identify(flags); RADEONIdentify(flags); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.9 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.10 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.13 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.13 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.14 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.8 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.8 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.12 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -29,24 +29,99 @@ #include "atistruct.h" /* + * All symbol lists belong here. They are externalised so that they can be + * referenced elsewhere. Note the naming convention for these things... + */ + +const char *ATIint10Symbols[] = +{ + "xf86FreeInt10", + "xf86InitInt10", + "xf86int10Addr", + NULL +}; + +const char *ATIddcSymbols[] = +{ + "xf86PrintEDID", + "xf86SetDDCProperties", + NULL +}; + +const char *ATIvbeSymbols[] = +{ + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + +#ifndef AVOID_CPIO + +const char *ATIxf1bppSymbols[] = +{ + "xf1bppScreenInit", + NULL +}; + +const char *ATIxf4bppSymbols[] = +{ + "xf4bppScreenInit", + NULL +}; + +#endif /* AVOID_CPIO */ + +const char *ATIfbSymbols[] = +{ + "fbPictureInit", + "fbScreenInit", + NULL +}; + +const char *ATIshadowfbSymbols[] = +{ + "ShadowFBInit", + NULL +}; + +const char *ATIxaaSymbols[] = +{ + "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAInit", + NULL +}; + +const char *ATIramdacSymbols[] = +{ + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + "xf86ForceHWCursor", + NULL +}; + +/* * ATILoadModule -- * - * Load a specific module and register its main entry with the loader. + * Load a specific module and register with the loader those of its entry + * points that are referenced by this driver. */ -static Bool +pointer ATILoadModule ( - ScrnInfoPtr pScreenInfo, - const char *Module, - const char *Symbol + ScrnInfoPtr pScreenInfo, + const char *Module, + const char **SymbolList ) { - if (!xf86LoadSubModule(pScreenInfo, Module)) - return FALSE; + pointer pModule = xf86LoadSubModule(pScreenInfo, Module); - xf86LoaderReqSymbols(Symbol, NULL); + if (pModule) + xf86LoaderReqSymLists(SymbolList, NULL); - return TRUE; + return pModule; } /* @@ -54,65 +129,28 @@ * * This function loads other modules required for a screen. */ -Bool +pointer ATILoadModules ( ScrnInfoPtr pScreenInfo, ATIPtr pATI ) { - /* - * Tell loader about symbols from other modules that this module might - * refer to. - */ - LoaderRefSymbols( - -#ifndef AVOID_CPIO - - "xf1bppScreenInit", - "xf4bppScreenInit", - -#endif /* AVOID_CPIO */ - - "fbScreenInit", - "fbPictureInit", - "ShadowFBInit", - "XAACreateInfoRec", - "XAADestroyInfoRec", - "XAAInit", - "xf86InitCursor", - "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", - NULL); - /* Load shadow frame buffer code if needed */ if (pATI->OptionShadowFB && - !ATILoadModule(pScreenInfo, "shadowfb", "ShadowFBInit")) - return FALSE; + !ATILoadModule(pScreenInfo, "shadowfb", ATIshadowfbSymbols)) + return NULL; /* Load XAA if needed */ - if (pATI->OptionAccel) - { - if (!ATILoadModule(pScreenInfo, "xaa", "XAAInit")) - return FALSE; + if (pATI->OptionAccel && + !ATILoadModule(pScreenInfo, "xaa", ATIxaaSymbols)) + return NULL; - /* Require more XAA symbols */ - xf86LoaderReqSymbols("XAACreateInfoRec", "XAADestroyInfoRec", NULL); - } - /* Load ramdac module if needed */ - if (pATI->Cursor > ATI_CURSOR_SOFTWARE) - { - if (!ATILoadModule(pScreenInfo, "ramdac", "xf86InitCursor")) - return FALSE; + if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && + !ATILoadModule(pScreenInfo, "ramdac", ATIramdacSymbols)) + return NULL; - /* Require more ramdac symbols */ - xf86LoaderReqSymbols( - "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", - NULL); - } - /* Load depth-specific entry points */ switch (pATI->bitsPerPixel) { @@ -120,10 +158,10 @@ #ifndef AVOID_CPIO case 1: - return ATILoadModule(pScreenInfo, "xf1bpp", "xf1bppScreenInit"); + return ATILoadModule(pScreenInfo, "xf1bpp", ATIxf1bppSymbols); case 4: - return ATILoadModule(pScreenInfo, "xf4bpp", "xf4bppScreenInit"); + return ATILoadModule(pScreenInfo, "xf4bpp", ATIxf4bppSymbols); #endif /* AVOID_CPIO */ @@ -131,15 +169,10 @@ case 16: case 24: case 32: - if (!ATILoadModule(pScreenInfo, "fb", "fbScreenInit")) - return FALSE; - - /* Require more fb symbols */ - xf86LoaderReqSymbols("fbPictureInit", NULL); - return TRUE; + return ATILoadModule(pScreenInfo, "fb", ATIfbSymbols); default: - return FALSE; + return NULL; } } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.3 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h,v 1.3 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h,v 1.5 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,14 +21,36 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#if defined(XFree86LOADER) && !defined(___ATILOAD_H___) +#ifndef ___ATILOAD_H___ #define ___ATILOAD_H___ 1 +#ifdef XFree86LOADER + #include "atipriv.h" #include "atiproto.h" #include "xf86str.h" + +extern const char *ATIint10Symbols[], *ATIddcSymbols[], *ATIvbeSymbols[], + +#ifndef AVOID_CPIO + + *ATIxf1bppSymbols[], *ATIxf4bppSymbols[], + +#endif /* AVOID_CPIO */ + + *ATIfbSymbols[], *ATIshadowfbSymbols[], *ATIxaaSymbols[], + *ATIramdacSymbols[]; + +extern pointer ATILoadModule FunctionPrototype((ScrnInfoPtr, const char *, + const char **)); +extern pointer ATILoadModules FunctionPrototype((ScrnInfoPtr, ATIPtr)); + +#else /* XFree86LOADER */ + +#define ATILoadModule(pScreenInfo, Module, SymboList) ((pointer)1) +#define ATILoadModules(pScreenInfo, pATI) ((pointer)1) -extern Bool ATILoadModules FunctionPrototype((ScrnInfoPtr, ATIPtr)); +#endif /* XFree86LOADER */ #endif /* ___ATILOAD_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.12 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c Fri Jan 10 15:57:57 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.12 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.18 2003/01/10 20:57:57 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -108,8 +108,11 @@ (pATI->LockData.bus_cntl & ~BUS_FIFO_ERR_INT_EN) | BUS_FIFO_ERR_INT; } - tmp = (pATI->LockData.bus_cntl & ~BUS_ROM_DIS) | - SetBits(15, BUS_FIFO_WS); + tmp = pATI->LockData.bus_cntl & ~BUS_ROM_DIS; + if (pATI->Chip < ATI_CHIP_264VTB) + tmp |= SetBits(15, BUS_FIFO_WS); + else + tmp &= ~BUS_MASTER_DIS; if (pATI->Chip >= ATI_CHIP_264VT) tmp |= BUS_EXT_REG_EN; /* Enable Block 1 */ outr(BUS_CNTL, tmp); @@ -136,6 +139,16 @@ if (pATI->Chip >= ATI_CHIP_264XL) outr(LCD_INDEX, pATI->LockData.lcd_index & ~(LCD_MONDET_INT_EN | LCD_MONDET_INT)); + + /* + * Prevent BIOS initiated display switches on dual-CRT controllers. + */ + if (pATI->Chip != ATI_CHIP_264XL) + { + pATI->LockData.scratch_reg3 = inr(SCRATCH_REG3); + outr(SCRATCH_REG3, + pATI->LockData.scratch_reg3 | DISPLAY_SWITCH_DISABLE); + } } pATI->LockData.mem_cntl = inr(MEM_CNTL); @@ -143,13 +156,55 @@ outr(MEM_CNTL, pATI->LockData.mem_cntl & ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN)); + /* Disable feature connector on integrated controllers */ + tmp = pATI->LockData.dac_cntl = inr(DAC_CNTL); + if (pATI->Chip >= ATI_CHIP_264CT) + tmp &= ~DAC_FEA_CON_EN; + #ifndef AVOID_CPIO /* Ensure VGA aperture is enabled */ pATI->LockData.config_cntl = inr(CONFIG_CNTL); - pATI->LockData.dac_cntl = inr(DAC_CNTL); - outr(DAC_CNTL, pATI->LockData.dac_cntl | DAC_VGA_ADR_EN); + tmp |= DAC_VGA_ADR_EN; outr(CONFIG_CNTL, pATI->LockData.config_cntl & ~CFG_VGA_DIS); + +#endif /* AVOID_CPIO */ + + outr(DAC_CNTL, tmp); + + if (pATI->Chip >= ATI_CHIP_264VTB) + { + pATI->LockData.mpp_config = inr(MPP_CONFIG); + pATI->LockData.mpp_strobe_seq = inr(MPP_STROBE_SEQ); + pATI->LockData.tvo_cntl = inr(TVO_CNTL); + + if (pATI->Chip >= ATI_CHIP_264GT2C) + { + pATI->LockData.hw_debug = inr(HW_DEBUG); + + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + if (!(pATI->LockData.hw_debug & CMDFIFO_SIZE_EN)) + outr(HW_DEBUG, + pATI->LockData.hw_debug | CMDFIFO_SIZE_EN); + + pATI->LockData.i2c_cntl_0 = + inr(I2C_CNTL_0) | (I2C_CNTL_STAT | I2C_CNTL_HPTR_RST); + outr(I2C_CNTL_0, + pATI->LockData.i2c_cntl_0 & ~I2C_CNTL_INT_EN); + pATI->LockData.i2c_cntl_1 = inr(I2C_CNTL_1); + } + else + { + if (pATI->LockData.hw_debug & CMDFIFO_SIZE_DIS) + outr(HW_DEBUG, + pATI->LockData.hw_debug & ~CMDFIFO_SIZE_DIS); + } + } + } + +#ifndef AVOID_CPIO + } if (pATI->VGAAdapter != ATI_ADAPTER_NONE) @@ -196,7 +251,7 @@ /* Setup to unlock non-shadow registers */ lcd_gen_ctrl = saved_lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN); + ~(SHADOW_EN | SHADOW_RW_EN); outr(LCD_GEN_CTRL, lcd_gen_ctrl); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || @@ -382,7 +437,7 @@ /* Setup to lock non-shadow registers */ lcd_gen_ctrl = saved_lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN); + ~(SHADOW_EN | SHADOW_RW_EN); outr(LCD_GEN_CTRL, lcd_gen_ctrl); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || @@ -500,13 +555,32 @@ #ifndef AVOID_CPIO outr(CONFIG_CNTL, pATI->LockData.config_cntl); - outr(DAC_CNTL, pATI->LockData.dac_cntl); #endif /* AVOID_CPIO */ + outr(DAC_CNTL, pATI->LockData.dac_cntl); if (pATI->Chip < ATI_CHIP_264CT) outr(MEM_CNTL, pATI->LockData.mem_cntl); if ((pATI->LCDPanelID >= 0) && (pATI->Chip != ATI_CHIP_264LT)) + { outr(LCD_INDEX, pATI->LockData.lcd_index); + if (pATI->Chip != ATI_CHIP_264XL) + outr(SCRATCH_REG3, pATI->LockData.scratch_reg3); + } + if (pATI->Chip >= ATI_CHIP_264VTB) + { + outr(MPP_CONFIG, pATI->LockData.mpp_config); + outr(MPP_STROBE_SEQ, pATI->LockData.mpp_strobe_seq); + outr(TVO_CNTL, pATI->LockData.tvo_cntl); + if (pATI->Chip >= ATI_CHIP_264GT2C) + { + outr(HW_DEBUG, pATI->LockData.hw_debug); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + outr(I2C_CNTL_0, pATI->LockData.i2c_cntl_0); + outr(I2C_CNTL_1, pATI->LockData.i2c_cntl_1); + } + } + } } } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.4 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h,v 1.4 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h,v 1.5 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.45 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.51 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.45 Wed Jan 16 11:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c Mon Feb 24 15:46:54 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.45 2002/01/16 16:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.51 2003/02/24 20:46:54 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -111,6 +111,13 @@ pATIHW->crtc_off_pitch = SetBits(pATI->displayWidth >> 3, CRTC_PITCH); } + if ((pATI->LockData.crtc_gen_cntl & CRTC_CSYNC_EN) && !pATI->OptionCSync) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "Using composite sync to match input timing.\n"); + pATI->OptionCSync = TRUE; + } + pATIHW->bus_cntl = bus_cntl = inr(BUS_CNTL); if (pATI->Chip < ATI_CHIP_264VT4) pATIHW->bus_cntl = (pATIHW->bus_cntl & ~BUS_HOST_ERR_INT_EN) | @@ -149,6 +156,8 @@ pATIHW->dac_cntl = inr(DAC_CNTL) & ~(DAC1_CLK_SEL | DAC_PALETTE_ACCESS_CNTL | DAC_8BIT_EN); + if (pATI->Chip >= ATI_CHIP_264CT) + pATIHW->dac_cntl &= ~DAC_FEA_CON_EN; if (pATI->rgbBits == 8) pATIHW->dac_cntl |= DAC_8BIT_EN; @@ -204,6 +213,20 @@ CTL_MEM_UPPER_APER_ENDIAN); break; } + + pATIHW->mpp_config = inr(MPP_CONFIG); + pATIHW->mpp_config &= + ~(MPP_PRESCALE | MPP_NSTATES | MPP_FORMAT | MPP_WAIT_STATE | + MPP_INSERT_WAIT | MPP_TRISTATE_ADDR | MPP_AUTO_INC_EN | + MPP_CHKREQ_EN | MPP_BUFFER_SIZE | MPP_BUFFER_MODE | MPP_BUSY); + pATIHW->mpp_config |= + (MPP_NSTATES_8 | MPP_FORMAT_DA8 | SetBits(4, MPP_WAIT_STATE) | + MPP_CHKRDY_EN | MPP_READ_EARLY | MPP_RW_MODE | MPP_EN); + pATIHW->mpp_strobe_seq = inr(MPP_STROBE_SEQ); + pATIHW->mpp_strobe_seq &= ~(MPP_STB0_SEQ | MPP_STB1_SEQ); + pATIHW->mpp_strobe_seq |= + SetBits(0x0087U, MPP_STB0_SEQ) | SetBits(0x0083U, MPP_STB1_SEQ); + pATIHW->tvo_cntl = 0; } /* Draw engine setup */ @@ -358,10 +381,15 @@ pATIHW->config_cntl = inr(CONFIG_CNTL); - pATIHW->gen_test_cntl = inr(GEN_TEST_CNTL); + pATIHW->gen_test_cntl = inr(GEN_TEST_CNTL) & ~GEN_CUR_EN; if (pATI->Chip >= ATI_CHIP_264VTB) + { pATIHW->mem_cntl = inr(MEM_CNTL); + pATIHW->mpp_config = inr(MPP_CONFIG); + pATIHW->mpp_strobe_seq = inr(MPP_STROBE_SEQ); + pATIHW->tvo_cntl = inr(TVO_CNTL); + } /* Save draw engine state */ if (pATI->OptionAccel && (pATIHW == &pATI->OldHW)) @@ -500,7 +528,7 @@ { pMode->Flags &= ~(V_PHSYNC | V_NHSYNC | V_PVSYNC | V_NVSYNC); - if (!pATI->OptionCRT && (pATI->LCDPanelID >= 0)) + if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) VDisplay = pATI->LCDVertical; else VDisplay = pMode->CrtcVDisplay; @@ -553,7 +581,7 @@ ~(CRTC_DBL_SCAN_EN | CRTC_INTERLACE_EN | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS | CRTC_CSYNC_EN | CRTC_PIX_BY_2_EN | CRTC_DISPLAY_DIS | CRTC_VGA_XOVERSCAN | - CRTC_PIX_WIDTH | CRTC_BYTE_PIX_ORDER | CRTC_FIFO_LWM | + CRTC_PIX_WIDTH | CRTC_BYTE_PIX_ORDER | CRTC_VGA_128KAP_PAGING | CRTC_VFC_SYNC_TRISTATE | CRTC_LOCK_REGS | /* Already off, but ... */ CRTC_SYNC_TRISTATE | CRTC_DISP_REQ_EN | @@ -805,7 +833,12 @@ outr(BUS_CNTL, pATIHW->bus_cntl); if (pATI->Chip >= ATI_CHIP_264VTB) + { outr(MEM_CNTL, pATIHW->mem_cntl); + outr(MPP_CONFIG, pATIHW->mpp_config); + outr(MPP_STROBE_SEQ, pATIHW->mpp_strobe_seq); + outr(TVO_CNTL, pATIHW->tvo_cntl); + } } /* @@ -881,7 +914,7 @@ outr(CRTC_GEN_CNTL, crtc_gen_cntl); - if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT) + if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) { CARD32 lcd_index = 0; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.15 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.15 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.15 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.16 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.4 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.5 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.13 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.13 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.14 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.4 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.6 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,6 +24,7 @@ #ifdef XFree86LOADER #include "ati.h" +#include "atiload.h" #include "ativersion.h" /* Module loader interface for subsidiary driver module */ @@ -63,6 +64,28 @@ /* Ensure main driver module is loaded, but not as a submodule */ if (!xf86ServerIsOnlyDetecting() && !LoaderSymbol(ATI_NAME)) xf86LoadOneModule(ATI_DRIVER_NAME, Options); + + /* + * Tell loader about symbols from other modules that this module might + * refer to. + */ + xf86LoaderRefSymLists( + ATIint10Symbols, + ATIddcSymbols, + ATIvbeSymbols, + +#ifndef AVOID_CPIO + + ATIxf1bppSymbols, + ATIxf4bppSymbols, + +#endif /* AVOID_CPIO */ + + ATIfbSymbols, + ATIshadowfbSymbols, + ATIxaaSymbols, + ATIramdacSymbols, + NULL); Inited = TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.9 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.9 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.16 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -306,18 +306,18 @@ pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND; - pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + pATIHW->lcd_gen_ctrl = + ATIGetMach64LCDReg(LCD_GEN_CNTL) & ~CRTC_RW_SELECT; outr(LCD_INDEX, lcd_index); } pATIHW->lcd_gen_ctrl &= - ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET | - DIS_HOR_CRT_DIVBY2 | VCLK_DAC_PM_EN | XTALIN_PM_EN | - CRTC_RW_SELECT | USE_SHADOWED_VEND | + ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | MCLK_PM_EN | + VCLK_DAC_PM_EN | USE_SHADOWED_VEND | USE_SHADOWED_ROWCUR | SHADOW_EN | SHADOW_RW_EN); pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT; - if (pATI->OptionCRT) + if (!pATI->OptionPanelDisplay) { /* * Use primary CRTC to drive the CRT. Turn off panel @@ -330,6 +330,10 @@ { /* Use primary CRTC to drive the panel */ pATIHW->lcd_gen_ctrl |= LCD_ON; + + /* If requested, also force CRT on */ + if (pATI->OptionCRTDisplay) + pATIHW->lcd_gen_ctrl |= CRT_ON; } } } @@ -390,8 +394,8 @@ pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); /* Set up to save non-shadow registers */ - outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, + pATIHW->lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || @@ -444,8 +448,7 @@ /* Switch to shadow registers */ if (pATI->Chip == ATI_CHIP_264LT) outr(LCD_GEN_CTRL, - (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | - (SHADOW_EN | SHADOW_RW_EN)); + pATIHW->lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ @@ -553,7 +556,7 @@ int Index, ECPClock, MaxScalerClock; /* Clobber mode timings */ - if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT && + if ((pATI->LCDPanelID >= 0) && pATI->OptionPanelDisplay && !pMode->CrtcHAdjusted && !pMode->CrtcVAdjusted && (!pATI->OptionSync || (pMode->type & M_T_BUILTIN))) { @@ -696,6 +699,9 @@ if (pMode->Flags & V_INTERLACE) VDisplay >>= 1; + /* Ensure secondary CRTC is completely disabled */ + pATIHW->crtc_gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); + if (pATI->Chip == ATI_CHIP_264LT) pATIHW->horz_stretching = inr(HORZ_STRETCHING); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || @@ -706,13 +712,13 @@ pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); pATIHW->ext_vert_stretch = ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH) & - ~(AUTO_VERT_RATIO | VERT_STRETCH_MODE); + ~(AUTO_VERT_RATIO | VERT_STRETCH_MODE | VERT_STRETCH_RATIO3); /* * Don't use vertical blending if the mode is too wide or not * vertically stretched. */ - if (!pATI->OptionCRT && + if (pATI->OptionPanelDisplay && (pMode->HDisplay <= pATI->LCDVBlendFIFOSize) && (VDisplay < pATI->LCDVertical)) pATIHW->ext_vert_stretch |= VERT_STRETCH_MODE; @@ -723,7 +729,8 @@ pATIHW->horz_stretching &= ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | AUTO_HORZ_RATIO | HORZ_STRETCH_MODE | HORZ_STRETCH_EN); - if (!pATI->OptionCRT && (pMode->HDisplay < pATI->LCDHorizontal)) + if (pATI->OptionPanelDisplay && + (pMode->HDisplay < pATI->LCDHorizontal)) do { /* @@ -804,9 +811,9 @@ pATIHW->horz_stretching |= (HORZ_STRETCH_MODE | HORZ_STRETCH_EN) | SetBits((HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) / pATI->LCDHorizontal, HORZ_STRETCH_BLEND); - } while(0); + } while (0); - if (pATI->OptionCRT || (VDisplay >= pATI->LCDVertical)) + if (!pATI->OptionPanelDisplay || (VDisplay >= pATI->LCDVertical)) pATIHW->vert_stretching = 0; else { @@ -907,9 +914,8 @@ if (pATI->Chip == ATI_CHIP_264LT) { /* Update non-shadow registers first */ - outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | - SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, + pATIHW->lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); /* Temporarily disable stretching */ outr(HORZ_STRETCHING, pATIHW->horz_stretching & @@ -925,8 +931,7 @@ /* Update non-shadow registers first */ ATIPutMach64LCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel); ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | - SHADOW_EN | SHADOW_RW_EN)); + ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); /* Temporarily disable stretching */ ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, @@ -994,7 +999,12 @@ outr(BUS_CNTL, pATIHW->bus_cntl); outr(DAC_CNTL, pATIHW->dac_cntl); if (pATI->Chip >= ATI_CHIP_264VTB) + { outr(MEM_CNTL, pATIHW->mem_cntl); + outr(MPP_CONFIG, pATIHW->mpp_config); + outr(MPP_STROBE_SEQ, pATIHW->mpp_strobe_seq); + outr(TVO_CNTL, pATIHW->tvo_cntl); + } } } @@ -1030,15 +1040,13 @@ { /* Switch to shadow registers */ if (pATI->Chip == ATI_CHIP_264LT) - outr(LCD_GEN_CTRL, (pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | - (SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, + pATIHW->lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ ATIPutMach64LCDReg(LCD_GEN_CNTL, - (pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | + (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | (SHADOW_EN | SHADOW_RW_EN)); /* Restore shadow registers */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.4 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.5 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.13 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.13 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.15 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -105,7 +105,7 @@ Inited = TRUE; xf86AddDriver(&ATI, Module, 0); - LoaderRefSymLists( + xf86LoaderRefSymLists( ATISymbols, R128Symbols, RADEONSymbols, Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.8 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h Wed Jan 1 14:16:32 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.8 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.9 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.6 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.6 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.7 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.19 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.19 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.21 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -40,8 +40,8 @@ FALSE }, { - ATI_OPTION_CRT, - "crt_screen", + ATI_OPTION_CRT_DISPLAY, + "crt_display", OPTV_BOOLEAN, {0, }, FALSE @@ -76,6 +76,13 @@ { ATI_OPTION_MMIO_CACHE, "mmio_cache", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_PANEL_DISPLAY, + "panel_display", OPTV_BOOLEAN, {0, }, FALSE Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.9 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.9 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.11 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -34,7 +34,7 @@ typedef enum { ATI_OPTION_ACCEL, - ATI_OPTION_CRT, + ATI_OPTION_CRT_DISPLAY, ATI_OPTION_CSYNC, ATI_OPTION_HWCURSOR, @@ -45,6 +45,7 @@ #endif /* AVOID_CPIO */ ATI_OPTION_MMIO_CACHE, + ATI_OPTION_PANEL_DISPLAY, ATI_OPTION_PROBE_CLOCKS, ATI_OPTION_REFERENCE_CLOCK, ATI_OPTION_SHADOW_FB, Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.57 xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.65 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.57 Fri Jan 18 11:56:16 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.57 2002/01/18 16:56:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.65 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -385,13 +385,13 @@ { # define BIOS_SIZE 0x00010000U /* 64kB */ CARD8 BIOS[BIOS_SIZE]; -# define BIOSByte(_n) (BIOS[_n]) -# define BIOSWord(_n) (BIOS[_n] | \ - (BIOS[(_n) + 1] << 8)) -# define BIOSLong(_n) (BIOS[_n] | \ - (BIOS[(_n) + 1] << 8) | \ - (BIOS[(_n) + 2] << 16) | \ - (BIOS[(_n) + 3] << 24)) +# define BIOSByte(_n) ((CARD8)(BIOS[_n])) +# define BIOSWord(_n) ((CARD16)(BIOS[_n] | \ + (BIOS[(_n) + 1] << 8))) +# define BIOSLong(_n) ((CARD32)(BIOS[_n] | \ + (BIOS[(_n) + 1] << 8) | \ + (BIOS[(_n) + 2] << 16) | \ + (BIOS[(_n) + 3] << 24))) unsigned int BIOSSize = 0; unsigned int ROMTable = 0, ClockTable = 0, FrequencyTable = 0; unsigned int LCDTable = 0, LCDPanelInfo = 0; @@ -581,7 +581,7 @@ * If there is an ix86-style BIOS, ensure its initialisation entry point * has been executed, and retrieve DDC and VBE information from it. */ - if (!(pInt10Module = xf86LoadSubModule(pScreenInfo, "int10"))) + if (!(pInt10Module = ATILoadModule(pScreenInfo, "int10", ATIint10Symbols))) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Unable to load int10 module.\n"); else if (!(pInt10Info = xf86InitInt10(pATI->iEntity))) @@ -589,10 +589,11 @@ "Unable to initialise int10 interface.\n"); else { - if (!(pDDCModule = xf86LoadSubModule(pScreenInfo, "ddc"))) + if (!(pDDCModule = ATILoadModule(pScreenInfo, "ddc", ATIddcSymbols))) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Unable to load ddc module.\n"); - else if (!(pVBEModule = xf86LoadSubModule(pScreenInfo, "vbe"))) + else + if (!(pVBEModule = ATILoadModule(pScreenInfo, "vbe", ATIvbeSymbols))) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Unable to load vbe module.\n"); else @@ -660,9 +661,18 @@ } } +#ifdef AVOID_CPIO + + pScreenInfo->racMemFlags = + RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR; + +#else /* AVOID_CPIO */ + pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR; - pScreenInfo->racMemFlags = RAC_FB; + pScreenInfo->racMemFlags = RAC_FB | RAC_CURSOR; + +#endif /* AVOID_CPIO */ /* Deal with ChipID & ChipRev overrides */ if (pGDev->chipID >= 0) @@ -781,12 +791,13 @@ #endif /* AVOID_CPIO */ case ATI_ADAPTER_MACH64: - /* Find and mmap() MMIO area */ - Block0Base = pATI->Block0Base; do { - /* Only allow auxiliary aperture if it exists */ - if (!pATI->Block0Base) + /* + * Find and mmap() MMIO area. Allow only auxiliary aperture if + * it exists. + */ + if (!(Block0Base = pATI->Block0Base)) { if (pVideo) { @@ -938,7 +949,7 @@ (!pATI->LCDHorizontal || !pATI->LCDVertical)) pATI->LCDPanelID = -1; else - pATI->OptionCRT = TRUE; + pATI->OptionPanelDisplay = FALSE; } } else @@ -1313,15 +1324,15 @@ if (pATI->Adapter >= ATI_ADAPTER_MACH64) -#endif /* AVOID_CPIO */ - { Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, - "; %s I/O base is 0x%04X", + "; %s I/O base is 0x%04lX", (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block", pATI->CPIOBase); } +#endif /* AVOID_CPIO */ + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s.\n", Buffer); } @@ -1353,18 +1364,18 @@ "Internal RAMDAC (subtype %d) detected.\n", pATI->DAC & 0x0FU); else { - const DACRec *DAC; + const SymTabRec *DAC; for (DAC = ATIDACDescriptors; ; DAC++) { - if (pATI->DAC == DAC->DACType) + if (pATI->DAC == DAC->token) { xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "%s RAMDAC detected.\n", DAC->DACName); + "%s RAMDAC detected.\n", DAC->name); break; } - if (pATI->DAC < DAC->DACType) + if (pATI->DAC < DAC->token) { xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_WARNING, 0, "Unknown RAMDAC type 0x%02X detected.\n", pATI->DAC); @@ -1567,7 +1578,7 @@ */ if (pATI->LCDPanelID >= 0) { - if (pATI->OptionCRT) + if (!pATI->OptionPanelDisplay) { xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Using CRT interface and disabling digital flat panel.\n"); @@ -1623,11 +1634,6 @@ pATI->LCDVBlankWidth = ((pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU) + 1; - HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth; - VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) | - ((pATIHW->crt[7] << 8) & 0x0100U) | - pATIHW->crt[6]) + 3 - pATI->LCDVBlankWidth; - pATI->LCDHSyncStart = ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1; pATI->LCDVSyncStart = (((((pATIHW->crt[7] << 2) & 0x0200U) | @@ -1636,6 +1642,20 @@ (((pATIHW->crt[9] << 4) & 0x0200U) | ((pATIHW->crt[7] << 5) & 0x0100U) | pATIHW->crt[21])) & 0xFFU) + 1; + + HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth - + pATI->LCDHBlankWidth; + if (HDisplay > 0) + pATI->LCDHBlankWidth += (HDisplay + 0x3FU) & ~0x3FU; + VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth - + pATI->LCDVBlankWidth; + if (VDisplay > 0) + pATI->LCDVBlankWidth += (VDisplay + 0xFFU) & ~0xFFU; + + HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth; + VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) | + ((pATIHW->crt[7] << 8) & 0x0100U) | + pATIHW->crt[6]) + 3 - pATI->LCDVBlankWidth; } else @@ -1837,7 +1857,8 @@ if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) && ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0)) { - if ((pATI->LCDHSyncStart -= HDisplay) < 0) + pATI->LCDHSyncStart -= HDisplay; + if (pATI->LCDHSyncStart < 0) pATI->LCDHSyncStart = 0; pATI->LCDHBlankWidth -= HDisplay; HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth; @@ -1848,7 +1869,8 @@ if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) && ((VDisplay = pATI->LCDVertical - VDisplay) > 0)) { - if ((pATI->LCDVSyncStart -= VDisplay) < 0) + pATI->LCDVSyncStart -= VDisplay; + if (pATI->LCDVSyncStart < 0) pATI->LCDVSyncStart = 0; pATI->LCDVBlankWidth -= VDisplay; VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth; @@ -1906,7 +1928,9 @@ (double)(pATI->LCDClock) / 1000.0); xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Using digital flat panel interface.\n"); + "Using digital flat panel interface%s.\n", + pATI->OptionCRTDisplay ? + " to display on both CRT and panel" : ""); } } @@ -2432,11 +2456,11 @@ #endif /* AVOID_CPIO */ { - pATI->OldHW.crtc = pATI->NewHW.crtc; + pATIHW->crtc = pATI->NewHW.crtc; #ifndef AVOID_CPIO - pATI->OldHW.SetBank = (ATIBankProcPtr)NoopDDA; + pATIHW->SetBank = (ATIBankProcPtr)NoopDDA; pATI->BankInfo.BankSize = 0; /* No banking */ #endif /* AVOID_CPIO */ @@ -2447,7 +2471,7 @@ else { - pATI->OldHW.crtc = ATI_CRTC_VGA; + pATIHW->crtc = ATI_CRTC_VGA; #if 0 /* ___NOT_YET___ */ if (pATI->ChipHasSUBSYS_CNTL) { @@ -2456,7 +2480,7 @@ #endif if ((pATI->Chip >= ATI_CHIP_88800GXC) && (pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN)) - pATI->OldHW.crtc = ATI_CRTC_MACH64; + pATIHW->crtc = ATI_CRTC_MACH64; if (pATI->depth <= 4) { @@ -2469,35 +2493,34 @@ pATI->NewHW.nPlane = 1; } - if ((pATI->OldHW.crtc != ATI_CRTC_VGA) || - (GetReg(SEQX, 0x04U) & 0x08U)) - pATI->OldHW.nPlane = 1; + if ((pATIHW->crtc != ATI_CRTC_VGA) || (GetReg(SEQX, 0x04U) & 0x08U)) + pATIHW->nPlane = 1; else - pATI->OldHW.nPlane = 4; + pATIHW->nPlane = 4; - pATI->OldHW.nBank = ATIDivide(pATI->VideoRAM, - pATI->OldHW.nPlane * pATI->BankInfo.BankSize, 10, 1); + pATIHW->nBank = ATIDivide(pATI->VideoRAM, + pATIHW->nPlane * pATI->BankInfo.BankSize, 10, 1); pATI->NewHW.nBank = ATIDivide(pATI->VideoRAM, pATI->NewHW.nPlane * pATI->BankInfo.BankSize, 10, 1); if (pATI->VGAAdapter == ATI_ADAPTER_VGA) { - pATI->OldHW.SetBank = pATI->NewHW.SetBank = + pATIHW->SetBank = pATI->NewHW.SetBank = (ATIBankProcPtr)NoopDDA; - pATI->OldHW.nBank = pATI->NewHW.nBank = 1; + pATIHW->nBank = pATI->NewHW.nBank = 1; } else if (!pATI->UseSmallApertures) - pATI->OldHW.SetBank = pATI->NewHW.SetBank; - else if ((pATI->OldHW.crtc == ATI_CRTC_VGA) && + pATIHW->SetBank = pATI->NewHW.SetBank; + else if ((pATIHW->crtc == ATI_CRTC_VGA) && !(pATI->LockData.config_cntl & CFG_MEM_VGA_AP_EN)) { - pATI->OldHW.SetBank = (ATIBankProcPtr)NoopDDA; - pATI->OldHW.nBank = 1; + pATIHW->SetBank = (ATIBankProcPtr)NoopDDA; + pATIHW->nBank = 1; } - else if (pATI->OldHW.nPlane == 1) - pATI->OldHW.SetBank = ATIMach64SetBankPacked; + else if (pATIHW->nPlane == 1) + pATIHW->SetBank = ATIMach64SetBankPacked; else - pATI->OldHW.SetBank = ATIMach64SetBankPlanar; + pATIHW->SetBank = ATIMach64SetBankPlanar; if (((ApertureSize * pATI->depth) / pATI->BankInfo.nBankDepth) >= (unsigned)(pScreenInfo->videoRam * 1024)) @@ -2720,6 +2743,7 @@ if (DefaultmaxClock < ATIClockRange.maxClock) ATIClockRange.maxClock = DefaultmaxClock; } + if (pATI->ClockDescriptor.MaxN <= 0) { ATIClockRange.maxClock = DefaultmaxClock; @@ -2872,7 +2896,7 @@ pATI->pitchInc = pATI->XModifier * (64 * 8); } - if (!pATI->OptionCRT && pATI->LCDPanelID >= 0) + if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) { /* * Given LCD modes are more tightly controlled than CRT modes, allow @@ -2926,6 +2950,68 @@ } pScreenInfo->monitor->Last = pMode; + + /* + * Defeat Xconfigurator brain damage. Ignore all HorizSync and + * VertRefresh specifications. For now, this does not take + * SYNC_TOLERANCE into account. + */ + if (pScreenInfo->monitor->nHsync > 0) + { + double hsync = (double)pMode->Clock / + (pATI->LCDHorizontal + pATI->LCDHBlankWidth); + + for (i = 0; ; i++) + { + if (i >= pScreenInfo->monitor->nHsync) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "Conflicting XF86Config HorizSync specification(s)" + " ignored.\n"); + break; + } + + if ((hsync >= pScreenInfo->monitor->hsync[i].lo) && + (hsync <= pScreenInfo->monitor->hsync[i].hi)) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Extraneous XF86Config HorizSync specification(s)" + " ignored.\n"); + break; + } + } + + pScreenInfo->monitor->nHsync = 0; + } + + if (pScreenInfo->monitor->nVrefresh > 0) + { + double vrefresh = ((double)pMode->Clock * 1000.0) / + ((pATI->LCDHorizontal + pATI->LCDHBlankWidth) * + (pATI->LCDVertical + pATI->LCDVBlankWidth)); + + for (i = 0; ; i++) + { + if (i >= pScreenInfo->monitor->nVrefresh) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "Conflicting XF86Config VertRefresh specification(s)" + " ignored.\n"); + break; + } + + if ((vrefresh >= pScreenInfo->monitor->vrefresh[i].lo) && + (vrefresh <= pScreenInfo->monitor->vrefresh[i].hi)) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Extraneous XF86Config VertRefresh specification(s)" + " ignored.\n"); + break; + } + } + + pScreenInfo->monitor->nVrefresh = 0; + } } i = xf86ValidateModes(pScreenInfo, @@ -2954,7 +3040,6 @@ /* Set display resolution */ xf86SetDpi(pScreenInfo, 0, 0); -#ifdef XFree86LOADER /* Load required modules */ if (!ATILoadModules(pScreenInfo, pATI)) { @@ -2963,7 +3048,6 @@ ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } -#endif pATI->displayWidth = pScreenInfo->displayWidth; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.5 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.5 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.6 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.23 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.23 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.25 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -499,12 +499,10 @@ { lcd_gen_ctrl = inr(LCD_GEN_CTRL); - outr(LCD_GEN_CTRL, lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "non-shadow"); - outr(LCD_GEN_CTRL, (lcd_gen_ctrl & ~CRTC_RW_SELECT) | - (SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "shadow"); outr(LCD_GEN_CTRL, lcd_gen_ctrl); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.9 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.9 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.10 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.4 Wed Jan 16 11:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.5 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.52 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.54 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.52 Fri Jan 18 11:56:16 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.52 2002/01/18 16:56:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.54 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -1734,6 +1734,9 @@ case ATI_CHIP_RADEONMOBILITY7: case ATI_CHIP_R200: case ATI_CHIP_RV200: + case ATI_CHIP_RV250: + case ATI_CHIP_RADEONMOBILITY9: + case ATI_CHIP_R300: DoRadeon = TRUE; continue; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.7 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h Wed Jan 1 14:16:33 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.8 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.6 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h,v 1.6 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h,v 1.7 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.18 xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.18 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h Fri Jan 10 12:43:40 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.18 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.23 2003/01/10 17:43:40 tsi Exp $ */ /* - * Copyright 1994 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1994 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -702,6 +702,24 @@ #define CRT_TRAP BlockIOTag(0x0eu) /* VTB/GTB/LT */ #define DSTN_CONTROL BlockIOTag(0x0fu) /* LT */ #define I2C_CNTL_0 BlockIOTag(0x0fu) /* GTPro */ +#define I2C_CNTL_STAT 0x0000000ful +#define I2C_CNTL_DONE 0x00000001ul +#define I2C_CNTL_NACK 0x00000002ul +#define I2C_CNTL_HALT 0x00000004ul +#define I2C_CNTL_FULL 0x00000008ul +/* ? 0x00000010ul */ +#define I2C_CNTL_HPTR_RST 0x00000020ul +/* ? 0x000000c0ul */ +#define I2C_CNTL_START 0x00000100ul +#define I2C_CNTL_STOP 0x00000200ul +#define I2C_CNTL_GO 0x00000400ul +#define I2C_CNTL_RECEIVE 0x00000800ul +#define I2C_CNTL_ABORT 0x00001000ul +#define I2C_CNTL_INT_EN 0x00002000ul +#define I2C_CNTL_SCL 0x00004000ul +#define I2C_CNTL_SDA 0x00008000ul +#define I2C_CNTL_M_FACTOR 0x00ff0000ul +#define I2C_CNTL_N_FACTOR 0xff000000ul #define OVR_CLR IOPortTag(0x08u, 0x10u) #define OVR_CLR_8 0x000000fful #define OVR_CLR_B 0x0000ff00ul @@ -781,7 +799,42 @@ #define TV_ON 0x00000100ul /* ? 0xfffffe00ul */ #define GP_IO IOPortTag(0x1eu, 0x1eu) /* VT/GT */ +#define GP_IO_0 0x00000001ul +#define GP_IO_1 0x00000002ul +#define GP_IO_2 0x00000004ul +#define GP_IO_3 0x00000008ul +#define GP_IO_4 0x00000010ul +#define GP_IO_5 0x00000020ul +#define GP_IO_6 0x00000040ul +#define GP_IO_7 0x00000080ul +#define GP_IO_8 0x00000100ul +#define GP_IO_9 0x00000200ul +#define GP_IO_A 0x00000400ul +#define GP_IO_B 0x00000800ul +#define GP_IO_C 0x00001000ul +#define GP_IO_D 0x00002000ul +#define GP_IO_E 0x00004000ul +#define GP_IO_F 0x00008000ul +#define GP_IO_DIR_0 0x00010000ul +#define GP_IO_DIR_1 0x00020000ul +#define GP_IO_DIR_2 0x00040000ul +#define GP_IO_DIR_3 0x00080000ul +#define GP_IO_DIR_4 0x00100000ul +#define GP_IO_DIR_5 0x00200000ul +#define GP_IO_DIR_6 0x00400000ul +#define GP_IO_DIR_7 0x00800000ul +#define GP_IO_DIR_8 0x01000000ul +#define GP_IO_DIR_9 0x02000000ul +#define GP_IO_DIR_A 0x04000000ul +#define GP_IO_DIR_B 0x08000000ul +#define GP_IO_DIR_C 0x10000000ul +#define GP_IO_DIR_D 0x20000000ul +#define GP_IO_DIR_E 0x40000000ul +#define GP_IO_DIR_F 0x80000000ul #define GP_IO_CNTL BlockIOTag(0x1fu) /* VT/GT */ +#define GP_IO_MODE 0x0000000ful +/* ? 0x7ffffff0ul */ +#define GP_IO_EN 0x80000000ul #define HW_DEBUG BlockIOTag(0x1fu) /* VTB/GTB/LT */ #define FAST_SRCCOPY_DIS 0x00000001ul #define BYPASS_SUBPIC_DBF 0x00000001ul /* XL/XC */ @@ -810,7 +863,7 @@ #define DBL_BUFFER_EN 0x00000400ul /* GTPro */ #define MEM_WE_FIX_DIS 0x00000800ul #define MEM_OE_PULLBACK_B 0x00000800ul /* GT2c/VT4 */ -#define CMDFIFO_SIZE_DIS_P 0x00000800ul /* GTPro */ +#define CMDFIFO_SIZE_EN 0x00000800ul /* GTPro */ #define RD_EN_FIX_DIS 0x00001000ul #define MEM_WE_FIX_DIS_B 0x00001000ul #define AUTO_FF_DIS 0x00001000ul /* GTPro */ @@ -848,6 +901,9 @@ /* ? 0xffff0000ul */ #define SCRATCH_REG2 BlockIOTag(0x22u) /* LT */ #define SCRATCH_REG3 BlockIOTag(0x23u) /* GTPro */ +/* Not described here 0x07fffffful */ +#define DISPLAY_SWITCH_DISABLE 0x08000000ul +/* Not described here 0xf0000000ul */ #define CLOCK_CNTL IOPortTag(0x12u, 0x24u) #define CLOCK_BIT 0x00000004ul /* For ICS2595 */ #define CLOCK_PULSE 0x00000008ul /* For ICS2595 */ @@ -1015,6 +1071,13 @@ #define MEM_VGA_RPS1 0xffff0000ul #define LT_GIO BlockIOTag(0x2fu) /* LT */ #define I2C_CNTL_1 BlockIOTag(0x2fu) /* GTPro */ +#define I2C_DATA_PORT 0x000000fful +#define I2C_DATA_COUNT 0x0000ff00ul +#define I2C_ADDR_COUNT 0x00070000ul +/* ? 0x00380000ul */ +#define I2C_SEL 0x00400000ul +/* ? 0x00800000ul */ +#define I2C_TIME_LIMIT 0xff000000ul #define DAC_REGS IOPortTag(0x17u, 0x30u) /* 4 separate bytes */ #define M64_DAC_WRITE (DAC_REGS + 0) #define M64_DAC_DATA (DAC_REGS + 1) @@ -1076,6 +1139,12 @@ #define HORZ_STRETCH_MODE 0x40000000ul #define HORZ_STRETCH_EN 0x80000000ul #define EXT_DAC_REGS BlockIOTag(0x32u) /* GTPro */ +#define EXT_DAC_REG_SEL 0x0000000ful +/* ? 0x000000f0ul */ +#define EXT_DAC_DATA 0x0000ff00ul +#define EXT_DAC_EN 0x00010000ul +#define EXT_DAC_WID 0x00020000ul +/* ? 0xfffc0000ul */ #define VERT_STRETCHING BlockIOTag(0x33u) /* LT */ #define VERT_STRETCH_RATIO0 0x000003fful #define VERT_STRETCH_RATIO1 0x000ffc00ul @@ -1135,22 +1204,27 @@ #define CRT_ON 0x00000001ul #define LCD_ON 0x00000002ul #define HORZ_DIVBY2_EN 0x00000004ul -#define DONT_DS_ICON 0x00000008ul +#define TRISTATE_MEM_EN 0x00000008ul +#define DONT_DS_ICON 0x00000008ul /* LTPro */ #define LOCK_8DOT 0x00000010ul #define ICON_ENABLE 0x00000020ul #define DONT_SHADOW_VPAR 0x00000040ul -#define V2CLK_PM_EN 0x00000080ul +#define TOGGLE_EN 0x00000080ul +#define V2CLK_PM_EN 0x00000080ul /* LTPro */ #define RST_FM 0x00000100ul #define DISABLE_PCLK_RESET 0x00000200ul /* XC/XL */ #define DIS_HOR_CRT_DIVBY2 0x00000400ul #define SCLK_SEL 0x00000800ul #define SCLK_DELAY 0x0000f000ul -#define TVCLK_PM_EN 0x00010000ul +#define MCLK_PM_EN 0x00010000ul +#define TVCLK_PM_EN 0x00010000ul /* LTPro */ #define VCLK_DAC_PM_EN 0x00020000ul #define VCLK_LCD_OFF 0x00040000ul -#define SELECT_WAIT_4MS 0x00080000ul +#define SLOWDOWN_XMCLK 0x00080000ul +#define SELECT_WAIT_4MS 0x00080000ul /* LTPro */ #define XTALIN_PM_EN 0x00080000ul /* XC/XL */ -#define V2CLK_DAC_PM_EN 0x00100000ul +#define LCD_CLK_RATIO 0x00100000ul +#define V2CLK_DAC_PM_EN 0x00100000ul /* LTPro */ #define LVDS_EN 0x00200000ul #define LVDS_PLL_EN 0x00400000ul #define LVDS_PLL_RESET 0x00800000ul @@ -1173,7 +1247,7 @@ #define KEYBD_SNOOP 0x00000200ul #define USE_F32KHZ 0x00000400ul /* LTPro */ #define DONT_USE_XTALIN 0x00000400ul /* XC/XL */ -#define TRISTATE_MEM_EN 0x00000800ul /* LTPro */ +#define TRISTATE_MEM_EN_P 0x00000800ul /* LTPro */ #define LCDENG_TEST_MODE 0x0000f000ul #define STANDBY_COUNT 0x000f0000ul #define SUSPEND_COUNT 0x00f00000ul @@ -1249,10 +1323,56 @@ /* ? 0xffffffc0ul */ /* GX/CX */ #define CRC_SIG 0xfffffffful /* 264xT */ #define MPP_CONFIG BlockIOTag(0x3bu) /* VTB/GTB/LT */ -#define MPP_STROBE_CONFIG BlockIOTag(0x3cu) /* VTB/GTB/LT */ +#define MPP_PRESCALE 0x00000007ul +/* ? 0x00000008ul */ +#define MPP_NSTATES 0x00000030ul +/* ? 0x00000000ul */ +#define MPP_NSTATES_2 0x00000010ul +#define MPP_NSTATES_4 0x00000020ul +#define MPP_NSTATES_8 0x00000030ul +#define MPP_FORMAT 0x000000c0ul +#define MPP_FORMAT_DO8 0x00000000ul +#define MPP_FORMAT_DO16 0x00000040ul +#define MPP_FORMAT_DA8 0x00000080ul +#define MPP_FORMAT_DA16 0x000000c0ul +#define MPP_WAIT_STATE 0x00000700ul +#define MPP_CHKRDY_EN 0x00000800ul +#define MPP_INSERT_WAIT 0x00001000ul +#define MPP_TRISTATE_ADDR 0x00002000ul +/* ? 0x00004000ul */ +#define MPP_READ_EARLY 0x00008000ul +#define MPP_RW_MODE 0x00030000ul +#define MPP_INT_MASK 0x000c0000ul +#define MPP_AUTO_INC_EN 0x00300000ul +#define MPP_CHKREQ_EN 0x00400000ul +#define MPP_CHKREQ_MODE 0x00800000ul +#define MPP_BUFFER_SIZE 0x03000000ul +#define MPP_BUFFER_MODE 0x0c000000ul +#define MPP_BUFFER_MODE_NORMAL 0x00000000ul +#define MPP_BUFFER_MODE_PREFETCH 0x04000000ul +#define MPP_BUFFER_MODE_BUS_MASTER 0x08000000ul +/* ? 0x0c000000ul */ +/* ? 0x30000000ul */ +#define MPP_BUSY 0x40000000ul +#define MPP_EN 0x80000000ul +#define MPP_STROBE_SEQ BlockIOTag(0x3cu) /* VTB/GTB/LT */ +#define MPP_STB0_SEQ 0x000000fful +#define MPP_STB1_SEQ 0x0000ff00ul +/* ? 0xffff0000ul */ #define MPP_ADDR BlockIOTag(0x3du) /* VTB/GTB/LT */ #define MPP_DATA BlockIOTag(0x3eu) /* VTB/GTB/LT */ #define TVO_CNTL BlockIOTag(0x3fu) /* VTB/GTB/LT */ +#define TVO_H_TOT_PIX 0x00000007ul +#define TVO_PC_OVR_DIS 0x00000008ul +#define TVO_H_TOT_EDGE 0x00000010ul +/* ? 0x00000060ul */ +#define TVO_VBLANK_ONLY 0x00000080ul +/* ? 0x0000ff00ul */ +#define TVO_MPEG_CLR_SRC 0x00030000ul +/* ? 0x1ffc0000ul */ +#define TVO_MPEG_CLK_EN 0x20000000ul +#define TVO_OVERRIDE_EN 0x40000000ul +#define TVO_EN 0x80000000ul /* GP_IO IOPortTag(0x1eu, 0x1eu) */ /* See above */ /* CRTC_H_TOTAL_DISP IOPortTag(0x1fu, 0x00u) */ /* Duplicate */ #define DST_OFF_PITCH BlockIOTag(0x40u) @@ -1598,17 +1718,49 @@ #define ALPHA_FOG_START BlockIOTag(0xfeu) /* GTB */ /* ? BlockIOTag(0xffu) */ #define OVERLAY_Y_X_START BlockIOTag(0x100u) +#define OVERLAY_Y_START 0x000003fful +/* ? 0x0000fc00ul */ +#define OVERLAY_X_START 0x03ff0000ul +/* ? 0x7c000000ul */ +#define OVERLAY_LOCK_START 0x80000000ul #define OVERLAY_Y_X_END BlockIOTag(0x101u) +#define OVERLAY_Y_END 0x000003fful +/* ? 0x0000fc00ul */ +#define OVERLAY_X_END 0x03ff0000ul +/* ? 0x7c000000ul */ +#define OVERLAY_LOCK_END 0x80000000ul #define OVERLAY_VIDEO_KEY_CLR BlockIOTag(0x102u) #define OVERLAY_VIDEO_KEY_MSK BlockIOTag(0x103u) #define OVERLAY_GRAPHICS_KEY_CLR BlockIOTag(0x104u) #define OVERLAY_GRAPHICS_KEY_MSK BlockIOTag(0x105u) #define OVERLAY_KEY_CNTL BlockIOTag(0x106u) +#define OVERLAY_VIDEO_FN 0x00000007ul +/* ? 0x00000008ul */ +#define OVERLAY_GRAPHICS_FN 0x00000070ul +/* ? 0x00000080ul */ +#define OVERLAY_CMP_MIX 0x00000100ul +/* ? 0xfffffe00ul */ /* ? BlockIOTag(0x107u) */ #define OVERLAY_SCALE_INC BlockIOTag(0x108u) #define OVERLAY_SCALE_CNTL BlockIOTag(0x109u) +#define SCALE_PIX_EXPAND 0x00000001ul +#define SCALE_Y2R_TEMP 0x00000002ul +#define SCALE_HORZ_MODE 0x00000004ul +#define SCALE_VERT_MODE 0x00000008ul +#define SCALE_SIGNED_UV 0x00000010ul +#define SCALE_GAMMA_SEL 0x00000060ul +/* ? 0x03ffff80ul */ +#define SCALE_BANDWIDTH 0x04000000ul +#define SCALE_DIS_LIMIT 0x08000000ul +/* ? 0x10000000ul */ +#define SCALE_CLK_FORCE_ON 0x20000000ul +#define OVERLAY_EN 0x40000000ul +#define SCALE_EN 0x80000000ul #define SCALER_HEIGHT_WIDTH BlockIOTag(0x10au) -#define OVERLAY_TEST BlockIOTag(0x10bu) +#define SCALER_TEST BlockIOTag(0x10bu) +/* ? 0x00000001ul */ +#define SCALE_Y2R_DIS 0x00000002ul +/* ? 0xfffffffcul */ #define SCALER_THRESHOLD BlockIOTag(0x10cu) #define SCALER_BUF0_OFFSET BlockIOTag(0x10du) /* VTB/GTB */ #define SCALER_BUF1_OFFSET BlockIOTag(0x10eu) /* VTB/GTB */ @@ -1618,14 +1770,99 @@ #define CAPTURE_HEIGHT_WIDTH BlockIOTag(0x111u) #define CAPTURE_X_WIDTH BlockIOTag(0x111u) /* VTB/GTB */ #define VIDEO_FORMAT BlockIOTag(0x112u) +#define VIDEO_IN 0x0000000ful +/* ? 0x00000000ul */ +/* ? 0x00000001ul */ +/* ? 0x00000002ul */ +/* ? 0x00000003ul */ +/* ? 0x00000004ul */ +/* ? 0x00000005ul */ +/* ? 0x00000006ul */ +/* ? 0x00000007ul */ +/* ? 0x00000008ul */ +/* ? 0x00000009ul */ +/* ? 0x0000000aul */ +#define VIDEO_IN_VYUY422 0x0000000bul +#define VIDEO_IN_YVYU422 0x0000000cul +/* ? 0x0000000dul */ +/* ? 0x0000000eul */ +/* ? 0x0000000ful */ +#define VIDEO_SIGNED_UV 0x00000010ul +/* ? 0x0000ffe0ul */ +#define SCALER_IN 0x000f0000ul +/* ? 0x00000000ul */ +/* ? 0x00010000ul */ +/* ? 0x00020000ul */ +#define SCALER_IN_15BPP 0x00030000ul +#define SCALER_IN_16BPP 0x00040000ul +/* ? 0x00050000ul */ +#define SCALER_IN_32BPP 0x00060000ul +/* ? 0x00070000ul */ +/* ? 0x00080000ul */ +#define SCALER_IN_YUV9 0x00090000ul +#define SCALER_IN_YUV12 0x000a0000ul +#define SCALER_IN_VYUY422 0x000b0000ul +#define SCALER_IN_YVYU422 0x000c0000ul +/* ? 0x000d0000ul */ +/* ? 0x000e0000ul */ +/* ? 0x000f0000ul */ +/* ? 0x0ff00000ul */ +#define HOST_BYTE_SHIFT_EN 0x10000000ul +#define HOST_YUV_APER 0x20000000ul +#define HOST_MEM_MODE 0xc0000000ul +#define HOST_MEM_MODE_NORMAL 0x00000000ul +#define HOST_MEM_MODE_Y 0x40000000ul +#define HOST_MEM_MODE_U 0x80000000ul +#define HOST_MEM_MODE_V 0xc0000000ul #define VIDEO_CONFIG BlockIOTag(0x113u) #define VBI_START_END BlockIOTag(0x113u) /* VTB/GTB */ #define CAPTURE_CONFIG BlockIOTag(0x114u) +#define CAP_INPUT_MODE 0x00000001ul +#define CAP_START_FIELD 0x00000002ul +#define CAP_BUF_MODE 0x00000004ul +#define CAP_START_BUF 0x00000008ul +#define CAP_BUF_TYPE 0x00000030ul +#define CAP_BUF_FIELD 0x00000000ul +#define CAP_BUF_ALTERNATING 0x00000010ul +#define CAP_BUF_FRAME 0x00000020ul +/* ? 0x00000030ul */ +#define CAP_FIELD_FLIP 0x00000040ul +#define CAP_CCIR656_EN 0x00000080ul +/* ? 0x00000f00ul */ +#define CAP_MIRROR_EN 0x00001000ul +#define ONESHOT_MIRROR_EN 0x00002000ul +#define ONESHOT_MODE 0x00004000ul +/* ? 0x00008000ul */ +#define CAP_HORZ_DOWN 0x00030000ul +#define CAP_VERT_DOWN 0x000c0000ul +#define ONESHOT_HORZ_DOWN 0x00300000ul +#define ONESHOT_VERT_DOWN 0x00c00000ul +/* ? 0x0f000000ul */ +#define OVL_BUF_MODE 0x10000000ul +#define OVL_BUF_NEXT 0x20000000ul +/* ? 0xc0000000ul */ #define TRIG_CNTL BlockIOTag(0x115u) +#define CAP_TRIGGER 0x00000003ul +#define CAP_TRIGGER_NEXT 0x00000001ul +/* ? 0x0000001cul */ +#define OVL_CUR_BUF 0x00000020ul +#define OVL_BUF_STATUS 0x00000040ul +#define CAP_BUF_STATUS 0x00000080ul +/* ? 0x7fffff00ul */ +#define CAPTURE_EN 0x80000000ul #define VIDEO_SYNC_TEST BlockIOTag(0x116u) #define OVERLAY_EXCLUSIVE_HORZ BlockIOTag(0x116u) /* VTB/GTB */ +#define EXCLUSIVE_HORZ_START 0x000000fful +#define EXCLUSIVE_HORZ_END 0x0000ff00ul +#define EXCLUSIVE_HORZ_PORCH 0x00ff0000ul +/* ? 0x7f000000ul */ +#define EXCLUSIVE_EN 0x80000000ul #define EXT_CRTC_GEN_CNTL_R BlockIOTag(0x117u) /* VT-A4 (R) */ #define OVERLAY_EXCLUSIVE_VERT BlockIOTag(0x117u) /* VTB/GTB */ +#define EXCLUSIVE_VERT_START 0x000003fful +/* ? 0x0000fc00ul */ +#define EXCLUSIVE_VERT_END 0x03ff0000ul +/* ? 0xfc000000ul */ #define VMC_CONFIG BlockIOTag(0x118u) #define VBI_WIDTH BlockIOTag(0x118u) /* VTB/GTB */ #define VMC_STATUS BlockIOTag(0x119u) @@ -1699,6 +1936,13 @@ #define AGP_BASE BlockIOTag(0x152u) /* GTPro */ #define AGP_CNTL BlockIOTag(0x153u) /* GTPro */ #define SCALER_COLOUR_CNTL BlockIOTag(0x154u) /* GTPro */ +#define SCALE_BRIGHTNESS 0x0000007ful +/* ? 0x00000080ul */ +#define SCALE_SATURATION_U 0x00001f00ul +/* ? 0x0000e000ul */ +#define SCALE_SATURATION_V 0x001f0000ul +#define SCALE_VERT_ADJ_UV 0x0fe00000ul +#define SCALE_HORZ_ADJ_UV 0xf0000000ul #define SCALER_H_COEFF0 BlockIOTag(0x155u) /* GTPro */ #define SCALER_H_COEFF1 BlockIOTag(0x156u) /* GTPro */ #define SCALER_H_COEFF2 BlockIOTag(0x157u) /* GTPro */ @@ -2400,6 +2644,16 @@ /* ? 0xfdu */ /* ? 0xfeu */ /* ? 0xffu */ + +/* Some ImpacTV definitions */ +#define IT_SDA_GET 0x40u +#define IT_SDA_SET 0x20u +#define IT_SDA_DIR 0x10u +#define IT_SCL_GET 0x04u +#define IT_SCL_SET 0x02u +#define IT_SCL_DIR 0x01u + +#define IT_I2C_CNTL 0x0015u /* Miscellaneous */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c,v 1.4 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h:1.2 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h,v 1.2 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h,v 1.3 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.28 xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.28 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.28 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.29 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.5 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.5 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.6 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.30 xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.37 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.30 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h Fri Jan 10 15:57:58 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.30 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.37 2003/01/10 20:57:58 tsi Exp $ */ /* - * Copyright 1999 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,10 +28,10 @@ #include "aticlock.h" #include "atiregs.h" +#include "xaa.h" #include "xf86Cursor.h" #include "xf86Pci.h" #include "xf86Resources.h" -#include "xaa.h" #define CacheSlotOf(____Register) ((____Register) / UnitOf(DWORD_SELECT)) @@ -91,7 +91,8 @@ cur_clr0, cur_clr1, cur_offset, cur_horz_vert_posn, cur_horz_vert_off, clock_cntl, bus_cntl, mem_cntl, mem_vga_wp_sel, mem_vga_rp_sel, - dac_cntl, gen_test_cntl, config_cntl; + dac_cntl, gen_test_cntl, config_cntl, mpp_config, mpp_strobe_seq, + tvo_cntl; /* LCD registers */ CARD32 lcd_index, config_panel, lcd_gen_ctrl, @@ -101,7 +102,7 @@ CARD32 shadow_h_total_disp, shadow_h_sync_strt_wid, shadow_v_total_disp, shadow_v_sync_strt_wid; - /* Mach64 MMIO Block 0 registers */ + /* Mach64 MMIO Block 0 registers and related subfields */ CARD32 dst_off_pitch; CARD16 dst_x, dst_y, dst_height; CARD32 dst_bres_err, dst_bres_inc, dst_bres_dec, dst_cntl; @@ -200,7 +201,8 @@ #ifndef AVOID_CPIO - IOADDRESS CPIO_DAC_MASK, CPIO_DAC_DATA, CPIO_DAC_READ, CPIO_DAC_WRITE; + IOADDRESS CPIO_DAC_MASK, CPIO_DAC_DATA, CPIO_DAC_READ, CPIO_DAC_WRITE, + CPIO_DAC_WAIT; #endif /* AVOID_CPIO */ @@ -347,12 +349,13 @@ struct { /* Mach64 registers */ - CARD32 bus_cntl, crtc_gen_cntl, mem_cntl, gen_test_cntl, crtc_int_cntl, - lcd_index; + CARD32 crtc_int_cntl, crtc_gen_cntl, i2c_cntl_0, hw_debug, + scratch_reg3, bus_cntl, lcd_index, mem_cntl, i2c_cntl_1, + dac_cntl, gen_test_cntl, mpp_config, mpp_strobe_seq, tvo_cntl; #ifndef AVOID_CPIO - CARD32 config_cntl, dac_cntl; + CARD32 config_cntl; /* Mach8/Mach32 registers */ CARD16 clock_sel, misc_options, mem_bndry, mem_cfg; @@ -385,7 +388,7 @@ */ CARD8 OptionAccel; /* Use hardware draw engine */ CARD8 OptionBlend; /* Force horizontal blending */ - CARD8 OptionCRT; /* Prefer CRT over digital panel */ + CARD8 OptionCRTDisplay; /* Display on both CRT and digital panel */ CARD8 OptionCSync; /* Use composite sync */ CARD8 OptionDevel; /* Intentionally undocumented */ @@ -396,6 +399,7 @@ #endif /* AVOID_CPIO */ CARD8 OptionMMIOCache; /* Cache MMIO writes */ + CARD8 OptionPanelDisplay; /* Prefer CRT over digital panel */ CARD8 OptionProbeClocks; /* Force probe for fixed clocks */ CARD8 OptionShadowFB; /* Use shadow frame buffer */ CARD8 OptionSync; /* Temporary */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.7 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c,v 1.8 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.7 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h,v 1.8 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.13 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.13 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.15 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -96,7 +96,7 @@ if (pMode->Flags & V_DBLSCAN) VScan <<= 1; - if (!pATI->OptionCRT && (pATI->LCDPanelID >= 0)) + if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) { if ((pMode->CrtcHDisplay > pATI->LCDHorizontal) || (pMode->CrtcVDisplay > pATI->LCDVertical)) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.7 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.8 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.47 xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.58 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.47 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h Fri Jan 10 15:57:58 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.47 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.58 2003/01/10 20:57:58 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,16 +24,35 @@ #ifndef ___ATIVERSION_H___ #define ___ATIVERSION_H___ 1 +#undef ATI_NAME +#undef ATI_DRIVER_NAME +#undef ATI_VERSION_MAJOR +#undef ATI_VERSION_MINOR +#undef ATI_VERSION_PATCH +#undef ATI_VERSION_CURRENT +#undef ATI_VERSION_EVALUATE +#undef ATI_VERSION_STRINGIFY +#undef ATI_VERSION_NAME + #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_NAME "6.4.8" - #define ATI_VERSION_MAJOR 6 #define ATI_VERSION_MINOR 4 -#define ATI_VERSION_PATCH 8 +#define ATI_VERSION_PATCH 18 +#ifndef ATI_VERSION_EXTRA +#define ATI_VERSION_EXTRA "" +#endif + #define ATI_VERSION_CURRENT \ ((ATI_VERSION_MAJOR << 20) | (ATI_VERSION_MINOR << 10) | ATI_VERSION_PATCH) + +#define ATI_VERSION_EVALUATE(__x) #__x +#define ATI_VERSION_STRINGIFY(_x) ATI_VERSION_EVALUATE(_x) +#define ATI_VERSION_NAME \ + ATI_VERSION_STRINGIFY(ATI_VERSION_MAJOR) "." \ + ATI_VERSION_STRINGIFY(ATI_VERSION_MINOR) "." \ + ATI_VERSION_STRINGIFY(ATI_VERSION_PATCH) ATI_VERSION_EXTRA #endif /* ___ATIVERSION_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.15 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.15 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.19 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -29,8 +29,6 @@ #include "ativga.h" #include "ativgaio.h" -#include "xf86.h" - #ifndef DPMS_SERVER # define DPMS_SERVER #endif @@ -204,10 +202,24 @@ Index = pMode->CrtcHBlankEnd - pMode->CrtcHBlankStart - 0x3F; if (Index > 0) { - pMode->CrtcHBlankStart += Index / 2; - if (pMode->CrtcHBlankStart >= pMode->CrtcHSyncStart) - pMode->CrtcHBlankStart = pMode->CrtcHSyncStart - 1; - pMode->CrtcHBlankEnd = pMode->CrtcHBlankStart + 0x3F; + if ((pMode->CrtcHBlankEnd - Index) > pMode->CrtcHSyncEnd) + { + pMode->CrtcHBlankStart += Index / 2; + if (pMode->CrtcHBlankStart >= pMode->CrtcHSyncStart) + pMode->CrtcHBlankStart = pMode->CrtcHSyncStart - 1; + pMode->CrtcHBlankEnd = pMode->CrtcHBlankStart + 0x3F; + } + else + { + Index -= 0x40; + if (Index > 0) + { + pMode->CrtcHBlankStart += Index / 2; + if (pMode->CrtcHBlankStart >= pMode->CrtcHSyncStart) + pMode->CrtcHBlankStart = pMode->CrtcHSyncStart - 1; + pMode->CrtcHBlankEnd = pMode->CrtcHBlankStart + 0x7F; + } + } } } @@ -258,7 +270,7 @@ { pMode->Flags &= ~(V_PHSYNC | V_NHSYNC | V_PVSYNC | V_NVSYNC); - if (!pATI->OptionCRT && (pATI->LCDPanelID >= 0)) + if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) VDisplay = pATI->LCDVertical; else VDisplay = pMode->CrtcVDisplay; @@ -328,13 +340,27 @@ } /* Check blank pulse width */ - Index = pMode->CrtcVBlankEnd - pMode->CrtcVBlankStart - 0x0FF; + Index = pMode->CrtcVBlankEnd - pMode->CrtcVBlankStart - 0x00FF; if (Index > 0) { - pMode->CrtcVBlankStart += Index / 2; - if (pMode->CrtcVBlankStart >= pMode->CrtcVSyncStart) - pMode->CrtcVBlankStart = pMode->CrtcVSyncStart - 1; - pMode->CrtcVBlankEnd = pMode->CrtcVBlankStart + 0x0FF; + if ((pMode->CrtcVBlankEnd - Index) > pMode->CrtcVSyncEnd) + { + pMode->CrtcVBlankStart += Index / 2; + if (pMode->CrtcVBlankStart >= pMode->CrtcVSyncStart) + pMode->CrtcVBlankStart = pMode->CrtcVSyncStart - 1; + pMode->CrtcVBlankEnd = pMode->CrtcVBlankStart + 0x00FF; + } + else + { + Index -= 0x0100; + if (Index > 0) + { + pMode->CrtcVBlankStart += Index / 2; + if (pMode->CrtcVBlankStart >= pMode->CrtcVSyncStart) + pMode->CrtcVBlankStart = pMode->CrtcVSyncStart - 1; + pMode->CrtcVBlankEnd = pMode->CrtcVBlankStart + 0x01FF; + } + } } /* Set up sequencer register values */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.9 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.9 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.10 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c,v 1.4 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.4 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.4 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.5 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.13 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c Wed Jan 1 14:16:34 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.13 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.14 2003/01/01 19:16:34 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.8 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.8 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.9 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.13 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.13 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.14 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.8 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.8 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.9 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c,v 1.4 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h,v 1.4 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.2 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c,v 1.2 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c,v 1.3 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.2 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h,v 1.2 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h,v 1.3 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2001 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.17 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.17 Tue Oct 2 15:44:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h Mon Dec 16 11:19:10 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.17 2001/10/02 19:44:01 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.24 2002/12/16 16:19:10 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -61,9 +61,10 @@ #include "GL/glxint.h" #endif -#define R128_DEBUG 0 /* Turn off debugging output */ +#define R128_DEBUG 0 /* Turn off debugging output */ +#define R128_IDLE_RETRY 32 /* Fall out of idle loops after this count */ #define R128_TIMEOUT 2000000 /* Fall out of wait loops after this count */ -#define R128_MMIOSIZE 0x80000 +#define R128_MMIOSIZE 0x4000 #define R128_VBIOS_SIZE 0x00010000 @@ -263,8 +264,16 @@ unsigned char *scratch_save; int scanline_x; int scanline_y; + int scanline_w; int scanline_h; - int scanline_h_w; +#ifdef XF86DRI + int scanline_hpass; + int scanline_x1clip; + int scanline_x2clip; + int scanline_rop; + int scanline_fg; + int scanline_bg; +#endif /* XF86DRI */ int scanline_words; int scanline_direct; int scanline_bpp; /* Only used for ImageWrite */ @@ -370,6 +379,11 @@ CARD32 re_width_height; CARD32 aux_sc_cntl; + + int irq; + CARD32 gen_int_cntl; + + Bool DMAForXv; #endif XF86VideoAdaptorPtr adaptor; @@ -415,7 +429,7 @@ #define R128CCE_START(pScrn, info) \ do { \ - int _ret = drmR128StartCCE(info->drmFD); \ + int _ret = drmCommandNone(info->drmFD, DRM_R128_CCE_START); \ if (_ret) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CCE start %d\n", __FUNCTION__, _ret); \ @@ -424,7 +438,7 @@ #define R128CCE_STOP(pScrn, info) \ do { \ - int _ret = drmR128StopCCE(info->drmFD); \ + int _ret = R128CCEStop(pScrn); \ if (_ret) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CCE stop %d\n", __FUNCTION__, _ret); \ @@ -435,7 +449,7 @@ do { \ if (info->directRenderingEnabled \ && R128CCE_USE_RING_BUFFER(info->CCEMode)) { \ - int _ret = drmR128ResetCCE(info->drmFD); \ + int _ret = drmCommandNone(info->drmFD, DRM_R128_CCE_RESET); \ if (_ret) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CCE reset %d\n", __FUNCTION__, _ret); \ @@ -443,14 +457,13 @@ } \ } while (0) -#endif - -#ifdef XF86DRI extern drmBufPtr R128CCEGetBuffer(ScrnInfoPtr pScrn); #endif -extern void R128CCEFlushIndirect(ScrnInfoPtr pScrn); + +extern void R128CCEFlushIndirect(ScrnInfoPtr pScrn, int discard); extern void R128CCEReleaseIndirect(ScrnInfoPtr pScrn); extern void R128CCEWaitForIdle(ScrnInfoPtr pScrn); +extern int R128CCEStop(ScrnInfoPtr pScrn); #define CCE_PACKET0( reg, n ) \ @@ -466,7 +479,6 @@ #define R128_VERBOSE 0 #define RING_LOCALS CARD32 *__head; int __count; -#define RING_THRESHOLD 256 #define R128CCE_REFRESH(pScrn, info) \ do { \ @@ -491,11 +503,11 @@ "BEGIN_RING( %d ) in %s\n", n, __FUNCTION__ ); \ } \ if ( !info->indirectBuffer ) { \ - info->indirectBuffer = R128CCEGetBuffer( pScrn ); \ + info->indirectBuffer = R128CCEGetBuffer( pScrn ); \ info->indirectStart = 0; \ - } else if ( info->indirectBuffer->used - info->indirectStart + \ - (n) * (int)sizeof(CARD32) > RING_THRESHOLD ) { \ - R128CCEFlushIndirect( pScrn ); \ + } else if ( (info->indirectBuffer->used + 4*(n)) > \ + info->indirectBuffer->total ) { \ + R128CCEFlushIndirect( pScrn, 1 ); \ } \ __head = (pointer)((char *)info->indirectBuffer->address + \ info->indirectBuffer->used); \ @@ -510,7 +522,7 @@ __count * sizeof(CARD32), \ info->indirectBuffer->used - info->indirectStart + \ __count * sizeof(CARD32), \ - RING_THRESHOLD ); \ + info->indirectBuffer->total - info->indirectStart ); \ } \ info->indirectBuffer->used += __count * (int)sizeof(CARD32); \ } while (0) @@ -535,7 +547,7 @@ xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ "FLUSH_RING in %s\n", __FUNCTION__ ); \ if ( info->indirectBuffer ) { \ - R128CCEFlushIndirect( pScrn ); \ + R128CCEFlushIndirect( pScrn, 0 ); \ } \ } while (0) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.3 Thu May 31 22:10:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man Tue Jun 4 19:04:50 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man,v 1.3 2001/06/01 02:10:05 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man,v 1.4 2002/06/04 23:04:50 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH R128 __drivermansuffix__ __vendorversion__ @@ -108,6 +108,11 @@ Enable or disable use of an OS-specific framebuffer device interface (which is not supported on all OSs). See fbdevhw(__drivermansuffix__) for further information. +Default: off. +.TP +.BI "Option \*qDMAForXv\*q \*q" boolean \*q +Try or don't try to use DMA for Xv image transfers. This will reduce CPU +usage when playing big videos like DVDs, but may cause instabilities. Default: off. .PP Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.13 Tue Oct 2 15:44:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c Thu Nov 14 22:01:35 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.13 2001/10/02 19:44:01 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.16 2002/11/15 03:01:35 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -32,7 +32,7 @@ * Authors: * Rickard E. Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> - * Alan Hourihane <ahourihane@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * * Credits: * @@ -82,6 +82,7 @@ /* Driver data structures */ #include "r128.h" #include "r128_reg.h" +#include "r128_sarea.h" #ifdef XF86DRI #include "r128_sarea.h" #define _XF86DRI_SERVER_ @@ -228,19 +229,20 @@ void R128CCEWaitForIdle(ScrnInfoPtr pScrn) { R128InfoPtr info = R128PTR(pScrn); - int ret; - int i = 0; + int ret, i; FLUSH_RING(); for (;;) { - do { - ret = drmR128WaitForIdleCCE(info->drmFD); - if (ret && ret != -EBUSY) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "%s: CCE idle %d\n", __FUNCTION__, ret); - } - } while ((ret == -EBUSY) && (i++ < R128_TIMEOUT)); + i = 0; + do { + ret = drmCommandNone(info->drmFD, DRM_R128_CCE_IDLE); + } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); + + if (ret && ret != -EBUSY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: CCE idle %d\n", __FUNCTION__, ret); + } if (ret == 0) return; @@ -253,6 +255,49 @@ R128CCE_START(pScrn, info); } } + +int R128CCEStop(ScrnInfoPtr pScrn) +{ + R128InfoPtr info = R128PTR(pScrn); + drmR128CCEStop stop; + int ret, i; + + stop.flush = 1; + stop.idle = 1; + + ret = drmCommandWrite( info->drmFD, DRM_R128_CCE_STOP, + &stop, sizeof(drmR128CCEStop) ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.flush = 0; + + i = 0; + do { + ret = drmCommandWrite( info->drmFD, DRM_R128_CCE_STOP, + &stop, sizeof(drmR128CCEStop) ); + } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.idle = 0; + + if ( drmCommandWrite( info->drmFD, DRM_R128_CCE_STOP, + &stop, sizeof(drmR128CCEStop) )) { + return -errno; + } else { + return 0; + } +} + #endif /* Setup for XAA SolidFill. */ @@ -704,6 +749,7 @@ unsigned char *R128MMIO = info->MMIO; R128WaitForFifo(pScrn, 4); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_DST_CLIPPING | R128_GMC_BRUSH_NONE @@ -713,6 +759,16 @@ | R128_ROP[rop].rop | R128_GMC_BYTE_LSB_TO_MSB | R128_DP_SRC_SOURCE_HOST_DATA)); +#else /* X_BYTE_ORDER == X_BIG_ENDIAN */ + OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl + | R128_GMC_DST_CLIPPING + | R128_GMC_BRUSH_NONE + | (bg == -1 + ? R128_GMC_SRC_DATATYPE_MONO_FG_LA + : R128_GMC_SRC_DATATYPE_MONO_FG_BG) + | R128_ROP[rop].rop + | R128_DP_SRC_SOURCE_HOST_DATA)); +#endif OUTREG(R128_DP_WRITE_MASK, planemask); OUTREG(R128_DP_SRC_FRGD_CLR, fg); OUTREG(R128_DP_SRC_BKGD_CLR, bg); @@ -991,10 +1047,19 @@ OUTREG(R128_DP_WRITE_MASK, 0xffffffff); R128WaitForFifo(pScrn, 1); + #if X_BYTE_ORDER == X_BIG_ENDIAN - OUTREGP(R128_DP_DATATYPE, - R128_HOST_BIG_ENDIAN_EN, ~R128_HOST_BIG_ENDIAN_EN); -#else + /* FIXME: this is a kludge for texture uploads in the 3D driver. Look at + * how the radeon driver handles HOST_DATA_SWAP if you want to implement + * CCE ImageWrite acceleration or anything needing this bit */ +#ifdef XF86DRI + if (info->directRenderingEnabled) + OUTREGP(R128_DP_DATATYPE, 0, ~R128_HOST_BIG_ENDIAN_EN); + else +#endif + OUTREGP(R128_DP_DATATYPE, + R128_HOST_BIG_ENDIAN_EN, ~R128_HOST_BIG_ENDIAN_EN); +#else /* X_LITTLE_ENDIAN */ OUTREGP(R128_DP_DATATYPE, 0, ~R128_HOST_BIG_ENDIAN_EN); #endif @@ -1129,6 +1194,150 @@ ADVANCE_RING(); } + +/* + * XAA scanline color expansion + * + * We use HOSTDATA_BLT CCE packets, dividing the image in chunks that fit into + * the indirect buffer if necessary. + */ +static void R128CCESetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int + planemask) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( 2 ); + OUT_RING_REG(R128_DP_WRITE_MASK, planemask); + ADVANCE_RING(); + + info->scanline_rop = rop; + info->scanline_fg = fg; + info->scanline_bg = bg; +} + +/* Helper function to write out a HOSTDATA_BLT packet into the indirect buffer + and set the XAA scratch buffer address appropriately */ +static void R128CCEScanlineCPUToScreenColorExpandFillPacket(ScrnInfoPtr pScrn, + int bufno) +{ + R128InfoPtr info = R128PTR(pScrn); + int chunk_words = info->scanline_hpass * info->scanline_words; + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( chunk_words+9 ); + + OUT_RING( CCE_PACKET3( R128_CCE_PACKET3_CNTL_HOSTDATA_BLT, chunk_words+9-2 ) ); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + OUT_RING( (info->dp_gui_master_cntl + | R128_GMC_DST_CLIPPING + | R128_GMC_BRUSH_NONE + | (info->scanline_bg == -1 + ? R128_GMC_SRC_DATATYPE_MONO_FG_LA + : R128_GMC_SRC_DATATYPE_MONO_FG_BG) + | R128_ROP[info->scanline_rop].rop + | R128_GMC_BYTE_LSB_TO_MSB + | R128_DP_SRC_SOURCE_HOST_DATA)); +#else /* X_BYTE_ORDER == X_BIG_ENDIAN */ + OUT_RING( (info->dp_gui_master_cntl + | R128_GMC_DST_CLIPPING + | R128_GMC_BRUSH_NONE + | (info->scanline_bg == -1 + ? R128_GMC_SRC_DATATYPE_MONO_FG_LA + : R128_GMC_SRC_DATATYPE_MONO_FG_BG) + | R128_ROP[info->scanline_rop].rop + | R128_DP_SRC_SOURCE_HOST_DATA)); +#endif + OUT_RING( (info->scanline_y << 16) | (info->scanline_x1clip & 0xffff) ); + OUT_RING( ((info->scanline_y+info->scanline_hpass-1) << 16) | ((info->scanline_x2clip-1) & 0xffff) ); + OUT_RING( info->scanline_fg ); + OUT_RING( info->scanline_bg ); + OUT_RING( (info->scanline_y << 16) | (info->scanline_x & 0xffff)); + + /* Have to pad the width here and use clipping engine */ + OUT_RING( (info->scanline_hpass << 16) | ((info->scanline_w + 31) & ~31)); + + OUT_RING( chunk_words ); + + info->scratch_buffer[bufno] = (unsigned char *) &__head[__count]; + __count += chunk_words; + + ADVANCE_RING(); + + info->scanline_y += info->scanline_hpass; + info->scanline_h -= info->scanline_hpass; + + if ( R128_VERBOSE ) + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "%s: hpass=%d, words=%d => chunk_words=%d, y=%d, h=%d\n", + __FUNCTION__, info->scanline_hpass, info->scanline_words, + chunk_words, info->scanline_y, info->scanline_h ); +} + +/* Subsequent XAA indirect CPU-to-screen color expansion. This is only + called once for each rectangle. */ +static void R128CCESubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft) +{ + R128InfoPtr info = R128PTR(pScrn); + +#define BUFSIZE ( R128_BUFFER_SIZE/4-9 ) + + info->scanline_x = x; + info->scanline_y = y; + info->scanline_w = w; + info->scanline_h = h; + + info->scanline_x1clip = x+skipleft; + info->scanline_x2clip = x+w; + + info->scanline_words = (w + 31) >> 5; + info->scanline_hpass = min(h,(BUFSIZE/info->scanline_words)); + + if ( R128_VERBOSE ) + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "%s: x=%d, y=%d, w=%d, h=%d, skipleft=%d => x1clip=%d, x2clip=%d, hpass=%d, words=%d\n", + __FUNCTION__, x, y, w, h, skipleft, info->scanline_x1clip, info->scanline_x2clip, + info->scanline_hpass, info->scanline_words ); + + R128CCEScanlineCPUToScreenColorExpandFillPacket(pScrn, 0); +} + +/* Subsequent XAA indirect CPU-to-screen color expansion. This is called + once for each scanline. */ +static void R128CCESubsequentColorExpandScanline(ScrnInfoPtr pScrn, + int bufno) +{ + R128InfoPtr info = R128PTR(pScrn); + + if ( R128_VERBOSE ) + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "%s enter: scanline_hpass=%d, scanline_h=%d\n", + __FUNCTION__, info->scanline_hpass, info->scanline_h ); + + if (--info->scanline_hpass) { + info->scratch_buffer[bufno] += 4 * info->scanline_words; + } + else if(info->scanline_h) { + info->scanline_hpass = min(info->scanline_h,(BUFSIZE/info->scanline_words)); + R128CCEScanlineCPUToScreenColorExpandFillPacket(pScrn, bufno); + } + + if ( R128_VERBOSE ) + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "%s exit: scanline_hpass=%d, scanline_h=%d\n", + __FUNCTION__, info->scanline_hpass, info->scanline_h ); +} + /* Solid lines */ static void R128CCESetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) @@ -1348,11 +1557,11 @@ while ( 1 ) { do { ret = drmDMA( info->drmFD, &dma ); - if ( ret && ret != -EBUSY ) { + if ( ret && ret != -EAGAIN ) { xf86DrvMsg( pScrn->scrnIndex, X_ERROR, "%s: CCE GetBuffer %d\n", __FUNCTION__, ret ); } - } while ( ( ret == -EBUSY ) && ( i++ < R128_TIMEOUT ) ); + } while ( ( ret == -EAGAIN ) && ( i++ < R128_TIMEOUT ) ); if ( ret == 0 ) { buf = &info->buffers->list[indx]; @@ -1377,30 +1586,35 @@ /* Flush the indirect buffer to the kernel for submission to the card. */ -void R128CCEFlushIndirect( ScrnInfoPtr pScrn ) +void R128CCEFlushIndirect( ScrnInfoPtr pScrn, int discard ) { R128InfoPtr info = R128PTR(pScrn); drmBufPtr buffer = info->indirectBuffer; int start = info->indirectStart; - int discard; + drmR128Indirect indirect; if ( !buffer ) return; - if ( start == buffer->used ) - return; + if ( (start == buffer->used) && !discard ) + return; - discard = ( buffer->used + RING_THRESHOLD > buffer->total ); + indirect.idx = buffer->idx; + indirect.start = start; + indirect.end = buffer->used; + indirect.discard = discard; - drmR128FlushIndirectBuffer( info->drmFD, buffer->idx, - start, buffer->used, discard ); + drmCommandWriteRead( info->drmFD, DRM_R128_INDIRECT, + &indirect, sizeof(drmR128Indirect)); - if ( discard ) { - info->indirectBuffer = R128CCEGetBuffer( pScrn ); - info->indirectStart = 0; - } else { - info->indirectStart = buffer->used; - } + if ( discard ) + buffer = info->indirectBuffer = R128CCEGetBuffer( pScrn ); + + /* pad to an even number of dwords */ + if (buffer->used & 7) + buffer->used = ( buffer->used+7 ) & ~7; + + info->indirectStart = buffer->used; } /* Flush and release the indirect buffer. @@ -1410,19 +1624,27 @@ R128InfoPtr info = R128PTR(pScrn); drmBufPtr buffer = info->indirectBuffer; int start = info->indirectStart; + drmR128Indirect indirect; info->indirectBuffer = NULL; info->indirectStart = 0; if ( !buffer ) return; + + indirect.idx = buffer->idx; + indirect.start = start; + indirect.end = buffer->used; + indirect.discard = 1; - drmR128FlushIndirectBuffer( info->drmFD, buffer->idx, - start, buffer->used, 1 ); + drmCommandWriteRead( info->drmFD, DRM_R128_INDIRECT, + &indirect, sizeof(drmR128Indirect)); } static void R128CCEAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) { + R128InfoPtr info = R128PTR(pScrn); + a->Flags = (PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER); @@ -1448,6 +1670,18 @@ a->SetupForScreenToScreenCopy = R128CCESetupForScreenToScreenCopy; a->SubsequentScreenToScreenCopy = R128CCESubsequentScreenToScreenCopy; + /* Indirect CPU-To-Screen Color Expand */ + a->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING + | LEFT_EDGE_CLIPPING_NEGATIVE_X; + a->NumScanlineColorExpandBuffers = 1; + a->ScanlineColorExpandBuffers = info->scratch_buffer; + info->scratch_buffer[0] = NULL; + a->SetupForScanlineCPUToScreenColorExpandFill + = R128CCESetupForScanlineCPUToScreenColorExpandFill; + a->SubsequentScanlineCPUToScreenColorExpandFill + = R128CCESubsequentScanlineCPUToScreenColorExpandFill; + a->SubsequentColorExpandScanline = R128CCESubsequentColorExpandScanline; + /* Bresenham Solid Lines */ a->SetupForSolidLine = R128CCESetupForSolidLine; a->SubsequentSolidBresenhamLine = R128CCESubsequentSolidBresenhamLine; @@ -1508,14 +1742,8 @@ | BIT_ORDER_IN_BYTE_LSBFIRST); /* Indirect CPU-To-Screen Color Expand */ -#if X_BYTE_ORDER == X_LITTLE_ENDIAN a->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; -#else - a->ScanlineCPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST - | LEFT_EDGE_CLIPPING - | LEFT_EDGE_CLIPPING_NEGATIVE_X; -#endif a->NumScanlineColorExpandBuffers = 1; a->ScanlineColorExpandBuffers = info->scratch_buffer; info->scratch_save = xalloc(((pScrn->virtualX+31)/32*4) @@ -1567,8 +1795,6 @@ if (!(a = info->accel = XAACreateInfoRec())) return FALSE; #ifdef XF86DRI - /* FIXME: When direct rendering is enabled, we should use the CCE to - draw 2D commands */ if (info->directRenderingEnabled) R128CCEAccelInit(pScrn, a); else Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/r128_common.h:1.2 --- /dev/null Thu Feb 27 12:30:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_common.h Mon Dec 16 11:19:10 2002 @@ -0,0 +1,170 @@ +/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite + * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * + * Converted to common header format: + * Jens Owen <jens@tungstengraphics.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_common.h,v 1.2 2002/12/16 16:19:10 dawes Exp $ + * + */ + +#ifndef _R128_COMMON_H_ +#define _R128_COMMON_H_ + +#include "X11/Xmd.h" + +/* + * WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (r128_drm.h) + */ + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_R128_INIT 0x00 +#define DRM_R128_CCE_START 0x01 +#define DRM_R128_CCE_STOP 0x02 +#define DRM_R128_CCE_RESET 0x03 +#define DRM_R128_CCE_IDLE 0x04 +#define DRM_R128_UNDEFINED1 0x05 +#define DRM_R128_RESET 0x06 +#define DRM_R128_SWAP 0x07 +#define DRM_R128_CLEAR 0x08 +#define DRM_R128_VERTEX 0x09 +#define DRM_R128_INDICES 0x0a +#define DRM_R128_BLIT 0x0b +#define DRM_R128_DEPTH 0x0c +#define DRM_R128_STIPPLE 0x0d +#define DRM_R128_UNDEFINED2 0x0e +#define DRM_R128_INDIRECT 0x0f +#define DRM_R128_FULLSCREEN 0x10 +#define DRM_R128_CLEAR2 0x11 +#define DRM_R128_GETPARAM 0x12 + +#define DRM_R128_FRONT_BUFFER 0x1 +#define DRM_R128_BACK_BUFFER 0x2 +#define DRM_R128_DEPTH_BUFFER 0x4 + +typedef struct { + enum { + DRM_R128_INIT_CCE = 0x01, + DRM_R128_CLEANUP_CCE = 0x02 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cce_mode; + int cce_secure; /* FIXME: Deprecated, we should remove this */ + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drmR128Init; + +typedef struct { + int flush; + int idle; +} drmR128CCEStop; + +typedef struct { + int idx; + int start; + int end; + int discard; +} drmR128Indirect; + +typedef struct { + int idx; + int pitch; + int offset; + int format; + unsigned short x, y; + unsigned short width, height; +} drmR128Blit; + +typedef struct { + enum { + DRM_R128_WRITE_SPAN = 0x01, + DRM_R128_WRITE_PIXELS = 0x02, + DRM_R128_READ_SPAN = 0x03, + DRM_R128_READ_PIXELS = 0x04 + } func; + int n; + int *x; + int *y; + unsigned int *buffer; + unsigned char *mask; +} drmR128Depth; + +typedef struct { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drmR128Vertex; + +typedef struct { + unsigned int *mask; +} drmR128Stipple; + +typedef struct { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drmR128Clear; + +typedef struct { + enum { + DRM_R128_INIT_FULLSCREEN = 0x01, + DRM_R128_CLEANUP_FULLSCREEN = 0x02 + } func; +} drmR128Fullscreen; + +typedef struct drm_r128_getparam { + int param; + int *value; +} drmR128GetParam; + +#define R128_PARAM_IRQ_NR 1 + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c:1.5 Sat Mar 3 17:26:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c Thu Feb 13 15:28:40 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.5 2001/03/03 22:26:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.6 2003/02/13 20:28:40 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -216,7 +216,8 @@ cursor->MaxWidth = 64; cursor->MaxHeight = 64; cursor->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP - + | HARDWARE_CURSOR_SHOW_TRANSPARENT + | HARDWARE_CURSOR_UPDATE_UNHIDDEN #if X_BYTE_ORDER == X_LITTLE_ENDIAN | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c:1.6 Tue Nov 6 10:53:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c Wed Oct 30 07:52:12 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.6 2001/11/06 15:53:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.9 2002/10/30 12:52:12 alanh Exp $ */ /* * Authors: * Ove Kåven <ovek@transgaming.com>, @@ -15,6 +15,9 @@ /* DGA support */ #include "dgaproc.h" +#ifdef XF86DRI +#include "r128_common.h" +#endif static Bool R128_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, int *, int *); @@ -26,124 +29,111 @@ static void R128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); - -static DGAModePtr -R128SetupDGAMode( - ScrnInfoPtr pScrn, - DGAModePtr modes, - int *num, - int bitsPerPixel, - int depth, - Bool pixmap, - int secondPitch, - unsigned long red, - unsigned long green, - unsigned long blue, - short visualClass -){ - R128InfoPtr info = R128PTR(pScrn); - DGAModePtr newmodes = NULL, currentMode; - DisplayModePtr pMode, firstMode; - int otherPitch, Bpp = bitsPerPixel >> 3; - Bool oneMore; - - pMode = firstMode = pScrn->modes; - - while(pMode) { - - otherPitch = secondPitch ? secondPitch : pMode->HDisplay; - - if(pMode->HDisplay != otherPitch) { - newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec)); - oneMore = TRUE; - } else { - newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)); - oneMore = FALSE; - } - - if(!newmodes) { - xfree(modes); - return NULL; - } - modes = newmodes; +static DGAModePtr R128SetupDGAMode(ScrnInfoPtr pScrn, + DGAModePtr modes, + int *num, + int bitsPerPixel, + int depth, + Bool pixmap, + int secondPitch, + unsigned long red, + unsigned long green, + unsigned long blue, + short visualClass) +{ + R128InfoPtr info = R128PTR(pScrn); + DGAModePtr newmodes = NULL; + DGAModePtr currentMode; + DisplayModePtr pMode; + DisplayModePtr firstMode; + unsigned int size; + int pitch; + int Bpp = bitsPerPixel >> 3; SECOND_PASS: - - currentMode = modes + *num; - (*num)++; - currentMode->mode = pMode; - currentMode->flags = DGA_CONCURRENT_ACCESS; - if(pixmap) - currentMode->flags |= DGA_PIXMAP_AVAILABLE; - if(info->accel) { - if(info->accel->SetupForSolidFill && - info->accel->SubsequentSolidFillRect) - currentMode->flags |= DGA_FILL_RECT; - if(info->accel->SetupForScreenToScreenCopy && - info->accel->SubsequentScreenToScreenCopy) - currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; - - if(currentMode->flags & - (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | - DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) - currentMode->flags &= -DGA_CONCURRENT_ACCESS; - } + pMode = firstMode = pScrn->modes; - if(pMode->Flags & V_DBLSCAN) - currentMode->flags |= DGA_DOUBLESCAN; - if(pMode->Flags & V_INTERLACE) - currentMode->flags |= DGA_INTERLACED; - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = depth; - currentMode->bitsPerPixel = bitsPerPixel; - currentMode->red_mask = red; - currentMode->green_mask = green; - currentMode->blue_mask = blue; - currentMode->visualClass = visualClass; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = 8; - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - currentMode->address = (unsigned char*)info->LinearAddr; - - if(oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pMode->VDisplay; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = ((otherPitch * Bpp) + 3) & ~3L; - currentMode->imageWidth = otherPitch; - currentMode->imageHeight = pMode->VDisplay; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; + while (1) { + pitch = pScrn->displayWidth; + size = pitch * Bpp * pMode->VDisplay; + + if ((!secondPitch || (pitch != secondPitch)) && + (size <= info->FbMapSize)) { + + if (secondPitch) + pitch = secondPitch; + + if (!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)))) + break; + + modes = newmodes; + currentMode = modes + *num; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS; + + if (pixmap) + currentMode->flags |= DGA_PIXMAP_AVAILABLE; + + if (info->accel) { + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + currentMode->flags |= DGA_FILL_RECT; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) + currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + if (currentMode->flags & + (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | + DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) + currentMode->flags &= ~DGA_CONCURRENT_ACCESS; + } + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = depth; + currentMode->bitsPerPixel = bitsPerPixel; + currentMode->red_mask = red; + currentMode->green_mask = green; + currentMode->blue_mask = blue; + currentMode->visualClass = visualClass; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 8; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = (unsigned char*)info->LinearAddr; + currentMode->bytesPerScanline = pitch * Bpp; + currentMode->imageWidth = pitch; + currentMode->imageHeight = (info->FbMapSize + / currentMode->bytesPerScanline); + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = (currentMode->imageWidth + - currentMode->viewportWidth); /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; + currentMode->maxViewportY = (currentMode->imageHeight + - currentMode->viewportHeight); + (*num)++; } pMode = pMode->next; - if(pMode == firstMode) - break; - } + if (pMode == firstMode) + break; + } + + if (secondPitch) { + secondPitch = 0; + goto SECOND_PASS; + } - return modes; + return modes; } - Bool R128DGAInit(ScreenPtr pScreen) { @@ -217,7 +207,7 @@ info->DGAFuncs.BlitTransRect = NULL; if (info->accel) { - info->DGAFuncs.Sync = R128WaitForIdle; + info->DGAFuncs.Sync = info->accel->Sync; if (info->accel->SetupForSolidFill && info->accel->SubsequentSolidFillRect) info->DGAFuncs.FillRect = R128_FillRect; @@ -249,6 +239,18 @@ pScrn->currentMode = info->CurrentLayout.mode; pScrn->SwitchMode(indx, pScrn->currentMode, 0); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + R128CCE_STOP(pScrn, info); + } +#endif + if (info->accelOn) + R128EngineInit(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + R128CCE_START(pScrn, info); + } +#endif pScrn->AdjustFrame(indx, 0, 0, 0); info->DGAactive = FALSE; } else { @@ -268,6 +270,19 @@ /* R128ModeInit() will set the mode field */ pScrn->SwitchMode(indx, pMode->mode, 0); + +#ifdef XF86DRI + if (info->directRenderingEnabled) { + R128CCE_STOP(pScrn, info); + } +#endif + if (info->accelOn) + R128EngineInit(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + R128CCE_START(pScrn, info); + } +#endif } return TRUE; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.22 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.22 Fri Dec 28 10:49:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c Fri Feb 7 15:41:14 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.22 2001/12/28 15:49:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.28 2003/02/07 20:41:14 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -76,7 +76,7 @@ __GLXvisualConfig *pConfigs = 0; R128ConfigPrivPtr pR128Configs = 0; R128ConfigPrivPtr *pR128ConfigPtrs = 0; - int i, accum, stencil; + int i, accum, stencil, db; switch (info->CurrentLayout.pixel_code) { case 8: /* 8bpp mode is not support */ @@ -89,11 +89,13 @@ #define R128_USE_ACCUM 1 #define R128_USE_STENCIL 1 +#define R128_USE_DB 1 case 16: numConfigs = 1; if (R128_USE_ACCUM) numConfigs *= 2; if (R128_USE_STENCIL) numConfigs *= 2; + if (R128_USE_DB) numConfigs *= 2; if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), @@ -115,7 +117,8 @@ } i = 0; - for (accum = 0; accum <= R128_USE_ACCUM; accum++) { + for (db = 0; db <= R128_USE_DB; db++) { + for (accum = 0; accum <= R128_USE_ACCUM; accum++) { for (stencil = 0; stencil <= R128_USE_STENCIL; stencil++) { pR128ConfigPtrs[i] = &pR128Configs[i]; @@ -141,7 +144,10 @@ pConfigs[i].accumBlueSize = 0; pConfigs[i].accumAlphaSize = 0; } - pConfigs[i].doubleBuffer = TRUE; + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 16; pConfigs[i].depthSize = 16; @@ -164,6 +170,7 @@ pConfigs[i].transparentIndex = 0; i++; } + } } break; @@ -171,6 +178,7 @@ numConfigs = 1; if (R128_USE_ACCUM) numConfigs *= 2; if (R128_USE_STENCIL) numConfigs *= 2; + if (R128_USE_DB) numConfigs *= 2; if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), @@ -192,7 +200,8 @@ } i = 0; - for (accum = 0; accum <= R128_USE_ACCUM; accum++) { + for (db = 0; db <= R128_USE_DB; db++) { + for (accum = 0; accum <= R128_USE_ACCUM; accum++) { for (stencil = 0; stencil <= R128_USE_STENCIL; stencil++) { pR128ConfigPtrs[i] = &pR128Configs[i]; @@ -218,7 +227,10 @@ pConfigs[i].accumBlueSize = 0; pConfigs[i].accumAlphaSize = 0; } - pConfigs[i].doubleBuffer = TRUE; + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 24; if (stencil) { @@ -243,6 +255,7 @@ pConfigs[i].transparentIndex = 0; i++; } + } } break; } @@ -300,14 +313,16 @@ unsigned char *R128MMIO = info->MMIO; if (!info->directRenderingEnabled) { - if (!info->CCEInUse) { - /* Save all hardware scissors */ - info->sc_left = INREG(R128_SC_LEFT); - info->sc_right = INREG(R128_SC_RIGHT); - info->sc_top = INREG(R128_SC_TOP); - info->sc_bottom = INREG(R128_SC_BOTTOM); - info->aux_sc_cntl = INREG(R128_SC_BOTTOM); - } + /* Save all hardware scissors */ + info->sc_left = INREG(R128_SC_LEFT); + info->sc_right = INREG(R128_SC_RIGHT); + info->sc_top = INREG(R128_SC_TOP); + info->sc_bottom = INREG(R128_SC_BOTTOM); + info->aux_sc_cntl = INREG(R128_SC_BOTTOM); + } else if (info->CCEInUse) { + R128CCEReleaseIndirect(pScrn); + + info->CCEInUse = FALSE; } } @@ -418,6 +433,7 @@ unsigned long cntl, chunk; int s, l; int flags; + unsigned long agpBase; if (drmAgpAcquire(info->drmFD) < 0) { xf86DrvMsg(pScreen->myNum, X_WARNING, "[agp] AGP not available\n"); @@ -589,7 +605,8 @@ info->agpSize*1024); return FALSE; } - OUTREG(R128_AGP_BASE, info->ringHandle); /* Ring buf is at AGP offset 0 */ + agpBase = drmAgpBase(info->drmFD); + OUTREG(R128_AGP_BASE, agpBase); OUTREG(R128_AGP_CNTL, cntl); /* Disable Rage 128's PCIGART registers */ @@ -601,8 +618,6 @@ OUTREG(R128_PCI_GART_PAGE, 1); /* Ensure AGP GART is used (for now) */ - xf86EnablePciBusMaster(info->PciInfo, TRUE); - return TRUE; } @@ -727,6 +742,40 @@ case PCI_CHIP_RAGE128TF: case PCI_CHIP_RAGE128TL: case PCI_CHIP_RAGE128TR: + /* FIXME: ATI documentation does not specify if the following chips are + * AGP or PCI, it just mentions their PCI IDs. I'm assuming they're AGP + * until I get more correct information. <mharris@redhat.com> + */ + case PCI_CHIP_RAGE128PA: + case PCI_CHIP_RAGE128PB: + case PCI_CHIP_RAGE128PC: + case PCI_CHIP_RAGE128PE: + case PCI_CHIP_RAGE128PG: + case PCI_CHIP_RAGE128PH: + case PCI_CHIP_RAGE128PI: + case PCI_CHIP_RAGE128PJ: + case PCI_CHIP_RAGE128PK: + case PCI_CHIP_RAGE128PL: + case PCI_CHIP_RAGE128PM: + case PCI_CHIP_RAGE128PN: + case PCI_CHIP_RAGE128PO: + case PCI_CHIP_RAGE128PQ: + case PCI_CHIP_RAGE128PS: + case PCI_CHIP_RAGE128PT: + case PCI_CHIP_RAGE128PU: + case PCI_CHIP_RAGE128PV: + case PCI_CHIP_RAGE128PW: + case PCI_CHIP_RAGE128PX: + case PCI_CHIP_RAGE128SE: + case PCI_CHIP_RAGE128SF: + case PCI_CHIP_RAGE128SG: + case PCI_CHIP_RAGE128SH: + case PCI_CHIP_RAGE128SK: + case PCI_CHIP_RAGE128SL: + case PCI_CHIP_RAGE128SN: + case PCI_CHIP_RAGE128TS: + case PCI_CHIP_RAGE128TT: + case PCI_CHIP_RAGE128TU: default: /* This is really an AGP card, force PCI GART mode */ chunk = INREG(R128_BM_CHUNK_0_VAL); @@ -767,6 +816,9 @@ { drmR128Init drmInfo; + memset( &drmInfo, 0, sizeof(drmR128Init) ); + + drmInfo.func = DRM_R128_INIT_CCE; drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); drmInfo.is_pci = info->IsPCI; drmInfo.cce_mode = info->CCEMode; @@ -787,14 +839,16 @@ drmInfo.depth_pitch = info->depthPitch; drmInfo.span_offset = info->spanOffset; - drmInfo.fb_offset = info->LinearAddr; + drmInfo.fb_offset = info->fbHandle; drmInfo.mmio_offset = info->registerHandle; drmInfo.ring_offset = info->ringHandle; drmInfo.ring_rptr_offset = info->ringReadPtrHandle; drmInfo.buffers_offset = info->bufHandle; drmInfo.agp_textures_offset = info->agpTexHandle; - if (drmR128InitCCE(info->drmFD, &drmInfo) < 0) return FALSE; + if (drmCommandWrite(info->drmFD, DRM_R128_INIT, + &drmInfo, sizeof(drmR128Init)) < 0) + return FALSE; return TRUE; } @@ -838,6 +892,35 @@ return TRUE; } +static void R128DRIIrqInit(R128InfoPtr info, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if (!info->irq) { + info->irq = drmGetInterruptFromBusID( + info->drmFD, + ((pciConfigPtr)info->PciInfo->thisCard)->busnum, + ((pciConfigPtr)info->PciInfo->thisCard)->devnum, + ((pciConfigPtr)info->PciInfo->thisCard)->funcnum); + + if((drmCtlInstHandler(info->drmFD, info->irq)) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding irq handler, " + "there is a device already using that irq\n" + "[drm] falling back to irq-free operation\n"); + info->irq = 0; + } else { + unsigned char *R128MMIO = info->MMIO; + info->gen_int_cntl = INREG( R128_GEN_INT_CNTL ); + } + } + + if (info->irq) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + info->irq); +} + /* Initialize the CCE state, and start the CCE (if used by the X server) */ static void R128DRICCEInit(ScrnInfoPtr pScrn) { @@ -994,6 +1077,42 @@ return FALSE; } + /* Check the DRM lib version. + drmGetLibVersion was not supported in version 1.0, so check for + symbol first to avoid possible crash or hang. + */ + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + version = drmGetLibVersion(info->drmFD); + } + else { + /* drmlib version 1.0.0 didn't have the drmGetLibVersion + entry point. Fake it by allocating a version record + via drmGetVersion and changing it to version 1.0.0 + */ + version = drmGetVersion(info->drmFD); + version->version_major = 1; + version->version_minor = 0; + version->version_patchlevel = 0; + } + + if (version) { + if (version->version_major != 1 || + version->version_minor < 1) { + /* incompatible drm library version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] R128DRIScreenInit failed because of a version mismatch.\n" + "[dri] libdrm.a module version is %d.%d.%d but version 1.1.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + R128DRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } + /* Check the r128 DRM version */ version = drmGetVersion(info->drmFD); if (version) { @@ -1037,6 +1156,18 @@ return FALSE; } + /* DRIScreenInit adds the frame buffer + map, but we need it as well */ + { + void *scratch_ptr; + int scratch_int; + + DRIGetDeviceInfo(pScreen, &info->fbHandle, + &scratch_int, &scratch_int, + &scratch_int, &scratch_int, + &scratch_ptr); + } + /* FIXME: When are these mappings unmapped? */ if (!R128InitVisualConfigs(pScreen)) { @@ -1082,6 +1213,9 @@ return FALSE; } + /* Initialize IRQ */ + R128DRIIrqInit(info, pScreen); + /* Initialize and start the CCE if required */ R128DRICCEInit(pScrn); @@ -1128,12 +1262,18 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; R128InfoPtr info = R128PTR(pScrn); + drmR128Init drmInfo; /* Stop the CCE if it is still in use */ if (info->directRenderingEnabled) { R128CCE_STOP(pScrn, info); } + if (info->irq) { + drmCtlUninstHandler(info->drmFD); + info->irq = 0; + } + /* De-allocate vertex buffers */ if (info->buffers) { drmUnmapBufs(info->buffers); @@ -1141,7 +1281,10 @@ } /* De-allocate all kernel resources */ - drmR128CleanupCCE(info->drmFD); + memset(&drmInfo, 0, sizeof(drmR128Init)); + drmInfo.func = DRM_R128_CLEANUP_CCE; + drmCommandWrite(info->drmFD, DRM_R128_INIT, + &drmInfo, sizeof(drmR128Init)); /* De-allocate all AGP resources */ if (info->agpTex) { Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h:1.6 Wed Mar 21 12:02:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h Wed Oct 30 07:52:12 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.6 2001/03/21 17:02:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.7 2002/10/30 12:52:12 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -40,7 +40,7 @@ #define _R128_DRI_ #include "xf86drm.h" -#include "xf86drmR128.h" +#include "r128_common.h" /* DRI Driver defaults */ #define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.57 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.75 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.57 Fri Jan 4 16:22:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c Tue Feb 18 20:19:41 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.57 2002/01/04 21:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.75 2003/02/19 01:19:41 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -93,6 +93,7 @@ #include "xf86_OSproc.h" #include "xf86PciInfo.h" #include "xf86RAC.h" +#include "xf86Resources.h" #include "xf86cmap.h" #include "xf86xv.h" #include "vbe.h" @@ -116,6 +117,8 @@ static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); +static void R128DisplayPowerManagementSetLCD(ScrnInfoPtr pScrn, + int PowerManagementMode, int flags); typedef enum { OPTION_NOACCEL, @@ -123,6 +126,7 @@ OPTION_DAC_6BIT, OPTION_DAC_8BIT, #ifdef XF86DRI + OPTION_XV_DMA, OPTION_IS_PCI, OPTION_CCE_PIO, OPTION_NO_SECURITY, @@ -151,6 +155,7 @@ { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE }, #ifdef XF86DRI + { OPTION_XV_DMA, "DMAForXv", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_IS_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CCE_PIO, "CCEPIOMode", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NO_SECURITY, "CCENoSecurity", OPTV_BOOLEAN, {0}, FALSE }, @@ -197,6 +202,8 @@ "fbdevHWGetLineLength", "fbdevHWGetVidmem", + "fbdevHWDPMSSet", + /* colormap */ "fbdevHWLoadPalette", @@ -277,18 +284,17 @@ "drmAgpUnbind", "drmAgpVendorId", "drmAvailable", + "drmCommandNone", + "drmCommandRead", + "drmCommandWrite", + "drmCommandWriteRead", + "drmFreeBufs", "drmFreeVersion", + "drmGetLibVersion", "drmGetVersion", "drmMap", "drmMapBufs", "drmDMA", - "drmR128CleanupCCE", - "drmR128InitCCE", - "drmR128ResetCCE", - "drmR128StartCCE", - "drmR128StopCCE", - "drmR128WaitForIdleCCE", - "drmR128FlushIndirectBuffer", "drmScatterGatherAlloc", "drmScatterGatherFree", "drmUnmap", @@ -325,6 +331,32 @@ NULL }; +void R128LoaderRefSymLists(void) +{ + /* + * Tell the loader about symbols from other modules that this module might + * refer to. + */ + xf86LoaderRefSymLists(vgahwSymbols, +#ifdef USE_FB + fbSymbols, +#else + cfbSymbols, +#endif + xaaSymbols, + ramdacSymbols, +#ifdef XF86DRI + drmSymbols, + driSymbols, +#endif + fbdevHWSymbols, + int10Symbols, + vbeSymbols, + /* ddcsymbols, */ + i2cSymbols, + /* shadowSymbols, */ + NULL); +} /* Allocate our private R128InfoRec. */ static Bool R128GetRec(ScrnInfoPtr pScrn) @@ -535,7 +567,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Attempting to read Video BIOS from legacy ISA space!\n"); info->BIOSAddr = 0x000c0000; - xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, R128_VBIOS_SIZE); + xf86ReadDomainMemory(info->PciTag, info->BIOSAddr, R128_VBIOS_SIZE, info->VBIOS); } } if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { @@ -897,10 +929,44 @@ switch (info->Chipset) { /* R128 Pro and Pro2 can have DFP, we will deal with it. No support for dual-head/xinerama yet. - M3 can also have DFP, no support for now */ + M3 can also have DFP, no support for now */ case PCI_CHIP_RAGE128TF: case PCI_CHIP_RAGE128TL: - case PCI_CHIP_RAGE128TR: info->isPro2 = TRUE; + case PCI_CHIP_RAGE128TR: + /* FIXME: RAGE128 TS/TT/TU are assumed to be PRO2 as all 6 chips came + * out at the same time, so are of the same family likely. + * This requires confirmation however to be fully correct. + * Mike A. Harris <mharris@redhat.com> + */ + case PCI_CHIP_RAGE128TS: + case PCI_CHIP_RAGE128TT: + case PCI_CHIP_RAGE128TU: info->isPro2 = TRUE; + /* FIXME: RAGE128 P[ABCEGHIJKLMNOQSTUVWX] are assumed to have DFP + * capability, as the comment at the top suggests. + * This requires confirmation however to be fully correct. + * Mike A. Harris <mharris@redhat.com> + */ + case PCI_CHIP_RAGE128PA: + case PCI_CHIP_RAGE128PB: + case PCI_CHIP_RAGE128PC: + case PCI_CHIP_RAGE128PE: + case PCI_CHIP_RAGE128PG: + case PCI_CHIP_RAGE128PH: + case PCI_CHIP_RAGE128PI: + case PCI_CHIP_RAGE128PJ: + case PCI_CHIP_RAGE128PK: + case PCI_CHIP_RAGE128PL: + case PCI_CHIP_RAGE128PM: + case PCI_CHIP_RAGE128PN: + case PCI_CHIP_RAGE128PO: + case PCI_CHIP_RAGE128PQ: + case PCI_CHIP_RAGE128PS: + case PCI_CHIP_RAGE128PT: + case PCI_CHIP_RAGE128PU: + case PCI_CHIP_RAGE128PV: + case PCI_CHIP_RAGE128PW: + case PCI_CHIP_RAGE128PX: + case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128PF: case PCI_CHIP_RAGE128PP: @@ -916,6 +982,18 @@ case PCI_CHIP_RAGE128RK: case PCI_CHIP_RAGE128RL: case PCI_CHIP_RAGE128SM: + /* FIXME: RAGE128 S[EFGHKLN] are assumed to be like the SM above as + * all of them are listed as "Rage 128 4x" in ATI docs. + * This requires confirmation however to be fully correct. + * Mike A. Harris <mharris@redhat.com> + */ + case PCI_CHIP_RAGE128SE: + case PCI_CHIP_RAGE128SF: + case PCI_CHIP_RAGE128SG: + case PCI_CHIP_RAGE128SH: + case PCI_CHIP_RAGE128SK: + case PCI_CHIP_RAGE128SL: + case PCI_CHIP_RAGE128SN: default: info->HasPanelRegs = FALSE; break; } } @@ -1007,7 +1085,6 @@ "VideoRAM: %d kByte (%s)\n", pScrn->videoRam, info->ram->name); /* Flat panel (part 2) */ - if (info->HasPanelRegs) { switch (info->BIOSDisplay) { case R128_BIOS_DISPLAY_FP: xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, @@ -1024,6 +1101,7 @@ break; } + if (info->HasPanelRegs) { /* Panel width/height overrides */ info->PanelXRes = 0; info->PanelYRes = 0; @@ -1040,6 +1118,13 @@ } #ifdef XF86DRI + /* DMA for Xv */ + info->DMAForXv = xf86ReturnOptValBool(info->Options, OPTION_XV_DMA, FALSE); + if (info->DMAForXv) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Will try to use DMA for Xv image transfers\n"); + } + /* AGP/PCI */ if (xf86ReturnOptValBool(info->Options, OPTION_IS_PCI, FALSE)) { info->IsPCI = TRUE; @@ -1049,20 +1134,53 @@ case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128RE: case PCI_CHIP_RAGE128RK: - case PCI_CHIP_RAGE128PP: + case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128PR: - case PCI_CHIP_RAGE128PD: info->IsPCI = TRUE; break; + case PCI_CHIP_RAGE128PP: info->IsPCI = TRUE; break; case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: case PCI_CHIP_RAGE128ML: + case PCI_CHIP_RAGE128PF: case PCI_CHIP_RAGE128RF: case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RL: case PCI_CHIP_RAGE128SM: - case PCI_CHIP_RAGE128PF: case PCI_CHIP_RAGE128TF: case PCI_CHIP_RAGE128TL: case PCI_CHIP_RAGE128TR: + /* FIXME: Rage 128 S[EFGHKLN], T[STU], P[ABCEGHIJKLMNOQSTUVWX] are + * believed to be AGP, but need confirmation. <mharris@redhat.com> + */ + case PCI_CHIP_RAGE128PA: + case PCI_CHIP_RAGE128PB: + case PCI_CHIP_RAGE128PC: + case PCI_CHIP_RAGE128PE: + case PCI_CHIP_RAGE128PG: + case PCI_CHIP_RAGE128PH: + case PCI_CHIP_RAGE128PI: + case PCI_CHIP_RAGE128PJ: + case PCI_CHIP_RAGE128PK: + case PCI_CHIP_RAGE128PL: + case PCI_CHIP_RAGE128PM: + case PCI_CHIP_RAGE128PN: + case PCI_CHIP_RAGE128PO: + case PCI_CHIP_RAGE128PQ: + case PCI_CHIP_RAGE128PS: + case PCI_CHIP_RAGE128PT: + case PCI_CHIP_RAGE128PU: + case PCI_CHIP_RAGE128PV: + case PCI_CHIP_RAGE128PW: + case PCI_CHIP_RAGE128PX: + case PCI_CHIP_RAGE128TS: + case PCI_CHIP_RAGE128TT: + case PCI_CHIP_RAGE128TU: + case PCI_CHIP_RAGE128SE: + case PCI_CHIP_RAGE128SF: + case PCI_CHIP_RAGE128SG: + case PCI_CHIP_RAGE128SH: + case PCI_CHIP_RAGE128SK: + case PCI_CHIP_RAGE128SL: + case PCI_CHIP_RAGE128SN: default: info->IsPCI = FALSE; break; } } @@ -1471,9 +1589,11 @@ if(info->isDFP) { R128MapMem(pScrn); + info->BIOSDisplay = R128_BIOS_DISPLAY_FP; /* validate if DFP really connected. */ if(!R128GetDFPInfo(pScrn)) { info->isDFP = FALSE; + info->BIOSDisplay = R128_BIOS_DISPLAY_CRT; } else if(!info->isPro2) { /* RageProII doesn't support rmx, we can't use native-mode stretching for other non-native modes. It will rely on @@ -1487,7 +1607,6 @@ } } - info->BIOSDisplay = R128_BIOS_DISPLAY_FP; R128UnmapMem(pScrn); } @@ -1749,29 +1868,6 @@ R128TRACE(("R128PreInit\n")); - /* - * Tell the loader about symbols from other modules that this module might - * refer to. - */ - xf86LoaderRefSymLists(vgahwSymbols, -#ifdef USE_FB - fbSymbols, -#else - cfbSymbols, -#endif - xaaSymbols, - ramdacSymbols, -#ifdef XF86DRI - drmSymbols, - driSymbols, -#endif - fbdevHWSymbols, - vbeSymbols, - /* ddcsymbols, */ - i2cSymbols, - /* shadowSymbols, */ - NULL); - if (pScrn->numEntities != 1) return FALSE; if (!R128GetRec(pScrn)) return FALSE; @@ -1805,8 +1901,9 @@ info->PciInfo->func); if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail; + if (xf86SetOperatingState(resVga, info->pEnt->index, ResUnusedOpr)) goto fail; - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR; + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR; pScrn->monitor = pScrn->confScreen->monitor; if (!R128PreInitVisual(pScrn)) goto fail; @@ -1990,6 +2087,7 @@ #ifdef XF86DRI /* Turn off the CCE for now. */ info->CCEInUse = FALSE; + info->indirectBuffer = NULL; #endif if (!R128MapMem(pScrn)) return FALSE; @@ -2333,12 +2431,6 @@ } } } - /* Backing store setup */ - miInitializeBackingStore(pScreen); - xf86SetBackingStore(pScreen); - - /* Set Silken Mouse */ - xf86SetSilkenMouse(pScreen); /* Acceleration setup */ if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { @@ -2359,6 +2451,13 @@ /* DGA setup */ R128DGAInit(pScreen); + /* Backing store setup */ + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + + /* Set Silken Mouse */ + xf86SetSilkenMouse(pScreen); + /* Cursor setup */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -2382,6 +2481,7 @@ xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); } } else { + info->cursor_start = 0; xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); } @@ -2397,11 +2497,17 @@ #endif )) return FALSE; - /* DPMS setup - FIXME: also for mirror mode? - Michel */ - if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) - xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0); + /* DPMS setup - FIXME: also for mirror mode in non-fbdev case? - Michel */ + if (info->FBDev) + xf86DPMSInit(pScreen, fbdevHWDPMSSet, 0); + else { + if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) + xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0); + else if (info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_FP) + xf86DPMSInit(pScreen, R128DisplayPowerManagementSetLCD, 0); + } - R128InitVideo(pScreen); + R128InitVideo(pScreen); /* Provide SaveScreen */ pScreen->SaveScreen = R128SaveScreen; @@ -3214,6 +3320,7 @@ pScrn->depth, pScrn->bitsPerPixel); if (mode->Flags & V_DBLSCAN) ErrorF(" D"); + if (mode->Flags & V_CSYNC) ErrorF(" C"); if (mode->Flags & V_INTERLACE) ErrorF(" I"); if (mode->Flags & V_PHSYNC) ErrorF(" +H"); if (mode->Flags & V_NHSYNC) ErrorF(" -H"); @@ -3236,6 +3343,7 @@ pScrn->depth, pScrn->bitsPerPixel); if (mode->Flags & V_DBLSCAN) ErrorF(" D"); + if (mode->Flags & V_CSYNC) ErrorF(" C"); if (mode->Flags & V_INTERLACE) ErrorF(" I"); if (mode->Flags & V_PHSYNC) ErrorF(" +H"); if (mode->Flags & V_NHSYNC) ErrorF(" -H"); @@ -3415,6 +3523,11 @@ #ifdef XF86DRI if (info->directRenderingEnabled) { + if (info->irq) { + /* Need to make sure interrupts are enabled */ + unsigned char *R128MMIO = info->MMIO; + OUTREG(R128_GEN_INT_CNTL, info->gen_int_cntl); + } R128CCE_START(pScrn, info); DRIUnlock(pScrn->pScreen); } @@ -3436,7 +3549,7 @@ R128TRACE(("R128LeaveVT\n")); #ifdef XF86DRI - if (R128PTR(pScrn)->directRenderingEnabled) { + if (info->directRenderingEnabled) { DRILock(pScrn->pScreen, 0); R128CCE_STOP(pScrn, info); } @@ -3539,3 +3652,73 @@ break; } } + +static int r128_set_backlight_enable(ScrnInfoPtr pScrn, int on); + +static void R128DisplayPowerManagementSetLCD(ScrnInfoPtr pScrn, + int PowerManagementMode, int flags) +{ + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + int mask = R128_LVDS_DISPLAY_DIS; + + switch (PowerManagementMode) { + case DPMSModeOn: + /* Screen: On; HSync: On, VSync: On */ + OUTREGP(R128_LVDS_GEN_CNTL, 0, ~mask); + r128_set_backlight_enable(pScrn, 1); + break; + case DPMSModeStandby: + /* Fall through */ + case DPMSModeSuspend: + /* Fall through */ + break; + case DPMSModeOff: + /* Screen: Off; HSync: Off, VSync: Off */ + OUTREGP(R128_LVDS_GEN_CNTL, mask, ~mask); + r128_set_backlight_enable(pScrn, 0); + break; + } +} + +static int r128_set_backlight_enable(ScrnInfoPtr pScrn, int on) +{ + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + unsigned int lvds_gen_cntl = INREG(R128_LVDS_GEN_CNTL); + + lvds_gen_cntl |= (/*R128_LVDS_BL_MOD_EN |*/ R128_LVDS_BLON); + if (on) { + lvds_gen_cntl |= R128_LVDS_DIGON; + if (!lvds_gen_cntl & R128_LVDS_ON) { + lvds_gen_cntl &= ~R128_LVDS_BLON; + OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); + (void)INREG(R128_LVDS_GEN_CNTL); + usleep(10000); + lvds_gen_cntl |= R128_LVDS_BLON; + OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); + } +#if 0 + lvds_gen_cntl &= ~R128_LVDS_BL_MOD_LEVEL_MASK; + lvds_gen_cntl |= (0xFF /* backlight_conv[level] */ << + R128_LVDS_BL_MOD_LEVEL_SHIFT); +#endif + lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_EN); + lvds_gen_cntl &= ~R128_LVDS_DISPLAY_DIS; + } else { +#if 0 + lvds_gen_cntl &= ~R128_LVDS_BL_MOD_LEVEL_MASK; + lvds_gen_cntl |= (0xFF /* backlight_conv[0] */ << + R128_LVDS_BL_MOD_LEVEL_SHIFT); +#endif + lvds_gen_cntl |= R128_LVDS_DISPLAY_DIS; + OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); + usleep(10); + lvds_gen_cntl &= ~(R128_LVDS_ON | R128_LVDS_EN | R128_LVDS_BLON + | R128_LVDS_DIGON); + } + + OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); + + return 0; + } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c,v 1.5 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -25,6 +25,7 @@ #include "ativersion.h" +#include "r128_probe.h" #include "r128_version.h" #include "xf86.h" @@ -66,6 +67,8 @@ /* Ensure main driver module is loaded, but not as a submodule */ if (!xf86ServerIsOnlyDetecting() && !LoaderSymbol(ATI_NAME)) xf86LoadOneModule(ATI_DRIVER_NAME, Options); + + R128LoaderRefSymLists(); Inited = TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.16 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.16 Mon Nov 5 18:37:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c Sun Feb 9 10:33:17 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.16 2001/11/05 23:37:50 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.18 2003/02/09 15:33:17 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -75,44 +75,108 @@ #endif SymTabRec R128Chipsets[] = { - { PCI_CHIP_RAGE128RE, "ATI Rage 128 RE (PCI)" }, - { PCI_CHIP_RAGE128RF, "ATI Rage 128 RF (AGP)" }, + /* FIXME: The chipsets with (PCI/AGP) are not known wether they are AGP or + * PCI, so I've labeled them as such in hopes users will submit + * data if we're unable to gather it from official documentation + */ + { PCI_CHIP_RAGE128LE, "ATI Rage 128 Mobility M3 LE (PCI)" }, + { PCI_CHIP_RAGE128LF, "ATI Rage 128 Mobility M3 LF (AGP)" }, + { PCI_CHIP_RAGE128MF, "ATI Rage 128 Mobility M4 MF (AGP)" }, + { PCI_CHIP_RAGE128ML, "ATI Rage 128 Mobility M4 ML (AGP)" }, + { PCI_CHIP_RAGE128PA, "ATI Rage 128 Pro GL PA (PCI/AGP)" }, + { PCI_CHIP_RAGE128PB, "ATI Rage 128 Pro GL PB (PCI/AGP)" }, + { PCI_CHIP_RAGE128PC, "ATI Rage 128 Pro GL PC (PCI/AGP)" }, + { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro GL PD (PCI)" }, + { PCI_CHIP_RAGE128PE, "ATI Rage 128 Pro GL PE (PCI/AGP)" }, + { PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro GL PF (AGP)" }, + { PCI_CHIP_RAGE128PG, "ATI Rage 128 Pro VR PG (PCI/AGP)" }, + { PCI_CHIP_RAGE128PH, "ATI Rage 128 Pro VR PH (PCI/AGP)" }, + { PCI_CHIP_RAGE128PI, "ATI Rage 128 Pro VR PI (PCI/AGP)" }, + { PCI_CHIP_RAGE128PJ, "ATI Rage 128 Pro VR PJ (PCI/AGP)" }, + { PCI_CHIP_RAGE128PK, "ATI Rage 128 Pro VR PK (PCI/AGP)" }, + { PCI_CHIP_RAGE128PL, "ATI Rage 128 Pro VR PL (PCI/AGP)" }, + { PCI_CHIP_RAGE128PM, "ATI Rage 128 Pro VR PM (PCI/AGP)" }, + { PCI_CHIP_RAGE128PN, "ATI Rage 128 Pro VR PN (PCI/AGP)" }, + { PCI_CHIP_RAGE128PO, "ATI Rage 128 Pro VR PO (PCI/AGP)" }, + { PCI_CHIP_RAGE128PP, "ATI Rage 128 Pro VR PP (PCI)" }, + { PCI_CHIP_RAGE128PQ, "ATI Rage 128 Pro VR PQ (PCI/AGP)" }, + { PCI_CHIP_RAGE128PR, "ATI Rage 128 Pro VR PR (PCI)" }, + { PCI_CHIP_RAGE128PS, "ATI Rage 128 Pro VR PS (PCI/AGP)" }, + { PCI_CHIP_RAGE128PT, "ATI Rage 128 Pro VR PT (PCI/AGP)" }, + { PCI_CHIP_RAGE128PU, "ATI Rage 128 Pro VR PU (PCI/AGP)" }, + { PCI_CHIP_RAGE128PV, "ATI Rage 128 Pro VR PV (PCI/AGP)" }, + { PCI_CHIP_RAGE128PW, "ATI Rage 128 Pro VR PW (PCI/AGP)" }, + { PCI_CHIP_RAGE128PX, "ATI Rage 128 Pro VR PX (PCI/AGP)" }, + { PCI_CHIP_RAGE128RE, "ATI Rage 128 GL RE (PCI)" }, + { PCI_CHIP_RAGE128RF, "ATI Rage 128 GL RF (AGP)" }, { PCI_CHIP_RAGE128RG, "ATI Rage 128 RG (AGP)" }, - { PCI_CHIP_RAGE128RK, "ATI Rage 128 RK (PCI)" }, - { PCI_CHIP_RAGE128RL, "ATI Rage 128 RL (AGP)" }, - { PCI_CHIP_RAGE128SM, "ATI Rage 128 SM (AGP)" }, - { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro PD (PCI)" }, - { PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro PF (AGP)" }, - { PCI_CHIP_RAGE128PP, "ATI Rage 128 Pro PP (PCI)" }, - { PCI_CHIP_RAGE128PR, "ATI Rage 128 Pro PR (PCI)" }, + { PCI_CHIP_RAGE128RK, "ATI Rage 128 VR RK (PCI)" }, + { PCI_CHIP_RAGE128RL, "ATI Rage 128 VR RL (AGP)" }, + { PCI_CHIP_RAGE128SE, "ATI Rage 128 4X SE (PCI/AGP)" }, + { PCI_CHIP_RAGE128SF, "ATI Rage 128 4X SF (PCI/AGP)" }, + { PCI_CHIP_RAGE128SG, "ATI Rage 128 4X SG (PCI/AGP)" }, + { PCI_CHIP_RAGE128SH, "ATI Rage 128 4X SH (PCI/AGP)" }, + { PCI_CHIP_RAGE128SK, "ATI Rage 128 4X SK (PCI/AGP)" }, + { PCI_CHIP_RAGE128SL, "ATI Rage 128 4X SL (PCI/AGP)" }, + { PCI_CHIP_RAGE128SM, "ATI Rage 128 4X SM (AGP)" }, + { PCI_CHIP_RAGE128SN, "ATI Rage 128 4X SN (PCI/AGP)" }, { PCI_CHIP_RAGE128TF, "ATI Rage 128 Pro ULTRA TF (AGP)" }, { PCI_CHIP_RAGE128TL, "ATI Rage 128 Pro ULTRA TL (AGP)" }, { PCI_CHIP_RAGE128TR, "ATI Rage 128 Pro ULTRA TR (AGP)" }, - { PCI_CHIP_RAGE128LE, "ATI Rage 128 Mobility LE (PCI)" }, - { PCI_CHIP_RAGE128LF, "ATI Rage 128 Mobility LF (AGP)" }, - { PCI_CHIP_RAGE128MF, "ATI Rage 128 Mobility MF (AGP)" }, - { PCI_CHIP_RAGE128ML, "ATI Rage 128 Mobility ML (AGP)" }, + { PCI_CHIP_RAGE128TS, "ATI Rage 128 Pro ULTRA TS (AGP?)" }, + { PCI_CHIP_RAGE128TT, "ATI Rage 128 Pro ULTRA TT (AGP?)" }, + { PCI_CHIP_RAGE128TU, "ATI Rage 128 Pro ULTRA TU (AGP?)" }, { -1, NULL } }; PciChipsets R128PciChipsets[] = { + { PCI_CHIP_RAGE128LE, PCI_CHIP_RAGE128LE, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128LF, PCI_CHIP_RAGE128LF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128MF, PCI_CHIP_RAGE128MF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128ML, PCI_CHIP_RAGE128ML, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PA, PCI_CHIP_RAGE128PA, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PB, PCI_CHIP_RAGE128PB, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PC, PCI_CHIP_RAGE128PC, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PD, PCI_CHIP_RAGE128PD, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PE, PCI_CHIP_RAGE128PE, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PF, PCI_CHIP_RAGE128PF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PG, PCI_CHIP_RAGE128PG, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PH, PCI_CHIP_RAGE128PH, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PI, PCI_CHIP_RAGE128PI, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PJ, PCI_CHIP_RAGE128PJ, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PK, PCI_CHIP_RAGE128PK, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PL, PCI_CHIP_RAGE128PL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PM, PCI_CHIP_RAGE128PM, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PN, PCI_CHIP_RAGE128PN, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PO, PCI_CHIP_RAGE128PO, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PP, PCI_CHIP_RAGE128PP, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PQ, PCI_CHIP_RAGE128PQ, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PR, PCI_CHIP_RAGE128PR, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PS, PCI_CHIP_RAGE128PS, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PT, PCI_CHIP_RAGE128PT, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PU, PCI_CHIP_RAGE128PU, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PV, PCI_CHIP_RAGE128PV, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PW, PCI_CHIP_RAGE128PW, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PX, PCI_CHIP_RAGE128PX, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RE, PCI_CHIP_RAGE128RE, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RF, PCI_CHIP_RAGE128RF, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RG, PCI_CHIP_RAGE128RG, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RK, PCI_CHIP_RAGE128RK, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RL, PCI_CHIP_RAGE128RL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SE, PCI_CHIP_RAGE128SE, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SF, PCI_CHIP_RAGE128SF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SG, PCI_CHIP_RAGE128SG, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SH, PCI_CHIP_RAGE128SH, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SK, PCI_CHIP_RAGE128SK, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SL, PCI_CHIP_RAGE128SL, RES_SHARED_VGA }, { PCI_CHIP_RAGE128SM, PCI_CHIP_RAGE128SM, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128PD, PCI_CHIP_RAGE128PD, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128PF, PCI_CHIP_RAGE128PF, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128PP, PCI_CHIP_RAGE128PP, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128PR, PCI_CHIP_RAGE128PR, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SN, PCI_CHIP_RAGE128SN, RES_SHARED_VGA }, { PCI_CHIP_RAGE128TF, PCI_CHIP_RAGE128TF, RES_SHARED_VGA }, { PCI_CHIP_RAGE128TL, PCI_CHIP_RAGE128TL, RES_SHARED_VGA }, { PCI_CHIP_RAGE128TR, PCI_CHIP_RAGE128TR, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128LE, PCI_CHIP_RAGE128LE, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128LF, PCI_CHIP_RAGE128LF, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128MF, PCI_CHIP_RAGE128MF, RES_SHARED_VGA }, - { PCI_CHIP_RAGE128ML, PCI_CHIP_RAGE128ML, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TS, PCI_CHIP_RAGE128TS, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TT, PCI_CHIP_RAGE128TT, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TU, PCI_CHIP_RAGE128TU, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h:1.5 Mon May 7 17:59:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h Sat Apr 6 14:06:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h,v 1.6 2002/04/06 19:06:06 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -53,6 +53,8 @@ extern PciChipsets R128PciChipsets[]; /* r128_driver.c */ +extern void R128LoaderRefSymLists + FunctionPrototype((void)); extern Bool R128PreInit FunctionPrototype((ScrnInfoPtr, int)); extern Bool R128ScreenInit Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.13 Tue Oct 2 07:44:16 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h Mon Dec 16 11:19:11 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.13 2001/10/02 11:44:16 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.15 2002/12/16 16:19:11 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -48,7 +48,9 @@ #ifndef _R128_REG_H_ #define _R128_REG_H_ +#ifdef XFree86Module #include "xf86_ansic.h" +#endif #include "compiler.h" /* Memory mapped register access macros */ @@ -684,6 +686,9 @@ #define R128_LEAD_BRES_LNTH_SUB 0x1624 #define R128_LVDS_GEN_CNTL 0x02d0 # define R128_LVDS_ON (1 << 0) +# define R128_LVDS_DISPLAY_DIS (1 << 1) +# define R128_LVDS_EN (1 << 7) +# define R128_LVDS_DIGON (1 << 18) # define R128_LVDS_BLON (1 << 19) # define R128_LVDS_SEL_CRTC2 (1 << 23) # define R128_HSYNC_DELAY_SHIFT 28 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h:1.6 Sun Jan 7 20:07:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h Sat Feb 16 16:26:35 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.6 2001/01/08 01:07:35 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.7 2002/02/16 21:26:35 herrb Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -164,10 +164,12 @@ unsigned int vertsize; unsigned int vc_format; +#ifdef XF86DRI /* The current cliprects, or a subset thereof. */ XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS]; unsigned int nbox; +#endif /* Counters for throttling of rendering clients. */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.6 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,18 +24,37 @@ #ifndef _R128_VERSION_H_ #define _R128_VERSION_H_ 1 +#undef R128_NAME +#undef R128_DRIVER_NAME +#undef R128_VERSION_MAJOR +#undef R128_VERSION_MINOR +#undef R128_VERSION_PATCH +#undef R128_VERSION_CURRENT +#undef R128_VERSION_EVALUATE +#undef R128_VERSION_STRINGIFY +#undef R128_VERSION_NAME + #define R128_NAME "R128" #define R128_DRIVER_NAME "r128" -#define R128_VERSION_NAME "4.0.1" - #define R128_VERSION_MAJOR 4 #define R128_VERSION_MINOR 0 #define R128_VERSION_PATCH 1 +#ifndef R128_VERSION_EXTRA +#define R128_VERSION_EXTRA "" +#endif + #define R128_VERSION_CURRENT \ ((R128_VERSION_MAJOR << 20) | \ (R128_VERSION_MINOR << 10) | \ (R128_VERSION_PATCH)) + +#define R128_VERSION_EVALUATE(__x) #__x +#define R128_VERSION_STRINGIFY(_x) R128_VERSION_EVALUATE(_x) +#define R128_VERSION_NAME \ + R128_VERSION_STRINGIFY(R128_VERSION_MAJOR) "." \ + R128_VERSION_STRINGIFY(R128_VERSION_MINOR) "." \ + R128_VERSION_STRINGIFY(R128_VERSION_MINOR) R128_VERSION_EXTRA #endif /* _R128_VERSION_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.20 Tue Oct 2 07:44:16 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c Tue Feb 18 20:19:41 2003 @@ -1,10 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.20 2001/10/02 11:44:16 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.26 2003/02/19 01:19:41 dawes Exp $ */ #include "r128.h" #include "r128_reg.h" #ifdef XF86DRI -#include "xf86drmR128.h" +#include "r128_common.h" #include "r128_sarea.h" #endif @@ -377,6 +377,8 @@ if(cleanup) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { OUTREG(R128_OV0_SCALE_CNTL, 0); + if (info->cursor_start) + xf86ForceHWCursor (pScrn->pScreen, FALSE); } if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); @@ -509,9 +511,10 @@ int err=-1, i, idx, offset, hpass, passes, srcpassbytes, dstpassbytes; int sizes[MAXPASSES], list[MAXPASSES]; drmDMAReq req; + drmR128Blit blit; /* Verify conditions and bail out as early as possible */ - if (!info->directRenderingEnabled) + if (!info->directRenderingEnabled || !info->DMAForXv) return FALSE; if ((hpass = min(h,(BUFSIZE/w))) == 0) @@ -567,8 +570,17 @@ } } - if ((err = drmR128TextureBlit(info->drmFD, idx, offset, dstPitch, - (R128_DATATYPE_CI8 >> 16), (offset % 32), 0, w, hpass)) < 0) + blit.idx = idx; + blit.offset = offset; + blit.pitch = dstPitch; + blit.format = (R128_DATATYPE_CI8 >> 16); + blit.x = (offset % 32); + blit.y = 0; + blit.width = w; + blit.height = hpass; + + if ((err = drmCommandWrite(info->drmFD, DRM_R128_BLIT, + &blit, sizeof(drmR128Blit))) < 0) break; } @@ -875,6 +887,14 @@ int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned char *R128MMIO = info->MMIO; + CARD32 config_cntl = INREG(R128_CONFIG_CNTL); + + /* We need to disable byte swapping, or the data gets mangled */ + OUTREG(R128_CONFIG_CNTL, config_cntl & + ~(APER_0_BIG_ENDIAN_16BPP_SWAP | APER_0_BIG_ENDIAN_32BPP_SWAP)); +#endif /* * s1offset, s2offset, s3offset - byte offsets to the Y, U and V planes @@ -983,24 +1003,9 @@ } nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; - { -#if X_BYTE_ORDER == X_BIG_ENDIAN - unsigned char *R128MMIO = info->MMIO; - CARD32 config_cntl; - - /* We need to disable byte swapping, or the data gets mangled */ - config_cntl = INREG(R128_CONFIG_CNTL); - OUTREG(R128_CONFIG_CNTL, config_cntl & - ~(APER_0_BIG_ENDIAN_16BPP_SWAP|APER_0_BIG_ENDIAN_32BPP_SWAP)); -#endif - R128CopyData420(info, buf + s1offset, buf + s2offset, buf + s3offset, - info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, - srcPitch, srcPitch2, dstPitch, nlines, npixels); -#if X_BYTE_ORDER == X_BIG_ENDIAN - /* restore byte swapping */ - OUTREG(R128_CONFIG_CNTL, config_cntl); -#endif - } + R128CopyData420(info, buf + s1offset, buf + s2offset, buf + s3offset, + info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, + srcPitch, srcPitch2, dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: @@ -1019,6 +1024,10 @@ break; } +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* restore byte swapping */ + OUTREG(R128_CONFIG_CNTL, config_cntl); +#endif /* update cliplist */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { @@ -1046,6 +1055,8 @@ break; } + if (info->cursor_start && !(pPriv->videoStatus & CLIENT_VIDEO_ON)) + xf86ForceHWCursor (pScrn->pScreen, TRUE); pPriv->videoStatus = CLIENT_VIDEO_ON; info->VideoTimerCallback = R128VideoTimerCallback; @@ -1107,6 +1118,8 @@ if(pPriv->offTime < now) { unsigned char *R128MMIO = info->MMIO; OUTREG(R128_OV0_SCALE_CNTL, 0); + if (info->cursor_start && pPriv->videoStatus & CLIENT_VIDEO_ON) + xf86ForceHWCursor (pScrn->pScreen, FALSE); pPriv->videoStatus = FREE_TIMER; pPriv->freeTime = now + FREE_DELAY; } @@ -1116,6 +1129,8 @@ xf86FreeOffscreenLinear(pPriv->linear); pPriv->linear = NULL; } + if (info->cursor_start && pPriv->videoStatus & CLIENT_VIDEO_ON) + xf86ForceHWCursor (pScrn->pScreen, FALSE); pPriv->videoStatus = 0; info->VideoTimerCallback = NULL; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.24 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.37 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.24 Wed Nov 14 11:50:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h Sun Feb 23 18:28:48 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.24 2001/11/14 16:50:44 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.37 2003/02/23 23:28:48 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,9 +29,9 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> - * Alan Hourihane <ahourihane@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * */ @@ -66,18 +66,23 @@ #include "picturestr.h" #endif -#define RADEON_DEBUG 0 /* Turn off debugging output */ -#define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */ -#define RADEON_MMIOSIZE 0x80000 +#define RADEON_DEBUG 0 /* Turn off debugging output */ +#define RADEON_IDLE_RETRY 16 /* Fall out of idle loops after this count */ +#define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */ +#define RADEON_MMIOSIZE 0x80000 #define RADEON_VBIOS_SIZE 0x00010000 +#define RADEON_USE_RMX 0x80000000 /* mode flag for using RMX + * Need to comfirm this is not used + * for something else. + */ #if RADEON_DEBUG -#define RADEONTRACE(x) \ - do { \ - ErrorF("(**) %s(%d): ", RADEON_NAME, pScrn->scrnIndex); \ - ErrorF x; \ - } while (0); +#define RADEONTRACE(x) \ +do { \ + ErrorF("(**) %s(%d): ", RADEON_NAME, pScrn->scrnIndex); \ + ErrorF x; \ +} while (0); #else #define RADEONTRACE(x) #endif @@ -86,193 +91,218 @@ /* Other macros */ #define RADEON_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define RADEON_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1)) -#define RADEONPTR(pScrn) ((RADEONInfoPtr)(pScrn)->driverPrivate) +#define RADEONPTR(pScrn) ((RADEONInfoPtr)(pScrn)->driverPrivate) -typedef struct { /* All values in XCLKS */ - int ML; /* Memory Read Latency */ - int MB; /* Memory Burst Length */ - int Trcd; /* RAS to CAS delay */ - int Trp; /* RAS percentage */ - int Twr; /* Write Recovery */ - int CL; /* CAS Latency */ - int Tr2w; /* Read to Write Delay */ - int Rloop; /* Loop Latency */ - int Rloop_fudge; /* Add to ML to get Rloop */ - char *name; +typedef struct { + /* All values in XCLKS */ + int ML; /* Memory Read Latency */ + int MB; /* Memory Burst Length */ + int Trcd; /* RAS to CAS delay */ + int Trp; /* RAS percentage */ + int Twr; /* Write Recovery */ + int CL; /* CAS Latency */ + int Tr2w; /* Read to Write Delay */ + int Rloop; /* Loop Latency */ + int Rloop_fudge; /* Add to ML to get Rloop */ + char *name; } RADEONRAMRec, *RADEONRAMPtr; typedef struct { /* Common registers */ - CARD32 ovr_clr; - CARD32 ovr_wid_left_right; - CARD32 ovr_wid_top_bottom; - CARD32 ov0_scale_cntl; - CARD32 mpp_tb_config; - CARD32 mpp_gp_config; - CARD32 subpic_cntl; - CARD32 viph_control; - CARD32 i2c_cntl_1; - CARD32 gen_int_cntl; - CARD32 cap0_trig_cntl; - CARD32 cap1_trig_cntl; - CARD32 bus_cntl; - CARD32 surface_cntl; + CARD32 ovr_clr; + CARD32 ovr_wid_left_right; + CARD32 ovr_wid_top_bottom; + CARD32 ov0_scale_cntl; + CARD32 mpp_tb_config; + CARD32 mpp_gp_config; + CARD32 subpic_cntl; + CARD32 viph_control; + CARD32 i2c_cntl_1; + CARD32 gen_int_cntl; + CARD32 cap0_trig_cntl; + CARD32 cap1_trig_cntl; + CARD32 bus_cntl; + CARD32 surface_cntl; /* Other registers to save for VT switches */ - CARD32 dp_datatype; - CARD32 rbbm_soft_reset; - CARD32 clock_cntl_index; - CARD32 amcgpio_en_reg; - CARD32 amcgpio_mask; + CARD32 dp_datatype; + CARD32 rbbm_soft_reset; + CARD32 clock_cntl_index; + CARD32 amcgpio_en_reg; + CARD32 amcgpio_mask; /* CRTC registers */ - CARD32 crtc_gen_cntl; - CARD32 crtc_ext_cntl; - CARD32 dac_cntl; - CARD32 crtc_h_total_disp; - CARD32 crtc_h_sync_strt_wid; - CARD32 crtc_v_total_disp; - CARD32 crtc_v_sync_strt_wid; - CARD32 crtc_offset; - CARD32 crtc_offset_cntl; - CARD32 crtc_pitch; + CARD32 crtc_gen_cntl; + CARD32 crtc_ext_cntl; + CARD32 dac_cntl; + CARD32 crtc_h_total_disp; + CARD32 crtc_h_sync_strt_wid; + CARD32 crtc_v_total_disp; + CARD32 crtc_v_sync_strt_wid; + CARD32 crtc_offset; + CARD32 crtc_offset_cntl; + CARD32 crtc_pitch; /* CRTC2 registers */ - CARD32 crtc2_gen_cntl; + CARD32 crtc2_gen_cntl; - CARD32 dac2_cntl; - CARD32 disp_output_cntl; - CARD32 crtc2_h_total_disp; - CARD32 crtc2_h_sync_strt_wid; - CARD32 crtc2_v_total_disp; - CARD32 crtc2_v_sync_strt_wid; - CARD32 crtc2_offset; - CARD32 crtc2_offset_cntl; - CARD32 crtc2_pitch; + CARD32 dac2_cntl; + CARD32 disp_output_cntl; + CARD32 disp_hw_debug; + CARD32 crtc2_h_total_disp; + CARD32 crtc2_h_sync_strt_wid; + CARD32 crtc2_v_total_disp; + CARD32 crtc2_v_sync_strt_wid; + CARD32 crtc2_offset; + CARD32 crtc2_offset_cntl; + CARD32 crtc2_pitch; /* Flat panel registers */ - CARD32 fp_crtc_h_total_disp; - CARD32 fp_crtc_v_total_disp; - CARD32 fp_gen_cntl; - CARD32 fp_h_sync_strt_wid; - CARD32 fp_horz_stretch; - CARD32 fp_panel_cntl; - CARD32 fp_v_sync_strt_wid; - CARD32 fp_vert_stretch; - CARD32 lvds_gen_cntl; - CARD32 lvds_pll_cntl; - CARD32 tmds_crc; + CARD32 fp_crtc_h_total_disp; + CARD32 fp_crtc_v_total_disp; + CARD32 fp_gen_cntl; + CARD32 fp2_gen_cntl; + CARD32 fp_h_sync_strt_wid; + CARD32 fp2_h_sync_strt_wid; + CARD32 fp_horz_stretch; + CARD32 fp_panel_cntl; + CARD32 fp_v_sync_strt_wid; + CARD32 fp2_v_sync_strt_wid; + CARD32 fp_vert_stretch; + CARD32 lvds_gen_cntl; + CARD32 lvds_pll_cntl; + CARD32 tmds_pll_cntl; /* Computed values for PLL */ - CARD32 dot_clock_freq; - CARD32 pll_output_freq; - int feedback_div; - int post_div; + CARD32 dot_clock_freq; + CARD32 pll_output_freq; + int feedback_div; + int post_div; /* PLL registers */ - CARD32 ppll_ref_div; - CARD32 ppll_div_3; - CARD32 htotal_cntl; + CARD32 ppll_ref_div; + CARD32 ppll_div_3; + CARD32 htotal_cntl; /* Computed values for PLL2 */ - CARD32 dot_clock_freq_2; - CARD32 pll_output_freq_2; - int feedback_div_2; - int post_div_2; + CARD32 dot_clock_freq_2; + CARD32 pll_output_freq_2; + int feedback_div_2; + int post_div_2; /* PLL2 registers */ - CARD32 p2pll_ref_div; - CARD32 p2pll_div_0; - CARD32 htotal_cntl2; - - /* DDA register */ - CARD32 dda_config; - CARD32 dda_on_off; + CARD32 p2pll_ref_div; + CARD32 p2pll_div_0; + CARD32 htotal_cntl2; /* Pallet */ - Bool palette_valid; - CARD32 palette[256]; - CARD32 palette2[256]; + Bool palette_valid; + CARD32 palette[256]; + CARD32 palette2[256]; } RADEONSaveRec, *RADEONSavePtr; typedef struct { - CARD16 reference_freq; - CARD16 reference_div; - CARD32 min_pll_freq; - CARD32 max_pll_freq; - CARD16 xclk; + CARD16 reference_freq; + CARD16 reference_div; + CARD32 min_pll_freq; + CARD32 max_pll_freq; + CARD16 xclk; } RADEONPLLRec, *RADEONPLLPtr; typedef struct { - int bitsPerPixel; - int depth; - int displayWidth; - int pixel_code; - int pixel_bytes; - DisplayModePtr mode; + int bitsPerPixel; + int depth; + int displayWidth; + int pixel_code; + int pixel_bytes; + DisplayModePtr mode; } RADEONFBLayout; -typedef enum -{ +typedef enum { MT_NONE, MT_CRT, MT_LCD, MT_DFP, MT_CTV, MT_STV -}RADEONMonitorType; +} RADEONMonitorType; -typedef enum -{ +typedef enum { DDC_NONE_DETECTED, DDC_MONID, DDC_DVI, DDC_VGA, DDC_CRT2 -}RADEONDDCType; +} RADEONDDCType; -typedef enum -{ +typedef enum { CONNECTOR_NONE, CONNECTOR_PROPRIETARY, CONNECTOR_CRT, CONNECTOR_DVI_I, CONNECTOR_DVI_D -}RADEONConnectorType; +} RADEONConnectorType; +typedef enum { + CHIP_FAMILY_UNKNOW, + CHIP_FAMILY_LEGACY, + CHIP_FAMILY_R128, + CHIP_FAMILY_M3, + CHIP_FAMILY_RADEON, + CHIP_FAMILY_VE, + CHIP_FAMILY_M6, + CHIP_FAMILY_RV200, + CHIP_FAMILY_M7, + CHIP_FAMILY_R200, + CHIP_FAMILY_RV250, + CHIP_FAMILY_M9, + CHIP_FAMILY_R300 +} RADEONChipFamily; + typedef struct { EntityInfoPtr pEnt; pciVideoPtr PciInfo; PCITAG PciTag; int Chipset; - Bool Primary; + RADEONChipFamily ChipFamily; Bool FBDev; - unsigned long LinearAddr; /* Frame buffer physical address */ - unsigned long MMIOAddr; /* MMIO region physical address */ - unsigned long BIOSAddr; /* BIOS physical address */ - - unsigned char *MMIO; /* Map of MMIO region */ - unsigned char *FB; /* Map of frame buffer */ - CARD8 *VBIOS; /* Video BIOS pointer */ + unsigned long LinearAddr; /* Frame buffer physical address */ + unsigned long MMIOAddr; /* MMIO region physical address */ + unsigned long BIOSAddr; /* BIOS physical address */ + + unsigned char *MMIO; /* Map of MMIO region */ + unsigned char *FB; /* Map of frame buffer */ + CARD8 *VBIOS; /* Video BIOS pointer */ CARD32 MemCntl; CARD32 BusCntl; - unsigned long FbMapSize; /* Size of frame buffer, in bytes */ - int Flags; /* Saved copy of mode flags */ + unsigned long FbMapSize; /* Size of frame buffer, in bytes */ + int Flags; /* Saved copy of mode flags */ - /****** Added for VE/M6 support *******************/ - RADEONMonitorType DisplayType; /* Monitor connected on*/ + /* VE/M6 support */ + RADEONMonitorType DisplayType; /* Monitor connected on */ RADEONDDCType DDCType; RADEONConnectorType ConnectorType; - BOOL HasCRTC2; /* VE/M6/M7 */ - BOOL IsR200; /* R200 chip */ - BOOL IsRV200; /* RV200 chip */ - BOOL IsSecondary; /* second Screen */ - BOOL UseCRT; /* force use CRT port as primary */ - BOOL IsM6; /* M6 card, for some workarounds */ - BOOL SwitchingMode; - int FPBIOSstart; /* Start of the flat panel info */ + Bool HasCRTC2; /* All cards except original Radeon */ + Bool IsSecondary; /* Second Screen */ + Bool IsSwitching; /* Flag for switching mode */ + Bool IsDell; /* Dell OEM VE card */ + int DellType; + Bool Clone; /* Force second head to clone primary*/ + RADEONMonitorType CloneType; + RADEONDDCType CloneDDCType; + DisplayModePtr CloneModes; + DisplayModePtr CurCloneMode; + int CloneFrameX0; + int CloneFrameY0; + Bool OverlayOnCRTC2; + Bool PanelOff; /* Force panel (LCD/DFP) off */ + int FPBIOSstart; /* Start of the flat panel info */ + Bool ddc_mode; /* Validate mode by matching exactly + * the modes supported in DDC data + */ + Bool R300CGWorkaround; /* EDID or BIOS values for FPs */ int PanelXRes; @@ -285,21 +315,19 @@ int VBlank; int PanelPwrDly; int DotClock; - /****************************************************/ - /*for getting EDID data using DDC interface*/ - BOOL ddc_bios; - BOOL ddc1; - BOOL ddc2; - I2CBusPtr pI2CBus; - CARD32 DDCReg; - BOOL HasEDID; + /* EDID data using DDC interface */ + Bool ddc_bios; + Bool ddc1; + Bool ddc2; + I2CBusPtr pI2CBus; + CARD32 DDCReg; - RADEONPLLRec pll; - RADEONRAMPtr ram; + RADEONPLLRec pll; + RADEONRAMPtr ram; - RADEONSaveRec SavedReg; /* Original (text) mode */ - RADEONSaveRec ModeReg; /* Current mode */ + RADEONSaveRec SavedReg; /* Original (text) mode */ + RADEONSaveRec ModeReg; /* Current mode */ Bool (*CloseScreen)(int, ScreenPtr); void (*BlockHandler)(int, pointer, pointer, pointer); @@ -311,6 +339,11 @@ xf86CursorInfoPtr cursor; unsigned long cursor_start; unsigned long cursor_end; +#ifdef ARGB_CURSOR + Bool cursor_argb; +#endif + int cursor_fg; + int cursor_bg; /* * XAAForceTransBlit is used to change the behavior of the XAA @@ -318,14 +351,16 @@ */ Bool XAAForceTransBlit; - int fifo_slots; /* Free slots in the FIFO (64 max) */ - int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */ - Bool dac6bits; /* Use 6 bit DAC? */ + int fifo_slots; /* Free slots in the FIFO (64 max) */ + int pix24bpp; /* Depth of pixmap for 24bpp fb */ + Bool dac6bits; /* Use 6 bit DAC? */ /* Computed values for Radeon */ int pitch; int datatype; CARD32 dp_gui_master_cntl; + CARD32 dp_gui_master_cntl_clip; + CARD32 trans_color; /* Saved values for ScreenToScreenCopy */ int xdir; @@ -336,11 +371,23 @@ unsigned char *scratch_save; int scanline_x; int scanline_y; + int scanline_w; int scanline_h; int scanline_h_w; int scanline_words; int scanline_direct; - int scanline_bpp; /* Only used for ImageWrite */ + int scanline_bpp; /* Only used for ImageWrite */ + int scanline_fg; + int scanline_bg; + int scanline_hpass; + int scanline_x1clip; + int scanline_x2clip; + + /* Saved values for DashedTwoPointLine */ + int dashLen; + CARD32 dashPattern; + int dash_fg; + int dash_bg; DGAModePtr DGAModes; int numDGAModes; @@ -348,8 +395,9 @@ int DGAViewportStatus; DGAFunctionRec DGAFuncs; - RADEONFBLayout CurrentLayout; + RADEONFBLayout CurrentLayout; #ifdef XF86DRI + Bool noBackBuffer; Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; int drmFD; @@ -368,16 +416,22 @@ unsigned char *PCI; /* Map */ Bool depthMoves; /* Enable depth moves -- slow! */ + Bool allowPageFlip; /* Enable 3d page flipping */ + Bool have3DWindows; /* Are there any 3d clients? */ + int drmMinor; drmSize agpSize; drmHandle agpMemHandle; /* Handle from drmAgpAlloc */ unsigned long agpOffset; unsigned char *AGP; /* Map */ int agpMode; + int agpFastWrite; CARD32 pciCommand; + Bool CPRuns; /* CP is running */ Bool CPInUse; /* CP has been used by X server */ + Bool CPStarted; /* CP has started */ int CPMode; /* CP mode that server/clients use */ int CPFifoSize; /* Size of the CP command FIFO */ int CPusecTimeout; /* CP timeout in usecs */ @@ -396,13 +450,13 @@ unsigned char *ringReadPtr; /* Map */ /* CP vertex/indirect buffer data */ - unsigned long bufStart; /* Offset into AGP space */ - drmHandle bufHandle; /* Handle from drmAddMap */ - drmSize bufMapSize; /* Size of map */ - int bufSize; /* Size of buffers (in MB) */ - unsigned char *buf; /* Map */ - int bufNumBufs; /* Number of buffers */ - drmBufMapPtr buffers; /* Buffer map */ + unsigned long bufStart; /* Offset into AGP space */ + drmHandle bufHandle; /* Handle from drmAddMap */ + drmSize bufMapSize; /* Size of map */ + int bufSize; /* Size of buffers (in MB) */ + unsigned char *buf; /* Map */ + int bufNumBufs; /* Number of buffers */ + drmBufMapPtr buffers; /* Buffer map */ /* CP AGP Texture data */ unsigned long agpTexStart; /* Offset into AGP space */ @@ -440,6 +494,12 @@ CARD32 dst_pitch_offset; + /* offscreen memory management */ + int backLines; + FBAreaPtr backArea; + int depthTexLines; + FBAreaPtr depthTexArea; + /* Saved scissor values */ CARD32 sc_left; CARD32 sc_right; @@ -451,27 +511,42 @@ CARD32 aux_sc_cntl; + int irq; + #ifdef PER_CONTEXT_SAREA - int perctx_sarea_size; + int perctx_sarea_size; #endif #endif + /* XVideo */ XF86VideoAdaptorPtr adaptor; void (*VideoTimerCallback)(ScrnInfoPtr, Time); + FBLinearPtr videoLinear; int videoKey; + + /* general */ Bool showCache; OptionInfoPtr Options; +#ifdef XFree86LOADER + XF86ModReqInfo xaaReq; +#endif } RADEONInfoRec, *RADEONInfoPtr; -#define RADEONWaitForFifo(pScrn, entries) \ -do { \ - if (info->fifo_slots < entries) \ - RADEONWaitForFifoFunction(pScrn, entries); \ - info->fifo_slots -= entries; \ +#define RADEONWaitForFifo(pScrn, entries) \ +do { \ + if (info->fifo_slots < entries) \ + RADEONWaitForFifoFunction(pScrn, entries); \ + info->fifo_slots -= entries; \ } while (0) extern void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries); -extern void RADEONWaitForIdle(ScrnInfoPtr pScrn); +extern void RADEONWaitForIdleMMIO(ScrnInfoPtr pScrn); +#ifdef XF86DRI +extern void RADEONWaitForIdleCP(ScrnInfoPtr pScrn); +#endif + +extern void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, + int clone); extern void RADEONEngineReset(ScrnInfoPtr pScrn); extern void RADEONEngineFlush(ScrnInfoPtr pScrn); @@ -479,50 +554,61 @@ extern unsigned RADEONINPLL(ScrnInfoPtr pScrn, int addr); extern void RADEONWaitForVerticalSync(ScrnInfoPtr pScrn); +extern void RADEONWaitForVerticalSync2(ScrnInfoPtr pScrn); extern void RADEONSelectBuffer(ScrnInfoPtr pScrn, int buffer); extern Bool RADEONAccelInit(ScreenPtr pScreen); +extern void RADEONEngineInit(ScrnInfoPtr pScrn); extern Bool RADEONCursorInit(ScreenPtr pScreen); extern Bool RADEONDGAInit(ScreenPtr pScreen); extern int RADEONMinBits(int val); -extern void RADEONInitVideo(ScreenPtr); +extern void RADEONInitVideo(ScreenPtr pScreen); +extern void R300CGWorkaround(ScrnInfoPtr pScrn); + #ifdef XF86DRI extern Bool RADEONDRIScreenInit(ScreenPtr pScreen); extern void RADEONDRICloseScreen(ScreenPtr pScreen); extern Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen); extern drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn); -extern void RADEONCPFlushIndirect(ScrnInfoPtr pScrn); +extern void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard); extern void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn); +extern int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info); #define RADEONCP_START(pScrn, info) \ do { \ - int _ret = drmRadeonStartCP(info->drmFD); \ + int _ret = drmCommandNone(info->drmFD, DRM_RADEON_CP_START); \ if (_ret) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CP start %d\n", __FUNCTION__, _ret); \ } \ + info->CPStarted = TRUE; \ } while (0) #define RADEONCP_STOP(pScrn, info) \ do { \ - int _ret = drmRadeonStopCP(info->drmFD); \ - if (_ret) { \ - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + int _ret; \ + if (info->CPStarted) { \ + _ret = RADEONCPStop(pScrn, info); \ + if (_ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CP stop %d\n", __FUNCTION__, _ret); \ - } \ + } \ + info->CPStarted = FALSE; \ + } \ RADEONEngineRestore(pScrn); \ + info->CPRuns = FALSE; \ } while (0) #define RADEONCP_RESET(pScrn, info) \ do { \ if (RADEONCP_USE_RING_BUFFER(info->CPMode)) { \ - int _ret = drmRadeonResetCP(info->drmFD); \ + int _ret = drmCommandNone(info->drmFD, DRM_RADEON_CP_RESET); \ if (_ret) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CP reset %d\n", __FUNCTION__, _ret); \ @@ -532,134 +618,131 @@ #define RADEONCP_REFRESH(pScrn, info) \ do { \ - if ( !info->CPInUse ) { \ - RADEON_WAIT_UNTIL_IDLE(); \ - BEGIN_RING( 6 ); \ - OUT_RING_REG( RADEON_RE_TOP_LEFT, info->re_top_left ); \ - OUT_RING_REG( RADEON_RE_WIDTH_HEIGHT, info->re_width_height ); \ - OUT_RING_REG( RADEON_AUX_SC_CNTL, info->aux_sc_cntl ); \ - ADVANCE_RING(); \ - info->CPInUse = TRUE; \ - } \ + if (!info->CPInUse) { \ + RADEON_WAIT_UNTIL_IDLE(); \ + BEGIN_RING(6); \ + OUT_RING_REG(RADEON_RE_TOP_LEFT, info->re_top_left); \ + OUT_RING_REG(RADEON_RE_WIDTH_HEIGHT, info->re_width_height); \ + OUT_RING_REG(RADEON_AUX_SC_CNTL, info->aux_sc_cntl); \ + ADVANCE_RING(); \ + info->CPInUse = TRUE; \ + } \ } while (0) -#define CP_PACKET0( reg, n ) \ +#define CP_PACKET0(reg, n) \ (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) -#define CP_PACKET1( reg0, reg1 ) \ +#define CP_PACKET1(reg0, reg1) \ (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2)) #define CP_PACKET2() \ (RADEON_CP_PACKET2) -#define CP_PACKET3( pkt, n ) \ +#define CP_PACKET3(pkt, n) \ (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) #define RADEON_VERBOSE 0 -#define RING_LOCALS CARD32 *__head; int __count; -#define RING_THRESHOLD 256 +#define RING_LOCALS CARD32 *__head = NULL; int __count = 0 -#define BEGIN_RING( n ) do { \ - if ( RADEON_VERBOSE ) { \ - xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ - "BEGIN_RING( %d ) in %s\n", n, __FUNCTION__ ); \ - } \ - if ( !info->indirectBuffer ) { \ - info->indirectBuffer = RADEONCPGetBuffer( pScrn ); \ - info->indirectStart = 0; \ - } else if ( info->indirectBuffer->used - info->indirectStart + \ - (n) * (int)sizeof(CARD32) > RING_THRESHOLD ) { \ - RADEONCPFlushIndirect( pScrn ); \ - } \ - __head = (pointer)((char *)info->indirectBuffer->address + \ +#define BEGIN_RING(n) do { \ + if (RADEON_VERBOSE) { \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + "BEGIN_RING(%d) in %s\n", n, __FUNCTION__); \ + } \ + if (!info->indirectBuffer) { \ + info->indirectBuffer = RADEONCPGetBuffer(pScrn); \ + info->indirectStart = 0; \ + } else if (info->indirectBuffer->used + (n) * (int)sizeof(CARD32) > \ + info->indirectBuffer->total) { \ + RADEONCPFlushIndirect(pScrn, 1); \ + } \ + __head = (pointer)((char *)info->indirectBuffer->address + \ info->indirectBuffer->used); \ - __count = 0; \ + __count = 0; \ } while (0) #define ADVANCE_RING() do { \ - if ( RADEON_VERBOSE ) { \ - xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ - "ADVANCE_RING() used: %d+%d=%d/%d\n", \ - info->indirectBuffer->used - info->indirectStart, \ - __count * sizeof(CARD32), \ - info->indirectBuffer->used - info->indirectStart + \ - __count * sizeof(CARD32), \ - RING_THRESHOLD ); \ - } \ - info->indirectBuffer->used += __count * (int)sizeof(CARD32); \ + if (RADEON_VERBOSE) { \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + "ADVANCE_RING() start: %d used: %d count: %d\n", \ + info->indirectStart, \ + info->indirectBuffer->used, \ + __count * sizeof(CARD32)); \ + } \ + info->indirectBuffer->used += __count * (int)sizeof(CARD32); \ } while (0) -#define OUT_RING( x ) do { \ - if ( RADEON_VERBOSE ) { \ - xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ - " OUT_RING( 0x%08x )\n", (unsigned int)(x) ); \ - } \ - __head[__count++] = (x); \ +#define OUT_RING(x) do { \ + if (RADEON_VERBOSE) { \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + " OUT_RING(0x%08x)\n", (unsigned int)(x)); \ + } \ + __head[__count++] = (x); \ } while (0) -#define OUT_RING_REG( reg, val ) \ +#define OUT_RING_REG(reg, val) \ do { \ - OUT_RING( CP_PACKET0( reg, 0 ) ); \ - OUT_RING( val ); \ + OUT_RING(CP_PACKET0(reg, 0)); \ + OUT_RING(val); \ } while (0) #define FLUSH_RING() \ do { \ - if ( RADEON_VERBOSE ) \ - xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ - "FLUSH_RING in %s\n", __FUNCTION__ ); \ - if ( info->indirectBuffer ) { \ - RADEONCPFlushIndirect( pScrn ); \ - } \ + if (RADEON_VERBOSE) \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + "FLUSH_RING in %s\n", __FUNCTION__); \ + if (info->indirectBuffer) { \ + RADEONCPFlushIndirect(pScrn, 0); \ + } \ } while (0) #define RADEON_WAIT_UNTIL_2D_IDLE() \ do { \ - BEGIN_RING( 2 ); \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ - ADVANCE_RING(); \ + BEGIN_RING(2); \ + OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); \ + OUT_RING((RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN)); \ + ADVANCE_RING(); \ } while (0) #define RADEON_WAIT_UNTIL_3D_IDLE() \ do { \ - BEGIN_RING( 2 ); \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ - ADVANCE_RING(); \ + BEGIN_RING(2); \ + OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); \ + OUT_RING((RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN)); \ + ADVANCE_RING(); \ } while (0) #define RADEON_WAIT_UNTIL_IDLE() \ do { \ - if ( RADEON_VERBOSE ) { \ - xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ - "WAIT_UNTIL_IDLE() in %s\n", __FUNCTION__ ); \ - } \ - BEGIN_RING( 2 ); \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + if (RADEON_VERBOSE) { \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + "WAIT_UNTIL_IDLE() in %s\n", __FUNCTION__); \ + } \ + BEGIN_RING(2); \ + OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); \ + OUT_RING((RADEON_WAIT_2D_IDLECLEAN | \ RADEON_WAIT_3D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ - ADVANCE_RING(); \ + RADEON_WAIT_HOST_IDLECLEAN)); \ + ADVANCE_RING(); \ } while (0) #define RADEON_FLUSH_CACHE() \ do { \ - BEGIN_RING( 2 ); \ - OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB2D_DC_FLUSH ); \ - ADVANCE_RING(); \ + BEGIN_RING(2); \ + OUT_RING(CP_PACKET0(RADEON_RB2D_DSTCACHE_CTLSTAT, 0)); \ + OUT_RING(RADEON_RB2D_DC_FLUSH); \ + ADVANCE_RING(); \ } while (0) #define RADEON_PURGE_CACHE() \ do { \ - BEGIN_RING( 2 ); \ - OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ - ADVANCE_RING(); \ + BEGIN_RING(2); \ + OUT_RING(CP_PACKET0(RADEON_RB2D_DSTCACHE_CTLSTAT, 0)); \ + OUT_RING(RADEON_RB2D_DC_FLUSH_ALL); \ + ADVANCE_RING(); \ } while (0) #endif /* XF86DRI */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man:1.1 --- /dev/null Thu Feb 27 12:30:38 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man Fri Feb 7 13:08:59 2003 @@ -0,0 +1,218 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man,v 1.0 2003/01/31 23:04:50 +.ds q \N'34' +.TH RADEON __drivermansuffix__ __vendorversion__ +.SH NAME +radeon \- ATI RADEON video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qradeon\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B radeon +is a XFree86 driver for ATI RADEON based video cards. It contains +full support for 8, 15, 16 and 24 bit pixel depths, dual-head setup, +flat panel, hardware 2D acceleration, hardware 3D acceleration +(except R300 cards), hardware cursor, XV extension, Xinerama extension. +.SH SUPPORTED HARDWARE +The +.B radeon +driver supports PCI and AGP video cards based on the following ATI chips +.TP 12 +.B R100 +Radeon 7200 +.TP 12 +.B RV100 +Radeon 7000(VE), M6 +.TP 12 +.B RV200 +Radeon 7500, M7 +.TP 12 +.B R200 +Radeon 8500, 9100, FireGL 8800/8700 +.TP 12 +.B RV250 +Radeon 9000, M9 +.TP 12 +.B R300 +Radeon 9700PRO/9700/9500PRO/9500, FireGL X1/Z1 + +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto\-detects all device information necessary to initialize +the card. However, if you have problems with auto\-detection, you can +specify: +.PP +.RS 4 +VideoRam \- in kilobytes +.br +MemBase \- physical address of the linear framebuffer +.br +IOBase \- physical address of the MMIO registers +.br +ChipID \- PCI DEVICE ID +.RE +.PP +In addition, the following driver +.B Options +are supported: +.TP +.BI "Option \*qSWcursor\*q \*q" boolean \*q +Selects software cursor. The default is +.B off. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Enables or disables all hardware acceleration. +.br +The default is to +.B enable +hardware acceleration. +.TP +.BI "Option \*qDac6Bit\*q \*q" boolean \*q +Enables or disables the use of 6 bits per color component when in 8 bpp +mode (emulates VGA mode). By default, all 8 bits per color component +are used. +.br +The default is +.B off. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +This overrides the default pixel value for the YUV video overlay key. +.br +The default value is +.B undefined. +.TP +.BI "Option \*qUseFBDev\*q \*q" boolean \*q +Enable or disable use of an OS\-specific framebuffer device interface +(which is not supported on all OSs). See fbdevhw(__drivermansuffix__) +for further information. +.br +The default is +.B off. +.TP +.BI "Option \*qAGPMode\*q \*q" integer \*q +Set AGP data transfer rate. +(used only when DRI is enabled) +.br +1 \-\- x1 (default) +.br +2 \-\- x2 +.br +4 \-\- x4 +.br +others \-\- invalid +.TP +.BI "Option \*qAGPFastWrite\*q \*q" boolean \*q +Enable AGP fast write. +.br +(used only when DRI is enabled) +.br +The default is +.B off. +.TP +.BI "Option \*qForcePCIMode\*q \*q" boolean \*q +Force to use PCI GART for DRI acceleration. +.br +(used only when DRI is enabled) +.br +The default is +.B off. +.TP +.BI "Option \*qDDCMode\*q \*q" boolean \*q +Force to use the modes queried from the connected monitor. +.br +The default is +.B off. +.TP +.BI "Option \*qCloneDisplay\*q \*q" integer \*q +.br +This option is only used for dual\-head cards with only single +screen section specified in the configuration file. + +0 \-\- disable +.br +1 \-\- auto\-detect (default) +.br +2 \-\- force on +.br +3 \-\- auto\-detect + 2nd head overlay +.br +4 \-\- force on + 2nd head overlay +.br +others \-\- auto\-detect + +.B disable +means only one CRTC is used for both heads. +.B auto\-detect +means the secondary head will be driven by CRTC2 +if a monitor is detected there. +.B force on +means the secondary head will be driven by CRTC2 +even no monitor is detected there. +.B 2nd-head overlay +means the only hardware overlay will be placed to the secondary head. + +Primary/Secondary head for dual\-head cards: +.br +(when only one port is used, it will be treated as the primary regardless) +.br +.B Primary head: +.br +DVI port on DVI+VGA cards +.br +LCD output on laptops +.br +Internal TMDS prot on DVI+DVI cards +.br +.B Secondary head: +.br +VGA port on DVI+VGA cards +.br +VGA port on laptops +.br +External TMDS port on DVI+DVI cards + +.TP +.BI "Option \*qCloneMode\*q \*q" "string" \*q +Set the first mode for the secondary head. +It can be different from the modes used for the primary head. If you don't +have this line while clone is on, the modes specified for the primary head +will be used for the secondary head. +.TP +.BI "Option \*qCloneHSync\*q \*q" "string" \*q +Set the horizontal sync range for the secondary monitor. +It is not required if a DDC\-capable monitor is connected. +.br +The default value is +.B undefined. +.TP +.BI "Option \*qCloneVRefresh\*q \*q" "string" \*q +Set the vertical refresh range for the secondary monitor. +It is not required if a DDC\-capable monitor is connected. +.br +The default value is +.B undefined. +.TP +.BI "Option \*qPanelOff\*q \*q" boolean \*q +Disable panel output. Only used when clone is enabled. +.br +The default value is +.B off. +.TP +.BI "Option \*qEnablePageFlip\*q \*q" boolean \*q +Enable page flipping for 3D acceleration. This will increase performance +but not work correctly in some rare cases, hence the default is +.B off. + + +.SH SEE ALSO +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +.nf +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.23 Sat Nov 24 09:38:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c Fri Jan 17 14:54:03 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.23 2001/11/24 14:38:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.32 2003/01/17 19:54:03 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,9 +29,9 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> - * Alan Hourihane <ahourihane@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * * Credits: * @@ -72,6 +72,7 @@ /* Driver data structures */ #include "radeon.h" +#include "radeon_macros.h" #include "radeon_probe.h" #include "radeon_reg.h" #include "radeon_version.h" @@ -111,13 +112,14 @@ extern int gRADEONEntityIndex; -/* The FIFO has 64 slots. This routines waits until at least `entries' of - these slots are empty. */ +/* The FIFO has 64 slots. This routines waits until at least `entries' + * of these slots are empty. + */ void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; + int i; for (;;) { for (i = 0; i < RADEON_TIMEOUT; i++) { @@ -133,116 +135,63 @@ RADEONEngineReset(pScrn); RADEONEngineRestore(pScrn); #ifdef XF86DRI - RADEONCP_RESET(pScrn, info); if (info->directRenderingEnabled) { + RADEONCP_RESET(pScrn, info); RADEONCP_START(pScrn, info); } #endif } } - -/* Wait for the graphics engine to be completely idle: the FIFO has - drained, the Pixel Cache is flushed, and the engine is idle. This is a - standard "sync" function that will make the hardware "quiescent". */ -void RADEONWaitForIdle(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - int i; - - RADEONTRACE(("WaitForIdle (entering): %d entries, stat=0x%08x\n", - INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, - INREG(RADEON_RBBM_STATUS))); - - RADEONWaitForFifoFunction(pScrn, 64); - - for (;;) { - for (i = 0; i < RADEON_TIMEOUT; i++) { - if (!(INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)) { - RADEONEngineFlush(pScrn); - return; - } - } - RADEONTRACE(("Idle timed out: %d entries, stat=0x%08x\n", - INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, - INREG(RADEON_RBBM_STATUS))); - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Idle timed out, resetting engine...\n"); - RADEONEngineReset(pScrn); - RADEONEngineRestore(pScrn); -#ifdef XF86DRI - RADEONCP_RESET(pScrn, info); - if (info->directRenderingEnabled) { - RADEONCP_START(pScrn, info); - } -#endif - } -} - -#ifdef XF86DRI -/* Wait until the CP is completely idle: the FIFO has drained and the - * CP is idle. - */ -static void RADEONCPWaitForIdle(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - int ret; - int i = 0; - - FLUSH_RING(); - - for (;;) { - do { - ret = drmRadeonWaitForIdleCP(info->drmFD); - if (ret && ret != -EBUSY) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "%s: CP idle %d\n", __FUNCTION__, ret); - } - } while ((ret == -EBUSY) && (i++ < RADEON_TIMEOUT)); - - if (ret == 0) return; - - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Idle timed out, resetting engine...\n"); - RADEONEngineReset(pScrn); - RADEONEngineRestore(pScrn); - - /* Always restart the engine when doing CP 2D acceleration */ - RADEONCP_RESET(pScrn, info); - RADEONCP_START(pScrn, info); - } -} -#endif -/* Flush all dirty data in the Pixel Cache to memory. */ +/* Flush all dirty data in the Pixel Cache to memory */ void RADEONEngineFlush(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; + int i; - OUTREGP(RADEON_RB2D_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH_ALL, - ~RADEON_RB2D_DC_FLUSH_ALL); + OUTREGP(RADEON_RB2D_DSTCACHE_CTLSTAT, + RADEON_RB2D_DC_FLUSH_ALL, + ~RADEON_RB2D_DC_FLUSH_ALL); for (i = 0; i < RADEON_TIMEOUT; i++) { - if (!(INREG(RADEON_RB2D_DSTCACHE_CTLSTAT) & RADEON_RB2D_DC_BUSY)) break; + if (!(INREG(RADEON_RB2D_DSTCACHE_CTLSTAT) & RADEON_RB2D_DC_BUSY)) + break; } } -/* Reset graphics card to known state. */ +/* Reset graphics card to known state */ void RADEONEngineReset(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 clock_cntl_index; - CARD32 mclk_cntl; - CARD32 rbbm_soft_reset; - CARD32 host_path_cntl; + CARD32 clock_cntl_index; + CARD32 mclk_cntl; + CARD32 rbbm_soft_reset; + CARD32 host_path_cntl; RADEONEngineFlush(pScrn); clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); - mclk_cntl = INPLL(pScrn, RADEON_MCLK_CNTL); + if (info->R300CGWorkaround) R300CGWorkaround(pScrn); + /* Some ASICs have bugs with dynamic-on feature, which are + * ASIC-version dependent, so we force all blocks on for now + */ + if (info->HasCRTC2) { + CARD32 tmp; + + tmp = INPLL(pScrn, RADEON_SCLK_CNTL); + OUTPLL(RADEON_SCLK_CNTL, ((tmp & ~RADEON_DYN_STOP_LAT_MASK) | + RADEON_CP_MAX_DYN_STOP_LAT | + RADEON_SCLK_FORCEON_MASK)); + + if (info->ChipFamily == CHIP_FAMILY_RV200) { + tmp = INPLL(pScrn, RADEON_SCLK_MORE_CNTL); + OUTPLL(RADEON_SCLK_MORE_CNTL, tmp | RADEON_SCLK_MORE_FORCEON); + } + } + + mclk_cntl = INPLL(pScrn, RADEON_MCLK_CNTL); OUTPLL(RADEON_MCLK_CNTL, (mclk_cntl | RADEON_FORCEON_MCLKA | RADEON_FORCEON_MCLKB | @@ -251,73 +200,96 @@ RADEON_FORCEON_MC | RADEON_FORCEON_AIC)); - /*Soft resetting HDP thru RBBM_SOFT_RESET register can - cause some unexpected behaviour on some machines. - Here we use RADEON_HOST_PATH_CNTL to reset it.*/ - host_path_cntl = INREG(RADEON_HOST_PATH_CNTL); - - rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); - - OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset | - RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB ); - INREG(RADEON_RBBM_SOFT_RESET); - OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & (CARD32) - ~(RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB )); - INREG(RADEON_RBBM_SOFT_RESET); + /* Soft resetting HDP thru RBBM_SOFT_RESET register can cause some + * unexpected behaviour on some machines. Here we use + * RADEON_HOST_PATH_CNTL to reset it. + */ + host_path_cntl = INREG(RADEON_HOST_PATH_CNTL); + rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); + + if (info->ChipFamily == CHIP_FAMILY_R300) { + CARD32 tmp; + + OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset | + RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_E2)); + INREG(RADEON_RBBM_SOFT_RESET); + OUTREG(RADEON_RBBM_SOFT_RESET, 0); + tmp = INREG(RADEON_RB2D_DSTCACHE_MODE); + OUTREG(RADEON_RB2D_DSTCACHE_MODE, tmp | (1 << 17)); /* FIXME */ + } else { + OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset | + RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_SE | + RADEON_SOFT_RESET_RE | + RADEON_SOFT_RESET_PP | + RADEON_SOFT_RESET_E2 | + RADEON_SOFT_RESET_RB)); + INREG(RADEON_RBBM_SOFT_RESET); + OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset & (CARD32) + ~(RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_SE | + RADEON_SOFT_RESET_RE | + RADEON_SOFT_RESET_PP | + RADEON_SOFT_RESET_E2 | + RADEON_SOFT_RESET_RB))); + INREG(RADEON_RBBM_SOFT_RESET); + } OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl | RADEON_HDP_SOFT_RESET); INREG(RADEON_HOST_PATH_CNTL); OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl); - OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); + if (info->ChipFamily != CHIP_FAMILY_R300) + OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); - OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); - + OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); + if (info->R300CGWorkaround) R300CGWorkaround(pScrn); } -/* Restore the acceleration hardware to its previous state. */ +/* Restore the acceleration hardware to its previous state */ void RADEONEngineRestore(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int pitch64; + int pitch64; RADEONTRACE(("EngineRestore (%d/%d)\n", info->CurrentLayout.pixel_code, info->CurrentLayout.bitsPerPixel)); RADEONWaitForFifo(pScrn, 1); - /* turn of all automatic flushing - we'll do it all */ - OUTREG(RADEON_RB2D_DSTCACHE_MODE, 0); + + /* NOTE: The following RB2D_DSTCACHE_MODE setting will cause the + * R300 to hang. ATI does not see a reason to change it from the + * default BIOS settings (even on non-R300 cards). This setting + * might be removed in future versions of the Radeon driver. + */ + + /* Turn of all automatic flushing - we'll do it all */ + if (info->ChipFamily != CHIP_FAMILY_R300) + OUTREG(RADEON_RB2D_DSTCACHE_MODE, 0); pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; RADEONWaitForFifo(pScrn, 1); - OUTREG(RADEON_DEFAULT_OFFSET, (INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000) | - (pitch64 << 22)); + OUTREG(RADEON_DEFAULT_OFFSET, ((INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000) + | (pitch64 << 22))); RADEONWaitForFifo(pScrn, 1); #if X_BYTE_ORDER == X_BIG_ENDIAN OUTREGP(RADEON_DP_DATATYPE, - RADEON_HOST_BIG_ENDIAN_EN, ~RADEON_HOST_BIG_ENDIAN_EN); + RADEON_HOST_BIG_ENDIAN_EN, + ~RADEON_HOST_BIG_ENDIAN_EN); #else OUTREGP(RADEON_DP_DATATYPE, 0, ~RADEON_HOST_BIG_ENDIAN_EN); #endif - /* restore SURFACE_CNTL */ + /* Restore SURFACE_CNTL */ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl); RADEONWaitForFifo(pScrn, 1); @@ -336,74 +308,16 @@ OUTREG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff); OUTREG(RADEON_DP_SRC_BKGD_CLR, 0x00000000); OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff); - - RADEONWaitForIdle(pScrn); -} - -/* This callback is required for multiheader cards using XAA */ -static -void RADEONRestoreAccelState(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - CARD32 pitch64; - RADEONEntPtr pRADEONEnt; - DevUnion* pPriv; - - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - if(pRADEONEnt->IsDRIEnabled) - { - /*not working yet*/ - /* - RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); - RADEONCP_TO_MMIO(pRADEONEnt->pPrimaryScrn, info0); - */ - } - pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; - - OUTREG(RADEON_DEFAULT_OFFSET, (pScrn->fbOffset>>10) | - (pitch64 << 22)); - - /* FIXME: May need to restore other things, - like BKGD_CLK FG_CLK...*/ - - RADEONWaitForIdle(pScrn); + RADEONWaitForIdleMMIO(pScrn); } -/* This callback is required for multiheader cards using XAA */ -#ifdef XF86DRI -static -void RADEONRestoreCPAccelState(ScrnInfoPtr pScrn) +/* Initialize the acceleration hardware */ +void RADEONEngineInit(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "===>RestoreCP\n");*/ - - RADEONWaitForFifo(pScrn, 1); - OUTREG( RADEON_DEFAULT_OFFSET, info->frontPitchOffset); - RADEONWaitForIdle(pScrn); - - /*Not working yet*/ - /* - RADEONMMIO_TO_CP(pScrn, info); - */ - - /* FIXME: May need to restore other things, - like BKGD_CLK FG_CLK...*/ - -} -#endif - -/* Initialize the acceleration hardware. */ -static void RADEONEngineInit(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - RADEONTRACE(("EngineInit (%d/%d)\n", info->CurrentLayout.pixel_code, info->CurrentLayout.bitsPerPixel)); @@ -411,13 +325,14 @@ OUTREG(RADEON_RB3D_CNTL, 0); #if defined(__powerpc__) #if defined(XF86_DRI) - if(!info->directRenderinEnabled) + if(!info->directRenderingEnabled) #endif { OUTREG(RADEON_MC_FB_LOCATION, 0xffff0000); OUTREG(RADEON_MC_AGP_LOCATION, 0xfffff000); } #endif + RADEONEngineReset(pScrn); switch (info->CurrentLayout.pixel_code) { @@ -456,1314 +371,237 @@ RADEONEngineRestore(pScrn); } - -/* Setup for XAA SolidFill. */ -static void RADEONSetupForSolidFill(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 4); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_SOLID_COLOR - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].pattern)); - OUTREG(RADEON_DP_BRUSH_FRGD_CLR, color); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - OUTREG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT - | RADEON_DST_Y_TOP_TO_BOTTOM)); -} - -/* Subsequent XAA SolidFillRect. - Tests: xtest CH06/fllrctngl, xterm -*/ -static void RADEONSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 2); - OUTREG(RADEON_DST_Y_X, (y << 16) | x); - OUTREG(RADEON_DST_WIDTH_HEIGHT, (w << 16) | h); -} - -/* Setup for XAA solid lines. */ - -/* unlike r128, Radeon don't have the Last-Pel controlling bit in DP_CNTL_XDIR_YDIR_YMAJOR - for line drawing, so we have to do it using our own extrapolation routine*/ -static void LastLinePel(int *X1, int *Y1, int *X2, int *Y2) -{ - int tg, deltax, deltay; - int xa = *X1, ya = *Y1, xb = *X2, yb = *Y2; - - deltax = xb - xa; - deltay = yb - ya; - - if(deltax == 0) - tg = 40; - else - tg = labs((deltay<<4) / deltax); - - if((tg >= 7) && (tg <= 39)) - { - if(deltax > 0)xb++; - else xb--; - if(deltay > 0)yb++; - else yb--; - } - else - { - if(labs(deltax) > labs(deltay)) - { - if(deltax > 0) xb++; - else xb--; - } - else - { - if(deltay > 0) yb++; - else yb--; - } - - } -} +#define ACCEL_MMIO +#define ACCEL_PREAMBLE() unsigned char *RADEONMMIO = info->MMIO +#define BEGIN_ACCEL(n) RADEONWaitForFifo(pScrn, (n)) +#define OUT_ACCEL_REG(reg, val) OUTREG(reg, val) +#define FINISH_ACCEL() + +#include "radeon_accelfuncs.c" + +#undef ACCEL_MMIO +#undef ACCEL_PREAMBLE +#undef BEGIN_ACCEL +#undef OUT_ACCEL_REG +#undef FINISH_ACCEL - -/* Setup for XAA solid lines. */ -static void RADEONSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_SOLID_COLOR - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].pattern)); - OUTREG(RADEON_DP_BRUSH_FRGD_CLR, color); - OUTREG(RADEON_DP_WRITE_MASK, planemask); -} - - -/* Subsequent XAA solid TwoPointLine line. - - Tests: xtest CH06/drwln, ico, Mark Vojkovich's linetest program - - [See http://www.xfree86.org/devel/archives/devel/1999-Jun/0102.shtml for - Mark Vojkovich's linetest program, posted 2Jun99 to devel@xfree86.org.] -*/ -static void RADEONSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int xa, int ya, int xb, int yb, - int flags) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - if (!(flags & OMIT_LAST)) - LastLinePel(&xa, &ya, &xb, &yb); - - RADEONWaitForFifo(pScrn, 2); - OUTREG(RADEON_DST_LINE_START, (ya << 16) | xa); - OUTREG(RADEON_DST_LINE_END, (yb << 16) | xb); - -} - -/* Subsequent XAA solid horizontal and vertical lines */ -static void RADEONSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir ) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 1); - OUTREG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT - | RADEON_DST_Y_TOP_TO_BOTTOM)); - - if (dir == DEGREES_0) { - RADEONSubsequentSolidFillRect(pScrn, x, y, len, 1); - } else { - RADEONSubsequentSolidFillRect(pScrn, x, y, 1, len); - } -} - -/* Setup for XAA dashed lines. - - Tests: xtest CH05/stdshs, XFree86/drwln - - NOTE: Since we can only accelerate lines with power-of-2 patterns of - length <= 32. -*/ -static void RADEONSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask, - int length, unsigned char *pattern) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - CARD32 pat = *(CARD32 *)(pointer)pattern; - - switch (length) { - case 2: pat |= pat << 2; /* fall through */ - case 4: pat |= pat << 4; /* fall through */ - case 8: pat |= pat << 8; /* fall through */ - case 16: pat |= pat << 16; - } - - RADEONWaitForFifo(pScrn, 5); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | (bg == -1 - ? RADEON_GMC_BRUSH_32x1_MONO_FG_LA - : RADEON_GMC_BRUSH_32x1_MONO_FG_BG) - | RADEON_ROP[rop].pattern - | RADEON_GMC_BYTE_LSB_TO_MSB)); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - OUTREG(RADEON_DP_BRUSH_FRGD_CLR, fg); - OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg); - OUTREG(RADEON_BRUSH_DATA0, pat); -} - -/* Subsequent XAA dashed line. */ -static void RADEONSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int xa, int ya, - int xb, int yb, - int flags, - int phase) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 3); - if (!(flags & OMIT_LAST)) - LastLinePel(&xa, &ya, &xb, &yb); - - OUTREG(RADEON_DST_LINE_START, (ya << 16) | xa); - OUTREG(RADEON_DST_LINE_PATCOUNT, phase); - OUTREG(RADEON_DST_LINE_END, (yb << 16) | xb); -} - -/* Setup for XAA screen-to-screen copy. - - Tests: xtest CH06/fllrctngl (also tests transparency). -*/ -static void RADEONSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, - int trans_color) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - info->xdir = xdir; - info->ydir = ydir; - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_NONE - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].rop - | RADEON_DP_SRC_SOURCE_MEMORY)); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - OUTREG(RADEON_DP_CNTL, ((xdir >= 0 - ? RADEON_DST_X_LEFT_TO_RIGHT - : 0) - | (ydir >= 0 - ? RADEON_DST_Y_TOP_TO_BOTTOM - : 0))); - - if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { - /* Set up for transparency */ - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color); - OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK); - /* Mmmm, Seems as though the transparency compare is opposite to r128 - * It should only draw when source != trans_color, - * this is the opposite of that. */ - OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR - | RADEON_CLR_CMP_SRC_SOURCE)); - } -} - -/* Subsequent XAA screen-to-screen copy. */ -static void RADEONSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int xa, int ya, - int xb, int yb, - int w, int h) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - if (info->xdir < 0) xa += w - 1, xb += w - 1; - if (info->ydir < 0) ya += h - 1, yb += h - 1; - - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_SRC_Y_X, (ya << 16) | xa); - OUTREG(RADEON_DST_Y_X, (yb << 16) | xb); - OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); -} - -/* Setup for XAA mono 8x8 pattern color expansion. Patterns with - transparency use `bg == -1'. This routine is only used if the XAA - pixmap cache is turned on. - - Tests: xtest XFree86/fllrctngl (no other test will test this routine with - both transparency and non-transparency) -*/ -static void RADEONSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, int rop, - unsigned int planemask) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 6); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | (bg == -1 - ? RADEON_GMC_BRUSH_8X8_MONO_FG_LA - : RADEON_GMC_BRUSH_8X8_MONO_FG_BG) - | RADEON_ROP[rop].pattern - | RADEON_GMC_BYTE_LSB_TO_MSB)); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - OUTREG(RADEON_DP_BRUSH_FRGD_CLR, fg); - OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg); - OUTREG(RADEON_BRUSH_DATA0, patternx); - OUTREG(RADEON_BRUSH_DATA1, patterny); -} - -/* Subsequent XAA 8x8 pattern color expansion. Because they are used in - the setup function, `patternx' and `patterny' are not used here. */ -static void RADEONSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, int w, int h) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_BRUSH_Y_X, (patterny << 8) | patternx); - OUTREG(RADEON_DST_Y_X, (y << 16) | x); - OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); -} - -#if 0 -/* Setup for XAA color 8x8 pattern fill. - - Tests: xtest XFree86/fllrctngl (with Mono8x8PatternFill off) -*/ -static void RADEONSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int rop, unsigned int planemask, - int trans_color) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - ErrorF("Color8x8 %d %d %d\n", trans_color, patx, paty); - - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_8x8_COLOR - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].pattern - | RADEON_DP_SRC_SOURCE_MEMORY)); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - OUTREG(RADEON_SRC_Y_X, (paty << 16) | patx); - - if (trans_color != -1) { - /* Set up for transparency */ - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color); - OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK); - /* Mmmm, Seems as though the transparency compare is opposite to r128 - * It should only draw when source != trans_color, - * this is the opposite of that. */ - OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR - | RADEON_CLR_CMP_SRC_SOURCE)); - } -} - -/* Subsequent XAA 8x8 pattern color expansion. */ -static void RADEONSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - ErrorF("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h); - - RADEONWaitForFifo(pScrn, 4); - OUTREG(RADEON_BRUSH_Y_X, (paty << 16) | patx); - OUTREG(RADEON_DST_Y_X, (y << 16) | x); - OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); -} -#endif - -/* Setup for XAA indirect CPU-to-screen color expansion (indirect). - Because of how the scratch buffer is initialized, this is really a - mainstore-to-screen color expansion. Transparency is supported when `bg - == -1'. - Implementing the hybrid indirect/direct scheme improved performance in a - few areas: -*/ -static void RADEONSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int - planemask) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - RADEONWaitForFifo(pScrn, 4); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_DST_CLIPPING - | RADEON_GMC_BRUSH_NONE - | (bg == -1 - ? RADEON_GMC_SRC_DATATYPE_MONO_FG_LA - : RADEON_GMC_SRC_DATATYPE_MONO_FG_BG) - | RADEON_ROP[rop].rop - | RADEON_GMC_BYTE_LSB_TO_MSB - | RADEON_DP_SRC_SOURCE_HOST_DATA)); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - OUTREG(RADEON_DP_SRC_FRGD_CLR, fg); - OUTREG(RADEON_DP_SRC_BKGD_CLR, bg); -} - -/* Subsequent XAA indirect CPU-to-screen color expansion. This is only - called once for each rectangle. */ -static void RADEONSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr - pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - info->scanline_h = h; - info->scanline_words = (w + 31) >> 5; - -#ifdef __alpha__ - /* always use indirect for Alpha */ - if (0) -#else - if ((info->scanline_words * h) <= 9) -#endif - { - /* Turn on direct for less than 9 dword colour expansion */ - info->scratch_buffer[0] - = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) - - (info->scanline_words - 1)); - info->scanline_direct = 1; - } else { - /* Use indirect for anything else */ - info->scratch_buffer[0] = info->scratch_save; - info->scanline_direct = 0; - } - - RADEONWaitForFifo(pScrn, 4 + (info->scanline_direct ? - (info->scanline_words * h) : 0) ); - OUTREG(RADEON_SC_TOP_LEFT, (y << 16) | ((x+skipleft) & 0xffff)); - /* MMmm, we don't need the -1 on both y+h or x+w, why ? */ - OUTREG(RADEON_SC_BOTTOM_RIGHT, ((y+h) << 16) | ((x+w) & 0xffff)); - OUTREG(RADEON_DST_Y_X, (y << 16) | (x & 0xffff)); - /* Have to pad the width here and use clipping engine */ - OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31)); -} - -/* Subsequent XAA indirect CPU-to-screen color expansion. This is called - once for each scanline. */ -static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - CARD32 *p = (pointer)info->scratch_buffer[bufno]; - int i; - int left = info->scanline_words; - volatile CARD32 *d; - - if (info->scanline_direct) return; - --info->scanline_h; - while (left) { - write_mem_barrier(); - if (left <= 8) { - /* Last scanline - finish write to DATA_LAST */ - if (info->scanline_h == 0) { - RADEONWaitForFifo(pScrn, left); - /* Unrolling doesn't improve performance */ - for (d = ADDRREG(RADEON_HOST_DATA_LAST) - (left - 1); left; --left) - *d++ = *p++; - return; - } else { - RADEONWaitForFifo(pScrn, left); - /* Unrolling doesn't improve performance */ - for (d = ADDRREG(RADEON_HOST_DATA7) - (left - 1); left; --left) - *d++ = *p++; - } - } else { - RADEONWaitForFifo(pScrn, 8); - /* Unrolling doesn't improve performance */ - for (d = ADDRREG(RADEON_HOST_DATA0), i = 0; i < 8; i++) - *d++ = *p++; - left -= 8; - } - } -} - -/* Setup for XAA indirect image write. */ -static void RADEONSetupForScanlineImageWrite(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int trans_color, - int bpp, - int depth) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - info->scanline_bpp = bpp; - - RADEONWaitForFifo(pScrn, 2); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_DST_CLIPPING - | RADEON_GMC_BRUSH_NONE - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].rop - | RADEON_GMC_BYTE_LSB_TO_MSB - | RADEON_DP_SRC_SOURCE_HOST_DATA)); - OUTREG(RADEON_DP_WRITE_MASK, planemask); - - if (trans_color != -1) { - /* Set up for transparency */ - RADEONWaitForFifo(pScrn, 3); - OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color); - OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK); - /* Mmmm, Seems as though the transparency compare is opposite to r128 - * It should only draw when source != trans_color, - * this is the opposite of that. */ - OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR - | RADEON_CLR_CMP_SRC_SOURCE)); - } -} - -/* Subsequent XAA indirect image write. This is only called once for each - rectangle. */ -static void RADEONSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - int shift = 0; /* 32bpp */ - - if (pScrn->bitsPerPixel == 8) shift = 3; - else if (pScrn->bitsPerPixel == 16) shift = 1; - - info->scanline_h = h; - info->scanline_words = (w * info->scanline_bpp + 31) >> 5; - -#ifdef __alpha__ - /* always use indirect for Alpha */ - if (0) -#else - if ((info->scanline_words * h) <= 9) -#endif - { - /* Turn on direct for less than 9 dword colour expansion */ - info->scratch_buffer[0] - = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) - - (info->scanline_words - 1)); - info->scanline_direct = 1; - } else { - /* Use indirect for anything else */ - info->scratch_buffer[0] = info->scratch_save; - info->scanline_direct = 0; - } - - RADEONWaitForFifo(pScrn, 4 + (info->scanline_direct ? - (info->scanline_words * h) : 0) ); - OUTREG(RADEON_SC_TOP_LEFT, (y << 16) | ((x+skipleft) & 0xffff)); - /* MMmm, we don't need the -1 on both y+h or x+w, why ? */ - OUTREG(RADEON_SC_BOTTOM_RIGHT, ((y+h) << 16) | ((x+w) & 0xffff)); - OUTREG(RADEON_DST_Y_X, (y << 16) | (x & 0xffff)); - /* Have to pad the width here and use clipping engine */ - OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + shift) & ~shift)); -} - -/* Subsequent XAA indirect image write. This is called once for each - scanline. */ -static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - CARD32 *p = (pointer)info->scratch_buffer[bufno]; - int i; - int left = info->scanline_words; - volatile CARD32 *d; - - if (info->scanline_direct) return; - --info->scanline_h; - while (left) { - write_mem_barrier(); - if (left <= 8) { - /* Last scanline - finish write to DATA_LAST */ - if (info->scanline_h == 0) { - RADEONWaitForFifo(pScrn, left); - /* Unrolling doesn't improve performance */ - for (d = ADDRREG(RADEON_HOST_DATA_LAST) - (left - 1); left; --left) - *d++ = *p++; - return; - } else { - RADEONWaitForFifo(pScrn, left); - /* Unrolling doesn't improve performance */ - for (d = ADDRREG(RADEON_HOST_DATA7) - (left - 1); left; --left) - *d++ = *p++; - } - } else { - RADEONWaitForFifo(pScrn, 8); - /* Unrolling doesn't improve performance */ - for (d = ADDRREG(RADEON_HOST_DATA0), i = 0; i < 8; i++) - *d++ = *p++; - left -= 8; - } - } -} - -static void RADEONSetClippingRectangle(ScrnInfoPtr pScrn, - int xa, int ya, int xb, int yb) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - unsigned long tmp = 0; - - if(xa < 0) - { - tmp = -xa; - tmp |= RADEON_SC_SIGN_MASK_LO; - } - else tmp = xa; - - if(ya < 0) - { - tmp |= ((-ya) << 16); - tmp |= RADEON_SC_SIGN_MASK_HI; - } - else tmp |= (ya << 16); - - OUTREG(RADEON_SC_TOP_LEFT, tmp); - - if(xb < 0) - { - tmp = -xb; - tmp |= RADEON_SC_SIGN_MASK_LO; - } - else tmp = xb; - - if(yb < 0) - { - tmp |= ((-yb) << 16); - tmp |= RADEON_SC_SIGN_MASK_HI; - } - else tmp |= (yb << 16); - OUTREG(RADEON_SC_BOTTOM_RIGHT, tmp); - - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | RADEON_GMC_DST_CLIPPING)); - -} - -static void -RADEONDisableClipping(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl & ~(CARD32)RADEON_GMC_DST_CLIPPING)); - - OUTREG(RADEON_SC_TOP_LEFT, 0); - OUTREG(RADEON_SC_BOTTOM_RIGHT, INREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT)); - -} - - - -/* ================================================================ - * CP-based 2D acceleration - */ #ifdef XF86DRI - -/* Setup for XAA SolidFill. */ -static void RADEONCPSetupForSolidFill(ScrnInfoPtr pScrn, - int color, int rop, - unsigned int planemask) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - RING_LOCALS; - - RADEONCP_REFRESH( pScrn, info ); - - BEGIN_RING( 8 ); - - OUT_RING_REG( RADEON_DP_GUI_MASTER_CNTL, - (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_SOLID_COLOR - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].pattern) ); - - OUT_RING_REG( RADEON_DP_BRUSH_FRGD_CLR, color ); - OUT_RING_REG( RADEON_DP_WRITE_MASK, planemask ); - OUT_RING_REG( RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT | - RADEON_DST_Y_TOP_TO_BOTTOM) ); - ADVANCE_RING(); -} - -/* Subsequent XAA SolidFillRect. - - Tests: xtest CH06/fllrctngl, xterm -*/ -static void RADEONCPSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - RING_LOCALS; - - RADEONCP_REFRESH( pScrn, info ); - - BEGIN_RING( 4 ); - - OUT_RING_REG( RADEON_DST_Y_X, (y << 16) | x ); - OUT_RING_REG( RADEON_DST_WIDTH_HEIGHT, (w << 16) | h ); - - ADVANCE_RING(); -} - -/* Setup for XAA screen-to-screen copy. - - Tests: xtest CH06/fllrctngl (also tests transparency). -*/ -static void RADEONCPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, - int trans_color) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - RING_LOCALS; - - RADEONCP_REFRESH( pScrn, info ); - - info->xdir = xdir; - info->ydir = ydir; - - BEGIN_RING( 6 ); - - OUT_RING_REG( RADEON_DP_GUI_MASTER_CNTL, - (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_NONE - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].rop - | RADEON_DP_SRC_SOURCE_MEMORY) ); - - OUT_RING_REG( RADEON_DP_WRITE_MASK, planemask ); - OUT_RING_REG( RADEON_DP_CNTL, - ((xdir >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) | - (ydir >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0)) ); - - ADVANCE_RING(); - - if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { - BEGIN_RING( 6 ); - - OUT_RING_REG( RADEON_CLR_CMP_CLR_SRC, trans_color ); - OUT_RING_REG( RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK ); - /* Mmmm, Seems as though the transparency compare is opposite to r128 - * It should only draw when source != trans_color, - * this is the opposite of that. */ - OUT_RING_REG( RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR | - RADEON_CLR_CMP_SRC_SOURCE) ); - - ADVANCE_RING(); - } -} - -/* Subsequent XAA screen-to-screen copy. */ -static void RADEONCPSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int xa, int ya, - int xb, int yb, - int w, int h) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - RING_LOCALS; - - RADEONCP_REFRESH( pScrn, info ); - - if (info->xdir < 0) xa += w - 1, xb += w - 1; - if (info->ydir < 0) ya += h - 1, yb += h - 1; - - BEGIN_RING( 6 ); - - OUT_RING_REG( RADEON_SRC_Y_X, (ya << 16) | xa ); - OUT_RING_REG( RADEON_DST_Y_X, (yb << 16) | xb ); - OUT_RING_REG( RADEON_DST_HEIGHT_WIDTH, (h << 16) | w ); - - ADVANCE_RING(); -} - -/* Setup for XAA solid lines. */ -static void RADEONCPSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - RING_LOCALS; - BEGIN_RING( 6 ); - OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_SOLID_COLOR - | RADEON_GMC_SRC_DATATYPE_COLOR - | RADEON_ROP[rop].pattern)); - OUT_RING_REG(RADEON_DP_BRUSH_FRGD_CLR, color); - OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask); - - ADVANCE_RING(); - -} - - -/* Subsequent XAA solid TwoPointLine line. - - Tests: xtest CH06/drwln, ico, Mark Vojkovich's linetest program - - [See http://www.xfree86.org/devel/archives/devel/1999-Jun/0102.shtml for - Mark Vojkovich's linetest program, posted 2Jun99 to devel@xfree86.org.] -*/ -static void RADEONCPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int xa, int ya, int xb, int yb, - int flags) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - RING_LOCALS; - BEGIN_RING( 4 ); - - if (!(flags & OMIT_LAST)) - { - LastLinePel(&xa, &ya, &xb, &yb); - } - - OUT_RING_REG(RADEON_DST_LINE_START, (ya << 16) | xa); - OUT_RING_REG(RADEON_DST_LINE_END, (yb << 16) | xb); - - ADVANCE_RING(); -} - -/* Subsequent XAA solid horizontal and vertical lines */ -static void RADEONCPSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir ) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - RING_LOCALS; - BEGIN_RING( 6 ); - - OUT_RING_REG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT - | RADEON_DST_Y_TOP_TO_BOTTOM)); - - if (dir == DEGREES_0) - { - OUT_RING_REG( RADEON_DST_Y_X, (y << 16) | x ); - OUT_RING_REG( RADEON_DST_WIDTH_HEIGHT, (len << 16) | 1 ); - } - else - { - OUT_RING_REG( RADEON_DST_Y_X, (y << 16) | x ); - OUT_RING_REG( RADEON_DST_WIDTH_HEIGHT, (1 << 16) | len ); - } - ADVANCE_RING(); -} - - -/* Setup for XAA dashed lines. - - Tests: xtest CH05/stdshs, XFree86/drwln - - NOTE: Since we can only accelerate lines with power-of-2 patterns of - length <= 32. -*/ -static void RADEONCPSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask, - int length, unsigned char *pattern) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - CARD32 pat = *(CARD32 *)(pointer)pattern; - - RING_LOCALS; - - switch (length) { - case 2: pat |= pat << 2; /* fall through */ - case 4: pat |= pat << 4; /* fall through */ - case 8: pat |= pat << 8; /* fall through */ - case 16: pat |= pat << 16; - } - - BEGIN_RING( 12 ); - OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | (bg == -1 - ? RADEON_GMC_BRUSH_32x1_MONO_FG_LA - : RADEON_GMC_BRUSH_32x1_MONO_FG_BG) - | RADEON_ROP[rop].pattern - | RADEON_GMC_BYTE_LSB_TO_MSB)); - OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask); - OUT_RING_REG(RADEON_DP_BRUSH_FRGD_CLR, fg); - if(bg != -1) OUT_RING_REG(RADEON_DP_BRUSH_BKGD_CLR, bg); - OUT_RING_REG(RADEON_BRUSH_DATA0, pat); - ADVANCE_RING(); - -} - -/* Subsequent XAA dashed line. */ -static void RADEONCPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int xa, int ya, - int xb, int yb, - int flags, - int phase) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - RING_LOCALS; - - if (!(flags & OMIT_LAST)) - { - LastLinePel(&xa, &ya, &xb, &yb); - } - - BEGIN_RING(6); - OUT_RING_REG(RADEON_DST_LINE_START, (ya << 16) | xa); - OUT_RING_REG(RADEON_DST_LINE_PATCOUNT, phase); - OUT_RING_REG(RADEON_DST_LINE_END, (yb << 16) | xb); - ADVANCE_RING(); -} - - -static void RADEONCPSetClippingRectangle(ScrnInfoPtr pScrn, - int xa, int ya, int xb, int yb) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned long tmp1 = 0, tmp2 = 0; - - if(xa < 0) - { - tmp1 = -xa; - tmp1 |= RADEON_SC_SIGN_MASK_LO; - } - else tmp1 = xa; - - if(ya < 0) - { - tmp1 |= ((-ya) << 16); - tmp1 |= RADEON_SC_SIGN_MASK_HI; - } - else tmp1 |= (ya << 16); - - if(xb < 0) - { - tmp2 = -xb; - tmp2 |= RADEON_SC_SIGN_MASK_LO; - } - else tmp2 = xb; - - if(yb < 0) - { - tmp2 |= ((-yb) << 16); - tmp2 |= RADEON_SC_SIGN_MASK_HI; - } - else tmp2 |= (yb << 16); - - { - - RING_LOCALS; - BEGIN_RING( 3 ); - OUT_RING_REG(RADEON_SC_TOP_LEFT, tmp1); - OUT_RING_REG(RADEON_SC_BOTTOM_RIGHT, tmp2); - OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, - (info->dp_gui_master_cntl | RADEON_GMC_DST_CLIPPING)); - - ADVANCE_RING(); - } -} - -static void -RADEONCPDisableClipping(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - /* unsigned char *RADEONMMIO = info->MMIO;*/ - RING_LOCALS; - BEGIN_RING( 3 ); - OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, - (info->dp_gui_master_cntl & ~(CARD32)(RADEON_GMC_DST_CLIPPING))); - OUT_RING_REG(RADEON_SC_TOP_LEFT, 0); - OUT_RING_REG(RADEON_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX - | RADEON_DEFAULT_SC_BOTTOM_MAX)); - - ADVANCE_RING(); - -} - - -/* Point the DST_PITCH_OFFSET register at the current buffer. This - * allows us to interact with the back and depth buffers. All CP 2D - * acceleration commands use the DST_PITCH_OFFSET register. - */ -void RADEONSelectBuffer(ScrnInfoPtr pScrn, int buffer) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - RING_LOCALS; - - switch (buffer) { - case RADEON_BACK: - info->dst_pitch_offset = info->backPitchOffset; - break; - case RADEON_DEPTH: - info->dst_pitch_offset = info->depthPitchOffset; - break; - default: - case RADEON_FRONT: - info->dst_pitch_offset = info->frontPitchOffset; - break; +#define ACCEL_CP +#define ACCEL_PREAMBLE() \ + RING_LOCALS; \ + RADEONCP_REFRESH(pScrn, info) +#define BEGIN_ACCEL(n) BEGIN_RING(2*(n)) +#define OUT_ACCEL_REG(reg, val) OUT_RING_REG(reg, val) +#define FINISH_ACCEL() ADVANCE_RING() + +#include "radeon_accelfuncs.c" + +#undef ACCEL_CP +#undef ACCEL_PREAMBLE +#undef BEGIN_ACCEL +#undef OUT_ACCEL_REG +#undef FINISH_ACCEL + +/* Stop the CP */ +int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info) +{ + drmRadeonCPStop stop; + int ret, i; + + stop.flush = 1; + stop.idle = 1; + + ret = drmCommandWrite(info->drmFD, DRM_RADEON_CP_STOP, &stop, + sizeof(drmRadeonCPStop)); + + if (ret == 0) { + return 0; + } else if (errno != EBUSY) { + return -errno; + } + + stop.flush = 0; + + i = 0; + do { + ret = drmCommandWrite(info->drmFD, DRM_RADEON_CP_STOP, &stop, + sizeof(drmRadeonCPStop)); + } while (ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY); + + if (ret == 0) { + return 0; + } else if (errno != EBUSY) { + return -errno; + } + + stop.idle = 0; + + if (drmCommandWrite(info->drmFD, DRM_RADEON_CP_STOP, + &stop, sizeof(drmRadeonCPStop))) { + return -errno; + } else { + return 0; } - - BEGIN_RING( 2 ); - - OUT_RING_REG( RADEON_DEFAULT_OFFSET, info->dst_pitch_offset ); - - ADVANCE_RING(); } -/* Get an indirect buffer for the CP 2D acceleration commands. - */ -drmBufPtr RADEONCPGetBuffer( ScrnInfoPtr pScrn ) +/* Get an indirect buffer for the CP 2D acceleration commands */ +drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); - drmDMAReq dma; - drmBufPtr buf = NULL; - int indx = 0; - int size = 0; - int ret, i = 0; + RADEONInfoPtr info = RADEONPTR(pScrn); + drmDMAReq dma; + drmBufPtr buf = NULL; + int indx = 0; + int size = 0; + int i = 0; + int ret; #if 0 /* FIXME: pScrn->pScreen has not been initialized when this is first - called from RADEONSelectBuffer via RADEONDRICPInit. We could use - the screen index from pScrn, which is initialized, and then get - the screen from screenInfo.screens[index], but that is a hack. */ + * called from RADEONSelectBuffer via RADEONDRICPInit. We could use + * the screen index from pScrn, which is initialized, and then get + * the screen from screenInfo.screens[index], but that is a hack. + */ dma.context = DRIGetContext(pScrn->pScreen); #else - dma.context = 0x00000001; /* This is the X server's context */ + /* This is the X server's context */ + dma.context = 0x00000001; #endif - dma.send_count = 0; - dma.send_list = NULL; - dma.send_sizes = NULL; - dma.flags = 0; + + dma.send_count = 0; + dma.send_list = NULL; + dma.send_sizes = NULL; + dma.flags = 0; dma.request_count = 1; - dma.request_size = RADEON_BUFFER_SIZE; - dma.request_list = &indx; + dma.request_size = RADEON_BUFFER_SIZE; + dma.request_list = &indx; dma.request_sizes = &size; dma.granted_count = 0; - while ( 1 ) { + while (1) { do { - ret = drmDMA( info->drmFD, &dma ); - if ( ret && ret != -EBUSY ) { - xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "%s: CP GetBuffer %d\n", __FUNCTION__, ret ); + ret = drmDMA(info->drmFD, &dma); + if (ret && ret != -EBUSY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: CP GetBuffer %d\n", __FUNCTION__, ret); } - } while ( ( ret == -EBUSY ) && ( i++ < RADEON_TIMEOUT ) ); + } while ((ret == -EBUSY) && (i++ < RADEON_TIMEOUT)); - if ( ret == 0 ) { + if (ret == 0) { buf = &info->buffers->list[indx]; buf->used = 0; - if ( RADEON_VERBOSE ) { - xf86DrvMsg( pScrn->scrnIndex, X_INFO, - " GetBuffer returning %d\n", buf->idx ); + if (RADEON_VERBOSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + " GetBuffer returning %d %08x\n", + buf->idx, buf->address); } return buf; } - xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "GetBuffer timed out, resetting engine...\n"); - RADEONEngineReset( pScrn ); - RADEONEngineRestore( pScrn ); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "GetBuffer timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); /* Always restart the engine when doing CP 2D acceleration */ - RADEONCP_RESET( pScrn, info ); - RADEONCP_START( pScrn, info ); + RADEONCP_RESET(pScrn, info); + RADEONCP_START(pScrn, info); } } -/* Flush the indirect buffer to the kernel for submission to the card. - */ -void RADEONCPFlushIndirect( ScrnInfoPtr pScrn ) +/* Flush the indirect buffer to the kernel for submission to the card */ +void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard) { - RADEONInfoPtr info = RADEONPTR(pScrn); - drmBufPtr buffer = info->indirectBuffer; - int start = info->indirectStart; - int discard; + RADEONInfoPtr info = RADEONPTR(pScrn); + drmBufPtr buffer = info->indirectBuffer; + int start = info->indirectStart; + drmRadeonIndirect indirect; - if ( !buffer ) - return; + if (!buffer) return; + if (start == buffer->used && !discard) return; - if ( start == buffer->used ) - return; + if (RADEON_VERBOSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Flushing buffer %d\n", + buffer->idx); + } - discard = ( buffer->used + RING_THRESHOLD > buffer->total ); + indirect.idx = buffer->idx; + indirect.start = start; + indirect.end = buffer->used; + indirect.discard = discard; - drmRadeonFlushIndirectBuffer( info->drmFD, buffer->idx, - start, buffer->used, discard ); + drmCommandWriteRead(info->drmFD, DRM_RADEON_INDIRECT, + &indirect, sizeof(drmRadeonIndirect)); - if ( discard ) { - info->indirectBuffer = RADEONCPGetBuffer( pScrn ); - info->indirectStart = 0; + if (discard) { + info->indirectBuffer = RADEONCPGetBuffer(pScrn); + info->indirectStart = 0; } else { - info->indirectStart = buffer->used; + /* Start on a double word boundary */ + info->indirectStart = buffer->used = (buffer->used + 7) & ~7; + if (RADEON_VERBOSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, " Starting at %d\n", + info->indirectStart); + } } } -/* Flush and release the indirect buffer. - */ -void RADEONCPReleaseIndirect( ScrnInfoPtr pScrn ) +/* Flush and release the indirect buffer */ +void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); - drmBufPtr buffer = info->indirectBuffer; - int start = info->indirectStart; + RADEONInfoPtr info = RADEONPTR(pScrn); + drmBufPtr buffer = info->indirectBuffer; + int start = info->indirectStart; + drmRadeonIndirect indirect; info->indirectBuffer = NULL; - info->indirectStart = 0; - - if ( !buffer ) - return; - - drmRadeonFlushIndirectBuffer( info->drmFD, buffer->idx, - start, buffer->used, 1 ); -} - -static void RADEONCPAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - -#if 1 - a->Flags = (PIXMAP_CACHE - | OFFSCREEN_PIXMAPS - | LINEAR_FRAMEBUFFER); -#else - a->Flags = 0; /* GH: Do we really need this? */ -#endif - - /* Sync */ - a->Sync = RADEONCPWaitForIdle; - - /* If direct rendering is disabled, then do not enable any CP - acceleration routines */ - if (!info->directRenderingEnabled) return; - - /* Solid Filled Rectangle */ - a->PolyFillRectSolidFlags = 0; - a->SetupForSolidFill = RADEONCPSetupForSolidFill; - a->SubsequentSolidFillRect = RADEONCPSubsequentSolidFillRect; - - /* Screen-to-screen Copy */ - a->ScreenToScreenCopyFlags = 0; - a->SetupForScreenToScreenCopy = RADEONCPSetupForScreenToScreenCopy; - a->SubsequentScreenToScreenCopy = RADEONCPSubsequentScreenToScreenCopy; - - - a->SetupForDashedLine = RADEONCPSetupForDashedLine; - a->SubsequentDashedTwoPointLine = RADEONCPSubsequentDashedTwoPointLine; - a->DashPatternMaxLength = 32; - /*ROP3 doesn't seem to work properly for dashedline with GXinvert*/ - a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED - | LINE_PATTERN_POWER_OF_2_ONLY - | ROP_NEEDS_SOURCE); - - - a->SolidLineFlags = 0; - a->SetupForSolidLine = RADEONCPSetupForSolidLine; - a->SubsequentSolidTwoPointLine = RADEONCPSubsequentSolidTwoPointLine; - a->SubsequentSolidHorVertLine = RADEONCPSubsequentSolidHorVertLine; - a->SubsequentSolidBresenhamLine = NULL; - - /* clipping */ - a->SetClippingRectangle = RADEONCPSetClippingRectangle; - a->DisableClipping = RADEONCPDisableClipping; - a->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | - HARDWARE_CLIP_DASHED_LINE | - /*HARDWARE_CLIP_SOLID_FILL |*/ /* seems very slow with this on ???*/ - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY; - - if(!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0])) - a->RestoreAccelState = RADEONRestoreCPAccelState; - -} -#endif - -static void RADEONMMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - a->Flags = (PIXMAP_CACHE - | OFFSCREEN_PIXMAPS - | LINEAR_FRAMEBUFFER); - - /* Sync */ - a->Sync = RADEONWaitForIdle; - - /* Solid Filled Rectangle */ - a->PolyFillRectSolidFlags = 0; - a->SetupForSolidFill = RADEONSetupForSolidFill; - a->SubsequentSolidFillRect = RADEONSubsequentSolidFillRect; - - /* Screen-to-screen Copy */ - a->ScreenToScreenCopyFlags = 0; - a->SetupForScreenToScreenCopy = RADEONSetupForScreenToScreenCopy; - a->SubsequentScreenToScreenCopy = RADEONSubsequentScreenToScreenCopy; - - /* Mono 8x8 Pattern Fill (Color Expand) */ - a->SetupForMono8x8PatternFill - = RADEONSetupForMono8x8PatternFill; - a->SubsequentMono8x8PatternFillRect - = RADEONSubsequentMono8x8PatternFillRect; - a->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS - | HARDWARE_PATTERN_PROGRAMMED_ORIGIN - | HARDWARE_PATTERN_SCREEN_ORIGIN - | BIT_ORDER_IN_BYTE_LSBFIRST); - - /* Indirect CPU-To-Screen Color Expand */ -#if X_BYTE_ORDER == X_LITTLE_ENDIAN - a->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING - /* RADEON gets upset, when using HOST provided data - * without a source rop. To show run 'xtest's drwarc */ - | ROP_NEEDS_SOURCE - | LEFT_EDGE_CLIPPING_NEGATIVE_X; -#else - a->ScanlineCPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST - /* RADEON gets upset, when using HOST provided data - * without a source rop. To show run 'xtest's drwarc */ - | ROP_NEEDS_SOURCE - | LEFT_EDGE_CLIPPING - | LEFT_EDGE_CLIPPING_NEGATIVE_X; -#endif - a->NumScanlineColorExpandBuffers = 1; - a->ScanlineColorExpandBuffers = info->scratch_buffer; - info->scratch_save = xalloc(((pScrn->virtualX+31)/32*4) - + (pScrn->virtualX - * info->CurrentLayout.pixel_bytes)); - info->scratch_buffer[0] = info->scratch_save; - a->SetupForScanlineCPUToScreenColorExpandFill - = RADEONSetupForScanlineCPUToScreenColorExpandFill; - a->SubsequentScanlineCPUToScreenColorExpandFill - = RADEONSubsequentScanlineCPUToScreenColorExpandFill; - a->SubsequentColorExpandScanline = RADEONSubsequentColorExpandScanline; - - a->SetupForSolidLine = RADEONSetupForSolidLine; - a->SubsequentSolidTwoPointLine = RADEONSubsequentSolidTwoPointLine; - a->SubsequentSolidHorVertLine = RADEONSubsequentSolidHorVertLine; - - a->SetupForDashedLine = RADEONSetupForDashedLine; - a->SubsequentDashedTwoPointLine = RADEONSubsequentDashedTwoPointLine; - a->DashPatternMaxLength = 32; - /*ROP3 doesn't seem to work properly for dashedline with GXinvert*/ - a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED - | LINE_PATTERN_POWER_OF_2_ONLY - | ROP_NEEDS_SOURCE); - - /* clipping, note without this, - all line accelerations will not be called */ - a->SetClippingRectangle = RADEONSetClippingRectangle; - a->DisableClipping = RADEONDisableClipping; - a->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | - HARDWARE_CLIP_DASHED_LINE | - /*HARDWARE_CLIP_SOLID_FILL |*/ /* seems very slow with this on ???*/ - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY; + info->indirectStart = 0; + if (!buffer) return; - if(xf86IsEntityShared(pScrn->entityList[0])) - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - - /*if there are more than one devices sharing this entity, we - have to assign this call back, otherwise the XAA will be - disabled */ - if(pRADEONEnt->HasSecondary || pRADEONEnt->BypassSecondary) - a->RestoreAccelState = RADEONRestoreAccelState; + if (RADEON_VERBOSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Releasing buffer %d\n", + buffer->idx); } - /* ImageWrite */ - a->NumScanlineImageWriteBuffers = 1; - a->ScanlineImageWriteBuffers = info->scratch_buffer; - info->scratch_buffer[0] = info->scratch_save; - a->SetupForScanlineImageWrite = RADEONSetupForScanlineImageWrite; - a->SubsequentScanlineImageWriteRect - = RADEONSubsequentScanlineImageWriteRect; - a->SubsequentImageWriteScanline = RADEONSubsequentImageWriteScanline; - a->ScanlineImageWriteFlags = CPU_TRANSFER_PAD_DWORD - /* Performance tests show that we shouldn't use GXcopy for - * uploads as a memcpy is faster */ - | NO_GXCOPY - /* RADEON gets upset, when using HOST provided data - * without a source rop. To show run 'xtest's ptimg */ - | ROP_NEEDS_SOURCE - | SCANLINE_PAD_DWORD - | LEFT_EDGE_CLIPPING - | LEFT_EDGE_CLIPPING_NEGATIVE_X; + indirect.idx = buffer->idx; + indirect.start = start; + indirect.end = buffer->used; + indirect.discard = 1; -#if 0 - /* Color 8x8 Pattern Fill */ - a->SetupForColor8x8PatternFill - = RADEONSetupForColor8x8PatternFill; - a->SubsequentColor8x8PatternFillRect - = RADEONSubsequentColor8x8PatternFillRect; - a->Color8x8PatternFillFlags = - HARDWARE_PATTERN_PROGRAMMED_ORIGIN - | HARDWARE_PATTERN_SCREEN_ORIGIN - | BIT_ORDER_IN_BYTE_LSBFIRST; -#endif + drmCommandWriteRead(info->drmFD, DRM_RADEON_INDIRECT, + &indirect, sizeof(drmRadeonIndirect)); } +#endif /* Initialize XAA for supported acceleration and also initialize the - graphics hardware for acceleration. */ + * graphics hardware for acceleration + */ Bool RADEONAccelInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - XAAInfoRecPtr a; - - if (!(a = info->accel = XAACreateInfoRec())) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "XAACreateInfoRec Error\n"); - return FALSE; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + XAAInfoRecPtr a; + + if (!(a = info->accel = XAACreateInfoRec())) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "XAACreateInfoRec Error\n"); + return FALSE; } + #ifdef XF86DRI if (info->directRenderingEnabled) - RADEONCPAccelInit(pScrn, a); + RADEONAccelInitCP(pScreen, a); else #endif - RADEONMMIOAccelInit(pScrn, a); + RADEONAccelInitMMIO(pScreen, a); RADEONEngineInit(pScrn); - - if(!XAAInit(pScreen, a)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "XAAInit Error\n"); - return FALSE; - } + + if (!XAAInit(pScreen, a)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "XAAInit Error\n"); + return FALSE; + } + return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c:1.6 --- /dev/null Thu Feb 27 12:30:38 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c Wed Jan 29 13:06:06 2003 @@ -0,0 +1,1372 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c,v 1.6 2003/01/29 18:06:06 martin Exp $ */ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and + * VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin <martin@xfree86.org> + * Rickard E. Faith <faith@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> + * Michel Dänzer <michel@daenzer.net> + * + * Credits: + * + * Thanks to Ani Joshi <ajoshi@shell.unixbox.com> for providing source + * code to his Radeon driver. Portions of this file are based on the + * initialization code for that driver. + * + * References: + * + * !!!! FIXME !!!! + * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical + * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April + * 1999. + * + * RAGE 128 Software Development Manual (Technical Reference Manual P/N + * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999. + * + * Notes on unimplemented XAA optimizations: + * + * SetClipping: This has been removed as XAA expects 16bit registers + * for full clipping. + * TwoPointLine: The Radeon supports this. Not Bresenham. + * DashedLine with non-power-of-two pattern length: Apparently, there is + * no way to set the length of the pattern -- it is always + * assumed to be 8 or 32 (or 1024?). + * ScreenToScreenColorExpandFill: See p. 4-17 of the Technical Reference + * Manual where it states that monochrome expansion of frame + * buffer data is not supported. + * CPUToScreenColorExpandFill, direct: The implementation here uses a hybrid + * direct/indirect method. If we had more data registers, + * then we could do better. If XAA supported a trigger write + * address, the code would be simpler. + * Color8x8PatternFill: Apparently, an 8x8 color brush cannot take an 8x8 + * pattern from frame buffer memory. + * ImageWrites: Same as CPUToScreenColorExpandFill + * + */ + +#if defined(ACCEL_MMIO) && defined(ACCEL_CP) +#error Cannot define both MMIO and CP acceleration! +#endif + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define FUNC_NAME_CAT(prefix,suffix) prefix##suffix +#else +#define FUNC_NAME_CAT(prefix,suffix) prefix/**/suffix +#endif + +#ifdef ACCEL_MMIO +#define FUNC_NAME(prefix) FUNC_NAME_CAT(prefix,MMIO) +#else +#ifdef ACCEL_CP +#define FUNC_NAME(prefix) FUNC_NAME_CAT(prefix,CP) +#else +#error No accel type defined! +#endif +#endif + +/* MMIO: + * + * Wait for the graphics engine to be completely idle: the FIFO has + * drained, the Pixel Cache is flushed, and the engine is idle. This is + * a standard "sync" function that will make the hardware "quiescent". + * + * CP: + * + * Wait until the CP is completely idle: the FIFO has drained and the CP + * is idle. + */ +void +FUNC_NAME(RADEONWaitForIdle)(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + int i = 0; + +#ifdef ACCEL_CP + /* Make sure the CP is idle first */ + if (info->CPStarted) { + int ret; + FLUSH_RING(); + + for (;;) { + do { + ret = drmCommandNone(info->drmFD, DRM_RADEON_CP_IDLE); + if (ret && ret != -EBUSY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: CP idle %d\n", __FUNCTION__, ret); + } + } while ((ret == -EBUSY) && (i++ < RADEON_TIMEOUT)); + + if (ret == 0) return; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); + + /* Always restart the engine when doing CP 2D acceleration */ + RADEONCP_RESET(pScrn, info); + RADEONCP_START(pScrn, info); + } + } +#endif + + RADEONTRACE(("WaitForIdle (entering): %d entries, stat=0x%08x\n", + INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, + INREG(RADEON_RBBM_STATUS))); + + /* Wait for the engine to go idle */ + RADEONWaitForFifoFunction(pScrn, 64); + + for (;;) { + for (i = 0; i < RADEON_TIMEOUT; i++) { + if (!(INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)) { + RADEONEngineFlush(pScrn); + return; + } + } + RADEONTRACE(("Idle timed out: %d entries, stat=0x%08x\n", + INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, + INREG(RADEON_RBBM_STATUS))); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + RADEONCP_RESET(pScrn, info); + RADEONCP_START(pScrn, info); + } +#endif + } +} + +/* This callback is required for multiheader cards using XAA */ +static void +FUNC_NAME(RADEONRestoreAccelState)(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + +#ifdef ACCEL_MMIO + + CARD32 pitch64; + RADEONEntPtr pRADEONEnt; + DevUnion *pPriv; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; +#if 0 + /* Not working yet */ + if (pRADEONEnt->IsDRIEnabled) { + RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + RADEONCP_TO_MMIO(pRADEONEnt->pPrimaryScrn, info0); + } +#endif + pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; + + OUTREG(RADEON_DEFAULT_OFFSET, ((pScrn->fbOffset>>10) | + (pitch64 << 22))); + + /* FIXME: May need to restore other things, like BKGD_CLK FG_CLK... */ + + RADEONWaitForIdleMMIO(pScrn); + +#else /* ACCEL_CP */ + + RADEONWaitForFifo(pScrn, 1); + OUTREG(RADEON_DEFAULT_OFFSET, info->frontPitchOffset); + + RADEONWaitForIdleMMIO(pScrn); + +#if 0 + /* Not working yet */ + RADEONMMIO_TO_CP(pScrn, info); +#endif + + /* FIXME: May need to restore other things, like BKGD_CLK FG_CLK... */ +#endif +} + +/* Setup for XAA SolidFill */ +static void +FUNC_NAME(RADEONSetupForSolidFill)(ScrnInfoPtr pScrn, + int color, + int rop, + unsigned int planemask) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_SOLID_COLOR + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].pattern); + + BEGIN_ACCEL(4); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, color); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_ACCEL_REG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT + | RADEON_DST_Y_TOP_TO_BOTTOM)); + + FINISH_ACCEL(); +} + +/* Subsequent XAA SolidFillRect + * + * Tests: xtest CH06/fllrctngl, xterm + */ +static void +FUNC_NAME(RADEONSubsequentSolidFillRect)(ScrnInfoPtr pScrn, + int x, int y, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + BEGIN_ACCEL(2); + + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | x); + OUT_ACCEL_REG(RADEON_DST_WIDTH_HEIGHT, (w << 16) | h); + + FINISH_ACCEL(); +} + +/* Setup for XAA solid lines */ +static void +FUNC_NAME(RADEONSetupForSolidLine)(ScrnInfoPtr pScrn, + int color, + int rop, + unsigned int planemask) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_SOLID_COLOR + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].pattern); + + if (info->ChipFamily >= CHIP_FAMILY_RV200) { + BEGIN_ACCEL(1); + OUT_ACCEL_REG(RADEON_DST_LINE_PATCOUNT, + 0x55 << RADEON_BRES_CNTL_SHIFT); + } + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, color); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + + FINISH_ACCEL(); +} + +/* Subsequent XAA solid horizontal and vertical lines */ +static void +FUNC_NAME(RADEONSubsequentSolidHorVertLine)(ScrnInfoPtr pScrn, + int x, int y, + int len, + int dir) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + int w = 1; + int h = 1; + ACCEL_PREAMBLE(); + + if (dir == DEGREES_0) w = len; + else h = len; + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT + | RADEON_DST_Y_TOP_TO_BOTTOM)); + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | x); + OUT_ACCEL_REG(RADEON_DST_WIDTH_HEIGHT, (w << 16) | h); + + FINISH_ACCEL(); +} + +/* Subsequent XAA solid TwoPointLine line + * + * Tests: xtest CH06/drwln, ico, Mark Vojkovich's linetest program + * + * [See http://www.xfree86.org/devel/archives/devel/1999-Jun/0102.shtml for + * Mark Vojkovich's linetest program, posted 2Jun99 to devel@xfree86.org.] + */ +static void +FUNC_NAME(RADEONSubsequentSolidTwoPointLine)(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int flags) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + /* TODO: Check bounds -- RADEON only has 14 bits */ + + if (!(flags & OMIT_LAST)) + FUNC_NAME(RADEONSubsequentSolidHorVertLine)(pScrn, + xb, yb, 1, + DEGREES_0); + + BEGIN_ACCEL(2); + + OUT_ACCEL_REG(RADEON_DST_LINE_START, (ya << 16) | xa); + OUT_ACCEL_REG(RADEON_DST_LINE_END, (yb << 16) | xb); + + FINISH_ACCEL(); +} + +/* Setup for XAA dashed lines + * + * Tests: xtest CH05/stdshs, XFree86/drwln + * + * NOTE: Since we can only accelerate lines with power-of-2 patterns of + * length <= 32 + */ +static void +FUNC_NAME(RADEONSetupForDashedLine)(ScrnInfoPtr pScrn, + int fg, + int bg, + int rop, + unsigned int planemask, + int length, + unsigned char *pattern) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + CARD32 pat = *(CARD32 *)(pointer)pattern; + ACCEL_PREAMBLE(); + + /* Save for determining whether or not to draw last pixel */ + info->dashLen = length; + info->dashPattern = pat; + +#if X_BYTE_ORDER == X_BIG_ENDIAN +# define PAT_SHIFT(pat, shift) (pat >> shift) +#else +# define PAT_SHIFT(pat, shift) (pat << shift) +#endif + + switch (length) { + case 2: pat |= PAT_SHIFT(pat, 2); /* fall through */ + case 4: pat |= PAT_SHIFT(pat, 4); /* fall through */ + case 8: pat |= PAT_SHIFT(pat, 8); /* fall through */ + case 16: pat |= PAT_SHIFT(pat, 16); + } + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | (bg == -1 + ? RADEON_GMC_BRUSH_32x1_MONO_FG_LA + : RADEON_GMC_BRUSH_32x1_MONO_FG_BG) + | RADEON_ROP[rop].pattern + | RADEON_GMC_BYTE_LSB_TO_MSB); + info->dash_fg = fg; + info->dash_bg = bg; + + BEGIN_ACCEL((bg == -1) ? 4 : 5); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, fg); + if (bg != -1) + OUT_ACCEL_REG(RADEON_DP_BRUSH_BKGD_CLR, bg); + OUT_ACCEL_REG(RADEON_BRUSH_DATA0, pat); + + FINISH_ACCEL(); +} + +/* Helper function to draw last point for dashed lines */ +static void +FUNC_NAME(RADEONDashedLastPel)(ScrnInfoPtr pScrn, + int x, int y, + int fg) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + CARD32 dp_gui_master_cntl = info->dp_gui_master_cntl_clip; + ACCEL_PREAMBLE(); + + dp_gui_master_cntl &= ~RADEON_GMC_BRUSH_DATATYPE_MASK; + dp_gui_master_cntl |= RADEON_GMC_BRUSH_SOLID_COLOR; + + dp_gui_master_cntl &= ~RADEON_GMC_SRC_DATATYPE_MASK; + dp_gui_master_cntl |= RADEON_GMC_SRC_DATATYPE_COLOR; + + BEGIN_ACCEL(7); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, dp_gui_master_cntl); + OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, fg); + OUT_ACCEL_REG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT + | RADEON_DST_Y_TOP_TO_BOTTOM)); + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | x); + OUT_ACCEL_REG(RADEON_DST_WIDTH_HEIGHT, (1 << 16) | 1); + + /* Restore old values */ + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, info->dash_fg); + + FINISH_ACCEL(); +} + +/* Subsequent XAA dashed line */ +static void +FUNC_NAME(RADEONSubsequentDashedTwoPointLine)(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int flags, + int phase) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + /* TODO: Check bounds -- RADEON only has 14 bits */ + + if (!(flags & OMIT_LAST)) { + int deltax = abs(xa - xb); + int deltay = abs(ya - yb); + int shift; + + if (deltax > deltay) shift = deltax; + else shift = deltay; + + shift += phase; + shift %= info->dashLen; + + if ((info->dashPattern >> shift) & 1) + FUNC_NAME(RADEONDashedLastPel)(pScrn, xb, yb, info->dash_fg); + else if (info->dash_bg != -1) + FUNC_NAME(RADEONDashedLastPel)(pScrn, xb, yb, info->dash_bg); + } + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DST_LINE_START, (ya << 16) | xa); + OUT_ACCEL_REG(RADEON_DST_LINE_PATCOUNT, phase); + OUT_ACCEL_REG(RADEON_DST_LINE_END, (yb << 16) | xb); + + FINISH_ACCEL(); +} + +/* Set up for transparency + * + * Mmmm, Seems as though the transparency compare is opposite to r128. + * It should only draw when source != trans_color, this is the opposite + * of that. + */ +static void +FUNC_NAME(RADEONSetTransparency)(ScrnInfoPtr pScrn, + int trans_color) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { + ACCEL_PREAMBLE(); + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_CLR_CMP_CLR_SRC, trans_color); + OUT_ACCEL_REG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK); + OUT_ACCEL_REG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR + | RADEON_CLR_CMP_SRC_SOURCE)); + + FINISH_ACCEL(); + } +} + +/* Setup for XAA screen-to-screen copy + * + * Tests: xtest CH06/fllrctngl (also tests transparency) + */ +static void +FUNC_NAME(RADEONSetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, + int xdir, int ydir, + int rop, + unsigned int planemask, + int trans_color) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + info->xdir = xdir; + info->ydir = ydir; + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_NONE + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].rop + | RADEON_DP_SRC_SOURCE_MEMORY); + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_ACCEL_REG(RADEON_DP_CNTL, + ((xdir >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) | + (ydir >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0))); + + FINISH_ACCEL(); + + info->trans_color = trans_color; + FUNC_NAME(RADEONSetTransparency)(pScrn, trans_color); +} + +/* Subsequent XAA screen-to-screen copy */ +static void +FUNC_NAME(RADEONSubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + if (info->xdir < 0) xa += w - 1, xb += w - 1; + if (info->ydir < 0) ya += h - 1, yb += h - 1; + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_SRC_Y_X, (ya << 16) | xa); + OUT_ACCEL_REG(RADEON_DST_Y_X, (yb << 16) | xb); + OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); + + FINISH_ACCEL(); +} + +/* Setup for XAA mono 8x8 pattern color expansion. Patterns with + * transparency use `bg == -1'. This routine is only used if the XAA + * pixmap cache is turned on. + * + * Tests: xtest XFree86/fllrctngl (no other test will test this routine with + * both transparency and non-transparency) + */ +static void +FUNC_NAME(RADEONSetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, + int patternx, + int patterny, + int fg, + int bg, + int rop, + unsigned int planemask) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned char pattern[8]; +#endif + ACCEL_PREAMBLE(); + +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* Take care of endianness */ + pattern[0] = (patternx & 0x000000ff); + pattern[1] = (patternx & 0x0000ff00) >> 8; + pattern[2] = (patternx & 0x00ff0000) >> 16; + pattern[3] = (patternx & 0xff000000) >> 24; + pattern[4] = (patterny & 0x000000ff); + pattern[5] = (patterny & 0x0000ff00) >> 8; + pattern[6] = (patterny & 0x00ff0000) >> 16; + pattern[7] = (patterny & 0xff000000) >> 24; +#endif + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | (bg == -1 + ? RADEON_GMC_BRUSH_8X8_MONO_FG_LA + : RADEON_GMC_BRUSH_8X8_MONO_FG_BG) + | RADEON_ROP[rop].pattern +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + | RADEON_GMC_BYTE_MSB_TO_LSB +#endif + ); + + BEGIN_ACCEL((bg == -1) ? 5 : 6); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, fg); + if (bg != -1) + OUT_ACCEL_REG(RADEON_DP_BRUSH_BKGD_CLR, bg); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + OUT_ACCEL_REG(RADEON_BRUSH_DATA0, patternx); + OUT_ACCEL_REG(RADEON_BRUSH_DATA1, patterny); +#else + OUT_ACCEL_REG(RADEON_BRUSH_DATA0, *(CARD32 *)(pointer)&pattern[0]); + OUT_ACCEL_REG(RADEON_BRUSH_DATA1, *(CARD32 *)(pointer)&pattern[4]); +#endif + + FINISH_ACCEL(); +} + +/* Subsequent XAA 8x8 pattern color expansion. Because they are used in + * the setup function, `patternx' and `patterny' are not used here. + */ +static void +FUNC_NAME(RADEONSubsequentMono8x8PatternFillRect)(ScrnInfoPtr pScrn, + int patternx, + int patterny, + int x, int y, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_BRUSH_Y_X, (patterny << 8) | patternx); + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | x); + OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); + + FINISH_ACCEL(); +} + +#if 0 +/* Setup for XAA color 8x8 pattern fill + * + * Tests: xtest XFree86/fllrctngl (with Mono8x8PatternFill off) + */ +static void +FUNC_NAME(RADEONSetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, + int patx, int paty, + int rop, + unsigned int planemask, + int trans_color) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_8x8_COLOR + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].pattern + | RADEON_DP_SRC_SOURCE_MEMORY); + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_ACCEL_REG(RADEON_SRC_Y_X, (paty << 16) | patx); + + FINISH_ACCEL(); + + info->trans_color = trans_color; + FUNC_NAME(RADEONSetTransparency)(pScrn, trans_color); +} + +/* Subsequent XAA 8x8 pattern color expansion */ +static void +FUNC_NAME(RADEONSubsequentColor8x8PatternFillRect)(ScrnInfoPtr pScrn, + int patx, int paty, + int x, int y, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_BRUSH_Y_X, (paty << 16) | patx); + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | x); + OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); + + FINISH_ACCEL(); +} +#endif + +#ifdef ACCEL_CP +#define CP_BUFSIZE (info->indirectBuffer->total/4-9) + +/* Helper function to write out a HOSTDATA_BLT packet into the indirect + * buffer and set the XAA scratch buffer address appropriately. + */ +static void +RADEONCPScanlinePacket(ScrnInfoPtr pScrn, int bufno) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + int chunk_words = info->scanline_hpass * info->scanline_words; + ACCEL_PREAMBLE(); + + if (RADEON_VERBOSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CPScanline Packet h=%d hpass=%d chunkwords=%d\n", + info->scanline_h, info->scanline_hpass, chunk_words); + } + BEGIN_RING(chunk_words+9); + + OUT_RING(CP_PACKET3(RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT,chunk_words+9-2)); + OUT_RING(info->dp_gui_master_cntl_clip); + OUT_RING((info->scanline_y << 16) | + (info->scanline_x1clip & 0xffff)); + OUT_RING(((info->scanline_y+info->scanline_hpass) << 16) | + (info->scanline_x2clip & 0xffff)); + OUT_RING(info->scanline_fg); + OUT_RING(info->scanline_bg); + OUT_RING((info->scanline_y << 16) | + (info->scanline_x & 0xffff)); + OUT_RING((info->scanline_hpass << 16) | + (info->scanline_w & 0xffff)); + OUT_RING(chunk_words); + + info->scratch_buffer[bufno] = (unsigned char *)&__head[__count]; + __count += chunk_words; + + /* The ring can only be advanced after the __head and __count have + been adjusted above */ + FINISH_ACCEL(); + + info->scanline_y += info->scanline_hpass; + info->scanline_h -= info->scanline_hpass; +} +#endif + +/* Setup for XAA indirect CPU-to-screen color expansion (indirect). + * Because of how the scratch buffer is initialized, this is really a + * mainstore-to-screen color expansion. Transparency is supported when + * `bg == -1'. + */ +static void +FUNC_NAME(RADEONSetupForScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, + int fg, + int bg, + int rop, + unsigned int + planemask) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | RADEON_GMC_DST_CLIPPING + | RADEON_GMC_BRUSH_NONE + | (bg == -1 + ? RADEON_GMC_SRC_DATATYPE_MONO_FG_LA + : RADEON_GMC_SRC_DATATYPE_MONO_FG_BG) + | RADEON_ROP[rop].rop +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + | RADEON_GMC_BYTE_LSB_TO_MSB +#else + | RADEON_GMC_BYTE_MSB_TO_LSB +#endif + | RADEON_DP_SRC_SOURCE_HOST_DATA); + +#ifdef ACCEL_MMIO + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + BEGIN_ACCEL(4); +#else + BEGIN_ACCEL(5); + + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_NONE); +#endif + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_ACCEL_REG(RADEON_DP_SRC_FRGD_CLR, fg); + OUT_ACCEL_REG(RADEON_DP_SRC_BKGD_CLR, bg); + +#else /* ACCEL_CP */ + + info->scanline_fg = fg; + info->scanline_bg = bg; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + BEGIN_ACCEL(1); +#else + BEGIN_ACCEL(2); + + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_32BIT); +#endif + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + +#endif + + FINISH_ACCEL(); +} + +/* Subsequent XAA indirect CPU-to-screen color expansion. This is only + * called once for each rectangle. + */ +static void +FUNC_NAME(RADEONSubsequentScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr + pScrn, + int x, int y, + int w, int h, + int skipleft) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef ACCEL_MMIO + ACCEL_PREAMBLE(); + + info->scanline_h = h; + info->scanline_words = (w + 31) >> 5; + +#ifdef __alpha__ + /* Always use indirect for Alpha */ + if (0) +#else + if ((info->scanline_words * h) <= 9) +#endif + { + /* Turn on direct for less than 9 dword colour expansion */ + info->scratch_buffer[0] = + (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) + - (info->scanline_words - 1)); + info->scanline_direct = 1; + } else { + /* Use indirect for anything else */ + info->scratch_buffer[0] = info->scratch_save; + info->scanline_direct = 0; + } + + BEGIN_ACCEL(4 + (info->scanline_direct ? + (info->scanline_words * h) : 0)); + + OUT_ACCEL_REG(RADEON_SC_TOP_LEFT, (y << 16) | ((x+skipleft) + & 0xffff)); + OUT_ACCEL_REG(RADEON_SC_BOTTOM_RIGHT, ((y+h) << 16) | ((x+w) & 0xffff)); + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | (x & 0xffff)); + /* Have to pad the width here and use clipping engine */ + OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31)); + + FINISH_ACCEL(); + +#else /* ACCEL_CP */ + + info->scanline_x = x; + info->scanline_y = y; + /* Have to pad the width here and use clipping engine */ + info->scanline_w = (w + 31) & ~31; + info->scanline_h = h; + + info->scanline_x1clip = x + skipleft; + info->scanline_x2clip = x + w; + + info->scanline_words = info->scanline_w / 32; + info->scanline_hpass = min(h,(CP_BUFSIZE/info->scanline_words)); + + RADEONCPScanlinePacket(pScrn, 0); + +#endif +} + +/* Subsequent XAA indirect CPU-to-screen color expansion and indirect + * image write. This is called once for each scanline. + */ +static void +FUNC_NAME(RADEONSubsequentScanline)(ScrnInfoPtr pScrn, + int bufno) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef ACCEL_MMIO + CARD32 *p = (pointer)info->scratch_buffer[bufno]; + int i; + int left = info->scanline_words; + volatile CARD32 *d; + ACCEL_PREAMBLE(); + + if (info->scanline_direct) return; + + --info->scanline_h; + + while (left) { + write_mem_barrier(); + if (left <= 8) { + /* Last scanline - finish write to DATA_LAST */ + if (info->scanline_h == 0) { + BEGIN_ACCEL(left); + /* Unrolling doesn't improve performance */ + for (d = ADDRREG(RADEON_HOST_DATA_LAST) - (left - 1); left; --left) + *d++ = *p++; + return; + } else { + BEGIN_ACCEL(left); + /* Unrolling doesn't improve performance */ + for (d = ADDRREG(RADEON_HOST_DATA7) - (left - 1); left; --left) + *d++ = *p++; + } + } else { + BEGIN_ACCEL(8); + /* Unrolling doesn't improve performance */ + for (d = ADDRREG(RADEON_HOST_DATA0), i = 0; i < 8; i++) + *d++ = *p++; + left -= 8; + } + } + + FINISH_ACCEL(); + +#else /* ACCEL_CP */ + + if (--info->scanline_hpass) { + info->scratch_buffer[bufno] += 4 * info->scanline_words; + } else if (info->scanline_h) { + info->scanline_hpass = + min(info->scanline_h,(CP_BUFSIZE/info->scanline_words)); + RADEONCPScanlinePacket(pScrn, bufno); + } + +#endif +} + +/* Setup for XAA indirect image write */ +static void +FUNC_NAME(RADEONSetupForScanlineImageWrite)(ScrnInfoPtr pScrn, + int rop, + unsigned int planemask, + int trans_color, + int bpp, + int depth) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + info->scanline_bpp = bpp; + + /* Save for later clipping */ + info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl + | RADEON_GMC_DST_CLIPPING + | RADEON_GMC_BRUSH_NONE + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].rop + | RADEON_GMC_BYTE_MSB_TO_LSB + | RADEON_DP_SRC_SOURCE_HOST_DATA); + +#ifdef ACCEL_MMIO + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + BEGIN_ACCEL(2); +#else + BEGIN_ACCEL(3); + + if (bpp == 16) + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_16BIT); + else if (bpp == 32) + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_32BIT); + else + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_NONE); +#endif + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + +#else /* ACCEL_CP */ + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + BEGIN_ACCEL(1); +#else + BEGIN_ACCEL(2); + + if (bpp == 16) + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_HDW); + else + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_NONE); +#endif +#endif + OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); + + FINISH_ACCEL(); + + info->trans_color = trans_color; + FUNC_NAME(RADEONSetTransparency)(pScrn, trans_color); +} + +/* Subsequent XAA indirect image write. This is only called once for + * each rectangle. + */ +static void +FUNC_NAME(RADEONSubsequentScanlineImageWriteRect)(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + +#ifdef ACCEL_MMIO + + int shift = 0; /* 32bpp */ + ACCEL_PREAMBLE(); + + if (pScrn->bitsPerPixel == 8) shift = 3; + else if (pScrn->bitsPerPixel == 16) shift = 1; + + info->scanline_h = h; + info->scanline_words = (w * info->scanline_bpp + 31) >> 5; + +#ifdef __alpha__ + /* Always use indirect for Alpha */ + if (0) +#else + if ((info->scanline_words * h) <= 9) +#endif + { + /* Turn on direct for less than 9 dword colour expansion */ + info->scratch_buffer[0] + = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) + - (info->scanline_words - 1)); + info->scanline_direct = 1; + } else { + /* Use indirect for anything else */ + info->scratch_buffer[0] = info->scratch_save; + info->scanline_direct = 0; + } + + BEGIN_ACCEL(4 + (info->scanline_direct ? + (info->scanline_words * h) : 0)); + + OUT_ACCEL_REG(RADEON_SC_TOP_LEFT, (y << 16) | ((x+skipleft) + & 0xffff)); + OUT_ACCEL_REG(RADEON_SC_BOTTOM_RIGHT, ((y+h) << 16) | ((x+w) & 0xffff)); + OUT_ACCEL_REG(RADEON_DST_Y_X, (y << 16) | (x & 0xffff)); + /* Have to pad the width here and use clipping engine */ + OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + shift) & + ~shift)); + + FINISH_ACCEL(); + +#else /* ACCEL_CP */ + + int pad = 0; /* 32bpp */ + + if (pScrn->bitsPerPixel == 8) pad = 3; + else if (pScrn->bitsPerPixel == 16) pad = 1; + + info->scanline_x = x; + info->scanline_y = y; + /* Have to pad the width here and use clipping engine */ + info->scanline_w = (w + pad) & ~pad; + info->scanline_h = h; + + info->scanline_x1clip = x + skipleft; + info->scanline_x2clip = x + w; + + info->scanline_words = (w * info->scanline_bpp + 31) / 32; + info->scanline_hpass = min(h,(CP_BUFSIZE/info->scanline_words)); + + RADEONCPScanlinePacket(pScrn, 0); + +#endif +} + +/* Set up the clipping rectangle */ +static void +FUNC_NAME(RADEONSetClippingRectangle)(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long tmp1 = 0; + unsigned long tmp2 = 0; + ACCEL_PREAMBLE(); + + if (xa < 0) { + tmp1 = (-xa) & 0x3fff; + tmp1 |= RADEON_SC_SIGN_MASK_LO; + } else { + tmp1 = xa; + } + + if (ya < 0) { + tmp1 |= (((-ya) & 0x3fff) << 16); + tmp1 |= RADEON_SC_SIGN_MASK_HI; + } else { + tmp1 |= (ya << 16); + } + + xb++; yb++; + + if (xb < 0) { + tmp2 = (-xb) & 0x3fff; + tmp2 |= RADEON_SC_SIGN_MASK_LO; + } else { + tmp2 = xb; + } + + if (yb < 0) { + tmp2 |= (((-yb) & 0x3fff) << 16); + tmp2 |= RADEON_SC_SIGN_MASK_HI; + } else { + tmp2 |= (yb << 16); + } + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl_clip + | RADEON_GMC_DST_CLIPPING)); + OUT_ACCEL_REG(RADEON_SC_TOP_LEFT, tmp1); + OUT_ACCEL_REG(RADEON_SC_BOTTOM_RIGHT, tmp2); + + FINISH_ACCEL(); + + FUNC_NAME(RADEONSetTransparency)(pScrn, info->trans_color); +} + +/* Disable the clipping rectangle */ +static void +FUNC_NAME(RADEONDisableClipping)(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + BEGIN_ACCEL(3); + + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_clip); + OUT_ACCEL_REG(RADEON_SC_TOP_LEFT, 0); + OUT_ACCEL_REG(RADEON_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX | + RADEON_DEFAULT_SC_BOTTOM_MAX)); + + FINISH_ACCEL(); + + FUNC_NAME(RADEONSetTransparency)(pScrn, info->trans_color); +} + +#ifdef ACCEL_CP +/* Point the DST_PITCH_OFFSET register at the current buffer. This + * allows us to interact with the back and depth buffers. All CP 2D + * acceleration commands use the DST_PITCH_OFFSET register. + */ +void +RADEONSelectBuffer(ScrnInfoPtr pScrn, int buffer) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + switch (buffer) { + case RADEON_BACK: + info->dst_pitch_offset = info->backPitchOffset; + break; + case RADEON_DEPTH: + info->dst_pitch_offset = info->depthPitchOffset; + break; + default: + case RADEON_FRONT: + info->dst_pitch_offset = info->frontPitchOffset; + break; + } + + BEGIN_ACCEL(1); + + OUT_ACCEL_REG(RADEON_DEFAULT_OFFSET, info->dst_pitch_offset); + + FINISH_ACCEL(); +} +#endif + +static void +FUNC_NAME(RADEONAccelInit)(ScreenPtr pScreen, XAAInfoRecPtr a) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + a->Flags = (PIXMAP_CACHE + | OFFSCREEN_PIXMAPS + | LINEAR_FRAMEBUFFER); + + /* Sync */ + a->Sync = FUNC_NAME(RADEONWaitForIdle); + + /* Solid Filled Rectangle */ + a->PolyFillRectSolidFlags = 0; + a->SetupForSolidFill + = FUNC_NAME(RADEONSetupForSolidFill); + a->SubsequentSolidFillRect + = FUNC_NAME(RADEONSubsequentSolidFillRect); + + /* Screen-to-screen Copy */ + a->ScreenToScreenCopyFlags = 0; + a->SetupForScreenToScreenCopy + = FUNC_NAME(RADEONSetupForScreenToScreenCopy); + a->SubsequentScreenToScreenCopy + = FUNC_NAME(RADEONSubsequentScreenToScreenCopy); + + /* Mono 8x8 Pattern Fill (Color Expand) */ + a->SetupForMono8x8PatternFill + = FUNC_NAME(RADEONSetupForMono8x8PatternFill); + a->SubsequentMono8x8PatternFillRect + = FUNC_NAME(RADEONSubsequentMono8x8PatternFillRect); + a->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS + | HARDWARE_PATTERN_PROGRAMMED_ORIGIN + | HARDWARE_PATTERN_SCREEN_ORIGIN); + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + if (info->ChipFamily >= CHIP_FAMILY_RV200) + a->Mono8x8PatternFillFlags |= BIT_ORDER_IN_BYTE_MSBFIRST; + else + a->Mono8x8PatternFillFlags |= BIT_ORDER_IN_BYTE_LSBFIRST; +#else + a->Mono8x8PatternFillFlags |= BIT_ORDER_IN_BYTE_LSBFIRST; +#endif + + /* Indirect CPU-To-Screen Color Expand */ + + /* RADEON gets upset, when using HOST provided data without a source + rop. To show run 'xtest's drwarc. */ + a->ScanlineCPUToScreenColorExpandFillFlags + = (LEFT_EDGE_CLIPPING + | ROP_NEEDS_SOURCE + | LEFT_EDGE_CLIPPING_NEGATIVE_X); + a->NumScanlineColorExpandBuffers = 1; + a->ScanlineColorExpandBuffers = info->scratch_buffer; + info->scratch_save + = xalloc(((pScrn->virtualX+31)/32*4) + + (pScrn->virtualX * info->CurrentLayout.pixel_bytes)); + info->scratch_buffer[0] = info->scratch_save; + a->SetupForScanlineCPUToScreenColorExpandFill + = FUNC_NAME(RADEONSetupForScanlineCPUToScreenColorExpandFill); + a->SubsequentScanlineCPUToScreenColorExpandFill + = FUNC_NAME(RADEONSubsequentScanlineCPUToScreenColorExpandFill); + a->SubsequentColorExpandScanline = FUNC_NAME(RADEONSubsequentScanline); + + /* Solid Lines */ + a->SetupForSolidLine + = FUNC_NAME(RADEONSetupForSolidLine); + a->SubsequentSolidHorVertLine + = FUNC_NAME(RADEONSubsequentSolidHorVertLine); + +#ifdef XFree86LOADER + if (info->xaaReq.minorversion >= 1) { +#endif + + /* RADEON only supports 14 bits for lines and clipping and only + * draws lines that are completely on-screen correctly. This will + * cause display corruption problem in the cases when out-of-range + * commands are issued, like when dimming screen during GNOME logout + * in dual-head setup. Solid and dashed lines are therefore limited + * to the virtual screen. + */ + + a->SolidLineFlags = LINE_LIMIT_COORDS; + a->SolidLineLimits.x1 = 0; + a->SolidLineLimits.y1 = 0; + a->SolidLineLimits.x2 = pScrn->virtualX-1; + a->SolidLineLimits.y2 = pScrn->virtualY-1; + + /* Call miSetZeroLineBias() to have mi/mfb/cfb/fb routines match + hardware accel two point lines */ + miSetZeroLineBias(pScreen, (OCTANT5 | OCTANT6 | OCTANT7 | OCTANT8)); + + a->SubsequentSolidTwoPointLine + = FUNC_NAME(RADEONSubsequentSolidTwoPointLine); + + /* Disabled on RV200 and newer because it does not pass XTest */ + if (info->ChipFamily < CHIP_FAMILY_RV200) { + a->SetupForDashedLine + = FUNC_NAME(RADEONSetupForDashedLine); + a->SubsequentDashedTwoPointLine + = FUNC_NAME(RADEONSubsequentDashedTwoPointLine); + a->DashPatternMaxLength = 32; + /* ROP3 doesn't seem to work properly for dashedline with GXinvert */ + a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED + | LINE_PATTERN_POWER_OF_2_ONLY + | LINE_LIMIT_COORDS + | ROP_NEEDS_SOURCE); + a->DashedLineLimits.x1 = 0; + a->DashedLineLimits.y1 = 0; + a->DashedLineLimits.x2 = pScrn->virtualX-1; + a->DashedLineLimits.y2 = pScrn->virtualY-1; + } + +#ifdef XFree86LOADER + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "libxaa too old, can't accelerate TwoPoint lines\n"); + } +#endif + + /* Clipping, note that without this, all line accelerations will + * not be called + */ + a->SetClippingRectangle + = FUNC_NAME(RADEONSetClippingRectangle); + a->DisableClipping + = FUNC_NAME(RADEONDisableClipping); + a->ClippingFlags + = (HARDWARE_CLIP_SOLID_LINE + | HARDWARE_CLIP_DASHED_LINE + /* | HARDWARE_CLIP_SOLID_FILL -- seems very slow with this on */ + | HARDWARE_CLIP_MONO_8x8_FILL + | HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY); + + if (xf86IsEntityShared(pScrn->entityList[0])) { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + /* If there are more than one devices sharing this entity, we + * have to assign this call back, otherwise the XAA will be + * disabled + */ +#ifdef ACCEL_MMIO + if (pRADEONEnt->HasSecondary || pRADEONEnt->BypassSecondary) +#else /* ACCEL_CP */ + if (!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0])) +#endif + a->RestoreAccelState = FUNC_NAME(RADEONRestoreAccelState); + } + + /* ImageWrite */ + a->NumScanlineImageWriteBuffers = 1; + a->ScanlineImageWriteBuffers = info->scratch_buffer; + a->SetupForScanlineImageWrite + = FUNC_NAME(RADEONSetupForScanlineImageWrite); + a->SubsequentScanlineImageWriteRect + = FUNC_NAME(RADEONSubsequentScanlineImageWriteRect); + a->SubsequentImageWriteScanline = FUNC_NAME(RADEONSubsequentScanline); + a->ScanlineImageWriteFlags = (CPU_TRANSFER_PAD_DWORD +#ifdef ACCEL_MMIO + /* Performance tests show that we shouldn't use GXcopy + * for uploads as a memcpy is faster + */ + | NO_GXCOPY +#endif + /* RADEON gets upset, when using HOST provided data + * without a source rop. To show run 'xtest's ptimg + */ + | ROP_NEEDS_SOURCE + | SCANLINE_PAD_DWORD + | LEFT_EDGE_CLIPPING + | LEFT_EDGE_CLIPPING_NEGATIVE_X); + +#if 0 + /* Color 8x8 Pattern Fill */ + a->SetupForColor8x8PatternFill + = FUNC_NAME(RADEONSetupForColor8x8PatternFill); + a->SubsequentColor8x8PatternFillRect + = FUNC_NAME(RADEONSubsequentColor8x8PatternFillRect); + a->Color8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_ORIGIN + | HARDWARE_PATTERN_SCREEN_ORIGIN + | BIT_ORDER_IN_BYTE_LSBFIRST); +#endif +} + +#undef FUNC_NAME Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h:1.1 --- /dev/null Thu Feb 27 12:30:38 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h Wed Oct 30 07:52:13 2002 @@ -0,0 +1,432 @@ +/* radeon_common.h -- common header definitions for Radeon 2D/3D/DRM suite + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * + * Converted to common header format: + * Jens Owen <jens@tungstengraphics.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h,v 1.1 2002/10/30 12:52:13 alanh Exp $ + * + */ + +#ifndef _RADEON_COMMON_H_ +#define _RADEON_COMMON_H_ + +#include "xf86drm.h" + +/* WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (radeon_drm.h) + */ + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_RADEON_CP_INIT 0x00 +#define DRM_RADEON_CP_START 0x01 +#define DRM_RADEON_CP_STOP 0x02 +#define DRM_RADEON_CP_RESET 0x03 +#define DRM_RADEON_CP_IDLE 0x04 +#define DRM_RADEON_RESET 0x05 +#define DRM_RADEON_FULLSCREEN 0x06 +#define DRM_RADEON_SWAP 0x07 +#define DRM_RADEON_CLEAR 0x08 +#define DRM_RADEON_VERTEX 0x09 +#define DRM_RADEON_INDICES 0x0a +#define DRM_RADEON_STIPPLE 0x0c +#define DRM_RADEON_INDIRECT 0x0d +#define DRM_RADEON_TEXTURE 0x0e +#define DRM_RADEON_VERTEX2 0x0f +#define DRM_RADEON_CMDBUF 0x10 +#define DRM_RADEON_GETPARAM 0x11 +#define DRM_RADEON_FLIP 0x12 +#define DRM_RADEON_ALLOC 0x13 +#define DRM_RADEON_FREE 0x14 +#define DRM_RADEON_INIT_HEAP 0x15 +#define DRM_RADEON_IRQ_EMIT 0x16 +#define DRM_RADEON_IRQ_WAIT 0x17 +#define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39 + + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 +#define RADEON_STENCIL 0x8 + +#define RADEON_CLEAR_X1 0 +#define RADEON_CLEAR_Y1 1 +#define RADEON_CLEAR_X2 2 +#define RADEON_CLEAR_Y2 3 +#define RADEON_CLEAR_DEPTH 4 + + +typedef struct { + enum { + DRM_RADEON_INIT_CP = 0x01, + DRM_RADEON_CLEANUP_CP = 0x02, + DRM_RADEON_INIT_R200_CP = 0x03 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int agp_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drmRadeonInit; + +typedef struct { + int flush; + int idle; +} drmRadeonCPStop; + +typedef struct { + int idx; + int start; + int end; + int discard; +} drmRadeonIndirect; + +typedef union drmRadeonClearR { + float f[5]; + unsigned int ui[5]; +} drmRadeonClearRect; + +typedef struct drmRadeonClearT { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; /* misnamed field: should be stencil */ + drmRadeonClearRect *depth_boxes; +} drmRadeonClearType; + +typedef struct drmRadeonFullscreenT { + enum { + RADEON_INIT_FULLSCREEN = 0x01, + RADEON_CLEANUP_FULLSCREEN = 0x02 + } func; +} drmRadeonFullscreenType; + +typedef struct { + unsigned int *mask; +} drmRadeonStipple; + +typedef struct { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + const void *data; +} drmRadeonTexImage; + +typedef struct { + int offset; + int pitch; + int format; + int width; /* Texture image coordinates */ + int height; + drmRadeonTexImage *image; +} drmRadeonTexture; + + +#define RADEON_MAX_TEXTURE_UNITS 3 + +/* Layout matches drm_radeon_state_t in linux drm_radeon.h. + */ +typedef struct { + struct { + unsigned int pp_misc; /* 0x1c14 */ + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + unsigned int pp_cntl; /* 0x1c38 */ + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + } context; + struct { + unsigned int se_cntl; + } setup1; + struct { + unsigned int se_coord_fmt; /* 0x1c50 */ + } vertex; + struct { + unsigned int re_line_pattern; /* 0x1cd0 */ + unsigned int re_line_state; + unsigned int se_line_width; /* 0x1db8 */ + } line; + struct { + unsigned int pp_lum_matrix; /* 0x1d00 */ + unsigned int pp_rot_matrix_0; /* 0x1d58 */ + unsigned int pp_rot_matrix_1; + } bumpmap; + struct { + unsigned int rb3d_stencilrefmask; /* 0x1d7c */ + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + } mask; + struct { + unsigned int se_vport_xscale; /* 0x1d98 */ + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + } viewport; + struct { + unsigned int se_cntl_status; /* 0x2140 */ + } setup2; + struct { + unsigned int re_top_left; /*ignored*/ /* 0x26c0 */ + unsigned int re_misc; + } misc; + struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + unsigned int pp_border_color; + } texture[RADEON_MAX_TEXTURE_UNITS]; + struct { + unsigned int se_zbias_factor; + unsigned int se_zbias_constant; + } zbias; + unsigned int dirty; +} drmRadeonState; + +/* 1.1 vertex ioctl. Used in compatibility modes. + */ +typedef struct { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drmRadeonVertex; + +typedef struct { + unsigned int start; + unsigned int finish; + unsigned int prim:8; + unsigned int stateidx:8; + unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ + unsigned int vc_format; +} drmRadeonPrim; + +typedef struct { + int idx; /* Index of vertex buffer */ + int discard; /* Client finished with buffer? */ + int nr_states; + drmRadeonState *state; + int nr_prims; + drmRadeonPrim *prim; +} drmRadeonVertex2; + +#define RADEON_MAX_STATES 16 +#define RADEON_MAX_PRIMS 64 + +/* Command buffer. Replace with true dma stream? + */ +typedef struct { + int bufsz; + char *buf; + int nbox; + drmClipRect *boxes; +} drmRadeonCmdBuffer; + +/* New style per-packet identifiers for use in cmd_buffer ioctl with + * the RADEON_EMIT_PACKET command. Comments relate new packets to old + * state bits and the packet size: + */ +#define RADEON_EMIT_PP_MISC 0 /* context/7 */ +#define RADEON_EMIT_PP_CNTL 1 /* context/3 */ +#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ +#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ +#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ +#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ +#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ +#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ +#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ +#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ +#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ +#define RADEON_EMIT_RE_MISC 11 /* misc/1 */ +#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ +#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ +#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ +#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ +#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ +#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ +#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ +#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ +#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ +#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ +#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ +#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ +#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ +#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ +#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/6 */ +#define R200_EMIT_TFACTOR_0 30 /* tf/6 */ +#define R200_EMIT_VTX_FMT_0 31 /* vtx/4 */ +#define R200_EMIT_VAP_CTL 32 /* vap/1 */ +#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ +#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ +#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ +#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ +#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ +#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ +#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ +#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ +#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ +#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ +#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ +#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ +#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ +#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ +#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ +#define R200_EMIT_VTE_CNTL 48 /* vte/1 */ +#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ +#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ +#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ +#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ +#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ +#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ +#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ +#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ +#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ +#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ +#define RADEON_MAX_STATE_PACKETS 61 + + +/* Commands understood by cmd_buffer ioctl. More can be added but + * obviously these can't be removed or changed: + */ +#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ +#define RADEON_CMD_SCALARS 2 /* emit scalar data */ +#define RADEON_CMD_VECTORS 3 /* emit vector data */ +#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ +#define RADEON_CMD_PACKET3 5 /* emit hw packet */ +#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ +#define RADEON_CMD_SCALARS2 7 /* R200 stopgap */ +#define RADEON_CMD_WAIT 8 /* synchronization */ + +typedef union { + int i; + struct { + unsigned char cmd_type, pad0, pad1, pad2; + } header; + struct { + unsigned char cmd_type, packet_id, pad0, pad1; + } packet; + struct { + unsigned char cmd_type, offset, stride, count; + } scalars; + struct { + unsigned char cmd_type, offset, stride, count; + } vectors; + struct { + unsigned char cmd_type, buf_idx, pad0, pad1; + } dma; + struct { + unsigned char cmd_type, flags, pad0, pad1; + } wait; +} drmRadeonCmdHeader; + + +#define RADEON_WAIT_2D 0x1 +#define RADEON_WAIT_3D 0x2 + + +typedef struct drm_radeon_getparam { + int param; + int *value; +} drmRadeonGetParam; + +#define RADEON_PARAM_AGP_BUFFER_OFFSET 1 +#define RADEON_PARAM_LAST_FRAME 2 +#define RADEON_PARAM_LAST_DISPATCH 3 +#define RADEON_PARAM_LAST_CLEAR 4 +#define RADEON_PARAM_IRQ_NR 5 +#define RADEON_PARAM_AGP_BASE 6 + + +#define RADEON_MEM_REGION_AGP 1 +#define RADEON_MEM_REGION_FB 2 + +typedef struct drm_radeon_mem_alloc { + int region; + int alignment; + int size; + int *region_offset; /* offset from start of fb or agp */ +} drmRadeonMemAlloc; + +typedef struct drm_radeon_mem_free { + int region; + int region_offset; +} drmRadeonMemFree; + +typedef struct drm_radeon_mem_init_heap { + int region; + int size; + int start; +} drmRadeonMemInitHeap; + +/* 1.6: Userspace can request & wait on irq's: + */ +typedef struct drm_radeon_irq_emit { + int *irq_seq; +} drmRadeonIrqEmit; + +typedef struct drm_radeon_irq_wait { + int irq_seq; +} drmRadeonIrqWait; + + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.9 Fri Nov 23 14:50:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c Mon Feb 24 15:34:55 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.9 2001/11/23 19:50:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.23 2003/02/24 20:34:55 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> * * References: @@ -46,244 +46,402 @@ /* Driver data structures */ #include "radeon.h" +#include "radeon_macros.h" #include "radeon_reg.h" /* X and server generic header files */ #include "xf86.h" +/* Mono ARGB cursor colours (premultiplied). */ +static CARD32 mono_cursor_color[] = { + 0x00000000, /* White, fully transparent. */ + 0x00000000, /* Black, fully transparent. */ + 0xffffffff, /* White, fully opaque. */ + 0xff000000, /* Black, fully opaque. */ +}; + +#define CURSOR_WIDTH 64 +#define CURSOR_HEIGHT 64 + +/* + * The cursor bits are always 32bpp. On MSBFirst busses, + * configure byte swapping to swap 32 bit units when writing + * the cursor image. Byte swapping must always be returned + * to its previous value before returning. + */ #if X_BYTE_ORDER == X_BIG_ENDIAN -#define P_SWAP32( a , b ) \ - ((char *)a)[0] = ((char *)b)[3]; \ - ((char *)a)[1] = ((char *)b)[2]; \ - ((char *)a)[2] = ((char *)b)[1]; \ - ((char *)a)[3] = ((char *)b)[0] - -#define P_SWAP16( a , b ) \ - ((char *)a)[0] = ((char *)b)[1]; \ - ((char *)a)[1] = ((char *)b)[0]; \ - ((char *)a)[2] = ((char *)b)[3]; \ - ((char *)a)[3] = ((char *)b)[2] -#endif +#define CURSOR_SWAPPING_DECL_MMIO unsigned char *RADEONMMIO = info->MMIO; +#define CURSOR_SWAPPING_DECL CARD32 __surface_cntl; +#define CURSOR_SWAPPING_START() \ + OUTREG(RADEON_SURFACE_CNTL, \ + ((__surface_cntl = INREG(RADEON_SURFACE_CNTL)) | \ + RADEON_NONSURF_AP0_SWP_32BPP) & \ + ~RADEON_NONSURF_AP0_SWP_16BPP) +#define CURSOR_SWAPPING_END() (OUTREG(RADEON_SURFACE_CNTL, __surface_cntl)) + +#else + +#define CURSOR_SWAPPING_DECL_MMIO +#define CURSOR_SWAPPING_DECL +#define CURSOR_SWAPPING_START() +#define CURSOR_SWAPPING_END() + +#endif -/* Set cursor foreground and background colors. */ +/* Set cursor foreground and background colors */ static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - if(info->IsSecondary) - { - OUTREG(RADEON_CUR2_CLR0, bg); - OUTREG(RADEON_CUR2_CLR1, fg); - } - else - { - OUTREG(RADEON_CUR_CLR0, bg); - OUTREG(RADEON_CUR_CLR1, fg); - } + RADEONInfoPtr info = RADEONPTR(pScrn); + CARD32 *pixels = (CARD32 *)(pointer)(info->FB + info->cursor_start); + int pixel, i; + CURSOR_SWAPPING_DECL_MMIO + CURSOR_SWAPPING_DECL + +#ifdef ARGB_CURSOR + /* Don't recolour cursors set with SetCursorARGB. */ + if (info->cursor_argb) + return; +#endif + + fg |= 0xff000000; + bg |= 0xff000000; + + /* Don't recolour the image if we don't have to. */ + if (fg == info->cursor_fg && bg == info->cursor_bg) + return; + + CURSOR_SWAPPING_START(); + + /* Note: We assume that the pixels are either fully opaque or fully + * transparent, so we won't premultiply them, and we can just + * check for non-zero pixel values; those are either fg or bg + */ + for (i = 0; i < CURSOR_WIDTH * CURSOR_HEIGHT; i++, pixels++) + if ((pixel = *pixels)) + *pixels = (pixel == info->cursor_fg) ? fg : bg; + + CURSOR_SWAPPING_END(); + info->cursor_fg = fg; + info->cursor_bg = bg; } /* Set cursor position to (x,y) with offset into cursor bitmap at - (xorigin,yorigin). */ + * (xorigin,yorigin) + */ static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - xf86CursorInfoPtr cursor = info->cursor; - int xorigin = 0; - int yorigin = 0; - int total_y = pScrn->frameY1 - pScrn->frameY0; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + xf86CursorInfoPtr cursor = info->cursor; + int xorigin = 0; + int yorigin = 0; + int total_y = pScrn->frameY1 - pScrn->frameY0; + int X2 = pScrn->frameX0 + x; + int Y2 = pScrn->frameY0 + y; + int stride = 256; - if (x < 0) xorigin = -x; - if (y < 0) yorigin = -y; + if (x < 0) xorigin = -x+1; + if (y < 0) yorigin = -y+1; if (y > total_y) y = total_y; if (info->Flags & V_DBLSCAN) y *= 2; if (xorigin >= cursor->MaxWidth) xorigin = cursor->MaxWidth - 1; if (yorigin >= cursor->MaxHeight) yorigin = cursor->MaxHeight - 1; -#if 0 - /* This test is NOT needed, and is the cause of jerky behavior - * as the mouse approaches the left edge of the screen, especially - * at high acceleration. - * - * Nowhere below is x (or y) used when they are negative! - */ - if(x >= 0) -#endif - { - if(!info->IsSecondary) - { - OUTREG(RADEON_CUR_HORZ_VERT_OFF, (RADEON_CUR_LOCK - | (xorigin << 16) - | yorigin)); - OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK - | ((xorigin ? 0 : x) << 16) - | (yorigin ? 0 : y))); - OUTREG(RADEON_CUR_OFFSET, info->cursor_start + yorigin * 16); - } - else - { - OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK - | (xorigin << 16) - | yorigin)); - OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK - | ((xorigin ? 0 : x) << 16) - | (yorigin ? 0 : y))); - OUTREG(RADEON_CUR2_OFFSET, - info->cursor_start + pScrn->fbOffset + yorigin * 16); - } + if (info->Clone) { + int X0 = 0; + int Y0 = 0; + + if ((info->CurCloneMode->VDisplay == pScrn->currentMode->VDisplay) && + (info->CurCloneMode->HDisplay == pScrn->currentMode->HDisplay)) { + Y2 = y; + X2 = x; + X0 = pScrn->frameX0; + Y0 = pScrn->frameY0; + } else { + if (y < 0) + Y2 = pScrn->frameY0; + + if (x < 0) + X2 = pScrn->frameX0; + + if (Y2 >= info->CurCloneMode->VDisplay + info->CloneFrameY0) { + Y0 = Y2 - info->CurCloneMode->VDisplay; + Y2 = info->CurCloneMode->VDisplay - 1; + } else if (Y2 < info->CloneFrameY0) { + Y0 = Y2; + Y2 = 0; + } else { + Y2 -= info->CloneFrameY0; + Y0 = info->CloneFrameY0; + } + + if (X2 >= info->CurCloneMode->HDisplay + info->CloneFrameX0) { + X0 = X2 - info->CurCloneMode->HDisplay; + X2 = info->CurCloneMode->HDisplay - 1; + } else if (X2 < info->CloneFrameX0) { + X0 = X2; + X2 = 0; + } else { + X2 -= info->CloneFrameX0; + X0 = info->CloneFrameX0; + } + + if (info->CurCloneMode->Flags & V_DBLSCAN) + Y2 *= 2; + } + + if ((X0 >= 0 || Y0 >= 0) && + ((info->CloneFrameX0 != X0) || (info->CloneFrameY0 != Y0))) { + RADEONDoAdjustFrame(pScrn, X0, Y0, TRUE); + info->CloneFrameX0 = X0; + info->CloneFrameY0 = Y0; + } + } + + if (!info->IsSecondary) { + OUTREG(RADEON_CUR_HORZ_VERT_OFF, (RADEON_CUR_LOCK + | (xorigin << 16) + | yorigin)); + OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK + | ((xorigin ? 0 : x) << 16) + | (yorigin ? 0 : y))); + OUTREG(RADEON_CUR_OFFSET, info->cursor_start + yorigin * stride); + } else { + OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK + | (xorigin << 16) + | yorigin)); + OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK + | ((xorigin ? 0 : x) << 16) + | (yorigin ? 0 : y))); + OUTREG(RADEON_CUR2_OFFSET, + info->cursor_start + pScrn->fbOffset + yorigin * stride); } + + if (info->Clone) { + xorigin = 0; + yorigin = 0; + if (X2 < 0) xorigin = -X2 + 1; + if (Y2 < 0) yorigin = -Y2 + 1; + if (xorigin >= cursor->MaxWidth) xorigin = cursor->MaxWidth - 1; + if (yorigin >= cursor->MaxHeight) yorigin = cursor->MaxHeight - 1; + + OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK + | (xorigin << 16) + | yorigin)); + OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK + | ((xorigin ? 0 : X2) << 16) + | (yorigin ? 0 : Y2))); + OUTREG(RADEON_CUR2_OFFSET, + info->cursor_start + pScrn->fbOffset + yorigin * stride); + } } /* Copy cursor image from `image' to video memory. RADEONSetCursorPosition - will be called after this, so we can ignore xorigin and yorigin. */ + * will be called after this, so we can ignore xorigin and yorigin. + */ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *s = (pointer)image; - CARD32 *d = (pointer)(info->FB + info->cursor_start); - int y; - CARD32 save; - - if(!info->IsSecondary) - { - save = INREG(RADEON_CRTC_GEN_CNTL); - OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); + CARD8 *s = (CARD8 *)(pointer)image; + CARD32 *d = (CARD32 *)(pointer)(info->FB + info->cursor_start); + CARD32 save1 = 0; + CARD32 save2 = 0; + CARD8 chunk; + CARD32 i, j; + CURSOR_SWAPPING_DECL + + if (!info->IsSecondary) { + save1 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20); + save1 |= (CARD32) (2 << 20); + OUTREG(RADEON_CRTC_GEN_CNTL, save1 & (CARD32)~RADEON_CRTC_CUR_EN); } - else - { - save = INREG(RADEON_CRTC2_GEN_CNTL); - OUTREG(RADEON_CRTC2_GEN_CNTL, save & (CARD32)~RADEON_CRTC2_CUR_EN); - } -#if X_BYTE_ORDER == X_BIG_ENDIAN - switch(info->CurrentLayout.pixel_bytes) { - case 4: - case 3: - for (y = 0; y < 64; y++) { - P_SWAP32(d,s); - d++; s++; - P_SWAP32(d,s); - d++; s++; - P_SWAP32(d,s); - d++; s++; - P_SWAP32(d,s); - d++; s++; - } - break; - case 2: - for (y = 0; y < 64; y++) { - P_SWAP16(d,s); - d++; s++; - P_SWAP16(d,s); - d++; s++; - P_SWAP16(d,s); - d++; s++; - P_SWAP16(d,s); - d++; s++; - } - break; - default: - for (y = 0; y < 64; y++) { - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - } + if (info->IsSecondary || info->Clone) { + save2 = INREG(RADEON_CRTC2_GEN_CNTL) & ~(CARD32) (3 << 20); + save2 |= (CARD32) (2 << 20); + OUTREG(RADEON_CRTC2_GEN_CNTL, save2 & (CARD32)~RADEON_CRTC2_CUR_EN); } -#else - for (y = 0; y < 64; y++) { - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - } + +#ifdef ARGB_CURSOR + info->cursor_argb = FALSE; #endif - /* Set the area after the cursor to be all transparent so that we - won't display corrupted cursors on the screen */ - for (y = 0; y < 64; y++) { - *d++ = 0xffffffff; /* The AND bits */ - *d++ = 0xffffffff; - *d++ = 0x00000000; /* The XOR bits */ - *d++ = 0x00000000; + /* + * Convert the bitmap to ARGB32. + * + * HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 always places + * source in the low bit of the pair and mask in the high bit, + * and MSBFirst machines set HARDWARE_CURSOR_BIT_ORDER_MSBFIRST + * (which actually bit swaps the image) to make the bits LSBFirst + */ + CURSOR_SWAPPING_START(); +#define ARGB_PER_CHUNK (8 * sizeof (chunk) / 2) + for (i = 0; i < CURSOR_WIDTH * CURSOR_HEIGHT / ARGB_PER_CHUNK; i++) { + chunk = *s++; + for (j = 0; j < ARGB_PER_CHUNK; j++, chunk >>= 2) + *d++ = mono_cursor_color[chunk & 3]; } + CURSOR_SWAPPING_END(); + + info->cursor_bg = mono_cursor_color[2]; + info->cursor_fg = mono_cursor_color[3]; - if(!info->IsSecondary) - OUTREG(RADEON_CRTC_GEN_CNTL, save); - else - OUTREG(RADEON_CRTC2_GEN_CNTL, save); + if (!info->IsSecondary) + OUTREG(RADEON_CRTC_GEN_CNTL, save1); + if (info->IsSecondary || info->Clone) + OUTREG(RADEON_CRTC2_GEN_CNTL, save2); + } /* Hide hardware cursor. */ static void RADEONHideCursor(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - if(info->IsSecondary) - OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~RADEON_CRTC2_CUR_EN); - else - OUTREGP(RADEON_CRTC_GEN_CNTL, 0, ~RADEON_CRTC_CUR_EN); + if (info->IsSecondary || info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~RADEON_CRTC2_CUR_EN); + if (!info->IsSecondary) + OUTREGP(RADEON_CRTC_GEN_CNTL, 0, ~RADEON_CRTC_CUR_EN); } /* Show hardware cursor. */ static void RADEONShowCursor(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - if(info->IsSecondary) - { - OUTREGP(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_CUR_EN, - ~RADEON_CRTC2_CUR_EN); - } - else - { - OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, - ~RADEON_CRTC_CUR_EN); - } + if (info->IsSecondary || info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_CUR_EN, + ~RADEON_CRTC2_CUR_EN); + + if (!info->IsSecondary) + OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, + ~RADEON_CRTC_CUR_EN); } /* Determine if hardware cursor is in use. */ static Bool RADEONUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); return info->cursor_start ? TRUE : FALSE; } +#ifdef ARGB_CURSOR +#include "cursorstr.h" + +static Bool RADEONUseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + if (info->cursor_start && + pCurs->bits->height <= CURSOR_HEIGHT && pCurs->bits->width <= CURSOR_WIDTH) + return TRUE; + return FALSE; +} + +static void RADEONLoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 *d = (CARD32 *)(pointer)(info->FB + info->cursor_start); + int x, y, w, h; + CARD32 save1 = 0; + CARD32 save2 = 0; + CARD32 *image = pCurs->bits->argb; + CARD32 *i; + CURSOR_SWAPPING_DECL + + if (!image) + return; /* XXX can't happen */ + + if (!info->IsSecondary) { + save1 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20); + save1 |= (CARD32) (2 << 20); + OUTREG(RADEON_CRTC_GEN_CNTL, save1 & (CARD32)~RADEON_CRTC_CUR_EN); + } + + if (info->IsSecondary || info->Clone) { + save2 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20); + save2 |= (CARD32) (2 << 20); + OUTREG(RADEON_CRTC2_GEN_CNTL, save2 & (CARD32)~RADEON_CRTC2_CUR_EN); + } + +#ifdef ARGB_CURSOR + info->cursor_argb = TRUE; +#endif + + CURSOR_SWAPPING_START(); + + w = pCurs->bits->width; + if (w > CURSOR_WIDTH) + w = CURSOR_WIDTH; + h = pCurs->bits->height; + if (h > CURSOR_HEIGHT) + h = CURSOR_HEIGHT; + for (y = 0; y < h; y++) + { + i = image; + image += pCurs->bits->width; + for (x = 0; x < w; x++) + *d++ = *i++; + /* pad to the right with transparent */ + for (; x < CURSOR_WIDTH; x++) + *d++ = 0; + } + /* pad below with transparent */ + for (; y < CURSOR_HEIGHT; y++) + for (x = 0; x < CURSOR_WIDTH; x++) + *d++ = 0; + + CURSOR_SWAPPING_END (); + + if (!info->IsSecondary) + OUTREG(RADEON_CRTC_GEN_CNTL, save1); + + if (info->IsSecondary || info->Clone) + OUTREG(RADEON_CRTC2_GEN_CNTL, save2); + +} + +#endif + + /* Initialize hardware cursor support. */ Bool RADEONCursorInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - xf86CursorInfoPtr cursor; - FBAreaPtr fbarea; - int width; - int height; - int size; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + xf86CursorInfoPtr cursor; + FBAreaPtr fbarea; + int width; + int width_bytes; + int height; + int size_bytes; - if (!(cursor = info->cursor = xf86CreateCursorInfoRec())) return FALSE; - cursor->MaxWidth = 64; - cursor->MaxHeight = 64; + cursor->MaxWidth = CURSOR_WIDTH; + cursor->MaxHeight = CURSOR_HEIGHT; cursor->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP - -#if X_BYTE_ORDER == X_LITTLE_ENDIAN + | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* this is a lie -- + * HARDWARE_CURSOR_BIT_ORDER_MSBFIRST + * actually inverts the bit order, so + * this switches to LSBFIRST + */ | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST #endif - | HARDWARE_CURSOR_INVERT_MASK - | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK - | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 - | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK); + | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1); cursor->SetCursorColors = RADEONSetCursorColors; cursor->SetCursorPosition = RADEONSetCursorPosition; @@ -292,13 +450,18 @@ cursor->ShowCursor = RADEONShowCursor; cursor->UseHWCursor = RADEONUseHWCursor; - size = (cursor->MaxWidth/4) * cursor->MaxHeight; +#ifdef ARGB_CURSOR + cursor->UseHWCursorARGB = RADEONUseHWCursorARGB; + cursor->LoadCursorARGB = RADEONLoadCursorARGB; +#endif + size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; width = pScrn->displayWidth; - height = (size*2 + 1023) / pScrn->displayWidth; + width_bytes = width * (pScrn->bitsPerPixel / 8); + height = (size_bytes + width_bytes - 1) / width_bytes; fbarea = xf86AllocateOffscreenArea(pScreen, width, height, - 16, + 256, NULL, NULL, NULL); @@ -309,11 +472,11 @@ "Hardware cursor disabled" " due to insufficient offscreen memory\n"); } else { - info->cursor_start = RADEON_ALIGN((fbarea->box.x1 - + width * fbarea->box.y1) - * info->CurrentLayout.pixel_bytes, - 16); - info->cursor_end = info->cursor_start + size; + info->cursor_start = RADEON_ALIGN((fbarea->box.x1 + + fbarea->box.y1 * width) * + info->CurrentLayout.pixel_bytes, + 256); + info->cursor_end = info->cursor_start + size_bytes; } RADEONTRACE(("RADEONCursorInit (0x%08x-0x%08x)\n", Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c:1.8 Tue Dec 4 12:30:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c Wed Sep 18 14:14:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.8 2001/12/04 17:30:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.11 2002/09/18 18:14:58 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * * Credits: * @@ -73,11 +73,14 @@ unsigned long blue, short visualClass) { - RADEONInfoPtr info = RADEONPTR(pScrn); - DGAModePtr newmodes = NULL, currentMode; - DisplayModePtr pMode, firstMode; - unsigned int size; - int pitch, Bpp = bitsPerPixel >> 3; + RADEONInfoPtr info = RADEONPTR(pScrn); + DGAModePtr newmodes = NULL; + DGAModePtr currentMode; + DisplayModePtr pMode; + DisplayModePtr firstMode; + unsigned int size; + int pitch; + int Bpp = bitsPerPixel >> 3; SECOND_PASS: @@ -95,8 +98,8 @@ if (!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)))) break; - - modes = newmodes; + + modes = newmodes; currentMode = modes + *num; currentMode->mode = pMode; @@ -108,19 +111,20 @@ if (info->accel) { if (info->accel->SetupForSolidFill && info->accel->SubsequentSolidFillRect) - currentMode->flags |= DGA_FILL_RECT; + currentMode->flags |= DGA_FILL_RECT; if (info->accel->SetupForScreenToScreenCopy && info->accel->SubsequentScreenToScreenCopy) - currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; if (currentMode->flags & (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) - currentMode->flags &= ~DGA_CONCURRENT_ACCESS; + currentMode->flags &= ~DGA_CONCURRENT_ACCESS; } if (pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if (pMode->Flags & V_INTERLACE) currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; currentMode->depth = depth; currentMode->bitsPerPixel = bitsPerPixel; @@ -136,15 +140,16 @@ currentMode->offset = 0; currentMode->address = (unsigned char*)info->LinearAddr; currentMode->bytesPerScanline = pitch * Bpp; - currentMode->imageWidth = pitch; - currentMode->imageHeight = info->FbMapSize / currentMode->bytesPerScanline; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; + currentMode->imageWidth = pitch; + currentMode->imageHeight = (info->FbMapSize + / currentMode->bytesPerScanline); + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = (currentMode->imageWidth + - currentMode->viewportWidth); /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = (currentMode->imageHeight - - currentMode->viewportHeight); + currentMode->maxViewportY = (currentMode->imageHeight + - currentMode->viewportHeight); (*num)++; } @@ -163,10 +168,10 @@ Bool RADEONDGAInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - DGAModePtr modes = NULL; - int num = 0; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + DGAModePtr modes = NULL; + int num = 0; /* 8 */ modes = RADEONSetupDGAMode(pScrn, modes, &num, 8, 8, @@ -229,7 +234,7 @@ info->DGAFuncs.BlitTransRect = NULL; if (info->accel) { - info->DGAFuncs.Sync = RADEONWaitForIdle; + info->DGAFuncs.Sync = info->accel->Sync; if (info->accel->SetupForSolidFill && info->accel->SubsequentSolidFillRect) info->DGAFuncs.FillRect = RADEON_FillRect; @@ -245,9 +250,9 @@ static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) { - static RADEONFBLayout SavedLayouts[MAXSCREENS]; - int indx = pScrn->pScreen->myNum; - RADEONInfoPtr info = RADEONPTR(pScrn); + static RADEONFBLayout SavedLayouts[MAXSCREENS]; + int indx = pScrn->pScreen->myNum; + RADEONInfoPtr info = RADEONPTR(pScrn); if (!pMode) { /* restore the original mode */ /* put the ScreenParameters back */ @@ -258,6 +263,18 @@ pScrn->currentMode = info->CurrentLayout.mode; RADEONSwitchMode(indx, pScrn->currentMode, 0); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + RADEONCP_STOP(pScrn, info); + } +#endif + if (info->accelOn) + RADEONEngineInit(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + RADEONCP_START(pScrn, info); + } +#endif RADEONAdjustFrame(indx, 0, 0, 0); info->DGAactive = FALSE; } else { @@ -278,6 +295,19 @@ /* RADEONModeInit() will set the mode field */ RADEONSwitchMode(indx, pMode->mode, 0); + +#ifdef XF86DRI + if (info->directRenderingEnabled) { + RADEONCP_STOP(pScrn, info); + } +#endif + if (info->accelOn) + RADEONEngineInit(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) { + RADEONCP_START(pScrn, info); + } +#endif } return TRUE; @@ -285,14 +315,14 @@ static int RADEON_GetViewport(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); return info->DGAViewportStatus; } static void RADEON_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); RADEONAdjustFrame(pScrn->pScreen->myNum, x, y, flags); info->DGAViewportStatus = 0; /* FIXME */ @@ -302,7 +332,7 @@ int x, int y, int w, int h, unsigned long color) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); @@ -315,9 +345,9 @@ int srcx, int srcy, int w, int h, int dstx, int dsty) { - RADEONInfoPtr info = RADEONPTR(pScrn); - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; + RADEONInfoPtr info = RADEONPTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1); @@ -332,9 +362,9 @@ int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color) { - RADEONInfoPtr info = RADEONPTR(pScrn); - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; + RADEONInfoPtr info = RADEONPTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; info->XAAForceTransBlit = TRUE; @@ -355,7 +385,7 @@ unsigned char **mem, int *size, int *offset, int *flags) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); *name = NULL; /* no special device */ *mem = (unsigned char*)info->LinearAddr; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.14 Mon Oct 1 09:44:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c Wed Feb 19 04:17:30 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.14 2001/10/01 13:44:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.32 2003/02/19 09:17:30 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -20,7 +20,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> * Gareth Hughes <gareth@valinux.com> * @@ -38,28 +38,26 @@ /* Driver data structures */ #include "radeon.h" +#include "radeon_macros.h" #include "radeon_dri.h" #include "radeon_reg.h" -#include "radeon_sarea.h" #include "radeon_version.h" /* X and server generic header files */ #include "xf86.h" #include "windowstr.h" +#include "xf86PciInfo.h" + +#include "shadowfb.h" /* GLX/DRI/DRM definitions */ #define _XF86DRI_SERVER_ #include "GL/glxtokens.h" #include "sarea.h" - -#if defined(__alpha__) -# define PCIGART_ENABLED -#else -# undef PCIGART_ENABLED -#endif +#include "radeon_sarea.h" -/* ?? HACK - for now, put this here... */ -/* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ +/* HACK - for now, put this here... */ +/* Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ #if defined(__alpha__) # define DRM_PAGE_SIZE 8192 #elif defined(__ia64__) @@ -68,26 +66,40 @@ # define DRM_PAGE_SIZE 4096 #endif + +static Bool RADEONDRICloseFullScreen(ScreenPtr pScreen); +static Bool RADEONDRIOpenFullScreen(ScreenPtr pScreen); +static void RADEONDRITransitionTo2d(ScreenPtr pScreen); +static void RADEONDRITransitionTo3d(ScreenPtr pScreen); +static void RADEONDRITransitionMultiToSingle3d(ScreenPtr pScreen); +static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen); + +static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + /* Initialize the visual configs that are supported by the hardware. - These are combined with the visual configs that the indirect - rendering core supports, and the intersection is exported to the - client. */ + * These are combined with the visual configs that the indirect + * rendering core supports, and the intersection is exported to the + * client. + */ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - int numConfigs = 0; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + int numConfigs = 0; __GLXvisualConfig *pConfigs = 0; - RADEONConfigPrivPtr pRADEONConfigs = 0; + RADEONConfigPrivPtr pRADEONConfigs = 0; RADEONConfigPrivPtr *pRADEONConfigPtrs = 0; - int i, accum, stencil; + int i, accum, stencil, db, use_db; + + use_db = !info->noBackBuffer ? 1 : 0; switch (info->CurrentLayout.pixel_code) { case 8: /* 8bpp mode is not support */ case 15: /* FIXME */ case 24: /* FIXME */ xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] RADEONInitVisualConfigs failed (depth %d not supported). " + "[dri] RADEONInitVisualConfigs failed " + "(depth %d not supported). " "Disabling DRI.\n", info->CurrentLayout.pixel_code); return FALSE; @@ -98,28 +110,30 @@ numConfigs = 1; if (RADEON_USE_ACCUM) numConfigs *= 2; if (RADEON_USE_STENCIL) numConfigs *= 2; + if (use_db) numConfigs *= 2; if (!(pConfigs - = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + = (__GLXvisualConfig *)xcalloc(sizeof(__GLXvisualConfig), + numConfigs))) { return FALSE; } if (!(pRADEONConfigs = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec), - numConfigs))) { + numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pRADEONConfigPtrs - = (RADEONConfigPrivPtr*)xcalloc(sizeof(RADEONConfigPrivPtr), - numConfigs))) { + = (RADEONConfigPrivPtr *)xcalloc(sizeof(RADEONConfigPrivPtr), + numConfigs))) { xfree(pConfigs); xfree(pRADEONConfigs); return FALSE; } i = 0; - for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { + for (db = 0; db <= use_db; db++) { + for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { for (stencil = 0; stencil <= RADEON_USE_STENCIL; stencil++) { pRADEONConfigPtrs[i] = &pRADEONConfigs[i]; @@ -145,17 +159,20 @@ pConfigs[i].accumBlueSize = 0; pConfigs[i].accumAlphaSize = 0; } - pConfigs[i].doubleBuffer = TRUE; + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 16; pConfigs[i].depthSize = 16; if (stencil) - pConfigs[i].stencilSize = 8; /* Simulated in software */ + pConfigs[i].stencilSize = 8; else pConfigs[i].stencilSize = 0; pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if (accum || stencil) { + if (accum) { pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; } else { pConfigs[i].visualRating = GLX_NONE_EXT; @@ -168,34 +185,38 @@ pConfigs[i].transparentIndex = 0; i++; } + } } break; + case 32: numConfigs = 1; if (RADEON_USE_ACCUM) numConfigs *= 2; if (RADEON_USE_STENCIL) numConfigs *= 2; + if (use_db) numConfigs *= 2; if (!(pConfigs - = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + = (__GLXvisualConfig *)xcalloc(sizeof(__GLXvisualConfig), + numConfigs))) { return FALSE; } if (!(pRADEONConfigs = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec), - numConfigs))) { + numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pRADEONConfigPtrs - = (RADEONConfigPrivPtr*)xcalloc(sizeof(RADEONConfigPrivPtr), - numConfigs))) { + = (RADEONConfigPrivPtr *)xcalloc(sizeof(RADEONConfigPrivPtr), + numConfigs))) { xfree(pConfigs); xfree(pRADEONConfigs); return FALSE; } i = 0; - for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { + for (db = 0; db <= use_db; db++) { + for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { for (stencil = 0; stencil <= RADEON_USE_STENCIL; stencil++) { pRADEONConfigPtrs[i] = &pRADEONConfigs[i]; @@ -221,9 +242,12 @@ pConfigs[i].accumBlueSize = 0; pConfigs[i].accumAlphaSize = 0; } - pConfigs[i].doubleBuffer = TRUE; + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 24; + pConfigs[i].bufferSize = 32; if (stencil) { pConfigs[i].depthSize = 24; pConfigs[i].stencilSize = 8; @@ -233,7 +257,7 @@ } pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if (accum || stencil) { + if (accum) { pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; } else { pConfigs[i].visualRating = GLX_NONE_EXT; @@ -246,6 +270,7 @@ pConfigs[i].transparentIndex = 0; i++; } + } } break; } @@ -263,9 +288,9 @@ DRIContextType contextStore) { #ifdef PER_CONTEXT_SAREA - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONDRIContextPtr ctx_info; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONDRIContextPtr ctx_info; ctx_info = (RADEONDRIContextPtr)contextStore; if (!ctx_info) return FALSE; @@ -275,19 +300,19 @@ DRM_SHM, DRM_REMOVABLE, &ctx_info->sarea_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] could not create private sarea for ctx id (%d)\n", (int)hwContext); - return FALSE; + return FALSE; } if (drmAddContextPrivateMapping(info->drmFD, hwContext, ctx_info->sarea_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] could not associate private sarea to ctx id (%d)\n", (int)hwContext); - drmRmMap(info->drmFD, ctx_info->sarea_handle); - return FALSE; + drmRmMap(info->drmFD, ctx_info->sarea_handle); + return FALSE; } ctx_info->ctx_id = hwContext; @@ -300,15 +325,15 @@ DRIContextType contextStore) { #ifdef PER_CONTEXT_SAREA - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONDRIContextPtr ctx_info; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONDRIContextPtr ctx_info; - ctx_info = (RADEONDRIContextPtr) contextStore; + ctx_info = (RADEONDRIContextPtr)contextStore; if (!ctx_info) return; if (drmRmMap(info->drmFD, ctx_info->sarea_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] could not remove private sarea for ctx id (%d)\n", (int)hwContext); } @@ -316,29 +341,31 @@ } /* Called when the X server is woken up to allow the last client's - context to be saved and the X server's context to be loaded. This is - not necessary for the Radeon since the client detects when it's - context is not currently loaded and then load's it itself. Since the - registers to start and stop the CP are privileged, only the X server - can start/stop the engine. */ + * context to be saved and the X server's context to be loaded. This is + * not necessary for the Radeon since the client detects when it's + * context is not currently loaded and then load's it itself. Since the + * registers to start and stop the CP are privileged, only the X server + * can start/stop the engine. + */ static void RADEONEnterServer(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); if (info->accel) info->accel->NeedToSync = TRUE; } /* Called when the X server goes to sleep to allow the X server's - context to be saved and the last client's context to be loaded. This - is not necessary for the Radeon since the client detects when it's - context is not currently loaded and then load's it itself. Since the - registers to start and stop the CP are privileged, only the X server - can start/stop the engine. */ + * context to be saved and the last client's context to be loaded. This + * is not necessary for the Radeon since the client detects when it's + * context is not currently loaded and then load's it itself. Since the + * registers to start and stop the CP are privileged, only the X server + * can start/stop the engine. + */ static void RADEONLeaveServer(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); RING_LOCALS; /* The CP is always running, but if we've generated any CP commands @@ -354,9 +381,10 @@ } /* Contexts can be swapped by the X server if necessary. This callback - is currently only used to perform any functions necessary when - entering or leaving the X server, and in the future might not be - necessary. */ + * is currently only used to perform any functions necessary when + * entering or leaving the X server, and in the future might not be + * necessary. + */ static void RADEONDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, @@ -367,6 +395,7 @@ (newContextType==DRI_2D_CONTEXT)) { /* Entering from Wakeup */ RADEONEnterServer(pScreen); } + if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && (newContextType==DRI_2D_CONTEXT)) { /* Exiting from Block Handler */ RADEONLeaveServer(pScreen); @@ -379,11 +408,11 @@ * is calculated, and then wired with x and y to produce the final * memory address. */ -static CARD32 radeon_mba_z16(RADEONInfoPtr info, - int x, int y) +static CARD32 radeon_mba_z16(RADEONInfoPtr info, int x, int y) { - CARD32 pitch = info->frontPitch; - CARD32 ba, address = 0; /* a[0] = 0 */ + CARD32 pitch = info->frontPitch; + CARD32 address = 0; /* a[0] = 0 */ + CARD32 ba; ba = (y / 16) * (pitch / 32) + (x / 32); @@ -398,11 +427,11 @@ return address; } -static CARD32 radeon_mba_z32(RADEONInfoPtr info, - int x, int y) +static CARD32 radeon_mba_z32(RADEONInfoPtr info, int x, int y) { - CARD32 pitch = info->frontPitch; - CARD32 ba, address = 0; /* a[0..1] = 0 */ + CARD32 pitch = info->frontPitch; + CARD32 address = 0; /* a[0..1] = 0 */ + CARD32 ba; ba = (y / 16) * (pitch / 16) + (x / 16); @@ -438,7 +467,8 @@ } while (0) #define READ_DEPTH32(d, _x, _y) \ - d = *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) & 0x00ffffff + d = (*(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) \ + & 0x00ffffff) /* Screen to screen copy of data in the depth buffer */ static void RADEONScreenToScreenCopyDepth(ScrnInfoPtr pScrn, @@ -446,11 +476,11 @@ int xb, int yb, int w, int h) { - RADEONInfoPtr info = RADEONPTR(pScrn); - int xstart, xend, xdir; - int ystart, yend, ydir; - int x, y, d; - unsigned char *buf = info->FB + info->depthOffset; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *buf = info->FB + info->depthOffset; + int xstart, xend, xdir; + int ystart, yend, ydir; + int x, y, d; if (xa < xb) xdir = -1, xstart = w-1, xend = 0; else xdir = 1, xstart = 0, xend = w-1; @@ -467,6 +497,7 @@ } } break; + case 32: for (x = xstart; x != xend; x += xdir) { for (y = ystart; y != yend; y += ydir) { @@ -475,86 +506,18 @@ } } break; - default: break; + + default: + break; } } -/* Initialize the state of the back and depth buffers. */ +/* Initialize the state of the back and depth buffers */ static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) { - /* FIXME: This routine needs to have acceleration turned on */ - ScreenPtr pScreen = pWin->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONSAREAPrivPtr pSAREAPriv; - BoxPtr pbox; - int nbox; - unsigned int color, depth; - unsigned int color_mask, depth_mask; - - /* FIXME: This should be based on the __GLXvisualConfig info */ - color = 0; - switch (pScrn->bitsPerPixel) { - case 16: - depth = 0x0000ffff; - color_mask = 0x0000ffff; - depth_mask = 0xffffffff; - break; - case 32: - depth = 0x00ffffff; - color_mask = 0xffffffff; - depth_mask = 0xffffffff; - break; - default: - depth = 0x00000000; - color_mask = 0x00000000; - depth_mask = 0x00000000; - break; - } - - /* FIXME: Copy XAAPaintWindow() and use REGION_TRANSLATE() */ - /* FIXME: Only initialize the back and depth buffers for contexts - that request them */ - - FLUSH_RING(); - - pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); - - pbox = REGION_RECTS(prgn); - nbox = REGION_NUM_RECTS(prgn); - - for (; nbox; nbox--, pbox++) { - int ret; - - /* drmRadeonClear uses the clip rects to draw instead of the - rect passed to it; however, it uses the rect for the depth - clears */ - pSAREAPriv->boxes[0].x1 = pbox->x1; - pSAREAPriv->boxes[0].x2 = pbox->x2; - pSAREAPriv->boxes[0].y1 = pbox->y1; - pSAREAPriv->boxes[0].y2 = pbox->y2; - pSAREAPriv->nbox = 1; - - ret = drmRadeonClear(info->drmFD, - DRM_RADEON_BACK | DRM_RADEON_DEPTH, - color, depth, color_mask, depth_mask, - pSAREAPriv->boxes, pSAREAPriv->nbox); - if (ret) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] DRIInitBuffers timed out, resetting engine...\n"); - RADEONEngineReset(pScrn); - RADEONEngineRestore(pScrn); - RADEONCP_RESET(pScrn, info); - RADEONCP_START(pScrn, info); - return; - } - } - - /* Mark the X server as the last context owner */ - pSAREAPriv->ctxOwner = DRIGetContext(pScreen); - - RADEONSelectBuffer(pScrn, RADEON_FRONT); - info->accel->NeedToSync = TRUE; + /* NOOP. There's no need for the 2d driver to be clearing buffers + * for the 3d client. It knows how to do that on its own. + */ } /* Copy the back and depth buffers when the X server moves a window. @@ -567,28 +530,28 @@ static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 indx) { - ScreenPtr pScreen = pParent->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - - BoxPtr pboxTmp, pboxNext, pboxBase; - DDXPointPtr pptTmp; - int xdir, ydir; - - int screenwidth = pScrn->virtualX; - int screenheight = pScrn->virtualY; - - BoxPtr pbox = REGION_RECTS(prgnSrc); - int nbox = REGION_NUM_RECTS(prgnSrc); - - BoxPtr pboxNew1 = NULL; - BoxPtr pboxNew2 = NULL; - DDXPointPtr pptNew1 = NULL; - DDXPointPtr pptNew2 = NULL; - DDXPointPtr pptSrc = &ptOldOrg; + ScreenPtr pScreen = pParent->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + BoxPtr pboxTmp, pboxNext, pboxBase; + DDXPointPtr pptTmp; + int xdir, ydir; + + int screenwidth = pScrn->virtualX; + int screenheight = pScrn->virtualY; + + BoxPtr pbox = REGION_RECTS(prgnSrc); + int nbox = REGION_NUM_RECTS(prgnSrc); + + BoxPtr pboxNew1 = NULL; + BoxPtr pboxNew2 = NULL; + DDXPointPtr pptNew1 = NULL; + DDXPointPtr pptNew2 = NULL; + DDXPointPtr pptSrc = &ptOldOrg; - int dx = pParent->drawable.x - ptOldOrg.x; - int dy = pParent->drawable.y - ptOldOrg.y; + int dx = pParent->drawable.x - ptOldOrg.x; + int dy = pParent->drawable.y - ptOldOrg.y; /* If the copy will overlap in Y, reverse the order */ if (dy > 0) { @@ -598,23 +561,30 @@ /* Keep ordering in each band, reverse order of bands */ pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); if (!pboxNew1) return; + pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); if (!pptNew1) { DEALLOCATE_LOCAL(pboxNew1); return; } + pboxBase = pboxNext = pbox+nbox-1; + while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; + pboxTmp = pboxNext+1; pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; *pptNew1++ = *pptTmp++; } + pboxBase = pboxNext; } + pboxNew1 -= nbox; pbox = pboxNew1; pptNew1 -= nbox; @@ -633,6 +603,7 @@ /* reverse order of rects in each band */ pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + if (!pboxNew2 || !pptNew2) { DEALLOCATE_LOCAL(pptNew2); DEALLOCATE_LOCAL(pboxNew2); @@ -640,19 +611,25 @@ DEALLOCATE_LOCAL(pboxNew1); return; } + pboxBase = pboxNext = pbox; + while (pboxBase < pbox+nbox) { while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; + pboxTmp = pboxNext; pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp != pboxBase) { *pboxNew2++ = *--pboxTmp; *pptNew2++ = *--pptTmp; } + pboxBase = pboxNext; } + pboxNew2 -= nbox; pbox = pboxNew2; pptNew2 -= nbox; @@ -667,12 +644,12 @@ (CARD32)(-1), -1); for (; nbox-- ; pbox++) { - int xa = pbox->x1; - int ya = pbox->y1; - int destx = xa + dx; - int desty = ya + dy; - int w = pbox->x2 - xa + 1; - int h = pbox->y2 - ya + 1; + int xa = pbox->x1; + int ya = pbox->y1; + int destx = xa + dx; + int desty = ya + dy; + int w = pbox->x2 - xa + 1; + int h = pbox->y2 - ya + 1; if (destx < 0) xa -= destx, w += destx, destx = 0; if (desty < 0) ya -= desty, h += desty, desty = 0; @@ -687,13 +664,14 @@ xa, ya, destx, desty, w, h); - RADEONSelectBuffer(pScrn, RADEON_DEPTH); - if (info->depthMoves) + if (info->depthMoves) { + RADEONSelectBuffer(pScrn, RADEON_DEPTH); RADEONScreenToScreenCopyDepth(pScrn, xa, ya, destx, desty, w, h); + } } RADEONSelectBuffer(pScrn, RADEON_FRONT); @@ -707,24 +685,31 @@ } /* Initialize the AGP state. Request memory for use in AGP space, and - initialize the Radeon registers to point to that memory. */ + * initialize the Radeon registers to point to that memory. + */ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) { unsigned char *RADEONMMIO = info->MMIO; - unsigned long mode; - unsigned int vendor, device; - int ret; - int s, l; + unsigned long mode; + unsigned int vendor, device; + unsigned long agpBase; + int ret; + int s, l; if (drmAgpAcquire(info->drmFD) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not available\n"); + xf86DrvMsg(pScreen->myNum, X_WARNING, "[agp] AGP not available\n"); return FALSE; } + + /* Workaround for some hardware bugs */ + if (info->ChipFamily < CHIP_FAMILY_R200) + OUTREG(RADEON_AGP_CNTL, INREG(RADEON_AGP_CNTL) | 0x000e0000); - /* Modify the mode if the default mode is - not appropriate for this particular - combination of graphics card and AGP - chipset. */ + /* Modify the mode if the default mode + * is not appropriate for this + * particular combination of graphics + * card and AGP chipset. + */ mode = drmAgpGetMode(info->drmFD); /* Default mode */ vendor = drmAgpVendorId(info->drmFD); @@ -737,6 +722,24 @@ case 1: default: mode |= RADEON_AGP_1X_MODE; } + if (info->agpFastWrite) mode |= RADEON_AGP_FW_MODE; + + if ((vendor == PCI_VENDOR_AMD) && + (device == PCI_CHIP_AMD761)) { + /* The combination of 761 with MOBILITY chips will lockup the + * system; however, currently there is no such a product on the + * market, so this is not yet a problem. + */ + if ((info->ChipFamily == CHIP_FAMILY_M6) || + (info->ChipFamily == CHIP_FAMILY_M7)) + return FALSE; + + /* Disable fast write for AMD 761 chipset, since they cause + * lockups when enabled. + */ + mode &= ~0x10; /* FIXME: Magic number */ + } + xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n", mode, vendor, device, @@ -868,23 +871,20 @@ (unsigned long)info->agpTex); /* Initialize Radeon's AGP registers */ - /* Ring buffer is at AGP offset 0 */ - OUTREG(RADEON_AGP_BASE, info->ringHandle); - /* Enable bus mastering in PCI config - space */ - xf86EnablePciBusMaster(info->PciInfo, TRUE); + agpBase = drmAgpBase(info->drmFD); + OUTREG(RADEON_AGP_BASE, agpBase); return TRUE; } -#if defined(PCIGART_ENABLED) /* Initialize the PCIGART state. Request memory for use in PCI space, - and initialize the Radeon registers to point to that memory. */ + * and initialize the Radeon registers to point to that memory. + */ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) { - int ret; - int flags; + int ret; + int flags; info->agpOffset = 0; @@ -931,7 +931,7 @@ (unsigned long)info->ring); xf86DrvMsg(pScreen->myNum, X_INFO, "[pci] Ring contents 0x%08lx\n", - *(unsigned long *)info->ring); + *(unsigned long *)(pointer)info->ring); if (drmAddMap(info->drmFD, info->ringReadOffset, info->ringReadMapSize, DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) { @@ -954,7 +954,7 @@ (unsigned long)info->ringReadPtr); xf86DrvMsg(pScreen->myNum, X_INFO, "[pci] Ring read ptr contents 0x%08lx\n", - *(unsigned long *)info->ringReadPtr); + *(unsigned long *)(pointer)info->ringReadPtr); if (drmAddMap(info->drmFD, info->bufStart, info->bufMapSize, DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) { @@ -977,14 +977,14 @@ (unsigned long)info->buf); xf86DrvMsg(pScreen->myNum, X_INFO, "[pci] Vertex/indirect buffers contents 0x%08lx\n", - *(unsigned long *)info->buf); + *(unsigned long *)(pointer)info->buf); return TRUE; } -#endif /* Add a map for the MMIO registers that will be accessed by any - DRI-based clients. */ + * DRI-based clients. + */ static Bool RADEONDRIMapInit(RADEONInfoPtr info, ScreenPtr pScreen) { /* Map registers */ @@ -999,12 +999,21 @@ return TRUE; } -/* Initialize the kernel data structures. */ +/* Initialize the kernel data structures */ static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - int cpp = info->CurrentLayout.pixel_bytes; - drmRadeonInit drmInfo; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + int cpp = info->CurrentLayout.pixel_bytes; + drmRadeonInit drmInfo; + + memset(&drmInfo, 0, sizeof(drmRadeonInit)); + + if ( (info->ChipFamily == CHIP_FAMILY_R200) || + (info->ChipFamily == CHIP_FAMILY_RV250) || + (info->ChipFamily == CHIP_FAMILY_M9) ) + drmInfo.func = DRM_RADEON_INIT_R200_CP; + else + drmInfo.func = DRM_RADEON_INIT_CP; drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); drmInfo.is_pci = info->IsPCI; @@ -1023,38 +1032,64 @@ drmInfo.depth_offset = info->depthOffset; drmInfo.depth_pitch = info->depthPitch * cpp; - drmInfo.fb_offset = info->LinearAddr; + drmInfo.fb_offset = info->fbHandle; drmInfo.mmio_offset = info->registerHandle; drmInfo.ring_offset = info->ringHandle; drmInfo.ring_rptr_offset = info->ringReadPtrHandle; drmInfo.buffers_offset = info->bufHandle; drmInfo.agp_textures_offset = info->agpTexHandle; - if (drmRadeonInitCP(info->drmFD, &drmInfo) < 0) return FALSE; + if (drmCommandWrite(info->drmFD, DRM_RADEON_CP_INIT, + &drmInfo, sizeof(drmRadeonInit)) < 0) + return FALSE; - /* drmRadeonInitCP does an engine reset, which resets some engine - registers back to their default values, so we need to restore - those engine register here. */ + /* DRM_RADEON_CP_INIT does an engine reset, which resets some engine + * registers back to their default values, so we need to restore + * those engine register here. + */ RADEONEngineRestore(pScrn); return TRUE; } +static void RADEONDRIAgpHeapInit(RADEONInfoPtr info, ScreenPtr pScreen) +{ + drmRadeonMemInitHeap drmHeap; + + /* Start up the simple memory manager for agp space */ + if (info->drmMinor >= 6) { + drmHeap.region = RADEON_MEM_REGION_AGP; + drmHeap.start = 0; + drmHeap.size = info->agpTexMapSize; + + if (drmCommandWrite(info->drmFD, DRM_RADEON_INIT_HEAP, + &drmHeap, sizeof(drmHeap))) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Failed to initialized agp heap manager\n"); + } else { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] Initialized kernel agp heap manager, %d\n", + info->agpTexMapSize); + } + } else { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] Kernel module too old (1.%d) for agp heap manager\n", + info->drmMinor); + } +} + /* Add a map for the vertex buffers that will be accessed by any - DRI-based clients. */ + * DRI-based clients. + */ static Bool RADEONDRIBufInit(RADEONInfoPtr info, ScreenPtr pScreen) { /* Initialize vertex buffers */ if (info->IsPCI) { -#if !defined(PCIGART_ENABLED) - return TRUE; -#else info->bufNumBufs = drmAddBufs(info->drmFD, info->bufMapSize / RADEON_BUFFER_SIZE, RADEON_BUFFER_SIZE, DRM_SG_BUFFER, info->bufStart); -#endif } else { info->bufNumBufs = drmAddBufs(info->drmFD, info->bufMapSize / RADEON_BUFFER_SIZE, @@ -1083,10 +1118,40 @@ return TRUE; } +static void RADEONDRIIrqInit(RADEONInfoPtr info, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if (!info->irq) { + info->irq = drmGetInterruptFromBusID( + info->drmFD, + ((pciConfigPtr)info->PciInfo->thisCard)->busnum, + ((pciConfigPtr)info->PciInfo->thisCard)->devnum, + ((pciConfigPtr)info->PciInfo->thisCard)->funcnum); + + if ((drmCtlInstHandler(info->drmFD, info->irq)) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding irq handler, " + "there is a device already using that irq\n" + "[drm] falling back to irq-free operation\n"); + info->irq = 0; + } else { + unsigned char *RADEONMMIO = info->MMIO; + info->ModeReg.gen_int_cntl = INREG( RADEON_GEN_INT_CNTL ); + } + } + + if (info->irq) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + info->irq); +} + + /* Initialize the CP state, and start the CP (if used by the X server) */ static void RADEONDRICPInit(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); /* Turn on bus mastering */ info->BusCntl &= ~RADEON_BUS_MASTER_DIS; @@ -1096,214 +1161,30 @@ RADEONSelectBuffer(pScrn, RADEON_FRONT); } -/* Initialize the DRI specific hardware state stored in the SAREA. - Currently, this involves setting up the 3D hardware state. */ -static void RADEONDRISAREAInit(ScreenPtr pScreen, - RADEONSAREAPrivPtr pSAREAPriv) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - radeon_context_regs_t *ctx; - radeon_texture_regs_t *tex; - CARD32 color_fmt, depth_fmt; - int i; - - switch (info->CurrentLayout.pixel_code) { - case 16: - color_fmt = RADEON_COLOR_FORMAT_RGB565; - depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; - break; - case 32: - color_fmt = RADEON_COLOR_FORMAT_ARGB8888; - depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; - break; - default: - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] RADEONDRISAREAInit failed: Unsupported depth (%d bpp). Disabling DRI.\n", - info->CurrentLayout.pixel_code); - return; - } - - /* Initialize the context state */ - ctx = &pSAREAPriv->ContextState; - - ctx->pp_misc = (RADEON_ALPHA_TEST_PASS | - RADEON_CHROMA_FUNC_FAIL | - RADEON_CHROMA_KEY_NEAREST | - RADEON_SHADOW_FUNC_EQUAL | - RADEON_SHADOW_PASS_1 | - RADEON_RIGHT_HAND_CUBE_OGL); - - ctx->pp_fog_color = ((0x00000000 & RADEON_FOG_COLOR_MASK) | - RADEON_FOG_VERTEX | - RADEON_FOG_USE_DEPTH); - - ctx->re_solid_color = 0x00000000; - - ctx->rb3d_blendcntl = (RADEON_SRC_BLEND_GL_ONE | - RADEON_DST_BLEND_GL_ZERO ); - - ctx->rb3d_depthoffset = info->depthOffset; - - ctx->rb3d_depthpitch = ((info->depthPitch & RADEON_DEPTHPITCH_MASK) | - RADEON_DEPTH_ENDIAN_NO_SWAP); - - ctx->rb3d_zstencilcntl = (depth_fmt | - RADEON_Z_TEST_LESS | - RADEON_STENCIL_TEST_ALWAYS | - RADEON_STENCIL_S_FAIL_KEEP | - RADEON_STENCIL_ZPASS_KEEP | - RADEON_STENCIL_ZFAIL_KEEP | - RADEON_Z_WRITE_ENABLE); - - ctx->pp_cntl = (RADEON_SCISSOR_ENABLE | - RADEON_ANTI_ALIAS_NONE); - - ctx->rb3d_cntl = (RADEON_PLANE_MASK_ENABLE | - color_fmt | - RADEON_ZBLOCK16); - - ctx->rb3d_coloroffset = (info->backOffset & RADEON_COLOROFFSET_MASK); - - ctx->re_width_height = ((0x7ff << RADEON_RE_WIDTH_SHIFT) | - (0x7ff << RADEON_RE_HEIGHT_SHIFT)); - - ctx->rb3d_colorpitch = ((info->backPitch & RADEON_COLORPITCH_MASK) | - RADEON_COLOR_ENDIAN_NO_SWAP); - - ctx->se_cntl = (RADEON_FFACE_CULL_CW | - RADEON_BFACE_SOLID | - RADEON_FFACE_SOLID | - RADEON_FLAT_SHADE_VTX_LAST | - RADEON_DIFFUSE_SHADE_GOURAUD | - RADEON_ALPHA_SHADE_GOURAUD | - RADEON_SPECULAR_SHADE_GOURAUD | - RADEON_FOG_SHADE_GOURAUD | - RADEON_VPORT_XY_XFORM_ENABLE | - RADEON_VTX_PIX_CENTER_OGL | - RADEON_ROUND_MODE_TRUNC | - RADEON_ROUND_PREC_8TH_PIX); - - ctx->se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 | - RADEON_VTX_Z_PRE_MULT_1_OVER_W0 | - RADEON_TEX1_W_ROUTING_USE_Q1); - - ctx->re_line_pattern = ((0x0000 & RADEON_LINE_PATTERN_MASK) | - (0 << RADEON_LINE_REPEAT_COUNT_SHIFT) | - (0 << RADEON_LINE_PATTERN_START_SHIFT) | - RADEON_LINE_PATTERN_LITTLE_BIT_ORDER); - - ctx->re_line_state = ((0 << RADEON_LINE_CURRENT_PTR_SHIFT) | - (0 << RADEON_LINE_CURRENT_COUNT_SHIFT)); - - ctx->se_line_width = 0x0000000; - - ctx->pp_lum_matrix = 0x00000000; - - ctx->pp_rot_matrix_0 = 0x00000000; - ctx->pp_rot_matrix_1 = 0x00000000; - - ctx->rb3d_stencilrefmask = - (CARD32)((0x000 << RADEON_STENCIL_REF_SHIFT) | - (0x0ff << RADEON_STENCIL_MASK_SHIFT) | - (0x0ff << RADEON_STENCIL_WRITEMASK_SHIFT)); - - ctx->rb3d_ropcntl = 0x00000000; - ctx->rb3d_planemask = 0xffffffff; - - ctx->se_vport_xscale = 0x00000000; - ctx->se_vport_xoffset = 0x00000000; - ctx->se_vport_yscale = 0x00000000; - ctx->se_vport_yoffset = 0x00000000; - ctx->se_vport_zscale = 0x00000000; - ctx->se_vport_zoffset = 0x00000000; - - ctx->se_cntl_status = (RADEON_VC_NO_SWAP | - RADEON_TCL_BYPASS); - -#ifdef TCL_ENABLE - /* FIXME: Obviously these need to be properly initialized */ - ctx->se_tcl_material_emmissive.red = 0x00000000; - ctx->se_tcl_material_emmissive.green = 0x00000000; - ctx->se_tcl_material_emmissive.blue = 0x00000000; - ctx->se_tcl_material_emmissive.alpha = 0x00000000; - - ctx->se_tcl_material_ambient.red = 0x00000000; - ctx->se_tcl_material_ambient.green = 0x00000000; - ctx->se_tcl_material_ambient.blue = 0x00000000; - ctx->se_tcl_material_ambient.alpha = 0x00000000; - - ctx->se_tcl_material_diffuse.red = 0x00000000; - ctx->se_tcl_material_diffuse.green = 0x00000000; - ctx->se_tcl_material_diffuse.blue = 0x00000000; - ctx->se_tcl_material_diffuse.alpha = 0x00000000; - - ctx->se_tcl_material_specular.red = 0x00000000; - ctx->se_tcl_material_specular.green = 0x00000000; - ctx->se_tcl_material_specular.blue = 0x00000000; - ctx->se_tcl_material_specular.alpha = 0x00000000; - - ctx->se_tcl_shininess = 0x00000000; - ctx->se_tcl_output_vtx_fmt = 0x00000000; - ctx->se_tcl_output_vtx_sel = 0x00000000; - ctx->se_tcl_matrix_select_0 = 0x00000000; - ctx->se_tcl_matrix_select_1 = 0x00000000; - ctx->se_tcl_ucp_vert_blend_ctl = 0x00000000; - ctx->se_tcl_texture_proc_ctl = 0x00000000; - ctx->se_tcl_light_model_ctl = 0x00000000; - for ( i = 0 ; i < 4 ; i++ ) { - ctx->se_tcl_per_light_ctl[i] = 0x00000000; - } -#endif - ctx->re_top_left = ((0 << RADEON_RE_LEFT_SHIFT) | - (0 << RADEON_RE_TOP_SHIFT) ); - - ctx->re_misc = ((0 << RADEON_STIPPLE_X_OFFSET_SHIFT) | - (0 << RADEON_STIPPLE_Y_OFFSET_SHIFT) | - RADEON_STIPPLE_LITTLE_BIT_ORDER); - - /* Initialize the texture state */ - for (i = 0; i < RADEON_MAX_TEXTURE_UNITS; i++) { - tex = &pSAREAPriv->TexState[i]; - - tex->pp_txfilter = 0x00000000; - tex->pp_txformat = 0x00000000; - tex->pp_txoffset = 0x00000000; - tex->pp_txcblend = 0x00000000; - tex->pp_txablend = 0x00000000; - tex->pp_tfactor = 0x00000000; - tex->pp_border_color = 0x00000000; - } - - /* Mark the context as dirty */ - pSAREAPriv->dirty = RADEON_UPLOAD_ALL; - - /* Mark the X server as the last context owner */ - pSAREAPriv->ctxOwner = DRIGetContext(pScreen); -} - /* Initialize the screen-specific data structures for the DRI and the - Radeon. This is the main entry point to the device-specific - initialization code. It calls device-independent DRI functions to - create the DRI data structures and initialize the DRI state. */ + * Radeon. This is the main entry point to the device-specific + * initialization code. It calls device-independent DRI functions to + * create the DRI data structures and initialize the DRI state. + */ Bool RADEONDRIScreenInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - DRIInfoPtr pDRIInfo; - RADEONDRIPtr pRADEONDRI; - int major, minor, patch; - drmVersionPtr version; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + DRIInfoPtr pDRIInfo; + RADEONDRIPtr pRADEONDRI; + int major, minor, patch; + drmVersionPtr version; /* Check that the GLX, DRI, and DRM modules have been loaded by testing - * for known symbols in each module. */ + * for known symbols in each module. + */ if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE; if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] RADEONDRIScreenInit failed (libdri.a too old)\n"); + "[dri] RADEONDRIScreenInit failed (libdri.a too old)\n"); return FALSE; } @@ -1311,8 +1192,10 @@ DRIQueryVersion(&major, &minor, &patch); if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] RADEONDRIScreenInit failed because of a version mismatch.\n" - "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n" + "[dri] RADEONDRIScreenInit failed because of a version " + "mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version 4.0.x is " + "needed.\n" "[dri] Disabling DRI.\n", major, minor, patch); return FALSE; @@ -1324,7 +1207,8 @@ case 24: /* These modes are not supported (yet). */ xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] RADEONInitVisualConfigs failed (depth %d not supported). " + "[dri] RADEONInitVisualConfigs failed " + "(depth %d not supported). " "Disabling DRI.\n", info->CurrentLayout.pixel_code); return FALSE; @@ -1335,12 +1219,21 @@ } /* Create the DRI data structure, and fill it in before calling the - DRIScreenInit(). */ + * DRIScreenInit(). + */ if (!(pDRIInfo = DRICreateInfoRec())) return FALSE; info->pDRIInfo = pDRIInfo; pDRIInfo->drmDriverName = RADEON_DRIVER_NAME; - pDRIInfo->clientDriverName = RADEON_DRIVER_NAME; + + if (info->ChipFamily == CHIP_FAMILY_R200) + pDRIInfo->clientDriverName = R200_DRIVER_NAME; + else if ((info->ChipFamily == CHIP_FAMILY_RV250) || + (info->ChipFamily == CHIP_FAMILY_M9)) + pDRIInfo->clientDriverName = RV250_DRIVER_NAME; + else + pDRIInfo->clientDriverName = RADEON_DRIVER_NAME; + pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", @@ -1359,6 +1252,7 @@ < RADEON_MAX_DRAWABLES ? SAREA_MAX_DRAWABLES : RADEON_MAX_DRAWABLES); + #ifdef PER_CONTEXT_SAREA /* This is only here for testing per-context SAREAs. When used, the magic number below would be properly defined in a header file. */ @@ -1369,14 +1263,14 @@ /* FIXME: Need to extend DRI protocol to pass this size back to * client for SAREA mapping that includes a device private record */ - pDRIInfo->SAREASize = - ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */ + pDRIInfo->SAREASize = ((sizeof(XF86DRISAREARec) + 0xfff) + & 0x1000); /* round to page */ /* + shared memory device private rec */ #else /* For now the mapping works by using a fixed size defined * in the SAREA header */ - if (sizeof(XF86DRISAREARec)+sizeof(RADEONSAREAPriv)>SAREA_MAX) { + if (sizeof(XF86DRISAREARec)+sizeof(RADEONSAREAPriv) > SAREA_MAX) { ErrorF("Data does not fit in SAREA\n"); return FALSE; } @@ -1398,12 +1292,19 @@ pDRIInfo->InitBuffers = RADEONDRIInitBuffers; pDRIInfo->MoveBuffers = RADEONDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->OpenFullScreen = RADEONDRIOpenFullScreen; + pDRIInfo->CloseFullScreen = RADEONDRICloseFullScreen; + pDRIInfo->TransitionTo2d = RADEONDRITransitionTo2d; + pDRIInfo->TransitionTo3d = RADEONDRITransitionTo3d; + pDRIInfo->TransitionSingleToMulti3D = RADEONDRITransitionSingleToMulti3d; + pDRIInfo->TransitionMultiToSingle3D = RADEONDRITransitionMultiToSingle3d; pDRIInfo->createDummyCtx = TRUE; pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate = NULL; DRIDestroyInfoRec(pDRIInfo); @@ -1411,47 +1312,113 @@ return FALSE; } - /* Check the radeon DRM version */ - version = drmGetVersion(info->drmFD); + /* Check the DRM lib version. + * drmGetLibVersion was not supported in version 1.0, so check for + * symbol first to avoid possible crash or hang. + */ + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + version = drmGetLibVersion(info->drmFD); + } else { + /* drmlib version 1.0.0 didn't have the drmGetLibVersion + * entry point. Fake it by allocating a version record + * via drmGetVersion and changing it to version 1.0.0. + */ + version = drmGetVersion(info->drmFD); + version->version_major = 1; + version->version_minor = 0; + version->version_patchlevel = 0; + } + if (version) { if (version->version_major != 1 || version->version_minor < 1) { - /* incompatible drm version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] RADEONDRIScreenInit failed because of a version mismatch.\n" - "[dri] radeon.o kernel module version is %d.%d.%d but version 1.1.x is needed.\n" - "[dri] Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel); - drmFreeVersion(version); - RADEONDRICloseScreen(pScreen); - return FALSE; + /* incompatible drm library version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONDRIScreenInit failed because of a " + "version mismatch.\n" + "[dri] libdrm.a module version is %d.%d.%d but " + "version 1.1.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + RADEONDRICloseScreen(pScreen); + return FALSE; } drmFreeVersion(version); } -#if !defined(PCIGART_ENABLED) - /* Initialize AGP */ - if (!info->IsPCI && !RADEONDRIAgpInit(info, pScreen)) { - RADEONDRICloseScreen(pScreen); - return FALSE; - } + /* Check the radeon DRM version */ + version = drmGetVersion(info->drmFD); + if (version) { + int req_minor, req_patch; - /* Initialize PCI */ - if (info->IsPCI) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] PCI cards not yet supported. Disabling DRI.\n"); - RADEONDRICloseScreen(pScreen); - return FALSE; - } + if ((info->ChipFamily == CHIP_FAMILY_R200) || + (info->ChipFamily == CHIP_FAMILY_RV250) || + (info->ChipFamily == CHIP_FAMILY_M9)) { + req_minor = 5; + req_patch = 0; + } else { +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + req_minor = 1; + req_patch = 0; #else + req_minor = 2; + req_patch = 1; +#endif + } + + if (version->version_major != 1 || + version->version_minor < req_minor || + (version->version_minor == req_minor && + version->version_patchlevel < req_patch)) { + /* Incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONDRIScreenInit failed because of a version " + "mismatch.\n" + "[dri] radeon.o kernel module version is %d.%d.%d " + "but version 1.%d.%d or newer is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel, + req_minor, + req_patch); + drmFreeVersion(version); + RADEONDRICloseScreen(pScreen); + return FALSE; + } + + if (version->version_minor < 3) { + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[dri] Some DRI features disabled because of version " + "mismatch.\n" + "[dri] radeon.o kernel module version is %d.%d.%d but " + "1.3.1 or later is preferred.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + } + info->drmMinor = version->version_minor; + drmFreeVersion(version); + } + /* Initialize AGP */ if (!info->IsPCI && !RADEONDRIAgpInit(info, pScreen)) { +#if defined(__alpha__) || defined(__powerpc__) info->IsPCI = TRUE; xf86DrvMsg(pScreen->myNum, X_WARNING, - "[agp] AGP failed to initialize -- falling back to PCI mode.\n"); + "[agp] AGP failed to initialize " + "-- falling back to PCI mode.\n"); xf86DrvMsg(pScreen->myNum, X_WARNING, - "[agp] Make sure you have the agpgart kernel module loaded.\n"); + "[agp] If this is an AGP card, you may want to make sure " + "the agpgart\nkernel module is loaded before the radeon " + "kernel module.\n"); +#else + RADEONDRICloseScreen(pScreen); + return FALSE; +#endif } /* Initialize PCI */ @@ -1459,16 +1426,28 @@ RADEONDRICloseScreen(pScreen); return FALSE; } -#endif /* DRIScreenInit doesn't add all the - common mappings. Add additional - mappings here. */ + * common mappings. Add additional + * mappings here. + */ if (!RADEONDRIMapInit(info, pScreen)) { RADEONDRICloseScreen(pScreen); return FALSE; } + /* DRIScreenInit adds the frame buffer + map, but we need it as well */ + { + void *scratch_ptr; + int scratch_int; + + DRIGetDeviceInfo(pScreen, &info->fbHandle, + &scratch_int, &scratch_int, + &scratch_int, &scratch_int, + &scratch_ptr); + } + /* FIXME: When are these mappings unmapped? */ if (!RADEONInitVisualConfigs(pScreen)) { @@ -1481,22 +1460,24 @@ } /* Finish initializing the device-dependent DRI state, and call - DRIFinishScreenInit() to complete the device-independent DRI - initialization. */ + * DRIFinishScreenInit() to complete the device-independent DRI + * initialization. + */ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONSAREAPrivPtr pSAREAPriv; - RADEONDRIPtr pRADEONDRI; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONSAREAPrivPtr pSAREAPriv; + RADEONDRIPtr pRADEONDRI; info->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; /* info->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit - because *DRIKernelInit requires that the hardware lock is held by - the X server, and the first time the hardware lock is grabbed is - in DRIFinishScreenInit. */ + * because *DRIKernelInit requires that the hardware lock is held by + * the X server, and the first time the hardware lock is grabbed is + * in DRIFinishScreenInit. + */ if (!DRIFinishScreenInit(pScreen)) { RADEONDRICloseScreen(pScreen); return FALSE; @@ -1514,6 +1495,12 @@ return FALSE; } + /* Initialize IRQ */ + RADEONDRIIrqInit(info, pScreen); + + /* Initialize kernel agp memory manager */ + RADEONDRIAgpHeapInit(info, pScreen); + /* Initialize and start the CP if required */ RADEONDRICPInit(pScrn); @@ -1521,8 +1508,6 @@ pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - RADEONDRISAREAInit(pScreen, pSAREAPriv); - pRADEONDRI = (RADEONDRIPtr)info->pDRIInfo->devPrivate; pRADEONDRI->deviceID = info->Chipset; @@ -1562,21 +1547,46 @@ pRADEONDRI->perctx_sarea_size = info->perctx_sarea_size; #endif + /* Have shadowfb run only while there is 3d active. */ + if (info->allowPageFlip /* && info->drmMinor >= 3 */) { + ShadowFBInit( pScreen, RADEONDRIRefreshArea ); + } else { + info->allowPageFlip = 0; + } + return TRUE; } /* The screen is being closed, so clean up any state and free any - resources used by the DRI. */ + * resources used by the DRI. + */ void RADEONDRICloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + drmRadeonInit drmInfo; + RING_LOCALS; /* Stop the CP */ if (info->directRenderingEnabled) { + /* If we've generated any CP commands, we must flush them to the + * kernel module now. + */ + if (info->CPInUse) { + RADEON_FLUSH_CACHE(); + RADEON_WAIT_UNTIL_IDLE(); + RADEONCPReleaseIndirect(pScrn); + + info->CPInUse = FALSE; + } RADEONCP_STOP(pScrn, info); } + if (info->irq) { + drmCtlUninstHandler(info->drmFD); + info->irq = 0; + } + /* De-allocate vertex buffers */ if (info->buffers) { drmUnmapBufs(info->buffers); @@ -1584,7 +1594,10 @@ } /* De-allocate all kernel resources */ - drmRadeonCleanupCP(info->drmFD); + memset(&drmInfo, 0, sizeof(drmRadeonInit)); + drmInfo.func = DRM_RADEON_CLEANUP_CP; + drmCommandWrite(info->drmFD, DRM_RADEON_CP_INIT, + &drmInfo, sizeof(drmRadeonInit)); /* De-allocate all AGP resources */ if (info->agpTex) { @@ -1634,4 +1647,214 @@ xfree(info->pVisualConfigsPriv); info->pVisualConfigsPriv = NULL; } +} + + + +/* Fullscreen hooks. The DRI fullscreen mode can probably be removed as + * it adds little or nothing above the mechanism below (and isn't widely + * used). + */ +static Bool RADEONDRIOpenFullScreen(ScreenPtr pScreen) +{ + return TRUE; +} + +static Bool RADEONDRICloseFullScreen(ScreenPtr pScreen) +{ + return TRUE; +} + + + +/* Use callbacks from dri.c to support pageflipping mode for a single + * 3d context without need for any specific full-screen extension. + * + * Also use these callbacks to allocate and free 3d-specific memory on + * demand. + */ + + +/* Use the shadowfb module to maintain a list of dirty rectangles. + * These are blitted to the back buffer to keep both buffers clean + * during page-flipping when the 3d application isn't fullscreen. + * + * Unlike most use of the shadowfb code, both buffers are in video memory. + * + * An alternative to this would be to organize for all on-screen drawing + * operations to be duplicated for the two buffers. That might be + * faster, but seems like a lot more work... + */ + + +static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + int i; + RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); + + /* Don't want to do this when no 3d is active and pages are + * right-way-round + */ + if (!pSAREAPriv->pfAllowPageFlip && pSAREAPriv->pfCurrentPage == 0) + return; + + (*info->accel->SetupForScreenToScreenCopy)(pScrn, + 1, 1, GXcopy, + (CARD32)(-1), -1); + + for (i = 0 ; i < num ; i++, pbox++) { + int xa = max(pbox->x1, 0), xb = min(pbox->x2, pScrn->virtualX-1); + int ya = max(pbox->y1, 0), yb = min(pbox->y2, pScrn->virtualY-1); + + if (xa <= xb && ya <= yb) { + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, xa, ya, + xa + info->backX, + ya + info->backY, + xb - xa + 1, + yb - ya + 1); + } + } +} + +static void RADEONEnablePageFlip(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen); + + if (info->allowPageFlip) { + /* Duplicate the frontbuffer to the backbuffer */ + (*info->accel->SetupForScreenToScreenCopy)(pScrn, + 1, 1, GXcopy, + (CARD32)(-1), -1); + + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, + 0, + 0, + info->backX, + info->backY, + pScrn->virtualX, + pScrn->virtualY); + + pSAREAPriv->pfAllowPageFlip = 1; + } +} + +static void RADEONDisablePageFlip(ScreenPtr pScreen) +{ + /* Tell the clients not to pageflip. How? + * -- Field in sarea, plus bumping the window counters. + * -- DRM needs to cope with Front-to-Back swapbuffers. + */ + RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen); + + pSAREAPriv->pfAllowPageFlip = 0; +} + +static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen) +{ + RADEONDisablePageFlip(pScreen); +} + +static void RADEONDRITransitionMultiToSingle3d(ScreenPtr pScreen) +{ + /* Let the remaining 3d app start page flipping again */ + RADEONEnablePageFlip(pScreen); +} + +static void RADEONDRITransitionTo3d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + FBAreaPtr fbarea; + int width, height; + + /* reserve offscreen area for back and depth buffers and textures */ + + /* If we still have an area for the back buffer reserved, free it + * first so we always start with all free offscreen memory, except + * maybe for Xv + */ + if (info->backArea) { + xf86FreeOffscreenArea(info->backArea); + info->backArea = NULL; + } + + xf86PurgeUnlockedOffscreenAreas(pScreen); + + xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0); + + /* Free Xv linear offscreen memory if necessary */ + if (height < (info->depthTexLines + info->backLines)) { + xf86FreeOffscreenLinear(info->videoLinear); + info->videoLinear = NULL; + xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0); + } + + /* Reserve placeholder area so the other areas will match the + * pre-calculated offsets + */ + fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + height + - info->depthTexLines + - info->backLines, + pScrn->displayWidth, + NULL, NULL, NULL); + if (!fbarea) + xf86DrvMsg(pScreen->myNum, X_ERROR, "Unable to reserve placeholder " + "offscreen area, you might experience screen corruption\n"); + + info->backArea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + info->backLines, + pScrn->displayWidth, + NULL, NULL, NULL); + if (!info->backArea) + xf86DrvMsg(pScreen->myNum, X_ERROR, "Unable to reserve offscreen " + "area for back buffer, you might experience screen " + "corruption\n"); + + info->depthTexArea = xf86AllocateOffscreenArea(pScreen, + pScrn->displayWidth, + info->depthTexLines, + pScrn->displayWidth, + NULL, NULL, NULL); + if (!info->depthTexArea) + xf86DrvMsg(pScreen->myNum, X_ERROR, "Unable to reserve offscreen " + "area for depth buffer and textures, you might " + "experience screen corruption\n"); + + xf86FreeOffscreenArea(fbarea); + + RADEONEnablePageFlip(pScreen); + + info->have3DWindows = 1; + + if (info->cursor_start) + xf86ForceHWCursor (pScreen, TRUE); +} + +static void RADEONDRITransitionTo2d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen); + + /* Shut down shadowing if we've made it back to the front page */ + if (pSAREAPriv->pfCurrentPage == 0) { + RADEONDisablePageFlip(pScreen); + xf86FreeOffscreenArea(info->backArea); + info->backArea = NULL; + } else { + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[dri] RADEONDRITransitionTo2d: " + "kernel failed to unflip buffers.\n"); + } + + xf86FreeOffscreenArea(info->depthTexArea); + + info->have3DWindows = 0; + + if (info->cursor_start) + xf86ForceHWCursor (pScreen, FALSE); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h:1.2 Wed Mar 21 12:02:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h Wed Oct 30 07:52:13 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.4 2002/10/30 12:52:13 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -20,7 +20,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> * */ @@ -38,29 +38,30 @@ #define _RADEON_DRI_ #include "xf86drm.h" -#include "xf86drmRadeon.h" +#include "radeon_common.h" /* DRI Driver defaults */ -#define RADEON_DEFAULT_CP_PIO_MODE RADEON_CSQ_PRIPIO_INDPIO -#define RADEON_DEFAULT_CP_BM_MODE RADEON_CSQ_PRIBM_INDBM -#define RADEON_DEFAULT_AGP_MODE 1 -#define RADEON_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */ -#define RADEON_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ -#define RADEON_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ -#define RADEON_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */ +#define RADEON_DEFAULT_CP_PIO_MODE RADEON_CSQ_PRIPIO_INDPIO +#define RADEON_DEFAULT_CP_BM_MODE RADEON_CSQ_PRIBM_INDBM +#define RADEON_DEFAULT_AGP_MODE 1 +#define RADEON_DEFAULT_AGP_FAST_WRITE 0 +#define RADEON_DEFAULT_AGP_SIZE 8 /* MB (must be 2^n and > 4MB) */ +#define RADEON_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ +#define RADEON_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ +#define RADEON_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */ -#define RADEON_DEFAULT_CP_TIMEOUT 10000 /* usecs */ +#define RADEON_DEFAULT_CP_TIMEOUT 10000 /* usecs */ -#define RADEON_AGP_MAX_MODE 4 +#define RADEON_AGP_MAX_MODE 4 -#define RADEON_CARD_TYPE_RADEON 1 +#define RADEON_CARD_TYPE_RADEON 1 /* Buffer are aligned on 4096 byte boundaries */ -#define RADEON_BUFFER_ALIGN 0x00000fff +#define RADEON_BUFFER_ALIGN 0x00000fff -#define RADEONCP_USE_RING_BUFFER(m) \ -(((m) == RADEON_CSQ_PRIBM_INDDIS) || \ - ((m) == RADEON_CSQ_PRIBM_INDBM)) +#define RADEONCP_USE_RING_BUFFER(m) \ + (((m) == RADEON_CSQ_PRIBM_INDDIS) || \ + ((m) == RADEON_CSQ_PRIBM_INDBM)) typedef struct { /* DRI screen private data */ @@ -99,7 +100,7 @@ unsigned int sarea_priv_offset; #ifdef PER_CONTEXT_SAREA - drmSize perctx_sarea_size; + drmSize perctx_sarea_size; #endif } RADEONDRIRec, *RADEONDRIPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h:1.2 Wed Mar 21 12:02:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h Wed Oct 30 07:52:13 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.4 2002/10/30 12:52:13 alanh Exp $ */ /* - * Copyright 2000 ATI Technologies Inc., Markham, Ontario, + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. * * All Rights Reserved. @@ -20,7 +20,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> * */ @@ -39,7 +39,7 @@ #include "GL/glxint.h" #include "xf86drm.h" -#include "xf86drmRadeon.h" +#include "radeon_common.h" #define RADEON_MAX_DRAWABLES 256 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.50 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.91 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.50 Tue Jan 15 21:00:43 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c Mon Feb 24 22:50:15 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.50 2002/01/16 02:00:43 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.91 2003/02/25 03:50:15 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,9 +29,9 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> - * Alan Hourihane <ahourihane@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * * Credits: * @@ -52,7 +52,7 @@ * This server does not yet support these XFree86 4.0 features: * !!!! FIXME !!!! * DDC1 & DDC2 - * shadowfb + * shadowfb (Note: dri uses shadowfb for another purpose in radeon_dri.c) * overlay planes * * Modified by Marc Aurele La France (tsi@xfree86.org) for ATI driver merge. @@ -60,6 +60,7 @@ /* Driver data structures */ #include "radeon.h" +#include "radeon_macros.h" #include "radeon_probe.h" #include "radeon_reg.h" #include "radeon_version.h" @@ -82,7 +83,6 @@ #include "cfb16.h" #include "cfb24.h" #include "cfb32.h" -#include "cfb24_32.h" #endif /* colormap initialization */ @@ -94,6 +94,7 @@ #include "xf86_OSproc.h" #include "xf86PciInfo.h" #include "xf86RAC.h" +#include "xf86Resources.h" #include "xf86cmap.h" #include "vbe.h" @@ -123,38 +124,53 @@ #ifdef XF86DRI OPTION_IS_PCI, OPTION_CP_PIO, - OPTION_NO_SECURITY, OPTION_USEC_TIMEOUT, OPTION_AGP_MODE, + OPTION_AGP_FW, OPTION_AGP_SIZE, OPTION_RING_SIZE, OPTION_BUFFER_SIZE, OPTION_DEPTH_MOVE, + OPTION_PAGE_FLIP, + OPTION_NO_BACKBUFFER, #endif - OPTION_CRT_SCREEN, - OPTION_PANEL_SIZE, - OPTION_FBDEV + OPTION_PANEL_OFF, + OPTION_DDC_MODE, + OPTION_CLONE_DISPLAY, + OPTION_CLONE_MODE, + OPTION_CLONE_HSYNC, + OPTION_CLONE_VREFRESH, + OPTION_FBDEV, + OPTION_VIDEO_KEY } RADEONOpts; const OptionInfoRec RADEONOptions[] = { - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE }, #ifdef XF86DRI - { OPTION_IS_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_CP_PIO, "CPPIOMode", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_USEC_TIMEOUT, "CPusecTimeout", OPTV_INTEGER, {0}, FALSE }, - { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, - { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_DEPTH_MOVE, "EnableDepthMoves", OPTV_BOOLEAN, {0}, FALSE }, -#endif - { OPTION_CRT_SCREEN, "CrtScreen", OPTV_BOOLEAN, {0}, FALSE}, - { OPTION_PANEL_SIZE, "PanelSize", OPTV_ANYSTR, {0}, FALSE }, - { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } + { OPTION_IS_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CP_PIO, "CPPIOMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_USEC_TIMEOUT, "CPusecTimeout", OPTV_INTEGER, {0}, FALSE }, + { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, + { OPTION_AGP_FW, "AGPFastWrite", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DEPTH_MOVE, "EnableDepthMoves", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_PAGE_FLIP, "EnablePageFlip", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NO_BACKBUFFER, "NoBackBuffer", OPTV_BOOLEAN, {0}, FALSE }, +#endif + { OPTION_PANEL_OFF, "PanelOff", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DDC_MODE, "DDCMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CLONE_DISPLAY, "CloneDisplay", OPTV_INTEGER, {0}, FALSE }, + { OPTION_CLONE_MODE, "CloneMode", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_CLONE_HSYNC, "CloneHSync", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_CLONE_VREFRESH, "CloneVRefresh", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; RADEONRAMRec RADEONRAM[] = { /* Memory Specifications @@ -181,6 +197,8 @@ "fbdevHWGetVidmem", + "fbdevHWDPMSSet", + /* colormap */ "fbdevHWLoadPalette", /* ScrnInfo hooks */ @@ -220,7 +238,6 @@ "cfb16ScreenInit", "cfb24ScreenInit", "cfb32ScreenInit", - "cfb24_32ScreenInit", NULL }; #endif @@ -242,16 +259,21 @@ static const char *ramdacSymbols[] = { "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86ForceHWCursor", "xf86InitCursor", NULL }; #ifdef XF86DRI static const char *drmSymbols[] = { + "drmGetInterruptFromBusID", + "drmCtlInstHandler", + "drmCtlUninstHandler", "drmAddBufs", "drmAddMap", "drmAgpAcquire", "drmAgpAlloc", + "drmAgpBase", "drmAgpBind", "drmAgpDeviceId", "drmAgpEnable", @@ -260,8 +282,13 @@ "drmAgpRelease", "drmAgpUnbind", "drmAgpVendorId", + "drmCommandNone", + "drmCommandRead", + "drmCommandWrite", + "drmCommandWriteRead", "drmDMA", "drmFreeVersion", + "drmGetLibVersion", "drmGetVersion", "drmMap", "drmMapBufs", @@ -273,7 +300,8 @@ "drmRadeonStartCP", "drmRadeonStopCP", "drmRadeonWaitForIdleCP", - "drmScatterGatherFree" + "drmScatterGatherAlloc", + "drmScatterGatherFree", "drmUnmap", "drmUnmapBufs", NULL @@ -285,6 +313,7 @@ "DRIDestroyInfoRec", "DRIFinishScreenInit", "DRIGetContext", + "DRIGetDeviceInfo", "DRIGetSAREAPrivate", "DRILock", "DRIQueryVersion", @@ -293,6 +322,11 @@ "GlxSetVisualConfigs", NULL }; + +static const char *driShadowFBSymbols[] = { + "ShadowFBInit", + NULL +}; #endif static const char *vbeSymbols[] = { @@ -314,18 +348,80 @@ NULL }; +void RADEONLoaderRefSymLists(void) +{ + /* + * Tell the loader about symbols from other modules that this module might + * refer to. + */ + xf86LoaderRefSymLists(vgahwSymbols, +#ifdef USE_FB + fbSymbols, +#else + cfbSymbols, +#endif + xaaSymbols, +#if 0 + xf8_32bppSymbols, +#endif + ramdacSymbols, +#ifdef XF86DRI + drmSymbols, + driSymbols, + driShadowFBSymbols, +#endif + fbdevHWSymbols, + vbeSymbols, + int10Symbols, + i2cSymbols, + ddcSymbols, + NULL); +} + +/* Established timings from EDID standard */ +static struct +{ + int hsize; + int vsize; + int refresh; +} est_timings[] = { + {1280, 1024, 75}, + {1024, 768, 75}, + {1024, 768, 70}, + {1024, 768, 60}, + {1024, 768, 87}, + {832, 624, 75}, + {800, 600, 75}, + {800, 600, 72}, + {800, 600, 60}, + {800, 600, 56}, + {640, 480, 75}, + {640, 480, 72}, + {640, 480, 67}, + {640, 480, 60}, + {720, 400, 88}, + {720, 400, 70}, +}; + extern int gRADEONEntityIndex; -#if !defined(__alpha__) -# define RADEONPreInt10Save(s, r1, r2) -# define RADEONPostInt10Check(s, r1, r2) -#else /* __alpha__ */ +struct RADEONInt10Save { + CARD32 MEM_CNTL; + CARD32 MEMSIZE; + CARD32 MPP_TB_CONFIG; +}; + +static Bool RADEONMapMMIO(ScrnInfoPtr pScrn); +static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn); + static void -RADEONSaveRegsZapMemCntl(ScrnInfoPtr pScrn, CARD32 *MEM_CNTL, CARD32 *MEMSIZE) +RADEONPreInt10Save(ScrnInfoPtr pScrn, void **pPtr) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO; - int mapped = 0; + int mapped = 0; + CARD32 CardTmp; + static struct RADEONInt10Save SaveStruct = { 0, 0, 0 }; /* * First make sure we have the pci and mmio info and that mmio is mapped @@ -335,7 +431,7 @@ if (!info->PciTag) info->PciTag = pciTag(info->PciInfo->bus, info->PciInfo->device, info->PciInfo->func); - if (!info->MMIOAddr) + if (!info->MMIOAddr) info->MMIOAddr = info->PciInfo->memBase[2] & 0xffffff00; if (!info->MMIO) { RADEONMapMMIO(pScrn); @@ -343,37 +439,40 @@ } RADEONMMIO = info->MMIO; - /* - * Save the values and zap MEM_CNTL + /* Save the values and zap MEM_CNTL */ + SaveStruct.MEM_CNTL = INREG(RADEON_MEM_CNTL); + SaveStruct.MEMSIZE = INREG(RADEON_CONFIG_MEMSIZE); + SaveStruct.MPP_TB_CONFIG = INREG(RADEON_MPP_TB_CONFIG); + + /* + * Zap MEM_CNTL and set MPP_TB_CONFIG<31:24> to 4 */ - *MEM_CNTL = INREG(RADEON_MEM_CNTL); - *MEMSIZE = INREG(RADEON_CONFIG_MEMSIZE); OUTREG(RADEON_MEM_CNTL, 0); + CardTmp = SaveStruct.MPP_TB_CONFIG & 0x00ffffffu; + CardTmp |= 0x04 << 24; + OUTREG(RADEON_MPP_TB_CONFIG, CardTmp); - /* - * Unmap mmio space if we mapped it - */ - if (mapped) + *pPtr = (void *)&SaveStruct; + + /* Unmap mmio space if we mapped it */ + if (mapped) RADEONUnmapMMIO(pScrn); } static void -RADEONCheckRegs(ScrnInfoPtr pScrn, CARD32 Saved_MEM_CNTL, CARD32 Saved_MEMSIZE) +RADEONPostInt10Check(ScrnInfoPtr pScrn, void *ptr) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO; - CARD32 MEM_CNTL; - int mapped = 0; + struct RADEONInt10Save *pSave = ptr; + CARD32 CardTmp; + int mapped = 0; - /* - * If we don't have a valid (non-zero) saved MEM_CNTL, get out now - */ - if (!Saved_MEM_CNTL) + /* If we don't have a valid (non-zero) saved MEM_CNTL, get out now */ + if (!pSave || !pSave->MEM_CNTL) return; - /* - * First make sure that mmio is mapped - */ + /* First make sure that mmio is mapped */ if (!info->MMIO) { RADEONMapMMIO(pScrn); mapped = 1; @@ -381,42 +480,45 @@ RADEONMMIO = info->MMIO; /* - * If either MEM_CNTL is currently zero or inconistent (configured for + * If either MEM_CNTL is currently zero or inconistent (configured for * two channels with the two channels configured differently), restore * the saved registers. */ - MEM_CNTL = INREG(RADEON_MEM_CNTL); - if (!MEM_CNTL || - ((MEM_CNTL & 1) && - (((MEM_CNTL >> 8) & 0xff) != ((MEM_CNTL >> 24) & 0xff)))) { - /* - * Restore the saved registers - */ + CardTmp = INREG(RADEON_MEM_CNTL); + if (!CardTmp || + ((CardTmp & 1) && + (((CardTmp >> 8) & 0xff) != ((CardTmp >> 24) & 0xff)))) { + /* Restore the saved registers */ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Restoring MEM_CNTL (%08x), setting to %08x\n", - MEM_CNTL, Saved_MEM_CNTL); - OUTREG(RADEON_MEM_CNTL, Saved_MEM_CNTL); + CardTmp, pSave->MEM_CNTL); + OUTREG(RADEON_MEM_CNTL, pSave->MEM_CNTL); + CardTmp = INREG(RADEON_CONFIG_MEMSIZE); + if (CardTmp != pSave->MEMSIZE) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Restoring CONFIG_MEMSIZE (%08x), setting to %08x\n", + CardTmp, pSave->MEMSIZE); + OUTREG(RADEON_CONFIG_MEMSIZE, pSave->MEMSIZE); + } + } + + CardTmp = INREG(RADEON_MPP_TB_CONFIG); + if ((CardTmp & 0xff000000u) != (pSave->MPP_TB_CONFIG & 0xff000000u)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Restoring CONFIG_MEMSIZE (%08x), setting to %08x\n", - INREG(RADEON_CONFIG_MEMSIZE), Saved_MEMSIZE); - OUTREG(RADEON_CONFIG_MEMSIZE, Saved_MEMSIZE); + "Restoring MPP_TB_CONFIG<31:24> (%02x), setting to %02x\n", + CardTmp >> 24, pSave->MPP_TB_CONFIG >> 24); + CardTmp &= 0x00ffffffu; + CardTmp |= (pSave->MPP_TB_CONFIG & 0xff000000u); + OUTREG(RADEON_MPP_TB_CONFIG, CardTmp); } - /* - * Unmap mmio space if we mapped it - */ - if (mapped) + /* Unmap mmio space if we mapped it */ + if (mapped) RADEONUnmapMMIO(pScrn); } -# define RADEONPreInt10Save(s, r1, r2) \ - RADEONSaveRegsZapMemCntl((s), (r1), (r2)) -# define RADEONPostInt10Check(s, r1, r2) \ - RADEONCheckRegs((s), (r1), (r2)) -#endif /* __alpha__ */ - -/* Allocate our private RADEONInfoRec. */ +/* Allocate our private RADEONInfoRec */ static Bool RADEONGetRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate) return TRUE; @@ -425,7 +527,7 @@ return TRUE; } -/* Free our private RADEONInfoRec. */ +/* Free our private RADEONInfoRec */ static void RADEONFreeRec(ScrnInfoPtr pScrn) { if (!pScrn || !pScrn->driverPrivate) return; @@ -434,10 +536,11 @@ } /* Memory map the MMIO region. Used during pre-init and by RADEONMapMem, - below. */ + * below + */ static Bool RADEONMapMMIO(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (info->FBDev) { info->MMIO = fbdevHWMapMMIO(pScrn); @@ -454,10 +557,11 @@ } /* Unmap the MMIO region. Used during pre-init and by RADEONUnmapMem, - below. */ + * below + */ static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (info->FBDev) fbdevHWUnmapMMIO(pScrn); @@ -471,7 +575,7 @@ /* Memory map the frame buffer. Used by RADEONMapMem, below. */ static Bool RADEONMapFB(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (info->FBDev) { info->FB = fbdevHWMapVidmem(pScrn); @@ -490,7 +594,7 @@ /* Unmap the frame buffer. Used by RADEONUnmapMem, below. */ static Bool RADEONUnmapFB(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (info->FBDev) fbdevHWUnmapVidmem(pScrn); @@ -500,7 +604,7 @@ return TRUE; } -/* Memory map the MMIO region and the frame buffer. */ +/* Memory map the MMIO region and the frame buffer */ static Bool RADEONMapMem(ScrnInfoPtr pScrn) { if (!RADEONMapMMIO(pScrn)) return FALSE; @@ -511,34 +615,49 @@ return TRUE; } -/* Unmap the MMIO region and the frame buffer. */ +/* Unmap the MMIO region and the frame buffer */ static Bool RADEONUnmapMem(ScrnInfoPtr pScrn) { if (!RADEONUnmapMMIO(pScrn) || !RADEONUnmapFB(pScrn)) return FALSE; return TRUE; } +/* This function is required to workaround a hardware bug in some (all?) + * revisions of the R300. This workaround should be called after every + * CLOCK_CNTL_INDEX register access. If not, register reads afterward + * may not be correct. + */ +void R300CGWorkaround(ScrnInfoPtr pScrn) { + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 save, tmp; + + save = INREG(RADEON_CLOCK_CNTL_INDEX); + tmp = save & ~(0x3f | RADEON_PLL_WR_EN); + OUTREG(RADEON_CLOCK_CNTL_INDEX, tmp); + tmp = INREG(RADEON_CLOCK_CNTL_DATA); + OUTREG(RADEON_CLOCK_CNTL_INDEX, save); +} + /* Read PLL information */ unsigned RADEONINPLL(ScrnInfoPtr pScrn, int addr) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + CARD32 data; -#if !RADEON_ATOMIC_UPDATE - while ( (INREG8(RADEON_CLOCK_CNTL_INDEX) & 0xbf) != addr) { -#endif - OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x3f); -#if !RADEON_ATOMIC_UPDATE - } -#endif - return INREG(RADEON_CLOCK_CNTL_DATA); + OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x3f); + data = INREG(RADEON_CLOCK_CNTL_DATA); + if (info->R300CGWorkaround) R300CGWorkaround(pScrn); + + return data; } #if 0 -/* Read PAL information (only used for debugging). */ +/* Read PAL information (only used for debugging) */ static int RADEONINPAL(int idx) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; OUTREG(RADEON_PALETTE_INDEX, idx << 16); @@ -546,172 +665,154 @@ } #endif -/* Wait for vertical sync. */ +/* Wait for vertical sync on primary CRTC */ void RADEONWaitForVerticalSync(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; + int i; - OUTREG(RADEON_GEN_INT_STATUS, RADEON_VSYNC_INT_AK); - for (i = 0; i < RADEON_TIMEOUT; i++) { - if (INREG(RADEON_GEN_INT_STATUS) & RADEON_VSYNC_INT) break; + /* Clear the CRTC_VBLANK_SAVE bit */ + OUTREG(RADEON_CRTC_STATUS, RADEON_CRTC_VBLANK_SAVE_CLEAR); + + /* Wait for it to go back up */ + for (i = 0; i < RADEON_TIMEOUT/1000; i++) { + if (INREG(RADEON_CRTC_STATUS) & RADEON_CRTC_VBLANK_SAVE) break; + usleep(1); } } -/* Blank screen. */ -static void RADEONBlank(ScrnInfoPtr pScrn) +/* Wait for vertical sync on secondary CRTC */ +void RADEONWaitForVerticalSync2(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + int i; - if(!info->IsSecondary) - { - switch(info->DisplayType) - { - case MT_LCD: - OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, - ~RADEON_LVDS_DISPLAY_DIS); - case MT_CRT: - case MT_DFP: - OUTREGP(RADEON_CRTC_EXT_CNTL, - RADEON_CRTC_DISPLAY_DIS | - RADEON_CRTC_VSYNC_DIS | - RADEON_CRTC_HSYNC_DIS, - ~(RADEON_CRTC_DISPLAY_DIS | - RADEON_CRTC_VSYNC_DIS | - RADEON_CRTC_HSYNC_DIS)); - break; - case MT_NONE: - default: - break; - } - } - else - { - OUTREGP(RADEON_CRTC2_GEN_CNTL, - RADEON_CRTC2_DISP_DIS | - RADEON_CRTC2_VSYNC_DIS | - RADEON_CRTC2_HSYNC_DIS, - ~(RADEON_CRTC2_DISP_DIS | - RADEON_CRTC2_VSYNC_DIS | - RADEON_CRTC2_HSYNC_DIS)); + /* Clear the CRTC2_VBLANK_SAVE bit */ + OUTREG(RADEON_CRTC2_STATUS, RADEON_CRTC2_VBLANK_SAVE_CLEAR); + + /* Wait for it to go back up */ + for (i = 0; i < RADEON_TIMEOUT/1000; i++) { + if (INREG(RADEON_CRTC2_STATUS) & RADEON_CRTC2_VBLANK_SAVE) break; + usleep(1); } } -/* Unblank screen. */ -static void RADEONUnblank(ScrnInfoPtr pScrn) +/* Blank screen */ +static void RADEONBlank(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - if(!info->IsSecondary) - { - switch(info->DisplayType) - { - case MT_LCD: - OUTREGP(RADEON_LVDS_GEN_CNTL, 0, - ~RADEON_LVDS_DISPLAY_DIS); - case MT_CRT: - case MT_DFP: - OUTREGP(RADEON_CRTC_EXT_CNTL, - RADEON_CRTC_CRT_ON, - ~(RADEON_CRTC_DISPLAY_DIS | - RADEON_CRTC_VSYNC_DIS | - RADEON_CRTC_HSYNC_DIS)); - break; - case MT_NONE: - default: - break; - } - } - else - { - switch(info->DisplayType) - { - case MT_LCD: - case MT_DFP: - case MT_CRT: - OUTREGP(RADEON_CRTC2_GEN_CNTL, - 0, - ~(RADEON_CRTC2_DISP_DIS | - RADEON_CRTC2_VSYNC_DIS | - RADEON_CRTC2_HSYNC_DIS)); - break; - case MT_NONE: - default: - break; - } + + if (!info->IsSecondary) { + switch(info->DisplayType) { + case MT_LCD: + case MT_CRT: + case MT_DFP: + OUTREGP(RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_VSYNC_DIS | + RADEON_CRTC_HSYNC_DIS, + ~(RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_VSYNC_DIS | + RADEON_CRTC_HSYNC_DIS)); + break; + + case MT_NONE: + default: + break; + } + if (info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + } else { + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); } } -/***Used to turn particular crtc or dac off - Not tested, comment out for now*/ -#if 0 -static void RADEONSetDisplayOff(ScrnInfoPtr pScrn, int crtc, int dac) +/* Unblank screen */ +static void RADEONUnblank(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 tmp; - if(crtc == 0) /* primary crtc*/ - { - tmp = INREG(RADEON_CRTC_EXT_CNTL); - tmp |= RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_SYNC_TRISTAT; - OUTREG(RADEON_CRTC_EXT_CNTL, tmp); - tmp &= ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_CRT_ON); - OUTREG(RADEON_CRTC_EXT_CNTL, tmp); - /*TODO update BIOS scratch register*/ - } - else /* secondary crtc*/ - { - tmp = INREG(RADEON_CRTC2_GEN_CNTL); - tmp |= RADEON_CRTC2_SYNC_TRISTAT | RADEON_CRTC2_DISP_DIS; - OUTREG(RADEON_CRTC2_GEN_CNTL, tmp); - tmp &= ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_CRT2_ON); - OUTREG(RADEON_CRTC2_GEN_CNTL, tmp); - /*TODO update BIOS scratch register*/ - } - if(dac == 0) - { - tmp = INREG(RADEON_DAC_CNTL); - tmp |= RADEON_DAC_PDWN; - OUTREG(RADEON_DAC_CNTL, tmp); - } - else - { - tmp = INREG(RADEON_TV_DAC_CNTL); - if(RADEON_TV_DAC_STD_MASK & tmp) - { - tmp |= RADEON_TV_DAC_RDACPD | RADEON_TV_DAC_GDACPD - | RADEON_TV_DAC_BDACPD; - OUTREG(RADEON_TV_DAC_CNTL, tmp); - } + if (!info->IsSecondary) { + switch (info->DisplayType) { + case MT_LCD: + case MT_CRT: + case MT_DFP: + OUTREGP(RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_CRT_ON, + ~(RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_VSYNC_DIS | + RADEON_CRTC_HSYNC_DIS)); + break; + + case MT_NONE: + default: + break; + } + if (info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, + 0, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + } else { + switch (info->DisplayType) { + case MT_LCD: + case MT_DFP: + case MT_CRT: + OUTREGP(RADEON_CRTC2_GEN_CNTL, + 0, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + break; + + case MT_NONE: + default: + break; + } } } -#endif -/* Compute log base 2 of val. */ +/* Compute log base 2 of val */ int RADEONMinBits(int val) { - int bits; + int bits; if (!val) return 1; for (bits = 0; val; val >>= 1, ++bits); return bits; } -/* Compute n/d with rounding. */ +/* Compute n/d with rounding */ static int RADEONDiv(int n, int d) { return (n + (d / 2)) / d; } -/* Read the Video BIOS block and the FP registers (if applicable). */ +/* Read the Video BIOS block and the FP registers (if applicable) */ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned long tmp, i; - unsigned char *RADEONMMIO; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long tmp, i; + unsigned char *RADEONMMIO; + Bool BypassSecondary = FALSE; + int CloneDispOption; #define RADEON_BIOS8(v) (info->VBIOS[v]) #define RADEON_BIOS16(v) (info->VBIOS[v] | \ @@ -721,35 +822,31 @@ (info->VBIOS[(v) + 2] << 16) | \ (info->VBIOS[(v) + 3] << 24)) - if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) - { + if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot allocate space for hold Video BIOS!\n"); return FALSE; } - - if (pInt10) - { + if (pInt10) { info->BIOSAddr = pInt10->BIOSseg << 4; (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), RADEON_VBIOS_SIZE); - } - else - { + } else { xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) - { + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS not detected in PCI space!\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Attempting to read Video BIOS from legacy ISA space!\n"); + "Attempting to read Video BIOS from " + "legacy ISA space!\n"); info->BIOSAddr = 0x000c0000; - xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE); + xf86ReadDomainMemory(info->PciTag, info->BIOSAddr, + RADEON_VBIOS_SIZE, info->VBIOS); } } - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) - { + + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { xfree(info->VBIOS); info->VBIOS = NULL; info->BIOSAddr = 0x00000000; @@ -759,197 +856,337 @@ } info->FPBIOSstart = RADEON_BIOS16(0x48); + info->OverlayOnCRTC2 = FALSE; - { - BOOL BypassSecondary = FALSE; - RADEONMapMMIO(pScrn); - RADEONMMIO = info->MMIO; - /*FIXME: using BIOS scratch registers to detect connected monitors - may not be a reliable way.... should use EDID data. - Also it only works with for VE/M6, no - such registers in regular RADEON!!!*/ - /***** - VE and M6 have both DVI and CRT ports (for M6 DVI port can be switch to - DFP port). The DVI port can also be conneted to a CRT with an adapter. - Here is the definition of ports for this driver--- - (1) If both port are connected, DVI port will be treated as the Primary - port (first screen in XF86Config, uses CRTC1) and CRT port will be - treated as the Secondary port (second screen in XF86Config, uses CRTC2) - (2) If only one screen specified in XF86Config, it will be used for DVI port - if a monitor is connected to DVI port, otherwise (only one monitor is - connected the CRT port) it will be used for CRT port. - *****/ - if(info->HasCRTC2) - { - /*FIXME: this may not be reliable*/ - tmp = INREG(RADEON_BIOS_4_SCRATCH); - if(info->IsSecondary) - { - /*check Port2 (CRT port, for the existing boards - (VE & M6),this port can only be connected to a CRT*/ - if(tmp & 0x02) info->DisplayType = MT_CRT; - else if(tmp & 0x800) info->DisplayType = MT_DFP; - else if(tmp & 0x400) info->DisplayType = MT_LCD; - else if(tmp & 0x1000) info->DisplayType = MT_CTV; - else if(tmp & 0x2000) info->DisplayType = MT_STV; - else info->DisplayType = MT_CRT; - - if(info->DisplayType > MT_NONE) - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - pRADEONEnt->HasSecondary = TRUE; - - } - else return FALSE; - - } - else - { - /*check Primary (DVI/DFP port)*/ - if(tmp & 0x08) info->DisplayType = MT_DFP; - else if(tmp & 0x04) info->DisplayType = MT_LCD; - else if(tmp & 0x0200) info->DisplayType = MT_CRT; - else if(tmp & 0x10) info->DisplayType = MT_CTV; - else if(tmp & 0x20) info->DisplayType = MT_STV; - else - { - /*DVI port has no monitor connected, try CRT port. - If something on CRT port, treat it as primary*/ - if(xf86IsEntityShared(pScrn->entityList[0])) - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - pRADEONEnt->BypassSecondary = TRUE; - } - - if(tmp & 0x02) info->DisplayType = MT_CRT; - else if(tmp & 0x800) info->DisplayType = MT_DFP; - else if(tmp & 0x400) info->DisplayType = MT_LCD; - else if(tmp & 0x1000) info->DisplayType = MT_CTV; - else if(tmp & 0x2000) info->DisplayType = MT_STV; - else - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No monitor detected!!!\n"); - return FALSE; - } - BypassSecondary = TRUE; - } - } - } - else - { - /*Regular Radeon ASIC, only one CRTC, but it could be - used for DFP with a DVI output, like AIW board*/ - tmp = INREG(RADEON_FP_GEN_CNTL); - if(tmp & RADEON_FP_EN_TMDS) info->DisplayType = MT_DFP; - else info->DisplayType = MT_CRT; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n", - (info->IsSecondary ? "Secondary" : "Primary"), - info->DisplayType); - - RADEONMMIO = NULL; - RADEONUnmapMMIO(pScrn); - - info->HBlank = 0; - info->HOverPlus = 0; - info->HSyncWidth = 0; - info->VBlank = 0; - info->VOverPlus = 0; - info->VSyncWidth = 0; - info->DotClock = 0; - - if(info->DisplayType == MT_LCD) { - tmp = RADEON_BIOS16(info->FPBIOSstart + 0x40); - if(!tmp) { - info->PanelPwrDly = 200; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Panel Info Table found in BIOS!\n"); - } else { - char stmp[30]; - int tmp0; - for(i=0; i<24; i++) - stmp[i] = RADEON_BIOS8(tmp+i+1); - stmp[24] = 0; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Panel ID string: %s\n", stmp); - info->PanelXRes = RADEON_BIOS16(tmp+25); - info->PanelYRes = RADEON_BIOS16(tmp+27); - xf86DrvMsg(0, X_INFO, "Panel Size from BIOS: %dx%d\n", - info->PanelXRes, info->PanelYRes); - info->PanelPwrDly = RADEON_BIOS16(tmp+44); - if(info->PanelPwrDly > 2000 || info->PanelPwrDly < 0) - info->PanelPwrDly = 2000; - for(i=0; i<20; i++) { - tmp0 = RADEON_BIOS16(tmp+64+i*2); - if(tmp0 == 0) break; - if((RADEON_BIOS16(tmp0) == info->PanelXRes) && - (RADEON_BIOS16(tmp0+2) == info->PanelYRes)) { - - info->HBlank = (RADEON_BIOS16(tmp0+17) - RADEON_BIOS16(tmp0+19)) * 8; - info->HOverPlus = (RADEON_BIOS16(tmp0+21) - RADEON_BIOS16(tmp0+19) - 1) * 8; - info->HSyncWidth = RADEON_BIOS8(tmp0+23) * 8; - info->VBlank = RADEON_BIOS16(tmp0+24) - RADEON_BIOS16(tmp0+26); - info->VOverPlus = (RADEON_BIOS16(tmp0+28) & 0x7ff) - RADEON_BIOS16(tmp0+26); - info->VSyncWidth = (RADEON_BIOS16(tmp0+28) & 0xf800) >> 11; - info->DotClock = RADEON_BIOS16(tmp0+9) * 10; - } - } - } - } - - /* Detect connector type from BIOS, used for - I2C/DDC qeurying EDID, Only available for VE or newer cards*/ - tmp = RADEON_BIOS16(info->FPBIOSstart + 0x50); - if(tmp) - { - for(i=1; i<4; i++) { - if(!RADEON_BIOS8(tmp + i*2) && i>1) break; - - /*Note: our Secondary port (CRT port) - actually uses primary DAC*/ - if(RADEON_BIOS16(tmp + i*2) & 0x01) { - if(!info->IsSecondary) { - info->DDCType = - (RADEON_BIOS16(tmp + i*2) & 0x0f00) >> 8; - break; - } - } else {/*Primary DAC*/ - - if(info->IsSecondary || BypassSecondary || !info->HasCRTC2) { - info->DDCType = - (RADEON_BIOS16(tmp + i*2) & 0x0f00) >> 8; - break; - } - } - } - } else { - /* orignal radeon cards, set it to DDC_VGA, - this will not work with AIW, it should be DDC_DVI, - let it fall back to VBE calls for AIW */ - info->DDCType = DDC_VGA; - } + RADEONMapMMIO(pScrn); + RADEONMMIO = info->MMIO; + + /* FIXME: using BIOS scratch registers to detect connected monitors + * may not be a reliable way.... should use EDID data. Also it only + * works with for VE/M6, no such registers in regular RADEON!!! + */ + + /* VE and M6 have both DVI and CRT ports (for M6 DVI port can be + * switch to DFP port). The DVI port can also be conneted to a CRT + * with an adapter. Here is the definition of ports for this + * driver: + * + * (1) If both port are connected, DVI port will be treated as the + * Primary port (first screen in XF86Config, uses CRTC1) and CRT + * port will be treated as the Secondary port (second screen in + * XF86Config, uses CRTC2) + * + * (2) If only one screen specified in XF86Config, it will be used + * for DVI port if a monitor is connected to DVI port, otherwise + * (only one monitor is connected the CRT port) it will be used for + * CRT port. + */ + + if (info->HasCRTC2) { + /* FIXME: this may not be reliable */ + tmp = INREG(RADEON_BIOS_4_SCRATCH); + + if (info->IsSecondary) { + /* Check Port2 (CRT port) -- for the existing boards (VE & + * M6), this port can only be connected to a CRT + */ + if (tmp & 0x02) info->DisplayType = MT_CRT; + else if (tmp & 0x800) info->DisplayType = MT_DFP; + else if (tmp & 0x400) info->DisplayType = MT_LCD; + else if (tmp & 0x1000) info->DisplayType = MT_CTV; + else if (tmp & 0x2000) info->DisplayType = MT_STV; + else info->DisplayType = MT_CRT; + + } else { + info->Clone = FALSE; + info->CloneType = MT_NONE; + + /* Check Primary (DVI/DFP port) */ + if (tmp & 0x08) info->DisplayType = MT_DFP; + else if (tmp & 0x04) info->DisplayType = MT_LCD; + else if (tmp & 0x0200) info->DisplayType = MT_CRT; + else if (tmp & 0x10) info->DisplayType = MT_CTV; + else if (tmp & 0x20) info->DisplayType = MT_STV; + else info->DisplayType = MT_NONE; + + if (info->DisplayType == MT_NONE) { + /* DVI port has no monitor connected, try CRT port. + * If something on CRT port, treat it as primary + */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->BypassSecondary = TRUE; + } + + if (tmp & 0x02) info->DisplayType = MT_CRT; + else if (tmp & 0x800) info->DisplayType = MT_DFP; + else if (tmp & 0x400) info->DisplayType = MT_LCD; + else if (tmp & 0x1000) info->DisplayType = MT_CTV; + else if (tmp & 0x2000) info->DisplayType = MT_STV; + else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No monitor detected!!!\n"); + return FALSE; + } + BypassSecondary = TRUE; + } else { + if (tmp & 0x02) { + info->CloneType = MT_CRT; + info->Clone = TRUE; + } else if (tmp & 0x800) { + info->CloneType = MT_DFP; + info->Clone = TRUE; + } + } + + /* FIXME: This option is too complicated. We need to + * find a better way to handle all cases. + * + * CloneDisplay options: + * 0 -- disable + * 1 -- auto-detect (default) + * 2 -- force on + * 3 -- auto-detect + 2nd head overlay. + * 4 -- force on + 2nd head overlay. + * others -- auto-detect + * + * Force on: it will force the clone mode on even no display + * is detected. With this option together with the proper + * CloneHSync and CloneVRefresh options, we can turn on the + * CRT ouput on the 2nd head regardless if a monitor is + * connected there. This way, we can plug in a CRT to the + * second head later after X server has started. + * + * 2nd head overlay: it will force the hardware overlay on + * CRTC2 (used by 2nd head). Since we only have one overlay, + * we have to decide which head to use it (the overlay space + * on the other head will be blank). 2nd head overlay is on + * automatically when PanelOff option is effective. + */ + if (xf86GetOptValInteger(info->Options, OPTION_CLONE_DISPLAY, + &(CloneDispOption))) { + char *s = NULL; + + if (CloneDispOption < 0 || CloneDispOption > 4) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Illegal CloneDisplay Option set, " + "using default\n"); + CloneDispOption = 1; + } + + switch (CloneDispOption) { + case 0: s = "Disable"; break; + case 1: s = "Auto-detect"; break; + case 2: s = "Force On"; break; + case 3: s = "Auto-detect -- use 2nd head overlay"; break; + case 4: s = "Force On -- use 2nd head overlay"; break; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CloneDisplay option: %s (%d)\n", + s, CloneDispOption); + } else { + /* Default to auto-detect */ + CloneDispOption = 1; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CloneDisplay option not set -- " + "defaulting to auto-detect\n"); + } + + if (CloneDispOption == 0) { + info->Clone = FALSE; + } else if ((CloneDispOption == 2 || CloneDispOption == 4) + && !info->Clone) { + info->CloneType = MT_CRT; + info->Clone = TRUE; + } + + /* This will be used to set OV0_SCALAR_CNTL */ + if (info->Clone && (CloneDispOption == 3 || CloneDispOption == 4)) + info->OverlayOnCRTC2 = TRUE; + } + } else { + /* Regular Radeon ASIC, only one CRTC, but it could be used for + * DFP with a DVI output, like AIW board + */ + tmp = INREG(RADEON_FP_GEN_CNTL); + if (tmp & RADEON_FP_EN_TMDS) info->DisplayType = MT_DFP; + else info->DisplayType = MT_CRT; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n", + (info->IsSecondary ? "Secondary" : "Primary"), + info->DisplayType); + + RADEONMMIO = NULL; + RADEONUnmapMMIO(pScrn); + + info->HBlank = 0; + info->HOverPlus = 0; + info->HSyncWidth = 0; + info->VBlank = 0; + info->VOverPlus = 0; + info->VSyncWidth = 0; + info->DotClock = 0; + + if (info->DisplayType == MT_LCD) { + tmp = RADEON_BIOS16(info->FPBIOSstart + 0x40); + if (!tmp) { + info->PanelPwrDly = 200; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No Panel Info Table found in BIOS!\n"); + } else { + char stmp[30]; + int tmp0; + + for (i = 0; i < 24; i++) + stmp[i] = RADEON_BIOS8(tmp+i+1); + stmp[24] = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Panel ID string: %s\n", stmp); + + info->PanelXRes = RADEON_BIOS16(tmp+25); + info->PanelYRes = RADEON_BIOS16(tmp+27); + xf86DrvMsg(0, X_INFO, "Panel Size from BIOS: %dx%d\n", + info->PanelXRes, info->PanelYRes); + + info->PanelPwrDly = RADEON_BIOS16(tmp+44); + if (info->PanelPwrDly > 2000 || info->PanelPwrDly < 0) + info->PanelPwrDly = 2000; + for (i = 0; i < 20; i++) { + tmp0 = RADEON_BIOS16(tmp+64+i*2); + if (tmp0 == 0) break; + if ((RADEON_BIOS16(tmp0) == info->PanelXRes) && + (RADEON_BIOS16(tmp0+2) == info->PanelYRes)) { + info->HBlank = (RADEON_BIOS16(tmp0+17) - + RADEON_BIOS16(tmp0+19)) * 8; + info->HOverPlus = (RADEON_BIOS16(tmp0+21) - + RADEON_BIOS16(tmp0+19) - 1) * 8; + info->HSyncWidth = RADEON_BIOS8(tmp0+23) * 8; + info->VBlank = (RADEON_BIOS16(tmp0+24) - + RADEON_BIOS16(tmp0+26)); + info->VOverPlus = ((RADEON_BIOS16(tmp0+28) & 0x7ff) - + RADEON_BIOS16(tmp0+26)); + info->VSyncWidth = ((RADEON_BIOS16(tmp0+28) & 0xf800) + >> 11); + info->DotClock = RADEON_BIOS16(tmp0+9) * 10; + info->Flags = 0; + } + } + } + } else if ((info->DisplayType == MT_DFP) && info->HasCRTC2) { + tmp = RADEON_BIOS16(info->FPBIOSstart + 0x34); + if (tmp != 0) { + tmp = RADEON_BIOS16(tmp + 2); + if (tmp != 0) { + /* 18 bytes of EDID data should be here */ + info->DotClock = RADEON_BIOS16(tmp) * 10; + info->PanelXRes = + ((RADEON_BIOS8(tmp + 4) & 0xf0) << 4) + + RADEON_BIOS8(tmp + 2); + info->HBlank = + ((RADEON_BIOS8(tmp + 4) & 0x0f) << 8) + + RADEON_BIOS8(tmp + 3); + info->PanelYRes = + ((RADEON_BIOS8(tmp + 7) & 0xf0) << 4) + + RADEON_BIOS8(tmp + 5); + info->VBlank = + ((RADEON_BIOS8(tmp + 7) & 0x0f) << 8) + + RADEON_BIOS8(tmp + 6); + info->HOverPlus = + ((RADEON_BIOS8(tmp + 11) & 0xc0) << 2) + + RADEON_BIOS8(tmp + 8); + info->HSyncWidth = + ((RADEON_BIOS8(tmp + 11) & 0x30) << 4) + + RADEON_BIOS8(tmp + 9); + info->VOverPlus = + ((RADEON_BIOS8(tmp + 11) & 0x0c) << 2) + + ((RADEON_BIOS8(tmp + 10) & 0xf0) >> 4); + info->VSyncWidth = + ((RADEON_BIOS8(tmp + 11) & 0x03) << 4) + + (RADEON_BIOS8(tmp + 10) & 0x0f); + info->Flags = 0; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No DFP timing table detected\n"); + } + } + + RADEONTRACE(("DFP Info: ----------------------\n" + "pixel clock: %d KHz\n" + "panel size: %dx%d\n" + "H. Blanking: %d\n" + "H. Sync. Offset: %d\n" + "H. Sync. Width: %d\n" + "V. Blanking: %d\n" + "V. Sync. Offset: %d\n" + "V. Sync. Width: %d\n", + info->DotClock, + info->PanelXRes, info->PanelYRes, + info->HBlank, + info->HOverPlus, + info->HSyncWidth, + info->VBlank, info->VOverPlus, info->VSyncWidth)); + } + + /* Detect connector type from BIOS, used for I2C/DDC qeurying EDID, + * Only available for VE or newer cards */ + + /* DELL OEM card doesn't seem to follow the conviention for BIOS's + * DDC type, we have to make a special case. Following hard coded + * type works with both CRT+CRT and DVI+DVI cases + */ + if (info->IsDell && info->DellType == 2) { + if (info->IsSecondary) + info->DDCType = DDC_CRT2; + else + info->DDCType = DDC_DVI; + info->CloneDDCType = DDC_CRT2; + } else if ((tmp = RADEON_BIOS16(info->FPBIOSstart + 0x50))) { + for (i = 1; i < 4; i++) { + unsigned int tmp0; + if (!RADEON_BIOS8(tmp + i*2) && i > 1) break; + + /* Note: Secondary port (CRT port) actually uses primary DAC */ + tmp0 = RADEON_BIOS16(tmp + i*2); + if (tmp0 & 0x01) { + if (!info->IsSecondary && !BypassSecondary) + info->DDCType = (tmp0 & 0x0f00) >> 8; + } else { /* Primary DAC */ + if (info->Clone) + info->CloneDDCType = (tmp0 & 0x0f00) >> 8; + else if (info->IsSecondary || + BypassSecondary || + !info->HasCRTC2) { + info->DDCType = (tmp0 & 0x0f00) >> 8; + } + } + } + } else { + /* Orignal radeon cards, set it to DDC_VGA, this will not work + * with AIW, it should be DDC_DVI, let it fall back to VBE calls + * for AIW + */ + info->DDCType = DDC_VGA; } return TRUE; } -/* Read PLL parameters from BIOS block. Default to typical values if there - is no BIOS. */ +/* Read PLL parameters from BIOS block. Default to typical values if + * there is no BIOS. + */ static Bool RADEONGetPLLParameters(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONPLLPtr pll = &info->pll; - CARD16 bios_header; - CARD16 pll_info_block; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONPLLPtr pll = &info->pll; + CARD16 bios_header; + CARD16 pll_info_block; if (!info->VBIOS) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -958,9 +1195,9 @@ the card you are using. Specifically, reference freq can be 29.50MHz, 28.63MHz, or 14.32MHz. YMMV. */ - /* - * these are somewhat sane defaults for Mac boards, we will - * need to find a good way of getting these from OpenFirmware + + /* These are somewhat sane defaults for Mac boards, we will need + * to find a good way of getting these from OpenFirmware */ pll->reference_freq = 2700; pll->reference_div = 67; @@ -991,12 +1228,12 @@ return TRUE; } -/* This is called by RADEONPreInit to set up the default visual. */ +/* This is called by RADEONPreInit to set up the default visual */ static Bool RADEONPreInitVisual(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); - if(!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) return FALSE; switch (pScrn->depth) { @@ -1005,6 +1242,7 @@ case 16: case 24: break; + default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by %s driver\n", @@ -1014,8 +1252,9 @@ xf86PrintDepthBpp(pScrn); - info->fifo_slots = 0; - info->pix24bpp = xf86GetBppFromDepth(pScrn, pScrn->depth); + info->fifo_slots = 0; + info->pix24bpp = xf86GetBppFromDepth(pScrn, + pScrn->depth); info->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel; info->CurrentLayout.depth = pScrn->depth; info->CurrentLayout.pixel_bytes = pScrn->bitsPerPixel / 8; @@ -1025,7 +1264,7 @@ if (info->pix24bpp == 24) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Radeon does NOT support 24bpp\n"); + "Radeon does NOT support 24bpp\n"); return FALSE; } @@ -1036,7 +1275,6 @@ info->CurrentLayout.pixel_bytes > 1 ? "s" : "", info->pix24bpp); - if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { @@ -1046,13 +1284,12 @@ return FALSE; } return TRUE; - } -/* This is called by RADEONPreInit to handle all color weight issues. */ +/* This is called by RADEONPreInit to handle all color weight issues */ static Bool RADEONPreInitWeight(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); /* Save flag for 6 bit DAC to use for setting CRTC registers. Otherwise use @@ -1060,8 +1297,10 @@ pScrn->rgbBits to some value other than 8. */ info->dac6bits = FALSE; + if (pScrn->depth > 8) { - rgb defaultWeight = { 0, 0, 0 }; + rgb defaultWeight = { 0, 0, 0 }; + if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; } else { pScrn->rgbBits = 8; @@ -1070,25 +1309,27 @@ info->dac6bits = TRUE; } } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d bits per RGB (%d bit DAC)\n", pScrn->rgbBits, info->dac6bits ? 6 : 8); return TRUE; - } -/* This is called by RADEONPreInit to handle config file overrides for things - like chipset and memory regions. Also determine memory size and type. - If memory type ever needs an override, put it in this routine. */ +/* This is called by RADEONPreInit to handle config file overrides for + * things like chipset and memory regions. Also determine memory size + * and type. If memory type ever needs an override, put it in this + * routine. + */ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); - EntityInfoPtr pEnt = info->pEnt; - GDevPtr dev = pEnt->device; - int offset = 0; /* RAM Type */ - MessageType from; - unsigned char *RADEONMMIO; + RADEONInfoPtr info = RADEONPTR(pScrn); + EntityInfoPtr pEnt = info->pEnt; + GDevPtr dev = pEnt->device; + int offset = 0; /* RAM Type */ + MessageType from; + unsigned char *RADEONMMIO; /* Chipset */ from = X_PROBED; @@ -1101,59 +1342,124 @@ } else { info->Chipset = info->PciInfo->chipType; } - pScrn->chipset = (char *)xf86TokenToString(RADEONChipsets, info->Chipset); + pScrn->chipset = (char *)xf86TokenToString(RADEONChipsets, info->Chipset); if (!pScrn->chipset) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04x is not recognized\n", info->Chipset); return FALSE; } - if (info->Chipset < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Chipset \"%s\" is not recognized\n", pScrn->chipset); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\" (ChipID = 0x%04x)\n", pScrn->chipset, info->Chipset); + info->HasCRTC2 = TRUE; + switch (info->Chipset) { + case PCI_CHIP_RADEON_LY: + case PCI_CHIP_RADEON_LZ: + info->ChipFamily = CHIP_FAMILY_M6; + break; + + case PCI_CHIP_RV100_QY: + case PCI_CHIP_RV100_QZ: + info->ChipFamily = CHIP_FAMILY_VE; + break; - info->IsM6 = FALSE; - switch (info->Chipset) - { - case PCI_CHIP_RADEON_LY: - case PCI_CHIP_RADEON_LZ: - info->IsM6 = TRUE; - case PCI_CHIP_RADEON_QY: - case PCI_CHIP_RADEON_QZ: - /*VE or M6 has secondary CRTC*/ - info->HasCRTC2 = TRUE; - break; - case PCI_CHIP_R200_QL: - case PCI_CHIP_R200_QN: - case PCI_CHIP_R200_QO: - case PCI_CHIP_R200_Ql: - case PCI_CHIP_R200_BB: - /*R200 has secondary CRTC*/ - info->HasCRTC2 = TRUE; - info->IsR200 = TRUE; - break; - case PCI_CHIP_RV200_QW: /* RV200 desktop */ - case PCI_CHIP_RADEON_LW: /* M7 */ - info->HasCRTC2 = TRUE; - info->IsRV200 = TRUE; - break; - default: - info->HasCRTC2 = FALSE; + case PCI_CHIP_R200_BB: + case PCI_CHIP_R200_QH: + case PCI_CHIP_R200_QI: + case PCI_CHIP_R200_QJ: + case PCI_CHIP_R200_QK: + case PCI_CHIP_R200_QL: + case PCI_CHIP_R200_QM: + case PCI_CHIP_R200_QN: + case PCI_CHIP_R200_QO: + case PCI_CHIP_R200_Qh: + case PCI_CHIP_R200_Qi: + case PCI_CHIP_R200_Qj: + case PCI_CHIP_R200_Qk: + case PCI_CHIP_R200_Ql: + info->ChipFamily = CHIP_FAMILY_R200; + break; + + case PCI_CHIP_RV200_QW: /* RV200 desktop */ + case PCI_CHIP_RV200_QX: + info->ChipFamily = CHIP_FAMILY_RV200; + break; + + case PCI_CHIP_RADEON_LW: + case PCI_CHIP_RADEON_LX: + info->ChipFamily = CHIP_FAMILY_M7; + break; + + case PCI_CHIP_RV250_Id: + case PCI_CHIP_RV250_Ie: + case PCI_CHIP_RV250_If: + case PCI_CHIP_RV250_Ig: + info->ChipFamily = CHIP_FAMILY_RV250; + break; + + case PCI_CHIP_RV250_Ld: + case PCI_CHIP_RV250_Le: + case PCI_CHIP_RV250_Lf: + case PCI_CHIP_RV250_Lg: + info->ChipFamily = CHIP_FAMILY_M9; + break; + + case PCI_CHIP_R300_AD: + case PCI_CHIP_R300_AE: + case PCI_CHIP_R300_AF: + case PCI_CHIP_R300_AG: + case PCI_CHIP_R300_ND: + case PCI_CHIP_R300_NE: + case PCI_CHIP_R300_NF: + case PCI_CHIP_R300_NG: + info->ChipFamily = CHIP_FAMILY_R300; + break; + + default: + /* Original Radeon/7200 */ + info->ChipFamily = CHIP_FAMILY_RADEON; + info->HasCRTC2 = FALSE; } + /* Here is the special case for DELL's VE card. + * It needs some special handlings for it's 2nd head to work. + */ + info->IsDell = FALSE; + if (info->ChipFamily == CHIP_FAMILY_VE && + info->PciInfo->subsysVendor == PCI_VENDOR_ATI && + info->PciInfo->subsysCard & (1 << 12)) { /* DELL's signature */ + if (info->PciInfo->subsysCard & 0xb00) { + info->IsDell = TRUE; + info->DellType = 2; /* DVI+DVI config, this seems to be the + * only known type for now, can be + * connected to both DVI+DVI and VGA+VGA + * dongles. + */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "DELL OEM Card detected with %s (type %d)\n", + (info->DellType == 2) ? "DVI+DVI / VGA+VGA" : "VGA+VGA", + info->DellType); + } else { + info->DellType = 0; /* Unknown */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Unknown type of DELL's Card (SSCID %x), " + "treated as normal type\n", + info->PciInfo->subsysCard); + } + } + /* Framebuffer */ - from = X_PROBED; - info->LinearAddr = info->PciInfo->memBase[0] & 0xfc000000; + from = X_PROBED; + info->LinearAddr = info->PciInfo->memBase[0] & 0xfc000000; pScrn->memPhysBase = info->LinearAddr; if (dev->MemBase) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -1212,26 +1518,33 @@ pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; else pScrn->videoRam = INREG(RADEON_CONFIG_MEMSIZE) / 1024; - - /* some production boards of m6 will return 0 if it's 8 MB */ - if(pScrn->videoRam == 0) pScrn->videoRam = 8192; - - if(info->IsSecondary) - { - /*FIXME: For now, split FB into two equal sections. This should - be able to be adjusted by user with a config option*/ - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - RADEONInfoPtr info1; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - pScrn->videoRam /= 2; - pRADEONEnt->pPrimaryScrn->videoRam = pScrn->videoRam; - info1 = RADEONPTR(pRADEONEnt->pPrimaryScrn); - info1->FbMapSize = pScrn->videoRam * 1024; - info->LinearAddr += pScrn->videoRam * 1024; - } + + /* Some production boards of m6 will return 0 if it's 8 MB */ + if (pScrn->videoRam == 0) pScrn->videoRam = 8192; + + if (info->IsSecondary) { + /* FIXME: For now, split FB into two equal sections. This should + * be able to be adjusted by user with a config option. */ + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + RADEONInfoPtr info1; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pScrn->videoRam /= 2; + pRADEONEnt->pPrimaryScrn->videoRam = pScrn->videoRam; + + info1 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + info1->FbMapSize = pScrn->videoRam * 1024; + info->LinearAddr += pScrn->videoRam * 1024; + info1->Clone = FALSE; + info1->CurCloneMode = NULL; + } + + info->R300CGWorkaround = + (info->ChipFamily == CHIP_FAMILY_R300 && + (INREG(RADEON_CONFIG_CNTL) & RADEON_CFG_ATI_REV_ID_MASK) + == RADEON_CFG_ATI_REV_A11); info->MemCntl = INREG(RADEON_SDRAM_MODE_REG); info->BusCntl = INREG(RADEON_BUS_CNTL); @@ -1240,14 +1553,13 @@ /* RAM */ switch (info->MemCntl >> 30) { - case 0: offset = 0; break; /* 64-bit SDR SDRAM */ - case 1: offset = 1; break; /* 64-bit DDR SDRAM */ - default: offset = 0; + case 0: offset = 0; break; /* 64-bit SDR SDRAM */ + case 1: offset = 1; break; /* 64-bit DDR SDRAM */ + default: offset = 0; } info->ram = &RADEONRAM[offset]; - if (dev->videoRam) - { + if (dev->videoRam) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Video RAM override, using %d kB instead of %d kB\n", dev->videoRam, @@ -1270,21 +1582,48 @@ #if 0 case PCI_CHIP_RADEON_XX: info->IsPCI = TRUE; break; #endif - case PCI_CHIP_RADEON_QY: - case PCI_CHIP_RADEON_QZ: + case PCI_CHIP_RV100_QY: + case PCI_CHIP_RV100_QZ: case PCI_CHIP_RADEON_LW: + case PCI_CHIP_RADEON_LX: case PCI_CHIP_RADEON_LY: case PCI_CHIP_RADEON_LZ: case PCI_CHIP_RADEON_QD: case PCI_CHIP_RADEON_QE: case PCI_CHIP_RADEON_QF: case PCI_CHIP_RADEON_QG: + case PCI_CHIP_R200_BB: + case PCI_CHIP_R200_QH: + case PCI_CHIP_R200_QI: + case PCI_CHIP_R200_QJ: + case PCI_CHIP_R200_QK: case PCI_CHIP_R200_QL: + case PCI_CHIP_R200_QM: case PCI_CHIP_R200_QN: case PCI_CHIP_R200_QO: + case PCI_CHIP_R200_Qh: + case PCI_CHIP_R200_Qi: + case PCI_CHIP_R200_Qj: + case PCI_CHIP_R200_Qk: case PCI_CHIP_R200_Ql: - case PCI_CHIP_R200_BB: case PCI_CHIP_RV200_QW: + case PCI_CHIP_RV200_QX: + case PCI_CHIP_RV250_Id: + case PCI_CHIP_RV250_Ie: + case PCI_CHIP_RV250_If: + case PCI_CHIP_RV250_Ig: + case PCI_CHIP_RV250_Ld: + case PCI_CHIP_RV250_Le: + case PCI_CHIP_RV250_Lf: + case PCI_CHIP_RV250_Lg: + case PCI_CHIP_R300_AD: + case PCI_CHIP_R300_AE: + case PCI_CHIP_R300_AF: + case PCI_CHIP_R300_AG: + case PCI_CHIP_R300_ND: + case PCI_CHIP_R300_NE: + case PCI_CHIP_R300_NF: + case PCI_CHIP_R300_NG: default: info->IsPCI = FALSE; break; } } @@ -1293,45 +1632,39 @@ return TRUE; } -static void -RADEONI2CGetBits(I2CBusPtr b, int *Clock, int *data) +static void RADEONI2CGetBits(I2CBusPtr b, int *Clock, int *data) { - ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned long val; + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long val; unsigned char *RADEONMMIO = info->MMIO; - /* Get the result. */ + /* Get the result */ val = INREG(info->DDCReg); *Clock = (val & RADEON_GPIO_Y_1) != 0; *data = (val & RADEON_GPIO_Y_0) != 0; - } -static void -RADEONI2CPutBits(I2CBusPtr b, int Clock, int data) +static void RADEONI2CPutBits(I2CBusPtr b, int Clock, int data) { - ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned long val; + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long val; unsigned char *RADEONMMIO = info->MMIO; - val = INREG(info->DDCReg) & - (CARD32)~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1); + val = INREG(info->DDCReg) & (CARD32)~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1); val |= (Clock ? 0:RADEON_GPIO_EN_1); val |= (data ? 0:RADEON_GPIO_EN_0); OUTREG(info->DDCReg, val); } - -static Bool -RADEONI2cInit(ScrnInfoPtr pScrn) +static Bool RADEONI2cInit(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); info->pI2CBus = xf86CreateI2CBusRec(); - if(!info->pI2CBus) return FALSE; + if (!info->pI2CBus) return FALSE; info->pI2CBus->BusName = "DDC"; info->pI2CBus->scrnIndex = pScrn->scrnIndex; @@ -1339,22 +1672,21 @@ info->pI2CBus->I2CGetBits = RADEONI2CGetBits; info->pI2CBus->AcknTimeout = 5; - switch(info->DDCType) - { - case DDC_MONID: - info->DDCReg = RADEON_GPIO_MONID; - break; - case DDC_DVI: - info->DDCReg = RADEON_GPIO_DVI_DDC; - break; - case DDC_VGA: - info->DDCReg = RADEON_GPIO_VGA_DDC; - break; - case DDC_CRT2: - info->DDCReg = RADEON_GPIO_CRT2_DDC; - break; - default: - return FALSE; + switch (info->DDCType) { + case DDC_MONID: + info->DDCReg = RADEON_GPIO_MONID; + break; + case DDC_DVI: + info->DDCReg = RADEON_GPIO_DVI_DDC; + break; + case DDC_VGA: + info->DDCReg = RADEON_GPIO_VGA_DDC; + break; + case DDC_CRT2: + info->DDCReg = RADEON_GPIO_CRT2_DDC; + break; + default: + return FALSE; } if (!xf86I2CBusInit(info->pI2CBus)) return FALSE; @@ -1363,449 +1695,1234 @@ static void RADEONPreInitDDC(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); - /*vbeInfoPtr pVbe;*/ + RADEONInfoPtr info = RADEONPTR(pScrn); + /* vbeInfoPtr pVbe; */ - info->ddc1 = FALSE; + info->ddc1 = FALSE; info->ddc_bios = FALSE; - if (!xf86LoadSubModule(pScrn, "ddc")) - { - info->ddc2 = FALSE; - } - else - { - xf86LoaderReqSymLists(ddcSymbols, NULL); - info->ddc2 = TRUE; + if (!xf86LoadSubModule(pScrn, "ddc")) { + info->ddc2 = FALSE; + } else { + xf86LoaderReqSymLists(ddcSymbols, NULL); + info->ddc2 = TRUE; } - - /*info->ddc1 = TRUE;*/ - /* - DDC can use I2C bus */ + /* DDC can use I2C bus */ /* Load I2C if we have the code to use it */ - if(info->ddc2) - { - if ( xf86LoadSubModule(pScrn, "i2c") ) - { - xf86LoaderReqSymLists(i2cSymbols,NULL); - info->ddc2 = RADEONI2cInit(pScrn); - } - else info->ddc2 = FALSE; + if (info->ddc2) { + if (xf86LoadSubModule(pScrn, "i2c")) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + info->ddc2 = RADEONI2cInit(pScrn); + } + else info->ddc2 = FALSE; } } -static xf86MonPtr -RADEONDoDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) +static xf86MonPtr RADEONDoDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { - RADEONInfoPtr info = RADEONPTR(pScrn); - xf86MonPtr MonInfo = NULL; + RADEONInfoPtr info = RADEONPTR(pScrn); + xf86MonPtr MonInfo = NULL; unsigned char *RADEONMMIO; + int i; + /* We'll use DDC2, BIOS EDID can only detect the monitor connected + * to one port. For VE, BIOS EDID detects the monitor connected to + * DVI port by default. If no monitor their, it will try CRT port + */ - /** - We'll use DDC2, BIOS EDID can only detect the monitor - connected to one port. For VE, BIOS EDID detects the - monitor connected to DVI port by default. If no monitor - their, it will try CRT port - */ - /* Read and output monitor info using DDC2 over I2C bus */ - if (info->pI2CBus && info->ddc2) - { - if (!RADEONMapMMIO(pScrn)) return NULL; - RADEONMMIO = info->MMIO; - /*OUTREG(RADEON_I2C_CNTL_1, 0); - OUTREG(RADEON_DVI_I2C_CNTL_1, 0);*/ - OUTREG(info->DDCReg, INREG(info->DDCReg) & - (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1)); - - MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus); - if(!MonInfo) info->ddc2 = FALSE; - RADEONUnmapMMIO(pScrn); - } + if (info->pI2CBus && info->ddc2) { + int j; - if(!MonInfo) - { - if (xf86LoadSubModule(pScrn, "vbe")) - { - vbeInfoPtr pVbe; - pVbe = VBEInit(pInt10, info->pEnt->index); - if (pVbe) - { - MonInfo = vbeDoEDID(pVbe,NULL); - info->ddc_bios = TRUE; - } - else - info->ddc_bios = FALSE; - } - } - -/***Not used for now - if(!MonInfo && info->ddc1) - { - if (info->ddc1Read && info->DDC1SetSpeed) - { - MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, - info->DDC1SetSpeed, - info->ddc1Read); - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", MonInfo); - xf86PrintEDID( MonInfo ); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n"); - } -***/ + if (!RADEONMapMMIO(pScrn)) return NULL; + RADEONMMIO = info->MMIO; + OUTREG(info->DDCReg, INREG(info->DDCReg) & + (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1)); - if(MonInfo) - { - if(info->ddc2) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C EDID Info:\n"); - else if(info->ddc_bios) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS EDID Info:\n"); - else return NULL; + /* For some old monitors (like Compaq Presario FP500), we need + * following process to initialize/stop DDC + */ + OUTREG(info->DDCReg, INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1)); + for (j = 0; j < 3; j++) { + OUTREG(info->DDCReg, + INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0)); + usleep(13000); + + OUTREG(info->DDCReg, + INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1)); + for (i = 0; i < 10; i++) { + usleep(15000); + if (INREG(info->DDCReg) & RADEON_GPIO_Y_1) + break; + } + if (i == 10) continue; - xf86PrintEDID(MonInfo); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of DDC Monitor info\n\n"); + usleep(15000); - xf86SetDDCproperties(pScrn, MonInfo); - return MonInfo; - } - else return NULL; -} + OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0); + usleep(15000); -/*********** - xfree's xf86ValidateModes routine deosn't work well with DFPs - here is our own validation routine. All modes between - 640<=XRes<=MaxRes and 480<=YRes<=MaxYRes will be permitted. -************/ -static int RADEONValidateFPModes(ScrnInfoPtr pScrn) -{ - int i, j, count=0, width, height; - RADEONInfoPtr info = RADEONPTR(pScrn); - DisplayModePtr last = NULL, new = NULL, first = NULL; + OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1); + usleep(15000); + OUTREG(info->DDCReg, + INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0)); + usleep(15000); + MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus); + + OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1); + OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0); + usleep(15000); + OUTREG(info->DDCReg, + INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1)); + for (i = 0; i < 50; i++) { + usleep(15000); + if (INREG(info->DDCReg) & RADEON_GPIO_Y_1) + break; + } + usleep(15000); + OUTREG(info->DDCReg, + INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0)); + usleep(15000); + + OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1); + OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0); + usleep(15000); + if (MonInfo) + break; + } - /* Free any allocated modes during configuration. We don't need them*/ - while (pScrn->modes) - { - xf86DeleteMode(&pScrn->modes, pScrn->modes); - } - while (pScrn->modePool) - { - xf86DeleteMode(&pScrn->modePool, pScrn->modePool); + RADEONUnmapMMIO(pScrn); } - pScrn->virtualX = pScrn->display->virtualX; - pScrn->virtualY = pScrn->display->virtualY; - - /* If no mode specified in config, we use native resolution*/ - if(!pScrn->display->modes[0]) - { - pScrn->display->modes[0] = xnfalloc(16); - sprintf(pScrn->display->modes[0], "%dx%d", - info->PanelXRes, info->PanelYRes); + if (!MonInfo && pInt10 && (info->DDCReg == RADEON_GPIO_VGA_DDC)) { + if (xf86LoadSubModule(pScrn, "vbe")) { + vbeInfoPtr pVbe; + pVbe = VBEInit(pInt10, info->pEnt->index); + if (pVbe) { + for (i = 0; i < 5; i++) { + MonInfo = vbeDoEDID(pVbe, NULL); + info->ddc_bios = TRUE; + if (MonInfo) + break; + } + } else + info->ddc_bios = FALSE; + } } - - for(i=0; pScrn->display->modes[i] != NULL; i++) - { - if (sscanf(pScrn->display->modes[i], "%dx%d", &width, &height) == 2) - { - if(width < 640 || width > info->PanelXRes || - height < 480 || height > info->PanelYRes) - { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Mode %s is out of range.\n" - "Valid mode should be between 640x480-%dx%d\n", - pScrn->display->modes[i], info->PanelXRes, info->PanelYRes); - continue; - } - - new = xnfcalloc(1, sizeof(DisplayModeRec)); - new->prev = last; - new->name = xnfalloc(strlen(pScrn->display->modes[i]) + 1); - strcpy(new->name, pScrn->display->modes[i]); - new->HDisplay = new->CrtcHDisplay = width; - new->VDisplay = new->CrtcVDisplay = height; - - if(info->HasEDID) - { - xf86MonPtr ddc = pScrn->monitor->DDC; - for(j=0; j<DET_TIMINGS; j++) - { - /*We use native mode clock only*/ - if(ddc->det_mon[j].type == 0) - new->Clock = ddc->det_mon[j].section.d_timings.clock / 1000; - } - } else - new->Clock = info->DotClock; - - if(new->prev) new->prev->next = new; - last = new; - if(!first) first = new; - pScrn->display->virtualX = - pScrn->virtualX = MAX(pScrn->virtualX, width); - pScrn->display->virtualY = - pScrn->virtualY = MAX(pScrn->virtualY, height); - count++; - } - else - { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Mode name %s is invalid\n", pScrn->display->modes[i]); - continue; - } - } - - if(last) - { - last->next = first; - first->prev = last; - pScrn->modes = first; - - /*FIXME: May need to validate line pitch here*/ - { - int dummy = 0; - switch(pScrn->depth / 8) - { - case 1: - dummy = 128 - pScrn->virtualX % 128; - break; - case 2: - dummy = 32 - pScrn->virtualX % 32; - break; - case 3: - case 4: - dummy = 16 - pScrn->virtualX % 16; - } - pScrn->displayWidth = pScrn->virtualX + dummy; - } + if (MonInfo) { + if (info->ddc2) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C EDID Info:\n"); + else if (info->ddc_bios) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS EDID Info:\n"); + else return NULL; - } + xf86PrintEDID(MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of DDC Monitor info\n\n"); - return count; + xf86SetDDCproperties(pScrn, MonInfo); + return MonInfo; + } + else return NULL; } -/* This is called by RADEONPreInit to initialize gamma correction. */ -static Bool RADEONPreInitGamma(ScrnInfoPtr pScrn) +/* BIOS may not have right panel size, we search through all supported + * DDC modes looking for the maximum panel size. + */ +static void RADEONUpdatePanelSize(ScrnInfoPtr pScrn) { - Gamma zeros = { 0.0, 0.0, 0.0 }; + int j; + RADEONInfoPtr info = RADEONPTR (pScrn); + xf86MonPtr ddc = pScrn->monitor->DDC; + DisplayModePtr p; + + /* Go thru detailed timing table first */ + for (j = 0; j < 4; j++) { + if (ddc->det_mon[j].type == 0) { + struct detailed_timings *d_timings = + &ddc->det_mon[j].section.d_timings; + if (info->PanelXRes < d_timings->h_active && + info->PanelYRes < d_timings->v_active) { + + info->PanelXRes = d_timings->h_active; + info->PanelYRes = d_timings->v_active; + info->DotClock = d_timings->clock / 1000; + info->HOverPlus = d_timings->h_sync_off; + info->HSyncWidth = d_timings->h_sync_width; + info->HBlank = d_timings->h_blanking; + info->VOverPlus = d_timings->v_sync_off; + info->VSyncWidth = d_timings->v_sync_width; + info->VBlank = d_timings->v_blanking; + } + } + } - if (!xf86SetGamma(pScrn, zeros)) return FALSE; + /* Search thru standard VESA modes from EDID */ + for (j = 0; j < 8; j++) { + if ((info->PanelXRes < ddc->timings2[j].hsize) && + (info->PanelYRes < ddc->timings2[j].vsize)) { + for (p = pScrn->monitor->Modes; p && p->next; p = p->next->next) { + if ((ddc->timings2[j].hsize == p->HDisplay) && + (ddc->timings2[j].vsize == p->VDisplay)) { + float refresh = + (float)p->Clock * 1000.0 / p->HTotal / p->VTotal; + + if (abs((float)ddc->timings2[j].refresh - refresh) < 1.0) { + /* Is this good enough? */ + info->PanelXRes = ddc->timings2[j].hsize; + info->PanelYRes = ddc->timings2[j].vsize; + info->HBlank = p->HTotal - p->HDisplay; + info->HOverPlus = p->HSyncStart - p->HDisplay; + info->HSyncWidth = p->HSyncEnd - p->HSyncStart; + info->VBlank = p->VTotal - p->VDisplay; + info->VOverPlus = p->VSyncStart - p->VDisplay; + info->VSyncWidth = p->VSyncEnd - p->VSyncStart; + info->DotClock = p->Clock; + info->Flags = + (ddc->det_mon[j].section.d_timings.interlaced + ? V_INTERLACE + : 0); + if (ddc->det_mon[j].section.d_timings.sync == 3) { + switch (ddc->det_mon[j].section.d_timings.misc) { + case 0: info->Flags |= V_NHSYNC | V_NVSYNC; break; + case 1: info->Flags |= V_PHSYNC | V_NVSYNC; break; + case 2: info->Flags |= V_NHSYNC | V_PVSYNC; break; + case 3: info->Flags |= V_PHSYNC | V_PVSYNC; break; + } + } + } + } + } + } + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size found from DDC: %dx%d\n", + info->PanelXRes, info->PanelYRes); +} + +/* This function will sort all modes according to their resolution. + * Highest resolution first. + */ +static void RADEONSortModes(DisplayModePtr *new, DisplayModePtr *first, + DisplayModePtr *last) +{ + DisplayModePtr p; + + p = *last; + while (p) { + if ((((*new)->HDisplay < p->HDisplay) && + ((*new)->VDisplay < p->VDisplay)) || + (((*new)->HDisplay == p->HDisplay) && + ((*new)->VDisplay == p->VDisplay) && + ((*new)->Clock < p->Clock))) { + + if (p->next) p->next->prev = *new; + (*new)->prev = p; + (*new)->next = p->next; + p->next = *new; + if (!((*new)->next)) *last = *new; + break; + } + if (!p->prev) { + (*new)->prev = NULL; + (*new)->next = p; + p->prev = *new; + *first = *new; + break; + } + p = p->prev; + } + + if (!*first) { + *first = *new; + (*new)->prev = NULL; + (*new)->next = NULL; + *last = *new; + } +} + +static void RADEONSetPitch (ScrnInfoPtr pScrn) +{ + int dummy = pScrn->virtualX; + + /* FIXME: May need to validate line pitch here */ + switch (pScrn->depth / 8) { + case 1: dummy = (pScrn->virtualX + 127) & ~127; break; + case 2: dummy = (pScrn->virtualX + 31) & ~31; break; + case 3: + case 4: dummy = (pScrn->virtualX + 15) & ~15; break; + } + pScrn->displayWidth = dummy; +} + +/* When no mode provided in config file, this will add all modes supported in + * DDC date the pScrn->modes list + */ +static DisplayModePtr RADEONDDCModes(ScrnInfoPtr pScrn) +{ + DisplayModePtr p; + DisplayModePtr last = NULL; + DisplayModePtr new = NULL; + DisplayModePtr first = NULL; + int count = 0; + int j, tmp; + char stmp[32]; + xf86MonPtr ddc = pScrn->monitor->DDC; + + /* Go thru detailed timing table first */ + for (j = 0; j < 4; j++) { + if (ddc->det_mon[j].type == 0) { + struct detailed_timings *d_timings = + &ddc->det_mon[j].section.d_timings; + + if (d_timings->h_active == 0 || d_timings->v_active == 0) break; + + new = xnfcalloc(1, sizeof (DisplayModeRec)); + memset(new, 0, sizeof (DisplayModeRec)); + + new->HDisplay = d_timings->h_active; + new->VDisplay = d_timings->v_active; + + sprintf(stmp, "%dx%d", new->HDisplay, new->VDisplay); + new->name = xnfalloc(strlen(stmp) + 1); + strcpy(new->name, stmp); + + new->HTotal = new->HDisplay + d_timings->h_blanking; + new->HSyncStart = new->HDisplay + d_timings->h_sync_off; + new->HSyncEnd = new->HSyncStart + d_timings->h_sync_width; + new->VTotal = new->VDisplay + d_timings->v_blanking; + new->VSyncStart = new->VDisplay + d_timings->v_sync_off; + new->VSyncEnd = new->VSyncStart + d_timings->v_sync_width; + new->Clock = d_timings->clock / 1000; + new->Flags = (d_timings->interlaced ? V_INTERLACE : 0); + new->status = MODE_OK; + new->type = M_T_DEFAULT; + + if (d_timings->sync == 3) { + switch (d_timings->misc) { + case 0: new->Flags |= V_NHSYNC | V_NVSYNC; break; + case 1: new->Flags |= V_PHSYNC | V_NVSYNC; break; + case 2: new->Flags |= V_NHSYNC | V_PVSYNC; break; + case 3: new->Flags |= V_PHSYNC | V_PVSYNC; break; + } + } + count++; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid Mode from Detailed timing table: %s\n", + new->name); + + RADEONSortModes(&new, &first, &last); + } + } + + /* Search thru standard VESA modes from EDID */ + for (j = 0; j < 8; j++) { + for (p = pScrn->monitor->Modes; p && p->next; p = p->next->next) { + /* Ignore all double scan modes */ + if ((ddc->timings2[j].hsize == p->HDisplay) && + (ddc->timings2[j].vsize == p->VDisplay)) { + float refresh = + (float)p->Clock * 1000.0 / p->HTotal / p->VTotal; + + if (abs((float)ddc->timings2[j].refresh - refresh) < 1.0) { + /* Is this good enough? */ + new = xnfcalloc(1, sizeof (DisplayModeRec)); + memcpy(new, p, sizeof(DisplayModeRec)); + new->name = xnfalloc(strlen(p->name) + 1); + strcpy(new->name, p->name); + new->status = MODE_OK; + new->type = M_T_DEFAULT; + + count++; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid Mode from standard timing table: %s\n", + new->name); + + RADEONSortModes(&new, &first, &last); + break; + } + } + } + } + + /* Search thru established modes from EDID */ + tmp = (ddc->timings1.t1 << 8) | ddc->timings1.t2; + for (j = 0; j < 16; j++) { + if (tmp & (1 << j)) { + for (p = pScrn->monitor->Modes; p && p->next; p = p->next->next) { + if ((est_timings[j].hsize == p->HDisplay) && + (est_timings[j].vsize == p->VDisplay)) { + float refresh = + (float)p->Clock * 1000.0 / p->HTotal / p->VTotal; + + if (abs((float)est_timings[j].refresh - refresh) < 1.0) { + /* Is this good enough? */ + new = xnfcalloc(1, sizeof (DisplayModeRec)); + memcpy(new, p, sizeof(DisplayModeRec)); + new->name = xnfalloc(strlen(p->name) + 1); + strcpy(new->name, p->name); + new->status = MODE_OK; + new->type = M_T_DEFAULT; + + count++; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid Mode from established timing " + "table: %s\n", new->name); + + RADEONSortModes(&new, &first, &last); + break; + } + } + } + } + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Total of %d mode(s) found.\n", count); + + return first; +} + +/* XFree86's xf86ValidateModes routine doesn't work well with DDC modes, + * so here is our own validation routine. + */ +static int RADEONValidateDDCModes(ScrnInfoPtr pScrn, char **ppModeName, + RADEONMonitorType DisplayType) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + DisplayModePtr p; + DisplayModePtr last = NULL; + DisplayModePtr first = NULL; + DisplayModePtr ddcModes = NULL; + int count = 0; + int i, width, height; + + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + if (pScrn->monitor->DDC) { + int maxVirtX = pScrn->virtualX; + int maxVirtY = pScrn->virtualY; + + if (DisplayType != MT_CRT) { + /* The panel size we collected from BIOS may not be the + * maximum size supported by the panel. If not, we update + * it now. These will be used if no matching mode can be + * found from EDID data. + */ + RADEONUpdatePanelSize(pScrn); + } + + /* Collect all of the DDC modes */ + first = last = ddcModes = RADEONDDCModes(pScrn); + + for (p = ddcModes; p; p = p->next) { + + /* If primary head is a flat panel, use RMX by default */ + if ((!info->IsSecondary && DisplayType != MT_CRT) && + !info->ddc_mode) { + /* These values are effective values after expansion. + * They are not really used to set CRTC registers. + */ + p->HTotal = info->PanelXRes + info->HBlank; + p->HSyncStart = info->PanelXRes + info->HOverPlus; + p->HSyncEnd = p->HSyncStart + info->HSyncWidth; + p->VTotal = info->PanelYRes + info->VBlank; + p->VSyncStart = info->PanelYRes + info->VOverPlus; + p->VSyncEnd = p->VSyncStart + info->VSyncWidth; + p->Clock = info->DotClock; + + p->Flags |= RADEON_USE_RMX; + } + + maxVirtX = MAX(maxVirtX, p->HDisplay); + maxVirtY = MAX(maxVirtY, p->VDisplay); + count++; + + last = p; + } + + /* Match up modes that are specified in the XF86Config file */ + if (ppModeName[0]) { + DisplayModePtr next; + + /* Reset the max virtual dimensions */ + maxVirtX = pScrn->virtualX; + maxVirtY = pScrn->virtualY; + + /* Reset list */ + first = last = NULL; + + for (i = 0; ppModeName[i]; i++) { + /* FIXME: Use HDisplay and VDisplay instead of mode string */ + if (sscanf(ppModeName[i], "%dx%d", &width, &height) == 2) { + for (p = ddcModes; p; p = next) { + next = p->next; + + if (p->HDisplay == width && p->VDisplay == height) { + /* We found a DDC mode that matches the one + requested in the XF86Config file */ + p->type |= M_T_USERDEF; + + /* Update the max virtual setttings */ + maxVirtX = MAX(maxVirtX, width); + maxVirtY = MAX(maxVirtY, height); + + /* Unhook from DDC modes */ + if (p->prev) p->prev->next = p->next; + if (p->next) p->next->prev = p->prev; + if (p == ddcModes) ddcModes = p->next; + + /* Add to used modes */ + if (last) { + last->next = p; + p->prev = last; + } else { + first = p; + p->prev = NULL; + } + p->next = NULL; + last = p; + + break; + } + } + } + } + + /* + * Add remaining DDC modes if they're smaller than the user + * specified modes + */ + for (p = ddcModes; p; p = next) { + next = p->next; + if (p->HDisplay <= maxVirtX && p->VDisplay <= maxVirtY) { + /* Unhook from DDC modes */ + if (p->prev) p->prev->next = p->next; + if (p->next) p->next->prev = p->prev; + if (p == ddcModes) ddcModes = p->next; + + /* Add to used modes */ + if (last) { + last->next = p; + p->prev = last; + } else { + first = p; + p->prev = NULL; + } + p->next = NULL; + last = p; + } + } + + /* Delete unused modes */ + while (ddcModes) + xf86DeleteMode(&ddcModes, ddcModes); + } else { + /* + * No modes were configured, so we make the DDC modes + * available for the user to cycle through. + */ + for (p = ddcModes; p; p = p->next) + p->type |= M_T_USERDEF; + } + + pScrn->virtualX = pScrn->display->virtualX = maxVirtX; + pScrn->virtualY = pScrn->display->virtualY = maxVirtY; + } + + /* Close the doubly-linked mode list, if we found any usable modes */ + if (last) { + last->next = first; + first->prev = last; + pScrn->modes = first; + RADEONSetPitch(pScrn); + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Total number of valid DDC mode(s) found: %d\n", count); + + return count; +} + +/* This is used only when no mode is specified for FP and no ddc is + * available. We force it to native mode, if possible. + */ +static DisplayModePtr RADEONFPNativeMode(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + DisplayModePtr new = NULL; + char stmp[32]; + + if (info->PanelXRes != 0 && + info->PanelYRes != 0 && + info->DotClock != 0) { + + /* Add native panel size */ + new = xnfcalloc(1, sizeof (DisplayModeRec)); + sprintf(stmp, "%dx%d", info->PanelXRes, info->PanelYRes); + new->name = xnfalloc(strlen(stmp) + 1); + strcpy(new->name, stmp); + new->HDisplay = info->PanelXRes; + new->VDisplay = info->PanelYRes; + + new->HTotal = new->HDisplay + info->HBlank; + new->HSyncStart = new->HDisplay + info->HOverPlus; + new->HSyncEnd = new->HSyncStart + info->HSyncWidth; + new->VTotal = new->VDisplay + info->VBlank; + new->VSyncStart = new->VDisplay + info->VOverPlus; + new->VSyncEnd = new->VSyncStart + info->VSyncWidth; + + new->Clock = info->DotClock; + new->Flags = 0; + new->type = M_T_USERDEF; + + new->next = NULL; + new->prev = NULL; + + pScrn->display->virtualX = + pScrn->virtualX = MAX(pScrn->virtualX, info->PanelXRes); + pScrn->display->virtualY = + pScrn->virtualY = MAX(pScrn->virtualY, info->PanelYRes); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No valid mode specified, force to native mdoe\n"); + } + + return new; +} + +/* XFree86's xf86ValidateModes routine doesn't work well with DFPs, so + * here is our own validation routine. + */ +static int RADEONValidateFPModes(ScrnInfoPtr pScrn, char **ppModeName) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + DisplayModePtr last = NULL; + DisplayModePtr new = NULL; + DisplayModePtr first = NULL; + int count = 0; + int i, width, height; + + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + /* We have a flat panel connected to the primary display, and we + * don't have any DDC info. + */ + for (i = 0; ppModeName[i] != NULL; i++) { + /* FIXME: Use HDisplay and VDisplay instead of mode string */ + if (sscanf(ppModeName[i], "%dx%d", &width, &height) != 2) continue; + + /* Note: We allow all non-standard modes as long as they do not + * exceed the native resolution of the panel. Since these modes + * need the internal RMX unit in the video chips (and there is + * only one per card), this will only apply to the primary head. + */ + if (width < 320 || width > info->PanelXRes || + height < 200 || height > info->PanelYRes) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode %s is out of range.\n", ppModeName[i]); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Valid modes must be between 320x200-%dx%d\n", + info->PanelXRes, info->PanelYRes); + continue; + } + + new = xnfcalloc(1, sizeof(DisplayModeRec)); + new->name = xnfalloc(strlen(ppModeName[i]) + 1); + strcpy(new->name, ppModeName[i]); + new->HDisplay = width; + new->VDisplay = height; + + /* These values are effective values after expansion They are + * not really used to set CRTC registers. + */ + new->HTotal = info->PanelXRes + info->HBlank; + new->HSyncStart = info->PanelXRes + info->HOverPlus; + new->HSyncEnd = new->HSyncStart + info->HSyncWidth; + new->VTotal = info->PanelYRes + info->VBlank; + new->VSyncStart = info->PanelYRes + info->VOverPlus; + new->VSyncEnd = new->VSyncStart + info->VSyncWidth; + new->Clock = info->DotClock; + new->Flags |= RADEON_USE_RMX; + + new->type |= M_T_USERDEF; + + new->next = NULL; + new->prev = last; + + if (last) last->next = new; + last = new; + if (!first) first = new; + + pScrn->display->virtualX = + pScrn->virtualX = MAX(pScrn->virtualX, width); + pScrn->display->virtualY = + pScrn->virtualY = MAX(pScrn->virtualY, height); + count++; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid mode using on-chip RMX: %s\n", new->name); + } + + /* If all else fails, add the native mode */ + if (!count) { + first = last = RADEONFPNativeMode(pScrn); + if (first) count = 1; + } + + /* Close the doubly-linked mode list, if we found any usable modes */ + if (last) { + last->next = first; + first->prev = last; + pScrn->modes = first; + RADEONSetPitch(pScrn); + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Total number of valid FP mode(s) found: %d\n", count); + + return count; +} + +/* This is called by RADEONPreInit to initialize gamma correction */ +static Bool RADEONPreInitGamma(ScrnInfoPtr pScrn) +{ + Gamma zeros = { 0.0, 0.0, 0.0 }; + + if (!xf86SetGamma(pScrn, zeros)) return FALSE; return TRUE; } static void RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) { - int i; - xf86MonPtr ddc = pScrn->monitor->DDC; - if(flag) /*HSync*/ - { - for(i=0; i<4; i++) - { - if(ddc->det_mon[i].type == DS_RANGES) - { - pScrn->monitor->nHsync = 1; - pScrn->monitor->hsync[0].lo = - ddc->det_mon[i].section.ranges.min_h; - pScrn->monitor->hsync[0].hi = - ddc->det_mon[i].section.ranges.max_h; - return; - } - } - /*if no sync ranges detected in detailed timing table, - let's try to derive them from supported VESA modes - Are we doing too much here!!!? - **/ - i = 0; - if(ddc->timings1.t1 & 0x02) /*800x600@56*/ - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 35.2; - i++; - } - if(ddc->timings1.t1 & 0x04) /*640x480@75*/ - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 37.5; - i++; - } - if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t1 & 0x01)) - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 37.9; - i++; - } - if(ddc->timings1.t2 & 0x40) - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 46.9; - i++; - } - if((ddc->timings1.t2 & 0x80) || (ddc->timings1.t2 & 0x08)) - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 48.1; - i++; - } - if(ddc->timings1.t2 & 0x04) - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 56.5; - i++; - } - if(ddc->timings1.t2 & 0x02) - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 60.0; - i++; - } - if(ddc->timings1.t2 & 0x01) - { - pScrn->monitor->hsync[i].lo = - pScrn->monitor->hsync[i].hi = 64.0; - i++; - } - pScrn->monitor->nHsync = i; + MonPtr mon = pScrn->monitor; + xf86MonPtr ddc = mon->DDC; + int i; + + if (flag) { /* HSync */ + for (i = 0; i < 4; i++) { + if (ddc->det_mon[i].type == DS_RANGES) { + mon->nHsync = 1; + mon->hsync[0].lo = ddc->det_mon[i].section.ranges.min_h; + mon->hsync[0].hi = ddc->det_mon[i].section.ranges.max_h; + return; + } + } + /* If no sync ranges detected in detailed timing table, let's + * try to derive them from supported VESA modes. Are we doing + * too much here!!!? */ + i = 0; + if (ddc->timings1.t1 & 0x02) { /* 800x600@56 */ + mon->hsync[i].lo = mon->hsync[i].hi = 35.2; + i++; + } + if (ddc->timings1.t1 & 0x04) { /* 640x480@75 */ + mon->hsync[i].lo = mon->hsync[i].hi = 37.5; + i++; + } + if ((ddc->timings1.t1 & 0x08) || (ddc->timings1.t1 & 0x01)) { + mon->hsync[i].lo = mon->hsync[i].hi = 37.9; + i++; + } + if (ddc->timings1.t2 & 0x40) { + mon->hsync[i].lo = mon->hsync[i].hi = 46.9; + i++; + } + if ((ddc->timings1.t2 & 0x80) || (ddc->timings1.t2 & 0x08)) { + mon->hsync[i].lo = mon->hsync[i].hi = 48.1; + i++; + } + if (ddc->timings1.t2 & 0x04) { + mon->hsync[i].lo = mon->hsync[i].hi = 56.5; + i++; + } + if (ddc->timings1.t2 & 0x02) { + mon->hsync[i].lo = mon->hsync[i].hi = 60.0; + i++; + } + if (ddc->timings1.t2 & 0x01) { + mon->hsync[i].lo = mon->hsync[i].hi = 64.0; + i++; + } + mon->nHsync = i; + } else { /* Vrefresh */ + for (i = 0; i < 4; i++) { + if (ddc->det_mon[i].type == DS_RANGES) { + mon->nVrefresh = 1; + mon->vrefresh[0].lo = ddc->det_mon[i].section.ranges.min_v; + mon->vrefresh[0].hi = ddc->det_mon[i].section.ranges.max_v; + return; + } + } + + i = 0; + if (ddc->timings1.t1 & 0x02) { /* 800x600@56 */ + mon->vrefresh[i].lo = mon->vrefresh[i].hi = 56; + i++; + } + if ((ddc->timings1.t1 & 0x01) || (ddc->timings1.t2 & 0x08)) { + mon->vrefresh[i].lo = mon->vrefresh[i].hi = 60; + i++; + } + if (ddc->timings1.t2 & 0x04) { + mon->vrefresh[i].lo = mon->vrefresh[i].hi = 70; + i++; + } + if ((ddc->timings1.t1 & 0x08) || (ddc->timings1.t2 & 0x80)) { + mon->vrefresh[i].lo = mon->vrefresh[i].hi = 72; + i++; + } + if ((ddc->timings1.t1 & 0x04) || (ddc->timings1.t2 & 0x40) || + (ddc->timings1.t2 & 0x02) || (ddc->timings1.t2 & 0x01)) { + mon->vrefresh[i].lo = mon->vrefresh[i].hi = 75; + i++; + } + mon->nVrefresh = i; } - else /*Vrefresh*/ - { - for(i=0; i<4; i++) - { - if(ddc->det_mon[i].type == DS_RANGES) - { - pScrn->monitor->nVrefresh = 1; - pScrn->monitor->vrefresh[0].lo = - ddc->det_mon[i].section.ranges.min_v; - pScrn->monitor->vrefresh[0].hi = - ddc->det_mon[i].section.ranges.max_v; - return; - } - } - i = 0; - if(ddc->timings1.t1 & 0x02) /*800x600@56*/ - { - pScrn->monitor->vrefresh[i].lo = - pScrn->monitor->vrefresh[i].hi = 56; - i++; - } - if((ddc->timings1.t1 & 0x01) || (ddc->timings1.t2 & 0x08)) - { - pScrn->monitor->vrefresh[i].lo = - pScrn->monitor->vrefresh[i].hi = 60; - i++; - } - if(ddc->timings1.t2 & 0x04) - { - pScrn->monitor->vrefresh[i].lo = - pScrn->monitor->vrefresh[i].hi = 70; - i++; - } - if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t2 & 0x80)) - { - pScrn->monitor->vrefresh[i].lo = - pScrn->monitor->vrefresh[i].hi = 72; - i++; - } - if((ddc->timings1.t1 & 0x04) || (ddc->timings1.t2 & 0x40) - || (ddc->timings1.t2 & 0x02) || (ddc->timings1.t2 & 0x01)) - { - pScrn->monitor->vrefresh[i].lo = - pScrn->monitor->vrefresh[i].hi = 75; - i++; - } - pScrn->monitor->nVrefresh = i; +} + +static int RADEONValidateCloneModes(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ClockRangePtr clockRanges; + DisplayModePtr tmp_mode = NULL; + DisplayModePtr clone_mode, save_mode; + int modesFound = 0; + int count = 0; + int tmp_hdisplay = 0; + int tmp_vdisplay = 0; + int i, save_n_hsync, save_n_vrefresh; + range save_hsync, save_vrefresh; + char *s; + char **clone_mode_names = NULL; + Bool ddc_mode = info->ddc_mode; + + /* Save all infomations that will be changed by clone mode validateion */ + save_mode = pScrn->modes; + pScrn->modes = NULL; + + /* Clone display mode names, duplicate all mode names for primary + * head. Allocate one more, in case pScrn->display->modes[0] == + * NULL */ + while (pScrn->display->modes[count]) count++; + clone_mode_names = xnfalloc((count+2) * sizeof(char*)); + for (i = 0; i < count; i++) { + clone_mode_names[i] = xnfalloc(strlen(pScrn->display->modes[i]) + 1); + strcpy(clone_mode_names[i], pScrn->display->modes[i]); + } + clone_mode_names[count] = NULL; + clone_mode_names[count+1] = NULL; + + pScrn->progClock = TRUE; + + clockRanges = xnfcalloc(sizeof(*clockRanges), 1); + clockRanges->next = NULL; + clockRanges->minClock = info->pll.min_pll_freq; + clockRanges->maxClock = info->pll.max_pll_freq * 10; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = FALSE; + clockRanges->doubleScanAllowed = FALSE; + + /* Only take one clone mode from config file for now, rest of clone + * modes will copy from primary head. + */ + if ((s = xf86GetOptValString(info->Options, OPTION_CLONE_MODE))) { + if (sscanf(s, "%dx%d", &tmp_hdisplay, &tmp_vdisplay) == 2) { + if(count > 0) free(clone_mode_names[0]); + else count++; + clone_mode_names[0] = xnfalloc(strlen(s)+1); + sprintf(clone_mode_names[0], "%dx%d", tmp_hdisplay, tmp_vdisplay); + xf86DrvMsg(0, X_INFO, "Clone mode %s in config file is used\n"); + } + } + + if (pScrn->display->virtualX < tmp_hdisplay) + pScrn->display->virtualX = tmp_hdisplay; + if (pScrn->display->virtualY < tmp_vdisplay) + pScrn->display->virtualY = tmp_vdisplay; + + save_hsync = pScrn->monitor->hsync[0]; + save_vrefresh = pScrn->monitor->vrefresh[0]; + save_n_hsync = pScrn->monitor->nHsync; + save_n_vrefresh = pScrn->monitor->nVrefresh; + + pScrn->monitor->DDC = NULL; + pScrn->monitor->nHsync = 0; + pScrn->monitor->nVrefresh = 0; + + if ((s = xf86GetOptValString(info->Options, OPTION_CLONE_HSYNC))) { + if (sscanf(s, "%f-%f", &pScrn->monitor->hsync[0].lo, + &pScrn->monitor->hsync[0].hi) == 2) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "HSync for CloneMode from config file: %s\n", s); + pScrn->monitor->nHsync = 1; + } else { + pScrn->monitor->nHsync = 0; + } + } + + if ((s = xf86GetOptValString(info->Options, OPTION_CLONE_VREFRESH))) { + if (sscanf(s, "%f-%f", &pScrn->monitor->vrefresh[0].lo, + &pScrn->monitor->vrefresh[0].hi) == 2) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VRefresh for CloneMode from config file: %s\n", s); + pScrn->monitor->nVrefresh = 1; + } else { + pScrn->monitor->nVrefresh = 0; + } } + + if ((pScrn->monitor->nVrefresh == 0) || (pScrn->monitor->nHsync == 0) || + (info->CloneType != MT_CRT) || info->ddc_mode) { + unsigned int save_ddc_reg; + save_ddc_reg = info->DDCReg; + switch (info->CloneDDCType) { + case DDC_MONID: info->DDCReg = RADEON_GPIO_MONID; break; + case DDC_DVI: info->DDCReg = RADEON_GPIO_DVI_DDC; break; + case DDC_VGA: info->DDCReg = RADEON_GPIO_VGA_DDC; break; + case DDC_CRT2: info->DDCReg = RADEON_GPIO_CRT2_DDC; break; + default: info->DDCReg = 0; break; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "DDC detection (type %d) for clone modes\n", + info->CloneDDCType); + + /* When primary head has an invalid DDC type, I2C is not + * initialized, so we do it here. + */ + if (!info->ddc2) info->ddc2 = xf86I2CBusInit(info->pI2CBus); + + pScrn->monitor->DDC = RADEONDoDDC(pScrn, NULL); + if (pScrn->monitor->DDC) { + if (info->CloneType == MT_CRT) { + if (pScrn->monitor->nHsync == 0) + RADEONSetSyncRangeFromEdid(pScrn, 1); + if (pScrn->monitor->nVrefresh == 0) + RADEONSetSyncRangeFromEdid(pScrn, 0); + } + } else if (info->ddc_mode) { + ddc_mode = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No DDC data available for clone mode, " + "DDCMode option is dismissed\n"); + } + info->DDCReg = save_ddc_reg; + } + + if (info->CloneType == MT_CRT && !ddc_mode) { + modesFound = + xf86ValidateModes(pScrn, pScrn->monitor->Modes, + clone_mode_names, + clockRanges, + NULL, /* linePitches */ + 8 * 64, /* minPitch */ + 8 * 1024, /* maxPitch */ + 64 * pScrn->bitsPerPixel, /* pitchInc */ + 128, /* minHeight */ + 2048, /* maxHeight */ + pScrn->display->virtualX, + pScrn->display->virtualY, + info->FbMapSize, + LOOKUP_BEST_REFRESH); + } else { + /* Try to add DDC modes */ + info->IsSecondary = TRUE; /* Fake it */ + modesFound = RADEONValidateDDCModes(pScrn, clone_mode_names, + info->CloneType); + info->IsSecondary = FALSE; /* Restore it!!! */ + + /* If that fails and we're connect to a flat panel, then try to + * add the flat panel modes + */ + if (modesFound < 1 && info->DisplayType != MT_CRT) + modesFound = RADEONValidateFPModes(pScrn, clone_mode_names); + } + + if (modesFound > 0) { + xf86SetCrtcForModes(pScrn, 0); + xf86PrintModes(pScrn); + for (i = 0; i < modesFound; i++) { + while (pScrn->modes->status != MODE_OK) { + pScrn->modes = pScrn->modes->next; + } + if (!pScrn->modes) break; + + clone_mode = xnfcalloc (1, sizeof (DisplayModeRec)); + if (!clone_mode || !pScrn->modes) break; + memcpy(clone_mode, pScrn->modes, sizeof(DisplayModeRec)); + clone_mode->name = xnfalloc(strlen(pScrn->modes->name) + 1); + strcpy(clone_mode->name, pScrn->modes->name); + + if (i == 0) { + info->CloneModes = clone_mode; + info->CurCloneMode = clone_mode; + } else { + clone_mode->prev = tmp_mode; + clone_mode->prev->next = clone_mode; + } + + tmp_mode = clone_mode; + clone_mode->next = NULL; + pScrn->modes = pScrn->modes->next; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid Clone Mode: %s\n", clone_mode->name); + } + } + + /* Clone_mode_names list is no longer needed, free it. */ + if (clone_mode_names) { + for (i = 0; clone_mode_names[i]; i++) { + free(clone_mode_names[i]); + clone_mode_names[i] = NULL; + } + + free(clone_mode_names); + clone_mode_names = NULL; + } + + /* We need to restore all changed info for the primary head */ + pScrn->modes = save_mode; + + pScrn->monitor->hsync[0] = save_hsync; + pScrn->monitor->vrefresh[0] = save_vrefresh; + pScrn->monitor->nHsync = save_n_hsync; + pScrn->monitor->nVrefresh = save_n_vrefresh; + + /* + * Also delete the clockRanges (if it was setup) since it will be + * set up during the primary head initialization. + */ + while (pScrn->clockRanges) { + ClockRangesPtr CRtmp = pScrn->clockRanges; + pScrn->clockRanges = pScrn->clockRanges->next; + xfree(CRtmp); + } + + /* modePool is no longer needed, free it */ + while (pScrn->modePool) + xf86DeleteMode(&pScrn->modePool, pScrn->modePool); + pScrn->modePool = NULL; + + return modesFound; } -/* This is called by RADEONPreInit to validate modes and compute parameters - for all of the valid modes. */ -static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - ClockRangePtr clockRanges; - int modesFound; +/* This is called by RADEONPreInit to validate modes and compute + * parameters for all of the valid modes. + */ +static Bool RADEONPreInitModes(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ClockRangePtr clockRanges; + int modesFound; char *mod = NULL; #ifndef USE_FB const char *Sym = NULL; #endif - /*We'll use our own mode validation routine for DFP/LCD, since - xf86ValidateModes is not working well with the DFP/LCD modes - 'stretched' from their native mode.*/ - if(info->DisplayType == MT_CRT || info->UseCRT) - { - /* Get mode information */ - pScrn->progClock = TRUE; - clockRanges = xnfcalloc(sizeof(*clockRanges), 1); - clockRanges->next = NULL; - clockRanges->minClock = info->pll.min_pll_freq; - clockRanges->maxClock = info->pll.max_pll_freq * 10; - clockRanges->clockIndex = -1; - - clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = TRUE; - - if(info->HasEDID) - { - /*if we still don't know sync range yet, let's try EDID. - Note that, since we can have dual heads, the Xconfigurator - may not be able to probe both monitors correctly through - vbe probe function (RADEONProbeDDC). Here we provide an - additional way to auto-detect sync ranges if they haven't - been added to XF86Config manually. - **/ - if(pScrn->monitor->nHsync <= 0) - RADEONSetSyncRangeFromEdid(pScrn, 1); - if(pScrn->monitor->nVrefresh <= 0) - RADEONSetSyncRangeFromEdid(pScrn, 0); + /* This option has two purposes: + * + * 1. For CRT, if this option is on, xf86ValidateModes (to + * LOOKUP_BEST_REFRESH) is not going to be used for mode + * validation. Instead, we'll validate modes by matching exactly + * the modes supported from the DDC data. This option can be + * used (a) to enable non-standard modes listed in the Detailed + * Timings block of EDID, like 2048x1536 (not included in + * xf86DefModes), (b) to avoid unstable modes for some flat + * panels working in analog mode (some modes validated by + * xf86ValidateModes don't really work with these panels). + * + * 2. For DFP on primary head, with this option on, the validation + * routine will try to use supported modes from DDC data first + * before trying on-chip RMX streching. By default, native mode + * + RMX streching is used for all non-native modes, it appears + * more reliable. Some non-native modes listed in the DDC data + * may not work properly if they are used directly. This seems to + * only happen to a few panels (haven't nailed this down yet, it + * may related to the incorrect setting in TMDS_PLL_CNTL when + * pixel clock is changed). Use this option may give you better + * refresh rate for some non-native modes. The 2nd DVI port will + * always use DDC modes directly (only have one on-chip RMX + * unit). + * + * Note: This option will be dismissed if no DDC data is available. + */ + info->ddc_mode = + xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE); + + /* Here is a hack for cloning first display on the second head. If + * we don't do this, when both heads are connected, the same CRTC + * will be used to drive them according to the capability of the + * primary head. This can cause an unstable or blank screen, or + * even worse it can damage a monitor. This feature is also + * important for laptops (using M6, M7), where the panel can't be + * disconnect when one wants to use the CRT port. Although 2 + * Screens can be set up in the config file for displaying same + * content on two monitors, it has problems with cursor, overlay, + * DRI. + */ + if (info->HasCRTC2) { + if (info->Clone) { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + /* If we have 2 screens from the config file, we don't need + * to do clone thing, let each screen handles one head. + */ + if (!pRADEONEnt->HasSecondary) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Clone modes validation ------------ \n"); + + modesFound = RADEONValidateCloneModes(pScrn); + if (modesFound < 1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid mode found for CRTC2 clone\n"); + info->Clone = FALSE; + info->CurCloneMode = NULL; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Total of %d clone modes found ------------ \n\n", + modesFound); + } + } } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Validating modes on %s head (DDCType: %d) ---------\n", + info->IsSecondary ? "Secondary" : "Primary", + info->DDCType); + + pScrn->monitor->DDC = RADEONDoDDC(pScrn, pInt10); + if (!pScrn->monitor->DDC && info->ddc_mode) { + info->ddc_mode = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No DDC data available, DDCMode option is dismissed\n"); + } - modesFound = xf86ValidateModes(pScrn, - pScrn->monitor->Modes, - pScrn->display->modes, - clockRanges, - NULL, /* linePitches */ - 8 * 64, /* minPitch */ - 8 * 1024, /* maxPitch */ - 64 * pScrn->bitsPerPixel, /* pitchInc */ - 128, /* minHeight */ - 2048, /* maxHeight */ - pScrn->display->virtualX, - pScrn->display->virtualY, - info->FbMapSize, - LOOKUP_BEST_REFRESH); - - if(modesFound < 1 && info->FBDev) - { - fbdevHWUseBuildinMode(pScrn); - pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */ - modesFound = 1; - } - - if(modesFound == -1) return FALSE; - - xf86PruneDriverModes(pScrn); - if(!modesFound || !pScrn->modes) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); - return FALSE; + if (pScrn->monitor->DDC) { + /* If we still don't know sync range yet, let's try EDID. + * + * Note that, since we can have dual heads, Xconfigurator + * may not be able to probe both monitors correctly through + * vbe probe function (RADEONProbeDDC). Here we provide an + * additional way to auto-detect sync ranges if they haven't + * been added to XF86Config manually. + */ + if (pScrn->monitor->nHsync <= 0) + RADEONSetSyncRangeFromEdid(pScrn, 1); + if (pScrn->monitor->nVrefresh <= 0) + RADEONSetSyncRangeFromEdid(pScrn, 0); + } + + pScrn->progClock = TRUE; + + clockRanges = xnfcalloc(sizeof(*clockRanges), 1); + clockRanges->next = NULL; + clockRanges->minClock = info->pll.min_pll_freq; + clockRanges->maxClock = info->pll.max_pll_freq * 10; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = (info->DisplayType == MT_CRT); + clockRanges->doubleScanAllowed = (info->DisplayType == MT_CRT); + + /* We'll use our own mode validation routine for DFP/LCD, since + * xf86ValidateModes does not work correctly with the DFP/LCD modes + * 'stretched' from their native mode. + */ + if (info->DisplayType == MT_CRT && !info->ddc_mode) { + modesFound = + xf86ValidateModes(pScrn, + pScrn->monitor->Modes, + pScrn->display->modes, + clockRanges, + NULL, /* linePitches */ + 8 * 64, /* minPitch */ + 8 * 1024, /* maxPitch */ + 64 * pScrn->bitsPerPixel, /* pitchInc */ + 128, /* minHeight */ + 2048, /* maxHeight */ + pScrn->display->virtualX, + pScrn->display->virtualY, + info->FbMapSize, + LOOKUP_BEST_REFRESH); + + if (modesFound < 1 && info->FBDev) { + fbdevHWUseBuildinMode(pScrn); + pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */ + modesFound = 1; + } + + if (modesFound == -1) return FALSE; + + xf86PruneDriverModes(pScrn); + if (!modesFound || !pScrn->modes) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + return FALSE; + } + } else { + /* First, free any allocated modes during configuration, since + * we don't need them + */ + while (pScrn->modes) + xf86DeleteMode(&pScrn->modes, pScrn->modes); + while (pScrn->modePool) + xf86DeleteMode(&pScrn->modePool, pScrn->modePool); + + /* Next try to add DDC modes */ + modesFound = RADEONValidateDDCModes(pScrn, pScrn->display->modes, + info->DisplayType); + + /* If that fails and we're connect to a flat panel, then try to + * add the flat panel modes + */ + if (modesFound < 1 && info->DisplayType != MT_CRT) + modesFound = RADEONValidateFPModes(pScrn, pScrn->display->modes); + + /* Fail if we still don't have any valid modes */ + if (modesFound < 1) { + if (info->DisplayType == MT_CRT) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid DDC modes found for this CRT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Try turning off the \"DDCMode\" option\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid mode found for this DFP/LCD\n"); + } + return FALSE; + } + + /* Setup the screen's clockRanges for the VidMode extension */ + pScrn->clockRanges = xnfcalloc(sizeof(*(pScrn->clockRanges)), 1); + memcpy(pScrn->clockRanges, clockRanges, sizeof(*clockRanges)); + pScrn->clockRanges->strategy = LOOKUP_BEST_REFRESH; } + xf86SetCrtcForModes(pScrn, 0); - } - else - { - /*DFP/LCD mode validation routine*/ - modesFound = RADEONValidateFPModes(pScrn); - if(modesFound < 1) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No valid mode found for this DFP/LCD\n"); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "If you have an analog monitor attached but no DFP/LCD try" - "specifying\n\t'Option \"CrtScreen\"' in your X server" - "config file.\n"); - return FALSE; - } + /* We need to adjust virtual size if the clone modes have larger + * display size. + */ + if (info->Clone && info->CloneModes) { + DisplayModePtr clone_mode = info->CloneModes; + while (1) { + if ((clone_mode->HDisplay > pScrn->virtualX) || + (clone_mode->VDisplay > pScrn->virtualY)) { + pScrn->virtualX = + pScrn->display->virtualX = clone_mode->HDisplay; + pScrn->virtualY = + pScrn->display->virtualY = clone_mode->VDisplay; + RADEONSetPitch(pScrn); + } + if (!clone_mode->next) break; + clone_mode = clone_mode->next; + } } pScrn->currentMode = pScrn->modes; @@ -1839,10 +2956,10 @@ return TRUE; } -/* This is called by RADEONPreInit to initialize the hardware cursor. */ +/* This is called by RADEONPreInit to initialize the hardware cursor */ static Bool RADEONPreInitCursor(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; @@ -1851,21 +2968,38 @@ return TRUE; } -/* This is called by RADEONPreInit to initialize hardware acceleration. */ +/* This is called by RADEONPreInit to initialize hardware acceleration */ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef XFree86LOADER + RADEONInfoPtr info = RADEONPTR(pScrn); if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { - if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; + int errmaj = 0, errmin = 0; + + info->xaaReq.majorversion = 1; + info->xaaReq.minorversion = 1; + + if (!LoadSubModule(pScrn->module, "xaa", NULL, NULL, NULL, + &info->xaaReq, &errmaj, &errmin)) { + info->xaaReq.minorversion = 0; + + if (!LoadSubModule(pScrn->module, "xaa", NULL, NULL, NULL, + &info->xaaReq, &errmaj, &errmin)) { + LoaderErrorMsg(NULL, "xaa", errmaj, errmin); + return FALSE; + } + } xf86LoaderReqSymLists(xaaSymbols, NULL); } +#endif + return TRUE; } static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); #if !defined(__powerpc__) if (xf86LoadSubModule(pScrn, "int10")) { @@ -1877,11 +3011,10 @@ return TRUE; } - #ifdef XF86DRI static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (xf86ReturnOptValBool(info->Options, OPTION_CP_PIO, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CP into PIO mode\n"); @@ -1895,6 +3028,7 @@ info->ringSize = RADEON_DEFAULT_RING_SIZE; info->bufSize = RADEON_DEFAULT_BUFFER_SIZE; info->agpTexSize = RADEON_DEFAULT_AGP_TEX_SIZE; + info->agpFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE; info->CPusecTimeout = RADEON_DEFAULT_CP_TIMEOUT; @@ -1910,6 +3044,16 @@ "Using AGP %dx mode\n", info->agpMode); } + if ((info->agpFastWrite = xf86ReturnOptValBool(info->Options, + OPTION_AGP_FW, + FALSE))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Enabling AGP Fast Write\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "AGP Fast Write disabled by default\n"); + } + if (xf86GetOptValInteger(info->Options, OPTION_AGP_SIZE, (int *)&(info->agpSize))) { switch (info->agpSize) { @@ -1921,6 +3065,7 @@ case 128: case 256: break; + default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Illegal AGP size: %d MB\n", info->agpSize); @@ -1980,6 +3125,30 @@ "Depth moves disabled by default\n"); } + /* Two options to try and squeeze as much texture memory as possible + * for dedicated 3d rendering boxes + */ + info->noBackBuffer = xf86ReturnOptValBool(info->Options, + OPTION_NO_BACKBUFFER, + FALSE); + + if (info->noBackBuffer) { + info->allowPageFlip = 0; + } else if (!xf86LoadSubModule(pScrn, "shadowfb")) { + info->allowPageFlip = 0; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Couldn't load shadowfb module:\n"); + } else { + xf86LoaderReqSymLists(driShadowFBSymbols, NULL); + + info->allowPageFlip = xf86ReturnOptValBool(info->Options, + OPTION_PAGE_FLIP, + FALSE); + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Page flipping %sabled\n", + info->allowPageFlip ? "en" : "dis"); + return TRUE; } #endif @@ -1987,177 +3156,21 @@ static void RADEONProbeDDC(ScrnInfoPtr pScrn, int indx) { - vbeInfoPtr pVbe; - if (xf86LoadSubModule(pScrn, "vbe")) - { + vbeInfoPtr pVbe; + + if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,indx); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); } } - -/*This funtion is used to reverse calculate - panel information from register settings in VGA mode. - More graceful way is to use EDID information... if it can be detected. - This way may be better than directly probing BIOS image. Because - BIOS image could change from version to version, while the - registers should always(?) contain right information, otherwise - the VGA mode display will not be correct. Well, if someone - messes up these registers before our driver is loaded, we'll be in - trouble...*/ -static Bool RadeonGetDFPInfo(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - char *s; - unsigned long r; - unsigned short a, b; - unsigned char* RADEONMMIO; - unsigned long mapped; - if(info->HasEDID) - { - int i; - xf86MonPtr ddc = pScrn->monitor->DDC; - for(i=0; i<4; i++) - { - if(ddc->det_mon[i].type == 0) - { - info->PanelXRes = - ddc->det_mon[i].section.d_timings.h_active; - info->PanelYRes = - ddc->det_mon[i].section.d_timings.v_active; - - info->HOverPlus = - ddc->det_mon[i].section.d_timings.h_sync_off; - info->HSyncWidth = - ddc->det_mon[i].section.d_timings.h_sync_width; - info->HBlank = - ddc->det_mon[i].section.d_timings.h_blanking; - info->VOverPlus = - ddc->det_mon[i].section.d_timings.v_sync_off; - info->VSyncWidth = - ddc->det_mon[i].section.d_timings.v_sync_width; - info->VBlank = - ddc->det_mon[i].section.d_timings.v_blanking; - - return TRUE; - } - } - } - - /* in case both EDID and BIOS probings failed, we'll try to get - panel information from the registers. This will depends on - how the registers are set up by bios, not very reliable*/ - mapped = RADEONMapMem(pScrn); - RADEONMMIO = info->MMIO; - - if(info->PanelXRes==0 || info->PanelYRes==0) { - r = INREG(RADEON_FP_VERT_STRETCH); - if(r & 0x08000000) { - r &= 0x00fff000; - info->PanelYRes = (unsigned short)(r >> 0x0c) + 1; - } else { - info->PanelYRes = (unsigned short)(((float)(INREG(RADEON_FP_CRTC_V_TOTAL_DISP >> 16) + 1.0) - * 4096.0 / (float) (r & 0x00000fff)) + 0.5); - } - - r = INREG(RADEON_FP_HORZ_STRETCH); - if(r & 0x08000000) { - r &= 0x01ff0000; - info->PanelXRes = (unsigned short)(r >> 0x10) + 1; - info->PanelXRes *= 8; - } else { - info->PanelXRes = (unsigned short)(((float)(INREG(RADEON_FP_CRTC_H_TOTAL_DISP >> 16) + 1.0) * 8.0 - * 4096.0 / (float) (r & 0x0000ffff)) + 0.5); - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected panel size from registers: %dx%d\n", info->PanelXRes, info->PanelYRes); - - if ((s = xf86GetOptValString(info->Options, OPTION_PANEL_SIZE))) { - if (sscanf(s, "%dx%d", &info->PanelXRes, &info->PanelYRes) == 2) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Panel size: %dx%d defined in config file is used\n", - info->PanelXRes, info->PanelYRes); - } - } - } - - if (info->PanelXRes == 0 || info->PanelYRes == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to detect the panel size.\n"); - return FALSE; - } - - if(info->HBlank == 0 || info->VBlank == 0) { - r = INREG(RADEON_FP_CRTC_H_TOTAL_DISP); - a = (r & RADEON_FP_CRTC_H_TOTAL_MASK) + 4; - b = (r & 0x01FF0000) >> RADEON_FP_CRTC_H_DISP_SHIFT; - info->HBlank = (a - b + 1) * 8; - - r = INREG(RADEON_FP_H_SYNC_STRT_WID); - info->HOverPlus = - (unsigned short)((r & RADEON_FP_H_SYNC_STRT_CHAR_MASK) - >> RADEON_FP_H_SYNC_STRT_CHAR_SHIFT) - b - 1; - info->HOverPlus *= 8; - info->HSyncWidth = - (unsigned short)((r & RADEON_FP_H_SYNC_WID_MASK) - >> RADEON_FP_H_SYNC_WID_SHIFT); - info->HSyncWidth *= 8; - r = INREG(RADEON_FP_CRTC_V_TOTAL_DISP); - a = (r & RADEON_FP_CRTC_V_TOTAL_MASK) + 1; - b = (r & RADEON_FP_CRTC_V_DISP_MASK) >> RADEON_FP_CRTC_V_DISP_SHIFT; - info->VBlank = a - b /*+ 24*/; - - r = INREG(RADEON_FP_V_SYNC_STRT_WID); - info->VOverPlus = (unsigned short)(r & RADEON_FP_V_SYNC_STRT_MASK) - - b + 1; - info->VSyncWidth = (unsigned short)((r & RADEON_FP_V_SYNC_WID_MASK) - >> RADEON_FP_V_SYNC_WID_SHIFT); - } - - if(mapped) RADEONUnmapMem(pScrn); - - return TRUE; -} - - -/* RADEONPreInit is called once at server startup. */ +/* RADEONPreInit is called once at server startup */ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) { - RADEONInfoPtr info; - xf86Int10InfoPtr pInt10 = NULL; -#ifdef __alpha__ - CARD32 save1, save2; -#endif - - /* - * Tell the loader about symbols from other modules that this module might - * refer to. - */ - xf86LoaderRefSymLists(vgahwSymbols, -#ifdef USE_FB - fbSymbols, -#else - cfbSymbols, -#endif - xaaSymbols, -#if 0 - xf8_32bppSymbols, -#endif - ramdacSymbols, -#ifdef XF86DRI - drmSymbols, - driSymbols, -#endif - fbdevHWSymbols, - vbeSymbols, - int10Symbols, - ddcSymbols, - /* i2csymbols, */ - /* shadowSymbols, */ - NULL); - + RADEONInfoPtr info; + xf86Int10InfoPtr pInt10 = NULL; + void *int10_save = NULL; + RADEONTRACE(("RADEONPreInit\n")); if (pScrn->numEntities != 1) return FALSE; @@ -2165,143 +3178,166 @@ info = RADEONPTR(pScrn); info->IsSecondary = FALSE; + info->Clone = FALSE; + info->CurCloneMode = NULL; + info->CloneModes = NULL; + info->IsSwitching = FALSE; + info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (info->pEnt->location.type != BUS_PCI) goto fail; + + info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); + info->PciTag = pciTag(info->PciInfo->bus, + info->PciInfo->device, + info->PciInfo->func); - RADEONPreInt10Save(pScrn, &save1, &save2); +#if !defined(__alpha__) + if (xf86GetPciDomain(info->PciTag) || + !xf86IsPrimaryPci(info->PciInfo)) + RADEONPreInt10Save(pScrn, &int10_save); +#else + /* [Alpha] On the primary, the console already ran the BIOS and we're + * going to run it again - so make sure to "fix up" the card + * so that (1) we can read the BIOS ROM and (2) the BIOS will + * get the memory config right. + */ + RADEONPreInt10Save(pScrn, &int10_save); +#endif + + if (xf86IsEntityShared(pScrn->entityList[0])) { + if (xf86IsPrimInitDone(pScrn->entityList[0])) { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + + info->IsSecondary = TRUE; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + if (pRADEONEnt->BypassSecondary) { + pRADEONEnt->HasSecondary = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Only one monitor detected, Second screen " + "will NOT be created\n"); + return FALSE; + } + pRADEONEnt->pSecondaryScrn = pScrn; + } else { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; - if(xf86IsEntityShared(pScrn->entityList[0])) - { - if(xf86IsPrimInitDone(pScrn->entityList[0])) - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - info->IsSecondary = TRUE; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - if(pRADEONEnt->BypassSecondary) return FALSE; - pRADEONEnt->pSecondaryScrn = pScrn; - } - else - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - xf86SetPrimInitDone(pScrn->entityList[0]); - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - pRADEONEnt->pPrimaryScrn = pScrn; - pRADEONEnt->IsDRIEnabled = FALSE; - pRADEONEnt->BypassSecondary = FALSE; - pRADEONEnt->HasSecondary = FALSE; - pRADEONEnt->RestorePrimary = FALSE; - pRADEONEnt->IsSecondaryRestored = FALSE; - } + xf86SetPrimInitDone(pScrn->entityList[0]); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + + pRADEONEnt = pPriv->ptr; + pRADEONEnt->pPrimaryScrn = pScrn; + pRADEONEnt->IsDRIEnabled = FALSE; + pRADEONEnt->BypassSecondary = FALSE; + pRADEONEnt->RestorePrimary = FALSE; + pRADEONEnt->IsSecondaryRestored = FALSE; + } } - if (flags & PROBE_DETECT) - { + if (flags & PROBE_DETECT) { RADEONProbeDDC(pScrn, info->pEnt->index); - RADEONPostInt10Check(pScrn, save1, save2); + RADEONPostInt10Check(pScrn, int10_save); return TRUE; } if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); - if (!vgaHWGetHWRec(pScrn)) - { + if (!vgaHWGetHWRec(pScrn)) { RADEONFreeRec(pScrn); return FALSE; } vgaHWGetIOBase(VGAHWPTR(pScrn)); - info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); - info->PciTag = pciTag(info->PciInfo->bus, - info->PciInfo->device, - info->PciInfo->func); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PCI bus %d card %d func %d\n", info->PciInfo->bus, info->PciInfo->device, info->PciInfo->func); + + if (xf86RegisterResources(info->pEnt->index, 0, ResExclusive)) + goto fail; - if (xf86RegisterResources(info->pEnt->index, 0, ResExclusive)) - goto fail; + if (xf86SetOperatingState(resVga, info->pEnt->index, ResUnusedOpr)) + goto fail; - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR; + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR; pScrn->monitor = pScrn->confScreen->monitor; - if (!RADEONPreInitVisual(pScrn)) goto fail; + if (!RADEONPreInitVisual(pScrn)) + goto fail; /* We can't do this until we have a pScrn->display. */ xf86CollectOptions(pScrn, NULL); - if (!(info->Options = xalloc(sizeof(RADEONOptions)))) goto fail; + if (!(info->Options = xalloc(sizeof(RADEONOptions)))) + goto fail; + memcpy(info->Options, RADEONOptions, sizeof(RADEONOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options); - if (!RADEONPreInitWeight(pScrn)) goto fail; + if (!RADEONPreInitWeight(pScrn)) + goto fail; - if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE)) { - info->FBDev = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using framebuffer device\n"); + if (xf86GetOptValInteger(info->Options, OPTION_VIDEO_KEY, + &(info->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + info->videoKey); + } else { + info->videoKey = 0x1E; } - info->UseCRT = FALSE; - - /*This option is used to force the ONLY DEVICE in XFConfig to - use CRT port, instead of default DVI port*/ - if (xf86ReturnOptValBool(info->Options, OPTION_CRT_SCREEN, FALSE)) - { - if(!xf86IsEntityShared(pScrn->entityList[0])) - info->UseCRT = TRUE; - } + if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE)) { + /* check for Linux framebuffer device */ - if (info->FBDev) - { - /* check for linux framebuffer device */ - if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE; - xf86LoaderReqSymLists(fbdevHWSymbols, NULL); - if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) return FALSE; - pScrn->SwitchMode = fbdevHWSwitchMode; - pScrn->AdjustFrame = fbdevHWAdjustFrame; - pScrn->ValidMode = fbdevHWValidMode; + if (xf86LoadSubModule(pScrn, "fbdevhw")) { + xf86LoaderReqSymLists(fbdevHWSymbols, NULL); + + if (fbdevHWInit(pScrn, info->PciInfo, NULL)) { + pScrn->ValidMode = fbdevHWValidMode; + info->FBDev = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using framebuffer device\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "fbdevHWInit failed, not using framebuffer device\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Couldn't load fbdevhw module, not using framebuffer device\n"); + } } if (!info->FBDev) - if (!RADEONPreInitInt10(pScrn, &pInt10)) goto fail; + if (!RADEONPreInitInt10(pScrn, &pInt10)) + goto fail; - RADEONPostInt10Check(pScrn, save1, save2); + RADEONPostInt10Check(pScrn, int10_save); - if (!RADEONPreInitConfig(pScrn)) goto fail; + if (!RADEONPreInitConfig(pScrn)) + goto fail; #if !defined(__powerpc__) - if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail; + if (!RADEONGetBIOSParameters(pScrn, pInt10)) + goto fail; #else - /* - * force type to CRT since we currently can't read BIOS to - * tell us what kind of heads we have + /* Force type to CRT since we currently can't read BIOS to tell us + * what kind of heads we have. */ info->DisplayType = MT_CRT; #endif RADEONPreInitDDC(pScrn); - info->HasEDID = - ((pScrn->monitor->DDC = RADEONDoDDC(pScrn, pInt10)) ? TRUE:FALSE); - - if((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) - if(!RadeonGetDFPInfo(pScrn)) goto fail; - if (!RADEONGetPLLParameters(pScrn)) goto fail; + if (!RADEONGetPLLParameters(pScrn)) goto fail; if (!RADEONPreInitGamma(pScrn)) goto fail; - if (!RADEONPreInitModes(pScrn)) goto fail; + if (!RADEONPreInitModes(pScrn, pInt10)) goto fail; if (!RADEONPreInitCursor(pScrn)) goto fail; @@ -2310,9 +3346,9 @@ #ifdef XF86DRI if (!RADEONPreInitDRI(pScrn)) goto fail; #endif + /* Free the video bios (if applicable) */ - if (info->VBIOS) - { + if (info->VBIOS) { xfree(info->VBIOS); info->VBIOS = NULL; } @@ -2322,8 +3358,8 @@ xf86FreeInt10(pInt10); xf86DrvMsg(pScrn->scrnIndex, X_NOTICE, - "For information on using the multimedia capabilities\n of this" - " adapter, please see http://gatos.sf.net.\n"); + "For information on using the multimedia capabilities\n of this" + " adapter, please see http://gatos.sf.net.\n"); return TRUE; @@ -2331,8 +3367,7 @@ /* Pre-init failed. */ /* Free the video bios (if applicable) */ - if (info->VBIOS) - { + if (info->VBIOS) { xfree(info->VBIOS); info->VBIOS = NULL; } @@ -2346,102 +3381,162 @@ return FALSE; } -/* Load a palette. */ +/* Load a palette */ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; - int idx, j; - unsigned char r, g, b; - - /* If the second monitor is connected, we also - need to deal with the secondary palette*/ - if (info->IsSecondary) j = 1; - else j = 0; - - PAL_SELECT(j); + int i; + int idx, j; + unsigned char r, g, b; + +#ifdef XF86DRI + if (info->CPStarted) DRILock(pScrn->pScreen, 0); +#endif + + if (info->accelOn) info->accel->Sync(pScrn); + + if (info->FBDev) { + fbdevHWLoadPalette(pScrn, numColors, indices, colors, pVisual); + } else { + /* If the second monitor is connected, we also need to deal with + * the secondary palette + */ + if (info->IsSecondary) j = 1; + else j = 0; - if (info->CurrentLayout.depth == 15) { - /* 15bpp mode. This sends 32 values. */ - for (i = 0; i < numColors; i++) { - idx = indices[i]; - r = colors[idx].red; - g = colors[idx].green; - b = colors[idx].blue; - RADEONWaitForFifo(pScrn, 32); /* delay */ - OUTPAL(idx * 8, r, g, b); - } - } - else if (info->CurrentLayout.depth == 16) { - /* 16bpp mode. This sends 64 values. */ - /* There are twice as many green values as - there are values for red and blue. So, - we take each red and blue pair, and - combine it with each of the two green - values. */ - for (i = 0; i < numColors; i++) { - idx = indices[i]; - r = colors[idx / 2].red; - g = colors[idx].green; - b = colors[idx / 2].blue; - RADEONWaitForFifo(pScrn, 32); /* delay */ - OUTPAL(idx * 4, r, g, b); - - /* AH - Added to write extra green data - How come this isn't - * needed on R128 ? We didn't load the extra green data in the - * other routine */ - if (idx <= 31) { + PAL_SELECT(j); + + if (info->CurrentLayout.depth == 15) { + /* 15bpp mode. This sends 32 values. */ + for (i = 0; i < numColors; i++) { + idx = indices[i]; r = colors[idx].red; - g = colors[(idx * 2) + 1].green; + g = colors[idx].green; b = colors[idx].blue; - RADEONWaitForFifo(pScrn, 32); /* delay */ OUTPAL(idx * 8, r, g, b); } + } else if (info->CurrentLayout.depth == 16) { + /* 16bpp mode. This sends 64 values. + * + * There are twice as many green values as there are values + * for red and blue. So, we take each red and blue pair, + * and combine it with each of the two green values. + */ + for (i = 0; i < numColors; i++) { + idx = indices[i]; + r = colors[idx / 2].red; + g = colors[idx].green; + b = colors[idx / 2].blue; + RADEONWaitForFifo(pScrn, 32); /* delay */ + OUTPAL(idx * 4, r, g, b); + + /* AH - Added to write extra green data - How come this isn't + * needed on R128? We didn't load the extra green data in the + * other routine + */ + if (idx <= 31) { + r = colors[idx].red; + g = colors[(idx * 2) + 1].green; + b = colors[idx].blue; + RADEONWaitForFifo(pScrn, 32); /* delay */ + OUTPAL(idx * 8, r, g, b); + } + } + } else { + /* 8bpp mode. This sends 256 values. */ + for (i = 0; i < numColors; i++) { + idx = indices[i]; + r = colors[idx].red; + b = colors[idx].blue; + g = colors[idx].green; + RADEONWaitForFifo(pScrn, 32); /* delay */ + OUTPAL(idx, r, g, b); + } } - } - else { - /* 8bpp mode. This sends 256 values. */ - for (i = 0; i < numColors; i++) { - idx = indices[i]; - r = colors[idx].red; - b = colors[idx].blue; - g = colors[idx].green; - RADEONWaitForFifo(pScrn, 32); /* delay */ - OUTPAL(idx, r, g, b); + + if (info->Clone) { + PAL_SELECT(1); + if (info->CurrentLayout.depth == 15) { + /* 15bpp mode. This sends 32 values. */ + for (i = 0; i < numColors; i++) { + idx = indices[i]; + r = colors[idx].red; + g = colors[idx].green; + b = colors[idx].blue; + OUTPAL(idx * 8, r, g, b); + } + } else if (info->CurrentLayout.depth == 16) { + /* 16bpp mode. This sends 64 values. + * + * There are twice as many green values as there are values + * for red and blue. So, we take each red and blue pair, + * and combine it with each of the two green values. + */ + for (i = 0; i < numColors; i++) { + idx = indices[i]; + r = colors[idx / 2].red; + g = colors[idx].green; + b = colors[idx / 2].blue; + OUTPAL(idx * 4, r, g, b); + + /* AH - Added to write extra green data - How come + * this isn't needed on R128? We didn't load the + * extra green data in the other routine. + */ + if (idx <= 31) { + r = colors[idx].red; + g = colors[(idx * 2) + 1].green; + b = colors[idx].blue; + OUTPAL(idx * 8, r, g, b); + } + } + } else { + /* 8bpp mode. This sends 256 values. */ + for (i = 0; i < numColors; i++) { + idx = indices[i]; + r = colors[idx].red; + b = colors[idx].blue; + g = colors[idx].green; + OUTPAL(idx, r, g, b); + } + } } } + +#ifdef XF86DRI + if (info->CPStarted) DRIUnlock(pScrn->pScreen); +#endif } -static void -RADEONBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +static void RADEONBlockHandler(int i, pointer blockData, + pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + RADEONInfoPtr info = RADEONPTR(pScrn); #ifdef XF86DRI if (info->directRenderingEnabled) - FLUSH_RING(); + FLUSH_RING(); #endif pScreen->BlockHandler = info->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = RADEONBlockHandler; - if(info->VideoTimerCallback) { - (*info->VideoTimerCallback)(pScrn, currentTime.milliseconds); - } + if (info->VideoTimerCallback) + (*info->VideoTimerCallback)(pScrn, currentTime.milliseconds); } /* Called at the start of each server generation. */ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - BoxRec MemBox; - int y2; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + BoxRec MemBox; + int y2; RADEONTRACE(("RADEONScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset)); @@ -2449,22 +3544,25 @@ #ifdef XF86DRI /* Turn off the CP for now. */ info->CPInUse = FALSE; + info->CPStarted = FALSE; + info->directRenderingEnabled = FALSE; #endif + info->accelOn = FALSE; pScrn->fbOffset = 0; - if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; + if (info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; if (!RADEONMapMem(pScrn)) return FALSE; #ifdef XF86DRI - info->fbX = 0; - info->fbY = 0; + info->fbX = 0; + info->fbY = 0; #endif info->PaletteSavedOnVT = FALSE; - info->SwitchingMode = FALSE; RADEONSave(pScrn); if (info->FBDev) { unsigned char *RADEONMMIO = info->MMIO; + if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; info->ModeReg.surface_cntl = INREG(RADEON_SURFACE_CNTL); } else { @@ -2474,6 +3572,15 @@ RADEONSaveScreen(pScreen, SCREEN_SAVER_ON); pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + if (info->CurCloneMode) { + info->CloneFrameX0 = + (pScrn->virtualX - info->CurCloneMode->HDisplay) / 2; + info->CloneFrameY0 = + (pScrn->virtualY - info->CurCloneMode->VDisplay) / 2; + RADEONDoAdjustFrame(pScrn, info->CloneFrameX0, info->CloneFrameY0, TRUE); + } + /* Visual setup */ miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, @@ -2490,11 +3597,12 @@ back. */ { /* FIXME: When we move to dynamic allocation of back and depth - buffers, we will want to revisit the following check for 3 - times the virtual size of the screen below. */ - int width_bytes = (pScrn->displayWidth * - info->CurrentLayout.pixel_bytes); - int maxy = info->FbMapSize / width_bytes; + * buffers, we will want to revisit the following check for 3 + * times the virtual size of the screen below. + */ + int width_bytes = (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes); + int maxy = info->FbMapSize / width_bytes; if (xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { xf86DrvMsg(scrnIndex, X_WARNING, @@ -2507,47 +3615,48 @@ (pScrn->displayWidth * pScrn->virtualY * info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024); info->directRenderingEnabled = FALSE; - } else if (info->IsR200) { + } else if (info->ChipFamily >= CHIP_FAMILY_R300) { info->directRenderingEnabled = FALSE; xf86DrvMsg(scrnIndex, X_WARNING, - "Direct rendering not yet supported on Radeon 8500\n"); + "Direct rendering not yet supported on " + "Radeon 9500/9700 and newer cards\n"); } else { - if(info->IsSecondary) - info->directRenderingEnabled = FALSE; - else - { - /* Xinerama has sync problem with DRI, disable it for now */ - if(xf86IsEntityShared(pScrn->entityList[0])) - { - info->directRenderingEnabled = FALSE; - xf86DrvMsg(scrnIndex, X_WARNING, - "Direct Rendering Disabled -- " - "Dual-head configuration is not working with DRI " - "at present.\nPlease use only one Device/Screen " - "section in your XFConfig file.\n"); - } - else - info->directRenderingEnabled = - RADEONDRIScreenInit(pScreen); - if(xf86IsEntityShared(pScrn->entityList[0])) - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - pRADEONEnt->IsDRIEnabled = info->directRenderingEnabled; - } - } + if (info->IsSecondary) + info->directRenderingEnabled = FALSE; + else { + /* Xinerama has sync problem with DRI, disable it for now */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + info->directRenderingEnabled = FALSE; + xf86DrvMsg(scrnIndex, X_WARNING, + "Direct Rendering Disabled -- " + "Dual-head configuration is not working with " + "DRI at present.\n" + "Please use only one Device/Screen " + "section in your XFConfig file.\n"); + } else { + info->directRenderingEnabled = + RADEONDRIScreenInit(pScreen); + } + + if (xf86IsEntityShared(pScrn->entityList[0])) { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->IsDRIEnabled = info->directRenderingEnabled; + } + } } } #endif #ifdef USE_FB - if (!fbScreenInit (pScreen, info->FB, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, - pScrn->bitsPerPixel)) + if (!fbScreenInit(pScreen, info->FB, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, + pScrn->bitsPerPixel)) return FALSE; #else switch (pScrn->bitsPerPixel) { @@ -2575,10 +3684,11 @@ return FALSE; } #endif + xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { - VisualPtr visual; + VisualPtr visual; visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -2592,22 +3702,41 @@ } } } + #ifdef USE_FB - /* must be after RGB order fixed */ + /* Must be after RGB order fixed */ fbPictureInit (pScreen, 0, 0); #endif +#ifdef RENDER + if (PictureGetSubpixelOrder (pScreen) == SubPixelUnknown) + { + int subPixelOrder; + + switch (info->DisplayType) { + case MT_NONE: subPixelOrder = SubPixelUnknown; break; + case MT_LCD: subPixelOrder = SubPixelHorizontalRGB; break; + case MT_DFP: subPixelOrder = SubPixelHorizontalRGB; break; + default: subPixelOrder = SubPixelNone; break; + } + PictureSetSubpixelOrder (pScreen, subPixelOrder); + } +#endif /* Memory manager setup */ #ifdef XF86DRI if (info->directRenderingEnabled) { - FBAreaPtr fbarea; - int width_bytes = (pScrn->displayWidth * - info->CurrentLayout.pixel_bytes); - int cpp = info->CurrentLayout.pixel_bytes; - int bufferSize = ((pScrn->virtualY * width_bytes + RADEON_BUFFER_ALIGN) - & ~RADEON_BUFFER_ALIGN); - int l; - int scanlines; + FBAreaPtr fbarea; + int width_bytes = (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes); + int cpp = info->CurrentLayout.pixel_bytes; + int bufferSize = ((pScrn->virtualY * width_bytes + + RADEON_BUFFER_ALIGN) + & ~RADEON_BUFFER_ALIGN); + int depthSize = ((((pScrn->virtualY+15) & ~15) * width_bytes + + RADEON_BUFFER_ALIGN) + & ~RADEON_BUFFER_ALIGN); + int l; + int scanlines; info->frontOffset = 0; info->frontPitch = pScrn->displayWidth; @@ -2637,7 +3766,7 @@ * pixmap cache. Should be enough for a fullscreen background * image plus some leftovers. */ - info->textureSize = info->FbMapSize - 6 * bufferSize; + info->textureSize = info->FbMapSize - 5 * bufferSize - depthSize; /* If that gives us less than half the available memory, let's * be greedy and grab some more. Sorry, I care more about 3D @@ -2645,18 +3774,28 @@ * framebuffer's worth of pixmap cache anyway. */ if (info->textureSize < (int)info->FbMapSize / 2) { - info->textureSize = info->FbMapSize - 5 * bufferSize; + info->textureSize = info->FbMapSize - 4 * bufferSize - depthSize; } if (info->textureSize < (int)info->FbMapSize / 2) { - info->textureSize = info->FbMapSize - 4 * bufferSize; + info->textureSize = info->FbMapSize - 3 * bufferSize - depthSize; } + /* If there's still no space for textures, try without pixmap cache */ + if (info->textureSize < 0) { + info->textureSize = info->FbMapSize - 2 * bufferSize - depthSize + - 64/4*64; + } /* Check to see if there is more room available after the 8192nd scanline for textures */ - if ((int)info->FbMapSize - 8192*width_bytes - bufferSize*2 + if ((int)info->FbMapSize - 8192*width_bytes - bufferSize - depthSize > info->textureSize) { info->textureSize = - info->FbMapSize - 8192*width_bytes - bufferSize*2; + info->FbMapSize - 8192*width_bytes - bufferSize - depthSize; + } + + /* If backbuffer is disabled, don't allocate memory for it */ + if (info->noBackBuffer) { + info->textureSize += bufferSize; } if (info->textureSize > 0) { @@ -2682,23 +3821,33 @@ } /* Reserve space for textures */ - info->textureOffset = (info->FbMapSize - info->textureSize + - RADEON_BUFFER_ALIGN) & - ~(CARD32)RADEON_BUFFER_ALIGN; - - /* Reserve space for the shared depth buffer */ - info->depthOffset = (info->textureOffset - bufferSize + - RADEON_BUFFER_ALIGN) & - ~(CARD32)RADEON_BUFFER_ALIGN; + info->textureOffset = ((info->FbMapSize - info->textureSize + + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN); + + /* Reserve space for the shared depth + * buffer. + */ + info->depthOffset = ((info->textureOffset - depthSize + + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN); info->depthPitch = pScrn->displayWidth; /* Reserve space for the shared back buffer */ - info->backOffset = (info->depthOffset - bufferSize + - RADEON_BUFFER_ALIGN) & - ~(CARD32)RADEON_BUFFER_ALIGN; - info->backPitch = pScrn->displayWidth; + if (info->noBackBuffer) { + info->backOffset = info->depthOffset; + info->backPitch = pScrn->displayWidth; + } else { + info->backOffset = ((info->depthOffset - bufferSize + + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN); + info->backPitch = pScrn->displayWidth; + } + + info->backY = info->backOffset / width_bytes; + info->backX = (info->backOffset - (info->backY * width_bytes)) / cpp; - scanlines = info->backOffset / width_bytes - 1; + scanlines = info->FbMapSize / width_bytes; if (scanlines > 8191) scanlines = 8191; MemBox.x1 = 0; @@ -2708,18 +3857,20 @@ if (!xf86InitFBManager(pScreen, &MemBox)) { xf86DrvMsg(scrnIndex, X_ERROR, - "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + "Memory manager initialization to " + "(%d,%d) (%d,%d) failed\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); return FALSE; } else { - int width, height; + int width, height; xf86DrvMsg(scrnIndex, X_INFO, "Memory manager initialized to (%d,%d) (%d,%d)\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - 2, 0, NULL, NULL, NULL))) { + 2, 0, NULL, NULL, + NULL))) { xf86DrvMsg(scrnIndex, X_INFO, "Reserved area from (%d,%d) to (%d,%d)\n", fbarea->box.x1, fbarea->box.y1, @@ -2732,17 +3883,32 @@ xf86DrvMsg(scrnIndex, X_INFO, "Largest offscreen area available: %d x %d\n", width, height); + + /* Lines in offscreen area needed for depth buffer and + * textures + */ + info->depthTexLines = (scanlines + - info->depthOffset / width_bytes); + info->backLines = (scanlines + - info->backOffset / width_bytes + - info->depthTexLines); + info->backArea = NULL; + } else { + xf86DrvMsg(scrnIndex, X_ERROR, + "Unable to determine largest offscreen area " + "available\n"); + return FALSE; } } xf86DrvMsg(scrnIndex, X_INFO, - "Reserved back buffer at offset 0x%x\n", + "Will use back buffer at offset 0x%x\n", info->backOffset); xf86DrvMsg(scrnIndex, X_INFO, - "Reserved depth buffer at offset 0x%x\n", + "Will use depth buffer at offset 0x%x\n", info->depthOffset); xf86DrvMsg(scrnIndex, X_INFO, - "Reserved %d kb for textures at offset 0x%x\n", + "Will use %d kb for textures at offset 0x%x\n", info->textureSize/1024, info->textureOffset); info->frontPitchOffset = (((info->frontPitch * cpp / 64) << 22) | @@ -2753,8 +3919,7 @@ info->depthPitchOffset = (((info->depthPitch * cpp / 64) << 22) | (info->depthOffset >> 10)); - } - else + } else #endif { MemBox.x1 = 0; @@ -2773,7 +3938,8 @@ if (!xf86InitFBManager(pScreen, &MemBox)) { xf86DrvMsg(scrnIndex, X_ERROR, - "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + "Memory manager initialization to " + "(%d,%d) (%d,%d) failed\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); return FALSE; } else { @@ -2783,8 +3949,10 @@ xf86DrvMsg(scrnIndex, X_INFO, "Memory manager initialized to (%d,%d) (%d,%d)\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - 2, 0, NULL, NULL, NULL))) { + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->displayWidth, + 2, 0, NULL, NULL, + NULL))) { xf86DrvMsg(scrnIndex, X_INFO, "Reserved area from (%d,%d) to (%d,%d)\n", fbarea->box.x1, fbarea->box.y1, @@ -2800,18 +3968,16 @@ } } } - /* Backing store setup */ - miInitializeBackingStore(pScreen); - xf86SetBackingStore(pScreen); - - /* Set Silken Mouse */ - xf86SetSilkenMouse(pScreen); /* Acceleration setup */ if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (RADEONAccelInit(pScreen)) { xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); info->accelOn = TRUE; + + /* FIXME: Figure out why this was added because it shouldn't be! */ + /* This is needed by the DRI and XAA code for shared entities */ + pScrn->pScreen = pScreen; } else { xf86DrvMsg(scrnIndex, X_ERROR, "Acceleration initialization failed\n"); @@ -2826,17 +3992,25 @@ /* DGA setup */ RADEONDGAInit(pScreen); + /* Backing store setup */ + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + + /* Set Silken Mouse */ + xf86SetSilkenMouse(pScreen); + /* Cursor setup */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); /* Hardware cursor setup */ if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (RADEONCursorInit(pScreen)) { - int width, height; + int width, height; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using hardware cursor (scanline %d)\n", - info->cursor_start / pScrn->displayWidth); + info->cursor_start / pScrn->displayWidth + / info->CurrentLayout.pixel_bytes); if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { xf86DrvMsg(scrnIndex, X_INFO, @@ -2849,28 +4023,27 @@ xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); } } else { + info->cursor_start = 0; xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); } /* Colormap setup */ if (!miCreateDefColormap(pScreen)) return FALSE; if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8, - (info->FBDev ? fbdevHWLoadPalette : - RADEONLoadPalette), NULL, + RADEONLoadPalette, NULL, CMAP_PALETTED_TRUECOLOR - | CMAP_RELOAD_ON_MODE_SWITCH #if 0 /* This option messes up text mode! (eich@suse.de) */ | CMAP_LOAD_EVEN_IF_OFFSCREEN #endif - )) return FALSE; + | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; /* DPMS setup */ #ifdef DPMSExtension - if (info->DisplayType == MT_CRT) - xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); + xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); #endif RADEONInitVideo(pScreen); + /* Provide SaveScreen */ pScreen->SaveScreen = RADEONSaveScreen; @@ -2903,44 +4076,91 @@ return TRUE; } -/* Write common registers (initialized to 0). */ +/* Write common registers (initialized to 0) */ static void RADEONRestoreCommonRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + OUTREG(RADEON_OVR_CLR, restore->ovr_clr); + OUTREG(RADEON_OVR_WID_LEFT_RIGHT, restore->ovr_wid_left_right); + OUTREG(RADEON_OVR_WID_TOP_BOTTOM, restore->ovr_wid_top_bottom); + OUTREG(RADEON_OV0_SCALE_CNTL, restore->ov0_scale_cntl); + OUTREG(RADEON_SUBPIC_CNTL, restore->subpic_cntl); + OUTREG(RADEON_VIPH_CONTROL, restore->viph_control); + OUTREG(RADEON_I2C_CNTL_1, restore->i2c_cntl_1); + OUTREG(RADEON_GEN_INT_CNTL, restore->gen_int_cntl); + OUTREG(RADEON_CAP0_TRIG_CNTL, restore->cap0_trig_cntl); + OUTREG(RADEON_CAP1_TRIG_CNTL, restore->cap1_trig_cntl); + OUTREG(RADEON_BUS_CNTL, restore->bus_cntl); + OUTREG(RADEON_SURFACE_CNTL, restore->surface_cntl); + + /* Workaround for the VT switching problem in dual-head mode. This + * problem only occurs on RV style chips, typically when a FP and + * CRT are connected. + */ + if (info->HasCRTC2 && + !info->IsSwitching && + info->ChipFamily != CHIP_FAMILY_R200 && + info->ChipFamily != CHIP_FAMILY_R300) { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + CARD32 tmp; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + if (pRADEONEnt->HasSecondary || info->Clone) { + tmp = INREG(RADEON_DAC_CNTL2); + OUTREG(RADEON_DAC_CNTL2, tmp & ~RADEON_DAC2_DAC_CLK_SEL); + usleep(100000); + } + } +} + +/* Write miscellaneous registers which might have been destroyed by an fbdevHW + * call + */ +static void RADEONRestoreFBDevRegisters(ScrnInfoPtr pScrn, + RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef XF86DRI + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - OUTREG(RADEON_OVR_CLR, restore->ovr_clr); - OUTREG(RADEON_OVR_WID_LEFT_RIGHT, restore->ovr_wid_left_right); - OUTREG(RADEON_OVR_WID_TOP_BOTTOM, restore->ovr_wid_top_bottom); - OUTREG(RADEON_OV0_SCALE_CNTL, restore->ov0_scale_cntl); - OUTREG(RADEON_MPP_TB_CONFIG, restore->mpp_tb_config ); - OUTREG(RADEON_MPP_GP_CONFIG, restore->mpp_gp_config ); - OUTREG(RADEON_SUBPIC_CNTL, restore->subpic_cntl); - OUTREG(RADEON_VIPH_CONTROL, restore->viph_control); - OUTREG(RADEON_I2C_CNTL_1, restore->i2c_cntl_1); - OUTREG(RADEON_GEN_INT_CNTL, restore->gen_int_cntl); - OUTREG(RADEON_CAP0_TRIG_CNTL, restore->cap0_trig_cntl); - OUTREG(RADEON_CAP1_TRIG_CNTL, restore->cap1_trig_cntl); - OUTREG(RADEON_BUS_CNTL, restore->bus_cntl); - OUTREG(RADEON_SURFACE_CNTL, restore->surface_cntl); + /* Restore register for vertical blank interrupts */ + if (info->irq) { + OUTREG(RADEON_GEN_INT_CNTL, restore->gen_int_cntl); + } + + /* Restore registers for page flipping */ + if (info->allowPageFlip) { + OUTREG(RADEON_CRTC_OFFSET_CNTL, restore->crtc_offset_cntl); + if (info->HasCRTC2) { + OUTREG(RADEON_CRTC2_OFFSET_CNTL, restore->crtc2_offset_cntl); + } + } +#endif } -/* Write CRTC registers. */ +/* Write CRTC registers */ static void RADEONRestoreCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - OUTREG(RADEON_CRTC_GEN_CNTL, restore->crtc_gen_cntl); + OUTREG(RADEON_CRTC_GEN_CNTL, restore->crtc_gen_cntl); - OUTREGP(RADEON_CRTC_EXT_CNTL, restore->crtc_ext_cntl, + OUTREGP(RADEON_CRTC_EXT_CNTL, + restore->crtc_ext_cntl, RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_DISPLAY_DIS); - OUTREGP(RADEON_DAC_CNTL, restore->dac_cntl, + OUTREGP(RADEON_DAC_CNTL, + restore->dac_cntl, RADEON_DAC_RANGE_CNTL | RADEON_DAC_BLANKING); @@ -2953,21 +4173,34 @@ OUTREG(RADEON_CRTC_PITCH, restore->crtc_pitch); } -/* Write CRTC2 registers. */ +/* Write CRTC2 registers */ static void RADEONRestoreCrtc2Registers(ScrnInfoPtr pScrn, - RADEONSavePtr restore) + RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; -/* OUTREG(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);*/ - OUTREGP(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl, + OUTREGP(RADEON_CRTC2_GEN_CNTL, + restore->crtc2_gen_cntl, RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS | RADEON_CRTC2_DISP_DIS); OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); - OUTREG(RADEON_DISP_OUTPUT_CNTL, restore->disp_output_cntl); + + if (info->ChipFamily == CHIP_FAMILY_R200 || + info->ChipFamily == CHIP_FAMILY_R300) { + OUTREG(RADEON_DISP_OUTPUT_CNTL, restore->disp_output_cntl); + } else { + OUTREG(RADEON_DISP_HW_DEBUG, restore->disp_hw_debug); + if (info->IsDell) { + /* Workaround for DELL card. BIOS doesn't initialize + * TV_DAC_CNTL to a correct value which causes too high + * contrast for the second CRT (using TV_DAC). + */ + OUTREG(RADEON_TV_DAC_CNTL, 0x00280203); + } + } OUTREG(RADEON_CRTC2_H_TOTAL_DISP, restore->crtc2_h_total_disp); OUTREG(RADEON_CRTC2_H_SYNC_STRT_WID, restore->crtc2_h_sync_strt_wid); @@ -2977,143 +4210,168 @@ OUTREG(RADEON_CRTC2_OFFSET_CNTL, restore->crtc2_offset_cntl); OUTREG(RADEON_CRTC2_PITCH, restore->crtc2_pitch); + if (info->DisplayType == MT_DFP || info->CloneType == MT_DFP) { + OUTREG(RADEON_FP_H2_SYNC_STRT_WID, restore->fp2_h_sync_strt_wid); + OUTREG(RADEON_FP_V2_SYNC_STRT_WID, restore->fp2_v_sync_strt_wid); + OUTREG(RADEON_FP2_GEN_CNTL, restore->fp2_gen_cntl); + } + +#if 0 + /* Hack for restoring text mode -- fixed elsewhere */ + usleep(100000); +#endif } -/* Note: Radeon flat panel support has been disabled for now */ /* Write flat panel registers */ static void RADEONRestoreFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - unsigned long tmp; + unsigned long tmp; OUTREG(RADEON_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp); OUTREG(RADEON_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp); OUTREG(RADEON_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid); OUTREG(RADEON_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid); - OUTREG(RADEON_TMDS_CRC, restore->tmds_crc); + OUTREG(RADEON_TMDS_PLL_CNTL, restore->tmds_pll_cntl); OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch); OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch); OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl); - if(info->DisplayType == MT_LCD) - { - tmp = INREG(RADEON_LVDS_GEN_CNTL); - if ((tmp & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) == - (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) - { - OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); - } - else - { - if (restore->lvds_gen_cntl & - (RADEON_LVDS_ON | RADEON_LVDS_BLON)) - { - usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); + if (info->DisplayType == MT_LCD) { + tmp = INREG(RADEON_LVDS_GEN_CNTL); + if ((tmp & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) == + (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) { OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); - } - else - { - OUTREG(RADEON_LVDS_GEN_CNTL, - restore->lvds_gen_cntl | RADEON_LVDS_BLON); - usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); - OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); + } else { + if (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) { + usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); + OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); + } else { + OUTREG(RADEON_LVDS_GEN_CNTL, + restore->lvds_gen_cntl | RADEON_LVDS_BLON); + usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); + OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); + } } } - } } -#if RADEON_ATOMIC_UPDATE static void RADEONPLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn) { - while (INPLL(pScrn, RADEON_PPLL_REF_DIV) & RADEON_PPLL_ATOMIC_UPDATE_R); + int i = 0; + + /* FIXME: Certain revisions of R300 can't recover here. Not sure of + the cause yet, but this workaround will mask the problem for now. + Other chips usually will pass at the very first test, so the + workaround shouldn't have any effect on them. */ + for (i = 0; + (i < 10000 && + INPLL(pScrn, RADEON_PPLL_REF_DIV) & RADEON_PPLL_ATOMIC_UPDATE_R); + i++); } static void RADEONPLLWriteUpdate(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + + while (INPLL(pScrn, RADEON_PPLL_REF_DIV) & RADEON_PPLL_ATOMIC_UPDATE_R); - OUTPLLP(pScrn, RADEON_PPLL_REF_DIV, RADEON_PPLL_ATOMIC_UPDATE_W, 0xffff); + OUTPLLP(pScrn, RADEON_PPLL_REF_DIV, + RADEON_PPLL_ATOMIC_UPDATE_W, + ~(RADEON_PPLL_ATOMIC_UPDATE_W)); } -#endif + +static void RADEONPLL2WaitForReadUpdateComplete(ScrnInfoPtr pScrn) +{ + int i = 0; + + /* FIXME: Certain revisions of R300 can't recover here. Not sure of + the cause yet, but this workaround will mask the problem for now. + Other chips usually will pass at the very first test, so the + workaround shouldn't have any effect on them. */ + for (i = 0; + (i < 10000 && + INPLL(pScrn, RADEON_P2PLL_REF_DIV) & RADEON_P2PLL_ATOMIC_UPDATE_R); + i++); +} -/* Write PLL registers. */ -static void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) +static void RADEONPLL2WriteUpdate(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - OUTPLLP(pScrn, 0x08, 0x00, ~(0x03)); + while (INPLL(pScrn, RADEON_P2PLL_REF_DIV) & RADEON_P2PLL_ATOMIC_UPDATE_R); -#if !RADEON_ATOMIC_UPDATE - while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & RADEON_PLL_DIV_SEL) != - RADEON_PLL_DIV_SEL) { -#endif - OUTREGP(RADEON_CLOCK_CNTL_INDEX, RADEON_PLL_DIV_SEL, 0xffff); -#if !RADEON_ATOMIC_UPDATE - } -#endif + OUTPLLP(pScrn, RADEON_P2PLL_REF_DIV, + RADEON_P2PLL_ATOMIC_UPDATE_W, + ~(RADEON_P2PLL_ATOMIC_UPDATE_W)); +} + +/* Write PLL registers */ +static void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, + RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + OUTPLLP(pScrn, RADEON_VCLK_ECP_CNTL, + RADEON_VCLK_SRC_SEL_CPUCLK, + ~(RADEON_VCLK_SRC_SEL_MASK)); -#if RADEON_ATOMIC_UPDATE OUTPLLP(pScrn, RADEON_PPLL_CNTL, RADEON_PPLL_RESET | RADEON_PPLL_ATOMIC_UPDATE_EN | RADEON_PPLL_VGA_ATOMIC_UPDATE_EN, - 0xffff); -#else - OUTPLLP(pScrn, - RADEON_PPLL_CNTL, - RADEON_PPLL_RESET, - 0xffff); -#endif - -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif - while ( (INPLL(pScrn, RADEON_PPLL_REF_DIV) & RADEON_PPLL_REF_DIV_MASK) != - (restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK)) { + ~(RADEON_PPLL_RESET + | RADEON_PPLL_ATOMIC_UPDATE_EN + | RADEON_PPLL_VGA_ATOMIC_UPDATE_EN)); + + OUTREGP(RADEON_CLOCK_CNTL_INDEX, + RADEON_PLL_DIV_SEL, + ~(RADEON_PLL_DIV_SEL)); + + if (info->ChipFamily == CHIP_FAMILY_R300) { + if (restore->ppll_ref_div & R300_PPLL_REF_DIV_ACC_MASK) { + /* When restoring console mode, use saved PPLL_REF_DIV + * setting. + */ + OUTPLLP(pScrn, RADEON_PPLL_REF_DIV, + restore->ppll_ref_div, + 0); + } else { + /* R300 uses ref_div_acc field as real ref divider */ + OUTPLLP(pScrn, RADEON_PPLL_REF_DIV, + (restore->ppll_ref_div << R300_PPLL_REF_DIV_ACC_SHIFT), + ~R300_PPLL_REF_DIV_ACC_MASK); + } + } else { OUTPLLP(pScrn, RADEON_PPLL_REF_DIV, - restore->ppll_ref_div, ~RADEON_PPLL_REF_DIV_MASK); + restore->ppll_ref_div, + ~RADEON_PPLL_REF_DIV_MASK); } -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif - while ( (INPLL(pScrn, RADEON_PPLL_DIV_3) & RADEON_PPLL_FB3_DIV_MASK) != - (restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK)) { - OUTPLLP(pScrn, RADEON_PPLL_DIV_3, - restore->ppll_div_3, ~RADEON_PPLL_FB3_DIV_MASK); - } -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif + OUTPLLP(pScrn, RADEON_PPLL_DIV_3, + restore->ppll_div_3, + ~RADEON_PPLL_FB3_DIV_MASK); -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif - while ( (INPLL(pScrn, RADEON_PPLL_DIV_3) & RADEON_PPLL_POST3_DIV_MASK) != - (restore->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK)) { - OUTPLLP(pScrn, RADEON_PPLL_DIV_3, - restore->ppll_div_3, ~RADEON_PPLL_POST3_DIV_MASK); - } -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif + OUTPLLP(pScrn, RADEON_PPLL_DIV_3, + restore->ppll_div_3, + ~RADEON_PPLL_POST3_DIV_MASK); -#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif + OUTPLL(RADEON_HTOTAL_CNTL, restore->htotal_cntl); -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif - OUTPLLP(pScrn, RADEON_PPLL_CNTL, 0, ~RADEON_PPLL_RESET); + OUTPLLP(pScrn, RADEON_PPLL_CNTL, + 0, + ~(RADEON_PPLL_RESET + | RADEON_PPLL_SLEEP + | RADEON_PPLL_ATOMIC_UPDATE_EN + | RADEON_PPLL_VGA_ATOMIC_UPDATE_EN)); RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n", restore->ppll_ref_div, @@ -3125,89 +4383,57 @@ restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK, (restore->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); - OUTPLLP(pScrn, 0x08, 0x03, ~(0x03)); + usleep(5000); /* Let the clock to lock */ + OUTPLLP(pScrn, RADEON_VCLK_ECP_CNTL, + RADEON_VCLK_SRC_SEL_PPLLCLK, + ~(RADEON_VCLK_SRC_SEL_MASK)); } -/* Write PLL2 registers. */ -static void RADEONRestorePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr restore) +/* Write PLL2 registers */ +static void RADEONRestorePLL2Registers(ScrnInfoPtr pScrn, + RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - - OUTPLLP(pScrn, 0x2d, 0x00, ~(0x03)); - - -#if !RADEON_ATOMIC_UPDATE - while (INREG(RADEON_CLOCK_CNTL_INDEX) & ~(RADEON_PLL2_DIV_SEL_MASK)) { -#endif - OUTREGP(RADEON_CLOCK_CNTL_INDEX, 0, RADEON_PLL2_DIV_SEL_MASK); -#if !RADEON_ATOMIC_UPDATE - } -#endif + OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, + RADEON_PIX2CLK_SRC_SEL_CPUCLK, + ~(RADEON_PIX2CLK_SRC_SEL_MASK)); -#if RADEON_ATOMIC_UPDATE OUTPLLP(pScrn, RADEON_P2PLL_CNTL, RADEON_P2PLL_RESET | RADEON_P2PLL_ATOMIC_UPDATE_EN | RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN, - 0xffff); -#else - OUTPLLP(pScrn, - RADEON_P2PLL_CNTL, - RADEON_P2PLL_RESET, - 0xffff); -#endif - -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif - while ( (INPLL(pScrn, RADEON_P2PLL_REF_DIV) & RADEON_P2PLL_REF_DIV_MASK) != - (restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK)) { - OUTPLLP(pScrn, RADEON_P2PLL_REF_DIV, restore->p2pll_ref_div, ~RADEON_P2PLL_REF_DIV_MASK); - } -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif - -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif - while ( (INPLL(pScrn, RADEON_P2PLL_DIV_0) & RADEON_P2PLL_FB0_DIV_MASK) != - (restore->p2pll_div_0 & -RADEON_P2PLL_FB0_DIV_MASK)) { - OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, - restore->p2pll_div_0, ~RADEON_P2PLL_FB0_DIV_MASK); - } -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif + ~(RADEON_P2PLL_RESET + | RADEON_P2PLL_ATOMIC_UPDATE_EN + | RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN)); + + OUTPLLP(pScrn, RADEON_P2PLL_REF_DIV, + restore->p2pll_ref_div, + ~RADEON_P2PLL_REF_DIV_MASK); + + OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, + restore->p2pll_div_0, + ~RADEON_P2PLL_FB0_DIV_MASK); + + OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, + restore->p2pll_div_0, + ~RADEON_P2PLL_POST0_DIV_MASK); -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif - while ( (INPLL(pScrn, RADEON_P2PLL_DIV_0) & RADEON_P2PLL_POST0_DIV_MASK) != - (restore->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK)) { - OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, - restore->p2pll_div_0, ~RADEON_P2PLL_POST0_DIV_MASK); - } -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif + RADEONPLL2WriteUpdate(pScrn); + RADEONPLL2WaitForReadUpdateComplete(pScrn); -#if RADEON_ATOMIC_UPDATE - RADEONPLLWaitForReadUpdateComplete(pScrn); -#endif OUTPLL(RADEON_HTOTAL2_CNTL, restore->htotal_cntl2); -#if RADEON_ATOMIC_UPDATE - RADEONPLLWriteUpdate(pScrn); -#endif - OUTPLLP(pScrn, RADEON_P2PLL_CNTL, 0, - ~(RADEON_P2PLL_RESET | RADEON_P2PLL_SLEEP)); + OUTPLLP(pScrn, RADEON_P2PLL_CNTL, + 0, + ~(RADEON_P2PLL_RESET + | RADEON_P2PLL_SLEEP + | RADEON_P2PLL_ATOMIC_UPDATE_EN + | RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN)); RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n", restore->p2pll_ref_div, @@ -3216,31 +4442,23 @@ INPLL(pScrn, RADEON_P2PLL_CNTL))); RADEONTRACE(("Wrote: rd=%d, fd=%d, pd=%d\n", restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, - restore->p2pll_div_0 & RADEON_P2PLL_FB3_DIV_MASK, - (restore->p2pll_div_0 & RADEON_P2PLL_POST3_DIV_MASK) >>16)); - - OUTPLLP(pScrn, 0x2d, 0x03, ~(0x03)); - - -} + restore->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, + (restore->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >>16)); -/* Write DDA registers. */ -static void RADEONRestoreDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; + usleep(5000); /* Let the clock to lock */ - OUTREG(RADEON_DDA_CONFIG, restore->dda_config); - OUTREG(RADEON_DDA_ON_OFF, restore->dda_on_off); + OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, + RADEON_PIX2CLK_SRC_SEL_P2PLLCLK, + ~(RADEON_PIX2CLK_SRC_SEL_MASK)); } #if 0 -/* Write palette data. */ +/* Write palette data */ static void RADEONRestorePalette(ScrnInfoPtr pScrn, RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; + int i; if (!restore->palette_valid) return; @@ -3260,120 +4478,103 @@ } #endif -/* Write out state to define a new video mode. */ -static void -RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) +/* Write out state to define a new video mode */ +static void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) { - RADEONInfoPtr info = RADEONPTR(pScrn); - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - static RADEONSaveRec restore0; - - /* for Non-dual head card, we don't have private field in the Entity*/ - if(!info->HasCRTC2) - { - RADEONRestoreCommonRegisters(pScrn, restore); - RADEONRestoreDDARegisters(pScrn, restore); - RADEONRestoreCrtcRegisters(pScrn, restore); - if((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) - { - RADEONRestoreFPRegisters(pScrn, restore); - } - RADEONRestorePLLRegisters(pScrn, restore); - return; - } + RADEONInfoPtr info = RADEONPTR(pScrn); + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + static RADEONSaveRec restore0; + + /* For Non-dual head card, we don't have private field in the Entity */ + if (!info->HasCRTC2) { + RADEONRestoreCommonRegisters(pScrn, restore); + RADEONRestoreCrtcRegisters(pScrn, restore); + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) { + RADEONRestoreFPRegisters(pScrn, restore); + } + RADEONRestorePLLRegisters(pScrn, restore); + return; + } - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex); pRADEONEnt = pPriv->ptr; - + RADEONTRACE(("RADEONRestoreMode(%p)\n", restore)); - /***** - When changing mode with Dual-head card (VE/M6), care must - be taken for the special order in setting registers. CRTC2 has - to be set before changing CRTC_EXT register. - In the dual-head setup, X server calls this routine twice with - primary and secondary pScrn pointers respectively. The calls - can come with different order. Regardless the order of X server issuing - the calls, we have to ensure we set registers in the right order!!! - Otherwise we may get a blank screen. - *****/ - if(info->IsSecondary) - { - RADEONRestoreCrtc2Registers(pScrn, restore); - RADEONRestorePLL2Registers(pScrn, restore); - - if(!info->SwitchingMode) - pRADEONEnt->IsSecondaryRestored = TRUE; - - if(pRADEONEnt->RestorePrimary) - { - RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); - pRADEONEnt->RestorePrimary = FALSE; - - RADEONRestoreCrtcRegisters(pScrn, &restore0); - if((info0->DisplayType == MT_DFP) || - (info0->DisplayType == MT_LCD)) - { - RADEONRestoreFPRegisters(pScrn, &restore0); - } - - RADEONRestorePLLRegisters(pScrn, &restore0); - pRADEONEnt->IsSecondaryRestored = FALSE; + /* When changing mode with Dual-head card, care must be taken for + * the special order in setting registers. CRTC2 has to be set + * before changing CRTC_EXT register. In the dual-head setup, X + * server calls this routine twice with primary and secondary pScrn + * pointers respectively. The calls can come with different + * order. Regardless the order of X server issuing the calls, we + * have to ensure we set registers in the right order!!! Otherwise + * we may get a blank screen. + */ + if (info->IsSecondary) { + if (!pRADEONEnt->RestorePrimary) + RADEONRestoreCommonRegisters(pScrn, restore); + RADEONRestoreCrtc2Registers(pScrn, restore); + RADEONRestorePLL2Registers(pScrn, restore); + + if(info->IsSwitching) return; + + pRADEONEnt->IsSecondaryRestored = TRUE; + + if (pRADEONEnt->RestorePrimary) { + RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + pRADEONEnt->RestorePrimary = FALSE; + + RADEONRestoreCrtcRegisters(pScrn, &restore0); + if ((info0->DisplayType == MT_DFP) || + (info0->DisplayType == MT_LCD)) { + RADEONRestoreFPRegisters(pScrn, &restore0); + } - } - } - else - { - RADEONRestoreCommonRegisters(pScrn, restore); - RADEONRestoreDDARegisters(pScrn, restore); - if(!pRADEONEnt->HasSecondary || pRADEONEnt->IsSecondaryRestored - || info->SwitchingMode) - { + RADEONRestorePLLRegisters(pScrn, &restore0); pRADEONEnt->IsSecondaryRestored = FALSE; - RADEONRestoreCrtcRegisters(pScrn, restore); - if((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) - { - RADEONRestoreFPRegisters(pScrn, restore); - } - RADEONRestorePLLRegisters(pScrn, restore); - } - else - { - memcpy(&restore0, restore, sizeof(restore0)); - pRADEONEnt->RestorePrimary = TRUE; - } - } + } + } else { + if (!pRADEONEnt->IsSecondaryRestored) + RADEONRestoreCommonRegisters(pScrn, restore); - /* if only one screen is used, we should turn off - the unused screen, not working for now */ - /* - if(!xf86IsEntityShared(pScrn->entityList[0])) - { - RADEONSetDisplayOff(pScrn, 1, 1); + if (info->Clone) { + RADEONRestoreCrtc2Registers(pScrn, restore); + RADEONRestorePLL2Registers(pScrn, restore); + } + + if (!pRADEONEnt->HasSecondary || pRADEONEnt->IsSecondaryRestored || + info->IsSwitching) { + pRADEONEnt->IsSecondaryRestored = FALSE; + + RADEONRestoreCrtcRegisters(pScrn, restore); + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) { + RADEONRestoreFPRegisters(pScrn, restore); + } + RADEONRestorePLLRegisters(pScrn, restore); + } else { + memcpy(&restore0, restore, sizeof(restore0)); + pRADEONEnt->RestorePrimary = TRUE; + } } - */ #if 0 RADEONRestorePalette(pScrn, &info->SavedReg); #endif } -/* Read common registers. */ +/* Read common registers */ static void RADEONSaveCommonRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; save->ovr_clr = INREG(RADEON_OVR_CLR); save->ovr_wid_left_right = INREG(RADEON_OVR_WID_LEFT_RIGHT); save->ovr_wid_top_bottom = INREG(RADEON_OVR_WID_TOP_BOTTOM); save->ov0_scale_cntl = INREG(RADEON_OV0_SCALE_CNTL); - save->mpp_tb_config = INREG(RADEON_MPP_TB_CONFIG); - save->mpp_gp_config = INREG(RADEON_MPP_GP_CONFIG); save->subpic_cntl = INREG(RADEON_SUBPIC_CNTL); save->viph_control = INREG(RADEON_VIPH_CONTROL); save->i2c_cntl_1 = INREG(RADEON_I2C_CNTL_1); @@ -3383,11 +4584,33 @@ save->bus_cntl = INREG(RADEON_BUS_CNTL); save->surface_cntl = INREG(RADEON_SURFACE_CNTL); } + +/* Read miscellaneous registers which might be destroyed by an fbdevHW call */ +static void RADEONSaveFBDevRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) +{ +#ifdef XF86DRI + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + /* Save register for vertical blank interrupts */ + if (info->irq) { + save->gen_int_cntl = INREG(RADEON_GEN_INT_CNTL); + } + + /* Save registers for page flipping */ + if (info->allowPageFlip) { + save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL); + if (info->HasCRTC2) { + save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL); + } + } +#endif +} -/* Read CRTC registers. */ +/* Read CRTC registers */ static void RADEONSaveCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; save->crtc_gen_cntl = INREG(RADEON_CRTC_GEN_CNTL); @@ -3400,14 +4623,12 @@ save->crtc_offset = INREG(RADEON_CRTC_OFFSET); save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL); save->crtc_pitch = INREG(RADEON_CRTC_PITCH); - } -/* Note: Radeon flat panel support has been disabled for now */ /* Read flat panel registers */ static void RADEONSaveFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; save->fp_crtc_h_total_disp = INREG(RADEON_FP_CRTC_H_TOTAL_DISP); @@ -3419,18 +4640,18 @@ save->fp_vert_stretch = INREG(RADEON_FP_VERT_STRETCH); save->lvds_gen_cntl = INREG(RADEON_LVDS_GEN_CNTL); save->lvds_pll_cntl = INREG(RADEON_LVDS_PLL_CNTL); - save->tmds_crc = INREG(RADEON_TMDS_CRC); + save->tmds_pll_cntl = INREG(RADEON_TMDS_PLL_CNTL); } -/* Read CRTC2 registers. */ -static void RADEONSaveCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr -save) +/* Read CRTC2 registers */ +static void RADEONSaveCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; save->dac2_cntl = INREG(RADEON_DAC_CNTL2); save->disp_output_cntl = INREG(RADEON_DISP_OUTPUT_CNTL); + save->disp_hw_debug = INREG (RADEON_DISP_HW_DEBUG); save->crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL); save->crtc2_h_total_disp = INREG(RADEON_CRTC2_H_TOTAL_DISP); @@ -3440,62 +4661,57 @@ save->crtc2_offset = INREG(RADEON_CRTC2_OFFSET); save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL); save->crtc2_pitch = INREG(RADEON_CRTC2_PITCH); + + save->fp2_h_sync_strt_wid = INREG (RADEON_FP_H2_SYNC_STRT_WID); + save->fp2_v_sync_strt_wid = INREG (RADEON_FP_V2_SYNC_STRT_WID); + save->fp2_gen_cntl = INREG (RADEON_FP2_GEN_CNTL); + } -/* Read PLL registers. */ +/* Read PLL registers */ static void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { - save->ppll_ref_div = INPLL(pScrn, RADEON_PPLL_REF_DIV); - save->ppll_div_3 = INPLL(pScrn, RADEON_PPLL_DIV_3); - save->htotal_cntl = INPLL(pScrn, RADEON_HTOTAL_CNTL); + save->ppll_ref_div = INPLL(pScrn, RADEON_PPLL_REF_DIV); + save->ppll_div_3 = INPLL(pScrn, RADEON_PPLL_DIV_3); + save->htotal_cntl = INPLL(pScrn, RADEON_HTOTAL_CNTL); RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n", - save->ppll_ref_div, - save->ppll_div_3, - save->htotal_cntl)); + save->ppll_ref_div, + save->ppll_div_3, + save->htotal_cntl)); RADEONTRACE(("Read: rd=%d, fd=%d, pd=%d\n", - save->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK, - save->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK, - (save->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); + save->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK, + save->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK, + (save->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); } -/* Read PLL registers. */ +/* Read PLL registers */ static void RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save) { - save->p2pll_ref_div = INPLL(pScrn, RADEON_P2PLL_REF_DIV); - save->p2pll_div_0 = INPLL(pScrn, RADEON_P2PLL_DIV_0); - save->htotal_cntl2 = INPLL(pScrn, RADEON_HTOTAL2_CNTL); + save->p2pll_ref_div = INPLL(pScrn, RADEON_P2PLL_REF_DIV); + save->p2pll_div_0 = INPLL(pScrn, RADEON_P2PLL_DIV_0); + save->htotal_cntl2 = INPLL(pScrn, RADEON_HTOTAL2_CNTL); RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n", - save->p2pll_ref_div, - save->p2pll_div_0, - save->htotal_cntl2)); + save->p2pll_ref_div, + save->p2pll_div_0, + save->htotal_cntl2)); RADEONTRACE(("Read: rd=%d, fd=%d, pd=%d\n", - save->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, - save->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, - (save->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >> 16)); -} - -/* Read DDA registers. */ -static void RADEONSaveDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - save->dda_config = INREG(RADEON_DDA_CONFIG); - save->dda_on_off = INREG(RADEON_DDA_ON_OFF); + save->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, + save->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, + (save->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >> 16)); } -/* Read palette data. */ +/* Read palette data */ static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; + int i; #ifdef ENABLE_FLAT_PANEL /* Select palette 0 (main CRTC) if using FP-enabled chip */ - /*if (info->Port1 == MT_DFP) PAL_SELECT(1);*/ + /* if (info->Port1 == MT_DFP) PAL_SELECT(1); */ #endif PAL_SELECT(1); INPAL_START(0); @@ -3506,40 +4722,42 @@ save->palette_valid = TRUE; } -/* Save state that defines current video mode. */ +/* Save state that defines current video mode */ static void RADEONSaveMode(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); RADEONTRACE(("RADEONSaveMode(%p)\n", save)); - if(info->IsSecondary) - { - RADEONSaveCrtc2Registers(pScrn, save); - RADEONSavePLL2Registers(pScrn, save); - } - else - { - RADEONSaveCommonRegisters(pScrn, save); - RADEONSaveCrtcRegisters(pScrn, save); - if((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) - { - RADEONSaveFPRegisters(pScrn, save); - } - RADEONSavePLLRegisters(pScrn, save); - RADEONSaveDDARegisters(pScrn, save); - /*RADEONSavePalette(pScrn, save);*/ + if (info->IsSecondary) { + RADEONSaveCrtc2Registers(pScrn, save); + RADEONSavePLL2Registers(pScrn, save); + } else { + RADEONSavePLLRegisters(pScrn, save); + RADEONSaveCommonRegisters(pScrn, save); + RADEONSaveCrtcRegisters(pScrn, save); + + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) { + RADEONSaveFPRegisters(pScrn, save); + } + + if (info->Clone) { + RADEONSaveCrtc2Registers(pScrn, save); + RADEONSavePLL2Registers(pScrn, save); + } + /* RADEONSavePalette(pScrn, save); */ } + RADEONTRACE(("RADEONSaveMode returns %p\n", save)); } -/* Save everything needed to restore the original VC state. */ +/* Save everything needed to restore the original VC state */ static void RADEONSave(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - RADEONSavePtr save = &info->SavedReg; - vgaHWPtr hwp = VGAHWPTR(pScrn); + RADEONSavePtr save = &info->SavedReg; + vgaHWPtr hwp = VGAHWPTR(pScrn); RADEONTRACE(("RADEONSave\n")); if (info->FBDev) { @@ -3547,92 +4765,101 @@ return; } - if(!info->IsSecondary) - { - vgaHWUnlock(hwp); + if (!info->IsSecondary) { + vgaHWUnlock(hwp); #if defined(__powerpc__) - /* temporary hack to prevent crashing on PowerMacs when trying to - * read VGA fonts and colormap, will find a better solution - * in the future - */ - vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* save mode only */ + /* temporary hack to prevent crashing on PowerMacs when trying to + * read VGA fonts and colormap, will find a better solution + * in the future + */ + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ #else - vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts,cmap */ -#endif - vgaHWLock(hwp); - save->dp_datatype = INREG(RADEON_DP_DATATYPE); - save->rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); - save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); - save->amcgpio_en_reg = INREG(RADEON_AMCGPIO_EN_REG); - save->amcgpio_mask = INREG(RADEON_AMCGPIO_MASK); + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* Save mode + * & fonts & cmap + */ +#endif + vgaHWLock(hwp); + save->dp_datatype = INREG(RADEON_DP_DATATYPE); + save->rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); + save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); + if (info->R300CGWorkaround) R300CGWorkaround(pScrn); } - + RADEONSaveMode(pScrn, save); } -/* Restore the original (text) mode. */ +/* Restore the original (text) mode */ static void RADEONRestore(ScrnInfoPtr pScrn) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - RADEONSavePtr restore = &info->SavedReg; - vgaHWPtr hwp = VGAHWPTR(pScrn); + RADEONSavePtr restore = &info->SavedReg; + vgaHWPtr hwp = VGAHWPTR(pScrn); RADEONTRACE(("RADEONRestore\n")); + +#if X_BYTE_ORDER == X_BIG_ENDIAN + RADEONWaitForFifo(pScrn, 1); + OUTREG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_NONE); +#endif + if (info->FBDev) { fbdevHWRestore(pScrn); return; } RADEONBlank(pScrn); - OUTREG(RADEON_AMCGPIO_MASK, restore->amcgpio_mask); - OUTREG(RADEON_AMCGPIO_EN_REG, restore->amcgpio_en_reg); OUTREG(RADEON_CLOCK_CNTL_INDEX, restore->clock_cntl_index); + if (info->R300CGWorkaround) R300CGWorkaround(pScrn); OUTREG(RADEON_RBBM_SOFT_RESET, restore->rbbm_soft_reset); OUTREG(RADEON_DP_DATATYPE, restore->dp_datatype); +#if 0 /* M6 card has trouble restoring text mode for its CRT. - Needs this workaround.*/ - if(xf86IsEntityShared(pScrn->entityList[0]) && info->IsM6) - OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); + * This is fixed elsewhere and will be removed in the future. + */ + if ((xf86IsEntityShared(pScrn->entityList[0]) || info->Clone) + && info->IsM6) + OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); +#endif RADEONRestoreMode(pScrn, restore); +#if 0 /* Temp fix to "solve" VT switch problems. When switching VTs on - some systems, the console can either hang or the fonts can be - corrupted. This hack solves the problem 99% of the time. A - correct fix is being worked on. */ + * some systems, the console can either hang or the fonts can be + * corrupted. This hack solves the problem 99% of the time. A + * correct fix is being worked on. + */ usleep(100000); +#endif - if(!info->IsSecondary) - { - vgaHWUnlock(hwp); + if (!info->IsSecondary) { + vgaHWUnlock(hwp); #if defined(__powerpc__) - /* temporary hack to prevent crashing on PowerMacs when trying to - * write VGA fonts, will find a better solution in the future - */ - vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); + /* Temporary hack to prevent crashing on PowerMacs when trying to + * write VGA fonts, will find a better solution in the future + */ + vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); #else - vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); + vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); #endif - vgaHWLock(hwp); - - } - else - { - DevUnion* pPriv; - RADEONEntPtr pRADEONEnt; - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - pRADEONEnt = pPriv->ptr; - { - ScrnInfoPtr pScrn0 = pRADEONEnt->pPrimaryScrn; - vgaHWPtr hwp0 = VGAHWPTR(pScrn0); - vgaHWUnlock(hwp0); - vgaHWRestore(pScrn0, &hwp0->SavedReg, - VGA_SR_MODE | VGA_SR_FONTS ); - vgaHWLock(hwp0); - } + vgaHWLock(hwp); + } else { + DevUnion *pPriv; + RADEONEntPtr pRADEONEnt; + ScrnInfoPtr pScrn0; + vgaHWPtr hwp0; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + pScrn0 = pRADEONEnt->pPrimaryScrn; + hwp0 = VGAHWPTR(pScrn0); + vgaHWUnlock(hwp0); + vgaHWRestore(pScrn0, &hwp0->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); + vgaHWLock(hwp0); } RADEONUnblank(pScrn); @@ -3641,16 +4868,13 @@ #endif } - -/* Define common registers for requested video mode. */ +/* Define common registers for requested video mode */ static void RADEONInitCommonRegisters(RADEONSavePtr save, RADEONInfoPtr info) { save->ovr_clr = 0; save->ovr_wid_left_right = 0; save->ovr_wid_top_bottom = 0; save->ov0_scale_cntl = 0; - save->mpp_tb_config = 0; - save->mpp_gp_config = 0; save->subpic_cntl = 0; save->viph_control = 0; save->i2c_cntl_1 = 0; @@ -3666,19 +4890,21 @@ save->bus_cntl |= RADEON_BUS_RD_DISCARD_EN; } -/* Define CRTC registers for requested video mode. */ +/* Define CRTC registers for requested video mode */ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, RADEONInfoPtr info) { - int format; - int hsync_start; - int hsync_wid; - int hsync_fudge; - int vsync_wid; - int bytpp; - int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; - int hsync_fudge_fp[] = { 0x02, 0x02, 0x00, 0x00, 0x05, 0x05 }; + unsigned char *RADEONMMIO = info->MMIO; + int format; + int hsync_start; + int hsync_wid; + int hsync_fudge; + int vsync_wid; + int bytpp; + int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; + int hsync_fudge_fp[] = { 0x02, 0x02, 0x00, 0x00, 0x05, 0x05 }; + switch (info->CurrentLayout.pixel_code) { case 4: format = 1; bytpp = 0; break; case 8: format = 2; bytpp = 1; break; @@ -3688,112 +4914,118 @@ case 32: format = 6; bytpp = 4; break; /* xRGB */ default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel); + "Unsupported pixel depth (%d)\n", + info->CurrentLayout.bitsPerPixel); return FALSE; } RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); - if ((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) { hsync_fudge = hsync_fudge_fp[format-1]; - else - hsync_fudge = hsync_fudge_default[format-1]; + if (mode->Flags & RADEON_USE_RMX) { +#if 0 + mode->CrtcHDisplay = info->PanelXRes; + mode->CrtcVDisplay = info->PanelYRes; +#endif + mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank; + mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus; + mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth; + mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank; + mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus; + mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth; + mode->Clock = info->DotClock; + mode->Flags = info->Flags | RADEON_USE_RMX; + } + } else { + hsync_fudge = hsync_fudge_default[format-1]; + } save->crtc_gen_cntl = (RADEON_CRTC_EXT_DISP_EN - | RADEON_CRTC_EN - | (format << 8) - | ((mode->Flags & V_DBLSCAN) - ? RADEON_CRTC_DBL_SCAN_EN - : 0) - | ((mode->Flags & V_INTERLACE) - ? RADEON_CRTC_INTERLACE_EN - : 0)); - - if((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) - { - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | - RADEON_XCRT_CNT_EN; - save->crtc_gen_cntl &= ~(RADEON_CRTC_DBL_SCAN_EN | - RADEON_CRTC_INTERLACE_EN); - } - else - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | - RADEON_XCRT_CNT_EN | - RADEON_CRTC_CRT_ON; - - save->dac_cntl = (RADEON_DAC_MASK_ALL - | RADEON_DAC_VGA_ADR_EN - | (info->dac6bits ? 0 : RADEON_DAC_8BIT_EN)); - - if(((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD)) && !info->UseCRT) - { - if(info->PanelXRes < mode->CrtcHDisplay) - mode->HDisplay = mode->CrtcHDisplay = info->PanelXRes; - if(info->PanelYRes < mode->CrtcVDisplay) - mode->VDisplay = mode->CrtcVDisplay = info->PanelYRes; - mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank; - mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus; - mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth; - mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank; - mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus; - mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth; + | RADEON_CRTC_EN + | (format << 8) + | ((mode->Flags & V_DBLSCAN) + ? RADEON_CRTC_DBL_SCAN_EN + : 0) + | ((mode->Flags & V_CSYNC) + ? RADEON_CRTC_CSYNC_EN + : 0) + | ((mode->Flags & V_INTERLACE) + ? RADEON_CRTC_INTERLACE_EN + : 0)); + + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) { + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN; + save->crtc_gen_cntl &= ~(RADEON_CRTC_DBL_SCAN_EN | + RADEON_CRTC_CSYNC_EN | + RADEON_CRTC_INTERLACE_EN); + } else { + save->crtc_ext_cntl = (RADEON_VGA_ATI_LINEAR | + RADEON_XCRT_CNT_EN | + RADEON_CRTC_CRT_ON); } + + save->dac_cntl = (RADEON_DAC_MASK_ALL + | RADEON_DAC_VGA_ADR_EN + | (info->dac6bits ? 0 : RADEON_DAC_8BIT_EN)); + save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) - | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); + | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) + << 16)); hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8; - if (!hsync_wid) hsync_wid = 1; - if (hsync_wid > 0x3f) hsync_wid = 0x3f; + if (!hsync_wid) hsync_wid = 1; hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge; save->crtc_h_sync_strt_wid = ((hsync_start & 0x1fff) - | (hsync_wid << 16) - | ((mode->Flags & V_NHSYNC) - ? RADEON_CRTC_H_SYNC_POL - : 0)); - + | ((hsync_wid & 0x3f) << 16) + | ((mode->Flags & V_NHSYNC) + ? RADEON_CRTC_H_SYNC_POL + : 0)); + #if 1 /* This works for double scan mode. */ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) - | ((mode->CrtcVDisplay - 1) << 16)); + | ((mode->CrtcVDisplay - 1) << 16)); #else /* This is what cce/nbmode.c example code - does -- is this correct? */ + * does -- is this correct? + */ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) - | ((mode->CrtcVDisplay - * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1) - << 16)); + | ((mode->CrtcVDisplay + * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1) + << 16)); #endif vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; - if (!vsync_wid) vsync_wid = 1; - if (vsync_wid > 0x1f) vsync_wid = 0x1f; + if (!vsync_wid) vsync_wid = 1; save->crtc_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff) - | (vsync_wid << 16) - | ((mode->Flags & V_NVSYNC) - ? RADEON_CRTC_V_SYNC_POL - : 0)); + | ((vsync_wid & 0x1f) << 16) + | ((mode->Flags & V_NVSYNC) + ? RADEON_CRTC_V_SYNC_POL + : 0)); save->crtc_offset = 0; - save->crtc_offset_cntl = 0; + save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL); - save->crtc_pitch = ((pScrn->displayWidth * pScrn->bitsPerPixel) + - ((pScrn->bitsPerPixel * 8) -1)) / - (pScrn->bitsPerPixel * 8); + save->crtc_pitch = (((pScrn->displayWidth * pScrn->bitsPerPixel) + + ((pScrn->bitsPerPixel * 8) -1)) / + (pScrn->bitsPerPixel * 8)); save->crtc_pitch |= save->crtc_pitch << 16; - save->surface_cntl = RADEON_SURF_TRANSLATION_DIS; + save->surface_cntl = 0; + #if X_BYTE_ORDER == X_BIG_ENDIAN switch (pScrn->bitsPerPixel) { - case 16: - save->surface_cntl |= RADEON_NONSURF_AP0_SWP_16BPP; - break; - case 32: - save->surface_cntl |= RADEON_NONSURF_AP0_SWP_32BPP; - break; + case 16: + save->surface_cntl |= RADEON_NONSURF_AP0_SWP_16BPP; + break; + + case 32: + save->surface_cntl |= RADEON_NONSURF_AP0_SWP_32BPP; + break; } #endif @@ -3803,18 +5035,20 @@ return TRUE; } -/* Define CRTC2 registers for requested video mode. */ +/* Define CRTC2 registers for requested video mode */ static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, - DisplayModePtr mode, RADEONInfoPtr info) + DisplayModePtr mode, RADEONInfoPtr info) { - int format; - int hsync_start; - int hsync_wid; - int hsync_fudge; - int vsync_wid; - int bytpp; - int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; + unsigned char *RADEONMMIO = info->MMIO; + int format; + int hsync_start; + int hsync_wid; + int hsync_fudge; + int vsync_wid; + int bytpp; + int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; + switch (info->CurrentLayout.pixel_code) { case 4: format = 1; bytpp = 0; break; case 8: format = 2; bytpp = 1; break; @@ -3824,7 +5058,8 @@ case 32: format = 6; bytpp = 4; break; /* xRGB */ default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel); + "Unsupported pixel depth (%d)\n", + info->CurrentLayout.bitsPerPixel); return FALSE; } RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); @@ -3832,184 +5067,271 @@ hsync_fudge = hsync_fudge_default[format-1]; save->crtc2_gen_cntl = (RADEON_CRTC2_EN - | RADEON_CRTC2_CRT2_ON - | (format << 8) - | ((mode->Flags & V_DBLSCAN) - ? RADEON_CRTC2_DBL_SCAN_EN - : 0) - | ((mode->Flags & V_INTERLACE) - ? RADEON_CRTC2_INTERLACE_EN - : 0)); - - if(info->IsR200) - save->disp_output_cntl = - ((info->SavedReg.disp_output_cntl & ~(CARD32)RADEON_DISP_DAC_SOURCE_MASK) - | RADEON_DISP_DAC_SOURCE_CRTC2); - else - save->dac2_cntl = info->SavedReg.dac2_cntl - /*| RADEON_DAC2_DAC2_CLK_SEL*/ - | RADEON_DAC2_DAC_CLK_SEL; + | RADEON_CRTC2_CRT2_ON + | (format << 8) + | ((mode->Flags & V_DBLSCAN) + ? RADEON_CRTC2_DBL_SCAN_EN + : 0) + | ((mode->Flags & V_CSYNC) + ? RADEON_CRTC2_CSYNC_EN + : 0) + | ((mode->Flags & V_INTERLACE) + ? RADEON_CRTC2_INTERLACE_EN + : 0)); + + /* Turn CRT on in case the first head is a DFP */ + save->crtc_ext_cntl |= RADEON_CRTC_CRT_ON; + save->dac2_cntl = info->SavedReg.dac2_cntl; + if (info->ChipFamily == CHIP_FAMILY_R200 || + info->ChipFamily == CHIP_FAMILY_R300) { + save->disp_output_cntl = + ((info->SavedReg.disp_output_cntl + & ~(CARD32)RADEON_DISP_DAC_SOURCE_MASK) + | RADEON_DISP_DAC_SOURCE_CRTC2); + } else { + save->disp_hw_debug = info->SavedReg.disp_hw_debug; + if (info->IsDell && info->DellType == 2) { + if (info->DisplayType == MT_CRT || info->CloneType == MT_CRT) { + /* Turn on 2nd CRT */ + save->dac2_cntl &= ~RADEON_DAC2_DAC_CLK_SEL; + save->dac2_cntl |= RADEON_DAC2_DAC2_CLK_SEL; + save->disp_hw_debug &= ~RADEON_CRT2_DISP1_SEL; + + /* This will make 2nd CRT stay on in console */ + info->SavedReg.dac2_cntl = save->dac2_cntl; + info->SavedReg.disp_hw_debug |= RADEON_CRT2_DISP1_SEL; + info->SavedReg.crtc2_gen_cntl |= RADEON_CRTC2_CRT2_ON; + } + } else save->dac2_cntl |= RADEON_DAC2_DAC_CLK_SEL; + } - save->crtc2_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) - | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); + save->crtc2_h_total_disp = + ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) + | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8; - if (!hsync_wid) hsync_wid = 1; - if (hsync_wid > 0x3f) hsync_wid = 0x3f; + if (!hsync_wid) hsync_wid = 1; hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge; save->crtc2_h_sync_strt_wid = ((hsync_start & 0x1fff) - | (hsync_wid << 16) - | ((mode->Flags & V_NHSYNC) - ? RADEON_CRTC_H_SYNC_POL - : RADEON_CRTC_H_SYNC_POL)); + | ((hsync_wid & 0x3f) << 16) + | ((mode->Flags & V_NHSYNC) + ? RADEON_CRTC_H_SYNC_POL + : 0)); #if 1 /* This works for double scan mode. */ save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) - | ((mode->CrtcVDisplay - 1) << 16)); + | ((mode->CrtcVDisplay - 1) << 16)); #else /* This is what cce/nbmode.c example code - does -- is this correct? */ + * does -- is this correct? + */ save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) - | ((mode->CrtcVDisplay - * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1) - << 16)); + | ((mode->CrtcVDisplay + * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1) + << 16)); #endif vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; - if (!vsync_wid) vsync_wid = 1; - if (vsync_wid > 0x1f) vsync_wid = 0x1f; + if (!vsync_wid) vsync_wid = 1; save->crtc2_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff) - | (vsync_wid << 16) - | ((mode->Flags & V_NVSYNC) - ? RADEON_CRTC2_V_SYNC_POL - : RADEON_CRTC2_V_SYNC_POL)); + | ((vsync_wid & 0x1f) << 16) + | ((mode->Flags & V_NVSYNC) + ? RADEON_CRTC2_V_SYNC_POL + : 0)); save->crtc2_offset = 0; - save->crtc2_offset_cntl = 0; + save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL); - save->crtc2_pitch = ((pScrn->displayWidth * pScrn->bitsPerPixel) + - ((pScrn->bitsPerPixel * 8) -1)) / - (pScrn->bitsPerPixel * 8); + save->crtc2_pitch = (((pScrn->displayWidth * pScrn->bitsPerPixel) + + ((pScrn->bitsPerPixel * 8) -1)) / + (pScrn->bitsPerPixel * 8)); save->crtc2_pitch |= save->crtc2_pitch << 16; - + + if (info->DisplayType == MT_DFP || info->CloneType == MT_DFP) { + save->crtc2_gen_cntl = (RADEON_CRTC2_EN | (format << 8)); + save->fp2_h_sync_strt_wid = save->crtc2_h_sync_strt_wid; + save->fp2_v_sync_strt_wid = save->crtc2_v_sync_strt_wid; + save->fp2_gen_cntl = (RADEON_FP2_SEL_CRTC2 | + RADEON_FP2_PANEL_FORMAT | + RADEON_FP2_ON); + + if (pScrn->rgbBits == 8) + save->fp2_gen_cntl |= RADEON_FP2_PANEL_FORMAT; /* 24 bit format */ + else + save->fp2_gen_cntl &= ~RADEON_FP2_PANEL_FORMAT;/* 18 bit format */ + + /* FIXME: When there are two DFPs, the 2nd DFP is driven by the + * external TMDS transmitter. It may have a problem at + * high dot clock for certain panels. Since we don't + * know how to control the external TMDS transmitter, not + * much we can do here. + */ +#if 0 + if (save->dot_clock_freq > 15000) + save->tmds_pll_cntl = 0xA3F; + else if(save->tmds_pll_cntl != 0xA3F) + save->tmds_pll_cntl = info->SavedReg.tmds_pll_cntl; +#endif + + /* If BIOS has not turned it on, we'll keep it on so that we'll + * have a valid VGA screen even after X quits or VT is switched + * to the console mode. + */ + info->SavedReg.fp2_gen_cntl = RADEON_FP2_ON; + } + RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n", save->crtc2_pitch, pScrn->virtualX, info->CurrentLayout.displayWidth)); + return TRUE; } -/* Note: Radeon flat panel support has been disabled for now */ -/* Define CRTC registers for requested video mode. */ +/* Define CRTC registers for requested video mode */ static void RADEONInitFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr orig, RADEONSavePtr save, DisplayModePtr mode, RADEONInfoPtr info) { - int xres = mode->CrtcHDisplay; - int yres = mode->CrtcVDisplay; - float Hratio, Vratio; + int xres = mode->HDisplay; + int yres = mode->VDisplay; + float Hratio, Vratio; - if(info->PanelXRes == 0 || info->PanelYRes == 0) - { - Hratio = 1; - Vratio = 1; - } - else - { - if (xres > info->PanelXRes) xres = info->PanelXRes; - if (yres > info->PanelYRes) yres = info->PanelYRes; + if (info->PanelXRes == 0 || info->PanelYRes == 0) { + Hratio = 1.0; + Vratio = 1.0; + } else { + if (xres > info->PanelXRes) xres = info->PanelXRes; + if (yres > info->PanelYRes) yres = info->PanelYRes; - Hratio = (float)xres/(float)info->PanelXRes; - Vratio = (float)yres/(float)info->PanelYRes; + Hratio = (float)xres/(float)info->PanelXRes; + Vratio = (float)yres/(float)info->PanelYRes; } - if (Hratio == 1.0) - { - save->fp_horz_stretch = orig->fp_horz_stretch; - save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND | + if (Hratio == 1.0 || !(mode->Flags & RADEON_USE_RMX)) { + save->fp_horz_stretch = orig->fp_horz_stretch; + save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND | RADEON_HORZ_STRETCH_ENABLE); + save->fp_horz_stretch &= ~(RADEON_HORZ_AUTO_RATIO | + RADEON_HORZ_PANEL_SIZE); + save->fp_horz_stretch |= ((xres/8-1)<<16); + + } else { + save->fp_horz_stretch = + ((((unsigned long)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + + 0.5)) & RADEON_HORZ_STRETCH_RATIO_MASK)) | + (orig->fp_horz_stretch & (RADEON_HORZ_PANEL_SIZE | + RADEON_HORZ_FP_LOOP_STRETCH | + RADEON_HORZ_AUTO_RATIO_INC)); + save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND | + RADEON_HORZ_STRETCH_ENABLE); + + save->fp_horz_stretch &= ~(RADEON_HORZ_AUTO_RATIO | + RADEON_HORZ_PANEL_SIZE); + save->fp_horz_stretch |= ((info->PanelXRes / 8 - 1) << 16); + } - else - { - save->fp_horz_stretch = - ((((unsigned long)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + - 0.5)) & RADEON_HORZ_STRETCH_RATIO_MASK)) | - (orig->fp_horz_stretch & (RADEON_HORZ_PANEL_SIZE | - RADEON_HORZ_FP_LOOP_STRETCH | - RADEON_HORZ_AUTO_RATIO_INC)); - save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND | - RADEON_HORZ_STRETCH_ENABLE); - } - save->fp_horz_stretch &= ~RADEON_HORZ_AUTO_RATIO; - if (Vratio == 1.0) - { - save->fp_vert_stretch = orig->fp_vert_stretch; - save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE| - RADEON_VERT_STRETCH_BLEND); - } - else - { - save->fp_vert_stretch = + if (Vratio == 1.0 || !(mode->Flags & RADEON_USE_RMX)) { + save->fp_vert_stretch = orig->fp_vert_stretch; + save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE| + RADEON_VERT_STRETCH_BLEND); + save->fp_vert_stretch &= ~(RADEON_VERT_AUTO_RATIO_EN | + RADEON_VERT_PANEL_SIZE); + save->fp_vert_stretch |= ((yres-1) << 12); + } else { + save->fp_vert_stretch = (((((unsigned long)(Vratio * RADEON_VERT_STRETCH_RATIO_MAX + - 0.5)) & RADEON_VERT_STRETCH_RATIO_MASK)) | - (orig->fp_vert_stretch & (RADEON_VERT_PANEL_SIZE | - RADEON_VERT_STRETCH_RESERVED))); - save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE | - RADEON_VERT_STRETCH_BLEND); + 0.5)) & RADEON_VERT_STRETCH_RATIO_MASK)) | + (orig->fp_vert_stretch & (RADEON_VERT_PANEL_SIZE | + RADEON_VERT_STRETCH_RESERVED))); + save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE | + RADEON_VERT_STRETCH_BLEND); + + save->fp_vert_stretch &= ~(RADEON_VERT_AUTO_RATIO_EN | + RADEON_VERT_PANEL_SIZE); + save->fp_vert_stretch |= ((info->PanelYRes-1) << 12); + } - save->fp_vert_stretch &= ~RADEON_VERT_AUTO_RATIO_EN; save->fp_gen_cntl = (orig->fp_gen_cntl & (CARD32) - ~(RADEON_FP_SEL_CRTC2 | - RADEON_FP_RMX_HVSYNC_CONTROL_EN | - RADEON_FP_DFP_SYNC_SEL | - RADEON_FP_CRT_SYNC_SEL | - RADEON_FP_CRTC_LOCK_8DOT | - RADEON_FP_USE_SHADOW_EN | - RADEON_FP_CRTC_USE_SHADOW_VEND | - RADEON_FP_CRT_SYNC_ALT)); - save->fp_gen_cntl |= (RADEON_FP_CRTC_DONT_SHADOW_VPAR | - RADEON_FP_CRTC_DONT_SHADOW_HEND ); - - save->lvds_gen_cntl = orig->lvds_gen_cntl; - save->lvds_pll_cntl = orig->lvds_pll_cntl; - save->tmds_crc = orig->tmds_crc; + ~(RADEON_FP_SEL_CRTC2 | + RADEON_FP_RMX_HVSYNC_CONTROL_EN | + RADEON_FP_DFP_SYNC_SEL | + RADEON_FP_CRT_SYNC_SEL | + RADEON_FP_CRTC_LOCK_8DOT | + RADEON_FP_USE_SHADOW_EN | + RADEON_FP_CRTC_USE_SHADOW_VEND | + RADEON_FP_CRT_SYNC_ALT)); + save->fp_gen_cntl |= (RADEON_FP_CRTC_DONT_SHADOW_VPAR | + RADEON_FP_CRTC_DONT_SHADOW_HEND ); - /* Disable CRT output by disabling CRT output for DFP*/ - save->crtc_ext_cntl &= ~RADEON_CRTC_CRT_ON; + if (pScrn->rgbBits == 8) + save->fp_gen_cntl |= RADEON_FP_PANEL_FORMAT; /* 24 bit format */ + else + save->fp_gen_cntl &= ~RADEON_FP_PANEL_FORMAT;/* 18 bit format */ - if(info->DisplayType == MT_LCD) - { - save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON); - save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); + save->lvds_gen_cntl = orig->lvds_gen_cntl; + save->lvds_pll_cntl = orig->lvds_pll_cntl; + + /* This is needed for some panel at high resolution (>=1600x1200) + */ + if ((save->dot_clock_freq > 15000) && + (info->ChipFamily != CHIP_FAMILY_R300)) + save->tmds_pll_cntl = 0xA3F; + else + save->tmds_pll_cntl = orig->tmds_pll_cntl; + + info->PanelOff = FALSE; + /* This option is used to force the ONLY DEVICE in XFConfig to use + * CRT port, instead of default DVI port. + */ + if (xf86ReturnOptValBool(info->Options, OPTION_PANEL_OFF, FALSE)) { + info->PanelOff = TRUE; } - else if(info->DisplayType == MT_DFP) - save->fp_gen_cntl |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN); + + if (info->PanelOff && info->Clone) { + info->OverlayOnCRTC2 = TRUE; + if (info->DisplayType == MT_LCD) { + /* Turning off LVDS_ON seems to make panel white blooming. + * For now we just turn off display data ??? + */ + save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_DISPLAY_DIS); + save->lvds_gen_cntl &= ~(RADEON_LVDS_BLON); - save->fp_crtc_h_total_disp = orig->fp_crtc_h_total_disp; - save->fp_crtc_v_total_disp = orig->fp_crtc_v_total_disp; - save->fp_h_sync_strt_wid = orig->fp_h_sync_strt_wid; - save->fp_v_sync_strt_wid = orig->fp_v_sync_strt_wid; + } else if (info->DisplayType == MT_DFP) + save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); + } else { + if (info->DisplayType == MT_LCD) { + save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON); + save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); + } else if (info->DisplayType == MT_DFP) + save->fp_gen_cntl |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN); + } + save->fp_crtc_h_total_disp = save->crtc_h_total_disp; + save->fp_crtc_v_total_disp = save->crtc_v_total_disp; + save->fp_h_sync_strt_wid = save->crtc_h_sync_strt_wid; + save->fp_v_sync_strt_wid = save->crtc_v_sync_strt_wid; } -/* Define PLL registers for requested video mode. */ +/* Define PLL registers for requested video mode */ static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONPLLPtr pll, double dot_clock) { - unsigned long freq = dot_clock * 100; + unsigned long freq = dot_clock * 100; + struct { int divider; int bitvalue; - } *post_div, - post_divs[] = { + } *post_div, post_divs[] = { /* From RAGE 128 VR/RAGE 128 GL Register - Reference Manual (Technical Reference - Manual P/N RRG-G04100-C Rev. 0.04), page - 3-17 (PLL_DIV_[3:0]). */ + * Reference Manual (Technical Reference + * Manual P/N RRG-G04100-C Rev. 0.04), page + * 3-17 (PLL_DIV_[3:0]). + */ { 1, 0 }, /* VCLK_SRC */ { 2, 1 }, /* VCLK_SRC/2 */ { 4, 2 }, /* VCLK_SRC/4 */ @@ -4047,26 +5369,26 @@ save->htotal_cntl = 0; } -/* Define PLL2 registers for requested video mode. */ +/* Define PLL2 registers for requested video mode */ static void RADEONInitPLL2Registers(RADEONSavePtr save, RADEONPLLPtr pll, - double dot_clock) + double dot_clock) { - unsigned long freq = dot_clock * 100; + unsigned long freq = dot_clock * 100; + struct { int divider; int bitvalue; - } *post_div, - post_divs[] = { + } *post_div, post_divs[] = { /* From RAGE 128 VR/RAGE 128 GL Register - Reference Manual (Technical Reference - Manual P/N RRG-G04100-C Rev. 0.04), page - 3-17 (PLL_DIV_[3:0]). */ + * Reference Manual (Technical Reference + * Manual P/N RRG-G04100-C Rev. 0.04), page + * 3-17 (PLL_DIV_[3:0]). + */ { 1, 0 }, /* VCLK_SRC */ { 2, 1 }, /* VCLK_SRC/2 */ { 4, 2 }, /* VCLK_SRC/4 */ { 8, 3 }, /* VCLK_SRC/8 */ { 3, 4 }, /* VCLK_SRC/3 */ - { 16, 5 }, /* VCLK_SRC/16 */ { 6, 6 }, /* VCLK_SRC/6 */ { 12, 7 }, /* VCLK_SRC/12 */ { 0, 0 } @@ -4083,8 +5405,8 @@ save->dot_clock_freq_2 = freq; save->feedback_div_2 = RADEONDiv(pll->reference_div - * save->pll_output_freq_2, - pll->reference_freq); + * save->pll_output_freq_2, + pll->reference_freq); save->post_div_2 = post_div->divider; RADEONTRACE(("dc=%d, of=%d, fd=%d, pd=%d\n", @@ -4092,93 +5414,29 @@ save->pll_output_freq_2, save->feedback_div_2, save->post_div_2)); - - save->p2pll_ref_div = pll->reference_div; - save->p2pll_div_0 = (save->feedback_div_2 | (post_div->bitvalue<<16)); - save->htotal_cntl2 = 0; -} - -/* Define DDA registers for requested video mode. */ -static Bool RADEONInitDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, - RADEONPLLPtr pll, RADEONInfoPtr info) -{ - int DisplayFifoWidth = 128; - int DisplayFifoDepth = 32; - int XclkFreq; - int VclkFreq; - int XclksPerTransfer; - int XclksPerTransferPrecise; - int UseablePrecision; - int Roff; - int Ron; - - XclkFreq = pll->xclk; - - VclkFreq = RADEONDiv(pll->reference_freq * save->feedback_div, - pll->reference_div * save->post_div); - - XclksPerTransfer = RADEONDiv(XclkFreq * DisplayFifoWidth, - VclkFreq * - (info->CurrentLayout.pixel_bytes * 8)); - - UseablePrecision = RADEONMinBits(XclksPerTransfer) + 1; - - XclksPerTransferPrecise = RADEONDiv((XclkFreq * DisplayFifoWidth) - << (11 - UseablePrecision), - VclkFreq * - (info->CurrentLayout.pixel_bytes * 8)); - - Roff = XclksPerTransferPrecise * (DisplayFifoDepth - 4); - - Ron = (4 * info->ram->MB - + 3 * MAX(info->ram->Trcd - 2, 0) - + 2 * info->ram->Trp - + info->ram->Twr - + info->ram->CL - + info->ram->Tr2w - + XclksPerTransfer) << (11 - UseablePrecision); - - if (Ron + info->ram->Rloop >= Roff) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "(Ron = %d) + (Rloop = %d) >= (Roff = %d)\n", - Ron, info->ram->Rloop, Roff); - return FALSE; - } - - save->dda_config = (XclksPerTransferPrecise - | (UseablePrecision << 16) - | (info->ram->Rloop << 20)); - - save->dda_on_off = (Ron << 16) | Roff; - - RADEONTRACE(("XclkFreq = %d; VclkFreq = %d; per = %d, %d (useable = %d)\n", - XclkFreq, - VclkFreq, - XclksPerTransfer, - XclksPerTransferPrecise, - UseablePrecision)); - RADEONTRACE(("Roff = %d, Ron = %d, Rloop = %d\n", - Roff, Ron, info->ram->Rloop)); - return TRUE; + save->p2pll_ref_div = pll->reference_div; + save->p2pll_div_0 = (save->feedback_div_2 | + (post_div->bitvalue << 16)); + save->htotal_cntl2 = 0; } - +#if 0 /* Define initial palette for requested video mode. This doesn't do - anything for XFree86 4.0. */ -/* + * anything for XFree86 4.0. + */ static void RADEONInitPalette(RADEONSavePtr save) { save->palette_valid = FALSE; } -*/ +#endif -/* Define registers for a requested video mode. */ +/* Define registers for a requested video mode */ static Bool RADEONInit(ScrnInfoPtr pScrn, DisplayModePtr mode, RADEONSavePtr save) { - RADEONInfoPtr info = RADEONPTR(pScrn); - double dot_clock = mode->Clock/1000.0; + RADEONInfoPtr info = RADEONPTR(pScrn); + double dot_clock = mode->Clock/1000.0; #if RADEON_DEBUG ErrorF("%-12.12s %7.2f %4d %4d %4d %4d %4d %4d %4d %4d (%d,%d)", @@ -4197,6 +5455,7 @@ pScrn->depth, pScrn->bitsPerPixel); if (mode->Flags & V_DBLSCAN) ErrorF(" D"); + if (mode->Flags & V_CSYNC) ErrorF(" C"); if (mode->Flags & V_INTERLACE) ErrorF(" I"); if (mode->Flags & V_PHSYNC) ErrorF(" +H"); if (mode->Flags & V_NHSYNC) ErrorF(" -H"); @@ -4219,6 +5478,7 @@ pScrn->depth, pScrn->bitsPerPixel); if (mode->Flags & V_DBLSCAN) ErrorF(" D"); + if (mode->Flags & V_CSYNC) ErrorF(" C"); if (mode->Flags & V_INTERLACE) ErrorF(" I"); if (mode->Flags & V_PHSYNC) ErrorF(" +H"); if (mode->Flags & V_NHSYNC) ErrorF(" -H"); @@ -4229,55 +5489,47 @@ info->Flags = mode->Flags; - if(info->IsSecondary) - { - if (!RADEONInitCrtc2Registers(pScrn, save, - pScrn->currentMode,info)) - return FALSE; - RADEONInitPLL2Registers(save, &info->pll, dot_clock); - } - else - { - RADEONInitCommonRegisters(save, info); - if(!RADEONInitCrtcRegisters(pScrn, save, mode, info)) - return FALSE; - if(dot_clock) - { - RADEONInitPLLRegisters(save, &info->pll, dot_clock); - if (!RADEONInitDDARegisters(pScrn, save, &info->pll, info)) - return FALSE; - } - else - { - save->ppll_ref_div = info->SavedReg.ppll_ref_div; - save->ppll_div_3 = info->SavedReg.ppll_div_3; - save->htotal_cntl = info->SavedReg.htotal_cntl; - save->dda_config = info->SavedReg.dda_config; - save->dda_on_off = info->SavedReg.dda_on_off; - - } - /* not used for now */ - /*if (!info->PaletteSavedOnVT) RADEONInitPalette(save);*/ - } + if (info->IsSecondary) { + if (!RADEONInitCrtc2Registers(pScrn, save, mode, info)) + return FALSE; + RADEONInitPLL2Registers(save, &info->pll, dot_clock); + } else { + RADEONInitCommonRegisters(save, info); + if (!RADEONInitCrtcRegisters(pScrn, save, mode, info)) + return FALSE; + dot_clock = mode->Clock/1000.0; + if (dot_clock) { + RADEONInitPLLRegisters(save, &info->pll, dot_clock); + } else { + save->ppll_ref_div = info->SavedReg.ppll_ref_div; + save->ppll_div_3 = info->SavedReg.ppll_div_3; + save->htotal_cntl = info->SavedReg.htotal_cntl; + } + if (info->Clone && info->CurCloneMode) { + RADEONInitCrtc2Registers(pScrn, save, info->CurCloneMode, info); + dot_clock = info->CurCloneMode->Clock / 1000.0; + RADEONInitPLL2Registers(save, &info->pll, dot_clock); + } + /* Not used for now: */ + /* if (!info->PaletteSavedOnVT) RADEONInitPalette(save); */ + } - if (((info->DisplayType == MT_DFP) || - (info->DisplayType == MT_LCD))) - { - RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info); + if (((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD))) { + RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info); } RADEONTRACE(("RADEONInit returns %p\n", save)); return TRUE; } -/* Initialize a new mode. */ +/* Initialize a new mode */ static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE; - /* FIXME? DRILock/DRIUnlock here? */ pScrn->vtSema = TRUE; RADEONBlank(pScrn); @@ -4290,97 +5542,133 @@ static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - Bool unblank; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + Bool unblank; unblank = xf86IsUnblank(mode); - if (unblank) - SetTimeSinceLastInputEvent(); + if (unblank) SetTimeSinceLastInputEvent(); if ((pScrn != NULL) && pScrn->vtSema) { - if (unblank) - RADEONUnblank(pScrn); - else - RADEONBlank(pScrn); + if (unblank) RADEONUnblank(pScrn); + else RADEONBlank(pScrn); } return TRUE; } Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + Bool ret; +#ifdef XF86DRI + Bool CPStarted = info->CPStarted; + + if (CPStarted) { + DRILock(pScrn->pScreen, 0); + RADEONCP_STOP(pScrn, info); + } +#endif + + if (info->accelOn) info->accel->Sync(pScrn); + + if (info->FBDev) { + RADEONSaveFBDevRegisters(pScrn, &info->ModeReg); + + ret = fbdevHWSwitchMode(scrnIndex, mode, flags); + + RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg); + } else { + info->IsSwitching = TRUE; + if (info->Clone && info->CloneModes) { + DisplayModePtr clone_mode = info->CloneModes; + + /* Try to match a mode on primary head + * FIXME: This may not be good if both heads don't have + * exactly the same list of mode. + */ + while (1) { + if ((clone_mode->HDisplay == mode->HDisplay) && + (clone_mode->VDisplay == mode->VDisplay) && + (!info->PanelOff)) { + info->CloneFrameX0 = (info->CurCloneMode->HDisplay + + info->CloneFrameX0 - + clone_mode->HDisplay - 1) / 2; + info->CloneFrameY0 = + (info->CurCloneMode->VDisplay + info->CloneFrameY0 - + clone_mode->VDisplay - 1) / 2; + info->CurCloneMode = clone_mode; + break; + } + + if (!clone_mode->next) { + info->CurCloneMode = info->CloneModes; + break; + } + + clone_mode = clone_mode->next; + } + } + ret = RADEONModeInit(xf86Screens[scrnIndex], mode); + + if (info->CurCloneMode) { + if (info->CloneFrameX0 + info->CurCloneMode->HDisplay >= + pScrn->virtualX) + info->CloneFrameX0 = + pScrn->virtualX - info->CurCloneMode->HDisplay; + else if (info->CloneFrameX0 < 0) + info->CloneFrameX0 = 0; + + if (info->CloneFrameY0 + info->CurCloneMode->VDisplay >= + pScrn->virtualY) + info->CloneFrameY0 = + pScrn->virtualY - info->CurCloneMode->VDisplay; + else if (info->CloneFrameY0 < 0) + info->CloneFrameY0 = 0; - /* when switch mode in dual-head setup, this function will be called - separately for each screen (depending on which screen the cursor is - in when user press ctrl-alt-+). Since this function is always - called when screen already in extensive mode, the sequence of - setting CRTC2 and CRT_EXT regesters doesn't matter any more, - So we set the flag for RADEONRestoreMode here. */ - info->SwitchingMode = TRUE; - return RADEONModeInit(xf86Screens[scrnIndex], mode); - info->SwitchingMode = FALSE; + RADEONDoAdjustFrame(pScrn, info->CloneFrameX0, info->CloneFrameY0, + TRUE); + } + + info->IsSwitching = FALSE; + } + + if (info->accelOn) { + info->accel->Sync(pScrn); + RADEONEngineRestore(pScrn); + } + +#ifdef XF86DRI + if (CPStarted) { + RADEONCP_START(pScrn, info); + DRIUnlock(pScrn->pScreen); + } +#endif + + return ret; } -/* Used to disallow modes that are not supported by the hardware. */ +/* Used to disallow modes that are not supported by the hardware */ int RADEONValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flag) { - /* Searching for native mode timing table embedded in BIOS image. - Not working yet. Currently we calculate from FP registers*/ - /****** - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - if (info->DisplayType == MT_LCD && info->VBIOS) - { - int i; - for (i = info->FPBIOSstart+0x40; RADEON_BIOS16(i) != 0; i += 2) { - int j = RADEON_BIOS16(i); - - if (mode->CrtcHDisplay == RADEON_BIOS16(j) && - mode->CrtcVDisplay == RADEON_BIOS16(j+2)) { - if (RADEON_BIOS16(j+5)) j = RADEON_BIOS16(j+5); - else j += 9; - - mode->Clock = (CARD32)RADEON_BIOS16(j) * 10; - - mode->HDisplay = mode->CrtcHDisplay = - ((RADEON_BIOS16(j+10) & 0x01ff)+1)*8; - mode->HSyncStart = mode->CrtcHSyncStart = - ((RADEON_BIOS16(j+12) & 0x01ff)+1)*8; - mode->HSyncEnd = mode->CrtcHSyncEnd = - mode->CrtcHSyncStart + (RADEON_BIOS8(j+14) & 0x1f); - mode->HTotal = mode->CrtcHTotal = - ((RADEON_BIOS16(j+8) & 0x01ff)+1)*8; - - mode->VDisplay = mode->CrtcVDisplay = - (RADEON_BIOS16(j+17) & 0x07ff)+1; - mode->VSyncStart = mode->CrtcVSyncStart = - (RADEON_BIOS16(j+19) & 0x07ff)+1; - mode->VSyncEnd = mode->CrtcVSyncEnd = - mode->CrtcVSyncStart + ((RADEON_BIOS16(j+19) >> 11)&0x1f); - mode->VTotal = mode->CrtcVTotal = - (RADEON_BIOS16(j+15) & 0x07ff)+1; - return MODE_OK; - } - } - return MODE_NOMODE; - }*****/ + * Not working yet. Currently we calculate from FP registers + */ return MODE_OK; } -/* Adjust viewport into virtual desktop such that (0,0) in viewport space - is (x,y) in virtual space. */ -void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) +/* Adjust viewport into virtual desktop such that (0,0) in viewport + * space is (x,y) in virtual space. + */ +void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int clone) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int Base; - - Base = y * info->CurrentLayout.displayWidth + x; + int reg, Base = y * info->CurrentLayout.displayWidth + x; +#ifdef XF86DRI + RADEONSAREAPrivPtr pSAREAPriv; +#endif switch (info->CurrentLayout.pixel_code) { case 15: @@ -4391,54 +5679,99 @@ Base &= ~7; /* 3 lower bits are always 0 */ - if(info->IsSecondary) - { - Base += pScrn->fbOffset; - OUTREG(RADEON_CRTC2_OFFSET, Base); + if (clone || info->IsSecondary) { + Base += pScrn->fbOffset; + reg = RADEON_CRTC2_OFFSET; + } else { + reg = RADEON_CRTC_OFFSET; } - else - OUTREG(RADEON_CRTC_OFFSET, Base); - + +#ifdef XF86DRI + if (info->directRenderingEnabled) { + + pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); + + if (pSAREAPriv->pfCurrentPage == 1) { + Base += info->backOffset; + } + + if (clone || info->IsSecondary) { + pSAREAPriv->crtc2_base = Base; + } + } +#endif + + OUTREG(reg, Base); +} + +void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + +#ifdef XF86DRI + if (info->CPStarted) DRILock(pScrn->pScreen, 0); +#endif + + if (info->accelOn) info->accel->Sync(pScrn); + + if (info->FBDev) { + fbdevHWAdjustFrame(scrnIndex, x, y, flags); + } else { + RADEONDoAdjustFrame(pScrn, x, y, FALSE); + } + +#ifdef XF86DRI + if (info->CPStarted) DRIUnlock(pScrn->pScreen); +#endif } -/* Called when VT switching back to the X server. Reinitialize the video - mode. */ +/* Called when VT switching back to the X server. Reinitialize the + * video mode. + */ Bool RADEONEnterVT(int scrnIndex, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); RADEONTRACE(("RADEONEnterVT\n")); if (info->FBDev) { unsigned char *RADEONMMIO = info->MMIO; - if (!fbdevHWEnterVT(scrnIndex,flags)) return FALSE; - info->PaletteSavedOnVT = FALSE; - info->ModeReg.surface_cntl = INREG(RADEON_SURFACE_CNTL); + if (!fbdevHWEnterVT(scrnIndex,flags)) return FALSE; + info->PaletteSavedOnVT = FALSE; + info->ModeReg.surface_cntl = INREG(RADEON_SURFACE_CNTL); + + RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg); } else - if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; + if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; if (info->accelOn) RADEONEngineRestore(pScrn); #ifdef XF86DRI - if (RADEONPTR(pScrn)->directRenderingEnabled) { + if (info->directRenderingEnabled) { RADEONCP_START(pScrn, info); DRIUnlock(pScrn->pScreen); } #endif + + pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + if (info->CurCloneMode) { + RADEONDoAdjustFrame(pScrn, info->CloneFrameX0, info->CloneFrameY0, TRUE); + } - RADEONAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return TRUE; } -/* Called when VT switching away from the X server. Restore the original - text mode. */ +/* Called when VT switching away from the X server. Restore the + * original text mode. + */ void RADEONLeaveVT(int scrnIndex, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONSavePtr save = &info->ModeReg; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONSavePtr save = &info->ModeReg; RADEONTRACE(("RADEONLeaveVT\n")); #ifdef XF86DRI @@ -4449,20 +5782,25 @@ #endif if (info->FBDev) { - RADEONSavePalette(pScrn, save); - info->PaletteSavedOnVT = TRUE; - fbdevHWLeaveVT(scrnIndex,flags); - } else - RADEONRestore(pScrn); + RADEONSavePalette(pScrn, save); + info->PaletteSavedOnVT = TRUE; + + RADEONSaveFBDevRegisters(pScrn, &info->ModeReg); + + fbdevHWLeaveVT(scrnIndex,flags); + } + + RADEONRestore(pScrn); } -/* Called at the end of each server generation. Restore the original text - mode, unmap video memory, and unwrap and call the saved CloseScreen - function. */ +/* Called at the end of each server generation. Restore the original + * text mode, unmap video memory, and unwrap and call the saved + * CloseScreen function. + */ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); RADEONTRACE(("RADEONCloseScreen\n")); @@ -4474,24 +5812,27 @@ } #endif - if (pScrn->vtSema) - { + if (pScrn->vtSema) { RADEONRestore(pScrn); RADEONUnmapMem(pScrn); } - if (info->accel) XAADestroyInfoRec(info->accel); - info->accel = NULL; + if (info->accel) XAADestroyInfoRec(info->accel); + info->accel = NULL; - if (info->scratch_save) xfree(info->scratch_save); - info->scratch_save = NULL; + if (info->scratch_save) xfree(info->scratch_save); + info->scratch_save = NULL; - if (info->cursor) xf86DestroyCursorInfoRec(info->cursor); - info->cursor = NULL; + if (info->cursor) xf86DestroyCursorInfoRec(info->cursor); + info->cursor = NULL; - if (info->DGAModes) xfree(info->DGAModes); - info->DGAModes = NULL; + if (info->DGAModes) xfree(info->DGAModes); + info->DGAModes = NULL; + if (info->CloneModes) + while (info->CloneModes) + xf86DeleteMode(&info->CloneModes, info->CloneModes); + pScrn->vtSema = FALSE; xf86ClearPrimInitDone(pScrn->entityList[0]); @@ -4503,7 +5844,7 @@ void RADEONFreeScreen(int scrnIndex, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONTRACE(("RADEONFreeScreen\n")); @@ -4512,34 +5853,92 @@ RADEONFreeRec(pScrn); } -/* Sets VESA Display Power Management Signaling (DPMS) Mode. */ +/* Sets VESA Display Power Management Signaling (DPMS) Mode */ static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, int flags) + int PowerManagementMode, + int flags) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int mask = (RADEON_CRTC_DISPLAY_DIS - | RADEON_CRTC_HSYNC_DIS - | RADEON_CRTC_VSYNC_DIS); - - switch (PowerManagementMode) { - case DPMSModeOn: - /* Screen: On; HSync: On, VSync: On */ - OUTREGP(RADEON_CRTC_EXT_CNTL, 0, ~mask); - break; - case DPMSModeStandby: - /* Screen: Off; HSync: Off, VSync: On */ - OUTREGP(RADEON_CRTC_EXT_CNTL, - RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS, ~mask); - break; - case DPMSModeSuspend: - /* Screen: Off; HSync: On, VSync: Off */ - OUTREGP(RADEON_CRTC_EXT_CNTL, - RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS, ~mask); - break; - case DPMSModeOff: - /* Screen: Off; HSync: Off, VSync: Off */ - OUTREGP(RADEON_CRTC_EXT_CNTL, mask, ~mask); - break; + +#ifdef XF86DRI + if (info->CPStarted) DRILock(pScrn->pScreen, 0); +#endif + + if (info->accelOn) info->accel->Sync(pScrn); + + if (info->FBDev) { + fbdevHWDPMSSet(pScrn, PowerManagementMode, flags); + } else { + int mask1 = (RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_HSYNC_DIS | + RADEON_CRTC_VSYNC_DIS); + int mask2 = (RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS); + + /* TODO: additional handling for LCD ? */ + + switch (PowerManagementMode) { + case DPMSModeOn: + /* Screen: On; HSync: On, VSync: On */ + if (info->IsSecondary) + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2); + else { + if (info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2); + OUTREGP(RADEON_CRTC_EXT_CNTL, 0, ~mask1); + } + break; + + case DPMSModeStandby: + /* Screen: Off; HSync: Off, VSync: On */ + if (info->IsSecondary) + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS, + ~mask2); + else { + if (info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS, + ~mask2); + OUTREGP(RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS, + ~mask1); + } + break; + + case DPMSModeSuspend: + /* Screen: Off; HSync: On, VSync: Off */ + if (info->IsSecondary) + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS, + ~mask2); + else { + if (info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS, + ~mask2); + OUTREGP(RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS, + ~mask1); + } + break; + + case DPMSModeOff: + /* Screen: Off; HSync: Off, VSync: Off */ + if (info->IsSecondary) + OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2); + else { + if (info->Clone) + OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2); + OUTREGP(RADEON_CRTC_EXT_CNTL, mask1, ~mask1); + } + break; + } } + +#ifdef XF86DRI + if (info->CPStarted) DRIUnlock(pScrn->pScreen); +#endif } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_macros.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_macros.h:1.1 --- /dev/null Thu Feb 27 12:30:39 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_macros.h Mon Dec 16 11:19:14 2002 @@ -0,0 +1,134 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_macros.h,v 1.1 2002/12/16 16:19:14 dawes Exp $ */ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and + * VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin <martin@xfree86.org> + * Rickard E. Faith <faith@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> + * + * References: + * + * !!!! FIXME !!!! + * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical + * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April + * 1999. + * + * !!!! FIXME !!!! + * RAGE 128 Software Development Manual (Technical Reference Manual P/N + * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999. + * + */ + + +#ifndef _RADEON_MACROS_H_ +#define _RADEON_MACROS_H_ + +#ifdef XFree86Module +#include "xf86_ansic.h" +#endif +#include "compiler.h" + + /* Memory mapped register access macros */ +#define INREG8(addr) MMIO_IN8(RADEONMMIO, addr) +#define INREG16(addr) MMIO_IN16(RADEONMMIO, addr) +#define INREG(addr) MMIO_IN32(RADEONMMIO, addr) +#define OUTREG8(addr, val) MMIO_OUT8(RADEONMMIO, addr, val) +#define OUTREG16(addr, val) MMIO_OUT16(RADEONMMIO, addr, val) +#define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val) + +#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(RADEONMMIO + (addr))) + + +#define OUTREGP(addr, val, mask) \ +do { \ + CARD32 tmp = INREG(addr); \ + tmp &= (mask); \ + tmp |= (val); \ + OUTREG(addr, tmp); \ +} while (0) + +#define INPLL(pScrn, addr) RADEONINPLL(pScrn, addr) + +#define OUTPLL(addr, val) \ +do { \ + OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ + RADEON_PLL_WR_EN)); \ + OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ +} while (0) + +#define OUTPLLP(pScrn, addr, val, mask) \ +do { \ + CARD32 tmp = INPLL(pScrn, addr); \ + tmp &= (mask); \ + tmp |= (val); \ + OUTPLL(addr, tmp); \ +} while (0) + +#define OUTPAL_START(idx) \ +do { \ + OUTREG8(RADEON_PALETTE_INDEX, (idx)); \ +} while (0) + +#define OUTPAL_NEXT(r, g, b) \ +do { \ + OUTREG(RADEON_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \ +} while (0) + +#define OUTPAL_NEXT_CARD32(v) \ +do { \ + OUTREG(RADEON_PALETTE_DATA, (v & 0x00ffffff)); \ +} while (0) + +#define OUTPAL(idx, r, g, b) \ +do { \ + OUTPAL_START((idx)); \ + OUTPAL_NEXT((r), (g), (b)); \ +} while (0) + +#define INPAL_START(idx) \ +do { \ + OUTREG(RADEON_PALETTE_INDEX, (idx) << 16); \ +} while (0) + +#define INPAL_NEXT() INREG(RADEON_PALETTE_DATA) + +#define PAL_SELECT(idx) \ +do { \ + if (!idx) { \ + OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) & \ + (CARD32)~RADEON_DAC2_PALETTE_ACC_CTL); \ + } else { \ + OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) | \ + RADEON_DAC2_PALETTE_ACC_CTL); \ + } \ +} while (0) + + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.4 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.4 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.7 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -25,6 +25,7 @@ #include "ativersion.h" +#include "radeon_probe.h" #include "radeon_version.h" #include "xf86.h" @@ -61,11 +62,12 @@ { static Bool Inited = FALSE; - if (!Inited) - { + if (!Inited) { /* Ensure main driver module is loaded, but not as a submodule */ if (!xf86ServerIsOnlyDetecting() && !LoaderSymbol(ATI_NAME)) xf86LoadOneModule(ATI_DRIVER_NAME, Options); + + RADEONLoaderRefSymLists(); Inited = TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.15 Tue Jan 15 21:00:44 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c Fri Feb 7 15:41:15 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.15 2002/01/16 02:00:44 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.24 2003/02/07 20:41:15 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> * * Modified by Marc Aurele La France <tsi@xfree86.org> for ATI driver merge. @@ -53,14 +53,14 @@ * The following exists to prevent the compiler from considering entry points * defined in a separate module from being constants. */ -static xf86PreInitProc * const volatile PreInitProc = RADEONPreInit; -static xf86ScreenInitProc * const volatile ScreenInitProc = RADEONScreenInit; -static xf86SwitchModeProc * const volatile SwitchModeProc = RADEONSwitchMode; -static xf86AdjustFrameProc * const volatile AdjustFrameProc = RADEONAdjustFrame; -static xf86EnterVTProc * const volatile EnterVTProc = RADEONEnterVT; -static xf86LeaveVTProc * const volatile LeaveVTProc = RADEONLeaveVT; -static xf86FreeScreenProc * const volatile FreeScreenProc = RADEONFreeScreen; -static xf86ValidModeProc * const volatile ValidModeProc = RADEONValidMode; +static xf86PreInitProc *const volatile PreInitProc = RADEONPreInit; +static xf86ScreenInitProc *const volatile ScreenInitProc = RADEONScreenInit; +static xf86SwitchModeProc *const volatile SwitchModeProc = RADEONSwitchMode; +static xf86AdjustFrameProc *const volatile AdjustFrameProc = RADEONAdjustFrame; +static xf86EnterVTProc *const volatile EnterVTProc = RADEONEnterVT; +static xf86LeaveVTProc *const volatile LeaveVTProc = RADEONLeaveVT; +static xf86FreeScreenProc *const volatile FreeScreenProc = RADEONFreeScreen; +static xf86ValidModeProc *const volatile ValidModeProc = RADEONValidMode; #define RADEONPreInit PreInitProc #define RADEONScreenInit ScreenInitProc @@ -78,17 +78,44 @@ { PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" }, { PCI_CHIP_RADEON_QF, "ATI Radeon QF (AGP)" }, { PCI_CHIP_RADEON_QG, "ATI Radeon QG (AGP)" }, - { PCI_CHIP_RADEON_QY, "ATI Radeon VE QY (AGP)" }, - { PCI_CHIP_RADEON_QZ, "ATI Radeon VE QZ (AGP)" }, - { PCI_CHIP_RADEON_LW, "ATI Radeon Mobility LW (AGP)" }, - { PCI_CHIP_RADEON_LY, "ATI Radeon Mobility LY (AGP)" }, - { PCI_CHIP_RADEON_LZ, "ATI Radeon Mobility LZ (AGP)" }, + { PCI_CHIP_RV100_QY, "ATI Radeon VE/7000 QY (AGP)" }, + { PCI_CHIP_RV100_QZ, "ATI Radeon VE/7000 QZ (AGP)" }, + { PCI_CHIP_RADEON_LW, "ATI Radeon Mobility M7 LW (AGP)" }, + { PCI_CHIP_RADEON_LX, "ATI Mobility FireGL 7800 M7 LX (AGP)" }, + { PCI_CHIP_RADEON_LY, "ATI Radeon Mobility M6 LY (AGP)" }, + { PCI_CHIP_RADEON_LZ, "ATI Radeon Mobility M6 LZ (AGP)" }, + { PCI_CHIP_R200_QH, "ATI FireGL 8700/8800 QH (AGP)" }, + { PCI_CHIP_R200_QI, "ATI Radeon 8500 QI (AGP)" }, + { PCI_CHIP_R200_QJ, "ATI Radeon 8500 QJ (AGP)" }, + { PCI_CHIP_R200_QK, "ATI Radeon 8500 QK (AGP)" }, { PCI_CHIP_R200_QL, "ATI Radeon 8500 QL (AGP)" }, + { PCI_CHIP_R200_QM, "ATI Radeon 9100 QM (AGP)" }, { PCI_CHIP_R200_QN, "ATI Radeon 8500 QN (AGP)" }, { PCI_CHIP_R200_QO, "ATI Radeon 8500 QO (AGP)" }, + { PCI_CHIP_R200_Qh, "ATI Radeon 8500 Qh (AGP)" }, + { PCI_CHIP_R200_Qi, "ATI Radeon 8500 Qi (AGP)" }, + { PCI_CHIP_R200_Qj, "ATI Radeon 8500 Qj (AGP)" }, + { PCI_CHIP_R200_Qk, "ATI Radeon 8500 Qk (AGP)" }, { PCI_CHIP_R200_Ql, "ATI Radeon 8500 Ql (AGP)" }, { PCI_CHIP_R200_BB, "ATI Radeon 8500 BB (AGP)" }, { PCI_CHIP_RV200_QW, "ATI Radeon 7500 QW (AGP)" }, + { PCI_CHIP_RV200_QX, "ATI Radeon 7500 QX (AGP)" }, + { PCI_CHIP_RV250_Id, "ATI Radeon 9000 Id (AGP)" }, + { PCI_CHIP_RV250_Ie, "ATI Radeon 9000 Ie (AGP)" }, + { PCI_CHIP_RV250_If, "ATI Radeon 9000 If (AGP)" }, + { PCI_CHIP_RV250_Ig, "ATI Radeon 9000 Ig (AGP)" }, + { PCI_CHIP_RV250_Ld, "ATI Radeon Mobility M9 Ld (AGP)" }, + { PCI_CHIP_RV250_Le, "ATI Radeon Mobility M9 Le (AGP)" }, + { PCI_CHIP_RV250_Lf, "ATI Radeon Mobility M9 Lf (AGP)" }, + { PCI_CHIP_RV250_Lg, "ATI Radeon Mobility M9 Lg (AGP)" }, + { PCI_CHIP_R300_AD, "ATI Radeon 9500 AD (AGP)" }, + { PCI_CHIP_R300_AE, "ATI Radeon 9500 AE (AGP)" }, + { PCI_CHIP_R300_AF, "ATI Radeon 9500 AF (AGP)" }, + { PCI_CHIP_R300_AG, "ATI FireGL Z1/X1 AG (AGP)" }, + { PCI_CHIP_R300_ND, "ATI Radeon 9700 Pro ND (AGP)" }, + { PCI_CHIP_R300_NE, "ATI Radeon 9700/9500Pro NE (AGP)" }, + { PCI_CHIP_R300_NF, "ATI Radeon 9700 NF (AGP)" }, + { PCI_CHIP_R300_NG, "ATI FireGL X1 NG (AGP)" }, { -1, NULL } }; @@ -97,17 +124,44 @@ { PCI_CHIP_RADEON_QE, PCI_CHIP_RADEON_QE, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QF, PCI_CHIP_RADEON_QF, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QG, PCI_CHIP_RADEON_QG, RES_SHARED_VGA }, - { PCI_CHIP_RADEON_QY, PCI_CHIP_RADEON_QY, RES_SHARED_VGA }, - { PCI_CHIP_RADEON_QZ, PCI_CHIP_RADEON_QZ, RES_SHARED_VGA }, + { PCI_CHIP_RV100_QY, PCI_CHIP_RV100_QY, RES_SHARED_VGA }, + { PCI_CHIP_RV100_QZ, PCI_CHIP_RV100_QZ, RES_SHARED_VGA }, { PCI_CHIP_RADEON_LW, PCI_CHIP_RADEON_LW, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LX, PCI_CHIP_RADEON_LX, RES_SHARED_VGA }, { PCI_CHIP_RADEON_LY, PCI_CHIP_RADEON_LY, RES_SHARED_VGA }, { PCI_CHIP_RADEON_LZ, PCI_CHIP_RADEON_LZ, RES_SHARED_VGA }, + { PCI_CHIP_R200_QH, PCI_CHIP_R200_QH, RES_SHARED_VGA }, + { PCI_CHIP_R200_QI, PCI_CHIP_R200_QI, RES_SHARED_VGA }, + { PCI_CHIP_R200_QJ, PCI_CHIP_R200_QJ, RES_SHARED_VGA }, + { PCI_CHIP_R200_QK, PCI_CHIP_R200_QK, RES_SHARED_VGA }, { PCI_CHIP_R200_QL, PCI_CHIP_R200_QL, RES_SHARED_VGA }, + { PCI_CHIP_R200_QM, PCI_CHIP_R200_QM, RES_SHARED_VGA }, { PCI_CHIP_R200_QN, PCI_CHIP_R200_QN, RES_SHARED_VGA }, { PCI_CHIP_R200_QO, PCI_CHIP_R200_QO, RES_SHARED_VGA }, + { PCI_CHIP_R200_Qh, PCI_CHIP_R200_Qh, RES_SHARED_VGA }, + { PCI_CHIP_R200_Qi, PCI_CHIP_R200_Qi, RES_SHARED_VGA }, + { PCI_CHIP_R200_Qj, PCI_CHIP_R200_Qj, RES_SHARED_VGA }, + { PCI_CHIP_R200_Qk, PCI_CHIP_R200_Qk, RES_SHARED_VGA }, { PCI_CHIP_R200_Ql, PCI_CHIP_R200_Ql, RES_SHARED_VGA }, { PCI_CHIP_R200_BB, PCI_CHIP_R200_BB, RES_SHARED_VGA }, { PCI_CHIP_RV200_QW, PCI_CHIP_RV200_QW, RES_SHARED_VGA }, + { PCI_CHIP_RV200_QX, PCI_CHIP_RV200_QX, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Id, PCI_CHIP_RV250_Id, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Ie, PCI_CHIP_RV250_Ie, RES_SHARED_VGA }, + { PCI_CHIP_RV250_If, PCI_CHIP_RV250_If, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Ig, PCI_CHIP_RV250_Ig, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Ld, PCI_CHIP_RV250_Ld, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Le, PCI_CHIP_RV250_Le, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Lf, PCI_CHIP_RV250_Lf, RES_SHARED_VGA }, + { PCI_CHIP_RV250_Lg, PCI_CHIP_RV250_Lg, RES_SHARED_VGA }, + { PCI_CHIP_R300_AD, PCI_CHIP_R300_AD, RES_SHARED_VGA }, + { PCI_CHIP_R300_AE, PCI_CHIP_R300_AE, RES_SHARED_VGA }, + { PCI_CHIP_R300_AF, PCI_CHIP_R300_AF, RES_SHARED_VGA }, + { PCI_CHIP_R300_AG, PCI_CHIP_R300_AG, RES_SHARED_VGA }, + { PCI_CHIP_R300_ND, PCI_CHIP_R300_ND, RES_SHARED_VGA }, + { PCI_CHIP_R300_NE, PCI_CHIP_R300_NE, RES_SHARED_VGA }, + { PCI_CHIP_R300_NF, PCI_CHIP_R300_NF, RES_SHARED_VGA }, + { PCI_CHIP_R300_NG, PCI_CHIP_R300_NG, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -117,7 +171,7 @@ const OptionInfoRec * RADEONAvailableOptions(int chipid, int busid) { - int i; + int i; /* * Return options defined in the radeon submodule which will have been @@ -145,28 +199,26 @@ Bool RADEONProbe(DriverPtr drv, int flags) { - int numUsed; - int numDevSections, nATIGDev, nRadeonGDev; - int *usedChips; - GDevPtr *devSections, *ATIGDevs, *RadeonGDevs; - Bool foundScreen = FALSE; - int i; + int numUsed; + int numDevSections, nATIGDev, nRadeonGDev; + int *usedChips; + GDevPtr *devSections, *ATIGDevs, *RadeonGDevs; + Bool foundScreen = FALSE; + int i; if (!xf86GetPciVideoInfo()) return FALSE; /* Collect unclaimed device sections for both driver names */ - nATIGDev = xf86MatchDevice(ATI_NAME, &ATIGDevs); + nATIGDev = xf86MatchDevice(ATI_NAME, &ATIGDevs); nRadeonGDev = xf86MatchDevice(RADEON_NAME, &RadeonGDevs); if (!(numDevSections = nATIGDev + nRadeonGDev)) return FALSE; if (!ATIGDevs) { - if (!(devSections = RadeonGDevs)) - numDevSections = 1; - else - numDevSections = nRadeonGDev; + if (!(devSections = RadeonGDevs)) numDevSections = 1; + else numDevSections = nRadeonGDev; } if (!RadeonGDevs) { - devSections = ATIGDevs; + devSections = ATIGDevs; numDevSections = nATIGDev; } else { /* Combine into one list */ @@ -189,88 +241,89 @@ drv, &usedChips); - if (numUsed<=0) return FALSE; + if (numUsed <= 0) return FALSE; - if (flags & PROBE_DETECT) foundScreen = TRUE; - else for (i = 0; i < numUsed; i++) - { - ScrnInfoPtr pScrn; - EntityInfoPtr pEnt; - - pScrn = NULL; - if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - RADEONPciChipsets, 0, 0, 0, 0, 0))) - { + if (flags & PROBE_DETECT) { + foundScreen = TRUE; + } else { + for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + EntityInfoPtr pEnt; + + if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + RADEONPciChipsets, 0, 0, 0, + 0, 0))) { #ifdef XFree86LOADER + if (!xf86LoadSubModule(pScrn, "radeon")) { + xf86Msg(X_ERROR, RADEON_NAME + ": Failed to load \"radeon\" module.\n"); + xf86DeleteScreen(pScrn->scrnIndex, 0); + continue; + } + + xf86LoaderReqSymLists(RADEONSymbols, NULL); +#endif - if (!xf86LoadSubModule(pScrn, "radeon")) { - xf86Msg(X_ERROR, - RADEON_NAME ": Failed to load \"radeon\" module.\n"); - xf86DeleteScreen(pScrn->scrnIndex, 0); - continue; + pScrn->driverVersion = RADEON_VERSION_CURRENT; + pScrn->driverName = RADEON_DRIVER_NAME; + pScrn->name = RADEON_NAME; + pScrn->Probe = RADEONProbe; + pScrn->PreInit = RADEONPreInit; + pScrn->ScreenInit = RADEONScreenInit; + pScrn->SwitchMode = RADEONSwitchMode; + pScrn->AdjustFrame = RADEONAdjustFrame; + pScrn->EnterVT = RADEONEnterVT; + pScrn->LeaveVT = RADEONLeaveVT; + pScrn->FreeScreen = RADEONFreeScreen; + pScrn->ValidMode = RADEONValidMode; + foundScreen = TRUE; } - xf86LoaderReqSymLists(RADEONSymbols, NULL); -#endif + pEnt = xf86GetEntityInfo(usedChips[i]); + + /* All Radeon chips except the original ones support + * Dual-Head, mark the entity as sharable. + */ + if (pEnt->chipset != PCI_CHIP_RADEON_QD && + pEnt->chipset != PCI_CHIP_RADEON_QE && + pEnt->chipset != PCI_CHIP_RADEON_QF && + pEnt->chipset != PCI_CHIP_RADEON_QG) { + static int instance = 0; + DevUnion *pPriv; + + xf86SetEntitySharable(usedChips[i]); + xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0], + instance); + + if (gRADEONEntityIndex < 0) { + gRADEONEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + + if (!pPriv->ptr) { + RADEONEntPtr pRADEONEnt; + + pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->IsDRIEnabled = FALSE; + pRADEONEnt->BypassSecondary = FALSE; + pRADEONEnt->HasSecondary = FALSE; + pRADEONEnt->IsSecondaryRestored = FALSE; + } + } + instance++; + if (instance == 2) { + RADEONEntPtr pRADEONEnt; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->HasSecondary = TRUE; + } - pScrn->driverVersion = RADEON_VERSION_CURRENT; - pScrn->driverName = RADEON_DRIVER_NAME; - pScrn->name = RADEON_NAME; - pScrn->Probe = RADEONProbe; - pScrn->PreInit = RADEONPreInit; - pScrn->ScreenInit = RADEONScreenInit; - pScrn->SwitchMode = RADEONSwitchMode; - pScrn->AdjustFrame = RADEONAdjustFrame; - pScrn->EnterVT = RADEONEnterVT; - pScrn->LeaveVT = RADEONLeaveVT; - pScrn->FreeScreen = RADEONFreeScreen; - pScrn->ValidMode = RADEONValidMode; - foundScreen = TRUE; - - } - - pEnt = xf86GetEntityInfo(usedChips[i]); - - /* VE/M6 card support Dual-Head, mark the entity as sharable*/ - if(pEnt->chipset == PCI_CHIP_RADEON_QY || - pEnt->chipset == PCI_CHIP_RADEON_QZ || - pEnt->chipset == PCI_CHIP_R200_QL || - pEnt->chipset == PCI_CHIP_R200_QN || - pEnt->chipset == PCI_CHIP_R200_QO || - pEnt->chipset == PCI_CHIP_R200_Ql || - pEnt->chipset == PCI_CHIP_R200_BB || - pEnt->chipset == PCI_CHIP_RV200_QW || - pEnt->chipset == PCI_CHIP_RADEON_LW || - pEnt->chipset == PCI_CHIP_RADEON_LY || - pEnt->chipset == PCI_CHIP_RADEON_LZ) - { - static int instance = 0; - DevUnion* pPriv; - - xf86SetEntitySharable(usedChips[i]); - xf86SetEntityInstanceForScreen(pScrn, - pScrn->entityList[0], instance); - - if(gRADEONEntityIndex < 0) - { - gRADEONEntityIndex = xf86AllocateEntityPrivateIndex(); - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], - gRADEONEntityIndex); - - if (!pPriv->ptr) - { - RADEONEntPtr pRADEONEnt; - pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); - pRADEONEnt = pPriv->ptr; - pRADEONEnt->IsDRIEnabled = FALSE; - pRADEONEnt->BypassSecondary = FALSE; - pRADEONEnt->HasSecondary = FALSE; - pRADEONEnt->IsSecondaryRestored = FALSE; - } - } - instance++; + } + xfree(pEnt); } - xfree(pEnt); } xfree(usedChips); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.6 Wed Jul 25 04:04:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h Wed Apr 24 12:20:40 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.6 2001/07/25 08:04:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.8 2002/04/24 16:20:40 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * * Modified by Marc Aurele La France <tsi@xfree86.org> for ATI driver merge. */ @@ -47,45 +47,50 @@ Bool HasSecondary; Bool BypassSecondary; - /*These two registers are used to make sure the CRTC2 is - retored before CRTC_EXT, otherwise it could lead to blank screen.*/ + + /* + * The next two are used to make sure CRTC2 is restored before CRTC_EXT, + * otherwise it could lead to blank screens. + */ Bool IsSecondaryRestored; Bool RestorePrimary; - ScrnInfoPtr pSecondaryScrn; + ScrnInfoPtr pSecondaryScrn; ScrnInfoPtr pPrimaryScrn; -}RADEONEntRec, *RADEONEntPtr; +} RADEONEntRec, *RADEONEntPtr; /* radeon_probe.c */ -extern const OptionInfoRec * RADEONAvailableOptions - FunctionPrototype((int, int)); -extern void RADEONIdentify - FunctionPrototype((int)); -extern Bool RADEONProbe - FunctionPrototype((DriverPtr, int)); +extern const OptionInfoRec *RADEONAvailableOptions + FunctionPrototype((int, int)); +extern void RADEONIdentify + FunctionPrototype((int)); +extern Bool RADEONProbe + FunctionPrototype((DriverPtr, int)); -extern SymTabRec RADEONChipsets[]; -extern PciChipsets RADEONPciChipsets[]; +extern SymTabRec RADEONChipsets[]; +extern PciChipsets RADEONPciChipsets[]; /* radeon_driver.c */ -extern Bool RADEONPreInit - FunctionPrototype((ScrnInfoPtr, int)); -extern Bool RADEONScreenInit - FunctionPrototype((int, ScreenPtr, int, char **)); -extern Bool RADEONSwitchMode - FunctionPrototype((int, DisplayModePtr, int)); -extern void RADEONAdjustFrame - FunctionPrototype((int, int, int, int)); -extern Bool RADEONEnterVT - FunctionPrototype((int, int)); -extern void RADEONLeaveVT - FunctionPrototype((int, int)); -extern void RADEONFreeScreen - FunctionPrototype((int, int)); -extern int RADEONValidMode - FunctionPrototype((int, DisplayModePtr, Bool, - int)); +extern void RADEONLoaderRefSymLists + FunctionPrototype((void)); +extern Bool RADEONPreInit + FunctionPrototype((ScrnInfoPtr, int)); +extern Bool RADEONScreenInit + FunctionPrototype((int, ScreenPtr, int, char **)); +extern Bool RADEONSwitchMode + FunctionPrototype((int, DisplayModePtr, int)); +extern void RADEONAdjustFrame + FunctionPrototype((int, int, int, int)); +extern Bool RADEONEnterVT + FunctionPrototype((int, int)); +extern void RADEONLeaveVT + FunctionPrototype((int, int)); +extern void RADEONFreeScreen + FunctionPrototype((int, int)); +extern int RADEONValidMode + FunctionPrototype((int, DisplayModePtr, Bool, + int)); -extern const OptionInfoRec RADEONOptions[]; +extern const OptionInfoRec RADEONOptions[]; #endif /* _RADEON_PROBE_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.13 Wed Sep 26 08:49:25 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h Fri Feb 7 13:08:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.13 2001/09/26 12:49:25 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.25 2003/02/07 18:08:59 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -29,9 +29,9 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> - * Alan Hourihane <ahourihane@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * * References: * @@ -53,102 +53,7 @@ #ifndef _RADEON_REG_H_ #define _RADEON_REG_H_ -#include "xf86_ansic.h" -#include "compiler.h" - -/* Atomic updates of PLL clock don't seem to always work and stick, thus - * the bit never resets. Here - we use our own check by reading back the - * register we've just wrote to make sure it's got the Right! value */ -#define RADEON_ATOMIC_UPDATE 0 /* Use PLL Atomic updates (seems broken) */ - - /* Memory mapped register access macros */ -#define INREG8(addr) MMIO_IN8(RADEONMMIO, addr) -#define INREG16(addr) MMIO_IN16(RADEONMMIO, addr) -#define INREG(addr) MMIO_IN32(RADEONMMIO, addr) -#define OUTREG8(addr, val) MMIO_OUT8(RADEONMMIO, addr, val) -#define OUTREG16(addr, val) MMIO_OUT16(RADEONMMIO, addr, val) -#define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val) - -#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(RADEONMMIO + (addr))) - - -#define OUTREGP(addr, val, mask) \ - do { \ - CARD32 tmp = INREG(addr); \ - tmp &= (mask); \ - tmp |= (val); \ - OUTREG(addr, tmp); \ - } while (0) - -#define INPLL(pScrn, addr) RADEONINPLL(pScrn, addr) - -#if !RADEON_ATOMIC_UPDATE -#define OUTPLL(addr, val) \ - do { \ - while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & 0xbf) != \ - (addr | RADEON_PLL_WR_EN)) { \ - OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ - RADEON_PLL_WR_EN)); \ - } \ - OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ - } while (0) -#else -#define OUTPLL(addr, val) \ - do { \ - OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ - RADEON_PLL_WR_EN)); \ - OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ - } while (0) -#endif - -#define OUTPLLP(pScrn, addr, val, mask) \ - do { \ - CARD32 tmp = INPLL(pScrn, addr); \ - tmp &= (mask); \ - tmp |= (val); \ - OUTPLL(addr, tmp); \ - } while (0) - -#define OUTPAL_START(idx) \ - do { \ - OUTREG8(RADEON_PALETTE_INDEX, (idx)); \ - } while (0) - -#define OUTPAL_NEXT(r, g, b) \ - do { \ - OUTREG(RADEON_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \ - } while (0) - -#define OUTPAL_NEXT_CARD32(v) \ - do { \ - OUTREG(RADEON_PALETTE_DATA, (v & 0x00ffffff)); \ - } while (0) - -#define OUTPAL(idx, r, g, b) \ - do { \ - OUTPAL_START((idx)); \ - OUTPAL_NEXT((r), (g), (b)); \ - } while (0) - -#define INPAL_START(idx) \ - do { \ - OUTREG(RADEON_PALETTE_INDEX, (idx) << 16); \ - } while (0) - -#define INPAL_NEXT() INREG(RADEON_PALETTE_DATA) - -#define PAL_SELECT(idx) \ - do { \ - if (!idx) { \ - OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) & \ - (CARD32)~RADEON_DAC2_PALETTE_ACC_CTL); \ - } else { \ - OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) | \ - RADEON_DAC2_PALETTE_ACC_CTL); \ - } \ - } while (0) - - + /* Registers for 2D/Video/Overlay */ #define RADEON_ADAPTER_ID 0x0f2c /* PCI */ #define RADEON_AGP_BASE 0x0170 #define RADEON_AGP_CNTL 0x0174 @@ -166,11 +71,8 @@ # define RADEON_AGP_1X_MODE 0x01 # define RADEON_AGP_2X_MODE 0x02 # define RADEON_AGP_4X_MODE 0x04 -# define RADEON_AGP_MODE_MASK 0x07 -#define RADEON_AMCGPIO_A_REG 0x01a0 -#define RADEON_AMCGPIO_EN_REG 0x01a8 -#define RADEON_AMCGPIO_MASK 0x0194 -#define RADEON_AMCGPIO_Y_REG 0x01a4 +# define RADEON_AGP_FW_MODE 0x10 +# define RADEON_AGP_MODE_MASK 0x17 #define RADEON_ATTRDR 0x03c1 /* VGA */ #define RADEON_ATTRDW 0x03c0 /* VGA */ #define RADEON_ATTRX 0x03c0 /* VGA */ @@ -315,6 +217,10 @@ #define RADEON_CONFIG_APER_SIZE 0x0108 #define RADEON_CONFIG_BONDS 0x00e8 #define RADEON_CONFIG_CNTL 0x00e0 +# define RADEON_CFG_ATI_REV_A11 (0 << 16) +# define RADEON_CFG_ATI_REV_A12 (1 << 16) +# define RADEON_CFG_ATI_REV_A13 (2 << 16) +# define RADEON_CFG_ATI_REV_ID_MASK (0xf << 16) #define RADEON_CONFIG_MEMSIZE 0x00f8 #define RADEON_CONFIG_MEMSIZE_EMBEDDED 0x0114 #define RADEON_CONFIG_REG_1_BASE 0x010c @@ -327,7 +233,6 @@ #define RADEON_CRC_CMDFIFO_ADDR 0x0740 #define RADEON_CRC_CMDFIFO_DOUT 0x0744 #define RADEON_CRTC_CRNT_FRAME 0x0214 -#define RADEON_CRTC_DEBUG 0x021c #define RADEON_CRTC_EXT_CNTL 0x0054 # define RADEON_CRTC_VGA_XOVERSCAN (1 << 0) # define RADEON_VGA_ATI_LINEAR (1 << 3) @@ -351,21 +256,22 @@ # define RADEON_CRTC_EXT_DISP_EN (1 << 24) # define RADEON_CRTC_EN (1 << 25) # define RADEON_CRTC_DISP_REQ_EN_B (1 << 26) -#define RADEON_CRTC2_GEN_CNTL 0x03f8 -# define RADEON_CRTC2_DBL_SCAN_EN (1 << 0) -# define RADEON_CRTC2_INTERLACE_EN (1 << 1) -# define RADEON_CRTC2_SYNC_TRISTAT (1 << 4) -# define RADEON_CRTC2_HSYNC_TRISTAT (1 << 5) -# define RADEON_CRTC2_VSYNC_TRISTAT (1 << 6) -# define RADEON_CRTC2_CRT2_ON (1 << 7) -# define RADEON_CRTC2_ICON_EN (1 << 15) -# define RADEON_CRTC2_CUR_EN (1 << 16) -# define RADEON_CRTC2_CUR_MODE_MASK (7 << 20) -# define RADEON_CRTC2_DISP_DIS (1 << 23) -# define RADEON_CRTC2_EN (1 << 25) -# define RADEON_CRTC2_DISP_REQ_EN_B (1 << 26) -# define RADEON_CRTC2_HSYNC_DIS (1 << 28) -# define RADEON_CRTC2_VSYNC_DIS (1 << 29) +#define RADEON_CRTC2_GEN_CNTL 0x03f8 +# define RADEON_CRTC2_DBL_SCAN_EN (1 << 0) +# define RADEON_CRTC2_INTERLACE_EN (1 << 1) +# define RADEON_CRTC2_SYNC_TRISTAT (1 << 4) +# define RADEON_CRTC2_HSYNC_TRISTAT (1 << 5) +# define RADEON_CRTC2_VSYNC_TRISTAT (1 << 6) +# define RADEON_CRTC2_CRT2_ON (1 << 7) +# define RADEON_CRTC2_ICON_EN (1 << 15) +# define RADEON_CRTC2_CUR_EN (1 << 16) +# define RADEON_CRTC2_CUR_MODE_MASK (7 << 20) +# define RADEON_CRTC2_DISP_DIS (1 << 23) +# define RADEON_CRTC2_EN (1 << 25) +# define RADEON_CRTC2_DISP_REQ_EN_B (1 << 26) +# define RADEON_CRTC2_CSYNC_EN (1 << 27) +# define RADEON_CRTC2_HSYNC_DIS (1 << 28) +# define RADEON_CRTC2_VSYNC_DIS (1 << 29) #define RADEON_CRTC_GUI_TRIG_VLINE 0x0218 #define RADEON_CRTC_H_SYNC_STRT_WID 0x0204 # define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0) @@ -374,7 +280,7 @@ # define RADEON_CRTC_H_SYNC_WID (0x3f << 16) # define RADEON_CRTC_H_SYNC_WID_SHIFT 16 # define RADEON_CRTC_H_SYNC_POL (1 << 23) -#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 +#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 # define RADEON_CRTC2_H_SYNC_STRT_PIX (0x07 << 0) # define RADEON_CRTC2_H_SYNC_STRT_CHAR (0x3ff << 3) # define RADEON_CRTC2_H_SYNC_STRT_CHAR_SHIFT 3 @@ -387,27 +293,31 @@ # define RADEON_CRTC_H_DISP (0x01ff << 16) # define RADEON_CRTC_H_DISP_SHIFT 16 #define RADEON_CRTC2_H_TOTAL_DISP 0x0300 -# define RADEON_CRTC2_H_TOTAL (0x03ff << 0) -# define RADEON_CRTC2_H_TOTAL_SHIFT 0 -# define RADEON_CRTC2_H_DISP (0x01ff << 16) -# define RADEON_CRTC2_H_DISP_SHIFT 16 +# define RADEON_CRTC2_H_TOTAL (0x03ff << 0) +# define RADEON_CRTC2_H_TOTAL_SHIFT 0 +# define RADEON_CRTC2_H_DISP (0x01ff << 16) +# define RADEON_CRTC2_H_DISP_SHIFT 16 #define RADEON_CRTC_OFFSET 0x0224 #define RADEON_CRTC2_OFFSET 0x0324 #define RADEON_CRTC_OFFSET_CNTL 0x0228 -# define RADEON_CRTC_TILE_EN (1 << 15) +# define RADEON_CRTC_TILE_EN (1 << 15) #define RADEON_CRTC2_OFFSET_CNTL 0x0328 -# define RADEON_CRTC2_TILE_EN (1 << 15) +# define RADEON_CRTC2_TILE_EN (1 << 15) #define RADEON_CRTC_PITCH 0x022c #define RADEON_CRTC2_PITCH 0x032c #define RADEON_CRTC_STATUS 0x005c # define RADEON_CRTC_VBLANK_SAVE (1 << 1) +# define RADEON_CRTC_VBLANK_SAVE_CLEAR (1 << 1) +#define RADEON_CRTC2_STATUS 0x03fc +# define RADEON_CRTC2_VBLANK_SAVE (1 << 1) +# define RADEON_CRTC2_VBLANK_SAVE_CLEAR (1 << 1) #define RADEON_CRTC_V_SYNC_STRT_WID 0x020c -# define RADEON_CRTC_V_SYNC_STRT (0x7ff << 0) -# define RADEON_CRTC_V_SYNC_STRT_SHIFT 0 -# define RADEON_CRTC_V_SYNC_WID (0x1f << 16) -# define RADEON_CRTC_V_SYNC_WID_SHIFT 16 -# define RADEON_CRTC_V_SYNC_POL (1 << 23) -#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c +# define RADEON_CRTC_V_SYNC_STRT (0x7ff << 0) +# define RADEON_CRTC_V_SYNC_STRT_SHIFT 0 +# define RADEON_CRTC_V_SYNC_WID (0x1f << 16) +# define RADEON_CRTC_V_SYNC_WID_SHIFT 16 +# define RADEON_CRTC_V_SYNC_POL (1 << 23) +#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c # define RADEON_CRTC2_V_SYNC_STRT (0x7ff << 0) # define RADEON_CRTC2_V_SYNC_STRT_SHIFT 0 # define RADEON_CRTC2_V_SYNC_WID (0x1f << 16) @@ -418,15 +328,14 @@ # define RADEON_CRTC_V_TOTAL_SHIFT 0 # define RADEON_CRTC_V_DISP (0x07ff << 16) # define RADEON_CRTC_V_DISP_SHIFT 16 -#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 -# define RADEON_CRTC2_V_TOTAL (0x07ff << 0) -# define RADEON_CRTC2_V_TOTAL_SHIFT 0 -# define RADEON_CRTC2_V_DISP (0x07ff << 16) -# define RADEON_CRTC2_V_DISP_SHIFT 16 +#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 +# define RADEON_CRTC2_V_TOTAL (0x07ff << 0) +# define RADEON_CRTC2_V_TOTAL_SHIFT 0 +# define RADEON_CRTC2_V_DISP (0x07ff << 16) +# define RADEON_CRTC2_V_DISP_SHIFT 16 #define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210 # define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16) #define RADEON_CRTC2_CRNT_FRAME 0x0314 -#define RADEON_CRTC2_DEBUG 0x031c #define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318 #define RADEON_CRTC2_STATUS 0x03fc #define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310 @@ -452,7 +361,7 @@ # define RADEON_DAC_VGA_ADR_EN (1 << 13) # define RADEON_DAC_PDWN (1 << 15) # define RADEON_DAC_MASK_ALL (0xff << 24) -#define RADEON_DAC_CNTL2 0x007c +#define RADEON_DAC_CNTL2 0x007c # define RADEON_DAC2_DAC_CLK_SEL (1 << 0) # define RADEON_DAC2_DAC2_CLK_SEL (1 << 1) # define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5) @@ -461,10 +370,11 @@ # define RADEON_TV_DAC_RDACPD (1 << 24) # define RADEON_TV_DAC_GDACPD (1 << 25) # define RADEON_TV_DAC_BDACPD (1 << 26) +#define RADEON_DISP_HW_DEBUG 0x0d14 +# define RADEON_CRT2_DISP1_SEL (1 << 5) #define RADEON_DISP_OUTPUT_CNTL 0x0d64 # define RADEON_DISP_DAC_SOURCE_MASK 0x03 # define RADEON_DISP_DAC_SOURCE_CRTC2 0x01 - #define RADEON_DAC_CRC_SIG 0x02cc #define RADEON_DAC_DATA 0x03c9 /* VGA */ #define RADEON_DAC_MASK 0x03c6 /* VGA */ @@ -494,56 +404,56 @@ #define RADEON_DP_DATATYPE 0x16c4 # define RADEON_HOST_BIG_ENDIAN_EN (1 << 29) #define RADEON_DP_GUI_MASTER_CNTL 0x146c -# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define RADEON_GMC_SRC_CLIPPING (1 << 2) -# define RADEON_GMC_DST_CLIPPING (1 << 3) -# define RADEON_GMC_BRUSH_DATATYPE_MASK (0x0f << 4) -# define RADEON_GMC_BRUSH_8X8_MONO_FG_BG (0 << 4) -# define RADEON_GMC_BRUSH_8X8_MONO_FG_LA (1 << 4) -# define RADEON_GMC_BRUSH_1X8_MONO_FG_BG (4 << 4) -# define RADEON_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4) -# define RADEON_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4) -# define RADEON_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4) -# define RADEON_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4) -# define RADEON_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4) -# define RADEON_GMC_BRUSH_8x8_COLOR (10 << 4) -# define RADEON_GMC_BRUSH_1X8_COLOR (12 << 4) -# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define RADEON_GMC_BRUSH_NONE (15 << 4) -# define RADEON_GMC_DST_8BPP_CI (2 << 8) -# define RADEON_GMC_DST_15BPP (3 << 8) -# define RADEON_GMC_DST_16BPP (4 << 8) -# define RADEON_GMC_DST_24BPP (5 << 8) -# define RADEON_GMC_DST_32BPP (6 << 8) -# define RADEON_GMC_DST_8BPP_RGB (7 << 8) -# define RADEON_GMC_DST_Y8 (8 << 8) -# define RADEON_GMC_DST_RGB8 (9 << 8) -# define RADEON_GMC_DST_VYUY (11 << 8) -# define RADEON_GMC_DST_YVYU (12 << 8) -# define RADEON_GMC_DST_AYUV444 (14 << 8) -# define RADEON_GMC_DST_ARGB4444 (15 << 8) -# define RADEON_GMC_DST_DATATYPE_MASK (0x0f << 8) -# define RADEON_GMC_DST_DATATYPE_SHIFT 8 +# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define RADEON_GMC_SRC_CLIPPING (1 << 2) +# define RADEON_GMC_DST_CLIPPING (1 << 3) +# define RADEON_GMC_BRUSH_DATATYPE_MASK (0x0f << 4) +# define RADEON_GMC_BRUSH_8X8_MONO_FG_BG (0 << 4) +# define RADEON_GMC_BRUSH_8X8_MONO_FG_LA (1 << 4) +# define RADEON_GMC_BRUSH_1X8_MONO_FG_BG (4 << 4) +# define RADEON_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4) +# define RADEON_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4) +# define RADEON_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4) +# define RADEON_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4) +# define RADEON_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4) +# define RADEON_GMC_BRUSH_8x8_COLOR (10 << 4) +# define RADEON_GMC_BRUSH_1X8_COLOR (12 << 4) +# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define RADEON_GMC_BRUSH_NONE (15 << 4) +# define RADEON_GMC_DST_8BPP_CI (2 << 8) +# define RADEON_GMC_DST_15BPP (3 << 8) +# define RADEON_GMC_DST_16BPP (4 << 8) +# define RADEON_GMC_DST_24BPP (5 << 8) +# define RADEON_GMC_DST_32BPP (6 << 8) +# define RADEON_GMC_DST_8BPP_RGB (7 << 8) +# define RADEON_GMC_DST_Y8 (8 << 8) +# define RADEON_GMC_DST_RGB8 (9 << 8) +# define RADEON_GMC_DST_VYUY (11 << 8) +# define RADEON_GMC_DST_YVYU (12 << 8) +# define RADEON_GMC_DST_AYUV444 (14 << 8) +# define RADEON_GMC_DST_ARGB4444 (15 << 8) +# define RADEON_GMC_DST_DATATYPE_MASK (0x0f << 8) +# define RADEON_GMC_DST_DATATYPE_SHIFT 8 # define RADEON_GMC_SRC_DATATYPE_MASK (3 << 12) # define RADEON_GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12) # define RADEON_GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12) # define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define RADEON_GMC_BYTE_PIX_ORDER (1 << 14) -# define RADEON_GMC_BYTE_MSB_TO_LSB (0 << 14) -# define RADEON_GMC_BYTE_LSB_TO_MSB (1 << 14) -# define RADEON_GMC_CONVERSION_TEMP (1 << 15) -# define RADEON_GMC_CONVERSION_TEMP_6500 (0 << 15) -# define RADEON_GMC_CONVERSION_TEMP_9300 (1 << 15) -# define RADEON_GMC_ROP3_MASK (0xff << 16) -# define RADEON_DP_SRC_SOURCE_MASK (7 << 24) -# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) -# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define RADEON_GMC_3D_FCN_EN (1 << 27) -# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define RADEON_GMC_AUX_CLIP_DIS (1 << 29) -# define RADEON_GMC_WR_MSK_DIS (1 << 30) -# define RADEON_GMC_LD_BRUSH_Y_X (1 << 31) +# define RADEON_GMC_BYTE_PIX_ORDER (1 << 14) +# define RADEON_GMC_BYTE_MSB_TO_LSB (0 << 14) +# define RADEON_GMC_BYTE_LSB_TO_MSB (1 << 14) +# define RADEON_GMC_CONVERSION_TEMP (1 << 15) +# define RADEON_GMC_CONVERSION_TEMP_6500 (0 << 15) +# define RADEON_GMC_CONVERSION_TEMP_9300 (1 << 15) +# define RADEON_GMC_ROP3_MASK (0xff << 16) +# define RADEON_DP_SRC_SOURCE_MASK (7 << 24) +# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) +# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define RADEON_GMC_3D_FCN_EN (1 << 27) +# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define RADEON_GMC_AUX_CLIP_DIS (1 << 29) +# define RADEON_GMC_WR_MSK_DIS (1 << 30) +# define RADEON_GMC_LD_BRUSH_Y_X (1 << 31) # define RADEON_ROP3_ZERO 0x00000000 # define RADEON_ROP3_DSa 0x00880000 # define RADEON_ROP3_SDna 0x00440000 @@ -573,8 +483,6 @@ # define RADEON_ROP3_Pn 0x000f0000 # define RADEON_ROP3_DPno 0x00af0000 # define RADEON_ROP3_DPan 0x005f0000 - - #define RADEON_DP_GUI_MASTER_CNTL_C 0x1c84 #define RADEON_DP_MIX 0x16c8 #define RADEON_DP_SRC_BKGD_CLR 0x15dc @@ -593,11 +501,12 @@ #define RADEON_DST_LINE_START 0x1600 #define RADEON_DST_LINE_END 0x1604 #define RADEON_DST_LINE_PATCOUNT 0x1608 +# define RADEON_BRES_CNTL_SHIFT 8 #define RADEON_DST_OFFSET 0x1404 #define RADEON_DST_PITCH 0x1408 #define RADEON_DST_PITCH_OFFSET 0x142c #define RADEON_DST_PITCH_OFFSET_C 0x1c80 -# define RADEON_PITCH_SHIFT 21 +# define RADEON_PITCH_SHIFT 21 # define RADEON_DST_TILE_LINEAR (0 << 30) # define RADEON_DST_TILE_MACRO (1 << 30) # define RADEON_DST_TILE_MICRO (2 << 30) @@ -613,7 +522,13 @@ #define RADEON_DST_Y_SUB 0x15a8 #define RADEON_DST_Y_X 0x1438 -#define RADEON_FCP_CNTL 0x0012 /* PLL */ +#define RADEON_FCP_CNTL 0x0910 +# define RADEON_FCP0_SRC_PCICLK 0 +# define RADEON_FCP0_SRC_PCLK 1 +# define RADEON_FCP0_SRC_PCLKb 2 +# define RADEON_FCP0_SRC_HREF 3 +# define RADEON_FCP0_SRC_GND 4 +# define RADEON_FCP0_SRC_HREFb 5 #define RADEON_FLUSH_1 0x1704 #define RADEON_FLUSH_2 0x1708 #define RADEON_FLUSH_3 0x170c @@ -630,28 +545,27 @@ #define RADEON_FP_CRTC_V_TOTAL_DISP 0x0254 #define RADEON_FP_CRTC2_H_TOTAL_DISP 0x0350 #define RADEON_FP_CRTC2_V_TOTAL_DISP 0x0354 -/*added for FP support------------------------------------------*/ -# define RADEON_FP_CRTC_H_TOTAL_MASK 0x000003ff -# define RADEON_FP_CRTC_H_DISP_MASK 0x01ff0000 -# define RADEON_FP_CRTC_V_TOTAL_MASK 0x00000fff -# define RADEON_FP_CRTC_V_DISP_MASK 0x0fff0000 -# define RADEON_FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 -# define RADEON_FP_H_SYNC_WID_MASK 0x003f0000 -# define RADEON_FP_V_SYNC_STRT_MASK 0x00000fff -# define RADEON_FP_V_SYNC_WID_MASK 0x001f0000 -# define RADEON_FP_CRTC_H_TOTAL_SHIFT 0x00000000 -# define RADEON_FP_CRTC_H_DISP_SHIFT 0x00000010 -# define RADEON_FP_CRTC_V_TOTAL_SHIFT 0x00000000 -# define RADEON_FP_CRTC_V_DISP_SHIFT 0x00000010 -# define RADEON_FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 -# define RADEON_FP_H_SYNC_WID_SHIFT 0x00000010 -# define RADEON_FP_V_SYNC_STRT_SHIFT 0x00000000 -# define RADEON_FP_V_SYNC_WID_SHIFT 0x00000010 -/*-----------------------------------------------------------------*/ +# define RADEON_FP_CRTC_H_TOTAL_MASK 0x000003ff +# define RADEON_FP_CRTC_H_DISP_MASK 0x01ff0000 +# define RADEON_FP_CRTC_V_TOTAL_MASK 0x00000fff +# define RADEON_FP_CRTC_V_DISP_MASK 0x0fff0000 +# define RADEON_FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 +# define RADEON_FP_H_SYNC_WID_MASK 0x003f0000 +# define RADEON_FP_V_SYNC_STRT_MASK 0x00000fff +# define RADEON_FP_V_SYNC_WID_MASK 0x001f0000 +# define RADEON_FP_CRTC_H_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_H_DISP_SHIFT 0x00000010 +# define RADEON_FP_CRTC_V_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_V_DISP_SHIFT 0x00000010 +# define RADEON_FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 +# define RADEON_FP_H_SYNC_WID_SHIFT 0x00000010 +# define RADEON_FP_V_SYNC_STRT_SHIFT 0x00000000 +# define RADEON_FP_V_SYNC_WID_SHIFT 0x00000010 #define RADEON_FP_GEN_CNTL 0x0284 # define RADEON_FP_FPON (1 << 0) # define RADEON_FP_TMDS_EN (1 << 2) -# define RADEON_FP_EN_TMDS (1 << 7) +# define RADEON_FP_PANEL_FORMAT (1 << 3) +# define RADEON_FP_EN_TMDS (1 << 7) # define RADEON_FP_DETECT_SENSE (1 << 8) # define RADEON_FP_SEL_CRTC2 (1 << 13) # define RADEON_FP_CRTC_DONT_SHADOW_HPAR (1 << 15) @@ -664,35 +578,32 @@ # define RADEON_FP_CRT_SYNC_SEL (1 << 23) # define RADEON_FP_USE_SHADOW_EN (1 << 24) # define RADEON_FP_CRT_SYNC_ALT (1 << 26) -#define RADEON_FP2_GEN_CNTL 0x0288 -# define RADEON_FP2_FPON (1 << 0) -# define RADEON_FP2_TMDS_EN (1 << 2) -# define RADEON_FP2_EN_TMDS (1 << 7) -# define RADEON_FP2_DETECT_SENSE (1 << 8) -# define RADEON_FP2_SEL_CRTC2 (1 << 13) -# define RADEON_FP2_FP_POL (1 << 16) -# define RADEON_FP2_LP_POL (1 << 17) -# define RADEON_FP2_SCK_POL (1 << 18) -# define RADEON_FP2_LCD_CNTL_MASK (7 << 19) -# define RADEON_FP2_PAD_FLOP_EN (1 << 22) -# define RADEON_FP2_CRC_EN (1 << 23) -# define RADEON_FP2_CRC_READ_EN (1 << 24) - +#define RADEON_FP2_GEN_CNTL 0x0288 +# define RADEON_FP2_BLANK_EN (1 << 1) +# define RADEON_FP2_ON (1 << 2) +# define RADEON_FP2_PANEL_FORMAT (1 << 3) +# define RADEON_FP2_SEL_CRTC2 (1 << 13) +# define RADEON_FP2_FP_POL (1 << 16) +# define RADEON_FP2_LP_POL (1 << 17) +# define RADEON_FP2_SCK_POL (1 << 18) +# define RADEON_FP2_LCD_CNTL_MASK (7 << 19) +# define RADEON_FP2_PAD_FLOP_EN (1 << 22) +# define RADEON_FP2_CRC_EN (1 << 23) +# define RADEON_FP2_CRC_READ_EN (1 << 24) #define RADEON_FP_H_SYNC_STRT_WID 0x02c4 #define RADEON_FP_H2_SYNC_STRT_WID 0x03c4 #define RADEON_FP_HORZ_STRETCH 0x028c #define RADEON_FP_HORZ2_STRETCH 0x038c -# define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff -# define RADEON_HORZ_STRETCH_RATIO_MAX 4096 -# define RADEON_HORZ_PANEL_SIZE (0x1ff << 16) -# define RADEON_HORZ_PANEL_SHIFT 16 -# define RADEON_HORZ_STRETCH_PIXREP (0 << 25) -# define RADEON_HORZ_STRETCH_BLEND (1 << 26) -# define RADEON_HORZ_STRETCH_ENABLE (1 << 25) -# define RADEON_HORZ_AUTO_RATIO (1 << 27) -# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 28) -# define RADEON_HORZ_AUTO_RATIO_INC (1 << 31) - +# define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff +# define RADEON_HORZ_STRETCH_RATIO_MAX 4096 +# define RADEON_HORZ_PANEL_SIZE (0x1ff << 16) +# define RADEON_HORZ_PANEL_SHIFT 16 +# define RADEON_HORZ_STRETCH_PIXREP (0 << 25) +# define RADEON_HORZ_STRETCH_BLEND (1 << 26) +# define RADEON_HORZ_STRETCH_ENABLE (1 << 25) +# define RADEON_HORZ_AUTO_RATIO (1 << 27) +# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 28) +# define RADEON_HORZ_AUTO_RATIO_INC (1 << 31) #define RADEON_FP_V_SYNC_STRT_WID 0x02c8 #define RADEON_FP_VERT_STRETCH 0x0290 #define RADEON_FP_V2_SYNC_STRT_WID 0x03c8 @@ -712,6 +623,8 @@ #define RADEON_GEN_INT_STATUS 0x0044 # define RADEON_VSYNC_INT_AK (1 << 2) # define RADEON_VSYNC_INT (1 << 2) +# define RADEON_VSYNC2_INT_AK (1 << 6) +# define RADEON_VSYNC2_INT (1 << 6) #define RADEON_GENENB 0x03c3 /* VGA */ #define RADEON_GENFC_RD 0x03ca /* VGA */ #define RADEON_GENFC_WT 0x03da /* VGA, 0x03ba */ @@ -719,39 +632,30 @@ #define RADEON_GENMO_WT 0x03c2 /* VGA */ #define RADEON_GENS0 0x03c2 /* VGA */ #define RADEON_GENS1 0x03da /* VGA, 0x03ba */ - -/*DDC interface using I2C*/ -#define RADEON_GPIO_MONID 0x0068 +#define RADEON_GPIO_MONID 0x0068 /* DDC interface via I2C */ #define RADEON_GPIO_MONIDB 0x006c #define RADEON_GPIO_CRT2_DDC 0x006c #define RADEON_GPIO_DVI_DDC 0x0064 #define RADEON_GPIO_VGA_DDC 0x0060 -# define RADEON_GPIO_A_0 (1 << 0) -# define RADEON_GPIO_A_1 (1 << 1) -# define RADEON_GPIO_Y_0 (1 << 8) -# define RADEON_GPIO_Y_1 (1 << 9) -# define RADEON_GPIO_Y_SHIFT_0 8 -# define RADEON_GPIO_Y_SHIFT_1 9 -# define RADEON_GPIO_EN_0 (1 << 16) -# define RADEON_GPIO_EN_1 (1 << 17) -# define RADEON_GPIO_MASK_0 (1 << 24) /*??*/ -# define RADEON_GPIO_MASK_1 (1 << 25) /*??*/ - +# define RADEON_GPIO_A_0 (1 << 0) +# define RADEON_GPIO_A_1 (1 << 1) +# define RADEON_GPIO_Y_0 (1 << 8) +# define RADEON_GPIO_Y_1 (1 << 9) +# define RADEON_GPIO_Y_SHIFT_0 8 +# define RADEON_GPIO_Y_SHIFT_1 9 +# define RADEON_GPIO_EN_0 (1 << 16) +# define RADEON_GPIO_EN_1 (1 << 17) +# define RADEON_GPIO_MASK_0 (1 << 24) /*??*/ +# define RADEON_GPIO_MASK_1 (1 << 25) /*??*/ #define RADEON_GRPH8_DATA 0x03cf /* VGA */ #define RADEON_GRPH8_IDX 0x03ce /* VGA */ -#define RADEON_GUI_DEBUG0 0x16a0 -#define RADEON_GUI_DEBUG1 0x16a4 -#define RADEON_GUI_DEBUG2 0x16a8 -#define RADEON_GUI_DEBUG3 0x16ac -#define RADEON_GUI_DEBUG4 0x16b0 -#define RADEON_GUI_DEBUG5 0x16b4 -#define RADEON_GUI_DEBUG6 0x16b8 #define RADEON_GUI_SCRATCH_REG0 0x15e0 #define RADEON_GUI_SCRATCH_REG1 0x15e4 #define RADEON_GUI_SCRATCH_REG2 0x15e8 #define RADEON_GUI_SCRATCH_REG3 0x15ec #define RADEON_GUI_SCRATCH_REG4 0x15f0 #define RADEON_GUI_SCRATCH_REG5 0x15f4 + #define RADEON_HEADER 0x0f0e /* PCI */ #define RADEON_HOST_DATA0 0x17c0 #define RADEON_HOST_DATA1 0x17c4 @@ -766,8 +670,6 @@ # define RADEON_HDP_SOFT_RESET (1 << 26) #define RADEON_HTOTAL_CNTL 0x0009 /* PLL */ #define RADEON_HTOTAL2_CNTL 0x002e /* PLL */ -#define RADEON_HW_DEBUG 0x0128 -#define RADEON_HW_DEBUG2 0x011c #define RADEON_I2C_CNTL_1 0x0094 /* ? */ #define RADEON_DVI_I2C_CNTL_1 0x02e4 /* ? */ @@ -789,7 +691,6 @@ # define RADEON_LVDS_BLON (1 << 19) # define RADEON_LVDS_SEL_CRTC2 (1 << 23) #define RADEON_LVDS_PLL_CNTL 0x02d4 - # define RADEON_HSYNC_DELAY_SHIFT 28 # define RADEON_HSYNC_DELAY_MASK (0xf << 28) @@ -823,17 +724,12 @@ #define RADEON_MPP_TB_CONFIG 0x01c0 /* ? */ #define RADEON_MPP_GP_CONFIG 0x01c8 /* ? */ -#define RADEON_N_VIF_COUNT 0x0248 -#define RADEON_OV0_SCALE_CNTL 0x0420 /* ? */ -#define RADEON_OVR_CLR 0x0230 -#define RADEON_OVR_WID_LEFT_RIGHT 0x0234 -#define RADEON_OVR_WID_TOP_BOTTOM 0x0238 - -/* first overlay unit (there is only one) */ +#define RADEON_N_VIF_COUNT 0x0248 -#define RADEON_OV0_Y_X_START 0x0400 -#define RADEON_OV0_Y_X_END 0x0404 +#define RADEON_OV0_AUTO_FLIP_CNTL 0x0470 +#define RADEON_OV0_COLOUR_CNTL 0x04E0 +#define RADEON_OV0_DEINTERLACE_PATTERN 0x0474 #define RADEON_OV0_EXCLUSIVE_HORZ 0x0408 # define RADEON_EXCL_HORZ_START_MASK 0x000000ff # define RADEON_EXCL_HORZ_END_MASK 0x0000ff00 @@ -842,16 +738,76 @@ #define RADEON_OV0_EXCLUSIVE_VERT 0x040C # define RADEON_EXCL_VERT_START_MASK 0x000003ff # define RADEON_EXCL_VERT_END_MASK 0x03ff0000 +#define RADEON_OV0_FILTER_CNTL 0x04A0 +#define RADEON_OV0_FOUR_TAP_COEF_0 0x04B0 +#define RADEON_OV0_FOUR_TAP_COEF_1 0x04B4 +#define RADEON_OV0_FOUR_TAP_COEF_2 0x04B8 +#define RADEON_OV0_FOUR_TAP_COEF_3 0x04BC +#define RADEON_OV0_FOUR_TAP_COEF_4 0x04C0 +#define RADEON_OV0_GAMMA_000_00F 0x0d40 +#define RADEON_OV0_GAMMA_010_01F 0x0d44 +#define RADEON_OV0_GAMMA_020_03F 0x0d48 +#define RADEON_OV0_GAMMA_040_07F 0x0d4c +#define RADEON_OV0_GAMMA_080_0BF 0x0e00 +#define RADEON_OV0_GAMMA_0C0_0FF 0x0e04 +#define RADEON_OV0_GAMMA_100_13F 0x0e08 +#define RADEON_OV0_GAMMA_140_17F 0x0e0c +#define RADEON_OV0_GAMMA_180_1BF 0x0e10 +#define RADEON_OV0_GAMMA_1C0_1FF 0x0e14 +#define RADEON_OV0_GAMMA_200_23F 0x0e18 +#define RADEON_OV0_GAMMA_240_27F 0x0e1c +#define RADEON_OV0_GAMMA_280_2BF 0x0e20 +#define RADEON_OV0_GAMMA_2C0_2FF 0x0e24 +#define RADEON_OV0_GAMMA_300_33F 0x0e28 +#define RADEON_OV0_GAMMA_340_37F 0x0e2c +#define RADEON_OV0_GAMMA_380_3BF 0x0d50 +#define RADEON_OV0_GAMMA_3C0_3FF 0x0d54 +#define RADEON_OV0_GRAPHICS_KEY_CLR_LOW 0x04EC +#define RADEON_OV0_GRAPHICS_KEY_CLR_HIGH 0x04F0 +#define RADEON_OV0_H_INC 0x0480 +#define RADEON_OV0_KEY_CNTL 0x04F4 +# define RADEON_VIDEO_KEY_FN_MASK 0x00000003L +# define RADEON_VIDEO_KEY_FN_FALSE 0x00000000L +# define RADEON_VIDEO_KEY_FN_TRUE 0x00000001L +# define RADEON_VIDEO_KEY_FN_EQ 0x00000002L +# define RADEON_VIDEO_KEY_FN_NE 0x00000003L +# define RADEON_GRAPHIC_KEY_FN_MASK 0x00000030L +# define RADEON_GRAPHIC_KEY_FN_FALSE 0x00000000L +# define RADEON_GRAPHIC_KEY_FN_TRUE 0x00000010L +# define RADEON_GRAPHIC_KEY_FN_EQ 0x00000020L +# define RADEON_GRAPHIC_KEY_FN_NE 0x00000030L +# define RADEON_CMP_MIX_MASK 0x00000100L +# define RADEON_CMP_MIX_OR 0x00000000L +# define RADEON_CMP_MIX_AND 0x00000100L +#define RADEON_OV0_LIN_TRANS_A 0x0d20 +#define RADEON_OV0_LIN_TRANS_B 0x0d24 +#define RADEON_OV0_LIN_TRANS_C 0x0d28 +#define RADEON_OV0_LIN_TRANS_D 0x0d2c +#define RADEON_OV0_LIN_TRANS_E 0x0d30 +#define RADEON_OV0_LIN_TRANS_F 0x0d34 +#define RADEON_OV0_P1_BLANK_LINES_AT_TOP 0x0430 +# define RADEON_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL +# define RADEON_P1_ACTIVE_LINES_M1 0x0fff0000L +#define RADEON_OV0_P1_H_ACCUM_INIT 0x0488 +#define RADEON_OV0_P1_V_ACCUM_INIT 0x0428 +# define RADEON_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L +# define RADEON_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L +#define RADEON_OV0_P1_X_START_END 0x0494 +#define RADEON_OV0_P2_X_START_END 0x0498 +#define RADEON_OV0_P23_BLANK_LINES_AT_TOP 0x0434 +# define RADEON_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL +# define RADEON_P23_ACTIVE_LINES_M1 0x07ff0000L +#define RADEON_OV0_P23_H_ACCUM_INIT 0x048C +#define RADEON_OV0_P23_V_ACCUM_INIT 0x042C +#define RADEON_OV0_P3_X_START_END 0x049C #define RADEON_OV0_REG_LOAD_CNTL 0x0410 # define RADEON_REG_LD_CTL_LOCK 0x00000001L # define RADEON_REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L # define RADEON_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L # define RADEON_REG_LD_CTL_LOCK_READBACK 0x00000008L #define RADEON_OV0_SCALE_CNTL 0x0420 -# define RADEON_SCALER_PIX_EXPAND 0x00000001L -# define RADEON_SCALER_Y2R_TEMP 0x00000002L -# define RADEON_SCALER_HORZ_PICK_NEAREST 0x00000003L -# define RADEON_SCALER_VERT_PICK_NEAREST 0x00000004L +# define RADEON_SCALER_HORZ_PICK_NEAREST 0x00000004L +# define RADEON_SCALER_VERT_PICK_NEAREST 0x00000008L # define RADEON_SCALER_SIGNED_UV 0x00000010L # define RADEON_SCALER_GAMMA_SEL_MASK 0x00000060L # define RADEON_SCALER_GAMMA_SEL_BRIGHT 0x00000000L @@ -867,25 +823,21 @@ # define RADEON_SCALER_SOURCE_YUV12 0x00000A00L # define RADEON_SCALER_SOURCE_VYUY422 0x00000B00L # define RADEON_SCALER_SOURCE_YVYU422 0x00000C00L +# define RADEON_SCALER_ADAPTIVE_DEINT 0x00001000L +# define RADEON_SCALER_TEMPORAL_DEINT 0x00002000L # define RADEON_SCALER_SMART_SWITCH 0x00008000L -# define RADEON_SCALER_BURST_PER_PLANE 0x00ff0000L +# define RADEON_SCALER_BURST_PER_PLANE 0x007F0000L # define RADEON_SCALER_DOUBLE_BUFFER 0x01000000L # define RADEON_SCALER_DIS_LIMIT 0x08000000L -# define RADEON_SCALER_PRG_LOAD_START 0x10000000L # define RADEON_SCALER_INT_EMU 0x20000000L # define RADEON_SCALER_ENABLE 0x40000000L # define RADEON_SCALER_SOFT_RESET 0x80000000L +# define RADEON_SCALER_ADAPTIVE_DEINT 0x00001000L +#define RADEON_OV0_STEP_BY 0x0484 +#define RADEON_OV0_TEST 0x04F8 #define RADEON_OV0_V_INC 0x0424 -#define RADEON_OV0_P1_V_ACCUM_INIT 0x0428 -# define RADEON_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L -# define RADEON_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L -#define RADEON_OV0_P23_V_ACCUM_INIT 0x042C -#define RADEON_OV0_P1_BLANK_LINES_AT_TOP 0x0430 -# define RADEON_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL -# define RADEON_P1_ACTIVE_LINES_M1 0x0fff0000L -#define RADEON_OV0_P23_BLANK_LINES_AT_TOP 0x0434 -# define RADEON_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL -# define RADEON_P23_ACTIVE_LINES_M1 0x07ff0000L +#define RADEON_OV0_VID_BUF_PITCH0_VALUE 0x0460 +#define RADEON_OV0_VID_BUF_PITCH1_VALUE 0x0464 #define RADEON_OV0_VID_BUF0_BASE_ADRS 0x0440 # define RADEON_VIF_BUF0_PITCH_SEL 0x00000001L # define RADEON_VIF_BUF0_TILE_ADRS 0x00000002L @@ -904,48 +856,41 @@ #define RADEON_OV0_VID_BUF3_BASE_ADRS 0x044C #define RADEON_OV0_VID_BUF4_BASE_ADRS 0x0450 #define RADEON_OV0_VID_BUF5_BASE_ADRS 0x0454 -#define RADEON_OV0_VID_BUF_PITCH0_VALUE 0x0460 -#define RADEON_OV0_VID_BUF_PITCH1_VALUE 0x0464 -#define RADEON_OV0_AUTO_FLIP_CNTL 0x0470 -#define RADEON_OV0_DEINTERLACE_PATTERN 0x0474 -#define RADEON_OV0_H_INC 0x0480 -#define RADEON_OV0_STEP_BY 0x0484 -#define RADEON_OV0_P1_H_ACCUM_INIT 0x0488 -#define RADEON_OV0_P23_H_ACCUM_INIT 0x048C -#define RADEON_OV0_P1_X_START_END 0x0494 -#define RADEON_OV0_P2_X_START_END 0x0498 -#define RADEON_OV0_P3_X_START_END 0x049C -#define RADEON_OV0_FILTER_CNTL 0x04A0 -#define RADEON_OV0_FOUR_TAP_COEF_0 0x04B0 -#define RADEON_OV0_FOUR_TAP_COEF_1 0x04B4 -#define RADEON_OV0_FOUR_TAP_COEF_2 0x04B8 -#define RADEON_OV0_FOUR_TAP_COEF_3 0x04BC -#define RADEON_OV0_FOUR_TAP_COEF_4 0x04C0 -#define RADEON_OV0_COLOUR_CNTL 0x04E0 -#define RADEON_OV0_VIDEO_KEY_CLR 0x04E4 -#define RADEON_OV0_VIDEO_KEY_MSK 0x04E8 -#define RADEON_OV0_GRAPHICS_KEY_CLR 0x04EC -#define RADEON_OV0_GRAPHICS_KEY_MSK 0x04F0 -#define RADEON_OV0_KEY_CNTL 0x04F4 -# define RADEON_VIDEO_KEY_FN_MASK 0x00000007L -# define RADEON_VIDEO_KEY_FN_FALSE 0x00000000L -# define RADEON_VIDEO_KEY_FN_TRUE 0x00000001L -# define RADEON_VIDEO_KEY_FN_EQ 0x00000004L -# define RADEON_VIDEO_KEY_FN_NE 0x00000005L -# define RADEON_GRAPHIC_KEY_FN_MASK 0x00000070L -# define RADEON_GRAPHIC_KEY_FN_FALSE 0x00000000L -# define RADEON_GRAPHIC_KEY_FN_TRUE 0x00000010L -# define RADEON_GRAPHIC_KEY_FN_EQ 0x00000040L -# define RADEON_GRAPHIC_KEY_FN_NE 0x00000050L -# define RADEON_CMP_MIX_MASK 0x00000100L -# define RADEON_CMP_MIX_OR 0x00000000L -# define RADEON_CMP_MIX_AND 0x00000100L -#define RADEON_OV0_TEST 0x04F8 +#define RADEON_OV0_VIDEO_KEY_CLR_HIGH 0x04E8 +#define RADEON_OV0_VIDEO_KEY_CLR_LOW 0x04E4 +#define RADEON_OV0_Y_X_START 0x0400 +#define RADEON_OV0_Y_X_END 0x0404 +#define RADEON_OV1_Y_X_START 0x0600 +#define RADEON_OV1_Y_X_END 0x0604 +#define RADEON_OVR_CLR 0x0230 +#define RADEON_OVR_WID_LEFT_RIGHT 0x0234 +#define RADEON_OVR_WID_TOP_BOTTOM 0x0238 +#define RADEON_P2PLL_CNTL 0x002a /* P2PLL */ +# define RADEON_P2PLL_RESET (1 << 0) +# define RADEON_P2PLL_SLEEP (1 << 1) +# define RADEON_P2PLL_ATOMIC_UPDATE_EN (1 << 16) +# define RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17) +# define RADEON_P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18) +#define RADEON_P2PLL_DIV_0 0x002c +# define RADEON_P2PLL_FB0_DIV_MASK 0x07ff +# define RADEON_P2PLL_POST0_DIV_MASK 0x00070000 +#define RADEON_P2PLL_REF_DIV 0x002B /* PLL */ +# define RADEON_P2PLL_REF_DIV_MASK 0x03ff +# define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ +# define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ +# define R300_PPLL_REF_DIV_ACC_MASK (0x3ff < 18) +# define R300_PPLL_REF_DIV_ACC_SHIFT 18 #define RADEON_PALETTE_DATA 0x00b4 #define RADEON_PALETTE_30_DATA 0x00b8 #define RADEON_PALETTE_INDEX 0x00b0 #define RADEON_PCI_GART_PAGE 0x017c +#define RADEON_PIXCLKS_CNTL 0x002d +# define RADEON_PIX2CLK_SRC_SEL_MASK 0x03 +# define RADEON_PIX2CLK_SRC_SEL_CPUCLK 0x00 +# define RADEON_PIX2CLK_SRC_SEL_PSCANCLK 0x01 +# define RADEON_PIX2CLK_SRC_SEL_BYTECLK 0x02 +# define RADEON_PIX2CLK_SRC_SEL_P2PLLCLK 0x03 #define RADEON_PLANE_3D_MASK_C 0x1d44 #define RADEON_PLL_TEST_CNTL 0x0013 /* PLL */ #define RADEON_PMI_CAP_ID 0x0f5c /* PCI */ @@ -970,29 +915,22 @@ # define RADEON_PPLL_REF_DIV_MASK 0x03ff # define RADEON_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ # define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ -#define RADEON_P2PLL_CNTL 0x002a /* P2PLL */ -# define RADEON_P2PLL_RESET (1 << 0) -# define RADEON_P2PLL_SLEEP (1 << 1) -# define RADEON_P2PLL_ATOMIC_UPDATE_EN (1 << 16) -# define RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17) -# define RADEON_P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18) -#define RADEON_P2PLL_DIV_0 0x002c -# define RADEON_P2PLL_FB0_DIV_MASK 0x07ff -# define RADEON_P2PLL_POST0_DIV_MASK 0x00070000 -#define RADEON_P2PLL_REF_DIV 0x002B /* PLL */ -# define RADEON_P2PLL_REF_DIV_MASK 0x03ff -# define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ -# define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ #define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */ + +#define RADEON_RBBM_GUICNTL 0x172c +# define RADEON_HOST_DATA_SWAP_NONE (0 << 0) +# define RADEON_HOST_DATA_SWAP_16BIT (1 << 0) +# define RADEON_HOST_DATA_SWAP_32BIT (2 << 0) +# define RADEON_HOST_DATA_SWAP_HDW (3 << 0) #define RADEON_RBBM_SOFT_RESET 0x00f0 -# define RADEON_SOFT_RESET_CP (1 << 0) -# define RADEON_SOFT_RESET_HI (1 << 1) -# define RADEON_SOFT_RESET_SE (1 << 2) -# define RADEON_SOFT_RESET_RE (1 << 3) -# define RADEON_SOFT_RESET_PP (1 << 4) -# define RADEON_SOFT_RESET_E2 (1 << 5) -# define RADEON_SOFT_RESET_RB (1 << 6) -# define RADEON_SOFT_RESET_HDP (1 << 7) +# define RADEON_SOFT_RESET_CP (1 << 0) +# define RADEON_SOFT_RESET_HI (1 << 1) +# define RADEON_SOFT_RESET_SE (1 << 2) +# define RADEON_SOFT_RESET_RE (1 << 3) +# define RADEON_SOFT_RESET_PP (1 << 4) +# define RADEON_SOFT_RESET_E2 (1 << 5) +# define RADEON_SOFT_RESET_RB (1 << 6) +# define RADEON_SOFT_RESET_HDP (1 << 7) #define RADEON_RBBM_STATUS 0x0e40 # define RADEON_RBBM_FIFOCNT_MASK 0x007f # define RADEON_RBBM_ACTIVE (1 << 31) @@ -1014,8 +952,14 @@ #define RADEON_SC_TOP 0x1648 #define RADEON_SC_TOP_LEFT 0x16ec #define RADEON_SC_TOP_LEFT_C 0x1c88 -# define RADEON_SC_SIGN_MASK_LO 0x8000 -# define RADEON_SC_SIGN_MASK_HI 0x80000000 +# define RADEON_SC_SIGN_MASK_LO 0x8000 +# define RADEON_SC_SIGN_MASK_HI 0x80000000 +#define RADEON_SCLK_CNTL 0x000d /* PLL */ +# define RADEON_DYN_STOP_LAT_MASK 0x00007ff8 +# define RADEON_CP_MAX_DYN_STOP_LAT 0x0008 +# define RADEON_SCLK_FORCEON_MASK 0xffff8000 +#define RADEON_SCLK_MORE_CNTL 0x0035 /* PLL */ +# define RADEON_SCLK_MORE_FORCEON 0x0700 #define RADEON_SDRAM_MODE_REG 0x0158 #define RADEON_SEQ8_DATA 0x03c5 /* VGA */ #define RADEON_SEQ8_IDX 0x03c4 /* VGA */ @@ -1036,9 +980,9 @@ #define RADEON_SUBPIC_CNTL 0x0540 /* ? */ #define RADEON_SUB_CLASS 0x0f0a /* PCI */ #define RADEON_SURFACE_CNTL 0x0b00 -# define RADEON_SURF_TRANSLATION_DIS (1 << 8) -# define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20) -# define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21) +# define RADEON_SURF_TRANSLATION_DIS (1 << 8) +# define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20) +# define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21) #define RADEON_SURFACE0_INFO 0x0b0c #define RADEON_SURFACE0_LOWER_BOUND 0x0b04 #define RADEON_SURFACE0_UPPER_BOUND 0x0b08 @@ -1068,7 +1012,7 @@ #define RADEON_TEST_DEBUG_CNTL 0x0120 #define RADEON_TEST_DEBUG_MUX 0x0124 #define RADEON_TEST_DEBUG_OUT 0x012c -#define RADEON_TMDS_CRC 0x02a0 +#define RADEON_TMDS_PLL_CNTL 0x02a8 #define RADEON_TRAIL_BRES_DEC 0x1614 #define RADEON_TRAIL_BRES_ERR 0x160c #define RADEON_TRAIL_BRES_INC 0x1610 @@ -1076,6 +1020,11 @@ #define RADEON_TRAIL_X_SUB 0x1620 #define RADEON_VCLK_ECP_CNTL 0x0008 /* PLL */ +# define RADEON_VCLK_SRC_SEL_MASK 0x03 +# define RADEON_VCLK_SRC_SEL_CPUCLK 0x00 +# define RADEON_VCLK_SRC_SEL_PSCANCLK 0x01 +# define RADEON_VCLK_SRC_SEL_BYTECLK 0x02 +# define RADEON_VCLK_SRC_SEL_PPLLCLK 0x03 #define RADEON_VENDOR_ID 0x0f00 /* PCI */ #define RADEON_VGA_DDA_CONFIG 0x02e8 #define RADEON_VGA_DDA_ON_OFF 0x02ec @@ -1084,16 +1033,18 @@ #define RADEON_VIPH_CONTROL 0x0c40 /* ? */ #define RADEON_WAIT_UNTIL 0x1720 -# define RADEON_WAIT_CRTC_PFLIP (1 << 0) -# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) -# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) -# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) +# define RADEON_WAIT_CRTC_PFLIP (1 << 0) +# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) +# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) +# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) #define RADEON_X_MPLL_REF_FB_DIV 0x000a /* PLL */ #define RADEON_XCLK_CNTL 0x000d /* PLL */ #define RADEON_XDLL_CNTL 0x000c /* PLL */ #define RADEON_XPLL_CNTL 0x000b /* PLL */ + + /* Registers for 3D/TCL */ #define RADEON_PP_BORDER_COLOR_0 0x1d40 #define RADEON_PP_BORDER_COLOR_1 0x1d44 @@ -1179,7 +1130,13 @@ # define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1) # define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1) # define RADEON_MIN_FILTER_MASK (15 << 1) -# define RADEON_LOD_BIAS_MASK (0xffff << 8) +# define RADEON_MAX_ANISO_1_TO_1 (0 << 5) +# define RADEON_MAX_ANISO_2_TO_1 (1 << 5) +# define RADEON_MAX_ANISO_4_TO_1 (2 << 5) +# define RADEON_MAX_ANISO_8_TO_1 (3 << 5) +# define RADEON_MAX_ANISO_16_TO_1 (4 << 5) +# define RADEON_MAX_ANISO_MASK (7 << 5) +# define RADEON_LOD_BIAS_MASK (0xff << 8) # define RADEON_LOD_BIAS_SHIFT 8 # define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16) # define RADEON_MAX_MIP_LEVEL_SHIFT 16 @@ -1222,6 +1179,10 @@ # define RADEON_TXFORMAT_WIDTH_SHIFT 8 # define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12) # define RADEON_TXFORMAT_HEIGHT_SHIFT 12 +# define RADEON_TXFORMAT_F5_WIDTH_MASK (15 << 16) +# define RADEON_TXFORMAT_F5_WIDTH_SHIFT 16 +# define RADEON_TXFORMAT_F5_HEIGHT_MASK (15 << 20) +# define RADEON_TXFORMAT_F5_HEIGHT_SHIFT 20 # define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) # define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24) # define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) @@ -1234,6 +1195,26 @@ # define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) # define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) # define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31) +#define RADEON_PP_CUBIC_FACES_0 0x1d24 +#define RADEON_PP_CUBIC_FACES_1 0x1d28 +#define RADEON_PP_CUBIC_FACES_2 0x1d2c +# define RADEON_FACE_WIDTH_1_SHIFT 0 +# define RADEON_FACE_HEIGHT_1_SHIFT 4 +# define RADEON_FACE_WIDTH_1_MASK (0xf << 0) +# define RADEON_FACE_HEIGHT_1_MASK (0xf << 4) +# define RADEON_FACE_WIDTH_2_SHIFT 8 +# define RADEON_FACE_HEIGHT_2_SHIFT 12 +# define RADEON_FACE_WIDTH_2_MASK (0xf << 8) +# define RADEON_FACE_HEIGHT_2_MASK (0xf << 12) +# define RADEON_FACE_WIDTH_3_SHIFT 16 +# define RADEON_FACE_HEIGHT_3_SHIFT 20 +# define RADEON_FACE_WIDTH_3_MASK (0xf << 16) +# define RADEON_FACE_HEIGHT_3_MASK (0xf << 20) +# define RADEON_FACE_WIDTH_4_SHIFT 24 +# define RADEON_FACE_HEIGHT_4_SHIFT 28 +# define RADEON_FACE_WIDTH_4_MASK (0xf << 24) +# define RADEON_FACE_HEIGHT_4_MASK (0xf << 28) + #define RADEON_PP_TXOFFSET_0 0x1c5c #define RADEON_PP_TXOFFSET_1 0x1c74 #define RADEON_PP_TXOFFSET_2 0x1c8c @@ -1248,134 +1229,164 @@ # define RADEON_TXO_MICRO_TILE_OPT (2 << 3) # define RADEON_TXO_OFFSET_MASK 0xffffffe0 # define RADEON_TXO_OFFSET_SHIFT 5 + +#define RADEON_PP_CUBIC_OFFSET_T0_0 0x1dd0 /* bits [31:5] */ +#define RADEON_PP_CUBIC_OFFSET_T0_1 0x1dd4 +#define RADEON_PP_CUBIC_OFFSET_T0_2 0x1dd8 +#define RADEON_PP_CUBIC_OFFSET_T0_3 0x1ddc +#define RADEON_PP_CUBIC_OFFSET_T0_4 0x1de0 +#define RADEON_PP_CUBIC_OFFSET_T1_0 0x1e00 +#define RADEON_PP_CUBIC_OFFSET_T1_1 0x1e04 +#define RADEON_PP_CUBIC_OFFSET_T1_2 0x1e08 +#define RADEON_PP_CUBIC_OFFSET_T1_3 0x1e0c +#define RADEON_PP_CUBIC_OFFSET_T1_4 0x1e10 +#define RADEON_PP_CUBIC_OFFSET_T2_0 0x1e14 +#define RADEON_PP_CUBIC_OFFSET_T2_1 0x1e18 +#define RADEON_PP_CUBIC_OFFSET_T2_2 0x1e1c +#define RADEON_PP_CUBIC_OFFSET_T2_3 0x1e20 +#define RADEON_PP_CUBIC_OFFSET_T2_4 0x1e24 + +#define RADEON_PP_TEX_SIZE_0 0x1d04 /* NPOT */ +#define RADEON_PP_TEX_SIZE_1 0x1d0c +#define RADEON_PP_TEX_SIZE_2 0x1d14 +# define RADEON_TEX_USIZE_MASK (0x7ff << 0) +# define RADEON_TEX_USIZE_SHIFT 0 +# define RADEON_TEX_VSIZE_MASK (0x7ff << 16) +# define RADEON_TEX_VSIZE_SHIFT 16 +# define RADEON_SIGNED_RGB_MASK (1 << 30) +# define RADEON_SIGNED_RGB_SHIFT 30 +# define RADEON_SIGNED_ALPHA_MASK (1 << 31) +# define RADEON_SIGNED_ALPHA_SHIFT 31 + #define RADEON_PP_TXCBLEND_0 0x1c60 #define RADEON_PP_TXCBLEND_1 0x1c78 #define RADEON_PP_TXCBLEND_2 0x1c90 -# define RADEON_COLOR_ARG_A_SHIFT 0 -# define RADEON_COLOR_ARG_A_MASK (0x1f << 0) -# define RADEON_COLOR_ARG_A_ZERO (0 << 0) -# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0) -# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0) -# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0) -# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0) -# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0) -# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0) -# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0) -# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0) -# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0) -# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0) -# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0) -# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0) -# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0) -# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0) -# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0) -# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0) -# define RADEON_COLOR_ARG_B_SHIFT 5 -# define RADEON_COLOR_ARG_B_MASK (0x1f << 5) -# define RADEON_COLOR_ARG_B_ZERO (0 << 5) -# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5) -# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5) -# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5) -# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5) -# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5) -# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5) -# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5) -# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5) -# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5) -# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5) -# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5) -# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5) -# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5) -# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5) -# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5) -# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5) -# define RADEON_COLOR_ARG_C_SHIFT 10 -# define RADEON_COLOR_ARG_C_MASK (0x1f << 10) -# define RADEON_COLOR_ARG_C_ZERO (0 << 10) -# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10) -# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10) -# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10) -# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10) -# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10) -# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10) -# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10) -# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10) -# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10) -# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10) -# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10) -# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10) -# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10) -# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10) -# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10) -# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10) -# define RADEON_COMP_ARG_A (1 << 15) -# define RADEON_COMP_ARG_A_SHIFT 15 -# define RADEON_COMP_ARG_B (1 << 16) -# define RADEON_COMP_ARG_B_SHIFT 16 -# define RADEON_COMP_ARG_C (1 << 17) -# define RADEON_COMP_ARG_C_SHIFT 17 -# define RADEON_BLEND_CTL_MASK (7 << 18) -# define RADEON_BLEND_CTL_ADD (0 << 18) -# define RADEON_BLEND_CTL_SUBTRACT (1 << 18) -# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18) -# define RADEON_BLEND_CTL_BLEND (3 << 18) -# define RADEON_BLEND_CTL_DOT3 (4 << 18) -# define RADEON_SCALE_SHIFT 21 -# define RADEON_SCALE_MASK (3 << 21) -# define RADEON_SCALE_1X (0 << 21) -# define RADEON_SCALE_2X (1 << 21) -# define RADEON_SCALE_4X (2 << 21) -# define RADEON_CLAMP_TX (1 << 23) -# define RADEON_T0_EQ_TCUR (1 << 24) -# define RADEON_T1_EQ_TCUR (1 << 25) -# define RADEON_T2_EQ_TCUR (1 << 26) -# define RADEON_T3_EQ_TCUR (1 << 27) -# define RADEON_COLOR_ARG_MASK 0x1f -# define RADEON_COMP_ARG_SHIFT 15 +# define RADEON_COLOR_ARG_A_SHIFT 0 +# define RADEON_COLOR_ARG_A_MASK (0x1f << 0) +# define RADEON_COLOR_ARG_A_ZERO (0 << 0) +# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0) +# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0) +# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0) +# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0) +# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0) +# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0) +# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0) +# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0) +# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0) +# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0) +# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0) +# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0) +# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0) +# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0) +# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0) +# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0) +# define RADEON_COLOR_ARG_B_SHIFT 5 +# define RADEON_COLOR_ARG_B_MASK (0x1f << 5) +# define RADEON_COLOR_ARG_B_ZERO (0 << 5) +# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5) +# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5) +# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5) +# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5) +# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5) +# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5) +# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5) +# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5) +# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5) +# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5) +# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5) +# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5) +# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5) +# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5) +# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5) +# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5) +# define RADEON_COLOR_ARG_C_SHIFT 10 +# define RADEON_COLOR_ARG_C_MASK (0x1f << 10) +# define RADEON_COLOR_ARG_C_ZERO (0 << 10) +# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10) +# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10) +# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10) +# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10) +# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10) +# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10) +# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10) +# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10) +# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10) +# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10) +# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10) +# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10) +# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10) +# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10) +# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10) +# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10) +# define RADEON_COMP_ARG_A (1 << 15) +# define RADEON_COMP_ARG_A_SHIFT 15 +# define RADEON_COMP_ARG_B (1 << 16) +# define RADEON_COMP_ARG_B_SHIFT 16 +# define RADEON_COMP_ARG_C (1 << 17) +# define RADEON_COMP_ARG_C_SHIFT 17 +# define RADEON_BLEND_CTL_MASK (7 << 18) +# define RADEON_BLEND_CTL_ADD (0 << 18) +# define RADEON_BLEND_CTL_SUBTRACT (1 << 18) +# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18) +# define RADEON_BLEND_CTL_BLEND (3 << 18) +# define RADEON_BLEND_CTL_DOT3 (4 << 18) +# define RADEON_SCALE_SHIFT 21 +# define RADEON_SCALE_MASK (3 << 21) +# define RADEON_SCALE_1X (0 << 21) +# define RADEON_SCALE_2X (1 << 21) +# define RADEON_SCALE_4X (2 << 21) +# define RADEON_CLAMP_TX (1 << 23) +# define RADEON_T0_EQ_TCUR (1 << 24) +# define RADEON_T1_EQ_TCUR (1 << 25) +# define RADEON_T2_EQ_TCUR (1 << 26) +# define RADEON_T3_EQ_TCUR (1 << 27) +# define RADEON_COLOR_ARG_MASK 0x1f +# define RADEON_COMP_ARG_SHIFT 15 #define RADEON_PP_TXABLEND_0 0x1c64 #define RADEON_PP_TXABLEND_1 0x1c7c #define RADEON_PP_TXABLEND_2 0x1c94 -# define RADEON_ALPHA_ARG_A_SHIFT 0 -# define RADEON_ALPHA_ARG_A_MASK (0xf << 0) -# define RADEON_ALPHA_ARG_A_ZERO (0 << 0) -# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0) -# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0) -# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0) -# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0) -# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0) -# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0) -# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0) -# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0) -# define RADEON_ALPHA_ARG_B_SHIFT 4 -# define RADEON_ALPHA_ARG_B_MASK (0xf << 4) -# define RADEON_ALPHA_ARG_B_ZERO (0 << 4) -# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4) -# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4) -# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4) -# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4) -# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4) -# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4) -# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4) -# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4) -# define RADEON_ALPHA_ARG_C_SHIFT 8 -# define RADEON_ALPHA_ARG_C_MASK (0xf << 8) -# define RADEON_ALPHA_ARG_C_ZERO (0 << 8) -# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8) -# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8) -# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8) -# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8) -# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8) -# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8) -# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8) -# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8) -# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9) -# define RADEON_ALPHA_ARG_MASK 0xf +# define RADEON_ALPHA_ARG_A_SHIFT 0 +# define RADEON_ALPHA_ARG_A_MASK (0xf << 0) +# define RADEON_ALPHA_ARG_A_ZERO (0 << 0) +# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0) +# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0) +# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0) +# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0) +# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0) +# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0) +# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0) +# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0) +# define RADEON_ALPHA_ARG_B_SHIFT 4 +# define RADEON_ALPHA_ARG_B_MASK (0xf << 4) +# define RADEON_ALPHA_ARG_B_ZERO (0 << 4) +# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4) +# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4) +# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4) +# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4) +# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4) +# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4) +# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4) +# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4) +# define RADEON_ALPHA_ARG_C_SHIFT 8 +# define RADEON_ALPHA_ARG_C_MASK (0xf << 8) +# define RADEON_ALPHA_ARG_C_ZERO (0 << 8) +# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8) +# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8) +# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8) +# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8) +# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8) +# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8) +# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8) +# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8) +# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9) +# define RADEON_ALPHA_ARG_MASK 0xf #define RADEON_PP_TFACTOR_0 0x1c68 #define RADEON_PP_TFACTOR_1 0x1c80 #define RADEON_PP_TFACTOR_2 0x1c98 #define RADEON_RB3D_BLENDCNTL 0x1c20 +# define RADEON_COMB_FCN_MASK (3 << 12) # define RADEON_COMB_FCN_ADD_CLAMP (0 << 12) # define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12) # define RADEON_COMB_FCN_SUB_CLAMP (2 << 12) @@ -1425,8 +1436,6 @@ # define RADEON_COLOR_FORMAT_aYUV444 (14 << 10) # define RADEON_COLOR_FORMAT_ARGB4444 (15 << 10) # define RADEON_CLRCMP_FLIP_ENABLE (1 << 14) -# define RADEON_ZBLOCK8 (0 << 15) -# define RADEON_ZBLOCK16 (1 << 15) #define RADEON_RB3D_COLOROFFSET 0x1c40 # define RADEON_COLOROFFSET_MASK 0xfffffff0 #define RADEON_RB3D_COLORPITCH 0x1c48 @@ -1444,10 +1453,30 @@ # define RADEON_DEPTH_ENDIAN_DWORD_SWAP (2 << 18) #define RADEON_RB3D_PLANEMASK 0x1d84 #define RADEON_RB3D_ROPCNTL 0x1d80 +# define RADEON_ROP_MASK (15 << 8) +# define RADEON_ROP_CLEAR (0 << 8) +# define RADEON_ROP_NOR (1 << 8) +# define RADEON_ROP_AND_INVERTED (2 << 8) +# define RADEON_ROP_COPY_INVERTED (3 << 8) +# define RADEON_ROP_AND_REVERSE (4 << 8) +# define RADEON_ROP_INVERT (5 << 8) +# define RADEON_ROP_XOR (6 << 8) +# define RADEON_ROP_NAND (7 << 8) +# define RADEON_ROP_AND (8 << 8) +# define RADEON_ROP_EQUIV (9 << 8) +# define RADEON_ROP_NOOP (10 << 8) +# define RADEON_ROP_OR_INVERTED (11 << 8) +# define RADEON_ROP_COPY (12 << 8) +# define RADEON_ROP_OR_REVERSE (13 << 8) +# define RADEON_ROP_OR (14 << 8) +# define RADEON_ROP_SET (15 << 8) #define RADEON_RB3D_STENCILREFMASK 0x1d7c # define RADEON_STENCIL_REF_SHIFT 0 +# define RADEON_STENCIL_REF_MASK (0xff << 0) # define RADEON_STENCIL_MASK_SHIFT 16 +# define RADEON_STENCIL_VALUE_MASK (0xff << 16) # define RADEON_STENCIL_WRITEMASK_SHIFT 24 +# define RADEON_STENCIL_WRITE_MASK (0xff << 24) #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c # define RADEON_DEPTH_FORMAT_MASK (0xf << 0) # define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) @@ -1467,7 +1496,6 @@ # define RADEON_Z_TEST_NEQUAL (6 << 4) # define RADEON_Z_TEST_ALWAYS (7 << 4) # define RADEON_Z_TEST_MASK (7 << 4) -# define RADEON_HIERARCHICAL_Z_ENABLE (1 << 8) # define RADEON_STENCIL_TEST_NEVER (0 << 12) # define RADEON_STENCIL_TEST_LESS (1 << 12) # define RADEON_STENCIL_TEST_LEQUAL (2 << 12) @@ -1476,28 +1504,31 @@ # define RADEON_STENCIL_TEST_GREATER (5 << 12) # define RADEON_STENCIL_TEST_NEQUAL (6 << 12) # define RADEON_STENCIL_TEST_ALWAYS (7 << 12) -# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16) -# define RADEON_STENCIL_S_FAIL_ZERO (1 << 16) -# define RADEON_STENCIL_S_FAIL_REPLACE (2 << 16) -# define RADEON_STENCIL_S_FAIL_INC (3 << 16) -# define RADEON_STENCIL_S_FAIL_DEC (4 << 16) -# define RADEON_STENCIL_S_FAIL_INVERT (5 << 16) +# define RADEON_STENCIL_TEST_MASK (0x7 << 12) +# define RADEON_STENCIL_FAIL_KEEP (0 << 16) +# define RADEON_STENCIL_FAIL_ZERO (1 << 16) +# define RADEON_STENCIL_FAIL_REPLACE (2 << 16) +# define RADEON_STENCIL_FAIL_INC (3 << 16) +# define RADEON_STENCIL_FAIL_DEC (4 << 16) +# define RADEON_STENCIL_FAIL_INVERT (5 << 16) +# define RADEON_STENCIL_FAIL_MASK (0x7 << 16) # define RADEON_STENCIL_ZPASS_KEEP (0 << 20) # define RADEON_STENCIL_ZPASS_ZERO (1 << 20) # define RADEON_STENCIL_ZPASS_REPLACE (2 << 20) # define RADEON_STENCIL_ZPASS_INC (3 << 20) # define RADEON_STENCIL_ZPASS_DEC (4 << 20) # define RADEON_STENCIL_ZPASS_INVERT (5 << 20) -# define RADEON_STENCIL_ZFAIL_KEEP (0 << 20) -# define RADEON_STENCIL_ZFAIL_ZERO (1 << 20) -# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 20) -# define RADEON_STENCIL_ZFAIL_INC (3 << 20) -# define RADEON_STENCIL_ZFAIL_DEC (4 << 20) -# define RADEON_STENCIL_ZFAIL_INVERT (5 << 20) +# define RADEON_STENCIL_ZPASS_MASK (0x7 << 20) +# define RADEON_STENCIL_ZFAIL_KEEP (0 << 24) +# define RADEON_STENCIL_ZFAIL_ZERO (1 << 24) +# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24) +# define RADEON_STENCIL_ZFAIL_INC (3 << 24) +# define RADEON_STENCIL_ZFAIL_DEC (4 << 24) +# define RADEON_STENCIL_ZFAIL_INVERT (5 << 24) +# define RADEON_STENCIL_ZFAIL_MASK (0x7 << 24) # define RADEON_Z_COMPRESSION_ENABLE (1 << 28) # define RADEON_FORCE_Z_DIRTY (1 << 29) # define RADEON_Z_WRITE_ENABLE (1 << 30) -# define RADEON_Z_DECOMPRESSION_ENABLE (1 << 31) #define RADEON_RE_LINE_PATTERN 0x1cd0 # define RADEON_LINE_PATTERN_MASK 0x0000ffff # define RADEON_LINE_REPEAT_COUNT_SHIFT 16 @@ -1576,7 +1607,7 @@ # define RADEON_VC_32BIT_SWAP (2 << 0) # define RADEON_VC_HALF_DWORD_SWAP (3 << 0) # define RADEON_TCL_BYPASS (1 << 8) -#define RADEON_SE_COORD_FMT 0x15c0 +#define RADEON_SE_COORD_FMT 0x1c50 # define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0) # define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1) # define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8) @@ -1593,6 +1624,24 @@ # define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26) #define RADEON_SE_LINE_WIDTH 0x1db8 #define RADEON_SE_TCL_LIGHT_MODEL_CTL 0x226c +# define RADEON_LIGHTING_ENABLE (1 << 0) +# define RADEON_LIGHT_IN_MODELSPACE (1 << 1) +# define RADEON_LOCAL_VIEWER (1 << 2) +# define RADEON_NORMALIZE_NORMALS (1 << 3) +# define RADEON_RESCALE_NORMALS (1 << 4) +# define RADEON_SPECULAR_LIGHTS (1 << 5) +# define RADEON_DIFFUSE_SPECULAR_COMBINE (1 << 6) +# define RADEON_LIGHT_ALPHA (1 << 7) +# define RADEON_LOCAL_LIGHT_VEC_GL (1 << 8) +# define RADEON_LIGHT_NO_NORMAL_AMBIENT_ONLY (1 << 9) +# define RADEON_LM_SOURCE_STATE_PREMULT 0 +# define RADEON_LM_SOURCE_STATE_MULT 1 +# define RADEON_LM_SOURCE_VERTEX_DIFFUSE 2 +# define RADEON_LM_SOURCE_VERTEX_SPECULAR 3 +# define RADEON_EMISSIVE_SOURCE_SHIFT 16 +# define RADEON_AMBIENT_SOURCE_SHIFT 18 +# define RADEON_DIFFUSE_SOURCE_SHIFT 20 +# define RADEON_SPECULAR_SOURCE_SHIFT 22 #define RADEON_SE_TCL_MATERIAL_AMBIENT_RED 0x2220 #define RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN 0x2224 #define RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE 0x2228 @@ -1610,23 +1659,169 @@ #define RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE 0x2248 #define RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA 0x224c #define RADEON_SE_TCL_MATRIX_SELECT_0 0x225c +# define RADEON_MODELVIEW_0_SHIFT 0 +# define RADEON_MODELVIEW_1_SHIFT 4 +# define RADEON_MODELVIEW_2_SHIFT 8 +# define RADEON_MODELVIEW_3_SHIFT 12 +# define RADEON_IT_MODELVIEW_0_SHIFT 16 +# define RADEON_IT_MODELVIEW_1_SHIFT 20 +# define RADEON_IT_MODELVIEW_2_SHIFT 24 +# define RADEON_IT_MODELVIEW_3_SHIFT 28 #define RADEON_SE_TCL_MATRIX_SELECT_1 0x2260 +# define RADEON_MODELPROJECT_0_SHIFT 0 +# define RADEON_MODELPROJECT_1_SHIFT 4 +# define RADEON_MODELPROJECT_2_SHIFT 8 +# define RADEON_MODELPROJECT_3_SHIFT 12 +# define RADEON_TEXMAT_0_SHIFT 16 +# define RADEON_TEXMAT_1_SHIFT 20 +# define RADEON_TEXMAT_2_SHIFT 24 +# define RADEON_TEXMAT_3_SHIFT 28 + + #define RADEON_SE_TCL_OUTPUT_VTX_FMT 0x2254 +# define RADEON_TCL_VTX_W0 (1 << 0) +# define RADEON_TCL_VTX_FP_DIFFUSE (1 << 1) +# define RADEON_TCL_VTX_FP_ALPHA (1 << 2) +# define RADEON_TCL_VTX_PK_DIFFUSE (1 << 3) +# define RADEON_TCL_VTX_FP_SPEC (1 << 4) +# define RADEON_TCL_VTX_FP_FOG (1 << 5) +# define RADEON_TCL_VTX_PK_SPEC (1 << 6) +# define RADEON_TCL_VTX_ST0 (1 << 7) +# define RADEON_TCL_VTX_ST1 (1 << 8) +# define RADEON_TCL_VTX_Q1 (1 << 9) +# define RADEON_TCL_VTX_ST2 (1 << 10) +# define RADEON_TCL_VTX_Q2 (1 << 11) +# define RADEON_TCL_VTX_ST3 (1 << 12) +# define RADEON_TCL_VTX_Q3 (1 << 13) +# define RADEON_TCL_VTX_Q0 (1 << 14) +# define RADEON_TCL_VTX_WEIGHT_COUNT_SHIFT 15 +# define RADEON_TCL_VTX_NORM0 (1 << 18) +# define RADEON_TCL_VTX_XY1 (1 << 27) +# define RADEON_TCL_VTX_Z1 (1 << 28) +# define RADEON_TCL_VTX_W1 (1 << 29) +# define RADEON_TCL_VTX_NORM1 (1 << 30) +# define RADEON_TCL_VTX_Z0 (1 << 31) + #define RADEON_SE_TCL_OUTPUT_VTX_SEL 0x2258 +# define RADEON_TCL_COMPUTE_XYZW (1 << 0) +# define RADEON_TCL_COMPUTE_DIFFUSE (1 << 1) +# define RADEON_TCL_COMPUTE_SPECULAR (1 << 2) +# define RADEON_TCL_FORCE_NAN_IF_COLOR_NAN (1 << 3) +# define RADEON_TCL_FORCE_INORDER_PROC (1 << 4) +# define RADEON_TCL_TEX_INPUT_TEX_0 0 +# define RADEON_TCL_TEX_INPUT_TEX_1 1 +# define RADEON_TCL_TEX_INPUT_TEX_2 2 +# define RADEON_TCL_TEX_INPUT_TEX_3 3 +# define RADEON_TCL_TEX_COMPUTED_TEX_0 8 +# define RADEON_TCL_TEX_COMPUTED_TEX_1 9 +# define RADEON_TCL_TEX_COMPUTED_TEX_2 10 +# define RADEON_TCL_TEX_COMPUTED_TEX_3 11 +# define RADEON_TCL_TEX_0_OUTPUT_SHIFT 16 +# define RADEON_TCL_TEX_1_OUTPUT_SHIFT 20 +# define RADEON_TCL_TEX_2_OUTPUT_SHIFT 24 +# define RADEON_TCL_TEX_3_OUTPUT_SHIFT 28 + #define RADEON_SE_TCL_PER_LIGHT_CTL_0 0x2270 +# define RADEON_LIGHT_0_ENABLE (1 << 0) +# define RADEON_LIGHT_0_ENABLE_AMBIENT (1 << 1) +# define RADEON_LIGHT_0_ENABLE_SPECULAR (1 << 2) +# define RADEON_LIGHT_0_IS_LOCAL (1 << 3) +# define RADEON_LIGHT_0_IS_SPOT (1 << 4) +# define RADEON_LIGHT_0_DUAL_CONE (1 << 5) +# define RADEON_LIGHT_0_ENABLE_RANGE_ATTEN (1 << 6) +# define RADEON_LIGHT_0_CONSTANT_RANGE_ATTEN (1 << 7) +# define RADEON_LIGHT_0_SHIFT 0 +# define RADEON_LIGHT_1_ENABLE (1 << 16) +# define RADEON_LIGHT_1_ENABLE_AMBIENT (1 << 17) +# define RADEON_LIGHT_1_ENABLE_SPECULAR (1 << 18) +# define RADEON_LIGHT_1_IS_LOCAL (1 << 19) +# define RADEON_LIGHT_1_IS_SPOT (1 << 20) +# define RADEON_LIGHT_1_DUAL_CONE (1 << 21) +# define RADEON_LIGHT_1_ENABLE_RANGE_ATTEN (1 << 22) +# define RADEON_LIGHT_1_CONSTANT_RANGE_ATTEN (1 << 23) +# define RADEON_LIGHT_1_SHIFT 16 #define RADEON_SE_TCL_PER_LIGHT_CTL_1 0x2274 +# define RADEON_LIGHT_2_SHIFT 0 +# define RADEON_LIGHT_3_SHIFT 16 #define RADEON_SE_TCL_PER_LIGHT_CTL_2 0x2278 +# define RADEON_LIGHT_4_SHIFT 0 +# define RADEON_LIGHT_5_SHIFT 16 #define RADEON_SE_TCL_PER_LIGHT_CTL_3 0x227c +# define RADEON_LIGHT_6_SHIFT 0 +# define RADEON_LIGHT_7_SHIFT 16 + #define RADEON_SE_TCL_SHININESS 0x2250 + #define RADEON_SE_TCL_TEXTURE_PROC_CTL 0x2268 +# define RADEON_TEXGEN_TEXMAT_0_ENABLE (1 << 0) +# define RADEON_TEXGEN_TEXMAT_1_ENABLE (1 << 1) +# define RADEON_TEXGEN_TEXMAT_2_ENABLE (1 << 2) +# define RADEON_TEXGEN_TEXMAT_3_ENABLE (1 << 3) +# define RADEON_TEXMAT_0_ENABLE (1 << 4) +# define RADEON_TEXMAT_1_ENABLE (1 << 5) +# define RADEON_TEXMAT_2_ENABLE (1 << 6) +# define RADEON_TEXMAT_3_ENABLE (1 << 7) +# define RADEON_TEXGEN_INPUT_MASK 0xf +# define RADEON_TEXGEN_INPUT_TEXCOORD_0 0 +# define RADEON_TEXGEN_INPUT_TEXCOORD_1 1 +# define RADEON_TEXGEN_INPUT_TEXCOORD_2 2 +# define RADEON_TEXGEN_INPUT_TEXCOORD_3 3 +# define RADEON_TEXGEN_INPUT_OBJ 4 +# define RADEON_TEXGEN_INPUT_EYE 5 +# define RADEON_TEXGEN_INPUT_EYE_NORMAL 6 +# define RADEON_TEXGEN_INPUT_EYE_REFLECT 7 +# define RADEON_TEXGEN_INPUT_EYE_NORMALIZED 8 +# define RADEON_TEXGEN_0_INPUT_SHIFT 16 +# define RADEON_TEXGEN_1_INPUT_SHIFT 20 +# define RADEON_TEXGEN_2_INPUT_SHIFT 24 +# define RADEON_TEXGEN_3_INPUT_SHIFT 28 + #define RADEON_SE_TCL_UCP_VERT_BLEND_CTL 0x2264 +# define RADEON_UCP_IN_CLIP_SPACE (1 << 0) +# define RADEON_UCP_IN_MODEL_SPACE (1 << 1) +# define RADEON_UCP_ENABLE_0 (1 << 2) +# define RADEON_UCP_ENABLE_1 (1 << 3) +# define RADEON_UCP_ENABLE_2 (1 << 4) +# define RADEON_UCP_ENABLE_3 (1 << 5) +# define RADEON_UCP_ENABLE_4 (1 << 6) +# define RADEON_UCP_ENABLE_5 (1 << 7) +# define RADEON_TCL_FOG_MASK (3 << 8) +# define RADEON_TCL_FOG_DISABLE (0 << 8) +# define RADEON_TCL_FOG_EXP (1 << 8) +# define RADEON_TCL_FOG_EXP2 (2 << 8) +# define RADEON_TCL_FOG_LINEAR (3 << 8) +# define RADEON_RNG_BASED_FOG (1 << 10) +# define RADEON_LIGHT_TWOSIDE (1 << 11) +# define RADEON_BLEND_OP_COUNT_MASK (7 << 12) +# define RADEON_BLEND_OP_COUNT_SHIFT 12 +# define RADEON_POSITION_BLEND_OP_ENABLE (1 << 16) +# define RADEON_NORMAL_BLEND_OP_ENABLE (1 << 17) +# define RADEON_VERTEX_BLEND_SRC_0_PRIMARY (1 << 18) +# define RADEON_VERTEX_BLEND_SRC_0_SECONDARY (1 << 18) +# define RADEON_VERTEX_BLEND_SRC_1_PRIMARY (1 << 19) +# define RADEON_VERTEX_BLEND_SRC_1_SECONDARY (1 << 19) +# define RADEON_VERTEX_BLEND_SRC_2_PRIMARY (1 << 20) +# define RADEON_VERTEX_BLEND_SRC_2_SECONDARY (1 << 20) +# define RADEON_VERTEX_BLEND_SRC_3_PRIMARY (1 << 21) +# define RADEON_VERTEX_BLEND_SRC_3_SECONDARY (1 << 21) +# define RADEON_VERTEX_BLEND_WGT_MINUS_ONE (1 << 22) +# define RADEON_CULL_FRONT_IS_CW (0 << 28) +# define RADEON_CULL_FRONT_IS_CCW (1 << 28) +# define RADEON_CULL_FRONT (1 << 29) +# define RADEON_CULL_BACK (1 << 30) +# define RADEON_FORCE_W_TO_ONE (1 << 31) + #define RADEON_SE_VPORT_XSCALE 0x1d98 #define RADEON_SE_VPORT_XOFFSET 0x1d9c #define RADEON_SE_VPORT_YSCALE 0x1da0 #define RADEON_SE_VPORT_YOFFSET 0x1da4 #define RADEON_SE_VPORT_ZSCALE 0x1da8 #define RADEON_SE_VPORT_ZOFFSET 0x1dac +#define RADEON_SE_ZBIAS_FACTOR 0x1db0 +#define RADEON_SE_ZBIAS_CONSTANT 0x1db4 + + /* Registers for CP and Microcode Engine */ #define RADEON_CP_ME_RAM_ADDR 0x07d4 #define RADEON_CP_ME_RAM_RADDR 0x07d8 @@ -1643,36 +1838,40 @@ #define RADEON_CP_IB_BUFSZ 0x073c #define RADEON_CP_CSQ_CNTL 0x0740 -# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) -# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) -# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) -# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) -# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) -# define RADEON_CSQ_PRIBM_INDBM (4 << 28) -# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) +# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) +# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) +# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) +# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) +# define RADEON_CSQ_PRIBM_INDBM (4 << 28) +# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) #define RADEON_CP_CSQ_STAT 0x07f8 -# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0) -# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8) -# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16) -# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24) +# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8) +# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16) +# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24) #define RADEON_CP_CSQ_ADDR 0x07f0 #define RADEON_CP_CSQ_DATA 0x07f4 #define RADEON_CP_CSQ_APER_PRIMARY 0x1000 #define RADEON_CP_CSQ_APER_INDIRECT 0x1300 #define RADEON_CP_RB_WPTR_DELAY 0x0718 -# define RADEON_PRE_WRITE_TIMER_SHIFT 0 -# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 +# define RADEON_PRE_WRITE_TIMER_SHIFT 0 +# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 #define RADEON_AIC_CNTL 0x01d0 -# define RADEON_PCIGART_TRANSLATE_EN (1 << 0) +# define RADEON_PCIGART_TRANSLATE_EN (1 << 0) + + /* Constants */ #define RADEON_AGP_TEX_OFFSET 0x02000000 #define RADEON_LAST_FRAME_REG RADEON_GUI_SCRATCH_REG0 #define RADEON_LAST_CLEAR_REG RADEON_GUI_SCRATCH_REG2 + + /* CP packet types */ #define RADEON_CP_PACKET0 0x00000000 #define RADEON_CP_PACKET1 0x40000000 @@ -1693,14 +1892,12 @@ #define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00 #define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300 #define RADEON_CP_PACKET3_LOAD_MICROCODE 0xC0002400 -#define RADEON_CP_PACKET3_3D_RNDR_GEN_PRIM 0xC0002500 #define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xC0002600 #define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xC0002800 #define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xC0002900 #define RADEON_CP_PACKET3_3D_DRAW_INDX 0xC0002A00 #define RADEON_CP_PACKET3_LOAD_PALETTE 0xC0002C00 #define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00 -#define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xC0003200 #define RADEON_CP_PACKET3_CNTL_PAINT 0xC0009100 #define RADEON_CP_PACKET3_CNTL_BITBLT 0xC0009200 #define RADEON_CP_PACKET3_CNTL_SMALLTEXT 0xC0009300 @@ -1743,7 +1940,7 @@ #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2 0x00000007 #define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008 #define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009 #define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a @@ -1755,7 +1952,47 @@ #define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080 #define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000 #define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100 +#define RADEON_CP_VC_CNTL_TCL_DISABLE 0x00000000 +#define RADEON_CP_VC_CNTL_TCL_ENABLE 0x00000200 #define RADEON_CP_VC_CNTL_NUM_SHIFT 16 -#endif +#define RADEON_VS_MATRIX_0_ADDR 0 +#define RADEON_VS_MATRIX_1_ADDR 4 +#define RADEON_VS_MATRIX_2_ADDR 8 +#define RADEON_VS_MATRIX_3_ADDR 12 +#define RADEON_VS_MATRIX_4_ADDR 16 +#define RADEON_VS_MATRIX_5_ADDR 20 +#define RADEON_VS_MATRIX_6_ADDR 24 +#define RADEON_VS_MATRIX_7_ADDR 28 +#define RADEON_VS_MATRIX_8_ADDR 32 +#define RADEON_VS_MATRIX_9_ADDR 36 +#define RADEON_VS_MATRIX_10_ADDR 40 +#define RADEON_VS_MATRIX_11_ADDR 44 +#define RADEON_VS_MATRIX_12_ADDR 48 +#define RADEON_VS_MATRIX_13_ADDR 52 +#define RADEON_VS_MATRIX_14_ADDR 56 +#define RADEON_VS_MATRIX_15_ADDR 60 +#define RADEON_VS_LIGHT_AMBIENT_ADDR 64 +#define RADEON_VS_LIGHT_DIFFUSE_ADDR 72 +#define RADEON_VS_LIGHT_SPECULAR_ADDR 80 +#define RADEON_VS_LIGHT_DIRPOS_ADDR 88 +#define RADEON_VS_LIGHT_HWVSPOT_ADDR 96 +#define RADEON_VS_LIGHT_ATTENUATION_ADDR 104 +#define RADEON_VS_MATRIX_EYE2CLIP_ADDR 112 +#define RADEON_VS_UCP_ADDR 116 +#define RADEON_VS_GLOBAL_AMBIENT_ADDR 122 +#define RADEON_VS_FOG_PARAM_ADDR 123 +#define RADEON_VS_EYE_VECTOR_ADDR 124 + +#define RADEON_SS_LIGHT_DCD_ADDR 0 +#define RADEON_SS_LIGHT_SPOT_EXPONENT_ADDR 8 +#define RADEON_SS_LIGHT_SPOT_CUTOFF_ADDR 16 +#define RADEON_SS_LIGHT_SPECULAR_THRESH_ADDR 24 +#define RADEON_SS_LIGHT_RANGE_CUTOFF_ADDR 32 +#define RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR 48 +#define RADEON_SS_VERT_GUARD_DISCARD_ADJ_ADDR 49 +#define RADEON_SS_HORZ_GUARD_CLIP_ADJ_ADDR 50 +#define RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 51 +#define RADEON_SS_SHININESS 60 +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h:1.2 Wed Mar 21 12:02:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h Wed Oct 30 07:52:14 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.5 2002/10/30 12:52:14 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -20,7 +20,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER @@ -29,7 +29,7 @@ /* * Authors: - * Kevin E. Martin <martin@valinux.com> + * Kevin E. Martin <martin@xfree86.org> * Gareth Hughes <gareth@valinux.com> * */ @@ -43,8 +43,7 @@ #ifndef __RADEON_SAREA_DEFINES__ #define __RADEON_SAREA_DEFINES__ -/* What needs to be changed for the current vertex buffer? - */ +/* What needs to be changed for the current vertex buffer? */ #define RADEON_UPLOAD_CONTEXT 0x00000001 #define RADEON_UPLOAD_VERTFMT 0x00000002 #define RADEON_UPLOAD_LINE 0x00000004 @@ -62,14 +61,16 @@ #define RADEON_UPLOAD_TEX2IMAGES 0x00004000 #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ #define RADEON_REQUIRE_QUIESCENCE 0x00010000 -#define RADEON_UPLOAD_ALL 0x0001ffff +#define RADEON_UPLOAD_ZBIAS 0x00020000 +#define RADEON_UPLOAD_ALL 0x0002ffff +#define RADEON_UPLOAD_CONTEXT_ALL 0x000201ff #define RADEON_FRONT 0x1 #define RADEON_BACK 0x2 #define RADEON_DEPTH 0x4 +#define RADEON_STENCIL 0x8 -/* Primitive types - */ +/* Primitive types */ #define RADEON_POINTS 0x1 #define RADEON_LINES 0x2 #define RADEON_LINE_STRIP 0x3 @@ -79,19 +80,16 @@ #define RADEON_3VTX_POINTS 0x9 #define RADEON_3VTX_LINES 0xa -/* Vertex/indirect buffer size - */ +/* Vertex/indirect buffer size */ #define RADEON_BUFFER_SIZE 65536 -/* Byte offsets for indirect buffer data - */ +/* Byte offsets for indirect buffer data */ #define RADEON_INDEX_PRIM_OFFSET 20 #define RADEON_HOSTDATA_BLIT_OFFSET 32 #define RADEON_SCRATCH_REG_OFFSET 32 -/* Keep these small for testing - */ +/* Keep these small for testing */ #define RADEON_NR_SAREA_CLIPRECTS 12 /* There are 2 heaps (local/AGP). Each region within a heap is a @@ -103,7 +101,7 @@ #define RADEON_NR_TEX_REGIONS 64 #define RADEON_LOG_TEX_GRANULARITY 16 -#define RADEON_MAX_TEXTURE_LEVELS 11 +#define RADEON_MAX_TEXTURE_LEVELS 12 #define RADEON_MAX_TEXTURE_UNITS 3 /* Blits have strict offset rules. All blit offset must be aligned on @@ -170,23 +168,6 @@ /* Setup state */ unsigned int se_cntl_status; -#ifdef TCL_ENABLE - /* TCL state */ - radeon_color_regs_t se_tcl_material_emmissive; - radeon_color_regs_t se_tcl_material_ambient; - radeon_color_regs_t se_tcl_material_diffuse; - radeon_color_regs_t se_tcl_material_specular; - unsigned int se_tcl_shininess; - unsigned int se_tcl_output_vtx_fmt; - unsigned int se_tcl_output_vtx_sel; - unsigned int se_tcl_matrix_select_0; - unsigned int se_tcl_matrix_select_1; - unsigned int se_tcl_ucp_vert_blend_ctl; - unsigned int se_tcl_texture_proc_ctl; - unsigned int se_tcl_light_model_ctl; - unsigned int se_tcl_per_light_ctl[4]; -#endif - /* Misc state */ unsigned int re_top_left; unsigned int re_misc; @@ -200,13 +181,7 @@ unsigned int pp_txcblend; unsigned int pp_txablend; unsigned int pp_tfactor; - unsigned int pp_border_color; - -#ifdef CUBIC_ENABLE - unsigned int pp_cubic_faces; - unsigned int pp_cubic_offset[5]; -#endif } radeon_texture_regs_t; typedef struct { @@ -225,13 +200,11 @@ unsigned int vertsize; unsigned int vc_format; - /* The current cliprects, or a subset thereof - */ + /* The current cliprects, or a subset thereof */ XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS]; unsigned int nbox; - /* Counters for throttling of rendering clients - */ + /* Counters for throttling of rendering clients */ unsigned int last_frame; unsigned int last_dispatch; unsigned int last_clear; @@ -256,6 +229,9 @@ int texAge[RADEON_NR_TEX_HEAPS]; int ctxOwner; /* last context to upload state */ + int pfAllowPageFlip; /* set by the 2d driver, read by the client */ + int pfCurrentPage; /* set by kernel, read by others */ + int crtc2_base; /* for pageflipping with CloneMode */ } RADEONSAREAPriv, *RADEONSAREAPrivPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.3 Wed Jan 16 11:22:28 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h Wed Jan 1 14:16:35 2003 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h,v 1.8 2003/01/01 19:16:35 tsi Exp $ */ /* - * Copyright 2000 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,18 +24,40 @@ #ifndef _RADEON_VERSION_H_ #define _RADEON_VERSION_H_ 1 +#undef RADEON_NAME +#undef RADEON_DRIVER_NAME +#undef R200_DRIVER_NAME +#undef RADEON_VERSION_MAJOR +#undef RADEON_VERSION_MINOR +#undef RADEON_VERSION_PATCH +#undef RADEON_VERSION_CURRENT +#undef RADEON_VERSION_EVALUATE +#undef RADEON_VERSION_STRINGIFY +#undef RADEON_VERSION_NAME + #define RADEON_NAME "RADEON" #define RADEON_DRIVER_NAME "radeon" - -#define RADEON_VERSION_NAME "4.0.1" +#define R200_DRIVER_NAME "r200" +#define RV250_DRIVER_NAME "r200" #define RADEON_VERSION_MAJOR 4 #define RADEON_VERSION_MINOR 0 #define RADEON_VERSION_PATCH 1 +#ifndef RADEON_VERSION_EXTRA +#define RADEON_VERSION_EXTRA "" +#endif + #define RADEON_VERSION_CURRENT \ ((RADEON_VERSION_MAJOR << 20) | \ (RADEON_VERSION_MINOR << 10) | \ (RADEON_VERSION_PATCH)) + +#define RADEON_VERSION_EVALUATE(__x) #__x +#define RADEON_VERSION_STRINGIFY(_x) RADEON_VERSION_EVALUATE(_x) +#define RADEON_VERSION_NAME \ + RADEON_VERSION_STRINGIFY(RADEON_VERSION_MAJOR) "." \ + RADEON_VERSION_STRINGIFY(RADEON_VERSION_MINOR) "." \ + RADEON_VERSION_STRINGIFY(RADEON_VERSION_PATCH) RADEON_VERSION_EXTRA #endif /* _RADEON_VERSION_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.12 Wed Jul 18 22:22:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c Tue Feb 18 20:19:43 2003 @@ -1,6 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.12 2001/07/19 02:22:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.24 2003/02/19 01:19:43 dawes Exp $ */ #include "radeon.h" +#include "radeon_macros.h" +#include "radeon_probe.h" #include "radeon_reg.h" #include "xf86.h" @@ -18,10 +20,14 @@ #define TIMER_MASK (OFF_TIMER | FREE_TIMER) +extern int gRADEONEntityIndex; + #ifndef XvExtension void RADEONInitVideo(ScreenPtr pScreen) {} #else +static void RADEONInitOffscreenImages(ScreenPtr); + static XF86VideoAdaptorPtr RADEONSetupImageVideo(ScreenPtr); static int RADEONSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); static int RADEONGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); @@ -39,26 +45,37 @@ static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now); - #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) static Atom xvBrightness, xvColorKey, xvSaturation, xvDoubleBuffer; +static Atom xvRedIntensity, xvGreenIntensity, xvBlueIntensity; +static Atom xvContrast, xvHue, xvColor, xvAutopaintColorkey, xvSetDefaults; - typedef struct { + CARD32 transform_index; int brightness; int saturation; + int hue; + int contrast; + int red_intensity; + int green_intensity; + int blue_intensity; + int ecp_div; + Bool doubleBuffer; unsigned char currentBuffer; - FBLinearPtr linear; RegionRec clip; CARD32 colorKey; CARD32 videoStatus; Time offTime; Time freeTime; + Bool autopaint_colorkey; } RADEONPortPrivRec, *RADEONPortPrivPtr; +#define GET_PORT_PRIVATE(pScrn) \ + (RADEONPortPrivPtr)((RADEONPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + void RADEONInitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -67,9 +84,11 @@ XF86VideoAdaptorPtr newAdaptor = NULL; int num_adaptors; - if(info->accel && info->accel->FillSolidRects) + if(info->accel && info->accel->FillSolidRects) + { newAdaptor = RADEONSetupImageVideo(pScreen); - + RADEONInitOffscreenImages(pScreen); + } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); if(newAdaptor) { @@ -116,26 +135,251 @@ }; -#define NUM_ATTRIBUTES 4 +#define NUM_ATTRIBUTES 9+3 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, - {XvSettable | XvGettable, -64, 63, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, 0, 31, "XV_SATURATION"}, - {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"} + {XvSettable , 0, 1, "XV_SET_DEFAULTS"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, + {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"}, + {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}, + {XvSettable | XvGettable, -1000, 1000, "XV_COLOR"}, + {XvSettable | XvGettable, -1000, 1000, "XV_HUE"}, + {XvSettable | XvGettable, -1000, 1000, "XV_RED_INTENSITY"}, + {XvSettable | XvGettable, -1000, 1000, "XV_GREEN_INTENSITY"}, + {XvSettable | XvGettable, -1000, 1000, "XV_BLUE_INTENSITY"}, }; #define NUM_IMAGES 4 static XF86ImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + XVIMAGE_UYVY, + XVIMAGE_YV12, + XVIMAGE_I420 +}; + +/* Reference color space transform data */ +typedef struct tagREF_TRANSFORM { - XVIMAGE_YUY2, - XVIMAGE_UYVY, - XVIMAGE_YV12, - XVIMAGE_I420 + float RefLuma; + float RefRCb; + float RefRCr; + float RefGCb; + float RefGCr; + float RefBCb; + float RefBCr; +} REF_TRANSFORM; + +/* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces */ +REF_TRANSFORM trans[2] = +{ + {1.1678, 0.0, 1.6007, -0.3929, -0.8154, 2.0232, 0.0}, /* BT.601 */ + {1.1678, 0.0, 1.7980, -0.2139, -0.5345, 2.1186, 0.0} /* BT.709 */ +}; + + +/* Gamma curve definition */ +typedef struct +{ + unsigned int gammaReg; + unsigned int gammaSlope; + unsigned int gammaOffset; +} GAMMA_SETTINGS; + +/* Recommended gamma curve parameters */ +GAMMA_SETTINGS def_gamma[18] = +{ + {RADEON_OV0_GAMMA_000_00F, 0x100, 0x0000}, + {RADEON_OV0_GAMMA_010_01F, 0x100, 0x0020}, + {RADEON_OV0_GAMMA_020_03F, 0x100, 0x0040}, + {RADEON_OV0_GAMMA_040_07F, 0x100, 0x0080}, + {RADEON_OV0_GAMMA_080_0BF, 0x100, 0x0100}, + {RADEON_OV0_GAMMA_0C0_0FF, 0x100, 0x0100}, + {RADEON_OV0_GAMMA_100_13F, 0x100, 0x0200}, + {RADEON_OV0_GAMMA_140_17F, 0x100, 0x0200}, + {RADEON_OV0_GAMMA_180_1BF, 0x100, 0x0300}, + {RADEON_OV0_GAMMA_1C0_1FF, 0x100, 0x0300}, + {RADEON_OV0_GAMMA_200_23F, 0x100, 0x0400}, + {RADEON_OV0_GAMMA_240_27F, 0x100, 0x0400}, + {RADEON_OV0_GAMMA_280_2BF, 0x100, 0x0500}, + {RADEON_OV0_GAMMA_2C0_2FF, 0x100, 0x0500}, + {RADEON_OV0_GAMMA_300_33F, 0x100, 0x0600}, + {RADEON_OV0_GAMMA_340_37F, 0x100, 0x0600}, + {RADEON_OV0_GAMMA_380_3BF, 0x100, 0x0700}, + {RADEON_OV0_GAMMA_3C0_3FF, 0x100, 0x0700} }; +/**************************************************************************** + * SetTransform * + * Function: Calculates and sets color space transform from supplied * + * reference transform, gamma, brightness, contrast, hue and * + * saturation. * + * Inputs: bright - brightness * + * cont - contrast * + * sat - saturation * + * hue - hue * + * red_intensity - intensity of red component * + * green_intensity - intensity of green component * + * blue_intensity - intensity of blue component * + * ref - index to the table of refernce transforms * + * Outputs: NONE * + ****************************************************************************/ + +static void RADEONSetTransform (ScrnInfoPtr pScrn, + float bright, + float cont, + float sat, + float hue, + float red_intensity, + float green_intensity, + float blue_intensity, + CARD32 ref) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + float OvHueSin, OvHueCos; + float CAdjLuma, CAdjOff; + float CAdjRCb, CAdjRCr; + float CAdjGCb, CAdjGCr; + float CAdjBCb, CAdjBCr; + float RedAdj,GreenAdj,BlueAdj; + float OvLuma, OvROff, OvGOff, OvBOff; + float OvRCb, OvRCr; + float OvGCb, OvGCr; + float OvBCb, OvBCr; + float Loff = 64.0; + float Coff = 512.0f; + + CARD32 dwOvLuma, dwOvROff, dwOvGOff, dwOvBOff; + CARD32 dwOvRCb, dwOvRCr; + CARD32 dwOvGCb, dwOvGCr; + CARD32 dwOvBCb, dwOvBCr; + + if (ref >= 2) + return; + + OvHueSin = sin(hue); + OvHueCos = cos(hue); + + CAdjLuma = cont * trans[ref].RefLuma; + CAdjOff = cont * trans[ref].RefLuma * bright * 1023.0; + RedAdj = cont * trans[ref].RefLuma * red_intensity * 1023.0; + GreenAdj = cont * trans[ref].RefLuma * green_intensity * 1023.0; + BlueAdj = cont * trans[ref].RefLuma * blue_intensity * 1023.0; + + CAdjRCb = sat * -OvHueSin * trans[ref].RefRCr; + CAdjRCr = sat * OvHueCos * trans[ref].RefRCr; + CAdjGCb = sat * (OvHueCos * trans[ref].RefGCb - OvHueSin * trans[ref].RefGCr); + CAdjGCr = sat * (OvHueSin * trans[ref].RefGCb + OvHueCos * trans[ref].RefGCr); + CAdjBCb = sat * OvHueCos * trans[ref].RefBCb; + CAdjBCr = sat * OvHueSin * trans[ref].RefBCb; + +#if 0 /* default constants */ + CAdjLuma = 1.16455078125; + + CAdjRCb = 0.0; + CAdjRCr = 1.59619140625; + CAdjGCb = -0.39111328125; + CAdjGCr = -0.8125; + CAdjBCb = 2.01708984375; + CAdjBCr = 0; +#endif + OvLuma = CAdjLuma; + OvRCb = CAdjRCb; + OvRCr = CAdjRCr; + OvGCb = CAdjGCb; + OvGCr = CAdjGCr; + OvBCb = CAdjBCb; + OvBCr = CAdjBCr; + OvROff = RedAdj + CAdjOff - + OvLuma * Loff - (OvRCb + OvRCr) * Coff; + OvGOff = GreenAdj + CAdjOff - + OvLuma * Loff - (OvGCb + OvGCr) * Coff; + OvBOff = BlueAdj + CAdjOff - + OvLuma * Loff - (OvBCb + OvBCr) * Coff; +#if 0 /* default constants */ + OvROff = -888.5; + OvGOff = 545; + OvBOff = -1104; +#endif + + dwOvROff = ((INT32)(OvROff * 2.0)) & 0x1fff; + dwOvGOff = ((INT32)(OvGOff * 2.0)) & 0x1fff; + dwOvBOff = ((INT32)(OvBOff * 2.0)) & 0x1fff; + /* + * Whatever docs say about R200 having 3.8 format instead of 3.11 + * as in Radeon is a lie + * Or more precisely the location of bit fields is a lie + */ + if(1 || info->ChipFamily < CHIP_FAMILY_R200) + { + dwOvLuma =(((INT32)(OvLuma * 2048.0))&0x7fff)<<17; + dwOvRCb = (((INT32)(OvRCb * 2048.0))&0x7fff)<<1; + dwOvRCr = (((INT32)(OvRCr * 2048.0))&0x7fff)<<17; + dwOvGCb = (((INT32)(OvGCb * 2048.0))&0x7fff)<<1; + dwOvGCr = (((INT32)(OvGCr * 2048.0))&0x7fff)<<17; + dwOvBCb = (((INT32)(OvBCb * 2048.0))&0x7fff)<<1; + dwOvBCr = (((INT32)(OvBCr * 2048.0))&0x7fff)<<17; + } + else + { + dwOvLuma = (((INT32)(OvLuma * 256.0))&0x7ff)<<20; + dwOvRCb = (((INT32)(OvRCb * 256.0))&0x7ff)<<4; + dwOvRCr = (((INT32)(OvRCr * 256.0))&0x7ff)<<20; + dwOvGCb = (((INT32)(OvGCb * 256.0))&0x7ff)<<4; + dwOvGCr = (((INT32)(OvGCr * 256.0))&0x7ff)<<20; + dwOvBCb = (((INT32)(OvBCb * 256.0))&0x7ff)<<4; + dwOvBCr = (((INT32)(OvBCr * 256.0))&0x7ff)<<20; + } + OUTREG(RADEON_OV0_LIN_TRANS_A, dwOvRCb | dwOvLuma); + OUTREG(RADEON_OV0_LIN_TRANS_B, dwOvROff | dwOvRCr); + OUTREG(RADEON_OV0_LIN_TRANS_C, dwOvGCb | dwOvLuma); + OUTREG(RADEON_OV0_LIN_TRANS_D, dwOvGOff | dwOvGCr); + OUTREG(RADEON_OV0_LIN_TRANS_E, dwOvBCb | dwOvLuma); + OUTREG(RADEON_OV0_LIN_TRANS_F, dwOvBOff | dwOvBCr); +} + +static void RADEONSetColorKey(ScrnInfoPtr pScrn, CARD32 colorKey) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 min, max; + CARD8 r, g, b; + + if (info->CurrentLayout.depth > 8) + { + CARD32 rbits, gbits, bbits; + + rbits = (colorKey & pScrn->mask.red) >> pScrn->offset.red; + gbits = (colorKey & pScrn->mask.green) >> pScrn->offset.green; + bbits = (colorKey & pScrn->mask.blue) >> pScrn->offset.blue; + + r = rbits << (8 - pScrn->weight.red); + g = gbits << (8 - pScrn->weight.green); + b = bbits << (8 - pScrn->weight.blue); + } + else + { + CARD32 bits; + + bits = colorKey & ((1 << info->CurrentLayout.depth) - 1); + r = bits; + g = bits; + b = bits; + } + min = (r << 16) | (g << 8) | (b); + max = (0xff << 24) | (r << 16) | (g << 8) | (b); + + RADEONWaitForFifo(pScrn, 2); + OUTREG(RADEON_OV0_GRAPHICS_KEY_CLR_HIGH, max); + OUTREG(RADEON_OV0_GRAPHICS_KEY_CLR_LOW, min); +} + static void RADEONResetVideo(ScrnInfoPtr pScrn) { @@ -143,18 +387,51 @@ unsigned char *RADEONMMIO = info->MMIO; RADEONPortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; + if (info->accelOn) info->accel->Sync(pScrn); + RADEONWaitForIdleMMIO(pScrn); OUTREG(RADEON_OV0_SCALE_CNTL, 0x80000000); - OUTREG(RADEON_OV0_EXCLUSIVE_HORZ, 0); OUTREG(RADEON_OV0_AUTO_FLIP_CNTL, 0); /* maybe */ + OUTREG(RADEON_OV0_EXCLUSIVE_HORZ, 0); OUTREG(RADEON_OV0_FILTER_CNTL, 0x0000000f); - OUTREG(RADEON_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | - (pPriv->saturation << 8) | - (pPriv->saturation << 16)); - OUTREG(RADEON_OV0_GRAPHICS_KEY_MSK, (1 << pScrn->depth) - 1); - OUTREG(RADEON_OV0_GRAPHICS_KEY_CLR, pPriv->colorKey); - OUTREG(RADEON_OV0_KEY_CNTL, RADEON_GRAPHIC_KEY_FN_NE); + OUTREG(RADEON_OV0_KEY_CNTL, RADEON_GRAPHIC_KEY_FN_EQ | + RADEON_VIDEO_KEY_FN_FALSE | + RADEON_CMP_MIX_OR); OUTREG(RADEON_OV0_TEST, 0); + OUTREG(RADEON_FCP_CNTL, RADEON_FCP0_SRC_GND); + OUTREG(RADEON_CAP0_TRIG_CNTL, 0); + RADEONSetColorKey(pScrn, pPriv->colorKey); + + if (info->ChipFamily == CHIP_FAMILY_R200 || + info->ChipFamily == CHIP_FAMILY_R300) { + int i; + + OUTREG(RADEON_OV0_LIN_TRANS_A, 0x12a20000); + OUTREG(RADEON_OV0_LIN_TRANS_B, 0x198a190e); + OUTREG(RADEON_OV0_LIN_TRANS_C, 0x12a2f9da); + OUTREG(RADEON_OV0_LIN_TRANS_D, 0xf2fe0442); + OUTREG(RADEON_OV0_LIN_TRANS_E, 0x12a22046); + OUTREG(RADEON_OV0_LIN_TRANS_F, 0x175f); + + /* + * Set default Gamma ramp: + * + * Of 18 segments for gamma curve, all segments in R200 (and + * newer) are programmable, while only lower 4 and upper 2 + * segments are programmable in the older Radeons. + */ + for (i = 0; i < 18; i++) { + OUTREG(def_gamma[i].gammaReg, + (def_gamma[i].gammaSlope<<16) | def_gamma[i].gammaOffset); + } + } else { + OUTREG(RADEON_OV0_LIN_TRANS_A, 0x12a00000); + OUTREG(RADEON_OV0_LIN_TRANS_B, 0x1990190e); + OUTREG(RADEON_OV0_LIN_TRANS_C, 0x12a0f9c0); + OUTREG(RADEON_OV0_LIN_TRANS_D, 0xf3000442); + OUTREG(RADEON_OV0_LIN_TRANS_E, 0x12a02040); + OUTREG(RADEON_OV0_LIN_TRANS_F, 0x175f); + } } @@ -164,6 +441,7 @@ XF86VideoAdaptorPtr adapt; RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv; + unsigned char *RADEONMMIO = info->MMIO; if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) return NULL; @@ -177,18 +455,39 @@ adapt->pPortPrivates = (DevUnion*)(&pPriv[1]); adapt->pPortPrivates[0].ptr = (pointer)pPriv; - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvSaturation = MAKE_ATOM("XV_SATURATION"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); - pPriv->colorKey = info->videoKey; pPriv->doubleBuffer = TRUE; pPriv->videoStatus = 0; pPriv->brightness = 0; - pPriv->saturation = 16; + pPriv->transform_index = 0; + pPriv->saturation = 0; + pPriv->contrast = 0; + pPriv->red_intensity = 0; + pPriv->green_intensity = 0; + pPriv->blue_intensity = 0; + pPriv->hue = 0; pPriv->currentBuffer = 0; + pPriv->autopaint_colorkey = TRUE; + + /* + * Unlike older Mach64 chips, RADEON has only two ECP settings: + * 0 for PIXCLK < 175Mhz, and 1 (divide by 2) + * for higher clocks, sure makes life nicer + */ + if(info->ModeReg.dot_clock_freq < 17500) + pPriv->ecp_div = 0; + else + pPriv->ecp_div = 1; +#if 0 + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Dotclock is %g Mhz, setting ecp_div to %d\n", info->ModeReg.dot_clock_freq/100.0, pPriv->ecp_div); +#endif + + OUTPLL(RADEON_VCLK_ECP_CNTL, (INPLL(pScrn, RADEON_VCLK_ECP_CNTL) & + 0xfffffCff) | (pPriv->ecp_div << 8)); + + info->adaptor = adapt; + return adapt; } @@ -196,7 +495,6 @@ RADEONSetupImageVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv; XF86VideoAdaptorPtr adapt; @@ -226,11 +524,23 @@ adapt->PutImage = RADEONPutImage; adapt->QueryImageAttributes = RADEONQueryImageAttributes; - info->adaptor = adapt; - pPriv = (RADEONPortPrivPtr)(adapt->pPortPrivates[0].ptr); REGION_INIT(pScreen, &(pPriv->clip), NullBox, 0); - + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvColor = MAKE_ATOM("XV_COLOR"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + xvHue = MAKE_ATOM("XV_HUE"); + xvRedIntensity = MAKE_ATOM("XV_RED_INTENSITY"); + xvGreenIntensity = MAKE_ATOM("XV_GREEN_INTENSITY"); + xvBlueIntensity = MAKE_ATOM("XV_BLUE_INTENSITY"); + + xvAutopaintColorkey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); + RADEONResetVideo(pScrn); return adapt; @@ -368,11 +678,14 @@ if(cleanup) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + RADEONWaitForFifo(pScrn, 2); OUTREG(RADEON_OV0_SCALE_CNTL, 0); + if (info->cursor_start) + xf86ForceHWCursor (pScrn->pScreen, FALSE); } - if(pPriv->linear) { - xf86FreeOffscreenLinear(pPriv->linear); - pPriv->linear = NULL; + if(info->videoLinear) { + xf86FreeOffscreenLinear(info->videoLinear); + info->videoLinear = NULL; } pPriv->videoStatus = 0; } else { @@ -384,73 +697,143 @@ } static int -RADEONSetPortAttribute( - ScrnInfoPtr pScrn, - Atom attribute, - INT32 value, - pointer data -){ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; +RADEONSetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; + Bool setTransform = FALSE; + + info->accel->Sync(pScrn); + +#define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0) +#define RTFBrightness(a) (((a)*1.0)/2000.0) +#define RTFIntensity(a) (((a)*1.0)/2000.0) +#define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0) +#define RTFHue(a) (((a)*3.1416)/1000.0) +#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v)) - if(attribute == xvBrightness) { - if((value < -64) || (value > 63)) - return BadValue; - pPriv->brightness = value; - OUTREG(RADEON_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | - (pPriv->saturation << 8) | - (pPriv->saturation << 16)); - } else - if(attribute == xvSaturation) { - if((value < 0) || (value > 31)) - return BadValue; - pPriv->saturation = value; - OUTREG(RADEON_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | - (pPriv->saturation << 8) | - (pPriv->saturation << 16)); - } else - if(attribute == xvDoubleBuffer) { - if((value < 0) || (value > 1)) - return BadValue; + if(attribute == xvAutopaintColorkey) + { + pPriv->autopaint_colorkey = ClipValue (value, 0, 1); + } + else if(attribute == xvSetDefaults) + { + pPriv->autopaint_colorkey = TRUE; + pPriv->brightness = 0; + pPriv->saturation = 0; + pPriv->contrast = 0; + pPriv->hue = 0; + pPriv->red_intensity = 0; + pPriv->green_intensity = 0; + pPriv->blue_intensity = 0; + pPriv->doubleBuffer = FALSE; + setTransform = TRUE; + } + else if(attribute == xvBrightness) + { + pPriv->brightness = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if((attribute == xvSaturation) || (attribute == xvColor)) + { + pPriv->saturation = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if(attribute == xvContrast) + { + pPriv->contrast = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if(attribute == xvHue) + { + pPriv->hue = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if(attribute == xvRedIntensity) + { + pPriv->red_intensity = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if(attribute == xvGreenIntensity) + { + pPriv->green_intensity = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if(attribute == xvBlueIntensity) + { + pPriv->blue_intensity = ClipValue (value, -1000, 1000); + setTransform = TRUE; + } + else if(attribute == xvDoubleBuffer) + { + pPriv->doubleBuffer = ClipValue (value, 0, 1); pPriv->doubleBuffer = value; - } else - if(attribute == xvColorKey) { + } + else if(attribute == xvColorKey) + { pPriv->colorKey = value; - OUTREG(RADEON_OV0_GRAPHICS_KEY_CLR, pPriv->colorKey); - + RADEONSetColorKey (pScrn, pPriv->colorKey); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - } else return BadMatch; + } + else + return BadMatch; - return Success; + if (setTransform) + { + RADEONSetTransform(pScrn, + RTFBrightness(pPriv->brightness), + RTFContrast(pPriv->contrast), + RTFSaturation(pPriv->saturation), + RTFHue(pPriv->hue), + RTFIntensity(pPriv->red_intensity), + RTFIntensity(pPriv->green_intensity), + RTFIntensity(pPriv->blue_intensity), + pPriv->transform_index); + } + + return Success; } static int -RADEONGetPortAttribute( - ScrnInfoPtr pScrn, - Atom attribute, - INT32 *value, - pointer data -){ - RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; +RADEONGetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; - if(attribute == xvBrightness) { + if (info->accelOn) info->accel->Sync(pScrn); + + if(attribute == xvAutopaintColorkey) + *value = pPriv->autopaint_colorkey; + else if(attribute == xvBrightness) *value = pPriv->brightness; - } else - if(attribute == xvSaturation) { + else if((attribute == xvSaturation) || (attribute == xvColor)) *value = pPriv->saturation; - } else - if(attribute == xvDoubleBuffer) { + else if(attribute == xvContrast) + *value = pPriv->contrast; + else if(attribute == xvHue) + *value = pPriv->hue; + else if(attribute == xvRedIntensity) + *value = pPriv->red_intensity; + else if(attribute == xvGreenIntensity) + *value = pPriv->green_intensity; + else if(attribute == xvBlueIntensity) + *value = pPriv->blue_intensity; + else if(attribute == xvDoubleBuffer) *value = pPriv->doubleBuffer ? 1 : 0; - } else - if(attribute == xvColorKey) { + else if(attribute == xvColorKey) *value = pPriv->colorKey; - } else return BadMatch; + else + return BadMatch; - return Success; + return Success; } - static void RADEONQueryBestSize( ScrnInfoPtr pScrn, @@ -464,12 +847,11 @@ drw_w = vid_w >> 4; if(vid_h > (drw_h << 4)) drw_h = vid_h >> 4; - + *p_w = drw_w; *p_h = drw_h; } - static void RADEONCopyData( unsigned char *src, @@ -578,7 +960,7 @@ RADEONDisplayVideo( ScrnInfoPtr pScrn, int id, - int offset, + int offset1, int offset2, short width, short height, int pitch, int left, int right, int top, @@ -591,9 +973,30 @@ int v_inc, h_inc, step_by, tmp; int p1_h_accum_init, p23_h_accum_init; int p1_v_accum_init; - - v_inc = (src_h << 20) / drw_h; - h_inc = (src_w << 12) / drw_w; + int ecp_div; + int v_inc_shift; + int y_mult; + int x_off; + CARD32 scaler_src; + + /* Unlike older Mach64 chips, RADEON has only two ECP settings: 0 for PIXCLK < 175Mhz, and 1 (divide by 2) + for higher clocks, sure makes life nicer + + Here we need to find ecp_div again, as the user may have switched resolutions */ + if(info->ModeReg.dot_clock_freq < 17500) + ecp_div = 0; + else + ecp_div = 1; + + OUTPLL(RADEON_VCLK_ECP_CNTL, (INPLL(pScrn, RADEON_VCLK_ECP_CNTL) & 0xfffffCff) | (ecp_div << 8)); + + v_inc_shift = 20; + if (pScrn->currentMode->Flags & V_INTERLACE) + v_inc_shift++; + if (pScrn->currentMode->Flags & V_DBLSCAN) + v_inc_shift--; + v_inc = (src_h << v_inc_shift) / drw_h; + h_inc = ((src_w << (12 + ecp_div)) / drw_w); step_by = 1; while(h_inc >= (2 << 12)) { @@ -603,8 +1006,14 @@ /* keep everything in 16.16 */ - offset += ((left >> 16) & ~7) << 1; + offset1 += ((left >> 16) & ~7) << 1; + offset2 += ((left >> 16) & ~7) << 1; + if (info->IsSecondary) { + offset1 += info->FbMapSize; + offset2 += info->FbMapSize; + } + tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3); p1_h_accum_init = ((tmp << 4) & 0x000f8000) | ((tmp << 12) & 0xf0000000); @@ -617,32 +1026,97 @@ p1_v_accum_init = ((tmp << 4) & 0x03ff8000) | 0x00000001; left = (left >> 16) & 7; - + RADEONWaitForFifo(pScrn, 2); OUTREG(RADEON_OV0_REG_LOAD_CNTL, 1); + if (info->accelOn) info->accel->Sync(pScrn); while(!(INREG(RADEON_OV0_REG_LOAD_CNTL) & (1 << 3))); + RADEONWaitForFifo(pScrn, 14); OUTREG(RADEON_OV0_H_INC, h_inc | ((h_inc >> 1) << 16)); OUTREG(RADEON_OV0_STEP_BY, step_by | (step_by << 8)); - OUTREG(RADEON_OV0_Y_X_START, (dstBox->x1 + 8) | (dstBox->y1 << 16)); - OUTREG(RADEON_OV0_Y_X_END, (dstBox->x2 + 8) | (dstBox->y2 << 16)); + + y_mult = 1; + if (pScrn->currentMode->Flags & V_DBLSCAN) + y_mult = 2; + x_off = 8; + if (info->ChipFamily == CHIP_FAMILY_R200 || + info->ChipFamily == CHIP_FAMILY_R300) + x_off = 0; + + /* Put the hardware overlay on CRTC2: + * + * Since one hardware overlay can not be displayed on two heads + * at the same time, we might need to consider using software + * rendering for the second head. + */ + if ((info->Clone && info->OverlayOnCRTC2) || info->IsSecondary) { + x_off = 0; + OUTREG(RADEON_OV1_Y_X_START, ((dstBox->x1 + + x_off + - info->CloneFrameX0 + + pScrn->frameX0) | + ((dstBox->y1*y_mult - + info->CloneFrameY0 + + pScrn->frameY0) << 16))); + OUTREG(RADEON_OV1_Y_X_END, ((dstBox->x2 + + x_off + - info->CloneFrameX0 + + pScrn->frameX0) | + ((dstBox->y2*y_mult + - info->CloneFrameY0 + + pScrn->frameY0) << 16))); + scaler_src = (1 << 14); + } else { + OUTREG(RADEON_OV0_Y_X_START, ((dstBox->x1 + x_off) | + ((dstBox->y1*y_mult) << 16))); + OUTREG(RADEON_OV0_Y_X_END, ((dstBox->x2 + x_off) | + ((dstBox->y2*y_mult) << 16))); + scaler_src = 0; + } + OUTREG(RADEON_OV0_V_INC, v_inc); OUTREG(RADEON_OV0_P1_BLANK_LINES_AT_TOP, 0x00000fff | ((src_h - 1) << 16)); OUTREG(RADEON_OV0_VID_BUF_PITCH0_VALUE, pitch); + OUTREG(RADEON_OV0_VID_BUF_PITCH1_VALUE, pitch); OUTREG(RADEON_OV0_P1_X_START_END, (src_w + left - 1) | (left << 16)); left >>= 1; src_w >>= 1; OUTREG(RADEON_OV0_P2_X_START_END, (src_w + left - 1) | (left << 16)); OUTREG(RADEON_OV0_P3_X_START_END, (src_w + left - 1) | (left << 16)); - OUTREG(RADEON_OV0_VID_BUF0_BASE_ADRS, offset & 0xfffffff0); + OUTREG(RADEON_OV0_VID_BUF0_BASE_ADRS, offset1 & 0xfffffff0); + OUTREG(RADEON_OV0_VID_BUF1_BASE_ADRS, offset2 & 0xfffffff0); + OUTREG(RADEON_OV0_VID_BUF2_BASE_ADRS, offset1 & 0xfffffff0); + + RADEONWaitForFifo(pScrn, 9); + OUTREG(RADEON_OV0_VID_BUF3_BASE_ADRS, offset2 & 0xfffffff0); + OUTREG(RADEON_OV0_VID_BUF4_BASE_ADRS, offset1 & 0xfffffff0); + OUTREG(RADEON_OV0_VID_BUF5_BASE_ADRS, offset2 & 0xfffffff0); OUTREG(RADEON_OV0_P1_V_ACCUM_INIT, p1_v_accum_init); OUTREG(RADEON_OV0_P1_H_ACCUM_INIT, p1_h_accum_init); OUTREG(RADEON_OV0_P23_H_ACCUM_INIT, p23_h_accum_init); +#if 0 if(id == FOURCC_UYVY) OUTREG(RADEON_OV0_SCALE_CNTL, 0x41008C03); else OUTREG(RADEON_OV0_SCALE_CNTL, 0x41008B03); +#endif + if (id == FOURCC_UYVY) + OUTREG(RADEON_OV0_SCALE_CNTL, (RADEON_SCALER_SOURCE_YVYU422 + | RADEON_SCALER_ADAPTIVE_DEINT + | RADEON_SCALER_SMART_SWITCH + | RADEON_SCALER_DOUBLE_BUFFER + | RADEON_SCALER_ENABLE + | scaler_src)); + else + OUTREG(RADEON_OV0_SCALE_CNTL, (RADEON_SCALER_SOURCE_VYUY422 + | RADEON_SCALER_ADAPTIVE_DEINT + | RADEON_SCALER_SMART_SWITCH + | RADEON_SCALER_DOUBLE_BUFFER + | RADEON_SCALER_ENABLE + | scaler_src)); + OUTREG(RADEON_OV0_REG_LOAD_CNTL, 0); } @@ -668,6 +1142,13 @@ int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned char *RADEONMMIO = info->MMIO; + CARD32 surface_cntl = INREG(RADEON_SURFACE_CNTL); + + OUTREG(RADEON_SURFACE_CNTL, (surface_cntl | + RADEON_NONSURF_AP0_SWP_32BPP) & ~RADEON_NONSURF_AP0_SWP_16BPP); +#endif /* * s2offset, s3offset - byte offsets into U and V plane of the @@ -729,7 +1210,7 @@ break; } - if(!(pPriv->linear = RADEONAllocateMemory(pScrn, pPriv->linear, + if(!(info->videoLinear = RADEONAllocateMemory(pScrn, info->videoLinear, pPriv->doubleBuffer ? (new_size << 1) : new_size))) { return BadAlloc; @@ -742,9 +1223,10 @@ left = (xa >> 16) & ~1; npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; - offset = (pPriv->linear->offset * bpp) + (top * dstPitch); + offset = (info->videoLinear->offset * bpp) + (top * dstPitch); if(pPriv->doubleBuffer) offset += pPriv->currentBuffer * new_size * bpp; + dst_start = info->FB + offset; switch(id) { @@ -761,9 +1243,13 @@ s3offset = tmp; } nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; +#if X_BYTE_ORDER == X_BIG_ENDIAN + OUTREG(RADEON_SURFACE_CNTL, (surface_cntl | RADEON_NONSURF_AP0_SWP_32BPP) + & ~RADEON_NONSURF_AP0_SWP_16BPP); +#endif RADEONCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, - buf + s3offset, dst_start, srcPitch, srcPitch2, - dstPitch, nlines, npixels); + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: @@ -772,22 +1258,35 @@ buf += (top * srcPitch) + left; nlines = ((yb + 0xffff) >> 16) - top; dst_start += left; +#if X_BYTE_ORDER == X_BIG_ENDIAN + OUTREG(RADEON_SURFACE_CNTL, surface_cntl & ~(RADEON_NONSURF_AP0_SWP_32BPP + | RADEON_NONSURF_AP0_SWP_16BPP)); +#endif RADEONCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* restore byte swapping */ + OUTREG(RADEON_SURFACE_CNTL, surface_cntl); +#endif /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + if(!RegionsEqual(&pPriv->clip, clipBoxes)) + { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, - (CARD32)~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + if(pPriv->autopaint_colorkey) + (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, + (CARD32)~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); } + + if (info->cursor_start && !(pPriv->videoStatus & CLIENT_VIDEO_ON)) + xf86ForceHWCursor (pScrn->pScreen, TRUE); - RADEONDisplayVideo(pScrn, id, offset, width, height, dstPitch, + RADEONDisplayVideo(pScrn, id, offset, offset, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); pPriv->videoStatus = CLIENT_VIDEO_ON; @@ -851,15 +1350,19 @@ if(pPriv->offTime < now) { unsigned char *RADEONMMIO = info->MMIO; OUTREG(RADEON_OV0_SCALE_CNTL, 0); + if (info->cursor_start && pPriv->videoStatus & CLIENT_VIDEO_ON) + xf86ForceHWCursor (pScrn->pScreen, FALSE); pPriv->videoStatus = FREE_TIMER; pPriv->freeTime = now + FREE_DELAY; } } else { /* FREE_TIMER */ if(pPriv->freeTime < now) { - if(pPriv->linear) { - xf86FreeOffscreenLinear(pPriv->linear); - pPriv->linear = NULL; + if(info->videoLinear) { + xf86FreeOffscreenLinear(info->videoLinear); + info->videoLinear = NULL; } + if (info->cursor_start && pPriv->videoStatus & CLIENT_VIDEO_ON) + xf86ForceHWCursor (pScrn->pScreen, FALSE); pPriv->videoStatus = 0; info->VideoTimerCallback = NULL; } @@ -868,5 +1371,216 @@ info->VideoTimerCallback = NULL; } +/****************** Offscreen stuff ***************/ +typedef struct { + FBLinearPtr linear; + Bool isOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +RADEONAllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + FBLinearPtr linear; + int pitch, fbpitch, size, bpp; + OffscreenPrivPtr pPriv; + if((w > 1024) || (h > 1024)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + size = ((pitch * h) + bpp - 1) / bpp; + + if(!(linear = RADEONAllocateMemory(pScrn, NULL, size))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->pitches = xalloc(sizeof(int)))) { + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + + pPriv->linear = linear; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = linear->offset * bpp; + surface->devPrivate.ptr = (pointer)pPriv; + + return Success; +} + +static int +RADEONStopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + RADEONInfoPtr info = RADEONPTR(surface->pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + if(pPriv->isOn) { + OUTREG(RADEON_OV0_SCALE_CNTL, 0); + pPriv->isOn = FALSE; + } + return Success; +} + + +static int +RADEONFreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + RADEONStopSurface(surface); + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +RADEONGetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return RADEONGetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + +static int +RADEONSetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return RADEONSetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + + +static int +RADEONDisplaySurface( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONPortPrivPtr portPriv = info->adaptor->pPortPrivates[0].ptr; + + INT32 xa, ya, xb, yb; + BoxRec dstBox; + + if (src_w > (drw_w << 4)) + drw_w = src_w >> 4; + if (src_h > (drw_h << 4)) + drw_h = src_h >> 4; + + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if (!RADEONClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, + surface->width, surface->height)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + RADEONResetVideo(pScrn); + + RADEONDisplayVideo(pScrn, surface->id, + surface->offsets[0], surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + + if (portPriv->autopaint_colorkey) + (*info->accel->FillSolidRects)(pScrn, portPriv->colorKey, GXcopy, + (CARD32)~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if (portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + if (info->cursor_start) + xf86ForceHWCursor (pScrn->pScreen, FALSE); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + info->VideoTimerCallback = RADEONVideoTimerCallback; + } + + return Success; +} + + +static void +RADEONInitOffscreenImages(ScreenPtr pScreen) +{ +/* ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); */ + XF86OffscreenImagePtr offscreenImages; + /* need to free this someplace */ + + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | + VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = RADEONAllocateSurface; + offscreenImages[0].free_surface = RADEONFreeSurface; + offscreenImages[0].display = RADEONDisplaySurface; + offscreenImages[0].stop = RADEONStopSurface; + offscreenImages[0].setAttribute = RADEONSetSurfaceAttribute; + offscreenImages[0].getAttribute = RADEONGetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} #endif /* !XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile:1.28 xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile:1.28 Tue Jan 23 19:06:16 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile Mon Feb 17 12:06:41 2003 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile,v 1.28 2001/01/24 00:06:16 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile,v 1.30 2003/02/17 17:06:41 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -28,7 +28,7 @@ -I$(XF86SRC)/ramdac -I$(XF86SRC)/rac -I$(XF86SRC)/ddc \ -I$(XF86SRC)/i2c -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/shadowfb \ -I$(XF86SRC)/xf8_16bpp -I$(XF86SRC)/int10 \ - -I$(XF86OSSRC)/vbe -I$(EXTINCSRC) -I$(SERVERSRC)/render + -I$(XF86SRC)/vbe -I$(EXTINCSRC) -I$(SERVERSRC)/render #endif #if MakeHasPosixVariableSubstitutions @@ -48,9 +48,7 @@ InstallModuleManPage(chips) #endif -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/chips) InstallDriverSDKNonExecFile(ct_BlitMM.h,$(DRIVERSDKDIR)/drivers/chips) Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h:1.4 Sat Aug 29 01:43:05 1998 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h Mon Nov 25 09:04:58 2002 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h,v 1.4 1998/08/29 05:43:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h,v 1.5 2002/11/25 14:04:58 eich Exp $ */ /* Definitions for the Chips and Technology BitBLT engine communication. */ /* These are done using Memory Mapped IO, of the registers */ @@ -33,41 +33,40 @@ /* Macros to do useful things with the C&T BitBLT engine */ #define ctBLTWAIT \ {HW_DEBUG(0x4); \ - while(*(volatile unsigned int *)(cPtr->MMIOBase + MR(0x4)) & \ - 0x00100000){};} + while(MMIO_IN32(cPtr->MMIOBase, MR(0x4)) & 0x00100000){};} #define ctSETROP(op) \ - {HW_DEBUG(0x4); *(unsigned int *)(cPtr->MMIOBase + MR(0x4)) = (op);} + {HW_DEBUG(0x4); MMIO_OUT32(cPtr->MMIOBase, MR(0x4), op);} #define ctSETSRCADDR(srcAddr) \ {HW_DEBUG(0x5); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x5)) = (srcAddr)&0x7FFFFFL;} + MMIO_OUT32(cPtr->MMIOBase, MR(0x5),(srcAddr)&0x7FFFFFL);} #define ctSETDSTADDR(dstAddr) \ {HW_DEBUG(0x6); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x6)) = (dstAddr)&0x7FFFFFL;} + MMIO_OUT32(cPtr->MMIOBase, MR(0x6), (dstAddr)&0x7FFFFFL);} #define ctSETPITCH(srcPitch,dstPitch) \ {HW_DEBUG(0x0); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x0)) = (((dstPitch)&0xFFFF)<<16)| \ - ((srcPitch)&0xFFFF);} + MMIO_OUT32(cPtr->MMIOBase, MR(0x0),(((dstPitch)&0xFFFF)<<16)| \ + ((srcPitch)&0xFFFF));} #define ctSETHEIGHTWIDTHGO(Height,Width)\ {HW_DEBUG(0x7); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x7)) = (((Height)&0xFFFF)<<16)| \ - ((Width)&0xFFFF);} + MMIO_OUT32(cPtr->MMIOBase, MR(0x7), (((Height)&0xFFFF)<<16)| \ + ((Width)&0xFFFF));} #define ctSETPATSRCADDR(srcAddr)\ {HW_DEBUG(0x1); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x1)) = (srcAddr)&0x1FFFFFL;} + MMIO_OUT32(cPtr->MMIOBase, MR(0x1),(srcAddr)&0x1FFFFFL);} #define ctSETBGCOLOR8(c) {\ HW_DEBUG(0x2); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x2)) = \ - ((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ - ((((c)&0xFF)<<8)|((c)&0xFF))); \ + MMIO_OUT32(cPtr->MMIOBase, MR(0x2),\ + ((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ + ((((c)&0xFF)<<8)|((c)&0xFF)))); \ } \ } @@ -75,8 +74,8 @@ HW_DEBUG(0x2); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x2)) = \ - ((((c)&0xFFFF)<<16)|((c)&0xFFFF)); \ + MMIO_OUT32(cPtr->MMIOBase, MR(0x2), \ + ((((c)&0xFFFF)<<16)|((c)&0xFFFF))); \ } \ } @@ -86,7 +85,7 @@ HW_DEBUG(0x2); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x2)) = ((c)&0xFFFFFF); \ + MMIO_OUT32(cPtr->MMIOBase, MR(0x2),((c)&0xFFFFFF)); \ } \ } @@ -94,9 +93,9 @@ HW_DEBUG(0x3); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x3)) = \ + MMIO_OUT32(cPtr->MMIOBase, MR(0x3), \ ((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ - ((((c)&0xFF)<<8)|((c)&0xFF))); \ + ((((c)&0xFF)<<8)|((c)&0xFF)))); \ } \ } @@ -104,8 +103,8 @@ HW_DEBUG(0x3); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x3)) = \ - ((((c)&0xFFFF)<<16)|((c)&0xFFFF)); \ + MMIO_OUT32(cPtr->MMIOBase, MR(0x3), \ + ((((c)&0xFFFF)<<16)|((c)&0xFFFF))); \ } \ } @@ -115,7 +114,7 @@ HW_DEBUG(0x3); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + MR(0x3)) = ((c)&0xFFFFFF); \ + MMIO_OUT32(cPtr->MMIOBase, MR(0x3),((c)&0xFFFFFF)); \ } \ } Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h:1.3 Sat Aug 29 01:43:06 1998 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h Fri Jan 25 16:55:58 2002 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h,v 1.3 1998/08/29 05:43:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h,v 1.4 2002/01/25 21:55:58 tsi Exp $ */ /* Definitions for the Chips and Technology BitBLT engine communication. */ /* registers */ @@ -69,26 +69,26 @@ /* Macros to do useful things with the C&T BitBLT engine */ #define ctBLTWAIT \ - {HW_DEBUG(0x4+2); while(inw(DR(0x4)+2)&0x10){};} + {HW_DEBUG(0x4+2); while(inw(cPtr->PIOBase+DR(0x4)+2)&0x10){};} #define ctSETROP(op) \ - {HW_DEBUG(0x4); outl(DR(0x4),(op));} + {HW_DEBUG(0x4); outl(cPtr->PIOBase+DR(0x4),(op));} #define ctSETSRCADDR(srcAddr) \ - {HW_DEBUG(0x5); outl(DR(0x5),((srcAddr)&0x1FFFFFL));} + {HW_DEBUG(0x5); outl(cPtr->PIOBase+DR(0x5),((srcAddr)&0x1FFFFFL));} #define ctSETDSTADDR(dstAddr) \ - {HW_DEBUG(0x6); outl(DR(0x6),((dstAddr)&0x1FFFFFL));} + {HW_DEBUG(0x6); outl(cPtr->PIOBase+DR(0x6),((dstAddr)&0x1FFFFFL));} #define ctSETPITCH(srcPitch,dstPitch) \ - {HW_DEBUG(0x0); outl(DR(0x0),(((dstPitch)<<16)|(srcPitch)));} + {HW_DEBUG(0x0); outl(cPtr->PIOBase+DR(0x0),(((dstPitch)<<16)|(srcPitch)));} /* Note that this command signal a blit to commence */ #define ctSETHEIGHTWIDTHGO(Height,Width)\ - {HW_DEBUG(0x7); outl(DR(0x7),(((Height)<<16)|(Width)));} + {HW_DEBUG(0x7); outl(cPtr->PIOBase+DR(0x7),(((Height)<<16)|(Width)));} #define ctSETPATSRCADDR(srcAddr)\ - {HW_DEBUG(0x1); outl(DR(0x1),((srcAddr)&0x1FFFFFL));} + {HW_DEBUG(0x1); outl(cPtr->PIOBase+DR(0x1),((srcAddr)&0x1FFFFFL));} /* I can't help pointing out at this point that I'm not complaining * about the american spelling of Colour!! [DGB] */ @@ -97,7 +97,7 @@ HW_DEBUG(0x2); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - outl(DR(0x2),((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ + outl(cPtr->PIOBase+DR(0x2),((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ ((((c)&0xFF)<<8)|((c)&0xFF)))); \ } \ } @@ -106,7 +106,7 @@ HW_DEBUG(0x2); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - outl(DR(0x2),((((c)&0xFFFF)<<16)|((c)&0xFFFF))); \ + outl(cPtr->PIOBase+DR(0x2),((((c)&0xFFFF)<<16)|((c)&0xFFFF))); \ } \ } @@ -115,7 +115,7 @@ HW_DEBUG(0x2); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - outl(DR(0x2),(c)&0xFFFFFF); \ + outl(cPtr->PIOBase+DR(0x2),(c)&0xFFFFFF); \ } \ } @@ -123,7 +123,7 @@ HW_DEBUG(0x3); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - outl(DR(0x3),((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ + outl(cPtr->PIOBase+DR(0x3),((((((c)&0xFF)<<8)|((c)&0xFF))<<16) | \ ((((c)&0xFF)<<8)|((c)&0xFF)))); \ } \ } @@ -132,7 +132,7 @@ HW_DEBUG(0x3); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - outl(DR(0x3),((((c)&0xFFFF)<<16)|((c)&0xFFFF))); \ + outl(cPtr->PIOBase+DR(0x3),((((c)&0xFFFF)<<16)|((c)&0xFFFF))); \ } \ } @@ -141,7 +141,7 @@ HW_DEBUG(0x3); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - outl(DR(0x3),(c)&0xFFFFFF); \ + outl(cPtr->PIOBase+DR(0x3),(c)&0xFFFFFF); \ } \ } Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h:1.10 Wed Dec 6 10:35:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h Mon Nov 25 09:04:58 2002 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h,v 1.10 2000/12/06 15:35:12 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h,v 1.12 2002/11/25 14:04:58 eich Exp $ */ /* Definitions for the Chips and Technology BitBLT engine communication. */ /* These are done using Memory Mapped IO, of the registers */ @@ -71,14 +71,15 @@ {int timeout; \ timeout = 0; \ for (;;) { \ - if (cPtr->Chipset >= CHIPS_CT69000) { \ + if (cPtr->Chipset >= CHIPS_CT69000 ) { \ if (!(MMIO_IN32(cPtr->MMIOBase,BR(0x4))&(1<<31)))\ break; \ } else { \ if (!(cPtr->readXR(cPtr,0x20) & 0x1)) break; \ } \ timeout++; \ - if (timeout == 100000) { \ + if ((cPtr->Chipset < CHIPS_CT69000 && \ + (timeout > 100000)) || timeout > 300000) { \ unsigned char tmp; \ ErrorF("timeout\n"); \ tmp = cPtr->readXR(cPtr, 0x20); \ @@ -91,67 +92,67 @@ } #define ctSETROP(op) \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x4)) = (op) + MMIO_OUT32(cPtr->MMIOBase, BR(0x4), op) #define ctSETMONOCTL(op) \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x3)) = (op) + MMIO_OUT32(cPtr->MMIOBase, BR(0x3), op) #define ctSETSRCADDR(srcAddr) \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x6)) = (srcAddr)&0x7FFFFFL + MMIO_OUT32(cPtr->MMIOBase, BR(0x6), (srcAddr)&0x7FFFFFL) #define ctSETDSTADDR(dstAddr) \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x7)) = (dstAddr)&0x7FFFFFL + MMIO_OUT32(cPtr->MMIOBase, BR(0x7), (dstAddr)&0x7FFFFFL) #define ctSETPITCH(srcPitch,dstPitch) \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x0)) = (((dstPitch)&0xFFFF)<<16)| \ - ((srcPitch)&0xFFFF) + MMIO_OUT32(cPtr->MMIOBase, BR(0x0), (((dstPitch)&0xFFFF)<<16)| \ + ((srcPitch)&0xFFFF)) #define ctSETHEIGHTWIDTHGO(Height,Width)\ - *(unsigned int *)(cPtr->MMIOBase + BR(0x8)) = (((Height)&0xFFFF)<<16)| \ - ((Width)&0xFFFF) + MMIO_OUT32(cPtr->MMIOBase, BR(0x8), (((Height)&0xFFFF)<<16)| \ + ((Width)&0xFFFF)) #define ctSETPATSRCADDR(srcAddr)\ - *(unsigned int *)(cPtr->MMIOBase + BR(0x5)) = (srcAddr)&0x7FFFFFL + MMIO_OUT32(cPtr->MMIOBase, BR(0x5), (srcAddr)&0x7FFFFFL) #define ctSETBGCOLOR8(c) {\ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x1)) = ((c)&0xFF); \ + MMIO_OUT32(cPtr->MMIOBase, BR(0x1), ((c)&0xFF)); \ } \ } #define ctSETBGCOLOR16(c) {\ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x1)) = ((c)&0xFFFF); \ + MMIO_OUT32(cPtr->MMIOBase, BR(0x1), ((c)&0xFFFF)); \ } \ } #define ctSETBGCOLOR24(c) {\ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x1)) = ((c)&0xFFFFFF); \ + MMIO_OUT32(cPtr->MMIOBase, BR(0x1), ((c)&0xFFFFFF)); \ } \ } #define ctSETFGCOLOR8(c) {\ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x2)) = ((c)&0xFF); \ + MMIO_OUT32(cPtr->MMIOBase, BR(0x2), ((c)&0xFF)); \ } \ } #define ctSETFGCOLOR16(c) {\ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x2)) = ((c)&0xFFFF); \ + MMIO_OUT32(cPtr->MMIOBase, BR(0x2), ((c)&0xFFFF)); \ } \ } #define ctSETFGCOLOR24(c) {\ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ - *(unsigned int *)(cPtr->MMIOBase + BR(0x2)) = ((c)&0xFFFFFF); \ + MMIO_OUT32(cPtr->MMIOBase, BR(0x2), ((c)&0xFFFFFF)); \ } \ } Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.38 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.40 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.38 Mon Jan 7 13:46:03 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c Mon Nov 25 09:04:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.38 2002/01/07 18:46:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.40 2002/11/25 14:04:58 eich Exp $ */ /* * Copyright 1996, 1997, 1998 by David Bateman <dbateman@ee.uts.edu.au> * Modified 1997, 1998 by Nozomi Ytow @@ -53,12 +53,6 @@ /* Our driver specific include file */ #include "ct_driver.h" -#ifdef DEBUG -# define DEBUG_P(x) ErrorF(x"\n"); -#else -# define DEBUG_P(x) /**/ -#endif - #if !defined(UNIXCPP) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname #else @@ -78,6 +72,17 @@ #define CTNAME(subname) CATNAME(CHIPS,subname) #endif +#ifdef DEBUG +# define DEBUG_P(x) ErrorF(x"\n"); +#elif defined X_DEBUG +# define DEBUG_P(x) snprintf(CTNAME(accel_debug),1024,x"\n"); +#else +# define DEBUG_P(x) /**/ +#endif + +#ifdef X_DEBUG +static char CTNAME(accel_debug)[1024]; +#endif #ifdef CHIPS_HIQV static void CTNAME(DepthChange)(ScrnInfoPtr pScrn, int depth); @@ -157,7 +162,6 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - BoxRec AvailFBArea; DEBUG_P("AccelInit"); cPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); @@ -274,8 +278,8 @@ LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | ROP_NEEDS_SOURCE; #ifdef UNDOCUMENTED_FEATURE - infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | - LEFT_EDGE_CLIPPING; + infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST + | LEFT_EDGE_CLIPPING; #endif if (cAcl->BitsPerPixel == 24) { infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK; @@ -283,6 +287,15 @@ infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; #endif } + /* The ct65550 has problems with transparency which leads to video + * corruption unless disabled. + */ + if (!(cPtr->Flags & ChipsColorTransparency)) { + infoPtr->CPUToScreenColorExpandFillFlags |= NO_TRANSPARENCY; +#ifdef UNDOCUMENTED_FEATURE + infoPtr->ScreenToScreenColorExpandFillFlags |= NO_TRANSPARENCY; +#endif + } #else infoPtr->CPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | CPU_TRANSFER_PAD_DWORD | @@ -390,16 +403,6 @@ infoPtr->ImageWriteFlags |= NO_PLANEMASK; #endif - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = cAcl->CacheEnd / - (pScrn->displayWidth * cAcl->BytesPerPixel); - -#ifdef CHIPS_HIQV - if (!(cPtr->Flags & ChipsOverlay8plus16)) -#endif - xf86InitFBManager(pScreen, &AvailFBArea); #ifdef CHIPS_HIQV if (XAAInit(pScreen, infoPtr)) { Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c:1.5 Tue Apr 4 15:25:05 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c Fri Jan 25 16:55:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c,v 1.5 2000/04/04 19:25:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c,v 1.6 2002/01/25 21:55:58 tsi Exp $ */ /* * Copyright 1997 @@ -63,8 +63,10 @@ int CHIPSSetRead(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); + #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ if (bank != ChipsBank(pScreen)) { @@ -80,7 +82,9 @@ int CHIPSSetWrite(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -97,9 +101,11 @@ int CHIPSSetReadWrite(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); + #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ if (bank != ChipsBank(pScreen)) { @@ -114,7 +120,9 @@ int CHIPSSetReadPlanar(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -130,8 +138,10 @@ int CHIPSSetWritePlanar(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); + #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ if (bank != ChipsBank(pScreen)) { @@ -146,8 +156,10 @@ int CHIPSSetReadWritePlanar(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -163,12 +175,13 @@ int CHIPSWINSetRead(ScreenPtr pScreen, int bank) { + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); register unsigned char tmp; - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); - outb(0x3D6, 0x0C); - tmp = inb(0x3D7) & 0xEF; - outw(0x3D6, (((((bank >> 1) & 0x10) | tmp) << 8) | 0x0C)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); + outb(cPtr->PIOBase + 0x3D6, 0x0C); + tmp = inb(cPtr->PIOBase + 0x3D7) & 0xEF; + outw(cPtr->PIOBase + 0x3D6, (((((bank >> 1) & 0x10) | tmp) << 8) | 0x0C)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -185,12 +198,13 @@ int CHIPSWINSetWrite(ScreenPtr pScreen, int bank) { + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); register unsigned char tmp; - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); - outb(0x3D6, 0x0C); - tmp = inb(0x3D7) & 0xBF; - outw(0x3D6, (((((bank << 1) & 0x40) | tmp) << 8) | 0x0C)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); + outb(cPtr->PIOBase + 0x3D6, 0x0C); + tmp = inb(cPtr->PIOBase + 0x3D7) & 0xBF; + outw(cPtr->PIOBase + 0x3D6, (((((bank << 1) & 0x40) | tmp) << 8) | 0x0C)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -206,13 +220,15 @@ int CHIPSWINSetReadWrite(ScreenPtr pScreen, int bank) { + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); register unsigned char tmp; - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); - outw(0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); - outb(0x3D6, 0x0C); - tmp = inb(0x3D7) & 0xAF; - outw(0x3D6, (((((bank << 1) & 0x40) | ((bank >> 1) & 0x10) | tmp) << 8) | 0x0C)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x10)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 3) & 0xFF) << 8) | 0x11)); + outb(cPtr->PIOBase + 0x3D6, 0x0C); + tmp = inb(cPtr->PIOBase + 0x3D7) & 0xAF; + outw(cPtr->PIOBase + 0x3D6, + (((((bank << 1) & 0x40) | ((bank >> 1) & 0x10) | tmp) << 8) | 0x0C)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -228,12 +244,13 @@ int CHIPSWINSetReadPlanar(ScreenPtr pScreen, int bank) { + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); register unsigned char tmp; - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); - outb(0x3D6, 0x0C); - tmp = inb(0x3D7) & 0xEF; - outw(0x3D6, (((((bank << 1) & 0x10) | tmp) << 8) | 0x0C)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); + outb(cPtr->PIOBase + 0x3D6, 0x0C); + tmp = inb(cPtr->PIOBase + 0x3D7) & 0xEF; + outw(cPtr->PIOBase + 0x3D6, (((((bank << 1) & 0x10) | tmp) << 8) | 0x0C)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -249,12 +266,13 @@ int CHIPSWINSetWritePlanar(ScreenPtr pScreen, int bank) { + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); register unsigned char tmp; - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); - outb(0x3D6, 0x0C); - tmp = inb(0x3D7) & 0xBF; - outw(0x3D6, (((((bank << 3) & 0x40) | tmp) << 8) | 0x0C)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); + outb(cPtr->PIOBase + 0x3D6, 0x0C); + tmp = inb(cPtr->PIOBase + 0x3D7) & 0xBF; + outw(cPtr->PIOBase + 0x3D6, (((((bank << 3) & 0x40) | tmp) << 8) | 0x0C)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -270,13 +288,15 @@ int CHIPSWINSetReadWritePlanar(ScreenPtr pScreen, int bank) { + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); register unsigned char tmp; - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); - outw(0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); - outb(0x3D6, 0x0C); - tmp = inb(0x3D7) & 0xAF; - outw(0x3D6, (((((bank << 3) & 0x40) | ((bank << 1) & 0x10) | tmp) << 8) | 0x0C)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x10)); + outw(cPtr->PIOBase + 0x3D6, ((((bank << 5) & 0xFF) << 8) | 0x11)); + outb(cPtr->PIOBase + 0x3D6, 0x0C); + tmp = inb(cPtr->PIOBase + 0x3D7) & 0xAF; + outw(cPtr->PIOBase + 0x3D6, + (((((bank << 3) & 0x40) | ((bank << 1) & 0x10) | tmp) << 8) | 0x0C)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ @@ -292,8 +312,10 @@ int CHIPSHiQVSetReadWrite(ScreenPtr pScreen, int bank) { - outw(0x3D6, (((bank & 0x7F) << 8) | 0x0E)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + outw(cPtr->PIOBase + 0x3D6, (((bank & 0x7F) << 8) | 0x0E)); + #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ if (bank != ChipsBank(pScreen)) { @@ -308,7 +330,9 @@ int CHIPSHiQVSetReadWritePlanar(ScreenPtr pScreen, int bank) { - outw(0x3D6, ((((bank << 2) & 0x7F) << 8) | 0x0E)); + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScreen->myNum]); + + outw(cPtr->PIOBase + 0x3D6, ((((bank << 2) & 0x7F) << 8) | 0x0E)); #ifdef __arm32__ /* Must drain StrongARM write buffer on bank switch! */ Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.24 Mon Oct 1 09:44:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c Mon Nov 25 09:04:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.24 2001/10/01 13:44:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.27 2002/11/25 14:04:58 eich Exp $ */ /* * Copyright 1994 The XFree86 Project @@ -57,6 +57,20 @@ } \ } +/* Swing your cursor bytes round and round... yeehaw! */ +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define P_SWAP32( a , b ) \ + ((char *)a)[0] = ((char *)b)[3]; \ + ((char *)a)[1] = ((char *)b)[2]; \ + ((char *)a)[2] = ((char *)b)[1]; \ + ((char *)a)[3] = ((char *)b)[0] + +#define P_SWAP16( a , b ) \ + ((char *)a)[0] = ((char *)b)[1]; \ + ((char *)a)[1] = ((char *)b)[0]; \ + ((char *)a)[2] = ((char *)b)[3]; \ + ((char *)a)[3] = ((char *)b)[2] +#endif static void CHIPSShowCursor(ScrnInfoPtr pScrn) @@ -64,7 +78,7 @@ CHIPSPtr cPtr = CHIPSPTR(pScrn); unsigned char tmp; - CURSOR_SYNC(pScrn); + CURSOR_SYNC(pScrn); /* turn the cursor on */ if (IS_HiQV(cPtr)) { @@ -87,7 +101,7 @@ } else { if(!cPtr->UseMMIO) { HW_DEBUG(0x8); - outw(DR(0x8), 0x21); + outw(cPtr->PIOBase+DR(0x8), 0x21); } else { HW_DEBUG(DR(8)); /* Used to be: MMIOmemw(MR(8)) = 0x21; */ @@ -126,7 +140,7 @@ } else { if(!cPtr->UseMMIO) { HW_DEBUG(0x8); - outw(DR(0x8), 0x20); + outw(cPtr->PIOBase+DR(0x8), 0x20); } else { HW_DEBUG(DR(0x8)); /* Used to be: MMIOmemw(DR(0x8)) = 0x20; */ @@ -180,7 +194,7 @@ xy = (xy << 16) | x; if(!cPtr->UseMMIO) { HW_DEBUG(0xB); - outl(DR(0xB), xy); + outl(cPtr->PIOBase+DR(0xB), xy); } else { HW_DEBUG(MR(0xB)); MMIOmeml(MR(0xB)) = xy; @@ -270,8 +284,8 @@ cPtr->writeMSS(cPtr, hwp, MSS); } } else if (IS_Wingine(cPtr)) { - outl(DR(0xA), (bg & 0xFFFFFF)); - outl(DR(0x9), (fg & 0xFFFFFF)); + outl(cPtr->PIOBase+DR(0xA), (bg & 0xFFFFFF)); + outl(cPtr->PIOBase+DR(0x9), (fg & 0xFFFFFF)); } else { packedcolfg = ((fg & 0xF80000) >> 8) | ((fg & 0xFC00) >> 5) | ((fg & 0xF8) >> 3); @@ -280,7 +294,7 @@ packedcolfg = (packedcolfg << 16) | packedcolbg; if(!cPtr->UseMMIO) { HW_DEBUG(0x9); - outl(DR(0x9), packedcolfg); + outl(cPtr->PIOBase+DR(0x9), packedcolfg); } else { MMIOmeml(MR(0x9)) = packedcolfg; HW_DEBUG(MR(0x9)); @@ -293,8 +307,13 @@ { CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); +#if X_BYTE_ORDER == X_BIG_ENDIAN + CARD32 *s = (pointer)src; + CARD32 *d = (pointer)(cPtr->FbBase + cAcl->CursorAddress); + int y; +#endif - CURSOR_SYNC(pScrn); + CURSOR_SYNC(pScrn); if (cPtr->cursorDelay) { usleep(200000); @@ -305,16 +324,56 @@ int i; CARD32 *tmp = (CARD32 *)src; - outl(DR(0x8),0x20); + outl(cPtr->PIOBase+DR(0x8),0x20); for (i=0; i<64; i++) { - outl(DR(0xC),*(CARD32 *)tmp); + outl(cPtr->PIOBase+DR(0xC),*(CARD32 *)tmp); tmp++; } } else { if (cPtr->Flags & ChipsLinearSupport) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* On big endian machines we must flip our cursor image around. */ + switch(cAcl->BytesPerPixel) { + case 4: + case 3: + for (y = 0; y < 64; y++) { + P_SWAP32(d,s); + d++; s++; + P_SWAP32(d,s); + d++; s++; + P_SWAP32(d,s); + d++; s++; + P_SWAP32(d,s); + d++; s++; + } + break; + case 2: + for (y = 0; y < 64; y++) { + P_SWAP16(d,s); + d++; s++; + P_SWAP16(d,s); + d++; s++; + P_SWAP16(d,s); + d++; s++; + P_SWAP16(d,s); + d++; s++; + P_SWAP16(d,s); + d++; s++; + } + break; + default: + for (y = 0; y < 64; y++) { + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + } + } +#else memcpy((unsigned char *)cPtr->FbBase + cAcl->CursorAddress, src, cPtr->CursorInfoRec->MaxWidth * cPtr->CursorInfoRec->MaxHeight / 4); +#endif } else { /* * The cursor can only be in the last 16K of video memory, @@ -361,7 +420,7 @@ } else if (!IS_Wingine(cPtr)) { if (!cPtr->UseMMIO) { HW_DEBUG(0xC); - outl(DR(0xC), cAcl->CursorAddress); + outl(cPtr->PIOBase+DR(0xC), cAcl->CursorAddress); } else { HW_DEBUG(MR(0xC)); MMIOmeml(MR(0xC)) = cAcl->CursorAddress; @@ -372,9 +431,8 @@ static Bool CHIPSUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { - CHIPSACLPtr cAcl = CHIPSACLPTR(xf86Screens[pScr->myNum]); - - return cAcl->UseHWCursor; + CHIPSPtr cPtr = CHIPSPTR(xf86Screens[pScr->myNum]); + return ((cPtr->Flags & ChipsHWCursor) != 0); } Bool @@ -383,13 +441,16 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; CHIPSPtr cPtr = CHIPSPTR(pScrn); xf86CursorInfoPtr infoPtr; - + infoPtr = xf86CreateCursorInfoRec(); if(!infoPtr) return FALSE; cPtr->CursorInfoRec = infoPtr; - infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + infoPtr->Flags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_INVERT_MASK | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c:1.3 Mon Oct 1 09:44:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c Mon Nov 25 09:04:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c,v 1.3 2001/10/01 13:44:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c,v 1.5 2002/11/25 14:04:58 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -18,8 +18,10 @@ static void CHIPS_SetViewport(ScrnInfoPtr, int, int, int); static void CHIPS_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void CHIPS_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void CHIPS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec CHIPS_DGAFuncs = { @@ -129,7 +131,7 @@ currentMode->viewportHeight = pMode->VDisplay; currentMode->xViewportStep = 1; currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->viewportFlags = DGA_FLIP_RETRACE | DGA_FLIP_IMMEDIATE; currentMode->offset = 0; currentMode->address = cPtr->FbBase; @@ -230,11 +232,17 @@ ScrnInfoPtr pScrn, int x, int y, int flags -){ - CHIPSPtr cPtr = CHIPSPTR(pScrn); + ){ + vgaHWPtr hwp = VGAHWPTR(pScrn); + CHIPSPtr cPtr = CHIPSPTR(pScrn); + + if (flags & DGA_FLIP_RETRACE) { + while ((hwp->readST01(hwp)) & 0x08){}; + while (!(hwp->readST01(hwp)) & 0x08){}; + } - CHIPSAdjustFrame(pScrn->pScreen->myNum, x, y, flags); - cPtr->DGAViewportStatus = 0; /* CHIPSAdjustFrame loops until finished */ + CHIPSAdjustFrame(pScrn->pScreen->myNum, x, y, flags); + cPtr->DGAViewportStatus = 0; /* CHIPSAdjustFrame loops until finished */ } static void @@ -272,8 +280,8 @@ SET_SYNC_FLAG(cPtr->AccelInfoRec); } } - +#if 0 static void CHIPS_BlitTransRect( ScrnInfoPtr pScrn, @@ -285,7 +293,7 @@ /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } - +#endif static Bool CHIPS_OpenFramebuffer( Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.117 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.122 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.117 Fri Jan 4 16:22:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c Mon Nov 25 09:04:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.117 2002/01/04 21:22:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.122 2002/11/25 14:04:58 eich Exp $ */ /* * Copyright 1993 by Jon Block <block@frc.com> @@ -1218,12 +1218,13 @@ clockRanges->minClock = cPtr->MinClock; clockRanges->maxClock = cPtr->MaxClock; clockRanges->clockIndex = -1; /* programmable */ - if (cPtr->PanelType & ChipsLCD) + if (cPtr->PanelType & ChipsLCD) { clockRanges->interlaceAllowed = FALSE; - else + clockRanges->doubleScanAllowed = FALSE; + } else { clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = FALSE; - + clockRanges->doubleScanAllowed = TRUE; + } /* * Reduce the amount of video ram for the modes, so that they * don't overlap with the DSTN framebuffer @@ -1353,13 +1354,12 @@ } xf86LoaderReqSymLists(ramdacSymbols, NULL); } - + if (cPtr->Flags & ChipsLinearSupport) - xf86SetOperatingState(resVgaMemShared, cPtr->pEnt->index, - ResDisableOpr); + xf86SetOperatingState(resVgaMem, cPtr->pEnt->index, ResDisableOpr); if (cPtr->MMIOBaseVGA) - xf86SetOperatingState(RES_SHARED_VGA, cPtr->pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaIo, cPtr->pEnt->index, ResDisableOpr); vbeFree(cPtr->pVbe); cPtr->pVbe = NULL; return TRUE; @@ -1426,6 +1426,7 @@ hwp = VGAHWPTR(pScrn); vgaHWGetIOBase(hwp); + cPtr->PIOBase = hwp->PIOOffset; /* * Must allow ensure that storage for the 2nd set of vga registers is @@ -1475,7 +1476,7 @@ /* Set the bits per RGB */ if (pScrn->depth > 1) { /* Default to 6, is this right for HiQV?? */ - pScrn->rgbBits = 6; + pScrn->rgbBits = 8; if (xf86GetOptValInteger(cPtr->Options, OPTION_RGB_BITS, &val)) { if (val == 6 || val == 8) { pScrn->rgbBits = val; @@ -1524,7 +1525,12 @@ /* linear base */ if (cPtr->Flags & ChipsLinearSupport) { if (cPtr->pEnt->location.type == BUS_PCI) { + /* Tack on 0x800000 to access the big-endian aperture? */ +#if X_BYTE_ORDER == X_BIG_ENDIAN + cPtr->FbAddress = (cPtr->PciInfo->memBase[0] & 0xff800000) + 0x800000L; +#else cPtr->FbAddress = cPtr->PciInfo->memBase[0] & 0xff800000; +#endif from = X_PROBED; if (xf86RegisterResources(cPtr->pEnt->index,NULL,ResNone)) cPtr->Flags &= ~ChipsLinearSupport; @@ -1557,7 +1563,6 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Disabling linear addressing\n"); - if ((s = xf86GetOptValString(cPtr->Options, OPTION_ROTATE)) || xf86ReturnOptValBool(cPtr->Options, OPTION_SHADOW_FB, FALSE)) { if (!(cPtr->Flags & ChipsLinearSupport)) { @@ -1657,10 +1662,6 @@ cPtr->Accel.UseHWCursor = FALSE; } } - if (cPtr->Accel.UseHWCursor) - cPtr->Flags |= ChipsHWCursor; - else - cPtr->Flags &= ~ChipsHWCursor; if (xf86ReturnOptValBool(cPtr->Options, OPTION_MMIO, TRUE)) { cPtr->UseMMIO = TRUE; @@ -1789,6 +1790,7 @@ pScrn->videoRam = 2048; break; } + break; default: /* XRE0: Software reg */ /* bit 3-0: memory size */ @@ -1818,10 +1820,10 @@ pScrn->videoRam = 1024; break; } + break; } } - if ((cPtr->Flags & ChipsDualChannelSupport) && (xf86IsEntityShared(pScrn->entityList[0]))) { /* @@ -1986,7 +1988,7 @@ tmp = cPtr->readFR(cPtr, 0x23); fr26 = cPtr->readFR(cPtr, 0x26); Size->HTotal = ((tmp + ((fr26 & 0x0F) << 8)) + 5) << 3; - ErrorF("x=%i, y=%i; xSync=%i, xSyncEnd=%i, xTotal=%i\n", + xf86ErrorF("x=%i, y=%i; xSync=%i, xSyncEnd=%i, xTotal=%i\n", Size->HDisplay, Size->VDisplay, Size->HRetraceStart,Size->HRetraceEnd, Size->HTotal); @@ -2129,9 +2131,9 @@ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Dot clock %i: %7.3f MHz",i, (float)(Probed[i])/1000.); - if (FPclkI == i) ErrorF(" FPclk"); - if (CRTclkI == i) ErrorF(" CRTclk"); - ErrorF("\n"); + if (FPclkI == i) xf86ErrorF(" FPclk"); + if (CRTclkI == i) xf86ErrorF(" CRTclk"); + xf86ErrorF("\n"); } cPtr->FPclock = Probed[FPclkI]; cPtr->FPclkInx = FPclkI; @@ -2268,7 +2270,7 @@ /* Check if maxClock is limited by the MemClk. Only 70% to allow for */ /* RAS/CAS. Extra byte per memory clock needed if framebuffer used */ - /* Extra byte if the overlay plane is avtivated */ + /* Extra byte if the overlay plane is activated */ /* We have a 64bit wide memory bus on the 69030 and 69000, and 32bits */ /* on the others. Thus multiply by a suitable factor */ if ((cPtr->Chipset == CHIPS_CT69030) || (cPtr->Chipset == CHIPS_CT69000)) { @@ -2739,11 +2741,6 @@ } } - if (cPtr->Accel.UseHWCursor) - cPtr->Flags |= ChipsHWCursor; - else - cPtr->Flags &= ~ChipsHWCursor; - cPtr->ClockMulFactor = ((pScrn->bitsPerPixel >= 8) ? bytesPerPixel : 1); if (cPtr->ClockMulFactor != 1) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, @@ -3419,10 +3416,6 @@ } } } - if (cPtr->Accel.UseHWCursor) - cPtr->Flags |= ChipsHWCursor; - else - cPtr->Flags &= ~ChipsHWCursor; /* sync reset ignored on this chipset */ if (cPtr->Chipset > CHIPS_CT65530) { @@ -3656,9 +3649,9 @@ /* Should we re-save the text mode on each VT enter? */ if(!chipsModeInit(pScrn, pScrn->currentMode)) return FALSE; - if ((!(cPtr->Flags & ChipsOverlay8plus16)) && - (cPtr->Flags & ChipsVideoSupport) - && (cPtr->Flags & ChipsAccelSupport)) + if ((!(cPtr->Flags & ChipsOverlay8plus16)) + && (cPtr->Flags & ChipsVideoSupport) + && (cPtr->Flags & ChipsLinearSupport)) CHIPSResetVideo(pScrn); /*xf86UDelay(50000);*/ @@ -3841,6 +3834,7 @@ */ cPtr = CHIPSPTR(pScrn); cAcl = CHIPSACLPTR(pScrn); + hwp = VGAHWPTR(pScrn); hwp->MapSize = 0x10000; /* Standard 64k VGA window */ @@ -4149,7 +4143,7 @@ * for 65550's. Wingine cursor is stored in registers and so no memory * is needed. */ - if (cPtr->Flags & ChipsHWCursor) { + if (cAcl->UseHWCursor) { cAcl->CursorAddress = -1; if (IS_HiQV(cPtr)) { if (CHIPSALIGN(1024, 0xFFF) <= freespace) { @@ -4169,7 +4163,10 @@ "Too little space for H/W cursor.\n"); } + cAcl->CacheEnd = currentaddr; + /* Setup the acceleration primitives */ + /* Calculate space needed of offscreen pixmaps etc. */ if (cPtr->Flags & ChipsAccelSupport) { /* * A scratch area is now allocated in the video ram. This is used @@ -4228,13 +4225,32 @@ cAcl->CacheEnd = 0; } - if (IS_HiQV(cPtr)) { - cAcl->BltDataWindow = (unsigned char *)cPtr->MMIOBase + - 0x10000L; - } else { + if (IS_HiQV(cPtr)) + cAcl->BltDataWindow = (unsigned char *)cPtr->MMIOBase + + 0x10000L; + else cAcl->BltDataWindow = cPtr->FbBase; - } + } + /* + * Initialize FBManager: + * we do even with no acceleration enabled + * so that video support can allocate space. + */ + + { + BoxRec AvailFBArea; + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = cAcl->CacheEnd / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + + if (!(cPtr->Flags & ChipsOverlay8plus16)) { + xf86InitFBManager(pScreen, &AvailFBArea); + } + } + if (cPtr->Flags & ChipsAccelSupport) { if (IS_HiQV(cPtr)) { CHIPSHiQVAccelInit(pScreen); } else if (cPtr->UseMMIO) { @@ -4243,7 +4259,7 @@ CHIPSAccelInit(pScreen); } } - + miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); #ifdef ENABLE_SILKEN_MOUSE @@ -4253,7 +4269,7 @@ /* Initialise cursor functions */ miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); - if ((cPtr->Flags & ChipsHWCursor) && (cAcl->CursorAddress != -1)) { + if ((cAcl->UseHWCursor) && (cAcl->CursorAddress != -1)) { /* HW cursor functions */ if (!CHIPSCursorInit(pScreen)) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -4297,9 +4313,8 @@ return FALSE; } - if (pScrn->bitsPerPixel <= 8) - racflag = RAC_COLORMAP; - if (cPtr->Flags & ChipsHWCursor) + racflag = RAC_COLORMAP; + if (cAcl->UseHWCursor) racflag |= RAC_CURSOR; racflag |= (RAC_FB | RAC_VIEWPORT); /* XXX Check if I/O and Mem flags need to be the same. */ @@ -4308,9 +4323,9 @@ xf86SetSilkenMouse(pScreen); #endif - if ((!(cPtr->Flags & ChipsOverlay8plus16)) && - (cPtr->Flags & ChipsVideoSupport) - && (cPtr->Flags & ChipsAccelSupport)) { + if ((!(cPtr->Flags & ChipsOverlay8plus16)) + && (cPtr->Flags & ChipsVideoSupport) + && (cPtr->Flags & ChipsLinearSupport)) { CHIPSInitVideo(pScreen); } @@ -4348,8 +4363,9 @@ CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSEntPtr cPtrEnt; +#ifdef DEBUG ErrorF("CHIPSSwitchMode\n"); - +#endif if (cPtr->UseDualChannel) { cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], CHIPSEntityIndex)->ptr; @@ -5267,9 +5283,14 @@ *(int*)0xFFFFFF0 = 0; ErrorF("done\n"); #endif + chipsUnlock(pScrn); chipsFixResume(pScrn); + if (cPtr->Accel.UseHWCursor) + cPtr->Flags |= ChipsHWCursor; + else + cPtr->Flags &= ~ChipsHWCursor; /* * We need to delay cursor loading after resetting the video mode * to give the engine a chance to recover. @@ -5561,22 +5582,18 @@ ChipsNew->FR[0x40] &= 0xDF; /* Disable Horizontal stretching */ ChipsNew->FR[0x48] &= 0xFB; /* Disable vertical stretching */ ChipsNew->XR[0xA0] = 0x10; /* Disable cursor stretching */ - cPtr->Accel.UseHWCursor = TRUE; } else { ChipsNew->FR[0x40] |= 0x21; /* Enable Horizontal stretching */ ChipsNew->FR[0x48] |= 0x05; /* Enable vertical stretching */ ChipsNew->XR[0xA0] = 0x70; /* Enable cursor stretching */ - if (xf86ReturnOptValBool(cPtr->Options, OPTION_HW_CURSOR, FALSE)) - cPtr->Accel.UseHWCursor = TRUE; /* H/W cursor forced */ - else { - if ((cPtr->PanelSize.HDisplay && cPtr->PanelSize.VDisplay) - && (cPtr->PanelSize.HDisplay != mode->CrtcHDisplay) - && (cPtr->PanelSize.VDisplay != mode->CrtcVDisplay)) { - if(cPtr->Accel.UseHWCursor) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Disabling HW Cursor on stretched LCD\n"); - cPtr->Accel.UseHWCursor = FALSE; /* Possible H/W bug? */ - } + if (cPtr->Accel.UseHWCursor + && cPtr->PanelSize.HDisplay && cPtr->PanelSize.VDisplay + && (cPtr->PanelSize.HDisplay != mode->CrtcHDisplay) + && (cPtr->PanelSize.VDisplay != mode->CrtcVDisplay)) { + if(cPtr->Accel.UseHWCursor) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling HW Cursor on stretched LCD\n"); + cPtr->Flags &= ~ChipsHWCursor; } } } @@ -6320,7 +6337,7 @@ /* This ugly hack is needed because CR01 and XR1C share the 8th bit!*/ CrtcHDisplay = ((mode->CrtcHDisplay >> 3) - 1); if ((lcdHDisplay & 0x100) != (CrtcHDisplay & 0x100)) { - ErrorF("This display configuration might cause problems !\n"); + xf86ErrorF("This display configuration might cause problems !\n"); lcdHDisplay = 255; } @@ -6424,11 +6441,7 @@ ChipsNew->XR[0x57] |= 0x60; /* Enable vertical stretching */ tmp = (mode->CrtcVDisplay / (cPtr->PanelSize.VDisplay - mode->CrtcVDisplay + 1)); - if (tmp == 0) - if (xf86ReturnOptValBool(cPtr->Options, OPTION_HW_CURSOR, - FALSE)) - cPtr->Accel.UseHWCursor = TRUE; /* H/W cursor forced */ - else { + if (tmp) { if (cPtr->PanelSize.HDisplay && cPtr->PanelSize.VDisplay && (cPtr->PanelSize.HDisplay != mode->CrtcHDisplay) @@ -6437,15 +6450,10 @@ if(cPtr->Accel.UseHWCursor) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Disabling HW Cursor on stretched LCD\n"); - cPtr->Accel.UseHWCursor = FALSE; + cPtr->Flags &= ~ChipsHWCursor; } } - else - cPtr->Accel.UseHWCursor = TRUE; - if (xf86ReturnOptValBool(cPtr->Options, OPTION_HW_CURSOR, - FALSE) && - !xf86ReturnOptValBool(cPtr->Options, OPTION_SW_CURSOR, - FALSE)) + if (cPtr->Flags & ChipsHWCursor) tmp = (tmp == 0 ? 1 : tmp); /* Bug when doubling */ ChipsNew->XR[0x5A] = tmp > 0x0F ? 0 : (unsigned char)tmp; } else { @@ -6658,11 +6666,10 @@ /* set the clock */ chipsClockLoad(pScrn, &ChipsReg->Clock); /* chipsClockLoad() sets this so we don't want vgaHWRestore() change it */ - VgaReg->MiscOutReg = inb(0x3CC); + VgaReg->MiscOutReg = inb(cPtr->PIOBase + 0x3CC); /* set extended regs */ chipsRestoreExtendedRegs(pScrn, ChipsReg); - #if 0 /* if people complain about lock ups or blank screens -- reenable */ /* set CRTC registers - do it before sequencer restarts */ @@ -6724,6 +6731,7 @@ /* Fix resume again here, as Nozomi seems to need it */ chipsFixResume(pScrn); /*vgaHWProtect(pScrn, FALSE);*/ + #if 0 /* Enable pipeline if needed */ if (cPtr->Flags & ChipsDualChannelSupport) { @@ -6970,11 +6978,11 @@ if (IS_HiQV(cPtr)) { if (cPtr->Bus == ChipsPCI) cPtr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, - VIDMEM_MMIO_32BIT,cPtr->PciTag, cPtr->IOAddress, - 0x20000L); - else + VIDMEM_MMIO_32BIT,cPtr->PciTag, cPtr->IOAddress, + 0x20000L); + else cPtr->MMIOBase = xf86MapVidMem(pScrn->scrnIndex, - VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x20000L); + VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x20000L); } else { if (cPtr->Bus == ChipsPCI) cPtr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, @@ -7058,6 +7066,10 @@ if (cPtr->MMIOBase) xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->MMIOBase, 0x20000); + if (cPtr->MMIOBasePipeB) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->MMIOBasePipeB, + 0x20000); + cPtr->MMIOBasePipeB = NULL; } else { if (cPtr->MMIOBase) xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->MMIOBase, @@ -7227,7 +7239,7 @@ if (cPtr->UseMMIO) { MMIOmeml(DR(0x8)) = cPtr->HWCursorContents; } else { - outl(DR(0x8), cPtr->HWCursorContents); + outl(cPtr->PIOBase + DR(0x8), cPtr->HWCursorContents); } } } @@ -7249,8 +7261,8 @@ /* Also see ct_cursor.c */ MMIOmeml(DR(0x8)) = cPtr->HWCursorContents & 0xFFFE; } else { - cPtr->HWCursorContents = inl(DR(0x8)); - outw(DR(0x8), cPtr->HWCursorContents & 0xFFFE); + cPtr->HWCursorContents = inl(cPtr->PIOBase + DR(0x8)); + outw(cPtr->PIOBase + DR(0x8), cPtr->HWCursorContents & 0xFFFE); } } } Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.33 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.34 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.33 Mon Oct 1 09:44:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h Fri Jan 25 16:56:00 2002 @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.33 2001/10/01 13:44:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.34 2002/01/25 21:56:00 tsi Exp $ */ #ifndef _CT_DRIVER_H_ @@ -273,6 +273,7 @@ PCITAG PciTag; int Chipset; EntityInfoPtr pEnt; + IOADDRESS PIOBase; CARD32 IOAddress; unsigned long FbAddress; unsigned int IOBase; Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.7 Mon Oct 1 09:44:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c Fri Jan 25 16:56:00 2002 @@ -19,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c,v 1.7 2001/10/01 13:44:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c,v 1.8 2002/01/25 21:56:00 tsi Exp $ */ /* * The functions in this file are used to read/write the C&T extension register @@ -116,67 +116,67 @@ void chipsStdWriteXR(CHIPSPtr cPtr, CARD8 index, CARD8 value) { - outb(CHIPS_XR_INDEX, index); - outb(CHIPS_XR_DATA, value); + outb(cPtr->PIOBase + CHIPS_XR_INDEX, index); + outb(cPtr->PIOBase + CHIPS_XR_DATA, value); } static CARD8 chipsStdReadXR(CHIPSPtr cPtr, CARD8 index) { - outb(CHIPS_XR_INDEX, index); - return inb(CHIPS_XR_DATA); + outb(cPtr->PIOBase + CHIPS_XR_INDEX, index); + return inb(cPtr->PIOBase + CHIPS_XR_DATA); } static void chipsStdWriteFR(CHIPSPtr cPtr, CARD8 index, CARD8 value) { - outb(CHIPS_FR_INDEX, index); - outb(CHIPS_FR_DATA, value); + outb(cPtr->PIOBase + CHIPS_FR_INDEX, index); + outb(cPtr->PIOBase + CHIPS_FR_DATA, value); } static CARD8 chipsStdReadFR(CHIPSPtr cPtr, CARD8 index) { - outb(CHIPS_FR_INDEX, index); - return inb(CHIPS_FR_DATA); + outb(cPtr->PIOBase + CHIPS_FR_INDEX, index); + return inb(cPtr->PIOBase + CHIPS_FR_DATA); } static void chipsStdWriteMR(CHIPSPtr cPtr, CARD8 index, CARD8 value) { - outb(CHIPS_MR_INDEX, index); - outb(CHIPS_MR_DATA, value); + outb(cPtr->PIOBase + CHIPS_MR_INDEX, index); + outb(cPtr->PIOBase + CHIPS_MR_DATA, value); } static CARD8 chipsStdReadMR(CHIPSPtr cPtr, CARD8 index) { - outb(CHIPS_MR_INDEX, index); - return inb(CHIPS_MR_DATA); + outb(cPtr->PIOBase + CHIPS_MR_INDEX, index); + return inb(cPtr->PIOBase + CHIPS_MR_DATA); } static void chipsStdWriteMSS(CHIPSPtr cPtr, vgaHWPtr hwp, CARD8 value) { - outb(CHIPS_MSS, value); + outb(cPtr->PIOBase + CHIPS_MSS, value); } static CARD8 chipsStdReadMSS(CHIPSPtr cPtr) { - return inb(CHIPS_MSS); + return inb(cPtr->PIOBase + CHIPS_MSS); } static void chipsStdWriteIOSS(CHIPSPtr cPtr, CARD8 value) { - outb(CHIPS_IOSS, value); + outb(cPtr->PIOBase + CHIPS_IOSS, value); } static CARD8 chipsStdReadIOSS(CHIPSPtr cPtr) { - return inb(CHIPS_IOSS); + return inb(cPtr->PIOBase + CHIPS_IOSS); } void Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.9 Mon Oct 1 09:44:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c Mon Nov 25 09:04:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.9 2001/10/01 13:44:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.12 2002/11/25 14:04:58 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -60,8 +60,7 @@ int num_adaptors; if (!(cPtr->Flags & ChipsOverlay8plus16) && - (cPtr->Flags & ChipsVideoSupport) - && (cPtr->Flags & ChipsAccelSupport)) { + (cPtr->Flags & ChipsVideoSupport)) { newAdaptor = CHIPSSetupImageVideo(pScreen); CHIPSInitOffscreenImages(pScreen); } @@ -131,7 +130,7 @@ 16, XvPacked, 1, - 15, 0x001F, 0x03E0, 0x7C00, + 15, 0x7C00, 0x03E0, 0x001F, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -148,7 +147,7 @@ 16, XvPacked, 1, - 16, 0x001F, 0x07E0, 0xF800, + 16, 0xF800, 0x07E0, 0x001F, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -184,7 +183,9 @@ unsigned char mr3c; int red, green, blue; - CHIPSHiQVSync(pScrn); + if (cPtr->Flags & ChipsAccelSupport) + CHIPSHiQVSync(pScrn); + mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c | 0x6)); switch (pScrn->depth) { @@ -414,7 +415,8 @@ unsigned char mr3c, tmp; REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - CHIPSHiQVSync(pScrn); + if (cPtr->Flags & ChipsAccelSupport) + CHIPSHiQVSync(pScrn); if(shadow) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { mr3c = cPtr->readMR(cPtr, 0x3C); @@ -446,7 +448,8 @@ CHIPSPortPrivPtr pPriv = (CHIPSPortPrivPtr)data; CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSHiQVSync(pScrn); + if (cPtr->Flags & ChipsAccelSupport) + CHIPSHiQVSync(pScrn); if(attribute == xvColorKey) { int red, green, blue; pPriv->colorKey = value; @@ -654,7 +657,8 @@ unsigned char tmp, m1f, m1e; int buffer = pPriv->currentBuffer; - CHIPSHiQVSync(pScrn); + if (cPtr->Flags & ChipsAccelSupport) + CHIPSHiQVSync(pScrn); tmp = cPtr->readXR(cPtr, 0xD0); cPtr->writeXR(cPtr, 0xD0, (tmp | 0x10)); @@ -744,7 +748,7 @@ /* Vertical Zoom */ if (drw_h > src_h) { - m1f = m1f | 0xc0; + m1f = m1f | 0x80; m1e = m1e | 0x08; /* set V-interpolation */ tmp = cPtr->VideoZoomMax * src_h / drw_h ; cPtr->writeMR(cPtr, 0x33, tmp); @@ -754,7 +758,8 @@ tmp = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (tmp | 0x7)); - CHIPSHiQVSync(pScrn); + if (cPtr->Flags & ChipsAccelSupport) + CHIPSHiQVSync(pScrn); } static int @@ -865,10 +870,7 @@ /* update cliplist */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); - /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } offset += top * dstPitch; @@ -933,7 +935,8 @@ if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { if(pPriv->offTime < time) { - CHIPSHiQVSync(pScrn); + if (cPtr->Flags & ChipsAccelSupport) + CHIPSHiQVSync(pScrn); mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); pPriv->videoStatus = FREE_TIMER; @@ -1116,10 +1119,7 @@ CHIPSDisplayVideo(pScrn, surface->id, surface->offsets[0], surface->width, surface->height, surface->pitches[0], x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h, FALSE); - - XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); pPriv->isOn = TRUE; if(portPriv->videoStatus & CLIENT_VIDEO_ON) { Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile:1.32 xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile:1.32 Thu Feb 15 12:39:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile Mon Feb 17 12:06:41 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile,v 1.32 2001/02/15 17:39:28 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile,v 1.33 2003/02/17 17:06:41 dawes Exp $ XCOMM XCOMM This is an Imakefile for the Cirrus Logic driver. XCOMM @@ -30,7 +30,7 @@ -I$(FONTINCSRC) -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(XF86OSSRC)/int10 -I$(XF86SRC)/shadowfb \ - -I$(SERVERSRC)/render -I$(XF86OSSRC)/vbe + -I$(SERVERSRC)/render -I$(XF86SRC)/vbe #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.26 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.26 Fri Jan 4 16:22:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c Tue Jul 23 21:47:27 2002 @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.26 2002/01/04 21:22:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.28 2002/07/24 01:47:27 tsi Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -542,6 +542,7 @@ pCir = CIRPTR(pScrn); pCir->pScrn = pScrn; + pCir->PIOReg = hwp->PIOOffset + 0x3CE; /* Get the entity, and make sure it is PCI. */ pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -755,9 +756,9 @@ */ if (!pCir->UseMMIO) { pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT | RAC_FB; - xf86SetOperatingState(resVgaMemShared, pCir->pEnt->index,ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pCir->pEnt->index, ResUnusedOpr); } else { - xf86SetOperatingState(RES_SHARED_VGA, pCir->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVga, pCir->pEnt->index, ResUnusedOpr); } /* Register the PCI-assigned resources. */ Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.7 Mon Oct 1 09:44:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c Fri Jan 25 16:56:00 2002 @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.8 2002/01/25 21:56:00 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -16,8 +16,10 @@ #define _ALP_PRIVATE_ #include "alp.h" -#define WAIT outb(0x3CE,0x31); while(inb(0x3CF) & pCir->chip.alp->waitMsk){}; -#define WAIT_1 outb(0x3CE,0x31); while(inb(0x3CF) & 0x1){}; +#define WAIT outb(pCir->PIOReg, 0x31); \ + while(inb(pCir->PIOReg + 1) & pCir->chip.alp->waitMsk){}; +#define WAIT_1 outb(pCir->PIOReg, 0x31); \ + while(inb(pCir->PIOReg + 1) & 0x1){}; static const CARD16 translated_rop[] = { @@ -40,13 +42,15 @@ }; #if 1 -#define SetupForRop(rop) outw(0x3CE, translated_rop[rop]) +#define SetupForRop(rop) outw(pCir->PIOReg, translated_rop[rop]) #else -#define SetupForRop(rop) outw(0x3CE, 0x0D32) +#define SetupForRop(rop) outw(pCir->PIOReg, 0x0D32) #endif static void AlpSync(ScrnInfoPtr pScrn) { + CirPtr pCir = CIRPTR(pScrn); + #ifdef ALP_DEBUG ErrorF("AlpSync\n"); #endif @@ -69,11 +73,11 @@ WAIT; SetupForRop(rop); /* Set dest pitch */ - outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24); - outw(0x3CE, ((pitch) & 0x1f00) | 0x25); + outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); + outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); /* Set source pitch */ - outw(0x3CE, ((pitch << 8) & 0xff00) | 0x26); - outw(0x3CE, ((pitch) & 0x1f00) | 0x27); + outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x26); + outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x27); } static void @@ -98,27 +102,27 @@ WAIT; - outw(0x3CE, decrement | 0x30); + outw(pCir->PIOReg, decrement | 0x30); /* Width */ - outw(0x3CE, ((ww << 8) & 0xff00) | 0x20); - outw(0x3CE, ((ww) & 0x1f00) | 0x21); + outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); + outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); /* Height */ - outw(0x3CE, ((hh << 8) & 0xff00) | 0x22); - outw(0x3CE, ((hh) & 0x0700) | 0x23); + outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); + outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); /* source */ - outw(0x3CE, ((source << 8) & 0xff00) | 0x2C); - outw(0x3CE, ((source) & 0xff00) | 0x2D); - outw(0x3CE, ((source >> 8) & 0x3f00)| 0x2E); + outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C); + outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D); + outw(pCir->PIOReg, ((source >> 8) & 0x3f00)| 0x2E); /* dest */ - outw(0x3CE, ((dest << 8) & 0xff00) | 0x28); - outw(0x3CE, ((dest) & 0xff00) | 0x29); - outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A); + outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); + outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); + outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); if (!pCir->chip.alp->autoStart) - outw(0x3CE,0x0231); + outw(pCir->PIOReg, 0x0231); #ifdef ALP_DEBUG ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", @@ -155,9 +159,9 @@ { int source = pAlp->monoPattern8x8; /* source = 8x8 solid mono pattern */ - outw(0x3CE, ((source << 8) & 0xff00) | 0x2C); - outw(0x3CE, ((source) & 0xff00) | 0x2D); - outw(0x3CE, ((source >> 8) & 0x3f00) | 0x2E); + outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C); + outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D); + outw(pCir->PIOReg, ((source >> 8) & 0x3f00) | 0x2E); /* memset() may not be the fastest */ memset(pCir->FbBase + pAlp->monoPattern8x8, 0xFF, 8); write_mem_barrier(); @@ -165,21 +169,21 @@ } default: /* GR33 = 0x04 => does not exist on GD7548 */ - outw(0x3CE, 0x0433); + outw(pCir->PIOReg, 0x0433); } /* GR30 = color expansion, pattern copy */ /* Choses 8bpp / 16bpp color expansion */ - outw(0x3CE, 0xC030 |((pScrn->bitsPerPixel - 8) << 9)); + outw(pCir->PIOReg, 0xC030 |((pScrn->bitsPerPixel - 8) << 9)); - outw(0x3CE, ((color << 8) & 0xff00) | 0x01); - outw(0x3CE, ((color) & 0xff00) | 0x11); - outw(0x3CE, ((color >> 8) & 0xff00) | 0x13); - outw(0x3CE, 0x15); + outw(pCir->PIOReg, ((color << 8) & 0xff00) | 0x01); + outw(pCir->PIOReg, ((color) & 0xff00) | 0x11); + outw(pCir->PIOReg, ((color >> 8) & 0xff00) | 0x13); + outw(pCir->PIOReg, 0x15); /* Set dest pitch */ - outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24); - outw(0x3CE, ((pitch) & 0x1f00) | 0x25); + outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); + outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); } static void @@ -197,18 +201,18 @@ WAIT; /* Width */ - outw(0x3CE, ((ww << 8) & 0xff00) | 0x20); - outw(0x3CE, ((ww) & 0x1f00) | 0x21); + outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); + outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); /* Height */ - outw(0x3CE, ((hh << 8) & 0xff00) | 0x22); - outw(0x3CE, ((hh) & 0x0700) | 0x23); + outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); + outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); /* dest */ - outw(0x3CE, ((dest << 8) & 0xff00) | 0x28); - outw(0x3CE, ((dest) & 0xff00) | 0x29); - outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A); + outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); + outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); + outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); if (!pCir->chip.alp->autoStart) - outw(0x3CE,0x0231); + outw(pCir->PIOReg, 0x0231); #ifdef ALP_DEBUG ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", @@ -239,40 +243,40 @@ { int source = pAlp->monoPattern8x8; /* source = 8x8 solid mono pattern */ - outw(0x3CE, ((source << 8) & 0xff00) | 0x2C); - outw(0x3CE, ((source) & 0xff00) | 0x2D); - outw(0x3CE, ((source >> 8) & 0x3f00) | 0x2E); + outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C); + outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D); + outw(pCir->PIOReg, ((source >> 8) & 0x3f00) | 0x2E); } /* GR30 = color expansion, pattern copy */ /* Choses 8bpp / 16bpp color expansion */ if (bg == -1) { /* transparency requested */ - outw(0x3CE, 0xC830 |((pScrn->bitsPerPixel - 8) << 9)); + outw(pCir->PIOReg, 0xC830 |((pScrn->bitsPerPixel - 8) << 9)); bg = ~fg; /* transparent color compare */ - outw(0x3CE, ((bg << 8) & 0xff00) | 0x34); - outw(0x3CE, ((bg) & 0xff00) | 0x35); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); + outw(pCir->PIOReg, ((bg) & 0xff00) | 0x35); /* transparent color mask = 0 (all bits matters) */ - outw(0x3CE, 0x38); - outw(0x3CE, 0x39); + outw(pCir->PIOReg, 0x38); + outw(pCir->PIOReg, 0x39); } else { - outw(0x3CE, 0xC030 |((pScrn->bitsPerPixel - 8) << 9)); + outw(pCir->PIOReg, 0xC030 |((pScrn->bitsPerPixel - 8) << 9)); } - outw(0x3CE, ((fg << 8) & 0xff00) | 0x01); - outw(0x3CE, ((fg) & 0xff00) | 0x11); + outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01); + outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11); - outw(0x3CE, ((bg << 8) & 0xff00) | 0x00); - outw(0x3CE, ((bg) & 0xff00) | 0x10); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x00); + outw(pCir->PIOReg, ((bg) & 0xff00) | 0x10); /* Set dest pitch */ - outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24); - outw(0x3CE, ((pitch) & 0x1f00) | 0x25); + outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); + outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); } static void @@ -296,18 +300,18 @@ write_mem_barrier(); /* Width */ - outw(0x3CE, ((ww << 8) & 0xff00) | 0x20); - outw(0x3CE, ((ww) & 0x1f00) | 0x21); + outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); + outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); /* Height */ - outw(0x3CE, ((hh << 8) & 0xff00) | 0x22); - outw(0x3CE, ((hh) & 0x0700) | 0x23); + outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); + outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); /* dest */ - outw(0x3CE, ((dest << 8) & 0xff00) | 0x28); - outw(0x3CE, ((dest) & 0xff00) | 0x29); - outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A); + outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); + outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); + outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); if (!pCir->chip.alp->autoStart) - outw(0x3CE,0x0231); + outw(pCir->PIOReg, 0x0231); #ifdef ALP_DEBUG ErrorF("AlpSubsequent8x8PatternFill x=%d y=%d w=%d h=%d\n", @@ -342,31 +346,31 @@ /* Choses 8bpp / 16bpp color expansion */ if (bg == -1) { /* transparency requested */ - outw(0x3CE, 0x8C30 |((pScrn->bitsPerPixel - 8) << 9)); + outw(pCir->PIOReg, 0x8C30 |((pScrn->bitsPerPixel - 8) << 9)); bg = ~fg; /* transparent color compare */ - outw(0x3CE, ((bg << 8) & 0xff00) | 0x34); - outw(0x3CE, ((bg) & 0xff00) | 0x35); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); + outw(pCir->PIOReg, ((bg) & 0xff00) | 0x35); /* transparent color mask = 0 (all bits matters) */ - outw(0x3CE, 0x38); - outw(0x3CE, 0x39); + outw(pCir->PIOReg, 0x38); + outw(pCir->PIOReg, 0x39); } else { - outw(0x3CE, 0x8430 |((pScrn->bitsPerPixel - 8) << 9)); + outw(pCir->PIOReg, 0x8430 |((pScrn->bitsPerPixel - 8) << 9)); } - outw(0x3CE, ((bg << 8) & 0xff00) | 0x00); - outw(0x3CE, ((bg) & 0xff00) | 0x10); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x00); + outw(pCir->PIOReg, ((bg) & 0xff00) | 0x10); - outw(0x3CE, ((fg << 8) & 0xff00) | 0x01); - outw(0x3CE, ((fg) & 0xff00) | 0x11); + outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01); + outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11); /* Set dest pitch */ - outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24); - outw(0x3CE, ((pitch) & 0x1f00) | 0x25); + outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); + outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); } static void @@ -387,25 +391,25 @@ WAIT; /* Width */ - outw(0x3CE, ((ww << 8) & 0xff00) | 0x20); - outw(0x3CE, ((ww) & 0x1f00) | 0x21); + outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); + outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); /* Height */ - outw(0x3CE, ((hh << 8) & 0xff00) | 0x22); - outw(0x3CE, ((hh) & 0x0700) | 0x23); + outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); + outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); /* source = CPU ; description of bit 2 of GR30 in the 7548 manual says that if we do color expansion we must zero the source adress registers (GR2C, GR2D, GR2E) */ - outw(0x3CE, 0x2C); - outw(0x3CE, 0x2D); - outw(0x3CE, 0x2E); + outw(pCir->PIOReg, 0x2C); + outw(pCir->PIOReg, 0x2D); + outw(pCir->PIOReg, 0x2E); /* dest */ - outw(0x3CE, ((dest << 8) & 0xff00) | 0x28); - outw(0x3CE, ((dest) & 0xff00) | 0x29); - outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A); + outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); + outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); + outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); if (!pCir->chip.alp->autoStart) - outw(0x3CE,0x0231); + outw(pCir->PIOReg, 0x0231); #ifdef ALP_DEBUG ErrorF("AlpSubsequentCPUToScreenColorExpandFill x=%d y=%d w=%d h=%d\n", @@ -439,40 +443,40 @@ { /* transparency requested */ if (pScrn->bitsPerPixel > 8) /* 16 bpp */ { - outw(0x3CE, 0x9C30); + outw(pCir->PIOReg, 0x9C30); bg = ~fg; /* transparent color compare */ - outw(0x3CE, ((bg << 8) & 0xff00) | 0x34); - outw(0x3CE, ((bg) & 0xff00) | 0x35); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); + outw(pCir->PIOReg, ((bg) & 0xff00) | 0x35); } else /* 8 bpp */ { - outw(0x3CE, 0x8C30); + outw(pCir->PIOReg, 0x8C30); bg = ~fg; /* transparent color compare */ - outw(0x3CE, ((bg << 8) & 0xff00) | 0x34); - outw(0x3CE, ((bg << 8) & 0xff00) | 0x35); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x35); } /* transparent color mask = 0 (all bits matters) */ - outw(0x3CE, 0x38); - outw(0x3CE, 0x39); + outw(pCir->PIOReg, 0x38); + outw(pCir->PIOReg, 0x39); } else { - outw(0x3CE, 0x8430 |((pScrn->bitsPerPixel - 8) << 9)); + outw(pCir->PIOReg, 0x8430 |((pScrn->bitsPerPixel - 8) << 9)); } - outw(0x3CE, ((bg << 8) & 0xff00) | 0x00); - outw(0x3CE, ((bg) & 0xff00) | 0x10); + outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x00); + outw(pCir->PIOReg, ((bg) & 0xff00) | 0x10); - outw(0x3CE, ((fg << 8) & 0xff00) | 0x01); - outw(0x3CE, ((fg) & 0xff00) | 0x11); + outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01); + outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11); /* Set dest pitch */ - outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24); - outw(0x3CE, ((pitch) & 0x1f00) | 0x25); + outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); + outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); } static void @@ -523,32 +527,32 @@ WAIT_1; /* Width */ - outw(0x3CE, ((ww << 8) & 0xff00) | 0x20); - outw(0x3CE, ((ww) & 0x1f00) | 0x21); + outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); + outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); /* Height = 1 */ - outw(0x3CE, 0x22); - outw(0x3CE, 0x23); + outw(pCir->PIOReg, 0x22); + outw(pCir->PIOReg, 0x23); /* source = CPU ; description of bit 2 of GR30 in the 7548 manual says that if we do color expansion we must zero the source adress registers (GR2C, GR2D, GR2E) */ - outw(0x3CE, 0x2C); - outw(0x3CE, 0x2D); - outw(0x3CE, 0x2E); + outw(pCir->PIOReg, 0x2C); + outw(pCir->PIOReg, 0x2D); + outw(pCir->PIOReg, 0x2E); /* dest */ - outw(0x3CE, ((dest << 8) & 0xff00) | 0x28); - outw(0x3CE, ((dest) & 0xff00) | 0x29); + outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); + outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); write_mem_barrier(); #ifdef ALP_DEBUG ErrorF("AlpSubsequentColorExpandScanline (2)\n"); #endif - outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A); + outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); if (!pCir->chip.alp->autoStart) - outw(0x3CE,0x0231); + outw(pCir->PIOReg, 0x0231); { int i; @@ -568,10 +572,10 @@ { CirPtr pCir = CIRPTR(pScrn); - outw(0x3CE, 0x200E); /* enable writes to gr33 */ + outw(pCir->PIOReg, 0x200E); /* enable writes to gr33 */ /* Setup things for autostart */ if (pCir->properties & ACCEL_AUTOSTART) { - outw(0x3CE, 0x8031); /* enable autostart */ + outw(pCir->PIOReg, 0x8031); /* enable autostart */ pCir->chip.alp->waitMsk = 0x10; pCir->chip.alp->autoStart = TRUE; } else { Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.7 Mon Oct 1 09:44:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c Tue Jul 9 22:36:50 2002 @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -#define DEBUG -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ +/* #define DEBUG */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.8 2002/07/10 02:36:50 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.20 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.20 Fri Jan 4 16:26:54 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h Fri Jan 25 16:56:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.20 2002/01/04 21:26:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.21 2002/01/25 21:56:01 tsi Exp $ */ /* (c) Itai Nahshon */ @@ -19,6 +19,7 @@ CARD32 properties; pciVideoPtr PciInfo; PCITAG PciTag; + IOADDRESS PIOReg; union { struct lgRec *lg; struct alpRec *alp; Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.41 xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.43 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.41 Fri Jan 4 16:22:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c Tue Jul 23 21:47:27 2002 @@ -13,7 +13,7 @@ * David Dawes, Andrew E. Mileski, Leonard N. Zubkoff, * Guy DESBIEF, Itai Nahshon. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.41 2002/01/04 21:22:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.43 2002/07/24 01:47:27 tsi Exp $ */ #define EXPERIMENTAL @@ -444,6 +444,7 @@ pCir = CIRPTR(pScrn); pCir->pScrn = pScrn; + pCir->PIOReg = hwp->PIOOffset + 0x3CE; /* Get the entity, and make sure it is PCI. */ pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -650,7 +651,7 @@ | RAC_VIEWPORT #endif ; - xf86SetOperatingState(resVgaMemShared, pCir->pEnt->index,ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pCir->pEnt->index, ResUnusedOpr); /* Register the PCI-assigned resources. */ if (xf86RegisterResources(pCir->pEnt->index, NULL, ResExclusive)) { Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/ChangeLog diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/cyrix/ChangeLog:1.1 --- /dev/null Thu Feb 27 12:30:43 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/ChangeLog Wed Nov 6 06:38:59 2002 @@ -0,0 +1,11 @@ + +Release 0.2 +----------- +First release to the unsuspecting masses. + +Release 0.3 +----------- +Fix segv on X -configure (Bruce Montague) +Fix hang with weird video layouts (Bruce Montague) +Initial (not yet used) code for VSA free mode setup (Alan Cox) + Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile:1.5 Tue Jan 23 19:06:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile Mon Feb 17 12:06:42 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile,v 1.5 2001/01/24 00:06:17 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile,v 1.8 2003/02/17 17:06:42 dawes Exp $ XCOMM XCOMM This is an Imakefile for the CYRIX driver. XCOMM @@ -6,18 +6,19 @@ #define IHaveModules #include <Server.tmpl> -SRCS = cyrix_driver.c cyrix_accel.c cyrix_bank.c cyrix_helper.c -OBJS = cyrix_driver.o cyrix_accel.o cyrix_bank.o cyrix_helper.o +SRCS = cyrix_driver.c cyrix_accel.c cyrix_bank.c cyrix_helper.c cyrix_shadow.c +OBJS = cyrix_driver.o cyrix_accel.o cyrix_bank.o cyrix_helper.o cyrix_shadow.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ + -I$(XF86SRC)/xaa -I$(XF86SRC)/rac -I$(XF86SRC)/shadowfb \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/ramdac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XTOP)/include/extensions -I$(SERVERSRC)/render + -I$(XTOP)/include/extensions -I$(SERVERSRC)/render \ + -I$(XF86SRC)/vbe -I$(XF86SRC)/int10 #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/README diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/cyrix/README:1.1 --- /dev/null Thu Feb 27 12:30:43 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/README Wed Nov 6 06:38:59 2002 @@ -0,0 +1,59 @@ + +MediaGX Fun +----------- + +This tries to document the "gotcha's" associated with the Cyrix +hardware and also the SoftVGA (SMM BIOS emulation of video) implementation. + +o Palette Handling + + In theory 8bit modes can use the VGA colour control. In practice + this doesn't work at least on some 5530 based systems with LCD + displays. + + Some 5510 based systems need special handling for external LCD + RAMDAC. We don't currently do this. + +o Mode Switches + + If you load unsuitable data into the Soft VGA mode switching + registers or forgot to set the ModeSwitch disable before you + load the registers up mode switches may fail. In a few cases + you get bogus illegal instructions reported + +o BIOS Versions + + The VSA1/VSA2 firmware that does all the magic on the Cyrix + processors is an SMM mode software block in the BIOS. This means + the Cyrix is one system where different BIOSes have different bugs + instead of just having to fight the hardware + + The BIOS is just plain unusable in a few systems. Code exists to + do some mode switches the hard way without VSA getting involved. + +o Compression Buffer + + To cut down on the memory usage the display scan checks dirty + bits on each scan line (per frame in some situations) and if the + line is dirty it scans it from the original buffer and writes back + a compressed line if it can do so. If it does this it clears the + dirty bit. We have to handle dirty bits ourselves and getting it + wrong produces interesting visuals. + +o Memory Layout + + When you use VSA to do mode set up it makes certain assumptions + about memory layout. Typically it lays out the frame buffer + with the compression buffer at the end. When there is enough + space between the lines (the chip only handles 1024/2048 bytes + stride) it will hide them in the gaps + + + +To Do +----- +- Add bare-metal setup option for the BIOS afflicted +- Add 5510 external ics5432 RAMDAC support +- Restore hardware cursor support +- DDC/EDID and friends +- RandR would be nice for the tablet pc systems Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h:1.3 Fri May 4 15:05:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h Wed Nov 6 06:38:59 2002 @@ -1,5 +1,6 @@ /* * Copyright 2000 by Richard A. Hecker, California, United States + * Copyright 2002 by Red Hat Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -19,14 +20,24 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RICHARD HECKER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * * Author: Richard Hecker, hecker@cat.dfrc.nasa.gov * Re-written for XFree86 v4.0 + * Chunks re-written again for XFree86 v4.2 + * Alan Cox <alan@redhat.com> * Previous driver (pre-XFree86 v4.0) by * Annius V. Groenink (A.V.Groenink@zfc.nl, avg@cwi.nl), * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h,v 1.3 2001/05/04 19:05:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h,v 1.4 2002/11/06 11:38:59 alanh Exp $ */ #ifndef _CYRIX_H_ #define _CYRIX_H_ @@ -52,6 +63,7 @@ unsigned char cyrixRegsDAC[0x01]; unsigned char cyrixRegsClock[0x03]; unsigned char DacRegs[0x300]; + unsigned int Colormap[0x100]; /* Actually 18bit values */ } CYRIXRegRec, *CYRIXRegPtr; typedef struct { @@ -59,6 +71,7 @@ unsigned char VerticalTimingExtension; unsigned char ExtendedAddressControl; unsigned char ExtendedOffset; + unsigned char Offset; unsigned char ExtendedColorControl; unsigned char DisplayCompression; unsigned char DriverControl; @@ -113,9 +126,15 @@ vgaHWRec std; prevExt PrevExt; Bool HWCursor; - Bool IsCyber; - Bool NewClockCode; +/* Bool IsCyber; + Bool NewClockCode;*/ Bool NoAccel; + Bool NoCompress; + Bool ShadowFB; + unsigned char * ShadowPtr; + int ShadowPitch; + int Rotate; + void (*PointerMoved)(int index, int x, int y); OptionInfoPtr Options; /* accel stuff */ int bltBufWidth; @@ -139,8 +158,12 @@ extern void CyrixRestore(ScrnInfoPtr pScrn, CYRIXRegPtr cyrixReg); extern void * CyrixSave(ScrnInfoPtr pScrn, CYRIXRegPtr cyrixReg); +/* Shadow routines */ +extern void CYRIXRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void CYRIXPointerMoved(int index, int x, int y); +extern void CYRIXRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void CYRIXRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -/* externs in cyrix_asm.s */ extern void CYRIXsetBlitBuffers(void); extern void CYRIXsetBlitBuffersOnOldChip(void); Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man:1.2 Sat Jan 27 13:20:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man Wed Nov 6 06:38:59 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man,v 1.2 2001/01/27 18:20:47 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man,v 1.3 2002/11/06 11:38:59 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH CYRIX __drivermansuffix__ __vendorversion__ @@ -14,17 +14,62 @@ .fi .SH DESCRIPTION .B cyrix -is an XFree86 driver for Cyrix video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. +is an XFree86 driver for the Cyrix MediaGX (now Natsemi Geode) series of +processors when using the built in video. .SH SUPPORTED HARDWARE The .B cyrix -driver supports... +driver supports the MediaGX, MediaGXi and MediaGXm processors, as well as +the Natsemi 'Geode' branded processors. It supports the CS5510, CS5520, +CS5530 and CS5530A companion chips. The driver supports 4, 8, 15 and 16 bit +deep displays with video compression and acceleration. +.PP +The MediaGX run length compresses its shared framebuffer, for the best +performance on a MediaGX machine pick backgrounds that compress well +horizonally. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. +.PP +The following driver +.B options +are supported +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Disable or enable software cursor. Default software cursor is enabled and a +hardware cursor is used. +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Disable or enable hardware cursor. Default hardware cursor is disabled. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Disable or enable shadow frame buffer. The shadow buffer is normally only +used when rotating the screen. The default is false. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +.PP +Rotate the display clockwise or counterclockwise for use on Cyrix based +tablet PC systems. This mode is currently unaccelerated. +.SH "BUGS" +This driver has not been tested on the original 5510 hardware for some +considerable time. +.PP +8bit mode does not currently work on the CS5510 with external RAMDAC. +.PP +The 5530A video overlay facility is not currently supported. +.PP +XFree86 uses the MediaGX 'SoftVGA' interface. On a small number of boards +this is buggy and may result in strange illegal instruction traps. +.PP +Hardware cursors are not currently supported. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS -Authors include: ... +Authors include: Richard Hecker, Annius Groenink, Dirk Hohndel, The GGI +Project, Alan Cox. Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c:1.4 Mon Jan 7 13:46:04 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c Wed Nov 6 06:38:59 2002 @@ -26,7 +26,7 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c,v 1.4 2002/01/07 18:46:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c,v 1.5 2002/11/06 11:38:59 alanh Exp $ */ #include "vgaHW.h" #include "xf86.h" @@ -54,9 +54,6 @@ 0x2A, 0xAA, 0x6A, 0xEA, 0x26, 0xA6, 0x66, 0xE6, 0x2E, 0xAE, 0x6E, 0xEE }; - -#if 0 -#endif /* Forward declaration of functions used in the driver */ void CYRIXAccelSync(ScrnInfoPtr pScrn); Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c:1.2 Tue Jul 25 21:52:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c Wed Nov 6 06:38:59 2002 @@ -26,7 +26,7 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c,v 1.2 2000/07/26 01:52:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c,v 1.3 2002/11/06 11:38:59 alanh Exp $ */ #define PSZ 8 Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.24 Fri Jan 4 16:22:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c Mon Jan 6 19:05:13 2003 @@ -1,5 +1,6 @@ /* * Copyright 2000 by Richard A. Hecker, California, United States + * Copyright 2002 by Red Hat Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -19,14 +20,37 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RICHARD HECKER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * * Author: Richard Hecker, hecker@cat.dfrc.nasa.gov * Re-written for XFree86 v4.0 + * + * Chunks re-written again for XFree86 v4.2 + * Alan Cox <alan@redhat.com> + * - Fixed cursor handling + * - Rewrote parts of the broken mode switch code + * - Added proper PCI detection + * - Added ShadowFB support + * - Added rotate support + * - Fixed palette loading/restore + * - Added "Nocompression" option + * - Fixed line length loading + * - Fixed panning logic + * * Previous driver (pre-XFree86 v4.0) by * Annius V. Groenink (A.V.Groenink@zfc.nl, avg@cwi.nl), * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. + * (note that most of the data books have been released by + * NatSemi and are downloadable for free as pdf files) */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.24 2002/01/04 21:22:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.26 2003/01/07 00:05:13 alanh Exp $ */ #include "fb.h" #include "mibank.h" @@ -38,10 +62,14 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" #include "xf86cmap.h" +#include "shadowfb.h" #include "vgaHW.h" +#include "xf86DDC.h" #include "xf86RAC.h" #include "xf86Resources.h" #include "compiler.h" +#include "xf86int10.h" +#include "vbe.h" #include "cyrix.h" @@ -75,12 +103,11 @@ int flags); /* Internally used functions */ -#if 0 -static void CYRIXEnterLeave(Bool enter); -#endif static void CYRIXSave(ScrnInfoPtr pScrn); static void CYRIXRestore(ScrnInfoPtr pScrn); static Bool CYRIXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void CYRIXRestorePalette(ScrnInfoPtr pScrn); +static void CYRIXSavePalette(ScrnInfoPtr pScrn); /* Misc additional routines */ void CYRIXSetRead(int bank); @@ -130,13 +157,19 @@ typedef enum { OPTION_SW_CURSOR, OPTION_HW_CURSOR, - OPTION_NOACCEL + OPTION_NOACCEL, + OPTION_NOCOMPRESS, + OPTION_SHADOW_FB, + OPTION_ROTATE } CYRIXOpts; static const OptionInfoRec CYRIXOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOCOMPRESS, "NoCompression",OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -169,6 +202,18 @@ NULL }; +static const char *shadowSymbols[] = { + "ShadowFBInit", + NULL +}; + +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + /* access to the MediaGX video hardware registers */ @@ -204,7 +249,7 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&CYRIX, module, 0); - LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, NULL); + LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, vbeSymbols, shadowSymbols, NULL); return (pointer)TRUE; } @@ -294,6 +339,18 @@ return CYRIXOptions; } +#define PCI_CHIP_CYRIX5510 0x0000 +#define PCI_CHIP_CYRIX5520 0x0002 +#define PCI_CHIP_CYRIX5530 0x0104 + +/* Conversion PCI ID to chipset name */ +static PciChipsets CYRIXPCIchipsets[] = { + { CHIP_CYRIXmediagx, PCI_CHIP_CYRIX5510, RES_EXCLUSIVE_VGA }, + { CHIP_CYRIXmediagx, PCI_CHIP_CYRIX5520, RES_EXCLUSIVE_VGA }, + { CHIP_CYRIXmediagx, PCI_CHIP_CYRIX5530, RES_EXCLUSIVE_VGA }, + { -1, -1, RES_UNDEFINED } +}; + /* Mandatory */ static Bool CYRIXProbe(DriverPtr drv, int flags) @@ -324,43 +381,80 @@ */ return FALSE; } +#ifdef DEBUG xf86ErrorFVerb(3,"%s: Device Sections found: %d\n",CYRIX_NAME, numDevSections); +#endif + /* Should look like an ISA device */ + /* PCI BUS */ + if (xf86GetPciVideoInfo() ) { + numUsed = xf86MatchPciInstances(CYRIX_NAME, PCI_VENDOR_CYRIX, + CYRIXChipsets, CYRIXPCIchipsets, + devSections,numDevSections, + drv, &usedChips); + + if (numUsed > 0) { + if (flags & PROBE_DETECT) + foundScreen = TRUE; + else for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + /* Allocate a ScrnInfoRec and claim the slot */ + if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + CYRIXPCIchipsets,NULL, NULL, + NULL, NULL, NULL))) { + pScrn->driverVersion = VERSION; + pScrn->driverName = CYRIX_DRIVER_NAME; + pScrn->name = CYRIX_NAME; + pScrn->Probe = CYRIXProbe; + pScrn->PreInit = CYRIXPreInit; + pScrn->ScreenInit = CYRIXScreenInit; + pScrn->SwitchMode = CYRIXSwitchMode; + pScrn->AdjustFrame = CYRIXAdjustFrame; + pScrn->LeaveVT = CYRIXLeaveVT; + pScrn->EnterVT = CYRIXEnterVT; + pScrn->FreeScreen = CYRIXFreeScreen; + pScrn->ValidMode = CYRIXValidMode; + foundScreen = TRUE; + } + } + xfree(usedChips); + } + } + + numUsed = xf86MatchIsaInstances(CYRIX_NAME,CYRIXChipsets, CYRIXISAChipsets,drv, CYRIXFindIsaDevice,devSections, numDevSections,&usedChips); - - if (numUsed <= 0) - return FALSE; - - foundScreen = TRUE; + if(numUsed > 0) { + foundScreen = TRUE; - /* Free it since we don't need that list after this */ - xfree(devSections); + /* Free it since we don't need that list after this */ + xfree(devSections); - if (!(flags & PROBE_DETECT)) { - for (i=0; i < numUsed; i++) { + if (!(flags & PROBE_DETECT)) { + for (i=0; i < numUsed; i++) { - /* Fill in what we can of the ScrnInfoRec */ - pScrn = NULL; - if ((pScrn = xf86ConfigIsaEntity(pScrn, 0, usedChips[i], + /* Fill in what we can of the ScrnInfoRec */ + pScrn = NULL; + if ((pScrn = xf86ConfigIsaEntity(pScrn, 0, usedChips[i], CYRIXISAChipsets, NULL, NULL, NULL, NULL, NULL))){ - pScrn->driverVersion = VERSION; - pScrn->driverName = CYRIX_DRIVER_NAME; - pScrn->name = CYRIX_NAME; - pScrn->Probe = CYRIXProbe; - pScrn->PreInit = CYRIXPreInit; - pScrn->ScreenInit = CYRIXScreenInit; - pScrn->SwitchMode = CYRIXSwitchMode; - pScrn->AdjustFrame = CYRIXAdjustFrame; - pScrn->LeaveVT = CYRIXLeaveVT; - pScrn->EnterVT = CYRIXEnterVT; - pScrn->FreeScreen = CYRIXFreeScreen; - pScrn->ValidMode = CYRIXValidMode; - } + pScrn->driverVersion = VERSION; + pScrn->driverName = CYRIX_DRIVER_NAME; + pScrn->name = CYRIX_NAME; + pScrn->Probe = CYRIXProbe; + pScrn->PreInit = CYRIXPreInit; + pScrn->ScreenInit = CYRIXScreenInit; + pScrn->SwitchMode = CYRIXSwitchMode; + pScrn->AdjustFrame = CYRIXAdjustFrame; + pScrn->LeaveVT = CYRIXLeaveVT; + pScrn->EnterVT = CYRIXEnterVT; + pScrn->FreeScreen = CYRIXFreeScreen; + pScrn->ValidMode = CYRIXValidMode; + } + } } } xfree(usedChips); @@ -423,6 +517,7 @@ /* Unprotect MediaGX extended registers */ outb(vgaIOBase + 4, CrtcExtendedRegisterLock); outb(vgaIOBase + 5, 0x00); + return (int)CHIP_CYRIXmediagx; fail: @@ -431,6 +526,17 @@ outb(vgaIOBase + 5, 0x00); return -1; } + +static void +CYRIXProbeDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL,index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } +} /* Mandatory */ static Bool @@ -446,8 +552,8 @@ int device_step, device_revision; int vgaIOBase; unsigned char gcr; - - if (flags & PROBE_DETECT) return FALSE; + static int accelWidths[3]= {2,1024, 2048}; + const char *s; /* Allocate the CYRIXRec driverPrivate */ if (!CYRIXGetRec(pScrn)) return FALSE; @@ -466,6 +572,16 @@ */ pCyrix = CYRIXPTR(pScrn); + pCyrix->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + + if (pCyrix->pEnt->location.type != BUS_PCI) + return FALSE; + + if (flags & PROBE_DETECT) { + CYRIXProbeDDC(pScrn, pCyrix->pEnt->index); + return TRUE; + } + /* The vgahw module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; @@ -497,7 +613,6 @@ physbase = (gcr & 3) << 30; padsize = (gcr & 12) ? (((gcr & 12) >> 2) + 1) : 0; - /* end GGI MediaGX driver based code */ if (padsize == 0) return (FALSE); @@ -623,20 +738,10 @@ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCyrix->Options); /* Set the bits per RGB for 8bpp mode */ - if (pScrn->depth == 8) { - /* XXX This is here just to test options. */ - /* Default to 8 */ - pScrn->rgbBits = 8; -#if 0 - if (xf86GetOptValInteger(pCyrix->Options, OPTION_RGB_BITS, - &pScrn->rgbBits)) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Bits per RGB set to %d\n", - pScrn->rgbBits); - } -#endif - } + pScrn->rgbBits = 6; + from = X_DEFAULT; - pCyrix->HWCursor = TRUE; + pCyrix->HWCursor = FALSE; if (xf86IsOptionSet(pCyrix->Options, OPTION_HW_CURSOR)) { from = X_CONFIG; pCyrix->HWCursor = TRUE; @@ -645,6 +750,39 @@ from = X_CONFIG; pCyrix->HWCursor = FALSE; } + if (pCyrix->HWCursor == TRUE) + xf86DrvMsg(pScrn->scrnIndex, from, "Hardware cursor is disabled in this release\n"); + + if (xf86ReturnOptValBool(pCyrix->Options, OPTION_SHADOW_FB, FALSE)) { + pCyrix->ShadowFB = TRUE; + pCyrix->NoAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using \"Shadow Framebuffer\" - acceleration disabled\n"); + } + pCyrix->Rotate = 0; + if ((s = xf86GetOptValString(pCyrix->Options, OPTION_ROTATE))) { + if(!xf86NameCmp(s, "CW")) { + pCyrix->ShadowFB = TRUE; + pCyrix->NoAccel = TRUE; + pCyrix->HWCursor = FALSE; + pCyrix->Rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n"); + } else + if(!xf86NameCmp(s, "CCW")) { + pCyrix->ShadowFB = TRUE; + pCyrix->NoAccel = TRUE; + pCyrix->HWCursor = FALSE; + pCyrix->Rotate = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise - acceleration disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n"); + } + } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pCyrix->HWCursor ? "HW" : "SW"); if (xf86IsOptionSet(pCyrix->Options, OPTION_NOACCEL)) { @@ -652,6 +790,12 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } + pCyrix->NoCompress = FALSE; + if (xf86IsOptionSet(pCyrix->Options, OPTION_NOCOMPRESS)) { + pCyrix->NoCompress = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Compression disabled\n"); + } + pCyrix->PciInfo = NULL; pCyrix->RamDac = -1; @@ -672,8 +816,6 @@ pCyrix->EngineOperation = 0x00; - pCyrix->IsCyber = FALSE; - pCyrix->NewClockCode = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Found %s chip\n", pScrn->chipset); @@ -751,7 +893,7 @@ */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, - NULL, 256, 2048, + accelWidths, 256, 2048, pScrn->bitsPerPixel, 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, @@ -823,6 +965,15 @@ } } + /* Load shadowfb if needed */ + if (pCyrix->ShadowFB) { + if (!xf86LoadSubModule(pScrn, "shadowfb")) { + CYRIXFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(shadowSymbols, NULL); + } + return TRUE; } @@ -843,6 +994,7 @@ vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); CyrixSave(pScrn, cyrixReg); + CYRIXSavePalette(pScrn); } @@ -869,7 +1021,6 @@ return FALSE; pScrn->vtSema = TRUE; - pCyrix = CYRIXPTR(pScrn); /* Do the guts of this work */ @@ -883,7 +1034,7 @@ cyrixReg = &pCyrix->ModeReg; CyrixRestore(pScrn, cyrixReg); - /*vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); */ +/* vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);*/ return TRUE; } @@ -907,13 +1058,81 @@ vgaHWProtect(pScrn, TRUE); /*CyrixRestore(pScrn, cyrixReg);*/ - + CYRIXRestorePalette(pScrn); vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); vgaHWProtect(pScrn, FALSE); } +/* Needed because we are not VGA enough in all cases (eg 5530 LCD) */ +static void +CYRIXLoadPalette( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ + int i; + unsigned int locked; + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + + switch(pScrn->depth) { + case 15: + case 16: + return; + } + + locked = GX_REG(DC_UNLOCK); + GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; + + for(i = 0; i < numColors; i++) { + unsigned int red, green, blue; + int index = indices[i]; + + red = colors[index].red; + green = colors[index].green; + blue = colors[index].blue;; + + GX_REG(DC_PAL_ADDRESS) = index; + GX_REG(DC_PAL_DATA) = (red << 12) | (green << 6) | blue; + } + GX_REG(DC_UNLOCK) = locked; +} + +static void CYRIXSavePalette(ScrnInfoPtr pScrn) +{ + int i; + unsigned int locked; + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + + locked = GX_REG(DC_UNLOCK); + GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; + + for(i = 0; i < 256; i++) { + GX_REG(DC_PAL_ADDRESS) = i; + pCyrix->SavedReg.Colormap[i] = GX_REG(DC_PAL_DATA); + } + GX_REG(DC_UNLOCK) = locked; +} + +static void CYRIXRestorePalette(ScrnInfoPtr pScrn) +{ + int i; + unsigned int locked; + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + + locked = GX_REG(DC_UNLOCK); + GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; + + for(i = 0; i < 256; i++) { + GX_REG(DC_PAL_ADDRESS) = i; + GX_REG(DC_PAL_DATA) = pCyrix->SavedReg.Colormap[i]; + } + GX_REG(DC_UNLOCK) = locked; +} + /* Mandatory */ /* This gets called at the start of each server generation */ @@ -927,7 +1146,8 @@ CYRIXPrvPtr pCyrix; int ret; VisualPtr visual; - + int width, height, displayWidth; + unsigned char *FBStart; /* * First get the ScrnInfoRec */ @@ -981,6 +1201,9 @@ pScrn->defaultVisual)) return FALSE; } else { + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) @@ -989,6 +1212,25 @@ miSetPixmapDepths (); + width = pScrn->virtualX; + height = pScrn->virtualY; + displayWidth = pScrn->displayWidth; + + + if(pCyrix->Rotate) { + height = pScrn->virtualX; + width = pScrn->virtualY; + } + + if(pCyrix->ShadowFB) { + pCyrix->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); + pCyrix->ShadowPtr = xalloc(pCyrix->ShadowPitch * height); + displayWidth = pCyrix->ShadowPitch / (pScrn->bitsPerPixel >> 3); + FBStart = pCyrix->ShadowPtr; + } else { + pCyrix->ShadowPtr = NULL; + FBStart = pCyrix->FbBase; + } /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -999,9 +1241,9 @@ case 4: case 8: case 16: - ret = fbScreenInit(pScreen, pCyrix->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel); + ret = fbScreenInit(pScreen, FBStart, width, + height, pScrn->xDpi, pScrn->yDpi, + displayWidth, pScrn->bitsPerPixel); break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1079,14 +1321,34 @@ if (!miCreateDefColormap(pScreen)) return FALSE; - if (!vgaHWHandleColormaps(pScreen)) - return FALSE; + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, + CYRIXLoadPalette, NULL, + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; xf86DPMSInit(pScreen, (DPMSSetProcPtr)CYRIXDisplayPowerManagementSet, 0); pScrn->memPhysBase = pCyrix->FbAddress; pScrn->fbOffset = 0; + if(pCyrix->ShadowFB) { + RefreshAreaFuncPtr refreshArea = CYRIXRefreshArea; + + if(pCyrix->Rotate) { + if (!pCyrix->PointerMoved) { + pCyrix->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = CYRIXPointerMoved; + } + + switch(pScrn->bitsPerPixel) { + case 8: refreshArea = CYRIXRefreshArea8; break; + case 16: refreshArea = CYRIXRefreshArea16; break; + } + } + + ShadowFBInit(pScreen, refreshArea); + } + pCyrix->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = CYRIXCloseScreen; pScreen->SaveScreen = CYRIXSaveScreen; @@ -1126,18 +1388,23 @@ switch (pScrn->bitsPerPixel) { case 4: - base /= 2; +/* base /= 2; */ + base = base >> 4; break; case 8: base = (base & 0xFFFFFFF8) >> 2; break; case 16: - base *= (pScrn->bitsPerPixel / 8); +/* base *= (pScrn->bitsPerPixel / 8); */ + base /= 2; break; } GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; + /* If you switch to poking FB_ST_OFFSET directly it expects to be + fed different values to the SoftVGA emulation code */ + /*GX_REG(DC_FB_ST_OFFSET) = base; */ /* CRT bits 0-15 */ outw(vgaIOBase + 4, (base & 0x00FF00) | 0x0C); @@ -1209,6 +1476,8 @@ pCyrix = CYRIXPTR(pScrn); if(pCyrix->AccelInfoRec) XAADestroyInfoRec(pCyrix->AccelInfoRec); + if (pCyrix->ShadowPtr) + xfree(pCyrix->ShadowPtr); pScrn->vtSema = FALSE; pScreen->CloseScreen = pCyrix->CloseScreen; @@ -1245,34 +1514,3 @@ return vgaHWSaveScreen(pScreen, mode); } -#if 0 -static void -CYRIXEnterLeave(enter) -Bool enter; -{ - unsigned char temp; - - if (enter) { - GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; - - /* Unprotect CRTC[0-7] */ - outb(vgaIOBase + 4, 0x11); temp = inb(vgaIOBase + 5); - outb(vgaIOBase + 5, temp & 0x7F); - - /* Unprotect MediaGX extended registers */ - outb(vgaIOBase + 4, CrtcExtendedRegisterLock); - outb(vgaIOBase + 5, 0x57); - outb(vgaIOBase + 5, 0x4C); - - } else { - /* Protect MediaGX extended registers */ - outb(vgaIOBase + 4, CrtcExtendedRegisterLock); - outb(vgaIOBase + 5, 0x00); - - /* Protect CRTC[0-7] */ - outb(vgaIOBase + 4, 0x11); temp = inb(vgaIOBase + 5); - outb(vgaIOBase + 5, (temp & 0x7F) | 0x80); - GX_REG(DC_UNLOCK) = 0; - } -} -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c:1.3 Tue Jul 25 21:52:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c Wed Nov 6 06:38:59 2002 @@ -1,5 +1,6 @@ /* * Copyright 2000 by Richard A. Hecker, California, United States + * Copyright 2002 by Red Hat Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -19,14 +20,26 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RICHARD HECKER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * * Author: Richard Hecker, hecker@cat.dfrc.nasa.gov * Re-written for XFree86 v4.0 + * + * Chunks re-written again for XFree86 v4.2 + * Alan Cox <alan@redhat.com> + * * Previous driver (pre-XFree86 v4.0) by * Annius V. Groenink (A.V.Groenink@zfc.nl, avg@cwi.nl), * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c,v 1.3 2000/07/26 01:52:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c,v 1.4 2002/11/06 11:38:59 alanh Exp $ */ #include "cyrix.h" #include "vgaHW.h" @@ -43,47 +56,43 @@ static void CYRIXresetVGA(ScrnInfoPtr pScrn, unsigned long vgaIOBase); -void -Cyrix1bppColorMap(ScrnInfoPtr pScrn) +void Cyrix1bppColorMap(ScrnInfoPtr pScrn) { /* use dedicated color map routines on new chipsets in 8bpp */ - ErrorF("%s: Cyrix 1BPP is only a stub for now.\n",X_PROBED); - + ErrorF("%s: Cyrix 1BPP is only a stub for now.\n", X_PROBED); return; } -int -CyrixHWCursor(ScreenPtr pScreen) +int CyrixHWCursor(ScreenPtr pScreen) { - int pitch; - - pitch=1024; - - - return pitch; + return 1024; } -void -CyrixRestore(ScrnInfoPtr pScrn, CYRIXRegPtr cyrixReg) -{ unsigned char temp; +void CyrixRestore(ScrnInfoPtr pScrn, CYRIXRegPtr cyrixReg) +{ + unsigned char temp; CYRIXPrvPtr pCyrix; + vgaHWPtr hwp; vgaRegPtr vgaReg; unsigned long vgaIOBase; vgaHWProtect(pScrn, TRUE); /* Blank the screen */ pCyrix = CYRIXPTR(pScrn); - vgaReg = &VGAHWPTR(pScrn)->SavedReg; - vgaIOBase = VGAHWPTR(pScrn)->IOBase; +/* vgaReg = &VGAHWPTR(pScrn)->SavedReg; */ + hwp = VGAHWPTR(pScrn); + vgaHWUnlock(hwp); + vgaReg = &hwp->ModeReg; - /* it would be ideal to be able to use the ModeSwitchControl - register to protect SoftVGA from reading the configuration - before all registers have been written. But that bit must be - set somewhere in the middle of vgaHWRestore (after restoring - the font). Luckily things seem to work without it. */ + vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* restore standard VGA portion */ + outb(vgaIOBase + 4, CrtcModeSwitchControl); + outb(vgaIOBase + 5, 0x01); CYRIXresetVGA(pScrn,vgaIOBase); vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + + vgaHWProtect(pScrn, TRUE); /* Blank the screen */ + CYRIXmarkLinesDirty; /* restore miscellaneous output registers */ @@ -105,9 +114,12 @@ outb(vgaIOBase + 5, (pCyrix->PrevExt.ExtendedAddressControl & 0x07) | (temp & 0xf8)); + outb(vgaIOBase + 4, 19); + outb(vgaIOBase + 5, pCyrix->PrevExt.Offset); + outb(vgaIOBase + 4, CrtcExtendedOffset); temp = inb(vgaIOBase + 5); - outb(vgaIOBase + 5, (pCyrix->PrevExt.ExtendedOffset & 0x03) + outb(vgaIOBase + 5, ((pCyrix->PrevExt.ExtendedOffset) & 0x03) | (temp & 0xfc)); outb(vgaIOBase + 4, CrtcExtendedColorControl); @@ -125,6 +137,9 @@ outb(vgaIOBase + 5, (pCyrix->PrevExt.DACControl & 0x0e) | (temp & 0xf1)); + outb(vgaIOBase + 4, CrtcModeSwitchControl); + outb(vgaIOBase + 5, 0x00); + /* let SoftVGA programming settle before we access DC registers, but don't wait too long */ usleep(1000); @@ -132,7 +147,7 @@ /* restore display controller hardware registers */ #ifndef MONOVGA -#define DCFG_MASK (DC_GCFG_FDTY | DC_GCFG_DECE | DC_GCFG_CMPE) +#define DCFG_MASK (DC_GCFG_FDTY | DC_GCFG_DECE | DC_GCFG_CMPE | DC_GCFG_FBLC | DC_GCFG_CURE) #define GPBS_MASK (BC_16BPP | BC_FB_WIDTH_2048) GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; @@ -168,6 +183,12 @@ unsigned long vgaIOBase; #ifndef MONOVGA + /* If we don't turn on the screen we end up restoring a + blanked display on some boxes whose APM is a bit too smart. + Save the display turned -on- therefore */ + + vgaHWProtect(pScrn, FALSE); /* Turn on screen */ + /* save graphics pipeline registers */ pCyrix = CYRIXPTR(pScrn); vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -198,6 +219,9 @@ outb(vgaIOBase + 4, CrtcExtendedAddressControl); pCyrix->PrevExt.ExtendedAddressControl = inb(vgaIOBase + 5); + outb(vgaIOBase + 4, 19); + pCyrix->PrevExt.Offset = inb(vgaIOBase + 5); + outb(vgaIOBase + 4, CrtcExtendedOffset); pCyrix->PrevExt.ExtendedOffset = inb(vgaIOBase + 5); @@ -260,6 +284,7 @@ EAC_PACKED_CHAIN4; pCyrix->PrevExt.ExtendedOffset = ((line_offset >> 8) & 0x03); + pCyrix->PrevExt.Offset = line_offset; pCyrix->PrevExt.ExtendedColorControl = (pScrn->bitsPerPixel == 16) ? ECC_16BPP | ECC_565_FORMAT @@ -299,13 +324,16 @@ screen. If the line delta is not 1024 or 2048, entire frames will be flagged dirty as opposed to lines. Problems with 16bpp and line-dirty flagging seem to have been solved now. */ - if (mode->CrtcVDisplay == pScrn->virtualY && - mode->CrtcHDisplay == pScrn->virtualX) - { pCyrix->PrevExt.DcGeneralCfg = DC_GCFG_DECE - | DC_GCFG_CMPE; - if (/* pScrn->bitsPerPixel != 8 || -- this is OK now */ - (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) & 0x03FF) - pCyrix->PrevExt.DcGeneralCfg |= DC_GCFG_FDTY; + + if (pCyrix->NoCompress == FALSE && + mode->CrtcVDisplay == pScrn->virtualY && + mode->CrtcHDisplay == pScrn->virtualX && + 0 == GX_REG(DC_FB_ST_OFFSET)) + { + pCyrix->PrevExt.DcGeneralCfg = DC_GCFG_DECE | DC_GCFG_CMPE; + if (/* pScrn->bitsPerPixel != 8 || -- this is OK now */ + (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) & 0x03FF) + pCyrix->PrevExt.DcGeneralCfg |= DC_GCFG_FDTY; } else pCyrix->PrevExt.DcGeneralCfg = 0; Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_shadow.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_shadow.c:1.1 --- /dev/null Thu Feb 27 12:30:43 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_shadow.c Wed Nov 6 06:38:59 2002 @@ -0,0 +1,155 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_shadow.c,v 1.1 2002/11/06 11:38:59 alanh Exp $ */ + +/* + Copyright (c) 1999, The XFree86 Project Inc. + Written by Mark Vojkovich <markv@valinux.com> +*/ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "cyrix.h" +#include "shadowfb.h" +#include "servermd.h" + + + +void +CYRIXRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + + while(num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = pCyrix->ShadowPtr + (pbox->y1 * pCyrix->ShadowPitch) + + (pbox->x1 * Bpp); + dst = pCyrix->FbBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + + while(height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += pCyrix->ShadowPitch; + } + + pbox++; + } +} + +void +CYRIXPointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + int newX, newY; + + if(pCyrix->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + + (*pCyrix->PointerMoved)(index, newX, newY); +} + +void +CYRIXRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pCyrix->Rotate * pCyrix->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if(pCyrix->Rotate == 1) { + dstPtr = pCyrix->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = pCyrix->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = pCyrix->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = pCyrix->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch * 2] << 16) | + (src[srcPitch * 3] << 24); + src += srcPitch * 4; + } + srcPtr += pCyrix->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +void +CYRIXRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + CYRIXPrvPtr pCyrix = CYRIXPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pCyrix->Rotate * pCyrix->ShadowPitch >> 1; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + + if(pCyrix->Rotate == 1) { + dstPtr = (CARD16*)pCyrix->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16*)pCyrix->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16*)pCyrix->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16*)pCyrix->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch * 2; + } + srcPtr += pCyrix->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + Index: xc/programs/Xserver/hw/xfree86/drivers/dummy/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/dummy/Imakefile:1.1 --- /dev/null Thu Feb 27 12:30:43 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/dummy/Imakefile Wed Sep 18 04:54:55 2002 @@ -0,0 +1,41 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/dummy/Imakefile,v 1.1 2002/09/18 08:54:55 eich Exp $ +#define IHaveModules +#include <Server.tmpl> + + +SRCS = dummy_driver.c dummy_cursor.c dummy_dga.c /* dummy_video.c */ + +OBJS = dummy_driver.o dummy_cursor.o dummy_dga.o /* dummy_video.o */ + +DEFINES = -DPSZ=8 + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(SERVERSRC)/fb \ + -I$(SERVERSRC)/mfb -I$(XINCLUDESRC) -I$(FONTINCSRC) \ + -I$(XF86SRC)/ramdac -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \ + -I$(SERVERSRC)/render +#endif + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + + +ModuleObjectRule() + +ObjectModuleTarget(dummy,$(OBJS)) + +InstallObjectModule(dummy,$(MODULEDIR),drivers) + +DependTarget() + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/dummy) +InstallDriverSDKNonExecFile(dummy.h,$(DRIVERSDKDIR)/drivers/dummy) +InstallDriverSDKNonExecFile(dummy_cursor.c,$(DRIVERSDKDIR)/drivers/dummy) +InstallDriverSDKNonExecFile(dummy_dga.c,$(DRIVERSDKDIR)/drivers/dummy) +InstallDriverSDKNonExecFile(dummy_driver.c,$(DRIVERSDKDIR)/drivers/dummy) + +InstallDriverSDKObjectModule(dummy,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy.h:1.1 --- /dev/null Thu Feb 27 12:30:44 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy.h Wed Sep 18 04:54:55 2002 @@ -0,0 +1,76 @@ + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "xf86Cursor.h" + +#ifdef XvExtension +# include "xf86xv.h" +# include "Xv.h" +#endif /* XvExtension */ + + +/* Supported chipsets */ +typedef enum { + DUMMY_CHIP +} DUMMYType; + +/* function prototypes */ + +extern Bool DUMMYSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +extern void DUMMYAdjustFrame(int scrnIndex, int x, int y, int flags); + +/* in dummy_cursor.c */ +extern Bool DUMMYCursorInit(ScreenPtr pScrn); +extern void DUMMYShowCursor(ScrnInfoPtr pScrn); +extern void DUMMYHideCursor(ScrnInfoPtr pScrn); + +/* in dummy_dga.c */ +Bool DUMMYDGAInit(ScreenPtr pScreen); + +/* in dummy_video.c */ +extern void DUMMYInitVideo(ScreenPtr pScreen); + +/* globals */ +typedef struct _color +{ + int red; + int green; + int blue; +} dummy_colors; + +typedef struct dummyRec +{ + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + /* options */ + OptionInfoPtr Options; + Bool swCursor; + /* proc pointer */ + CloseScreenProcPtr CloseScreen; + xf86CursorInfoPtr CursorInfo; + + Bool DummyHWCursorShown; + int cursorX, cursorY; + int cursorFG, cursorBG; + + Bool screenSaver; +#ifdef XvExtension + Bool video; + XF86VideoAdaptorPtr overlayAdaptor; + int overlay; + int overlay_offset; + int videoKey; + int interlace; +#endif /* XvExtension */ + dummy_colors colors[256]; + pointer* FBBase; +} DUMMYRec, *DUMMYPtr; + +/* The privates of the DUMMY driver */ +#define DUMMYPTR(p) ((DUMMYPtr)((p)->driverPrivate)) + Index: xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_cursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_cursor.c:1.1 --- /dev/null Thu Feb 27 12:30:44 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_cursor.c Wed Sep 18 04:54:55 2002 @@ -0,0 +1,101 @@ +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "xf86Cursor.h" +#include "cursorstr.h" +/* Driver specific headers */ +#include "dummy.h" + +static void +dummyShowCursor(ScrnInfoPtr pScrn) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + /* turn cursor on */ + dPtr->DummyHWCursorShown = TRUE; +} + +static void +dummyHideCursor(ScrnInfoPtr pScrn) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + /* + * turn cursor off + * + */ + dPtr->DummyHWCursorShown = FALSE; +} + +#define MAX_CURS 64 + +static void +dummySetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + +/* unsigned char *_dest = ((unsigned char *)dPtr->FBBase + */ +/* pScrn->videoRam * 1024 - 1024); */ + dPtr->cursorX = x; + dPtr->cursorY = y; +} + +static void +dummySetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + dPtr->cursorFG = fg; + dPtr->cursorBG = bg; +} + +static void +dummyLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +{ +} + +static Bool +dummyUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) +{ + DUMMYPtr dPtr = DUMMYPTR(xf86Screens[pScr->myNum]); + return(!dPtr->swCursor); +} + +#if 0 +static unsigned char* +dummyRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) +{ + return NULL; +} +#endif + +Bool +DUMMYCursorInit(ScreenPtr pScreen) +{ + DUMMYPtr dPtr = DUMMYPTR(xf86Screens[pScreen->myNum]); + + xf86CursorInfoPtr infoPtr; + infoPtr = xf86CreateCursorInfoRec(); + if(!infoPtr) return FALSE; + + dPtr->CursorInfo = infoPtr; + + infoPtr->MaxHeight = 64; + infoPtr->MaxWidth = 64; + infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; + + infoPtr->SetCursorColors = dummySetCursorColors; + infoPtr->SetCursorPosition = dummySetCursorPosition; + infoPtr->LoadCursorImage = dummyLoadCursorImage; + infoPtr->HideCursor = dummyHideCursor; + infoPtr->ShowCursor = dummyShowCursor; + infoPtr->UseHWCursor = dummyUseHWCursor; +/* infoPtr->RealizeCursor = dummyRealizeCursor; */ + + return(xf86InitCursor(pScreen, infoPtr)); +} + + + Index: xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_dga.c:1.1 --- /dev/null Thu Feb 27 12:30:44 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_dga.c Wed Sep 18 04:54:55 2002 @@ -0,0 +1,174 @@ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "dgaproc.h" +#include "dummy.h" + +static Bool DUMMY_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static Bool DUMMY_SetMode(ScrnInfoPtr, DGAModePtr); +static int DUMMY_GetViewport(ScrnInfoPtr); +static void DUMMY_SetViewport(ScrnInfoPtr, int, int, int); + +static +DGAFunctionRec DUMMYDGAFuncs = { + DUMMY_OpenFramebuffer, + NULL, + DUMMY_SetMode, + DUMMY_SetViewport, + DUMMY_GetViewport, + NULL, + NULL, + NULL, +#if 0 + DUMMY_BlitTransRect +#else + NULL +#endif +}; + +Bool +DUMMYDGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0, imlines, pixlines; + + imlines = (pScrn->videoRam * 1024) / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + + pixlines = imlines; + + pMode = firstMode = pScrn->modes; + + while(pMode) { + + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + + if(!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + + currentMode = modes + num; + num++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + if(pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if(pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = (unsigned char *)pDUMMY->FBBase; + + currentMode->bytesPerScanline = + ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = imlines; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = pixlines; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + pMode = pMode->next; + if(pMode == firstMode) + break; + } + + pDUMMY->numDGAModes = num; + pDUMMY->DGAModes = modes; + + return DGAInit(pScreen, &DUMMYDGAFuncs, modes, num); +} + +static DisplayModePtr DUMMYSavedDGAModes[MAXSCREENS]; + +static Bool +DUMMY_SetMode( + ScrnInfoPtr pScrn, + DGAModePtr pMode +){ + int index = pScrn->pScreen->myNum; + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + if(!pMode) { /* restore the original mode */ + if(pDUMMY->DGAactive) { + pScrn->currentMode = DUMMYSavedDGAModes[index]; + DUMMYSwitchMode(index, pScrn->currentMode, 0); + DUMMYAdjustFrame(index, 0, 0, 0); + pDUMMY->DGAactive = FALSE; + } + } else { + if(!pDUMMY->DGAactive) { /* save the old parameters */ + DUMMYSavedDGAModes[index] = pScrn->currentMode; + pDUMMY->DGAactive = TRUE; + } + + DUMMYSwitchMode(index, pMode->mode, 0); + } + + return TRUE; +} + +static int +DUMMY_GetViewport( + ScrnInfoPtr pScrn +){ + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + return pDUMMY->DGAViewportStatus; +} + +static void +DUMMY_SetViewport( + ScrnInfoPtr pScrn, + int x, int y, + int flags +){ + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + DUMMYAdjustFrame(pScrn->pScreen->myNum, x, y, flags); + pDUMMY->DGAViewportStatus = 0; +} + + +static Bool +DUMMY_OpenFramebuffer( + ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, + int *size, + int *offset, + int *flags +){ + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char*)pDUMMY->FBBase; + *size = pScrn->videoRam * 1024; + *offset = 0; + *flags = DGA_NEED_ROOT; + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_driver.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_driver.c:1.1 --- /dev/null Thu Feb 27 12:30:44 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/dummy/dummy_driver.c Wed Sep 18 04:54:55 2002 @@ -0,0 +1,781 @@ + +/* + * Copyright 2002, SuSE Linux AG, Author: Egbert Eich + */ + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Bus.h" + +/* This is used for module versioning */ +#include "xf86Version.h" + +/* All drivers initialising the SW cursor need this */ +#include "mipointer.h" + +/* All drivers implementing backing store need this */ +#include "mibstore.h" + +/* All drivers using the mi colormap manipulation need this */ +#include "micmap.h" + +#include "xf86cmap.h" + +#include "xf86fbman.h" + +#include "fb.h" + +#include "picturestr.h" + +#ifdef XvExtension +#include "xf86xv.h" +#include "Xv.h" +#endif + +/* + * Driver data structures. + */ +#include "dummy.h" + +/* These need to be checked */ +#include "X.h" +#include "Xproto.h" +#include "scrnintstr.h" +#include "servermd.h" +#define _XF86DGA_SERVER_ +#include "extensions/xf86dgastr.h" + +/* Mandatory functions */ +static const OptionInfoRec * DUMMYAvailableOptions(int chipid, int busid); +static void DUMMYIdentify(int flags); +static Bool DUMMYProbe(DriverPtr drv, int flags); +static Bool DUMMYPreInit(ScrnInfoPtr pScrn, int flags); +static Bool DUMMYScreenInit(int Index, ScreenPtr pScreen, int argc, + char **argv); +static Bool DUMMYEnterVT(int scrnIndex, int flags); +static void DUMMYLeaveVT(int scrnIndex, int flags); +static Bool DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen); +static void DUMMYFreeScreen(int scrnIndex, int flags); +static int DUMMYValidMode(int scrnIndex, DisplayModePtr mode, + Bool verbose, int flags); +static Bool DUMMYSaveScreen(ScreenPtr pScreen, int mode); + +/* Internally used functions */ +static Bool dummyModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void dummySave(ScrnInfoPtr pScrn); +static void dummyRestore(ScrnInfoPtr pScrn, Bool restoreText); + +/* static void DUMMYDisplayPowerManagementSet(ScrnInfoPtr pScrn, */ +/* int PowerManagementMode, int flags); */ + +#define VERSION 4000 +#define DUMMY_NAME "DUMMY" +#define DUMMY_DRIVER_NAME "dummy" + +#define DUMMY_MAJOR_VERSION 0 +#define DUMMY_MINOR_VERSION 1 +#define DUMMY_PATCHLEVEL 0 + +/* + * This is intentionally screen-independent. It indicates the binding + * choice made in the first PreInit. + */ +static int pix24bpp = 0; + + +/* + * This contains the functions needed by the server after loading the driver + * module. It must be supplied, and gets passed back by the SetupProc + * function in the dynamic case. In the static case, a reference to this + * is compiled in, and this requires that the name of this DriverRec be + * an upper-case version of the driver name. + */ + +DriverRec DUMMY = { + VERSION, + DUMMY_DRIVER_NAME, + DUMMYIdentify, + DUMMYProbe, + DUMMYAvailableOptions, + NULL, + 0 +}; + +static SymTabRec DUMMYChipsets[] = { + { DUMMY_CHIP, "dummy" }, + { -1, NULL } +}; + +typedef enum { + OPTION_SW_CURSOR +} DUMMYOpts; + +static const OptionInfoRec DUMMYOptions[] = { + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + + +/* + * List of symbols from other modules that this module references. This + * list is used to tell the loader that it is OK for symbols here to be + * unresolved providing that it hasn't been told that they haven't been + * told that they are essential via a call to xf86LoaderReqSymbols() or + * xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about + * unresolved symbols that are not required. + */ + +static const char *fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", + NULL +}; + +static const char *ramdacSymbols[] = { + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL +}; + + +#ifdef XFree86LOADER + +static MODULESETUPPROTO(dummySetup); + +static XF86ModuleVersionInfo dummyVersRec = +{ + "dummy", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + DUMMY_MAJOR_VERSION, DUMMY_MINOR_VERSION, DUMMY_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0,0,0,0} +}; + +/* + * This is the module init data. + * Its name has to be the driver name followed by ModuleData + */ +XF86ModuleData dummyModuleData = { &dummyVersRec, dummySetup, NULL }; + +static pointer +dummySetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&DUMMY, module, 0); + + /* + * Modules that this driver always requires can be loaded here + * by calling LoadSubModule(). + */ + + /* + * Tell the loader about symbols from other modules that this module + * might refer to. + */ + LoaderRefSymLists(fbSymbols, ramdacSymbols, NULL); + /* + * The return value must be non-NULL on success even though there + * is no TearDownProc. + */ + return (pointer)1; + } else { + if (errmaj) *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +#endif /* XFree86LOADER */ + +static Bool +DUMMYGetRec(ScrnInfoPtr pScrn) +{ + /* + * Allocate a DUMMYRec, and hook it into pScrn->driverPrivate. + * pScrn->driverPrivate is initialised to NULL, so we can check if + * the allocation has already been done. + */ + if (pScrn->driverPrivate != NULL) + return TRUE; + + pScrn->driverPrivate = xnfcalloc(sizeof(DUMMYRec), 1); + + if (pScrn->driverPrivate == NULL) + return FALSE; + return TRUE; +} + +static void +DUMMYFreeRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate == NULL) + return; + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; +} + +static const OptionInfoRec * +DUMMYAvailableOptions(int chipid, int busid) +{ + return DUMMYOptions; +} + +/* Mandatory */ +static void +DUMMYIdentify(int flags) +{ + xf86PrintChipsets(DUMMY_NAME, "Driver for Dummy chipsets", + DUMMYChipsets); +} + +/* Mandatory */ +static Bool +DUMMYProbe(DriverPtr drv, int flags) +{ + Bool foundScreen = FALSE; + int numDevSections, numUsed; + GDevPtr *devSections; + int i; + + if (flags & PROBE_DETECT) + return FALSE; + /* + * Find the config file Device sections that match this + * driver, and return if there are none. + */ + if ((numDevSections = xf86MatchDevice(DUMMY_DRIVER_NAME, + &devSections)) <= 0) { + return FALSE; + } + + numUsed = numDevSections; + + if (numUsed > 0) { + + for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + int entityIndex = + xf86ClaimNoSlot(drv,DUMMY_CHIP,devSections[i],TRUE); + /* Allocate a ScrnInfoRec and claim the slot */ + if ((pScrn = xf86AllocateScreen(drv,0 ))) { + xf86AddEntityToScreen(pScrn,entityIndex); + pScrn->driverVersion = VERSION; + pScrn->driverName = DUMMY_DRIVER_NAME; + pScrn->name = DUMMY_NAME; + pScrn->Probe = DUMMYProbe; + pScrn->PreInit = DUMMYPreInit; + pScrn->ScreenInit = DUMMYScreenInit; + pScrn->SwitchMode = DUMMYSwitchMode; + pScrn->AdjustFrame = DUMMYAdjustFrame; + pScrn->EnterVT = DUMMYEnterVT; + pScrn->LeaveVT = DUMMYLeaveVT; + pScrn->FreeScreen = DUMMYFreeScreen; + pScrn->ValidMode = DUMMYValidMode; + + foundScreen = TRUE; + } + } + } + return foundScreen; +} + +# define RETURN \ + { DUMMYFreeRec(pScrn);\ + return FALSE;\ + } + +/* Mandatory */ +Bool +DUMMYPreInit(ScrnInfoPtr pScrn, int flags) +{ + ClockRangePtr clockRanges; + int i; + DUMMYPtr dPtr; + int maxClock = 230000; + GDevPtr device = xf86GetEntityInfo(pScrn->entityList[0])->device; + + if (flags & PROBE_DETECT) + return TRUE; + + /* Allocate the DummyRec driverPrivate */ + if (!DUMMYGetRec(pScrn)) { + return FALSE; + } +# define RETURN \ + { DUMMYFreeRec(pScrn);\ + return FALSE;\ + } + + dPtr = DUMMYPTR(pScrn); + + pScrn->chipset = (char *)xf86TokenToString(DUMMYChipsets, + DUMMY_CHIP); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Chipset is a DUMMY\n"); + + pScrn->monitor = pScrn->confScreen->monitor; + + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb)) + return FALSE; + else { + /* Check that the returned depth is one we support */ + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScrn->depth); + return FALSE; + } + } + + xf86PrintDepthBpp(pScrn); + if (pScrn->depth == 8) + pScrn->rgbBits = 8; + + /* Get the depth24 pixmap format */ + if (pScrn->depth == 24 && pix24bpp == 0) + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + + /* + * This must happen after pScrn->display has been set because + * xf86SetWeight references it. + */ + if (pScrn->depth > 8) { + /* The defaults are OK for us */ + rgb zeros = {0, 0, 0}; + + if (!xf86SetWeight(pScrn, zeros, zeros)) { + return FALSE; + } else { + /* XXX check that weight returned is supported */ + ; + } + } + + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + + if (pScrn->depth > 1) { + Gamma zeros = {0.0, 0.0, 0.0}; + + if (!xf86SetGamma(pScrn, zeros)) + return FALSE; + } + + xf86CollectOptions(pScrn, device->options); + /* Process the options */ + if (!(dPtr->Options = xalloc(sizeof(DUMMYOptions)))) + return FALSE; + memcpy(dPtr->Options, DUMMYOptions, sizeof(DUMMYOptions)); + + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options); + + xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor); + + if (device->videoRam != 0) { + pScrn->videoRam = device->videoRam; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "VideoRAM: %d kByte\n", + pScrn->videoRam); + } else { + pScrn->videoRam = 4096; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kByte\n", + pScrn->videoRam); + } + + if (device->dacSpeeds[0] != 0) { + maxClock = device->dacSpeeds[0]; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Max Clock: %d kHz\n", + maxClock); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Max Clock: %d kHz\n", + maxClock); + } + + pScrn->progClock = TRUE; + /* + * Setup the ClockRanges, which describe what clock ranges are available, + * and what sort of modes they can be used for. + */ + clockRanges = (ClockRangePtr)xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->ClockMulFactor = 1; + clockRanges->minClock = 11000; /* guessed §§§ */ + clockRanges->maxClock = 300000; + clockRanges->clockIndex = -1; /* programmable */ + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = TRUE; + + /* Subtract memory for HW cursor */ + + + { + int apertureSize = (pScrn->videoRam * 1024); + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, + NULL, 256, 2048,(8 * pScrn->bitsPerPixel), + 128, 2048, pScrn->display->virtualX, + pScrn->display->virtualY, apertureSize, + LOOKUP_BEST_REFRESH); + + if (i == -1) + RETURN; + } + + /* Prune the modes marked as invalid */ + xf86PruneDriverModes(pScrn); + + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + RETURN; + } + + /* + * Set the CRTC parameters for all of the modes based on the type + * of mode, and the chipset's interlace requirements. + * + * Calling this is required if the mode->Crtc* values are used by the + * driver and if the driver doesn't provide code to set them. They + * are not pre-initialised at all. + */ + xf86SetCrtcForModes(pScrn, 0); + + /* Set the current mode to the first in the list */ + pScrn->currentMode = pScrn->modes; + + /* Print the list of modes being used */ + xf86PrintModes(pScrn); + + /* If monitor resolution is set on the command line, use it */ + xf86SetDpi(pScrn, 0, 0); + + if (xf86LoadSubModule(pScrn, "fb") == NULL) { + RETURN; + } + xf86LoaderReqSymLists(fbSymbols, NULL); + + if (!dPtr->swCursor) { + if (!xf86LoadSubModule(pScrn, "ramdac")) + RETURN; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + } + + return TRUE; +} +#undef RETURN + +/* Mandatory */ +static Bool +DUMMYEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + + /* Should we re-save the text mode on each VT enter? */ + if(!dummyModeInit(pScrn, pScrn->currentMode)) + return FALSE; + + DUMMYAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + return TRUE; +} + +/* Mandatory */ +static void +DUMMYLeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + dummyRestore(pScrn, TRUE); +} + +static void +DUMMYLoadPalette( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ + int i, index, shift, Gshift; + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + switch(pScrn->depth) { + case 15: + shift = Gshift = 1; + break; + case 16: + shift = 0; + Gshift = 0; + break; + default: + shift = Gshift = 0; + break; + } + + for(i = 0; i < numColors; i++) { + index = indices[i]; + dPtr->colors[index].red = colors[index].red << shift; + dPtr->colors[index].green = colors[index].green << Gshift; + dPtr->colors[index].blue = colors[index].blue << shift; + } + +} + +/* Mandatory */ +static Bool +DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScrn; + DUMMYPtr dPtr; + int ret; + VisualPtr visual; + int height, width; + + /* + * we need to get the ScrnInfoRec for this screen, so let's allocate + * one first thing + */ + pScrn = xf86Screens[pScreen->myNum]; + dPtr = DUMMYPTR(pScrn); + + + if (!(dPtr->FBBase = xalloc(pScrn->videoRam * 1024))) + return FALSE; + + /* + * next we save the current state and setup the first mode + */ + dummySave(pScrn); + + if (!dummyModeInit(pScrn,pScrn->currentMode)) + return FALSE; + DUMMYAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + /* + * Reset visual list. + */ + miClearVisualTypes(); + + /* Setup the visuals we support. */ + + if (!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + + if (!miSetPixmapDepths ()) return FALSE; + + /* + * Call the framebuffer layer's ScreenInit function, and fill in other + * pScreen fields. + */ + width = pScrn->virtualX; + height = pScrn->virtualY; + + ret = fbScreenInit(pScreen, dPtr->FBBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel); + if (!ret) + return FALSE; + + if (pScrn->depth > 8) { + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); + + xf86SetBlackWhitePixels(pScreen); + + DUMMYDGAInit(pScreen); + + if (dPtr->swCursor) + xf86DrvMsg(scrnIndex, X_CONFIG, "Using Software Cursor.\n"); + + { + + + BoxRec AvailFBArea; + int lines = pScrn->videoRam * 1024 / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = lines; + xf86InitFBManager(pScreen, &AvailFBArea); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %i scanlines of offscreen memory \n" + , lines - pScrn->virtualY); + } + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + + /* Initialise cursor functions */ + miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); + + + if (!dPtr->swCursor) { + /* HW cursor functions */ + if (!DUMMYCursorInit(pScreen)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + return FALSE; + } + } + + /* Initialise default colourmap */ + if(!miCreateDefColormap(pScreen)) + return FALSE; + + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, + DUMMYLoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR + | CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + +/* DUMMYInitVideo(pScreen); */ + + pScreen->SaveScreen = DUMMYSaveScreen; + + + /* Wrap the current CloseScreen function */ + dPtr->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = DUMMYCloseScreen; + + /* Report any unused options (only for the first generation) */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + } + + return TRUE; +} + +/* Mandatory */ +Bool +DUMMYSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + return dummyModeInit(xf86Screens[scrnIndex], mode); +} + +/* Mandatory */ +void +DUMMYAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrn; + int Base; + + pScrn = xf86Screens[scrnIndex]; + + Base = (y * pScrn->displayWidth + x) >> 2; + + /* Scale Base by the number of bytes per pixel. */ + switch (pScrn->depth) { + case 8 : + break; + case 15 : + case 16 : + Base *= 2; + break; + case 24 : + Base *= 3; + break; + default : + break; + } +} + +/* Mandatory */ +static Bool +DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + if(pScrn->vtSema){ + dummyRestore(pScrn, TRUE); + xfree(dPtr->FBBase); + } + + if (dPtr->CursorInfo) + xf86DestroyCursorInfoRec(dPtr->CursorInfo); + + pScrn->vtSema = FALSE; + pScreen->CloseScreen = dPtr->CloseScreen; + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + +/* Optional */ +static void +DUMMYFreeScreen(int scrnIndex, int flags) +{ + DUMMYFreeRec(xf86Screens[scrnIndex]); +} + +static Bool +DUMMYSaveScreen(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = NULL; + DUMMYPtr dPtr; + + if (pScreen != NULL) { + pScrn = xf86Screens[pScreen->myNum]; + dPtr = DUMMYPTR(pScrn); + + dPtr->screenSaver = xf86IsUnblank(mode); + } + return TRUE; +} + +/* Optional */ +static int +DUMMYValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +{ + return(MODE_OK); +} + +static void +dummySave(ScrnInfoPtr pScrn) +{ +} + +static void +dummyRestore(ScrnInfoPtr pScrn, Bool restoreText) +{ +} + +static Bool +dummyModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + dummyRestore(pScrn, FALSE); + + return(TRUE); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c diff -u xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.38 xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.42 --- xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.38 Sat Oct 27 23:33:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c Wed Oct 9 21:35:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.38 2001/10/28 03:33:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.42 2002/10/10 01:35:20 dawes Exp $ */ /* * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> @@ -23,7 +23,6 @@ #ifdef USE_AFB #include "afb.h" #endif -#include "cfb24_32.h" #include "xf86Resources.h" #include "xf86RAC.h" @@ -128,11 +127,6 @@ NULL }; -static const char *cfbSymbols[] = { - "cfb24_32ScreenInit", - NULL -}; - static const char *fbSymbols[] = { "fbScreenInit", "fbPictureInit", @@ -140,9 +134,12 @@ }; static const char *shadowSymbols[] = { + "shadowAdd", "shadowAlloc", "shadowInit", + "shadowSetup", "shadowUpdatePacked", + "shadowUpdateRotatePacked", NULL }; @@ -171,6 +168,8 @@ "fbdevHWLeaveVT", "fbdevHWModeInit", "fbdevHWRestore", + "fbdevHWSave", + "fbdevHWSaveScreen", "fbdevHWSwitchMode", "fbdevHWValidMode", @@ -207,8 +206,8 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&FBDEV, module, 0); - LoaderRefSymLists(afbSymbols, cfbSymbols, - fbSymbols, shadowSymbols, NULL); + LoaderRefSymLists(afbSymbols, fbSymbols, + shadowSymbols, fbdevHWSymbols, NULL); return (pointer)1; } else { if (errmaj) *errmaj = LDR_ONCEONLY; @@ -521,10 +520,13 @@ if (fPtr->shadowFB) pScrn->displayWidth = pScrn->virtualX; /* ShadowFB handles this correctly */ - else + else { + int fbbpp; /* FIXME: this doesn't work for all cases, e.g. when each scanline has a padding which is independent from the depth (controlfb) */ - pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(fbdevHWGetDepth(pScrn,NULL) >> 3); + fbdevHWGetDepth(pScrn,&fbbpp); + pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(fbbpp >> 3); + } xf86PrintModes(pScrn); @@ -543,22 +545,11 @@ { case 8: case 16: + case 24: case 32: mod = "fb"; syms = fbSymbols; break; - case 24: - if (pix24bpp == 32) - { - mod = "xf24_32bpp"; - syms = cfbSymbols; - } - else - { - mod = "fb"; - syms = fbSymbols; - } - break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unsupported bpp: %d", pScrn->bitsPerPixel); @@ -908,6 +899,9 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; FBDevPtr fPtr = FBDEVPTR(pScrn); + + if (!pScrn->vtSema) + return NULL; if (fPtr->lineLength) *size = fPtr->lineLength; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.35 xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.39 --- xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.35 Fri May 25 07:19:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile Mon Feb 17 12:06:42 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.35 2001/05/25 11:19:58 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.39 2003/02/17 17:06:42 dawes Exp $ XCOMM XCOMM This is an Imakefile for the GLINT driver. XCOMM @@ -6,10 +6,17 @@ #define IHaveModules #include <Server.tmpl> +/* XXX Temporary: for now DRM for BSD/GLINT has something missing. */ +#if !defined(LinuxArchitecture) +#undef BuildXF86DRI +#define BuildXF86DRI NO +#endif + #if BuildXF86DRI /* || BuildXF86DRIDriverSupport -- does not currently work */ DRISRC=glint_dri.c DRIOBJ=glint_dri.o DRIINCLUDES=-I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri +DRIDEFINES=$(GLX_DEFINES) #endif SRCS = glint_driver.c pm2_dac.c pm2ramdac.c pm2_accel.c pm_dac.c IBMramdac.c \ @@ -35,11 +42,11 @@ -I$(XF86SRC)/xf4bpp -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(EXTINCSRC) $(DRIINCLUDES) \ -I$(XF86SRC)/shadowfb -I$(XF86SRC)/fbdevhw \ - -I$(XTOP)/include -I$(XF86OSSRC)/vbe \ + -I$(XF86SRC)/vbe \ -I$(SERVERSRC)/render #endif -DEFINES = $(GLX_DEFINES) -DPPC_MMIO_IS_BE -DSPARC_MMIO_IS_BE +DEFINES = $(DRIDEFINES) -DPPC_MMIO_IS_BE -DSPARC_MMIO_IS_BE #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) @@ -68,6 +75,7 @@ InstallDriverSDKNonExecFile(glint_dga.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_regs.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_shadow.c,$(DRIVERSDKDIR)/drivers/glint) +InstallDriverSDKNonExecFile(glint_common.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm2_accel.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm2_dac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm2_video.c,$(DRIVERSDKDIR)/drivers/glint) Index: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.12 xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.12 Sat Aug 18 07:37:30 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 Tue May 7 19:15:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.12 2001/08/18 11:37:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.13 2002/05/07 23:15:58 alanh Exp $ */ STATUS as of Tue, 8 May 2001 19:01:39 +0200 @@ -41,7 +41,6 @@ - 1 -> 25% Video, 75% FB - 2 -> 75% Video, 25% FB - 3 -> Video Only - * DRI : Work is underway. Not Working : @@ -53,19 +52,6 @@ - Render extension initialization. - CPUToScreenTexture. - CPUToScreenAlphaTexture. - * [WORK IS UNDERWAY] DRI/OpenGL (only together with a gamma chip) : - - DRI support should be ok, but accelerated openGL is not yet supported. - - The accelerated OpenGL library supposes we are using a gamma together - with a MX rasterizer, not a Permedia3 one. - -Known problems : - - * [FIXED] R-B inversion. Sometimes, all of a sudden, it seems as the - RGB order gets changed. going to console and back solves this. - Well, this is partly fixed, but still appears under very heavy load. - => [NOTE] If this still happens, try disabling the Hardware cursor, with - the "SWCursor" option to your device XF86Config section. - => [NOTE2] Or, try starting the Xserver with the -nosilk option. Sven Luther <luther@dpt-info.u-strasbg.fr> Alan Hourihane <alanh@fairlite.demon.co.uk> Index: xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c:1.4 Wed Jan 31 11:14:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c Wed Oct 30 07:52:15 2002 @@ -22,12 +22,12 @@ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> * * Modified from IBMramdac.c to support TI RAMDAC routines - * by Jens Owen, <jens@precisioninsight.com>. + * by Jens Owen, <jens@tungstengraphics.com>. * * glintOutTIIndReg() and glintInTIIndReg() are used to access * the indirect TI RAMDAC registers only. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c,v 1.4 2001/01/31 16:14:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c,v 1.5 2002/10/30 12:52:15 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.54 xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.58 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.54 Sat Dec 8 11:01:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h Mon Feb 17 11:08:28 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.54 2001/12/08 16:01:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.58 2003/02/17 16:08:28 dawes Exp $ */ /* * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * @@ -71,6 +71,7 @@ typedef struct { pciVideoPtr PciInfo; pciVideoPtr MultiPciInfo[GLINT_MAX_MULTI_DEVICES]; + int MultiIndex; int numMultiDevices; int MultiChip; Bool MultiAperture; @@ -140,7 +141,6 @@ CARD32 BltScanDirection; CARD32 TexMapFormat; CARD32 PixelWidth; - CARD32 FIFOSize; RamDacRecPtr RamDacRec; xf86CursorInfoPtr CursorInfoRec; XAAInfoRecPtr AccelInfoRec; @@ -162,6 +162,7 @@ CARD32 PM3_Render2D; CARD32 PM3_AreaStippleMode; CARD32 PM3_VideoControl; + int FIFOSize; int InFifoSpace; #ifdef XvExtension void (*VideoTimerCallback)(ScrnInfoPtr, Time); @@ -170,13 +171,18 @@ #endif #ifdef XF86DRI Bool directRenderingEnabled; + Bool PCIMode; DRIInfoPtr pDRIInfo; int drmSubFD; drmBufMapPtr drmBufs; /* Map of DMA buffers */ + drmRegion agp; + drmRegion buffers; int numVisualConfigs; __GLXvisualConfig* pVisualConfigs; GLINTConfigPrivPtr pVisualConfigsPriv; GLINTRegRec DRContextRegs; + int DRIctx; + unsigned char *buf2D; #endif OptionInfoPtr Options; Bool PM3_UsingSGRAM; @@ -302,8 +308,6 @@ void Permedia2ReadAddress(ScrnInfoPtr pScrn, CARD32 index); void Permedia2WriteData(ScrnInfoPtr pScrn, unsigned char data); unsigned char Permedia2ReadData(ScrnInfoPtr pScrn); -void TIramdacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, - LOCO *colors, VisualPtr pVisual); void Permedia2LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); void Permedia2LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.5 xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.5 Mon Dec 17 15:52:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man Fri Feb 14 07:03:09 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.5 2001/12/17 20:52:32 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.6 2003/02/14 12:03:09 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH GLINT __drivermansuffix__ __vendorversion__ @@ -22,8 +22,8 @@ The .B glint driver supports 3Dlabs (GLINT MX, GLINT 500TX, GLINT 300SX, GLINT GAMMA, -GLINT DELTA, GLINT GAMMA2, Permedia, Permedia 2, Permedia 2v, Permedia 3, R4) -and Texas Instruments (Permedia, Permedia 2) chips. +GLINT DELTA, GLINT GAMMA2, Permedia, Permedia 2, Permedia 2v, Permedia 3, R3, +R4) and Texas Instruments (Permedia, Permedia 2) chips. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/glint/glint_common.h:1.1 --- /dev/null Thu Feb 27 12:30:45 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_common.h Wed Oct 30 07:52:15 2002 @@ -0,0 +1,63 @@ +/* glint_common.h -- common header definitions for Gamma 2D/3D/DRM suite + * + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Converted to common header format: + * Jens Owen <jens@tungstengraphics.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_common.h,v 1.1 2002/10/30 12:52:15 alanh Exp $ + * + */ + +#ifndef _GLINT_COMMON_H_ +#define _GLINT_COMMON_H_ + +/* + * WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (gamma_drm.h) + */ + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_GAMMA_INIT 0x00 +#define DRM_GAMMA_COPY 0x01 + +typedef struct { + enum { + GAMMA_INIT_DMA = 0x01, + GAMMA_CLEANUP_DMA = 0x02 + } func; + int sarea_priv_offset; + int pcimode; + unsigned int mmio0; + unsigned int mmio1; + unsigned int mmio2; + unsigned int mmio3; + unsigned int buffers_offset; +} drmGAMMAInit; + +extern int drmGAMMAInitDMA( int fd, drmGAMMAInit *info ); +extern int drmGAMMACleanupDMA( int fd ); + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c:1.27 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c:1.27 Wed May 2 11:06:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c Mon Feb 10 08:20:10 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.27 2001/05/02 15:06:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.32 2003/02/10 13:20:10 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -28,8 +28,9 @@ **************************************************************************/ /* - * Author: - * Jens Owen <jens@precisioninsight.com> + * Authors: + * Jens Owen <jens@tungstengraphics.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * */ @@ -56,6 +57,14 @@ static void GLINTDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore); + +static unsigned int mylog2( unsigned int n ) +{ + unsigned int log2 = 1; + while ( n > 1 ) n >>= 1, log2++; + return log2; +} + static int GLINTDRIControlInit(int drmSubFD, int irq) { @@ -68,267 +77,362 @@ static Bool GLINTInitVisualConfigs(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - GLINTPtr pGlint = GLINTPTR(pScrn); - int numConfigs = 0; - __GLXvisualConfig *pConfigs = NULL; - GLINTConfigPrivPtr pGlintConfigs = NULL; - GLINTConfigPrivPtr *pGlintConfigPtrs = NULL; - int i; - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - if (pGlint->DoubleBuffer) { - } - else { - } - break; - case 24: - break; - case 32: - /* if(pGlint->Overlay): differentiate overlays when we support - either alpha buffer or 3D rendering in Overlay */ - numConfigs = 5; - - if (!(pConfigs = (__GLXvisualConfig *)xcalloc( - sizeof(__GLXvisualConfig), - numConfigs))) { - return FALSE; - } + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + int numConfigs = 0; + __GLXvisualConfig *pConfigs = NULL; + GLINTConfigPrivPtr pGlintConfigs = NULL; + GLINTConfigPrivPtr *pGlintConfigPtrs = NULL; + int db, depth, stencil, accum; + int i; + + switch ( pScrn->depth ) { + case 15: + numConfigs = 8; + + pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { + return FALSE; + } + + pGlintConfigs = (GLINTConfigPrivPtr)xnfcalloc( sizeof(GLINTConfigPrivRec), + numConfigs ); + if ( !pGlintConfigs ) { + xfree( pConfigs ); + return FALSE; + } + + pGlintConfigPtrs = (GLINTConfigPrivPtr*)xnfcalloc( sizeof(GLINTConfigPrivPtr), + numConfigs ); + if ( !pGlintConfigPtrs ) { + xfree( pConfigs ); + xfree( pGlintConfigs ); + return FALSE; + } + + for ( i = 0 ; i < numConfigs ; i++ ) { + pGlintConfigPtrs[i] = &pGlintConfigs[i]; + } + + i = 0; + depth = 1; + for ( accum = 0 ; accum <= 1 ; accum++ ) { + for ( stencil = 0 ; stencil <= 1 ; stencil++ ) { + for ( db = 1 ; db >= 0 ; db-- ) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 5; + pConfigs[i].blueSize = 5; + pConfigs[i].alphaSize = 1; + pConfigs[i].redMask = 0x00007C00; + pConfigs[i].greenMask = 0x000003E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0x00008000; + if ( accum ) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if ( db ) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; + } + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 20; + if ( depth ) { + pConfigs[i].depthSize = 16; + } else { + pConfigs[i].depthSize = 0; + } + if ( stencil ) { + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].stencilSize = 0; + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if ( accum || stencil ) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + } + if ( i != numConfigs ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n" ); + return FALSE; + } + break; + + case 24: + numConfigs = 8; + + pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { + return FALSE; + } + + pGlintConfigs = (GLINTConfigPrivPtr)xnfcalloc( sizeof(GLINTConfigPrivRec), + numConfigs ); + if ( !pGlintConfigs ) { + xfree( pConfigs ); + return FALSE; + } + + pGlintConfigPtrs = (GLINTConfigPrivPtr*)xnfcalloc( sizeof(GLINTConfigPrivPtr), + numConfigs ); + if ( !pGlintConfigPtrs ) { + xfree( pConfigs ); + xfree( pGlintConfigs ); + return FALSE; + } + + for ( i = 0 ; i < numConfigs ; i++ ) { + pGlintConfigPtrs[i] = &pGlintConfigs[i]; + } + + i = 0; + for ( accum = 0 ; accum <= 1 ; accum++ ) { + for ( depth = 0 ; depth <= 1 ; depth++ ) { /* and stencil */ + for ( db = 1 ; db >= 0 ; db-- ) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 8; + pConfigs[i].greenSize = 8; + pConfigs[i].blueSize = 8; + pConfigs[i].alphaSize = 0; + pConfigs[i].redMask = 0x00FF0000; + pConfigs[i].greenMask = 0x0000FF00; + pConfigs[i].blueMask = 0x000000FF; + pConfigs[i].alphaMask = 0; + if ( accum ) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if ( db ) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; + } + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 24; + if ( depth ) { + pConfigs[i].depthSize = 16; + pConfigs[i].stencilSize = 8; + } + else { + pConfigs[i].depthSize = 0; + pConfigs[i].stencilSize = 0; + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if ( accum ) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + } + if ( i != numConfigs ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n" ); + return FALSE; + } + break; - if (!(pGlintConfigs = (GLINTConfigPrivPtr)xcalloc( - sizeof(GLINTConfigPrivRec), - numConfigs))) { - xfree(pConfigs); - return FALSE; - } + default: /* Can't do depth 8 or 16, just 15 or 24 */ + return FALSE; + break; + } + + pGlint->numVisualConfigs = numConfigs; + pGlint->pVisualConfigs = pConfigs; + pGlint->pVisualConfigsPriv = pGlintConfigs; + GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pGlintConfigPtrs); + + return TRUE; +} + +static Bool GLINTDRIAgpInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + int ret, count; + CARD32 mode; + + /* FIXME: Make these configurable... + */ + pGlint->agp.size = 2 * 1024 * 1024; + pGlint->buffers.offset = 0; + pGlint->buffers.size = GLINT_DRI_BUF_COUNT * GLINT_DRI_BUF_SIZE; + + if ( drmAgpAcquire( pGlint->drmSubFD ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" ); + return FALSE; + } + + /* Read AGP Capabilities */ + mode = drmAgpGetMode(pGlint->drmSubFD) & ~0x03; /* Mask Host capabilities */ + + mode |= 0x01; /* Gamma only supports AGP 1x */ + + /* Now enable AGP only on the specified BusID */ + if ( drmAgpEnable( pGlint->drmSubFD, mode ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" ); + drmAgpRelease( pGlint->drmSubFD ); + return FALSE; + } + + ret = drmAgpAlloc( pGlint->drmSubFD, pGlint->agp.size, 0, NULL, + &pGlint->agp.handle); - if (!(pGlintConfigPtrs = (GLINTConfigPrivPtr *)xcalloc( - sizeof(GLINTConfigPrivPtr), - numConfigs))) { - xfree(pGlintConfigs); - xfree(pConfigs); + if ( ret < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Out of memory (%d)\n", ret ); + drmAgpRelease( pGlint->drmSubFD ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] %d kB allocated with handle 0x%08x\n", + pGlint->agp.size/1024, pGlint->agp.handle ); + + if ( drmAgpBind( pGlint->drmSubFD, pGlint->agp.handle, 0 ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Could not bind memory\n" ); + drmAgpFree( pGlint->drmSubFD, pGlint->agp.handle ); + drmAgpRelease( pGlint->drmSubFD ); + return FALSE; + } + + /* DMA buffers + */ + if ( drmAddMap( pGlint->drmSubFD, pGlint->buffers.offset, + pGlint->buffers.size, DRM_AGP, 0, + &pGlint->buffers.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add DMA buffers mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers handle = 0x%08lx\n", + pGlint->buffers.handle ); + + if ( drmMap( pGlint->drmSubFD, pGlint->buffers.handle, + pGlint->buffers.size, &pGlint->buffers.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map DMA buffers\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers mapped at 0x%08lx\n", pGlint->buffers.map); + + count = drmAddBufs( pGlint->drmSubFD, + GLINT_DRI_BUF_COUNT, GLINT_DRI_BUF_SIZE, + DRM_AGP_BUFFER, pGlint->buffers.offset ); + if ( count <= 0 ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "[drm] failure adding %d %d byte DMA buffers\n", + GLINT_DRI_BUF_COUNT, GLINT_DRI_BUF_SIZE ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Added %d %d byte DMA buffers\n", + count, GLINT_DRI_BUF_SIZE ); + + { + int bufs; + + if ((bufs = drmAddBufs(pGlint->drmSubFD, + 1, + 8192, /* 8K = 8MB physical memory */ + 0, + DRM_RESTRICTED /* flags */)) <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] 0x%x failure adding page table buffer\n",bufs); + DRICloseScreen(pScreen); return FALSE; } - - /* Init the list of Glint config pointers */ - for (i = 0; i < numConfigs; i++) - pGlintConfigPtrs[i] = &pGlintConfigs[i]; - - /* config 0: db=FALSE, depth=0, stencil=0, conformant (a lie) */ - pConfigs[0].vid = -1; - pConfigs[0].class = -1; - pConfigs[0].rgba = TRUE; - pConfigs[0].redSize = 8; - pConfigs[0].greenSize = 8; - pConfigs[0].blueSize = 8; - pConfigs[0].alphaSize = 0; - pConfigs[0].redMask = 0x00ff0000; - pConfigs[0].greenMask = 0x0000ff00; - pConfigs[0].blueMask = 0x000000ff; - pConfigs[0].alphaMask = 0; - pConfigs[0].accumRedSize = 0; - pConfigs[0].accumGreenSize = 0; - pConfigs[0].accumBlueSize = 0; - pConfigs[0].accumAlphaSize = 0; - pConfigs[0].doubleBuffer = FALSE; - pConfigs[0].stereo = FALSE; - pConfigs[0].bufferSize = 32; - pConfigs[0].depthSize = 0; - pConfigs[0].stencilSize = 0; - pConfigs[0].auxBuffers = 0; - pConfigs[0].level = 0; - pConfigs[0].visualRating = 0; - pConfigs[0].transparentPixel = 0; - pConfigs[0].transparentRed = 0; - pConfigs[0].transparentGreen = 0; - pConfigs[0].transparentBlue = 0; - pConfigs[0].transparentAlpha = 0; - pConfigs[0].transparentIndex = 0; - pGlintConfigs[0].index = 0; - - /* config 1: db=FALSE, depth=16, stencil=0, conformant (a lie) */ - pConfigs[1].vid = -1; - pConfigs[1].class = -1; - pConfigs[1].rgba = TRUE; - pConfigs[1].redSize = 8; - pConfigs[1].greenSize = 8; - pConfigs[1].blueSize = 8; - pConfigs[1].alphaSize = 0; - pConfigs[1].redMask = 0x00ff0000; - pConfigs[1].greenMask = 0x0000ff00; - pConfigs[1].blueMask = 0x000000ff; - pConfigs[1].alphaMask = 0; - pConfigs[1].accumRedSize = 0; - pConfigs[1].accumGreenSize = 0; - pConfigs[1].accumBlueSize = 0; - pConfigs[1].accumAlphaSize = 0; - pConfigs[1].doubleBuffer = FALSE; - pConfigs[1].stereo = FALSE; - pConfigs[1].bufferSize = 32; - pConfigs[1].depthSize = 16; - pConfigs[1].stencilSize = 0; - pConfigs[1].auxBuffers = 0; - pConfigs[1].level = 0; - pConfigs[1].visualRating = 0; - pConfigs[1].transparentPixel = 0; - pConfigs[1].transparentRed = 0; - pConfigs[1].transparentGreen = 0; - pConfigs[1].transparentBlue = 0; - pConfigs[1].transparentAlpha = 0; - pConfigs[1].transparentIndex = 0; - pGlintConfigs[1].index = 1; - - /* config 2: db=TRUE, depth=0, stencil=0, conformant (a lie) */ - pConfigs[2].vid = -1; - pConfigs[2].class = -1; - pConfigs[2].rgba = TRUE; - pConfigs[2].redSize = 8; - pConfigs[2].greenSize = 8; - pConfigs[2].blueSize = 8; - pConfigs[2].alphaSize = 0; - pConfigs[2].redMask = 0x00ff0000; - pConfigs[2].greenMask = 0x0000ff00; - pConfigs[2].blueMask = 0x000000ff; - pConfigs[2].alphaMask = 0; - pConfigs[2].accumRedSize = 0; - pConfigs[2].accumGreenSize = 0; - pConfigs[2].accumBlueSize = 0; - pConfigs[2].accumAlphaSize = 0; - pConfigs[2].doubleBuffer = TRUE; - pConfigs[2].stereo = FALSE; - pConfigs[2].bufferSize = 32; - pConfigs[2].depthSize = 0; - pConfigs[2].stencilSize = 0; - pConfigs[2].auxBuffers = 0; - pConfigs[2].level = 0; - pConfigs[2].visualRating = 0; - pConfigs[2].transparentPixel = 0; - pConfigs[2].transparentRed = 0; - pConfigs[2].transparentGreen = 0; - pConfigs[2].transparentBlue = 0; - pConfigs[2].transparentAlpha = 0; - pConfigs[2].transparentIndex = 0; - pGlintConfigs[2].index = 2; - - /* config 3: db=TRUE, depth=16, stencil=0, conformant (a lie) */ - pConfigs[3].vid = -1; - pConfigs[3].class = -1; - pConfigs[3].rgba = TRUE; - pConfigs[3].redSize = 8; - pConfigs[3].greenSize = 8; - pConfigs[3].blueSize = 8; - pConfigs[3].alphaSize = 0; - pConfigs[3].redMask = 0x00ff0000; - pConfigs[3].greenMask = 0x0000ff00; - pConfigs[3].blueMask = 0x000000ff; - pConfigs[3].alphaMask = 0; - pConfigs[3].accumRedSize = 0; - pConfigs[3].accumGreenSize = 0; - pConfigs[3].accumBlueSize = 0; - pConfigs[3].accumAlphaSize = 0; - pConfigs[3].doubleBuffer = TRUE; - pConfigs[3].stereo = FALSE; - pConfigs[3].bufferSize = 32; - pConfigs[3].depthSize = 16; - pConfigs[3].stencilSize = 0; - pConfigs[3].auxBuffers = 0; - pConfigs[3].level = 0; - pConfigs[3].visualRating = 0; - pConfigs[3].transparentPixel = 0; - pConfigs[3].transparentRed = 0; - pConfigs[3].transparentGreen = 0; - pConfigs[3].transparentBlue = 0; - pConfigs[3].transparentAlpha = 0; - pConfigs[3].transparentIndex = 0; - pGlintConfigs[3].index = 3; - - /* config 4: db=TRUE, depth=16, stencil=8, conformant (a lie) */ - pConfigs[4].vid = -1; - pConfigs[4].class = -1; - pConfigs[4].rgba = TRUE; - pConfigs[4].redSize = 8; - pConfigs[4].greenSize = 8; - pConfigs[4].blueSize = 8; - pConfigs[4].alphaSize = 0; - pConfigs[4].redMask = 0x00ff0000; - pConfigs[4].greenMask = 0x0000ff00; - pConfigs[4].blueMask = 0x000000ff; - pConfigs[4].alphaMask = 0; - pConfigs[4].accumRedSize = 0; - pConfigs[4].accumGreenSize = 0; - pConfigs[4].accumBlueSize = 0; - pConfigs[4].accumAlphaSize = 0; - pConfigs[4].doubleBuffer = TRUE; - pConfigs[4].stereo = FALSE; - pConfigs[4].bufferSize = 32; - pConfigs[4].depthSize = 16; - pConfigs[4].stencilSize = 8; - pConfigs[4].auxBuffers = 0; - pConfigs[4].level = 0; - pConfigs[4].visualRating = 0; - pConfigs[4].transparentPixel = 0; - pConfigs[4].transparentRed = 0; - pConfigs[4].transparentGreen = 0; - pConfigs[4].transparentBlue = 0; - pConfigs[4].transparentAlpha = 0; - pConfigs[4].transparentIndex = 0; - pGlintConfigs[4].index = 4; - - break; - } - - pGlint->numVisualConfigs = numConfigs; - pGlint->pVisualConfigs = pConfigs; - pGlint->pVisualConfigsPriv = pGlintConfigs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pGlintConfigPtrs); - - /* - * All of the above visual configs use the same local buffer memory - * organiation, so just set once here at the bottom - */ - GLINT_SLOW_WRITE_REG( - (LBRF_DepthWidth16 | - LBRF_StencilWidth8 | - LBRF_StencilPos16 | - LBRF_FrameCount8 | - LBRF_FrameCountPos24 | - LBRF_GIDWidth4 | - LBRF_GIDPos32 ), LBReadFormat); - GLINT_SLOW_WRITE_REG( - (LBRF_DepthWidth16 | - LBRF_StencilWidth8 | - LBRF_StencilPos16 | - LBRF_FrameCount8 | - LBRF_FrameCountPos24 | - LBRF_GIDWidth4 | - LBRF_GIDPos32 ), LBWriteFormat); - if (pGlint->numMultiDevices == 2) { - ACCESSCHIP2(); - GLINT_SLOW_WRITE_REG( - (LBRF_DepthWidth16 | - LBRF_StencilWidth8 | - LBRF_StencilPos16 | - LBRF_FrameCount8 | - LBRF_FrameCountPos24 | - LBRF_GIDWidth4 | - LBRF_GIDPos32 ), LBReadFormat); - GLINT_SLOW_WRITE_REG( - (LBRF_DepthWidth16 | - LBRF_StencilWidth8 | - LBRF_StencilPos16 | - LBRF_FrameCount8 | - LBRF_FrameCountPos24 | - LBRF_GIDWidth4 | - LBRF_GIDPos32 ), LBWriteFormat); - ACCESSCHIP1(); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] added 1 page table buffer\n"); } + pGlint->PCIMode = FALSE; + return TRUE; } +static Bool GLINTDRIKernelInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + DRIInfoPtr pDRIInfo = pGlint->pDRIInfo; + GLINTDRIPtr pGlintDRI = pDRIInfo->devPrivate; + drmGAMMAInit init; + int ret; + + memset( &init, 0, sizeof(drmGAMMAInit) ); + + init.func = GAMMA_INIT_DMA; + init.sarea_priv_offset = sizeof(XF86DRISAREARec); + + init.mmio0 = pGlintDRI->registers0.handle; + init.mmio1 = pGlintDRI->registers1.handle; + init.mmio2 = pGlintDRI->registers2.handle; + init.mmio3 = pGlintDRI->registers3.handle; + + if (!pGlint->PCIMode) { + init.pcimode = 0; + init.buffers_offset = pGlint->buffers.handle; + } else { + init.pcimode = 1; + } + + ret = drmCommandWrite( pGlint->drmSubFD, DRM_GAMMA_INIT, + &init, sizeof(drmGAMMAInit) ); + + if ( ret < 0 ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to initialize DMA! (%d)\n", ret ); + return FALSE; + } + + return TRUE; +} + Bool GLINTDRIScreenInit(ScreenPtr pScreen) { @@ -419,6 +523,13 @@ return FALSE; } + /* setup visual configurations */ + if (!(GLINTInitVisualConfigs(pScreen))) { + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + pDRIInfo->devPrivate = pGlintDRI; pDRIInfo->devPrivateSize = sizeof(GLINTDRIRec); pDRIInfo->contextSize = sizeof(GLINTDRIContextRec); @@ -434,22 +545,65 @@ pDRIInfo->createDummyCtx = TRUE; pDRIInfo->createDummyCtxPriv = FALSE; + /* So DRICloseScreen does the right thing if we abort */ + pGlint->buffers.map = 0; + pGlint->agp.handle = 0; + if (!DRIScreenInit(pScreen, pDRIInfo, &(pGlint->drmSubFD))) { DRIDestroyInfoRec(pGlint->pDRIInfo); xfree(pGlintDRI); return FALSE; } - /* Check the GLINT DRM version */ + /* Check the DRM versioning */ { - drmVersionPtr version = drmGetVersion(pGlint->drmSubFD); + drmVersionPtr version; + + /* Check the DRM lib version. + drmGetLibVersion was not supported in version 1.0, so check for + symbol first to avoid possible crash or hang. + */ + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + version = drmGetLibVersion(pGlint->drmSubFD); + } + else { + /* drmlib version 1.0.0 didn't have the drmGetLibVersion + entry point. Fake it by allocating a version record + via drmGetVersion and changing it to version 1.0.0 + */ + version = drmGetVersion(pGlint->drmSubFD); + version->version_major = 1; + version->version_minor = 0; + version->version_patchlevel = 0; + } + + if (version) { + if (version->version_major != 1 || + version->version_minor < 1) { + /* incompatible drm library version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] GLINTDRIScreenInit failed because of a version mismatch.\n" + "[dri] libdrm.a module version is %d.%d.%d but version 1.1.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + GLINTDRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } + + /* Check the GLINT DRM version */ + version = drmGetVersion(pGlint->drmSubFD); if (version) { - if (version->version_major != 1 || + if (version->version_major != 2 || version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] GLINTDRIScreenInit failed because of a version mismatch.\n" - "[dri] gamma.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n" + "[dri] gamma.o kernel module version is %d.%d.%d but version 2.0.x is needed.\n" "[dri] Disabling DRI.\n", version->version_major, version->version_minor, @@ -466,138 +620,151 @@ pGlintDRI->numMultiDevices = pGlint->numMultiDevices; /* Tell the client about our screen size setup */ pGlintDRI->pprod = pGlint->pprod; + + pGlintDRI->cpp = pScrn->bitsPerPixel / 8; + pGlintDRI->frontPitch = pScrn->displayWidth; + pGlintDRI->frontOffset = 0; + + pGlintDRI->textureSize = 32 * 1024 * 1024; + pGlintDRI->logTextureGranularity = + mylog2( pGlintDRI->textureSize / GAMMA_NR_TEX_REGIONS ); /* setup device specific direct rendering memory maps */ /* pci region 0: control regs, first 4k page, priveledged writes */ - pGlintDRI->flagsControlRegs0 = DRM_READ_ONLY; - pGlintDRI->sizeControlRegs0 = 0x1000; + pGlintDRI->registers0.size = 0x1000; if (drmAddMap( pGlint->drmSubFD, (drmHandle)pGlint->IOAddress, - pGlintDRI->sizeControlRegs0, - DRM_REGISTERS, - pGlintDRI->flagsControlRegs0, - &pGlintDRI->hControlRegs0) < 0) + pGlintDRI->registers0.size, + DRM_REGISTERS, DRM_READ_ONLY, + &pGlintDRI->registers0.handle) < 0) { DRICloseScreen(pScreen); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Register handle 0 = 0x%08lx\n", - pGlintDRI->hControlRegs0); + pGlintDRI->registers0.handle); /* pci region 0: control regs, following region, client access */ - pGlintDRI->flagsControlRegs1 = 0; - pGlintDRI->sizeControlRegs1 = 0xf000; + pGlintDRI->registers1.size = 0xf000; if (drmAddMap( pGlint->drmSubFD, (drmHandle)(pGlint->IOAddress + 0x1000), - pGlintDRI->sizeControlRegs1, - DRM_REGISTERS, - pGlintDRI->flagsControlRegs1, - &pGlintDRI->hControlRegs1) < 0) + pGlintDRI->registers1.size, + DRM_REGISTERS, 0, + &pGlintDRI->registers1.handle) < 0) { DRICloseScreen(pScreen); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Register handle 1 = 0x%08lx\n", - pGlintDRI->hControlRegs1); + pGlintDRI->registers1.handle); /* pci region 0: control regs, second MX, first 4k page */ - pGlintDRI->flagsControlRegs2 = DRM_READ_ONLY; - pGlintDRI->sizeControlRegs2 = 0x1000; + pGlintDRI->registers2.size = 0x1000; if (drmAddMap( pGlint->drmSubFD, (drmHandle)(pGlint->IOAddress + 0x10000), - pGlintDRI->sizeControlRegs2, - DRM_REGISTERS, - pGlintDRI->flagsControlRegs2, - &pGlintDRI->hControlRegs2) < 0) + pGlintDRI->registers2.size, + DRM_REGISTERS, DRM_READ_ONLY, + &pGlintDRI->registers2.handle) < 0) { DRICloseScreen(pScreen); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Register handle 2 = 0x%08lx\n", - pGlintDRI->hControlRegs2); + pGlintDRI->registers2.handle); /* pci region 0: control regs, second MX, following region */ - pGlintDRI->flagsControlRegs3 = 0; - pGlintDRI->sizeControlRegs3 = 0xf000; + pGlintDRI->registers3.size = 0xf000; if (drmAddMap( pGlint->drmSubFD, (drmHandle)(pGlint->IOAddress + 0x11000), - pGlintDRI->sizeControlRegs3, - DRM_REGISTERS, - pGlintDRI->flagsControlRegs3, - &pGlintDRI->hControlRegs3) < 0) + pGlintDRI->registers3.size, + DRM_REGISTERS, 0, + &pGlintDRI->registers3.handle) < 0) { DRICloseScreen(pScreen); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Register handle 3 = 0x%08lx\n", - pGlintDRI->hControlRegs3); + pGlintDRI->registers3.handle); /* setup DMA buffers */ - if (xf86ConfigDRI.bufs_count) { - int i; - int bufs; + /* TRY AGP */ + if ( !GLINTDRIAgpInit( pScreen ) ) { + /* OUCH, NO AGP, TRY PCI */ + pGlint->PCIMode = TRUE; + if (xf86ConfigDRI.bufs_count) { + int i; + int bufs; - for (i = 0; i < xf86ConfigDRI.bufs_count; i++) { - if ((bufs = drmAddBufs(pGlint->drmSubFD, + for (i = 0; i < xf86ConfigDRI.bufs_count; i++) { + if ((bufs = drmAddBufs(pGlint->drmSubFD, xf86ConfigDRI.bufs[i].count, xf86ConfigDRI.bufs[i].size, 0, 0 /* flags */)) <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] failure adding %d %d byte DMA buffers\n", xf86ConfigDRI.bufs[i].count, xf86ConfigDRI.bufs[i].size); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] added %d %d byte DMA buffers\n", bufs, xf86ConfigDRI.bufs[i].size); - dmabufs += bufs; + dmabufs += bufs; + } } - } - } + } - if (dmabufs <= 0) { - int bufs; + if (dmabufs <= 0) { + int bufs; - if ((bufs = drmAddBufs(pGlint->drmSubFD, + if ((bufs = drmAddBufs(pGlint->drmSubFD, GLINT_DRI_BUF_COUNT, GLINT_DRI_BUF_SIZE, 0, 0 /* flags */)) <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure adding %d %d byte DMA buffers\n", GLINT_DRI_BUF_COUNT, GLINT_DRI_BUF_SIZE); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", bufs, GLINT_DRI_BUF_SIZE); - } + + if ((bufs = drmAddBufs(pGlint->drmSubFD, + 1, + 8192, /* 8K = 8MB physical memory */ + 0, + DRM_RESTRICTED /* flags */)) <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] 0x%x failure adding page table buffer\n",bufs); + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] added 1 page table buffer\n"); + } - /* -->> If you mark the buffer queueing policy, you'd do it here. <<-- */ - - if (!(pGlint->drmBufs = drmMapBufs(pGlint->drmSubFD))) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + if (!(pGlint->drmBufs = drmMapBufs(pGlint->drmSubFD))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure mapping DMA buffers\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] buffers mapped with %p\n", + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] buffers mapped with %p\n", pGlint->drmBufs); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n", + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n", pGlint->drmBufs->count); + } /* PCIMODE */ - xf86EnablePciBusMaster(pGlint->PciInfo, TRUE); - - /* tell the generic kernel driver how to handle Gamma DMA */ if (pGlint->irq <= 0) { pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD, ((pciConfigPtr)pGlint->PciInfo @@ -608,26 +775,6 @@ ->thisCard)->funcnum); } - if ( (pGlint->irq <= 0) || - GLINTDRIControlInit(pGlint->drmSubFD, pGlint->irq) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] cannot initialize dma with IRQ %d\n", - pGlint->irq); - DRICloseScreen(pScreen); - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pGlint->irq); - - /* setup visual configurations */ - if (!(GLINTInitVisualConfigs(pScreen))) { - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" ); - return TRUE; } @@ -637,12 +784,27 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] unmapping %d buffers\n", - pGlint->drmBufs->count); - if (drmUnmapBufs(pGlint->drmBufs)) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] unable to unmap DMA buffers\n"); + if (pGlint->buffers.map) { + drmUnmap( pGlint->buffers.map, pGlint->buffers.size); + pGlint->buffers.map = NULL; + } + + if (pGlint->agp.handle) { + drmAgpUnbind( pGlint->drmSubFD, pGlint->agp.handle ); + drmAgpFree( pGlint->drmSubFD, pGlint->agp.handle ); + pGlint->agp.handle = 0; + drmAgpRelease( pGlint->drmSubFD ); + } + + if (pGlint->drmBufs) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] unmapping %d buffers\n", + pGlint->drmBufs->count); + if (drmUnmapBufs(pGlint->drmBufs)) { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] unable to unmap DMA buffers\n"); + } + } DRICloseScreen(pScreen); @@ -702,6 +864,9 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); + DRIInfoPtr pDRIInfo = pGlint->pDRIInfo; + GLINTDRIPtr pGlintDRI = pDRIInfo->devPrivate; + FBAreaPtr fbarea; /* * Setup one of 4 types of context swap handling methods @@ -746,8 +911,72 @@ */ pGlint->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + + /* Allocate the shared back buffer */ + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->virtualX, + pScrn->virtualY, + 32, NULL, NULL, NULL))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Reserved back buffer from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + + pGlintDRI->backPitch = pScrn->displayWidth; + pGlintDRI->backOffset = (fbarea->box.y1 * pScrn->displayWidth * + pScrn->bitsPerPixel / 8) + + (fbarea->box.x1 * pScrn->bitsPerPixel / 8); + pGlintDRI->backX = fbarea->box.x1; + pGlintDRI->backY = fbarea->box.y1; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to reserve back buffer\n"); + pGlintDRI->backPitch = -1; + pGlintDRI->backOffset = -1; + } + + if (!DRIFinishScreenInit(pScreen)) { + DRICloseScreen(pScreen); + return FALSE; + } + + if (!GLINTDRIKernelInit(pScreen)) { + DRICloseScreen(pScreen); + return FALSE; + } + + if ( (pGlint->irq <= 0) || + GLINTDRIControlInit(pGlint->drmSubFD, pGlint->irq) ) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] cannot initialize dma with IRQ %d\n", + pGlint->irq); + DRICloseScreen(pScreen); + return FALSE; + } - return(DRIFinishScreenInit(pScreen)); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + pGlint->irq); + + if (!pGlint->PCIMode) { + if (!(pGlint->drmBufs = drmMapBufs(pGlint->drmSubFD))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure mapping DMA buffers\n"); + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] buffers mapped with %p\n", + pGlint->drmBufs); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] %d DMA buffers mapped\n", + pGlint->drmBufs->count); + } + +#if 0 + /* Get the X server's context */ + pGlint->DRIctx = DRIGetContext(pScreen); + pGlint->buf2D = pGlint->drmBufs->list[GLINT_DRI_BUF_COUNT + 1].address; +#endif + + return TRUE; } #define ContextDump_tag 0x1b8 Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h:1.5 Wed Jan 31 11:14:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h Wed Oct 30 07:52:16 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.5 2001/01/31 16:14:55 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.7 2002/10/30 12:52:16 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -29,30 +29,95 @@ /* * Author: - * Jens Owen <jens@precisioninsight.com> + * Jens Owen <jens@tungstengraphics.com> * */ +#ifndef _GLINT_DRI_H_ +#define _GLINT_DRI_H_ + +#include "xf86drm.h" +#include "glint_common.h" + +typedef struct { + unsigned int GDeltaMode; + unsigned int GDepthMode; + unsigned int GGeometryMode; + unsigned int GTransformMode; +} GAMMAContextRegionRec, *GAMMAContextRegionPtr; + +typedef struct { + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ +} GAMMATextureRegionRec, *GAMMATextureRegionPtr; + +typedef struct { + GAMMAContextRegionRec context_state; + + unsigned int dirty; + + /* Maintain an LRU of contiguous regions of texture space. If + * you think you own a region of texture memory, and it has an + * age different to the one you set, then you are mistaken and + * it has been stolen by another client. If global texAge + * hasn't changed, there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained + * texture information of other clients - by maintaining them + * in the same lru which is used to age their own textures, + * clients have an approximate lru for the whole of global + * texture space, and can make informed decisions as to which + * areas to kick out. There is no need to choose whether to + * kick out your own texture or someone else's - simply eject + * them all in LRU order. + */ + +#define GAMMA_NR_TEX_REGIONS 64 + GAMMATextureRegionRec texList[GAMMA_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; +} GLINTSAREADRIRec, *GLINTSAREADRIPtr; + /* * Glint specific record passed back to client driver * via DRIGetDeviceInfo request */ typedef struct { - drmHandle hControlRegs0; - drmHandle hControlRegs1; - drmHandle hControlRegs2; - drmHandle hControlRegs3; - drmSize sizeControlRegs0; - drmSize sizeControlRegs1; - drmSize sizeControlRegs2; - drmSize sizeControlRegs3; - drmMapFlags flagsControlRegs0; - drmMapFlags flagsControlRegs1; - drmMapFlags flagsControlRegs2; - drmMapFlags flagsControlRegs3; + drmRegion registers0; + drmRegion registers1; + drmRegion registers2; + drmRegion registers3; int numMultiDevices; int pprod; + int cpp; + int frontOffset; + int frontPitch; + int backOffset; + int backPitch; + int backX; + int backY; + int depthOffset; + int depthPitch; + int textureSize; + int logTextureGranularity; } GLINTDRIRec, *GLINTDRIPtr; + +#define GLINT_DRI_BUF_COUNT 256 +#define GLINT_DRI_BUF_SIZE 4096 + +#define GAMMA_NR_TEX_REGIONS 64 + +#define DMA_WRITE(val,reg) \ +do { \ + pGlint->buf2D++ = Glint##reg##Tag; \ + pGlint->buf2D++ = val; \ +} while (0) -#define GLINT_DRI_BUF_COUNT 20 -#define GLINT_DRI_BUF_SIZE 0x1000 +#endif /* _GLINT_DRI_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h:1.5 Sat Jun 17 06:00:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h Wed Oct 30 07:52:16 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h,v 1.5 2000/06/17 10:00:13 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h,v 1.6 2002/10/30 12:52:16 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -29,7 +29,7 @@ /* * Author: - * Jens Owen <jens@precisioninsight.com> + * Jens Owen <jens@tungstengraphics.com> * */ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.144 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.156 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.144 Fri Jan 4 16:22:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c Mon Feb 17 11:08:28 2003 @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen, * Siemens Nixdorf Informationssysteme and Appian Graphics. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.144 2002/01/04 21:22:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.156 2003/02/17 16:08:28 dawes Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -275,12 +275,14 @@ NULL }; +#ifdef XFree86LOADER static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", "vbeFree", NULL }; +#endif static const char *ramdacSymbols[] = { "IBMramdac526CalculateMNPCForClock", @@ -341,9 +343,11 @@ static const char *drmSymbols[] = { "drmAddBufs", "drmAddMap", + "drmCommandWrite", "drmCtlInstHandler", "drmFreeVersion", "drmGetInterruptFromBusID", + "drmGetLibVersion", "drmGetVersion", "drmMapBufs", "drmUnmapBufs", @@ -1075,8 +1079,7 @@ return FALSE; } - xf86SetOperatingState(resVgaMemShared, pGlint->pEnt->index, ResDisableOpr); - xf86SetOperatingState(resVgaIoShared, pGlint->pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVga, pGlint->pEnt->index, ResDisableOpr); /* Operations for which memory access is required. */ pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; @@ -1384,22 +1387,25 @@ } else { pGlint->IOAddress = pGlint->PciInfo->memBase[0] & 0xFFFFC000; } -#if X_BYTE_ORDER == X_BIG_ENDIAN - pGlint->IOAddress += 0x10000; -#endif if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { - /* Fix up for dual head mode, offset gamma registers at 0x10000 */ + /* We know which head is the primary on the J2000 board, need a more + * generix solution though. + */ if ((xf86IsEntityShared(pScrn->entityList[0])) && (xf86IsPrimInitDone(pScrn->entityList[0]))) { -#if 0 /* When we need gamma & acceleration, this should be used instead */ pGlint->IOAddress += 0x10000; -#endif + pGlint->MultiIndex = 2; } else { xf86SetPrimInitDone(pScrn->entityList[0]); + pGlint->MultiIndex = 1; } -#if 1 /* And then remove this */ - pGlint->IOAddress = pGlint->MultiPciInfo[0]->memBase[0] & 0xFFFFC000; +#if X_BYTE_ORDER == X_BIG_ENDIAN + GLINT_SLOW_WRITE_REG( + GLINT_READ_REG(GCSRAperture) | GCSRBitSwap + , GCSRAperture); + } else { + pGlint->IOAddress += 0x10000; #endif } @@ -1420,6 +1426,21 @@ } } + /* Initialize the card through int10 interface if needed */ + if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA && + pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA2 && + pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_DELTA && + !xf86IsPrimaryPci(pGlint->PciInfo) && !pGlint->FBDev) { + if ( xf86LoadSubModule(pScrn, "int10")){ + xf86Int10InfoPtr pInt; + + xf86LoaderReqSymLists(GLINTint10Symbols, NULL); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); + pInt = xf86InitInt10(pGlint->pEnt->index); + xf86FreeInt10(pInt); + } + } + pGlint->FbMapSize = 0; { @@ -1714,12 +1735,24 @@ pGlint->FIFOSize = 31; maxheight = 1024; maxwidth = 1536; - GLINTProbeIBMramdac(pScrn); - if (pGlint->RamDac == NULL) return FALSE; - if (pGlint->RamDac->RamDacType != (IBM526DB_RAMDAC) && - pGlint->RamDac->RamDacType != (IBM526_RAMDAC)) + /* Test for an TI ramdac */ + if (!pGlint->RamDac) { + GLINTProbeTIramdac(pScrn); + if (pGlint->RamDac) + if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) + pGlint->RefClock = 14318; + } + /* Test for an IBM ramdac */ + if (!pGlint->RamDac) { + GLINTProbeIBMramdac(pScrn); + if (pGlint->RamDac) { + if (pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || + pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) + pGlint->RefClock = 14318; + } + } + if (!pGlint->RamDac) return FALSE; - pGlint->RefClock = 14318; break; case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: @@ -1762,12 +1795,24 @@ case PCI_CHIP_TI_PERMEDIA: maxheight = 1024; maxwidth = 1536; - GLINTProbeIBMramdac(pScrn); - if (pGlint->RamDac == NULL) return FALSE; - if (pGlint->RamDac->RamDacType != (IBM526DB_RAMDAC) && - pGlint->RamDac->RamDacType != (IBM526_RAMDAC)) + /* Test for an TI ramdac */ + if (!pGlint->RamDac) { + GLINTProbeTIramdac(pScrn); + if (pGlint->RamDac) + if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) + pGlint->RefClock = 14318; + } + /* Test for an IBM ramdac */ + if (!pGlint->RamDac) { + GLINTProbeIBMramdac(pScrn); + if (pGlint->RamDac) { + if (pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || + pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) + pGlint->RefClock = 14318; + } + } + if (!pGlint->RamDac) return FALSE; - pGlint->RefClock = 14318; break; case PCI_CHIP_500TX: case PCI_CHIP_300SX: @@ -1826,11 +1871,6 @@ RamDacDestroyInfoRec(pGlint->RamDacRec); return FALSE; } -#if 1 /* REMOVE LATER - see other IS_J2000 fixup code */ - /* As we push the acceleration through the pm3 (for now) we can - * safely set the FIFOSize to 120 again */ - pGlint->FIFOSize = 120; -#endif break; } if (IS_GMX2000) { @@ -1892,25 +1932,19 @@ break; } + if ( pGlint->RamDac && + (pGlint->RamDac->RamDacType != (IBM640_RAMDAC)) && + (pScrn->depth == 30) ) + { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Depth 30 not supported for this chip\n"); + return FALSE; + } + if (pGlint->FIFOSize) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "FIFO Size is %d DWORDS\n", pGlint->FIFOSize); - /* Initialize the card through int10 interface if needed */ - if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA && - pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA2 && - pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_DELTA && - !xf86IsPrimaryPci(pGlint->PciInfo) && !pGlint->FBDev) { - if ( xf86LoadSubModule(pScrn, "int10")){ - xf86Int10InfoPtr pInt; - - xf86LoaderReqSymLists(GLINTint10Symbols, NULL); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); - pInt = xf86InitInt10(pGlint->pEnt->index); - xf86FreeInt10(pInt); - } - } - /* Set the min pixel clock */ pGlint->MinClock = 16250; /* XXX Guess, need to check this */ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %d MHz\n", @@ -3607,12 +3641,15 @@ ScreenPtr pScreen = screenInfo.screens[i]; ScrnInfoPtr pScrn = xf86Screens[i]; GLINTPtr pGlint = GLINTPTR(pScrn); + int sigstate = xf86BlockSIGIO(); if(pGlint->CursorColorCallback) (*pGlint->CursorColorCallback)(pScrn); if(pGlint->LoadCursorCallback) (*pGlint->LoadCursorCallback)(pScrn); + + xf86UnblockSIGIO(sigstate); pScreen->BlockHandler = pGlint->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.31 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.36 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.31 Sat Dec 8 11:01:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h Sat Jan 11 22:55:47 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.31 2001/12/08 16:01:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.36 2003/01/12 03:55:47 tsi Exp $ */ /* * glint register file @@ -32,7 +32,6 @@ #define PCI_CHIP_3DLABS_PERMEDIA4 0x0C #define PCI_CHIP_3DLABS_R4 0x0D #define PCI_CHIP_3DLABS_GAMMA2 0x0E -#define PCI_CHIP_TI_PERMEDIA 0x3d04 /* The boards we know */ #define IS_GLORIAXXL ((pGlint->PciInfo->subsysVendor == 0x1048) && \ @@ -192,47 +191,47 @@ #define PMRomControl 0x1040 #define PMBootAddress 0x1080 #define PMMemConfig 0x10C0 - #define RowCharge8 1 << 10 - #define TimeRCD8 1 << 7 - #define TimeRC8 0x6 << 3 - #define TimeRP8 1 - #define CAS3Latency8 0 << 16 - #define BootAdress8 0x10 - #define NumberBanks8 0x3 << 29 - #define RefreshCount8 0x41 << 21 - #define TimeRASMin8 1 << 13 - #define DeadCycle8 1 << 17 - #define BankDelay8 0 << 18 - #define Burst1Cycle8 1 << 31 - #define SDRAM8 0 << 4 - - #define RowCharge6 1 << 10 - #define TimeRCD6 1 << 7 - #define TimeRC6 0x6 << 3 - #define TimeRP6 0x2 - #define CAS3Latency6 1 << 16 - #define BootAdress6 0x60 - #define NumberBanks6 0x2 << 29 - #define RefreshCount6 0x41 << 21 - #define TimeRASMin6 1 << 13 - #define DeadCycle6 1 << 17 - #define BankDelay6 0 << 18 - #define Burst1Cycle6 1 << 31 - #define SDRAM6 0 << 4 - - #define RowCharge4 0 << 10 - #define TimeRCD4 0 << 7 - #define TimeRC4 0x4 << 3 - #define TimeRP4 1 - #define CAS3Latency4 0 << 16 - #define BootAdress4 0x10 - #define NumberBanks4 1 << 29 - #define RefreshCount4 0x30 << 21 - #define TimeRASMin4 1 << 13 - #define DeadCycle4 0 << 17 - #define BankDelay4 0 << 18 - #define Burst1Cycle4 1 << 31 - #define SDRAM4 0 << 4 +# define RowCharge8 1 << 10 +# define TimeRCD8 1 << 7 +# define TimeRC8 0x6 << 3 +# define TimeRP8 1 +# define CAS3Latency8 0 << 16 +# define BootAdress8 0x10 +# define NumberBanks8 0x3 << 29 +# define RefreshCount8 0x41 << 21 +# define TimeRASMin8 1 << 13 +# define DeadCycle8 1 << 17 +# define BankDelay8 0 << 18 +# define Burst1Cycle8 1 << 31 +# define SDRAM8 0 << 4 + +# define RowCharge6 1 << 10 +# define TimeRCD6 1 << 7 +# define TimeRC6 0x6 << 3 +# define TimeRP6 0x2 +# define CAS3Latency6 1 << 16 +# define BootAdress6 0x60 +# define NumberBanks6 0x2 << 29 +# define RefreshCount6 0x41 << 21 +# define TimeRASMin6 1 << 13 +# define DeadCycle6 1 << 17 +# define BankDelay6 0 << 18 +# define Burst1Cycle6 1 << 31 +# define SDRAM6 0 << 4 + +# define RowCharge4 0 << 10 +# define TimeRCD4 0 << 7 +# define TimeRC4 0x4 << 3 +# define TimeRP4 1 +# define CAS3Latency4 0 << 16 +# define BootAdress4 0x10 +# define NumberBanks4 1 << 29 +# define RefreshCount4 0x30 << 21 +# define TimeRASMin4 1 << 13 +# define DeadCycle4 0 << 17 +# define BankDelay4 0 << 18 +# define Burst1Cycle4 1 << 31 +# define SDRAM4 0 << 4 /* Permedia 2 Control */ #define MemControl 0x1040 @@ -510,6 +509,7 @@ #define GCSRAperture 0x0878 #define GCSRSecondaryGLINTMapEn 1 << 0 +#define GCSRBitSwap 1 << 1 #define GPageTableAddr 0x0c00 #define GPageTableLength 0x0c08 @@ -547,26 +547,26 @@ #define dY GLINT_TAG_ADDR(0x00,0x05) #define GLINTCount GLINT_TAG_ADDR(0x00,0x06) #define Render GLINT_TAG_ADDR(0x00,0x07) - #define AreaStippleEnable 0x00001 - #define LineStippleEnable 0x00002 - #define ResetLineStipple 0x00004 - #define FastFillEnable 0x00008 - #define PrimitiveLine 0 - #define PrimitiveTrapezoid 0x00040 - #define PrimitivePoint 0x00080 - #define PrimitiveRectangle 0x000C0 - #define AntialiasEnable 0x00100 - #define AntialiasingQuality 0x00200 - #define UsePointTable 0x00400 - #define SyncOnBitMask 0x00800 - #define SyncOnHostData 0x01000 - #define TextureEnable 0x02000 - #define FogEnable 0x04000 - #define CoverageEnable 0x08000 - #define SubPixelCorrectionEnable 0x10000 - #define SpanOperation 0x40000 - #define XPositive 1<<21 - #define YPositive 1<<22 +# define AreaStippleEnable 0x00001 +# define LineStippleEnable 0x00002 +# define ResetLineStipple 0x00004 +# define FastFillEnable 0x00008 +# define PrimitiveLine 0 +# define PrimitiveTrapezoid 0x00040 +# define PrimitivePoint 0x00080 +# define PrimitiveRectangle 0x000C0 +# define AntialiasEnable 0x00100 +# define AntialiasingQuality 0x00200 +# define UsePointTable 0x00400 +# define SyncOnBitMask 0x00800 +# define SyncOnHostData 0x01000 +# define TextureEnable 0x02000 +# define FogEnable 0x04000 +# define CoverageEnable 0x08000 +# define SubPixelCorrectionEnable 0x10000 +# define SpanOperation 0x40000 +# define XPositive 1<<21 +# define YPositive 1<<22 #define ContinueNewLine GLINT_TAG_ADDR(0x00,0x08) @@ -597,9 +597,9 @@ #define PackedDataLimits GLINT_TAG_ADDR(0x02,0x0a) /* PM only */ #define ScissorMode GLINT_TAG_ADDR(0x03,0x00) - #define SCI_USER 0x01 - #define SCI_SCREEN 0x02 - #define SCI_USERANDSCREEN 0x03 +# define SCI_USER 0x01 +# define SCI_SCREEN 0x02 +# define SCI_USERANDSCREEN 0x03 #define ScissorMinXY GLINT_TAG_ADDR(0x03,0x01) #define ScissorMaxXY GLINT_TAG_ADDR(0x03,0x02) @@ -613,17 +613,17 @@ /* XAddress_1bit */ /* UNIT_DISABLE */ - #define ASM_XAddress_2bit 1 << 1 - #define ASM_XAddress_3bit 2 << 1 - #define ASM_XAddress_4bit 3 << 1 - #define ASM_XAddress_5bit 4 << 1 - #define ASM_YAddress_2bit 1 << 4 - #define ASM_YAddress_3bit 2 << 4 - #define ASM_YAddress_4bit 3 << 4 - #define ASM_YAddress_5bit 4 << 4 - #define ASM_InvertPattern 1 << 17 - #define ASM_MirrorX 1 << 18 - #define ASM_MirrorY 1 << 19 +# define ASM_XAddress_2bit 1 << 1 +# define ASM_XAddress_3bit 2 << 1 +# define ASM_XAddress_4bit 3 << 1 +# define ASM_XAddress_5bit 4 << 1 +# define ASM_YAddress_2bit 1 << 4 +# define ASM_YAddress_3bit 2 << 4 +# define ASM_YAddress_4bit 3 << 4 +# define ASM_YAddress_5bit 4 << 4 +# define ASM_InvertPattern 1 << 17 +# define ASM_MirrorX 1 << 18 +# define ASM_MirrorY 1 << 19 #define LineStippleMode GLINT_TAG_ADDR(0x03,0x05) #define LoadLineStippleCounters GLINT_TAG_ADDR(0x03,0x06) @@ -657,12 +657,12 @@ #define TextureReadMode GLINT_TAG_ADDR(0x09,0x00) #define TextureFormat GLINT_TAG_ADDR(0x09,0x01) - #define Texture_4_Components 3 << 3 - #define Texture_Texel 0 +# define Texture_4_Components 3 << 3 +# define Texture_Texel 0 #define TextureCacheControl GLINT_TAG_ADDR(0x09,0x02) - #define TextureCacheControlEnable 2 - #define TextureCacheControlInvalidate 1 +# define TextureCacheControlEnable 2 +# define TextureCacheControlInvalidate 1 #define GLINTBorderColor GLINT_TAG_ADDR(0x09,0x05) @@ -709,10 +709,10 @@ #define TexelLUTMode GLINT_TAG_ADDR(0x0c,0x0f) #define TextureColorMode GLINT_TAG_ADDR(0x0d,0x00) - #define TextureTypeOpenGL 0 - #define TextureTypeApple 1 << 4 - #define TextureKsDDA 1 << 5 /* only Apple-Mode */ - #define TextureKdDDA 1 << 6 /* only Apple-Mode */ +# define TextureTypeOpenGL 0 +# define TextureTypeApple 1 << 4 +# define TextureKsDDA 1 << 5 /* only Apple-Mode */ +# define TextureKdDDA 1 << 6 /* only Apple-Mode */ #define TextureEnvColor GLINT_TAG_ADDR(0x0d,0x01) #define FogMode GLINT_TAG_ADDR(0x0d,0x02) @@ -720,7 +720,7 @@ /* FOG RGBA */ /* UNIT_DISABLE */ - #define FOG_CI 0x0002 +# define FOG_CI 0x0002 #define FogColor GLINT_TAG_ADDR(0x0d,0x03) #define FStart GLINT_TAG_ADDR(0x0d,0x04) @@ -747,9 +747,9 @@ #define dAdyDom GLINT_TAG_ADDR(0x0f,0x0b) #define ColorDDAMode GLINT_TAG_ADDR(0x0f,0x0c) /* 0: */ - #define CDDA_FlatShading 0 +# define CDDA_FlatShading 0 /* UNIT_DISABLE */ - #define CDDA_GouraudShading 0x0002 +# define CDDA_GouraudShading 0x0002 #define ConstantColor GLINT_TAG_ADDR(0x0f,0x0d) @@ -767,36 +767,36 @@ /* DstFBData */ /* UNIT_DISABLE */ - #define ABM_SrcONE 1 << 1 - #define ABM_SrcDST_COLOR 2 << 1 - #define ABM_SrcONE_MINUS_DST_COLOR 3 << 1 - #define ABM_SrcSRC_ALPHA 4 << 1 - #define ABM_SrcONE_MINUS_SRC_ALPHA 5 << 1 - #define ABM_SrcDST_ALPHA 6 << 1 - #define ABM_SrcONE_MINUS_DST_ALPHA 7 << 1 - #define ABM_SrcSRC_ALPHA_SATURATE 8 << 1 - #define ABM_DstONE 1 << 5 - #define ABM_DstSRC_COLOR 2 << 5 - #define ABM_DstONE_MINUS_SRC_COLOR 3 << 5 - #define ABM_DstSRC_ALPHA 4 << 5 - #define ABM_DstONE_MINUS_SRC_ALPHA 5 << 5 - #define ABM_DstDST_ALPHA 6 << 5 - #define ABM_DstONE_MINUS_DST_ALPHA 7 << 5 - #define ABM_ColorFormat5555 1 << 8 - #define ABM_ColorFormat4444 2 << 8 - #define ABM_ColorFormat4444_Front 3 << 8 - #define ABM_ColorFormat4444_Back 4 << 8 - #define ABM_ColorFormat332_Front 5 << 8 - #define ABM_ColorFormat332_Back 6 << 8 - #define ABM_ColorFormat121_Front 7 << 8 - #define ABM_ColorFormat121_Back 8 << 8 - #define ABM_ColorFormat555_Back 13 << 8 - #define ABM_ColorFormat_CI8 14 << 8 - #define ABM_ColorFormat_CI4 15 << 8 - #define ABM_NoAlphaBuffer 0x1000 - #define ABM_ColorOrderRGB 0x2000 - #define ABM_TypeQuickDraw3D 0x4000 - #define ABM_DstFBSourceData 0x8000 +# define ABM_SrcONE 1 << 1 +# define ABM_SrcDST_COLOR 2 << 1 +# define ABM_SrcONE_MINUS_DST_COLOR 3 << 1 +# define ABM_SrcSRC_ALPHA 4 << 1 +# define ABM_SrcONE_MINUS_SRC_ALPHA 5 << 1 +# define ABM_SrcDST_ALPHA 6 << 1 +# define ABM_SrcONE_MINUS_DST_ALPHA 7 << 1 +# define ABM_SrcSRC_ALPHA_SATURATE 8 << 1 +# define ABM_DstONE 1 << 5 +# define ABM_DstSRC_COLOR 2 << 5 +# define ABM_DstONE_MINUS_SRC_COLOR 3 << 5 +# define ABM_DstSRC_ALPHA 4 << 5 +# define ABM_DstONE_MINUS_SRC_ALPHA 5 << 5 +# define ABM_DstDST_ALPHA 6 << 5 +# define ABM_DstONE_MINUS_DST_ALPHA 7 << 5 +# define ABM_ColorFormat5555 1 << 8 +# define ABM_ColorFormat4444 2 << 8 +# define ABM_ColorFormat4444_Front 3 << 8 +# define ABM_ColorFormat4444_Back 4 << 8 +# define ABM_ColorFormat332_Front 5 << 8 +# define ABM_ColorFormat332_Back 6 << 8 +# define ABM_ColorFormat121_Front 7 << 8 +# define ABM_ColorFormat121_Back 8 << 8 +# define ABM_ColorFormat555_Back 13 << 8 +# define ABM_ColorFormat_CI8 14 << 8 +# define ABM_ColorFormat_CI4 15 << 8 +# define ABM_NoAlphaBuffer 0x1000 +# define ABM_ColorOrderRGB 0x2000 +# define ABM_TypeQuickDraw3D 0x4000 +# define ABM_DstFBSourceData 0x8000 #define DitherMode GLINT_TAG_ADDR(0x10,0x03) /* 0: */ @@ -807,31 +807,31 @@ /* DitherDisable */ /* UNIT_DISABLE */ - #define DTM_DitherEnable 1 << 1 - #define DTM_ColorFormat5555 1 << 2 - #define DTM_ColorFormat4444 2 << 2 - #define DTM_ColorFormat4444_Front 3 << 2 - #define DTM_ColorFormat4444_Back 4 << 2 - #define DTM_ColorFormat332_Front 5 << 2 - #define DTM_ColorFormat332_Back 6 << 2 - #define DTM_ColorFormat121_Front 7 << 2 - #define DTM_ColorFormat121_Back 8 << 2 - #define DTM_ColorFormat555_Back 13 << 2 - #define DTM_ColorFormat_CI8 14 << 2 - #define DTM_ColorFormat_CI4 15 << 2 - #define DTM_ColorOrderRGB 1 << 10 - #define DTM_NoAlphaDither 1 << 14 - #define DTM_RoundMode 1 << 15 +# define DTM_DitherEnable 1 << 1 +# define DTM_ColorFormat5555 1 << 2 +# define DTM_ColorFormat4444 2 << 2 +# define DTM_ColorFormat4444_Front 3 << 2 +# define DTM_ColorFormat4444_Back 4 << 2 +# define DTM_ColorFormat332_Front 5 << 2 +# define DTM_ColorFormat332_Back 6 << 2 +# define DTM_ColorFormat121_Front 7 << 2 +# define DTM_ColorFormat121_Back 8 << 2 +# define DTM_ColorFormat555_Back 13 << 2 +# define DTM_ColorFormat_CI8 14 << 2 +# define DTM_ColorFormat_CI4 15 << 2 +# define DTM_ColorOrderRGB 1 << 10 +# define DTM_NoAlphaDither 1 << 14 +# define DTM_RoundMode 1 << 15 #define FBSoftwareWriteMask GLINT_TAG_ADDR(0x10,0x04) #define LogicalOpMode GLINT_TAG_ADDR(0x10,0x05) - #define Use_ConstantFBWriteData 0x40 +# define Use_ConstantFBWriteData 0x40 #define FBWriteData GLINT_TAG_ADDR(0x10,0x06) #define RouterMode GLINT_TAG_ADDR(0x10,0x08) - #define ROUTER_Depth_Texture 1 - #define ROUTER_Texture_Depth 0 +# define ROUTER_Depth_Texture 1 +# define ROUTER_Texture_Depth 0 #define LBReadMode GLINT_TAG_ADDR(0x11,0x00) @@ -843,60 +843,60 @@ /* NoPatch */ /* ScanlineInterval1 */ - #define LBRM_SrcEnable 1 << 9 - #define LBRM_DstEnable 1 << 10 - #define LBRM_DataLBStencil 1 << 16 - #define LBRM_DataLBDepth 2 << 16 - #define LBRM_WinBottomLeft 1 << 18 - #define LBRM_DoPatch 1 << 19 - - #define LBRM_ScanlineInt2 1 << 20 - #define LBRM_ScanlineInt4 2 << 20 - #define LBRM_ScanlineInt8 3 << 20 +# define LBRM_SrcEnable 1 << 9 +# define LBRM_DstEnable 1 << 10 +# define LBRM_DataLBStencil 1 << 16 +# define LBRM_DataLBDepth 2 << 16 +# define LBRM_WinBottomLeft 1 << 18 +# define LBRM_DoPatch 1 << 19 + +# define LBRM_ScanlineInt2 1 << 20 +# define LBRM_ScanlineInt4 2 << 20 +# define LBRM_ScanlineInt8 3 << 20 #define LBReadFormat GLINT_TAG_ADDR(0x11,0x01) - #define LBRF_DepthWidth15 0x03 /* only permedia */ - #define LBRF_DepthWidth16 0x00 - #define LBRF_DepthWidth24 0x01 - #define LBRF_DepthWidth32 0x02 - - #define LBRF_StencilWidth0 (0 << 2) - #define LBRF_StencilWidth4 (1 << 2) - #define LBRF_StencilWidth8 (2 << 2) - - #define LBRF_StencilPos16 (0 << 4) - #define LBRF_StencilPos20 (1 << 4) - #define LBRF_StencilPos24 (2 << 4) - #define LBRF_StencilPos28 (3 << 4) - #define LBRF_StencilPos32 (4 << 4) - - #define LBRF_FrameCount0 (0 << 7) - #define LBRF_FrameCount4 (1 << 7) - #define LBRF_FrameCount8 (2 << 7) - - #define LBRF_FrameCountPos16 (0 << 9) - #define LBRF_FrameCountPos20 (1 << 9) - #define LBRF_FrameCountPos24 (2 << 9) - #define LBRF_FrameCountPos28 (3 << 9) - #define LBRF_FrameCountPos32 (4 << 9) - #define LBRF_FrameCountPos36 (5 << 9) - #define LBRF_FrameCountPos40 (6 << 9) - - #define LBRF_GIDWidth0 (0 << 12) - #define LBRF_GIDWidth4 (1 << 12) - - #define LBRF_GIDPos16 (0 << 13) - #define LBRF_GIDPos20 (1 << 13) - #define LBRF_GIDPos24 (2 << 13) - #define LBRF_GIDPos28 (3 << 13) - #define LBRF_GIDPos32 (4 << 13) - #define LBRF_GIDPos36 (5 << 13) - #define LBRF_GIDPos40 (6 << 13) - #define LBRF_GIDPos44 (7 << 13) - #define LBRF_GIDPos48 (8 << 13) +# define LBRF_DepthWidth15 0x03 /* only permedia */ +# define LBRF_DepthWidth16 0x00 +# define LBRF_DepthWidth24 0x01 +# define LBRF_DepthWidth32 0x02 + +# define LBRF_StencilWidth0 (0 << 2) +# define LBRF_StencilWidth4 (1 << 2) +# define LBRF_StencilWidth8 (2 << 2) + +# define LBRF_StencilPos16 (0 << 4) +# define LBRF_StencilPos20 (1 << 4) +# define LBRF_StencilPos24 (2 << 4) +# define LBRF_StencilPos28 (3 << 4) +# define LBRF_StencilPos32 (4 << 4) + +# define LBRF_FrameCount0 (0 << 7) +# define LBRF_FrameCount4 (1 << 7) +# define LBRF_FrameCount8 (2 << 7) + +# define LBRF_FrameCountPos16 (0 << 9) +# define LBRF_FrameCountPos20 (1 << 9) +# define LBRF_FrameCountPos24 (2 << 9) +# define LBRF_FrameCountPos28 (3 << 9) +# define LBRF_FrameCountPos32 (4 << 9) +# define LBRF_FrameCountPos36 (5 << 9) +# define LBRF_FrameCountPos40 (6 << 9) + +# define LBRF_GIDWidth0 (0 << 12) +# define LBRF_GIDWidth4 (1 << 12) + +# define LBRF_GIDPos16 (0 << 13) +# define LBRF_GIDPos20 (1 << 13) +# define LBRF_GIDPos24 (2 << 13) +# define LBRF_GIDPos28 (3 << 13) +# define LBRF_GIDPos32 (4 << 13) +# define LBRF_GIDPos36 (5 << 13) +# define LBRF_GIDPos40 (6 << 13) +# define LBRF_GIDPos44 (7 << 13) +# define LBRF_GIDPos48 (8 << 13) - #define LBRF_Compact32 (1 << 17) +# define LBRF_Compact32 (1 << 17) @@ -905,9 +905,9 @@ #define LBDepth GLINT_TAG_ADDR(0x11,0x06) #define LBWindowBase GLINT_TAG_ADDR(0x11,0x07) #define LBWriteMode GLINT_TAG_ADDR(0x11,0x08) - #define LBWM_WriteEnable 0x1 - #define LBWM_UpLoad_LBDepth 0x2 - #define LBWM_UpLoad_LBStencil 0x4 +# define LBWM_WriteEnable 0x1 +# define LBWM_UpLoad_LBDepth 0x2 +# define LBWM_UpLoad_LBStencil 0x4 #define LBWriteFormat GLINT_TAG_ADDR(0x11,0x09) @@ -917,16 +917,16 @@ #define LBWindowOffset GLINT_TAG_ADDR(0x11,0x0f) #define GLINTWindow GLINT_TAG_ADDR(0x13,0x00) - #define GWIN_UnitEnable (1 << 0) - #define GWIN_ForceLBUpdate (1 << 3) - #define GWIN_LBUpdateSourceREG (1 << 4) - #define GWIN_LBUpdateSourceLB (0 << 4) - #define GWIN_StencilFCP (1 << 17) - #define GWIN_DepthFCP (1 << 18) - #define GWIN_OverrideWriteFilter (1 << 19) +# define GWIN_UnitEnable (1 << 0) +# define GWIN_ForceLBUpdate (1 << 3) +# define GWIN_LBUpdateSourceREG (1 << 4) +# define GWIN_LBUpdateSourceLB (0 << 4) +# define GWIN_StencilFCP (1 << 17) +# define GWIN_DepthFCP (1 << 18) +# define GWIN_OverrideWriteFilter (1 << 19) /* ??? is this needed, set by permedia (2) modules */ - #define GWIN_DisableLBUpdate 0x40000 +# define GWIN_DisableLBUpdate 0x40000 #define StencilMode GLINT_TAG_ADDR(0x13,0x01) #define StencilData GLINT_TAG_ADDR(0x13,0x02) @@ -938,17 +938,17 @@ /* CompFuncNEVER */ /* UNIT_DISABLE */ - #define DPM_WriteEnable 1 << 1 - #define DPM_SrcCompLBData 1 << 2 - #define DPM_SrcCompDregister 2 << 2 - #define DPM_SrcCompLBSourceData 3 << 2 - #define DPM_CompFuncLESS 1 << 4 - #define DPM_CompFuncEQUAL 2 << 4 - #define DPM_CompFuncLESS_OR_EQ 3 << 4 - #define DPM_CompFuncGREATER 4 << 4 - #define DPM_CompFuncNOT_EQ 5 << 4 - #define DPM_CompFuncGREATER_OR_EQ 6 << 4 - #define DPM_CompFuncALWAYS 7 << 4 +# define DPM_WriteEnable 1 << 1 +# define DPM_SrcCompLBData 1 << 2 +# define DPM_SrcCompDregister 2 << 2 +# define DPM_SrcCompLBSourceData 3 << 2 +# define DPM_CompFuncLESS 1 << 4 +# define DPM_CompFuncEQUAL 2 << 4 +# define DPM_CompFuncLESS_OR_EQ 3 << 4 +# define DPM_CompFuncGREATER 4 << 4 +# define DPM_CompFuncNOT_EQ 5 << 4 +# define DPM_CompFuncGREATER_OR_EQ 6 << 4 +# define DPM_CompFuncALWAYS 7 << 4 #define GLINTDepth GLINT_TAG_ADDR(0x13,0x05) #define ZStartU GLINT_TAG_ADDR(0x13,0x06) @@ -967,14 +967,14 @@ /* WinTopLeft */ /* ScanlineInterval1 */ - #define FBRM_SrcEnable 1 << 9 - #define FBRM_DstEnable 1 << 10 - #define FBRM_DataFBColor 1 << 15 - #define FBRM_WinBottomLeft 1 << 16 - #define FBRM_Packed 1 << 19 - #define FBRM_ScanlineInt2 1 << 23 - #define FBRM_ScanlineInt4 2 << 23 - #define FBRM_ScanlineInt8 3 << 23 +# define FBRM_SrcEnable 1 << 9 +# define FBRM_DstEnable 1 << 10 +# define FBRM_DataFBColor 1 << 15 +# define FBRM_WinBottomLeft 1 << 16 +# define FBRM_Packed 1 << 19 +# define FBRM_ScanlineInt2 1 << 23 +# define FBRM_ScanlineInt4 2 << 23 +# define FBRM_ScanlineInt8 3 << 23 #define FBSourceOffset GLINT_TAG_ADDR(0x15,0x01) @@ -988,10 +988,10 @@ /* 0: */ /* FBWM_NoColorUpload */ /* FBWM_WriteDisable */ - #define FBWM_WriteEnable 1 - #define FBWM_UploadColor 1 << 3 +# define FBWM_WriteEnable 1 +# define FBWM_UploadColor 1 << 3 /* Permedia3 extensions */ - #define FBWM_Enable0 1 << 12 +# define FBWM_Enable0 1 << 12 #define FBHardwareWriteMask GLINT_TAG_ADDR(0x15,0x08) #define FBBlockColor GLINT_TAG_ADDR(0x15,0x09) @@ -1020,16 +1020,16 @@ /* CullStatisticTag */ /* CullStatisticData */ - #define FM_PassDepthTags 0x0010 - #define FM_PassDepthData 0x0020 - #define FM_PassStencilTags 0x0040 - #define FM_PassStencilData 0x0080 - #define FM_PassColorTag 0x0100 - #define FM_PassColorData 0x0200 - #define FM_PassSyncTag 0x0400 - #define FM_PassSyncData 0x0800 - #define FM_PassStatisticTag 0x1000 - #define FM_PassStatisticData 0x2000 +# define FM_PassDepthTags 0x0010 +# define FM_PassDepthData 0x0020 +# define FM_PassStencilTags 0x0040 +# define FM_PassStencilData 0x0080 +# define FM_PassColorTag 0x0100 +# define FM_PassColorData 0x0200 +# define FM_PassSyncTag 0x0400 +# define FM_PassSyncData 0x0800 +# define FM_PassStatisticTag 0x1000 +# define FM_PassStatisticData 0x2000 #define Sync_tag 0x0188 @@ -1141,43 +1141,43 @@ /* GLINT_300SX */ /* DeltaMode Register Bit Field Assignments */ - #define DM_GLINT_300SX 0x0000 - #define DM_GLINT_500TX 0x0001 - #define DM_PERMEDIA 0x0002 - #define DM_Depth_16BPP (1 << 2) - #define DM_Depth_24BPP (2 << 2) - #define DM_Depth_32BPP (3 << 2) - #define DM_FogEnable 0x0010 - #define DM_TextureEnable 0x0020 - #define DM_SmoothShadingEnable 0x0040 - #define DM_DepthEnable 0x0080 - #define DM_SpecularTextureEnable 0x0100 - #define DM_DiffuseTextureEnable 0x0200 - #define DM_SubPixelCorrectionEnable 0x0400 - #define DM_DiamondExit 0x0800 - #define DM_NoDraw 0x1000 - #define DM_ClampEnable 0x2000 - #define DM_ClampedTexParMode 0x4000 - #define DM_NormalizedTexParMode 0xC000 - - - #define DDCMD_AreaStrippleEnable 0x0001 - #define DDCMD_LineStrippleEnable 0x0002 - #define DDCMD_ResetLineStripple 1 << 2 - #define DDCMD_FastFillEnable 1 << 3 +# define DM_GLINT_300SX 0x0000 +# define DM_GLINT_500TX 0x0001 +# define DM_PERMEDIA 0x0002 +# define DM_Depth_16BPP (1 << 2) +# define DM_Depth_24BPP (2 << 2) +# define DM_Depth_32BPP (3 << 2) +# define DM_FogEnable 0x0010 +# define DM_TextureEnable 0x0020 +# define DM_SmoothShadingEnable 0x0040 +# define DM_DepthEnable 0x0080 +# define DM_SpecularTextureEnable 0x0100 +# define DM_DiffuseTextureEnable 0x0200 +# define DM_SubPixelCorrectionEnable 0x0400 +# define DM_DiamondExit 0x0800 +# define DM_NoDraw 0x1000 +# define DM_ClampEnable 0x2000 +# define DM_ClampedTexParMode 0x4000 +# define DM_NormalizedTexParMode 0xC000 + + +# define DDCMD_AreaStrippleEnable 0x0001 +# define DDCMD_LineStrippleEnable 0x0002 +# define DDCMD_ResetLineStripple 1 << 2 +# define DDCMD_FastFillEnable 1 << 3 /* 2 Bits reserved */ - #define DDCMD_PrimitiveType_Point 2 << 6 - #define DDCMD_PrimitiveType_Line 0 << 6 - #define DDCMD_PrimitiveType_Trapezoid 1 << 6 - #define DDCMD_AntialiasEnable 1 << 8 - #define DDCMD_AntialiasingQuality 1 << 9 - #define DDCMD_UsePointTable 1 << 10 - #define DDCMD_SyncOnBitMask 1 << 11 - #define DDCMD_SyncOnHostDate 1 << 12 - #define DDCMD_TextureEnable 1 << 13 - #define DDCMD_FogEnable 1 << 14 - #define DDCMD_CoverageEnable 1 << 15 - #define DDCMD_SubPixelCorrectionEnable 1 << 16 +# define DDCMD_PrimitiveType_Point 2 << 6 +# define DDCMD_PrimitiveType_Line 0 << 6 +# define DDCMD_PrimitiveType_Trapezoid 1 << 6 +# define DDCMD_AntialiasEnable 1 << 8 +# define DDCMD_AntialiasingQuality 1 << 9 +# define DDCMD_UsePointTable 1 << 10 +# define DDCMD_SyncOnBitMask 1 << 11 +# define DDCMD_SyncOnHostDate 1 << 12 +# define DDCMD_TextureEnable 1 << 13 +# define DDCMD_FogEnable 1 << 14 +# define DDCMD_CoverageEnable 1 << 15 +# define DDCMD_SubPixelCorrectionEnable 1 << 16 @@ -1258,7 +1258,7 @@ #define GLINT_SLOW_WRITE_REG(v,r) \ do{ \ mem_barrier(); \ - GLINT_WAIT(pGlint->FIFOSize); \ + GLINT_WAIT(pGlint->FIFOSize); \ mem_barrier(); \ GLINT_WRITE_REG(v,r); \ }while(0) Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.22 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.22 Sat Aug 18 07:41:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c Mon Dec 2 17:52:30 2002 @@ -21,14 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c,v 1.22 2001/08/18 11:41:44 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c,v 1.23 2002/12/02 22:52:30 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "xf86Pci.h" #include "xf86PciInfo.h" -#include "xf86Xinput.h" #include "xf86fbman.h" #include "xf86i2c.h" #include "xf86xv.h" Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.27 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.27 Wed Nov 28 16:53:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c Tue May 7 19:15:59 2002 @@ -27,7 +27,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.27 2001/11/28 21:53:01 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.29 2002/05/07 23:15:59 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -442,7 +442,7 @@ { GLINTPtr pGlint = GLINTPTR(pScrn); int i; - + for (i=0; i<1024; i++) Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPattern+i, 0x00, pGlint->HardwareCursorPattern[i]); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.29 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.31 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.29 Mon Nov 19 19:09:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c Sun Jan 5 19:04:54 2003 @@ -26,7 +26,7 @@ * * Permedia 3 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.29 2001/11/20 00:09:13 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.31 2003/01/06 00:04:54 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -139,7 +139,11 @@ /* Initialize the Accelerator Engine to defaults */ TRACE_ENTER("Permedia3InitializeEngine"); + if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + GLINT_SLOW_WRITE_REG(pGlint->MultiIndex, BroadcastMask); + } if (pGlint->MultiAperture) { + ErrorF("pm3_accel: SVEN : multiAperture set\n"); /* Only write the following register to the first PM3 */ GLINT_SLOW_WRITE_REG(1, BroadcastMask); GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); @@ -502,7 +506,6 @@ GLINTPtr pGlint = GLINTPTR(pScrn); BoxRec AvailFBArea; - if (xf86FBManagerRunning(pScreen)) return; /* Available Framebuffer Area for XAA. */ AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; @@ -1041,6 +1044,10 @@ static void Permedia3RestoreAccelState(ScrnInfoPtr pScrn) { + GLINTPtr pGlint = GLINTPTR(pScrn); + if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + GLINT_SLOW_WRITE_REG(pGlint->MultiIndex, BroadcastMask); + } Permedia3Sync(pScrn); } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.30 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.30 Mon Dec 10 16:11:00 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c Fri Jul 19 11:33:45 2002 @@ -26,7 +26,7 @@ * this work is sponsored by Appian Graphics. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.30 2001/12/10 21:11:00 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.33 2002/07/19 15:33:45 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -128,35 +128,116 @@ static unsigned long PM3DAC_CalculateClock ( - unsigned long reqclock, /* In kHz units */ - unsigned long refclock, /* In kHz units */ + unsigned long ReqClock, /* In kHz units */ + unsigned long RefClock, /* In kHz units */ unsigned char *prescale, /* ClkPreScale */ - unsigned char *feedback, /* ClkFeedBackScale */ + unsigned char *feedback, /* ClkFeedBackScale */ unsigned char *postscale /* ClkPostScale */ ) { - int f, pre, post; - unsigned long freq; - long freqerr = 1000; - unsigned long actualclock = 0; - - for (f=1;f<256;f++) { - for (pre=1;pre<256;pre++) { - for (post=0;post<5;post++) { - freq = ((2* refclock * f) / (pre * (1 << post))); - if ((reqclock > freq - freqerr)&&(reqclock < freq + freqerr)){ - freqerr = (reqclock > freq) ? - reqclock - freq : freq - reqclock; - *feedback = f; - *prescale = pre; - *postscale = post; - actualclock = freq; + unsigned long fMinVCO = 2000000; /* min fVCO is 200MHz (in 100Hz units) */ + unsigned long fMaxVCO = 6220000; /* max fVCO is 622MHz (in 100Hz units) */ + unsigned long fMinINTREF = 10000;/* min fINTREF is 1MHz (in 100Hz units) */ + unsigned long fMaxINTREF = 20000;/* max fINTREF is 2MHz (in 100Hz units) */ + unsigned long M, N, P; /* M=feedback, N=prescale, P=postscale */ + unsigned long fINTREF; + unsigned long fVCO; + unsigned long ActualClock; + long Error; + unsigned long LowestError = 1000000; + unsigned int bFoundFreq = FALSE; + int cInnerLoopIterations = 0; + int LoopCount; + unsigned long ClosestClock = 0; + + ReqClock*=10; /* convert into 100Hz units */ + RefClock*=10; /* convert into 100Hz units */ + + for(P = 0; P <= 5; ++P) + { + unsigned long fVCOLowest, fVCOHighest; + + /* it is pointless going through the main loop if all values of + N produce an fVCO outside the acceptable range */ + N = 1; + M = (N * (1UL << P) * ReqClock) / (2 * RefClock); + fVCOLowest = (2 * RefClock * M) / N; + N = 255; + M = (N * (1UL << P) * ReqClock) / (2 * RefClock); + fVCOHighest = (2 * RefClock * M) / N; + + if(fVCOHighest < fMinVCO || fVCOLowest > fMaxVCO) + { + continue; + } + + for(N = 1; N <= 255; ++N, ++cInnerLoopIterations) + { + fINTREF = RefClock / N; + if(fINTREF < fMinINTREF || fINTREF > fMaxINTREF) + { + if(fINTREF > fMaxINTREF) + { + /* hopefully we will get into range as the prescale + value increases */ + continue; } + else + { + /* already below minimum and it will only get worse: + move to the next postscale value */ + break; + } } + + M = (N * (1UL << P) * ReqClock) / (2 * RefClock); + if(M > 255) + { + /* M, N & P registers are only 8 bits wide */ + break; + } + + /* we can expect rounding errors in calculating M, which + will always be rounded down. So we will checkout our + calculated value of M along with (M+1) */ + for(LoopCount = (M == 255) ? 1 : 2; --LoopCount >= 0; ++M) + { + fVCO = (2 * RefClock * M) / N; + if(fVCO >= fMinVCO && fVCO <= fMaxVCO) + { + ActualClock = fVCO / (1UL << P); + Error = ActualClock - ReqClock; + if(Error < 0) + Error = -Error; + if(Error < LowestError) + { + bFoundFreq = TRUE; + LowestError = Error; + ClosestClock = ActualClock; + *prescale = N; + *feedback = M; + *postscale = P; + if(Error == 0) + goto Done; + } + } + } } } + +Done: + + if(bFoundFreq) + ActualClock = ClosestClock; + else + ActualClock = 0; + +#if 0 + ErrorF("PM3DAC_CalculateClock: Got prescale=%d, feedback=%d, postscale=%d, WantedClock = %d00 ActualClock = %d00 (Error %d00)\n", + *prescale, *feedback, *postscale, ReqClock, ActualClock, LowestError); +#endif - return(actualclock); + return(ActualClock); } static unsigned long @@ -439,7 +520,7 @@ STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_32BIT); STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT); #else - STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT | + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_32BIT | PM3ByApertureMode_BYTESWAP_DCBA); STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT | PM3ByApertureMode_BYTESWAP_DCBA); @@ -692,7 +773,9 @@ LOCO *colors, VisualPtr pVisual ){ +#if 0 GLINTPtr pGlint = GLINTPTR(pScrn); +#endif int i, index, shift = 0, j, repeat = 1; if (pScrn->depth == 15) { @@ -708,11 +791,13 @@ Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index].blue); } +#if 0 GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); +#endif } } @@ -724,7 +809,9 @@ LOCO *colors, VisualPtr pVisual ){ +#if 0 GLINTPtr pGlint = GLINTPTR(pScrn); +#endif int i, index, j; for(i = 0; i < numColors; i++) { @@ -735,11 +822,13 @@ Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index >> 1].blue); } +#if 0 GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); +#endif if(index <= 31) { for (j = 0; j < 4; j++) { Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.9 Mon Nov 19 19:09:15 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h Sat Jan 11 22:55:47 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.9 2001/11/20 00:09:15 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.10 2003/01/12 03:55:47 tsi Exp $ */ /* * glint register file @@ -53,33 +53,33 @@ * GLINT Permedia3 Region 0 Bypass Controls * ***********************************************/ #define PM3ByAperture1Mode 0x0300 - #define PM3ByApertureMode_BYTESWAP_ABCD (0<<0) - #define PM3ByApertureMode_BYTESWAP_BADC (1<<0) - #define PM3ByApertureMode_BYTESWAP_CDAB (2<<0) - #define PM3ByApertureMode_BYTESWAP_DCBA (3<<0) - #define PM3ByApertureMode_PATCH_DISABLE (0<<2) - #define PM3ByApertureMode_PATCH_ENABLE (1<<2) - #define PM3ByApertureMode_FORMAT_RAW (0<<3) - #define PM3ByApertureMode_FORMAT_YUYV (1<<3) - #define PM3ByApertureMode_FORMAT_UYVY (2<<3) - #define PM3ByApertureMode_PIXELSIZE_8BIT (0<<5) - #define PM3ByApertureMode_PIXELSIZE_16BIT (1<<5) - #define PM3ByApertureMode_PIXELSIZE_32BIT (2<<5) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_1024 (0<<7) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_2048 (1<<7) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_4096 (2<<7) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_8192 (3<<7) - #define PM3ByApertureMode_PATCH_OFFSET_X(off) (((off)&7f)<<9) - #define PM3ByApertureMode_PATCH_OFFSET_Y(off) (((off)&7f)<<16) - #define PM3ByApertureMode_FRAMEBUFFER (0<<21) - #define PM3ByApertureMode_LOCALBUFFER (1<<21) - #define PM3ByApertureMode_DOUBLE_WRITE_OFF (0<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_1MB (1<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_2MB (2<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_4MB (3<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_8MB (4<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_16MB (5<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_32MB (6<<22) +# define PM3ByApertureMode_BYTESWAP_ABCD (0<<0) +# define PM3ByApertureMode_BYTESWAP_BADC (1<<0) +# define PM3ByApertureMode_BYTESWAP_CDAB (2<<0) +# define PM3ByApertureMode_BYTESWAP_DCBA (3<<0) +# define PM3ByApertureMode_PATCH_DISABLE (0<<2) +# define PM3ByApertureMode_PATCH_ENABLE (1<<2) +# define PM3ByApertureMode_FORMAT_RAW (0<<3) +# define PM3ByApertureMode_FORMAT_YUYV (1<<3) +# define PM3ByApertureMode_FORMAT_UYVY (2<<3) +# define PM3ByApertureMode_PIXELSIZE_8BIT (0<<5) +# define PM3ByApertureMode_PIXELSIZE_16BIT (1<<5) +# define PM3ByApertureMode_PIXELSIZE_32BIT (2<<5) +# define PM3ByApertureMode_EFFECTIVE_STRIDE_1024 (0<<7) +# define PM3ByApertureMode_EFFECTIVE_STRIDE_2048 (1<<7) +# define PM3ByApertureMode_EFFECTIVE_STRIDE_4096 (2<<7) +# define PM3ByApertureMode_EFFECTIVE_STRIDE_8192 (3<<7) +# define PM3ByApertureMode_PATCH_OFFSET_X(off) (((off)&7f)<<9) +# define PM3ByApertureMode_PATCH_OFFSET_Y(off) (((off)&7f)<<16) +# define PM3ByApertureMode_FRAMEBUFFER (0<<21) +# define PM3ByApertureMode_LOCALBUFFER (1<<21) +# define PM3ByApertureMode_DOUBLE_WRITE_OFF (0<<22) +# define PM3ByApertureMode_DOUBLE_WRITE_1MB (1<<22) +# define PM3ByApertureMode_DOUBLE_WRITE_2MB (2<<22) +# define PM3ByApertureMode_DOUBLE_WRITE_4MB (3<<22) +# define PM3ByApertureMode_DOUBLE_WRITE_8MB (4<<22) +# define PM3ByApertureMode_DOUBLE_WRITE_16MB (5<<22) +# define PM3ByApertureMode_DOUBLE_WRITE_32MB (6<<22) #define PM3ByAperture2Mode 0x0328 @@ -90,7 +90,7 @@ #define PM3MemBypassWriteMask 0x1008 #define PM3MemScratch 0x1010 #define PM3LocalMemCaps 0x1018 - #define PM3LocalMemCaps_NoWriteMask (1<<28) +# define PM3LocalMemCaps_NoWriteMask (1<<28) #define PM3LocalMemTimings 0x1020 #define PM3LocalMemControl 0x1028 #define PM3LocalMemRefresh 0x1030 @@ -113,43 +113,43 @@ #define PM3VsStart 0x3048 #define PM3VsEnd 0x3050 #define PM3VideoControl 0x3058 - #define PM3VideoControl_DISABLE (0<<0) - #define PM3VideoControl_ENABLE (1<<0) - #define PM3VideoControl_BLANK_ACTIVE_HIGH (0<<1) - #define PM3VideoControl_BLANK_ACTIVE_LOW (1<<1) - #define PM3VideoControl_LINE_DOUBLE_OFF (0<<2) - #define PM3VideoControl_LINE_DOUBLE_ON (1<<2) - #define PM3VideoControl_HSYNC_FORCE_HIGH (0<<3) - #define PM3VideoControl_HSYNC_ACTIVE_HIGH (1<<3) - #define PM3VideoControl_HSYNC_FORCE_LOW (2<<3) - #define PM3VideoControl_HSYNC_ACTIVE_LOW (3<<3) - #define PM3VideoControl_VSYNC_FORCE_HIGH (0<<5) - #define PM3VideoControl_VSYNC_ACTIVE_HIGH (1<<5) - #define PM3VideoControl_VSYNC_FORCE_LOW (2<<5) - #define PM3VideoControl_VSYNC_ACTIVE_LOW (3<<5) - #define PM3VideoControl_BYTE_DOUBLE_OFF (0<<7) - #define PM3VideoControl_BYTE_DOUBLE_ON (1<<7) - #define PM3VideoControl_BUFFER_SWAP_SYNCON_FRAMEBLANK (0<<9) - #define PM3VideoControl_BUFFER_SWAP_FREE_RUNNING (1<<9) - #define PM3VideoControl_BUFFER_SWAP_LIMITETO_FRAMERATE (2<<9) - #define PM3VideoControl_STEREO_DISABLE (0<<11) - #define PM3VideoControl_STEREO_ENABLE (1<<11) - #define PM3VideoControl_RIGHT_EYE_ACTIVE_HIGH (0<<12) - #define PM3VideoControl_RIGHT_EYE_ACTIVE_LOW (1<<12) - #define PM3VideoControl_VIDEO_EXT_LOW (0<<14) - #define PM3VideoControl_VIDEO_EXT_HIGH (1<<14) - #define PM3VideoControl_SYNC_MODE_INDEPENDENT (0<<16) - #define PM3VideoControl_SYNC_MODE_SYNCTO_VSA (1<<16) - #define PM3VideoControl_SYNC_MODE_SYNCTO_VSB (2<<16) - #define PM3VideoControl_PATCH_DISABLE (0<<18) - #define PM3VideoControl_PATCH_ENABLE (1<<18) - #define PM3VideoControl_PIXELSIZE_8BIT (0<<19) - #define PM3VideoControl_PIXELSIZE_16BIT (1<<19) - #define PM3VideoControl_PIXELSIZE_32BIT (2<<19) - #define PM3VideoControl_DISPLAY_DISABLE (0<<21) - #define PM3VideoControl_DISPLAY_ENABLE (1<<21) - #define PM3VideoControl_PATCH_OFFSET_X(off) (((off)&0x3f)<<22) - #define PM3VideoControl_PATCH_OFFSET_Y(off) (((off)&0x3f)<<28) +# define PM3VideoControl_DISABLE (0<<0) +# define PM3VideoControl_ENABLE (1<<0) +# define PM3VideoControl_BLANK_ACTIVE_HIGH (0<<1) +# define PM3VideoControl_BLANK_ACTIVE_LOW (1<<1) +# define PM3VideoControl_LINE_DOUBLE_OFF (0<<2) +# define PM3VideoControl_LINE_DOUBLE_ON (1<<2) +# define PM3VideoControl_HSYNC_FORCE_HIGH (0<<3) +# define PM3VideoControl_HSYNC_ACTIVE_HIGH (1<<3) +# define PM3VideoControl_HSYNC_FORCE_LOW (2<<3) +# define PM3VideoControl_HSYNC_ACTIVE_LOW (3<<3) +# define PM3VideoControl_VSYNC_FORCE_HIGH (0<<5) +# define PM3VideoControl_VSYNC_ACTIVE_HIGH (1<<5) +# define PM3VideoControl_VSYNC_FORCE_LOW (2<<5) +# define PM3VideoControl_VSYNC_ACTIVE_LOW (3<<5) +# define PM3VideoControl_BYTE_DOUBLE_OFF (0<<7) +# define PM3VideoControl_BYTE_DOUBLE_ON (1<<7) +# define PM3VideoControl_BUFFER_SWAP_SYNCON_FRAMEBLANK (0<<9) +# define PM3VideoControl_BUFFER_SWAP_FREE_RUNNING (1<<9) +# define PM3VideoControl_BUFFER_SWAP_LIMITETO_FRAMERATE (2<<9) +# define PM3VideoControl_STEREO_DISABLE (0<<11) +# define PM3VideoControl_STEREO_ENABLE (1<<11) +# define PM3VideoControl_RIGHT_EYE_ACTIVE_HIGH (0<<12) +# define PM3VideoControl_RIGHT_EYE_ACTIVE_LOW (1<<12) +# define PM3VideoControl_VIDEO_EXT_LOW (0<<14) +# define PM3VideoControl_VIDEO_EXT_HIGH (1<<14) +# define PM3VideoControl_SYNC_MODE_INDEPENDENT (0<<16) +# define PM3VideoControl_SYNC_MODE_SYNCTO_VSA (1<<16) +# define PM3VideoControl_SYNC_MODE_SYNCTO_VSB (2<<16) +# define PM3VideoControl_PATCH_DISABLE (0<<18) +# define PM3VideoControl_PATCH_ENABLE (1<<18) +# define PM3VideoControl_PIXELSIZE_8BIT (0<<19) +# define PM3VideoControl_PIXELSIZE_16BIT (1<<19) +# define PM3VideoControl_PIXELSIZE_32BIT (2<<19) +# define PM3VideoControl_DISPLAY_DISABLE (0<<21) +# define PM3VideoControl_DISPLAY_ENABLE (1<<21) +# define PM3VideoControl_PATCH_OFFSET_X(off) (((off)&0x3f)<<22) +# define PM3VideoControl_PATCH_OFFSET_Y(off) (((off)&0x3f)<<28) #define PM3InterruptLine 0x3060 #define PM3DisplayData 0x3068 #define PM3VerticalLineCount 0x3070 @@ -158,54 +158,54 @@ #define PM3MiscControl 0x3088 #define PM3VideoOverlayUpdate 0x3100 - #define PM3VideoOverlayUpdate_DISABLE (0<<0) - #define PM3VideoOverlayUpdate_ENABLE (1<<0) +# define PM3VideoOverlayUpdate_DISABLE (0<<0) +# define PM3VideoOverlayUpdate_ENABLE (1<<0) #define PM3VideoOverlayMode 0x3108 - #define PM3VideoOverlayMode_DISABLE (0<<0) - #define PM3VideoOverlayMode_ENABLE (1<<0) - #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1) - #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1) - #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1) - #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4) - #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4) - #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5) - #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5) - #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5) - #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5)) - #define PM3VideoOverlayMode_COLORORDER_BGR (0<<12) - #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) - #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) - #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) - #define PM3VideoOverlayMode_FILTER_MASK (3<<14) - #define PM3VideoOverlayMode_FILTER_OFF (0<<14) - #define PM3VideoOverlayMode_FILTER_FULL (1<<14) - #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) - #define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16) - #define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16) - #define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18) - #define PM3VideoOverlayMode_PATCHMODE_ON (1<<18) - #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) - #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) - #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) - #define PM3VideoOverlayMode_MIRROR_MASK (3<<23) - #define PM3VideoOverlayMode_MIRRORX_OFF (0<<23) - #define PM3VideoOverlayMode_MIRRORX_ON (1<<23) - #define PM3VideoOverlayMode_MIRRORY_OFF (0<<24) - #define PM3VideoOverlayMode_MIRRORY_ON (1<<24) +# define PM3VideoOverlayMode_DISABLE (0<<0) +# define PM3VideoOverlayMode_ENABLE (1<<0) +# define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1) +# define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1) +# define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1) +# define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4) +# define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4) +# define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5) +# define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5) +# define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5) +# define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5)) +# define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5)) +# define PM3VideoOverlayMode_COLORORDER_BGR (0<<12) +# define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) +# define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) +# define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) +# define PM3VideoOverlayMode_FILTER_MASK (3<<14) +# define PM3VideoOverlayMode_FILTER_OFF (0<<14) +# define PM3VideoOverlayMode_FILTER_FULL (1<<14) +# define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) +# define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16) +# define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16) +# define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18) +# define PM3VideoOverlayMode_PATCHMODE_ON (1<<18) +# define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) +# define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) +# define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) +# define PM3VideoOverlayMode_MIRROR_MASK (3<<23) +# define PM3VideoOverlayMode_MIRRORX_OFF (0<<23) +# define PM3VideoOverlayMode_MIRRORX_ON (1<<23) +# define PM3VideoOverlayMode_MIRRORY_OFF (0<<24) +# define PM3VideoOverlayMode_MIRRORY_ON (1<<24) #define PM3VideoOverlayFifoControl 0x3110 #define PM3VideoOverlayIndex 0x3118 #define PM3VideoOverlayBase 0x3120 @@ -213,25 +213,25 @@ #define PM3VideoOverlayBase1 0x3128 #define PM3VideoOverlayBase2 0x3130 #define PM3VideoOverlayStride 0x3138 - #define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0) +# define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0) #define PM3VideoOverlayWidth 0x3140 - #define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0) +# define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0) #define PM3VideoOverlayHeight 0x3148 - #define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0) +# define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0) #define PM3VideoOverlayOrigin 0x3150 - #define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0) - #define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16) +# define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0) +# define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16) #define PM3VideoOverlayShrinkXDelta 0x3158 - #define PM3VideoOverlayShrinkXDelta_NONE (1<<16) - #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ +# define PM3VideoOverlayShrinkXDelta_NONE (1<<16) +# define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayZoomXDelta 0x3160 - #define PM3VideoOverlayZoomXDelta_NONE (1<<16) - #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ +# define PM3VideoOverlayZoomXDelta_NONE (1<<16) +# define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ ((((s)<<16)/(d))&0x0001fff0) #define PM3VideoOverlayYDelta 0x3168 - #define PM3VideoOverlayYDelta_NONE (1<<16) - #define PM3VideoOverlayYDelta_DELTA(s,d) \ +# define PM3VideoOverlayYDelta_NONE (1<<16) +# define PM3VideoOverlayYDelta_DELTA(s,d) \ ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayFieldOffset 0x3170 #define PM3VideoOverlayStatus 0x3178 @@ -249,102 +249,102 @@ #define PM3RD_IndexHigh 0x4028 #define PM3RD_IndexedData 0x4030 #define PM3RD_IndexControl 0x4038 - #define PM3RD_IndexControl_AUTOINCREMENT_ENABLE (1<<0) - #define PM3RD_IndexControl_AUTOINCREMENT_DISABLE (0<<0) +# define PM3RD_IndexControl_AUTOINCREMENT_ENABLE (1<<0) +# define PM3RD_IndexControl_AUTOINCREMENT_DISABLE (0<<0) /* Indirect Registers */ #define PM3RD_MiscControl 0x000 - #define PM3RD_MiscControl_HIGHCOLOR_RES_DISABLE (0<<0) - #define PM3RD_MiscControl_HIGHCOLOR_RES_ENABLE (1<<0) - #define PM3RD_MiscControl_PIXELDOUBLE_DISABLE (0<<1) - #define PM3RD_MiscControl_PIXELDOUBLE_ENABLE (1<<1) - #define PM3RD_MiscControl_LASTREAD_ADDR_DISABLE (0<<2) - #define PM3RD_MiscControl_LASTREAD_ADDR_ENABLE (1<<2) - #define PM3RD_MiscControl_DIRECTCOLOR_DISABLE (0<<3) - #define PM3RD_MiscControl_DIRECTCOLOR_ENABLE (1<<3) - #define PM3RD_MiscControl_OVERLAY_DISABLE (0<<4) - #define PM3RD_MiscControl_OVERLAY_ENABLE (1<<4) - #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_DISABLE (0<<5) - #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_ENABLE (1<<5) - #define PM3RD_MiscControl_VSB_OUTPUT_DISABLE (0<<6) - #define PM3RD_MiscControl_VSB_OUTPUT_ENABLE (1<<6) - #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_DISABLE (0<<7) - #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_ENABLE (1<<7) +# define PM3RD_MiscControl_HIGHCOLOR_RES_DISABLE (0<<0) +# define PM3RD_MiscControl_HIGHCOLOR_RES_ENABLE (1<<0) +# define PM3RD_MiscControl_PIXELDOUBLE_DISABLE (0<<1) +# define PM3RD_MiscControl_PIXELDOUBLE_ENABLE (1<<1) +# define PM3RD_MiscControl_LASTREAD_ADDR_DISABLE (0<<2) +# define PM3RD_MiscControl_LASTREAD_ADDR_ENABLE (1<<2) +# define PM3RD_MiscControl_DIRECTCOLOR_DISABLE (0<<3) +# define PM3RD_MiscControl_DIRECTCOLOR_ENABLE (1<<3) +# define PM3RD_MiscControl_OVERLAY_DISABLE (0<<4) +# define PM3RD_MiscControl_OVERLAY_ENABLE (1<<4) +# define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_DISABLE (0<<5) +# define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_ENABLE (1<<5) +# define PM3RD_MiscControl_VSB_OUTPUT_DISABLE (0<<6) +# define PM3RD_MiscControl_VSB_OUTPUT_ENABLE (1<<6) +# define PM3RD_MiscControl_STEREODOUBLE_BUFFER_DISABLE (0<<7) +# define PM3RD_MiscControl_STEREODOUBLE_BUFFER_ENABLE (1<<7) #define PM3RD_SyncControl 0x001 - #define PM3RD_SyncControl_HSYNC_ACTIVE_LOW (0<<0) - #define PM3RD_SyncControl_HSYNC_ACTIVE_HIGH (1<<0) - #define PM3RD_SyncControl_HSYNC_FORCE_ACTIVE (3<<0) - #define PM3RD_SyncControl_HSYNC_FORCE_INACTIVE (4<<0) - #define PM3RD_SyncControl_HSYNC_TRI_STATE (2<<0) - #define PM3RD_SyncControl_VSYNC_ACTIVE_LOW (0<<3) - #define PM3RD_SyncControl_VSYNC_ACTIVE_HIGH (1<<3) - #define PM3RD_SyncControl_VSYNC_TRI_STATE (2<<3) - #define PM3RD_SyncControl_VSYNC_FORCE_ACTIVE (3<<3) - #define PM3RD_SyncControl_VSYNC_FORCE_INACTIVE (4<<3) - #define PM3RD_SyncControl_HSYNC_OVERRIDE_SETBY_HSYNC (0<<6) - #define PM3RD_SyncControl_HSYNC_OVERRIDE_FORCE_HIGH (1<<6) - #define PM3RD_SyncControl_VSYNC_OVERRIDE_SETBY_VSYNC (0<<7) - #define PM3RD_SyncControl_VSYNC_OVERRIDE_FORCE_HIGH (1<<7) +# define PM3RD_SyncControl_HSYNC_ACTIVE_LOW (0<<0) +# define PM3RD_SyncControl_HSYNC_ACTIVE_HIGH (1<<0) +# define PM3RD_SyncControl_HSYNC_FORCE_ACTIVE (3<<0) +# define PM3RD_SyncControl_HSYNC_FORCE_INACTIVE (4<<0) +# define PM3RD_SyncControl_HSYNC_TRI_STATE (2<<0) +# define PM3RD_SyncControl_VSYNC_ACTIVE_LOW (0<<3) +# define PM3RD_SyncControl_VSYNC_ACTIVE_HIGH (1<<3) +# define PM3RD_SyncControl_VSYNC_TRI_STATE (2<<3) +# define PM3RD_SyncControl_VSYNC_FORCE_ACTIVE (3<<3) +# define PM3RD_SyncControl_VSYNC_FORCE_INACTIVE (4<<3) +# define PM3RD_SyncControl_HSYNC_OVERRIDE_SETBY_HSYNC (0<<6) +# define PM3RD_SyncControl_HSYNC_OVERRIDE_FORCE_HIGH (1<<6) +# define PM3RD_SyncControl_VSYNC_OVERRIDE_SETBY_VSYNC (0<<7) +# define PM3RD_SyncControl_VSYNC_OVERRIDE_FORCE_HIGH (1<<7) #define PM3RD_DACControl 0x002 - #define PM3RD_DACControl_DAC_POWER_ON (0<<0) - #define PM3RD_DACControl_DAC_POWER_OFF (1<<0) - #define PM3RD_DACControl_SYNC_ON_GREEN_DISABLE (0<<3) - #define PM3RD_DACControl_SYNC_ON_GREEN_ENABLE (1<<3) - #define PM3RD_DACControl_BLANK_RED_DAC_DISABLE (0<<4) - #define PM3RD_DACControl_BLANK_RED_DAC_ENABLE (1<<4) - #define PM3RD_DACControl_BLANK_GREEN_DAC_DISABLE (0<<5) - #define PM3RD_DACControl_BLANK_GREEN_DAC_ENABLE (1<<5) - #define PM3RD_DACControl_BLANK_BLUE_DAC_DISABLE (0<<6) - #define PM3RD_DACControl_BLANK_BLUE_DAC_ENABLE (1<<6) - #define PM3RD_DACControl_BLANK_PEDESTAL_DISABLE (0<<7) - #define PM3RD_DACControl_BLANK_PEDESTAL_ENABLE (1<<7) +# define PM3RD_DACControl_DAC_POWER_ON (0<<0) +# define PM3RD_DACControl_DAC_POWER_OFF (1<<0) +# define PM3RD_DACControl_SYNC_ON_GREEN_DISABLE (0<<3) +# define PM3RD_DACControl_SYNC_ON_GREEN_ENABLE (1<<3) +# define PM3RD_DACControl_BLANK_RED_DAC_DISABLE (0<<4) +# define PM3RD_DACControl_BLANK_RED_DAC_ENABLE (1<<4) +# define PM3RD_DACControl_BLANK_GREEN_DAC_DISABLE (0<<5) +# define PM3RD_DACControl_BLANK_GREEN_DAC_ENABLE (1<<5) +# define PM3RD_DACControl_BLANK_BLUE_DAC_DISABLE (0<<6) +# define PM3RD_DACControl_BLANK_BLUE_DAC_ENABLE (1<<6) +# define PM3RD_DACControl_BLANK_PEDESTAL_DISABLE (0<<7) +# define PM3RD_DACControl_BLANK_PEDESTAL_ENABLE (1<<7) #define PM3RD_PixelSize 0x003 - #define PM3RD_PixelSize_24_BIT_PIXELS (4<<0) - #define PM3RD_PixelSize_32_BIT_PIXELS (2<<0) - #define PM3RD_PixelSize_16_BIT_PIXELS (1<<0) - #define PM3RD_PixelSize_8_BIT_PIXELS (0<<0) +# define PM3RD_PixelSize_24_BIT_PIXELS (4<<0) +# define PM3RD_PixelSize_32_BIT_PIXELS (2<<0) +# define PM3RD_PixelSize_16_BIT_PIXELS (1<<0) +# define PM3RD_PixelSize_8_BIT_PIXELS (0<<0) #define PM3RD_ColorFormat 0x004 - #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_ENABLE (1<<6) - #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_DISABLE (0<<6) - #define PM3RD_ColorFormat_COLOR_ORDER_BLUE_LOW (1<<5) - #define PM3RD_ColorFormat_COLOR_ORDER_RED_LOW (0<<5) - #define PM3RD_ColorFormat_COLOR_FORMAT_MASK (0x1f<<0) - #define PM3RD_ColorFormat_8888_COLOR (0<<0) - #define PM3RD_ColorFormat_5551_FRONT_COLOR (1<<0) - #define PM3RD_ColorFormat_4444_COLOR (2<<0) - #define PM3RD_ColorFormat_332_FRONT_COLOR (5<<0) - #define PM3RD_ColorFormat_332_BACK_COLOR (6<<0) - #define PM3RD_ColorFormat_2321_FRONT_COLOR (9<<0) - #define PM3RD_ColorFormat_2321_BACK_COLOR (10<<0) - #define PM3RD_ColorFormat_232_FRONTOFF_COLOR (11<<0) - #define PM3RD_ColorFormat_232_BACKOFF_COLOR (12<<0) - #define PM3RD_ColorFormat_5551_BACK_COLOR (13<<0) - #define PM3RD_ColorFormat_CI8_COLOR (14<<0) - #define PM3RD_ColorFormat_565_FRONT_COLOR (16<<0) - #define PM3RD_ColorFormat_565_BACK_COLOR (17<<0) +# define PM3RD_ColorFormat_LINEAR_COLOR_EXT_ENABLE (1<<6) +# define PM3RD_ColorFormat_LINEAR_COLOR_EXT_DISABLE (0<<6) +# define PM3RD_ColorFormat_COLOR_ORDER_BLUE_LOW (1<<5) +# define PM3RD_ColorFormat_COLOR_ORDER_RED_LOW (0<<5) +# define PM3RD_ColorFormat_COLOR_FORMAT_MASK (0x1f<<0) +# define PM3RD_ColorFormat_8888_COLOR (0<<0) +# define PM3RD_ColorFormat_5551_FRONT_COLOR (1<<0) +# define PM3RD_ColorFormat_4444_COLOR (2<<0) +# define PM3RD_ColorFormat_332_FRONT_COLOR (5<<0) +# define PM3RD_ColorFormat_332_BACK_COLOR (6<<0) +# define PM3RD_ColorFormat_2321_FRONT_COLOR (9<<0) +# define PM3RD_ColorFormat_2321_BACK_COLOR (10<<0) +# define PM3RD_ColorFormat_232_FRONTOFF_COLOR (11<<0) +# define PM3RD_ColorFormat_232_BACKOFF_COLOR (12<<0) +# define PM3RD_ColorFormat_5551_BACK_COLOR (13<<0) +# define PM3RD_ColorFormat_CI8_COLOR (14<<0) +# define PM3RD_ColorFormat_565_FRONT_COLOR (16<<0) +# define PM3RD_ColorFormat_565_BACK_COLOR (17<<0) #define PM3RD_CursorMode 0x005 - #define PM3RD_CursorMode_CURSOR_DISABLE (0<<0) - #define PM3RD_CursorMode_CURSOR_ENABLE (1<<0) - #define PM3RD_CursorMode_FORMAT_64x64_2BPE_P0123 (0<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P0 (1<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P1 (2<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P2 (3<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P3 (4<<2) - #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P01 (5<<2) - #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P23 (6<<2) - #define PM3RD_CursorMode_TYPE_MS (0<<4) - #define PM3RD_CursorMode_TYPE_X (1<<4) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_DISABLE (0<<6) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_ENABLE (1<<6) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_3_COLOR (2<<6) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_15_COLOR (3<<6) +# define PM3RD_CursorMode_CURSOR_DISABLE (0<<0) +# define PM3RD_CursorMode_CURSOR_ENABLE (1<<0) +# define PM3RD_CursorMode_FORMAT_64x64_2BPE_P0123 (0<<2) +# define PM3RD_CursorMode_FORMAT_32x32_2BPE_P0 (1<<2) +# define PM3RD_CursorMode_FORMAT_32x32_2BPE_P1 (2<<2) +# define PM3RD_CursorMode_FORMAT_32x32_2BPE_P2 (3<<2) +# define PM3RD_CursorMode_FORMAT_32x32_2BPE_P3 (4<<2) +# define PM3RD_CursorMode_FORMAT_32x32_4BPE_P01 (5<<2) +# define PM3RD_CursorMode_FORMAT_32x32_4BPE_P23 (6<<2) +# define PM3RD_CursorMode_TYPE_MS (0<<4) +# define PM3RD_CursorMode_TYPE_X (1<<4) +# define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_DISABLE (0<<6) +# define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_ENABLE (1<<6) +# define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_3_COLOR (2<<6) +# define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_15_COLOR (3<<6) #define PM3RD_CursorControl 0x006 - #define PM3RD_CursorControl_DOUBLE_X_DISABLED (0<<0) - #define PM3RD_CursorControl_DOUBLE_X_ENABLED (1<<0) - #define PM3RD_CursorControl_DOUBLE_Y_DISABLED (0<<1) - #define PM3RD_CursorControl_DOUBLE_Y_ENABLED (1<<1) - #define PM3RD_CursorControl_READBACK_POS_DISABLED (0<<2) - #define PM3RD_CursorControl_READBACK_POS_ENABLED (1<<2) +# define PM3RD_CursorControl_DOUBLE_X_DISABLED (0<<0) +# define PM3RD_CursorControl_DOUBLE_X_ENABLED (1<<0) +# define PM3RD_CursorControl_DOUBLE_Y_DISABLED (0<<1) +# define PM3RD_CursorControl_DOUBLE_Y_ENABLED (1<<1) +# define PM3RD_CursorControl_READBACK_POS_DISABLED (0<<2) +# define PM3RD_CursorControl_READBACK_POS_ENABLED (1<<2) #define PM3RD_CursorXLow 0x007 #define PM3RD_CursorXHigh 0x008 @@ -354,17 +354,17 @@ #define PM3RD_CursorHotSpotY 0x00c #define PM3RD_OverlayKey 0x00d #define PM3RD_Pan 0x00e - #define PM3RD_Pan_DISABLE (0<<0) - #define PM3RD_Pan_ENABLE (1<<0) - #define PM3RD_Pan_GATE_DISABLE (0<<1) - #define PM3RD_Pan_GATE_ENABLE (1<<1) +# define PM3RD_Pan_DISABLE (0<<0) +# define PM3RD_Pan_ENABLE (1<<0) +# define PM3RD_Pan_GATE_DISABLE (0<<1) +# define PM3RD_Pan_GATE_ENABLE (1<<1) #define PM3RD_Sense 0x00f #define PM3RD_CheckControl 0x018 - #define PM3RD_CheckControl_PIXEL_DISABLED (0<<0) - #define PM3RD_CheckControl_PIXEL_ENABLED (1<<0) - #define PM3RD_CheckControl_LUT_DISABLED (0<<1) - #define PM3RD_CheckControl_LUT_ENABLED (1<<1) +# define PM3RD_CheckControl_PIXEL_DISABLED (0<<0) +# define PM3RD_CheckControl_PIXEL_ENABLED (1<<0) +# define PM3RD_CheckControl_LUT_DISABLED (0<<1) +# define PM3RD_CheckControl_LUT_ENABLED (1<<1) #define PM3RD_CheckPixelRed 0x019 #define PM3RD_CheckPixelGreen 0x01a #define PM3RD_CheckPixelBlue 0x01b @@ -374,19 +374,19 @@ #define PM3RD_Scratch 0x01f #define PM3RD_VideoOverlayControl 0x020 - #define PM3RD_VideoOverlayControl_DISABLE (0<<0) - #define PM3RD_VideoOverlayControl_ENABLE (1<<0) - #define PM3RD_VideoOverlayControl_MODE_MASK (3<<1) - #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1) - #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1) - #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1) - #define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1) - #define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3) - #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3) - #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4) - #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4) - #define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5) - #define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5) +# define PM3RD_VideoOverlayControl_DISABLE (0<<0) +# define PM3RD_VideoOverlayControl_ENABLE (1<<0) +# define PM3RD_VideoOverlayControl_MODE_MASK (3<<1) +# define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1) +# define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1) +# define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1) +# define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1) +# define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3) +# define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3) +# define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4) +# define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4) +# define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5) +# define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5) #define PM3RD_VideoOverlayXStartLow 0x021 #define PM3RD_VideoOverlayXStartHigh 0x022 #define PM3RD_VideoOverlayYStartLow 0x023 @@ -399,10 +399,10 @@ #define PM3RD_VideoOverlayKeyG 0x02a #define PM3RD_VideoOverlayKeyB 0x02b #define PM3RD_VideoOverlayBlend 0x02c - #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6) - #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6) - #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (2<<6) - #define PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT (3<<6) +# define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6) +# define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6) +# define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (2<<6) +# define PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT (3<<6) #define PM3RD_DClkSetup1 0x1f0 #define PM3RD_DClkSetup2 0x1f1 @@ -410,17 +410,17 @@ #define PM3RD_KClkSetup2 0x1f3 #define PM3RD_DClkControl 0x200 - #define PM3RD_DClkControl_SOURCE_PLL (0<<4) - #define PM3RD_DClkControl_SOURCE_VSA (1<<4) - #define PM3RD_DClkControl_SOURCE_VSB (2<<4) - #define PM3RD_DClkControl_SOURCE_EXT (3<<4) - #define PM3RD_DClkControl_STATE_RUN (2<<2) - #define PM3RD_DClkControl_STATE_HIGH (1<<2) - #define PM3RD_DClkControl_STATE_LOW (0<<2) - #define PM3RD_DClkControl_LOCKED (1<<1) - #define PM3RD_DClkControl_NOT_LOCKED (0<<1) - #define PM3RD_DClkControl_ENABLE (1<<0) - #define PM3RD_DClkControl_DISABLE (0<<0) +# define PM3RD_DClkControl_SOURCE_PLL (0<<4) +# define PM3RD_DClkControl_SOURCE_VSA (1<<4) +# define PM3RD_DClkControl_SOURCE_VSB (2<<4) +# define PM3RD_DClkControl_SOURCE_EXT (3<<4) +# define PM3RD_DClkControl_STATE_RUN (2<<2) +# define PM3RD_DClkControl_STATE_HIGH (1<<2) +# define PM3RD_DClkControl_STATE_LOW (0<<2) +# define PM3RD_DClkControl_LOCKED (1<<1) +# define PM3RD_DClkControl_NOT_LOCKED (0<<1) +# define PM3RD_DClkControl_ENABLE (1<<0) +# define PM3RD_DClkControl_DISABLE (0<<0) #define PM3RD_DClk0PreScale 0x201 #define PM3RD_DClk0FeedbackScale 0x202 #define PM3RD_DClk0PostScale 0x203 @@ -434,53 +434,53 @@ #define PM3RD_DClk3FeedbackScale 0x20b #define PM3RD_DClk3PostScale 0x20c #define PM3RD_KClkControl 0x20d - #define PM3RD_KClkControl_DISABLE (0<<0) - #define PM3RD_KClkControl_ENABLE (1<<0) - #define PM3RD_KClkControl_NOT_LOCKED (0<<1) - #define PM3RD_KClkControl_LOCKED (1<<1) - #define PM3RD_KClkControl_STATE_LOW (0<<2) - #define PM3RD_KClkControl_STATE_HIGH (1<<2) - #define PM3RD_KClkControl_STATE_RUN (2<<2) - #define PM3RD_KClkControl_STATE_LOW_POWER (3<<2) - #define PM3RD_KClkControl_SOURCE_PCLK (0<<4) - #define PM3RD_KClkControl_SOURCE_HALF_PCLK (1<<4) - #define PM3RD_KClkControl_SOURCE_PLL (2<<4) +# define PM3RD_KClkControl_DISABLE (0<<0) +# define PM3RD_KClkControl_ENABLE (1<<0) +# define PM3RD_KClkControl_NOT_LOCKED (0<<1) +# define PM3RD_KClkControl_LOCKED (1<<1) +# define PM3RD_KClkControl_STATE_LOW (0<<2) +# define PM3RD_KClkControl_STATE_HIGH (1<<2) +# define PM3RD_KClkControl_STATE_RUN (2<<2) +# define PM3RD_KClkControl_STATE_LOW_POWER (3<<2) +# define PM3RD_KClkControl_SOURCE_PCLK (0<<4) +# define PM3RD_KClkControl_SOURCE_HALF_PCLK (1<<4) +# define PM3RD_KClkControl_SOURCE_PLL (2<<4) #define PM3RD_KClkPreScale 0x20e #define PM3RD_KClkFeedbackScale 0x20f #define PM3RD_KClkPostScale 0x210 #define PM3RD_MClkControl 0x211 - #define PM3RD_MClkControl_DISABLE (0<<0) - #define PM3RD_MClkControl_ENABLE (1<<0) - #define PM3RD_MClkControl_NOT_LOCKED (0<<1) - #define PM3RD_MClkControl_LOCKED (1<<1) - #define PM3RD_MClkControl_STATE_LOW (0<<2) - #define PM3RD_MClkControl_STATE_HIGH (1<<2) - #define PM3RD_MClkControl_STATE_RUN (2<<2) - #define PM3RD_MClkControl_STATE_LOW_POWER (3<<2) - #define PM3RD_MClkControl_SOURCE_PCLK (0<<4) - #define PM3RD_MClkControl_SOURCE_HALF_PCLK (1<<4) - #define PM3RD_MClkControl_SOURCE_HALF_EXT (3<<4) - #define PM3RD_MClkControl_SOURCE_EXT (4<<4) - #define PM3RD_MClkControl_SOURCE_HALF_KCLK (5<<4) - #define PM3RD_MClkControl_SOURCE_KCLK (6<<4) +# define PM3RD_MClkControl_DISABLE (0<<0) +# define PM3RD_MClkControl_ENABLE (1<<0) +# define PM3RD_MClkControl_NOT_LOCKED (0<<1) +# define PM3RD_MClkControl_LOCKED (1<<1) +# define PM3RD_MClkControl_STATE_LOW (0<<2) +# define PM3RD_MClkControl_STATE_HIGH (1<<2) +# define PM3RD_MClkControl_STATE_RUN (2<<2) +# define PM3RD_MClkControl_STATE_LOW_POWER (3<<2) +# define PM3RD_MClkControl_SOURCE_PCLK (0<<4) +# define PM3RD_MClkControl_SOURCE_HALF_PCLK (1<<4) +# define PM3RD_MClkControl_SOURCE_HALF_EXT (3<<4) +# define PM3RD_MClkControl_SOURCE_EXT (4<<4) +# define PM3RD_MClkControl_SOURCE_HALF_KCLK (5<<4) +# define PM3RD_MClkControl_SOURCE_KCLK (6<<4) #define PM3RD_MClkPreScale 0x212 #define PM3RD_MClkFeedbackScale 0x213 #define PM3RD_MClkPostScale 0x214 #define PM3RD_SClkControl 0x215 - #define PM3RD_SClkControl_DISABLE (0<<0) - #define PM3RD_SClkControl_ENABLE (1<<0) - #define PM3RD_SClkControl_NOT_LOCKED (0<<1) - #define PM3RD_SClkControl_LOCKED (1<<1) - #define PM3RD_SClkControl_STATE_LOW (0<<2) - #define PM3RD_SClkControl_STATE_HIGH (1<<2) - #define PM3RD_SClkControl_STATE_RUN (2<<2) - #define PM3RD_SClkControl_STATE_LOW_POWER (3<<2) - #define PM3RD_SClkControl_SOURCE_PCLK (0<<4) - #define PM3RD_SClkControl_SOURCE_HALF_PCLK (1<<4) - #define PM3RD_SClkControl_SOURCE_HALF_EXT (3<<4) - #define PM3RD_SClkControl_SOURCE_EXT (4<<4) - #define PM3RD_SClkControl_SOURCE_HALF_KCLK (5<<4) - #define PM3RD_SClkControl_SOURCE_KCLK (6<<4) +# define PM3RD_SClkControl_DISABLE (0<<0) +# define PM3RD_SClkControl_ENABLE (1<<0) +# define PM3RD_SClkControl_NOT_LOCKED (0<<1) +# define PM3RD_SClkControl_LOCKED (1<<1) +# define PM3RD_SClkControl_STATE_LOW (0<<2) +# define PM3RD_SClkControl_STATE_HIGH (1<<2) +# define PM3RD_SClkControl_STATE_RUN (2<<2) +# define PM3RD_SClkControl_STATE_LOW_POWER (3<<2) +# define PM3RD_SClkControl_SOURCE_PCLK (0<<4) +# define PM3RD_SClkControl_SOURCE_HALF_PCLK (1<<4) +# define PM3RD_SClkControl_SOURCE_HALF_EXT (3<<4) +# define PM3RD_SClkControl_SOURCE_EXT (4<<4) +# define PM3RD_SClkControl_SOURCE_HALF_KCLK (5<<4) +# define PM3RD_SClkControl_SOURCE_KCLK (6<<4) #define PM3RD_SClkPreScale 0x216 #define PM3RD_SClkFeedbackScale 0x217 #define PM3RD_SClkPostScale 0x218 @@ -520,10 +520,10 @@ #define PM3ColorDDAModeOr 0xabe8 #define PM3CommandInterrupt 0xa990 #define PM3ConstantColorDDA 0xafb0 - #define PM3ConstantColorDDA_R(r) ((r)&0xff) - #define PM3ConstantColorDDA_G(g) (((g)&0xff)<<8) - #define PM3ConstantColorDDA_B(b) (((b)&0xff)<<16) - #define PM3ConstantColorDDA_A(a) (((a)&0xff)<<24) +# define PM3ConstantColorDDA_R(r) ((r)&0xff) +# define PM3ConstantColorDDA_G(g) (((g)&0xff)<<8) +# define PM3ConstantColorDDA_B(b) (((b)&0xff)<<16) +# define PM3ConstantColorDDA_A(a) (((a)&0xff)<<24) #define PM3ContextData 0x8dd0 #define PM3ContextDump 0x8dc0 #define PM3ContextRestore 0x8dc8 @@ -567,59 +567,59 @@ #define PM3FBDestReadBufferOffset1 0xaea8 #define PM3FBDestReadBufferOffset2 0xaeb0 #define PM3FBDestReadBufferOffset3 0xaeb8 - #define PM3FBDestReadBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FBDestReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) +# define PM3FBDestReadBufferOffset_XOffset(x) ((x)&0xffff) +# define PM3FBDestReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FBDestReadBufferWidth0 0xaec0 #define PM3FBDestReadBufferWidth1 0xaec8 #define PM3FBDestReadBufferWidth2 0xaed0 #define PM3FBDestReadBufferWidth3 0xaed8 - #define PM3FBDestReadBufferWidth_Width(w) ((w)&0x0fff) +# define PM3FBDestReadBufferWidth_Width(w) ((w)&0x0fff) #define PM3FBDestReadEnables 0xaee8 #define PM3FBDestReadEnablesAnd 0xad20 #define PM3FBDestReadEnablesOr 0xad28 - #define PM3FBDestReadEnables_E(e) ((e)&0xff) - #define PM3FBDestReadEnables_E0 1<<0 - #define PM3FBDestReadEnables_E1 1<<1 - #define PM3FBDestReadEnables_E2 1<<2 - #define PM3FBDestReadEnables_E3 1<<3 - #define PM3FBDestReadEnables_E4 1<<4 - #define PM3FBDestReadEnables_E5 1<<5 - #define PM3FBDestReadEnables_E6 1<<6 - #define PM3FBDestReadEnables_E7 1<<7 - #define PM3FBDestReadEnables_R(r) (((r)&0xff)<<8) - #define PM3FBDestReadEnables_R0 1<<8 - #define PM3FBDestReadEnables_R1 1<<9 - #define PM3FBDestReadEnables_R2 1<<10 - #define PM3FBDestReadEnables_R3 1<<11 - #define PM3FBDestReadEnables_R4 1<<12 - #define PM3FBDestReadEnables_R5 1<<13 - #define PM3FBDestReadEnables_R6 1<<14 - #define PM3FBDestReadEnables_R7 1<<15 - #define PM3FBDestReadEnables_ReferenceAlpha(a) (((a)&0xff)<<24) +# define PM3FBDestReadEnables_E(e) ((e)&0xff) +# define PM3FBDestReadEnables_E0 1<<0 +# define PM3FBDestReadEnables_E1 1<<1 +# define PM3FBDestReadEnables_E2 1<<2 +# define PM3FBDestReadEnables_E3 1<<3 +# define PM3FBDestReadEnables_E4 1<<4 +# define PM3FBDestReadEnables_E5 1<<5 +# define PM3FBDestReadEnables_E6 1<<6 +# define PM3FBDestReadEnables_E7 1<<7 +# define PM3FBDestReadEnables_R(r) (((r)&0xff)<<8) +# define PM3FBDestReadEnables_R0 1<<8 +# define PM3FBDestReadEnables_R1 1<<9 +# define PM3FBDestReadEnables_R2 1<<10 +# define PM3FBDestReadEnables_R3 1<<11 +# define PM3FBDestReadEnables_R4 1<<12 +# define PM3FBDestReadEnables_R5 1<<13 +# define PM3FBDestReadEnables_R6 1<<14 +# define PM3FBDestReadEnables_R7 1<<15 +# define PM3FBDestReadEnables_ReferenceAlpha(a) (((a)&0xff)<<24) #define PM3FBDestReadMode 0xaee0 #define PM3FBDestReadModeAnd 0xac90 #define PM3FBDestReadModeOr 0xac98 - #define PM3FBDestReadMode_ReadDisable 0<<0 - #define PM3FBDestReadMode_ReadEnable 1<<0 - #define PM3FBDestReadMode_StripePitch(sp) (((sp)&0x7)<<2 - #define PM3FBDestReadMode_StripeHeight(sh) (((sh)&0x7)<<7 - #define PM3FBDestReadMode_Enable0 1<<8 - #define PM3FBDestReadMode_Enable1 1<<9 - #define PM3FBDestReadMode_Enable2 1<<10 - #define PM3FBDestReadMode_Enable3 1<<11 - #define PM3FBDestReadMode_Layout0(l) (((l)&0x3)<<12 - #define PM3FBDestReadMode_Layout1(l) (((l)&0x3)<<14 - #define PM3FBDestReadMode_Layout2(l) (((l)&0x3)<<16 - #define PM3FBDestReadMode_Layout3(l) (((l)&0x3)<<18 - #define PM3FBDestReadMode_Origin0 1<<20 - #define PM3FBDestReadMode_Origin1 1<<21 - #define PM3FBDestReadMode_Origin2 1<<22 - #define PM3FBDestReadMode_Origin3 1<<23 - #define PM3FBDestReadMode_Blocking 1<<24 - #define PM3FBDestReadMode_UseReadEnabled 1<<26 - #define PM3FBDestReadMode_AlphaFiltering 1<<27 +# define PM3FBDestReadMode_ReadDisable 0<<0 +# define PM3FBDestReadMode_ReadEnable 1<<0 +# define PM3FBDestReadMode_StripePitch(sp) (((sp)&0x7)<<2 +# define PM3FBDestReadMode_StripeHeight(sh) (((sh)&0x7)<<7 +# define PM3FBDestReadMode_Enable0 1<<8 +# define PM3FBDestReadMode_Enable1 1<<9 +# define PM3FBDestReadMode_Enable2 1<<10 +# define PM3FBDestReadMode_Enable3 1<<11 +# define PM3FBDestReadMode_Layout0(l) (((l)&0x3)<<12 +# define PM3FBDestReadMode_Layout1(l) (((l)&0x3)<<14 +# define PM3FBDestReadMode_Layout2(l) (((l)&0x3)<<16 +# define PM3FBDestReadMode_Layout3(l) (((l)&0x3)<<18 +# define PM3FBDestReadMode_Origin0 1<<20 +# define PM3FBDestReadMode_Origin1 1<<21 +# define PM3FBDestReadMode_Origin2 1<<22 +# define PM3FBDestReadMode_Origin3 1<<23 +# define PM3FBDestReadMode_Blocking 1<<24 +# define PM3FBDestReadMode_UseReadEnabled 1<<26 +# define PM3FBDestReadMode_AlphaFiltering 1<<27 #define PM3FBHardwareWriteMask 0x8ac0 #define PM3FBSoftwareWriteMask 0x8820 @@ -627,26 +627,26 @@ #define PM3FBSourceData 0x8aa8 #define PM3FBSourceReadBufferAddr 0xaf08 #define PM3FBSourceReadBufferOffset 0xaf10 - #define PM3FBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) +# define PM3FBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) +# define PM3FBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FBSourceReadBufferWidth 0xaf18 - #define PM3FBSourceReadBufferWidth_Width(w) ((w)&0x0fff) +# define PM3FBSourceReadBufferWidth_Width(w) ((w)&0x0fff) #define PM3FBSourceReadMode 0xaf00 #define PM3FBSourceReadModeAnd 0xaca0 #define PM3FBSourceReadModeOr 0xaca8 - #define PM3FBSourceReadMode_ReadDisable (0<<0) - #define PM3FBSourceReadMode_ReadEnable (1<<0) - #define PM3FBSourceReadMode_StripePitch(sp) (((sp)&0x7)<<2 - #define PM3FBSourceReadMode_StripeHeight(sh) (((sh)&0x7)<<7 - #define PM3FBSourceReadMode_Layout(l) (((l)&0x3)<<8 - #define PM3FBSourceReadMode_Origin 1<<10 - #define PM3FBSourceReadMode_Blocking 1<<11 - #define PM3FBSourceReadMode_UserTexelCoord 1<<13 - #define PM3FBSourceReadMode_WrapXEnable 1<<14 - #define PM3FBSourceReadMode_WrapYEnable 1<<15 - #define PM3FBSourceReadMode_WrapX(w) (((w)&0xf)<<16 - #define PM3FBSourceReadMode_WrapY(w) (((w)&0xf)<<20 - #define PM3FBSourceReadMode_ExternalSourceData 1<<24 +# define PM3FBSourceReadMode_ReadDisable (0<<0) +# define PM3FBSourceReadMode_ReadEnable (1<<0) +# define PM3FBSourceReadMode_StripePitch(sp) (((sp)&0x7)<<2 +# define PM3FBSourceReadMode_StripeHeight(sh) (((sh)&0x7)<<7 +# define PM3FBSourceReadMode_Layout(l) (((l)&0x3)<<8 +# define PM3FBSourceReadMode_Origin 1<<10 +# define PM3FBSourceReadMode_Blocking 1<<11 +# define PM3FBSourceReadMode_UserTexelCoord 1<<13 +# define PM3FBSourceReadMode_WrapXEnable 1<<14 +# define PM3FBSourceReadMode_WrapYEnable 1<<15 +# define PM3FBSourceReadMode_WrapX(w) (((w)&0xf)<<16 +# define PM3FBSourceReadMode_WrapY(w) (((w)&0xf)<<20 +# define PM3FBSourceReadMode_ExternalSourceData 1<<24 #define PM3FBWriteBufferAddr0 0xb000 #define PM3FBWriteBufferAddr1 0xb008 #define PM3FBWriteBufferAddr2 0xb010 @@ -656,36 +656,36 @@ #define PM3FBWriteBufferOffset1 0xb028 #define PM3FBWriteBufferOffset2 0xb030 #define PM3FBWriteBufferOffset3 0xb038 - #define PM3FBWriteBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FBWriteBufferOffset_YOffset(y) (((y)&0xffff)<<16) +# define PM3FBWriteBufferOffset_XOffset(x) ((x)&0xffff) +# define PM3FBWriteBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FBWriteBufferWidth0 0xb040 #define PM3FBWriteBufferWidth1 0xb048 #define PM3FBWriteBufferWidth2 0xb050 #define PM3FBWriteBufferWidth3 0xb058 - #define PM3FBWriteBufferWidth_Width(w) ((w)&0x0fff) +# define PM3FBWriteBufferWidth_Width(w) ((w)&0x0fff) #define PM3FBWriteMode 0x8ab8 #define PM3FBWriteModeAnd 0xacf0 #define PM3FBWriteModeOr 0xacf8 - #define PM3FBWriteMode_WriteDisable 0<<0 - #define PM3FBWriteMode_WriteEnable 1<<0 - #define PM3FBWriteMode_Replicate 1<<4 - #define PM3FBWriteMode_OpaqueSpan 1<<5 - #define PM3FBWriteMode_StripePitch(p) (((p)&0x7)<<6) - #define PM3FBWriteMode_StripeHeight(h) (((h)&0x7)<<9) - #define PM3FBWriteMode_Enable0 1<<12 - #define PM3FBWriteMode_Enable1 1<<13 - #define PM3FBWriteMode_Enable2 1<<14 - #define PM3FBWriteMode_Enable3 1<<15 - #define PM3FBWriteMode_Layout0(l) (((l)&0x3)<<16) - #define PM3FBWriteMode_Layout1(l) (((l)&0x3)<<18) - #define PM3FBWriteMode_Layout2(l) (((l)&0x3)<<20) - #define PM3FBWriteMode_Layout3(l) (((l)&0x3)<<22) - #define PM3FBWriteMode_Origin0 1<<24 - #define PM3FBWriteMode_Origin1 1<<25 - #define PM3FBWriteMode_Origin2 1<<26 - #define PM3FBWriteMode_Origin3 1<<27 +# define PM3FBWriteMode_WriteDisable 0<<0 +# define PM3FBWriteMode_WriteEnable 1<<0 +# define PM3FBWriteMode_Replicate 1<<4 +# define PM3FBWriteMode_OpaqueSpan 1<<5 +# define PM3FBWriteMode_StripePitch(p) (((p)&0x7)<<6) +# define PM3FBWriteMode_StripeHeight(h) (((h)&0x7)<<9) +# define PM3FBWriteMode_Enable0 1<<12 +# define PM3FBWriteMode_Enable1 1<<13 +# define PM3FBWriteMode_Enable2 1<<14 +# define PM3FBWriteMode_Enable3 1<<15 +# define PM3FBWriteMode_Layout0(l) (((l)&0x3)<<16) +# define PM3FBWriteMode_Layout1(l) (((l)&0x3)<<18) +# define PM3FBWriteMode_Layout2(l) (((l)&0x3)<<20) +# define PM3FBWriteMode_Layout3(l) (((l)&0x3)<<22) +# define PM3FBWriteMode_Origin0 1<<24 +# define PM3FBWriteMode_Origin1 1<<25 +# define PM3FBWriteMode_Origin2 1<<26 +# define PM3FBWriteMode_Origin3 1<<27 #define PM3ForegroundColor 0xb0c0 /* ... */ #define PM3GIDMode 0xb538 @@ -700,55 +700,55 @@ #define PM3LBDestReadMode 0xb500 #define PM3LBDestReadModeAnd 0xb580 #define PM3LBDestReadModeOr 0xb588 - #define PM3LBDestReadMode_Disable 0<<0 - #define PM3LBDestReadMode_Enable 1<<0 - #define PM3LBDestReadMode_StripePitch(p) (((p)&0x7)<<2) - #define PM3LBDestReadMode_StripeHeight(h) (((h)&0x7)<<5) - #define PM3LBDestReadMode_Layout 1<<8 - #define PM3LBDestReadMode_Origin 1<<9 - #define PM3LBDestReadMode_UserReadEnables 1<<10 - #define PM3LBDestReadMode_Packed16 1<<11 - #define PM3LBDestReadMode_Width(w) (((w)&0xfff)<<12) +# define PM3LBDestReadMode_Disable 0<<0 +# define PM3LBDestReadMode_Enable 1<<0 +# define PM3LBDestReadMode_StripePitch(p) (((p)&0x7)<<2) +# define PM3LBDestReadMode_StripeHeight(h) (((h)&0x7)<<5) +# define PM3LBDestReadMode_Layout 1<<8 +# define PM3LBDestReadMode_Origin 1<<9 +# define PM3LBDestReadMode_UserReadEnables 1<<10 +# define PM3LBDestReadMode_Packed16 1<<11 +# define PM3LBDestReadMode_Width(w) (((w)&0xfff)<<12) #define PM3LBReadFormat 0x8888 - #define PM3LBReadFormat_DepthWidth(w) (((w)&0x3)<<0) - #define PM3LBReadFormat_StencilWidth(w) (((w)&0xf)<<2) - #define PM3LBReadFormat_StencilPosition(p) (((p)&0x1f)<<6) - #define PM3LBReadFormat_FCPWidth(w) (((w)&0xf)<<11) - #define PM3LBReadFormat_FCPPosition(p) (((p)&0x1f)<<15) - #define PM3LBReadFormat_GIDWidth(w) (((w)&0x7)<<20) - #define PM3LBReadFormat_GIDPosition(p) (((p)&0x1f)<<23) +# define PM3LBReadFormat_DepthWidth(w) (((w)&0x3)<<0) +# define PM3LBReadFormat_StencilWidth(w) (((w)&0xf)<<2) +# define PM3LBReadFormat_StencilPosition(p) (((p)&0x1f)<<6) +# define PM3LBReadFormat_FCPWidth(w) (((w)&0xf)<<11) +# define PM3LBReadFormat_FCPPosition(p) (((p)&0x1f)<<15) +# define PM3LBReadFormat_GIDWidth(w) (((w)&0x7)<<20) +# define PM3LBReadFormat_GIDPosition(p) (((p)&0x1f)<<23) #define PM3LBSourceReadBufferAddr 0xb528 #define PM3LBSourceReadBufferOffset 0xb530 #define PM3LBSourceReadMode 0xb520 #define PM3LBSourceReadModeAnd 0xb5a0 #define PM3LBSourceReadModeOr 0xb5a8 - #define PM3LBSourceReadMode_Enable 1<<0 - #define PM3LBSourceReadMode_StripePitch(p) (((p)&0x7)<<2) - #define PM3LBSourceReadMode_StripeHeight(h) (((h)&0x7)<<5) - #define PM3LBSourceReadMode_Layout 1<<8 - #define PM3LBSourceReadMode_Origin 1<<9 - #define PM3LBSourceReadMode_Packed16 1<<10 - #define PM3LBSourceReadMode_Width(w) (((w)&0xfff)<<11) +# define PM3LBSourceReadMode_Enable 1<<0 +# define PM3LBSourceReadMode_StripePitch(p) (((p)&0x7)<<2) +# define PM3LBSourceReadMode_StripeHeight(h) (((h)&0x7)<<5) +# define PM3LBSourceReadMode_Layout 1<<8 +# define PM3LBSourceReadMode_Origin 1<<9 +# define PM3LBSourceReadMode_Packed16 1<<10 +# define PM3LBSourceReadMode_Width(w) (((w)&0xfff)<<11) #define PM3LBStencil 0x88a8 #define PM3LBWriteBufferAddr 0xb540 #define PM3LBWriteBufferOffset 0xb548 #define PM3LBWriteFormat 0x88c8 - #define PM3LBWriteFormat_DepthWidth(w) (((w)&0x3)<<0) - #define PM3LBWriteFormat_StencilWidth(w) (((w)&0xf)<<2) - #define PM3LBWriteFormat_StencilPosition(p) (((p)&0x1f)<<6) - #define PM3LBWriteFormat_GIDWidth(w) (((w)&0x7)<<20) - #define PM3LBWriteFormat_GIDPosition(p) (((p)&0x1f)<<23) +# define PM3LBWriteFormat_DepthWidth(w) (((w)&0x3)<<0) +# define PM3LBWriteFormat_StencilWidth(w) (((w)&0xf)<<2) +# define PM3LBWriteFormat_StencilPosition(p) (((p)&0x1f)<<6) +# define PM3LBWriteFormat_GIDWidth(w) (((w)&0x7)<<20) +# define PM3LBWriteFormat_GIDPosition(p) (((p)&0x1f)<<23) #define PM3LBWriteMode 0x88c0 #define PM3LBWriteModeAnd 0xac80 #define PM3LBWriteModeOr 0xac88 - #define PM3LBWriteMode_WriteDisable 0<<0 - #define PM3LBWriteMode_WriteEnable 1<<0 - #define PM3LBWriteMode_StripePitch(p) (((p)&0x7)<<3) - #define PM3LBWriteMode_StripeHeight(h) (((h)&0x7)<<6) - #define PM3LBWriteMode_Layout 1<<9 - #define PM3LBWriteMode_Origin 1<<10 - #define PM3LBWriteMode_Packed16 1<<11 - #define PM3LBWriteMode_Width(w) (((w)&0xfff)<<12) +# define PM3LBWriteMode_WriteDisable 0<<0 +# define PM3LBWriteMode_WriteEnable 1<<0 +# define PM3LBWriteMode_StripePitch(p) (((p)&0x7)<<3) +# define PM3LBWriteMode_StripeHeight(h) (((h)&0x7)<<6) +# define PM3LBWriteMode_Layout 1<<9 +# define PM3LBWriteMode_Origin 1<<10 +# define PM3LBWriteMode_Packed16 1<<11 +# define PM3LBWriteMode_Width(w) (((w)&0xfff)<<12) /* ... */ #define PM3LineStippleMode 0x81a8 #define PM3LineStippleModeAnd 0xabc0 @@ -758,16 +758,16 @@ #define PM3LogicalOpMode 0x8828 #define PM3LogicalOpModeAnd 0xace0 #define PM3LogicalOpModeOr 0xace8 - #define PM3LogicalOpMode_Disable (0<<0) - #define PM3LogicalOpMode_Enable (1<<0) - #define PM3LogicalOpMode_LogicOp(op) (((op)&0xf)<<1) - #define PM3LogicalOpMode_UseConstantWriteData_Disable (0<<5) - #define PM3LogicalOpMode_UseConstantWriteData_Enable (1<<5) - #define PM3LogicalOpMode_Background_Disable (0<<6) - #define PM3LogicalOpMode_Background_Enable (1<<6) - #define PM3LogicalOpMode_Background_LogicOp(op) (((op)&0xf)<<7) - #define PM3LogicalOpMode_UseConstantSource_Disable (0<<11) - #define PM3LogicalOpMode_UseConstantSource_Enable (1<<11) +# define PM3LogicalOpMode_Disable (0<<0) +# define PM3LogicalOpMode_Enable (1<<0) +# define PM3LogicalOpMode_LogicOp(op) (((op)&0xf)<<1) +# define PM3LogicalOpMode_UseConstantWriteData_Disable (0<<5) +# define PM3LogicalOpMode_UseConstantWriteData_Enable (1<<5) +# define PM3LogicalOpMode_Background_Disable (0<<6) +# define PM3LogicalOpMode_Background_Enable (1<<6) +# define PM3LogicalOpMode_Background_LogicOp(op) (((op)&0xf)<<7) +# define PM3LogicalOpMode_UseConstantSource_Disable (0<<11) +# define PM3LogicalOpMode_UseConstantSource_Enable (1<<11) /* ... */ #define PM3LUT 0x8e80 @@ -782,70 +782,70 @@ #define PM3LUTTransfer 0x84d8 /* ... */ #define PM3PixelSize 0x80c0 - #define PM3PixelSize_GLOBAL_32BIT (0<<0) - #define PM3PixelSize_GLOBAL_16BIT (1<<0) - #define PM3PixelSize_GLOBAL_8BIT (2<<0) - #define PM3PixelSize_RASTERIZER_32BIT (0<<2) - #define PM3PixelSize_RASTERIZER_16BIT (1<<2) - #define PM3PixelSize_RASTERIZER_8BIT (2<<2) - #define PM3PixelSize_SCISSOR_AND_STIPPLE_32BIT (0<<4) - #define PM3PixelSize_SCISSOR_AND_STIPPLE_16BIT (1<<4) - #define PM3PixelSize_SCISSOR_AND_STIPPLE_8BIT (2<<4) - #define PM3PixelSize_TEXTURE_32BIT (0<<6) - #define PM3PixelSize_TEXTURE_16BIT (1<<6) - #define PM3PixelSize_TEXTURE_8BIT (2<<6) - #define PM3PixelSize_LUT_32BIT (0<<8) - #define PM3PixelSize_LUT_16BIT (1<<8) - #define PM3PixelSize_LUT_8BIT (2<<8) - #define PM3PixelSize_FRAMEBUFFER_32BIT (0<<10) - #define PM3PixelSize_FRAMEBUFFER_16BIT (1<<10) - #define PM3PixelSize_FRAMEBUFFER_8BIT (2<<10) - #define PM3PixelSize_LOGICAL_OP_32BIT (0<<12) - #define PM3PixelSize_LOGICAL_OP_16BIT (1<<12) - #define PM3PixelSize_LOGICAL_OP_8BIT (2<<12) - #define PM3PixelSize_LOCALBUFFER_32BIT (0<<14) - #define PM3PixelSize_LOCALBUFFER_16BIT (1<<14) - #define PM3PixelSize_LOCALBUFFER_8BIT (2<<14) - #define PM3PixelSize_SETUP_32BIT (0<<16) - #define PM3PixelSize_SETUP_16BIT (1<<16) - #define PM3PixelSize_SETUP_8BIT (2<<16) - #define PM3PixelSize_GLOBAL (0<<31) - #define PM3PixelSize_INDIVIDUAL (1<<31) +# define PM3PixelSize_GLOBAL_32BIT (0<<0) +# define PM3PixelSize_GLOBAL_16BIT (1<<0) +# define PM3PixelSize_GLOBAL_8BIT (2<<0) +# define PM3PixelSize_RASTERIZER_32BIT (0<<2) +# define PM3PixelSize_RASTERIZER_16BIT (1<<2) +# define PM3PixelSize_RASTERIZER_8BIT (2<<2) +# define PM3PixelSize_SCISSOR_AND_STIPPLE_32BIT (0<<4) +# define PM3PixelSize_SCISSOR_AND_STIPPLE_16BIT (1<<4) +# define PM3PixelSize_SCISSOR_AND_STIPPLE_8BIT (2<<4) +# define PM3PixelSize_TEXTURE_32BIT (0<<6) +# define PM3PixelSize_TEXTURE_16BIT (1<<6) +# define PM3PixelSize_TEXTURE_8BIT (2<<6) +# define PM3PixelSize_LUT_32BIT (0<<8) +# define PM3PixelSize_LUT_16BIT (1<<8) +# define PM3PixelSize_LUT_8BIT (2<<8) +# define PM3PixelSize_FRAMEBUFFER_32BIT (0<<10) +# define PM3PixelSize_FRAMEBUFFER_16BIT (1<<10) +# define PM3PixelSize_FRAMEBUFFER_8BIT (2<<10) +# define PM3PixelSize_LOGICAL_OP_32BIT (0<<12) +# define PM3PixelSize_LOGICAL_OP_16BIT (1<<12) +# define PM3PixelSize_LOGICAL_OP_8BIT (2<<12) +# define PM3PixelSize_LOCALBUFFER_32BIT (0<<14) +# define PM3PixelSize_LOCALBUFFER_16BIT (1<<14) +# define PM3PixelSize_LOCALBUFFER_8BIT (2<<14) +# define PM3PixelSize_SETUP_32BIT (0<<16) +# define PM3PixelSize_SETUP_16BIT (1<<16) +# define PM3PixelSize_SETUP_8BIT (2<<16) +# define PM3PixelSize_GLOBAL (0<<31) +# define PM3PixelSize_INDIVIDUAL (1<<31) /* ... */ #define PM3Render 0x8038 - #define PM3Render_AreaStipple_Disable (0<<0) - #define PM3Render_AreaStipple_Enable (1<<0) - #define PM3Render_LineStipple_Disable (0<<1) - #define PM3Render_LineStipple_Enable (1<<1) - #define PM3Render_ResetLine_Disable (0<<2) - #define PM3Render_ResetLine_Enable (1<<2) - #define PM3Render_FastFill_Disable (0<<3) - #define PM3Render_FastFill_Enable (1<<3) - #define PM3Render_Primitive_Line (0<<6) - #define PM3Render_Primitive_Trapezoid (1<<6) - #define PM3Render_Primitive_Point (2<<6) - #define PM3Render_Antialias_Disable (0<<8) - #define PM3Render_Antialias_Enable (1<<8) - #define PM3Render_Antialias_SubPixelRes_4x4 (0<<9) - #define PM3Render_Antialias_SubPixelRes_8x8 (1<<9) - #define PM3Render_UsePointTable_Disable (0<<10) - #define PM3Render_UsePointTable_Enable (1<<10) - #define PM3Render_SyncOnbitMask_Disable (0<<11) - #define PM3Render_SyncOnBitMask_Enable (1<<11) - #define PM3Render_SyncOnHostData_Disable (0<<12) - #define PM3Render_SyncOnHostData_Enable (1<<12) - #define PM3Render_Texture_Disable (0<<13) - #define PM3Render_Texture_Enable (1<<13) - #define PM3Render_Fog_Disable (0<<14) - #define PM3Render_Fog_Enable (1<<14) - #define PM3Render_Coverage_Disable (0<<15) - #define PM3Render_Coverage_Enable (1<<15) - #define PM3Render_SubPixelCorrection_Disable (0<<16) - #define PM3Render_SubPixelCorrection_Enable (1<<16) - #define PM3Render_SpanOperation_Disable (0<<18) - #define PM3Render_SpanOperation_Enable (1<<18) - #define PM3Render_FBSourceRead_Disable (0<<27) - #define PM3Render_FBSourceRead_Enable (1<<27) +# define PM3Render_AreaStipple_Disable (0<<0) +# define PM3Render_AreaStipple_Enable (1<<0) +# define PM3Render_LineStipple_Disable (0<<1) +# define PM3Render_LineStipple_Enable (1<<1) +# define PM3Render_ResetLine_Disable (0<<2) +# define PM3Render_ResetLine_Enable (1<<2) +# define PM3Render_FastFill_Disable (0<<3) +# define PM3Render_FastFill_Enable (1<<3) +# define PM3Render_Primitive_Line (0<<6) +# define PM3Render_Primitive_Trapezoid (1<<6) +# define PM3Render_Primitive_Point (2<<6) +# define PM3Render_Antialias_Disable (0<<8) +# define PM3Render_Antialias_Enable (1<<8) +# define PM3Render_Antialias_SubPixelRes_4x4 (0<<9) +# define PM3Render_Antialias_SubPixelRes_8x8 (1<<9) +# define PM3Render_UsePointTable_Disable (0<<10) +# define PM3Render_UsePointTable_Enable (1<<10) +# define PM3Render_SyncOnbitMask_Disable (0<<11) +# define PM3Render_SyncOnBitMask_Enable (1<<11) +# define PM3Render_SyncOnHostData_Disable (0<<12) +# define PM3Render_SyncOnHostData_Enable (1<<12) +# define PM3Render_Texture_Disable (0<<13) +# define PM3Render_Texture_Enable (1<<13) +# define PM3Render_Fog_Disable (0<<14) +# define PM3Render_Fog_Enable (1<<14) +# define PM3Render_Coverage_Disable (0<<15) +# define PM3Render_Coverage_Enable (1<<15) +# define PM3Render_SubPixelCorrection_Disable (0<<16) +# define PM3Render_SubPixelCorrection_Enable (1<<16) +# define PM3Render_SpanOperation_Disable (0<<18) +# define PM3Render_SpanOperation_Enable (1<<18) +# define PM3Render_FBSourceRead_Disable (0<<27) +# define PM3Render_FBSourceRead_Enable (1<<27) #define PM3RasterizerMode 0x80a0 #define PM3RasterizerModeAnd 0xaba0 #define PM3RasterizerModeOr 0xabb8 @@ -922,13 +922,13 @@ #define PM3TextureMapSize 0xb428 #define PM3TextureMapWidth0 0x8580 #define PM3TextureMapWidth1 0x8588 - #define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0) - #define PM3TextureMapWidth_BorderLayout (1<<12) - #define PM3TextureMapWidth_Layout_Linear (0<<13) - #define PM3TextureMapWidth_Layout_Patch64 (1<<13) - #define PM3TextureMapWidth_Layout_Patch32_2 (2<<13) - #define PM3TextureMapWidth_Layout_Patch2 (3<<13) - #define PM3TextureMapWidth_HostTexture (1<<15) +# define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0) +# define PM3TextureMapWidth_BorderLayout (1<<12) +# define PM3TextureMapWidth_Layout_Linear (0<<13) +# define PM3TextureMapWidth_Layout_Patch64 (1<<13) +# define PM3TextureMapWidth_Layout_Patch32_2 (2<<13) +# define PM3TextureMapWidth_Layout_Patch2 (3<<13) +# define PM3TextureMapWidth_HostTexture (1<<15) #define PM3TextureReadMode0 0xb400 #define PM3TextureReadMode0And 0xac30 #define PM3TextureReadMode0Or 0xac38 @@ -938,12 +938,12 @@ /* ... */ #define PM3WaitForCompletion 0x80b8 #define PM3Window 0x8980 - #define PM3Window_ForceLBUpdate 1<<3 - #define PM3Window_LBUpdateSource 1<<4 - #define PM3Window_FrameCount(c) (((c)&0xff)<<9 - #define PM3Window_StencilFCP 1<<17 - #define PM3Window_DepthFCP 1<<18 - #define PM3Window_OverrideWriteFiltering 1<<19 +# define PM3Window_ForceLBUpdate 1<<3 +# define PM3Window_LBUpdateSource 1<<4 +# define PM3Window_FrameCount(c) (((c)&0xff)<<9 +# define PM3Window_StencilFCP 1<<17 +# define PM3Window_DepthFCP 1<<18 +# define PM3Window_OverrideWriteFiltering 1<<19 #define PM3WindowAnd 0xab80 #define PM3WindowOr 0xab88 #define PM3WindowOrigin 0x81c8 @@ -961,58 +961,58 @@ * GLINT Permedia3 2D setup Unit * ***********************************************/ #define PM3Config2D 0xb618 - #define PM3Config2D_OpaqueSpan 1<<0 - #define PM3Config2D_MultiRXBlit 1<<1 - #define PM3Config2D_UserScissorEnable 1<<2 - #define PM3Config2D_FBDestReadEnable 1<<3 - #define PM3Config2D_AlphaBlendEnable 1<<4 - #define PM3Config2D_DitherEnable 1<<5 - #define PM3Config2D_ForegroundROPEnable 1<<6 - #define PM3Config2D_ForegroundROP(rop) (((rop)&0xf)<<7) - #define PM3Config2D_BackgroundROPEnable 1<<11 - #define PM3Config2D_BackgroundROP(rop) (((rop)&0xf)<<12) - #define PM3Config2D_UseConstantSource 1<<16 - #define PM3Config2D_FBWriteEnable 1<<17 - #define PM3Config2D_Blocking 1<<18 - #define PM3Config2D_ExternalSourceData 1<<19 - #define PM3Config2D_LUTModeEnable 1<<20 +# define PM3Config2D_OpaqueSpan 1<<0 +# define PM3Config2D_MultiRXBlit 1<<1 +# define PM3Config2D_UserScissorEnable 1<<2 +# define PM3Config2D_FBDestReadEnable 1<<3 +# define PM3Config2D_AlphaBlendEnable 1<<4 +# define PM3Config2D_DitherEnable 1<<5 +# define PM3Config2D_ForegroundROPEnable 1<<6 +# define PM3Config2D_ForegroundROP(rop) (((rop)&0xf)<<7) +# define PM3Config2D_BackgroundROPEnable 1<<11 +# define PM3Config2D_BackgroundROP(rop) (((rop)&0xf)<<12) +# define PM3Config2D_UseConstantSource 1<<16 +# define PM3Config2D_FBWriteEnable 1<<17 +# define PM3Config2D_Blocking 1<<18 +# define PM3Config2D_ExternalSourceData 1<<19 +# define PM3Config2D_LUTModeEnable 1<<20 #define PM3DownloadGlyphwidth 0xb658 - #define PM3DownloadGlyphwidth_GlyphWidth(gw) ((gw)&0xffff) +# define PM3DownloadGlyphwidth_GlyphWidth(gw) ((gw)&0xffff) #define PM3DownloadTarget 0xb650 - #define PM3DownloadTarget_TagName(tag) ((tag)&0x1fff) +# define PM3DownloadTarget_TagName(tag) ((tag)&0x1fff) #define PM3GlyphData 0xb660 #define PM3GlyphPosition 0xb608 - #define PM3GlyphPosition_XOffset(x) ((x)&0xffff) - #define PM3GlyphPosition_YOffset(y) (((y)&0xffff)<<16) +# define PM3GlyphPosition_XOffset(x) ((x)&0xffff) +# define PM3GlyphPosition_YOffset(y) (((y)&0xffff)<<16) #define PM3Packed4Pixels 0xb668 #define PM3Packed8Pixels 0xb630 #define PM3Packed16Pixels 0xb638 #define PM3RectanglePosition 0xb600 - #define PM3RectanglePosition_XOffset(x) ((x)&0xffff) - #define PM3RectanglePosition_YOffset(y) (((y)&0xffff)<<16) +# define PM3RectanglePosition_XOffset(x) ((x)&0xffff) +# define PM3RectanglePosition_YOffset(y) (((y)&0xffff)<<16) #define PM3Render2D 0xb640 - #define PM3Render2D_Width(w) ((w)&0x0fff) - #define PM3Render2D_Operation_Normal 0<<12 - #define PM3Render2D_Operation_SyncOnHostData 1<<12 - #define PM3Render2D_Operation_SyncOnBitMask 2<<12 - #define PM3Render2D_Operation_PatchOrderRendering 3<<12 - #define PM3Render2D_FBSourceReadEnable 1<<14 - #define PM3Render2D_SpanOperation 1<<15 - #define PM3Render2D_Height(h) (((h)&0x0fff)<<16) - #define PM3Render2D_XPositive 1<<28 - #define PM3Render2D_YPositive 1<<29 - #define PM3Render2D_AreaStippleEnable 1<<30 - #define PM3Render2D_TextureEnable 1<<31 +# define PM3Render2D_Width(w) ((w)&0x0fff) +# define PM3Render2D_Operation_Normal 0<<12 +# define PM3Render2D_Operation_SyncOnHostData 1<<12 +# define PM3Render2D_Operation_SyncOnBitMask 2<<12 +# define PM3Render2D_Operation_PatchOrderRendering 3<<12 +# define PM3Render2D_FBSourceReadEnable 1<<14 +# define PM3Render2D_SpanOperation 1<<15 +# define PM3Render2D_Height(h) (((h)&0x0fff)<<16) +# define PM3Render2D_XPositive 1<<28 +# define PM3Render2D_YPositive 1<<29 +# define PM3Render2D_AreaStippleEnable 1<<30 +# define PM3Render2D_TextureEnable 1<<31 #define PM3Render2DGlyph 0xb648 - #define PM3Render2DGlyph_Width(w) ((w)&0x7f) - #define PM3Render2DGlyph_Height(h) (((h)&0x7f)<<7) - #define PM3Render2DGlyph_XOffset(x) (((x)&0x1ff)<<14) - #define PM3Render2DGlyph_YOffset(y) (((y)&0x1ff)<<23) +# define PM3Render2DGlyph_Width(w) ((w)&0x7f) +# define PM3Render2DGlyph_Height(h) (((h)&0x7f)<<7) +# define PM3Render2DGlyph_XOffset(x) (((x)&0x1ff)<<14) +# define PM3Render2DGlyph_YOffset(y) (((y)&0x1ff)<<23) #define PM3RenderPatchOffset 0xb610 - #define PM3RenderPatchOffset_XOffset(x) ((x)&0xffff) - #define PM3RenderPatchOffset_YOffset(y) (((y)&0xffff)<<16) +# define PM3RenderPatchOffset_XOffset(x) ((x)&0xffff) +# define PM3RenderPatchOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3RLCount 0xb678 - #define PM3RLCount_Count(c) ((c)&0x0fff) +# define PM3RLCount_Count(c) ((c)&0x0fff) #define PM3RLData 0xb670 /********************************************** @@ -1021,35 +1021,35 @@ #define PM3FillBackgroundColor 0x8330 #define PM3FillConfig2D0 0x8338 #define PM3FillConfig2D1 0x8360 - #define PM3FillConfig2D_OpaqueSpan 1<<0 - #define PM3FillConfig2D_MultiRXBlit 1<<1 - #define PM3FillConfig2D_UserScissorEnable 1<<2 - #define PM3FillConfig2D_FBDestReadEnable 1<<3 - #define PM3FillConfig2D_AlphaBlendEnable 1<<4 - #define PM3FillConfig2D_DitherEnable 1<<5 - #define PM3FillConfig2D_ForegroundROPEnable 1<<6 - #define PM3FillConfig2D_ForegroundROP(rop) (((rop)&0xf)<<7) - #define PM3FillConfig2D_BackgroundROPEnable 1<<11 - #define PM3FillConfig2D_BackgroundROP(rop) (((rop)&0xf)<<12) - #define PM3FillConfig2D_UseConstantSource 1<<16 - #define PM3FillConfig2D_FBWriteEnable 1<<17 - #define PM3FillConfig2D_Blocking 1<<18 - #define PM3FillConfig2D_ExternalSourceData 1<<19 - #define PM3FillConfig2D_LUTModeEnable 1<<20 +# define PM3FillConfig2D_OpaqueSpan 1<<0 +# define PM3FillConfig2D_MultiRXBlit 1<<1 +# define PM3FillConfig2D_UserScissorEnable 1<<2 +# define PM3FillConfig2D_FBDestReadEnable 1<<3 +# define PM3FillConfig2D_AlphaBlendEnable 1<<4 +# define PM3FillConfig2D_DitherEnable 1<<5 +# define PM3FillConfig2D_ForegroundROPEnable 1<<6 +# define PM3FillConfig2D_ForegroundROP(rop) (((rop)&0xf)<<7) +# define PM3FillConfig2D_BackgroundROPEnable 1<<11 +# define PM3FillConfig2D_BackgroundROP(rop) (((rop)&0xf)<<12) +# define PM3FillConfig2D_UseConstantSource 1<<16 +# define PM3FillConfig2D_FBWriteEnable 1<<17 +# define PM3FillConfig2D_Blocking 1<<18 +# define PM3FillConfig2D_ExternalSourceData 1<<19 +# define PM3FillConfig2D_LUTModeEnable 1<<20 #define PM3FillFBDestReadBufferAddr 0x8310 #define PM3FillFBSourceReadBufferAddr 0x8308 #define PM3FillFBSourceReadBufferOffset 0x8340 - #define PM3FillFBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FillFBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) +# define PM3FillFBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) +# define PM3FillFBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FillFBWriteBufferAddr 0x8300 #define PM3FillForegroundColor0 0x8328 #define PM3FillForegroundColor1 0x8358 #define PM3FillGlyphPosition 0x8368 - #define PM3FillGlyphPosition_XOffset(x) ((x)&0xffff) - #define PM3FillGlyphPosition_YOffset(y) (((y)&0xffff)<<16) +# define PM3FillGlyphPosition_XOffset(x) ((x)&0xffff) +# define PM3FillGlyphPosition_YOffset(y) (((y)&0xffff)<<16) #define PM3FillRectanglePosition 0x8348 - #define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) - #define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16) +# define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) +# define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16) #if 0 Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.8 Sat Oct 27 23:33:30 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c Wed May 22 04:12:02 2002 @@ -22,7 +22,7 @@ * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk * Sven Luther <luther@dpt-info.u-strasbg.fr> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.8 2001/10/28 03:33:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.11 2002/05/22 08:12:02 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -604,8 +604,8 @@ GLINT_MoveDWORDS( (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)src, pGlint->FIFOSize - 1); - dwords -= pGlint->FIFOSize - 1; - src += pGlint->FIFOSize - 1; + dwords -= (pGlint->FIFOSize - 1); + src += (pGlint->FIFOSize << 2) - 4; } if(dwords) { GLINT_WAIT(dwords + 1); @@ -625,8 +625,8 @@ GLINT_MoveDWORDS( (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)src, pGlint->FIFOSize - 1); - dwords -= pGlint->FIFOSize - 1; - src += pGlint->FIFOSize - 1; + dwords -= (pGlint->FIFOSize - 1); + src += (pGlint->FIFOSize << 2) - 4; } if(dwords) { GLINT_WAIT(dwords + 1); @@ -943,12 +943,12 @@ } HWCopySetup(pScrn, pPriv->area[pPriv->buffer]->box.x1, - pPriv->area[pPriv->buffer]->box.y1, w_bpp, src_h); + pPriv->area[pPriv->buffer]->box.y1, w_bpp, height); if (copy_flat) - HWCopyFlat(pScrn, buf, src_w, src_h); + HWCopyFlat(pScrn, buf, width, height); else - HWCopyYV12(pScrn, buf, src_w, src_h); + HWCopyYV12(pScrn, buf, width, height); /* paint the color key */ if(pPriv->autopaintColorKey && !RegionsEqual(&pPriv->clip, clipBoxes)) { Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.10 Thu May 24 15:55:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c Wed Feb 27 13:41:04 2002 @@ -27,7 +27,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c,v 1.10 2001/05/24 19:55:05 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c,v 1.11 2002/02/27 18:41:04 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -37,6 +37,7 @@ #include "xf86Pci.h" #include "IBM.h" +#include "TI.h" #include "glint_regs.h" #include "glint.h" @@ -89,6 +90,9 @@ pReg->glintRegs[PMVTotal >> 3] -= 1; /* PMVTotal */ pReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig) & 0xFFFFFFFD; + switch(pGlint->RamDac->RamDacType) { + case IBM526_RAMDAC: + case IBM526DB_RAMDAC: { /* Get the programmable clock values */ unsigned long m=0,n=0,p=0,c=0; @@ -115,7 +119,6 @@ ramdacReg->DacRegs[IBMRGB_sysclk_p] = p; ramdacReg->DacRegs[IBMRGB_sysclk_c] = c; } - ramdacReg->DacRegs[IBMRGB_misc1] = SENS_DSAB_DISABLE | VRAM_SIZE_32; ramdacReg->DacRegs[IBMRGB_misc2] = COL_RES_8BIT | PORT_SEL_VRAM; if (pScrn->depth >= 24) @@ -129,8 +132,52 @@ ramdacReg->DacRegs[IBMRGB_pwr_mgmt] = 0; ramdacReg->DacRegs[IBMRGB_dac_op] = 0; ramdacReg->DacRegs[IBMRGB_pal_ctrl] = 0; + break; + case TI3026_RAMDAC: + { + /* Get the programmable clock values */ + unsigned long m=0,n=0,p=0; + unsigned long clock; + unsigned long q, VCO = 0; + + clock = TIramdacCalculateMNPForClock(pGlint->RefClock, + mode->Clock, 1, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p); + + STORERAMDAC(TIDAC_PIXEL_N, ((n & 0x3f) | 0xC0)); + STORERAMDAC(TIDAC_PIXEL_M, (m & 0x3f)); + STORERAMDAC(TIDAC_PIXEL_P, ((p & 0x03) | 0xbc)); + STORERAMDAC(TIDAC_PIXEL_VALID, TRUE); + + if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) + n = 65 - ((32 << 2) / pScrn->bitsPerPixel); + else + n = 65 - ((128 << 2) / pScrn->bitsPerPixel); + m = 61; + p = 0; + for (q = 0; q < 8; q++) { + if (q > 0) p = 3; + for ( ; p < 4; p++) { + VCO = ((clock * (q + 1) * (65 - m)) / (65 - n)) << (p + 1); + if (VCO >= 110000) { break; } + } + if (VCO >= 110000) { break; } + } + STORERAMDAC(TIDAC_clock_ctrl, (q | 0x38)); + + STORERAMDAC(TIDAC_LOOP_N, ((n & 0x3f) | 0xC0)); + STORERAMDAC(TIDAC_LOOP_M, (m & 0x3f)); + STORERAMDAC(TIDAC_LOOP_P, ((p & 0x03) | 0xF0)); + STORERAMDAC(TIDAC_LOOP_VALID, TRUE); + break; + } + } (*pGlint->RamDac->SetBpp)(pScrn, ramdacReg); + + /* The permedia uses a 32bit data path, the TI ramdac code + * defaults to 64bit. So we knock it down to 32bit here */ + if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) + ramdacReg->DacRegs[TIDAC_multiplex_ctrl] -= 1; return(TRUE); } Index: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile:1.4 Tue Jan 23 19:06:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile Mon Feb 17 12:06:42 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile,v 1.4 2001/01/24 00:06:19 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile,v 1.5 2003/02/17 17:06:42 dawes Exp $ XCOMM XCOMM This is the Imakefile for the I128 driver. XCOMM @@ -20,7 +20,7 @@ -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf8_32bpp\ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) \ - -I$(XF86OSSRC)/vbe $(DRIINCLUDES) -I$(SERVERSRC)/render + -I$(XF86SRC)/vbe $(DRIINCLUDES) -I$(SERVERSRC)/render #endif DEFINES = $(DRIDEFINES) Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.25 xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.25 Fri Jan 4 16:22:31 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c Mon Feb 17 11:08:28 2003 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.25 2002/01/04 21:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.29 2003/02/17 16:08:28 dawes Exp $ */ /* All drivers should typically include these */ @@ -217,6 +217,7 @@ NULL }; +#ifdef XFree86LOADER /* XXX The vbe module isn't currently loaded. */ static const char *vbeSymbols[] = { "VBEInit", @@ -230,6 +231,7 @@ "xf86FreeInt10", NULL }; +#endif #ifdef XFree86LOADER @@ -517,11 +519,12 @@ I128PreInit(ScrnInfoPtr pScrn, int flags) { I128Ptr pI128; + vgaHWPtr hwp; int i; int bytesPerPixel; ClockRangePtr clockRanges; MessageType from; - CARD32 iobase; + IOADDRESS iobase; char *ramdac = NULL; CARD32 tmpl, tmph, tmp; unsigned char n, m, p, mdc, df; @@ -566,7 +569,8 @@ if (!vgaHWGetHWRec(pScrn)) return FALSE; - vgaHWGetIOBase(VGAHWPTR(pScrn)); + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -708,8 +712,15 @@ } xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); + if (pI128->PciInfo->subsysVendor == 0x105D) + xf86DrvMsg(pScrn->scrnIndex, from, "Subsystem Vendor: \"Number Nine\"\n"); + else if (pI128->PciInfo->subsysVendor == 0x10F0) + xf86DrvMsg(pScrn->scrnIndex, from, "Subsystem Vendor: \"Peritek\"\n"); + else + xf86DrvMsg(pScrn->scrnIndex, from, "Subsystem Vendor: \"%x\"\n", + pI128->PciInfo->subsysVendor); - iobase = pI128->PciInfo->ioBase[5] & 0xFF00; + iobase = (pI128->PciInfo->ioBase[5] & 0xFFFFFF00) + hwp->PIOOffset; pI128->RegRec.iobase = iobase; pI128->io.rbase_g = inl(iobase) & 0xFFFFFF00; @@ -1067,7 +1078,7 @@ * Setup the ClockRanges, which describe what clock ranges are available, * and what sort of modes they can be used for. */ - clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges = xnfcalloc(sizeof(ClockRange),1); clockRanges->next = NULL; clockRanges->minClock = pI128->minClock; clockRanges->maxClock = pI128->maxClock; @@ -1801,7 +1812,7 @@ I128Ptr pI128 = I128PTR(pScrn); unsigned char val; unsigned long tmp, ddc; - unsigned short iobase; + IOADDRESS iobase; iobase = pI128->RegRec.iobase; ddc = inl(iobase + 0x2C); @@ -1836,7 +1847,7 @@ { I128Ptr pI128 = I128PTR(xf86Screens[b->scrnIndex]); unsigned long ddc; - unsigned short iobase; + IOADDRESS iobase; #if 0 static int lastclock = -1, lastdata = -1; #endif @@ -1864,7 +1875,7 @@ unsigned char drv, val; unsigned long ddc; unsigned long tmp; - unsigned short iobase; + IOADDRESS iobase; iobase = pI128->RegRec.iobase; ddc = inl(iobase + 0x2C); @@ -1886,7 +1897,7 @@ { I128Ptr pI128 = I128PTR(pScrn); I2CBusPtr I2CPtr; - unsigned short iobase; + IOADDRESS iobase; unsigned long soft_sw, ddc; I2CPtr = xf86CreateI2CBusRec(); @@ -2095,7 +2106,7 @@ I128DumpActiveRegisters(ScrnInfoPtr pScrn) { I128Ptr pI128 = I128PTR(pScrn); - unsigned short iobase; + IOADDRESS iobase; unsigned long rbase_g, rbase_w, rbase_a, rbase_b, rbase_i, rbase_e; unsigned long id, config1, config2, sgram, soft_sw, ddc, vga_ctl; volatile CARD32 *vrba, *vrbg, *vrbw; Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c:1.7 Tue Dec 5 20:07:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c Mon Feb 17 11:08:28 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c,v 1.7 2000/12/06 01:07:34 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c,v 1.8 2003/02/17 16:08:28 dawes Exp $ */ /* * Copyright 1997-2000 by Robin Cutshaw <robin@XFree86.Org> @@ -38,7 +38,6 @@ #include "i128.h" #include "i128reg.h" -void I128EngineDone(ScrnInfoPtr pScrn); void I128BitBlit(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h); void I128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c:1.2 Sun Apr 1 10:00:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c Wed Oct 9 12:38:19 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.4 2002/10/09 16:38:19 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -18,8 +18,10 @@ static void I128_SetViewport(ScrnInfoPtr, int, int, int); static void I128_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void I128_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void I128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec I128_DGAFuncs = { @@ -225,8 +227,8 @@ SET_SYNC_FLAG(pI128->AccelInfoRec); } } - +#if 0 static void I128_BlitTransRect( ScrnInfoPtr pScrn, @@ -248,7 +250,7 @@ SET_SYNC_FLAG(pI128->AccelInfoRec); } } - +#endif static Bool I128_OpenFramebuffer( Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h:1.2 Mon Oct 23 10:11:39 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h Fri Jan 25 16:56:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h,v 1.2 2000/10/23 14:11:39 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h,v 1.3 2002/01/25 21:56:02 tsi Exp $ */ /* * Copyright 1994 by Robin Cutshaw <robin@XFree86.Org> * @@ -26,6 +26,7 @@ #ifndef I128REG_H #define I128REG_H +#include "xf86Pci.h" struct i128pci { CARD32 devicevendor; @@ -75,7 +76,7 @@ /* save the registers needed for restoration in this structure */ typedef struct { - unsigned short iobase; /* saved only for iobase indexing */ + IOADDRESS iobase; /* saved only for iobase indexing */ CARD32 config1; /* iobase+0x1C register */ CARD32 config2; /* iobase+0x20 register */ CARD32 sgram; /* iobase+0x24 register */ Index: xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile:1.8 Tue May 15 06:19:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile Mon Feb 17 12:06:42 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile,v 1.8 2001/05/15 10:19:38 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile,v 1.10 2003/02/17 17:06:42 dawes Exp $ XCOMM XCOMM This is the Imakefile for the i740 driver. XCOMM @@ -6,9 +6,9 @@ #define IHaveModules #include <Server.tmpl> -SRCS = i740_driver.c i740_cursor.c i740_accel.c i740_io.c +SRCS = i740_driver.c i740_cursor.c i740_accel.c i740_io.c i740_dga.c i740_i2c.c i740_video.c -OBJS = i740_driver.o i740_cursor.o i740_accel.o i740_io.o +OBJS = i740_driver.o i740_cursor.o i740_accel.o i740_io.o i740_dga.o i740_i2c.o i740_video.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -18,7 +18,7 @@ -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(SERVERSRC)/Xext -I$(XF86OSSRC)/vbe -I$(SERVERSRC)/fb\ + -I$(SERVERSRC)/Xext -I$(XF86SRC)/vbe -I$(SERVERSRC)/fb\ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) -I$(XF86SRC)/int10 -I$(SERVERSRC)/render #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i740/README diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/README:1.1 xc/programs/Xserver/hw/xfree86/drivers/i740/README:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/i740/README:1.1 Sun Aug 29 08:20:57 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/README Tue Jan 14 22:39:42 2003 @@ -121,7 +121,9 @@ http://www.precisioninsight.com + XVideo and DGA drivers by Patrick Lerda with some small modification by + Stephen Blackheath <stephen@blacksapphire.com> -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/README,v 1.1 1999/08/29 12:20:57 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/README,v 1.2 2003/01/15 03:39:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h:1.4 Fri May 4 15:05:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h Wed Oct 23 12:08:36 2002 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h,v 1.4 2001/05/04 19:05:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h,v 1.7 2002/10/23 16:08:36 tsi Exp $ */ /* * Authors: @@ -95,8 +95,8 @@ int MaxClock; int CursorStart; int Chipset; - int LinearAddr; - int MMIOAddr; + unsigned long LinearAddr; + unsigned long MMIOAddr; EntityInfoPtr pEnt; pciVideoPtr PciInfo; PCITAG PciTag; @@ -114,6 +114,29 @@ I740WriteByteFunc writeStandard; I740ReadByteFunc readStandard; OptionInfoPtr Options; + + /*DGA*/ + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + BoxRec FbMemBox; + /*-*/ + + /*I2C*/ + I2CBusPtr rc_i2c; + /*-*/ + + /*-*/ /*Overlay*/ + XF86VideoAdaptorPtr adaptor; + unsigned long OverlayStart; + unsigned long OverlayPhysical; + int colorKey; + ScreenBlockHandlerProcPtr BlockHandler; + int ov_offset_x,ov_offset_y; + /*-*/ + + Bool usevgacompat; } I740Rec; #define I740PTR(p) ((I740Ptr)((p)->driverPrivate)) @@ -122,13 +145,13 @@ extern Bool I740AccelInit(ScreenPtr pScreen); void I740SetPIOAccess(I740Ptr pI740); void I740SetMMIOAccess(I740Ptr pI740); +void I740InitVideo(ScreenPtr pScreen); + +Bool I740SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +void I740AdjustFrame(int scrnIndex, int x, int y, int flags); + #define minb(p) MMIO_IN8(pI740->MMIOBase, (p)) #define moutb(p,v) MMIO_OUT8(pI740->MMIOBase, (p),(v)) #endif - - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c:1.5 Sat Mar 3 17:26:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c Mon Oct 21 09:32:58 2002 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c,v 1.5 2001/03/03 22:26:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c,v 1.7 2002/10/21 13:32:58 alanh Exp $ */ /* * Authors: @@ -43,7 +43,9 @@ #include "xf86PciInfo.h" #include "xaa.h" +#include "vgaHW.h" +#include "xf86xv.h" #include "i740.h" static unsigned int i740Rop[16] = { Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c:1.4 Tue Feb 22 23:47:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c Mon Oct 21 09:32:58 2002 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c,v 1.4 2000/02/23 04:47:13 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_cursor.c,v 1.5 2002/10/21 13:32:58 alanh Exp $ */ /* * Authors: @@ -40,6 +40,8 @@ #include "xf86fbman.h" +#include "vgaHW.h" +#include "xf86xv.h" #include "i740.h" static void I740LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.c:1.2 --- /dev/null Thu Feb 27 12:30:48 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.c Wed Feb 12 16:46:42 2003 @@ -0,0 +1,252 @@ +/* + * Copyright 2001 by Patrick LERDA + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Patrick LERDA not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Patrick LERDA makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * PATRICK LERDA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL PATRICK LERDA BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Patrick LERDA + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.c,v 1.2 2003/02/12 21:46:42 tsi Exp $ */ + + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xaa.h" +#include "xaalocal.h" +#include "vgaHW.h" +#include "xf86xv.h" +#include "i740.h" +#include "dgaproc.h" +#include "i740_dga.h" + +static Bool I740_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, int *, int *); +static Bool I740_SetMode(ScrnInfoPtr, DGAModePtr); +static void I740_Sync(ScrnInfoPtr); +static int I740_GetViewport(ScrnInfoPtr); +static void I740_SetViewport(ScrnInfoPtr, int, int, int); +static void I740_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); +static void I740_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 +static void I740_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif + +static DGAFunctionRec I740DGAFuncs = { + I740_OpenFramebuffer, + NULL, + I740_SetMode, + I740_SetViewport, + I740_GetViewport, + I740_Sync, + I740_FillRect, + I740_BlitRect, +#if 0 + I740_BlitTransRect +#else + NULL +#endif +}; + +Bool I740DGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I740Ptr pI740 = I740PTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0; + + pMode = firstMode = pScrn->modes; + + while(pMode) { + + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + + if(!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + + currentMode = modes + num; + num++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + if(pI740->AccelInfoRec) + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if(pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if(pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = (Bpp == 3) ? 2 : 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pI740->FbBase; + + currentMode->bytesPerScanline = + ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pI740->FbMemBox.x2; + currentMode->imageHeight = pI740->FbMemBox.y2; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + pMode = pMode->next; + if(pMode == firstMode) + break; + } + + pI740->numDGAModes = num; + pI740->DGAModes = modes; + + return DGAInit(pScreen, &I740DGAFuncs, modes, num); +} + +static DisplayModePtr I740SavedDGAModes[MAXSCREENS]; + +static Bool I740_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) +{ + int index = pScrn->pScreen->myNum; + I740Ptr pI740 = I740PTR(pScrn); + + if(!pMode) { /* restore the original mode */ + if(pI740->DGAactive) { + pScrn->currentMode = I740SavedDGAModes[index]; + I740SwitchMode(index, pScrn->currentMode, 0); + I740AdjustFrame(index, 0, 0, 0); + pI740->DGAactive = FALSE; + } + } else { + if(!pI740->DGAactive) { + I740SavedDGAModes[index] = pScrn->currentMode; + pI740->DGAactive = TRUE; + } + + I740SwitchMode(index, pMode->mode, 0); + } + + return TRUE; +} + +static int I740_GetViewport(ScrnInfoPtr pScrn) +{ + I740Ptr pI740 = I740PTR(pScrn); + + return pI740->DGAViewportStatus; +} + +static void I740_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ + I740Ptr pI740 = I740PTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + + I740AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + + /* wait for retrace */ + while((hwp->readST01(hwp) & 0x08)); + while(!(hwp->readST01(hwp) & 0x08)); + + pI740->DGAViewportStatus = 0; +} + +static void I740_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) +{ + I740Ptr pI740 = I740PTR(pScrn); + + if(pI740->AccelInfoRec) { + (*pI740->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); + (*pI740->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); + SET_SYNC_FLAG(pI740->AccelInfoRec); + } +} + +static void I740_Sync(ScrnInfoPtr pScrn) +{ + I740Ptr pI740 = I740PTR(pScrn); + + if(pI740->AccelInfoRec) { + (*pI740->AccelInfoRec->Sync)(pScrn); + } +} + +static void I740_BlitRect( + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, + int dstx, int dsty + ){ + I740Ptr pI740 = I740PTR(pScrn); + + if(pI740->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pI740->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pI740->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, h); + SET_SYNC_FLAG(pI740->AccelInfoRec); + } +} + +#if 0 +static void I740_BlitTransRect(ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, + int dstx, int dsty, + unsigned long color + ) +{ + /* this one should be separate since the XAA function would + prohibit usage of ~0 as the key */ +} +#endif + +static Bool I740_OpenFramebuffer( + ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, + int *size, + int *offset, + int *flags + ){ + I740Ptr pI740 = I740PTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char*)pI740->LinearAddr; + *size = pI740->FbMapSize; + *offset = 0; + *flags = DGA_NEED_ROOT; + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.h:1.1 --- /dev/null Thu Feb 27 12:30:48 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.h Mon Oct 21 09:32:58 2002 @@ -0,0 +1,26 @@ +/* + * Copyright 2001 by Patrick LERDA + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Patrick LERDA not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Patrick LERDA makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * PATRICK LERDA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL PATRICK LERDA BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Patrick LERDA + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_dga.h,v 1.1 2002/10/21 13:32:58 alanh Exp $ */ + +Bool I740DGAInit(ScreenPtr pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.35 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.41 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.35 Fri Jan 4 16:22:31 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c Mon Feb 17 11:59:02 2003 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.35 2002/01/04 21:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.41 2003/02/17 16:59:02 dawes Exp $ */ /* * Authors: @@ -91,7 +91,6 @@ /* The driver's own header file: */ -#include "i740.h" #include "miscstruct.h" @@ -99,7 +98,10 @@ #include "Xv.h" #include "vbe.h" +#include "i740_dga.h" +#include "i740.h" + /* Required Functions: */ static const OptionInfoRec * I740AvailableOptions(int chipid, int busid); @@ -127,11 +129,6 @@ /* Change screensaver state */ static Bool I740SaveScreen(ScreenPtr pScreen, int mode); -/* Allow mode switching */ -static Bool I740SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -/* Allow moving the viewport */ -static void I740AdjustFrame(int scrnIndex, int x, int y, int flags); - /* Cleanup server private data */ static void I740FreeScreen(int scrnIndex, int flags); @@ -145,6 +142,10 @@ static void I740ProbeDDC(ScrnInfoPtr pScrn, int index); +static Bool I740MapMem(ScrnInfoPtr pScrn); +static Bool I740UnmapMem(ScrnInfoPtr pScrn); + + #define VERSION 4000 #define I740_NAME "I740" #define I740_DRIVER_NAME "i740" @@ -182,7 +183,8 @@ OPTION_SGRAM, OPTION_SLOW_RAM, OPTION_DAC_6BIT, - OPTION_USE_PIO + OPTION_USE_PIO, + OPTION_VGACOMPAT } I740Opts; static const OptionInfoRec I740Options[] = { @@ -193,40 +195,44 @@ { OPTION_SLOW_RAM, "SlowRam", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_USE_PIO, "UsePIO", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_VGACOMPAT, "VGACompat", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; static const char *vgahwSymbols[] = { - "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWGetIOBase", - "vgaHWGetIndex", - "vgaHWHBlankKGA", + "vgaHWSave", /* Added */ + "vgaHWRestore", /* Added */ + "vgaHWProtect", "vgaHWInit", - "vgaHWLock", "vgaHWMapMem", - "vgaHWProtect", - "vgaHWRestore", - "vgaHWSave", - "vgaHWSaveScreen", "vgaHWSetMmioFuncs", + "vgaHWGetIOBase", + "vgaHWLock", "vgaHWUnlock", - "vgaHWUnmapMem", - "vgaHWVBlankKGA", + "vgaHWFreeHWRec", + "vgaHWSaveScreen", + "vgaHWHandleColormaps", 0 }; -static const char *cfbSymbols[] = { +static const char *fbSymbols[] = { +#ifdef USE_FB + "fbScreenInit", + "fbPictureInit", +#else "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", "cfb32ScreenInit", +#endif + "cfb8_32ScreenInit", + "cfb24_32ScreenInit", NULL }; -static const char *fbSymbols[] = { - "fbScreenInit", - "fbPictureInit", +static const char *xf8_32bppSymbols[] = { + "xf86Overlay8Plus32Init", NULL }; @@ -234,23 +240,40 @@ "XAADestroyInfoRec", "XAACreateInfoRec", "XAAInit", + "XAAStippleScanlineFuncLSBFirst", + "XAAOverlayFBfuncs", + "XAACachePlanarMonoStipple", + "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { + "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", - "xf86InitCursor", NULL }; static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", - "vbeFree", NULL }; +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86DoEDID_DDC1", + "xf86DoEDID_DDC2", + NULL +}; + +static const char *i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", + NULL +}; + + #ifdef XFree86LOADER static MODULESETUPPROTO(i740Setup); @@ -292,8 +315,9 @@ * might refer to. */ LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, - cfbSymbols, ramdacSymbols, vbeSymbols, - NULL); + xf8_32bppSymbols, ramdacSymbols, vbeSymbols, + ddcSymbols, i2cSymbols, NULL /* shadowSymbols */, + NULL /* fbdevsymbols */, NULL); /* * The return value must be non-NULL on success even though there @@ -489,6 +513,7 @@ pI740->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (pI740->pEnt->location.type != BUS_PCI) return FALSE; + /*I740ProbeDDC(pScrn, pI740->pEnt->index);*/ if (flags & PROBE_DETECT) { I740ProbeDDC(pScrn, pI740->pEnt->index); return TRUE; @@ -516,12 +541,14 @@ /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; + flags24=Support24bppFb | Support32bppFb | SupportConvert32to24; if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) { return FALSE; } else { switch (pScrn->depth) { case 8: + case 15: case 16: case 24: break; @@ -532,27 +559,8 @@ return FALSE; } } - xf86PrintDepthBpp(pScrn); - - /* Process the options */ - xf86CollectOptions(pScrn, NULL); - if (!(pI740->Options = xalloc(sizeof(I740Options)))) - return FALSE; - memcpy(pI740->Options, I740Options, sizeof(I740Options)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI740->Options); + /*xf86PrintDepthBpp(pScrn);*/ - /* 6-BIT dac isn't reasonable for modes with > 8bpp */ - if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE) && - pScrn->bitsPerPixel>8) { - OptionInfoPtr ptr; - ptr=xf86TokenToOptinfo(pI740->Options, OPTION_DAC_6BIT); - ptr->found=FALSE; - } - - - pScrn->rgbBits=8; - if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE)) - pScrn->rgbBits=6; if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; @@ -568,12 +576,32 @@ } } - /* We use a programmable clock */ + /* We use a programamble clock */ pScrn->progClock = TRUE; hwp = VGAHWPTR(pScrn); pI740->cpp = pScrn->bitsPerPixel/8; + /* Process the options */ + xf86CollectOptions(pScrn, NULL); + if (!(pI740->Options = xalloc(sizeof(I740Options)))) + return FALSE; + memcpy(pI740->Options, I740Options, sizeof(I740Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI740->Options); + + /* 6-BIT dac isn't reasonable for modes with > 8bpp */ + if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE) && + pScrn->bitsPerPixel>8) { + OptionInfoPtr ptr; + ptr=xf86TokenToOptinfo(pI740->Options, OPTION_DAC_6BIT); + ptr->found=FALSE; + } + + if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE)) + pScrn->rgbBits=8; + else + pScrn->rgbBits=6; + /* We have to use PIO to probe, because we haven't mappend yet */ I740SetPIOAccess(pI740); @@ -615,7 +643,7 @@ } } xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", - (unsigned long)pI740->LinearAddr); + pI740->LinearAddr); if (pI740->pEnt->device->IOBase != 0) { pI740->MMIOAddr = pI740->pEnt->device->IOBase; @@ -632,7 +660,7 @@ } } xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n", - (unsigned long)pI740->MMIOAddr); + pI740->MMIOAddr); /* Calculate memory */ if (pI740->pEnt->device->videoRam) { @@ -673,7 +701,7 @@ } } - xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte %s\n", + xf86DrvMsg(pScrn->scrnIndex, from, "Steve was here! VideoRAM: %d kByte %s\n", pScrn->videoRam, (pI740->HasSGRAM)?"SGRAM":"SDRAM"); pI740->FbMapSize = pScrn->videoRam*1024; @@ -732,8 +760,8 @@ clockRanges->minClock= 12000; /* !!! What's the min clock? !!! */ clockRanges->maxClock=pI740->MaxClock; clockRanges->clockIndex = -1; - clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = FALSE; + clockRanges->interlaceAllowed = FALSE; /*PL*/ + clockRanges->doubleScanAllowed = TRUE; /*PL*/ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, @@ -768,7 +796,7 @@ I740FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(fbSymbols, NULL); + xf86LoaderReqSymbols("fbScreenInit","fbPictureInit", NULL); #else switch (pScrn->bitsPerPixel) { case 8: @@ -800,7 +828,6 @@ I740FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(xaaSymbols, NULL); } if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) { @@ -829,11 +856,61 @@ pI740->usePIO=TRUE; } + if(xf86IsOptionSet(pI740->Options, OPTION_VGACOMPAT)) + pI740->usevgacompat=TRUE; + else + pI740->usevgacompat=FALSE; + + +#if 0 /*DDC2*/ + { /*PL*/ + + if (xf86LoadSubModule(pScrn, "ddc")) { + xf86LoaderReqSymLists(ddcSymbols, NULL); + if ( xf86LoadSubModule(pScrn, "i2c") ) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + + if (I740MapMem(pScrn)) + { + if (I740_I2CInit(pScrn)) + { + xf86MonPtr MonInfo; + + if ((MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex,pI740->rc_i2c))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", + MonInfo); + xf86PrintEDID( MonInfo ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor " + "info\n\n"); + xf86SetDDCproperties(pScrn,MonInfo); + } + + //xf86SetDDCproperties(pScrn,xf86PrintEDID( xf86DoEDID_DDC2(pScrn->scrnIndex,pI740->rc_i2c))); + } + else + xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"I2C initialization failed\n"); + + I740UnmapMem(pScrn); + } + } + } + } +#endif /*DDC2*/ + + { /* Overlay */ + pI740->colorKey = (1 << pScrn->offset.red) | (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + + pI740->colorKey &= ((1 << pScrn->depth) - 1); + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video overlay key set to 0x%x\n", pI740->colorKey); + } + + return TRUE; } -static Bool -I740MapMem(ScrnInfoPtr pScrn) +static Bool I740MapMem(ScrnInfoPtr pScrn) { int mmioFlags; I740Ptr pI740; @@ -857,8 +934,7 @@ return TRUE; } -static Bool -I740UnmapMem(ScrnInfoPtr pScrn) +static Bool I740UnmapMem(ScrnInfoPtr pScrn) { I740Ptr pI740; @@ -1310,7 +1386,7 @@ else i740Reg->PixelPipeCfg0 = DAC_8_BIT; - i740Reg->PixelPipeCfg2 = DISPLAY_GAMMA_ENABLE | OVERLAY_GAMMA_ENABLE; + i740Reg->PixelPipeCfg2 = DISPLAY_GAMMA_ENABLE /*| OVERLAY_GAMMA_ENABLE*/; /* Turn on Extended VGA Interpretation */ i740Reg->IOControl = EXTENDED_CRTC_CNTL; @@ -1367,20 +1443,36 @@ /* Calculate the FIFO Watermark and Burst Length. */ i740Reg->LMI_FIFO_Watermark = I740CalcFIFO(pScrn, dclk); + /*-Overlay-*/ + pI740->ov_offset_x=((mode->CrtcHTotal-mode->CrtcHDisplay) & ~7)-9; + pI740->ov_offset_y=mode->CrtcVTotal-mode->CrtcVSyncEnd-2; + /*-*/ + return TRUE; } static Bool -I740ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +I740ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode_src) { vgaHWPtr hwp; I740Ptr pI740; + struct _DisplayModeRec mode_dst; + DisplayModePtr mode=&mode_dst; + + *mode=*mode_src; hwp = VGAHWPTR(pScrn); pI740 = I740PTR(pScrn); vgaHWUnlock(hwp); + + if(pI740->usevgacompat) + { /* Try to get the same visual aspect as a S3 board */ + mode->CrtcHSyncStart+=16; + mode->CrtcHSyncEnd +=16; + } + if (!vgaHWInit(pScrn, mode)) return FALSE; pScrn->vtSema = TRUE; @@ -1392,9 +1484,8 @@ return TRUE; } -static void -I740LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - VisualPtr pVisual) { +static void I740LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) +{ I740Ptr pI740; vgaHWPtr hwp; int i, index; @@ -1402,6 +1493,36 @@ pI740 = I740PTR(pScrn); hwp = VGAHWPTR(pScrn); + + for (i=0; i<numColors; i++) + { + index=indices[i/2]; + r=colors[index].red; + b=colors[index].blue; + g=colors[index].green; + + hwp->writeDacWriteAddr(hwp, index<<2); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + + i++; + hwp->writeDacWriteAddr(hwp, index<<2); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + } +} + +static void I740LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) +{ + I740Ptr pI740; + vgaHWPtr hwp; + int i, index; + unsigned char r, g, b; + + pI740 = I740PTR(pScrn); + hwp = VGAHWPTR(pScrn); for (i=0; i<numColors; i++) { index=indices[i/2]; r=colors[index].red; @@ -1451,14 +1572,13 @@ vgaHWPtr hwp; I740Ptr pI740; VisualPtr visual; - BoxRec MemBox; pScrn = xf86Screens[pScreen->myNum]; pI740 = I740PTR(pScrn); hwp = VGAHWPTR(pScrn); if (!I740MapMem(pScrn)) return FALSE; - pScrn->memPhysBase = (unsigned long)pI740->FbBase; + pScrn->memPhysBase = pI740->LinearAddr; pScrn->fbOffset = 0; if (!pI740->usePIO) @@ -1529,6 +1649,9 @@ pScrn->bitsPerPixel); return FALSE; } +#ifdef USE_FB + fbPictureInit(pScreen,0,0); +#endif xf86SetBlackWhitePixels(pScreen); @@ -1546,10 +1669,6 @@ } } -#ifdef USE_FB - /* must be after RGB ordering set */ - fbPictureInit(pScreen,0,0); -#endif miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); @@ -1558,19 +1677,28 @@ if (!miCreateDefColormap(pScreen)) return FALSE; - if (pScrn->bitsPerPixel==16) { - if (!xf86HandleColormaps(pScreen, 256, 8, I740LoadPalette16, 0, - CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; - } else { - if (!xf86HandleColormaps(pScreen, 256, 8, I740LoadPalette24, 0, - CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; - } + if (pScrn->bitsPerPixel==16) + { + if (pScrn->weight.green == 5) + { + if (!xf86HandleColormaps(pScreen, 256, 8, I740LoadPalette15, 0, CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + } + else + { + if (!xf86HandleColormaps(pScreen, 256, 8, I740LoadPalette16, 0, CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + } + } + else + { + if (!xf86HandleColormaps(pScreen, 256, 8, I740LoadPalette24, 0, CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + } xf86DPMSInit(pScreen, I740DisplayPowerManagementSet, 0); -#ifdef XvExtension +#if 0 /*def XvExtension*/ { XF86VideoAdaptorPtr *ptr; int n; @@ -1581,13 +1709,16 @@ } } #endif + + memset(&(pI740->FbMemBox), 0, sizeof(BoxRec)); + pI740->FbMemBox.x1=0; + pI740->FbMemBox.x2=pScrn->displayWidth; + pI740->FbMemBox.y1=0; + pI740->FbMemBox.y2=pI740->FbMapSize/(pScrn->displayWidth*pI740->cpp); - MemBox.x1=0; - MemBox.x2=pScrn->displayWidth; - MemBox.y1=0; - MemBox.y2=pI740->FbMapSize/(pScrn->displayWidth*pI740->cpp); + I740DGAInit(pScreen); - if (!xf86InitFBManager(pScreen, &MemBox)) { + if (!xf86InitFBManager(pScreen, &pI740->FbMemBox)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n"); return FALSE; } @@ -1613,10 +1744,16 @@ if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); +#ifdef XvExtension + { /* Overlay */ + I740InitVideo(pScreen); pI740->OverlayStart = pI740->CursorStart + 1024; + } +#endif /*XvExtension*/ + return TRUE; } -static Bool +Bool I740SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn; @@ -1624,7 +1761,7 @@ return I740ModeInit(pScrn, mode); } -static void +void I740AdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn; I740Ptr pI740; Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_i2c.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i740/i740_i2c.c:1.1 --- /dev/null Thu Feb 27 12:30:48 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_i2c.c Mon Oct 21 09:32:58 2002 @@ -0,0 +1,105 @@ +/* + * Copyright 2001 by Patrick LERDA + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Patrick LERDA not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Patrick LERDA makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * PATRICK LERDA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL PATRICK LERDA BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Patrick LERDA + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_i2c.c,v 1.1 2002/10/21 13:32:58 alanh Exp $ */ + +/* not working at this time */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "compiler.h" + +#include "xf86Pci.h" +#include "xf86PciInfo.h" + +#include "vgaHW.h" + +#include "xf86xv.h" +#include "i740.h" + + +static void i740_I2CPutBits(I2CBusPtr b, int clk, int dat) +{ + I740Ptr pI740=I740PTR(xf86Screens[b->scrnIndex]); + unsigned char val; + + val=pI740->readControl(pI740, XRX, 0x1C); + + if(clk) val&=~0x40; else val|=0x40; if(dat) val&=~0x08; else val|=0x08; + + /*if ( clk && dat) val&=0xBF; else if( clk && !dat) val&=0xF7; else if(!clk && dat) val|=0x40; else val|=0x08;*/ + + val|=0x90; + + pI740->writeControl(pI740, XRX, 0x1C, val); + + ErrorF("i740_I2CPutBits: clk=%d dat=%d [<1c>=0x%02x] [<63>=0x%02x] clk=%d dat=%d\n", clk, dat,val,pI740->readControl(pI740, XRX, 0x63), + !!(pI740->readControl(pI740, XRX, 0x63) & 0x02), !!(pI740->readControl(pI740, XRX, 0x63) & 0x01) ); +} + +static void i740_I2CGetBits(I2CBusPtr b, int *clk, int *dat) +{ + I740Ptr pI740=I740PTR(xf86Screens[b->scrnIndex]); + unsigned char val; + + { + val=pI740->readControl(pI740, XRX, 0x1C); + val|=0x90; + pI740->writeControl(pI740, XRX, 0x1C, val); + } + + { + val=pI740->readControl(pI740, XRX, 0x63); + *clk=!!(val & 0x02); + *dat=!!(val & 0x01); + } + + ErrorF("i740_I2CGetBits: clk=%d dat=%d [<1c>=0x%02x] [<63>=0x%02x]\n", *clk, *dat,pI740->readControl(pI740, XRX, 0x1c) & 0xff,pI740->readControl(pI740, XRX, 0x63)); +} + +Bool I740_I2CInit(ScrnInfoPtr pScrn) +{ + I740Ptr pI740=I740PTR(pScrn); + I2CBusPtr I2CPtr; + + { unsigned char val; val=pI740->readControl(pI740, XRX, 0x63); val&=0xFC; pI740->writeControl(pI740, XRX, 0x63, val); } + { unsigned char val; val=pI740->readControl(pI740, XRX, 0x1C); val|=0x90; pI740->writeControl(pI740, XRX, 0x1C, val); } + { unsigned char val; val=pI740->readControl(pI740, XRX, 0x63); val&=0xFC; pI740->writeControl(pI740, XRX, 0x63, val); } + + + I2CPtr = xf86CreateI2CBusRec(); + if(!I2CPtr) return FALSE; + + pI740->rc_i2c = I2CPtr; + + I2CPtr->BusName = "I2C bus"; + I2CPtr->scrnIndex = pScrn->scrnIndex; + I2CPtr->I2CPutBits = i740_I2CPutBits; + I2CPtr->I2CGetBits = i740_I2CGetBits; + + if (!xf86I2CBusInit(I2CPtr)) + return FALSE; + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c:1.3 Tue Feb 22 23:47:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c Mon Oct 21 09:32:58 2002 @@ -24,7 +24,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c,v 1.3 2000/02/23 04:47:14 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c,v 1.5 2002/10/21 13:32:58 alanh Exp $ */ /* * Authors: @@ -36,7 +36,9 @@ #include "xf86_ansic.h" #include "xf86_OSproc.h" #include "compiler.h" +#include "vgaHW.h" +#include "xf86xv.h" #include "i740.h" static void I740WriteControlPIO(I740Ptr pI740, int addr, unsigned char index, char val) { Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h:1.2 Tue Feb 22 23:47:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h Mon Oct 21 09:32:58 2002 @@ -25,13 +25,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h,v 1.2 2000/02/23 04:47:14 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_macros.h,v 1.4 2002/10/21 13:32:58 alanh Exp $ */ /* * Authors: * Kevin E. Martin <kevin@precisioninsight.com> * */ + +#include "xf86fbman.h" + #define WAIT_ENGINE_IDLE_PIO() { \ outb(XRX, BITBLT_CNTL); \ Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i740/i740_video.c:1.3 --- /dev/null Thu Feb 27 12:30:48 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_video.c Fri Jan 17 17:22:52 2003 @@ -0,0 +1,1323 @@ +/* + * Copyright 2001 by Patrick LERDA + * Portions Copyright by Stephen Blackheath + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Patrick LERDA not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Patrick LERDA makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * PATRICK LERDA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL PATRICK LERDA BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Patrick LERDA + * with modifications by Stephen Blackheath (Aug 2002) + * + * REVISION HISTORY: + * December 2001 - Patrick LERDA's original (http://sourceforge.net/projects/i740fb). + * 27 August 2002 - Patrick's version would run for an hour or two on my machine, + * then the screen would go blank (no signal to monitor) and for some reason I + * sometimes couldn't even log in through the network. I had to re-boot my machine. + * This version fixes that and makes a few other unnecessary tweaks. I am not + * certain, but I think the problem is that Patrick's code was reading a value from + * XRX register 0xD0, and or'ing with 0x10. When I removed this from the main + * loop, it became reliable. I suspect the hardware (whether just my cheap + * clone board only I'm not sure) was sometimes returning bogus values, which were + * then programmed back in - but I never checked this. This register is related to + * powering on or off certain subsystems of the i740 chip, so that might explain + * the blank screen. - Stephen Blackheath + * 3 September 2002 - Added software scaling in the situation where the screen size is + * smaller than the original video size, since scaling down is not supported by + * the hardware. The implementation of this is not quite complete. + * 12 September 2002 - Better software scaling with some averaging, giving a nicer + * picture. + * 13 January 2003 - Fixed a minor bug where the video would occasionally stop updating, + * which was worked around just by re-sizing the window. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_video.c,v 1.3 2003/01/17 22:22:52 tsi Exp $ */ + +/* + * i740_video.c: i740 Xv driver. Based on the mga Xv driver by Mark Vojkovich. + */ + +#ifdef XvExtension +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +#include "vgaHW.h" +#include "i740.h" + + +#define FOURCC_RV15 0x35315652 +#define FOURCC_RV16 0x36315652 + +/*-*/ +#define i740_wc(fb,z,r,v) (pI740->writeControl(pI740,(z),(r),(v))) +#define i740_rc(fb,z,r) (pI740->readControl(pI740,(z),(r))) +/*-*/ + +#define OFF_DELAY 250 /* milliseconds */ +#define FREE_DELAY 15000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + + + + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey; + + + +#define IMAGE_MAX_PHY_WIDTH 1024 /*720*/ +#define IMAGE_MAX_PHY_HEIGHT 1024 /*576*/ + + +#define IMAGE_MAX_LOG_WIDTH 1024 /*720*/ +#define IMAGE_MAX_LOG_HEIGHT 1024 /*576*/ + + +typedef struct { + CARD32 YBuf0offset; + CARD32 YBuf1offset; + + unsigned char currentBuf; + + int brightness; + int contrast; + + RegionRec clip; + CARD32 colorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; + FBLinearPtr linear; + +} I740PortPrivRec, *I740PortPrivPtr; + +typedef struct { + CARD32 OBUF_0Y; + CARD32 OBUF_1Y; + CARD32 OBUF_0U; + CARD32 OBUF_0V; + CARD32 OBUF_1U; + CARD32 OBUF_1V; + CARD32 OV0STRIDE; + CARD32 YRGB_VPH; + CARD32 UV_VPH; + CARD32 HORZ_PH; + CARD32 INIT_PH; + CARD32 DWINPOS; + CARD32 DWINSZ; + CARD32 SWID; + CARD32 SWIDQW; + CARD32 SHEIGHT; + CARD32 YRGBSCALE; + CARD32 UVSCALE; + CARD32 OV0CLRC0; + CARD32 OV0CLRC1; + CARD32 DCLRKV; + CARD32 DCLRKM; + CARD32 SCLRKVH; + CARD32 SCLRKVL; + CARD32 SCLRKM; + CARD32 OV0CONF; + CARD32 OV0CMD; +} I740OverlayRegRec, *I740OverlayRegPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (I740PortPrivPtr)((I740PTR(pScrn))->adaptor->pPortPrivates[0].ptr) + + +/*-----------------------------------------------------------------------------------------*/ +__inline__ static void i740fb_overlay_off(ScrnInfoPtr pScrn) +{ + I740Ptr pI740 = I740PTR(pScrn); + + /* 0x3C = COL_KEY_CNTL_1 */ + i740_wc(fb_p, MRX, 0x3C, (i740_rc(fb_p, MRX, 0x3C) | 0x02)); + usleep(50000); + /*i740_wc(fb_p, XRX, 0xD0, (i740_rc(fb_p, XRX, 0xD0) & ~0x10)); + usleep(50000);*/ + i740_wc(fb_p, XRX, 0xD0, 0x2F); +} + +__inline__ static void i740fb_overlay_set(ScrnInfoPtr pScrn, I740PortPrivPtr pPriv, unsigned long mem1,unsigned long mem2, + unsigned long isrc_w,unsigned long isrc_h, /* source image size */ + unsigned long idst_w,unsigned long idst_h, /* destination image size */ + unsigned long ddst_x,unsigned long ddst_y, /* destination image pos to display */ + unsigned long ddst_w,unsigned long ddst_h, /* destination image size to display allows trunc... */ + unsigned long pitch,int flip, + unsigned char vd_mod) +{ + I740Ptr pI740 = I740PTR(pScrn); + const int f_dbl=pScrn->currentMode->Flags & V_DBLSCAN; + + if(f_dbl) { idst_h*=2; ddst_y*=2; ddst_h*=2; } + + ddst_x+=pI740->ov_offset_x; + ddst_y+=pI740->ov_offset_y; + + /* Program the i740 overlay to use the new image dimensions. */ + + i740_wc(fb_p, MRX, 0x24, mem1>>16); + i740_wc(fb_p, MRX, 0x23, mem1>> 8); + i740_wc(fb_p, MRX, 0x22, mem1>> 0); + + i740_wc(fb_p, MRX, 0x27, mem2>>16); + i740_wc(fb_p, MRX, 0x26, mem2>> 8); + i740_wc(fb_p, MRX, 0x25, mem2>> 0); + + i740_wc(fb_p, MRX, 0x28, (( pitch >>3)-1) ); + + { unsigned short v=ddst_x; i740_wc(fb_p, MRX, 0x2B, v>> 8); i740_wc(fb_p, MRX, 0x2A, v>> 0); } + { unsigned short v=ddst_x+ddst_w-1; i740_wc(fb_p, MRX, 0x2D, v>> 8); i740_wc(fb_p, MRX, 0x2C, v>> 0); } + { unsigned short v=ddst_y; i740_wc(fb_p, MRX, 0x2F, v>> 8); i740_wc(fb_p, MRX, 0x2E, v>> 0); } + { unsigned short v=ddst_y+ddst_h-1; i740_wc(fb_p, MRX, 0x31, v>> 8); i740_wc(fb_p, MRX, 0x30, v>> 0); } + + i740_wc(fb_p, MRX, 0x32, (isrc_w<<8)/(idst_w)); + i740_wc(fb_p, MRX, 0x33, (isrc_h<<8)/(idst_h)); + + i740_wc(fb_p, MRX, 0x50, 0); + i740_wc(fb_p, MRX, 0x51, 0); + + i740_wc(fb_p, MRX, 0x1E, ( idst_w > isrc_w ? 0x04 : 0x00 ) | ( idst_h > isrc_h ? 0x08 : 0x00 )); + i740_wc(fb_p, MRX, 0x1F, ( idst_w > isrc_w ? 0x20 : 0x00 ) | ( (idst_h > isrc_h) && (pitch <= 720*2) ? 0xC0 : 0x00 ) | (vd_mod & 0x1F)); + + /*i740_wc(fb_p, MRX, 0x20, 0);*/ + + i740_wc(fb_p, MRX, 0x19, 0x00); + + /*i740_wc(fb_p, XRX, 0xD0, i740_rc(fb_p, XRX, 0xD0) | 0x10 );*/ + i740_wc(fb_p, XRX, 0xD0, 0x3F); + /* 0x3C = COL_KEY_CNTL_1 */ + i740_wc(fb_p, MRX, 0x3C, 0x05 | 0x02); + + /*i740_wc(fb_p, MRX, 0x20, (flip ? 0x14 : 0x04));*/ + /*i740_wc(fb_p, MRX, 0x20, 0);*/ + /*i740_wc(fb_p, XRX, 0xD0, i740_rc(fb_p, XRX, 0xD0) | 0x10 );*/ + /*i740_wc(fb_p, MRX, 0x19, 0x00);*/ + i740_wc(fb_p, MRX, 0x20, (flip ? 0x34 : 0x24)); /*SB*/ +} + +__inline__ static void i740fb_colorkey(ScrnInfoPtr pScrn,unsigned long key) +{ + I740Ptr pI740 = I740PTR(pScrn); + unsigned char r,g,b,rm,gm,bm; + + /*//xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,"colorkey=%04x depth=%d\n",key,pScrn->depth);*/ + + switch(pScrn->depth) + { + case 4: r=0x00; g=0x00; b=key; rm=0xFF; gm=0xFF; bm=0xF0; break; + case 8: r=0x00; g=0x00; b=key; rm=0xFF; gm=0xFF; bm=0x00; break; + case 15: r=(key&0x7C00)>>7; g=(key&0x03E0)>>2; b=(key&0x001F)<<3; rm=0x07; gm=0x07; bm=0x07; break; + case 16: r=(key&0xF800)>>8; g=(key&0x07E0)>>3; b=(key&0x001F)<<3; rm=0x07; gm=0x03; bm=0x07; break; + default: /*24*/ r=(key&0xFF00)>>8; g=(key&0xFF00)>>3; b=(key&0xFF00)<<3; rm=0x00; gm=0x00; bm=0x00; break; + } + + i740_wc(fb_p, MRX, 0x3D, r); + i740_wc(fb_p, MRX, 0x3E, g); + i740_wc(fb_p, MRX, 0x3F, b); + + i740_wc(fb_p, MRX, 0x40, rm); + i740_wc(fb_p, MRX, 0x41, gm); + i740_wc(fb_p, MRX, 0x42, bm); +} + +/*-----------------------------------------------------------------------------------------*/ + + + +static void I740ResetVideo(ScrnInfoPtr pScrn) +{ + I740Ptr pI740 = I740PTR(pScrn); + I740PortPrivPtr pPriv = pI740->adaptor->pPortPrivates[0].ptr; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740ResetVideo entered\n"); /* ### */ + + /* + * Enable destination color keying + */ + + i740fb_colorkey(pScrn,pPriv->colorKey); +} + + + + +static Bool RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} + + +/* I740ClipVideo - + + Takes the dst box in standard X BoxRec form (top and left + edges inclusive, bottom and right exclusive). The new dst + box is returned. The source boundaries are given (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ + +static void I740ClipVideo( + BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + BoxPtr extents, /* extents of the clip region */ + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } +} + +static void I740StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + I740PortPrivPtr pPriv = (I740PortPrivPtr)data; + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740StopVideo entered %p %d\n", (void*)data, (int)exit);*/ /* ### */ + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(exit) + { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) + i740fb_overlay_off(pScrn); + + if(pPriv->linear) + { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } + else + { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) + { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } + +} + +static int I740SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data) +{ + I740PortPrivPtr pPriv = (I740PortPrivPtr)data; + I740Ptr pI740 = I740PTR(pScrn); + I740OverlayRegPtr overlay = (I740OverlayRegPtr) (pI740->FbBase + pI740->OverlayStart); + + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740SetPortAttribute entered %d\n", (int) value);*/ /* ### */ + + if(attribute == xvBrightness) + { + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + overlay->OV0CLRC0 = (pPriv->contrast << 8) | (pPriv->brightness & 0xff); + /*//OVERLAY_UPDATE(pI740->OverlayPhysical);*/ + } + else + if(attribute == xvContrast) + { + if((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + overlay->OV0CLRC0 = (pPriv->contrast << 8) | (pPriv->brightness & 0xff); + /*//OVERLAY_UPDATE(pI740->OverlayPhysical);*/ + } + else + if(attribute == xvColorKey) + { + pPriv->colorKey = value; + + i740fb_colorkey(pScrn,pPriv->colorKey); + + /*//OVERLAY_UPDATE(pI740->OverlayPhysical);*/ + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } + else + return BadMatch; + + return Success; +} + +static int I740GetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + I740PortPrivPtr pPriv = (I740PortPrivPtr)data; + + if(attribute == xvBrightness) { + *value = pPriv->brightness; + } else + if(attribute == xvContrast) { + *value = pPriv->contrast; + } else + if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } else return BadMatch; + + return Success; +} + +static void I740QueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + if(vid_w > (drw_w << 1)) drw_w = vid_w >> 1; + if(vid_h > (drw_h << 1)) drw_h = vid_h >> 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740QueryBestSize entered %d %d %d %d\n", (int) vid_w, (int) vid_h, (int) drw_w, (int) drw_h); /* ### */ + fprintf(stderr, "fprintf - I740QueryBestSize entered %d %d %d %d\n", (int) vid_w, (int) vid_h, (int) drw_w, (int) drw_h); /* ### */ + + *p_w = drw_w; + *p_h = drw_h; +} + +static void I740CopyMungedData(ScrnInfoPtr pScrn, + unsigned char *src1, unsigned char *src2, unsigned char *src3, + int srcPitch, + int srcPitch2, + int dstPitch, + int h, + int w, + long scalex, + long scaley) +{ + I740Ptr pI740 = I740PTR(pScrn); + I740PortPrivPtr pPriv = pI740->adaptor->pPortPrivates[0].ptr; + CARD32 *dst; + int i, j; + + if (pPriv->currentBuf == 0) + dst = (CARD32 *)(pI740->FbBase + pPriv->YBuf0offset); + else + dst = (CARD32 *)(pI740->FbBase + pPriv->YBuf1offset); + + dstPitch >>= 2; + w >>= 1; + + /* If the space on the screen is smaller than the source image, then we use + * software scaling to make it smaller. */ + if (scalex > 0x10000 || scaley > 0x10000) { + int dsth = ((long) h * 0x10000L + scaley - 1) / scaley; + long halfx = scalex/2; + long dstj = 0; + for(j = 0; j < dsth; j++) { + int dstj_rnd = dstj >> 16; + unsigned char* src1_ = src1 + (dstj_rnd * srcPitch); + unsigned char* src2_ = src2 + ((dstj_rnd/2) * srcPitch2); + unsigned char* src3_ = src3 + ((dstj_rnd/2) * srcPitch2); + int dstw = ((long) w * 0x10000L + halfx - 1) / scalex; + long srci = 0; + for(i = 0; i < dstw; i++) { + long srci_rnd = srci >> 16; + long srci2_rnd = (srci + halfx) >> 16; + dst[i] = + (((src1_[srci_rnd << 1] | (src1_[(srci_rnd << 1) + 1] << 16) | + (src3_[srci_rnd] << 8) | (src2_[srci_rnd] << 24))) >> 1 & 0x7F7F7F7FL) + + + (((src1_[srci2_rnd << 1] | (src1_[(srci2_rnd << 1) + 1] << 16) | + (src3_[srci2_rnd] << 8) | (src2_[srci2_rnd] << 24))) >> 1 & 0x7F7F7F7FL); + srci += scalex; + } + dst += dstPitch; + dstj += scaley; + } + } + else { + for(j = 0; j < h; j++) { + for(i = 0; i < w; i++) { + dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | + (src3[i] << 8) | (src2[i] << 24); + } + dst += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } + } +} + + +__inline__ static void I740CopyPackedData(ScrnInfoPtr pScrn, + unsigned char *buf, + int srcPitch, + int dstPitch, + int top, + int left, + int h, + int w + ) +{ + I740Ptr pI740 = I740PTR(pScrn); + I740PortPrivPtr pPriv = pI740->adaptor->pPortPrivates[0].ptr; + unsigned char *src, *dst; + + src = buf + (top*srcPitch) + (left<<1); + + if (pPriv->currentBuf == 0) + dst = pI740->FbBase + pPriv->YBuf0offset; + else + dst = pI740->FbBase + pPriv->YBuf1offset; + + w <<= 1; + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + + +__inline__ static void I740DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height, + int dstPitch, /* of chroma for 4:2:0 */ + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, short drw_w, short drw_h, + unsigned char vd_mod + ) +{ + I740Ptr pI740 = I740PTR(pScrn); + I740PortPrivPtr pPriv = pI740->adaptor->pPortPrivates[0].ptr; + + i740fb_overlay_set(pScrn,pPriv,pPriv->YBuf0offset,pPriv->YBuf1offset, + src_w,src_h, /* source image size */ + drw_w,drw_h, /* destination image size */ + dstBox->x1,dstBox->y1, /* destination image pos to display */ + dstBox->x2 - dstBox->x1,dstBox->y2 - dstBox->y1, /* destination image size to display allows trunc... */ + dstPitch,(pPriv->currentBuf != 0), + vd_mod); + + i740fb_colorkey(pScrn,pPriv->colorKey); /* needed to reset properly the i740 board after switching from framebuffer */ +} + +static FBLinearPtr I740AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size) +{ + ScreenPtr pScreen; + FBLinearPtr new_linear; + + if(linear) + { + if(linear->size >= size) + return linear; + + if(xf86ResizeOffscreenLinear(linear, size)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory resized to %d - %p\n", (int) size, linear); /* ### */ + return linear; + } + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory free %p - %d < %d\n", linear, (int) linear->size, (int) size); /* ### */ + xf86FreeOffscreenLinear(linear); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); + + if(!new_linear) + { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, PRIORITY_EXTREME); + + if(max_size < size) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory can't purge %d < %d\n", (int) max_size, (int) size); /* ### */ + return NULL; + } + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory purged %d\n", (int) max_size); /* ### */ + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, + NULL, NULL, NULL); + } + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory allocated %d - %p\n", (int) size, new_linear); /* ### */ + + return new_linear; +} + +static int I740PutImage(ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data + ) +{ + I740Ptr pI740 = I740PTR(pScrn); + I740PortPrivPtr pPriv = (I740PortPrivPtr)data; + INT32 x1, x2, y1, y2; + int srcPitch, dstPitch, srcPitch2=0; + int top, left, npixels, nlines, size; + BoxRec dstBox; + int offset2=0, offset3=0; + + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740PutImage entered %d %d\n", (int) width, (int) height, id);*/ /* ### */ + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + I740ClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), width, height); + + if((x1 >= x2) || (y1 >= y2)) { + return Success; + } + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + switch(id) + { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + offset2 = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offset3 = (srcPitch2 * (height >> 1)) + offset2; + dstPitch = ((width << 1) + 15) & ~15; + size = dstPitch * height; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = (width << 1); + dstPitch = (srcPitch + 7) & ~7; + size = dstPitch * height; + break; + } + + { + FBLinearPtr new_linear = I740AllocateMemory(pScrn, pPriv->linear, size); + if (new_linear != pPriv->linear) { + pPriv->linear = new_linear; + } + } + if(!pPriv->linear) + return BadAlloc; + + /* fixup pointers */ + pPriv->YBuf0offset = pPriv->linear->offset*pI740->cpp; + pPriv->YBuf1offset = (pPriv->linear->offset*pI740->cpp) + size; + + +#if 0 /*???*/ + /* wait for the last rendered buffer to be flipped in */ + while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf); +#endif + + /* buffer swap */ + pPriv->currentBuf ^= 1; + + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + { + CARD32 tmp; + + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + offset2 += tmp; + offset3 += tmp; + + if(id == FOURCC_I420) + { + tmp = offset2; + offset2 = offset3; + offset3 = tmp; + } + + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + + /* If the screen image size is smaller than the video image size, then + * we use software scaling to make it smaller. The hardware takes care + * of scaling up - see i740fb_overlay_set. + */ + { + long scalex = 0x10000, scaley = 0x10000; + if (drw_w < src_w) + scalex = (0x10000L * (long) src_w) / (long) drw_w; + if (drw_h < src_h) + scaley = (0x10000L * (long) src_h) / (long) drw_h; + + I740CopyMungedData(pScrn, buf + (top * srcPitch) + left, + buf + offset2, buf + offset3, + srcPitch, srcPitch2, dstPitch, nlines, npixels, scalex, scaley); + } + } + break; + + case FOURCC_UYVY: case FOURCC_YUY2: default: + { + nlines = ((y2 + 0xffff) >> 16) - top; + /* Add software scaling as above. */ + I740CopyPackedData(pScrn, buf, srcPitch, dstPitch, top, left, nlines, + npixels); + } + break; + } + + /* update cliplist */ + if(!RegionsEqual(&pPriv->clip, clipBoxes)) + { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); + } + + { + unsigned char vd_mod; + + switch(id) + { + case FOURCC_RV15: vd_mod=0x09; break; + case FOURCC_RV16: vd_mod=0x08; break; + default: vd_mod=0x00; break; + } + + I740DisplayVideo(pScrn, id, width, height, dstPitch, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h, + vd_mod); + } + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + + +static int I740QueryImageAttributes(ScrnInfoPtr pScrn, int id, unsigned short *w, unsigned short *h, int *pitches, int *offsets ) +{ + int size,tmp; + + if(*w > IMAGE_MAX_PHY_WIDTH) *w = IMAGE_MAX_PHY_WIDTH; + if(*h > IMAGE_MAX_PHY_HEIGHT) *h = IMAGE_MAX_PHY_HEIGHT; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) + { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; +} + +static void I740BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + I740Ptr pI740 = I740PTR(pScrn); + I740PortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740BlockHandler entered\n"); */ /* ### */ + + pScreen->BlockHandler = pI740->BlockHandler; + + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + + pScreen->BlockHandler = I740BlockHandler; + + if(pPriv->videoStatus & TIMER_MASK) + { + UpdateCurrentTime(); + if(pPriv->videoStatus & OFF_TIMER) + { + if(pPriv->offTime < currentTime.milliseconds) + { + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740BlockHandler: OFF_TIMER expired\n");*/ /* ### */ + /* Turn off the overlay */ + i740fb_overlay_off(pScrn); + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } + else + { /* FREE_TIMER */ + if(pPriv->freeTime < currentTime.milliseconds) + { + if(pPriv->linear) + { + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740BlockHandler: FREE_TIMER expired\n");*/ /* ### */ + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } + } + } +} + + +/*************************************************************************** + * Offscreen Images + ***************************************************************************/ + +typedef struct { + FBLinearPtr linear; + Bool isOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int I740AllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + FBLinearPtr linear; + int pitch, size; + OffscreenPrivPtr pPriv; + I740Ptr pI740 = I740PTR(pScrn); + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateSurface entered %d %d\n", (int) w, (int) h); /* ### */ + + if((w > IMAGE_MAX_LOG_WIDTH) || (h > IMAGE_MAX_LOG_HEIGHT)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + size = pitch * h; + + if(!(linear = I740AllocateMemory(pScrn, NULL, size))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->pitches = xalloc(sizeof(int)))) { + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + + pPriv->linear = linear; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = linear->offset*pI740->cpp; + surface->devPrivate.ptr = (pointer)pPriv; + + /*//memset(pI740->FbBase + surface->offsets[0],0,size);*/ + + return Success; +} + +static int I740StopSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + { + /*//i740fb_overlay_off(pScrn);*/ + + pPriv->isOn = FALSE; + } + + return Success; +} + + +static int I740FreeSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + { + I740StopSurface(surface); + } + + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int I740GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value) +{ + return I740GetPortAttribute(pScrn, attribute, value, 0); +} + +static int I740SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value) +{ + return I740SetPortAttribute(pScrn, attribute, value, 0); +} + + +static int I740DisplaySurface(XF86SurfacePtr surface, short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + I740PortPrivPtr pI740Priv = GET_PORT_PRIVATE(pScrn); + + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740DisplaySurface entered\n"); /* ### */ + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,"I740DisplaySurface-----------------------------------\n");*/ + /*//fprintf(stderr, "I740DisplaySurface-----------------------------------\n");*/ + + + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + I740ClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(screenInfo.screens[0], clipBoxes), + surface->width, surface->height); + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + /* fixup pointers */ + pI740Priv->YBuf0offset = surface->offsets[0]; + pI740Priv->YBuf1offset = pI740Priv->YBuf0offset; + +#if 0 /*???*/ + /* wait for the last rendered buffer to be flipped in */ + while (((INREG(DOV0STA)&0x00100000)>>20) != pI740Priv->currentBuf) { + if(loops == 200000) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Overlay Lockup\n"); + break; + } + loops++; + } +#endif + + /* buffer swap */ + if (pI740Priv->currentBuf == 0) + pI740Priv->currentBuf = 1; + else + pI740Priv->currentBuf = 0; + + I740ResetVideo(pScrn); + + I740DisplayVideo(pScrn, surface->id, surface->width, surface->height, + surface->pitches[0], x1, y1, x2, y2, &dstBox, + src_w, src_h, drw_w, drw_h, + 0x00); + + XAAFillSolidRects(pScrn, pI740Priv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if(pI740Priv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, & pI740Priv->clip); + UpdateCurrentTime(); + pI740Priv->videoStatus = FREE_TIMER; + pI740Priv->freeTime = currentTime.milliseconds + FREE_DELAY; + pScrn->pScreen->BlockHandler = I740BlockHandler; + } + + return Success; +} + +/*-------------------------------------------------------------------------------------------*/ +#define NUM_IMAGES (sizeof(i740vid_Images)/sizeof(XF86ImageRec)) +static XF86ImageRec i740vid_Images[] = +{ + XVIMAGE_YUY2, + XVIMAGE_UYVY, + XVIMAGE_YV12, /* converted to YUV2 while copying */ + XVIMAGE_I420, /* converted to YUV2 while copying */ + { + FOURCC_RV15, + XvRGB, + LSBFirst, + {'R','V','1','5', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, + 15, 0x001F, 0x03E0, 0x7C00, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R','V','B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, + { + FOURCC_RV16, + XvRGB, + LSBFirst, + {'R','V','1','6', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, + 16, 0x001F, 0x07E0, 0xF800, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R','V','B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, +}; + +#define NUM_ATTRIBUTES (sizeof(i740vid_Attributes)/sizeof(XF86AttributeRec)) + +static XF86AttributeRec i740vid_Attributes[] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} +}; + + +static void I740InitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740InitOffscreenImages entered\n"); /* ### */ + } + + /* need to free this someplace */ + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + { + return; + } + + offscreenImages[0].image = &i740vid_Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = I740AllocateSurface; + offscreenImages[0].free_surface = I740FreeSurface; + offscreenImages[0].display = I740DisplaySurface; + offscreenImages[0].stop = I740StopSurface; + offscreenImages[0].setAttribute = I740SetSurfaceAttribute; + offscreenImages[0].getAttribute = I740GetSurfaceAttribute; + offscreenImages[0].max_width = IMAGE_MAX_LOG_WIDTH; + offscreenImages[0].max_height = IMAGE_MAX_LOG_HEIGHT; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = i740vid_Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + + + +static XF86VideoAdaptorPtr I740SetupImageVideo(ScreenPtr pScreen) +{ + /* client libraries expect an encoding */ + static XF86VideoEncodingRec DummyEncoding[1] = + { + { + 0, + "XV_IMAGE", + IMAGE_MAX_PHY_WIDTH, IMAGE_MAX_PHY_HEIGHT, + {1, 1} + } + }; + +#define NUM_FORMATS (sizeof(i740vid_Formats)/sizeof(XF86VideoFormatRec)) + static XF86VideoFormatRec i740vid_Formats[] = + { + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, {8, PseudoColor} + }; + + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I740Ptr pI740 = I740PTR(pScrn); + XF86VideoAdaptorPtr adapt; + I740PortPrivPtr pPriv; + + /*xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740SetupImageVideo entered\n");*/ /* ### */ + { + const int n=sizeof(XF86VideoAdaptorRec)+sizeof(I740PortPrivRec)+sizeof(DevUnion); + + if(!(adapt = xcalloc(1, n))) + return NULL; + + /*//memset(adapt,0,n);*/ + } + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "I740 Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = i740vid_Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPriv = (I740PortPrivPtr)((unsigned char *)(&adapt[1])+sizeof(sizeof(DevUnion))); + + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = i740vid_Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = i740vid_Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = I740StopVideo; + adapt->SetPortAttribute = I740SetPortAttribute; + adapt->GetPortAttribute = I740GetPortAttribute; + adapt->QueryBestSize = I740QueryBestSize; + adapt->PutImage = I740PutImage; + adapt->QueryImageAttributes = I740QueryImageAttributes; + + pPriv->colorKey = pI740->colorKey & ((1 << pScrn->depth) - 1); + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 64; + pPriv->linear = NULL; + pPriv->currentBuf = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pI740->adaptor = adapt; + + pI740->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = I740BlockHandler; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + I740ResetVideo(pScrn); + + return adapt; +} + +void I740InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr newAdaptor = NULL; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740InitVideo entered\n"); /* ### */ + +#if 0 /*disable!*/ + { + XF86VideoAdaptorPtr *ptr; + int n; + + n = xf86XVListGenericAdaptors(pScrn,&ptr); + if (n) { + xf86XVScreenInit(pScreen, ptr, n); + } + + return; + } +#endif + + { + newAdaptor = I740SetupImageVideo(pScreen); + I740InitOffscreenImages(pScreen); + } + + { + XF86VideoAdaptorPtr *adaptors_oldptrs, *adaptors_newptrs = NULL; + int num_adaptors; + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors_oldptrs); + + if(newAdaptor) + { + if(!num_adaptors) + { + xf86XVScreenInit(pScreen, &newAdaptor, 1); + } + else + { + if((adaptors_newptrs = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr)))) + { + memcpy(adaptors_newptrs, adaptors_oldptrs, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + adaptors_newptrs[num_adaptors] = newAdaptor; + + /*//xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,"num--- %d [%d] %08x %08x\n",num_adaptors,num_adaptors * sizeof(XF86VideoAdaptorPtr),*/ + /*// adaptors_newptrs[0],adaptors_newptrs[1]);*/ + + + xf86XVScreenInit(pScreen, adaptors_newptrs, num_adaptors+1); + xfree(adaptors_newptrs); + } + } + } + + } +} +#endif /*XvExtension*/ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.18 xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.18 Thu Oct 4 14:28:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile Mon Feb 17 12:06:42 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.18 2001/10/04 18:28:21 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.25 2003/02/17 17:06:42 dawes Exp $ XCOMM XCOMM This is the Imakefile for the i810 driver. XCOMM @@ -6,21 +6,59 @@ #define IHaveModules #include <Server.tmpl> +#ifndef I830Only +#define I830Only NO +#endif + +#define I830XvSupport YES + +#ifndef I830XvSupport +#define I830XvSupport NO +#endif + #if BuildXF86DRI -DRISRCS = i810_dri.c i810_hwmc.c i830_dri.c -DRIOBJS = i810_dri.o i810_hwmc.o i830_dri.o +#if !I830Only +I810DRISRCS = i810_dri.c i810_hwmc.c +I810DRIOBJS = i810_dri.o i810_hwmc.o +#endif +I830DRISRCS = i830_dri.c +I830DRIOBJS = i830_dri.o +DRISRCS = $(I810DRISRCS) $(I830DRISRCS) +DRIOBJS = $(I810DRIOBJS) $(I830DRIOBJS) DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \ -I$(XF86OSSRC)/linux/drm/kernel -I$(TOP)/include DRIDEFINES = $(GLX_DEFINES) #endif + +#if I830XvSupport +I830SRCS1 = i830_video.c +I830OBJS1 = i830_video.o +#endif + +#if !I830Only +I810SRCS = i810_cursor.c i810_accel.c i810_memory.c i810_wmark.c i810_dga.c \ + i810_video.c i810_io.c +I810OBJS = i810_cursor.o i810_accel.o i810_memory.o i810_wmark.o i810_dga.o \ + i810_video.o i810_io.o +#endif +I830SRCS = i830_driver.c i830_memory.c i830_cursor.c i830_accel.c i830_io.c \ + i830_dga.c $(I830SRCS1) $(I830SRCS2) +I830OBJS = i830_driver.o i830_memory.o i830_cursor.o i830_accel.o i830_io.o \ + i830_dga.o $(I830OBJS1) $(I830OBJS2) + +SRCS = i810_driver.c \ + $(I810SRCS) $(I830SRCS) $(DRISRCS) + +OBJS = i810_driver.o \ + $(I810OBJS) $(I830OBJS) $(DRIOBJS) + +#if I830Only +CHIPDEFINES = -DI830_ONLY +#endif -SRCS = i810_driver.c i810_cursor.c i810_accel.c i810_io.c \ - i810_memory.c i810_wmark.c i810_dga.c i810_video.c \ - i830_driver.c $(DRISRCS) - -OBJS = i810_driver.o i810_cursor.o i810_accel.o i810_io.o \ - i810_memory.o i810_wmark.o i810_dga.o i810_video.o \ - i830_driver.o $(DRIOBJS) +#if I830XvSupport +I830XVDEFINES = -DI830_XV +#endif #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -28,18 +66,23 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ + -I$(SERVERSRC)/miext/shadow \ -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86OSSRC)/vbe -I$(XF86SRC)/int10 \ - -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf24_32bpp \ + -I$(XF86SRC)/vbe -I$(XF86SRC)/int10 \ + -I$(SERVERSRC)/Xext \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) -I$(SERVERSRC)/render \ $(DRIINCLUDES) #endif -DEFINES = $(DRIDEFINES) +DEFINES = $(DRIDEFINES) $(CHIPDEFINES) $(I830XVDEFINES) +#if BuildXF86DRI LinkSourceFile(i830_3d_reg.h, $(GLXLIBSRC)/mesa/src/drv/i830) +#endif +ObjectFromSpecialSource(i830_io, i810_io, -DBUILD_FOR_I830) + #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) #endif @@ -57,19 +100,30 @@ DependTarget() InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(common.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_accel.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i810_common.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_cursor.c,$(DRIVERSDKDIR)/drivers/i810) -InstallDriverSDKNonExecFile(i810_driver.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_dga.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_dri.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_dri.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i810_driver.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i810_hwmc.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_io.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_memory.c,$(DRIVERSDKDIR)/drivers/i810) -InstallDriverSDKNonExecFile(i810_wmark.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_reg.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i810_video.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i810_wmark.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_accel.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_common.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_cursor.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_dga.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i830_dri.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i830_dri.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i830_driver.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_memory.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_video.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKObjectModule(i810,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/i810/common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/common.h:1.6 --- /dev/null Thu Feb 27 12:30:48 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/common.h Wed Feb 5 23:18:04 2003 @@ -0,0 +1,327 @@ + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 David Dawes + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/common.h,v 1.6 2003/02/06 04:18:04 dawes Exp $ */ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * David Dawes <dawes@tungstengraphics.com> + * + */ + +#ifndef _INTEL_COMMON_H_ +#define _INTEL_COMMON_H_ + +#ifdef __GNUC__ +#define PFX __FILE__,__LINE__,__FUNCTION__ +#define FUNCTION_NAME __FUNCTION__ +#else +#define PFX __FILE__,__LINE__,"" +#define FUNCTION_NAME "" +#endif + +#ifdef I830DEBUG +#define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \ + __FILE__, __LINE__,__FUNCTION__) +#define DPRINTF I830DPRINTF_stub +#else /* #ifdef I830DEBUG */ +#define MARKER() +/* this is a real ugly hack to get the compiler to optimize the debugging statements into oblivion */ +#define DPRINTF if(0) I830DPRINTF_stub +#endif /* #ifdef I830DEBUG */ + +#define KB(x) ((x) * 1024) +#define MB(x) ((x) * KB(1024)) + +/* Using usleep() makes things noticably slow. */ +#if 0 +#define DELAY(x) usleep(x) +#else +#define DELAY(x) do {;} while (0) +#endif + +/* I830 hooks for the I810 driver setup/probe. */ +extern const OptionInfoRec *I830BIOSAvailableOptions(int chipid, int busid); +extern void I830InitpScrn(ScrnInfoPtr pScrn); + +/* Symbol lists shared by the i810 and i830 parts. */ +extern const char *I810vgahwSymbols[]; +extern const char *I810ramdacSymbols[]; +extern const char *I810int10Symbols[]; +extern const char *I810vbeSymbols[]; +extern const char *I810ddcSymbols[]; +extern const char *I810fbSymbols[]; +extern const char *I810xaaSymbols[]; +extern const char *I810shadowSymbols[]; + +extern void I830DPRINTF_stub(const char *filename, int line, + const char *function, const char *fmt, ...); + +#ifdef _I830_H_ +#define PrintErrorState I830PrintErrorState +#define WaitRingFunc I830WaitLpRing +#define RecPtr pI830 +#else +#define PrintErrorState I810PrintErrorState +#define WaitRingFunc I810WaitLpRing +#define RecPtr pI810 +#endif + +/* BIOS debug macro */ +#define xf86ExecX86int10_wrapper(pInt, pScrn) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_BIOS) { \ + ErrorF("\n\n\n\nExecuting (ax == 0x%x) BIOS call\n", pInt->ax); \ + ErrorF("Checking Error state before execution\n"); \ + PrintErrorState(pScrn); \ + } \ + xf86ExecX86int10(pInt); \ + if(I810_DEBUG & DEBUG_VERBOSE_BIOS) { \ + ErrorF("Checking Error state after execution\n"); \ + usleep(50000); \ + PrintErrorState(pScrn); \ + } \ +} while (0) + +#define OUT_RING(n) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "OUT_RING %x: %x, (mask %x)\n", outring, n, ringmask); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; \ + outring &= ringmask; \ +} while (0) + +#if 1 +#define ADVANCE_LP_RING() do { \ + RecPtr->LpRing.tail = outring; \ + if (outring & 0x07) \ + ErrorF("ADVANCE_LP_RING: " \ + "outring (0x%x) isn't on a QWord boundary", outring); \ + OUTREG(LP_RING + RING_TAIL, outring); \ +} while (0) +#else +#define ADVANCE_LP_RING() { \ + RecPtr->LpRing.tail = outring; \ + if (outring & 0x07) \ + ErrorF("ADVANCE_LP_RING: " \ + "outring (0x%x) isn't on a QWord boundary", outring); \ + ErrorF("head is %d, tail is %d [%d]\n", INREG(LP_RING + RING_HEAD), INREG(LP_RING + RING_TAIL), outring); \ + OUTREG(LP_RING + RING_TAIL, outring); \ + ErrorF("head is %d, tail is %d [%d]\n", INREG(LP_RING + RING_HEAD), INREG(LP_RING + RING_TAIL), outring); \ +} +#endif + +/* + * XXX Note: the head/tail masks are different for 810 and i830. + * If the i810 always sets the higher bits to 0, then this shouldn't be + * a problem. Check this! + */ +#define DO_RING_IDLE() do { \ + int _head; \ + int _tail; \ + do { \ + _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; \ + _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; \ + DELAY(10); \ + } while (_head != _tail); \ +} while( 0) + +/* + * This is for debugging a potential problem writing the tail pointer + * close to the end of the ring buffer. + */ +#ifndef AVOID_TAIL_END +#define AVOID_TAIL_END 0 +#endif +#ifndef AVOID_SIZE +#define AVOID_SIZE 64 +#endif + +#if AVOID_TAIL_END + +#define BEGIN_LP_RING(n) \ + unsigned int outring, ringmask; \ + volatile unsigned char *virt; \ + unsigned int needed; \ + if ((n) & 1) \ + ErrorF("BEGIN_LP_RING called with odd argument: %d\n", n); \ + if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ + DO_RING_IDLE(); \ + needed = (n) * 4; \ + if ((RecPtr->LpRing.tail > RecPtr->LpRing.tail_mask - AVOID_SIZE) || \ + (RecPtr->LpRing.tail + needed) > \ + RecPtr->LpRing.tail_mask - AVOID_SIZE) { \ + needed += RecPtr->LpRing.tail_mask + 1 - RecPtr->LpRing.tail; \ + ErrorF("BEGIN_LP_RING: skipping last 64 bytes of " \ + "ring (%d vs %d)\n", needed, (n) * 4); \ + } \ + if (RecPtr->LpRing.space < needed) \ + WaitRingFunc(pScrn, needed, 0); \ + RecPtr->LpRing.space -= needed; \ + outring = RecPtr->LpRing.tail; \ + ringmask = RecPtr->LpRing.tail_mask; \ + virt = RecPtr->LpRing.virtual_start; \ + while (needed > (n) * 4) { \ + ErrorF("BEGIN_LP_RING: putting MI_NOOP at 0x%x (remaining %d)\n", \ + outring, needed - (n) * 4); \ + OUT_RING(MI_NOOP); \ + needed -= 4; \ + } \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); + +#else /* AVOID_TAIL_END */ + +#define BEGIN_LP_RING(n) \ + unsigned int outring, ringmask; \ + volatile unsigned char *virt; \ + unsigned int needed; \ + if ((n) & 1) \ + ErrorF("BEGIN_LP_RING called with odd argument: %d\n", n); \ + if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ + DO_RING_IDLE(); \ + needed = (n) * 4; \ + if (RecPtr->LpRing.space < needed) \ + WaitRingFunc(pScrn, needed, 0); \ + RecPtr->LpRing.space -= needed; \ + outring = RecPtr->LpRing.tail; \ + ringmask = RecPtr->LpRing.tail_mask; \ + virt = RecPtr->LpRing.virtual_start; \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); + +#endif /* AVOID_TAIL_END */ + + +/* Memory mapped register access macros */ +#define INREG8(addr) *(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) +#define INREG16(addr) *(volatile CARD16 *)(RecPtr->MMIOBase + (addr)) +#define INREG(addr) *(volatile CARD32 *)(RecPtr->MMIOBase + (addr)) + +#define OUTREG8(addr, val) do { \ + *(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ + ErrorF("OUTREG8(0x%x, 0x%x) in %s\n", addr, val, FUNCTION_NAME); \ + } \ +} while (0) + +#define OUTREG16(addr, val) do { \ + *(volatile CARD16 *)(RecPtr->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ + ErrorF("OUTREG16(0x%x, 0x%x) in %s\n", addr, val, FUNCTION_NAME); \ + } \ +} while (0) + +#define OUTREG(addr, val) do { \ + *(volatile CARD32 *)(RecPtr->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ + ErrorF("OUTREG(0x%x, 0x%x) in %s\n", addr, val, FUNCTION_NAME); \ + } \ +} while (0) + +/* To remove all debugging, make sure I810_DEBUG is defined as a + * preprocessor symbol, and equal to zero. + */ +#if 1 +#define I810_DEBUG 0 +#endif +#ifndef I810_DEBUG +#warning "Debugging enabled - expect reduced performance" +extern int I810_DEBUG; +#endif + +#define DEBUG_VERBOSE_ACCEL 0x1 +#define DEBUG_VERBOSE_SYNC 0x2 +#define DEBUG_VERBOSE_VGA 0x4 +#define DEBUG_VERBOSE_RING 0x8 +#define DEBUG_VERBOSE_OUTREG 0x10 +#define DEBUG_VERBOSE_MEMORY 0x20 +#define DEBUG_VERBOSE_CURSOR 0x40 +#define DEBUG_ALWAYS_SYNC 0x80 +#define DEBUG_VERBOSE_DRI 0x100 +#define DEBUG_VERBOSE_BIOS 0x200 + +/* Size of the mmio region. + */ +#define I810_REG_SIZE 0x80000 + +#ifndef PCI_CHIP_I810 +#define PCI_CHIP_I810 0x7121 +#define PCI_CHIP_I810_DC100 0x7123 +#define PCI_CHIP_I810_E 0x7125 +#define PCI_CHIP_I815 0x1132 +#define PCI_CHIP_I810_BRIDGE 0x7120 +#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 +#define PCI_CHIP_I810_E_BRIDGE 0x7124 +#define PCI_CHIP_I815_BRIDGE 0x1130 +#endif + +#ifndef PCI_CHIP_I855_GM +#define PCI_CHIP_I855_GM 0x3582 +#define PCI_CHIP_I855_GM_BRIDGE 0x3580 +#endif + +#ifndef PCI_CHIP_I865_G +#define PCI_CHIP_I865_G 0x2572 +#define PCI_CHIP_I865_G_BRIDGE 0x2570 +#endif + +#define IS_I810(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I810 || \ + pI810->PciInfo->chipType == PCI_CHIP_I810_DC100 || \ + pI810->PciInfo->chipType == PCI_CHIP_I810_E) +#define IS_I815(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I815) +#define IS_I830(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I830_M) +#define IS_845G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_845_G) +#define IS_I85X(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I855_GM) +#define IS_I865G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I865_G) + +#define IS_MOBILE(pI810) (IS_I830(pI810) || IS_I85X(pI810)) + +#define GTT_PAGE_SIZE KB(4) +#define ROUND_TO(x, y) (((x) + (y) - 1) / (y) * (y)) +#define ROUND_DOWN_TO(x, y) ((x) / (y) * (y)) +#define ROUND_TO_PAGE(x) ROUND_TO((x), GTT_PAGE_SIZE) +#define ROUND_TO_MB(x) ROUND_TO((x), MB(1)) +#define PRIMARY_RINGBUFFER_SIZE KB(128) +#define MIN_SCRATCH_BUFFER_SIZE KB(16) +#define MAX_SCRATCH_BUFFER_SIZE KB(64) +#define HWCURSOR_SIZE GTT_PAGE_SIZE +#define OVERLAY_SIZE GTT_PAGE_SIZE + +/* Use a 64x64 HW cursor */ +#define I810_CURSOR_X 64 +#define I810_CURSOR_Y I810_CURSOR_X + +/* XXX Need to check if these are reasonable. */ +#define MAX_DISPLAY_PITCH 2048 +#define MAX_DISPLAY_HEIGHT 2048 + +#define PIPE_NAME(n) ('A' + (n)) + +#endif /* _INTEL_COMMON_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.29 xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.38 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.29 Mon Jan 14 13:43:51 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h Tue Feb 25 23:19:36 2003 @@ -2,6 +2,8 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 David Dawes + All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -25,16 +27,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.29 2002/01/14 18:43:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.38 2003/02/26 04:19:36 dawes Exp $ */ /* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> + * David Dawes <dawes@tungstengraphics.com> * */ -/* #define I830DEBUG */ - #ifndef _I810_H_ #define _I810_H_ @@ -47,6 +48,7 @@ #include "xf86Cursor.h" #include "xf86xv.h" #include "xf86int10.h" +#include "vbe.h" #include "vgaHW.h" #ifdef XF86DRI @@ -57,255 +59,18 @@ #include "dri.h" #include "GL/glxint.h" #include "i810_dri.h" -#include "i830_dri.h" #endif +#include "common.h" #define I810_VERSION 4000 #define I810_NAME "I810" #define I810_DRIVER_NAME "i810" #define I810_MAJOR_VERSION 1 -#define I810_MINOR_VERSION 1 +#define I810_MINOR_VERSION 3 #define I810_PATCHLEVEL 0 -#ifdef __GNUC__ -#define PFX __FILE__,__LINE__,__FUNCTION__ -#define FUNCTION_NAME __FUNCTION__ -#else -#define PFX __FILE__,__LINE__,"" -#define FUNCTION_NAME "" -#endif - -#ifdef I830DEBUG -#define MARKER() fprintf(stderr,"\n### %s:%d: >>> %s <<< ###\n\n",__FILE__,__LINE__,__FUNCTION__) -#define DPRINTF DPRINTF_stub -#else /* #ifdef I830DEBUG */ -#define MARKER() -/* this is a real ugle hack to get the compiler to optimize the debugging statements into oblivion */ -#define DPRINTF if(0) DPRINTF_stub -#endif /* #ifdef I830DEBUG */ - -#define KB(x) ((x) * 1024) -#define MB(x) ((x) * KB(1024)) - -/* I830 Video BIOS support */ - -/* This code is Heavily based upon the VESA driver written by: - * Paulo C~^Aésar Pereira de Andrade <pcpa@conectiva.com.br> */ - -typedef struct _VBEInfoBlock VBEInfoBlock; -typedef struct _ModeInfoBlock ModeInfoBlock; -typedef struct _CRTCInfoBlock CRTCInfoBlock; -typedef struct _VBT_header VBTHeader; -typedef struct _BIOSDataBlock BIOSDataBlock; - -#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) - -typedef struct _VESARec -{ - xf86Int10InfoPtr pInt; - EntityInfoPtr pEnt; - CARD16 major, minor; - VBEInfoBlock *vbeInfo; - GDevPtr device; - pciVideoPtr pciInfo; - PCITAG pciTag; - CARD16 maxBytesPerScanline; - int mapPhys, mapOff, mapSize; /* video memory */ - void *base, *VGAbase; - CARD8 *state, *pstate; /* SVGA state */ - int statePage, stateSize, stateMode; - int page; - CARD8 *block; - int pix24bpp; - CARD32 *pal, *savedPal; - CARD8 *fonts; - xf86MonPtr monitor; - Bool shadowFB, primary; - CARD8 *shadowPtr; - CARD32 windowAoffset; -} VESARec, *VESAPtr; - -typedef struct _ModeInfoData -{ - int mode; - ModeInfoBlock *data; - CRTCInfoBlock *block; -} ModeInfoData; - -#if !defined(__GNUC__) && !defined(__attribute__) -#define __attribute__(a) -#endif - -/* - * INT 0 - */ -struct _VBEInfoBlock -{ - /* VESA 1.2 fields */ - CARD8 VESASignature[4]; /* VESA */ - CARD16 VESAVersion; /* Higher byte major, lower byte minor */ - /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ - CARD8 Capabilities[4]; /* Capabilities of the video environment */ - - /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ - - CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ - /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ - - /* VESA 2 fields */ - CARD16 OemSoftwareRev; /* VBE implementation Software revision */ - /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ - /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ - /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ - CARD8 Reserved[222]; /* Reserved for VBE implementation */ - CARD8 OemData[256]; /* Data Area for OEM Strings */ -} __attribute__((packed)); -/* - * INT 1 - */ -struct _ModeInfoBlock { - CARD16 ModeAttributes; /* mode attributes */ - CARD8 WinAAttributes; /* window A attributes */ - CARD8 WinBAttributes; /* window B attributes */ - CARD16 WinGranularity; /* window granularity */ - CARD16 WinSize; /* window size */ - CARD16 WinASegment; /* window A start segment */ - CARD16 WinBSegment; /* window B start segment */ - CARD32 WinFuncPtr; /* real mode pointer to window function */ - CARD16 BytesPerScanline; /* bytes per scanline */ - - /* Mandatory information for VBE 1.2 and above */ - CARD16 XResolution; /* horizontal resolution in pixels or characters */ - CARD16 YResolution; /* vertical resolution in pixels or characters */ - CARD8 XCharSize; /* character cell width in pixels */ - CARD8 YCharSize; /* character cell height in pixels */ - CARD8 NumberOfPlanes; /* number of memory planes */ - CARD8 BitsPerPixel; /* bits per pixel */ - CARD8 NumberOfBanks; /* number of banks */ - CARD8 MemoryModel; /* memory model type */ - CARD8 BankSize; /* bank size in KB */ - CARD8 NumberOfImages; /* number of images */ - CARD8 Reserved; /* 1 */ /* reserved for page function */ - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - CARD8 RedMaskSize; /* size of direct color red mask in bits */ - CARD8 RedFieldPosition; /* bit position of lsb of red mask */ - CARD8 GreenMaskSize; /* size of direct color green mask in bits */ - CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ - CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ - CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ - CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ - CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ - CARD8 DirectColorModeInfo; /* direct color mode attributes */ - - /* Mandatory information for VBE 2.0 and above */ - CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ - CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ - CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ - - /* Mandatory information for VBE 3.0 and above */ - CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ - CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ - CARD8 LinNumberOfImagePages; /* number of images for linear modes */ - CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ - CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ - CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ - CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ - CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ - CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ - CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ - CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ - CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ - CARD8 Reserved2[189]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); - -/* - * INT2 - */ -#define CRTC_DBLSCAN (1<<0) -#define CRTC_INTERLACE (1<<1) -#define CRTC_NHSYNC (1<<2) -#define CRTC_NVSYNC (1<<3) - -struct _CRTCInfoBlock -{ - CARD16 HorizontalTotal; /* Horizontal total in pixels */ - CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ - CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ - CARD16 VerticalTotal; /* Vertical total in lines */ - CARD16 VerticalSyncStart; /* Vertical sync start in lines */ - CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ - CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ - CARD32 PixelClock; /* Pixel clock in units of Hz */ - CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ - CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); - -/* CRTCInfoBlock is in the VESA 3.0 specs */ -typedef struct _VESApmi -{ - int seg_tbl; - int tbl_off; - int tbl_len; -} VESApmi; - -/* Functions */ -const OptionInfoRec *I830BIOSAvailableOptions(int chipid, int busid); -ModeInfoBlock *I830VESAGetModeInfo(ScrnInfoPtr pScrn, int mode); -void I830BIOSProbeDDC(ScrnInfoPtr pScrn, int index); -void I830VESAFreeModeInfo(ModeInfoBlock *block); -Bool I830BIOSPreInit(ScrnInfoPtr pScrn, int flags); -void I830BIOSSaveRegisters(ScrnInfoPtr pScrn); -void I830BIOSSetRegisters(ScrnInfoPtr pScrn, int mode); -Bool I830VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode); -Bool I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, CRTCInfoBlock *block); -Bool I830VESASaveRestore(ScrnInfoPtr pScrn, int function); -Bool I830VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, - int width, int *pixels, int *bytes, - int *max); -int I830VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits); -CARD32 *I830VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, - int num, CARD32 *data, Bool secondary, - Bool wait_retrace); -Bool I830BIOSInitializeFirstMode(int scrnIndex); -Bool I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, - int argc, char **argv); -Bool I830VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, - Bool wait_retrace); -void I830BIOSAdjustFrame(int scrnIndex, int x, int y, int flags); -void I830BIOSFreeScreen(int scrnIndex, int flags); -void I830BIOSLeaveVT(int scrnIndex, int flags); -Bool I830BIOSEnterVT(int scrnIndex, int flags); -Bool I830BIOSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -Bool I830BIOSSaveScreen(ScreenPtr pScreen, Bool unblack); -Bool I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen); - -#define SCANWID_SET 0 -#define SCANWID_GET 1 -#define SCANWID_SET_BYTES 2 -#define SCANWID_GET_MAX 3 -#define I830VESASetLogicalScanline(pScrn, width) \ - I830VESASetGetLogicalScanlineLength(pScrn, SCANWID_SET, \ - width, NULL, NULL, NULL) -#define I830VESASetLogicalScanlineBytes(pScrn, width) \ - I830VESASetGetLogicalScanlineLength(pScrn, width, SCANWID_SET_BYTES, \ - NULL, NULL, NULL) -#define I830VESAGetLogicalScanline(pScrn, pixels, bytes, max) \ - I830VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET, NULL, \ - pixels, bytes, max) -#define I830VESAGetMaxLogicalScanline(pScrn, pixels, bytes, max) \ - I830VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET_MAX, \ - NULL, pixels, bytes, max) - -#define MODE_QUERY 0 -#define MODE_SAVE 1 -#define MODE_RESTORE 2 - -#define SET_SAVED_MODE 1 -#define SET_CURRENT_MODE 2 - /* HWMC Surfaces */ #define I810_MAX_SURFACES 7 #define I810_MAX_SUBPICTURES 2 @@ -315,34 +80,16 @@ typedef struct _I810Rec *I810Ptr; -typedef void (*I810WriteIndexedByteFunc)(I810Ptr pI810, int addr, - CARD8 index, CARD8 value); -typedef CARD8 (*I810ReadIndexedByteFunc)(I810Ptr pI810, int addr, CARD8 index); -typedef void (*I810WriteByteFunc)(I810Ptr pI810, int addr, CARD8 value); -typedef CARD8 (*I810ReadByteFunc)(I810Ptr pI810, int addr); - - -extern void I810SetTiledMemory(ScrnInfoPtr pScrn, - int nr, - unsigned start, - unsigned pitch, - unsigned size); - -typedef enum { - OPTION_NOACCEL, - OPTION_SW_CURSOR, - OPTION_COLOR_KEY, - OPTION_CACHE_LINES, - OPTION_DAC_6BIT, - OPTION_DRI, - OPTION_NO_DDC, - OPTION_STRETCH, - OPTION_CENTER, - OPTION_XVMC_SURFACES -} I810Opts; +typedef void (*I810WriteIndexedByteFunc)(I810Ptr pI810, IOADDRESS addr, + CARD8 index, CARD8 value); +typedef CARD8(*I810ReadIndexedByteFunc)(I810Ptr pI810, IOADDRESS addr, + CARD8 index); +typedef void (*I810WriteByteFunc)(I810Ptr pI810, IOADDRESS addr, CARD8 value); +typedef CARD8(*I810ReadByteFunc)(I810Ptr pI810, IOADDRESS addr); -/* Linear region allocated in framebuffer. - */ +extern void I810SetTiledMemory(ScrnInfoPtr pScrn, int nr, unsigned start, + unsigned pitch, unsigned size); + typedef struct { unsigned long Start; unsigned long End; @@ -377,73 +124,20 @@ unsigned char ExtHorizBlank; unsigned char ExtOffset; unsigned char InterlaceControl; - unsigned int LMI_FIFO_Watermark; + unsigned int LMI_FIFO_Watermark; - unsigned int LprbTail; - unsigned int LprbHead; - unsigned int LprbStart; - unsigned int LprbLen; + unsigned int LprbTail; + unsigned int LprbHead; + unsigned int LprbStart; + unsigned int LprbLen; unsigned int Fence[8]; unsigned short OverlayActiveStart; unsigned short OverlayActiveEnd; - } I810RegRec, *I810RegPtr; -typedef struct -{ - unsigned int LprbTail; - unsigned int LprbHead; - unsigned int LprbStart; - unsigned int LprbLen; - - unsigned int Fence[8]; - - unsigned int VideoClk_VGA0_M1M2N; - unsigned int VideoClk_VGA1_M1M2N; - unsigned int VideoClk_PostDiv; - unsigned int fpa_0; - unsigned int fpa_1; - unsigned int dpll_a; - unsigned int dpll_b; - - unsigned int LMI_FIFO_Watermark; - unsigned int LMI_FIFO_Watermark2; - - unsigned int HTotal_A; - unsigned int HBlank_A; - unsigned int HSync_A; - unsigned int VTotal_A; - unsigned int VBlank_A; - unsigned int VSync_A; - unsigned int Bclrpat_A; - unsigned int PipeASRC; - - unsigned int HTotal_B; - unsigned int HBlank_B; - unsigned int HSync_B; - unsigned int VTotal_B; - unsigned int VBlank_B; - unsigned int VSync_B; - unsigned int Bclrpat_B; - unsigned int PipeBSRC; - - unsigned int PipeAConf; - unsigned int PipeBConf; - unsigned int DspACntr; - unsigned int DspAStride; - unsigned int DspABase; - unsigned int DspBCntr; - unsigned int DspBStride; - unsigned int DspBBase; - - unsigned int adpa; - unsigned int dv0a; - unsigned int dv0b; -} I830RegRec, *I830RegPtr; - typedef struct _I810Rec { unsigned char *MMIOBase; unsigned char *FbBase; @@ -453,17 +147,17 @@ int cpp; int MaxClock; - unsigned int bufferOffset; /* for I810SelectBuffer */ + unsigned int bufferOffset; /* for I810SelectBuffer */ Bool DoneFrontAlloc; BoxRec FbMemBox; I810MemRange FrontBuffer; - I810MemRange BackBuffer; + I810MemRange BackBuffer; I810MemRange DepthBuffer; I810MemRange TexMem; I810MemRange Scratch; I810MemRange BufferMem; I810MemRange ContextMem; - I810MemRange MC; + I810MemRange MC; int auxPitch; int auxPitchBits; @@ -485,24 +179,25 @@ int Chipset; unsigned long LinearAddr; unsigned long MMIOAddr; + IOADDRESS ioBase; EntityInfoPtr pEnt; pciVideoPtr PciInfo; PCITAG PciTag; I810RingBuffer LpRing; - unsigned int BR[20]; + unsigned int BR[20]; - int LmFreqSel; + int LmFreqSel; int VramKey; unsigned long VramOffset; int DcacheKey; unsigned long DcacheOffset; - int HwcursKey; + int HwcursKey; unsigned long HwcursOffset; int GttBound; - + I810MemRange DcacheMem; I810MemRange SysMem; @@ -516,27 +211,24 @@ I810RegRec SavedReg; I810RegRec ModeReg; - I830RegRec i830_SavedReg; - I830RegRec i830_ModeReg; - XAAInfoRecPtr AccelInfoRec; xf86CursorInfoPtr CursorInfoRec; CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; - + I810WriteIndexedByteFunc writeControl; I810ReadIndexedByteFunc readControl; I810WriteByteFunc writeStandard; I810ReadByteFunc readStandard; - Bool directRenderingEnabled; /* false if XF86DRI not defined. */ + Bool directRenderingEnabled; /* false if XF86DRI not defined. */ #ifdef XF86DRI int LockHeld; DRIInfoPtr pDRIInfo; int drmSubFD; int numVisualConfigs; - __GLXvisualConfig* pVisualConfigs; + __GLXvisualConfig *pVisualConfigs; I810ConfigPrivPtr pVisualConfigsPriv; unsigned long dcacheHandle; unsigned long backHandle; @@ -556,29 +248,17 @@ XF86VideoAdaptorPtr adaptor; OptionInfoPtr Options; - /* Stolen memory support */ - unsigned long StolenSize; - Bool StolenOnly; - - /* Video BIOS support */ - VESAPtr vesa; - int configured_device; + + Bool showCache; + Bool noAccel; } I810Rec; #define I810PTR(p) ((I810Ptr)((p)->driverPrivate)) -#define I810_FRONT 0 -#define I810_BACK 1 -#define I810_DEPTH 2 - -extern const char *I810vgahwSymbols[]; -extern const char *I810ramdacSymbols[]; -extern const char *I810int10Symbols[]; -extern const char *I810vbeSymbols[]; -extern const char *I810ddcSymbols[]; -extern const char *I810fbSymbols[]; -extern const char *I810xaaSymbols[]; +#define I810_SELECT_FRONT 0 +#define I810_SELECT_BACK 1 +#define I810_SELECT_DEPTH 2 extern Bool I810DRIScreenInit(ScreenPtr pScreen); extern void I810DRICloseScreen(ScreenPtr pScreen); @@ -593,40 +273,39 @@ extern Bool I810AccelInit(ScreenPtr pScreen); extern void I810SetPIOAccess(I810Ptr pI810); extern void I810SetMMIOAccess(I810Ptr pI810); -extern unsigned int I810CalcWatermark( ScrnInfoPtr pScrn, double freq, - Bool dcache ); -extern void I810PrintErrorState( ScrnInfoPtr pScrn ); -extern int I810WaitLpRing( ScrnInfoPtr pScrn, int n, int timeout_millis ); -extern void I810Sync( ScrnInfoPtr pScrn ); -extern unsigned long I810LocalToPhysical( ScrnInfoPtr pScrn, - unsigned long local ); -extern int I810AllocLow( I810MemRange *result, I810MemRange *pool, int size ); -extern int I810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ); +extern unsigned int I810CalcWatermark(ScrnInfoPtr pScrn, double freq, + Bool dcache); +extern void I810PrintErrorState(ScrnInfoPtr pScrn); +extern int I810WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis); +extern void I810Sync(ScrnInfoPtr pScrn); +extern unsigned long I810LocalToPhysical(ScrnInfoPtr pScrn, + unsigned long local); +extern int I810AllocLow(I810MemRange * result, I810MemRange * pool, int size); +extern int I810AllocHigh(I810MemRange * result, I810MemRange * pool, + int size); extern Bool I810AllocateFront(ScrnInfoPtr pScrn); - -extern void I810SetCursorPosition(ScrnInfoPtr pScrn, int x, int y); -extern int I810AllocateGARTMemory( ScrnInfoPtr pScrn ); -extern void I810FreeGARTMemory( ScrnInfoPtr pScrn ); +extern int I810AllocateGARTMemory(ScrnInfoPtr pScrn); +extern void I810FreeGARTMemory(ScrnInfoPtr pScrn); -extern Bool I810BindGARTMemory( ScrnInfoPtr pScrn ); -extern Bool I810UnbindGARTMemory( ScrnInfoPtr pScrn ); +extern Bool I810BindGARTMemory(ScrnInfoPtr pScrn); +extern Bool I810UnbindGARTMemory(ScrnInfoPtr pScrn); extern int I810CheckAvailableMemory(ScrnInfoPtr pScrn); extern Bool I810SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); extern void I810AdjustFrame(int scrnIndex, int x, int y, int flags); -extern void I810SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, +extern void I810SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, - unsigned int planemask, + unsigned int planemask, int trans_color); -extern void I810SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, +extern void I810SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, + int srcY, int dstX, int dstY, int w, int h); -extern void I810SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, +extern void I810SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); -extern void I810SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, +extern void I810SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h); extern void I810SelectBuffer(ScrnInfoPtr pScrn, int buffer); @@ -641,177 +320,5 @@ extern void I810InitMC(ScreenPtr pScreen); extern const OptionInfoRec *I810AvailableOptions(int chipid, int busid); - -extern Bool I810MapMem(ScrnInfoPtr pScrn); -extern Bool I810UnmapMem(ScrnInfoPtr pScrn); -extern void I810SetRingRegs(ScrnInfoPtr pScrn); - -/* I830 specific functions */ -extern void I830EmitInvarientState(ScrnInfoPtr pScrn); - -extern Bool I830DRIScreenInit(ScreenPtr pScreen); -extern void I830DRICloseScreen(ScreenPtr pScreen); -extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen); -extern Bool I830InitDma(ScrnInfoPtr pScrn); -extern Bool I830CleanupDma(ScrnInfoPtr pScrn); -extern Bool I830AccelInit(ScreenPtr pScreen); -extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, - int ydir, int rop, - unsigned int planemask, - int trans_color); -extern void I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, - int w, int h); -extern void I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -extern void I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h); - -/* Debug functions */ -extern char *i810_outreg_get_addr_name(unsigned int addr, int size); -extern void i810_outreg_decode_register(unsigned int addr, unsigned int val, int size); -extern void I830PrintAllRegisters(I830RegPtr i810Reg); -extern void I830ReadAllRegisters(I810Ptr pI810, I830RegPtr i810Reg); -void DPRINTF_stub (const char *filename,int line,const char *function,const char *fmt, ...); - -/* BIOS debug macro */ -#define xf86ExecX86int10_wrapper(pInt, pScrn) do \ - { \ - if(I810_DEBUG & DEBUG_VERBOSE_BIOS) \ - { \ - ErrorF("\n\n\n\nExecuting (ax == 0x%x) BIOS call\n", pInt->ax); \ - ErrorF("Checking Error state before execution\n"); \ - I810PrintErrorState(pScrn); \ - } \ - xf86ExecX86int10(pInt); \ - if(I810_DEBUG & DEBUG_VERBOSE_BIOS) \ - { \ - ErrorF("Checking Error state after execution\n"); \ - usleep(50000); \ - I810PrintErrorState(pScrn); \ - } \ - } while(0) - -#define minb(p) *(volatile CARD8 *)(pI810->MMIOBase + (p)) -#define moutb(p,v) *(volatile CARD8 *)(pI810->MMIOBase + (p)) = (v) - -#define OUT_RING(n) { \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF( "OUT_RING %x: %x\n", outring, n); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; \ - outring &= ringmask; \ -} - -#define ADVANCE_LP_RING() { \ - pI810->LpRing.tail = outring; \ - OUTREG(LP_RING + RING_TAIL, outring); \ -} - -#define DO_RING_IDLE() do \ - { \ - int _head; \ - int _tail; \ - int _i; \ - do \ - { \ - _head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; \ - _tail = INREG(LP_RING + RING_TAIL) & TAIL_ADDR; \ - for(_i = 0; _i < 65535; _i++); \ - } \ - while(_head != _tail); \ - } while(0) - -#define BEGIN_LP_RING(n) \ - unsigned int outring, ringmask; \ - volatile unsigned char *virt; \ - if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) DO_RING_IDLE(); \ - if (pI810->LpRing.space < n*4) I810WaitLpRing( pScrn, n*4, 0); \ - pI810->LpRing.space -= n*4; \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); \ - outring = pI810->LpRing.tail; \ - ringmask = pI810->LpRing.tail_mask; \ - virt = pI810->LpRing.virtual_start; - -/* Memory mapped register access macros */ -#define INREG8(addr) *(volatile CARD8 *)(pI810->MMIOBase + (addr)) -#define INREG16(addr) *(volatile CARD16 *)(pI810->MMIOBase + (addr)) -#define INREG(addr) *(volatile CARD32 *)(pI810->MMIOBase + (addr)) - -#define OUTREG8(addr, val) do \ - { \ - *(volatile CARD8 *)(pI810->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ - char *_name = i810_outreg_get_addr_name(addr, 8); \ - ErrorF( "OUTREG8(%s, %x, %x) in %s\n", _name, addr, val, FUNCTION_NAME); \ - i810_outreg_decode_register(addr, val, 8); \ - } \ - } while (0) - -#define OUTREG16(addr, val) do \ - { \ - *(volatile CARD16 *)(pI810->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ - char *_name = i810_outreg_get_addr_name(addr, 16); \ - ErrorF( "OUTREG16(%s, %x, %x) in %s\n", _name, addr, val, FUNCTION_NAME); \ - i810_outreg_decode_register(addr, val, 16); \ - } \ - } while (0) - -#define OUTREG(addr, val) do \ - { \ - *(volatile CARD32 *)(pI810->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ - char *_name = i810_outreg_get_addr_name(addr, 32); \ - ErrorF( "OUTREG(%s, %x, %x) in %s\n", _name, addr, val, FUNCTION_NAME); \ - i810_outreg_decode_register(addr, val, 32); \ - } \ - } while (0) - -/* To remove all debugging, make sure I810_DEBUG is defined as a - * preprocessor symbol, and equal to zero. - */ -#define I810_DEBUG 0 -#ifndef I810_DEBUG -#warning "Debugging enabled - expect reduced performance" -extern int I810_DEBUG; -#endif - -#define DEBUG_VERBOSE_ACCEL 0x1 -#define DEBUG_VERBOSE_SYNC 0x2 -#define DEBUG_VERBOSE_VGA 0x4 -#define DEBUG_VERBOSE_RING 0x8 -#define DEBUG_VERBOSE_OUTREG 0x10 -#define DEBUG_VERBOSE_MEMORY 0x20 -#define DEBUG_VERBOSE_CURSOR 0x40 -#define DEBUG_ALWAYS_SYNC 0x80 -#define DEBUG_VERBOSE_DRI 0x100 -#define DEBUG_VERBOSE_BIOS 0x200 - -/* Size of the mmio region. - */ -#define I810_REG_SIZE 0x80000 - -#ifndef PCI_CHIP_I810 -#define PCI_CHIP_I810 0x7121 -#define PCI_CHIP_I810_DC100 0x7123 -#define PCI_CHIP_I810_E 0x7125 -#define PCI_CHIP_I815 0x1132 -#define PCI_CHIP_I810_BRIDGE 0x7120 -#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 -#define PCI_CHIP_I810_E_BRIDGE 0x7124 -#define PCI_CHIP_I815_BRIDGE 0x1130 -#endif - - -#define IS_I810(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I810 || \ - pI810->PciInfo->chipType == PCI_CHIP_I810_DC100 || \ - pI810->PciInfo->chipType == PCI_CHIP_I810_E) -#define IS_I815(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I815) -#define IS_I830(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I830_M) - - -#endif - +#endif /* _I810_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man:1.2 Sat Jan 27 13:20:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man Mon Feb 17 14:19:02 2003 @@ -1,9 +1,9 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man,v 1.2 2001/01/27 18:20:48 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man,v 1.3 2003/02/17 19:19:02 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH I810 __drivermansuffix__ __vendorversion__ .SH NAME -i810 \- Intel i810 video driver +i810 \- Intel 8xx integrated graphics chipsets .SH SYNOPSIS .nf .B "Section \*qDevice\*q" @@ -14,31 +14,32 @@ .fi .SH DESCRIPTION .B i810 -is an XFree86 driver for the Intel i810 family of graphics chipsets. +is an XFree86 driver for Intel integrated graphics chipsets. The driver supports depths 8, 15, 16 and 24. All visual types are supported in depth 8, other depths only support TrueColor. The driver supports hardware accelerated 3D via the Direct Rendering Infrastructure (DRI), -but only in depth 16. +but only in depth 16 for the i810/i815 and depths 16 and 24 for later chipsets. .SH SUPPORTED HARDWARE .B i810 -supports the i810, i810-DC100, i810e and i815 chipsets. +supports the i810, i810-DC100, i810e, i815, 830M, 845G, 852GM, 855GM, +and 865G chipsets. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. .PP -The i810 has a unified memory architecture and uses system memory -for video ram. By default 8 Megabytes of system memory are used -for graphics. This amount may be changed with the -.B VideoRam -entry in the config file +The Intel 8xx family of integrated graphics chipsets has a unified memory +architecture and uses system memory for video ram. By default 8 Megabytes +of system memory are used for graphics. For the 830M and later, the +default is 8 Megabytes when DRI is not enabled and 32 Megabytes with +DRI is enabled. This amount may be changed with the +.B VideoRam +entry in the config file .B "Device" -section. It may be set to any power of two between 4 and 32 Megabytes -inclusive to allow the user to customize the balance between main -memory usage and graphics performance. Too little memory reserved for -graphics can result in decreased 3D and 2D graphics performance and -features. +section. It may be set to any reasonable value up to 64MB for older +chipsets or 128MB for newer chipets. Note that increasing this value +will reduce the amount of system memory available for other applications. .PP The following driver .B Options @@ -68,4 +69,6 @@ XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Authors include: Keith Whitwell, and also Jonathan Bian, Matthew J Sottek, -Jeff Hartmann, Mark Vojkovich, Alan Hourihane, H. J. Lu. +Jeff Hartmann, Mark Vojkovich, Alan Hourihane, H. J. Lu. 830M and 845G +support reworked for XFree86 4.3 by David Dawes and Keith Whitwell. +852GM, 855GM, and 865G support added by David Dawes and Keith Whitwell. Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c:1.12 Thu Oct 4 14:28:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c Mon Nov 25 09:04:59 2002 @@ -25,11 +25,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c,v 1.12 2001/10/04 18:28:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c,v 1.17 2002/11/25 14:04:59 eich Exp $ */ /* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> * */ @@ -37,52 +50,50 @@ #include "xf86.h" #include "i810.h" -#include "i810_reg.h" - static unsigned int i810Rop[16] = { - 0x00, /* GXclear */ - 0x88, /* GXand */ - 0x44, /* GXandReverse */ - 0xCC, /* GXcopy */ - 0x22, /* GXandInvert */ - 0xAA, /* GXnoop */ - 0x66, /* GXxor */ - 0xEE, /* GXor */ - 0x11, /* GXnor */ - 0x99, /* GXequiv */ - 0x55, /* GXinvert */ - 0xDD, /* GXorReverse */ - 0x33, /* GXcopyInvert */ - 0xBB, /* GXorInverted */ - 0x77, /* GXnand */ - 0xFF /* GXset */ + 0x00, /* GXclear */ + 0x88, /* GXand */ + 0x44, /* GXandReverse */ + 0xCC, /* GXcopy */ + 0x22, /* GXandInvert */ + 0xAA, /* GXnoop */ + 0x66, /* GXxor */ + 0xEE, /* GXor */ + 0x11, /* GXnor */ + 0x99, /* GXequiv */ + 0x55, /* GXinvert */ + 0xDD, /* GXorReverse */ + 0x33, /* GXcopyInvert */ + 0xBB, /* GXorInverted */ + 0x77, /* GXnand */ + 0xFF /* GXset */ }; static unsigned int i810PatternRop[16] = { - 0x00, /* GXclear */ - 0xA0, /* GXand */ - 0x50, /* GXandReverse */ - 0xF0, /* GXcopy */ - 0x0A, /* GXandInvert */ - 0xAA, /* GXnoop */ - 0x5A, /* GXxor */ - 0xFA, /* GXor */ - 0x05, /* GXnor */ - 0xA5, /* GXequiv */ - 0x55, /* GXinvert */ - 0xF5, /* GXorReverse */ - 0x0F, /* GXcopyInvert */ - 0xAF, /* GXorInverted */ - 0x5F, /* GXnand */ - 0xFF /* GXset */ + 0x00, /* GXclear */ + 0xA0, /* GXand */ + 0x50, /* GXandReverse */ + 0xF0, /* GXcopy */ + 0x0A, /* GXandInvert */ + 0xAA, /* GXnoop */ + 0x5A, /* GXxor */ + 0xFA, /* GXor */ + 0x05, /* GXnor */ + 0xA5, /* GXequiv */ + 0x55, /* GXinvert */ + 0xF5, /* GXorReverse */ + 0x0F, /* GXcopyInvert */ + 0xAF, /* GXorInverted */ + 0x5F, /* GXnand */ + 0xFF /* GXset */ }; -static void I810SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, +static void I810SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, int fg, int bg, int rop, unsigned int planemask); -static void I810SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, +static void I810SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, int x, int y, int w, int h); @@ -91,36 +102,37 @@ int rop, unsigned int mask); -static void I810SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft ); +static void I810SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr + pScrn, int x, + int y, int w, + int h, + int skipleft); static void I810SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - /* The following function sets up the supported acceleration. Call it * from the FbInit() function in the SVGA driver, or before ScreenInit * in a monolithic server. */ Bool -I810AccelInit( ScreenPtr pScreen ) +I810AccelInit(ScreenPtr pScreen) { XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810AccelInit\n"); + ErrorF("I810AccelInit\n"); pI810->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; + if (!infoPtr) + return FALSE; pI810->bufferOffset = 0; infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; /* There is a bit blt bug in 24 bpp. This is a problem, but - at least without the pixmap cache we can pass the test suite */ - if(pScrn->depth != 24) + * at least without the pixmap cache we can pass the test suite */ + if (pScrn->depth != 24) infoPtr->Flags |= PIXMAP_CACHE; /* Sync @@ -139,28 +151,26 @@ * - the transparency op hangs the blit engine, disable for now. */ { - infoPtr->ScreenToScreenCopyFlags = ( 0 - | NO_PLANEMASK - | NO_TRANSPARENCY - | 0 ); + infoPtr->ScreenToScreenCopyFlags = (0 + | NO_PLANEMASK + | NO_TRANSPARENCY | 0); infoPtr->SetupForScreenToScreenCopy = I810SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = I810SubsequentScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = + I810SubsequentScreenToScreenCopy; } - /* 8x8 pattern fills */ { infoPtr->SetupForMono8x8PatternFill = I810SetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = - I810SubsequentMono8x8PatternFillRect; - - infoPtr->Mono8x8PatternFillFlags = ( HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST | - NO_PLANEMASK | - 0 ); + I810SubsequentMono8x8PatternFillRect; + + infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_SCREEN_ORIGIN | + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_PLANEMASK | 0); } /* 8x8 color fills - not considered useful for XAA. @@ -169,53 +179,52 @@ /* Scanline color expansion - Use the same scheme as the 3.3 driver. * */ - if(pI810->Scratch.Size != 0) { + if (pI810->Scratch.Size != 0) { int i; - int width = ((pScrn->displayWidth + 31) & ~31) / 8; + int width = ((pScrn->displayWidth + 31) & ~31) / 8; int nr_buffers = pI810->Scratch.Size / width; unsigned char *ptr = pI810->FbBase + pI810->Scratch.Start; - + pI810->NumScanlineColorExpandBuffers = nr_buffers; - pI810->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc( nr_buffers, sizeof (unsigned char *) ); - - for (i = 0 ; i < nr_buffers ; i++, ptr += width) + pI810->ScanlineColorExpandBuffers = (unsigned char **) + xnfcalloc(nr_buffers, sizeof(unsigned char *)); + + for (i = 0; i < nr_buffers; i++, ptr += width) pI810->ScanlineColorExpandBuffers[i] = ptr; - - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( - NO_PLANEMASK | - ROP_NEEDS_SOURCE | - BIT_ORDER_IN_BYTE_MSBFIRST | - 0); - infoPtr->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc( 1, sizeof (unsigned char *) ); + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = (NO_PLANEMASK | + ROP_NEEDS_SOURCE | + BIT_ORDER_IN_BYTE_MSBFIRST + | 0); + + infoPtr->ScanlineColorExpandBuffers = (unsigned char **) + xnfcalloc(1, sizeof(unsigned char *)); infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers[0] = - pI810->ScanlineColorExpandBuffers[0]; + infoPtr->ScanlineColorExpandBuffers[0] = + pI810->ScanlineColorExpandBuffers[0]; pI810->nextColorExpandBuf = 0; infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - I810SetupForScanlineCPUToScreenColorExpandFill; + I810SetupForScanlineCPUToScreenColorExpandFill; infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - I810SubsequentScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentColorExpandScanline = - I810SubsequentColorExpandScanline; + I810SubsequentScanlineCPUToScreenColorExpandFill; + + infoPtr->SubsequentColorExpandScanline = + I810SubsequentColorExpandScanline; } /* Possible todo: Image writes w/ non-GXCOPY rop. */ - I810SelectBuffer(pScrn, I810_FRONT); + I810SelectBuffer(pScrn, I810_SELECT_FRONT); return XAAInit(pScreen, infoPtr); } int -I810WaitLpRing( ScrnInfoPtr pScrn, int n, int timeout_millis ) +I810WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) { I810Ptr pI810 = I810PTR(pScrn); I810RingBuffer *ring = &(pI810->LpRing); @@ -232,51 +241,48 @@ timeout_millis = 2000; if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) { - ErrorF( "I810WaitLpRing %d\n", n); + ErrorF("I810WaitLpRing %d\n", n); first = GetTimeInMillis(); } - - while (ring->space < n) - { - int i; + while (ring->space < n) { ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->space = ring->head - (ring->tail+8); + ring->space = ring->head - (ring->tail + 8); - if (ring->space < 0) + if (ring->space < 0) ring->space += ring->mem.Size; - + iters++; now = GetTimeInMillis(); - if ( start == 0 || now < start || ring->head != last_head) { + if (start == 0 || now < start || ring->head != last_head) { if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - if (now > start) - ErrorF( "space: %d wanted %d\n", ring->space, n ); + if (now > start) + ErrorF("space: %d wanted %d\n", ring->space, n); start = now; last_head = ring->head; - } else if ( now - start > timeout_millis ) { - I810PrintErrorState( pScrn ); - ErrorF( "space: %d wanted %d\n", ring->space, n ); + } else if (now - start > timeout_millis) { + ErrorF("Error in I810WaitLpRing(), now is %d, start is %d\n", now, + start); + I810PrintErrorState(pScrn); + ErrorF("space: %d wanted %d\n", ring->space, n); #ifdef XF86DRI - if(pI810->directRenderingEnabled) { + if (pI810->directRenderingEnabled) { DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]); } #endif - pI810->AccelInfoRec = NULL; /* Stops recursive behavior */ - FatalError("lockup\n"); + pI810->AccelInfoRec = NULL; /* Stops recursive behavior */ + FatalError("lockup\n"); } - for (i = 0 ; i < 2000 ; i++) - ; + DELAY(10000); } - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - { + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) { now = GetTimeInMillis(); if (now - first) { ErrorF("Elapsed %d ms\n", now - first); - ErrorF( "space: %d wanted %d\n", ring->space, n ); + ErrorF("space: %d wanted %d\n", ring->space, n); } } @@ -284,18 +290,18 @@ } void -I810Sync( ScrnInfoPtr pScrn ) +I810Sync(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL|DEBUG_VERBOSE_SYNC)) - ErrorF( "I810Sync\n"); - + if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC)) + ErrorF("I810Sync\n"); + #ifdef XF86DRI /* VT switching tries to do this. */ if (!pI810->LockHeld && pI810->directRenderingEnabled) { - return; + return; } #endif @@ -304,57 +310,55 @@ * flushes the internal graphics caches. */ { - BEGIN_LP_RING(2); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( 0 ); /* pad to quadword */ + BEGIN_LP_RING(2); + OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); + OUT_RING(0); /* pad to quadword */ ADVANCE_LP_RING(); } - I810WaitLpRing( pScrn, pI810->LpRing.mem.Size - 8, 0 ); + I810WaitLpRing(pScrn, pI810->LpRing.mem.Size - 8, 0); - pI810->LpRing.space = pI810->LpRing.mem.Size - 8; + pI810->LpRing.space = pI810->LpRing.mem.Size - 8; pI810->nextColorExpandBuf = 0; } -void +void I810SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810SetupForFillRectSolid color: %x rop: %x mask: %x\n", - color, rop, planemask); + ErrorF("I810SetupForFillRectSolid color: %x rop: %x mask: %x\n", + color, rop, planemask); /* Color blit, p166 */ - pI810->BR[13] = (BR13_SOLID_PATTERN | + pI810->BR[13] = (BR13_SOLID_PATTERN | (i810PatternRop[rop] << 16) | (pScrn->displayWidth * pI810->cpp)); pI810->BR[16] = color; } - -void +void I810SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) { I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810SubsequentFillRectSolid %d,%d %dx%d\n", - x,y,w,h); + ErrorF("I810SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h); - { + { BEGIN_LP_RING(6); - - OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); - OUT_RING( pI810->BR[13] ); - OUT_RING( (h << 16) | (w * pI810->cpp)); - OUT_RING( pI810->bufferOffset + - (y * pScrn->displayWidth + x) * pI810->cpp); - OUT_RING( pI810->BR[16]); - OUT_RING( 0 ); /* pad to quadword */ + OUT_RING(BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3); + OUT_RING(pI810->BR[13]); + OUT_RING((h << 16) | (w * pI810->cpp)); + OUT_RING(pI810->bufferOffset + + (y * pScrn->displayWidth + x) * pI810->cpp); + OUT_RING(pI810->BR[16]); + OUT_RING(0); /* pad to quadword */ + ADVANCE_LP_RING(); } } @@ -366,13 +370,13 @@ I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810SetupForScreenToScreenCopy %d %d %x %x %d\n", - xdir, ydir, rop, planemask, transparency_color); + ErrorF("I810SetupForScreenToScreenCopy %d %d %x %x %d\n", + xdir, ydir, rop, planemask, transparency_color); pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); - + if (ydir == -1) - pI810->BR[13] = (- pI810->BR[13]) & 0xFFFF; + pI810->BR[13] = (-pI810->BR[13]) & 0xFFFF; if (xdir == -1) pI810->BR[13] |= BR13_RIGHT_TO_LEFT; @@ -382,664 +386,277 @@ } void -I810SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, - int x2, int y2, int w, int h) +I810SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, + int x2, int y2, int w, int h) +{ + I810Ptr pI810 = I810PTR(pScrn); + int src, dst; + int w_back = w; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I810SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", + x1,y1,x2,y2,w,h); + /* + * This works around a bug in the i810 drawing engine. + * This was developed empirically so it may not catch all + * cases. + */ + if ( !(pI810->BR[13] & BR13_RIGHT_TO_LEFT) && (y2 - y1) < 3 + && (y2 - y1) >= 0 && (x2 - x1) <= (w + 4) && (w > 4)) + w = 4; + do { + + if (pI810->BR[13] & BR13_PITCH_SIGN_BIT) { + src = (y1 + h - 1) * pScrn->displayWidth * pI810->cpp; + dst = (y2 + h - 1) * pScrn->displayWidth * pI810->cpp; + } else { + src = y1 * pScrn->displayWidth * pI810->cpp; + dst = y2 * pScrn->displayWidth * pI810->cpp; + } + + if (pI810->BR[13] & BR13_RIGHT_TO_LEFT) { + src += (x1 + w - 1) * pI810->cpp + pI810->cpp - 1; + dst += (x2 + w - 1) * pI810->cpp + pI810->cpp - 1; + } else { + src += x1 * pI810->cpp; + dst += x2 * pI810->cpp; + } + + + /* SRC_COPY_BLT, p169 */ + { + BEGIN_LP_RING(6); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4 ); + OUT_RING( pI810->BR[13]); + + OUT_RING( (h << 16) | (w * pI810->cpp)); + OUT_RING( pI810->bufferOffset + dst); + + OUT_RING( pI810->BR[13] & 0xFFFF); + OUT_RING( pI810->bufferOffset + src); + ADVANCE_LP_RING(); + } + w_back -= w; + if (w_back <= 0) + break; + x2 += w; + x1 += w; + w = w_back; + } while (1); +} + +static void +I810SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, + int fg, int bg, int rop, + unsigned int planemask) { I810Ptr pI810 = I810PTR(pScrn); - int src, dst; if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", - x1,y1,x2,y2,w,h); - - if (pI810->BR[13] & BR13_PITCH_SIGN_BIT) { - src = (y1 + h - 1) * pScrn->displayWidth * pI810->cpp; - dst = (y2 + h - 1) * pScrn->displayWidth * pI810->cpp; - } else { - src = y1 * pScrn->displayWidth * pI810->cpp; - dst = y2 * pScrn->displayWidth * pI810->cpp; - } - - if (pI810->BR[13] & BR13_RIGHT_TO_LEFT) { - src += (x1 + w - 1) * pI810->cpp + pI810->cpp - 1; - dst += (x2 + w - 1) * pI810->cpp + pI810->cpp - 1; - } else { - src += x1 * pI810->cpp; - dst += x2 * pI810->cpp; - } - - - /* SRC_COPY_BLT, p169 */ - { - BEGIN_LP_RING(6); - OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4 ); - OUT_RING( pI810->BR[13] ); + ErrorF("I810SetupFor8x8PatternColorExpand\n"); - OUT_RING( (h << 16) | (w * pI810->cpp)); - OUT_RING( pI810->bufferOffset + dst ); - - OUT_RING( pI810->BR[13] & 0xFFFF ); - OUT_RING( pI810->bufferOffset + src ); - ADVANCE_LP_RING(); - } -} - -static void -I810SetupForMono8x8PatternFill( ScrnInfoPtr pScrn, int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask) -{ - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810SetupFor8x8PatternColorExpand\n"); - - /* FULL_MONO_PAT_BLT, p176 */ - pI810->BR[0] = (BR00_BITBLT_CLIENT | BR00_OP_MONO_PAT_BLT | 0x9 ); - pI810->BR[18] = bg; - pI810->BR[19] = fg; - pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); - pI810->BR[13] |= i810PatternRop[rop] << 16; - if (bg == -1) pI810->BR[13] |= BR13_MONO_TRANSPCY; + /* FULL_MONO_PAT_BLT, p176 */ + pI810->BR[0] = (BR00_BITBLT_CLIENT | BR00_OP_MONO_PAT_BLT | 0x9); + pI810->BR[18] = bg; + pI810->BR[19] = fg; + pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); + pI810->BR[13] |= i810PatternRop[rop] << 16; + if (bg == -1) + pI810->BR[13] |= BR13_MONO_TRANSPCY; } static void -I810SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, - int x, int y, int w, int h) +I810SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, + int x, int y, int w, int h) { I810Ptr pI810 = I810PTR(pScrn); - int addr = pI810->bufferOffset + (y * pScrn->displayWidth + x) * pI810->cpp; + int addr = + pI810->bufferOffset + (y * pScrn->displayWidth + x) * pI810->cpp; if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810Subsequent8x8PatternColorExpand\n"); + ErrorF("I810Subsequent8x8PatternColorExpand\n"); { - BEGIN_LP_RING( 12 ); - OUT_RING( pI810->BR[0] | ((y << 5) & BR00_PAT_VERT_ALIGN)); - OUT_RING( pI810->BR[13]); - OUT_RING( (h << 16) | (w * pI810->cpp)); - OUT_RING( addr ); - OUT_RING( pI810->BR[13] & 0xFFFF ); /* src pitch */ - OUT_RING( addr ); /* src addr */ - OUT_RING( 0 ); /* transparency color */ - OUT_RING( pI810->BR[18] ); /* bg */ - OUT_RING( pI810->BR[19] ); /* fg */ - OUT_RING( pattx ); /* pattern data */ - OUT_RING( patty ); - OUT_RING( 0 ); + BEGIN_LP_RING(12); + OUT_RING(pI810->BR[0] | ((y << 5) & BR00_PAT_VERT_ALIGN)); + OUT_RING(pI810->BR[13]); + OUT_RING((h << 16) | (w * pI810->cpp)); + OUT_RING(addr); + OUT_RING(pI810->BR[13] & 0xFFFF); /* src pitch */ + OUT_RING(addr); /* src addr */ + OUT_RING(0); /* transparency color */ + OUT_RING(pI810->BR[18]); /* bg */ + OUT_RING(pI810->BR[19]); /* fg */ + OUT_RING(pattx); /* pattern data */ + OUT_RING(patty); + OUT_RING(0); ADVANCE_LP_RING(); } } -static void -I810GetNextScanlineColorExpandBuffer( ScrnInfoPtr pScrn ) +static void +I810GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; - if (pI810->nextColorExpandBuf == pI810->NumScanlineColorExpandBuffers) - I810Sync( pScrn ); - - infoPtr->ScanlineColorExpandBuffers[0] = - pI810->ScanlineColorExpandBuffers[pI810->nextColorExpandBuf]; + if (pI810->nextColorExpandBuf == pI810->NumScanlineColorExpandBuffers) + I810Sync(pScrn); + infoPtr->ScanlineColorExpandBuffers[0] = + pI810->ScanlineColorExpandBuffers[pI810->nextColorExpandBuf]; + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "using color expand buffer %d\n", - pI810->nextColorExpandBuf); + ErrorF("using color expand buffer %d\n", pI810->nextColorExpandBuf); pI810->nextColorExpandBuf++; } static void -I810SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask ) +I810SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask) { I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( - "I810SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", - fg,bg,rop,planemask); + ErrorF("I810SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", + fg, bg, rop, planemask); pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); pI810->BR[13] |= i810Rop[rop] << 16; - pI810->BR[13] |= (1<<27); - if (bg == -1) pI810->BR[13] |= BR13_MONO_TRANSPCY; + pI810->BR[13] |= (1 << 27); + if (bg == -1) + pI810->BR[13] |= BR13_MONO_TRANSPCY; pI810->BR[18] = bg; pI810->BR[19] = fg; - I810GetNextScanlineColorExpandBuffer( pScrn ); + I810GetNextScanlineColorExpandBuffer(pScrn); } - -static void +static void I810SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft ) + int x, int y, + int w, int h, int skipleft) { I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( - "I810SubsequentScanlineCPUToScreenColorExpandFill " - "%d,%d %dx%x %d\n", - x,y,w,h,skipleft); - - pI810->BR[0] = BR00_BITBLT_CLIENT | BR00_OP_MONO_SRC_COPY_BLT | 0x06; - pI810->BR[9] = (pI810->bufferOffset + + ErrorF("I810SubsequentScanlineCPUToScreenColorExpandFill " + "%d,%d %dx%x %d\n", x, y, w, h, skipleft); + + pI810->BR[0] = BR00_BITBLT_CLIENT | BR00_OP_MONO_SRC_COPY_BLT | 0x06; + pI810->BR[9] = (pI810->bufferOffset + (y * pScrn->displayWidth + x) * pI810->cpp); - pI810->BR[14] = ( (1 << 16) | (w * pI810->cpp)); - pI810->BR[11] = ((w+31)/32)-1; + pI810->BR[14] = ((1 << 16) | (w * pI810->cpp)); + pI810->BR[11] = ((w + 31) / 32) - 1; } - -static void +static void I810SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { I810Ptr pI810 = I810PTR(pScrn); - pI810->BR[12] = (pI810->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI810->BR[12] = (pI810->AccelInfoRec->ScanlineColorExpandBuffers[0] - pI810->FbBase); if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I810SubsequentColorExpandScanline %d (addr %x)\n", - bufno, - pI810->BR[12]); - + ErrorF("I810SubsequentColorExpandScanline %d (addr %x)\n", + bufno, pI810->BR[12]); { - BEGIN_LP_RING( 8 ); - OUT_RING( pI810->BR[0]); - OUT_RING( pI810->BR[13]); - OUT_RING( pI810->BR[14] ); - OUT_RING( pI810->BR[9] ); - OUT_RING( pI810->BR[11] ); - OUT_RING( pI810->BR[12] ); /* srcaddr */ - OUT_RING( pI810->BR[18]); - OUT_RING( pI810->BR[19]); + BEGIN_LP_RING(8); + OUT_RING(pI810->BR[0]); + OUT_RING(pI810->BR[13]); + OUT_RING(pI810->BR[14]); + OUT_RING(pI810->BR[9]); + OUT_RING(pI810->BR[11]); + OUT_RING(pI810->BR[12]); /* srcaddr */ + OUT_RING(pI810->BR[18]); + OUT_RING(pI810->BR[19]); ADVANCE_LP_RING(); } /* Advance to next scanline. */ pI810->BR[9] += pScrn->displayWidth * pI810->cpp; - I810GetNextScanlineColorExpandBuffer( pScrn ); + I810GetNextScanlineColorExpandBuffer(pScrn); } - -void -I810EmitFlush( ScrnInfoPtr pScrn ) +void +I810EmitFlush(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - + BEGIN_LP_RING(2); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); - OUT_RING( 0 ); + OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); + OUT_RING(0); ADVANCE_LP_RING(); } - -void +void I810SelectBuffer(ScrnInfoPtr pScrn, int buffer) { I810Ptr pI810 = I810PTR(pScrn); switch (buffer) { - case I810_BACK: + case I810_SELECT_BACK: pI810->bufferOffset = pI810->BackBuffer.Start; break; - case I810_DEPTH: + case I810_SELECT_DEPTH: pI810->bufferOffset = pI810->DepthBuffer.Start; break; default: - case I810_FRONT: + case I810_SELECT_FRONT: pI810->bufferOffset = pI810->FrontBuffer.Start; break; } - if (I810_DEBUG&DEBUG_VERBOSE_ACCEL) - ErrorF("I810SelectBuffer %d --> offset %x\n", + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I810SelectBuffer %d --> offset %x\n", buffer, pI810->bufferOffset); } - -void +void I810RefreshRing(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - + pI810->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; pI810->LpRing.tail = INREG(LP_RING + RING_TAIL); - pI810->LpRing.space = pI810->LpRing.head - (pI810->LpRing.tail+8); - if (pI810->LpRing.space < 0) + pI810->LpRing.space = pI810->LpRing.head - (pI810->LpRing.tail + 8); + if (pI810->LpRing.space < 0) pI810->LpRing.space += pI810->LpRing.mem.Size; pI810->AccelInfoRec->NeedToSync = TRUE; } - /* Emit on gaining VT? */ -void +void I810EmitInvarientState(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - BEGIN_LP_RING( 10 ); + + BEGIN_LP_RING(10); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 ); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); - OUT_RING( 0 ); - - - OUT_RING( GFX_OP_COLOR_CHROMA_KEY ); - OUT_RING( CC1_UPDATE_KILL_WRITE | - CC1_DISABLE_KILL_WRITE | - CC1_UPDATE_COLOR_IDX | - CC1_UPDATE_CHROMA_LOW | - CC1_UPDATE_CHROMA_HI | - 0); - OUT_RING( 0 ); - OUT_RING( 0 ); + OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); + OUT_RING(GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0); + OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); + OUT_RING(0); + + OUT_RING(GFX_OP_COLOR_CHROMA_KEY); + OUT_RING(CC1_UPDATE_KILL_WRITE | + CC1_DISABLE_KILL_WRITE | + CC1_UPDATE_COLOR_IDX | + CC1_UPDATE_CHROMA_LOW | CC1_UPDATE_CHROMA_HI | 0); + OUT_RING(0); + OUT_RING(0); /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */ /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */ - - ADVANCE_LP_RING(); -} - -/* I830 Accel Functions */ - -static void I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask); -static void I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int pattx, int patty, - int x, int y, int w, int h); - -static void I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int mask); - -static void I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft ); - -static void I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - - -/* The following function sets up the supported acceleration. Call it - * from the FbInit() function in the SVGA driver, or before ScreenInit - * in a monolithic server. - */ -Bool -I830AccelInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) ErrorF("I830AccelInit\n"); - - pI810->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - pI810->bufferOffset = 0; - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; - - /* Use the same sync function as the I810. - */ - infoPtr->Sync = I810Sync; - - /* Everything else is different enough to justify different functions */ - { - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = I830SetupForSolidFill; - infoPtr->SubsequentSolidFillRect = I830SubsequentSolidFillRect; - } - - { - infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY); - - infoPtr->SetupForScreenToScreenCopy = I830SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = I830SubsequentScreenToScreenCopy; - } - - { - infoPtr->SetupForMono8x8PatternFill = I830SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - I830SubsequentMono8x8PatternFillRect; - - infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST | - NO_PLANEMASK); - - } - - if(pI810->Scratch.Size != 0) { - int i; - int width = ((pScrn->displayWidth + 31) & ~31) / 8; - int nr_buffers = pI810->Scratch.Size / width; - unsigned char *ptr = pI810->FbBase + pI810->Scratch.Start; - - pI810->NumScanlineColorExpandBuffers = nr_buffers; - pI810->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc( nr_buffers, sizeof (unsigned char *) ); - - for (i = 0 ; i < nr_buffers ; i++, ptr += width) - pI810->ScanlineColorExpandBuffers[i] = ptr; - - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - (NO_PLANEMASK | - ROP_NEEDS_SOURCE | - BIT_ORDER_IN_BYTE_MSBFIRST); - - infoPtr->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc( 1, sizeof (unsigned char *) ); - infoPtr->NumScanlineColorExpandBuffers = 1; - - infoPtr->ScanlineColorExpandBuffers[0] = - pI810->ScanlineColorExpandBuffers[0]; - pI810->nextColorExpandBuf = 0; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - I830SetupForScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - I830SubsequentScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentColorExpandScanline = - I830SubsequentColorExpandScanline; - } - - I810SelectBuffer(pScrn, I810_FRONT); - - return XAAInit(pScreen, infoPtr); -} - -void -I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830SetupForFillRectSolid color: %x rop: %x mask: %x\n", - color, rop, planemask); - - pI810->BR[13] = ((i810PatternRop[rop] << 16) | - (pScrn->displayWidth * pI810->cpp)); - - pI810->BR[16] = color; - - switch (pScrn->bitsPerPixel) { - case 8: break; - case 16: pI810->BR[13] |= (1<<24); break; - case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; - } -} - -void -I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830SubsequentFillRectSolid %d,%d %dx%d\n", - x,y,w,h); - - { - BEGIN_LP_RING(6); - - if(pScrn->bitsPerPixel == 32) { - OUT_RING(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA | COLOR_BLT_WRITE_RGB); - } else { - OUT_RING(COLOR_BLT_CMD); - } - OUT_RING(pI810->BR[13]); - OUT_RING((h << 16) | (w * pI810->cpp)); - OUT_RING(pI810->bufferOffset + (y * pScrn->displayWidth + x) * - pI810->cpp); - OUT_RING(pI810->BR[16]); - OUT_RING(0); - - ADVANCE_LP_RING(); - } -} - -void -I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, - unsigned int planemask, int transparency_color) -{ - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830SetupForScreenToScreenCopy %d %d %x %x %d\n", - xdir, ydir, rop, planemask, transparency_color); - - pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); - pI810->BR[13] |= i810Rop[rop] << 16; - - switch (pScrn->bitsPerPixel) { - case 8: break; - case 16: pI810->BR[13] |= (1<<24); break; - case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; - } - -} - -void -I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1, - int dst_x1, int dst_y1, int w, int h) -{ - I810Ptr pI810 = I810PTR(pScrn); - int dst_x2, dst_y2; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", - src_x1,src_y1,dst_x1,dst_y1,w,h); - - dst_x2 = dst_x1 + w; - dst_y2 = dst_y1 + h; - - { - BEGIN_LP_RING(8); - - if(pScrn->bitsPerPixel == 32) { - OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); - } else { - OUT_RING(XY_SRC_COPY_BLT_CMD); - } - OUT_RING(pI810->BR[13]); - OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff)); - OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff)); - OUT_RING(pI810->bufferOffset); - OUT_RING((src_y1 << 16) | (src_x1 & 0xffff)); - OUT_RING(pI810->BR[13] & 0xFFFF); - OUT_RING(pI810->bufferOffset); - - ADVANCE_LP_RING(); - } -} - -static void -I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask) -{ - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830SetupFor8x8PatternColorExpand\n"); - - pI810->BR[16] = pattx; - pI810->BR[17] = patty; - pI810->BR[18] = bg; - pI810->BR[19] = fg; - - pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); /* In bytes */ - pI810->BR[13] |= i810PatternRop[rop] << 16; - if (bg == -1) pI810->BR[13] |= (1<<28); - - switch (pScrn->bitsPerPixel) { - case 8: break; - case 16: pI810->BR[13] |= (1<<24); break; - case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; - } - -} - -static void -I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, - int x, int y, int w, int h) -{ - I810Ptr pI810 = I810PTR(pScrn); - int x1, x2, y1, y2; - - x1 = x; - x2 = x + w; - y1 = y; - y2 = y + h; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830Subsequent8x8PatternColorExpand\n"); - - { - BEGIN_LP_RING( 10 ); - - if(pScrn->bitsPerPixel == 32) { - OUT_RING(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA | - XY_MONO_PAT_BLT_WRITE_RGB | - ((patty << 8) & XY_MONO_PAT_VERT_SEED) | - ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); - } else { - OUT_RING(XY_MONO_PAT_BLT_CMD | - ((patty << 8) & XY_MONO_PAT_VERT_SEED) | - ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); - } - OUT_RING(pI810->BR[13]); - OUT_RING((y1 << 16) | x1); - OUT_RING((y2 << 16) | x2); - OUT_RING(pI810->bufferOffset); - OUT_RING(pI810->BR[18]); /* bg */ - OUT_RING(pI810->BR[19]); /* fg */ - OUT_RING(pI810->BR[16]); /* pattern data */ - OUT_RING(pI810->BR[17]); - OUT_RING(0); - ADVANCE_LP_RING(); - } -} - -static void -I830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; - - if (pI810->nextColorExpandBuf == pI810->NumScanlineColorExpandBuffers) - I810Sync( pScrn ); - - infoPtr->ScanlineColorExpandBuffers[0] = - pI810->ScanlineColorExpandBuffers[pI810->nextColorExpandBuf]; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "using color expand buffer %d\n", - pI810->nextColorExpandBuf); - - pI810->nextColorExpandBuf++; -} - -static void -I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) -{ - I810Ptr pI810 = I810PTR(pScrn); - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", - fg,bg,rop,planemask); - - /* Fill out register values */ - pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); - pI810->BR[13] |= i810Rop[rop] << 16; - if (bg == -1) pI810->BR[13] |= (1<<29); - - switch (pScrn->bitsPerPixel) { - case 8: break; - case 16: pI810->BR[13] |= (1<<24); break; - case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; - } - - pI810->BR[18] = bg; - pI810->BR[19] = fg; - - I830GetNextScanlineColorExpandBuffer( pScrn ); -} - -static void -I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - I810Ptr pI810 = I810PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill " - "%d,%d %dx%x %d\n", - x,y,w,h,skipleft); - - /* Fill out register values */ - pI810->BR[9] = (pI810->bufferOffset + - (y * pScrn->displayWidth + x) * pI810->cpp); - pI810->BR[11] = ((1 << 16) | w); + ADVANCE_LP_RING(); } -static void -I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - I810Ptr pI810 = I810PTR(pScrn); - - pI810->BR[12] = (pI810->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI810->FbBase); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "I830SubsequentColorExpandScanline %d (addr %x)\n", - bufno, - pI810->BR[12]); - - { - BEGIN_LP_RING( 8 ); - - if(pScrn->bitsPerPixel == 32) { - OUT_RING(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA | - XY_MONO_SRC_BLT_WRITE_RGB); - } else { - OUT_RING(XY_MONO_SRC_BLT_CMD); - } - OUT_RING(pI810->BR[13]); - OUT_RING(0); /* x1 = 0, y1 = 0 */ - OUT_RING(pI810->BR[11]); /* x2 = w, y2 = 1 */ - OUT_RING(pI810->BR[9]); /* dst addr */ - OUT_RING(pI810->BR[12]); /* src addr */ - OUT_RING( pI810->BR[18]); /* bg */ - OUT_RING( pI810->BR[19]); /* fg */ - - ADVANCE_LP_RING(); - } - - /* Advance to next scanline. - */ - pI810->BR[9] += pScrn->displayWidth * pI810->cpp; - I830GetNextScanlineColorExpandBuffer( pScrn ); -} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h:1.1 --- /dev/null Thu Feb 27 12:30:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h Tue Sep 10 20:29:31 2002 @@ -0,0 +1,188 @@ +/* i810_common.h -- common header definitions for I810 2D/3D/DRM suite + * + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Converted to common header format: + * Jens Owen <jens@tungstengraphics.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h,v 1.1 2002/09/11 00:29:31 dawes Exp $ + * + */ + +/* WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (i810_drm.h) + */ + +#ifndef _I810_COMMON_H_ +#define _I810_COMMON_H_ + +#ifndef _I810_DEFINES_ +#define _I810_DEFINES_ +#define I810_USE_BATCH 1 + +#define I810_DMA_BUF_ORDER 12 +#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) +#define I810_DMA_BUF_NR 256 + +#define I810_NR_SAREA_CLIPRECTS 8 + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define I810_NR_TEX_REGIONS 64 +#define I810_LOG_MIN_TEX_REGION_SIZE 16 + +/* Destbuffer state + * - backbuffer linear offset and pitch -- invarient in the current dri + * - zbuffer linear offset and pitch -- also invarient + * - drawing origin in back and depth buffers. + * + * Keep the depth/back buffer state here to acommodate private buffers + * in the future. + */ +#define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ +#define I810_DESTREG_DI1 1 +#define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ +#define I810_DESTREG_DV1 3 +#define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ +#define I810_DESTREG_DR1 5 +#define I810_DESTREG_DR2 6 +#define I810_DESTREG_DR3 7 +#define I810_DESTREG_DR4 8 +#define I810_DEST_SETUP_SIZE 10 + +/* Context state + */ +#define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ +#define I810_CTXREG_CF1 1 +#define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ +#define I810_CTXREG_ST1 3 +#define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ +#define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ +#define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ +#define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ +#define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ +#define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ +#define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ +#define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ +#define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ +#define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ +#define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ +#define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ +#define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ +#define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ +#define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ +#define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ +#define I810_CTX_SETUP_SIZE 20 + +/* Texture state (per tex unit) + */ +#define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ +#define I810_TEXREG_MI1 1 +#define I810_TEXREG_MI2 2 +#define I810_TEXREG_MI3 3 +#define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ +#define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ +#define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ +#define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ +#define I810_TEX_SETUP_SIZE 8 + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_I810_INIT 0x00 +#define DRM_I810_VERTEX 0x01 +#define DRM_I810_CLEAR 0x02 +#define DRM_I810_FLUSH 0x03 +#define DRM_I810_GETAGE 0x04 +#define DRM_I810_GETBUF 0x05 +#define DRM_I810_SWAP 0x06 +#define DRM_I810_COPY 0x07 +#define DRM_I810_DOCOPY 0x08 +#define DRM_I810_OV0INFO 0x09 +#define DRM_I810_FSTATUS 0x0a +#define DRM_I810_OV0FLIP 0x0b +#define DRM_I810_MC 0x0c +#define DRM_I810_RSTATUS 0x0d + +#endif + +typedef struct { + enum { + I810_INIT_DMA = 0x01, + I810_CLEANUP_DMA = 0x02 + } func; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_priv_offset; + unsigned int ring_start; + unsigned int ring_end; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int overlay_offset; + unsigned int overlay_physical; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; +} drmI810Init; + +typedef struct { + void *virtual; + int request_idx; + int request_size; + int granted; +} drmI810DMA; + +/* Flags for clear ioctl + */ +#define I810_FRONT 0x1 +#define I810_BACK 0x2 +#define I810_DEPTH 0x4 + +typedef struct { + int clear_color; + int clear_depth; + int flags; +} drmI810Clear; + +typedef struct { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + int discard; /* client is finished with the buffer? */ +} drmI810Vertex; + +/* Flags for vertex ioctl + */ +#define PR_TRIANGLES (0x0<<18) +#define PR_TRISTRIP_0 (0x1<<18) +#define PR_TRISTRIP_1 (0x2<<18) +#define PR_TRIFAN (0x3<<18) +#define PR_POLYGON (0x4<<18) +#define PR_LINES (0x5<<18) +#define PR_LINESTRIP (0x6<<18) +#define PR_RECTS (0x7<<18) +#define PR_MASK (0x7<<18) + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c:1.4 Wed Oct 10 10:08:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c Wed Oct 30 07:52:17 2002 @@ -25,11 +25,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c,v 1.4 2001/10/10 14:08:36 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c,v 1.7 2002/10/30 12:52:17 alanh Exp $ */ /* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> * */ @@ -46,119 +59,95 @@ static void I810ShowCursor(ScrnInfoPtr pScrn); static void I810HideCursor(ScrnInfoPtr pScrn); static void I810SetCursorColors(ScrnInfoPtr pScrn, int bg, int fb); +static void I810SetCursorPosition(ScrnInfoPtr pScrn, int x, int y); static Bool I810UseHWCursor(ScreenPtr pScrn, CursorPtr pCurs); Bool I810CursorInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn; - I810Ptr pI810; - xf86CursorInfoPtr infoPtr; - - pScrn = xf86Screens[pScreen->myNum]; - pI810 = I810PTR(pScrn); - pI810->CursorInfoRec = infoPtr = xf86CreateCursorInfoRec(); - if (!infoPtr) return FALSE; - - infoPtr->MaxWidth = 64; - infoPtr->MaxHeight = 64; - infoPtr->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + ScrnInfoPtr pScrn; + I810Ptr pI810; + xf86CursorInfoPtr infoPtr; + + pScrn = xf86Screens[pScreen->myNum]; + pI810 = I810PTR(pScrn); + pI810->CursorInfoRec = infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + + infoPtr->MaxWidth = 64; + infoPtr->MaxHeight = 64; + infoPtr->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | HARDWARE_CURSOR_INVERT_MASK | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | - 0); + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | 0); - infoPtr->SetCursorColors = I810SetCursorColors; - infoPtr->SetCursorPosition = I810SetCursorPosition; - infoPtr->LoadCursorImage = I810LoadCursorImage; - infoPtr->HideCursor = I810HideCursor; - infoPtr->ShowCursor = I810ShowCursor; - infoPtr->UseHWCursor = I810UseHWCursor; + infoPtr->SetCursorColors = I810SetCursorColors; + infoPtr->SetCursorPosition = I810SetCursorPosition; + infoPtr->LoadCursorImage = I810LoadCursorImage; + infoPtr->HideCursor = I810HideCursor; + infoPtr->ShowCursor = I810ShowCursor; + infoPtr->UseHWCursor = I810UseHWCursor; - if (!pI810->CursorPhysical) - return FALSE; - - return xf86InitCursor(pScreen, infoPtr); + return xf86InitCursor(pScreen, infoPtr); } static Bool -I810UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { +I810UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); - if (!pI810->CursorPhysical) return FALSE; - return TRUE; + if (!pI810->CursorPhysical) + return FALSE; + else + return TRUE; } static void -I810LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { - I810Ptr pI810 = I810PTR(pScrn); - CARD8 *pcurs = (CARD8 *)(pI810->FbBase + pI810->CursorStart); - int x, y; - - for (y = 0; y < 64; y++) { - for (x = 0; x < 64 / 4; x++) { - *pcurs++ = *src++; - } - } -} - -#define CURACNTR 0x70080 -#define CURSORA_DISABLE 0 -#define CURSORA_MODE_64_3C (1<<2) -#define CURSORA_MODE_64_AND_XOR ((1<<2)|(1)) -#define CURSORA_MODE_64_4C ((1<<2)|(1<<1)) -#define CURSORA_MODE_64_32BPP_AND_XOR ((1<<2)|(1<<1)|(1)) -#define CURSORA_MODE_64_32BPP_ARGB ((1<<5)|(1<<2)|(1<<1)|(1)) -#define CURSORA_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|(1<<7)|(1<<6)|(1<<4)) -#define CURABASE 0x70084 +I810LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +{ + I810Ptr pI810 = I810PTR(pScrn); + CARD8 *pcurs = (CARD8 *) (pI810->FbBase + pI810->CursorStart); + int x, y; -void + for (y = 0; y < 64; y++) { + for (x = 0; x < 64 / 4; x++) { + *pcurs++ = *src++; + } + } +} + +static void I810SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { I810Ptr pI810 = I810PTR(pScrn); int flag; -#if 0 - DPRINTF (PFX, - "%s %d %d\n" - "--> CURACNTR == 0x%.8x\n" - "--> CURBCNTR == 0x%.8x\n", - __FUNCTION__,x,y, - INREG (0x70080), - INREG (0x700C0)); -#endif - /* FIXME: hack to get around disappearing cursor problems. - * don't know why this work though. */ - if (IS_I830 (pI810)) - { - INREG (0x70080); - INREG (0x700C0); - } - x += pI810->CursorOffset; - if (x >= 0) flag = CURSOR_X_POS; + if (x >= 0) + flag = CURSOR_X_POS; else { flag = CURSOR_X_NEG; - x=-x; + x = -x; } - OUTREG8( CURSOR_X_LO, x&0xFF); - OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag)); + OUTREG8(CURSOR_X_LO, x & 0xFF); + OUTREG8(CURSOR_X_HI, (((x >> 8) & 0x07) | flag)); - if (y >= 0) flag = CURSOR_Y_POS; + if (y >= 0) + flag = CURSOR_Y_POS; else { flag = CURSOR_Y_NEG; - y=-y; + y = -y; } - OUTREG8( CURSOR_Y_LO, y&0xFF); - OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag)); + OUTREG8(CURSOR_Y_LO, y & 0xFF); + OUTREG8(CURSOR_Y_HI, (((y >> 8) & 0x07) | flag)); - /* FIXME */ - OUTREG(CURABASE, pI810->CursorPhysical); + OUTREG(CURSOR_BASEADDR, pI810->CursorPhysical); } static void @@ -166,79 +155,48 @@ { I810Ptr pI810 = I810PTR(pScrn); unsigned char tmp; - CARD32 temp; - if(IS_I830(pI810)) { - temp = INREG(CURACNTR); - temp &= CURSORA_RESERVED; - temp |= CURSORA_MODE_64_AND_XOR; - OUTREG(CURACNTR, temp); - OUTREG(CURABASE, pI810->CursorPhysical); - } else { - OUTREG( CURSOR_BASEADDR, pI810->CursorPhysical); - OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); - - tmp = INREG8( PIXPIPE_CONFIG_0 ); - tmp |= HW_CURSOR_ENABLE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); - } + OUTREG(CURSOR_BASEADDR, pI810->CursorPhysical); + OUTREG8(CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); + + tmp = INREG8(PIXPIPE_CONFIG_0); + tmp |= HW_CURSOR_ENABLE; + OUTREG8(PIXPIPE_CONFIG_0, tmp); } static void I810HideCursor(ScrnInfoPtr pScrn) { unsigned char tmp; - CARD32 temp; I810Ptr pI810 = I810PTR(pScrn); - if(IS_I830(pI810)) { - temp = INREG(CURACNTR); - temp &= CURSORA_RESERVED; - temp |= CURSORA_DISABLE; - OUTREG(CURACNTR, temp); - OUTREG(CURABASE, pI810->CursorPhysical); - } else { - tmp=INREG8( PIXPIPE_CONFIG_0 ); - tmp &= ~HW_CURSOR_ENABLE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); - } + tmp = INREG8(PIXPIPE_CONFIG_0); + tmp &= ~HW_CURSOR_ENABLE; + OUTREG8(PIXPIPE_CONFIG_0, tmp); } -#define CURAPALET0 0x70090 -#define CURAPALET1 0x70094 -#define CURAPALET2 0x70098 -#define CURAPALET3 0x7009c - static void I810SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { int tmp; I810Ptr pI810 = I810PTR(pScrn); - if(IS_I830(pI810)) { - OUTREG(CURAPALET0, bg & 0x00ffffff); - OUTREG(CURAPALET1, fg & 0x00ffffff); - OUTREG(CURAPALET2, fg & 0x00ffffff); - OUTREG(CURAPALET3, bg & 0x00ffffff); - } else { - tmp=INREG8(PIXPIPE_CONFIG_0); - tmp |= EXTENDED_PALETTE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); - - pI810->writeStandard(pI810, DACMASK, 0xFF); - pI810->writeStandard(pI810, DACWX, 0x04); - - pI810->writeStandard(pI810, DACDATA, (bg & 0x00FF0000) >> 16); - pI810->writeStandard(pI810, DACDATA, (bg & 0x0000FF00) >> 8); - pI810->writeStandard(pI810, DACDATA, (bg & 0x000000FF)); - - pI810->writeStandard(pI810, DACDATA, (fg & 0x00FF0000) >> 16); - pI810->writeStandard(pI810, DACDATA, (fg & 0x0000FF00) >> 8); - pI810->writeStandard(pI810, DACDATA, (fg & 0x000000FF)); - - tmp=INREG8( PIXPIPE_CONFIG_0 ); - tmp &= ~EXTENDED_PALETTE; - OUTREG8( PIXPIPE_CONFIG_0, tmp ); - } + tmp = INREG8(PIXPIPE_CONFIG_0); + tmp |= EXTENDED_PALETTE; + OUTREG8(PIXPIPE_CONFIG_0, tmp); + + pI810->writeStandard(pI810, DACMASK, 0xFF); + pI810->writeStandard(pI810, DACWX, 0x04); + + pI810->writeStandard(pI810, DACDATA, (bg & 0x00FF0000) >> 16); + pI810->writeStandard(pI810, DACDATA, (bg & 0x0000FF00) >> 8); + pI810->writeStandard(pI810, DACDATA, (bg & 0x000000FF)); + + pI810->writeStandard(pI810, DACDATA, (fg & 0x00FF0000) >> 16); + pI810->writeStandard(pI810, DACDATA, (fg & 0x0000FF00) >> 8); + pI810->writeStandard(pI810, DACDATA, (fg & 0x000000FF)); + + tmp = INREG8(PIXPIPE_CONFIG_0); + tmp &= ~EXTENDED_PALETTE; + OUTREG8(PIXPIPE_CONFIG_0, tmp); } - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c:1.4 Wed Oct 10 10:08:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c Tue Feb 25 23:19:36 2003 @@ -21,8 +21,21 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.4 2001/10/10 14:08:37 alanh Exp $ */ +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.6 2003/02/26 04:19:36 dawes Exp $ */ + #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -35,17 +48,18 @@ #include "dgaproc.h" #include "vgaHW.h" -static Bool I810_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, - int *, int *, int *); +static Bool I810_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); static Bool I810_SetMode(ScrnInfoPtr, DGAModePtr); static void I810_Sync(ScrnInfoPtr); -static int I810_GetViewport(ScrnInfoPtr); +static int I810_GetViewport(ScrnInfoPtr); static void I810_SetViewport(ScrnInfoPtr, int, int, int); static void I810_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void I810_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); + #if 0 -static void I810_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); +static void I810_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, + unsigned long); #endif static @@ -67,7 +81,7 @@ Bool I810DGAInit(ScreenPtr pScreen) -{ +{ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); DGAModePtr modes = NULL, newmodes = NULL, currentMode; @@ -79,116 +93,108 @@ pMode = firstMode = pScrn->modes; - while(pMode) { + while (pMode) { - newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); - if(!newmodes) { - xfree(modes); - return FALSE; - } - modes = newmodes; - - currentMode = modes + num; - num++; - - currentMode->mode = pMode; - currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - if(pI810->AccelInfoRec) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; - if(pMode->Flags & V_DBLSCAN) - currentMode->flags |= DGA_DOUBLESCAN; - if(pMode->Flags & V_INTERLACE) - currentMode->flags |= DGA_INTERLACED; - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = pScrn->depth; - currentMode->bitsPerPixel = pScrn->bitsPerPixel; - currentMode->red_mask = pScrn->mask.red; - currentMode->green_mask = pScrn->mask.green; - currentMode->blue_mask = pScrn->mask.blue; - currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = (Bpp == 3) ? 2 : 1; - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - currentMode->address = pI810->FbBase; - - currentMode->bytesPerScanline = - ((pScrn->displayWidth * Bpp) + 3) & ~3L; - currentMode->imageWidth = pI810->FbMemBox.x2; - currentMode->imageHeight = pI810->FbMemBox.y2; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - - pMode = pMode->next; - if(pMode == firstMode) - break; + if (!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + + currentMode = modes + num; + num++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + if (!pI810->noAccel) + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = (Bpp == 3) ? 2 : 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pI810->FbBase; + + currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pI810->FbMemBox.x2; + currentMode->imageHeight = pI810->FbMemBox.y2; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + pMode = pMode->next; + if (pMode == firstMode) + break; } pI810->numDGAModes = num; pI810->DGAModes = modes; - return DGAInit(pScreen, &I810DGAFuncs, modes, num); + return DGAInit(pScreen, &I810DGAFuncs, modes, num); } - static DisplayModePtr I810SavedDGAModes[MAXSCREENS]; static Bool -I810_SetMode( - ScrnInfoPtr pScrn, - DGAModePtr pMode -){ +I810_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) +{ int index = pScrn->pScreen->myNum; I810Ptr pI810 = I810PTR(pScrn); MARKER(); - if(!pMode) { /* restore the original mode */ - DPRINTF (PFX,"Restoring original mode (from DGA mode)\n"); - if(pI810->DGAactive) { - pScrn->currentMode = I810SavedDGAModes[index]; - pScrn->SwitchMode(index, pScrn->currentMode, 0); - pScrn->AdjustFrame(index, 0, 0, 0); - pI810->DGAactive = FALSE; - } + if (!pMode) { /* restore the original mode */ + DPRINTF(PFX, "Restoring original mode (from DGA mode)\n"); + if (pI810->DGAactive) { + pScrn->currentMode = I810SavedDGAModes[index]; + pScrn->SwitchMode(index, pScrn->currentMode, 0); + pScrn->AdjustFrame(index, 0, 0, 0); + pI810->DGAactive = FALSE; + } } else { - if(!pI810->DGAactive) { - DPRINTF (PFX,"Setting DGA mode\n"); - I810SavedDGAModes[index] = pScrn->currentMode; - pI810->DGAactive = TRUE; - } + if (!pI810->DGAactive) { + DPRINTF(PFX, "Setting DGA mode\n"); + I810SavedDGAModes[index] = pScrn->currentMode; + pI810->DGAactive = TRUE; + } - pScrn->SwitchMode(index, pMode->mode, 0); + pScrn->SwitchMode(index, pMode->mode, 0); } - + return TRUE; } -static int -I810_GetViewport( - ScrnInfoPtr pScrn -){ - I810Ptr pI810 = I810PTR(pScrn); +static int +I810_GetViewport(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); MARKER(); - return pI810->DGAViewportStatus; + return pI810->DGAViewportStatus; } -static void -I810_SetViewport( - ScrnInfoPtr pScrn, - int x, int y, - int flags -){ +static void +I810_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ I810Ptr pI810 = I810PTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -197,105 +203,91 @@ pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); /* wait for retrace */ - while((hwp->readST01(hwp) & 0x08)); - while(!(hwp->readST01(hwp) & 0x08)); + while ((hwp->readST01(hwp) & 0x08)) ; + while (!(hwp->readST01(hwp) & 0x08)) ; - pI810->DGAViewportStatus = 0; + pI810->DGAViewportStatus = 0; } -static void -I810_FillRect ( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned long color -){ - I810Ptr pI810 = I810PTR(pScrn); +static void +I810_FillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h, unsigned long color) +{ + I810Ptr pI810 = I810PTR(pScrn); MARKER(); - if(pI810->AccelInfoRec) { - (*pI810->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pI810->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pI810->AccelInfoRec); - } + if (pI810->AccelInfoRec) { + (*pI810->AccelInfoRec->SetupForSolidFill) (pScrn, color, GXcopy, ~0); + (*pI810->AccelInfoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); + SET_SYNC_FLAG(pI810->AccelInfoRec); + } } -static void -I810_Sync( - ScrnInfoPtr pScrn -){ - I810Ptr pI810 = I810PTR(pScrn); +static void +I810_Sync(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); MARKER(); - if(pI810->AccelInfoRec) { - (*pI810->AccelInfoRec->Sync)(pScrn); - } + if (pI810->AccelInfoRec) { + (*pI810->AccelInfoRec->Sync) (pScrn); + } } -static void -I810_BlitRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty -){ - I810Ptr pI810 = I810PTR(pScrn); +static void +I810_BlitRect(ScrnInfoPtr pScrn, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + I810Ptr pI810 = I810PTR(pScrn); MARKER(); - if(pI810->AccelInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pI810->AccelInfoRec->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pI810->AccelInfoRec->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pI810->AccelInfoRec); - } + if (pI810->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pI810->AccelInfoRec->SetupForScreenToScreenCopy) (pScrn, xdir, ydir, + GXcopy, ~0, -1); + (*pI810->AccelInfoRec->SubsequentScreenToScreenCopy) (pScrn, srcx, srcy, + dstx, dsty, w, h); + SET_SYNC_FLAG(pI810->AccelInfoRec); + } } #if 0 -static void -I810_BlitTransRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty, - unsigned long color -){ +static void +I810_BlitTransRect(ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, int dstx, int dsty, unsigned long color) +{ MARKER(); - /* this one should be separate since the XAA function would - prohibit usage of ~0 as the key */ + /* this one should be separate since the XAA function would + * prohibit usage of ~0 as the key */ } #endif -static Bool -I810_OpenFramebuffer( - ScrnInfoPtr pScrn, - char **name, - unsigned char **mem, - int *size, - int *offset, - int *flags -){ - I810Ptr pI810 = I810PTR(pScrn); +static Bool +I810_OpenFramebuffer(ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, int *size, int *offset, int *flags) +{ + I810Ptr pI810 = I810PTR(pScrn); MARKER(); - *name = NULL; /* no special device */ - *mem = (unsigned char*)pI810->LinearAddr; - *size = pI810->FbMapSize; - *offset = 0; - *flags = DGA_NEED_ROOT; - - DPRINTF (PFX, - " mem == 0x%.8x (pI810->LinearAddr)\n" - "size == %lu (pI810->FbMapSize)\n", - *mem,*size); + *name = NULL; /* no special device */ + *mem = (unsigned char *)pI810->LinearAddr; + *size = pI810->FbMapSize; + *offset = 0; + *flags = DGA_NEED_ROOT; + + DPRINTF(PFX, + " mem == 0x%.8x (pI810->LinearAddr)\n" + "size == %lu (pI810->FbMapSize)\n", *mem, *size); - return TRUE; + return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.25 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.25 Fri Dec 21 16:04:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c Mon Dec 9 20:27:04 2002 @@ -1,4 +1,16 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.25 2001/12/21 21:04:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.33 2002/12/10 01:27:04 dawes Exp $ */ +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,7 +46,7 @@ RegionPtr prgnSrc, CARD32 index); extern void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, + __GLXvisualConfig * configs, void **configprivs); static int i810_pitches[] = { @@ -46,38 +58,50 @@ }; static int i810_pitch_flags[] = { - 0x0, - 0x1, - 0x2, - 0x3, - 0 + 0x0, + 0x1, + 0x2, + 0x3, + 0 }; -Bool I810CleanupDma(ScrnInfoPtr pScrn) +Bool +I810CleanupDma(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - Bool ret_val; + drmI810Init info; + + memset(&info, 0, sizeof(drmI810Init)); + info.func = I810_CLEANUP_DMA; + + if (drmCommandWrite(pI810->drmSubFD, DRM_I810_INIT, + &info, sizeof(drmI810Init))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[dri] I810 Dma Cleanup Failed\n"); + return FALSE; + } - ret_val = drmI810CleanupDma(pI810->drmSubFD); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] I810 Dma Cleanup Failed\n"); - return ret_val; + return TRUE; } -Bool I810InitDma(ScrnInfoPtr pScrn) +Bool +I810InitDma(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); I810RingBuffer *ring = &(pI810->LpRing); I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate; drmI810Init info; - Bool ret_val; - info.start = ring->mem.Start; - info.end = ring->mem.End; - info.size = ring->mem.Size; + memset(&info, 0, sizeof(drmI810Init)); + + info.func = I810_INIT_DMA; + + info.ring_start = ring->mem.Start; + info.ring_end = ring->mem.End; + info.ring_size = ring->mem.Size; info.mmio_offset = (unsigned int)pI810DRI->regs; info.buffers_offset = (unsigned int)pI810->buffer_map; - info.sarea_off = sizeof(XF86DRISAREARec); + info.sarea_priv_offset = sizeof(XF86DRISAREARec); info.front_offset = 0; info.back_offset = pI810->BackBuffer.Start; @@ -89,12 +113,14 @@ info.pitch = pI810->auxPitch; info.pitch_bits = pI810->auxPitchBits; - ret_val = drmI810InitDma(pI810->drmSubFD, &info); - if(ret_val == FALSE) { + if (drmCommandWrite(pI810->drmSubFD, DRM_I810_INIT, + &info, sizeof(drmI810Init))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] I810 Dma Initialization failed.\n"); + "[drm] I810 Dma Initialization failed.\n"); + return FALSE; } - return ret_val; + + return TRUE; } static Bool @@ -117,79 +143,84 @@ case 16: numConfigs = 8; - pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), numConfigs); + pConfigs = + (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), + numConfigs); if (!pConfigs) return FALSE; - pI810Configs = (I810ConfigPrivPtr) xcalloc(sizeof(I810ConfigPrivRec), numConfigs); + pI810Configs = + (I810ConfigPrivPtr) xcalloc(sizeof(I810ConfigPrivRec), + numConfigs); if (!pI810Configs) { xfree(pConfigs); return FALSE; } - pI810ConfigPtrs = (I810ConfigPrivPtr *) xcalloc(sizeof(I810ConfigPrivPtr), numConfigs); + pI810ConfigPtrs = + (I810ConfigPrivPtr *) xcalloc(sizeof(I810ConfigPrivPtr), + numConfigs); if (!pI810ConfigPtrs) { xfree(pConfigs); xfree(pI810Configs); return FALSE; } - for (i=0; i<numConfigs; i++) + for (i = 0; i < numConfigs; i++) pI810ConfigPtrs[i] = &pI810Configs[i]; i = 0; depth = 1; for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= 1; stencil++) { - for (db = 1; db >= 0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 16; - } - else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - pConfigs[i].doubleBuffer = db ? TRUE : FALSE; - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; - if (depth) - pConfigs[i].depthSize = 16; - else - pConfigs[i].depthSize = 0; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (stencil || accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - pConfigs[i].visualRating = GLX_NONE_EXT; - pConfigs[i].transparentPixel = 0; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } + for (stencil = 0; stencil <= 1; stencil++) { + for (db = 1; db >= 0; db--) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 16; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + pConfigs[i].doubleBuffer = db ? TRUE : FALSE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if (depth) + pConfigs[i].depthSize = 16; + else + pConfigs[i].depthSize = 0; + if (stencil) + pConfigs[i].stencilSize = 8; + else + pConfigs[i].stencilSize = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (stencil || accum) + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + else + pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } } assert(i == numConfigs); break; @@ -197,19 +228,22 @@ pI810->numVisualConfigs = numConfigs; pI810->pVisualConfigs = pConfigs; pI810->pVisualConfigsPriv = pI810Configs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pI810ConfigPtrs); + GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pI810ConfigPtrs); return TRUE; } - -static unsigned int mylog2(unsigned int n) +static unsigned int +mylog2(unsigned int n) { unsigned int log2 = 1; - while (n>1) n >>= 1, log2++; + + while (n > 1) + n >>= 1, log2++; return log2; } -Bool I810DRIScreenInit(ScreenPtr pScreen) +Bool +I810DRIScreenInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); @@ -232,37 +266,39 @@ /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for known symbols in each module. */ - if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; - if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE; - if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; + if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) + return FALSE; + if (!xf86LoaderCheckSymbol("DRIScreenInit")) + return FALSE; + if (!xf86LoaderCheckSymbol("drmAvailable")) + return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] I810DRIScreenInit failed (libdri.a too old)\n"); + "[dri] I810DRIScreenInit failed (libdri.a too old)\n"); return FALSE; } /* Check the DRI version */ { int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); if (major != 4 || minor < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] I810DRIScreenInit failed because of a version mismatch.\n" - "[dri] libDRI version is %d.%d.%d bug version 4.0.x is needed.\n" - "[dri] Disabling DRI.\n", - major, minor, patch); - return FALSE; + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] I810DRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d bug version 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", major, minor, patch); + return FALSE; } } pDRIInfo = DRICreateInfoRec(); if (!pDRIInfo) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); + "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); return FALSE; } - /* pDRIInfo->wrap.ValidateTree = 0; */ /* pDRIInfo->wrap.PostValidateTree = 0; */ @@ -274,9 +310,9 @@ pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pI810->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pI810->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pI810->PciInfo->thisCard)->funcnum); + ((pciConfigPtr) pI810->PciInfo->thisCard)->busnum, + ((pciConfigPtr) pI810->PciInfo->thisCard)->devnum, + ((pciConfigPtr) pI810->PciInfo->thisCard)->funcnum); pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION; pDRIInfo->ddxDriverMinorVersion = I810_MINOR_VERSION; pDRIInfo->ddxDriverPatchVersion = I810_PATCHLEVEL; @@ -285,7 +321,7 @@ pScrn->virtualY * pI810->cpp) + 4096 - 1) / 4096) * 4096; - pDRIInfo->frameBufferStride = pScrn->displayWidth*pI810->cpp; + pDRIInfo->frameBufferStride = pScrn->displayWidth * pI810->cpp; pDRIInfo->ddxDrawableTableEntry = I810_MAX_DRAWABLES; if (SAREA_MAX_DRAWABLES < I810_MAX_DRAWABLES) @@ -296,15 +332,16 @@ /* For now the mapping works by using a fixed size defined * in the SAREA header */ - if (sizeof(XF86DRISAREARec)+sizeof(I810SAREARec)>SAREA_MAX) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] Data does not fit in SAREA\n"); + if (sizeof(XF86DRISAREARec) + sizeof(I810SAREARec) > SAREA_MAX) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] Data does not fit in SAREA\n"); return FALSE; } pDRIInfo->SAREASize = SAREA_MAX; - if (!(pI810DRI = (I810DRIPtr)xcalloc(sizeof(I810DRIRec),1))) { + if (!(pI810DRI = (I810DRIPtr) xcalloc(sizeof(I810DRIRec), 1))) { DRIDestroyInfoRec(pI810->pDRIInfo); - pI810->pDRIInfo=0; + pI810->pDRIInfo = 0; return FALSE; } pDRIInfo->devPrivate = pI810DRI; @@ -326,39 +363,78 @@ */ if (!DRIScreenInit(pScreen, pDRIInfo, &pI810->drmSubFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] DRIScreenInit failed. Disabling DRI.\n"); + "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate=0; + pDRIInfo->devPrivate = 0; DRIDestroyInfoRec(pI810->pDRIInfo); - pI810->pDRIInfo=0; + pI810->pDRIInfo = 0; return FALSE; } - /* Check the i810 DRM version */ + /* Check the i810 DRM versioning */ { - drmVersionPtr version = drmGetVersion(pI810->drmSubFD); + drmVersionPtr version; + + /* Check the DRM lib version. + * drmGetLibVersion was not supported in version 1.0, so check for + * symbol first to avoid possible crash or hang. + */ + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + version = drmGetLibVersion(pI810->drmSubFD); + } else + { + /* drmlib version 1.0.0 didn't have the drmGetLibVersion + * entry point. Fake it by allocating a version record + * via drmGetVersion and changing it to version 1.0.0 + */ + version = drmGetVersion(pI810->drmSubFD); + version->version_major = 1; + version->version_minor = 0; + version->version_patchlevel = 0; + } + +#define REQ_MAJ 1 +#define REQ_MIN 1 + if (version) { + if (version->version_major != REQ_MAJ || + version->version_minor < REQ_MIN) { + /* incompatible drm library version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] I810DRIScreenInit failed because of a version mismatch.\n" + "[dri] libdrm.a module version is %d.%d.%d but version %d.%d.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, version->version_patchlevel, + REQ_MAJ, REQ_MIN); + drmFreeVersion(version); + I810DRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } + + /* Check the i810 DRM version */ + version = drmGetVersion(pI810->drmSubFD); if (version) { - if (version->version_major != 1 || - version->version_minor < 2) { - /* incompatible drm version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] I810DRIScreenInit failed because of a version mismatch.\n" - "[dri] i810.o kernel module version is %d.%d.%d but version 1.2 or greater is needed.\n" - "[dri] Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel); - I810DRICloseScreen(pScreen); - drmFreeVersion(version); - return FALSE; - } - drmFreeVersion(version); + if (version->version_major != 1 || version->version_minor < 2) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] I810DRIScreenInit failed because of a version mismatch.\n" + "[dri] i810.o kernel module version is %d.%d.%d but version 1.2.0 or greater is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, version->version_patchlevel); + I810DRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + drmFreeVersion(version); } } - pI810DRI->regsSize=I810_REG_SIZE; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MMIOAddr, - pI810DRI->regsSize, DRM_REGISTERS, 0, &pI810DRI->regs)<0) { + pI810DRI->regsSize = I810_REG_SIZE; + if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->MMIOAddr, + pI810DRI->regsSize, DRM_REGISTERS, 0, &pI810DRI->regs) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n"); DRICloseScreen(pScreen); return FALSE; @@ -376,7 +452,7 @@ /* Agp Support - Need this just to get the framebuffer. */ - if(drmAgpAcquire(pI810->drmSubFD) < 0) { + if (drmAgpAcquire(pI810->drmSubFD) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAquire failed\n"); DRICloseScreen(pScreen); return FALSE; @@ -389,9 +465,9 @@ return FALSE; } - memset (&pI810->DcacheMem, 0, sizeof(I810MemRange)); - memset (&pI810->BackBuffer, 0, sizeof(I810MemRange)); - memset (&pI810->DepthBuffer, 0, sizeof(I810MemRange)); + memset(&pI810->DcacheMem, 0, sizeof(I810MemRange)); + memset(&pI810->BackBuffer, 0, sizeof(I810MemRange)); + memset(&pI810->DepthBuffer, 0, sizeof(I810MemRange)); pI810->CursorPhysical = 0; /* Dcache - half the speed of normal ram, but has use as a Z buffer @@ -400,10 +476,11 @@ drmAgpAlloc(pI810->drmSubFD, 4096 * 1024, 1, NULL, &dcacheHandle); pI810->dcacheHandle = dcacheHandle; - xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : %p\n", dcacheHandle); + xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : %p\n", + dcacheHandle); #define Elements(x) sizeof(x)/sizeof(*x) - for (pitch_idx = 0 ; pitch_idx < Elements(i810_pitches) ; pitch_idx++) + for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++) if (width <= i810_pitches[pitch_idx]) break; @@ -412,58 +489,54 @@ "[dri] Couldn't find depth/back buffer pitch"); DRICloseScreen(pScreen); return FALSE; - } - else { + } else { back_size = i810_pitches[pitch_idx] * (pScrn->virtualY + 4); back_size = ((back_size + 4096 - 1) / 4096) * 4096; } sysmem_size = pScrn->videoRam * 1024; if (dcacheHandle != 0) { - if (back_size > 4*1024*1024) { - xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] Backsize is larger then 4 meg\n"); - sysmem_size = sysmem_size - 2*back_size; + if (back_size > 4 * 1024 * 1024) { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[dri] Backsize is larger then 4 meg\n"); + sysmem_size = sysmem_size - 2 * back_size; drmAgpFree(pI810->drmSubFD, dcacheHandle); pI810->dcacheHandle = dcacheHandle = 0; - } - else { + } else { sysmem_size = sysmem_size - back_size; } - } - else { - sysmem_size = sysmem_size - 2*back_size; + } else { + sysmem_size = sysmem_size - 2 * back_size; } - /* Max size is 48 without XvMC, 41 with 6 surfaces, 40 with 7 surfaces */ - if(pI810->numSurfaces && (pI810->numSurfaces == 6)) { - if(sysmem_size > (pI810->FbMapSize - 7*1024*1024)) { - sysmem_size = (pI810->FbMapSize - 7*1024*1024); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "User requested more memory then fits in the agp aperture\n" - "Truncating to %d bytes of memory\n", - sysmem_size); - } - } - if(pI810->numSurfaces && (pI810->numSurfaces == 7)) { - if(sysmem_size > (pI810->FbMapSize - 8*1024*1024)) { - sysmem_size = (pI810->FbMapSize - 8*1024*1024); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "User requested more memory then fits in the agp aperture\n" - "Truncating to %d bytes of memory\n", - sysmem_size); - } + /* Max size is 48 without XvMC, 41 with 6 surfaces, 40 with 7 surfaces */ + if (pI810->numSurfaces && (pI810->numSurfaces == 6)) { + if (sysmem_size > (pI810->FbMapSize - 7 * 1024 * 1024)) { + sysmem_size = (pI810->FbMapSize - 7 * 1024 * 1024); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "User requested more memory then fits in the agp aperture\n" + "Truncating to %d bytes of memory\n", sysmem_size); + } } + if (pI810->numSurfaces && (pI810->numSurfaces == 7)) { + if (sysmem_size > (pI810->FbMapSize - 8 * 1024 * 1024)) { + sysmem_size = (pI810->FbMapSize - 8 * 1024 * 1024); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "User requested more memory then fits in the agp aperture\n" + "Truncating to %d bytes of memory\n", sysmem_size); + } + } - if(sysmem_size > pI810->FbMapSize) { + if (sysmem_size > pI810->FbMapSize) { sysmem_size = pI810->FbMapSize; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] User requested more memory then fits in the agp" " aperture\n\tTruncating to %d bytes of memory\n", - sysmem_size); + sysmem_size); } - sysmem_size -= 4096; /* remove 4k for the hw cursor */ + sysmem_size -= 4096; /* remove 4k for the hw cursor */ pI810->SysMem.Start = 0; pI810->SysMem.Size = sysmem_size; @@ -473,36 +546,37 @@ pI810->SavedSysMem = pI810->SysMem; if (dcacheHandle != 0) { - if(drmAgpBind(pI810->drmSubFD, dcacheHandle, pI810->DepthOffset) == 0) { - memset (&pI810->DcacheMem, 0, sizeof(I810MemRange)); + if (drmAgpBind(pI810->drmSubFD, dcacheHandle, pI810->DepthOffset) == 0) { + memset(&pI810->DcacheMem, 0, sizeof(I810MemRange)); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: Found 4096K Z buffer memory\n"); pI810->DcacheMem.Start = pI810->DepthOffset; pI810->DcacheMem.Size = 1024 * 4096; - pI810->DcacheMem.End = pI810->DcacheMem.Start + pI810->DcacheMem.Size; - if (!I810AllocLow(&(pI810->DepthBuffer), - &(pI810->DcacheMem), - back_size)) - { + pI810->DcacheMem.End = + pI810->DcacheMem.Start + pI810->DcacheMem.Size; + if (!I810AllocLow + (&(pI810->DepthBuffer), &(pI810->DcacheMem), back_size)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] Depth buffer allocation failed\n"); DRICloseScreen(pScreen); return FALSE; } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: dcache bind failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] GART: dcache bind failed\n"); drmAgpFree(pI810->drmSubFD, dcacheHandle); pI810->dcacheHandle = dcacheHandle = 0; } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: no dcache memory found\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] GART: no dcache memory found\n"); } drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); pI810->backHandle = agpHandle; if (agpHandle != 0) { - if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->BackOffset) == 0) { + if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->BackOffset) == 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] Bound backbuffer memory\n"); @@ -512,7 +586,7 @@ pI810->BackBuffer.Size); } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[agp] Unable to bind backbuffer. Disabling DRI.\n"); + "[agp] Unable to bind backbuffer. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } @@ -523,14 +597,14 @@ return FALSE; } - if(dcacheHandle == 0) { - drmAgpAlloc(pI810->drmSubFD, back_size, 0, - NULL, &agpHandle); + if (dcacheHandle == 0) { + drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); pI810->zHandle = agpHandle; - if(agpHandle != 0) { - if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->DepthOffset) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] Bound depthbuffer memory\n"); + if (agpHandle != 0) { + if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->DepthOffset) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] Bound depthbuffer memory\n"); pI810->DepthBuffer.Start = pI810->DepthOffset; pI810->DepthBuffer.Size = back_size; pI810->DepthBuffer.End = (pI810->DepthBuffer.Start + @@ -581,36 +655,35 @@ 42 - 42.5MB = 0.5MB Fence, 4 Tiles wide 40 - 42MB = 2MB Fence, 4 Tiles wide */ - if(pI810->numSurfaces) { - if(pI810->numSurfaces == 6) { - pI810->MC.Size = 7*1024*1024; - pI810->MC.Start = pI810->FbMapSize - 7*1024*1024; + if (pI810->numSurfaces) { + if (pI810->numSurfaces == 6) { + pI810->MC.Size = 7 * 1024 * 1024; + pI810->MC.Start = pI810->FbMapSize - 7 * 1024 * 1024; } - if(pI810->numSurfaces == 7) { - pI810->MC.Size = 8*1024*1024; - pI810->MC.Start = pI810->FbMapSize - 8*1024*1024; + if (pI810->numSurfaces == 7) { + pI810->MC.Size = 8 * 1024 * 1024; + pI810->MC.Start = pI810->FbMapSize - 8 * 1024 * 1024; } drmAgpAlloc(pI810->drmSubFD, pI810->MC.Size, 0, NULL, &agpHandle); pI810->xvmcHandle = agpHandle; if (agpHandle != 0) { - if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->MC.Start) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "GART: Allocated 7MB for HWMC\n"); - pI810->MC.End = pI810->MC.Start + pI810->MC.Size; - } - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: HWMC bind failed\n"); - pI810->MC.Start = 0; - pI810->MC.Size = 0; - pI810->MC.End = 0; - } + if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->MC.Start) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "GART: Allocated 7MB for HWMC\n"); + pI810->MC.End = pI810->MC.Start + pI810->MC.Size; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: HWMC bind failed\n"); + pI810->MC.Start = 0; + pI810->MC.Size = 0; + pI810->MC.End = 0; + } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: HWMC alloc failed\n"); - pI810->MC.Start = 0; - pI810->MC.Size = 0; - pI810->MC.End = 0; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: HWMC alloc failed\n"); + pI810->MC.Start = 0; + pI810->MC.Size = 0; + pI810->MC.End = 0; } pI810->xvmcContext = 0; } @@ -627,83 +700,62 @@ "[agp] GART: Allocated 4K for mouse cursor image\n"); pI810->CursorStart = tom; tom += 4096; - } - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor bind failed\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] GART: cursor bind failed\n"); pI810->CursorPhysical = 0; } - } - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor alloc failed\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] GART: cursor alloc failed\n"); pI810->CursorPhysical = 0; } /* Steal some of the excess cursor space for the overlay regs. */ - pI810->OverlayPhysical = pI810->CursorPhysical + 1024; - pI810->OverlayStart = pI810->CursorStart + 1024; - + pI810->OverlayPhysical = pI810->CursorPhysical + 1024; + pI810->OverlayStart = pI810->CursorStart + 1024; - - I810SetTiledMemory(pScrn, 1, pI810->DepthBuffer.Start, - i810_pitches[pitch_idx], - 8*1024*1024); + i810_pitches[pitch_idx], 8 * 1024 * 1024); I810SetTiledMemory(pScrn, 2, pI810->BackBuffer.Start, - i810_pitches[pitch_idx], - 8*1024*1024); - + i810_pitches[pitch_idx], 8 * 1024 * 1024); /* These are for HWMC surfaces */ - if(pI810->numSurfaces == 6) { - I810SetTiledMemory(pScrn, 3, - pI810->MC.Start, - 512, - 1024*1024); + if (pI810->numSurfaces == 6) { + I810SetTiledMemory(pScrn, 3, pI810->MC.Start, 512, 1024 * 1024); I810SetTiledMemory(pScrn, 4, - pI810->MC.Start + 1024*1024, - 512, - 1024*1024); + pI810->MC.Start + 1024 * 1024, 512, 1024 * 1024); I810SetTiledMemory(pScrn, 5, - pI810->MC.Start + 1024*1024*2, - 1024, - 1024*1024); + pI810->MC.Start + 1024 * 1024 * 2, + 1024, 1024 * 1024); I810SetTiledMemory(pScrn, 6, - pI810->MC.Start + 1024*1024*3, - 1024, - 4*1024*1024); - } - if(pI810->numSurfaces == 7) { - I810SetTiledMemory(pScrn, 3, - pI810->MC.Start, - 512, - 2*1024*1024); + pI810->MC.Start + 1024 * 1024 * 3, + 1024, 4 * 1024 * 1024); + } + if (pI810->numSurfaces == 7) { + I810SetTiledMemory(pScrn, 3, pI810->MC.Start, 512, 2 * 1024 * 1024); I810SetTiledMemory(pScrn, 4, - pI810->MC.Start + 2*1024*1024, - 512, - 512*1024); + pI810->MC.Start + 2 * 1024 * 1024, 512, 512 * 1024); I810SetTiledMemory(pScrn, 5, - pI810->MC.Start + 2*1024*1024 + 512*1024, - 1024, - 512*1024); + pI810->MC.Start + 2 * 1024 * 1024 + 512 * 1024, + 1024, 512 * 1024); I810SetTiledMemory(pScrn, 6, - pI810->MC.Start + 3*1024*1024, - 1024, - 1*1024*1024); + pI810->MC.Start + 3 * 1024 * 1024, + 1024, 1 * 1024 * 1024); I810SetTiledMemory(pScrn, 7, - pI810->MC.Start + 4*1024*1024, - 1024, - 4*1024*1024); + pI810->MC.Start + 4 * 1024 * 1024, + 1024, 4 * 1024 * 1024); } @@ -712,21 +764,21 @@ pI810->SavedDcacheMem = pI810->DcacheMem; pI810DRI->backbufferSize = pI810->BackBuffer.Size; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BackBuffer.Start, + if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->BackBuffer.Start, pI810->BackBuffer.Size, DRM_AGP, 0, &pI810DRI->backbuffer) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n"); + "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } pI810DRI->depthbufferSize = pI810->DepthBuffer.Size; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->DepthBuffer.Start, + if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->DepthBuffer.Start, pI810->DepthBuffer.Size, DRM_AGP, 0, &pI810DRI->depthbuffer) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(depthbuffer) failed. Disabling DRI.\n"); + "[drm] drmAddMap(depthbuffer) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } @@ -738,25 +790,24 @@ } /* Allocate buffer memory */ - I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), - I810_DMA_BUF_NR * I810_DMA_BUF_SZ); + I810AllocHigh(&(pI810->BufferMem), &(pI810->SysMem), + I810_DMA_BUF_NR * I810_DMA_BUF_SZ); xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] Buffer map : %lx\n", - pI810->BufferMem.Start); + pI810->BufferMem.Start); if (pI810->BufferMem.Start == 0 || - pI810->BufferMem.End - pI810->BufferMem.Start > - I810_DMA_BUF_NR * I810_DMA_BUF_SZ) { + pI810->BufferMem.End - pI810->BufferMem.Start > + I810_DMA_BUF_NR * I810_DMA_BUF_SZ) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] Not enough memory for dma buffers. Disabling DRI.\n"); + "[dri] Not enough memory for dma buffers. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BufferMem.Start, - pI810->BufferMem.Size, DRM_AGP, 0, - &pI810->buffer_map) < 0) { + if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->BufferMem.Start, + pI810->BufferMem.Size, DRM_AGP, 0, &pI810->buffer_map) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(buffer_map) failed. Disabling DRI.\n"); + "[drm] drmAddMap(buffer_map) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } @@ -764,11 +815,10 @@ pI810DRI->agp_buffers = pI810->buffer_map; pI810DRI->agp_buf_size = pI810->BufferMem.Size; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->LpRing.mem.Start, - pI810->LpRing.mem.Size, DRM_AGP, 0, - &pI810->ring_map) < 0) { + if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->LpRing.mem.Start, + pI810->LpRing.mem.Size, DRM_AGP, 0, &pI810->ring_map) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(ring_map) failed. Disabling DRI.\n"); + "[drm] drmAddMap(ring_map) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } @@ -782,43 +832,38 @@ i = I810_LOG_MIN_TEX_REGION_SIZE; pI810DRI->logTextureGranularity = i; - pI810DRI->textureSize = (pI810DRI->textureSize >> i) << i; /* truncate */ + pI810DRI->textureSize = (pI810DRI->textureSize >> i) << i; /* truncate */ - if(pI810DRI->textureSize < 512*1024) { + if (pI810DRI->textureSize < 512 * 1024) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Less then 512k memory left for textures. Disabling DRI.\n"); + "[drm] Less then 512k memory left for textures. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - I810AllocLow( &(pI810->TexMem), &(pI810->SysMem), - pI810DRI->textureSize); + I810AllocLow(&(pI810->TexMem), &(pI810->SysMem), pI810DRI->textureSize); - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->TexMem.Start, - pI810->TexMem.Size, DRM_AGP, 0, - &pI810DRI->textures) < 0) { + if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->TexMem.Start, + pI810->TexMem.Size, DRM_AGP, 0, &pI810DRI->textures) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(textures) failed. Disabling DRI.\n"); + "[drm] drmAddMap(textures) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - if((bufs = drmAddBufs(pI810->drmSubFD, - I810_DMA_BUF_NR, - I810_DMA_BUF_SZ, - DRM_AGP_BUFFER, pI810->BufferMem.Start)) <= 0) { + if ((bufs = drmAddBufs(pI810->drmSubFD, + I810_DMA_BUF_NR, + I810_DMA_BUF_SZ, + DRM_AGP_BUFFER, pI810->BufferMem.Start)) <= 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure adding %d %d byte DMA buffers. Disabling DRI.\n", - I810_DMA_BUF_NR, - I810_DMA_BUF_SZ); + I810_DMA_BUF_NR, I810_DMA_BUF_SZ); DRICloseScreen(pScreen); return FALSE; } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", - bufs, I810_DMA_BUF_SZ); - xf86EnablePciBusMaster(pI810->PciInfo, TRUE); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] added %d %d byte DMA buffers\n", bufs, I810_DMA_BUF_SZ); I810InitDma(pScrn); @@ -826,13 +871,13 @@ if (!pI810DRI->irq) { pI810DRI->irq = drmGetInterruptFromBusID(pI810->drmSubFD, - ((pciConfigPtr)pI810->PciInfo - ->thisCard)->busnum, - ((pciConfigPtr)pI810->PciInfo - ->thisCard)->devnum, - ((pciConfigPtr)pI810->PciInfo - ->thisCard)->funcnum); - if((drmCtlInstHandler(pI810->drmSubFD, pI810DRI->irq)) != 0) { + ((pciConfigPtr) pI810-> + PciInfo->thisCard)->busnum, + ((pciConfigPtr) pI810-> + PciInfo->thisCard)->devnum, + ((pciConfigPtr) pI810-> + PciInfo->thisCard)->funcnum); + if ((drmCtlInstHandler(pI810->drmSubFD, pI810DRI->irq)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure adding irq handler, there is a device " "already using that irq\n Consider rearranging your " @@ -843,41 +888,40 @@ } xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pI810DRI->irq); + "[drm] dma control initialized, using IRQ %d\n", pI810DRI->irq); - pI810DRI->deviceID=pI810->PciInfo->chipType; - pI810DRI->width=pScrn->virtualX; - pI810DRI->height=pScrn->virtualY; - pI810DRI->mem=pScrn->videoRam*1024; - pI810DRI->cpp=pI810->cpp; + pI810DRI->deviceID = pI810->PciInfo->chipType; + pI810DRI->width = pScrn->virtualX; + pI810DRI->height = pScrn->virtualY; + pI810DRI->mem = pScrn->videoRam * 1024; + pI810DRI->cpp = pI810->cpp; - pI810DRI->fbOffset=pI810->FrontBuffer.Start; - pI810DRI->fbStride=pI810->auxPitch; + pI810DRI->fbOffset = pI810->FrontBuffer.Start; + pI810DRI->fbStride = pI810->auxPitch; pI810DRI->bitsPerPixel = pScrn->bitsPerPixel; + pI810DRI->textureOffset = pI810->TexMem.Start; - pI810DRI->textureOffset=pI810->TexMem.Start; + pI810DRI->backOffset = pI810->BackBuffer.Start; + pI810DRI->depthOffset = pI810->DepthBuffer.Start; - pI810DRI->backOffset=pI810->BackBuffer.Start; - pI810DRI->depthOffset=pI810->DepthBuffer.Start; + pI810DRI->ringOffset = pI810->LpRing.mem.Start; + pI810DRI->ringSize = pI810->LpRing.mem.Size; - pI810DRI->ringOffset=pI810->LpRing.mem.Start; - pI810DRI->ringSize=pI810->LpRing.mem.Size; - pI810DRI->auxPitch = pI810->auxPitch; pI810DRI->auxPitchBits = pI810->auxPitchBits; pI810DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); if (!(I810InitVisualConfigs(pScreen))) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] I810InitVisualConfigs failed. Disabling DRI.\n"); + "[dri] I810InitVisualConfigs failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] visual configs initialized.\n"); pI810->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; return TRUE; @@ -891,14 +935,21 @@ I810CleanupDma(pScrn); - if(pI810->dcacheHandle) drmAgpFree(pI810->drmSubFD, pI810->dcacheHandle); - if(pI810->backHandle) drmAgpFree(pI810->drmSubFD, pI810->backHandle); - if(pI810->zHandle) drmAgpFree(pI810->drmSubFD, pI810->zHandle); - if(pI810->cursorHandle) drmAgpFree(pI810->drmSubFD, pI810->cursorHandle); - if(pI810->xvmcHandle) drmAgpFree(pI810->drmSubFD, pI810->xvmcHandle); - if(pI810->sysmemHandle) drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle); + if (pI810->dcacheHandle) + drmAgpFree(pI810->drmSubFD, pI810->dcacheHandle); + if (pI810->backHandle) + drmAgpFree(pI810->drmSubFD, pI810->backHandle); + if (pI810->zHandle) + drmAgpFree(pI810->drmSubFD, pI810->zHandle); + if (pI810->cursorHandle) + drmAgpFree(pI810->drmSubFD, pI810->cursorHandle); + if (pI810->xvmcHandle) + drmAgpFree(pI810->drmSubFD, pI810->xvmcHandle); + if (pI810->sysmemHandle) + drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle); - if(pI810->agpAcquired == TRUE) drmAgpRelease(pI810->drmSubFD); + if (pI810->agpAcquired == TRUE) + drmAgpRelease(pI810->drmSubFD); pI810->backHandle = 0; pI810->zHandle = 0; @@ -908,19 +959,20 @@ pI810->agpAcquired = FALSE; pI810->dcacheHandle = 0; - DRICloseScreen(pScreen); if (pI810->pDRIInfo) { if (pI810->pDRIInfo->devPrivate) { xfree(pI810->pDRIInfo->devPrivate); - pI810->pDRIInfo->devPrivate=0; + pI810->pDRIInfo->devPrivate = 0; } DRIDestroyInfoRec(pI810->pDRIInfo); - pI810->pDRIInfo=0; + pI810->pDRIInfo = 0; } - if (pI810->pVisualConfigs) xfree(pI810->pVisualConfigs); - if (pI810->pVisualConfigsPriv) xfree(pI810->pVisualConfigsPriv); + if (pI810->pVisualConfigs) + xfree(pI810->pVisualConfigs); + if (pI810->pVisualConfigsPriv) + xfree(pI810->pVisualConfigsPriv); } static Bool @@ -937,12 +989,12 @@ { } - Bool I810DRIFinishScreenInit(ScreenPtr pScreen) { - I810SAREARec *sPriv = (I810SAREARec *)DRIGetSAREAPrivate(pScreen); - memset( sPriv, 0, sizeof(sPriv) ); + I810SAREARec *sPriv = (I810SAREARec *) DRIGetSAREAPrivate(pScreen); + + memset(sPriv, 0, sizeof(sPriv)); return DRIFinishScreenInit(pScreen); } @@ -955,24 +1007,21 @@ I810Ptr pI810 = I810PTR(pScrn); if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { + oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) { if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (in)\n"); + if (!pScrn->vtSema) + return; pI810->LockHeld = 1; - I810RefreshRing( pScrn ); - } - else if (syncType == DRI_2D_SYNC && - oldContextType == DRI_NO_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { + I810RefreshRing(pScrn); + } else if (syncType == DRI_2D_SYNC && + oldContextType == DRI_NO_CONTEXT && + newContextType == DRI_2D_CONTEXT) { pI810->LockHeld = 0; if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (out)\n"); - } - else if (I810_DEBUG & DEBUG_VERBOSE_DRI) + } else if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (other)\n"); } @@ -986,13 +1035,13 @@ int nbox = REGION_NUM_RECTS(prgn); if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF( "I810DRIInitBuffers\n"); + ErrorF("I810DRIInitBuffers\n"); I810SetupForSolidFill(pScrn, 0, GXcopy, -1); while (nbox--) { - I810SelectBuffer(pScrn, I810_BACK); + I810SelectBuffer(pScrn, I810_SELECT_BACK); I810SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, - pbox->x2-pbox->x1, pbox->y2-pbox->y1); + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); pbox++; } @@ -1000,14 +1049,14 @@ */ pbox = REGION_RECTS(prgn); nbox = REGION_NUM_RECTS(prgn); - I810SelectBuffer(pScrn, I810_DEPTH); + I810SelectBuffer(pScrn, I810_SELECT_DEPTH); I810SetupForSolidFill(pScrn, 0xffff, GXcopy, -1); while (nbox--) { I810SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, - pbox->x2-pbox->x1, pbox->y2-pbox->y1); + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); pbox++; } - I810SelectBuffer(pScrn, I810_FRONT); + I810SelectBuffer(pScrn, I810_SELECT_FRONT); pI810->AccelInfoRec->NeedToSync = TRUE; } @@ -1044,23 +1093,24 @@ int dy = pParent->drawable.y - ptOldOrg.y; /* If the copy will overlap in Y, reverse the order */ - if (dy>0) { + if (dy > 0) { ydir = -1; - if (nbox>1) { + if (nbox > 1) { /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - if (!pboxNew1) return; - pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + pboxNew1 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + if (!pboxNew1) + return; + pptNew1 = (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if (!pptNew1) { DEALLOCATE_LOCAL(pboxNew1); return; } - pboxBase = pboxNext = pbox+nbox-1; + pboxBase = pboxNext = pbox + nbox - 1; while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; - pboxTmp = pboxNext+1; + pboxTmp = pboxNext + 1; pptTmp = pptSrc + (pboxTmp - pbox); while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; @@ -1079,16 +1129,18 @@ } /* If the regions will overlap in X, reverse the order */ - if (dx>0) { + if (dx > 0) { xdir = -1; if (nbox > 1) { /*reverse orderof rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + pboxNew2 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pptNew2 = (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if (!pboxNew2 || !pptNew2) { - if (pptNew2) DEALLOCATE_LOCAL(pptNew2); - if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); + if (pptNew2) + DEALLOCATE_LOCAL(pptNew2); + if (pboxNew2) + DEALLOCATE_LOCAL(pboxNew2); if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); @@ -1096,8 +1148,8 @@ return; } pboxBase = pboxNext = pbox; - while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) + while (pboxBase < pbox + nbox) { + while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; pptTmp = pptSrc + (pboxTmp - pbox); @@ -1121,7 +1173,7 @@ */ I810EmitFlush(pScrn); I810SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); - for ( ; nbox-- ; pbox++ ) { + for (; nbox--; pbox++) { int x1 = pbox->x1; int y1 = pbox->y1; @@ -1129,25 +1181,30 @@ int desty = y1 + dy; int w = pbox->x2 - x1 + 1; int h = pbox->y2 - y1 + 1; - - if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; - if ( desty < 0 ) y1 -= desty, h += desty, desty = 0; - if ( destx + w > screenwidth ) w = screenwidth - destx; - if ( desty + h > screenheight ) h = screenheight - desty; - if ( w <= 0 ) continue; - if ( h <= 0 ) continue; + if (destx < 0) + x1 -= destx, w += destx, destx = 0; + if (desty < 0) + y1 -= desty, h += desty, desty = 0; + if (destx + w > screenwidth) + w = screenwidth - destx; + if (desty + h > screenheight) + h = screenheight - desty; + if (w <= 0) + continue; + if (h <= 0) + continue; if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF( "MoveBuffers %d,%d %dx%d dx: %d dy: %d\n", - x1, y1, w, h, dx, dy); + ErrorF("MoveBuffers %d,%d %dx%d dx: %d dy: %d\n", + x1, y1, w, h, dx, dy); - I810SelectBuffer(pScrn, I810_BACK); + I810SelectBuffer(pScrn, I810_SELECT_BACK); I810SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); - I810SelectBuffer(pScrn, I810_DEPTH); + I810SelectBuffer(pScrn, I810_SELECT_DEPTH); I810SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); } - I810SelectBuffer(pScrn, I810_FRONT); + I810SelectBuffer(pScrn, I810_SELECT_FRONT); I810EmitFlush(pScrn); if (pboxNew2) { Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.6 Thu Oct 4 14:28:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h Mon Dec 9 20:27:04 2002 @@ -1,10 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.6 2001/10/04 18:28:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.10 2002/12/10 01:27:04 dawes Exp $ */ #ifndef _I810_DRI_ #define _I810_DRI_ -#include <xf86drm.h> -#include <xf86drmI810.h> +#include "xf86drm.h" +#include "i810_common.h" #define I810_MAX_DRAWABLES 256 @@ -24,7 +24,7 @@ drmHandle agp_buffers; drmSize agp_buf_size; - + int deviceID; int width; int height; @@ -57,16 +57,29 @@ /* WARNING: Do not change the SAREA structure without changing the kernel * as well */ +#define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ +#define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ +#define I810_UPLOAD_CTX 0x4 +#define I810_UPLOAD_BUFFERS 0x8 +#define I810_UPLOAD_TEX0 0x10 +#define I810_UPLOAD_TEX1 0x20 +#define I810_UPLOAD_CLIPRECTS 0x40 + typedef struct { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ } I810TexRegionRec, *I810TexRegionPtr; typedef struct { + unsigned int ContextState[I810_CTX_SETUP_SIZE]; + unsigned int BufferState[I810_DEST_SETUP_SIZE]; + unsigned int TexState[2][I810_TEX_SETUP_SIZE]; + unsigned int dirty; + unsigned int nbox; XF86DRIClipRectRec boxes[I810_NR_SAREA_CLIPRECTS]; - + /* Maintain an LRU of contiguous regions of texture space. If * you think you own a region of texture memory, and it has an * age different to the one you set, then you are mistaken and @@ -80,28 +93,30 @@ * texture space, and can make informed decisions as to which * areas to kick out. There is no need to choose whether to * kick out your own texture or someone else's - simply eject - * them all in LRU order. + * them all in LRU order. */ - I810TexRegionRec texList[I810_NR_TEX_REGIONS+1]; /* Last elt is sentinal */ - - int texAge; /* last time texture was uploaded */ - - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - - int ctxOwner; /* last context to upload state */ + I810TexRegionRec texList[I810_NR_TEX_REGIONS + 1]; /* Last elt is sentinal */ + + int texAge; /* last time texture was uploaded */ + + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + + int ctxOwner; /* last context to upload state */ + + int vertex_prim; + } I810SAREARec, *I810SAREAPtr; typedef struct { - /* Nothing here yet */ - int dummy; + /* Nothing here yet */ + int dummy; } I810ConfigPrivRec, *I810ConfigPrivPtr; typedef struct { - /* Nothing here yet */ - int dummy; + /* Nothing here yet */ + int dummy; } I810DRIContextRec, *I810DRIContextPtr; - #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.65 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.80 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.65 Wed Jan 9 11:02:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Tue Feb 25 23:19:36 2003 @@ -25,11 +25,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.65 2002/01/09 16:02:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.80 2003/02/26 04:19:36 dawes Exp $ */ /* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> * */ @@ -55,7 +68,6 @@ #include "mipointer.h" #include "micmap.h" - #include "fb.h" #include "miscstruct.h" #include "xf86xv.h" @@ -72,19 +84,22 @@ static void I810Identify(int flags); static Bool I810Probe(DriverPtr drv, int flags); +#ifndef I830_ONLY static Bool I810PreInit(ScrnInfoPtr pScrn, int flags); -static Bool I810ScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); +static Bool I810ScreenInit(int Index, ScreenPtr pScreen, int argc, + char **argv); static Bool I810EnterVT(int scrnIndex, int flags); static void I810LeaveVT(int scrnIndex, int flags); static Bool I810CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool I810SaveScreen(ScreenPtr pScreen, Bool unblank); static void I810FreeScreen(int scrnIndex, int flags); +static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, + int PowerManagermentMode, + int flags); static int I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); +#endif /* I830_ONLY */ -static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagermentMode, - int flags); DriverRec I810 = { I810_VERSION, @@ -96,49 +111,75 @@ 0 }; +/* *INDENT-OFF* */ /* Chipsets */ static SymTabRec I810Chipsets[] = { - { PCI_CHIP_I810, "i810"}, - { PCI_CHIP_I810_DC100, "i810-dc100"}, - { PCI_CHIP_I810_E, "i810e"}, - { PCI_CHIP_I815, "i815"}, - { PCI_CHIP_I830_M, "i830M"}, - { -1, NULL } +#ifndef I830_ONLY + {PCI_CHIP_I810, "i810"}, + {PCI_CHIP_I810_DC100, "i810-dc100"}, + {PCI_CHIP_I810_E, "i810e"}, + {PCI_CHIP_I815, "i815"}, +#endif + {PCI_CHIP_I830_M, "i830M"}, + {PCI_CHIP_845_G, "845G"}, + {PCI_CHIP_I855_GM, "852GM/855GM"}, + {PCI_CHIP_I865_G, "865G"}, + {-1, NULL} }; static PciChipsets I810PciChipsets[] = { - { PCI_CHIP_I810, PCI_CHIP_I810, RES_SHARED_VGA }, - { PCI_CHIP_I810_DC100, PCI_CHIP_I810_DC100, RES_SHARED_VGA }, - { PCI_CHIP_I810_E, PCI_CHIP_I810_E, RES_SHARED_VGA }, - { PCI_CHIP_I815, PCI_CHIP_I815, RES_SHARED_VGA }, - { PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } +#ifndef I830_ONLY + {PCI_CHIP_I810, PCI_CHIP_I810, RES_SHARED_VGA}, + {PCI_CHIP_I810_DC100, PCI_CHIP_I810_DC100, RES_SHARED_VGA}, + {PCI_CHIP_I810_E, PCI_CHIP_I810_E, RES_SHARED_VGA}, + {PCI_CHIP_I815, PCI_CHIP_I815, RES_SHARED_VGA}, +#endif + {PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA}, + {PCI_CHIP_845_G, PCI_CHIP_845_G, RES_SHARED_VGA}, + {PCI_CHIP_I855_GM, PCI_CHIP_I855_GM, RES_SHARED_VGA}, + {PCI_CHIP_I865_G, PCI_CHIP_I865_G, RES_SHARED_VGA}, + {-1, -1, RES_UNDEFINED } }; +#ifndef I830_ONLY +typedef enum { + OPTION_NOACCEL, + OPTION_SW_CURSOR, + OPTION_COLOR_KEY, + OPTION_CACHE_LINES, + OPTION_DAC_6BIT, + OPTION_DRI, + OPTION_NO_DDC, + OPTION_SHOW_CACHE, + OPTION_XVMC_SURFACES +} I810Opts; + static const OptionInfoRec I810Options[] = { - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE }, - { OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, - { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, - { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, - { OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, - { OPTION_XVMC_SURFACES, "XvMCSurfaces", OPTV_INTEGER, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE} + {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, + {OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, + {OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_SHOW_CACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_XVMC_SURFACES, "XvMCSurfaces", OPTV_INTEGER, {0}, FALSE}, + {-1, NULL, OPTV_NONE, {0}, FALSE} }; +/* *INDENT-ON* */ +#endif const char *I810vgahwSymbols[] = { "vgaHWFreeHWRec", "vgaHWGetHWRec", "vgaHWGetIOBase", "vgaHWGetIndex", - "vgaHWHandleColormaps", "vgaHWInit", "vgaHWLock", "vgaHWMapMem", "vgaHWProtect", "vgaHWRestore", - "vgaHWSave", + "vgaHWSave", "vgaHWSaveScreen", "vgaHWSetMmioFuncs", "vgaHWUnlock", @@ -153,12 +194,36 @@ }; const char *I810vbeSymbols[] = { + "VBEFreeModeInfo", + "VBEFreeVBEInfo", + "VBEGetModeInfo", + "VBEGetModePool", + "VBEGetVBEInfo", + "VBEGetVBEMode", "VBEInit", + "VBEPrintModes", + "VBESaveRestore", + "VBESetDisplayStart", + "VBESetGetDACPaletteFormat", + "VBESetGetLogicalScanlineLength", + "VBESetGetPaletteData", + "VBESetModeNames", + "VBESetModeParameters", + "VBESetVBEMode", + "VBEValidateModes", "vbeDoEDID", "vbeFree", NULL }; +#ifdef XFree86LOADER +static const char *vbeOptionalSymbols[] = { + "VBEDPMSSet", + "VBEGetPixelClock", + NULL +}; +#endif + const char *I810ddcSymbols[] = { "xf86PrintEDID", "xf86SetDDCproperties", @@ -174,14 +239,10 @@ }; const char *I810xaaSymbols[] = { - "XAACachePlanarMonoStipple", "XAACreateInfoRec", "XAADestroyInfoRec", - "XAAFillSolidRects" + "XAAFillSolidRects", "XAAInit", - "XAAOverlayFBfuncs", - "XAAScreenIndex", - "XAAStippleScanlineFuncLSBFirst", NULL }; @@ -192,6 +253,7 @@ NULL }; +#ifndef I830_ONLY #ifdef XFree86LOADER #ifdef XF86DRI static const char *drmSymbols[] = { @@ -203,53 +265,61 @@ "drmAgpEnable", "drmAgpFree", "drmAgpRelease", - "drmAvailable", "drmAuthMagic", + "drmCommandWrite", "drmCreateContext", "drmCtlInstHandler", "drmDestroyContext", "drmFreeVersion", "drmGetInterruptFromBusID", + "drmGetLibVersion", "drmGetVersion", - "drmI810CleanupDma", - "drmI810InitDma", - "drmI830CleanupDma", - "drmI830InitDma", NULL }; + static const char *driSymbols[] = { - "DRICloseScreen", - "DRICreateInfoRec", - "DRIDestroyInfoRec", - "DRIFinishScreenInit", - "DRIGetContext", - "DRIGetDrawableIndex", - "DRIGetSAREAPrivate", - "DRILock", - "DRIQueryVersion", - "DRIScreenInit", - "DRIUnlock", - "GlxSetVisualConfigs", - NULL + "DRICloseScreen", + "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", + "DRIGetSAREAPrivate", + "DRILock", + "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", + "GlxSetVisualConfigs", + NULL }; + #endif #endif +#ifdef XF86DRI +const char *I810shadowSymbols[] = { + "shadowInit", + "shadowSetup", + "shadowAdd", + NULL +}; +#endif +#endif /* I830_ONLY */ + #ifndef I810_DEBUG int I810_DEBUG = (0 /* | DEBUG_ALWAYS_SYNC */ -/* | DEBUG_VERBOSE_ACCEL */ +/* | DEBUG_VERBOSE_ACCEL */ /* | DEBUG_VERBOSE_SYNC */ /* | DEBUG_VERBOSE_VGA */ -/* | DEBUG_VERBOSE_RING */ -/* | DEBUG_VERBOSE_OUTREG */ +/* | DEBUG_VERBOSE_RING */ +/* | DEBUG_VERBOSE_OUTREG */ /* | DEBUG_VERBOSE_MEMORY */ -/* | DEBUG_VERBOSE_CURSOR */ - ); +/* | DEBUG_VERBOSE_CURSOR */ + ); #endif +#ifndef I830_ONLY #ifdef XF86DRI static int i810_pitches[] = { 512, @@ -259,13 +329,13 @@ 0 }; #endif +#endif #ifdef XFree86LOADER static MODULESETUPPROTO(i810Setup); -static XF86ModuleVersionInfo i810VersRec = -{ +static XF86ModuleVersionInfo i810VersRec = { "i810", MODULEVENDORSTRING, MODINFOSTRING1, @@ -275,17 +345,17 @@ ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, MOD_CLASS_VIDEODRV, - {0,0,0,0} + {0, 0, 0, 0} }; -XF86ModuleData i810ModuleData = {&i810VersRec, i810Setup, 0}; +XF86ModuleData i810ModuleData = { &i810VersRec, i810Setup, 0 }; static pointer i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = 0; - /* This module should be loaded only once, but check to be sure. + /* This module should be loaded only once, but check to be sure. */ if (!setupDone) { setupDone = 1; @@ -295,74 +365,88 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(I810vgahwSymbols, - I810fbSymbols, - I810xaaSymbols, - I810ramdacSymbols, + LoaderRefSymLists(I810vgahwSymbols, + I810fbSymbols, I810xaaSymbols, I810ramdacSymbols, #ifdef XF86DRI - drmSymbols, + drmSymbols, driSymbols, + I810shadowSymbols, #endif - I810vbeSymbols, - I810ddcSymbols, - I810int10Symbols, - NULL); + I810vbeSymbols, vbeOptionalSymbols, + I810ddcSymbols, I810int10Symbols, NULL); /* * The return value must be non-NULL on success even though there * is no TearDownProc. */ - return (pointer)1; + return (pointer) 1; } else { - if (errmaj) *errmaj = LDR_ONCEONLY; + if (errmaj) + *errmaj = LDR_ONCEONLY; return NULL; } } #endif +#ifndef I830_ONLY /* * I810GetRec and I810FreeRec -- * - * Private data for the driver is stored in the screen structure. + * Private data for the driver is stored in the screen structure. * These two functions create and destroy that private data. * */ static Bool -I810GetRec(ScrnInfoPtr pScrn) { - if (pScrn->driverPrivate) return TRUE; +I810GetRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate) + return TRUE; pScrn->driverPrivate = xnfcalloc(sizeof(I810Rec), 1); return TRUE; } static void -I810FreeRec(ScrnInfoPtr pScrn) { - if (!pScrn) return; - if (!pScrn->driverPrivate) return; +I810FreeRec(ScrnInfoPtr pScrn) +{ + if (!pScrn) + return; + if (!pScrn->driverPrivate) + return; xfree(pScrn->driverPrivate); - pScrn->driverPrivate=0; + pScrn->driverPrivate = 0; } +#endif /* * I810Identify -- * * Returns the string name for the driver based on the chipset. In this * case it will always be an I810, so we can return a static string. - * + * */ static void -I810Identify(int flags) { - xf86PrintChipsets(I810_NAME, "Driver for Intel i810 chipset", I810Chipsets); +I810Identify(int flags) +{ + xf86PrintChipsets(I810_NAME, "Driver for Intel Integrated Graphics Chipsets", + I810Chipsets); } const OptionInfoRec * I810AvailableOptions(int chipid, int busid) { - const OptionInfoRec *pOptions; - if ((pOptions = I830BIOSAvailableOptions (chipid,busid))) return pOptions; - return I810Options; +#ifndef I830_ONLY + const OptionInfoRec *pOptions; + + if ((pOptions = I830BIOSAvailableOptions(chipid, busid))) + return pOptions; + return I810Options; +#else + return I830BIOSAvailableOptions(chipid, busid); +#endif } + /* * I810Probe -- * @@ -371,74 +455,105 @@ * */ static Bool -I810Probe(DriverPtr drv, int flags) { +I810Probe(DriverPtr drv, int flags) +{ int i, numUsed, numDevSections, *usedChips; GDevPtr *devSections; Bool foundScreen = FALSE; - + pciVideoPtr *VideoInfo; + pciVideoPtr *ppPci; + PciChipsets *id; + /* - Find the config file Device sections that match this - driver, and return if there are none. - */ - if ((numDevSections = xf86MatchDevice(I810_DRIVER_NAME, &devSections))<=0) { + * Find the config file Device sections that match this + * driver, and return if there are none. + */ + if ((numDevSections = + xf86MatchDevice(I810_DRIVER_NAME, &devSections)) <= 0) { return FALSE; } - /* - Since these Probing is just checking the PCI data the server already - collected. - */ - if (!xf86GetPciVideoInfo()) return FALSE; - - /* Look for i810 devices */ + /* + * This probing is just checking the PCI data the server already + * collected. + */ + if (!(VideoInfo = xf86GetPciVideoInfo())) + return FALSE; + + /* + * Mobile platforms may have both function 0 and 1 active, but they + * are handled as a single entity. To make sure that the function 1 + * entity isn't assigned to a screen, check for and claim it here + * first. + * + * XXX If function 1's resources are ever needed, they'll need to be + * added to the screen and marked active. + */ + for (ppPci = VideoInfo; ppPci != NULL && *ppPci != NULL; ppPci++) { + if ((*ppPci)->vendor == PCI_VENDOR_INTEL && + (*ppPci)->func == 1) { + for (id = I810PciChipsets; id->PCIid != -1; id++) { + if (id->PCIid == (*ppPci)->chipType) { + /* Claim slot */ + if (xf86CheckPciSlot((*ppPci)->bus, (*ppPci)->device, + (*ppPci)->func)) { + xf86ClaimPciSlot((*ppPci)->bus, (*ppPci)->device, + (*ppPci)->func, drv, id->PCIid, + NULL, FALSE); + } + break; + } + } + } + } + + /* Look for Intel i8xx devices. */ numUsed = xf86MatchPciInstances(I810_NAME, PCI_VENDOR_INTEL, I810Chipsets, I810PciChipsets, devSections, numDevSections, drv, &usedChips); if (flags & PROBE_DETECT) { - if (numUsed > 0) + if (numUsed > 0) + foundScreen = TRUE; + } else { + for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + + /* Allocate new ScrnInfoRec and claim the slot */ + if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + I810PciChipsets, 0, 0, 0, 0, 0))) { + EntityInfoPtr pEnt; + + pEnt = xf86GetEntityInfo(usedChips[i]); + + pScrn->driverVersion = I810_VERSION; + pScrn->driverName = I810_DRIVER_NAME; + pScrn->name = I810_NAME; + pScrn->Probe = I810Probe; foundScreen = TRUE; - } else - for (i=0; i<numUsed; i++) { - ScrnInfoPtr pScrn = NULL; - /* Allocate new ScrnInfoRec and claim the slot */ - if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - I810PciChipsets, 0, 0, 0, 0, 0))){ - EntityInfoPtr pEnt; - - pEnt = xf86GetEntityInfo(usedChips[i]); - - if (pEnt->chipset == PCI_CHIP_I830_M) { - pScrn->driverVersion = I810_VERSION; - pScrn->driverName = I810_DRIVER_NAME; - pScrn->name = I810_NAME; - pScrn->Probe = I810Probe; - pScrn->PreInit = I830BIOSPreInit; - pScrn->ScreenInit = I830BIOSScreenInit; - pScrn->SwitchMode = I830BIOSSwitchMode; - pScrn->AdjustFrame = I830BIOSAdjustFrame; - pScrn->EnterVT = I830BIOSEnterVT; - pScrn->LeaveVT = I830BIOSLeaveVT; - pScrn->FreeScreen = I830BIOSFreeScreen; - pScrn->ValidMode = I810ValidMode; - foundScreen = TRUE; - } else { - pScrn->driverVersion = I810_VERSION; - pScrn->driverName = I810_DRIVER_NAME; - pScrn->name = I810_NAME; - pScrn->Probe = I810Probe; - pScrn->PreInit = I810PreInit; - pScrn->ScreenInit = I810ScreenInit; - pScrn->SwitchMode = I810SwitchMode; - pScrn->AdjustFrame = I810AdjustFrame; - pScrn->EnterVT = I810EnterVT; - pScrn->LeaveVT = I810LeaveVT; - pScrn->FreeScreen = I810FreeScreen; - pScrn->ValidMode = I810ValidMode; - foundScreen = TRUE; - } - } + switch (pEnt->chipset) { + case PCI_CHIP_I830_M: + case PCI_CHIP_845_G: + case PCI_CHIP_I855_GM: + case PCI_CHIP_I865_G: + I830InitpScrn(pScrn); + break; +#ifndef I830_ONLY + default: + pScrn->PreInit = I810PreInit; + pScrn->ScreenInit = I810ScreenInit; + pScrn->SwitchMode = I810SwitchMode; + pScrn->AdjustFrame = I810AdjustFrame; + pScrn->EnterVT = I810EnterVT; + pScrn->LeaveVT = I810LeaveVT; + pScrn->FreeScreen = I810FreeScreen; + pScrn->ValidMode = I810ValidMode; + break; +#endif + } + } + } } xfree(usedChips); @@ -447,40 +562,43 @@ return foundScreen; } +#ifndef I830_ONLY static void I810ProbeDDC(ScrnInfoPtr pScrn, int index) { - vbeInfoPtr pVbe; - if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(NULL,index); - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); - vbeFree(pVbe); - } + vbeInfoPtr pVbe; + + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL, index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } } static xf86MonPtr I810DoDDC(ScrnInfoPtr pScrn, int index) { - vbeInfoPtr pVbe; - xf86MonPtr MonInfo = NULL; - I810Ptr pI810 = I810PTR(pScrn); + vbeInfoPtr pVbe; + xf86MonPtr MonInfo = NULL; + I810Ptr pI810 = I810PTR(pScrn); - /* Honour Option "noDDC" */ - if (xf86ReturnOptValBool(pI810->Options, OPTION_NO_DDC, FALSE) ) { + /* Honour Option "noDDC" */ + if (xf86ReturnOptValBool(pI810->Options, OPTION_NO_DDC, FALSE)) { return MonInfo; - } + } - if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL,index))) { + if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL, index))) { xf86LoaderReqSymLists(I810vbeSymbols, NULL); MonInfo = vbeDoEDID(pVbe, NULL); - xf86PrintEDID( MonInfo ); + xf86PrintEDID(MonInfo); xf86SetDDCproperties(pScrn, MonInfo); vbeFree(pVbe); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "this driver cannot do DDC without VBE\n"); - } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "this driver cannot do DDC without VBE\n"); + } - return MonInfo; + return MonInfo; } /* @@ -491,38 +609,46 @@ * */ static Bool -I810PreInit(ScrnInfoPtr pScrn, int flags) { +I810PreInit(ScrnInfoPtr pScrn, int flags) +{ vgaHWPtr hwp; I810Ptr pI810; ClockRangePtr clockRanges; int i; MessageType from; int flags24; - rgb defaultWeight = {0, 0, 0}; + rgb defaultWeight = { 0, 0, 0 }; int mem; - if (pScrn->numEntities != 1) return FALSE; + if (pScrn->numEntities != 1) + return FALSE; /* Allocate driverPrivate */ - if (!I810GetRec(pScrn)) return FALSE; + if (!I810GetRec(pScrn)) + return FALSE; pI810 = I810PTR(pScrn); pI810->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - if (pI810->pEnt->location.type != BUS_PCI) return FALSE; + if (pI810->pEnt->location.type != BUS_PCI) + return FALSE; if (flags & PROBE_DETECT) { - I810ProbeDDC(pScrn, pI810->pEnt->index); - return TRUE; + I810ProbeDDC(pScrn, pI810->pEnt->index); + return TRUE; } /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; + if (!xf86LoadSubModule(pScrn, "vgahw")) + return FALSE; xf86LoaderReqSymLists(I810vgahwSymbols, NULL); /* Allocate a vgaHWRec */ - if (!vgaHWGetHWRec(pScrn)) return FALSE; + if (!vgaHWGetHWRec(pScrn)) + return FALSE; + hwp = VGAHWPTR(pScrn); + pI810->ioBase = hwp->PIOOffset; pI810->PciInfo = xf86GetPciInfoForEntity(pI810->pEnt->index); pI810->PciTag = pciTag(pI810->PciInfo->bus, pI810->PciInfo->device, @@ -535,7 +661,7 @@ /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; - flags24=Support24bppFb | PreferConvert32to24 | SupportConvert32to24; + flags24 = Support24bppFb | PreferConvert32to24 | SupportConvert32to24; if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) { return FALSE; } else { @@ -546,8 +672,8 @@ case 24: break; default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by i810 driver\n", + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by i810 driver\n", pScrn->depth); return FALSE; } @@ -555,28 +681,27 @@ xf86PrintDepthBpp(pScrn); switch (pScrn->bitsPerPixel) { - case 8: - case 16: - case 24: - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given bpp (%d) is not supported by i810 driver\n", - pScrn->bitsPerPixel); - return FALSE; + case 8: + case 16: + case 24: + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given bpp (%d) is not supported by i810 driver\n", + pScrn->bitsPerPixel); + return FALSE; } if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; - if (!xf86SetDefaultVisual(pScrn, -1)) + if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; /* We use a programmable clock */ pScrn->progClock = TRUE; - hwp = VGAHWPTR(pScrn); - pI810->cpp = pScrn->bitsPerPixel/8; + pI810->cpp = pScrn->bitsPerPixel / 8; /* Process the options */ xf86CollectOptions(pScrn, NULL); @@ -585,16 +710,22 @@ memcpy(pI810->Options, I810Options, sizeof(I810Options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI810->Options); - pScrn->rgbBits=8; + pScrn->rgbBits = 8; if (xf86ReturnOptValBool(pI810->Options, OPTION_DAC_6BIT, FALSE)) - pScrn->rgbBits=6; + pScrn->rgbBits = 6; + if (xf86ReturnOptValBool(pI810->Options, OPTION_SHOW_CACHE, FALSE)) + pI810->showCache = TRUE; + else + pI810->showCache = FALSE; + /* 6-BIT dac isn't reasonable for modes with > 8bpp */ if (xf86ReturnOptValBool(pI810->Options, OPTION_DAC_6BIT, FALSE) && - pScrn->bitsPerPixel>8) { + pScrn->bitsPerPixel > 8) { OptionInfoPtr ptr; - ptr=xf86TokenToOptinfo(pI810->Options, OPTION_DAC_6BIT); - ptr->found=FALSE; + + ptr = xf86TokenToOptinfo(pI810->Options, OPTION_DAC_6BIT); + ptr->found = FALSE; } /* Get DDC info from monitor */ @@ -603,7 +734,6 @@ */ pScrn->monitor->DDC = I810DoDDC(pScrn, pI810->pEnt->index); - /* We have to use PIO to probe, because we haven't mapped yet */ I810SetPIOAccess(pI810); @@ -615,14 +745,14 @@ pScrn->chipset = pI810->pEnt->device->chipset; from = X_CONFIG; } else if (pI810->pEnt->device->chipID >= 0) { - pScrn->chipset = (char *)xf86TokenToString(I810Chipsets, + pScrn->chipset = (char *)xf86TokenToString(I810Chipsets, pI810->pEnt->device->chipID); from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", pI810->pEnt->device->chipID); } else { from = X_PROBED; - pScrn->chipset = (char *)xf86TokenToString(I810Chipsets, + pScrn->chipset = (char *)xf86TokenToString(I810Chipsets, pI810->PciInfo->chipType); } if (pI810->pEnt->device->chipRev >= 0) { @@ -630,18 +760,18 @@ pI810->pEnt->device->chipRev); } - xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", - (pScrn->chipset!=NULL)?pScrn->chipset:"Unknown i810"); + xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", + (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i810"); if (pI810->pEnt->device->MemBase != 0) { pI810->LinearAddr = pI810->pEnt->device->MemBase; from = X_CONFIG; } else { if (pI810->PciInfo->memBase[1] != 0) { - pI810->LinearAddr = pI810->PciInfo->memBase[0]&0xFF000000; + pI810->LinearAddr = pI810->PciInfo->memBase[0] & 0xFF000000; from = X_PROBED; } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid FB address in PCI config space\n"); I810FreeRec(pScrn); return FALSE; @@ -655,7 +785,7 @@ from = X_CONFIG; } else { if (pI810->PciInfo->memBase[1]) { - pI810->MMIOAddr = pI810->PciInfo->memBase[1]&0xFFF80000; + pI810->MMIOAddr = pI810->PciInfo->memBase[1] & 0xFFF80000; from = X_PROBED; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -672,15 +802,15 @@ */ if (!xf86AgpGARTSupported()) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "AGP GART support is not available. Make sure your kernel has\n" - "\tagpgart support or that the agpgart kernel module is loaded.\n"); + "AGP GART support is not available. Make sure your kernel has\n" + "\tagpgart support or that the agpgart kernel module is loaded.\n"); return FALSE; } /* Find out memory bus frequency. */ { - unsigned long whtcfg_pamr_drp = pciReadLong(pI810->PciTag, + unsigned long whtcfg_pamr_drp = pciReadLong(pI810->PciTag, WHTCFG_PAMR_DRP); /* Need this for choosing watermarks. @@ -691,15 +821,13 @@ pI810->LmFreqSel = 100; } - - /* Default to 4MB framebuffer, which is sufficient for all * supported 2d resolutions. If the user has specified a different * size in the XF86Config, use that amount instead. - * + * * Changed to 8 Meg so we can have acceleration by default (Mark). */ - pScrn->videoRam = 8192; + pScrn->videoRam = 8192; from = X_DEFAULT; if (pI810->pEnt->device->videoRam) { pScrn->videoRam = pI810->pEnt->device->videoRam; @@ -714,7 +842,7 @@ from = X_PROBED; if (mem > (6 * 1024)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Reducing video memory to 4MB\n"); + "Reducing video memory to 4MB\n"); pScrn->videoRam = 4096; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Less than 6MB of AGP memory" @@ -724,17 +852,17 @@ } } - xf86DrvMsg(pScrn->scrnIndex, from, "Will alloc AGP framebuffer: %d kByte\n", - pScrn->videoRam); + xf86DrvMsg(pScrn->scrnIndex, from, + "Will alloc AGP framebuffer: %d kByte\n", pScrn->videoRam); - /* Calculate Fixed Offsets depending on graphics aperture size */ + /* Calculate Fixed Offsets depending on graphics aperture size */ { PCITAG bridge; long smram_miscc; - bridge = pciTag(0,0,0); /* This is always the host bridge */ + bridge = pciTag(0, 0, 0); /* This is always the host bridge */ smram_miscc = pciReadLong(bridge, SMRAM_MISCC); - if((smram_miscc & GFX_MEM_WIN_SIZE) == GFX_MEM_WIN_32M) { + if ((smram_miscc & GFX_MEM_WIN_SIZE) == GFX_MEM_WIN_32M) { pI810->FbMapSize = 0x1000000; pI810->DepthOffset = 0x1000000; pI810->BackOffset = 0x1800000; @@ -742,7 +870,7 @@ pI810->FbMapSize = 0x3000000; pI810->DepthOffset = 0x3000000; pI810->BackOffset = 0x3800000; - } + } } /* @@ -750,8 +878,8 @@ * here. */ { - Gamma zeros = {0.0, 0.0, 0.0}; - + Gamma zeros = { 0.0, 0.0, 0.0 }; + if (!xf86SetGamma(pScrn, zeros)) { return FALSE; } @@ -769,7 +897,7 @@ case 24: pI810->MaxClock = pI810->pEnt->device->dacSpeeds[DAC_BPP24]; break; - case 32: /* not supported */ + case 32: /* not supported */ pI810->MaxClock = pI810->pEnt->device->dacSpeeds[DAC_BPP32]; break; } @@ -787,14 +915,14 @@ case 24: pI810->MaxClock = 136000; break; - case 32: /* not supported */ + case 32: /* not supported */ pI810->MaxClock = 86000; } } clockRanges = xnfcalloc(sizeof(ClockRange), 1); - clockRanges->next=NULL; - clockRanges->minClock= 12000; /* !!! What's the min clock? !!! */ - clockRanges->maxClock=pI810->MaxClock; + clockRanges->next = NULL; + clockRanges->minClock = 12000; /* !!! What's the min clock? !!! */ + clockRanges->maxClock = pI810->MaxClock; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = TRUE; clockRanges->doubleScanAllowed = FALSE; @@ -802,15 +930,15 @@ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, #ifndef XF86DRI - 0, 320, 1600, 64*pScrn->bitsPerPixel, + 0, 320, 1600, 64 * pScrn->bitsPerPixel, #else - i810_pitches, 0, 0, 64*pScrn->bitsPerPixel, + i810_pitches, 0, 0, 64 * pScrn->bitsPerPixel, #endif 200, 1200, pScrn->display->virtualX, pScrn->display->virtualY, - pScrn->videoRam*1024, LOOKUP_BEST_REFRESH); + pScrn->videoRam * 1024, LOOKUP_BEST_REFRESH); - if (i==-1) { + if (i == -1) { I810FreeRec(pScrn); return FALSE; } @@ -837,7 +965,10 @@ } xf86LoaderReqSymLists(I810fbSymbols, NULL); - if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) + pI810->noAccel = TRUE; + + if (!pI810->noAccel) { if (!xf86LoadSubModule(pScrn, "xaa")) { I810FreeRec(pScrn); return FALSE; @@ -853,58 +984,46 @@ xf86LoaderReqSymLists(I810ramdacSymbols, NULL); } - if (xf86GetOptValInteger(pI810->Options, OPTION_COLOR_KEY, &(pI810->colorKey))) - { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video overlay key set to 0x%x\n", - pI810->colorKey); + if (xf86GetOptValInteger + (pI810->Options, OPTION_COLOR_KEY, &(pI810->colorKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "video overlay key set to 0x%x\n", pI810->colorKey); } else { - pI810->colorKey = (1 << pScrn->offset.red) | - (1 << pScrn->offset.green) | - (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + pI810->colorKey = (1 << pScrn->offset.red) | + (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - + 1) << pScrn->offset.blue); } - if (xf86GetOptValInteger(pI810->Options, OPTION_XVMC_SURFACES, - &(pI810->numSurfaces))) - { + &(pI810->numSurfaces))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "%d XvMC Surfaces Requested.\n", - pI810->numSurfaces); - if(pI810->numSurfaces > 7) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Using 7 XvMC Surfaces (Maximum Allowed).\n"); - pI810->numSurfaces = 7; - } - if(pI810->numSurfaces < 6) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Using 6 XvMC Surfaces (Minimum Allowed).\n"); - pI810->numSurfaces = 6; + pI810->numSurfaces); + if (pI810->numSurfaces > 7) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Using 7 XvMC Surfaces (Maximum Allowed).\n"); + pI810->numSurfaces = 7; + } + if (pI810->numSurfaces < 6) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Using 6 XvMC Surfaces (Minimum Allowed).\n"); + pI810->numSurfaces = 6; } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "XvMC is Disabled: use XvMCSurfaces config option to enable.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "XvMC is Disabled: use XvMCSurfaces config option to enable.\n"); pI810->numSurfaces = 0; } - - /* We wont be using the VGA access after the probe */ - { - resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, - {ResShrIoBlock,0x3C0,0x3DF}, - _END }; - resRange vgamem[] = {{ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - {ResShrMemBlock,0xB0000,0xB7FFF}, - _END }; - - I810SetMMIOAccess(pI810); - xf86SetOperatingState(vgaio, pI810->pEnt->index, ResUnusedOpr); - xf86SetOperatingState(vgamem, pI810->pEnt->index, ResDisableOpr); - } + /* We won't be using the VGA access after the probe */ + I810SetMMIOAccess(pI810); + xf86SetOperatingState(resVgaIo, pI810->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pI810->pEnt->index, ResDisableOpr); return TRUE; } -static Bool +static Bool I810MapMMIO(ScrnInfoPtr pScrn) { int mmioFlags; @@ -916,23 +1035,21 @@ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; #endif - pI810->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pI810->PciTag, - pI810->MMIOAddr, - I810_REG_SIZE); - if (!pI810->MMIOBase) return FALSE; + pI810->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pI810->PciTag, + pI810->MMIOAddr, I810_REG_SIZE); + if (!pI810->MMIOBase) + return FALSE; return TRUE; } - - -Bool +static Bool I810MapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); unsigned i; - for (i = 2 ; i < pI810->FbMapSize ; i <<= 1); + for (i = 2; i < pI810->FbMapSize; i <<= 1) ; pI810->FbMapSize = i; if (!I810MapMMIO(pScrn)) @@ -940,71 +1057,65 @@ pI810->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pI810->PciTag, - pI810->LinearAddr, - pI810->FbMapSize); - if (!pI810->FbBase) return FALSE; + pI810->LinearAddr, pI810->FbMapSize); + if (!pI810->FbBase) + return FALSE; pI810->LpRing.virtual_start = pI810->FbBase + pI810->LpRing.mem.Start; return TRUE; } -Bool -I810UnmapMem(ScrnInfoPtr pScrn) +static void +I810UnmapMMIO(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pI810->MMIOBase, I810_REG_SIZE); - pI810->MMIOBase=0; + xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->MMIOBase, + I810_REG_SIZE); + pI810->MMIOBase = 0; +} - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pI810->FbBase, pI810->FbMapSize); +static Bool +I810UnmapMem(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + + xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->FbBase, + pI810->FbMapSize); pI810->FbBase = 0; + I810UnmapMMIO(pScrn); return TRUE; } - /* Famous last words */ -void +void I810PrintErrorState(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - ErrorF( "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", - INREG(PGETBL_CTL), - INREG(PGE_ERR)); - - ErrorF( "ipeir: %lx iphdr: %lx\n", - INREG(IPEIR), - INREG(IPEHR)); - - ErrorF( "LP ring tail: %lx head: %lx len: %lx start %lx\n", - INREG(LP_RING + RING_TAIL), - INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - INREG(LP_RING + RING_LEN), - INREG(LP_RING + RING_START)); - - ErrorF( "eir: %x esr: %x emr: %x\n", - INREG16(EIR), - INREG16(ESR), - INREG16(EMR)); - - ErrorF( "instdone: %x instpm: %x\n", - INREG16(INST_DONE), - INREG8(INST_PM)); - - ErrorF( "memmode: %lx instps: %lx\n", - INREG(MEMMODE), - INREG(INST_PS)); - - ErrorF( "hwstam: %x ier: %x imr: %x iir: %x\n", - INREG16(HWSTAM), - INREG16(IER), - INREG16(IMR), - INREG16(IIR)); -} + ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", + INREG(PGETBL_CTL), INREG(PGE_ERR)); + + ErrorF("ipeir: %lx iphdr: %lx\n", INREG(IPEIR), INREG(IPEHR)); + + ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", + INREG(LP_RING + RING_TAIL), + INREG(LP_RING + RING_HEAD) & HEAD_ADDR, + INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); + + ErrorF("eir: %x esr: %x emr: %x\n", + INREG16(EIR), INREG16(ESR), INREG16(EMR)); + ErrorF("instdone: %x instpm: %x\n", INREG16(INST_DONE), INREG8(INST_PM)); + ErrorF("memmode: %lx instps: %lx\n", INREG(MEMMODE), INREG(INST_PS)); + + ErrorF("hwstam: %x ier: %x imr: %x iir: %x\n", + INREG16(HWSTAM), INREG16(IER), INREG16(IMR), INREG16(IIR)); +} + /* * I810Save -- * @@ -1013,7 +1124,8 @@ * mask out bits here - just read the registers. */ static void -DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts) +DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, + Bool saveFonts) { I810Ptr pI810; vgaHWPtr hwp; @@ -1027,12 +1139,12 @@ * in the generic VGA portion. */ if (saveFonts) - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_FONTS|VGA_SR_CMAP); + vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS | VGA_SR_CMAP); else - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_CMAP); + vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP); /* - * The port I/O code necessary to read in the extended registers + * The port I/O code necessary to read in the extended registers * into the fields of the vgaI810Rec structure goes here. */ i810Reg->IOControl = hwp->readCrtc(hwp, IO_CTNL); @@ -1042,23 +1154,23 @@ i810Reg->VideoClk2_N = INREG16(VCLK2_VCO_N); i810Reg->VideoClk2_DivisorSel = INREG8(VCLK2_VCO_DIV_SEL); - i810Reg->ExtVertTotal=hwp->readCrtc(hwp, EXT_VERT_TOTAL); - i810Reg->ExtVertDispEnd=hwp->readCrtc(hwp, EXT_VERT_DISPLAY); - i810Reg->ExtVertSyncStart=hwp->readCrtc(hwp, EXT_VERT_SYNC_START); - i810Reg->ExtVertBlankStart=hwp->readCrtc(hwp, EXT_VERT_BLANK_START); - i810Reg->ExtHorizTotal=hwp->readCrtc(hwp, EXT_HORIZ_TOTAL); - i810Reg->ExtHorizBlank=hwp->readCrtc(hwp, EXT_HORIZ_BLANK); - i810Reg->ExtOffset=hwp->readCrtc(hwp, EXT_OFFSET); - i810Reg->InterlaceControl=hwp->readCrtc(hwp, INTERLACE_CNTL); + i810Reg->ExtVertTotal = hwp->readCrtc(hwp, EXT_VERT_TOTAL); + i810Reg->ExtVertDispEnd = hwp->readCrtc(hwp, EXT_VERT_DISPLAY); + i810Reg->ExtVertSyncStart = hwp->readCrtc(hwp, EXT_VERT_SYNC_START); + i810Reg->ExtVertBlankStart = hwp->readCrtc(hwp, EXT_VERT_BLANK_START); + i810Reg->ExtHorizTotal = hwp->readCrtc(hwp, EXT_HORIZ_TOTAL); + i810Reg->ExtHorizBlank = hwp->readCrtc(hwp, EXT_HORIZ_BLANK); + i810Reg->ExtOffset = hwp->readCrtc(hwp, EXT_OFFSET); + i810Reg->InterlaceControl = hwp->readCrtc(hwp, INTERLACE_CNTL); i810Reg->PixelPipeCfg0 = INREG8(PIXPIPE_CONFIG_0); i810Reg->PixelPipeCfg1 = INREG8(PIXPIPE_CONFIG_1); i810Reg->PixelPipeCfg2 = INREG8(PIXPIPE_CONFIG_2); - i810Reg->DisplayControl = INREG8(DISPLAY_CNTL); + i810Reg->DisplayControl = INREG8(DISPLAY_CNTL); i810Reg->LMI_FIFO_Watermark = INREG(FWATER_BLC); - for (i = 0 ; i < 8 ; i++) - i810Reg->Fence[i] = INREG(FENCE+i*4); + for (i = 0; i < 8; i++) + i810Reg->Fence[i] = INREG(FENCE + i * 4); i810Reg->LprbTail = INREG(LP_RING + RING_TAIL); i810Reg->LprbHead = INREG(LP_RING + RING_HEAD); @@ -1067,8 +1179,8 @@ if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) && i810Reg->LprbLen & RING_VALID) { - I810PrintErrorState( pScrn ); - FatalError( "Active ring not flushed\n"); + I810PrintErrorState(pScrn); + FatalError("Active ring not flushed\n"); } } @@ -1078,7 +1190,7 @@ vgaHWPtr hwp; I810Ptr pI810; CARD32 temp; - + hwp = VGAHWPTR(pScrn); pI810 = I810PTR(pScrn); DoSave(pScrn, &hwp->SavedReg, &pI810->SavedReg, TRUE); @@ -1087,45 +1199,46 @@ temp |= 4; OUTREG(MEMMODE, temp); } - - -static void i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode ) +static void +i810PrintMode(vgaRegPtr vgaReg, I810RegPtr mode) { int i; ErrorF(" MiscOut: %x\n", vgaReg->MiscOutReg); - - ErrorF("SEQ: "); - for (i = 0 ; i < vgaReg->numSequencer ; i++) { - if ((i&7)==0) ErrorF("\n"); + ErrorF("SEQ: "); + for (i = 0; i < vgaReg->numSequencer; i++) { + if ((i & 7) == 0) + ErrorF("\n"); ErrorF(" %d: %x", i, vgaReg->Sequencer[i]); } ErrorF("\n"); - ErrorF("CRTC: "); - for (i = 0 ; i < vgaReg->numCRTC ; i++) { - if ((i&3)==0) ErrorF("\n"); + ErrorF("CRTC: "); + for (i = 0; i < vgaReg->numCRTC; i++) { + if ((i & 3) == 0) + ErrorF("\n"); ErrorF(" %d: %x", i, vgaReg->CRTC[i]); } ErrorF("\n"); - ErrorF("GFX: "); - for (i = 0 ; i < vgaReg->numGraphics ; i++) { - if ((i&7)==0) ErrorF("\n"); + ErrorF("GFX: "); + for (i = 0; i < vgaReg->numGraphics; i++) { + if ((i & 7) == 0) + ErrorF("\n"); ErrorF(" %d: %x", i, vgaReg->Graphics[i]); } ErrorF("\n"); - ErrorF("ATTR: "); - for (i = 0 ; i < vgaReg->numAttribute ; i++) { - if ((i&7)==0) ErrorF("\n"); + ErrorF("ATTR: "); + for (i = 0; i < vgaReg->numAttribute; i++) { + if ((i & 7) == 0) + ErrorF("\n"); ErrorF(" %d: %x", i, vgaReg->Attribute[i]); } ErrorF("\n"); - ErrorF(" DisplayControl: %x\n", mode->DisplayControl); ErrorF(" PixelPipeCfg0: %x\n", mode->PixelPipeCfg0); ErrorF(" PixelPipeCfg1: %x\n", mode->PixelPipeCfg1); @@ -1144,32 +1257,29 @@ ErrorF(" ExtHorizBlank: %x\n", mode->ExtHorizBlank); ErrorF(" ExtOffset: %x\n", mode->ExtOffset); ErrorF(" InterlaceControl: %x\n", mode->InterlaceControl); - ErrorF(" LMI_FIFO_Watermark: %x\n", mode->LMI_FIFO_Watermark); + ErrorF(" LMI_FIFO_Watermark: %x\n", mode->LMI_FIFO_Watermark); ErrorF(" LprbTail: %x\n", mode->LprbTail); ErrorF(" LprbHead: %x\n", mode->LprbHead); ErrorF(" LprbStart: %x\n", mode->LprbStart); ErrorF(" LprbLen: %x\n", mode->LprbLen); } - - - static void -DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, - Bool restoreFonts) { +DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, + Bool restoreFonts) +{ I810Ptr pI810; vgaHWPtr hwp; unsigned char temp; - unsigned int itemp; + unsigned int itemp; int i; pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); - - if (I810_DEBUG&DEBUG_VERBOSE_VGA) { + if (I810_DEBUG & DEBUG_VERBOSE_VGA) { ErrorF("Setting mode in I810Restore:\n"); - i810PrintMode( vgaReg, i810Reg ); + i810PrintMode(vgaReg, i810Reg); } vgaHWProtect(pScrn, TRUE); @@ -1177,17 +1287,17 @@ usleep(50000); /* Turn off DRAM Refresh */ - temp = INREG8( DRAM_ROW_CNTL_HI ); + temp = INREG8(DRAM_ROW_CNTL_HI); temp &= ~DRAM_REFRESH_RATE; temp |= DRAM_REFRESH_DISABLE; - OUTREG8( DRAM_ROW_CNTL_HI, temp ); + OUTREG8(DRAM_ROW_CNTL_HI, temp); - usleep(1000); /* Wait 1 ms */ + usleep(1000); /* Wait 1 ms */ /* Write the M, N and P values */ - OUTREG16( VCLK2_VCO_M, i810Reg->VideoClk2_M); - OUTREG16( VCLK2_VCO_N, i810Reg->VideoClk2_N); - OUTREG8( VCLK2_VCO_DIV_SEL, i810Reg->VideoClk2_DivisorSel); + OUTREG16(VCLK2_VCO_M, i810Reg->VideoClk2_M); + OUTREG16(VCLK2_VCO_N, i810Reg->VideoClk2_N); + OUTREG8(VCLK2_VCO_DIV_SEL, i810Reg->VideoClk2_DivisorSel); /* * Turn on 8 bit dac mode, if requested. This is needed to make @@ -1198,27 +1308,27 @@ * will be displayed on the screen. The only time this can happen * is at server startup time and when switching back from a VT. */ - temp = INREG8(PIXPIPE_CONFIG_0); - temp &= 0x7F; /* Save all but the 8 bit dac mode bit */ + temp = INREG8(PIXPIPE_CONFIG_0); + temp &= 0x7F; /* Save all but the 8 bit dac mode bit */ temp |= (i810Reg->PixelPipeCfg0 & DAC_8_BIT); - OUTREG8( PIXPIPE_CONFIG_0, temp ); + OUTREG8(PIXPIPE_CONFIG_0, temp); /* * Code to restore any SVGA registers that have been saved/modified - * goes here. Note that it is allowable, and often correct, to + * goes here. Note that it is allowable, and often correct, to * only modify certain bits in a register by a read/modify/write cycle. * * A special case - when using an external clock-setting program, * this function must not change bits associated with the clock * selection. This condition can be checked by the condition: * - * if (i810Reg->std.NoClock >= 0) - * restore clock-select bits. + * if (i810Reg->std.NoClock >= 0) + * restore clock-select bits. */ if (restoreFonts) - vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE|VGA_SR_CMAP); + vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS | VGA_SR_MODE | VGA_SR_CMAP); else - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_CMAP); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP); hwp->writeCrtc(hwp, EXT_VERT_TOTAL, i810Reg->ExtVertTotal); hwp->writeCrtc(hwp, EXT_VERT_DISPLAY, i810Reg->ExtVertDispEnd); @@ -1228,82 +1338,85 @@ hwp->writeCrtc(hwp, EXT_HORIZ_BLANK, i810Reg->ExtHorizBlank); hwp->writeCrtc(hwp, EXT_OFFSET, i810Reg->ExtOffset); - temp=hwp->readCrtc(hwp, INTERLACE_CNTL); + temp = hwp->readCrtc(hwp, INTERLACE_CNTL); temp &= ~INTERLACE_ENABLE; temp |= i810Reg->InterlaceControl; hwp->writeCrtc(hwp, INTERLACE_CNTL, temp); - temp=pI810->readControl(pI810, GRX, ADDRESS_MAPPING); - temp &= 0xE0; /* Save reserved bits 7:5 */ + temp = pI810->readControl(pI810, GRX, ADDRESS_MAPPING); + temp &= 0xE0; /* Save reserved bits 7:5 */ temp |= i810Reg->AddressMapping; pI810->writeControl(pI810, GRX, ADDRESS_MAPPING, temp); - - - /* Setting the OVRACT Register for video overlay*/ - OUTREG(0x6001C, (i810Reg->OverlayActiveEnd << 16) | i810Reg->OverlayActiveStart); - - - + /* Setting the OVRACT Register for video overlay */ + { + CARD32 LCD_TV_Control = INREG(LCD_TV_C); + + if(!(LCD_TV_Control & LCD_TV_ENABLE) + || (LCD_TV_Control & LCD_TV_VGAMOD)) { + OUTREG(LCD_TV_OVRACT, + (i810Reg->OverlayActiveEnd << 16) + | i810Reg->OverlayActiveStart); + } + } + /* Turn on DRAM Refresh */ - temp = INREG8( DRAM_ROW_CNTL_HI ); + temp = INREG8(DRAM_ROW_CNTL_HI); temp &= ~DRAM_REFRESH_RATE; temp |= DRAM_REFRESH_60HZ; - OUTREG8( DRAM_ROW_CNTL_HI, temp ); + OUTREG8(DRAM_ROW_CNTL_HI, temp); - temp = INREG8( BITBLT_CNTL ); + temp = INREG8(BITBLT_CNTL); temp &= ~COLEXP_MODE; temp |= i810Reg->BitBLTControl; - OUTREG8( BITBLT_CNTL, temp ); + OUTREG8(BITBLT_CNTL, temp); - temp = INREG8( DISPLAY_CNTL ); + temp = INREG8(DISPLAY_CNTL); temp &= ~(VGA_WRAP_MODE | GUI_MODE); temp |= i810Reg->DisplayControl; - OUTREG8( DISPLAY_CNTL, temp ); - + OUTREG8(DISPLAY_CNTL, temp); - temp = INREG8( PIXPIPE_CONFIG_0 ); - temp &= 0x64; /* Save reserved bits 6:5,2 */ + temp = INREG8(PIXPIPE_CONFIG_0); + temp &= 0x64; /* Save reserved bits 6:5,2 */ temp |= i810Reg->PixelPipeCfg0; - OUTREG8( PIXPIPE_CONFIG_0, temp ); + OUTREG8(PIXPIPE_CONFIG_0, temp); - temp = INREG8( PIXPIPE_CONFIG_2 ); - temp &= 0xF3; /* Save reserved bits 7:4,1:0 */ + temp = INREG8(PIXPIPE_CONFIG_2); + temp &= 0xF3; /* Save reserved bits 7:4,1:0 */ temp |= i810Reg->PixelPipeCfg2; - OUTREG8( PIXPIPE_CONFIG_2, temp ); + OUTREG8(PIXPIPE_CONFIG_2, temp); - temp = INREG8( PIXPIPE_CONFIG_1 ); + temp = INREG8(PIXPIPE_CONFIG_1); temp &= ~DISPLAY_COLOR_MODE; - temp &= 0xEF; /* Restore the CRT control bit */ + temp &= 0xEF; /* Restore the CRT control bit */ temp |= i810Reg->PixelPipeCfg1; - OUTREG8( PIXPIPE_CONFIG_1, temp ); - + OUTREG8(PIXPIPE_CONFIG_1, temp); + OUTREG16(EIR, 0); itemp = INREG(FWATER_BLC); - itemp &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK | - MM_BURST_LENGTH | MM_FIFO_WATERMARK ); + itemp &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK | + MM_BURST_LENGTH | MM_FIFO_WATERMARK); itemp |= i810Reg->LMI_FIFO_Watermark; OUTREG(FWATER_BLC, itemp); - - for (i = 0 ; i < 8 ; i++) { - OUTREG( FENCE+i*4, i810Reg->Fence[i] ); + for (i = 0; i < 8; i++) { + OUTREG(FENCE + i * 4, i810Reg->Fence[i]); if (I810_DEBUG & DEBUG_VERBOSE_VGA) - ErrorF("Fence Register : %x\n", i810Reg->Fence[i]); + ErrorF("Fence Register : %x\n", i810Reg->Fence[i]); } - + /* First disable the ring buffer (Need to wait for empty first?, if so * should probably do it before entering this section) */ itemp = INREG(LP_RING + RING_LEN); itemp &= ~RING_VALID_MASK; - OUTREG(LP_RING + RING_LEN, itemp ); + OUTREG(LP_RING + RING_LEN, itemp); /* Set up the low priority ring buffer. */ - OUTREG(LP_RING + RING_TAIL, 0 ); - OUTREG(LP_RING + RING_HEAD, 0 ); + OUTREG(LP_RING + RING_TAIL, 0); + OUTREG(LP_RING + RING_HEAD, 0); pI810->LpRing.head = 0; pI810->LpRing.tail = 0; @@ -1311,55 +1424,53 @@ itemp = INREG(LP_RING + RING_START); itemp &= ~(START_ADDR); itemp |= i810Reg->LprbStart; - OUTREG(LP_RING + RING_START, itemp ); + OUTREG(LP_RING + RING_START, itemp); itemp = INREG(LP_RING + RING_LEN); itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); itemp |= i810Reg->LprbLen; - OUTREG(LP_RING + RING_LEN, itemp ); + OUTREG(LP_RING + RING_LEN, itemp); if (!(vgaReg->Attribute[0x10] & 0x1)) { usleep(50000); if (restoreFonts) - vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE|VGA_SR_CMAP); + vgaHWRestore(pScrn, vgaReg, + VGA_SR_FONTS | VGA_SR_MODE | VGA_SR_CMAP); else - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_CMAP); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP); } vgaHWProtect(pScrn, FALSE); - temp=hwp->readCrtc(hwp, IO_CTNL); + temp = hwp->readCrtc(hwp, IO_CTNL); temp &= ~(EXTENDED_ATTR_CNTL | EXTENDED_CRTC_CNTL); temp |= i810Reg->IOControl; hwp->writeCrtc(hwp, IO_CTNL, temp); } - -void -I810SetRingRegs( ScrnInfoPtr pScrn ) { +static void +I810SetRingRegs(ScrnInfoPtr pScrn) +{ unsigned int itemp; I810Ptr pI810 = I810PTR(pScrn); - OUTREG(LP_RING + RING_TAIL, 0 ); - OUTREG(LP_RING + RING_HEAD, 0 ); + OUTREG(LP_RING + RING_TAIL, 0); + OUTREG(LP_RING + RING_HEAD, 0); itemp = INREG(LP_RING + RING_START); itemp &= ~(START_ADDR); itemp |= pI810->LpRing.mem.Start; - OUTREG(LP_RING + RING_START, itemp ); + OUTREG(LP_RING + RING_START, itemp); itemp = INREG(LP_RING + RING_LEN); - if (IS_I830 (pI810)) { - itemp &= ~(I830_RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); - } else { - itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); - } - itemp |= ((pI810->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID); - OUTREG(LP_RING + RING_LEN, itemp ); + itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + itemp |= ((pI810->LpRing.mem.Size - 4096) | RING_NO_REPORT | RING_VALID); + OUTREG(LP_RING + RING_LEN, itemp); } static void -I810Restore(ScrnInfoPtr pScrn) { +I810Restore(ScrnInfoPtr pScrn) +{ vgaHWPtr hwp; I810Ptr pI810; @@ -1383,7 +1494,7 @@ (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ static void -I810CalcVCLK( ScrnInfoPtr pScrn, double freq ) +I810CalcVCLK(ScrnInfoPtr pScrn, double freq) { I810Ptr pI810 = I810PTR(pScrn); I810RegPtr i810Reg = &pI810->ModeReg; @@ -1397,16 +1508,17 @@ double err_target = 0.001; double err_best = 999999.0; - p_best = p = log(MAX_VCO_FREQ/f_target)/log((double)2); + p_best = p = log(MAX_VCO_FREQ / f_target) / log((double)2); f_vco = f_target * (1 << p); n = 2; do { n++; m = f_vco / (REF_FREQ / (double)n) / (double)4.0 + 0.5; - if (m < 3) m = 3; - f_out = CALC_VCLK(m,n,p); - f_err = 1.0 - (f_target/f_out); + if (m < 3) + m = 3; + f_out = CALC_VCLK(m, n, p); + f_err = 1.0 - (f_target / f_out); if (fabs(f_err) < err_max) { m_best = m; n_best = n; @@ -1421,32 +1533,29 @@ n_best = n; } - i810Reg->VideoClk2_M = (m_best-2) & 0x3FF; - i810Reg->VideoClk2_N = (n_best-2) & 0x3FF; + i810Reg->VideoClk2_M = (m_best - 2) & 0x3FF; + i810Reg->VideoClk2_N = (n_best - 2) & 0x3FF; i810Reg->VideoClk2_DivisorSel = (p_best << 4); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting dot clock to %.1lf MHz " - "[ 0x%x 0x%x 0x%x ] " - "[ %d %d %d ]\n", - CALC_VCLK(m_best,n_best,p_best), - i810Reg->VideoClk2_M, - i810Reg->VideoClk2_N, - i810Reg->VideoClk2_DivisorSel, - m_best, n_best, p_best); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting dot clock to %.1lf MHz " "[ 0x%x 0x%x 0x%x ] " + "[ %d %d %d ]\n", CALC_VCLK(m_best, n_best, p_best), + i810Reg->VideoClk2_M, i810Reg->VideoClk2_N, + i810Reg->VideoClk2_DivisorSel, m_best, n_best, p_best); } static Bool -I810SetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) +I810SetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - I810Ptr pI810 = I810PTR(pScrn); + I810Ptr pI810 = I810PTR(pScrn); I810RegPtr i810Reg = &pI810->ModeReg; vgaRegPtr pVga = &VGAHWPTR(pScrn)->ModeReg; - double dclk = mode->Clock/1000.0; + double dclk = mode->Clock / 1000.0; switch (pScrn->bitsPerPixel) { case 8: - pVga->CRTC[0x13] = pScrn->displayWidth >> 3; - i810Reg->ExtOffset = pScrn->displayWidth >> 11; + pVga->CRTC[0x13] = pScrn->displayWidth >> 3; + i810Reg->ExtOffset = pScrn->displayWidth >> 11; i810Reg->PixelPipeCfg1 = DISPLAY_8BPP_MODE; i810Reg->BitBLTControl = COLEXP_8BPP; break; @@ -1457,15 +1566,15 @@ i810Reg->PixelPipeCfg1 = DISPLAY_16BPP_MODE; } pVga->CRTC[0x13] = pScrn->displayWidth >> 2; - i810Reg->ExtOffset = pScrn->displayWidth >> 10; + i810Reg->ExtOffset = pScrn->displayWidth >> 10; i810Reg->BitBLTControl = COLEXP_16BPP; /* Enable Palette Programming for Direct Color visuals. -jens */ i810Reg->PixelPipeCfg2 = DISPLAY_GAMMA_ENABLE; break; case 24: - pVga->CRTC[0x13] = (pScrn->displayWidth * 3) >> 3; - i810Reg->ExtOffset = (pScrn->displayWidth * 3) >> 11; + pVga->CRTC[0x13] = (pScrn->displayWidth * 3) >> 3; + i810Reg->ExtOffset = (pScrn->displayWidth * 3) >> 11; i810Reg->PixelPipeCfg1 = DISPLAY_24BPP_MODE; i810Reg->BitBLTControl = COLEXP_24BPP; @@ -1490,13 +1599,11 @@ i810Reg->IOControl = EXTENDED_CRTC_CNTL; /* Turn on linear and page mapping */ - i810Reg->AddressMapping = (LINEAR_MODE_ENABLE | - GTT_MEM_MAP_ENABLE); + i810Reg->AddressMapping = (LINEAR_MODE_ENABLE | GTT_MEM_MAP_ENABLE); /* Turn on GUI mode */ i810Reg->DisplayControl = HIRES_MODE; - /* Calculate the extended CRTC regs */ i810Reg->ExtVertTotal = (mode->CrtcVTotal - 2) >> 8; i810Reg->ExtVertDispEnd = (mode->CrtcVDisplay - 1) >> 8; @@ -1509,19 +1616,16 @@ * The following workarounds are needed to get video overlay working * at 1024x768 and 1280x1024 display resolutions. */ - if ((mode->CrtcVDisplay == 768) && (i810Reg->ExtVertBlankStart == 3)) - { - i810Reg->ExtVertBlankStart = 2; + if ((mode->CrtcVDisplay == 768) && (i810Reg->ExtVertBlankStart == 3)) { + i810Reg->ExtVertBlankStart = 2; } - if ((mode->CrtcVDisplay == 1024) && (i810Reg->ExtVertBlankStart == 4)) - { - i810Reg->ExtVertBlankStart = 3; + if ((mode->CrtcVDisplay == 1024) && (i810Reg->ExtVertBlankStart == 4)) { + i810Reg->ExtVertBlankStart = 3; } /* OVRACT Register */ - i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; - i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; - + i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; + i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; /* Turn on interlaced mode if necessary */ if (mode->Flags & V_INTERLACE) @@ -1546,14 +1650,14 @@ /* Calculate the FIFO Watermark and Burst Length. */ i810Reg->LMI_FIFO_Watermark = I810CalcWatermark(pScrn, dclk, FALSE); - + /* Setup the ring buffer */ i810Reg->LprbTail = 0; i810Reg->LprbHead = 0; i810Reg->LprbStart = pI810->LpRing.mem.Start; - if (i810Reg->LprbStart) - i810Reg->LprbLen = ((pI810->LpRing.mem.Size-4096) | + if (i810Reg->LprbStart) + i810Reg->LprbLen = ((pI810->LpRing.mem.Size - 4096) | RING_NO_REPORT | RING_VALID); else i810Reg->LprbLen = RING_INVALID; @@ -1573,7 +1677,8 @@ vgaHWUnlock(hwp); - if (!vgaHWInit(pScrn, mode)) return FALSE; + if (!vgaHWInit(pScrn, mode)) + return FALSE; /* * the KGA fix in vgaHW.c results in the first * scanline and the first character clock (8 pixels) @@ -1582,14 +1687,15 @@ * "theoretical" values corrects the problem. KAO. */ pVga = &VGAHWPTR(pScrn)->ModeReg; - pVga->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1 ) & 0x1F) | 0x80; - pVga->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1 ) & 0x20) << 2) - | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); + pVga->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80; + pVga->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2) + | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); pVga->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; pScrn->vtSema = TRUE; - if (!I810SetMode(pScrn, mode)) return FALSE; + if (!I810SetMode(pScrn, mode)) + return FALSE; #ifdef XF86DRI if (pI810->directRenderingEnabled) { @@ -1610,10 +1716,10 @@ return TRUE; } - static void -I810LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - VisualPtr pVisual) { +I810LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO * colors, VisualPtr pVisual) +{ I810Ptr pI810; vgaHWPtr hwp; int i, j, index; @@ -1622,13 +1728,13 @@ pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); - for (i=0; i<numColors; i++) { - index=indices[i]; - r=colors[index].red; - g=colors[index].green; - b=colors[index].blue; - for (j=0; j<8; j++) { - hwp->writeDacWriteAddr(hwp, (index<<3)+j); + for (i = 0; i < numColors; i++) { + index = indices[i]; + r = colors[index].red; + g = colors[index].green; + b = colors[index].blue; + for (j = 0; j < 8; j++) { + hwp->writeDacWriteAddr(hwp, (index << 3) + j); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); @@ -1637,8 +1743,9 @@ } static void -I810LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - VisualPtr pVisual) { +I810LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO * colors, VisualPtr pVisual) +{ I810Ptr pI810; vgaHWPtr hwp; int i, index; @@ -1648,53 +1755,53 @@ hwp = VGAHWPTR(pScrn); /* Load all four entries in each of the 64 color ranges. -jens */ - for (i=0; i<numColors; i++) { - index=indices[i/2]; - r=colors[index].red; - b=colors[index].blue; - index=indices[i]; - g=colors[index].green; + for (i = 0; i < numColors; i++) { + index = indices[i / 2]; + r = colors[index].red; + b = colors[index].blue; + index = indices[i]; + g = colors[index].green; - hwp->writeDacWriteAddr(hwp, index<<2); + hwp->writeDacWriteAddr(hwp, index << 2); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); - hwp->writeDacWriteAddr(hwp, (index<<2)+1); + hwp->writeDacWriteAddr(hwp, (index << 2) + 1); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); - hwp->writeDacWriteAddr(hwp, (index<<2)+2); + hwp->writeDacWriteAddr(hwp, (index << 2) + 2); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); - hwp->writeDacWriteAddr(hwp, (index<<2)+3); + hwp->writeDacWriteAddr(hwp, (index << 2) + 3); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); i++; - index=indices[i]; - g=colors[index].green; + index = indices[i]; + g = colors[index].green; - hwp->writeDacWriteAddr(hwp, index<<2); + hwp->writeDacWriteAddr(hwp, index << 2); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); - hwp->writeDacWriteAddr(hwp, (index<<2)+1); + hwp->writeDacWriteAddr(hwp, (index << 2) + 1); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); - hwp->writeDacWriteAddr(hwp, (index<<2)+2); + hwp->writeDacWriteAddr(hwp, (index << 2) + 2); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); - hwp->writeDacWriteAddr(hwp, (index<<2)+3); + hwp->writeDacWriteAddr(hwp, (index << 2) + 3); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); @@ -1702,8 +1809,9 @@ } static void -I810LoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - VisualPtr pVisual) { +I810LoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO * colors, VisualPtr pVisual) +{ I810Ptr pI810; vgaHWPtr hwp; int i, index; @@ -1712,11 +1820,11 @@ pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); - for (i=0; i<numColors; i++) { - index=indices[i]; - r=colors[index].red; - g=colors[index].green; - b=colors[index].blue; + for (i = 0; i < numColors; i++) { + index = indices[i]; + r = colors[index].red; + g = colors[index].green; + b = colors[index].blue; hwp->writeDacWriteAddr(hwp, index); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); @@ -1725,19 +1833,20 @@ } Bool -I810AllocateFront(ScrnInfoPtr pScrn) { +I810AllocateFront(ScrnInfoPtr pScrn) +{ I810Ptr pI810 = I810PTR(pScrn); int cache_lines = -1; - if(pI810->DoneFrontAlloc) + if (pI810->DoneFrontAlloc) return TRUE; - + memset(&(pI810->FbMemBox), 0, sizeof(BoxRec)); /* Alloc FrontBuffer/Ring/Accel memory */ - pI810->FbMemBox.x1=0; - pI810->FbMemBox.x2=pScrn->displayWidth; - pI810->FbMemBox.y1=0; - pI810->FbMemBox.y2=pScrn->virtualY; + pI810->FbMemBox.x1 = 0; + pI810->FbMemBox.x2 = pScrn->displayWidth; + pI810->FbMemBox.y1 = 0; + pI810->FbMemBox.y2 = pScrn->virtualY; xf86GetOptValInteger(pI810->Options, OPTION_CACHE_LINES, &cache_lines); @@ -1753,7 +1862,7 @@ * Not sure why 256 was initially subtracted from videoRam in the * maxCacheLines calculation, but that was causing a problem * for configurations that have exactly enough Ram for the framebuffer. - * Common code should catch the case where there isn't enough space for + * Common code should catch the case where there isn't enough space for * framebuffer, we'll just check for no space for cache_lines. -jens * */ @@ -1761,69 +1870,66 @@ int maxCacheLines; maxCacheLines = (pScrn->videoRam * 1024 / - (pScrn->bitsPerPixel / 8) / - pScrn->displayWidth) - pScrn->virtualY; + (pScrn->bitsPerPixel / 8) / + pScrn->displayWidth) - pScrn->virtualY; if (maxCacheLines < 0) - maxCacheLines = 0; + maxCacheLines = 0; if (cache_lines > maxCacheLines) cache_lines = maxCacheLines; } pI810->FbMemBox.y2 += cache_lines; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Adding %i scanlines for pixmap caching\n", cache_lines); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Adding %i scanlines for pixmap caching\n", cache_lines); /* Reserve room for the framebuffer and pixcache. Put at the top * of memory so we can have nice alignment for the tiled regions at * the start of memory. */ - if (!I810AllocLow( &(pI810->FrontBuffer), - &(pI810->SysMem), - ((pI810->FbMemBox.x2 * - pI810->FbMemBox.y2 * - pI810->cpp) + 4095) & ~4095)) { + if (!I810AllocLow(&(pI810->FrontBuffer), + &(pI810->SysMem), + ((pI810->FbMemBox.x2 * + pI810->FbMemBox.y2 * pI810->cpp) + 4095) & ~4095)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Framebuffer allocation failed\n"); return FALSE; } else - DPRINTF (PFX, - "Frame buffer at 0x%.8x (%luk, %lu bytes)\n", - pI810->FrontBuffer.Start, - pI810->FrontBuffer.Size / 1024, - pI810->FrontBuffer.Size); - - memset( &(pI810->LpRing), 0, sizeof( I810RingBuffer ) ); - if(I810AllocLow( &(pI810->LpRing.mem), &(pI810->SysMem), 16*4096 )) { - DPRINTF (PFX, - "Ring buffer at 0x%.8x (%luk, %lu bytes)\n", - pI810->LpRing.mem.Start, - pI810->LpRing.mem.Size / 1024, - pI810->LpRing.mem.Size); - - pI810->LpRing.tail_mask = pI810->LpRing.mem.Size - 1; - pI810->LpRing.virtual_start = pI810->FbBase + pI810->LpRing.mem.Start; - pI810->LpRing.head = 0; - pI810->LpRing.tail = 0; - pI810->LpRing.space = 0; + DPRINTF(PFX, + "Frame buffer at 0x%.8x (%luk, %lu bytes)\n", + pI810->FrontBuffer.Start, + pI810->FrontBuffer.Size / 1024, pI810->FrontBuffer.Size); + + memset(&(pI810->LpRing), 0, sizeof(I810RingBuffer)); + if (I810AllocLow(&(pI810->LpRing.mem), &(pI810->SysMem), 16 * 4096)) { + DPRINTF(PFX, + "Ring buffer at 0x%.8x (%luk, %lu bytes)\n", + pI810->LpRing.mem.Start, + pI810->LpRing.mem.Size / 1024, pI810->LpRing.mem.Size); + + pI810->LpRing.tail_mask = pI810->LpRing.mem.Size - 1; + pI810->LpRing.virtual_start = pI810->FbBase + pI810->LpRing.mem.Start; + pI810->LpRing.head = 0; + pI810->LpRing.tail = 0; + pI810->LpRing.space = 0; } else { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Ring buffer allocation failed\n"); - return (FALSE); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Ring buffer allocation failed\n"); + return (FALSE); } - if ( I810AllocLow( &pI810->Scratch, &(pI810->SysMem), 64*1024 ) || - I810AllocLow( &pI810->Scratch, &(pI810->SysMem), 16*1024 ) ) { - DPRINTF (PFX, - "Scratch memory at 0x%.8x (%luk, %lu bytes)\n", - pI810->Scratch.Start, - pI810->Scratch.Size / 1024, - pI810->Scratch.Size); + if (I810AllocLow(&pI810->Scratch, &(pI810->SysMem), 64 * 1024) || + I810AllocLow(&pI810->Scratch, &(pI810->SysMem), 16 * 1024)) { + DPRINTF(PFX, + "Scratch memory at 0x%.8x (%luk, %lu bytes)\n", + pI810->Scratch.Start, + pI810->Scratch.Size / 1024, pI810->Scratch.Size); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Allocated Scratch Memory\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Allocated Scratch Memory\n"); } else { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Scratch memory allocation failed\n"); - return (FALSE); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Scratch memory allocation failed\n"); + return (FALSE); } pI810->DoneFrontAlloc = TRUE; @@ -1831,7 +1937,8 @@ } static Bool -I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { +I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ ScrnInfoPtr pScrn; vgaHWPtr hwp; I810Ptr pI810; @@ -1842,27 +1949,23 @@ pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); - - miClearVisualTypes(); /* Re-implemented Direct Color support, -jens */ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) - return FALSE; - - if (!miSetPixmapDepths ()) - return FALSE; + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + + if (!miSetPixmapDepths()) + return FALSE; { I810RegPtr i810Reg = &pI810->ModeReg; int i; - - for (i = 0 ; i < 8 ; i++) - i810Reg->Fence[i] = 0; - } - + for (i = 0; i < 8; i++) + i810Reg->Fence[i] = 0; + } /* Have to init the DRM earlier than in other drivers to get agp * memory. Wonder if this is going to be a problem... @@ -1874,61 +1977,63 @@ * is called. cfbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - + if (xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE) || !xf86ReturnOptValBool(pI810->Options, OPTION_DRI, TRUE)) { pI810->directRenderingEnabled = FALSE; driFrom = X_CONFIG; } else { - pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); + pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); } - + #else pI810->directRenderingEnabled = FALSE; - if (!I810AllocateGARTMemory( pScrn )) + if (!I810AllocateGARTMemory(pScrn)) return FALSE; if (!I810AllocateFront(pScrn)) return FALSE; #endif - - if (!I810MapMem(pScrn)) return FALSE; + if (!I810MapMem(pScrn)) + return FALSE; + pScrn->memPhysBase = (unsigned long)pI810->LinearAddr; pScrn->fbOffset = 0; vgaHWSetMmioFuncs(hwp, pI810->MMIOBase, 0); vgaHWGetIOBase(hwp); - if (!vgaHWMapMem(pScrn)) return FALSE; + if (!vgaHWMapMem(pScrn)) + return FALSE; I810Save(pScrn); - if (!I810ModeInit(pScrn, pScrn->currentMode)) return FALSE; + if (!I810ModeInit(pScrn, pScrn->currentMode)) + return FALSE; I810SaveScreen(pScreen, FALSE); I810AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - - if(!fbScreenInit(pScreen, pI810->FbBase + pScrn->fbOffset, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) - return FALSE; + if (!fbScreenInit(pScreen, pI810->FbBase + pScrn->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel)) + return FALSE; if (pScrn->bitsPerPixel > 8) { - /* Fixup RGB ordering */ - visual = pScreen->visuals + pScreen->numVisuals; - while (--visual >= pScreen->visuals) { - if ((visual->class | DynamicClass) == DirectColor) { - visual->offsetRed = pScrn->offset.red; - visual->offsetGreen = pScrn->offset.green; - visual->offsetBlue = pScrn->offset.blue; - visual->redMask = pScrn->mask.red; - visual->greenMask = pScrn->mask.green; - visual->blueMask = pScrn->mask.blue; - } - } + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } } - fbPictureInit (pScreen, 0, 0); + fbPictureInit(pScreen, 0, 0); xf86SetBlackWhitePixels(pScreen); @@ -1941,8 +2046,8 @@ if (!pI810->directRenderingEnabled) { pI810->DoneFrontAlloc = FALSE; - if (!I810AllocateGARTMemory( pScrn )) - return FALSE; + if (!I810AllocateGARTMemory(pScrn)) + return FALSE; if (!I810AllocateFront(pScrn)) return FALSE; } @@ -1952,18 +2057,18 @@ if (!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to init memory manager\n"); + "Failed to init memory manager\n"); return FALSE; } if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) { if (pI810->LpRing.mem.Size != 0) { - I810SetRingRegs( pScrn ); + I810SetRingRegs(pScrn); - if (!I810AccelInit(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Hardware acceleration initialization failed\n"); - } + if (!I810AccelInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware acceleration initialization failed\n"); + } } } @@ -1975,29 +2080,30 @@ if (!xf86ReturnOptValBool(pI810->Options, OPTION_SW_CURSOR, FALSE)) { if (!I810CursorInit(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Hardware cursor initialization failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); } } - if (!miCreateDefColormap(pScreen)) return FALSE; + if (!miCreateDefColormap(pScreen)) + return FALSE; /* Use driver specific palette load routines for Direct Color support. -jens */ - if (pScrn->bitsPerPixel==16) { + if (pScrn->bitsPerPixel == 16) { if (pScrn->depth == 15) { if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette15, 0, - CMAP_PALETTED_TRUECOLOR| - CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; + CMAP_PALETTED_TRUECOLOR | + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; } else { if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, 0, - CMAP_PALETTED_TRUECOLOR| - CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; + CMAP_PALETTED_TRUECOLOR | + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; } } else { if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette24, 0, - CMAP_PALETTED_TRUECOLOR| + CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } @@ -2008,19 +2114,19 @@ #ifdef XF86DRI if (pI810->directRenderingEnabled) { - /* Now that mi, cfb, drm and others have done their thing, + /* Now that mi, cfb, drm and others have done their thing, * complete the DRI setup. */ pI810->directRenderingEnabled = I810DRIFinishScreenInit(pScreen); } #ifdef XvMCExtension - if (pI810->directRenderingEnabled) { + if ((pI810->directRenderingEnabled) && (pI810->numSurfaces)) { /* Initialize the hardware motion compensation code */ I810InitMC(pScreen); } #endif #endif - + if (pI810->directRenderingEnabled) { xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering enabled\n"); } else { @@ -2038,27 +2144,40 @@ } Bool -I810SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn =xf86Screens[scrnIndex]; +I810SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; if (I810_DEBUG & DEBUG_VERBOSE_CURSOR) - ErrorF( "I810SwitchMode %p %x\n", mode, flags); + ErrorF("I810SwitchMode %p %x\n", mode, flags); return I810ModeInit(pScrn, mode); } void -I810AdjustFrame(int scrnIndex, int x, int y, int flags) { +I810AdjustFrame(int scrnIndex, int x, int y, int flags) +{ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I810Ptr pI810 = I810PTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - int Base = (y * pScrn->displayWidth + x) >> 2; + int Base; +#if 1 + if (pI810->showCache) { + int lastline = pI810->FbMapSize / + ((pScrn->displayWidth * pScrn->bitsPerPixel) / 8); + lastline -= pScrn->currentMode->VDisplay; + if (y > 0) + y += pScrn->currentMode->VDisplay; + if (y > lastline) y = lastline; + } +#endif + Base = (y * pScrn->displayWidth + x) >> 2; if (I810_DEBUG & DEBUG_VERBOSE_CURSOR) - ErrorF( "I810AdjustFrame %d,%d %x\n", x, y, flags); + ErrorF("I810AdjustFrame %d,%d %x\n", x, y, flags); switch (pScrn->bitsPerPixel) { - case 8: + case 8: break; case 16: Base *= 2; @@ -2066,10 +2185,10 @@ case 24: /* KW: Need to do 16-pixel alignment for i810, otherwise you * get bad watermark problems. Need to fixup the mouse - * pointer positioning to take this into account. + * pointer positioning to take this into account. */ pI810->CursorOffset = (Base & 0x3) * 4; - Base &= ~0x3; + Base &= ~0x3; Base *= 3; break; case 32: @@ -2077,20 +2196,20 @@ break; } - hwp->writeCrtc(hwp, START_ADDR_LO, Base&0xFF); - hwp->writeCrtc(hwp, START_ADDR_HI, (Base&0xFF00)>>8); - hwp->writeCrtc(hwp, EXT_START_ADDR_HI, (Base&0x3FC00000)>>22); - hwp->writeCrtc(hwp, EXT_START_ADDR, - ((Base&0x00eF0000)>>16|EXT_START_ADDR_ENABLE)); + hwp->writeCrtc(hwp, START_ADDR_LO, Base & 0xFF); + hwp->writeCrtc(hwp, START_ADDR_HI, (Base & 0xFF00) >> 8); + hwp->writeCrtc(hwp, EXT_START_ADDR_HI, (Base & 0x3FC00000) >> 22); + hwp->writeCrtc(hwp, EXT_START_ADDR, + ((Base & 0x00eF0000) >> 16 | EXT_START_ADDR_ENABLE)); } - - /* These functions are usually called with the lock **not held**. */ static Bool -I810EnterVT(int scrnIndex, int flags) { +I810EnterVT(int scrnIndex, int flags) +{ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + #ifdef XF86DRI I810Ptr pI810 = I810PTR(pScrn); #endif @@ -2098,25 +2217,27 @@ if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("\n\nENTER VT\n"); - if (! I810BindGARTMemory(pScrn)) - return FALSE; + if (!I810BindGARTMemory(pScrn)) + return FALSE; #ifdef XF86DRI if (pI810->directRenderingEnabled) { if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("calling dri unlock\n"); - DRIUnlock( screenInfo.screens[scrnIndex] ); + DRIUnlock(screenInfo.screens[scrnIndex]); pI810->LockHeld = 0; } #endif - if (!I810ModeInit(pScrn, pScrn->currentMode)) return FALSE; + if (!I810ModeInit(pScrn, pScrn->currentMode)) + return FALSE; I810AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return TRUE; } static void -I810LeaveVT(int scrnIndex, int flags) { +I810LeaveVT(int scrnIndex, int flags) +{ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); I810Ptr pI810 = I810PTR(pScrn); @@ -2125,22 +2246,23 @@ ErrorF("\n\n\nLeave VT\n"); #ifdef XF86DRI - if (pI810->directRenderingEnabled) { + if (pI810->directRenderingEnabled) { if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("calling dri lock\n"); - DRILock( screenInfo.screens[scrnIndex], 0 ); + DRILock(screenInfo.screens[scrnIndex], 0); pI810->LockHeld = 1; } #endif - if(pI810->AccelInfoRec != NULL) { - I810RefreshRing( pScrn ); - I810Sync( pScrn ); + if (pI810->AccelInfoRec != NULL) { + I810RefreshRing(pScrn); + I810Sync(pScrn); + pI810->AccelInfoRec->NeedToSync = FALSE; } I810Restore(pScrn); - if (! I810UnbindGARTMemory(pScrn)) - return; + if (!I810UnbindGARTMemory(pScrn)) + return; vgaHWLock(hwp); } @@ -2154,25 +2276,25 @@ XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; if (pScrn->vtSema == TRUE) { - I810Restore(pScrn); - vgaHWLock(hwp); + I810Restore(pScrn); + vgaHWLock(hwp); } #ifdef XF86DRI if (pI810->directRenderingEnabled) { - I810DRICloseScreen(pScreen); - pI810->directRenderingEnabled=FALSE; + I810DRICloseScreen(pScreen); + pI810->directRenderingEnabled = FALSE; } #endif - if(pScrn->vtSema == TRUE) { - I810UnbindGARTMemory(pScrn); - I810Restore(pScrn); - vgaHWLock(hwp); + if (pScrn->vtSema == TRUE) { + I810UnbindGARTMemory(pScrn); + I810Restore(pScrn); + vgaHWLock(hwp); } - + I810UnmapMem(pScrn); vgaHWUnmapMem(pScrn); - + if (pI810->ScanlineColorExpandBuffers) { xfree(pI810->ScanlineColorExpandBuffers); pI810->ScanlineColorExpandBuffers = 0; @@ -2182,12 +2304,12 @@ if (infoPtr->ScanlineColorExpandBuffers) xfree(infoPtr->ScanlineColorExpandBuffers); XAADestroyInfoRec(infoPtr); - pI810->AccelInfoRec=0; + pI810->AccelInfoRec = 0; } if (pI810->CursorInfoRec) { xf86DestroyCursorInfoRec(pI810->CursorInfoRec); - pI810->CursorInfoRec=0; + pI810->CursorInfoRec = 0; } /* Free all allocated video ram. @@ -2201,25 +2323,26 @@ */ xf86GARTCloseScreen(scrnIndex); - pScrn->vtSema=FALSE; + pScrn->vtSema = FALSE; pScreen->CloseScreen = pI810->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen) (scrnIndex, pScreen); } static void -I810FreeScreen(int scrnIndex, int flags) { +I810FreeScreen(int scrnIndex, int flags) +{ I810FreeRec(xf86Screens[scrnIndex]); if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) - vgaHWFreeHWRec(xf86Screens[scrnIndex]); + vgaHWFreeHWRec(xf86Screens[scrnIndex]); } static int -I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { +I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +{ if (mode->Flags & V_INTERLACE) { if (verbose) { - xf86DrvMsg(scrnIndex, X_PROBED, - "Removing interlaced mode \"%s\"\n", - mode->name); + xf86DrvMsg(scrnIndex, X_PROBED, + "Removing interlaced mode \"%s\"\n", mode->name); } return MODE_BAD; } @@ -2233,11 +2356,12 @@ } static void -I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, - int flags) { +I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, + int flags) +{ I810Ptr pI810; - unsigned char SEQ01=0; - int DPMSSyncSelect=0; + unsigned char SEQ01 = 0; + int DPMSSyncSelect = 0; pI810 = I810PTR(pScrn); switch (PowerManagementMode) { @@ -2270,3 +2394,4 @@ /* Set the DPMS mode */ OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); } +#endif /* I830_ONLY */ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c:1.3 Tue Dec 4 16:17:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c Tue Sep 10 20:29:32 2002 @@ -32,7 +32,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.3 2001/12/04 21:17:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.4 2002/09/11 00:29:32 dawes Exp $ */ #include "xf86.h" @@ -259,7 +259,7 @@ if(!*priv) { *num_priv = 0; - return(BadAlloc); + return BadAlloc; } *num_priv = sizeof(I810XvMCCreateContextRec) >> 2; @@ -267,7 +267,7 @@ xf86DrvMsg(X_ERROR, pScrn->scrnIndex, "I810XvMCCreateContext: Unable to create DRMContext!\n"); xfree(*priv); - return(BadAlloc); + return BadAlloc; } drmAuthMagic(pI810->drmSubFD, pContext->flags); @@ -299,7 +299,7 @@ xf86DrvMsg(X_ERROR, pScrn->scrnIndex, "I810XvMCCreateSurface: Unable to allocate memory!\n"); *num_priv = 0; - return (BadAlloc); + return BadAlloc; } *num_priv = 2; @@ -345,7 +345,7 @@ xf86DrvMsg(X_ERROR, pScrn->scrnIndex, "I810XvMCCreateSubpicture: Unable to allocate memory!\n"); *num_priv = 0; - return (BadAlloc); + return BadAlloc; } *num_priv = 1; Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c:1.3 Thu May 11 14:14:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c Tue Sep 10 20:29:32 2002 @@ -24,9 +24,22 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c,v 1.3 2000/05/11 18:14:34 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c,v 1.5 2002/09/11 00:29:32 dawes Exp $ */ /* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* * Authors: * Daryll Strauss <daryll@precisioninsight.com> * @@ -37,63 +50,95 @@ #include "xf86_OSproc.h" #include "compiler.h" +#ifdef BUILD_FOR_I830 +#include "i830.h" +#define pI810 pI830 +#define I810Ptr I830Ptr +#define I810WriteControlPIO I830WriteControlPIO +#define I810ReadControlPIO I830ReadControlPIO +#define I810WriteStandardPIO I830WriteStandardPIO +#define I810ReadStandardPIO I830ReadStandardPIO +#define I810SetPIOAccess I830SetPIOAccess +#define I810WriteControlMMIO I830WriteControlMMIO +#define I810ReadControlMMIO I830ReadControlMMIO +#define I810WriteStandardMMIO I830WriteStandardMMIO +#define I810ReadStandardMMIO I830ReadStandardMMIO +#define I810SetMMIOAccess I830SetMMIOAccess +#else #include "i810.h" +#endif +#define minb(p) *(volatile CARD8 *)(pI810->MMIOBase + (p)) +#define moutb(p,v) *(volatile CARD8 *)(pI810->MMIOBase + (p)) = (v) + static void -I810WriteControlPIO(I810Ptr pI810, int addr, CARD8 index, CARD8 val) { - outb(addr, index); - outb(addr+1, val); +I810WriteControlPIO(I810Ptr pI810, IOADDRESS addr, CARD8 index, CARD8 val) +{ + addr += pI810->ioBase; + outb(addr, index); + outb(addr + 1, val); } static CARD8 -I810ReadControlPIO(I810Ptr pI810, int addr, CARD8 index) { - outb(addr, index); - return inb(addr+1); +I810ReadControlPIO(I810Ptr pI810, IOADDRESS addr, CARD8 index) +{ + addr += pI810->ioBase; + outb(addr, index); + return inb(addr + 1); } static void -I810WriteStandardPIO(I810Ptr pI810, int addr, CARD8 val) { - outb(addr, val); +I810WriteStandardPIO(I810Ptr pI810, IOADDRESS addr, CARD8 val) +{ + outb(pI810->ioBase + addr, val); } static CARD8 -I810ReadStandardPIO(I810Ptr pI810, int addr) { - return inb(addr); +I810ReadStandardPIO(I810Ptr pI810, IOADDRESS addr) +{ + return inb(pI810->ioBase + addr); } -void I810SetPIOAccess(I810Ptr pI810) { - pI810->writeControl=I810WriteControlPIO; - pI810->readControl=I810ReadControlPIO; - pI810->writeStandard=I810WriteStandardPIO; - pI810->readStandard=I810ReadStandardPIO; +void +I810SetPIOAccess(I810Ptr pI810) +{ + pI810->writeControl = I810WriteControlPIO; + pI810->readControl = I810ReadControlPIO; + pI810->writeStandard = I810WriteStandardPIO; + pI810->readStandard = I810ReadStandardPIO; } static void -I810WriteControlMMIO(I810Ptr pI810, int addr, CARD8 index, CARD8 val) { - moutb(addr, index); - moutb(addr+1, val); +I810WriteControlMMIO(I810Ptr pI810, IOADDRESS addr, CARD8 index, CARD8 val) +{ + moutb(addr, index); + moutb(addr + 1, val); } static CARD8 -I810ReadControlMMIO(I810Ptr pI810, int addr, CARD8 index) { - moutb(addr, index); - return minb(addr+1); +I810ReadControlMMIO(I810Ptr pI810, IOADDRESS addr, CARD8 index) +{ + moutb(addr, index); + return minb(addr + 1); } static void -I810WriteStandardMMIO(I810Ptr pI810, int addr, CARD8 val) { - moutb(addr, val); +I810WriteStandardMMIO(I810Ptr pI810, IOADDRESS addr, CARD8 val) +{ + moutb(addr, val); } static CARD8 -I810ReadStandardMMIO(I810Ptr pI810, int addr) { - return minb(addr); +I810ReadStandardMMIO(I810Ptr pI810, IOADDRESS addr) +{ + return minb(addr); } -void I810SetMMIOAccess(I810Ptr pI810) { - pI810->writeControl=I810WriteControlMMIO; - pI810->readControl=I810ReadControlMMIO; - pI810->writeStandard=I810WriteStandardMMIO; - pI810->readStandard=I810ReadStandardMMIO; +void +I810SetMMIOAccess(I810Ptr pI810) +{ + pI810->writeControl = I810WriteControlMMIO; + pI810->readControl = I810ReadControlMMIO; + pI810->writeStandard = I810WriteStandardMMIO; + pI810->readStandard = I810ReadStandardMMIO; } - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c:1.23 Tue Jan 8 19:37:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c Mon Dec 9 20:27:05 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.23 2002/01/09 00:37:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.27 2002/12/10 01:27:05 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -27,8 +27,21 @@ **************************************************************************/ /* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> * */ @@ -39,241 +52,165 @@ #include "i810.h" #include "i810_reg.h" -int I810AllocLow (I810MemRange *result,I810MemRange *pool,int size) +int +I810AllocLow(I810MemRange * result, I810MemRange * pool, int size) { - if (size > pool->Size) return (0); + if (size > pool->Size) + return 0; pool->Size -= size; result->Size = size; result->Start = pool->Start; result->End = pool->Start += size; - return (1); + return 1; } -int I810AllocHigh (I810MemRange *result,I810MemRange *pool,int size) +int +I810AllocHigh(I810MemRange * result, I810MemRange * pool, int size) { - if (size > pool->Size) return (0); + if (size > pool->Size) + return 0; pool->Size -= size; result->Size = size; result->End = pool->End; result->Start = pool->End -= size; - return (1); + return 1; } -int I810AllocateGARTMemory (ScrnInfoPtr pScrn) +int +I810AllocateGARTMemory(ScrnInfoPtr pScrn) { unsigned long size = pScrn->videoRam * 1024; - I810Ptr pI810 = I810PTR (pScrn); + I810Ptr pI810 = I810PTR(pScrn); int key; long tom = 0; unsigned long physical; - if (pI810->StolenOnly == TRUE && pI810->StolenSize) - { - pI810->SysMem.Start = 0; - pI810->SysMem.Size = pI810->StolenSize; - pI810->SysMem.End = pI810->StolenSize; - pI810->SavedSysMem = pI810->SysMem; - pI810->agpAcquired2d = TRUE; - - pI810->CursorPhysical = 0; - pI810->CursorStart = 0; - - pI810->HwcursKey = -1; - pI810->DcacheKey = -1; - pI810->VramKey = -1; - - return (TRUE); - } - - if (!xf86AgpGARTSupported () || !xf86AcquireGART (pScrn->scrnIndex)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "AGP GART support is either not available or cannot be used.\n" - "\tMake sure your kernel has agpgart support or has the\n" - "\tagpgart module loaded.\n"); - return (FALSE); + if (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "AGP GART support is either not available or cannot be used.\n" + "\tMake sure your kernel has agpgart support or has the\n" + "\tagpgart module loaded.\n"); + return FALSE; } /* This allows the 2d only Xserver to regen */ pI810->agpAcquired2d = TRUE; + + /* + * I810/I815 + * + * Treat the gart like video memory - we assume we own all that is + * there, so ignore EBUSY errors. Don't try to remove it on + * failure, either, as other X server may be using it. + */ + + if ((key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL)) == -1) + return FALSE; + + pI810->VramOffset = 0; + pI810->VramKey = key; - if (IS_I830 (pI810)) - { - /* - * The I830 is slightly different from the I810/I815, it has no - * dcache and it has stolen memory by default in its gtt. All - * additional memory must go after it. - */ - - int offset,alloc_size; - - DPRINTF (PFX, - "size == %luk (%lu bytes == pScrn->videoRam)\n" - "pI810->StolenSize == %luk (%lu bytes)\n", - size/1024,size, - pI810->StolenSize/1024,pI810->StolenSize); - - alloc_size = size; - if (alloc_size <= pI810->StolenSize) - offset = alloc_size = 0; - else - { - alloc_size -= pI810->StolenSize; /* Stolen size is in bytes */ - offset = pI810->StolenSize; - } - - if (alloc_size) - { - if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,alloc_size,0,NULL)) == -1) - return (FALSE); - - DPRINTF (PFX, - "alloc_size == %luk (%lu bytes)\n" - " key == 0x%.8x\n" - " offset == 0x%.8x\n", - alloc_size/1024,alloc_size, - key,offset); - - if (!xf86BindGARTMemory (pScrn->scrnIndex,key,offset)) - return (FALSE); - - pI810->VramOffset = offset; - pI810->VramKey = key; - } - else pI810->VramKey = -1; - - pI810->SysMem.Start = 0; - pI810->SysMem.Size = size; - pI810->SysMem.End = size; - pI810->SavedSysMem = pI810->SysMem; - pI810->DcacheKey = -1; - - tom = size <= pI810->StolenSize ? pI810->StolenSize : pI810->SysMem.End; - } - else - { - /* - * I810/I815 - * - * Treat the gart like video memory - we assume we own all that is - * there, so ignore EBUSY errors. Don't try to remove it on - * failure, either, as other X server may be using it. - */ - - if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,size,0,NULL)) == -1) - return (FALSE); - - pI810->VramOffset = 0; - pI810->VramKey = key; - - if (!xf86BindGARTMemory (pScrn->scrnIndex,key,0)) - return (FALSE); - - pI810->SysMem.Start = 0; - pI810->SysMem.Size = size; - pI810->SysMem.End = size; - pI810->SavedSysMem = pI810->SysMem; - - tom = pI810->SysMem.End; - - pI810->DcacheMem.Start = 0; - pI810->DcacheMem.End = 0; - pI810->DcacheMem.Size = 0; - pI810->CursorPhysical = 0; - - /* - * Dcache - half the speed of normal ram, so not really useful for - * a 2d server. Don't bother reporting its presence. This is - * mapped in addition to the requested amount of system ram. - */ - - size = 1024 * 4096; - - /* - * Keep it 512K aligned for the sake of tiled regions. - */ - - tom += 0x7ffff; - tom &= ~0x7ffff; - - if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,size,1,NULL)) != -1) - { - pI810->DcacheOffset = tom; - pI810->DcacheKey = key; - if (!xf86BindGARTMemory (pScrn->scrnIndex,key,tom)) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Allocation of %d bytes for DCACHE failed\n",size); - pI810->DcacheKey = -1; - } - else - { - pI810->DcacheMem.Start = tom; - pI810->DcacheMem.Size = size; - pI810->DcacheMem.End = pI810->DcacheMem.Start + pI810->DcacheMem.Size; - tom = pI810->DcacheMem.End; - } - } - else - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"No physical memory available for %d bytes of DCACHE\n",size); - pI810->DcacheKey = -1; - } - } + if (!xf86BindGARTMemory(pScrn->scrnIndex, key, 0)) + return FALSE; + + pI810->SysMem.Start = 0; + pI810->SysMem.Size = size; + pI810->SysMem.End = size; + pI810->SavedSysMem = pI810->SysMem; + + tom = pI810->SysMem.End; + + pI810->DcacheMem.Start = 0; + pI810->DcacheMem.End = 0; + pI810->DcacheMem.Size = 0; + pI810->CursorPhysical = 0; + + /* + * Dcache - half the speed of normal ram, so not really useful for + * a 2d server. Don't bother reporting its presence. This is + * mapped in addition to the requested amount of system ram. + */ + + size = 1024 * 4096; + + /* + * Keep it 512K aligned for the sake of tiled regions. + */ + + tom += 0x7ffff; + tom &= ~0x7ffff; + + if ((key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 1, NULL)) != -1) { + pI810->DcacheOffset = tom; + pI810->DcacheKey = key; + if (!xf86BindGARTMemory(pScrn->scrnIndex, key, tom)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Allocation of %d bytes for DCACHE failed\n", size); + pI810->DcacheKey = -1; + } else { + pI810->DcacheMem.Start = tom; + pI810->DcacheMem.Size = size; + pI810->DcacheMem.End = pI810->DcacheMem.Start + pI810->DcacheMem.Size; + tom = pI810->DcacheMem.End; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No physical memory available for %d bytes of DCACHE\n", + size); + pI810->DcacheKey = -1; + } /* - * Mouse cursor -- The i810 (crazy) needs a physical address in - * system memory from which to upload the cursor. We get this from - * the agpgart module using a special memory type. + * Mouse cursor -- The i810 (crazy) needs a physical address in + * system memory from which to upload the cursor. We get this from + * the agpgart module using a special memory type. */ /* - * 4k for the cursor is excessive, I'm going to steal 3k for - * overlay registers later + * 4k for the cursor is excessive, I'm going to steal 3k for + * overlay registers later */ size = 4096; - if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,size,2,&physical)) == -1) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"No physical memory available for HW cursor\n"); - pI810->HwcursKey = -1; - pI810->CursorStart = 0; - } - else - { - pI810->HwcursOffset = tom; - pI810->HwcursKey = key; - if (!xf86BindGARTMemory (pScrn->scrnIndex,key,tom)) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Allocation of %d bytes for HW cursor failed\n",size); - pI810->HwcursKey = -1; - } - else - { - pI810->CursorPhysical = physical; - pI810->CursorStart = tom; - tom += size; - } - } + if ((key = + xf86AllocateGARTMemory(pScrn->scrnIndex, size, 2, &physical)) == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No physical memory available for HW cursor\n"); + pI810->HwcursKey = -1; + pI810->CursorStart = 0; + } else { + pI810->HwcursOffset = tom; + pI810->HwcursKey = key; + if (!xf86BindGARTMemory(pScrn->scrnIndex, key, tom)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Allocation of %d bytes for HW cursor failed\n", size); + pI810->HwcursKey = -1; + } else { + pI810->CursorPhysical = physical; + pI810->CursorStart = tom; + tom += size; + } + } /* - * Overlay register buffer -- Just like the cursor, the i810 needs a - * physical address in system memory from which to upload the overlay - * registers. + * Overlay register buffer -- Just like the cursor, the i810 needs a + * physical address in system memory from which to upload the overlay + * registers. */ - if (pI810->CursorStart != 0) - { - pI810->OverlayPhysical = pI810->CursorPhysical + 1024; - pI810->OverlayStart = pI810->CursorStart + 1024; - } + if (pI810->CursorStart != 0) { + pI810->OverlayPhysical = pI810->CursorPhysical + 1024; + pI810->OverlayStart = pI810->CursorStart + 1024; + } pI810->GttBound = 1; - return (TRUE); + return TRUE; } /* Tiled memory is good... really, really good... @@ -281,175 +218,182 @@ * Need to make it less likely that we miss out on this - probably * need to move the frontbuffer away from the 'guarenteed' alignment * of the first memory segment, or perhaps allocate a discontigous - * framebuffer to get more alignment 'sweet spots'. + * framebuffer to get more alignment 'sweet spots'. */ -void I810SetTiledMemory (ScrnInfoPtr pScrn,int nr,unsigned int start,unsigned int pitch,unsigned int size) +void +I810SetTiledMemory(ScrnInfoPtr pScrn, int nr, unsigned int start, + unsigned int pitch, unsigned int size) { - I810Ptr pI810 = I810PTR (pScrn); + I810Ptr pI810 = I810PTR(pScrn); I810RegPtr i810Reg = &pI810->ModeReg; CARD32 val; CARD32 fence_mask = 0; - if (nr < 0 || nr > 7) - { - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s - fence %d out of range\n","I810SetTiledMemory",nr); - return; - } + if (nr < 0 || nr > 7) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, "%s - fence %d out of range\n", + "I810SetTiledMemory", nr); + return; + } i810Reg->Fence[nr] = 0; - fence_mask = IS_I830 (pI810) ? ~I830_FENCE_START_MASK : ~FENCE_START_MASK; + fence_mask = ~FENCE_START_MASK; - if (start & fence_mask) - { - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: start (%x) is not 512k aligned\n","I810SetTiledMemory",nr,start); - return; - } - - if (start % size) - { - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: start (%x) is not size (%x) aligned\n","I810SetTiledMemory",nr,start,size); - return; - } - - if (pitch & 127) - { - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: pitch (%x) not a multiple of 128 bytes\n","I810SetTiledMemory",nr,pitch); - return; - } + if (start & fence_mask) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "%s %d: start (%x) is not 512k aligned\n", + "I810SetTiledMemory", nr, start); + return; + } + + if (start % size) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "%s %d: start (%x) is not size (%x) aligned\n", + "I810SetTiledMemory", nr, start, size); + return; + } + if (pitch & 127) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "%s %d: pitch (%x) not a multiple of 128 bytes\n", + "I810SetTiledMemory", nr, pitch); + return; + } + val = (start | FENCE_X_MAJOR | FENCE_VALID); - if (IS_I830 (pI810)) - { - switch (size) - { - case KB (512): val |= FENCE_SIZE_512K; break; - case MB (1): val |= FENCE_SIZE_1M; break; - case MB (2): val |= FENCE_SIZE_2M; break; - case MB (4): val |= FENCE_SIZE_4M; break; - case MB (8): val |= FENCE_SIZE_8M; break; - case MB (16): val |= FENCE_SIZE_16M; break; - case MB (32): val |= FENCE_SIZE_32M; break; - case MB (64): val |= FENCE_SIZE_64M; break; - default: - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); - return; - } - - switch (pitch / 128) - { - case 1: val |= FENCE_PITCH_1; break; - case 2: val |= FENCE_PITCH_2; break; - case 4: val |= FENCE_PITCH_4; break; - case 8: val |= FENCE_PITCH_8; break; - case 16: val |= FENCE_PITCH_16; break; - case 32: val |= FENCE_PITCH_32; break; - case 64: val |= FENCE_PITCH_64; break; - default: - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); - return; - } - } - else - { - switch (size) - { - case KB (512): val |= FENCE_SIZE_512K; break; - case MB (1): val |= FENCE_SIZE_1M; break; - case MB (2): val |= FENCE_SIZE_2M; break; - case MB (4): val |= FENCE_SIZE_4M; break; - case MB (8): val |= FENCE_SIZE_8M; break; - case MB (16): val |= FENCE_SIZE_16M; break; - case MB (32): val |= FENCE_SIZE_32M; break; - default: - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); - return; - } - - switch (pitch / 128) - { - case 1: val |= FENCE_PITCH_1; break; - case 2: val |= FENCE_PITCH_2; break; - case 4: val |= FENCE_PITCH_4; break; - case 8: val |= FENCE_PITCH_8; break; - case 16: val |= FENCE_PITCH_16; break; - case 32: val |= FENCE_PITCH_32; break; - default: - xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); - return; - } - } + switch (size) { + case KB(512): + val |= FENCE_SIZE_512K; + break; + case MB(1): + val |= FENCE_SIZE_1M; + break; + case MB(2): + val |= FENCE_SIZE_2M; + break; + case MB(4): + val |= FENCE_SIZE_4M; + break; + case MB(8): + val |= FENCE_SIZE_8M; + break; + case MB(16): + val |= FENCE_SIZE_16M; + break; + case MB(32): + val |= FENCE_SIZE_32M; + break; + default: + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "%s %d: illegal size (0x%x)\n", "I810SetTiledMemory", nr, + size); + return; + } + + switch (pitch / 128) { + case 1: + val |= FENCE_PITCH_1; + break; + case 2: + val |= FENCE_PITCH_2; + break; + case 4: + val |= FENCE_PITCH_4; + break; + case 8: + val |= FENCE_PITCH_8; + break; + case 16: + val |= FENCE_PITCH_16; + break; + case 32: + val |= FENCE_PITCH_32; + break; + default: + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "%s %d: illegal size (0x%x)\n", "I810SetTiledMemory", nr, + size); + return; + } i810Reg->Fence[nr] = val; } -Bool I810BindGARTMemory (ScrnInfoPtr pScrn) +Bool +I810BindGARTMemory(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR (pScrn); + I810Ptr pI810 = I810PTR(pScrn); - if (pI810->StolenOnly == TRUE) return (TRUE); + if (xf86AgpGARTSupported() && !pI810->directRenderingEnabled + && !pI810->GttBound) { + if (!xf86AcquireGART(pScrn->scrnIndex)) + return FALSE; + + if (pI810->VramKey != -1 + && !xf86BindGARTMemory(pScrn->scrnIndex, pI810->VramKey, + pI810->VramOffset)) + return FALSE; + + if (pI810->DcacheKey != -1 + && !xf86BindGARTMemory(pScrn->scrnIndex, pI810->DcacheKey, + pI810->DcacheOffset)) + return FALSE; + + if (pI810->HwcursKey != -1 + && !xf86BindGARTMemory(pScrn->scrnIndex, pI810->HwcursKey, + pI810->HwcursOffset)) + return FALSE; - if (xf86AgpGARTSupported () && !pI810->directRenderingEnabled && !pI810->GttBound) - { - if (!xf86AcquireGART (pScrn->scrnIndex)) - return (FALSE); - - if (pI810->VramKey != -1 && !xf86BindGARTMemory (pScrn->scrnIndex,pI810->VramKey,pI810->VramOffset)) - return (FALSE); - - if (pI810->DcacheKey != -1 && !xf86BindGARTMemory (pScrn->scrnIndex,pI810->DcacheKey,pI810->DcacheOffset)) - return (FALSE); - - if (pI810->HwcursKey != -1 && !xf86BindGARTMemory (pScrn->scrnIndex,pI810->HwcursKey,pI810->HwcursOffset)) - return (FALSE); - - pI810->GttBound = 1; - } + pI810->GttBound = 1; + } - return (TRUE); + return TRUE; } -Bool I810UnbindGARTMemory (ScrnInfoPtr pScrn) +Bool +I810UnbindGARTMemory(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR (pScrn); + I810Ptr pI810 = I810PTR(pScrn); - if (pI810->StolenOnly == TRUE) return (TRUE); + if (xf86AgpGARTSupported() && !pI810->directRenderingEnabled + && pI810->GttBound) { + if (pI810->VramKey != -1 + && !xf86UnbindGARTMemory(pScrn->scrnIndex, pI810->VramKey)) + return FALSE; + + if (pI810->DcacheKey != -1 + && !xf86UnbindGARTMemory(pScrn->scrnIndex, pI810->DcacheKey)) + return FALSE; + + if (pI810->HwcursKey != -1 + && !xf86UnbindGARTMemory(pScrn->scrnIndex, pI810->HwcursKey)) + return FALSE; - if (xf86AgpGARTSupported () && !pI810->directRenderingEnabled && pI810->GttBound) - { - if (pI810->VramKey != -1 && !xf86UnbindGARTMemory (pScrn->scrnIndex,pI810->VramKey)) - return (FALSE); + if (!xf86ReleaseGART(pScrn->scrnIndex)) + return FALSE; - if (pI810->DcacheKey != -1 && !xf86UnbindGARTMemory (pScrn->scrnIndex,pI810->DcacheKey)) - return (FALSE); - - if (pI810->HwcursKey != -1 && !xf86UnbindGARTMemory (pScrn->scrnIndex,pI810->HwcursKey)) - return (FALSE); - - if (!xf86ReleaseGART (pScrn->scrnIndex)) - return (FALSE); - - pI810->GttBound = 0; - } + pI810->GttBound = 0; + } - return (TRUE); + return TRUE; } -int I810CheckAvailableMemory (ScrnInfoPtr pScrn) +int +I810CheckAvailableMemory(ScrnInfoPtr pScrn) { AgpInfoPtr agpinf; int maxPages; - if (!xf86AgpGARTSupported () || - !xf86AcquireGART (pScrn->scrnIndex) || - (agpinf = xf86GetAGPInfo (pScrn->scrnIndex)) == NULL || - !xf86ReleaseGART (pScrn->scrnIndex)) - return (-1); + if (!xf86AgpGARTSupported() || + !xf86AcquireGART(pScrn->scrnIndex) || + (agpinf = xf86GetAGPInfo(pScrn->scrnIndex)) == NULL || + !xf86ReleaseGART(pScrn->scrnIndex)) + return -1; maxPages = agpinf->totalPages - agpinf->usedPages; - xf86DrvMsgVerb (pScrn->scrnIndex,X_INFO,2,"%s: %dk available\n","I810CheckAvailableMemory",maxPages * 4); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "%s: %dk available\n", + "I810CheckAvailableMemory", maxPages * 4); - return (maxPages * 4); + return maxPages * 4; } - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h:1.6 Sat Oct 27 23:33:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h Wed Feb 5 23:18:04 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.6 2001/10/28 03:33:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -28,7 +28,7 @@ /* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> * * based on the i740 driver by * Kevin E. Martin <kevin@precisioninsight.com> @@ -36,7 +36,10 @@ * */ -/* I/O register offsets +#ifndef _I810_REG_H +#define _I810_REG_H + +/* I/O register offsets */ #define SRX 0x3C4 /* p208 */ #define GRX 0x3CE /* p213 */ @@ -147,18 +150,46 @@ /* Cursor control registers, pp383-384 */ +/* Desktop (845G, 865G) */ #define CURSOR_CONTROL 0x70080 -#define CURSOR_ORIGIN_SCREEN 0x00 -#define CURSOR_ORIGIN_DISPLAY 0x10 -#define CURSOR_MODE 0x07 +#define CURSOR_ENABLE 0x80000000 +#define CURSOR_GAMMA_ENABLE 0x40000000 +#define CURSOR_STRIDE_MASK 0x30000000 +#define CURSOR_FORMAT_SHIFT 24 +#define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT) +#define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT) +#define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT) +#define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT) +#define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT) +#define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT) + +/* Mobile and i810 */ +#define CURSOR_A_CONTROL CURSOR_CONTROL +#define CURSOR_ORIGIN_SCREEN 0x00 /* i810 only */ +#define CURSOR_ORIGIN_DISPLAY 0x1 /* i810 only */ +#define CURSOR_MODE 0x27 #define CURSOR_MODE_DISABLE 0x00 -#define CURSOR_MODE_32_4C_AX 0x01 +#define CURSOR_MODE_32_4C_AX 0x01 /* i810 only */ #define CURSOR_MODE_64_3C 0x04 #define CURSOR_MODE_64_4C_AX 0x05 #define CURSOR_MODE_64_4C 0x06 -#define CURSOR_MODE_RESERVED 0x07 +#define CURSOR_MODE_64_32B_AX 0x07 +#define CURSOR_MODE_64_ARGB_AX (0x20 | CURSOR_MODE_64_32B_AX) +#define MCURSOR_PIPE_SELECT (1 << 28) +#define MCURSOR_PIPE_A 0x00 +#define MCURSOR_PIPE_B (1 << 28) +#define MCURSOR_GAMMA_ENABLE (1 << 26) +#define MCURSOR_MEM_TYPE_LOCAL (1 << 25) + + #define CURSOR_BASEADDR 0x70084 +#define CURSOR_A_BASE CURSOR_BASEADDR #define CURSOR_BASEADDR_MASK 0x1FFFFF00 +#define CURSOR_A_POSITION 0x70088 +#define CURSOR_POS_SIGN 0x8000 +#define CURSOR_POS_MASK 0x007FF +#define CURSOR_X_SHIFT 0 +#define CURSOR_Y_SHIFT 16 #define CURSOR_X_LO 0x70088 #define CURSOR_X_HI 0x70089 #define CURSOR_X_POS 0x00 @@ -168,6 +199,15 @@ #define CURSOR_Y_POS 0x00 #define CURSOR_Y_NEG 0x80 +#define CURSOR_A_PALETTE0 0x70090 +#define CURSOR_A_PALETTE1 0x70094 +#define CURSOR_A_PALETTE2 0x70098 +#define CURSOR_A_PALETTE3 0x7009C + +#define CURSOR_SIZE 0x700A0 +#define CURSOR_SIZE_MASK 0x3FF +#define CURSOR_SIZE_HSHIFT 0 +#define CURSOR_SIZE_VSHIFT 12 /* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm @@ -393,14 +433,17 @@ #define RING_TAIL 0x00 #define TAIL_ADDR 0x000FFFF8 +#define I830_TAIL_MASK 0x001FFFF8 #define RING_HEAD 0x04 #define HEAD_WRAP_COUNT 0xFFE00000 #define HEAD_WRAP_ONE 0x00200000 #define HEAD_ADDR 0x001FFFFC +#define I830_HEAD_MASK 0x001FFFFC #define RING_START 0x08 #define START_ADDR 0x00FFFFF8 +#define I830_RING_START_MASK 0xFFFFF000 #define RING_LEN 0x0C #define RING_NR_PAGES 0x000FF000 @@ -570,6 +613,14 @@ #define CS_USE_CTX0 0 #define CS_USE_CTX1 (1<<0) +/* I810 LCD/TV registers */ +#define LCD_TV_HTOTAL 0x60000 +#define LCD_TV_C 0x60018 +#define LCD_TV_OVRACT 0x6001C + +#define LCD_TV_ENABLE (1 << 31) +#define LCD_TV_VGAMOD (1 << 28) + /* I830 CRTC registers */ #define HTOTAL_A 0x60000 #define HBLANK_A 0x60004 @@ -618,7 +669,9 @@ #define ADPA 0x61100 #define ADPA_DAC_ENABLE (1<<31) #define ADPA_DAC_DISABLE 0 +#define ADPA_PIPE_SELECT_MASK (1<<30) #define ADPA_PIPE_A_SELECT 0 +#define ADPA_PIPE_B_SELECT (1<<30) #define ADPA_USE_VGA_HVPOLARITY (1<<15) #define ADPA_SETS_HVPOLARITY 0 #define ADPA_VSYNC_CNTL_DISABLE (1<<11) @@ -630,13 +683,17 @@ #define ADPA_HSYNC_ACTIVE_HIGH (1<<3) #define ADPA_HSYNC_ACTIVE_LOW 0 - -#define DV0A 0x61120 -#define DV0A_DISABLE (1<<31) -#define DV0B 0x61140 -#define DV0B_DISABLE (1<<31) +#define DVOA 0x61120 +#define DVOB 0x61140 +#define DVOC 0x61160 +#define DVO_ENABLE (1<<31) + +#define DVOA_SRCDIM 0x61124 +#define DVOB_SRCDIM 0x61144 +#define DVOC_SRCDIM 0x61164 +#define LVDS 0x61180 #define PIPEACONF 0x70008 #define PIPEACONF_ENABLE (1<<31) @@ -655,53 +712,39 @@ #define PIPEBCONF_PALETTE 0 #define DSPACNTR 0x70180 -#define DSPACNTR_PLANE_A_ENABLE (1<<31) -#define DSPACNTR_PLANE_A_DISABLE 0 -#define DSPACNTR_GAMMA_ENABLE (1<<30) -#define DSPACNTR_GAMMA_DISABLE 0 -#define DSPACNTR_8BPP (1<<27) -#define DSPACNTR_16BPP ((1<<26)|(1<<28)) -#define DSPACNTR_32BPP_NO_ALPHA ((1<<27)|(1<<28)) -#define DSPACNTR_32BPP ((1<<26)|(1<<27)|(1<<28)) -#define DSPACNTR_STEREO_ENABLE (1<<25) -#define DSPACNTR_STEREO_DISABLE 0 -#define DSPACNTR_SEL_PIPE_A 0 -#define DSPACNTR_SEL_PIPE_B (1<<24) -#define DSPACNTR_SRC_KEY_ENABLE (1<<22) -#define DSPACNTR_SRC_KEY_DISABLE 0 -#define DSPACNTR_LINE_DOUBLE (1<<20) -#define DSPACNTR_NO_LINE_DOUBLE 0 -#define DSPACNTR_STEREO_POLARITY_FIRST 0 -#define DSPACNTR_STEREO_POLARITY_SECOND (1<<18) +#define DSPBCNTR 0x71180 +#define DISPLAY_PLANE_ENABLE (1<<31) +#define DISPLAY_PLANE_DISABLE 0 +#define DISPPLANE_GAMMA_ENABLE (1<<30) +#define DISPPLANE_GAMMA_DISABLE 0 +#define DISPPLANE_PIXFORMAT_MASK (0xf<<26) +#define DISPPLANE_8BPP (0x2<<26) +#define DISPPLANE_15_16BPP (0x4<<26) +#define DISPPLANE_16BPP (0x5<<26) +#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26) +#define DISPPLANE_32BPP (0x7<<26) +#define DISPPLANE_STEREO_ENABLE (1<<25) +#define DISPPLANE_STEREO_DISABLE 0 +#define DISPPLANE_SEL_PIPE_MASK (1<<24) +#define DISPPLANE_SEL_PIPE_A 0 +#define DISPPLANE_SEL_PIPE_B (1<<24) +#define DISPPLANE_SRC_KEY_ENABLE (1<<22) +#define DISPPLANE_SRC_KEY_DISABLE 0 +#define DISPPLANE_LINE_DOUBLE (1<<20) +#define DISPPLANE_NO_LINE_DOUBLE 0 +#define DISPPLANE_STEREO_POLARITY_FIRST 0 +#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) +/* plane B only */ +#define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15) +#define DISPPLANE_ALPHA_TRANS_DISABLE 0 +#define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0 +#define DISPPLANE_SPRITE_ABOVE_OVERLAY (1) #define DSPABASE 0x70184 #define DSPASTRIDE 0x70188 -#define DSPBCNTR 0x71180 -#define DSPBCNTR_PLANE_B_ENABLE (1<<31) -#define DSPBCNTR_PLANE_B_DISABLE 0 -#define DSPBCNTR_GAMMA_ENABLE (1<<30) -#define DSPBCNTR_GAMMA_DISABLE 0 -#define DSPBCNTR_8BPP (1<<27) -#define DSPBCNTR_16BPP ((1<<26)|(1<<28)) -#define DSPBCNTR_32BPP_NO_ALPHA ((1<<27)|(1<<28)) -#define DSPBCNTR_32BPP ((1<<26)|(1<<27)|(1<<28)) -#define DSPBCNTR_STEREO_ENABLE (1<<25) -#define DSPBCNTR_STEREO_DISABLE 0 -#define DSPBCNTR_SEL_PIPE_A 0 -#define DSPBCNTR_SEL_PIPE_B (1<<24) -#define DSPBCNTR_SRC_KEY_ENABLE (1<<22) -#define DSPBCNTR_SRC_KEY_DISABLE 0 -#define DSPBCNTR_LINE_DOUBLE (1<<20) -#define DSPBCNTR_NO_LINE_DOUBLE 0 -#define DSPBCNTR_STEREO_POLARITY_FIRST 0 -#define DSPBCNTR_STEREO_POLARITY_SECOND (1<<18) -#define DSPBCNTR_ALPHA_TRANS_ENABLE (1<<15) -#define DSPBCNTR_ALPHA_TRANS_DISABLE 0 -#define DSPBCNTR_SPRITE_ABOVE_DISPLAYA 0 -#define DSPBCNTR_SPRITE_ABOVE_OVERLAY (1) - #define DSPBBASE 0x71184 +#define DSPBADDR DSPBBASE #define DSPBSTRIDE 0x71188 /* Various masks for reserved bits, etc. */ @@ -751,6 +794,22 @@ #define I830_RDRAM_ND(x) (((x) & 0x20) >> 5) #define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3) +#define I855_GMCH_GMS_MASK (0x7 << 4) +#define I855_GMCH_GMS_DISABLED 0x00 +#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) +#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4) +#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4) +#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4) +#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4) + +#define I85X_CAPID 0x44 +#define I85X_VARIANT_MASK 0x7 +#define I85X_VARIANT_SHIFT 5 +#define I855_GME 0x0 +#define I855_GM 0x4 +#define I852_GME 0x2 +#define I852_GM 0x5 + /* BLT commands */ #define COLOR_BLT_CMD ((2<<29)|(0x40<<22)|(0x3)) #define COLOR_BLT_WRITE_ALPHA (1<<21) @@ -806,9 +865,128 @@ /* Dword 1 */ #define MI_VERTEX_BUFFER_DISABLE (1) +/* Overlay Flip */ +#define MI_OVERLAY_FLIP (0x11<<23) +#define MI_OVERLAY_FLIP_CONTINUE (0<<21) +#define MI_OVERLAY_FLIP_ON (1<<21) +#define MI_OVERLAY_FLIP_OFF (2<<21) + +/* Wait for Events */ +#define MI_WAIT_FOR_EVENT (0x03<<23) +#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16) + +/* Flush */ +#define MI_FLUSH (0x04<<23) +#define MI_WRITE_DIRTY_STATE (1<<4) +#define MI_END_SCENE (1<<3) +#define MI_INHIBIT_RENDER_CACHE_FLUSH (1<<2) +#define MI_INVALIDATE_MAP_CACHE (1<<0) + +/* Noop */ +#define MI_NOOP 0x00 +#define MI_NOOP_WRITE_ID (1<<22) +#define MI_NOOP_ID_MASK (1<<22 - 1) + #define STATE3D_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x01<<16)) /* STATE3D_FOG_MODE stuff */ #define ENABLE_FOG_SOURCE (1<<27) #define ENABLE_FOG_CONST (1<<24) #define ENABLE_FOG_DENSITY (1<<23) + + +#define MAX_DISPLAY_PIPES 2 + +typedef enum { + CrtIndex = 0, + TvIndex, + DfpIndex, + LfpIndex, + Tv2Index, + Dfp2Index, + UnknownIndex, + Unknown2Index, + NumDisplayTypes, + NumKnownDisplayTypes = UnknownIndex +} DisplayType; + +/* What's connected to the pipes (as reported by the BIOS) */ +#define PIPE_ACTIVE_MASK 0xff +#define PIPE_CRT_ACTIVE (1 << CrtIndex) +#define PIPE_TV_ACTIVE (1 << TvIndex) +#define PIPE_DFP_ACTIVE (1 << DfpIndex) +#define PIPE_LCD_ACTIVE (1 << LfpIndex) +#define PIPE_TV2_ACTIVE (1 << Tv2Index) +#define PIPE_DFP2_ACTIVE (1 << Dfp2Index) +#define PIPE_UNKNOWN_ACTIVE ((1 << UnknownIndex) | \ + (1 << Unknown2Index)) + +#define PIPE_SIZED_DISP_MASK (PIPE_DFP_ACTIVE | \ + PIPE_LCD_ACTIVE | \ + PIPE_DFP2_ACTIVE) + +#define PIPE_A_SHIFT 0 +#define PIPE_B_SHIFT 8 +#define PIPE_SHIFT(n) ((n) == 0 ? \ + PIPE_A_SHIFT : PIPE_B_SHIFT) + +/* + * Some BIOS scratch area registers. The 845 (and 830?) store the amount + * of video memory available to the BIOS in SWF1. + */ + +#define SWF0 0x71410 +#define SWF1 0x71414 +#define SWF2 0x71418 +#define SWF3 0x7141c +#define SWF4 0x71420 +#define SWF5 0x71424 +#define SWF6 0x71428 + +/* + * 855 scratch registers. + */ +#define SWF00 0x70410 +#define SWF01 0x70414 +#define SWF02 0x70418 +#define SWF03 0x7041c +#define SWF04 0x70420 +#define SWF05 0x70424 +#define SWF06 0x70428 + +#define SWF10 SWF0 +#define SWF11 SWF1 +#define SWF12 SWF2 +#define SWF13 SWF3 +#define SWF14 SWF4 +#define SWF15 SWF5 +#define SWF16 SWF6 + +#define SWF30 0x72414 +#define SWF31 0x72418 +#define SWF32 0x7241c + +/* + * Overlay registers. These are overlay registers accessed via MMIO. + * Those loaded via the overlay register page are defined in i830_video.c. + */ +#define OVADD 0x30000 + +#define DOVSTA 0x30008 +#define OC_BUF (0x3<<20) + +#define OGAMC5 0x30010 +#define OGAMC4 0x30014 +#define OGAMC3 0x30018 +#define OGAMC2 0x3001c +#define OGAMC1 0x30020 +#define OGAMC0 0x30024 + + +/* + * Palette registers + */ +#define PALETTE_A 0x0a000 +#define PALETTE_B 0x0a800 + +#endif /* _I810_REG_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.21 Tue Dec 4 16:17:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c Tue Sep 10 20:29:32 2002 @@ -23,7 +23,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.21 2001/12/04 21:17:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.22 2002/09/11 00:29:32 dawes Exp $ */ /* * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. @@ -188,6 +188,7 @@ xfree(newAdaptors); } +/* *INDENT-OFF* */ /* client libraries expect an encoding */ static XF86VideoEncodingRec DummyEncoding[1] = { @@ -219,11 +220,12 @@ static XF86ImageRec Images[NUM_IMAGES] = { - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY }; +/* *INDENT-ON* */ typedef struct { CARD32 OBUF_0Y; Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c:1.6 Mon Nov 26 13:55:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c Wed Oct 30 07:52:18 2002 @@ -25,11 +25,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c,v 1.6 2001/11/26 18:55:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c,v 1.8 2002/10/30 12:52:18 alanh Exp $ */ /* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "xf86.h" @@ -41,210 +54,205 @@ }; struct wm_info i810_wm_8_100[] = { - { 0, 0x22003000 }, - { 25.2, 0x22003000 }, - { 28.0, 0x22003000 }, - { 31.5, 0x22003000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22008000 }, - { 50.0, 0x22008000 }, - { 56.3, 0x22008000 }, - { 65.0, 0x22008000 }, - { 75.0, 0x22008000 }, - { 78.8, 0x22008000 }, - { 80.0, 0x22008000 }, - { 94.0, 0x22008000 }, - { 96.0, 0x22107000 }, - { 99.0, 0x22107000 }, - { 108.0, 0x22107000 }, - { 121.0, 0x22107000 }, - { 128.9, 0x22107000 }, - { 132.0, 0x22109000 }, - { 135.0, 0x22109000 }, - { 157.5, 0x2210b000 }, - { 162.0, 0x2210b000 }, - { 175.5, 0x2210b000 }, - { 189.0, 0x2220e000 }, - { 202.5, 0x2220e000 } + {0, 0x22003000}, + {25.2, 0x22003000}, + {28.0, 0x22003000}, + {31.5, 0x22003000}, + {36.0, 0x22007000}, + {40.0, 0x22007000}, + {45.0, 0x22007000}, + {49.5, 0x22008000}, + {50.0, 0x22008000}, + {56.3, 0x22008000}, + {65.0, 0x22008000}, + {75.0, 0x22008000}, + {78.8, 0x22008000}, + {80.0, 0x22008000}, + {94.0, 0x22008000}, + {96.0, 0x22107000}, + {99.0, 0x22107000}, + {108.0, 0x22107000}, + {121.0, 0x22107000}, + {128.9, 0x22107000}, + {132.0, 0x22109000}, + {135.0, 0x22109000}, + {157.5, 0x2210b000}, + {162.0, 0x2210b000}, + {175.5, 0x2210b000}, + {189.0, 0x2220e000}, + {202.5, 0x2220e000} }; struct wm_info i810_wm_16_100[] = { - { 0, 0x22004000 }, - { 25.2, 0x22006000 }, - { 28.0, 0x22006000 }, - { 31.5, 0x22007000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22009000 }, - { 50.0, 0x22009000 }, - { 56.3, 0x22108000 }, - { 65.0, 0x2210e000 }, - { 75.0, 0x2210e000 }, - { 78.8, 0x2210e000 }, - { 80.0, 0x22210000 }, - { 94.5, 0x22210000 }, - { 96.0, 0x22210000 }, - { 99.0, 0x22210000 }, - { 108.0, 0x22210000 }, - { 121.0, 0x22210000 }, - { 128.9, 0x22210000 }, - { 132.0, 0x22314000 }, - { 135.0, 0x22314000 }, - { 157.5, 0x22415000 }, - { 162.0, 0x22416000 }, - { 175.5, 0x22416000 }, - { 189.0, 0x22416000 }, - { 195.0, 0x22416000 }, - { 202.5, 0x22416000 } + {0, 0x22004000}, + {25.2, 0x22006000}, + {28.0, 0x22006000}, + {31.5, 0x22007000}, + {36.0, 0x22007000}, + {40.0, 0x22007000}, + {45.0, 0x22007000}, + {49.5, 0x22009000}, + {50.0, 0x22009000}, + {56.3, 0x22108000}, + {65.0, 0x2210e000}, + {75.0, 0x2210e000}, + {78.8, 0x2210e000}, + {80.0, 0x22210000}, + {94.5, 0x22210000}, + {96.0, 0x22210000}, + {99.0, 0x22210000}, + {108.0, 0x22210000}, + {121.0, 0x22210000}, + {128.9, 0x22210000}, + {132.0, 0x22314000}, + {135.0, 0x22314000}, + {157.5, 0x22415000}, + {162.0, 0x22416000}, + {175.5, 0x22416000}, + {189.0, 0x22416000}, + {195.0, 0x22416000}, + {202.5, 0x22416000} }; - struct wm_info i810_wm_24_100[] = { - { 0, 0x22006000 }, - { 25.2, 0x22009000 }, - { 28.0, 0x22009000 }, - { 31.5, 0x2200a000 }, - { 36.0, 0x2210c000 }, - { 40.0, 0x2210c000 }, - { 45.0, 0x2210c000 }, - { 49.5, 0x22111000 }, - { 50.0, 0x22111000 }, - { 56.3, 0x22111000 }, - { 65.0, 0x22214000 }, - { 75.0, 0x22214000 }, - { 78.8, 0x22215000 }, - { 80.0, 0x22216000 }, - { 94.5, 0x22218000 }, - { 96.0, 0x22418000 }, - { 99.0, 0x22418000 }, - { 108.0, 0x22418000 }, - { 121.0, 0x22418000 }, - { 128.9, 0x22419000 }, - { 132.0, 0x22519000 }, - { 135.0, 0x4441d000 }, - { 157.5, 0x44419000 }, - { 162.0, 0x44419000 }, - { 175.5, 0x44419000 }, - { 189.0, 0x44419000 }, - { 195.0, 0x44419000 }, - { 202.5, 0x44419000 } + {0, 0x22006000}, + {25.2, 0x22009000}, + {28.0, 0x22009000}, + {31.5, 0x2200a000}, + {36.0, 0x2210c000}, + {40.0, 0x2210c000}, + {45.0, 0x2210c000}, + {49.5, 0x22111000}, + {50.0, 0x22111000}, + {56.3, 0x22111000}, + {65.0, 0x22214000}, + {75.0, 0x22214000}, + {78.8, 0x22215000}, + {80.0, 0x22216000}, + {94.5, 0x22218000}, + {96.0, 0x22418000}, + {99.0, 0x22418000}, + {108.0, 0x22418000}, + {121.0, 0x22418000}, + {128.9, 0x22419000}, + {132.0, 0x22519000}, + {135.0, 0x4441d000}, + {157.5, 0x44419000}, + {162.0, 0x44419000}, + {175.5, 0x44419000}, + {189.0, 0x44419000}, + {195.0, 0x44419000}, + {202.5, 0x44419000} }; struct wm_info i810_wm_32_100[] = { - { 0, 0x2210b000 }, - { 60, 0x22415000 }, /* 0x314000 works too */ - { 80, 0x22419000 } /* 0x518000 works too */ + {0, 0x2210b000}, + {60, 0x22415000}, /* 0x314000 works too */ + {80, 0x22419000} /* 0x518000 works too */ }; - struct wm_info i810_wm_8_133[] = { - { 0, 0x22003000 }, - { 25.2, 0x22003000 }, - { 28.0, 0x22003000 }, - { 31.5, 0x22003000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22008000 }, - { 50.0, 0x22008000 }, - { 56.3, 0x22008000 }, - { 65.0, 0x22008000 }, - { 75.0, 0x22008000 }, - { 78.8, 0x22008000 }, - { 80.0, 0x22008000 }, - { 94.0, 0x22008000 }, - { 96.0, 0x22107000 }, - { 99.0, 0x22107000 }, - { 108.0, 0x22107000 }, - { 121.0, 0x22107000 }, - { 128.9, 0x22107000 }, - { 132.0, 0x22109000 }, - { 135.0, 0x22109000 }, - { 157.5, 0x2210b000 }, - { 162.0, 0x2210b000 }, - { 175.5, 0x2210b000 }, - { 189.0, 0x2220e000 }, - { 202.5, 0x2220e000 } + {0, 0x22003000}, + {25.2, 0x22003000}, + {28.0, 0x22003000}, + {31.5, 0x22003000}, + {36.0, 0x22007000}, + {40.0, 0x22007000}, + {45.0, 0x22007000}, + {49.5, 0x22008000}, + {50.0, 0x22008000}, + {56.3, 0x22008000}, + {65.0, 0x22008000}, + {75.0, 0x22008000}, + {78.8, 0x22008000}, + {80.0, 0x22008000}, + {94.0, 0x22008000}, + {96.0, 0x22107000}, + {99.0, 0x22107000}, + {108.0, 0x22107000}, + {121.0, 0x22107000}, + {128.9, 0x22107000}, + {132.0, 0x22109000}, + {135.0, 0x22109000}, + {157.5, 0x2210b000}, + {162.0, 0x2210b000}, + {175.5, 0x2210b000}, + {189.0, 0x2220e000}, + {202.5, 0x2220e000} }; - struct wm_info i810_wm_16_133[] = { - { 0, 0x22004000 }, - { 25.2, 0x22006000 }, - { 28.0, 0x22006000 }, - { 31.5, 0x22007000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22009000 }, - { 50.0, 0x22009000 }, - { 56.3, 0x22108000 }, - { 65.0, 0x2210e000 }, - { 75.0, 0x2210e000 }, - { 78.8, 0x2210e000 }, - { 80.0, 0x22210000 }, - { 94.5, 0x22210000 }, - { 96.0, 0x22210000 }, - { 99.0, 0x22210000 }, - { 108.0, 0x22210000 }, - { 121.0, 0x22210000 }, - { 128.9, 0x22210000 }, - { 132.0, 0x22314000 }, - { 135.0, 0x22314000 }, - { 157.5, 0x22415000 }, - { 162.0, 0x22416000 }, - { 175.5, 0x22416000 }, - { 189.0, 0x22416000 }, - { 195.0, 0x22416000 }, - { 202.5, 0x22416000 } + {0, 0x22004000}, + {25.2, 0x22006000}, + {28.0, 0x22006000}, + {31.5, 0x22007000}, + {36.0, 0x22007000}, + {40.0, 0x22007000}, + {45.0, 0x22007000}, + {49.5, 0x22009000}, + {50.0, 0x22009000}, + {56.3, 0x22108000}, + {65.0, 0x2210e000}, + {75.0, 0x2210e000}, + {78.8, 0x2210e000}, + {80.0, 0x22210000}, + {94.5, 0x22210000}, + {96.0, 0x22210000}, + {99.0, 0x22210000}, + {108.0, 0x22210000}, + {121.0, 0x22210000}, + {128.9, 0x22210000}, + {132.0, 0x22314000}, + {135.0, 0x22314000}, + {157.5, 0x22415000}, + {162.0, 0x22416000}, + {175.5, 0x22416000}, + {189.0, 0x22416000}, + {195.0, 0x22416000}, + {202.5, 0x22416000} }; struct wm_info i810_wm_24_133[] = { - { 0, 0x22006000 }, - { 25.2, 0x22009000 }, - { 28.0, 0x22009000 }, - { 31.5, 0x2200a000 }, - { 36.0, 0x2210c000 }, - { 40.0, 0x2210c000 }, - { 45.0, 0x2210c000 }, - { 49.5, 0x22111000 }, - { 50.0, 0x22111000 }, - { 56.3, 0x22111000 }, - { 65.0, 0x22214000 }, - { 75.0, 0x22214000 }, - { 78.8, 0x22215000 }, - { 80.0, 0x22216000 }, - { 94.5, 0x22218000 }, - { 96.0, 0x22418000 }, - { 99.0, 0x22418000 }, - { 108.0, 0x22418000 }, - { 121.0, 0x22418000 }, - { 128.9, 0x22419000 }, - { 132.0, 0x22519000 }, - { 135.0, 0x4441d000 }, - { 157.5, 0x44419000 }, - { 162.0, 0x44419000 }, - { 175.5, 0x44419000 }, - { 189.0, 0x44419000 }, - { 195.0, 0x44419000 }, - { 202.5, 0x44419000 } + {0, 0x22006000}, + {25.2, 0x22009000}, + {28.0, 0x22009000}, + {31.5, 0x2200a000}, + {36.0, 0x2210c000}, + {40.0, 0x2210c000}, + {45.0, 0x2210c000}, + {49.5, 0x22111000}, + {50.0, 0x22111000}, + {56.3, 0x22111000}, + {65.0, 0x22214000}, + {75.0, 0x22214000}, + {78.8, 0x22215000}, + {80.0, 0x22216000}, + {94.5, 0x22218000}, + {96.0, 0x22418000}, + {99.0, 0x22418000}, + {108.0, 0x22418000}, + {121.0, 0x22418000}, + {128.9, 0x22419000}, + {132.0, 0x22519000}, + {135.0, 0x4441d000}, + {157.5, 0x44419000}, + {162.0, 0x44419000}, + {175.5, 0x44419000}, + {189.0, 0x44419000}, + {195.0, 0x44419000}, + {202.5, 0x44419000} }; - #define Elements(x) (sizeof(x)/sizeof(*x)) - - /* * I810CalcFIFO -- * * Calculate burst length and FIFO watermark. */ -unsigned int I810CalcWatermark( ScrnInfoPtr pScrn, double freq, Bool dcache ) +unsigned int +I810CalcWatermark(ScrnInfoPtr pScrn, double freq, Bool dcache) { I810Ptr pI810 = I810PTR(pScrn); struct wm_info *tab; @@ -252,7 +260,7 @@ int i; if (pI810->LmFreqSel == 100) { - switch(pScrn->bitsPerPixel) { + switch (pScrn->bitsPerPixel) { case 8: tab = i810_wm_8_100; nr = Elements(i810_wm_8_100); @@ -265,11 +273,11 @@ tab = i810_wm_24_100; nr = Elements(i810_wm_24_100); break; - default: + default: return 0; } } else { - switch(pScrn->bitsPerPixel) { + switch (pScrn->bitsPerPixel) { case 8: tab = i810_wm_8_133; nr = Elements(i810_wm_8_133); @@ -286,15 +294,15 @@ return 0; } } + + for (i = 0; i < nr && tab[i].freq < freq; i++) ; - for (i = 0 ; i < nr && tab[i].freq < freq ; i++); - if (i == nr) i--; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "chose watermark 0x%x: (tab.freq %.1f)\n", - tab[i].wm, tab[i].freq); + "chose watermark 0x%x: (tab.freq %.1f)\n", + tab[i].wm, tab[i].freq); /* None of these values (sourced from intel) have watermarks for * the dcache memory. Fake it for now by using the same watermark @@ -307,8 +315,7 @@ * now. */ if (dcache) - return (tab[i].wm & ~0xffffff) | ((tab[i].wm>>12) & 0xfff); + return (tab[i].wm & ~0xffffff) | ((tab[i].wm >> 12) & 0xfff); else return tab[i].wm; } - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h:1.7 --- /dev/null Thu Feb 27 12:30:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h Tue Jan 28 17:47:09 2003 @@ -0,0 +1,395 @@ + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 David Dawes + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.7 2003/01/28 22:47:09 dawes Exp $ */ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * David Dawes <dawes@tungstengraphics.com> + * + */ + +#if 0 +#define I830DEBUG +#endif + +#ifndef REMAP_RESERVED +#define REMAP_RESERVED 0 +#endif + +#ifndef _I830_H_ +#define _I830_H_ + +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "i810_reg.h" +#include "xaa.h" +#include "xf86Cursor.h" +#include "xf86xv.h" +#include "xf86int10.h" +#include "vbe.h" +#include "vgaHW.h" + +#ifdef XF86DRI +#include "xf86drm.h" +#include "sarea.h" +#define _XF86DRI_SERVER_ +#include "xf86dri.h" +#include "dri.h" +#include "GL/glxint.h" +#include "i830_dri.h" +#endif + +#include "common.h" + +/* I830 Video BIOS support */ + +/* + * The mode handling is based upon the VESA driver written by + * Paulo César Pereira de Andrade <pcpa@conectiva.com.br>. + */ + +typedef struct _VESARec { + /* SVGA state */ + pointer state, pstate; + int statePage, stateSize, stateMode; + CARD32 *savedPal; + int savedScanlinePitch; + xf86MonPtr monitor; + /* Don't try to set the refresh rate for any modes. */ + Bool useDefaultRefresh; +} VESARec, *VESAPtr; + + +typedef struct _I830Rec *I830Ptr; + +typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, + CARD8 index, CARD8 value); +typedef CARD8(*I830ReadIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, + CARD8 index); +typedef void (*I830WriteByteFunc)(I830Ptr pI830, IOADDRESS addr, CARD8 value); +typedef CARD8(*I830ReadByteFunc)(I830Ptr pI830, IOADDRESS addr); + +/* Linear region allocated in framebuffer. */ +typedef struct _I830MemPool *I830MemPoolPtr; +typedef struct _I830MemRange *I830MemRangePtr; +typedef struct _I830MemRange { + long Start; + long End; + long Size; + unsigned long Physical; + unsigned long Offset; /* Offset of AGP-allocated portion */ + unsigned long Alignment; + int Key; + I830MemPoolPtr Pool; +} I830MemRange; + +typedef struct _I830MemPool { + I830MemRange Total; + I830MemRange Free; + I830MemRange Fixed; + I830MemRange Allocated; +} I830MemPool; + +typedef struct { + int tail_mask; + I830MemRange mem; + unsigned char *virtual_start; + int head; + int tail; + int space; +} I830RingBuffer; + +typedef struct { + unsigned int Fence[8]; +} I830RegRec, *I830RegPtr; + +typedef struct _I830Rec { + unsigned char *MMIOBase; + unsigned char *FbBase; + int cpp; + + unsigned int bufferOffset; /* for I830SelectBuffer */ + BoxRec FbMemBox; + int CacheLines; + + /* These are set in PreInit and never changed. */ + unsigned long FbMapSize; + unsigned long TotalVideoRam; + I830MemRange StolenMemory; /* pre-allocated memory */ + unsigned long BIOSMemorySize; /* min stolen pool size */ + + /* These change according to what has been allocated. */ + long FreeMemory; + I830MemRange MemoryAperture; + I830MemPool StolenPool; + unsigned long allocatedMemory; + + /* Regions allocated either from the above pools, or from agpgart. */ + I830MemRange FrontBuffer; + I830MemRange CursorMem; + I830RingBuffer LpRing; + I830MemRange Scratch; + +#if REMAP_RESERVED + I830MemRange Dummy; +#endif + +#ifdef I830_XV + /* For Xvideo */ + I830MemRange OverlayMem; +#endif + +#ifdef XF86DRI + I830MemRange BackBuffer; + I830MemRange DepthBuffer; + I830MemRange TexMem; + I830MemRange BufferMem; + I830MemRange ContextMem; + int TexGranularity; + int drmMinor; + Bool have3DWindows; +#endif + + Bool NeedRingBufferLow; + Bool allowPageFlip; + + int auxPitch; + int auxPitchBits; + + Bool CursorNeedsPhysical; + + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + + int Chipset; + unsigned long LinearAddr; + unsigned long MMIOAddr; + IOADDRESS ioBase; + EntityInfoPtr pEnt; + pciVideoPtr PciInfo; + PCITAG PciTag; + CARD8 variant; + + unsigned int BR[20]; + + int GttBound; + + unsigned char **ScanlineColorExpandBuffers; + int NumScanlineColorExpandBuffers; + int nextColorExpandBuf; + + I830RegRec SavedReg; + I830RegRec ModeReg; + + Bool noAccel; + Bool SWCursor; + Bool cursorOn; + XAAInfoRecPtr AccelInfoRec; + xf86CursorInfoPtr CursorInfoRec; + CloseScreenProcPtr CloseScreen; + ScreenBlockHandlerProcPtr BlockHandler; + + I830WriteIndexedByteFunc writeControl; + I830ReadIndexedByteFunc readControl; + I830WriteByteFunc writeStandard; + I830ReadByteFunc readStandard; + + Bool XvDisabled; /* Xv disabled in PreInit. */ + Bool XvEnabled; /* Xv enabled for this generation. */ + +#ifdef I830_XV + int colorKey; + XF86VideoAdaptorPtr adaptor; + Bool overlayOn; +#endif + + Bool directRenderingDisabled; /* DRI disabled in PreInit. */ + Bool directRenderingEnabled; /* DRI enabled this generation. */ + +#ifdef XF86DRI + Bool directRenderingOpen; + int LockHeld; + DRIInfoPtr pDRIInfo; + int drmSubFD; + int numVisualConfigs; + __GLXvisualConfig *pVisualConfigs; + I830ConfigPrivPtr pVisualConfigsPriv; + drmHandle buffer_map; + drmHandle ring_map; +#endif + + OptionInfoPtr Options; + + /* Stolen memory support */ + Bool StolenOnly; + + /* Video BIOS support. */ + vbeInfoPtr pVbe; + VbeInfoBlock *vbeInfo; + VESAPtr vesa; + + Bool overrideBIOSMemSize; + int saveBIOSMemSize; + int newBIOSMemSize; + Bool useSWF1; + int saveSWF1; + + Bool swfSaved; + CARD32 saveSWF0; + CARD32 saveSWF4; + + /* Use BIOS call 0x5f64 to explicitly enable displays. */ + Bool enableDisplays; + /* Use BIOS call 0x5f05 to set the refresh rate. */ + Bool useExtendedRefresh; + + int configuredDevices; + + /* These are indexed by the display types */ + Bool displayAttached[NumDisplayTypes]; + Bool displayPresent[NumDisplayTypes]; + BoxRec displaySize[NumDisplayTypes]; + + /* [0] is Pipe A, [1] is Pipe B. */ + int availablePipes; + int pipeDevices[MAX_DISPLAY_PIPES]; + /* [0] is display plane A, [1] is display plane B. */ + Bool pipeEnabled[MAX_DISPLAY_PIPES]; + BoxRec pipeDisplaySize[MAX_DISPLAY_PIPES]; + int planeEnabled[MAX_DISPLAY_PIPES]; + + /* Driver phase/state information */ + Bool starting; + Bool closing; + Bool suspended; + +} I830Rec; + +#define I830PTR(p) ((I830Ptr)((p)->driverPrivate)) +#define I830REGPTR(p) (&(I830PTR(p)->ModeReg)) + +#define I830_SELECT_FRONT 0 +#define I830_SELECT_BACK 1 +#define I830_SELECT_DEPTH 2 + +/* I830 specific functions */ +extern int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis); +extern void I830SetPIOAccess(I830Ptr pI830); +extern void I830SetMMIOAccess(I830Ptr pI830); +extern void I830PrintErrorState(ScrnInfoPtr pScrn); +extern void I830Sync(ScrnInfoPtr pScrn); +extern void I830InitHWCursor(ScrnInfoPtr pScrn); +extern Bool I830CursorInit(ScreenPtr pScreen); +extern void I830EmitInvarientState(ScrnInfoPtr pScrn); +extern void I830SelectBuffer(ScrnInfoPtr pScrn, int buffer); + +extern void I830RefreshRing(ScrnInfoPtr pScrn); +extern void I830EmitFlush(ScrnInfoPtr pScrn); + +extern Bool I830DGAInit(ScreenPtr pScreen); + +#ifdef I830_XV +extern void I830InitVideo(ScreenPtr pScreen); +extern void I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode); +extern void I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode); +#endif + +#ifdef XF86DRI +extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags); +extern void I830SetupMemoryTiling(ScrnInfoPtr pScrn); +extern Bool I830DRIScreenInit(ScreenPtr pScreen); +extern Bool I830DRIDoMappings(ScreenPtr pScreen); +extern void I830DRICloseScreen(ScreenPtr pScreen); +extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen); +#endif +extern Bool I830AccelInit(ScreenPtr pScreen); +extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, + int ydir, int rop, + unsigned int planemask, + int trans_color); +extern void I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, + int srcY, int dstX, int dstY, + int w, int h); +extern void I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask); +extern void I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h); + +extern void I830ResetAllocations(ScrnInfoPtr pScrn, const int flags); +extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn); +extern long I830GetExcessMemoryAllocations(ScrnInfoPtr pScrn); +extern Bool I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags); +extern Bool I830DoPoolAllocation(ScrnInfoPtr pScrn, I830MemPool *pool); +extern Bool I830FixupOffsets(ScrnInfoPtr pScrn); +extern Bool I830BindGARTMemory(ScrnInfoPtr pScrn); +extern Bool I830UnbindGARTMemory(ScrnInfoPtr pScrn); +extern unsigned long I830AllocVidMem(ScrnInfoPtr pScrn, I830MemRange *result, + I830MemPool *pool, unsigned long size, + unsigned long alignment, int flags); + +extern void I830PrintAllRegisters(I830RegPtr i830Reg); +extern void I830ReadAllRegisters(I830Ptr pI830, I830RegPtr i830Reg); + +extern void I830ChangeFrontbuffer(ScrnInfoPtr pScrn,int buffer); + +/* + * 12288 is set as the maximum, chosen because it is enough for + * 1920x1440@32bpp with a 2048 pixel line pitch with some to spare. + */ +#define I830_MAXIMUM_VBIOS_MEM 12288 +#define I830_DEFAULT_VIDEOMEM_2D (MB(8) / 1024) +#define I830_DEFAULT_VIDEOMEM_3D (MB(32) / 1024) + +/* Flags for memory allocation function */ +#define FROM_ANYWHERE 0x00000000 +#define FROM_POOL_ONLY 0x00000001 +#define FROM_NEW_ONLY 0x00000002 +#define FROM_MASK 0x0000000f + +#define ALLOCATE_AT_TOP 0x00000010 +#define ALLOCATE_AT_BOTTOM 0x00000020 +#define FORCE_GAPS 0x00000040 + +#define NEED_PHYSICAL_ADDR 0x00000100 +#define ALIGN_BOTH_ENDS 0x00000200 +#define FORCE_LOW 0x00000400 + +#define ALLOC_NO_TILING 0x00001000 +#define ALLOC_INITIAL 0x00002000 + +#define ALLOCATE_DRY_RUN 0x80000000 + + +#endif /* _I830_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_accel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_accel.c:1.4 --- /dev/null Thu Feb 27 12:30:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_accel.c Mon Dec 9 20:27:05 2002 @@ -0,0 +1,770 @@ +/* + * XXX So far, for GXxor this is about 40% of the speed of SW, but CPU + * utilisation falls from 95% to < 5%. + */ +#ifndef DO_SCANLINE_IMAGE_WRITE +#define DO_SCANLINE_IMAGE_WRITE 0 +#endif + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_accel.c,v 1.4 2002/12/10 01:27:05 dawes Exp $ */ + +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * + */ + +#include "xf86_ansic.h" +#include "xf86.h" + +#include "i830.h" +#include "i810_reg.h" + +static unsigned int i810Rop[16] = { + 0x00, /* GXclear */ + 0x88, /* GXand */ + 0x44, /* GXandReverse */ + 0xCC, /* GXcopy */ + 0x22, /* GXandInvert */ + 0xAA, /* GXnoop */ + 0x66, /* GXxor */ + 0xEE, /* GXor */ + 0x11, /* GXnor */ + 0x99, /* GXequiv */ + 0x55, /* GXinvert */ + 0xDD, /* GXorReverse */ + 0x33, /* GXcopyInvert */ + 0xBB, /* GXorInverted */ + 0x77, /* GXnand */ + 0xFF /* GXset */ +}; + +static unsigned int i810PatternRop[16] = { + 0x00, /* GXclear */ + 0xA0, /* GXand */ + 0x50, /* GXandReverse */ + 0xF0, /* GXcopy */ + 0x0A, /* GXandInvert */ + 0xAA, /* GXnoop */ + 0x5A, /* GXxor */ + 0xFA, /* GXor */ + 0x05, /* GXnor */ + 0xA5, /* GXequiv */ + 0x55, /* GXinvert */ + 0xF5, /* GXorReverse */ + 0x0F, /* GXcopyInvert */ + 0xAF, /* GXorInverted */ + 0x5F, /* GXnand */ + 0xFF /* GXset */ +}; + +int +I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830RingBuffer *ring = &(pI830->LpRing); + int iters = 0; + int start = 0; + int now = 0; + int last_head = 0; + int first = 0; + + /* If your system hasn't moved the head pointer in 2 seconds, I'm going to + * call it crashed. + */ + if (timeout_millis == 0) + timeout_millis = 2000; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) { + ErrorF("I830WaitLpRing %d\n", n); + first = GetTimeInMillis(); + } + + while (ring->space < n) { + ring->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + ring->space = ring->head - (ring->tail + 8); + + if (ring->space < 0) + ring->space += ring->mem.Size; + + iters++; + now = GetTimeInMillis(); + if (start == 0 || now < start || ring->head != last_head) { + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + if (now > start) + ErrorF("space: %d wanted %d\n", ring->space, n); + start = now; + last_head = ring->head; + } else if (now - start > timeout_millis) { + ErrorF("Error in I830WaitLpRing(), now is %d, start is %d\n", now, + start); + I830PrintErrorState(pScrn); + ErrorF("space: %d wanted %d\n", ring->space, n); +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); + DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]); + } +#endif + pI830->AccelInfoRec = NULL; /* Stops recursive behavior */ + FatalError("lockup\n"); + } + + DELAY(10); + } + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) { + now = GetTimeInMillis(); + if (now - first) { + ErrorF("Elapsed %d ms\n", now - first); + ErrorF("space: %d wanted %d\n", ring->space, n); + } + } + + return iters; +} + +void +I830Sync(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC)) + ErrorF("I830Sync\n"); + +#ifdef XF86DRI + /* VT switching tries to do this. + */ + if (!pI830->LockHeld && pI830->directRenderingEnabled) { + return; + } +#endif + + /* Send a flush instruction and then wait till the ring is empty. + * This is stronger than waiting for the blitter to finish as it also + * flushes the internal graphics caches. + */ + { + BEGIN_LP_RING(2); + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); + OUT_RING(MI_NOOP); /* pad to quadword */ + ADVANCE_LP_RING(); + } + + I830WaitLpRing(pScrn, pI830->LpRing.mem.Size - 8, 0); + + pI830->LpRing.space = pI830->LpRing.mem.Size - 8; + pI830->nextColorExpandBuf = 0; +} + +void +I830EmitFlush(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + BEGIN_LP_RING(2); + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); + OUT_RING(MI_NOOP); /* pad to quadword */ + ADVANCE_LP_RING(); +} + +void +I830SelectBuffer(ScrnInfoPtr pScrn, int buffer) +{ + I830Ptr pI830 = I830PTR(pScrn); + + switch (buffer) { +#ifdef XF86DRI + case I830_SELECT_BACK: + pI830->bufferOffset = pI830->BackBuffer.Start; + break; + case I830_SELECT_DEPTH: + pI830->bufferOffset = pI830->DepthBuffer.Start; + break; +#endif + default: + case I830_SELECT_FRONT: + pI830->bufferOffset = pI830->FrontBuffer.Start; + break; + } + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SelectBuffer %d --> offset %x\n", + buffer, pI830->bufferOffset); +} + +void +I830RefreshRing(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + pI830->LpRing.head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + pI830->LpRing.tail = INREG(LP_RING + RING_TAIL); + pI830->LpRing.space = pI830->LpRing.head - (pI830->LpRing.tail + 8); + if (pI830->LpRing.space < 0) + pI830->LpRing.space += pI830->LpRing.mem.Size; + + if (pI830->AccelInfoRec) + pI830->AccelInfoRec->NeedToSync = TRUE; +} + +/* I830 Accel Functions */ + +static void I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, + int pattx, int patty, + int fg, int bg, int rop, + unsigned int planemask); +static void I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, + int pattx, int patty, + int x, int y, int w, int h); + +static void I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int mask); + +static void I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr + pScrn, int x, + int y, int w, + int h, + int skipleft); + +static void I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); + +#if DO_SCANLINE_IMAGE_WRITE +static void I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, + unsigned int planemask, + int trans_color, int bpp, + int depth); +static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft); +static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); +#endif + + +/* The following function sets up the supported acceleration. Call it + * from the FbInit() function in the SVGA driver, or before ScreenInit + * in a monolithic server. + */ +Bool +I830AccelInit(ScreenPtr pScreen) +{ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830AccelInit\n"); + + pI830->AccelInfoRec = infoPtr = XAACreateInfoRec(); + if (!infoPtr) + return FALSE; + + pI830->bufferOffset = 0; + infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; + + /* Use the same sync function as the I830. + */ + infoPtr->Sync = I830Sync; + + /* Everything else is different enough to justify different functions */ + { + infoPtr->SolidFillFlags = NO_PLANEMASK; + infoPtr->SetupForSolidFill = I830SetupForSolidFill; + infoPtr->SubsequentSolidFillRect = I830SubsequentSolidFillRect; + } + + { + infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY); + + infoPtr->SetupForScreenToScreenCopy = I830SetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = + I830SubsequentScreenToScreenCopy; + } + + { + infoPtr->SetupForMono8x8PatternFill = I830SetupForMono8x8PatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = + I830SubsequentMono8x8PatternFillRect; + + infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_ORIGIN | + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_PLANEMASK); + + } + + if (pI830->Scratch.Size != 0) { + int i; + int width = ((pScrn->displayWidth + 31) & ~31) / 8; + int nr_buffers = pI830->Scratch.Size / width; + unsigned char *ptr = pI830->FbBase + pI830->Scratch.Start; + + pI830->NumScanlineColorExpandBuffers = nr_buffers; + pI830->ScanlineColorExpandBuffers = (unsigned char **) + xnfcalloc(nr_buffers, sizeof(unsigned char *)); + + for (i = 0; i < nr_buffers; i++, ptr += width) + pI830->ScanlineColorExpandBuffers[i] = ptr; + + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + (NO_PLANEMASK | ROP_NEEDS_SOURCE | BIT_ORDER_IN_BYTE_MSBFIRST); + + infoPtr->ScanlineColorExpandBuffers = (unsigned char **) + xnfcalloc(1, sizeof(unsigned char *)); + infoPtr->NumScanlineColorExpandBuffers = 1; + + infoPtr->ScanlineColorExpandBuffers[0] = + pI830->ScanlineColorExpandBuffers[0]; + pI830->nextColorExpandBuf = 0; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + I830SetupForScanlineCPUToScreenColorExpandFill; + + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + I830SubsequentScanlineCPUToScreenColorExpandFill; + + infoPtr->SubsequentColorExpandScanline = + I830SubsequentColorExpandScanline; + +#if DO_SCANLINE_IMAGE_WRITE + infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->ScanlineImageWriteBuffers = infoPtr->ScanlineColorExpandBuffers; + infoPtr->SetupForScanlineImageWrite = I830SetupForScanlineImageWrite; + infoPtr->SubsequentScanlineImageWriteRect = + I830SubsequentScanlineImageWriteRect; + infoPtr->SubsequentImageWriteScanline = I830SubsequentImageWriteScanline; + infoPtr->ScanlineImageWriteFlags = NO_GXCOPY | + NO_PLANEMASK | + ROP_NEEDS_SOURCE | + SCANLINE_PAD_DWORD; +#endif + } + + I830SelectBuffer(pScrn, I830_SELECT_FRONT); + + return XAAInit(pScreen, infoPtr); +} + +void +I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SetupForFillRectSolid color: %x rop: %x mask: %x\n", + color, rop, planemask); + + pI830->BR[13] = ((i810PatternRop[rop] << 16) | + (pScrn->displayWidth * pI830->cpp)); + + pI830->BR[16] = color; + + switch (pScrn->bitsPerPixel) { + case 8: + break; + case 16: + pI830->BR[13] |= (1 << 24); + break; + case 32: + pI830->BR[13] |= ((1 << 25) | (1 << 24)); + break; + } +} + +void +I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h); + + { + BEGIN_LP_RING(6); + + if (pScrn->bitsPerPixel == 32) { + OUT_RING(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA | + COLOR_BLT_WRITE_RGB); + } else { + OUT_RING(COLOR_BLT_CMD); + } + OUT_RING(pI830->BR[13]); + OUT_RING((h << 16) | (w * pI830->cpp)); + OUT_RING(pI830->bufferOffset + (y * pScrn->displayWidth + x) * + pI830->cpp); + OUT_RING(pI830->BR[16]); + OUT_RING(0); + + ADVANCE_LP_RING(); + } +} + +void +I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, + unsigned int planemask, int transparency_color) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SetupForScreenToScreenCopy %d %d %x %x %d\n", + xdir, ydir, rop, planemask, transparency_color); + + pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); + pI830->BR[13] |= i810Rop[rop] << 16; + + switch (pScrn->bitsPerPixel) { + case 8: + break; + case 16: + pI830->BR[13] |= (1 << 24); + break; + case 32: + pI830->BR[13] |= ((1 << 25) | (1 << 24)); + break; + } + +} + +void +I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1, + int dst_x1, int dst_y1, int w, int h) +{ + I830Ptr pI830 = I830PTR(pScrn); + int dst_x2, dst_y2; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", + src_x1, src_y1, dst_x1, dst_y1, w, h); + + dst_x2 = dst_x1 + w; + dst_y2 = dst_y1 + h; + + { + BEGIN_LP_RING(8); + + if (pScrn->bitsPerPixel == 32) { + OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + } else { + OUT_RING(XY_SRC_COPY_BLT_CMD); + } + OUT_RING(pI830->BR[13]); + OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff)); + OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff)); + OUT_RING(pI830->bufferOffset); + OUT_RING((src_y1 << 16) | (src_x1 & 0xffff)); + OUT_RING(pI830->BR[13] & 0xFFFF); + OUT_RING(pI830->bufferOffset); + + ADVANCE_LP_RING(); + } +} + +static void +I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, + int fg, int bg, int rop, + unsigned int planemask) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SetupForMono8x8PatternFill\n"); + + pI830->BR[16] = pattx; + pI830->BR[17] = patty; + pI830->BR[18] = bg; + pI830->BR[19] = fg; + + pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); /* In bytes */ + pI830->BR[13] |= i810PatternRop[rop] << 16; + if (bg == -1) + pI830->BR[13] |= (1 << 28); + + switch (pScrn->bitsPerPixel) { + case 8: + break; + case 16: + pI830->BR[13] |= (1 << 24); + break; + case 32: + pI830->BR[13] |= ((1 << 25) | (1 << 24)); + break; + } + +} + +static void +I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, + int x, int y, int w, int h) +{ + I830Ptr pI830 = I830PTR(pScrn); + int x1, x2, y1, y2; + + x1 = x; + x2 = x + w; + y1 = y; + y2 = y + h; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentMono8x8PatternFillRect\n"); + + { + BEGIN_LP_RING(10); + + if (pScrn->bitsPerPixel == 32) { + OUT_RING(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA | + XY_MONO_PAT_BLT_WRITE_RGB | + ((patty << 8) & XY_MONO_PAT_VERT_SEED) | + ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); + } else { + OUT_RING(XY_MONO_PAT_BLT_CMD | + ((patty << 8) & XY_MONO_PAT_VERT_SEED) | + ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); + } + OUT_RING(pI830->BR[13]); + OUT_RING((y1 << 16) | x1); + OUT_RING((y2 << 16) | x2); + OUT_RING(pI830->bufferOffset); + OUT_RING(pI830->BR[18]); /* bg */ + OUT_RING(pI830->BR[19]); /* fg */ + OUT_RING(pI830->BR[16]); /* pattern data */ + OUT_RING(pI830->BR[17]); + OUT_RING(0); + ADVANCE_LP_RING(); + } +} + +static void +I830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + XAAInfoRecPtr infoPtr = pI830->AccelInfoRec; + + if (pI830->nextColorExpandBuf == pI830->NumScanlineColorExpandBuffers) + I830Sync(pScrn); + + infoPtr->ScanlineColorExpandBuffers[0] = + pI830->ScanlineColorExpandBuffers[pI830->nextColorExpandBuf]; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("using color expand buffer %d\n", pI830->nextColorExpandBuf); + + pI830->nextColorExpandBuf++; +} + +static void +I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", + fg, bg, rop, planemask); + + /* Fill out register values */ + pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); + pI830->BR[13] |= i810Rop[rop] << 16; + if (bg == -1) + pI830->BR[13] |= (1 << 29); + + switch (pScrn->bitsPerPixel) { + case 8: + break; + case 16: + pI830->BR[13] |= (1 << 24); + break; + case 32: + pI830->BR[13] |= ((1 << 25) | (1 << 24)); + break; + } + + pI830->BR[18] = bg; + pI830->BR[19] = fg; + + I830GetNextScanlineColorExpandBuffer(pScrn); +} + +static void +I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, int skipleft) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill " + "%d,%d %dx%x %d\n", x, y, w, h, skipleft); + + /* Fill out register values */ + pI830->BR[9] = (pI830->bufferOffset + + (y * pScrn->displayWidth + x) * pI830->cpp); + pI830->BR[11] = ((1 << 16) | w); +} + +static void +I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + I830Ptr pI830 = I830PTR(pScrn); + + pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI830->FbBase); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n", + bufno, pI830->BR[12]); + + { + BEGIN_LP_RING(8); + + if (pScrn->bitsPerPixel == 32) { + OUT_RING(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA | + XY_MONO_SRC_BLT_WRITE_RGB); + } else { + OUT_RING(XY_MONO_SRC_BLT_CMD); + } + OUT_RING(pI830->BR[13]); + OUT_RING(0); /* x1 = 0, y1 = 0 */ + OUT_RING(pI830->BR[11]); /* x2 = w, y2 = 1 */ + OUT_RING(pI830->BR[9]); /* dst addr */ + OUT_RING(pI830->BR[12]); /* src addr */ + OUT_RING(pI830->BR[18]); /* bg */ + OUT_RING(pI830->BR[19]); /* fg */ + + ADVANCE_LP_RING(); + } + + /* Advance to next scanline. + */ + pI830->BR[9] += pScrn->displayWidth * pI830->cpp; + I830GetNextScanlineColorExpandBuffer(pScrn); +} + +#if DO_SCANLINE_IMAGE_WRITE +static void +I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, + unsigned int planemask, int trans_color, + int bpp, int depth) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SetupForScanlineImageWrite %x %x\n", rop, planemask); + + /* Fill out register values */ + pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); + pI830->BR[13] |= i810Rop[rop] << 16; + + switch (pScrn->bitsPerPixel) { + case 8: + break; + case 16: + pI830->BR[13] |= (1 << 24); + break; + case 32: + pI830->BR[13] |= ((1 << 25) | (1 << 24)); + break; + } + + I830GetNextScanlineColorExpandBuffer(pScrn); +} + +static void +I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h, int skipleft) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentScanlineImageWriteRect " + "%d,%d %dx%x %d\n", x, y, w, h, skipleft); + + /* Fill out register values */ + pI830->BR[9] = (pI830->bufferOffset + + (y * pScrn->displayWidth + x) * pI830->cpp); + pI830->BR[11] = ((1 << 16) | w); +} + +static void +I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) +{ + I830Ptr pI830 = I830PTR(pScrn); + + pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI830->FbBase); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n", + bufno, pI830->BR[12]); + + { + BEGIN_LP_RING(8); + + if (pScrn->bitsPerPixel == 32) { + OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + } else { + OUT_RING(XY_SRC_COPY_BLT_CMD); + } + OUT_RING(pI830->BR[13]); + OUT_RING(0); /* x1 = 0, y1 = 0 */ + OUT_RING(pI830->BR[11]); /* x2 = w, y2 = 1 */ + OUT_RING(pI830->BR[9]); /* dst addr */ + OUT_RING(0); /* source origin (0,0) */ + OUT_RING(pI830->BR[11] & 0xffff); /* source pitch */ + OUT_RING(pI830->BR[12]); /* src addr */ + + ADVANCE_LP_RING(); + } + + /* Advance to next scanline. + */ + pI830->BR[9] += pScrn->displayWidth * pI830->cpp; + I830GetNextScanlineColorExpandBuffer(pScrn); +} + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h:1.2 --- /dev/null Thu Feb 27 12:30:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h Mon Dec 9 20:27:05 2002 @@ -0,0 +1,288 @@ +/************************************************************************** + +Copyright 2001 VA Linux Systems Inc., Fremont, California. +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.2 2002/12/10 01:27:05 dawes Exp $ */ + +/* Author: Jeff Hartmann <jhartmann@valinux.com> + + Converted to common header format: + Jens Owen <jens@tungstengraphics.com> + */ + +#ifndef _I830_COMMON_H_ +#define _I830_COMMON_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _I830_DEFINES_ +#define _I830_DEFINES_ + +#define I830_DMA_BUF_ORDER 12 +#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) +#define I830_DMA_BUF_NR 256 +#define I830_NR_SAREA_CLIPRECTS 8 + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define I830_NR_TEX_REGIONS 64 +#define I830_LOG_MIN_TEX_REGION_SIZE 16 + +/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ +#if !defined(I830_ENABLE_4_TEXTURES) +#define I830_TEXTURE_COUNT 2 +#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ +#else /* defined(I830_ENABLE_4_TEXTURES) */ +#define I830_TEXTURE_COUNT 4 +#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ +#endif /* I830_ENABLE_4_TEXTURES */ + +#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ + +#define I830_UPLOAD_CTX 0x1 +#define I830_UPLOAD_BUFFERS 0x2 +#define I830_UPLOAD_CLIPRECTS 0x4 +#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ +#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ +#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ +#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ +#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ +#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ +#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ +#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ +#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) +#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) +#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 +#define I830_UPLOAD_TEX0 0x10000 +#define I830_UPLOAD_TEX1 0x20000 +#define I830_UPLOAD_TEX2 0x40000 +#define I830_UPLOAD_TEX3 0x80000 +#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) +#define I830_UPLOAD_TEX_MASK 0xf0000 +#define I830_UPLOAD_TEXBLEND0 0x100000 +#define I830_UPLOAD_TEXBLEND1 0x200000 +#define I830_UPLOAD_TEXBLEND2 0x400000 +#define I830_UPLOAD_TEXBLEND3 0x800000 +#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) +#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 +#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) +#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 +#define I830_UPLOAD_STIPPLE 0x8000000 + +/* Indices into buf.Setup where various bits of state are mirrored per + * context and per buffer. These can be fired at the card as a unit, + * or in a piecewise fashion as required. + */ + +/* Destbuffer state + * - backbuffer linear offset and pitch -- invarient in the current dri + * - zbuffer linear offset and pitch -- also invarient + * - drawing origin in back and depth buffers. + * + * Keep the depth/back buffer state here to acommodate private buffers + * in the future. + */ + +#define I830_DESTREG_CBUFADDR 0 +/* Invarient */ +#define I830_DESTREG_DBUFADDR 1 +#define I830_DESTREG_DV0 2 +#define I830_DESTREG_DV1 3 +#define I830_DESTREG_SENABLE 4 +#define I830_DESTREG_SR0 5 +#define I830_DESTREG_SR1 6 +#define I830_DESTREG_SR2 7 +#define I830_DESTREG_DR0 8 +#define I830_DESTREG_DR1 9 +#define I830_DESTREG_DR2 10 +#define I830_DESTREG_DR3 11 +#define I830_DESTREG_DR4 12 +#define I830_DEST_SETUP_SIZE 13 + +/* Context state + */ +#define I830_CTXREG_STATE1 0 +#define I830_CTXREG_STATE2 1 +#define I830_CTXREG_STATE3 2 +#define I830_CTXREG_STATE4 3 +#define I830_CTXREG_STATE5 4 +#define I830_CTXREG_IALPHAB 5 +#define I830_CTXREG_STENCILTST 6 +#define I830_CTXREG_ENABLES_1 7 +#define I830_CTXREG_ENABLES_2 8 +#define I830_CTXREG_AA 9 +#define I830_CTXREG_FOGCOLOR 10 +#define I830_CTXREG_BLENDCOLR0 11 +#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ +#define I830_CTXREG_VF 13 +#define I830_CTXREG_VF2 14 +#define I830_CTXREG_MCSB0 15 +#define I830_CTXREG_MCSB1 16 +#define I830_CTX_SETUP_SIZE 17 + +/* 1.3: Stipple state + */ +#define I830_STPREG_ST0 0 +#define I830_STPREG_ST1 1 +#define I830_STP_SETUP_SIZE 2 + +/* Texture state (per tex unit) + */ +#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ +#define I830_TEXREG_MI1 1 +#define I830_TEXREG_MI2 2 +#define I830_TEXREG_MI3 3 +#define I830_TEXREG_MI4 4 +#define I830_TEXREG_MI5 5 +#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ +#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ +#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ +#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ +#define I830_TEX_SETUP_SIZE 10 + +/* New version. Kernel auto-detects. + */ +#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */ +#define I830_TEXREG_TM0S0 1 +#define I830_TEXREG_TM0S1 2 +#define I830_TEXREG_TM0S2 3 +#define I830_TEXREG_TM0S3 4 +#define I830_TEXREG_TM0S4 5 +#define I830_TEXREG_NOP0 6 /* noop */ +#define I830_TEXREG_NOP1 7 /* noop */ +#define I830_TEXREG_NOP2 8 /* noop */ +#define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */ +#define __I830_TEX_SETUP_SIZE 10 + + +#define I830_FRONT 0x1 +#define I830_BACK 0x2 +#define I830_DEPTH 0x4 + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_I830_INIT 0x00 +#define DRM_I830_VERTEX 0x01 +#define DRM_I830_CLEAR 0x02 +#define DRM_I830_FLUSH 0x03 +#define DRM_I830_GETAGE 0x04 +#define DRM_I830_GETBUF 0x05 +#define DRM_I830_SWAP 0x06 +#define DRM_I830_COPY 0x07 +#define DRM_I830_DOCOPY 0x08 +#define DRM_I830_FLIP 0x09 +#define DRM_I830_IRQ_EMIT 0x0a +#define DRM_I830_IRQ_WAIT 0x0b +#define DRM_I830_GETPARAM 0x0c +#define DRM_I830_SETPARAM 0x0d + +#endif /* _I830_DEFINES_ */ + +typedef struct { + enum { + I830_INIT_DMA = 0x01, + I830_CLEANUP_DMA = 0x02 + } func; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_priv_offset; + unsigned int ring_start; + unsigned int ring_end; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int back_pitch; + unsigned int depth_pitch; + unsigned int cpp; +} drmI830Init; + +typedef struct { + int clear_color; + int clear_depth; + int flags; + unsigned int clear_colormask; + unsigned int clear_depthmask; +} drmI830Clear; + +/* These may be placeholders if we have more cliprects than + * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to + * false, indicating that the buffer will be dispatched again with a + * new set of cliprects. + */ +typedef struct { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + int discard; /* client is finished with the buffer? */ +} drmI830Vertex; + +typedef struct { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + void *address; /* Address to copy from */ +} drmI830Copy; + +typedef struct { + void *virtual; + int request_idx; + int request_size; + int granted; +} drmI830DMA; + +typedef struct drm_i830_irq_emit { + int *irq_seq; +} drmI830IrqEmit; + +typedef struct drm_i830_irq_wait { + int irq_seq; +} drmI830IrqWait; + +typedef struct drm_i830_getparam { + int param; + int *value; +} drmI830GetParam; + +#define I830_PARAM_IRQ_ACTIVE 1 + + +typedef struct drm_i830_setparam { + int param; + int value; +} drmI830SetParam; + +#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 + + + +#endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_cursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_cursor.c:1.6 --- /dev/null Thu Feb 27 12:30:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_cursor.c Wed Dec 18 10:49:01 2002 @@ -0,0 +1,281 @@ + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 David Dawes +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_cursor.c,v 1.6 2002/12/18 15:49:01 dawes Exp $ */ + +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * David Dawes <dawes@tungstengraphics.com> + * + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "compiler.h" + +#include "xf86fbman.h" + +#include "i830.h" + +static void I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); +static void I830ShowCursor(ScrnInfoPtr pScrn); +static void I830HideCursor(ScrnInfoPtr pScrn); +static void I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fb); +static void I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y); +static Bool I830UseHWCursor(ScreenPtr pScrn, CursorPtr pCurs); + +void +I830InitHWCursor(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 temp; + + DPRINTF(PFX, "I830InitHWCursor\n"); + + /* Initialise the HW cursor registers, leaving the cursor hidden. */ + if (IS_MOBILE(pI830)) { + temp = INREG(CURSOR_A_CONTROL); + temp &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE | MCURSOR_MEM_TYPE_LOCAL | + MCURSOR_PIPE_SELECT); + temp |= CURSOR_MODE_DISABLE; + /* + * XXX Should enable cursor B when both pipes are enabled. + * For now, give pipe A preference. + */ + if (pI830->pipeEnabled[0]) + temp |= MCURSOR_PIPE_A; + else if (pI830->pipeEnabled[1]) + temp |= MCURSOR_PIPE_B; + /* Need to set control, then address. */ + OUTREG(CURSOR_A_CONTROL, temp); + OUTREG(CURSOR_A_BASE, pI830->CursorMem.Physical); + } else { + temp = INREG(CURSOR_CONTROL); + temp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE | + CURSOR_ENABLE | CURSOR_STRIDE_MASK); + temp |= (CURSOR_FORMAT_3C); + /* This initialises the format and leave the cursor disabled. */ + OUTREG(CURSOR_CONTROL, temp); + /* Need to set address and size after disabling. */ + OUTREG(CURSOR_BASEADDR, pI830->CursorMem.Start); + temp = ((I810_CURSOR_X & CURSOR_SIZE_MASK) << CURSOR_SIZE_HSHIFT) | + ((I810_CURSOR_Y & CURSOR_SIZE_MASK) << CURSOR_SIZE_VSHIFT); + OUTREG(CURSOR_SIZE, temp); + } +} + +Bool +I830CursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn; + I830Ptr pI830; + xf86CursorInfoPtr infoPtr; + + DPRINTF(PFX, "I830CursorInit\n"); + pScrn = xf86Screens[pScreen->myNum]; + pI830 = I830PTR(pScrn); + pI830->CursorInfoRec = infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + + infoPtr->MaxWidth = 64; + infoPtr->MaxHeight = 64; + infoPtr->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_INVERT_MASK | + HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | 0); + + infoPtr->SetCursorColors = I830SetCursorColors; + infoPtr->SetCursorPosition = I830SetCursorPosition; + infoPtr->LoadCursorImage = I830LoadCursorImage; + infoPtr->HideCursor = I830HideCursor; + infoPtr->ShowCursor = I830ShowCursor; + infoPtr->UseHWCursor = I830UseHWCursor; + + if (pI830->CursorNeedsPhysical && !pI830->CursorMem.Physical) + return FALSE; + + I830HideCursor(pScrn); + + return xf86InitCursor(pScreen, infoPtr); +} + +static Bool +I830UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830UseHWCursor\n"); + if (pI830->CursorNeedsPhysical && !pI830->CursorMem.Physical) + return FALSE; + + return TRUE; +} + +static void +I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD8 *pcurs = (CARD8 *) (pI830->FbBase + pI830->CursorMem.Start); + int x, y; + + DPRINTF(PFX, "I830LoadCursorImage\n"); + for (y = 0; y < 64; y++) { + for (x = 0; x < 64 / 4; x++) { + *pcurs++ = *src++; + } + } +} + + +static void +I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 temp = 0; + static Bool outsideViewport = FALSE; + Bool hide = FALSE, show = FALSE; + + /* + * There is a screen display problem when the cursor position is set + * wholely outside of the viewport. We trap that here, turning the + * cursor off when that happens, and back on when it comes back into + * the viewport. + */ + if (x >= pScrn->currentMode->HDisplay || + y >= pScrn->currentMode->VDisplay || + x <= -I810_CURSOR_X || y <= -I810_CURSOR_Y) { + hide = TRUE; + outsideViewport = TRUE; + } else if (outsideViewport) { + show = TRUE; + outsideViewport = FALSE; + } + + if (x < 0) { + temp |= (CURSOR_POS_SIGN << CURSOR_X_SHIFT); + x = -x; + } + if (y < 0) { + temp |= (CURSOR_POS_SIGN << CURSOR_Y_SHIFT); + y = -y; + } + temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT); + temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT); + + OUTREG(CURSOR_A_POSITION, temp); + + if (pI830->cursorOn) { + if (hide) + pI830->CursorInfoRec->HideCursor(pScrn); + else if (show) + pI830->CursorInfoRec->ShowCursor(pScrn); + pI830->cursorOn = TRUE; + } +} + +static void +I830ShowCursor(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 temp; + + DPRINTF(PFX, "I830ShowCursor\n"); + DPRINTF(PFX, + "Value of CursorMem.Physical is %x, " + " Value of CursorMem.Start is %x ", + pI830->CursorMem.Physical, pI830->CursorMem.Start); + + pI830->cursorOn = TRUE; + if (IS_MOBILE(pI830)) { + temp = INREG(CURSOR_A_CONTROL); + temp &= ~CURSOR_MODE; + temp |= CURSOR_MODE_64_4C_AX; + /* Need to set mode, then address. */ + OUTREG(CURSOR_A_CONTROL, temp); + OUTREG(CURSOR_A_BASE, pI830->CursorMem.Physical); + } else { + temp = INREG(CURSOR_CONTROL); + temp |= CURSOR_ENABLE; + OUTREG(CURSOR_CONTROL, temp); + } +} + +static void +I830HideCursor(ScrnInfoPtr pScrn) +{ + CARD32 temp; + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830HideCursor\n"); + + pI830->cursorOn = FALSE; + if (IS_MOBILE(pI830)) { + temp = INREG(CURSOR_A_CONTROL); + temp &= ~CURSOR_MODE; + temp |= CURSOR_MODE_DISABLE; + OUTREG(CURSOR_A_CONTROL, temp); + /* This is needed to flush the above change. */ + OUTREG(CURSOR_A_BASE, pI830->CursorMem.Physical); + } else { + temp = INREG(CURSOR_CONTROL); + temp &= ~CURSOR_ENABLE; + OUTREG(CURSOR_CONTROL, temp); + } +} + +static void +I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830SetCursorColors\n"); + + OUTREG(CURSOR_A_PALETTE0, bg & 0x00ffffff); + OUTREG(CURSOR_A_PALETTE1, fg & 0x00ffffff); + OUTREG(CURSOR_A_PALETTE2, fg & 0x00ffffff); + OUTREG(CURSOR_A_PALETTE3, bg & 0x00ffffff); +} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dga.c:1.3 --- /dev/null Thu Feb 27 12:30:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dga.c Tue Feb 25 23:11:23 2003 @@ -0,0 +1,293 @@ +/* + * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> + */ +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dga.c,v 1.3 2003/02/26 04:11:23 dawes Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xaa.h" +#include "xaalocal.h" +#include "i830.h" +#include "i810_reg.h" +#include "dgaproc.h" +#include "vgaHW.h" + +static Bool I830_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static Bool I830_SetMode(ScrnInfoPtr, DGAModePtr); +static void I830_Sync(ScrnInfoPtr); +static int I830_GetViewport(ScrnInfoPtr); +static void I830_SetViewport(ScrnInfoPtr, int, int, int); +static void I830_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); +static void I830_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); + +#if 0 +static void I830_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, + unsigned long); +#endif + +static +DGAFunctionRec I830DGAFuncs = { + I830_OpenFramebuffer, + NULL, + I830_SetMode, + I830_SetViewport, + I830_GetViewport, + I830_Sync, + I830_FillRect, + I830_BlitRect, +#if 0 + I830_BlitTransRect +#else + NULL +#endif +}; + +Bool +I830DGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0; + + MARKER(); + + pMode = firstMode = pScrn->modes; + + while (pMode) { + + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + + if (!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + + currentMode = modes + num; + num++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + if (!pI830->noAccel) + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = (Bpp == 3) ? 2 : 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pI830->FbBase + pScrn->fbOffset; + + currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pI830->FbMemBox.x2; + currentMode->imageHeight = pI830->FbMemBox.y2; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + pMode = pMode->next; + if (pMode == firstMode) + break; + } + + pI830->numDGAModes = num; + pI830->DGAModes = modes; + + return DGAInit(pScreen, &I830DGAFuncs, modes, num); +} + +static DisplayModePtr I830SavedDGAModes[MAXSCREENS]; + +static Bool +I830_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) +{ + int index = pScrn->pScreen->myNum; + I830Ptr pI830 = I830PTR(pScrn); + + MARKER(); + + if (!pMode) { /* restore the original mode */ + DPRINTF(PFX, "Restoring original mode (from DGA mode)\n"); + if (pI830->DGAactive) { + pScrn->currentMode = I830SavedDGAModes[index]; + pScrn->SwitchMode(index, pScrn->currentMode, 0); + pScrn->AdjustFrame(index, 0, 0, 0); + pI830->DGAactive = FALSE; + } + } else { + if (!pI830->DGAactive) { + DPRINTF(PFX, "Setting DGA mode\n"); + I830SavedDGAModes[index] = pScrn->currentMode; + pI830->DGAactive = TRUE; + } + + pScrn->SwitchMode(index, pMode->mode, 0); + } + + return TRUE; +} + +static int +I830_GetViewport(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + MARKER(); + + return pI830->DGAViewportStatus; +} + +static void +I830_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + + MARKER(); + + pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + + /* wait for retrace */ + while ((hwp->readST01(hwp) & 0x08)) ; + while (!(hwp->readST01(hwp) & 0x08)) ; + + pI830->DGAViewportStatus = 0; +} + +static void +I830_FillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h, unsigned long color) +{ + I830Ptr pI830 = I830PTR(pScrn); + + MARKER(); + + if (pI830->AccelInfoRec) { + (*pI830->AccelInfoRec->SetupForSolidFill) (pScrn, color, GXcopy, ~0); + (*pI830->AccelInfoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); + SET_SYNC_FLAG(pI830->AccelInfoRec); + } +} + +static void +I830_Sync(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + MARKER(); + + if (pI830->AccelInfoRec) { + (*pI830->AccelInfoRec->Sync) (pScrn); + } +} + +static void +I830_BlitRect(ScrnInfoPtr pScrn, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + I830Ptr pI830 = I830PTR(pScrn); + + MARKER(); + + if (pI830->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pI830->AccelInfoRec->SetupForScreenToScreenCopy) (pScrn, xdir, ydir, + GXcopy, ~0, -1); + (*pI830->AccelInfoRec->SubsequentScreenToScreenCopy) (pScrn, srcx, srcy, + dstx, dsty, w, h); + SET_SYNC_FLAG(pI830->AccelInfoRec); + } +} + +#if 0 +static void +I830_BlitTransRect(ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, int dstx, int dsty, unsigned long color) +{ + + MARKER(); + + /* this one should be separate since the XAA function would + * prohibit usage of ~0 as the key */ +} +#endif + +static Bool +I830_OpenFramebuffer(ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, int *size, int *offset, int *flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + + MARKER(); + + *name = NULL; /* no special device */ + *mem = (unsigned char *)(pI830->LinearAddr + pScrn->fbOffset); + *size = pI830->FrontBuffer.Size; + *offset = 0; + *flags = DGA_NEED_ROOT; + + DPRINTF(PFX, + " mem == 0x%.8x (pI830->LinearAddr)\n" + "size == %lu (pI830->FbMapSize)\n", *mem, *size); + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c:1.3 Tue Jan 8 19:37:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c Sat Feb 8 16:26:57 2003 @@ -1,7 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.3 2002/01/09 00:37:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.12 2003/02/08 21:26:57 dawes Exp $ */ /************************************************************************** Copyright 2001 VA Linux Systems Inc., Fremont, California. +Copyright © 2002 by David Dawes All Rights Reserved. @@ -24,10 +25,37 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - **************************************************************************/ + +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* + * Authors: Jeff Hartmann <jhartmann@valinux.com> + * David Dawes <dawes@tungstengraphics.com> + * Keith Whitwell <keith@tungstengraphics.com> + */ -/* Author: Jeff Hartmann <jhartmann@valinux.com> +/* + * This driver does AGP memory allocation a little differently from most + * others. The 2D and 3D allocations have been unified (see i830_memory.c). + * The driver does the AGP allocations and binding directly, then passes + * on the mappings to the DRM module. The DRM's AGP interfaces are not used. + * The main difference with this is that the offsets need to include + * the AGP aperture base address because that won't be known or added on + * by the DRM module. + * + * DHD 07/2002 */ #include "xf86.h" @@ -39,10 +67,11 @@ #include "xf86Pci.h" #include "windowstr.h" +#include "shadow.h" #include "GL/glxtokens.h" -#include "i810.h" +#include "i830.h" #include "i830_dri.h" #include "i830_3d_reg.h" @@ -50,84 +79,120 @@ static char I830ClientDriverName[] = "i830"; static Bool I830InitVisualConfigs(ScreenPtr pScreen); -static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual, +static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore); static void I830DestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore); -static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, +static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType readContextType, void *readContextStore, - DRIContextType writeContextType, + DRIContextType writeContextType, void *writeContextStore); static void I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); +static Bool I830DRICloseFullScreen(ScreenPtr pScreen); +static Bool I830DRIOpenFullScreen(ScreenPtr pScreen); +static void I830DRITransitionTo2d(ScreenPtr pScreen); +static void I830DRITransitionTo3d(ScreenPtr pScreen); +static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen); +static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen); + +static void I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf); + extern void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, + __GLXvisualConfig * configs, void **configprivs); + +static Bool +I830CleanupDma(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + drmI830Init info; + + memset(&info, 0, sizeof(drmI830Init)); + info.func = I830_CLEANUP_DMA; -static int i830_pitches[] = { - 512, - 1024, - 2048, - 4096, - 8192, - 0 -}; - -Bool I830CleanupDma(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - Bool ret_val; - - ret_val = drmI830CleanupDma(pI810->drmSubFD); - if (ret_val == FALSE) + if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT, + &info, sizeof(drmI830Init))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Cleanup Failed\n"); - return ret_val; + return FALSE; + } + + return TRUE; } -Bool I830InitDma(ScrnInfoPtr pScrn) +static Bool +I830InitDma(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR(pScrn); - I810RingBuffer *ring = &(pI810->LpRing); - I830DRIPtr pI830DRI=(I830DRIPtr)pI810->pDRIInfo->devPrivate; + I830Ptr pI830 = I830PTR(pScrn); + I830RingBuffer *ring = &(pI830->LpRing); + I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; drmI830Init info; - Bool ret_val; + + memset(&info, 0, sizeof(drmI830Init)); + info.func = I830_INIT_DMA; - info.start = ring->mem.Start; - info.end = ring->mem.End; - info.size = ring->mem.Size; + info.ring_start = ring->mem.Start + pI830->LinearAddr; + info.ring_end = ring->mem.End + pI830->LinearAddr; + info.ring_size = ring->mem.Size; info.mmio_offset = (unsigned int)pI830DRI->regs; - info.buffers_offset = (unsigned int)pI810->buffer_map; + info.buffers_offset = (unsigned int)pI830->buffer_map; - info.sarea_off = sizeof(XF86DRISAREARec); + info.sarea_priv_offset = sizeof(XF86DRISAREARec); - info.front_offset = 0; - info.back_offset = pI810->BackBuffer.Start; - info.depth_offset = pI810->DepthBuffer.Start; + info.front_offset = pI830->FrontBuffer.Start; + info.back_offset = pI830->BackBuffer.Start; + info.depth_offset = pI830->DepthBuffer.Start; info.w = pScrn->virtualX; info.h = pScrn->virtualY; - info.pitch = pI810->auxPitch; - info.pitch_bits = pI810->auxPitchBits; - info.cpp = pI810->cpp; - - ret_val = drmI830InitDma(pI810->drmSubFD, &info); - if(ret_val == FALSE) ErrorF("i830 Dma Initialization Failed\n"); - return ret_val; + info.pitch = pI830->auxPitch; + info.pitch_bits = pI830->auxPitchBits; + info.back_pitch = pI830->auxPitch; + info.depth_pitch = pI830->auxPitch; + info.cpp = pI830->cpp; + + if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT, + &info, sizeof(drmI830Init))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "I830 Dma Initialization Failed\n"); + return FALSE; + } + + return TRUE; +} + +static Bool +I830SetParam(ScrnInfoPtr pScrn, int param, int value) +{ + I830Ptr pI830 = I830PTR(pScrn); + drmI830SetParam sp; + + memset(&sp, 0, sizeof(sp)); + sp.param = param; + sp.value = value; + + if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 SetParam Failed\n"); + return FALSE; + } + + return TRUE; } + static Bool I830InitVisualConfigs(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); int numConfigs = 0; __GLXvisualConfig *pConfigs = 0; - I810ConfigPrivPtr pI810Configs = 0; - I810ConfigPrivPtr *pI810ConfigPtrs = 0; + I830ConfigPrivPtr pI830Configs = 0; + I830ConfigPrivPtr *pI830ConfigPtrs = 0; int accum, stencil, db, depth; int i; @@ -139,79 +204,84 @@ case 16: numConfigs = 8; - pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), numConfigs); + pConfigs = + (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), + numConfigs); if (!pConfigs) return FALSE; - pI810Configs = (I810ConfigPrivPtr) xcalloc(sizeof(I810ConfigPrivRec), numConfigs); - if (!pI810Configs) { + pI830Configs = + (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec), + numConfigs); + if (!pI830Configs) { xfree(pConfigs); return FALSE; } - pI810ConfigPtrs = (I810ConfigPrivPtr *) xcalloc(sizeof(I810ConfigPrivPtr), numConfigs); - if (!pI810ConfigPtrs) { + pI830ConfigPtrs = + (I830ConfigPrivPtr *) xcalloc(sizeof(I830ConfigPrivPtr), + numConfigs); + if (!pI830ConfigPtrs) { xfree(pConfigs); - xfree(pI810Configs); + xfree(pI830Configs); return FALSE; } - for (i=0; i<numConfigs; i++) - pI810ConfigPtrs[i] = &pI810Configs[i]; + for (i = 0; i < numConfigs; i++) + pI830ConfigPtrs[i] = &pI830Configs[i]; i = 0; depth = 1; for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= 1; stencil++) { - for (db = 1; db >= 0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 16; - } - else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - pConfigs[i].doubleBuffer = db ? TRUE : FALSE; - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; - if (depth) - pConfigs[i].depthSize = 16; - else - pConfigs[i].depthSize = 0; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (stencil || accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - pConfigs[i].visualRating = GLX_NONE_EXT; - pConfigs[i].transparentPixel = 0; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } + for (stencil = 0; stencil <= 1; stencil++) { + for (db = 1; db >= 0; db--) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 16; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + pConfigs[i].doubleBuffer = db ? TRUE : FALSE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if (depth) + pConfigs[i].depthSize = 16; + else + pConfigs[i].depthSize = 0; + if (stencil) + pConfigs[i].stencilSize = 8; + else + pConfigs[i].stencilSize = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (stencil || accum) + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + else + pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } } assert(i == numConfigs); break; @@ -219,186 +289,175 @@ case 32: numConfigs = 8; - pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), - numConfigs ); - if ( !pConfigs ) { + pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), + numConfigs); + if (!pConfigs) { return FALSE; } - pI810Configs = (I810ConfigPrivPtr)xcalloc( sizeof(I810ConfigPrivRec), - numConfigs ); - if ( !pI810Configs ) { - xfree( pConfigs ); + pI830Configs = (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec), + numConfigs); + if (!pI830Configs) { + xfree(pConfigs); return FALSE; } - pI810ConfigPtrs = (I810ConfigPrivPtr*) - xcalloc(sizeof(I810ConfigPrivPtr), - numConfigs); - if ( !pI810ConfigPtrs ) { - xfree( pConfigs ); - xfree( pI810Configs ); + pI830ConfigPtrs = (I830ConfigPrivPtr *) + xcalloc(sizeof(I830ConfigPrivPtr), numConfigs); + if (!pI830ConfigPtrs) { + xfree(pConfigs); + xfree(pI830Configs); return FALSE; } - for ( i = 0 ; i < numConfigs ; i++ ) { - pI810ConfigPtrs[i] = &pI810Configs[i]; + for (i = 0; i < numConfigs; i++) { + pI830ConfigPtrs[i] = &pI830Configs[i]; } i = 0; - for ( accum = 0 ; accum <= 1 ; accum++ ) { - for ( depth = 0 ; depth <= 1 ; depth++ ) { /* and stencil */ - for ( db = 1 ; db >= 0 ; db-- ) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 8; - pConfigs[i].greenSize = 8; - pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x00FF0000; - pConfigs[i].greenMask = 0x0000FF00; - pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0xff000000;; - if ( accum ) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; - } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - if ( db ) { - pConfigs[i].doubleBuffer = TRUE; - } else { - pConfigs[i].doubleBuffer = FALSE; + for (accum = 0; accum <= 1; accum++) { + for (depth = 0; depth <= 1; depth++) { /* and stencil */ + for (db = 1; db >= 0; db--) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 8; + pConfigs[i].greenSize = 8; + pConfigs[i].blueSize = 8; + pConfigs[i].alphaSize = 0; + pConfigs[i].redMask = 0x00FF0000; + pConfigs[i].greenMask = 0x0000FF00; + pConfigs[i].blueMask = 0x000000FF; + pConfigs[i].alphaMask = 0x00000000;; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if (db) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; } - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 32; - if ( depth ) { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 8; - } - else { - pConfigs[i].depthSize = 0; - pConfigs[i].stencilSize = 0; - } - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if ( accum ) { - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - } else { - pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 24; + if (depth) { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].depthSize = 0; + pConfigs[i].stencilSize = 0; } - pConfigs[i].transparentPixel = 0; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (accum) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } } - if ( i != numConfigs ) { - xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "[drm] Incorrect initialization of visuals\n" ); - return FALSE; + if (i != numConfigs) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n"); + return FALSE; } break; } - pI810->numVisualConfigs = numConfigs; - pI810->pVisualConfigs = pConfigs; - pI810->pVisualConfigsPriv = pI810Configs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pI810ConfigPtrs); + pI830->numVisualConfigs = numConfigs; + pI830->pVisualConfigs = pConfigs; + pI830->pVisualConfigsPriv = pI830Configs; + GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pI830ConfigPtrs); return TRUE; } - - -static unsigned int mylog2(unsigned int n) -{ - unsigned int log2 = 1; - while (n>1) n >>= 1, log2++; - return log2; -} - -Bool I830DRIScreenInit(ScreenPtr pScreen) +Bool +I830DRIScreenInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); DRIInfoPtr pDRIInfo; I830DRIPtr pI830DRI; - unsigned long tom; - unsigned long agpHandle; - int sysmem_size = 0; - int back_size = 0; - int bufs; - int i; + DPRINTF(PFX, "I830DRIScreenInit\n"); /* Hardware 3D rendering only implemented for 16bpp and 32 bpp */ - if (((pScrn->bitsPerPixel / 8) != 2 && pScrn->depth != 16) && + if (((pScrn->bitsPerPixel / 8) != 2 && pScrn->depth != 16) && (pScrn->bitsPerPixel / 8) != 4) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Direct rendering only supported in 16 and 32 bpp modes\n"); + "[drm] Direct rendering only supported in 16 and 32 bpp modes\n"); return FALSE; } /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for known symbols in each module. */ - if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; - if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE; - if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; + if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) + return FALSE; + if (!xf86LoaderCheckSymbol("DRIScreenInit")) + return FALSE; + if (!xf86LoaderCheckSymbol("drmAvailable")) + return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] %s failed (libdri.a too old)\n","I830DRIScreenInit"); + "[dri] %s failed (libdri.a too old)\n", "I830DRIScreenInit"); return FALSE; } - + /* Check the DRI version */ { int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); if (major != 4 || minor < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] %s failed because of a version mismatch.\n" - "[dri] libDRI version is %d.%d.%d bug version 4.0.x is needed.\n" - "[dri] Disabling DRI.\n", - "I830DRIScreenInit", major, minor, patch); - return FALSE; + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] %s failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d bug version 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", + "I830DRIScreenInit", major, minor, patch); + return FALSE; } } pDRIInfo = DRICreateInfoRec(); if (!pDRIInfo) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); return FALSE; } - pI810->pDRIInfo = pDRIInfo; - pI810->LockHeld = 0; + pI830->pDRIInfo = pDRIInfo; + pI830->LockHeld = 0; pDRIInfo->drmDriverName = I830KernelDriverName; pDRIInfo->clientDriverName = I830ClientDriverName; pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pI810->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pI810->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pI810->PciInfo->thisCard)->funcnum); + ((pciConfigPtr) pI830->PciInfo->thisCard)->busnum, + ((pciConfigPtr) pI830->PciInfo->thisCard)->devnum, + ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum); pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION; pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION; pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL; - pDRIInfo->frameBufferPhysicalAddress = pI810->LinearAddr; - pDRIInfo->frameBufferSize = (((pScrn->displayWidth * - pScrn->virtualY * pI810->cpp) + - 4096 - 1) / 4096) * 4096; - - pDRIInfo->frameBufferStride = pScrn->displayWidth*pI810->cpp; + pDRIInfo->frameBufferPhysicalAddress = pI830->LinearAddr + + pI830->FrontBuffer.Start; + pDRIInfo->frameBufferSize = ROUND_TO_PAGE(pScrn->displayWidth * + pScrn->virtualY * pI830->cpp); + pDRIInfo->frameBufferStride = pScrn->displayWidth * pI830->cpp; pDRIInfo->ddxDrawableTableEntry = I830_MAX_DRAWABLES; if (SAREA_MAX_DRAWABLES < I830_MAX_DRAWABLES) @@ -406,8 +465,9 @@ else pDRIInfo->maxDrawableTableEntry = I830_MAX_DRAWABLES; - if (sizeof(XF86DRISAREARec)+sizeof(I830SAREARec)>SAREA_MAX) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] Data does not fit in SAREA\n"); + if (sizeof(XF86DRISAREARec) + sizeof(I830SAREARec) > SAREA_MAX) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] Data does not fit in SAREA\n"); return FALSE; } /* This is a hack for now. We have to have more than a 4k page here @@ -417,453 +477,277 @@ */ pDRIInfo->SAREASize = SAREA_MAX; - if (!(pI830DRI = (I830DRIPtr)xcalloc(sizeof(I830DRIRec),1))) { - DRIDestroyInfoRec(pI810->pDRIInfo); - pI810->pDRIInfo=0; + if (!(pI830DRI = (I830DRIPtr) xcalloc(sizeof(I830DRIRec), 1))) { + DRIDestroyInfoRec(pI830->pDRIInfo); + pI830->pDRIInfo = 0; return FALSE; } pDRIInfo->devPrivate = pI830DRI; pDRIInfo->devPrivateSize = sizeof(I830DRIRec); pDRIInfo->contextSize = sizeof(I830DRIContextRec); - + pDRIInfo->CreateContext = I830CreateContext; pDRIInfo->DestroyContext = I830DestroyContext; pDRIInfo->SwapContext = I830DRISwapContext; pDRIInfo->InitBuffers = I830DRIInitBuffers; pDRIInfo->MoveBuffers = I830DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->OpenFullScreen = I830DRIOpenFullScreen; + pDRIInfo->CloseFullScreen = I830DRICloseFullScreen; + pDRIInfo->TransitionTo2d = I830DRITransitionTo2d; + pDRIInfo->TransitionTo3d = I830DRITransitionTo3d; + pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d; + pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d; - /* This adds the framebuffer as a drm map *before* we have asked agp - * to allocate it. Scary stuff, hold on... - */ - if (!DRIScreenInit(pScreen, pDRIInfo, &pI810->drmSubFD)) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n"); + if (!DRIScreenInit(pScreen, pDRIInfo, &pI830->drmSubFD)) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate=0; - DRIDestroyInfoRec(pI810->pDRIInfo); - pI810->pDRIInfo=0; - return FALSE; - } - - /* Check the i830 DRM version */ - { - drmVersionPtr version = drmGetVersion(pI810->drmSubFD); - if (version) { - if (version->version_major != 1 || - version->version_minor < 2) { - /* incompatible drm version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] %s failed because of a version mismatch.\n" - "[dri] i830.o kernel module version is %d.%d.%d but version 1.2 or greater is needed.\n" - "[dri] Disabling DRI.\n", - "I830DRIScreenInit", - version->version_major, - version->version_minor, - version->version_patchlevel); - I830DRICloseScreen(pScreen); - drmFreeVersion(version); - return FALSE; - } - drmFreeVersion(version); - } - } - - pI830DRI->regsSize=I830_REG_SIZE; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MMIOAddr, - pI830DRI->regsSize, DRM_REGISTERS, 0, &pI830DRI->regs)<0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n"); - DRICloseScreen(pScreen); + pDRIInfo->devPrivate = 0; + DRIDestroyInfoRec(pI830->pDRIInfo); + pI830->pDRIInfo = 0; return FALSE; } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", - pI830DRI->regs); - - pI810->backHandle = 0; - pI810->zHandle = 0; - pI810->cursorHandle = 0; - pI810->sysmemHandle = 0; - pI810->agpAcquired = FALSE; - /* Agp Support - Need this just to get the framebuffer. - */ - if(drmAgpAcquire(pI810->drmSubFD) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAquire failed\n"); - DRICloseScreen(pScreen); - return FALSE; - } - pI810->agpAcquired = TRUE; - - if (drmAgpEnable(pI810->drmSubFD, 0) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpEnable failed\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - memset (&pI810->BackBuffer, 0, sizeof(I810MemRange)); - memset (&pI810->DepthBuffer, 0, sizeof(I810MemRange)); - pI810->CursorPhysical = 0; - - back_size = (((pScrn->displayWidth * - pScrn->virtualY * pI810->cpp) + - 4096 - 1) / 4096) * 4096; - - sysmem_size = pScrn->videoRam * 1024; - - /* The 1 meg here is for texture space and the ring buffer. */ - if(sysmem_size < (3 * back_size + 0x100000)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Not enough memory to contain front, back, and depth buffers.\n"); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] You need at least %dK of VideoRam for this configuration.\n", - (3 * back_size + 0x100000) / 1024); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - sysmem_size = sysmem_size - 2*back_size; - - if(sysmem_size > pI810->FbMapSize) { - sysmem_size = pI810->FbMapSize; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] User requested more memory then fits in the agp aperture\n" - "[dri] Truncating to %d bytes of memory\n", - sysmem_size); - } - - sysmem_size -= 4096; /* remove 4k for the hw cursor */ - - if(sysmem_size < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Not enough memory to contain front, back, and depth buffers.\n" - "[dri] Disabling DRI.\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); - pI810->backHandle = agpHandle; - - if (agpHandle != 0) { - if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->BackOffset) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Bound backbuffer memory\n"); - - pI810->BackBuffer.Start = pI810->BackOffset; - pI810->BackBuffer.Size = back_size; - pI810->BackBuffer.End = (pI810->BackBuffer.Start + - pI810->BackBuffer.Size); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Unable to bind backbuffer\n"); - DRICloseScreen(pScreen); - return FALSE; - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Unable to allocate backbuffer memory\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - drmAgpAlloc(pI810->drmSubFD, back_size, 0, - NULL, &agpHandle); - pI810->zHandle = agpHandle; - - if(agpHandle != 0) { - if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->DepthOffset) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Bound depthbuffer memory\n"); - pI810->DepthBuffer.Start = pI810->DepthOffset; - pI810->DepthBuffer.Size = back_size; - pI810->DepthBuffer.End = (pI810->DepthBuffer.Start + - pI810->DepthBuffer.Size); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Unable to bind depthbuffer\n"); - DRICloseScreen(pScreen); - return FALSE; - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[dri] Unable to allocate depthbuffer memory\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - /* Now allocate and bind the agp space. This memory will include the - * regular framebuffer as well as texture memory. - */ + /* Check the i830 DRM versioning */ { - int offset, alloc_size; - - alloc_size = sysmem_size; + drmVersionPtr version; - if(alloc_size <= pI810->StolenSize) { - /* We are cheating here. We really should not scale the sysmem_size. - * However we always have at least stolen size here. */ - alloc_size = 0; - offset = 0; - sysmem_size = pI810->StolenSize; - } else { - alloc_size -= pI810->StolenSize; /* Stolen size is in bytes */ - offset = pI810->StolenSize; + /* Check the DRM lib version. + * drmGetLibVersion was not supported in version 1.0, so check for + * symbol first to avoid possible crash or hang. + */ + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + version = drmGetLibVersion(pI830->drmSubFD); + } else + { + /* drmlib version 1.0.0 didn't have the drmGetLibVersion + * entry point. Fake it by allocating a version record + * via drmGetVersion and changing it to version 1.0.0 + */ + version = drmGetVersion(pI830->drmSubFD); + version->version_major = 1; + version->version_minor = 0; + version->version_patchlevel = 0; } - if(alloc_size) { - drmAgpAlloc(pI810->drmSubFD, alloc_size, 0, NULL, &agpHandle); - if (agpHandle == 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAlloc failed\n"); - DRICloseScreen(pScreen); - return FALSE; - } - if (drmAgpBind(pI810->drmSubFD, agpHandle, offset) != 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpBind failed\n"); - DRICloseScreen(pScreen); +#define REQ_MAJ 1 +#define REQ_MIN 1 + if (version) { + if (version->version_major != REQ_MAJ || + version->version_minor < REQ_MIN) { + /* incompatible drm library version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] I830DRIScreenInit failed because of a version mismatch.\n" + "[dri] libdrm.a module version is %d.%d.%d but version %d.%d.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, version->version_patchlevel, + REQ_MAJ, REQ_MIN); + drmFreeVersion(version); + I830DRICloseScreen(pScreen); return FALSE; } - - pI810->sysmemHandle = agpHandle; - } else { - pI810->sysmemHandle = 0; - } - - pI810->SysMem.Start = 0; - pI810->SysMem.Size = sysmem_size; - pI810->SysMem.End = sysmem_size; - pI810->SavedSysMem = pI810->SysMem; - - if(sysmem_size <= pI810->StolenSize) { - tom = pI810->StolenSize; - } else { - tom = pI810->SysMem.End; + drmFreeVersion(version); } - - } - drmAgpAlloc(pI810->drmSubFD, 4096, 2, - (unsigned long *)&pI810->CursorPhysical, &agpHandle); - pI810->cursorHandle = agpHandle; - - if (agpHandle != 0) { - if (drmAgpBind(pI810->drmSubFD, agpHandle, tom) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[agp] GART: Allocated 4K for mouse cursor image\n"); - pI810->CursorStart = tom; - tom += 4096; + /* Check the i830 DRM version */ + version = drmGetVersion(pI830->drmSubFD); + if (version) { + if (version->version_major != 1 || version->version_minor < 3) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] %s failed because of a version mismatch.\n" + "[dri] i830.o kernel module version is %d.%d.%d but version 1.3 or greater is needed.\n" + "[dri] Disabling DRI.\n", + "I830DRIScreenInit", + version->version_major, + version->version_minor, version->version_patchlevel); + I830DRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + pI830->drmMinor = version->version_minor; + drmFreeVersion(version); } - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor bind failed\n"); - pI810->CursorPhysical = 0; - } - } - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor alloc failed\n"); - pI810->CursorPhysical = 0; } + return TRUE; +} - /* Steal some of the excess cursor space for the overlay regs, - * then allocate 202*2 pages for the overlay buffers. - */ - pI810->OverlayPhysical = pI810->CursorPhysical + 1024; - pI810->OverlayStart = pI810->CursorStart + 1024; +Bool +I830DRIDoMappings(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + DRIInfoPtr pDRIInfo = pI830->pDRIInfo; + I830DRIPtr pI830DRI = pDRIInfo->devPrivate; + int bufs; - /* drmAddMap happens later to preserve index order */ + DPRINTF(PFX, "I830DRIDoMappings\n"); + pI830DRI->regsSize = I830_REG_SIZE; + if (drmAddMap(pI830->drmSubFD, (drmHandle)pI830->MMIOAddr, + pI830DRI->regsSize, DRM_REGISTERS, 0, &pI830DRI->regs) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", + pI830DRI->regs); - /* The tiled registers always describe 8 meg regions, even if - * the actually memory used is less than 8 meg (which is the normal - * case.) + /* + * The tile setup is now initiated from I830BIOSScreenInit(). */ - - { - int can_tile, i; - -#define Elements(x) sizeof(x)/sizeof(*x) - for(i = 0, can_tile = 0; i < Elements(i830_pitches) ; i++) { - if((pScrn->displayWidth * pI810->cpp) == i830_pitches[i]) - can_tile = 1; - } - - if(can_tile) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Activating Tiled Memory\n"); - I810SetTiledMemory(pScrn, 1, - pI810->DepthBuffer.Start, - pScrn->displayWidth * pI810->cpp, - 8*1024*1024); - - I810SetTiledMemory(pScrn, 2, - pI810->BackBuffer.Start, - pScrn->displayWidth * pI810->cpp, - 8*1024*1024); - } - } - - pI810->auxPitch = pScrn->displayWidth; - pI810->auxPitchBits = 0; + pI830->auxPitch = pScrn->displayWidth; + pI830->auxPitchBits = 0; - pI830DRI->backbufferSize = pI810->BackBuffer.Size; + pI830DRI->backbufferSize = pI830->BackBuffer.Size; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BackBuffer.Start, - pI810->BackBuffer.Size, DRM_AGP, 0, + if (drmAddMap(pI830->drmSubFD, + (drmHandle)pI830->BackBuffer.Start + pI830->LinearAddr, + pI830->BackBuffer.Size, DRM_AGP, 0, &pI830DRI->backbuffer) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } - - pI830DRI->depthbufferSize = pI810->DepthBuffer.Size; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->DepthBuffer.Start, - pI810->DepthBuffer.Size, DRM_AGP, 0, + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Back Buffer = 0x%08lx\n", + pI830DRI->backbuffer); + + pI830DRI->depthbufferSize = pI830->DepthBuffer.Size; + if (drmAddMap(pI830->drmSubFD, + (drmHandle)pI830->DepthBuffer.Start + pI830->LinearAddr, + pI830->DepthBuffer.Size, DRM_AGP, 0, &pI830DRI->depthbuffer) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(depthbuffer) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - /* Allocate FrontBuffer etc. */ - I810AllocateFront(pScrn); - - /* Allocate memory for the logical context, 32k is fine for right now */ - I810AllocHigh( &(pI810->ContextMem), &(pI810->SysMem), - 32768 ); - - /* Allocate buffer memory */ - I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), - I830_DMA_BUF_NR * I830_DMA_BUF_SZ); - - xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] Buffer map : %lx\n", - pI810->BufferMem.Start); - - if (pI810->BufferMem.Start == 0 || - pI810->BufferMem.End - pI810->BufferMem.Start > - I830_DMA_BUF_NR * I830_DMA_BUF_SZ) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] Not enough memory for dma buffers. Disabling DRI\n"); + "[drm] drmAddMap(depthbuffer) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BufferMem.Start, - pI810->BufferMem.Size, DRM_AGP, 0, - &pI810->buffer_map) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(buffer_map) failed. Disabling DRI\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Depth Buffer = 0x%08lx\n", + pI830DRI->depthbuffer); + + if (drmAddMap(pI830->drmSubFD, + (drmHandle)pI830->BufferMem.Start + pI830->LinearAddr, + pI830->BufferMem.Size, DRM_AGP, 0, + &pI830->buffer_map) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(buffer_map) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] DMA Buffers = 0x%08lx\n", + pI830->buffer_map); - pI830DRI->agp_buffers = pI810->buffer_map; - pI830DRI->agp_buf_size = pI810->BufferMem.Size; + pI830DRI->agp_buffers = pI830->buffer_map; + pI830DRI->agp_buf_size = pI830->BufferMem.Size; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->LpRing.mem.Start, - pI810->LpRing.mem.Size, DRM_AGP, 0, - &pI810->ring_map) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); + if (drmAddMap(pI830->drmSubFD, + (drmHandle)pI830->LpRing.mem.Start + pI830->LinearAddr, + pI830->LpRing.mem.Size, DRM_AGP, 0, + &pI830->ring_map) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } - - /* Use the rest of memory for textures. */ - pI830DRI->textureSize = pI810->SysMem.Size; - - i = mylog2(pI830DRI->textureSize / I830_NR_TEX_REGIONS); - - if (i < I830_LOG_MIN_TEX_REGION_SIZE) - i = I830_LOG_MIN_TEX_REGION_SIZE; + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] ring buffer = 0x%08lx\n", + pI830->ring_map); - pI830DRI->logTextureGranularity = i; - pI830DRI->textureSize = (pI830DRI->textureSize >> i) << i; /* truncate */ + pI830DRI->textureSize = pI830->TexMem.Size; + pI830DRI->logTextureGranularity = pI830->TexGranularity; - if(pI830DRI->textureSize < 512*1024) { - ErrorF("Less then 512k for textures\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - I810AllocLow( &(pI810->TexMem), &(pI810->SysMem), - pI830DRI->textureSize); - - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->TexMem.Start, - pI810->TexMem.Size, DRM_AGP, 0, + if (drmAddMap(pI830->drmSubFD, + (drmHandle)pI830->TexMem.Start + pI830->LinearAddr, + pI830->TexMem.Size, DRM_AGP, 0, &pI830DRI->textures) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(textures) failed. Disabling DRI\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(textures) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } - - if((bufs = drmAddBufs(pI810->drmSubFD, - I830_DMA_BUF_NR, - I830_DMA_BUF_SZ, - DRM_AGP_BUFFER, pI810->BufferMem.Start)) <= 0) { + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] textures = 0x%08lx\n", + pI830DRI->textures); + + if ((bufs = drmAddBufs(pI830->drmSubFD, + I830_DMA_BUF_NR, + I830_DMA_BUF_SZ, + DRM_AGP_BUFFER, pI830DRI->agp_buffers)) <= 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure adding %d %d byte DMA buffers\n", - I830_DMA_BUF_NR, - I830_DMA_BUF_SZ); + I830_DMA_BUF_NR, I830_DMA_BUF_SZ); DRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", - bufs, I830_DMA_BUF_SZ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] added %d %d byte DMA buffers\n", bufs, I830_DMA_BUF_SZ); + I830InitDma(pScrn); - xf86EnablePciBusMaster(pI810->PciInfo, TRUE); + if (pI830->PciInfo->chipType != PCI_CHIP_845_G && + pI830->PciInfo->chipType != PCI_CHIP_I830_M) { + I830SetParam(pScrn, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 ); + } - I830InitDma(pScrn); - /* Okay now initialize the dma engine */ -#if 1 if (!pI830DRI->irq) { - pI830DRI->irq = drmGetInterruptFromBusID(pI810->drmSubFD, - ((pciConfigPtr)pI810->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pI810->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pI810->PciInfo->thisCard)->funcnum); - if((drmCtlInstHandler(pI810->drmSubFD, pI830DRI->irq)) != 0) { + pI830DRI->irq = drmGetInterruptFromBusID(pI830->drmSubFD, + ((pciConfigPtr) pI830-> + PciInfo->thisCard)->busnum, + ((pciConfigPtr) pI830-> + PciInfo->thisCard)->devnum, + ((pciConfigPtr) pI830-> + PciInfo->thisCard)->funcnum); +#if 1 + if ((drmCtlInstHandler(pI830->drmSubFD, pI830DRI->irq)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure adding irq handler, there is a device already using that irq\n" - "[drm] Consider rearranging your PCI cards\n"); + "[drm] Consider rearranging your PCI cards\n"); DRICloseScreen(pScreen); return FALSE; } +#endif } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pI830DRI->irq); -#endif + "[drm] dma control initialized, using IRQ %d\n", pI830DRI->irq); + + pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; + pI830DRI->deviceID = pI830->PciInfo->chipType; + pI830DRI->width = pScrn->virtualX; + pI830DRI->height = pScrn->virtualY; + pI830DRI->mem = pScrn->videoRam * 1024; + pI830DRI->cpp = pI830->cpp; - pI830DRI=(I830DRIPtr)pI810->pDRIInfo->devPrivate; - pI830DRI->deviceID=pI810->PciInfo->chipType; - pI830DRI->width=pScrn->virtualX; - pI830DRI->height=pScrn->virtualY; - pI830DRI->mem=pScrn->videoRam*1024; - pI830DRI->cpp=pI810->cpp; - - pI830DRI->fbOffset=pI810->FrontBuffer.Start; - pI830DRI->fbStride=pI810->auxPitch; - + pI830DRI->fbOffset = pI830->FrontBuffer.Start; + pI830DRI->fbStride = pI830->auxPitch; + pI830DRI->bitsPerPixel = pScrn->bitsPerPixel; - - - pI830DRI->textureOffset=pI810->TexMem.Start; - - pI830DRI->backOffset=pI810->BackBuffer.Start; - pI830DRI->depthOffset=pI810->DepthBuffer.Start; - - pI830DRI->ringOffset=pI810->LpRing.mem.Start; - pI830DRI->ringSize=pI810->LpRing.mem.Size; - - pI830DRI->auxPitch = pI810->auxPitch; - pI830DRI->auxPitchBits = pI810->auxPitchBits; + + pI830DRI->textureOffset = pI830->TexMem.Start; + + pI830DRI->backOffset = pI830->BackBuffer.Start; + pI830DRI->depthOffset = pI830->DepthBuffer.Start; + + pI830DRI->ringOffset = pI830->LpRing.mem.Start; + pI830DRI->ringSize = pI830->LpRing.mem.Size; + + pI830DRI->auxPitch = pI830->auxPitch; + pI830DRI->auxPitchBits = pI830->auxPitchBits; pI830DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); if (!(I830InitVisualConfigs(pScreen))) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] I830InitVisualConfigs failed. Disabling DRI\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] I830InitVisualConfigs failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n" ); - pI810->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n"); + pI830->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; return TRUE; } @@ -872,40 +756,30 @@ I830DRICloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); - I830CleanupDma(pScrn); + DPRINTF(PFX, "I830DRICloseScreen\n"); - if(pI810->backHandle) drmAgpFree(pI810->drmSubFD, pI810->backHandle); - if(pI810->zHandle) drmAgpFree(pI810->drmSubFD, pI810->zHandle); - if(pI810->cursorHandle) drmAgpFree(pI810->drmSubFD, pI810->cursorHandle); - if(pI810->sysmemHandle) drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle); - - if(pI810->agpAcquired == TRUE) drmAgpRelease(pI810->drmSubFD); - - pI810->backHandle = 0; - pI810->zHandle = 0; - pI810->cursorHandle = 0; - pI810->sysmemHandle = 0; - pI810->agpAcquired = FALSE; + I830CleanupDma(pScrn); - DRICloseScreen(pScreen); - if (pI810->pDRIInfo) { - if (pI810->pDRIInfo->devPrivate) { - xfree(pI810->pDRIInfo->devPrivate); - pI810->pDRIInfo->devPrivate=0; - } - DRIDestroyInfoRec(pI810->pDRIInfo); - pI810->pDRIInfo=0; - } - if (pI810->pVisualConfigs) xfree(pI810->pVisualConfigs); - if (pI810->pVisualConfigsPriv) xfree(pI810->pVisualConfigsPriv); + if (pI830->pDRIInfo) { + if (pI830->pDRIInfo->devPrivate) { + xfree(pI830->pDRIInfo->devPrivate); + pI830->pDRIInfo->devPrivate = 0; + } + DRIDestroyInfoRec(pI830->pDRIInfo); + pI830->pDRIInfo = 0; + } + if (pI830->pVisualConfigs) + xfree(pI830->pVisualConfigs); + if (pI830->pVisualConfigsPriv) + xfree(pI830->pVisualConfigsPriv); } static Bool -I830CreateContext(ScreenPtr pScreen, VisualPtr visual, +I830CreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { @@ -913,49 +787,58 @@ } static void -I830DestroyContext(ScreenPtr pScreen, drmContext hwContext, +I830DestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore) { } - Bool I830DRIFinishScreenInit(ScreenPtr pScreen) { - I830SAREARec *sPriv = (I830SAREARec *)DRIGetSAREAPrivate(pScreen); - memset( sPriv, 0, sizeof(sPriv) ); + I830SAREARec *sPriv = (I830SAREARec *) DRIGetSAREAPrivate(pScreen); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830DRIFinishScreenInit\n"); + + memset(sPriv, 0, sizeof(sPriv)); + + /* Have shadow run only while there is 3d active. + */ + if (pI830->allowPageFlip && pI830->drmMinor >= 3) { + shadowSetup(pScreen); + shadowAdd(pScreen, 0, I830DRIShadowUpdate, 0, 0, 0); + } + else + pI830->allowPageFlip = 0; + return DRIFinishScreenInit(pScreen); } void -I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, +I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, DRIContextType newContextType, void *newContext) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); - if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { + if (syncType == DRI_3D_SYNC && + oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("i830DRISwapContext (in)\n"); - - pI810->LockHeld = 1; - I810RefreshRing( pScrn ); - } - else if (syncType == DRI_2D_SYNC && - oldContextType == DRI_NO_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { - pI810->LockHeld = 0; + + pI830->LockHeld = 1; + I830RefreshRing(pScrn); + } else if (syncType == DRI_2D_SYNC && + oldContextType == DRI_NO_CONTEXT && + newContextType == DRI_2D_CONTEXT) { + pI830->LockHeld = 0; if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("i830DRISwapContext (out)\n"); - } - else if (I810_DEBUG & DEBUG_VERBOSE_DRI) + } else if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("i830DRISwapContext (other)\n"); } @@ -964,18 +847,18 @@ { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); BoxPtr pbox = REGION_RECTS(prgn); int nbox = REGION_NUM_RECTS(prgn); if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF( "I830DRIInitBuffers\n"); + ErrorF("I830DRIInitBuffers\n"); I830SetupForSolidFill(pScrn, 0, GXcopy, -1); while (nbox--) { - I810SelectBuffer(pScrn, I810_BACK); - I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, - pbox->x2-pbox->x1, pbox->y2-pbox->y1); + I830SelectBuffer(pScrn, I830_SELECT_BACK); + I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); pbox++; } @@ -984,35 +867,39 @@ pbox = REGION_RECTS(prgn); nbox = REGION_NUM_RECTS(prgn); - I810SelectBuffer(pScrn, I810_DEPTH); + I830SelectBuffer(pScrn, I830_SELECT_DEPTH); switch (pScrn->bitsPerPixel) { - case 16: I830SetupForSolidFill(pScrn, 0xffff, GXcopy, -1); break; - case 32: I830SetupForSolidFill(pScrn, 0xffffff, GXcopy, -1); break; + case 16: + I830SetupForSolidFill(pScrn, 0xffff, GXcopy, -1); + break; + case 32: + I830SetupForSolidFill(pScrn, 0xffffff, GXcopy, -1); + break; } - while (nbox--) { - I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, - pbox->x2-pbox->x1, pbox->y2-pbox->y1); + while (nbox--) { + I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); pbox++; } - I810SelectBuffer(pScrn, I810_FRONT); - pI810->AccelInfoRec->NeedToSync = TRUE; + I830SelectBuffer(pScrn, I830_SELECT_FRONT); + pI830->AccelInfoRec->NeedToSync = TRUE; } /* This routine is a modified form of XAADoBitBlt with the calls to * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source * instead of destination. My origin is upside down so the ydir cases - * are reversed. + * are reversed. */ static void -I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I810Ptr pI810 = I810PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); BoxPtr pboxTmp, pboxNext, pboxBase; DDXPointPtr pptTmp, pptNew2; int xdir, ydir; @@ -1032,23 +919,24 @@ int dy = pParent->drawable.y - ptOldOrg.y; /* If the copy will overlap in Y, reverse the order */ - if (dy>0) { + if (dy > 0) { ydir = -1; - if (nbox>1) { + if (nbox > 1) { /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - if (!pboxNew1) return; - pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + pboxNew1 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + if (!pboxNew1) + return; + pptNew1 = (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if (!pptNew1) { DEALLOCATE_LOCAL(pboxNew1); return; } - pboxBase = pboxNext = pbox+nbox-1; + pboxBase = pboxNext = pbox + nbox - 1; while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; - pboxTmp = pboxNext+1; + pboxTmp = pboxNext + 1; pptTmp = pptSrc + (pboxTmp - pbox); while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; @@ -1067,16 +955,18 @@ } /* If the regions will overlap in X, reverse the order */ - if (dx>0) { + if (dx > 0) { xdir = -1; if (nbox > 1) { /*reverse orderof rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + pboxNew2 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pptNew2 = (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if (!pboxNew2 || !pptNew2) { - if (pptNew2) DEALLOCATE_LOCAL(pptNew2); - if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); + if (pptNew2) + DEALLOCATE_LOCAL(pptNew2); + if (pboxNew2) + DEALLOCATE_LOCAL(pboxNew2); if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); @@ -1084,8 +974,8 @@ return; } pboxBase = pboxNext = pbox; - while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) + while (pboxBase < pbox + nbox) { + while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; pptTmp = pptSrc + (pboxTmp - pbox); @@ -1107,36 +997,41 @@ /* SelectBuffer isn't really a good concept for the i810. */ - I810EmitFlush(pScrn); + I830EmitFlush(pScrn); I830SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); - for ( ; nbox-- ; pbox++ ) { - + for (; nbox--; pbox++) { + int x1 = pbox->x1; int y1 = pbox->y1; int destx = x1 + dx; int desty = y1 + dy; int w = pbox->x2 - x1 + 1; int h = pbox->y2 - y1 + 1; - - if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; - if ( desty < 0 ) y1 -= desty, h += desty, desty = 0; - if ( destx + w > screenwidth ) w = screenwidth - destx; - if ( desty + h > screenheight ) h = screenheight - desty; - if ( w <= 0 ) continue; - if ( h <= 0 ) continue; - + if (destx < 0) + x1 -= destx, w += destx, destx = 0; + if (desty < 0) + y1 -= desty, h += desty, desty = 0; + if (destx + w > screenwidth) + w = screenwidth - destx; + if (desty + h > screenheight) + h = screenheight - desty; + if (w <= 0) + continue; + if (h <= 0) + continue; + if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF( "MoveBuffers %d,%d %dx%d dx: %d dy: %d\n", - x1, y1, w, h, dx, dy); + ErrorF("MoveBuffers %d,%d %dx%d dx: %d dy: %d\n", + x1, y1, w, h, dx, dy); - I810SelectBuffer(pScrn, I810_BACK); + I830SelectBuffer(pScrn, I830_SELECT_BACK); I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); - I810SelectBuffer(pScrn, I810_DEPTH); + I830SelectBuffer(pScrn, I830_SELECT_DEPTH); I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); } - I810SelectBuffer(pScrn, I810_FRONT); - I810EmitFlush(pScrn); + I830SelectBuffer(pScrn, I830_SELECT_FRONT); + I830EmitFlush(pScrn); if (pboxNew2) { DEALLOCATE_LOCAL(pptNew2); @@ -1147,69 +1042,44 @@ DEALLOCATE_LOCAL(pboxNew1); } - pI810->AccelInfoRec->NeedToSync = TRUE; + pI830->AccelInfoRec->NeedToSync = TRUE; } /* Completely Initialize the first context */ -void +void I830EmitInvarientState(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR(pScrn); - I830DRIPtr pI830DRI = (I830DRIPtr)pI810->pDRIInfo->devPrivate; - CARD32 ctx_addr, vtx_addr, vtx1_addr, temp; - BEGIN_LP_RING( 128 ); + I830Ptr pI830 = I830PTR(pScrn); + I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; + CARD32 ctx_addr, temp; - ctx_addr = pI810->ContextMem.Start; + BEGIN_LP_RING(128-2); + + ctx_addr = pI830->ContextMem.Start; /* Align to a 2k boundry */ ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048; - /* Carve out some context memory for the vertex buffers, if we ever - * use these directly, we will need to change this - */ - vtx_addr = ctx_addr + 8192; - vtx1_addr = ctx_addr + 16384; - OUT_RING(MI_SET_CONTEXT); OUT_RING(ctx_addr | CTXT_NO_RESTORE | - CTXT_PALETTE_SAVE_DISABLE | - CTXT_PALETTE_RESTORE_DISABLE); - - /* Zero pitch and width make the vertex buffer match vertex format */ - OUT_RING(MI_VERTEX_BUFFER | - MI_VERTEX_BUFFER_IDX(0) | - MI_VERTEX_BUFFER_PITCH(0) | - MI_VERTEX_BUFFER_WIDTH(0)); - OUT_RING(vtx_addr); - - /* Setting zero pitch and width is undefined so we have to set these to - * one, even though we just disable this buffer. - */ - - OUT_RING(MI_VERTEX_BUFFER | - MI_VERTEX_BUFFER_IDX(1) | - MI_VERTEX_BUFFER_PITCH(1) | - MI_VERTEX_BUFFER_WIDTH(1)); - OUT_RING(vtx1_addr | - MI_VERTEX_BUFFER_DISABLE); + CTXT_PALETTE_SAVE_DISABLE | CTXT_PALETTE_RESTORE_DISABLE); OUT_RING(STATE3D_AA_CMD | AA_LINE_ECAAR_WIDTH_ENABLE | AA_LINE_ECAAR_WIDTH_1_0 | AA_LINE_REGION_WIDTH_ENABLE | - AA_LINE_REGION_WIDTH_1_0 | - AA_LINE_DISABLE); + AA_LINE_REGION_WIDTH_1_0 | AA_LINE_DISABLE); OUT_RING(STATE3D_BUF_INFO_CMD); OUT_RING(BUF_3D_ID_COLOR_BACK | BUF_3D_USE_FENCE | - BUF_3D_PITCH((pI810->cpp * pScrn->displayWidth) / 4)); + BUF_3D_PITCH((pI830->cpp * pScrn->displayWidth) / 4)); OUT_RING(BUF_3D_ADDR(pI830DRI->backOffset)); OUT_RING(STATE3D_BUF_INFO_CMD); OUT_RING(BUF_3D_ID_DEPTH | BUF_3D_USE_FENCE | - BUF_3D_PITCH((pI810->cpp * pScrn->displayWidth) / 4)); + BUF_3D_PITCH((pI830->cpp * pScrn->displayWidth) / 4)); OUT_RING(BUF_3D_ADDR(pI830DRI->depthOffset)); OUT_RING(STATE3D_COLOR_FACTOR); @@ -1239,7 +1109,7 @@ OUT_RING(STATE3D_DFLT_Z_CMD); OUT_RING(0); - switch(pScrn->bitsPerPixel) { + switch (pScrn->bitsPerPixel) { case 15: temp = DEPTH_FRMT_16_FIXED | COLR_BUF_RGB555; break; @@ -1256,15 +1126,12 @@ OUT_RING(STATE3D_DST_BUF_VARS_CMD); OUT_RING(DSTORG_HORT_BIAS(0x8) | - DSTORG_VERT_BIAS(0x8) | - DEPTH_IS_Z | - temp); + DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z | temp); OUT_RING(STATE3D_DRAW_RECT_CMD); OUT_RING(DRAW_RECT_DIS_DEPTH_OFS); OUT_RING(0); - OUT_RING((pI830DRI->height<<16) | - pI830DRI->width); + OUT_RING((pI830DRI->height << 16) | pI830DRI->width); OUT_RING(0); OUT_RING(STATE3D_ENABLES_1_CMD | @@ -1273,28 +1140,20 @@ DISABLE_DEPTH_BIAS | DISABLE_SPEC_ADD | I830_DISABLE_FOG | - DISABLE_ALPHA_TEST | - DISABLE_COLOR_BLEND | - DISABLE_DEPTH_TEST); + DISABLE_ALPHA_TEST | DISABLE_COLOR_BLEND | DISABLE_DEPTH_TEST); OUT_RING(STATE3D_ENABLES_2_CMD | DISABLE_STENCIL_WRITE | ENABLE_TEX_CACHE | ENABLE_DITHER | - ENABLE_COLOR_MASK | - ENABLE_COLOR_WRITE | - ENABLE_DEPTH_WRITE); + ENABLE_COLOR_MASK | ENABLE_COLOR_WRITE | ENABLE_DEPTH_WRITE); OUT_RING(STATE3D_FOG_COLOR_CMD | - FOG_COLOR_RED(0) | - FOG_COLOR_GREEN(0) | - FOG_COLOR_BLUE(0)); + FOG_COLOR_RED(0) | FOG_COLOR_GREEN(0) | FOG_COLOR_BLUE(0)); OUT_RING(STATE3D_FOG_MODE); OUT_RING(FOG_MODE_VERTEX | - ENABLE_FOG_CONST | - ENABLE_FOG_SOURCE | - ENABLE_FOG_DENSITY); + ENABLE_FOG_CONST | ENABLE_FOG_SOURCE | ENABLE_FOG_DENSITY); OUT_RING(0); OUT_RING(0); @@ -1304,51 +1163,34 @@ ABLENDFUNC_ADD | ENABLE_SRC_ABLEND_FACTOR | SRC_ABLEND_FACT(BLENDFACT_ONE) | - ENABLE_DST_ABLEND_FACTOR | - SRC_ABLEND_FACT(BLENDFACT_ZERO)); + ENABLE_DST_ABLEND_FACTOR | SRC_ABLEND_FACT(BLENDFACT_ZERO)); /* I need to come back to texture state */ OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(0) | TEXPIPE_COLOR | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(1) | TEXPIPE_COLOR | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(2) | TEXPIPE_COLOR | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(3) | TEXPIPE_COLOR | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(0) | TEXPIPE_ALPHA | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(1) | TEXPIPE_ALPHA | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(2) | TEXPIPE_ALPHA | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(3) | TEXPIPE_ALPHA | - TEXBLEND_ARG1 | - TEXBLENDARG_MODIFY_PARMS | - TEXBLENDARG_DIFFUSE); + TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS | TEXBLENDARG_DIFFUSE); OUT_RING(STATE3D_MAP_BLEND_OP_CMD(0) | TEXPIPE_COLOR | @@ -1356,16 +1198,12 @@ TEXOP_OUTPUT_CURRENT | DISABLE_TEX_CNTRL_STAGE | TEXOP_SCALE_1X | - TEXOP_MODIFY_PARMS | - TEXOP_LAST_STAGE | - TEXBLENDOP_ARG1); + TEXOP_MODIFY_PARMS | TEXOP_LAST_STAGE | TEXBLENDOP_ARG1); OUT_RING(STATE3D_MAP_BLEND_OP_CMD(0) | TEXPIPE_ALPHA | ENABLE_TEXOUTPUT_WRT_SEL | TEXOP_OUTPUT_CURRENT | - TEXOP_SCALE_1X | - TEXOP_MODIFY_PARMS | - TEXBLENDOP_ARG1); + TEXOP_SCALE_1X | TEXOP_MODIFY_PARMS | TEXBLENDOP_ARG1); OUT_RING(STATE3D_MAP_COORD_SETBIND_CMD); OUT_RING(TEXBIND_SET3(TEXCOORDSRC_DEFAULT) | @@ -1411,30 +1249,27 @@ DISABLE_TEX_STREAM_BUMP | ENABLE_TEX_STREAM_COORD_SET | TEX_STREAM_COORD_SET(0) | - ENABLE_TEX_STREAM_MAP_IDX | - TEX_STREAM_MAP_IDX(0)); + ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(0)); OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | MAP_UNIT(1) | DISABLE_TEX_STREAM_BUMP | ENABLE_TEX_STREAM_COORD_SET | TEX_STREAM_COORD_SET(1) | - ENABLE_TEX_STREAM_MAP_IDX | - TEX_STREAM_MAP_IDX(1)); + ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(1)); OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | MAP_UNIT(2) | DISABLE_TEX_STREAM_BUMP | ENABLE_TEX_STREAM_COORD_SET | TEX_STREAM_COORD_SET(2) | - ENABLE_TEX_STREAM_MAP_IDX | - TEX_STREAM_MAP_IDX(2)); + ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(2)); OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | MAP_UNIT(3) | DISABLE_TEX_STREAM_BUMP | ENABLE_TEX_STREAM_COORD_SET | TEX_STREAM_COORD_SET(3) | - ENABLE_TEX_STREAM_MAP_IDX | - TEX_STREAM_MAP_IDX(3)); + ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(3)); +#if 0 OUT_RING(STATE3D_MAP_FILTER_CMD | MAP_UNIT(0) | ENABLE_CHROMA_KEY_PARAMS | @@ -1442,8 +1277,7 @@ MIPFILTER_NEAREST | ENABLE_MAG_MODE_FILTER | ENABLE_MIN_MODE_FILTER | - MAG_FILTER(FILTER_NEAREST) | - MIN_FILTER(FILTER_NEAREST)); + MAG_FILTER(FILTER_NEAREST) | MIN_FILTER(FILTER_NEAREST)); OUT_RING(STATE3D_MAP_FILTER_CMD | MAP_UNIT(1) | ENABLE_CHROMA_KEY_PARAMS | @@ -1451,8 +1285,7 @@ MIPFILTER_NEAREST | ENABLE_MAG_MODE_FILTER | ENABLE_MIN_MODE_FILTER | - MAG_FILTER(FILTER_NEAREST) | - MIN_FILTER(FILTER_NEAREST)); + MAG_FILTER(FILTER_NEAREST) | MIN_FILTER(FILTER_NEAREST)); OUT_RING(STATE3D_MAP_FILTER_CMD | MAP_UNIT(2) | ENABLE_CHROMA_KEY_PARAMS | @@ -1460,8 +1293,7 @@ MIPFILTER_NEAREST | ENABLE_MAG_MODE_FILTER | ENABLE_MIN_MODE_FILTER | - MAG_FILTER(FILTER_NEAREST) | - MIN_FILTER(FILTER_NEAREST)); + MAG_FILTER(FILTER_NEAREST) | MIN_FILTER(FILTER_NEAREST)); OUT_RING(STATE3D_MAP_FILTER_CMD | MAP_UNIT(3) | ENABLE_CHROMA_KEY_PARAMS | @@ -1469,8 +1301,7 @@ MIPFILTER_NEAREST | ENABLE_MAG_MODE_FILTER | ENABLE_MIN_MODE_FILTER | - MAG_FILTER(FILTER_NEAREST) | - MIN_FILTER(FILTER_NEAREST)); + MAG_FILTER(FILTER_NEAREST) | MIN_FILTER(FILTER_NEAREST)); OUT_RING(STATE3D_MAP_INFO_COLR_CMD); OUT_RING(MAP_INFO_TEX(0) | @@ -1478,11 +1309,9 @@ MT_32BIT_ARGB8888 | MAP_INFO_OUTMUX_F0F1F2F3 | MAP_INFO_VERTLINESTRIDEOFS_0 | - MAP_INFO_FORMAT_2D | - MAP_INFO_USE_FENCE); - OUT_RING(MAP_INFO_HEIGHT(0) | - MAP_INFO_WIDTH(0)); - OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + MAP_INFO_FORMAT_2D | MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI830->TexMem.Start)); OUT_RING(MAP_INFO_DWORD_PITCH(31)); OUT_RING(MAP_INFO_DFLT_COLR(0)); @@ -1492,11 +1321,9 @@ MT_32BIT_ARGB8888 | MAP_INFO_OUTMUX_F0F1F2F3 | MAP_INFO_VERTLINESTRIDEOFS_0 | - MAP_INFO_FORMAT_2D | - MAP_INFO_USE_FENCE); - OUT_RING(MAP_INFO_HEIGHT(0) | - MAP_INFO_WIDTH(0)); - OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + MAP_INFO_FORMAT_2D | MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI830->TexMem.Start)); OUT_RING(MAP_INFO_DWORD_PITCH(31)); OUT_RING(MAP_INFO_DFLT_COLR(0)); @@ -1506,11 +1333,9 @@ MT_32BIT_ARGB8888 | MAP_INFO_OUTMUX_F0F1F2F3 | MAP_INFO_VERTLINESTRIDEOFS_0 | - MAP_INFO_FORMAT_2D | - MAP_INFO_USE_FENCE); - OUT_RING(MAP_INFO_HEIGHT(0) | - MAP_INFO_WIDTH(0)); - OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + MAP_INFO_FORMAT_2D | MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI830->TexMem.Start)); OUT_RING(MAP_INFO_DWORD_PITCH(31)); OUT_RING(MAP_INFO_DFLT_COLR(0)); @@ -1520,55 +1345,38 @@ MT_32BIT_ARGB8888 | MAP_INFO_OUTMUX_F0F1F2F3 | MAP_INFO_VERTLINESTRIDEOFS_0 | - MAP_INFO_FORMAT_2D | - MAP_INFO_USE_FENCE); - OUT_RING(MAP_INFO_HEIGHT(0) | - MAP_INFO_WIDTH(0)); - OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + MAP_INFO_FORMAT_2D | MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI830->TexMem.Start)); OUT_RING(MAP_INFO_DWORD_PITCH(31)); OUT_RING(MAP_INFO_DFLT_COLR(0)); OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | - MAP_UNIT(0) | - ENABLE_TEXLOD_BIAS | - MAP_LOD_BIAS(0)); + MAP_UNIT(0) | ENABLE_TEXLOD_BIAS | MAP_LOD_BIAS(0)); OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | - MAP_UNIT(1) | - ENABLE_TEXLOD_BIAS | - MAP_LOD_BIAS(0)); + MAP_UNIT(1) | ENABLE_TEXLOD_BIAS | MAP_LOD_BIAS(0)); OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | - MAP_UNIT(2) | - ENABLE_TEXLOD_BIAS | - MAP_LOD_BIAS(0)); + MAP_UNIT(2) | ENABLE_TEXLOD_BIAS | MAP_LOD_BIAS(0)); OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | - MAP_UNIT(3) | - ENABLE_TEXLOD_BIAS | - MAP_LOD_BIAS(0)); + MAP_UNIT(3) | ENABLE_TEXLOD_BIAS | MAP_LOD_BIAS(0)); OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | MAP_UNIT(0) | ENABLE_MAX_MIP_LVL | - ENABLE_MIN_MIP_LVL | - LOD_MAX(0) | - LOD_MIN(0)); + ENABLE_MIN_MIP_LVL | LOD_MAX(0) | LOD_MIN(0)); OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | MAP_UNIT(1) | ENABLE_MAX_MIP_LVL | - ENABLE_MIN_MIP_LVL | - LOD_MAX(0) | - LOD_MIN(0)); + ENABLE_MIN_MIP_LVL | LOD_MAX(0) | LOD_MIN(0)); OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | MAP_UNIT(2) | ENABLE_MAX_MIP_LVL | - ENABLE_MIN_MIP_LVL | - LOD_MAX(0) | - LOD_MIN(0)); + ENABLE_MIN_MIP_LVL | LOD_MAX(0) | LOD_MIN(0)); OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | MAP_UNIT(3) | ENABLE_MAX_MIP_LVL | - ENABLE_MIN_MIP_LVL | - LOD_MAX(0) | - LOD_MIN(0)); + ENABLE_MIN_MIP_LVL | LOD_MAX(0) | LOD_MIN(0)); +#endif OUT_RING(STATE3D_MAP_COORD_TRANSFORM); OUT_RING(DISABLE_TEX_TRANSFORM | TEXTURE_SET(0)); @@ -1586,15 +1394,13 @@ BLENDFUNC_ADD | ENABLE_SRC_BLND_FACTOR | ENABLE_DST_BLND_FACTOR | - SRC_BLND_FACT(BLENDFACT_ONE) | - DST_BLND_FACT(BLENDFACT_ZERO)); + SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ZERO)); OUT_RING(STATE3D_MODES_2_CMD | ENABLE_GLOBAL_DEPTH_BIAS | GLOBAL_DEPTH_BIAS(0) | ENABLE_ALPHA_TEST_FUNC | - ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) | - ALPHA_REF_VALUE(0)); + ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) | ALPHA_REF_VALUE(0)); OUT_RING(STATE3D_MODES_3_CMD | ENABLE_DEPTH_TEST_FUNC | @@ -1607,16 +1413,14 @@ SPEC_SHADE_MODE(SHADE_MODE_LINEAR) | ENABLE_COLOR_SHADE_MODE | COLOR_SHADE_MODE(SHADE_MODE_LINEAR) | - ENABLE_CULL_MODE | - CULLMODE_NONE); + ENABLE_CULL_MODE | CULLMODE_NONE); OUT_RING(STATE3D_MODES_4_CMD | ENABLE_LOGIC_OP_FUNC | LOGIC_OP_FUNC(LOGICOP_COPY) | ENABLE_STENCIL_TEST_MASK | STENCIL_TEST_MASK(0xff) | - ENABLE_STENCIL_WRITE_MASK | - STENCIL_WRITE_MASK(0xff)); + ENABLE_STENCIL_WRITE_MASK | STENCIL_WRITE_MASK(0xff)); OUT_RING(STATE3D_MODES_5_CMD | ENABLE_SPRITE_POINT_TEX | @@ -1625,8 +1429,7 @@ FLUSH_TEXTURE_CACHE | ENABLE_FIXED_LINE_WIDTH | FIXED_LINE_WIDTH(0x2) | - ENABLE_FIXED_POINT_WIDTH | - FIXED_POINT_WIDTH(1)); + ENABLE_FIXED_POINT_WIDTH | FIXED_POINT_WIDTH(1)); OUT_RING(STATE3D_RASTER_RULES_CMD | ENABLE_POINT_RASTER_RULE | @@ -1635,11 +1438,9 @@ ENABLE_TRI_FAN_PROVOKE_VRTX | ENABLE_TRI_STRIP_PROVOKE_VRTX | LINE_STRIP_PROVOKE_VRTX(1) | - TRI_FAN_PROVOKE_VRTX(2) | - TRI_STRIP_PROVOKE_VRTX(2)); + TRI_FAN_PROVOKE_VRTX(2) | TRI_STRIP_PROVOKE_VRTX(2)); - OUT_RING(STATE3D_SCISSOR_ENABLE_CMD | - DISABLE_SCISSOR_RECT); + OUT_RING(STATE3D_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT); OUT_RING(STATE3D_SCISSOR_RECT_0_CMD); OUT_RING(0); @@ -1652,8 +1453,7 @@ STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_KEEP) | ENABLE_STENCIL_TEST_FUNC | STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS) | - ENABLE_STENCIL_REF_VALUE | - STENCIL_REF_VALUE(0)); + ENABLE_STENCIL_REF_VALUE | STENCIL_REF_VALUE(0)); OUT_RING(VRTX_FORMAT_NTEX(1)); @@ -1668,12 +1468,197 @@ VRTX_TEX_SET_7_FMT(TEXCOORDFMT_2D)); OUT_RING(STATE3D_VERTEX_TRANSFORM); - OUT_RING(DISABLE_VIEWPORT_TRANSFORM | - DISABLE_PERSPECTIVE_DIVIDE); + OUT_RING(DISABLE_VIEWPORT_TRANSFORM | DISABLE_PERSPECTIVE_DIVIDE); OUT_RING(STATE3D_W_STATE_CMD); OUT_RING(MAGIC_W_STATE_DWORD1); - OUT_RING(0x3f800000 /* 1.0 in IEEE float */); + OUT_RING(0x3f800000 /* 1.0 in IEEE float */ ); + +#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) + + OUT_RING(GFX_OP_STIPPLE); + OUT_RING(0); ADVANCE_LP_RING(); } + +/* Fullscreen hooks. The DRI fullscreen mode can probably be removed + * as it adds little or nothing above the mechanism below. (and isn't + * widely used) + */ +static Bool +I830DRIOpenFullScreen(ScreenPtr pScreen) +{ + return TRUE; +} + +static Bool +I830DRICloseFullScreen(ScreenPtr pScreen) +{ + return TRUE; +} + + + +/* Use callbacks from dri.c to support pageflipping mode for a single + * 3d context without need for any specific full-screen extension. + * + * Also see tdfx driver for example of using these callbacks to + * allocate and free 3d-specific memory on demand. + */ + + + + + +/* Use the miext/shadow module to maintain a list of dirty rectangles. + * These are blitted to the back buffer to keep both buffers clean + * during page-flipping when the 3d application isn't fullscreen. + * + * Unlike most use of the shadow code, both buffers are in video + * memory. + * + * An alternative to this would be to organize for all on-screen + * drawing operations to be duplicated for the two buffers. That + * might be faster, but seems like a lot more work... + */ + + +/* This should be done *before* XAA syncs, + * Otherwise will have to sync again??? + */ +static void +I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + RegionPtr damage = &pBuf->damage; + int i, num = REGION_NUM_RECTS(damage); + BoxPtr pbox = REGION_RECTS(damage); + I830SAREARec *pSAREAPriv = DRIGetSAREAPrivate(pScreen); + int cmd, br13; + + /* Don't want to do this when no 3d is active and pages are + * right-way-round : + */ + if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0) + return; + + br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16); + + if (pScrn->bitsPerPixel == 32) { + cmd = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + br13 |= 3 << 24; + } else { + cmd = (XY_SRC_COPY_BLT_CMD); + br13 |= 1 << 24; + } + + for (i = 0 ; i < num ; i++, pbox++) { + BEGIN_LP_RING(8); + OUT_RING(cmd); + OUT_RING(br13); + OUT_RING((pbox->y1 << 16) | pbox->x1); + OUT_RING((pbox->y2 << 16) | pbox->x2); + OUT_RING(pI830->BackBuffer.Start); + OUT_RING((pbox->y1 << 16) | pbox->x1); + OUT_RING(br13 & 0xffff); + OUT_RING(pI830->FrontBuffer.Start); + ADVANCE_LP_RING(); + } +} + + +static void +I830EnablePageFlip(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + I830SAREARec *pSAREAPriv = DRIGetSAREAPrivate(pScreen); + + pSAREAPriv->pf_enabled = pI830->allowPageFlip; + pSAREAPriv->pf_active = 0; + + if (pI830->allowPageFlip) { + int br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16); + + BEGIN_LP_RING(8); + if (pScrn->bitsPerPixel == 32) { + OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + br13 |= 3 << 24; + } else { + OUT_RING(XY_SRC_COPY_BLT_CMD); + br13 |= 1 << 24; + } + + OUT_RING(br13); + OUT_RING(0); + OUT_RING((pScrn->virtualY << 16) | pScrn->virtualX); + OUT_RING(pI830->BackBuffer.Start); + OUT_RING(0); + OUT_RING(br13 & 0xffff); + OUT_RING(pI830->FrontBuffer.Start); + ADVANCE_LP_RING(); + + pSAREAPriv->pf_active = 1; + } +} + +static void +I830DisablePageFlip(ScreenPtr pScreen) +{ + I830SAREARec *pSAREAPriv = DRIGetSAREAPrivate(pScreen); + + pSAREAPriv->pf_active = 0; +} + + +static void +I830DRITransitionSingleToMulti3d(ScreenPtr pScreen) +{ + /* Tell the clients not to pageflip. How? + * -- Field in sarea, plus bumping the window counters. + * -- DRM needs to cope with Front-to-Back swapbuffers. + */ + I830DisablePageFlip(pScreen); +} + +static void +I830DRITransitionMultiToSingle3d(ScreenPtr pScreen) +{ + /* Let the remaining 3d app start page flipping again. + */ + I830EnablePageFlip(pScreen); +} + + +static void +I830DRITransitionTo3d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + I830EnablePageFlip(pScreen); + pI830->have3DWindows = 1; +} + + +static void +I830DRITransitionTo2d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + I830SAREARec *sPriv = (I830SAREARec *) DRIGetSAREAPrivate(pScreen); + + /* Shut down shadowing if we've made it back to the front page: + */ + if (sPriv->pf_current_page == 0) { + I830DisablePageFlip(pScreen); + } + + pI830->have3DWindows = 0; +} + + Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h:1.2 Sat Oct 27 23:33:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h Mon Dec 9 20:27:05 2002 @@ -1,15 +1,15 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.2 2001/10/28 03:33:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.5 2002/12/10 01:27:05 dawes Exp $ */ #ifndef _I830_DRI_H #define _I830_DRI_H -#include <xf86drm.h> -#include <xf86drmI830.h> +#include "xf86drm.h" +#include "i830_common.h" #define I830_MAX_DRAWABLES 256 #define I830_MAJOR_VERSION 1 -#define I830_MINOR_VERSION 0 +#define I830_MINOR_VERSION 3 #define I830_PATCHLEVEL 0 #define I830_REG_SIZE 0x80000 @@ -30,7 +30,7 @@ drmHandle agp_buffers; drmSize agp_buf_size; - + int deviceID; int width; int height; @@ -60,61 +60,87 @@ } I830DRIRec, *I830DRIPtr; typedef struct { - /* Nothing here yet */ - int dummy; + /* Nothing here yet */ + int dummy; } I830ConfigPrivRec, *I830ConfigPrivPtr; typedef struct { - /* Nothing here yet */ - int dummy; + /* Nothing here yet */ + int dummy; } I830DRIContextRec, *I830DRIContextPtr; /* Warning: If you change the SAREA structure you must change the kernel * structure as well */ typedef struct _I830TexRegion { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ } I830TexRegion; typedef struct _I830SAREA { - unsigned int ContextState[I830_CTX_SETUP_SIZE]; - unsigned int BufferState[I830_DEST_SETUP_SIZE]; - unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; - unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; - unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; - unsigned int Palette[2][256]; - unsigned int dirty; - - unsigned int nbox; - XF86DRIClipRectRec boxes[I830_NR_SAREA_CLIPRECTS]; - - /* Maintain an LRU of contiguous regions of texture space. If - * you think you own a region of texture memory, and it has an - * age different to the one you set, then you are mistaken and - * it has been stolen by another client. If global texAge - * hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained - * texture information of other clients - by maintaining them - * in the same lru which is used to age their own textures, - * clients have an approximate lru for the whole of global - * texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to - * kick out your own texture or someone else's - simply eject - * them all in LRU order. - */ - - I830TexRegion texList[I830_NR_TEX_REGIONS+1]; - /* Last elt is sentinal */ - int texAge; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - int ctxOwner; /* last context to upload state */ + unsigned int ContextState[I830_CTX_SETUP_SIZE]; + unsigned int BufferState[I830_DEST_SETUP_SIZE]; + unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; + unsigned int Palette[2][256]; + unsigned int dirty; + + unsigned int nbox; + XF86DRIClipRectRec boxes[I830_NR_SAREA_CLIPRECTS]; + + /* Maintain an LRU of contiguous regions of texture space. If + * you think you own a region of texture memory, and it has an + * age different to the one you set, then you are mistaken and + * it has been stolen by another client. If global texAge + * hasn't changed, there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained + * texture information of other clients - by maintaining them + * in the same lru which is used to age their own textures, + * clients have an approximate lru for the whole of global + * texture space, and can make informed decisions as to which + * areas to kick out. There is no need to choose whether to + * kick out your own texture or someone else's - simply eject + * them all in LRU order. + */ + + I830TexRegion texList[I830_NR_TEX_REGIONS + 1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; + + int pf_enabled; /* is pageflipping allowed? */ + int pf_active; /* is pageflipping active right now? */ + int pf_current_page; /* which buffer is being displayed? */ - int vertex_prim; + int perf_boxes; /* performance boxes to be displayed */ + + /* Here's the state for texunits 2,3: + */ + unsigned int TexState2[I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState2[I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed2; + + unsigned int TexState3[I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState3[I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed3; + + unsigned int StippleState[I830_STP_SETUP_SIZE]; } I830SAREARec, *I830SAREAPtr; + +/* Flags for perf_boxes + */ +#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ +#define I830_BOX_FLIP 0x2 /* populated by kernel */ +#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ +#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ +#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c:1.7 Tue Jan 8 13:59:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c Fri Feb 14 12:12:42 2003 @@ -1,7 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.7 2002/01/08 18:59:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.27 2003/02/14 17:12:42 dawes Exp $ */ /************************************************************************** Copyright 2001 VA Linux Systems Inc., Fremont, California. +Copyright © 2002 by David Dawes All Rights Reserved. @@ -19,19 +20,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - **************************************************************************/ + +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ -/* Author: Jeff Hartmann <jhartmann@valinux.com> +/* + * Authors: Jeff Hartmann <jhartmann@valinux.com> + * Abraham van der Merwe <abraham@2d3d.co.za> + * David Dawes <dawes@tungstengraphics.com> */ -/* Heavily based on the VESA driver written by: - * Paulo César Pereira de Andrade <pcpa@conectiva.com.br> +/* + * Mode handling is based on the VESA driver written by: + * Paulo César Pereira de Andrade <pcpa@conectiva.com.br> */ /* @@ -74,7 +91,7 @@ * instead of the function arguments :P * - Added a workaround for the 1600x1200 bug (Text mode corrupts * when you exit from any 1600x1200 mode and 1280x1024@85Hz. I - * suspect this is a BIOS bug (hence the 1280x1024@85Hz case). + * suspect this is a BIOS bug (hence the 1280x1024@85Hz case)). * For now I'm switching to 800x600@60Hz then to 80x25 text mode * and then restoring the registers - very ugly indeed. * @@ -86,6 +103,43 @@ * - Fixed a bug in I830BIOSLeaveVT() which caused a bug when you * switched VT's */ +/* + * 07/2002 David Dawes + * - Add Intel(R) 855GM/852GM support. + */ +/* + * 07/2002 David Dawes + * - Cleanup code formatting. + * - Improve VESA mode selection, and fix refresh rate selection. + * - Don't duplicate functions provided in 4.2 vbe modules. + * - Don't duplicate functions provided in the vgahw module. + * - Rewrite memory allocation. + * - Rewrite initialisation and save/restore state handling. + * - Decouple the i810 support from i830 and later. + * - Remove various unnecessary hacks and workarounds. + * - Fix an 845G problem with the ring buffer not in pre-allocated + * memory. + * - Fix screen blanking. + * - Clear the screen at startup so you don't see the previous session. + * - Fix some HW cursor glitches, and turn HW cursor off at VT switch + * and exit. + * + * 08/2002 Keith Whitwell + * - Fix DRI initialisation. + */ +/* + * 08/2002 Alan Hourihane and David Dawes + * - Add XVideo support. + */ +/* + * 10/2002 David Dawes + * - Add Intel(R) 865G support. + */ + + +#ifndef PRINT_MODE_INFO +#define PRINT_MODE_INFO 0 +#endif #include "xf86.h" #include "xf86_ansic.h" @@ -104,8 +158,9 @@ #include "xf86xv.h" #include "Xv.h" #include "vbe.h" +#include "vbeModes.h" -#include "i810.h" +#include "i830.h" #ifdef XF86DRI #include "dri.h" @@ -115,2079 +170,2888 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define NB_OF(x) (sizeof (x) / sizeof (*x)) +/* *INDENT-OFF* */ static SymTabRec I830BIOSChipsets[] = { - { PCI_CHIP_I830_M, "i830"}, - { -1, NULL } + {PCI_CHIP_I830_M, "i830"}, + {PCI_CHIP_845_G, "845G"}, + {PCI_CHIP_I855_GM, "852GM/855GM"}, + {PCI_CHIP_I865_G, "865G"}, + {-1, NULL} }; static PciChipsets I830BIOSPciChipsets[] = { - { PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } + {PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA}, + {PCI_CHIP_845_G, PCI_CHIP_845_G, RES_SHARED_VGA}, + {PCI_CHIP_I855_GM, PCI_CHIP_I855_GM, RES_SHARED_VGA}, + {PCI_CHIP_I865_G, PCI_CHIP_I865_G, RES_SHARED_VGA}, + {-1, -1, RES_UNDEFINED} }; +/* + * Note: "ColorKey" is provided for compatibility with the i810 driver. + * However, the correct option name is "VideoKey". "ColorKey" usually + * refers to the tranparency key for 8+24 overlays, not for video overlays. + */ + +typedef enum { + OPTION_NOACCEL, + OPTION_SW_CURSOR, + OPTION_CACHE_LINES, + OPTION_DRI, + OPTION_PAGEFLIP, + OPTION_XVIDEO, + OPTION_VIDEO_KEY, + OPTION_COLOR_KEY, + OPTION_STRETCH, + OPTION_CENTER +} I830Opts; + static OptionInfoRec I830BIOSOptions[] = { - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, - { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE}, - { OPTION_STRETCH, "Stretch", OPTV_BOOLEAN, {0}, FALSE}, - { OPTION_CENTER, "Center", OPTV_BOOLEAN, {0}, FALSE}, - { -1, NULL, OPTV_NONE, {0}, FALSE} + {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, + {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE}, + {OPTION_PAGEFLIP, "PageFlip", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_XVIDEO, "XVideo", OPTV_BOOLEAN, {0}, TRUE}, + {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, + {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, + {OPTION_STRETCH, "Stretch", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_CENTER, "Center", OPTV_BOOLEAN, {0}, FALSE}, + {-1, NULL, OPTV_NONE, {0}, FALSE} }; +/* *INDENT-ON* */ - -static VBEInfoBlock *I830VESAGetVBEInfo(ScrnInfoPtr pScrn); -static Bool I830BIOSGetRec(ScrnInfoPtr pScrn); -static void I830BIOSFreeRec(ScrnInfoPtr pScrn); -static void SaveFonts(ScrnInfoPtr pScrn); -static void RestoreFonts(ScrnInfoPtr pScrn); -static Bool I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); static void I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, - int flags); + int PowerManagementMode, int flags); +static void I830BIOSAdjustFrame(int scrnIndex, int x, int y, int flags); +static Bool I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool I830BIOSSaveScreen(ScreenPtr pScreen, int unblack); +static Bool I830BIOSEnterVT(int scrnIndex, int flags); +static Bool I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, + VbeCRTCInfoBlock *block); + +static Bool OffsetFrame = FALSE; + + #ifdef I830DEBUG -void DPRINTF_stub (const char *filename,int line,const char *function,const char *fmt, ...) { - va_list ap; - fprintf (stderr, - "\n##############################################\n" - "*** In function %s, on line %d, in file %s ***\n", - function,line,filename); - va_start (ap,fmt); - vfprintf (stderr,fmt,ap); - va_end (ap); - fprintf (stderr, - "##############################################\n\n"); - fflush (stderr); -} -#else /* #ifdef I830DEBUG */ -void DPRINTF_stub (const char *filename,int line,const char *function,const char *fmt, ...) { - /* do nothing */ +void +I830DPRINTF_stub(const char *filename, int line, const char *function, + const char *fmt, ...) +{ + va_list ap; + + ErrorF("\n##############################################\n" + "*** In function %s, on line %d, in file %s ***\n", + function, line, filename); + va_start(ap, fmt); + VErrorF(fmt, ap); + va_end(ap); + ErrorF("##############################################\n\n"); } -#endif /* #ifdef I830DEBUG */ +#else /* #ifdef I830DEBUG */ +void +I830DPRINTF_stub(const char *filename, int line, const char *function, + const char *fmt, ...) +{ + /* do nothing */ +} +#endif /* #ifdef I830DEBUG */ +/* XXX Check if this is still needed. */ const OptionInfoRec * I830BIOSAvailableOptions(int chipid, int busid) { int i; - for(i = 0; I830BIOSPciChipsets[i].PCIid > 0; i++) { - if(chipid == I830BIOSPciChipsets[i].PCIid) return I830BIOSOptions; + for (i = 0; I830BIOSPciChipsets[i].PCIid > 0; i++) { + if (chipid == I830BIOSPciChipsets[i].PCIid) + return I830BIOSOptions; } return NULL; } -static VBEInfoBlock * -I830VESAGetVBEInfo(ScrnInfoPtr pScrn) -{ - I810Ptr pI810; - VESAPtr pVesa; - VBEInfoBlock *block = NULL; - int i, pStr, pModes; - char *str; - CARD16 major, minor, *modes; - - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; - - bzero(pVesa->block, sizeof(VBEInfoBlock)); - - pVesa->block[0] = 'V'; - pVesa->block[1] = 'B'; - pVesa->block[2] = 'E'; - pVesa->block[3] = '2'; - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f00; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); - - if(pVesa->pInt->ax != 0x4f) return NULL; - - block = xcalloc(sizeof(VBEInfoBlock), 1); - block->VESASignature[0] = pVesa->block[0]; - block->VESASignature[1] = pVesa->block[1]; - block->VESASignature[2] = pVesa->block[2]; - block->VESASignature[3] = pVesa->block[3]; - - block->VESAVersion = *(CARD16*)(pVesa->block + 4); - major = (unsigned)block->VESAVersion >> 8; - minor = block->VESAVersion & 0xff; - - pStr = *(CARD32*)(pVesa->block + 6); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OEMStringPtr = strdup(str); - - block->Capabilities[0] = pVesa->block[10]; - block->Capabilities[1] = pVesa->block[11]; - block->Capabilities[2] = pVesa->block[12]; - block->Capabilities[3] = pVesa->block[13]; - - pModes = *(CARD32*)(pVesa->block + 14); - modes = xf86int10Addr(pVesa->pInt, FARP(pModes)); - i = 0; - while(modes[i] != 0xffff) i++; - block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1); - memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); - block->VideoModePtr[i] = 0xffff; - - block->TotalMemory = *(CARD16*)(pVesa->block + 18); - - if(major < 2) memcpy(&block->OemSoftwareRev, pVesa->block + 20, 236); - else { - block->OemSoftwareRev = *(CARD16*)(pVesa->block + 20); - pStr = *(CARD32*)(pVesa->block + 22); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemVendorNamePtr = strdup(str); - pStr = *(CARD32*)(pVesa->block + 26); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemProductNamePtr = strdup(str); - pStr = *(CARD32*)(pVesa->block + 30); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemProductRevPtr = strdup(str); - memcpy(&block->Reserved, pVesa->block + 34, 222); - memcpy(&block->OemData, pVesa->block + 256, 256); - } - - return block; -} - -ModeInfoBlock * I830VESAGetModeInfo (ScrnInfoPtr pScrn,int mode) -{ - I810Ptr pI810; - VESAPtr pVesa; - ModeInfoBlock *block = NULL; - - pI810 = I810PTR (pScrn); - pVesa = pI810->vesa; - - bzero (pVesa->block,sizeof (ModeInfoBlock)); - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f01; - pVesa->pInt->cx = mode; - pVesa->pInt->es = SEG_ADDR (pVesa->page); - pVesa->pInt->di = SEG_OFF (pVesa->page); - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - if (pVesa->pInt->ax != 0x4f) return (NULL); - - block = xcalloc (sizeof (ModeInfoBlock),1); - - block->ModeAttributes = *(CARD16 *) pVesa->block; - block->WinAAttributes = pVesa->block[2]; - block->WinBAttributes = pVesa->block[3]; - block->WinGranularity = *(CARD16 *) (pVesa->block + 4); - block->WinSize = *(CARD16 *) (pVesa->block + 6); - block->WinASegment = *(CARD16 *) (pVesa->block + 8); - block->WinBSegment = *(CARD16 *) (pVesa->block + 10); - block->WinFuncPtr = *(CARD32 *) (pVesa->block + 12); - block->BytesPerScanline = *(CARD16 *) (pVesa->block + 16); - - /* mandatory information for VBE 1.2 and above */ - block->XResolution = *(CARD16 *) (pVesa->block + 18); - block->YResolution = *(CARD16 *) (pVesa->block + 20); - block->XCharSize = pVesa->block[22]; - block->YCharSize = pVesa->block[23]; - block->NumberOfPlanes = pVesa->block[24]; - block->BitsPerPixel = pVesa->block[25]; - block->NumberOfBanks = pVesa->block[26]; - block->MemoryModel = pVesa->block[27]; - block->BankSize = pVesa->block[28]; - block->NumberOfImages = pVesa->block[29]; - block->Reserved = pVesa->block[30]; - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - block->RedMaskSize = pVesa->block[31]; - block->RedFieldPosition = pVesa->block[32]; - block->GreenMaskSize = pVesa->block[33]; - block->GreenFieldPosition = pVesa->block[34]; - block->BlueMaskSize = pVesa->block[35]; - block->BlueFieldPosition = pVesa->block[36]; - block->RsvdMaskSize = pVesa->block[37]; - block->RsvdFieldPosition = pVesa->block[38]; - block->DirectColorModeInfo = pVesa->block[39]; - - /* Mandatory information for VBE 2.0 and above */ - if(pVesa->major >= 2) - { - block->PhysBasePtr = *(CARD32 *) (pVesa->block + 40); - block->Reserved32 = *(CARD32 *) (pVesa->block + 44); - block->Reserved16 = *(CARD16 *) (pVesa->block + 48); - - /* Mandatory information for VBE 3.0 and above */ - if (pVesa->major >= 3) - { - block->LinBytesPerScanLine = *(CARD16 *) (pVesa->block + 50); - block->BnkNumberOfImagePages = pVesa->block[52]; - block->LinNumberOfImagePages = pVesa->block[53]; - block->LinRedMaskSize = pVesa->block[54]; - block->LinRedFieldPosition = pVesa->block[55]; - block->LinGreenMaskSize = pVesa->block[56]; - block->LinGreenFieldPosition = pVesa->block[57]; - block->LinBlueMaskSize = pVesa->block[58]; - block->LinBlueFieldPosition = pVesa->block[59]; - block->LinRsvdMaskSize = pVesa->block[60]; - block->LinRsvdFieldPosition = pVesa->block[61]; - block->MaxPixelClock = *(CARD32 *) (pVesa->block + 62); - memcpy (&block->Reserved2,pVesa->block + 66,188); - } - else memcpy (&block->LinBytesPerScanLine,pVesa->block + 50,206); - } - else memcpy (&block->PhysBasePtr,pVesa->block + 40,216); - - return (block); -} - static Bool I830BIOSGetRec(ScrnInfoPtr pScrn) { - I810Ptr pI810; + I830Ptr pI830; - if(pScrn->driverPrivate) return TRUE; - pI810 = pScrn->driverPrivate = xnfcalloc(sizeof(I810Rec), 1); - pI810->vesa = xcalloc(sizeof(VESARec), 1); + if (pScrn->driverPrivate) + return TRUE; + pI830 = pScrn->driverPrivate = xnfcalloc(sizeof(I830Rec), 1); + pI830->vesa = xnfcalloc(sizeof(VESARec), 1); return TRUE; } static void I830BIOSFreeRec(ScrnInfoPtr pScrn) { - I810Ptr pI810; + I830Ptr pI830; VESAPtr pVesa; DisplayModePtr mode; - if(!pScrn) return; - if(!pScrn->driverPrivate) return; + if (!pScrn) + return; + if (!pScrn->driverPrivate) + return; - pI810 = I810PTR(pScrn); + pI830 = I830PTR(pScrn); mode = pScrn->modes; - pVesa = pI810->vesa; if (mode) { do { - if(mode->Private) { - ModeInfoData *data = (ModeInfoData*)mode->Private; + if (mode->Private) { + VbeModeInfoData *data = (VbeModeInfoData *) mode->Private; - if(data->block) xfree(data->block); + if (data->block) + xfree(data->block); xfree(data); mode->Private = NULL; } mode = mode->next; - } while(mode && mode != pScrn->modes); + } while (mode && mode != pScrn->modes); } - if(pVesa->monitor) xfree(pVesa->monitor); - if(pVesa->vbeInfo) xfree(pVesa->vbeInfo); - if(pVesa->pal) xfree(pVesa->pal); - if(pVesa->savedPal) xfree(pVesa->savedPal); - if(pVesa->fonts) xfree(pVesa->fonts); + if (pI830->vbeInfo) + VBEFreeVBEInfo(pI830->vbeInfo); + if (pI830->pVbe) + vbeFree(pI830->pVbe); + + pVesa = pI830->vesa; + if (pVesa->monitor) + xfree(pVesa->monitor); + if (pVesa->savedPal) + xfree(pVesa->savedPal); + xfree(pVesa); + xfree(pScrn->driverPrivate); - pScrn->driverPrivate=0; + pScrn->driverPrivate = NULL; } -void +static void I830BIOSProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; - - if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(NULL,index); - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); - } -} -void -I830VESAFreeModeInfo(ModeInfoBlock *block) -{ - xfree(block); + /* The vbe module gets loaded in PreInit(), so no need to load it here. */ + + pVbe = VBEInit(NULL, index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); } +/* Various extended video BIOS functions. */ +static const int refreshes[] = { + 43, 56, 60, 70, 72, 75, 85, 100, 120 +}; +static const int nrefreshes = sizeof(refreshes) / sizeof(refreshes[0]); + static Bool -I830DetectDisplayDevice(ScrnInfoPtr pScrn) +Check5fStatus(ScrnInfoPtr pScrn, int func, int ax) { - I810Ptr pI810; - VESAPtr pVesa; + if (ax == 0x005f) + return TRUE; + else if (ax == 0x015f) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Extended BIOS function 0x%04x failed.\n", func); + return FALSE; + } else if ((ax & 0xff) != 0x5f) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Extended BIOS function 0x%04x not supported.\n", func); + return FALSE; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Extended BIOS function 0x%04x returns 0x%04x.\n", + func, ax & 0xffff); + return FALSE; + } +} - pI810 = I810PTR (pScrn); - pVesa = pI810->vesa; +#if 0 +static int +BitToRefresh(int bits) +{ + int i; - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f64; - pVesa->pInt->bx = 0x0100; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - - if (pVesa->pInt->ax != 0x005f) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Failed to detect active display devices\n"); - return (FALSE); - } + for (i = 0; i < nrefreshes; i++) + if (bits & (1 << i)) + return refreshes[i]; + return 0; +} - pI810->configured_device = pVesa->pInt->cx; +static int +GetRefreshRate(ScrnInfoPtr pScrn, int mode, int refresh, int *availRefresh) +{ + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; -#define PIPEA_CRT_ACTIVE 0x01 -#define PIPEA_LCD_ACTIVE 0x08 - /* Anything on Pipe A? */ - if (pVesa->pInt->cx & 0xff) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Currently active displays on Pipe A:\n"); + DPRINTF(PFX, "GetRefreshRate\n"); - if (pVesa->pInt->cx & PIPEA_CRT_ACTIVE) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," CRT\n"); + /* Only 8-bit mode numbers are supported. */ + if (mode & 0x100) + return 0; + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f05; + pVbe->pInt10->bx = (mode & 0xff) | 0x100; + + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f05, pVbe->pInt10->ax)) { + if (availRefresh) + *availRefresh = pVbe->pInt10->bx; + return BitToRefresh(pVbe->pInt10->cx); + } else + return 0; +} +#endif - if (pVesa->pInt->cx & 0x02) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," TV child device\n"); +static int +SetRefreshRate(ScrnInfoPtr pScrn, int mode, int refresh) +{ + int i; + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - if (pVesa->pInt->cx & 0x04) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," DFP child device\n"); + DPRINTF(PFX, "SetRefreshRate: mode 0x%x, refresh: %d\n", mode, refresh); - if (pVesa->pInt->cx & PIPEA_LCD_ACTIVE) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," LFP (Local Flat Panel) child device\n"); + /* Only 8-bit mode numbers are supported. */ + if (mode & 0x100) + return 0; + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f05; + pVbe->pInt10->bx = mode & 0xff; + + for (i = nrefreshes - 1; i >= 0; i--) { + /* + * Look for the highest value that the requested (refresh + 2) is + * greater than or equal to. + */ + if (refreshes[i] <= (refresh + 2)) + break; + } + /* i can be 0 if the requested refresh was higher than the max. */ + if (i == 0) { + if (refresh >= refreshes[nrefreshes - 1]) + i = nrefreshes - 1; + } + DPRINTF(PFX, "Setting refresh rate to %dHz for mode 0x%02x\n", + refreshes[i], mode & 0xff); + pVbe->pInt10->cx = 1 << i; + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f05, pVbe->pInt10->ax)) + return refreshes[i]; + else + return 0; +} - if (pVesa->pInt->cx & 0xf0) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," Some unknown display devices may also be present\n"); - } +static Bool +GetModeSupport(ScrnInfoPtr pScrn, int modePipeA, int modePipeB, + int devicesPipeA, int devicesPipeB, int *maxBandwidth, + int *bandwidthPipeA, int *bandwidthPipeB) +{ + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; + + DPRINTF(PFX, "GetModeSupport: modes 0x%x, 0x%x, devices: 0x%x, 0x%x\n", + modePipeA, modePipeB, devicesPipeA, devicesPipeB); + + /* Only 8-bit mode numbers are supported. */ + if ((modePipeA & 0x100) || (modePipeB & 0x100)) + return 0; + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f28; + pVbe->pInt10->bx = (modePipeA & 0xff) | ((modePipeB & 0xff) << 8); + if ((devicesPipeA & 0x80) || (devicesPipeB & 0x80)) + pVbe->pInt10->cx = 0x8000; + else + pVbe->pInt10->cx = (devicesPipeA & 0xff) | ((devicesPipeB & 0xff) << 8); -#define PIPEB_CRT_ACTIVE 0x0100 -#define PIPEB_LCD_ACTIVE 0x0800 - /* Anything on Pipe B? */ - if (pVesa->pInt->cx & 0xff00) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Currently active displays on Pipe B:\n"); - - if (pVesa->pInt->cx & PIPEB_CRT_ACTIVE) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," CRT\n"); - - if (pVesa->pInt->cx & 0x0200) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," TV child device\n"); + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f28, pVbe->pInt10->ax)) { + if (maxBandwidth) + *maxBandwidth = pVbe->pInt10->cx; + if (bandwidthPipeA) + *bandwidthPipeA = pVbe->pInt10->dx & 0xffff; + /* XXX For XFree86 4.2.0 and earlier, ->dx is truncated to 16 bits. */ + if (bandwidthPipeB) + *bandwidthPipeB = (pVbe->pInt10->dx >> 16) & 0xffff; + return TRUE; + } else + return FALSE; +} - if (pVesa->pInt->cx & 0x0400) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," DFP child device\n"); +static int +GetLFPCompMode(ScrnInfoPtr pScrn) +{ + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - if (pVesa->pInt->cx & PIPEB_LCD_ACTIVE) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," LFP (Local Flat Panel) child device\n"); + DPRINTF(PFX, "GetLFPCompMode\n"); - if (pVesa->pInt->cx & 0xf000) - xf86DrvMsg (pScrn->scrnIndex,X_INFO," Some unknown display devices may also be present\n"); - } + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f61; + pVbe->pInt10->bx = 0x100; - return (TRUE); + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f61, pVbe->pInt10->ax)) + return pVbe->pInt10->cx & 0xffff; + else + return -1; } -static int I830DetectMemory (ScrnInfoPtr pScrn) +#if 0 +static Bool +SetLFPCompMode(ScrnInfoPtr pScrn, int compMode) { - I810Ptr pI810; - VESAPtr pVesa; - PCITAG bridge; - CARD16 gmch_ctrl; - int memsize; - - pI810 = I810PTR (pScrn); - pVesa = pI810->vesa; + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - bridge = pciTag (0,0,0); /* This is always the host bridge */ - gmch_ctrl = pciReadWord (bridge,I830_GMCH_CTRL); + DPRINTF(PFX, "SetLFPCompMode: compMode %d\n", compMode); - switch (gmch_ctrl & I830_GMCH_GMS_MASK) - { - case I830_GMCH_GMS_STOLEN_512: - memsize = KB (512); - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK stolen memory.\n",memsize / 1024); - break; - case I830_GMCH_GMS_STOLEN_1024: - memsize = MB (1); - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK stolen memory.\n",memsize / 1024); - break; - case I830_GMCH_GMS_STOLEN_8192: - memsize = MB (8); - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK stolen memory.\n",memsize / 1024); - break; - case I830_GMCH_GMS_LOCAL: - /* I'd like to use the VGA controller registers here, but MMIOBase isn't - * yet, so for now, we'll just use the BIOS instead... */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f10; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - memsize = pVesa->pInt->cx * KB (1); - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK local memory.\n",memsize / 1024); - break; - default: - /* not that this is possible, but anyway (: */ - memsize = 0; - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"no video memory detected.\n"); - } + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f61; + pVbe->pInt10->bx = 0; + pVbe->pInt10->cx = compMode; - return (memsize); + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + return Check5fStatus(pScrn, 0x5f61, pVbe->pInt10->ax); } +#endif -Bool I830BIOSPreInit (ScrnInfoPtr pScrn,int flags) +static int +GetDisplayDevices(ScrnInfoPtr pScrn) { - vgaHWPtr hwp; - I810Ptr pI810; - MessageType from; - rgb defaultWeight = { 0, 0, 0 }; - VESAPtr pVesa; - VBEInfoBlock *vbe; - DisplayModePtr pMode,tmp; - ModeInfoBlock *mode; - ModeInfoData *data = NULL; - vbeInfoPtr pVbe; - pointer pVbeModule,pDDCModule; - int mem; - int flags24; - int i = 0; + I830Ptr pI830 = I830PTR(pScrn); + vbeInfoPtr pVbe = pI830->pVbe; - if(pScrn->numEntities != 1) return (FALSE); + DPRINTF(PFX, "GetDisplayDevices\n"); - /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule (pScrn,"vgahw")) return (FALSE); - xf86LoaderReqSymLists (I810vgahwSymbols,NULL); +#if 0 + { + CARD32 temp; + ErrorF("ADPA is 0x%08x\n", INREG(ADPA)); + ErrorF("DVOA is 0x%08x\n", INREG(DVOA)); + ErrorF("DVOB is 0x%08x\n", INREG(DVOB)); + ErrorF("DVOC is 0x%08x\n", INREG(DVOC)); + ErrorF("LVDS is 0x%08x\n", INREG(LVDS)); + temp = INREG(DVOA_SRCDIM); + ErrorF("DVOA_SRCDIM is 0x%08x (%d x %d)\n", temp, + (temp >> 12) & 0xfff, temp & 0xfff); + temp = INREG(DVOB_SRCDIM); + ErrorF("DVOB_SRCDIM is 0x%08x (%d x %d)\n", temp, + (temp >> 12) & 0xfff, temp & 0xfff); + temp = INREG(DVOC_SRCDIM); + ErrorF("DVOC_SRCDIM is 0x%08x (%d x %d)\n", temp, + (temp >> 12) & 0xfff, temp & 0xfff); + ErrorF("SWF0 is 0x%08x\n", INREG(SWF0)); + ErrorF("SWF4 is 0x%08x\n", INREG(SWF4)); + } +#endif + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f64; + pVbe->pInt10->bx = 0x100; + + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) + return pVbe->pInt10->cx & 0xffff; + else + return -1; +} - /* Load int10 module */ - if (!xf86LoadSubModule (pScrn,"int10")) return (FALSE); - xf86LoaderReqSymLists (I810int10Symbols,NULL); +static Bool +SetDisplayDevices(ScrnInfoPtr pScrn, int devices) +{ + I830Ptr pI830 = I830PTR(pScrn); + vbeInfoPtr pVbe = pI830->pVbe; + CARD32 temp; - /* Allocate a vgaHWRec */ - if (!vgaHWGetHWRec (pScrn)) return (FALSE); + DPRINTF(PFX, "SetDisplayDevices: devices 0x%x\n", devices); - /* Allocate driverPrivate */ - if (!I830BIOSGetRec (pScrn)) return (FALSE); + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f64; + pVbe->pInt10->bx = 0x1; + pVbe->pInt10->cx = devices; - pI810 = I810PTR (pScrn); - pI810->pEnt = xf86GetEntityInfo (pScrn->entityList[0]); + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) + return TRUE; + else { + ErrorF("Writing config directly to SWF0\n"); + temp = INREG(SWF0); + OUTREG(SWF0, (temp & ~(0xffff)) | (devices & 0xffff)); + ErrorF("SetDisplayDevices failed. devices is 0x%x instead of 0x%x\n", + GetDisplayDevices(pScrn), devices); + return FALSE; + } +} - if (pI810->pEnt->location.type != BUS_PCI) return (FALSE); +#if 0 +static Bool +GetDevicePresence(ScrnInfoPtr pScrn, Bool *required, int *attached, + int *encoderPresent) +{ + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - if (flags & PROBE_DETECT) - { - I830BIOSProbeDDC (pScrn,pI810->pEnt->index); - return (TRUE); - } + DPRINTF(PFX, "GetDevicePresence\n"); - pI810->PciInfo = xf86GetPciInfoForEntity (pI810->pEnt->index); - pI810->PciTag = pciTag (pI810->PciInfo->bus,pI810->PciInfo->device,pI810->PciInfo->func); + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f64; + pVbe->pInt10->bx = 0x200; + + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { + if (required) + *required = ((pVbe->pInt10->bx & 0x1) == 0); + if (attached) + *attached = (pVbe->pInt10->cx >> 8) & 0xff; + if (encoderPresent) + *encoderPresent = pVbe->pInt10->cx & 0xff; + return TRUE; + } else + return FALSE; +} +#endif - if (xf86RegisterResources (pI810->pEnt->index,0,ResNone)) - return (FALSE); +static Bool +GetDisplayInfo(ScrnInfoPtr pScrn, int device, Bool *attached, Bool *present, + short *x, short *y) +{ + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; - pScrn->monitor = pScrn->confScreen->monitor; - pScrn->progClock = TRUE; - pScrn->rgbBits = 8; + DPRINTF(PFX, "GetDisplayInfo: device: 0x%x\n", device); - flags24 = Support32bppFb | PreferConvert24to32 | SupportConvert24to32; + switch (device & 0xff) { + case 0x01: + case 0x02: + case 0x04: + case 0x08: + case 0x10: + case 0x20: + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "GetDisplayInfo: invalid device: 0x%x\n", device & 0xff); + return FALSE; + } - if (!xf86SetDepthBpp (pScrn,8,8,8,flags24)) return (FALSE); - switch (pScrn->depth) - { - case 8: - case 15: - case 16: - case 24: - break; - default: - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Given depth (%d) is not supported by I830 driver\n",pScrn->depth); - return (FALSE); + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f64; + pVbe->pInt10->bx = 0x300; + pVbe->pInt10->cx = device & 0xff; + + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { + if (attached) + *attached = ((pVbe->pInt10->bx & 0x2) != 0); + if (present) + *present = ((pVbe->pInt10->bx & 0x1) != 0); + if (pVbe->pInt10->cx != (device & 0xff)) { + if (y) { + *y = pVbe->pInt10->cx & 0xffff; + } + if (x) { + *x = (pVbe->pInt10->cx >> 16) & 0xffff; } - xf86PrintDepthBpp (pScrn); + } + return TRUE; + } else + return FALSE; +} - if (!xf86SetWeight (pScrn,defaultWeight,defaultWeight)) - return (FALSE); - if (!xf86SetDefaultVisual (pScrn,-1)) - return (FALSE); +/* + * Returns a string matching the device corresponding to the first bit set + * in "device". savedDevice is then set to device with that bit cleared. + * Subsequent calls with device == -1 will use savedDevice. + */ - hwp = VGAHWPTR (pScrn); - pI810->cpp = pScrn->bitsPerPixel / 8; +static const char *displayDevices[] = { + "CRT", + "TV", + "DFP (digital flat panel)", + "LFP (local flat panel)", + "TV2 (second TV)", + "DFP2 (second digital flat panel)", + NULL +}; - /* Process the options */ - xf86CollectOptions (pScrn,NULL); - xf86ProcessOptions (pScrn->scrnIndex,pScrn->options,I830BIOSOptions); +static const char * +DeviceToString(int device) +{ + static int savedDevice = -1; + static int bit = 0; + const char *name; + + if (device == -1) { + device = savedDevice; + bit = 0; + } + + if (device == -1) + return NULL; + + while (displayDevices[bit]) { + if (device & (1 << bit)) { + name = displayDevices[bit]; + savedDevice = device & ~(1 << bit); + bit++; + return name; + } + bit++; + } + return NULL; +} - /* We have to use PIO to probe, because we haven't mapped yet */ - I810SetPIOAccess (pI810); +static void +PrintDisplayDeviceInfo(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + int pipe, n; + int displays; + + DPRINTF(PFX, "PrintDisplayDeviceInfo\n"); + + displays = pI830->configuredDevices; + if (displays == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No active display devices.\n"); + return; + } + + /* Check for active devices connected to each display pipe. */ + for (n = 0; n < pI830->availablePipes; n++) { + pipe = ((displays >> PIPE_SHIFT(n)) & PIPE_ACTIVE_MASK); + if (pipe) { + const char *name; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Currently active displays on Pipe %c:\n", PIPE_NAME(n)); + name = DeviceToString(pipe); + do { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t%s\n", name); + name = DeviceToString(-1); + } while (name); + + if (pipe & PIPE_UNKNOWN_ACTIVE) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "\tSome unknown display devices may also be present\n"); - pVesa = pI810->vesa; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No active displays on Pipe %c.\n", PIPE_NAME(n)); + } - /* Initialize Vesa record */ + if (pI830->pipeDisplaySize[n].x2 != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Lowest common panel size for pipe %c is %d x %d\n", + PIPE_NAME(n), pI830->pipeDisplaySize[n].x2, + pI830->pipeDisplaySize[n].y2); + } else if (pI830->pipeEnabled[n] && pipe & ~PIPE_CRT_ACTIVE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No display size information available for pipe %c.\n", + PIPE_NAME(n)); + } + } +} - if ((pVesa->pInt = xf86InitInt10(pI810->pEnt->index)) == NULL) - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Int10 initialization failed.\n"); - return (FALSE); - } - if ((pVesa->block = xf86Int10AllocPages (pVesa->pInt,1,&pVesa->page)) == NULL) - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Cannot allocate one scratch page in real mode memory.\n"); - return (FALSE); - } +static void +GetPipeSizes(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + int pipe, n; + DisplayType i; + + DPRINTF(PFX, "GetPipeSizes\n"); + + + for (n = 0; n < pI830->availablePipes; n++) { + pipe = (pI830->configuredDevices >> PIPE_SHIFT(n)) & PIPE_ACTIVE_MASK; + pI830->pipeDisplaySize[n].x1 = pI830->pipeDisplaySize[n].y1 = 0; + pI830->pipeDisplaySize[n].x2 = pI830->pipeDisplaySize[n].y2 = 4096; + for (i = 0; i < NumKnownDisplayTypes; i++) { + if (pipe & (1 << i) & PIPE_SIZED_DISP_MASK) { + if (pI830->displaySize[i].x2 != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Size of device %s is %d x %d\n", + displayDevices[i], + pI830->displaySize[i].x2, + pI830->displaySize[i].y2); + if (pI830->displaySize[i].x2 < pI830->pipeDisplaySize[n].x2) + pI830->pipeDisplaySize[n].x2 = pI830->displaySize[i].x2; + if (pI830->displaySize[i].y2 < pI830->pipeDisplaySize[n].y2) + pI830->pipeDisplaySize[n].y2 = pI830->displaySize[i].y2; + } + } + } - /* Set the Chipset and ChipRev, allowing config file entries to override. */ - if (pI810->pEnt->device->chipset && *pI810->pEnt->device->chipset) - { - pScrn->chipset = pI810->pEnt->device->chipset; - from = X_CONFIG; - } - else if (pI810->pEnt->device->chipID >= 0) - { - pScrn->chipset = (char *) xf86TokenToString (I830BIOSChipsets,pI810->pEnt->device->chipID); - from = X_CONFIG; - xf86DrvMsg (pScrn->scrnIndex,X_CONFIG,"ChipID override: 0x%04X\n",pI810->pEnt->device->chipID); - } - else - { - from = X_PROBED; - pScrn->chipset = (char *) xf86TokenToString (I830BIOSChipsets,pI810->PciInfo->chipType); - } + if (pI830->pipeDisplaySize[n].x2 == 4096) + pI830->pipeDisplaySize[n].x2 = 0; + if (pI830->pipeDisplaySize[n].y2 == 4096) + pI830->pipeDisplaySize[n].y2 = 0; + } +} - if (pI810->pEnt->device->chipRev >= 0) - xf86DrvMsg (pScrn->scrnIndex,X_CONFIG,"ChipRev override: %d\n",pI810->pEnt->device->chipRev); +static Bool +I830DetectDisplayDevice(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + int pipe, n; + DisplayType i; + + for (i = 0; i < NumKnownDisplayTypes; i++) { + if (GetDisplayInfo(pScrn, 1 << i, &pI830->displayAttached[i], + &pI830->displayPresent[i], + &pI830->displaySize[i].x2, + &pI830->displaySize[i].y2)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Display Info: %s: attached: %s, present: %s, size: " + "(%d,%d)\n", displayDevices[i], + BOOLTOSTRING(pI830->displayAttached[i]), + BOOLTOSTRING(pI830->displayPresent[i]), + pI830->displaySize[i].x2, pI830->displaySize[i].y2); + } + } - xf86DrvMsg (pScrn->scrnIndex,from,"Chipset: \"%s\"\n",(pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i810"); + pI830->configuredDevices = GetDisplayDevices(pScrn); + if (pI830->configuredDevices == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Failed to detect active display devices\n"); + return FALSE; + } - if (pI810->pEnt->device->MemBase != 0) - { - pI810->LinearAddr = pI810->pEnt->device->MemBase; - from = X_CONFIG; - } - else - { - if (pI810->PciInfo->memBase[1] != 0) - { - pI810->LinearAddr = pI810->PciInfo->memBase[0] & 0xFF000000; - from = X_PROBED; - } - else - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"No valid FB address in PCI config space\n"); - I830BIOSFreeRec (pScrn); - return (FALSE); - } - } + /* Check for active devices connected to each display pipe. */ + for (n = 0; n < pI830->availablePipes; n++) { + pipe = ((pI830->configuredDevices >> PIPE_SHIFT(n)) & PIPE_ACTIVE_MASK); + if (pipe) { + pI830->pipeEnabled[n] = TRUE; + } + } - xf86DrvMsg (pScrn->scrnIndex,from,"Linear framebuffer at 0x%lX\n",(unsigned long) pI810->LinearAddr); + GetPipeSizes(pScrn); + PrintDisplayDeviceInfo(pScrn); - if (pI810->pEnt->device->IOBase != 0) - { - pI810->MMIOAddr = pI810->pEnt->device->IOBase; - from = X_CONFIG; - } - else - { - if (pI810->PciInfo->memBase[1]) - { - pI810->MMIOAddr = pI810->PciInfo->memBase[1] & 0xFFF80000; - from = X_PROBED; - } - else - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"No valid MMIO address in PCI config space\n"); - I830BIOSFreeRec (pScrn); - return (FALSE); - } - } +#if 0 + /* A quick hack to change the set of enabled devices. */ + enabledDevices = PIPE_CRT_ACTIVE; + if (!SetDisplayDevices(pScrn, enabledDevices)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to switch to configured display devices\n"); + } +#endif - xf86DrvMsg (pScrn->scrnIndex,from,"IO registers at addr 0x%lX\n",(unsigned long) pI810->MMIOAddr); + return TRUE; +} - { - PCITAG bridge; - CARD16 gmch_ctrl; - - bridge = pciTag (0,0,0); /* This is always the host bridge */ - gmch_ctrl = pciReadWord (bridge,I830_GMCH_CTRL); - if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) - { - pI810->FbMapSize = 0x7000000; - pI810->DepthOffset = 0x7000000; - pI810->BackOffset = 0x7800000; - } - else - { - pI810->FbMapSize = 0x3000000; - pI810->DepthOffset = 0x3000000; - pI810->BackOffset = 0x3800000; - } - } +static int +I830DetectMemory(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + PCITAG bridge; + CARD16 gmch_ctrl; + int memsize = 0; - /* FIXME: Get rid of StolenSize/StolenOnly */ - pI810->StolenSize = I830DetectMemory (pScrn); + bridge = pciTag(0, 0, 0); /* This is always the host bridge */ + gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); - /* Default to stolen/local memory size or 8MB whichever is bigger */ - if (!pI810->pEnt->device->videoRam) - { - from = X_DEFAULT; - pScrn->videoRam = pI810->StolenSize / 1024; - if (pScrn->videoRam < 8192) pScrn->videoRam = 8192; - } - else - { - from = X_DEFAULT; - pScrn->videoRam = pI810->pEnt->device->videoRam; - } + if (IS_I85X(pI830) || IS_I865G(pI830)) + { + switch (gmch_ctrl & I830_GMCH_GMS_MASK) { + case I855_GMCH_GMS_STOLEN_1M: + memsize = MB(1) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_4M: + memsize = MB(4) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_8M: + memsize = MB(8) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_16M: + memsize = MB(16) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_32M: + memsize = MB(32) - KB(132); + break; + } + } else + { + switch (gmch_ctrl & I830_GMCH_GMS_MASK) { + case I830_GMCH_GMS_STOLEN_512: + memsize = KB(512) - KB(132); + break; + case I830_GMCH_GMS_STOLEN_1024: + memsize = MB(1) - KB(132); + break; + case I830_GMCH_GMS_STOLEN_8192: + memsize = MB(8) - KB(132); + break; + case I830_GMCH_GMS_LOCAL: + memsize = 0; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Local memory found, but won't be used.\n"); + break; + } + } + if (memsize > 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "detected %d kB stolen memory.\n", memsize / 1024); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "no video memory detected.\n"); + } + return memsize; +} - mem = I810CheckAvailableMemory (pScrn); - pI810->StolenOnly = FALSE; +static Bool +I830MapMMIO(ScrnInfoPtr pScrn) +{ + int mmioFlags; + I830Ptr pI830 = I830PTR(pScrn); - DPRINTF (PFX, - "Available memory: %dk\n" - "Requested memory: %dk (see XF86Config-4)\n", - mem,pScrn->videoRam); - - if (mem < 0) - { - xf86DrvMsg (pScrn->scrnIndex,X_WARNING, - "/dev/agpgart is either not available, or no memory " - "is available\nfor allocation. Using stolen memory only.\n"); - pScrn->videoRam = pI810->StolenSize / 1024; - pI810->StolenOnly = TRUE; - } +#if !defined(__alpha__) + mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; +#else + mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; +#endif - xf86DrvMsg (pScrn->scrnIndex,from,"Will alloc AGP framebuffer: %d kByte\n",pScrn->videoRam); + pI830->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pI830->PciTag, + pI830->MMIOAddr, I810_REG_SIZE); + if (!pI830->MMIOBase) + return FALSE; + return TRUE; +} - /* - * If the driver can do gamma correction, it should call xf86SetGamma() here. - */ +static Bool +I830MapMem(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned i; - { - Gamma zeros = { 0.0, 0.0, 0.0 }; + for (i = 2; i < pI830->FbMapSize; i <<= 1) ; + pI830->FbMapSize = i; - if (!xf86SetGamma (pScrn,zeros)) return (FALSE); - } + if (!I830MapMMIO(pScrn)) + return FALSE; - if (!I830DetectDisplayDevice (pScrn)) - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Couldn't detect display devices.\n"); - return (FALSE); - } + pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pI830->PciTag, + pI830->LinearAddr, pI830->FbMapSize); + if (!pI830->FbBase) + return FALSE; - vbe = I830VESAGetVBEInfo(pScrn); - pVesa->major = (unsigned)(vbe->VESAVersion >> 8); - pVesa->minor = vbe->VESAVersion & 0xff; - pVesa->vbeInfo = vbe; + pI830->LpRing.virtual_start = pI830->FbBase + pI830->LpRing.mem.Start; - /* Load vbe module */ - if((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) return FALSE; - xf86LoaderReqSymLists(I810vbeSymbols, NULL); - if((pVbe = VBEInit(pVesa->pInt, pVesa->pEnt->index)) == NULL) return FALSE; + return TRUE; +} - /* Load ddc module */ - if((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) return FALSE; - xf86LoaderReqSymLists(I810ddcSymbols, NULL); +static void +I830UnmapMMIO(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); - if((pVesa->monitor = vbeDoEDID(pVbe, pDDCModule)) != NULL) { - xf86PrintEDID(pVesa->monitor); - } + xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->MMIOBase, + I810_REG_SIZE); + pI830->MMIOBase = 0; +} - /* unload modules */ - xf86UnloadSubModule(pVbeModule); - xf86UnloadSubModule(pDDCModule); - /* Set display resolution */ - xf86SetDpi(pScrn, 0, 0); +static Bool +I830UnmapMem(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); -#define VIDEO_BIOS_SCRATCH 0x18 + xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->FbBase, + pI830->FbMapSize); + pI830->FbBase = 0; + I830UnmapMMIO(pScrn); + return TRUE; +} - /* Enable hot keys by writing the proper value to GR18 */ - { - CARD8 gr18; - gr18 = pI810->readControl(pI810, GRX, VIDEO_BIOS_SCRATCH); - gr18 &= ~0x80; /* Clear Hot key bit so that Video BIOS performs - * the hot key servicing */ - pI810->writeControl(pI810, GRX, VIDEO_BIOS_SCRATCH, gr18); - } - - if((pScrn->monitor->DDC = pVesa->monitor) != NULL) - xf86SetDDCproperties(pScrn, pVesa->monitor); - - /* New way of processing video modes */ - for (i = 0; i <= 0x7f; i++) - { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f28; - pVesa->pInt->bx = 0x8000 | i; - pVesa->pInt->cx = 0x8000; /* Current display device */ - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - - if(pVesa->pInt->ax != 0x005f) continue; - - if ((mode = I830VESAGetModeInfo (pScrn,i)) == NULL) continue; - - if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ - !(mode->ModeAttributes & (1 << 4)) || /* text mode */ - (pScrn->bitsPerPixel != 1 && !(mode->ModeAttributes & (1 << 3))) || /* monochrome */ - (mode->BitsPerPixel > 8 && (mode->RedMaskSize + mode->GreenMaskSize + mode->BlueMaskSize != pScrn->depth)) || - /* only linear mode, but no PhysBasePtr */ - ((mode->ModeAttributes & (1 << 6)) && (mode->ModeAttributes & (1 << 7)) && !mode->PhysBasePtr) || - ((mode->ModeAttributes & (1 << 6)) && !(mode->ModeAttributes & (1 << 7))) || mode->BitsPerPixel != pScrn->bitsPerPixel) - { - I830VESAFreeModeInfo (mode); - continue; - } - - pMode = xcalloc (sizeof (DisplayModeRec),1); - pMode->prev = pMode->next = NULL; - - pMode->status = MODE_OK; - pMode->type = M_T_DEFAULT; /*M_T_BUILTIN;*/ - - /* for adjust frame */ - pMode->HDisplay = mode->XResolution; - pMode->VDisplay = mode->YResolution; - - data = xcalloc (sizeof (ModeInfoData),1); - data->mode = i; - data->data = mode; - pMode->PrivSize = sizeof (ModeInfoData); - pMode->Private = (INT32*) data; - - if (pScrn->modePool == NULL) - { - pScrn->modePool = pMode; - pMode->next = pMode->prev = pMode; - } - else - { - tmp = pScrn->modePool; - tmp->prev = pMode; - while (tmp->next != pScrn->modePool) tmp = tmp->next; - tmp->next = pMode; - pMode->prev = tmp; - pMode->next = pScrn->modePool; - } - } +#ifndef HAVE_GET_PUT_BIOSMEMSIZE +#define HAVE_GET_PUT_BIOSMEMSIZE 1 +#endif - if (pScrn->modePool == NULL) return FALSE; +#if HAVE_GET_PUT_BIOSMEMSIZE +/* + * Tell the BIOS how much video memory is available. The BIOS call used + * here won't always be available. + */ +static Bool +PutBIOSMemSize(ScrnInfoPtr pScrn, int memSize) +{ + vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) - { - pMode = pScrn->modePool; - - do - { - DisplayModePtr next = pMode->next; - int width, height; - - if (sscanf (pScrn->display->modes[i],"%dx%d",&width,&height) == 2 && - width == pMode->HDisplay && height == pMode->VDisplay) - { - pMode->name = strdup(pScrn->display->modes[i]); - - pMode->prev->next = pMode->next; - pMode->next->prev = pMode->prev; - - if (pScrn->modes == NULL) - { - pScrn->modes = pMode; - pMode->next = pMode->prev = pMode; - } - else - { - tmp = pScrn->modes; - tmp->prev = pMode; - while (tmp->next != pScrn->modes) tmp = tmp->next; - pMode->prev = tmp; - tmp->next = pMode; - pMode->next = pScrn->modes; - } - - if (pMode == pScrn->modePool) - pScrn->modePool = next == pMode ? NULL : next; - break; - } - - pMode = next; - } - while (pMode != pScrn->modePool && pScrn->modePool != NULL); - } + DPRINTF(PFX, "PutBIOSMemSize: %d kB\n", memSize / 1024); - if (pScrn->modes == NULL) - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"No matching modes found in configuration file.\n"); - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Only the following modes are supported by the BIOS in this bpp:\n"); - pMode = pScrn->modePool; - do - { - data = (ModeInfoData *) pMode->Private; - mode = data->data; - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"%dx%d\n",mode->XResolution,mode->YResolution); - pMode = pMode->next; - } - while (pMode != pScrn->modePool); + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5f11; + pVbe->pInt10->bx = 0; + pVbe->pInt10->cx = memSize / GTT_PAGE_SIZE; - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Please choose one of these modes.\n"); + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + return Check5fStatus(pScrn, 0x5f11, pVbe->pInt10->ax); +} - return (FALSE); - } +/* + * This reports what the previous VBEGetVBEInfo() found. Be sure to call + * VBEGetVBEInfo() after changing the BIOS memory size view. If + * a separate BIOS call is added for this, it can be put here. Only + * return a valid value if the funtionality for PutBIOSMemSize() + * is available. + */ +static int +GetBIOSMemSize(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + int memSize = KB(pI830->vbeInfo->TotalMemory * 64); - tmp = pScrn->modes; - do - { - mode = ((ModeInfoData *) tmp->Private)->data; - if (mode->XResolution > pScrn->virtualX) - { - pScrn->virtualX = mode->XResolution; - pVesa->maxBytesPerScanline = mode->BytesPerScanline; - } - if (mode->YResolution > pScrn->virtualY) - pScrn->virtualY = mode->YResolution; - } - while ((tmp = tmp->next) != pScrn->modes); + DPRINTF(PFX, "GetBIOSMemSize\n"); - if (pVesa->monitor != NULL) - { - DisplayModePtr tmp; - int dotclock = 0; - float hsync,vrefresh; - - pMode = pScrn->modes; - do - { - for (tmp = pScrn->monitor->Modes; tmp != NULL; tmp = tmp->next) - if (!strcmp (pMode->name,tmp->name) && dotclock < tmp->Clock) - { -#ifdef I830DEBUG - fprintf (stderr,"##############################################\n"); - { - char flags[256]; - - *flags = '\0'; - - if (tmp->HSkew) sprintf (flags,"%s hskew %d",flags,tmp->HSkew); - if (tmp->VScan) sprintf (flags,"%s vscan %d",flags,tmp->VScan); - if (tmp->Flags & V_INTERLACE) strcat (flags," interlace"); - if (tmp->Flags & V_CSYNC) strcat (flags," composite"); - if (tmp->Flags & V_DBLSCAN) strcat (flags," doublescan"); - if (tmp->Flags & V_BCAST) strcat (flags," bcast"); - if (tmp->Flags & V_PHSYNC) strcat (flags," +hsync"); - if (tmp->Flags & V_NHSYNC) strcat (flags," -hsync"); - if (tmp->Flags & V_PVSYNC) strcat (flags," +vsync"); - if (tmp->Flags & V_NVSYNC) strcat (flags," -vsync"); - if (tmp->Flags & V_PCSYNC) strcat (flags," +csync"); - if (tmp->Flags & V_NCSYNC) strcat (flags," -csync"); - fprintf (stderr, - "Modeline \"%s\" %6.2f %d %d %d %d %d %d %d %d%s\n", - tmp->name, - tmp->Clock / 1000.0, - tmp->HDisplay,tmp->HSyncStart,tmp->HSyncEnd,tmp->HTotal, - tmp->VDisplay,tmp->VSyncStart,tmp->VSyncEnd,tmp->VTotal, - flags); - } - fprintf (stderr,"##############################################\n"); -#endif - - pMode->Clock = tmp->Clock; - pMode->HDisplay = tmp->HDisplay; - pMode->HSyncStart = tmp->HSyncStart; - pMode->HSyncEnd = tmp->HSyncEnd; - pMode->HTotal = tmp->HTotal; - pMode->HSkew = tmp->HSkew; - pMode->VDisplay = tmp->VDisplay; - pMode->VSyncStart = tmp->VSyncStart; - pMode->VSyncEnd = tmp->VSyncEnd; - pMode->VTotal = tmp->VTotal; - pMode->VScan = tmp->VScan; - pMode->Flags = tmp->Flags; - - dotclock = tmp->Clock; - } - - data->mode |= 1 << 11; /* FIXME: What is this used for? */ - - data = (ModeInfoData *) pMode->Private; - data->block = xcalloc (sizeof (CRTCInfoBlock),1); - data->block->HorizontalTotal = pMode->HTotal; - data->block->HorizontalSyncStart = pMode->HSyncStart; - data->block->HorizontalSyncEnd = pMode->HSyncEnd; - data->block->VerticalTotal = pMode->VTotal; - data->block->VerticalSyncStart = pMode->VSyncStart; - data->block->VerticalSyncEnd = pMode->VSyncEnd; - data->block->Flags = pMode->Flags; - data->block->PixelClock = pMode->Clock * 1000; - - hsync = 0; - if (pMode->HSync > 0.0) - hsync = pMode->HSync; - else if (pMode->HTotal > 0) - hsync = (float) pMode->Clock / (float) pMode->HTotal; - - vrefresh = 0; - if (pMode->VTotal > 0) vrefresh = hsync * 1000.0 / pMode->VTotal; - if (pMode->Flags & V_INTERLACE) vrefresh *= 2.0; - if (pMode->Flags & V_DBLSCAN) vrefresh /= 2.0; - if (pMode->VScan > 1) vrefresh /= pMode->VScan; - if (pMode->VRefresh > 0.0) vrefresh = pMode->VRefresh; - - pMode->HSync = hsync; - pMode->VRefresh = vrefresh; - - DPRINTF (PFX, - "pMode->HSync == %.1f KHz\n" - "pMode->VRefresh == %.1f Hz\n", - pMode->HSync, - pMode->VRefresh); - - data->block->RefreshRate = vrefresh; - - /* do some very primitive rounding to the nearest integer */ - if ((vrefresh - data->block->RefreshRate) * 10.0 >= 5.0) - data->block->RefreshRate++; - - data->block->RefreshRate *= 100; - } - while (pMode != pScrn->modes); - } + if (PutBIOSMemSize(pScrn, memSize)) + return memSize; + else + return -1; +} +#endif - DPRINTF (PFX, - "data->block->HorizontalTotal = %lu\n" - "data->block->HorizontalSyncStart = %lu\n" - "data->block->HorizontalSyncEnd = %lu\n" - "data->block->VerticalTotal = %lu\n" - "data->block->VerticalSyncStart = %lu\n" - "data->block->VerticalSyncEnd = %lu\n" - "data->block->Flags = %lu\n" - "data->block->PixelClock = %lu\n" - "data->block->RefreshRate = %lu\n", - data->block->HorizontalTotal, - data->block->HorizontalSyncStart, - data->block->HorizontalSyncEnd, - data->block->VerticalTotal, - data->block->VerticalSyncStart, - data->block->VerticalSyncEnd, - data->block->Flags, - data->block->PixelClock, - data->block->RefreshRate); +/* + * These three functions allow the video BIOS's view of the available video + * memory to be changed. This is currently implemented only for the 830 + * and 845G, which can do this via a BIOS scratch register that holds the + * BIOS's view of the (pre-reserved) memory size. If another mechanism + * is available in the future, it can be plugged in here. + * + * The mapping used for the 830/845G scratch register's low 4 bits is: + * + * 320k => 0 + * 832k => 1 + * 8000k => 8 + * + * The "unusual" values are the 512k, 1M, 8M pre-reserved memory, less + * overhead, rounded down to the BIOS-reported 64k granularity. + */ - pScrn->currentMode = pScrn->modes; +static Bool +SaveBIOSMemSize(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); -#ifdef XF86DRI - /* Need to find largest sized mode then pick the best pitch, this allows us to use tiled memory. */ - { - int maxXResolution = 0; - int calc_pitch; -#if 0 - int i,i830_pitches[] = { 512, 1024, 2048, 4096, 8192 }; -#endif + DPRINTF(PFX, "SaveBIOSMemSize\n"); - pMode = pScrn->modes; - do - { - if (pMode->HDisplay > maxXResolution) maxXResolution = pMode->HDisplay; - pMode = pMode->next; - } - while (pMode != pScrn->modes); + pI830->useSWF1 = FALSE; - calc_pitch = 0; +#if HAVE_GET_PUT_BIOSMEMSIZE + if ((pI830->saveBIOSMemSize = GetBIOSMemSize(pScrn)) != -1) + return TRUE; +#endif -/* FIXME: why isn't this working? */ -#if 0 - for (i = 0; i < NB_OF (i830_pitches); i++) - if ((maxXResolution * pI810->cpp) <= i830_pitches[i]) - { - calc_pitch = i830_pitches[i] / pI810->cpp; - break; - } -#endif - - pScrn->displayWidth = calc_pitch ? calc_pitch : pScrn->virtualX; - if (pScrn->virtualY * pScrn->displayWidth * pI810->cpp > pI810->StolenSize) - { - xf86DrvMsg (pScrn->scrnIndex,X_WARNING,"Pitch is bigger than local/stolen size. Defaulting\n\tto original display width\n"); - pScrn->displayWidth = pScrn->virtualX; - } - - DPRINTF (PFX, - "calc_pitch == %lu\n" - "pScrn->displayWidth == %lu\n" - "virtualX == %lu\n" - "virtualY == %lu\n" - "Memory needed: %lu x %lu x %lu == %luK\n", - calc_pitch, - pScrn->displayWidth, - pScrn->virtualX, - pScrn->virtualY, - pScrn->virtualY,MAX(pScrn->displayWidth,pScrn->virtualX),pI810->cpp, - (pScrn->virtualY * MAX(pScrn->displayWidth,pScrn->virtualX) * pI810->cpp) / 1024); - } -#endif /* XF86DRI */ - - if (pScrn->modes == NULL) return FALSE; - - /* Further validate the mode */ - mode = ((ModeInfoData *) pScrn->modes->Private)->data; - switch (mode->MemoryModel) - { - case 0x0: /* Text mode */ - case 0x1: /* CGA graphics */ - case 0x2: /* Hercules graphics */ - case 0x3: /* Planar */ - case 0x5: /* Non-chain 4, 256 color */ - case 0x7: /* YUV */ - xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Unsupported Memory Model: %d",mode->MemoryModel); - return FALSE; - case 0x4: /* Packed pixel */ - case 0x6: /* Direct Color */ - break; - } + if (IS_I830(pI830) || IS_845G(pI830)) { + pI830->useSWF1 = TRUE; + pI830->saveSWF1 = INREG(SWF1) & 0x0f; + + /* + * This is for sample purposes only. pI830->saveBIOSMemSize isn't used + * when pI830->useSWF1 is TRUE. + */ + switch (pI830->saveSWF1) { + case 0: + pI830->saveBIOSMemSize = KB(320); + break; + case 1: + pI830->saveBIOSMemSize = KB(832); + break; + case 8: + pI830->saveBIOSMemSize = KB(8000); + break; + default: + pI830->saveBIOSMemSize = 0; + break; + } + return TRUE; + } + return FALSE; +} - xf86PrintModes (pScrn); +static void +RestoreBIOSMemSize(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 swf1; - /* Load the required sub modules */ - if (!xf86LoadSubModule (pScrn,"fb")) - { - I830BIOSFreeRec (pScrn); - return FALSE; - } + DPRINTF(PFX, "RestoreBIOSMemSize\n"); - xf86LoaderReqSymLists(I810fbSymbols, NULL); + if (!pI830->overrideBIOSMemSize) + return; - if (!xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_NOACCEL, FALSE)) { - if (!xf86LoadSubModule(pScrn, "xaa")) { - I830BIOSFreeRec(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(I810xaaSymbols, NULL); +#if HAVE_GET_PUT_BIOSMEMSIZE + if (!pI830->useSWF1) { + PutBIOSMemSize(pScrn, pI830->saveBIOSMemSize); + return; } +#endif - if (!xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_SW_CURSOR, FALSE)) { - if (!xf86LoadSubModule(pScrn, "ramdac")) { - I830BIOSFreeRec(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(I810ramdacSymbols, NULL); + if ((IS_I830(pI830) || IS_845G(pI830)) && pI830->useSWF1) { + swf1 = INREG(SWF1); + swf1 &= ~0x0f; + swf1 |= (pI830->saveSWF1 & 0x0f); + OUTREG(SWF1, swf1); } +} - /* We wont be using the VGA access after the probe */ - { - resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, - {ResShrIoBlock,0x3C0,0x3DF}, - _END }; - resRange vgamem[] = {{ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - {ResShrMemBlock,0xB0000,0xB7FFF}, - _END }; - - I810SetMMIOAccess(pI810); - xf86SetOperatingState(vgaio, pI810->pEnt->index, ResUnusedOpr); - xf86SetOperatingState(vgamem, pI810->pEnt->index, ResDisableOpr); +static void +SetBIOSMemSize(ScrnInfoPtr pScrn, int newSize) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 swf1; + Bool mapped; + + DPRINTF(PFX, "SetBIOSMemSize: %d kB\n", newSize / 1024); + + if (!pI830->overrideBIOSMemSize) + return; + +#if HAVE_GET_PUT_BIOSMEMSIZE + if (!pI830->useSWF1) { + PutBIOSMemSize(pScrn, newSize); + return; } +#endif - return TRUE; + if ((IS_I830(pI830) || IS_845G(pI830)) && pI830->useSWF1) { + CARD32 newSWF1; + + /* Need MMIO access here. */ + mapped = (pI830->MMIOBase != NULL); + if (!mapped) + I830MapMMIO(pScrn); + + if (newSize <= KB(832)) + newSWF1 = 1; + else + newSWF1 = 8; + + swf1 = INREG(SWF1); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Before: SWF1 is 0x%08x\n", swf1); + swf1 &= ~0x0f; + swf1 |= (newSWF1 & 0x0f); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "After: SWF1 is 0x%08x\n", swf1); + OUTREG(SWF1, swf1); + if (!mapped) + I830UnmapMMIO(pScrn); + } } /* - * Just adapted from the std* functions in vgaHW.c + * Use the native method instead of the vgahw method. So far this is + * only used for 8-bit mode. + * + * XXX Look into using the 10-bit gamma correction mode for 15/16/24 bit, + * and see if a DirectColor visual can be offered. */ - static void -WriteAttr(int index, int value) +I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO * colors, VisualPtr pVisual) { - CARD8 tmp; + I830Ptr pI830; + int i, index; + unsigned char r, g, b; + CARD32 val, temp; + + DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors); + pI830 = I830PTR(pScrn); + + if (pI830->pipeEnabled[0]) { + /* It seems that an initial read is needed. */ + temp = INREG(PALETTE_A); + for (i = 0; i < numColors; i++) { + index = indices[i]; + r = colors[index].red; + g = colors[index].green; + b = colors[index].blue; + val = (r << 16) | (g << 8) | b; + OUTREG(PALETTE_A + index * 4, val); + } + } + if (pI830->pipeEnabled[1]) { + /* It seems that an initial read is needed. */ + temp = INREG(PALETTE_B); + for (i = 0; i < numColors; i++) { + index = indices[i]; + r = colors[index].red; + g = colors[index].green; + b = colors[index].blue; + val = (r << 16) | (g << 8) | b; + OUTREG(PALETTE_B + index * 4, val); + } + } +} - tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); +static void +PreInitCleanup(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); - index |= 0x20; - outb(VGA_ATTR_INDEX, index); - outb(VGA_ATTR_DATA_W, value); + RestoreBIOSMemSize(pScrn); + if (pI830->swfSaved) { + OUTREG(SWF0, pI830->saveSWF0); + OUTREG(SWF4, pI830->saveSWF4); + } + if (pI830->MMIOBase) + I830UnmapMMIO(pScrn); + I830BIOSFreeRec(pScrn); } -static int -ReadAttr(int index) +static Bool +I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) { - CARD8 tmp; + vgaHWPtr hwp; + I830Ptr pI830; + MessageType from; + rgb defaultWeight = { 0, 0, 0 }; + vbeInfoPtr pVbe; + EntityInfoPtr pEnt; + int mem, memsize; + int flags24; + int i, n; + pointer pDDCModule, pVBEModule; + Bool enable; + const char *chipname; - tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + if (pScrn->numEntities != 1) + return FALSE; - index |= 0x20; - outb(VGA_ATTR_INDEX, index); - return (inb(VGA_ATTR_DATA_R)); -} + /* Load int10 module */ + if (!xf86LoadSubModule(pScrn, "int10")) + return FALSE; + xf86LoaderReqSymLists(I810int10Symbols, NULL); + + /* Load vbe module */ + if (!(pVBEModule = xf86LoadSubModule(pScrn, "vbe"))) + return FALSE; + xf86LoaderReqSymLists(I810vbeSymbols, NULL); -#define WriteMiscOut(value) outb(VGA_MISC_OUT_W, value) -#define ReadMiscOut() inb(VGA_MISC_OUT_R) -#define WriteSeq(index, value) outb(VGA_SEQ_INDEX, index);\ - outb(VGA_SEQ_DATA, value) + pEnt = xf86GetEntityInfo(pScrn->entityList[0]); -static int -ReadSeq(int index) -{ - outb(VGA_SEQ_INDEX, index); + if (flags & PROBE_DETECT) { + I830BIOSProbeDDC(pScrn, pEnt->index); + return TRUE; + } - return (inb(VGA_SEQ_DATA)); -} + /* The vgahw module should be loaded here when needed */ + if (!xf86LoadSubModule(pScrn, "vgahw")) + return FALSE; + xf86LoaderReqSymLists(I810vgahwSymbols, NULL); -#define WriteGr(index, value) outb(VGA_GRAPH_INDEX, index);\ - outb(VGA_GRAPH_DATA, value) -static int -ReadGr(int index) -{ - outb(VGA_GRAPH_INDEX, index); - return (inb(VGA_GRAPH_DATA)); -} + /* Allocate a vgaHWRec */ + if (!vgaHWGetHWRec(pScrn)) + return FALSE; -static void -SeqReset(Bool start) -{ - if(start) { - WriteSeq(0x00, 0x01); /* Synchronous Reset */ - } else { - WriteSeq(0x00, 0x03); /* End Reset */ + /* Allocate driverPrivate */ + if (!I830BIOSGetRec(pScrn)) + return FALSE; + + pI830 = I830PTR(pScrn); + pI830->pEnt = pEnt; + + if (pI830->pEnt->location.type != BUS_PCI) + return FALSE; + + pI830->PciInfo = xf86GetPciInfoForEntity(pI830->pEnt->index); + pI830->PciTag = pciTag(pI830->PciInfo->bus, pI830->PciInfo->device, + pI830->PciInfo->func); + + if (xf86RegisterResources(pI830->pEnt->index, 0, ResNone)) { + PreInitCleanup(pScrn); + return FALSE; + } -} -static void -SaveFonts(ScrnInfoPtr pScrn) -{ - I810Ptr pI810; - VESAPtr pVesa; - unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4, scrn; + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; + pScrn->monitor = pScrn->confScreen->monitor; + pScrn->progClock = TRUE; + pScrn->rgbBits = 8; - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; + flags24 = Support32bppFb | PreferConvert24to32 | SupportConvert24to32; - if(pVesa->fonts != NULL) return; + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) + return FALSE; - /* If in graphics mode, don't save anything */ - attr10 = ReadAttr(0x10); - if(attr10 & 0x01) return; - - pVesa->fonts = xalloc(16384); - - /* save the registers that are needed here */ - miscOut = ReadMiscOut(); - gr4 = ReadGr(0x04); - gr5 = ReadGr(0x05); - gr6 = ReadGr(0x06); - seq2 = ReadSeq(0x02); - seq4 = ReadSeq(0x04); - - /* Force into colour mode */ - WriteMiscOut(miscOut | 0x01); - - scrn = ReadSeq(0x01) | 0x20; - SeqReset(TRUE); - WriteSeq(0x01, scrn); - SeqReset(FALSE); - - WriteAttr(0x10, 0x01); /* graphics mode */ - - /*font1 */ - WriteSeq(0x02, 0x04); /* write to plane 2 */ - WriteSeq(0x04, 0x06); /* enable plane graphics */ - WriteGr(0x04, 0x02); /* read plane 2 */ - WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ - WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts, 8192); - - /* font2 */ - WriteSeq(0x02, 0x08); /* write to plane 3 */ - WriteSeq(0x04, 0x06); /* enable plane graphics */ - WriteGr(0x04, 0x03); /* read plane 3 */ - WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ - WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts + 8192, 8192); - - scrn = ReadSeq(0x01) & ~0x20; - SeqReset(TRUE); - WriteSeq(0x01, scrn); - SeqReset(FALSE); - - /* Restore clobbered registers */ - WriteAttr(0x10, attr10); - WriteSeq(0x02, seq2); - WriteSeq(0x04, seq4); - WriteGr(0x04, gr4); - WriteGr(0x05, gr5); - WriteGr(0x06, gr6); - WriteMiscOut(miscOut); -} + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by I830 driver\n", + pScrn->depth); + return FALSE; + } + xf86PrintDepthBpp(pScrn); -static void -RestoreFonts(ScrnInfoPtr pScrn) -{ - I810Ptr pI810; - VESAPtr pVesa; - unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4, scrn; + if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) + return FALSE; + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; + hwp = VGAHWPTR(pScrn); + pI830->cpp = pScrn->bitsPerPixel / 8; - if(pVesa->fonts == NULL) return; + /* Process the options */ + xf86CollectOptions(pScrn, NULL); + if (!(pI830->Options = xalloc(sizeof(I830BIOSOptions)))) + return FALSE; + memcpy(pI830->Options, I830BIOSOptions, sizeof(I830BIOSOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI830->Options); - /* save the registers that are needed here */ - miscOut = ReadMiscOut(); - attr10 = ReadAttr(0x10); - gr1 = ReadGr(0x01); - gr3 = ReadGr(0x03); - gr4 = ReadGr(0x04); - gr5 = ReadGr(0x05); - gr6 = ReadGr(0x06); - gr8 = ReadGr(0x08); - seq2 = ReadSeq(0x02); - seq4 = ReadSeq(0x04); - - /* Force into colour mode */ - WriteMiscOut(miscOut | 0x01); - - scrn = ReadSeq(0x01) | 0x20; - SeqReset(TRUE); - WriteSeq(0x01, scrn); - SeqReset(FALSE); - - WriteAttr(0x10, 0x01); /* graphics mode */ - - WriteSeq(0x02, 0x04); /* write to plane 2 */ - WriteSeq(0x04, 0x06); /* enable plane graphics */ - WriteGr(0x04, 0x02); /* read plane 2 */ - WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ - WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_tobus(pVesa->fonts, pVesa->VGAbase, 8192); - - WriteSeq(0x02, 0x08); /* write to plane 3 */ - WriteSeq(0x04, 0x06); /* enable plane graphics */ - WriteGr(0x04, 0x03); /* read plane 3 */ - WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ - WriteGr(0x06, 0x05); /* set graphics */ - slowbcopy_tobus(pVesa->fonts + 8192, pVesa->VGAbase, 8192); - - scrn = ReadSeq(0x01) & ~0x20; - SeqReset(TRUE); - WriteSeq(0x01, scrn); - SeqReset(FALSE); - - /* restore the registers that were changed */ - WriteMiscOut(miscOut); - WriteAttr(0x10, attr10); - WriteGr(0x01, gr1); - WriteGr(0x03, gr3); - WriteGr(0x04, gr4); - WriteGr(0x05, gr5); - WriteGr(0x06, gr6); - WriteGr(0x08, gr8); - WriteSeq(0x02, seq2); - WriteSeq(0x04, seq4); -} + /* We have to use PIO to probe, because we haven't mapped yet. */ + I830SetPIOAccess(pI830); -/* End font code */ + /* Initialize VBE record */ + if ((pI830->pVbe = VBEInit(NULL, pI830->pEnt->index)) == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VBE initialization failed.\n"); + return FALSE; + } -void -I830BIOSSaveRegisters(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - I830RegPtr i830Reg = &pI810->i830_SavedReg; - int i; + switch (pI830->PciInfo->chipType) { + case PCI_CHIP_I830_M: + chipname = "830M"; + break; + case PCI_CHIP_845_G: + chipname = "845G"; + break; + case PCI_CHIP_I855_GM: + /* Check capid register to find the chipset variant */ + pI830->variant = (pciReadLong(pI830->PciTag, I85X_CAPID) + >> I85X_VARIANT_SHIFT) & I85X_VARIANT_MASK; + switch (pI830->variant) { + case I855_GM: + chipname = "855GM"; + break; + case I855_GME: + chipname = "855GME"; + break; + case I852_GM: + chipname = "852GM"; + break; + case I852_GME: + chipname = "852GME"; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Unknown 852GM/855GM variant: 0x%x)\n", pI830->variant); + chipname = "852GM/855GM (unknown variant)"; + break; + } + break; + case PCI_CHIP_I865_G: + chipname = "865G"; + break; + default: + chipname = "unknown chipset"; + break; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Integrated Graphics Chipset: Intel(R) %s\n", chipname); + + pVbe = pI830->pVbe; + + pI830->vbeInfo = VBEGetVBEInfo(pVbe); - for (i = 0 ; i < 8 ; i++) - i830Reg->Fence[i] = INREG(FENCE+i*4); + /* Set the Chipset and ChipRev, allowing config file entries to override. */ + if (pI830->pEnt->device->chipset && *pI830->pEnt->device->chipset) { + pScrn->chipset = pI830->pEnt->device->chipset; + from = X_CONFIG; + } else if (pI830->pEnt->device->chipID >= 0) { + pScrn->chipset = (char *)xf86TokenToString(I830BIOSChipsets, + pI830->pEnt->device->chipID); + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", + pI830->pEnt->device->chipID); + } else { + from = X_PROBED; + pScrn->chipset = (char *)xf86TokenToString(I830BIOSChipsets, + pI830->PciInfo->chipType); + } + + if (pI830->pEnt->device->chipRev >= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", + pI830->pEnt->device->chipRev); + } - i830Reg->LprbTail = INREG(LP_RING + RING_TAIL); - i830Reg->LprbHead = INREG(LP_RING + RING_HEAD); - i830Reg->LprbStart = INREG(LP_RING + RING_START); - i830Reg->LprbLen = INREG(LP_RING + RING_LEN); + xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", + (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i8xx"); - if ((i830Reg->LprbTail & TAIL_ADDR) != (i830Reg->LprbHead & HEAD_ADDR) && - i830Reg->LprbLen & RING_VALID) { - I810PrintErrorState( pScrn ); - FatalError( "Active ring not flushed\n"); + if (pI830->pEnt->device->MemBase != 0) { + pI830->LinearAddr = pI830->pEnt->device->MemBase; + from = X_CONFIG; + } else { + if (pI830->PciInfo->memBase[1] != 0) { + /* XXX Check mask. */ + pI830->LinearAddr = pI830->PciInfo->memBase[0] & 0xFF000000; + from = X_PROBED; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid FB address in PCI config space\n"); + PreInitCleanup(pScrn); + return FALSE; + } } -} -static void I830SetRingRegisters(ScrnInfoPtr pScrn, I830RegPtr i830Reg) -{ - I810Ptr pI810 = I810PTR(pScrn); - unsigned int temp; + xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", + (unsigned long)pI830->LinearAddr); + + if (pI830->pEnt->device->IOBase != 0) { + pI830->MMIOAddr = pI830->pEnt->device->IOBase; + from = X_CONFIG; + } else { + if (pI830->PciInfo->memBase[1]) { + pI830->MMIOAddr = pI830->PciInfo->memBase[1] & 0xFFF80000; + from = X_PROBED; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid MMIO address in PCI config space\n"); + PreInitCleanup(pScrn); + return FALSE; + } + } + + xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n", + (unsigned long)pI830->MMIOAddr); + + /* Some of the probing needs MMIO access, so map it here. */ + I830MapMMIO(pScrn); - /* First disable the ring buffer (Need to wait for empty first?, if so - * should probably do it before entering this section) +#if 1 + pI830->saveSWF0 = INREG(SWF0); + pI830->saveSWF4 = INREG(SWF4); + pI830->swfSaved = TRUE; + + /* Set "extended desktop" */ + OUTREG(SWF0, pI830->saveSWF0 | (1 << 21)); + + /* Set "driver loaded", "OS unknown", "APM 1.2" */ + OUTREG(SWF4, (pI830->saveSWF4 & ~((3 << 19) | (7 << 16))) | + (1 << 23) | (2 << 16)); +#endif + + if (IS_I830(pI830) || IS_845G(pI830)) { + PCITAG bridge; + CARD16 gmch_ctrl; + + bridge = pciTag(0, 0, 0); /* This is always the host bridge */ + gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); + if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { + pI830->FbMapSize = 0x8000000; + } else { + pI830->FbMapSize = 0x4000000; + } + } + else { + /* 128MB aperture for later chips */ + pI830->FbMapSize = 0x8000000; + } + + /* + * Get the pre-allocated (stolen) memory size. */ - temp = INREG(LP_RING + RING_LEN); - temp &= ~RING_VALID_MASK; - OUTREG(LP_RING + RING_LEN, temp ); + pI830->StolenMemory.Size = I830DetectMemory(pScrn); + pI830->StolenMemory.Start = 0; + pI830->StolenMemory.End = pI830->StolenMemory.Size; + + /* Sanity check: compare with what the BIOS thinks. */ + if (pI830->vbeInfo->TotalMemory != pI830->StolenMemory.Size / 1024 / 64) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Detected stolen memory (%d kB) doesn't match what the BIOS" + " reports (%d kB)\n", + ROUND_DOWN_TO(pI830->StolenMemory.Size / 1024, 64), + pI830->vbeInfo->TotalMemory * 64); + } + + /* Find the maximum amount of agpgart memory available. */ + mem = I830CheckAvailableMemory(pScrn); + pI830->StolenOnly = FALSE; + + if (mem <= 0) { + if (pI830->StolenMemory.Size <= 0) { + /* Shouldn't happen. */ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "/dev/agpgart is either not available, or no memory " + "is available\nfor allocation, " + "and no pre-allocated memory is available.\n"); + PreInitCleanup(pScrn); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "/dev/agpgart is either not available, or no memory " + "is available\nfor allocation. " + "Using pre-allocated memory only.\n"); + mem = 0; + pI830->StolenOnly = TRUE; + } + + if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) { + pI830->noAccel = TRUE; + } + if (xf86ReturnOptValBool(pI830->Options, OPTION_SW_CURSOR, FALSE)) { + pI830->SWCursor = TRUE; + } - /* Set up the low priority ring buffer. + pI830->directRenderingDisabled = + !xf86ReturnOptValBool(pI830->Options, OPTION_DRI, TRUE); + +#ifdef XF86DRI + if (!pI830->directRenderingDisabled) { + if (pI830->noAccel || pI830->SWCursor) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it " + "needs HW cursor and 2D acceleration.\n"); + pI830->directRenderingDisabled = TRUE; + } else if (pScrn->depth != 16 && pScrn->depth != 24) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it " + "runs only at depths 16 and 24.\n"); + pI830->directRenderingDisabled = TRUE; + } + } +#endif + + /* + * The "VideoRam" config file parameter specifies the total amount of + * memory that will be used/allocated. When agpgart support isn't + * available (StolenOnly == TRUE), this is limited to the amount of + * pre-allocated ("stolen") memory. */ - OUTREG(LP_RING + RING_TAIL, 0 ); - OUTREG(LP_RING + RING_HEAD, 0 ); - pI810->LpRing.head = 0; - pI810->LpRing.tail = 0; + /* + * Default to I830_DEFAULT_VIDEOMEM_2D (8192KB) for 2D-only, + * or I830_DEFAULT_VIDEOMEM_3D (32768KB) for 3D. If the stolen memory + * amount is higher, default to it rounded up to the nearest MB. This + * guarantees that by default there will be at least some run-time + * space for things that need a physical address. + */ + if (!pI830->pEnt->device->videoRam) { + from = X_DEFAULT; +#ifdef XF86DRI + if (!pI830->directRenderingDisabled) + pScrn->videoRam = I830_DEFAULT_VIDEOMEM_3D; + else +#endif + pScrn->videoRam = I830_DEFAULT_VIDEOMEM_2D; + if (pI830->StolenMemory.Size / 1024 > pScrn->videoRam) + pScrn->videoRam = ROUND_TO(pI830->StolenMemory.Size / 1024, 1024); + } else { + from = X_CONFIG; + pScrn->videoRam = pI830->pEnt->device->videoRam; + } - temp = INREG(LP_RING + RING_START); - temp &= ~(START_ADDR); - temp |= i830Reg->LprbStart; - OUTREG(LP_RING + RING_START, temp ); + DPRINTF(PFX, + "Available memory: %dk\n" + "Requested memory: %dk\n", mem, pScrn->videoRam); + + + if (mem + (pI830->StolenMemory.Size / 1024) < pScrn->videoRam) { + pScrn->videoRam = mem + (pI830->StolenMemory.Size / 1024); + from = X_PROBED; + if (mem + (pI830->StolenMemory.Size / 1024) < + pI830->pEnt->device->videoRam) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "VideoRAM reduced to %d kByte " + "(limited to available sysmem)\n", pScrn->videoRam); + } + } - temp = INREG(LP_RING + RING_LEN); - temp &= ~(I830_RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); - temp |= i830Reg->LprbLen; - OUTREG(LP_RING + RING_LEN, temp ); -} + if (pScrn->videoRam > pI830->FbMapSize / 1024) { + pScrn->videoRam = pI830->FbMapSize / 1024; + if (pI830->FbMapSize / 1024 < pI830->pEnt->device->videoRam) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "VideoRam reduced to %d kByte (limited to aperture size)\n", + pScrn->videoRam); + } + + if (mem > 0) { + /* + * If the reserved (BIOS accessible) memory is less than the desired + * amount, try to increase it. So far this is only implemented for + * the 845G and 830, but those details are handled in SetBIOSMemSize(). + * + * The BIOS-accessible amount is only important for setting video + * modes. The maximum amount we try to set is limited to what would + * be enough for 1920x1440 with a 2048 pitch. + * + * If ALLOCATE_ALL_BIOSMEM is enabled in i830_memory.c, all of the + * BIOS-aware memory will get allocated. If it isn't then it may + * not be, and in that case there is an assumption that the video + * BIOS won't attempt to access memory beyond what is needed for + * modes that are actually used. ALLOCATE_ALL_BIOSMEM is enabled by + * default. + */ + + /* Try to keep HW cursor and Overlay amounts separate from this. */ + int reserve = (HWCURSOR_SIZE + OVERLAY_SIZE) / 1024; + + if (pScrn->videoRam - reserve >= I830_MAXIMUM_VBIOS_MEM) + pI830->newBIOSMemSize = KB(I830_MAXIMUM_VBIOS_MEM); + else + pI830->newBIOSMemSize = + KB(ROUND_DOWN_TO(pScrn->videoRam - reserve, 64)); + + if (pI830->vbeInfo->TotalMemory * 64 < pI830->newBIOSMemSize / 1024) { + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Will attempt to tell the BIOS that there is " + "%d kB VideoRAM\n", pI830->newBIOSMemSize / 1024); + + if (SaveBIOSMemSize(pScrn)) { + pI830->overrideBIOSMemSize = TRUE; + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + + VBEFreeVBEInfo(pI830->vbeInfo); + vbeFree(pI830->pVbe); + pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); + pVbe = pI830->pVbe; + pI830->vbeInfo = VBEGetVBEInfo(pVbe); + + pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "BIOS now sees %d kB VideoRAM\n", + pI830->BIOSMemorySize / 1024); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "BIOS view of memory size can't be changed " + "(this is not an error).\n"); + } + } + } -static void I830SetFenceRegisters(ScrnInfoPtr pScrn, I830RegPtr i830Reg) -{ - I810Ptr pI810 = I810PTR(pScrn); - int i; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pre-allocated VideoRAM: %d kByte\n", + pI830->StolenMemory.Size / 1024); + xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam); + pI830->TotalVideoRam = KB(pScrn->videoRam); - for (i = 0 ; i < 8 ; i++) { - OUTREG( FENCE+i*4, i830Reg->Fence[i] ); - if (I810_DEBUG & DEBUG_VERBOSE_VGA) - ErrorF("Fence Register : %x\n", i830Reg->Fence[i]); + /* + * If the requested videoRam amount is less than the stolen memory size, + * reduce the stolen memory size accordingly. + */ + if (pI830->StolenMemory.Size > pI830->TotalVideoRam) { + pI830->StolenMemory.Size = pI830->TotalVideoRam; + pI830->StolenMemory.End = pI830->TotalVideoRam; } -} -void -I830BIOSSetRegisters(ScrnInfoPtr pScrn, int mode) -{ - I810Ptr pI810 = I810PTR(pScrn); - I830RegPtr i830Reg; + if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES, + &(pI830->CacheLines))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n", + pI830->CacheLines); + } else { + pI830->CacheLines = -1; + } + + pI830->XvDisabled = + !xf86ReturnOptValBool(pI830->Options, OPTION_XVIDEO, TRUE); - if(mode == SET_SAVED_MODE) { - i830Reg = &pI810->i830_SavedReg; +#ifdef I830_XV + if (xf86GetOptValInteger(pI830->Options, OPTION_VIDEO_KEY, + &(pI830->colorKey))) { + from = X_CONFIG; + } else if (xf86GetOptValInteger(pI830->Options, OPTION_COLOR_KEY, + &(pI830->colorKey))) { + from = X_CONFIG; } else { - i830Reg = &pI810->i830_ModeReg; + pI830->colorKey = (1 << pScrn->offset.red) | + (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << + pScrn->offset.blue); + from = X_DEFAULT; } + xf86DrvMsg(pScrn->scrnIndex, from, "video overlay key set to 0x%x\n", + pI830->colorKey); +#endif - I830SetRingRegisters(pScrn, i830Reg); - I830SetFenceRegisters(pScrn, i830Reg); -} + pI830->allowPageFlip = FALSE; + enable = xf86ReturnOptValBool(pI830->Options, OPTION_PAGEFLIP, FALSE); +#ifdef XF86DRI + if (!pI830->directRenderingDisabled) { + pI830->allowPageFlip = enable; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "page flipping %s\n", + enable ? "enabled" : "disabled"); + } +#endif -Bool -I830VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode) -{ - I810Ptr pI810; - VESAPtr pVesa; + /* Check if the HW cursor needs physical address. */ + if (IS_MOBILE(pI830)) + pI830->CursorNeedsPhysical = TRUE; + else + pI830->CursorNeedsPhysical = FALSE; + + /* Force ring buffer to be in low memory for the 845G. */ + if (IS_845G(pI830)) + pI830->NeedRingBufferLow = TRUE; + + /* + * XXX If we knew the pre-initialised GTT format for certain, we could + * probably figure out the physical address even in the StolenOnly case. + */ + if (pI830->StolenOnly && pI830->CursorNeedsPhysical && !pI830->SWCursor) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "HW Cursor disabled because it needs agpgart memory.\n"); + pI830->SWCursor = TRUE; + } - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; + /* + * Reduce the maximum videoram available for video modes by the ring buffer, + * minimum scratch space and HW cursor amounts. + */ + if (!pI830->SWCursor) + pScrn->videoRam -= (HWCURSOR_SIZE / 1024); + if (!pI830->XvDisabled) + pScrn->videoRam -= (OVERLAY_SIZE / 1024); + if (!pI830->noAccel) { + pScrn->videoRam -= (PRIMARY_RINGBUFFER_SIZE / 1024); + pScrn->videoRam -= (MIN_SCRATCH_BUFFER_SIZE / 1024); + } - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f03; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Maximum frambuffer space: %d kByte\n", pScrn->videoRam); - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); + /* + * If the driver can do gamma correction, it should call xf86SetGamma() here. + */ - if (pVesa->pInt->ax == 0x4f) { - *mode = pVesa->pInt->bx; + { + Gamma zeros = { 0.0, 0.0, 0.0 }; - return TRUE; + if (!xf86SetGamma(pScrn, zeros)) + return FALSE; } - return FALSE; -} + if (IS_MOBILE(pI830)) + pI830->availablePipes = 2; + else + pI830->availablePipes = 1; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%d display pipe%s available.\n", + pI830->availablePipes, pI830->availablePipes > 1 ? "s" : ""); -/* At the moment some of the BIOS vesa mode sets doesn't seem to work, so - * we set those modes using the legacy BIOS calls */ -Bool I830VESASetVBEMode (ScrnInfoPtr pScrn,int mode,CRTCInfoBlock *block) -{ - I810Ptr pI810; - VESAPtr pVesa; + if (!I830DetectDisplayDevice(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Couldn't detect display devices.\n"); + PreInitCleanup(pScrn); + return FALSE; + } - pI810 = I810PTR (pScrn); - pVesa = pI810->vesa; + if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) { + PreInitCleanup(pScrn); + return FALSE; + } - DPRINTF(PFX,"Setting mode 0x%.8x\n",mode); + if ((pI830->vesa->monitor = vbeDoEDID(pVbe, pDDCModule)) != NULL) { + xf86PrintEDID(pI830->vesa->monitor); + } + if ((pScrn->monitor->DDC = pI830->vesa->monitor) != NULL) + xf86SetDDCproperties(pScrn, pI830->vesa->monitor); + xf86UnloadSubModule(pDDCModule); - pVesa->pInt->num = 0x10; - switch (mode) - { - case 0x0118: - pVesa->pInt->ax = 0x0054; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - return (TRUE); - case 0x011a: - pVesa->pInt->ax = 0x0049; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - return (TRUE); - case 0x4003: - case 0x03: - pVesa->pInt->ax = 0x0003; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - return (TRUE); - default: - pVesa->pInt->ax = 0x4f02; - pVesa->pInt->bx = mode & ~(1 << 11); -/* This doesn't work. The BIOS is f**cked */ -#if 0 - if (block != NULL) - { - pVesa->pInt->bx |= 1 << 11; - memcpy (pVesa->block,block,sizeof (CRTCInfoBlock)); - pVesa->pInt->es = SEG_ADDR (pVesa->page); - pVesa->pInt->di = SEG_OFF (pVesa->page); - } + /* XXX Move this to a header. */ +#define VIDEO_BIOS_SCRATCH 0x18 + +#if 1 + /* + * XXX This should be in ScreenInit/EnterVT. PreInit should not leave the + * state changed. + */ + /* Enable hot keys by writing the proper value to GR18 */ + { + CARD8 gr18; + + gr18 = pI830->readControl(pI830, GRX, VIDEO_BIOS_SCRATCH); + gr18 &= ~0x80; /* + * Clear Hot key bit so that Video + * BIOS performs the hot key + * servicing + */ + pI830->writeControl(pI830, GRX, VIDEO_BIOS_SCRATCH, gr18); + } #endif - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - return (pVesa->pInt->ax == 0x004f); - } -} -Bool I830VESASaveRestore (ScrnInfoPtr pScrn,int function) -{ - I810Ptr pI810; - VESAPtr pVesa; + for (i = 0; i < pI830->availablePipes; i++) { + int pipe = + (pI830->configuredDevices >> PIPE_SHIFT(i)) & PIPE_ACTIVE_MASK; + if (pipe & ~PIPE_CRT_ACTIVE) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "A non-CRT device is attached to pipe %c.\n" + "\tNo refresh rate overrides will be attempted.\n", + PIPE_NAME(i)); + pI830->vesa->useDefaultRefresh = TRUE; + } + /* + * Some desktop platforms might not have 0x5f05, so useExtendedRefresh + * would need to be set to FALSE for those cases. + */ + if (!pI830->vesa->useDefaultRefresh) + pI830->useExtendedRefresh = TRUE; + } - pI810 = I810PTR (pScrn); - pVesa = pI810->vesa; + if (pI830->useExtendedRefresh) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Will use BIOS call 0x5f05 to set refresh rates for CRTs.\n"); + } - if(MODE_QUERY < 0 || function > MODE_RESTORE) return (FALSE); + /* + * Calling 0x5f64 can reset the refresh rate, so only do this when + * using 0x5f05, or when not overriding the default refresh rate. + * Also, 0x5f64 doesn't work correctly in i830 platforms. + */ + pI830->enableDisplays = !IS_I830(pI830) && pI830->useExtendedRefresh; - /* Insure that if the Ring is active we are Synced */ + if (pI830->enableDisplays) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Will use BIOS call 0x5f64 to enable displays.\n"); + } -#if 0 - if(pI810->AccelInfoRec != NULL) - { - I810RefreshRing (pScrn); - I810Sync (pScrn); - } + /* + * Limit videoram available for mode selection to what the video + * BIOS can see. + */ + if (pScrn->videoRam > (pI830->vbeInfo->TotalMemory * 64)) + memsize = pI830->vbeInfo->TotalMemory * 64; + else + memsize = pScrn->videoRam; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Maximum space available for video modes: %d kByte\n", memsize); + + /* + * Note: VBE modes (> 0x7f) won't work with Intel's extended BIOS + * functions. For that reason it's important to set only + * V_MODETYPE_VGA in the flags for VBEGetModePool(). + */ + pScrn->modePool = VBEGetModePool(pScrn, pVbe, pI830->vbeInfo, + V_MODETYPE_VGA); + + if (!pScrn->modePool) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No Video BIOS modes for chosen depth.\n"); + PreInitCleanup(pScrn); + return FALSE; + } + + VBESetModeNames(pScrn->modePool); + + /* + * XXX DDC information: There's code in xf86ValidateModes + * (VBEValidateModes) to set monitor defaults based on DDC information + * where available. If we need something that does better than this, + * there's code in vesa/vesa.c. + */ + + /* XXX Need to get relevant modes and virtual parameters. */ + /* Do the mode validation without regard to special scanline pitches. */ + n = VBEValidateModes(pScrn, NULL, pScrn->display->modes, NULL, + NULL, 0, MAX_DISPLAY_PITCH, 1, + 0, MAX_DISPLAY_HEIGHT, + pScrn->display->virtualX, + pScrn->display->virtualY, + memsize, LOOKUP_BEST_REFRESH); + if (n <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); + PreInitCleanup(pScrn); + return FALSE; + } + + xf86PruneDriverModes(pScrn); + + pScrn->currentMode = pScrn->modes; + + if (pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n"); + PreInitCleanup(pScrn); + return FALSE; + } + +#ifndef USE_PITCHES +#define USE_PITCHES 1 #endif - /* FIXME: Workaround for 1600x1200 mode set problem */ -#if 1 - if (function == MODE_RESTORE) { - int thisMode; - I830VESAGetVBEMode (pScrn,&thisMode); - - DPRINTF (PFX,"Current mode: 0x%.8x\n",thisMode); - - thisMode &= 0xff; - - if (thisMode == 0x3a || thisMode == 0x4a || thisMode == 0x4b || thisMode == 0x5a || /* 1600x1200 */ - thisMode == 0x38 || thisMode == 0x48 || thisMode == 0x49 || thisMode == 0x58) { /* 1280x1024 */ - DPRINTF (PFX,"Doing 1600x1200 / 1280x1024 mode hack\n"); - - /* first we restore everything the way we're supposed to do it */ - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); - RestoreFonts (pScrn); - I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); - - /* now we fake a 800x600x8 mode save and restore */ - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); - I830BIOSSaveRegisters (pScrn); - SaveFonts (pScrn); - I830VESASetVBEMode (pScrn,0xc032,NULL); - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); - RestoreFonts (pScrn); - I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + /* + * If DRI is potentially usable, check if there is enough memory available + * for it, and if there's also enough to allow tiling to be enabled. + */ +#if defined(XF86DRI) + if (!pI830->directRenderingDisabled) { + int savedDisplayWidth = pScrn->displayWidth; + int memNeeded = 0; + /* Good pitches to allow tiling. Don't care about pitches < 256. */ + static const int pitches[] = { + 128 * 2, + 128 * 4, + 128 * 8, + 128 * 16, + 128 * 32, + 128 * 64, + 0 + }; + +#ifdef I830_XV + /* + * Set this so that the overlay allocation is factored in when + * appropriate. + */ + pI830->XvEnabled = !pI830->XvDisabled; +#endif + + for (i = 0; pitches[i] != 0; i++) { +#if USE_PITCHES + if (pitches[i] >= pScrn->displayWidth) { + pScrn->displayWidth = pitches[i]; + break; + } +#else + if (pitches[i] == pScrn->displayWidth) + break; +#endif + } - return (TRUE); - } + /* + * If the displayWidth is a tilable pitch, test if there's enough + * memory available to enable tiling. + */ + if (pScrn->displayWidth == pitches[i]) { + I830ResetAllocations(pScrn, 0); + if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && + I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN)) { + memNeeded = I830GetExcessMemoryAllocations(pScrn); + if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) { + if (memNeeded > 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%d kBytes additional video memory is " + "required to\n\tenable tiling mode for DRI.\n", + (memNeeded + 1023) / 1024); + } + if (pI830->MemoryAperture.Size < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Allocation with DRI tiling enabled would " + "exceed the\n" + "\tmemory aperture size (%d kB) by %d kB.\n" + "\tReduce VideoRam amount to avoid this!\n", + pI830->FbMapSize / 1024, + -pI830->MemoryAperture.Size / 1024); + } + pScrn->displayWidth = savedDisplayWidth; + pI830->allowPageFlip = FALSE; + } else if (pScrn->displayWidth != savedDisplayWidth) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Increasing the scanline pitch to allow tiling mode " + "(%d -> %d).\n", + savedDisplayWidth, pScrn->displayWidth); + } + } else { + memNeeded = 0; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unexpected dry run allocation failure (1).\n"); + } + } + if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) { + /* + * Tiling can't be enabled. Check if there's enough memory for DRI + * without tiling. + */ + I830ResetAllocations(pScrn, 0); + if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && + I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_NO_TILING)) { + memNeeded = I830GetExcessMemoryAllocations(pScrn); + if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) { + if (memNeeded > 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%d kBytes additional video memory is required " + "to enable DRI.\n", + (memNeeded + 1023) / 1024); + } + if (pI830->MemoryAperture.Size < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Allocation with DRI enabled would " + "exceed the\n" + "\tmemory aperture size (%d kB) by %d kB.\n" + "\tReduce VideoRam amount to avoid this!\n", + pI830->FbMapSize / 1024, + -pI830->MemoryAperture.Size / 1024); + } + pI830->directRenderingDisabled = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unexpected dry run allocation failure (2).\n"); + } + } } #endif -#if 1 - /* This is a workaround that is needed to avoid a bug in VESA Save/Restore, - * I will remove it as soon as the problem is fixed in the BIOS. - * Basically it is a problem with 0x4f04 in that it corrupts the - * GATT table after it has been executed. We are working around this - * by just setting the BIOS mode to the save one. This is not completely - * correct behavior, especially since it doesn't reset all the registers - * to their correct state (if something other than the BIOS has set the - * mode.) - */ - - if(function == MODE_RESTORE) { - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); - RestoreFonts (pScrn); - I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); - return (TRUE); + VBEPrintModes(pScrn); + + if (!pI830->vesa->useDefaultRefresh) { + /* + * This sets the parameters for the VBE modes according to the best + * usable parameters from the Monitor sections modes (usually the + * default VESA modes), allowing for better than default refresh rates. + * This only works for VBE 3.0 and later. Also, we only do this + * if there are no non-CRT devices attached. + */ + VBESetModeParameters(pScrn, pVbe); + } + + /* PreInit shouldn't leave any state changes, so restore this. */ + RestoreBIOSMemSize(pScrn); + + /* Don't need MMIO access anymore. */ + if (pI830->swfSaved) { + OUTREG(SWF0, pI830->saveSWF0); + OUTREG(SWF4, pI830->saveSWF4); + } + I830UnmapMMIO(pScrn); + + /* Set display resolution */ + xf86SetDpi(pScrn, 0, 0); + + /* Load the required sub modules */ + if (!xf86LoadSubModule(pScrn, "fb")) { + PreInitCleanup(pScrn); + return FALSE; + } + + xf86LoaderReqSymLists(I810fbSymbols, NULL); + + if (!pI830->noAccel) { + if (!xf86LoadSubModule(pScrn, "xaa")) { + PreInitCleanup(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(I810xaaSymbols, NULL); + } + + if (!pI830->SWCursor) { + if (!xf86LoadSubModule(pScrn, "ramdac")) { + PreInitCleanup(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(I810ramdacSymbols, NULL); + } + + /* We won't be using the VGA access after the probe. */ + I830SetMMIOAccess(pI830); + xf86SetOperatingState(resVgaIo, pI830->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pI830->pEnt->index, ResDisableOpr); + + VBEFreeVBEInfo(pI830->vbeInfo); + vbeFree(pVbe); + +#if defined(XF86DRI) + if (!pI830->directRenderingDisabled) { + if (!xf86LoadSubModule(pScrn, "shadow")) { + PreInitCleanup(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(I810shadowSymbols, NULL); } #endif - /* Save the accel and fence state */ - if(function == MODE_SAVE) I830BIOSSaveRegisters (pScrn); - - /* Query amount of memory to save state */ - if(function == MODE_QUERY || (function == MODE_SAVE && pVesa->state == NULL)) - { - int npages; - - /* Make sure we save at least this information in case of failure */ - I830VESAGetVBEMode (pScrn,&pVesa->stateMode); - SaveFonts (pScrn); - - if (pVesa->major > 1) - { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = 0; - pVesa->pInt->cx = 0x000f; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - if(pVesa->pInt->ax != 0x4f) return (FALSE); - - npages = (pVesa->pInt->bx * 64) / 4096 + 1; - if ((pVesa->state = xf86Int10AllocPages (pVesa->pInt,npages,&pVesa->statePage)) == NULL) - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Cannot allocate memory to save SVGA state.\n"); - return (FALSE); - } - DPRINTF (PFX, - "BIOS returned bx == %d\n" - "therefore I need npages == %d (4k pages)\n", - pVesa->pInt->bx,npages); - } - } + return TRUE; +} +/* + * As the name says. Check that the initial state is reasonable. + * If any unrecoverable problems are found, bail out here. + */ +static Bool +CheckInheritedState(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + int errors = 0, fatal = 0; + unsigned long temp, head, tail; + + /* Check first for page table errors */ + temp = INREG(PGE_ERR); + if (temp != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08x\n", temp); + errors++; + } + temp = INREG(PGETBL_CTL); + if (!(temp & 1)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "PGTBL_CTL (0x%08x) indicates GTT is disabled\n", temp); + errors++; + } + temp = INREG(LP_RING + RING_LEN); + if (temp & 1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "PRB0_CTL (0x%08x) indicates ring buffer enabled\n", temp); + errors++; + } + head = INREG(LP_RING + RING_HEAD); + tail = INREG(LP_RING + RING_TAIL); + if ((tail & I830_TAIL_MASK) != (head & I830_HEAD_MASK)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "PRB0_HEAD (0x%08x) and PRB0_TAIL (0x%08x) indicate " + "ring buffer not flushed\n", head, tail); + errors++; + } #if 0 - /* Save/Restore Super VGA state */ - if(function != MODE_QUERY) - { - int ax_reg = 0; - - if (pVesa->major > 1) - { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = function; - pVesa->pInt->cx = 0x000f; - - if (function == MODE_RESTORE) - memcpy (pVesa->state,pVesa->pstate,pVesa->stateSize); - - pVesa->pInt->es = SEG_ADDR (pVesa->statePage); - pVesa->pInt->bx = SEG_OFF (pVesa->statePage); - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - ax_reg = pVesa->pInt->ax; - } - - if(function == MODE_RESTORE) - { - I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); - RestoreFonts (pScrn); - I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); - } - - if (pVesa->major > 1) - { - if (ax_reg != 0x4f) return (FALSE); - - if (function == MODE_SAVE && pVesa->pstate == NULL) - { - /* don't rely on the memory not being touched */ - pVesa->stateSize = pVesa->pInt->bx * 64; - pVesa->pstate = xalloc (pVesa->stateSize); - memcpy (pVesa->pstate,pVesa->state,pVesa->stateSize); - } - } - } + if (errors) + I830PrintErrorState(pScrn); #endif + + if (fatal) + FatalError("CheckInheritedState: can't recover from the above\n"); + + return (errors != 0); +} + +/* + * Reset registers that it doesn't make sense to save/restore to a sane state. + * This is basically the ring buffer and fence registers. Restoring these + * doesn't make sense without restoring GTT mappings. This is something that + * whoever gets control next should do. + */ +static void +ResetState(ScrnInfoPtr pScrn, Bool flush) +{ + I830Ptr pI830 = I830PTR(pScrn); + int i; + unsigned long temp; - /* Now that the modes setup, we can do our I830 specific fu */ - if(function == MODE_RESTORE) I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); + DPRINTF(PFX, "ResetState: flush is %s\n", BOOLTOSTRING(flush)); - return (TRUE); + /* Reset the fence registers to 0 */ + for (i = 0; i < 8; i++) + OUTREG(FENCE + i * 4, 0); + + /* Flush the ring buffer (if enabled), then disable it. */ + if (pI830->AccelInfoRec != NULL && flush) { + temp = INREG(LP_RING + RING_LEN); + if (temp & 1) { + I830RefreshRing(pScrn); + I830Sync(pScrn); + DO_RING_IDLE(); + } + } + OUTREG(LP_RING + RING_LEN, 0); + OUTREG(LP_RING + RING_HEAD, 0); + OUTREG(LP_RING + RING_TAIL, 0); + OUTREG(LP_RING + RING_START, 0); + + if (pI830->CursorInfoRec && pI830->CursorInfoRec->HideCursor) + pI830->CursorInfoRec->HideCursor(pScrn); } -Bool -I830VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, int width, - int *pixels, int *bytes, int *max) +static void +SetFenceRegs(ScrnInfoPtr pScrn) { - I810Ptr pI810; + I830Ptr pI830 = I830PTR(pScrn); + int i; + + DPRINTF(PFX, "SetFenceRegs\n"); + + for (i = 0; i < 8; i++) { + OUTREG(FENCE + i * 4, pI830->ModeReg.Fence[i]); + if (I810_DEBUG & DEBUG_VERBOSE_VGA) + ErrorF("Fence Register : %x\n", pI830->ModeReg.Fence[i]); + } +} + +static void +SetRingRegs(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned int itemp; + + DPRINTF(PFX, "SetRingRegs\n"); + + if (pI830->noAccel) + return; + + OUTREG(LP_RING + RING_LEN, 0); + OUTREG(LP_RING + RING_TAIL, 0); + OUTREG(LP_RING + RING_HEAD, 0); + + if ((pI830->LpRing.mem.Start & I830_RING_START_MASK) != + pI830->LpRing.mem.Start) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "I830SetRingRegs: Ring buffer start (%x) violates its " + "mask (%x)\n", pI830->LpRing.mem.Start, I830_RING_START_MASK); + } + /* Don't care about the old value. Reserved bits must be zero anyway. */ + itemp = pI830->LpRing.mem.Start & I830_RING_START_MASK; + OUTREG(LP_RING + RING_START, itemp); + + if (((pI830->LpRing.mem.Size - 4096) & I830_RING_NR_PAGES) != + pI830->LpRing.mem.Size - 4096) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "I830SetRingRegs: Ring buffer size - 4096 (%x) violates its " + "mask (%x)\n", pI830->LpRing.mem.Size - 4096, + I830_RING_NR_PAGES); + } + /* Don't care about the old value. Reserved bits must be zero anyway. */ + itemp = (pI830->LpRing.mem.Size - 4096) & I830_RING_NR_PAGES; + itemp |= (RING_NO_REPORT | RING_VALID); + OUTREG(LP_RING + RING_LEN, itemp); + I830RefreshRing(pScrn); +} + +/* + * This should be called everytime the X server gains control of the screen, + * before any video modes are programmed (ScreenInit, EnterVT). + */ +static void +SetHWOperatingState(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "SetHWOperatingState\n"); + + if (!pI830->noAccel) + SetRingRegs(pScrn); + SetFenceRegs(pScrn); + if (!pI830->SWCursor) + I830InitHWCursor(pScrn); +} + +static Bool +SaveHWState(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + vbeInfoPtr pVbe = pI830->pVbe; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VbeModeInfoBlock *modeInfo; VESAPtr pVesa; + + DPRINTF(PFX, "SaveHWState\n"); + + pVesa = pI830->vesa; + /* Make sure we save at least this information in case of failure. */ + VBEGetVBEMode(pVbe, &pVesa->stateMode); + modeInfo = VBEGetModeInfo(pVbe, pVesa->stateMode); + pVesa->savedScanlinePitch = 0; + if (modeInfo) { + if (VBE_MODE_GRAPHICS(modeInfo)) { + VBEGetLogicalScanline(pVbe, &pVesa->savedScanlinePitch, NULL, NULL); + } + VBEFreeModeInfo(modeInfo); + } + + vgaHWUnlock(hwp); + vgaHWSave(pScrn, vgaReg, VGA_SR_FONTS); - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; +#ifndef I845G_VBE_WORKAROUND +#define I845G_VBE_WORKAROUND 1 +#endif - if(command < SCANWID_SET || command > SCANWID_GET_MAX) - return FALSE; + pVesa = pI830->vesa; + /* This save/restore method doesn't work for 845G BIOS */ + /* + * XXX If it's fixed in production versions, this could be removed. + * + * KW: This may have been because of the behaviour I've found on my + * board: The 'save' command actually modifies the interrupt + * registers, turning off the irq & breaking the kernel module + * behaviour. + */ + if (!I845G_VBE_WORKAROUND || !IS_845G(pI830)) { + CARD16 imr = INREG16(IMR); + CARD16 ier = INREG16(IER); + CARD16 hwstam = INREG16(HWSTAM); + + if (!VBESaveRestore(pVbe, MODE_SAVE, &pVesa->state, &pVesa->stateSize, + &pVesa->statePage)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SaveHWState: VBESaveRestore(MODE_SAVE) failed.\n"); + return FALSE; + } - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f06; - pVesa->pInt->bx = command; - if(command == SCANWID_SET || command == SCANWID_SET_BYTES) - pVesa->pInt->cx = width; - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); - - if(pVesa->pInt->ax != 0x4f) - return FALSE; - - if(command == SCANWID_GET || command == SCANWID_GET_MAX) { - if(pixels) *pixels = pVesa->pInt->cx; - if(bytes) *bytes = pVesa->pInt->bx; - if(max) *max = pVesa->pInt->dx; + OUTREG16(IMR, imr); + OUTREG16(IER, ier); + OUTREG16(HWSTAM, hwstam); } + pVesa->savedPal = VBESetGetPaletteData(pVbe, FALSE, 0, 256, + NULL, FALSE, FALSE); + if (!pVesa->savedPal) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SaveHWState: VBESetGetPaletteData(GET) failed.\n"); + return FALSE; + } + return TRUE; } -int -I830VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits) +static Bool +RestoreHWState(ScrnInfoPtr pScrn) { - I810Ptr pI810; + I830Ptr pI830 = I830PTR(pScrn); + vbeInfoPtr pVbe = pI830->pVbe; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; VESAPtr pVesa; + Bool restored = FALSE; + + DPRINTF(PFX, "RestoreHWState\n"); + + pVesa = pI830->vesa; - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; + /* + * Workaround for text mode restoration with some flat panels. + * Temporarily program a 640x480 mode before switching back to + * text mode. + */ + if (pVesa->useDefaultRefresh) { + int mode = 0; - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f08; - if(!bits) pVesa->pInt->bx = 0x01; - else pVesa->pInt->bx = (bits & 0x00ff) << 8; - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); + switch (pScrn->depth) { + case 8: + mode = 0x30; + break; + case 15: + mode = 0x40; + break; + case 16: + mode = 0x41; + break; + case 24: + mode = 0x50; + break; + } + mode |= (1 << 15) | (1 << 14); + I830VESASetVBEMode(pScrn, mode, NULL); + } - if(pVesa->pInt->ax != 0x4f) return 0; + if (pVesa->state && pVesa->stateSize) { + CARD16 imr = INREG16(IMR); + CARD16 ier = INREG16(IER); + CARD16 hwstam = INREG16(HWSTAM); + + /* Make a copy of the state. Don't rely on it not being touched. */ + if (!pVesa->pstate) { + pVesa->pstate = xalloc(pVesa->stateSize); + if (pVesa->pstate) + memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); + } + restored = VBESaveRestore(pVbe, MODE_RESTORE, &pVesa->state, + &pVesa->stateSize, &pVesa->statePage); + if (!restored) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "RestoreHWState: VBESaveRestore failed.\n"); + } + /* Copy back */ + if (pVesa->pstate) + memcpy(pVesa->state, pVesa->pstate, pVesa->stateSize); + + OUTREG16(IMR, imr); + OUTREG16(IER, ier); + OUTREG16(HWSTAM, hwstam); + } + /* If that failed, restore the original mode. */ + if (!restored) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Setting the original video mode instead of restoring\n\t" + "the saved state\n"); + I830VESASetVBEMode(pScrn, pVesa->stateMode, NULL); + } + if (pVesa->savedScanlinePitch) + VBESetLogicalScanline(pVbe, pVesa->savedScanlinePitch); + + if (pVesa->savedPal) + VBESetGetPaletteData(pVbe, TRUE, 0, 256, pVesa->savedPal, FALSE, TRUE); - return (bits != 0 ? bits : (pVesa->pInt->bx >> 8) & 0x00ff); + vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS); + vgaHWLock(hwp); + return TRUE; } + +#ifndef USE_VBE +#define USE_VBE 1 +#endif -static Bool I830VESASetMode (ScrnInfoPtr pScrn,DisplayModePtr pMode) +static Bool +I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, VbeCRTCInfoBlock * block) { - I810Ptr pI810; - VESAPtr pVesa; - ModeInfoData *data; - int mode; + I830Ptr pI830 = I830PTR(pScrn); - pI810 = I810PTR (pScrn); - pVesa = pI810->vesa; + DPRINTF(PFX, "Setting mode 0x%.8x\n", mode); +#if USE_VBE + return VBESetVBEMode(pI830->pVbe, mode, block); +#else + { + vbeInfoPtr pVbe = pI830->pVbe; + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x80 | (mode & 0x7f); + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + pVbe->pInt10->ax = 0x0f00; + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); + if ((pVbe->pInt10->ax & 0x7f) == (mode & 0x7f)) + return TRUE; + else + return FALSE; + } +#endif +} - data = (ModeInfoData *) pMode->Private; +static Bool +I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) +{ + I830Ptr pI830 = I830PTR(pScrn); + vbeInfoPtr pVbe = pI830->pVbe; + VbeModeInfoData *data; + int mode, i; + CARD32 planeA, planeB, temp; + int refresh = 60; +#ifdef XF86DRI + Bool didLock = FALSE; +#endif + DPRINTF(PFX, "I830VESASetMode\n"); + + data = (VbeModeInfoData *) pMode->Private; + /* Always Enable Linear Addressing */ mode = data->mode | (1 << 15) | (1 << 14); #ifdef XF86DRI - if(pI810->directRenderingEnabled) - { - DRILock (screenInfo.screens[pScrn->scrnIndex],0); - pI810->LockHeld = 1; - } + if (pI830->directRenderingEnabled && !pI830->LockHeld) { + DRILock(screenInfo.screens[pScrn->scrnIndex], 0); + pI830->LockHeld = 1; + didLock = TRUE; + } +#endif + +#ifndef MODESWITCH_RESET_STATE +#define MODESWITCH_RESET_STATE 0 +#endif +#if MODESWITCH_RESET_STATE + ResetState(pScrn, TRUE); #endif + + /* XXX Add macros for the various mode parameter bits. */ + + if (pI830->vesa->useDefaultRefresh) + mode &= ~(1 << 11); + + if (I830VESASetVBEMode(pScrn, mode, data->block) == FALSE) { + if ((data->block && (mode & (1 << 11))) && + I830VESASetVBEMode(pScrn, (mode & ~(1 << 11)), NULL) == TRUE) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Set VBE Mode rejected this modeline.\n\t" + "Trying standard mode instead!\n"); + DPRINTF(PFX, "OOPS!\n"); + xfree(data->block); + data->block = NULL; + data->mode &= ~(1 << 11); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); + return FALSE; + } + } + + /* + * The BIOS may not set a scanline pitch that would require more video + * memory than it's aware of. We check for this later, and set it + * explicitly if necessary. + */ + if (data->data->XResolution != pScrn->displayWidth) + VBESetLogicalScanline(pVbe, pScrn->displayWidth); + + if (pScrn->bitsPerPixel >= 8 && pI830->vbeInfo->Capabilities[0] & 0x01) + VBESetGetDACPaletteFormat(pVbe, 8); + + /* + * XXX This location of this isn't correct. + * + * Turn on the configured displays. This has the effect of resetting + * the default refresh rates to values that the configured displays + * can handle. This seems to be the safest way to make sure that this + * happens. When it's safe to set higher values, we do that after this. + * + * Note: When a DFP is connected to an 830, this causes the mode setting + * to be trashed. So, we don't do it on the 830. + * + * XXX Need to test an 830 with a LFP. + */ + if (pI830->enableDisplays) { + if (!SetDisplayDevices(pScrn, pI830->configuredDevices)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to switch to configured display devices\n"); + } + } + + /* + * When it's OK to set better than default refresh rates, set them here. + */ + if (pI830->useExtendedRefresh && !pI830->vesa->useDefaultRefresh && + (mode & (1 << 11)) && data && data->data && data->block) { + refresh = SetRefreshRate(pScrn, mode, data->block->RefreshRate / 100); + if (!refresh) { + refresh = 60; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to set refresh rate to %dHz.\n", + data->block->RefreshRate / 100); + } + } + + + /* XXX Fix plane A with pipe A, and plane B with pipe B. */ + planeA = INREG(DSPACNTR); + planeB = INREG(DSPBCNTR); + + pI830->planeEnabled[0] = ((planeA & DISPLAY_PLANE_ENABLE) != 0); + pI830->planeEnabled[1] = ((planeB & DISPLAY_PLANE_ENABLE) != 0); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Display plane A is %s.\n", + pI830->planeEnabled[0] ? "enabled" : "disabled"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Display plane B is %s.\n", + pI830->planeEnabled[1] ? "enabled" : "disabled"); + + /* + * Sometimes it seems that no display planes are enabled at this point. + * For mobile platforms pick the plane(s) connected to enabled pipes. + * For others choose plane A. + */ + if (!pI830->planeEnabled[0] && !pI830->planeEnabled[1]) { + if (IS_MOBILE(pI830)) { + if ((pI830->pipeEnabled[0] && + ((planeA & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_A)) || + (pI830->pipeEnabled[1] && + ((planeA & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_B))) { + pI830->planeEnabled[0] = TRUE; + } + if ((pI830->pipeEnabled[0] && + ((planeB & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_A)) || + (pI830->pipeEnabled[1] && + ((planeB & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_B))) { + pI830->planeEnabled[1] = TRUE; + } + } else { + pI830->planeEnabled[0] = TRUE; + } + if (pI830->planeEnabled[0]) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling plane A.\n"); + planeA |= DISPLAY_PLANE_ENABLE; + OUTREG(DSPACNTR, planeA); + /* flush the change. */ + temp = INREG(DSPABASE); + OUTREG(DSPABASE, temp); + } + if (pI830->planeEnabled[1]) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling plane B.\n"); + planeB |= DISPLAY_PLANE_ENABLE; + OUTREG(DSPBCNTR, planeB); + /* flush the change. */ + temp = INREG(DSPBADDR); + OUTREG(DSPBADDR, temp); + } + } + + /* XXX Plane C is ignored for now (overlay). */ + + /* + * Print out the PIPEACONF and PIPEBCONF registers. + */ + temp = INREG(PIPEACONF); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08x\n", temp); + if (IS_MOBILE(pI830)) { + temp = INREG(PIPEBCONF); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08x\n", temp); + } + +#if PRINT_MODE_INFO + /* Print out some CRTC/display information. */ + temp = INREG(HTOTAL_A); + ErrorF("Horiz active: %d, Horiz total: %d\n", temp & 0x7ff, + (temp >> 16) & 0xfff); + temp = INREG(HBLANK_A); + ErrorF("Horiz blank start: %d, Horiz blank end: %d\n", temp & 0xfff, + (temp >> 16) & 0xfff); + temp = INREG(HSYNC_A); + ErrorF("Horiz sync start: %d, Horiz sync end: %d\n", temp & 0xfff, + (temp >> 16) & 0xfff); + temp = INREG(VTOTAL_A); + ErrorF("Vert active: %d, Vert total: %d\n", temp & 0x7ff, + (temp >> 16) & 0xfff); + temp = INREG(VBLANK_A); + ErrorF("Vert blank start: %d, Vert blank end: %d\n", temp & 0xfff, + (temp >> 16) & 0xfff); + temp = INREG(VSYNC_A); + ErrorF("Vert sync start: %d, Vert sync end: %d\n", temp & 0xfff, + (temp >> 16) & 0xfff); + temp = INREG(PIPEASRC); + ErrorF("Image size: %dx%d (%dx%d)\n", + (temp >> 16) & 0x7ff, temp & 0x7ff, + (((temp >> 16) & 0x7ff) + 1), ((temp & 0x7ff) + 1)); + ErrorF("Pixel multiply is %d\n", (planeA >> 20) & 0x3); + temp = INREG(DSPABASE); + ErrorF("Plane A start offset is %d\n", temp); + temp = INREG(DSPASTRIDE); + ErrorF("Plane A stride is %d bytes (%d pixels)\n", temp, temp / pI830->cpp); +#endif + + for (i = 0; i < MAX_DISPLAY_PIPES; i++) { + CARD32 stridereg = i ? DSPBSTRIDE : DSPASTRIDE; + CARD32 basereg = i ? DSPBBASE : DSPABASE; + + if (!pI830->planeEnabled[i]) + continue; + + temp = INREG(stridereg); + if (temp / pI830->cpp != pScrn->displayWidth) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(i), + temp / pI830->cpp, pScrn->displayWidth); + OUTREG(stridereg, pScrn->displayWidth * pI830->cpp); + /* Trigger update */ + temp = INREG(basereg); + OUTREG(basereg, temp); + } + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode bandwidth is %d Mpixel/s\n", + pMode->HDisplay * pMode->VDisplay * refresh / 1000000); - if (I830VESASetVBEMode (pScrn,mode,data->block) == FALSE) - { - if ((data->block || (data->mode & (1 << 11))) && - I830VESASetVBEMode (pScrn,(mode & ~(1 << 11)),NULL) == TRUE) - { - xf86DrvMsg (pScrn->scrnIndex,X_WARNING,"Set VBE Mode rejected this modeline. Trying current mode instead!\n"); - DPRINTF (PFX,"OOPS!\n"); - xfree (data->block); - data->block = NULL; - data->mode &= ~(1 << 11); - } - else - { - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Set VBE Mode failed!\n"); - return (FALSE); - } - } + { + int maxBandwidth, bandwidthA, bandwidthB; - /* test if CRT display is present */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f55; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - - /* is this a CRT? */ - if (pVesa->pInt->ax == 0x005f && pVesa->pInt->bx != 0x0002) - { - DPRINTF (PFX, - "data->data = {\n" - " XResolution: %d\n" - " YResolution: %d\n" - "}\n", - data->data->XResolution,data->data->YResolution); - if (data->block != NULL) - DPRINTF (PFX, - "data->block = {\n" - " HorizontalTotal: %d\n" - " HorizontalSyncStart: %d\n" - " HorizontalSyncEnd: %d\n" - " VerticalTotal: %d\n" - " VerticalSyncStart: %d\n" - " VerticalSyncEnd: %d\n" - " Flags: %d\n" - " PixelClock: %d\n" - " RefreshRate: %d\n" - "}\n", - data->block->HorizontalTotal,data->block->HorizontalSyncStart,data->block->HorizontalSyncEnd, - data->block->VerticalTotal,data->block->VerticalSyncStart,data->block->VerticalSyncEnd, - data->block->Flags,data->block->PixelClock,data->block->RefreshRate / 100); - - /* make double sure it's not an LCD */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f64; - pVesa->pInt->bx = 0x0100; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - if (data->data != NULL && data->block != NULL && pVesa->pInt->ax == 0x005f && !(pVesa->pInt->cx & 0x0008)) - { - int i; - static const int VesaRefresh[] = { 43, 56, 60, 70, 72, 75, 85, 100, 120, -1 }; - - for (i = 0; VesaRefresh[i] != -1 && VesaRefresh[i] != data->block->RefreshRate / 100; i++) ; - - if (VesaRefresh[i] == data->block->RefreshRate / 100) - { - DPRINTF (PFX, - "Setting refresh rate to %dHz for mode %d\n", - VesaRefresh[i], - mode & 0xff); - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f05; - pVesa->pInt->bx = mode & 0xff; - pVesa->pInt->cx = 1 << i; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - - if (pVesa->pInt->ax != 0x5f) - xf86DrvMsg (pScrn->scrnIndex,X_WARNING,"Failed to set refresh rate to %dHz!\n",VesaRefresh[i]); - } - } - } + if (GetModeSupport(pScrn, 0x80, 0x80, 0x80, 0x80, + &maxBandwidth, &bandwidthA, &bandwidthB)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "maxBandwidth is %d Mbyte/s, " + "pipe bandwidths are %d Mbyte/s, %d Mbyte/s\n", + maxBandwidth, bandwidthA, bandwidthB); + } + } - if (data->data->XResolution != pScrn->displayWidth) - I830VESASetLogicalScanline (pScrn,pScrn->displayWidth); + { + int ret; - if (pScrn->bitsPerPixel >= 8 && pVesa->vbeInfo->Capabilities[0] & 0x01) - I830VESASetGetDACPaletteFormat (pScrn,8); + ret = GetLFPCompMode(pScrn); + if (ret != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "LFP compensation mode: 0x%x\n", ret); + } + } - I830BIOSSetRegisters (pScrn,SET_CURRENT_MODE); - I810SetRingRegs (pScrn); +#if MODESWITCH_RESET_STATE + ResetState(pScrn, TRUE); + SetHWOperatingState(pScrn); +#endif #ifdef XF86DRI - if (pI810->directRenderingEnabled) - { - DRIUnlock (screenInfo.screens[pScrn->scrnIndex]); - pI810->LockHeld = 0; - } + if (pI830->directRenderingEnabled && didLock) { + DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); + pI830->LockHeld = 0; + } #endif pScrn->vtSema = TRUE; - return (TRUE); + return TRUE; } -CARD32 * -I830VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace) +static void +InitRegisterRec(ScrnInfoPtr pScrn) { - I810Ptr pI810; - VESAPtr pVesa; - - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f09; - - if(!secondary) pVesa->pInt->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; - else pVesa->pInt->bx = set ? 2 : 3; - - pVesa->pInt->cx = num; - pVesa->pInt->dx = first; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - - if(set) memcpy(pVesa->block, data, num * sizeof(CARD32)); - - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); + I830Ptr pI830 = I830PTR(pScrn); + I830RegPtr i830Reg = &pI830->ModeReg; + int i; - if(pVesa->pInt->ax != 0x4f) return NULL; + for (i = 0; i < 8; i++) + i830Reg->Fence[i] = 0; +} - if(set) return data; +/* Famous last words + */ +void +I830PrintErrorState(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); - data = xalloc(num * sizeof(CARD32)); - memcpy(data, pVesa->block, num * sizeof(CARD32)); + ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", + INREG(PGETBL_CTL), INREG(PGE_ERR)); - return data; -} + ErrorF("ipeir: %lx iphdr: %lx\n", INREG(IPEIR), INREG(IPEHR)); -Bool -I830BIOSInitializeFirstMode(int scrnIndex) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - I810Ptr pI810 = I810PTR(pScrn); - VESAPtr pVesa = pI810->vesa; - I830RegPtr i830Reg = &pI810->i830_ModeReg; - int i; + ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", + INREG(LP_RING + RING_TAIL), + INREG(LP_RING + RING_HEAD) & HEAD_ADDR, + INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); - for (i = 0 ; i < 8 ; i++) - i830Reg->Fence[i] = 0; + ErrorF("eir: %x esr: %x emr: %x\n", + INREG16(EIR), INREG16(ESR), INREG16(EMR)); - /* Setup the ring buffer */ - i830Reg->LprbTail = 0; - i830Reg->LprbHead = 0; - i830Reg->LprbStart = pI810->LpRing.mem.Start; - - if (i830Reg->LprbStart) - i830Reg->LprbLen = ((pI810->LpRing.mem.Size-4096) | - RING_NO_REPORT | RING_VALID); - else - i830Reg->LprbLen = RING_INVALID; - - /* save current video state */ - if(!I830VESASaveRestore(pScrn, MODE_SAVE)) return FALSE; - pVesa->savedPal = I830VESASetGetPaletteData(pScrn, FALSE, 0, 256, - NULL, FALSE, FALSE); - - /* set first video mode */ - if(!I830VESASetMode(pScrn, pScrn->currentMode)) - return FALSE; + ErrorF("instdone: %x instpm: %x\n", INREG16(INST_DONE), INREG8(INST_PM)); - I830BIOSAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + ErrorF("memmode: %lx instps: %lx\n", INREG(MEMMODE), INREG(INST_PS)); - return TRUE; + ErrorF("hwstam: %x ier: %x imr: %x iir: %x\n", + INREG16(HWSTAM), INREG16(IER), INREG16(IMR), INREG16(IIR)); } #ifdef I830DEBUG -static void dump_DSPACNTR (ScrnInfoPtr pScrn) +static void +dump_DSPACNTR(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR (pScrn); + I830Ptr pI830 = I830PTR(pScrn); unsigned int tmp; /* Display A Control */ - tmp = INREG (0x70180); - fprintf (stderr,"Display A Plane Control Register (0x%.8x)\n",tmp); + tmp = INREG(0x70180); + ErrorF("Display A Plane Control Register (0x%.8x)\n", tmp); if (tmp & BIT(31)) - fprintf (stderr," Display Plane A (Primary) Enable\n"); + ErrorF(" Display Plane A (Primary) Enable\n"); else - fprintf (stderr," Display Plane A (Primary) Disabled\n"); + ErrorF(" Display Plane A (Primary) Disabled\n"); if (tmp & BIT(30)) - fprintf (stderr," Display A pixel data is gamma corrected\n"); + ErrorF(" Display A pixel data is gamma corrected\n"); else - fprintf (stderr," Display A pixel data bypasses gamma correction logic (default)\n"); + ErrorF(" Display A pixel data bypasses gamma correction logic (default)\n"); - switch ((tmp & 0x3c000000) >> 26) /* bit 29:26 */ - { - case 0x00: - case 0x01: - case 0x03: - fprintf (stderr," Reserved\n"); - break; - case 0x02: - fprintf (stderr," 8-bpp Indexed\n"); - break; - case 0x04: - fprintf (stderr," 15-bit (5-5-5) pixel format (Targa compatible)\n"); - break; - case 0x05: - fprintf (stderr," 16-bit (5-6-5) pixel format (XGA compatible)\n"); - break; - case 0x06: - fprintf (stderr," 32-bit format (X:8:8:8)\n"); - break; - case 0x07: - fprintf (stderr," 32-bit format (8:8:8:8)\n"); - break; - default: - fprintf (stderr," Unknown - Invalid register value maybe?\n"); - } + switch ((tmp & 0x3c000000) >> 26) { /* bit 29:26 */ + case 0x00: + case 0x01: + case 0x03: + ErrorF(" Reserved\n"); + break; + case 0x02: + ErrorF(" 8-bpp Indexed\n"); + break; + case 0x04: + ErrorF(" 15-bit (5-5-5) pixel format (Targa compatible)\n"); + break; + case 0x05: + ErrorF(" 16-bit (5-6-5) pixel format (XGA compatible)\n"); + break; + case 0x06: + ErrorF(" 32-bit format (X:8:8:8)\n"); + break; + case 0x07: + ErrorF(" 32-bit format (8:8:8:8)\n"); + break; + default: + ErrorF(" Unknown - Invalid register value maybe?\n"); + } if (tmp & BIT(25)) - fprintf (stderr," Stereo Enable\n"); + ErrorF(" Stereo Enable\n"); else - fprintf (stderr," Stereo Disable\n"); + ErrorF(" Stereo Disable\n"); if (tmp & BIT(24)) - fprintf (stderr," Display A, Pipe B Select\n"); + ErrorF(" Display A, Pipe B Select\n"); else - fprintf (stderr," Display A, Pipe A Select\n"); + ErrorF(" Display A, Pipe A Select\n"); if (tmp & BIT(22)) - fprintf (stderr," Source key is enabled\n"); + ErrorF(" Source key is enabled\n"); else - fprintf (stderr," Source key is disabled\n"); + ErrorF(" Source key is disabled\n"); - switch ((tmp & 0x00300000) >> 20) /* bit 21:20 */ - { - case 0x00: - fprintf (stderr," No line duplication\n"); - break; - case 0x01: - fprintf (stderr," Line/pixel Doubling\n"); - break; - case 0x02: - case 0x03: - fprintf (stderr," Reserved\n"); - break; - } + switch ((tmp & 0x00300000) >> 20) { /* bit 21:20 */ + case 0x00: + ErrorF(" No line duplication\n"); + break; + case 0x01: + ErrorF(" Line/pixel Doubling\n"); + break; + case 0x02: + case 0x03: + ErrorF(" Reserved\n"); + break; + } if (tmp & BIT(18)) - fprintf (stderr," Stereo output is high during second image\n"); + ErrorF(" Stereo output is high during second image\n"); else - fprintf (stderr," Stereo output is high during first image\n"); + ErrorF(" Stereo output is high during first image\n"); } -static void dump_DSPBCNTR (ScrnInfoPtr pScrn) +static void +dump_DSPBCNTR(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR (pScrn); + I830Ptr pI830 = I830PTR(pScrn); unsigned int tmp; /* Display B/Sprite Control */ - tmp = INREG (0x71180); - fprintf (stderr,"Display B/Sprite Plane Control Register (0x%.8x)\n",tmp); + tmp = INREG(0x71180); + ErrorF("Display B/Sprite Plane Control Register (0x%.8x)\n", tmp); if (tmp & BIT(31)) - fprintf (stderr," Display B/Sprite Enable\n"); + ErrorF(" Display B/Sprite Enable\n"); else - fprintf (stderr," Display B/Sprite Disable\n"); + ErrorF(" Display B/Sprite Disable\n"); if (tmp & BIT(30)) - fprintf (stderr," Display B pixel data is gamma corrected\n"); + ErrorF(" Display B pixel data is gamma corrected\n"); else - fprintf (stderr," Display B pixel data bypasses gamma correction logic (default)\n"); + ErrorF(" Display B pixel data bypasses gamma correction logic (default)\n"); - switch ((tmp & 0x3c000000) >> 26) /* bit 29:26 */ - { - case 0x00: - case 0x01: - case 0x03: - fprintf (stderr," Reserved\n"); - break; - case 0x02: - fprintf (stderr," 8-bpp Indexed\n"); - break; - case 0x04: - fprintf (stderr," 15-bit (5-5-5) pixel format (Targa compatible)\n"); - break; - case 0x05: - fprintf (stderr," 16-bit (5-6-5) pixel format (XGA compatible)\n"); - break; - case 0x06: - fprintf (stderr," 32-bit format (X:8:8:8)\n"); - break; - case 0x07: - fprintf (stderr," 32-bit format (8:8:8:8)\n"); - break; - default: - fprintf (stderr," Unknown - Invalid register value maybe?\n"); - } + switch ((tmp & 0x3c000000) >> 26) { /* bit 29:26 */ + case 0x00: + case 0x01: + case 0x03: + ErrorF(" Reserved\n"); + break; + case 0x02: + ErrorF(" 8-bpp Indexed\n"); + break; + case 0x04: + ErrorF(" 15-bit (5-5-5) pixel format (Targa compatible)\n"); + break; + case 0x05: + ErrorF(" 16-bit (5-6-5) pixel format (XGA compatible)\n"); + break; + case 0x06: + ErrorF(" 32-bit format (X:8:8:8)\n"); + break; + case 0x07: + ErrorF(" 32-bit format (8:8:8:8)\n"); + break; + default: + ErrorF(" Unknown - Invalid register value maybe?\n"); + } if (tmp & BIT(25)) - fprintf (stderr," Stereo is enabled and both start addresses are used in a two frame sequence\n"); + ErrorF(" Stereo is enabled and both start addresses are used in a two frame sequence\n"); else - fprintf (stderr," Stereo disable and only a single start address is used\n"); + ErrorF(" Stereo disable and only a single start address is used\n"); if (tmp & BIT(24)) - fprintf (stderr," Display B/Sprite, Pipe B Select\n"); + ErrorF(" Display B/Sprite, Pipe B Select\n"); else - fprintf (stderr," Display B/Sprite, Pipe A Select\n"); + ErrorF(" Display B/Sprite, Pipe A Select\n"); if (tmp & BIT(22)) - fprintf (stderr," Sprite source key is enabled\n"); + ErrorF(" Sprite source key is enabled\n"); else - fprintf (stderr," Sprite source key is disabled (default)\n"); + ErrorF(" Sprite source key is disabled (default)\n"); - switch ((tmp & 0x00300000) >> 20) /* bit 21:20 */ - { - case 0x00: - fprintf (stderr," No line duplication\n"); - break; - case 0x01: - fprintf (stderr," Line/pixel Doubling\n"); - break; - case 0x02: - case 0x03: - fprintf (stderr," Reserved\n"); - break; - } + switch ((tmp & 0x00300000) >> 20) { /* bit 21:20 */ + case 0x00: + ErrorF(" No line duplication\n"); + break; + case 0x01: + ErrorF(" Line/pixel Doubling\n"); + break; + case 0x02: + case 0x03: + ErrorF(" Reserved\n"); + break; + } if (tmp & BIT(18)) - fprintf (stderr," Stereo output is high during second image\n"); + ErrorF(" Stereo output is high during second image\n"); else - fprintf (stderr," Stereo output is high during first image\n"); + ErrorF(" Stereo output is high during first image\n"); if (tmp & BIT(15)) - fprintf (stderr," Alpha transfer mode enabled\n"); + ErrorF(" Alpha transfer mode enabled\n"); else - fprintf (stderr," Alpha transfer mode disabled\n"); + ErrorF(" Alpha transfer mode disabled\n"); if (tmp & BIT(0)) - fprintf (stderr," Sprite is above overlay\n"); + ErrorF(" Sprite is above overlay\n"); else - fprintf (stderr," Sprite is above display A (default)\n"); + ErrorF(" Sprite is above display A (default)\n"); } -static void dump_registers (ScrnInfoPtr pScrn) +void +I830_dump_registers(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR (pScrn); + I830Ptr pI830 = I830PTR(pScrn); unsigned int i; - fprintf (stderr,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); - dump_DSPACNTR (pScrn); - dump_DSPBCNTR (pScrn); + ErrorF("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); - fprintf (stderr,"0x71400 == 0x%.8x\n",INREG(0x71400)); - fprintf (stderr,"0x70008 == 0x%.8x\n",INREG(0x70008)); + dump_DSPACNTR(pScrn); + dump_DSPBCNTR(pScrn); + + ErrorF("0x71400 == 0x%.8x\n", INREG(0x71400)); + ErrorF("0x70008 == 0x%.8x\n", INREG(0x70008)); for (i = 0x71410; i <= 0x71428; i += 4) - fprintf (stderr,"0x%x == 0x%.8x\n",i,INREG(i)); + ErrorF("0x%x == 0x%.8x\n", i, INREG(i)); - fprintf (stderr,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); + ErrorF("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); } #endif -Bool +static Bool I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn; vgaHWPtr hwp; - I810Ptr pI810; - VESAPtr pVesa; + I830Ptr pI830; VisualPtr visual; +#ifdef XF86DRI + Bool driDisabled; +#endif pScrn = xf86Screens[pScreen->myNum]; - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; + pI830 = I830PTR(pScrn); hwp = VGAHWPTR(pScrn); + pI830->starting = TRUE; + + /* + * If we're changing the BIOS's view of the video memory size, do that + * first, then re-initialise the VBE information. + */ + pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + if (!pI830->pVbe) + return FALSE; + pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + miClearVisualTypes(); - if(!xf86SetDefaultVisual(pScrn, -1)) return FALSE; - if(pScrn->bitsPerPixel > 8) { - if(!miSetVisualTypes(pScrn->depth, TrueColorMask, - pScrn->rgbBits, TrueColor)) return FALSE; + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + if (pScrn->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, + pScrn->rgbBits, TrueColor)) + return FALSE; } else { - if(!miSetVisualTypes(pScrn->depth, - miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + if (!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + } + if (!miSetPixmapDepths()) + return FALSE; + +#ifdef I830_XV + pI830->XvEnabled = !pI830->XvDisabled; + if (pI830->XvEnabled) { + if (pI830->noAccel || pI830->StolenOnly) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it " + "needs 2D accel and AGPGART.\n"); + pI830->XvEnabled = FALSE; + } + } +#else + pI830->XvEnabled = FALSE; +#endif + + I830ResetAllocations(pScrn, 0); + + I830Allocate2DMemory(pScrn, ALLOC_INITIAL); + + if (!pI830->noAccel) { + if (pI830->LpRing.mem.Size == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling acceleration because the ring buffer " + "allocation failed.\n"); + pI830->noAccel = TRUE; + } + } + + if (!pI830->SWCursor) { + if (pI830->CursorMem.Size == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling HW cursor because the cursor memory " + "allocation failed.\n"); + pI830->SWCursor = TRUE; + } + } + +#ifdef I830_XV + if (pI830->XvEnabled) { + if (pI830->noAccel) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Disabling Xv because it " + "needs 2D acceleration.\n"); + pI830->XvEnabled = FALSE; + } + if (pI830->OverlayMem.Physical == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling Xv because the overlay register buffer " + "allocation failed.\n"); + pI830->XvEnabled = FALSE; + } } - if (!miSetPixmapDepths()) return FALSE; +#endif + InitRegisterRec(pScrn); + #ifdef XF86DRI + /* + * pI830->directRenderingDisabled is set once in PreInit. Reinitialise + * pI830->directRenderingEnabled based on it each generation. + */ + pI830->directRenderingEnabled = !pI830->directRenderingDisabled; /* - * Setup DRI after visuals have been established, but before cfbScreenInit - * is called. cfbScreenInit will eventually call into the drivers + * Setup DRI after visuals have been established, but before fbScreenInit + * is called. fbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - if (!xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_NOACCEL, - FALSE) && - xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_DRI, TRUE)) { - pI810->directRenderingEnabled = I830DRIScreenInit(pScreen); - } else { - pI810->directRenderingEnabled = FALSE; + if (pI830->directRenderingEnabled) { + if (pI830->noAccel || pI830->SWCursor || pI830->StolenOnly) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it " + "needs HW cursor, 2D accel and AGPGART.\n"); + pI830->directRenderingEnabled = FALSE; + } } + + driDisabled = !pI830->directRenderingEnabled; + + if (pI830->directRenderingEnabled) + pI830->directRenderingEnabled = I830DRIScreenInit(pScreen); + + if (pI830->directRenderingEnabled) + if (!(pI830->directRenderingEnabled = I830Allocate3DMemory(pScrn, 0))) + I830DRICloseScreen(pScreen); + #else - pI810->directRenderingEnabled = FALSE; - if(!I810AllocateGARTMemory( pScrn )) + pI830->directRenderingEnabled = FALSE; +#endif + + /* + * After the 3D allocations have been done, see if there's any free space + * that can be added to the framebuffer allocation. + */ + I830Allocate2DMemory(pScrn, 0); + + DPRINTF(PFX, "assert(if(!I830DoPoolAllocation(pScrn, pI830->StolenPool)))\n"); + if (!I830DoPoolAllocation(pScrn, &(pI830->StolenPool))) return FALSE; - if(!I810AllocateFront(pScrn)) + + DPRINTF(PFX, "assert( if(!I830FixupOffsets(pScrn)) )\n"); + if (!I830FixupOffsets(pScrn)) return FALSE; + +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + I830SetupMemoryTiling(pScrn); + pI830->directRenderingEnabled = I830DRIDoMappings(pScreen); + } #endif - DPRINTF(PFX,"assert( if(!I810MapMem(pScrn)) )\n"); - if(!I810MapMem(pScrn)) return FALSE; + DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n"); + if (!I830MapMem(pScrn)) + return FALSE; - pScrn->memPhysBase = (unsigned long)pI810->FbBase; - pScrn->fbOffset = 0; + pScrn->memPhysBase = (unsigned long)pI830->FbBase; + pScrn->fbOffset = pI830->FrontBuffer.Start; - vgaHWSetMmioFuncs(hwp, pI810->MMIOBase, 0); + vgaHWSetMmioFuncs(hwp, pI830->MMIOBase, 0); vgaHWGetIOBase(hwp); - DPRINTF(PFX,"assert( if(!vgaHWMapMem(pScrn)) )\n"); - if(!vgaHWMapMem(pScrn)) return FALSE; + DPRINTF(PFX, "assert( if(!vgaHWMapMem(pScrn)) )\n"); + if (!vgaHWMapMem(pScrn)) + return FALSE; + + /* Clear SavedReg */ + memset(&pI830->SavedReg, 0, sizeof(pI830->SavedReg)); + + DPRINTF(PFX, "assert( if(!I830BIOSEnterVT(scrnIndex, 0)) )\n"); + if (!I830BIOSEnterVT(scrnIndex, 0)) + return FALSE; - /* Handle Setup of the mode here */ - DPRINTF(PFX,"assert( if(!(I830BIOSInitializeFirstMode(scrnIndex))) )\n"); - if(!(I830BIOSInitializeFirstMode(scrnIndex))) return FALSE; - - DPRINTF(PFX,"assert( if(!fbScreenInit(pScreen, ...) )\n"); - if(!fbScreenInit(pScreen, pI810->FbBase + pScrn->fbOffset, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) - return FALSE; + DPRINTF(PFX, "assert( if(!fbScreenInit(pScreen, ...) )\n"); + if (!fbScreenInit(pScreen, pI830->FbBase + pScrn->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel)) + return FALSE; - if(pScrn->bitsPerPixel > 8) { + if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; - while(--visual >= pScreen->visuals) { - if((visual->class | DynamicClass) == DirectColor) { + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { visual->offsetRed = pScrn->offset.red; visual->offsetGreen = pScrn->offset.green; visual->offsetBlue = pScrn->offset.blue; @@ -2198,42 +3062,26 @@ } } - xf86SetBlackWhitePixels(pScreen); + fbPictureInit(pScreen, 0, 0); -#ifdef XF86DRI - if(pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { - pI810->directRenderingEnabled = 0; - I830DRICloseScreen(pScreen); - } + xf86SetBlackWhitePixels(pScreen); - if(!pI810->directRenderingEnabled) { - pI810->DoneFrontAlloc = FALSE; - DPRINTF(PFX,"assert( if(!I810AllocateGARTMemory( pScrn )) )\n"); - if(!I810AllocateGARTMemory( pScrn )) - return FALSE; - DPRINTF(PFX,"assert( if(!I810AllocateFront(pScrn)) )\n"); - if(!I810AllocateFront(pScrn)) - return FALSE; - } +#if 1 + I830DGAInit(pScreen); #endif - I810DGAInit(pScreen); - - DPRINTF(PFX,"assert( if(!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) )\n"); - if(!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) { + DPRINTF(PFX, + "assert( if(!xf86InitFBManager(pScreen, &(pI830->FbMemBox))) )\n"); + if (!xf86InitFBManager(pScreen, &(pI830->FbMemBox))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to init memory manager\n"); + "Failed to init memory manager\n"); return FALSE; } - - if(!xf86ReturnOptValBool(I830BIOSOptions, OPTION_NOACCEL, FALSE)) { - if(pI810->LpRing.mem.Size != 0) { - I810SetRingRegs( pScrn ); - if(!I830AccelInit(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Hardware acceleration initialization failed\n"); - } + if (!pI830->noAccel) { + if (!I830AccelInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware acceleration initialization failed\n"); } } @@ -2242,278 +3090,497 @@ xf86SetSilkenMouse(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if(!xf86ReturnOptValBool(I830BIOSOptions, OPTION_SW_CURSOR, FALSE)) - { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Initializing HW Cursor\n"); - if(!I810CursorInit(pScreen)) - xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Hardware cursor initialization failed\n"); - } - else xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Initializing SW Cursor!\n"); + if (!pI830->SWCursor) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing HW Cursor\n"); + if (!I830CursorInit(pScreen)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + } else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing SW Cursor!\n"); - DPRINTF(PFX,"assert( if(!miCreateDefColormap(pScreen)) )\n"); - if(!miCreateDefColormap(pScreen)) return FALSE; + DPRINTF(PFX, "assert( if(!miCreateDefColormap(pScreen)) )\n"); + if (!miCreateDefColormap(pScreen)) + return FALSE; - DPRINTF(PFX,"assert( if(!vgaHWHandleColormaps(pScreen)) )\n"); - if(!vgaHWHandleColormaps(pScreen)) return FALSE; + DPRINTF(PFX, "assert( if(!xf86HandleColormaps(pScreen, ...)) )\n"); + if (!xf86HandleColormaps(pScreen, 256, 8, I830LoadPalette, 0, + CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } #ifdef DPMSExtension xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0); #endif - /* Init video here - Not supported as of yet */ +#ifdef I830_XV + /* Init video */ + if (pI830->XvEnabled) + I830InitVideo(pScreen); +#endif #ifdef XF86DRI - if(pI810->directRenderingEnabled) { - pI810->directRenderingEnabled = I830DRIFinishScreenInit(pScreen); - if(!pI810->directRenderingEnabled) { - pI810->agpAcquired2d = FALSE; - } + if (pI830->directRenderingEnabled) { + pI830->directRenderingEnabled = I830DRIFinishScreenInit(pScreen); } #endif - if(pI810->directRenderingEnabled) { +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + pI830->directRenderingOpen = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Enabled\n"); /* Setup 3D engine */ -#ifdef XF86DRI I830EmitInvarientState(pScrn); -#if 0 - I830EmitInvarientState2(pScrn); -#endif -#endif } else { - if(pI810->agpAcquired2d == TRUE) { + if (driDisabled) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Disabled\n"); - } else { + else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Failed\n"); - return FALSE; - } } - +#else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Not available\n"); +#endif + pScreen->SaveScreen = I830BIOSSaveScreen; - pI810->CloseScreen = pScreen->CloseScreen; + pI830->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = I830BIOSCloseScreen; if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); -/* +#if 0 #ifdef I830DEBUG - dump_registers (pScrn); + I830_dump_registers(pScrn); #endif -*/ - return TRUE; -} - -Bool -I830VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, Bool wait_retrace) -{ - I810Ptr pI810; - VESAPtr pVesa; - - pI810 = I810PTR(pScrn); - pVesa = pI810->vesa; - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f07; - pVesa->pInt->bx = wait_retrace ? 0x80 : 0x00; - pVesa->pInt->cx = x; - pVesa->pInt->dx = y; - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); +#endif - if(pVesa->pInt->ax != 0x4f) return FALSE; + pI830->starting = FALSE; + pI830->closing = FALSE; + pI830->suspended = FALSE; return TRUE; } -void +static void I830BIOSAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn; + I830Ptr pI830; + vbeInfoPtr pVbe; + static int xoffset = 0, yoffset = 0; + static int adjustGeneration = -1; pScrn = xf86Screens[scrnIndex]; - I830VESASetDisplayStart(pScrn, x, y, TRUE); + pI830 = I830PTR(pScrn); + pVbe = pI830->pVbe; + + DPRINTF(PFX, "I830BIOSAdjustFrame: y = %d (+ %d), x = %d (+ %d)\n", + x, xoffset, y, yoffset); + + /* Calculate the offsets once per server generation. */ + if (adjustGeneration != serverGeneration) { + adjustGeneration = serverGeneration; + xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth; + yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth; + } + + if (OffsetFrame) { + y = (pI830->FbMemBox.y2 - pScrn->currentMode->VDisplay); + ErrorF("AdjustFrame: OffsetFrame is set, setting y to %d\n", y); + } + x += xoffset; + y += yoffset; +#if 0 + x >>= 4; + x <<= 4; +#endif + VBESetDisplayStart(pVbe, x, y, TRUE); } -void +static void I830BIOSFreeScreen(int scrnIndex, int flags) { I830BIOSFreeRec(xf86Screens[scrnIndex]); if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) - vgaHWFreeHWRec(xf86Screens[scrnIndex]); + vgaHWFreeHWRec(xf86Screens[scrnIndex]); } -void -I830BIOSLeaveVT (int scrnIndex,int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - vgaHWPtr hwp = VGAHWPTR (pScrn); -#if defined(XF86DRI) || 0 - I810Ptr pI810 = I810PTR (pScrn); +#ifndef SAVERESTORE_HWSTATE +#define SAVERESTORE_HWSTATE 0 #endif - DPRINTF (PFX,"Leave VT\n"); +#if SAVERESTORE_HWSTATE +static void +SaveHWOperatingState(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830RegPtr save = &pI830->SavedReg; -#ifdef XF86DRI - if (pI810->directRenderingEnabled) { - DPRINTF (PFX,"calling dri lock\n"); - DRILock (screenInfo.screens[scrnIndex],0); - pI810->LockHeld = 1; - } + DPRINTF(PFX, "SaveHWOperatingState\n"); + + return; +} + +static void +RestoreHWOperatingState(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830RegPtr save = &pI830->SavedReg; + + DPRINTF(PFX, "RestoreHWOperatingState\n"); + + return; +} #endif -#if 0 - if (pI810->AccelInfoRec != NULL) { - DPRINTF (PFX,"syncing ring buffer\n"); - I810Sync (pScrn); - DO_RING_IDLE (); - } +static void +I830BIOSLeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; +#ifdef XF86DRI + I830Ptr pI830 = I830PTR(pScrn); #endif + + DPRINTF(PFX, "Leave VT\n"); - I830VESASaveRestore (pScrn,MODE_RESTORE); +#ifdef XF86DRI + if (pI830->directRenderingOpen) { + DPRINTF(PFX, "calling dri lock\n"); + DRILock(screenInfo.screens[scrnIndex], 0); + pI830->LockHeld = 1; + } +#endif - if (!I810UnbindGARTMemory (pScrn)) return; +#if SAVERESTORE_HWSTATE + if (!pI830->closing) + SaveHWOperatingState(pScrn); +#endif - vgaHWLock(hwp); + ResetState(pScrn, TRUE); + RestoreHWState(pScrn); + RestoreBIOSMemSize(pScrn); + I830UnbindGARTMemory(pScrn); } + +/* + * This gets called when gaining control of the VT, and from ScreenInit(). + */ +static Bool +I830BIOSEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + I830Ptr pI830 = I830PTR(pScrn); + static int SaveGeneration = -1; -Bool -I830BIOSEnterVT (int scrnIndex,int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - I810Ptr pI810 = I810PTR (pScrn); + DPRINTF(PFX, "Enter VT\n"); - DPRINTF (PFX,"Enter VT\n"); + if (!I830BindGARTMemory(pScrn)) + return FALSE; - if (!I810BindGARTMemory (pScrn)) return FALSE; + CheckInheritedState(pScrn); + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); -#ifdef XF86DRI - if (pI810->directRenderingEnabled) { - DPRINTF (PFX,"calling dri unlock\n"); - DRIUnlock (screenInfo.screens[scrnIndex]); - pI810->LockHeld = 0; - } + /* + * Only save state once per server generation since that's what most + * drivers do. Could change this to save state at each VT enter. + */ + if (SaveGeneration != serverGeneration) { + SaveGeneration = serverGeneration; + SaveHWState(pScrn); + } + ResetState(pScrn, FALSE); + SetHWOperatingState(pScrn); + +#if 1 + /* Clear the framebuffer */ + memset(pI830->FbBase + pScrn->fbOffset, 0, + pScrn->virtualY * pScrn->displayWidth * pI830->cpp); #endif - /* FIXME: Is this really necessary? */ -#if 0 - VESAPtr pVesa = pI810->vesa; - /* Switch to configured display device */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x5f64; - pVesa->pInt->bx = 0x0001; - pVesa->pInt->cx = (CARD16) pI810->configured_device; - xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); - - if (pVesa->pInt->ax != 0x005f) { - xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Failed to switch to configured display device\n"); - return FALSE; - } + if (!I830VESASetMode(pScrn, pScrn->currentMode)) + return FALSE; +#ifdef I830_XV + I830VideoSwitchModeAfter(pScrn, pScrn->currentMode); #endif - if (!I830VESASetMode (pScrn,pScrn->currentMode)) - return FALSE; + ResetState(pScrn, TRUE); + SetHWOperatingState(pScrn); - I830BIOSAdjustFrame (scrnIndex,pScrn->frameX0,pScrn->frameY0,0); + pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); -#if 1 - if (pI810->AccelInfoRec != NULL) { - DPRINTF (PFX,"syncing ring buffer\n"); - I810Sync (pScrn); - DO_RING_IDLE (); - } +#if SAVERESTORE_HWSTATE + RestoreHWOperatingState(pScrn); +#endif + +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + if (!pI830->starting) { + I830EmitInvarientState(pScrn); + I830RefreshRing(pScrn); + I830Sync(pScrn); + DO_RING_IDLE(); + + DPRINTF(PFX, "calling dri unlock\n"); + DRIUnlock(screenInfo.screens[scrnIndex]); + } + pI830->LockHeld = 0; + } #endif - return TRUE; + return TRUE; } -Bool +static Bool I830BIOSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - DPRINTF (PFX,"mode == %s\n",mode); - return I830VESASetMode(xf86Screens[scrnIndex], mode); + + int _head; + int _tail; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + I830Ptr pI830 = I830PTR(pScrn); + int ret = TRUE; + + DPRINTF(PFX, "I830BIOSSwitchMode: mode == %p\n", mode); + + /* Stops head pointer freezes for 845G */ + if (!pI830->noAccel && (1 || IS_845G(pI830))) { + do { + _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; + DELAY(1000); + } while (_head != _tail); + } + +#if 0 + OffsetFrame = !OffsetFrame; + pScrn->AdjustFrame(scrnIndex, 0, 0, 0); +#endif + +#ifndef BINDUNBIND +#define BINDUNBIND 0 +#endif +#if BINDUNBIND + I830UnbindGARTMemory(pScrn); +#endif +#ifdef I830_XV + /* Give the video overlay code a chance to see the new mode. */ + I830VideoSwitchModeBefore(pScrn, mode); +#endif + if (!I830VESASetMode(pScrn, mode)) + ret = FALSE; +#ifdef I830_XV + /* Give the video overlay code a chance to see the new mode. */ + I830VideoSwitchModeAfter(pScrn, mode); +#endif +#if BINDUNBIND + I830BindGARTMemory(pScrn); +#endif + + return ret; } -Bool -I830BIOSSaveScreen(ScreenPtr pScreen, Bool unblack) +static Bool +I830BIOSSaveScreen(ScreenPtr pScreen, int mode) { - return vgaHWSaveScreen(pScreen, unblack); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + Bool on = xf86IsUnblank(mode); + CARD32 temp, ctrl, base, i; + + DPRINTF(PFX, "I830BIOSSaveScreen: %d, on is %s\n", mode, BOOLTOSTRING(on)); + + for (i = 0; i < MAX_DISPLAY_PIPES; i++) { + if (i == 0) { + ctrl = DSPACNTR; + base = DSPABASE; + } else { + ctrl = DSPBCNTR; + base = DSPBADDR; + } + if (pI830->planeEnabled[i]) { + temp = INREG(ctrl); + if (on) + temp |= DISPLAY_PLANE_ENABLE; + else + temp &= ~DISPLAY_PLANE_ENABLE; + OUTREG(ctrl, temp); + /* Flush changes */ + temp = INREG(base); + OUTREG(base, temp); + } + } + + if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) { + if (on) + pI830->CursorInfoRec->ShowCursor(pScrn); + else + pI830->CursorInfoRec->HideCursor(pScrn); + pI830->cursorOn = TRUE; + } + + return TRUE; } +/* Use the VBE version when available. */ static void I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, - int flags) + int flags) { - I810Ptr pI810 = I810PTR(pScrn); - VESAPtr pVesa = pI810->vesa; + I830Ptr pI830 = I830PTR(pScrn); + vbeInfoPtr pVbe = pI830->pVbe; - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f10; - - switch (PowerManagementMode) { - case DPMSModeOn: pVesa->pInt->bx = 0x0001; break; - case DPMSModeStandby: pVesa->pInt->bx = 0x0101; break; - case DPMSModeSuspend: pVesa->pInt->bx = 0x0201; break; - case DPMSModeOff: pVesa->pInt->bx = 0x0401; break; - default: pVesa->pInt->bx = 0x0001; break; + if (xf86LoaderCheckSymbol("VBEDPMSSet")) { + VBEDPMSSet(pVbe, PowerManagementMode); + } else { + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f10; + pVbe->pInt10->bx = 0x01; + + switch (PowerManagementMode) { + case DPMSModeOn: + break; + case DPMSModeStandby: + pVbe->pInt10->bx |= 0x0100; + break; + case DPMSModeSuspend: + pVbe->pInt10->bx |= 0x0200; + break; + case DPMSModeOff: + pVbe->pInt10->bx |= 0x0400; + break; + } + xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); } - - xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); } -Bool +static Bool I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - vgaHWPtr hwp = VGAHWPTR(pScrn); - I810Ptr pI810 = I810PTR(pScrn); - VESAPtr pVesa = pI810->vesa; - XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; + I830Ptr pI830 = I830PTR(pScrn); + XAAInfoRecPtr infoPtr = pI830->AccelInfoRec; + pI830->closing = TRUE; #ifdef XF86DRI - if (pI810->directRenderingEnabled) { - I830DRICloseScreen(pScreen); - pI810->directRenderingEnabled = FALSE; + if (pI830->directRenderingOpen) { + pI830->directRenderingOpen = FALSE; + I830DRICloseScreen(pScreen); } #endif if (pScrn->vtSema == TRUE) { - if(pI810->AccelInfoRec) { - I810Sync(pScrn); - DO_RING_IDLE(); - } - I830VESASaveRestore(pScrn, MODE_RESTORE); - I830VESASetGetPaletteData(pScrn, TRUE, 0, 256, - pVesa->savedPal, FALSE, TRUE); - I810UnbindGARTMemory(pScrn); - vgaHWLock(hwp); + I830BIOSLeaveVT(scrnIndex, 0); } - I810UnmapMem(pScrn); + DPRINTF(PFX, "\nUnmapping memory\n"); + I830UnmapMem(pScrn); vgaHWUnmapMem(pScrn); - if(pI810->ScanlineColorExpandBuffers) { - xfree(pI810->ScanlineColorExpandBuffers); - pI810->ScanlineColorExpandBuffers = 0; + if (pI830->ScanlineColorExpandBuffers) { + xfree(pI830->ScanlineColorExpandBuffers); + pI830->ScanlineColorExpandBuffers = 0; } - if(infoPtr) { - if(infoPtr->ScanlineColorExpandBuffers) - xfree(infoPtr->ScanlineColorExpandBuffers); + if (infoPtr) { + if (infoPtr->ScanlineColorExpandBuffers) + xfree(infoPtr->ScanlineColorExpandBuffers); XAADestroyInfoRec(infoPtr); - pI810->AccelInfoRec=0; + pI830->AccelInfoRec = NULL; } - if(pI810->CursorInfoRec) { - xf86DestroyCursorInfoRec(pI810->CursorInfoRec); - pI810->CursorInfoRec=0; + if (pI830->CursorInfoRec) { + xf86DestroyCursorInfoRec(pI830->CursorInfoRec); + pI830->CursorInfoRec = 0; } - /* Free all allocated video ram. - */ - pI810->SysMem = pI810->SavedSysMem; - pI810->DcacheMem = pI810->SavedDcacheMem; - pI810->DoneFrontAlloc = FALSE; - xf86GARTCloseScreen(scrnIndex); + + pScrn->vtSema = FALSE; + pI830->closing = FALSE; + pScreen->CloseScreen = pI830->CloseScreen; + return (*pScreen->CloseScreen) (scrnIndex, pScreen); +} + +static int +I830ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +{ + if (mode->Flags & V_INTERLACE) { + if (verbose) { + xf86DrvMsg(scrnIndex, X_PROBED, + "Removing interlaced mode \"%s\"\n", mode->name); + } + return MODE_BAD; + } + return MODE_OK; +} + +#ifndef SUSPEND_SLEEP +#define SUSPEND_SLEEP 0 +#endif +#ifndef RESUME_SLEEP +#define RESUME_SLEEP 0 +#endif + +/* + * This function is only required if we need to do anything differently from + * DoApmEvent() in common/xf86PM.c, including if we want to see events other + * than suspend/resume. + */ +static Bool +I830PMEvent(int scrnIndex, pmEvent event, Bool undo) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + I830Ptr pI830 = I830PTR(pScrn); - pScrn->vtSema=FALSE; - pScreen->CloseScreen = pI810->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + DPRINTF(PFX, "Enter VT, event %d, undo: %s\n", event, BOOLTOSTRING(undo)); + + switch(event) { + case XF86_APM_SYS_SUSPEND: + case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend?*/ + case XF86_APM_USER_SUSPEND: + case XF86_APM_SYS_STANDBY: + case XF86_APM_USER_STANDBY: + if (!undo && !pI830->suspended) { + pScrn->LeaveVT(scrnIndex, 0); + pI830->suspended = TRUE; + sleep(SUSPEND_SLEEP); + } else if (undo && pI830->suspended) { + sleep(RESUME_SLEEP); + pScrn->EnterVT(scrnIndex, 0); + pI830->suspended = FALSE; + } + break; + case XF86_APM_STANDBY_RESUME: + case XF86_APM_NORMAL_RESUME: + case XF86_APM_CRITICAL_RESUME: + if (pI830->suspended) { + sleep(RESUME_SLEEP); + pScrn->EnterVT(scrnIndex, 0); + pI830->suspended = FALSE; + /* + * Turn the screen saver off when resuming. This seems to be + * needed to stop xscreensaver kicking in (when used). + * + * XXX DoApmEvent() should probably call this just like + * xf86VTSwitch() does. Maybe do it here only in 4.2 + * compatibility mode. + */ + SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); + } + break; + default: + ErrorF("I830PMEvent: received APM event %d\n", event); + } + return TRUE; } +void +I830InitpScrn(ScrnInfoPtr pScrn) +{ + pScrn->PreInit = I830BIOSPreInit; + pScrn->ScreenInit = I830BIOSScreenInit; + pScrn->SwitchMode = I830BIOSSwitchMode; + pScrn->AdjustFrame = I830BIOSAdjustFrame; + pScrn->EnterVT = I830BIOSEnterVT; + pScrn->LeaveVT = I830BIOSLeaveVT; + pScrn->FreeScreen = I830BIOSFreeScreen; + pScrn->ValidMode = I830ValidMode; + pScrn->PMEvent = I830PMEvent; +} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_memory.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_memory.c:1.6 --- /dev/null Thu Feb 27 12:30:50 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_memory.c Fri Feb 7 21:26:56 2003 @@ -0,0 +1,1458 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_memory.c,v 1.6 2003/02/08 02:26:56 dawes Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 by David Dawes. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * David Dawes <dawes@tungstengraphics.com> + * + */ + +#include "xf86.h" +#include "xf86_ansic.h" +#include "xf86_OSproc.h" + +#include "i830.h" +#include "i810_reg.h" + +/* + * Allocate memory from the given pool. Grow the pool if needed and if + * possible. + */ +static unsigned long +AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, + unsigned long size, unsigned long alignment, int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long needed, start, end; + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + + if (!result || !pool || !size) + return 0; + + /* Calculate how much space is needed. */ + if (alignment <= GTT_PAGE_SIZE) + needed = size; + else { + if (flags & ALLOCATE_AT_BOTTOM) { + start = ROUND_TO(pool->Free.Start, alignment); + if (flags & ALIGN_BOTH_ENDS) + end = ROUND_TO(start + size, alignment); + else + end = start + size; + needed = end - pool->Free.Start; + } else { /* allocate at top */ + if (flags & ALIGN_BOTH_ENDS) + end = ROUND_DOWN_TO(pool->Free.End, alignment); + else + end = pool->Free.End; + + start = ROUND_DOWN_TO(end - size, alignment); + needed = pool->Free.End - start; + } + } + if (needed > pool->Free.Size) { + unsigned long extra; + /* See if the pool can be grown. */ + if (pI830->StolenOnly && !dryrun) + return 0; + extra = needed - pool->Free.Size; + extra = ROUND_TO_PAGE(extra); + if (extra > pI830->FreeMemory) { + if (dryrun) + pI830->FreeMemory = extra; + else + return 0; + } + + if (!dryrun && (extra > pI830->MemoryAperture.Size)) + return 0; + + pool->Free.Size += extra; + pool->Free.End += extra; + pool->Total.Size += extra; + pool->Total.End += extra; + pI830->FreeMemory -= extra; + pI830->MemoryAperture.Start += extra; + pI830->MemoryAperture.Size -= extra; + } + if (flags & ALLOCATE_AT_BOTTOM) { + result->Start = ROUND_TO(pool->Free.Start, alignment); + pool->Free.Start += needed; + result->End = pool->Free.Start; + } else { + result->Start = ROUND_DOWN_TO(pool->Free.End - size, alignment) - + pool->Total.End; + result->End = pool->Free.End - pool->Total.End; + pool->Free.End -= needed; + } + pool->Free.Size = pool->Free.End - pool->Free.Start; + result->Size = result->End - result->Start; + result->Pool = pool; + result->Alignment = alignment; + return needed; +} + +static unsigned long +AllocFromAGP(ScrnInfoPtr pScrn, I830MemRange *result, unsigned long size, + unsigned long alignment, int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long start, end; + unsigned long newApStart, newApEnd; + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + + if (!result || !size) + return 0; + + if ((flags & ALLOCATE_AT_BOTTOM) && pI830->StolenMemory.Size != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "AllocFromAGP(): can't allocate from " + "bottom when there is stolen memory\n"); + return 0; + } + + if (size > pI830->FreeMemory) { + if (dryrun) + pI830->FreeMemory = size; + else + return 0; + } + + /* Calculate offset */ + if (flags & ALLOCATE_AT_BOTTOM) { + start = ROUND_TO(pI830->MemoryAperture.Start, alignment); + if (flags & ALIGN_BOTH_ENDS) + end = ROUND_TO(start + size, alignment); + else + end = start + size; + newApStart = end; + newApEnd = pI830->MemoryAperture.End; + } else { + if (flags & ALIGN_BOTH_ENDS) + end = ROUND_DOWN_TO(pI830->MemoryAperture.End, alignment); + else + end = pI830->MemoryAperture.End; + start = ROUND_DOWN_TO(end - size, alignment); + newApStart = pI830->MemoryAperture.Start; + newApEnd = start; + } + + if (!dryrun) { + if (newApStart > newApEnd) + return 0; + + if (flags & NEED_PHYSICAL_ADDR) { + result->Key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 2, + &(result->Physical)); + } else { + result->Key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL); + } + if (result->Key == -1) + return 0; + } + + pI830->allocatedMemory += size; + pI830->MemoryAperture.Start = newApStart; + pI830->MemoryAperture.End = newApEnd; + pI830->MemoryAperture.Size = newApEnd - newApStart; + pI830->FreeMemory -= size; + result->Start = start; + result->End = start + size; + result->Size = size; + result->Offset = start; + result->Alignment = alignment; + result->Pool = NULL; + + return size; +} + + +unsigned long +I830AllocVidMem(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, + unsigned long size, unsigned long alignment, int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + + if (!result) + return 0; + + /* Make sure these are initialised. */ + result->Size = 0; + result->Key = -1; + + if (!size) { + return 0; + } + + switch (flags & FROM_MASK) { + case FROM_POOL_ONLY: + return AllocFromPool(pScrn, result, pool, size, alignment, flags); + case FROM_NEW_ONLY: + if (!dryrun && (pI830->StolenOnly || (pI830->FreeMemory <= 0))) + return 0; + return AllocFromAGP(pScrn, result, size, alignment, flags); + case FROM_ANYWHERE: + if ((!(flags & ALLOCATE_AT_BOTTOM) && (pI830->FreeMemory >= size)) || + (flags & NEED_PHYSICAL_ADDR)) + return AllocFromAGP(pScrn, result, size, alignment, flags); + else + return AllocFromPool(pScrn, result, pool, size, alignment, flags); + default: + /* Shouldn't happen. */ + return 0; + } +} + +static Bool +AllocateRingBuffer(ScrnInfoPtr pScrn, int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size, alloced; + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + int verbosity = dryrun ? 4 : 1; + const char *s = dryrun ? "[dryrun] " : ""; + + /* Clear ring buffer info */ + memset(&(pI830->LpRing), 0, sizeof(pI830->LpRing)); + pI830->LpRing.mem.Key = -1; + + if (pI830->noAccel) + return TRUE; + + /* Ring buffer */ + size = PRIMARY_RINGBUFFER_SIZE; + if (flags & FORCE_LOW) + flags |= FROM_POOL_ONLY | ALLOCATE_AT_BOTTOM; + else + flags |= FROM_ANYWHERE | ALLOCATE_AT_TOP; + + alloced = I830AllocVidMem(pScrn, &(pI830->LpRing.mem), + &(pI830->StolenPool), size, + GTT_PAGE_SIZE, flags); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate Ring Buffer space\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for the ring buffer at 0x%x\n", s, + alloced / 1024, pI830->LpRing.mem.Start); + pI830->LpRing.tail_mask = pI830->LpRing.mem.Size - 1; + return TRUE; +} + +#ifdef I830_XV +/* + * Note, the FORCE_LOW flag is currently not used or supported. + */ +static Bool +AllocateOverlay(ScrnInfoPtr pScrn, int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size, alloced; + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + int verbosity = dryrun ? 4 : 1; + const char *s = dryrun ? "[dryrun] " : ""; + + /* Clear overlay info */ + memset(&(pI830->OverlayMem), 0, sizeof(pI830->OverlayMem)); + pI830->OverlayMem.Key = -1; + + if (!pI830->XvEnabled) + return TRUE; + + /* + * The overlay register space needs a physical address in + * system memory. We get this from the agpgart module using + * a special memory type. + */ + + size = OVERLAY_SIZE; + if (flags & FORCE_LOW) + flags |= FROM_POOL_ONLY | ALLOCATE_AT_BOTTOM | NEED_PHYSICAL_ADDR; + else + flags |= FROM_ANYWHERE | ALLOCATE_AT_TOP | NEED_PHYSICAL_ADDR; + + alloced = I830AllocVidMem(pScrn, &(pI830->OverlayMem), + &(pI830->StolenPool), size, GTT_PAGE_SIZE, flags); + + /* + * XXX For testing only. Don't enable this unless you know how to set + * physBase. + */ + if (flags & FORCE_LOW) { + ErrorF("AllocateOverlay() doesn't support setting FORCE_LOW\n"); + return FALSE; + } + + if (!dryrun && (alloced < size)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate Overlay register space.\n"); + /* This failure isn't fatal. */ + } else { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for Overlay registers at 0x%x " + "(0x%08x).\n", s, + alloced / 1024, pI830->OverlayMem.Start, + pI830->OverlayMem.Physical); + } + return TRUE; +} +#endif + +static unsigned long +GetFreeSpace(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long extra = 0; + + /* First check for free space in StolenPool. */ + if (pI830->StolenPool.Free.Size > 0) + extra = pI830->StolenPool.Free.Size; + /* Next check for unallocated space. */ + if (pI830->FreeMemory > 0) + extra += pI830->FreeMemory; + + return extra; +} + +static Bool +IsTileable(int pitch) +{ + /* + * Allow tiling for pitches that are a power of 2 multiple of 128 bytes, + * up to 64 * 128 (= 8192) bytes. + */ + switch (pitch) { + case 128 * 1: + case 128 * 2: + case 128 * 4: + case 128 * 8: + case 128 * 16: + case 128 * 32: + case 128 * 64: + return TRUE; + default: + return FALSE; + } +} + +/* + * Allocate memory for 2D operation. This includes the (front) framebuffer, + * ring buffer, scratch memory, HW cursor. + */ + +Bool +I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size, alloced; + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + int verbosity = dryrun ? 4 : 1; + const char *s = dryrun ? "[dryrun] " : ""; + Bool tileable; + int align, alignflags; + + DPRINTF(PFX, "I830Allocate2DMemory: inital is %s\n", + BOOLTOSTRING(flags & ALLOC_INITIAL)); + + if (!pI830->StolenOnly && + (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex))) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "AGP GART support is either not available or cannot " + "be used.\n" + "\tMake sure your kernel has agpgart support or has the\n" + "\tagpgart module loaded.\n"); + } + return FALSE; + } + + + /* + * The I830 is slightly different from the I830/I815, it has no + * dcache and it has stolen memory by default in its gtt. All + * additional memory must go after it. + */ + + DPRINTF(PFX, + "size == %luk (%lu bytes == pScrn->videoRam)\n" + "pI830->StolenSize == %luk (%lu bytes)\n", + pScrn->videoRam, pScrn->videoRam * 1024, + pI830->StolenPool.Free.Size / 1024, + pI830->StolenPool.Free.Size); + + if (flags & ALLOC_INITIAL) { + unsigned long minspace, avail, lineSize; + int cacheLines, maxCacheLines; + + if (pI830->NeedRingBufferLow) + AllocateRingBuffer(pScrn, flags | FORCE_LOW); + + /* Clear everything first. */ + memset(&(pI830->FbMemBox), 0, sizeof(pI830->FbMemBox)); + memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer)); + pI830->FrontBuffer.Key = -1; + + pI830->FbMemBox.x1 = 0; + pI830->FbMemBox.x2 = pScrn->displayWidth; + pI830->FbMemBox.y1 = 0; + pI830->FbMemBox.y2 = pScrn->virtualY; + + /* + * Calculate how much framebuffer memory to allocate. For the + * initial allocation, calculate a reasonable minimum. This is + * enough for the virtual screen size, plus some pixmap cache + * space. + */ + + lineSize = pScrn->displayWidth * pI830->cpp; + minspace = lineSize * pScrn->virtualY; + avail = pScrn->videoRam * 1024; + maxCacheLines = (avail - minspace) / lineSize; + /* This shouldn't happen. */ + if (maxCacheLines < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal Error: " + "maxCacheLines < 0 in I830Allocate2DMemory()\n"); + maxCacheLines = 0; + } + if (maxCacheLines > (MAX_DISPLAY_HEIGHT - pScrn->virtualY)) + maxCacheLines = MAX_DISPLAY_HEIGHT - pScrn->virtualY; + + if (pI830->CacheLines >= 0) { + cacheLines = pI830->CacheLines; + } else { +#if 1 + /* Make sure there is enough for two DVD sized YUV buffers */ + cacheLines = (pScrn->depth == 24) ? 256 : 384; + if (pScrn->displayWidth <= 1024) + cacheLines *= 2; +#else + /* + * Make sure there is enough for two DVD sized YUV buffers. + * Make that 1.5MB, which is around what was allocated with + * the old algorithm + */ + cacheLines = (MB(1) + KB(512)) / pI830->cpp / pScrn->displayWidth; +#endif + } + if (cacheLines > maxCacheLines) + cacheLines = maxCacheLines; + + pI830->FbMemBox.y2 += cacheLines; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocating at least %d scanlines for pixmap cache\n", + s, cacheLines); + + tileable = !(flags & ALLOC_NO_TILING) && pI830->allowPageFlip && + IsTileable(pScrn->displayWidth * pI830->cpp); + if (tileable) { + align = KB(512); + alignflags = ALIGN_BOTH_ENDS; + } else { + align = KB(64); + alignflags = 0; + } + + size = lineSize * (pScrn->virtualY + cacheLines); + size = ROUND_TO_PAGE(size); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sInitial framebuffer allocation size: %d kByte\n", s, + size / 1024); + alloced = I830AllocVidMem(pScrn, &(pI830->FrontBuffer), + &(pI830->StolenPool), size, align, + flags | alignflags | + FROM_ANYWHERE | ALLOCATE_AT_BOTTOM); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate framebuffer.\n"); + } + return FALSE; + } + } else { + unsigned long lineSize; + unsigned long extra = 0; + unsigned long maxFb = 0; + + /* + * XXX Need to "free" up any 3D allocations if the DRI ended up + * and make them available for 2D. The best way to do this would + * be position all of those regions contiguously at the end of the + * StolenPool. + */ + extra = GetFreeSpace(pScrn); + + if (extra == 0) + return TRUE; + + maxFb = pI830->FrontBuffer.Size + extra; + lineSize = pScrn->displayWidth * pI830->cpp; + maxFb = ROUND_DOWN_TO(maxFb, lineSize); + if (maxFb > lineSize * MAX_DISPLAY_HEIGHT) + maxFb = lineSize * MAX_DISPLAY_HEIGHT; + if (maxFb > pI830->FrontBuffer.Size) { + unsigned long oldsize; + /* + * Sanity check -- the fb should be the last thing allocated at + * the bottom of the stolen pool. + */ + if (pI830->StolenPool.Free.Start != pI830->FrontBuffer.End) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal error in I830Allocate2DMemory():\n\t" + "Framebuffer isn't the last allocation at the bottom" + " of StolenPool\n\t(%x != %x).\n", + pI830->FrontBuffer.End, + pI830->StolenPool.Free.Start); + return FALSE; + } + /* + * XXX Maybe should have a "Free" function. This should be + * the only place where a region is resized, and we know that + * the fb is always at the bottom of the aperture/stolen pool, + * and is the only region that is allocated bottom-up. + * Allowing for more general realloction would require a smarter + * allocation system. + */ + oldsize = pI830->FrontBuffer.Size; + pI830->StolenPool.Free.Size += pI830->FrontBuffer.Size; + pI830->StolenPool.Free.Start -= pI830->FrontBuffer.Size; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sUpdated framebuffer allocation size from %d " + "to %d kByte\n", s, oldsize / 1024, maxFb / 1024); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sUpdated pixmap cache from %d scanlines to %d " + "scanlines\n", s, + oldsize / lineSize - pScrn->virtualY, + maxFb / lineSize - pScrn->virtualY); + pI830->FbMemBox.y2 = maxFb / lineSize; + tileable = !(flags & ALLOC_NO_TILING) && pI830->allowPageFlip && + IsTileable(pScrn->displayWidth * pI830->cpp); + if (tileable) { + align = KB(512); + alignflags = ALIGN_BOTH_ENDS; + } else { + align = KB(64); + alignflags = 0; + } + alloced = I830AllocVidMem(pScrn, &(pI830->FrontBuffer), + &(pI830->StolenPool), maxFb, align, + flags | alignflags | + FROM_ANYWHERE | ALLOCATE_AT_BOTTOM); + if (alloced < maxFb) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to re-allocate framebuffer\n"); + } + return FALSE; + } + } + return TRUE; + } + +#if REMAP_RESERVED + /* + * Allocate a dummy page to pass when attempting to rebind the + * pre-allocated region. + */ + if (!dryrun) { + memset(&(pI830->Dummy), 0, sizeof(pI830->Dummy)); + pI830->Dummy.Key = + xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL); + pI830->Dummy.Offset = 0; + } +#endif + + /* Clear cursor info */ + memset(&(pI830->CursorMem), 0, sizeof(pI830->CursorMem)); + pI830->CursorMem.Key = -1; + + if (!pI830->SWCursor) { + int cursFlags = 0; + /* + * Mouse cursor -- The i810-i830 need a physical address in system + * memory from which to upload the cursor. We get this from + * the agpgart module using a special memory type. + */ + + size = HWCURSOR_SIZE; + cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP; + if (pI830->CursorNeedsPhysical) + cursFlags |= NEED_PHYSICAL_ADDR; + + alloced = I830AllocVidMem(pScrn, &(pI830->CursorMem), + &(pI830->StolenPool), size, + GTT_PAGE_SIZE, flags | cursFlags); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate HW cursor space.\n"); + } + } else { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for HW cursor at 0x%x", s, + alloced / 1024, pI830->CursorMem.Start); + if (pI830->CursorNeedsPhysical) + xf86ErrorFVerb(verbosity, " (0x%08x)", pI830->CursorMem.Physical); + xf86ErrorFVerb(verbosity, "\n"); + } + } + +#ifdef I830_XV + AllocateOverlay(pScrn, flags); +#endif + + if (!pI830->NeedRingBufferLow) + AllocateRingBuffer(pScrn, flags); + + /* Clear scratch info */ + memset(&(pI830->Scratch), 0, sizeof(pI830->Scratch)); + pI830->Scratch.Key = -1; + + if (!pI830->noAccel) { + size = MAX_SCRATCH_BUFFER_SIZE; + alloced = I830AllocVidMem(pScrn, &(pI830->Scratch), &(pI830->StolenPool), + size, GTT_PAGE_SIZE, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + if (alloced < size) { + size = MIN_SCRATCH_BUFFER_SIZE; + alloced = I830AllocVidMem(pScrn, &(pI830->Scratch), + &(pI830->StolenPool), size, + GTT_PAGE_SIZE, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + } + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate scratch buffer space\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for the scratch buffer at 0x%x\n", s, + alloced / 1024, pI830->Scratch.Start); + } + return TRUE; +} + +#ifndef ALLOCATE_ALL_BIOSMEM +#define ALLOCATE_ALL_BIOSMEM 1 +#endif + +void +I830ResetAllocations(ScrnInfoPtr pScrn, const int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + + pI830->MemoryAperture.Start = pI830->StolenMemory.End; + pI830->MemoryAperture.End = pI830->FbMapSize; + pI830->MemoryAperture.Size = pI830->FbMapSize - pI830->StolenMemory.Size; + pI830->StolenPool.Fixed = pI830->StolenMemory; + pI830->StolenPool.Total = pI830->StolenMemory; +#if ALLOCATE_ALL_BIOSMEM + if (pI830->overrideBIOSMemSize && + pI830->BIOSMemorySize > pI830->StolenMemory.Size) { + pI830->StolenPool.Total.End = pI830->BIOSMemorySize; + pI830->StolenPool.Total.Size = pI830->BIOSMemorySize; + } +#endif + pI830->StolenPool.Free = pI830->StolenPool.Total; + pI830->FreeMemory = pI830->TotalVideoRam - pI830->StolenPool.Total.Size; + pI830->allocatedMemory = 0; +} + +long +I830GetExcessMemoryAllocations(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long allocated; + + allocated = pI830->StolenPool.Total.Size + pI830->allocatedMemory; + if (allocated > pI830->TotalVideoRam) + return allocated - pI830->TotalVideoRam; + else + return 0; +} + +#ifdef XF86DRI +static unsigned long +GetBestTileAlignment(unsigned long size) +{ + unsigned long i; + + for (i = KB(512); i < size; i <<= 1) + ; + + if (i > MB(64)) + i = MB(64); + + return i; +} + +static unsigned int +myLog2(unsigned int n) +{ + unsigned int log2 = 1; + + while (n > 1) { + n >>= 1; + log2++; + } + return log2; +} + +Bool +I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size, alloced, align = 0; + int i; + Bool tileable; + Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); + int verbosity = dryrun ? 4 : 1; + const char *s = dryrun ? "[dryrun] " : ""; + int lines; + + DPRINTF(PFX, "I830Allocate3DMemory\n"); + + /* Back Buffer */ + memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer)); + pI830->BackBuffer.Key = -1; + tileable = !(flags & ALLOC_NO_TILING) && + IsTileable(pScrn->displayWidth * pI830->cpp); + if (tileable) { + /* Make the height a multiple of the tile height (16) */ + lines = (pScrn->virtualY + 15) / 16 * 16; + } else { + lines = pScrn->virtualY; + } + + size = ROUND_TO_PAGE(pScrn->displayWidth * lines * pI830->cpp); + /* + * Try to allocate on the best tile-friendly boundaries. + */ + alloced = 0; + if (tileable) { + align = GetBestTileAlignment(size); + for (align = GetBestTileAlignment(size); align >= KB(512); align >>= 1) { + alloced = I830AllocVidMem(pScrn, &(pI830->BackBuffer), + &(pI830->StolenPool), size, align, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP | + ALIGN_BOTH_ENDS); + if (alloced >= size) + break; + } + } + if (alloced < size) { + /* Give up on trying to tile */ + tileable = FALSE; + size = ROUND_TO_PAGE(pScrn->displayWidth * pScrn->virtualY * pI830->cpp); + align = GTT_PAGE_SIZE; + alloced = I830AllocVidMem(pScrn, &(pI830->BackBuffer), + &(pI830->StolenPool), size, align, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + } + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate back buffer space.\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for the back buffer at 0x%x.\n", s, + alloced / 1024, pI830->BackBuffer.Start); + + /* Depth Buffer -- same size as the back buffer */ + memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer)); + pI830->DepthBuffer.Key = -1; + /* + * Try to allocate on the best tile-friendly boundaries. + */ + alloced = 0; + if (tileable) { + /* Start with the previous align value. */ + for (; align >= KB(512); align >>= 1) { + alloced = I830AllocVidMem(pScrn, &(pI830->DepthBuffer), + &(pI830->StolenPool), size, align, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP | + ALIGN_BOTH_ENDS); + if (alloced >= size) + break; + } + } + if (alloced < size) { + /* Give up on trying to tile */ + tileable = FALSE; + size = ROUND_TO_PAGE(pScrn->displayWidth * pScrn->virtualY * pI830->cpp); + align = GTT_PAGE_SIZE; + alloced = I830AllocVidMem(pScrn, &(pI830->DepthBuffer), + &(pI830->StolenPool), size, align, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + } + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate depth buffer space.\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for the depth buffer at 0x%x.\n", s, + alloced / 1024, pI830->DepthBuffer.Start); + + /* Space for logical context. 32k is fine for right now. */ + memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem)); + pI830->ContextMem.Key = -1; + size = KB(32); + alloced = I830AllocVidMem(pScrn, &(pI830->ContextMem), + &(pI830->StolenPool), size, GTT_PAGE_SIZE, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate logical context space.\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for the logical context at 0x%x.\n", s, + alloced / 1024, pI830->ContextMem.Start); + + /* + * Space for DMA buffers, only if there's enough free for at least 1MB + * of texture space. + */ + memset(&(pI830->BufferMem), 0, sizeof(pI830->BufferMem)); + pI830->BufferMem.Key = -1; + /* This should already be a page multiple */ + size = I830_DMA_BUF_NR * I830_DMA_BUF_SZ; + if (dryrun || (GetFreeSpace(pScrn) >= size + MB(1))) { + alloced = I830AllocVidMem(pScrn, &(pI830->BufferMem), + &(pI830->StolenPool), size, + GTT_PAGE_SIZE, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate DMA buffer space.\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for the DMA buffers at 0x%x.\n", s, + alloced / 1024, pI830->BufferMem.Start); + } else { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Not enough free space for DMA buffers.\n"); + } + return FALSE; + } + + /* Allocate the remaining space for textures. */ + memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem)); + pI830->TexMem.Key = -1; + size = GetFreeSpace(pScrn); + if (dryrun && (size < MB(1))) + size = MB(1); + i = myLog2(size / I830_NR_TEX_REGIONS); + if (i < I830_LOG_MIN_TEX_REGION_SIZE) + i = I830_LOG_MIN_TEX_REGION_SIZE; + pI830->TexGranularity = i; + /* Truncate size */ + size >>= i; + size <<= i; + if (size < KB(512)) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Less than %d kBytes for texture space.\n", size / 1024); + } + return FALSE; + } + alloced = I830AllocVidMem(pScrn, &(pI830->TexMem), + &(pI830->StolenPool), size, GTT_PAGE_SIZE, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate texture space.\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %d kB for textures at 0x%x\n", s, + alloced / 1024, pI830->TexMem.Start); + + return TRUE; +} +#endif + +/* Allocate pool space that isn't pre-allocated */ +Bool +I830DoPoolAllocation(ScrnInfoPtr pScrn, I830MemPool *pool) +{ + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830DoPoolAllocation\n"); + + if (!pool) + return FALSE; + + /* + * Sanity check: there shouldn't be an allocation required when + * there is only stolen memory. + */ + if (pI830->StolenOnly && (pool->Total.Size > pool->Fixed.Size)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "I830DoPoolAllocation(): pool size is greater than the " + "preallocated size,\n\t" + "and there is no allocatable memory.\n"); + return FALSE; + } + + if (pool->Total.Size > pool->Fixed.Size) { + pool->Allocated.Size = pool->Total.Size - pool->Fixed.Size; + pool->Allocated.Key = + xf86AllocateGARTMemory(pScrn->scrnIndex, pool->Allocated.Size, + 0, NULL); + if (pool->Allocated.Key == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Pool allocation failed\n"); + return FALSE; + } + pool->Allocated.Start = pool->Fixed.End; + pool->Allocated.End = pool->Total.Size; + pool->Allocated.Offset = pool->Allocated.Start; + } else + pool->Allocated.Key = -1; + return TRUE; +} + +static unsigned long topOfMem = 0; + +/* + * These modify the way memory is positioned within the aperture. + * + * By default, memory allocated from the bottom or specifically within + * the pool at the bottom gets allocated from the "stolen pool", which is + * actually the stolen memory plus any extra allocated to make it a larger + * contiguous region. Memory allocated from the AGP is allocated top-down + * from the end of the aperture space. Memory allocated "from top" defaults + * to AGP if there is enough "free space". The total allocation (stolen + + * extra) doesn't exceed the orignal pScrn->videoRam amount (this isn't true + * when memory allocated from AGP gets moved into the pool by one of the + * following options. + * + * XXX Write a better description. + * + */ +#define PACK_RANGES 0 +#define POOL_RANGES 0 + +static Bool +FixOffset(ScrnInfoPtr pScrn, I830MemRange *mem) +{ +#if POOL_RANGES + I830Ptr pI830 = I830PTR(pScrn); +#endif + + if (!mem) + return FALSE; + + if (mem->Pool && mem->Key == -1 && mem->Start < 0) { + mem->Start = mem->Pool->Total.End + mem->Start; + mem->End = mem->Start + mem->Size; + } +#if PACK_RANGES + /* + * Map AGP-allocated areas at the top of the stolen area, resulting in + * a contiguous region in the aperture. Normally most AGP-allocated areas + * will be at the top of the aperture, making alignment requirements + * easier to achieve. This optin is primarily for debugging purposes, + * and using this option can break any special alignment requirements. + */ + if (!mem->Pool && mem->Start != 0 && mem->Key != -1 && mem->Physical == 0 && + mem->Offset != 0) { + long diff; + if (mem->Offset != mem->Start) + ErrorF("mem %p, Offset != Start\n", mem); + diff = mem->Offset - topOfMem; + mem->Start -= diff; + mem->End -= diff; + mem->Offset -= diff; + topOfMem += mem->Size; + } +#elif POOL_RANGES + /* + * Move AGP-allocated regions (that don't need a physical address) into + * the pre-allocated pool when there's enough space to do so. Note: the + * AGP-allocated areas aren't freed. This option is primarily for + * debugging purposes, and using it can break any special alignment + * requirements. + */ + if (!mem->Pool && mem->Start >= pI830->StolenPool.Free.End && + mem->Key != -1 && mem->Physical == 0 && mem->Offset != 0 && + pI830->StolenPool.Free.Size >= mem->Size) { + long diff; + if (mem->Offset != mem->Start) + ErrorF("mem %p, Offset != Start\n", mem); + diff = mem->Offset - pI830->StolenPool.Free.Start; + mem->Start -= diff; + mem->End -= diff; + mem->Offset -= diff; + mem->Key = -1; + pI830->StolenPool.Free.Start += mem->Size; + pI830->StolenPool.Free.Size -= mem->Size; + } +#endif + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%p: Memory at offset 0x%08x, size %d kBytes\n", mem, + mem->Start, mem->Size / 1024); + return TRUE; +} + +Bool +I830FixupOffsets(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830FixupOffsets\n"); + + topOfMem = pI830->StolenPool.Total.End; + FixOffset(pScrn, &(pI830->FrontBuffer)); + FixOffset(pScrn, &(pI830->CursorMem)); + FixOffset(pScrn, &(pI830->LpRing.mem)); + FixOffset(pScrn, &(pI830->Scratch)); +#ifdef I830_XV + if (pI830->XvEnabled) { + FixOffset(pScrn, &(pI830->OverlayMem)); + } +#endif +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + FixOffset(pScrn, &(pI830->BackBuffer)); + FixOffset(pScrn, &(pI830->DepthBuffer)); + FixOffset(pScrn, &(pI830->ContextMem)); + FixOffset(pScrn, &(pI830->BufferMem)); + FixOffset(pScrn, &(pI830->TexMem)); + } +#endif + return TRUE; +} + +#ifdef XF86DRI +/* Tiled memory is good... really, really good... + * + * Need to make it less likely that we miss out on this - probably + * need to move the frontbuffer away from the 'guarenteed' alignment + * of the first memory segment, or perhaps allocate a discontigous + * framebuffer to get more alignment 'sweet spots'. + */ +static void +SetFence(ScrnInfoPtr pScrn, int nr, unsigned int start, unsigned int pitch, + unsigned int size) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830RegPtr i830Reg = &pI830->ModeReg; + CARD32 val; + CARD32 fence_mask = 0; + + DPRINTF(PFX, "SetFence: %d, 0x%08x, %d, %d kByte\n", + nr, start, pitch, size / 1024); + + if (nr < 0 || nr > 7) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "SetFence: fence %d out of range\n"); + return; + } + + i830Reg->Fence[nr] = 0; + + fence_mask = ~I830_FENCE_START_MASK; + + if (start & fence_mask) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "SetFence: %d: start (0x%08x) is not 512k aligned\n", + nr, start); + return; + } + + if (start % size) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "SetFence: %d: start (0x%08x) is not size (%dk) aligned\n", + nr, start, size / 1024); + return; + } + + if (pitch & 127) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "SetFence: %d: pitch (%d) not a multiple of 128 bytes\n", + nr, pitch); + return; + } + + val = (start | FENCE_X_MAJOR | FENCE_VALID); + + switch (size) { + case KB(512): + val |= FENCE_SIZE_512K; + break; + case MB(1): + val |= FENCE_SIZE_1M; + break; + case MB(2): + val |= FENCE_SIZE_2M; + break; + case MB(4): + val |= FENCE_SIZE_4M; + break; + case MB(8): + val |= FENCE_SIZE_8M; + break; + case MB(16): + val |= FENCE_SIZE_16M; + break; + case MB(32): + val |= FENCE_SIZE_32M; + break; + case MB(64): + val |= FENCE_SIZE_64M; + break; + default: + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); + return; + } + + switch (pitch / 128) { + case 1: + val |= FENCE_PITCH_1; + break; + case 2: + val |= FENCE_PITCH_2; + break; + case 4: + val |= FENCE_PITCH_4; + break; + case 8: + val |= FENCE_PITCH_8; + break; + case 16: + val |= FENCE_PITCH_16; + break; + case 32: + val |= FENCE_PITCH_32; + break; + case 64: + val |= FENCE_PITCH_64; + break; + default: + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "SetFence: %d: illegal pitch (%d)\n", nr, pitch); + return; + } + + i830Reg->Fence[nr] = val; +} + +static Bool +MakeTiles(ScrnInfoPtr pScrn, I830MemRange *pMem) +{ + I830Ptr pI830 = I830PTR(pScrn); + int pitch, ntiles, i; + static int nextTile = 0; + static int tileGeneration = -1; + +#if 0 + /* Hack to "improve" the alignment of the front buffer. + */ + while (!(pMem->Start & ~pMem->Alignment) && pMem->Alignment < 0x00400000 ) + pMem->Alignment <<= 1; +#endif + + if (tileGeneration != serverGeneration) { + tileGeneration = serverGeneration; + nextTile = 0; + } + + pitch = pScrn->displayWidth * pI830->cpp; + /* + * Simply try to break the region up into at most four pieces of size + * equal to the alignment. + */ + ntiles = ROUND_TO(pMem->Size, pMem->Alignment) / pMem->Alignment; + if (ntiles >= 4) { + return FALSE; + } + + for (i = 0; i < ntiles; i++, nextTile++) { + SetFence(pScrn, nextTile, pMem->Start + i * pMem->Alignment, + pitch, pMem->Alignment); + } + return TRUE; +} + +void +I830SetupMemoryTiling(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + /* We currently only attempt to tile the back and depth buffers. */ + if (!pI830->directRenderingEnabled) + return; + + if (!IsTileable(pScrn->displayWidth * pI830->cpp)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "I830SetupMemoryTiling: Not tileable 0x%x\n", + pScrn->displayWidth * pI830->cpp); + pI830->allowPageFlip = FALSE; + return; + } + + if (pI830->allowPageFlip) { + if (pI830->allowPageFlip && pI830->FrontBuffer.Alignment >= KB(512)) { + if (MakeTiles(pScrn, &(pI830->FrontBuffer))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Activating tiled memory for the FRONT buffer\n"); + } else { + pI830->allowPageFlip = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "MakeTiles failed for the FRONT buffer\n"); + } + } else { + pI830->allowPageFlip = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Alignment bad for the FRONT buffer\n"); + } + } + + /* + * We tried to get the best alignment during the allocation. Check + * the alignment values to tell. If well-aligned allocations were + * successful, the address range reserved is a multiple of the align + * value. + */ + if (pI830->BackBuffer.Alignment >= KB(512)) { + if (MakeTiles(pScrn, &(pI830->BackBuffer))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Activating tiled memory for the back buffer.\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "MakeTiles failed for the back buffer.\n"); + pI830->allowPageFlip = FALSE; + } + } + + if (pI830->DepthBuffer.Alignment >= KB(512)) { + if (MakeTiles(pScrn, &(pI830->DepthBuffer))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Activating tiled memory for the depth buffer.\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "MakeTiles failed for the back buffer.\n"); + } + } + +} +#endif /* XF86DRI */ + +static Bool +BindMemRange(ScrnInfoPtr pScrn, I830MemRange *mem) +{ + if (!mem) + return FALSE; + + if (mem->Key == -1) + return TRUE; + + return xf86BindGARTMemory(pScrn->scrnIndex, mem->Key, mem->Offset); +} + +Bool +I830BindGARTMemory(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, + "I830BindGARTMemory: StolenOnly is %s, pI830->GttBound is %s\n", + BOOLTOSTRING(pI830->StolenOnly), BOOLTOSTRING(pI830->GttBound)); + + if (pI830->StolenOnly == TRUE) + return TRUE; + + if (xf86AgpGARTSupported() && !pI830->GttBound) { + if (!xf86AcquireGART(pScrn->scrnIndex)) + return FALSE; + +#if REMAP_RESERVED + /* Rebind the pre-allocated region. */ + BindMemRange(pScrn, &(pI830->Dummy)); +#endif + + if (!BindMemRange(pScrn, &(pI830->StolenPool.Allocated))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->FrontBuffer))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->CursorMem))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->LpRing.mem))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->Scratch))) + return FALSE; +#ifdef I830_XV + if (!BindMemRange(pScrn, &(pI830->OverlayMem))) + return FALSE; +#endif +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + if (!BindMemRange(pScrn, &(pI830->BackBuffer))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->DepthBuffer))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->ContextMem))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->BufferMem))) + return FALSE; + if (!BindMemRange(pScrn, &(pI830->TexMem))) + return FALSE; + } +#endif + pI830->GttBound = 1; + } + + return TRUE; +} + +static Bool +UnbindMemRange(ScrnInfoPtr pScrn, I830MemRange *mem) +{ + if (!mem) + return FALSE; + + if (mem->Key == -1) + return TRUE; + + return xf86UnbindGARTMemory(pScrn->scrnIndex, mem->Key); +} + + +Bool +I830UnbindGARTMemory(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, + "I830UnbindGARTMemory: StolenOnly is %s, pI830->GttBound is %s\n", + BOOLTOSTRING(pI830->StolenOnly), BOOLTOSTRING(pI830->GttBound)); + + if (pI830->StolenOnly == TRUE) + return TRUE; + + if (xf86AgpGARTSupported() && pI830->GttBound) { + +#if REMAP_RESERVED + /* "unbind" the pre-allocated region. */ + UnbindMemRange(pScrn, &(pI830->Dummy)); +#endif + + if (!UnbindMemRange(pScrn, &(pI830->StolenPool.Allocated))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->FrontBuffer))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->CursorMem))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->LpRing.mem))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->Scratch))) + return FALSE; +#ifdef I830_XV + if (!UnbindMemRange(pScrn, &(pI830->OverlayMem))) + return FALSE; +#endif +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + if (!UnbindMemRange(pScrn, &(pI830->BackBuffer))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->DepthBuffer))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->ContextMem))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->BufferMem))) + return FALSE; + if (!UnbindMemRange(pScrn, &(pI830->TexMem))) + return FALSE; + } +#endif + if (!xf86ReleaseGART(pScrn->scrnIndex)) + return FALSE; + + pI830->GttBound = 0; + } + + return TRUE; +} + +long +I830CheckAvailableMemory(ScrnInfoPtr pScrn) +{ + AgpInfoPtr agpinf; + int maxPages; + + if (!xf86AgpGARTSupported() || + !xf86AcquireGART(pScrn->scrnIndex) || + (agpinf = xf86GetAGPInfo(pScrn->scrnIndex)) == NULL || + !xf86ReleaseGART(pScrn->scrnIndex)) + return -1; + + maxPages = agpinf->totalPages - agpinf->usedPages; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "%s: %d kB available\n", + "I830CheckAvailableMemory", maxPages * 4); + + return maxPages * 4; +} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c:1.6 --- /dev/null Thu Feb 27 12:30:50 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c Wed Feb 5 23:18:05 2003 @@ -0,0 +1,1840 @@ +#define VIDEO_DEBUG 0 +/*************************************************************************** + +Copyright 2000 Intel Corporation. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c,v 1.6 2003/02/06 04:18:05 dawes Exp $ */ + +/* + * Reformatted with GNU indent (2.2.8), using the following options: + * + * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 + * -lp -npcs -psl -sob -ss -br -ce -sc -hnl + * + * This provides a good match with the original i810 code and preferred + * XFree86 formatting conventions. + * + * When editing this driver, please follow the existing formatting, and edit + * with <TAB> characters expanded at 8-column intervals. + */ + +/* + * i830_video.c: i830/i845 Xv driver. + * + * Copyright © 2002 by Alan Hourihane and David Dawes + * + * Authors: + * Alan Hourihane <alanh@tungstengraphics.com> + * David Dawes <dawes@tungstengraphics.com> + * + * Derived from i810 Xv driver: + * + * Authors of i810 code: + * Jonathan Bian <jonathan.bian@intel.com> + * Offscreen Images: + * Matt Sottek <matthew.j.sottek@intel.com> + */ + +/* + * XXX Could support more formats. + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "i830.h" +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +#ifndef USE_USLEEP_FOR_VIDEO +#define USE_USLEEP_FOR_VIDEO 0 +#endif + +#define OFF_DELAY 250 /* milliseconds */ +#define FREE_DELAY 15000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +static void I830InitOffscreenImages(ScreenPtr); + +static XF86VideoAdaptorPtr I830SetupImageVideo(ScreenPtr); +static void I830StopVideo(ScrnInfoPtr, pointer, Bool); +static int I830SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int I830GetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); +static void I830QueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, + unsigned int *, pointer); +static int I830PutImage(ScrnInfoPtr, short, short, short, short, short, short, + short, short, int, unsigned char *, short, short, + Bool, RegionPtr, pointer); +static int I830QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); + +static void I830BlockHandler(int, pointer, pointer, pointer); + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey; + +#define IMAGE_MAX_WIDTH 1440 +#define IMAGE_MAX_HEIGHT 1080 +#define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT) + +#if !VIDEO_DEBUG +#define ErrorF Edummy +static void +Edummy(const char *dummy, ...) +{ +} +#endif + +/* + * This is more or less the correct way to initalise, update, and shut down + * the overlay. Note OVERLAY_OFF should be used only after disabling the + * overlay in OCMD and calling OVERLAY_UPDATE. + * + * XXX Need to make sure that the overlay engine is cleanly shutdown in + * all modes of server exit. + */ + +#define OVERLAY_UPDATE \ + do { \ + BEGIN_LP_RING(6); \ + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); \ + OUT_RING(MI_NOOP); \ + if (!pI830->overlayOn) { \ + OUT_RING(MI_NOOP); \ + OUT_RING(MI_NOOP); \ + OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_ON); \ + ErrorF("Overlay goes from off to on\n"); \ + pI830->overlayOn = TRUE; \ + } else { \ + OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); \ + OUT_RING(MI_NOOP); \ + OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_CONTINUE); \ + } \ + OUT_RING(pI830->OverlayMem.Physical | 1); \ + ADVANCE_LP_RING(); \ + ErrorF("OVERLAY_UPDATE\n"); \ + } while(0) + +#define OVERLAY_OFF \ + do { \ + if (pI830->overlayOn) { \ + BEGIN_LP_RING(8); \ + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); \ + OUT_RING(MI_NOOP); \ + OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); \ + OUT_RING(MI_NOOP); \ + OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_OFF); \ + OUT_RING(pI830->OverlayMem.Physical); \ + OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); \ + OUT_RING(MI_NOOP); \ + ADVANCE_LP_RING(); \ + pI830->overlayOn = FALSE; \ + ErrorF("Overlay goes from on to off\n"); \ + ErrorF("OVERLAY_OFF\n"); \ + } \ + } while(0) + +/* + * OCMD - Overlay Command Register + */ +#define MIRROR_MODE (0x3<<17) +#define MIRROR_HORIZONTAL (0x1<<17) +#define MIRROR_VERTICAL (0x2<<17) +#define MIRROR_BOTH (0x3<<17) +#define OV_BYTE_ORDER (0x3<<14) +#define UV_SWAP (0x1<<14) +#define Y_SWAP (0x2<<14) +#define Y_AND_UV_SWAP (0x3<<14) +#define SOURCE_FORMAT (0xf<<10) +#define RGB_888 (0x1<<10) +#define RGB_555 (0x2<<10) +#define RGB_565 (0x3<<10) +#define YUV_422 (0x8<<10) +#define YUV_411 (0x9<<10) +#define YUV_420 (0xc<<10) +#define YUV_422_PLANAR (0xd<<10) +#define YUV_410 (0xe<<10) +#define TVSYNC_FLIP_PARITY (0x1<<9) +#define TVSYNC_FLIP_ENABLE (0x1<<7) +#define BUF_TYPE (0x1<<5) +#define BUF_TYPE_FRAME (0x0<<5) +#define BUF_TYPE_FIELD (0x1<<5) +#define TEST_MODE (0x1<<4) +#define BUFFER_SELECT (0x3<<2) +#define BUFFER0 (0x0<<2) +#define BUFFER1 (0x1<<2) +#define FIELD_SELECT (0x1<<1) +#define FIELD0 (0x0<<1) +#define FIELD1 (0x1<<1) +#define OVERLAY_ENABLE 0x1 + +/* OCONFIG register */ +#define CC_OUT_8BIT (0x1<<3) +#define OVERLAY_PIPE_MASK (0x1<<18) +#define OVERLAY_PIPE_A (0x0<<18) +#define OVERLAY_PIPE_B (0x1<<18) + +/* DCLRKM register */ +#define DEST_KEY_ENABLE (0x1<<31) + +/* Polyphase filter coefficients */ +#define N_HORIZ_Y_TAPS 5 +#define N_VERT_Y_TAPS 3 +#define N_HORIZ_UV_TAPS 3 +#define N_VERT_UV_TAPS 3 +#define N_PHASES 17 +#define MAX_TAPS 5 + +/* Filter cutoff frequency limits. */ +#define MIN_CUTOFF_FREQ 1.0 +#define MAX_CUTOFF_FREQ 3.0 + +#define RGB16ToColorKey(c) \ + (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3)) + +#define RGB15ToColorKey(c) \ + (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3)) + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = { + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 3 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = { + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} +}; + +#define NUM_IMAGES 4 + +static XF86ImageRec Images[NUM_IMAGES] = { + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY +}; + +typedef struct { + CARD32 OBUF_0Y; + CARD32 OBUF_1Y; + CARD32 OBUF_0U; + CARD32 OBUF_0V; + CARD32 OBUF_1U; + CARD32 OBUF_1V; + CARD32 OSTRIDE; + CARD32 YRGB_VPH; + CARD32 UV_VPH; + CARD32 HORZ_PH; + CARD32 INIT_PHS; + CARD32 DWINPOS; + CARD32 DWINSZ; + CARD32 SWIDTH; + CARD32 SWIDTHSW; + CARD32 SHEIGHT; + CARD32 YRGBSCALE; + CARD32 UVSCALE; + CARD32 OCLRC0; + CARD32 OCLRC1; + CARD32 DCLRKV; + CARD32 DCLRKM; + CARD32 SCLRKVH; + CARD32 SCLRKVL; + CARD32 SCLRKEN; + CARD32 OCONFIG; + CARD32 OCMD; + CARD32 RESERVED1; /* 0x6C */ + CARD32 AWINPOS; + CARD32 AWINSZ; + CARD32 RESERVED2; /* 0x78 */ + CARD32 RESERVED3; /* 0x7C */ + CARD32 RESERVED4; /* 0x80 */ + CARD32 RESERVED5; /* 0x84 */ + CARD32 RESERVED6; /* 0x88 */ + CARD32 RESERVED7; /* 0x8C */ + CARD32 RESERVED8; /* 0x90 */ + CARD32 RESERVED9; /* 0x94 */ + CARD32 RESERVEDA; /* 0x98 */ + CARD32 RESERVEDB; /* 0x9C */ + CARD32 FASTHSCALE; /* 0xA0 */ + CARD32 UVSCALEV; /* 0xA4 */ + + CARD32 RESERVEDC[(0x200 - 0xA8) / 4]; /* 0xA8 - 0x1FC */ + CARD16 Y_VCOEFS[N_VERT_Y_TAPS * N_PHASES]; /* 0x200 */ + CARD16 RESERVEDD[0x100 / 2 - N_VERT_Y_TAPS * N_PHASES]; + CARD16 Y_HCOEFS[N_HORIZ_Y_TAPS * N_PHASES]; /* 0x300 */ + CARD16 RESERVEDE[0x200 / 2 - N_HORIZ_Y_TAPS * N_PHASES]; + CARD16 UV_VCOEFS[N_VERT_UV_TAPS * N_PHASES]; /* 0x500 */ + CARD16 RESERVEDF[0x100 / 2 - N_VERT_UV_TAPS * N_PHASES]; + CARD16 UV_HCOEFS[N_HORIZ_UV_TAPS * N_PHASES]; /* 0x600 */ + CARD16 RESERVEDG[0x100 / 2 - N_HORIZ_UV_TAPS * N_PHASES]; +} I830OverlayRegRec, *I830OverlayRegPtr; + +typedef struct { + CARD32 GAMC5; + CARD32 GAMC4; + CARD32 GAMC3; + CARD32 GAMC2; + CARD32 GAMC1; + CARD32 GAMC0; +} I830OverlayStateRec, *I830OverlayStatePtr; + +typedef struct { + CARD32 YBuf0offset; + CARD32 UBuf0offset; + CARD32 VBuf0offset; + + CARD32 YBuf1offset; + CARD32 UBuf1offset; + CARD32 VBuf1offset; + + unsigned char currentBuf; + + int brightness; + int contrast; + + RegionRec clip; + CARD32 colorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; + FBLinearPtr linear; + + I830OverlayStateRec hwstate; + + Bool refreshOK; + int maxRate; +} I830PortPrivRec, *I830PortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (I830PortPrivPtr)((I830PTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +static void +CompareOverlay(I830Ptr pI830, CARD32 * overlay, int size) +{ + int i; + CARD32 val; + int bad = 0; + + for (i = 0; i < size; i += 4) { + val = INREG(0x30100 + i); + if (val != overlay[i / 4]) { + ErrorF("0x%05x value doesn't match (0x%08x != 0x%08x)\n", + 0x30100 + i, val, overlay[i / 4]); + bad++; + } + } + if (!bad) + ErrorF("CompareOverlay: no differences\n"); +} + +void +I830InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + + DPRINTF(PFX, "I830InitVideo\n"); + +#if 0 + { + I830OverlayRegRec tmp; + + ErrorF("sizeof I830OverlayRegRec is 0x%x\n", sizeof(I830OverlayRegRec)); + ErrorF("Reserved C, D, E, F, G are %x, %x, %x, %x, %x\n", + (unsigned long)&(tmp.RESERVEDC[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDD[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDE[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDF[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDG[0]) - (unsigned long)&tmp); + } +#endif + + if (pScrn->bitsPerPixel != 8) { + newAdaptor = I830SetupImageVideo(pScreen); + I830InitOffscreenImages(pScreen); + } + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if (newAdaptor) { + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *)); + if (newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if (num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); +} + +static void +I830ResetVideo(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + I830OverlayRegPtr overlay = + (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem.Start); + I830OverlayStatePtr hwstate = &(pPriv->hwstate); + + DPRINTF(PFX, "I830ResetVideo: base: %p, offset: 0x%08x, obase: %p\n", + pI830->FbBase, pI830->OverlayMem.Start, overlay); + /* + * Default to maximum image size in YV12 + */ + + memset(overlay, 0, sizeof(*overlay)); + overlay->YRGB_VPH = 0; + overlay->UV_VPH = 0; + overlay->HORZ_PH = 0; + overlay->INIT_PHS = 0; + overlay->DWINPOS = 0; + overlay->DWINSZ = (IMAGE_MAX_HEIGHT << 16) | IMAGE_MAX_WIDTH; + overlay->SWIDTH = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 16); + overlay->SWIDTHSW = (IMAGE_MAX_WIDTH >> 3) | (IMAGE_MAX_WIDTH << 12); + overlay->SHEIGHT = IMAGE_MAX_HEIGHT | (IMAGE_MAX_HEIGHT << 15); + overlay->OCLRC0 = 0x01000000; /* brightness: 0 contrast: 1.0 */ + overlay->OCLRC1 = 0x00000080; /* saturation: bypass */ + overlay->AWINPOS = 0; + overlay->AWINSZ = 0; + overlay->FASTHSCALE = 0; + + /* + * Enable destination color keying + */ + switch (pScrn->depth) { + case 8: + overlay->DCLRKV = 0; + overlay->DCLRKM = 0xffffff | DEST_KEY_ENABLE; + break; + case 15: + overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); + overlay->DCLRKM = 0x070707 | DEST_KEY_ENABLE; + break; + case 16: + overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); + overlay->DCLRKM = 0x070307 | DEST_KEY_ENABLE; + break; + default: + overlay->DCLRKV = pPriv->colorKey; + overlay->DCLRKM = DEST_KEY_ENABLE; + break; + } + + overlay->SCLRKVH = 0; + overlay->SCLRKVL = 0; + overlay->SCLRKEN = 0; /* source color key disable */ + overlay->OCONFIG = CC_OUT_8BIT; + + /* + * Select which pipe the overlay is enabled on. Give preference to + * pipe A. + */ + if (pI830->pipeEnabled[0]) + overlay->OCONFIG |= OVERLAY_PIPE_A; + else if (pI830->pipeEnabled[1]) + overlay->OCONFIG |= OVERLAY_PIPE_B; + + overlay->OCMD = YUV_420; + + /* setup hwstate */ + /* Default gamma correction values. */ + hwstate->GAMC5 = 0xc0c0c0; + hwstate->GAMC4 = 0x808080; + hwstate->GAMC3 = 0x404040; + hwstate->GAMC2 = 0x202020; + hwstate->GAMC1 = 0x101010; + hwstate->GAMC0 = 0x080808; + +#if 0 + /* + * XXX DUMP REGISTER CODE !!! + * This allows us to dump the complete i845 registers and compare + * with warm boot situations before we upload our first copy. + */ + { + int i; + for (i = 0x30000; i < 0x31000; i += 4) + ErrorF("0x%x 0x%08x\n", i, INREG(i)); + } +#endif + + OUTREG(OGAMC5, hwstate->GAMC5); + OUTREG(OGAMC4, hwstate->GAMC4); + OUTREG(OGAMC3, hwstate->GAMC3); + OUTREG(OGAMC2, hwstate->GAMC2); + OUTREG(OGAMC1, hwstate->GAMC1); + OUTREG(OGAMC0, hwstate->GAMC0); + +} + +/* + * Each chipset has a limit on the pixel rate that the video overlay can + * be used for. Enabling the overlay above that limit can result in a + * lockup. These two functions check the pixel rate for the new mode + * and turn the overlay off before switching to the new mode if it exceeds + * the limit, or turn it back on if the new mode is below the limit. + */ + +/* + * Approximate pixel rate limits for the video overlay. + * The rate is calculated based on the mode resolution and refresh rate. + */ +#define I830_OVERLAY_RATE 79 /* 1024x768@85, 1280x1024@60 */ +#define I845_OVERLAY_RATE 120 /* 1280x1024@85, 1600x1200@60 */ +#define I852_OVERLAY_RATE 79 /* 1024x768@85, 1280x1024@60 */ +#define I855_OVERLAY_RATE 120 /* 1280x1024@85, 1600x1200@60 */ +#define I865_OVERLAY_RATE 170 /* 1600x1200@85, 1920x1440@60 */ +#define DEFAULT_OVERLAY_RATE 120 + +static XF86VideoAdaptorPtr +I830SetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + XF86VideoAdaptorPtr adapt; + I830PortPrivPtr pPriv; + + DPRINTF(PFX, "I830SetupImageVideo\n"); + + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(I830PortPrivRec) + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Intel(R) 830M/845G/852GM/855GM/865G Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + + pPriv = (I830PortPrivPtr) (&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer) (pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = I830StopVideo; + adapt->SetPortAttribute = I830SetPortAttribute; + adapt->GetPortAttribute = I830GetPortAttribute; + adapt->QueryBestSize = I830QueryBestSize; + adapt->PutImage = I830PutImage; + adapt->QueryImageAttributes = I830QueryImageAttributes; + + pPriv->colorKey = pI830->colorKey & ((1 << pScrn->depth) - 1); + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 64; + pPriv->linear = NULL; + pPriv->currentBuf = 0; + + switch (pI830->PciInfo->chipType) { + case PCI_CHIP_I830_M: + pPriv->maxRate = I830_OVERLAY_RATE; + break; + case PCI_CHIP_845_G: + pPriv->maxRate = I845_OVERLAY_RATE; + break; + case PCI_CHIP_I855_GM: + switch (pI830->variant) { + case I852_GM: + case I852_GME: + pPriv->maxRate = I852_OVERLAY_RATE; + break; + default: + pPriv->maxRate = I855_OVERLAY_RATE; + break; + } + break; + case PCI_CHIP_I865_G: + pPriv->maxRate = I865_OVERLAY_RATE; + break; + default: + pPriv->maxRate = DEFAULT_OVERLAY_RATE; + break; + } + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pI830->adaptor = adapt; + + /* Initialise pPriv->refreshOK */ + I830VideoSwitchModeAfter(pScrn, pScrn->currentMode); + + pI830->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = I830BlockHandler; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + I830ResetVideo(pScrn); + + return adapt; +} + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) + return FALSE; + + if ((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int *)REGION_RECTS(A); + dataB = (int *)REGION_RECTS(B); + + while (num--) { + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} + +static void +I830StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) +{ + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + I830Ptr pI830 = I830PTR(pScrn); + + I830OverlayRegPtr overlay = + (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem.Start); + + DPRINTF(PFX, "I830StopVideo\n"); + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if (shutdown) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + overlay->OCMD &= ~OVERLAY_ENABLE; + OVERLAY_UPDATE; + + OVERLAY_OFF; + } + if (pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } else { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } + +} + +static int +I830SetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + I830Ptr pI830 = I830PTR(pScrn); + I830OverlayRegPtr overlay = + (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem.Start); + + if (attribute == xvBrightness) { + if ((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + if (pPriv->refreshOK) + OVERLAY_UPDATE; + } else if (attribute == xvContrast) { + if ((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + if (pPriv->refreshOK) + OVERLAY_UPDATE; + } else if (attribute == xvColorKey) { + pPriv->colorKey = value; + switch (pScrn->depth) { + case 16: + overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); + break; + case 15: + overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); + break; + default: + overlay->DCLRKV = pPriv->colorKey; + break; + } + if (pPriv->refreshOK) + OVERLAY_UPDATE; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else + return BadMatch; + + return Success; +} + +static int +I830GetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 * value, pointer data) +{ + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + + if (attribute == xvBrightness) { + *value = pPriv->brightness; + } else if (attribute == xvContrast) { + *value = pPriv->contrast; + } else if (attribute == xvColorKey) { + *value = pPriv->colorKey; + } else + return BadMatch; + + return Success; +} + +static void +I830QueryBestSize(ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ + if (vid_w > (drw_w << 1)) + drw_w = vid_w >> 1; + if (vid_h > (drw_h << 1)) + drw_h = vid_h >> 1; + + *p_w = drw_w; + *p_h = drw_h; +} + +static void +I830CopyPackedData(ScrnInfoPtr pScrn, + unsigned char *buf, + int srcPitch, + int dstPitch, int top, int left, int h, int w) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + unsigned char *src, *dst; + + DPRINTF(PFX, "I830CopyPackedData: (%d,%d) (%d,%d)\n" + "srcPitch: %d, dstPitch: %d\n", top, left, h, w, srcPitch, dstPitch); + + src = buf + (top * srcPitch) + (left << 1); + + if (pPriv->currentBuf == 0) + dst = pI830->FbBase + pPriv->YBuf0offset; + else + dst = pI830->FbBase + pPriv->YBuf1offset; + + w <<= 1; + while (h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +static void +I830CopyPlanarData(ScrnInfoPtr pScrn, unsigned char *buf, int srcPitch, + int dstPitch, int srcH, int top, int left, + int h, int w, int id) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + int i; + unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3; + + DPRINTF(PFX, "I830CopyPlanarData: srcPitch %d, dstPitch %d\n" + "nlines %d, npixels %d, top %d, left %d\n", srcPitch, dstPitch, + h, w, top, left); + + /* Copy Y data */ + src1 = buf + (top * srcPitch) + left; + ErrorF("src1 is %p, offset is %d\n", src1, + (unsigned long)src1 - (unsigned long)buf); + if (pPriv->currentBuf == 0) + dst1 = pI830->FbBase + pPriv->YBuf0offset; + else + dst1 = pI830->FbBase + pPriv->YBuf1offset; + + for (i = 0; i < h; i++) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += dstPitch << 1; + } + + /* Copy V data for YV12, or U data for I420 */ + src2 = buf + (srcH * srcPitch) + ((top * srcPitch) >> 2) + (left >> 1); + ErrorF("src2 is %p, offset is %d\n", src2, + (unsigned long)src2 - (unsigned long)buf); + if (pPriv->currentBuf == 0) { + if (id == FOURCC_I420) + dst2 = pI830->FbBase + pPriv->UBuf0offset; + else + dst2 = pI830->FbBase + pPriv->VBuf0offset; + } else { + if (id == FOURCC_I420) + dst2 = pI830->FbBase + pPriv->UBuf1offset; + else + dst2 = pI830->FbBase + pPriv->VBuf1offset; + } + + for (i = 0; i < h / 2; i++) { + memcpy(dst2, src2, w / 2); + src2 += srcPitch >> 1; + dst2 += dstPitch; + } + + /* Copy U data for YV12, or V data for I420 */ + src3 = buf + (srcH * srcPitch) + ((srcH * srcPitch) >> 2) + + ((top * srcPitch) >> 2) + (left >> 1); + ErrorF("src3 is %p, offset is %d\n", src3, + (unsigned long)src3 - (unsigned long)buf); + if (pPriv->currentBuf == 0) { + if (id == FOURCC_I420) + dst3 = pI830->FbBase + pPriv->VBuf0offset; + else + dst3 = pI830->FbBase + pPriv->UBuf0offset; + } else { + if (id == FOURCC_I420) + dst3 = pI830->FbBase + pPriv->VBuf1offset; + else + dst3 = pI830->FbBase + pPriv->UBuf1offset; + } + + for (i = 0; i < h / 2; i++) { + memcpy(dst3, src3, w / 2); + src3 += srcPitch >> 1; + dst3 += dstPitch; + } +} + +typedef struct { + CARD8 sign; + CARD16 mantissa; + CARD8 exponent; +} coeffRec, *coeffPtr; + +static Bool +SetCoeffRegs(double *coeff, int mantSize, coeffPtr pCoeff, int pos) +{ + int maxVal, icoeff, res; + int sign; + double c; + + sign = 0; + maxVal = 1 << mantSize; + c = *coeff; + if (c < 0.0) { + sign = 1; + c = -c; + } + + res = 12 - mantSize; + if ((icoeff = (int)(c * 4 * maxVal + 0.5)) < maxVal) { + pCoeff[pos].exponent = 3; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(4 * maxVal); + } else if ((icoeff = (int)(c * 2 * maxVal + 0.5)) < maxVal) { + pCoeff[pos].exponent = 2; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(2 * maxVal); + } else if ((icoeff = (int)(c * maxVal + 0.5)) < maxVal) { + pCoeff[pos].exponent = 1; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(maxVal); + } else if ((icoeff = (int)(c * maxVal * 0.5 + 0.5)) < maxVal) { + pCoeff[pos].exponent = 0; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(maxVal / 2); + } else { + /* Coeff out of range */ + return FALSE; + } + + pCoeff[pos].sign = sign; + if (sign) + *coeff = -(*coeff); + return TRUE; +} + +static void +UpdateCoeff(int taps, double fCutoff, Bool isHoriz, Bool isY, coeffPtr pCoeff) +{ + int i, j, j1, num, pos, mantSize; + double pi = 3.1415926535, val, sinc, window, sum; + double rawCoeff[MAX_TAPS * 32], coeffs[N_PHASES][MAX_TAPS]; + double diff; + int tapAdjust[MAX_TAPS], tap2Fix; + Bool isVertAndUV; + + if (isHoriz) + mantSize = 7; + else + mantSize = 6; + + isVertAndUV = !isHoriz && !isY; + num = taps * 16; + for (i = 0; i < num * 2; i++) { + val = (1.0 / fCutoff) * taps * pi * (i - num) / (2 * num); + if (val == 0.0) + sinc = 1.0; + else + sinc = sin(val) / val; + + /* Hamming window */ + window = (0.5 - 0.5 * cos(i * pi / num)); + rawCoeff[i] = sinc * window; + } + + for (i = 0; i < N_PHASES; i++) { + /* Normalise the coefficients. */ + sum = 0.0; + for (j = 0; j < taps; j++) { + pos = i + j * 32; + sum += rawCoeff[pos]; + } + for (j = 0; j < taps; j++) { + pos = i + j * 32; + coeffs[i][j] = rawCoeff[pos] / sum; + } + + /* Set the register values. */ + for (j = 0; j < taps; j++) { + pos = j + i * taps; + if ((j == (taps - 1) / 2) && !isVertAndUV) + SetCoeffRegs(&coeffs[i][j], mantSize + 2, pCoeff, pos); + else + SetCoeffRegs(&coeffs[i][j], mantSize, pCoeff, pos); + } + + tapAdjust[0] = (taps - 1) / 2; + for (j = 1, j1 = 1; j <= tapAdjust[0]; j++, j1++) { + tapAdjust[j1] = tapAdjust[0] - j; + tapAdjust[++j1] = tapAdjust[0] + j; + } + + /* Adjust the coefficients. */ + sum = 0.0; + for (j = 0; j < taps; j++) + sum += coeffs[i][j]; + if (sum != 1.0) { + for (j1 = 0; j1 < taps; j1++) { + tap2Fix = tapAdjust[j1]; + diff = 1.0 - sum; + coeffs[i][tap2Fix] += diff; + pos = tap2Fix + i * taps; + if ((tap2Fix == (taps - 1) / 2) && !isVertAndUV) + SetCoeffRegs(&coeffs[i][tap2Fix], mantSize + 2, pCoeff, pos); + else + SetCoeffRegs(&coeffs[i][tap2Fix], mantSize, pCoeff, pos); + + sum = 0.0; + for (j = 0; j < taps; j++) + sum += coeffs[i][j]; + if (sum == 1.0) + break; + } + } + } +} + +static void +I830DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height, + int dstPitch, int x1, int y1, int x2, int y2, BoxPtr dstBox, + short src_w, short src_h, short drw_w, short drw_h) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + I830OverlayRegPtr overlay = + (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem.Start); + unsigned int swidth; + + DPRINTF(PFX, "I830DisplayVideo: %dx%d (pitch %d)\n", width, height, + dstPitch); + + if (!pPriv->refreshOK) + return; + + CompareOverlay(pI830, (CARD32 *) overlay, 0x100); + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + swidth = (width + 1) & ~1 & 0xfff; + overlay->SWIDTH = swidth; + swidth /= 2; + overlay->SWIDTH |= (swidth & 0x7ff) << 16; + + swidth = ((pPriv->YBuf0offset + width + 0x1f) >> 5) - + (pPriv->YBuf0offset >> 5) - 1; + + ErrorF("Y width is %d, swidthsw is %d\n", width, swidth); + + overlay->SWIDTHSW = swidth << 2; + + swidth = ((pPriv->UBuf0offset + (width / 2) + 0x1f) >> 5) - + (pPriv->UBuf0offset >> 5) - 1; + ErrorF("UV width is %d, swidthsw is %d\n", width / 2, swidth); + + overlay->SWIDTHSW |= swidth << 18; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + /* XXX Check for i845 */ + + swidth = ((width + 31) & ~31) << 1; + overlay->SWIDTH = swidth; + overlay->SWIDTHSW = swidth >> 3; + break; + } + + overlay->SHEIGHT = height | ((height / 2) << 16); + + overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; + overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) | + (dstBox->x2 - dstBox->x1); + + /* buffer locations */ + overlay->OBUF_0Y = pPriv->YBuf0offset; + overlay->OBUF_1Y = pPriv->YBuf1offset; + overlay->OBUF_0U = pPriv->UBuf0offset; + overlay->OBUF_0V = pPriv->VBuf0offset; + overlay->OBUF_1U = pPriv->UBuf1offset; + overlay->OBUF_1V = pPriv->VBuf1offset; + + ErrorF("Buffers: Y0: 0x%08x, U0: 0x%08x, V0: 0x%08x\n", overlay->OBUF_0Y, + overlay->OBUF_0U, overlay->OBUF_0V); + ErrorF("Buffers: Y1: 0x%08x, U1: 0x%08x, V1: 0x%08x\n", overlay->OBUF_1Y, + overlay->OBUF_1U, overlay->OBUF_1V); + +#if 0 + { + int i; + + ErrorF("First 32 bytes of Y data:\n"); + for (i = 0; i < 32; i++) + ErrorF(" %02x", + ((unsigned char *)pI830->FbBase + pPriv->YBuf0offset)[i]); + ErrorF("\n"); + ErrorF("First 16 bytes of U data:\n"); + for (i = 0; i < 16; i++) + ErrorF(" %02x", + ((unsigned char *)pI830->FbBase + pPriv->UBuf0offset)[i]); + ErrorF("\n"); + ErrorF("First 16 bytes of V data:\n"); + for (i = 0; i < 16; i++) + ErrorF(" %02x", + ((unsigned char *)pI830->FbBase + pPriv->VBuf0offset)[i]); + ErrorF("\n"); + } +#endif + +#if 1 + overlay->OCMD = OVERLAY_ENABLE; +#endif + + ErrorF("pos: 0x%08x, size: 0x%08x\n", overlay->DWINPOS, overlay->DWINSZ); + ErrorF("dst: %d x %d, src: %d x %d\n", drw_w, drw_h, src_w, src_h); + + /* + * Calculate horizontal and vertical scaling factors and polyphase + * coefficients. + */ + + { + Bool scaleChanged = FALSE; + int xscaleInt, xscaleFract, yscaleInt, yscaleFract; + int xscaleIntUV, xscaleFractUV; + int yscaleIntUV, yscaleFractUV; + /* UV is half the size of Y -- YUV420 */ + int uvratio = 2; + CARD32 newval; + coeffRec xcoeffY[N_HORIZ_Y_TAPS * N_PHASES]; + coeffRec xcoeffUV[N_HORIZ_UV_TAPS * N_PHASES]; + int i, j, pos; + + /* + * Y down-scale factor as a multiple of 4096. + */ + xscaleFract = (src_w << 12) / drw_w; + yscaleFract = (src_h << 12) / drw_h; + + /* Calculate the UV scaling factor. */ + xscaleFractUV = xscaleFract / uvratio; + yscaleFractUV = yscaleFract / uvratio; + + /* + * To keep the relative Y and UV ratios exact, round the Y scales + * to a multiple of the Y/UV ratio. + */ + xscaleFract = xscaleFractUV * uvratio; + yscaleFract = yscaleFractUV * uvratio; + + /* Integer (un-multiplied) values. */ + xscaleInt = xscaleFract >> 12; + yscaleInt = yscaleFract >> 12; + + xscaleIntUV = xscaleFractUV >> 12; + yscaleIntUV = yscaleFractUV >> 12; + + ErrorF("xscale: 0x%x.%03x, yscale: 0x%x.%03x\n", xscaleInt, + xscaleFract & 0xFFF, yscaleInt, yscaleFract & 0xFFF); + ErrorF("UV xscale: 0x%x.%03x, UV yscale: 0x%x.%03x\n", xscaleIntUV, + xscaleFractUV & 0xFFF, yscaleIntUV, yscaleFractUV & 0xFFF); + + newval = (xscaleInt << 16) | + ((xscaleFract & 0xFFF) << 3) | ((yscaleFract & 0xFFF) << 20); + if (newval != overlay->YRGBSCALE) { + scaleChanged = TRUE; + overlay->YRGBSCALE = newval; + } + + newval = (xscaleIntUV << 16) | ((xscaleFractUV & 0xFFF) << 3) | + ((yscaleFractUV & 0xFFF) << 20); + if (newval != overlay->UVSCALE) { + scaleChanged = TRUE; + overlay->UVSCALE = newval; + } + + newval = yscaleInt << 16 | yscaleIntUV; + if (newval != overlay->UVSCALEV) { + scaleChanged = TRUE; + overlay->UVSCALEV = newval; + } + + /* Recalculate coefficients if the scaling changed. */ + + /* + * Only Horizontal coefficients so far. + */ + if (scaleChanged) { + double fCutoffY; + double fCutoffUV; + + fCutoffY = xscaleFract / 4096.0; + fCutoffUV = xscaleFractUV / 4096.0; + + /* Limit to between 1.0 and 3.0. */ + if (fCutoffY < MIN_CUTOFF_FREQ) + fCutoffY = MIN_CUTOFF_FREQ; + if (fCutoffY > MAX_CUTOFF_FREQ) + fCutoffY = MAX_CUTOFF_FREQ; + if (fCutoffUV < MIN_CUTOFF_FREQ) + fCutoffUV = MIN_CUTOFF_FREQ; + if (fCutoffUV > MAX_CUTOFF_FREQ) + fCutoffUV = MAX_CUTOFF_FREQ; + + UpdateCoeff(N_HORIZ_Y_TAPS, fCutoffY, TRUE, TRUE, xcoeffY); + UpdateCoeff(N_HORIZ_UV_TAPS, fCutoffUV, TRUE, FALSE, xcoeffUV); + + for (i = 0; i < N_PHASES; i++) { + for (j = 0; j < N_HORIZ_Y_TAPS; j++) { + pos = i * N_HORIZ_Y_TAPS + j; + overlay->Y_HCOEFS[pos] = xcoeffY[pos].sign << 15 | + xcoeffY[pos].exponent << 12 | + xcoeffY[pos].mantissa; + } + } + for (i = 0; i < N_PHASES; i++) { + for (j = 0; j < N_HORIZ_UV_TAPS; j++) { + pos = i * N_HORIZ_UV_TAPS + j; + overlay->UV_HCOEFS[pos] = xcoeffUV[pos].sign << 15 | + xcoeffUV[pos].exponent << 12 | + xcoeffUV[pos].mantissa; + } + } + } + } + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + ErrorF("YUV420\n"); +#if 0 + /* set UV vertical phase to -0.25 */ + overlay->UV_VPH = 0x30003000; +#endif + ErrorF("UV stride is %d, Y stride is %d\n", dstPitch, dstPitch * 2); + overlay->OSTRIDE = (dstPitch * 2) | (dstPitch << 16); + overlay->OCMD &= ~SOURCE_FORMAT; + overlay->OCMD &= ~OV_BYTE_ORDER; + overlay->OCMD |= YUV_420; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + ErrorF("YUV422\n"); + overlay->OSTRIDE = dstPitch; + overlay->OCMD &= ~SOURCE_FORMAT; + overlay->OCMD |= YUV_422; + overlay->OCMD &= ~OV_BYTE_ORDER; + if (id == FOURCC_UYVY) + overlay->OCMD |= Y_SWAP; + break; + } + + overlay->OCMD &= ~(BUFFER_SELECT | FIELD_SELECT); + if (pPriv->currentBuf == 0) + overlay->OCMD |= BUFFER0; + else + overlay->OCMD |= BUFFER1; + + ErrorF("OCMD is 0x%08x\n", overlay->OCMD); + + OVERLAY_UPDATE; +} + +static FBLinearPtr +I830AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size) +{ + ScreenPtr pScreen; + FBLinearPtr new_linear; + + DPRINTF(PFX, "I830AllocateMemory\n"); + if (linear) { + if (linear->size >= size) + return linear; + + if (xf86ResizeOffscreenLinear(linear, size)) + return linear; + + xf86FreeOffscreenLinear(linear); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, + NULL, NULL, NULL); + + if (!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, + PRIORITY_EXTREME); + + if (max_size < size) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, + NULL, NULL, NULL); + } + + return new_linear; +} + +static int +I830PutImage(ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char *buf, + short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + INT32 x1, x2, y1, y2; + int srcPitch, dstPitch; + int top, left, npixels, nlines, size, loops; + BoxRec dstBox; + + DPRINTF(PFX, "I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n" + "width %d, height %d\n", src_x, src_y, src_w, src_h, drw_x, drw_y, + drw_w, drw_h, width, height); + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + width, height)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + dstPitch = ((width / 2) + 255) & ~255; /* of chroma */ + size = dstPitch * height * 3; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = (width << 1); + dstPitch = (srcPitch + 255) & ~255; + size = dstPitch * height; + break; + } + ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, dstPitch, size); + + if (!(pPriv->linear = I830AllocateMemory(pScrn, pPriv->linear, + size * 2 / pI830->cpp))) + return BadAlloc; + + /* fixup pointers */ + pPriv->YBuf0offset = pScrn->fbOffset + pPriv->linear->offset * pI830->cpp; + pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height); + pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height / 2); + + pPriv->YBuf1offset = pPriv->YBuf0offset + size; + pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height); + pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height / 2); + + /* XXX We could potentially use MI_WAIT_FOR_OVERLAY here instead + * of this code....*/ + + /* Make sure this buffer isn't in use */ + loops = 0; + while (loops < 1000000) { +#if USE_USLEEP_FOR_VIDEO + usleep(10); +#endif + if (((INREG(DOVSTA) & OC_BUF) >> 20) == pPriv->currentBuf) { + break; + } + loops++; + } + if (loops >= 1000000) { + ErrorF("loops (1) maxed out for buffer %d\n", pPriv->currentBuf); +#if 0 + pPriv->currentBuf = !pPriv->currentBuf; +#endif + } + + /* buffer swap */ + if (pPriv->currentBuf == 0) + pPriv->currentBuf = 1; + else + pPriv->currentBuf = 0; + + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + I830CopyPlanarData(pScrn, buf, srcPitch, dstPitch, height, top, left, + nlines, npixels, id); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + nlines = ((y2 + 0xffff) >> 16) - top; + I830CopyPackedData(pScrn, buf, srcPitch, dstPitch, top, left, nlines, + npixels); + break; + } + + /* update cliplist */ + /* + * XXX Always draw the key. LinDVD seems to fill the window background + * with a colour different from the key. This works around that. + */ + if (1 || !RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + xf86XVFillKeyHelper(pScreen, pPriv->colorKey, clipBoxes); + } + + I830DisplayVideo(pScrn, id, width, height, dstPitch, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + +static int +I830QueryImageAttributes(ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + int size, tmp; + + DPRINTF(PFX, "I830QueryImageAttributes: w is %d, h is %d\n", *w, *h); + + if (*w > IMAGE_MAX_WIDTH) + *w = IMAGE_MAX_WIDTH; + if (*h > IMAGE_MAX_HEIGHT) + *h = IMAGE_MAX_HEIGHT; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + /* IA44 is for XvMC only */ + case FOURCC_IA44: + case FOURCC_AI44: + if (pitches) + pitches[0] = *w; + size = *w * *h; + break; + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; +#if 1 + size = (*w + 3) & ~3; +#else + size = (*w + 255) & ~255; +#endif + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; +#if 1 + tmp = ((*w >> 1) + 3) & ~3; +#else + tmp = ((*w >> 1) + 255) & ~255; +#endif + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; + if (pitches) + ErrorF("pitch 0 is %d, pitch 1 is %d, pitch 2 is %d\n", pitches[0], + pitches[1], pitches[2]); + if (offsets) + ErrorF("offset 1 is %d, offset 2 is %d\n", offsets[1], offsets[2]); + if (offsets) + ErrorF("size is %d\n", size); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; +} + +static void +I830BlockHandler(int i, + pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + I830OverlayRegPtr overlay = + (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem.Start); + + pScreen->BlockHandler = pI830->BlockHandler; + + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + + pScreen->BlockHandler = I830BlockHandler; + + if (pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if (pPriv->videoStatus & OFF_TIMER) { + if (pPriv->offTime < currentTime.milliseconds) { + /* Turn off the overlay */ + overlay->OCMD &= ~OVERLAY_ENABLE; + + OVERLAY_UPDATE; + + OVERLAY_OFF; + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if (pPriv->freeTime < currentTime.milliseconds) { + if (pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } + } + } +} + +/*************************************************************************** + * Offscreen Images + ***************************************************************************/ + +typedef struct { + FBLinearPtr linear; + Bool isOn; +} OffscreenPrivRec, *OffscreenPrivPtr; + +static int +I830AllocateSurface(ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, XF86SurfacePtr surface) +{ + FBLinearPtr linear; + int pitch, fbpitch, size, bpp; + OffscreenPrivPtr pPriv; + I830Ptr pI830 = I830PTR(pScrn); + + DPRINTF(PFX, "I830AllocateSurface\n"); + + if ((w > 1024) || (h > 1024)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + size = ((pitch * h) + bpp - 1) / bpp; + + if (!(linear = I830AllocateMemory(pScrn, NULL, size))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if (!(surface->pitches = xalloc(sizeof(int)))) { + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if (!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + + pPriv->linear = linear; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = linear->offset * bpp; + surface->devPrivate.ptr = (pointer) pPriv; + + memset(pI830->FbBase + pScrn->fbOffset + surface->offsets[0], 0, size); + + return Success; +} + +static int +I830StopSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + + if (pPriv->isOn) { + I830Ptr pI830 = I830PTR(pScrn); + + I830OverlayRegPtr overlay = + (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem.Start); + + overlay->OCMD &= ~OVERLAY_ENABLE; + + OVERLAY_UPDATE; + + OVERLAY_OFF; + + pPriv->isOn = FALSE; + } + + return Success; +} + +static int +I830FreeSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + + if (pPriv->isOn) { + I830StopSurface(surface); + } + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +I830GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value) +{ + return I830GetPortAttribute(pScrn, attribute, value, 0); +} + +static int +I830SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value) +{ + return I830SetPortAttribute(pScrn, attribute, value, 0); +} + +static int +I830DisplaySurface(XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, RegionPtr clipBoxes) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pI830Priv = GET_PORT_PRIVATE(pScrn); + + INT32 x1, y1, x2, y2; + INT32 loops = 0; + BoxRec dstBox; + + DPRINTF(PFX, "I830DisplaySurface\n"); + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + /* fixup pointers */ + pI830Priv->YBuf0offset = surface->offsets[0]; + pI830Priv->YBuf1offset = pI830Priv->YBuf0offset; + + /* XXX We could potentially use MI_WAIT_FOR_OVERLAY here instead + * of this code....*/ + + /* wait for the last rendered buffer to be flipped in */ + while (((INREG(DOVSTA) & OC_BUF) >> 20) != pI830Priv->currentBuf) { +#if USE_USLEEP_FOR_VIDEO + usleep(10); +#endif + if (loops == 200000) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Overlay Lockup\n"); + break; + } + loops++; + } + + /* buffer swap */ + if (pI830Priv->currentBuf == 0) + pI830Priv->currentBuf = 1; + else + pI830Priv->currentBuf = 0; + + I830ResetVideo(pScrn); + + I830DisplayVideo(pScrn, surface->id, surface->width, surface->height, + surface->pitches[0], x1, y1, x2, y2, &dstBox, + src_w, src_h, drw_w, drw_h); + + xf86XVFillKeyHelper(pScreen, pI830Priv->colorKey, clipBoxes); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if (pI830Priv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &pI830Priv->clip); + UpdateCurrentTime(); + pI830Priv->videoStatus = FREE_TIMER; + pI830Priv->freeTime = currentTime.milliseconds + FREE_DELAY; + pScrn->pScreen->BlockHandler = I830BlockHandler; + } + + return Success; +} + +static void +I830InitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) { + return; + } + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = I830AllocateSurface; + offscreenImages[0].free_surface = I830FreeSurface; + offscreenImages[0].display = I830DisplaySurface; + offscreenImages[0].stop = I830StopSurface; + offscreenImages[0].setAttribute = I830SetSurfaceAttribute; + offscreenImages[0].getAttribute = I830GetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = 1; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + +void +I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + I830PortPrivPtr pPriv; + int pixrate; + + if (!I830PTR(pScrn)->adaptor) { + return; + } + + pPriv = GET_PORT_PRIVATE(pScrn); + + if (!pPriv) { + xf86ErrorF("pPriv isn't set\n"); + return; + } + + pixrate = mode->HDisplay * mode->VDisplay * mode->VRefresh; + if (pixrate > pPriv->maxRate && pPriv->refreshOK) { + I830StopVideo(pScrn, pPriv, TRUE); + pPriv->refreshOK = FALSE; + } +} + +void +I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + I830PortPrivPtr pPriv; + int pixrate; + + if (!I830PTR(pScrn)->adaptor) { + return; + } + pPriv = GET_PORT_PRIVATE(pScrn); + if (!pPriv) + return; + + /* If this isn't initialised, assume 60Hz. */ + if (mode->VRefresh == 0) + mode->VRefresh = 60; + + pixrate = (mode->HDisplay * mode->VDisplay * mode->VRefresh) / 1000000; + pPriv->refreshOK = (pixrate <= pPriv->maxRate); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.18 Wed Nov 7 23:15:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c Tue Sep 24 11:23:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.18 2001/11/08 04:15:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.20 2002/09/24 15:23:55 tsi Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -254,7 +254,7 @@ static void IMSTTIdentify(int flags) { - xf86PrintChipsets("IMSTT", "driver (version " DRIVER_VERSION " for IMS TwinTurbo chipsets ", + xf86PrintChipsets("IMSTT", "driver (version " DRIVER_VERSION ") for IMS TwinTurbo chipsets ", IMSTTChipsets); } @@ -438,8 +438,8 @@ iptr->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); - xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); - xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); if (pEnt->device->chipset && *pEnt->device->chipset) { pScrn->chipset = pEnt->device->chipset; Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h:1.4 Wed Aug 2 17:36:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h Tue Aug 6 15:57:30 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h,v 1.4 2000/08/02 21:36:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h,v 1.5 2002/08/06 19:57:30 herrb Exp $ */ #ifndef _IMSTT_REG_H #define _IMSTT_REG_H @@ -7,7 +7,7 @@ #if defined(__powerpc__) -static inline void regw(unsigned long base_addr, unsigned long regindex, unsigned long regdata) +static __inline__ void regw(unsigned long base_addr, unsigned long regindex, unsigned long regdata) { asm volatile ("stwbrx %1,%2,%3; eieio" : "=m" (*(volatile unsigned *)(base_addr+regindex)) @@ -15,7 +15,7 @@ } -static inline unsigned long regr(unsigned long base_addr, unsigned long regindex) +static __inline__ unsigned long regr(unsigned long base_addr, unsigned long regindex) { register unsigned long val; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile:1.43 xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile:1.46 --- xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile:1.43 Thu Apr 5 13:42:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile Mon Feb 17 12:06:42 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.43 2001/04/05 17:42:32 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.46 2003/02/17 17:06:42 dawes Exp $ XCOMM XCOMM This is an Imakefile for the MGA driver. XCOMM @@ -57,10 +57,12 @@ MGASRCS = mga_driver.c mga_hwcurs.c /* mga_cmap.c */ mga_dac3026.c mga_dacG.c \ mga_storm8.c mga_storm16.c mga_storm24.c mga_storm32.c mga_arc.c \ - mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c mga_dh.c $(DRISRCS) + mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c mga_dh.c mga_esc.c \ + mga_merge.c $(DRISRCS) MGAOBJS = mga_driver.o mga_hwcurs.o /* mga_cmap.o */ mga_dac3026.o mga_dacG.o \ mga_storm8.o mga_storm16.o mga_storm24.o mga_storm32.o mga_arc.o \ - mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o mga_dh.o $(DRIOBJS) + mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o mga_dh.o mga_esc.o \ + mga_merge.o $(DRIOBJS) SRCS = $(MGASRCS) $(MGAHALSRCS) OBJS = $(MGAOBJS) $(MGAHALOBJS) @@ -78,7 +80,7 @@ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) \ -I$(SERVERSRC)/render \ - -I$(XF86OSSRC)/vbe $(DRIINCLUDES) + -I$(XF86SRC)/vbe $(DRIINCLUDES) #endif DEFINES = $(MGAHALDEFINES) $(DRIDEFINES) @@ -130,6 +132,7 @@ InstallDriverSDKNonExecFile(mga_storm.c,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKNonExecFile(mga_video.c,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKNonExecFile(mga_halmod.c,$(DRIVERSDKDIR)/drivers/mga) +InstallDriverSDKNonExecFile(mga_common.h,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKObjectModule(mga,$(DRIVERSDKMODULEDIR),drivers) #if BuildMatroxHal Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.79 xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.85 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.79 Fri Jan 11 10:42:57 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h Mon Dec 16 11:19:17 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.79 2002/01/11 15:42:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.85 2002/12/16 16:19:17 dawes Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -52,6 +52,45 @@ #endif #include "mga_bios.h" +typedef enum { + OPTION_SW_CURSOR, + OPTION_HW_CURSOR, + OPTION_PCI_RETRY, + OPTION_SYNC_ON_GREEN, + OPTION_NOACCEL, + OPTION_SHOWCACHE, + OPTION_OVERLAY, + OPTION_MGA_SDRAM, + OPTION_SHADOW_FB, + OPTION_FBDEV, + OPTION_COLOR_KEY, + OPTION_SET_MCLK, + OPTION_OVERCLOCK_MEM, + OPTION_VIDEO_KEY, + OPTION_ROTATE, + OPTION_TEXTURED_VIDEO, + OPTION_CRTC2HALF, + OPTION_CRTC2RAM, + OPTION_INT10, + OPTION_AGP_MODE, + OPTION_AGP_SIZE, + OPTION_DIGITAL1, + OPTION_DIGITAL2, + OPTION_TV, + OPTION_TVSTANDARD, + OPTION_CABLETYPE, + OPTION_USEIRQZERO, + OPTION_NOHAL, + OPTION_SWAPPED_HEAD, + OPTION_DRI, + OPTION_MERGEDFB, + OPTION_HSYNC2, + OPTION_VREFRESH2, + OPTION_MONITOR2POS, + OPTION_METAMODES +} MGAOpts; + + #if !defined(EXTRADEBUG) #define INREG8(addr) MMIO_IN8(pMga->IOBase, addr) #define INREG16(addr) MMIO_IN16(pMga->IOBase, addr) @@ -120,6 +159,8 @@ CARD32 Option; CARD32 Option2; CARD32 Option3; + long Clock; + Bool PIXPLLCSaved; } MGARegRec, *MGARegPtr; /* For programming the second CRTC */ @@ -198,10 +239,11 @@ #define MGAPTR(p) ((MGAPtr)((p)->driverPrivate)) -#define ISDIGITAL1(p) ((p->pMgaHwInfo->ulCapsFirstOutput) & MGAHWINFOCAPS_OUTPUT_DIGITAL) -#define ISDIGITAL2(p) ((p->pMgaHwInfo->ulCapsSecondOutput) & MGAHWINFOCAPS_OUTPUT_DIGITAL) -#define ISTV1(p) ((p->pMgaHwInfo->ulCapsFirstOutput) & MGAHWINFOCAPS_OUTPUT_TV) -#define ISTV2(p) ((p->pMgaHwInfo->ulCapsSecondOutput) & MGAHWINFOCAPS_OUTPUT_TV) +/*avoids segfault by returning false if pMgaHwInfo not defined*/ +#define ISDIGITAL1(p) (p->pMgaHwInfo && ((p->pMgaHwInfo->ulCapsFirstOutput) & MGAHWINFOCAPS_OUTPUT_DIGITAL)) +#define ISDIGITAL2(p) (p->pMgaHwInfo && ((p->pMgaHwInfo->ulCapsSecondOutput) & MGAHWINFOCAPS_OUTPUT_DIGITAL)) +#define ISTV1(p) (p->pMgaHwInfo && ((p->pMgaHwInfo->ulCapsFirstOutput) & MGAHWINFOCAPS_OUTPUT_TV)) +#define ISTV2(p) (p->pMgaHwInfo && ((p->pMgaHwInfo->ulCapsSecondOutput) & MGAHWINFOCAPS_OUTPUT_TV)) #ifdef DISABLE_VGA_IO typedef struct mgaSave { @@ -210,6 +252,15 @@ } MgaSave, *MgaSavePtr; #endif + +typedef enum { + mgaLeftOf, + mgaRightOf, + mgaAbove, + mgaBelow, + mgaClone +} MgaScrn2Rel; + typedef struct { int lastInstance; #ifdef USEMGAHAL @@ -350,9 +401,13 @@ void (*GetQuiescence)(ScrnInfoPtr pScrn); int agpMode; + int agpSize; + int irq; + CARD32 reg_ien; #endif XF86VideoAdaptorPtr adaptor; + Bool DualHeadEnabled; Bool SecondCrtc; Bool SecondOutput; GDevPtr device; @@ -376,6 +431,21 @@ Bool HALLoaded; #endif OptionInfoPtr Options; +/* Merged Framebuffer data */ + Bool MergedFB; + + /* Real values specific to monitor1, since the original ones are replaced */ + DisplayModePtr M1modes; /* list of actual modes */ + DisplayModePtr M1currentMode; /* current mode */ + int M1frameX0; /* viewport position */ + int M1frameY0; + int M1frameX1; + int M1frameY1; + + ScrnInfoPtr pScrn2; /*pointer to second CRTC screeninforec, + if in merged mode */ +/* End of Merged Framebuffer Data */ + int HALGranularityOffX, HALGranularityOffY; } MGARec, *MGAPtr; extern CARD32 MGAAtype[16]; @@ -403,6 +473,20 @@ void MGAAdjustFrame(int scrnIndex, int x, int y, int flags); Bool MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +void MGAFillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode); +Bool MGAGetRec(ScrnInfoPtr pScrn); +void MGAProbeDDC(ScrnInfoPtr pScrn, int index); +void MGASoftReset(ScrnInfoPtr pScrn); +void MGAFreeRec(ScrnInfoPtr pScrn); +void MGAReadBios(ScrnInfoPtr pScrn); +void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, + int flags); +void MGAAdjustFrameCrtc2(int scrnIndex, int x, int y, int flags); +void MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, + int PowerManagementMode, + int flags); +void MGAAdjustGranularity(ScrnInfoPtr pScrn, int* x, int* y); + void MGA2064SetupFuncs(ScrnInfoPtr pScrn); void MGAGSetupFuncs(ScrnInfoPtr pScrn); @@ -493,8 +577,12 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); void MGACRTC2GetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); void MGACRTC2GetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); - + double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out); +#ifdef DEBUG +void MGAG450PrintPLL(ScrnInfoPtr pScrn); +#endif +long MGAG450SavePLLFreq(ScrnInfoPtr pScrn); void MGAprintDac(ScrnInfoPtr pScrn); #ifdef USEMGAHAL @@ -513,7 +601,7 @@ extern MGAMODEINFO TmpMgaModeInfo[2]; extern void MGAExecuteEscCmd(ScrnInfoPtr pScrn, char *cmdline , char *sResult, DisplayModePtr pMode); -void FillDisplayModeStruct(DisplayModePtr pMode, LPMGAMODEINFO pModeInfo); +void MGAFillDisplayModeStruct(DisplayModePtr pMode, LPMGAMODEINFO pModeInfo); /************************************************/ #endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.4 xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.4 Mon Dec 17 15:52:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man Sat Jan 25 21:17:28 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.4 2001/12/17 20:52:32 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.6 2003/01/26 02:17:28 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH MGA __drivermansuffix__ __vendorversion__ @@ -19,11 +19,17 @@ 8, 15, 16, 24, and an 8+24 overlay mode. All visual types are supported for depth 8, and both TrueColor and DirectColor visuals are supported for the other depths except 8+24 mode which supports -PseudoColor, GrayScale and TrueColor. Multi-head configurations +PseudoColor, GrayScale and TrueColor. Multi-card configurations are supported. XVideo is supported on G200 and newer systems, with either .B TexturedVideo -or video overlay. +or video overlay. The second head of dual-head cards is supported for +the G450 and G550. Support for the second head on G400 cards requires +a binary-only "mga_hal" module that is available from Matrox +<http://www.matrox.com>, and may be on the CD supplied with the card. +That module also provides various other enhancements, +and may be necessary to use the DVI (digital) output on the G550 +(and other cards). .SH SUPPORTED HARDWARE The .B mga @@ -44,6 +50,10 @@ Millennium G200 and Mystique G200 .TP 12 .B G400 +.TP 12 +.B G450 +.TP 12 +.B G550 .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -57,9 +67,11 @@ .PP .RS 4 "mga2064w", "mga1064sg", "mga2164w", "mga2164w agp", "mgag100", "mgag200", -"mgag200 pci" "mgag400". +"mgag200 pci", "mgag400", "mgag550". .RE .PP +The G450 is Chipset "mgag400" with ChipRev 0x80. +.PP The driver will auto-detect the amount of video memory present for all chips except the Millennium II. In the Millennium II case it defaults to 4096\ kBytes. When using a Millennium II, the actual amount of video @@ -92,6 +104,10 @@ .BI "Option \*qNoAccel\*q \*q" boolean \*q Disable or enable acceleration. Default: acceleration is enabled. .TP +.BI "Option \*qNoHal\*q \*q" boolean \*q +Disable or enable loading the "mga_hal" module. Default: the module is +loaded when available and when using hardware that it supports. +.TP .BI "Option \*qOverclockMem\*q" Set clocks to values used by some commercial X-Servers (G100, G200 and G400 only). Default: off. @@ -137,4 +153,4 @@ .SH AUTHORS Authors include: Radoslaw Kapitan, Mark Vojkovich, and also David Dawes, Guy Desbief, Dirk Hohndel, Doug Merritt, Andrew E. Mileski, Andrew van der Stock, -Leonard N. Zubkoff. +Leonard N. Zubkoff, Andrew C. Aitchison. Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h:1.2 --- /dev/null Thu Feb 27 12:31:02 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h Mon Dec 16 11:19:18 2002 @@ -0,0 +1,152 @@ +/* mga_common.h -- common header definitions for MGA 2D/3D/DRM suite + * + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Converted to common header format: + * Jens Owen <jens@tungstengraphics.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h,v 1.2 2002/12/16 16:19:18 dawes Exp $ + * + */ + +#ifndef _MGA_COMMON_H_ +#define _MGA_COMMON_H_ + +/* + * WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (mga_drm.h) + */ + +#define DRM_MGA_IDLE_RETRY 2048 +#define DRM_MGA_NR_TEX_HEAPS 2 + +typedef struct { + int installed; + unsigned long phys_addr; + int size; +} drmMGAWarpIndex; + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_MGA_INIT 0x00 +#define DRM_MGA_FLUSH 0x01 +#define DRM_MGA_RESET 0x02 +#define DRM_MGA_SWAP 0x03 +#define DRM_MGA_CLEAR 0x04 +#define DRM_MGA_VERTEX 0x05 +#define DRM_MGA_INDICES 0x06 +#define DRM_MGA_ILOAD 0x07 +#define DRM_MGA_BLIT 0x08 +#define DRM_MGA_GETPARAM 0x09 + +typedef struct { + enum { + MGA_INIT_DMA = 0x01, + MGA_CLEANUP_DMA = 0x02 + } func; + + unsigned long sarea_priv_offset; + + int chipset; + int sgram; + + unsigned int maccess; + + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + + unsigned int texture_offset[DRM_MGA_NR_TEX_HEAPS]; + unsigned int texture_size[DRM_MGA_NR_TEX_HEAPS]; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long status_offset; + unsigned long warp_offset; + unsigned long primary_offset; + unsigned long buffers_offset; +} drmMGAInit; + +typedef enum { + DRM_MGA_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */ + DRM_MGA_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */ + DRM_MGA_LOCK_FLUSH = 0x04, /* Flush this context's DMA queue first */ + DRM_MGA_LOCK_FLUSH_ALL = 0x08, /* Flush all DMA queues first */ + /* These *HALT* flags aren't supported yet + -- they will be used to support the + full-screen DGA-like mode. */ + DRM_MGA_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues */ + DRM_MGA_HALT_CUR_QUEUES = 0x20 /* Halt all current queues */ +} drmMGALockFlags; + +typedef struct { + int context; + drmMGALockFlags flags; +} drmMGALock; + +typedef struct { + int idx; + unsigned int dstorg; + unsigned int length; +} drmMGAIload; + +typedef struct { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drmMGAClearRec; + +typedef struct { + int idx; /* buffer to queue */ + int used; /* bytes in use */ + int discard; /* client finished with buffer? */ +} drmMGAVertex; + +typedef struct { + unsigned int planemask; + unsigned int srcorg; + unsigned int dstorg; + int src_pitch, dst_pitch; + int delta_sx, delta_sy; + int delta_dx, delta_dy; + int height, ydir; /* flip image vertically */ + int source_pitch, dest_pitch; +} drmMGABlit; + +/* 3.1: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define MGA_PARAM_IRQ_NR 1 + +typedef struct { + int param; + int *value; +} drmMGAGetParam; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.49 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.51 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.49 Fri Jan 11 10:42:57 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c Mon Sep 16 14:05:55 2002 @@ -2,7 +2,7 @@ * MGA-1064, MGA-G100, MGA-G200, MGA-G400, MGA-G550 RAMDAC driver */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.49 2002/01/11 15:42:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.51 2002/09/16 18:05:55 eich Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -212,8 +212,8 @@ double f_pll; if(MGAISGx50(pMga)) { - MGAG450SetPLLFreq(pScrn, f_out); - return; + pReg->Clock = f_out; + return; } /* Do the calculations for m, n, p and s */ @@ -285,7 +285,7 @@ pReg->DacRegs[i] = initDAC[i]; } ); /* MGA_NOT_HAL */ - + switch(pMga->Chipset) { case PCI_CHIP_MGA1064: @@ -529,7 +529,7 @@ OUTREG(MGAREG_ZORG, 0); } - MGAGSetPCLK(pScrn, mode->Clock); + MGAGSetPCLK(pScrn, mode->Clock); ); /* MGA_NOT_HAL */ /* This disables the VGA memory aperture */ @@ -616,6 +616,7 @@ /* * MGAGRestorePalette */ + static void MGAGRestorePalette(ScrnInfoPtr pScrn, unsigned char* pntr) { @@ -623,8 +624,8 @@ int i = 768; outMGAdreg(MGA1064_WADR_PAL, 0x00); - while(i--) - outMGAdreg(MGA1064_COL_PAL, *(pntr++)); + while(i--) + outMGAdreg(MGA1064_COL_PAL, *(pntr++)); } /* @@ -637,8 +638,8 @@ int i = 768; outMGAdreg(MGA1064_RADR_PAL, 0x00); - while(i--) - *(pntr++) = inMGAdreg(MGA1064_COL_PAL); + while(i--) + *(pntr++) = inMGAdreg(MGA1064_COL_PAL); } /* @@ -655,7 +656,22 @@ MGAPtr pMga = MGAPTR(pScrn); CARD32 optionMask; + /* + * Pixel Clock needs to be restored regardless if we use + * HALLib or not. HALlib doesn't do a good job restoring + * VESA modes. MATROX: hint, hint. + */ + if (MGAISGx50(pMga) && mgaReg->Clock) { + /* + * With HALlib program only when restoring to console! + * To test this we check for Clock == 0. + */ + MGAG450SetPLLFreq(pScrn, mgaReg->Clock); + mgaReg->PIXPLLCSaved = FALSE; + } + if(!pMga->SecondCrtc) { + MGA_NOT_HAL( /* * Code is needed to get things back to bank zero. @@ -673,7 +689,7 @@ (i == 0x1c) || ((i >= 0x1f) && (i <= 0x29)) || ((i >= 0x30) && (i <= 0x37)) || - (MGAISGx50(pMga) && + (MGAISGx50(pMga) && !mgaReg->PIXPLLCSaved && ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) || (i == 0x4c) || (i == 0x4d) || (i == 0x4e)))) continue; @@ -696,7 +712,21 @@ mgaReg->Option3); } ); /* MGA_NOT_HAL */ - +#ifdef USEMGAHAL + /* + * Work around another bug in HALlib: it doesn't restore the + * DAC width register correctly. MATROX: hint, hint. + */ + MGA_HAL( + outMGAdac(MGA1064_MUL_CTL,mgaReg->DacRegs[0]); + outMGAdac(MGA1064_MISC_CTL,mgaReg->DacRegs[1]); + if (!MGAISGx50(pMga)) { + outMGAdac(MGA1064_PIX_PLLC_M,mgaReg->DacRegs[2]); + outMGAdac(MGA1064_PIX_PLLC_N,mgaReg->DacRegs[3]); + outMGAdac(MGA1064_PIX_PLLC_P,mgaReg->DacRegs[4]); + } + ); +#endif /* restore CRTCEXT regs */ for (i = 0; i < 6; i++) OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i); @@ -706,7 +736,7 @@ */ vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | (restoreFonts ? VGA_SR_FONTS : 0)); - MGAGRestorePalette(pScrn, vgaReg->DAC); + MGAGRestorePalette(pScrn, vgaReg->DAC); /* * this is needed to properly restore start address @@ -751,6 +781,7 @@ for (i=0; i<6; i++) ErrorF(" %02X", mgaReg->ExtVga[i]); ErrorF("\n"); #endif + } /* @@ -765,6 +796,15 @@ int i; MGAPtr pMga = MGAPTR(pScrn); + /* + * Pixel Clock needs to be restored regardless if we use + * HALLib or not. HALlib doesn't do a good job restoring + * VESA modes (s.o.). MATROX: hint, hint. + */ + if (MGAISGx50(pMga)) { + mgaReg->Clock = MGAG450SavePLLFreq(pScrn); + } + if(pMga->SecondCrtc == TRUE) { for(i = 0x80; i < 0xa0; i++) mgaReg->dac2[i-0x80] = inMGAdac(i); @@ -790,7 +830,29 @@ */ vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | (saveFonts ? VGA_SR_FONTS : 0)); MGAGSavePalette(pScrn, vgaReg->DAC); + /* + * Work around another bug in HALlib: it doesn't restore the + * DAC width register correctly. + */ +#ifdef USEMGAHAL + /* + * Work around another bug in HALlib: it doesn't restore the + * DAC width register correctly (s.o.). MATROX: hint, hint. + */ + MGA_HAL( + if (mgaReg->DacRegs == NULL) { + mgaReg->DacRegs = xnfcalloc(MGAISGx50(pMga) ? 2 : 5, 1); + } + mgaReg->DacRegs[0] = inMGAdac(MGA1064_MUL_CTL); + mgaReg->DacRegs[1] = inMGAdac(MGA1064_MISC_CTL); + if (!MGAISGx50(pMga)) { + mgaReg->DacRegs[2] = inMGAdac(MGA1064_PIX_PLLC_M); + mgaReg->DacRegs[3] = inMGAdac(MGA1064_PIX_PLLC_N); + mgaReg->DacRegs[4] = inMGAdac(MGA1064_PIX_PLLC_P); + } + ); +#endif MGA_NOT_HAL( /* * The port I/O code necessary to read in the extended registers. @@ -798,6 +860,8 @@ for (i = 0; i < DACREGSIZE; i++) mgaReg->DacRegs[i] = inMGAdac(i); + mgaReg->PIXPLLCSaved = TRUE; + mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG); mgaReg->Option2 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION2); @@ -876,7 +940,12 @@ MGAPtr pMga = MGAPTR(pScrn); x += 64; y += 64; - +#ifdef USEMGAHAL + MGA_HAL( + x += pMga->HALGranularityOffX; + y += pMga->HALGranularityOffY; + ); +#endif /* cursor update must never occurs during a retrace period (pp 4-160) */ while( INREG( MGAREG_Status ) & 0x08 ); Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c:1.15 Mon Dec 10 18:02:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c Mon Sep 16 14:05:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.15 2001/12/10 23:02:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.16 2002/09/16 18:05:55 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -101,6 +101,7 @@ while(1) { + pitch = FindSmallestPitch(pMga, Bpp, pMode->HDisplay); size = pitch * Bpp * pMode->VDisplay; @@ -118,8 +119,7 @@ mode->mode = pMode; mode->flags = DGA_CONCURRENT_ACCESS; - - if(pixmap) + if(pixmap) mode->flags |= DGA_PIXMAP_AVAILABLE; if(!pMga->NoAccel) { mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; @@ -140,7 +140,8 @@ mode->viewportWidth = pMode->HDisplay; mode->viewportHeight = pMode->VDisplay; mode->xViewportStep = (3 - pMga->BppShifts[Bpp - 1]); - if((Bpp == 3) && (pMga->Chipset == PCI_CHIP_MGAG400)) + if((Bpp == 3) && + (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550)) mode->xViewportStep <<= 1; mode->yViewportStep = 1; mode->viewportFlags = DGA_FLIP_RETRACE; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.22 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.22 Wed Sep 26 08:59:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c Sat Feb 8 16:26:58 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.22 2001/09/26 12:59:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.28 2003/02/08 21:26:58 dawes Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -24,7 +24,7 @@ * OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith WHitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> * Gareth Hughes <gareth@valinux.com> */ @@ -251,11 +251,11 @@ pConfigs[i].redSize = 8; pConfigs[i].greenSize = 8; pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 8; + pConfigs[i].alphaSize = 0; pConfigs[i].redMask = 0x00FF0000; pConfigs[i].greenMask = 0x0000FF00; pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0; + pConfigs[i].alphaMask = 0x0; if ( accum ) { pConfigs[i].accumRedSize = 16; pConfigs[i].accumGreenSize = 16; @@ -273,7 +273,7 @@ pConfigs[i].doubleBuffer = FALSE; } pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 32; + pConfigs[i].bufferSize = 24; if ( depth ) { pConfigs[i].depthSize = 24; pConfigs[i].stencilSize = 8; @@ -342,13 +342,29 @@ static void MGAWaitForIdleDMA( ScrnInfoPtr pScrn ) { MGAPtr pMga = MGAPTR(pScrn); + drmMGALock lock; int ret; int i = 0; + memset( &lock, 0, sizeof(drmMGALock) ); + for (;;) { do { - ret = drmMGAFlushDMA( pMga->drmFD, - DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); + /* first ask for quiescent and flush */ + lock.flags = DRM_MGA_LOCK_QUIESCENT | DRM_MGA_LOCK_FLUSH; + do { + ret = drmCommandWrite( pMga->drmFD, DRM_MGA_FLUSH, + &lock, sizeof( drmMGALock ) ); + } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY ); + + /* if it's still busy just try quiescent */ + if ( ret == -EBUSY ) { + lock.flags = DRM_MGA_LOCK_QUIESCENT; + do { + ret = drmCommandWrite( pMga->drmFD, DRM_MGA_FLUSH, + &lock, sizeof( drmMGALock ) ); + } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY ); + } } while ( ( ret == -EBUSY ) && ( i++ < MGA_TIMEOUT ) ); if ( ret == 0 ) @@ -357,7 +373,7 @@ xf86DrvMsg( pScrn->scrnIndex, X_ERROR, "[dri] Idle timed out, resetting engine...\n" ); - drmMGAEngineReset( pMga->drmFD ); + drmCommandNone( pMga->drmFD, DRM_MGA_RESET ); } } @@ -571,11 +587,14 @@ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; unsigned long mode; unsigned int vendor, device; - int ret, count; + int ret, count, i; + if(pMga->agpSize < 12)pMga->agpSize = 12; + if(pMga->agpSize > 64)pMga->agpSize = 64; /* cap */ + /* FIXME: Make these configurable... */ - pMGADRIServer->agp.size = 12 * 1024 * 1024; + pMGADRIServer->agp.size = pMga->agpSize * 1024 * 1024; pMGADRIServer->warp.offset = 0; pMGADRIServer->warp.size = MGA_WARP_UCODE_SIZE; @@ -588,6 +607,13 @@ pMGADRIServer->primary.size); pMGADRIServer->buffers.size = MGA_NUM_BUFFERS * MGA_BUFFER_SIZE; + + pMGADRIServer->agpTextures.offset = (pMGADRIServer->buffers.offset + + pMGADRIServer->buffers.size); + + pMGADRIServer->agpTextures.size = pMGADRIServer->agp.size - + pMGADRIServer->agpTextures.offset; + if ( drmAgpAcquire( pMga->drmFD ) < 0 ) { xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" ); return FALSE; @@ -750,8 +776,27 @@ "[drm] Added %d %d byte DMA buffers\n", count, MGA_BUFFER_SIZE ); - xf86EnablePciBusMaster( pMga->PciInfo, TRUE ); + i = mylog2(pMGADRIServer->agpTextures.size / MGA_NR_TEX_REGIONS); + if(i < MGA_LOG_MIN_TEX_REGION_SIZE) + i = MGA_LOG_MIN_TEX_REGION_SIZE; + pMGADRIServer->agpTextures.size = (pMGADRIServer->agpTextures.size >> i) << i; + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->agpTextures.offset, + pMGADRIServer->agpTextures.size, + DRM_AGP, 0, + &pMGADRIServer->agpTextures.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add agpTexture mapping\n" ); + return FALSE; + } +/* should i map it ? */ + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] agpTexture handle = 0x%08lx\n", + pMGADRIServer->agpTextures.handle ); + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] agpTexture size: %d kb\n", pMGADRIServer->agpTextures.size/1024 ); + return TRUE; } @@ -814,6 +859,7 @@ memset( &init, 0, sizeof(drmMGAInit) ); + init.func = MGA_INIT_DMA; init.sarea_priv_offset = sizeof(XF86DRISAREARec); switch ( pMga->Chipset ) { @@ -845,7 +891,7 @@ init.texture_offset[0] = pMGADRIServer->textureOffset; init.texture_size[0] = pMGADRIServer->textureSize; - init.fb_offset = pMga->FbAddress; + init.fb_offset = pMGADRIServer->fb.handle; init.mmio_offset = pMGADRIServer->registers.handle; init.status_offset = pMGADRIServer->status.handle; @@ -853,7 +899,10 @@ init.primary_offset = pMGADRIServer->primary.handle; init.buffers_offset = pMGADRIServer->buffers.handle; - ret = drmMGAInitDMA( pMga->drmFD, &init ); + init.texture_offset[1] = pMGADRIServer->agpTextures.handle; + init.texture_size[1] = pMGADRIServer->agpTextures.size; + + ret = drmCommandWrite( pMga->drmFD, DRM_MGA_INIT, &init, sizeof(drmMGAInit)); if ( ret < 0 ) { xf86DrvMsg( pScrn->scrnIndex, X_ERROR, "[drm] Failed to initialize DMA! (%d)\n", ret ); @@ -870,6 +919,38 @@ return TRUE; } +static void MGADRIIrqInit(MGAPtr pMga, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + /* version = drmGetVersion(pMga->drmFD); + if ( version ) { + if ( version->version_major != 3 || + version->version_minor < 0 ) {*/ + if (!pMga->irq) { + pMga->irq = drmGetInterruptFromBusID( + pMga->drmFD, + ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum); + + if((drmCtlInstHandler(pMga->drmFD, pMga->irq)) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding irq handler, " + "there is a device already using that irq\n" + "[drm] falling back to irq-free operation\n"); + pMga->irq = 0; + } else { + pMga->reg_ien = INREG( MGAREG_IEN ); + } + } + + if (pMga->irq) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + pMga->irq); +} + static Bool MGADRIBuffersInit( ScreenPtr pScreen ) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -1064,9 +1145,48 @@ return FALSE; } - /* Check the MGA DRM version */ + /* Check the DRM versioning */ { - drmVersionPtr version = drmGetVersion(pMga->drmFD); + drmVersionPtr version; + + /* Check the DRM lib version. + drmGetLibVersion was not supported in version 1.0, so check for + symbol first to avoid possible crash or hang. + */ + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + version = drmGetLibVersion(pMga->drmFD); + } + else { + /* drmlib version 1.0.0 didn't have the drmGetLibVersion + entry point. Fake it by allocating a version record + via drmGetVersion and changing it to version 1.0.0 + */ + version = drmGetVersion(pMga->drmFD); + version->version_major = 1; + version->version_minor = 0; + version->version_patchlevel = 0; + } + + if (version) { + if (version->version_major != 1 || + version->version_minor < 1) { + /* incompatible drm library version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] MGADRIScreenInit failed because of a version mismatch.\n" + "[dri] libdrm.a module version is %d.%d.%d but version 1.1.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + MGADRICloseScreen( pScreen ); /* FIXME: ??? */ + return FALSE; + } + drmFreeVersion(version); + } + + /* Check the MGA DRM version */ + version = drmGetVersion(pMga->drmFD); if ( version ) { if ( version->version_major != 3 || version->version_minor < 0 ) { @@ -1113,7 +1233,16 @@ DRICloseScreen( pScreen ); return FALSE; } + { + void *scratch_ptr; + int scratch_int; + DRIGetDeviceInfo(pScreen, &pMGADRIServer->fb.handle, + &scratch_int, &scratch_int, + &scratch_int, &scratch_int, + &scratch_ptr); + } + if ( !MGAInitVisualConfigs( pScreen ) ) { DRICloseScreen( pScreen ); return FALSE; @@ -1157,6 +1286,8 @@ return FALSE; } + MGADRIIrqInit(pMga, pScreen); + switch(pMga->Chipset) { case PCI_CHIP_MGAG550: case PCI_CHIP_MGAG400: @@ -1192,6 +1323,14 @@ pMGADRI->logTextureGranularity = i; pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */ + i = mylog2( pMGADRIServer->agpTextures.size / MGA_NR_TEX_REGIONS ); + if ( i < MGA_LOG_MIN_TEX_REGION_SIZE ) + i = MGA_LOG_MIN_TEX_REGION_SIZE; + + pMGADRI->logAgpTextureGranularity = i; + pMGADRI->agpTextureOffset = (unsigned int)pMGADRIServer->agpTextures.handle; + pMGADRI->agpTextureSize = (unsigned int)pMGADRIServer->agpTextures.size; + pMGADRI->registers.handle = pMGADRIServer->registers.handle; pMGADRI->registers.size = pMGADRIServer->registers.size; pMGADRI->status.handle = pMGADRIServer->status.handle; @@ -1210,13 +1349,22 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + drmMGAInit init; if ( pMGADRIServer->drmBuffers ) { drmUnmapBufs( pMGADRIServer->drmBuffers ); pMGADRIServer->drmBuffers = NULL; } + + if (pMga->irq) { + drmCtlUninstHandler(pMga->drmFD); + pMga->irq = 0; + } - drmMGACleanupDMA( pMga->drmFD ); + /* Cleanup DMA */ + memset( &init, 0, sizeof(drmMGAInit) ); + init.func = MGA_CLEANUP_DMA; + drmCommandWrite( pMga->drmFD, DRM_MGA_INIT, &init, sizeof(drmMGAInit) ); if ( pMGADRIServer->status.map ) { drmUnmap( pMGADRIServer->status.map, pMGADRIServer->status.size ); @@ -1233,6 +1381,11 @@ if ( pMGADRIServer->warp.map ) { drmUnmap( pMGADRIServer->warp.map, pMGADRIServer->warp.size ); pMGADRIServer->warp.map = NULL; + } + + if ( pMGADRIServer->agpTextures.map ) { + drmUnmap( pMGADRIServer->agpTextures.map, pMGADRIServer->agpTextures.size ); + pMGADRIServer->agpTextures.map = NULL; } if ( pMGADRIServer->agp.handle ) { Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h:1.6 Tue Apr 10 12:08:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h Fri Nov 29 06:06:42 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.6 2001/04/10 16:08:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.8 2002/11/29 11:06:42 eich Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -24,7 +24,7 @@ * OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith WHitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> * Gareth Hughes <gareth@valinux.com> */ @@ -32,7 +32,7 @@ #define __MGA_DRI_H__ #include "xf86drm.h" -#include "xf86drmMga.h" +#include "mga_common.h" #define MGA_DEFAULT_AGP_MODE 1 #define MGA_MAX_AGP_MODE 4 @@ -66,6 +66,7 @@ drmRegion agp; /* PCI mappings */ + drmRegion fb; drmRegion registers; drmRegion status; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.214 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.231 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.214 Mon Jan 7 16:50:11 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c Wed Jan 29 14:29:49 2003 @@ -45,7 +45,7 @@ * Added digital screen option for first head */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.214 2002/01/07 21:50:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.231 2003/01/29 19:29:49 eich Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -126,12 +126,6 @@ static void MGAFreeScreen(int scrnIndex, int flags); static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -static void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, - int flags); -static void MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, - int PowerManagementMode, - int flags); /* Internally used functions */ static Bool MGAMapMem(ScrnInfoPtr pScrn); @@ -139,12 +133,14 @@ static void MGASave(ScrnInfoPtr pScrn); static void MGARestore(ScrnInfoPtr pScrn); static Bool MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -void MGAAdjustFrameCrtc2(int scrnIndex, int x, int y, int flags); static void MGABlockHandler(int, pointer, pointer, pointer); static void MGAG100BlackMagic(MGAPtr pMga); static int MGAEntityIndex = -1; +#include "mga_merge.h" + + /* * This contains the functions needed by the server after loading the * driver module. It must be supplied, and gets added the driver list by @@ -179,50 +175,19 @@ }; static PciChipsets MGAPciChipsets[] = { - { PCI_CHIP_MGA2064, PCI_CHIP_MGA2064, RES_SHARED_VGA }, - { PCI_CHIP_MGA1064, PCI_CHIP_MGA1064, RES_SHARED_VGA }, - { PCI_CHIP_MGA2164, PCI_CHIP_MGA2164, RES_SHARED_VGA }, - { PCI_CHIP_MGA2164_AGP, PCI_CHIP_MGA2164_AGP, RES_SHARED_VGA }, - { PCI_CHIP_MGAG100, PCI_CHIP_MGAG100, RES_SHARED_VGA }, - { PCI_CHIP_MGAG100_PCI, PCI_CHIP_MGAG100_PCI, RES_SHARED_VGA }, - { PCI_CHIP_MGAG200, PCI_CHIP_MGAG200, RES_SHARED_VGA }, - { PCI_CHIP_MGAG200_PCI, PCI_CHIP_MGAG200_PCI, RES_SHARED_VGA }, - { PCI_CHIP_MGAG400, PCI_CHIP_MGAG400, RES_SHARED_VGA }, - { PCI_CHIP_MGAG550, PCI_CHIP_MGAG550, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } + { PCI_CHIP_MGA2064, PCI_CHIP_MGA2064, (resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGA1064, PCI_CHIP_MGA1064, (resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGA2164, PCI_CHIP_MGA2164, (resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGA2164_AGP, PCI_CHIP_MGA2164_AGP,(resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGAG100, PCI_CHIP_MGAG100, (resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGAG100_PCI, PCI_CHIP_MGAG100_PCI,(resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGAG200, PCI_CHIP_MGAG200, (resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGAG200_PCI, PCI_CHIP_MGAG200_PCI,(resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGAG400, PCI_CHIP_MGAG400, (resRange*)RES_SHARED_VGA }, + { PCI_CHIP_MGAG550, PCI_CHIP_MGAG550, (resRange*)RES_SHARED_VGA }, + { -1, -1, (resRange*)RES_UNDEFINED } }; -typedef enum { - OPTION_SW_CURSOR, - OPTION_HW_CURSOR, - OPTION_PCI_RETRY, - OPTION_SYNC_ON_GREEN, - OPTION_NOACCEL, - OPTION_SHOWCACHE, - OPTION_OVERLAY, - OPTION_MGA_SDRAM, - OPTION_SHADOW_FB, - OPTION_FBDEV, - OPTION_COLOR_KEY, - OPTION_SET_MCLK, - OPTION_OVERCLOCK_MEM, - OPTION_VIDEO_KEY, - OPTION_ROTATE, - OPTION_TEXTURED_VIDEO, - OPTION_CRTC2HALF, - OPTION_CRTC2RAM, - OPTION_INT10, - OPTION_AGP_MODE, - OPTION_DIGITAL, - OPTION_TV, - OPTION_TVSTANDARD, - OPTION_CABLETYPE, - OPTION_USEIRQZERO, - OPTION_NOHAL, - OPTION_SWAPPED_HEAD, - OPTION_DRI -} MGAOpts; - static const OptionInfoRec MGAOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -244,13 +209,20 @@ { OPTION_CRTC2RAM, "Crtc2Ram", OPTV_INTEGER, {0}, FALSE }, { OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, - { OPTION_DIGITAL, "DigitalScreen",OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DIGITAL1, "DigitalScreen1",OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DIGITAL2, "DigitalScreen2",OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TV, "TV", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE }, { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE }, { OPTION_NOHAL, "NoHal", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HSYNC2, "Monitor2HSync", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_VREFRESH2, "Monitor2VRefresh", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_MONITOR2POS, "Monitor2Position", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_METAMODES, "MetaModes", OPTV_ANYSTR, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -315,6 +287,7 @@ NULL }; +#ifdef XFree86LOADER #ifdef XF86DRI static const char *drmSymbols[] = { "drmAddBufs", @@ -329,14 +302,13 @@ "drmAgpRelease", "drmAgpUnbind", "drmAgpVendorId", + "drmCommandNone", + "drmCommandWrite", "drmFreeVersion", + "drmGetLibVersion", "drmGetVersion", - "drmMGACleanupDMA", - "drmMGAEngineReset", - "drmMGAFlushDMA", - "drmMGAInitDMA", - "drmMapBufs", "drmMap", + "drmMapBufs", "drmUnmap", "drmUnmapBufs", NULL @@ -347,6 +319,7 @@ "DRICreateInfoRec", "DRIDestroyInfoRec", "DRIFinishScreenInit", + "DRIGetDeviceInfo", "DRILock", "DRIQueryVersion", "DRIScreenInit", @@ -355,6 +328,7 @@ NULL }; #endif +#endif #define MGAuseI2C 1 @@ -379,12 +353,14 @@ NULL }; +#ifdef XFree86LOADER static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", "vbeFree", NULL }; +#endif static const char *int10Symbols[] = { "xf86FreeInt10", @@ -393,30 +369,23 @@ }; static const char *fbdevHWSymbols[] = { - "fbdevHWInit", - "fbdevHWUseBuildinMode", - - "fbdevHWGetVidmem", - - /* colormap */ - "fbdevHWLoadPalette", - - /* ScrnInfo hooks */ - "fbdevHWAdjustFrame", - "fbdevHWEnterVT", - "fbdevHWLeaveVT", - "fbdevHWModeInit", - "fbdevHWRestore", - "fbdevHWSave", - "fbdevHWSwitchMode", - "fbdevHWValidMode", - - "fbdevHWMapMMIO", - "fbdevHWMapVidmem", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", - - NULL + "fbdevHWAdjustFrame", + "fbdevHWEnterVT", + "fbdevHWGetVidmem", + "fbdevHWInit", + "fbdevHWLeaveVT", + "fbdevHWLoadPalette", + "fbdevHWMapMMIO", + "fbdevHWMapVidmem", + "fbdevHWModeInit", + "fbdevHWRestore", + "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", + "fbdevHWUseBuildinMode", + "fbdevHWValidMode", + NULL }; #ifdef USEMGAHAL @@ -431,7 +400,8 @@ "MGASetVgaMode", "MGAValidateMode", "MGAValidateVideoParameters", - NULL + "HALSetDisplayStart", + NULL }; #endif #ifdef XFree86LOADER @@ -510,7 +480,7 @@ 0, X_DEFAULT, X_DEFAULT, FALSE }; -static Bool +Bool MGAGetRec(ScrnInfoPtr pScrn) { /* @@ -528,7 +498,7 @@ return TRUE; } -static void +void MGAFreeRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate == NULL) @@ -609,13 +579,14 @@ } numUsed = xf86MatchPciInstances(MGA_NAME, PCI_VENDOR_MATROX, - MGAChipsets, MGAPciChipsets, devSections, - numDevSections, drv, &usedChips); + MGAChipsets, MGAPciChipsets, devSections, + numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ xfree(devSections); if (numUsed <= 0) return FALSE; + if (flags & PROBE_DETECT) foundScreen = TRUE; else for (i = 0; i < numUsed; i++) { @@ -630,8 +601,8 @@ #ifndef DISABLE_VGA_IO if ((pScrn = xf86ConfigPciEntity(pScrn, 0,usedChips[i], - MGAPciChipsets, NULL, NULL, - NULL, NULL, NULL))) + MGAPciChipsets, NULL, NULL, + NULL, NULL, NULL))) #else smga = xnfalloc(sizeof(MgaSave)); smga->pvp = xf86GetPciInfoForEntity(usedChips[i]); @@ -654,15 +625,16 @@ pScrn->LeaveVT = MGALeaveVT; pScrn->FreeScreen = MGAFreeScreen; pScrn->ValidMode = MGAValidMode; + foundScreen = TRUE; } /* * For cards that can do dual head per entity, mark the entity - * as sharable. + * as sharable. */ pEnt = xf86GetEntityInfo(usedChips[i]); - if (pEnt->chipset == PCI_CHIP_MGAG400 || pEnt->chipset == PCI_CHIP_MGAG550) { + if ((pEnt->chipset == PCI_CHIP_MGAG400 || pEnt->chipset == PCI_CHIP_MGAG550)) { MGAEntPtr pMgaEnt = NULL; DevUnion *pPriv; @@ -723,7 +695,7 @@ * Written and tested. */ -static void +void MGAReadBios(ScrnInfoPtr pScrn) { CARD8 BIOS[0x10000]; @@ -740,8 +712,9 @@ pBios = &pMga->Bios; pBios2 = &pMga->Bios2; - /* Get the output mode set by the BIOS */ - xf86ReadBIOS(pMga->BiosAddress, 0x7ff1, &pMga->BiosOutputMode, sizeof(CARD8)); + /* Get the output mode set by the BIOS */ + xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress + 0x7ff1u, + sizeof(CARD8), &pMga->BiosOutputMode); /* * If the BIOS address was probed, it was found from the PCI config @@ -757,14 +730,16 @@ rlen = xf86ReadPciBIOS(0, pMga->PciTag, pMga->FbBaseReg, BIOS, sizeof(BIOS)); else - rlen = xf86ReadBIOS(pMga->BiosAddress, 0, BIOS, sizeof(BIOS)); + rlen = xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress, + sizeof(BIOS), BIOS); if (rlen < (BIOS[2] << 9)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Could not retrieve video BIOS!\n"); return; } - + + /* Get the video BIOS info block */ if (strncmp((char *)(&BIOS[45]), "MATROX", 6)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS info block not detected!\n"); @@ -791,6 +766,7 @@ default: MGADoBIOSRead(offset, ( CARD8 * ) & pBios2->PinID, sizeof( MGABios2Info )); + break; } /* matrox millennium-2 and mystique pins info */ @@ -860,7 +836,7 @@ * * Resets drawing engine */ -static void +void MGASoftReset(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); @@ -1078,7 +1054,7 @@ MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex,pMga->I2C); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", MonInfo); xf86PrintEDID(MonInfo); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n"); } if (!MonInfo) #endif /* MGAuseI2C */ @@ -1089,8 +1065,22 @@ pMga->ddc1Read ) ; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", MonInfo); xf86PrintEDID( MonInfo ); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n"); } + if (!MonInfo){ + vbeInfoPtr pVbe; + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL,pMga->pEnt->index); + MonInfo = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + + if (MonInfo){ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBE DDC Monitor info: %p\n", MonInfo); + xf86PrintEDID( MonInfo ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of VBE DDC Monitor info\n\n"); + } + } + } /* Restore previous state and unmap MGA memory and MMIO areas */ @@ -1165,14 +1155,14 @@ } #endif /* DISABLE_VGA_IO */ -static void +void MGAProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); - vbeFree(pVbe); + vbeFree(pVbe); } } @@ -1189,14 +1179,10 @@ const char *s; int flags24; MGAEntPtr pMgaEnt = NULL; + Bool Default; #ifdef USEMGAHAL - MGAMODEINFO mgaModeInfo = {0}; - Bool digital1 = FALSE; - Bool digital2 = FALSE; - Bool tv1 = FALSE; - Bool tv2 = FALSE; - Bool swap_head = FALSE; ULONG status; + CARD8 MiscCtlReg; #endif /* @@ -1267,19 +1253,8 @@ pMga->Primary = xf86IsPrimaryPci(pMga->PciInfo); #ifndef DISABLE_VGA_IO - { - resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, - {ResShrIoBlock,0x3C0,0x3DF}, - _END }; - resRange vga1mem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - _END }; - resRange vga2mem[] = { {ResShrMemBlock,0xB0000,0xB7FFF}, - _END }; - xf86SetOperatingState(vgaio, pMga->pEnt->index, ResUnusedOpr); - xf86SetOperatingState(vga1mem, pMga->pEnt->index, ResDisableOpr); - xf86SetOperatingState(vga2mem, pMga->pEnt->index, ResDisableOpr); - } + xf86SetOperatingState(resVgaIo, pMga->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pMga->pEnt->index, ResDisableOpr); #else /* * Set our own access functions, which control the vgaioen bit. @@ -1299,28 +1274,136 @@ pScrn->monitor = pScrn->confScreen->monitor; /* - * In case of DualHead, we need to determine if we are the 'master' head or the 'slave' - * head. In order to do that, at the end of the first initialisation, PrimInit is set as - * DONE to the shared entity. So that the second initialisation knows that something has - * been done before it. This always assume that the first device initialised is the master + * Set the Chipset and ChipRev, allowing config file entries to + * override. + */ + if (pMga->device->chipset && *pMga->device->chipset) { + pScrn->chipset = pMga->device->chipset; + pMga->Chipset = xf86StringToToken(MGAChipsets, pScrn->chipset); + from = X_CONFIG; + } else if (pMga->device->chipID >= 0) { + pMga->Chipset = pMga->device->chipID; + pScrn->chipset = (char *)xf86TokenToString(MGAChipsets, pMga->Chipset); + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", + pMga->Chipset); + } else { + from = X_PROBED; + pMga->Chipset = pMga->PciInfo->chipType; + pScrn->chipset = (char *)xf86TokenToString(MGAChipsets, pMga->Chipset); + } + if (pMga->device->chipRev >= 0) { + pMga->ChipRev = pMga->device->chipRev; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", + pMga->ChipRev); + } else { + pMga->ChipRev = pMga->PciInfo->chipRev; + } + + /* + * This shouldn't happen because such problems should be caught in + * MGAProbe(), but check it just in case. + */ + if (pScrn->chipset == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ChipID 0x%04X is not recognised\n", pMga->Chipset); + return FALSE; + } + if (pMga->Chipset < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Chipset \"%s\" is not recognised\n", pScrn->chipset); + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"", pScrn->chipset); + if (pMga->Chipset == PCI_CHIP_MGAG400) { + if (pMga->ChipRev >= 0x80) + xf86ErrorF(" (G450)\n"); + else + xf86ErrorF(" (G400)\n"); + } else { + xf86ErrorF("\n"); + } +#ifdef USEMGAHAL + if (HAL_CHIPSETS) { + Bool loadHal = TRUE; + + from = X_DEFAULT; + if (xf86FindOption(pMga->device->options, "NoHal")) { + loadHal = !xf86SetBoolOption(pMga->device->options, + "NoHal", !loadHal); + from = X_CONFIG; + } else if (xf86FindOption(pMga->device->options, "Hal")) { + loadHal = xf86SetBoolOption(pMga->device->options, + "Hal", loadHal); + from = X_CONFIG; + } + if (loadHal && xf86LoadSubModule(pScrn, "mga_hal")) { + xf86LoaderReqSymLists(halSymbols, NULL); + xf86DrvMsg(pScrn->scrnIndex, from,"Matrox HAL module used\n"); + pMga->HALLoaded = TRUE; + } else { + xf86DrvMsg(pScrn->scrnIndex, from, "Matrox HAL module not loaded " + "- using builtin mode setup instead\n"); + pMga->HALLoaded = FALSE; + } + } +#endif + + pMga->DualHeadEnabled = FALSE; + if (xf86IsEntityShared(pScrn->entityList[0])) {/* dual-head mode requested*/ +#ifdef USEMGAHAL + if (pMga->HALLoaded || !MGA_DH_NEEDS_HAL(pMga)) { +#else + if (!MGA_DH_NEEDS_HAL(pMga)) { +#endif + pMga->DualHeadEnabled = TRUE; + } else if (xf86IsPrimInitDone(pScrn->entityList[0])) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "This card requires the \"mga_hal\" module for dual-head operation\n" + "\tIt can be found at the Matrox web site <http://www.matrox.com>\n"); + } + } + + /* + * In case of DualHead, we need to determine if we are the 'master' head + * or the 'slave' head. In order to do that, at the end of the first + * initialisation, PrimInit is set as DONE to the shared entity. So that + * the second initialisation knows that something has been done before it. + * This always assume that the first device initialised is the master * head, and the second the slave. * */ if (xf86IsEntityShared(pScrn->entityList[0])) { /* dual-head mode */ - if (!xf86IsPrimInitDone(pScrn->entityList[0])) { /* Is it the first initialisation? */ /* First CRTC */ pMga->SecondCrtc = FALSE; pMga->HWCursor = TRUE; pMgaEnt->pScrn_1 = pScrn; - } - else { + } else if (pMga->DualHeadEnabled) { /* Second CRTC */ pMga->SecondCrtc = TRUE; pMga->HWCursor = FALSE; pMgaEnt->pScrn_2 = pScrn; pScrn->AdjustFrame = MGAAdjustFrameCrtc2; - } + /* + * Fail initialization of second head if we are in MergeFB mode, + * since we do it ourselfs. + */ + if(pMgaEnt->pScrn_1 && MGAPTR(pMgaEnt->pScrn_1)->MergedFB) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Primary head in Merged framebuffer mode. \n" + "Don't let Xfree try to manage the second head.\n" + "Remove the second screen in the \"ServerLayout\"\n" + "Section of the config file."); + return FALSE; + } + } else { + return FALSE; + } + } + + if (pMga->DualHeadEnabled) { #ifdef XF86DRI pMga->GetQuiescence = MGAGetQuiescenceShared; #endif @@ -1332,6 +1415,8 @@ #endif } + + /* * The first thing we should figure out is the depth, bpp, etc. * Our default depth is 8, so pass it to the helper function. @@ -1403,9 +1488,16 @@ memcpy(pMga->Options, MGAOptions, sizeof(MGAOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pMga->Options); + #if !defined(__powerpc__) pMga->softbooted = FALSE; - if (xf86ReturnOptValBool(pMga->Options, OPTION_INT10, FALSE) && + if (pMga->Chipset >= PCI_CHIP_MGAG400 + && !pMga->Primary + && !pMga->SecondCrtc) + Default = TRUE; + else + Default = FALSE; + if (xf86ReturnOptValBool(pMga->Options, OPTION_INT10, Default) && xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; @@ -1421,65 +1513,6 @@ if (pScrn->depth == 8) pScrn->rgbBits = 8; - /* - * Set the Chipset and ChipRev, allowing config file entries to - * override. - */ - if (pMga->device->chipset && *pMga->device->chipset) { - pScrn->chipset = pMga->device->chipset; - pMga->Chipset = xf86StringToToken(MGAChipsets, pScrn->chipset); - from = X_CONFIG; - } else if (pMga->device->chipID >= 0) { - pMga->Chipset = pMga->device->chipID; - pScrn->chipset = (char *)xf86TokenToString(MGAChipsets, pMga->Chipset); - from = X_CONFIG; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", - pMga->Chipset); - } else { - from = X_PROBED; - pMga->Chipset = pMga->PciInfo->chipType; - pScrn->chipset = (char *)xf86TokenToString(MGAChipsets, pMga->Chipset); - } - if (pMga->device->chipRev >= 0) { - pMga->ChipRev = pMga->device->chipRev; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", - pMga->ChipRev); - } else { - pMga->ChipRev = pMga->PciInfo->chipRev; - } - -#ifdef USEMGAHAL - if (HAL_CHIPSETS) { - if (!xf86ReturnOptValBool(pMga->Options, OPTION_NOHAL, FALSE) - && xf86LoadSubModule(pScrn, "mga_hal")) { - xf86LoaderReqSymLists(halSymbols, NULL); - xf86DrvMsg(pScrn->scrnIndex, X_INFO,"Matrox HAL module used\n"); - pMga->HALLoaded = TRUE; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Matrox HAL module not loaded " - "- using builtin mode setup instead\n"); - pMga->HALLoaded = FALSE; - } - } -#endif - - /* - * This shouldn't happen because such problems should be caught in - * MGAProbe(), but check it just in case. - */ - if (pScrn->chipset == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "ChipID 0x%04X is not recognised\n", pMga->Chipset); - return FALSE; - } - if (pMga->Chipset < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Chipset \"%s\" is not recognised\n", pScrn->chipset); - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); - #ifdef XF86DRI from = X_DEFAULT; pMga->agpMode = MGA_DEFAULT_AGP_MODE; @@ -1494,6 +1527,12 @@ } from = X_CONFIG; } + if (xf86GetOptValInteger(pMga->Options, + OPTION_AGP_SIZE, &(pMga->agpSize))) { + /* check later */ + xf86DrvMsg(pScrn->scrnIndex, from, "Using %d MB of AGP memory\n", + pMga->agpSize); + } xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP %dx mode\n", pMga->agpMode); @@ -1581,6 +1620,41 @@ if (xf86ReturnOptValBool(pMga->Options, OPTION_TEXTURED_VIDEO, FALSE)) { pMga->TexturedVideo = TRUE; } + if (xf86ReturnOptValBool(pMga->Options, OPTION_MERGEDFB, FALSE)) { + if(!MGAISGx50(pMga)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "\"Merged Framebuffer\" mode only supported on G450 and G550 boards.\n"); + } else { +#ifdef USEMGAHAL + if(pMga->HALLoaded) + { + pMga->MergedFB = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using \"Merged Framebuffer\" mode.\n"); + /* + * a few options that won't work well together + */ + if(pMga->HWCursor) /*Should we give the choice? */ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + " -- Hardware Cursor disabled.\n"); + pMga->HWCursor = FALSE; + if(pMga->ShadowFB) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + " -- Shadow Framebuffer disabled.\n"); + pMga->ShadowFB = FALSE; + if(pMga->FBDev) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + " -- Framebuffer device disabled.\n"); + pMga->FBDev = FALSE; + } /* MGA_HAL */ + else +#endif + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "HALLib not loaded! NOT using \"Merged Framebuffer\" mode.\n"); + } /* MGA_NOT_HAL */ + } /* ISMGAGx50() */ + } if (pMga->FBDev) { /* check for linux framebuffer device */ if (!xf86LoadSubModule(pScrn, "fbdevhw")) @@ -1596,27 +1670,32 @@ } pMga->Rotate = 0; if ((s = xf86GetOptValString(pMga->Options, OPTION_ROTATE))) { - if(!xf86NameCmp(s, "CW")) { - pMga->ShadowFB = TRUE; - pMga->NoAccel = TRUE; - pMga->HWCursor = FALSE; - pMga->Rotate = 1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Rotating screen clockwise - acceleration disabled\n"); - } else - if(!xf86NameCmp(s, "CCW")) { - pMga->ShadowFB = TRUE; - pMga->NoAccel = TRUE; - pMga->HWCursor = FALSE; - pMga->Rotate = -1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Rotating screen counter clockwise - acceleration disabled\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "\"%s\" is not a valid value for Option \"Rotate\"\n", s); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Valid options are \"CW\" or \"CCW\"\n"); - } + if(!pMga->MergedFB) { + if(!xf86NameCmp(s, "CW")) { + pMga->ShadowFB = TRUE; + pMga->NoAccel = TRUE; + pMga->HWCursor = FALSE; + pMga->Rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n"); + } else + if(!xf86NameCmp(s, "CCW")) { + pMga->ShadowFB = TRUE; + pMga->NoAccel = TRUE; + pMga->HWCursor = FALSE; + pMga->Rotate = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise - acceleration disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + " -- Rotation disabled.\n"); + } } switch (pMga->Chipset) { @@ -1812,7 +1891,7 @@ pScrn->videoRam = MGACountRam(pScrn); } - if(xf86IsEntityShared(pScrn->entityList[0])) { + if (pMga->DualHeadEnabled) { /* This takes gives either half or 8 meg to the second head * whichever is less. */ if(pMga->SecondCrtc == FALSE) { @@ -1839,7 +1918,7 @@ pMgaEnt->masterFbAddress = pMga->FbAddress; pMga->FbMapSize = pMgaEnt->masterFbMapSize = pScrn->videoRam * 1024; - pMgaEnt->slaveFbAddress = pMga->FbAddress + + pMgaEnt->slaveFbAddress = pMga->FbAddress + pMgaEnt->masterFbMapSize; pMgaEnt->slaveFbMapSize = pMgaEnt->slavevideoRam * 1024; pMga->realSrcOrg = pMga->SrcOrg = 0; @@ -1941,7 +2020,6 @@ } if(pMga->SecondCrtc == TRUE) { /* Override on 2nd crtc */ - if ((pMga->ChipRev >= 0x80) || (pMga->Chipset == PCI_CHIP_MGAG550)) { /* G450, G550 */ pMga->MaxClock = 234000; @@ -1966,7 +2044,7 @@ MGA_HAL(clockRanges->interlaceAllowed = FALSE); MGA_HAL(clockRanges->doubleScanAllowed = FALSE); #endif - if (pMga->SecondCrtc == TRUE) + if (pMga->SecondCrtc == TRUE) clockRanges->interlaceAllowed = FALSE; clockRanges->ClockMulFactor = 1; @@ -2037,7 +2115,7 @@ pScrn->display->virtualY, pMga->FbMapSize, LOOKUP_BEST_REFRESH); - + if (linePitches) xfree(linePitches); } @@ -2064,109 +2142,76 @@ } #ifdef USEMGAHAL MGA_HAL( - swap_head - = xf86ReturnOptValBool(pMga->Options, OPTION_SWAPPED_HEAD, FALSE); if(pMga->SecondCrtc == FALSE) { + pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); pMga->pClientStruct = xalloc(sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; MGAMapMem(pScrn); + /* + * For some reason the MGAOPM_DMA_BLIT bit needs to be set + * on G200 before opening the HALlib. I don't know why. + * MATROX: hint, hint. + */ + /*if (pMga->Chipset == PCI_CHIP_MGAG200 || + pMga->Chipset == PCI_CHIP_MGAG200_PCI) */{ + CARD32 opmode; + opmode = INREG(MGAREG_OPMODE); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | opmode); + } + /* wrapping OpenLibrary to fix broken registers. MATROX: hint, hint. */ + MiscCtlReg = inMGAdac(MGA1064_MISC_CTL); MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); + outMGAdac(MGA1064_MISC_CTL,MiscCtlReg); MGAUnmapMem(pScrn); pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); - digital1 = ISDIGITAL1(pMga); - digital2 = ISDIGITAL2(pMga); - tv1 = ISTV1(pMga); - tv2 = ISTV2(pMga); - - /* Display type information */ - if (digital1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Digital screen detected on first head.\n"); - mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL1; - } else if (tv1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "TV detected on first head.\n"); - mgaModeInfo.flOutput = MGAMODEINFO_TV; - } else { - if (!swap_head) { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1; - } else { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2; - } - } - /* copy the board handles */ - if (xf86IsEntityShared(pScrn->entityList[0])) { + if (pMga->DualHeadEnabled) { pMgaEnt->pClientStruct = pMga->pClientStruct; pMgaEnt->pBoard = pMga->pBoard; pMgaEnt->pMgaHwInfo = pMga->pMgaHwInfo; } - mgaModeInfo.ulDispWidth = pScrn->virtualX; - mgaModeInfo.ulDispHeight = pScrn->virtualY; - mgaModeInfo.ulDeskWidth = pScrn->virtualX; - mgaModeInfo.ulDeskHeight = pScrn->virtualY; - mgaModeInfo.ulBpp = pScrn->bitsPerPixel; - mgaModeInfo.ulZoom = 1; - } else { /* Second CRTC && entity is shared */ - if (digital2 == TRUE) { - mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2 | - MGAMODEINFO_SECOND_CRTC; - } else if (tv2 == TRUE) { - mgaModeInfo.flOutput = MGAMODEINFO_TV | - MGAMODEINFO_SECOND_CRTC; - } else { - if (!swap_head) { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC; - } else { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1 | - MGAMODEINFO_SECOND_CRTC; - } - } - mgaModeInfo.ulDispWidth = pScrn->virtualX; - mgaModeInfo.ulDispHeight = pScrn->virtualY; - mgaModeInfo.ulDeskWidth = pScrn->virtualX; - mgaModeInfo.ulDeskHeight = pScrn->virtualY; - mgaModeInfo.ulBpp = pScrn->bitsPerPixel; - mgaModeInfo.ulZoom = 1; + } else { /* Second CRTC && entity is shared */ pMga->pBoard = pMgaEnt->pBoard; pMga->pClientStruct = pMgaEnt->pClientStruct; pMga->pMgaHwInfo = pMgaEnt->pMgaHwInfo; - digital1 = ISDIGITAL1(pMga); - digital2 = ISDIGITAL2(pMga); - tv1 = ISTV1(pMga); - tv2 = ISTV2(pMga); - - if (digital2) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Digital screen detected on second head.\n"); - mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2 | - MGAMODEINFO_SECOND_CRTC; - } else if (tv2) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "TV detected on second head.\n"); - mgaModeInfo.flOutput = MGAMODEINFO_TV | - MGAMODEINFO_SECOND_CRTC; - } else { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC; - } } + + MGAFillModeInfoStruct(pScrn,NULL); + /* Fields usually handled by MGAFillModeInfoStruct, but are unavailable + * because no mode is given + */ + pMga->pMgaModeInfo->ulDispWidth = pScrn->virtualX; + pMga->pMgaModeInfo->ulDispHeight = pScrn->virtualY; - if((status = MGAValidateMode(pMga->pBoard,&mgaModeInfo)) != 0) { + + if (ISDIGITAL1(pMga)) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Digital screen detected on first head.\n"); + if (ISTV1(pMga)) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "TV detected on first head.\n"); + if (ISDIGITAL2(pMga)) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Digital screen detected on second head.\n"); + if (ISTV2(pMga)) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "TV detected on second head.\n"); + + + if((status = MGAValidateMode(pMga->pBoard,pMga->pMgaModeInfo)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MGAValidateMode from HALlib found the mode to be invalid.\n" "\tError: 0x%lx\n", status); return FALSE; } - pScrn->displayWidth = mgaModeInfo.ulFBPitch; + pScrn->displayWidth = pMga->pMgaModeInfo->ulFBPitch; ); /* MGA_HAL */ #endif @@ -2182,7 +2227,11 @@ * Can we trust HALlib to set the memory configuration * registers correctly? */ +#ifdef USEMGAHAL else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && +#else + else if ((pMga->softbooted || pMga->Primary) && +#endif (pMga->Chipset != PCI_CHIP_MGA2064) && (pMga->Chipset != PCI_CHIP_MGA2164) && (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { @@ -2264,7 +2313,7 @@ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "YDstOrg is set to %d\n", pMga->YDstOrg); - if(xf86IsEntityShared(pScrn->entityList[0])) { + if(pMga->DualHeadEnabled) { if(pMga->SecondCrtc == FALSE) { pMga->FbUsableSize = pMgaEnt->masterFbMapSize; /* Allocate HW cursor buffer at the end of video ram */ @@ -2287,7 +2336,7 @@ pMga->FbUsableSize = pMgaEnt->slaveFbMapSize; pMga->HWCursor = FALSE; } - } else { + } else { pMga->FbUsableSize = pMga->FbMapSize - pMga->YDstOrg * bytesPerPixel; /* Allocate HW cursor buffer at the end of video ram */ if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) { @@ -2362,13 +2411,22 @@ pMga->CurrentLayout.weight.blue = pScrn->weight.blue; pMga->CurrentLayout.Overlay8Plus24 = pMga->Overlay8Plus24; pMga->CurrentLayout.mode = pScrn->currentMode; + + + + if(pMga->MergedFB) { + MGAPreInitMergedFB(pScrn,flags); + }; + + #ifdef USEMGAHAL MGA_HAL( /* Close the library after preinit */ /* This needs to only happen after this board has completed preinit * both times */ - if(xf86IsEntityShared(pScrn->entityList[0])) { + + if(pMga->DualHeadEnabled) { /* Entity is shared make sure refcount == 2 */ /* If ref count is 2 then reset it to 0 */ if(pMgaEnt->refCount == 2) { @@ -2397,10 +2455,12 @@ if (pMga->pMgaHwInfo) xfree(pMga->pMgaHwInfo); } + ); /* MGA_HAL */ #endif xf86SetPrimInitDone(pScrn->entityList[0]); + return TRUE; } @@ -2553,16 +2613,39 @@ } #ifdef USEMGAHAL -/* Convert DisplayModeRec parameters in MGAMODEINFO parameters. */ -static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode) +/* Convert DisplayModeRec parameters in MGAMODEINFO parameters. +* mode parameter optionnal. */ +void +MGAFillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode) { - const char *s; + const char *s; MGAPtr pMga = MGAPTR(pScrn); + + Bool digital1 = FALSE; + Bool digital2 = FALSE; + Bool tv1 = FALSE; + Bool tv2 = FALSE; + Bool swap_head + = xf86ReturnOptValBool(pMga->Options, OPTION_SWAPPED_HEAD, FALSE); + + if(pMga->MergedFB && mode && mode->Private && (mode->PrivSize == 0)) { + mode = pMga->SecondCrtc ? + ((MergedDisplayModePtr)mode->Private)->Monitor2 + : ((MergedDisplayModePtr)mode->Private)->Monitor1; + } + + + if (pMga->pMgaHwInfo) + { + digital1 = ISDIGITAL1(pMga); + digital2 = ISDIGITAL2(pMga); + tv1 = ISTV1(pMga); + tv2 = ISTV2(pMga); + } - pMga->pMgaModeInfo = xalloc(sizeof(MGAMODEINFO)); + /*FIXME: causes segfault elsewhere if not commented*/ + /*if(!pMga->pMgaModeInfo)*/ pMga->pMgaModeInfo = xalloc(sizeof(MGAMODEINFO)); pMga->pMgaModeInfo->flOutput = 0; - pMga->pMgaModeInfo->ulDispWidth = mode->HDisplay; - pMga->pMgaModeInfo->ulDispHeight = mode->VDisplay; pMga->pMgaModeInfo->ulDeskWidth = pScrn->virtualX; pMga->pMgaModeInfo->ulDeskHeight = pScrn->virtualY; pMga->pMgaModeInfo->ulFBPitch = 0; @@ -2600,20 +2683,55 @@ pMga->pMgaModeInfo->ulCableType = TV_YC_COMPOSITE; } - pMga->pMgaModeInfo->ulHorizRate = 0; - pMga->pMgaModeInfo->ulPixClock = mode->Clock; - pMga->pMgaModeInfo->ulHFPorch = mode->HSyncStart - mode->HDisplay; - pMga->pMgaModeInfo->ulHSync = mode->HSyncEnd - mode->HSyncStart; - pMga->pMgaModeInfo->ulHBPorch = mode->HTotal - mode->HSyncEnd; - pMga->pMgaModeInfo->ulVFPorch = mode->VSyncStart - mode->VDisplay; - pMga->pMgaModeInfo->ulVSync = mode->VSyncEnd - mode->VSyncStart; - pMga->pMgaModeInfo->ulVBPorch = mode->VTotal - mode->VSyncEnd; + if(mode) { + pMga->pMgaModeInfo->ulHorizRate = 0; + pMga->pMgaModeInfo->ulDispWidth = mode->HDisplay; + pMga->pMgaModeInfo->ulDispHeight = mode->VDisplay; + pMga->pMgaModeInfo->ulPixClock = mode->Clock; + pMga->pMgaModeInfo->ulHFPorch = mode->HSyncStart - mode->HDisplay; + pMga->pMgaModeInfo->ulHSync = mode->HSyncEnd - mode->HSyncStart; + pMga->pMgaModeInfo->ulHBPorch = mode->HTotal - mode->HSyncEnd; + pMga->pMgaModeInfo->ulVFPorch = mode->VSyncStart - mode->VDisplay; + pMga->pMgaModeInfo->ulVSync = mode->VSyncEnd - mode->VSyncStart; + pMga->pMgaModeInfo->ulVBPorch = mode->VTotal - mode->VSyncEnd; + } /* Use DstOrg directly */ /* This is an offset in pixels not memory */ pMga->pMgaModeInfo->ulDstOrg = pMga->DstOrg / (pScrn->bitsPerPixel / 8); pMga->pMgaModeInfo->ulDisplayOrg = pMga->DstOrg / (pScrn->bitsPerPixel / 8); pMga->pMgaModeInfo->ulPanXGran = 0; pMga->pMgaModeInfo->ulPanYGran = 0; + + if(pMga->SecondCrtc == TRUE) { + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_SECOND_CRTC | + MGAMODEINFO_FORCE_PITCH | + MGAMODEINFO_FORCE_DISPLAYORG; + if (digital2) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL2; + } else if (tv2) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; + } else { + if (!swap_head) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; + } else { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; + } + } + } else { + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_FORCE_PITCH; + if (digital1) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL1; + } else if (tv1) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; + } else { + if (!swap_head) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; + } else { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; + } + } + } + pMga->pMgaModeInfo->ulFBPitch = pScrn->displayWidth; } #endif @@ -2630,26 +2748,16 @@ vgaRegPtr vgaReg; MGAPtr pMga = MGAPTR(pScrn); MGARegPtr mgaReg; -#ifdef USEMGAHAL - Bool digital1 = FALSE; - Bool digital2 = FALSE; - Bool tv1 = FALSE; - Bool tv2 = FALSE; - ULONG status; - Bool swap_head - = xf86ReturnOptValBool(pMga->Options, OPTION_SWAPPED_HEAD, FALSE); - if (pMga->pMgaHwInfo) - { - digital1 = ISDIGITAL1(pMga); - digital2 = ISDIGITAL2(pMga); - tv1 = ISTV1(pMga); - tv2 = ISTV2(pMga); - } +#ifdef USEMGAHAL + ULONG status; #endif - vgaHWUnlock(hwp); +/* if(pMga->MergedFB && mode && mode->Private && (mode->PrivSize == 0)) { + mode = (DisplayModePtr)mode->Private; + }*/ + /* Initialise the ModeReg values */ if (!vgaHWInit(pScrn, mode)) return FALSE; @@ -2662,60 +2770,55 @@ vgaHWProtect(pScrn, TRUE); vgaReg = &hwp->ModeReg; mgaReg = &pMga->ModeReg; - #ifdef USEMGAHAL - MGA_HAL( - FillModeInfoStruct(pScrn,mode); + MGA_HAL( + MGAFillModeInfoStruct(pScrn,mode); + + /* Validate the parameters */ + if ((status = MGAValidateMode(pMga->pBoard, pMga->pMgaModeInfo)) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "MGAValidateMode from HALlib found the mode to be invalid.\n" + "\tError: %lx\n", status); + return FALSE; + } - if(pMga->SecondCrtc == TRUE) { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; - if (digital2) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL2; - } else if (tv2) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; - } else { - if (!swap_head) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; - } else { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; - } - } - } else { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_FORCE_PITCH; - if (digital1) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL1; - } else if (tv1) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; - } else { - if (!swap_head) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; - } else { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; + /* + * Find mode for second head. + */ + if(pMga->MergedFB) { + + MGAFillModeInfoStruct(pMga->pScrn2,mode); + /* Validates the Video parameters */ + if ((status = MGAValidateVideoParameters(pMga->pBoard, MGAPTR(pMga->pScrn2)->pMgaModeInfo)) + != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "MGAValidateVideoParameters from HALlib found the mode to be invalid.\n\tError: %lx\n", status); + return FALSE; } } - } + ); /*MGA_HAL */ + +#endif - pMga->pMgaModeInfo->ulFBPitch = pScrn->displayWidth; +#ifdef USEMGAHAL +MGA_HAL( - /* Validate the parameters */ - if ((status = MGAValidateMode(pMga->pBoard, pMga->pMgaModeInfo)) != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MGAValidateMode from HALlib found the mode to be invalid.\n" - "\tError: %lx\n", status); - return FALSE; - } + /*************************** ESC *****************************/ + TmpMgaModeInfo[0] = *pMga->pMgaModeInfo; + + if(pMga->SecondCrtc == TRUE) + pMgaModeInfo[1] = pMga->pMgaModeInfo; + else + pMgaModeInfo[0] = pMga->pMgaModeInfo; + + TmpMgaModeInfo[0].ulDispWidth = 0; + + if(!pMga->MergedFB) /* FIXME: Must deal with this once PowerDesk & MergedFB + compatibility will exist */ + MGAFillDisplayModeStruct(mode, pMga->pMgaModeInfo); + /*************************************************************/ - /* Validates the Video parameters */ - if ((status = MGAValidateVideoParameters(pMga->pBoard, pMga->pMgaModeInfo)) - != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MGAValidateVideoParameters from HALlib found the mode to be" - " invalid.\n\tError: %lx\n", status); - return FALSE; - } - ); /* MGA_HAL */ +); /* MGA_HAL */ #endif #ifdef XF86DRI @@ -2733,10 +2836,16 @@ " Make sure to validate the mode before.\n"); return FALSE; } - + if(pMga->MergedFB + && MGASetMode(pMga->pBoard,MGAPTR(pMga->pScrn2)->pMgaModeInfo) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "MGASetMode returned an error." + " Make sure to validate the mode before.\n"); + } + ); /* MGA_HAL */ - /* getting around bugs in the HAL lib. MATROX: hint, hint */ + /* getting around bugs in the HAL lib. MATROX: hint, hint. */ MGA_HAL( switch (pMga->Chipset) { case PCI_CHIP_MGA1064: @@ -2745,7 +2854,8 @@ case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: case PCI_CHIP_MGAG400: - if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) { + case PCI_CHIP_MGAG550: + if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) { outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10); outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, @@ -2765,10 +2875,12 @@ } ); /* MGA_HAL */ #endif + MGA_NOT_HAL((*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE)); MGAStormSync(pScrn); MGAStormEngineInit(pScrn); + vgaHWProtect(pScrn, FALSE); if (xf86IsPc98()) { @@ -2780,11 +2892,17 @@ pMga->CurrentLayout.mode = mode; + if(pMga->MergedFB && mode->Private && (mode->PrivSize == 0)) { + pMga->M1currentMode = (DisplayModePtr)mode->Private; + } + #ifdef XF86DRI if (pMga->directRenderingEnabled) DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); #endif - +#ifdef DEBUG + MGAG450PrintPLL(pScrn); +#endif return TRUE; } @@ -2795,7 +2913,14 @@ if (MGAISGx50(pMga)) { /* Force to return in clone mode */ - if (pMga->SecondOutput) { + if (pMga->SecondOutput + && (xf86IsEntityShared(pScrn->entityList[0]) || pMga->SecondCrtc) + && !pMga->MergedFB) { + /* Do this branch if + * SecondOutput + * and not Unshared Primary + * and not Merged Mode (usualy means Unshared Primary) + */ CARD8 ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL); ucXDispCtrl &= ~0x0c; /* dac2outsel mask */ @@ -2841,21 +2966,33 @@ if (pScrn->pScreen != NULL) MGAStormSync(pScrn); - if(pMga->SecondCrtc) { - MGARestoreSecondCrtc(pScrn); - return; + /* + * Restore the second crtc if: + * first and only driver entity + * second entity + * Merged Framebuffer mode (first and only driver entity) + */ + if((!xf86IsEntityShared(pScrn->entityList[0]) && !pMga->SecondCrtc) + || pMga->SecondCrtc || pMga->MergedFB) { + /* if(pMga->MergedFB) { + if(pMga->pScrn2) + MGARestoreSecondCrtc(pMga->pScrn2); + } else*/ + MGARestoreSecondCrtc(pScrn); + /* if we are second instance of driver, we've done our job, exit */ + if(pMga->SecondCrtc) return; } - + /* Only restore text mode fonts/text for the primary card */ vgaHWProtect(pScrn, TRUE); if (pMga->Primary) { #ifdef USEMGAHAL - MGA_HAL( - if(pMga->pBoard != NULL) { - MGASetVgaMode(pMga->pBoard); - MGARestoreVgaState(pMga->pBoard); - } - ); /* MGA_HAL */ + MGA_HAL( + if(pMga->pBoard != NULL) { + MGASetVgaMode(pMga->pBoard); + MGARestoreVgaState(pMga->pBoard); + } + ); /* MGA_HAL */ #endif (*pMga->Restore)(pScrn, vgaReg, mgaReg, TRUE); } else { @@ -2917,6 +3054,7 @@ pMga = MGAPTR(pScrn); MGAdac = &pMga->Dac; + /* Map the MGA memory and MMIO areas */ if (pMga->FBDev) { if (!MGAMapMemFBDev(pScrn)) @@ -2925,12 +3063,12 @@ if (!MGAMapMem(pScrn)) return FALSE; } - + if ((pMga->Chipset == PCI_CHIP_MGAG100) || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) MGAG100BlackMagic(pMga); - if (xf86IsEntityShared(pScrn->entityList[0])) { + if (pMga->DualHeadEnabled) { DevUnion *pPriv; pPriv = xf86GetEntityPrivate(pScrn->entityList[0], MGAEntityIndex); pMgaEnt = pPriv->ptr; @@ -2938,11 +3076,15 @@ #ifdef USEMGAHAL MGA_HAL( if(pMgaEnt->refCount == 1) { + CARD8 MiscCtlReg; pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); pMga->pClientStruct = xalloc(sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; - + + /* wrapping OpenLibrary to fix broken registers. MATROX: hint,hint.*/ + MiscCtlReg = inMGAdac(MGA1064_MISC_CTL); MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); + outMGAdac(MGA1064_MISC_CTL,MiscCtlReg); pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); @@ -2974,12 +3116,17 @@ #endif } else { #ifdef USEMGAHAL + CARD8 MiscCtlReg; + MGA_HAL( pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); pMga->pClientStruct = xalloc(sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; + MiscCtlReg = inMGAdac(MGA1064_MISC_CTL); + /* wrapping OpenLibrary to fix broken registers. MATROX: hint,hint.*/ MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); + outMGAdac(MGA1064_MISC_CTL,MiscCtlReg); pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); ); /* MGA_HAL */ @@ -2988,7 +3135,7 @@ #ifdef USEMGAHAL MGA_HAL( /* There is a problem in the HALlib: set soft reset bit */ - /* MATROX: hint, hint */ + /* MATROX: hint, hint. */ if (!pMga->Primary && !pMga->FBDev && (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { OUTREG(MGAREG_Reset, 1); @@ -3040,12 +3187,15 @@ if (!MGAModeInit(pScrn, pScrn->currentMode)) return FALSE; } - /* Darken the screen for aesthetic reasons and set the viewport */ - if (pMga->SecondCrtc == TRUE) { - MGASaveScreenCrtc2(pScreen, SCREEN_SAVER_ON); - } else { - MGASaveScreen(pScreen, SCREEN_SAVER_ON); + if (pMga->SecondCrtc == TRUE && !pMga->MergedFB) { + MGASaveScreenCrtc2(pScreen, SCREEN_SAVER_ON); + } + if (pMga->SecondCrtc == FALSE && !pMga->MergedFB) { + MGASaveScreen(pScreen, SCREEN_SAVER_ON); + } + if( pMga->MergedFB ) { + MGASaveScreenMerged( pScreen, SCREEN_SAVER_ON ); } pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -3094,7 +3244,6 @@ return FALSE; } - /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -3222,6 +3371,15 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); } + if(pMga->MergedFB) { + /* Rotate and MergedFB are mutiualy exclusive, so we can use this + * variable. + */ + if (!pMga->PointerMoved) + pMga->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = MGAMergePointerMoved; + + } /* Initialise default colourmap */ if (!miCreateDefColormap(pScreen)) @@ -3262,20 +3420,29 @@ ShadowFBInit(pScreen, refreshArea); } - if(pMga->SecondCrtc == TRUE) { + if(pMga->SecondCrtc == TRUE && !pMga->MergedFB) { xf86DPMSInit(pScreen, MGADisplayPowerManagementSetCrtc2, 0); - } else { + } + if(pMga->SecondCrtc == FALSE && !pMga->MergedFB) { xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); } - + if(pMga->MergedFB) { + xf86DPMSInit(pScreen, MGADisplayPowerManagementSetMerged, 0); + } + pScrn->memPhysBase = pMga->FbAddress; pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); - if(pMga->SecondCrtc == TRUE) { - pScreen->SaveScreen = MGASaveScreenCrtc2; - } else { - pScreen->SaveScreen = MGASaveScreen; + if(!pMga->MergedFB) { + if(pMga->SecondCrtc == TRUE) { + pScreen->SaveScreen = MGASaveScreenCrtc2; + } else { + pScreen->SaveScreen = MGASaveScreen; + } + } else { /* Merged FB */ + pScreen->SaveScreen = MGASaveScreenMerged; } + MGAInitVideo(pScreen); #ifdef XF86DRI @@ -3283,14 +3450,14 @@ /* Now that mi, cfb, drm and others have done their thing, * complete the DRI setup. */ - pMga->directRenderingEnabled = MGADRIFinishScreenInit(pScreen); + pMga->directRenderingEnabled = MGADRIFinishScreenInit(pScreen); } if (pMga->directRenderingEnabled) { xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering enabled\n"); } else { xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering disabled\n"); } - if (xf86IsEntityShared(pScrn->entityList[0]) && pMga->SecondCrtc == FALSE) + if (pMga->DualHeadEnabled && pMga->SecondCrtc == FALSE) pMgaEnt->directRenderingEnabled = pMga->directRenderingEnabled; pMga->haveQuiescense = 1; #endif @@ -3305,7 +3472,7 @@ } /* For the second head, work around display problem. */ - if (pMga->SecondCrtc) { + if (!pMga->MergedFB && pMga->SecondCrtc) { MGACrtc2FillStrip(pScrn); } @@ -3318,7 +3485,89 @@ Bool MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - return MGAModeInit(xf86Screens[scrnIndex], mode); +#ifdef USEMGAHAL + char sCmdIn[256]; + char sCmdOut[256]; + FILE* fdIn; + FILE* fdOut; +#endif + MGAPtr pMga; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + pMga = MGAPTR(pScrn); + + if (mode->Flags & 0x80000000) { +#ifdef USEMGAHAL + MGA_HAL( + fdIn = fopen("/tmp/mgaDriverIn", "rt"); + fdOut = fopen("/tmp/mgaDriverOut", "wt"); + + if(fdIn && fdOut) + { + + fgets(sCmdIn, 255, fdIn); + + if(sCmdIn) + { + + MGAExecuteEscCmd(xf86Screens[scrnIndex], sCmdIn, sCmdOut, mode); + + /* Remove file and close file descriptor */ + remove("/tmp/mgaDriverIn"); + fclose(fdIn); + + /* Write output data to output file for calling application */ + fputs(sCmdOut, fdOut); + fclose(fdOut); + + mode->Flags &= 0x7FFFFFFF; + return TRUE; + } + else + { + mode->Flags &= 0x7FFFFFFF; + return FALSE; + } + } + else + { + mode->Flags &= 0x7FFFFFFF; + return FALSE; + } + ) +#endif + return FALSE; + } else + return MGAModeInit(xf86Screens[scrnIndex], mode); +} + + /* Adjusts coordinates to match Panning granularity. + * does nothing if the HALlib is not loaded + */ +void +MGAAdjustGranularity(ScrnInfoPtr pScrn, int* x, int* y) +{ +#ifdef USEMGAHAL + MGA_HAL( + MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga2; + int xg = 1; + int yg = 1; + if(pMga->pMgaModeInfo && pMga->pMgaModeInfo->ulPanXGran && pMga->pMgaModeInfo->ulPanYGran) { + xg = pMga->pMgaModeInfo->ulPanXGran; + yg = pMga->pMgaModeInfo->ulPanYGran; + } + if(pMga->pScrn2 && (pMga2 = MGAPTR(pMga->pScrn2)) ) { + + if(pMga2->pMgaModeInfo && pMga2->pMgaModeInfo->ulPanXGran && pMga2->pMgaModeInfo->ulPanYGran) { + xg = max(xg,pMga2->pMgaModeInfo->ulPanXGran); + yg = max(yg,pMga2->pMgaModeInfo->ulPanYGran); + } + } + xg=16; /*ncoder: temporary */ + *x -= *x % xg; + *y -= *y % yg; + ); +#endif } @@ -3332,38 +3581,54 @@ { ScrnInfoPtr pScrn; int Base, tmp, count; + MGAFBLayout *pLayout; MGAPtr pMga; + pScrn = xf86Screens[scrnIndex]; pMga = MGAPTR(pScrn); pLayout = &pMga->CurrentLayout; - - - if(pMga->ShowCache && y && pScrn->vtSema) - y += pScrn->virtualY - 1; + + /* wanted to improve panning granularity problems without risking + * compatibility issues. Existing code looked hardware dependent. + */ +#ifdef USEMGAHAL + MGA_HAL( + pMga->HALGranularityOffX = x; + pMga->HALGranularityOffY = y; + MGAAdjustGranularity(pScrn,&x,&y); + pMga->HALGranularityOffX = pMga->HALGranularityOffX - x; + pMga->HALGranularityOffY = pMga->HALGranularityOffY - y; + HALSetDisplayStart(pMga->pBoard,x,y,0); + ); +#endif + MGA_NOT_HAL( + if(pMga->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; + + Base = (y * pLayout->displayWidth + x + pMga->YDstOrg) >> + (3 - pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1]); - Base = (y * pLayout->displayWidth + x + pMga->YDstOrg) >> - (3 - pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1]); + if (pLayout->bitsPerPixel == 24) { + if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) + Base &= ~1; /*1 Not sure why */ + Base *= 3; + } - if (pLayout->bitsPerPixel == 24) { - if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) - Base &= ~1; /* Not sure why */ - Base *= 3; - } - - /* find start of retrace */ - while (INREG8(0x1FDA) & 0x08); - while (!(INREG8(0x1FDA) & 0x08)); - /* wait until we're past the start (fixseg.c in the DDK) */ - count = INREG(MGAREG_VCOUNT) + 2; - while(INREG(MGAREG_VCOUNT) < count); - - OUTREG16(MGAREG_CRTC_INDEX, (Base & 0x00FF00) | 0x0C); - OUTREG16(MGAREG_CRTC_INDEX, ((Base & 0x0000FF) << 8) | 0x0D); - OUTREG8(MGAREG_CRTCEXT_INDEX, 0x00); - tmp = INREG8(MGAREG_CRTCEXT_DATA); - OUTREG8(MGAREG_CRTCEXT_DATA, (tmp & 0xF0) | ((Base & 0x0F0000) >> 16)); + /* find start of retrace */ + while (INREG8(0x1FDA) & 0x08); + while (!(INREG8(0x1FDA) & 0x08)); + /* wait until we're past the start (fixseg.c in the DDK) */ + count = INREG(MGAREG_VCOUNT) + 2; + while(INREG(MGAREG_VCOUNT) < count); + + OUTREG16(MGAREG_CRTC_INDEX, (Base & 0x00FF00) | 0x0C); + OUTREG16(MGAREG_CRTC_INDEX, ((Base & 0x0000FF) << 8) | 0x0D); + OUTREG8(MGAREG_CRTCEXT_INDEX, 0x00); + tmp = INREG8(MGAREG_CRTCEXT_DATA); + OUTREG8(MGAREG_CRTCEXT_DATA, (tmp & 0xF0) | ((Base & 0x0F0000) >> 16)); + ); } @@ -3380,19 +3645,26 @@ pScrn = xf86Screens[scrnIndex]; pMga = MGAPTR(pScrn); pLayout = &pMga->CurrentLayout; - - if(pMga->ShowCache && y && pScrn->vtSema) - y += pScrn->virtualY - 1; - - /* 3-85 c2offset - * 3-93 c2startadd0 - * 3-96 c2vcount - */ - - Base = (y * pLayout->displayWidth + x) * pLayout->bitsPerPixel >> 3; - Base += pMga->DstOrg; - Base &= 0x01ffffc0; - OUTREG(C2STARTADD0, Base); +#ifdef USEMGAHAL + MGA_HAL( + MGAAdjustGranularity(pScrn,&x,&y); + HALSetDisplayStart(pMga->pBoard,x,y,1); + ); +#endif + MGA_NOT_HAL( + if(pMga->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; + + /* 3-85 c2offset + * 3-93 c2startadd0 + * 3-96 c2vcount + */ + + Base = (y * pLayout->displayWidth + x) * pLayout->bitsPerPixel >> 3; + Base += pMga->DstOrg; + Base &= 0x01ffffc0; + OUTREG(C2STARTADD0, Base); + ); } /* @@ -3408,25 +3680,25 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; MGAPtr pMga; -#ifdef XF86DRI - ScreenPtr pScreen; -#endif pMga = MGAPTR(pScrn); #ifdef XF86DRI if (pMga->directRenderingEnabled) { - pScreen = screenInfo.screens[scrnIndex]; - DRIUnlock(pScreen); + if (pMga->irq) { + /* Need to make sure interrupts are enabled */ + OUTREG(MGAREG_IEN, pMga->reg_ien); + } + DRIUnlock(screenInfo.screens[scrnIndex]); } #endif if (!MGAModeInit(pScrn, pScrn->currentMode)) return FALSE; - MGAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); /* For the second head, work around display problem. */ - if (pMga->SecondCrtc) { + if (pMga->SecondCrtc) { MGACrtc2FillStrip(pScrn); } @@ -3513,9 +3785,13 @@ vgaHWPtr hwp = VGAHWPTR(pScrn); MGAPtr pMga = MGAPTR(pScrn); MGAEntPtr pMgaEnt = NULL; + #ifdef USEMGAHAL MGA_HAL( RESTORE_TEXTMODE_ON_DVI(pMga); ); #endif + if (pMga->MergedFB) + MGACloseScreenMerged(scrnIndex, pScreen); + if (pScrn->vtSema) { if (pMga->FBDev) { fbdevHWRestore(pScrn); @@ -3534,7 +3810,7 @@ } #endif - if (xf86IsEntityShared(pScrn->entityList[0])) { + if (pMga->DualHeadEnabled) { DevUnion *pPriv; pPriv = xf86GetEntityPrivate(pScrn->entityList[0], MGAEntityIndex); pMgaEnt = pPriv->ptr; @@ -3543,7 +3819,7 @@ #ifdef USEMGAHAL MGA_HAL( - if(xf86IsEntityShared(pScrn->entityList[0])) { + if(pMga->DualHeadEnabled) { if(pMgaEnt->refCount == 0) { /* Both boards have closed there screen */ MGACloseLibrary(pMga->pBoard); @@ -3598,6 +3874,7 @@ pScreen->BlockHandler = pMga->BlockHandler; pScreen->CloseScreen = pMga->CloseScreen; + return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -3608,6 +3885,7 @@ static void MGAFreeScreen(int scrnIndex, int flags) { + /* * This only gets called when a screen is being deleted. It does not * get called routinely at the end of a server generation. @@ -3615,6 +3893,7 @@ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(xf86Screens[scrnIndex]); MGAFreeRec(xf86Screens[scrnIndex]); + } @@ -3681,7 +3960,7 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -static void +void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -3721,14 +4000,14 @@ } -static void +void MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { MGAPtr pMga = MGAPTR(pScrn); CARD32 crtc2 = 0; - if (PowerManagementMode != DPMSModeOn) + if (PowerManagementMode != DPMSModeOn) crtc2 = 0x8; /* c2pixclkdis */ crtc2 |= INREG(MGAREG_C2CTL) & ~0x8; OUTREG(MGAREG_C2CTL, crtc2); @@ -3884,3 +4163,4 @@ OUTREG(MGAREG_MACCESS, 1<<15); usleep(10); } + Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_esc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_esc.c:1.2 --- /dev/null Thu Feb 27 12:31:04 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_esc.c Wed Dec 11 12:26:13 2002 @@ -0,0 +1,791 @@ +/**************************************************************************** +* mga_esc.c +* +* ESC call implementation +* +* (C) Matrox Graphics, Inc. +*****************************************************************************/ + +#ifdef USEMGAHAL + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" + +/* All drivers need this */ +#include "xf86_ansic.h" + +#include "compiler.h" + +/* Drivers for PCI hardware need this */ +#include "xf86PciInfo.h" + +/* Drivers that need to access the PCI config space directly need this */ +#include "xf86Pci.h" + +/* All drivers initialising the SW cursor need this */ +#include "mipointer.h" + +/* All drivers implementing backing store need this */ +#include "mibstore.h" + +#include "micmap.h" + +#include "xf86DDC.h" +#include "xf86RAC.h" +#include "vbe.h" + +#include "fb.h" +#include "cfb8_32.h" +#include "dixstruct.h" + +#include "mga_reg.h" +#include "mga.h" +#include "mga_macros.h" + +/* ESC */ +LPMGAMODEINFO pMgaModeInfo[2] = {NULL}; +MGAMODEINFO TmpMgaModeInfo[2] = {{0}}; + +/* ESC Implementation */ +static void EscHLeft(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscHRight(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscVUp(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscVDown(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscHLarger(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscHSmaller(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscVTaller(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscVSmaller(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscRefresh(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscRestoreVidParm(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscRead(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscWrite(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscHal(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscTest(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); +static void EscMerged(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode); + +static LPMGAMODEINFO GetModeInfoPtr(ULONG ulScreen); +static void GetVideoParameterStr(LPMGAMODEINFO pModeInfo, char *sResult); +static Bool convertNumber(unsigned long *pulNumber, char *sNumber); + + +static MGAEscFuncRec FunctionTable[] = { + {"hal", EscHal}, + {"test", EscTest}, + {"read", EscRead}, + {"write", EscWrite}, + {"left", EscHLeft}, + {"right", EscHRight}, + {"down", EscVDown}, + {"up", EscVUp}, + {"h+", EscHLarger}, + {"h-", EscHSmaller}, + {"v+", EscVTaller}, + {"v-", EscVSmaller}, + {"refresh", EscRefresh}, + {"undo", EscRestoreVidParm}, + {"merged", EscMerged}, + {NULL,NULL} +}; + + +void MGAFillDisplayModeStruct(DisplayModePtr pMode, LPMGAMODEINFO pModeInfo) +{ + pMode->Clock = pModeInfo->ulPixClock; + + pMode->HDisplay = pModeInfo->ulDispWidth; + pMode->HSyncStart = pModeInfo->ulDispWidth + + pModeInfo->ulHFPorch; + pMode->HSyncEnd = pModeInfo->ulDispWidth + + pModeInfo->ulHFPorch + + pModeInfo->ulHSync; + pMode->HTotal = pModeInfo->ulDispWidth + + pModeInfo->ulHFPorch + + pModeInfo->ulHSync + + pModeInfo->ulHBPorch; + + pMode->VDisplay = pModeInfo->ulDispHeight; + pMode->VSyncStart = pModeInfo->ulDispHeight + + pModeInfo->ulVFPorch; + pMode->VSyncEnd = pModeInfo->ulDispHeight + + pModeInfo->ulVFPorch + + pModeInfo->ulVSync; + pMode->VTotal = pModeInfo->ulDispHeight + + pModeInfo->ulVFPorch + + pModeInfo->ulVSync + + pModeInfo->ulVBPorch; + + pMode->VRefresh = pModeInfo->ulRefreshRate; +} + +static LPMGAMODEINFO GetModeInfoPtr(ULONG ulScreen) +{ + + if ( !TmpMgaModeInfo[ulScreen].ulDispWidth ) + { + TmpMgaModeInfo[ulScreen] = *pMgaModeInfo[ulScreen]; + } + + return &TmpMgaModeInfo[ulScreen]; +} + + +static void GetVideoParameterStr(LPMGAMODEINFO pModeInfo, char *sResult) +{ + sprintf(sResult, "%d %d %d %d %d %d %d %d %d %d %d", + pModeInfo->ulDispWidth, + pModeInfo->ulDispHeight, + pModeInfo->ulBpp, + pModeInfo->ulPixClock, + pModeInfo->ulHFPorch, + pModeInfo->ulHSync, + pModeInfo->ulHBPorch, + pModeInfo->ulVFPorch, + pModeInfo->ulVSync, + pModeInfo->ulVBPorch, + pModeInfo->flSignalMode); +} + + +static float GetVRefresh(LPMGAMODEINFO pModeInfo) +{ + ULONG ulHTotal; + ULONG ulVTotal; + + ulHTotal = + pModeInfo->ulDispWidth + + pModeInfo->ulHFPorch + + pModeInfo->ulHSync + + pModeInfo->ulHBPorch; + + ulVTotal = + pModeInfo->ulDispHeight + + pModeInfo->ulVFPorch + + pModeInfo->ulVSync + + pModeInfo->ulVBPorch; + + return ((float)pModeInfo->ulPixClock * 1000.0) / (ulHTotal * ulVTotal); +} + +static void EscHal(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMGA = MGAPTR(pScrn); + + if(pMGA->HALLoaded) + strcpy(sResult, "YES"); + else + strcpy(sResult, "NO"); + +} + +static void EscTest(ScrnInfoPtr pScrn, unsigned long *param, char +*sResult, DisplayModePtr pMode) +{ + strcpy(sResult, "YES"); +} + +static void EscMerged(ScrnInfoPtr pScrn, unsigned long *param, char +*sResult, DisplayModePtr pMode) +{ + strcpy(sResult, "YES"); +} + +static void EscRead(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + ULONG ulSource, ulAddr, ulData; + UCHAR ucIndex; + + if ( (param[0] & 0xffff) < 2 ) + { + strcpy(sResult, "#error 1"); + return; + } + + + ulSource = param[1] >> 16; + ulAddr = param[1] & 0xffff; + + + switch( ulSource ) + { + case 0: + ulData = INREG(ulAddr); + sprintf(sResult, "MGA[%04X] = 0x%08X", ulAddr, ulData); + break; + case 1: + ucIndex = INREG8(0x3c00); + OUTREG(0x3c00, (UCHAR)ulAddr); + ulData = (ULONG)INREG8(0x3c0a); + OUTREG(0x3c00, ucIndex); + sprintf(sResult, "DAC[%02X] = 0x%02X", ulAddr, ulData); + break; + case 2: + ucIndex = INREG8(0x1fd4); + OUTREG(0x1fd4, (UCHAR)ulAddr); + ulData = (ULONG)INREG8(0x1fd5); + OUTREG(0x1fd4, ucIndex); + sprintf(sResult, "CRTC[%02X] = 0x%02X", ulAddr, ulData); + break; + case 3: + ucIndex = INREG8(0x1fde); + OUTREG(0x1fde, (UCHAR)ulAddr); + ulData = (ULONG)INREG8(0x1fdf); + OUTREG(0x1fde, ucIndex); + sprintf(sResult, "CRTCEXT[%02X] = 0x%02X", ulAddr, ulData); + break; + default: + strcpy(sResult, "ERROR# 2"); + break; + } +} + +static void EscWrite(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + ULONG ulSource, ulAddr, ulData; + UCHAR ucIndex; + + if ( (param[0] & 0xffff) < 3 ) + { + strcpy(sResult, "#error 1"); + return; + } + + ulSource = param[1] >> 16; + ulAddr = param[1] & 0xffff; + ulData = param[2]; + + + switch( ulSource ) + { + case 0: + OUTREG(ulAddr, ulData); + strcpy(sResult, "OK"); + break; + case 1: + ucIndex = INREG8(0x3c00); + OUTREG(0x3c00, (UCHAR)ulAddr); + OUTREG(0x3c0a, (UCHAR)ulData); + OUTREG(0x3c00, ucIndex); + strcpy(sResult, "OK"); + break; + case 2: + ucIndex = INREG8(0x1fd4); + OUTREG(0x1fd4, (UCHAR)ulAddr); + OUTREG(0x1fd5, (UCHAR)ulData); + OUTREG(0x1fd4, ucIndex); + strcpy(sResult, "OK"); + break; + case 3: + ucIndex = INREG8(0x1fde); + OUTREG(0x1fde, (UCHAR)ulAddr); + OUTREG(0x1fdf, (UCHAR)ulData); + OUTREG(0x1fde, ucIndex); + strcpy(sResult, "OK"); + break; + default: + strcpy(sResult, "ERROR# 2"); + break; + } +} + +static void EscHLeft(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + + if (pModeInfo->ulHBPorch > (8 * param[1]) ) + { + pModeInfo->ulHBPorch -=8 * param[1]; + pModeInfo->ulHFPorch +=8 * param[1]; + MGASetMode(pMga->pBoard, pModeInfo); + } + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + + +static void EscHRight(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if (pModeInfo->ulHFPorch > (8 * param[1]) ) + { + pModeInfo->ulHFPorch -=8 * param[1]; + pModeInfo->ulHBPorch +=8 * param[1]; + MGASetMode(pMga->pBoard, pModeInfo); + } + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + + + +static void EscVUp(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if (pModeInfo->ulVBPorch > (param[1]) ) + { + pModeInfo->ulVBPorch -= param[1]; + pModeInfo->ulVFPorch += param[1]; + MGASetMode(pMga->pBoard, pModeInfo); + } + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + + +static void EscVDown(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if (pModeInfo->ulVFPorch >= (param[1]) ) + { + pModeInfo->ulVFPorch -= param[1]; + pModeInfo->ulVBPorch += param[1]; + MGASetMode(pMga->pBoard, pModeInfo); + } + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + + +static void EscHLarger(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + float fRefresh, fPixelClock; + ULONG ulStep; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if ((param[0] & 0xffff) > 1) + { + + ulStep = param[1] * 8; + } + else + { + + ulStep = 8; + } + + fRefresh = GetVRefresh(pModeInfo); + fPixelClock = (float)pModeInfo->ulPixClock; + if (pModeInfo->ulHBPorch >= ulStep ) + { + pModeInfo->ulHBPorch -= ulStep; + } + else + { + pModeInfo->ulHBPorch = 0; + } + pModeInfo->ulPixClock = (ULONG)( (fRefresh * fPixelClock) / GetVRefresh(pModeInfo)); + MGASetMode(pMga->pBoard, pModeInfo); + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + + +static void EscHSmaller(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + float fRefresh, fPixelClock; + ULONG ulStep; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if ((param[0] & 0xffff) > 1) + { + + ulStep = param[1] * 8; + } + else + { + + ulStep = 8; + } + + + fRefresh = GetVRefresh(pModeInfo); + fPixelClock = (float)pModeInfo->ulPixClock; + pModeInfo->ulHBPorch += ulStep; + pModeInfo->ulPixClock = (ULONG)( (fRefresh * fPixelClock) / GetVRefresh(pModeInfo)); + + MGASetMode(pMga->pBoard, pModeInfo); + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + +static void EscVTaller(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + float fRefresh, fPixelClock; + ULONG ulStep; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if ((param[0] & 0xffff) > 1) + { + + ulStep = param[1]; + } + else + { + + ulStep = 1; + } + + fRefresh = GetVRefresh(pModeInfo); + fPixelClock = (float)pModeInfo->ulPixClock; + + if (pModeInfo->ulVBPorch >= ulStep ) + { + pModeInfo->ulVBPorch -= ulStep; + } + else + { + pModeInfo->ulVBPorch = 0; + } + + pModeInfo->ulPixClock = (ULONG)( (fRefresh * fPixelClock) / GetVRefresh(pModeInfo)); + MGASetMode(pMga->pBoard, pModeInfo); + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + +static void EscVSmaller(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + float fRefresh, fPixelClock; + ULONG ulStep; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if ((param[0] & 0xffff) > 1) + { + + ulStep = param[1]; + } + else + { + + ulStep = 1; + } + + + fRefresh = GetVRefresh(pModeInfo); + fPixelClock = (float)pModeInfo->ulPixClock; + pModeInfo->ulVFPorch += ulStep; + pModeInfo->ulPixClock = (ULONG)( (fRefresh * fPixelClock) / GetVRefresh(pModeInfo)); + MGASetMode(pMga->pBoard, pModeInfo); + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + + +static void EscRefresh(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + LPMGAMODEINFO pModeInfo; + float fRefresh, fPixelClock; + + pModeInfo = GetModeInfoPtr(param[0] >> 16); + + if ( !pMgaModeInfo ) + { + strcpy(sResult, "#error 1"); + return; + } + + if ((param[0] & 0xffff) < 2) + { + strcpy(sResult, "#error 1"); + return; + } + + fRefresh = GetVRefresh(pModeInfo); + + fPixelClock = (float)pModeInfo->ulPixClock; + pModeInfo->ulPixClock = (ULONG)( ((float)param[1] * fPixelClock) / fRefresh); + + pModeInfo->ulRefreshRate = param[1]; + + MGASetMode(pMga->pBoard, pModeInfo); + + MGAFillDisplayModeStruct(pMode, pModeInfo); + + GetVideoParameterStr(pModeInfo, sResult); +} + +static void EscRestoreVidParm(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, DisplayModePtr pMode) +{ + MGAPtr pMga = MGAPTR(pScrn); + + TmpMgaModeInfo[param[0] >> 16].ulDispWidth = 0; + MGASetMode(pMga->pBoard, pMgaModeInfo[param[0] >> 16]); + + MGAFillDisplayModeStruct(pMode, pMgaModeInfo[param[0] >> 16]); + + GetVideoParameterStr(pMgaModeInfo[param[0] >> 16], sResult); +} + +static Bool convertNumber(unsigned long *pulNumber, char *sNumber) +{ + unsigned long i, ulDigit, shiftHex; + Bool bResult = TRUE; + + if (sNumber == NULL) + { + return FALSE; + } + + + /* Convert number */ + if ( (sNumber[0] == '0') && (sNumber[1] == 'x') ) + { + shiftHex = 0; + *pulNumber = 0; + + for (i = strlen(sNumber) - 1; i > 1; i--) + { + if (shiftHex > 28) + { + bResult = FALSE; + break; + } + + if ( !isxdigit(sNumber[i]) ) + { + bResult = FALSE; + break; + } + + ulDigit = toupper(sNumber[i]) - '0'; + if (ulDigit > 9) + { + ulDigit -= 7; + } + *pulNumber += ulDigit << shiftHex; + shiftHex += 4; + } + } + else + { + for (i = 0; i < strlen(sNumber); i++) + { + if ( !isdigit(sNumber[i]) ) + { + bResult = FALSE; + break; + } + } + *pulNumber = atoi(sNumber); + } + + return bResult; +} + +static Bool GetEscCommand(char *cmdline, EscCmdStruct *escCmd) +{ + unsigned long i, paramIndex, ulHI; + Bool bResult; + char *pParameter, *function; + + bResult = TRUE; /* success */ + + function = strtok(cmdline, " \t\n,"); + + + escCmd->parameters[0] = 0; + if (function) + { + /* Find Screen */ + if (function[1] == ':' ) + { + escCmd->parameters[0] = (unsigned long)(function[0] - '0') << 16; + strncpy(escCmd->function, function+2, 32); + } + else + { + strncpy(escCmd->function, function, 32); + } + + } + else + { + strcpy(escCmd->function, "#ERROR -1"); + escCmd->parameters[0] = 0; + return FALSE; + } + + paramIndex = 1; + while ( (pParameter = strtok(NULL, " \t\n,")) != NULL ) + { + if (paramIndex > 31) + { + /* 32 parameters supported */ + break; + } + + i = 0; + while(pParameter[i] && pParameter[i] != ':') + { + i++; + } + + if ( pParameter[i] ) + { + pParameter[i] = '\0'; + bResult = convertNumber(&escCmd->parameters[paramIndex], &pParameter[i+1]); + bResult |= convertNumber(&ulHI, pParameter); + escCmd->parameters[paramIndex] &= 0xffff; + escCmd->parameters[paramIndex] += ulHI << 16; + pParameter[i] = ':'; + } + else + { + bResult = convertNumber(&escCmd->parameters[paramIndex], pParameter); + } + + + if (!bResult) + { + break; + } + paramIndex++; + } + + escCmd->parameters[0] += paramIndex; + return bResult; + +} + +void MGAExecuteEscCmd(ScrnInfoPtr pScrn, char *cmdline , char *sResult, DisplayModePtr pMode) +{ + int i = 0; + int ulScreen = 0; + MGAPtr pMga = MGAPTR(pScrn); + EscCmdStruct EscCmd; + + if (pMga->SecondCrtc) + { + ulScreen = 1; + } + else + { + ulScreen = 0; + } + + + if (FunctionTable[0].function && GetEscCommand(cmdline, &EscCmd) ) + { + i = 0; + + while ( FunctionTable[i].function && strcmp(FunctionTable[i].function, EscCmd.function) ) + { + i++; + } + + if (FunctionTable[i].function) + { + EscCmd.parameters[0] &= 0xffff; + EscCmd.parameters[0] |= ulScreen << 16; + + FunctionTable[i].funcptr(pScrn, EscCmd.parameters, sResult, pMode); + } + else + { + strcpy(sResult, "error# -1"); + } + } + else + { + strcpy(sResult, "error# -1"); + } +} +#else +int mga_foo; +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.5 Fri Jan 11 10:42:57 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c Mon Sep 16 14:05:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.5 2002/01/11 15:42:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.8 2002/09/16 18:05:56 eich Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -136,6 +136,7 @@ *pulPLLMNP |= (CARD32)ucM << 16; *pulPLLMNP |= (CARD32)ucN << 8; *pulPLLMNP |= (CARD32)ucP; + #ifdef DEBUG ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", ulVCO, (ULONG)ucS, *pulPLLMNP); #endif @@ -208,7 +209,27 @@ return TRUE; } +static CARD32 G450ReadMNP(ScrnInfoPtr pScrn) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + CARD32 ret = 0; + + pReg = &pMga->ModeReg; + if (!pMga->SecondCrtc) { + ret = (CARD8)inMGAdac(MGA1064_PIX_PLLC_M) << 16; + ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_N) << 8; + ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_P); + } else { + ret = (CARD8)inMGAdac(MGA1064_VID_PLL_M) << 16; + ret |= (CARD8)inMGAdac(MGA1064_VID_PLL_N) << 8; + ret |= (CARD8)inMGAdac(MGA1064_VID_PLL_P); + } + return ret; +} + + static CARD32 G450CompareMNP(ScrnInfoPtr pScrn, CARD32 ulFout, CARD32 ulMNP1, CARD32 ulMNP2, long *pulResult) { @@ -295,16 +316,18 @@ { Bool bFoundValidPLL; Bool bLocked; - CARD8 ucMisc; + CARD8 ucMisc, ucSIndex, ucSTable[4]; CARD32 ulMaxIndex; CARD32 ulMNP; CARD32 ulMNPTable[MNP_TABLE_SIZE]; CARD32 ulIndex; CARD32 ulTryMNP; long lCompareResult; - MGAPtr pMga = MGAPTR(pScrn); +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Restoring PLLClk = %d\n",f_out); +#endif G450FindFirstPLLParam(pScrn, f_out, &ulMNP); ulMNPTable[0] = ulMNP; G450FindNextPLLParam(pScrn, f_out, &ulMNP); @@ -364,16 +387,25 @@ for(ulIndex = 0; !bFoundValidPLL && (ulIndex < ulMaxIndex); ulIndex++) { - ulTryMNP = ulMNPTable[ulIndex]; - -#if 0 - for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8) -#endif - { -#if 0 - ulTryMNP &= 0xffffffc7; - ulTryMNP |= (CARD32)ucS; -#endif + ulTryMNP = ulMNPTable[ulIndex]; + + ucSTable[3] = 0xff; + ucSTable[2] = 0xff; + ucSTable[0] = (CARD8) (ulTryMNP & 0x38); + + if (ucSTable[0] != 0) { + ucSTable[1] = ucSTable[0] - 8; + if (ucSTable[0] != 0x38) { + ucSTable[2] = ucSTable[0] + 8; + } + } else { + ucSTable[1] = 8; + } + + for(ucSIndex = 0; !bFoundValidPLL && (ucSTable[ucSIndex] != 0xff); + ucSIndex++) { + ulTryMNP &= 0xffffffc7; + ulTryMNP |= (CARD32)ucSTable[ucSIndex]; bLocked = TRUE; if((ulMNPTable[ulIndex] & 0xff00) < 0x300 || @@ -455,3 +487,37 @@ return TRUE; } + +long +MGAG450SavePLLFreq(ScrnInfoPtr pScrn) +{ + CARD32 ulMNP = G450ReadMNP(pScrn); + CARD8 ucP; + CARD32 freq; + + G450CalculVCO(pScrn, ulMNP, &freq); + ucP = (CARD8)(ulMNP & 0x03); + G450ApplyPFactor(pScrn, ucP, &freq); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Saved PLLClk = %d\n",freq); +#endif + return freq; +} + +#ifdef DEBUG +void +MGAG450PrintPLL(ScrnInfoPtr pScrn) +{ + CARD32 ulMNP = G450ReadMNP(pScrn); + CARD8 ucP; + CARD32 freq; + + G450CalculVCO(pScrn, ulMNP, &freq); + ucP = (CARD8)(ulMNP & 0x03); + G450ApplyPFactor(pScrn, ucP, &freq); + + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"MGAGClock = %d -- MNP = 0x%x\n", + freq,ulMNP); +} +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.21 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.21 Wed Sep 26 08:59:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h Wed Feb 20 12:17:50 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.21 2001/09/26 12:59:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.22 2002/02/20 17:17:50 dawes Exp $ */ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ @@ -111,5 +111,8 @@ #define MGAISGx50(x) ( (((x)->Chipset == PCI_CHIP_MGAG400) && ((x)->ChipRev >= 0x80)) || \ ((x)->Chipset == PCI_CHIP_MGAG550) ) + +#define MGA_DH_NEEDS_HAL(x) (((x)->Chipset == PCI_CHIP_MGAG400) && \ + ((x)->ChipRev < 0x80)) #endif /* _MGA_MACROS_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c:1.2 --- /dev/null Thu Feb 27 12:31:05 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c Wed Sep 18 17:25:45 2002 @@ -0,0 +1,960 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c,v 1.2 2002/09/18 21:25:45 tsi Exp $ */ + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" + +/* All drivers need this */ +#include "xf86_ansic.h" + +#include "compiler.h" + +/* Drivers for PCI hardware need this */ +#include "xf86PciInfo.h" +#include "mga.h" +#include "mga_macros.h" +#include "mga_reg.h" +#include "mga_merge.h" + +#include "fbdevhw.h" + +static int +StrToRanges(range* r, char* s) { + float num=0.0; + int rangenum=0; + Bool gotdash = FALSE; + Bool nextdash = FALSE; + char* strnum=NULL; + do { + switch(*s) { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case '.': + if(strnum == NULL) { + strnum = s; + gotdash = nextdash; + nextdash = FALSE; + } + + break; + case '-': + case ' ': case 0: + if(strnum == NULL) break; /*is extra seperator */ + if(strnum != NULL) sscanf(strnum,"%f",&num); + if(gotdash) /*if wasn't singlet: correct. */ + r[rangenum-1].hi = num; + else { /*first, assume singlet */ + r[rangenum].lo = num; + r[rangenum].hi = num; + rangenum++; + } + strnum = NULL; + if(*s == '-') + nextdash = (rangenum != 0); /*ignore dash if before any number.*/ + break; + default : + return 0; + } + } while(*(s++) != 0); /* run loop for every char including null terminator.*/ + + return rangenum; +} + + +/* Copys mode i, links the result to dest, and returns it. + * Links i and j in Private record. + * if dest is NULL, return value is copy of i linked to itself. + */ +static DisplayModePtr +CopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest, DisplayModePtr i, DisplayModePtr j, MgaScrn2Rel srel) { + DisplayModePtr mode; + int dx = 0,dy = 0; + /* start with first node */ + mode = xalloc(sizeof(DisplayModeRec)); + memcpy(mode,i, sizeof(DisplayModeRec)); + mode->Private = xalloc(sizeof(MergedDisplayModeRec)); + ((MergedDisplayModePtr)mode->Private)->Monitor1 = i; + ((MergedDisplayModePtr)mode->Private)->Monitor2 = j; + ((MergedDisplayModePtr)mode->Private)->Monitor2Pos = srel; + mode->PrivSize = 0; + + switch(srel) { + case mgaLeftOf: + case mgaRightOf: + dx = min(pScrn->virtualX,i->HDisplay + j->HDisplay) - mode->HDisplay; + dy = min(pScrn->virtualY, max(i->VDisplay,j->VDisplay)) - mode->VDisplay; + break; + case mgaAbove: + case mgaBelow: + dy = min(pScrn->virtualY,i->VDisplay + j->VDisplay) - mode->VDisplay; + dx = min(pScrn->virtualX, max(i->HDisplay,j->HDisplay)) - mode->HDisplay; + break; + case mgaClone: + dx = min(pScrn->virtualX, max(i->HDisplay,j->HDisplay)) - mode->HDisplay; + dy = min(pScrn->virtualY, max(i->VDisplay,j->VDisplay)) - mode->VDisplay; + break; + } + mode->HDisplay += dx; + mode->HSyncStart += dx; + mode->HSyncEnd += dx; + mode->HTotal += dx; + mode->VDisplay += dy; + mode->VSyncStart += dy; + mode->VSyncEnd += dy; + mode->VTotal += dy; + mode->Clock = 0; /* Shows we're in Merge mode. */ + + mode->next = mode; + mode->prev = mode; + + if(dest) { + /* Insert node after "dest" */ + mode->next = dest->next; + dest->next->prev = mode; + mode->prev = dest; + dest->next = mode; + } + + return mode; +} + +static DisplayModePtr +GetModeFromName(char* str, DisplayModePtr i) +{ + DisplayModePtr c = i; + if(!i) return NULL; + do { + if(strcmp(str,c->name) == 0) return c; + c = c->next; + } while(c != i); + return NULL; +} + +/* takes a config file string of MetaModes and generates a MetaModeList */ +static DisplayModePtr +GenerateModeList(ScrnInfoPtr pScrn, char* str, + DisplayModePtr i, DisplayModePtr j, MgaScrn2Rel srel) { + char* strmode = str; + char modename[256]; + Bool gotdash = FALSE; + MgaScrn2Rel sr; + + DisplayModePtr mode1 = NULL; + DisplayModePtr mode2 = NULL; + DisplayModePtr result = NULL; + do { + switch(*str) { + case 0: + case '-': + case ' ': + if((strmode != str)) {/*we got a mode */ + /* read new entry */ + strncpy(modename,strmode,str - strmode); + modename[str - strmode] = 0; + + if(gotdash) { + if(mode1 == NULL) return NULL; + mode2 = GetModeFromName(modename,j); + if(!mode2) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Mode: \"%s\" is not a supported mode for monitor 2\n",modename); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Skipping metamode \"%s-%s\".\n",mode1->name,modename); + mode1 = NULL; + } + } else { + mode1 = GetModeFromName(modename,i); + if(!mode1) { + char* tmps = str; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Mode: \"%s\" is not a supported mode for monitor 1\n",modename); + /* find if a monitor2 mode follows */ + gotdash = FALSE; + while(*tmps == ' ') tmps++; + if(*tmps == '-') { /* skip the next mode */ + tmps++; + while((*tmps == ' ') && (*tmps != 0)) tmps++; /*skip spaces */ + while((*tmps != ' ') && (*tmps != '-') && (*tmps != 0)) tmps++; /*skip modename */ + /* for error message */ + strncpy(modename,strmode,tmps - strmode); + modename[tmps - strmode] = 0; + str = tmps-1; + } + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Skipping metamode \"%s\".\n",modename); + mode1 = NULL; + } + } + gotdash = FALSE; + } + strmode = str+1; /* number starts on next char */ + gotdash |= (*str == '-'); + + if(*str != 0) break; /* if end of string, we wont get a chance to catch a char and run the + default case. do it now */ + + default: + if(!gotdash && mode1) { /* complete previous pair */ + sr = srel; + if(!mode2) { + mode2 = GetModeFromName(mode1->name,j); + sr = mgaClone; + } + if(!mode2) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Mode: \"%s\" is not a supported mode for monitor 2\n",mode1->name); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Skipping clone mode \"%s\".\n"); + mode1 = NULL; + } else { + result = CopyModeNLink(pScrn,result,mode1,mode2,sr); + mode1 = NULL; + mode2 = NULL; + } + } + break; + + } + } while(*(str++) != 0); + return result; +} + + +/* second CRTC init funcitons. Used to check monitor timings and refreshes. + * this function looses lots of maintainability points due to redundancy, + * but it still was the cleanest and least-intrusive way I found. */ + +Bool +MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) +{ + ScrnInfoPtr pScrn; + MGAPtr pMga; + MGAPtr pMga1; + MessageType from; + int i; + char* s; + ClockRangePtr clockRanges; +#ifdef USEMGAHAL + ULONG status; +#endif + MgaScrn2Rel Monitor2Pos; + + xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "==== Start of second screen initialization ====\n"); + pScrn = xalloc(sizeof(ScrnInfoRec)); + memcpy(pScrn,pScrn1,sizeof(ScrnInfoRec)); + + pScrn->driverPrivate = NULL; + /* Allocate the MGARec driverPrivate */ + if (!MGAGetRec(pScrn)) { + return FALSE; + } + + pMga = MGAPTR(pScrn); +#ifdef USEMGAHAL + pMga->pMgaModeInfo = NULL; /*will be allocated later if NULL*/ +#endif + pMga1 = MGAPTR(pScrn1); + pMga1->pScrn2 = pScrn; + + /* Get the entity, and make sure it is PCI. */ + pMga->pEnt = pMga1->pEnt; + + /* Set pMga->device to the relevant Device section */ + pMga->device = pMga1->device; + + if (flags & PROBE_DETECT) { + MGAProbeDDC(pScrn, pMga->pEnt->index); /*FIXME make shure this probes second monitor */ + return TRUE; + } + + pMga->PciTag = pMga1->PciTag; + + pMga->Primary = pMga1->Primary; + + /* Set pScrn->monitor */ + { + pScrn->monitor = xalloc(sizeof(MonRec)); + /* copy everything we don't care about */ + memcpy(pScrn->monitor,pScrn1->monitor,sizeof(MonRec)); + pScrn->monitor->DDC = NULL; /*FIXME:have to try this */ + if ((s = xf86GetOptValString(pMga1->Options, OPTION_HSYNC2))) { + pScrn->monitor->nHsync = StrToRanges(pScrn->monitor->hsync,s); + } + if ((s = xf86GetOptValString(pMga1->Options, OPTION_VREFRESH2))) { + pScrn->monitor->nVrefresh = StrToRanges(pScrn->monitor->vrefresh,s); + } + + + + } + + pMga->SecondCrtc = TRUE; + pMga->HWCursor = FALSE; + pScrn->AdjustFrame = MGAAdjustMergeFrames; + pScrn1->AdjustFrame = MGAAdjustMergeFrames; + +/* if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) FIXME:have to copy result form scrn1 + if (!xf86SetWeight(pScrn, zeros, zeros)) { +*/ + + /* We use a programamble clock */ + pScrn->progClock = TRUE; + + /* Collect all of the relevant option flags (fill in pScrn->options) */ + pScrn->options = pScrn1->options; + +/* xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pMga->Options);*/ + pMga->Options = pMga1->Options; + + + /* Set the bits per RGB for 8bpp mode */ + if (pScrn->depth == 8) + pScrn->rgbBits = 8; + + /* + * Set the Chipset and ChipRev, allowing config file entries to + * override. + */ + pScrn->chipset = pScrn1->chipset; + pMga->Chipset = pMga1->Chipset; + pMga->ChipRev = pMga1->ChipRev; + +#ifdef XF86DRI + pMga->agpMode = pMga1->agpMode; +#endif + + pMga->NoAccel = pMga1->NoAccel; + pMga->UsePCIRetry = pMga1->UsePCIRetry; + pMga->SyncOnGreen = pMga1->SyncOnGreen; + pMga->ShowCache = pMga1->ShowCache; + pMga->HasSDRAM = pMga1->HasSDRAM; + pMga->MemClk = pMga1->MemClk; + pMga->Overlay8Plus24 = pMga1->Overlay8Plus24; + pMga->colorKey = pMga1->colorKey; + pScrn->colorKey = pScrn1->colorKey; + pScrn->overlayFlags = pScrn1->overlayFlags; + pMga->videoKey = pMga1->videoKey; + /* unsupported options */ + pMga->HWCursor = FALSE; + pMga->ShadowFB = FALSE; + pMga->FBDev = FALSE; + + pMga->OverclockMem = pMga1->OverclockMem; + pMga->TexturedVideo = pMga1->TexturedVideo; + pMga->MergedFB = TRUE; + + pMga->Rotate = 0; + + switch (pMga->Chipset) { + case PCI_CHIP_MGA2064: + case PCI_CHIP_MGA2164: + case PCI_CHIP_MGA2164_AGP: + MGA2064SetupFuncs(pScrn); + break; + case PCI_CHIP_MGA1064: + case PCI_CHIP_MGAG100: + case PCI_CHIP_MGAG100_PCI: + case PCI_CHIP_MGAG200: + case PCI_CHIP_MGAG200_PCI: + case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: + MGAGSetupFuncs(pScrn); + break; + } + + pMga->FbAddress = pMga1->FbAddress; + pMga->FbBaseReg = pMga1->FbBaseReg; + pMga->PciInfo = pMga1->PciInfo; + pMga->IOAddress = pMga1->IOAddress; + pMga->ILOADAddress = pMga1->ILOADAddress; + pMga->BiosFrom = pMga1->BiosFrom; + pMga->BiosAddress = pMga1->BiosAddress; + + /* + * Read the BIOS data struct + */ + + MGAReadBios(pScrn); + + /* HW bpp matches reported bpp */ + pMga->HwBpp = pMga1->HwBpp; + + /* + * Reset card if it isn't primary one + */ + if ( (!pMga->Primary && !pMga->FBDev) || xf86IsPc98() ) + MGASoftReset(pScrn); + + + pScrn->videoRam = pScrn1->videoRam; + pMga->FbMapSize = pMga1->FbMapSize; + pMga->SrcOrg = pMga1->SrcOrg; + pMga->DstOrg = pMga1->DstOrg; + + /* Set the bpp shift value */ + pMga->BppShifts[0] = 0; + pMga->BppShifts[1] = 1; + pMga->BppShifts[2] = 0; + pMga->BppShifts[3] = 2; + + /* + * fill MGAdac struct + * Warning: currently, it should be after RAM counting + */ + (*pMga->PreInit)(pScrn); + +#if !defined(__powerpc__) + + /* Read and print the Monitor DDC info */ +/* pScrn->monitor->DDC = MGAdoDDC(pScrn);*/ /*FIXME: have to try this*/ +#endif /* !__powerpc__ */ + + /* + * If the driver can do gamma correction, it should call xf86SetGamma() + * here. + */ + { + Gamma zeros = {0.0, 0.0, 0.0}; + + if (!xf86SetGamma(pScrn, zeros)) { + return FALSE; + } + } + + + /* Set the min pixel clock */ + pMga->MinClock = pMga1->MinClock; /* XXX Guess, need to check this */ + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "CRTC2: Min pixel clock is %d MHz\n", + pMga->MinClock / 1000); + /* Override on 2nd crtc */ + + if (pMga->ChipRev >= 0x80) { /* G450 */ + pMga->MaxClock = 234000; + } else { + pMga->MaxClock = 135000; + } + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "CRTC2: Max pixel clock is %d MHz\n", + pMga->MaxClock / 1000); + /* + * Setup the ClockRanges, which describe what clock ranges are available, + * and what sort of modes they can be used for. + */ + clockRanges = xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->minClock = pMga->MinClock; + clockRanges->maxClock = pMga->MaxClock; + clockRanges->clockIndex = -1; /* programmable */ + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = TRUE; +#ifdef USEMGAHAL + MGA_HAL(clockRanges->interlaceAllowed = FALSE); + MGA_HAL(clockRanges->doubleScanAllowed = FALSE); +#endif + clockRanges->interlaceAllowed = FALSE; /*no interlace on CRTC2 */ + + clockRanges->ClockMulFactor = 1; + clockRanges->ClockDivFactor = 1; + /* Only set MemClk if appropriate for the ramdac */ + if (pMga->Dac.SetMemClk) { + if (pMga->MemClk == 0) { + pMga->MemClk = pMga->Dac.MemoryClock; + from = pMga->Dac.MemClkFrom; + } else + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, from, "CRTC2: MCLK used is %.1f MHz\n", + pMga->MemClk / 1000.0); + } + + /* + * xf86ValidateModes will check that the mode HTotal and VTotal values + * don't exceed the chipset's limit if pScrn->maxHValue and + * pScrn->maxVValue are set. Since our MGAValidMode() already takes + * care of this, we don't worry about setting them here. + */ + { + int Pitches1[] = + {640, 768, 800, 960, 1024, 1152, 1280, 1600, 1920, 2048, 0}; + int Pitches2[] = + {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664, + 1920, 2048, 0}; + int *linePitches = NULL; + int minPitch = 256; + int maxPitch = 2048; + + switch(pMga->Chipset) { + case PCI_CHIP_MGA2064: + if (!pMga->NoAccel) { + linePitches = xalloc(sizeof(Pitches1)); + memcpy(linePitches, Pitches1, sizeof(Pitches1)); + minPitch = maxPitch = 0; + } + break; + case PCI_CHIP_MGA2164: + case PCI_CHIP_MGA2164_AGP: + case PCI_CHIP_MGA1064: + if (!pMga->NoAccel) { + linePitches = xalloc(sizeof(Pitches2)); + memcpy(linePitches, Pitches2, sizeof(Pitches2)); + minPitch = maxPitch = 0; + } + break; + case PCI_CHIP_MGAG100: + case PCI_CHIP_MGAG100_PCI: + maxPitch = 2048; + break; + case PCI_CHIP_MGAG200: + case PCI_CHIP_MGAG200_PCI: + case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: + maxPitch = 4096; + break; + } + + pScrn->modePool=NULL; + pScrn->modes = NULL; + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, + linePitches, minPitch, maxPitch, + pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] * + pScrn->bitsPerPixel, 128, 2048, + pScrn->display->virtualX, + pScrn->display->virtualY, + pMga->FbMapSize, + LOOKUP_BEST_REFRESH); + + if (linePitches) + xfree(linePitches); + } + + + if (i < 1 && pMga->FBDev) { + fbdevHWUseBuildinMode(pScrn); + pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */ + i = 1; + } + if (i == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "CRTC2: Validate Modes Failed\n"); + MGAFreeRec(pScrn); + return FALSE; + } + + /* Prune the modes marked as invalid */ + xf86PruneDriverModes(pScrn); + + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "CRTC2: No valid modes found\n"); + MGAFreeRec(pScrn); + return FALSE; + } +#ifdef USEMGAHAL + MGA_HAL( + + pMga->pBoard = pMga1->pBoard; + pMga->pClientStruct = pMga1->pClientStruct; + pMga->pMgaHwInfo = pMga1->pMgaHwInfo; + + + MGAFillModeInfoStruct(pScrn,NULL); + /* Fields usually handled by MGAFillModeInfoStruct, but are unavailable + * because no mode is given + */ + pMga->pMgaModeInfo->ulDispWidth = pScrn->virtualX; + pMga->pMgaModeInfo->ulDispHeight = pScrn->virtualY; + + if((status = MGAValidateMode(pMga->pBoard,pMga->pMgaModeInfo)) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "MGAValidateMode from HALlib found the mode to be invalid.\n" + "\tError: 0x%lx\n", status); + return FALSE; + } + pScrn->displayWidth = pMga->pMgaModeInfo->ulFBPitch; + ); /* MGA_HAL */ +#endif + + /* + * Set the CRTC parameters for all of the modes based on the type + * of mode, and the chipset's interlace requirements. + * + * Calling this is required if the mode->Crtc* values are used by the + * driver and if the driver doesn't provide code to set them. They + * are not pre-initialised at all. + */ +#ifdef USEMGAHAL + MGA_HAL(xf86SetCrtcForModes(pScrn, 0)); +#endif + MGA_NOT_HAL(xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V)); + + /* Set the current mode to the first in the list */ + pScrn->currentMode = pScrn->modes; + + /* Print the list of modes being used */ + xf86PrintModes(pScrn); + + /* Set display resolution */ + xf86SetDpi(pScrn, 0, 0); + + /* + * Compute the byte offset into the linear frame buffer where the + * frame buffer data should actually begin. According to DDK misc.c + * line 1023, if more than 4MB is to be displayed, YDSTORG must be set + * appropriately to align memory bank switching, and this requires a + * corresponding offset on linear frame buffer access. + * This is only needed for WRAM. + */ + + pMga->YDstOrg = pMga1->YDstOrg; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "CRTC2: YDstOrg is set to %d\n", + pMga->YDstOrg); + pMga->FbUsableSize = pMga1->FbUsableSize; + pMga->FbCursorOffset = pMga1->FbCursorOffset; + + pMga->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel; + pMga->CurrentLayout.depth = pScrn->depth; + pMga->CurrentLayout.displayWidth = pScrn->displayWidth; + pMga->CurrentLayout.weight.red = pScrn->weight.red; + pMga->CurrentLayout.weight.green = pScrn->weight.green; + pMga->CurrentLayout.weight.blue = pScrn->weight.blue; + pMga->CurrentLayout.Overlay8Plus24 = pMga->Overlay8Plus24; + pMga->CurrentLayout.mode = pScrn->currentMode; + + + Monitor2Pos = mgaRightOf; + if ((s = xf86GetOptValString(pMga1->Options, OPTION_MONITOR2POS))) { + switch(s[0]) { + case 'L': case 'l': case 'G': case 'g': + Monitor2Pos = mgaLeftOf; + break; + case 'R': case 'r': case 'D': case 'd': + Monitor2Pos = mgaRightOf; + break; + + case 'A': case 'a': case 'H': case 'h': + Monitor2Pos = mgaAbove; + break; + + case 'B': case 'b': + Monitor2Pos = mgaBelow; + break; + + case 'C': case 'c': + Monitor2Pos = mgaClone; + break; + default: + Monitor2Pos = mgaRightOf; + break; + } + } + + /* Fool xf86 into thinking we have huge modes */ + /* Keep the original values somewhere */ + pMga1->M1modes = pScrn1->modes; + pMga1->M1currentMode = pScrn1->currentMode; + /* make a copy of the mode list, so we can modify it. */ + if ((s = xf86GetOptValString(pMga1->Options, OPTION_METAMODES))) { + pScrn1->modes = GenerateModeList(pScrn,s,pMga1->M1modes,pScrn->modes,Monitor2Pos); /*FIXME: free this list*/ + if(!pScrn1->modes) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Parse Error reading MetaModes, or No modes left.\n"); + return FALSE; + } + + pScrn1->modes = pScrn1->modes->next; + pScrn1->currentMode = pScrn1->modes; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MetaModes option missing.\n"); + return FALSE; + } + xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "==== End of second screen initialization ====\n"); + return TRUE; +} + +void +MGADisplayPowerManagementSetMerged(ScrnInfoPtr pScrn, int PowerManagementMode, + int flags) +{ + MGADisplayPowerManagementSet(pScrn,PowerManagementMode,flags); + MGADisplayPowerManagementSetCrtc2(pScrn,PowerManagementMode,flags); +} + +typedef struct _region { + int x0,x1,y0,y1; + } region; + +static Bool +InRegion(int x, int y, region r) { + return (r.x0 <= x) && (x < r.x1) && (r.y0 <= y) && (y < r.y1); +} + + +#define BOUND(test,low,hi) { \ + if(test < low) test = low; \ + if(test > hi) test = hi; } +#define REBOUND(low,hi,test) { \ + if(test < low) { \ + hi += test-low; \ + low = test; } \ + if(test > hi) { \ + low += test-hi; \ + hi = test; } } + void +MGAMergePointerMoved(int scrnIndex, int x, int y) +{ + ScrnInfoPtr pScr = xf86Screens[scrnIndex]; + MGAPtr pMga = MGAPTR(pScr); + ScrnInfoPtr pScr2 = pMga->pScrn2; + + region out,in1,in2,f2,f1; + + int deltax,deltay; + + /* for ease. */ + f1.x0 = pMga->M1frameX0; + f1.x1 = pMga->M1frameX1+1; + f1.y0 = pMga->M1frameY0; + f1.y1 = pMga->M1frameY1+1; + f2.x0 = pScr2->frameX0; + f2.x1 = pScr2->frameX1+1; + f2.y0 = pScr2->frameY0; + f2.y1 = pScr2->frameY1+1; + + + /*specify outer clipping region. crossing this causes all frames to move*/ + out.x0 = pScr->frameX0; + out.x1 = pScr->frameX1+1; + out.y0 = pScr->frameY0; + out.y1 = pScr->frameY1+1; + + /* + * specify inner sliding window. beeing outsize both frames, and inside + * the outer cliping window, causes corresponding frame to slide + */ + in1 = out; + in2 = out; + switch(((MergedDisplayModePtr)pScr->currentMode->Private)->Monitor2Pos) { + case mgaLeftOf : + in1.x0 = f1.x0; + in2.x1 = f2.x1; + break; + case mgaRightOf : + in1.x1 = f1.x1; + in2.x0 = f2.x0; + break; + case mgaBelow : + in1.y1 = f1.y1; + in2.y0 = f2.y0; + break; + case mgaAbove : + in1.y0 = f1.y0; + in2.y1 = f2.y1; + break; + case mgaClone : + break; + } + + + deltay = 0; + deltax = 0; + + if(InRegion(x,y,out)) { + if( InRegion(x,y, in1) && !InRegion(x,y, f1) ) { + REBOUND(f1.x0,f1.x1,x); + REBOUND(f1.y0,f1.y1,y); + deltax = 1; /*force frame update */ + } + if( InRegion(x,y, in2) && !InRegion(x,y, f2) ) { + REBOUND(f2.x0,f2.x1,x); + REBOUND(f2.y0,f2.y1,y); + deltax = 1; /*force frame update */ + } + } + else { /*outside outer clipping region*/ + if ( out.x0 > x) { + deltax = x - out.x0; + } + if ( out.x1 < x) { + deltax = x - out.x1; + } + f1.x0 += deltax; + f1.x1 += deltax; + f2.x0 += deltax; + f2.x1 += deltax; + pScr->frameX0 += deltax; + pScr->frameX1 += deltax; + + + if ( out.y0 > y) { + deltay = y - out.y0; + } + if ( out.y1 < y) { + deltay = y - out.y1; + } + f1.y0 += deltay; + f1.y1 += deltay; + f2.y0 += deltay; + f2.y1 += deltay; + pScr->frameY0 += deltay; + pScr->frameY1 += deltay; + } + + + if (deltax != 0 || deltay != 0) { + /* back to reality. */ + pMga->M1frameX0 = f1.x0; + pMga->M1frameY0 = f1.y0; + pScr2->frameX0 = f2.x0; + pScr2->frameY0 = f2.y0; + + /*Adjust Granularity */ + MGAAdjustGranularity(pScr,&pMga->M1frameX0,&pMga->M1frameY0); + MGAAdjustGranularity(pScr,&pScr2->frameX0,&pScr2->frameY0); + MGAAdjustGranularity(pScr,&pScr->frameX0,&pScr->frameY0); + + pMga->M1frameX1 = pMga->M1frameX0 + MDMPTR(pScr)->Monitor1->HDisplay -1; + pMga->M1frameY1 = pMga->M1frameY0 + MDMPTR(pScr)->Monitor1->VDisplay -1; + pScr2->frameX1 = pScr2->frameX0 + MDMPTR(pScr)->Monitor2->HDisplay -1; + pScr2->frameY1 = pScr2->frameY0 + MDMPTR(pScr)->Monitor2->VDisplay -1; + pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay -1; + pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay -1; + + MGAAdjustFrame(pScr->scrnIndex, pMga->M1frameX0, pMga->M1frameY0, 0); + MGAAdjustFrameCrtc2(pScr->scrnIndex, pScr2->frameX0, pScr2->frameY0, 0); + } + +/* if(pMga->PointerMoved) + (*pMga->PointerMoved)(scrnIndex, x, y); FIXME: do I need to call old func?*/ + +} + + +void +MGAAdjustMergeFrames(int scrnIndex, int x, int y, int flags) { + ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex]; + MGAPtr pMga = MGAPTR(pScrn1); + ScrnInfoPtr pScrn2 = pMga->pScrn2; + int VTotal = pScrn1->currentMode->VDisplay; + int HTotal = pScrn1->currentMode->HDisplay; + int VMax = VTotal; + int HMax = HTotal; + + BOUND(x,0,pScrn1->virtualX-HTotal); + BOUND(y,0,pScrn1->virtualY-VTotal); + switch(MDMPTR(pScrn1)->Monitor2Pos) { + case mgaLeftOf: + pScrn2->frameX0 = x; + BOUND(pScrn2->frameY0,y,y + VMax - MDMPTR(pScrn1)->Monitor2->VDisplay); + pMga->M1frameX0 = x+MDMPTR(pScrn1)->Monitor2->HDisplay; + BOUND(pMga->M1frameY0,y,y + VMax - MDMPTR(pScrn1)->Monitor1->VDisplay); + break; + case mgaRightOf: + pMga->M1frameX0 = x; + BOUND(pMga->M1frameY0,y,y + VMax - MDMPTR(pScrn1)->Monitor1->VDisplay); + pScrn2->frameX0 = x+MDMPTR(pScrn1)->Monitor1->HDisplay; + BOUND(pScrn2->frameY0,y,y + VMax - MDMPTR(pScrn1)->Monitor2->VDisplay); + break; + case mgaAbove: + BOUND(pScrn2->frameX0,x,x + HMax - MDMPTR(pScrn1)->Monitor2->HDisplay); + pScrn2->frameY0 = y; + BOUND(pMga->M1frameX0,x,x + HMax - MDMPTR(pScrn1)->Monitor1->HDisplay); + pMga->M1frameY0 = y+MDMPTR(pScrn1)->Monitor2->VDisplay; + break; + case mgaBelow: + BOUND(pMga->M1frameX0,x,x + HMax - MDMPTR(pScrn1)->Monitor1->HDisplay); + pMga->M1frameY0 = y; + BOUND(pScrn2->frameX0,x,x + HMax - MDMPTR(pScrn1)->Monitor2->HDisplay); + pScrn2->frameY0 = y+MDMPTR(pScrn1)->Monitor1->VDisplay; + break; + case mgaClone: + BOUND(pMga->M1frameX0,x,x + HMax - MDMPTR(pScrn1)->Monitor1->HDisplay); + BOUND(pMga->M1frameY0,y,y + VMax - MDMPTR(pScrn1)->Monitor1->VDisplay); + BOUND(pScrn2->frameX0,x,x + HMax - MDMPTR(pScrn1)->Monitor2->HDisplay); + BOUND(pScrn2->frameY0,y,y + VMax - MDMPTR(pScrn1)->Monitor2->VDisplay); + break; + } + /* sanity checks. Make shure were not out of bounds */ + BOUND(pMga->M1frameX0,0,pScrn1->virtualX -MDMPTR(pScrn1)->Monitor1->HDisplay); + BOUND(pMga->M1frameY0,0,pScrn1->virtualY -MDMPTR(pScrn1)->Monitor1->VDisplay); + BOUND(pScrn2->frameX0,0,pScrn2->virtualX -MDMPTR(pScrn1)->Monitor2->HDisplay); + BOUND(pScrn2->frameY0,0,pScrn2->virtualY -MDMPTR(pScrn1)->Monitor2->VDisplay); + + pScrn1->frameX0 = x; + pScrn1->frameY0 = y; + + /* check granularity */ + MGAAdjustGranularity(pScrn1,&pMga->M1frameX0,&pMga->M1frameY0); + MGAAdjustGranularity(pScrn1,&pScrn2->frameX0,&pScrn2->frameY0); + MGAAdjustGranularity(pScrn1,&pScrn1->frameX0,&pScrn1->frameY0); + + /* complete shitty redundant info */ + pMga->M1frameX1 = pMga->M1frameX0 + MDMPTR(pScrn1)->Monitor1->HDisplay -1; + pMga->M1frameY1 = pMga->M1frameY0 + MDMPTR(pScrn1)->Monitor1->VDisplay -1; + pScrn2->frameX1 = pScrn2->frameX0 + MDMPTR(pScrn1)->Monitor2->HDisplay -1; + pScrn2->frameY1 = pScrn2->frameY0 + MDMPTR(pScrn1)->Monitor2->VDisplay -1; + pScrn1->frameX1 = pScrn1->frameX0 + pScrn1->currentMode->HDisplay -1; + pScrn1->frameY1 = pScrn1->frameY0 + pScrn1->currentMode->VDisplay -1; + + MGAAdjustFrame(scrnIndex, pMga->M1frameX0, pMga->M1frameY0, flags); + MGAAdjustFrameCrtc2(scrnIndex, pScrn2->frameX0, pScrn2->frameY0, flags); + return; +} + +Bool +MGACloseScreenMerged(int scrnIndex, ScreenPtr pScreen) { + ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex]; + MGAPtr pMga = MGAPTR(pScrn1); + ScrnInfoPtr pScrn2 = pMga->pScrn2; + + if(pScrn2) { + xfree(pScrn2->monitor); + pScrn2->monitor = NULL; + + xfree(pScrn2); + pMga->pScrn2 = NULL; + } + + if(pScrn1->modes) { + pScrn1->currentMode = pScrn1->modes; + do { + DisplayModePtr p = pScrn1->currentMode->next; + if(pScrn1->currentMode->Private) + xfree(pScrn1->currentMode->Private); + xfree(pScrn1->currentMode); + pScrn1->currentMode = p; + }while( pScrn1->currentMode != pScrn1->modes); + } + + pScrn1->currentMode = pMga->M1currentMode; + pScrn1->modes = pMga->M1modes; + + return TRUE; +} + +Bool +MGASaveScreenMerged(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + BOOL on = xf86IsUnblank(mode); + CARD8 reg; + + if (on) { +/* SetTimdeSinceLastInputEvent();*/ + + /* power on Dac1 */ + reg = inMGAdac(0x1E); + outMGAdac(0x1E, reg | 1); + /* power on Dac2 */ + reg = inMGAdac(0xA0); + outMGAdac(0xA0, reg | 1); + + } else { + /* power off Dac1 */ + reg = inMGAdac(0x1E); + outMGAdac(0x1E, reg & ~1); + /* power off Dac2 */ + reg = inMGAdac(0xA0); + outMGAdac(0xA0, reg & ~1); + + } + return TRUE; +} + + Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.h:1.1 --- /dev/null Thu Feb 27 12:31:05 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.h Wed Sep 18 04:54:55 2002 @@ -0,0 +1,19 @@ +/* Merged mode stuff */ +/* include file for mga_driver.c DO NOT try to generate a .o with this file.*/ + +void MGADisplayPowerManagementSetMerged(ScrnInfoPtr pScrn, + int PowerManagementMode, + int flags); +void MGAMergePointerMoved(int scrnIndex, int x, int y); +void MGAAdjustMergeFrames(int scrnIndex, int x, int y, int flags); +Bool MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags); +Bool MGACloseScreenMerged(int scrnIndex, ScreenPtr pScreen); +Bool MGASaveScreenMerged(ScreenPtr pScreen, int mode); + +typedef struct _MergedDisplayModeRec { + DisplayModePtr Monitor1; + DisplayModePtr Monitor2; + MgaScrn2Rel Monitor2Pos; +} MergedDisplayModeRec, *MergedDisplayModePtr; + +#define MDMPTR(x) ((MergedDisplayModePtr)(x->currentMode->Private)) Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.96 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.98 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.96 Thu Dec 6 10:54:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c Thu Jan 16 11:09:10 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.96 2001/12/06 15:54:52 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.98 2003/01/16 16:09:10 eich Exp $ */ /* All drivers should typically include these */ @@ -609,8 +609,7 @@ /* fallthrough */ case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: - if (pMga->SecondCrtc == FALSE) - doRender = TRUE; + doRender = FALSE; pMga->AccelFlags = TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND; @@ -1170,6 +1169,7 @@ case PCI_CHIP_MGAG400: case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: + pMga->SrcOrg = 0; OUTREG(MGAREG_SRCORG, pMga->realSrcOrg); OUTREG(MGAREG_DSTORG, pMga->DstOrg); break; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h:1.1 Fri Feb 11 12:25:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h Sat Jan 11 22:55:47 2003 @@ -19,6 +19,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h,v 1.2 2003/01/12 03:55:47 tsi Exp $ */ #ifndef _MGAREGS_H_ #define _MGAREGS_H_ @@ -34,892 +35,892 @@ * Power Graphic Mode Memory Space Registers */ - #define AGP_PLL_agp2xpllen_MASK 0xfffffffe /* bit 0 */ - #define AGP_PLL_agp2xpllen_disable 0x0 - #define AGP_PLL_agp2xpllen_enable 0x1 - - #define AC_src_MASK 0xfffffff0 /* bits 0-3 */ - #define AC_src_zero 0x0 /* val 0, shift 0 */ - #define AC_src_one 0x1 /* val 1, shift 0 */ - #define AC_src_dst_color 0x2 /* val 2, shift 0 */ - #define AC_src_om_dst_color 0x3 /* val 3, shift 0 */ - #define AC_src_src_alpha 0x4 /* val 4, shift 0 */ - #define AC_src_om_src_alpha 0x5 /* val 5, shift 0 */ - #define AC_src_dst_alpha 0x6 /* val 6, shift 0 */ - #define AC_src_om_dst_alpha 0x7 /* val 7, shift 0 */ - #define AC_src_src_alpha_sat 0x8 /* val 8, shift 0 */ - #define AC_dst_MASK 0xffffff0f /* bits 4-7 */ - #define AC_dst_zero 0x0 /* val 0, shift 4 */ - #define AC_dst_one 0x10 /* val 1, shift 4 */ - #define AC_dst_src_color 0x20 /* val 2, shift 4 */ - #define AC_dst_om_src_color 0x30 /* val 3, shift 4 */ - #define AC_dst_src_alpha 0x40 /* val 4, shift 4 */ - #define AC_dst_om_src_alpha 0x50 /* val 5, shift 4 */ - #define AC_dst_dst_alpha 0x60 /* val 6, shift 4 */ - #define AC_dst_om_dst_alpha 0x70 /* val 7, shift 4 */ - #define AC_amode_MASK 0xfffffcff /* bits 8-9 */ - #define AC_amode_FCOL 0x0 /* val 0, shift 8 */ - #define AC_amode_alpha_channel 0x100 /* val 1, shift 8 */ - #define AC_amode_video_alpha 0x200 /* val 2, shift 8 */ - #define AC_amode_RSVD 0x300 /* val 3, shift 8 */ - #define AC_astipple_MASK 0xfffff7ff /* bit 11 */ - #define AC_astipple_disable 0x0 - #define AC_astipple_enable 0x800 - #define AC_aten_MASK 0xffffefff /* bit 12 */ - #define AC_aten_disable 0x0 - #define AC_aten_enable 0x1000 - #define AC_atmode_MASK 0xffff1fff /* bits 13-15 */ - #define AC_atmode_noacmp 0x0 /* val 0, shift 13 */ - #define AC_atmode_ae 0x4000 /* val 2, shift 13 */ - #define AC_atmode_ane 0x6000 /* val 3, shift 13 */ - #define AC_atmode_alt 0x8000 /* val 4, shift 13 */ - #define AC_atmode_alte 0xa000 /* val 5, shift 13 */ - #define AC_atmode_agt 0xc000 /* val 6, shift 13 */ - #define AC_atmode_agte 0xe000 /* val 7, shift 13 */ - #define AC_atref_MASK 0xff00ffff /* bits 16-23 */ - #define AC_atref_SHIFT 16 - #define AC_alphasel_MASK 0xfcffffff /* bits 24-25 */ - #define AC_alphasel_fromtex 0x0 /* val 0, shift 24 */ - #define AC_alphasel_diffused 0x1000000 /* val 1, shift 24 */ - #define AC_alphasel_modulated 0x2000000 /* val 2, shift 24 */ - #define AC_alphasel_trans 0x3000000 /* val 3, shift 24 */ - - #define AR0_ar0_MASK 0xfffc0000 /* bits 0-17 */ - #define AR0_ar0_SHIFT 0 - - #define AR1_ar1_MASK 0xff000000 /* bits 0-23 */ - #define AR1_ar1_SHIFT 0 - - #define AR2_ar2_MASK 0xfffc0000 /* bits 0-17 */ - #define AR2_ar2_SHIFT 0 - - #define AR3_ar3_MASK 0xff000000 /* bits 0-23 */ - #define AR3_ar3_SHIFT 0 - #define AR3_spage_MASK 0xf8ffffff /* bits 24-26 */ - #define AR3_spage_SHIFT 24 - - #define AR4_ar4_MASK 0xfffc0000 /* bits 0-17 */ - #define AR4_ar4_SHIFT 0 - - #define AR5_ar5_MASK 0xfffc0000 /* bits 0-17 */ - #define AR5_ar5_SHIFT 0 - - #define AR6_ar6_MASK 0xfffc0000 /* bits 0-17 */ - #define AR6_ar6_SHIFT 0 - - #define BC_besen_MASK 0xfffffffe /* bit 0 */ - #define BC_besen_disable 0x0 - #define BC_besen_enable 0x1 - #define BC_besv1srcstp_MASK 0xffffffbf /* bit 6 */ - #define BC_besv1srcstp_even 0x0 - #define BC_besv1srcstp_odd 0x40 - #define BC_besv2srcstp_MASK 0xfffffeff /* bit 8 */ - #define BC_besv2srcstp_disable 0x0 - #define BC_besv2srcstp_enable 0x100 - #define BC_beshfen_MASK 0xfffffbff /* bit 10 */ - #define BC_beshfen_disable 0x0 - #define BC_beshfen_enable 0x400 - #define BC_besvfen_MASK 0xfffff7ff /* bit 11 */ - #define BC_besvfen_disable 0x0 - #define BC_besvfen_enable 0x800 - #define BC_beshfixc_MASK 0xffffefff /* bit 12 */ - #define BC_beshfixc_weight 0x0 - #define BC_beshfixc_coeff 0x1000 - #define BC_bescups_MASK 0xfffeffff /* bit 16 */ - #define BC_bescups_disable 0x0 - #define BC_bescups_enable 0x10000 - #define BC_bes420pl_MASK 0xfffdffff /* bit 17 */ - #define BC_bes420pl_422 0x0 - #define BC_bes420pl_420 0x20000 - #define BC_besdith_MASK 0xfffbffff /* bit 18 */ - #define BC_besdith_disable 0x0 - #define BC_besdith_enable 0x40000 - #define BC_beshmir_MASK 0xfff7ffff /* bit 19 */ - #define BC_beshmir_disable 0x0 - #define BC_beshmir_enable 0x80000 - #define BC_besbwen_MASK 0xffefffff /* bit 20 */ - #define BC_besbwen_color 0x0 - #define BC_besbwen_bw 0x100000 - #define BC_besblank_MASK 0xffdfffff /* bit 21 */ - #define BC_besblank_disable 0x0 - #define BC_besblank_enable 0x200000 - #define BC_besfselm_MASK 0xfeffffff /* bit 24 */ - #define BC_besfselm_soft 0x0 - #define BC_besfselm_hard 0x1000000 - #define BC_besfsel_MASK 0xf9ffffff /* bits 25-26 */ - #define BC_besfsel_a1 0x0 /* val 0, shift 25 */ - #define BC_besfsel_a2 0x2000000 /* val 1, shift 25 */ - #define BC_besfsel_b1 0x4000000 /* val 2, shift 25 */ - #define BC_besfsel_b2 0x6000000 /* val 3, shift 25 */ - - #define BGC_beshzoom_MASK 0xfffffffe /* bit 0 */ - #define BGC_beshzoom_disable 0x0 - #define BGC_beshzoom_enable 0x1 - #define BGC_beshzoomf_MASK 0xfffffffd /* bit 1 */ - #define BGC_beshzoomf_disable 0x0 - #define BGC_beshzoomf_enable 0x2 - #define BGC_bescorder_MASK 0xfffffff7 /* bit 3 */ - #define BGC_bescorder_even 0x0 - #define BGC_bescorder_odd 0x8 - #define BGC_besreghup_MASK 0xffffffef /* bit 4 */ - #define BGC_besreghup_disable 0x0 - #define BGC_besreghup_enable 0x10 - #define BGC_besvcnt_MASK 0xf000ffff /* bits 16-27 */ - #define BGC_besvcnt_SHIFT 16 - - #define BHC_besright_MASK 0xfffff800 /* bits 0-10 */ - #define BHC_besright_SHIFT 0 - #define BHC_besleft_MASK 0xf800ffff /* bits 16-26 */ - #define BHC_besleft_SHIFT 16 - - #define BHISF_beshiscal_MASK 0xffe00003 /* bits 2-20 */ - #define BHISF_beshiscal_SHIFT 2 - - #define BHSE_beshsrcend_MASK 0xfc000003 /* bits 2-25 */ - #define BHSE_beshsrcend_SHIFT 2 - - #define BHSL_beshsrclst_MASK 0xfc00ffff /* bits 16-25 */ - #define BHSL_beshsrclst_SHIFT 16 - - #define BHSS_beshsrcst_MASK 0xfc000003 /* bits 2-25 */ - #define BHSS_beshsrcst_SHIFT 2 - - #define BP_bespitch_MASK 0xfffff000 /* bits 0-11 */ - #define BP_bespitch_SHIFT 0 - - #define BS_besstat_MASK 0xfffffffc /* bits 0-1 */ - #define BS_besstat_a1 0x0 /* val 0, shift 0 */ - #define BS_besstat_a2 0x1 /* val 1, shift 0 */ - #define BS_besstat_b1 0x2 /* val 2, shift 0 */ - #define BS_besstat_b2 0x3 /* val 3, shift 0 */ - - #define BSF_besv1srclast_MASK 0xfffffc00 /* bits 0-9 */ - #define BSF_besv1srclast_SHIFT 0 - - #define BSF_besv2srclst_MASK 0xfffffc00 /* bits 0-9 */ - #define BSF_besv2srclst_SHIFT 0 - - #define BSF_besv1wght_MASK 0xffff0003 /* bits 2-15 */ - #define BSF_besv1wght_SHIFT 2 - #define BSF_besv1wghts_MASK 0xfffeffff /* bit 16 */ - #define BSF_besv1wghts_disable 0x0 - #define BSF_besv1wghts_enable 0x10000 - - #define BSF_besv2wght_MASK 0xffff0003 /* bits 2-15 */ - #define BSF_besv2wght_SHIFT 2 - #define BSF_besv2wghts_MASK 0xfffeffff /* bit 16 */ - #define BSF_besv2wghts_disable 0x0 - #define BSF_besv2wghts_enable 0x10000 - - #define BVC_besbot_MASK 0xfffff800 /* bits 0-10 */ - #define BVC_besbot_SHIFT 0 - #define BVC_bestop_MASK 0xf800ffff /* bits 16-26 */ - #define BVC_bestop_SHIFT 16 - - #define BVISF_besviscal_MASK 0xffe00003 /* bits 2-20 */ - #define BVISF_besviscal_SHIFT 2 - - #define CXB_cxleft_MASK 0xfffff000 /* bits 0-11 */ - #define CXB_cxleft_SHIFT 0 - #define CXB_cxright_MASK 0xf000ffff /* bits 16-27 */ - #define CXB_cxright_SHIFT 16 - - #define DO_dstmap_MASK 0xfffffffe /* bit 0 */ - #define DO_dstmap_fb 0x0 - #define DO_dstmap_sys 0x1 - #define DO_dstacc_MASK 0xfffffffd /* bit 1 */ - #define DO_dstacc_pci 0x0 - #define DO_dstacc_agp 0x2 - #define DO_dstorg_MASK 0x7 /* bits 3-31 */ - #define DO_dstorg_SHIFT 3 - - #define DC_opcod_MASK 0xfffffff0 /* bits 0-3 */ - #define DC_opcod_line_open 0x0 /* val 0, shift 0 */ - #define DC_opcod_autoline_open 0x1 /* val 1, shift 0 */ - #define DC_opcod_line_close 0x2 /* val 2, shift 0 */ - #define DC_opcod_autoline_close 0x3 /* val 3, shift 0 */ - #define DC_opcod_trap 0x4 /* val 4, shift 0 */ - #define DC_opcod_texture_trap 0x6 /* val 6, shift 0 */ - #define DC_opcod_bitblt 0x8 /* val 8, shift 0 */ - #define DC_opcod_iload 0x9 /* val 9, shift 0 */ - #define DC_atype_MASK 0xffffff8f /* bits 4-6 */ - #define DC_atype_rpl 0x0 /* val 0, shift 4 */ - #define DC_atype_rstr 0x10 /* val 1, shift 4 */ - #define DC_atype_zi 0x30 /* val 3, shift 4 */ - #define DC_atype_blk 0x40 /* val 4, shift 4 */ - #define DC_atype_i 0x70 /* val 7, shift 4 */ - #define DC_linear_MASK 0xffffff7f /* bit 7 */ - #define DC_linear_xy 0x0 - #define DC_linear_linear 0x80 - #define DC_zmode_MASK 0xfffff8ff /* bits 8-10 */ - #define DC_zmode_nozcmp 0x0 /* val 0, shift 8 */ - #define DC_zmode_ze 0x200 /* val 2, shift 8 */ - #define DC_zmode_zne 0x300 /* val 3, shift 8 */ - #define DC_zmode_zlt 0x400 /* val 4, shift 8 */ - #define DC_zmode_zlte 0x500 /* val 5, shift 8 */ - #define DC_zmode_zgt 0x600 /* val 6, shift 8 */ - #define DC_zmode_zgte 0x700 /* val 7, shift 8 */ - #define DC_solid_MASK 0xfffff7ff /* bit 11 */ - #define DC_solid_disable 0x0 - #define DC_solid_enable 0x800 - #define DC_arzero_MASK 0xffffefff /* bit 12 */ - #define DC_arzero_disable 0x0 - #define DC_arzero_enable 0x1000 - #define DC_sgnzero_MASK 0xffffdfff /* bit 13 */ - #define DC_sgnzero_disable 0x0 - #define DC_sgnzero_enable 0x2000 - #define DC_shftzero_MASK 0xffffbfff /* bit 14 */ - #define DC_shftzero_disable 0x0 - #define DC_shftzero_enable 0x4000 - #define DC_bop_MASK 0xfff0ffff /* bits 16-19 */ - #define DC_bop_SHIFT 16 - #define DC_trans_MASK 0xff0fffff /* bits 20-23 */ - #define DC_trans_SHIFT 20 - #define DC_bltmod_MASK 0xe1ffffff /* bits 25-28 */ - #define DC_bltmod_bmonolef 0x0 /* val 0, shift 25 */ - #define DC_bltmod_bmonowf 0x8000000 /* val 4, shift 25 */ - #define DC_bltmod_bplan 0x2000000 /* val 1, shift 25 */ - #define DC_bltmod_bfcol 0x4000000 /* val 2, shift 25 */ - #define DC_bltmod_bu32bgr 0x6000000 /* val 3, shift 25 */ - #define DC_bltmod_bu32rgb 0xe000000 /* val 7, shift 25 */ - #define DC_bltmod_bu24bgr 0x16000000 /* val 11, shift 25 */ - #define DC_bltmod_bu24rgb 0x1e000000 /* val 15, shift 25 */ - #define DC_pattern_MASK 0xdfffffff /* bit 29 */ - #define DC_pattern_disable 0x0 - #define DC_pattern_enable 0x20000000 - #define DC_transc_MASK 0xbfffffff /* bit 30 */ - #define DC_transc_disable 0x0 - #define DC_transc_enable 0x40000000 - #define DC_clipdis_MASK 0x7fffffff /* bit 31 */ - #define DC_clipdis_disable 0x0 - #define DC_clipdis_enable 0x80000000 - - #define DS_dwgsyncaddr_MASK 0x3 /* bits 2-31 */ - #define DS_dwgsyncaddr_SHIFT 2 - - #define FS_fifocount_MASK 0xffffff80 /* bits 0-6 */ - #define FS_fifocount_SHIFT 0 - #define FS_bfull_MASK 0xfffffeff /* bit 8 */ - #define FS_bfull_disable 0x0 - #define FS_bfull_enable 0x100 - #define FS_bempty_MASK 0xfffffdff /* bit 9 */ - #define FS_bempty_disable 0x0 - #define FS_bempty_enable 0x200 - - #define XA_fxleft_MASK 0xffff0000 /* bits 0-15 */ - #define XA_fxleft_SHIFT 0 - #define XA_fxright_MASK 0xffff /* bits 16-31 */ - #define XA_fxright_SHIFT 16 - - #define IC_softrapiclr_MASK 0xfffffffe /* bit 0 */ - #define IC_softrapiclr_disable 0x0 - #define IC_softrapiclr_enable 0x1 - #define IC_pickiclr_MASK 0xfffffffb /* bit 2 */ - #define IC_pickiclr_disable 0x0 - #define IC_pickiclr_enable 0x4 - #define IC_vlineiclr_MASK 0xffffffdf /* bit 5 */ - #define IC_vlineiclr_disable 0x0 - #define IC_vlineiclr_enable 0x20 - #define IC_wiclr_MASK 0xffffff7f /* bit 7 */ - #define IC_wiclr_disable 0x0 - #define IC_wiclr_enable 0x80 - #define IC_wciclr_MASK 0xfffffeff /* bit 8 */ - #define IC_wciclr_disable 0x0 - #define IC_wciclr_enable 0x100 - - #define IE_softrapien_MASK 0xfffffffe /* bit 0 */ - #define IE_softrapien_disable 0x0 - #define IE_softrapien_enable 0x1 - #define IE_pickien_MASK 0xfffffffb /* bit 2 */ - #define IE_pickien_disable 0x0 - #define IE_pickien_enable 0x4 - #define IE_vlineien_MASK 0xffffffdf /* bit 5 */ - #define IE_vlineien_disable 0x0 - #define IE_vlineien_enable 0x20 - #define IE_extien_MASK 0xffffffbf /* bit 6 */ - #define IE_extien_disable 0x0 - #define IE_extien_enable 0x40 - #define IE_wien_MASK 0xffffff7f /* bit 7 */ - #define IE_wien_disable 0x0 - #define IE_wien_enable 0x80 - #define IE_wcien_MASK 0xfffffeff /* bit 8 */ - #define IE_wcien_disable 0x0 - #define IE_wcien_enable 0x100 - - #define MA_pwidth_MASK 0xfffffffc /* bits 0-1 */ - #define MA_pwidth_8 0x0 /* val 0, shift 0 */ - #define MA_pwidth_16 0x1 /* val 1, shift 0 */ - #define MA_pwidth_32 0x2 /* val 2, shift 0 */ - #define MA_pwidth_24 0x3 /* val 3, shift 0 */ - #define MA_zwidth_MASK 0xffffffe7 /* bits 3-4 */ - #define MA_zwidth_16 0x0 /* val 0, shift 3 */ - #define MA_zwidth_32 0x8 /* val 1, shift 3 */ - #define MA_zwidth_15 0x10 /* val 2, shift 3 */ - #define MA_zwidth_24 0x18 /* val 3, shift 3 */ - #define MA_memreset_MASK 0xffff7fff /* bit 15 */ - #define MA_memreset_disable 0x0 - #define MA_memreset_enable 0x8000 - #define MA_fogen_MASK 0xfbffffff /* bit 26 */ - #define MA_fogen_disable 0x0 - #define MA_fogen_enable 0x4000000 - #define MA_tlutload_MASK 0xdfffffff /* bit 29 */ - #define MA_tlutload_disable 0x0 - #define MA_tlutload_enable 0x20000000 - #define MA_nodither_MASK 0xbfffffff /* bit 30 */ - #define MA_nodither_disable 0x0 - #define MA_nodither_enable 0x40000000 - #define MA_dit555_MASK 0x7fffffff /* bit 31 */ - #define MA_dit555_disable 0x0 - #define MA_dit555_enable 0x80000000 - - #define MCWS_casltncy_MASK 0xfffffff8 /* bits 0-2 */ - #define MCWS_casltncy_SHIFT 0 - #define MCWS_rrddelay_MASK 0xffffffcf /* bits 4-5 */ - #define MCWS_rcddelay_MASK 0xfffffe7f /* bits 7-8 */ - #define MCWS_rasmin_MASK 0xffffe3ff /* bits 10-12 */ - #define MCWS_rasmin_SHIFT 10 - #define MCWS_rpdelay_MASK 0xffff3fff /* bits 14-15 */ - #define MCWS_wrdelay_MASK 0xfff3ffff /* bits 18-19 */ - #define MCWS_rddelay_MASK 0xffdfffff /* bit 21 */ - #define MCWS_rddelay_disable 0x0 - #define MCWS_rddelay_enable 0x200000 - #define MCWS_smrdelay_MASK 0xfe7fffff /* bits 23-24 */ - #define MCWS_bwcdelay_MASK 0xf3ffffff /* bits 26-27 */ - #define MCWS_bpldelay_MASK 0x1fffffff /* bits 29-31 */ - #define MCWS_bpldelay_SHIFT 29 - - #define MRB_mclkbrd0_MASK 0xfffffff0 /* bits 0-3 */ - #define MRB_mclkbrd0_SHIFT 0 - #define MRB_mclkbrd1_MASK 0xfffffe1f /* bits 5-8 */ - #define MRB_mclkbrd1_SHIFT 5 - #define MRB_strmfctl_MASK 0xff3fffff /* bits 22-23 */ - #define MRB_mrsopcod_MASK 0xe1ffffff /* bits 25-28 */ - #define MRB_mrsopcod_SHIFT 25 - - #define OM_dmamod_MASK 0xfffffff3 /* bits 2-3 */ - #define OM_dmamod_general 0x0 /* val 0, shift 2 */ - #define OM_dmamod_blit 0x4 /* val 1, shift 2 */ - #define OM_dmamod_vector 0x8 /* val 2, shift 2 */ - #define OM_dmamod_vertex 0xc /* val 3, shift 2 */ - #define OM_dmadatasiz_MASK 0xfffffcff /* bits 8-9 */ - #define OM_dmadatasiz_8 0x0 /* val 0, shift 8 */ - #define OM_dmadatasiz_16 0x100 /* val 1, shift 8 */ - #define OM_dmadatasiz_32 0x200 /* val 2, shift 8 */ - #define OM_dirdatasiz_MASK 0xfffcffff /* bits 16-17 */ - #define OM_dirdatasiz_8 0x0 /* val 0, shift 16 */ - #define OM_dirdatasiz_16 0x10000 /* val 1, shift 16 */ - #define OM_dirdatasiz_32 0x20000 /* val 2, shift 16 */ - - #define P_iy_MASK 0xffffe000 /* bits 0-12 */ - #define P_iy_SHIFT 0 - #define P_ylin_MASK 0xffff7fff /* bit 15 */ - #define P_ylin_disable 0x0 - #define P_ylin_enable 0x8000 - - #define PDCA_primod_MASK 0xfffffffc /* bits 0-1 */ - #define PDCA_primod_general 0x0 /* val 0, shift 0 */ - #define PDCA_primod_blit 0x1 /* val 1, shift 0 */ - #define PDCA_primod_vector 0x2 /* val 2, shift 0 */ - #define PDCA_primod_vertex 0x3 /* val 3, shift 0 */ - #define PDCA_primaddress_MASK 0x3 /* bits 2-31 */ - #define PDCA_primaddress_SHIFT 2 - - #define PDEA_primnostart_MASK 0xfffffffe /* bit 0 */ - #define PDEA_primnostart_disable 0x0 - #define PDEA_primnostart_enable 0x1 - #define PDEA_pagpxfer_MASK 0xfffffffd /* bit 1 */ - #define PDEA_pagpxfer_disable 0x0 - #define PDEA_pagpxfer_enable 0x2 - #define PDEA_primend_MASK 0x3 /* bits 2-31 */ - #define PDEA_primend_SHIFT 2 - - #define PLS_primptren0_MASK 0xfffffffe /* bit 0 */ - #define PLS_primptren0_disable 0x0 - #define PLS_primptren0_enable 0x1 - #define PLS_primptren1_MASK 0xfffffffd /* bit 1 */ - #define PLS_primptren1_disable 0x0 - #define PLS_primptren1_enable 0x2 - #define PLS_primptr_MASK 0x7 /* bits 3-31 */ - #define PLS_primptr_SHIFT 3 - - #define R_softreset_MASK 0xfffffffe /* bit 0 */ - #define R_softreset_disable 0x0 - #define R_softreset_enable 0x1 - #define R_softextrst_MASK 0xfffffffd /* bit 1 */ - #define R_softextrst_disable 0x0 - #define R_softextrst_enable 0x2 - - #define SDCA_secmod_MASK 0xfffffffc /* bits 0-1 */ - #define SDCA_secmod_general 0x0 /* val 0, shift 0 */ - #define SDCA_secmod_blit 0x1 /* val 1, shift 0 */ - #define SDCA_secmod_vector 0x2 /* val 2, shift 0 */ - #define SDCA_secmod_vertex 0x3 /* val 3, shift 0 */ - #define SDCA_secaddress_MASK 0x3 /* bits 2-31 */ - #define SDCA_secaddress_SHIFT 2 - - #define SDEA_sagpxfer_MASK 0xfffffffd /* bit 1 */ - #define SDEA_sagpxfer_disable 0x0 - #define SDEA_sagpxfer_enable 0x2 - #define SDEA_secend_MASK 0x3 /* bits 2-31 */ - #define SDEA_secend_SHIFT 2 - - #define SETDCA_setupmod_MASK 0xfffffffc /* bits 0-1 */ - #define SETDCA_setupmod_vertlist 0x0 /* val 0, shift 0 */ - #define SETDCA_setupaddress_MASK 0x3 /* bits 2-31 */ - #define SETDCA_setupaddress_SHIFT 2 - - #define SETDEA_setupagpxfer_MASK 0xfffffffd /* bit 1 */ - #define SETDEA_setupagpxfer_disable 0x0 - #define SETDEA_setupagpxfer_enable 0x2 - #define SETDEA_setupend_MASK 0x3 /* bits 2-31 */ - #define SETDEA_setupend_SHIFT 2 - - #define S_sdydxl_MASK 0xfffffffe /* bit 0 */ - #define S_sdydxl_y 0x0 - #define S_sdydxl_x 0x1 - #define S_scanleft_MASK 0xfffffffe /* bit 0 */ - #define S_scanleft_disable 0x0 - #define S_scanleft_enable 0x1 - #define S_sdxl_MASK 0xfffffffd /* bit 1 */ - #define S_sdxl_pos 0x0 - #define S_sdxl_neg 0x2 - #define S_sdy_MASK 0xfffffffb /* bit 2 */ - #define S_sdy_pos 0x0 - #define S_sdy_neg 0x4 - #define S_sdxr_MASK 0xffffffdf /* bit 5 */ - #define S_sdxr_pos 0x0 - #define S_sdxr_neg 0x20 - #define S_brkleft_MASK 0xfffffeff /* bit 8 */ - #define S_brkleft_disable 0x0 - #define S_brkleft_enable 0x100 - #define S_errorinit_MASK 0x7fffffff /* bit 31 */ - #define S_errorinit_disable 0x0 - #define S_errorinit_enable 0x80000000 - - #define FSC_x_off_MASK 0xfffffff0 /* bits 0-3 */ - #define FSC_x_off_SHIFT 0 - #define FSC_funcnt_MASK 0xffffff80 /* bits 0-6 */ - #define FSC_funcnt_SHIFT 0 - #define FSC_y_off_MASK 0xffffff8f /* bits 4-6 */ - #define FSC_y_off_SHIFT 4 - #define FSC_funoff_MASK 0xffc0ffff /* bits 16-21 */ - #define FSC_funoff_SHIFT 16 - #define FSC_stylelen_MASK 0xffc0ffff /* bits 16-21 */ - #define FSC_stylelen_SHIFT 16 - - - #define STH_softraphand_MASK 0x3 /* bits 2-31 */ - #define STH_softraphand_SHIFT 2 - - #define SO_srcmap_MASK 0xfffffffe /* bit 0 */ - #define SO_srcmap_fb 0x0 - #define SO_srcmap_sys 0x1 - #define SO_srcacc_MASK 0xfffffffd /* bit 1 */ - #define SO_srcacc_pci 0x0 - #define SO_srcacc_agp 0x2 - #define SO_srcorg_MASK 0x7 /* bits 3-31 */ - #define SO_srcorg_SHIFT 3 - - #define STAT_softrapen_MASK 0xfffffffe /* bit 0 */ - #define STAT_softrapen_disable 0x0 - #define STAT_softrapen_enable 0x1 - #define STAT_pickpen_MASK 0xfffffffb /* bit 2 */ - #define STAT_pickpen_disable 0x0 - #define STAT_pickpen_enable 0x4 - #define STAT_vsyncsts_MASK 0xfffffff7 /* bit 3 */ - #define STAT_vsyncsts_disable 0x0 - #define STAT_vsyncsts_enable 0x8 - #define STAT_vsyncpen_MASK 0xffffffef /* bit 4 */ - #define STAT_vsyncpen_disable 0x0 - #define STAT_vsyncpen_enable 0x10 - #define STAT_vlinepen_MASK 0xffffffdf /* bit 5 */ - #define STAT_vlinepen_disable 0x0 - #define STAT_vlinepen_enable 0x20 - #define STAT_extpen_MASK 0xffffffbf /* bit 6 */ - #define STAT_extpen_disable 0x0 - #define STAT_extpen_enable 0x40 - #define STAT_wpen_MASK 0xffffff7f /* bit 7 */ - #define STAT_wpen_disable 0x0 - #define STAT_wpen_enable 0x80 - #define STAT_wcpen_MASK 0xfffffeff /* bit 8 */ - #define STAT_wcpen_disable 0x0 - #define STAT_wcpen_enable 0x100 - #define STAT_dwgengsts_MASK 0xfffeffff /* bit 16 */ - #define STAT_dwgengsts_disable 0x0 - #define STAT_dwgengsts_enable 0x10000 - #define STAT_endprdmasts_MASK 0xfffdffff /* bit 17 */ - #define STAT_endprdmasts_disable 0x0 - #define STAT_endprdmasts_enable 0x20000 - #define STAT_wbusy_MASK 0xfffbffff /* bit 18 */ - #define STAT_wbusy_disable 0x0 - #define STAT_wbusy_enable 0x40000 - #define STAT_swflag_MASK 0xfffffff /* bits 28-31 */ - #define STAT_swflag_SHIFT 28 - - #define S_sref_MASK 0xffffff00 /* bits 0-7 */ - #define S_sref_SHIFT 0 - #define S_smsk_MASK 0xffff00ff /* bits 8-15 */ - #define S_smsk_SHIFT 8 - #define S_swtmsk_MASK 0xff00ffff /* bits 16-23 */ - #define S_swtmsk_SHIFT 16 - - #define SC_smode_MASK 0xfffffff8 /* bits 0-2 */ - #define SC_smode_salways 0x0 /* val 0, shift 0 */ - #define SC_smode_snever 0x1 /* val 1, shift 0 */ - #define SC_smode_se 0x2 /* val 2, shift 0 */ - #define SC_smode_sne 0x3 /* val 3, shift 0 */ - #define SC_smode_slt 0x4 /* val 4, shift 0 */ - #define SC_smode_slte 0x5 /* val 5, shift 0 */ - #define SC_smode_sgt 0x6 /* val 6, shift 0 */ - #define SC_smode_sgte 0x7 /* val 7, shift 0 */ - #define SC_sfailop_MASK 0xffffffc7 /* bits 3-5 */ - #define SC_sfailop_keep 0x0 /* val 0, shift 3 */ - #define SC_sfailop_zero 0x8 /* val 1, shift 3 */ - #define SC_sfailop_replace 0x10 /* val 2, shift 3 */ - #define SC_sfailop_incrsat 0x18 /* val 3, shift 3 */ - #define SC_sfailop_decrsat 0x20 /* val 4, shift 3 */ - #define SC_sfailop_invert 0x28 /* val 5, shift 3 */ - #define SC_sfailop_incr 0x30 /* val 6, shift 3 */ - #define SC_sfailop_decr 0x38 /* val 7, shift 3 */ - #define SC_szfailop_MASK 0xfffffe3f /* bits 6-8 */ - #define SC_szfailop_keep 0x0 /* val 0, shift 6 */ - #define SC_szfailop_zero 0x40 /* val 1, shift 6 */ - #define SC_szfailop_replace 0x80 /* val 2, shift 6 */ - #define SC_szfailop_incrsat 0xc0 /* val 3, shift 6 */ - #define SC_szfailop_decrsat 0x100 /* val 4, shift 6 */ - #define SC_szfailop_invert 0x140 /* val 5, shift 6 */ - #define SC_szfailop_incr 0x180 /* val 6, shift 6 */ - #define SC_szfailop_decr 0x1c0 /* val 7, shift 6 */ - #define SC_szpassop_MASK 0xfffff1ff /* bits 9-11 */ - #define SC_szpassop_keep 0x0 /* val 0, shift 9 */ - #define SC_szpassop_zero 0x200 /* val 1, shift 9 */ - #define SC_szpassop_replace 0x400 /* val 2, shift 9 */ - #define SC_szpassop_incrsat 0x600 /* val 3, shift 9 */ - #define SC_szpassop_decrsat 0x800 /* val 4, shift 9 */ - #define SC_szpassop_invert 0xa00 /* val 5, shift 9 */ - #define SC_szpassop_incr 0xc00 /* val 6, shift 9 */ - #define SC_szpassop_decr 0xe00 /* val 7, shift 9 */ - - #define TD1_color1arg2selMASK 0xfffffffc /* bits 0-1 */ - #define TD1_color1alphaselMASK 0xffffffe3 /* bits 2-4 */ - #define TD1_color1alphaselSHIFT 2 - #define TD1_color1arg1alphaMASK 0xffffffdf /* bit 5 */ - #define TD1_color1arg1alphadisable 0x0 - #define TD1_color1arg1alphaenable 0x20 - #define TD1_color1arg1invMASK 0xffffffbf /* bit 6 */ - #define TD1_color1arg1invdisable 0x0 - #define TD1_color1arg1invenable 0x40 - #define TD1_color1arg2alphaMASK 0xffffff7f /* bit 7 */ - #define TD1_color1arg2alphadisable 0x0 - #define TD1_color1arg2alphaenable 0x80 - #define TD1_color1arg2invMASK 0xfffffeff /* bit 8 */ - #define TD1_color1arg2invdisable 0x0 - #define TD1_color1arg2invenable 0x100 - #define TD1_color1alpha1invMASK 0xfffffdff /* bit 9 */ - #define TD1_color1alpha1invdisable 0x0 - #define TD1_color1alpha1invenable 0x200 - #define TD1_color1alpha2invMASK 0xfffffbff /* bit 10 */ - #define TD1_color1alpha2invdisable 0x0 - #define TD1_color1alpha2invenable 0x400 - #define TD1_color1selMASK 0xff9fffff /* bits 21-22 */ - #define TD1_color1selarg1 0x0 /* val 0, shift 21 */ - #define TD1_color1selarg2 0x200000 /* val 1, shift 21 */ - #define TD1_color1seladd 0x400000 /* val 2, shift 21 */ - #define TD1_color1selmul 0x600000 /* val 3, shift 21 */ - #define TD1_alpha1selMASK 0x3fffffff /* bits 30-31 */ - #define TD1_alpha1selarg1 0x0 /* val 0, shift 30 */ - #define TD1_alpha1selarg2 0x40000000 /* val 1, shift 30 */ - #define TD1_alpha1seladd 0x80000000 /* val 2, shift 30 */ - #define TD1_alpha1selmul 0xc0000000 /* val 3, shift 30 */ - - #define TST_ramtsten_MASK 0xfffffffe /* bit 0 */ - #define TST_ramtsten_disable 0x0 - #define TST_ramtsten_enable 0x1 - #define TST_ramtstdone_MASK 0xfffffffd /* bit 1 */ - #define TST_ramtstdone_disable 0x0 - #define TST_ramtstdone_enable 0x2 - #define TST_wramtstpass_MASK 0xfffffffb /* bit 2 */ - #define TST_wramtstpass_disable 0x0 - #define TST_wramtstpass_enable 0x4 - #define TST_tcachetstpass_MASK 0xfffffff7 /* bit 3 */ - #define TST_tcachetstpass_disable 0x0 - #define TST_tcachetstpass_enable 0x8 - #define TST_tluttstpass_MASK 0xffffffef /* bit 4 */ - #define TST_tluttstpass_disable 0x0 - #define TST_tluttstpass_enable 0x10 - #define TST_luttstpass_MASK 0xffffffdf /* bit 5 */ - #define TST_luttstpass_disable 0x0 - #define TST_luttstpass_enable 0x20 - #define TST_besramtstpass_MASK 0xffffffbf /* bit 6 */ - #define TST_besramtstpass_disable 0x0 - #define TST_besramtstpass_enable 0x40 - #define TST_ringen_MASK 0xfffffeff /* bit 8 */ - #define TST_ringen_disable 0x0 - #define TST_ringen_enable 0x100 - #define TST_apllbyp_MASK 0xfffffdff /* bit 9 */ - #define TST_apllbyp_disable 0x0 - #define TST_apllbyp_enable 0x200 - #define TST_hiten_MASK 0xfffffbff /* bit 10 */ - #define TST_hiten_disable 0x0 - #define TST_hiten_enable 0x400 - #define TST_tmode_MASK 0xffffc7ff /* bits 11-13 */ - #define TST_tmode_SHIFT 11 - #define TST_tclksel_MASK 0xfffe3fff /* bits 14-16 */ - #define TST_tclksel_SHIFT 14 - #define TST_ringcnten_MASK 0xfffdffff /* bit 17 */ - #define TST_ringcnten_disable 0x0 - #define TST_ringcnten_enable 0x20000 - #define TST_ringcnt_MASK 0xc003ffff /* bits 18-29 */ - #define TST_ringcnt_SHIFT 18 - #define TST_ringcntclksl_MASK 0xbfffffff /* bit 30 */ - #define TST_ringcntclksl_disable 0x0 - #define TST_ringcntclksl_enable 0x40000000 - #define TST_biosboot_MASK 0x7fffffff /* bit 31 */ - #define TST_biosboot_disable 0x0 - #define TST_biosboot_enable 0x80000000 - - #define TMC_tformat_MASK 0xfffffff0 /* bits 0-3 */ - #define TMC_tformat_tw4 0x0 /* val 0, shift 0 */ - #define TMC_tformat_tw8 0x1 /* val 1, shift 0 */ - #define TMC_tformat_tw15 0x2 /* val 2, shift 0 */ - #define TMC_tformat_tw16 0x3 /* val 3, shift 0 */ - #define TMC_tformat_tw12 0x4 /* val 4, shift 0 */ - #define TMC_tformat_tw32 0x6 /* val 6, shift 0 */ - #define TMC_tformat_tw422 0xa /* val 10, shift 0 */ - #define TMC_tpitchlin_MASK 0xfffffeff /* bit 8 */ - #define TMC_tpitchlin_disable 0x0 - #define TMC_tpitchlin_enable 0x100 - #define TMC_tpitchext_MASK 0xfff001ff /* bits 9-19 */ - #define TMC_tpitchext_SHIFT 9 - #define TMC_tpitch_MASK 0xfff8ffff /* bits 16-18 */ - #define TMC_tpitch_SHIFT 16 - #define TMC_owalpha_MASK 0xffbfffff /* bit 22 */ - #define TMC_owalpha_disable 0x0 - #define TMC_owalpha_enable 0x400000 - #define TMC_azeroextend_MASK 0xff7fffff /* bit 23 */ - #define TMC_azeroextend_disable 0x0 - #define TMC_azeroextend_enable 0x800000 - #define TMC_decalckey_MASK 0xfeffffff /* bit 24 */ - #define TMC_decalckey_disable 0x0 - #define TMC_decalckey_enable 0x1000000 - #define TMC_takey_MASK 0xfdffffff /* bit 25 */ - #define TMC_takey_0 0x0 - #define TMC_takey_1 0x2000000 - #define TMC_tamask_MASK 0xfbffffff /* bit 26 */ - #define TMC_tamask_0 0x0 - #define TMC_tamask_1 0x4000000 - #define TMC_clampv_MASK 0xf7ffffff /* bit 27 */ - #define TMC_clampv_disable 0x0 - #define TMC_clampv_enable 0x8000000 - #define TMC_clampu_MASK 0xefffffff /* bit 28 */ - #define TMC_clampu_disable 0x0 - #define TMC_clampu_enable 0x10000000 - #define TMC_tmodulate_MASK 0xdfffffff /* bit 29 */ - #define TMC_tmodulate_disable 0x0 - #define TMC_tmodulate_enable 0x20000000 - #define TMC_strans_MASK 0xbfffffff /* bit 30 */ - #define TMC_strans_disable 0x0 - #define TMC_strans_enable 0x40000000 - #define TMC_itrans_MASK 0x7fffffff /* bit 31 */ - #define TMC_itrans_disable 0x0 - #define TMC_itrans_enable 0x80000000 - - #define TMC_decalblend_MASK 0xfffffffe /* bit 0 */ - #define TMC_decalblend_disable 0x0 - #define TMC_decalblend_enable 0x1 - #define TMC_idecal_MASK 0xfffffffd /* bit 1 */ - #define TMC_idecal_disable 0x0 - #define TMC_idecal_enable 0x2 - #define TMC_decaldis_MASK 0xfffffffb /* bit 2 */ - #define TMC_decaldis_disable 0x0 - #define TMC_decaldis_enable 0x4 - #define TMC_ckstransdis_MASK 0xffffffef /* bit 4 */ - #define TMC_ckstransdis_disable 0x0 - #define TMC_ckstransdis_enable 0x10 - #define TMC_borderen_MASK 0xffffffdf /* bit 5 */ - #define TMC_borderen_disable 0x0 - #define TMC_borderen_enable 0x20 - #define TMC_specen_MASK 0xffffffbf /* bit 6 */ - #define TMC_specen_disable 0x0 - #define TMC_specen_enable 0x40 - - #define TF_minfilter_MASK 0xfffffff0 /* bits 0-3 */ - #define TF_minfilter_nrst 0x0 /* val 0, shift 0 */ - #define TF_minfilter_bilin 0x2 /* val 2, shift 0 */ - #define TF_minfilter_cnst 0x3 /* val 3, shift 0 */ - #define TF_minfilter_mm1s 0x8 /* val 8, shift 0 */ - #define TF_minfilter_mm2s 0x9 /* val 9, shift 0 */ - #define TF_minfilter_mm4s 0xa /* val 10, shift 0 */ - #define TF_minfilter_mm8s 0xc /* val 12, shift 0 */ - #define TF_magfilter_MASK 0xffffff0f /* bits 4-7 */ - #define TF_magfilter_nrst 0x0 /* val 0, shift 4 */ - #define TF_magfilter_bilin 0x20 /* val 2, shift 4 */ - #define TF_magfilter_cnst 0x30 /* val 3, shift 4 */ - #define TF_avgstride_MASK 0xfff7ffff /* bit 19 */ - #define TF_avgstride_disable 0x0 - #define TF_avgstride_enable 0x80000 - #define TF_filteralpha_MASK 0xffefffff /* bit 20 */ - #define TF_filteralpha_disable 0x0 - #define TF_filteralpha_enable 0x100000 - #define TF_fthres_MASK 0xe01fffff /* bits 21-28 */ - #define TF_fthres_SHIFT 21 - #define TF_mapnb_MASK 0x1fffffff /* bits 29-31 */ - #define TF_mapnb_SHIFT 29 - - #define TH_th_MASK 0xffffffc0 /* bits 0-5 */ - #define TH_th_SHIFT 0 - #define TH_rfh_MASK 0xffff81ff /* bits 9-14 */ - #define TH_rfh_SHIFT 9 - #define TH_thmask_MASK 0xe003ffff /* bits 18-28 */ - #define TH_thmask_SHIFT 18 - - #define TO_texorgmap_MASK 0xfffffffe /* bit 0 */ - #define TO_texorgmap_fb 0x0 - #define TO_texorgmap_sys 0x1 - #define TO_texorgacc_MASK 0xfffffffd /* bit 1 */ - #define TO_texorgacc_pci 0x0 - #define TO_texorgacc_agp 0x2 - #define TO_texorg_MASK 0x1f /* bits 5-31 */ - #define TO_texorg_SHIFT 5 - - #define TT_tckey_MASK 0xffff0000 /* bits 0-15 */ - #define TT_tckey_SHIFT 0 - #define TT_tkmask_MASK 0xffff /* bits 16-31 */ - #define TT_tkmask_SHIFT 16 - - #define TT_tckeyh_MASK 0xffff0000 /* bits 0-15 */ - #define TT_tckeyh_SHIFT 0 - #define TT_tkmaskh_MASK 0xffff /* bits 16-31 */ - #define TT_tkmaskh_SHIFT 16 - - #define TW_tw_MASK 0xffffffc0 /* bits 0-5 */ - #define TW_tw_SHIFT 0 - #define TW_rfw_MASK 0xffff81ff /* bits 9-14 */ - #define TW_rfw_SHIFT 9 - #define TW_twmask_MASK 0xe003ffff /* bits 18-28 */ - #define TW_twmask_SHIFT 18 - - #define WAS_seqdst0_MASK 0xffffffc0 /* bits 0-5 */ - #define WAS_seqdst0_SHIFT 0 - #define WAS_seqdst1_MASK 0xfffff03f /* bits 6-11 */ - #define WAS_seqdst1_SHIFT 6 - #define WAS_seqdst2_MASK 0xfffc0fff /* bits 12-17 */ - #define WAS_seqdst2_SHIFT 12 - #define WAS_seqdst3_MASK 0xff03ffff /* bits 18-23 */ - #define WAS_seqdst3_SHIFT 18 - #define WAS_seqlen_MASK 0xfcffffff /* bits 24-25 */ - #define WAS_wfirsttag_MASK 0xfbffffff /* bit 26 */ - #define WAS_wfirsttag_disable 0x0 - #define WAS_wfirsttag_enable 0x4000000 - #define WAS_wsametag_MASK 0xf7ffffff /* bit 27 */ - #define WAS_wsametag_disable 0x0 - #define WAS_wsametag_enable 0x8000000 - #define WAS_seqoff_MASK 0xefffffff /* bit 28 */ - #define WAS_seqoff_disable 0x0 - #define WAS_seqoff_enable 0x10000000 - - #define WMA_wcodeaddr_MASK 0xff /* bits 8-31 */ - #define WMA_wcodeaddr_SHIFT 8 - - #define WF_walustsflag_MASK 0xffffff00 /* bits 0-7 */ - #define WF_walustsflag_SHIFT 0 - #define WF_walucfgflag_MASK 0xffff00ff /* bits 8-15 */ - #define WF_walucfgflag_SHIFT 8 - #define WF_wprgflag_MASK 0xffff /* bits 16-31 */ - #define WF_wprgflag_SHIFT 16 - - #define WF1_walustsflag1_MASK 0xffffff00 /* bits 0-7 */ - #define WF1_walustsflag1_SHIFT 0 - #define WF1_walucfgflag1_MASK 0xffff00ff /* bits 8-15 */ - #define WF1_walucfgflag1_SHIFT 8 - #define WF1_wprgflag1_MASK 0xffff /* bits 16-31 */ - #define WF1_wprgflag1_SHIFT 16 - - #define WGV_wgetmsbmin_MASK 0xffffffe0 /* bits 0-4 */ - #define WGV_wgetmsbmin_SHIFT 0 - #define WGV_wgetmsbmax_MASK 0xffffe0ff /* bits 8-12 */ - #define WGV_wgetmsbmax_SHIFT 8 - #define WGV_wbrklefttop_MASK 0xfffeffff /* bit 16 */ - #define WGV_wbrklefttop_disable 0x0 - #define WGV_wbrklefttop_enable 0x10000 - #define WGV_wfastcrop_MASK 0xfffdffff /* bit 17 */ - #define WGV_wfastcrop_disable 0x0 - #define WGV_wfastcrop_enable 0x20000 - #define WGV_wcentersnap_MASK 0xfffbffff /* bit 18 */ - #define WGV_wcentersnap_disable 0x0 - #define WGV_wcentersnap_enable 0x40000 - #define WGV_wbrkrighttop_MASK 0xfff7ffff /* bit 19 */ - #define WGV_wbrkrighttop_disable 0x0 - #define WGV_wbrkrighttop_enable 0x80000 - - #define WIA_wmode_MASK 0xfffffffc /* bits 0-1 */ - #define WIA_wmode_suspend 0x0 /* val 0, shift 0 */ - #define WIA_wmode_resume 0x1 /* val 1, shift 0 */ - #define WIA_wmode_jump 0x2 /* val 2, shift 0 */ - #define WIA_wmode_start 0x3 /* val 3, shift 0 */ - #define WIA_wagp_MASK 0xfffffffb /* bit 2 */ - #define WIA_wagp_pci 0x0 - #define WIA_wagp_agp 0x4 - #define WIA_wiaddr_MASK 0x7 /* bits 3-31 */ - #define WIA_wiaddr_SHIFT 3 - - #define WIA2_wmode_MASK 0xfffffffc /* bits 0-1 */ - #define WIA2_wmode_suspend 0x0 /* val 0, shift 0 */ - #define WIA2_wmode_resume 0x1 /* val 1, shift 0 */ - #define WIA2_wmode_jump 0x2 /* val 2, shift 0 */ - #define WIA2_wmode_start 0x3 /* val 3, shift 0 */ - #define WIA2_wagp_MASK 0xfffffffb /* bit 2 */ - #define WIA2_wagp_pci 0x0 - #define WIA2_wagp_agp 0x4 - #define WIA2_wiaddr_MASK 0x7 /* bits 3-31 */ - #define WIA2_wiaddr_SHIFT 3 - - #define WIMA_wimemaddr_MASK 0xffffff00 /* bits 0-7 */ - #define WIMA_wimemaddr_SHIFT 0 - - #define WM_wucodecache_MASK 0xfffffffe /* bit 0 */ - #define WM_wucodecache_disable 0x0 - #define WM_wucodecache_enable 0x1 - #define WM_wmaster_MASK 0xfffffffd /* bit 1 */ - #define WM_wmaster_disable 0x0 - #define WM_wmaster_enable 0x2 - #define WM_wcacheflush_MASK 0xfffffff7 /* bit 3 */ - #define WM_wcacheflush_disable 0x0 - #define WM_wcacheflush_enable 0x8 - - #define WVS_wvrtxsz_MASK 0xffffffc0 /* bits 0-5 */ - #define WVS_wvrtxsz_SHIFT 0 - #define WVS_primsz_MASK 0xffffc0ff /* bits 8-13 */ - #define WVS_primsz_SHIFT 8 - - #define XYEA_x_end_MASK 0xffff0000 /* bits 0-15 */ - #define XYEA_x_end_SHIFT 0 - #define XYEA_y_end_MASK 0xffff /* bits 16-31 */ - #define XYEA_y_end_SHIFT 16 - - #define XYSA_x_start_MASK 0xffff0000 /* bits 0-15 */ - #define XYSA_x_start_SHIFT 0 - #define XYSA_y_start_MASK 0xffff /* bits 16-31 */ - #define XYSA_y_start_SHIFT 16 - - #define YA_ydst_MASK 0xff800000 /* bits 0-22 */ - #define YA_ydst_SHIFT 0 - #define YA_sellin_MASK 0x1fffffff /* bits 29-31 */ - #define YA_sellin_SHIFT 29 - - #define YDL_length_MASK 0xffff0000 /* bits 0-15 */ - #define YDL_length_SHIFT 0 - #define YDL_yval_MASK 0xffff /* bits 16-31 */ - #define YDL_yval_SHIFT 16 - - #define ZO_zorgmap_MASK 0xfffffffe /* bit 0 */ - #define ZO_zorgmap_fb 0x0 - #define ZO_zorgmap_sys 0x1 - #define ZO_zorgacc_MASK 0xfffffffd /* bit 1 */ - #define ZO_zorgacc_pci 0x0 - #define ZO_zorgacc_agp 0x2 - #define ZO_zorg_MASK 0x3 /* bits 2-31 */ - #define ZO_zorg_SHIFT 2 +# define AGP_PLL_agp2xpllen_MASK 0xfffffffe /* bit 0 */ +# define AGP_PLL_agp2xpllen_disable 0x0 +# define AGP_PLL_agp2xpllen_enable 0x1 + +# define AC_src_MASK 0xfffffff0 /* bits 0-3 */ +# define AC_src_zero 0x0 /* val 0, shift 0 */ +# define AC_src_one 0x1 /* val 1, shift 0 */ +# define AC_src_dst_color 0x2 /* val 2, shift 0 */ +# define AC_src_om_dst_color 0x3 /* val 3, shift 0 */ +# define AC_src_src_alpha 0x4 /* val 4, shift 0 */ +# define AC_src_om_src_alpha 0x5 /* val 5, shift 0 */ +# define AC_src_dst_alpha 0x6 /* val 6, shift 0 */ +# define AC_src_om_dst_alpha 0x7 /* val 7, shift 0 */ +# define AC_src_src_alpha_sat 0x8 /* val 8, shift 0 */ +# define AC_dst_MASK 0xffffff0f /* bits 4-7 */ +# define AC_dst_zero 0x0 /* val 0, shift 4 */ +# define AC_dst_one 0x10 /* val 1, shift 4 */ +# define AC_dst_src_color 0x20 /* val 2, shift 4 */ +# define AC_dst_om_src_color 0x30 /* val 3, shift 4 */ +# define AC_dst_src_alpha 0x40 /* val 4, shift 4 */ +# define AC_dst_om_src_alpha 0x50 /* val 5, shift 4 */ +# define AC_dst_dst_alpha 0x60 /* val 6, shift 4 */ +# define AC_dst_om_dst_alpha 0x70 /* val 7, shift 4 */ +# define AC_amode_MASK 0xfffffcff /* bits 8-9 */ +# define AC_amode_FCOL 0x0 /* val 0, shift 8 */ +# define AC_amode_alpha_channel 0x100 /* val 1, shift 8 */ +# define AC_amode_video_alpha 0x200 /* val 2, shift 8 */ +# define AC_amode_RSVD 0x300 /* val 3, shift 8 */ +# define AC_astipple_MASK 0xfffff7ff /* bit 11 */ +# define AC_astipple_disable 0x0 +# define AC_astipple_enable 0x800 +# define AC_aten_MASK 0xffffefff /* bit 12 */ +# define AC_aten_disable 0x0 +# define AC_aten_enable 0x1000 +# define AC_atmode_MASK 0xffff1fff /* bits 13-15 */ +# define AC_atmode_noacmp 0x0 /* val 0, shift 13 */ +# define AC_atmode_ae 0x4000 /* val 2, shift 13 */ +# define AC_atmode_ane 0x6000 /* val 3, shift 13 */ +# define AC_atmode_alt 0x8000 /* val 4, shift 13 */ +# define AC_atmode_alte 0xa000 /* val 5, shift 13 */ +# define AC_atmode_agt 0xc000 /* val 6, shift 13 */ +# define AC_atmode_agte 0xe000 /* val 7, shift 13 */ +# define AC_atref_MASK 0xff00ffff /* bits 16-23 */ +# define AC_atref_SHIFT 16 +# define AC_alphasel_MASK 0xfcffffff /* bits 24-25 */ +# define AC_alphasel_fromtex 0x0 /* val 0, shift 24 */ +# define AC_alphasel_diffused 0x1000000 /* val 1, shift 24 */ +# define AC_alphasel_modulated 0x2000000 /* val 2, shift 24 */ +# define AC_alphasel_trans 0x3000000 /* val 3, shift 24 */ + +# define AR0_ar0_MASK 0xfffc0000 /* bits 0-17 */ +# define AR0_ar0_SHIFT 0 + +# define AR1_ar1_MASK 0xff000000 /* bits 0-23 */ +# define AR1_ar1_SHIFT 0 + +# define AR2_ar2_MASK 0xfffc0000 /* bits 0-17 */ +# define AR2_ar2_SHIFT 0 + +# define AR3_ar3_MASK 0xff000000 /* bits 0-23 */ +# define AR3_ar3_SHIFT 0 +# define AR3_spage_MASK 0xf8ffffff /* bits 24-26 */ +# define AR3_spage_SHIFT 24 + +# define AR4_ar4_MASK 0xfffc0000 /* bits 0-17 */ +# define AR4_ar4_SHIFT 0 + +# define AR5_ar5_MASK 0xfffc0000 /* bits 0-17 */ +# define AR5_ar5_SHIFT 0 + +# define AR6_ar6_MASK 0xfffc0000 /* bits 0-17 */ +# define AR6_ar6_SHIFT 0 + +# define BC_besen_MASK 0xfffffffe /* bit 0 */ +# define BC_besen_disable 0x0 +# define BC_besen_enable 0x1 +# define BC_besv1srcstp_MASK 0xffffffbf /* bit 6 */ +# define BC_besv1srcstp_even 0x0 +# define BC_besv1srcstp_odd 0x40 +# define BC_besv2srcstp_MASK 0xfffffeff /* bit 8 */ +# define BC_besv2srcstp_disable 0x0 +# define BC_besv2srcstp_enable 0x100 +# define BC_beshfen_MASK 0xfffffbff /* bit 10 */ +# define BC_beshfen_disable 0x0 +# define BC_beshfen_enable 0x400 +# define BC_besvfen_MASK 0xfffff7ff /* bit 11 */ +# define BC_besvfen_disable 0x0 +# define BC_besvfen_enable 0x800 +# define BC_beshfixc_MASK 0xffffefff /* bit 12 */ +# define BC_beshfixc_weight 0x0 +# define BC_beshfixc_coeff 0x1000 +# define BC_bescups_MASK 0xfffeffff /* bit 16 */ +# define BC_bescups_disable 0x0 +# define BC_bescups_enable 0x10000 +# define BC_bes420pl_MASK 0xfffdffff /* bit 17 */ +# define BC_bes420pl_422 0x0 +# define BC_bes420pl_420 0x20000 +# define BC_besdith_MASK 0xfffbffff /* bit 18 */ +# define BC_besdith_disable 0x0 +# define BC_besdith_enable 0x40000 +# define BC_beshmir_MASK 0xfff7ffff /* bit 19 */ +# define BC_beshmir_disable 0x0 +# define BC_beshmir_enable 0x80000 +# define BC_besbwen_MASK 0xffefffff /* bit 20 */ +# define BC_besbwen_color 0x0 +# define BC_besbwen_bw 0x100000 +# define BC_besblank_MASK 0xffdfffff /* bit 21 */ +# define BC_besblank_disable 0x0 +# define BC_besblank_enable 0x200000 +# define BC_besfselm_MASK 0xfeffffff /* bit 24 */ +# define BC_besfselm_soft 0x0 +# define BC_besfselm_hard 0x1000000 +# define BC_besfsel_MASK 0xf9ffffff /* bits 25-26 */ +# define BC_besfsel_a1 0x0 /* val 0, shift 25 */ +# define BC_besfsel_a2 0x2000000 /* val 1, shift 25 */ +# define BC_besfsel_b1 0x4000000 /* val 2, shift 25 */ +# define BC_besfsel_b2 0x6000000 /* val 3, shift 25 */ + +# define BGC_beshzoom_MASK 0xfffffffe /* bit 0 */ +# define BGC_beshzoom_disable 0x0 +# define BGC_beshzoom_enable 0x1 +# define BGC_beshzoomf_MASK 0xfffffffd /* bit 1 */ +# define BGC_beshzoomf_disable 0x0 +# define BGC_beshzoomf_enable 0x2 +# define BGC_bescorder_MASK 0xfffffff7 /* bit 3 */ +# define BGC_bescorder_even 0x0 +# define BGC_bescorder_odd 0x8 +# define BGC_besreghup_MASK 0xffffffef /* bit 4 */ +# define BGC_besreghup_disable 0x0 +# define BGC_besreghup_enable 0x10 +# define BGC_besvcnt_MASK 0xf000ffff /* bits 16-27 */ +# define BGC_besvcnt_SHIFT 16 + +# define BHC_besright_MASK 0xfffff800 /* bits 0-10 */ +# define BHC_besright_SHIFT 0 +# define BHC_besleft_MASK 0xf800ffff /* bits 16-26 */ +# define BHC_besleft_SHIFT 16 + +# define BHISF_beshiscal_MASK 0xffe00003 /* bits 2-20 */ +# define BHISF_beshiscal_SHIFT 2 + +# define BHSE_beshsrcend_MASK 0xfc000003 /* bits 2-25 */ +# define BHSE_beshsrcend_SHIFT 2 + +# define BHSL_beshsrclst_MASK 0xfc00ffff /* bits 16-25 */ +# define BHSL_beshsrclst_SHIFT 16 + +# define BHSS_beshsrcst_MASK 0xfc000003 /* bits 2-25 */ +# define BHSS_beshsrcst_SHIFT 2 + +# define BP_bespitch_MASK 0xfffff000 /* bits 0-11 */ +# define BP_bespitch_SHIFT 0 + +# define BS_besstat_MASK 0xfffffffc /* bits 0-1 */ +# define BS_besstat_a1 0x0 /* val 0, shift 0 */ +# define BS_besstat_a2 0x1 /* val 1, shift 0 */ +# define BS_besstat_b1 0x2 /* val 2, shift 0 */ +# define BS_besstat_b2 0x3 /* val 3, shift 0 */ + +# define BSF_besv1srclast_MASK 0xfffffc00 /* bits 0-9 */ +# define BSF_besv1srclast_SHIFT 0 + +# define BSF_besv2srclst_MASK 0xfffffc00 /* bits 0-9 */ +# define BSF_besv2srclst_SHIFT 0 + +# define BSF_besv1wght_MASK 0xffff0003 /* bits 2-15 */ +# define BSF_besv1wght_SHIFT 2 +# define BSF_besv1wghts_MASK 0xfffeffff /* bit 16 */ +# define BSF_besv1wghts_disable 0x0 +# define BSF_besv1wghts_enable 0x10000 + +# define BSF_besv2wght_MASK 0xffff0003 /* bits 2-15 */ +# define BSF_besv2wght_SHIFT 2 +# define BSF_besv2wghts_MASK 0xfffeffff /* bit 16 */ +# define BSF_besv2wghts_disable 0x0 +# define BSF_besv2wghts_enable 0x10000 + +# define BVC_besbot_MASK 0xfffff800 /* bits 0-10 */ +# define BVC_besbot_SHIFT 0 +# define BVC_bestop_MASK 0xf800ffff /* bits 16-26 */ +# define BVC_bestop_SHIFT 16 + +# define BVISF_besviscal_MASK 0xffe00003 /* bits 2-20 */ +# define BVISF_besviscal_SHIFT 2 + +# define CXB_cxleft_MASK 0xfffff000 /* bits 0-11 */ +# define CXB_cxleft_SHIFT 0 +# define CXB_cxright_MASK 0xf000ffff /* bits 16-27 */ +# define CXB_cxright_SHIFT 16 + +# define DO_dstmap_MASK 0xfffffffe /* bit 0 */ +# define DO_dstmap_fb 0x0 +# define DO_dstmap_sys 0x1 +# define DO_dstacc_MASK 0xfffffffd /* bit 1 */ +# define DO_dstacc_pci 0x0 +# define DO_dstacc_agp 0x2 +# define DO_dstorg_MASK 0x7 /* bits 3-31 */ +# define DO_dstorg_SHIFT 3 + +# define DC_opcod_MASK 0xfffffff0 /* bits 0-3 */ +# define DC_opcod_line_open 0x0 /* val 0, shift 0 */ +# define DC_opcod_autoline_open 0x1 /* val 1, shift 0 */ +# define DC_opcod_line_close 0x2 /* val 2, shift 0 */ +# define DC_opcod_autoline_close 0x3 /* val 3, shift 0 */ +# define DC_opcod_trap 0x4 /* val 4, shift 0 */ +# define DC_opcod_texture_trap 0x6 /* val 6, shift 0 */ +# define DC_opcod_bitblt 0x8 /* val 8, shift 0 */ +# define DC_opcod_iload 0x9 /* val 9, shift 0 */ +# define DC_atype_MASK 0xffffff8f /* bits 4-6 */ +# define DC_atype_rpl 0x0 /* val 0, shift 4 */ +# define DC_atype_rstr 0x10 /* val 1, shift 4 */ +# define DC_atype_zi 0x30 /* val 3, shift 4 */ +# define DC_atype_blk 0x40 /* val 4, shift 4 */ +# define DC_atype_i 0x70 /* val 7, shift 4 */ +# define DC_linear_MASK 0xffffff7f /* bit 7 */ +# define DC_linear_xy 0x0 +# define DC_linear_linear 0x80 +# define DC_zmode_MASK 0xfffff8ff /* bits 8-10 */ +# define DC_zmode_nozcmp 0x0 /* val 0, shift 8 */ +# define DC_zmode_ze 0x200 /* val 2, shift 8 */ +# define DC_zmode_zne 0x300 /* val 3, shift 8 */ +# define DC_zmode_zlt 0x400 /* val 4, shift 8 */ +# define DC_zmode_zlte 0x500 /* val 5, shift 8 */ +# define DC_zmode_zgt 0x600 /* val 6, shift 8 */ +# define DC_zmode_zgte 0x700 /* val 7, shift 8 */ +# define DC_solid_MASK 0xfffff7ff /* bit 11 */ +# define DC_solid_disable 0x0 +# define DC_solid_enable 0x800 +# define DC_arzero_MASK 0xffffefff /* bit 12 */ +# define DC_arzero_disable 0x0 +# define DC_arzero_enable 0x1000 +# define DC_sgnzero_MASK 0xffffdfff /* bit 13 */ +# define DC_sgnzero_disable 0x0 +# define DC_sgnzero_enable 0x2000 +# define DC_shftzero_MASK 0xffffbfff /* bit 14 */ +# define DC_shftzero_disable 0x0 +# define DC_shftzero_enable 0x4000 +# define DC_bop_MASK 0xfff0ffff /* bits 16-19 */ +# define DC_bop_SHIFT 16 +# define DC_trans_MASK 0xff0fffff /* bits 20-23 */ +# define DC_trans_SHIFT 20 +# define DC_bltmod_MASK 0xe1ffffff /* bits 25-28 */ +# define DC_bltmod_bmonolef 0x0 /* val 0, shift 25 */ +# define DC_bltmod_bmonowf 0x8000000 /* val 4, shift 25 */ +# define DC_bltmod_bplan 0x2000000 /* val 1, shift 25 */ +# define DC_bltmod_bfcol 0x4000000 /* val 2, shift 25 */ +# define DC_bltmod_bu32bgr 0x6000000 /* val 3, shift 25 */ +# define DC_bltmod_bu32rgb 0xe000000 /* val 7, shift 25 */ +# define DC_bltmod_bu24bgr 0x16000000 /* val 11, shift 25 */ +# define DC_bltmod_bu24rgb 0x1e000000 /* val 15, shift 25 */ +# define DC_pattern_MASK 0xdfffffff /* bit 29 */ +# define DC_pattern_disable 0x0 +# define DC_pattern_enable 0x20000000 +# define DC_transc_MASK 0xbfffffff /* bit 30 */ +# define DC_transc_disable 0x0 +# define DC_transc_enable 0x40000000 +# define DC_clipdis_MASK 0x7fffffff /* bit 31 */ +# define DC_clipdis_disable 0x0 +# define DC_clipdis_enable 0x80000000 + +# define DS_dwgsyncaddr_MASK 0x3 /* bits 2-31 */ +# define DS_dwgsyncaddr_SHIFT 2 + +# define FS_fifocount_MASK 0xffffff80 /* bits 0-6 */ +# define FS_fifocount_SHIFT 0 +# define FS_bfull_MASK 0xfffffeff /* bit 8 */ +# define FS_bfull_disable 0x0 +# define FS_bfull_enable 0x100 +# define FS_bempty_MASK 0xfffffdff /* bit 9 */ +# define FS_bempty_disable 0x0 +# define FS_bempty_enable 0x200 + +# define XA_fxleft_MASK 0xffff0000 /* bits 0-15 */ +# define XA_fxleft_SHIFT 0 +# define XA_fxright_MASK 0xffff /* bits 16-31 */ +# define XA_fxright_SHIFT 16 + +# define IC_softrapiclr_MASK 0xfffffffe /* bit 0 */ +# define IC_softrapiclr_disable 0x0 +# define IC_softrapiclr_enable 0x1 +# define IC_pickiclr_MASK 0xfffffffb /* bit 2 */ +# define IC_pickiclr_disable 0x0 +# define IC_pickiclr_enable 0x4 +# define IC_vlineiclr_MASK 0xffffffdf /* bit 5 */ +# define IC_vlineiclr_disable 0x0 +# define IC_vlineiclr_enable 0x20 +# define IC_wiclr_MASK 0xffffff7f /* bit 7 */ +# define IC_wiclr_disable 0x0 +# define IC_wiclr_enable 0x80 +# define IC_wciclr_MASK 0xfffffeff /* bit 8 */ +# define IC_wciclr_disable 0x0 +# define IC_wciclr_enable 0x100 + +# define IE_softrapien_MASK 0xfffffffe /* bit 0 */ +# define IE_softrapien_disable 0x0 +# define IE_softrapien_enable 0x1 +# define IE_pickien_MASK 0xfffffffb /* bit 2 */ +# define IE_pickien_disable 0x0 +# define IE_pickien_enable 0x4 +# define IE_vlineien_MASK 0xffffffdf /* bit 5 */ +# define IE_vlineien_disable 0x0 +# define IE_vlineien_enable 0x20 +# define IE_extien_MASK 0xffffffbf /* bit 6 */ +# define IE_extien_disable 0x0 +# define IE_extien_enable 0x40 +# define IE_wien_MASK 0xffffff7f /* bit 7 */ +# define IE_wien_disable 0x0 +# define IE_wien_enable 0x80 +# define IE_wcien_MASK 0xfffffeff /* bit 8 */ +# define IE_wcien_disable 0x0 +# define IE_wcien_enable 0x100 + +# define MA_pwidth_MASK 0xfffffffc /* bits 0-1 */ +# define MA_pwidth_8 0x0 /* val 0, shift 0 */ +# define MA_pwidth_16 0x1 /* val 1, shift 0 */ +# define MA_pwidth_32 0x2 /* val 2, shift 0 */ +# define MA_pwidth_24 0x3 /* val 3, shift 0 */ +# define MA_zwidth_MASK 0xffffffe7 /* bits 3-4 */ +# define MA_zwidth_16 0x0 /* val 0, shift 3 */ +# define MA_zwidth_32 0x8 /* val 1, shift 3 */ +# define MA_zwidth_15 0x10 /* val 2, shift 3 */ +# define MA_zwidth_24 0x18 /* val 3, shift 3 */ +# define MA_memreset_MASK 0xffff7fff /* bit 15 */ +# define MA_memreset_disable 0x0 +# define MA_memreset_enable 0x8000 +# define MA_fogen_MASK 0xfbffffff /* bit 26 */ +# define MA_fogen_disable 0x0 +# define MA_fogen_enable 0x4000000 +# define MA_tlutload_MASK 0xdfffffff /* bit 29 */ +# define MA_tlutload_disable 0x0 +# define MA_tlutload_enable 0x20000000 +# define MA_nodither_MASK 0xbfffffff /* bit 30 */ +# define MA_nodither_disable 0x0 +# define MA_nodither_enable 0x40000000 +# define MA_dit555_MASK 0x7fffffff /* bit 31 */ +# define MA_dit555_disable 0x0 +# define MA_dit555_enable 0x80000000 + +# define MCWS_casltncy_MASK 0xfffffff8 /* bits 0-2 */ +# define MCWS_casltncy_SHIFT 0 +# define MCWS_rrddelay_MASK 0xffffffcf /* bits 4-5 */ +# define MCWS_rcddelay_MASK 0xfffffe7f /* bits 7-8 */ +# define MCWS_rasmin_MASK 0xffffe3ff /* bits 10-12 */ +# define MCWS_rasmin_SHIFT 10 +# define MCWS_rpdelay_MASK 0xffff3fff /* bits 14-15 */ +# define MCWS_wrdelay_MASK 0xfff3ffff /* bits 18-19 */ +# define MCWS_rddelay_MASK 0xffdfffff /* bit 21 */ +# define MCWS_rddelay_disable 0x0 +# define MCWS_rddelay_enable 0x200000 +# define MCWS_smrdelay_MASK 0xfe7fffff /* bits 23-24 */ +# define MCWS_bwcdelay_MASK 0xf3ffffff /* bits 26-27 */ +# define MCWS_bpldelay_MASK 0x1fffffff /* bits 29-31 */ +# define MCWS_bpldelay_SHIFT 29 + +# define MRB_mclkbrd0_MASK 0xfffffff0 /* bits 0-3 */ +# define MRB_mclkbrd0_SHIFT 0 +# define MRB_mclkbrd1_MASK 0xfffffe1f /* bits 5-8 */ +# define MRB_mclkbrd1_SHIFT 5 +# define MRB_strmfctl_MASK 0xff3fffff /* bits 22-23 */ +# define MRB_mrsopcod_MASK 0xe1ffffff /* bits 25-28 */ +# define MRB_mrsopcod_SHIFT 25 + +# define OM_dmamod_MASK 0xfffffff3 /* bits 2-3 */ +# define OM_dmamod_general 0x0 /* val 0, shift 2 */ +# define OM_dmamod_blit 0x4 /* val 1, shift 2 */ +# define OM_dmamod_vector 0x8 /* val 2, shift 2 */ +# define OM_dmamod_vertex 0xc /* val 3, shift 2 */ +# define OM_dmadatasiz_MASK 0xfffffcff /* bits 8-9 */ +# define OM_dmadatasiz_8 0x0 /* val 0, shift 8 */ +# define OM_dmadatasiz_16 0x100 /* val 1, shift 8 */ +# define OM_dmadatasiz_32 0x200 /* val 2, shift 8 */ +# define OM_dirdatasiz_MASK 0xfffcffff /* bits 16-17 */ +# define OM_dirdatasiz_8 0x0 /* val 0, shift 16 */ +# define OM_dirdatasiz_16 0x10000 /* val 1, shift 16 */ +# define OM_dirdatasiz_32 0x20000 /* val 2, shift 16 */ + +# define P_iy_MASK 0xffffe000 /* bits 0-12 */ +# define P_iy_SHIFT 0 +# define P_ylin_MASK 0xffff7fff /* bit 15 */ +# define P_ylin_disable 0x0 +# define P_ylin_enable 0x8000 + +# define PDCA_primod_MASK 0xfffffffc /* bits 0-1 */ +# define PDCA_primod_general 0x0 /* val 0, shift 0 */ +# define PDCA_primod_blit 0x1 /* val 1, shift 0 */ +# define PDCA_primod_vector 0x2 /* val 2, shift 0 */ +# define PDCA_primod_vertex 0x3 /* val 3, shift 0 */ +# define PDCA_primaddress_MASK 0x3 /* bits 2-31 */ +# define PDCA_primaddress_SHIFT 2 + +# define PDEA_primnostart_MASK 0xfffffffe /* bit 0 */ +# define PDEA_primnostart_disable 0x0 +# define PDEA_primnostart_enable 0x1 +# define PDEA_pagpxfer_MASK 0xfffffffd /* bit 1 */ +# define PDEA_pagpxfer_disable 0x0 +# define PDEA_pagpxfer_enable 0x2 +# define PDEA_primend_MASK 0x3 /* bits 2-31 */ +# define PDEA_primend_SHIFT 2 + +# define PLS_primptren0_MASK 0xfffffffe /* bit 0 */ +# define PLS_primptren0_disable 0x0 +# define PLS_primptren0_enable 0x1 +# define PLS_primptren1_MASK 0xfffffffd /* bit 1 */ +# define PLS_primptren1_disable 0x0 +# define PLS_primptren1_enable 0x2 +# define PLS_primptr_MASK 0x7 /* bits 3-31 */ +# define PLS_primptr_SHIFT 3 + +# define R_softreset_MASK 0xfffffffe /* bit 0 */ +# define R_softreset_disable 0x0 +# define R_softreset_enable 0x1 +# define R_softextrst_MASK 0xfffffffd /* bit 1 */ +# define R_softextrst_disable 0x0 +# define R_softextrst_enable 0x2 + +# define SDCA_secmod_MASK 0xfffffffc /* bits 0-1 */ +# define SDCA_secmod_general 0x0 /* val 0, shift 0 */ +# define SDCA_secmod_blit 0x1 /* val 1, shift 0 */ +# define SDCA_secmod_vector 0x2 /* val 2, shift 0 */ +# define SDCA_secmod_vertex 0x3 /* val 3, shift 0 */ +# define SDCA_secaddress_MASK 0x3 /* bits 2-31 */ +# define SDCA_secaddress_SHIFT 2 + +# define SDEA_sagpxfer_MASK 0xfffffffd /* bit 1 */ +# define SDEA_sagpxfer_disable 0x0 +# define SDEA_sagpxfer_enable 0x2 +# define SDEA_secend_MASK 0x3 /* bits 2-31 */ +# define SDEA_secend_SHIFT 2 + +# define SETDCA_setupmod_MASK 0xfffffffc /* bits 0-1 */ +# define SETDCA_setupmod_vertlist 0x0 /* val 0, shift 0 */ +# define SETDCA_setupaddress_MASK 0x3 /* bits 2-31 */ +# define SETDCA_setupaddress_SHIFT 2 + +# define SETDEA_setupagpxfer_MASK 0xfffffffd /* bit 1 */ +# define SETDEA_setupagpxfer_disable 0x0 +# define SETDEA_setupagpxfer_enable 0x2 +# define SETDEA_setupend_MASK 0x3 /* bits 2-31 */ +# define SETDEA_setupend_SHIFT 2 + +# define S_sdydxl_MASK 0xfffffffe /* bit 0 */ +# define S_sdydxl_y 0x0 +# define S_sdydxl_x 0x1 +# define S_scanleft_MASK 0xfffffffe /* bit 0 */ +# define S_scanleft_disable 0x0 +# define S_scanleft_enable 0x1 +# define S_sdxl_MASK 0xfffffffd /* bit 1 */ +# define S_sdxl_pos 0x0 +# define S_sdxl_neg 0x2 +# define S_sdy_MASK 0xfffffffb /* bit 2 */ +# define S_sdy_pos 0x0 +# define S_sdy_neg 0x4 +# define S_sdxr_MASK 0xffffffdf /* bit 5 */ +# define S_sdxr_pos 0x0 +# define S_sdxr_neg 0x20 +# define S_brkleft_MASK 0xfffffeff /* bit 8 */ +# define S_brkleft_disable 0x0 +# define S_brkleft_enable 0x100 +# define S_errorinit_MASK 0x7fffffff /* bit 31 */ +# define S_errorinit_disable 0x0 +# define S_errorinit_enable 0x80000000 + +# define FSC_x_off_MASK 0xfffffff0 /* bits 0-3 */ +# define FSC_x_off_SHIFT 0 +# define FSC_funcnt_MASK 0xffffff80 /* bits 0-6 */ +# define FSC_funcnt_SHIFT 0 +# define FSC_y_off_MASK 0xffffff8f /* bits 4-6 */ +# define FSC_y_off_SHIFT 4 +# define FSC_funoff_MASK 0xffc0ffff /* bits 16-21 */ +# define FSC_funoff_SHIFT 16 +# define FSC_stylelen_MASK 0xffc0ffff /* bits 16-21 */ +# define FSC_stylelen_SHIFT 16 + + +# define STH_softraphand_MASK 0x3 /* bits 2-31 */ +# define STH_softraphand_SHIFT 2 + +# define SO_srcmap_MASK 0xfffffffe /* bit 0 */ +# define SO_srcmap_fb 0x0 +# define SO_srcmap_sys 0x1 +# define SO_srcacc_MASK 0xfffffffd /* bit 1 */ +# define SO_srcacc_pci 0x0 +# define SO_srcacc_agp 0x2 +# define SO_srcorg_MASK 0x7 /* bits 3-31 */ +# define SO_srcorg_SHIFT 3 + +# define STAT_softrapen_MASK 0xfffffffe /* bit 0 */ +# define STAT_softrapen_disable 0x0 +# define STAT_softrapen_enable 0x1 +# define STAT_pickpen_MASK 0xfffffffb /* bit 2 */ +# define STAT_pickpen_disable 0x0 +# define STAT_pickpen_enable 0x4 +# define STAT_vsyncsts_MASK 0xfffffff7 /* bit 3 */ +# define STAT_vsyncsts_disable 0x0 +# define STAT_vsyncsts_enable 0x8 +# define STAT_vsyncpen_MASK 0xffffffef /* bit 4 */ +# define STAT_vsyncpen_disable 0x0 +# define STAT_vsyncpen_enable 0x10 +# define STAT_vlinepen_MASK 0xffffffdf /* bit 5 */ +# define STAT_vlinepen_disable 0x0 +# define STAT_vlinepen_enable 0x20 +# define STAT_extpen_MASK 0xffffffbf /* bit 6 */ +# define STAT_extpen_disable 0x0 +# define STAT_extpen_enable 0x40 +# define STAT_wpen_MASK 0xffffff7f /* bit 7 */ +# define STAT_wpen_disable 0x0 +# define STAT_wpen_enable 0x80 +# define STAT_wcpen_MASK 0xfffffeff /* bit 8 */ +# define STAT_wcpen_disable 0x0 +# define STAT_wcpen_enable 0x100 +# define STAT_dwgengsts_MASK 0xfffeffff /* bit 16 */ +# define STAT_dwgengsts_disable 0x0 +# define STAT_dwgengsts_enable 0x10000 +# define STAT_endprdmasts_MASK 0xfffdffff /* bit 17 */ +# define STAT_endprdmasts_disable 0x0 +# define STAT_endprdmasts_enable 0x20000 +# define STAT_wbusy_MASK 0xfffbffff /* bit 18 */ +# define STAT_wbusy_disable 0x0 +# define STAT_wbusy_enable 0x40000 +# define STAT_swflag_MASK 0xfffffff /* bits 28-31 */ +# define STAT_swflag_SHIFT 28 + +# define S_sref_MASK 0xffffff00 /* bits 0-7 */ +# define S_sref_SHIFT 0 +# define S_smsk_MASK 0xffff00ff /* bits 8-15 */ +# define S_smsk_SHIFT 8 +# define S_swtmsk_MASK 0xff00ffff /* bits 16-23 */ +# define S_swtmsk_SHIFT 16 + +# define SC_smode_MASK 0xfffffff8 /* bits 0-2 */ +# define SC_smode_salways 0x0 /* val 0, shift 0 */ +# define SC_smode_snever 0x1 /* val 1, shift 0 */ +# define SC_smode_se 0x2 /* val 2, shift 0 */ +# define SC_smode_sne 0x3 /* val 3, shift 0 */ +# define SC_smode_slt 0x4 /* val 4, shift 0 */ +# define SC_smode_slte 0x5 /* val 5, shift 0 */ +# define SC_smode_sgt 0x6 /* val 6, shift 0 */ +# define SC_smode_sgte 0x7 /* val 7, shift 0 */ +# define SC_sfailop_MASK 0xffffffc7 /* bits 3-5 */ +# define SC_sfailop_keep 0x0 /* val 0, shift 3 */ +# define SC_sfailop_zero 0x8 /* val 1, shift 3 */ +# define SC_sfailop_replace 0x10 /* val 2, shift 3 */ +# define SC_sfailop_incrsat 0x18 /* val 3, shift 3 */ +# define SC_sfailop_decrsat 0x20 /* val 4, shift 3 */ +# define SC_sfailop_invert 0x28 /* val 5, shift 3 */ +# define SC_sfailop_incr 0x30 /* val 6, shift 3 */ +# define SC_sfailop_decr 0x38 /* val 7, shift 3 */ +# define SC_szfailop_MASK 0xfffffe3f /* bits 6-8 */ +# define SC_szfailop_keep 0x0 /* val 0, shift 6 */ +# define SC_szfailop_zero 0x40 /* val 1, shift 6 */ +# define SC_szfailop_replace 0x80 /* val 2, shift 6 */ +# define SC_szfailop_incrsat 0xc0 /* val 3, shift 6 */ +# define SC_szfailop_decrsat 0x100 /* val 4, shift 6 */ +# define SC_szfailop_invert 0x140 /* val 5, shift 6 */ +# define SC_szfailop_incr 0x180 /* val 6, shift 6 */ +# define SC_szfailop_decr 0x1c0 /* val 7, shift 6 */ +# define SC_szpassop_MASK 0xfffff1ff /* bits 9-11 */ +# define SC_szpassop_keep 0x0 /* val 0, shift 9 */ +# define SC_szpassop_zero 0x200 /* val 1, shift 9 */ +# define SC_szpassop_replace 0x400 /* val 2, shift 9 */ +# define SC_szpassop_incrsat 0x600 /* val 3, shift 9 */ +# define SC_szpassop_decrsat 0x800 /* val 4, shift 9 */ +# define SC_szpassop_invert 0xa00 /* val 5, shift 9 */ +# define SC_szpassop_incr 0xc00 /* val 6, shift 9 */ +# define SC_szpassop_decr 0xe00 /* val 7, shift 9 */ + +# define TD1_color1arg2selMASK 0xfffffffc /* bits 0-1 */ +# define TD1_color1alphaselMASK 0xffffffe3 /* bits 2-4 */ +# define TD1_color1alphaselSHIFT 2 +# define TD1_color1arg1alphaMASK 0xffffffdf /* bit 5 */ +# define TD1_color1arg1alphadisable 0x0 +# define TD1_color1arg1alphaenable 0x20 +# define TD1_color1arg1invMASK 0xffffffbf /* bit 6 */ +# define TD1_color1arg1invdisable 0x0 +# define TD1_color1arg1invenable 0x40 +# define TD1_color1arg2alphaMASK 0xffffff7f /* bit 7 */ +# define TD1_color1arg2alphadisable 0x0 +# define TD1_color1arg2alphaenable 0x80 +# define TD1_color1arg2invMASK 0xfffffeff /* bit 8 */ +# define TD1_color1arg2invdisable 0x0 +# define TD1_color1arg2invenable 0x100 +# define TD1_color1alpha1invMASK 0xfffffdff /* bit 9 */ +# define TD1_color1alpha1invdisable 0x0 +# define TD1_color1alpha1invenable 0x200 +# define TD1_color1alpha2invMASK 0xfffffbff /* bit 10 */ +# define TD1_color1alpha2invdisable 0x0 +# define TD1_color1alpha2invenable 0x400 +# define TD1_color1selMASK 0xff9fffff /* bits 21-22 */ +# define TD1_color1selarg1 0x0 /* val 0, shift 21 */ +# define TD1_color1selarg2 0x200000 /* val 1, shift 21 */ +# define TD1_color1seladd 0x400000 /* val 2, shift 21 */ +# define TD1_color1selmul 0x600000 /* val 3, shift 21 */ +# define TD1_alpha1selMASK 0x3fffffff /* bits 30-31 */ +# define TD1_alpha1selarg1 0x0 /* val 0, shift 30 */ +# define TD1_alpha1selarg2 0x40000000 /* val 1, shift 30 */ +# define TD1_alpha1seladd 0x80000000 /* val 2, shift 30 */ +# define TD1_alpha1selmul 0xc0000000 /* val 3, shift 30 */ + +# define TST_ramtsten_MASK 0xfffffffe /* bit 0 */ +# define TST_ramtsten_disable 0x0 +# define TST_ramtsten_enable 0x1 +# define TST_ramtstdone_MASK 0xfffffffd /* bit 1 */ +# define TST_ramtstdone_disable 0x0 +# define TST_ramtstdone_enable 0x2 +# define TST_wramtstpass_MASK 0xfffffffb /* bit 2 */ +# define TST_wramtstpass_disable 0x0 +# define TST_wramtstpass_enable 0x4 +# define TST_tcachetstpass_MASK 0xfffffff7 /* bit 3 */ +# define TST_tcachetstpass_disable 0x0 +# define TST_tcachetstpass_enable 0x8 +# define TST_tluttstpass_MASK 0xffffffef /* bit 4 */ +# define TST_tluttstpass_disable 0x0 +# define TST_tluttstpass_enable 0x10 +# define TST_luttstpass_MASK 0xffffffdf /* bit 5 */ +# define TST_luttstpass_disable 0x0 +# define TST_luttstpass_enable 0x20 +# define TST_besramtstpass_MASK 0xffffffbf /* bit 6 */ +# define TST_besramtstpass_disable 0x0 +# define TST_besramtstpass_enable 0x40 +# define TST_ringen_MASK 0xfffffeff /* bit 8 */ +# define TST_ringen_disable 0x0 +# define TST_ringen_enable 0x100 +# define TST_apllbyp_MASK 0xfffffdff /* bit 9 */ +# define TST_apllbyp_disable 0x0 +# define TST_apllbyp_enable 0x200 +# define TST_hiten_MASK 0xfffffbff /* bit 10 */ +# define TST_hiten_disable 0x0 +# define TST_hiten_enable 0x400 +# define TST_tmode_MASK 0xffffc7ff /* bits 11-13 */ +# define TST_tmode_SHIFT 11 +# define TST_tclksel_MASK 0xfffe3fff /* bits 14-16 */ +# define TST_tclksel_SHIFT 14 +# define TST_ringcnten_MASK 0xfffdffff /* bit 17 */ +# define TST_ringcnten_disable 0x0 +# define TST_ringcnten_enable 0x20000 +# define TST_ringcnt_MASK 0xc003ffff /* bits 18-29 */ +# define TST_ringcnt_SHIFT 18 +# define TST_ringcntclksl_MASK 0xbfffffff /* bit 30 */ +# define TST_ringcntclksl_disable 0x0 +# define TST_ringcntclksl_enable 0x40000000 +# define TST_biosboot_MASK 0x7fffffff /* bit 31 */ +# define TST_biosboot_disable 0x0 +# define TST_biosboot_enable 0x80000000 + +# define TMC_tformat_MASK 0xfffffff0 /* bits 0-3 */ +# define TMC_tformat_tw4 0x0 /* val 0, shift 0 */ +# define TMC_tformat_tw8 0x1 /* val 1, shift 0 */ +# define TMC_tformat_tw15 0x2 /* val 2, shift 0 */ +# define TMC_tformat_tw16 0x3 /* val 3, shift 0 */ +# define TMC_tformat_tw12 0x4 /* val 4, shift 0 */ +# define TMC_tformat_tw32 0x6 /* val 6, shift 0 */ +# define TMC_tformat_tw422 0xa /* val 10, shift 0 */ +# define TMC_tpitchlin_MASK 0xfffffeff /* bit 8 */ +# define TMC_tpitchlin_disable 0x0 +# define TMC_tpitchlin_enable 0x100 +# define TMC_tpitchext_MASK 0xfff001ff /* bits 9-19 */ +# define TMC_tpitchext_SHIFT 9 +# define TMC_tpitch_MASK 0xfff8ffff /* bits 16-18 */ +# define TMC_tpitch_SHIFT 16 +# define TMC_owalpha_MASK 0xffbfffff /* bit 22 */ +# define TMC_owalpha_disable 0x0 +# define TMC_owalpha_enable 0x400000 +# define TMC_azeroextend_MASK 0xff7fffff /* bit 23 */ +# define TMC_azeroextend_disable 0x0 +# define TMC_azeroextend_enable 0x800000 +# define TMC_decalckey_MASK 0xfeffffff /* bit 24 */ +# define TMC_decalckey_disable 0x0 +# define TMC_decalckey_enable 0x1000000 +# define TMC_takey_MASK 0xfdffffff /* bit 25 */ +# define TMC_takey_0 0x0 +# define TMC_takey_1 0x2000000 +# define TMC_tamask_MASK 0xfbffffff /* bit 26 */ +# define TMC_tamask_0 0x0 +# define TMC_tamask_1 0x4000000 +# define TMC_clampv_MASK 0xf7ffffff /* bit 27 */ +# define TMC_clampv_disable 0x0 +# define TMC_clampv_enable 0x8000000 +# define TMC_clampu_MASK 0xefffffff /* bit 28 */ +# define TMC_clampu_disable 0x0 +# define TMC_clampu_enable 0x10000000 +# define TMC_tmodulate_MASK 0xdfffffff /* bit 29 */ +# define TMC_tmodulate_disable 0x0 +# define TMC_tmodulate_enable 0x20000000 +# define TMC_strans_MASK 0xbfffffff /* bit 30 */ +# define TMC_strans_disable 0x0 +# define TMC_strans_enable 0x40000000 +# define TMC_itrans_MASK 0x7fffffff /* bit 31 */ +# define TMC_itrans_disable 0x0 +# define TMC_itrans_enable 0x80000000 + +# define TMC_decalblend_MASK 0xfffffffe /* bit 0 */ +# define TMC_decalblend_disable 0x0 +# define TMC_decalblend_enable 0x1 +# define TMC_idecal_MASK 0xfffffffd /* bit 1 */ +# define TMC_idecal_disable 0x0 +# define TMC_idecal_enable 0x2 +# define TMC_decaldis_MASK 0xfffffffb /* bit 2 */ +# define TMC_decaldis_disable 0x0 +# define TMC_decaldis_enable 0x4 +# define TMC_ckstransdis_MASK 0xffffffef /* bit 4 */ +# define TMC_ckstransdis_disable 0x0 +# define TMC_ckstransdis_enable 0x10 +# define TMC_borderen_MASK 0xffffffdf /* bit 5 */ +# define TMC_borderen_disable 0x0 +# define TMC_borderen_enable 0x20 +# define TMC_specen_MASK 0xffffffbf /* bit 6 */ +# define TMC_specen_disable 0x0 +# define TMC_specen_enable 0x40 + +# define TF_minfilter_MASK 0xfffffff0 /* bits 0-3 */ +# define TF_minfilter_nrst 0x0 /* val 0, shift 0 */ +# define TF_minfilter_bilin 0x2 /* val 2, shift 0 */ +# define TF_minfilter_cnst 0x3 /* val 3, shift 0 */ +# define TF_minfilter_mm1s 0x8 /* val 8, shift 0 */ +# define TF_minfilter_mm2s 0x9 /* val 9, shift 0 */ +# define TF_minfilter_mm4s 0xa /* val 10, shift 0 */ +# define TF_minfilter_mm8s 0xc /* val 12, shift 0 */ +# define TF_magfilter_MASK 0xffffff0f /* bits 4-7 */ +# define TF_magfilter_nrst 0x0 /* val 0, shift 4 */ +# define TF_magfilter_bilin 0x20 /* val 2, shift 4 */ +# define TF_magfilter_cnst 0x30 /* val 3, shift 4 */ +# define TF_avgstride_MASK 0xfff7ffff /* bit 19 */ +# define TF_avgstride_disable 0x0 +# define TF_avgstride_enable 0x80000 +# define TF_filteralpha_MASK 0xffefffff /* bit 20 */ +# define TF_filteralpha_disable 0x0 +# define TF_filteralpha_enable 0x100000 +# define TF_fthres_MASK 0xe01fffff /* bits 21-28 */ +# define TF_fthres_SHIFT 21 +# define TF_mapnb_MASK 0x1fffffff /* bits 29-31 */ +# define TF_mapnb_SHIFT 29 + +# define TH_th_MASK 0xffffffc0 /* bits 0-5 */ +# define TH_th_SHIFT 0 +# define TH_rfh_MASK 0xffff81ff /* bits 9-14 */ +# define TH_rfh_SHIFT 9 +# define TH_thmask_MASK 0xe003ffff /* bits 18-28 */ +# define TH_thmask_SHIFT 18 + +# define TO_texorgmap_MASK 0xfffffffe /* bit 0 */ +# define TO_texorgmap_fb 0x0 +# define TO_texorgmap_sys 0x1 +# define TO_texorgacc_MASK 0xfffffffd /* bit 1 */ +# define TO_texorgacc_pci 0x0 +# define TO_texorgacc_agp 0x2 +# define TO_texorg_MASK 0x1f /* bits 5-31 */ +# define TO_texorg_SHIFT 5 + +# define TT_tckey_MASK 0xffff0000 /* bits 0-15 */ +# define TT_tckey_SHIFT 0 +# define TT_tkmask_MASK 0xffff /* bits 16-31 */ +# define TT_tkmask_SHIFT 16 + +# define TT_tckeyh_MASK 0xffff0000 /* bits 0-15 */ +# define TT_tckeyh_SHIFT 0 +# define TT_tkmaskh_MASK 0xffff /* bits 16-31 */ +# define TT_tkmaskh_SHIFT 16 + +# define TW_tw_MASK 0xffffffc0 /* bits 0-5 */ +# define TW_tw_SHIFT 0 +# define TW_rfw_MASK 0xffff81ff /* bits 9-14 */ +# define TW_rfw_SHIFT 9 +# define TW_twmask_MASK 0xe003ffff /* bits 18-28 */ +# define TW_twmask_SHIFT 18 + +# define WAS_seqdst0_MASK 0xffffffc0 /* bits 0-5 */ +# define WAS_seqdst0_SHIFT 0 +# define WAS_seqdst1_MASK 0xfffff03f /* bits 6-11 */ +# define WAS_seqdst1_SHIFT 6 +# define WAS_seqdst2_MASK 0xfffc0fff /* bits 12-17 */ +# define WAS_seqdst2_SHIFT 12 +# define WAS_seqdst3_MASK 0xff03ffff /* bits 18-23 */ +# define WAS_seqdst3_SHIFT 18 +# define WAS_seqlen_MASK 0xfcffffff /* bits 24-25 */ +# define WAS_wfirsttag_MASK 0xfbffffff /* bit 26 */ +# define WAS_wfirsttag_disable 0x0 +# define WAS_wfirsttag_enable 0x4000000 +# define WAS_wsametag_MASK 0xf7ffffff /* bit 27 */ +# define WAS_wsametag_disable 0x0 +# define WAS_wsametag_enable 0x8000000 +# define WAS_seqoff_MASK 0xefffffff /* bit 28 */ +# define WAS_seqoff_disable 0x0 +# define WAS_seqoff_enable 0x10000000 + +# define WMA_wcodeaddr_MASK 0xff /* bits 8-31 */ +# define WMA_wcodeaddr_SHIFT 8 + +# define WF_walustsflag_MASK 0xffffff00 /* bits 0-7 */ +# define WF_walustsflag_SHIFT 0 +# define WF_walucfgflag_MASK 0xffff00ff /* bits 8-15 */ +# define WF_walucfgflag_SHIFT 8 +# define WF_wprgflag_MASK 0xffff /* bits 16-31 */ +# define WF_wprgflag_SHIFT 16 + +# define WF1_walustsflag1_MASK 0xffffff00 /* bits 0-7 */ +# define WF1_walustsflag1_SHIFT 0 +# define WF1_walucfgflag1_MASK 0xffff00ff /* bits 8-15 */ +# define WF1_walucfgflag1_SHIFT 8 +# define WF1_wprgflag1_MASK 0xffff /* bits 16-31 */ +# define WF1_wprgflag1_SHIFT 16 + +# define WGV_wgetmsbmin_MASK 0xffffffe0 /* bits 0-4 */ +# define WGV_wgetmsbmin_SHIFT 0 +# define WGV_wgetmsbmax_MASK 0xffffe0ff /* bits 8-12 */ +# define WGV_wgetmsbmax_SHIFT 8 +# define WGV_wbrklefttop_MASK 0xfffeffff /* bit 16 */ +# define WGV_wbrklefttop_disable 0x0 +# define WGV_wbrklefttop_enable 0x10000 +# define WGV_wfastcrop_MASK 0xfffdffff /* bit 17 */ +# define WGV_wfastcrop_disable 0x0 +# define WGV_wfastcrop_enable 0x20000 +# define WGV_wcentersnap_MASK 0xfffbffff /* bit 18 */ +# define WGV_wcentersnap_disable 0x0 +# define WGV_wcentersnap_enable 0x40000 +# define WGV_wbrkrighttop_MASK 0xfff7ffff /* bit 19 */ +# define WGV_wbrkrighttop_disable 0x0 +# define WGV_wbrkrighttop_enable 0x80000 + +# define WIA_wmode_MASK 0xfffffffc /* bits 0-1 */ +# define WIA_wmode_suspend 0x0 /* val 0, shift 0 */ +# define WIA_wmode_resume 0x1 /* val 1, shift 0 */ +# define WIA_wmode_jump 0x2 /* val 2, shift 0 */ +# define WIA_wmode_start 0x3 /* val 3, shift 0 */ +# define WIA_wagp_MASK 0xfffffffb /* bit 2 */ +# define WIA_wagp_pci 0x0 +# define WIA_wagp_agp 0x4 +# define WIA_wiaddr_MASK 0x7 /* bits 3-31 */ +# define WIA_wiaddr_SHIFT 3 + +# define WIA2_wmode_MASK 0xfffffffc /* bits 0-1 */ +# define WIA2_wmode_suspend 0x0 /* val 0, shift 0 */ +# define WIA2_wmode_resume 0x1 /* val 1, shift 0 */ +# define WIA2_wmode_jump 0x2 /* val 2, shift 0 */ +# define WIA2_wmode_start 0x3 /* val 3, shift 0 */ +# define WIA2_wagp_MASK 0xfffffffb /* bit 2 */ +# define WIA2_wagp_pci 0x0 +# define WIA2_wagp_agp 0x4 +# define WIA2_wiaddr_MASK 0x7 /* bits 3-31 */ +# define WIA2_wiaddr_SHIFT 3 + +# define WIMA_wimemaddr_MASK 0xffffff00 /* bits 0-7 */ +# define WIMA_wimemaddr_SHIFT 0 + +# define WM_wucodecache_MASK 0xfffffffe /* bit 0 */ +# define WM_wucodecache_disable 0x0 +# define WM_wucodecache_enable 0x1 +# define WM_wmaster_MASK 0xfffffffd /* bit 1 */ +# define WM_wmaster_disable 0x0 +# define WM_wmaster_enable 0x2 +# define WM_wcacheflush_MASK 0xfffffff7 /* bit 3 */ +# define WM_wcacheflush_disable 0x0 +# define WM_wcacheflush_enable 0x8 + +# define WVS_wvrtxsz_MASK 0xffffffc0 /* bits 0-5 */ +# define WVS_wvrtxsz_SHIFT 0 +# define WVS_primsz_MASK 0xffffc0ff /* bits 8-13 */ +# define WVS_primsz_SHIFT 8 + +# define XYEA_x_end_MASK 0xffff0000 /* bits 0-15 */ +# define XYEA_x_end_SHIFT 0 +# define XYEA_y_end_MASK 0xffff /* bits 16-31 */ +# define XYEA_y_end_SHIFT 16 + +# define XYSA_x_start_MASK 0xffff0000 /* bits 0-15 */ +# define XYSA_x_start_SHIFT 0 +# define XYSA_y_start_MASK 0xffff /* bits 16-31 */ +# define XYSA_y_start_SHIFT 16 + +# define YA_ydst_MASK 0xff800000 /* bits 0-22 */ +# define YA_ydst_SHIFT 0 +# define YA_sellin_MASK 0x1fffffff /* bits 29-31 */ +# define YA_sellin_SHIFT 29 + +# define YDL_length_MASK 0xffff0000 /* bits 0-15 */ +# define YDL_length_SHIFT 0 +# define YDL_yval_MASK 0xffff /* bits 16-31 */ +# define YDL_yval_SHIFT 16 + +# define ZO_zorgmap_MASK 0xfffffffe /* bit 0 */ +# define ZO_zorgmap_fb 0x0 +# define ZO_zorgmap_sys 0x1 +# define ZO_zorgacc_MASK 0xfffffffd /* bit 1 */ +# define ZO_zorgacc_pci 0x0 +# define ZO_zorgacc_agp 0x2 +# define ZO_zorg_MASK 0x3 /* bits 2-31 */ +# define ZO_zorg_SHIFT 2 Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile:1.11 xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile:1.11 Tue Jan 23 19:06:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile Mon Feb 17 12:06:43 2003 @@ -1,13 +1,13 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile,v 1.11 2001/01/24 00:06:21 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile,v 1.13 2003/02/17 17:06:43 dawes Exp $ #define IHaveModules #include <Server.tmpl> SRCS = neo_driver.c neo_bank.c neo_cursor.c neo_2097.c neo_2070.c \ - neo_2090.c neo_2200.c neo_i2c.c neo_shadow.c neo_dga.c + neo_2090.c neo_2200.c neo_i2c.c neo_shadow.c neo_dga.c neo_video.c OBJS = neo_driver.o neo_bank.o neo_cursor.o neo_2097.o neo_2070.o \ - neo_2090.o neo_2200.o neo_i2c.o neo_shadow.o neo_dga.o + neo_2090.o neo_2200.o neo_i2c.o neo_shadow.o neo_dga.o neo_video.o DEFINES = -DPSZ=8 @@ -22,7 +22,7 @@ -I$(XF86SRC)/ramdac -I$(XF86SRC)/rac -I$(XF86SRC)/ddc \ -I$(XF86SRC)/i2c -I$(XF86SRC)/shadowfb -I$(XF86SRC)/xf24_32bpp \ -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \ - -I$(XF86SRC)/int10 -I$(XF86OSSRC)/vbe -I$(SERVERSRC)/render + -I$(XF86SRC)/int10 -I$(XF86SRC)/vbe -I$(SERVERSRC)/render #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/NM-reg.txt diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/neomagic/NM-reg.txt:1.1 --- /dev/null Thu Feb 27 12:31:06 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/NM-reg.txt Thu Apr 4 09:05:44 2002 @@ -0,0 +1,69 @@ +NM2160 Register GUESS + --- Overlay and ZV capture --- + +2002,2.3. + +1. Overlay + GRB0 bit5 Format; 0:YUY2/1:RGB + bit1 1 + bit0 Enable overlay ; 1:enable/0:disable + GRB1 bit7:4 X2[11:8] + bit3:0 X1[11:8] + GRB2 X1[7:0] + GRB3 X2[7:0] + GRB4 bit7:4 Y2[11:8] + bit3:0 Y1[11:8] + GRB5 Y1[7:0] + GRB6 Y2[7:0] + GRB7 VRAM offset[24:17] + GRB8 VRAM offset[16:9] + GRB9 VRAM offset[8:1] + GRBA Width in byte[15:8] + GRBB Width in byte[7:0] + GRBC 0x4f + GRBD - + GRBE - + GRBF bit2 0:normal/1:mirror + bit1:0 b'10' + GRC0 X scale[15:8] ; x1.0 == 0x1000 + GRC1 X scale[7:0] + GRC2 Y scale[15:8] ; x1.0 == 0x1000 + GRC3 Y scale[7:0] + GRC4 brightness ; -128 to +127 + GRC5 Color key(R) + GRC6 Color key(G) / Color key(8bpp) + GRC7 Color key(B) + +2. ZV capture + GR0A bit5 Enable extended SR reg. ; 1:enable/0:disable + bit0 1 + + SR08 bit7:1 b'1010000' + bit0 Enable capture ; 1:enable/0:disable + SR09 0x11 + SR0A 0x00 + SR0B - + SR0C VRAM offset[8:1] + SR0D VRAM offset[16:9] + SR0E VRAM offset[24:17] + SR0F - + SR10 - + SR11 - + SR12 - + SR13 - + SR14 Y1[7:0] + SR15 Y2[7:0] + SR16 bit7:4 Y2[11:4] + bit3:0 Y1[11:4] + SR17 X1[7:0] + SR18 X2[7:0] + SR19 bit7:4 X2[11:8] + bit3:0 X1[11:8] + SR1A Width in byte[7:0] + SR1B Width in byte[15:8] + SR1C 0xfb + SR1D 0x00 + SR1E 0xe2 + SR1F 0x02 + +s.nomura@mba.nifty.ne.jp Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/README diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/README:1.1 xc/programs/Xserver/hw/xfree86/drivers/neomagic/README:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/README:1.1 Sat Apr 17 03:06:15 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/README Wed Oct 30 07:52:20 2002 @@ -134,7 +134,7 @@ The original version of the driver - written for Xfree86 3.3 - done by: - Jens Owen (jens@precisioninsight.com) + Jens Owen (jens@tungstengraphics.com) Kevin E. Martin (kevin@precisioninsight.com) Precision Insight, Inc. @@ -147,4 +147,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/README,v 1.1 1999/04/17 07:06:15 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/README,v 1.2 2002/10/30 12:52:20 alanh Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h:1.19 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h:1.19 Mon Oct 1 09:44:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h Wed Oct 30 07:52:21 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.19 2001/10/01 13:44:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.23 2002/10/30 12:52:21 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -60,6 +60,11 @@ #include "xf86i2c.h" +#ifdef XvExtension +# include "xf86xv.h" +# include "Xv.h" +#endif /* XvExtension */ + /* * Driver data structures. */ @@ -121,6 +126,10 @@ /* in neo_dga.c */ Bool NEODGAInit(ScreenPtr pScreen); +/* in neo_video.c */ +extern void NEOInitVideo(ScreenPtr pScreen); +extern void NEOResetVideo(ScrnInfoPtr pScrn); + /* shadow regs */ #define NEO_EXT_CR_MAX 0x85 @@ -154,6 +163,7 @@ unsigned char PanelHorizCenterReg3; unsigned char PanelHorizCenterReg4; unsigned char PanelHorizCenterReg5; + unsigned char Sequencer1; Bool ProgramVCLK; unsigned char VCLK3NumeratorLow; unsigned char VCLK3NumeratorHigh; @@ -199,6 +209,8 @@ unsigned long NeoMMIOAddr; unsigned long NeoLinearAddr; unsigned char* NeoMMIOBase; + unsigned long NeoMMIOAddr2; + unsigned char* NeoMMIOBase2; unsigned char* NeoFbBase; long NeoFbMapSize; unsigned long vgaIOBase; @@ -224,6 +236,7 @@ OptionInfoPtr Options; Bool noLinear; Bool noAccel; + Bool noAccelSet; Bool swCursor; Bool noMMIO; Bool internDisp; @@ -249,6 +262,17 @@ RefreshAreaFuncPtr refreshArea; void (*PointerMoved)(int index, int x, int y); int rotate; + Bool showcache; +#ifdef XvExtension + Bool video; + double videoHZoom; + double videoVZoom; + XF86VideoAdaptorPtr overlayAdaptor; + int overlay; + int overlay_offset; + int videoKey; + int interlace; +#endif /* XvExtension */ } NEORec, *NEOPtr; typedef struct { @@ -264,18 +288,20 @@ #define GRAX 0x3CE /* vga IO functions */ -#define VGArCR(index) hwp->readCrtc(hwp,index) -#define VGAwCR(index,val) hwp->writeCrtc(hwp,index,val) -#define VGArGR(index) hwp->readGr(hwp,index) -#define VGAwGR(index,val) hwp->writeGr(hwp,index,val) +#define VGArCR(index) (*hwp->readCrtc)(hwp, index) +#define VGAwCR(index, val) (*hwp->writeCrtc)(hwp, index, val) +#define VGArGR(index) (*hwp->readGr)(hwp, index) +#define VGAwGR(index, val) (*hwp->writeGr)(hwp, index, val) +#define VGArSR(index) (*hwp->readSeq)(hwp, index) +#define VGAwSR(index, val) (*hwp->writeSeq)(hwp, index, val) /* memory mapped register access macros */ -#define INREG8(addr) MMIO_IN8(nPtr->NeoMMIOBase, (addr)) -#define INREG16(addr) MMIO_IN16(nPtr->NeoMMIOBase, (addr)) -#define INREG(addr) MMIO_IN32(nPtr->NeoMMIOBase, (addr)) -#define OUTREG8(addr, val) MMIO_OUT8(nPtr->NeoMMIOBase, (addr), (val)) -#define OUTREG16(addr, val) MMIO_OUT16(nPtr->NeoMMIOBase, (addr), (val)) -#define OUTREG(addr, val) MMIO_OUT32(nPtr->NeoMMIOBase, (addr), (val)) +#define INREG8(addr) MMIO_IN8(nPtr->NeoMMIOBase, addr) +#define INREG16(addr) MMIO_IN16(nPtr->NeoMMIOBase, addr) +#define INREG(addr) MMIO_IN32(nPtr->NeoMMIOBase, addr) +#define OUTREG8(addr, val) MMIO_OUT8(nPtr->NeoMMIOBase, addr, val) +#define OUTREG16(addr, val) MMIO_OUT16(nPtr->NeoMMIOBase, addr, val) +#define OUTREG(addr, val) MMIO_OUT32(nPtr->NeoMMIOBase, addr, val) /* This swizzle macro is to support the manipulation of cursor masks when * the sprite moves off the left edge of the display. This code is Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c:1.3 Mon Sep 25 19:57:08 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c Wed Oct 30 07:52:21 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c,v 1.3 2000/09/25 23:57:08 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c,v 1.5 2002/10/30 12:52:21 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -104,8 +104,6 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NEOPtr nPtr = NEOPTR(pScrn); NEOACLPtr nAcl = NEOACLPTR(pScrn); - BoxRec AvailFBArea; - int lines; nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -158,23 +156,7 @@ default: return FALSE; } - - /* Initialize for widths */ - nAcl->Pitch = pScrn->displayWidth * nAcl->PixelWidth; - lines = nAcl->cacheEnd / - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); - if(lines > 1024) lines = 1024; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = lines; - xf86InitFBManager(pScreen, &AvailFBArea); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %i scanlines of offscreen memory for pixmap caching\n", - lines - pScrn->virtualY); - + return(XAAInit(pScreen, infoPtr)); } Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c:1.5 Mon Oct 1 09:44:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c Wed Oct 30 07:52:21 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c,v 1.5 2001/10/01 13:44:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c,v 1.7 2002/10/30 12:52:21 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -101,8 +101,6 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NEOPtr nPtr = NEOPTR(pScrn); NEOACLPtr nAcl = NEOACLPTR(pScrn); - BoxRec AvailFBArea; - int lines; nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -196,20 +194,6 @@ } nAcl->BltCntlFlags |= NEO_BC3_FIFO_EN; - - lines = nAcl->cacheEnd / - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); - if(lines > 1024) lines = 1024; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = lines; - xf86InitFBManager(pScreen, &AvailFBArea); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %i scanlines of offscreen memory for pixmap caching\n", - lines - pScrn->virtualY); return(XAAInit(pScreen, infoPtr)); } Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c:1.8 Mon Oct 1 09:44:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c Tue Dec 10 12:36:29 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c,v 1.8 2001/10/01 13:44:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c,v 1.12 2002/12/10 17:36:29 dawes Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -77,6 +77,7 @@ int w, int h, int skipleft); static void Neo2097SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#if 0 static void Neo2097SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -87,6 +88,7 @@ int patterny, int x, int y, int w, int h); +#endif static void Neo2097SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); @@ -123,8 +125,6 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NEOPtr nPtr = NEOPTR(pScrn); NEOACLPtr nAcl = NEOACLPTR(pScrn); - int lines; - BoxRec AvailFBArea; nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -192,7 +192,7 @@ Neo2097SubsequentMono8x8PatternFill; #endif - if (nPtr->strangeLockups) { + if (!nPtr->strangeLockups) { /* image writes */ infoPtr->ScanlineImageWriteFlags = ( CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | @@ -245,21 +245,7 @@ default: return FALSE; } - - lines = nAcl->cacheEnd / - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); - if(lines > 1024) lines = 1024; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = lines; - xf86InitFBManager(pScreen, &AvailFBArea); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %i scanlines of offscreen memory for pixmap caching\n", - lines - pScrn->virtualY); - + return(XAAInit(pScreen, infoPtr)); } @@ -454,6 +440,7 @@ #endif } +#if 0 static void Neo2097SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, @@ -513,7 +500,7 @@ OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); } - +#endif static void Neo2097SetupForScanlineImageWrite( @@ -555,5 +542,3 @@ ){ /* should I be checking for fifo slots here ? */ } - - Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.15 Sat Oct 27 23:33:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Sat Jan 11 22:55:48 2003 @@ -22,13 +22,13 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.15 2001/10/28 03:33:42 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.20 2003/01/12 03:55:48 tsi Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -78,6 +78,7 @@ int w, int h, int skipleft); static void Neo2200SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#if 0 static void Neo2200SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -90,7 +91,7 @@ int patterny, int x, int y, int w, int h); - +#endif static unsigned int neo2200Rop[16] = { @@ -120,8 +121,6 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NEOPtr nPtr = NEOPTR(pScrn); NEOACLPtr nAcl = NEOACLPTR(pScrn); - BoxRec AvailFBArea; - int lines; nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -213,7 +212,9 @@ nAcl->PixelWidth = 2; break; case 24: - if (nPtr->NeoChipset == NM2360) { + if (nPtr->noAccelSet || nPtr->NeoChipset == NM2230 + || nPtr->NeoChipset == NM2360 + || nPtr->NeoChipset == NM2380) { nAcl->BltModeFlags = NEO_MODE1_DEPTH24; nAcl->PixelWidth = 3; } else @@ -251,19 +252,6 @@ return FALSE; } - lines = nAcl->cacheEnd / - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); - if(lines > 1024) lines = 1024; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = lines; - xf86InitFBManager(pScreen, &AvailFBArea); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %i scanlines of offscreen memory for pixmap caching\n", - lines - pScrn->virtualY); return(XAAInit(pScreen, infoPtr)); } @@ -482,7 +470,7 @@ NEOPtr nPtr = NEOPTR(pScrn); WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); + OUTREG(NEOREG_DSTSTARTOFF, (y <<16) | (x & 0xffff)); OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); } @@ -553,7 +541,7 @@ #endif OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags | ((skipleft << 2) & 0x1C)); - #ifdef NEO_DO_CLIPPING +#ifdef NEO_DO_CLIPPING OUTREG(NEOREG_CLIPLT, (y << 16) | (x + skipleft)); OUTREG(NEOREG_CLIPRB, ((y + h) << 16) | (x + w)); #endif @@ -590,6 +578,7 @@ #endif } +#if 0 static void Neo2200SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, @@ -657,5 +646,4 @@ OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); } - - +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c:1.2 Tue Apr 4 15:25:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c Wed Oct 30 07:52:21 2002 @@ -11,7 +11,7 @@ used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Precision Insight and its suppliers make no representations about the suitability of this -software for any purpose. It is provided "as is" without express or +software for any purpose. It is provided "as is" without express or implied warranty. PRECISION INSIGHT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c,v 1.2 2000/04/04 19:25:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_bank.c,v 1.4 2002/10/30 12:52:21 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -51,25 +51,27 @@ int NEOSetReadWrite(ScreenPtr pScreen, int bank) -{ +{ + IOADDRESS ioBase = xf86Screens[pScreen->myNum]->domainIOBase + 0x3CE; unsigned char tmp; - - outb(0x3CE, 0x11); - tmp = inb(0x3CF); - outw(0x3CE, (( tmp & 0xFC ) << 8 ) | 0x11); - outw(0x3CE, ((((bank << 2) & 0xFF) << 8) | 0x15)); + + outb(ioBase, 0x11); + tmp = inb(ioBase + 1); + outw(ioBase, (( tmp & 0xFC ) << 8 ) | 0x11); + outw(ioBase, ((((bank << 2) & 0xFF) << 8) | 0x15)); return 0; } int NEOSetWrite(ScreenPtr pScreen, int bank) { + IOADDRESS ioBase = xf86Screens[pScreen->myNum]->domainIOBase + 0x3CE; unsigned char tmp; - - outb(0x3CE, 0x11); - tmp = inb(0x3CF); - outw(0x3CE, ((( tmp & 0xFC ) | 0x01 ) << 8 ) | 0x11); - outw(0x3CE, ((((bank << 2) & 0xFF) << 8) | 0x16)); + + outb(ioBase, 0x11); + tmp = inb(ioBase + 1); + outw(ioBase, ((( tmp & 0xFC ) | 0x01 ) << 8 ) | 0x11); + outw(ioBase, ((((bank << 2) & 0xFF) << 8) | 0x16)); return 0; } @@ -77,19 +79,12 @@ int NEOSetRead(ScreenPtr pScreen, int bank) { + IOADDRESS ioBase = xf86Screens[pScreen->myNum]->domainIOBase + 0x3CE; unsigned char tmp; - - outb(0x3CE, 0x11); - tmp = inb(0x3CF); - outw(0x3CE, ((( tmp & 0xFC ) | 0x01 ) << 8 ) | 0x11); - outw(0x3CE, ((((bank << 2) & 0xFF) << 8) | 0x15)); + + outb(ioBase, 0x11); + tmp = inb(ioBase + 1); + outw(ioBase, ((( tmp & 0xFC ) | 0x01 ) << 8 ) | 0x11); + outw(ioBase, ((((bank << 2) & 0xFF) << 8) | 0x15)); return 0; } - - - - - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c:1.8 Sat Oct 27 23:33:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c Wed Oct 30 07:52:21 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c,v 1.8 2001/10/28 03:33:42 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c,v 1.9 2002/10/30 12:52:21 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c:1.4 Mon Oct 1 09:44:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c Thu Apr 4 09:05:44 2002 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c,v 1.4 2001/10/01 13:44:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c,v 1.5 2002/04/04 14:05:44 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -43,8 +43,10 @@ static void NEO_SetViewport(ScrnInfoPtr, int, int, int); static void NEO_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void NEO_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void NEO_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec NEODGAFuncs = { @@ -76,7 +78,7 @@ imlines = (pScrn->videoRam * 1024) / (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); - pixlines = (imlines > 1024 && !pNEO->noAccel) ? 1024 : imlines; + pixlines = (imlines > 1024 && !pNEO->noAccel) ? 1024 : imlines; pMode = firstMode = pScrn->modes; @@ -184,7 +186,7 @@ ){ NEOPtr pNEO = NEOPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - + NEOAdjustFrame(pScrn->pScreen->myNum, x, y, flags); /* wait for retrace */ while((hwp->readST01(hwp) & 0x08)); @@ -240,7 +242,7 @@ } } - +#if 0 static void NEO_BlitTransRect( ScrnInfoPtr pScrn, @@ -252,7 +254,7 @@ /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } - +#endif static Bool NEO_OpenFramebuffer( Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.59 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.66 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.59 Fri Nov 30 07:11:57 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c Mon Dec 9 06:32:48 2002 @@ -22,14 +22,22 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.59 2001/11/30 12:11:57 eich Exp $ */ /* + * Copyright 1998, 1999 Egbert Eich + * Copyright 2000, 2001 SuSE GmbH, Author: Egbert Eich + * Copyright 2002 SuSE Linux AG, Author: Egbert Eich + * Copyright 2002 Shigehiro Nomura + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.66 2002/12/09 11:32:48 eich Exp $ */ + +/* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -229,6 +237,47 @@ 0.0 /* VRefresh */ }; +static DisplayModeRec neo1024x480Mode = { + NULL, /* prev */ + NULL, /* next */ + "1024x480", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 45900, /* Clock frequency */ + 1024, /* HDisplay */ + 1048, /* HSyncStart */ + 1184, /* HSyncEnd */ + 1344, /* HTotal */ + 0, /* HSkew */ + 480, /* VDisplay */ + 480, /* VSyncStart */ + 486, /* VSyncEnd */ + 488, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 45900, /* SynthClock */ + 1024, /* CRTC HDisplay */ + 1024, /* CRTC HBlankStart */ + 1048, /* CRTC HSyncStart */ + 1184, /* CRTC HSyncEnd */ + 1072, /* CRTC HBlankEnd */ + 1344, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 480, /* CRTC VDisplay */ + 480, /* CRTC VBlankStart */ + 480, /* CRTC VSyncStart */ + 486, /* CRTC VSyncEnd */ + 487, /* CRTC VBlankEnd */ + 488, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + /* * This contains the functions needed by the server after loading the driver * module. It must be supplied, and gets passed back by the SetupProc @@ -299,7 +348,11 @@ OPTION_PROG_LCD_MODE_REGS, OPTION_PROG_LCD_MODE_STRETCH, OPTION_OVERRIDE_VALIDATE_MODE, + OPTION_SHOWCACHE, OPTION_ROTATE, + OPTION_VIDEO_KEY, + OPTION_OVERLAYMEM, + OPTION_VIDEO_INTERLACE, OPTION_DISPLAY_HEIGHT_480, OPTION_STRANGE_LOCKUPS } NEOOpts; @@ -314,6 +367,7 @@ { OPTION_LCD_STRETCH, "NoStretch", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PCI_BURST, "pciBurst", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_PROG_LCD_MODE_REGS, "progLcdModeRegs", OPTV_BOOLEAN, {0}, FALSE }, @@ -321,6 +375,10 @@ OPTV_BOOLEAN, {0}, FALSE }, { OPTION_OVERRIDE_VALIDATE_MODE, "overrideValidateMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, + { OPTION_OVERLAYMEM, "OverlayMem", OPTV_INTEGER, {0}, FALSE }, + { OPTION_VIDEO_INTERLACE, "Interlace", + OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -335,6 +393,7 @@ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LCD_STRETCH,"NoStretch", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PCI_BURST, "pciBurst", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_STRANGE_LOCKUPS, "StrangeLockups", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DISPLAY_HEIGHT_480, "DisplayHeight480", @@ -345,6 +404,10 @@ OPTV_BOOLEAN, {0}, FALSE }, { OPTION_OVERRIDE_VALIDATE_MODE, "overrideValidateMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, + { OPTION_OVERLAYMEM, "OverlayMem", OPTV_INTEGER, {0}, FALSE }, + { OPTION_VIDEO_INTERLACE, "Interlace", + OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -470,7 +533,7 @@ * The return value must be non-NULL on success even though there * is no TearDownProc. */ - return (pointer)1; + return (pointer)1; } else { if (errmaj) *errmaj = LDR_ONCEONLY; return NULL; @@ -662,6 +725,7 @@ int w; int apertureSize; Bool height_480 = FALSE; + Bool lcdCenterOptSet = FALSE; char *s; if (flags & PROBE_DETECT) { @@ -971,14 +1035,15 @@ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, nPtr->Options); xf86GetOptValBool(nPtr->Options, OPTION_NOLINEAR_MODE,&nPtr->noLinear); - xf86GetOptValBool(nPtr->Options, OPTION_NOACCEL,&nPtr->noAccel); xf86GetOptValBool(nPtr->Options, OPTION_SW_CURSOR,&nPtr->swCursor); xf86GetOptValBool(nPtr->Options, OPTION_NO_MMIO,&nPtr->noMMIO); xf86GetOptValBool(nPtr->Options, OPTION_INTERN_DISP,&nPtr->internDisp); xf86GetOptValBool(nPtr->Options, OPTION_EXTERN_DISP,&nPtr->externDisp); - xf86GetOptValBool(nPtr->Options, OPTION_LCD_CENTER,&nPtr->lcdCenter); + if (xf86GetOptValBool(nPtr->Options, OPTION_LCD_CENTER,&nPtr->lcdCenter)) + lcdCenterOptSet = TRUE; xf86GetOptValBool(nPtr->Options, OPTION_LCD_STRETCH,&nPtr->noLcdStretch); xf86GetOptValBool(nPtr->Options, OPTION_SHADOW_FB,&nPtr->shadowFB); + xf86GetOptValBool(nPtr->Options, OPTION_SHOWCACHE,&nPtr->showcache); nPtr->onPciBurst = TRUE; xf86GetOptValBool(nPtr->Options, OPTION_PCI_BURST,&nPtr->onPciBurst); xf86GetOptValBool(nPtr->Options, @@ -991,6 +1056,8 @@ xf86GetOptValBool(nPtr->Options, OPTION_DISPLAY_HEIGHT_480,&height_480); xf86GetOptValBool(nPtr->Options, OPTION_STRANGE_LOCKUPS, &nPtr->strangeLockups); + nPtr->noAccelSet = + xf86GetOptValBool(nPtr->Options, OPTION_NOACCEL,&nPtr->noAccel); nPtr->rotate = 0; if ((s = xf86GetOptValString(nPtr->Options, OPTION_ROTATE))) { @@ -1014,11 +1081,50 @@ "Valid options are \"CW\" or \"CCW\"\n"); } } +#ifdef XvExtension + if(xf86GetOptValInteger(nPtr->Options, + OPTION_VIDEO_KEY, &(nPtr->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + nPtr->videoKey); + } else { + nPtr->videoKey = (1 << pScrn->offset.red) | + (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) + << pScrn->offset.blue); + } + if(xf86GetOptValInteger(nPtr->Options, OPTION_OVERLAYMEM, + &(nPtr->overlay))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "reserve %d bytes for overlay.\n", nPtr->overlay); + } else { + nPtr->overlay = 0; + } + nPtr->interlace = 0; + if(xf86GetOptValInteger(nPtr->Options, OPTION_VIDEO_INTERLACE, + &(nPtr->interlace))) { + if (nPtr->interlace >= 0 && nPtr->interlace <= 2){ + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "interlace flag = %d\n", + nPtr->interlace); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for " + "Option \"Interlaced\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are 0..2\n"); + } + } +#endif /* XvExtension */ - if (height_480 && nPtr->NeoPanelWidth == 800) { + + if (height_480 + && (nPtr->NeoPanelWidth == 800 || nPtr->NeoPanelWidth == 1024)) { xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "Overriding Panel height: Set to 480\n"); nPtr->NeoPanelHeight = 480; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, + "Disabling LCD stretching for panel height 480\n"); + nPtr->noLcdStretch = TRUE; + if (!lcdCenterOptSet) + nPtr->lcdCenter = TRUE; } if (nPtr->internDisp && nPtr->externDisp) @@ -1069,6 +1175,9 @@ if (nPtr->strangeLockups) xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "Option StrangeLockups set: disabling some acceleration\n"); + if (nPtr->showcache) + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, + "Show chache for debugging\n"); if (nPtr->shadowFB) { if (nPtr->noLinear) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -1096,6 +1205,8 @@ nPtr->NeoLinearAddr = 0; } + nPtr->NeoMMIOAddr2 = 0; + nPtr->NeoMMIOBase2 = NULL; if (nPtr->pEnt->device->IOBase && !nPtr->noMMIO) { /* XXX Check this matches a PCI base address */ nPtr->NeoMMIOAddr = nPtr->pEnt->device->IOBase; @@ -1113,7 +1224,7 @@ "FB base address is set at 0x%X.\n", nPtr->NeoLinearAddr); } - if (!nPtr->NeoMMIOAddr) { + if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) { switch (nPtr->NeoChipset) { case NM2070 : nPtr->NeoMMIOAddr = nPtr->NeoLinearAddr + 0x100000; @@ -1129,11 +1240,17 @@ case NM2360: case NM2380: nPtr->NeoMMIOAddr = nPtr->PciInfo->memBase[1]; + nPtr->NeoMMIOAddr2 = nPtr->PciInfo->memBase[2]; break; } xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO base address is set at 0x%X.\n", nPtr->NeoMMIOAddr); + if (nPtr->NeoMMIOAddr2 != 0){ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "MMIO base address2 is set at 0x%X.\n", + nPtr->NeoMMIOAddr2); + } } /* XXX What about VGA resources in OPERATING mode? */ if (xf86RegisterResources(nPtr->pEnt->index, NULL, ResExclusive)) @@ -1152,7 +1269,7 @@ "FB base address is set at 0x%X.\n", nPtr->NeoLinearAddr); } - if (!nPtr->NeoMMIOAddr) { + if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) { nPtr->NeoMMIOAddr = nPtr->NeoLinearAddr + 0x100000; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO base address is set at 0x%X.\n", @@ -1210,9 +1327,13 @@ apertureSize = (pScrn->videoRam * 1024) - nPtr->NeoCursorMem; if ((nPtr->NeoPanelWidth == 800) && (nPtr->NeoPanelHeight == 480)) { - neo800x480Mode.next = pScrn->monitor->Modes; - pScrn->monitor->Modes = &neo800x480Mode; -} + neo800x480Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &neo800x480Mode; + } + if ((nPtr->NeoPanelWidth == 1024) && (nPtr->NeoPanelHeight == 480)) { + neo1024x480Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &neo1024x480Mode; + } /* * For external displays, limit the width to 1024 pixels or less. */ @@ -1293,6 +1414,10 @@ /* Should we re-save the text mode on each VT enter? */ if(!neoModeInit(pScrn, pScrn->currentMode)) return FALSE; +#ifdef XvExtension + if (nPtr->video) + NEOResetVideo(pScrn); +#endif if (nPtr->NeoHWCursorShown) NeoShowCursor(pScrn); NEOAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -1384,12 +1509,12 @@ /* Map the Neo memory and possible MMIO areas */ if (!neoMapMem(pScrn)) return FALSE; - + /* * next we save the current state and setup the first mode */ neoSave(pScrn); - + if (!neoModeInit(pScrn,pScrn->currentMode)) return FALSE; vgaHWSaveScreen(pScreen,SCREEN_SAVER_ON); @@ -1431,7 +1556,7 @@ nPtr->ShadowPtr = NULL; FBStart = nPtr->NeoFbBase; } - + ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, @@ -1509,13 +1634,13 @@ nPtr->NeoLinearAddr); /* Setup pointers to free space in video ram */ allocatebase = (pScrn->videoRam << 10); - freespace = allocatebase - pScrn->displayWidth * + freespace = allocatebase - pScrn->displayWidth * pScrn->virtualY * (pScrn->bitsPerPixel >> 3); currentaddr = allocatebase; xf86DrvMsg(scrnIndex, X_PROBED, "%d bytes off-screen memory available\n", freespace); - if (nPtr->swCursor || nPtr->noMMIO) { + if (nPtr->swCursor || !nPtr->NeoMMIOBase) { xf86DrvMsg(scrnIndex, X_CONFIG, "Using Software Cursor.\n"); } else if (nPtr->NeoCursorMem <= freespace) { @@ -1527,42 +1652,79 @@ nAcl->CursorAddress = currentaddr; xf86DrvMsg(scrnIndex, X_INFO, "Using H/W Cursor.\n"); - } else xf86DrvMsg(scrnIndex, X_ERROR, - "Too little space for H/W cursor.\n"); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, + "Too little space for H/W cursor.\n"); + } - if (!nPtr->noAccel && nPtr->noMMIO) + if (!nPtr->noAccel && !nPtr->NeoMMIOBase) xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Acceleration disabled when not using MMIO\n"); +#ifdef XvExtension + if (nPtr->overlay > 0){ + if (nPtr->overlay > freespace){ + xf86DrvMsg(pScrn->scrnIndex,X_INFO, + "Can not reserve %d bytes for overlay. " + "Resize to %d bytes.\n", + nPtr->overlay, freespace); + nPtr->overlay = freespace; + } + currentaddr -= nPtr->overlay; + freespace -= nPtr->overlay; + nPtr->overlay_offset = currentaddr; + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Overlay at 0x%x\n", + nPtr->overlay_offset); + } +#endif /* XvExtension */ + nAcl->cacheStart = currentaddr - freespace; + nAcl->cacheEnd = currentaddr; + freespace = 0; + if (nAcl->cacheStart < nAcl->cacheEnd) { + BoxRec AvailFBArea; + int lines = nAcl->cacheEnd / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + if (!nPtr->noAccel && nPtr->NeoMMIOBase && lines > 1024) + lines = 1024; + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = lines; + xf86InitFBManager(pScreen, &AvailFBArea); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %i scanlines of offscreen memory \n", + lines - pScrn->virtualY); + } + /* Setup the acceleration primitives */ - if (!nPtr->noAccel && !nPtr->noMMIO) { - nAcl->cacheStart = currentaddr - freespace; - nAcl->cacheEnd = currentaddr; - freespace = 0; + if (!nPtr->noAccel && nPtr->NeoMMIOBase) { + Bool ret = FALSE; if (nAcl->cacheStart >= nAcl->cacheEnd) { xf86DrvMsg(scrnIndex, X_ERROR, "Too little space for pixmap cache.\n"); - } + } switch(nPtr->NeoChipset) { case NM2070 : - Neo2070AccelInit(pScreen); + ret = Neo2070AccelInit(pScreen); break; case NM2090 : case NM2093 : - Neo2090AccelInit(pScreen); + ret = Neo2090AccelInit(pScreen); break; case NM2097 : case NM2160 : - Neo2097AccelInit(pScreen); + ret = Neo2097AccelInit(pScreen); break; case NM2200 : case NM2230 : case NM2360 : case NM2380 : - Neo2200AccelInit(pScreen); + ret = Neo2200AccelInit(pScreen); break; } - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Acceleration Initialized\n"); + xf86DrvMsg(pScrn->scrnIndex,X_INFO, + "Acceleration %s Initialized\n",ret ? "" : "not"); } miInitializeBackingStore(pScreen); @@ -1624,6 +1786,8 @@ pScrn->racIoFlags = pScrn->racMemFlags = racflag; + NEOInitVideo(pScreen); + pScreen->SaveScreen = vgaHWSaveScreen; /* Setup DPMS mode */ @@ -1634,19 +1798,8 @@ if (!nPtr->noLinear) { pScrn->memPhysBase = (unsigned long)nPtr->NeoFbBase; pScrn->fbOffset = 0; - } - -#ifdef XvExtension - { - XF86VideoAdaptorPtr *ptr; - int n; - - n = xf86XVListGenericAdaptors(pScrn,&ptr); - if (n) - xf86XVScreenInit(pScreen, ptr, n); } -#endif - + /* Wrap the current CloseScreen function */ nPtr->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = NEOCloseScreen; @@ -1677,11 +1830,21 @@ int Base; pScrn = xf86Screens[scrnIndex]; - Base = (y * pScrn->displayWidth + x) >> 2; hwp = VGAHWPTR(pScrn); nPtr = NEOPTR(pScrn); - /* Scale Base by the number of bytes per pixel. */ + if (nPtr->showcache && y) { + int lastline = nPtr->NeoFbMapSize / + ((pScrn->displayWidth * pScrn->bitsPerPixel) / 8); + + lastline -= pScrn->currentMode->VDisplay; + y += pScrn->virtualY - 1; + if (y > lastline) y = lastline; + } + + Base = (y * pScrn->displayWidth + x) >> 2; + + /* Scale Base by the number of bytes per pixel. */ switch (pScrn->depth) { case 8 : break; @@ -1730,6 +1893,7 @@ if (nPtr->NeoHWCursorShown) NeoHideCursor(pScrn); neoRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &nPtr->NeoSavedReg, TRUE); + neoLock(pScrn); neoUnmapMem(pScrn); } @@ -1796,6 +1960,8 @@ case 1024 : if (mode->VDisplay == 768) return(MODE_OK); + if ((mode->VDisplay == 480) && (nPtr->NeoPanelHeight == 480)) + return(MODE_OK); break; case 800 : if (mode->VDisplay == 600) @@ -1807,6 +1973,14 @@ if (mode->VDisplay == 480) return(MODE_OK); break; +#if 1 + case 320: + if (mode->VDisplay == 240) + return(MODE_OK); + break; +#endif + default: + break; } xf86DrvMsg(scrnIndex, X_INFO, "Removing mode (%dx%d) that won't " @@ -1845,12 +2019,18 @@ if (!nPtr->noLinear) { if (!nPtr->noMMIO) { - if (nPtr->pEnt->location.type == BUS_PCI) + if (nPtr->pEnt->location.type == BUS_PCI){ nPtr->NeoMMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, nPtr->PciTag, nPtr->NeoMMIOAddr, 0x200000L); - else + if (nPtr->NeoMMIOAddr2 != 0){ + nPtr->NeoMMIOBase2 = + xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + nPtr->PciTag, nPtr->NeoMMIOAddr2, + 0x100000L); + } + } else nPtr->NeoMMIOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, nPtr->NeoMMIOAddr, @@ -1889,8 +2069,14 @@ NEOPtr nPtr = NEOPTR(pScrn); if (!nPtr->noLinear) { - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoMMIOBase, 0x200000L); + if (nPtr->NeoMMIOBase) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoMMIOBase, + 0x200000L); nPtr->NeoMMIOBase = NULL; + if (nPtr->NeoMMIOBase2) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoMMIOBase2, + 0x100000L); + nPtr->NeoMMIOBase2 = NULL; xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoFbBase, nPtr->NeoFbMapSize); } @@ -2000,6 +2186,14 @@ Bool noProgramShadowRegs; vgaHWPtr hwp = VGAHWPTR(pScrn); NEOPtr nPtr = NEOPTR(pScrn); + Bool prog_lcd; + + /* + * If display is external only and we want internal + * we need to program the shadow registers. + */ + prog_lcd = (((VGArGR(0x20) & 0x3) == 0x1) && nPtr->internDisp); + /* * Convoluted logic for shadow register programming. @@ -2011,7 +2205,7 @@ case NM2070: /* Program the shadow regs by default */ noProgramShadowRegs = FALSE; - if (!nPtr->progLcdRegs) + if (!nPtr->progLcdRegs && !prog_lcd) noProgramShadowRegs = TRUE; if (restore->PanelDispCntlReg2 & 0x84) { @@ -2032,7 +2226,7 @@ default: /* Don't program the shadow regs by default */ noProgramShadowRegs = TRUE; - if (nPtr->progLcdRegs) + if (nPtr->progLcdRegs || prog_lcd) noProgramShadowRegs = FALSE; if (restore->PanelDispCntlReg2 & 0x84) { @@ -2044,7 +2238,7 @@ } if (noProgramShadowRegs) { - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"Not programming shadow registers\n"); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,5,"Not programming shadow registers\n"); if (nPtr->NeoSavedReg.reg){ for (i = 0x40; i <= 0x59; i++) { VGAwCR(i, nPtr->NeoSavedReg.reg->CR[i]); @@ -2080,112 +2274,149 @@ break; case 800 : switch (nPtr->NeoPanelHeight) { - case 600: - VGAwCR(0x40,0x7F); - VGAwCR(0x41,0x63); - VGAwCR(0x42,0x02); - VGAwCR(0x43,0x6C); - VGAwCR(0x44,0x1C); - VGAwCR(0x45,0x72); - VGAwCR(0x46,0xE0); - VGAwCR(0x47,0x58); - VGAwCR(0x48,0x0C); - VGAwCR(0x49,0x57); - VGAwCR(0x4A,0x73); - VGAwCR(0x4B,0x3D); - VGAwCR(0x4C,0x31); - VGAwCR(0x4D,0x01); - VGAwCR(0x4E,0x36); - VGAwCR(0x4F,0x1E); - if (nPtr->NeoChipset != NM2070) { - VGAwCR(0x50,0x6B); - VGAwCR(0x51,0x4F); - VGAwCR(0x52,0x0E); - VGAwCR(0x53,0x58); - VGAwCR(0x54,0x88); - VGAwCR(0x55,0x33); - VGAwCR(0x56,0x27); - VGAwCR(0x57,0x16); - VGAwCR(0x58,0x2C); - VGAwCR(0x59,0x94); - } - break; - case 480: - VGAwCR(0x40,0x7F); - VGAwCR(0x41,0x63); - VGAwCR(0x42,0x02); - VGAwCR(0x43,0x6B); - VGAwCR(0x44,0x1B); - VGAwCR(0x45,0x72); - VGAwCR(0x46,0xE0); - VGAwCR(0x47,0x1C); - VGAwCR(0x48,0x00); - VGAwCR(0x49,0x57); - VGAwCR(0x4A,0x73); - VGAwCR(0x4B,0x3E); - VGAwCR(0x4C,0x31); - VGAwCR(0x4D,0x01); - VGAwCR(0x4E,0x36); - VGAwCR(0x4F,0x1E); + case 600: + VGAwCR(0x40,0x7F); + VGAwCR(0x41,0x63); + VGAwCR(0x42,0x02); + VGAwCR(0x43,0x6C); + VGAwCR(0x44,0x1C); + VGAwCR(0x45,0x72); + VGAwCR(0x46,0xE0); + VGAwCR(0x47,0x58); + VGAwCR(0x48,0x0C); + VGAwCR(0x49,0x57); + VGAwCR(0x4A,0x73); + VGAwCR(0x4B,0x3D); + VGAwCR(0x4C,0x31); + VGAwCR(0x4D,0x01); + VGAwCR(0x4E,0x36); + VGAwCR(0x4F,0x1E); + if (nPtr->NeoChipset != NM2070) { VGAwCR(0x50,0x6B); VGAwCR(0x51,0x4F); VGAwCR(0x52,0x0E); - VGAwCR(0x53,0x57); - VGAwCR(0x54,0x87); + VGAwCR(0x53,0x58); + VGAwCR(0x54,0x88); VGAwCR(0x55,0x33); VGAwCR(0x56,0x27); VGAwCR(0x57,0x16); VGAwCR(0x58,0x2C); VGAwCR(0x59,0x94); - break; + } + break; + case 480: + VGAwCR(0x40,0x7F); + VGAwCR(0x41,0x63); + VGAwCR(0x42,0x02); + VGAwCR(0x43,0x6B); + VGAwCR(0x44,0x1B); + VGAwCR(0x45,0x72); + VGAwCR(0x46,0xE0); + VGAwCR(0x47,0x1C); + VGAwCR(0x48,0x00); + VGAwCR(0x49,0x57); + VGAwCR(0x4A,0x73); + VGAwCR(0x4B,0x3E); + VGAwCR(0x4C,0x31); + VGAwCR(0x4D,0x01); + VGAwCR(0x4E,0x36); + VGAwCR(0x4F,0x1E); + VGAwCR(0x50,0x6B); + VGAwCR(0x51,0x4F); + VGAwCR(0x52,0x0E); + VGAwCR(0x53,0x57); + VGAwCR(0x54,0x87); + VGAwCR(0x55,0x33); + VGAwCR(0x56,0x27); + VGAwCR(0x57,0x16); + VGAwCR(0x58,0x2C); + VGAwCR(0x59,0x94); break; + break; /* Not done */ } break; case 1024 : - VGAwCR(0x40,0xA3); - VGAwCR(0x41,0x7F); - VGAwCR(0x42,0x06); - VGAwCR(0x43,0x85); - VGAwCR(0x44,0x96); - VGAwCR(0x45,0x24); - VGAwCR(0x46,0xE5); - VGAwCR(0x47,0x02); - VGAwCR(0x48,0x08); - VGAwCR(0x49,0xFF); - VGAwCR(0x4A,0x25); - VGAwCR(0x4B,0x4F); - VGAwCR(0x4C,0x40); - VGAwCR(0x4D,0x00); - VGAwCR(0x4E,0x44); - VGAwCR(0x4F,0x0C); - VGAwCR(0x50,0x7A); - VGAwCR(0x51,0x56); - VGAwCR(0x52,0x00); - VGAwCR(0x53,0x5D); - VGAwCR(0x54,0x0E); - VGAwCR(0x55,0x3B); - VGAwCR(0x56,0x2B); - VGAwCR(0x57,0x00); - VGAwCR(0x58,0x2F); - VGAwCR(0x59,0x18); - VGAwCR(0x60,0x88); - VGAwCR(0x61,0x63); - VGAwCR(0x62,0x0B); - VGAwCR(0x63,0x69); - VGAwCR(0x64,0x1A); + switch (nPtr->NeoPanelHeight) { + case 768: + VGAwCR(0x40,0xA3); + VGAwCR(0x41,0x7F); + VGAwCR(0x42,0x06); + VGAwCR(0x43,0x85); + VGAwCR(0x44,0x96); + VGAwCR(0x45,0x24); + VGAwCR(0x46,0xE5); + VGAwCR(0x47,0x02); + VGAwCR(0x48,0x08); + VGAwCR(0x49,0xFF); + VGAwCR(0x4A,0x25); + VGAwCR(0x4B,0x4F); + VGAwCR(0x4C,0x40); + VGAwCR(0x4D,0x00); + VGAwCR(0x4E,0x44); + VGAwCR(0x4F,0x0C); + VGAwCR(0x50,0x7A); + VGAwCR(0x51,0x56); + VGAwCR(0x52,0x00); + VGAwCR(0x53,0x5D); + VGAwCR(0x54,0x0E); + VGAwCR(0x55,0x3B); + VGAwCR(0x56,0x2B); + VGAwCR(0x57,0x00); + VGAwCR(0x58,0x2F); + VGAwCR(0x59,0x18); + VGAwCR(0x60,0x88); + VGAwCR(0x61,0x63); + VGAwCR(0x62,0x0B); + VGAwCR(0x63,0x69); + VGAwCR(0x64,0x1A); + break; + case 480: + VGAwCR(0x40,0xA3); + VGAwCR(0x41,0x7F); + VGAwCR(0x42,0x1B); + VGAwCR(0x43,0x89); + VGAwCR(0x44,0x16); + VGAwCR(0x45,0x0B); + VGAwCR(0x46,0x2C); + VGAwCR(0x47,0xE8); + VGAwCR(0x48,0x0C); + VGAwCR(0x49,0xE7); + VGAwCR(0x4A,0x09); + VGAwCR(0x4B,0x4F); + VGAwCR(0x4C,0x40); + VGAwCR(0x4D,0x00); + VGAwCR(0x4E,0x44); + VGAwCR(0x4F,0x0C); + VGAwCR(0x50,0x7A); + VGAwCR(0x51,0x56); + VGAwCR(0x52,0x00); + VGAwCR(0x53,0x5D); + VGAwCR(0x54,0x0E); + VGAwCR(0x55,0x3B); + VGAwCR(0x56,0x2A); + VGAwCR(0x57,0x00); + VGAwCR(0x58,0x2F); + VGAwCR(0x59,0x18); + VGAwCR(0x60,0x88); + VGAwCR(0x61,0x63); + VGAwCR(0x62,0x0B); + VGAwCR(0x63,0x69); + VGAwCR(0x64,0x1A); + break; + } break; case 1280: #ifdef NOT_DONE VGAwCR(0x40,0x?? ); . - . - . - VGAwCR(0x64,0x?? ); - break; + . + . + VGAwCR(0x64,0x?? ); + break; #else - /* Probe should prevent this case for now */ - FatalError("1280 panel support incomplete\n"); + /* Probe should prevent this case for now */ + FatalError("1280 panel support incomplete\n"); #endif } } @@ -2200,7 +2431,7 @@ unsigned char temp; int i; Bool clock_hi = FALSE; - + vgaHWProtect(pScrn,TRUE); /* Blank the screen */ VGAwGR(0x09,0x26); @@ -2220,6 +2451,7 @@ * any reserved bits. */ temp = VGArGR(0x90); + switch (nPtr->NeoChipset) { case NM2070 : temp &= 0xF0; /* Save bits 7:4 */ @@ -2238,6 +2470,7 @@ break; } VGAwGR(0x90,temp); + /* * In some rare cases a lockup might occur if we don't delay * here. (Reported by Miles Lane) @@ -2256,7 +2489,6 @@ * had time to take effect. */ xf86UDelay(200000); - /* * This function handles restoring the generic VGA registers. */ vgaHWRestore(pScrn, VgaReg, @@ -2273,6 +2505,7 @@ VGAwGR(0x11, restore->SysIfaceCntl2); VGAwGR(0x15, restore->SingleAddrPage); VGAwGR(0x16, restore->DualAddrPage); + temp = VGArGR(0x20); switch (nPtr->NeoChipset) { case NM2070 : @@ -2295,6 +2528,7 @@ break; } VGAwGR(0x20, temp); + temp = VGArGR(0x25); temp &= 0x38; /* Save bits 5:3 */ temp |= (restore->PanelDispCntlReg2 & ~0x38); @@ -2349,7 +2583,7 @@ } if (restore->biosMode) VGAwCR(0x23,restore->biosMode); - + if (restore->reg) { VGAwCR(0x23,restore->reg->CR[0x23]); VGAwCR(0x25,restore->reg->CR[0x25]); @@ -2371,13 +2605,13 @@ VGAwGR(i, restore->reg->GR[i]); } } + /* Program vertical extension register */ if (nPtr->NeoChipset == NM2200 || nPtr->NeoChipset == NM2230 || nPtr->NeoChipset == NM2360 || nPtr->NeoChipset == NM2380) { VGAwCR(0x70, restore->VerticalExt); } - - + vgaHWProtect(pScrn, FALSE); /* Turn on screen */ } @@ -2392,7 +2626,8 @@ NeoRegPtr NeoNew = &nPtr->NeoModeReg; vgaRegPtr NeoStd = &hwp->ModeReg; Bool noLcdStretch = nPtr->noLcdStretch; - + int clockMul = 1; + neoUnlock(pScrn); /* @@ -2559,7 +2794,7 @@ } else if (mode->Flags & V_DBLSCAN) { nAcl->NoCursorMode = TRUE; } - + /* * If the screen is to be centerd, turn on the centering for the * various modes. @@ -2574,32 +2809,57 @@ NeoNew->PanelHorizCenterReg3 = 0x00; NeoNew->PanelHorizCenterReg4 = 0x00; NeoNew->PanelHorizCenterReg5 = 0x00; - + if (nPtr->lcdCenter && (NeoNew->PanelDispCntlReg1 & 0x02)) { + Bool doCenter = FALSE; + + hoffset = 0; + voffset = 0; if (mode->HDisplay == nPtr->NeoPanelWidth) { /* * No centering required when the requested display width * equals the panel width. */ } else { - NeoNew->PanelDispCntlReg2 |= 0x01; NeoNew->PanelDispCntlReg3 |= 0x10; - - /* Calculate the horizontal and vertical offsets. */ if (noLcdStretch) { - hoffset = ((nPtr->NeoPanelWidth - mode->HDisplay) >> 4) - 1; - voffset = ((nPtr->NeoPanelHeight - mode->VDisplay) >> 1) - 2; + /* Calculate the horizontal offsets. */ + int HDisplay = mode->HDisplay + << ((mode->VDisplay < 480) ? 1 : 0); + hoffset = ((nPtr->NeoPanelWidth - HDisplay) >> 4) - 1; + if (mode->VDisplay < 480) + hoffset >>= 1; + doCenter = TRUE; } else { /* Stretched modes cannot be centered. */ hoffset = 0; + } + } + if (mode->VDisplay == nPtr->NeoPanelHeight) { + /* + * No centering required when the requested display width + * equals the panel width. + */ + } else { + NeoNew->PanelDispCntlReg2 |= 0x01; + if (noLcdStretch) { + /* Calculate the vertical offsets. */ + int VDisplay = mode->VDisplay + << ((mode->Flags & V_DBLSCAN) ? 1 : 0); + voffset = ((nPtr->NeoPanelHeight - VDisplay) >> 1) - 2; + doCenter = TRUE; + } else { + /* Stretched modes cannot be centered. */ voffset = 0; } + } + if (doCenter) { switch (mode->HDisplay) { case 320 : /* Needs testing. KEM -- 24 May 98 */ - NeoNew->PanelHorizCenterReg3 = hoffset; - NeoNew->PanelVertCenterReg2 = voffset; + NeoNew->PanelHorizCenterReg3 = hoffset; + NeoNew->PanelVertCenterReg3 = voffset; break; case 400 : /* Needs testing. KEM -- 24 May 98 */ NeoNew->PanelHorizCenterReg4 = hoffset; @@ -2632,6 +2892,25 @@ } } } + +#ifdef XvExtension + if (!noLcdStretch && + (NeoNew->PanelDispCntlReg1 & 0x02)) { + if (mode->HDisplay != nPtr->NeoPanelWidth) + nPtr->videoHZoom = (double)nPtr->NeoPanelWidth/mode->HDisplay; + if (mode->VDisplay != nPtr->NeoPanelHeight) + nPtr->videoVZoom = (double)nPtr->NeoPanelHeight/mode->VDisplay; + } else { + nPtr->videoHZoom = 1.0; + nPtr->videoVZoom = 1.0; + } +#endif + + if (mode->VDisplay < 480) { + NeoStd->Sequencer[1] |= 0x8; + clockMul = 2; + } + NeoNew->biosMode = neoFindMode(mode->HDisplay,mode->VDisplay,pScrn->depth); /* @@ -2649,7 +2928,7 @@ * Calculate the VCLK that most closely matches the requested dot * clock. */ - neoCalcVCLK(pScrn, mode->SynthClock); + neoCalcVCLK(pScrn, mode->SynthClock*clockMul); /* Since we program the clocks ourselves, always use VCLK3. */ NeoStd->MiscOutReg |= 0x0C; @@ -2764,9 +3043,8 @@ } /* Turn the screen on/off */ - outb(0x3C4, 0x01); - SEQ01 |= inb(0x3C5) & ~0x20; - outb(0x3C5, SEQ01); + SEQ01 |= VGArSR(0x01) & ~0x20; + VGAwSR(0x01, SEQ01); /* Turn the LCD on/off */ LCD_on |= VGArGR(0x20) & ~0x02; Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c:1.3 Fri Nov 3 13:46:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c Wed Oct 30 07:52:22 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c,v 1.3 2000/11/03 18:46:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_i2c.c,v 1.5 2002/10/30 12:52:22 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 @@ -79,8 +79,8 @@ NEOPtr pNeo = NEOPTR(pScrn); I2CBusPtr I2CPtr; - I2CPtr = xf86CreateI2CBusRec(); + if(!I2CPtr) return FALSE; pNeo->I2C = I2CPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h:1.1 Sat Apr 17 03:06:27 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h Wed Oct 30 07:52:22 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h,v 1.1 1999/04/17 07:06:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_macros.h,v 1.2 2002/10/30 12:52:22 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h:1.1 Sat Apr 17 03:06:29 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h Wed Oct 30 07:52:22 2002 @@ -22,14 +22,14 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h,v 1.1 1999/04/17 07:06:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_reg.h,v 1.2 2002/10/30 12:52:22 alanh Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. * * Authors: - * Jens Owen (jens@precisioninsight.com) + * Jens Owen (jens@tungstengraphics.com) * Kevin E. Martin (kevin@precisioninsight.com) * * Port to Xfree86 v.4.0 Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c:1.4 --- /dev/null Thu Feb 27 12:31:07 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c Mon Nov 25 09:05:00 2002 @@ -0,0 +1,1233 @@ +/********************************************************************** +Copyright 2002 by Shigehiro Nomura. + + All Rights Reserved + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Shigehiro Nomura not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. Shigehiro Nomura +and its suppliers make no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty. + +SHIGEHIRO NOMURA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL SHIGEHIRO NOMURA AND/OR ITS SUPPLIERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +**********************************************************************/ + +/* + * Copyright 2002 SuSE Linux AG, Author: Egbert Eich + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c,v 1.4 2002/11/25 14:05:00 eich Exp $ */ + +#include "neo.h" +#include "neo_video.h" + +#define nElems(x) (sizeof(x) / sizeof(x[0])) +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +#if defined(XvExtension) + +#include "dixstruct.h" +#include "xaa.h" +#include "xaalocal.h" + +static XF86VideoAdaptorPtr NEOSetupVideo(ScreenPtr); + +static int NEOPutVideo(ScrnInfoPtr, short, short, short, short, + short, short, short, short, RegionPtr, pointer); + +static void NEOStopVideo(ScrnInfoPtr, pointer, Bool); +static int NEOSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int NEOGetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); +static void NEOQueryBestSize(ScrnInfoPtr, Bool, short, short, short, + short, unsigned int *, unsigned int *, pointer); +static int NEOPutImage(ScrnInfoPtr, short, short, short, short, short, short, + short, short, int, unsigned char *, short, short, Bool, + RegionPtr, pointer); +static int NEOQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); + +static Bool RegionsEqual(RegionPtr, RegionPtr); +static void NEODisplayVideo(ScrnInfoPtr, int, int, short, short, int, int, + int, int, int, BoxPtr, short, short, short, short); + +static void NEOInitOffscreenImages(ScreenPtr); +static FBLinearPtr NEOAllocateMemory(ScrnInfoPtr, FBLinearPtr, int); +static void NEOCopyData(unsigned char *, unsigned char *, int, int, int, int); +static void NEOCopyYV12Data(unsigned char *, unsigned char *, unsigned char *, + unsigned char *, int, int, int, int, int); + +static int NEOAllocSurface(ScrnInfoPtr, int, unsigned short, unsigned short, + XF86SurfacePtr); +static int NEOFreeSurface(XF86SurfacePtr); +static int NEODisplaySurface(XF86SurfacePtr, short, short, short, short, + short, short, short, short, RegionPtr clipBoxes); +static int NEOStopSurface(XF86SurfacePtr); +static int NEOGetSurfaceAttribute(ScrnInfoPtr, Atom, INT32 *); +static int NEOSetSurfaceAttribute(ScrnInfoPtr, Atom, INT32); + +static Atom xvColorKey, xvBrightness, xvInterlace; + +void +NEOInitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + NEOPtr nPtr = NEOPTR(pScrn); + XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int numAdaptors; + + numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors); + + if (nPtr->NeoChipset >= NM2160 + && !nPtr->noLinear + && nPtr->NeoMMIOBase2 != NULL){ + nPtr->video = TRUE; + newAdaptor = NEOSetupVideo(pScreen); + NEOInitOffscreenImages(pScreen); + } else + nPtr->video = FALSE; + + if (newAdaptor){ + if (!numAdaptors){ + numAdaptors = 1; + overlayAdaptors = &newAdaptor; + } else { + newAdaptors = xalloc((numAdaptors + 1) + * sizeof(XF86VideoAdaptorPtr*)); + if (newAdaptors){ + memcpy(newAdaptors, overlayAdaptors, + numAdaptors * sizeof(XF86VideoAdaptorPtr)); + newAdaptors[numAdaptors++] = newAdaptor; + overlayAdaptors = newAdaptors; + } + } + } + + if (numAdaptors) + xf86XVScreenInit(pScreen, overlayAdaptors, numAdaptors); + + if (newAdaptors) + xfree(newAdaptors); +} + +static XF86VideoEncodingRec NEOVideoEncodings[] = +{ + { + NEO_VIDEO_VIDEO, + "XV_VIDEO", + 1024, 1024, + {1, 1} + }, + { + NEO_VIDEO_IMAGE, + "XV_IMAGE", + 1024, 1024, + {1, 1} + } +}; + +static XF86VideoFormatRec NEOVideoFormats[] = +{ + { 8, PseudoColor }, + { 15, TrueColor }, + { 16, TrueColor }, + { 24, TrueColor }, +}; + +static XF86AttributeRec NEOVideoAttributes[] = +{ + { + XvSettable | XvGettable, + 0x000000, 0xFFFFFF, + "XV_COLORKEY" + }, + { + XvSettable | XvGettable, + -128, 127, + "XV_BRIGHTNESS" + }, + { + XvSettable | XvGettable, + 0,2, + "XV_INTERLACE" + }, +}; + +static XF86ImageRec NEOVideoImages[] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + { + FOURCC_RV15, + XvRGB, + LSBFirst, + { 'R', 'V' ,'1', '5', + 0x00,'5',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, + 15, 0x001F, 0x03E0, 0x7C00, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + { 'R', 'V', 'B' }, + XvTopToBottom + }, + { + FOURCC_RV16, + XvRGB, + LSBFirst, + { 'R', 'V' ,'1', '6', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + 16, + XvPacked, + 1, + 16, 0xF800, 0x07E0, 0x001F, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + { 'R', 'V', 'B' }, + XvTopToBottom + } +}; + +static XF86VideoAdaptorPtr +NEOSetupVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + NEOPtr nPtr = NEOPTR(pScrn); + NEOPortPtr pPriv; + XF86VideoAdaptorPtr overlayAdaptor; + int i; + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOSetupVideo\n"); +#endif + if ((overlayAdaptor = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(DevUnion) + + sizeof(NEOPortRec))) == NULL){ + return (NULL); + } + + overlayAdaptor->type = XvInputMask | XvImageMask | XvWindowMask + | XvOutputMask | XvVideoMask; + overlayAdaptor->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + overlayAdaptor->name = "NeoMagic Video Engine"; + overlayAdaptor->nEncodings = nElems(NEOVideoEncodings); + overlayAdaptor->pEncodings = NEOVideoEncodings; + for (i = 0; i < nElems(NEOVideoEncodings); i++){ + NEOVideoEncodings[i].width = 1024; + NEOVideoEncodings[i].height = 1024; + } + overlayAdaptor->nFormats = nElems(NEOVideoFormats); + overlayAdaptor->pFormats = NEOVideoFormats; + overlayAdaptor->nPorts = 1; + overlayAdaptor->pPortPrivates = (DevUnion*) &overlayAdaptor[1]; + overlayAdaptor->pPortPrivates[0].ptr = + (pointer) &overlayAdaptor->pPortPrivates[1]; + overlayAdaptor->nAttributes = nElems(NEOVideoAttributes); + overlayAdaptor->pAttributes = NEOVideoAttributes; + overlayAdaptor->nImages = nElems(NEOVideoImages); + overlayAdaptor->pImages = NEOVideoImages; + + overlayAdaptor->PutVideo = NEOPutVideo; + overlayAdaptor->PutStill = NULL; + overlayAdaptor->GetVideo = NULL; + overlayAdaptor->GetStill = NULL; + + overlayAdaptor->StopVideo = NEOStopVideo; + overlayAdaptor->SetPortAttribute = NEOSetPortAttribute; + overlayAdaptor->GetPortAttribute = NEOGetPortAttribute; + overlayAdaptor->QueryBestSize = NEOQueryBestSize; + overlayAdaptor->PutImage = NEOPutImage; + overlayAdaptor->QueryImageAttributes = NEOQueryImageAttributes; + + pPriv = (NEOPortPtr)overlayAdaptor->pPortPrivates[0].ptr; + pPriv->colorKey = nPtr->videoKey; + pPriv->interlace = nPtr->interlace; + pPriv->videoStatus = 0; + pPriv->brightness = 0; + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + nPtr->overlayAdaptor = overlayAdaptor; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvInterlace = MAKE_ATOM("XV_INTERLACE"); + + NEOResetVideo(pScrn); + + return (overlayAdaptor); +} + +void +NEOResetVideo(ScrnInfoPtr pScrn) +{ + NEOPtr nPtr = NEOPTR(pScrn); + NEOPortPtr pPriv = (NEOPortPtr)nPtr->overlayAdaptor->pPortPrivates[0].ptr; + int r, g, b; + VGA_HWP(pScrn); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOResetVideo\n"); +#endif + switch (pScrn->depth){ + case 8: + OUTGR(0xc6, pPriv->colorKey & 0); + OUTGR(0xc5, pPriv->colorKey & 0xff); + OUTGR(0xc7, pPriv->colorKey & 0); + break; + default: + r = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; + g = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green; + b = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; + OUTGR(0xc5, r); + OUTGR(0xc6, g); + OUTGR(0xc7, b); + break; + } + OUTGR(0xc4, pPriv->brightness); +} + +static int +NEOPutVideo(ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data) +{ + NEOPortPtr pPriv = (NEOPortPtr)data; + NEOPtr nPtr = NEOPTR(pScrn); + CARD32 src_pitch, offset; + int xscale, yscale; + BoxRec dstBox; + INT32 x1, y1, x2, y2; + int size, bpp; + unsigned char capctrl; + VGA_HWP(pScrn); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: src: %d %d %d %d\n", + src_x, src_y, src_w, src_h); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: drw: %d %d %d %d\n", + drw_x, drw_y, drw_w, drw_h); +#endif + if (src_w > 720) + src_w = 720; + if (src_h > 576) + src_h = 576; + if (pPriv->interlace != 2) + src_h /= 2; + x1 = src_x; + y1 = src_y; + x2 = src_x + src_w; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.y1 = drw_y; + dstBox.x2 = drw_x + drw_w; + dstBox.y2 = drw_y + drw_h; + + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, + clipBoxes, src_w, src_h)){ + return(Success); + } +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: %d %d %d %d\n", + x1, y1, x2, y2); +#endif + + dstBox.x1 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y2 -= pScrn->frameY0; +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: dstBox %d %d %d %d\n", + dstBox.x1, dstBox.y1, dstBox.x2, dstBox.y2); +#endif + + bpp = (pScrn->bitsPerPixel + 1) >> 3; + src_pitch = (src_w + 7) & ~7; + + xscale = 0x1000; + if (src_w <= drw_w){ + xscale = (src_w * 0x1000 / drw_w) & 0xffff; + } + + yscale = 0x1000; + if (src_h <= drw_h){ + yscale = (src_h * 0x1000 / drw_h) & 0xffff; + } + + size = src_h * src_pitch * 2; + + if (size > nPtr->overlay){ + if ((pPriv->linear = NEOAllocateMemory(pScrn, pPriv->linear, size)) + == NULL){ + return (BadAlloc); + } + } else { + pPriv->linear = NULL; + } + + if (pPriv->linear == NULL){ + offset = nPtr->overlay_offset; + } else { + offset = pPriv->linear->offset * bpp; + } + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: offset=0x%x\n", offset); +#endif + WAIT_ENGINE_IDLE(); + memset(nPtr->NeoFbBase + offset, 0, size); + + if (!RegionsEqual(&pPriv->clip, clipBoxes)){ + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, + clipBoxes); + } + + x1 >>= 16; + y1 >>= 16; + x2 >>= 16; + y2 >>= 16; + + switch (nPtr->NeoChipset) { + default: + case NM2160: + offset/=2; + OUTGR(0xbc, 0x4f); + break; + case NM2200: + case NM2230: + case NM2360: + case NM2380: + OUTGR(0xbc, 0x2e); + break; + } + + + OUTGR(0xb1, (((dstBox.x2-1) >> 4) & 0xf0) | ((dstBox.x1 >> 8) & 0x0f)); + OUTGR(0xb2, dstBox.x1); + OUTGR(0xb3, dstBox.x2 - 1); + OUTGR(0xb4, (((dstBox.y2 - 1) >> 4) & 0xf0) | ((dstBox.y1 >> 8) & 0x0f)); + OUTGR(0xb5, dstBox.y1); + OUTGR(0xb6, dstBox.y2 - 1); + OUTGR(0xb7, offset >> 16); + OUTGR(0xb8, offset >> 8); + OUTGR(0xb9, offset ); + OUTGR(0xba, src_pitch >> 8); + OUTGR(0xbb, src_pitch); + + OUTGR(0xc0, xscale >> 8); + OUTGR(0xc1, xscale); + OUTGR(0xc2, yscale >> 8); + OUTGR(0xc3, yscale); + OUTGR(0xbf, 0x02); + + OUTGR(0x0a, 0x21); + + OUTSR(0x0c, offset ); + OUTSR(0x0d, offset >> 8); + OUTSR(0x0e, offset >> 16); + OUTSR(0x1a, src_pitch); + OUTSR(0x1b, src_pitch>>8); + + OUTSR(0x17, 0 + x1); + OUTSR(0x18, 0 + x2 -1); + OUTSR(0x19, (((0 + x2 - 1) >> 4) & 0xf0) | (((0 + x1) >> 8) & 0x0f)); + + OUTSR(0x14, 14 + y1); + OUTSR(0x15, 14 + y2 - 2); + OUTSR(0x16, (((14 + y2 - 1) >> 4) & 0xf0) | (((14 + y1) >> 8) & 0x0f)); + + OUTSR(0x1c, 0xfb); + OUTSR(0x1d, 0x00); + OUTSR(0x1e, 0xe2); + OUTSR(0x1f, 0x02); + + OUTSR(0x09, 0x11); + OUTSR(0x0a, 0x00); + + capctrl = 0x21; + switch (pPriv->interlace){ + case 0: /* Combine 2 fields */ + break; + case 1: /* one field only */ + capctrl |= 0x80; + break; + case 2: /* Interlaced fields */ + capctrl |= 0x40; + break; + } + OUTSR(0x08, capctrl); + +#if 0 + OUTGR(0x0a, 0x01); +#endif + OUTGR(0xb0, 0x03); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + return (Success); +} + +static void +NEOStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + NEOPortPtr pPriv = (NEOPortPtr)data; + NEOPtr nPtr = NEOPTR(pScrn); + VGA_HWP(pScrn); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOStopVideo\n"); +#endif + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if (exit){ + if (pPriv->videoStatus & CLIENT_VIDEO_ON){ +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOStopVideo: stop capture\n"); +#endif + OUTGR(0xb0, 0x02); + OUTGR(0x0a, 0x21); + OUTSR(0x08, 0xa0); +#if 0 + OUTGR(0x0a, 0x01); +#endif + } + if (pPriv->linear != NULL){ + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } else { + if (pPriv->videoStatus & CLIENT_VIDEO_ON){ + OUTGR(0xb0, 0x02); + OUTGR(0x0a, 0x21); + OUTSR(0x08, 0xa0); +#if 0 + OUTGR(0x0a, 0x01); +#endif + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + +static int +NEOSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, + pointer data) +{ + NEOPortPtr pPriv = (NEOPortPtr)data; + NEOPtr nPtr = NEOPTR(pScrn); + VGA_HWP(pScrn); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOSetPortAttribute\n"); +#endif + if (attribute == xvColorKey){ + int r, g, b; + + pPriv->colorKey = value; + switch (pScrn->depth){ + case 8: + OUTGR(0xc6, pPriv->colorKey & 0xff); + OUTGR(0xc5, 0x00); + OUTGR(0xc7, 0x00); + break; + default: + r = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; + g = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green; + b = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; + OUTGR(0xc5, r); + OUTGR(0xc6, g); + OUTGR(0xc7, b); + } + } else if (attribute == xvBrightness){ + if ((value < -128) || (value > 127)){ + return (BadValue); + } + pPriv->brightness = value; + OUTGR(0xc4, value); + } else if (attribute == xvInterlace){ + if (value < 0 || value > 2){ + return (BadValue); + } + pPriv->interlace = value; + } else { + return (BadMatch); + } + return (Success); +} + +static int +NEOGetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value, + pointer data) +{ + NEOPortPtr pPriv = (NEOPortPtr)data; + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOGetPortAttribute\n"); +#endif + if (attribute == xvColorKey){ + *value = pPriv->colorKey; + } else if (attribute == xvBrightness){ + *value = pPriv->brightness; + } else if (attribute == xvInterlace){ + *value = pPriv->interlace; + } else { + return (BadMatch); + } + return (Success); +} + +static void +NEOQueryBestSize(ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data) +{ +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOQueryBestSize\n"); +#endif + *p_w = min(drw_w, 1024); + *p_h = min(drw_h, 1024); +} + +static int +NEOPutImage(ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + int id, unsigned char *buf, short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data) +{ + NEOPtr nPtr = NEOPTR(pScrn); + NEOPortPtr pPriv = (NEOPortPtr)nPtr->overlayAdaptor->pPortPrivates[0].ptr; + INT32 x1, y1, x2, y2; + int bpp; + int srcPitch, srcPitch2 = 0, dstPitch, size; + BoxRec dstBox; + CARD32 offset, offset2 = 0, offset3 = 0, tmp; + int left, top, nPixels, nLines; + unsigned char *dstStart; + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutImage\n"); +#endif + + x1 = src_x; + y1 = src_y; + x2 = src_x + src_w; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.y1 = drw_y; + dstBox.x2 = drw_x + drw_w; + dstBox.y2 = drw_y + drw_h; + + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, + clipBoxes, width, height)){ + return (Success); + } + + dstBox.x1 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y2 -= pScrn->frameY0; + + bpp = ((pScrn->bitsPerPixel + 1) >> 3); + + switch (id){ + case FOURCC_YV12: + srcPitch = (width + 3) & ~3; + offset2 = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offset3 = offset2 + (srcPitch2 * (height >> 1)); + dstPitch = ((width << 1) + 15) & ~15; + break; + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + offset3 = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offset2 = offset3 + (srcPitch2 * (height >> 1)); + dstPitch = ((width << 1) + 15) & ~15; + break; + case FOURCC_YUY2: + case FOURCC_RV15: + case FOURCC_RV16: + default: + srcPitch = width << 1; + dstPitch = (srcPitch + 15) & ~15; + break; + } + + size = dstPitch * height; + if (size > nPtr->overlay){ + if ((pPriv->linear = NEOAllocateMemory(pScrn, pPriv->linear, size)) + == NULL){ + return (BadAlloc); + } + } else { + pPriv->linear = NULL; + } + + top = y1 >> 16; + left = (x1 >> 16) & ~1; + nPixels = ((((x2 + 0xFFFF) >> 16) + 1) & ~1) - left; + left <<= 1; + + if (pPriv->linear == NULL){ + offset = nPtr->overlay_offset; + } else { + offset = pPriv->linear->offset * bpp; + } + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"offset=%x\n", offset); +#endif + + dstStart = (unsigned char *)(nPtr->NeoFbBase + offset + left); + + switch (id){ + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 2); + offset2 += tmp; + offset3 += tmp; + nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top; + NEOCopyYV12Data(buf + (top * srcPitch) + (left >> 1), buf + offset2, + buf + offset3, dstStart, srcPitch, srcPitch2, + dstPitch, nLines, nPixels); + break; + default: + buf += (top * srcPitch) + left; + nLines = ((y2 + 0xFFFF) >> 16) - top; + NEOCopyData(buf, dstStart, srcPitch, dstPitch, nLines, nPixels << 1); + } + + if (!RegionsEqual(&pPriv->clip, clipBoxes)){ + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); + } + NEODisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, + x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + return (Success); + +} + +static int +NEOQueryImageAttributes(ScrnInfoPtr pScrn, int id, + unsigned short *width, unsigned short *height, + int *pitches, int *offsets) +{ + int size, tmp; + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOQueryImageAttributes\n"); +#endif + if (*width > 1024){ + *width = 1024; + } + if (*height > 1024){ + *height = 1024; + } + + *width = (*width + 1) & ~1; + if (offsets != NULL){ + offsets[0] = 0; + } + + switch (id){ + case FOURCC_YV12: + case FOURCC_I420: + *height = (*height + 1) & ~1; + size = (*width + 3) & ~3; + if (pitches != NULL){ + pitches[0] = size; + } + size *= *height; + if (offsets != NULL){ + offsets[1] = size; + } + tmp = ((*width >> 1) + 3) & ~3; + if (pitches != NULL){ + pitches[1] = pitches[2] = tmp; + } + tmp *= (*height >> 1); + size += tmp; + if (offsets != NULL){ + offsets[2] = size; + } + size += tmp; + break; + case FOURCC_YUY2: + case FOURCC_RV15: + case FOURCC_RV16: + default: + size = *width * 2; + if (pitches != NULL){ + pitches[0] = size; + } + size *= *height; + break; + } + return (size); +} + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)){ + return (FALSE); + } + + if ((A->extents.x1 != B->extents.x1) + || (A->extents.y1 != B->extents.y1) + || (A->extents.x2 != B->extents.x2) + || (A->extents.y2 != B->extents.y2)){ + return (FALSE); + } + + dataA = (int*) REGION_RECTS(A); + dataB = (int*) REGION_RECTS(B); + + while (num--){ + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])){ + return (FALSE); + } + dataA += 2; + dataB += 2; + } + return (TRUE); +} + +static void +NEODisplayVideo(ScrnInfoPtr pScrn, int id, int offset, + short width, short height, int pitch, + int x1, int y1, int x2, int y2, BoxPtr dstBox, + short src_w, short src_h, short drw_w, short drw_h) +{ + NEOPtr nPtr = NEOPTR(pScrn); + int hstretch, vstretch, fmt; + VGA_HWP(pScrn); +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEODisplayVideo\n"); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEODisplayVideo src_w=%d, src_h=%d, pitch=%d, drw_w=%d, drw_h=%d\n", src_w, src_h, pitch, drw_w, drw_h); +#endif +#define WIDTH_THRESHOLD 160 + if (dstBox->x2 >= pScrn->virtualX) { + /* + * This is a hack to work around a problem when video is moved + * accross the right border. + */ + int diff_s = (width - ((x2 - x1) >> 16)) & ~1; + int diff_d = (drw_w - dstBox->x2 + dstBox->x1) & ~1; + + offset -= 2 * ((diff_s > diff_d) ? diff_d : diff_s); + dstBox->x1 -= diff_d; + } else if (dstBox->x2 - dstBox->x1 < WIDTH_THRESHOLD) { + /* + * When the video window is less than about 160 pixel wide + * it will be distoreted. We attempt to fix it by actually + * making it wider and relying on the color key to prevent + * it from appearing outside of the video. + */ + int pre, post; + int scale = 1; + + if (dstBox->x1 < WIDTH_THRESHOLD) { + pre = dstBox->x1; + post = 160 - pre; + } else { + pre = 160; + post = 0; + } + offset -= 2 * scale * pre; + dstBox->x1 -= pre; + dstBox->x2 += post; + } + if (nPtr->videoHZoom != 1.0) { + if ((dstBox->x2 += 5) > pScrn->virtualX) + dstBox->x2 = pScrn->virtualX; + if (dstBox->x1 > 0) dstBox->x1 += 2; + } + + fmt = 0x00; + switch (id){ + case FOURCC_YV12: + case FOURCC_I420: + case FOURCC_YUY2: + fmt = 0x00; + break; + case FOURCC_RV15: + case FOURCC_RV16: + fmt = 0x20; + break; + } + + offset += (x1 >> 15) & ~0x03; + + switch (nPtr->NeoChipset) { + default: + case NM2160: + offset/=2; + pitch/=2; + OUTGR(0xbc, 0x4f); + break; + case NM2200: + case NM2230: + case NM2360: + case NM2380: + OUTGR(0xbc, 0x2e); + break; + } + + /* factor 4 for granularity */ + hstretch = (double)0x1000 * 4 / (int)(nPtr->videoHZoom * 4); + if (drw_w > src_w) + hstretch = (((int)src_w) * hstretch) / (int) drw_w; + + vstretch = (double)0x1000 / nPtr->videoVZoom; + if (drw_h > src_h) + vstretch = (((int)src_h) * vstretch )/ (int) drw_h; + + OUTGR(0xb1, (((dstBox->x2 - 1) >> 4) & 0xf0) | ((dstBox->x1 >> 8) & 0x0f)); + OUTGR(0xb2, dstBox->x1); + OUTGR(0xb3, dstBox->x2 - 1); + OUTGR(0xb4, (((dstBox->y2 - 1) >> 4) & 0xf0) | ((dstBox->y1 >> 8) & 0x0f)); + OUTGR(0xb5, dstBox->y1); + OUTGR(0xb6, dstBox->y2 - 1); + OUTGR(0xb7, offset >> 16); + OUTGR(0xb8, offset >> 8); + OUTGR(0xb9, offset ); + OUTGR(0xba, pitch >> 8); + OUTGR(0xbb, pitch); + + OUTGR(0xbd, 0x02); + OUTGR(0xbe, 0x00); + OUTGR(0xbf, 0x02); + + OUTGR(0xc0, hstretch >> 8); + OUTGR(0xc1, hstretch); + OUTGR(0xc2, vstretch >> 8); + OUTGR(0xc3, vstretch); + + OUTGR(0xb0, fmt | 0x03); + + OUTGR(0x0a, 0x21); + OUTSR(0x08, 0xa0); + OUTGR(0x0a, 0x01); +} + +static void +NEOInitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + +#ifdef DEBUG + xf86DrvMsg(xf86Screens[pScreen->myNum]->scrnIndex,X_INFO,"NEOInitOffscreenImages\n"); +#endif + if ((offscreenImages = xalloc(sizeof(XF86OffscreenImageRec))) == NULL){ + return; + } + + offscreenImages->image = NEOVideoImages; + offscreenImages->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages->alloc_surface = NEOAllocSurface; + offscreenImages->free_surface = NEOFreeSurface; + offscreenImages->display = NEODisplaySurface; + offscreenImages->stop = NEOStopSurface; + offscreenImages->getAttribute = NEOGetSurfaceAttribute; + offscreenImages->setAttribute = NEOSetSurfaceAttribute; + offscreenImages->max_width = 1024; + offscreenImages->max_height = 1024; + offscreenImages->num_attributes = nElems(NEOVideoAttributes); + offscreenImages->attributes = NEOVideoAttributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + +static FBLinearPtr +NEOAllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size) +{ + ScreenPtr pScreen; + FBLinearPtr new_linear; + int bytespp = pScrn->bitsPerPixel >> 3; + + /* convert size in bytes into number of pixels */ + size = (size + bytespp - 1) / bytespp; +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO, + "NEOAllocateMemory: linear=%x, size=%d\n", linear, size); +#endif + if (linear){ +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO, + "NEOAllocateMemory: linear->size=%d\n", linear->size); +#endif + if (linear->size >= size){ + return (linear); + } + + if (xf86ResizeOffscreenLinear(linear, size)){ + return (linear); + } + + xf86FreeOffscreenLinear(linear); + } + + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + if ((new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16, NULL, + NULL, NULL)) == NULL){ + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 16, + PRIORITY_EXTREME); +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO, + "NEOAllocateMemory: max_size=%d\n", max_size); +#endif + if (max_size < size){ + return (NULL); + } + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, + size, 16, NULL, NULL, NULL); + } + + return (new_linear); +} + +static void +NEOCopyData(unsigned char *src, unsigned char *dst, + int srcPitch, int dstPitch, + int height, int width) +{ + while (height-- > 0){ + memcpy(dst, src, width); + src += srcPitch; + dst += dstPitch; + } +} + +static void +NEOCopyYV12Data(unsigned char *src1, unsigned char *src2, + unsigned char *src3, unsigned char *dst, + int srcPitch1, int srcPitch2, int dstPitch, + int height, int width) +{ + CARD32 *pDst = (CARD32 *) dst; + int i; + + width >>= 1; + height >>= 1; + dstPitch >>= 2; + while (--height >= 0){ + for (i =0; i < width; i++){ + pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | + (src3[i] << 8) | (src2[i] << 24); + } + pDst += dstPitch; + src1 += srcPitch1; + + for (i =0; i < width; i++){ + pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | + (src3[i] << 8) | (src2[i] << 24); + } + pDst += dstPitch; + src1 += srcPitch1; + src2 += srcPitch2; + src3 += srcPitch2; + } +} + +static int +NEOAllocSurface(ScrnInfoPtr pScrn, int id, + unsigned short width, unsigned short height, + XF86SurfacePtr surface) +{ + int pitch, bpp, size; + NEOOffscreenPtr pPriv; + FBLinearPtr linear; + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOAllocSurface\n"); +#endif + if (width > 1024 || height > 1024){ + return (BadAlloc); + } + + width = (width + 1) & ~1; + bpp = ((pScrn->bitsPerPixel + 1) >> 3); + pitch = ((width << 1) + 15) & ~15; + size = pitch * height; + + if ((linear = NEOAllocateMemory(pScrn, NULL, size)) == NULL){ + return (BadAlloc); + } + + surface->width = width; + surface->height = height; + if ((surface->pitches = xalloc(sizeof(int))) == NULL){ + xf86FreeOffscreenLinear(linear); + return (BadAlloc); + } + if ((surface->offsets = xalloc(sizeof(int))) == NULL){ + xfree(surface->pitches); + xf86FreeOffscreenLinear(linear); + return (BadAlloc); + } + + if ((pPriv = xalloc(sizeof(NEOOffscreenRec))) == NULL){ + xfree(surface->pitches); + xfree(surface->offsets); + xf86FreeOffscreenLinear(linear); + return (BadAlloc); + } + + pPriv->linear = linear; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = linear->offset << 1; + surface->devPrivate.ptr = (pointer)pPriv; + return (Success); +} + +static int +NEOFreeSurface(XF86SurfacePtr surface) +{ + NEOOffscreenPtr pPriv = (NEOOffscreenPtr)surface->devPrivate.ptr; + +#ifdef DEBUG + xf86DrvMsg(0,X_INFO,"NEOFreeSurface\n"); +#endif + if (pPriv->isOn) + NEOStopSurface(surface); + + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + return (Success); +} + +static int +NEODisplaySurface(XF86SurfacePtr surface, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + RegionPtr clipBoxes) +{ + NEOOffscreenPtr pPriv = (NEOOffscreenPtr)surface->devPrivate.ptr; + NEOPtr nPtr = NEOPTR(surface->pScrn); + NEOPortPtr portPriv = nPtr->overlayAdaptor->pPortPrivates[0].ptr; + INT32 x1, y1, x2, y2; + BoxRec dstBox; + +#ifdef DEBUG + xf86DrvMsg(surface->pScrn->scrnIndex,X_INFO,"NEODisplaySurface\n"); +#endif + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + if (!xf86XVClipVideoHelper( &dstBox, &x1, &x2, &y1, &y2, + clipBoxes, surface->width, surface->height)){ + return (Success); + } + + dstBox.x1 -= surface->pScrn->frameX0; + dstBox.y1 -= surface->pScrn->frameY0; + dstBox.x2 -= surface->pScrn->frameX0; + dstBox.y2 -= surface->pScrn->frameY0; + + xf86XVFillKeyHelper(surface->pScrn->pScreen, portPriv->colorKey, + clipBoxes); + NEOResetVideo(surface->pScrn); + NEODisplayVideo(surface->pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->isOn = TRUE; + if (portPriv->videoStatus & CLIENT_VIDEO_ON){ + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + return (Success); +} + +static int +NEOStopSurface(XF86SurfacePtr surface) +{ + NEOOffscreenPtr pPriv = (NEOOffscreenPtr)surface->devPrivate.ptr; + +#ifdef DEBUG + xf86DrvMsg(surface->pScrn->scrnIndex,X_INFO,"NEOStopSurface\n"); +#endif + if (pPriv->isOn){ + NEOPtr nPtr = NEOPTR(surface->pScrn); + VGA_HWP(surface->pScrn); + OUTGR(0xb0, 0x02); + pPriv->isOn = FALSE; + } + return (Success); +} + +static int +NEOGetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 *value) +{ + NEOPtr nPtr = NEOPTR(pScrn); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOGetSurfaceAttribute\n"); +#endif + return (NEOGetPortAttribute(pScrn, + attr, value, (pointer)nPtr->overlayAdaptor->pPortPrivates[0].ptr)); +} + +static int +NEOSetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 value) +{ + NEOPtr nPtr = NEOPTR(pScrn); + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOSetSurfaceAttribute\n"); +#endif + return (NEOSetPortAttribute(pScrn, + attr, value, (pointer)nPtr->overlayAdaptor->pPortPrivates[0].ptr)); +} + +#else /* XvExtension */ + +void NEOInitVideo(ScreenPtr pScreen) {} +void NEOResetVideo(ScreenPtr pScreen) {} + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.h:1.2 --- /dev/null Thu Feb 27 12:31:08 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.h Sun Jun 30 22:25:58 2002 @@ -0,0 +1,84 @@ +/********************************************************************** +Copyright 2002 by Shigehiro Nomura. + + All Rights Reserved + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Shigehiro Nomura not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. Shigehiro Nomura +and its suppliers make no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty. + +SHIGEHIRO NOMURA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL SHIGEHIRO NOMURA AND/OR ITS SUPPLIERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +**********************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.h,v 1.2 2002/07/01 02:25:58 tsi Exp $ */ + +#ifndef _NEO_VIDEO_H +#define _NEO_VIDEO_H + +#define ACC_MMIO + +#include "vgaHW.h" +#include "fourcc.h" +#include "Xv.h" + +#define NEO_VIDEO_VIDEO 0 +#define NEO_VIDEO_IMAGE 1 + +#define FOURCC_RV15 0x35315652 +#define FOURCC_RV16 0x36315652 + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 /* milliseconds */ + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +typedef struct +{ + FBLinearPtr linear; + RegionRec clip; + CARD32 colorKey; + CARD32 interlace; + CARD32 brightness; + CARD32 videoStatus; + Time offTime; + Time freeTime; +} NEOPortRec, *NEOPortPtr; + +typedef struct +{ + FBLinearPtr linear; + Bool isOn; +} NEOOffscreenRec, *NEOOffscreenPtr; + +/* I/O Functions */ +# define OUTGR(idx,dat) \ + if (nPtr->NeoMMIOBase2) \ + (*(unsigned short *)(nPtr->NeoMMIOBase2+VGA_GRAPH_INDEX)\ + =(idx)|((dat)<<8));\ + else \ + VGAwGR((idx),(dat)); + +# define OUTSR(idx,dat) \ +if (nPtr->NeoMMIOBase2) \ + (*(unsigned short *)(nPtr->NeoMMIOBase2+VGA_SEQ_INDEX)=(idx)|((dat)<<8));\ +else \ + VGAwSR((idx),(dat)); + +# define VGA_HWP(x) vgaHWPtr hwp = VGAHWPTR(x) + +#endif /* _NEO_VIDEO_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.3 Mon Dec 17 15:52:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man Wed Feb 19 22:22:52 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.3 2001/12/17 20:52:32 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.4 2003/02/20 03:22:52 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH NEOMAGIC __drivermansuffix__ __vendorversion__ @@ -72,6 +72,13 @@ .TP .BI "Option \*qShadowFB\*q \*q" boolean \*q Enable or disable use of the shadow framebuffer layer. Default: off. +.TP +.BI "Option \*qOverlayMem\*q \*q" integer \*q +Reserve the given amount of memory (in bytes) for the XVideo overlay. On +boards with limited memory, display of large XVideo buffers might fail due +to insufficient available memory. Using this option solves the problem at +the expense of reducing the memory avilable for other operations. For +full\-resolution DVDs, 829440 bytes (720x576x2) are necessary. .PP .B Note .br Index: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile:1.4 Wed May 16 02:48:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile Mon Dec 9 23:03:00 2002 @@ -1,11 +1,11 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.4 2001/05/16 06:48:09 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.5 2002/12/10 04:03:00 dawes Exp $ #define IHaveModules #include <Server.tmpl> -SRCS = newport_driver.c newport_regs.c newport_cmap.c newport_shadow.c +SRCS = newport_driver.c newport_regs.c newport_cmap.c newport_shadow.c newport_cursor.c -OBJS = newport_driver.o newport_regs.o newport_cmap.o newport_shadow.o +OBJS = newport_driver.o newport_regs.o newport_cmap.o newport_shadow.o newport_cursor.o XF86CONFIG = XF86Config.indy Index: xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy:1.2 Thu Dec 14 15:59:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy Wed Feb 19 23:05:15 2003 @@ -27,7 +27,7 @@ # dealings in this Software without prior written authorization from the # XFree86 Project. # -# $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy,v 1.2 2000/12/14 20:59:12 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy,v 1.3 2003/02/20 04:05:15 dawes Exp $ # ********************************************************************** # This is a configuration file for the Indy's Newport Graphics and the @@ -106,6 +106,12 @@ # provide a better stack trace in the core dump to aid in debugging # Option "NoTrapSignals" + +# Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence +# (where n is 1 through 12). This allows clients to receive these key +# events. + +# Option "DontVTSwitch" # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence # This allows clients to receive this key event. Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.8 Wed Dec 19 16:31:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h Mon Dec 9 23:03:00 2002 @@ -1,7 +1,7 @@ /* * Id: newport.h,v 1.4 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.8 2001/12/19 21:31:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.10 2002/12/10 04:03:00 dawes Exp $ */ #ifndef __NEWPORT_H__ #define __NEWPORT_H__ @@ -25,7 +25,7 @@ #include "newport_regs.h" #define NEWPORT_BASE_ADDR0 0x1f0f0000 -#define NEWPORT_BASE_OFFSET 0x0040000 +#define NEWPORT_BASE_OFFSET 0x00400000 #define NEWPORT_MAX_BOARDS 4 #if 0 @@ -47,14 +47,21 @@ int bitplanes; /* revision numbers of the various pieces of silicon */ unsigned int board_rev, cmap_rev, rex3_rev, xmap9_rev, bt445_rev; + /* shadow copies of frequently used registers */ NewportRegsPtr pNewportRegs; /* Pointer to REX3 registers */ npireg_t drawmode1; /* REX3 drawmode1 common to all drawing operations */ + CARD16 vc2ctrl; /* VC2 control register */ /* ShadowFB stuff: */ - pointer ShadowPtr; + CARD32* ShadowPtr; unsigned long int ShadowPitch; unsigned int Bpp; /* Bytes per pixel */ + /* HWCursour stuff: */ + Bool hwCursor; + xf86CursorInfoPtr CursorInfoRec; + CARD16 curs_cmap_base; /* MSB of the cursor's cmap */ + /* wrapped funtions: */ CloseScreenProcPtr CloseScreen; @@ -67,13 +74,20 @@ npireg_t txt_smask2x; /* Rex3 screen mask 2 registers */ npireg_t txt_smask2y; npireg_t txt_clipmode; /* Rex3 clip mode register */ + + CARD16 txt_vc2ctrl; /* VC2 control register */ + CARD16 txt_vc2cur_x; /* VC2 hw cursor x location */ + CARD16 txt_vc2cur_y; /* VC2 hw cursor x location */ + CARD32 txt_vc2cur_data[64]; /* VC2 hw cursor glyph data */ - unsigned short txt_vc2ctrl; /* VC2 control register */ CARD8 txt_xmap9_cfg0; /* 0. Xmap9's control register */ CARD8 txt_xmap9_cfg1; /* 1. Xmap9's control register */ + CARD8 txt_xmap9_ccmsb; /* cursor cmap msb */ CARD8 txt_xmap9_mi; /* Xmap9s' mode index register */ CARD32 txt_xmap9_mod0; /* Xmap9s' mode 0 register */ + LOCO txt_colormap[256]; + OptionInfoPtr Options; } NewportRec, *NewportPtr; @@ -91,15 +105,24 @@ void NewportRestoreRex3( ScrnInfoPtr pScrn); void NewportBackupXmap9s( ScrnInfoPtr pScrn); void NewportRestoreXmap9s( ScrnInfoPtr pScrn); +void NewportBackupVc2( ScrnInfoPtr pScrn); +void NewportRestoreVc2( ScrnInfoPtr pScrn); +void NewportBackupVc2Cursor( ScrnInfoPtr pScrn); +void NewportRestoreVc2Cursor( ScrnInfoPtr pScrn); /* newort_cmap.c */ void NewportLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO* colors, VisualPtr pVisual); void NewportRestorePalette(ScrnInfoPtr pScrn); void NewportBackupPalette(ScrnInfoPtr pScrn); +void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color); /* newport_shadow.c */ void NewportRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void NewportRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +/* newport_cursor.c */ +Bool NewportHWCursorInit(ScreenPtr pScreen); +void NewportLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits); #endif /* __NEWPORT_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.3 Fri Nov 23 14:50:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man Mon Feb 17 18:06:11 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man,v 1.3 2001/11/23 19:50:45 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man,v 1.4 2003/02/17 23:06:11 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH NEWPORT __drivermansuffix__ __vendorversion__ @@ -14,28 +14,32 @@ .fi .SH DESCRIPTION .B newport -is an XFree86 driver for the SGI Indy's newport video cards. +is an XFree86 driver for the SGI Indy's and Indigo2's newport video cards. .SH SUPPORTED HARDWARE The .B newport -driver supports the Newport(sometimes called XL) cards found in SGI Indys. It -does not support the XZ boards. It supports both the 8bit and 24bit versions -of the Newport. +driver supports the Newport (also called XL) cards found in SGI Indys and Indigo2s. +It supports both the 8bit and 24bit versions of the Newport. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. .PP -The driver auto-detects all device information necessary to initialize -the card. However, if you have problems with auto-detection, you can -specify: +The following driver options are supported: .br .TP .BI "Option \*qbitplanes\*q \*q" integer \*q number of bitplanes of the board (8 or 24) Default: auto-detected. +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.PP +.TP +.BI "Option \*qBusID\*q \*q"integer \*q +Set to 1 for the Indigo2 XL. Default: 0 .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Authors: -Guido GÜnther \fIagx@sigxcpu.org\fP +Guido GÜnther \fIagx@sigxcpu.org\fP Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c:1.2 Fri Nov 23 14:50:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c Mon Dec 9 23:03:00 2002 @@ -1,12 +1,18 @@ /* * Id: newport_cmap.c,v 1.1 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c,v 1.2 2001/11/23 19:50:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c,v 1.3 2002/12/10 04:03:00 dawes Exp $ */ #include "newport.h" -static void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color); +#ifndef USEFIFOWAIT +#define USEFIFOWAIT 0 +#endif + static void NewportCmapGetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO *color); +#if USEFIFOWAIT +static void NewportCmapFifoWait( NewportRegsPtr pNewportRegs); +#endif /* Load a colormap into the hardware */ void NewportLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, \ @@ -33,19 +39,53 @@ } } +#ifdef linux +/* stolen from kernel :) */ +static unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7, + 8,12,10,14, 9,13,11,15 }; + +/* the default colour table, for VGA+ colour systems */ +static int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa, + 0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff}; +static int default_grn[] = {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa, + 0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff}; +static int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa, + 0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff}; +#endif + /* restore the default colormap */ void NewportRestorePalette(ScrnInfoPtr pScrn) { int i; NewportPtr pNewport = NEWPORTPTR(pScrn); +#ifdef linux + for (i = 0; i < 16; i++) { + pNewport->txt_colormap[color_table[i]].red = default_red[i]; + pNewport->txt_colormap[color_table[i]].green = default_grn[i]; + pNewport->txt_colormap[color_table[i]].blue = default_blu[i]; + } +#endif for(i = 0; i < 256; i++) { NewportCmapSetRGB(pNewport->pNewportRegs, i, pNewport->txt_colormap[i]); } } +#if USEFIFOWAIT +/* wait 'til cmap fifo is completely empty */ +static void NewportCmapFifoWait(NewportRegsPtr pNewportRegs) +{ + while(1) { + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACM0 | NCMAP_PROTOCOL | + NCMAP_REGADDR_SREG | NPORT_DMODE_W1); + if(!(pNewportRegs->set.dcbdata0.bytes.b3 & 4)) + break; + } +} +#endif + /* set the colormap entry at addr to color */ -static void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color) +void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color) { NewportWait(pNewportRegs); /* this one should not be necessary */ NewportBfwait(pNewportRegs); Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cursor.c:1.1 --- /dev/null Thu Feb 27 12:31:08 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cursor.c Mon Dec 9 23:03:00 2002 @@ -0,0 +1,165 @@ +/* + * newport_cursor.c + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cursor.c,v 1.1 2002/12/10 04:03:00 dawes Exp $ */ + +#include "newport.h" +#include "cursorstr.h" + +#include "servermd.h" + +#define MAX_CURS 32 + +static void NewportShowCursor(ScrnInfoPtr pScrn); +static void NewportHideCursor(ScrnInfoPtr pScrn); +static void NewportSetCursorPosition(ScrnInfoPtr pScrn, int x, int y); +static void NewportSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); +/* static void NewportLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits); */ +static unsigned char* NewportRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs); + +Bool +NewportHWCursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + xf86CursorInfoPtr infoPtr; + CARD16 tmp; + + infoPtr = xf86CreateCursorInfoRec(); + if(!infoPtr) + return FALSE; + + pNewport->CursorInfoRec = infoPtr; + infoPtr->MaxWidth = MAX_CURS; + infoPtr->MaxHeight = MAX_CURS; + infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; + + infoPtr->SetCursorColors = NewportSetCursorColors; + infoPtr->SetCursorPosition = NewportSetCursorPosition; + infoPtr->LoadCursorImage = NewportLoadCursorImage; + infoPtr->HideCursor = NewportHideCursor; + infoPtr->ShowCursor = NewportShowCursor; + infoPtr->RealizeCursor = NewportRealizeCursor; + infoPtr->UseHWCursor = NULL; + + /* enable cursor funtion in shadow register */ + pNewport->vc2ctrl |= VC2_CTRL_ECURS; + /* enable glyph cursor, maximum size is 32x32x2 */ + pNewport->vc2ctrl &= ~( VC2_CTRL_ECG64 | VC2_CTRL_ECCURS); + /* setup hw cursors cmap base address */ + NewportBfwait(pNewportRegs); + pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_CURS_CMAP_MSB | NPORT_DMODE_W1 ); + tmp = pNewportRegs->set.dcbdata0.bytes.b3; +#if 0 + /* The docs say we can change base address of the cursors + * cmap entries, but it doesn't work. */ + tmp++; +#endif + pNewportRegs->set.dcbmode = (DCB_XMAP0 | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_CURS_CMAP_MSB | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = tmp; + pNewport->curs_cmap_base = (tmp << 5) & 0xffe0; + + return xf86InitCursor(pScreen, infoPtr); +} + + +static void NewportShowCursor(ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + pNewport->vc2ctrl |= VC2_CTRL_ECDISP; + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->vc2ctrl); +} + +static void NewportHideCursor(ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + pNewport->vc2ctrl &= ~VC2_CTRL_ECDISP; + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->vc2ctrl); +} + +static void NewportSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + CARD16 x_off; + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + NewportPtr pNewport = NEWPORTPTR(pScrn); + + /* the docu says this should always be 31, but it isn't */ + x_off = 31; + if ( pNewport->board_rev < 6 ) + x_off = 21; + NewportVc2Set( pNewportRegs, VC2_IREG_CURSX, (CARD16) x + x_off); + NewportVc2Set( pNewportRegs, VC2_IREG_CURSY, (CARD16) y + 31); +} + +static void NewportSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + LOCO color; + + color.blue = bg & 0xff; + color.green = (bg & 0xff00) >> 8; + color.red = (bg & 0xff0000) >> 16; + NewportCmapSetRGB( pNewportRegs, pNewport->curs_cmap_base+2, color); + + color.blue = fg & 0xff; + color.green = (fg & 0xff00) >> 8; + color.red = (fg & 0xff0000) >> 16; + NewportCmapSetRGB( pNewportRegs, pNewport->curs_cmap_base+1, color); +} + +static unsigned char* NewportRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) +{ + int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; + CARD32 *mem, *SrcS, *SrcM, *DstS; + unsigned int i; + + if (!(mem = xcalloc(1, size))) + return NULL; + + SrcS = (CARD32*)pCurs->bits->source; + SrcM = (CARD32*)pCurs->bits->mask; + DstS = mem; + /* first color: maximum is 32*4 Bytes */ + for(i=0; i < pCurs->bits->height; i++) { + *DstS = *SrcS & *SrcM; + DstS++, SrcS++, SrcM++; + } + /* second color is the lower of mem: again 32*4 Bytes at most */ + DstS = mem + MAX_CURS; + SrcS = (CARD32*)pCurs->bits->source; + SrcM = (CARD32*)pCurs->bits->mask; + for(i=0; i < pCurs->bits->height; i++) { + *DstS = (~*SrcS) & *SrcM; + DstS++, SrcS++, SrcM++; + } + return (unsigned char*) mem; +} + +void NewportLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits) +{ + int i; + CARD16 tmp; + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + /* address of cursor data in vc2's ram */ + tmp = NewportVc2Get( pNewportRegs, VC2_IREG_CENTRY); + /* this is where we want to write to: */ + NewportVc2Set( pNewportRegs, VC2_IREG_RADDR, tmp); + pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM | + NPORT_DMODE_W2 | VC2_PROTOCOL); + /* write cursor data */ + for (i = 0; i < ((MAX_CURS * MAX_CURS) >> 3); i++) { + NewportBfwait(pNewportRegs); + pNewportRegs->set.dcbdata0.hwords.s1 = *(unsigned short*)bits; + bits += sizeof(unsigned short); + } +} + Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.19 Fri Jan 4 16:22:33 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c Tue Feb 18 14:10:36 2003 @@ -5,7 +5,7 @@ * * This driver is based on the newport.c & newport_con.c kernel code * - * (c) 2000,2001 Guido Guenther <agx@sigxcpu.org> + * (c) 2000-2002 Guido Guenther <agx@sigxcpu.org> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,7 +30,7 @@ * Project. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.19 2002/01/04 21:22:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.24 2003/02/18 19:10:36 alanh Exp $ */ /* function prototypes, common data structures & generic includes */ #include "newport.h" @@ -106,6 +106,12 @@ NULL }; +static const char *ramdacSymbols[] = { + "xf86CreateCursorInfoRec", + "xf86InitCursor", + NULL +}; + static const char *shadowSymbols[] = { "ShadowFBInit", NULL @@ -150,7 +156,7 @@ * might refer to. * */ - LoaderRefSymLists( fbSymbols, shadowSymbols, NULL); + LoaderRefSymLists( fbSymbols, ramdacSymbols, shadowSymbols, NULL); /* @@ -168,13 +174,15 @@ typedef enum { OPTION_BITPLANES, - OPTION_BUS_ID + OPTION_BUS_ID, + OPTION_HWCURSOR } NewportOpts; /* Supported options */ static const OptionInfoRec NewportOptions [] = { { OPTION_BITPLANES, "bitplanes", OPTV_INTEGER, {0}, FALSE }, { OPTION_BUS_ID, "BusID", OPTV_INTEGER, {0}, FALSE }, + { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -243,7 +251,8 @@ * Set it as an ISA entity to get the entity field set up right. */ entity = xf86ClaimIsaSlot(drv, 0, dev, TRUE); - base = (NEWPORT_BASE_ADDR0 + busID * NEWPORT_BASE_OFFSET); + base = (NEWPORT_BASE_ADDR0 + + busID * NEWPORT_BASE_OFFSET); RANGE(range[0], base, base + sizeof(NewportRegs),\ ResExcMemBlock); pScrn = xf86ConfigIsaEntity(pScrn, 0, entity, NULL, range, \ @@ -385,11 +394,17 @@ pNewport->bitplanes); return FALSE; } + + from=X_DEFAULT; + pNewport->hwCursor = TRUE; + if (xf86GetOptValBool(pNewport->Options, OPTION_HWCURSOR, &pNewport->hwCursor)) + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pNewport->hwCursor ? "HW" : "SW"); /* Set up clock ranges that are alway ok */ - /* XXX: Use information from VC2 here */ - clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges = xnfcalloc(sizeof(ClockRange),1); clockRanges->next = NULL; clockRanges->minClock = 10000; clockRanges->maxClock = 300000; @@ -437,6 +452,15 @@ } xf86LoaderReqSymLists( fbSymbols, NULL); + /* Load ramdac modules */ + if (pNewport->hwCursor) { + if (!xf86LoadSubModule(pScrn, "ramdac")) { + NewportFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(ramdacSymbols, NULL); + } + /* Load ShadowFB module */ if (!xf86LoadSubModule(pScrn, "shadowfb")) { NewportFreeRec(pScrn); @@ -478,7 +502,7 @@ /* Setup the stuff for the shadow framebuffer */ pNewport->ShadowPitch = (( pScrn->virtualX * pNewport->Bpp ) + 3) & ~3L; pNewport->ShadowPtr = xnfalloc(pNewport->ShadowPitch * pScrn->virtualY); - + if (!NewportModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -517,19 +541,35 @@ /* Initialize software cursor */ if(!miDCInitialize(pScreen, xf86GetPointerScreenFuncs())) return FALSE; - + + /* Initialize hardware cursor */ + if(pNewport->hwCursor) + if(!NewportHWCursorInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + return FALSE; + } + /* Initialise default colourmap */ if (!miCreateDefColormap(pScreen)) return FALSE; /* Install our LoadPalette funciton */ if(!xf86HandleColormaps(pScreen, 256, 8, NewportLoadPalette, 0, - CMAP_RELOAD_ON_MODE_SWITCH )) + CMAP_RELOAD_ON_MODE_SWITCH )) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Colormap initialization failed\n"); return FALSE; + } /* Initialise shadow frame buffer */ - ShadowFBInit(pScreen, (pNewport->Bpp == 1) ? &NewportRefreshArea8 : - &NewportRefreshArea24); + if(!ShadowFBInit(pScreen, (pNewport->Bpp == 1) ? &NewportRefreshArea8 : + &NewportRefreshArea24)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ShadowFB initialization failed\n"); + return FALSE; + } + #ifdef XvExtension { @@ -596,21 +636,27 @@ NewportSaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn; + NewportPtr pNewport; NewportRegsPtr pNewportRegs; Bool unblank; - unsigned short treg; + + if (!pScreen) + return TRUE; unblank = xf86IsUnblank(mode); pScrn = xf86Screens[pScreen->myNum]; + + if (!pScrn->vtSema) + return TRUE; + + pNewport = NEWPORTPTR(pScrn); pNewportRegs = NEWPORTPTR(pScrn)->pNewportRegs; - if (unblank) { - treg = NewportVc2Get(pNewportRegs, VC2_IREG_CONTROL); - NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, (treg | VC2_CTRL_EDISP)); - } else { - treg = NewportVc2Get(pNewportRegs, VC2_IREG_CONTROL); - NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, (treg & ~(VC2_CTRL_EDISP))); - } + if (unblank) + pNewport->vc2ctrl |= VC2_CTRL_EDISP; + else + pNewport->vc2ctrl &= ~VC2_CTRL_EDISP; + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->vc2ctrl); return TRUE; } @@ -641,11 +687,11 @@ pScrn->vtSema = TRUE; /* first backup the necessary registers... */ NewportBackupRex3(pScrn); - pNewport->txt_vc2ctrl = NewportVc2Get( pNewportRegs, VC2_IREG_CONTROL); + if( pNewport->hwCursor ) + NewportBackupVc2Cursor( pScrn ); + NewportBackupVc2(pScrn); NewportBackupPalette(pScrn); - if( pNewport->Bpp == 3) { /* at 24bpp we have to backup some more registers */ - NewportBackupXmap9s( pScrn ); - } + NewportBackupXmap9s( pScrn ); /* ...then setup the hardware */ pNewport->drawmode1 = DM1_RGBPLANES | NPORT_DMODE1_CCLT | @@ -661,7 +707,7 @@ /* tell the xmap9s that we are using 24bpp */ NewportBfwait(pNewport->pNewportRegs); - pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | R_DCB_XMAP9_PROTOCOL | + pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | W_DCB_XMAP9_PROTOCOL | XM9_CRS_CONFIG | NPORT_DMODE_W1 ); pNewportRegs->set.dcbdata0.bytes.b3 &= ~(XM9_8_BITPLANES | XM9_PUPMODE); NewportBfwait(pNewport->pNewportRegs); @@ -681,7 +727,11 @@ /* turn on RGB mode */ NPORT_DMODE1_RGBMD | /* turn on 8888 = RGBA pixel packing */ - NPORT_DMODE1_HD32 | NPORT_DMODE1_RWPCKD; + NPORT_DMODE1_HD32 | NPORT_DMODE1_RWPCKD; + /* After setting up XMAP9 we have to reinitialize the CMAP for + * whatever reason (the docs say nothing about it). RestorePalette() + * is just a lazy way to do this */ + NewportRestorePalette( pScrn ); } /* blank the framebuffer */ NewportWait(pNewportRegs); @@ -699,6 +749,9 @@ NewportWait(pNewportRegs); pNewportRegs->set.drawmode1 = pNewport->drawmode1; + /* XXX: Lazy mode on: just use the textmode value */ + pNewport->vc2ctrl = pNewport->txt_vc2ctrl; + return TRUE; } @@ -712,15 +765,14 @@ NewportRestore(ScrnInfoPtr pScrn, Bool Closing) { NewportPtr pNewport = NEWPORTPTR(pScrn); - NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; /* Restore backed up registers */ NewportRestoreRex3( pScrn ); - NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->txt_vc2ctrl ); + if( pNewport->hwCursor ) + NewportRestoreVc2Cursor( pScrn ); + NewportRestoreVc2( pScrn ); NewportRestorePalette( pScrn ); - if( pNewport->Bpp == 3) { - NewportRestoreXmap9s( pScrn); - } + NewportRestoreXmap9s( pScrn ); } @@ -729,21 +781,26 @@ static unsigned NewportHWProbe(unsigned probedIDs[]) { - FILE* cpuinfo; + FILE* cpuinfo; char line[80]; unsigned hasNewport = 0; + if ((cpuinfo = fopen("/proc/cpuinfo", "r"))) { - while(fgets(line, 80, cpuinfo) != NULL) { + while(fgets(line, 80, cpuinfo) != NULL) { if(strstr(line, "SGI Indy") != NULL) { hasNewport = 1; + probedIDs[0] = 0; break; } + if(strstr(line, "SGI Indigo2") != NULL) { + hasNewport = 1; + probedIDs[0] = 1; + break; + } } - fclose(cpuinfo); + fclose(cpuinfo); } - - probedIDs[0] = 0; - return hasNewport; + return hasNewport; } /* Probe for Chipset revisions */ Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c:1.6 Fri Dec 21 10:37:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c Mon Dec 9 23:03:00 2002 @@ -1,7 +1,7 @@ /* * Id: newport_regs.c,v 1.3 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c,v 1.6 2001/12/21 15:37:23 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c,v 1.7 2002/12/10 04:03:00 dawes Exp $ */ #include "newport.h" @@ -26,7 +26,58 @@ return pNewportRegs->set.dcbdata0.hwords.s1; } +void +NewportBackupVc2( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + pNewport->txt_vc2ctrl = NewportVc2Get( pNewportRegs, VC2_IREG_CONTROL ); + pNewport->txt_vc2cur_x = NewportVc2Get( pNewportRegs, VC2_IREG_CURSX ); + pNewport->txt_vc2cur_y = NewportVc2Get( pNewportRegs, VC2_IREG_CURSY ); +} + +void +NewportRestoreVc2( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->txt_vc2ctrl ); + NewportVc2Set( pNewportRegs, VC2_IREG_CURSX, pNewport->txt_vc2cur_x ); + NewportVc2Set( pNewportRegs, VC2_IREG_CURSY, pNewport->txt_vc2cur_y ); +} + +void +NewportRestoreVc2Cursor( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportLoadCursorImage( pScrn, (CARD8*)pNewport->txt_vc2cur_data); +} + +void +NewportBackupVc2Cursor( ScrnInfoPtr pScrn) +{ + int i; + CARD16 tmp, *data; + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + data = (CARD16*)pNewport->txt_vc2cur_data; + /* address of cursor data in vc2's ram */ + tmp = NewportVc2Get( pNewportRegs, VC2_IREG_CENTRY); + /* this is where we want to write to: */ + NewportVc2Set( pNewportRegs, VC2_IREG_RADDR, tmp); + pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM | + NPORT_DMODE_W2 | VC2_PROTOCOL); + /* read cursor data */ + for (i = 0; i < 128; i++) { + NewportBfwait(pNewportRegs); + *data = pNewportRegs->set.dcbdata0.hwords.s1; + data++; + } +} + /* Sometimes we just have to wait until we can do anything */ void NewportWait(NewportRegsPtr pNewportRegs) @@ -148,6 +199,10 @@ pNewport->txt_xmap9_mi = pNewportRegs->set.dcbdata0.bytes.b3; /* mode register 0 of xmap 0 */ pNewport->txt_xmap9_mod0 = NewportXmap9GetModeRegister(pNewportRegs, 0, 0); + /* cursor cmap msb */ + pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_CURS_CMAP_MSB | NPORT_DMODE_W1 ); + pNewport->txt_xmap9_ccmsb = pNewportRegs->set.dcbdata0.bytes.b3; } void NewportRestoreXmap9s( ScrnInfoPtr pScrn) @@ -172,5 +227,9 @@ pNewportRegs->set.dcbmode = (DCB_XMAP1 | W_DCB_XMAP9_PROTOCOL | XM9_CRS_CONFIG | NPORT_DMODE_W1 ); pNewportRegs->set.dcbdata0.bytes.b3 = pNewport->txt_xmap9_cfg1; + /* cursor cmap msb */ + pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_CURS_CMAP_MSB | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = pNewport->txt_xmap9_ccmsb; } Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h:1.2 Fri Nov 23 14:50:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h Mon Dec 9 23:03:00 2002 @@ -4,7 +4,7 @@ * Register Layouts of the various newport chips * mostly as found in linux/include/asm/newport.h */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h,v 1.2 2001/11/23 19:50:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h,v 1.3 2002/12/10 04:03:00 dawes Exp $ */ typedef volatile unsigned long npireg_t; @@ -427,7 +427,7 @@ #define XM9_MREG_BUF_SEL (1 << 0) #define XM9_MREG_OVL_BUF_SEL (1 << 1) #define XM9_MREG_GAMMA_BYPASS (1 << 2) -#define XM9_MREG_MSB_CMAP (31 << 3 +#define XM9_MREG_MSB_CMAP (31 << 3) #define XM9_MREG_PIX_MODE_MASK (3 << 8) #define XM9_MREG_PIX_MODE_RGB0 (1 << 8) #define XM9_MREG_PIX_MODE_RGB1 (1 << 9) Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c:1.2 Fri Nov 23 14:50:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c Mon Sep 30 18:17:55 2002 @@ -1,20 +1,20 @@ /* * Id: newport_shadow.c,v 1.3 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c,v 1.2 2001/11/23 19:50:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c,v 1.3 2002/09/30 22:17:55 alanh Exp $ */ #include "newport.h" void NewportRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { - unsigned long *base, *src; int dx, dy, x; + CARD32 *base, *src; NewportPtr pNewport = NEWPORTPTR(pScrn); NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; -#define RA8_PIXELS 4 /* burst 4 pixels each time */ -#define RA8_PIXEL_SHIFT 2 /* 4 Pixels on each burst */ +#define RA8_BYTES 4 /* burst 4 pixels each time */ +#define RA8_BYTE_SHIFT 2 /* 4 Pixels on each burst, so divide ShadowPitch by 4 */ #define RA8_MASK 0xffc /* move to 4 byte boundary */ TRACE_ENTER("NewportRefreshArea8"); @@ -25,35 +25,36 @@ while(num--) { NewportWait(pNewportRegs); x = pbox->x1 & RA8_MASK; /* move x to 4 byte boundary */ - base = (unsigned long*)pNewport->ShadowPtr - + (pbox->y1 * (pNewport->ShadowPitch >> RA8_PIXEL_SHIFT) ) - + ( x >> RA8_PIXEL_SHIFT); + base = pNewport->ShadowPtr + + (pbox->y1 * (pNewport->ShadowPitch >> RA8_BYTE_SHIFT) ) + + ( x >> RA8_BYTE_SHIFT); pNewportRegs->set.xystarti = (x << 16) | pbox->y1; - pNewportRegs->set.xyendi = (pbox->x2 << 16) | pbox->y2; + pNewportRegs->set.xyendi = ((pbox->x2-1) << 16) | (pbox->y2-1); - for ( dy = pbox->y1; dy <= pbox->y2; dy++) { + for ( dy = pbox->y1; dy < pbox->y2; dy++) { src = base; - for ( dx = x; dx <= pbox->x2; dx += RA8_PIXELS) { + for ( dx = x; dx < pbox->x2; dx += RA8_BYTES) { pNewportRegs->go.hostrw0 = *src; src++; } - base += ( pNewport->ShadowPitch >> RA8_PIXEL_SHIFT ); + base += ( pNewport->ShadowPitch >> RA8_BYTE_SHIFT ); } pbox++; } TRACE_EXIT("NewportRefreshArea8"); } + void NewportRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { - NewportPtr pNewport = NEWPORTPTR(pScrn); - NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; int dx, dy; CARD8 *src, *base; CARD32 dest; + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; TRACE_ENTER("NewportRefreshArea24"); NewportWait(pNewportRegs); @@ -67,11 +68,14 @@ base = (CARD8*)pNewport->ShadowPtr + pbox->y1 * pNewport->ShadowPitch + pbox->x1 * 3; pNewportRegs->set.xystarti = (pbox->x1 << 16) | pbox->y1; - pNewportRegs->set.xyendi = (pbox->x2 << 16) | pbox->y2; + pNewportRegs->set.xyendi = ((pbox->x2-1) << 16) | (pbox->y2-1); - for ( dy = pbox->y1; dy <= pbox->y2; dy++) { + for ( dy = pbox->y1; dy < pbox->y2; dy++) { src = base; - for ( dx = pbox->x1 ; dx <= pbox->x2 ; dx++) { + for ( dx = pbox->x1 ; dx < pbox->x2 ; dx++) { + /* Removing these shifts by using 32bpp fb + * yields < 2% percent performance gain and wastes 25% memory + */ dest = src[0] | src[1] << 8 | src[2] << 16; pNewportRegs->go.hostrw0 = dest; src+=3; @@ -82,3 +86,4 @@ } TRACE_EXIT("NewportRefreshArea24"); } + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/Imakefile:1.6 --- /dev/null Thu Feb 27 12:31:09 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/Imakefile Wed Feb 19 05:10:49 2003 @@ -0,0 +1,178 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/Imakefile,v 1.6 2003/02/19 10:10:49 alanh Exp $ +XCOMM Imakefile for the National Semiconductor display driver +XCOMM that is based on the durango code. +XCOMM +XCOMM (c) 2000 National Semiconductor corporation +XCOMM (c) 2000 by Juergen Schneider, Infomatec IAS GmbH +XCOMM +#define IHaveModules +#include <Server.tmpl> + +XCOMM Turn this on for the Set-Top-Box (STB) mode which uses +XCOMM the NSC linux kernel frame buffer driver interface. + +XCOMM #define NSC_STB + +#if !defined(NSC_STB) +DEFINES = -DOPT_ACCEL +DURANGOSRCS = durango.c panel.c +DURANGOOBJS = durango.o panel.o +EXTINCLUDES = -I./gfx -I./panel +#else +DEFINES = -DSTB_X +STBSRCS = nsc_galstub.c +STBOBJS = nsc_galstub.o +EXTINCLUDES = -I/usr/src/linux/drivers/video/nsc/gfx \ + -I/usr/src/linux/drivers/video/nsc/panel \ + -I/usr/src/linux/drivers/video/nsc/ +#endif + +#ifdef i386Architecture +I86SRC = nsc_msr_asm.S +I86OBJ = nsc_msr_asm.o +#endif + +SRCS = nsc_driver.c \ + nsc_gx1_driver.c \ + nsc_gx1_dga.c \ + nsc_gx1_accel.c \ + nsc_gx1_cursor.c \ + nsc_gx1_video.c \ + nsc_gx1_shadow.c \ + nsc_gx2_driver.c\ + nsc_gx2_accel.c \ + nsc_gx2_cursor.c \ + nsc_gx2_dga.c \ + nsc_gx2_video.c \ + nsc_gx2_shadow.c $(I86SRC) $(STBSRCS) $(DURANGOSRCS) + +OBJS = nsc_driver.o \ + nsc_gx1_driver.o \ + nsc_gx1_accel.o \ + nsc_gx1_cursor.o \ + nsc_gx1_dga.o \ + nsc_gx1_shadow.o \ + nsc_gx1_video.o \ + nsc_gx2_driver.o \ + nsc_gx2_accel.o \ + nsc_gx2_cursor.o \ + nsc_gx2_dga.o \ + nsc_gx2_video.o \ + nsc_gx2_shadow.o $(I86OBJ) $(STBOBJS) $(DURANGOOBJS) + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ + -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/cfb -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ + -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ + -I$(XF86SRC)/xf24_32bpp -I$(FONTINCSRC) \ + -I$(XF86SRC)/xf8_32bpp -I$(XF86SRC)/xf1bpp \ + -I$(XF86SRC)/xf4bpp -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(EXTINCSRC) $(DRIINCLUDES) \ + -I$(XF86SRC)/shadowfb -I$(XF86SRC)/fbdevhw \ + -I$(XTOP)/include -I$(XF86SRC)/vbe -I$(SERVERSRC)/render \ + $(EXTINCLUDES) +#endif + + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget(nsc,$(OBJS)) + +InstallObjectModule(nsc,$(MODULEDIR),drivers) + +#if !defined(XF86DriverSDK) +CppManTarget(nsc,) +InstallModuleManPage(nsc) +#endif + +DependTarget() + +#ifdef i386Architecture +ObjectFromAsmSource(nsc_msr_asm,NullParameter) +#endif + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/nsc) + +InstallDriverSDKNonExecFile(durango.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc.h,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_driver.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_fourcc.h,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_galfns.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_galstub.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx1_accel.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx1_cursor.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx1_dga.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx1_driver.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx1_shadow.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx1_video.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_accel.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_cursor.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_dga.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_driver.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_shadow.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_vga.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_gx2_video.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_msr_asm.S,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(nsc_regacc.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(panel.c,$(DRIVERSDKDIR)/drivers/nsc) +InstallDriverSDKNonExecFile(gfx/disp_gu1.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/disp_gu2.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/durango.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_dcdr.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_defs.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_disp.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_i2c.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_init.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_mode.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_msr.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_regs.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_rndr.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_rtns.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_tv.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_type.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_vga.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_vid.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/gfx_vip.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/history.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/i2c_acc.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/i2c_gpio.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/init_gu1.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/init_gu2.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/msr_rdcl.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/release.txt,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/rndr_gu1.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/rndr_gu2.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/saa7114.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/tv_1200.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/tv_fs450.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/tv_fs450.h,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/vga_gu1.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/vid_1200.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/vid_5530.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/vid_rdcl.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(gfx/vip_1200.c,$(DRIVERSDKDIR)/drivers/nsc/gfx) +InstallDriverSDKNonExecFile(panel/92xx.h,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/cen9211.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/cen9211.h,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/dora9211.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/dora9211.h,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/drac9210.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/drac9210.h,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/panel.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/panel.h,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/platform.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/pnl_bios.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/pnl_defs.h,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/pnl_init.c,$(DRIVERSDKDIR)/drivers/nsc/panel) +InstallDriverSDKNonExecFile(panel/readme.txt,$(DRIVERSDKDIR)/drivers/nsc/panel) + +InstallDriverSDKObjectModule(nsc,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/durango.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/durango.c:1.5 --- /dev/null Thu Feb 27 12:31:09 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/durango.c Fri Jan 24 12:16:52 2003 @@ -0,0 +1,722 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/durango.c,v 1.5 2003/01/24 17:16:52 tsi Exp $ */ +/* + * $Workfile: durango.c $ + * $Revision: 9 $ + * $Author: Sarma $ + * + * This is the main file used to add Durango graphics support to a software + * project. The main reason to have a single file include the other files + * is that it centralizes the location of the compiler options. This file + * should be tuned for a specific implementation, and then modified as needed + * for new Durango releases. The releases.txt file indicates any updates to + * this main file, such as a new definition for a new hardware platform. + * + * In other words, this file should be copied from the Durango source files + * once when a software project starts, and then maintained as necessary. + * It should not be recopied with new versions of Durango unless the + * developer is willing to tune the file again for the specific project. + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* COMPILER OPTIONS + * These compiler options specify how the Durango routines are compiled + * for the different hardware platforms. For best performance, a driver + * would build for a specific platform. The "dynamic" switches are set + * by diagnostic applications such as Darwin that will run on a variety + * of platforms and use the appropriate code at runtime. Each component + * may be separately dynamic, so that a driver has the option of being + * tuned for a specific 2D accelerator, but will still run with a variety + * of chipsets. + */ + +#define GFX_DISPLAY_DYNAMIC 1 /* runtime selection */ +#define GFX_DISPLAY_GU1 1 /* 1st generation display controller */ +#define GFX_DISPLAY_GU2 1 /* 2nd generation display controller */ + +#define GFX_INIT_DYNAMIC 1 /* runtime selection */ +#define GFX_INIT_GU1 1 /* Geode family */ +#define GFX_INIT_GU2 1 /* Redcloud */ + +#define GFX_MSR_DYNAMIC 1 /* runtime selection */ +#define GFX_MSR_REDCLOUD 1 /* Redcloud */ + +#define GFX_2DACCEL_DYNAMIC 1 /* runtime selection */ +#define GFX_2DACCEL_GU1 1 /* 1st generation 2D accelerator */ +#define GFX_2DACCEL_GU2 1 /* 2nd generation 2D accelerator */ + +#define GFX_VIDEO_DYNAMIC 1 /* runtime selection */ +#define GFX_VIDEO_CS5530 1 /* support for CS5530 */ +#define GFX_VIDEO_SC1200 1 /* support for SC1200 */ +#define GFX_VIDEO_REDCLOUD 1 /* support for Redcloud */ + +#define GFX_VIP_DYNAMIC 1 /* runtime selection */ +#define GFX_VIP_SC1200 1 /* support for SC1200 */ + +#define GFX_DECODER_DYNAMIC 1 /* runtime selection */ +#define GFX_DECODER_SAA7114 1 /* Philips SAA7114 decoder */ + +#define GFX_TV_DYNAMIC 1 /* runtime selection */ +#define GFX_TV_FS451 0 /* Focus Enhancements FS450 */ +#define GFX_TV_SC1200 1 /* SC1200 integrated TV encoder */ + +#define GFX_I2C_DYNAMIC 1 /* runtime selection */ +#define GFX_I2C_ACCESS 1 /* support for ACCESS.BUS */ +#define GFX_I2C_GPIO 1 /* support for CS5530 GPIOs */ + +#define GFX_VGA_DYNAMIC 1 /* runtime selection */ +#define GFX_VGA_GU1 1 /* 1st generation graphics unit */ + +#define FB4MB 1 /* Set to use 4Mb video ram for Pyramid */ + +#define GFX_NO_IO_IN_WAIT_MACROS 1 /* Set to remove I/O accesses in GP bit testing */ + +/* ROUTINES TO READ VALUES + * These are routines used by Darwin or other diagnostics to read the + * current state of the hardware. Display drivers or embedded applications can + * reduce the size of the Durango code by not including these routines. + */ +#define GFX_READ_ROUTINES 1 /* add routines to read values */ + +/* HEADER FILE FOR DURANGO ROUTINE DEFINITIONS + * Needed since some of the Durango routines call other Durango routines. + * Also defines the size of chipset array (GFX_CSPTR_SIZE). + */ +#include "gfx_rtns.h" /* routine definitions */ + +/* VARIABLES USED FOR RUNTIME SELECTION + * If part of the graphics subsystem is declared as dynamic, then the + * following variables are used to specify which platform has been detected. + * The variables are set in the "gfx_detect_cpu" routine. The values should + * be bit flags to allow masks to be used to check for multiple platforms. + */ + +#if GFX_DISPLAY_DYNAMIC +int gfx_display_type = 0; +#endif + +#if GFX_INIT_DYNAMIC +int gfx_init_type = 0; +#endif + +#if GFX_MSR_DYNAMIC +int gfx_msr_type = 0; +#endif + +#if GFX_2DACCEL_DYNAMIC +int gfx_2daccel_type = 0; +#endif + +#if GFX_VIDEO_DYNAMIC +int gfx_video_type = 0; +#endif + +#if GFX_VIP_DYNAMIC +int gfx_vip_type = 0; +#endif + +#if GFX_DECODER_DYNAMIC +int gfx_decoder_type = 0; +#endif + +#if GFX_TV_DYNAMIC +int gfx_tv_type = 0; +#endif + +#if GFX_I2C_DYNAMIC +int gfx_i2c_type = 0; +#endif + +#if GFX_VGA_DYNAMIC +int gfx_vga_type = 0; +#endif + +/* DEFINE POINTERS TO MEMORY MAPPED REGIONS + * These pointers are used by the Durango routines to access the hardware. + * The variables must be set by the project's initialization code after + * mapping the regions in the appropriate manner. + */ + +/* DEFINE VIRTUAL ADDRESSES */ +/* Note: These addresses define the starting base expected by all */ +/* Durango offsets. Under an OS that requires these pointers */ +/* to be mapped to linear addresses (i.e Windows), it may not */ +/* be possible to keep these base offsets. In these cases, */ +/* the addresses are modified to point to the beginning of the */ +/* relevant memory region and the access macros are adjusted */ +/* to subtract the offset from the default base. For example, */ +/* the register pointer could be moved to be 0x40008000, while */ +/* the WRITE_REG* macros are modified to subtract 0x8000 from */ +/* the offset. */ + +unsigned char *gfx_virt_regptr = (unsigned char *)0x40000000; +unsigned char *gfx_virt_fbptr = (unsigned char *)0x40800000; +unsigned char *gfx_virt_vidptr = (unsigned char *)0x40010000; +unsigned char *gfx_virt_vipptr = (unsigned char *)0x40015000; +unsigned char *gfx_virt_spptr = (unsigned char *)0x40000000; +unsigned char *gfx_virt_gpptr = (unsigned char *)0x40000000; + +/* DEFINE PHYSICAL ADDRESSES */ + +unsigned char *gfx_phys_regptr = (unsigned char *)0x40000000; +unsigned char *gfx_phys_fbptr = (unsigned char *)0x40800000; +unsigned char *gfx_phys_vidptr = (unsigned char *)0x40010000; +unsigned char *gfx_phys_vipptr = (unsigned char *)0x40015000; + +/* HEADER FILE FOR GRAPHICS REGISTER DEFINITIONS + * This contains only constant definitions, so it should be able to be + * included in any software project as is. + */ +#include "gfx_regs.h" /* graphics register definitions */ + +/* HEADER FILE FOR REGISTER ACCESS MACROS + * This file contains the definitions of the WRITE_REG32 and similar macros + * used by the Durango routines to access the hardware. The file assumes + * that the environment can handle 32-bit pointer access. If this is not + * the case, or if there are special requirements, then this header file + * should not be included and the project must define the macros itself. + * (A project may define WRITE_REG32 to call a routine, for example). + */ +#include "gfx_defs.h" /* register access macros */ + +/* IO MACROS AND ROUTINES + * These macros must be defined before the initialization or I2C + * routines will work properly. + */ + +#if defined(OS_WIN32) /* For Windows */ + +/* VSA II CALL */ + +void +gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long temp1, temp2; + + _asm { + mov dx, 0x0AC1C + mov eax, 0x0FC530007 + out dx, eax + add dl, 2 + mov ecx, msrAddr + mov cx, msrReg + in ax, dx; + ;EDX:EAX will contain MSR contents. + mov temp1, edx + mov temp2, eax + } + + *ptrHigh = temp1; + *ptrLow = temp2; +} + +void +gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long temp1 = *ptrHigh; + unsigned long temp2 = *ptrLow; + + _asm { + mov dx, 0x0AC1C + mov eax, 0x0FC530007 + out dx, eax i + add dl, 2 + ;ECX contains msrAddr | msrReg + mov ecx, msrAddr + mov cx, msrReg + ;<OR_mask_hi > + mov ebx, temp1 + + ;<OR_mask_hi > + mov eax, temp2 + ;<AND_mask_hi > + mov esi, 0 + ;<AND_mask_lo > + mov edi, 0 + ;MSR is written at this point + out dx, ax + } +} + +unsigned char +gfx_inb(unsigned short port) +{ + unsigned char data; + + _asm { + pushf + mov dx, port + in al, dx + mov data, al + popf + } + return (data); +} + +unsigned short +gfx_inw(unsigned short port) +{ + unsigned short data; + + _asm { + pushf + mov dx, port + in ax, dx + mov data, ax + popf + } + return (data); +} + +unsigned long +gfx_ind(unsigned short port) +{ + unsigned long data; + + _asm { + pushf + mov dx, port + in eax, dx + mov data, eax + popf + } + return (data); +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + _asm { + pushf + mov al, data + mov dx, port + out dx, al + popf + } +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + _asm { + pushf + mov ax, data + mov dx, port + out dx, ax + popf + } +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + _asm { + pushf + mov eax, data + mov dx, port + out dx, eax + popf + } +} + +#elif defined(OS_VXWORKS) || defined (OS_LINUX) /* VxWorks and Linux */ + +extern unsigned long nsc_asm_msr_vsa_rd(unsigned long, unsigned long *, + unsigned long *); +extern unsigned long nsc_asm_msr_vsa_wr(unsigned long, unsigned long, + unsigned long); + +void +gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long addr, val1, val2; + + addr = msrAddr | (unsigned long)msrReg; + nsc_asm_msr_vsa_rd(addr, &val2, &val1); + *ptrHigh = val2; + *ptrLow = val1; +} + +void +gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long addr, val1, val2; + + val2 = *ptrHigh; + val1 = *ptrLow; + addr = (msrAddr & 0xFFFF0000) | (unsigned long)msrReg; + nsc_asm_msr_vsa_wr(addr, val2, val1); +} + +unsigned char +gfx_inb(unsigned short port) +{ + unsigned char value; + __asm__ volatile ("inb %1,%0":"=a" (value):"d"(port)); + + return value; +} + +unsigned short +gfx_inw(unsigned short port) +{ + unsigned short value; + __asm__ volatile ("in %1,%0":"=a" (value):"d"(port)); + + return value; +} + +unsigned long +gfx_ind(unsigned short port) +{ + unsigned long value; + __asm__ volatile ("inl %1,%0":"=a" (value):"d"(port)); + + return value; +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + __asm__ volatile ("outb %0,%1"::"a" (data), "d"(port)); +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + __asm__ volatile ("out %0,%1"::"a" (data), "d"(port)); +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + __asm__ volatile ("outl %0,%1"::"a" (data), "d"(port)); +} + +#elif defined(XFree86Server) + +#include <xf86_ansic.h> +#include <compiler.h> +#define INB(port) inb(port) +#define INW(port) inw(port) +#define IND(port) inl(port) +#define OUTB(port,data) outb(port, data) +#define OUTW(port,data) outw(port, data) +#define OUTD(port,data) outl(port, data) + +unsigned char gfx_inb(unsigned short port); +unsigned short gfx_inw(unsigned short port); +unsigned long gfx_ind(unsigned short port); +void gfx_outb(unsigned short port, unsigned char data); +void gfx_outw(unsigned short port, unsigned short data); +void gfx_outd(unsigned short port, unsigned long data); + +unsigned char +gfx_inb(unsigned short port) +{ + return inb(port); +} + +unsigned short +gfx_inw(unsigned short port) +{ + return inw(port); +} + +unsigned long +gfx_ind(unsigned short port) +{ + return inl(port); +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + outb(port, data); +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + outw(port, data); +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + outl(port, data); +} + +#ifdef __i386__ +extern unsigned long nsc_asm_msr_vsa_rd(unsigned long, unsigned long *, + unsigned long *); +extern unsigned long nsc_asm_msr_vsa_wr(unsigned long, unsigned long, + unsigned long); +#endif + +void +gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ +#ifdef __i386__ + unsigned long addr, val1, val2; + + addr = msrAddr | (unsigned long)msrReg; + nsc_asm_msr_vsa_rd(addr, &val2, &val1); + *ptrHigh = val2; + *ptrLow = val1; +#endif +} + +void +gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ +#ifdef __i386__ + unsigned long addr, val1, val2; + + val2 = *ptrHigh; + val1 = *ptrLow; + addr = (msrAddr & 0xFFFF0000) | (unsigned long)msrReg; + nsc_asm_msr_vsa_wr(addr, val2, val1); +#endif +} +#else /* else nothing */ + +unsigned char +gfx_inb(unsigned short port) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ + return (0); +} + +unsigned short +gfx_inw(unsigned short port) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ + return (0); +} + +unsigned long +gfx_ind(unsigned short port) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ + return (0); +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ +} +#endif + +#ifndef XFree86Server +#define INB(port) gfx_inb(port) +#define INW(port) gfx_inw(port) +#define IND(port) gfx_ind(port) +#define OUTB(port, data) gfx_outb(port, data) +#define OUTW(port, data) gfx_outw(port, data) +#define OUTD(port, data) gfx_outd(port, data) +#endif + +/* INITIALIZATION ROUTINES + * These routines are used during the initialization of the driver to + * perform such tasks as detecting the type of CPU and video hardware. + * The routines require the use of IO, so the above IO routines need + * to be implemented before the initialization routines will work + * properly. + */ + +#include "gfx_init.c" + +/* INCLUDE MSR ACCESS ROUTINES */ + +#include "gfx_msr.c" + +/* INCLUDE GRAPHICS ENGINE ROUTINES + * These routines are used to program the 2D graphics accelerator. If + * the project does not use graphics acceleration (direct frame buffer + * access only), then this file does not need to be included. + */ +#include "gfx_rndr.c" /* graphics engine routines */ + +/* INCLUDE DISPLAY CONTROLLER ROUTINES + * These routines are used if the display mode is set directly. If the + * project uses VGA registers to set a display mode, then these files + * do not need to be included. + */ +#include "gfx_mode.h" /* display mode tables */ +#include "gfx_disp.c" /* display controller routines */ + +/* INCLUDE VIDEO OVERLAY ROUTINES + * These routines control the video overlay hardware. + */ +#include "gfx_vid.c" /* video overlay routines */ + +/* VIDEO PORT AND VIDEO DECODER ROUTINES + * These routines rely on the I2C routines. + */ +#include "gfx_vip.c" /* video port routines */ +#include "gfx_dcdr.c" /* video decoder routines */ + +/* I2C BUS ACCESS ROUTINES + * These routines are used by the video decoder and possibly an + * external TV encoer. + */ +#include "gfx_i2c.c" /* I2C bus access routines */ + +/* TV ENCODER ROUTINES + * This file does not need to be included if the system does not + * support TV output. + */ +#include "gfx_tv.c" /* TV encoder routines */ + +/* VGA ROUTINES + * This file is used if setting display modes using VGA registers. + */ +#include "gfx_vga.c" /* VGA routines */ + +/* Hardware Register reading functions */ +#include "nsc_regacc.c" + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.h:1.5 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.h Fri Feb 21 11:51:09 2003 @@ -0,0 +1,433 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.h,v 1.5 2003/02/21 16:51:09 alanh Exp $ */ +/* + * $Workfile: nsc.h $ + * $Revision: 16 $ + * $Author: Sarma $ + * + * File Contents: This file contains the data structures Geode driver. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Geode Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _NSC_GEODE_H_ +#define _NSC_GEODE_H_ + +#include "xaa.h" +#include "xf86Cursor.h" +#if !defined(STB_X) +#include "vgaHW.h" +#endif +#include "xf86int10.h" +#include "xf86xv.h" + +#if defined(STB_X) +#define GFX(func) Gal_##func +#define GFX2(func) Gal2_##func +#define OPTACCEL(func) func +#else /* STB_X */ +#define GFX(func) gfx_##func +#define GFX2(func) gfx2_##func + +#if defined(OPT_ACCEL) +#define OPTACCEL(func) OPT##func +#else /* OPT_ACCEL */ +#define OPTACCEL(func) func +#endif /* OPT_ACCEL */ + +#endif /* STB_X */ + +#define GEODEPTR(p) ((GeodePtr)((p)->driverPrivate)) + +#define DebugPort(_Val) gfx_outb(0x84, (_Val)); + +#define DEFAULT_NUM_OF_BUF 20 /* default # of buffers */ + +#if defined(MYDBG) +#define DEBUGMSG(cond, drv_msg) if((cond)) xf86DrvMsg drv_msg +#else +#define DEBUGMSG(cond, drv_msg) +#endif + +/* Overlay Transparency Key */ +#define TRANSPARENCY_KEY 255 + +#if defined(EXTERN) +unsigned char DCount = 0; + +#if defined(STB_X) +void +gfx_outb(unsigned short port, unsigned char data) +{ + __asm__ volatile ("outb %0,%1"::"a" (data), "d"(port)); +} +#endif +#else +extern unsigned char DCount; + +#if defined(STB_X) +extern void gfx_outb(unsigned short port, unsigned char data); +extern unsigned char gfx_inb(unsigned short port); +#endif +#endif + +#if defined(STB_X) +#include "nsc_galproto.h" +#else +extern void gfx_write_reg32(int offset, int data); +extern void gfx_write_reg16(int offset, short data); +extern void gfx_write_reg8(int offset, char data); +extern int gfx_read_reg32(int offset); +extern short gfx_read_reg16(int offset); +extern void gfx_write_vid32(int offset, int data); +extern int gfx_read_vid32(int offset); +extern unsigned char gfx_inb(unsigned short port); +extern void gfx_outb(unsigned short port, unsigned char data); +extern unsigned short gfx_inw(unsigned short port); +extern void gfx_outw(unsigned short port, unsigned short data); +extern unsigned long gfx_ind(unsigned short port); +extern void gfx_outd(unsigned short port, unsigned long data); + +#include "gfx_rtns.h" +#include "gfx_defs.h" +#include "gfx_regs.h" +#include "panel.h" + +typedef struct __TVPARAMS +{ + unsigned int dwFlags; + unsigned short wWidth; + unsigned short wHeight; + unsigned short wStandard; + unsigned short wType; + unsigned short wOutput; + unsigned short wResolution; + Bool bState; +} +TVPARAMS, *PTVPARAMS; + +typedef struct __DISPLAYTIMING +{ + unsigned int dwDotClock; + unsigned short wPitch; + unsigned short wBpp; + unsigned short wHTotal; + unsigned short wHActive; + unsigned short wHSyncStart; + unsigned short wHSyncEnd; + unsigned short wHBlankStart; + unsigned short wHBlankEnd; + unsigned short wVTotal; + unsigned short wVActive; + unsigned short wVSyncStart; + unsigned short wVSyncEnd; + unsigned short wVBlankStart; + unsigned short wVBlankEnd; + unsigned short wPolarity; +} +DISPLAYTIMING, *PDISPLAYTIMING; + +/* TV Timings */ +typedef struct __TVTIMING +{ + unsigned long HorzTim; + unsigned long HorzSync; + unsigned long VertSync; + unsigned long LineEnd; + unsigned long VertDownscale; + unsigned long HorzScaling; + unsigned long TimCtrl1; + unsigned long TimCtrl2; + unsigned long Subfreq; + unsigned long DispPos; + unsigned long DispSize; + unsigned long Debug; + unsigned long DacCtrl; + unsigned int DotClock; +} +TVTIMING, *PTVTIMING; + +#endif /* STB_X */ + +typedef struct _VESARec +{ + xf86Int10InfoPtr pInt; +} +VESARec, *VESAPtr; + +typedef struct +{ + /* Private struct for the server */ + unsigned long cpu_version; /* [7:0] Type:1=GXLV,2=SC1400 */ + /* [15:8] Major version */ + /* [23:16] Minor version */ + unsigned long vid_version; /* [7:0] Type:1=CS5530,2=SC1400 */ + + EntityInfoPtr pEnt; + ScreenBlockHandlerProcPtr BlockHandler; /* needed for video */ + int DetectedChipSet; + int Chipset; + unsigned long FBLinearAddr; + unsigned char *FBBase; + unsigned long FBSize; + unsigned int cpu_reg_size; + unsigned int gp_reg_size; + unsigned int vid_reg_size; + int Pitch; + Bool HWCursor; + Bool NoAccel; + unsigned long VideoKey; + + Bool TVSupport; +#if defined(STB_X) + GAL_TVPARAMS TvParam; +#else + TVPARAMS TvParam; +#endif /* STB_X */ + + int TVOx, TVOy, TVOw, TVOh; + Bool TV_Overscan_On; + + Bool Panel; + + /* Flatpanel support from Bios */ + int FPBX; /* xres */ + int FPBY; /* yres */ + int FPBB; /* bpp */ + int FPBF; /* freq */ + + int Rotate; + Bool ShadowFB; + unsigned char *ShadowPtr; + int ShadowPitch; + void (*PointerMoved) (int index, int x, int y); + /* CloseScreen function. */ + CloseScreenProcPtr CloseScreen; + + Bool Compression; + unsigned int CBOffset; + unsigned int CBPitch; + unsigned int CBSize; + unsigned long CursorStartOffset; + unsigned int CursorSize; + xf86CursorInfoPtr CursorInfo; + int CursorXHot; + int CursorYHot; + unsigned long OffscreenStartOffset; + unsigned int OffscreenSize; + + /***Image Write structures ***/ + + /* offset in video memory for ImageWrite Buffers */ + unsigned char **AccelImageWriteBufferOffsets; + int NoOfImgBuffers; + FBAreaPtr CompressionArea; + FBAreaPtr AccelImgArea; +/*****************************************/ +/* Saved Console State */ +#if defined(STB_X) + GAL_VGAMODEDATA FBgfxVgaRegs; + GAL_DISPLAYTIMING FBgfxdisplaytiming; + GAL_TVTIMING FBgfxtvtiming; +#else + gfx_vga_struct FBgfxVgaRegs; + DISPLAYTIMING FBgfxdisplaytiming; + TVTIMING FBtvtiming; +#endif /* STB_X */ + int FBVGAActive; + unsigned int FBTVActive; + unsigned int FBTVEnabled; + unsigned long FBDisplayOffset; + + VESAPtr vesa; + + /* compression */ + int FBCompressionEnable; + unsigned long FBCompressionOffset; + unsigned short FBCompressionPitch; + unsigned short FBCompressionSize; + + /* Save the Cursor offset of the FB */ + unsigned long FBCursorOffset; +/*****************************************/ + + XAAInfoRecPtr AccelInfoRec; + + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; +/*****************************************/ + int video_x; + int video_y; + short video_w; + short video_h; + short video_srcw; + short video_srch; + short video_dstw; + short video_dsth; + int video_id; + int video_offset; + ScrnInfoPtr video_scrnptr; + BOOL OverlayON; + + int videoKey; + XF86VideoAdaptorPtr adaptor; + int OverlaySkewX; + int OverlaySkewY; + int VideoZoomMax; +} +GeodeRec, *GeodePtr; + +/* option flags are self-explanatory */ +enum +{ + OPTION_SW_CURSOR, + OPTION_HW_CURSOR, + OPTION_NOCOMPRESSION, + OPTION_NOACCEL, + OPTION_TV_SUPPORT, + OPTION_TV_OUTPUT, + OPTION_TV_OVERSCAN, + OPTION_SHADOW_FB, + OPTION_ROTATE, + OPTION_FLATPANEL, + OPTION_FLATPANEL_INFO, + OPTION_FLATPANEL_IN_BIOS, + OPTION_COLOR_KEY, + OPTION_OSM, + OPTION_OSM_IMG_BUFS, + OPTION_DONT_PROGRAM +} +GeodeOpts; + +#endif /* _NSC_GEODE_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.man:1.1 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.man Tue Dec 10 10:12:23 2002 @@ -0,0 +1,134 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.man,v 1.1 2002/12/10 15:12:23 alanh Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH NSC __drivermansuffix__ __vendorversion__ +.SH NAME +nsc \- Nsc video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qnsc\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B nsc +is an XFree86 driver for National Semiconductors GEODE processor family. +It uses the DURANGO kit provided by National Semiconductor. +The driver is accelerated, and provides support for the following +framebuffer depths: 8, 16 and 24. +.SH SUPPORTED HARDWARE +The +.B nsc +driver supports GXLV (5530 companion chip), SC1200, SC1400 and +GX2 (5535 companion chip). +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver will auto-detect the amount of video memory present for all +chips. If the amount of memory is detected incorrectly, the actual amount +of video memory should be specified with a +.B VideoRam +entry in the config file +.B \*qDevice\*q +section. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Enable or disable the SW cursor. +Default: off. +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. +Default: on. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. +Default: acceleration is enabled. +.TP +.BI "Option \*qNoCompression\*q \*q" boolean \*q +Disable or enable compression. +Default: compression is enabled. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. +Default: off. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +Rotate the display clockwise. This mode is unaccelerated, and uses +the Shadow Frame Buffer layer. +Default: no rotation. +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the display counterclockwise. This mode is unaccelerated, and +uses the Shadow Frame Buffer layer. +Default: no rotation. +.TP +.BI "Option \*qFlatPanel\*q \*q" boolean \*q +This enables the FlatPanel display unit. The FlatPanel depends on the +BIOS to do the Pnale h/w initialization. +In GX2 based platforms with TFT part Flatpanel is enabled, and on CRT +part is disabled. +Default: off. +.TP +.BI "Option \*qOSMImageBuffers\*q \*q" integer \*q +This sets the number of scanline buffers to be allocated in offscreen +memory for acceleration. This can take any value 0 will disable the +allocation. Disabled if cannot alocate requested scanline memory. +Default: 20. +.TP +.BI "Option \*qColorKey\*q \*q" integer \*q +This sets the default pixel value for the YUV video overlay key. +Default: 0. +.PP +The following +.B Options +are supported only on SC1200 based platforms: +.TP +.BI "Option \*qTV\*q \*qPAL-768x576\*q" +Selects the PAL TV display mode 768x576 and the depth is forced to 16 bpp. +Default: no TV. +.TP +.BI "Option \*qTV\*q \*qPAL-720x576\*q" +Selects the PAL TV display mode 720x576 and the depth is forced to 16 bpp. +Default: no TV. +.TP +.BI "Option \*qTV\*q \*qNTSC-720x480\*q" +Selects the NTSC TV display mode 720x480 and the depth is forced to 16 bpp. +Default: no TV. +.TP +.BI "Option \*qTV\*q \*qNTSC-640x480\*q" +Selects the NTSC TV display mode 640x480 and the depth is forced to 16 bpp. +Default: no TV. +.TP +.BI "Option \*qTV_Output\*q \*qCOMPOSITE\*q" +The selected TV mode output is coded for Composite signal. +Default: no TV. +.TP +.BI "Option \*qTV_Output\*q \*qSVIDEO\*q" +The selected TV mode output is coded for SVIDEO signal. +Default: no TV. +.TP +.BI "Option \*qTV_Output\*q \*qYUV\*q" +The selected TV mode output is coded for YUV signal. +Default: no TV. +.TP +.BI "Option \*qTV_Output\*q \*qSCART\*q" +The selected TV mode output is coded for SCART signal. +Default: no TV. +.TP +.BI "Option \*qTVOverscan\*q \*xx:yy:ww:hh\*q" +This option will let only the viewable display area smaller to be able to +view on TV. The parameters xx: X-offset, yy: Y-offset, ww: Viewable width, +hh: Viewable height. +Default: no TV. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHOR +Author: Sarma V. Kolluru Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_driver.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_driver.c:1.4 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_driver.c Wed Feb 12 08:08:54 2003 @@ -0,0 +1,614 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_driver.c,v 1.4 2003/02/12 13:08:54 alanh Exp $ */ +/* + * $Workfile: nsc_driver.c $ + * $Revision: 21 $ + * $Author: Sarma $ + * + * File Contents: This is the main module configures the interfacing + * with the X server. The individual modules will be + * loaded based upon the options selected from the + * XF86Config. This file also has modules for finding + * supported modes, turning on the modes based on options. + * + * Project: Nsc Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#define DEBUG(x) +#define NSC_TRACE 0 +#define CFB 0 +#define HWVGA 1 + +/* Includes that are used by all drivers */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +/* We may want inb() and outb() */ +#include "compiler.h" + +/* We may want to access the PCI config space */ +#include "xf86PciInfo.h" +#include "xf86Pci.h" + +/* Colormap handling stuff */ +#include "xf86cmap.h" + +#define RC_MAX_DEPTH 24 + +/* Frame buffer stuff */ +#if CFB +/* + * If using cfb, cfb.h is required. Select the others for the bpp values + * the driver supports. + */ +#define PSZ 8 /* needed for cfb.h */ +#include "cfb.h" +#undef PSZ +#include "cfb16.h" +#include "cfb24.h" +#include "cfb32.h" +#else +#include "fb.h" +#endif + +#include "shadowfb.h" + +/* Machine independent stuff */ +#include "mipointer.h" +#include "mibank.h" +#include "micmap.h" +/* All drivers implementing backing store need this */ +#include "mibstore.h" +#include "vgaHW.h" +#include "vbe.h" + +/* Check for some extensions */ +#ifdef XFreeXDGA +#define _XF86_DGA_SERVER_ +#include "extensions/xf86dgastr.h" +#endif /* XFreeXDGA */ + +#ifdef DPMSExtension +#include "globals.h" +#include "opaque.h" +#define DPMS_SERVER +#include "extensions/dpms.h" +#endif /* DPMSExtension */ + +#define EXTERN +/* Our private include file (this also includes the durango headers) */ +#include "nsc.h" + +#if NSC_TRACE +/* ANSI C does not allow var arg macros */ +#define GeodeDebug(args) DebugPort(DCount++);ErrorF args +#else +#define GeodeDebug(args) +#endif + +/* A few things all drivers should have */ +#define NSC_NAME "NSC" +#define NSC_DRIVER_NAME "nsc" + +/* This should match the durango code version. + * The patchlevel may be used to indicate changes in geode.c + */ +#define NSC_VERSION_NAME "2.7.6" +#define NSC_VERSION_MAJOR 2 +#define NSC_VERSION_MINOR 7 +#define NSC_PATCHLEVEL 6 + +#define NSC_VERSION_CURRENT ((NSC_VERSION_MAJOR << 24) | \ + (NSC_VERSION_MINOR << 16) | NSC_PATCHLEVEL) + +/* Forward definitions */ +static const OptionInfoRec *NscAvailableOptions(int chipid, int busid); +static void NscIdentify(int); +static Bool NscProbe(DriverPtr, int); +static int CPUDetected; + +extern void GX1SetupChipsetFPtr(ScrnInfoPtr pScrn); +extern void GX2SetupChipsetFPtr(ScrnInfoPtr pScrn); + +#if !defined(STB_X) +extern unsigned char *XpressROMPtr; +#endif /* STB_X */ + +/* driver record contains the functions needed by the server after loading + * the driver module. + */ +DriverRec NSC = { + NSC_VERSION_CURRENT, + NSC_DRIVER_NAME, + NscIdentify, + NscProbe, + NscAvailableOptions, + NULL, + 0 +}; + +/* Existing Processor Models */ +#define GX1 0x1 +#define GX2 0x2 +#define GX2_CRT 0x6 +#define GX2_TFT 0xA + +#define PCI_VENDOR_ID_CYRIX 0x1078 +#define PCI_VENDOR_ID_NS 0x100B + +#define PCI_CHIP_5530 0x0104 +#define PCI_CHIP_SC1200 0x0504 +#define PCI_CHIP_SC1400 0x0104 +#define PCI_CHIP_REDCLOUD 0x0030 + +/* National Chip Models */ +typedef struct _DEVICE_MODEL +{ + int DeviceId; + int Model; +} +DeviceModel; + +DeviceModel ChipModel[] = { + {PCI_CHIP_5530, GX1}, + {PCI_CHIP_SC1200, GX1}, + {PCI_CHIP_SC1400, GX1}, + {PCI_CHIP_REDCLOUD, GX2}, + {-1, 0} +}; + +/* Supported chipsets */ +SymTabRec GeodeChipsets[] = { + {PCI_CHIP_5530, "5530"}, + {PCI_CHIP_SC1200, "SC1200"}, + {PCI_CHIP_SC1400, "SC1400"}, + {PCI_CHIP_REDCLOUD, "REDCLOUD"}, + {-1, NULL} +}; + +PciChipsets GeodePCIchipsets[] = { + {PCI_CHIP_5530, PCI_CHIP_5530, RES_SHARED_VGA}, + {PCI_CHIP_SC1200, PCI_CHIP_SC1200, RES_SHARED_VGA}, + {PCI_CHIP_SC1400, PCI_CHIP_SC1400, RES_SHARED_VGA}, + {PCI_CHIP_REDCLOUD, PCI_CHIP_REDCLOUD, RES_SHARED_VGA}, + {-1, -1, RES_UNDEFINED}, +}; + +OptionInfoRec GeodeOptions[] = { + {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_NOCOMPRESSION, "NoCompression", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_TV_SUPPORT, "TV", OPTV_ANYSTR, {0}, FALSE}, + {OPTION_TV_OUTPUT, "TV_Output", OPTV_ANYSTR, {0}, FALSE}, + {OPTION_TV_OVERSCAN, "TVOverscan", OPTV_ANYSTR, {0}, FALSE}, + {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE}, + {OPTION_FLATPANEL, "FlatPanel", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, + {OPTION_OSM_IMG_BUFS, "OSMImageBuffers", OPTV_INTEGER, {0}, FALSE}, + {-1, NULL, OPTV_NONE, {0}, FALSE} +}; + +/* List of symbols from other modules that this module references.The purpose +* is that to avoid unresolved symbol warnings +*/ +const char *nscVgahwSymbols[] = { + "vgaHWGetHWRec", + "vgaHWUnlock", + "vgaHWInit", + "vgaHWSave", + "vgaHWRestore", + "vgaHWProtect", + "vgaHWGetIOBase", + "vgaHWMapMem", + "vgaHWLock", + "vgaHWFreeHWRec", + "vgaHWSaveScreen", + NULL +}; + +const char *nscVbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + +const char *nscInt10Symbols[] = { + "xf86ExecX86int10", + "xf86InitInt10", + "xf86Int10AllocPages", + "xf86Int10Addr", + NULL +}; + +#if CFB +const char *nscCfbSymbols[] = { + "cfbScreenInit", + "cfb16ScreenInit", + "cfb24ScreenInit", + "cfb32ScreenInit", + NULL +}; +#else +const char *nscFbSymbols[] = { + "fbScreenInit", + "fbPictureInit", + NULL +}; +#endif + +const char *nscXaaSymbols[] = { + "XAADestroyInfoRec", + "XAACreateInfoRec", + "XAAInit", + "XAAScreenIndex", + NULL +}; + +const char *nscRamdacSymbols[] = { + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL +}; + +const char *nscShadowSymbols[] = { + "ShadowFBInit", + NULL +}; + +#ifdef XFree86LOADER + +/* Module loader interface */ + +static MODULESETUPPROTO(NscSetup); + +static XF86ModuleVersionInfo NscVersionRec = { + "nsc", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + NSC_VERSION_MAJOR, NSC_VERSION_MINOR, NSC_PATCHLEVEL, + ABI_CLASS_VIDEODRV, /* This is a video driver */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +/* + * This data is accessed by the loader. The name must be the module name + * followed by "ModuleInit". + */ +XF86ModuleData nscModuleData = { &NscVersionRec, NscSetup, NULL }; + +/*------------------------------------------------------------------------- + * NscSetup. + * + * Description :This function sets up the driver in X list and load the + * module symbols through xf86loader routines.. + * + * Parameters. + * Module :Pointer to the geode module + * options :Driver module options. + * ErrorMajor:Major no + * ErrorMinor:Minor no. + * + * Returns :NULL on success + * + * Comments :Module setup is done by this function + * + *------------------------------------------------------------------------- +*/ +static pointer +NscSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) +{ + static Bool Initialised = FALSE; + + if (!Initialised) { + Initialised = TRUE; + xf86AddDriver(&NSC, Module, 0); + /* Tell the loader about symbols from other modules that this + * module might refer to. + */ + LoaderRefSymLists(nscVgahwSymbols, nscVbeSymbols, +#if CFB + nscCfbSymbols, +#else + nscFbSymbols, +#endif + nscXaaSymbols, + nscInt10Symbols, nscRamdacSymbols, nscShadowSymbols, + NULL); + return (pointer) TRUE; + } + /*The return value must be non-NULL on success */ + if (ErrorMajor) + *ErrorMajor = LDR_ONCEONLY; + return NULL; +} +#endif /*End of XFree86Loader */ + +/*------------------------------------------------------------------------- + * NscIdentify. + * + * Description : This function identify an Nscfamily version. + * + * + * Parameters. + * flags : flags may be used in PreInit* + * + * Returns : none + * + * Comments : none + * +*------------------------------------------------------------------------ +*/ +static void +NscIdentify(int flags) +{ + xf86PrintChipsets(NSC_NAME, + "Nsc family driver (version " NSC_VERSION_NAME ") " + "for chipsets", GeodeChipsets); +} + +/*---------------------------------------------------------------------------- + * NscAvailableOptions. + * + * Description :This function returns the geodeoptions set geodeoption + * + * Parameters. + * chipid :This will identify the chipset. + * busid :This will identify the PCI busid + * + * Returns :ptr to GeodeOptions. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static const OptionInfoRec * +NscAvailableOptions(int chipid, int busid) +{ + return GeodeOptions; +} + +/*---------------------------------------------------------------------------- + * NscProbe. + * + * Description :This is to find that hardware is claimed by another + * driver if not claim the slot & allocate ScreenInfoRec. + * + * Parameters. + * drv :a pointer to the geode driver + * flags :flags may passed to check the config and probe detect + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :This should ne minimal probe and it should under no + * circumstances change the state of the hardware.Don't do + * any intiallizations other than the required + * ScreenInforec. +*---------------------------------------------------------------------------- +*/ + +static Bool +NscProbe(DriverPtr drv, int flags) +{ + Bool foundScreen = FALSE; + int numDevSections, numUsed; + GDevPtr *devSections = NULL; + int *usedChips = NULL; + int i; + + GeodeDebug(("NscProbe: Probing for supported devices!\n")); + /* + * * Find the config file Device sections that match this + * * driver, and return if there are none. + */ + if ((numDevSections = xf86MatchDevice(NSC_NAME, &devSections)) <= 0) { + GeodeDebug(("NscProbe: failed 1!\n")); + return FALSE; + } + GeodeDebug(("NscProbe: Before MatchPciInstances!\n")); + /* PCI BUS */ + if (xf86GetPciVideoInfo()) { + numUsed = xf86MatchPciInstances(NSC_NAME, PCI_VENDOR_ID_NS, + GeodeChipsets, GeodePCIchipsets, + devSections, numDevSections, + drv, &usedChips); + if (numUsed <= 0) { + /* Check for old CYRIX vendor ID (5530) */ + numUsed = xf86MatchPciInstances(NSC_NAME, + PCI_VENDOR_ID_CYRIX, + GeodeChipsets, GeodePCIchipsets, + devSections, numDevSections, + drv, &usedChips); + } + + GeodeDebug(("NscProbe: MatchPCI (%d)!\n", numUsed)); + + if (numUsed > 0) { + if (flags & PROBE_DETECT) + foundScreen = TRUE; + else { + /* Durango only supports one instance, */ + /* so take the first one */ + for (i = 0; i < numUsed; i++) { + /* Allocate a ScrnInfoRec */ + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + + EntityInfoPtr pEnt = xf86GetEntityInfo(usedChips[i]); + PciChipsets *p_id; + + for (p_id = GeodePCIchipsets; p_id->numChipset != -1; p_id++) { + if (pEnt->chipset == p_id->numChipset) { + CPUDetected = GX1; + if (pEnt->chipset == PCI_CHIP_REDCLOUD) + CPUDetected = GX2; + break; + } + } + xfree(pEnt); + GeodeDebug(("NscProbe: CPUDetected %d!\n", CPUDetected)); + + pScrn->driverName = NSC_DRIVER_NAME; + pScrn->name = NSC_NAME; + pScrn->Probe = NscProbe; + + if (CPUDetected == GX1) { + GX1SetupChipsetFPtr(pScrn); + } else { /* GX2 */ + GX2SetupChipsetFPtr(pScrn); + } + + foundScreen = TRUE; + xf86ConfigActivePciEntity(pScrn, + usedChips[i], + GeodePCIchipsets, + NULL, NULL, NULL, NULL, NULL); + } + } + } + } + + if (usedChips) + xfree(usedChips); + if (devSections) + xfree(devSections); + GeodeDebug(("NscProbe: result (%d)!\n", foundScreen)); + return foundScreen; +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_fourcc.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_fourcc.h:1.2 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_fourcc.h Tue Jan 14 04:34:30 2003 @@ -0,0 +1,200 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_fourcc.h,v 1.2 2003/01/14 09:34:30 alanh Exp $ */ +/* + * $Workfile: nsc_fourcc.h $ + * $Revision: 4 $ + * $Author: Sarma $ + * + * File Contents: This file consists of main Xfree video macro definitions. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Geode Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Geode Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Geode Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#define FOURCC_Y2YU 0x55593259 +#define XVIMAGE_Y2YU \ + { \ + FOURCC_Y2YU, \ + XvYUV, \ + LSBFirst, \ + {'Y','2','Y','U', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 16, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 8, 8, \ + 1, 2, 2, \ + 1, 1, 1, \ + {'Y','V','Y','U', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } + +#define FOURCC_YVYU 0x55595659 +#define XVIMAGE_YVYU \ + { \ + FOURCC_YVYU, \ + XvYUV, \ + LSBFirst, \ + {'Y','V','Y','U', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 16, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 8, 8, \ + 1, 2, 2, \ + 1, 1, 1, \ + {'Y','V','Y','U', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } + +#define FOURCC_Y800 0x30303859 +#define XVIMAGE_Y800 \ + { \ + FOURCC_Y800, \ + XvYUV, \ + LSBFirst, \ + {'Y','8','0','0', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 8, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 0, 0, \ + 1, 0, 0, \ + 1, 0, 0, \ + {'Y','8','0','0', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galfns.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galfns.c:1.3 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galfns.c Wed Feb 5 13:38:42 2003 @@ -0,0 +1,4876 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galfns.c,v 1.3 2003/02/05 18:38:42 alanh Exp $ */ +/* + * $Workfile: nsc_galfns.c $ + * $Revision: 7 $ + * $Author: Sarma $ + * + * File Contents: This file contains the main functions of the Geode + * frame buffer device drivers GAL function definitions. + * + * Project: Geode Frame buffer device driver + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Geode frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Geode frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Geode frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef XFree86LOADER +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/sysmacros.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/ioctl.h> +#endif + +#include "nsc_galproto.h" + +/* + * Compile time constants + */ +#define FBDEV_NAME "/dev/nscgal" + +/* + * Cool Macros to access the structures + */ +#define INIT_GAL(x) \ + ((GAL_BASE *)(x))->dwSignature = FBGAL_SIGNATURE;\ + ((GAL_BASE *)(x))->dwSize = sizeof(x);\ + ((GAL_BASE *)(x))->dwVersion = FBGAL_VERSION; +/* + * Variables public for this file + */ +static int ifbdev_handle; + +/*------------------------------------------------------------------------ + * create_devicenode + * + * Description: This function creates nscgal device node in the device + * directory. + * parameters : none + * + * return: '0' was return on creating the galdevice node. + *----------------------------------------------------------------------*/ +int +create_devicenode() +{ + +#if 1 + FILE *pfdevices; + char line[200], devname[200]; + int majdev; + + /* remove fails if device is open */ + remove("/dev/nscgal"); + + if ((pfdevices = fopen("/proc/devices", "r"))) { + while (fgets(line, sizeof(line), pfdevices)) { + if (sscanf(line, "%d%*[ \t]%s", &majdev, devname) == 2) { + if (strstr(devname, "nscgal")) + mknod("/dev/nscgal", S_IFCHR | S_IRUSR | S_IWUSR, + makedev(majdev, 0)); + } + } + fclose(pfdevices); + } + return 1; +#endif + +} + +/*------------------------------------------------------------------------ + * Gal_initialize_interface + * + * Description: This function intializes the nscgal device . + * parameters : none + * + * return: '1' was returned on intialization of the galdevice + * otherwise '0' was returned on failure. + *----------------------------------------------------------------------*/ +BOOLEAN +Gal_initialize_interface() +{ +/* create_devicenode(); */ + + if ((ifbdev_handle = open("/dev/fb0", O_RDONLY)) == -1) +/* if ((ifbdev_handle = open("FBDEV_NAME", O_RDONLY)) == -1) */ + return 0; + return 1; +} + +/*------------------------------------------------------------------------ + * Gal_cleanup_interface + * + * Description: This function closes the nscgal device . + * parameters : none + * + * return: '1' was returned on closing the galdevice. + *----------------------------------------------------------------------*/ +BOOLEAN +Gal_cleanup_interface() +{ + if (ifbdev_handle != -1) + close(ifbdev_handle); + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_write_register + * + * Description: This function writes the data to the hardware register + * of the nscgal device . + * parameters: + * type: It specifies the hardware access type. + * offset: It specifies the offset address the register to be accessed. + * value: It specifies the data value to be written into the register. + * size: It specifies the size of the data to be written. + * + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_write_register(int type, unsigned long offset, unsigned long value, + int size) +{ + GAL_HWACCESS hwAccess; + + INIT_GAL(&hwAccess); + hwAccess.dwSubfunction = GALFN_WRITEREG; + hwAccess.dwType = type; + hwAccess.dwOffset = offset; + hwAccess.dwValue = value; + hwAccess.dwByteCount = size; + if (ioctl(ifbdev_handle, FBIOGAL_API, &hwAccess)) + return 0; + else { + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_read_register + * + * Description: This function reads the data from the hardware register + * of the nscgal device . + * parameters: + * type: It specifies the hardware access type. + * offset: It specifies the offset address of the register to be accessed. + * value: It specifies the pointer to hold the data to be read from + * the gal hardware register. + * size: It specifies the size of the data to be read + * + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_read_register(int type, unsigned long offset, unsigned long *value, + int size) +{ + GAL_HWACCESS hwAccess; + + INIT_GAL(&hwAccess); + hwAccess.dwSubfunction = GALFN_READREG; + hwAccess.dwType = type; + hwAccess.dwOffset = offset; + hwAccess.dwByteCount = size; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &hwAccess)) + return 0; + else { + *value = hwAccess.dwValue; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_get_adapter_info + * + * Description: This function gets the adapter information of the + * nscgal device . + * parameters: + *pAdapterInfo: It specifies the adapter information structure. + * + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_adapter_info(PGAL_ADAPTERINFO pAdapterInfo) +{ + INIT_GAL(pAdapterInfo); + + pAdapterInfo->dwSubfunction = GALFN_GETADAPTERINFO; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pAdapterInfo)) + return 0; + else { + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_softvga_state + * + * Description: This function sets the softvga state of the platform device . + * parameters: + * bEnable: It specifies the softvga state enable state. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_softvga_state(BOOLEAN bEnable) +{ + GAL_SOFTVGASTATE sSoftVgaState; + + INIT_GAL(&sSoftVgaState); + sSoftVgaState.dwSubfunction = GALFN_SETSOFTVGASTATE; + sSoftVgaState.bSoftVgaEnable = bEnable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSoftVgaState)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_softvga_state + * + * Description: This function gets the softvga state of the platform device . + * parameters: + * bEnable: get the softvga state. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_softvga_state(int *bState) +{ + GAL_SOFTVGASTATE sSoftVgaState; + + INIT_GAL(&sSoftVgaState); + sSoftVgaState.dwSubfunction = GALFN_GETSOFTVGASTATE; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSoftVgaState)) + return 0; + else { + *bState = sSoftVgaState.bSoftVgaEnable; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_vga_test_pci + * + * Description: This function tests the vga pci. + * parameters: + * softvga: It is pointer to the softvga state. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_test_pci(int *softvga) +{ + GAL_VGATESTPCI sVgatestpci; + + INIT_GAL(&sVgatestpci); + sVgatestpci.dwSubfunction = GALFN_GETSOFTVGASTATE; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sVgatestpci)) + return 0; + else { + *softvga = sVgatestpci.softvga; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_vga_get_pci_command + * + * Description: This function gets the vga pci command. + * parameters: + * value: It is pointer to pci command value. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_get_pci_command(unsigned char *value) +{ + GAL_VGAGETPCICOMMAND sVgagetpcicommand; + + INIT_GAL(&sVgagetpcicommand); + sVgagetpcicommand.dwSubfunction = GALFN_VGAGETPCICOMMAND; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sVgagetpcicommand)) + return 0; + else { + *value = sVgagetpcicommand.value; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_vga_seq_reset + * + * Description: This function resets the vga seq. + * parameters: + * reset: It gives the reset value. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_seq_reset(int reset) +{ + GAL_VGASEQRESET sVgaseqreset; + + INIT_GAL(&sVgaseqreset); + sVgaseqreset.dwSubfunction = GALFN_VGASEQRESET; + sVgaseqreset.reset = reset; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sVgaseqreset)) + return 0; + else { + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_vga_set_graphics_bits + * + * Description: This function resets the vga seq. + * parameters: None. + * + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_set_graphics_bits(void) +{ + GAL_VGASETGRAPHICSBITS sVgasetgraphics; + + INIT_GAL(&sVgasetgraphics); + sVgasetgraphics.dwSubfunction = GALFN_VGASETGRAPHICSBITS; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sVgasetgraphics)) + return 0; + else { + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_crt_enable + * + * Description: This function sets the crt state of the device . + * parameters: + * crtState: It specifies the crt state of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_crt_enable(int crtEnable) +{ + GAL_CRTENABLE sCrtEnable; + + INIT_GAL(&sCrtEnable); + sCrtEnable.dwSubfunction = GALFN_SETCRTENABLE; + sCrtEnable.wCrtEnable = crtEnable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCrtEnable)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_is_display_mode_supported + * + * Description: This function checks the display mode is supported or not. + * parameters: + * xres: It specifies x co-ordinate resolution. + * Yres: It specifies y co-ordinate resolution. + * bpp: It specifies the bits per pixel (8/16 bits). + * hz: It specifies the frequency of the display mode. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_is_display_mode_supported(int xres, int yres, int bpp, int hz, + int *supported) +{ + GAL_DISPLAYMODE sDisplayMode; + + *supported = 0; + INIT_GAL(&sDisplayMode); + sDisplayMode.dwSubfunction = GALFN_ISDISPLAYMODESUPPORTED; + sDisplayMode.wXres = xres; + sDisplayMode.wYres = yres; + sDisplayMode.wBpp = bpp; + sDisplayMode.wRefresh = hz; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayMode)) + return 0; + else { + *supported = sDisplayMode.dwSupported; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_mode + * + * Description: This function sets the display mode of the galdevice. + * parameters: + * xres: It specifies x co-ordinate resolution. + * Yres: It specifies y co-ordinate resolution. + * bpp: It specifies the bits per pixel (8/16 bits). + * hz: It specifies the frequency of the display mode. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_mode(int xres, int yres, int bpp, int hz) +{ + GAL_DISPLAYMODE sDisplayMode; + + INIT_GAL(&sDisplayMode); + sDisplayMode.dwSubfunction = GALFN_SETDISPLAYMODE; + sDisplayMode.wXres = xres; + sDisplayMode.wYres = yres; + sDisplayMode.wBpp = bpp; + sDisplayMode.wRefresh = hz; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayMode)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_mode + * + * Description: This function gets the display mode of the galdevice. + * parameters: + * xres: It specifies x co-ordinate resolution. + * Yres: It specifies y co-ordinate resolution. + * bpp: It specifies the bits per pixel (8/16 bits). + * hz: It specifies the frequency of the display mode. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +{ + GAL_DISPLAYMODE sDisplayMode; + + INIT_GAL(&sDisplayMode); + sDisplayMode.dwSubfunction = GALFN_GETDISPLAYMODE; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayMode)) + return 0; + else { + *xres = sDisplayMode.wXres; + *yres = sDisplayMode.wYres; + *bpp = sDisplayMode.wBpp; + *hz = sDisplayMode.wRefresh; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_bpp + * + * Description: This function sets the number bits per pixel in the display + * mode of the galdevice. + * parameters: + * bpp: It specifies the bits per pixel (8/16 bits). + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_bpp(unsigned short bpp) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_SETDISPLAYBPP; + sDisplayParams.wBpp = bpp; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_set_bpp + * + * Description: This function sets the number bits per pixel in the display + * mode of the galdevice. + * parameters: + * bpp: It specifies the bits per pixel (8/16 bits). + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_bpp(unsigned short bpp) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_SETBPP; + sDisplayParams.wBpp = bpp; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_bpp + * + * Description: This function gets the number bits per pixel in the display + * mode of the galdevice. + * parameters: + * bpp: It specifies the bits per pixel (8/16 bits). + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_bpp(unsigned short *bpp) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_GETDISPLAYBPP; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else { + *bpp = sDisplayParams.wBpp; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_pitch + * + * Description: This function sets the display pitch of the galdevice. + * parameters: + * pitch: It specifies pitch of the display mode. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_pitch(unsigned short pitch) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_SETDISPLAYPITCH; + sDisplayParams.wPitch = pitch; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_pitch + * + * Description: This function gets the display pitch of the galdevice. + * parameters: + * pitch: It specifies pitch of the display mode. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_pitch(unsigned short *pitch) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_GETDISPLAYPITCH; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else { + *pitch = sDisplayParams.wPitch; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_offset + * + * Description: This function sets the offset of display parameters. + * parameters: + * offset: It specifies the offset address of display parameters. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_offset(unsigned long offset) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_SETDISPLAYOFFSET; + sDisplayParams.dwOffset = offset; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_offset + * + * Description: This function gets the offset of display parameters. + * parameters: + * offset: It specifies the offset address of display parameters. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_offset(unsigned long *offset) +{ + GAL_DISPLAYPARAMS sDisplayParams; + + INIT_GAL(&sDisplayParams); + sDisplayParams.dwSubfunction = GALFN_GETDISPLAYOFFSET; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDisplayParams)) + return 0; + else { + *offset = sDisplayParams.dwOffset; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_get_refreshrate_from_dotclock + * + * Description: This function gets the refreshrate from dotclock. + * parameters: + * xres: It specifies x co-ordinate resolution. + * Yres: It specifies y co-ordinate resolution. + * bpp: It specifies the bits per pixel (8/16 bits). + * hz: It is a pointer which holds the refresh rate of the display. + * frequency: It spcifies the frequency of the dotclock. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_refreshrate_from_dotclock(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +{ + GAL_DOTCLKTOREFRESH sDclkToRefresh; + + INIT_GAL(&sDclkToRefresh); + sDclkToRefresh.dwSubfunction = GALFN_DOTCLKTOREFRESH; + sDclkToRefresh.wXres = xres; + sDclkToRefresh.wYres = yres; + sDclkToRefresh.wBpp = bpp; + sDclkToRefresh.dwDotClock = frequency; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sDclkToRefresh)) + return 0; + else { + *hz = sDclkToRefresh.wRefreshRate; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_timing + * + * Description: This function gets the display timing from galdevice. + * parameters: + * pDisplayTiming: It specifies the display timing of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_timing(PGAL_DISPLAYTIMING pDisplayTiming) +{ + INIT_GAL(pDisplayTiming); + pDisplayTiming->dwSubfunction = GALFN_GETDISPLAYTIMINGS; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pDisplayTiming)) + return 0; + else { + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_timing + * + * Description: This function sets the display timing of the galdevice. + * parameters: + * pDisplayTiming: It specifies the display timing of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_timing(PGAL_DISPLAYTIMING pDisplayTiming) +{ + INIT_GAL(pDisplayTiming); + pDisplayTiming->dwSubfunction = GALFN_SETDISPLAYTIMINGS; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pDisplayTiming)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_set_fixed_timings + * + * Description: This function sets the fixed display timings of the + * galdevice. + * parameters: + * pnlXres: It specifies the panel X resolution. + * pnlYres: It specifies the panel Y resolution. + * totXres: It specifies the total X resolution. + * totYres: It specifies the total Y resolution. + * bpp: It specifies the bits per pixel (8/16 bits). + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_fixed_timings(int pnlXres, int pnlYres, int totXres, + int totYres, int bpp) +{ + GAL_DISPLAYTIMING DisplayTiming; + + INIT_GAL(&DisplayTiming); + DisplayTiming.dwSubfunction = GALFN_SETFIXEDTIMINGS; + DisplayTiming.wHActive = pnlXres; /* panel Xres */ + DisplayTiming.wVActive = pnlYres; /* panel Yres */ + DisplayTiming.wHTotal = totXres; /* Total Xres */ + DisplayTiming.wVTotal = totYres; /* Total Yres */ + DisplayTiming.wBpp = bpp; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &DisplayTiming)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_palette_entry + * + * Description: This function sets the display palette entry of the + * galdevice. + * parameters: + * index: It specifies the palette index, + * palette: It specifies the palette of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_palette_entry(unsigned long index, unsigned long palette) +{ + GAL_PALETTE_ENTRY sPalette; + + INIT_GAL(&sPalette); + sPalette.dwSubfunction = GALFN_SETPALETTE_ENTRY; + sPalette.dwIndex = index; + sPalette.dwPalette = palette; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sPalette)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_palette_entry + * + * Description: This function gets the display palette entry of the + * galdevice. + * parameters: + * index: It specifies the palette index, + * palette: It is a pointer to the palette of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_palette_entry(unsigned long index, unsigned long *palette) +{ + GAL_PALETTE_ENTRY sPalette; + + INIT_GAL(&sPalette); + sPalette.dwSubfunction = GALFN_GETPALETTE_ENTRY; + sPalette.dwIndex = index; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sPalette)) + return 0; + else { + *palette = sPalette.dwPalette; + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_set_display_palette_entry + * + * Description: This function sets the display palette entry of the + * galdevice. + * parameters: + * pPalette: It specifies the palette structure of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_display_palette(PGAL_PALETTE pPalette) +{ + INIT_GAL(pPalette); + pPalette->dwSubfunction = GALFN_SETPALETTE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pPalette)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_get_display_palette_entry + * + * Description: This function gets the display palette entry of the + * galdevice. + * parameters: + * pPalette: It specifies the palette structure of the galdevice. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_display_palette(PGAL_PALETTE pPalette) +{ + INIT_GAL(pPalette); + pPalette->dwSubfunction = GALFN_GETPALETTE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pPalette)) + return 0; + else { + return 1; + } +} + +/*--------------------------------------------------------------------------- + * Gal_wait_until_idle + * + * Description: This function waits until the graphics engine is idle. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_wait_until_idle(void) +{ + GAL_WAITUNTILIDLE sWaitIdle; + + INIT_GAL(&sWaitIdle); + sWaitIdle.dwSubfunction = GALFN_WAITUNTILIDLE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sWaitIdle)) + return 0; + else + return 1; +} + +/*--------------------------------------------------------------------------- + * Gal_wait_vertical_blank + * + * Description: This function wait until start of vertical blank. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_wait_vertical_blank(void) +{ + GAL_WAITVERTICALBLANK sWaitVerticalBlank; + + INIT_GAL(&sWaitVerticalBlank); + sWaitVerticalBlank.dwSubfunction = GALFN_WAITVERTICALBLANK; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sWaitVerticalBlank)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_cursor_enable + * + * Description: This function enable or disable the hardware cursor. + * parameters: + * enable: This specifies the enable value of the cursor. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_cursor_enable(int enable) +{ + GAL_CURSORENABLE sCursorEnable; + + INIT_GAL(&sCursorEnable); + sCursorEnable.dwSubfunction = GALFN_SETCURSORENABLE; + sCursorEnable.bCursorEnable = enable ? 1 : 0; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorEnable)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_cursor_position + * + * Description: This function sets the position of the cursor. + * parameters: + * memoffset: It specifies the memory offset of the cursor position. + * xpos: It specifies the X co-ordinate position of the cursor. + * ypos: It specifies the Y co-ordinate position of the cursor. + * xhotspot: It specifies the X hotspot location for current cursor shape. + * yhotspot: It specifies the Y hotspot location for current cursor shape. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +{ + GAL_CURSORPOSITION sCursorPos; + + INIT_GAL(&sCursorPos); + sCursorPos.dwSubfunction = GALFN_SETCURSORPOSITION; + sCursorPos.dwMemOffset = memoffset; + sCursorPos.wXPos = xpos; + sCursorPos.wYPos = ypos; + sCursorPos.wXHot = xhotspot; + sCursorPos.wYHot = yhotspot; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorPos)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_cursor_position + * + * Description: This function gets the cursor position. + * parameters: + * memoffset: It points the memory offset of the cursor position. + * xpos: It points the X co-ordinate position of the cursor. + * ypos: It points the Y co-ordinate position of the cursor. + * xhotspot: It points the X hotspot location for current cursor shape. + * yhotspot: It points the Y hotspot location for current cursor shape. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_cursor_position(unsigned long *memoffset, + unsigned short *xpos, unsigned short *ypos, + unsigned short *xhotspot, unsigned short *yhotspot) +{ + GAL_CURSORPOSITION sCursorPos; + + INIT_GAL(&sCursorPos); + sCursorPos.dwSubfunction = GALFN_GETCURSORPOSITION; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorPos)) + return 0; + else { + *memoffset = sCursorPos.dwMemOffset; + *xpos = sCursorPos.wXPos; + *ypos = sCursorPos.wYPos; + *xhotspot = sCursorPos.wXHot; + *yhotspot = sCursorPos.wYHot; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_cursor_shape32 + * + * Description: This function loads 32x32 cursor pattern. + * parameters: + * memoffset: It specifies the graphics memory offset for cursor shape. + * andmask: It is a pointer to 32 DWORD of AND data. + * xormask: It is a pointer to 32 DWORD of XOR data. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +{ + GAL_SETCURSORSHAPE sCursorShape; + + INIT_GAL(&sCursorShape); + sCursorShape.dwSubfunction = GALFN_SETCURSORSHAPE; + sCursorShape.dwMemOffset = memoffset; + + memcpy(sCursorShape.dwAndMask, andmask, sizeof(sCursorShape.dwAndMask)); + + memcpy(sCursorShape.dwXorMask, xormask, sizeof(sCursorShape.dwXorMask)); + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorShape)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_cursor_shape64 + * + * Description: This function loads 64x64 cursor pattern. + * parameters: + * memoffset: It specifies the graphics memory offset for cursor shape. + * andmask: It is a pointer to 64 DWORD of AND data. + * xormask: It is a pointer to 64 DWORD of XOR data. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ BOOLEAN +Gal_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +{ + GAL_SETCURSORSHAPE sCursorShape; + + INIT_GAL(&sCursorShape); + sCursorShape.dwSubfunction = GALFN_SETCURSORSHAPE_RCLD; + sCursorShape.dwMemOffset = memoffset; + + memcpy(sCursorShape.dwAndMask, andmask, sizeof(sCursorShape.dwAndMask)); + + memcpy(sCursorShape.dwXorMask, xormask, sizeof(sCursorShape.dwXorMask)); + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorShape)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_cursor_colors + * + * Description: This function sets the colors of the hardware cursor. + * parameters: + * bkcolor:It specifies the RGB value for the background color. + * fgcolor:It specifies the RGB value for the foreground color. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +{ + GAL_CURSORCOLORS sCursorColor; + + INIT_GAL(&sCursorColor); + sCursorColor.dwSubfunction = GALFN_SETCURSORCOLORS; + sCursorColor.dwBgColor = bkcolor; + sCursorColor.dwFgColor = fgcolor; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorColor)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_cursor_colors + * + * Description: This function gets the colors of the hardware cursor. + * parameters: + * bkcolor:It points the RGB value for the background color. + * fgcolor:It points the RGB value for the foreground color. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_cursor_colors(unsigned long *bkcolor, unsigned long *fgcolor) +{ + GAL_CURSORCOLORS sCursorColor; + + INIT_GAL(&sCursorColor); + sCursorColor.dwSubfunction = GALFN_GETCURSORCOLORS; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCursorColor)) + return 0; + else { + *bkcolor = sCursorColor.dwBgColor; + *fgcolor = sCursorColor.dwFgColor; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_solid_pattern + * + * Description: This function sets a solid pattern color for future rendering. + * parameters: + * color: It specifies the pattern color in proper format for current + * display mode. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_solid_pattern(unsigned long color) +{ + GAL_SETSOLIDPATTERN sSetSoildPat; + + INIT_GAL(&sSetSoildPat); + sSetSoildPat.dwSubfunction = GALFN_SETSOLIDPATTERN; + sSetSoildPat.dwColor = color; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetSoildPat)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_solid_source + * + * Description: This function specifies a constant source data value for + * raster operations that use both pattern + * and source data. + * parameters: + * color: It specifies the source color. + * return: '1' was returned on success otherwise '0' was returned. + *-------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_solid_source(unsigned long color) +{ + GAL_SETSOLIDSOURCE sSetSolidSrc; + + INIT_GAL(&sSetSolidSrc); + sSetSolidSrc.dwSubfunction = GALFN_SETSOLIDSOURCE; + sSetSolidSrc.dwColor = color; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetSolidSrc)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_mono_source + * + * Description: + * parameters: + * bkcolor: It specifies the background color. + * fgcolor: It specifies the foreground color. + *transparency: It specifies the transparency flag. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned char transparency) +{ + GAL_SETMONOSOURCE sSetMonoSrc; + + INIT_GAL(&sSetMonoSrc); + sSetMonoSrc.dwSubfunction = GALFN_SETMONOSOURCE; + sSetMonoSrc.dwFgColor = fgcolor; + sSetMonoSrc.dwBgColor = bgcolor; + sSetMonoSrc.cTransparency = transparency; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetMonoSrc)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_mono_pattern + * + * Description: This function specifies an 8x8 monochrome pattern + * used in future rendering operations. + * parameters: + * bkcolor: It specifies the background color. + * fgcolor: It specifies the foreground color. + * data0: It specifies the bits of 8x8 monochrome pattern. + * data1: It specifies the bits of 8x8 monochrome pattern. + *transparency: It specifies the transparency flag. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparency) +{ + GAL_SETMONOPATTERN sSetMonoPat; + + INIT_GAL(&sSetMonoPat); + sSetMonoPat.dwSubfunction = GALFN_SETMONOPATTERN; + sSetMonoPat.dwFgColor = fgcolor; + sSetMonoPat.dwBgColor = bgcolor; + sSetMonoPat.dwData0 = data0; + sSetMonoPat.dwData1 = data1; + sSetMonoPat.cTransparency = transparency; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetMonoPat)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_raster_operation + * + * Description: This function specifies the raster operation for + * future rendering. + * parameters: + * rop: It specifies the ternary raster operation + * (pattern/source/destination). + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_raster_operation(unsigned char rop) +{ + GAL_RASTEROPERATION sSetRop; + + INIT_GAL(&sSetRop); + sSetRop.dwSubfunction = GALFN_SETRASTEROPERATION; + sSetRop.cRop = rop; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetRop)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_pattern_fill + * + * Description: This function renders pattern data to a rectangular + * region. + * parameters: + * x: It specifies the screen X position, in pixels. + * y: It specifies the screen Y position, in pixels. + * width: It specifies the width of rectangle, in pixels. + * height: It specifies the height of rectangle, in pixels. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +{ + GAL_PATTERNFILL sPatternFill; + + INIT_GAL(&sPatternFill); + sPatternFill.dwSubfunction = GALFN_PATTERNFILL; + sPatternFill.wXPos = x; + sPatternFill.wYPos = y; + sPatternFill.wWidth = width; + sPatternFill.wHeight = height; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sPatternFill)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_screen_to_screen_blt + * + * Description: This function is used to perform a screen to screen + * BLT operation. + * parameters: + * srcx: It specifies the source X position. + * srcy: It specifies the source Y position. + * dstx: It specifies the destination X position. + * dsty: It specifies the destination Y position. + * width: It specifies the width of BLT, in pixels. + * height: It specifies the height of BLT, in pixels. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) +{ + GAL_SCREENTOSCREENBLT sScreenBlt; + + INIT_GAL(&sScreenBlt); + sScreenBlt.dwSubfunction = GALFN_SCREENTOSCREENBLT; + sScreenBlt.wXStart = srcx; + sScreenBlt.wYStart = srcy; + sScreenBlt.wXEnd = dstx; + sScreenBlt.wYEnd = dsty; + sScreenBlt.wWidth = width; + sScreenBlt.wHeight = height; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sScreenBlt)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_screen_to_screen_xblt + * + * Description: This function is used to perform a screen to screen + * BLT operation using a transparency color. + * parameters: + * srcx: It specifies the source X position. + * srcy: It specifies the source Y position. + * dstx: It specifies the destination X position. + * dsty: It specifies the destination Y position. + * width: It specifies the width of BLT, in pixels. + * height: It specifies the height of BLT, in pixels. + * color: It specifies the transparency color. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) +{ + GAL_SCREENTOSCREENXBLT sScreenXBlt; + + INIT_GAL(&sScreenXBlt); + sScreenXBlt.dwSubfunction = GALFN_SCREENTOSCREENXBLT; + sScreenXBlt.wXStart = srcx; + sScreenXBlt.wYStart = srcy; + sScreenXBlt.wXEnd = dstx; + sScreenXBlt.wYEnd = dsty; + sScreenXBlt.wWidth = width; + sScreenXBlt.wHeight = height; + sScreenXBlt.dwColor = color; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sScreenXBlt)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_bresenham_line + * + * Description: This function is used to draw a single pixel line + * using the specified Bresenham parameters. + * parameters: + * x: It specifies the starting X position. + * y: It specifies the starting Y position. + * length: It specifies the length of the vector, in pixels. + * initerr: It specifies the Bresenham initial error term. + * axialerr: It specifies the Bresenham axial error term + * (moving in major direction only). + * diagerr: It specifies Bresenham diagonal error term + * (moving in major and minor direction. + * flags: It specifies the flag. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +{ + GAL_BRESENHAMLINE sBresenhamLine; + + INIT_GAL(&sBresenhamLine); + sBresenhamLine.dwSubfunction = GALFN_BRESENHAMLINE; + sBresenhamLine.wX1 = x; + sBresenhamLine.wY1 = y; + sBresenhamLine.wLength = length; + sBresenhamLine.wErr = initerr; + sBresenhamLine.wE1 = axialerr; + sBresenhamLine.wE2 = diagerr; + sBresenhamLine.wFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sBresenhamLine)) + return 0; + else + return 1; +} + +BOOLEAN +Gal_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long pattern) +{ + GAL_COLOR_PATTERNFILL sColorPat; + + INIT_GAL(&sColorPat); + sColorPat.dwSubfunction = GALFN_COLOR_PATTERNFILL; + sColorPat.wDstx = x; + sColorPat.wDsty = y; + sColorPat.wWidth = width; + sColorPat.wHeight = height; + sColorPat.dwPattern = pattern; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sColorPat)) + return 0; + else + return 1; +} + +BOOLEAN +Gal_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long data, long pitch) +{ + GAL_COLOR_BITMAP_TO_SCREEN_BLT sBmp2Scr; + + INIT_GAL(&sBmp2Scr); + sBmp2Scr.dwSubfunction = GALFN_COLOR_BITMAP_TO_SCREEN_BLT; + sBmp2Scr.wSrcx = srcx; + sBmp2Scr.wSrcy = srcy; + sBmp2Scr.wDstx = dstx; + sBmp2Scr.wDsty = dsty; + sBmp2Scr.wWidth = width; + sBmp2Scr.wHeight = height; + sBmp2Scr.dwData = data; + sBmp2Scr.wPitch = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sBmp2Scr)) + return 0; + else + return 1; +} + +BOOLEAN +Gal_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long data, long pitch, + unsigned long color) +{ + GAL_COLOR_BITMAP_TO_SCREEN_XBLT sBmp2Scr; + + INIT_GAL(&sBmp2Scr); + sBmp2Scr.dwSubfunction = GALFN_COLOR_BITMAP_TO_SCREEN_XBLT; + sBmp2Scr.wSrcx = srcx; + sBmp2Scr.wSrcy = srcy; + sBmp2Scr.wDstx = dstx; + sBmp2Scr.wDsty = dsty; + sBmp2Scr.wWidth = width; + sBmp2Scr.wHeight = height; + sBmp2Scr.dwData = data; + sBmp2Scr.wPitch = pitch; + sBmp2Scr.dwColor = color; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sBmp2Scr)) + return 0; + else + return 1; +} + +BOOLEAN +Gal_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long data, short pitch) +{ + GAL_MONO_BITMAP_TO_SCREEN_BLT sBmp2Scr; + + INIT_GAL(&sBmp2Scr); + sBmp2Scr.dwSubfunction = GALFN_MONO_BITMAP_TO_SCREEN_BLT; + sBmp2Scr.wSrcx = srcx; + sBmp2Scr.wSrcy = srcy; + sBmp2Scr.wDstx = dstx; + sBmp2Scr.wDsty = dsty; + sBmp2Scr.wWidth = width; + sBmp2Scr.wHeight = height; + sBmp2Scr.dwData = data; + sBmp2Scr.wPitch = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sBmp2Scr)) + return 0; + else + return 1; +} + +BOOLEAN +Gal_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long data) +{ + GAL_TEXT_BLT sTextBlt; + + INIT_GAL(&sTextBlt); + sTextBlt.dwSubfunction = GALFN_TEXT_BLT; + sTextBlt.wDstx = dstx; + sTextBlt.wDsty = dsty; + sTextBlt.wWidth = width; + sTextBlt.wHeight = height; + sTextBlt.dwData = data; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sTextBlt)) + return 0; + else + return 1; +} + +/*------------------------------------------------------------------------ + * Gal_set_compression_enable + * + * Description: This function enables or disables display + * compression. + * parameters: + * bCompressionState: It specifies the display compression state. + * return: '1' was returned on success otherwise + * '0' was returned. + *----------------------------------------------------------------------*/ +BOOLEAN +Gal_set_compression_enable(BOOLEAN bCompressionState) +{ + GAL_COMPRESSIONSTATE sCompState; + + INIT_GAL(&sCompState); + sCompState.dwSubfunction = GALFN_SETCOMPRESSIONSTATE; + sCompState.bCompressionState = bCompressionState; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCompState)) + return 0; + else + return 1; +} + +/*------------------------------------------------------------------------ + * Gal_get_compression_enable + * + * Description: This function gets the compression state. + * + * parameters: + * bCompressionState: gets the display compression state. + * return: '1' was returned on success otherwise + * '0' was returned. + *----------------------------------------------------------------------*/ +BOOLEAN +Gal_get_compression_enable(int *bCompressionState) +{ + GAL_COMPRESSIONSTATE sCompState; + + INIT_GAL(&sCompState); + sCompState.dwSubfunction = GALFN_GETCOMPRESSIONSTATE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCompState)) + return 0; + else { + *bCompressionState = sCompState.bCompressionState; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_compression_parameters + * + * Description: This function sets the compression parameters of the + * frame buffer device. + * parameters: + * flags: It specifies the flag. + * offset: It specifies the base offset in graphics memory for the + * compression buffer. + * pitch: It specifies the pitch of compression buffer, in bytes. + * size: It specifies the maximum line size of the compression buffer + * in bytes. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_compression_parameters(unsigned long flags, + unsigned long offset, unsigned short pitch, + unsigned short size) +{ + GAL_COMPRESSIONPARAMS sCompParams; + + INIT_GAL(&sCompParams); + sCompParams.dwSubfunction = GALFN_SETCOMPRESSIONPARAMS; + sCompParams.dwFlags = flags; + sCompParams.dwCompOffset = offset; + sCompParams.dwCompPitch = pitch; + sCompParams.dwCompSize = size; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCompParams)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_compression_parameters + * + * Description: This function gets the compression parameters of the + * frame buffer device. + * parameters: + * flags: It specifies the flag. + * offset: gets the base offset in graphics memory for the + * compression buffer. + * pitch: gets the pitch of compression buffer, in bytes. + * size: gets the maximum line size of the compression buffer + * in bytes. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_compression_parameters(unsigned long flags, + unsigned long *offset, + unsigned short *pitch, unsigned short *size) +{ + GAL_COMPRESSIONPARAMS sCompParams; + + INIT_GAL(&sCompParams); + sCompParams.dwSubfunction = GALFN_GETCOMPRESSIONPARAMS; + sCompParams.dwFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sCompParams)) + return 0; + else { + *offset = sCompParams.dwCompOffset; + *pitch = sCompParams.dwCompPitch; + *size = sCompParams.dwCompSize; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_vga_mode_switch + * + * Description:This function signals the beginning or end of a + * mode switch. + * parameters: + * active: It specifies the mode switch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_mode_switch(int active) +{ + GAL_VGAMODEDATA sVgaData; + + INIT_GAL(&sVgaData); + sVgaData.dwSubfunction = GALFN_VGAMODESWITCH; + sVgaData.dwFlags = active; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sVgaData)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_vga_clear_extended + * + * Description: This will clear the Svga data. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_clear_extended(void) +{ + GAL_VGAMODEDATA sVgaData; + + INIT_GAL(&sVgaData); + sVgaData.dwSubfunction = GALFN_VGACLEARCRTEXT; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sVgaData)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_vga_pitch + * + * Description: This function sets VGA register values in VGA + * structure for specified pitch. + * parameters: + * pVgaData: It specifies the vga structure. + * pitch: It specifies the number of bytes between scanlines. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_pitch(PGAL_VGAMODEDATA pVgaData, unsigned short pitch) +{ + INIT_GAL(pVgaData); + pVgaData->dwSubfunction = GALFN_VGASETPITCH; + pVgaData->dwFlags = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pVgaData)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_vga_restore + * + * Description: This function sets the VGA state to the values in the + * VGA structure. + * parameters: + * pVgaData: It specifies the vga structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_restore(PGAL_VGAMODEDATA pVgaData) +{ + INIT_GAL(pVgaData); + pVgaData->dwSubfunction = GALFN_VGARESTORE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pVgaData)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_vga_save + * + * Description: This function saves the current VGA state in the + * VGA structure. + * parameters: + * pVgaData: It specifies the vga structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_save(PGAL_VGAMODEDATA pVgaData) +{ + INIT_GAL(pVgaData); + pVgaData->dwSubfunction = GALFN_VGASAVE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pVgaData)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_vga_mode + * + * Description: This function sets VGA register values in VGA + * structure for specified mode. + * parameters: + * pVgaData: It specifies the vga structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_vga_mode(PGAL_VGAMODEDATA pVgaData) +{ + INIT_GAL(pVgaData); + pVgaData->dwSubfunction = GALFN_VGASETMODE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pVgaData)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_enabled_in_bios + * + * Description: This function gets the status of the FP in BIOS. + * parameters: + * status: returns the state of FP in Bios. + * pParam: It specifies the panel parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_enabled_in_bios(int *state) +{ + GAL_PNLBIOS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLBIOSENABLE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + *state = pStat.state; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_info_from_bios + * + * Description: This function gets the parameters of the FP in BIOS. + * parameters: + * status: returns the state of FP in Bios. + * pParam: It specifies the panel parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_info_from_bios(int *xres, int *yres, int *bpp, int *hz) +{ + GAL_PNLBIOS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLBIOSINFO; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + *xres = pStat.XRes; + *yres = pStat.YRes; + *bpp = pStat.Bpp; + *hz = pStat.Freq; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_set_params + * + * Description: This function sets the panel parameters. + * parameters: + * flags: + * pParam: It specifies the panel parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_set_params(unsigned long flags, PPnl_PanelParams pParam) +{ + GAL_PNLPARAMS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLSETPARAMS; + pParam->Flags = flags; + memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams)); + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_get_params + * + * Description: This function gets the panel parameters. + * parameters: + * flags: + * pParam: It specifies the panel parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_get_params(unsigned long flags, PPnl_PanelParams pParam) +{ + GAL_PNLPARAMS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLGETPARAMS; + memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams)); + pStat.PanelParams.Flags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + memcpy(pParam, &(pStat.PanelParams), sizeof(Pnl_PanelParams)); + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_init + * + * Description: This function initializes the panel parameters. + * parameters: + * pParam: It specifies the panel parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_init(PPnl_PanelParams pParam) +{ + GAL_PNLPARAMS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLINITPANEL; + memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams)); + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else + return 1; + +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_save + * + * Description: This function saves the current panel parameters. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_save(void) +{ + GAL_PNLPARAMS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLSAVESTATE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_restore + * + * Description: This function restores the current panel parameters. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_restore(void) +{ + GAL_PNLPARAMS pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLRESTORESTATE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_powerup + * + * Description: This function powers up the panel. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_powerup(void) +{ + GAL_BASE pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLPOWERUP; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_pnl_powerdown + * + * Description: This function powers down the panel. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_pnl_powerdown(void) +{ + GAL_BASE pStat; + + INIT_GAL(&pStat); + pStat.dwSubfunction = GALFN_PNLPOWERDOWN; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pStat)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_tv_set_params + * + * Description: This function sets the tv parameters of + * tvparameters structure. + * parameters: + * flags: + * pTV: It specifies the tv parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_tv_set_params(unsigned long flags, PGAL_TVPARAMS pTV) +{ + INIT_GAL(pTV); + pTV->dwSubfunction = GALFN_SETTVPARAMS; + pTV->dwFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pTV)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_tv_get_params + * + * Description: This function gets the tv parameters of + * tvparameters structure. + * parameters: + * flags: Dummy flag + * pTV: It specifies the tv parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_tv_get_params(unsigned long flags, PGAL_TVPARAMS pTV) +{ + INIT_GAL(pTV); + pTV->dwSubfunction = GALFN_GETTVPARAMS; + pTV->dwFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pTV)) + return 0; + else + return 1; + +} + +/*-------------------------------------------------------------------------- + * Gal_tv_set_timings + * + * Description: This function sets the tv timing registers. + * parameters: + * flags: Dummy flag. + * pTV: It specifies the tv parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_tv_set_timings(unsigned long flags, PGAL_TVTIMING pTV) +{ + INIT_GAL(pTV); + pTV->dwSubfunction = GALFN_SETTVTIMING; + pTV->dwFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pTV)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_tv_get_timings + * + * Description: This function gets the tv timing registers. + * parameters: + * flags: Dummy flag. + * pTV: It specifies the tv parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_tv_get_timings(unsigned long flags, PGAL_TVTIMING pTV) +{ + INIT_GAL(pTV); + pTV->dwSubfunction = GALFN_GETTVTIMING; + pTV->dwFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pTV)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_tv_enable + * + * Description: This function sets the tv state of the device . + * parameters: + * bState : set the tv state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_tv_enable(int bState) +{ + GAL_TVPARAMS pTV; + + INIT_GAL(&pTV); + pTV.dwSubfunction = GALFN_SETENABLE; + pTV.bState = bState; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pTV)) + return 0; + else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_tv_enable + * + * Description: This function gets the tv state of the device . + * parameters: + * bState : get the tv state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_tv_enable(unsigned int *bState) +{ + GAL_TVPARAMS pTV; + + INIT_GAL(&pTV); + pTV.dwSubfunction = GALFN_GETENABLE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &pTV)) { + *bState = 0; + return 0; + } else { + *bState = pTV.bState; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_is_tv_mode_supported + * + * Description: This function checks the tv mode is supported or not. + * parameters: + * flags: Dummy flag + * pTV: It specifies the tv parameters structure. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_is_tv_mode_supported(unsigned long flags, PGAL_TVPARAMS pTV, int *bState) +{ + INIT_GAL(pTV); + pTV->dwSubfunction = GALFN_ISTVMODESUPPORTED; + pTV->dwFlags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, pTV)) { + return 0; + } else { + *bState = pTV->bState; + return 1; + } +} + +/** Video **********************************************************/ + +/*-------------------------------------------------------------------------- + * Gal_set_video_enable + * + * Description: This function sets the video enable state. + * parameters: + * enable: Its value is '1' to enable video and '0' to disable video. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_enable(int enable) +{ + GAL_VIDEOENABLE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOENABLE; + sSetVideo.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_format + * + * Description: This function sets the video format. + * parameters: + * format: Its video format value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_format(int format) +{ + GAL_VIDEOFORMAT sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOFORMAT; + sSetVideo.format = format; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_size + * + * Description: This function sets the video size. + * parameters: + * width: Width of the video. + * height: Height of the video. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_size(unsigned short width, unsigned short height) +{ + GAL_VIDEOSIZE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOSIZE; + sSetVideo.width = width; + sSetVideo.height = height; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_offset + * + * Description: This function sets the video size. + * parameters: + * offset: Offset of the video. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_offset(unsigned long offset) +{ + GAL_VIDEOOFFSET sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOOFFSET; + sSetVideo.offset = offset; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_window + * + * Description: This function sets the video window. + * parameters: + * x: X co-ordinate of the Video screen. + * y: Y co-ordinate of the Video screen. + * w: Width of the Video screen. + * h: Height of the Video screen. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_window(short x, short y, short w, short h) +{ + GAL_VIDEOWINDOW sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOWINDOW; + sSetVideo.x = x; + sSetVideo.y = y; + sSetVideo.w = w; + sSetVideo.h = h; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_scale + * + * Description: This function sets the video scale. + * parameters: + * srcw: Source width. + * srch: Source height. + * dstw: Destination width. + * dsth: Destination height. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + GAL_VIDEOSCALE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOSCALE; + sSetVideo.srcw = srcw; + sSetVideo.srch = srch; + sSetVideo.dstw = dstw; + sSetVideo.dsth = dsth; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_filter. + * + * Description: This function sets the video filter. + * parameters: + * xfilter: X-co-ordinate filter. + * yfilter: Y-co-ordinate filter. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_filter(int xfilter, int yfilter) +{ + GAL_VIDEOFILTER sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOFILTER; + sSetVideo.xfilter = xfilter; + sSetVideo.yfilter = yfilter; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_color_key. + * + * Description: This function sets the video color key. + * parameters: + * key: Color key. + * mask: Color mask. + * bluescreen: Value for bluescreen. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_color_key(unsigned long key, unsigned long mask, int bluescreen) +{ + GAL_VIDEOCOLORKEY sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOCOLORKEY; + sSetVideo.key = key; + sSetVideo.mask = mask; + sSetVideo.bluescreen = bluescreen; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_downscale_enable. + * + * Description: This function sets the video downscale enable state. + * parameters: + * enable: Value for enable or disable the video downscale. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_downscale_enable(int enable) +{ + GAL_VIDEODOWNSCALEENABLE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALEENABLE; + sSetVideo.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_downscale_config. + * + * Description: This function sets the video downscale configuration. + * parameters: + * type: Video down scale type. + * m: Factor for the Video overlay window. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_downscale_config(unsigned short type, unsigned short m) +{ + GAL_VIDEODOWNSCALECONFIG sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALECONFIG; + sSetVideo.type = type; + sSetVideo.m = m; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_downscale_coefficients. + * + * Description: This function sets the video downscale coefficients. + * parameters: + * coef1: Video downscale filter coefficient. + * coef2: Video downscale filter coefficient. + * coef3: Video downscale filter coefficient. + * coef4: Video downscale filter coefficient. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) +{ + GAL_VIDEODOWNSCALECOEFF sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALECOEFF; + sSetVideo.coef1 = coef1; + sSetVideo.coef2 = coef2; + sSetVideo.coef3 = coef3; + sSetVideo.coef4 = coef4; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_source. + * + * Description: This function sets the video source to either memory or Direct + * VIP + * parameters: + * source: Video source. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_source(int source) +{ + GAL_VIDEOSOURCE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOSOURCE; + sSetVideo.source = source; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_interlaced + * + * Description: This function configures the Video processor video overlay mode + * to be interlaced YUV. + * parameters: + * enable: Value used to enable or disalbe the Video interlaced. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ + +BOOLEAN +Gal_set_video_interlaced(int enable) +{ + GAL_SETVIDEOINTERLACED sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOINTERLACED; + sSetVideo.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_color_space + * + * Description: This function configures the Video processor to prcoess + * graphics and video in either YUV or RGB color space. + * + * parameters: + * enable: Value used to enable or disalbe the Video color space. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_color_space_YUV(int colorspace) +{ + GAL_COLORSPACEYUV sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOCOLORSPACE; + sSetVideo.colorspace = colorspace; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_cursor. + * + * Description: This function configures the Video Hardware cursor. + * + * + * parameters: + * key: color key. + * mask: color mask. + *select_color2: selected for color2. + * color1: color1 value. + * color2: color2 value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_cursor(unsigned long key, + unsigned long mask, + unsigned short select_color2, + unsigned long color1, unsigned long color2) +{ + GAL_VIDEOCURSOR sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOCURSOR; + sSetVideo.key = key; + sSetVideo.mask = mask; + sSetVideo.select_color2 = select_color2; + sSetVideo.color1 = color1; + sSetVideo.color2 = color2; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_request. + * + * Description: This function sets the horizontal(pixel) and vertical(line) + * video request values. + * + * parameters: + * x: X video request value. + * y: Y video request value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_request(short x, short y) +{ + GAL_VIDEOREQUEST sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOREQUEST; + sSetVideo.x = x; + sSetVideo.y = y; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_alpha_enable. + * + * Description: This function enables or disables the currently selected + * alpha region. + * + * parameters: + * enable: Value to enalbe or disable alha region. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_alpha_enable(int enable) +{ + GAL_ALPHAENABLE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETALPHAENABLE; + sSetVideo.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_alpha_enable. + * + * Description: This function gets the alpha enable state. + * + * parameters: + * enable: Pointer to get the enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_alpha_enable(int *enable) +{ + GAL_ALPHAENABLE sGetalphaenable; + + INIT_GAL(&sGetalphaenable); + sGetalphaenable.dwSubfunction = GALFN_GETALPHAENABLE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetalphaenable)) + return 0; + else + + *enable = sGetalphaenable.enable; + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_alpha_window + * + * Description: This function sets the size of the currently selected + * alpha region. + * parameters: + * x: X co-ordinate of the alpha region. + * y: Y co-ordinate of the alpha region. + * width: Width of the alpha region. + * height: Height of the alpha region. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +{ + GAL_ALPHAWINDOW sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETALPHAWINDOW; + sSetVideo.x = x; + sSetVideo.y = y; + sSetVideo.width = width; + sSetVideo.height = height; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_alpha_size + * + * Description: This function gets the size of the currently selected + * alpha region. + * parameters: + * x: X co-ordinate of the alpha region. + * y: Y co-ordinate of the alpha region. + * width: Width of the alpha region. + * height: Height of the alpha region. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +{ + GAL_ALPHASIZE sGetalphasize; + + INIT_GAL(&sGetalphasize); + sGetalphasize.dwSubfunction = GALFN_GETALPHASIZE; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetalphasize)) + return 0; + else { + *x = *(sGetalphasize.x); + *y = *(sGetalphasize.y); + *width = *(sGetalphasize.width); + *height = *(sGetalphasize.height); + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_alpha_value + * + * Description: This function sets the alpha value for the selected alpha + * region. It also specifies an increment/decrement value for + * fading. + * parameters: + * alpha: Alpha value for the currently selected alpha region. + * delta: Gives the increment/decrement fading value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_alpha_value(unsigned char alpha, char delta) +{ + GAL_ALPHAVALUE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETALPHAVALUE; + sSetVideo.alpha = alpha; + sSetVideo.delta = delta; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_alpha_value + * + * Description: This function gets the alpha value for the selected alpha + * region. It also gets increment/decrement value for + * fading. + * parameters: + * alpha: Alpha value for the currently selected alpha region. + * delta: Gives the increment/decrement fading value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_alpha_value(unsigned char *alpha, char *delta) +{ + GAL_ALPHAVALUE sGetalphavalue; + + INIT_GAL(&sGetalphavalue); + sGetalphavalue.dwSubfunction = GALFN_GETALPHAVALUE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetalphavalue)) + return 0; + else { + *alpha = sGetalphavalue.alpha; + *delta = sGetalphavalue.delta; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_alpha_priority + * + * Description: This function sets the priority of the selected alpha + * region. + * parameters: + * priority: Gives the priority value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_alpha_priority(int priority) +{ + GAL_ALPHAPRIORITY sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETALPHAPRIORITY; + sSetVideo.priority = priority; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_alpha_priority + * + * Description: This function gets the priority of the selected alpha + * region. + * parameters: + * priority: Gives the priority value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_alpha_priority(int *priority) +{ + GAL_ALPHAPRIORITY sGetalphapriority; + + INIT_GAL(&sGetalphapriority); + sGetalphapriority.dwSubfunction = GALFN_GETALPHAPRIORITY; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetalphapriority)) + return 0; + else { + *priority = sGetalphapriority.priority; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_alpha_color + * + * Description: This function sets the color to be displayed inside the + * currently of the selected alpha window. + * parameters: + * color: Gives the color value to be displayed. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_alpha_color(unsigned long color) +{ + GAL_ALPHACOLOR sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETALPHACOLOR; + sSetVideo.color = color; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_get_alpha_color + * + * Description: This function gets the color to be displayed inside the + * currently of the selected alpha window. + * parameters: + * color: Gives the color value to be displayed. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_alpha_color(unsigned long *color) +{ + GAL_ALPHACOLOR sGetalphacolor; + + INIT_GAL(&sGetalphacolor); + sGetalphacolor.dwSubfunction = GALFN_GETALPHACOLOR; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetalphacolor)) + return 0; + else { + *color = sGetalphacolor.color; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_select_alpha_region + * + * Description: This function selects the alpha region should be used for + * future updates. + * parameters: + * region: Gives the alpha window number. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_select_alpha_region(int region) +{ + GAL_ALPHAREGION sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETALPHAREGION; + sSetVideo.region = region; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_outside_alpha + * + * Description: This function enable/disable the video outside alpha region. + * parameters: + * enable: Gives the value for enable/disable. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_outside_alpha(int enable) +{ + GAL_VIDEOOUTSIDEALPHA sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOOUTSIDEALPHA; + sSetVideo.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_palette + * + * Description: This function loads the video hardware palette. + * parameters: + * palette: Gives value for hardware palette. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_palette(unsigned long *palette) +{ + GAL_VIDEOPALETTE sSetVideo; + + INIT_GAL(&sSetVideo); + sSetVideo.dwSubfunction = GALFN_SETVIDEOPALETTE; + + if (palette == NULL) { + sSetVideo.identity = 1; + } else { + sSetVideo.identity = 0; + memcpy(sSetVideo.palette, palette, 256 * sizeof(*palette)); + } + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideo)) + return 0; + else + return 1; +} + +/** Video **********************************************************/ + +/*-------------------------------------------------------------------------- + * Gal_set_icon_enable + * + * Description: This function enable/disables the hardware icon. The icon + * position and colors should be programmed prior to calling + * this routine. + * parameters: + * enable: Gives value for enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_icon_enable(int enable) +{ + GAL_ICONENABLE sSetIconenable; + + INIT_GAL(&sSetIconenable); + sSetIconenable.dwSubfunction = GALFN_SETICONENABLE; + sSetIconenable.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetIconenable)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_icon_colors + * + * Description: This function sets the three hardware icon colors. + * parameters: + * color0: Gives first color value. + * color1: Gives second color value. + * color2: Gives third color value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +{ + GAL_ICONCOLORS sSetIconcolors; + + INIT_GAL(&sSetIconcolors); + sSetIconcolors.dwSubfunction = GALFN_SETICONCOLORS; + sSetIconcolors.color0 = color0; + sSetIconcolors.color1 = color1; + sSetIconcolors.color2 = color2; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetIconcolors)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_icon_position. + * + * Description: This function sets the hardware icon position. + * parameters: + * memoffset: Memory offset of the icon buffer. + * xpos: Starting X co-ordinate for the hardware icon. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_icon_position(unsigned long memoffset, unsigned short xpos) +{ + GAL_ICONPOSITION sSetIconposi; + + INIT_GAL(&sSetIconposi); + sSetIconposi.dwSubfunction = GALFN_SETICONPOSITION; + sSetIconposi.memoffset = memoffset; + sSetIconposi.xpos = xpos; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetIconposi)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_icon_shape64. + * + * Description: This function initializes the icon buffer according to + * the current mode. + * parameters: + * memoffset: Memory offset of the icon buffer. + * andmask: Andmask of the icon buffer. + * xormask: Xormask of the icon buffer. + * lines: Lines of the icon buffer. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines) +{ + GAL_ICONSHAPE64 sSetIconshape64; + + INIT_GAL(&sSetIconshape64); + sSetIconshape64.dwSubfunction = GALFN_SETICONSHAPE64; + sSetIconshape64.memoffset = memoffset; + *(sSetIconshape64.andmask) = *andmask; + *(sSetIconshape64.xormask) = *xormask; + sSetIconshape64.lines = lines; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetIconshape64)) { + return 0; + } else { + return 1; + } +} + +/* VIP Functions */ + +/*-------------------------------------------------------------------------- + * Gal_set_vip_enable + * + * Description: This function enable/disables the writes to memory from the + * video port. + * position and colors should be programmed prior to calling + * this routine. + * parameters: + * enable: Gives value for enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_enable(int enable) +{ + GAL_VIPENABLE sSetVipenable; + + INIT_GAL(&sSetVipenable); + sSetVipenable.dwSubfunction = GALFN_SETVIPENABLE; + sSetVipenable.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVipenable)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vip_enable + * + * Description: This function gets the enable state of the + * video port. + * parameters: + * enable: Gives value for enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vip_enable(int *enable) +{ + GAL_VIPENABLE sGetVipenable; + + INIT_GAL(&sGetVipenable); + sGetVipenable.dwSubfunction = GALFN_GETVIPENABLE; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVipenable)) { + return 0; + } else { + + *enable = sGetVipenable.enable; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vip_capture_run_mode + * + * Description: This function selects the VIP capture run mode. + * + * parameters: + * mode: VIP capture run mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_capture_run_mode(int mode) +{ + GAL_VIPCAPTURERUNMODE sSetVipcapturerunmode; + + INIT_GAL(&sSetVipcapturerunmode); + sSetVipcapturerunmode.dwSubfunction = GALFN_SETVIPCAPTURERUNMODE; + sSetVipcapturerunmode.mode = mode; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVipcapturerunmode)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vip_base + * + * Description: This routine sets the odd and even base address values for + * the VIP memory buffer. + * parameters: + * even: Even base address. + * odd: odd base address. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_base(unsigned long even, unsigned long odd) +{ + GAL_VIPBASE sSetVipBase; + + INIT_GAL(&sSetVipBase); + sSetVipBase.dwSubfunction = GALFN_SETVIPBASE; + sSetVipBase.even = even; + sSetVipBase.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVipBase)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vip_base + * + * Description: This routine gets the base address value for + * the VIP memory buffer. + * parameters: + * address: VIP base address. + * odd: odd base address. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vip_base(unsigned long *address, int odd) +{ + GAL_VIPBASE sGetVipBase; + + INIT_GAL(&sGetVipBase); + sGetVipBase.dwSubfunction = GALFN_GETVIPBASE; + sGetVipBase.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVipBase)) { + return 0; + } else { + *address = sGetVipBase.address; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vip_pitch + * + * Description: This routine sets the number of bytes between scanlines + * for the VIP data. + * parameters: + * pitch: VIP pitch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_pitch(unsigned long pitch) +{ + GAL_VIPPITCH sSetVipPitch; + + INIT_GAL(&sSetVipPitch); + sSetVipPitch.dwSubfunction = GALFN_SETVIPPITCH; + sSetVipPitch.pitch = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVipPitch)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vip_pitch + * + * Description: This routine gets the number of bytes between scanlines + * for the VIP data. + * parameters: + * pitch: VIP pitch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vip_pitch(unsigned long *pitch) +{ + GAL_VIPPITCH sGetVipPitch; + + INIT_GAL(&sGetVipPitch); + sGetVipPitch.dwSubfunction = GALFN_GETVIPPITCH; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVipPitch)) { + return 0; + } else { + *pitch = sGetVipPitch.pitch; + return 1; + + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vip_mode + * + * Description: This routine sets the VIP operating mode. + * parameters: + * mode: VIP operating mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_mode(int mode) +{ + GAL_VIPMODE sSetVipMode; + + INIT_GAL(&sSetVipMode); + sSetVipMode.dwSubfunction = GALFN_SETVIPMODE; + sSetVipMode.mode = mode; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVipMode)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vip_mode + * + * Description: This routine gets the VIP operating mode. + * parameters: + * mode: VIP operating mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vip_mode(int *mode) +{ + GAL_VIPMODE sGetVipMode; + + INIT_GAL(&sGetVipMode); + sGetVipMode.dwSubfunction = GALFN_GETVIPMODE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVipMode)) { + return 0; + } else { + + *mode = sGetVipMode.mode; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vip_bus_request_threshold_high + * + * Description: This function sets the VIP FIFO bus request threshold. + * + * parameters: + * enable: Enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_bus_request_threshold_high(int enable) +{ + GAL_VIPBUS_RTH sSetVipBRTH; + + INIT_GAL(&sSetVipBRTH); + sSetVipBRTH.dwSubfunction = GALFN_SETVIPBRTH; + sSetVipBRTH.enable = enable; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVipBRTH)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vip_bus_request_threshold_high + * + * Description: This function gets the VIP FIFO bus request threshold. + * + * parameters: + * enable: Enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vip_bus_request_threshold_high(int *enable) +{ + GAL_VIPBUS_RTH sGetVipBRTH; + + INIT_GAL(&sGetVipBRTH); + sGetVipBRTH.dwSubfunction = GALFN_GETVIPBRTH; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVipBRTH)) { + return 0; + } else { + + *enable = sGetVipBRTH.enable; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vip_last_line + * + * Description: This function sets the maximum number of lines captured + * in each field. + * + * parameters: + * last_line: Maximum number of lines captured in each field. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vip_last_line(int last_line) +{ + GAL_VIPLASTLINE sSetViplastline; + + INIT_GAL(&sSetViplastline); + sSetViplastline.dwSubfunction = GALFN_SETVIPLASTLINE; + sSetViplastline.last_line = last_line; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetViplastline)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vip_line + * + * Description: This function gets the number of the current video line being + * recieved by the VIP interface. + * + * parameters: + * vip_line: Number of the current video line. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vip_line(int *vip_line) +{ + GAL_VIPLINE sGetVipline; + + INIT_GAL(&sGetVipline); + sGetVipline.dwSubfunction = GALFN_GETVIPLINE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVipline)) { + return 0; + } else { + *vip_line = sGetVipline.status; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_test_vip_odd_field + * + * Description: This function tests the VIP odd field. + * + * parameters: + * status: Status of the odd field. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_test_vip_odd_field(int *status) +{ + GAL_TESTVIPODDFIELD sTestVipoddfield; + + INIT_GAL(&sTestVipoddfield); + sTestVipoddfield.dwSubfunction = GALFN_TESTVIPODDFIELD; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sTestVipoddfield)) { + return 0; + } else { + *status = sTestVipoddfield.status; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_test_vip_bases_updated + * + * Description: This function tests the VIP bases updated. + * + * parameters: + * status: Status of the VIP bases updated. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_test_vip_bases_updated(int *status) +{ + GAL_TESTVIPBASESUPDATED sTestVipbasesupdated; + + INIT_GAL(&sTestVipbasesupdated); + sTestVipbasesupdated.dwSubfunction = GALFN_TESTVIPBASESUPDATED; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sTestVipbasesupdated)) { + return 0; + } else { + *status = sTestVipbasesupdated.status; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_test_vip_fifo_overflow + * + * Description: This function tests the VIP FIFO overflow. + * + * parameters: + * status: Status of the VIP FIFO overflow. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_test_vip_fifo_overflow(int *status) +{ + GAL_TESTVIPOVERFLOW sTestVipoverflow; + + INIT_GAL(&sTestVipoverflow); + sTestVipoverflow.dwSubfunction = GALFN_TESTVIPFIFOOVERFLOW; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sTestVipoverflow)) { + return 0; + } else { + *status = sTestVipoverflow.status; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_enable + * + * Description: This function enable/disables the VBI data capture. + * + * parameters: + * enable: VBI enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_enable(int enable) +{ + GAL_VBIENABLE sSetVbienable; + + INIT_GAL(&sSetVbienable); + sSetVbienable.dwSubfunction = GALFN_SETVBIENABLE; + sSetVbienable.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbienable)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_enable + * + * Description: This function gets the enable state of the VBI data capture. + * + * parameters: + * enable: VBI enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_enable(int *enable) +{ + GAL_VBIENABLE sGetVbienable; + + INIT_GAL(&sGetVbienable); + sGetVbienable.dwSubfunction = GALFN_GETVBIENABLE; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbienable)) { + return 0; + } else { + + *enable = sGetVbienable.enable; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_base + * + * Description: This function sets the VBI base addresses. + * + * parameters: + * even: Even base address. + * odd: Odd base address. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_base(unsigned long even, unsigned long odd) +{ + GAL_VBIBASE sSetVbiBase; + + INIT_GAL(&sSetVbiBase); + sSetVbiBase.dwSubfunction = GALFN_SETVBIBASE; + sSetVbiBase.even = even; + sSetVbiBase.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbiBase)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_base + * + * Description: This function gets the VBI base address. + * + * parameters: + * address: VBI base address. + * odd: Odd base address. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_base(unsigned long *address, int odd) +{ + GAL_VBIBASE sGetVbiBase; + + INIT_GAL(&sGetVbiBase); + sGetVbiBase.dwSubfunction = GALFN_GETVBIBASE; + sGetVbiBase.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbiBase)) { + return 0; + } else { + *address = sGetVbiBase.address; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_pitch + * + * Description: This function sets the number of bytes between scanlines for + * VBI capture. + * + * parameters: + * pitch: VBI pitch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_pitch(unsigned long pitch) +{ + GAL_VBIPITCH sSetVbiPitch; + + INIT_GAL(&sSetVbiPitch); + sSetVbiPitch.dwSubfunction = GALFN_SETVBIPITCH; + sSetVbiPitch.pitch = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbiPitch)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_pitch + * + * Description: This function gets the number of bytes between scanlines for + * VBI capture. + * + * parameters: + * pitch: VBI pitch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_pitch(unsigned long *pitch) +{ + GAL_VBIPITCH sGetVbiPitch; + + INIT_GAL(&sGetVbiPitch); + sGetVbiPitch.dwSubfunction = GALFN_GETVBIPITCH; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbiPitch)) { + return 0; + } else { + *pitch = sGetVbiPitch.pitch; + return 1; + + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_mode + * + * Description: This function sets the VBI data types captured to memory. + * + * parameters: + * mode: VBI mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_mode(int mode) +{ + GAL_VBIMODE sSetVbiMode; + + INIT_GAL(&sSetVbiMode); + sSetVbiMode.dwSubfunction = GALFN_SETVBIMODE; + sSetVbiMode.mode = mode; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbiMode)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_mode + * + * Description: This function gets the VBI data types captured to memory. + * + * parameters: + * mode: VBI mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_mode(int *mode) +{ + GAL_VBIMODE sGetVbiMode; + + INIT_GAL(&sGetVbiMode); + sGetVbiMode.dwSubfunction = GALFN_GETVBIMODE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbiMode)) { + return 0; + } else { + + *mode = sGetVbiMode.mode; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_direct + * + * Description: This function sets the VBI lines to be passed to the + * Direct VIP. + * + * parameters: + * even_lines: VBI even lines. + * odd_lines: VBI odd lines. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +{ + GAL_SETVBIDIRECT sSetVbidirect; + + INIT_GAL(&sSetVbidirect); + sSetVbidirect.dwSubfunction = GALFN_SETVBIDIRECT; + sSetVbidirect.even_lines = even_lines; + sSetVbidirect.odd_lines = odd_lines; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbidirect)) { + return 0; + } else { + return 1; + } +} +BOOLEAN +Gal2_set_destination_stride(unsigned short stride) +{ + GAL_STRIDE sSetStride; + + INIT_GAL(&sSetStride); + sSetStride.dwSubfunction = GALFN_SETDESTINATIONSTRIDE; + + sSetStride.stride = stride; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetStride)) + return 0; + else + return 1; +} + +BOOLEAN +Gal2_set_pattern_origin(int x, int y) +{ + GAL_PATTERNORIGIN sSetPatOrigin; + + INIT_GAL(&sSetPatOrigin); + sSetPatOrigin.dwSubfunction = GALFN_SETPATTERNORIGIN; + + sSetPatOrigin.x = x; + sSetPatOrigin.y = y; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetPatOrigin)) + return 0; + else + return 1; +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_direct + * + * Description: This function gets the VBI lines to be passed to the + * Direct VIP. + * + * parameters: + * odd: VBI odd lines. + * direct_lines: VBI direct lines. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_direct(int odd, unsigned long *direct_lines) +{ + GAL_GETVBIDIRECT sGetVbidirect; + + INIT_GAL(&sGetVbidirect); + sGetVbidirect.dwSubfunction = GALFN_GETVBIDIRECT; + sGetVbidirect.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbidirect)) { + return 0; + } else { + *direct_lines = sGetVbidirect.direct_lines; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_interrupt + * + * Description: This function enable/disables the VBI field interrupt. + * + * parameters: + * enable: Value to enable/disable VBI interrupt. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_interrupt(int enable) +{ + GAL_VBIINTERRUPT sSetVbiinterrupt; + + INIT_GAL(&sSetVbiinterrupt); + sSetVbiinterrupt.dwSubfunction = GALFN_SETVBIINTERRUPT; + sSetVbiinterrupt.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbiinterrupt)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_interrupt + * + * Description: This function gets the VBI field interrupt. + * + * parameters: + * enable: Value of enable/disable VBI interrupt. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_interrupt(int *enable) +{ + GAL_VBIINTERRUPT sGetVbiinterrupt; + + INIT_GAL(&sGetVbiinterrupt); + sGetVbiinterrupt.dwSubfunction = GALFN_GETVBIINTERRUPT; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbiinterrupt)) { + return 0; + } else { + *enable = sGetVbiinterrupt.enable; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_source_stride + * + * Description: This function sets the stride to be used in successive screen + * to screen BLTs. + * + * parameters: + * enable: Value of enable/disable VBI interrupt. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_set_source_stride(unsigned short stride) +{ + GAL_STRIDE sSetsourcestride; + + INIT_GAL(&sSetsourcestride); + sSetsourcestride.dwSubfunction = GALFN_SETSOURCESTRIDE; + + sSetsourcestride.stride = stride; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetsourcestride)) { + return 0; + } else { + + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_source_transparency + * + * Description: This function sets the source transparency color and + * mask to be used in future rendering routines. + * to screen BLTs. + * + * parameters: + * color: Source color. + * mask: Source mask. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_set_source_transparency(unsigned long color, unsigned long mask) +{ + GAL_SOURCETRANSPARENCY sSetsourcetransparency; + + INIT_GAL(&sSetsourcetransparency); + sSetsourcetransparency.dwSubfunction = GALFN_SETSOURCETRANSPARENCY; + + sSetsourcetransparency.color = color; + sSetsourcetransparency.mask = mask; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetsourcetransparency)) { + return 0; + } else { + + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_alpha_mode + * + * Description: This function sets the alpha blending mode. + * parameters: + * mode: Alpha blending mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_set_alpha_mode(int mode) +{ + GAL_GFX2ALPHAMODE sSetalphamode; + + INIT_GAL(&sSetalphamode); + sSetalphamode.dwSubfunction = GALFN_GFX2SETALPHAMODE; + + sSetalphamode.mode = mode; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetalphamode)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_gfx2_set_alpha_value + * + * Description: This function sets the alpha value to be used with certain + * alpha blending modes. + * parameters: + * value: Alpha blending value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_set_alpha_value(unsigned char value) +{ + GAL_GFX2ALPHAVALUE sSetalphavalue; + + INIT_GAL(&sSetalphavalue); + sSetalphavalue.dwSubfunction = GALFN_GFX2SETALPHAVALUE; + + sSetalphavalue.value = value; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetalphavalue)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_gfx2_pattern_fill + * + * Description: This function used to fill the pattern of GX2. + * It allows the arbitary destination stride. The rendering + * position is also specified as an offset instead of (x,y) + * position. + * parameters: + * dstoffset: Rendering offset. + * width: Width of the pattern. + * height: Height of the pattern. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +{ + GAL_GFX2PATTERNFILL sPatternfill; + + INIT_GAL(&sPatternfill); + sPatternfill.dwSubfunction = GALFN_GFX2PATTERNFILL; + + sPatternfill.dstoffset = dstoffset; + sPatternfill.width = width; + sPatternfill.height = height; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sPatternfill)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_gfx2_screen_to_screen_blt + * + * Description: This function used for screen to screen BLTs of GX2. + * It allows the arbitary source and destination strides and + * alpha blending. + * parameters: + * srcoffset: Source Rendering offset. + * dstoffset: Destination Rendering offset. + * width: Width of the screen. + * height: Height of the screen. + * flags: Flags of the screen to screen BLT. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_screen_to_screen_blt(unsigned long srcoffset, + unsigned long dstoffset, unsigned short width, + unsigned short height, int flags) +{ + GAL_GFX2SCREENTOSCREENBLT sScreentoScreenblt; + + INIT_GAL(&sScreentoScreenblt); + sScreentoScreenblt.dwSubfunction = GALFN_GFX2SCREENTOSCREENBLT; + + sScreentoScreenblt.srcoffset = srcoffset; + sScreentoScreenblt.dstoffset = dstoffset; + sScreentoScreenblt.width = width; + sScreentoScreenblt.height = height; + sScreentoScreenblt.flags = flags; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sScreentoScreenblt)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal2_mono_expand_blt + * + * Description: This function used to expand monochrome data stored in + * graphics memory for screen to screen BLTs. + * parameters: + * srcbase: Source Rendering base address. + * srcx: Source X offset. + * srcy: Source Y offset. + * dstoffset: Destination Rendering offset. + * width: Width of the screen. + * height: Height of the screen. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) +{ + GAL_GFX2MONOEXPANDBLT sMonoexpandblt; + + INIT_GAL(&sMonoexpandblt); + sMonoexpandblt.dwSubfunction = GALFN_GFX2MONOEXPANDBLT; + sMonoexpandblt.srcbase = srcbase; + sMonoexpandblt.srcx = srcx; + sMonoexpandblt.srcy = srcy; + sMonoexpandblt.dstoffset = dstoffset; + sMonoexpandblt.width = width; + sMonoexpandblt.height = height; + sMonoexpandblt.byte_packed = byte_packed; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sMonoexpandblt)) { + return 0; + } else { + return 1; + + } +} + +/*-------------------------------------------------------------------------- + * Gal2_color_bitmap_to_screen_blt + * + * Description: This function used for color bmp to screen BLTs. + * parameters: + * srcx: Source X offset. + * srcy: Source Y offset. + * dstoffset: Destination Rendering offset. + * width: Width of the screen. + * height: Height of the screen. + * *data: Color bmp data. + * pitch: Pitch of the dispaly mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_color_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, unsigned short pitch) +{ + GAL_GFX2COLORBMPTOSCRBLT sColorbmptoscrblt; + + INIT_GAL(&sColorbmptoscrblt); + sColorbmptoscrblt.dwSubfunction = GALFN_GFX2COLORBMPTOSCRBLT; + sColorbmptoscrblt.srcx = srcx; + sColorbmptoscrblt.srcy = srcy; + sColorbmptoscrblt.dstoffset = dstoffset; + sColorbmptoscrblt.width = width; + sColorbmptoscrblt.height = height; + sColorbmptoscrblt.data = *data; + sColorbmptoscrblt.pitch = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sColorbmptoscrblt)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal2_mono_bitmap_to_screen_blt + * + * Description: This function used for mono bmp to screen BLTs. + * parameters: + * srcx: Source X offset. + * srcy: Source Y offset. + * dstoffset: Destination Rendering offset. + * width: Width of the screen. + * height: Height of the screen. + * *data: mono bmp data. + * pitch: Pitch of the display mode. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_mono_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, unsigned short pitch) +{ + GAL_GFX2MONOBMPTOSCRBLT sMonobmptoscrblt; + + INIT_GAL(&sMonobmptoscrblt); + sMonobmptoscrblt.dwSubfunction = GALFN_GFX2MONOBMPTOSCRBLT; + sMonobmptoscrblt.srcx = srcx; + sMonobmptoscrblt.srcy = srcy; + sMonobmptoscrblt.dstoffset = dstoffset; + sMonobmptoscrblt.width = width; + sMonobmptoscrblt.height = height; + sMonobmptoscrblt.data = *data; + sMonobmptoscrblt.pitch = pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sMonobmptoscrblt)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal2_bresenham_line + * + * Description: This function used to draw bresenham line. It allows the + * arbitary destination stride. + * parameters: + * dstoffset: Destination offset. + * length: Length of the line. + * initerr: Intial error. + * axialerr: + * diagerr: + * flags: + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags) +{ + GAL_GFX2BRESENHAMLINE sBresenhamline; + + INIT_GAL(&sBresenhamline); + sBresenhamline.dwSubfunction = GALFN_GFX2BRESENHAMLINE; + sBresenhamline.dstoffset = dstoffset; + sBresenhamline.length = length; + sBresenhamline.initerr = initerr; + sBresenhamline.axialerr = axialerr; + sBresenhamline.diagerr = diagerr; + sBresenhamline.flags = flags; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sBresenhamline)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal2_sync_to_vblank + * + * Description: This function sets the a flag to synchronize the next + * rendering routine to VBLANK. + * parameters: none. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal2_sync_to_vblank(void) +{ + GAL_GFX2SYNCTOVBLANK sSynctovblank; + + INIT_GAL(&sSynctovblank); + sSynctovblank.dwSubfunction = GALFN_GFX2SYNCTOVBLANK; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSynctovblank)) { + return 0; + } else { + return 1; + } +} + +/* Video routines */ + +/*-------------------------------------------------------------------------- + * Gal_set_video_yuv_pitch + * + * Description: This function sets the Video YUV pitch. + * + * parameters: + * y_pitch: Y pitch. + * uv_pitch: UV pitch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_yuv_pitch(unsigned long y_pitch, unsigned long uv_pitch) +{ + GAL_VIDEOYUVPITCH sSetVideoyuvpitch; + + INIT_GAL(&sSetVideoyuvpitch); + sSetVideoyuvpitch.dwSubfunction = GALFN_SETVIDEOYUVPITCH; + sSetVideoyuvpitch.y_pitch = y_pitch; + sSetVideoyuvpitch.uv_pitch = uv_pitch; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideoyuvpitch)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_video_yuv_pitch + * + * Description: This function gets the Video YUV pitch. + * + * parameters: + * y_pitch: Y pitch. + * uv_pitch: UV pitch. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_video_yuv_pitch(unsigned long *y_pitch, unsigned long *uv_pitch) +{ + GAL_VIDEOYUVPITCH sGetVideoyuvpitch; + + INIT_GAL(&sGetVideoyuvpitch); + sGetVideoyuvpitch.dwSubfunction = GALFN_GETVIDEOYUVPITCH; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVideoyuvpitch)) { + return 0; + } else { + *y_pitch = sGetVideoyuvpitch.y_pitch; + *uv_pitch = sGetVideoyuvpitch.uv_pitch; + + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_yuv_offsets + * + * Description: This function sets the Video YUV offsets. + * + * parameters: + * y_offset: Y offset. + * u_offset: U offset. + * v_offset: V offset. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_video_yuv_offsets(unsigned long y_offset, unsigned long u_offset, + unsigned long v_offset) +{ + GAL_VIDEOYUVOFFSETS sSetVideoyuvoffsets; + + INIT_GAL(&sSetVideoyuvoffsets); + sSetVideoyuvoffsets.dwSubfunction = GALFN_SETVIDEOYUVOFFSETS; + sSetVideoyuvoffsets.dwYoffset = y_offset; + sSetVideoyuvoffsets.dwUoffset = u_offset; + sSetVideoyuvoffsets.dwVoffset = v_offset; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideoyuvoffsets)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_video_yuv_offsets + * + * Description: This function gets the Video YUV offsets. + * + * parameters: + * y_offset: Y offset. + * u_offset: U offset. + * v_offset: V offset. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_get_video_yuv_offsets(unsigned long *y_offset, + unsigned long *u_offset, unsigned long *v_offset) +{ + GAL_VIDEOYUVOFFSETS sGetVideoyuvoffsets; + + INIT_GAL(&sGetVideoyuvoffsets); + sGetVideoyuvoffsets.dwSubfunction = GALFN_GETVIDEOYUVOFFSETS; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVideoyuvoffsets)) { + return 0; + } else { + *y_offset = sGetVideoyuvoffsets.dwYoffset; + *u_offset = sGetVideoyuvoffsets.dwUoffset; + *v_offset = sGetVideoyuvoffsets.dwVoffset; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_left_crop + * + * Description: This function sets the number of pixels which will be cropped + * from the beginning of each video line. + * + * parameters: + * x: + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_set_video_left_crop(unsigned short x) +{ + GAL_VIDEOLEFTCROP sSetVideoleftcrop;; + + INIT_GAL(&sSetVideoleftcrop); + sSetVideoleftcrop.dwSubfunction = GALFN_SETVIDEOLEFTCROP; + sSetVideoleftcrop.x = x; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideoleftcrop)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_video_vertical_downscale + * + * Description: This function sets the vertical downscale factor for the video + * overlay window. + * + * parameters: + * srch: Height of the source. + * dsth: Height of the destination. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) +{ + GAL_VIDEOVERTICALDOWNSCALE sSetVideoverticaldownscale; + + INIT_GAL(&sSetVideoverticaldownscale); + sSetVideoverticaldownscale.dwSubfunction = GALFN_SETVIDEOVERTICALDOWNSCALE; + sSetVideoverticaldownscale.srch = srch; + sSetVideoverticaldownscale.dsth = dsth; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVideoverticaldownscale)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_source + * + * Description: This function sets the VBI source. + * + * parameters: + * source: VBI Source type. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_set_vbi_source(VbiSourceType source) +{ + GAL_VBISOURCE sSetVbisource; + + INIT_GAL(&sSetVbisource); + sSetVbisource.dwSubfunction = GALFN_SETVBISOURCE; + sSetVbisource.source = source; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbisource)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_source + * + * Description: This function gets the VBI source. + * + * parameters: + * source: VBI Source type. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_vbi_source(VbiSourceType * source) +{ + GAL_VBISOURCE sGetVbisource; + + INIT_GAL(&sGetVbisource); + sGetVbisource.dwSubfunction = GALFN_GETVBISOURCE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbisource)) { + return 0; + } else { + + *source = sGetVbisource.source; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_lines + * + * Description: This function sets the VBI lines. + * + * parameters: + * even: VBI even lines. + * odd: VBI odd lines. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_lines(unsigned long even, unsigned long odd) +{ + GAL_VBILINES sSetVbilines; + + INIT_GAL(&sSetVbilines); + sSetVbilines.dwSubfunction = GALFN_SETVBILINES; + sSetVbilines.even = even; + sSetVbilines.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbilines)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vbi_lines + * + * Description: This function gets the VBI lines. + * + * parameters: + * lines: VBI lines. + * odd: VBI odd lines. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_get_vbi_lines(int odd, unsigned long *lines) +{ + GAL_VBILINES sGetVbilines; + + INIT_GAL(&sGetVbilines); + sGetVbilines.dwSubfunction = GALFN_GETVBILINES; + sGetVbilines.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbilines)) { + return 0; + } else { + *lines = sGetVbilines.lines; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_total + * + * Description: This function sets the total number of VBI bytes for each + * field. + * + * parameters: + * even: + * odd: + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_vbi_total(unsigned long even, unsigned long odd) +{ + GAL_VBITOTAL sSetVbitotal; + + INIT_GAL(&sSetVbitotal); + sSetVbitotal.dwSubfunction = GALFN_SETVBITOTAL; + sSetVbitotal.even = even; + sSetVbitotal.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVbitotal)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vbi_total + * + * Description: This function gets the total number of VBI bytes in the + * field. + * + * parameters: + * even: + * odd: + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_get_vbi_total(int odd, unsigned long *total) +{ + GAL_VBITOTAL sGetVbitotal; + + INIT_GAL(&sGetVbitotal); + sGetVbitotal.dwSubfunction = GALFN_GETVBITOTAL; + sGetVbitotal.odd = odd; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVbitotal)) { + return 0; + } else { + *total = sGetVbitotal.total; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_vertical_scaler_offset + * + * Description: This function sets the Video vertical scaler offset. + * + * parameters: + * offset: Vertical Scaler offset. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_set_vertical_scaler_offset(char offset) +{ + GAL_VSCALEROFFSET sSetVscaleroffset; + + INIT_GAL(&sSetVscaleroffset); + sSetVscaleroffset.dwSubfunction = GALFN_SETVSCALEROFFSET; + sSetVscaleroffset.offset = offset; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetVscaleroffset)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_vertical_scaler_offset + * + * Description: This function gets the Video vertical scaler offset. + * + * parameters: + * offset: Vertical Scaler offset. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ BOOLEAN +Gal_get_vertical_scaler_offset(char *offset) +{ + GAL_VSCALEROFFSET sGetVscaleroffset; + + INIT_GAL(&sGetVscaleroffset); + sGetVscaleroffset.dwSubfunction = GALFN_GETVSCALEROFFSET; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetVscaleroffset)) { + return 0; + } else { + + *offset = sGetVscaleroffset.offset; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_video_interlaced + * + * Description: This function gets the video interlaced mode. + * parameters: + * interlaced: ptr to the interlaced status. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_video_interlaced(int *interlaced) +{ + GAL_GETVIDEOINTERLACED sGetvideointerlaced; + + INIT_GAL(&sGetvideointerlaced); + sGetvideointerlaced.dwSubfunction = GALFN_GETVIDEOINTERLACED; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetvideointerlaced)) { + return 0; + } else { + *interlaced = sGetvideointerlaced.interlaced; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_color_space_YUV + * + * Description: This function gets the video color space YUV. + * parameters: + * colorspace: ptr to the color space. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_color_space_YUV(int *colorspace) +{ + GAL_COLORSPACEYUV sGetcolorspaceyuv; + + INIT_GAL(&sGetcolorspaceyuv); + sGetcolorspaceyuv.dwSubfunction = GALFN_GETCOLORSPACEYUV; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetcolorspaceyuv)) { + return 0; + } else { + *colorspace = sGetcolorspaceyuv.colorspace; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_genlock_enable + * + * Description: This function gets the enable state of the genlock. + * parameters: + * enable: ptr to the enable state of the genlock. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_genlock_enable(int *enable) +{ + GAL_GENLOCKENABLE sGetgenlockenable; + + INIT_GAL(&sGetgenlockenable); + sGetgenlockenable.dwSubfunction = GALFN_GETGENLOCKENABLE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetgenlockenable)) { + return 0; + } else { + *enable = sGetgenlockenable.enable; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_genlock_enable + * + * Description: This function enable/disables and configure the genlock + * according to the parameters. + * parameters: + * enable: enable state of the genlock. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_genlock_enable(int enable) +{ + GAL_GENLOCKENABLE sSetgenlockenable; + + INIT_GAL(&sSetgenlockenable); + sSetgenlockenable.dwSubfunction = GALFN_SETGENLOCKENABLE; + + sSetgenlockenable.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetgenlockenable)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_genlock_delay + * + * Description: This function gets the genlock delay. + * parameters: + * delay: Ptr to the genlock delay. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_genlock_delay(unsigned long *delay) +{ + GAL_GENLOCKDELAY sGetgenlockdelay; + + INIT_GAL(&sGetgenlockdelay); + sGetgenlockdelay.dwSubfunction = GALFN_GETGENLOCKDELAY; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetgenlockdelay)) { + return 0; + } else { + *delay = sGetgenlockdelay.delay; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_genlock_delay + * + * Description: This function sets the genlock delay. + * parameters: + * delay: genlock delay. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_genlock_delay(unsigned long delay) +{ + GAL_GENLOCKDELAY sSetgenlockdelay; + + INIT_GAL(&sSetgenlockdelay); + sSetgenlockdelay.dwSubfunction = GALFN_SETGENLOCKDELAY; + + sSetgenlockdelay.delay = delay; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetgenlockdelay)) { + return 0; + } else { + return 1; + } +} + +BOOLEAN +Gal_set_top_line_in_odd(int enable) +{ + GAL_TOPLINEINODD sSettoplineinodd; + + INIT_GAL(&sSettoplineinodd); + sSettoplineinodd.dwSubfunction = GALFN_SETTOPLINEINODD; + + sSettoplineinodd.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSettoplineinodd)) { + return 0; + } else { + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_video_cursor. + * + * Description: This function gets configuration of the Video Hardware + * cursor. + * parameters: + * key: color key. + * mask: color mask. + *select_color2: selected for color2. + * color1: color1 value. + * color2: color2 value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_video_cursor(unsigned long *key, + unsigned long *mask, + unsigned short *select_color2, + unsigned long *color1, unsigned long *color2) +{ + GAL_VIDEOCURSOR sGetvideocursor; + + INIT_GAL(&sGetvideocursor); + sGetvideocursor.dwSubfunction = GALFN_GETVIDEOCURSOR; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetvideocursor)) { + return 0; + } else { + *key = sGetvideocursor.key; + *mask = sGetvideocursor.mask; + *select_color2 = sGetvideocursor.select_color2; + *color1 = sGetvideocursor.color1; + *color2 = sGetvideocursor.color2; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_read_crc. + * + * Description: This function reads the hardware CRC value, which is used for + * automated testing. + * parameters: + * crc: Holds the crc value. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_read_crc(unsigned long *crc) +{ + GAL_READCRC sReadcrc; + + INIT_GAL(&sReadcrc); + sReadcrc.dwSubfunction = GALFN_READCRC; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sReadcrc)) { + return 0; + } else { + *crc = sReadcrc.crc; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_read_window_crc. + * + * Description: This function reads the hardware CRC value for a subsection + * of the display. + * + * parameters: + * source: + * x: + * y: + * width: + * height: + * crc: + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + int crc32, unsigned long *crc) +{ + GAL_READWINDOWCRC sReadwindowcrc; + + INIT_GAL(&sReadwindowcrc); + sReadwindowcrc.dwSubfunction = GALFN_READWINDOWCRC; + sReadwindowcrc.source = source; + sReadwindowcrc.x = x; + sReadwindowcrc.y = y; + sReadwindowcrc.width = width; + sReadwindowcrc.height = height; + sReadwindowcrc.crc32 = crc32; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sReadwindowcrc)) { + return 0; + } else { + *crc = sReadwindowcrc.crc; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_get_macrovision_enable. + * + * Description: This function gets the enable state of the macrovision. + * + * parameters: + * enable: ptr holds the macrovision enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_get_macrovision_enable(int *enable) +{ + GAL_MACROVISIONENABLE sGetmacrovisionenable; + + INIT_GAL(&sGetmacrovisionenable); + sGetmacrovisionenable.dwSubfunction = GALFN_GETMACROVISIONENABLE; + + if (ioctl(ifbdev_handle, FBIOGAL_API, &sGetmacrovisionenable)) { + return 0; + } else { + *enable = sGetmacrovisionenable.enable; + return 1; + } +} + +/*-------------------------------------------------------------------------- + * Gal_set_macrovision_enable. + * + * Description: This function gets the enable state of the macrovision. + * + * parameters: + * enable: macrovision enable state. + * return: '1' was returned on success otherwise '0' was returned. + *------------------------------------------------------------------------*/ +BOOLEAN +Gal_set_macrovision_enable(int enable) +{ + GAL_MACROVISIONENABLE sSetmacrovisionenable; + + INIT_GAL(&sSetmacrovisionenable); + sSetmacrovisionenable.dwSubfunction = GALFN_SETMACROVISIONENABLE; + + sSetmacrovisionenable.enable = enable; + if (ioctl(ifbdev_handle, FBIOGAL_API, &sSetmacrovisionenable)) { + return 0; + } else { + return 1; + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galstub.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galstub.c:1.2 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galstub.c Tue Jan 14 04:34:31 2003 @@ -0,0 +1,157 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_galstub.c,v 1.2 2003/01/14 09:34:31 alanh Exp $ */ +/* + * $Workfile: nsc_galstub.c $ + * $Revision: 5 $ + * $Author: Sarma $ + * + * File Contents: This file contains the file inclusions of the GAL + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Geode Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Geode Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Geode Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#if defined(STB_X) +/* all driver need this */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +/* pci stuff */ +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86cmap.h" +#include "asm/page.h" /* #define for PAGE_* */ + +#define makedev(major, minor) ((((unsigned int) (major)) << 8) \ + | ((unsigned int) (minor))) + +#include "nsc_galfns.c" +#endif /* STB_X */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c:1.5 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c Tue Feb 11 08:36:41 2003 @@ -0,0 +1,1788 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c,v 1.5 2003/02/11 13:36:41 alanh Exp $ */ +/* + * $Workfile: nsc_gx1_accel.c $ + * $Revision: 15 $ + * $Author: Sarma $ + * + * File Contents: This file is consists of main Xfree + * acceleration supported routines like solid fill used + * here. + * Project: Geode Xfree Frame buffer device driver. + * + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* + * Fixes by + * Alan Hourihane <alanh@fairlite.demon.co.uk> + */ + +/* Xfree86 header files */ +#include "vgaHW.h" +#include "xf86.h" +#include "xf86_ansic.h" +#include "xaalocal.h" +#include "xf86fbman.h" +#include "miline.h" +#include "xf86_libc.h" +#include "xaarop.h" +#include "nsc.h" + +#define SCR2SCREXP 0 + +/* STATIC VARIABLES FOR THIS FILE + * Used to maintain state between setup and rendering calls. + */ + +static int GeodeTransparent; +static int GeodeTransColor; +static int Geodedstx; +static int Geodedsty; +static int Geodesrcx; +static int Geodesrcy; +static int Geodewidth; +static int Geodeheight; +static int Geodebpp; +static int GeodeCounter; + +#if !defined(STB_X) +static unsigned int GeodeROP = 0; +static unsigned short Geode_blt_mode = 0; +static unsigned short Geode_vector_mode = 0; +static unsigned short Geode_buffer_width = 0; +#endif +static unsigned int gu1_bpp = 0; +static unsigned int gu1_xshift = 1; +static unsigned int gu1_yshift = 1; +static unsigned short GeodebufferWidthPixels; +static unsigned int ImgBufOffset; +static unsigned short Geodebb0Base; +static unsigned short Geodebb1Base; +static XAAInfoRecPtr localRecPtr; + +#define CALC_FBOFFSET(_SrcX, _SrcY) \ + (((unsigned int) (_SrcY) << gu1_yshift) |\ + (((unsigned int) (_SrcX)) << gu1_xshift)) + +#define GFX_WAIT_BUSY while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY) { ; } +#define GFX_WAIT_PENDING while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) { ; } + +#define BB0_BASE_3K 0x400 +#define BB1_BASE_3K 0x930 + +Bool GX1AccelInit(ScreenPtr pScreen); +void GX1AccelSync(ScrnInfoPtr pScreenInfo); +void GX1SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void GX1SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, + int w, int h); +void GX1SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, + int rop, unsigned int planemask, + int trans_color); +void GX1Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int x, + int y, int w, int h); +void GX1SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, int patternx, + int patterny, int fg, int bg, int rop, + unsigned int planemask); +void GX1Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, int patternx, + int patterny, int x, int y, int w, + int h); +void GX1SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int xdir, + int ydir, int rop, unsigned int planemask, + int transparency_color); +void GX1SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int x1, int y1, + int x2, int y2, int w, int h); +void GX1SetupForSolidLine(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void GX1SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern); +void GX1SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1, + int absmaj, int absmin, int err, int len, + int octant); +void GX1SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, int x0, int y0, + int x1, int y1, int flags); +void GX1SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y, int len, + int dir); + +void GX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, + int depth); + +void GX1SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft); + +void GX1SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno); +void GX1FillCacheBltRects(ScrnInfoPtr pScrn, int rop, unsigned int planemask, + int nBox, BoxPtr pBox, int xorg, int yorg, + XAACacheInfoPtr pCache); +void OPTGX1SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void OPTGX1SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, + int w, int h); +void OPTGX1SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int xdir, + int ydir, int rop, + unsigned int planemask, + int transparency_color); +void OPTGX1SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int x1, + int y1, int x2, int y2, int w, int h); +void OPTGX1SetupForSolidLine(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void OPTGX1SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern); +void OPTGX1SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1, + int absmaj, int absmin, int err, int len, + int octant); +void OPTGX1SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, + int flags); +void OPTGX1SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y, + int len, int dir); + +void OPTGX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, + int depth); + +void OPTGX1SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft); + +void OPTGX1SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno); + +/*---------------------------------------------------------------------------- + * GX1AccelSync. + * + * Description :This function is called to syncronize with the graphics + * engine and it waits the graphic engine is idle.This is + * required before allowing direct access to the + * framebuffer. + * Parameters. + * pScreenInfo:Screeen info pointer structure. + * + * Returns :none + * + * Comments :This function is called on geode_video routines. +*---------------------------------------------------------------------------- +*/ +void +GX1AccelSync(ScrnInfoPtr pScreenInfo) +{ + GFX(wait_until_idle()); +} + +/*---------------------------------------------------------------------------- + * GX1SetupForFillRectSolid. + * + * Description :This routine is called to setup the solid pattern + * color for future rectangular fills or vectors. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * color :Specifies the color to be filled up in defined area. + * rop :Specifies the raster operation value. + * planemask :Specifies the masking value based rop srcdata. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + GFX(set_solid_pattern((unsigned long)color)); + + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + GFX(set_solid_source((unsigned long)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + + /*---------------------------------------------------------------------------- + * GX1SubsequentFillRectSolid. + * + * Description :This routine is used to fill the rectangle of previously + * specified solid pattern. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x and y :Specifies the x and y co-ordinatesarea. + * w and h :Specifies width and height respectively. + * + * Returns :none + * + * Comments :desired pattern can be set before this function by + * gfx_set_solid_pattern. + * Sample application uses: + * - Window backgrounds. + * - x11perf: rectangle tests (-rect500). + * - x11perf: fill trapezoid tests (-trap100). + * - x11perf: horizontal line segments (-hseg500). + *---------------------------------------------------------------------------- +*/ +void +GX1SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, int w, + int h) +{ + /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */ + GeodePtr pGeode; + + pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->TV_Overscan_On) { + x += pGeode->TVOx; + y += pGeode->TVOy; + } + + GFX(pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)w, (unsigned short)h)); +} + +/*---------------------------------------------------------------------------- + * GX1SetupFor8x8PatternColorExpand + * + * Description :This routine is called to fill the color pattern of + * 8x8. + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * planemask :Specifies the value of masking from rop data + * trans_color :to be added. + * Returns :none. + * + * Comments :none. + * +*---------------------------------------------------------------------------- +*/ + +void +GX1SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, + int rop, unsigned int planemask, + int trans_color) +{ + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + GFX(set_solid_source((unsigned int)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + +/*---------------------------------------------------------------------------- + * GX1Subsequent8x8PatternColorExpand + * + * Description :This routine is called to fill a rectangle with the + * color pattern of previously loaded pattern. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * x :x -coordinates of the destination rectangle + * y :y-co-ordinates of the destination rectangle + * w :Specifies width of the rectangle + * h :Height of the window of the rectangle + * + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses: + * - Patterned desktops + * - x11perf: stippled rectangle tests (-srect500). + * - x11perf: opaque stippled rectangle tests (-osrect500). +*---------------------------------------------------------------------------- +*/ +void +GX1Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int x, int y, + int w, int h) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + DEBUGMSG(1, (0, 0, "8x8color %d %d %dx%d\n", x, y, w, h)); + if (pGeode->TV_Overscan_On) { + x += pGeode->TVOx; + y += pGeode->TVOy; + } + /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */ + /* Ignores specified pattern. */ + GFX(color_pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)w, (unsigned short)h, + ((unsigned long *)((pGeode->FBBase + + (patterny << gu1_yshift)) + + patternx)))); +} + +/*---------------------------------------------------------------------------- + * GX1SetupFor8x8PatternMonoExpand + * + * Description :This routine is called to fill the monochrome pattern of + * 8x8. + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx:This is set from on rop data. + * patterny:This is set based on rop data. + * fg :Specifies the foreground color + * bg :Specifies the background color + * planemask :Specifies the value of masking from rop data + + * Returns :none. + * + * Comments :none. + * +*---------------------------------------------------------------------------- +*/ +void +GX1SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int fg, + int bg, int rop, unsigned int planemask) +{ + int trans = (bg == -1); + + /* LOAD PATTERN COLORS AND DATA */ + GFX(set_mono_pattern((unsigned int)bg, (unsigned int)fg, + (unsigned int)patternx, (unsigned int)patterny, + trans)); + + GFX(set_mono_source((unsigned int)bg, (unsigned int)fg, trans)); + + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + GFX(set_solid_source((unsigned int)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + +/*---------------------------------------------------------------------------- + * GX1Subsequent8x8PatternMonoExpand + * + * Description :This routine is called to fill a ractanglethe + * monochrome pattern of previusly loaded pattern. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * fg :Specifies the foreground color + * bg :Specifies the background color + * planemask :Specifies the value of masking from rop data + + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses: + * - Patterned desktops + * - x11perf: stippled rectangle tests (-srect500). + * - x11perf: opaque stippled rectangle tests (-osrect500). +*---------------------------------------------------------------------------- +*/ +void +GX1Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int x, int y, + int w, int h) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->TV_Overscan_On) { + x += pGeode->TVOx; + y += pGeode->TVOy; + } + + /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */ + /* Ignores specified pattern. */ + GFX(pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)w, (unsigned short)h)); +} + +/*---------------------------------------------------------------------------- + * GX1SetupForScreenToScreenCopy + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * xdir :This is set based on rop data. + * ydir :This is set based on rop data. + * rop :sets the raster operation + * transparency:tobeadded + * planemask :Specifies the value of masking from rop data + + * Returns :none + * + * Comments :The patterns specified is ignored inside the function +*---------------------------------------------------------------------------- +*/ +void +GX1SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int xdir, int ydir, int rop, + unsigned int planemask, int transparency_color) +{ + GFX(set_solid_pattern(planemask)); + /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */ + GFX(set_raster_operation(XAACopyROP[rop])); + /* SAVE TRANSPARENCY FLAG */ + GeodeTransparent = (transparency_color == -1) ? 0 : 1; + GeodeTransColor = transparency_color; + +} + +/*---------------------------------------------------------------------------- + * GX1SubsquentScreenToScreenCopy + * + * Description :This function is called to perform a screen to screen + * BLT using the previously specified planemask,raster + * operation and * transparency flag + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x1 :x -coordinates of the source window + * y1 :y-co-ordinates of the source window + * x2 :x -coordinates of the destination window + * y2 :y-co-ordinates of the destination window + * w :Specifies width of the window to be copied + * h :Height of the window to be copied. + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ + +void +GX1SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int x1, int y1, int x2, int y2, int w, int h) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->TV_Overscan_On) { + if ((x1 < pScreenInfo->virtualX) && (y1 < pScreenInfo->virtualY)) { + x1 += pGeode->TVOx; + y1 += pGeode->TVOy; + } + x2 += pGeode->TVOx; + y2 += pGeode->TVOy; + } + + if (GeodeTransparent) { + /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT + * * Should only be called for the "copy" raster operation. + */ + GFX(screen_to_screen_xblt((unsigned short)x1, (unsigned short)y1, + (unsigned short)x2, (unsigned short)y2, + (unsigned short)w, (unsigned short)h, + GeodeTransColor)); + } else { + /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */ + GFX(screen_to_screen_blt((unsigned short)x1, (unsigned short)y1, + (unsigned short)x2, (unsigned short)y2, + (unsigned short)w, (unsigned short)h)); + } +} + +/*---------------------------------------------------------------------------- + * GX1SetupForScanlineImageWrite + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * rop :sets the raster operation + * transparency_color :transparency color key. + * planemask :Specifies the value of masking from rop data + * bpp :bits per pixel of the source pixmap + * depth :depth of the source pixmap. + * Returns :none + * + * Comments :none + * x11perf -putimage10 + * x11perf -putimage100 + * x11perf -putimage500 +*---------------------------------------------------------------------------- +*/ + +void +GX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth) +{ + GFX(set_solid_pattern((unsigned int)planemask)); + /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */ + GFX(set_raster_operation(XAACopyROP_PM[rop])); + /* SAVE TRANSPARENCY FLAG */ + GeodeTransparent = (transparency_color == -1) ? 0 : 1; + GeodeTransColor = transparency_color; + Geodebpp = bpp; +} + +/*---------------------------------------------------------------------------- + * GX1SubsequentScanlineImageWriteRect + * + * Description :This function is used to set up the x,y corordinates and width + * &height for future Bliting functionality. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x :destination x + * y :destination y + * w :Specifies the width of the rectangle to be copied + * h :Specifies the height of the rectangle to be copied + * + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +GX1SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, int skipleft) +{ + + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + GeodeCounter = 0; +} + +/*---------------------------------------------------------------------------- + * GX1SubsquentImageWriteScanline + * + * Description :This function is called to + * BLT using the previously specified planemask,raster + * operation and transparency flag + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ + +void +GX1SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + int blt_height = 0; + char blit = FALSE; + + GeodeCounter++; + + if ((Geodeheight <= pGeode->NoOfImgBuffers) && + (GeodeCounter == Geodeheight)) { + blit = TRUE; + blt_height = Geodeheight; + } else if ((Geodeheight > pGeode->NoOfImgBuffers) + && (GeodeCounter == pGeode->NoOfImgBuffers)) { + blit = TRUE; + Geodeheight -= pGeode->NoOfImgBuffers; + blt_height = pGeode->NoOfImgBuffers; + } else + return; + + if (blit) { + blit = FALSE; + + GeodeCounter = 0; + + if (GeodeTransparent) { + /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT + * * Should only be called for the "copy" raster operation. + */ + GFX(screen_to_screen_xblt((unsigned short)Geodesrcx, + (unsigned short)Geodesrcy, + (unsigned short)Geodedstx, + (unsigned short)Geodedsty, + (unsigned short)Geodewidth, + (unsigned short)blt_height, + GeodeTransColor)); + } else { + /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */ + GFX(screen_to_screen_blt((unsigned short)Geodesrcx, + (unsigned short)Geodesrcy, + (unsigned short)Geodedstx, + (unsigned short)Geodedsty, + (unsigned short)Geodewidth, + (unsigned short)blt_height)); + } + Geodedsty += blt_height; + GFX(wait_until_idle()); + } +} + +static unsigned short vector_mode_table[] = { + VM_MAJOR_INC | VM_MINOR_INC | VM_X_MAJOR, + VM_MAJOR_INC | VM_MINOR_INC | VM_Y_MAJOR, + VM_MAJOR_INC | VM_X_MAJOR, + VM_MINOR_INC | VM_Y_MAJOR, + VM_MINOR_INC | VM_X_MAJOR, + VM_MAJOR_INC | VM_Y_MAJOR, + VM_X_MAJOR, + VM_Y_MAJOR, +}; + +/*---------------------------------------------------------------------------- + * GX1SetupForSolidLine + * + * Description :This function is used setup the solid line color for + * future line draws. + * + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * color :Specifies the color value od line + * rop :Specifies rop values. + * Planemask :Specifies planemask value. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +GX1SetupForSolidLine(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + /* LOAD THE SOLID PATTERN COLOR */ + GFX(set_solid_pattern((unsigned int)color)); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); +} + +/*--------------------------------------------------------------------------- + * GX1SubsequentBresenhamLine + * + * Description :This function is used to render a vector using the + * specified bresenham parameters. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x1 :Specifies the starting x position + * y1 :Specifies starting y possition + * absmaj :Specfies the Bresenman absolute major. + * absmin :Specfies the Bresenman absolute minor. + * err :Specifies the bresenham err term. + * len :Specifies the length of the vector interms of pixels. + * octant :not used in this function,may be added for standard + * interface. + * Returns :none + * + * Comments :none + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-line500). + * - x11perf: line segments (-seg500). +*---------------------------------------------------------------------------- +*/ +void +GX1SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, + int x1, int y1, int absmaj, int absmin, int err, + int len, int octant) +{ + int axial, init, diag; + + DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n", + x1, y1, absmaj, absmin, err, len, octant)); + + /* DETERMINE BRESENHAM PARAMETERS */ + + axial = ((int)absmin << 1); + init = axial - (int)absmaj; + diag = init - (int)absmaj; + + /* ADJUST INITIAL ERROR + * * Adjust by -1 for certain directions so that the vector + * * hits the same pixels when drawn in either direction. + * * The Gamma value is assumed to account for the initial + * * error adjustment for clipped lines. + */ + + init += err; + + /* CALL ROUTINE TO DRAW VECTOR */ + + GFX(bresenham_line((unsigned short)x1, + (unsigned short)y1, + (unsigned short)len, + (unsigned short)init, + (unsigned short)axial, + (unsigned short)diag, + (unsigned short)vector_mode_table[octant])); + +} + +#define ABS(_val1, _val2) (((_val1) > (_val2)) ? ((_val1)-(_val2)) : ((_val2) - (_val1))) + +void +GX1SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, int flags) +{ + long dx, dy, dmaj, dmin; + long axialerr, diagerr, initerr; + unsigned short vec_flags = 0; + + dx = ABS(x1, x0); + dy = ABS(y1, y0); + if (dx >= dy) { + dmaj = dx; + dmin = dy; + vec_flags = VM_X_MAJOR; + if (x1 > x0) + vec_flags |= VM_MAJOR_INC; + if (y1 > y0) + vec_flags |= VM_MINOR_INC; + } else { + dmaj = dy; + dmin = dx; + vec_flags = VM_Y_MAJOR; + if (x1 > x0) + vec_flags |= VM_MINOR_INC; + if (y1 > y0) + vec_flags |= VM_MAJOR_INC; + } + axialerr = dmin << 1; + diagerr = (dmin - dmaj) << 1; + initerr = (dmin << 1) - dmaj; + if (!(vec_flags & VM_MINOR_INC)) + initerr--; + + GFX(bresenham_line((unsigned short)x0, + (unsigned short)y0, + (unsigned short)dmaj, + (unsigned short)initerr, + (unsigned short)axialerr, + (unsigned short)diagerr, vec_flags)); +} + +/*--------------------------------------------------------------------------- + * GX1SubsequentHorVertLine + * + * This routine is called to render a vector using the specified Bresenham + * parameters. + * + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-hseg500). + * - x11perf: line segments (-vseg500). + *--------------------------------------------------------------------------- + */ +void +GX1SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, + int x, int y, int len, int dir) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->TV_Overscan_On) { + x += pGeode->TVOx; + y += pGeode->TVOy; + } + GFX(pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)((dir == DEGREES_0) ? len : 1), + (unsigned short)((dir == DEGREES_0) ? 1 : len))); +} + +void +GX1SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern) +{ + int trans = (bg == -1); + unsigned long *pat = (unsigned long *)pattern; + + /* LOAD PATTERN COLORS AND DATA */ + + GFX(set_mono_pattern((unsigned long)bg, (unsigned long)fg, + (unsigned long)pat, (unsigned long)pat, + (unsigned char)trans)); + + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + + if (planemask == (unsigned int)-1) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + + GFX(set_solid_source((unsigned long)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + +#if SCR2SCREXP +void +GX1SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask) +{ + GFX(set_solid_pattern(planemask)); + GFX(set_mono_source(bg, fg, (bg == -1))); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAACopyROP_PM[rop & 0x0F])); + + DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask)); +} + +void +GX1SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int srcx, int srcy, int offset) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + GFX(mono_bitmap_to_screen_blt(offset, 0, x, y, w, h, + (unsigned char *)(pGeode->FBBase + + CALC_FBOFFSET(srcx, srcy)), + pGeode->Pitch)); +} +#endif + +#if !defined(STB_X) +/*---------------------------------------------------------------------------- + * OPTGX1SetupForFillRectSolid. + * + * Description :This routine is called to setup the solid pattern + * color for future rectangular fills or vectors. + * (non durango version) + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * color :Specifies the color to be filled up in defined area. + * rop :Specifies the raster operation value. + * planemask :Specifies the masking value based rop srcdata. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +OPTGX1SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + unsigned short rop16; + + if (gu1_bpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + if (planemask == 0xFFFFFFFF) { + if (gu1_bpp == 8) { + planemask &= 0x00FF; + planemask |= (planemask << 8); + } + + rop16 = XAAPatternROP[rop]; + + /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG32(GP_SRC_COLOR_0, (planemask << 16) | planemask); + } else { + rop16 = XAAPatternROP_PM[rop]; + } + + Geode_blt_mode = 0; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); + WRITE_REG16(GP_RASTER_MODE, rop16); +} + + /*---------------------------------------------------------------------------- + * OPTGX1SubsequentFillRectSolid. + * + * Description :This routine is used to fill the rectangle of previously + * specified solid pattern. + * (non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x and y :Specifies the x and y co-ordinatesarea. + * w and h :Specifies width and height respectively. + * + * Returns :none + * + * Comments :desired pattern can be set before this function by + * gfx_set_solid_pattern. + * Sample application uses: + * - Window backgrounds. + * - x11perf: rectangle tests (-rect500). + * - x11perf: fill trapezoid tests (-trap100). + * - x11perf: horizontal line segments (-hseg500). + *---------------------------------------------------------------------------- +*/ +void +OPTGX1SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, + int x, int y, int width, int height) +{ + unsigned short section; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->TV_Overscan_On) { + x += pGeode->TVOx; + y += pGeode->TVOy; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + + /* SET REGISTERS TO DRAW RECTANGLE */ + WRITE_REG32(GP_DST_XCOOR, (y << 16) | x); + + WRITE_REG16(GP_HEIGHT, height); + + /* CHECK WIDTH FOR GX BUG WORKAROUND */ + + if (width <= 16) { + /* OK TO DRAW SMALL RECTANGLE IN ONE PASS */ + + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_BLIT_MODE, Geode_blt_mode); + } else { + /* DRAW FIRST PART OF RECTANGLE */ + /* Get to a 16 pixel boundary. */ + + section = 0x10 - (x & 0x0F); + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_BLIT_MODE, Geode_blt_mode); + + /* POLL UNTIL ABLE TO LOAD THE SECOND RECTANGLE */ + + GFX_WAIT_PENDING; + + WRITE_REG32(GP_DST_XCOOR, (y << 16) | (x + section)); + WRITE_REG16(GP_WIDTH, width - section); + WRITE_REG16(GP_BLIT_MODE, Geode_blt_mode); + } +} + +/*---------------------------------------------------------------------------- + * OPTGX1SetupForScreenToScreenCopy + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality. + * (non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * xdir :This is set based on rop data. + * ydir :This is set based on rop data. + * rop :sets the raster operation + * transparency:tobeadded + * planemask :Specifies the value of masking from rop data + + * Returns :none + * + * Comments :The patterns specified is ignored inside the function +*---------------------------------------------------------------------------- +*/ +void +OPTGX1SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int xdir, int ydir, int rop, + unsigned int planemask, + int transparency_color) +{ + int GFXusesDstData; + unsigned short rop16 = XAACopyROP[rop]; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (gu1_bpp == 8) { + planemask &= 0x00FF; + planemask |= (planemask << 8); + } + + /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */ + /* True if even bits (0:2:4:6) do not equal the correspinding */ + /* even bits (1:3:5:7). */ + + GFXusesDstData = ((rop & 0x55) ^ ((rop >> 1) & 0x55)); + + Geode_blt_mode = GFXusesDstData ? BM_READ_DST_FB1 | BM_READ_SRC_FB : + BM_READ_SRC_FB; + + /* CHECK AVAILABLE BLT BUFFER SIZE */ + /* Can use both BLT buffers if no destination data is required. */ + + Geode_buffer_width = GFXusesDstData ? GeodebufferWidthPixels : + GeodebufferWidthPixels << 1; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)planemask); + WRITE_REG16(GP_RASTER_MODE, rop16); + + GeodeTransparent = (transparency_color == -1) ? 0 : 1; + GeodeTransColor = transparency_color; +} + +/*---------------------------------------------------------------------------- + * OPTGX1SubsquentScreenToScreenCopy + * + * Description :This function is called to perform a screen to screen + * BLT using the previously specified planemask,raster + * operation and * transparency flag + * (non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * srcx :x -coordinates of the source window + * srcy :y-co-ordinates of the source window + * dstx :x -coordinates of the destination window + * dsty :y-co-ordinates of the destination window + * width :Specifies width of the window to be copied + * height :Height of the window to be copied. + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ +void +OPTGX1SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int srcx, int srcy, int dstx, int dsty, + int width, int height) +{ + unsigned short section; + unsigned short blit_mode = 0; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->TV_Overscan_On) { + if ((srcx < pScreenInfo->virtualX) && (srcy < pScreenInfo->virtualY)) { + srcx += pGeode->TVOx; + srcy += pGeode->TVOy; + } + dstx += pGeode->TVOx; + dsty += pGeode->TVOy; + } + if (GeodeTransparent) { + if (gu1_bpp == 8) { + GeodeTransColor &= 0x00FF; + GeodeTransColor |= (GeodeTransColor << 8); + } + GeodeTransColor = + (GeodeTransColor & 0x0000FFFF) | (GeodeTransColor << 16); + + /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */ + /* Need to make sure any previous BLT using BB1 is complete. */ + /* Only need to load 32 bits of BB1 for the 1 pixel BLT that follows. */ + + GFX_WAIT_BUSY; + WRITE_SCRATCH32(Geodebb1Base, GeodeTransColor); + + /* DO BOGUS BLT TO LATCH DATA FROM BB1 */ + /* Already know graphics pipeline is idle. */ + /* Only need to latch data into the holding registers for the current */ + /* data from BB1. A 1 pixel wide BLT will suffice. */ + + WRITE_REG32(GP_DST_XCOOR, 0); + WRITE_REG32(GP_SRC_XCOOR, 0); + WRITE_REG32(GP_WIDTH, 0x00010001); + WRITE_REG16(GP_RASTER_MODE, 0x00CC); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1); + + /* WRITE REGISTERS FOR REAL SCREEN TO SCREEN BLT */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_RASTER_MODE, 0x10C6); + WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF); + + } + + /* CHECK Y DIRECTION */ + /* Hardware has support for negative Y direction. */ + + if (dsty > srcy) { + blit_mode = BM_REVERSE_Y; + srcy += height - 1; + dsty += height - 1; + } + + /* CHECK X DIRECTION */ + /* Hardware does not support negative X direction since at the time */ + /* of development all supported resolutions could fit a scanline of */ + /* data at once into the BLT buffers (using both BB0 and BB1). This */ + /* code is more generic to allow for any size BLT buffer. */ + + if (dstx > srcx) { + srcx += width; + dstx += width; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */ + /* Hardware does not split the operations, so software must do it to */ + /* avoid large scanlines that would overflow the BLT buffers. */ + + while (width > 0) { + /* CHECK WIDTH OF CURRENT SECTION */ + + if (width > Geode_buffer_width) + section = Geode_buffer_width; + else + section = width; + + /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_YCOOR, srcy); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, section); + + /* CHECK X DIRECTION */ + + if (dstx > srcx) { + /* NEGATIVE X DIRECTION */ + /* Still positive X direction within the section. */ + + srcx -= section; + dstx -= section; + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + } else { + /* POSITIVE X DIRECTION */ + + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + dstx += section; + srcx += section; + } + WRITE_REG16(GP_BLIT_MODE, Geode_blt_mode | blit_mode); + width -= section; + } +} + +/*---------------------------------------------------------------------------- + * OPTGX1SetupForScanlineImageWrite + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality.(non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * rop :sets the raster operation + * transparency_color :tobeadded + * planemask :Specifies the value of masking from rop data + * bpp :bits per pixel of the source pixmap + * depth :depth of the source pixmap. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +OPTGX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth) +{ + Geodebpp = bpp; + OPTGX1SetupForScreenToScreenCopy(pScreenInfo, + 0, 0, rop, planemask, transparency_color); +} + +/*---------------------------------------------------------------------------- + * OPTGX1SubsequentScanlineImageWriteRect + * + * Description :This function is used to set up the x,y corordinates and width + * &height for future Bliting functionality.(non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x :destination x + * y :destination y + * w :Specifies the width of the rectangle to be copied + * h :Specifies the height of the rectangle to be copied + * Returns :none + * + * Comments :none + *---------------------------------------------------------------------------- +*/ +void +OPTGX1SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft) +{ + + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + GeodeCounter = 0; +} + +/*---------------------------------------------------------------------------- + * OPTGX1SubsquentImageWriteScanline + * + * Description :This function is called to + * BLT using the previously specified planemask,raster + * operation and transparency flag(non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ + +void +OPTGX1SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + int blt_height = 0; + char blit = FALSE; + + GeodeCounter++; + + if ((Geodeheight <= pGeode->NoOfImgBuffers) && + (GeodeCounter == Geodeheight)) { + blit = TRUE; + blt_height = Geodeheight; + } else if ((Geodeheight > pGeode->NoOfImgBuffers) + && (GeodeCounter == pGeode->NoOfImgBuffers)) { + blit = TRUE; + Geodeheight -= pGeode->NoOfImgBuffers; + blt_height = pGeode->NoOfImgBuffers; + } else + return; + + if (blit) { + blit = FALSE; + GeodeCounter = 0; + OPTGX1SubsequentScreenToScreenCopy(pScreenInfo, + Geodesrcx, Geodesrcy, Geodedstx, + Geodedsty, Geodewidth, blt_height); + Geodedsty += blt_height; + GFX_WAIT_BUSY; + } +} + +/*---------------------------------------------------------------------------- + * OPTGX1SetupForSolidLine + * + * Description :This function is used setup the solid line color for + * future line draws. + * + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * color :Specifies the color value od line + * rop :Specifies rop values. + * Planemask :Specifies planemask value. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +OPTGX1SetupForSolidLine(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + if (gu1_bpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + + GeodeROP = XAAPatternROP[rop]; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); + WRITE_REG16(GP_RASTER_MODE, GeodeROP); + + if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) { + Geode_vector_mode = VM_READ_DST_FB; + Geode_blt_mode = BM_READ_DST_FB1 | BM_READ_SRC_FB; + } else { + Geode_vector_mode = 0; + Geode_blt_mode = BM_READ_SRC_FB; + } +} + +/*--------------------------------------------------------------------------- + * OPTGX1SubsequentBresenhamLine + * + * Description :This function is used to render a vector using the + * specified bresenham parameters. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x1 :Specifies the starting x position + * y1 :Specifies starting y possition + * absmaj :Specfies the Bresenman absolute major. + * absmin :Specfies the Bresenman absolute minor. + * err :Specifies the bresenham err term. + * len :Specifies the length of the vector interms of pixels. + * octant :not used in this function,may be added for standard + * interface. + * Returns :none + * + * Comments :none + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-seg500). +*---------------------------------------------------------------------------- +*/ +void +OPTGX1SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, + int x1, int y1, int absmaj, int absmin, int err, + int len, int octant) +{ + int axial, init, diag; + + DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n", + x1, y1, absmaj, absmin, err, len, octant)); + + /* DETERMINE BRESENHAM PARAMETERS */ + + axial = ((int)absmin << 1); + init = axial - (int)absmaj; + diag = init - (int)absmaj; + + /* ADJUST INITIAL ERROR + * * Adjust by -1 for certain directions so that the vector + * * hits the same pixels when drawn in either direction. + * * The Gamma value is assumed to account for the initial + * * error adjustment for clipped lines. + */ + + init += err; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GFX_WAIT_PENDING; + WRITE_REG32(GP_DST_XCOOR, (y1 << 16) | x1); + WRITE_REG32(GP_VECTOR_LENGTH, (((unsigned long)init) << 16) | + ((unsigned short)len)); + WRITE_REG32(GP_AXIAL_ERROR, (((unsigned long)diag) << 16) | + ((unsigned short)axial)); + WRITE_REG16(GP_VECTOR_MODE, + (Geode_vector_mode | vector_mode_table[octant])); +} + +void +OPTGX1SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, int flags) +{ + long dx, dy, dmaj, dmin; + long axialerr, diagerr, initerr; + unsigned short vec_flags = 0; + + dx = ABS(x1, x0); + dy = ABS(y1, y0); + if (dx >= dy) { + dmaj = dx; + dmin = dy; + vec_flags = VM_X_MAJOR; + if (x1 > x0) + vec_flags |= VM_MAJOR_INC; + if (y1 > y0) + vec_flags |= VM_MINOR_INC; + } else { + dmaj = dy; + dmin = dx; + vec_flags = VM_Y_MAJOR; + if (x1 > x0) + vec_flags |= VM_MINOR_INC; + if (y1 > y0) + vec_flags |= VM_MAJOR_INC; + } + + axialerr = dmin << 1; + diagerr = (dmin - dmaj) << 1; + initerr = (axialerr - dmaj); + + if (!(vec_flags & VM_MINOR_INC)) + initerr--; + + GFX_WAIT_PENDING; + WRITE_REG32(GP_DST_XCOOR, (y0 << 16) | x0); + WRITE_REG32(GP_VECTOR_LENGTH, (((unsigned long)initerr) << 16) | + ((unsigned short)dmaj)); + WRITE_REG32(GP_AXIAL_ERROR, (((unsigned long)diagerr) << 16) | + ((unsigned short)axialerr)); + WRITE_REG16(GP_VECTOR_MODE, (Geode_vector_mode | vec_flags)); +} + +/*--------------------------------------------------------------------------- + * OPTGX1SubsequentHorVertLine + * + * This routine is called to render a vector using the specified Bresenham + * parameters. + * + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-hseg500). + * - x11perf: line segments (-vseg500). + *--------------------------------------------------------------------------- + */ +void +OPTGX1SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, + int x, int y, int len, int dir) +{ + + DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir)); + + OPTGX1SubsequentFillRectSolid(pScreenInfo, + (unsigned short)x, (unsigned short)y, + (unsigned short)((dir == DEGREES_0) ? len : + 1), + (unsigned short)((dir == DEGREES_0) ? 1 : + len)); +} +#endif + +/*---------------------------------------------------------------------------- + * GX1AccelInit. + * + * Description :This function sets up the supported acceleration routines and + * appropriate flags. + * + * Parameters: + * pScreen :Screeen pointer structure. + * + * Returns :TRUE on success and FALSE on Failure + * + * Comments :This function is called in GX1ScreenInit in + geode_driver.c to set * the acceleration. +*---------------------------------------------------------------------------- +*/ +Bool +GX1AccelInit(ScreenPtr pScreen) +{ + GeodePtr pGeode; + ScrnInfoPtr pScreenInfo; + + pScreenInfo = xf86Screens[pScreen->myNum]; + pGeode = GEODEPTR(pScreenInfo); + + switch (pScreenInfo->bitsPerPixel) { + case 8: + gu1_bpp = 8; + break; + case 16: + gu1_bpp = 16; + break; + } + + gu1_xshift = pScreenInfo->bitsPerPixel >> 4; + + switch (pGeode->Pitch) { + case 1024: + gu1_yshift = 10; + break; + case 2048: + gu1_yshift = 11; + break; + case 4096: + gu1_yshift = 12; + break; + } + + Geodebb0Base = BB0_BASE_3K; + Geodebb1Base = BB1_BASE_3K; + GeodebufferWidthPixels = Geodebb1Base - Geodebb0Base - 16; + + if (gu1_bpp > 8) { + /* If 16bpp, divide GFXbufferWidthPixels by 2 */ + GeodebufferWidthPixels >>= 1; + } + /* Getting the pointer for acceleration Inforecord */ + pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec(); + + /* SET ACCELERATION FLAGS */ + localRecPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER; + localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; + + /* HOOK SYNCRONIZARION ROUTINE */ + localRecPtr->Sync = GX1AccelSync; + + /* HOOK FILLED RECTANGLES */ + localRecPtr->SetupForSolidFill = (GX1SetupForFillRectSolid); + localRecPtr->SubsequentSolidFillRect = (GX1SubsequentFillRectSolid); + localRecPtr->SolidFillFlags = 0; + + /* HOOK 8x8 MonoEXPAND PATTERNS */ + localRecPtr->SetupForMono8x8PatternFill = GX1SetupFor8x8PatternMonoExpand; + localRecPtr->SubsequentMono8x8PatternFillRect = + GX1Subsequent8x8PatternMonoExpand; + localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN; + + localRecPtr->SetupForColor8x8PatternFill = + GX1SetupFor8x8PatternColorExpand; + localRecPtr->SubsequentColor8x8PatternFillRect = + GX1Subsequent8x8PatternColorExpand; + /* Color expansion */ + localRecPtr->Color8x8PatternFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | + SCANLINE_PAD_DWORD | HARDWARE_PATTERN_SCREEN_ORIGIN; + + /* HOOK SCREEN TO SCREEN COPIES + * * Set flag to only allow copy if transparency is enabled. + */ + localRecPtr->SetupForScreenToScreenCopy = + OPTACCEL(GX1SetupForScreenToScreenCopy); + localRecPtr->SubsequentScreenToScreenCopy = + OPTACCEL(GX1SubsequentScreenToScreenCopy); + localRecPtr->ScreenToScreenCopyFlags = 0; + + /* HOOK BRESENHAM SOLID LINES */ + /* Do not hook unless flag can be set preventing use of planemask. */ + localRecPtr->SolidLineFlags = NO_PLANEMASK; + localRecPtr->SetupForSolidLine = OPTACCEL(GX1SetupForSolidLine); + localRecPtr->SubsequentSolidBresenhamLine = + OPTACCEL(GX1SubsequentBresenhamLine); + localRecPtr->SubsequentSolidHorVertLine = + OPTACCEL(GX1SubsequentHorVertLine); + localRecPtr->SubsequentSolidTwoPointLine = + OPTACCEL(GX1SubsequentSolidTwoPointLine); + localRecPtr->SolidBresenhamLineErrorTermBits = 15; + +#if SCR2SCREXP + /* Color expansion */ + localRecPtr->ScreenToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | NO_TRANSPARENCY; + + localRecPtr->SetupForScreenToScreenColorExpandFill = + (GX1SetupForScreenToScreenColorExpandFill); + localRecPtr->SubsequentScreenToScreenColorExpandFill = + (GX1SubsequentScreenToScreenColorExpandFill); +#endif + + /* + * ImageWrite. + * + * SInce this uses off-screen scanline buffers, it is only of use when + * complex ROPs are used. But since the current XAA pixmap cache code + * only works when an ImageWrite is provided, the NO_GXCOPY flag is + * temporarily disabled. + */ + if (pGeode->AccelImageWriteBufferOffsets) { + + localRecPtr->ScanlineImageWriteFlags = + localRecPtr->ScreenToScreenCopyFlags; + localRecPtr->ScanlineImageWriteBuffers = + pGeode->AccelImageWriteBufferOffsets; + localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers; + localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu1_yshift; + localRecPtr->SetupForScanlineImageWrite = + OPTACCEL(GX1SetupForScanlineImageWrite); + localRecPtr->SubsequentScanlineImageWriteRect = + OPTACCEL(GX1SubsequentScanlineImageWriteRect); + localRecPtr->SubsequentImageWriteScanline = + OPTACCEL(GX1SubsequentImageWriteScanline); + + ImgBufOffset = pGeode->AccelImageWriteBufferOffsets[0] - pGeode->FBBase; + Geodesrcy = ImgBufOffset >> gu1_yshift; + + Geodesrcx = ImgBufOffset & (pGeode->Pitch - 1); + Geodesrcx /= (pScreenInfo->bitsPerPixel >> 3); + } + + return (XAAInit(pScreen, localRecPtr)); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_cursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_cursor.c:1.5 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_cursor.c Fri Feb 21 11:51:09 2003 @@ -0,0 +1,396 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_cursor.c,v 1.5 2003/02/21 16:51:09 alanh Exp $ */ +/* + * $Workfile: nsc_gx1_cursor.c $ + * $Revision: 9 $ + * $Author: Sarma $ + * + * File Contents: Xfree cursor implementation routines + * for geode HWcursor init.setting cursor color,image etc + * are done here. + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "nsc.h" + +/* Forward declarations of the functions */ +Bool GX1HWCursorInit(ScreenPtr pScreen); +static void GX1SetCursorColors(ScrnInfoPtr pScreenInfo, int bg, int fg); +static void GX1SetCursorPosition(ScrnInfoPtr pScreenInfo, int x, int y); +void GX1LoadCursorImage(ScrnInfoPtr pScreenInfo, unsigned char *src); +void GX1HideCursor(ScrnInfoPtr pScreenInfo); +void GX1ShowCursor(ScrnInfoPtr pScreenInfo); +static Bool GX1UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs); +extern void GX1SetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, + short drw_h, int id, int offset, + ScrnInfoPtr pScrn); +/*---------------------------------------------------------------------------- + * GX1HWCursorInit. + * + * Description :This function sets the cursor information by probing the + * hardware. + * + * Parameters. + * pScreen :Screeen pointer structure. + * + * Returns :TRUE on success and FALSE on Failure + * + * Comments :Geode supports the hardware_cursor,no need to enable SW + * cursor. +*---------------------------------------------------------------------------- +*/ +Bool +GX1HWCursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + xf86CursorInfoPtr infoPtr; + + infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + /* the geode structure is intiallized with the cursor infoRec */ + pGeode->CursorInfo = infoPtr; + infoPtr->MaxWidth = 32; + infoPtr->MaxHeight = 32; + /* seeting up the cursor flags */ + infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; + /* cursor info ptr is intiallized with the values obtained from + * * durnago calls + */ + infoPtr->SetCursorColors = GX1SetCursorColors; + infoPtr->SetCursorPosition = GX1SetCursorPosition; + infoPtr->LoadCursorImage = GX1LoadCursorImage; + infoPtr->HideCursor = GX1HideCursor; + infoPtr->ShowCursor = GX1ShowCursor; + infoPtr->UseHWCursor = GX1UseHWCursor; + return (xf86InitCursor(pScreen, infoPtr)); +} + +/*---------------------------------------------------------------------------- + * GX1SetCursorColors. + * + * Description :This function sets the cursor foreground and background + * colors + * Parameters: + * pScreen: Screeen pointer structure. + * bg: Specifies the color value of cursor background color. + * fg: Specifies the color value of cursor foreground color. + * Returns: none. + * + * Comments: The integer color value passed by this function is + * converted into * RGB value by the gfx_set_color routines. + *---------------------------------------------------------------------------- + */ +static void +GX1SetCursorColors(ScrnInfoPtr pScreenInfo, int bg, int fg) +{ + GFX(set_cursor_colors(bg, fg)); +} + +/*---------------------------------------------------------------------------- + * GX1SetCursorPosition. + * + * Description :This function sets the cursor co -ordinates and enable the + * cursor. + * + * Parameters: + * pScreen: Screeen pointer structure. + * x: Specifies the x-cordinates of the cursor. + * y: Specifies the y co-ordinate of the cursor. + * Returns: none. + * + *---------------------------------------------------------------------------- + */ +static void +GX1SetCursorPosition(ScrnInfoPtr pScreenInfo, int x, int y) +{ + unsigned long offset; + static int panOffset = 0; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + unsigned short xhot = 0, yhot = 0; + + if (x < 0) { + xhot = (unsigned short)(-x); + x = 0; + } + if (y < 0) { + yhot = (unsigned short)(-y); + y = 0; + } + + if (pGeode->TV_Overscan_On) { + x += pGeode->TVOx; + y += pGeode->TVOy; + } + GFX(set_cursor_position(pGeode->CursorStartOffset, x, y, xhot, yhot)); + GFX(set_cursor_enable(1)); + + if ((pGeode->OverlayON) && (pGeode->Panel)) { +#if defined(STB_X) + Gal_get_display_offset(&offset); +#else + offset = gfx_get_display_offset(); +#endif + if (offset != panOffset) { + GX1SetVideoPosition(pGeode->video_x, pGeode->video_y, + pGeode->video_w, pGeode->video_h, + pGeode->video_srcw, pGeode->video_srch, + pGeode->video_dstw, pGeode->video_dsth, + pGeode->video_id, pGeode->video_offset, + pGeode->video_scrnptr); + panOffset = offset; + } + } +} + +/*---------------------------------------------------------------------------- + * GX1LoadCursorImage + * + * Description :This function loads the 32x32 cursor pattern.The shape + * and color is set by AND and XOR masking of arrays of 32 + * DWORD. + * Parameters: + * pScreen: Screeen pointer structure. + * src : Specifies cursor data. + * Returns : none + * + *---------------------------------------------------------------------------- +*/ +void +GX1LoadCursorImage(ScrnInfoPtr pScreenInfo, unsigned char *src) +{ + int i, j; + unsigned long shape; + unsigned long mask; + unsigned long andMask[32] = { 0, }; + unsigned long xorMask[32] = { 0, }; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + j = 0; + for (i = 0; i < 32; i++) { + if (src) { + shape = ((unsigned long)src[i * 4] << 24) | + ((unsigned long)src[i * 4 + 1] << 16) | + ((unsigned long)src[i * 4 + 2] << 8) | + ((unsigned long)src[i * 4 + 3] << 0); + mask = ((unsigned long)src[i * 4 + 128] << 24) | + ((unsigned long)src[i * 4 + 1 + 128] << 16) | + ((unsigned long)src[i * 4 + 2 + 128] << 8) | + ((unsigned long)src[i * 4 + 3 + 128] << 0); + } else { + mask = 0x0; + shape = 0xFFFFFFFF; + } + + andMask[i] = ~(mask); + xorMask[i] = shape & mask; + } + + GFX(set_cursor_shape32(pGeode->CursorStartOffset, andMask, xorMask)); +} + +/*---------------------------------------------------------------------------- + * GX1HideCursor. + * + * Description :This function will disable the cursor. + * + * Parameters: + * pScreen: Handles to the Screeen pointer structure. + * + * Returns: none. + * + * Comments: gfx_set_cursor enable function is hardcoded to disable + * the cursor. + *---------------------------------------------------------------------------- + */ +void +GX1HideCursor(ScrnInfoPtr pScreenInfo) +{ + GFX(set_cursor_enable(0)); +} + +/*---------------------------------------------------------------------------- + * GX1ShowCursor + * + * Description :This function will enable the cursor. + * + * Parameters: + * pScreen :Handles to the Screeen pointer structure. + * + * Returns :none + * + * Comments :gfx_set_cursor enable function is hardcoded to enable the + * cursor + *---------------------------------------------------------------------------- +*/ +void +GX1ShowCursor(ScrnInfoPtr pScreenInfo) +{ + GFX(set_cursor_enable(1)); +} + +/*---------------------------------------------------------------------------- + * GX1UseHwCursor. + * + * Description :This function will sets the hardware cursor flag in + * pscreen structure. + * + * Parameters. + * pScreen :Handles to the Screeen pointer structure. + * + * Returns :none + * + * Comments :none + * + *---------------------------------------------------------------------------- +*/ +static Bool +GX1UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScreenInfo = XF86SCRNINFO(pScreen); + + if (pScreenInfo->currentMode->Flags & V_DBLSCAN) + return FALSE; + return TRUE; +} + +/* End of File */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_dga.c:1.2 --- /dev/null Thu Feb 27 12:31:10 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_dga.c Tue Jan 14 04:34:31 2003 @@ -0,0 +1,506 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_dga.c,v 1.2 2003/01/14 09:34:31 alanh Exp $ */ +/* + * $Workfile: nsc_gx1_dga.c $ + * $Revision: 6 $ + * $Author: Sarma $ + * + * File contents: DGA(Direct Acess Graphics mode) is feature of + * XFree86 that allows the program to access directly to video + * memory on the graphics card.DGA supports the double + * flickering.This file has the functions to support the DGA + * modes. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xaa.h" +#include "xaalocal.h" +#include "nsc.h" +#include "dgaproc.h" + +/* forward declarations */ +static Bool GX1_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static void GX1_CloseFramebuffer(ScrnInfoPtr pScrn); +static Bool GX1_SetMode(ScrnInfoPtr, DGAModePtr); +static int GX1_GetViewport(ScrnInfoPtr); +static void GX1_SetViewport(ScrnInfoPtr, int, int, int); +static void GX1_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); +static void GX1_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); + +extern void GX1AdjustFrame(int, int, int, int); +extern Bool GX1SwitchMode(int, DisplayModePtr, int); +extern void GX1AccelSync(ScrnInfoPtr pScreenInfo); + +Bool GX1DGAInit(ScreenPtr pScreen); + +static DGAFunctionRec GeodeDGAFuncs = { + GX1_OpenFramebuffer, + GX1_CloseFramebuffer, + GX1_SetMode, + GX1_SetViewport, + GX1_GetViewport, + GX1AccelSync, + GX1_FillRect, + GX1_BlitRect, + NULL +}; + +/*---------------------------------------------------------------------------- + * GX1DGAInit. + * + * Description :This function is used to intiallize the DGA modes and sets the + viewport based on the screen mode. + * Parameters. + * pScreeen :Pointer to screen info structure. + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :This function prepares the DGA mode settings for + * other func reference. + * +*---------------------------------------------------------------------------- +*/ +Bool +GX1DGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GeodePtr pGeode = GEODEPTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0; + Bool oneMore; + + pMode = firstMode = pScrn->modes; + DEBUGMSG(0, (0, X_NONE, "GX1DGAInit\n")); + while (pMode) { + + /* redundant but it can be used in future:if(0). */ + if (0) { /*pScrn->displayWidth != pMode->HDisplay */ + /* memory is allocated for dga to + *setup the viewport and mode parameters + */ + newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec)); + oneMore = TRUE; + } else { + /* one record is allocated here */ + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + oneMore = FALSE; + } + if (!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + + SECOND_PASS: /* DGA mode flgas and viewport parametrs are set here. */ + + currentMode = modes + num; + num++; + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pGeode->FBBase; + if (oneMore) { /* first one is narrow width */ + currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; + currentMode->imageWidth = pMode->HDisplay; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + oneMore = FALSE; + goto SECOND_PASS; + } else { + currentMode->bytesPerScanline = + ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + } + pMode = pMode->next; + if (pMode == firstMode) + break; + } + pGeode->numDGAModes = num; + pGeode->DGAModes = modes; + return DGAInit(pScreen, &GeodeDGAFuncs, modes, num); +} + +/*---------------------------------------------------------------------------- + * GX1_SetMode. + * + * Description :This function is sets into the DGA mode. + *. + * Parameters. + * pScreeen :Pointer to screen info structure. + * pMode :Points to the DGAmode ptr data + * Returns :TRUE on success and FALSE on failure. + * + * Comments :none. + * + * +*---------------------------------------------------------------------------- +*/ +static Bool +GX1_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) +{ + static int OldDisplayWidth[MAXSCREENS]; + int index = pScrn->pScreen->myNum; + GeodePtr pGeode = GEODEPTR(pScrn); + + DEBUGMSG(0, (0, X_NONE, "GX1_SetMode\n")); + if (!pMode) { + /* restore the original mode + * * put the ScreenParameters back + */ + pScrn->displayWidth = OldDisplayWidth[index]; + GX1SwitchMode(index, pScrn->currentMode, 0); + pGeode->DGAactive = FALSE; + } else { + if (!pGeode->DGAactive) { /* save the old parameters */ + OldDisplayWidth[index] = pScrn->displayWidth; + pGeode->DGAactive = TRUE; + } + pScrn->displayWidth = pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3); + GX1SwitchMode(index, pMode->mode, 0); + } + /* enable/disable cursor */ + if (pGeode->HWCursor) { +#if defined(STB_X) + Gal_set_compression_enable(((pGeode->DGAactive) ? + GAL_COMPRESSION_DISABLE : + GAL_COMPRESSION_ENABLE)); + Gal_set_cursor_enable(!pGeode->DGAactive); +#else + gfx_set_cursor_enable(!pGeode->DGAactive); + gfx_set_compression_enable(!pGeode->DGAactive); +#endif /* STB_X */ + } + + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX1_GetViewPort. + * + * Description :This function is Gets the viewport window memory. + *. + * Parameters. + * pScrn :Pointer to screen info structure. + * + * Returns :returns the viewport status. + * + * Comments :none. + * + * +*---------------------------------------------------------------------------- +*/ +static int +GX1_GetViewport(ScrnInfoPtr pScrn) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + return pGeode->DGAViewportStatus; +} + +/*---------------------------------------------------------------------------- + * GX1_SetViewPort. + * + * Description :This function is Gets the viewport window memory. + * + * Parameters. + * pScrn :Pointer to screen info structure. + x :x-cordinate of viewport window + * y :y-codinate of the viewport window. + * flags :indicates the viewport to be flipped or not. + * Returns :returns the viewport status as zero. + * + * Comments :none. + * +*---------------------------------------------------------------------------- +*/ +static void +GX1_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + GX1AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + pGeode->DGAViewportStatus = 0; /*GX1AdjustFrame loops until finished */ +} + +/*---------------------------------------------------------------------------- + * GX1_FillRect. + * + * Description :This function is Gets the viewport window memory. + *. + * Parameters. + * pScrn :Pointer to screen info structure. + * x :x-cordinate of viewport window + * y :y-codinate of the viewport window. + * w :width of the rectangle + * h :height of the rectangle. + * color :color to be filled in rectangle. + * + * Returns :returns the viewport status as zero. + * + * Comments :This function is implemented by solidfill routines.. + * +*---------------------------------------------------------------------------- +*/ +static void +GX1_FillRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h, unsigned long color) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + if (pGeode->AccelInfoRec) { + (*pGeode->AccelInfoRec->SetupForSolidFill) (pScrn, color, GXcopy, ~0); + (*pGeode->AccelInfoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); + SET_SYNC_FLAG(pGeode->AccelInfoRec); + } +} + +/*---------------------------------------------------------------------------- + * GX1_BlitRect. + * + * Description :This function implementing Blit and it moves a + * Rectangular block of data from one location to other + * Location. + * + * Parameters. + * pScrn :Pointer to screen info structure. + * srcx :x-cordinate of the src rectangle + * srcy :y-codinate of src rectangle. + * w :width of the rectangle + * h :height of the rectangle. + * dstx :x-cordinate of the dst rectangle. + * dsty :y -coordinates of the dst rectangle. + * Returns :none. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static void +GX1_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, + int h, int dstx, int dsty) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + if (pGeode->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pGeode->AccelInfoRec->SetupForScreenToScreenCopy) + (pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pGeode->AccelInfoRec->SubsequentScreenToScreenCopy) (pScrn, srcx, + srcy, dstx, dsty, + w, h); + SET_SYNC_FLAG(pGeode->AccelInfoRec); + } +} + +/*---------------------------------------------------------------------------- + * GX1_OpenFramebuffer. + * + * Description :This function open the framebuffer driver for DGA. + * + * Parameters. + * pScrn :Pointer to screen info structure. + * srcx :x-cordinate of the src rectangle + * srcy :y-codinate of src rectangle. + * w :width of the rectangle + * h :height of the rectangle. + * dstx :x-cordinate of the dst rectangle. + * dsty :y -coordinates of the dst rectangle. + * Returns :none. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static Bool +GX1_OpenFramebuffer(ScrnInfoPtr pScrn, + char **name, unsigned char **mem, + int *size, int *offset, int *flags) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char *)pGeode->FBLinearAddr; + *size = pGeode->FBSize; + *offset = 0; + *flags = DGA_NEED_ROOT; + return TRUE; +} + +static void +GX1_CloseFramebuffer(ScrnInfoPtr pScrn) +{ +} + +/* end of file */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_driver.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_driver.c:1.7 --- /dev/null Thu Feb 27 12:31:11 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_driver.c Fri Feb 14 08:28:29 2003 @@ -0,0 +1,2484 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_driver.c,v 1.7 2003/02/14 13:28:29 alanh Exp $ */ +/* + * $Workfile: nsc_gx1_driver.c $ + * $Revision: 25 $ + * $Author: Binesh $ + * + * File Contents: This is the main module configures the interfacing + * with the X server. The individual modules will be + * loaded based upon the options selected from the + * XF86Config. This file also has modules for finding + * supported modes, turning on the modes based on options. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* + * Lots of fixes & updates + * Alan Hourihane <alanh@fairlite.demon.co.uk> + */ + +#define DEBUG(x) +#define GEODE_TRACE 0 +#define CFB 0 +#define HWVGA 0 + +/* Includes that are used by all drivers */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +/* We may want inb() and outb() */ +#include "compiler.h" + +/* We may want to access the PCI config space */ +#include "xf86PciInfo.h" +#include "xf86Pci.h" + +/* Colormap handling stuff */ +#include "xf86cmap.h" + +/* Frame buffer stuff */ +#if CFB +/* + * If using cfb, cfb.h is required. Select the others for the bpp values + * the driver supports. + */ +#define PSZ 8 /* needed for cfb.h */ +#include "cfb.h" +#undef PSZ +#include "cfb16.h" +#include "cfb24.h" +#include "cfb32.h" + +#else +#include "fb.h" + +#endif + +#include "shadowfb.h" + +/* Machine independent stuff */ +#include "mipointer.h" +#include "mibank.h" +#include "micmap.h" +/* All drivers implementing backing store need this */ +#include "mibstore.h" +#include "vgaHW.h" +#include "vbe.h" + +/* Check for some extensions */ +#ifdef XFreeXDGA +#define _XF86_DGA_SERVER_ +#include "extensions/xf86dgastr.h" +#endif /* XFreeXDGA */ + +#ifdef DPMSExtension +#include "globals.h" +#include "opaque.h" +#define DPMS_SERVER +#include "extensions/dpms.h" +#endif /* DPMSExtension */ + +/* Our private include file (this also includes the durango headers) */ +#include "nsc.h" + +#if GEODE_TRACE +/* ANSI C does not allow var arg macros */ +#define GeodeDebug(args) DebugPort(DCount++);ErrorF args +#else +#define GeodeDebug(args) +#endif + +extern SymTabRec GeodeChipsets[]; +extern OptionInfoRec GeodeOptions[]; + +typedef struct _MemOffset +{ + unsigned long xres; + unsigned long yres; + unsigned long bpp; + unsigned long CBOffset; + unsigned short CBPitch; + unsigned short CBSize; + unsigned long CurOffset; + unsigned long OffScreenOffset; +} +MemOffset; + +/* predefined memory address for compression and cursor offsets + * if COMPRESSION enabled. + */ +MemOffset GeodeMemOffset[] = { + {640, 480, 8, 640, 1024, 272, 0x78000, 0x78100}, + {640, 480, 16, 1280, 2048, 272, 0x610, 0xF0000}, + {800, 600, 8, 800, 1024, 208, 0x96000, 0x96100}, + {800, 600, 16, 1600, 2048, 272, 0x12C000, 0x12C100}, + {1024, 768, 8, 0xC0000, 272, 272, 0xF3000, 0xF3100}, + {1024, 768, 16, 0x180000, 272, 272, 0x1B3000, 0x1B3100}, + {1152, 864, 8, 1152, 2048, 272, 0x590, 0x1B0000}, + {1152, 864, 16, 2304, 4096, 272, 0xA10, 0x360000}, + {1280, 1024, 8, 1280, 2048, 272, 0x610, 0x200000}, + {1280, 1024, 16, 2560, 4096, 272, 0xB10, 0x400000}, + + /* PAL TV modes */ + + {704, 576, 16, 1408, 2048, 272, 0x690, 0x120000}, + {720, 576, 16, 1440, 2048, 272, 0x6B0, 0x120000}, + {768, 576, 16, 1536, 2048, 256, 0x700, 0x120000}, + + /* NTSC TV modes */ + + {704, 480, 16, 1408, 2048, 272, 0x690, 0xF0000}, + {720, 480, 16, 1440, 2048, 272, 0x6B0, 0xF0000} + +}; +static int MemIndex = 0; + +static Bool GX1PreInit(ScrnInfoPtr, int); +static Bool GX1ScreenInit(int, ScreenPtr, int, char **); +static Bool GX1EnterVT(int, int); +static void GX1LeaveVT(int, int); +static void GX1FreeScreen(int, int); +void GX1AdjustFrame(int, int, int, int); +Bool GX1SwitchMode(int, DisplayModePtr, int); +static int GX1ValidMode(int, DisplayModePtr, Bool, int); +static void GX1LoadPalette(ScrnInfoPtr pScreenInfo, + int numColors, int *indizes, + LOCO * colors, VisualPtr pVisual); +static Bool GX1MapMem(ScrnInfoPtr); +static Bool GX1UnmapMem(ScrnInfoPtr); + +extern Bool GX1AccelInit(ScreenPtr pScreen); +extern Bool GX1HWCursorInit(ScreenPtr pScreen); +extern void GX1HideCursor(ScrnInfoPtr pScreenInfo); +extern void GX1ShowCursor(ScrnInfoPtr pScreenInfo); +extern void GX1PointerMoved(int index, int x, int y); +extern void GX1RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX1RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX1RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX1InitVideo(ScreenPtr pScreen); +extern Bool GX1DGAInit(ScreenPtr pScreen); +extern void GX1LoadCursorImage(ScrnInfoPtr pScreenInfo, unsigned char *src); +extern unsigned int GetVideoMemSize(void); + +void get_tv_overscan_geom(const char *options, int *X, int *Y, int *W, + int *H); +void GX1SetupChipsetFPtr(ScrnInfoPtr pScrn); +GeodePtr GX1GetRec(ScrnInfoPtr pScreenInfo); +void gx1_clear_screen(int width, int height); + +#if !defined(STB_X) +extern unsigned char *XpressROMPtr; +#endif /* STB_X */ + +/* List of symbols from other modules that this module references.The purpose +* is that to avoid unresolved symbol warnings +*/ +extern const char *nscVgahwSymbols[]; +extern const char *nscVbeSymbols[]; +extern const char *nscInt10Symbols[]; + +#if CFB +extern const char *nscCfbSymbols[]; +#else +extern const char *nscFbSymbols[]; +#endif +extern const char *nscXaaSymbols[]; +extern const char *nscRamdacSymbols[]; +extern const char *nscShadowSymbols[]; + +void +GX1SetupChipsetFPtr(ScrnInfoPtr pScrn) +{ + GeodeDebug(("GX1SetupChipsetFPtr!\n")); + + pScrn->PreInit = GX1PreInit; + pScrn->ScreenInit = GX1ScreenInit; + pScrn->SwitchMode = GX1SwitchMode; + pScrn->AdjustFrame = GX1AdjustFrame; + pScrn->EnterVT = GX1EnterVT; + pScrn->LeaveVT = GX1LeaveVT; + pScrn->FreeScreen = GX1FreeScreen; + pScrn->ValidMode = GX1ValidMode; +} + +/*---------------------------------------------------------------------------- + * GX1GetRec. + * + * Description :This function allocate an GeodeRec and hooked into + * pScreenInfo str driverPrivate member of ScreeenInfo + * structure. + * Parameters. + * pScreenInfo :Pointer handle to the screenonfo structure. + * + * Returns :allocated pScreeninfo structure. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +GeodePtr +GX1GetRec(ScrnInfoPtr pScreenInfo) +{ + if (!pScreenInfo->driverPrivate) + pScreenInfo->driverPrivate = xnfcalloc(sizeof(GeodeRec), 1); + return GEODEPTR(pScreenInfo); +} + +/*---------------------------------------------------------------------------- + * GX1FreeRec. + * + * Description :This function deallocate an GeodeRec and freed from + * pScreenInfo str driverPrivate member of ScreeenInfo + * structure. + * Parameters. + * pScreenInfo :Pointer handle to the screenonfo structure. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static void +GX1FreeRec(ScrnInfoPtr pScreenInfo) +{ + if (pScreenInfo->driverPrivate == NULL) { + return; + } + xfree(pScreenInfo->driverPrivate); + pScreenInfo->driverPrivate = NULL; +} + +/*---------------------------------------------------------------------------- + * GX1SaveScreen. + * + * Description :This is todo the screen blanking + * + * Parameters. + * pScreen :Handle to ScreenPtr structure. + * mode :mode is used by vgaHWSaveScren to check blnak os on. + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +static Bool +GX1SaveScreen(ScreenPtr pScreen, int mode) +{ +#if !defined(STB_X) + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + + GeodeDebug(("GX2SaveScreen!\n")); + + if (!pScreenInfo->vtSema) + return vgaHWSaveScreen(pScreen, mode); + +#endif /* STB_X */ + return TRUE; +} + +/*---------------------------------------------------------------------------- + * get_tv_overscan_geom. + * + * Description :This is todo the screen blanking + * + * Parameters: + * options : Pointer to the display options. + * X: Pointer to the offset of the screen X-co-ordinate. + * Y: Pointer to the offset of the screen Y-co-ordinate. + * W: Pointer to the width of the screen. + * H: Pointer to the height of the screen. + * Returns : none. + * + * Comments :none + *------------------------------------------------------------------------ + */ +void +get_tv_overscan_geom(const char *options, int *X, int *Y, int *W, int *H) +{ + char *tv_opt; + + tv_opt = strtok((char *)options, ":"); + *X = strtoul(tv_opt, NULL, 0); + tv_opt = strtok(NULL, ":"); + *Y = strtoul(tv_opt, NULL, 0); + tv_opt = strtok(NULL, ":"); + *W = strtoul(tv_opt, NULL, 0); + tv_opt = strtok(NULL, ":"); + *H = strtoul(tv_opt, NULL, 0); +} + +static void +GX1ProbeDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL, index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } +} + +/*---------------------------------------------------------------------------- + * GX1PreInit. + * + * Description :This function is called only once ate teh server startup + * + * Parameters. + * pScreenInfo :Handle to ScreenPtr structure. + * flags :flags may be used to check the probeed one with config. + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :none. + *---------------------------------------------------------------------------- + */ +static Bool +GX1PreInit(ScrnInfoPtr pScreenInfo, int flags) +{ + static ClockRange GeodeClockRange = + { NULL, 25175, 135000, 0, FALSE, TRUE, 1, 1, 0 }; + MessageType from; + int i = 0; + GeodePtr pGeode; + char *mod = NULL; + +#if CFB + char *reqSymbol = NULL; +#endif + +#if defined(STB_X) + GAL_ADAPTERINFO sAdapterInfo; +#endif /* STB_X */ + unsigned int PitchInc = 0, minPitch = 0, maxPitch = 0; + unsigned int minHeight = 0, maxHeight = 0; + const char *s; + char **modes; + char **tvmodes_defa; + + GeodeDebug(("GX1PreInit!\n")); + /* Allocate driver private structure */ + if (!(pGeode = GX1GetRec(pScreenInfo))) + return FALSE; + + /* This is the general case */ + for (i = 0; i < pScreenInfo->numEntities; i++) { + pGeode->pEnt = xf86GetEntityInfo(pScreenInfo->entityList[i]); + if (pGeode->pEnt->resources) + return FALSE; + pGeode->Chipset = pGeode->pEnt->chipset; + pScreenInfo->chipset = (char *)xf86TokenToString(GeodeChipsets, + pGeode->pEnt->chipset); + } + + if (flags & PROBE_DETECT) { + GX1ProbeDDC(pScreenInfo, pGeode->pEnt->index); + return TRUE; + } + + pGeode->FBVGAActive = 0; /* KFB will Knock of VGA */ + +#if !defined(STB_X) + /* If the vgahw module would be needed it would be loaded here */ + if (!xf86LoadSubModule(pScreenInfo, "vgahw")) { + return FALSE; + } + + xf86LoaderReqSymLists(nscVgahwSymbols, NULL); +#endif /* STB_X */ + GeodeDebug(("GX1PreInit(1)!\n")); + + /* Do the durango hardware detection */ +#if defined(STB_X) + if (!Gal_initialize_interface()) + return FALSE; + if (Gal_get_adapter_info(&sAdapterInfo)) { + pGeode->cpu_version = sAdapterInfo.dwCPUVersion; + pGeode->vid_version = sAdapterInfo.dwVideoVersion; + pGeode->FBSize = sAdapterInfo.dwFrameBufferSize; + /* update the max clock from the one system suports */ + GeodeClockRange.maxClock = sAdapterInfo.dwMaxSupportedPixelClock; + pGeode->FBLinearAddr = sAdapterInfo.dwFrameBufferBase; + + if (!GX1MapMem(pScreenInfo)) + return FALSE; + + } else { + return FALSE; + } +#else + pGeode->cpu_version = gfx_detect_cpu(); + pGeode->vid_version = gfx_detect_video(); + pGeode->FBLinearAddr = gfx_get_frame_buffer_base(); + /* update the max clock from the one system suports */ + GeodeClockRange.maxClock = gfx_get_max_supported_pixel_clock(); + + if (!GX1MapMem(pScreenInfo)) + return FALSE; + + DEBUGMSG(1, + (0, X_INFO, + "Geode chip info: cpu:%x vid:%x size:%x base:%x, rom:%X\n", + pGeode->cpu_version, pGeode->vid_version, pGeode->FBSize, + pGeode->FBBase, XpressROMPtr)); +#endif /* STB_X */ + + /* Fill in the monitor field */ + pScreenInfo->monitor = pScreenInfo->confScreen->monitor; + GeodeDebug(("GX1PreInit(2)!\n")); + /* Determine depth, bpp, etc. */ + if (!xf86SetDepthBpp(pScreenInfo, 8, 8, 8, 0)) { + return FALSE; + + } else { + + switch (pScreenInfo->depth) { + case 8: + case 16: + break; + default: + /* Depth not supported */ + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "Given depth (%d bpp) is not supported by this driver\n", + pScreenInfo->depth)); + return FALSE; + } + } + + /*This must happen after pScreenInfo->display has been set + * * because xf86SetWeight references it. + */ + if (pScreenInfo->depth > 8) { + /* The defaults are OK for us */ + rgb zeros = { 0, 0, 0 }; + + if (!xf86SetWeight(pScreenInfo, zeros, zeros)) { + return FALSE; + } else { + /* XXX Check if the returned weight is supported */ + } + } + xf86PrintDepthBpp(pScreenInfo); + GeodeDebug(("GX1PreInit(3)!\n")); + if (!xf86SetDefaultVisual(pScreenInfo, -1)) + return FALSE; + GeodeDebug(("GX1PreInit(4)!\n")); + + /* The new cmap layer needs this to be initialized */ + if (pScreenInfo->depth > 1) { + Gamma zeros = { 0.0, 0.0, 0.0 }; + + if (!xf86SetGamma(pScreenInfo, zeros)) { + return FALSE; + } + } + GeodeDebug(("GX1PreInit(5)!\n")); + /* We use a programmable clock */ + pScreenInfo->progClock = TRUE; + + /*Collect all of the relevant option flags + * *(fill in pScreenInfo->options) + */ + xf86CollectOptions(pScreenInfo, NULL); + + /*Process the options */ + xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, + GeodeOptions); + + /*Set the bits per RGB for 8bpp mode */ + if (pScreenInfo->depth == 8) { + /* Default to 8 */ + pScreenInfo->rgbBits = 8; + } + from = X_DEFAULT; + pGeode->HWCursor = TRUE; + /* + * *The preferred method is to use the "hw cursor" option as a tri-state + * *option, with the default set above. + */ + if (xf86GetOptValBool(GeodeOptions, OPTION_HW_CURSOR, &pGeode->HWCursor)) { + from = X_CONFIG; + } + /* For compatibility, accept this too (as an override) */ + if (xf86ReturnOptValBool(GeodeOptions, OPTION_SW_CURSOR, FALSE)) { + from = X_CONFIG; + pGeode->HWCursor = FALSE; + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, "Using %s cursor\n", + pGeode->HWCursor ? "HW" : "SW")); + + pGeode->Compression = TRUE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_NOCOMPRESSION, FALSE)) { + pGeode->Compression = FALSE; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "NoCompression\n")); + } + + pGeode->NoAccel = FALSE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_NOACCEL, FALSE)) { + pGeode->NoAccel = TRUE; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "Acceleration \ + disabled\n")); + } + + if (!xf86GetOptValInteger(GeodeOptions, OPTION_OSM_IMG_BUFS, + &(pGeode->NoOfImgBuffers))) + pGeode->NoOfImgBuffers = DEFAULT_NUM_OF_BUF; /* default # of buffers */ + if (pGeode->NoOfImgBuffers <= 0) + pGeode->NoOfImgBuffers = 0; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "No of Buffers %d\n", + pGeode->NoOfImgBuffers)); + + pGeode->TVSupport = FALSE; + + pGeode->FBTVActive = 0; + GFX(get_tv_enable(&(pGeode->FBTVActive))); + DEBUGMSG(1, (1, X_PROBED, "FB TV %d \n", pGeode->FBTVActive)); + + if ((s = xf86GetOptValString(GeodeOptions, OPTION_TV_SUPPORT))) { + + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "TV = %s\n", s)); + if (!xf86NameCmp(s, "PAL-768x576")) { + pGeode->TvParam.wStandard = TV_STANDARD_PAL; + pGeode->TvParam.wType = GFX_ON_TV_SQUARE_PIXELS; + pGeode->TvParam.wWidth = 768; + pGeode->TvParam.wHeight = 576; + pGeode->TVSupport = TRUE; + } else if (!xf86NameCmp(s, "PAL-720x576")) { + pGeode->TvParam.wStandard = TV_STANDARD_PAL; + pGeode->TvParam.wType = GFX_ON_TV_NO_SCALING; + pGeode->TvParam.wWidth = 720; + pGeode->TvParam.wHeight = 576; + pGeode->TVSupport = TRUE; + } else if (!xf86NameCmp(s, "NTSC-640x480")) { + pGeode->TvParam.wStandard = TV_STANDARD_NTSC; + pGeode->TvParam.wType = GFX_ON_TV_SQUARE_PIXELS; + pGeode->TvParam.wWidth = 640; + pGeode->TvParam.wHeight = 480; + pGeode->TVSupport = TRUE; + } else if (!xf86NameCmp(s, "NTSC-720x480")) { + pGeode->TvParam.wStandard = TV_STANDARD_NTSC; + pGeode->TvParam.wType = GFX_ON_TV_NO_SCALING; + pGeode->TvParam.wWidth = 720; + pGeode->TvParam.wHeight = 480; + pGeode->TVSupport = TRUE; + } + + if (pGeode->TVSupport == TRUE) { + pGeode->TvParam.wOutput = TV_OUTPUT_S_VIDEO; /* default */ + + /* Now find the output */ + if (pGeode->TVSupport) { + if ((s = xf86GetOptValString(GeodeOptions, OPTION_TV_OUTPUT))) { + if (!xf86NameCmp(s, "COMPOSITE")) { + pGeode->TvParam.wOutput = TV_OUTPUT_COMPOSITE; + } else if (!xf86NameCmp(s, "SVIDEO")) { + pGeode->TvParam.wOutput = TV_OUTPUT_S_VIDEO; + } else if (!xf86NameCmp(s, "YUV")) { + pGeode->TvParam.wOutput = TV_OUTPUT_YUV; + } else if (!xf86NameCmp(s, "SCART")) { + pGeode->TvParam.wOutput = TV_OUTPUT_SCART; + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "TVOutput = %s %d\n", s, + pGeode->TvParam.wOutput)); + } + } + } +/* Only SC1200 can support TV modes */ + if ((pGeode->vid_version != GFX_VID_SC1200) + && (pGeode->TVSupport == TRUE)) { + pGeode->TVSupport = FALSE; + } + + /*TV can be turned on only in 16BPP mode */ + if ((pScreenInfo->depth == 8) && (pGeode->TVSupport == TRUE)) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Warning TV Disabled, TV Can't be supported in 8Bpp !!!\n")); + pGeode->TVSupport = FALSE; + } + } + + /* If TV Supported then check for TVO support */ + if (pGeode->TVSupport == TRUE) { + pGeode->TVOx = 0; + pGeode->TVOy = 0; + pGeode->TVOw = 0; + pGeode->TVOh = 0; + pGeode->TV_Overscan_On = FALSE; + if ((s = xf86GetOptValString(GeodeOptions, OPTION_TV_OVERSCAN))) { + get_tv_overscan_geom(s, &(pGeode->TVOx), + &(pGeode->TVOy), &(pGeode->TVOw), + &(pGeode->TVOh)); + + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "TVO %d %d %d %d\n", pGeode->TVOx, pGeode->TVOy, + pGeode->TVOw, pGeode->TVOh)); + + if ((pGeode->TVOx >= 0 && pGeode->TVOy >= 0) && + (pGeode->TVOh > 0 && pGeode->TVOw > 0)) { + if (((pGeode->TVOx + pGeode->TVOw) <= pGeode->TvParam.wWidth) && + ((pGeode->TVOy + pGeode->TVOh) <= pGeode->TvParam.wHeight)) { + pGeode->TV_Overscan_On = TRUE; + } + } + } + } + + /* If TV is not selected and currently TV is enabled, disable the TV out */ + if (pGeode->TVSupport == FALSE) { + unsigned int status = 0; + + GFX(get_tv_enable(&status)); + if (status) + GFX(set_tv_enable(0)); + } + + pGeode->Panel = FALSE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_FLATPANEL, FALSE)) { + DEBUGMSG(0, (pScreenInfo->scrnIndex, X_CONFIG, "FlatPanel Selected\n")); + pGeode->Panel = TRUE; + } + + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Quering FP Bios %d\n", pGeode->Panel)); + + /* if FP not supported in BIOS, then turn off user option */ + if (pGeode->Panel) { + int ret; + + /* check if bios supports FP */ +#if defined(STB_X) + Gal_get_softvga_state(&ret); + if (!ret) { + /* its time to wakeup softvga */ + Gal_set_softvga_state(TRUE); + Gal_vga_mode_switch(0); + } + Gal_pnl_enabled_in_bios(&pGeode->Panel); + + if (pGeode->Panel) { + Gal_pnl_info_from_bios(&pGeode->FPBX, &pGeode->FPBY, + &pGeode->FPBB, &pGeode->FPBF); + } + if (!ret) { + /* its time to put softvga back to sleep */ + Gal_set_softvga_state(FALSE); + Gal_vga_mode_switch(1); + } +#else + ret = gfx_get_softvga_active(); + if (!ret) { + /* its time to wakeup softvga */ + gfx_enable_softvga(); + gfx_vga_mode_switch(0); + } + pGeode->Panel = Pnl_IsPanelEnabledInBIOS(); + if (pGeode->Panel) { + Pnl_GetPanelInfoFromBIOS(&pGeode->FPBX, &pGeode->FPBY, + &pGeode->FPBB, &pGeode->FPBF); + } + if (!ret) { + /* its time to put softvga back to sleep */ + gfx_disable_softvga(); + gfx_vga_mode_switch(1); + } +#endif + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Quering FP Bios %d %d %d %d\n", + pGeode->FPBX, pGeode->FPBY, pGeode->FPBB, pGeode->FPBF)); + + /* if panel not selected and Panel can be supported. + * Power down the panel. + */ + if (!pGeode->Panel) { +#if defined(STB_X) + Gal_pnl_powerdown(); +#else + Pnl_PowerDown(); +#endif /* STB_X */ + } else { +#if defined(STB_X) + Gal_pnl_powerup(); +#else + Pnl_PowerUp(); +#endif /* STB_X */ + } + + pGeode->ShadowFB = FALSE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_SHADOW_FB, FALSE)) { + pGeode->ShadowFB = TRUE; + pGeode->NoAccel = TRUE; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Using \"Shadow Framebuffer\" - acceleration disabled\n")); + } + + pGeode->Rotate = 0; + if ((s = xf86GetOptValString(GeodeOptions, OPTION_ROTATE))) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "Rotating - %s\n", s)); + if (!xf86NameCmp(s, "CW")) { + pGeode->ShadowFB = TRUE; + pGeode->NoAccel = TRUE; + pGeode->HWCursor = FALSE; + pGeode->Rotate = 1; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n")); + } else { + if (!xf86NameCmp(s, "CCW")) { + pGeode->ShadowFB = TRUE; + pGeode->NoAccel = TRUE; + pGeode->HWCursor = FALSE; + pGeode->Rotate = -1; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise - acceleration \ + disabled\n")); + } else { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", + s)); + DEBUGMSG(1, + (pScreenInfo->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n")); + } + } + } + + /* Disable Rotation when TV Over Scan is enabled */ + if (pGeode->TV_Overscan_On) + pGeode->Rotate = 0; + + /* XXX Init further private data here */ + + /* + * * This shouldn't happen because such problems should be caught in + * * GeodeProbe(), but check it just in case. + */ + if (pScreenInfo->chipset == NULL) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "ChipID 0x%04X is not recognised\n", pGeode->Chipset)); + return FALSE; + } + if (pGeode->Chipset < 0) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "Chipset \"%s\" is not recognised\n", + pScreenInfo->chipset)); + return FALSE; + } + GeodeDebug(("GX1PreInit(6)!\n")); + + /* + * * Init the screen with some values + */ +#if !defined(STB_X) + + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "Video I/O registers at 0x%08lX\n", + (unsigned long)VGAHW_GET_IOBASE())); +#endif /* STB_X */ + + if (pScreenInfo->memPhysBase == 0) { + from = X_PROBED; +#if defined(STB_X) + pScreenInfo->memPhysBase = sAdapterInfo.dwFrameBufferBase; +#else /* STB_X */ + pScreenInfo->memPhysBase = gfx_get_frame_buffer_base(); +#endif /* STB_X */ + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "Linear framebuffer at 0x%08lX\n", + (unsigned long)pScreenInfo->memPhysBase)); + + if (pGeode->pEnt->device->videoRam == 0) { + from = X_PROBED; + pScreenInfo->videoRam = pGeode->FBSize / 1024; + } else { + pScreenInfo->videoRam = pGeode->pEnt->device->videoRam; + from = X_CONFIG; + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "VideoRam: %d kByte\n", + (unsigned long)pScreenInfo->videoRam)); + + GeodeDebug(("GX1PreInit(7)!\n")); + + /* + * * xf86ValidateModes will check that the mode HTotal and VTotal values + * * don't exceed the chipset's limit if pScreenInfo->maxHValue adn + * * pScreenInfo->maxVValue are set. Since our GX1ValidMode() + * * already takes care of this, we don't worry about setting them here. + */ + /* Select valid modes from those available */ + /* + * * min pitch 1024, max 2048 (Pixel count) + * * min height 480, max 1024 (Pixel count) + */ + minPitch = 1024; + maxPitch = 2048; + minHeight = 480; + maxHeight = 1024; /* Can support upto 1280x1024 16Bpp */ + if (pScreenInfo->depth == 16) { + PitchInc = 2048; + } else { + PitchInc = 1024; + } + PitchInc <<= 3; /* in bits */ + + /* by default use what user sets in the XF86Config file */ + modes = pScreenInfo->display->modes; + if (pGeode->TVSupport == TRUE) { + char str[20]; + + sprintf(str, "%dx%d-%d", + pGeode->TvParam.wWidth, + pGeode->TvParam.wHeight, + ((pGeode->TvParam.wStandard == TV_STANDARD_PAL) ? 50 : 60)); + + tvmodes_defa = (char **)malloc(sizeof(char *) * 2); + tvmodes_defa[0] = (char *)malloc(strlen(str)); + tvmodes_defa[1] = NULL; + strcpy(str, tvmodes_defa[0]); + + modes = tvmodes_defa; + } + + i = xf86ValidateModes(pScreenInfo, + pScreenInfo->monitor->Modes, + modes, + &GeodeClockRange, + NULL, minPitch, maxPitch, + PitchInc, minHeight, maxHeight, + pScreenInfo->display->virtualX, + pScreenInfo->display->virtualY, +#if defined(STB_X) + sAdapterInfo.dwFrameBufferSize, +#else + pGeode->FBSize, +#endif /* STB_X */ + LOOKUP_BEST_REFRESH); + + DEBUGMSG(0, (pScreenInfo->scrnIndex, from, + "xf86ValidateModes: %d %d %d\n", + pScreenInfo->virtualX, + pScreenInfo->virtualY, pScreenInfo->displayWidth)); + if (i == -1) { + GX1FreeRec(pScreenInfo); + return FALSE; + } + GeodeDebug(("GX1PreInit(8)!\n")); + /* Prune the modes marked as invalid */ + xf86PruneDriverModes(pScreenInfo); + GeodeDebug(("GX1PreInit(9)!\n")); + if (i == 0 || pScreenInfo->modes == NULL) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "No valid modes found\n")); + GX1FreeRec(pScreenInfo); + return FALSE; + } + GeodeDebug(("GX1PreInit(10)!\n")); + xf86SetCrtcForModes(pScreenInfo, 0); + GeodeDebug(("GX1PreInit(11)!\n")); + /* Set the current mode to the first in the list */ + pScreenInfo->currentMode = pScreenInfo->modes; + GeodeDebug(("GX1PreInit(12)!\n")); + /* Print the list of modes being used */ + xf86PrintModes(pScreenInfo); + GeodeDebug(("GX1PreInit(13)!\n")); + /* Set the display resolution */ + xf86SetDpi(pScreenInfo, 0, 0); + GeodeDebug(("GX1PreInit(14)!\n")); + /* Load bpp-specific modules */ + mod = NULL; + +#if CFB + /* Load bpp-specific modules */ + switch (pScreenInfo->bitsPerPixel) { + case 8: + mod = "cfb"; + reqSymbol = "cfbScreenInit"; + break; + case 16: + mod = "cfb16"; + reqSymbol = "cfb16ScreenInit"; + break; + default: + return FALSE; + } + if (mod && xf86LoadSubModule(pScreenInfo, mod) == NULL) { + GX1FreeRec(pScreenInfo); + return FALSE; + } + + xf86LoaderReqSymbols(reqSymbol, NULL); +#else + if (xf86LoadSubModule(pScreenInfo, "fb") == NULL) { + GX1FreeRec(pScreenInfo); + return FALSE; + } + + xf86LoaderReqSymLists(nscFbSymbols, NULL); +#endif + GeodeDebug(("GX1PreInit(15)!\n")); + if (pGeode->NoAccel == FALSE) { + if (!xf86LoadSubModule(pScreenInfo, "xaa")) { + GX1FreeRec(pScreenInfo); + return FALSE; + } + xf86LoaderReqSymLists(nscXaaSymbols, NULL); + } + GeodeDebug(("GX1PreInit(16)!\n")); + if (pGeode->HWCursor == TRUE) { + if (!xf86LoadSubModule(pScreenInfo, "ramdac")) { + GX1FreeRec(pScreenInfo); + return FALSE; + } + xf86LoaderReqSymLists(nscRamdacSymbols, NULL); + } + GeodeDebug(("GX1PreInit(17)!\n")); + /* Load shadowfb if needed */ + if (pGeode->ShadowFB) { + if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) { + GX1FreeRec(pScreenInfo); + return FALSE; + } + xf86LoaderReqSymLists(nscShadowSymbols, NULL); + } + GeodeDebug(("GX2PreInit(18)!\n")); + if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "xf86RegisterResources() found resource conflicts\n")); + GX1FreeRec(pScreenInfo); + return FALSE; + } + GX1UnmapMem(pScreenInfo); + GeodeDebug(("GX1PreInit(19)!\n")); + GeodeDebug(("GX1PreInit(20)!\n")); + GeodeDebug(("GX1PreInit ... done successfully!\n")); + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX1RestoreEx. + * + * Description :This function restores the mode that was saved on server + entry + * Parameters. + * pScreenInfo :Handle to ScreenPtr structure. + * Pmode :poits to screen mode + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static void +GX1RestoreEx(ScrnInfoPtr pScreenInfo, DisplayModePtr pMode) +{ + GeodePtr pGeode; + + GeodeDebug(("GX1RestoreEx!\n")); + /* Get driver private structure */ + if (!(pGeode = GX1GetRec(pScreenInfo))) + return; + /* Restore the extended registers */ +#if defined(STB_X) + pGeode->FBgfxVgaRegs.dwFlags = GFX_VGA_FLAG_MISC_OUTPUT | + GFX_VGA_FLAG_STD_CRTC | GFX_VGA_FLAG_EXT_CRTC; + Gal_vga_restore(&(pGeode->FBgfxVgaRegs)); +#else + gfx_vga_restore(&(pGeode->FBgfxVgaRegs), + GFX_VGA_FLAG_MISC_OUTPUT | + GFX_VGA_FLAG_STD_CRTC | GFX_VGA_FLAG_EXT_CRTC); +#endif /* STB_X */ +} + +/*---------------------------------------------------------------------------- + * GX1CalculatePitchBytes. + * + * Description :This function restores the mode that was saved on server + * + * Parameters. + * pScreenInfo :Handle to ScreenPtr structure. + * Pmode :Points to screenmode + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static int +GX1CalculatePitchBytes(unsigned int width, unsigned int bpp) +{ + int lineDelta = width * (bpp >> 3); + + if (width < 640) { + /* low resolutions have both pixel and line doubling */ + DEBUGMSG(1, (0, X_PROBED, "lower resolution %d %d\n", + width, lineDelta)); + lineDelta <<= 1; + } + /* needed in Rotate mode when in accel is turned off */ + if (1) { /*!pGeode->NoAccel */ + if (lineDelta > 2048) + lineDelta = 4096; + else if (lineDelta > 1024) + lineDelta = 2048; + else + lineDelta = 1024; + } + + DEBUGMSG(1, (0, X_PROBED, "pitch %d %d\n", width, lineDelta)); + + return lineDelta; +} + +/*---------------------------------------------------------------------------- + * GX1GetRefreshRate. + * + * Description :This function restores the mode that saved on server + * + * Parameters. + * Pmode :Pointer to the screen modes + * + * Returns :It returns the selected refresh rate. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static int +GX1GetRefreshRate(DisplayModePtr pMode) +{ +#define THRESHOLD 2 + unsigned int i; + static int validRates[] = { 50, 56, 60, 70, 72, 75, 85 }; /* Hz */ + unsigned long dotClock; + int refreshRate; + int selectedRate; + + dotClock = pMode->SynthClock * 1000; + refreshRate = dotClock / pMode->CrtcHTotal / pMode->CrtcVTotal; + + if ((pMode->CrtcHTotal < 640) && (pMode->CrtcVTotal < 480)) + refreshRate >>= 2; /* double pixel and double scan */ + + DEBUGMSG(1, (0, X_PROBED, "dotclock %d %d\n", dotClock, refreshRate)); + + selectedRate = validRates[0]; + for (i = 0; i < (sizeof(validRates) / sizeof(validRates[0])); i++) { + if (validRates[i] < (refreshRate + THRESHOLD)) { + selectedRate = validRates[i]; + } + } + return selectedRate; +} + +void +gx1_clear_screen(int width, int height) +{ + /* clean up the frame buffer memory */ + GFX(set_solid_pattern(0)); + GFX(set_raster_operation(0xF0)); + GFX(pattern_fill(0, 0, width, height)); +} + +/*---------------------------------------------------------------------------- + * GX1SetMode. + * + * Description :This function sets parametrs for screen mode + * + * Parameters. + * pScreenInfo :Pointer to the screenInfo structure. + * Pmode :Pointer to the screen modes + * + * Returns :TRUE on success and FALSE on Failure. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ + +static Bool +GX1SetMode(ScrnInfoPtr pScreenInfo, DisplayModePtr pMode) +{ + GeodePtr pGeode; + + /* unsigned int compOffset, compPitch, compSize; */ + GeodeDebug(("GX1SetMode!\n")); + pGeode = GEODEPTR(pScreenInfo); + /* Set the VT semaphore */ + pScreenInfo->vtSema = TRUE; + DEBUGMSG(1, (0, X_NONE, "Set mode")); + /* The timing will be adjusted later */ + GeodeDebug(("Set display mode: %dx%d-%d (%dHz)\n", + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, GX1GetRefreshRate(pMode))); + GeodeDebug(("Before setting the mode\n")); + if ((pMode->CrtcHDisplay >= 640) && (pMode->CrtcVDisplay >= 480)) + + GFX(set_display_bpp(pScreenInfo->bitsPerPixel)); + + if (pGeode->TVSupport == TRUE) { + pGeode->TvParam.bState = 1; /* enable */ + /* wWidth and wHeight already set in init. */ +#if defined(STB_X) + Gal_tv_set_params(GAL_TVSTATE | GAL_TVOUTPUT | + GAL_TVFORMAT | GAL_TVRESOLUTION, &(pGeode->TvParam)); +#else + /* sequence might be important */ + gfx_set_tv_display(pGeode->TvParam.wWidth, pGeode->TvParam.wHeight); + gfx_set_tv_format(pGeode->TvParam.wStandard, pGeode->TvParam.wType); + gfx_set_tv_output(pGeode->TvParam.wOutput); + gfx_set_tv_enable(pGeode->TvParam.bState); + +#endif /* STB_X */ + } else { /* TV not selected */ + + DEBUGMSG(0, (0, X_PROBED, "Setting Display for CRT or TFT\n")); + + if (pGeode->Panel) { + DEBUGMSG(0, (0, X_PROBED, "Setting Display for TFT\n")); + DEBUGMSG(1, (0, X_PROBED, "Restore Panel %d %d %d %d %d\n", + pGeode->FPBX, pGeode->FPBY, + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, pScreenInfo->bitsPerPixel)); + + GFX(set_fixed_timings(pGeode->FPBX, pGeode->FPBY, + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel)); + } else { + /* display is crt */ + DEBUGMSG(0, (0, X_PROBED, "Setting Display for CRT\n")); + GFX(set_display_mode(pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX1GetRefreshRate(pMode))); + + /* adjust the pitch */ + GFX(set_display_pitch(pGeode->Pitch)); + + } + /* enable crt */ + GFX(set_crt_enable(CRT_ENABLE)); + } + + GFX(set_display_offset(0L)); + GFX(wait_vertical_blank()); + + /* enable compression if option selected */ + if (pGeode->Compression) { + /* set the compression parameters,and it will be turned on later. */ +#if defined(STB_X) + Gal_set_compression_parameters(GAL_COMPRESSION_ALL, + pGeode->CBOffset, + pGeode->CBPitch, pGeode->CBSize); + + /* set the compression buffer, all parameters already set */ + Gal_set_compression_enable(GAL_COMPRESSION_ENABLE); +#else + gfx_set_compression_offset(pGeode->CBOffset); + gfx_set_compression_pitch(pGeode->CBPitch); + gfx_set_compression_size(pGeode->CBSize); + + /* set the compression buffer, all parameters already set */ + gfx_set_compression_enable(1); +#endif /* STB_X */ + + } + if (pGeode->HWCursor) { + /* Load blank cursor */ + GX1LoadCursorImage(pScreenInfo, NULL); + GFX(set_cursor_position(pGeode->CursorStartOffset, 0, 0, 0, 0)); + GFX(set_cursor_enable(1)); + } else { + GeodeDebug(("GX1RestoreEx ... ")); + GX1RestoreEx(pScreenInfo, pMode); + GeodeDebug(("done.\n")); + } + + GeodeDebug(("done.\n")); + /* Reenable the hardware cursor after the mode switch */ + if (pGeode->HWCursor == TRUE) { + GeodeDebug(("GX1ShowCursor ... ")); + GX1ShowCursor(pScreenInfo); + GeodeDebug(("done.\n")); + } + /* Restore the contents in the screen info */ + GeodeDebug(("After setting the mode\n")); + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX1EnterGraphics. + * + * Description :This function will intiallize the displaytiming + structure for nextmode and switch to VGA mode. + * + * Parameters. + * pScreen :Screen information will be stored in this structure. + * pScreenInfo :Pointer to the screenInfo structure. + * + * Returns :TRUE on success and FALSE on Failure. + * + * Comments :gfx_vga_mode_switch() will start and end the + * switching based on the arguments 0 or 1.soft_vga + * is disabled in this function. +*---------------------------------------------------------------------------- +*/ +static Bool +GX1EnterGraphics(ScreenPtr pScreen, ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode; + +#if !defined(STB_X) + + vgaHWPtr hwp = VGAHWPTR(pScreenInfo); + + vgaHWUnlock(hwp); +#endif + + GeodeDebug(("GX1EnterGraphics!\n")); + + DEBUGMSG(1, (0, X_NONE, "EnterGraphics\n")); + /* Should we re-save the text mode on each VT enter? */ + pGeode = GX1GetRec(pScreenInfo); +#if 0 + print_gxm_gfx_reg(pGeode, 0x4C); + print_gxm_vga_reg(); +#endif + /* This routine saves the current VGA state in Durango VGA structure */ +#if defined(STB_X) + Gal_get_softvga_state(&pGeode->FBVGAActive); + pGeode->FBgfxVgaRegs.dwFlags = GFX_VGA_FLAG_MISC_OUTPUT | + GFX_VGA_FLAG_STD_CRTC | GFX_VGA_FLAG_EXT_CRTC; + Gal_vga_save(&(pGeode->FBgfxVgaRegs)); +#else + pGeode->FBVGAActive = gfx_get_softvga_active(); + gfx_vga_save(&(pGeode->FBgfxVgaRegs), + GFX_VGA_FLAG_MISC_OUTPUT | + GFX_VGA_FLAG_STD_CRTC | GFX_VGA_FLAG_EXT_CRTC); +#endif /* STB_X */ + DEBUGMSG(1, (0, X_PROBED, "VSA = %d\n", pGeode->FBVGAActive)); + +#if !defined(STB_X) + + vgaHWSave(pScreenInfo, &VGAHWPTR(pScreenInfo)->SavedReg, VGA_SR_ALL); +#endif + +#if defined(STB_X) + Gal_get_display_timing(&pGeode->FBgfxdisplaytiming); + Gal_tv_get_timings(0, &pGeode->FBgfxtvtiming); + + /* Save Display offset */ + Gal_get_display_offset(&(pGeode->FBDisplayOffset)); + + /* Save the current Compression state */ + Gal_get_compression_enable(&(pGeode->FBCompressionEnable)); + Gal_get_compression_parameters(GAL_COMPRESSION_ALL, + &(pGeode->FBCompressionOffset), + &(pGeode->FBCompressionPitch), + &(pGeode->FBCompressionSize)); + + /* Save Cursor offset */ + { + unsigned short x, y, xhot, yhot; + + Gal_get_cursor_position(&(pGeode->FBCursorOffset), + &x, &y, &xhot, &yhot); + } + /* Save the Panel state */ + Gal_pnl_save(); + + /* its time to put softvga to sleep */ + Gal_set_softvga_state(FALSE); + Gal_vga_mode_switch(1); + +#else + /* Save TV State */ + gfx_get_tv_enable(&(pGeode->FBTVEnabled)); + if (pGeode->FBTVEnabled) { + /* TV Format */ + pGeode->FBtvtiming.HorzTim = READ_VID32(SC1200_TVOUT_HORZ_TIM); + pGeode->FBtvtiming.HorzSync = READ_VID32(SC1200_TVOUT_HORZ_SYNC); + pGeode->FBtvtiming.VertSync = READ_VID32(SC1200_TVOUT_VERT_SYNC); + pGeode->FBtvtiming.LineEnd = READ_VID32(SC1200_TVOUT_LINE_END); + pGeode->FBtvtiming.VertDownscale = + READ_VID32(SC1200_TVOUT_VERT_DOWNSCALE); + pGeode->FBtvtiming.HorzScaling = READ_VID32(SC1200_TVOUT_HORZ_SCALING); + pGeode->FBtvtiming.TimCtrl1 = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + pGeode->FBtvtiming.TimCtrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); + pGeode->FBtvtiming.Subfreq = READ_VID32(SC1200_TVENC_SUB_FREQ); + pGeode->FBtvtiming.DispPos = READ_VID32(SC1200_TVENC_DISP_POS); + pGeode->FBtvtiming.DispSize = READ_VID32(SC1200_TVENC_DISP_SIZE); + /* TV Output */ + pGeode->FBtvtiming.TimCtrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); + pGeode->FBtvtiming.Debug = READ_VID32(SC1200_TVOUT_DEBUG); + /* TV Enable */ + pGeode->FBtvtiming.DacCtrl = READ_VID32(SC1200_TVENC_DAC_CONTROL); + } + + /* Save CRT State */ + pGeode->FBgfxdisplaytiming.dwDotClock = gfx_get_clock_frequency(); + pGeode->FBgfxdisplaytiming.wPitch = gfx_get_display_pitch(); + pGeode->FBgfxdisplaytiming.wBpp = gfx_get_display_bpp(); + pGeode->FBgfxdisplaytiming.wHTotal = gfx_get_htotal(); + pGeode->FBgfxdisplaytiming.wHActive = gfx_get_hactive(); + pGeode->FBgfxdisplaytiming.wHSyncStart = gfx_get_hsync_start(); + pGeode->FBgfxdisplaytiming.wHSyncEnd = gfx_get_hsync_end(); + pGeode->FBgfxdisplaytiming.wHBlankStart = gfx_get_hblank_start(); + pGeode->FBgfxdisplaytiming.wHBlankEnd = gfx_get_hblank_end(); + pGeode->FBgfxdisplaytiming.wVTotal = gfx_get_vtotal(); + pGeode->FBgfxdisplaytiming.wVActive = gfx_get_vactive(); + pGeode->FBgfxdisplaytiming.wVSyncStart = gfx_get_vsync_start(); + pGeode->FBgfxdisplaytiming.wVSyncEnd = gfx_get_vsync_end(); + pGeode->FBgfxdisplaytiming.wVBlankStart = gfx_get_vblank_start(); + pGeode->FBgfxdisplaytiming.wVBlankEnd = gfx_get_vblank_end(); + pGeode->FBgfxdisplaytiming.wPolarity = gfx_get_sync_polarities(); + + /* Save Display offset */ + pGeode->FBDisplayOffset = gfx_get_display_offset(); + + /* Save the current Compression state */ + pGeode->FBCompressionEnable = gfx_get_compression_enable(); + pGeode->FBCompressionOffset = gfx_get_compression_offset(); + pGeode->FBCompressionPitch = gfx_get_compression_pitch(); + pGeode->FBCompressionSize = gfx_get_compression_size(); + + /* Save Cursor offset */ + pGeode->FBCursorOffset = gfx_get_cursor_offset(); + + /* Save the Panel state */ + Pnl_SavePanelState(); + + /* its time to put softvga to sleep */ + gfx_disable_softvga(); + gfx_vga_mode_switch(1); + +#endif /* STB_X */ + + if (!GX1SetMode(pScreenInfo, pScreenInfo->currentMode)) { + return FALSE; + } +#if 1 + /* clear the frame buffer, for annoying noise during mode switch */ + gx1_clear_screen(pScreenInfo->currentMode->CrtcHDisplay, + pScreenInfo->currentMode->CrtcVDisplay); +#endif + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX1LeaveGraphics: + * + * Description :This function will restore the displaymode parameters + * and switches the VGA mode + * + * Parameters. + * pScreen :Screen information will be stored in this structure. + * pScreenInfo :Pointer to the screenInfo structure. + * + * + * Returns :none. + * + * Comments : gfx_vga_mode_switch() will start and end the switching + * based on the arguments 0 or 1.soft_vga is disabled in + * this function. +*---------------------------------------------------------------------------- +*/ +static void +GX1LeaveGraphics(ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode; + + GeodeDebug(("GX1LeaveGraphics!\n")); + pGeode = GEODEPTR(pScreenInfo); + + if (!pGeode->FBTVActive) { + GFX(set_tv_enable(0)); + } + /* clear the frame buffer, when leaving X */ + gx1_clear_screen(pScreenInfo->virtualX, pScreenInfo->virtualY); + +#if defined(STB_X) + Gal_set_display_timing(&pGeode->FBgfxdisplaytiming); + Gal_tv_set_timings(0, &pGeode->FBgfxtvtiming); + Gal_set_display_offset(pGeode->FBDisplayOffset); + + /* Restore Cursor */ + Gal_set_cursor_position(pGeode->FBCursorOffset, 0, 0, 0, 0); + + /* Restore the previous Compression state */ + if (pGeode->FBCompressionEnable) { + Gal_set_compression_parameters(GAL_COMPRESSION_ALL, + pGeode->FBCompressionOffset, + pGeode->FBCompressionPitch, + pGeode->FBCompressionSize); + + Gal_set_compression_enable(GAL_COMPRESSION_ENABLE); + } +#else + /* Restore TV */ + if (pGeode->FBTVEnabled) { + /* TV Format */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, pGeode->FBtvtiming.HorzTim); + WRITE_VID32(SC1200_TVOUT_HORZ_SYNC, pGeode->FBtvtiming.HorzSync); + WRITE_VID32(SC1200_TVOUT_VERT_SYNC, pGeode->FBtvtiming.VertSync); + WRITE_VID32(SC1200_TVOUT_LINE_END, pGeode->FBtvtiming.LineEnd); + WRITE_VID32(SC1200_TVOUT_VERT_DOWNSCALE, + pGeode->FBtvtiming.VertDownscale); + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, pGeode->FBtvtiming.HorzScaling); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, pGeode->FBtvtiming.TimCtrl1); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, pGeode->FBtvtiming.TimCtrl2); + WRITE_VID32(SC1200_TVENC_SUB_FREQ, pGeode->FBtvtiming.Subfreq); + WRITE_VID32(SC1200_TVENC_DISP_POS, pGeode->FBtvtiming.DispPos); + WRITE_VID32(SC1200_TVENC_DISP_SIZE, pGeode->FBtvtiming.DispSize); + /* TV Output */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, pGeode->FBtvtiming.TimCtrl2); + /* WRITE_VID32(SC1200_TVENC_DAC_CONTROL, tmp); */ + WRITE_VID32(SC1200_TVOUT_DEBUG, pGeode->FBtvtiming.Debug); + /* TV Enable */ + WRITE_VID32(SC1200_TVENC_DAC_CONTROL, pGeode->FBtvtiming.DacCtrl); + } + + /* Restore CRT */ + gfx_set_display_timings(pGeode->FBgfxdisplaytiming.wBpp, + pGeode->FBgfxdisplaytiming.wPolarity, + pGeode->FBgfxdisplaytiming.wHActive, + pGeode->FBgfxdisplaytiming.wHBlankStart, + pGeode->FBgfxdisplaytiming.wHSyncStart, + pGeode->FBgfxdisplaytiming.wHSyncEnd, + pGeode->FBgfxdisplaytiming.wHBlankEnd, + pGeode->FBgfxdisplaytiming.wHTotal, + pGeode->FBgfxdisplaytiming.wVActive, + pGeode->FBgfxdisplaytiming.wVBlankStart, + pGeode->FBgfxdisplaytiming.wVSyncStart, + pGeode->FBgfxdisplaytiming.wVSyncEnd, + pGeode->FBgfxdisplaytiming.wVBlankEnd, + pGeode->FBgfxdisplaytiming.wVTotal, + pGeode->FBgfxdisplaytiming.dwDotClock); + + gfx_set_display_pitch(pGeode->FBgfxdisplaytiming.wPitch); + + gfx_set_display_offset(pGeode->FBDisplayOffset); + + /* Restore Cursor */ + gfx_set_cursor_position(pGeode->FBCursorOffset, 0, 0, 0, 0); + + /* Restore the previous Compression state */ + if (pGeode->FBCompressionEnable) { + gfx_set_compression_offset(pGeode->FBCompressionOffset); + gfx_set_compression_pitch(pGeode->FBCompressionPitch); + gfx_set_compression_size(pGeode->FBCompressionSize); + gfx_set_compression_enable(1); + } +#endif /* STB_X */ + + /* We need this to get back to vga mode when soft-vga + * * kicks in. + * * We actually need to examine the attribute Ctlr to find out + * * what kinda crap (grafix or text) we need to enter in + * * For now just lookout for 720x400 + */ +#if 0 + if ((pGeode->FBgfxdisplaytiming.wHActive == 720) && + (pGeode->FBgfxdisplaytiming.wVActive == 400)) +#else + if (pGeode->FBVGAActive) +#endif + { + /* VSA was active before we started. Since we disabled it + * we got to enable it */ +#if defined(STB_X) + Gal_set_softvga_state(TRUE); + Gal_vga_mode_switch(1); + Gal_vga_clear_extended(); +#else + gfx_enable_softvga(); + gfx_vga_mode_switch(1); + gfx_vga_clear_extended(); +#endif /* STB_X */ + +#if !defined(STB_X) + + vgaHWRestore(pScreenInfo, &VGAHWPTR(pScreenInfo)->SavedReg, VGA_SR_ALL); +#endif + +#if defined(STB_X) + pGeode->FBgfxVgaRegs.dwFlags = GFX_VGA_FLAG_MISC_OUTPUT | + GFX_VGA_FLAG_STD_CRTC | GFX_VGA_FLAG_EXT_CRTC; + Gal_vga_restore(&(pGeode->FBgfxVgaRegs)); + Gal_vga_mode_switch(0); +#else + gfx_vga_restore(&(pGeode->FBgfxVgaRegs), + GFX_VGA_FLAG_MISC_OUTPUT | + GFX_VGA_FLAG_STD_CRTC | GFX_VGA_FLAG_EXT_CRTC); + gfx_vga_mode_switch(0); +#endif /* STB_X */ + } +#if 0 + print_gxm_gfx_reg(pGeode, 0x4C); + print_gxm_vga_reg(); +#endif +} + +/*---------------------------------------------------------------------------- + * GX1CloseScreen. + * + * Description :This function will restore the original mode + * and also it unmap video memory + * + * Parameters. + * ScrnIndex :Screen index value of the screen will be closed. + * pScreen :Pointer to the screen structure. + * + * + * Returns :TRUE on success and FALSE on Failure. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static Bool +GX1CloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + DEBUGMSG(1, (scrnIndex, X_PROBED, "GX1CloseScreen\n")); + GeodeDebug(("GX1CloseScreen!\n")); + GX1LeaveGraphics(pScreenInfo); + if (pGeode->AccelInfoRec) + XAADestroyInfoRec(pGeode->AccelInfoRec); + pScreenInfo->vtSema = FALSE; + if (pGeode->DGAModes) + xfree(pGeode->DGAModes); + pGeode->DGAModes = 0; + if (pGeode->ShadowPtr) + xfree(pGeode->ShadowPtr); + + if (pGeode->AccelImageWriteBufferOffsets) { + xfree(pGeode->AccelImageWriteBufferOffsets); + pGeode->AccelImageWriteBufferOffsets = 0x0; + } + /* free the allocated off screen area */ + xf86FreeOffscreenArea(pGeode->AccelImgArea); + xf86FreeOffscreenArea(pGeode->CompressionArea); + + GX1UnmapMem(pScreenInfo); + + pScreen->CloseScreen = pGeode->CloseScreen; + return (*pScreen->CloseScreen) (scrnIndex, pScreen); + +} + +#ifdef DPMSExtension +/*---------------------------------------------------------------------------- + * GX1DPMSet. + * + * Description :This function sets geode into Power Management + * Signalling mode. + * + * Parameters. + * pScreenInfo :Pointer to screen info strucrure. + * mode :Specifies the power management mode. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static void +GX1DPMSSet(ScrnInfoPtr pScreenInfo, int mode, int flags) +{ + GeodePtr pGeode; + + pGeode = GEODEPTR(pScreenInfo); + + GeodeDebug(("GX1DPMSSet!\n")); + + /* Check if we are actively controlling the display */ + if (!pScreenInfo->vtSema) { + ErrorF("GX1DPMSSet called when we not controlling the VT!\n"); + return; + } + switch (mode) { + case DPMSModeOn: + /* Screen: On; HSync: On; VSync: On */ + GFX(set_crt_enable(CRT_ENABLE)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerup(); +#else + if (pGeode->Panel) + Pnl_PowerUp(); +#endif /* STB_X */ + if (pGeode->TVSupport) + GFX(set_tv_enable(1)); + break; + + case DPMSModeStandby: + /* Screen: Off; HSync: Off; VSync: On */ + GFX(set_crt_enable(CRT_STANDBY)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerdown(); +#else + if (pGeode->Panel) + Pnl_PowerDown(); +#endif /* STB_X */ + if (pGeode->TVSupport) + GFX(set_tv_enable(0)); + break; + + case DPMSModeSuspend: + /* Screen: Off; HSync: On; VSync: Off */ + GFX(set_crt_enable(CRT_SUSPEND)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerdown(); +#else + if (pGeode->Panel) + Pnl_PowerDown(); +#endif /* STB_X */ + if (pGeode->TVSupport) + GFX(set_tv_enable(0)); + break; + case DPMSModeOff: + /* Screen: Off; HSync: Off; VSync: Off */ + GFX(set_crt_enable(CRT_DISABLE)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerdown(); +#else + if (pGeode->Panel) + Pnl_PowerDown(); +#endif /* STB_X */ + if (pGeode->TVSupport) + GFX(set_tv_enable(0)); + break; + } +} +#endif + +/*---------------------------------------------------------------------------- + * GX1ScreenInit. + * + * Description :This function will be called at the each ofserver + * generation. + * + * Parameters. + * scrnIndex :Specfies the screenindex value during generation. + * pScreen :Pointer to screen info strucrure. + * argc :parameters for command line arguments count + * argv :command line arguments if any it is not used. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static Bool +GX1ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + GeodePtr pGeode; + int i; + Bool Inited = FALSE; + unsigned char *FBStart; + unsigned int req_offscreenmem; + int width, height, displayWidth; + VisualPtr visual; + BoxRec AvailBox; + RegionRec OffscreenRegion; + + DCount = 30; + + GeodeDebug(("GX1ScreenInit!\n")); + /* Get driver private */ + pGeode = GX1GetRec(pScreenInfo); + GeodeDebug(("GX1ScreenInit(0)!\n")); + +#if !defined(STB_X) + /* + * * Allocate a vgaHWRec + */ + if (!vgaHWGetHWRec(pScreenInfo)) + return FALSE; + VGAHWPTR(pScreenInfo)->MapSize = 0x10000; /* Standard 64k VGA window */ + if (!vgaHWMapMem(pScreenInfo)) + return FALSE; +#endif + + if (!GX1MapMem(pScreenInfo)) + return FALSE; + +#if !defined(STB_X) + vgaHWGetIOBase(VGAHWPTR(pScreenInfo)); +#endif + + pGeode->Pitch = GX1CalculatePitchBytes(pScreenInfo->virtualX, + pScreenInfo->bitsPerPixel); + + /* find the index to our operating mode the offsets are located */ + for (i = 0; i < (int)((sizeof(GeodeMemOffset) / sizeof(MemOffset))); i++) { + if ((pScreenInfo->virtualX == (int)GeodeMemOffset[i].xres) && + (pScreenInfo->virtualY == (int)GeodeMemOffset[i].yres) && + (pScreenInfo->bitsPerPixel == (int)GeodeMemOffset[i].bpp)) { + MemIndex = i; + break; + } + } + if (MemIndex == -1) /* no match */ + return FALSE; + + /* SET UP GRAPHICS MEMORY AVAILABLE FOR PIXMAP CACHE */ + AvailBox.x1 = 0; + AvailBox.y1 = pScreenInfo->virtualY; + AvailBox.x2 = pScreenInfo->displayWidth; + AvailBox.y2 = (pGeode->FBSize / pGeode->Pitch); + + pGeode->CursorSize = 8 * 32; /* 32 DWORDS */ + + if (pGeode->HWCursor) { + /* Compute cursor buffer */ + /* Default cursor offset, end of the frame buffer */ + pGeode->CursorStartOffset = pGeode->FBSize - pGeode->CursorSize; + AvailBox.y2 -= 1; + } + + DEBUGMSG(1, (scrnIndex, X_PROBED, + "Memory manager initialized to (%d,%d) (%d,%d) %d %d\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2, + pGeode->Pitch, pScreenInfo->displayWidth)); + /* set the offscreen offset accordingly */ + if (pGeode->Compression) { + + pGeode->CBOffset = GeodeMemOffset[MemIndex].CBOffset; + pGeode->CBSize = GeodeMemOffset[MemIndex].CBSize - 16; + pGeode->CBPitch = GeodeMemOffset[MemIndex].CBPitch; + + if ((pScreenInfo->virtualX == 1024) && (pScreenInfo->virtualY == 768)) { + req_offscreenmem = pScreenInfo->virtualY * pGeode->CBPitch; + req_offscreenmem += pGeode->Pitch - 1; + req_offscreenmem /= pGeode->Pitch; + pGeode->CBOffset = AvailBox.y1 * pGeode->Pitch; + AvailBox.y1 += req_offscreenmem; + } + } + DEBUGMSG(1, (scrnIndex, X_PROBED, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2)); + + if (!pGeode->NoAccel) { + if (pGeode->NoOfImgBuffers > 0) { + if (pGeode->NoOfImgBuffers <= (AvailBox.y2 - AvailBox.y1)) { + pGeode->AccelImageWriteBufferOffsets = + xalloc(sizeof(unsigned long) * pGeode->NoOfImgBuffers); + + pGeode->AccelImageWriteBufferOffsets[0] = + ((unsigned char *)pGeode->FBBase) + + (AvailBox.y1 * pGeode->Pitch); + + for (i = 1; i < pGeode->NoOfImgBuffers; i++) { + pGeode->AccelImageWriteBufferOffsets[i] = + pGeode->AccelImageWriteBufferOffsets[i - 1] + + pGeode->Pitch; + } + + for (i = 0; i < pGeode->NoOfImgBuffers; i++) { + DEBUGMSG(1, (scrnIndex, X_PROBED, + "memory %d %x\n", i, + pGeode->AccelImageWriteBufferOffsets[i])); + } + AvailBox.y1 += pGeode->NoOfImgBuffers; + } else { + xf86DrvMsg(scrnIndex, X_ERROR, + "Unable to reserve scanline area\n"); + } + } + DEBUGMSG(1, (scrnIndex, X_PROBED, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2)); + + REGION_INIT(pScreen, &OffscreenRegion, &AvailBox, 2); + + if (!xf86InitFBManagerRegion(pScreen, &OffscreenRegion)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2); + } else { + xf86DrvMsg(scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2); + } + REGION_UNINIT(pScreen, &OffscreenRegion); + } + + /* Initialise graphics mode */ + if (!GX1EnterGraphics(pScreen, pScreenInfo)) + return FALSE; + + GX1AdjustFrame(scrnIndex, pScreenInfo->frameX0, pScreenInfo->frameY0, 0); + GeodeDebug(("GX1ScreenInit(1)!\n")); + + /* Reset visual list */ + miClearVisualTypes(); + GeodeDebug(("GX1ScreenInit(2)!\n")); + + /* Setup the visual we support */ + if (pScreenInfo->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScreenInfo->depth, + TrueColorMask, + pScreenInfo->rgbBits, + pScreenInfo->defaultVisual)) { + return FALSE; + } + } else { + if (!miSetVisualTypes(pScreenInfo->depth, + miGetDefaultVisualMask(pScreenInfo->depth), + pScreenInfo->rgbBits, + pScreenInfo->defaultVisual)) { + return FALSE; + } + } + GeodeDebug(("GX1ScreenInit(3)!\n")); + /* Set this for RENDER extension */ + miSetPixmapDepths(); + /* Call the framebuffer layer's ScreenInit function, and fill in other + * * pScreen fields. + */ + + if (pGeode->TV_Overscan_On) { + width = pGeode->TVOw; + height = pGeode->TVOh; + GeodeDebug(("width : %d , height : %d", width, height)); + } else { + width = pScreenInfo->virtualX; + height = pScreenInfo->virtualY; + } + + displayWidth = pScreenInfo->displayWidth; + if (pGeode->Rotate) { + if (pGeode->TV_Overscan_On) { + width = pGeode->TVOh; + height = pGeode->TVOw; + } else { + width = pScreenInfo->virtualY; + height = pScreenInfo->virtualX; + } + } + if (pGeode->ShadowFB) { + pGeode->ShadowPitch = BitmapBytePad(pScreenInfo->bitsPerPixel * width); + pGeode->ShadowPtr = xalloc(pGeode->ShadowPitch * height); + displayWidth = pGeode->ShadowPitch / (pScreenInfo->bitsPerPixel >> 3); + FBStart = pGeode->ShadowPtr; + } else { + pGeode->ShadowPtr = NULL; + + if (pGeode->TV_Overscan_On) { + GeodeDebug(("pGeode->Pitch (%d)!\n", pGeode->Pitch)); + FBStart = pGeode->FBBase + (pGeode->Pitch * pGeode->TVOy) + + (pGeode->TVOx << ((pScreenInfo->depth >> 3) - 1)); + } else { + FBStart = pGeode->FBBase; + } + DEBUGMSG(1, (0, X_PROBED, "FBStart %X \n", FBStart)); + } + + /* Initialise the framebuffer */ + switch (pScreenInfo->bitsPerPixel) { +#if CFB + case 8: + Inited = cfbScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth); + break; + case 16: + Inited = cfb16ScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth); + break; + +#else + case 8: + case 16: + Inited = fbScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth, pScreenInfo->bitsPerPixel); + break; +#endif + default: + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: invalid bpp (%d) in ScreenInit\n", + pScreenInfo->bitsPerPixel); + Inited = FALSE; + break; + } + if (!Inited) + return FALSE; + + GeodeDebug(("GX1ScreenInit(4)!\n")); + + xf86SetBlackWhitePixels(pScreen); + + if (!pGeode->ShadowFB && (!pGeode->TV_Overscan_On)) { + GX1DGAInit(pScreen); + } + GeodeDebug(("GX1ScreenInit(5)!\n")); + if (pScreenInfo->bitsPerPixel > 8) { + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScreenInfo->offset.red; + visual->offsetGreen = pScreenInfo->offset.green; + visual->offsetBlue = pScreenInfo->offset.blue; + visual->redMask = pScreenInfo->mask.red; + visual->greenMask = pScreenInfo->mask.green; + visual->blueMask = pScreenInfo->mask.blue; + } + } + } +#if CFB +#else + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); +#endif + + GeodeDebug(("GX1ScreenInit(6)!\n")); + if (!pGeode->NoAccel) { + GX1AccelInit(pScreen); + } + GeodeDebug(("GX1ScreenInit(7)!\n")); + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + + GeodeDebug(("GX1ScreenInit(8)!\n")); + /* Initialise software cursor */ + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + /* Initialize HW cursor layer. + * * Must follow software cursor initialization + */ + if (pGeode->HWCursor) { + if (!GX1HWCursorInit(pScreen)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + } + GeodeDebug(("GX1ScreenInit(9)!\n")); + + /* Setup default colourmap */ + if (!miCreateDefColormap(pScreen)) { + return FALSE; + } + + GeodeDebug(("GX1ScreenInit(10)!\n")); + /* Initialize colormap layer. + * * Must follow initialization of the default colormap + */ + if (!xf86HandleColormaps(pScreen, 256, 8, + GX1LoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | + CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + GeodeDebug(("GX1ScreenInit(11)!\n")); + + if (pGeode->ShadowFB) { + RefreshAreaFuncPtr refreshArea = GX1RefreshArea; + + if (pGeode->Rotate) { + if (!pGeode->PointerMoved) { + pGeode->PointerMoved = pScreenInfo->PointerMoved; + pScreenInfo->PointerMoved = GX1PointerMoved; + } + switch (pScreenInfo->bitsPerPixel) { + case 8: + refreshArea = GX1RefreshArea8; + break; + case 16: + refreshArea = GX1RefreshArea16; + break; + } + } + ShadowFBInit(pScreen, refreshArea); + } +#ifdef DPMSExtension + xf86DPMSInit(pScreen, GX1DPMSSet, 0); +#endif + GeodeDebug(("GX1ScreenInit(12)!\n")); + + if (pGeode->TV_Overscan_On) { + GeodeDebug(("pGeode->Pitch (%d)!\n", pGeode->Pitch)); + + pScreenInfo->memPhysBase = (unsigned long)(pGeode->FBBase + + (pGeode->Pitch * + pGeode->TVOy) + + (pGeode-> + TVOx << + ((pScreenInfo->depth >> 3) - + 1))); + GeodeDebug(("->memPhysBase (%X)!\n", pScreenInfo->memPhysBase)); + } else { + pScreenInfo->memPhysBase = (unsigned long)pGeode->FBBase; + } + pScreenInfo->fbOffset = 0; + + GeodeDebug(("GX1ScreenInit(13)!\n")); + GX1InitVideo(pScreen); /* needed for video */ + /* Wrap the screen's CloseScreen vector and set its + * SaveScreen vector + */ + pGeode->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = GX1CloseScreen; + + pScreen->SaveScreen = GX1SaveScreen; + GeodeDebug(("GX1ScreenInit(14)!\n")); + /* Report any unused options */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScreenInfo->scrnIndex, pScreenInfo->options); + } + GeodeDebug(("GX2ScreenInit(15)!\n")); + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX1SwitchMode. + * + * Description :This function will switches the screen mode + * + * Parameters: + * scrnIndex :Specfies the screen index value. + * pMode :pointer to the mode structure. + * flags :may be used for status check?. + * + * Returns :Returns TRUE on success and FALSE on failure. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +Bool +GX1SwitchMode(int scrnIndex, DisplayModePtr pMode, int flags) +{ + GeodeDebug(("GX1SwitchMode!\n")); + return GX1SetMode(xf86Screens[scrnIndex], pMode); +} + +/*---------------------------------------------------------------------------- + * GX1AdjustFrame. + * + * Description :This function is used to intiallize the start + * address of the memory. + * Parameters. + * scrnIndex :Specfies the screen index value. + * x :x co-ordinate value interms of pixels. + * y :y co-ordinate value interms of pixels. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +void +GX1AdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + GeodePtr pGeode; + unsigned long offset; + + pGeode = GX1GetRec(pScreenInfo); + offset = (unsigned long)y *(unsigned long)pGeode->Pitch; + + offset += x; + if (pScreenInfo->bitsPerPixel > 8) { + offset += x; + } + GFX(set_display_offset(offset)); +} + +/*---------------------------------------------------------------------------- + * GX1EnterVT. + * + * Description :This is called when VT switching back to the X server + * + * Parameters. + * scrnIndex :Specfies the screen index value. + * flags :Not used inside the function. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static Bool +GX1EnterVT(int scrnIndex, int flags) +{ + GeodeDebug(("GX1EnterVT!\n")); + return GX1EnterGraphics(NULL, xf86Screens[scrnIndex]); +} + +/*---------------------------------------------------------------------------- + * GX1LeaveVT. + * + * Description :This is called when VT switching X server text mode. + * + * Parameters. + * scrnIndex :Specfies the screen index value. + * flags :Not used inside the function. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static void +GX1LeaveVT(int scrnIndex, int flags) +{ + GeodeDebug(("GX1LeaveVT!\n")); + GX1LeaveGraphics(xf86Screens[scrnIndex]); +} + +/*---------------------------------------------------------------------------- + * GX1FreeScreen. + * + * Description :This is called to free any persistent data structures. + * + * Parameters. + * scrnIndex :Specfies the screen index value. + * flags :Not used inside the function. + * + * Returns :none. + * + * Comments :This will be called only when screen being deleted.. +*---------------------------------------------------------------------------- +*/ +static void +GX1FreeScreen(int scrnIndex, int flags) +{ + GeodeDebug(("GX1FreeScreen!\n")); +#if !defined(STB_X) + + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) + vgaHWFreeHWRec(xf86Screens[scrnIndex]); +#endif + GX1FreeRec(xf86Screens[scrnIndex]); +} + +/*---------------------------------------------------------------------------- + * GX1ValidMode. + * + * Description :This function checks if a mode is suitable for selected + * chipset. + * Parameters. + * scrnIndex :Specfies the screen index value. + * pMode :Pointer to the screen mode structure.. + * verbose :not used for implementation. + * flags :not used for implementation + * + * Returns :MODE_OK if the specified mode is supported or + * MODE_NO_INTERLACE. + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static int +GX1ValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + unsigned int total_memory_required; + int ret = -1; + GeodePtr pGeode = GX1GetRec(pScreenInfo); + + DEBUGMSG(1, (0, X_NONE, "GeodeValidateMode: %dx%d %d %d\n", + pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, GX1GetRefreshRate(pMode))); + + if (pGeode->TVSupport == TRUE) { + if ((pGeode->TvParam.wWidth == pMode->CrtcHDisplay) && + (pGeode->TvParam.wHeight == pMode->CrtcVDisplay)) { + DEBUGMSG(1, (0, X_NONE, "TV mode\n")); + +#if defined(STB_X) + Gal_is_tv_mode_supported(0, &(pGeode->TvParam), &ret); +#else + ret = gfx_is_tv_display_mode_supported(pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pGeode->TvParam.wStandard); +#endif + } + } else { + DEBUGMSG(1, (0, X_NONE, "CRT mode\n")); + + if (pMode->Flags & V_INTERLACE) + return MODE_NO_INTERLACE; + +#if defined(STB_X) + Gal_is_display_mode_supported(pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX1GetRefreshRate(pMode), &ret); +#else + ret = gfx_is_display_mode_supported(pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX1GetRefreshRate(pMode)); +#endif /* STB_X */ + } + + if (ret < 0) + return MODE_NOMODE; + + total_memory_required = GX1CalculatePitchBytes(pMode->CrtcHDisplay, + pScreenInfo->bitsPerPixel) * + pMode->CrtcVDisplay; + + DEBUGMSG(0, (0, X_NONE, "Total Mem %X %X", + total_memory_required, pGeode->FBSize)); + + if (total_memory_required > pGeode->FBSize) + return MODE_MEM; + + return MODE_OK; +} + +/*---------------------------------------------------------------------------- + * GX1LoadPalette. + * + * Description :This function sets the palette entry used for graphics data + * + * Parameters. + * pScreenInfo:Points the screeninfo structure. + * numColors:Specifies the no of colors it supported. + * indizes :This is used get index value . + * LOCO :to be added. + * pVisual :to be added. + * + * Returns :MODE_OK if the specified mode is supported or + * MODE_NO_INTERLACE. + * Comments :none. +*---------------------------------------------------------------------------- +*/ + +static void +GX1LoadPalette(ScrnInfoPtr pScreenInfo, + int numColors, int *indizes, LOCO * colors, VisualPtr pVisual) +{ + int i, index, color; + + for (i = 0; i < numColors; i++) { + index = indizes[i] & 0xFF; + color = (((unsigned long)(colors[index].red & 0xFF)) << 16) | + (((unsigned long)(colors[index].green & 0xFF)) << 8) | + ((unsigned long)(colors[index].blue & 0xFF)); + DEBUGMSG(0, (0, X_NONE, "GX1LoadPalette: %d %d %X\n", + numColors, index, color)); + + GFX(set_display_palette_entry(index, color)); + } +} + +static Bool +GX1MapMem(ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + +#if defined(STB_X) + pGeode->FBBase = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, + pGeode->FBLinearAddr, + pGeode->FBSize); + +#else + /* SET DURANGO REGISTER POINTERS + * * The method of mapping from a physical address to a linear address + * * is operating system independent. Set variables to linear address. + */ + gfx_virt_regptr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_MMIO, + (unsigned int) + gfx_get_cpu_register_base + (), 0x9000); + gfx_virt_spptr = gfx_virt_regptr; + gfx_virt_vidptr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_MMIO, + (unsigned int) + gfx_get_vid_register_base + (), 0x1000); + pGeode->FBSize = GetVideoMemSize(); + gfx_virt_fbptr = + (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, + pGeode->FBLinearAddr, pGeode->FBSize); + + /* CHECK IF REGISTERS WERE MAPPED SUCCESSFULLY */ + if ((!gfx_virt_regptr) || + (!gfx_virt_spptr) || (!gfx_virt_vidptr) || (!gfx_virt_fbptr)) { + DEBUGMSG(1, (0, X_NONE, "Could not map hardware registers.\n")); + return (FALSE); + } + + /* Map the XpressROM ptr to read what platform are we on */ + XpressROMPtr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, 0xF0000, + 0x10000); + + if (!XpressROMPtr) + return FALSE; + + pGeode->FBBase = gfx_virt_fbptr; +#endif + + return TRUE; +} + +/* + * Unmap the framebuffer and MMIO memory. + */ + +static Bool +GX1UnmapMem(ScrnInfoPtr pScreenInfo) +{ +#if !defined(STB_X) + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + /* unmap all the memory map's */ + xf86UnMapVidMem(pScreenInfo->scrnIndex, gfx_virt_regptr, 0x9000); + xf86UnMapVidMem(pScreenInfo->scrnIndex, gfx_virt_vidptr, 0x1000); + xf86UnMapVidMem(pScreenInfo->scrnIndex, gfx_virt_fbptr, pGeode->FBSize); + xf86UnMapVidMem(pScreenInfo->scrnIndex, XpressROMPtr, 0x10000); +#endif /* STB_X */ + + return TRUE; +} + +/* End of file */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_shadow.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_shadow.c:1.2 --- /dev/null Thu Feb 27 12:31:11 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_shadow.c Tue Jan 14 04:34:32 2003 @@ -0,0 +1,468 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_shadow.c,v 1.2 2003/01/14 09:34:32 alanh Exp $ */ +/* + * $Workfile: nsc_gx1_shadow.c $ + * $Revision: 6 $ + * $Author: Sarma $ + * + * File Contents: Direct graphics display routines are implemented and + * graphics rendering are all done in memory. + * + * Project: Geode Xfree Frame buffer device driver. + * + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "nsc.h" +#include "shadowfb.h" +#include "servermd.h" + +void GX1RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX1PointerMoved(int index, int x, int y); +void GX1RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX1RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX1RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX1RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +/*---------------------------------------------------------------------------- + * GX1RefreshArea. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer. + * Parameters. + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments : none + * +*---------------------------------------------------------------------------- +*/ +void +GX1RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + while (num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = pGeode->ShadowPtr + (pbox->y1 * pGeode->ShadowPitch) + + (pbox->x1 * Bpp); + dst = pGeode->FBBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + while (height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += pGeode->ShadowPitch; + } + + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX1PointerMoved. + * + * Description :This function moves one screen memory from one area to other. + * + * Parameters. + * index :Pointer to screen index. + * x :Specifies the new x co-ordinates of new area. + * y :Specifies the new y co-ordinates of new area. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1PointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + GeodePtr pGeode = GEODEPTR(pScrn); + int newX, newY; + + if (pGeode->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + (*pGeode->PointerMoved) (index, newX, newY); +} + +/*---------------------------------------------------------------------------- + * GX1RefreshArea8. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 8bpp. + * Parameters. + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2, + srcPitch3, srcPitch4; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch; + srcPitch2 = srcPitch * 2; + srcPitch3 = srcPitch * 3; + srcPitch4 = srcPitch * 4; + while (num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if (pGeode->Rotate == 1) { + dstPtr = pGeode->FBBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = pGeode->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = pGeode->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + while (width--) { + src = srcPtr; + dst = (CARD32 *) dstPtr; + count = height; + while (count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch2] << 16) | (src[srcPitch3] << 24); + src += srcPitch4; + } + srcPtr += pGeode->Rotate; + dstPtr += dstPitch; + } + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX1RefreshArea16. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 16bpp. + * Parameters: + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch >> 1; + srcPitch2 = srcPitch * 2; + while (num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + if (pGeode->Rotate == 1) { + dstPtr = (CARD16 *) pGeode->FBBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16 *) pGeode->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16 *) pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16 *) pGeode->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while (width--) { + src = srcPtr; + dst = (CARD32 *) dstPtr; + count = height; + while (count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch2; + } + srcPtr += pGeode->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX1RefreshArea24. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 24bpp. + * Parameters. + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2, srcPitch3; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = BitmapBytePad(pScrn->displayWidth * 24); + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch; + srcPitch2 = srcPitch * 2; + srcPitch3 = srcPitch * 3; + while (num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* blocks of 3 dwords */ + if (pGeode->Rotate == 1) { + dstPtr = pGeode->FBBase + + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); + srcPtr = pGeode->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); + } else { + dstPtr = pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); + srcPtr = pGeode->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; + } + while (width--) { + src = srcPtr; + dst = (CARD32 *) dstPtr; + count = height; + while (count--) { + dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | + (src[srcPitch] << 24); + dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | + (src[srcPitch2] << 16) | (src[srcPitch2 + 1] << 24); + dst[2] = src[srcPitch2 + 2] | (src[srcPitch3] << 8) | + (src[srcPitch3 + 1] << 16) | (src[srcPitch3 + 2] << 24); + dst += 3; + src += srcPitch << 2; + } + srcPtr += pGeode->Rotate * 3; + dstPtr += dstPitch; + } + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX1RefreshArea32. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 32bpp. + * Parameters: + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns : none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, dstPitch, srcPitch; + CARD32 *dstPtr, *srcPtr, *src, *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch >> 2; + while (num--) { + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + + if (pGeode->Rotate == 1) { + dstPtr = (CARD32 *) pGeode->FBBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; + srcPtr = (CARD32 *) pGeode->ShadowPtr + + ((1 - pbox->y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD32 *) pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; + srcPtr = (CARD32 *) pGeode->ShadowPtr + + (pbox->y1 * srcPitch) + pbox->x2 - 1; + } + while (width--) { + src = srcPtr; + dst = dstPtr; + count = height; + while (count--) { + *(dst++) = *src; + src += srcPitch; + } + srcPtr += pGeode->Rotate; + dstPtr += dstPitch; + } + pbox++; + } +} + +/* End of file */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_video.c:1.6 --- /dev/null Thu Feb 27 12:31:11 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_video.c Fri Feb 21 11:51:09 2003 @@ -0,0 +1,1629 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_video.c,v 1.6 2003/02/21 16:51:09 alanh Exp $ */ +/* + * $Workfile: nsc_gx1_video.c $ + * $Revision: 11 $ + * $Author: Binesh $ + * + * File Contents: This file consists of main Xfree video supported routines. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* + * Fixes & Extensions to support Y800 greyscale modes + * Alan Hourihane <alanh@fairlite.demon.co.uk> + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "nsc.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" +#include "nsc_fourcc.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) +#define XV_PROFILE 0 +#define REINIT 1 + +void GX1InitVideo(ScreenPtr pScreen); +void GX1ResetVideo(ScrnInfoPtr pScrn); + +#ifndef XvExtension +void +GX1InitVideo(ScreenPtr pScreen) +{ +} + +void +GX1ResetVideo(ScrnInfoPtr pScrn) +{ +} +#else + +#define DBUF 0 + +static XF86VideoAdaptorPtr GX1SetupImageVideo(ScreenPtr); +static void GX1InitOffscreenImages(ScreenPtr); +static void GX1StopVideo(ScrnInfoPtr, pointer, Bool); +static int GX1SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int GX1GetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); +static void GX1QueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, + unsigned int *, pointer); +static int GX1PutImage(ScrnInfoPtr, + short, short, short, short, short, short, + short, short, int, unsigned char *, short, short, + Bool, RegionPtr, pointer); +static int GX1QueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, + int *, int *); + +static void GX1BlockHandler(int, pointer, pointer, pointer); + +void GX1SetVideoPosition(int, int, int, int, + short, short, short, short, int, int, ScrnInfoPtr); + +extern void GX1AccelSync(ScrnInfoPtr pScreenInfo); + +#if !defined(STB_X) +extern int DeltaX, DeltaY; +#else +int DeltaX, DeltaY; +#endif + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvColorKey, xvColorKeyMode, xvFilter +#if DBUF + , xvDoubleBuffer +#endif + ; + +/*---------------------------------------------------------------------------- + * GX1InitVideo + * + * Description :This is the initialization routine.It creates a new video adapter + * and calls GX1SetupImageVideo to initialize the adaptor by filling + * XF86VideoAdaptorREc.Then it lists the existing adaptors and adds the + * new one to it. Finally the list of XF86VideoAdaptorPtr pointers are + * passed to the xf86XVScreenInit(). + * + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX1InitVideo(ScreenPtr pScreen) +{ + GeodePtr pGeode; + + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + + pGeode = GEODEPTR(pScreenInfo); + + if (!pGeode->NoAccel) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + + int num_adaptors; + + DEBUGMSG(0, (0, X_NONE, "InitVideo\n")); + newAdaptor = GX1SetupImageVideo(pScreen); + GX1InitOffscreenImages(pScreen); + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if (newAdaptor) { + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *)); + if (newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if (num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); + } +} + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = { + { + 0, + "XV_IMAGE", + 1024, 1024, + {1, 1} + } +}; + +#define NUM_FORMATS 4 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = { + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#if DBUF +#define NUM_ATTRIBUTES 4 +#else +#define NUM_ATTRIBUTES 3 +#endif + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { +#if DBUF + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, +#endif + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER"}, + {XvSettable | XvGettable, 0, 1, "XV_COLORKEYMODE"} +}; + +#define NUM_IMAGES 7 + +static XF86ImageRec Images[NUM_IMAGES] = { + XVIMAGE_UYVY, + XVIMAGE_YUY2, + XVIMAGE_Y2YU, + XVIMAGE_YVYU, + XVIMAGE_Y800, + XVIMAGE_I420, + XVIMAGE_YV12 +}; + +typedef struct +{ + FBAreaPtr area; + FBLinearPtr linear; + RegionRec clip; + CARD32 colorKey; + CARD32 colorKeyMode; + CARD32 filter; + CARD32 videoStatus; + Time offTime; + Time freeTime; +#if DBUF + Bool doubleBuffer; + int currentBuffer; +#endif +} +GeodePortPrivRec, *GeodePortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (GeodePortPrivPtr)((GEODEPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +/*---------------------------------------------------------------------------- + * GX1SetColorKey + * + * Description :This function reads the color key for the pallete and + * sets the video color key register. + * + * Parameters. + * ScreenInfoPtr + * pScrn :Screen pointer having screen information. + * pPriv :Video port private data + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static INT32 +GX1SetColorkey(ScrnInfoPtr pScrn, GeodePortPrivPtr pPriv) +{ + int red, green, blue; + unsigned long key; + + DEBUGMSG(0, (0, X_NONE, "ColorKey\n")); + switch (pScrn->depth) { + case 8: + GFX(get_display_palette_entry(pPriv->colorKey & 0xFF, &key)); + red = ((key >> 16) & 0xFF); + green = ((key >> 8) & 0xFF); + blue = (key & 0xFF); + break; + default: + red = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red << (8 - + pScrn-> + weight. + red); + green = + (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset. + green << (8 - pScrn->weight.green); + blue = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset. + blue << (8 - pScrn->weight.blue); + break; + } + GFX(set_video_color_key((blue | (green << 8) | (red << 16)), 0xFCFCFC, + (pPriv->colorKeyMode == 0))); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + return 0; +} + +/*---------------------------------------------------------------------------- + * GX1ResetVideo + * + * Description : This function resets the video + * + * Parameters. + * ScreenInfoPtr + * pScrn :Screen pointer having screen information. + * + * Returns :None + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ + +void +GX1ResetVideo(ScrnInfoPtr pScrn) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + if (!pGeode->NoAccel) { + GeodePortPrivPtr pPriv = pGeode->adaptor->pPortPrivates[0].ptr; + + DEBUGMSG(0, (0, X_NONE, "ResetVideo\n")); + GX1AccelSync(pScrn); + GFX(set_video_palette(NULL)); + GX1SetColorkey(pScrn, pPriv); + GFX(set_video_filter(pPriv->filter, pPriv->filter)); + } +} + +/*---------------------------------------------------------------------------- + * GX1SetupImageVideo + * + * Description : This function allocates space for a Videoadaptor and initializes + * the XF86VideoAdaptorPtr record. + * + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns :XF86VideoAdaptorPtr :- pointer to the initialized video adaptor record. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ + +static XF86VideoAdaptorPtr +GX1SetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GeodePtr pGeode = GEODEPTR(pScrn); + XF86VideoAdaptorPtr adapt; + GeodePortPrivPtr pPriv; + + DEBUGMSG(0, (0, X_NONE, "SetupImageVideo\n")); + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(GeodePortPrivRec) + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "National Semiconductor Corporation"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + pPriv = (GeodePortPrivPtr) (&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer) (pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = GX1StopVideo; + adapt->SetPortAttribute = GX1SetPortAttribute; + adapt->GetPortAttribute = GX1GetPortAttribute; + adapt->QueryBestSize = GX1QueryBestSize; + adapt->PutImage = GX1PutImage; + adapt->QueryImageAttributes = GX1QueryImageAttributes; + + pPriv->colorKey = pGeode->videoKey; + pPriv->colorKeyMode = 0; + pPriv->filter = 0; + pPriv->videoStatus = 0; +#if DBUF + pPriv->doubleBuffer = TRUE; + pPriv->currentBuffer = 0; /* init to first buffer */ +#endif + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pGeode->adaptor = adapt; + + pGeode->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = GX1BlockHandler; + + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvColorKeyMode = MAKE_ATOM("XV_COLORKEYMODE"); + xvFilter = MAKE_ATOM("XV_FILTER"); +#if DBUF + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); +#endif + + GX1ResetVideo(pScrn); + + return adapt; +} + +#if REINIT +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) + return FALSE; + + if ((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int *)REGION_RECTS(A); + dataB = (int *)REGION_RECTS(B); + + while (num--) { + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} +#endif + +/*---------------------------------------------------------------------------- + * GX1StopVideo + * + * Description :This function is used to stop input and output video + * + * Parameters. + * pScreenInfo + * pScrn :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * exit :Flag indicating whether the offscreen areas used for video + * to be deallocated or not. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static void +GX1StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + GeodePtr pGeode = GEODEPTR(pScrn); + + DEBUGMSG(0, (0, X_NONE, "StopVideo\n")); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + GX1AccelSync(pScrn); + if (exit) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + GFX(set_video_enable(0)); + } + if (pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + pPriv->videoStatus = 0; + pGeode->OverlayON = FALSE; + } else { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + +/*---------------------------------------------------------------------------- + * GX1SetPortAttribute + * + * Description :This function is used to set the attributes of a port like colorkeymode, + * double buffer support and filter. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * attribute :The port attribute to be set + * value :Value of the attribute to be set. + * + * Returns :Sucess if the attribute is supported, else BadMatch + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static int +GX1SetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + + GX1AccelSync(pScrn); + if (attribute == xvColorKey) { + pPriv->colorKey = value; + GX1SetColorkey(pScrn, pPriv); + } +#if DBUF + else if (attribute == xvDoubleBuffer) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } +#endif + else if (attribute == xvColorKeyMode) { + pPriv->colorKeyMode = value; + GX1SetColorkey(pScrn, pPriv); + } else if (attribute == xvFilter) { + pPriv->filter = value; + GFX(set_video_filter(pPriv->filter, pPriv->filter)); + } else + return BadMatch; + + return Success; +} + +/*---------------------------------------------------------------------------- + * GX1GetPortAttribute + * + * Description :This function is used to get the attributes of a port like hue, + * saturation,brightness or contrast. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * attribute :The port attribute to be read + * value :Pointer to the value of the attribute to be read. + * + * Returns :Sucess if the attribute is supported, else BadMatch + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static int +GX1GetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 * value, pointer data) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + + if (attribute == xvColorKey) { + *value = pPriv->colorKey; + } +#if DBUF + else if (attribute == xvDoubleBuffer) { + *value = (pPriv->doubleBuffer) ? 1 : 0; + } +#endif + else if (attribute == xvColorKeyMode) { + *value = pPriv->colorKeyMode; + } else if (attribute == xvFilter) { + *value = pPriv->filter; + } else + return BadMatch; + + return Success; +} + +/*---------------------------------------------------------------------------- + * GX1QueryBestSize + * + * Description :This function provides a way to query what the destination dimensions + * would end up being if they were to request that an area vid_w by vid_h + * from the video stream be scaled to rectangle of drw_w by drw_h on + * the screen. + * + * Parameters. + * ScreenInfoPtr + * pScrn :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * vid_w,vid_h :Width and height of the video data. + * drw_w,drw_h :Width and height of the scaled rectangle. + * p_w,p_h :Width and height of the destination rectangle. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ +static void +GX1QueryBestSize(ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ + DEBUGMSG(0, (0, X_NONE, "QueryBestSize\n")); + *p_w = drw_w; + *p_h = drw_h; + + if (*p_w > 16384) + *p_w = 16384; +} +static void +GX1CopyGreyscale(unsigned char *src, + unsigned char *dst, int srcPitch, int dstPitch, int h, int w) +{ + int i; + unsigned char *src2 = src; + unsigned char *dst2 = dst; + unsigned char *dst3; + unsigned char *src3; + + dstPitch <<= 1; + + while (h--) { + dst3 = dst2; + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + dst2 += dstPitch; + src2 += srcPitch; + } +} + +/*---------------------------------------------------------------------------- + * GX1CopyData + * + * Description : Copies data from src to destination + * + * Parameters. + * src : pointer to the source data + * dst : pointer to destination data + * srcPitch : pitch of the srcdata + * dstPitch : pitch of the destination data + * h & w : height and width of source data + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static void +GX1CopyData(unsigned char *src, unsigned char *dst, + int srcPitch, int dstPitch, int h, int w) +{ + w <<= 1; + while (h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +static void +GX1CopyMungedData(unsigned char *src1, + unsigned char *src2, + unsigned char *src3, + unsigned char *dst1, + int srcPitch, int srcPitch2, int dstPitch, int h, int w) +{ + CARD32 *dstCur = (CARD32 *) dst1; + CARD32 *dstNext = (CARD32 *) dst1; + int i, j, k, m, n; + CARD32 crcb; + +#if XV_PROFILE + long oldtime, newtime; +#endif + + DEBUGMSG(0, (0, X_NONE, "CopyMungedData\n")); + /* dstPitch is in byte count, but we write longs. + * so divide dstpitch by 4 + */ + dstPitch >>= 2; + /* Width is in byte but video data is 16bit + */ + w >>= 1; + /* We render 2 scanlines at one shot, handle the odd count */ + m = h & 1; + /* decrement the height since we write 2 scans */ + h -= 1; + /* we traverse by 2 bytes in src Y */ + srcPitch <<= 1; +#if XV_PROFILE + UpdateCurrentTime(); + oldtime = currentTime.milliseconds; +#endif + + for (j = 0; j < h; j += 2) { + /* calc the next dest scan start */ + dstNext = dstCur + dstPitch; + for (i = 0; i < w; i++) { + /* crcb is same for the x pixel for 2 scans */ + crcb = (src3[i] << 8) | (src2[i] << 24); + + n = i << 1; + + /* write the first scan pixel DWORD */ + dstCur[i] = src1[n] | (src1[n + 1] << 16) | crcb; + + /* calc the offset of next pixel */ + k = n + srcPitch; + + /* write the 2nd scan pixel DWORD */ + dstNext[i] = src1[k] | (src1[k + 1] << 16) | crcb; + } + /* increment the offsets */ + + /* Y */ + src1 += srcPitch; + /* crcb */ + src2 += srcPitch2; + src3 += srcPitch2; + /* processed dest */ + dstCur += (dstPitch << 1); + } + + /* if any scans remaining */ + if (m) { + for (i = 0, k = 0; i < w; i++, k += 2) { + dstCur[i] = src1[k] | (src1[k + 1] << 16) | + (src3[i] << 8) | (src2[i] << 24); + } + } +#if XV_PROFILE + UpdateCurrentTime(); + newtime = currentTime.milliseconds; + DEBUGMSG(1, (0, X_NONE, "CMD %d\n", newtime - oldtime)); +#endif +} + +static FBAreaPtr +GX1AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, int numlines) +{ + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + FBAreaPtr new_area; + + if (area) { + if ((area->box.y2 - area->box.y1) >= numlines) + return area; + + if (xf86ResizeOffscreenArea(area, pScrn->displayWidth, numlines)) + return area; + + xf86FreeOffscreenArea(area); + } + + new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + numlines, 0, NULL, NULL, NULL); + + if (!new_area) { + int max_w, max_h; + + xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0, + FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME); + + if ((max_w < pScrn->displayWidth) || (max_h < numlines)) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + numlines, 0, NULL, NULL, NULL); + } + return new_area; +} + +static BoxRec dstBox; +static int srcPitch = 0, srcPitch2 = 0, dstPitch = 0; +static INT32 Bx1, Bx2, By1, By2; +static int top, left, npixels, nlines; +static int offset, s1offset = 0, s2offset = 0, s3offset = 0; +static unsigned char *dst_start; +static int TVOverScanX; + +static Bool +RegionsIntersect(BoxPtr pRcl1, BoxPtr pRcl2, BoxPtr pRclResult) +{ + pRclResult->x1 = max(pRcl1->x1, pRcl2->x1); + pRclResult->x2 = min(pRcl1->x2, pRcl2->x2); + + if (pRclResult->x1 <= pRclResult->x2) { + pRclResult->y1 = max(pRcl1->y1, pRcl2->y1); + pRclResult->y2 = min(pRcl1->y2, pRcl2->y2); + + if (pRclResult->y1 <= pRclResult->y2) { + return (TRUE); + } + } + + return (FALSE); +} + +void +GX1SetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, short drw_h, + int id, int offset, ScrnInfoPtr pScrn) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + long xstart, ystart, xend, yend; + unsigned long lines = 0; + unsigned long y_extra = 0; + unsigned short crop = 0; + BoxRec ovly, display, result; + +#if defined(STB_X) + unsigned long startAddress = 0; +#endif + xend = x + drw_w; + yend = y + drw_h; + + /* Take care of panning when panel is present */ + +#if defined(STB_X) + Gal_get_display_offset(&startAddress); + DeltaY = startAddress / pGeode->Pitch; + DeltaX = startAddress & (pGeode->Pitch - 1); + DeltaX /= (pScrn->bitsPerPixel >> 3); +#endif + + if (pGeode->Panel) { + ovly.x1 = x; + ovly.x2 = x + pGeode->video_dstw; + ovly.y1 = y; + ovly.y2 = y + pGeode->video_dsth; + + display.x1 = DeltaX; + display.x2 = DeltaX + pGeode->FPBX; + display.y1 = DeltaY; + display.y2 = DeltaY + pGeode->FPBY; + + x = xend = 0; + + if (RegionsIntersect(&display, &ovly, &result)) { + x = ovly.x1 - DeltaX; + xend = ovly.x2 - DeltaX; + y = ovly.y1 - DeltaY; + yend = ovly.y2 - DeltaY; + } + } + + /* LEFT CLIPPING */ + + if (x < 0) { + if (TVOverScanX) + xstart = TVOverScanX; + else + xstart = 0; + } else { + if (TVOverScanX) + xstart = TVOverScanX; + else + xstart = (unsigned long)x; + } + drw_w -= (xstart - x); + + /* TOP CLIPPING */ + + if (y < 0) { + lines = (-y) * src_h / drw_h; + ystart = 0; + drw_h += y; + y_extra = lines * dstPitch; + } else { + ystart = y; + lines = 0; + y_extra = 0; + } + + /* CLIP RIGHT AND BOTTOM FOR TV OVER SCAN */ + if (pGeode->TV_Overscan_On) { + crop = (pGeode->TVOw + pGeode->TVOx); + if ((xstart + drw_w) > crop) + xend = crop; + crop = (pGeode->TVOh + pGeode->TVOy); + if ((ystart + drw_h) > crop) + yend = crop; + } + GFX(set_video_window(xstart, ystart, xend - xstart, yend - ystart)); + GFX(set_video_offset(offset + y_extra)); + GFX(set_video_left_crop(xstart - x)); + +} + +/*---------------------------------------------------------------------------- + * GX1DisplayVideo + * + * Description : This function sets up the video registers for playing video + * It sets up the video format,width, height & position of the + * video window ,video offsets( y,u,v) and video pitches(y,u,v) + * Parameters. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static void +GX1DisplayVideo(ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, short drw_w, short drw_h) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + /* DisplayModePtr mode = pScrn->currentMode; */ + GX1AccelSync(pScrn); + + GFX(set_video_enable(1)); + + switch (id) { + case FOURCC_UYVY: /* UYVY */ + GFX(set_video_format(VIDEO_FORMAT_UYVY)); + break; + case FOURCC_Y800: /* Y800 - greyscale - we munge it! */ + case FOURCC_YV12: + case FOURCC_I420: + case FOURCC_YUY2: /* YUY2 */ + GFX(set_video_format(VIDEO_FORMAT_YUYV)); + break; + case FOURCC_Y2YU: /* Y2YU */ + GFX(set_video_format(VIDEO_FORMAT_Y2YU)); + break; + case FOURCC_YVYU: /* YVYU */ + GFX(set_video_format(VIDEO_FORMAT_YVYU)); + break; + } + + if (pGeode->TV_Overscan_On) { + if (dstBox->x1 < 0) + TVOverScanX = pGeode->TVOx; + else + TVOverScanX = 0; + dstBox->x1 += pGeode->TVOx; + dstBox->y1 += pGeode->TVOy; + } + if (pGeode->Panel) { + pGeode->video_x = dstBox->x1; + pGeode->video_y = dstBox->y1; + pGeode->video_w = width; + pGeode->video_h = height; + pGeode->video_srcw = src_w; + pGeode->video_srch = src_h; + pGeode->video_dstw = drw_w; + pGeode->video_dsth = drw_h; + pGeode->video_offset = offset; + pGeode->video_id = id; + pGeode->video_scrnptr = pScrn; + } + + GFX(set_video_size(width, height)); + GFX(set_video_scale(width, height, drw_w, drw_h)); + GX1SetVideoPosition(dstBox->x1, dstBox->y1, width, height, src_w, src_h, + drw_w, drw_h, id, offset, pScrn); + GFX(set_color_space_YUV(0)); +} + +/*---------------------------------------------------------------------------- + * GX1PutImage : This function writes a single frame of video into a drawable. + * The position and size of the source rectangle is specified by src_x,src_y, + * src_w and src_h. This data is stored in a system memory buffer at buf. + * The position and size of the destination rectangle is specified by drw_x, + * drw_y,drw_w,drw_h.The data is in the format indicated by the image descriptor + * and represents a source of size width by height. If sync is TRUE the driver + * should not return from this function until it is through reading the data from + * buf. Returning when sync is TRUE indicates that it is safe for the data at buf + * to be replaced,freed, or modified. + * + * + * Description : + * Parameters. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static int +GX1PutImage(ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char *buf, + short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + GeodePtr pGeode = GEODEPTR(pScrn); + int pitch, new_h; + +#if REINIT + BOOL ReInitVideo = FALSE; +#endif + +#if XV_PROFILE + long oldtime, newtime; + + UpdateCurrentTime(); + oldtime = currentTime.milliseconds; +#endif + +#if REINIT +/* update cliplist */ + if (!RegionsEqual(&pPriv->clip, clipBoxes)) { + ReInitVideo = TRUE; + } + if (ReInitVideo) { + DEBUGMSG(1, (0, X_NONE, "Regional Not Equal - Init\n")); +#endif + + if (drw_w > 16384) + drw_w = 16384; + + /* Clip */ + Bx1 = src_x; + Bx2 = src_x + src_w; + By1 = src_y; + By2 = src_y + src_h; + + if ((Bx1 >= Bx2) || (By1 >= By2)) + return Success; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + pitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; + + dstPitch = ((width << 1) + 3) & ~3; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; /* of luma */ + s2offset = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + srcPitch = (width << 1); + break; + } + + /* Find how many pitch scanlines required to store the data */ + new_h = ((dstPitch * height) + pitch - 1) / pitch; + +#if DBUF + if (pPriv->doubleBuffer) + new_h <<= 1; +#endif + + if (!(pPriv->area = GX1AllocateMemory(pScrn, pPriv->area, new_h))) + return BadAlloc; + + /* copy data */ + top = By1; + left = Bx1 & ~1; + npixels = ((Bx2 + 1) & ~1) - left; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + { + int tmp; + + top &= ~1; + offset = (pPriv->area->box.y1 * pitch) + (top * dstPitch); + +#if DBUF + if (pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_h >> 1) * pitch; +#endif + + dst_start = pGeode->FBBase + offset + left; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if (id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((By2 + 1) & ~1) - top; + } + break; + + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = By2 - top; + offset = (pPriv->area->box.y1 * pitch) + (top * dstPitch); + +#if DBUF + if (pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_h >> 1) * pitch; +#endif + + dst_start = pGeode->FBBase + offset + left; + break; + } + s1offset = (top * srcPitch) + left; + +#if REINIT + /* update cliplist */ + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if (pPriv->colorKeyMode == 0) { + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + GX1DisplayVideo(pScrn, id, offset, width, height, dstPitch, + Bx1, By1, Bx2, By2, &dstBox, src_w, src_h, drw_w, + drw_h); + } +#endif + + switch (id) { + + case FOURCC_Y800: + GX1CopyGreyscale(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + case FOURCC_YV12: + case FOURCC_I420: + GX1CopyMungedData(buf + s1offset, buf + s2offset, + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + GX1CopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } +#if !REINIT + /* update cliplist */ + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if (pPriv->colorKeyMode == 0) { + /* draw these */ + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); + } + GX1DisplayVideo(pScrn, id, offset, width, height, dstPitch, + Bx1, By1, Bx2, By2, &dstBox, src_w, src_h, drw_w, drw_h); +#endif + +#if XV_PROFILE + UpdateCurrentTime(); + newtime = currentTime.milliseconds; + DEBUGMSG(1, (0, X_NONE, "PI %d\n", newtime - oldtime)); +#endif + +#if DBUF + pPriv->currentBuffer ^= 1; +#endif + + pPriv->videoStatus = CLIENT_VIDEO_ON; + pGeode->OverlayON = TRUE; + return Success; +} + +/*---------------------------------------------------------------------------- + * GX1QueryImageAttributes + * + * Description :This function is called to let the driver specify how data + * for a particular image of size width by height should be + * stored. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * id :Id for the video format + * width :width of the image (can be modified by the driver) + * height :height of the image (can be modified by the driver) + * Returns : Size of the memory required for storing this image + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ +static int +GX1QueryImageAttributes(ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + int size; + int tmp; + + DEBUGMSG(0, (0, X_NONE, "QueryImageAttributes %X\n", id)); + + if (*w > 1024) + *w = 1024; + if (*h > 1024) + *h = 1024; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + return size; +} + +static void +GX1BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + GeodePtr pGeode = GEODEPTR(pScrn); + GeodePortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + DEBUGMSG(0, (0, X_NONE, "BlockHandler\n")); + pScreen->BlockHandler = pGeode->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = GX1BlockHandler; + + GX1AccelSync(pScrn); + if (pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if (pPriv->videoStatus & OFF_TIMER) { + if (pPriv->offTime < currentTime.milliseconds) { + GFX(set_video_enable(0)); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if (pPriv->freeTime < currentTime.milliseconds) { + if (pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + pPriv->videoStatus = 0; + } + } + } +} + +/****************** Offscreen stuff ***************/ + +typedef struct +{ + FBAreaPtr area; + FBLinearPtr linear; + Bool isOn; +} +OffscreenPrivRec, *OffscreenPrivPtr; + +/*---------------------------------------------------------------------------- + * GX1AllocateSurface + * + * Description :This function allocates an area of w by h in the offscreen + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static int +GX1AllocateSurface(ScrnInfoPtr pScrn, + int id, + unsigned short w, unsigned short h, XF86SurfacePtr surface) +{ + FBAreaPtr area; + int pitch, fbpitch, numlines; + OffscreenPrivPtr pPriv; + + DEBUGMSG(0, (0, X_NONE, "AllocateSurface %x\n", id)); + if ((w > 1024) || (h > 1024)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + fbpitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; + numlines = ((pitch * h) + fbpitch - 1) / fbpitch; + + if (!(area = GX1AllocateMemory(pScrn, NULL, numlines))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if (!(surface->pitches = xalloc(sizeof(int)))) + return BadAlloc; + if (!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + return BadAlloc; + } + if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + return BadAlloc; + } + + pPriv->area = area; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = area->box.y1 * fbpitch; + surface->devPrivate.ptr = (pointer) pPriv; + + return Success; +} + +static int +GX1StopSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + + if (pPriv->isOn) { + pPriv->isOn = FALSE; + } + + return Success; +} + +static int +GX1FreeSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + + DEBUGMSG(0, (0, X_NONE, "FreeSurface\n")); + + if (pPriv->isOn) + GX1StopSurface(surface); + xf86FreeOffscreenArea(pPriv->area); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +GX1GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value) +{ + return GX1GetPortAttribute(pScrn, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrn))); +} + +static int +GX1SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value) +{ + return GX1SetPortAttribute(pScrn, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrn))); +} + +static int +GX1DisplaySurface(XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, RegionPtr clipBoxes) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + GeodePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn); + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + DEBUGMSG(0, (0, X_NONE, "DisplaySuface\n")); + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if ((x1 >= x2) || (y1 >= y2)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); + + GX1DisplayVideo(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->isOn = TRUE; + if (portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + + return Success; +} + +/*---------------------------------------------------------------------------- + * GX1InitOffscreenImages + * + * Description :This function sets up the offscreen memory management.It fills + * in the XF86OffscreenImagePtr structure with functions to handle + * offscreen memory operations. + * + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns : None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ +static void +GX1InitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + + DEBUGMSG(0, (0, X_NONE, "InitOffscreenImages\n")); + /* need to free this someplace */ + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = GX1AllocateSurface; + offscreenImages[0].free_surface = GX1FreeSurface; + offscreenImages[0].display = GX1DisplaySurface; + offscreenImages[0].stop = GX1StopSurface; + offscreenImages[0].setAttribute = GX1SetSurfaceAttribute; + offscreenImages[0].getAttribute = GX1GetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + +#endif /* !XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_accel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_accel.c:1.4 --- /dev/null Thu Feb 27 12:31:11 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_accel.c Fri Feb 21 11:51:09 2003 @@ -0,0 +1,2302 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_accel.c,v 1.4 2003/02/21 16:51:09 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_accel.c $ + * $Revision: 12 $ + * $Author: Sarma $ + * + * File Contents: This file is consists of main Xfree + * acceleration supported routines like solid fill used + * here. + * Project: Geode Xfree Frame buffer device driver. + * + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* Xfree86 header files */ +#include "vgaHW.h" +#include "xf86.h" +#include "xf86_ansic.h" +#include "xaalocal.h" +#include "xf86fbman.h" +#include "miline.h" +#include "xf86_libc.h" +#include "xaarop.h" +#include "nsc.h" + +#define DASHED_SUPPORT 0 +#define IMGWRITE_SUPPORT 0 +#define SCR2SCREXP 0 + +/* STATIC VARIABLES FOR THIS FILE + * Used to maintain state between setup and rendering calls. + */ + +static int GeodeTransparent; +static int GeodeTransColor; +static int Geodedstx; +static int Geodedsty; +static int Geodesrcx; +static int Geodesrcy; +static int Geodewidth; +static int Geodeheight; +static int Geodebpp; +static int GeodeCounter; + +#if !defined(STB_X) +static unsigned int GeodeROP = 0; +static unsigned short Geode_blt_mode = 0; +static unsigned short Geode_vector_mode = 0; +#endif +static unsigned int gu2_xshift = 1; +static unsigned int gu2_yshift = 1; +static unsigned int gu2_bpp = 1; +static unsigned int SetCPUToScreen = 0; +static unsigned int SetImageWriteRect = 0; +static unsigned int ImgBufOffset; + +#define GU2_WAIT_PENDING while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) +#define GU2_WAIT_BUSY while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) + +#define CALC_FBOFFSET(_SrcX, _SrcY) \ + (((unsigned int) (_SrcY) << gu2_yshift) |\ + (((unsigned int) (_SrcX)) << gu2_xshift)) + +#define GFX_PATTERN_FILL(_SrcX, _SrcY, _Width, _Height) \ +{ \ + GU2_WAIT_PENDING;\ + WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET((_SrcX), (_SrcY)));\ + WRITE_GP32(MGP_WID_HEIGHT, \ + (((unsigned int) (_Width)) << 16) | (_Height));\ + WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode);\ +} + +static XAAInfoRecPtr localRecPtr; + +Bool GX2AccelInit(ScreenPtr pScreen); +void GX2AccelSync(ScrnInfoPtr pScreenInfo); +void GX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void GX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, + int w, int h); +void GX2SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, + int rop, unsigned int planemask, + int trans_color); +void GX2Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int x, + int y, int w, int h); +void GX2SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, int patternx, + int patterny, int fg, int bg, int rop, + unsigned int planemask); +void GX2Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, int patternx, + int patterny, int x, int y, int w, + int h); +void GX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int xdir, + int ydir, int rop, unsigned int planemask, + int transparency_color); +void GX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int x1, int y1, + int x2, int y2, int w, int h); +void GX2SetupForSolidLine(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void GX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern); +void GX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1, + int absmaj, int absmin, int err, int len, + int octant); +void GX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, int x0, int y0, + int x1, int y1, int flags); +void GX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y, int len, + int dir); + +void GX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, + int depth); + +void GX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft); + +void GX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno); +void GX2FillCacheBltRects(ScrnInfoPtr pScrn, int rop, unsigned int planemask, + int nBox, BoxPtr pBox, int xorg, int yorg, + XAACacheInfoPtr pCache); +void GX2SetupForImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth); +void GX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, int skipleft); +void GX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int fg, int bg, int rop, + unsigned int planemask); +void GX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft); +void OPTGX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void OPTGX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, + int w, int h); +void OPTGX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int xdir, + int ydir, int rop, + unsigned int planemask, + int transparency_color); +void OPTGX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int x1, + int y1, int x2, int y2, int w, int h); +void OPTGX2SetupForSolidLine(ScrnInfoPtr pScreenInfo, int color, int rop, + unsigned int planemask); +void OPTGX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern); +void OPTGX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1, + int absmaj, int absmin, int err, int len, + int octant); +void OPTGX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, + int flags); +void OPTGX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y, + int len, int dir); + +void OPTGX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, + int depth); + +void OPTGX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft); + +void OPTGX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno); +void OPTGX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int fg, int bg, int rop, + unsigned int planemask); +void OPTGX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft); +void OPTGX2SetupForImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth); +void OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, int skipleft); + +/*---------------------------------------------------------------------------- + * GX2AccelSync. + * + * Description :This function is called to syncronize with the graphics + * engine and it waits the graphic engine is idle.This is + * required before allowing direct access to the + * framebuffer. + * Parameters. + * pScreenInfo:Screeen info pointer structure. + * + * Returns :none + * + * Comments :This function is called on geode_video routines. +*---------------------------------------------------------------------------- +*/ +void +GX2AccelSync(ScrnInfoPtr pScreenInfo) +{ + if (SetCPUToScreen) { +#if defined(OPT_ACCEL) + WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode | + MGP_BM_SRC_FB | MGP_BM_SRC_MONO); +#else + GFX(mono_bitmap_to_screen_blt(0, 0, Geodedstx, Geodedsty, + Geodewidth, Geodeheight, + localRecPtr->ColorExpandBase, + ((Geodewidth + 31) >> 5) << 2)); +#endif + + SetCPUToScreen = 0; + } +#if IMGWRITE_SUPPORT + if (SetImageWriteRect) { + unsigned long srcpitch; + +#if defined(OPT_ACCEL) + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + srcpitch = ((Geodewidth << gu2_xshift) + 3) & 0xFFFFFFFC; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_STRIDE, (srcpitch << 16) | pGeode->Pitch); + WRITE_GP32(MGP_SRC_OFFSET, ImgBufOffset); + WRITE_GP32(MGP_DST_OFFSET, + (CALC_FBOFFSET(Geodedstx, Geodedsty)) & 0x00FFFFFF); + WRITE_GP32(MGP_WID_HEIGHT, + ((unsigned long)Geodewidth << 16) | (unsigned long) + Geodeheight); +/* + ErrorF("%d %d, %d\n", Geodewidth, Geodeheight, gu2_xshift); + ErrorF("%X , %X %X %X %X\n", srcpitch, ((srcpitch << 16) | + pGeode->Pitch), ImgBufOffset, + (CALC_FBOFFSET(Geodedstx, Geodedsty)) & 0x00FFFFFF, + ((unsigned long)Geodewidth << 16) | + (unsigned long)Geodeheight); +*/ + WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode); +#else + srcpitch = ((Geodewidth << gu2_xshift) + 3) & 0xFFFFFFFC; + GFX2(set_source_stride(srcpitch)); + GFX2(screen_to_screen_blt(ImgBufOffset, + CALC_FBOFFSET(Geodedstx, Geodedsty), + Geodewidth, Geodeheight, 0)); +#endif + SetImageWriteRect = 0; + } +#endif /* IMGWRITE_SUPPORT */ + + GFX(wait_until_idle()); +} + +/*---------------------------------------------------------------------------- + * GX2SetupForFillRectSolid. + * + * Description :This routine is called to setup the solid pattern + * color for future rectangular fills or vectors. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * color :Specifies the color to be filled up in defined area. + * rop :Specifies the raster operation value. + * planemask :Specifies the masking value based rop srcdata. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + GFX(set_solid_pattern((unsigned int)color)); + + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + GFX(set_solid_source((unsigned int)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + + /*---------------------------------------------------------------------------- + * GX2SubsequentFillRectSolid. + * + * Description :This routine is used to fill the rectangle of previously + * specified solid pattern. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x and y :Specifies the x and y co-ordinatesarea. + * w and h :Specifies width and height respectively. + * + * Returns :none + * + * Comments :desired pattern can be set before this function by + * gfx_set_solid_pattern. + * Sample application uses: + * - Window backgrounds. + * - x11perf: rectangle tests (-rect500). + * - x11perf: fill trapezoid tests (-trap100). + * - x11perf: horizontal line segments (-hseg500). + *---------------------------------------------------------------------------- +*/ +void +GX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, int w, + int h) +{ + DEBUGMSG(0, (0, 0, "FillRect %d %d %dx%d\n", x, y, w, h)); + + /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */ + + GFX(pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)w, (unsigned short)h)); +} + +/*---------------------------------------------------------------------------- + * GX2SetupFor8x8PatternColorExpand + * + * Description :This routine is called to fill the color pattern of + * 8x8. + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * planemask :Specifies the value of masking from rop data + * trans_color :to be added. + * Returns :none. + * + * Comments :none. + * +*---------------------------------------------------------------------------- +*/ + +void +GX2SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int rop, + unsigned int planemask, int trans_color) +{ + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + GFX(set_solid_source((unsigned int)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + +/*---------------------------------------------------------------------------- + * GX2Subsequent8x8PatternColorExpand + * + * Description :This routine is called to fill a rectangle with the + * color pattern of previously loaded pattern. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * x :x -coordinates of the destination rectangle + * y :y-co-ordinates of the destination rectangle + * w :Specifies width of the rectangle + * h :Height of the window of the rectangle + * + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses: + * - Patterned desktops + * - x11perf: stippled rectangle tests (-srect500). + * - x11perf: opaque stippled rectangle tests (-osrect500). +*---------------------------------------------------------------------------- +*/ +void +GX2Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int x, int y, + int w, int h) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + DEBUGMSG(1, (0, 0, "8x8color %d %d %dx%d\n", x, y, w, h)); + + /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */ + /* Ignores specified pattern. */ + GFX(color_pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)w, (unsigned short)h, + ((unsigned long *)((pGeode->FBBase + + (patterny << gu2_yshift)) + + patternx)))); +} + +/*---------------------------------------------------------------------------- + * GX2SetupFor8x8PatternMonoExpand + * + * Description :This routine is called to fill the monochrome pattern of + * 8x8. + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * fg :Specifies the foreground color + * bg :Specifies the background color + * planemask :Specifies the value of masking from rop data + + * Returns :none. + * + * Comments :none. + * +*---------------------------------------------------------------------------- +*/ +void +GX2SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int fg, + int bg, int rop, unsigned int planemask) +{ + int trans = (bg == -1); + + /* LOAD PATTERN COLORS AND DATA */ + GFX(set_mono_pattern((unsigned int)bg, (unsigned int)fg, + (unsigned int)patternx, (unsigned int)patterny, + trans)); + + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + GFX(set_solid_source((unsigned int)planemask)); + GFX(set_raster_operation(XAAPatternROP_PM[rop])); + } +} + +/*---------------------------------------------------------------------------- + * GX2Subsequent8x8PatternMonoExpand + * + * Description :This routine is called to fill a ractanglethe + * monochrome pattern of previusly loaded pattern. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * patternx :This is set from on rop data. + * patterny :This is set based on rop data. + * fg :Specifies the foreground color + * bg :Specifies the background color + * planemask :Specifies the value of masking from rop data + + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses: + * - Patterned desktops + * - x11perf: stippled rectangle tests (-srect500). + * - x11perf: opaque stippled rectangle tests (-osrect500). +*---------------------------------------------------------------------------- +*/ +void +GX2Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, + int patternx, int patterny, int x, int y, + int w, int h) +{ + DEBUGMSG(0, (0, 0, "8x8mono %d %d %dx%d\n", x, y, w, h)); + + /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */ + /* Ignores specified pattern. */ + GFX(pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)w, (unsigned short)h)); +} + +/*---------------------------------------------------------------------------- + * GX2SetupForScreenToScreenCopy + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * xdir :This is set based on rop data. + * ydir :This is set based on rop data. + * rop :sets the raster operation + * transparency:tobeadded + * planemask :Specifies the value of masking from rop data + + * Returns :none + * + * Comments :The patterns specified is ignored inside the function +*---------------------------------------------------------------------------- +*/ +void +GX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int xdir, int ydir, int rop, + unsigned int planemask, int transparency_color) +{ + GFX(set_solid_pattern(planemask)); + /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */ + GFX(set_raster_operation(XAACopyROP[rop])); + /* SAVE TRANSPARENCY FLAG */ + GeodeTransparent = (transparency_color == -1) ? 0 : 1; + GeodeTransColor = transparency_color; + +} + +/*---------------------------------------------------------------------------- + * GX2SubsquentScreenToScreenCopy + * + * Description :This function is called to perform a screen to screen + * BLT using the previously specified planemask,raster + * operation and * transparency flag + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x1 :x -coordinates of the source window + * y1 :y-co-ordinates of the source window + * x2 :x -coordinates of the destination window + * y2 :y-co-ordinates of the destination window + * w :Specifies width of the window to be copied + * h :Height of the window to be copied. + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ +void +GX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int x1, int y1, int x2, int y2, int w, int h) +{ + if (GeodeTransparent) { + /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT + * * Should only be called for the "copy" raster operation. + */ + GFX(screen_to_screen_xblt((unsigned short)x1, (unsigned short)y1, + (unsigned short)x2, (unsigned short)y2, + (unsigned short)w, (unsigned short)h, + GeodeTransColor)); + } else { + /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */ + GFX(screen_to_screen_blt((unsigned short)x1, (unsigned short)y1, + (unsigned short)x2, (unsigned short)y2, + (unsigned short)w, (unsigned short)h)); + } +} + +void +GX2SetupForImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth) +{ + GFX(set_solid_pattern((unsigned int)planemask)); + /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */ + GFX(set_raster_operation(XAACopyROP[rop])); + /* SAVE TRANSPARENCY FLAG */ + GeodeTransparent = (transparency_color == -1) ? 0 : 1; + GeodeTransColor = transparency_color; + Geodebpp = bpp; +} + +void +GX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, int skipleft) +{ + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + SetImageWriteRect = 1; + +} + +/*---------------------------------------------------------------------------- + * GX2SetupForScanlineImageWrite + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * rop :sets the raster operation + * transparency_color :transparency color key. + * planemask :Specifies the value of masking from rop data + * bpp :bits per pixel of the source pixmap + * depth :depth of the source pixmap. + * Returns :none + * + * Comments :none + * x11perf -putimage10 + * x11perf -putimage100 + * x11perf -putimage500 +*---------------------------------------------------------------------------- +*/ +void +GX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth) +{ + GFX(set_solid_pattern((unsigned int)planemask)); + /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */ + GFX(set_raster_operation(XAACopyROP[rop & 0x0F])); + /* SAVE TRANSPARENCY FLAG */ + GeodeTransparent = (transparency_color == -1) ? 0 : 1; + GeodeTransColor = transparency_color; + Geodebpp = bpp; +} + +/*---------------------------------------------------------------------------- + * GX2SubsequentScanlineImageWriteRect + * + * Description :This function is used to set up the x,y corordinates and width + * &height for future Bliting functionality. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x :destination x + * y :destination y + * w :Specifies the width of the rectangle to be copied + * h :Specifies the height of the rectangle to be copied + * + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +GX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, int skipleft) +{ + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + GeodeCounter = 0; +} + +/*---------------------------------------------------------------------------- + * GX2SubsquentImageWriteScanline + * + * Description :This function is called to + * BLT using the previously specified planemask,raster + * operation and transparency flag + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ +void +GX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno) +{ + GeodePtr pGeode; + int blt_height = 0; + char blit = FALSE; + + pGeode = GEODEPTR(pScreenInfo); + + GeodeCounter++; + + if ((Geodeheight <= pGeode->NoOfImgBuffers) && + (GeodeCounter == Geodeheight)) { + blit = TRUE; + blt_height = Geodeheight; + } else if ((Geodeheight > pGeode->NoOfImgBuffers) + && (GeodeCounter == pGeode->NoOfImgBuffers)) { + blit = TRUE; + Geodeheight -= pGeode->NoOfImgBuffers; + blt_height = pGeode->NoOfImgBuffers; + } else + return; + + if (blit) { + blit = FALSE; + + GeodeCounter = 0; + + if (GeodeTransparent) { + /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT + * * Should only be called for the "copy" raster operation. + */ + GFX(screen_to_screen_xblt((unsigned short)Geodesrcx, + (unsigned short)Geodesrcy, + (unsigned short)Geodedstx, + (unsigned short)Geodedsty, + (unsigned short)Geodewidth, + (unsigned short)blt_height, + GeodeTransColor)); + } else { + /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */ + GFX(screen_to_screen_blt((unsigned short)Geodesrcx, + (unsigned short)Geodesrcy, + (unsigned short)Geodedstx, + (unsigned short)Geodedsty, + (unsigned short)Geodewidth, + (unsigned short)blt_height)); + } + Geodedsty += blt_height; + GFX(wait_until_idle()); + } +} + +/*---------------------------------------------------------------------------- + * GX2SetupForCPUToScreenColorExpandFill + * + * Description :This routine is called to setup the background and + * foreground colors,rop and plane mask for future + * color expansion blits from source patterns stored + * in system memory + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * fg :Specifies the foreground color + * bg :Specifies the background color + * rop :Specifies rop values. + * planemask :Specifies the value of masking from rop data + * + * Returns :none. + * + * Comments : + * All the text gets rendered through this i/f. We have given + * the offscreen memory loaction to temporarily put the text + * bitmap. Generaly all the text comes as bitmap and then gets + * rendered via the HOST_SRC(similar to scratchpad in GX1). Now + * since we already have the bitmap in offscreen we can do a + * src_FB_EXPAND. This is the best possible you can do with GX2 + * CPU-to-screen color expansion + *---------------------------------------------------------------------------- +*/ +void +GX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int fg, int bg, int rop, + unsigned int planemask) +{ + GFX(set_solid_pattern(planemask)); + GFX(set_mono_source(bg, fg, (bg == -1))); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAACopyROP_PM[rop & 0x0F])); + + DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask)); +} + +/*------------------------------------------------------------------------------- + * GX2SubsequentCPUToScreenColorExpandFill + * + * Description :This routine is used to perform color expansion blits from + * source patterns stored in system memory using the + * previously set rop and plane mask. + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x and y :Specifies the x and y co-ordinatesarea. + * w and h :Specifies width and height respectively. + * + * Returns :none + * + * Comments :none + *-------------------------------------------------------------------------------- + */ +void +GX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft) +{ + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + SetCPUToScreen = 1; +} + +#if SCR2SCREXP +void +GX2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask) +{ + GFX(set_solid_pattern(planemask)); + GFX(set_mono_source(bg, fg, (bg == -1))); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAACopyROP_PM[rop & 0x0F])); + + DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask)); +} + +void +GX2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int srcx, int srcy, int offset) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + GFX(mono_bitmap_to_screen_blt(offset, 0, x, y, w, h, + (unsigned char *)(pGeode->FBBase + + CALC_FBOFFSET(srcx, srcy)), + pGeode->Pitch)); +} +#endif + +static unsigned short vector_mode_table[] = { + VM_MAJOR_INC | VM_MINOR_INC | VM_X_MAJOR, + VM_MAJOR_INC | VM_MINOR_INC | VM_Y_MAJOR, + VM_MAJOR_INC | VM_X_MAJOR, + VM_MINOR_INC | VM_Y_MAJOR, + VM_MINOR_INC | VM_X_MAJOR, + VM_MAJOR_INC | VM_Y_MAJOR, + VM_X_MAJOR, + VM_Y_MAJOR, +}; + +/*---------------------------------------------------------------------------- + * GX2SetupForSolidLine + * + * Description :This function is used setup the solid line color for + * future line draws. + * + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * color :Specifies the color value od line + * rop :Specifies rop values. + * Planemask :Specifies planemask value. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +GX2SetupForSolidLine(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + /* LOAD THE SOLID PATTERN COLOR */ + GFX(set_solid_pattern((unsigned int)color)); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(XAAPatternROP[rop & 0x0F])); +} + +/*--------------------------------------------------------------------------- + * GX2SubsequentBresenhamLine + * + * Description :This function is used to render a vector using the + * specified bresenham parameters. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x1 :Specifies the starting x position + * y1 :Specifies starting y possition + * absmaj :Specfies the Bresenman absolute major. + * absmin :Specfies the Bresenman absolute minor. + * err :Specifies the bresenham err term. + * len :Specifies the length of the vector interms of pixels. + * octant :not used in this function,may be added for standard + * interface. + * Returns :none + * + * Comments :none + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-line500). + * - x11perf: line segments (-seg500). +*---------------------------------------------------------------------------- +*/ +void +GX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, + int x1, int y1, int absmaj, int absmin, int err, + int len, int octant) +{ + int axial, init, diag; + + DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n", + x1, y1, absmaj, absmin, err, len, octant)); + + /* DETERMINE BRESENHAM PARAMETERS */ + + axial = ((int)absmin << 1); + init = axial - (int)absmaj; + diag = init - (int)absmaj; + + /* ADJUST INITIAL ERROR + * * Adjust by -1 for certain directions so that the vector + * * hits the same pixels when drawn in either direction. + * * The Gamma value is assumed to account for the initial + * * error adjustment for clipped lines. + */ + + init += err; + + /* CALL ROUTINE TO DRAW VECTOR */ + + GFX(bresenham_line((unsigned short)x1, + (unsigned short)y1, + (unsigned short)len, + (unsigned short)init, + (unsigned short)axial, + (unsigned short)diag, + (unsigned short)vector_mode_table[octant])); + +} + +#define ABS(_val1, _val2) (((_val1) > (_val2)) ? ((_val1)-(_val2)) : ((_val2) - (_val1))) + +void +GX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, int flags) +{ + long dx, dy, dmaj, dmin; + long axialerr, diagerr, initerr; + unsigned short vec_flags = 0; + + dx = ABS(x1, x0); + dy = ABS(y1, y0); + if (dx >= dy) { + dmaj = dx; + dmin = dy; + vec_flags = VM_X_MAJOR; + if (x1 > x0) + vec_flags |= VM_MAJOR_INC; + if (y1 > y0) + vec_flags |= VM_MINOR_INC; + } else { + dmaj = dy; + dmin = dx; + vec_flags = VM_Y_MAJOR; + if (x1 > x0) + vec_flags |= VM_MINOR_INC; + if (y1 > y0) + vec_flags |= VM_MAJOR_INC; + } + axialerr = dmin << 1; + diagerr = (dmin - dmaj) << 1; + initerr = (dmin << 1) - dmaj; + if (!(vec_flags & VM_MINOR_INC)) + initerr--; + + GFX(bresenham_line((unsigned short)x0, + (unsigned short)y0, + (unsigned short)dmaj, + (unsigned short)initerr, + (unsigned short)axialerr, + (unsigned short)diagerr, vec_flags)); +} + +/*--------------------------------------------------------------------------- + * GX2SubsequentHorVertLine + * + * This routine is called to render a vector using the specified Bresenham + * parameters. + * + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-hseg500). + * - x11perf: line segments (-vseg500). + *--------------------------------------------------------------------------- + */ +void +GX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, + int x, int y, int len, int dir) +{ + DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir)); + GFX(pattern_fill((unsigned short)x, (unsigned short)y, + (unsigned short)((dir == DEGREES_0) ? len : 1), + (unsigned short)((dir == DEGREES_0) ? 1 : len))); +} + +#if DASHED_SUPPORT +void +BuildPattern(CARD32 pat, int len, CARD32 * pat8x8) +{ + unsigned long i, count; + + /* find homany can fit comfortably */ + count = 32 / len; + /* add 1 for the residue */ + count++; + /* construct the mask and knock off the unwanted data */ + i = ((CARD32) 0xFFFFFFFF) << (31 - len); + pat &= i; + /* init before the show */ + pat8x8[0] = 0; + /* loop and build the pattern aray data */ + for (i = 0; i < count; i++) { + pat8x8[0] |= (pat >> (len * i)); + } + + /* equate both the array's and then adjust */ + pat8x8[1] = pat8x8[0]; + + /* how many carried from last operation */ + i = (len * count) - 32; + pat8x8[1] >>= i; + pat8x8[1] |= (pat << (len - i)); +} + +#define PAT_SHIFT(pat,n) pat >> n + +/*---------------------------------------------------------------------------- + * GX2SetupForDashedLine + * + * Description :This function is used to setup for + * future line draws. + * + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * Returns :none + * + * Comments :none + * x11perf -dseg100 + * x11perf -dline100 + * x11perf -ddline100 +*---------------------------------------------------------------------------- +*/ +void +GX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern) +{ + int trans = (bg == -1); + CARD32 *pat = (CARD32 *) pattern; + CARD32 pat8x8[2]; + + pat8x8[0] = pat[0]; + switch (length) { + case 2: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 2); /* fall through */ + case 4: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 4); /* fall through */ + case 8: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 8); /* fall through */ + case 16: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 16); + case 32: + pat8x8[1] = pat8x8[0]; + break; + case 64: + pat8x8[1] = pat[1]; + break; + default: + BuildPattern(pat[0], length, pat8x8); + } +/* + ErrorF("%X %d, %X %X\n", pat[0], length, pat8x8[0], pat8x8[1]); +*/ + /* LOAD PATTERN COLORS AND DATA */ + + GFX(set_mono_pattern((unsigned int)bg, (unsigned int)fg, + pat8x8[0], pat8x8[1], (unsigned char)trans)); + + /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */ + + if (planemask == 0xFFFFFFFF) { + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + + GFX(set_raster_operation(windowsROPpat[rop & 0x0F])); + } else { + /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */ + + GFX(set_raster_operation(windowsROPsrcMask[rop & 0x0F])); + } +} + +/*--------------------------------------------------------------------------- + * GX2SubsequentDashedBresenhamLine + * + * Description :This function is used to render a vector using the + * specified bresenham parameters. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x1 :Specifies the starting x position + * y1 :Specifies starting y possition + * absmaj :Specfies the Bresenman absolute major. + * absmin :Specfies the Bresenman absolute minor. + * err :Specifies the bresenham err term. + * len :Specifies the length of the vector interms of pixels. + * octant :not used in this function,may be added for standard + * interface. + * Returns :none + * + * Comments :none + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-line500). + * - x11perf: line segments (-seg500). +*---------------------------------------------------------------------------- +*/ +void +GX2SubsequentDashedBresenhamLine(ScrnInfoPtr pScreenInfo, + int x1, int y1, int absmaj, int absmin, + int err, int len, int octant) +{ + int axial, init, diag; + + DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n", + x1, y1, absmaj, absmin, err, len, octant)); + + /* DETERMINE BRESENHAM PARAMETERS */ + + axial = ((int)absmin << 1); + init = axial - (int)absmaj; + diag = init - (int)absmaj; + + /* ADJUST INITIAL ERROR + * * Adjust by -1 for certain directions so that the vector + * * hits the same pixels when drawn in either direction. + * * The Gamma value is assumed to account for the initial + * * error adjustment for clipped lines. + */ + + init += err; + + /* CALL ROUTINE TO DRAW VECTOR */ + + gfx2_set_pattern_origin(x1, y1); + gfx2_bresenham_line(CALC_FBOFFSET(x1, y1), + (unsigned short)len, (unsigned short)init, + (unsigned short)axial, (unsigned short)diag, + (unsigned short)vector_mode_table[octant]); + +} +#endif + +#if !defined(STB_X) +/*---------------------------------------------------------------------------- + * OPTGX2SetupForCPUToScreenColorExpandFill + * + * Description :This routine is called to setup the background and + * foreground colors,rop and plane mask for future + * color expansion blits from source patterns stored + * in system memory(non durango version). + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * fg :Specifies the foreground color + * bg :Specifies the background color + * rop :Specifies rop values. + * planemask :Specifies the value of masking from rop data + * + * Returns :none. + * + * Comments : + * All the text gets rendered through this i/f. We have given + * the offscreen memory loaction to temporarily put the text + * bitmap. Generaly all the text comes as bitmap and then gets + * rendered via the HOST_SRC(similar to scratchpad in GX1). Now + * since we already have the bitmap in offscreen we can do a + * src_FB_EXPAND. This is the best possible you can do with GX2 + * CPU-to-screen color expansion + * x11perf -ftext (pure indirect): + * x11perf -oddsrect10 + * x11perf -oddsrect100 + * x11perf -bigsrect10 + * x11perf -bigsrect100 + * x11perf -polytext + * x11perf -polytext16 + * x11perf -seg1 + * x11perf -copyplane10 + * x11perf -copyplane100 + * x11perf -putimagexy10 + * x11perf -putimagexy100 +*---------------------------------------------------------------------------- +*/ + +void +OPTGX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int fg, int bg, int rop, + unsigned int planemask) +{ + int trans = (bg == -1); + + GeodeROP = XAACopyROP_PM[rop]; + + if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) { + Geode_blt_mode = MGP_BM_DST_REQ; + } else { + Geode_blt_mode = 0; + } + if (trans) + GeodeROP |= MGP_RM_SRC_TRANS; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_PAT_COLOR_0, (unsigned long)planemask); + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP); + WRITE_GP32(MGP_SRC_COLOR_FG, fg); + WRITE_GP32(MGP_SRC_COLOR_BG, bg); +} + +/*------------------------------------------------------------------------------- + * OPTGX2SubsequentCPUToScreenColorExpandFill + * + * Description :This routine is used to perform color expansion blits from + * source patterns stored in system memory using the previously + * set rop and plane mask.(non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x and y :Specifies the x and y co-ordinatesarea. + * w and h :Specifies width and height respectively. + * + * Returns :none + * + * Comments :none + *-------------------------------------------------------------------------------- + */ +void +OPTGX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned int)(localRecPtr->ColorExpandBase - + pGeode->FBBase))); + WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x, y)); + WRITE_GP32(MGP_WID_HEIGHT, (((unsigned long)w) << 16) | h); + WRITE_GP32(MGP_STRIDE, (((w + 31) >> 5) << 18) | pGeode->Pitch); + SetCPUToScreen = 1; +} + +/*---------------------------------------------------------------------------- + * OPTGX2SetupForFillRectSolid. + * + * Description :This routine is called to setup the solid pattern + * color for future rectangular fills or vectors. + * (non durango version) + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * color :Specifies the color to be filled up in defined area. + * rop :Specifies the raster operation value. + * planemask :Specifies the masking value based rop srcdata. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_PAT_COLOR_0, (unsigned long)color); + + WRITE_GP32(MGP_STRIDE, pGeode->Pitch); + + if (planemask == 0xFFFFFFFF) { + GeodeROP = XAAPatternROP[rop]; + } else { + WRITE_GP32(MGP_SRC_COLOR_FG, (unsigned long)planemask); + GeodeROP = XAAPatternROP_PM[rop]; + } + + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP); + + Geode_blt_mode = 0; + if (!((GeodeROP & 0x33) ^ ((GeodeROP >> 2) & 0x33))) + Geode_blt_mode = MGP_BM_SRC_MONO; + + if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) { + Geode_blt_mode |= MGP_BM_DST_REQ; + Geode_vector_mode = MGP_VM_DST_REQ; + } else { + Geode_vector_mode = 0; + } +} + + /*---------------------------------------------------------------------------- + * OPTGX2SubsequentFillRectSolid. + * + * Description :This routine is used to fill the rectangle of previously + * specified solid pattern. + * (non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * x and y :Specifies the x and y co-ordinatesarea. + * w and h :Specifies width and height respectively. + * + * Returns :none + * + * Comments :desired pattern can be set before this function by + * gfx_set_solid_pattern. + * Sample application uses: + * - Window backgrounds. + * - x11perf: rectangle tests (-rect500). + * - x11perf: fill trapezoid tests (-trap100). + * - x11perf: horizontal line segments (-hseg500). + *---------------------------------------------------------------------------- +*/ +void +OPTGX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, + int x, int y, int width, int height) +{ + DEBUGMSG(0, (0, 0, "FillRect %d %d %dx%d\n", x, y, width, height)); + + GFX_PATTERN_FILL(x, y, width, height); +} + +/*---------------------------------------------------------------------------- + * OPTGX2SetupForScreenToScreenCopy + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality. + * (non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * xdir :This is set based on rop data. + * ydir :This is set based on rop data. + * rop :sets the raster operation + * transparency:tobeadded + * planemask :Specifies the value of masking from rop data + + * Returns :none + * + * Comments :The patterns specified is ignored inside the function +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int xdir, int ydir, int rop, + unsigned int planemask, + int transparency_color) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + GeodeROP = XAACopyROP_PM[rop]; + + Geode_blt_mode = MGP_BM_SRC_FB; + + /* CALCULATE THE DIRECTION OF THE BLT */ + if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) { + Geode_blt_mode |= MGP_BM_DST_REQ; + } + + GU2_WAIT_PENDING; + + if (transparency_color != -1) { + WRITE_GP32(MGP_SRC_COLOR_FG, transparency_color); + WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF); + GeodeROP = MGP_RM_SRC_TRANS | 0xCC; + } + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP); + WRITE_GP32(MGP_STRIDE, pGeode->Pitch | (pGeode->Pitch << 16)); +} + +/*---------------------------------------------------------------------------- + * OPTGX2SubsquentScreenToScreenCopy + * + * Description :This function is called to perform a screen to screen + * BLT using the previously specified planemask,raster + * operation and * transparency flag + * (non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * srcx :x -coordinates of the source window + * srcy :y-co-ordinates of the source window + * dstx :x -coordinates of the destination window + * dsty :y-co-ordinates of the destination window + * width :Specifies width of the window to be copied + * height :Height of the window to be copied. + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, + int srcx, int srcy, int dstx, int dsty, + int width, int height) +{ + unsigned int srcoffset, dstoffset, blt_mode, size; + + DEBUGMSG(0, (0, 0, "Scr2scr %d %d %d %d %dx%d\n", + srcx, srcy, dstx, dsty, width, height)); + + size = (((unsigned int)width) << 16) | height; + + blt_mode = Geode_blt_mode; + + if (dstx > srcx) { + blt_mode |= MGP_BM_NEG_XDIR; + srcx += width - 1; + dstx += width - 1; + } + if (dsty > srcy) { + blt_mode |= MGP_BM_NEG_YDIR; + srcy += height - 1; + dsty += height - 1; + } + + /* CALCULATE STARTING OFFSETS */ + + srcoffset = CALC_FBOFFSET(srcx, srcy); + dstoffset = CALC_FBOFFSET(dstx, dsty) & 0xFFFFFF; + + /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */ + /* This is a quirk of the hardware. */ + + if (Geode_blt_mode & MGP_BM_NEG_XDIR) { + srcoffset += (1 << gu2_xshift) - 1; + dstoffset += (1 << gu2_xshift) - 1; + } + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_BLT_MODE, blt_mode); +} + +/*---------------------------------------------------------------------------- + * OPTGX2SetupForImageWrite + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality.(non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * rop :sets the raster operation + * transparency_color :tobeadded + * planemask :Specifies the value of masking from rop data + * bpp :bits per pixel of the source pixmap + * depth :depth of the source pixmap. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SetupForImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth) +{ + OPTGX2SetupForScreenToScreenCopy(pScreenInfo, + 0, 0, rop, planemask, transparency_color); +} + +void +OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, int skipleft) +{ + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + + SetImageWriteRect = 1; +} + +/*---------------------------------------------------------------------------- + * OPTGX2SetupForScanlineImageWrite + * + * Description :This function is used to set up the planemask and raster + * for future Bliting functionality.(non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * rop :sets the raster operation + * transparency_color:tobeadded + * planemask :Specifies the value of masking from rop data + * bpp :bits per pixel of the source pixmap + * depth :depth of the source pixmap. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo, + int rop, unsigned int planemask, + int transparency_color, int bpp, int depth) +{ + Geodebpp = bpp; + OPTGX2SetupForScreenToScreenCopy(pScreenInfo, + 0, 0, rop, planemask, transparency_color); +} + +/*---------------------------------------------------------------------------- + * OPTGX2SubsequentScanlineImageWriteRect + * + * Description :This function is used to set up the x,y corordinates and width + * &height for future Bliting functionality.(non durango version) + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x :destination x + * y :destination y + * w :Specifies the width of the rectangle to be copied + * h :Specifies the height of the rectangle to be copied + * Returns :none + * + * Comments :none + *---------------------------------------------------------------------------- +*/ +void +OPTGX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo, + int x, int y, int w, int h, + int skipleft) +{ + Geodedstx = x; + Geodedsty = y; + Geodewidth = w; + Geodeheight = h; + GeodeCounter = 0; +} + +/*---------------------------------------------------------------------------- + * OPTGX2SubsquentImageWriteScanline + * + * Description :This function is called to + * BLT using the previously specified planemask,raster + * operation and transparency flag(non durango version) + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :The patterns specified is ignored inside the function + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + * No application found using transparency. +*---------------------------------------------------------------------------- +*/ + +void +OPTGX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno) +{ + GeodePtr pGeode; + + int blt_height = 0; + char blit = FALSE; + + pGeode = GEODEPTR(pScreenInfo); + GeodeCounter++; + + if ((Geodeheight <= pGeode->NoOfImgBuffers) && + (GeodeCounter == Geodeheight)) { + blit = TRUE; + blt_height = Geodeheight; + } else if ((Geodeheight > pGeode->NoOfImgBuffers) + && (GeodeCounter == pGeode->NoOfImgBuffers)) { + blit = TRUE; + Geodeheight -= pGeode->NoOfImgBuffers; + blt_height = pGeode->NoOfImgBuffers; + } else + return; + + if (blit) { + blit = FALSE; + GeodeCounter = 0; + OPTGX2SubsequentScreenToScreenCopy(pScreenInfo, + Geodesrcx, Geodesrcy, Geodedstx, + Geodedsty, Geodewidth, blt_height); + Geodedsty += blt_height; + GU2_WAIT_BUSY; + } +} + +/*---------------------------------------------------------------------------- + * OPTGX2SetupForSolidLine + * + * Description :This function is used setup the solid line color for + * future line draws. + * + * + * Parameters. + * pScreenInfo :Screen handler pointer having screen information. + * color :Specifies the color value od line + * rop :Specifies rop values. + * Planemask :Specifies planemask value. + * Returns :none + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SetupForSolidLine(ScrnInfoPtr pScreenInfo, + int color, int rop, unsigned int planemask) +{ + OPTGX2SetupForFillRectSolid(pScreenInfo, color, rop, planemask); +} + +/*--------------------------------------------------------------------------- + * OPTGX2SubsequentBresenhamLine + * + * Description :This function is used to render a vector using the + * specified bresenham parameters. + * + * Parameters: + * pScreenInfo :Screen handler pointer having screen information. + * x1 :Specifies the starting x position + * y1 :Specifies starting y possition + * absmaj :Specfies the Bresenman absolute major. + * absmin :Specfies the Bresenman absolute minor. + * err :Specifies the bresenham err term. + * len :Specifies the length of the vector interms of pixels. + * octant :not used in this function,may be added for standard + * interface. + * Returns :none + * + * Comments :none + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-seg500). +*---------------------------------------------------------------------------- +*/ +void +OPTGX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, + int x1, int y1, int absmaj, int absmin, + int err, int len, int octant) +{ + int axial, init, diag; + + DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n", + x1, y1, absmaj, absmin, err, len, octant)); + + /* DETERMINE BRESENHAM PARAMETERS */ + + axial = ((int)absmin << 1); + init = axial - (int)absmaj; + diag = init - (int)absmaj; + + /* ADJUST INITIAL ERROR + * * Adjust by -1 for certain directions so that the vector + * * hits the same pixels when drawn in either direction. + * * The Gamma value is assumed to account for the initial + * * error adjustment for clipped lines. + */ + + init += err; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x1, y1)); + WRITE_GP32(MGP_VEC_ERR, + (((unsigned long)axial) << 16) | (unsigned short)diag); + WRITE_GP32(MGP_VEC_LEN, + (((unsigned long)len) << 16) | (unsigned short)init); + WRITE_GP32(MGP_VECTOR_MODE, + (Geode_vector_mode | vector_mode_table[octant])); +} + +void +OPTGX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, int flags) +{ + long dx, dy, dmaj, dmin; + long axialerr, diagerr, initerr; + unsigned short vec_flags = 0; + + dx = ABS(x1, x0); + dy = ABS(y1, y0); + if (dx >= dy) { + dmaj = dx; + dmin = dy; + vec_flags = VM_X_MAJOR; + if (x1 > x0) + vec_flags |= VM_MAJOR_INC; + if (y1 > y0) + vec_flags |= VM_MINOR_INC; + } else { + dmaj = dy; + dmin = dx; + vec_flags = VM_Y_MAJOR; + if (x1 > x0) + vec_flags |= VM_MINOR_INC; + if (y1 > y0) + vec_flags |= VM_MAJOR_INC; + } + + axialerr = dmin << 1; + diagerr = (dmin - dmaj) << 1; + initerr = (axialerr - dmaj); + + if (!(vec_flags & VM_MINOR_INC)) + initerr--; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x0, y0)); + WRITE_GP32(MGP_VEC_ERR, + (((unsigned long)axialerr) << 16) | (unsigned short)diagerr); + WRITE_GP32(MGP_VEC_LEN, + (((unsigned long)dmaj) << 16) | (unsigned short)initerr); + WRITE_GP32(MGP_VECTOR_MODE, (Geode_vector_mode | vec_flags)); +} + +/*--------------------------------------------------------------------------- + * OPTGX2SubsequentHorVertLine + * + * This routine is called to render a vector using the specified Bresenham + * parameters. + * + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-hseg500). + * - x11perf: line segments (-vseg500). + *--------------------------------------------------------------------------- + */ +void +OPTGX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, + int x, int y, int len, int dir) +{ + DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir)); +#if 1 + GFX_PATTERN_FILL(x, y, + (unsigned short)((dir == DEGREES_0) ? len : 1), + (unsigned short)((dir == DEGREES_0) ? 1 : len)); +#else + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x, y)); + WRITE_GP32(MGP_VEC_ERR, 0); + WRITE_GP32(MGP_VEC_LEN, + (((unsigned long)len) << 16) | (unsigned short)-len); + WRITE_GP32(MGP_VECTOR_MODE, + (Geode_vector_mode | + vector_mode_table[(dir == DEGREES_0) ? 2 : 5])); +#endif +} + +#if DASHED_SUPPORT +/* Setup for XAA dashed lines. + + Tests: xtest CH05/stdshs, XFree86/drwln + + x11perf -dseg100 + x11perf -dline100 + x11perf -ddline100 +*/ +void +OPTGX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + CARD32 *pat = (CARD32 *) pattern; + CARD32 pat8x8[2]; + + pat8x8[0] = pat[0]; + switch (length) { + case 2: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 2); /* fall through */ + case 4: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 4); /* fall through */ + case 8: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 8); /* fall through */ + case 16: + pat8x8[0] |= PAT_SHIFT(pat8x8[0], 16); + case 32: + pat8x8[1] = pat8x8[0]; + break; + case 64: + pat8x8[1] = pat[1]; + break; + default: + BuildPattern(pat[0], length, pat8x8); + } + /* LOAD PATTERN COLORS AND DATA */ + + /* SET PATTERN FLAGS */ + + if (planemask == 0xFFFFFFFF) { + GeodeROP = XAAPatternROP[rop & 0x0F]; + } else { + GeodeROP = XAAPatternROP_PM[rop & 0x0F]; + } + if (bg == -1) + GeodeROP |= MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS; + else + GeodeROP |= MGP_RM_PAT_MONO; + + if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) { + Geode_blt_mode = MGP_BM_DST_REQ; + Geode_vector_mode = MGP_VM_DST_REQ; + } else { + Geode_blt_mode = MGP_BM_SRC_MONO; + Geode_vector_mode = 0; + } + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP); + WRITE_GP32(MGP_PAT_COLOR_0, bg); + WRITE_GP32(MGP_PAT_COLOR_1, fg); + WRITE_GP32(MGP_PAT_DATA_0, pat8x8[0]); + WRITE_GP32(MGP_PAT_DATA_1, pat8x8[1]); + WRITE_GP32(MGP_STRIDE, pGeode->Pitch); + +} + +void +OPTGX2SubsequentDashedBresenhamLine(ScrnInfoPtr pScreenInfo, + int x1, int y1, int absmaj, int absmin, + int err, int len, int octant) +{ + int axial, init, diag; + unsigned long gu2_pattern_origin; + + DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n", + x1, y1, absmaj, absmin, err, len, octant)); + + /* CHECK NULL LENGTH */ + + if (!len) + return; + + /* DETERMINE BRESENHAM PARAMETERS */ + + axial = ((int)absmin << 1); + init = axial - (int)absmaj; + diag = init - (int)absmaj; + + /* ADJUST INITIAL ERROR + * * Adjust by -1 for certain directions so that the vector + * * hits the same pixels when drawn in either direction. + * * The Gamma value is assumed to account for the initial + * * error adjustment for clipped lines. + */ + + init += err; + + /* CALL ROUTINE TO DRAW VECTOR */ + + gu2_pattern_origin = (((unsigned long)(x1 & 7)) << 26) | + (((unsigned long)(y1 & 7)) << 29); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, (CALC_FBOFFSET(x1, y1) & 0x00FFFFFF) | + gu2_pattern_origin); + WRITE_GP32(MGP_VEC_ERR, + (((unsigned long)axial) << 16) | (unsigned short)diag); + WRITE_GP32(MGP_VEC_LEN, + (((unsigned long)len) << 16) | (unsigned short)init); + WRITE_GP32(MGP_VECTOR_MODE, (Geode_vector_mode | + vector_mode_table[octant])); +} + +void +OPTGX2SubsequentDashedTwoPointLine(ScrnInfoPtr pScreenInfo, + int x0, int y0, int x1, int y1, int flags) +{ + long dx, dy, dmaj, dmin; + long axialerr, diagerr, initerr; + unsigned long gu2_pattern_origin; + unsigned short vec_flags = 0; + + dx = ABS(x1, x0); + dy = ABS(y1, y0); + if (dx >= dy) { + dmaj = dx; + dmin = dy; + vec_flags = VM_X_MAJOR; + if (x1 > x0) + vec_flags |= VM_MAJOR_INC; + if (y1 > y0) + vec_flags |= VM_MINOR_INC; + } else { + dmaj = dy; + dmin = dx; + vec_flags = VM_Y_MAJOR; + if (x1 > x0) + vec_flags |= VM_MINOR_INC; + if (y1 > y0) + vec_flags |= VM_MAJOR_INC; + } + + axialerr = dmin << 1; + diagerr = (dmin - dmaj) << 1; + initerr = (axialerr - dmaj); + + if (!(vec_flags & VM_MINOR_INC)) + initerr--; + + /* CALL ROUTINE TO DRAW VECTOR */ + + gu2_pattern_origin = (((unsigned long)(x0 & 7)) << 26) | + (((unsigned long)(y0 & 7)) << 29); + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, (CALC_FBOFFSET(x0, y0) & 0x00FFFFFF) | + gu2_pattern_origin); + WRITE_GP32(MGP_VEC_ERR, + (((unsigned long)axialerr) << 16) | (unsigned short)diagerr); + WRITE_GP32(MGP_VEC_LEN, + (((unsigned long)dmaj) << 16) | (unsigned short)initerr); + WRITE_GP16(MGP_VECTOR_MODE, (Geode_vector_mode | vec_flags)); +} +#endif /* DASHED_SUPPORT */ +#endif /* STB_X */ + +#if 0 +void +GX2WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, + unsigned char *src, int srcwidth, int skipleft, + int fg, int bg, int rop, unsigned int planemask) +{ + GFX(set_solid_pattern(planemask)); + GFX(set_mono_source(bg, fg, (bg == -1))); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(windowsROPpatMask[rop & 0x0F])); + GFX(mono_bitmap_to_screen_blt_swp(0, 0, x, y, + srcwidth << 3, h, src, srcwidth)); +} + +void +GX2WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */ + int rop, unsigned int planemask, int trans, int bpp, int depth) +{ + /* + * ErrorF("GX2WritePixmap %d %d %d %d %X %d %d %d, %d\n", + * x, y, w, h, src, srcwidth, bpp, depth, trans); + */ + GFX(set_solid_pattern(planemask)); + + /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */ + GFX(set_raster_operation(windowsROPpatMask[rop & 0x0F])); + if (trans == -1) { + GFX(color_bitmap_to_screen_blt(0, 0, x, y, w, h, src, srcwidth)); + } else { + GFX(color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src, + srcwidth, trans)); + } +} + +void +GX2ReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, + unsigned char *dst, int dstwidth, int bpp, int depth) +{ + ErrorF("GX2ReadPixmap %d %d %d %d %X %d %d %d\n", + x, y, w, h, dst, dstwidth, bpp, depth); +} +#endif +/**************************************************************************/ + +/*---------------------------------------------------------------------------- + * GX2AccelInit. + * + * Description :This function sets up the supported acceleration routines and + * appropriate flags. + * + * Parameters: + * pScreen :Screeen pointer structure. + * + * Returns :TRUE on success and FALSE on Failure + * + * Comments :This function is called in GX2ScreenInit in + geode_driver.c to set * the acceleration. +*---------------------------------------------------------------------------- +*/ +Bool +GX2AccelInit(ScreenPtr pScreen) +{ + GeodePtr pGeode; + ScrnInfoPtr pScreenInfo; + + pScreenInfo = xf86Screens[pScreen->myNum]; + pGeode = GEODEPTR(pScreenInfo); + + switch (pScreenInfo->bitsPerPixel) { + case 8: + gu2_bpp = MGP_RM_BPPFMT_332; + break; + case 16: + gu2_bpp = MGP_RM_BPPFMT_565; + break; + case 32: + gu2_bpp = MGP_RM_BPPFMT_8888; + break; + } + + gu2_xshift = pScreenInfo->bitsPerPixel >> 4; + + switch (pGeode->Pitch) { + case 1024: + gu2_yshift = 10; + break; + case 2048: + gu2_yshift = 11; + break; + case 4096: + gu2_yshift = 12; + break; + case 8192: + gu2_yshift = 13; + break; + } + + /* Getting the pointer for acceleration Inforecord */ + pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec(); + + /* SET ACCELERATION FLAGS */ + localRecPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER; + + /* HOOK SYNCRONIZARION ROUTINE */ + localRecPtr->Sync = GX2AccelSync; + + /* HOOK FILLED RECTANGLES */ + localRecPtr->SetupForSolidFill = OPTACCEL(GX2SetupForFillRectSolid); + localRecPtr->SubsequentSolidFillRect = + OPTACCEL(GX2SubsequentFillRectSolid); + localRecPtr->SolidFillFlags = 0; + + /* HOOK 8x8 Mono EXPAND PATTERNS */ + localRecPtr->SetupForMono8x8PatternFill = GX2SetupFor8x8PatternMonoExpand; + localRecPtr->SubsequentMono8x8PatternFillRect = + GX2Subsequent8x8PatternMonoExpand; + localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN; + + localRecPtr->SetupForColor8x8PatternFill = + GX2SetupFor8x8PatternColorExpand; + localRecPtr->SubsequentColor8x8PatternFillRect = + GX2Subsequent8x8PatternColorExpand; + /* Color expansion */ + localRecPtr->Color8x8PatternFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | + SCANLINE_PAD_DWORD | HARDWARE_PATTERN_SCREEN_ORIGIN; + + /* HOOK SCREEN TO SCREEN COPIES + * * Set flag to only allow copy if transparency is enabled. + */ + localRecPtr->SetupForScreenToScreenCopy = + OPTACCEL(GX2SetupForScreenToScreenCopy); + localRecPtr->SubsequentScreenToScreenCopy = + OPTACCEL(GX2SubsequentScreenToScreenCopy); + localRecPtr->ScreenToScreenCopyFlags = 0; + + /* HOOK BRESENHAM SOLID LINES */ + /* Do not hook unless flag can be set preventing use of planemask. */ + localRecPtr->SolidLineFlags = NO_PLANEMASK; + localRecPtr->SetupForSolidLine = OPTACCEL(GX2SetupForSolidLine); + localRecPtr->SubsequentSolidBresenhamLine = + OPTACCEL(GX2SubsequentBresenhamLine); + localRecPtr->SubsequentSolidHorVertLine = + OPTACCEL(GX2SubsequentHorVertLine); + localRecPtr->SubsequentSolidTwoPointLine = + OPTACCEL(GX2SubsequentSolidTwoPointLine); + localRecPtr->SolidBresenhamLineErrorTermBits = 15; + +#if DASHED_SUPPORT + localRecPtr->SetupForDashedLine = OPTACCEL(GX2SetupForDashedLine); + localRecPtr->SubsequentDashedBresenhamLine = + OPTACCEL(GX2SubsequentDashedBresenhamLine); + localRecPtr->SubsequentSolidTwoPointLine = + OPTACCEL(GX2SubsequentDashedTwoPointLine); + localRecPtr->DashedBresenhamLineErrorTermBits = 15; + localRecPtr->DashPatternMaxLength = 64; + localRecPtr->DashedLineFlags = NO_PLANEMASK | + LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED; +#endif +#if SCR2SCREXP + /* Color expansion */ + localRecPtr->ScreenToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | NO_TRANSPARENCY; + + localRecPtr->SetupForScreenToScreenColorExpandFill = + (GX2SetupForScreenToScreenColorExpandFill); + localRecPtr->SubsequentScreenToScreenColorExpandFill = + (GX2SubsequentScreenToScreenColorExpandFill); +#endif + /* + * ImageWrite. + * + * SInce this uses off-screen scanline buffers, it is only of use when + * complex ROPs are used. But since the current XAA pixmap cache code + * only works when an ImageWrite is provided, the NO_GXCOPY flag is + * temporarily disabled. + */ + if (pGeode->AccelImageWriteBufferOffsets) { + /* Color expansion */ + localRecPtr->CPUToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_PLANEMASK | SYNC_AFTER_COLOR_EXPAND | SCANLINE_PAD_DWORD; + localRecPtr->ColorExpandBase = pGeode->AccelImageWriteBufferOffsets[0]; + localRecPtr->ColorExpandRange = pGeode->NoOfImgBuffers << gu2_yshift; + + localRecPtr->SetupForCPUToScreenColorExpandFill = + OPTACCEL(GX2SetupForCPUToScreenColorExpandFill); + localRecPtr->SubsequentCPUToScreenColorExpandFill = + OPTACCEL(GX2SubsequentCPUToScreenColorExpandFill); + +#if IMGWRITE_SUPPORT + localRecPtr->ImageWriteFlags = NO_PLANEMASK | + SCANLINE_PAD_DWORD | SYNC_AFTER_IMAGE_WRITE; + localRecPtr->ImageWriteBase = pGeode->AccelImageWriteBufferOffsets[0]; + localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu2_yshift; + localRecPtr->SetupForImageWrite = OPTACCEL(GX2SetupForImageWrite); + localRecPtr->SubsequentImageWriteRect = + OPTACCEL(GX2SubsequentImageWriteRect); +#endif /* IMGWRITE_SUPPORT */ + + localRecPtr->ScanlineImageWriteFlags = + localRecPtr->ScreenToScreenCopyFlags; + localRecPtr->ScanlineImageWriteBuffers = + pGeode->AccelImageWriteBufferOffsets; + localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers; + localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu2_yshift; + localRecPtr->SetupForScanlineImageWrite = + OPTACCEL(GX2SetupForScanlineImageWrite); + localRecPtr->SubsequentScanlineImageWriteRect = + OPTACCEL(GX2SubsequentScanlineImageWriteRect); + localRecPtr->SubsequentImageWriteScanline = + OPTACCEL(GX2SubsequentImageWriteScanline); + + ImgBufOffset = pGeode->AccelImageWriteBufferOffsets[0] - pGeode->FBBase; + Geodesrcy = ImgBufOffset >> gu2_yshift; + + Geodesrcx = ImgBufOffset & (pGeode->Pitch - 1); + Geodesrcx /= (pScreenInfo->bitsPerPixel >> 3); + } else { + localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; + } +#if 0 +#if !defined(STB_X) + localRecPtr->WriteBitmap = GX2WriteBitmap; +#endif + localRecPtr->WritePixmap = GX2WritePixmap; + localRecPtr->ReadPixmap = GX2ReadPixmap; +#endif + + return (XAAInit(pScreen, localRecPtr)); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_cursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_cursor.c:1.5 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_cursor.c Fri Feb 21 11:51:09 2003 @@ -0,0 +1,393 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_cursor.c,v 1.5 2003/02/21 16:51:09 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_cursor.c $ + * $Revision: 9 $ + * $Author: Sarma $ + * + * File Contents: Xfree cursor implementation routines + * for geode HWcursor init.setting cursor color,image etc + * are done here. + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "nsc.h" + +/* Forward declarations of the functions */ +Bool GX2HWCursorInit(ScreenPtr pScreen); +static void GX2SetCursorColors(ScrnInfoPtr pScreenInfo, int bg, int fg); +static void GX2SetCursorPosition(ScrnInfoPtr pScreenInfo, int x, int y); +void GX2LoadCursorImage(ScrnInfoPtr pScreenInfo, unsigned char *src); +void GX2HideCursor(ScrnInfoPtr pScreenInfo); +void GX2ShowCursor(ScrnInfoPtr pScreenInfo); +static Bool GX2UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs); +extern void GX2SetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, + short drw_h, int id, int offset, + ScrnInfoPtr pScrn); + +/*---------------------------------------------------------------------------- + * GX2HWCursorInit. + * + * Description :This function sets the cursor information by probing the + * hardware. + * + * Parameters. + * pScreen :Screeen pointer structure. + * + * Returns :TRUE on success and FALSE on Failure + * + * Comments :Geode supports the hardware_cursor,no need to enable SW + * cursor. +*---------------------------------------------------------------------------- +*/ +Bool +GX2HWCursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + xf86CursorInfoPtr infoPtr; + + infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + /* the geode structure is intiallized with the cursor infoRec */ + pGeode->CursorInfo = infoPtr; + infoPtr->MaxWidth = 32; + infoPtr->MaxHeight = 32; + /* seeting up the cursor flags */ + infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; + /* cursor info ptr is intiallized with the values obtained from + * * durnago calls + */ + infoPtr->SetCursorColors = GX2SetCursorColors; + infoPtr->SetCursorPosition = GX2SetCursorPosition; + infoPtr->LoadCursorImage = GX2LoadCursorImage; + infoPtr->HideCursor = GX2HideCursor; + infoPtr->ShowCursor = GX2ShowCursor; + infoPtr->UseHWCursor = GX2UseHWCursor; + return (xf86InitCursor(pScreen, infoPtr)); +} + +/*---------------------------------------------------------------------------- + * GX2SetCursorColors. + * + * Description :This function sets the cursor foreground and background + * colors + * Parameters: + * pScreen: Screeen pointer structure. + * bg: Specifies the color value of cursor background color. + * fg: Specifies the color value of cursor foreground color. + * Returns: none. + * + * Comments: The integer color value passed by this function is + * converted into * RGB value by the gfx_set_color routines. + *---------------------------------------------------------------------------- + */ +static void +GX2SetCursorColors(ScrnInfoPtr pScreenInfo, int bg, int fg) +{ + GFX(set_cursor_colors(bg, fg)); +} + +/*---------------------------------------------------------------------------- + * GX2SetCursorPosition. + * + * Description :This function sets the cursor co -ordinates and enable the + * cursor. + * + * Parameters: + * pScreen: Screeen pointer structure. + * x: Specifies the x-cordinates of the cursor. + * y: Specifies the y co-ordinate of the cursor. + * Returns: none. + * + *---------------------------------------------------------------------------- + */ +static void +GX2SetCursorPosition(ScrnInfoPtr pScreenInfo, int x, int y) +{ + unsigned long offset; + static int panOffset = 0; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + unsigned short xhot = 0, yhot = 0; + + if (x < 0) { + xhot = (unsigned short)(-x); + x = 0; + } + if (y < 0) { + yhot = (unsigned short)(-y); + y = 0; + } + + GFX(set_cursor_position(pGeode->CursorStartOffset, x, y, xhot, yhot)); + GFX(set_cursor_enable(1)); + + if ((pGeode->OverlayON) && (pGeode->Panel)) { +#if defined(STB_X) + Gal_get_display_offset(&offset); +#else + offset = gfx_get_display_offset(); +#endif + if (offset != panOffset) { + GX2SetVideoPosition(pGeode->video_x, pGeode->video_y, + pGeode->video_w, pGeode->video_h, + pGeode->video_srcw, pGeode->video_srch, + pGeode->video_dstw, pGeode->video_dsth, + pGeode->video_id, pGeode->video_offset, + pGeode->video_scrnptr); + panOffset = offset; + } + } +} + +/*---------------------------------------------------------------------------- + * GX2LoadCursorImage + * + * Description :This function loads the 32x32 cursor pattern.The shape + * and color is set by AND and XOR masking of arrays of 32 + * DWORD. + * Parameters: + * pScreen: Screeen pointer structure. + * src : Specifies cursor data. + * Returns : none + * + *---------------------------------------------------------------------------- +*/ +void +GX2LoadCursorImage(ScrnInfoPtr pScreenInfo, unsigned char *src) +{ + int i, j; + unsigned long shape; + unsigned long mask; + unsigned long andMask[32] = { 0, }; + unsigned long xorMask[32] = { 0, }; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + j = 0; + for (i = 0; i < 32; i++) { + if (src) { + shape = ((unsigned long)src[i * 4] << 24) | + ((unsigned long)src[i * 4 + 1] << 16) | + ((unsigned long)src[i * 4 + 2] << 8) | + ((unsigned long)src[i * 4 + 3] << 0); + mask = ((unsigned long)src[i * 4 + 128] << 24) | + ((unsigned long)src[i * 4 + 1 + 128] << 16) | + ((unsigned long)src[i * 4 + 2 + 128] << 8) | + ((unsigned long)src[i * 4 + 3 + 128] << 0); + } else { + mask = 0x0; + shape = 0xFFFFFFFF; + } + + andMask[i] = ~(mask); + xorMask[i] = shape & mask; + } + + GFX(set_cursor_shape32(pGeode->CursorStartOffset, andMask, xorMask)); +} + +/*---------------------------------------------------------------------------- + * GX2HideCursor. + * + * Description :This function will disable the cursor. + * + * Parameters: + * pScreen: Handles to the Screeen pointer structure. + * + * Returns: none. + * + * Comments: gfx_set_cursor enable function is hardcoded to disable + * the cursor. + *---------------------------------------------------------------------------- + */ +void +GX2HideCursor(ScrnInfoPtr pScreenInfo) +{ + GFX(set_cursor_enable(0)); +} + +/*---------------------------------------------------------------------------- + * GX2ShowCursor + * + * Description :This function will enable the cursor. + * + * Parameters: + * pScreen :Handles to the Screeen pointer structure. + * + * Returns :none + * + * Comments :gfx_set_cursor enable function is hardcoded to enable the + * cursor + *---------------------------------------------------------------------------- +*/ +void +GX2ShowCursor(ScrnInfoPtr pScreenInfo) +{ + GFX(set_cursor_enable(1)); +} + +/*---------------------------------------------------------------------------- + * GX2UseHwCursor. + * + * Description :This function will sets the hardware cursor flag in + * pscreen structure. + * + * Parameters. + * pScreen :Handles to the Screeen pointer structure. + * + * Returns :none + * + * Comments :none + * + *---------------------------------------------------------------------------- +*/ +static Bool +GX2UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScreenInfo = XF86SCRNINFO(pScreen); + + if (pScreenInfo->currentMode->Flags & V_DBLSCAN) + return FALSE; + return TRUE; +} + +/* End of File */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_dga.c:1.2 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_dga.c Tue Jan 14 04:34:32 2003 @@ -0,0 +1,509 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_dga.c,v 1.2 2003/01/14 09:34:32 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_dga.c $ + * $Revision: 4 $ + * $Author: Sarma $ + * + * File contents: DGA(Direct Acess Graphics mode) is feature of + * XFree86 that allows the program to access directly to video + * memory on the graphics card.DGA supports the double + * flickering.This file has the functions to support the DGA + * modes. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xaa.h" +#include "xaalocal.h" +#include "nsc.h" +#include "dgaproc.h" + +/* forward declarations */ +Bool GX2DGAInit(ScreenPtr pScreen); +static Bool GX2_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static void GX2_CloseFramebuffer(ScrnInfoPtr pScrn); +static Bool GX2_SetMode(ScrnInfoPtr, DGAModePtr); +static int GX2_GetViewport(ScrnInfoPtr); +static void GX2_SetViewport(ScrnInfoPtr, int, int, int); +static void GX2_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); +static void GX2_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); + +extern void GX2AdjustFrame(int, int, int, int); +extern Bool GX2SwitchMode(int, DisplayModePtr, int); +extern void GX2AccelSync(ScrnInfoPtr pScreenInfo); + +static DGAFunctionRec GX2DGAFuncs = { + GX2_OpenFramebuffer, + GX2_CloseFramebuffer, + GX2_SetMode, + GX2_SetViewport, + GX2_GetViewport, + GX2AccelSync, + GX2_FillRect, + GX2_BlitRect, + NULL +}; + +/*---------------------------------------------------------------------------- + * GX2DGAInit. + * + * Description :This function is used to intiallize the DGA modes and sets the + viewport based on the screen mode. + * Parameters. + * pScreeen :Pointer to screen info structure. + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :This function prepares the DGA mode settings for + * other func reference. + * +*---------------------------------------------------------------------------- +*/ +Bool +GX2DGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GeodePtr pGeode = GEODEPTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0; + Bool oneMore; + + pMode = firstMode = pScrn->modes; + DEBUGMSG(0, (0, X_NONE, "GX2DGAInit %d\n", Bpp)); + while (pMode) { + + /* redundant but it can be used in future:if(0). */ + if (0) { /*pScrn->displayWidth != pMode->HDisplay */ + /* memory is allocated for dga to + *setup the viewport and mode parameters + */ + newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec)); + oneMore = TRUE; + } else { + /* one record is allocated here */ + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + oneMore = FALSE; + } + if (!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + + SECOND_PASS: /* DGA mode flgas and viewport parametrs are set here. */ + + currentMode = modes + num; + num++; + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pGeode->FBBase; + if (oneMore) { /* first one is narrow width */ + currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; + currentMode->imageWidth = pMode->HDisplay; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + oneMore = FALSE; + goto SECOND_PASS; + } else { + currentMode->bytesPerScanline = + ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + } + pMode = pMode->next; + if (pMode == firstMode) + break; + } + pGeode->numDGAModes = num; + pGeode->DGAModes = modes; + return DGAInit(pScreen, &GX2DGAFuncs, modes, num); +} + +/*---------------------------------------------------------------------------- + * GX2_SetMode. + * + * Description :This function is sets into the DGA mode. + *. + * Parameters. + * pScreeen :Pointer to screen info structure. + * pMode :Points to the DGAmode ptr data + * Returns :TRUE on success and FALSE on failure. + * + * Comments :none. + * + * +*---------------------------------------------------------------------------- +*/ +static Bool +GX2_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) +{ + static int OldDisplayWidth[MAXSCREENS]; + int index = pScrn->pScreen->myNum; + GeodePtr pGeode = GEODEPTR(pScrn); + + DEBUGMSG(0, (0, X_NONE, "GX2_SetMode\n")); + if (!pMode) { + /* restore the original mode + * * put the ScreenParameters back + */ + pScrn->displayWidth = OldDisplayWidth[index]; + DEBUGMSG(0, + (0, X_NONE, "GX2_SetMode !pMode %d\n", pScrn->displayWidth)); + GX2SwitchMode(index, pScrn->currentMode, 0); + pGeode->DGAactive = FALSE; + } else { + if (!pGeode->DGAactive) { /* save the old parameters */ + OldDisplayWidth[index] = pScrn->displayWidth; + pGeode->DGAactive = TRUE; + DEBUGMSG(0, + (0, X_NONE, "GX2_SetMode pMode+ NA %d\n", + pScrn->displayWidth)); + } + pScrn->displayWidth = pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3); + DEBUGMSG(0, + (0, X_NONE, "GX2_SetMode pMode+ %d\n", pScrn->displayWidth)); + GX2SwitchMode(index, pMode->mode, 0); + } + /* enable/disable Compression */ + if (pGeode->Compression) { + GFX(set_compression_enable(!pGeode->DGAactive)); + } + + /* enable/disable cursor */ + if (pGeode->HWCursor) { + GFX(set_cursor_enable(!pGeode->DGAactive)); + } + + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX2_GetViewPort. + * + * Description :This function is Gets the viewport window memory. + *. + * Parameters. + * pScrn :Pointer to screen info structure. + * + * Returns :returns the viewport status. + * + * Comments :none. + * + * +*---------------------------------------------------------------------------- +*/ +static int +GX2_GetViewport(ScrnInfoPtr pScrn) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + return pGeode->DGAViewportStatus; +} + +/*---------------------------------------------------------------------------- + * GX2_SetViewPort. + * + * Description :This function is Gets the viewport window memory. + * + * Parameters. + * pScrn :Pointer to screen info structure. + x :x-cordinate of viewport window + * y :y-codinate of the viewport window. + * flags :indicates the viewport to be flipped or not. + * Returns :returns the viewport status as zero. + * + * Comments :none. + * +*---------------------------------------------------------------------------- +*/ +static void +GX2_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + GX2AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + pGeode->DGAViewportStatus = 0; /*GX2AdjustFrame loops until finished */ +} + +/*---------------------------------------------------------------------------- + * GX2_FillRect. + * + * Description :This function is Gets the viewport window memory. + *. + * Parameters. + * pScrn :Pointer to screen info structure. + * x :x-cordinate of viewport window + * y :y-codinate of the viewport window. + * w :width of the rectangle + * h :height of the rectangle. + * color :color to be filled in rectangle. + * + * Returns :returns the viewport status as zero. + * + * Comments :This function is implemented by solidfill routines.. + * +*---------------------------------------------------------------------------- +*/ +static void +GX2_FillRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h, unsigned long color) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + if (pGeode->AccelInfoRec) { + (*pGeode->AccelInfoRec->SetupForSolidFill) (pScrn, color, GXcopy, ~0); + (*pGeode->AccelInfoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); + SET_SYNC_FLAG(pGeode->AccelInfoRec); + } +} + +/*---------------------------------------------------------------------------- + * GX2_BlitRect. + * + * Description :This function implementing Blit and it moves a + * Rectangular block of data from one location to other + * Location. + * + * Parameters. + * pScrn :Pointer to screen info structure. + * srcx :x-cordinate of the src rectangle + * srcy :y-codinate of src rectangle. + * w :width of the rectangle + * h :height of the rectangle. + * dstx :x-cordinate of the dst rectangle. + * dsty :y -coordinates of the dst rectangle. + * Returns :none. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static void +GX2_BlitRect(ScrnInfoPtr pScrn, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + if (pGeode->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pGeode->AccelInfoRec->SetupForScreenToScreenCopy) + (pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pGeode->AccelInfoRec->SubsequentScreenToScreenCopy) (pScrn, srcx, + srcy, dstx, dsty, + w, h); + SET_SYNC_FLAG(pGeode->AccelInfoRec); + } +} + +/*---------------------------------------------------------------------------- + * GX2_OpenFramebuffer. + * + * Description :This function open the framebuffer driver for DGA. + * + * Parameters. + * pScrn :Pointer to screen info structure. + * srcx :x-cordinate of the src rectangle + * srcy :y-codinate of src rectangle. + * w :width of the rectangle + * h :height of the rectangle. + * dstx :x-cordinate of the dst rectangle. + * dsty :y -coordinates of the dst rectangle. + * Returns :none. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static Bool +GX2_OpenFramebuffer(ScrnInfoPtr pScrn, + char **name, unsigned char **mem, + int *size, int *offset, int *flags) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char *)pGeode->FBLinearAddr; + *size = pGeode->FBSize; + *offset = 0; + *flags = DGA_NEED_ROOT; + return TRUE; +} + +static void +GX2_CloseFramebuffer(ScrnInfoPtr pScrn) +{ +} + +/* end of file */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_driver.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_driver.c:1.6 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_driver.c Wed Feb 12 08:08:54 2003 @@ -0,0 +1,2398 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_driver.c,v 1.6 2003/02/12 13:08:54 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_driver.c $ + * $Revision: 28 $ + * $Author: Sarma $ + * + * File Contents: This is the main module configures the interfacing + * with the X server. The individual modules will be + * loaded based upon the options selected from the + * XF86Config. This file also has modules for finding + * supported modes, turning on the modes based on options. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#define DEBUG(x) +#define GEODE_TRACE 0 +#define CFB 0 + +/* Includes that are used by all drivers */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +/* We may want inb() and outb() */ +#include "compiler.h" + +/* We may want to access the PCI config space */ +#include "xf86PciInfo.h" +#include "xf86Pci.h" + +#define INT10_SUPPORT 1 + +/* Colormap handling stuff */ +#include "xf86cmap.h" + +#define RC_MAX_DEPTH 24 + +/* Frame buffer stuff */ +#if CFB +/* + * If using cfb, cfb.h is required. Select the others for the bpp values + * the driver supports. + */ +#define PSZ 8 /* needed for cfb.h */ +#include "cfb.h" +#undef PSZ +#include "cfb16.h" +#include "cfb24.h" +#include "cfb32.h" +#else +#include "fb.h" +#endif + +#include "shadowfb.h" + +/* Machine independent stuff */ +#include "mipointer.h" +#include "mibank.h" +#include "micmap.h" +/* All drivers implementing backing store need this */ +#include "mibstore.h" +#include "vgaHW.h" +#include "vbe.h" + +/* Check for some extensions */ +#ifdef XFreeXDGA +#define _XF86_DGA_SERVER_ +#include "extensions/xf86dgastr.h" +#endif /* XFreeXDGA */ + +#ifdef DPMSExtension +#include "globals.h" +#include "opaque.h" +#define DPMS_SERVER +#include "extensions/dpms.h" +#endif /* DPMSExtension */ + +/* Our private include file (this also includes the durango headers) */ +#include "nsc.h" +#if !defined(STB_X) +#include "nsc_gx2_vga.c" +#endif /* STB_X */ + +#if GEODE_TRACE +/* ANSI C does not allow var arg macros */ +#define GeodeDebug(args) DebugPort(DCount++);ErrorF args +#else +#define GeodeDebug(args) +#endif + +extern SymTabRec GeodeChipsets[]; +extern PciChipsets GeodePCIchipsets[]; +extern OptionInfoRec GeodeOptions[]; + +/* Forward definitions */ +static Bool GX2PreInit(ScrnInfoPtr, int); +static Bool GX2ScreenInit(int, ScreenPtr, int, char **); +static Bool GX2EnterVT(int, int); +static void GX2LeaveVT(int, int); +static void GX2FreeScreen(int, int); +void GX2AdjustFrame(int, int, int, int); +Bool GX2SwitchMode(int, DisplayModePtr, int); +static int GX2ValidMode(int, DisplayModePtr, Bool, int); +static void GX2LoadPalette(ScrnInfoPtr pScreenInfo, + int numColors, int *indizes, + LOCO * colors, VisualPtr pVisual); +static Bool GX2MapMem(ScrnInfoPtr); +static Bool GX2UnmapMem(ScrnInfoPtr); +static void gx2_set_DvLineSize(unsigned int pitch); + +extern Bool GX2AccelInit(ScreenPtr pScreen); +extern Bool GX2HWCursorInit(ScreenPtr pScreen); +extern void GX2HideCursor(ScrnInfoPtr pScreenInfo); +extern void GX2ShowCursor(ScrnInfoPtr pScreenInfo); +extern void GX2PointerMoved(int index, int x, int y); +extern void GX2RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX2RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX2RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX2RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX2RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +extern void GX2InitVideo(ScreenPtr pScreen); +extern Bool GX2DGAInit(ScreenPtr pScreen); +extern void GX2LoadCursorImage(ScrnInfoPtr pScreenInfo, unsigned char *src); + +#if !defined(STB_X) +extern unsigned char *XpressROMPtr; +#endif /* STB_X */ + +/* Existing Processor Models */ +#define GX1 0x1 +#define GX2 0x2 +#define GX2_CRT 0x6 +#define GX2_TFT 0xA + +/* List of symbols from other modules that this module references.The purpose +* is that to avoid unresolved symbol warnings +*/ +extern const char *nscVgahwSymbols[]; +extern const char *nscVbeSymbols[]; +extern const char *nscInt10Symbols[]; + +#if CFB +extern const char *nscCfbSymbols[]; +#else +extern const char *nscFbSymbols[]; +#endif +extern const char *nscXaaSymbols[]; +extern const char *nscRamdacSymbols[]; +extern const char *nscShadowSymbols[]; + +void GX2SetupChipsetFPtr(ScrnInfoPtr pScrn); +GeodePtr GX2GetRec(ScrnInfoPtr pScreenInfo); +void get_flatpanel_info(const char *options, int *W, int *H, + int *D, int *C, int *T); +void gx2_clear_screen(int width, int height); +void EnableDACPower(void); +void redcloud_gfx_2_vga_fix(void); + +void +GX2SetupChipsetFPtr(ScrnInfoPtr pScrn) +{ + GeodeDebug(("GX2SetupChipsetFPtr!\n")); + + pScrn->PreInit = GX2PreInit; + pScrn->ScreenInit = GX2ScreenInit; + pScrn->SwitchMode = GX2SwitchMode; + pScrn->AdjustFrame = GX2AdjustFrame; + pScrn->EnterVT = GX2EnterVT; + pScrn->LeaveVT = GX2LeaveVT; + pScrn->FreeScreen = GX2FreeScreen; + pScrn->ValidMode = GX2ValidMode; +} + +/*---------------------------------------------------------------------------- + * GX2GetRec. + * + * Description :This function allocate an GeodeRec and hooked into + * pScreenInfo str driverPrivate member of ScreeenInfo + * structure. + * Parameters. + * pScreenInfo :Pointer handle to the screenonfo structure. + * + * Returns :allocated pScreeninfo structure. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +GeodePtr +GX2GetRec(ScrnInfoPtr pScreenInfo) +{ + if (!pScreenInfo->driverPrivate) { + GeodePtr pGeode; + + pGeode = pScreenInfo->driverPrivate = xnfcalloc(sizeof(GeodeRec), 1); +#if INT10_SUPPORT + pGeode->vesa = xcalloc(sizeof(VESARec), 1); +#endif + } + return GEODEPTR(pScreenInfo); +} + +/*---------------------------------------------------------------------------- + * GX2FreeRec. + * + * Description :This function deallocate an GeodeRec and freed from + * pScreenInfo str driverPrivate member of ScreeenInfo + * structure. + * Parameters. + * pScreenInfo :Pointer handle to the screenonfo structure. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static void +GX2FreeRec(ScrnInfoPtr pScreenInfo) +{ + if (pScreenInfo->driverPrivate == NULL) { + return; + } + xfree(pScreenInfo->driverPrivate); + pScreenInfo->driverPrivate = NULL; +} + +/*---------------------------------------------------------------------------- + * GX2SaveScreen. + * + * Description :This is todo the screen blanking + * + * Parameters. + * pScreen :Handle to ScreenPtr structure. + * mode :mode is used by vgaHWSaveScren to check blnak os on. + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :none +*---------------------------------------------------------------------------- +*/ +static Bool +GX2SaveScreen(ScreenPtr pScreen, int mode) +{ +#if !defined(STB_X) + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + + GeodeDebug(("GX2SaveScreen!\n")); + + if (!pScreenInfo->vtSema) + return vgaHWSaveScreen(pScreen, mode); + +#endif /* STB_X */ + return TRUE; +} + +/*---------------------------------------------------------------------------- + * get_flatpanel_info. + * + * Description :This gets the values of the flatpanel attached. + * + * Parameters: + * options : Pointer to the display options. + * W: Pointer to the width of the panel + * H: Pointer to the height of the panel + * D: Pointer to the depth of the panel. + * C: Pointer to the color of the panel. + * T: Pointer to the type of the panel. + * Returns : none. + * + * Comments :none + *------------------------------------------------------------------------ + */ +void +get_flatpanel_info(const char *options, int *W, int *H, + int *D, int *C, int *T) +{ + char *pnl_opt; + + pnl_opt = strtok((char *)options, ":"); + *W = strtoul(pnl_opt, NULL, 0); + pnl_opt = strtok(NULL, ":"); + *H = strtoul(pnl_opt, NULL, 0); + pnl_opt = strtok(NULL, ":"); + *D = strtoul(pnl_opt, NULL, 0); + pnl_opt = strtok(NULL, ":"); + *C = strtoul(pnl_opt, NULL, 0); + pnl_opt = strtok(NULL, ":"); + *T = strtoul(pnl_opt, NULL, 0); + + *C = (*C) ? PNL_COLOR_PANEL : PNL_MONO_PANEL; + + switch (*T) { + case 0: + *T = PNL_SSTN; + break; + case 1: + *T = PNL_DSTN; + break; + case 2: + default: + *T = PNL_TFT; + break; + } + + if ((*W != 640) && (*W != 800) && (*W != 1024)) + *W = 640; + + if ((*H != 480) && (*H != 600) && (*H != 768)) + *H = 480; +} + +static void +GX2ProbeDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL, index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } +} + +/*---------------------------------------------------------------------------- + * GX2PreInit. + * + * Description :This function is called only once ate teh server startup + * + * Parameters. + * pScreenInfo :Handle to ScreenPtr structure. + * flags :flags may be used to check the probeed one with config. + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :none. + *---------------------------------------------------------------------------- + */ +static Bool +GX2PreInit(ScrnInfoPtr pScreenInfo, int flags) +{ + static ClockRange GeodeClockRange = + { NULL, 25175, 229500, 0, FALSE, TRUE, 1, 1, 0 }; + MessageType from; + int i = 0; + GeodePtr pGeode; + char *mod = NULL; + +#if CFB + char *reqSymbol = NULL; +#endif /* CFB */ +#if defined(STB_X) + GAL_ADAPTERINFO sAdapterInfo; +#endif /* STB_X */ + unsigned int PitchInc = 0, minPitch = 0, maxPitch = 0; + unsigned int minHeight = 0, maxHeight = 0; + unsigned int SupportFlags; + const char *s; + char **modes; + +#if INT10_SUPPORT + VESAPtr pVesa; +#endif + + DCount = 10; + GeodeDebug(("GX2PreInit!\n")); + /* Allocate driver private structure */ + if (!(pGeode = GX2GetRec(pScreenInfo))) + return FALSE; + + /* This is the general case */ + for (i = 0; i < pScreenInfo->numEntities; i++) { + pGeode->pEnt = xf86GetEntityInfo(pScreenInfo->entityList[i]); + if (pGeode->pEnt->resources) + return FALSE; + pGeode->Chipset = pGeode->pEnt->chipset; + pScreenInfo->chipset = (char *)xf86TokenToString(GeodeChipsets, + pGeode->pEnt->chipset); + } + + if (flags & PROBE_DETECT) { + GX2ProbeDDC(pScreenInfo, pGeode->pEnt->index); + return TRUE; + } +#if INT10_SUPPORT + if (!xf86LoadSubModule(pScreenInfo, "int10")) + return FALSE; + xf86LoaderReqSymLists(nscInt10Symbols, NULL); +#endif + pGeode->FBVGAActive = 0; /* KFB will Knock of VGA */ + +#if !defined(STB_X) + /* If the vgahw module would be needed it would be loaded here */ + if (!xf86LoadSubModule(pScreenInfo, "vgahw")) { + return FALSE; + } + xf86LoaderReqSymLists(nscVgahwSymbols, NULL); +#endif /* STB_X */ + GeodeDebug(("GX2PreInit(1)!\n")); + /* Do the durango hardware detection */ +#if defined(STB_X) + if (!Gal_initialize_interface()) { + GeodeDebug(("GALintialize fail GX2PreInit(1.00)!\n")); + return FALSE; + } + + if (Gal_get_adapter_info(&sAdapterInfo)) { + pGeode->cpu_version = sAdapterInfo.dwCPUVersion; + + /* find the base chipset core. Currently there can be only one + * chip active at any time. + */ + if ((pGeode->cpu_version & 0xFF) == GFX_CPU_REDCLOUD) { + if (sAdapterInfo.dwCPUType) + pGeode->DetectedChipSet = GX2_TFT; + else + pGeode->DetectedChipSet = GX2_CRT; + } + + DEBUGMSG(1, + (0, X_NONE, "Detected BaseChip %d, %d\n", + pGeode->DetectedChipSet, sAdapterInfo.dwCPUType)); + + pGeode->vid_version = sAdapterInfo.dwVideoVersion; + pGeode->FBSize = sAdapterInfo.dwFrameBufferSize; + /* update the max clock from the one system suports */ + GeodeClockRange.maxClock = sAdapterInfo.dwMaxSupportedPixelClock; + pGeode->FBLinearAddr = sAdapterInfo.dwFrameBufferBase; +#if 0 + pGeode->FBBase = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, + pGeode->FBLinearAddr, + pGeode->FBSize); +#endif + if (!GX2MapMem(pScreenInfo)) + return FALSE; + DEBUGMSG(1, (0, X_NONE, "CPU=%x vid %x FB %x FBAdd %X\n", + pGeode->cpu_version, pGeode->vid_version, pGeode->FBSize, + pGeode->FBLinearAddr)); + } else { + return FALSE; + } +#else /* STB */ + pGeode->cpu_version = gfx_detect_cpu(); + + /* find the base chipset core. Currently there can be only one + * chip active at any time. + */ +/* pGeode->DetectedChipSet = GX1; */ + if ((pGeode->cpu_version & 0xFF) == GFX_CPU_REDCLOUD) + pGeode->DetectedChipSet = GX2; + GeodeDebug(("Detected BaseChip (%d)\n", pGeode->DetectedChipSet)); + { + Q_WORD msrValue; + + /* GX2 : Can have CRT or TFT only */ + gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msrValue); + pGeode->DetectedChipSet = + ((msrValue.low & RCDF_CONFIG_FMT_MASK) == + RCDF_CONFIG_FMT_FP) ? GX2_TFT : GX2_CRT; + GeodeDebug(("Gx2 for %s\n", + ((pGeode->DetectedChipSet == GX2_TFT) ? "TFT" : "CRT"))); + } + GeodeDebug(("GX2PreInit(1.1)!\n")); + pGeode->vid_version = gfx_detect_video(); + GeodeDebug(("GX2PreInit(1.2)!\n")); + pGeode->FBLinearAddr = gfx_get_frame_buffer_base(); + GeodeDebug(("GX2PreInit(1.3)!\n")); + pGeode->FBSize = gfx_get_frame_buffer_size(); + GeodeDebug(("GX2PreInit(1.4)!\n")); + /* update the max clock from the one system suports */ + GeodeClockRange.maxClock = gfx_get_max_supported_pixel_clock(); + + GeodeDebug(("GX2PreInit(1.5)!\n")); + /* SET DURANGO REGISTER POINTERS + * * The method of mapping from a physical address to a linear address + * * is operating system independent. Set variables to linear address. + */ + if (pGeode->DetectedChipSet & GX2) { + pGeode->cpu_reg_size = 0x4000; + pGeode->gp_reg_size = 0x4000; + pGeode->vid_reg_size = 0x4000; + } else { + pGeode->cpu_reg_size = 0x9000; + pGeode->vid_reg_size = 0x1000; + } + + if (!GX2MapMem(pScreenInfo)) + return FALSE; + + /* check if VGA is active */ + /* This routine saves the current VGA state in Durango VGA structure */ + /* check if VGA is active */ + pGeode->FBVGAActive = gu2_get_vga_active(); + +#endif /* STB_X */ + DEBUGMSG(1, (0, X_PROBED, "VGA = %d\n", pGeode->FBVGAActive)); + + /* Fill in the monitor field */ + pScreenInfo->monitor = pScreenInfo->confScreen->monitor; + GeodeDebug(("GX2PreInit(2)!\n")); + SupportFlags = Support24bppFb | Support32bppFb; + GeodeDebug(("GX2PreInit(2)!\n")); + /* Determine depth, bpp, etc. */ + if (!xf86SetDepthBpp(pScreenInfo, 8, 8, 8, SupportFlags)) { + return FALSE; + } else { + if (!((pScreenInfo->depth == 8) || + (pScreenInfo->depth == 16) || + (pScreenInfo->depth == 24) || (pScreenInfo->depth == 32))) { + /* Depth not supported */ + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "Given depth (%d bpp) is not supported by this driver\n", + pScreenInfo->depth)); + return FALSE; + } + } + + /*This must happen after pScreenInfo->display has been set + * * because xf86SetWeight references it. + */ + if (pScreenInfo->depth > 8) { + /* The defaults are OK for us */ + rgb BitsPerComponent = { 0, 0, 0 }; + rgb BitMask = { 0, 0, 0 }; + + if (pScreenInfo->depth > 16) { + /* we are operating in 24 bpp, Readcloud */ + BitsPerComponent.red = 8; + BitsPerComponent.green = 8; + BitsPerComponent.blue = 8; + + BitMask.red = 0xFF0000; + BitMask.green = 0x00FF00; + BitMask.blue = 0x0000FF; + } + if (!xf86SetWeight(pScreenInfo, BitsPerComponent, BitMask)) { + return FALSE; + } else { + /* XXX Check if the returned weight is supported */ + } + } + + xf86PrintDepthBpp(pScreenInfo); + + GeodeDebug(("GX2PreInit(3)!\n")); + + if (!xf86SetDefaultVisual(pScreenInfo, -1)) + return FALSE; + + GeodeDebug(("GX2PreInit(4)!\n")); + + /* The new cmap layer needs this to be initialized */ + if (pScreenInfo->depth > 1) { + Gamma zeros = { 0.0, 0.0, 0.0 }; + + if (!xf86SetGamma(pScreenInfo, zeros)) { + return FALSE; + } + } + GeodeDebug(("GX2PreInit(5)!\n")); + + /* We use a programmable clock */ + pScreenInfo->progClock = TRUE; + + /*Collect all of the relevant option flags + * *(fill in pScreenInfo->options) + */ + xf86CollectOptions(pScreenInfo, NULL); + + /*Process the options */ + xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, + GeodeOptions); + +#if INT10_SUPPORT + pVesa = pGeode->vesa; + /* Initialize Vesa record */ + + if ((pVesa->pInt = xf86InitInt10(pGeode->pEnt->index)) == NULL) { + xf86DrvMsg(0, X_ERROR, "Int10 initialization failed.\n"); + return (FALSE); + } +#endif + /*Set the bits per RGB for 8bpp mode */ + if (pScreenInfo->depth == 8) { + /* Default to 8 */ + pScreenInfo->rgbBits = 8; + } + from = X_DEFAULT; + + /* + * *The preferred method is to use the "hw cursor" option as a tri-state + * *option, with the default set above. + */ + pGeode->HWCursor = TRUE; + if (xf86GetOptValBool(GeodeOptions, OPTION_HW_CURSOR, &pGeode->HWCursor)) { + from = X_CONFIG; + } + /* For compatibility, accept this too (as an override) */ + if (xf86ReturnOptValBool(GeodeOptions, OPTION_SW_CURSOR, FALSE)) { + from = X_CONFIG; + pGeode->HWCursor = FALSE; + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, "Using %s cursor\n", + pGeode->HWCursor ? "HW" : "SW")); + + pGeode->Compression = TRUE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_NOCOMPRESSION, FALSE)) { + pGeode->Compression = FALSE; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "NoCompression\n")); + } + + pGeode->NoAccel = FALSE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_NOACCEL, FALSE)) { + pGeode->NoAccel = TRUE; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "Acceleration \ + disabled\n")); + } + + if (!xf86GetOptValInteger(GeodeOptions, OPTION_OSM_IMG_BUFS, + &(pGeode->NoOfImgBuffers))) + pGeode->NoOfImgBuffers = DEFAULT_NUM_OF_BUF; /* default # of buffers */ + if (pGeode->NoOfImgBuffers <= 0) + pGeode->NoOfImgBuffers = 0; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "NoOfImgBuffers = %d\n", pGeode->NoOfImgBuffers)); + + pGeode->Panel = FALSE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_FLATPANEL, FALSE)) { + DEBUGMSG(0, (pScreenInfo->scrnIndex, X_CONFIG, "FlatPanel Selected\n")); + pGeode->Panel = TRUE; + } + + /* Force the Panel on if on a GX2 TFT part, no crt support */ + if (pGeode->DetectedChipSet == GX2_TFT) { + pGeode->Panel = TRUE; + } + + /* If on a CRT and Panel flag set, disable Panel */ + if ((pGeode->DetectedChipSet == GX2_CRT) && (pGeode->Panel)) + pGeode->Panel = FALSE; + + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Quering FP Bios %d\n", pGeode->Panel)); + + /* if FP not supported in BIOS, then turn off user option */ + if (pGeode->Panel) { + /* check if bios supports FP */ +#if defined(STB_X) + Gal_pnl_enabled_in_bios(&pGeode->Panel); + Gal_pnl_info_from_bios(&pGeode->FPBX, &pGeode->FPBY, + &pGeode->FPBB, &pGeode->FPBF); +#else /* STB_X */ + pGeode->Panel = Pnl_IsPanelEnabledInBIOS(); + Pnl_GetPanelInfoFromBIOS(&pGeode->FPBX, &pGeode->FPBY, + &pGeode->FPBB, &pGeode->FPBF); +#endif /* STB_X */ + } + + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Quering FP Bios %d %d %d %d\n", + pGeode->FPBX, pGeode->FPBY, pGeode->FPBB, pGeode->FPBF)); + + /* if panel not selected and Panel can be supported. + * Power down the panel. + */ + if (!pGeode->Panel) { +#if defined(STB_X) + Gal_pnl_powerdown(); +#else /* STB_X */ + Pnl_PowerDown(); +#endif /* STB_X */ + } else { +#if defined(STB_X) + Gal_pnl_powerup(); +#else + Pnl_PowerUp(); +#endif /* STB_X */ + } + + pGeode->ShadowFB = FALSE; + if (xf86ReturnOptValBool(GeodeOptions, OPTION_SHADOW_FB, FALSE)) { + pGeode->ShadowFB = TRUE; + pGeode->NoAccel = TRUE; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Using \"Shadow Framebuffer\" - acceleration disabled\n")); + } + + pGeode->Rotate = 0; + if ((s = xf86GetOptValString(GeodeOptions, OPTION_ROTATE))) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "Rotating - %s\n", s)); + if (!xf86NameCmp(s, "CW")) { + pGeode->ShadowFB = TRUE; + pGeode->NoAccel = TRUE; + pGeode->HWCursor = FALSE; + pGeode->Rotate = 1; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n")); + } else { + if (!xf86NameCmp(s, "CCW")) { + pGeode->ShadowFB = TRUE; + pGeode->NoAccel = TRUE; + pGeode->HWCursor = FALSE; + pGeode->Rotate = -1; + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise - acceleration \ + disabled\n")); + } else { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", + s)); + DEBUGMSG(1, + (pScreenInfo->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n")); + } + } + } + + /* XXX Init further private data here */ + + /* + * * This shouldn't happen because such problems should be caught in + * * GeodeProbe(), but check it just in case. + */ + if (pScreenInfo->chipset == NULL) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "ChipID 0x%04X is not recognised\n", pGeode->Chipset)); + return FALSE; + } + if (pGeode->Chipset < 0) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "Chipset \"%s\" is not recognised\n", + pScreenInfo->chipset)); + return FALSE; + } + GeodeDebug(("GX2PreInit(6)!\n")); + + /* + * * Init the screen with some values + */ +#if !defined(STB_X) + + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "Video I/O registers at 0x%08lX\n", + (unsigned long)VGAHW_GET_IOBASE())); +#endif /* STB_X */ + + if (pScreenInfo->memPhysBase == 0) { + from = X_PROBED; +#if defined(STB_X) + pScreenInfo->memPhysBase = sAdapterInfo.dwFrameBufferBase; +#else /* STB_X */ + pScreenInfo->memPhysBase = gfx_get_frame_buffer_base(); +#endif /* STB_X */ + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "Linear framebuffer at 0x%08lX\n", + (unsigned long)pScreenInfo->memPhysBase)); + + if (pGeode->pEnt->device->videoRam == 0) { + from = X_PROBED; + pScreenInfo->videoRam = pGeode->FBSize / 1024; + } else { + pScreenInfo->videoRam = pGeode->pEnt->device->videoRam; + from = X_CONFIG; + } + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "VideoRam: %d kByte\n", + (unsigned long)pScreenInfo->videoRam)); + + GeodeDebug(("GX2PreInit(7)!\n")); + + /* + * * xf86ValidateModes will check that the mode HTotal and VTotal values + * * don't exceed the chipset's limit if pScreenInfo->maxHValue adn + * * pScreenInfo->maxVValue are set. Since our GX2ValidMode() + * * already takes care of this, we don't worry about setting them here. + */ + /* Select valid modes from those available */ + /* + * * min pitch 1024, max 2048 (Pixel count) + * * min height 480, max 1024 (Pixel count) + */ + minPitch = 1024; + maxPitch = 4096; /* Can support upto 1600x1200 32Bpp */ + minHeight = 480; + maxHeight = 1200; /* Can support upto 1600x1200 32Bpp */ + if (pScreenInfo->depth > 16) { + PitchInc = 4096; + } else if (pScreenInfo->depth == 16) { + PitchInc = 2048; + } else { + PitchInc = 1024; + } + PitchInc <<= 3; /* in bits */ + + /* by default use what user sets in the XF86Config file */ + modes = pScreenInfo->display->modes; + + i = xf86ValidateModes(pScreenInfo, + pScreenInfo->monitor->Modes, + modes, + &GeodeClockRange, + NULL, minPitch, maxPitch, + PitchInc, minHeight, maxHeight, + pScreenInfo->display->virtualX, + pScreenInfo->display->virtualY, +#if defined(STB_X) + sAdapterInfo.dwFrameBufferSize, +#else /* STB_X */ + gfx_get_frame_buffer_size(), +#endif /* STB_X */ + LOOKUP_BEST_REFRESH); + + DEBUGMSG(1, (pScreenInfo->scrnIndex, from, + "xf86ValidateModes: %d %d %d\n", + pScreenInfo->virtualX, + pScreenInfo->virtualY, pScreenInfo->displayWidth)); + if (i == -1) { + GX2FreeRec(pScreenInfo); + return FALSE; + } + GeodeDebug(("GX2PreInit(8)!\n")); + + /* Prune the modes marked as invalid */ + xf86PruneDriverModes(pScreenInfo); + + GeodeDebug(("GX2PreInit(9)!\n")); + if (i == 0 || pScreenInfo->modes == NULL) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "No valid modes found\n")); + GX2FreeRec(pScreenInfo); + return FALSE; + } + GeodeDebug(("GX2PreInit(10)!\n")); + + xf86SetCrtcForModes(pScreenInfo, 0); + GeodeDebug(("GX2PreInit(11)!\n")); + + /* Set the current mode to the first in the list */ + pScreenInfo->currentMode = pScreenInfo->modes; + GeodeDebug(("GX2PreInit(12)!\n")); + + /* Print the list of modes being used */ + xf86PrintModes(pScreenInfo); + GeodeDebug(("GX2PreInit(13)!\n")); + + /* Set the display resolution */ + xf86SetDpi(pScreenInfo, 0, 0); + GeodeDebug(("GX2PreInit(14)!\n")); + + /* Load bpp-specific modules */ + mod = NULL; + +#if CFB + /* Load bpp-specific modules */ + switch (pScreenInfo->bitsPerPixel) { + case 8: + mod = "cfb"; + reqSymbol = "cfbScreenInit"; + break; + case 16: + mod = "cfb16"; + reqSymbol = "cfb16ScreenInit"; + break; + case 24: + mod = "cfb24"; + reqSymbol = "cfb24ScreenInit"; + break; + case 32: + mod = "cfb32"; + reqSymbol = "cfb32ScreenInit"; + break; + default: + return FALSE; + } + if (mod && xf86LoadSubModule(pScreenInfo, mod) == NULL) { + GX2FreeRec(pScreenInfo); + return FALSE; + } + + xf86LoaderReqSymbols(reqSymbol, NULL); +#else + if (xf86LoadSubModule(pScreenInfo, "fb") == NULL) { + GX2FreeRec(pScreenInfo); + return FALSE; + } + + xf86LoaderReqSymLists(nscFbSymbols, NULL); +#endif + GeodeDebug(("GX2PreInit(15)!\n")); + if (pGeode->NoAccel == FALSE) { + if (!xf86LoadSubModule(pScreenInfo, "xaa")) { + GX2FreeRec(pScreenInfo); + return FALSE; + } + xf86LoaderReqSymLists(nscXaaSymbols, NULL); + } + GeodeDebug(("GX2PreInit(16)!\n")); + if (pGeode->HWCursor == TRUE) { + if (!xf86LoadSubModule(pScreenInfo, "ramdac")) { + GX2FreeRec(pScreenInfo); + return FALSE; + } + xf86LoaderReqSymLists(nscRamdacSymbols, NULL); + } + GeodeDebug(("GX2PreInit(17)!\n")); + /* Load shadowfb if needed */ + if (pGeode->ShadowFB) { + if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) { + GX2FreeRec(pScreenInfo); + return FALSE; + } + xf86LoaderReqSymLists(nscShadowSymbols, NULL); + } + GeodeDebug(("GX2PreInit(18)!\n")); + if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) { + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_ERROR, + "xf86RegisterResources() found resource conflicts\n")); + GX2FreeRec(pScreenInfo); + return FALSE; + } + GX2UnmapMem(pScreenInfo); + GeodeDebug(("GX2PreInit ... done successfully!\n")); + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX2Restore. + * + * Description :This function restores the mode that was saved on server + entry + * Parameters. + * pScreenInfo :Handle to ScreenPtr structure. + * Pmode :poits to screen mode + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static void +GX2Restore(ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode; + + GeodeDebug(("GX2Restore!\n")); + /* Get driver private structure */ + if (!(pGeode = GX2GetRec(pScreenInfo))) + return; + if (pGeode->FBVGAActive) { + vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); + + vgaHWProtect(pScreenInfo, TRUE); + vgaHWRestore(pScreenInfo, &pvgaHW->SavedReg, VGA_SR_ALL); + vgaHWProtect(pScreenInfo, FALSE); + } +} + +/*---------------------------------------------------------------------------- + * GX2CalculatePitchBytes. + * + * Description :This function restores the mode that was saved on server + * + * Parameters. + * pScreenInfo :Handle to ScreenPtr structure. + * Pmode :Points to screenmode + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static int +GX2CalculatePitchBytes(unsigned int width, unsigned int bpp) +{ + int lineDelta = width * (bpp >> 3); + + if (width < 640) { + /* low resolutions have both pixel and line doubling */ + DEBUGMSG(1, (0, X_PROBED, "lower resolution %d %d\n", + width, lineDelta)); + lineDelta <<= 1; + } + /* needed in Rotate mode when in accel is turned off */ + if (1) { /*!pGeode->NoAccel */ + if (lineDelta > 4096) + lineDelta = 8192; + else if (lineDelta > 2048) + lineDelta = 4096; + else if (lineDelta > 1024) + lineDelta = 2048; + else + lineDelta = 1024; + } + + DEBUGMSG(1, (0, X_PROBED, "pitch %d %d\n", width, lineDelta)); + + return lineDelta; +} + +/*---------------------------------------------------------------------------- + * GX2GetRefreshRate. + * + * Description :This function restores the mode that saved on server + * + * Parameters. + * Pmode :Pointer to the screen modes + * + * Returns :It returns the selected refresh rate. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static int +GX2GetRefreshRate(DisplayModePtr pMode) +{ +#define THRESHOLD 2 + unsigned int i; + static int validRates[] = { 50, 56, 60, 70, 72, 75, 85 }; /* Hz */ + unsigned long dotClock; + int refreshRate; + int selectedRate; + + dotClock = pMode->SynthClock * 1000; + refreshRate = dotClock / pMode->CrtcHTotal / pMode->CrtcVTotal; + + if ((pMode->CrtcHTotal < 640) && (pMode->CrtcVTotal < 480)) + refreshRate >>= 2; /* double pixel and double scan */ + + DEBUGMSG(1, (0, X_PROBED, "dotclock %d %d\n", dotClock, refreshRate)); + + selectedRate = validRates[0]; + + for (i = 0; i < (sizeof(validRates) / sizeof(validRates[0])); i++) { + if (validRates[i] < (refreshRate + THRESHOLD)) { + selectedRate = validRates[i]; + } + } + return selectedRate; +} + +void +gx2_clear_screen(int width, int height) +{ + /* clean up the frame buffer memory */ + GFX(set_solid_pattern(0)); + GFX(set_raster_operation(0xF0)); + GFX(pattern_fill(0, 0, width, height)); +} + +void +gx2_set_DvLineSize(unsigned int pitch) +{ + unsigned long temp, dv_size = MDC_DV_LINE_SIZE_1024; + + if (pitch > 1024) { + dv_size = MDC_DV_LINE_SIZE_2048; + } + if (pitch > 2048) { + dv_size = MDC_DV_LINE_SIZE_4096; + } + if (pitch > 4096) { + dv_size = MDC_DV_LINE_SIZE_8192; + } + + /* WRITE DIRTY/VALID CONTROL WITH LINE LENGTH */ + +#if defined(STB_X) + Gal_read_register(GAL_REG, MDC_DV_CTL, &temp, 4); + temp = (temp & ~MDC_DV_LINE_SIZE_MASK) | dv_size; + Gal_write_register(GAL_REG, MDC_DV_CTL, temp, 4); +#else + temp = READ_REG32(MDC_DV_CTL); + WRITE_REG32(MDC_DV_CTL, (temp & ~MDC_DV_LINE_SIZE_MASK) | dv_size); +#endif +} + +/*---------------------------------------------------------------------------- + * GX2SetMode. + * + * Description :This function sets parametrs for screen mode + * + * Parameters. + * pScreenInfo :Pointer to the screenInfo structure. + * Pmode :Pointer to the screen modes + * + * Returns :TRUE on success and FALSE on Failure. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ + +static Bool +GX2SetMode(ScrnInfoPtr pScreenInfo, DisplayModePtr pMode) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + DCount = 50; + /* unsigned int compOffset, compPitch, compSize; */ + GeodeDebug(("GX2SetMode!\n")); +#if !defined(STB_X) + DEBUGMSG(1, (0, X_NONE, "Set mode %X %X %X %X %X\n", + gfx_virt_regptr, + gfx_virt_gpptr, + gfx_virt_spptr, gfx_virt_vidptr, gfx_virt_fbptr)); +#endif /* STB_X */ + + /* Set the VT semaphore */ + pScreenInfo->vtSema = TRUE; + DEBUGMSG(1, (0, X_NONE, "Set mode")); + + /* The timing will be adjusted later */ + GeodeDebug(("Set display mode: %dx%d-%d (%dHz) Pitch %d\n", + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX2GetRefreshRate(pMode), pGeode->Pitch)); + + GeodeDebug(("Before setting the mode\n")); + if (1) { + { /* TV not selected */ + + DEBUGMSG(1, (0, X_PROBED, "Setting Display for CRT or TFT\n")); + + if (pGeode->Panel) { + DEBUGMSG(0, (0, X_PROBED, "Setting Display for TFT\n")); + DEBUGMSG(1, (0, X_PROBED, "Restore Panel %d %d %d %d %d\n", + pGeode->FPBX, pGeode->FPBY, + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, pScreenInfo->bitsPerPixel)); + + DEBUGMSG(1, (pScreenInfo->scrnIndex, X_CONFIG, "FP Bios %d\n", + pGeode->Panel)); + GFX(set_fixed_timings(pGeode->FPBX, pGeode->FPBY, + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel)); + } else { + /* display is crt */ + DEBUGMSG(1, (0, X_PROBED, "Setting Display for CRT %dx%d-%d@%d\n", + pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX2GetRefreshRate(pMode))); + GFX(set_display_mode(pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX2GetRefreshRate(pMode))); + + /* adjust the pitch */ + GFX(set_display_pitch(pGeode->Pitch)); + } + GFX(set_bpp(pScreenInfo->bitsPerPixel)); + /* enable crt */ + GFX(set_crt_enable(CRT_ENABLE)); + } + GFX(set_display_offset(0L)); + GFX(wait_vertical_blank()); + + DEBUGMSG(1, (0, X_PROBED, "Display mode set\n")); + /* enable compression if option selected */ + if (pGeode->Compression) { + DEBUGMSG(1, (0, X_PROBED, "Compression mode set %d\n", + pGeode->Compression)); + /* set the compression parameters,and it will be turned on later. */ + gx2_set_DvLineSize(pGeode->Pitch); + +#if defined(STB_X) + Gal_set_compression_parameters(GAL_COMPRESSION_ALL, + pGeode->CBOffset, + pGeode->CBPitch, pGeode->CBSize); + + /* set the compression buffer, all parameters already set */ + Gal_set_compression_enable(GAL_COMPRESSION_ENABLE); +#else /* STB_X */ + gfx_set_compression_offset(pGeode->CBOffset); + gfx_set_compression_pitch(pGeode->CBPitch); + gfx_set_compression_size(pGeode->CBSize); + + /* set the compression buffer, all parameters already set */ + gfx_set_compression_enable(1); +#endif /* STB_X */ + + } + if (pGeode->HWCursor) { + /* Load blank cursor */ + GX2LoadCursorImage(pScreenInfo, NULL); + GFX(set_cursor_position(pGeode->CursorStartOffset, 0, 0, 0, 0)); + GFX(set_cursor_enable(1)); + } + } else { + GeodeDebug(("GX2Restore ... ")); + GX2Restore(pScreenInfo); + GeodeDebug(("done.\n")); + } + + GeodeDebug(("done.\n")); + /* Reenable the hardware cursor after the mode switch */ + if (pGeode->HWCursor == TRUE) { + GeodeDebug(("GX2ShowCursor ... ")); + GX2ShowCursor(pScreenInfo); + GeodeDebug(("done.\n")); + } + /* Restore the contents in the screen info */ + GeodeDebug(("After setting the mode\n")); + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX2EnterGraphics. + * + * Description :This function will intiallize the displaytiming + structure for nextmode and switch to VGA mode. + * + * Parameters. + * pScreen :Screen information will be stored in this structure. + * pScreenInfo :Pointer to the screenInfo structure. + * + * Returns :TRUE on success and FALSE on Failure. + * + * Comments :gfx_vga_mode_switch() will start and end the + * switching based on the arguments 0 or 1.soft_vga + * is disabled in this function. +*---------------------------------------------------------------------------- +*/ +static Bool +GX2EnterGraphics(ScreenPtr pScreen, ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode = GX2GetRec(pScreenInfo); + +#if defined(STB_X) + Gal_get_display_timing(&pGeode->FBgfxdisplaytiming); + + /* Save Display offset */ + Gal_get_display_offset(&(pGeode->FBDisplayOffset)); + + /* Save the current Compression state */ + Gal_get_compression_enable(&(pGeode->FBCompressionEnable)); + Gal_get_compression_parameters(GAL_COMPRESSION_ALL, + &(pGeode->FBCompressionOffset), + &(pGeode->FBCompressionPitch), + &(pGeode->FBCompressionSize)); + + /* Save Cursor offset */ + { + unsigned short x, y, xhot, yhot; + + Gal_get_cursor_position(&(pGeode->FBCursorOffset), + &x, &y, &xhot, &yhot); + } + /* Save the Panel state */ + Gal_pnl_save(); +#else /* STB_X */ + /* Save CRT State */ + pGeode->FBgfxdisplaytiming.dwDotClock = gfx_get_clock_frequency(); + pGeode->FBgfxdisplaytiming.wPitch = gfx_get_display_pitch(); + pGeode->FBgfxdisplaytiming.wBpp = gfx_get_display_bpp(); + pGeode->FBgfxdisplaytiming.wHTotal = gfx_get_htotal(); + pGeode->FBgfxdisplaytiming.wHActive = gfx_get_hactive(); + pGeode->FBgfxdisplaytiming.wHSyncStart = gfx_get_hsync_start(); + pGeode->FBgfxdisplaytiming.wHSyncEnd = gfx_get_hsync_end(); + pGeode->FBgfxdisplaytiming.wHBlankStart = gfx_get_hblank_start(); + pGeode->FBgfxdisplaytiming.wHBlankEnd = gfx_get_hblank_end(); + pGeode->FBgfxdisplaytiming.wVTotal = gfx_get_vtotal(); + pGeode->FBgfxdisplaytiming.wVActive = gfx_get_vactive(); + pGeode->FBgfxdisplaytiming.wVSyncStart = gfx_get_vsync_start(); + pGeode->FBgfxdisplaytiming.wVSyncEnd = gfx_get_vsync_end(); + pGeode->FBgfxdisplaytiming.wVBlankStart = gfx_get_vblank_start(); + pGeode->FBgfxdisplaytiming.wVBlankEnd = gfx_get_vblank_end(); + pGeode->FBgfxdisplaytiming.wPolarity = gfx_get_sync_polarities(); + + /* Save Display offset */ + pGeode->FBDisplayOffset = gfx_get_display_offset(); + + /* Save the current Compression state */ + pGeode->FBCompressionEnable = gfx_get_compression_enable(); + pGeode->FBCompressionOffset = gfx_get_compression_offset(); + pGeode->FBCompressionPitch = gfx_get_compression_pitch(); + pGeode->FBCompressionSize = gfx_get_compression_size(); + + /* Save Cursor offset */ + pGeode->FBCursorOffset = gfx_get_cursor_offset(); + + /* Save the Panel state */ + Pnl_SavePanelState(); + + /* only if comming from VGA */ + if (pGeode->FBVGAActive) { + unsigned short sequencer; + vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); + + /* Map VGA aperture */ + if (!vgaHWMapMem(pScreenInfo)) + return FALSE; + + /* Unlock VGA registers */ + vgaHWUnlock(pvgaHW); + + /* Save the current state and setup the current mode */ + vgaHWSave(pScreenInfo, &VGAHWPTR(pScreenInfo)->SavedReg, VGA_SR_ALL); + + /* DISABLE VGA SEQUENCER */ + /* This allows the VGA state machine to terminate. We must delay */ + /* such that there are no pending MBUS requests. */ + + gfx_outb(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_CLK_MODE); + sequencer = gfx_inb(MDC_SEQUENCER_DATA); + sequencer |= MDC_CLK_MODE_SCREEN_OFF; + gfx_outb(MDC_SEQUENCER_DATA, sequencer); + + gfx_delay_milliseconds(1); + + /* BLANK THE VGA DISPLAY */ + gfx_outw(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_RESET); + sequencer = gfx_inb(MDC_SEQUENCER_DATA); + sequencer &= ~MDC_RESET_VGA_DISP_ENABLE; + gfx_outb(MDC_SEQUENCER_DATA, sequencer); + + gfx_delay_milliseconds(1); + } +#endif /* STB */ + + if (!GX2SetMode(pScreenInfo, pScreenInfo->currentMode)) { + return FALSE; + } + + /* clear the frame buffer, for annoying noise during mode switch */ + gx2_clear_screen(pScreenInfo->currentMode->CrtcHDisplay, + pScreenInfo->currentMode->CrtcVDisplay); + + return TRUE; +} + +#if !defined(STB_X) +void +EnableDACPower(void) +{ + /* enable the DAC POWER */ + gfx_write_vid32(RCDF_VID_MISC, + gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH); +} + +void +redcloud_gfx_2_vga_fix(void) +{ + /* enable the DAC POWER */ + EnableDACPower(); +#if 0 + int i; + + /* set the character width to 9 */ + gfx_outb(0x3C4, 0x1); + gfx_outb(0x3C5, 0x2); + + /* clear the gfx mode bit in VGA Attribute controller */ + gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x30); + gfx_outb(0x3C0, 0xC); + + /* Re init the EGA Palaette */ + for (i = 0; i < 16; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + gfx_outb(0x3C0, i); + } + + /* Re init the Overscan color to black */ + gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x11); + gfx_outb(0x3C0, 0x0); + + /* Re Enable all the 4 color planes */ + gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x12); + gfx_outb(0x3C0, 0xF); + + /* Clear Pixel Panning in VGA Attribute controller */ + gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x33); + gfx_outb(0x3C0, 0x8); + + /* ??????????????????????? */ + gfx_outb(0x3C0, 0x20); + gfx_outb(0x3C0, 0x20); +#endif +} +#endif /* STB_X */ + +/*---------------------------------------------------------------------------- + * GX2LeaveGraphics: + * + * Description :This function will restore the displaymode parameters + * and switches the VGA mode + * + * Parameters. + * pScreen :Screen information will be stored in this structure. + * pScreenInfo :Pointer to the screenInfo structure. + * + * + * Returns :none. + * + * Comments : gfx_vga_mode_switch() will start and end the switching + * based on the arguments 0 or 1.soft_vga is disabled in + * this function. +*---------------------------------------------------------------------------- +*/ +static void +GX2LeaveGraphics(ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode = GX2GetRec(pScreenInfo); + + /* Restore VG registers */ +#if defined(STB_X) + Gal_set_display_timing(&pGeode->FBgfxdisplaytiming); + + Gal_set_display_offset(pGeode->FBDisplayOffset); + + /* Restore Cursor */ + Gal_set_cursor_position(pGeode->FBCursorOffset, 0, 0, 0, 0); + + /* Restore the previous Compression state */ + if (pGeode->FBCompressionEnable) { + Gal_set_compression_parameters(GAL_COMPRESSION_ALL, + pGeode->FBCompressionOffset, + pGeode->FBCompressionPitch, + pGeode->FBCompressionSize); + + Gal_set_compression_enable(GAL_COMPRESSION_ENABLE); + } +#else /* STB_X */ + gfx_set_display_timings(pGeode->FBgfxdisplaytiming.wBpp, + pGeode->FBgfxdisplaytiming.wPolarity, + pGeode->FBgfxdisplaytiming.wHActive, + pGeode->FBgfxdisplaytiming.wHBlankStart, + pGeode->FBgfxdisplaytiming.wHSyncStart, + pGeode->FBgfxdisplaytiming.wHSyncEnd, + pGeode->FBgfxdisplaytiming.wHBlankEnd, + pGeode->FBgfxdisplaytiming.wHTotal, + pGeode->FBgfxdisplaytiming.wVActive, + pGeode->FBgfxdisplaytiming.wVBlankStart, + pGeode->FBgfxdisplaytiming.wVSyncStart, + pGeode->FBgfxdisplaytiming.wVSyncEnd, + pGeode->FBgfxdisplaytiming.wVBlankEnd, + pGeode->FBgfxdisplaytiming.wVTotal, + pGeode->FBgfxdisplaytiming.dwDotClock); + + gfx_set_compression_enable(0); + + /* Restore the previous Compression state */ + if (pGeode->FBCompressionEnable) { + gfx_set_compression_offset(pGeode->FBCompressionOffset); + gfx_set_compression_pitch(pGeode->FBCompressionPitch); + gfx_set_compression_size(pGeode->FBCompressionSize); + gfx_set_compression_enable(1); + } + + gfx_set_display_pitch(pGeode->FBgfxdisplaytiming.wPitch); + + gfx_set_display_offset(pGeode->FBDisplayOffset); + + /* Restore Cursor */ + gfx_set_cursor_position(pGeode->FBCursorOffset, 0, 0, 0, 0); + + GeodeDebug(("FBVGAActive %d\n", pGeode->FBVGAActive)); + if (pGeode->FBVGAActive) { + pGeode->vesa->pInt->num = 0x10; + pGeode->vesa->pInt->ax = 0x3; + pGeode->vesa->pInt->bx = 0; + xf86ExecX86int10(pGeode->vesa->pInt); + gfx_delay_milliseconds(3); + EnableDACPower(); + } +#endif /* STB_X */ +} + +/*---------------------------------------------------------------------------- + * GX2CloseScreen. + * + * Description :This function will restore the original mode + * and also it unmap video memory + * + * Parameters. + * ScrnIndex :Screen index value of the screen will be closed. + * pScreen :Pointer to the screen structure. + * + * + * Returns :TRUE on success and FALSE on Failure. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static Bool +GX2CloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + if (pGeode->ShadowPtr) + xfree(pGeode->ShadowPtr); + + DEBUGMSG(0, (scrnIndex, X_PROBED, "GX2CloseScreen %d\n", + pScreenInfo->vtSema)); + if (pScreenInfo->vtSema) + GX2LeaveGraphics(pScreenInfo); + + if (pGeode->AccelInfoRec) + XAADestroyInfoRec(pGeode->AccelInfoRec); + + if (pGeode->AccelImageWriteBufferOffsets) { + xfree(pGeode->AccelImageWriteBufferOffsets); + pGeode->AccelImageWriteBufferOffsets = 0x0; + } + /* free the allocated off screen area */ + xf86FreeOffscreenArea(pGeode->AccelImgArea); + xf86FreeOffscreenArea(pGeode->CompressionArea); + + pScreenInfo->vtSema = FALSE; + + GX2UnmapMem(pScreenInfo); + if (pGeode && (pScreen->CloseScreen = pGeode->CloseScreen)) { + pGeode->CloseScreen = NULL; + return ((*pScreen->CloseScreen) (scrnIndex, pScreen)); + } + return TRUE; +} + +#ifdef DPMSExtension +/*---------------------------------------------------------------------------- + * GX2DPMSSet. + * + * Description :This function sets geode into Power Management + * Signalling mode. + * + * Parameters. + * pScreenInfo :Pointer to screen info strucrure. + * mode :Specifies the power management mode. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static void +GX2DPMSSet(ScrnInfoPtr pScreenInfo, int mode, int flags) +{ + GeodePtr pGeode; + + pGeode = GEODEPTR(pScreenInfo); + + GeodeDebug(("GX2DPMSSet!\n")); + + /* Check if we are actively controlling the display */ + if (!pScreenInfo->vtSema) { + ErrorF("GX2DPMSSet called when we not controlling the VT!\n"); + return; + } + switch (mode) { + case DPMSModeOn: + /* Screen: On; HSync: On; VSync: On */ + GFX(set_crt_enable(CRT_ENABLE)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerup(); +#else /* STB_X */ + if (pGeode->Panel) + Pnl_PowerUp(); +#endif /* STB_X */ + break; + + case DPMSModeStandby: + /* Screen: Off; HSync: Off; VSync: On */ + GFX(set_crt_enable(CRT_STANDBY)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerdown(); +#else /* STB_X */ + if (pGeode->Panel) + Pnl_PowerDown(); +#endif /* STB_X */ + break; + + case DPMSModeSuspend: + /* Screen: Off; HSync: On; VSync: Off */ + GFX(set_crt_enable(CRT_SUSPEND)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerdown(); +#else /* STB_X */ + if (pGeode->Panel) + Pnl_PowerDown(); +#endif /* STB_X */ + break; + case DPMSModeOff: + /* Screen: Off; HSync: Off; VSync: Off */ + GFX(set_crt_enable(CRT_DISABLE)); +#if defined(STB_X) + if (pGeode->Panel) + Gal_pnl_powerdown(); +#else /* STB_X */ + if (pGeode->Panel) + Pnl_PowerDown(); +#endif /* STB_X */ + break; + } +} +#endif + +/*---------------------------------------------------------------------------- + * GX2ScreenInit. + * + * Description :This function will be called at the each ofserver + * generation. + * + * Parameters. + * scrnIndex :Specfies the screenindex value during generation. + * pScreen :Pointer to screen info strucrure. + * argc :parameters for command line arguments count + * argv :command line arguments if any it is not used. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static Bool +GX2ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + GeodePtr pGeode; + int i; + Bool Inited = FALSE; + unsigned char *FBStart; + unsigned int req_offscreenmem; + int width, height, displayWidth; + VisualPtr visual; + BoxRec AvailBox; + RegionRec OffscreenRegion; + + DCount = 30; + GeodeDebug(("GX2ScreenInit!\n")); + /* Get driver private */ + pGeode = GX2GetRec(pScreenInfo); + GeodeDebug(("GX2ScreenInit(0)!\n")); + /* + * * Allocate a vgaHWRec + */ + GeodeDebug(("FBVGAActive %d\n", pGeode->FBVGAActive)); + if (pGeode->FBVGAActive) { + if (!vgaHWGetHWRec(pScreenInfo)) + return FALSE; + if (!vgaHWMapMem(pScreenInfo)) + return FALSE; + vgaHWGetIOBase(VGAHWPTR(pScreenInfo)); + } + + if (!GX2MapMem(pScreenInfo)) + return FALSE; + + pGeode->Pitch = GX2CalculatePitchBytes(pScreenInfo->virtualX, + pScreenInfo->bitsPerPixel); + + /* SET UP GRAPHICS MEMORY AVAILABLE FOR PIXMAP CACHE */ + AvailBox.x1 = 0; + AvailBox.y1 = pScreenInfo->virtualY; + AvailBox.x2 = pScreenInfo->displayWidth; + AvailBox.y2 = (pGeode->FBSize / pGeode->Pitch); + + pGeode->CursorSize = 16 * 64; /* 64x64 */ + + if (pGeode->HWCursor) { + /* Compute cursor buffer */ + /* Default cursor offset, end of the frame buffer */ + pGeode->CursorStartOffset = pGeode->FBSize - pGeode->CursorSize; + AvailBox.y2 -= 1; + } + + DEBUGMSG(1, (scrnIndex, X_PROBED, + "Memory manager initialized to (%d,%d) (%d,%d) %d %d %d\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2, + pGeode->Pitch, pScreenInfo->displayWidth, + pScreenInfo->bitsPerPixel)); + + /* set the offscreen offset accordingly */ + if (pGeode->Compression) { + + pGeode->CBPitch = 544; + pGeode->CBSize = 544; + + req_offscreenmem = pScreenInfo->virtualY * pGeode->CBPitch; + req_offscreenmem += pGeode->Pitch - 1; + req_offscreenmem /= pGeode->Pitch; + pGeode->CBOffset = AvailBox.y1 * pGeode->Pitch; + AvailBox.y1 += req_offscreenmem; + } + DEBUGMSG(1, (scrnIndex, X_PROBED, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2)); + + if (!pGeode->NoAccel) { + if (pGeode->NoOfImgBuffers > 0) { + if (pGeode->NoOfImgBuffers <= (AvailBox.y2 - AvailBox.y1)) { + pGeode->AccelImageWriteBufferOffsets = + xalloc(sizeof(unsigned long) * pGeode->NoOfImgBuffers); + + pGeode->AccelImageWriteBufferOffsets[0] = + ((unsigned char *)pGeode->FBBase) + + (AvailBox.y1 * pGeode->Pitch); + + for (i = 1; i < pGeode->NoOfImgBuffers; i++) { + pGeode->AccelImageWriteBufferOffsets[i] = + pGeode->AccelImageWriteBufferOffsets[i - 1] + + pGeode->Pitch; + } + + for (i = 0; i < pGeode->NoOfImgBuffers; i++) { + DEBUGMSG(1, (scrnIndex, X_PROBED, + "memory %d %x\n", i, + pGeode->AccelImageWriteBufferOffsets[i])); + } + AvailBox.y1 += pGeode->NoOfImgBuffers; + } else { + xf86DrvMsg(scrnIndex, X_ERROR, + "Unable to reserve scanline area\n"); + } + } + DEBUGMSG(1, (scrnIndex, X_PROBED, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2)); + + REGION_INIT(pScreen, &OffscreenRegion, &AvailBox, 2); + + if (!xf86InitFBManagerRegion(pScreen, &OffscreenRegion)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2); + } else { + xf86DrvMsg(scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + AvailBox.x1, AvailBox.y1, AvailBox.x2, AvailBox.y2); + } + REGION_UNINIT(pScreen, &OffscreenRegion); + } + + /* Initialise graphics mode */ + if (!GX2EnterGraphics(pScreen, pScreenInfo)) + return FALSE; + + GX2AdjustFrame(scrnIndex, pScreenInfo->frameX0, pScreenInfo->frameY0, 0); + GeodeDebug(("GX2ScreenInit(1)!\n")); + + /* Reset visual list */ + miClearVisualTypes(); + GeodeDebug(("GX2ScreenInit(2)!\n")); + + /* Setup the visual we support */ + if (pScreenInfo->bitsPerPixel > 8) { + DEBUGMSG(1, (scrnIndex, X_PROBED, + "miSetVisualTypes %d %X %X %X\n", + pScreenInfo->depth, + TrueColorMask, + pScreenInfo->rgbBits, pScreenInfo->defaultVisual)); + + if (!miSetVisualTypes(pScreenInfo->depth, + TrueColorMask, + pScreenInfo->rgbBits, + pScreenInfo->defaultVisual)) { + return FALSE; + } + } else { + if (!miSetVisualTypes(pScreenInfo->depth, + miGetDefaultVisualMask(pScreenInfo->depth), + pScreenInfo->rgbBits, + pScreenInfo->defaultVisual)) { + return FALSE; + } + } + GeodeDebug(("GX2ScreenInit(3)!\n")); + + /* Set for RENDER extensions */ + miSetPixmapDepths(); + + /* Call the framebuffer layer's ScreenInit function, and fill in other + * * pScreen fields. + */ + + width = pScreenInfo->virtualX; + height = pScreenInfo->virtualY; + + displayWidth = pScreenInfo->displayWidth; + if (pGeode->Rotate) { + width = pScreenInfo->virtualY; + height = pScreenInfo->virtualX; + } + if (pGeode->ShadowFB) { + pGeode->ShadowPitch = BitmapBytePad(pScreenInfo->bitsPerPixel * width); + pGeode->ShadowPtr = xalloc(pGeode->ShadowPitch * height); + displayWidth = pGeode->ShadowPitch / (pScreenInfo->bitsPerPixel >> 3); + FBStart = pGeode->ShadowPtr; + } else { + pGeode->ShadowPtr = NULL; + + FBStart = pGeode->FBBase; + DEBUGMSG(1, (0, X_PROBED, "FBStart %X \n", FBStart)); + } + + switch (pScreenInfo->bitsPerPixel) { +#if CFB + case 8: + Inited = cfbScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth); + break; + case 16: + Inited = cfb16ScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth); + break; + case 24: + case 32: + Inited = cfb32ScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth); + break; +#else + case 8: + case 16: + case 24: + case 32: + Inited = fbScreenInit(pScreen, FBStart, width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth, pScreenInfo->bitsPerPixel); + break; +#endif + default: + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: invalid bpp (%d) in ScreenInit\n", + pScreenInfo->bitsPerPixel); + Inited = FALSE; + break; + } + if (!Inited) + return FALSE; + + GeodeDebug(("GX2ScreenInit(4)!\n")); + xf86SetBlackWhitePixels(pScreen); + + if (!pGeode->ShadowFB) { + GX2DGAInit(pScreen); + } + GeodeDebug(("GX2ScreenInit(5)!\n")); + if (pScreenInfo->bitsPerPixel > 8) { + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScreenInfo->offset.red; + visual->offsetGreen = pScreenInfo->offset.green; + visual->offsetBlue = pScreenInfo->offset.blue; + visual->redMask = pScreenInfo->mask.red; + visual->greenMask = pScreenInfo->mask.green; + visual->blueMask = pScreenInfo->mask.blue; + } + } + } +#if CFB +#else + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); +#endif + + GeodeDebug(("GX2ScreenInit(6)!\n")); + if (!pGeode->NoAccel) { + GX2AccelInit(pScreen); + } + GeodeDebug(("GX2ScreenInit(7)!\n")); + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + GeodeDebug(("GX2ScreenInit(8)!\n")); + /* Initialise software cursor */ + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + /* Initialize HW cursor layer. + * * Must follow software cursor initialization + */ + if (pGeode->HWCursor) { + if (!GX2HWCursorInit(pScreen)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + } + GeodeDebug(("GX2ScreenInit(9)!\n")); + /* Setup default colourmap */ + if (!miCreateDefColormap(pScreen)) { + return FALSE; + } + GeodeDebug(("GX2ScreenInit(10)!\n")); + /* Initialize colormap layer. + * * Must follow initialization of the default colormap + */ + if (!xf86HandleColormaps(pScreen, 256, 8, + GX2LoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | + CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + + GeodeDebug(("GX2ScreenInit(11)!\n")); + + if (pGeode->ShadowFB) { + RefreshAreaFuncPtr refreshArea = GX2RefreshArea; + + if (pGeode->Rotate) { + if (!pGeode->PointerMoved) { + pGeode->PointerMoved = pScreenInfo->PointerMoved; + pScreenInfo->PointerMoved = GX2PointerMoved; + } + switch (pScreenInfo->bitsPerPixel) { + case 8: + refreshArea = GX2RefreshArea8; + break; + case 16: + refreshArea = GX2RefreshArea16; + break; + case 24: + refreshArea = GX2RefreshArea24; + break; + case 32: + refreshArea = GX2RefreshArea32; + break; + } + } + ShadowFBInit(pScreen, refreshArea); + } +#ifdef DPMSExtension + xf86DPMSInit(pScreen, GX2DPMSSet, 0); +#endif + GeodeDebug(("GX2ScreenInit(12)!\n")); + + pScreenInfo->memPhysBase = (unsigned long)pGeode->FBBase; + pScreenInfo->fbOffset = 0; + + GeodeDebug(("GX2ScreenInit(13)!\n")); + GX2InitVideo(pScreen); /* needed for video */ + /* Wrap the screen's CloseScreen vector and set its + * SaveScreen vector + */ + pGeode->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = GX2CloseScreen; + + pScreen->SaveScreen = GX2SaveScreen; + GeodeDebug(("GX2ScreenInit(14)!\n")); + + /* Report any unused options */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScreenInfo->scrnIndex, pScreenInfo->options); + } + GeodeDebug(("GX2ScreenInit(15)!\n")); + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GX2SwitchMode. + * + * Description :This function will switches the screen mode + * + * Parameters: + * scrnIndex :Specfies the screen index value. + * pMode :pointer to the mode structure. + * flags :may be used for status check?. + * + * Returns :Returns TRUE on success and FALSE on failure. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +Bool +GX2SwitchMode(int scrnIndex, DisplayModePtr pMode, int flags) +{ + GeodeDebug(("GX2SwitchMode!\n")); + return GX2SetMode(xf86Screens[scrnIndex], pMode); +} + +/*---------------------------------------------------------------------------- + * GX2AdjustFrame. + * + * Description :This function is used to intiallize the start + * address of the memory. + * Parameters. + * scrnIndex :Specfies the screen index value. + * x :x co-ordinate value interms of pixels. + * y :y co-ordinate value interms of pixels. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +void +GX2AdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + GeodePtr pGeode = GX2GetRec(pScreenInfo); + unsigned long offset; + + /* y offset */ + offset = (unsigned long)y *(unsigned long)pGeode->Pitch; + + /* x offset */ + offset += x * (pScreenInfo->bitsPerPixel >> 3); + + GFX(set_display_offset(offset)); +} + +/*---------------------------------------------------------------------------- + * GX2EnterVT. + * + * Description :This is called when VT switching back to the X server + * + * Parameters. + * scrnIndex :Specfies the screen index value. + * flags :Not used inside the function. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static Bool +GX2EnterVT(int scrnIndex, int flags) +{ + GeodeDebug(("GX2EnterVT!\n")); + return GX2EnterGraphics(NULL, xf86Screens[scrnIndex]); +} + +/*---------------------------------------------------------------------------- + * GX2LeaveVT. + * + * Description :This is called when VT switching X server text mode. + * + * Parameters. + * scrnIndex :Specfies the screen index value. + * flags :Not used inside the function. + * + * Returns :none. + * + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static void +GX2LeaveVT(int scrnIndex, int flags) +{ + GeodeDebug(("GX2LeaveVT!\n")); + GX2LeaveGraphics(xf86Screens[scrnIndex]); +} + +/*---------------------------------------------------------------------------- + * GX2FreeScreen. + * + * Description :This is called to free any persistent data structures. + * + * Parameters. + * scrnIndex :Specfies the screen index value. + * flags :Not used inside the function. + * + * Returns :none. + * + * Comments :This will be called only when screen being deleted.. +*---------------------------------------------------------------------------- +*/ +static void +GX2FreeScreen(int scrnIndex, int flags) +{ + GeodeDebug(("GX2FreeScreen!\n")); + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) + vgaHWFreeHWRec(xf86Screens[scrnIndex]); + GX2FreeRec(xf86Screens[scrnIndex]); +} + +/*---------------------------------------------------------------------------- + * GX2ValidMode. + * + * Description :This function checks if a mode is suitable for selected + * chipset. + * Parameters. + * scrnIndex :Specfies the screen index value. + * pMode :Pointer to the screen mode structure.. + * verbose :not used for implementation. + * flags :not used for implementation + * + * Returns :MODE_OK if the specified mode is supported or + * MODE_NO_INTERLACE. + * Comments :none. +*---------------------------------------------------------------------------- +*/ +static int +GX2ValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags) +{ + unsigned int total_memory_required; + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + int ret = -1; + GeodePtr pGeode = GX2GetRec(pScreenInfo); + + DEBUGMSG(1, (0, X_NONE, "GeodeValidateMode: %dx%d %d %d\n", + pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, GX2GetRefreshRate(pMode))); + { + DEBUGMSG(1, (0, X_NONE, "CRT mode\n")); + if (pMode->Flags & V_INTERLACE) + return MODE_NO_INTERLACE; + +#if defined(STB_X) + Gal_is_display_mode_supported(pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX2GetRefreshRate(pMode), &ret); +#else /* STB_X */ + ret = gfx_is_display_mode_supported(pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScreenInfo->bitsPerPixel, + GX2GetRefreshRate(pMode)); +#endif /* STB_X */ + } + if (ret < 0) + return MODE_NOMODE; + + total_memory_required = GX2CalculatePitchBytes(pMode->CrtcHDisplay, + pScreenInfo->bitsPerPixel) * + pMode->CrtcVDisplay; + + DEBUGMSG(1, (0, X_NONE, "Total Mem %X %X\n", + total_memory_required, pGeode->FBSize)); + + if (total_memory_required > pGeode->FBSize) + return MODE_MEM; + + return MODE_OK; +} + +/*---------------------------------------------------------------------------- + * GX2LoadPalette. + * + * Description :This function sets the palette entry used for graphics data + * + * Parameters. + * pScreenInfo:Points the screeninfo structure. + * numColors:Specifies the no of colors it supported. + * indizes :This is used get index value . + * LOCO :to be added. + * pVisual :to be added. + * + * Returns :MODE_OK if the specified mode is supported or + * MODE_NO_INTERLACE. + * Comments :none. +*---------------------------------------------------------------------------- +*/ + +static void +GX2LoadPalette(ScrnInfoPtr pScreenInfo, + int numColors, int *indizes, LOCO * colors, VisualPtr pVisual) +{ + int i, index, color; + + for (i = 0; i < numColors; i++) { + index = indizes[i] & 0xFF; + color = (((unsigned long)(colors[index].red & 0xFF)) << 16) | + (((unsigned long)(colors[index].green & 0xFF)) << 8) | + ((unsigned long)(colors[index].blue & 0xFF)); + DEBUGMSG(0, (0, X_NONE, "GX2LoadPalette: %d %d %X\n", + numColors, index, color)); + + GFX(set_display_palette_entry(index, color)); + } +} + +static Bool +GX2MapMem(ScrnInfoPtr pScreenInfo) +{ + GeodePtr pGeode = GEODEPTR(pScreenInfo); + +#if defined(STB_X) + pGeode->FBBase = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, + pGeode->FBLinearAddr, + pGeode->FBSize); + +#else + gfx_virt_regptr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_MMIO, + (unsigned int) + gfx_get_cpu_register_base + (), pGeode->cpu_reg_size); + + if (pGeode->DetectedChipSet & GX2) { + gfx_virt_gpptr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_MMIO, + (unsigned int) + gfx_get_graphics_register_base + (), + pGeode->gp_reg_size); + } else { + gfx_virt_spptr = gfx_virt_regptr; + } + + gfx_virt_vidptr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_MMIO, + (unsigned int) + gfx_get_vid_register_base + (), pGeode->vid_reg_size); + + gfx_virt_fbptr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, + pGeode->FBLinearAddr, + pGeode->FBSize); + + pGeode->FBBase = gfx_virt_fbptr; + + DEBUGMSG(1, (0, X_NONE, "Set mode %X %X %X %X %X\n", + gfx_virt_regptr, + gfx_virt_gpptr, + gfx_virt_spptr, gfx_virt_vidptr, gfx_virt_fbptr)); + + /* CHECK IF REGISTERS WERE MAPPED SUCCESSFULLY */ + if ((!gfx_virt_regptr) || + (!gfx_virt_gpptr) || (!gfx_virt_vidptr) || (!gfx_virt_fbptr)) { + DEBUGMSG(1, (0, X_NONE, "Could not map hardware registers.\n")); + return (FALSE); + } + + /* Map the XpressROM ptr to read what platform are we on */ + XpressROMPtr = (unsigned char *)xf86MapVidMem(pScreenInfo->scrnIndex, + VIDMEM_FRAMEBUFFER, 0xF0000, + 0x10000); + + DEBUGMSG(1, (0, X_NONE, "adapter info %x %x %x %x, %X\n", + pGeode->cpu_version, + pGeode->vid_version, + pGeode->FBSize, pGeode->FBBase, XpressROMPtr)); +#endif + + return TRUE; +} + +/* + * Unmap the framebuffer and MMIO memory. + */ + +static Bool +GX2UnmapMem(ScrnInfoPtr pScreenInfo) +{ +#if !defined(STB_X) + GeodePtr pGeode = GEODEPTR(pScreenInfo); + + /* unmap all the memory map's */ + xf86UnMapVidMem(pScreenInfo->scrnIndex, + gfx_virt_regptr, pGeode->cpu_reg_size); + if (pGeode->DetectedChipSet & GX2) { + xf86UnMapVidMem(pScreenInfo->scrnIndex, + gfx_virt_gpptr, pGeode->gp_reg_size); + } + xf86UnMapVidMem(pScreenInfo->scrnIndex, + gfx_virt_vidptr, pGeode->vid_reg_size); + xf86UnMapVidMem(pScreenInfo->scrnIndex, gfx_virt_fbptr, pGeode->FBSize); + xf86UnMapVidMem(pScreenInfo->scrnIndex, XpressROMPtr, 0x10000); +#endif /* STB_X */ + return TRUE; +} + +/* End of file */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_shadow.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_shadow.c:1.2 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_shadow.c Tue Jan 14 04:34:32 2003 @@ -0,0 +1,468 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_shadow.c,v 1.2 2003/01/14 09:34:32 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_shadow.c $ + * $Revision: 5 $ + * $Author: Sarma $ + * + * File Contents: Direct graphics display routines are implemented and + * graphics rendering are all done in memory. + * + * Project: Geode Xfree Frame buffer device driver. + * + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "nsc.h" +#include "shadowfb.h" +#include "servermd.h" + +void GX2RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX2PointerMoved(int index, int x, int y); +void GX2RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX2RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX2RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void GX2RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +/*---------------------------------------------------------------------------- + * GX2RefreshArea. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer. + * Parameters. + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments : none + * +*---------------------------------------------------------------------------- +*/ +void +GX2RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + while (num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = pGeode->ShadowPtr + (pbox->y1 * pGeode->ShadowPitch) + + (pbox->x1 * Bpp); + dst = pGeode->FBBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + while (height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += pGeode->ShadowPitch; + } + + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX2PointerMoved. + * + * Description :This function moves one screen memory from one area to other. + * + * Parameters. + * index :Pointer to screen index. + * x :Specifies the new x co-ordinates of new area. + * y :Specifies the new y co-ordinates of new area. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2PointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + GeodePtr pGeode = GEODEPTR(pScrn); + int newX, newY; + + if (pGeode->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + (*pGeode->PointerMoved) (index, newX, newY); +} + +/*---------------------------------------------------------------------------- + * GX2RefreshArea8. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 8bpp. + * Parameters. + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2RefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2, + srcPitch3, srcPitch4; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch; + srcPitch2 = srcPitch * 2; + srcPitch3 = srcPitch * 3; + srcPitch4 = srcPitch * 4; + while (num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if (pGeode->Rotate == 1) { + dstPtr = pGeode->FBBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = pGeode->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = pGeode->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + while (width--) { + src = srcPtr; + dst = (CARD32 *) dstPtr; + count = height; + while (count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch2] << 16) | (src[srcPitch3] << 24); + src += srcPitch4; + } + srcPtr += pGeode->Rotate; + dstPtr += dstPitch; + } + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX2RefreshArea16. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 16bpp. + * Parameters: + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2RefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch >> 1; + srcPitch2 = srcPitch * 2; + while (num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + if (pGeode->Rotate == 1) { + dstPtr = (CARD16 *) pGeode->FBBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16 *) pGeode->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16 *) pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16 *) pGeode->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while (width--) { + src = srcPtr; + dst = (CARD32 *) dstPtr; + count = height; + while (count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch2; + } + srcPtr += pGeode->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX2RefreshArea24. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 24bpp. + * Parameters. + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2RefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch, srcPitch2, srcPitch3; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = BitmapBytePad(pScrn->displayWidth * 24); + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch; + srcPitch2 = srcPitch * 2; + srcPitch3 = srcPitch * 3; + while (num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* blocks of 3 dwords */ + if (pGeode->Rotate == 1) { + dstPtr = pGeode->FBBase + + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); + srcPtr = pGeode->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); + } else { + dstPtr = pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); + srcPtr = pGeode->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; + } + while (width--) { + src = srcPtr; + dst = (CARD32 *) dstPtr; + count = height; + while (count--) { + dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | + (src[srcPitch] << 24); + dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | + (src[srcPitch2] << 16) | (src[srcPitch2 + 1] << 24); + dst[2] = src[srcPitch2 + 2] | (src[srcPitch3] << 8) | + (src[srcPitch3 + 1] << 16) | (src[srcPitch3 + 2] << 24); + dst += 3; + src += srcPitch << 2; + } + srcPtr += pGeode->Rotate * 3; + dstPtr += dstPitch; + } + pbox++; + } +} + +/*---------------------------------------------------------------------------- + * GX2RefreshArea32. + * + * Description :This function copies the memory to be displayed from the + * shadow pointer by 32bpp. + * Parameters: + * pScrn :Pointer to screen structure. + * num :Specifies the num of squarebox area to be displayed. + * pbox :Points to square of memory to be displayed. + * Returns : none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2RefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + int count, width, height, dstPitch, srcPitch; + CARD32 *dstPtr, *srcPtr, *src, *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pGeode->Rotate * pGeode->ShadowPitch >> 2; + while (num--) { + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + + if (pGeode->Rotate == 1) { + dstPtr = (CARD32 *) pGeode->FBBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; + srcPtr = (CARD32 *) pGeode->ShadowPtr + + ((1 - pbox->y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD32 *) pGeode->FBBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; + srcPtr = (CARD32 *) pGeode->ShadowPtr + + (pbox->y1 * srcPitch) + pbox->x2 - 1; + } + while (width--) { + src = srcPtr; + dst = dstPtr; + count = height; + while (count--) { + *(dst++) = *src; + src += srcPitch; + } + srcPtr += pGeode->Rotate; + dstPtr += dstPitch; + } + pbox++; + } +} + +/* End of file */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_vga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_vga.c:1.2 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_vga.c Tue Jan 14 04:34:32 2003 @@ -0,0 +1,570 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_vga.c,v 1.2 2003/01/14 09:34:32 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_vga.c $ + * $Revision: 6 $ + * $Author: Sarma $ + * + * This file contains routines to set modes using the VGA registers. + * Since this file is for the first generation graphics unit, it interfaces + * to SoftVGA registers. It works for both VSA1 and VSA2. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * nsc XFree86 + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* VGA STRUCTURE */ + +#define GU2_STD_CRTC_REGS 25 +#define GU2_EXT_CRTC_REGS 15 +#define GU2_GDC_REGS 9 +#define GU2_SEQ_REGS 5 + +#define GU2_VGA_FLAG_MISC_OUTPUT 0x1 +#define GU2_VGA_FLAG_STD_CRTC 0x2 +#define GU2_VGA_FLAG_EXT_CRTC 0x4 +#define GU2_VGA_FLAG_GDC 0x10 +#define GU2_VGA_FLAG_SEQ 0x20 +#define GU2_VGA_FLAG_PALETTE 0x40 +#define GU2_VGA_FLAG_ATTR 0x80 + +static unsigned int GDCregs[10]; +static unsigned int SEQregs[10]; +static unsigned int palette[256]; +static unsigned int ATTRregs[32]; +static unsigned char *font_data = NULL; + +#define VGA_BLOCK 0x40000 /* 256 k */ + +void gu2_vga_extcrtc(char offset, int reset); +int gu2_get_vga_active(void); +void gu2_vga_font_data(int flag); +void gu2_set_vga(int reset); +int gu2_vga_seq_blanking(void); +int gu2_vga_attr_ctrl(int reset); +void gu2_vga_to_gfx(void); +void gu2_gfx_to_vga(int vga_mode); +int gu2_vga_seq_reset(int reset); +int gu2_vga_save(gfx_vga_struct * vga, int flags); +void gu2_vga_clear_extended(void); +int gu2_vga_restore(gfx_vga_struct * vga, int flags); + +int +gu2_get_vga_active(void) +{ + int data = gfx_read_reg32(MDC_GENERAL_CFG); + + if (data & MDC_GCFG_VGAE) + return 1; + return 0; +} + +void +gu2_vga_font_data(int flag) +{ + if (flag == 0) { + if (font_data == NULL) { + font_data = malloc(VGA_BLOCK); + } + DEBUGMSG(1, (0, X_NONE, "Saving VGA Data\n")); + memcpy(font_data, gfx_virt_fbptr, VGA_BLOCK); + } else { + if (font_data) { + DEBUGMSG(1, (0, X_NONE, "Restore VGA Data\n")); + memcpy(gfx_virt_fbptr, font_data, VGA_BLOCK); + free(font_data); + font_data = NULL; + } + } +} + +void +gu2_set_vga(int reset) +{ + int data = gfx_read_reg32(MDC_GENERAL_CFG); + + if (reset) + data |= MDC_GCFG_VGAE; + else + data &= ~MDC_GCFG_VGAE; + gfx_write_reg32(MDC_GENERAL_CFG, data); +} + +int +gu2_vga_seq_blanking(void) +{ + int tmp; + + gfx_outb(0x3C4, 1); + tmp = gfx_inb(0x3C5); + tmp |= 0x20; + tmp |= tmp << 8; + gfx_outw(0x3C4, tmp); + + gfx_delay_milliseconds(1); + return (GFX_STATUS_OK); +} + +int +gu2_vga_attr_ctrl(int reset) +{ + int tmp; + + tmp = gfx_inb(0x3DA); + gfx_outb(0x3C0, (unsigned char)(reset ? 0x00 : 0x20)); + if (reset) + tmp = gfx_inb(0x3DA); + return (GFX_STATUS_OK); +} + +void +gu2_vga_to_gfx(void) +{ + gu2_vga_attr_ctrl(0); + + gu2_vga_seq_blanking(); + gfx_delay_milliseconds(2); + + gu2_vga_extcrtc(0x3F, 1); +} + +void +gu2_gfx_to_vga(int vga_mode) +{ + int tmp; + char sequencer; + + gu2_vga_extcrtc(0x40, vga_mode); + + /* clear the display blanking bit */ + gfx_outb(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_CLK_MODE); + sequencer = gfx_inb(MDC_SEQUENCER_DATA); + sequencer &= ~MDC_CLK_MODE_SCREEN_OFF; + sequencer |= 1; + gfx_outb(MDC_SEQUENCER_DATA, sequencer); + + gfx_delay_milliseconds(1); + + /*restart the sequencer */ + gfx_outw(0x3C4, 0x300); + + /* turn on the attribute controler */ + tmp = gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x20); + tmp = gfx_inb(0x3DA); + + gu2_vga_extcrtc(0x3F, 0); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_seq_reset + * + * This routine enables or disables SoftVGA. It is used to make SoftVGA + * "be quiet" and not interfere with any of the direct hardware access from + * Durango. For VSA1, the sequencer is reset to stop text redraws. VSA2 may + * provide a better way to have SoftVGA sit in the background. + *----------------------------------------------------------------------------- + */ +int +gu2_vga_seq_reset(int reset) +{ + gfx_outb(0x3C4, 0); + gfx_outb(0x3C5, (unsigned char)(reset ? 0x00 : 0x03)); + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_save + * + * This routine saves the state of the VGA registers into the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *----------------------------------------------------------------------------- + */ +int +gu2_vga_save(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GU2_VGA_FLAG_MISC_OUTPUT) { + /* SAVE MISCCELLANEOUS OUTPUT REGISTER */ + + vga->miscOutput = gfx_inb(0x3CC); + } + + /* CHECK SEQ */ + + if (flags & GU2_VGA_FLAG_SEQ) { + /* SAVE STANDARD CRTC REGISTERS */ + + for (i = 1; i < GU2_SEQ_REGS; i++) { + gfx_outb(0x3C4, (unsigned char)i); + SEQregs[i] = gfx_inb(0x3C5); + } + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_STD_CRTC) { + /* SAVE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GU2_STD_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)i); + vga->stdCRTCregs[i] = gfx_inb(crtcdata); + } + } + + /* CHECK GDC */ + + if (flags & GU2_VGA_FLAG_GDC) { + /* SAVE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GU2_GDC_REGS; i++) { + gfx_outb(0x3CE, (unsigned char)i); + GDCregs[i] = gfx_inb(0x3CF); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_EXT_CRTC) { + /* SAVE EXTENDED CRTC REGISTERS */ + + for (i = 0; i < GU2_EXT_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)(0x40 + i)); + vga->extCRTCregs[i] = gfx_inb(crtcdata); + } + } + + if (flags & GU2_VGA_FLAG_PALETTE) { + /* SAVE PALETTE DATA */ + + for (i = 0; i < 0x100; i++) { + gfx_outb(0x3C7, i); + palette[i] = gfx_inb(0x3C9); + } + } + + if (flags & GU2_VGA_FLAG_ATTR) { + /* SAVE Attribute DATA */ + + for (i = 0; i < 21; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + ATTRregs[i] = gfx_inb(0x3C1); + } + } + /* save the VGA data */ + gu2_vga_font_data(0); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_clear_extended + * + * This routine clears the extended SoftVGA register values to have SoftVGA + * behave like standard VGA. + *----------------------------------------------------------------------------- + */ +void +gu2_vga_clear_extended(void) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x57); + gfx_outb(crtcdata, 0x4C); + for (i = 0x41; i <= 0x4F; i++) { + gfx_outb(crtcindex, (unsigned char)i); + gfx_outb(crtcdata, 0); + } + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x00); +} + +void +gu2_vga_extcrtc(char offset, int reset) +{ + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* UNLOCK EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x57); + gfx_outb(crtcdata, 0x4C); + + /* RESTORE EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, offset); + gfx_outb(crtcdata, reset); + +#if 0 + /* LOCK EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x00); +#endif +} + +/*----------------------------------------------------------------------------- + * gfx_vga_restore + * + * This routine restores the state of the VGA registers from the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *----------------------------------------------------------------------------- + */ +int +gu2_vga_restore(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GU2_VGA_FLAG_MISC_OUTPUT) { + /* RESTORE MISCELLANEOUS OUTPUT REGISTER VALUE */ + + gfx_outb(0x3C2, vga->miscOutput); + } + + /* CHECK SEQ */ + + if (flags & GU2_VGA_FLAG_SEQ) { + /* RESTORE STANDARD CRTC REGISTERS */ + + for (i = 1; i < GU2_SEQ_REGS; i++) { + gfx_outb(0x3C4, (unsigned char)i); + gfx_outb(0x3C5, SEQregs[i]); + } + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_STD_CRTC) { + /* UNLOCK STANDARD CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x11); + gfx_outb(crtcdata, 0); + + /* RESTORE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GU2_STD_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)i); + gfx_outb(crtcdata, vga->stdCRTCregs[i]); + } + } + + /* CHECK GDC */ + + if (flags & GU2_VGA_FLAG_GDC) { + /* SAVE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GU2_GDC_REGS; i++) { + gfx_outb(0x3CE, (unsigned char)i); + gfx_outb(0x3CF, GDCregs[i]); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_EXT_CRTC) { + /* UNLOCK EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x57); + gfx_outb(crtcdata, 0x4C); + + /* RESTORE EXTENDED CRTC REGISTERS */ + + for (i = 1; i < GU2_EXT_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)(0x40 + i)); + gfx_outb(crtcdata, vga->extCRTCregs[i]); + } + + /* LOCK EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x00); + + /* CHECK IF DIRECT FRAME BUFFER MODE (VESA MODE) */ + + if (vga->extCRTCregs[0x03] & 1) { + /* SET BORDER COLOR TO BLACK */ + /* This really should be another thing saved/restored, but */ + /* Durango currently doesn't do the attr controller registers. */ + + gfx_inb(0x3BA); /* Reset flip-flop */ + gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x11); + gfx_outb(0x3C0, 0x00); + } + } + + if (flags & GU2_VGA_FLAG_PALETTE) { + /* RESTORE PALETTE DATA */ + + for (i = 0; i < 0x100; i++) { + gfx_outb(0x3C8, i); + gfx_outb(0x3C9, palette[i]); + } + } + + if (flags & GU2_VGA_FLAG_ATTR) { + /* RESTORE Attribute DATA */ + + for (i = 0; i < 21; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + gfx_outb(0x3C0, ATTRregs[i]); + } + /* SAVE Attribute DATA */ + + for (i = 0; i < 21; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + } + } + + /* restore the VGA data */ + gu2_vga_font_data(1); + + return (0); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_video.c:1.5 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_video.c Fri Feb 21 11:51:09 2003 @@ -0,0 +1,1570 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_video.c,v 1.5 2003/02/21 16:51:09 alanh Exp $ */ +/* + * $Workfile: nsc_gx2_video.c $ + * $Revision: 11 $ + * $Author: Sarma $ + * + * File Contents: This file consists of main Xfree video supported routines. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * National Xfree frame buffer driver + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * National Xfree frame buffer driver + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * National Xfree frame buffer driver + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* + * Fixes & Extensions to support Y800 greyscale modes + * Alan Hourihane <alanh@fairlite.demon.co.uk> + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "nsc.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" +#include "nsc_fourcc.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) +#define XV_PROFILE 0 +#define REINIT 1 +#ifndef XvExtension +void +GX2InitVideo(ScreenPtr pScreen) +{ +} + +void +GX2ResetVideo(ScrnInfoPtr pScrn) +{ +} +#else + +#define DBUF 1 +void GX2InitVideo(ScreenPtr pScreen); +void GX2ResetVideo(ScrnInfoPtr pScrn); +static XF86VideoAdaptorPtr GX2SetupImageVideo(ScreenPtr); +static void GX2InitOffscreenImages(ScreenPtr); +static void GX2StopVideo(ScrnInfoPtr, pointer, Bool); +static int GX2SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int GX2GetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); +static void GX2QueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, + unsigned int *, pointer); +static int GX2PutImage(ScrnInfoPtr, short, short, short, short, short, short, + short, short, int, unsigned char *, short, short, Bool, + RegionPtr, pointer); +static int GX2QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); + +static void GX2BlockHandler(int, pointer, pointer, pointer); +void GX2SetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, + short drw_h, int id, int offset, ScrnInfoPtr pScrn); + +extern void GX2AccelSync(ScrnInfoPtr pScreenInfo); + +#if !defined(STB_X) +extern int DeltaX, DeltaY; +#else +int DeltaX, DeltaY; +#endif + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvColorKey, xvColorKeyMode, xvFilter +#if DBUF + , xvDoubleBuffer +#endif + ; + +/*---------------------------------------------------------------------------- + * GX2InitVideo + * + * Description :This is the initialization routine.It creates a new video adapter + * and calls GX2SetupImageVideo to initialize the adaptor by filling + * XF86VideoAdaptorREc.Then it lists the existing adaptors and adds the + * new one to it. Finally the list of XF86VideoAdaptorPtr pointers are + * passed to the xf86XVScreenInit(). + * + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +void +GX2InitVideo(ScreenPtr pScreen) +{ + GeodePtr pGeode; + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + + pGeode = GEODEPTR(pScreenInfo); + + if (!pGeode->NoAccel) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + + int num_adaptors; + + newAdaptor = GX2SetupImageVideo(pScreen); + GX2InitOffscreenImages(pScreen); + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if (newAdaptor) { + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *)); + if (newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if (num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); + } +} + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = { + { + 0, + "XV_IMAGE", + 1024, 1024, + {1, 1} + } +}; + +#define NUM_FORMATS 4 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = { + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#if DBUF +#define NUM_ATTRIBUTES 4 +#else +#define NUM_ATTRIBUTES 3 +#endif + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { +#if DBUF + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, +#endif + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER"}, + {XvSettable | XvGettable, 0, 1, "XV_COLORKEYMODE"} +}; + +#define NUM_IMAGES 7 + +static XF86ImageRec Images[NUM_IMAGES] = { + XVIMAGE_UYVY, + XVIMAGE_YUY2, + XVIMAGE_Y2YU, + XVIMAGE_YVYU, + XVIMAGE_Y800, + XVIMAGE_I420, + XVIMAGE_YV12 +}; + +typedef struct +{ + FBAreaPtr area; + FBLinearPtr linear; + RegionRec clip; + CARD32 colorKey; + CARD32 colorKeyMode; + CARD32 filter; + CARD32 videoStatus; + Time offTime; + Time freeTime; +#if DBUF + Bool doubleBuffer; + int currentBuffer; +#endif +} +GeodePortPrivRec, *GeodePortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (GeodePortPrivPtr)((GEODEPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +/*---------------------------------------------------------------------------- + * GX2SetColorKey + * + * Description :This function reads the color key for the pallete and + * sets the video color key register. + * + * Parameters. + * ScreenInfoPtr + * pScrn :Screen pointer having screen information. + * pPriv :Video port private data + * + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static INT32 +GX2SetColorkey(ScrnInfoPtr pScrn, GeodePortPrivPtr pPriv) +{ + int red, green, blue; + unsigned long key; + + switch (pScrn->depth) { + case 8: + GFX(get_display_palette_entry(pPriv->colorKey & 0xFF, &key)); + red = ((key >> 16) & 0xFF); + green = ((key >> 8) & 0xFF); + blue = (key & 0xFF); + break; + case 16: + red = (pPriv->colorKey & pScrn->mask.red) >> + pScrn->offset.red << (8 - pScrn->weight.red); + green = (pPriv->colorKey & pScrn->mask.green) >> + pScrn->offset.green << (8 - pScrn->weight.green); + blue = (pPriv->colorKey & pScrn->mask.blue) >> + pScrn->offset.blue << (8 - pScrn->weight.blue); + break; + default: + /* for > 16 bpp we send in the mask in xf86SetWeight. This + * function is providing the offset by 1 more. So we take + * this as a special case and subtract 1 for > 16 + */ + red = (pPriv->colorKey & pScrn->mask.red) >> + (pScrn->offset.red - 1) << (8 - pScrn->weight.red); + green = (pPriv->colorKey & pScrn->mask.green) >> + (pScrn->offset.green - 1) << (8 - pScrn->weight.green); + blue = (pPriv->colorKey & pScrn->mask.blue) >> + (pScrn->offset.blue - 1) << (8 - pScrn->weight.blue); + break; + } + + GFX(set_video_color_key((blue | (green << 8) | (red << 16)), 0xFFFFFF, + (pPriv->colorKeyMode == 0))); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + return 0; +} + +/*---------------------------------------------------------------------------- + * GX2ResetVideo + * + * Description : This function resets the video + * + * Parameters. + * ScreenInfoPtr + * pScrn :Screen pointer having screen information. + * + * Returns :None + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ + +void +GX2ResetVideo(ScrnInfoPtr pScrn) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + if (!pGeode->NoAccel) { + GeodePortPrivPtr pPriv = pGeode->adaptor->pPortPrivates[0].ptr; + + GX2AccelSync(pScrn); + GFX(set_video_palette(NULL)); + GX2SetColorkey(pScrn, pPriv); + GFX(set_video_filter(pPriv->filter, pPriv->filter)); + } +} + +/*---------------------------------------------------------------------------- + * GX2SetupImageVideo + * + * Description : This function allocates space for a Videoadaptor and initializes + * the XF86VideoAdaptorPtr record. + * + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns :XF86VideoAdaptorPtr :- pointer to the initialized video adaptor record. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ + +static XF86VideoAdaptorPtr +GX2SetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GeodePtr pGeode = GEODEPTR(pScrn); + XF86VideoAdaptorPtr adapt; + GeodePortPrivPtr pPriv; + + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(GeodePortPrivRec) + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "National Semiconductor Corporation"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + pPriv = (GeodePortPrivPtr) (&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer) (pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = GX2StopVideo; + adapt->SetPortAttribute = GX2SetPortAttribute; + adapt->GetPortAttribute = GX2GetPortAttribute; + adapt->QueryBestSize = GX2QueryBestSize; + adapt->PutImage = GX2PutImage; + adapt->QueryImageAttributes = GX2QueryImageAttributes; + + pPriv->colorKey = pGeode->videoKey; + pPriv->colorKeyMode = 0; + pPriv->filter = 0; + pPriv->videoStatus = 0; +#if DBUF + pPriv->doubleBuffer = TRUE; + pPriv->currentBuffer = 0; /* init to first buffer */ +#endif + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pGeode->adaptor = adapt; + + pGeode->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = GX2BlockHandler; + + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvColorKeyMode = MAKE_ATOM("XV_COLORKEYMODE"); + xvFilter = MAKE_ATOM("XV_FILTER"); +#if DBUF + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); +#endif + + GX2ResetVideo(pScrn); + + return adapt; +} + +#if REINIT +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) + return FALSE; + + if ((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int *)REGION_RECTS(A); + dataB = (int *)REGION_RECTS(B); + + while (num--) { + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} +#endif + +/*---------------------------------------------------------------------------- + * GX2StopVideo + * + * Description :This function is used to stop input and output video + * + * Parameters. + * pScreenInfo + * pScrn :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * exit :Flag indicating whether the offscreen areas used for video + * to be deallocated or not. + * Returns :none + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static void +GX2StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + GeodePtr pGeode = GEODEPTR(pScrn); + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + GX2AccelSync(pScrn); + if (exit) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + GFX(set_video_enable(0)); + } + if (pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + pPriv->videoStatus = 0; + pGeode->OverlayON = FALSE; + } else { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + +/*---------------------------------------------------------------------------- + * GX2SetPortAttribute + * + * Description :This function is used to set the attributes of a port like colorkeymode, + * double buffer support and filter. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * attribute :The port attribute to be set + * value :Value of the attribute to be set. + * + * Returns :Sucess if the attribute is supported, else BadMatch + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static int +GX2SetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + + GX2AccelSync(pScrn); + if (attribute == xvColorKey) { + pPriv->colorKey = value; + GX2SetColorkey(pScrn, pPriv); + } +#if DBUF + else if (attribute == xvDoubleBuffer) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } +#endif + else if (attribute == xvColorKeyMode) { + pPriv->colorKeyMode = value; + GX2SetColorkey(pScrn, pPriv); + } else if (attribute == xvFilter) { + pPriv->filter = value; + GFX(set_video_filter(pPriv->filter, pPriv->filter)); + } else + return BadMatch; + + return Success; +} + +/*---------------------------------------------------------------------------- + * GX2GetPortAttribute + * + * Description :This function is used to get the attributes of a port like hue, + * saturation,brightness or contrast. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * attribute :The port attribute to be read + * value :Pointer to the value of the attribute to be read. + * + * Returns :Sucess if the attribute is supported, else BadMatch + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static int +GX2GetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 * value, pointer data) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + + if (attribute == xvColorKey) { + *value = pPriv->colorKey; + } +#if DBUF + else if (attribute == xvDoubleBuffer) { + *value = (pPriv->doubleBuffer) ? 1 : 0; + } +#endif + else if (attribute == xvColorKeyMode) { + *value = pPriv->colorKeyMode; + } else if (attribute == xvFilter) { + *value = pPriv->filter; + } else + return BadMatch; + + return Success; +} + +/*---------------------------------------------------------------------------- + * GX2QueryBestSize + * + * Description :This function provides a way to query what the destination dimensions + * would end up being if they were to request that an area vid_w by vid_h + * from the video stream be scaled to rectangle of drw_w by drw_h on + * the screen. + * + * Parameters. + * ScreenInfoPtr + * pScrn :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * vid_w,vid_h :Width and height of the video data. + * drw_w,drw_h :Width and height of the scaled rectangle. + * p_w,p_h :Width and height of the destination rectangle. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ +static void +GX2QueryBestSize(ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ + *p_w = drw_w; + *p_h = drw_h; + + if (*p_w > 16384) + *p_w = 16384; +} + +static void +GX2CopyGreyscale(unsigned char *src, + unsigned char *dst, int srcPitch, int dstPitch, int h, int w) +{ + int i; + unsigned char *src2 = src; + unsigned char *dst2 = dst; + unsigned char *dst3; + unsigned char *src3; + + dstPitch <<= 1; + + while (h--) { + dst3 = dst2; + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + dst2 += dstPitch; + src2 += srcPitch; + } +} + +/*---------------------------------------------------------------------------- + * GX2CopyData420 + * + * Description : Copies data from src to destination + * + * Parameters. + * src : pointer to the source data + * dst : pointer to destination data + * srcPitch : pitch of the srcdata + * dstPitch : pitch of the destination data + * h & w : height and width of source data + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static void +GX2CopyData420(unsigned char *src, unsigned char *dst, + int srcPitch, int dstPitch, int h, int w) +{ + while (h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +/*---------------------------------------------------------------------------- + * GX2CopyData422 + * + * Description : Copies data from src to destination + * + * Parameters. + * src : pointer to the source data + * dst : pointer to destination data + * srcPitch : pitch of the srcdata + * dstPitch : pitch of the destination data + * h & w : height and width of source data + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static void +GX2CopyData422(unsigned char *src, unsigned char *dst, + int srcPitch, int dstPitch, int h, int w) +{ + w <<= 1; + while (h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +static FBAreaPtr +GX2AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, int numlines) +{ + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + FBAreaPtr new_area; + + if (area) { + if ((area->box.y2 - area->box.y1) >= numlines) + return area; + + if (xf86ResizeOffscreenArea(area, pScrn->displayWidth, numlines)) + return area; + + xf86FreeOffscreenArea(area); + } + + new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + numlines, 0, NULL, NULL, NULL); + + if (!new_area) { + int max_w, max_h; + + xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0, + FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME); + + if ((max_w < pScrn->displayWidth) || (max_h < numlines)) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + numlines, 0, NULL, NULL, NULL); + } + + return new_area; +} + +static BoxRec dstBox; +static int srcPitch = 0, srcPitch2 = 0, dstPitch = 0, dstPitch2 = 0; +static INT32 Bx1, Bx2, By1, By2; +static int top, left, npixels, nlines; +static int offset, s1offset = 0, s2offset = 0, s3offset = 0; +static unsigned char *dst_start; +static int d2offset = 0, d3offset = 0; +static Bool +RegionsIntersect(BoxPtr pRcl1, BoxPtr pRcl2, BoxPtr pRclResult) +{ + pRclResult->x1 = max(pRcl1->x1, pRcl2->x1); + pRclResult->x2 = min(pRcl1->x2, pRcl2->x2); + + if (pRclResult->x1 <= pRclResult->x2) { + pRclResult->y1 = max(pRcl1->y1, pRcl2->y1); + pRclResult->y2 = min(pRcl1->y2, pRcl2->y2); + + if (pRclResult->y1 <= pRclResult->y2) { + return (TRUE); + } + } + + return (FALSE); +} + +void +GX2SetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, short drw_h, + int id, int offset, ScrnInfoPtr pScrn) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + long xstart, ystart, xend, yend; + unsigned long lines = 0; + unsigned long y_extra, uv_extra = 0; + BoxRec ovly, display, result; + +#if defined(STB_X) + unsigned long startAddress = 0; +#endif + + xend = x + drw_w; + yend = y + drw_h; + + /* Take care of panning when panel is present */ + +#if defined(STB_X) + Gal_get_display_offset(&startAddress); + DeltaY = startAddress / pGeode->Pitch; + DeltaX = startAddress & (pGeode->Pitch - 1); + DeltaX /= (pScrn->bitsPerPixel >> 3); +#endif + + if (pGeode->Panel) { + ovly.x1 = x; + ovly.x2 = x + pGeode->video_dstw; + ovly.y1 = y; + ovly.y2 = y + pGeode->video_dsth; + + display.x1 = DeltaX; + display.x2 = DeltaX + pGeode->FPBX; + display.y1 = DeltaY; + display.y2 = DeltaY + pGeode->FPBY; + x = xend = 0; + if (RegionsIntersect(&display, &ovly, &result)) { + x = ovly.x1 - DeltaX; + xend = ovly.x2 - DeltaX; + y = ovly.y1 - DeltaY; + yend = ovly.y2 - DeltaY; + } + } + + /* LEFT CLIPPING */ + + if (x < 0) { + xstart = 0; + } else { + xstart = (unsigned long)x; + } + drw_w -= (xstart - x); + + /* TOP CLIPPING */ + + if (y < 0) { + lines = (-y) * src_h / drw_h; + ystart = 0; + drw_h += y; + y_extra = lines * dstPitch; + uv_extra = (lines >> 1) * (dstPitch2); + } else { + ystart = y; + lines = 0; + y_extra = 0; + } + GFX(set_video_window(xstart, ystart, xend - xstart, yend - ystart)); + if ((id == FOURCC_Y800) || (id == FOURCC_I420) || (id == FOURCC_YV12)) { + GFX(set_video_yuv_offsets(offset + y_extra, + offset + d3offset + uv_extra, + offset + d2offset + uv_extra)); + } else { + GFX(set_video_offset(offset + y_extra)); + } + GFX(set_video_left_crop(xstart - x)); +} + +/*---------------------------------------------------------------------------- + * GX2DisplayVideo + * + * Description : This function sets up the video registers for playing video + * It sets up the video format,width, height & position of the + * video window ,video offsets( y,u,v) and video pitches(y,u,v) + * Parameters. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static void +GX2DisplayVideo(ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, short drw_w, short drw_h) +{ + GeodePtr pGeode = GEODEPTR(pScrn); + + GX2AccelSync(pScrn); + + GFX(set_video_enable(1)); + + switch (id) { + case FOURCC_UYVY: /* UYVY */ + GFX(set_video_format(VIDEO_FORMAT_UYVY)); + GFX(set_video_size(width, height)); + break; + case FOURCC_Y800: /* Y800 - greyscale - we munge it! */ + case FOURCC_YV12: /* YV12 */ + case FOURCC_I420: /* I420 */ + GFX(set_video_format(VIDEO_FORMAT_Y0Y1Y2Y3)); + GFX(set_video_size(width, height)); + GFX(set_video_yuv_pitch(dstPitch, dstPitch2)); + break; + case FOURCC_YUY2: /* YUY2 */ + GFX(set_video_format(VIDEO_FORMAT_YUYV)); + GFX(set_video_size(width, height)); + break; + case FOURCC_Y2YU: /* Y2YU */ + GFX(set_video_format(VIDEO_FORMAT_Y2YU)); + GFX(set_video_size(width, height)); + break; + case FOURCC_YVYU: /* YVYU */ + GFX(set_video_format(VIDEO_FORMAT_YVYU)); + GFX(set_video_size(width, height)); + break; + } + if (pGeode->Panel) { + pGeode->video_x = dstBox->x1; + pGeode->video_y = dstBox->y1; + pGeode->video_w = width; + pGeode->video_h = height; + pGeode->video_srcw = src_w; + pGeode->video_srch = src_h; + pGeode->video_dstw = drw_w; + pGeode->video_dsth = drw_h; + pGeode->video_offset = offset; + pGeode->video_id = id; + pGeode->video_scrnptr = pScrn; + } + GFX(set_video_scale(width, height, drw_w, drw_h)); + GX2SetVideoPosition(dstBox->x1, dstBox->y1, width, height, src_w, + src_h, drw_w, drw_h, id, offset, pScrn); + +} + +/*---------------------------------------------------------------------------- + * GX2PutImage : This function writes a single frame of video into a drawable. + * The position and size of the source rectangle is specified by src_x,src_y, + * src_w and src_h. This data is stored in a system memory buffer at buf. + * The position and size of the destination rectangle is specified by drw_x, + * drw_y,drw_w,drw_h.The data is in the format indicated by the image descriptor + * and represents a source of size width by height. If sync is TRUE the driver + * should not return from this function until it is through reading the data from + * buf. Returning when sync is TRUE indicates that it is safe for the data at buf + * to be replaced,freed, or modified. + * + * + * Description : + * Parameters. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static int +GX2PutImage(ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char *buf, + short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data) +{ + GeodePortPrivPtr pPriv = (GeodePortPrivPtr) data; + GeodePtr pGeode = GEODEPTR(pScrn); + int new_h; + +#if REINIT + BOOL ReInitVideo = FALSE; +#endif + +#if XV_PROFILE + long oldtime, newtime; + + UpdateCurrentTime(); + oldtime = currentTime.milliseconds; +#endif + +#if REINIT +/* update cliplist */ + if (!RegionsEqual(&pPriv->clip, clipBoxes)) { + ReInitVideo = TRUE; + } + if (ReInitVideo) { + DEBUGMSG(1, (0, X_NONE, "Regional Not Equal - Init\n")); +#endif + + if (drw_w > 16384) + drw_w = 16384; + + /* Clip */ + Bx1 = src_x; + Bx2 = src_x + src_w; + By1 = src_y; + By2 = src_y + src_h; + + if ((Bx1 >= Bx2) || (By1 >= By2)) + return Success; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + + srcPitch = (width + 3) & ~3; /* of luma */ + dstPitch = (width + 31) & ~31; + + s2offset = srcPitch * height; + d2offset = dstPitch * height; + + srcPitch2 = ((width >> 1) + 3) & ~3; + dstPitch2 = ((width >> 1) + 15) & ~15; + + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + d3offset = (dstPitch2 * (height >> 1)) + d2offset; + + new_h = dstPitch * height; /* Y */ + new_h += (dstPitch2 * height); /* U+V */ + new_h += pGeode->Pitch - 1; + new_h /= pGeode->Pitch; + break; + + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + dstPitch = ((width << 1) + 3) & ~3; + srcPitch = (width << 1); + new_h = ((dstPitch * height) + pGeode->Pitch - 1) / pGeode->Pitch; + break; + } + +#if DBUF + if (pPriv->doubleBuffer) + new_h <<= 1; +#endif + + if (!(pPriv->area = GX2AllocateMemory(pScrn, pPriv->area, new_h))) + return BadAlloc; + + /* copy data */ + top = By1; + left = Bx1 & ~1; + npixels = ((Bx2 + 1) & ~1) - left; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + { + int tmp; + + top &= ~1; + offset = (pPriv->area->box.y1 * pGeode->Pitch) + (top * dstPitch); + +#if DBUF + if (pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_h >> 1) * pGeode->Pitch; +#endif + + dst_start = pGeode->FBBase + offset + left; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if (id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((By2 + 1) & ~1) - top; + } + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = By2 - top; + offset = (pPriv->area->box.y1 * pGeode->Pitch) + (top * dstPitch); +#if DBUF + if (pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_h >> 1) * pGeode->Pitch; +#endif + + dst_start = pGeode->FBBase + offset + left; + break; + } + s1offset = (top * srcPitch) + left; + +#if REINIT + /* update cliplist */ + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if (pPriv->colorKeyMode == 0) { + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + GX2DisplayVideo(pScrn, id, offset, width, height, dstPitch, + Bx1, By1, Bx2, By2, &dstBox, src_w, src_h, drw_w, + drw_h); + } +#endif + + switch (id) { + + case FOURCC_Y800: + GX2CopyGreyscale(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + case FOURCC_YV12: + case FOURCC_I420: + GX2CopyData420(buf + s1offset, dst_start, srcPitch, dstPitch, nlines, + npixels); + GX2CopyData420(buf + s2offset, dst_start + d2offset, srcPitch2, + dstPitch2, nlines >> 1, npixels >> 1); + GX2CopyData420(buf + s3offset, dst_start + d3offset, srcPitch2, + dstPitch2, nlines >> 1, npixels >> 1); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + GX2CopyData422(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } +#if !REINIT + /* update cliplist */ + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if (pPriv->colorKeyMode == 0) { + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); + } + GX2DisplayVideo(pScrn, id, offset, width, height, dstPitch, + Bx1, By1, Bx2, By2, &dstBox, src_w, src_h, drw_w, drw_h); +#endif + +#if XV_PROFILE + UpdateCurrentTime(); + newtime = currentTime.milliseconds; + DEBUGMSG(1, (0, X_NONE, "PI %d\n", newtime - oldtime)); +#endif + +#if DBUF + pPriv->currentBuffer ^= 1; +#endif + + pPriv->videoStatus = CLIENT_VIDEO_ON; + pGeode->OverlayON = TRUE; + return Success; +} + +/*---------------------------------------------------------------------------- + * GX2QueryImageAttributes + * + * Description :This function is called to let the driver specify how data + * for a particular image of size width by height should be + * stored. + * + * Parameters. + * pScreenInfo + * Ptr :Screen handler pointer having screen information. + * id :Id for the video format + * width :width of the image (can be modified by the driver) + * height :height of the image (can be modified by the driver) + * Returns : Size of the memory required for storing this image + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ +static int +GX2QueryImageAttributes(ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + int size; + int tmp; + + DEBUGMSG(0, (0, X_NONE, "QueryImageAttributes %X\n", id)); + + if (*w > 1024) + *w = 1024; + if (*h > 1024) + *h = 1024; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + return size; +} + +static void +GX2BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + GeodePtr pGeode = GEODEPTR(pScrn); + GeodePortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + pScreen->BlockHandler = pGeode->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = GX2BlockHandler; + + GX2AccelSync(pScrn); + if (pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if (pPriv->videoStatus & OFF_TIMER) { + if (pPriv->offTime < currentTime.milliseconds) { + GFX(set_video_enable(0)); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if (pPriv->freeTime < currentTime.milliseconds) { + if (pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + pPriv->videoStatus = 0; + } + } + } +} + +/****************** Offscreen stuff ***************/ + +typedef struct +{ + FBAreaPtr area; + FBLinearPtr linear; + Bool isOn; +} +OffscreenPrivRec, *OffscreenPrivPtr; + +/*---------------------------------------------------------------------------- + * GX2AllocateSurface + * + * Description :This function allocates an area of w by h in the offscreen + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns :None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ + +static int +GX2AllocateSurface(ScrnInfoPtr pScrn, + int id, + unsigned short w, unsigned short h, XF86SurfacePtr surface) +{ + FBAreaPtr area; + int pitch, fbpitch, numlines; + OffscreenPrivPtr pPriv; + + if ((w > 1024) || (h > 1024)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + fbpitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; + numlines = ((pitch * h) + fbpitch - 1) / fbpitch; + + if (!(area = GX2AllocateMemory(pScrn, NULL, numlines))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if (!(surface->pitches = xalloc(sizeof(int)))) + return BadAlloc; + if (!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + return BadAlloc; + } + if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + return BadAlloc; + } + + pPriv->area = area; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = area->box.y1 * fbpitch; + surface->devPrivate.ptr = (pointer) pPriv; + + return Success; +} + +static int +GX2StopSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + + if (pPriv->isOn) { + pPriv->isOn = FALSE; + } + + return Success; +} + +static int +GX2FreeSurface(XF86SurfacePtr surface) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + + if (pPriv->isOn) + GX2StopSurface(surface); + xf86FreeOffscreenArea(pPriv->area); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +GX2GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value) +{ + return GX2GetPortAttribute(pScrn, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrn))); +} + +static int +GX2SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value) +{ + return GX2SetPortAttribute(pScrn, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrn))); +} + +static int +GX2DisplaySurface(XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, RegionPtr clipBoxes) +{ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + GeodePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn); + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + DEBUGMSG(0, (0, X_NONE, "DisplaySuface\n")); + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if ((x1 >= x2) || (y1 >= y2)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); + + GX2DisplayVideo(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->isOn = TRUE; + if (portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + + return Success; +} + +/*---------------------------------------------------------------------------- + * GX2InitOffscreenImages + * + * Description :This function sets up the offscreen memory management.It fills + * in the XF86OffscreenImagePtr structure with functions to handle + * offscreen memory operations. + * + * Parameters. + * ScreenPtr + * pScreen :Screen handler pointer having screen information. + * + * Returns : None + * + * Comments :None + * +*---------------------------------------------------------------------------- +*/ +static void +GX2InitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = GX2AllocateSurface; + offscreenImages[0].free_surface = GX2FreeSurface; + offscreenImages[0].display = GX2DisplaySurface; + offscreenImages[0].stop = GX2StopSurface; + offscreenImages[0].setAttribute = GX2SetSurfaceAttribute; + offscreenImages[0].getAttribute = GX2GetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + +#endif /* !XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_msr_asm.S diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_msr_asm.S:1.1 --- /dev/null Thu Feb 27 12:31:12 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_msr_asm.S Thu Dec 12 17:13:34 2002 @@ -0,0 +1,229 @@ +/* +# $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_msr_asm.S,v 1.1 2002/12/12 22:13:34 dawes Exp $ +########################################################################## +# NSC_LIC_ALTERNATIVE_PREAMBLE +# +# Revision 1.0 +# +# National Semiconductor Alternative GPL-BSD License +# +# National Semiconductor Corporation licenses this software +# ("Software"): +# +# Geode Xfree frame buffer driver +# +# under one of the two following licenses, depending on how the +# Software is received by the Licensee. +# +# If this Software is received as part of the Linux Framebuffer or +# other GPL licensed software, then the GPL license designated +# NSC_LIC_GPL applies to this Software; in all other circumstances +# then the BSD-style license designated NSC_LIC_BSD shall apply. +# +# END_NSC_LIC_ALTERNATIVE_PREAMBLE +########################################################################## +# NSC_LIC_BSD +# +# National Semiconductor Corporation Open Source License for +# +# Geode Xfree frame buffer driver +# +# (BSD License with Export Notice) +# +# Copyright (c) 1999-2001 +# National Semiconductor Corporation. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the National Semiconductor Corporation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, +# INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. +# +# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF +# YOUR JURISDICTION. It is licensee's responsibility to comply with +# any export regulations applicable in licensee's jurisdiction. Under +# CURRENT (2001) U.S. export regulations this software +# is eligible for export from the U.S. and can be downloaded by or +# otherwise exported or reexported worldwide EXCEPT to U.S. embargoed +# destinations which include Cuba, Iraq, Libya, North Korea, Iran, +# Syria, Sudan, Afghanistan and any other country to which the U.S. +# has embargoed goods and services. +# +# END_NSC_LIC_BSD +########################################################################## +# NSC_LIC_GPL +# +# National Semiconductor Corporation Gnu General Public License for +# +# Geode Xfree frame buffer driver +# +# (GPL License with Export Notice) +# +# Copyright (c) 1999-2001 +# National Semiconductor Corporation. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted under the terms of the GNU General +# Public License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version +# +# In addition to the terms of the GNU General Public License, neither +# the name of the National Semiconductor Corporation nor the names of +# its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, +# INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. See the GNU General Public License for more details. +# +# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF +# YOUR JURISDICTION. It is licensee's responsibility to comply with +# any export regulations applicable in licensee's jurisdiction. Under +# CURRENT (2001) U.S. export regulations this software +# is eligible for export from the U.S. and can be downloaded by or +# otherwise exported or reexported worldwide EXCEPT to U.S. embargoed +# destinations which include Cuba, Iraq, Libya, North Korea, Iran, +# Syria, Sudan, Afghanistan and any other country to which the U.S. +# has embargoed goods and services. +# +# You should have received a copy of the GNU General Public License +# along with this file; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# END_NSC_LIC_GPL +*/ + +#include "assyntax.h" + + FILE("nsc_msr_asm.s") + + AS_BEGIN + + SEG_TEXT + + ALIGNTEXT4 + + GLOBL GLNAME(nsc_asm_msr_vsa_rd) + +GLNAME(nsc_asm_msr_vsa_rd): + + PUSH_L (EBP) + MOV_L (ESP,EBP) + + PUSH_L (EAX) + PUSH_L (EBX) + PUSH_L (ECX) + PUSH_L (EDX) + + MOV_L (REGOFF(8,EBP),ECX) + + /* unlock */ + MOV_W (CONST(0x0ac1c),DX) + MOV_W (CONST(0x0fc53),AX) + OUT_W + + MOV_W (CONST(0x0ac1c),DX) + MOV_W (CONST(0x0007),AX) + OUT_W + + MOV_W (CONST(0x0ac1e),DX) + IN_W + + MOV_L (REGOFF(12,EBP),EBX) + MOV_L (EDX,REGIND(EBX)) + MOV_L (REGOFF(16,EBP),EBX) + MOV_L (EAX,REGIND(EBX)) + + POP_L (EDX) + POP_L (ECX) + POP_L (EBX) + POP_L (EAX) + + LEAVE + RET + +/*###################################*/ + + + ALIGNTEXT4 + + GLOBL GLNAME(nsc_asm_msr_vsa_wr) + +GLNAME(nsc_asm_msr_vsa_wr): + + PUSH_L (EBP) + MOV_L (ESP,EBP) + + PUSH_L (EAX) + PUSH_L (EBX) + PUSH_L (ECX) + PUSH_L (EDX) + PUSH_L (EDI) + PUSH_L (ESI) + + MOV_L (REGOFF(8,EBP),ECX) + + /* unlock */ + MOV_W (CONST(0x0ac1c),DX) + MOV_L (CONST(0x0fc530007),EAX) + OUT_L + + MOV_L (REGOFF(12,EBP),EBX) + MOV_L (REGOFF(16,EBP),EAX) + + XOR_L (ESI,ESI) + XOR_L (EDI,EDI) + + MOV_W (CONST(0x0ac1e),DX) + + OUT_W + + POP_L (ESI) + POP_L (EDI) + POP_L (EDX) + POP_L (ECX) + POP_L (EBX) + POP_L (EAX) + + LEAVE + RET + +/*###################################*/ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_regacc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_regacc.c:1.2 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_regacc.c Tue Jan 14 04:34:32 2003 @@ -0,0 +1,421 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_regacc.c,v 1.2 2003/01/14 09:34:32 alanh Exp $ */ +/* + * $Workfile: nsc_regacc.c $ + * $Revision: 4 $ + * $Author: Sarma $ + * + * This is the main file used to add Durango graphics support to a software + * project. The main reason to have a single file include the other files + * is that it centralizes the location of the compiler options. This file + * should be tuned for a specific implementation, and then modified as needed + * for new Durango releases. The releases.txt file indicates any updates to + * this main file, such as a new definition for a new hardware platform. + * + * In other words, this file should be copied from the Durango source files + * once when a software project starts, and then maintained as necessary. + * It should not be recopied with new versions of Durango unless the + * developer is willing to tune the file again for the specific project. + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +void gfx_write_reg8(unsigned long offset, unsigned char value); +void gfx_write_reg16(unsigned long offset, unsigned short value); +void gfx_write_reg32(unsigned long offset, unsigned long value); +unsigned short gfx_read_reg16(unsigned long offset); +unsigned long gfx_read_reg32(unsigned long offset); +void gfx_write_vid32(unsigned long offset, unsigned long value); +unsigned long gfx_read_vid32(unsigned long offset); +unsigned long gfx_read_vip32(unsigned long offset); +void gfx_write_vip32(unsigned long offset, unsigned long value); +void gfx_mono_bitmap_to_screen_blt_swp(unsigned short srcx, + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); +unsigned int GetVideoMemSize(void); + +/* ROUTINES added accessing hardware reg */ +void +gfx_write_reg8(unsigned long offset, unsigned char value) +{ + WRITE_REG8(offset, value); +} + +void +gfx_write_reg16(unsigned long offset, unsigned short value) +{ + WRITE_REG16(offset, value); +} + +void +gfx_write_reg32(unsigned long offset, unsigned long value) +{ + WRITE_REG32(offset, value); +} +unsigned short +gfx_read_reg16(unsigned long offset) +{ + unsigned short value; + + value = READ_REG16(offset); + return value; +} +unsigned long +gfx_read_reg32(unsigned long offset) +{ + unsigned long value; + + value = READ_REG32(offset); + return value; +} + +void +gfx_write_vid32(unsigned long offset, unsigned long value) +{ + WRITE_VID32(offset, value); +} +unsigned long +gfx_read_vid32(unsigned long offset) +{ + unsigned long value; + + value = READ_VID32(offset); + return value; +} + +/*Addition for the VIP code */ +unsigned long +gfx_read_vip32(unsigned long offset) +{ + unsigned long value; + + value = READ_VIP32(offset); + return value; +} + +void +gfx_write_vip32(unsigned long offset, unsigned long value) +{ + WRITE_VIP32(offset, value); +} + +#define SWAP_BITS_IN_BYTES(v) \ + (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \ + ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \ + ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \ + ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7)) + +#define WRITE_GPREG_STRING32_SWP(regoffset, dwords, counter, array, array_offset, temp) \ +{ \ + temp = (unsigned long)array + (array_offset); \ + for (counter = 0; counter < dwords; counter++) \ + WRITE_GP32 (regoffset, SWAP_BITS_IN_BYTES(*((unsigned long *)temp + counter))); \ +} + +void +gfx_mono_bitmap_to_screen_blt_swp(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +{ + unsigned long dstoffset, size, bytes; + unsigned long offset, temp_offset, temp1 = 0, temp2 = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift = 0; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + bytes = ((srcx & 7) + width + 7) >> 3; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* Need to wait for busy instead of pending, since hardware clears */ + /* the host data FIFO at the beginning of a BLT. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | MGP_BM_SRC_HOST | MGP_BM_SRC_MONO); + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL OF THE DATA TO THE HOST SOURCE REGISTER */ + + while (height--) { + temp_offset = offset; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32_SWP(MGP_HST_SOURCE, 8, j, data, temp_offset, + temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32_SWP(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + + /* WRITE REMAINING BYTES */ + + shift = 0; + if (bytes_extra) + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + + offset += pitch; + } +} +unsigned int +GetVideoMemSize(void) +{ + unsigned int graphicsMemBaseAddr; + unsigned int totalMem = 0; + int i; + unsigned int graphicsMemMask, graphicsMemShift; + + /* Read graphics base address. */ + + graphicsMemBaseAddr = gfx_read_reg32(0x8414); + + if (1) { + unsigned int mcBankCfg = gfx_read_reg32(0x8408); + unsigned int dimmShift = 4; + + graphicsMemMask = 0x7FF; + graphicsMemShift = 19; + + /* Calculate total memory size for GXm. */ + + for (i = 0; i < 2; i++) { + if (((mcBankCfg >> dimmShift) & 0x7) != 0x7) { + switch ((mcBankCfg >> (dimmShift + 4)) & 0x7) { + case 0: + totalMem += 0x400000; + break; + case 1: + totalMem += 0x800000; + break; + case 2: + totalMem += 0x1000000; + break; + case 3: + totalMem += 0x2000000; + break; + case 4: + totalMem += 0x4000000; + break; + case 5: + totalMem += 0x8000000; + break; + case 6: + totalMem += 0x10000000; + break; + case 7: + totalMem += 0x20000000; + break; + default: + break; + } + } + dimmShift += 16; + } + } else { + unsigned int mcMemCntrl1 = gfx_read_reg32(0x8400); + unsigned int bankSizeShift = 12; + + graphicsMemMask = 0x3FF; + graphicsMemShift = 17; + + /* Calculate total memory size for GX. */ + + for (i = 0; i < 4; i++) { + switch ((mcMemCntrl1 >> bankSizeShift) & 0x7) { + case 1: + totalMem += 0x200000; + break; + case 2: + totalMem += 0x400000; + break; + case 3: + totalMem += 0x800000; + break; + case 4: + totalMem += 0x1000000; + break; + case 5: + totalMem += 0x2000000; + break; + default: + break; + } + bankSizeShift += 3; + } + } + + /* Calculate graphics memory base address */ + + graphicsMemBaseAddr &= graphicsMemMask; + graphicsMemBaseAddr <<= graphicsMemShift; + + return (totalMem - graphicsMemBaseAddr); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel.c:1.3 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel.c Tue Jan 14 04:34:32 2003 @@ -0,0 +1,175 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel.c,v 1.3 2003/01/14 09:34:32 alanh Exp $ */ +/* + * $Workfile: panel.c $ + * $Revision: 4 $ + * $Author: Sarma $ + * + * File Contents: This file contailns the panel include files and + * external pointer to the hardware. + * + * Project: Geode Xfree Frame buffer device driver. + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#if defined(linux) /* Linux */ + +#ifdef __KERNEL__ + +#include <linux/string.h> +#include <asm/io.h> + +#elif !defined(XFree86Server) + +#include <linux/fs.h> +#include <asm/mman.h> + +#endif /* __KERNEL__ */ +#elif defined(_WIN32) /* windows */ + +#include <windows.h> + +#endif + +#include "panel.h" +#include "gfx_defs.h" +#include "nsc.h" + +#define PLATFORM_DYNAMIC 1 /* runtime selection */ +#define PLATFORM_DRACO 0 /* Draco + 9210 */ +#define PLATFORM_CENTAURUS 1 /* Centaurus + 9211 RevA */ +#define PLATFORM_DORADO 1 /* Dorado + 9211 RevC */ +#define PLATFORM_GX2BASED 1 /* Redcloud */ + +unsigned char *XpressROMPtr; + +#include "pnl_init.c" +#include "pnl_bios.c" Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu1.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu1.c:1.4 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu1.c Thu Feb 6 12:46:02 2003 @@ -0,0 +1,2835 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu1.c,v 1.4 2003/02/06 17:46:02 alanh Exp $ */ +/* + * $Workfile: disp_gu1.c $ + * + * This file contains routines for the first generation display controller. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +void gu1_enable_compression(void); /* private routine definition */ +void gu1_disable_compression(void); /* private routine definition */ +void gfx_reset_video(void); /* private routine definition */ +int gfx_set_display_control(int sync_polarities); /* private routine definition */ +void gu1_delay_approximate(unsigned long milliseconds); +void gu1_delay_precise(unsigned long milliseconds); +int gu1_set_display_bpp(unsigned short bpp); +int gu1_is_display_mode_supported(int xres, int yres, int bpp, int hz); +int gu1_set_display_mode(int xres, int yres, int bpp, int hz); +int gu1_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, + unsigned short hblank_start, + unsigned short hsync_start, + unsigned short hsync_end, + unsigned short hblank_end, unsigned short htotal, + unsigned short vactive, + unsigned short vblank_start, + unsigned short vsync_start, + unsigned short vsync_end, + unsigned short vblank_end, unsigned short vtotal, + unsigned long frequency); +int gu1_set_vtotal(unsigned short vtotal); +void gu1_set_display_pitch(unsigned short pitch); +void gu1_set_display_offset(unsigned long offset); +int gu1_set_display_palette_entry(unsigned long index, unsigned long palette); +int gu1_set_display_palette(unsigned long *palette); +void gu1_video_shutdown(void); +void gu1_set_clock_frequency(unsigned long frequency); +int gu1_set_crt_enable(int enable); +void gu1_set_cursor_enable(int enable); +void gu1_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); +void gu1_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, + unsigned short yhotspot); +void gu1_set_cursor_shape32(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask); +void gu1_set_cursor_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask); +void gu1_set_icon_enable(int enable); +void gu1_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2); +void gu1_set_icon_position(unsigned long memoffset, unsigned short xpos); +void gu1_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines); + +int gu1_set_compression_enable(int enable); +int gu1_set_compression_offset(unsigned long offset); +int gu1_set_compression_pitch(unsigned short pitch); +int gu1_set_compression_size(unsigned short size); +void gu1_set_display_priority_high(int enable); +int gu1_test_timing_active(void); +int gu1_test_vertical_active(void); +int gu1_wait_vertical_blank(void); +void gu1_delay_milliseconds(unsigned long milliseconds); +void gu1_delay_microseconds(unsigned long microseconds); +void gu1_enable_panning(int x, int y); +int gu1_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +int gu1_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +void gu1_reset_timing_lock(void); + +int gu1_get_display_details(unsigned int mode, int *xres, int *yres, int *hz); +unsigned short gu1_get_display_pitch(void); +int gu1_get_vsa2_softvga_enable(void); +int gu1_get_sync_polarities(void); +unsigned long gu1_get_clock_frequency(void); +unsigned long gu1_get_max_supported_pixel_clock(void); +int gu1_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency); +int gu1_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu1_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu1_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency); +int gu1_get_display_mode_count(void); +int gu1_get_display_mode(int *xres, int *yres, int *bpp, int *hz); +unsigned long gu1_get_frame_buffer_line_size(void); +unsigned short gu1_get_hactive(void); +unsigned short gu1_get_hblank_start(void); +unsigned short gu1_get_hsync_start(void); +unsigned short gu1_get_hsync_end(void); +unsigned short gu1_get_hblank_end(void); +unsigned short gu1_get_htotal(void); +unsigned short gu1_get_vactive(void); +unsigned short gu1_get_vline(void); +unsigned short gu1_get_vblank_start(void); +unsigned short gu1_get_vsync_start(void); +unsigned short gu1_get_vsync_end(void); +unsigned short gu1_get_vblank_end(void); +unsigned short gu1_get_vtotal(void); +unsigned short gu1_get_display_bpp(void); +unsigned long gu1_get_display_offset(void); +int gu1_get_display_palette_entry(unsigned long index, + unsigned long *palette); +void gu1_get_display_palette(unsigned long *palette); +unsigned long gu1_get_cursor_enable(void); +unsigned long gu1_get_cursor_offset(void); +unsigned long gu1_get_cursor_position(void); +unsigned long gu1_get_cursor_clip(void); +unsigned long gu1_get_cursor_color(int color); +unsigned long gu1_get_icon_enable(void); +unsigned long gu1_get_icon_offset(void); +unsigned long gu1_get_icon_position(void); +unsigned long gu1_get_icon_color(int color); +int gu1_get_compression_enable(void); +unsigned long gu1_get_compression_offset(void); +unsigned short gu1_get_compression_pitch(void); +unsigned short gu1_get_compression_size(void); +int gu1_get_display_priority_high(void); +int gu1_get_valid_bit(int line); +void gu1_set_display_video_enable(int enable); +int gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp); +void gu1_set_display_video_size(unsigned short width, unsigned short height); +void gu1_set_display_video_offset(unsigned long offset); +unsigned long gu1_get_display_video_offset(void); +unsigned long gu1_get_display_video_size(void); + +/* VIDEO BUFFER SIZE */ + +unsigned long vid_buf_size = 0; +int vid_enabled = 0; + +/*----------------------------------------------------------------------------- + * GU1_DELAY_APPROXIMATE (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Delay the requested number of milliseconds by reading a register. This function + * generally takes longer than the requested time. + *-----------------------------------------------------------------------------*/ +void +gu1_delay_approximate(unsigned long milliseconds) +{ + /* ASSUME 300 MHz, 5 CLOCKS PER READ */ + +# define READS_PER_MILLISECOND 60000L + + unsigned long loop; + + loop = milliseconds * READS_PER_MILLISECOND; + while (loop-- > 0) { + READ_REG32(DC_UNLOCK); + } +} + +/*----------------------------------------------------------------------------- + * GU1_DELAY_PRECISE (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Delay the number of milliseconds on a more precise level, varying only by + * 1/10 of a ms. This function should only be called if an SC1200 is present. + *-----------------------------------------------------------------------------*/ +void +gu1_delay_precise(unsigned long milliseconds) +{ +#if GFX_VIDEO_SC1200 + +#define LOOP 1000 + unsigned long i, timer_start, timer_end, total_ticks, previous_ticks, + temp_ticks; + + /* Get current time */ + timer_start = IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE); + + /* Calculate expected end time */ + if (INB(SC1200_CB_BASE_ADDR + SC1200_CB_TMCNFG) & SC1200_TMCLKSEL_27MHZ) + total_ticks = 27000 * milliseconds; /* timer resolution is 27 MHz */ + else + total_ticks = 1000 * milliseconds; /* timer resolution is 1 MHz */ + + if (total_ticks > ((unsigned long)0xffffffff - timer_start)) /* wrap-around */ + timer_end = total_ticks - ((unsigned long)0xffffffff - timer_start); + else + timer_end = timer_start + total_ticks; + + /* in case of wrap around */ + if (timer_end < timer_start) { + previous_ticks = timer_start; + while (1) { + temp_ticks = IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE); + if (temp_ticks < previous_ticks) + break; + else + previous_ticks = temp_ticks; + for (i = 0; i < LOOP; i++) + READ_REG32(DC_UNLOCK); + } + } + /* now the non-wrap around part */ + while (1) { + for (i = 0; i < LOOP; i++) + READ_REG32(DC_UNLOCK); + if (IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE) > timer_end) + break; + } + +#endif /* GFX_VIDEO_SC1200 */ +} + +/*----------------------------------------------------------------------------- + * WARNING!!!! INACCURATE DELAY MECHANISM + * + * In an effort to keep the code self contained and operating system + * independent, the delay loop just performs reads of a display controller + * register. This time will vary for faster processors. The delay can always + * be longer than intended, only effecting the time of the mode switch + * (obviously want it to still be under a second). Problems with the hardware + * only arise if the delay is not long enough. + * + * For the SC1200, the high resolution timer can be used as an accurate mechanism + * for keeping time. However, in order to avoid a busy loop of IO reads, the + * timer is polled in-between busy loops, and therefore the actual delay might + * be longer than the requested delay by the time of one busy loop + * (which on a 200 MHz system took 95 us) + * + * There are thus two delay functions which are called from the main API routine. + * One is meant to be more precise and should only called if an SC1200 is present. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_delay_milliseconds(unsigned long milliseconds) +#else +void +gfx_delay_milliseconds(unsigned long milliseconds) +#endif +{ +#if GFX_VIDEO_SC1200 + +#if GFX_VIDEO_DYNAMIC + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) { +#endif + gu1_delay_precise(milliseconds); + return; +#if GFX_VIDEO_DYNAMIC + } +#endif + +#endif /* GFX_VIDEO_SC1200 */ + + gu1_delay_approximate(milliseconds); +} + +#if GFX_DISPLAY_DYNAMIC +void +gu1_delay_microseconds(unsigned long microseconds) +#else +void +gfx_delay_microseconds(unsigned long microseconds) +#endif +{ + /* ASSUME 300 MHz, 2 CLOCKS PER INCREMENT */ + + unsigned long loop_count = microseconds * 150; + + while (loop_count-- > 0) { + ; + } +} + +/*----------------------------------------------------------------------------- + * GFX_VIDEO_SHUTDOWN + * + * This routine disables the display controller output. + *----------------------------------------------------------------------------- + */ +void +gu1_video_shutdown(void) +{ + unsigned long unlock; + unsigned long gcfg, tcfg; + + /* DISABLE COMPRESSION */ + + gu1_disable_compression(); + + /* ALSO DISABLE VIDEO */ + /* Use private "reset video" routine to do all that is needed. */ + /* SC1200, for example, also disables the alpha blending regions. */ + + gfx_reset_video(); + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* READ THE CURRENT GX VALUES */ + + gcfg = READ_REG32(DC_GENERAL_CFG); + tcfg = READ_REG32(DC_TIMING_CFG); + + /* BLANK THE GX DISPLAY AND DISABLE THE TIMING GENERATOR */ + + tcfg &= ~((unsigned long)DC_TCFG_BLKE | (unsigned long)DC_TCFG_TGEN); + WRITE_REG32(DC_TIMING_CFG, tcfg); + + /* DELAY: WAIT FOR PENDING MEMORY REQUESTS */ + /* This delay is used to make sure that all pending requests to the */ + /* memory controller have completed before disabling the FIFO load. */ + + gfx_delay_milliseconds(1); + + /* DISABLE DISPLAY FIFO LOAD AND DISABLE COMPRESSION */ + + gcfg &= ~(unsigned long)(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); + return; +} + +/*----------------------------------------------------------------------------- + * GFX_SET_DISPLAY_BPP + * + * This routine programs the bpp in the display controller. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_bpp(unsigned short bpp) +#else +int +gfx_set_display_bpp(unsigned short bpp) +#endif +{ + unsigned long ocfg, lock; + + lock = READ_REG32(DC_UNLOCK); + ocfg = READ_REG32(DC_OUTPUT_CFG) & ~(DC_OCFG_8BPP | DC_OCFG_555); + + /* SET DC PIXEL FORMAT */ + + if (bpp == 8) + ocfg |= DC_OCFG_8BPP; + else if (bpp == 15) + ocfg |= DC_OCFG_555; + else if (bpp != 16) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_OUTPUT_CFG, ocfg); + WRITE_REG32(DC_UNLOCK, lock); + + /* SET BPP IN GRAPHICS PIPELINE */ + + gfx_set_bpp(bpp); + + return 0; +} + +/*----------------------------------------------------------------------------- + * GFX_SET_SPECIFIED_MODE + * This routine uses the parameters in the specified display mode structure + * to program the display controller hardware. + *----------------------------------------------------------------------------- + */ +int +gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) +{ + unsigned long unlock, value; + unsigned long gcfg, tcfg, ocfg; + unsigned long size, pitch; + unsigned long vid_buffer_size; + unsigned long hactive, vactive; + + gbpp = bpp; + + /* CHECK WHETHER TIMING CHANGE IS ALLOWED */ + /* Flag used for locking also overrides timing change restriction */ + + if (gfx_timing_lock && !(pMode->flags & GFX_MODE_LOCK_TIMING)) + return GFX_STATUS_ERROR; + + /* SET GLOBAL FLAG */ + + if (pMode->flags & GFX_MODE_LOCK_TIMING) + gfx_timing_lock = 1; + + /* DISABLE COMPRESSION */ + + gu1_disable_compression(); + + /* ALSO DISABLE VIDEO */ + /* Use private "reset video" routine to do all that is needed. */ + /* SC1200, for example, also disables the alpha blending regions. */ + + gfx_reset_video(); + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* READ THE CURRENT GX VALUES */ + + gcfg = READ_REG32(DC_GENERAL_CFG); + tcfg = READ_REG32(DC_TIMING_CFG); + + /* BLANK THE GX DISPLAY AND DISABLE THE TIMING GENERATOR */ + + tcfg &= ~((unsigned long)DC_TCFG_BLKE | (unsigned long)DC_TCFG_TGEN); + WRITE_REG32(DC_TIMING_CFG, tcfg); + + /* DELAY: WAIT FOR PENDING MEMORY REQUESTS + * This delay is used to make sure that all pending requests to the + * memory controller have completed before disabling the FIFO load. + */ + + gfx_delay_milliseconds(1); + + /* DISABLE DISPLAY FIFO LOAD AND DISABLE COMPRESSION */ + + gcfg &= ~(unsigned long)(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* CLEAR THE "DCLK_MUL" FIELD */ + + gcfg &= ~(unsigned long)(DC_GCFG_DDCK | DC_GCFG_DPCK | DC_GCFG_DFCK); + gcfg &= ~(unsigned long)DC_GCFG_DCLK_MASK; + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* SET THE DOT CLOCK FREQUENCY */ + /* Mask off the divide by two bit (bit 31) */ + + gfx_set_clock_frequency(pMode->frequency & 0x7FFFFFFF); + + /* DELAY: WAIT FOR THE PLL TO SETTLE */ + /* This allows the dot clock frequency that was just set to settle. */ + + gfx_delay_milliseconds(1); + + /* SET THE "DCLK_MUL" FIELD OF DC_GENERAL_CFG */ + /* The GX hardware divides the dot clock, so 2x really means that the */ + /* internal dot clock equals the external dot clock. */ + + if (pMode->frequency & 0x80000000) + gcfg |= 0x0040; + else + gcfg |= 0x0080; + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* DELAY: WAIT FOR THE ADL TO LOCK */ + /* This allows the clock generatation within GX to settle. This is */ + /* needed since some of the register writes that follow require that */ + /* clock to be present. */ + + /* We do a few to ensure we're synced */ + gfx_delay_milliseconds(1); + gfx_delay_milliseconds(1); + gfx_delay_milliseconds(1); + gfx_delay_milliseconds(1); + gfx_delay_milliseconds(1); + gfx_delay_milliseconds(1); + + /* SET THE GX DISPLAY CONTROLLER PARAMETERS */ + + WRITE_REG32(DC_FB_ST_OFFSET, 0); + WRITE_REG32(DC_CB_ST_OFFSET, 0); + WRITE_REG32(DC_CURS_ST_OFFSET, 0); + + /* SET LINE SIZE AND PITCH */ + /* Flat panels use the current flat panel line size to */ + /* calculate the pitch, but load the true line size */ + /* for the mode into the "Frame Buffer Line Size" field */ + /* of DC_BUF_SIZE. */ + + if (PanelEnable) + size = ModeWidth; + else + size = pMode->hactive; + + if (bpp > 8) + size <<= 1; + + /* ONLY PYRAMID SUPPORTS 4K LINE SIZE */ + + if (size <= 1024) { + pitch = 1024; + + /* SPECIAL CASE */ + /* Graphics acceleration in 16-bit pixel line double modes */ + /* requires a pitch of 2048. */ + + if ((pMode->flags & GFX_MODE_LINE_DOUBLE) && bpp > 8) + pitch <<= 1; + } else { + if (gfx_cpu_version == GFX_CPU_PYRAMID) + pitch = (size <= 2048) ? 2048 : 4096; + else + pitch = 2048; + } + WRITE_REG32(DC_LINE_DELTA, pitch >> 2); + + if (PanelEnable) { + size = pMode->hactive; + if (bpp > 8) + size <<= 1; + } + + /* SAVE PREVIOUSLY STORED VIDEO BUFFER SIZE */ + + vid_buffer_size = READ_REG32(DC_BUF_SIZE) & 0x3FFF0000; + + /* ADD 2 TO SIZE FOR POSSIBLE START ADDRESS ALIGNMENTS */ + + WRITE_REG32(DC_BUF_SIZE, ((size >> 3) + 2) | vid_buffer_size); + + /* ALWAYS ENABLE "PANEL" DATA FROM MEDIAGX */ + /* That is really just the 18 BPP data bus to the companion chip */ + + ocfg = DC_OCFG_PCKE | DC_OCFG_PDEL | DC_OCFG_PDEH; + + /* SET PIXEL FORMAT */ + + if (bpp == 8) + ocfg |= DC_OCFG_8BPP; + else if (bpp == 15) + ocfg |= DC_OCFG_555; + + /* ENABLE TIMING GENERATOR, SYNCS, AND FP DATA */ + + tcfg = DC_TCFG_FPPE | DC_TCFG_HSYE | DC_TCFG_VSYE | DC_TCFG_BLKE | + DC_TCFG_TGEN; + + /* SET FIFO PRIORITY, DCLK MULTIPLIER, AND FIFO ENABLE */ + /* Default 6/5 for FIFO, 2x for DCLK multiplier. */ + + gcfg = (6 << DC_GCFG_DFHPEL_POS) | (5 << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + + /* INCREASE FIFO PRIORITY FOR LARGE MODES */ + + if (pMode->hactive == 1280 && pMode->vactive == 1024) { + if ((bpp == 8) && (pMode->flags & GFX_MODE_85HZ)) + gcfg = (8l << DC_GCFG_DFHPEL_POS) | (7l << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + if ((bpp > 8) && (pMode->flags & GFX_MODE_75HZ)) + gcfg = (7l << DC_GCFG_DFHPEL_POS) | (6l << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + if ((bpp > 8) && (pMode->flags & GFX_MODE_85HZ)) + gcfg = (9l << DC_GCFG_DFHPEL_POS) | (8l << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + } + + /* SET DOT CLOCK MULTIPLIER */ + /* Bit 31 of frequency indicates divide frequency by two */ + + if (pMode->frequency & 0x80000000) + gcfg |= (1l << DC_GCFG_DCLK_POS); + else + gcfg |= (2l << DC_GCFG_DCLK_POS); + + /* DIVIDE VIDEO CLOCK */ + /* CPU core frequencies above 266 MHz will divide the video */ + /* clock by 4 to ensure that we are running below 150 MHz. */ + + if (gfx_cpu_frequency > 266) + gcfg |= DC_GCFG_VCLK_DIV; + + /* SET THE PIXEL AND LINE DOUBLE BITS IF NECESSARY */ + + hactive = pMode->hactive; + vactive = pMode->vactive; + gfx_line_double = 0; + gfx_pixel_double = 0; + + if (pMode->flags & GFX_MODE_LINE_DOUBLE) { + gcfg |= DC_GCFG_LDBL; + hactive <<= 1; + + /* SET GLOBAL FLAG */ + + gfx_line_double = 1; + } + + if (pMode->flags & GFX_MODE_PIXEL_DOUBLE) { + tcfg |= DC_TCFG_PXDB; + vactive <<= 1; + + /* SET GLOBAL FLAG */ + + gfx_pixel_double = 1; + } + + /* COMBINE AND SET TIMING VALUES */ + + value = (unsigned long)(hactive - 1) | + (((unsigned long)(pMode->htotal - 1)) << 16); + WRITE_REG32(DC_H_TIMING_1, value); + value = (unsigned long)(pMode->hblankstart - 1) | + (((unsigned long)(pMode->hblankend - 1)) << 16); + WRITE_REG32(DC_H_TIMING_2, value); + value = (unsigned long)(pMode->hsyncstart - 1) | + (((unsigned long)(pMode->hsyncend - 1)) << 16); + WRITE_REG32(DC_H_TIMING_3, value); + WRITE_REG32(DC_FP_H_TIMING, value); + value = (unsigned long)(vactive - 1) | + (((unsigned long)(pMode->vtotal - 1)) << 16); + WRITE_REG32(DC_V_TIMING_1, value); + value = (unsigned long)(pMode->vblankstart - 1) | + (((unsigned long)(pMode->vblankend - 1)) << 16); + WRITE_REG32(DC_V_TIMING_2, value); + value = (unsigned long)(pMode->vsyncstart - 1) | + (((unsigned long)(pMode->vsyncend - 1)) << 16); + WRITE_REG32(DC_V_TIMING_3, value); + value = (unsigned long)(pMode->vsyncstart - 2) | + (((unsigned long)(pMode->vsyncend - 2)) << 16); + WRITE_REG32(DC_FP_V_TIMING, value); + + WRITE_REG32(DC_OUTPUT_CFG, ocfg); + WRITE_REG32(DC_TIMING_CFG, tcfg); + gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* ENABLE FLAT PANEL CENTERING */ + /* For 640x480 modes displayed with the 9211 within a 800x600 */ + /* flat panel display, turn on flat panel centering. */ + + if (PanelEnable) { + if (ModeWidth < PanelWidth) { + tcfg = READ_REG32(DC_TIMING_CFG); + tcfg = tcfg | DC_TCFG_FCEN; + WRITE_REG32(DC_TIMING_CFG, tcfg); + gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ + } + } + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + + gfx_set_display_control(((pMode->flags & GFX_MODE_NEG_HSYNC) ? 1 : 0) | + ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); + + /* RESTORE VALUE OF DC_UNLOCK */ + + WRITE_REG32(DC_UNLOCK, unlock); + + /* ALSO WRITE GP_BLIT_STATUS FOR PITCH AND 8/18 BPP */ + /* Remember, only Pyramid supports 4K line pitch */ + + value = 0; + if (bpp > 8) + value |= BC_16BPP; + if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) + value |= BC_FB_WIDTH_4096; + else if (pitch > 1024) + value |= BC_FB_WIDTH_2048; + WRITE_REG16(GP_BLIT_STATUS, (unsigned short)value); + + return GFX_STATUS_OK; + +} /* end gfx_set_specified_mode() */ + +/*---------------------------------------------------------------------------- + * GFX_IS_DISPLAY_MODE_SUPPORTED + * + * This routine sets the specified display mode. + * + * Returns the index of the mode if successful and mode returned, -1 if the mode + * could not be found. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#else +int +gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#endif +{ + unsigned int mode = 0; + unsigned long hz_flag = 0, bpp_flag = 0; + + /* SET FLAGS TO MATCH REFRESH RATE */ + + if (hz == 56) + hz_flag = GFX_MODE_56HZ; + else if (hz == 60) + hz_flag = GFX_MODE_60HZ; + else if (hz == 70) + hz_flag = GFX_MODE_70HZ; + else if (hz == 72) + hz_flag = GFX_MODE_72HZ; + else if (hz == 75) + hz_flag = GFX_MODE_75HZ; + else if (hz == 85) + hz_flag = GFX_MODE_85HZ; + else + return -1; + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + + if (bpp == 8) + bpp_flag = GFX_MODE_8BPP; + else if (bpp == 15) + bpp_flag = GFX_MODE_15BPP; + else if (bpp == 16) + bpp_flag = GFX_MODE_16BPP; + else + return -1; + + /* ONLY PYRAMID SUPPORTS 4K PITCH */ + + if (gfx_cpu_version != GFX_CPU_PYRAMID && xres > 1024) { + if (bpp > 8) + return (-1); /* return with mode not found */ + } + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_GX_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned short)xres) && + (DisplayParams[mode].vactive == (unsigned short)yres) && + (DisplayParams[mode].flags & hz_flag) && + (DisplayParams[mode].flags & bpp_flag)) { + + /* SET THE DISPLAY CONTROLLER FOR THE SELECTED MODE */ + + return (mode); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_MODE + * + * This routine sets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be set. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_mode(int xres, int yres, int bpp, int hz) +#else +int +gfx_set_display_mode(int xres, int yres, int bpp, int hz) +#endif +{ + int mode; + + /* DISABLE FLAT PANEL */ + /* Flat Panel settings are enabled by the function gfx_set_fixed_timings */ + /* and disabled by gfx_set_display_mode. */ + + PanelEnable = 0; + + mode = gfx_is_display_mode_supported(xres, yres, bpp, hz); + if (mode >= 0) { + if (gu1_set_specified_mode(&DisplayParams[mode], bpp) == GFX_STATUS_OK) + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_TIMINGS + * + * This routine sets the display controller mode using the specified timing + * values (as opposed to using the tables internal to Durango). + * + * Returns GFX_STATUS_OK on success, GFX_STATUS_ERROR otherwise. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) +#else +int +gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) +#endif +{ + /* SET MODE STRUCTURE WITH SPECIFIED VALUES */ + + gfx_display_mode.flags = 0; + if (flags & 1) + gfx_display_mode.flags |= GFX_MODE_NEG_HSYNC; + if (flags & 2) + gfx_display_mode.flags |= GFX_MODE_NEG_VSYNC; + if (flags & 0x1000) + gfx_display_mode.flags |= GFX_MODE_LOCK_TIMING; + gfx_display_mode.hactive = hactive; + gfx_display_mode.hblankstart = hblankstart; + gfx_display_mode.hsyncstart = hsyncstart; + gfx_display_mode.hsyncend = hsyncend; + gfx_display_mode.hblankend = hblankend; + gfx_display_mode.htotal = htotal; + gfx_display_mode.vactive = vactive; + gfx_display_mode.vblankstart = vblankstart; + gfx_display_mode.vsyncstart = vsyncstart; + gfx_display_mode.vsyncend = vsyncend; + gfx_display_mode.vblankend = vblankend; + gfx_display_mode.vtotal = vtotal; + gfx_display_mode.frequency = frequency; + + /* CALL ROUTINE TO SET MODE */ + + return (gu1_set_specified_mode(&gfx_display_mode, bpp)); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_VTOTAL + * + * This routine sets the display controller vertical total to + * "vtotal". As a side effect it also sets vertical blank end. + * It should be used when only this value needs to be changed, + * due to speed considerations. + * + * Note: it is the caller's responsibility to make sure that + * a legal vtotal is used, i.e. that "vtotal" is greater than or + * equal to vsync end. + * + * Always returns 0. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_vtotal(unsigned short vtotal) +#else +int +gfx_set_vtotal(unsigned short vtotal) +#endif +{ + unsigned long unlock, tcfg, timing1, timing2; + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* READ THE CURRENT GX VALUES */ + + tcfg = READ_REG32(DC_TIMING_CFG); + timing1 = READ_REG32(DC_V_TIMING_1); + timing2 = READ_REG32(DC_V_TIMING_2); + + /* DISABLE THE TIMING GENERATOR */ + + WRITE_REG32(DC_TIMING_CFG, tcfg & ~(unsigned long)DC_TCFG_TGEN); + + /* WRITE NEW TIMING VALUES */ + + WRITE_REG32(DC_V_TIMING_1, + (timing1 & 0xffff) | (unsigned long)(vtotal - 1) << 16); + WRITE_REG32(DC_V_TIMING_2, + (timing2 & 0xffff) | (unsigned long)(vtotal - 1) << 16); + + /* RESTORE GX VALUES */ + + WRITE_REG32(DC_TIMING_CFG, tcfg); + WRITE_REG32(DC_UNLOCK, unlock); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_pitch + * + * This routine sets the pitch of the frame buffer to the specified value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_pitch(unsigned short pitch) +#else +void +gfx_set_display_pitch(unsigned short pitch) +#endif +{ + unsigned long value = 0; + unsigned long lock = READ_REG32(DC_UNLOCK); + + value = READ_REG32(DC_LINE_DELTA) & 0xFFFFF000; + value |= (pitch >> 2); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_LINE_DELTA, value); + WRITE_REG32(DC_UNLOCK, lock); + + /* ALSO UPDATE PITCH IN GRAPHICS ENGINE */ + /* Pyramid alone supports 4K line pitch */ + + value = (unsigned long)READ_REG16(GP_BLIT_STATUS); + value &= ~(BC_FB_WIDTH_2048 | BC_FB_WIDTH_4096); + + if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) + value |= BC_FB_WIDTH_4096; + + else if (pitch > 1024) + value |= BC_FB_WIDTH_2048; + + WRITE_REG16(GP_BLIT_STATUS, (unsigned short)value); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_offset + * + * This routine sets the start address of the frame buffer. It is + * typically used to pan across a virtual desktop (frame buffer larger than + * the displayed screen) or to flip the display between multiple buffers. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_offset(unsigned long offset) +#else +void +gfx_set_display_offset(unsigned long offset) +#endif +{ + /* UPDATE FRAME BUFFER OFFSET */ + + unsigned long lock; + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* START ADDRESS EFFECTS DISPLAY COMPRESSION */ + /* Disable compression for non-zero start addresss values. */ + /* Enable compression if offset is zero and comression is intended to */ + /* be enabled from a previous call to "gfx_set_compression_enable". */ + /* Compression should be disabled BEFORE the offset is changed */ + /* and enabled AFTER the offset is changed. */ + + if (offset == 0) { + WRITE_REG32(DC_FB_ST_OFFSET, offset); + if (gfx_compression_enabled) { + /* WAIT FOR THE OFFSET TO BE LATCHED */ + gfx_wait_vertical_blank(); + gu1_enable_compression(); + } + } else { + /* ONLY DISABLE COMPRESSION ONCE */ + + if (gfx_compression_active) + gu1_disable_compression(); + + WRITE_REG32(DC_FB_ST_OFFSET, offset); + } + + WRITE_REG32(DC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette_entry + * + * This routine sets an palette entry in the display controller. + * A 32-bit X:R:G:B value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_display_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + unsigned long data; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(DC_PAL_ADDRESS, index); + data = ((palette >> 2) & 0x0003F) | + ((palette >> 4) & 0x00FC0) | ((palette >> 6) & 0x3F000); + WRITE_REG32(DC_PAL_DATA, data); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette + * + * This routine sets the entire palette in the display controller. + * A pointer is provided to a 256 entry table of 32-bit X:R:G:B values. + * Restriction: + * Due to SC1200 Issue #748 (in Notes DB) this function should be called only + * when DCLK is active, i.e PLL is already powered up and genlock is not active. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_palette(unsigned long *palette) +#else +int +gfx_set_display_palette(unsigned long *palette) +#endif +{ + unsigned long data, i; + + WRITE_REG32(DC_PAL_ADDRESS, 0); + if (palette) { + for (i = 0; i < 256; i++) { + /* CONVERT 24 BPP COLOR DATA TO 18 BPP COLOR DATA */ + + data = ((palette[i] >> 2) & 0x0003F) | + ((palette[i] >> 4) & 0x00FC0) | ((palette[i] >> 6) & 0x3F000); + WRITE_REG32(DC_PAL_DATA, data); + } + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_enable + * + * This routine enables or disables the hardware cursor. + * + * WARNING: The cusrsor start offset must be set by setting the cursor + * position before calling this routine to assure that memory reads do not + * go past the end of graphics memory (this can hang GXm). + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_enable(int enable) +#else +void +gfx_set_cursor_enable(int enable) +#endif +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR CURSOR ENABLE BIT */ + + unlock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + if (enable) + gcfg |= DC_GCFG_CURE; + else + gcfg &= ~(DC_GCFG_CURE); + + /* WRITE NEW REGISTER VALUE */ + + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_colors + * + * This routine sets the colors of the hardware cursor. + * Restriction: + * Due to SC1200 Issue #748 (in Notes DB) this function should be called only + * when DCLK is active, i.e PLL is already powered up. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#else +void +gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#endif +{ + unsigned long value; + + /* If genlock is enabled DCLK might be disabled in vertical blank. */ + /* Due to SC1200 Issue #748 in Notes DB this would fail the cursor color settings */ + /* So Wait for vertical blank to end */ + +#if GFX_VIDEO_SC1200 + if (gfx_test_timing_active()) + while ((gfx_get_vline()) > gfx_get_vactive()) ; +#endif + + /* SET CURSOR COLORS */ + + WRITE_REG32(DC_PAL_ADDRESS, 0x100); + value = ((bkcolor & 0x000000FC) >> 2) | + ((bkcolor & 0x0000FC00) >> (2 + 8 - 6)) | + ((bkcolor & 0x00FC0000) >> (2 + 16 - 12)); + WRITE_REG32(DC_PAL_DATA, value); + value = ((fgcolor & 0x000000FC) >> 2) | + ((fgcolor & 0x0000FC00) >> (2 + 8 - 6)) | + ((fgcolor & 0x00FC0000) >> (2 + 16 - 12)); + WRITE_REG32(DC_PAL_DATA, value); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_position + * + * This routine sets the position of the hardware cusror. The starting + * offset of the cursor buffer must be specified so that the routine can + * properly clip scanlines if the cursor is off the top of the screen. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#else +void +gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#endif +{ + unsigned long unlock; + + short x, y; + short xoffset = 0; + short yoffset = 0; + + /* SUPPORT CURSOR IN EMULATED VGA MODES */ + /* Timings are for twice the resolution */ + + if (gfx_pixel_double) + xpos <<= 1; + if (gfx_line_double) + ypos <<= 1; + + x = (short)xpos - (short)xhotspot; + y = (short)ypos - (short)yhotspot; + if (x < -31) + return; + if (y < -31) + return; + if (x < 0) { + xoffset = -x; + x = 0; + } + if (y < 0) { + yoffset = -y; + y = 0; + } + memoffset += (unsigned long)yoffset << 3; + + if (PanelEnable) { + if ((ModeWidth > PanelWidth) || (ModeHeight > PanelHeight)) { + gfx_enable_panning(xpos, ypos); + x = x - (short)panelLeft; + y = y - (short)panelTop; + } + } + + /* SET CURSOR POSITION */ + + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_CURS_ST_OFFSET, memoffset); + WRITE_REG32(DC_CURSOR_X, (unsigned long)x | + (((unsigned long)xoffset) << 11)); + WRITE_REG32(DC_CURSOR_Y, (unsigned long)y | + (((unsigned long)yoffset) << 11)); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape32 + * + * This routine loads 32x32 cursor data into the specified location in + * graphics memory. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#else +void +gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#endif +{ + int i; + unsigned long value; + + for (i = 0; i < 32; i++) { + /* CONVERT TO 16 BITS AND MASK, 16 BITS XOR MASK PER DWORD */ + + value = (andmask[i] & 0xFFFF0000) | (xormask[i] >> 16); + WRITE_FB32(memoffset, value); + memoffset += 4; + value = (andmask[i] << 16) | (xormask[i] & 0x0000FFFF); + WRITE_FB32(memoffset, value); + memoffset += 4; + } +} + +/*--------------------------------------------------------------------------- + * gu1_enable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It enables display compression. + *--------------------------------------------------------------------------- + */ +void +gu1_enable_compression(void) +{ + int i; + unsigned long unlock, gcfg, offset; + + /* DO NOT ENABLE IF START ADDRESS IS NOT ZERO */ + + offset = READ_REG32(DC_FB_ST_OFFSET) & 0x003FFFFF; + if (offset != 0) + return; + + /* DO NOT ENABLE IF WE ARE WITHIN AN EMULATED VGA MODE */ + + if (gfx_line_double || gfx_pixel_double) + return; + + /* SET GLOBAL INDICATOR */ + + gfx_compression_active = 1; + + /* CLEAR DIRTY/VALID BITS IN MEMORY CONTROLLER */ + /* Software is required to do this before enabling compression. */ + /* Don't want controller to think that old lines are still valid. */ + + for (i = 0; i < 1024; i++) { + WRITE_REG32(MC_DR_ADD, i); + WRITE_REG32(MC_DR_ACC, 0); + } + + /* TURN ON COMPRESSION CONTROL BITS */ + + unlock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + gcfg |= DC_GCFG_CMPE | DC_GCFG_DECE; + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gu1_disable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It disables display compression. + *--------------------------------------------------------------------------- + */ +void +gu1_disable_compression(void) +{ + unsigned long unlock, gcfg; + + /* SET GLOBAL INDICATOR */ + + gfx_compression_active = 0; + + /* TURN OFF COMPRESSION CONTROL BITS */ + + unlock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + gcfg &= ~(DC_GCFG_CMPE | DC_GCFG_DECE); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_enable + * + * This routine enables or disables display compression. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_enable(int enable) +#else +int +gfx_set_compression_enable(int enable) +#endif +{ + /* SET GLOBAL VARIABLE FOR INTENDED STATE */ + /* Compression can only be enabled for non-zero start address values. */ + /* Keep state to enable compression on start address changes. */ + + gfx_compression_enabled = enable; + if (enable) + gu1_enable_compression(); + else + gu1_disable_compression(); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_offset + * + * This routine sets the base offset for the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_offset(unsigned long offset) +#else +int +gfx_set_compression_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + /* MUST BE 16-BYTE ALIGNED FOR GXLV */ + + if (offset & 0x0F) + return (1); + + /* SET REGISTER VALUE */ + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_CB_ST_OFFSET, offset); + WRITE_REG32(DC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_pitch + * + * This routine sets the pitch, in bytes, of the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_pitch(unsigned short pitch) +#else +int +gfx_set_compression_pitch(unsigned short pitch) +#endif +{ + unsigned long lock, line_delta; + + /* SET REGISTER VALUE */ + + lock = READ_REG32(DC_UNLOCK); + line_delta = READ_REG32(DC_LINE_DELTA) & 0xFF800FFF; + line_delta |= ((unsigned long)pitch << 10l) & 0x007FF000; + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_LINE_DELTA, line_delta); + WRITE_REG32(DC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_size + * + * This routine sets the line size of the compression buffer, which is the + * maximum number of bytes allowed to store a compressed line. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_size(unsigned short size) +#else +int +gfx_set_compression_size(unsigned short size) +#endif +{ + unsigned long lock, buf_size; + + /* SUBTRACT 16 FROM SIZE */ + /* The display controller will actually write */ + /* 2 extra QWords. So, if we assume that "size" */ + /* refers to the allocated size, we must subtract */ + /* 16 bytes. */ + + size -= 16; + + /* SET REGISTER VALUE */ + + lock = READ_REG32(DC_UNLOCK); + buf_size = READ_REG32(DC_BUF_SIZE) & 0xFFFF01FF; + buf_size |= (((size >> 2) + 1) & 0x7F) << 9; + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_BUF_SIZE, buf_size); + WRITE_REG32(DC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine enables/disables video on GX. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_video_enable(int enable) +#else +void +gfx_set_display_video_enable(int enable) +#endif +{ + unsigned long lock, gcfg, buf_size; + + lock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + buf_size = READ_REG32(DC_BUF_SIZE); + + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + vid_enabled = enable; + + /* SET THE BUFFER SIZE TO A NON-ZERO VALUE ONLY WHEN */ + /* ENABLING VIDEO */ + + if (enable) { + gcfg |= (DC_GCFG_VIDE | DC_GCFG_VRDY); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + WRITE_REG32(DC_BUF_SIZE, (buf_size & 0x0000FFFFl) | vid_buf_size); + } + + /* CLEAR THE VIDEO BUFFER SIZE WHEN DISABLING VIDEO */ + + else { + gcfg &= ~(DC_GCFG_VIDE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + vid_buf_size = buf_size & 0xFFFF0000l; + WRITE_REG32(DC_BUF_SIZE, buf_size & 0x0000FFFFl); + } + + WRITE_REG32(DC_UNLOCK, lock); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_video_size(unsigned short width, unsigned short height) +#else +void +gfx_set_display_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long lock, size, value; + + size = (unsigned long)(width << 1) * (unsigned long)height; + + /* STORE THE VIDEO BUFFER SIZE AS A GLOBAL */ + + vid_buf_size = ((size + 63) >> 6) << 16; + + /* DO NOT SET THE VIDEO SIZE IF VIDEO IS DISABLED */ + + if (!vid_enabled) + return; + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + value = READ_REG32(DC_BUF_SIZE) & 0x0000FFFF; + value |= vid_buf_size; + WRITE_REG32(DC_BUF_SIZE, value); + WRITE_REG32(DC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_video_offset(unsigned long offset) +#else +void +gfx_set_display_video_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + offset &= 0x003FFFFF; + WRITE_REG32(DC_VID_ST_OFFSET, offset); + WRITE_REG32(DC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_priority_high + * + * This routine controls the x-bus round robin arbitration mechanism. + * When enable is TRUE, graphics pipeline requests and non-critical display + * controller requests are arbitrated at the same priority as processor + * requests. When FALSE processor requests are arbitrated at a higher priority. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_priority_high(int enable) +#else +void +gfx_set_display_priority_high(int enable) +#endif +{ + unsigned long lock, control; + + lock = READ_REG32(DC_UNLOCK); + control = READ_REG32(MC_MEM_CNTRL1); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + if (enable) + control |= MC_XBUSARB; + else + control &= ~(MC_XBUSARB); + WRITE_REG32(MC_MEM_CNTRL1, control); + WRITE_REG32(DC_UNLOCK, lock); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_test_timing_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_test_timing_active(void) +#else +int +gfx_test_timing_active(void) +#endif +{ + if (READ_REG32(DC_TIMING_CFG) & DC_TCFG_TGEN) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_test_vertical_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_test_vertical_active(void) +#else +int +gfx_test_vertical_active(void) +#endif +{ + if (READ_REG32(DC_TIMING_CFG) & DC_TCFG_VNA) + return (0); + else + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_wait_vertical_blank + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_wait_vertical_blank(void) +#else +int +gfx_wait_vertical_blank(void) +#endif +{ + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_panning + * + * This routine enables the panning when the Mode is bigger than the panel + * size. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_enable_panning(int x, int y) +#else +void +gfx_enable_panning(int x, int y) +#endif +{ + unsigned long modeBytesPerPixel; + unsigned long modeBytesPerScanline = 0; + unsigned long startAddress = 0; + + modeBytesPerPixel = (gbpp + 7) / 8; + modeBytesPerScanline = + (((ModeWidth + 1023) / 1024) * 1024) * modeBytesPerPixel; + + /* TEST FOR NO-WORK */ + + if (x >= DeltaX && (unsigned short)x < (PanelWidth + DeltaX) && + y >= DeltaY && (unsigned short)y < (PanelHeight + DeltaY)) + return; + + /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ + /* Test the boundary conditions for each coordinate and update */ + /* all variables and the starting offset accordingly. */ + + if (x < DeltaX) + DeltaX = x; + + else if ((unsigned short)x >= (DeltaX + PanelWidth)) + DeltaX = x - PanelWidth + 1; + + if (y < DeltaY) + DeltaY = y; + + else if ((unsigned short)y >= (DeltaY + PanelHeight)) + DeltaY = y - PanelHeight + 1; + + /* CALCULATE THE START OFFSET */ + + startAddress = + (DeltaX * modeBytesPerPixel) + (DeltaY * modeBytesPerScanline); + + gfx_set_display_offset(startAddress); + + /* SET PANEL COORDINATES */ + /* Panel's x position must be DWORD aligned */ + + panelTop = DeltaY; + panelLeft = DeltaX * modeBytesPerPixel; + + if (panelLeft & 3) + panelLeft = (panelLeft & 0xFFFFFFFC) + 4; + + panelLeft /= modeBytesPerPixel; + +} + +/*--------------------------------------------------------------------------- + * gfx_set_fixed_timings + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + unsigned int mode; + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_FIXED_TIMINGS_MODES; mode++) { + if ((FixedParams[mode].xres == width) && + (FixedParams[mode].yres == height) && + (FixedParams[mode].panelresx == panelResX) && + (FixedParams[mode].panelresy == panelResY)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + FIXEDTIMINGS *fmode = &FixedParams[mode]; + + gfx_set_display_timings(bpp, 3, fmode->hactive, fmode->hblankstart, + fmode->hsyncstart, fmode->hsyncend, + fmode->hblankend, fmode->htotal, + fmode->vactive, fmode->vblankstart, + fmode->vsyncstart, fmode->vsyncend, + fmode->vblankend, fmode->vtotal, + fmode->frequency); + + return (1); + } /* end if() */ + } /* end for() */ + + return (-1); +} + +/*--------------------------------------------------------------------------- + * gfx_set_panel_present + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + /* SET VALID BPP */ + /* 16BPP is the default. */ + + if (bpp != 8 && bpp != 15 && bpp != 16) + bpp = 16; + + /* RECORD PANEL PARAMETERS */ + /* This routine does not touch any panel timings. It is used when custom panel */ + /* settings are set up in advance by the BIOS or an application, but the */ + /* application still requires access to other panel functionality provided by */ + /* Durango (i.e. panning). */ + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + gbpp = bpp; + + /* PROGRAM THE BPP IN THE DISPLAY CONTROLLER */ + + gfx_set_display_bpp(bpp); + + return (GFX_STATUS_OK); +} + +/*-----------------------------------------------------------------------* + * THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED: * + * gfx_get_hsync_end, gfx_get_htotal, gfx_get_vsync_end, gfx_get_vtotal * + * are used by the video overlay routines. * + * * + * gfx_get_vline and gfx_vactive are used to prevent an issue for the * + * SC1200. * + * * + * The others are part of the Durango API. * + *-----------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- + * gfx_get_display_pitch + * + * This routine returns the current pitch of the frame buffer, in bytes. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_display_pitch(void) +#else +unsigned short +gfx_get_display_pitch(void) +#endif +{ + unsigned long value; + + if (gfx_cpu_version == GFX_CPU_PYRAMID) { /* Pyramid update for 4KB line pitch */ + value = (READ_REG32(DC_LINE_DELTA) & 0x07FF) << 2; + } else { + value = (READ_REG32(DC_LINE_DELTA) & 0x03FF) << 2; + } + + return ((unsigned short)value); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_DETAILS + * + * This routine gets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be get. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#else +int +gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#endif +{ + if (mode < NUM_GX_DISPLAY_MODES) { + if (DisplayParams[mode].flags & GFX_MODE_56HZ) + *hz = 56; + else if (DisplayParams[mode].flags & GFX_MODE_60HZ) + *hz = 60; + else if (DisplayParams[mode].flags & GFX_MODE_70HZ) + *hz = 70; + else if (DisplayParams[mode].flags & GFX_MODE_72HZ) + *hz = 72; + else if (DisplayParams[mode].flags & GFX_MODE_75HZ) + *hz = 75; + else if (DisplayParams[mode].flags & GFX_MODE_85HZ) + *hz = 85; + + *xres = DisplayParams[mode].hactive; + *yres = DisplayParams[mode].vactive; + + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_MODE_COUNT + * + * Returns number of modes supported. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_mode_count(void) +#else +int +gfx_get_display_mode_count(void) +#endif +{ + return (NUM_GX_DISPLAY_MODES); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_line_size + * + * Returns the current frame buffer line size, in bytes + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_frame_buffer_line_size(void) +#else +unsigned long +gfx_get_frame_buffer_line_size(void) +#endif +{ + return ((READ_REG32(DC_BUF_SIZE) & 0x1FF) << 3); +} + +/*---------------------------------------------------------------------------- + * gfx_mode_frequency_supported + * + * This routine examines if the requested mode with pixel frequency is supported. + * + * Returns >0 if successful , <0 if freq. could not be found and matched. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#else +int +gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value; + unsigned long bpp_flag = 0; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].frequency == frequency)) { + int hz = 0; + + value = DisplayParams[index].flags; + + if (value & GFX_MODE_60HZ) + hz = 60; + else if (value & GFX_MODE_70HZ) + hz = 70; + else if (value & GFX_MODE_72HZ) + hz = 72; + else if (value & GFX_MODE_75HZ) + hz = 75; + else if (value & GFX_MODE_85HZ) + hz = 85; + return (hz); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_frequency + * + * This routine maps the frequency to close match refresh rate + * + * Returns . + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + min = 0x7fffffff; + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].htotal == (unsigned short)xres) && + (DisplayParams[index].vtotal == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_mode + * + * This routine is identical to the gfx_get_refreshrate_from_frequency, + * except that the active timing values are compared instead of the total + * values. Some modes (such as 70Hz and 72Hz) may be confused in this routine. + * + * Returns . + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + min = 0x7fffffff; + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frequency_from_refreshrate + * + * This routine maps the refresh rate to the closest matching PLL frequency. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#else +int +gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#endif +{ + int retval = -1; + unsigned long hz_flag = 0; + unsigned long index, bpp_flag = 0; + + *frequency = 0; + + if (hz == 60) + hz_flag = GFX_MODE_60HZ; + else if (hz == 70) + hz_flag = GFX_MODE_70HZ; + else if (hz == 72) + hz_flag = GFX_MODE_72HZ; + else if (hz == 75) + hz_flag = GFX_MODE_75HZ; + else if (hz == 85) + hz_flag = GFX_MODE_85HZ; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].flags & hz_flag)) { + *frequency = DisplayParams[index].frequency; + retval = 1; + } + } + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_supported_pixel_clock + * + * This routine returns the maximum recommended speed for the pixel clock. The + * return value is an integer of the format xxxyyy, where xxx.yyy is the maximum + * floating point pixel clock speed. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_max_supported_pixel_clock(void) +#else +unsigned long +gfx_get_max_supported_pixel_clock(void) +#endif +{ + /* ALL CHIPS CAN HANDLE 1280X1024@85HZ - 157.5 MHz */ + + return 157500; +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_mode + * + * This routine gets the specified display mode. + * + * Returns >0 if successful and mode returned, <0 if mode could not be found. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#else +int +gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#endif +{ + unsigned int mode = 0; + unsigned long pll_freq = 0, bpp_flag = 0; + + *xres = gfx_get_hactive(); + *yres = gfx_get_vactive(); + *bpp = gfx_get_display_bpp(); + pll_freq = gfx_get_clock_frequency(); + + /* SUPPORT EMULATED VGA MODES */ + + if (gfx_pixel_double) + *xres >>= 1; + + if (gfx_line_double) + *yres >>= 1; + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + + bpp_flag = GFX_MODE_8BPP; + if (*bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + for (mode = 0; mode < NUM_GX_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned short)*xres) && + (DisplayParams[mode].vactive == (unsigned short)*yres) && + (DisplayParams[mode].frequency == pll_freq) && + (DisplayParams[mode].flags & bpp_flag)) { + + pll_freq = DisplayParams[mode].flags; + + if (pll_freq & GFX_MODE_56HZ) + *hz = 56; + else if (pll_freq & GFX_MODE_60HZ) + *hz = 60; + else if (pll_freq & GFX_MODE_70HZ) + *hz = 70; + else if (pll_freq & GFX_MODE_72HZ) + *hz = 72; + else if (pll_freq & GFX_MODE_75HZ) + *hz = 75; + else if (pll_freq & GFX_MODE_85HZ) + *hz = 85; + + return (1); + } + } + return (-1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hactive(void) +#else +unsigned short +gfx_get_hactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_H_TIMING_1) & 0x07F8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hsync_start(void) +#else +unsigned short +gfx_get_hsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_H_TIMING_3) & 0x07F8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hsync_end(void) +#else +unsigned short +gfx_get_hsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_H_TIMING_3) >> 16) & 0x07F8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_htotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_htotal(void) +#else +unsigned short +gfx_get_htotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_H_TIMING_1) >> 16) & 0x07F8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vactive(void) +#else +unsigned short +gfx_get_vactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_V_TIMING_1) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vsync_end(void) +#else +unsigned short +gfx_get_vsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_V_TIMING_3) >> 16) & 0x07FF) + + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vtotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vtotal(void) +#else +unsigned short +gfx_get_vtotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_V_TIMING_1) >> 16) & 0x07FF) + + 1)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_bpp + * + * This routine returns the current color depth of the active display. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_display_bpp(void) +#else +unsigned short +gfx_get_display_bpp(void) +#endif +{ + switch (READ_REG32(DC_OUTPUT_CFG) & 3) { + case 0: + return (16); + case 2: + return (15); + } + return (8); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vline + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vline(void) +#else +unsigned short +gfx_get_vline(void) +#endif +{ + unsigned short current_scan_line; + + /* Read similar value twice to ensure that the value is not transitioning */ + + do + current_scan_line = (unsigned short)READ_REG32(DC_V_LINE_CNT) & 0x07FF; + while (current_scan_line != + (unsigned short)(READ_REG32(DC_V_LINE_CNT) & 0x07FF)); + + return (current_scan_line); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_display_offset(void) +#else +unsigned long +gfx_get_display_offset(void) +#endif +{ + return (READ_REG32(DC_FB_ST_OFFSET) & 0x003FFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_offset(void) +#else +unsigned long +gfx_get_cursor_offset(void) +#endif +{ + return (READ_REG32(DC_CURS_ST_OFFSET) & 0x003FFFFF); +} + +#if GFX_READ_ROUTINES + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hblank_start(void) +#else +unsigned short +gfx_get_hblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_H_TIMING_2) & 0x07F8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hblank_end(void) +#else +unsigned short +gfx_get_hblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_H_TIMING_2) >> 16) & 0x07F8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vblank_start(void) +#else +unsigned short +gfx_get_vblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_V_TIMING_2) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vsync_start(void) +#else +unsigned short +gfx_get_vsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_V_TIMING_3) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vblank_end(void) +#else +unsigned short +gfx_get_vblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_V_TIMING_2) >> 16) & 0x07FF) + + 1)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_palette_entry + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_display_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + unsigned long data; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(DC_PAL_ADDRESS, index); + data = READ_REG32(DC_PAL_DATA); + data = ((data << 2) & 0x000000FC) | + ((data << 4) & 0x0000FC00) | ((data << 6) & 0x00FC0000); + + *palette = data; + + return 0; +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_palette + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_get_display_palette(unsigned long *palette) +#else +void +gfx_get_display_palette(unsigned long *palette) +#endif +{ + unsigned long i, data; + + WRITE_REG32(DC_PAL_ADDRESS, 0); + for (i = 0; i < 256; i++) { + data = READ_REG32(DC_PAL_DATA); + data = ((data << 2) & 0x000000FC) | + ((data << 4) & 0x0000FC00) | ((data << 6) & 0x00FC0000); + palette[i] = data; + } +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_enable(void) +#else +unsigned long +gfx_get_cursor_enable(void) +#endif +{ + return (READ_REG32(DC_GENERAL_CFG) & DC_GCFG_CURE); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_position + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_position(void) +#else +unsigned long +gfx_get_cursor_position(void) +#endif +{ + return ((READ_REG32(DC_CURSOR_X) & 0x07FF) | + ((READ_REG32(DC_CURSOR_Y) << 16) & 0x03FF0000)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_clip + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_clip(void) +#else +unsigned long +gfx_get_cursor_clip(void) +#endif +{ + return (((READ_REG32(DC_CURSOR_X) >> 11) & 0x01F) | + ((READ_REG32(DC_CURSOR_Y) << 5) & 0x1F0000)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_color + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_color(int color) +#else +unsigned long +gfx_get_cursor_color(int color) +#endif +{ + unsigned long data; + + if (color) { + WRITE_REG32(DC_PAL_ADDRESS, 0x101); + } else { + WRITE_REG32(DC_PAL_ADDRESS, 0x100); + } + data = READ_REG32(DC_PAL_DATA); + data = ((data << 6) & 0x00FC0000) | + ((data << 4) & 0x0000FC00) | ((data << 2) & 0x000000FC); + return (data); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_compression_enable(void) +#else +int +gfx_get_compression_enable(void) +#endif +{ + unsigned long gcfg; + + gcfg = READ_REG32(DC_GENERAL_CFG); + if (gcfg & DC_GCFG_CMPE) + return (1); + else + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_compression_offset(void) +#else +unsigned long +gfx_get_compression_offset(void) +#endif +{ + unsigned long offset; + + offset = READ_REG32(DC_CB_ST_OFFSET) & 0x003FFFFF; + return (offset); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_compression_pitch(void) +#else +unsigned short +gfx_get_compression_pitch(void) +#endif +{ + unsigned short pitch; + + pitch = (unsigned short)(READ_REG32(DC_LINE_DELTA) >> 12) & 0x07FF; + return (pitch << 2); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_size + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_compression_size(void) +#else +unsigned short +gfx_get_compression_size(void) +#endif +{ + unsigned short size; + + size = (unsigned short)((READ_REG32(DC_BUF_SIZE) >> 9) & 0x7F) - 1; + return ((size << 2) + 16); +} + +/*----------------------------------------------------------------------------- + * gfx_get_valid_bit + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_valid_bit(int line) +#else +int +gfx_get_valid_bit(int line) +#endif +{ + int valid; + + WRITE_REG32(MC_DR_ADD, line); + valid = (int)READ_REG32(MC_DR_ACC) & 1; + return (valid); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_display_video_offset(void) +#else +unsigned long +gfx_get_display_video_offset(void) +#endif +{ + return (READ_REG32(DC_VID_ST_OFFSET) & 0x003FFFFF); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_display_video_size(void) +#else +unsigned long +gfx_get_display_video_size(void) +#endif +{ + /* RETURN TOTAL SIZE, IN BYTES */ + + return ((READ_REG32(DC_BUF_SIZE) >> 10) & 0x000FFFC0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_priority_high + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_priority_high(void) +#else +int +gfx_get_display_priority_high(void) +#endif +{ + if (READ_REG32(MC_MEM_CNTRL1) & MC_XBUSARB) + return (1); + else + return (0); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu2.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu2.c:1.4 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu2.c Thu Feb 6 12:46:02 2003 @@ -0,0 +1,3156 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/disp_gu2.c,v 1.4 2003/02/06 17:46:02 alanh Exp $ */ +/* + * $Workfile: disp_gu2.c $ + * + * This file contains routines for the second generation display controller. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +void gu2_enable_compression(void); /* private routine definition */ +void gu2_disable_compression(void); /* private routine definition */ +int gu2_set_display_bpp(unsigned short bpp); +int gu2_is_display_mode_supported(int xres, int yres, int bpp, int hz); +int gu2_set_display_mode(int xres, int yres, int bpp, int hz); +int gu2_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, + unsigned short hblank_start, + unsigned short hsync_start, + unsigned short hsync_end, + unsigned short hblank_end, unsigned short htotal, + unsigned short vactive, + unsigned short vblank_start, + unsigned short vsync_start, + unsigned short vsync_end, + unsigned short vblank_end, unsigned short vtotal, + unsigned long frequency); +int gu2_set_vtotal(unsigned short vtotal); +void gu2_set_display_pitch(unsigned short pitch); +void gu2_set_display_offset(unsigned long offset); +int gu2_set_display_palette_entry(unsigned long index, unsigned long palette); +int gu2_set_display_palette(unsigned long *palette); +void gu2_video_shutdown(void); +void gu2_set_clock_frequency(unsigned long frequency); +int gu2_set_crt_enable(int enable); +void gu2_set_cursor_enable(int enable); +void gu2_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); +void gu2_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, + unsigned short yhotspot); +void gu2_set_cursor_shape32(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask); +void gu2_set_cursor_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask); +void gu2_set_icon_enable(int enable); +void gu2_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2); +void gu2_set_icon_position(unsigned long memoffset, unsigned short xpos); +void gu2_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines); + +int gu2_set_compression_enable(int enable); +int gu2_set_compression_offset(unsigned long offset); +int gu2_set_compression_pitch(unsigned short pitch); +int gu2_set_compression_size(unsigned short size); +void gu2_set_display_priority_high(int enable); +int gu2_test_timing_active(void); +int gu2_test_vertical_active(void); +int gu2_wait_vertical_blank(void); +void gu2_delay_milliseconds(unsigned long milliseconds); +void gu2_delay_microseconds(unsigned long microseconds); +void gu2_enable_panning(int x, int y); +int gu2_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +int gu2_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +void gu2_reset_timing_lock(void); + +int gu2_get_display_details(unsigned int mode, int *xres, int *yres, int *hz); +unsigned short gu2_get_display_pitch(void); +int gu2_get_vsa2_softvga_enable(void); +int gu2_get_sync_polarities(void); +unsigned long gu2_get_clock_frequency(void); +unsigned long gu2_get_max_supported_pixel_clock(void); +int gu2_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency); +int gu2_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu2_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu2_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency); +int gu2_get_display_mode_count(void); +int gu2_get_display_mode(int *xres, int *yres, int *bpp, int *hz); +unsigned long gu2_get_frame_buffer_line_size(void); +unsigned short gu2_get_hactive(void); +unsigned short gu2_get_hblank_start(void); +unsigned short gu2_get_hsync_start(void); +unsigned short gu2_get_hsync_end(void); +unsigned short gu2_get_hblank_end(void); +unsigned short gu2_get_htotal(void); +unsigned short gu2_get_vactive(void); +unsigned short gu2_get_vline(void); +unsigned short gu2_get_vblank_start(void); +unsigned short gu2_get_vsync_start(void); +unsigned short gu2_get_vsync_end(void); +unsigned short gu2_get_vblank_end(void); +unsigned short gu2_get_vtotal(void); +unsigned short gu2_get_display_bpp(void); +unsigned long gu2_get_display_offset(void); +int gu2_get_display_palette_entry(unsigned long index, + unsigned long *palette); +void gu2_get_display_palette(unsigned long *palette); +unsigned long gu2_get_cursor_enable(void); +unsigned long gu2_get_cursor_offset(void); +unsigned long gu2_get_cursor_position(void); +unsigned long gu2_get_cursor_clip(void); +unsigned long gu2_get_cursor_color(int color); +unsigned long gu2_get_icon_enable(void); +unsigned long gu2_get_icon_offset(void); +unsigned long gu2_get_icon_position(void); +unsigned long gu2_get_icon_color(int color); +int gu2_get_compression_enable(void); +unsigned long gu2_get_compression_offset(void); +unsigned short gu2_get_compression_pitch(void); +unsigned short gu2_get_compression_size(void); +int gu2_get_display_priority_high(void); +int gu2_get_valid_bit(int line); +int gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp); +void gu2_set_display_video_size(unsigned short width, unsigned short height); +void gu2_set_display_video_offset(unsigned long offset); +unsigned long gu2_get_display_video_offset(void); +unsigned long gu2_get_display_video_size(void); +void gu2_get_display_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +int gu2_get_display_video_downscale_enable(void); +void gu2_set_display_video_format(unsigned long format); +void gu2_set_display_video_enable(int enable); +void gu2_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, + unsigned long voffset); +void gu2_set_display_video_yuv_pitch(unsigned long ypitch, + unsigned long uvpitch); +void gu2_set_display_video_downscale(unsigned short srch, + unsigned short dsth); +void gu2_set_display_video_vertical_downscale_enable(int enable); +void gu2_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset); +unsigned long gu2_get_display_video_downscale_delta(void); + + /*----------------------------------------------------------------------------- + * WARNING!!!! INACCURATE DELAY MECHANISM + * + * In an effort to keep the code self contained and operating system + * independent, the delay loop just performs reads of a display controller + * register. This time will vary for faster processors. The delay can always + * be longer than intended, only effecting the time of the mode switch + * (obviously want it to still be under a second). Problems with the hardware + * only arise if the delay is not long enough. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_delay_milliseconds(unsigned long milliseconds) +#else +void +gfx_delay_milliseconds(unsigned long milliseconds) +#endif +{ + /* ASSUME 300 MHZ 20 CLOCKS PER READ */ + +# define RC_READS_PER_MILLISECOND 15000L + + unsigned long loop; + + loop = milliseconds * RC_READS_PER_MILLISECOND; + while (loop-- > 0) { + READ_REG32(MDC_UNLOCK); + } +} + +#if GFX_DISPLAY_DYNAMIC +void +gu2_delay_microseconds(unsigned long microseconds) +#else +void +gfx_delay_microseconds(unsigned long microseconds) +#endif +{ + /* ASSUME 400 MHz, 2 CLOCKS PER INCREMENT */ + + unsigned long loop_count = microseconds * 15; + + while (loop_count-- > 0) { + READ_REG32(MDC_UNLOCK); + } +} + +/*----------------------------------------------------------------------------- + * GFX_SET_DISPLAY_BPP + * + * This routine programs the bpp in the display controller. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_bpp(unsigned short bpp) +#else +int +gfx_set_display_bpp(unsigned short bpp) +#endif +{ + unsigned long dcfg, lock; + + dcfg = READ_REG32(MDC_DISPLAY_CFG) & ~(MDC_DCFG_DISP_MODE_MASK | + MDC_DCFG_16BPP_MODE_MASK); + lock = READ_REG32(MDC_UNLOCK); + + switch (bpp) { + case 12: + dcfg |= (MDC_DCFG_DISP_MODE_16BPP | MDC_DCFG_12BPP); + break; + case 15: + dcfg |= (MDC_DCFG_DISP_MODE_16BPP | MDC_DCFG_15BPP); + break; + case 16: + dcfg |= (MDC_DCFG_DISP_MODE_16BPP | MDC_DCFG_16BPP); + break; + case 32: + dcfg |= (MDC_DCFG_DISP_MODE_24BPP); + break; + case 8: + dcfg |= (MDC_DCFG_DISP_MODE_8BPP); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + WRITE_REG32(MDC_UNLOCK, lock); + + /* SET BPP IN GRAPHICS PIPELINE */ + + gfx_set_bpp(bpp); + + return 0; +} + +/*----------------------------------------------------------------------------- + * gu2_set_specified_mode (private routine) + * This routine uses the parameters in the specified display mode structure + * to program the display controller hardware. + *----------------------------------------------------------------------------- + */ +int +gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) +{ + unsigned long unlock, value; + unsigned long gcfg, dcfg; + unsigned long size, pitch; + unsigned long vid_buf_size; + unsigned long bpp_mask, temp, dv_size; + + /* CHECK WHETHER TIMING CHANGE IS ALLOWED */ + /* Flag used for locking also overrides timing change restriction */ + + if (gfx_timing_lock && !(pMode->flags & GFX_MODE_LOCK_TIMING)) + return GFX_STATUS_ERROR; + + /* CLEAR PANNING OFFSETS */ + + DeltaX = 0; + DeltaY = 0; + panelLeft = 0; + panelTop = 0; + + /* SET GLOBAL FLAG */ + + if (pMode->flags & GFX_MODE_LOCK_TIMING) + gfx_timing_lock = 1; + + /* CHECK FOR VALID BPP */ + /* As this function can be called directly from */ + /* gfx_set_display_timings, we must correct any */ + /* invalid bpp settings. */ + + switch (bpp) { + case 12: + bpp_mask = 0x00000900; + break; + case 15: + bpp_mask = 0x00000500; + break; + case 16: + bpp_mask = 0x00000100; + break; + case 32: + bpp_mask = 0x00000200; + break; + default: + bpp_mask = 0x00000000; + bpp = 8; + break; + } + + gbpp = bpp; + + /* DISABLE COMPRESSION */ + + gu2_disable_compression(); + + /* ALSO DISABLE VIDEO */ + /* Use private "reset video" routine to do all that is needed. */ + /* SC1200, for example, also disables the alpha blending regions. */ + + gfx_reset_video(); + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + + unlock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* READ THE CURRENT REGISTER VALUES */ + + gcfg = READ_REG32(MDC_GENERAL_CFG); + dcfg = READ_REG32(MDC_DISPLAY_CFG); + + /* BLANK THE DISPLAY IN THE DISPLAY FILTER */ + + gfx_set_crt_enable(0); + + /* DISABLE THE TIMING GENERATOR */ + + dcfg &= ~(unsigned long)MDC_DCFG_TGEN; + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + + /* DELAY: WAIT FOR PENDING MEMORY REQUESTS */ + /* This delay is used to make sure that all pending requests to the */ + /* memory controller have completed before disabling the FIFO load. */ + + gfx_delay_milliseconds(5); + + /* DISABLE DISPLAY FIFO LOAD */ + + gcfg &= ~(unsigned long)MDC_GCFG_DFLE; + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + + /* PRESERVE VIDEO INFORMATION */ + + gcfg &= (unsigned long)(MDC_GCFG_YUVM | MDC_GCFG_VDSE); + dcfg = 0; + + /* SET THE DOT CLOCK FREQUENCY */ + /* Mask off the divide by two bit (bit 31) */ + + gfx_set_clock_frequency(pMode->frequency & 0x7FFFFFFF); + + /* DELAY: WAIT FOR THE PLL TO SETTLE */ + /* This allows the dot clock frequency that was just set to settle. */ + + gfx_delay_milliseconds(10); + + /* SET THE GX DISPLAY CONTROLLER PARAMETERS */ + + WRITE_REG32(MDC_FB_ST_OFFSET, 0); + WRITE_REG32(MDC_CB_ST_OFFSET, 0); + WRITE_REG32(MDC_CURS_ST_OFFSET, 0); + WRITE_REG32(MDC_ICON_ST_OFFSET, 0); + + /* SET LINE SIZE AND PITCH */ + /* 1. Flat Panels must use the mode width and not */ + /* the timing width to set the pitch. */ + /* 2. Mode sets will use a pitch that is aligned */ + /* on a 1K boundary to preserve legacy. The */ + /* pitch can be overridden by a subsequent call */ + /* to gfx_set_display_pitch. */ + + if (PanelEnable) + size = ModeWidth; + else + size = pMode->hactive; + + if (bpp > 8) + size <<= 1; + if (bpp > 16) + size <<= 1; + + pitch = 1024; + dv_size = MDC_DV_LINE_SIZE_1024; + + if (size > 1024) { + pitch = 2048; + dv_size = MDC_DV_LINE_SIZE_2048; + } + if (size > 2048) { + pitch = 4096; + dv_size = MDC_DV_LINE_SIZE_4096; + } + if (size > 4096) { + pitch = 8192; + dv_size = MDC_DV_LINE_SIZE_8192; + } + WRITE_REG32(MDC_GFX_PITCH, pitch >> 3); + + /* WRITE DIRTY/VALID CONTROL WITH LINE LENGTH */ + + temp = READ_REG32(MDC_DV_CTL); + WRITE_REG32(MDC_DV_CTL, (temp & ~MDC_DV_LINE_SIZE_MASK) | dv_size); + + if (PanelEnable) { + size = pMode->hactive; + if (bpp > 8) + size <<= 1; + if (bpp > 16) + size <<= 1; + } + + /* SAVE PREVIOUSLY STORED VIDEO LINE SIZE */ + + vid_buf_size = READ_REG32(MDC_LINE_SIZE) & 0xFF000000; + + /* ADD 2 TO SIZE FOR POSSIBLE START ADDRESS ALIGNMENTS */ + + WRITE_REG32(MDC_LINE_SIZE, ((size >> 3) + 2) | vid_buf_size); + + /* ALWAYS ENABLE VIDEO AND GRAPHICS DATA */ + /* These bits are relics from a previous design and */ + /* should always be enabled. */ + + dcfg |= (unsigned long)(MDC_DCFG_VDEN | MDC_DCFG_GDEN); + + /* SET PIXEL FORMAT */ + + dcfg |= bpp_mask; + + /* ENABLE TIMING GENERATOR, TIM. REG. UPDATES, PALETTE BYPASS */ + /* AND VERT. INT. SELECT */ + + dcfg |= + (unsigned long)(MDC_DCFG_TGEN | MDC_DCFG_TRUP | MDC_DCFG_PALB | + MDC_DCFG_VISL); + + /* DISABLE ADDRESS MASKS */ + + dcfg |= MDC_DCFG_A20M; + dcfg |= MDC_DCFG_A18M; + + /* SET FIFO PRIORITIES AND DISPLAY FIFO LOAD ENABLE */ + /* Set the priorities higher for high resolution modes. */ + + if (pMode->hactive > 1024 || bpp == 32) + gcfg |= 0x000A901; + else + gcfg |= 0x0006501; + + /* ENABLE FLAT PANEL CENTERING */ + /* For panel modes having a resolution smaller than the */ + /* panel resolution, turn on data centering. */ + + if (PanelEnable && ModeWidth < PanelWidth) + dcfg |= MDC_DCFG_DCEN; + + /* COMBINE AND SET TIMING VALUES */ + + value = (unsigned long)(pMode->hactive - 1) | + (((unsigned long)(pMode->htotal - 1)) << 16); + WRITE_REG32(MDC_H_ACTIVE_TIMING, value); + value = (unsigned long)(pMode->hblankstart - 1) | + (((unsigned long)(pMode->hblankend - 1)) << 16); + WRITE_REG32(MDC_H_BLANK_TIMING, value); + value = (unsigned long)(pMode->hsyncstart - 1) | + (((unsigned long)(pMode->hsyncend - 1)) << 16); + WRITE_REG32(MDC_H_SYNC_TIMING, value); + value = (unsigned long)(pMode->vactive - 1) | + (((unsigned long)(pMode->vtotal - 1)) << 16); + WRITE_REG32(MDC_V_ACTIVE_TIMING, value); + value = (unsigned long)(pMode->vblankstart - 1) | + (((unsigned long)(pMode->vblankend - 1)) << 16); + WRITE_REG32(MDC_V_BLANK_TIMING, value); + value = (unsigned long)(pMode->vsyncstart - 1) | + (((unsigned long)(pMode->vsyncend - 1)) << 16); + WRITE_REG32(MDC_V_SYNC_TIMING, value); + + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + + gfx_set_display_control(((pMode->flags & GFX_MODE_NEG_HSYNC) ? 1 : 0) | + ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); + + /* RESTORE VALUE OF MDC_UNLOCK */ + + WRITE_REG32(MDC_UNLOCK, unlock); + + /* RESET THE PITCH VALUES IN THE GP */ + + gfx_reset_pitch((unsigned short)pitch); + + gfx_set_bpp((unsigned short)bpp); + + return GFX_STATUS_OK; +} + + /*---------------------------------------------------------------------------- + * GFX_IS_DISPLAY_MODE_SUPPORTED + * + * This routine sets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be set. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#else +int +gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#endif +{ + unsigned int mode; + unsigned long hz_flag = 0, bpp_flag = 0; + + /* SET FLAGS TO MATCH REFRESH RATE */ + + if (hz == 56) + hz_flag = GFX_MODE_56HZ; + if (hz == 60) + hz_flag = GFX_MODE_60HZ; + if (hz == 70) + hz_flag = GFX_MODE_70HZ; + if (hz == 72) + hz_flag = GFX_MODE_72HZ; + if (hz == 75) + hz_flag = GFX_MODE_75HZ; + if (hz == 85) + hz_flag = GFX_MODE_85HZ; + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + + switch (bpp) { + case 8: + bpp_flag = GFX_MODE_8BPP; + break; + case 12: + bpp_flag = GFX_MODE_12BPP; + break; + case 15: + bpp_flag = GFX_MODE_15BPP; + break; + case 16: + bpp_flag = GFX_MODE_16BPP; + break; + case 32: + bpp_flag = GFX_MODE_24BPP; + break; + default: + return (-1); + } + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_RC_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned short)xres) && + (DisplayParams[mode].vactive == (unsigned short)yres) && + (DisplayParams[mode].flags & hz_flag) && + (DisplayParams[mode].flags & bpp_flag)) { + + /* REDCLOUD DOES NOT SUPPORT EMULATED VGA MODES */ + + if ((DisplayParams[mode].flags & GFX_MODE_PIXEL_DOUBLE) || + (DisplayParams[mode].flags & GFX_MODE_LINE_DOUBLE)) + continue; + + /* SET THE DISPLAY CONTROLLER FOR THE SELECTED MODE */ + + return (mode); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * gfx_set_display_mode + * + * This routine sets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be set. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_mode(int xres, int yres, int bpp, int hz) +#else +int +gfx_set_display_mode(int xres, int yres, int bpp, int hz) +#endif +{ + int mode; + + /* DISABLE FLAT PANEL */ + /* Flat Panel settings are enabled by the function gfx_set_fixed_timings */ + /* and disabled by gfx_set_display_mode. */ + + PanelEnable = 0; + + mode = gfx_is_display_mode_supported(xres, yres, bpp, hz); + if (mode >= 0) { + if (gu2_set_specified_mode(&DisplayParams[mode], bpp) == GFX_STATUS_OK) + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_TIMINGS + * + * This routine sets the display controller mode using the specified timing + * values (as opposed to using the tables internal to Durango). + * + * Returns GFX_STATUS_OK ON SUCCESS, GFX_STATUS_ERROR otherwise. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) +#else +int +gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) +#endif +{ + /* SET MODE STRUCTURE WITH SPECIFIED VALUES */ + + gfx_display_mode.flags = 0; + if (flags & 1) + gfx_display_mode.flags |= GFX_MODE_NEG_HSYNC; + if (flags & 2) + gfx_display_mode.flags |= GFX_MODE_NEG_VSYNC; + if (flags & 0x1000) + gfx_display_mode.flags |= GFX_MODE_LOCK_TIMING; + gfx_display_mode.hactive = hactive; + gfx_display_mode.hblankstart = hblankstart; + gfx_display_mode.hsyncstart = hsyncstart; + gfx_display_mode.hsyncend = hsyncend; + gfx_display_mode.hblankend = hblankend; + gfx_display_mode.htotal = htotal; + gfx_display_mode.vactive = vactive; + gfx_display_mode.vblankstart = vblankstart; + gfx_display_mode.vsyncstart = vsyncstart; + gfx_display_mode.vsyncend = vsyncend; + gfx_display_mode.vblankend = vblankend; + gfx_display_mode.vtotal = vtotal; + gfx_display_mode.frequency = frequency; + + /* CALL ROUTINE TO SET MODE */ + + return (gu2_set_specified_mode(&gfx_display_mode, bpp)); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_VTOTAL + * + * This routine sets the display controller vertical total to + * "vtotal". As a side effect it also sets vertical blank end. + * It should be used when only this value needs to be changed, + * due to speed considerations. + * + * Note: it is the caller's responsibility to make sure that + * a legal vtotal is used, i.e. that "vtotal" is greater than or + * equal to vsync end. + * + * Always returns 0. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_vtotal(unsigned short vtotal) +#else +int +gfx_set_vtotal(unsigned short vtotal) +#endif +{ + unsigned long unlock, dcfg, vactive, vblank; + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + + unlock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* READ THE CURRENT RC VALUES */ + + dcfg = READ_REG32(MDC_DISPLAY_CFG); + vactive = READ_REG32(MDC_V_ACTIVE_TIMING); + vblank = READ_REG32(MDC_V_BLANK_TIMING); + + /* DISABLE TIMING REGISTER UPDATES */ + + WRITE_REG32(MDC_DISPLAY_CFG, dcfg & ~(unsigned long)MDC_DCFG_TRUP); + + /* WRITE NEW TIMING VALUES */ + + WRITE_REG32(MDC_V_ACTIVE_TIMING, + (vactive & MDC_VAT_VA_MASK) | (unsigned long)(vtotal - + 1) << 16); + WRITE_REG32(MDC_V_BLANK_TIMING, + (vblank & MDC_VBT_VBS_MASK) | (unsigned long)(vtotal - + 1) << 16); + + /* RESTORE OLD RC VALUES */ + + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + WRITE_REG32(MDC_UNLOCK, unlock); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_pitch + * + * This routine sets the pitch of the frame buffer to the specified value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_pitch(unsigned short pitch) +#else +void +gfx_set_display_pitch(unsigned short pitch) +#endif +{ + unsigned long value = 0; + unsigned long lock = READ_REG32(MDC_UNLOCK); + + value = READ_REG32(MDC_GFX_PITCH) & 0xFFFF0000; + value |= (pitch >> 3); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GFX_PITCH, value); + + /* SET RENDERING PITCHES TO MATCH */ + + gfx_reset_pitch(pitch); + + /* SET THE FRAME DIRTY MODE */ + /* Non-standard pitches, i.e. pitches that */ + /* are not 1K, 2K or 4K must mark the entire */ + /* frame as dirty when writing to the frame */ + /* buffer. */ + + value = READ_REG32(MDC_GENERAL_CFG); + + if (pitch == 1024 || pitch == 2048 || pitch == 4096 || pitch == 8192) + value &= ~(unsigned long)(MDC_GCFG_FDTY); + else + value |= (unsigned long)(MDC_GCFG_FDTY); + + WRITE_REG32(MDC_GENERAL_CFG, value); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_offset + * + * This routine sets the start address of the frame buffer. It is + * typically used to pan across a virtual desktop (frame buffer larger than + * the displayed screen) or to flip the display between multiple buffers. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_offset(unsigned long offset) +#else +void +gfx_set_display_offset(unsigned long offset) +#endif +{ + /* UPDATE FRAME BUFFER OFFSET */ + unsigned long lock; + + lock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* START ADDRESS EFFECTS DISPLAY COMPRESSION */ + /* Disable compression for non-zero start addresss values. */ + /* Enable compression if offset is zero and comression is intended to */ + /* be enabled from a previous call to "gfx_set_compression_enable". */ + /* Compression should be disabled BEFORE the offset is changed */ + /* and enabled AFTER the offset is changed. */ + + if (offset == 0) { + WRITE_REG32(MDC_FB_ST_OFFSET, offset); + if (gfx_compression_enabled) { + /* WAIT FOR THE OFFSET TO BE LATCHED */ + gfx_wait_vertical_blank(); + gu2_enable_compression(); + } + } else { + /* ONLY DISABLE COMPRESSION ONCE */ + + if (gfx_compression_active) + gu2_disable_compression(); + + WRITE_REG32(MDC_FB_ST_OFFSET, offset); + } + + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette_entry + * + * This routine sets an palette entry in the display controller. + * A 32-bit X:R:G:B value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_display_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(MDC_PAL_ADDRESS, index); + WRITE_REG32(MDC_PAL_DATA, palette); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette + * + * This routine sets the entire palette in the display controller. + * A pointer is provided to a 256 entry table of 32-bit X:R:G:B values. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_palette(unsigned long *palette) +#else +int +gfx_set_display_palette(unsigned long *palette) +#endif +{ + unsigned long i; + + WRITE_REG32(MDC_PAL_ADDRESS, 0); + + if (palette) { + for (i = 0; i < 256; i++) { + WRITE_REG32(MDC_PAL_DATA, palette[i]); + } + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_enable + * + * This routine enables or disables the hardware cursor. + * + * WARNING: The cursor start offset must be set by setting the cursor + * position before calling this routine to assure that memory reads do not + * go past the end of graphics memory (this can hang GXm). + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_enable(int enable) +#else +void +gfx_set_cursor_enable(int enable) +#endif +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR CURSOR ENABLE BIT */ + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + if (enable) + gcfg |= MDC_GCFG_CURE; + else + gcfg &= ~(MDC_GCFG_CURE); + + /* WRITE NEW REGISTER VALUE */ + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_colors + * + * This routine sets the colors of the hardware cursor. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#else +void +gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#endif +{ + /* SET CURSOR COLORS */ + + WRITE_REG32(MDC_PAL_ADDRESS, 0x100); + WRITE_REG32(MDC_PAL_DATA, bkcolor); + WRITE_REG32(MDC_PAL_DATA, fgcolor); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_position + * + * This routine sets the position of the hardware cusror. The starting + * offset of the cursor buffer must be specified so that the routine can + * properly clip scanlines if the cursor is off the top of the screen. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#else +void +gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#endif +{ + unsigned long unlock; + + short x = (short)xpos - (short)xhotspot; + short y = (short)ypos - (short)yhotspot; + short xoffset = 0; + short yoffset = 0; + + if (x < -63) + return; + if (y < -63) + return; + + if (PanelEnable) { + if ((ModeWidth > PanelWidth) || (ModeHeight > PanelHeight)) { + gfx_enable_panning(xpos, ypos); + x = x - (unsigned short)panelLeft; + y = y - (unsigned short)panelTop; + } + } + + /* ADJUST OFFSETS */ + /* Cursor movement and panning work as follows: The cursor position */ + /* refers to where the hotspot of the cursor is located. However, for */ + /* non-zero hotspots, the cursor buffer actually begins before the */ + /* specified position. */ + + if (x < 0) { + xoffset = -x; + x = 0; + } + if (y < 0) { + yoffset = -y; + y = 0; + } + memoffset += (unsigned long)yoffset << 4; + + /* SET CURSOR POSITION */ + + unlock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_CURS_ST_OFFSET, memoffset); + WRITE_REG32(MDC_CURSOR_X, (unsigned long)x | + (((unsigned long)xoffset) << 11)); + WRITE_REG32(MDC_CURSOR_Y, (unsigned long)y | + (((unsigned long)yoffset) << 11)); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape32 + * + * This routine loads 32x32 cursor data into the cursor buffer in graphics memory. + * As the Redcloud cursor is actually 64x64, we must pad the outside of the + * cursor data with transparent pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#else +void +gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#endif +{ + int i; + + for (i = 0; i < 32; i++) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + + WRITE_FB32(memoffset, 0xFFFFFFFF); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + + WRITE_FB32(memoffset + 8, 0x00000000); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } + + /* FILL THE LOWER HALF OF THE BUFFER WITH TRANSPARENT PIXELS */ + + for (i = 0; i < 32; i++) { + WRITE_FB32(memoffset, 0xFFFFFFFF); + WRITE_FB32(memoffset + 4, 0xFFFFFFFF); + WRITE_FB32(memoffset + 8, 0x00000000); + WRITE_FB32(memoffset + 12, 0x00000000); + + memoffset += 16; + } +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape64 + * + * This routine loads 64x64 cursor data into the cursor buffer in graphics memory. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#else +void +gfx_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#endif +{ + int i; + + for (i = 0; i < 128; i += 2) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + /* We invert the dwords to prevent the calling */ + /* application from having to think in terms of Qwords. */ + /* The hardware data order is actually 63:0, or 31:0 of */ + /* the second dword followed by 31:0 of the first dword. */ + + WRITE_FB32(memoffset, andmask[i + 1]); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + + WRITE_FB32(memoffset + 8, xormask[i + 1]); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_enable + * + * This routine enables or disables the hardware icon. The icon position + * and colors should be programmed prior to calling this routine for the + * first time. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_enable(int enable) +#else +void +gfx_set_icon_enable(int enable) +#endif +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR ICON ENABLE BIT */ + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + if (enable) + gcfg |= MDC_GCFG_ICNE; + else + gcfg &= ~(MDC_GCFG_ICNE); + + /* WRITE NEW REGISTER VALUE */ + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_colors + * + * This routine sets the three icon colors. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +#else +void +gfx_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +#endif +{ + /* ICON COLORS LOCATED AT PALETTE INDEXES 102-104h */ + + WRITE_REG32(MDC_PAL_ADDRESS, 0x102); + + WRITE_REG32(MDC_PAL_DATA, color0); + WRITE_REG32(MDC_PAL_DATA, color1); + WRITE_REG32(MDC_PAL_DATA, color2); +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_position + * + * This routine sets the starting X coordinate for the hardware icon and the + * memory offset for the icon buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_position(unsigned long memoffset, unsigned short xpos) +#else +void +gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) +#endif +{ + unsigned long lock = READ_REG32(MDC_UNLOCK); + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* PROGRAM THE MEMORY OFFSET */ + + WRITE_REG32(MDC_ICON_ST_OFFSET, memoffset & 0x0FFFFFFF); + + /* PROGRAM THE XCOORDINATE */ + + WRITE_REG32(MDC_ICON_X, (unsigned long)(xpos & 0x07FF)); + + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_shape64 + * + * This routine initializes the icon buffer according to the current mode. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines) +#else +void +gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines) +#endif +{ + unsigned short i, height; + + height = lines << 1; + + for (i = 0; i < height; i += 2) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + /* Swap dwords to hide qword constraint */ + + WRITE_FB32(memoffset, andmask[i + 1]); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + + WRITE_FB32(memoffset + 8, xormask[i + 1]); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } +} + +/*--------------------------------------------------------------------------- + * gu2_enable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It enables display compression. + *--------------------------------------------------------------------------- + */ +void +gu2_enable_compression(void) +{ + unsigned long unlock, gcfg, temp; + + /* DO NOT ENABLE IF START ADDRESS IS NOT ZERO */ + + if (READ_REG32(MDC_FB_ST_OFFSET) & 0x0FFFFFFF) + return; + + /* SET GLOBAL INDICATOR */ + + gfx_compression_active = 1; + + /* CLEAR DIRTY/VALID BITS IN MEMORY CONTROLLER */ + /* Software is required to do this before enabling compression. */ + /* Don't want controller to think that old lines are still valid. */ + /* Writing a 1 to bit 0 of the DV Control register will force the */ + /* hardware to clear all the valid bits. */ + + temp = READ_REG32(MDC_DV_CTL); + WRITE_REG32(MDC_DV_CTL, temp | 0x00000001); + + /* TURN ON COMPRESSION CONTROL BITS */ + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + gcfg |= MDC_GCFG_CMPE | MDC_GCFG_DECE; + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gu2_disable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It disables display compression. + *--------------------------------------------------------------------------- + */ +void +gu2_disable_compression(void) +{ + unsigned long unlock, gcfg; + + /* SET GLOBAL INDICATOR */ + + gfx_compression_active = 0; + + /* TURN OFF COMPRESSION CONTROL BITS */ + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + gcfg &= ~(MDC_GCFG_CMPE | MDC_GCFG_DECE); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_enable + * + * This routine enables or disables display compression. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_enable(int enable) +#else +int +gfx_set_compression_enable(int enable) +#endif +{ + /* SET GLOBAL VARIABLE FOR INDENDED STATE */ + /* Compression can only be enabled for non-zero start address values. */ + /* Keep state to enable compression on start address changes. */ + + gfx_compression_enabled = enable; + if (enable) + gu2_enable_compression(); + else + gu2_disable_compression(); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_offset + * + * This routine sets the base offset for the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_offset(unsigned long offset) +#else +int +gfx_set_compression_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + /* MUST BE 16-BYTE ALIGNED FOR REDCLOUD */ + + if (offset & 0x0F) + return (1); + + /* SET REGISTER VALUE */ + + lock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_CB_ST_OFFSET, offset & 0x0FFFFFFF); + WRITE_REG32(MDC_UNLOCK, lock); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_pitch + * + * This routine sets the pitch, in bytes, of the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_pitch(unsigned short pitch) +#else +int +gfx_set_compression_pitch(unsigned short pitch) +#endif +{ + unsigned long lock, line_delta; + + lock = READ_REG32(MDC_UNLOCK); + + /* SET REGISTER VALUE */ + + line_delta = READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF; + line_delta |= (((unsigned long)pitch << 13) & 0xFFFF0000); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GFX_PITCH, line_delta); + WRITE_REG32(MDC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_size + * + * This routine sets the line size of the compression buffer, which is the + * maximum number of bytes allowed to store a compressed line. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_size(unsigned short size) +#else +int +gfx_set_compression_size(unsigned short size) +#endif +{ + unsigned long lock, buf_size; + + /* SUBTRACT 32 FROM SIZE */ + /* The display controller will actually write */ + /* 4 extra QWords. So, if we assume that "size" */ + /* refers to the allocated size, we must subtract */ + /* 32 bytes. */ + + size -= 32; + + /* SET REGISTER VALUE */ + + lock = READ_REG32(MDC_UNLOCK); + buf_size = READ_REG32(MDC_LINE_SIZE) & 0xFF80FFFF; + buf_size |= ((((unsigned long)size >> 3) + 1) & 0x7F) << 16; + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_LINE_SIZE, buf_size); + WRITE_REG32(MDC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_format (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_format". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_format(unsigned long format) +#else +void +gfx_set_display_video_format(unsigned long format) +#endif +{ + unsigned long gcfg, lock; + + lock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + + switch (format) { + case VIDEO_FORMAT_Y0Y1Y2Y3: + case VIDEO_FORMAT_Y3Y2Y1Y0: + case VIDEO_FORMAT_Y1Y0Y3Y2: + case VIDEO_FORMAT_Y1Y2Y3Y0: + + gcfg |= MDC_GCFG_YUVM; + break; + + default: + + gcfg &= ~MDC_GCFG_YUVM; + break; + } + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_enable(int enable) +#else +void +gfx_set_display_video_enable(int enable) +#endif +{ + unsigned long lock, gcfg, dcfg; + + /* READ CURRENT VALUES */ + + lock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + dcfg = READ_REG32(MDC_DISPLAY_CFG); + + /* SET OR CLEAR VIDEO ENABLE IN GENERAL_CFG */ + + if (enable) + gcfg |= MDC_GCFG_VIDE; + else + gcfg &= ~MDC_GCFG_VIDE; + + /* WRITE REGISTER */ + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_size(unsigned short width, unsigned short height) +#else +void +gfx_set_display_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long lock, value, yuv_420; + + /* READ CURRENT VALUES */ + + lock = READ_REG32(MDC_UNLOCK); + value = READ_REG32(MDC_LINE_SIZE) & 0x00FFFFFF; + yuv_420 = READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_YUVM; + + /* LINE WIDTH IS 1/4 FOR 4:2:0 VIDEO */ + /* All data must be 32-byte aligned. */ + + if (yuv_420) { + width >>= 1; + width = (width + 7) & 0xFFF8; + } else { + width <<= 1; + width = (width + 31) & 0xFFE0; + } + + /* ONLY THE LINE SIZE IS PROGRAMMED IN THE DISPLAY CONTROLLER */ + + value |= ((unsigned long)width << 21); + + /* WRITE THE REGISTER */ + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_LINE_SIZE, value); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_offset(unsigned long offset) +#else +void +gfx_set_display_video_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + lock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + offset &= 0x0FFFFFF0; + WRITE_REG32(MDC_VID_Y_ST_OFFSET, offset); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by gfx_set_video_yuv_offsets. It abstracts the version + * of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, + unsigned long voffset) +#else +void +gfx_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, + unsigned long voffset) +#endif +{ + unsigned long lock; + + lock = READ_REG32(MDC_UNLOCK); + + yoffset &= 0x0FFFFFF0; + uoffset &= 0x0FFFFFF8; + voffset &= 0x0FFFFFF8; + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_VID_Y_ST_OFFSET, yoffset); + WRITE_REG32(MDC_VID_U_ST_OFFSET, uoffset); + WRITE_REG32(MDC_VID_V_ST_OFFSET, voffset); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by gfx_set_video_yuv_pitch. It abstracts the version + * of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#else +void +gfx_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#endif +{ + unsigned long lock, pitch; + + lock = READ_REG32(MDC_UNLOCK); + + pitch = ((uvpitch << 13) & 0xFFFF0000) | ((ypitch >> 3) & 0xFFFF); + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_VID_YUV_PITCH, pitch); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_downscale (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by gfx_set_video_vertical_downscale. It abstracts the version + * of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_downscale(unsigned short srch, unsigned short dsth) +#else +void +gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth) +#endif +{ + unsigned long lock, delta; + + lock = READ_REG32(MDC_UNLOCK); + + /* CLIP SCALING LIMITS */ + /* Upscaling is performed in a separate function. */ + /* Maximum scale ratio is 1/2. */ + + if (dsth > srch || dsth <= (srch >> 1)) + delta = 0; + else + delta = (((unsigned long)srch << 14) / (unsigned long)dsth) << 18; + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_VID_DS_DELTA, delta); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_downscale_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_vertical_downscale_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_vertical_downscale_enable(int enable) +#else +void +gfx_set_display_video_vertical_downscale_enable(int enable) +#endif +{ + unsigned long gcfg, unlock; + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + + if (enable) + gcfg |= MDC_GCFG_VDSE; + else + gcfg &= ~MDC_GCFG_VDSE; + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_test_timing_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_test_timing_active(void) +#else +int +gfx_test_timing_active(void) +#endif +{ + if (READ_REG32(MDC_DISPLAY_CFG) & MDC_DCFG_TGEN) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_test_vertical_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_test_vertical_active(void) +#else +int +gfx_test_vertical_active(void) +#endif +{ + if (READ_REG32(MDC_LINE_CNT_STATUS) & MDC_LNCNT_VNA) + return (0); + + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_wait_vertical_blank + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_wait_vertical_blank(void) +#else +int +gfx_wait_vertical_blank(void) +#endif +{ + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_panning + * + * This routine enables the panning when the Mode is bigger than the panel + * size. + *--------------------------------------------------------------------------- + */ + +#if GFX_DISPLAY_DYNAMIC +void +gu2_enable_panning(int x, int y) +#else +void +gfx_enable_panning(int x, int y) +#endif +{ + unsigned long modeBytesPerPixel; + unsigned long modeBytesPerScanline = 0; + unsigned long startAddress = 0; + + modeBytesPerPixel = (gbpp + 7) / 8; + modeBytesPerScanline = (READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF) << 3; + + /* TEST FOR NO-WORK */ + + if (x >= DeltaX && x < ((int)PanelWidth + DeltaX) && + y >= DeltaY && y < ((int)PanelHeight + DeltaY)) + return; + + /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ + /* Test the boundary conditions for each coordinate and update */ + /* all variables and the starting offset accordingly. */ + + if (x < DeltaX) + DeltaX = x; + + else if (x >= (DeltaX + (int)PanelWidth)) + DeltaX = x - (int)PanelWidth + 1; + + if (y < DeltaY) + DeltaY = y; + + else if (y >= (DeltaY + (int)PanelHeight)) + DeltaY = y - (int)PanelHeight + 1; + + /* CALCULATE THE START OFFSET */ + + startAddress = + (DeltaX * modeBytesPerPixel) + (DeltaY * modeBytesPerScanline); + + gfx_set_display_offset(startAddress); + + /* SET PANEL COORDINATES */ + /* Panel's x position must be DWORD aligned */ + + panelTop = DeltaY; + panelLeft = DeltaX * modeBytesPerPixel; + + if (panelLeft & 3) + panelLeft = (panelLeft & 0xFFFFFFFC) + 4; + + panelLeft /= modeBytesPerPixel; +} + +/*--------------------------------------------------------------------------- + * gfx_set_fixed_timings + *--------------------------------------------------------------------------- + */ + +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + unsigned int mode; + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_FIXED_TIMINGS_MODES; mode++) { + if ((FixedParams[mode].xres == width) && + (FixedParams[mode].yres == height) && + (FixedParams[mode].panelresx == panelResX) && + (FixedParams[mode].panelresy == panelResY)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + FIXEDTIMINGS *fmode = &FixedParams[mode]; + + gfx_set_display_timings(bpp, 3, fmode->hactive, fmode->hblankstart, + fmode->hsyncstart, fmode->hsyncend, + fmode->hblankend, fmode->htotal, + fmode->vactive, fmode->vblankstart, + fmode->vsyncstart, fmode->vsyncend, + fmode->vblankend, fmode->vtotal, + fmode->frequency); + + return (1); + } /* end if() */ + } /* end for() */ + + return (-1); +} + +/*--------------------------------------------------------------------------- + * gfx_set_panel_present + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + /* SET VALID BPP */ + /* 16BPP is the default. */ + + if (bpp != 8 && bpp != 12 && bpp != 15 && bpp != 16 && bpp != 32) + bpp = 16; + + /* RECORD PANEL PARAMETERS */ + /* This routine does not touch any panel timings. It is used when custom panel */ + /* settings are set up in advance by the BIOS or an application, but the */ + /* application still requires access to other panel functionality provided by */ + /* Durango (i.e. panning). */ + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + gbpp = bpp; + + /* PROGRAM THE BPP IN THE DISPLAY CONTROLLER */ + + gfx_set_display_bpp(bpp); + + return (GFX_STATUS_OK); +} + +/* THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED: */ + +/*--------------------------------------------------------------------------- + * gfx_get_display_pitch + * + * This routine returns the current pitch of the frame buffer, in bytes. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_display_pitch(void) +#else +unsigned short +gfx_get_display_pitch(void) +#endif +{ + return ((unsigned short)(READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF) << 3); +} + +/*---------------------------------------------------------------------------- + * gfx_mode_frequency_supported + * + * This routine examines if the requested mode with pixel frequency is supported. + * + * Returns >0 if successful , <0 if freq. could not be found and matched. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#else +int +gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value; + unsigned long bpp_flag = 0; + + switch (bpp) { + case 8: + bpp_flag = GFX_MODE_8BPP; + break; + case 12: + bpp_flag = GFX_MODE_12BPP; + break; + case 15: + bpp_flag = GFX_MODE_15BPP; + break; + case 16: + bpp_flag = GFX_MODE_16BPP; + break; + case 32: + bpp_flag = GFX_MODE_24BPP; + break; + default: + bpp_flag = GFX_MODE_8BPP; + break; + } + + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned int)xres) && + (DisplayParams[index].vactive == (unsigned int)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].frequency == frequency)) { + int hz = 0; + + value = DisplayParams[index].flags; + + if (value & GFX_MODE_60HZ) + hz = 60; + else if (value & GFX_MODE_70HZ) + hz = 70; + else if (value & GFX_MODE_72HZ) + hz = 72; + else if (value & GFX_MODE_75HZ) + hz = 75; + else if (value & GFX_MODE_85HZ) + hz = 85; + return (hz); + } + } + + return (-1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_frequency + * + * This routine maps the frequency to close match refresh rate + * + * Returns . + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + switch (bpp) { + case 8: + bpp_flag = GFX_MODE_8BPP; + break; + case 12: + bpp_flag = GFX_MODE_12BPP; + break; + case 15: + bpp_flag = GFX_MODE_15BPP; + break; + case 16: + bpp_flag = GFX_MODE_16BPP; + break; + case 32: + bpp_flag = GFX_MODE_24BPP; + break; + default: + bpp_flag = GFX_MODE_8BPP; + break; + } + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + min = 0x7fffffff; + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].htotal == (unsigned int)xres) && + (DisplayParams[index].vtotal == (unsigned int)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_56HZ) + *hz = 56; + else if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_mode + * + * This routine is identical to the gfx_get_refreshrate_from_frequency, + * except that the active timing values are compared instead of the total + * values. Some modes (such as 70Hz and 72Hz) may be confused in this routine. + * + * Returns . + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + switch (bpp) { + case 8: + bpp_flag = GFX_MODE_8BPP; + break; + case 12: + bpp_flag = GFX_MODE_12BPP; + break; + case 15: + bpp_flag = GFX_MODE_15BPP; + break; + case 16: + bpp_flag = GFX_MODE_16BPP; + break; + case 32: + bpp_flag = GFX_MODE_24BPP; + break; + default: + bpp_flag = GFX_MODE_8BPP; + break; + } + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + min = 0x7fffffff; + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned int)xres) && + (DisplayParams[index].vactive == (unsigned int)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_56HZ) + *hz = 56; + else if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frequency_from_refreshrate + * + * This routine maps the refresh rate to the closest matching PLL frequency. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#else +int +gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#endif +{ + int retval = -1; + unsigned long hz_flag = 0; + unsigned long index, bpp_flag = 0; + + *frequency = 0; + + if (hz == 60) + hz_flag = GFX_MODE_60HZ; + else if (hz == 70) + hz_flag = GFX_MODE_70HZ; + else if (hz == 72) + hz_flag = GFX_MODE_72HZ; + else if (hz == 75) + hz_flag = GFX_MODE_75HZ; + else if (hz == 85) + hz_flag = GFX_MODE_85HZ; + + switch (bpp) { + case 8: + bpp_flag = GFX_MODE_8BPP; + break; + case 12: + bpp_flag = GFX_MODE_12BPP; + break; + case 15: + bpp_flag = GFX_MODE_15BPP; + break; + case 16: + bpp_flag = GFX_MODE_16BPP; + break; + case 32: + bpp_flag = GFX_MODE_24BPP; + break; + default: + bpp_flag = GFX_MODE_8BPP; + break; + } + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].flags & hz_flag)) { + *frequency = DisplayParams[index].frequency; + retval = 1; + } + } + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_supported_pixel_clock + * + * This routine returns the maximum recommended speed for the pixel clock. The + * return value is an integer of the format xxxyyy, where xxx.yyy is the maximum + * floating point pixel clock speed. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_max_supported_pixel_clock(void) +#else +unsigned long +gfx_get_max_supported_pixel_clock(void) +#endif +{ + return 229500; +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_mode + * + * This routine gets the specified display mode. + * + * Returns >0 if successful and mode returned, <0 if mode could not be found. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#else +int +gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#endif +{ + unsigned int mode = 0; + unsigned long pll_freq = 0, bpp_flag = 0; + + *xres = gfx_get_hactive(); + *yres = gfx_get_vactive(); + *bpp = gfx_get_display_bpp(); + pll_freq = gfx_get_clock_frequency(); + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + + switch (*bpp) { + case 8: + bpp_flag = GFX_MODE_8BPP; + break; + case 12: + bpp_flag = GFX_MODE_12BPP; + break; + case 15: + bpp_flag = GFX_MODE_15BPP; + break; + case 16: + bpp_flag = GFX_MODE_16BPP; + break; + case 32: + bpp_flag = GFX_MODE_24BPP; + break; + default: + bpp_flag = GFX_MODE_8BPP; + break; + } + + for (mode = 0; mode < NUM_RC_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned int)*xres) && + (DisplayParams[mode].vactive == (unsigned int)*yres) && + (DisplayParams[mode].frequency == pll_freq) && + (DisplayParams[mode].flags & bpp_flag)) { + + pll_freq = DisplayParams[mode].flags; + + if (pll_freq & GFX_MODE_56HZ) + *hz = 56; + else if (pll_freq & GFX_MODE_60HZ) + *hz = 60; + else if (pll_freq & GFX_MODE_70HZ) + *hz = 70; + else if (pll_freq & GFX_MODE_72HZ) + *hz = 72; + else if (pll_freq & GFX_MODE_75HZ) + *hz = 75; + else if (pll_freq & GFX_MODE_85HZ) + *hz = 85; + + return (1); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_DETAILS + * + * This routine gets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be get. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#else +int +gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#endif +{ + if (mode < NUM_RC_DISPLAY_MODES) { + if (DisplayParams[mode].flags & GFX_MODE_56HZ) + *hz = 56; + else if (DisplayParams[mode].flags & GFX_MODE_60HZ) + *hz = 60; + else if (DisplayParams[mode].flags & GFX_MODE_70HZ) + *hz = 70; + else if (DisplayParams[mode].flags & GFX_MODE_72HZ) + *hz = 72; + else if (DisplayParams[mode].flags & GFX_MODE_75HZ) + *hz = 75; + else if (DisplayParams[mode].flags & GFX_MODE_85HZ) + *hz = 85; + + *xres = DisplayParams[mode].hactive; + *yres = DisplayParams[mode].vactive; + + if (DisplayParams[mode].flags & GFX_MODE_PIXEL_DOUBLE) + *xres >>= 1; + if (DisplayParams[mode].flags & GFX_MODE_LINE_DOUBLE) + *yres >>= 1; + + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_MODE_COUNT + * + * This routine gets the number of available display modes. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_mode_count(void) +#else +int +gfx_get_display_mode_count(void) +#endif +{ + return (NUM_RC_DISPLAY_MODES); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_line_size + * + * Returns the current frame buffer line size, in bytes + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_frame_buffer_line_size(void) +#else +unsigned long +gfx_get_frame_buffer_line_size(void) +#endif +{ + return ((READ_REG32(MDC_LINE_SIZE) & 0x7FF) << 3); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hactive(void) +#else +unsigned short +gfx_get_hactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_H_ACTIVE_TIMING) & 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hsync_start(void) +#else +unsigned short +gfx_get_hsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_H_SYNC_TIMING) & 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hsync_end(void) +#else +unsigned short +gfx_get_hsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_H_SYNC_TIMING) >> 16) & 0x0FF8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_htotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_htotal(void) +#else +unsigned short +gfx_get_htotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_H_ACTIVE_TIMING) >> 16) & 0x0FF8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vactive(void) +#else +unsigned short +gfx_get_vactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_V_ACTIVE_TIMING) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vsync_end(void) +#else +unsigned short +gfx_get_vsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_V_SYNC_TIMING) >> 16) & 0x07FF) + + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vtotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vtotal(void) +#else +unsigned short +gfx_get_vtotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_V_ACTIVE_TIMING) >> 16) & 0x07FF) + + 1)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_bpp + * + * This routine returns the current color depth of the active display. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_display_bpp(void) +#else +unsigned short +gfx_get_display_bpp(void) +#endif +{ + unsigned long dcfg = READ_REG32(MDC_DISPLAY_CFG); + + switch ((dcfg & MDC_DCFG_DISP_MODE_MASK) >> 8) { + case 0: + return (8); + case 2: + return (32); + + case 1: + + switch ((dcfg & MDC_DCFG_16BPP_MODE_MASK) >> 10) { + case 0: + return (16); + case 1: + return (15); + case 2: + return (12); + default: + return (0); + } + } + + /* INVALID SETTING */ + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vline + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vline(void) +#else +unsigned short +gfx_get_vline(void) +#endif +{ + unsigned short current_scan_line; + + /* Read similar value twice to ensure that the value is not transitioning */ + + do + current_scan_line = + (unsigned short)(READ_REG32(MDC_LINE_CNT_STATUS) & + MDC_LNCNT_V_LINE_CNT); + while (current_scan_line != + (unsigned short)(READ_REG32(MDC_LINE_CNT_STATUS) & + MDC_LNCNT_V_LINE_CNT)); + + return (current_scan_line >> 16); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_offset(void) +#else +unsigned long +gfx_get_display_offset(void) +#endif +{ + return (READ_REG32(MDC_FB_ST_OFFSET) & 0x0FFFFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_offset(void) +#else +unsigned long +gfx_get_cursor_offset(void) +#endif +{ + return (READ_REG32(MDC_CURS_ST_OFFSET) & 0x0FFFFFFF); +} + +#if GFX_READ_ROUTINES + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hblank_start(void) +#else +unsigned short +gfx_get_hblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_H_BLANK_TIMING) & 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hblank_end(void) +#else +unsigned short +gfx_get_hblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_H_BLANK_TIMING) >> 16) & 0x0FF8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vblank_start(void) +#else +unsigned short +gfx_get_vblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_V_BLANK_TIMING) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vsync_start(void) +#else +unsigned short +gfx_get_vsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_V_SYNC_TIMING) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vblank_end(void) +#else +unsigned short +gfx_get_vblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_V_BLANK_TIMING) >> 16) & 0x07FF) + + 1)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_palette_entry + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_display_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(MDC_PAL_ADDRESS, index); + *palette = READ_REG32(MDC_PAL_DATA); + + return 0; +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_palette + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_get_display_palette(unsigned long *palette) +#else +void +gfx_get_display_palette(unsigned long *palette) +#endif +{ + unsigned long i; + + WRITE_REG32(MDC_PAL_ADDRESS, 0); + for (i = 0; i < 256; i++) { + palette[i] = READ_REG32(MDC_PAL_DATA); + } +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_enable(void) +#else +unsigned long +gfx_get_cursor_enable(void) +#endif +{ + return (READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_CURE); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_position + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_position(void) +#else +unsigned long +gfx_get_cursor_position(void) +#endif +{ + return ((READ_REG32(MDC_CURSOR_X) & 0x07FF) | + ((READ_REG32(MDC_CURSOR_Y) << 16) & 0x03FF0000)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_clip(void) +#else +unsigned long +gfx_get_cursor_clip(void) +#endif +{ + return (((READ_REG32(MDC_CURSOR_X) >> 11) & 0x03F) | + ((READ_REG32(MDC_CURSOR_Y) << 5) & 0x3F0000)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_color + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_color(int color) +#else +unsigned long +gfx_get_cursor_color(int color) +#endif +{ + if (color) { + WRITE_REG32(MDC_PAL_ADDRESS, 0x101); + } else { + WRITE_REG32(MDC_PAL_ADDRESS, 0x100); + } + return READ_REG32(MDC_PAL_DATA); +} + +/*----------------------------------------------------------------------------- + * gfx_get_icon_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_enable(void) +#else +unsigned long +gfx_get_icon_enable(void) +#endif +{ + return (READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_ICNE); +} + +/*----------------------------------------------------------------------------- + * gfx_get_icon_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_offset(void) +#else +unsigned long +gfx_get_icon_offset(void) +#endif +{ + return (READ_REG32(MDC_ICON_ST_OFFSET) & 0x0FFFFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_icon_position + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_position(void) +#else +unsigned long +gfx_get_icon_position(void) +#endif +{ + return (READ_REG32(MDC_ICON_X) & 0x07FF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_icon_color + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_color(int color) +#else +unsigned long +gfx_get_icon_color(int color) +#endif +{ + if (color >= 3) + return 0; + + WRITE_REG32(MDC_PAL_ADDRESS, 0x102 + color); + + return READ_REG32(MDC_PAL_DATA); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_compression_enable(void) +#else +int +gfx_get_compression_enable(void) +#endif +{ + if (READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_CMPE) + return (1); + + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_compression_offset(void) +#else +unsigned long +gfx_get_compression_offset(void) +#endif +{ + return (READ_REG32(MDC_CB_ST_OFFSET) & 0x007FFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_compression_pitch(void) +#else +unsigned short +gfx_get_compression_pitch(void) +#endif +{ + unsigned short pitch; + + pitch = (unsigned short)(READ_REG32(MDC_GFX_PITCH) >> 16); + return (pitch << 3); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_size + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_compression_size(void) +#else +unsigned short +gfx_get_compression_size(void) +#endif +{ + unsigned short size; + + size = (unsigned short)((READ_REG32(MDC_LINE_SIZE) >> 16) & 0x7F) - 1; + return ((size << 3) + 32); +} + +/*----------------------------------------------------------------------------- + * gfx_get_valid_bit + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_valid_bit(int line) +#else +int +gfx_get_valid_bit(int line) +#endif +{ + unsigned long offset; + int valid; + + offset = READ_REG32(MDC_PHY_MEM_OFFSET) & 0xFF000000; + offset |= line; + + WRITE_REG32(MDC_PHY_MEM_OFFSET, offset); + valid = (int)READ_REG32(MDC_DV_ACC) & 2; + + if (valid) + return 1; + return 0; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_video_offset(void) +#else +unsigned long +gfx_get_display_video_offset(void) +#endif +{ + return (READ_REG32(MDC_VID_Y_ST_OFFSET) & 0x0FFFFFFF); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_yuv_offsets". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset) +#else +void +gfx_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset) +#endif +{ + *yoffset = (READ_REG32(MDC_VID_Y_ST_OFFSET) & 0x0FFFFFFF); + *uoffset = (READ_REG32(MDC_VID_U_ST_OFFSET) & 0x0FFFFFFF); + *voffset = (READ_REG32(MDC_VID_V_ST_OFFSET) & 0x0FFFFFFF); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_yuv_pitch". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#else +void +gfx_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#endif +{ + unsigned long pitch = READ_REG32(MDC_VID_YUV_PITCH); + + *ypitch = ((pitch & 0xFFFF) << 3); + *uvpitch = (pitch >> 13) & 0x7FFF8; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_delta (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_downscale_delta". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_video_downscale_delta(void) +#else +unsigned long +gfx_get_display_video_downscale_delta(void) +#endif +{ + return (READ_REG32(MDC_VID_DS_DELTA) >> 18); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_vertical_downscale_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_video_downscale_enable(void) +#else +int +gfx_get_display_video_downscale_enable(void) +#endif +{ + return ((int)((READ_REG32(MDC_GENERAL_CFG) >> 19) & 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_video_size(void) +#else +unsigned long +gfx_get_display_video_size(void) +#endif +{ + /* RETURN THE LINE SIZE, AS THIS IS ALL THAT IS AVAILABLE */ + + return ((READ_REG32(MDC_LINE_SIZE) >> 21) & 0x000007FF); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/durango.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/durango.c:1.1 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/durango.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,627 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/durango.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: durango.c $ + * + * This is the main file used to add Durango graphics support to a software + * project. The main reason to have a single file include the other files + * is that it centralizes the location of the compiler options. This file + * should be tuned for a specific implementation, and then modified as needed + * for new Durango releases. The releases.txt file indicates any updates to + * this main file, such as a new definition for a new hardware platform. + * + * In other words, this file should be copied from the Durango source files + * once when a software project starts, and then maintained as necessary. + * It should not be recopied with new versions of Durango unless the + * developer is willing to tune the file again for the specific project. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* COMPILER OPTIONS + * These compiler options specify how the Durango routines are compiled + * for the different hardware platforms. For best performance, a driver + * would build for a specific platform. The "dynamic" switches are set + * by diagnostic applications such as Darwin that will run on a variety + * of platforms and use the appropriate code at runtime. Each component + * may be separately dynamic, so that a driver has the option of being + * tuned for a specific 2D accelerator, but will still run with a variety + * of chipsets. + */ + +#define GFX_DISPLAY_DYNAMIC 1 /* runtime selection */ +#define GFX_DISPLAY_GU1 1 /* 1st generation display controller */ +#define GFX_DISPLAY_GU2 1 /* 2nd generation display controller */ + +#define GFX_INIT_DYNAMIC 1 /* runtime selection */ +#define GFX_INIT_GU1 1 /* Geode family */ +#define GFX_INIT_GU2 1 /* Redcloud */ + +#define GFX_MSR_DYNAMIC 1 /* runtime selection */ +#define GFX_MSR_REDCLOUD 1 /* Redcloud */ + +#define GFX_2DACCEL_DYNAMIC 1 /* runtime selection */ +#define GFX_2DACCEL_GU1 1 /* 1st generation 2D accelerator */ +#define GFX_2DACCEL_GU2 1 /* 2nd generation 2D accelerator */ + +#define GFX_VIDEO_DYNAMIC 1 /* runtime selection */ +#define GFX_VIDEO_CS5530 1 /* support for CS5530 */ +#define GFX_VIDEO_SC1200 1 /* support for SC1200 */ +#define GFX_VIDEO_REDCLOUD 1 /* support for Redcloud */ + +#define GFX_VIP_DYNAMIC 1 /* runtime selection */ +#define GFX_VIP_SC1200 1 /* support for SC1200 */ + +#define GFX_DECODER_DYNAMIC 1 /* runtime selection */ +#define GFX_DECODER_SAA7114 1 /* Philips SAA7114 decoder */ + +#define GFX_TV_DYNAMIC 1 /* runtime selection */ +#define GFX_TV_FS451 1 /* Focus Enhancements FS450 */ +#define GFX_TV_SC1200 1 /* SC1200 integrated TV encoder */ + +#define GFX_I2C_DYNAMIC 1 /* runtime selection */ +#define GFX_I2C_ACCESS 1 /* support for ACCESS.BUS */ +#define GFX_I2C_GPIO 1 /* support for CS5530 GPIOs */ + +#define GFX_VGA_DYNAMIC 1 /* runtime selection */ +#define GFX_VGA_GU1 1 /* 1st generation graphics unit */ + +#define FB4MB 1 /* Set to use 4Mb video ram for Pyramid */ + +#define GFX_NO_IO_IN_WAIT_MACROS 0 /* Set to remove I/O accesses in GP bit testing */ + +/* ROUTINES TO READ VALUES + * These are routines used by Darwin or other diagnostics to read the + * current state of the hardware. Display drivers or embedded applications can + * reduce the size of the Durango code by not including these routines. + */ +#define GFX_READ_ROUTINES 1 /* add routines to read values */ + +/* VARIABLES USED FOR RUNTIME SELECTION + * If part of the graphics subsystem is declared as dynamic, then the + * following variables are used to specify which platform has been detected. + * The variables are set in the "gfx_detect_cpu" routine. The values should + * be bit flags to allow masks to be used to check for multiple platforms. + */ + +#if GFX_DISPLAY_DYNAMIC +int gfx_display_type = 0; +#endif + +#if GFX_INIT_DYNAMIC +int gfx_init_type = 0; +#endif + +#if GFX_MSR_DYNAMIC +int gfx_msr_type = 0; +#endif + +#if GFX_2DACCEL_DYNAMIC +int gfx_2daccel_type = 0; +#endif + +#if GFX_VIDEO_DYNAMIC +int gfx_video_type = 0; +#endif + +#if GFX_VIP_DYNAMIC +int gfx_vip_type = 0; +#endif + +#if GFX_DECODER_DYNAMIC +int gfx_decoder_type = 0; +#endif + +#if GFX_TV_DYNAMIC +int gfx_tv_type = 0; +#endif + +#if GFX_I2C_DYNAMIC +int gfx_i2c_type = 0; +#endif + +#if GFX_VGA_DYNAMIC +int gfx_vga_type = 0; +#endif + +/* HEADER FILE FOR DURANGO ROUTINE DEFINITIONS + * Needed since some of the Durango routines call other Durango routines. + * Also defines the size of chipset array (GFX_CSPTR_SIZE). + */ +#include "gfx_rtns.h" /* routine definitions */ + +/* DEFINE POINTERS TO MEMORY MAPPED REGIONS + * These pointers are used by the Durango routines to access the hardware. + * The variables must be set by the project's initialization code after + * mapping the regions in the appropriate manner. + */ + +/* DEFINE VIRTUAL ADDRESSES */ +/* Note: These addresses define the starting base expected by all */ +/* Durango offsets. Under an OS that requires these pointers */ +/* to be mapped to linear addresses (i.e Windows), it may not */ +/* be possible to keep these base offsets. In these cases, */ +/* the addresses are modified to point to the beginning of the */ +/* relevant memory region and the access macros are adjusted */ +/* to subtract the offset from the default base. For example, */ +/* the register pointer could be moved to be 0x40008000, while */ +/* the WRITE_REG* macros are modified to subtract 0x8000 from */ +/* the offset. */ + +unsigned char *gfx_virt_regptr = (unsigned char *)0x40000000; +unsigned char *gfx_virt_fbptr = (unsigned char *)0x40800000; +unsigned char *gfx_virt_vidptr = (unsigned char *)0x40010000; +unsigned char *gfx_virt_vipptr = (unsigned char *)0x40015000; +unsigned char *gfx_virt_spptr = (unsigned char *)0x40000000; +unsigned char *gfx_virt_gpptr = (unsigned char *)0x40000000; + +/* DEFINE PHYSICAL ADDRESSES */ + +unsigned char *gfx_phys_regptr = (unsigned char *)0x40000000; +unsigned char *gfx_phys_fbptr = (unsigned char *)0x40800000; +unsigned char *gfx_phys_vidptr = (unsigned char *)0x40010000; +unsigned char *gfx_phys_vipptr = (unsigned char *)0x40015000; + +/* HEADER FILE FOR GRAPHICS REGISTER DEFINITIONS + * This contains only constant definitions, so it should be able to be + * included in any software project as is. + */ +#include "gfx_regs.h" /* graphics register definitions */ + +/* HEADER FILE FOR REGISTER ACCESS MACROS + * This file contains the definitions of the WRITE_REG32 and similar macros + * used by the Durango routines to access the hardware. The file assumes + * that the environment can handle 32-bit pointer access. If this is not + * the case, or if there are special requirements, then this header file + * should not be included and the project must define the macros itself. + * (A project may define WRITE_REG32 to call a routine, for example). + */ +#include "gfx_defs.h" /* register access macros */ + +/* IO MACROS AND ROUTINES + * These macros must be defined before the initialization or I2C + * routines will work properly. + */ + +#if defined(OS_WIN32) /* For Windows */ + +/* VSA II CALL */ + +void +gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long temp1, temp2; + + _asm { + mov dx, 0x0AC1C + mov eax, 0x0FC530007 + out dx, eax + add dl, 2 + mov ecx, msrAddr + mov cx, msrReg + in ax, dx; + ;EDX:EAX will contain MSR contents. + mov temp1, edx + mov temp2, eax + } + + *ptrHigh = temp1; + *ptrLow = temp2; +} + +void +gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long temp1 = *ptrHigh; + unsigned long temp2 = *ptrLow; + + _asm { + mov dx, 0x0AC1C + mov eax, 0x0FC530007 + out dx, eax i + add dl, 2 + ;ECX contains msrAddr | msrReg + mov ecx, msrAddr + mov cx, msrReg + ;<OR_mask_hi > + mov ebx, temp1 + + ;<OR_mask_hi > + mov eax, temp2 + ;<AND_mask_hi > + mov esi, 0 + ;<AND_mask_lo > + mov edi, 0 + ;MSR is written at this point + out dx, ax + } +} + +unsigned char +gfx_inb(unsigned short port) +{ + unsigned char data; + + _asm { + pushf + mov dx, port + in al, dx + mov data, al + popf + } + return (data); +} + +unsigned short +gfx_inw(unsigned short port) +{ + unsigned short data; + + _asm { + pushf + mov dx, port + in ax, dx + mov data, ax + popf + } + return (data); +} + +unsigned long +gfx_ind(unsigned short port) +{ + unsigned long data; + + _asm { + pushf + mov dx, port + in eax, dx + mov data, eax + popf + } + return (data); +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + _asm { + pushf + mov al, data + mov dx, port + out dx, al + popf + } +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + _asm { + pushf + mov ax, data + mov dx, port + out dx, ax + popf + } +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + _asm { + pushf + mov eax, data + mov dx, port + out dx, eax + popf + } +} + + +#elif defined(OS_VXWORKS) || defined (OS_LINUX) /* VxWorks and Linux */ + +#if defined(OS_LINUX) +#include "asm/msr.h" +#endif + +void +gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long addr, val1, val2; + + addr = msrAddr | (unsigned long)msrReg; + rdmsr(addr, val1, val2); + + *ptrHigh = val2; + *ptrLow = val1; +} + +void +gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow) +{ + unsigned long addr, val1, val2; + + val2 = *ptrHigh; + val1 = *ptrLow; + + addr = (msrAddr & 0xFFFF0000) | (unsigned long)msrReg; + wrmsr(addr, val1, val2); +} + +unsigned char +gfx_inb(unsigned short port) +{ + unsigned char value; + __asm__ volatile ("inb %1,%0":"=a" (value):"d"(port)); + + return value; +} + +unsigned short +gfx_inw(unsigned short port) +{ + unsigned short value; + __asm__ volatile ("in %1,%0":"=a" (value):"d"(port)); + + return value; +} + +unsigned long +gfx_ind(unsigned short port) +{ + unsigned long value; + __asm__ volatile ("inl %1,%0":"=a" (value):"d"(port)); + + return value; +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + __asm__ volatile ("outb %0,%1"::"a" (data), "d"(port)); +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + __asm__ volatile ("out %0,%1"::"a" (data), "d"(port)); +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + __asm__ volatile ("outl %0,%1"::"a" (data), "d"(port)); +} + +#else /* else nothing */ + +unsigned char +gfx_inb(unsigned short port) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ + return (0); +} + +unsigned short +gfx_inw(unsigned short port) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ + return (0); +} + +unsigned long +gfx_ind(unsigned short port) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ + return (0); +} + +void +gfx_outb(unsigned short port, unsigned char data) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ +} + +void +gfx_outw(unsigned short port, unsigned short data) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ +} + +void +gfx_outd(unsigned short port, unsigned long data) +{ + /* ADD OS SPECIFIC IMPLEMENTATION */ +} +#endif + +#define INB(port) gfx_inb(port) +#define INW(port) gfx_inw(port) +#define IND(port) gfx_ind(port) +#define OUTB(port, data) gfx_outb(port, data) +#define OUTW(port, data) gfx_outw(port, data) +#define OUTD(port, data) gfx_outd(port, data) + +/* INITIALIZATION ROUTINES + * These routines are used during the initialization of the driver to + * perform such tasks as detecting the type of CPU and video hardware. + * The routines require the use of IO, so the above IO routines need + * to be implemented before the initialization routines will work + * properly. + */ + +#include "gfx_init.c" + +/* INCLUDE MSR ACCESS ROUTINES */ + +#include "gfx_msr.c" + +/* INCLUDE GRAPHICS ENGINE ROUTINES + * These routines are used to program the 2D graphics accelerator. If + * the project does not use graphics acceleration (direct frame buffer + * access only), then this file does not need to be included. + */ +#include "gfx_rndr.c" /* graphics engine routines */ + +/* INCLUDE DISPLAY CONTROLLER ROUTINES + * These routines are used if the display mode is set directly. If the + * project uses VGA registers to set a display mode, then these files + * do not need to be included. + */ +#include "gfx_mode.h" /* display mode tables */ +#include "gfx_disp.c" /* display controller routines */ + +/* INCLUDE VIDEO OVERLAY ROUTINES + * These routines control the video overlay hardware. + */ +#include "gfx_vid.c" /* video overlay routines */ + +/* VIDEO PORT AND VIDEO DECODER ROUTINES + * These routines rely on the I2C routines. + */ +#include "gfx_vip.c" /* video port routines */ +#include "gfx_dcdr.c" /* video decoder routines */ + +/* I2C BUS ACCESS ROUTINES + * These routines are used by the video decoder and possibly an + * external TV encoer. + */ +#include "gfx_i2c.c" /* I2C bus access routines */ + +/* TV ENCODER ROUTINES + * This file does not need to be included if the system does not + * support TV output. + */ +#include "gfx_tv.c" /* TV encoder routines */ + +/* VGA ROUTINES + * This file is used if setting display modes using VGA registers. + */ +#include "gfx_vga.c" /* VGA routines */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_dcdr.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_dcdr.c:1.1 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_dcdr.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,600 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_dcdr.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_dcdr.c $ + * + * This file contains routines to control the video decoder. + * + * gfx_set_decoder_defaults + * gfx_set_decoder_analog_input + * gfx_set_decoder_brightness + * gfx_set_decoder_contrast + * gfx_set_decoder_luminance_filter + * gfx_set_decoder_hue + * gfx_set_decoder_saturation + * gfx_set_decoder_input_offset + * gfx_set_decoder_input_size + * gfx_set_decoder_output_size + * gfx_set_decoder_scale + * gfx_set_decoder_TV_standard + * gfx_set_decoder_vbi_enable + * gfx_set_decoder_vbi_format + * gfx_set_decoder_vbi_upscale + * gfx_decoder_software_reset + * gfx_decoder_detect_macrovision + * gfx_decoder_detect_video + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_decoder_brightness + * gfx_get_decoder_contrast + * gfx_get_decoder_hue + * gfx_get_decoder_saturation + * gfx_get_decoder_input_offset + * gfx_get_decoder_input_size + * gfx_get_decoder_output_size + * gfx_get_decoder_vbi_format + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* INCLUDE SUPPORT FOR PHILIPS SAA7114 DECODER, IF SPECIFIED */ + +#if GFX_DECODER_SAA7114 +#include "saa7114.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call various decoders. Currently only the Pillips */ +/* decoder is supported, but still organized to easily expand later. */ + +#if GFX_DECODER_DYNAMIC + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_defaults + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_defaults(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_defaults(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_analog_input + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_analog_input(unsigned char input) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_analog_input(input); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_brightness + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_brightness(unsigned char brightness) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_brightness(brightness); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_contrast + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_contrast(unsigned char contrast) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_contrast(contrast); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_hue + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_hue(char hue) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_hue(hue); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_saturation + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_saturation(unsigned char saturation) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_saturation(saturation); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_input_offset + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_input_offset(unsigned short x, unsigned short y) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_input_offset(x, y); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_input_size + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_input_size(unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_input_size(width, height); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_output_size + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_output_size(unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_output_size(width, height); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_scale + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_scale(srcw, srch, dstw, dsth); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_vbi_format + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_vbi_format(int start, int end, int format) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_vbi_format(start, end, format); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_vbi_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_vbi_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_vbi_enable(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_vbi_upscale + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_vbi_upscale(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_vbi_upscale(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_TV_standard + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_TV_standard(TVStandardType TVStandard) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_TV_standard(TVStandard); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_luminance_filter + *----------------------------------------------------------------------------- + */ +int +gfx_set_decoder_luminance_filter(unsigned char lufi) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_luminance_filter(lufi); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_decoder_software_reset + *----------------------------------------------------------------------------- + */ +int +gfx_decoder_software_reset(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_decoder_software_reset(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_decoder_detect_macrovision + *----------------------------------------------------------------------------- + */ +int +gfx_decoder_detect_macrovision(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_decoder_detect_macrovision(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_decoder_detect_video + *----------------------------------------------------------------------------- + */ +int +gfx_decoder_detect_video(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_decoder_detect_video(); +# endif + return (status); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_brightness + *----------------------------------------------------------------------------- + */ +unsigned char +gfx_get_decoder_brightness(void) +{ + unsigned char brightness = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + brightness = saa7114_get_decoder_brightness(); +# endif + return (brightness); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_contrast + *----------------------------------------------------------------------------- + */ +unsigned char +gfx_get_decoder_contrast(void) +{ + unsigned char contrast = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + contrast = saa7114_get_decoder_contrast(); +# endif + return (contrast); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_hue + *----------------------------------------------------------------------------- + */ +char +gfx_get_decoder_hue(void) +{ + unsigned char hue = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + hue = saa7114_get_decoder_hue(); +# endif + return ((char)hue); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_saturation + *----------------------------------------------------------------------------- + */ +unsigned char +gfx_get_decoder_saturation(void) +{ + unsigned char saturation = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + saturation = saa7114_get_decoder_saturation(); +# endif + return (saturation); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_input_offset + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_decoder_input_offset() +{ + unsigned long offset = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + offset = saa7114_get_decoder_input_offset(); +# endif + return (offset); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_input_size + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_decoder_input_size() +{ + unsigned long size = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + size = saa7114_get_decoder_input_size(); +# endif + return (size); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_output_size + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_decoder_output_size() +{ + unsigned long size = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + size = saa7114_get_decoder_output_size(); +# endif + return (size); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_vbi_format + *----------------------------------------------------------------------------- + */ +int +gfx_get_decoder_vbi_format(int line) +{ + int format = 0; + +# if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + format = saa7114_get_decoder_vbi_format(line); +# endif + return (format); +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_DECODER_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_defs.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_defs.h:1.2 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_defs.h Wed Dec 11 17:51:01 2002 @@ -0,0 +1,435 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_defs.h,v 1.2 2002/12/11 22:51:01 dawes Exp $ */ +/* + * $Workfile: gfx_defs.h $ + * + * This header file contains the macros used to access the hardware. These + * macros assume that 32-bit access is possible, which is true for most + * applications. Projects using 16-bit compilers (the Windows98 display + * driver) and special purpose applications (such as Darwin) need to define + * their own versions of these macros, which typically call a subroutine. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _gfx_defs_h +#define _gfx_defs_h + +/* ACCESS TO THE CPU REGISTERS */ + +#define WRITE_REG8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_regptr + (offset))) = (value) + +#define WRITE_REG16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_regptr + (offset))) = (value) + +#define WRITE_REG32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_regptr + (offset))) = (value) + +#define READ_REG16(offset) \ + (*(volatile unsigned short *)(gfx_virt_regptr + (offset))) + +#define READ_REG32(offset) \ + (*(volatile unsigned long *)(gfx_virt_regptr + (offset))) + +/* ACCESS TO THE ACCELERATOR REGISTERS (REDCLOUD ONLY) */ + +#define WRITE_GP8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_gpptr + (offset))) = (value) + +#define WRITE_GP16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_gpptr + (offset))) = (value) + +#define WRITE_GP32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_gpptr + (offset))) = (value) + +#define READ_GP16(offset) \ + (*(volatile unsigned short *)(gfx_virt_gpptr + (offset))) + +#define READ_GP32(offset) \ + (*(volatile unsigned long *)(gfx_virt_gpptr + (offset))) + +/* ACCESS TO THE FRAME BUFFER */ + +#define WRITE_FB32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_fbptr + (offset))) = (value) + +#define WRITE_FB16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_fbptr + (offset))) = (value) + +#define WRITE_FB8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_fbptr + (offset))) = (value) + +/* ACCESS TO THE VIDEO HARDWARE */ + +#define READ_VID32(offset) \ + (*(volatile unsigned long *)(gfx_virt_vidptr + (offset))) + +#define WRITE_VID32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_vidptr + (offset))) = (value) + +/* ACCESS TO THE VIP HARDWARE */ + +#define READ_VIP32(offset) \ + (*(volatile unsigned long *)(gfx_virt_vipptr + (offset))) + +#define WRITE_VIP32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_vipptr + (offset))) = (value) + +/* ACCESS TO THE SCRATCHPAD RAM */ + +#define WRITE_SCRATCH32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_spptr + (offset))) = (value) + +#define WRITE_SCRATCH16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_spptr + (offset))) = (value) + +#define WRITE_SCRATCH8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_spptr + (offset))) = (value) + +#define READ_SCRATCH16(offset) \ + (*(volatile unsigned short *)(gfx_virt_spptr + (offset))) + +#define READ_SCRATCH32(offset) \ + (*(volatile unsigned long *)(gfx_virt_spptr + (offset))) + +/* ACCESS TO MSRS */ + +void gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow); +void gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow); + +#define MSR_READ( MBD_MSR_CAP, address, valueHigh_ptr, valueLow_ptr ) \ + gfx_msr_asm_read( ((unsigned short)(MBD_MSR_CAP)), address, valueHigh_ptr, valueLow_ptr ) + +#define MSR_WRITE( MBD_MSR_CAP, address, valueHigh_ptr, valueLow_ptr ) \ + gfx_msr_asm_write( ((unsigned short)(MBD_MSR_CAP)), address, valueHigh_ptr, valueLow_ptr ) + +/* OPTIMIZATION MACROS */ +/* The following macros have been added to allow more complete optimization of the */ +/* bitmap-to-screen routines in Durango. These routines also allow Durango to run */ +/* properly within a 16-bit environment. */ + +/************************************************************************************ + * Macro: SET_SCRATCH_BASE + * Purpose: Record the base address of the BLT buffers. The WRITE_SCRATCH_STRINGxx + * macros assume that this address is used as the base for all writes. + * + * Arguments: + * scratch_base - offset into the GX base for the first BLT buffer byte. + ************************************************************************************/ + +#define SET_SCRATCH_BASE(scratch_base) \ + { gfx_gx1_scratch_base = (unsigned long)gfx_virt_spptr + scratch_base; } + +#ifdef GFX_OPTIMIZE_ASSEMBLY + +/************************************************************************************ + * Macro: WRITE_SCRATCH_STRING + * Purpose: Write multiple bytes to the scratchpad buffer + * + * Arguments: + * dword_bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * bytes_extra - number of non-DWORD aligned bytes + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + ************************************************************************************/ + +#define WRITE_SCRATCH_STRING(dwords, bytes, array, array_offset) \ +{ \ + _asm { mov edi, gfx_gx1_scratch_base } \ + _asm { mov esi, array } \ + _asm { add esi, array_offset } \ + _asm { mov ecx, dwords } \ + _asm { shr ecx, 2 } \ + _asm { rep movsd } \ + _asm { mov ecx, bytes } \ + _asm { rep movsb } \ +} + +/************************************************************************************ + * Macro: WRITE_FRAME_BUFFER_STRING32 + * Purpose: Write multiple dwords to the Frame buffer + * + * Arguments: + * fboffset - offset to the beginning frame buffer location. + * bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + ************************************************************************************/ + +#define WRITE_FRAME_BUFFER_STRING32(fboffset, bytes, array, array_offset) \ +{ \ + _asm { mov ecx, bytes } \ + _asm { shr ecx, 2 } \ + _asm { cld } \ + _asm { mov edi, gfx_virt_fbptr } \ + _asm { add edi, fboffset } \ + _asm { mov esi, array } \ + _asm { add esi, array_offset } \ + _asm { rep movsd } \ +} + +#else + +/************************************************************************************ + * Macro: WRITE_SCRATCH_STRING + * Purpose: Write multiple bytes to the scratchpad buffer + * + * Arguments: + * dword_bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * bytes_extra - number of non-DWORD aligned bytes + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + ************************************************************************************/ + +#define WRITE_SCRATCH_STRING(dword_bytes, bytes_extra, array, array_offset) \ +{ \ + unsigned long i, j; \ + unsigned long aroffset = (unsigned long)array + (array_offset); \ + \ + /* WRITE DWORDS */ \ + \ + for (i = 0; i < dword_bytes; i += 4) \ + *((volatile unsigned long *)(gfx_gx1_scratch_base + i)) = *((unsigned long *)(aroffset + i)); \ + \ + /* WRITE BYTES */ \ + \ + j = i + bytes_extra; \ + while (i < j) \ + { \ + *((volatile unsigned char *)(gfx_gx1_scratch_base + i)) = *((unsigned char *)(aroffset + i)); \ + i++; \ + } \ +} + +/************************************************************************************ + * Macro: WRITE_FRAME_BUFFER_STRING32 + * Purpose: Write multiple dwords to the Frame buffer + * + * Arguments: + * fboffset - offset to the beginning frame buffer location. + * bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + ************************************************************************************/ + +#define WRITE_FRAME_BUFFER_STRING32(fboffset, bytes, array, array_offset) \ +{ \ + unsigned long i; \ + unsigned long aroffset = (unsigned long)array + (array_offset); \ + for (i = 0; i < bytes; i += 4) \ + WRITE_FB32 ((fboffset) + i, *((unsigned long *)(aroffset + i))); \ +} + +#endif + +/************************************************************************************ + * Macro: WRITE_FRAME_BUFFER_STRING8 + * Purpose: Write multiple bytes to the frame buffer + * + * Arguments: + * spoffset - offset to the beginning frame buffer location. + * bytes - number of bytes to transfer. This number cannot be modified within the + * macro (ex. bytes -= 4) + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + ************************************************************************************/ + +#define WRITE_FRAME_BUFFER_STRING8(fboffset, bytes, array, array_offset) \ +{ \ + unsigned long i; \ + unsigned long aroffset = (unsigned long)array + (array_offset); \ + for (i = 0; i < bytes; i++) \ + WRITE_FB8 ((fboffset) + i, *((unsigned char *)(aroffset + i))); \ +} + +/************************************************************************************ + * Macro: WRITE_GPREG_STRING32 + * Purpose: Write multiple dwords to one GP register. + * + * Arguments: + * regoffset - Offset of the GP register to be written. + * dwords - number of dwords to transfer. It cannot be modified within the + * macro (ex. dwords--) + * counter - name of a counter variable that can be used in a loop. This + * is used to optimize macros written in C. + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + * temp - name of a temporary variable that can be used for calculations. + * This argument is also used for C-only macros. + ************************************************************************************/ + +#define WRITE_GPREG_STRING32(regoffset, dwords, counter, array, array_offset, temp) \ +{ \ + temp = (unsigned long)array + (array_offset); \ + for (counter = 0; counter < dwords; counter++) \ + WRITE_GP32 (regoffset, *((unsigned long *)temp + counter)); \ +} + +/************************************************************************************ + * Macro: WRITE_GPREG_STRING8 + * Purpose: Write 4 or less bytes to one GP register. + * + * Arguments: + * regoffset - Offset of the GP register to be written. + * bytes - number of bytes to transfer. This number will always. + * be less than 4. It cannot be modified within the + * macro (ex. bytes--) + * shift - name of a shift variable that can be used as a shift count. + * This variable holds the initial shift value into the GP register. + * counter - name of a counter variable that can be used in a loop. This + * is used to optimize macros written in C. + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first character. + * temp1 - name of a temporary variable that can be used for calculations. + * This argument is also used for C-only macros. + * temp2 - name of a temporary variable that can be used for calculations. + * This argument is also used for C-only macros. + ************************************************************************************/ +#define WRITE_GPREG_STRING8(regoffset, bytes, shift, counter, array, array_offset, temp1, temp2) \ +{ \ + if (bytes) \ + { \ + temp1 = (unsigned long)array + (array_offset); \ + temp2 = 0; \ + for (counter = 0; counter < bytes; counter++) \ + { \ + temp2 |= ((unsigned long)(*((unsigned char *)(temp1 + counter)))) << shift; \ + shift += 8; \ + } \ + WRITE_GP32 (regoffset, temp2); \ + } \ +} +#endif /* _gfx_defs_h */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_disp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_disp.c:1.2 --- /dev/null Thu Feb 27 12:31:13 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_disp.c Tue Jan 14 04:34:34 2003 @@ -0,0 +1,2322 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_disp.c,v 1.2 2003/01/14 09:34:34 alanh Exp $ */ +/* + * $Workfile: gfx_disp.c $ + * + * This file contains routines to program the display controller. + * + * The "disp_gu1.c" and "disp_gu2.c" files implement the following routines: + * + * gfx_get_display_mode_count + * gfx_get_display_mode + * gfx_is_display_mode_supported + * gfx_get_display_details + * gfx_set_display_mode + * gfx_set_display_bpp + * gfx_set_display_timings + * gfx_set_vtotal + * gfx_get_display_pitch + * gfx_set_display_pitch + * gfx_set_display_offset + * gfx_set_display_palette + * gfx_set_display_palette_entry + * gfx_set_cursor_enable + * gfx_set_cursor_colors + * gfx_set_cursor_position + * gfx_set_cursor_shape32 + * gfx_set_cursor_shape64 + * gfx_set_icon_enable + * gfx_set_icon_colors + * gfx_set_icon_position + * gfx_set_icon_shape64 + * gfx_set_compression_enable + * gfx_set_compression_offset + * gfx_set_compression_pitch + * gfx_set_compression_size + * gfx_set_display_priority_high + * gfx_test_timing_active + * gfx_test_vertical_active + * gfx_wait_vertical_blank + * gfx_reset_timing_lock + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_hactive + * gfx_get_hblank_start + * gfx_get_hsync_start + * gfx_get_hsync_end + * gfx_get_hblank_end + * gfx_get_htotal + * gfx_get_vactive + * gfx_get_vblank_start + * gfx_get_vsync_start + * gfx_get_vsync_end + * gfx_get_vblank_end + * gfx_get_vtotal + * gfx_get_vline + * gfx_get_display_bpp + * gfx_get_display_offset + * gfx_get_display_palette + * gfx_get_cursor_enable + * gfx_get_cursor_base + * gfx_get_cursor_position + * gfx_get_cursor_offset + * gfx_get_cursor_color + * gfx_get_icon_enable + * gfx_get_icon_color + * gfx_get_icon_offset + * gfx_get_icon_position + * gfx_get_compression_enable + * gfx_get_compression_offset + * gfx_get_compression_pitch + * gfx_get_compression_size + * gfx_get_display_priority_high + * gfx_get_valid_bit + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +unsigned short PanelWidth = 0; +unsigned short PanelHeight = 0; +unsigned short PanelEnable = 0; +unsigned short ModeWidth; +unsigned short ModeHeight; + +int DeltaX = 0; +int DeltaY = 0; +unsigned long prevstartAddr = 0; +unsigned long panelTop = 0; +unsigned long panelLeft = 0; + +int gbpp = 8; + +int gfx_compression_enabled = 0; +int gfx_compression_active = 0; +int gfx_line_double = 0; +int gfx_pixel_double = 0; +int gfx_timing_lock = 0; +DISPLAYMODE gfx_display_mode; + +/* DISPLAY MODE TIMINGS */ + +DISPLAYMODE DisplayParams[] = { + +/* 320 x 200 */ + + {GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_NEG_HSYNC | /* negative HSYNC */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x140, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ + 0x0C8, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, + +/* 320 x 240 */ + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC | /* negative syncs */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0140, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, /* horizontal timings */ + 0x00F0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, + +/* 400 x 300 */ + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0190, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, /* horizontal timings */ + 0x012C, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, /* vertical timings */ + 0x00318000, /* freq = 49.5 MHz */ + }, + +/* 512 x 384 */ + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0200, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, /* horizontal timings */ + 0x0180, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, + +/* 640 x 400 */ + + {GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC, /* negative HSYNC */ + 0x280, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ + 0x190, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, + +/* 640x480 */ + + {GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0288, 0x0290, 0x02E8, 0x0318, 0x0320, /* horizontal timings */ + 0x01E0, 0x01E8, 0x01EA, 0x01EC, 0x0205, 0x020D, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, + + {GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0288, 0x0298, 0x02c0, 0x0338, 0x0340, /* horizontal timings */ + 0x01e0, 0x01e8, 0x01e9, 0x01ec, 0x0200, 0x0208, /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, + + {GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0280, 0x02B8, 0x02F0, 0x0340, 0x0340, /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, /* vertical timings */ + 0x00240000, /* freq = 36.0 MHz */ + }, + +/* 800x600 */ + + {GFX_MODE_56HZ | /* refresh rate = 56 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420, /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, /* vertical timings */ + 0x00240000, /* freq = 36.00 MHz */ + }, + + {GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420, /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, /* vertical timings */ + 0x00280000, /* freq = 40.00 MHz */ + }, + + {GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0358, 0x03D0, 0x0410, 0x0410, /* horizontal timings */ + 0x0258, 0x0258, 0x027D, 0x0283, 0x029A, 0x029A, /* vertical timings */ + 0x00320000, /* freq = 49.5 MHz */ + }, + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, /* vertical timings */ + 0x00318000, /* freq = 49.5 MHz */ + }, + + {GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0340, 0x0380, 0x0418, 0x0418, /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x0277, /* vertical timings */ + 0x00384000, /* freq = 56.25 MHz */ + }, + +/* 1024x768 */ + + {GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, /* horizontal timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, /* vertical timings */ + 0x00410000, /* freq = 65.00 MHz */ + }, + + {GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0530, 0x0530, /* horizontal timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, /* vertical timings */ + 0x004B0000, /* freq = 78.75 MHz */ + }, + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, + + {GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0430, 0x0490, 0x0560, 0x0560, /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0328, 0x0328, /* vertical timings */ + 0x005E8000, /* freq = 94.50 MHz */ + }, + +/* 1152x864 */ + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C0, 0x0540, 0x0640, 0x0640, /* horizontal timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x0384, 0x0384, /* vertical timings */ + 0x006C0000, /* freq = 108.00 MHz */ + }, + +/* 1280x1024 */ + + {GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 16 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698, /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, /* vertical timings */ + 0x006C0000, /* freq = 108.0 MHz */ + }, + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 16 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0510, 0x05A0, 0x0698, 0x0698, /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, /* vertical timings */ + 0x00870000, /* freq = 135.0 MHz */ + }, + + {GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 16 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0540, 0x05E0, 0x06C0, 0x06C0, /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x0430, 0x0430, /* vertical timings */ + 0x009D8000, /* freq = 157.5 MHz */ + }, + +/*********************************/ +/* BEGIN REDCLOUD-SPECIFIC MODES */ +/*-------------------------------*/ + +/* 1600 x 1200 */ + + {GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 32 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0x00A20000, /* freq = 162.0 MHz */ + }, + + {GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 32 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0x00BD0000, /* freq = 189.0 MHz */ + }, + + {GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 32 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0x00CA8000, /* freq = 202.5 MHz */ + }, + + {GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | /* Up to 32 bpp */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0x00E58000, /* freq = 229.5 MHz */ + }, +}; + +/* UPDATE THIS VARIABLE WHENEVER NEW REDCLOUD-SPECIFIC MODES ARE ADDED */ + +#define REDCLOUD_SPECIFIC_MODES 4 + +#define NUM_RC_DISPLAY_MODES sizeof(DisplayParams) / sizeof(DISPLAYMODE) +#define NUM_GX_DISPLAY_MODES (NUM_RC_DISPLAY_MODES - REDCLOUD_SPECIFIC_MODES) + +FIXEDTIMINGS FixedParams[] = { +/* 640x480 Panel */ + {640, 480, 640, 480, + 0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380, + 0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc, + 0x00192CCC, + }, + + {640, 480, 800, 600, + 0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380, + 0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc, + 0x00192CCC, + }, + + {640, 480, 1024, 768, + 0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380, + 0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc, + 0x00192CCC, + }, + + {640, 480, 1152, 864, + 0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380, + 0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc, + 0x00192CCC, + }, + + {640, 480, 1280, 1024, + 0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380, + 0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc, + 0x00192CCC, + }, + + {640, 480, 1600, 1200, + 0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380, + 0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc, + 0x00192CCC, + }, + +/* 800x600 Panel */ + {800, 600, 640, 480, + 0x0280, 0x2d0, 0x2f8, 0x378, 0x3d0, 0x420, + 0x1e0, 0x21c, 0x21d, 0x221, 0x238, 0x274, + 0x00280000, + }, + + {800, 600, 800, 600, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1024, 768, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1152, 864, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1280, 1024, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1600, 1200, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + +/* 1024x768 panel */ + {1024, 768, 640, 480, + 0x0280, 0x340, 0x368, 0x3e8, 0x440, 0x500, + 0x1e0, 0x270, 0x271, 0x275, 0x28c, 0x31c, + 0x00410000, + }, + + {1024, 768, 800, 600, + 0x0320, 0x390, 0x3b8, 0x438, 0x490, 0x500, + 0x258, 0x2ac, 0x2ad, 0x2b1, 0x2c8, 0x31c, + 0x00410000, + }, + + {1024, 768, 1024, 768, + 0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500, + 0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c, + 0x00410000, + }, + + {1024, 768, 1152, 864, + 0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500, + 0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c, + 0x00410000, + }, + + {1024, 768, 1280, 1024, + 0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500, + 0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c, + 0x00410000, + }, + + {1024, 768, 1600, 1200, + 0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500, + 0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c, + 0x00410000, + }, + +}; + +#define NUM_FIXED_TIMINGS_MODES sizeof(FixedParams)/sizeof(FIXEDTIMINGS) + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_DISPLAY_GU1 +#include "disp_gu1.c" +#endif + +/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ + +#if GFX_DISPLAY_GU2 +#include "disp_gu2.c" +#endif + +void gfx_set_display_video_format(unsigned long format); +void gfx_set_display_video_enable(int enable); +void gfx_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, + unsigned long voffset); +void gfx_set_display_video_yuv_pitch(unsigned long ypitch, + unsigned long uvpitch); +void gfx_set_display_video_downscale(unsigned short srch, + unsigned short dsth); +void gfx_set_display_video_vertical_downscale_enable(int enable); +void gfx_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset); +void gfx_get_display_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long gfx_get_display_video_downscale_delta(void); +int gfx_get_display_video_downscale_enable(void); +unsigned long gfx_get_display_video_size(void); +void gfx_set_display_video_size(unsigned short width, unsigned short height); +void gfx_set_display_video_offset(unsigned long offset); +unsigned long gfx_get_display_video_offset(void); + +/*--------------------------------------------------------------------------- + * gfx_reset_timing_lock + * + * This routine resets the timing change lock. The lock can only be set by + * setting a flag when calling mode set. + *--------------------------------------------------------------------------- + */ +void +gfx_reset_timing_lock(void) +{ + gfx_timing_lock = 0; +} + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_DISPLAY_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_set_display_bpp + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_bpp(unsigned short bpp) +{ + int retval = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_display_bpp(bpp); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_display_bpp(bpp); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_is_display_mode_supported + * check if given mode supported, + * return the supported mode on success, -1 on fail + *--------------------------------------------------------------------------- + */ +int +gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) +{ + int retval = -1; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_is_display_mode_supported(xres, yres, bpp, hz); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_is_display_mode_supported(xres, yres, bpp, hz); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_mode + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_mode(int xres, int yres, int bpp, int hz) +{ + int retval = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_display_mode(xres, yres, bpp, hz); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_display_mode(xres, yres, bpp, hz); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_timings + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) +{ + int retval = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_display_timings(bpp, flags, + hactive, hblankstart, hsyncstart, + hsyncend, hblankend, htotal, vactive, + vblankstart, vsyncstart, vsyncend, + vblankend, vtotal, frequency); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_display_timings(bpp, flags, + hactive, hblankstart, hsyncstart, + hsyncend, hblankend, htotal, vactive, + vblankstart, vsyncstart, vsyncend, + vblankend, vtotal, frequency); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_pitch + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_pitch(unsigned short pitch) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_pitch(pitch); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_pitch(pitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_offset + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_offset(unsigned long offset) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_offset(offset); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_offset(offset); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_palette_entry(unsigned long index, unsigned long palette) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_display_palette_entry(index, palette); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_display_palette_entry(index, palette); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_palette(unsigned long *palette) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_display_palette(palette); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_display_palette(palette); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_enable + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_enable(int enable) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_enable(enable); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_enable(enable); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_colors + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_colors(bkcolor, fgcolor); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_colors(bkcolor, fgcolor); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_position + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_position(memoffset, xpos, ypos, xhotspot, yhotspot); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_position(memoffset, xpos, ypos, xhotspot, yhotspot); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape32 + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_shape32(memoffset, andmask, xormask); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_shape32(memoffset, andmask, xormask); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape64 + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_shape64(memoffset, andmask, xormask); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_enable + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_enable(int enable) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_enable(enable); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_colors + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_colors(color0, color1, color2); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_position + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_position(memoffset, xpos); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_shape64 + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask, + unsigned int lines) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_shape64(memoffset, andmask, xormask, lines); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_enable(int enable) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_enable(enable); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_offset + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_offset(unsigned long offset) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_offset(offset); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_offset(offset); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_pitch + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_pitch(unsigned short pitch) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_pitch(pitch); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_pitch(pitch); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_size + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_size(unsigned short size) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_size(size); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_size(size); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_priority_high + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_priority_high(int enable) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_priority_high(enable); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_format (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_format". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_format(unsigned long format) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_format(format); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_enable(int enable) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_video_enable(enable); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_enable(enable); +# endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_size(unsigned short width, unsigned short height) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_video_size(width, height); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_size(width, height); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_offset(unsigned long offset) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_video_offset(offset); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_offset(offset); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_yuv_offsets". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, + unsigned long voffset) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_yuv_offsets(yoffset, uoffset, voffset); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_yuv_pitch". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_yuv_pitch(ypitch, uvpitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_downscale (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_vertical_downscale". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_downscale(srch, dsth); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_vertical_downscale_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_vertical_downscale_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_vertical_downscale_enable(int enable) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_vertical_downscale_enable(enable); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_test_timing_active + *--------------------------------------------------------------------------- + */ +int +gfx_test_timing_active(void) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_test_timing_active(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_test_timing_active(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_test_vertical_active + *--------------------------------------------------------------------------- + */ +int +gfx_test_vertical_active(void) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_test_vertical_active(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_test_vertical_active(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_wait_vertical_blank + *--------------------------------------------------------------------------- + */ +int +gfx_wait_vertical_blank(void) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_wait_vertical_blank(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_wait_vertical_blank(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_delay_milliseconds + *--------------------------------------------------------------------------- + */ +void +gfx_delay_milliseconds(unsigned long milliseconds) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_delay_milliseconds(milliseconds); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_delay_milliseconds(milliseconds); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_delay_microseconds + *--------------------------------------------------------------------------- + */ +void +gfx_delay_microseconds(unsigned long microseconds) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_delay_microseconds(microseconds); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_delay_microseconds(microseconds); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_enable_panning + * + * This routine enables the panning when the Mode is bigger than the panel + * size. + *--------------------------------------------------------------------------- + */ +void +gfx_enable_panning(int x, int y) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_enable_panning(x, y); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_enable_panning(x, y); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_fixed_timings + *--------------------------------------------------------------------------- + */ +int +gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = + gu1_set_fixed_timings(panelResX, panelResY, width, height, bpp); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = + gu2_set_fixed_timings(panelResX, panelResY, width, height, bpp); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_panel_present + *--------------------------------------------------------------------------- + */ +int +gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = + gu1_set_panel_present(panelResX, panelResY, width, height, bpp); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = + gu2_set_panel_present(panelResX, panelResY, width, height, bpp); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vtotal + *--------------------------------------------------------------------------- + */ +int +gfx_set_vtotal(unsigned short vtotal) +{ + int retval = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_vtotal(vtotal); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_vtotal(vtotal); +# endif + return (retval); +} + +/*-----------------------------------------------------------------------* + * THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED: * + * gfx_get_hsync_end, gfx_get_htotal, gfx_get_vsync_end, gfx_get_vtotal * + * are used by the video overlay routines. * + * * + * gfx_get_vline and gfx_vactive are used to prevent an issue for the * + * SC1200. * + * * + * The others are part of the Durango API. * + *-----------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * gfx_mode_frequency_supported + *---------------------------------------------------------------------------- + */ +int +gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +{ + int freq = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + freq = gu1_mode_frequency_supported(xres, yres, bpp, frequency); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + freq = gu2_mode_frequency_supported(xres, yres, bpp, frequency); +# endif + return (freq); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_frequency + *---------------------------------------------------------------------------- + */ +int +gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_get_refreshrate_from_frequency(xres, yres, bpp, hz, frequency); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_refreshrate_from_frequency(xres, yres, bpp, hz, frequency); +# endif + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_mode + *---------------------------------------------------------------------------- + */ +int +gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_get_refreshrate_from_mode(xres, yres, bpp, hz, frequency); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_refreshrate_from_mode(xres, yres, bpp, hz, frequency); +# endif + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frequency_from_refreshrate + *---------------------------------------------------------------------------- + */ +int +gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +{ + int retval = -1; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = + gu1_get_frequency_from_refreshrate(xres, yres, bpp, hz, + frequency); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = + gu2_get_frequency_from_refreshrate(xres, yres, bpp, hz, + frequency); +# endif + + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_supported_pixel_clock + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_max_supported_pixel_clock(void) +{ + unsigned long status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_get_max_supported_pixel_clock(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_get_max_supported_pixel_clock(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_pitch + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_display_pitch(void) +{ + unsigned short pitch = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + pitch = gu1_get_display_pitch(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + pitch = gu2_get_display_pitch(); +# endif + return (pitch); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_mode_count + * return # of modes supported. + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_mode_count(void) +{ + int retval = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_display_mode_count(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_display_mode_count(); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_frame_buffer_line_size + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_frame_buffer_line_size(void) +{ + unsigned long retval = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_frame_buffer_line_size(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_frame_buffer_line_size(); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_mode + * get the curent mode set, + * return the supported mode on success, -1 on fail + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +{ + int retval = -1; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_display_mode(xres, yres, bpp, hz); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_display_mode(xres, yres, bpp, hz); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_details + * given the mode get's the resoultion details, width, height, freq + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +{ + int retval = -1; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_display_details(mode, xres, yres, hz); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_display_details(mode, xres, yres, hz); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hactive + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hactive(void) +{ + unsigned short hactive = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hactive = gu1_get_hactive(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hactive = gu2_get_hactive(); +# endif + return (hactive); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hsync_start(void) +{ + unsigned short hsync_start = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hsync_start = gu1_get_hsync_start(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hsync_start = gu2_get_hsync_start(); +# endif + return (hsync_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hsync_end(void) +{ + unsigned short hsync_end = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hsync_end = gu1_get_hsync_end(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hsync_end = gu2_get_hsync_end(); +# endif + return (hsync_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_htotal + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_htotal(void) +{ + unsigned short htotal = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + htotal = gu1_get_htotal(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + htotal = gu2_get_htotal(); +# endif + return (htotal); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vactive + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vactive(void) +{ + unsigned short vactive = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vactive = gu1_get_vactive(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vactive = gu2_get_vactive(); +# endif + return (vactive); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vsync_end(void) +{ + unsigned short vsync_end = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vsync_end = gu1_get_vsync_end(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vsync_end = gu2_get_vsync_end(); +# endif + return (vsync_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vtotal + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vtotal(void) +{ + unsigned short vtotal = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vtotal = gu1_get_vtotal(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vtotal = gu2_get_vtotal(); +# endif + return (vtotal); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_bpp + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_display_bpp(void) +{ + unsigned short bpp = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + bpp = gu1_get_display_bpp(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + bpp = gu2_get_display_bpp(); +# endif + return (bpp); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vline + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vline(void) +{ + unsigned short vline = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vline = gu1_get_vline(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vline = gu2_get_vline(); +# endif + return (vline); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_offset(void) +{ + unsigned long offset = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_display_offset(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_display_offset(); +# endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_offset(void) +{ + unsigned long base = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + base = gu1_get_cursor_offset(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + base = gu2_get_cursor_offset(); +# endif + return (base); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hblank_start(void) +{ + unsigned short hblank_start = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hblank_start = gu1_get_hblank_start(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hblank_start = gu2_get_hblank_start(); +# endif + return (hblank_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hblank_end(void) +{ + unsigned short hblank_end = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hblank_end = gu1_get_hblank_end(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hblank_end = gu2_get_hblank_end(); +# endif + return (hblank_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vblank_start(void) +{ + unsigned short vblank_start = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vblank_start = gu1_get_vblank_start(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vblank_start = gu2_get_vblank_start(); +# endif + return (vblank_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vsync_start(void) +{ + unsigned short vsync_start = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vsync_start = gu1_get_vsync_start(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vsync_start = gu2_get_vsync_start(); +# endif + return (vsync_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vblank_end(void) +{ + unsigned short vblank_end = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vblank_end = gu1_get_vblank_end(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vblank_end = gu2_get_vblank_end(); +# endif + return (vblank_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_palette_entry(unsigned long index, unsigned long *palette) +{ + int status = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_get_display_palette_entry(index, palette); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_get_display_palette_entry(index, palette); +# endif + + return status; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_palette + *--------------------------------------------------------------------------- + */ +void +gfx_get_display_palette(unsigned long *palette) +{ +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_get_display_palette(palette); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_display_palette(palette); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_enable + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_enable(void) +{ + unsigned long enable = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + enable = gu1_get_cursor_enable(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + enable = gu2_get_cursor_enable(); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_position + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_position(void) +{ + unsigned long position = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + position = gu1_get_cursor_position(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + position = gu2_get_cursor_position(); +# endif + return (position); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_clip + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_clip(void) +{ + unsigned long offset = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_cursor_clip(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_cursor_clip(); +# endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_color + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_color(int index) +{ + unsigned long color = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + color = gu1_get_cursor_color(index); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + color = gu2_get_cursor_color(index); +# endif + return (color); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_enable + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_enable(void) +{ + unsigned long enable = 0; + +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + enable = gu2_get_icon_enable(); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_offset(void) +{ + unsigned long base = 0; + +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + base = gu2_get_icon_offset(); +# endif + + return (base); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_position + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_position(void) +{ + unsigned long position = 0; + +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + position = gu2_get_icon_position(); +# endif + + return (position); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_color + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_color(int index) +{ + unsigned long color = 0; + +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + color = gu2_get_icon_color(index); +# endif + + return (color); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_compression_enable(void) +{ + int enable = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + enable = gu1_get_compression_enable(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + enable = gu2_get_compression_enable(); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_compression_offset(void) +{ + unsigned long offset = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_compression_offset(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_compression_offset(); +# endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_pitch + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_compression_pitch(void) +{ + unsigned short pitch = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + pitch = gu1_get_compression_pitch(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + pitch = gu2_get_compression_pitch(); +# endif + return (pitch); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_size + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_compression_size(void) +{ + unsigned short size = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + size = gu1_get_compression_size(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + size = gu2_get_compression_size(); +# endif + return (size); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_priority_high + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_priority_high(void) +{ + int high = GFX_STATUS_UNSUPPORTED; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + high = gu1_get_display_priority_high(); +# endif + return (high); +} + +/*--------------------------------------------------------------------------- + * gfx_get_valid_bit + *--------------------------------------------------------------------------- + */ +int +gfx_get_valid_bit(int line) +{ + int valid = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + valid = gu1_get_valid_bit(line); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + valid = gu2_get_valid_bit(line); +# endif + return (valid); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_offset(void) +{ + unsigned long offset = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_display_video_offset(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_display_video_offset(); +# endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_offsets + *--------------------------------------------------------------------------- + */ +void +gfx_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_display_video_yuv_offsets(yoffset, uoffset, voffset); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_offsets + *--------------------------------------------------------------------------- + */ +void +gfx_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +{ +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_display_video_yuv_pitch(ypitch, uvpitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_delta + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_downscale_delta(void) +{ + unsigned long ret_value = 0; + +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + ret_value = gu2_get_display_video_downscale_delta(); +# endif + + return ret_value; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_delta + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_video_downscale_enable(void) +{ + int ret_value = 0; + +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + ret_value = gu2_get_display_video_downscale_enable(); +# endif + + return ret_value; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_size + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_size(void) +{ + unsigned long size = 0; + +# if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + size = gu1_get_display_video_size(); +# endif +# if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + size = gu2_get_display_video_size(); +# endif + return (size); +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_DISPLAY_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_i2c.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_i2c.c:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_i2c.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,269 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_i2c.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_i2c.c $ + * + * This file contains routines to write to and read from the I2C bus. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* INCLUDE ROUTINES FOR ACCESS.BUS, IF SPECIFIED */ +/* This is for SC1200 systems. */ + +#if GFX_I2C_ACCESS +#include "i2c_acc.c" +#endif + +/* INCLUDE ROUTINES FOR CS5530 GPIOs, IF SPECIFIED */ +/* This is for GXLV systems that use GPIOs on the CS5530 for I2C. */ + +#if GFX_I2C_GPIO +#include "i2c_gpio.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either ACCESS.bus or GPIO routines. */ + +#if GFX_I2C_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_i2c_reset + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_reset(unsigned char busnum, short adr, char freq) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_reset(busnum, adr, freq); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_reset(busnum, adr, freq); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_select_gpio + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_select_gpio(int clock, int data) +{ +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + acc_i2c_select_gpio(clock, data); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + gpio_i2c_select_gpio(clock, data); +#endif + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_write + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +{ + int status = -1; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_write(busnum, chipadr, subadr, bytes, data); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_write(busnum, chipadr, subadr, bytes, data); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_read + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +{ + int status = -1; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_read(busnum, chipadr, subadr, bytes, data); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_read(busnum, chipadr, subadr, bytes, data); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_init + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_init(void) +{ + int status = -1; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_init(); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_init(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_cleanup + *--------------------------------------------------------------------------- + */ +void +gfx_i2c_cleanup(void) +{ +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + acc_i2c_cleanup(); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + gpio_i2c_cleanup(); +#endif +} + +#endif /* GFX_I2C_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_init.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_init.c:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_init.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,688 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_init.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_init.c $ + * + * This file contains routines typically used in driver initialization. + * + * Routines: + * + * gfx_pci_config_read + * gfx_cpu_config_read + * gfx_detect_cpu + * gfx_detect_video + * gfx_get_cpu_register_base + * gfx_get_frame_buffer_base + * gfx_get_frame_buffer_size + * gfx_get_vid_register_base + * gfx_get_vip_register_base + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* CONSTANTS USED BY THE INITIALIZATION CODE */ + +#define PCI_CONFIG_ADDR 0x0CF8 +#define PCI_CONFIG_DATA 0x0CFC +#define PCI_VENDOR_DEVICE_GXM 0x00011078 +#define PCI_VENDOR_DEVICE_REDCLOUD 0x0028100B +#define REDCLOUD_VIDEO_PCI_VENDOR_DEVICE 0x0030100B + +#define GXM_CONFIG_GCR 0xB8 +#define GXM_CONFIG_CCR3 0xC3 +#define GXM_CONFIG_DIR0 0xFE +#define GXM_CONFIG_DIR1 0xFF + +/* STATIC VARIABLES FOR THIS FILE */ + +unsigned long gfx_cpu_version = 0; +unsigned long gfx_cpu_frequency = 0; +unsigned long gfx_vid_version = 0; +unsigned long gfx_gx1_scratch_base = 0; +unsigned long gfx_gx2_scratch_base = 0x7FC000; +ChipType gfx_chip_revision = CHIP_NOT_DETECTED; + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +ChipType gfx_detect_chip(void); + +#if GFX_INIT_GU1 +#include "init_gu1.c" +#endif + +/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ + +#if GFX_INIT_GU2 +#include "init_gu2.c" +#endif + +/* THE FOLLOWING ROUTINES ARE NEVER DYNAMIC */ +/* They are used to set the variables for future dynamic */ +/* function calls. */ + +/*----------------------------------------------------------------------------- + * gfx_detect_chip + * + * This routine returns the name and revision of the chip. This function is only + * relevant to the SC1200. + *----------------------------------------------------------------------------- + */ +ChipType +gfx_detect_chip(void) +{ + unsigned char pid = INB(SC1200_CB_BASE_ADDR + SC1200_CB_PID); + unsigned char rev = INB(SC1200_CB_BASE_ADDR + SC1200_CB_REV); + + gfx_chip_revision = CHIP_NOT_DETECTED; + + if (pid == 0x4) { + switch (rev) { + case 0: + gfx_chip_revision = SC1200_REV_A; + break; + case 1: + gfx_chip_revision = SC1200_REV_B1_B2; + break; + case 2: + gfx_chip_revision = SC1200_REV_B3; + break; + case 3: + gfx_chip_revision = SC1200_REV_C1; + break; + case 4: + gfx_chip_revision = SC1200_REV_D1; + break; + case 5: + gfx_chip_revision = SC1200_REV_D1_1; + break; + case 6: + gfx_chip_revision = SC1200_REV_D2_MVD; + break; + } + if (rev > 0x6) + gfx_chip_revision = SC1200_FUTURE_REV; + } else if (pid == 0x5) { + if (rev == 0x6) + gfx_chip_revision = SC1200_REV_D2_MVE; + else if (rev > 0x6) + gfx_chip_revision = SC1200_FUTURE_REV; + } + return (gfx_chip_revision); +} + +/*----------------------------------------------------------------------------- + * gfx_detect_cpu + * + * This routine returns the type and revison of the CPU. If a Geode + * processor is not present, the routine returns zero. + * + * The return value is as follows: + * bits[24:16] = minor version + * bits[15:8] = major version + * bits[7:0] = type (1 = GXm, 2 = SC1200, 3 = Redcloud) + * + * A return value of 0x00020501, for example, indicates GXm version 5.2. + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_detect_cpu(void) +{ + + unsigned long value = 0; + unsigned long version = 0; + + /* initialize core freq. to 0 */ + gfx_cpu_frequency = 0; + +#if GFX_INIT_GU1 + + value = gfx_pci_config_read(0x80000000); + + if (value == PCI_VENDOR_DEVICE_GXM) { + unsigned char dir0 = gfx_gxm_config_read(GXM_CONFIG_DIR0) & 0xF0; + unsigned char dir1 = gfx_gxm_config_read(GXM_CONFIG_DIR1); + + if (dir0 == 0x40) { + /* CHECK FOR GXLV (and GXm) (DIR1 = 0x30 THROUGH 0x82) */ + + if ((dir1 >= 0x30) && (dir1 <= 0x82)) { + /* Major version is one less than what appears in DIR1 */ + if ((dir1 & 0xF0) < 0x70) { + + version = GFX_CPU_GXLV | (((((unsigned long)dir1 >> 4) - 1) << 8)) | /* major - 1 */ + ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + } else { + version = GFX_CPU_GXLV | ((((unsigned long)dir1 >> 4)) << 8) | /* major */ + ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + + } + /* Currently always CS5530 for video overlay. */ + +# if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_CS5530; +# endif + + /* Currently always CS5530 GPIOs for I2C access. */ + +# if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +# endif + +# if GFX_TV_DYNAMIC + gfx_tv_type = GFX_TV_TYPE_FS451; +# endif + } + } else if (dir0 == 0xB0) { + /* CHECK FOR SC1200 */ + + if ((dir1 == 0x70) || (dir1 == 0x81)) { + version = GFX_CPU_SC1200 | ((((unsigned long)dir1 >> 4)) << 8) | /* major */ + ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + + /* Detect SC1200 revision */ + + gfx_detect_chip(); + + /* SC1200 for video overlay and VIP. */ + +# if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_SC1200; +# endif + +# if GFX_VIP_DYNAMIC + gfx_vip_type = GFX_VIP_TYPE_SC1200; +# endif + + /* Currently always SAA7114 decoder. */ + +# if GFX_DECODER_DYNAMIC + gfx_decoder_type = GFX_DECODER_TYPE_SAA7114; +# endif + + /* SC1200 for TV encoder */ + +# if GFX_TV_DYNAMIC + gfx_tv_type = GFX_TV_TYPE_SC1200; +# endif + + /* Currently always ACCESS.bus for I2C access. */ + +# if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_ACCESS; +# endif + } + } + + if (version) { + /* ALWAYS FIRST GENERATION GRAPHICS UNIT */ + +# if GFX_DISPLAY_DYNAMIC + gfx_display_type = GFX_DISPLAY_TYPE_GU1; +# endif +# if GFX_2DACCEL_DYNAMIC + gfx_2daccel_type = GFX_2DACCEL_TYPE_GU1; +# endif +# if GFX_INIT_DYNAMIC + gfx_init_type = GFX_INIT_TYPE_GU1; +# endif + + /* READ THE CORE FREQUENCY */ + + gfx_cpu_frequency = gfx_get_core_freq(); + } + } +#endif + +#if GFX_INIT_GU2 + + value = gfx_pci_config_read(0x80000800); + + if (value == PCI_VENDOR_DEVICE_REDCLOUD) { + Q_WORD msr_value; + int valid, i; + + /* CHECK FOR SOFT VG */ + /* If SoftVG is not present, the base addresses for all devices */ + /* will not be allocated. Essentially, it is as if no Redcloud */ + /* video hardware is present. */ + + value = gfx_pci_config_read(0x80000900); + + if (value == REDCLOUD_VIDEO_PCI_VENDOR_DEVICE) { + valid = 1; + + /* BAR0 - BAR3 HOLD THE PERIPHERAL BASE ADDRESSES */ + + for (i = 0; i < 4; i++) { + value = gfx_pci_config_read(0x80000910 + (i << 2)); + if (value == 0x00000000 || value == 0xFFFFFFFF) { + valid = 0; + break; + } + } + + if (valid) { + /* REDCLOUD INTEGRATED VIDEO */ + +# if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD; +# endif + + /* CURRENTLY, ALWAYS GPIO FOR I2C ACCESS */ + +# if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +# endif + + /* SECOND-GENERATION DISPLAY CONTROLLER */ + +# if GFX_DISPLAY_DYNAMIC + gfx_display_type = GFX_DISPLAY_TYPE_GU2; +# endif + + /* SECOND-GENERATION GRAPHICS UNIT */ + +# if GFX_2DACCEL_DYNAMIC + gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2; +# endif + + /* SECOND-GENERATION INITIALIZATION */ + +# if GFX_INIT_DYNAMIC + gfx_init_type = GFX_INIT_TYPE_GU2; +# endif + + /* MBUS MSR ACCESSES */ + +# if GFX_MSR_DYNAMIC + gfx_msr_type = GFX_MSR_TYPE_REDCLOUD; +# endif + + /* CS5530 GPIO I2C */ + +# if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +# endif + + /* READ VERSION */ + + gfx_msr_init(); + + gfx_msr_read(RC_ID_MCP, MCP_RC_REVID, &msr_value); + + /* SUBTRACT 1 FROM REV ID */ + /* REDCLOUD 1.X rev id is 1 less than the reported value */ + + if ((msr_value.low & 0xF0) == 0x10) + msr_value.low--; + + version = GFX_CPU_REDCLOUD | ((msr_value.low & 0xF0) << 4) | /* MAJOR */ + ((msr_value.low & 0x0F) << 16); /* MINOR */ + + /* READ THE CORE FREQUENCY */ + + gfx_cpu_frequency = gfx_get_core_freq(); + + /* SET THE GP SCRATCH AREA */ + /* Color bitmap BLTs use the last 16K of frame buffer space */ + + gfx_gx2_scratch_base = gfx_get_frame_buffer_size() - 0x4000; + } + } + } +#endif + + if (!version) { + /* ALWAYS SECOND GENERATION IF SIMULATING */ + /* For now, that is. This could change. */ + +# if GFX_DISPLAY_DYNAMIC + gfx_display_type = GFX_DISPLAY_TYPE_GU2; +# endif +# if GFX_2DACCEL_DYNAMIC + gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2; +# endif +# if GFX_INIT_DYNAMIC + gfx_init_type = GFX_INIT_TYPE_GU2; +# endif +# if GFX_MSR_DYNAMIC + gfx_msr_type = GFX_MSR_TYPE_REDCLOUD; +# endif +# if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD; +# endif +# if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +# endif + } + gfx_cpu_version = version; + + return (version); +} + +/*----------------------------------------------------------------------------- + * gfx_detect_video + * + * This routine returns the type of the video hardware. + * + * The return value is as follows: + * bits[7:0] = type (1 = CS5530, 2 = SC1200, 3 = Redcloud) + * + * Currently this routine does not actually detect any hardware, and bases + * the video hardware entirely on the detected CPU. + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_detect_video(void) +{ + unsigned long version = 0; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_GXLV) + version = GFX_VID_CS5530; + else if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) + version = GFX_VID_SC1200; + else if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) + version = GFX_VID_REDCLOUD; + gfx_vid_version = version; + return (version); +} + +/*----------------------------------------------------------------------------- + * gfx_pci_config_read + * + * This routine reads a 32-bit value from the specified location in PCI + * configuration space. + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_pci_config_read(unsigned long address) +{ + unsigned long value = 0xFFFFFFFF; + + OUTD(PCI_CONFIG_ADDR, address); + value = IND(PCI_CONFIG_DATA); + return (value); +} + +/*----------------------------------------------------------------------------- + * gfx_pci_config_write + * + * This routine writes a 32-bit value to the specified location in PCI + * configuration space. + *----------------------------------------------------------------------------- + */ +void +gfx_pci_config_write(unsigned long address, unsigned long data) +{ + OUTD(PCI_CONFIG_ADDR, address); + OUTD(PCI_CONFIG_DATA, data); + return; +} + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_INIT_DYNAMIC + +/*----------------------------------------------------------------------------- + * gfx_get_core_freq + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_core_freq(void) +{ + unsigned long freq = 0; + +# if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + freq = gu1_get_core_freq(); +# endif +# if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + freq = gu2_get_core_freq(); +# endif + return freq; +} + +/*----------------------------------------------------------------------------- + * gfx_get_cpu_register_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cpu_register_base(void) +{ + unsigned long base = 0; + +# if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_cpu_register_base(); +# endif +# if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_cpu_register_base(); +# endif + + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_graphics_register_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_graphics_register_base(void) +{ + unsigned long base = 0; + +# if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_graphics_register_base(); +# endif + + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_frame_buffer_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_frame_buffer_base(void) +{ + unsigned long base = 0; + +# if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_frame_buffer_base(); +# endif +# if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_frame_buffer_base(); +# endif + + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_frame_buffer_size + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_frame_buffer_size(void) +{ + unsigned long size = 0; + +# if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + size = gu1_get_frame_buffer_size(); +# endif +# if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + size = gu2_get_frame_buffer_size(); +# endif + + return size; +} + +/*----------------------------------------------------------------------------- + * gfx_get_vid_register_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vid_register_base(void) +{ + unsigned long base = 0; + +# if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_vid_register_base(); +# endif +# if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_vid_register_base(); +# endif + + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_register_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vip_register_base(void) +{ + unsigned long base = 0; + +# if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_vip_register_base(); +# endif + + return (base); +} + +#endif + +/* END OF FILE */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_mode.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_mode.h:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_mode.h Tue Dec 10 10:12:25 2002 @@ -0,0 +1,226 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_mode.h,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_mode.h $ + * + * This header file contains the mode tables. It is used by the "gfx_disp.c" + * file to set a display mode. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _gfx_mode_h +#define _gfx_mode_h + +/* MODE FLAGS (BITWISE-OR) */ + +#define GFX_MODE_8BPP 0x00000001 +#define GFX_MODE_12BPP 0x00000002 +#define GFX_MODE_15BPP 0x00000004 +#define GFX_MODE_16BPP 0x00000008 +#define GFX_MODE_24BPP 0x00000010 +#define GFX_MODE_56HZ 0x00000020 +#define GFX_MODE_60HZ 0x00000040 +#define GFX_MODE_70HZ 0x00000080 +#define GFX_MODE_72HZ 0x00000100 +#define GFX_MODE_75HZ 0x00000200 +#define GFX_MODE_85HZ 0x00000400 +#define GFX_MODE_NEG_HSYNC 0x00000800 +#define GFX_MODE_NEG_VSYNC 0x00001000 +#define GFX_MODE_PIXEL_DOUBLE 0x00002000 +#define GFX_MODE_LINE_DOUBLE 0x00004000 +#define GFX_MODE_TV_NTSC 0x00008000 +#define GFX_MODE_TV_PAL 0x00010000 + +#define GFX_MODE_LOCK_TIMING 0x10000000 + +/* STRUCTURE DEFINITION */ + +typedef struct tagDISPLAYMODE +{ + /* DISPLAY MODE FLAGS */ + /* Specify valid color depths and the refresh rate. */ + + unsigned long flags; + + /* TIMINGS */ + + unsigned short hactive; + unsigned short hblankstart; + unsigned short hsyncstart; + unsigned short hsyncend; + unsigned short hblankend; + unsigned short htotal; + + unsigned short vactive; + unsigned short vblankstart; + unsigned short vsyncstart; + unsigned short vsyncend; + unsigned short vblankend; + unsigned short vtotal; + + /* CLOCK FREQUENCY */ + + unsigned long frequency; + +} +DISPLAYMODE; + +/* For Fixed timings */ +typedef struct tagFIXEDTIMINGS +{ + /* DISPLAY MODE FLAGS */ + /* Specify valid color depths and the refresh rate. */ + + int panelresx; + int panelresy; + unsigned short xres; + unsigned short yres; + + /* TIMINGS */ + + unsigned short hactive; + unsigned short hblankstart; + unsigned short hsyncstart; + unsigned short hsyncend; + unsigned short hblankend; + unsigned short htotal; + + unsigned short vactive; + unsigned short vblankstart; + unsigned short vsyncstart; + unsigned short vsyncend; + unsigned short vblankend; + unsigned short vtotal; + + /* CLOCK FREQUENCY */ + + unsigned long frequency; + +} +FIXEDTIMINGS; + +#endif /* !_gfx_mode_h */ + +/* END OF FILE */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_msr.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_msr.c:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_msr.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,253 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_msr.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_msr.c $ + * + * This file contains routines to read machine-specific registers (MSRs) + * + * Routines: + * + * gfx_msr_init + * gfx_id_msr_device + * gfx_get_msr_dev_address + * gfx_get_glink_id_at_address + * gfx_msr_read + * gfx_msr_write + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* INCLUDE SUPPORT FOR REDCLOUD, IF SPECIFIED */ + +#if GFX_MSR_REDCLOUD +#include "msr_rdcl.c" +#endif + +/* EXTRA WRAPPERS FOR DYNAMIC SELECTION */ + +#if GFX_MSR_DYNAMIC + +/*----------------------------------------------------------------------------- + * gfx_msr_init + *----------------------------------------------------------------------------- + */ +int +gfx_msr_init() +{ + int ret_value = 0; + +# if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_msr_init(); +# endif + + return ret_value; +} + +/*----------------------------------------------------------------------------- + * gfx_id_msr_device + *----------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_id_msr_device(MSR * pDev, unsigned long address) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +# if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_id_msr_device(pDev, address); +# endif + + return ret_value; +} + +/*----------------------------------------------------------------------------- + * gfx_get_msr_dev_address + *----------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_get_msr_dev_address(unsigned int device, unsigned long *address) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +# if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_get_msr_dev_address(device, address); +# endif + + return ret_value; +} + +/*----------------------------------------------------------------------------- + * gfx_get_glink_id_at_address + *----------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_get_glink_id_at_address(unsigned int *device, unsigned long address) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +# if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_get_glink_id_at_address(device, address); +# endif + + return ret_value; +} + +/*----------------------------------------------------------------------------- + * gfx_msr_read + *----------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +# if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_msr_read(device, msrRegister, msrValue); +# endif + + return ret_value; +} + +/*----------------------------------------------------------------------------- + * gfx_msr_write + *----------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +# if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_msr_write(device, msrRegister, msrValue); +# endif + + return ret_value; +} + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_regs.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_regs.h:1.2 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_regs.h Wed Feb 5 13:38:43 2003 @@ -0,0 +1,1358 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_regs.h,v 1.2 2003/02/05 18:38:43 alanh Exp $ */ +/* + * $Workfile: gfx_regs.h $ + * + * This header file contains the graphics register definitions. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/*----------------------------------*/ +/* FIRST GENERATION GRAPHICS UNIT */ +/*----------------------------------*/ + +#define GP_DST_XCOOR 0x8100 /* x destination origin */ +#define GP_DST_YCOOR 0x8102 /* y destination origin */ +#define GP_WIDTH 0x8104 /* pixel width */ +#define GP_HEIGHT 0x8106 /* pixel height */ +#define GP_SRC_XCOOR 0x8108 /* x source origin */ +#define GP_SRC_YCOOR 0x810A /* y source origin */ + +#define GP_VECTOR_LENGTH 0x8104 /* vector length */ +#define GP_INIT_ERROR 0x8106 /* vector initial error */ +#define GP_AXIAL_ERROR 0x8108 /* axial error increment */ +#define GP_DIAG_ERROR 0x810A /* diagonal error increment */ + +#define GP_SRC_COLOR_0 0x810C /* source color 0 */ +#define GP_SRC_COLOR_1 0x810E /* source color 1 */ +#define GP_PAT_COLOR_0 0x8110 /* pattern color 0 */ +#define GP_PAT_COLOR_1 0x8112 /* pattern color 1 */ +#define GP_PAT_COLOR_2 0x8114 /* pattern color 2 */ +#define GP_PAT_COLOR_3 0x8116 /* pattern color 3 */ +#define GP_PAT_DATA_0 0x8120 /* bits 31:0 of pattern */ +#define GP_PAT_DATA_1 0x8124 /* bits 63:32 of pattern */ +#define GP_PAT_DATA_2 0x8128 /* bits 95:64 of pattern */ +#define GP_PAT_DATA_3 0x812C /* bits 127:96 of pattern */ + +#define GP_VGA_WRITE 0x8140 /* VGA write path control */ +#define GP_VGA_READ 0x8144 /* VGA read path control */ + +#define GP_RASTER_MODE 0x8200 /* raster operation */ +#define GP_VECTOR_MODE 0x8204 /* vector mode register */ +#define GP_BLIT_MODE 0x8208 /* blit mode register */ +#define GP_BLIT_STATUS 0x820C /* blit status register */ + +#define GP_VGA_BASE 0x8210 /* VGA memory offset (x64K) */ +#define GP_VGA_LATCH 0x8214 /* VGA display latch */ + +/* "GP_VECTOR_MODE" BIT DEFINITIONS */ + +#define VM_X_MAJOR 0x0000 /* X major vector */ +#define VM_Y_MAJOR 0x0001 /* Y major vector */ +#define VM_MAJOR_INC 0x0002 /* positive major axis step */ +#define VM_MINOR_INC 0x0004 /* positive minor axis step */ +#define VM_READ_DST_FB 0x0008 /* read destination data */ + +/* "GP_RASTER_MODE" BIT DEFINITIONS */ + +#define RM_PAT_DISABLE 0x0000 /* pattern is disabled */ +#define RM_PAT_MONO 0x0100 /* 1BPP pattern expansion */ +#define RM_PAT_DITHER 0x0200 /* 2BPP pattern expansion */ +#define RM_PAT_COLOR 0x0300 /* 8BPP or 16BPP pattern */ +#define RM_PAT_MASK 0x0300 /* mask for pattern mode */ +#define RM_PAT_TRANSPARENT 0x0400 /* transparent 1BPP pattern */ +#define RM_SRC_TRANSPARENT 0x0800 /* transparent 1BPP source */ + +/* "GP_BLIT_STATUS" BIT DEFINITIONS */ + +#define BS_BLIT_BUSY 0x0001 /* blit engine is busy */ +#define BS_PIPELINE_BUSY 0x0002 /* graphics pipeline is busy */ +#define BS_BLIT_PENDING 0x0004 /* blit pending */ +#define BC_FLUSH 0x0080 /* flush pipeline requests */ +#define BC_8BPP 0x0000 /* 8BPP mode */ +#define BC_16BPP 0x0100 /* 16BPP mode */ +#define BC_FB_WIDTH_1024 0x0000 /* framebuffer width = 1024 */ +#define BC_FB_WIDTH_2048 0x0200 /* framebuffer width = 2048 */ +#define BC_FB_WIDTH_4096 0x0400 /* framebuffer width = 4096 */ + +/* "GP_BLIT_MODE" BIT DEFINITIONS */ + +#define BM_READ_SRC_NONE 0x0000 /* source foreground color */ +#define BM_READ_SRC_FB 0x0001 /* read source from FB */ +#define BM_READ_SRC_BB0 0x0002 /* read source from BB0 */ +#define BM_READ_SRC_BB1 0x0003 /* read source from BB1 */ +#define BM_READ_SRC_MASK 0x0003 /* read source mask */ + +#define BM_READ_DST_NONE 0x0000 /* no destination data */ +#define BM_READ_DST_BB0 0x0008 /* destination from BB0 */ +#define BM_READ_DST_BB1 0x000C /* destination from BB1 */ +#define BM_READ_DST_FB0 0x0010 /* dest from FB (store BB0) */ +#define BM_READ_DST_FB1 0x0014 /* dest from FB (store BB1) */ +#define BM_READ_DST_MASK 0x001C /* read destination mask */ + +#define BM_WRITE_FB 0x0000 /* write to framebuffer */ +#define BM_WRITE_MEM 0x0020 /* write to memory */ +#define BM_WRITE_MASK 0x0020 /* write mask */ + +#define BM_SOURCE_COLOR 0x0000 /* source is 8BPP or 16BPP */ +#define BM_SOURCE_EXPAND 0x0040 /* source is 1BPP */ +#define BM_SOURCE_TEXT 0x00C0 /* source is 1BPP text */ +#define BM_SOURCE_MASK 0x00C0 /* source mask */ + +#define BM_REVERSE_Y 0x0100 /* reverse Y direction */ + +/*---------------------------------------*/ +/* FIRST GENERATION DISPLAY CONTROLLER */ +/*---------------------------------------*/ + +#define DC_UNLOCK 0x8300 /* lock register */ +#define DC_GENERAL_CFG 0x8304 /* config registers... */ +#define DC_TIMING_CFG 0x8308 +#define DC_OUTPUT_CFG 0x830C + +#define DC_FB_ST_OFFSET 0x8310 /* framebuffer start offset */ +#define DC_CB_ST_OFFSET 0x8314 /* compression start offset */ +#define DC_CURS_ST_OFFSET 0x8318 /* cursor start offset */ +#define DC_ICON_ST_OFFSET 0x831C /* icon start offset */ +#define DC_VID_ST_OFFSET 0x8320 /* video start offset */ +#define DC_LINE_DELTA 0x8324 /* fb and cb skip counts */ +#define DC_BUF_SIZE 0x8328 /* fb and cb line size */ + +#define DC_H_TIMING_1 0x8330 /* horizontal timing... */ +#define DC_H_TIMING_2 0x8334 +#define DC_H_TIMING_3 0x8338 +#define DC_FP_H_TIMING 0x833C + +#define DC_V_TIMING_1 0x8340 /* vertical timing... */ +#define DC_V_TIMING_2 0x8344 +#define DC_V_TIMING_3 0x8348 +#define DC_FP_V_TIMING 0x834C + +#define DC_CURSOR_X 0x8350 /* cursor x position */ +#define DC_ICON_X 0x8354 /* HACK - 1.3 definition */ +#define DC_V_LINE_CNT 0x8354 /* vertical line counter */ +#define DC_CURSOR_Y 0x8358 /* cursor y position */ +#define DC_ICON_Y 0x835C /* HACK - 1.3 definition */ +#define DC_SS_LINE_CMP 0x835C /* line compare value */ +#define DC_CURSOR_COLOR 0x8360 /* cursor colors */ +#define DC_ICON_COLOR 0x8364 /* icon colors */ +#define DC_BORDER_COLOR 0x8368 /* border color */ +#define DC_PAL_ADDRESS 0x8370 /* palette address */ +#define DC_PAL_DATA 0x8374 /* palette data */ +#define DC_DFIFO_DIAG 0x8378 /* display FIFO diagnostic */ +#define DC_CFIFO_DIAG 0x837C /* compression FIF0 diagnostic */ + +/* PALETTE LOCATIONS */ + +#define PAL_CURSOR_COLOR_0 0x100 +#define PAL_CURSOR_COLOR_1 0x101 +#define PAL_ICON_COLOR_0 0x102 +#define PAL_ICON_COLOR_1 0x103 +#define PAL_OVERSCAN_COLOR 0x104 + +/* UNLOCK VALUE */ + +#define DC_UNLOCK_VALUE 0x00004758 /* used to unlock DC regs */ + +/* "DC_GENERAL_CFG" BIT DEFINITIONS */ + +#define DC_GCFG_DFLE 0x00000001 /* display FIFO load enable */ +#define DC_GCFG_CURE 0x00000002 /* cursor enable */ +#define DC_GCFG_VCLK_DIV 0x00000004 /* vid clock divisor */ +#define DC_GCFG_PLNO 0x00000004 /* planar offset LSB */ +#define DC_GCFG_PPC 0x00000008 /* pixel pan compatibility */ +#define DC_GCFG_CMPE 0x00000010 /* compression enable */ +#define DC_GCFG_DECE 0x00000020 /* decompression enable */ +#define DC_GCFG_DCLK_MASK 0x000000C0 /* dotclock multiplier */ +#define DC_GCFG_DCLK_POS 6 /* dotclock multiplier */ +#define DC_GCFG_DFHPSL_MASK 0x00000F00 /* FIFO high-priority start */ +#define DC_GCFG_DFHPSL_POS 8 /* FIFO high-priority start */ +#define DC_GCFG_DFHPEL_MASK 0x0000F000 /* FIFO high-priority end */ +#define DC_GCFG_DFHPEL_POS 12 /* FIFO high-priority end */ +#define DC_GCFG_CIM_MASK 0x00030000 /* compressor insert mode */ +#define DC_GCFG_CIM_POS 16 /* compressor insert mode */ +#define DC_GCFG_FDTY 0x00040000 /* frame dirty mode */ +#define DC_GCFG_RTPM 0x00080000 /* real-time perf. monitor */ +#define DC_GCFG_DAC_RS_MASK 0x00700000 /* DAC register selects */ +#define DC_GCFG_DAC_RS_POS 20 /* DAC register selects */ +#define DC_GCFG_CKWR 0x00800000 /* clock write */ +#define DC_GCFG_LDBL 0x01000000 /* line double */ +#define DC_GCFG_DIAG 0x02000000 /* FIFO diagnostic mode */ +#define DC_GCFG_CH4S 0x04000000 /* sparse refresh mode */ +#define DC_GCFG_SSLC 0x08000000 /* enable line compare */ +#define DC_GCFG_VIDE 0x10000000 /* video enable */ +#define DC_GCFG_DFCK 0x20000000 /* divide flat-panel clock - rev 2.3 down */ +#define DC_GCFG_VRDY 0x20000000 /* video port speed - rev 2.4 up */ +#define DC_GCFG_DPCK 0x40000000 /* divide pixel clock */ +#define DC_GCFG_DDCK 0x80000000 /* divide dot clock */ + +/* "DC_TIMING_CFG" BIT DEFINITIONS */ + +#define DC_TCFG_FPPE 0x00000001 /* flat-panel power enable */ +#define DC_TCFG_HSYE 0x00000002 /* horizontal sync enable */ +#define DC_TCFG_VSYE 0x00000004 /* vertical sync enable */ +#define DC_TCFG_BLKE 0x00000008 /* blank enable */ +#define DC_TCFG_DDCK 0x00000010 /* DDC clock */ +#define DC_TCFG_TGEN 0x00000020 /* timing generator enable */ +#define DC_TCFG_VIEN 0x00000040 /* vertical interrupt enable */ +#define DC_TCFG_BLNK 0x00000080 /* blink enable */ +#define DC_TCFG_CHSP 0x00000100 /* horizontal sync polarity */ +#define DC_TCFG_CVSP 0x00000200 /* vertical sync polarity */ +#define DC_TCFG_FHSP 0x00000400 /* panel horz sync polarity */ +#define DC_TCFG_FVSP 0x00000800 /* panel vert sync polarity */ +#define DC_TCFG_FCEN 0x00001000 /* flat-panel centering */ +#define DC_TCFG_CDCE 0x00002000 /* HACK - 1.3 definition */ +#define DC_TCFG_PLNR 0x00002000 /* planar mode enable */ +#define DC_TCFG_INTL 0x00004000 /* interlace scan */ +#define DC_TCFG_PXDB 0x00008000 /* pixel double */ +#define DC_TCFG_BKRT 0x00010000 /* blink rate */ +#define DC_TCFG_PSD_MASK 0x000E0000 /* power sequence delay */ +#define DC_TCFG_PSD_POS 17 /* power sequence delay */ +#define DC_TCFG_DDCI 0x08000000 /* DDC input (RO) */ +#define DC_TCFG_SENS 0x10000000 /* monitor sense (RO) */ +#define DC_TCFG_DNA 0x20000000 /* display not active (RO) */ +#define DC_TCFG_VNA 0x40000000 /* vertical not active (RO) */ +#define DC_TCFG_VINT 0x80000000 /* vertical interrupt (RO) */ + +/* "DC_OUTPUT_CFG" BIT DEFINITIONS */ + +#define DC_OCFG_8BPP 0x00000001 /* 8/16 bpp select */ +#define DC_OCFG_555 0x00000002 /* 16 bpp format */ +#define DC_OCFG_PCKE 0x00000004 /* PCLK enable */ +#define DC_OCFG_FRME 0x00000008 /* frame rate mod enable */ +#define DC_OCFG_DITE 0x00000010 /* dither enable */ +#define DC_OCFG_2PXE 0x00000020 /* 2 pixel enable */ +#define DC_OCFG_2XCK 0x00000040 /* 2 x pixel clock */ +#define DC_OCFG_2IND 0x00000080 /* 2 index enable */ +#define DC_OCFG_34ADD 0x00000100 /* 3- or 4-bit add */ +#define DC_OCFG_FRMS 0x00000200 /* frame rate mod select */ +#define DC_OCFG_CKSL 0x00000400 /* clock select */ +#define DC_OCFG_PRMP 0x00000800 /* palette re-map */ +#define DC_OCFG_PDEL 0x00001000 /* panel data enable low */ +#define DC_OCFG_PDEH 0x00002000 /* panel data enable high */ +#define DC_OCFG_CFRW 0x00004000 /* comp line buffer r/w sel */ +#define DC_OCFG_DIAG 0x00008000 /* comp line buffer diag */ + +#define MC_MEM_CNTRL1 0x00008400 +#define MC_DR_ADD 0x00008418 +#define MC_DR_ACC 0x0000841C + +/* MC_MEM_CNTRL1 BIT DEFINITIONS */ + +#define MC_XBUSARB 0x00000008 /* 0 = GP priority < CPU priority */ + /* 1 = GP priority = CPU priority */ + /* GXm databook V2.0 is wrong ! */ +/*----------*/ +/* CS5530 */ +/*----------*/ + +/* CS5530 REGISTER DEFINITIONS */ + +#define CS5530_VIDEO_CONFIG 0x0000 +#define CS5530_DISPLAY_CONFIG 0x0004 +#define CS5530_VIDEO_X_POS 0x0008 +#define CS5530_VIDEO_Y_POS 0x000C +#define CS5530_VIDEO_SCALE 0x0010 +#define CS5530_VIDEO_COLOR_KEY 0x0014 +#define CS5530_VIDEO_COLOR_MASK 0x0018 +#define CS5530_PALETTE_ADDRESS 0x001C +#define CS5530_PALETTE_DATA 0x0020 +#define CS5530_DOT_CLK_CONFIG 0x0024 +#define CS5530_CRCSIG_TFT_TV 0x0028 + +/* "CS5530_VIDEO_CONFIG" BIT DEFINITIONS */ + +#define CS5530_VCFG_VID_EN 0x00000001 +#define CS5530_VCFG_VID_REG_UPDATE 0x00000002 +#define CS5530_VCFG_VID_INP_FORMAT 0x0000000C +#define CS5530_VCFG_8_BIT_4_2_0 0x00000004 +#define CS5530_VCFG_16_BIT_4_2_0 0x00000008 +#define CS5530_VCFG_GV_SEL 0x00000010 +#define CS5530_VCFG_CSC_BYPASS 0x00000020 +#define CS5530_VCFG_X_FILTER_EN 0x00000040 +#define CS5530_VCFG_Y_FILTER_EN 0x00000080 +#define CS5530_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define CS5530_VCFG_INIT_READ_MASK 0x01FF0000 +#define CS5530_VCFG_EARLY_VID_RDY 0x02000000 +#define CS5530_VCFG_LINE_SIZE_UPPER 0x08000000 +#define CS5530_VCFG_4_2_0_MODE 0x10000000 +#define CS5530_VCFG_16_BIT_EN 0x20000000 +#define CS5530_VCFG_HIGH_SPD_INT 0x40000000 + +/* "CS5530_DISPLAY_CONFIG" BIT DEFINITIONS */ + +#define CS5530_DCFG_DIS_EN 0x00000001 +#define CS5530_DCFG_HSYNC_EN 0x00000002 +#define CS5530_DCFG_VSYNC_EN 0x00000004 +#define CS5530_DCFG_DAC_BL_EN 0x00000008 +#define CS5530_DCFG_DAC_PWDNX 0x00000020 +#define CS5530_DCFG_FP_PWR_EN 0x00000040 +#define CS5530_DCFG_FP_DATA_EN 0x00000080 +#define CS5530_DCFG_CRT_HSYNC_POL 0x00000100 +#define CS5530_DCFG_CRT_VSYNC_POL 0x00000200 +#define CS5530_DCFG_FP_HSYNC_POL 0x00000400 +#define CS5530_DCFG_FP_VSYNC_POL 0x00000800 +#define CS5530_DCFG_XGA_FP 0x00001000 +#define CS5530_DCFG_FP_DITH_EN 0x00002000 +#define CS5530_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define CS5530_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define CS5530_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define CS5530_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define CS5530_DCFG_VG_CK 0x00100000 +#define CS5530_DCFG_GV_PAL_BYP 0x00200000 +#define CS5530_DCFG_DDC_SCL 0x00400000 +#define CS5530_DCFG_DDC_SDA 0x00800000 +#define CS5530_DCFG_DDC_OE 0x01000000 +#define CS5530_DCFG_16_BIT_EN 0x02000000 + +/*----------*/ +/* SC1200 */ +/*----------*/ + +/* SC1200 VIDEO REGISTER DEFINITIONS */ + +#define SC1200_VIDEO_CONFIG 0x000 +#define SC1200_DISPLAY_CONFIG 0x004 +#define SC1200_VIDEO_X_POS 0x008 +#define SC1200_VIDEO_Y_POS 0x00C +#define SC1200_VIDEO_UPSCALE 0x010 +#define SC1200_VIDEO_COLOR_KEY 0x014 +#define SC1200_VIDEO_COLOR_MASK 0x018 +#define SC1200_PALETTE_ADDRESS 0x01C +#define SC1200_PALETTE_DATA 0x020 +#define SC1200_VID_MISC 0x028 +#define SC1200_VID_CLOCK_SELECT 0x02C +#define SC1200_VIDEO_DOWNSCALER_CONTROL 0x03C +#define SC1200_VIDEO_DOWNSCALER_COEFFICIENTS 0x40 +#define SC1200_VID_CRC 0x044 +#define SC1200_DEVICE_ID 0x048 +#define SC1200_VID_ALPHA_CONTROL 0x04C +#define SC1200_CURSOR_COLOR_KEY 0x050 +#define SC1200_CURSOR_COLOR_MASK 0x054 +#define SC1200_CURSOR_COLOR_1 0x058 +#define SC1200_CURSOR_COLOR_2 0x05C +#define SC1200_ALPHA_XPOS_1 0x060 +#define SC1200_ALPHA_YPOS_1 0x064 +#define SC1200_ALPHA_COLOR_1 0x068 +#define SC1200_ALPHA_CONTROL_1 0x06C +#define SC1200_ALPHA_XPOS_2 0x070 +#define SC1200_ALPHA_YPOS_2 0x074 +#define SC1200_ALPHA_COLOR_2 0x078 +#define SC1200_ALPHA_CONTROL_2 0x07C +#define SC1200_ALPHA_XPOS_3 0x080 +#define SC1200_ALPHA_YPOS_3 0x084 +#define SC1200_ALPHA_COLOR_3 0x088 +#define SC1200_ALPHA_CONTROL_3 0x08C +#define SC1200_VIDEO_REQUEST 0x090 +#define SC1200_ALPHA_WATCH 0x094 +#define SC1200_VIDEO_DISPLAY_MODE 0x400 +#define SC1200_VIDEO_ODD_VBI_LINE_ENABLE 0x40C +#define SC1200_VIDEO_EVEN_VBI_LINE_ENABLE 0x410 +#define SC1200_VIDEO_VBI_HORIZ_CONTROL 0x414 +#define SC1200_VIDEO_ODD_VBI_TOTAL_COUNT 0x418 +#define SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT 0x41C +#define SC1200_GENLOCK 0x420 +#define SC1200_GENLOCK_DELAY 0x424 +#define SC1200_TVOUT_HORZ_TIM 0x800 +#define SC1200_TVOUT_HORZ_SYNC 0x804 +#define SC1200_TVOUT_VERT_SYNC 0x808 +#define SC1200_TVOUT_LINE_END 0x80C +#define SC1200_TVOUT_VERT_DOWNSCALE 0x810 /* REV. A & B */ +#define SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE 0x810 /* REV. C */ +#define SC1200_TVOUT_HORZ_SCALING 0x814 +#define SC1200_TVOUT_DEBUG 0x818 +#define SC1200_TVENC_TIM_CTRL_1 0xC00 +#define SC1200_TVENC_TIM_CTRL_2 0xC04 +#define SC1200_TVENC_TIM_CTRL_3 0xC08 +#define SC1200_TVENC_SUB_FREQ 0xC0C +#define SC1200_TVENC_DISP_POS 0xC10 +#define SC1200_TVENC_DISP_SIZE 0xC14 +#define SC1200_TVENC_CC_DATA 0xC18 +#define SC1200_TVENC_EDS_DATA 0xC1C +#define SC1200_TVENC_CGMS_DATA 0xC20 +#define SC1200_TVENC_WSS_DATA 0xC24 +#define SC1200_TVENC_CC_CONTROL 0xC28 +#define SC1200_TVENC_DAC_CONTROL 0xC2C +#define SC1200_TVENC_MV_CONTROL 0xC30 + +/* "SC1200_VIDEO_CONFIG" BIT DEFINITIONS */ + +#define SC1200_VCFG_VID_EN 0x00000001 +#define SC1200_VCFG_VID_INP_FORMAT 0x0000000C +#define SC1200_VCFG_UYVY_FORMAT 0x00000000 +#define SC1200_VCFG_Y2YU_FORMAT 0x00000004 +#define SC1200_VCFG_YUYV_FORMAT 0x00000008 +#define SC1200_VCFG_YVYU_FORMAT 0x0000000C +#define SC1200_VCFG_X_FILTER_EN 0x00000040 +#define SC1200_VCFG_Y_FILTER_EN 0x00000080 +#define SC1200_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define SC1200_VCFG_INIT_READ_MASK 0x01FF0000 +#define SC1200_VCFG_LINE_SIZE_UPPER 0x08000000 +#define SC1200_VCFG_4_2_0_MODE 0x10000000 + +/* "SC1200_DISPLAY_CONFIG" BIT DEFINITIONS */ + +#define SC1200_DCFG_DIS_EN 0x00000001 +#define SC1200_DCFG_HSYNC_EN 0x00000002 +#define SC1200_DCFG_VSYNC_EN 0x00000004 +#define SC1200_DCFG_DAC_BL_EN 0x00000008 +#define SC1200_DCFG_FP_PWR_EN 0x00000040 +#define SC1200_DCFG_FP_DATA_EN 0x00000080 +#define SC1200_DCFG_CRT_HSYNC_POL 0x00000100 +#define SC1200_DCFG_CRT_VSYNC_POL 0x00000200 +#define SC1200_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define SC1200_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define SC1200_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define SC1200_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define SC1200_DCFG_VG_CK 0x00100000 +#define SC1200_DCFG_GV_PAL_BYP 0x00200000 +#define SC1200_DCFG_DDC_SCL 0x00400000 +#define SC1200_DCFG_DDC_SDA 0x00800000 +#define SC1200_DCFG_DDC_OE 0x01000000 + +/* "SC1200_VID_MISC" BIT DEFINITIONS */ + +#define SC1200_GAMMA_BYPASS_BOTH 0x00000001 +#define SC1200_DAC_POWER_DOWN 0x00000400 +#define SC1200_ANALOG_POWER_DOWN 0x00000800 +#define SC1200_PLL_POWER_NORMAL 0x00001000 + +/* "SC1200_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */ + +#define SC1200_VIDEO_DOWNSCALE_ENABLE 0x00000001 +#define SC1200_VIDEO_DOWNSCALE_FACTOR_POS 1 +#define SC1200_VIDEO_DOWNSCALE_FACTOR_MASK 0x0000001E +#define SC1200_VIDEO_DOWNSCALE_TYPE_A 0x00000000 +#define SC1200_VIDEO_DOWNSCALE_TYPE_B 0x00000040 +#define SC1200_VIDEO_DOWNSCALE_TYPE_MASK 0x00000040 + +/* "SC1200_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */ + +#define SC1200_VIDEO_DOWNSCALER_COEF1_POS 0 +#define SC1200_VIDEO_DOWNSCALER_COEF2_POS 8 +#define SC1200_VIDEO_DOWNSCALER_COEF3_POS 16 +#define SC1200_VIDEO_DOWNSCALER_COEF4_POS 24 +#define SC1200_VIDEO_DOWNSCALER_COEF_MASK 0xF + +/* VIDEO DE-INTERLACING AND ALPHA CONTROL (REGISTER 0x4C) */ + +#define SC1200_VERTICAL_SCALER_SHIFT_MASK 0x00000007 +#define SC1200_VERTICAL_SCALER_SHIFT_INIT 0x00000004 +#define SC1200_VERTICAL_SCALER_SHIFT_EN 0x00000010 +#define SC1200_TOP_LINE_IN_ODD 0x00000040 +#define SC1200_NO_CK_OUTSIDE_ALPHA 0x00000100 +#define SC1200_VIDEO_IS_INTERLACED 0x00000200 +#define SC1200_CSC_VIDEO_YUV_TO_RGB 0x00000400 +#define SC1200_CSC_GFX_RGB_TO_YUV 0x00000800 +#define SC1200_VIDEO_INPUT_IS_RGB 0x00002000 +#define SC1200_VIDEO_LINE_OFFSET_ODD 0x00001000 +#define SC1200_ALPHA1_PRIORITY_POS 16 +#define SC1200_ALPHA1_PRIORITY_MASK 0x00030000 +#define SC1200_ALPHA2_PRIORITY_POS 18 +#define SC1200_ALPHA2_PRIORITY_MASK 0x000C0000 +#define SC1200_ALPHA3_PRIORITY_POS 20 +#define SC1200_ALPHA3_PRIORITY_MASK 0x00300000 + +/* VIDEO CURSOR COLOR KEY DEFINITIONS (REGISTER 0x50) */ + +#define SC1200_CURSOR_COLOR_KEY_OFFSET_POS 24 +#define SC1200_CURSOR_COLOR_BITS 23 +#define SC1200_COLOR_MASK 0x00FFFFFF /* 24 significant bits */ + +/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */ + +#define SC1200_ALPHA_COLOR_ENABLE 0x01000000 + +/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */ + +#define SC1200_ACTRL_WIN_ENABLE 0x00010000 +#define SC1200_ACTRL_LOAD_ALPHA 0x00020000 + +/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */ + +#define SC1200_VIDEO_Y_REQUEST_POS 0 +#define SC1200_VIDEO_X_REQUEST_POS 16 +#define SC1200_VIDEO_REQUEST_MASK 0x00000FFF + +/* VIDEO DISPLAY MODE (REGISTER 0x400) */ + +#define SC1200_VIDEO_SOURCE_MASK 0x00000003 +#define SC1200_VIDEO_SOURCE_GX1 0x00000000 +#define SC1200_VIDEO_SOURCE_DVIP 0x00000002 +#define SC1200_VBI_SOURCE_MASK 0x00000004 +#define SC1200_VBI_SOURCE_DVIP 0x00000000 +#define SC1200_VBI_SOURCE_GX1 0x00000004 + +/* ODD/EVEN VBI LINE ENABLE (REGISTERS 0x40C, 0x410) */ + +#define SC1200_VIDEO_VBI_LINE_ENABLE_MASK 0x00FFFFFC +#define SC1200_VIDEO_ALL_ACTIVE_IS_VBI 0x01000000 +#define SC1200_VIDEO_VBI_LINE_OFFSET_POS 25 +#define SC1200_VIDEO_VBI_LINE_OFFSET_MASK 0x3E000000 + +/* ODD/EVEN VBI TOTAL COUNT (REGISTERS 0x418, 0x41C) */ + +#define SC1200_VIDEO_VBI_TOTAL_COUNT_MASK 0x000FFFFF + +/* GENLOCK BIT DEFINITIONS */ + +#define SC1200_GENLOCK_SINGLE_ENABLE 0x00000001 +#define SC1200_GENLOCK_FIELD_SYNC_ENABLE 0x00000001 +#define SC1200_GENLOCK_CONTINUOUS_ENABLE 0x00000002 +#define SC1200_GENLOCK_GX_VSYNC_FALLING_EDGE 0x00000004 +#define SC1200_GENLOCK_VIP_VSYNC_FALLING_EDGE 0x00000008 +#define SC1200_GENLOCK_TIMEOUT_ENABLE 0x00000010 +#define SC1200_GENLOCK_TVENC_RESET_EVEN_FIELD 0x00000020 +#define SC1200_GENLOCK_TVENC_RESET_BEFORE_DELAY 0x00000040 +#define SC1200_GENLOCK_TVENC_RESET_ENABLE 0x00000080 +#define SC1200_GENLOCK_SYNC_TO_TVENC 0x00000100 +#define SC1200_GENLOCK_DELAY_MASK 0x001FFFFF + +/* TVOUT HORIZONTAL PRE ENCODER SCALE BIT DEFINITIONS */ + +#define SC1200_TVOUT_YC_DELAY_MASK 0x00C00000 +#define SC1200_TVOUT_YC_DELAY_NONE 0x00000000 +#define SC1200_TVOUT_Y_DELAY_ONE_PIXEL 0x00400000 +#define SC1200_TVOUT_C_DELAY_ONE_PIXEL 0x00800000 +#define SC1200_TVOUT_C_DELAY_TWO_PIXELS 0x00C00000 + +/* TVOUT HORIZONTAL SCALING/CONTROL BIT DEFINITIONS */ + +#define SC1200_TVOUT_FLICKER_FILTER_MASK 0x60000000 +#define SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH 0x00000000 +#define SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF 0x20000000 +#define SC1200_TVOUT_FLICKER_FILTER_DISABLED 0x40000000 +#define SC1200_TVENC_EXTERNAL_RESET_INTERVAL_MASK 0x0F000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD 0x00000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD 0x02000000 +#define SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD 0x05000000 +#define SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD 0x07000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD 0x0E000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_X_ODD_FIELDS 0x08000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_X_EVEN_FIELDS 0x0A000000 + +/* TVOUT DEBUG BIT DEFINITIONS */ + +#define SC1200_TVOUT_FIELD_STATUS_EVEN 0x00000040 +#define SC1200_TVOUT_FIELD_STATUS_TV 0x00000080 +#define SC1200_TVOUT_CRT_VSYNC_STATUS_TRAILING 0x00000100 +#define SC1200_TVOUT_FIELD_STATUS_INVERT 0x00000200 +#define SC1200_TVOUT_CONVERTER_INTERPOLATION 0x00000400 + +/* TVENC TIMING/CONTROL 1 BIT DEFINITIONS (REGISTER 0xC00) */ + +#define SC1200_TVENC_VPHASE_MASK 0x001FF800 +#define SC1200_TVENC_VPHASE_POS 11 +#define SC1200_TVENC_SUB_CARRIER_RESET_MASK 0x30000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_NEVER 0x00000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES 0x10000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES 0x20000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES 0x30000000 +#define SC1200_TVENC_VIDEO_TIMING_ENABLE 0x80000000 + +/* TVENC TIMING/CONTROL 2 BIT DEFINITIONS (REGISTER 0xC04) */ + +#define SC1200_TVENC_OUTPUT_YCBCR 0x40000000 +#define SC1200_TVENC_CFS_MASK 0x00030000 +#define SC1200_TVENC_CFS_BYPASS 0x00000000 +#define SC1200_TVENC_CFS_CVBS 0x00020000 +#define SC1200_TVENC_CFS_SVIDEO 0x00030000 + +/* TVENC TIMING/CONTROL 3 BIT DEFINITIONS (REGISTER 0xC08) */ + +#define SC1200_TVENC_CS 0x00000001 +#define SC1200_TVENC_SYNCMODE_MASK 0x00000006 +#define SC1200_TVENC_SYNC_ON_GREEN 0x00000002 +#define SC1200_TVENC_SYNC_ON_CVBS 0x00000004 +#define SC1200_TVENC_CM 0x00000008 + +/* TVENC DAC CONTROL BIT DEFINITIONS (REGISTER 0xC2C) */ +#define SC1200_TVENC_TRIM_MASK 0x00000007 +#define SC1200_TVENC_POWER_DOWN 0x00000020 + +/* TVENC MV CONTROL BIT DEFINITIONS (REGISTER 0xC30) */ +#define SC1200_TVENC_MV_ENABLE 0xBE + +/* SC1200 VIP REGISTER DEFINITIONS */ + +#define SC1200_VIP_CONFIG 0x00000000 +#define SC1200_VIP_CONTROL 0x00000004 +#define SC1200_VIP_STATUS 0x00000008 +#define SC1200_VIP_CURRENT_LINE 0x00000010 +#define SC1200_VIP_LINE_TARGET 0x00000014 +#define SC1200_ODD_DIRECT_VBI_LINE_ENABLE 0x00000018 +#define SC1200_EVEN_DIRECT_VBI_LINE_ENABLE 0x0000001C +#define SC1200_VIP_ODD_BASE 0x00000020 +#define SC1200_VIP_EVEN_BASE 0x00000024 +#define SC1200_VIP_PITCH 0x00000028 +#define SC1200_VBI_ODD_BASE 0x00000040 +#define SC1200_VBI_EVEN_BASE 0x00000044 +#define SC1200_VBI_PITCH 0x00000048 + +/* "SC1200_VIP_CONFIG" BIT DEFINITIONS */ + +#define SC1200_VIP_MODE_MASK 0x00000003 +#define SC1200_VIP_MODE_C 0x00000002 +#define SC1200_VBI_ANCILLARY_TO_MEMORY 0x000C0000 +#define SC1200_VBI_TASK_A_TO_MEMORY 0x00140000 +#define SC1200_VBI_TASK_B_TO_MEMORY 0x00240000 +#define SC1200_VIP_BUS_REQUEST_THRESHOLD 0x00400000 + +/* "SC1200_VIP_CONTROL" BIT DEFINITIONS */ + +#define SC1200_CAPTURE_RUN_MODE_MASK 0x00000003 +#define SC1200_CAPTURE_RUN_MODE_STOP_LINE 0x00000000 +#define SC1200_CAPTURE_RUN_MODE_STOP_FIELD 0x00000001 +#define SC1200_CAPTURE_RUN_MODE_START 0x00000003 +#define SC1200_VIP_DATA_CAPTURE_EN 0x00000100 +#define SC1200_VIP_VBI_CAPTURE_EN 0x00000200 +#define SC1200_VIP_VBI_FIELD_INTERRUPT_EN 0x00010000 + +/* "SC1200_VIP_STATUS" BIT DEFINITIONS */ + +#define SC1200_VIP_CURRENT_FIELD_ODD 0x01000000 +#define SC1200_VIP_BASE_NOT_UPDATED 0x00200000 +#define SC1200_VIP_FIFO_OVERFLOW 0x00100000 +#define SC1200_VIP_CLEAR_LINE_INT 0x00020000 +#define SC1200_VIP_CLEAR_FIELD_INT 0x00010000 +#define SC1200_VBI_DATA_CAPTURE_ACTIVE 0x00000200 +#define SC1200_VIDEO_DATA_CAPTURE_ACTIVE 0x00000100 + +/* "SC1200_VIP_CURRENT_LINE" BIT DEFINITIONS */ + +#define SC1200_VIP_CURRENT_LINE_MASK 0x000003FF + +/* "SC1200_VIP_LINE_TARGET" BIT DEFINITIONS */ + +#define SC1200_VIP_LAST_LINE_MASK 0x03FF0000 + +/* "SC1200_VIP_PITCH" BIT DEFINITION */ + +#define SC1200_VIP_PITCH_MASK 0x0000FFFC + +/* "SC1200_VBI_PITCH" BIT DEFINITION */ + +#define SC1200_VBI_PITCH_MASK 0x0000FFFC + +/* SC1200 DIRECT VBI LINE ENABLE BIT DEFINITION */ + +#define SC1200_DIRECT_VBI_LINE_ENABLE_MASK 0x00FFFFFF + +/* SC1200 CONFIGURATION BLOCK */ + +#define SC1200_CB_BASE_ADDR 0x9000 +#define SC1200_CB_WDTO 0x0000 +#define SC1200_CB_WDCNFG 0x0002 +#define SC1200_CB_WDSTS 0x0004 +#define SC1200_CB_TMVALUE 0x0008 +#define SC1200_CB_TMCNFG 0x000D +#define SC1200_CB_PMR 0x0030 +#define SC1200_CB_MCR 0x0034 +#define SC1200_CB_INTSEL 0x0038 +#define SC1200_CB_PID 0x003C +#define SC1200_CB_REV 0x003D + +/* SC1200 HIGH RESOLUTION TIMER CONFIGURATION REGISTER BITS */ + +#define SC1200_TMCLKSEL_27MHZ 0x2 + +/*---------------------------------*/ +/* PHILIPS SAA7114 VIDEO DECODER */ +/*---------------------------------*/ + +#define SAA7114_CHIPADDR 0x42 + +/* VIDEO DECODER REGISTER DEFINITIONS */ + +#define SAA7114_ANALOG_INPUT_CTRL1 0x02 +#define SAA7114_LUMINANCE_CONTROL 0x09 +#define SAA7114_BRIGHTNESS 0x0A +#define SAA7114_CONTRAST 0x0B +#define SAA7114_SATURATION 0x0C +#define SAA7114_HUE 0x0D +#define SAA7114_STATUS 0x1F +#define SAA7114_IPORT_CONTROL 0x86 + +/* TASK A REGISTER DEFINITIONS */ + +#define SAA7114_TASK_A_HORZ_OUTPUT_LO 0x9C +#define SAA7114_TASK_A_HORZ_OUTPUT_HI 0x9D +#define SAA7114_TASK_A_HSCALE_LUMA_LO 0xA8 +#define SAA7114_TASK_A_HSCALE_LUMA_HI 0xA9 +#define SAA7114_TASK_A_HSCALE_CHROMA_LO 0xAC +#define SAA7114_TASK_A_HSCALE_CHROMA_HI 0xAD + +/* TASK B REGISTER DEFINITIONS */ + +#define SAA7114_HORZ_OFFSET_LO 0xC4 +#define SAA7114_HORZ_OFFSET_HI 0xC5 +#define SAA7114_HORZ_INPUT_LO 0xC6 +#define SAA7114_HORZ_INPUT_HI 0xC7 +#define SAA7114_VERT_OFFSET_LO 0xC8 +#define SAA7114_VERT_OFFSET_HI 0xC9 +#define SAA7114_VERT_INPUT_LO 0xCA +#define SAA7114_VERT_INPUT_HI 0xCB +#define SAA7114_HORZ_OUTPUT_LO 0xCC +#define SAA7114_HORZ_OUTPUT_HI 0xCD +#define SAA7114_VERT_OUTPUT_LO 0xCE +#define SAA7114_VERT_OUTPUT_HI 0xCF +#define SAA7114_HORZ_PRESCALER 0xD0 +#define SAA7114_HORZ_ACL 0xD1 +#define SAA7114_HORZ_FIR_PREFILTER 0xD2 +#define SAA7114_FILTER_CONTRAST 0xD5 +#define SAA7114_FILTER_SATURATION 0xD6 +#define SAA7114_HSCALE_LUMA_LO 0xD8 +#define SAA7114_HSCALE_LUMA_HI 0xD9 +#define SAA7114_HSCALE_CHROMA_LO 0xDC +#define SAA7114_HSCALE_CHROMA_HI 0xDD +#define SAA7114_VSCALE_LUMA_LO 0xE0 +#define SAA7114_VSCALE_LUMA_HI 0xE1 +#define SAA7114_VSCALE_CHROMA_LO 0xE2 +#define SAA7114_VSCALE_CHROMA_HI 0xE3 +#define SAA7114_VSCALE_CONTROL 0xE4 +#define SAA7114_VSCALE_CHROMA_OFFS0 0xE8 +#define SAA7114_VSCALE_CHROMA_OFFS1 0xE9 +#define SAA7114_VSCALE_CHROMA_OFFS2 0xEA +#define SAA7114_VSCALE_CHROMA_OFFS3 0xEB +#define SAA7114_VSCALE_LUMINA_OFFS0 0xEC +#define SAA7114_VSCALE_LUMINA_OFFS1 0xED +#define SAA7114_VSCALE_LUMINA_OFFS2 0xEE +#define SAA7114_VSCALE_LUMINA_OFFS3 0xEF + +/* Still need to determine PHO value (common phase offset) */ +#define SAA7114_VSCALE_PHO 0x00 + +/*----------------------------------------------*/ +/* SECOND GENERATION GRAPHICS UNIT (REDCLOUD) */ +/*----------------------------------------------*/ + +#define MGP_DST_OFFSET 0x0000 /* dst address */ +#define MGP_SRC_OFFSET 0x0004 /* src address */ +#define MGP_VEC_ERR 0x0004 /* vector diag/axial errors */ +#define MGP_STRIDE 0x0008 /* src and dst strides */ +#define MGP_WID_HEIGHT 0x000C /* width and height of BLT */ +#define MGP_VEC_LEN 0x000C /* vector length/init error */ +#define MGP_SRC_COLOR_FG 0x0010 /* src mono data fgcolor */ +#define MGP_SRC_COLOR_BG 0x0014 /* src mono data bkcolor */ +#define MGP_PAT_COLOR_0 0x0018 /* pattern color 0 */ +#define MGP_PAT_COLOR_1 0x001C /* pattern color 1 */ +#define MGP_PAT_COLOR_2 0x0020 /* pattern color 2 */ +#define MGP_PAT_COLOR_3 0x0024 /* pattern color 3 */ +#define MGP_PAT_COLOR_4 0x0028 /* pattern color 4 */ +#define MGP_PAT_COLOR_5 0x002C /* pattern color 5 */ +#define MGP_PAT_DATA_0 0x0030 /* pattern data 0 */ +#define MGP_PAT_DATA_1 0x0034 /* pattern data 1 */ +#define MGP_RASTER_MODE 0x0038 /* raster operation */ +#define MGP_VECTOR_MODE 0x003C /* render vector */ +#define MGP_BLT_MODE 0x0040 /* render BLT */ +#define MGP_BLT_STATUS 0x0044 /* BLT status register */ +#define MGP_RESET 0x0044 /* reset register (write) */ +#define MGP_HST_SOURCE 0x0048 /* host src data (bitmap) */ +#define MGP_BASE_OFFSET 0x004C /* base render offset */ + +/* MGP_RASTER_MODE DEFINITIONS */ + +#define MGP_RM_BPPFMT_332 0x00000000 /* 8 BPP, 3:3:2 */ +#define MGP_RM_BPPFMT_4444 0x40000000 /* 16 BPP, 4:4:4:4 */ +#define MGP_RM_BPPFMT_1555 0x50000000 /* 16 BPP, 1:5:5:5 */ +#define MGP_RM_BPPFMT_565 0x60000000 /* 16 BPP, 5:6:5 */ +#define MGP_RM_BPPFMT_8888 0x80000000 /* 32 BPP, 8:8:8:8 */ +#define MGP_RM_ALPHA_EN_MASK 0x00C00000 /* Alpha enable */ +#define MGP_RM_ALPHA_TO_RGB 0x00400000 /* Alpha applies to RGB */ +#define MGP_RM_ALPHA_TO_ALPHA 0x00800000 /* Alpha applies to alpha */ +#define MGP_RM_ALPHA_OP_MASK 0x00300000 /* Alpha operation */ +#define MGP_RM_ALPHA_TIMES_A 0x00000000 /* Alpha * A */ +#define MGP_RM_BETA_TIMES_B 0x00100000 /* (1-alpha) * B */ +#define MGP_RM_A_PLUS_BETA_B 0x00200000 /* A + (1-alpha) * B */ +#define MGP_RM_ALPHA_A_PLUS_BETA_B 0x00300000 /* alpha * A + (1 - alpha)B */ +#define MGP_RM_ALPHA_SELECT 0x000E0000 /* Alpha Select */ +#define MGP_RM_SELECT_ALPHA_A 0x00000000 /* Alpha from channel A */ +#define MGP_RM_SELECT_ALPHA_B 0x00020000 /* Alpha from channel B */ +#define MGP_RM_SELECT_ALPHA_R 0x00040000 /* Registered alpha */ +#define MGP_RM_SELECT_ALPHA_1 0x00060000 /* Constant 1 */ +#define MGP_RM_SELECT_ALPHA_CHAN_A 0x00080000 /* RGB Values from A */ +#define MGP_RM_SELECT_ALPHA_CHAN_B 0x000A0000 /* RGB Values from B */ +#define MGP_RM_DEST_FROM_CHAN_A 0x00010000 /* Alpha channel select */ +#define MGP_RM_PAT_FLAGS 0x00000700 /* pattern related bits */ +#define MGP_RM_PAT_MONO 0x00000100 /* monochrome pattern */ +#define MGP_RM_PAT_COLOR 0x00000200 /* color pattern */ +#define MGP_RM_PAT_TRANS 0x00000400 /* pattern transparency */ +#define MGP_RM_SRC_TRANS 0x00000800 /* source transparency */ + +/* MGP_VECTOR_MODE DEFINITIONS */ + +#define MGP_VM_DST_REQ 0x00000008 /* dst data required */ +#define MGP_VM_THROTTLE 0x00000010 /* sync to VBLANK */ + +/* MGP_BLT_MODE DEFINITIONS */ + +#define MGP_BM_SRC_FB 0x00000001 /* src = frame buffer */ +#define MGP_BM_SRC_HOST 0x00000002 /* src = host register */ +#define MGP_BM_DST_REQ 0x00000004 /* dst data required */ +#define MGP_BM_SRC_MONO 0x00000040 /* monochrome source data */ +#define MGP_BM_SRC_BP_MONO 0x00000080 /* Byte-packed monochrome */ +#define MGP_BM_NEG_YDIR 0x00000100 /* negative Y direction */ +#define MGP_BM_NEG_XDIR 0x00000200 /* negative X direction */ +#define MGP_BM_THROTTLE 0x00000400 /* sync to VBLANK */ + +/* MGP_BLT_STATUS DEFINITIONS */ + +#define MGP_BS_BLT_BUSY 0x00000001 /* GP is not idle */ +#define MGP_BS_BLT_PENDING 0x00000004 /* second BLT is pending */ +#define MGP_BS_HALF_EMPTY 0x00000008 /* src FIFO half empty */ + +/* ALPHA BLENDING MODES */ + +#define ALPHA_MODE_BLEND 0x00000000 + +/*---------------------------------------------------*/ +/* SECOND GENERATION DISPLAY CONTROLLER (REDCLOUD) */ +/*---------------------------------------------------*/ + +#define MDC_UNLOCK 0x00000000 /* Unlock register */ +#define MDC_GENERAL_CFG 0x00000004 /* Config registers */ +#define MDC_DISPLAY_CFG 0x00000008 +#define MDC_GFX_SCL 0x0000000C /* Graphics scaling */ + +#define MDC_FB_ST_OFFSET 0x00000010 /* Frame buffer start offset */ +#define MDC_CB_ST_OFFSET 0x00000014 /* Compression start offset */ +#define MDC_CURS_ST_OFFSET 0x00000018 /* Cursor buffer start offset */ +#define MDC_ICON_ST_OFFSET 0x0000001C /* Icon buffer start offset */ +#define MDC_VID_Y_ST_OFFSET 0x00000020 /* Video Y Buffer start offset */ +#define MDC_VID_U_ST_OFFSET 0x00000024 /* Video U Buffer start offset */ +#define MDC_VID_V_ST_OFFSET 0x00000028 /* Video V Buffer start offset */ +#define MDC_LINE_SIZE 0x00000030 /* Video, CB, and FB line sizes */ +#define MDC_GFX_PITCH 0x00000034 /* FB and DB skip counts */ +#define MDC_VID_YUV_PITCH 0x00000038 /* Y, U and V buffer skip counts */ + +#define MDC_H_ACTIVE_TIMING 0x00000040 /* Horizontal timings */ +#define MDC_H_BLANK_TIMING 0x00000044 +#define MDC_H_SYNC_TIMING 0x00000048 +#define MDC_V_ACTIVE_TIMING 0x00000050 /* Vertical Timings */ +#define MDC_V_BLANK_TIMING 0x00000054 +#define MDC_V_SYNC_TIMING 0x00000058 + +#define MDC_CURSOR_X 0x00000060 /* Cursor X position */ +#define MDC_CURSOR_Y 0x00000064 /* Cursor Y Position */ +#define MDC_ICON_X 0x00000068 /* Icon X Position */ +#define MDC_LINE_CNT_STATUS 0x0000006C /* Icon Y Position */ + +#define MDC_PAL_ADDRESS 0x00000070 /* Palette Address */ +#define MDC_PAL_DATA 0x00000074 /* Palette Data */ +#define MDC_DFIFO_DIAG 0x00000078 /* Display FIFO diagnostic */ +#define MDC_CFIFO_DIAG 0x0000007C /* Compression FIFO diagnostic */ + +#define MDC_VID_DS_DELTA 0x00000080 /* Vertical Downscaling fraction */ + +#define MDC_PHY_MEM_OFFSET 0x00000084 /* VG Base Address Register */ +#define MDC_DV_CTL 0x00000088 /* Dirty-Valid Control Register */ +#define MDC_DV_ACC 0x0000008C /* Dirty-Valid RAM Access */ + +/* UNLOCK VALUE */ + +#define MDC_UNLOCK_VALUE 0x00004758 /* used to unlock DC regs */ + +/* VG MBUS DEVICE SMI MSR FIELDS */ + +#define MDC_VG_BL_MASK 0x00000001 +#define MDC_MISC_MASK 0x00000002 +#define MDC_ISR0_MASK 0x00000004 +#define MDC_VGA_BL_MASK 0x00000008 +#define MDC_CRTCIO_MSK 0x00000010 +#define MDC_VG_BLANK_SMI 0x00000001 +#define MDC_MISC_SMI 0x00000002 +#define MDC_ISR0_SMI 0x00000004 +#define MDC_VGA_BLANK_SMI 0x00000008 +#define MDC_CRTCIO_SMI 0x00000010 + +/* MDC_GENERAL_CFG BIT FIELDS */ + +#define MDC_GCFG_DBUG 0x80000000 +#define MDC_GCFG_DBSL 0x40000000 +#define MDC_GCFG_CFRW 0x20000000 +#define MDC_GCFG_DIAG 0x10000000 +#define MDC_GCFG_GXRFS4 0x08000000 +#define MDC_GCFG_SGFR 0x04000000 +#define MDC_GCFG_SGRE 0x02000000 +#define MDC_GCFG_SIGE 0x01000000 +#define MDC_GCFG_YUVM 0x00100000 +#define MDC_GCFG_VDSE 0x00080000 +#define MDC_GCFG_VGAFT 0x00040000 +#define MDC_GCFG_FDTY 0x00020000 +#define MDC_GCFG_STFM 0x00010000 +#define MDC_GCFG_DFHPEL_MASK 0x0000F000 +#define MDC_GCFG_DFHPSL_MASK 0x00000F00 +#define MDC_GCFG_VGAE 0x00000080 +#define MDC_GCFG_DECE 0x00000040 +#define MDC_GCFG_CMPE 0x00000020 +#define MDC_GCFG_VIDE 0x00000008 +#define MDC_GCFG_ICNE 0x00000004 +#define MDC_GCFG_CURE 0x00000002 +#define MDC_GCFG_DFLE 0x00000001 + +/* MDC_DISPLAY_CFG BIT FIELDS */ + +#define MDC_DCFG_A20M 0x80000000 +#define MDC_DCFG_A18M 0x40000000 +#define MDC_DCFG_VISL 0x08000000 +#define MDC_DCFG_FRLK 0x04000000 +#define MDC_DCFG_PALB 0x02000000 +#define MDC_DCFG_PIX_PAN_MASK 0x00F00000 +#define MDC_DCFG_DCEN 0x00080000 +#define MDC_DCFG_16BPP_MODE_MASK 0x00000C00 +#define MDC_DCFG_16BPP 0x00000000 +#define MDC_DCFG_15BPP 0x00000400 +#define MDC_DCFG_12BPP 0x00000800 +#define MDC_DCFG_DISP_MODE_MASK 0x00000300 +#define MDC_DCFG_DISP_MODE_8BPP 0x00000000 +#define MDC_DCFG_DISP_MODE_16BPP 0x00000100 +#define MDC_DCFG_DISP_MODE_24BPP 0x00000200 +#define MDC_DCFG_SCLE 0x00000080 +#define MDC_DCFG_TRUP 0x00000040 +#define MDC_DCFG_VIEN 0x00000020 +#define MDC_DCFG_VDEN 0x00000010 +#define MDC_DCFG_GDEN 0x00000008 +#define MDC_DCFG_VCKE 0x00000004 +#define MDC_DCFG_PCKE 0x00000002 +#define MDC_DCFG_TGEN 0x00000001 + +/* MDC_LINE_CNT BIT FIELDS */ + +#define MDC_LNCNT_DNA 0x80000000 +#define MDC_LNCNT_VNA 0x40000000 +#define MDC_LNCNT_VSA 0x20000000 +#define MDC_LNCNT_VINT 0x10000000 +#define MDC_LNCNT_FLIP 0x08000000 +#define MDC_LNCNT_V_LINE_CNT 0x07FF0000 +#define MDC_LNCNT_VFLIP 0x00008000 +#define MDC_LNCNT_SIGC 0x00004000 +#define MDC_LNCNT_SS_LINE_CMP 0x000007FF + +/* MDC_FB_ST_OFFSET BIT FIELDS */ + +#define MDC_FB_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_CB_ST_OFFSET BIT FIELDS */ + +#define MDC_CB_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_CURS_ST_OFFSET BIT FIELDS */ + +#define MDC_CURS_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_ICON_ST_OFFSET BIT FIELDS */ + +#define MDC_ICON_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_VID_Y_ST_OFFSET BIT FIELDS */ + +#define MDC_VID_Y_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_VID_U_ST_OFFSET BIT FIELDS */ + +#define MDC_VID_U_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_VID_V_ST_OFFSET BIT FIELDS */ + +#define MDC_VID_V_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_LINE_SIZE BIT FIELDS */ + +#define MDC_LINE_SIZE_VLS_MASK 0xFF000000 +#define MDC_LINE_SIZE_CBLS_MASK 0x007F0000 +#define MDC_LINE_SIZE_FBLS_MASK 0x000007FF + +/* MDC_GFX_PITCH BIT FIELDS */ + +#define MDC_GFX_PITCH_CBP_MASK 0xFFFF0000 +#define MDC_GFX_PITCH_FBP_MASK 0x0000FFFF + +/* MDC_VID_YUV_PITCH BIT FIELDS */ + +#define MDC_YUV_PITCH_UVP_MASK 0xFFFF0000 +#define MDC_YUV_PITCH_YBP_MASK 0x0000FFFF + +/* MDC_H_ACTIVE_TIMING BIT FIELDS */ + +#define MDC_HAT_HT_MASK 0x0FF80000 +#define MDC_HAT_HA_MASK 0x00000FF8 + +/* MDC_H_BLANK_TIMING BIT FIELDS */ + +#define MDC_HBT_HBE_MASK 0x0FF80000 +#define MDC_HBT_HBS_MASK 0x00000FF8 + +/* MDC_H_SYNC_TIMING BIT FIELDS */ + +#define MDC_HST_HSE_MASK 0x0FF80000 +#define MDC_HST_HSS_MASK 0x00000FF8 + +/* MDC_V_ACTIVE_TIMING BIT FIELDS */ + +#define MDC_VAT_VT_MASK 0x07FF0000 +#define MDC_VAT_VA_MASK 0x000007FF + +/* MDC_V_BLANK_TIMING BIT FIELDS */ + +#define MDC_VBT_VBE_MASK 0x07FF0000 +#define MDC_VBT_VBS_MASK 0x000007FF + +/* MDC_V_SYNC_TIMING BIT FIELDS */ + +#define MDC_VST_VSE_MASK 0x07FF0000 +#define MDC_VST_VSS_MASK 0x000007FF + +/* MDC_DV_CTL BIT DEFINITIONS */ + +#define MDC_DV_LINE_SIZE_MASK 0x00000C00 +#define MDC_DV_LINE_SIZE_1024 0x00000000 +#define MDC_DV_LINE_SIZE_2048 0x00000400 +#define MDC_DV_LINE_SIZE_4096 0x00000800 +#define MDC_DV_LINE_SIZE_8192 0x00000C00 + +/* VGA DEFINITIONS */ + +#define MDC_SEQUENCER_INDEX 0x03C4 +#define MDC_SEQUENCER_DATA 0x03C5 +#define MDC_SEQUENCER_RESET 0x00 +#define MDC_SEQUENCER_CLK_MODE 0x01 + +#define MDC_RESET_VGA_DISP_ENABLE 0x03 +#define MDC_CLK_MODE_SCREEN_OFF 0x20 + +/*---------------------------------------------------*/ +/* REDCLOUD DISPLAY FILTER */ +/*---------------------------------------------------*/ + +/* RCDF VIDEO REGISTER DEFINITIONS */ + +#define RCDF_VIDEO_CONFIG 0x000 +#define RCDF_DISPLAY_CONFIG 0x008 +#define RCDF_VIDEO_X_POS 0x010 +#define RCDF_VIDEO_Y_POS 0x018 +#define RCDF_VIDEO_SCALE 0x020 +#define RCDF_VIDEO_COLOR_KEY 0x028 +#define RCDF_VIDEO_COLOR_MASK 0x030 +#define RCDF_PALETTE_ADDRESS 0x038 +#define RCDF_PALETTE_DATA 0x040 +#define RCDF_VID_MISC 0x050 +#define RCDF_VID_CLOCK_SELECT 0x058 +#define RCDF_VIDEO_DOWNSCALER_CONTROL 0x078 +#define RCDF_VIDEO_DOWNSCALER_COEFFICIENTS 0x080 +#define RCDF_VID_CRC 0x088 +#define RCDF_VID_CRC32 0x090 +#define RCDF_VID_ALPHA_CONTROL 0x098 +#define RCDF_CURSOR_COLOR_KEY 0x0A0 +#define RCDF_CURSOR_COLOR_MASK 0x0A8 +#define RCDF_CURSOR_COLOR_1 0x0B0 +#define RCDF_CURSOR_COLOR_2 0x0B8 +#define RCDF_ALPHA_XPOS_1 0x0C0 +#define RCDF_ALPHA_YPOS_1 0x0C8 +#define RCDF_ALPHA_COLOR_1 0x0D0 +#define RCDF_ALPHA_CONTROL_1 0x0D8 +#define RCDF_ALPHA_XPOS_2 0x0E0 +#define RCDF_ALPHA_YPOS_2 0x0E8 +#define RCDF_ALPHA_COLOR_2 0x0F0 +#define RCDF_ALPHA_CONTROL_2 0x0F8 +#define RCDF_ALPHA_XPOS_3 0x100 +#define RCDF_ALPHA_YPOS_3 0x108 +#define RCDF_ALPHA_COLOR_3 0x110 +#define RCDF_ALPHA_CONTROL_3 0x118 +#define RCDF_VIDEO_REQUEST 0x120 +#define RCDF_ALPHA_WATCH 0x128 +#define RCDF_VIDEO_TEST_MODE 0x210 +#define RCDF_POWER_MANAGEMENT 0x410 + +/* DISPLAY FILTER POWER MANAGEMENT DEFINITIONS */ + +#define RCDF_PM_PANEL_POWER_ON 0x01000000 + +/* DISPLAY FILTER MSRS */ + +#define RCDF_MBD_MSR_DIAG_DF 0x2010 +#define RCDF_DIAG_32BIT_CRC 0x80000000 + +/* "RCDF_VIDEO_CONFIG" BIT DEFINITIONS */ + +#define RCDF_VCFG_VID_EN 0x00000001 +#define RCDF_VCFG_VID_INP_FORMAT 0x0000000C +#define RCDF_VCFG_X_FILTER_EN 0x00000040 +#define RCDF_VCFG_Y_FILTER_EN 0x00000080 +#define RCDF_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define RCDF_VCFG_INIT_READ_MASK 0x01FF0000 +#define RCDF_VCFG_LINE_SIZE_UPPER 0x08000000 +#define RCDF_VCFG_4_2_0_MODE 0x10000000 +#define RCDF_VCFG_UYVY_FORMAT 0x00000000 +#define RCDF_VCFG_Y2YU_FORMAT 0x00000004 +#define RCDF_VCFG_YUYV_FORMAT 0x00000008 +#define RCDF_VCFG_YVYU_FORMAT 0x0000000C + +/* "RCDF_DISPLAY_CONFIG" BIT DEFINITIONS */ + +#define RCDF_DCFG_DIS_EN 0x00000001 +#define RCDF_DCFG_HSYNC_EN 0x00000002 +#define RCDF_DCFG_VSYNC_EN 0x00000004 +#define RCDF_DCFG_DAC_BL_EN 0x00000008 +#define RCDF_DCFG_FP_PWR_EN 0x00000040 +#define RCDF_DCFG_FP_DATA_EN 0x00000080 +#define RCDF_DCFG_CRT_HSYNC_POL 0x00000100 +#define RCDF_DCFG_CRT_VSYNC_POL 0x00000200 +#define RCDF_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define RCDF_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define RCDF_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define RCDF_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define RCDF_DCFG_VG_CK 0x00100000 +#define RCDF_DCFG_GV_PAL_BYP 0x00200000 +#define RCDF_DAC_VREF 0x04000000 +#define RCDF_FP_ON_STATUS 0x08000000 + +/* "RCDF_VID_MISC" BIT DEFINITIONS */ + +#define RCDF_GAMMA_BYPASS_BOTH 0x00000001 +#define RCDF_DAC_POWER_DOWN 0x00000400 +#define RCDF_ANALOG_POWER_DOWN 0x00000800 + +/* "RCDF_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */ + +#define RCDF_VIDEO_DOWNSCALE_ENABLE 0x00000001 +#define RCDF_VIDEO_DOWNSCALE_FACTOR_POS 1 +#define RCDF_VIDEO_DOWNSCALE_FACTOR_MASK 0x0000001E +#define RCDF_VIDEO_DOWNSCALE_TYPE_A 0x00000000 +#define RCDF_VIDEO_DOWNSCALE_TYPE_B 0x00000040 +#define RCDF_VIDEO_DOWNSCALE_TYPE_MASK 0x00000040 + +/* "RCDF_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */ + +#define RCDF_VIDEO_DOWNSCALER_COEF1_POS 0 +#define RCDF_VIDEO_DOWNSCALER_COEF2_POS 8 +#define RCDF_VIDEO_DOWNSCALER_COEF3_POS 16 +#define RCDF_VIDEO_DOWNSCALER_COEF4_POS 24 +#define RCDF_VIDEO_DOWNSCALER_COEF_MASK 0xF + +/* VIDEO DE-INTERLACING AND ALPHA CONTROL */ + +#define RCDF_NO_CK_OUTSIDE_ALPHA 0x00000100 +#define RCDF_CSC_VIDEO_YUV_TO_RGB 0x00000400 +#define RCDF_VIDEO_INPUT_IS_RGB 0x00002000 +#define RCDF_ALPHA1_PRIORITY_POS 16 +#define RCDF_ALPHA1_PRIORITY_MASK 0x00030000 +#define RCDF_ALPHA2_PRIORITY_POS 18 +#define RCDF_ALPHA2_PRIORITY_MASK 0x000C0000 +#define RCDF_ALPHA3_PRIORITY_POS 20 +#define RCDF_ALPHA3_PRIORITY_MASK 0x00300000 + +/* VIDEO CURSOR COLOR KEY DEFINITIONS */ + +#define RCDF_CURSOR_COLOR_KEY_ENABLE 0x20000000 +#define RCDF_CURSOR_COLOR_KEY_OFFSET_POS 24 +#define RCDF_CURSOR_COLOR_BITS 23 +#define RCDF_COLOR_MASK 0x00FFFFFF /* 24 significant bits */ + +/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */ + +#define RCDF_ALPHA_COLOR_ENABLE 0x01000000 + +/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */ + +#define RCDF_ACTRL_WIN_ENABLE 0x00010000 +#define RCDF_ACTRL_LOAD_ALPHA 0x00020000 + +/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */ + +#define RCDF_VIDEO_Y_REQUEST_POS 0 +#define RCDF_VIDEO_X_REQUEST_POS 16 +#define RCDF_VIDEO_REQUEST_MASK 0x000007FF + +/* GEODELINK DEVICE MSR REGISTER SUMMARY */ + +#define MBD_MSR_CAP 0x2000 /* Device Capabilities */ +#define MBD_MSR_CONFIG 0x2001 /* Device Master Configuration Register */ +#define MBD_MSR_SMI 0x2002 /* MBus Device SMI Register */ +#define MBD_MSR_ERROR 0x2003 /* MBus Device Error */ +#define MBD_MSR_PM 0x2004 /* MBus Device Power Management Register */ +#define MBD_MSR_DIAG 0x2005 /* Mbus Device Diagnostic Register */ + +/* DISPLAY FILTER MBD_MSR_DIAG DEFINITIONS */ + +#define RCDF_MBD_DIAG_SEL0 0x00007FFF /* Lower 32-bits of Diag Bus Select */ +#define RCDF_MBD_DIAG_EN0 0x00008000 /* Enable for lower 32-bits of diag bus */ +#define RCDF_MBD_DIAG_SEL1 0x7FFF0000 /* Upper 32-bits of Diag Bus Select */ +#define RCDF_MBD_DIAG_EN1 0x80000000 /* Enable for upper 32-bits of diag bus */ + +/* DISPLAY FILTER MBD_MSR_CONFIG DEFINITIONS */ + +#define RCDF_CONFIG_FMT_MASK 0x00000038 /* Output Format */ +#define RCDF_CONFIG_FMT_CRT 0x00000000 +#define RCDF_CONFIG_FMT_FP 0x00000008 + +/* MCP MSR DEFINITIONS */ + +#define MCP_CLKOFF 0x0010 +#define MCP_CLKACTIVE 0x0011 +#define MCP_CLKDISABLE 0x0012 +#define MCP_CLK4ACK 0x0013 +#define MCP_SYS_RSTPLL 0x0014 +#define MCP_DOTPLL 0x0015 +#define MCP_DBGCLKCTL 0x0016 +#define MCP_RC_REVID 0x0017 +#define MCP_SETM0CTL 0x0040 +#define MCP_SETN0CTL 0x0048 +#define MCP_CMPVAL0 0x0050 +#define MCP_CMPMASK0 0x0051 +#define MCP_REGA 0x0058 +#define MCP_REGB 0x0059 +#define MCP_REGAMASK 0x005A +#define MCP_REGAVAL 0x005B +#define MCP_REGBMASK 0x005C +#define MCP_REGBVAL 0x005D +#define MCP_FIFOCTL 0x005E +#define MCP_DIAGCTL 0x005F +#define MCP_H0CTL 0x0060 +#define MCP_XSTATE 0x0066 +#define MCP_YSTATE 0x0067 +#define MCP_ACTION0 0x0068 + +/* MCP_SYS_RSTPLL DEFINITIONS */ + +#define MCP_DOTPOSTDIV3 0x00000008 +#define MCP_DOTPREMULT2 0x00000004 +#define MCP_DOTPREDIV2 0x00000002 + +/* MCP MBD_MSR_DIAG DEFINITIONS */ + +#define MCP_MBD_DIAG_SEL0 0x00000007 +#define MCP_MBD_DIAG_EN0 0x00008000 +#define MCP_MBD_DIAG_SEL1 0x00070000 +#define MCP_MBD_DIAG_EN1 0x80000000 + +/* MCP_DOTPLL DEFINITIONS */ + +#define MCP_DOTPLL_P 0x00000003 +#define MCP_DOTPLL_N 0x000001FC +#define MCP_DOTPLL_M 0x00001E00 +#define MCP_DOTPLL_LOCK 0x02000000 +#define MCP_DOTPLL_BYPASS 0x00008000 + +/* END OF FILE */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rndr.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rndr.c:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rndr.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,786 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rndr.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_rndr.c $ + * + * This file contains routines to program the 2D acceleration hardware: + * + * gfx_set_bpp + * gfx_set_solid_pattern + * gfx_set_mono_pattern + * gfx_set_color_pattern + * gfx_load_color_pattern_line + * gfx_set_solid_source + * gfx_set_mono_source + * gfx_set_raster_operation + * gfx_pattern_fill + * gfx_color_pattern_fill + * gfx_screen_to_screen_blt + * gfx_screen_to_screen_xblt + * gfx_color_bitmap_to_screen_blt + * gfx_color_bitmap_to_screen_xblt + * gfx_mono_bitmap_to_screen_blt + * gfx_bresenham_line + * gfx_wait_until_idle + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* STATIC VARIABLES */ + +unsigned short GFXbpp = 16; +unsigned short GFXbb0Base = 0x400; +unsigned short GFXbb1Base = 0x930; +unsigned short GFXbufferWidthPixels = 400; + +unsigned short GFXpatternFlags = 0; +unsigned short GFXsourceFlags = 0; +unsigned long GFXsavedColor = 0; +unsigned short GFXsavedRop = 0; +unsigned short GFXusesDstData = 0; + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_2DACCEL_GU1 +#include "rndr_gu1.c" +#endif + +/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ + +#if GFX_2DACCEL_GU2 +#include "rndr_gu2.c" +#endif + +void gfx_reset_pitch(unsigned short pitch); + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_2DACCEL_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_reset_pitch (PRIVATE ROUTINE - NOT PART OF API) + *--------------------------------------------------------------------------- + */ +void +gfx_reset_pitch(unsigned short pitch) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_reset_pitch(pitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_bpp + *--------------------------------------------------------------------------- + */ +void +gfx_set_bpp(unsigned short bpp) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_bpp(bpp); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_bpp(bpp); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_solid_source + *--------------------------------------------------------------------------- + */ +void +gfx_set_solid_source(unsigned long color) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_solid_source(color); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_solid_source(color); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_mono_source + *--------------------------------------------------------------------------- + */ +void +gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_mono_source(bgcolor, fgcolor, transparent); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_mono_source(bgcolor, fgcolor, transparent); +# endif +} + +void +gfx_set_pattern_flags(unsigned short flags) +{ + GFXpatternFlags |= flags; +} + +/*--------------------------------------------------------------------------- + * gfx_set_solid_pattern + *--------------------------------------------------------------------------- + */ +void +gfx_set_solid_pattern(unsigned long color) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_solid_pattern(color); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_solid_pattern(color); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_mono_pattern + *--------------------------------------------------------------------------- + */ +void +gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparent) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_color_pattern + *--------------------------------------------------------------------------- + */ +void +gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, + transparent); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, + transparent); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_load_color_pattern_line + *--------------------------------------------------------------------------- + */ +void +gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_load_color_pattern_line(y, pattern_8x8); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_load_color_pattern_line(y, pattern_8x8); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_raster_operation + *--------------------------------------------------------------------------- + */ +void +gfx_set_raster_operation(unsigned char rop) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_raster_operation(rop); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_raster_operation(rop); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_pattern_fill(x, y, width, height); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_pattern_fill(x, y, width, height); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_color_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_color_pattern_fill(x, y, width, height, pattern); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_color_pattern_fill(x, y, width, height, pattern); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_screen_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_screen_to_screen_xblt + *--------------------------------------------------------------------------- + */ +void +gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_color_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_color_bitmap_to_screen_xblt + *--------------------------------------------------------------------------- + */ +void +gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, + data, pitch, color); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, + data, pitch, color); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_mono_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_text_blt + *--------------------------------------------------------------------------- + */ +void +gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_text_blt(dstx, dsty, width, height, data); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_text_blt(dstx, dsty, width, height, data); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_bresenham_line + *--------------------------------------------------------------------------- + */ +void +gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_wait_until_idle + *--------------------------------------------------------------------------- + */ +void +gfx_wait_until_idle(void) +{ +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_wait_until_idle(); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_wait_until_idle(); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_test_blt_pending + *--------------------------------------------------------------------------- + */ +int +gfx_test_blt_pending(void) +{ + int retval = 0; + +# if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + retval = gu1_test_blt_pending(); +# endif +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + retval = gu2_test_blt_pending(); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * NEW ROUTINES FOR REDCLOUD + *--------------------------------------------------------------------------- + */ + +/*--------------------------------------------------------------------------- + * gfx2_set_source_stride + *--------------------------------------------------------------------------- + */ +void +gfx2_set_source_stride(unsigned short stride) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_source_stride(stride); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_destination_stride + *--------------------------------------------------------------------------- + */ +void +gfx2_set_destination_stride(unsigned short stride) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_destination_stride(stride); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_pattern_origin + *--------------------------------------------------------------------------- + */ +void +gfx2_set_pattern_origin(int x, int y) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_pattern_origin(x, y); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_source_transparency + *--------------------------------------------------------------------------- + */ +void +gfx2_set_source_transparency(unsigned long color, unsigned long mask) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_source_transparency(color, mask); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_alpha_mode + *--------------------------------------------------------------------------- + */ +void +gfx2_set_alpha_mode(int mode) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_alpha_mode(mode); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_alpha_value + *--------------------------------------------------------------------------- + */ +void +gfx2_set_alpha_value(unsigned char value) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_alpha_value(value); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_pattern_fill(dstoffset, width, height); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_color_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_color_pattern_fill(dstoffset, width, height, pattern); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_screen_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, + unsigned short width, unsigned short height, + int flags) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_screen_to_screen_blt(srcoffset, dstoffset, width, height, flags); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_mono_expand_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_mono_expand_blt(srcbase, srcx, srcy, dstoffset, width, height, + byte_packed); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_color_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_color_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, + data, pitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_text_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_text_blt(dstoffset, width, height, data); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_mono_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_mono_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, + data, pitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_bresenham_line + *--------------------------------------------------------------------------- + */ +void +gfx2_bresenham_line(unsigned long dstoffset, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_bresenham_line(dstoffset, length, initerr, axialerr, diagerr, + flags); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx2_sync_to_vblank + *--------------------------------------------------------------------------- + */ +void +gfx2_sync_to_vblank(void) +{ +# if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_sync_to_vblank(); +# endif +} + +#endif /* GFX_2DACCEL_DYNAMIC */ + +/* END OF FILE */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rtns.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rtns.h:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rtns.h Tue Dec 10 10:12:25 2002 @@ -0,0 +1,738 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rtns.h,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_rtns.h $ + * + * This header file defines the Durango routines and variables used + * to access the memory mapped regions. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _gfx_rtns_h +#define _gfx_rtns_h + +/* INCLUDE DURANGO DEFINITIONS */ +/* These definitions are placed in another file to allow their inclusion */ +/* in a user application. Such applications generally work through driver */ +/* shell routines that simply pass their parameters to Durango routines. */ +/* An external file provides an easy way to provide the definitions for these */ +/* parameters without the applications gaining any Durango visisbility. */ + +#include "gfx_type.h" + +/* COMPILER OPTION FOR C++ PROGRAMS */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* DURANGO MEMORY POINTERS */ + + extern unsigned char *gfx_virt_regptr; + extern unsigned char *gfx_virt_fbptr; + extern unsigned char *gfx_virt_vidptr; + extern unsigned char *gfx_virt_vipptr; + extern unsigned char *gfx_virt_spptr; + extern unsigned char *gfx_virt_gpptr; + + extern unsigned char *gfx_phys_regptr; + extern unsigned char *gfx_phys_fbptr; + extern unsigned char *gfx_phys_vidptr; + extern unsigned char *gfx_phys_vipptr; + extern unsigned char *gfx_phys_spptr; + extern unsigned char *gfx_phys_gpptr; + +/* DURANGO VARIBLES FOR RUNTIME SELECTION AND POSSIBLE VALUES */ + + extern int gfx_display_type; +#define GFX_DISPLAY_TYPE_GU1 0x0001 +#define GFX_DISPLAY_TYPE_GU2 0x0002 + + extern int gfx_init_type; +#define GFX_INIT_TYPE_GU1 0x0001 +#define GFX_INIT_TYPE_GU2 0x0002 + + extern int gfx_msr_type; +#define GFX_MSR_TYPE_REDCLOUD 0x0001 + + extern int gfx_2daccel_type; +#define GFX_2DACCEL_TYPE_GU1 0x0001 +#define GFX_2DACCEL_TYPE_GU2 0x0002 + + extern int gfx_video_type; +#define GFX_VIDEO_TYPE_CS5530 0x0001 +#define GFX_VIDEO_TYPE_SC1200 0x0002 +#define GFX_VIDEO_TYPE_REDCLOUD 0x0004 + + extern int gfx_vip_type; +#define GFX_VIP_TYPE_SC1200 0x0001 + + extern int gfx_decoder_type; +#define GFX_DECODER_TYPE_SAA7114 0x0001 + + extern int gfx_tv_type; +#define GFX_TV_TYPE_SC1200 0x0001 +#define GFX_TV_TYPE_FS451 0x0002 + + extern int gfx_i2c_type; +#define GFX_I2C_TYPE_ACCESS 0x0001 +#define GFX_I2C_TYPE_GPIO 0x0002 + +/* GLOBAL CPU INFORMATION */ + + extern unsigned long gfx_cpu_version; + extern unsigned long gfx_cpu_frequency; + extern unsigned long gfx_vid_version; + extern ChipType gfx_chip_revision; + +/* ROUTINES IN GFX_INIT.C */ + + unsigned long gfx_pci_config_read(unsigned long address); + void gfx_pci_config_write(unsigned long address, unsigned long data); + unsigned long gfx_get_core_freq(void); + unsigned long gfx_detect_cpu(void); + unsigned long gfx_detect_video(void); + unsigned long gfx_get_cpu_register_base(void); + unsigned long gfx_get_graphics_register_base(void); + unsigned long gfx_get_frame_buffer_base(void); + unsigned long gfx_get_frame_buffer_size(void); + unsigned long gfx_get_vid_register_base(void); + unsigned long gfx_get_vip_register_base(void); + +/* ROUTINES IN GFX_MSR.C */ + + int gfx_msr_init(void); + DEV_STATUS gfx_id_msr_device(MSR * pDev, unsigned long address); + DEV_STATUS gfx_get_msr_dev_address(unsigned int device, + unsigned long *address); + DEV_STATUS gfx_get_glink_id_at_address(unsigned int *device, + unsigned long address); + DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); + DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); + +/* ROUTINES IN GFX_DISP.C */ + + int gfx_set_display_bpp(unsigned short bpp); + int gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz); + int gfx_set_display_mode(int xres, int yres, int bpp, int hz); + int gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, + unsigned short hblank_start, + unsigned short hsync_start, + unsigned short hsync_end, + unsigned short hblank_end, + unsigned short htotal, unsigned short vactive, + unsigned short vblank_start, + unsigned short vsync_start, + unsigned short vsync_end, + unsigned short vblank_end, + unsigned short vtotal, + unsigned long frequency); + int gfx_set_vtotal(unsigned short vtotal); + void gfx_set_display_pitch(unsigned short pitch); + void gfx_set_display_offset(unsigned long offset); + int gfx_set_display_palette_entry(unsigned long index, + unsigned long palette); + int gfx_set_display_palette(unsigned long *palette); + void gfx_video_shutdown(void); + void gfx_set_clock_frequency(unsigned long frequency); + int gfx_set_crt_enable(int enable); + void gfx_set_cursor_enable(int enable); + void gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); + void gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, + unsigned short yhotspot); + void gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, + unsigned long *xormask); + void gfx_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, + unsigned long *xormask); + void gfx_set_icon_enable(int enable); + void gfx_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2); + void gfx_set_icon_position(unsigned long memoffset, unsigned short xpos); + void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines); + + int gfx_set_compression_enable(int enable); + int gfx_set_compression_offset(unsigned long offset); + int gfx_set_compression_pitch(unsigned short pitch); + int gfx_set_compression_size(unsigned short size); + void gfx_set_display_priority_high(int enable); + int gfx_test_timing_active(void); + int gfx_test_vertical_active(void); + int gfx_wait_vertical_blank(void); + void gfx_delay_milliseconds(unsigned long milliseconds); + void gfx_delay_microseconds(unsigned long microseconds); + void gfx_enable_panning(int x, int y); + int gfx_set_fixed_timings(int panelResX, int panelResY, + unsigned short width, unsigned short height, + unsigned short bpp); + int gfx_set_panel_present(int panelResX, int panelResY, + unsigned short width, unsigned short height, + unsigned short bpp); + void gfx_reset_timing_lock(void); + +/* "READ" ROUTINES IN GFX_DISP.C */ + + int gfx_get_display_details(unsigned int mode, int *xres, int *yres, + int *hz); + unsigned short gfx_get_display_pitch(void); + int gfx_get_vsa2_softvga_enable(void); + int gfx_get_sync_polarities(void); + unsigned long gfx_get_clock_frequency(void); + unsigned long gfx_get_max_supported_pixel_clock(void); + int gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency); + int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, + int *hz, unsigned long frequency); + int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency); + int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency); + int gfx_get_display_mode_count(void); + int gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz); + unsigned long gfx_get_frame_buffer_line_size(void); + unsigned short gfx_get_hactive(void); + unsigned short gfx_get_hblank_start(void); + unsigned short gfx_get_hsync_start(void); + unsigned short gfx_get_hsync_end(void); + unsigned short gfx_get_hblank_end(void); + unsigned short gfx_get_htotal(void); + unsigned short gfx_get_vactive(void); + unsigned short gfx_get_vline(void); + unsigned short gfx_get_vblank_start(void); + unsigned short gfx_get_vsync_start(void); + unsigned short gfx_get_vsync_end(void); + unsigned short gfx_get_vblank_end(void); + unsigned short gfx_get_vtotal(void); + unsigned short gfx_get_display_bpp(void); + unsigned long gfx_get_display_offset(void); + int gfx_get_display_palette_entry(unsigned long index, + unsigned long *palette); + void gfx_get_display_palette(unsigned long *palette); + unsigned long gfx_get_cursor_enable(void); + unsigned long gfx_get_cursor_offset(void); + unsigned long gfx_get_cursor_position(void); + unsigned long gfx_get_cursor_clip(void); + unsigned long gfx_get_cursor_color(int color); + unsigned long gfx_get_icon_enable(void); + unsigned long gfx_get_icon_offset(void); + unsigned long gfx_get_icon_position(void); + unsigned long gfx_get_icon_color(int color); + int gfx_get_compression_enable(void); + unsigned long gfx_get_compression_offset(void); + unsigned short gfx_get_compression_pitch(void); + unsigned short gfx_get_compression_size(void); + int gfx_get_display_priority_high(void); + int gfx_get_valid_bit(int line); + +/* ROUTINES IN GFX_RNDR.C */ + + void gfx_set_bpp(unsigned short bpp); + void gfx_set_solid_pattern(unsigned long color); + void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparency); + void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparency); + void gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8); + void gfx_set_solid_source(unsigned long color); + void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent); + void gfx_set_pattern_flags(unsigned short flags); + void gfx_set_raster_operation(unsigned char rop); + void gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height); + void gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern); + void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height); + void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color); + void gfx_color_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch); + void gfx_color_bitmap_to_screen_xblt(unsigned short srcx, + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch, + unsigned long color); + void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); + void gfx_text_blt(unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data); + void gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); + void gfx_wait_until_idle(void); + int gfx_test_blt_pending(void); + +/* SECOND GENERATION RENDERING ROUTINES */ + + void gfx2_set_source_stride(unsigned short stride); + void gfx2_set_destination_stride(unsigned short stride); + void gfx2_set_pattern_origin(int x, int y); + void gfx2_set_source_transparency(unsigned long color, unsigned long mask); + void gfx2_set_alpha_mode(int mode); + void gfx2_set_alpha_value(unsigned char value); + void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height); + void gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, + unsigned long *pattern); + void gfx2_screen_to_screen_blt(unsigned long srcoffset, + unsigned long dstoffset, + unsigned short width, unsigned short height, + int flags); + void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed); + void gfx2_color_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); + void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); + void gfx2_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data); + void gfx2_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); + void gfx2_sync_to_vblank(void); + +/* ROUTINES IN GFX_VID.C */ + + int gfx_set_video_enable(int enable); + int gfx_set_video_format(unsigned long format); + int gfx_set_video_size(unsigned short width, unsigned short height); + int gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); + int gfx_set_video_offset(unsigned long offset); + int gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset); + int gfx_set_video_window(short x, short y, unsigned short w, + unsigned short h); + int gfx_set_video_left_crop(unsigned short x); + int gfx_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); + int gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); + int gfx_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth); + void gfx_set_video_vertical_downscale_enable(int enable); + int gfx_set_video_downscale_config(unsigned short type, unsigned short m); + int gfx_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); + int gfx_set_video_filter(int xfilter, int yfilter); + int gfx_set_video_palette(unsigned long *palette); + int gfx_set_video_palette_entry(unsigned long index, unsigned long color); + int gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); + int gfx_set_video_downscale_enable(int enable); + int gfx_set_video_source(VideoSourceType source); + int gfx_set_vbi_source(VbiSourceType source); + int gfx_set_vbi_lines(unsigned long even, unsigned long odd); + int gfx_set_vbi_total(unsigned long even, unsigned long odd); + int gfx_set_video_interlaced(int enable); + int gfx_set_color_space_YUV(int enable); + int gfx_set_vertical_scaler_offset(char offset); + int gfx_set_top_line_in_odd(int enable); + int gfx_set_genlock_delay(unsigned long delay); + int gfx_set_genlock_enable(int flags); + int gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, + unsigned long color1, unsigned long color2); + int gfx_set_video_cursor_enable(int enable); + int gfx_set_video_request(short x, short y); + + int gfx_select_alpha_region(int region); + int gfx_set_alpha_enable(int enable); + int gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); + int gfx_set_alpha_value(unsigned char alpha, char delta); + int gfx_set_alpha_priority(int priority); + int gfx_set_alpha_color(unsigned long color); + int gfx_set_alpha_color_enable(int enable); + int gfx_set_no_ck_outside_alpha(int enable); + int gfx_disable_softvga(void); + int gfx_enable_softvga(void); + int gfx_set_macrovision_enable(int enable); + +/* READ ROUTINES IN GFX_VID.C */ + + int gfx_get_video_enable(void); + int gfx_get_video_format(void); + unsigned long gfx_get_video_src_size(void); + unsigned long gfx_get_video_line_size(void); + unsigned long gfx_get_video_xclip(void); + unsigned long gfx_get_video_offset(void); + void gfx_get_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset); + void gfx_get_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); + unsigned long gfx_get_video_upscale(void); + unsigned long gfx_get_video_scale(void); + unsigned long gfx_get_video_downscale_delta(void); + int gfx_get_video_vertical_downscale_enable(void); + int gfx_get_video_downscale_config(unsigned short *type, + unsigned short *m); + void gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); + void gfx_get_video_downscale_enable(int *enable); + unsigned long gfx_get_video_dst_size(void); + unsigned long gfx_get_video_position(void); + unsigned long gfx_get_video_color_key(void); + unsigned long gfx_get_video_color_key_mask(void); + int gfx_get_video_palette_entry(unsigned long index, + unsigned long *palette); + int gfx_get_video_color_key_src(void); + int gfx_get_video_filter(void); + int gfx_get_video_request(short *x, short *y); + int gfx_get_video_source(VideoSourceType * source); + int gfx_get_vbi_source(VbiSourceType * source); + unsigned long gfx_get_vbi_lines(int odd); + unsigned long gfx_get_vbi_total(int odd); + int gfx_get_video_interlaced(void); + int gfx_get_color_space_YUV(void); + int gfx_get_vertical_scaler_offset(char *offset); + unsigned long gfx_get_genlock_delay(void); + int gfx_get_genlock_enable(void); + int gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); + unsigned long gfx_read_crc(void); + unsigned long gfx_read_crc32(void); + unsigned long gfx_read_window_crc(int source, unsigned short x, + unsigned short y, unsigned short width, + unsigned short height, int crc32); + int gfx_get_macrovision_enable(void); + + void gfx_get_alpha_enable(int *enable); + void gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); + void gfx_get_alpha_value(unsigned char *alpha, char *delta); + void gfx_get_alpha_priority(int *priority); + void gfx_get_alpha_color(unsigned long *color); + +/* ROUTINES IN GFX_VIP.C */ + + int gfx_set_vip_enable(int enable); + int gfx_set_vip_capture_run_mode(int mode); + int gfx_set_vip_base(unsigned long even, unsigned long odd); + int gfx_set_vip_pitch(unsigned long pitch); + int gfx_set_vip_mode(int mode); + int gfx_set_vbi_enable(int enable); + int gfx_set_vbi_mode(int mode); + int gfx_set_vbi_base(unsigned long even, unsigned long odd); + int gfx_set_vbi_pitch(unsigned long pitch); + int gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines); + int gfx_set_vbi_interrupt(int enable); + int gfx_set_vip_bus_request_threshold_high(int enable); + int gfx_set_vip_last_line(int last_line); + int gfx_test_vip_odd_field(void); + int gfx_test_vip_bases_updated(void); + int gfx_test_vip_fifo_overflow(void); + int gfx_get_vip_line(void); + +/* READ ROUTINES IN GFX_VIP.C */ + + int gfx_get_vip_enable(void); + unsigned long gfx_get_vip_base(int odd); + unsigned long gfx_get_vip_pitch(void); + int gfx_get_vip_mode(void); + int gfx_get_vbi_enable(void); + int gfx_get_vbi_mode(void); + unsigned long gfx_get_vbi_base(int odd); + unsigned long gfx_get_vbi_pitch(void); + unsigned long gfx_get_vbi_direct(int odd); + int gfx_get_vbi_interrupt(void); + int gfx_get_vip_bus_request_threshold_high(void); + +/* ROUTINES IN GFX_DCDR.C */ + + int gfx_set_decoder_defaults(void); + int gfx_set_decoder_analog_input(unsigned char input); + int gfx_set_decoder_brightness(unsigned char brightness); + int gfx_set_decoder_contrast(unsigned char contrast); + int gfx_set_decoder_hue(char hue); + int gfx_set_decoder_saturation(unsigned char saturation); + int gfx_set_decoder_input_offset(unsigned short x, unsigned short y); + int gfx_set_decoder_input_size(unsigned short width, + unsigned short height); + int gfx_set_decoder_output_size(unsigned short width, + unsigned short height); + int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); + int gfx_set_decoder_vbi_format(int start, int end, int format); + int gfx_set_decoder_vbi_enable(int enable); + int gfx_set_decoder_vbi_upscale(void); + int gfx_set_decoder_TV_standard(TVStandardType TVStandard); + int gfx_set_decoder_luminance_filter(unsigned char lufi); + int gfx_decoder_software_reset(void); + int gfx_decoder_detect_macrovision(void); + int gfx_decoder_detect_video(void); + +/* READ ROUTINES IN GFX_DCDR.C */ + + unsigned char gfx_get_decoder_brightness(void); + unsigned char gfx_get_decoder_contrast(void); + char gfx_get_decoder_hue(void); + unsigned char gfx_get_decoder_saturation(void); + unsigned long gfx_get_decoder_input_offset(void); + unsigned long gfx_get_decoder_input_size(void); + unsigned long gfx_get_decoder_output_size(void); + int gfx_get_decoder_vbi_format(int line); + +/* ROUTINES IN GFX_I2C.C */ + + int gfx_i2c_reset(unsigned char busnum, short adr, char freq); + int gfx_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, + unsigned char *data); + int gfx_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, + unsigned char *data); + int gfx_i2c_select_gpio(int clock, int data); + int gfx_i2c_init(void); + void gfx_i2c_cleanup(void); + +/* ROUTINES IN GFX_TV.C */ + + int gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution); + int gfx_set_tv_output(int output); + int gfx_set_tv_enable(int enable); + int gfx_set_tv_flicker_filter(int ff); + int gfx_set_tv_sub_carrier_reset(int screset); + int gfx_set_tv_vphase(int vphase); + int gfx_set_tv_YC_delay(int delay); + int gfx_set_tvenc_reset_interval(int interval); + int gfx_set_tv_cc_enable(int enable); + int gfx_set_tv_cc_data(unsigned char data1, unsigned char data2); + int gfx_set_tv_display(int width, int height); + int gfx_test_tvout_odd_field(void); + int gfx_test_tvenc_odd_field(void); + int gfx_set_tv_field_status_invert(int enable); + int gfx_get_tv_vphase(void); + int gfx_get_tv_enable(unsigned int *p_on); + int gfx_get_tv_output(void); + int gfx_get_tv_mode_count(TVStandardType format); + int gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz); + int gfx_get_tv_display_mode_frequency(unsigned short width, + unsigned short height, + TVStandardType format, + int *frequency); + int gfx_is_tv_display_mode_supported(unsigned short width, + unsigned short height, + TVStandardType format); + + int gfx_get_tv_standard(unsigned long *p_standard); + int gfx_get_available_tv_standards(unsigned long *p_standards); + int gfx_set_tv_standard(unsigned long standard); + int gfx_get_tv_vga_mode(unsigned long *p_vga_mode); + int gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes); + int gfx_set_tv_vga_mode(unsigned long vga_mode); + int gfx_get_tvout_mode(unsigned long *p_tvout_mode); + int gfx_set_tvout_mode(unsigned long tvout_mode); + int gfx_get_sharpness(int *p_sharpness); + int gfx_set_sharpness(int sharpness); + int gfx_get_flicker_filter(int *p_flicker); + int gfx_set_flicker_filter(int flicker); + int gfx_get_overscan(int *p_x, int *p_y); + int gfx_set_overscan(int x, int y); + int gfx_get_position(int *p_x, int *p_y); + int gfx_set_position(int x, int y); + int gfx_get_color(int *p_color); + int gfx_set_color(int color); + int gfx_get_brightness(int *p_brightness); + int gfx_set_brightness(int brightness); + int gfx_get_contrast(int *p_contrast); + int gfx_set_contrast(int constrast); + int gfx_get_yc_filter(unsigned int *p_yc_filter); + int gfx_set_yc_filter(unsigned int yc_filter); + int gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits); + int gfx_set_aps_trigger_bits(unsigned int trigger_bits); + +/* ROUTINES IN GFX_VGA.C */ + + int gfx_get_softvga_active(void); + int gfx_vga_test_pci(void); + unsigned char gfx_vga_get_pci_command(void); + int gfx_vga_set_pci_command(unsigned char command); + int gfx_vga_seq_reset(int reset); + int gfx_vga_set_graphics_bits(void); + int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, + int hz); + int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch); + int gfx_vga_save(gfx_vga_struct * vga, int flags); + int gfx_vga_restore(gfx_vga_struct * vga, int flags); + int gfx_vga_mode_switch(int active); + void gfx_vga_clear_extended(void); + +/* CLOSE BRACKET FOR C++ COMPLILATION */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_gfx_rtns_h */ + +/* END OF FILE */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.c:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.c Tue Dec 10 10:12:25 2002 @@ -0,0 +1,940 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ +/* + * $Workfile: gfx_tv.c $ + * + * This file contains routines to program TVOUT and TV encoder. + * + * Routines: + * + * gfx_set_tv_format + * gfx_set_tv_output + * gfx_set_tv_enable + * gfx_set_tv_flicker_filter + * gfx_set_tv_sub_carrier_reset + * gfx_set_tv_vphase + * gfx_set_tv_YC_delay + * gfx_set_tvenc_reset_interval + * gfx_set_tv_cc_enable + * gfx_set_tv_cc_data + * gfx_test_tvout_odd_field + * gfx_test_tvenc_odd_field + * gfx_set_tv_field_status_invert + * gfx_get_tv_vphase + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* TV TIMINGS */ + +DISPLAYMODE TVTimings[] = { + +/* NTSC resolution */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_NTSC, /* NTSC format */ + 640, 640, 656, 744, 792, 792, /* horizontal timings */ + 480, 480, 490, 492, 517, 525, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + } + , + +/* PAL resolution */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_PAL, /* PAL format */ + 768, 768, 800, 848, 864, 864, /* horizontal timings */ + 576, 576, 586, 588, 625, 625, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } + , + +/* NTSC resolution non-square pixels */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_NTSC, /* NTSC format */ + 720, 720, 736, 752, 792, 792, /* horizontal timings */ + 480, 480, 490, 492, 517, 525, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + } + , + +/* PAL resolution non-square pixels */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_PAL, /* PAL format */ + 720, 720, 752, 816, 864, 864, /* horizontal timings */ + 576, 576, 586, 588, 625, 625, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } +}; + +#define NUM_TV_MODES sizeof(TVTimings)/sizeof(DISPLAYMODE) + +/* INCLUDE SUPPORT FOR SC1200 TV ENCODER, IF SPECIFIED */ + +#if GFX_TV_SC1200 +#include "tv_1200.c" +#endif + +/* INCLUDE SUPPORT FOR FS450 TV ENCODER, IF SPECIFIED */ + +#if GFX_TV_FS451 +#include "tv_fs450.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either SC1200 or FS450 TV encoder routines. */ + +#if GFX_TV_DYNAMIC + +/*----------------------------------------------------------------------------- + * gfx_set_tv_format + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_format(format, resolution); +#endif +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_format(format, resolution); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_output + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_output(int output) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_output(output); +#endif +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_output(output); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_enable(int enable) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_enable(enable); +#endif +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_enable(enable); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_flicker_filter + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_flicker_filter(int ff) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_flicker_filter(ff); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_sub_carrier_reset + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_sub_carrier_reset(int screset) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_sub_carrier_reset(screset); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_vphase + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_vphase(int vphase) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_vphase(vphase); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_YC_delay + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_YC_delay(int delay) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_YC_delay(delay); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tvenc_reset_interval + *----------------------------------------------------------------------------- + */ +int +gfx_set_tvenc_reset_interval(int interval) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tvenc_reset_interval(interval); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_cc_enable(int enable) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_cc_enable(enable); +#endif + return (retval); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_cc_data(data1, data2); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_tv_display + * + * Set the timings in the display controller to support a TV resolution. + *--------------------------------------------------------------------------- + */ +int +gfx_set_tv_display(int width, int height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_set_tv_display(width, height); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvout_odd_field + *--------------------------------------------------------------------------- + */ +int +gfx_test_tvout_odd_field(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_test_tvout_odd_field(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvenc_odd_field + *--------------------------------------------------------------------------- + */ +int +gfx_test_tvenc_odd_field(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_test_tvenc_odd_field(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_field_status_invert + *----------------------------------------------------------------------------- + */ +int +gfx_set_tv_field_status_invert(int enable) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_field_status_invert(enable); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_vphase + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_vphase(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_get_tv_vphase(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_enable(unsigned int *p_on) +{ + int retval = -1; + +# if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tv_enable(p_on); +# endif +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_enable(p_on); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_output + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_output() +{ + int retval = -1; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_output(); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_mode_count + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_mode_count(TVStandardType format) +{ + int retval = -1; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_mode_count(format); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) +{ + int retval = -1; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_display_mode(width, height, bpp, hz); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode_frequency + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, + TVStandardType format, int *frequency) +{ + int retval = -1; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = + sc1200_get_tv_display_mode_frequency(width, height, format, + frequency); +# endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_is_tv_display_mode_supported + *--------------------------------------------------------------------------- + */ +int +gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, + TVStandardType format) +{ + int retval = -1; + +# if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_is_tv_display_mode_supported(width, height, format); +# endif + return (retval); +} + +/*------------------------------------------ + * The following functions were added to support + * the FS450 and will eventually be removed. There + * is no equivalent support in the SC1200. + *----------------------------------------------*/ + +/* +// ========================================================================== +// +// TV standard +*/ + +int +gfx_get_tv_standard(unsigned long *p_standard) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tv_standard(p_standard); +#endif + return (retval); +} + +int +gfx_get_available_tv_standards(unsigned long *p_standards) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_available_tv_standards(p_standards); +#endif + return (retval); +} + +int +gfx_set_tv_standard(unsigned long standard) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_standard(standard); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// vga mode as known by the driver +*/ + +int +gfx_get_tv_vga_mode(unsigned long *p_vga_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tv_vga_mode(p_vga_mode); +#endif + return (retval); +} + +int +gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_available_tv_vga_modes(p_vga_modes); +#endif + return (retval); +} + +int +gfx_set_tv_vga_mode(unsigned long vga_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_vga_mode(vga_mode); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// tvout mode +*/ + +int +gfx_get_tvout_mode(unsigned long *p_tvout_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tvout_mode(p_tvout_mode); +#endif + return (retval); +} + +int +gfx_set_tvout_mode(unsigned long tvout_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tvout_mode(tvout_mode); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// Sharpness +*/ +int +gfx_get_sharpness(int *p_sharpness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_sharpness(p_sharpness); +#endif + return (retval); +} + +int +gfx_set_sharpness(int sharpness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_sharpness(sharpness); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// flicker filter control. +*/ + +int +gfx_get_flicker_filter(int *p_flicker) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_flicker_filter(p_flicker); +#endif + return (retval); +} + +int +gfx_set_flicker_filter(int flicker) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_flicker_filter(flicker); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// Overscan and Position +*/ + +int +gfx_get_overscan(int *p_x, int *p_y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_overscan(p_x, p_y); +#endif + return (retval); + +} + +int +gfx_set_overscan(int x, int y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_overscan(x, y); +#endif + return (retval); +} + +int +gfx_get_position(int *p_x, int *p_y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_position(p_x, p_y); +#endif + return (retval); +} + +int +gfx_set_position(int x, int y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_position(x, y); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// Color, Brightness, and Contrast +*/ + +int +gfx_get_color(int *p_color) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_color(p_color); +#endif + return (retval); +} + +int +gfx_set_color(int color) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_color(color); +#endif + return (retval); +} + +int +gfx_get_brightness(int *p_brightness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_brightness(p_brightness); +#endif + return (retval); +} + +int +gfx_set_brightness(int brightness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_brightness(brightness); +#endif + return (retval); +} + +int +gfx_get_contrast(int *p_contrast) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_contrast(p_contrast); +#endif + return (retval); +} + +int +gfx_set_contrast(int contrast) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_contrast(contrast); +#endif + return (retval); +} + +/* +// ========================================================================== +// +// YC filters +*/ + +int +gfx_get_yc_filter(unsigned int *p_yc_filter) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_yc_filter(p_yc_filter); +#endif + return (retval); +} + +int +gfx_set_yc_filter(unsigned int yc_filter) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_yc_filter(yc_filter); +#endif + return (retval); +} + +int +gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_aps_trigger_bits(p_trigger_bits); +#endif + return (retval); +} + +int +gfx_set_aps_trigger_bits(unsigned int trigger_bits) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_aps_trigger_bits(trigger_bits); +#endif + return (retval); +} + +#endif /* GFX_TV_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.h:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.h Tue Dec 10 10:12:26 2002 @@ -0,0 +1,60 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_tv.h,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ + +typedef struct tagTVDISPLAYMODE +{ + /* DISPLAY MODE FLAGS */ + /* Specify valid color depths and the refresh rate. */ + + unsigned short flags; + + /* TIMINGS */ + + unsigned short hactive; + unsigned short hblankstart; + unsigned short hsyncstart; + unsigned short hsyncend; + unsigned short hblankend; + unsigned short htotal; + + unsigned short vactive; + unsigned short vblankstart; + unsigned short vsyncstart; + unsigned short vsyncend; + unsigned short vblankend; + unsigned short vtotal; + + /* CLOCK FREQUENCY */ + + unsigned long frequency; + +} +TVDISPLAYMODE; + +TVDISPLAYMODE TVTimings[] = { + +/* NTSC resolution */ + { + 0x3, /* negative syncs */ + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0318, /* horizontal timings */ + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + }, + +/* PAL resolution */ + { + 0x3, /* positive syncs */ + 0x0300, 0x0300, 0x0320, 0x0350, 0x0360, 0x0360, /* horizontal timings */ + 0x0240, 0x0240, 0x024A, 0x024C, 0x0271, 0x0271, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + }, + +/* PAL resolution non-square pixels */ + { + 0x3, /* positive syncs */ + 0x02C0, 0x02C0, 0x02F0, 0x0330, 0x0360, 0x0360, /* horizontal timings */ + 0x0240, 0x0240, 0x024A, 0x024C, 0x0271, 0x0271, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } +}; + +#define NUM_TV_MODES sizeof(TVTimings)/sizeof(TVDISPLAYMODE) Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_type.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_type.h:1.1 --- /dev/null Thu Feb 27 12:31:14 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_type.h Tue Dec 10 10:12:26 2002 @@ -0,0 +1,439 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_type.h,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ +/* + * $Workfile: gfx_type.h $ + * + * This header file defines the pneumonics used when calling Durango routines. + * This file is automatically included by gfx_rtns.h + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _gfx_type_h +#define _gfx_type_h + +/* MSR DEFINITIONS */ + +typedef enum DevStatus +{ FOUND, NOT_KNOWN, REQ_NOT_FOUND, REQ_NOT_INSTALLED } +DEV_STATUS; + +typedef struct msr +{ + DEV_STATUS Present; /* Node enumeration status */ + unsigned char Id; /* Device ID (from MSR specs) */ + unsigned long Address; /* Address - 32-bit MBus address at which 'Id' is found */ +} +MSR; + +typedef struct mValue +{ + unsigned long high; + unsigned long low; +} +Q_WORD; + +typedef struct mbusNode +{ + unsigned long address; + unsigned int deviceId; + unsigned int claimed; +} +MBUS_NODE; + +/* MSR ARRAY INDEXES */ +/* These are indexes into the array of MBus devices. These */ +/* should not be confused with the class codes at MSR register */ +/* 0x2000. */ + +#define RC_ID_MBIU0 0x00 +#define RC_ID_MBIU1 0x01 +#define RC_ID_MCP 0x02 +#define RC_ID_MPCI 0x03 +#define RC_ID_MC 0x04 +#define RC_ID_GP 0x05 +#define RC_ID_VG 0x06 +#define RC_ID_DF 0x07 +#define RC_ID_FG 0x08 +#define RC_ID_VA 0x09 +#define CP_ID_MBIU 0x0A +#define CP_ID_MPCI 0x0B +#define CP_ID_USB2 0x0C +#define CP_ID_ATAC 0x0D +#define CP_ID_MDD 0x0E +#define CP_ID_ACC 0x0F +#define CP_ID_USB1 0x10 +#define CP_ID_MCP 0x11 + +/* MBUS DEVICE CLASS CODES */ +/* These are the device ids for the known Redcloud MBus devices. */ + +#define RC_CC_MBIU 0x01 +#define RC_CC_MCP 0x02 +#define RC_CC_MPCI 0x05 +#define RC_CC_MC 0x20 +#define RC_CC_GP 0x3D +#define RC_CC_VG 0x3E +#define RC_CC_DF 0x3F +#define RC_CC_FG 0xF0 +#define RC_CC_VA 0x86 +#define CP_CC_MBIU 0x01 +#define CP_CC_MPCI 0x05 +#define CP_CC_USB2 0x42 +#define CP_CC_ATAC 0x47 +#define CP_CC_MDD 0xDF +#define CP_CC_ACC 0x33 +#define CP_CC_USB1 0x42 +#define CP_CC_MCP 0x02 + +/* VAIL AND MBIUS ARE AT KNOWN ADDRESSES */ +/* We can initialize the addresses of these devices in advance, */ +/* as their location should never change. */ + +#define RC_MB0_MBIU0 0x10000000 +#define RC_MB0_MBIU1 0x40000000 +#define CP_MB0_MBIU0 0x51010000 +#define RC_MB0_CPU 0x00000000 +#define FAKE_ADDRESS 0xFFFFFFFF + +/* MSR PORT DESCRIPTORS */ + +#define NOT_POPULATED 0 +#define NOT_INSTALLED 0xFFFE +#define REFLECTIVE 0xFFFF + +/* CRC DATA SOURCES */ + +#define CRC_SOURCE_GFX_DATA 0x00 +#define CRC_SOURCE_CRT_RGB 0x01 +#define CRC_SOURCE_FP_DATA 0x02 + +/* TV DEFINITIONS */ + +typedef enum TVStandardType +{ + TV_STANDARD_NTSC = 1, + TV_STANDARD_PAL +} +TVStandardType; + +typedef enum GfxOnTVType +{ + GFX_ON_TV_SQUARE_PIXELS = 1, + GFX_ON_TV_NO_SCALING +} +GfxOnTVType; + +#define CRT_DISABLE 0x00 +#define CRT_ENABLE 0x01 +#define CRT_STANDBY 0x02 +#define CRT_SUSPEND 0x03 + +#define TV_OUTPUT_COMPOSITE 0x01 +#define TV_OUTPUT_S_VIDEO 0x02 +#define TV_OUTPUT_YUV 0x03 +#define TV_OUTPUT_SCART 0x04 + +#define TV_FLICKER_FILTER_NONE 0x01 +#define TV_FLICKER_FILTER_NORMAL 0x02 +#define TV_FLICKER_FILTER_INTERLACED 0x03 + +#define TV_YC_DELAY_NONE 0x01 +#define TV_Y_DELAY_ONE_PIXEL 0x02 +#define TV_C_DELAY_ONE_PIXEL 0x03 +#define TV_C_DELAY_TWO_PIXELS 0x04 + +#define TV_SUB_CARRIER_RESET_NEVER 0x01 +#define TV_SUB_CARRIER_RESET_EVERY_TWO_LINES 0x02 +#define TV_SUB_CARRIER_RESET_EVERY_TWO_FRAMES 0x03 +#define TV_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES 0x04 + +#define TVENC_RESET_EVERY_ODD_FIELD 0x01 +#define TVENC_RESET_EVERY_EVEN_FIELD 0x02 +#define TVENC_RESET_NEXT_ODD_FIELD 0x03 +#define TVENC_RESET_NEXT_EVEN_FIELD 0x04 +#define TVENC_RESET_EVERY_FIELD 0x05 +#define TVENC_RESET_EVERY_X_ODD_FIELDS 0x06 +#define TVENC_RESET_EVERY_X_EVEN_FIELDS 0x07 + +/* VBI FORMATS */ + +#define VBI_FORMAT_VIDEO 0x1 +#define VBI_FORMAT_RAW 0x2 +#define VBI_FORMAT_CC 0x4 +#define VBI_FORMAT_NABTS 0x8 + +/* VIDEO DEFINITIONS */ + +#define VIDEO_FORMAT_UYVY 0x0 +#define VIDEO_FORMAT_Y2YU 0x1 +#define VIDEO_FORMAT_YUYV 0x2 +#define VIDEO_FORMAT_YVYU 0x3 +#define VIDEO_FORMAT_Y0Y1Y2Y3 0x4 +#define VIDEO_FORMAT_Y3Y2Y1Y0 0x5 +#define VIDEO_FORMAT_Y1Y0Y3Y2 0x6 +#define VIDEO_FORMAT_Y1Y2Y3Y0 0x7 +#define VIDEO_FORMAT_RGB 0x8 +#define VIDEO_FORMAT_P2M_P2L_P1M_P1L 0x9 +#define VIDEO_FORMAT_P1M_P1L_P2M_P2L 0xA +#define VIDEO_FORMAT_P1M_P2L_P2M_P1L 0xB + +#define VIDEO_DOWNSCALE_KEEP_1_OF 0x1 +#define VIDEO_DOWNSCALE_DROP_1_OF 0x2 + +typedef enum VideoSourceType +{/* The source from which the video processor shows full screen video */ + VIDEO_SOURCE_MEMORY = 1, + VIDEO_SOURCE_DVIP +} +VideoSourceType; + +typedef enum VbiSourceType +{/* The source from which the video processor takes VBI */ + VBI_SOURCE_MEMORY = 1, + VBI_SOURCE_DVIP +} +VbiSourceType; + +/* GENLOCK DEFINITIONS */ + +#define GENLOCK_SINGLE 0x001 +#define GENLOCK_FIELD_SYNC 0x001 +#define GENLOCK_CONTINUOUS 0x002 +#define GENLOCK_SYNCED_EDGE_FALLING 0x004 +#define GENLOCK_SYNCING_EDGE_FALLING 0x008 +#define GENLOCK_TIMEOUT 0x010 +#define GENLOCK_TVENC_RESET_EVEN_FIELD 0x020 +#define GENLOCK_TVENC_RESET_BEFORE_DELAY 0x040 +#define GENLOCK_TVENC_RESET 0x080 +#define GENLOCK_SYNC_TO_TVENC 0x100 + +/* VIP DEFINITIONS */ + +#define VIP_MODE_C 0x1 + +#define VIP_CAPTURE_STOP_LINE 0x1 +#define VIP_CAPTURE_STOP_FIELD 0x2 +#define VIP_CAPTURE_START_FIELD 0x4 + +#define VBI_ANCILLARY 0x1 +#define VBI_TASK_A 0x2 +#define VBI_TASK_B 0x4 + +/* VGA STRUCTURE */ + +#define GFX_STD_CRTC_REGS 25 +#define GFX_EXT_CRTC_REGS 16 + +#define GFX_VGA_FLAG_MISC_OUTPUT 0x00000001 +#define GFX_VGA_FLAG_STD_CRTC 0x00000002 +#define GFX_VGA_FLAG_EXT_CRTC 0x00000004 + +/* FS450 TV Standard flags */ + +#define GFX_TV_STANDARD_NTSC_M 0x0001 +#define GFX_TV_STANDARD_NTSC_M_J 0x0002 +#define GFX_TV_STANDARD_PAL_B 0x0004 +#define GFX_TV_STANDARD_PAL_D 0x0008 +#define GFX_TV_STANDARD_PAL_H 0x0010 +#define GFX_TV_STANDARD_PAL_I 0x0020 +#define GFX_TV_STANDARD_PAL_M 0x0040 +#define GFX_TV_STANDARD_PAL_N 0x0080 +#define GFX_TV_STANDARD_PAL_G 0x0100 + +/* FS450 VGA Mode flags */ + +#define GFX_VGA_MODE_UNKNOWN 0 +#define GFX_VGA_MODE_640X480 0x0001 +#define GFX_VGA_MODE_720X487 0x0002 +#define GFX_VGA_MODE_720X576 0x0004 +#define GFX_VGA_MODE_800X600 0x0008 +#define GFX_VGA_MODE_1024X768 0x0010 + +/* FS450 TVout mode flags */ + +#define GFX_TVOUT_MODE_CVBS 0x0001 +#define GFX_TVOUT_MODE_YC 0x0002 +#define GFX_TVOUT_MODE_RGB 0x0004 +#define GFX_TVOUT_MODE_CVBS_YC (GFX_TVOUT_MODE_CVBS | GFX_TVOUT_MODE_YC) + +/* FS450 Luma and Chroma Filters */ + +#define GFX_LUMA_FILTER 0x0001 +#define GFX_CHROMA_FILTER 0x0002 + +/* APS Trigger Bits */ + +#define GFX_APS_TRIGGER_OFF 0 +#define GFX_APS_TRIGGER_AGC_ONLY 1 +#define GFX_APS_TRIGGER_AGC_2_LINE 2 +#define GFX_APS_TRIGGER_AGC_4_LINE 3 + +typedef struct +{ + int xsize; + int ysize; + int hz; + int clock; + unsigned char miscOutput; + unsigned char stdCRTCregs[GFX_STD_CRTC_REGS]; + unsigned char extCRTCregs[GFX_EXT_CRTC_REGS]; +} +gfx_vga_struct; + +/* POSSIBLE STATUS VALUES */ + +#define GFX_STATUS_UNSUPPORTED (-3) +#define GFX_STATUS_BAD_PARAMETER (-2) +#define GFX_STATUS_ERROR (-1) +#define GFX_STATUS_OK 0 + +/* CPU AND VIDEO TYPES */ + +#define GFX_CPU_GXLV 1 +#define GFX_CPU_SC1200 2 +#define GFX_CPU_REDCLOUD 3 +#define GFX_CPU_PYRAMID 0x20801 + +#define GFX_VID_CS5530 1 +#define GFX_VID_SC1200 2 +#define GFX_VID_REDCLOUD 3 + +/* CHIP NAME AND REVISION */ + +typedef enum ChipType +{ + CHIP_NOT_DETECTED, + SC1200_REV_A, + SC1200_REV_B1_B2, + SC1200_REV_B3, + SC1200_REV_C1, + SC1200_REV_D1, + SC1200_REV_D1_1, + SC1200_REV_D2_MVD, /* Macrovision disabled */ + SC1200_REV_D2_MVE, /* Macrovision enabled */ + SC1200_FUTURE_REV +} +ChipType; + +#endif /* !_gfx_type_h */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vga.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vga.c Tue Dec 10 10:12:26 2002 @@ -0,0 +1,146 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vga.c,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ +/* + * $Workfile: gfx_vga.c $ + * + * This file contains routines to interface to the VGA registers. Some + * operating systems require mode sets be done through VGA, rather than + * directly using the "gfx_set_display_mode" routine. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_VGA_GU1 +#include "vga_gu1.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_VGA_DYNAMIC + +#endif /* GFX_DISPLAY_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vid.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vid.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vid.c Tue Dec 10 10:12:26 2002 @@ -0,0 +1,2127 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vid.c,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ +/* + * $Workfile: gfx_vid.c $ + * + * This file contains routines to control the video overlay window. + * + * Video overlay routines: + * + * gfx_set_clock_frequency + * gfx_set_crt_enable + * gfx_set_video_enable + * gfx_set_video_format + * gfx_set_video_size + * gfx_set_video_offset + * gfx_set_video_yuv_offsets + * gfx_set_video_yuv_pitch + * gfx_set_video_scale + * gfx_set_video_upscale + * gfx_set_video_downscale_config + * gfx_set_video_downscale_coefficients + * gfx_set_video_downscale_enable + * gfx_set_video_vertical_downscale + * gfx_set_video_vertical_downscale_enable + * gfx_set_video_window + * gfx_set_video_left_crop + * gfx_set_video_color_key + * gfx_set_video_filter + * gfx_set_video_palette + * gfx_set_video_request + * gfx_set_video_source + * gfx_set_vbi_source + * gfx_set_vbi_lines + * gfx_set_vbi_total + * gfx_set_video_interlaced + * gfx_set_color_space_YUV + * gfx_set_vertical_scaler_offset + * gfx_set_top_line_in_odd + * gfx_set_genlock_delay + * gfx_set_genlock_enable + * gfx_set_video_cursor + * gfx_set_video_cursor_enable + * + * Alpha blending routines (SC1200 ONLY): + * + * gfx_select_alpha_region + * gfx_set_alpha_enable + * gfx_set_alpha_window + * gfx_set_alpha_value + * gfx_set_alpha_priority + * gfx_set_alpha_color + * gfx_set_alpha_color_enable + * gfx_set_no_ck_outside_alpha + * gfx_test_tvout_odd_field + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_sync_polarities + * gfx_get_video_enable + * gfx_get_video_format + * gfx_get_video_src_size + * gfx_get_video_line_size + * gfx_get_video_xclip + * gfx_get_video_offset + * gfx_get_video_yuv_offsets + * gfx_get_video_yuv_pitch + * gfx_get_video_scale + * gfx_get_video_upscale + * gfx_get_video_downscale_config + * gfx_get_video_downscale_coefficients + * gfx_get_video_downscale_enable + * gfx_get_video_downscale_delta + * gfx_get_video_vertical_downscale_enable + * gfx_get_video_dst_size + * gfx_get_video_position + * gfx_get_video_color_key + * gfx_get_video_color_key_mask + * gfx_get_video_color_key_src + * gfx_get_video_filter + * gfx_get_video_request + * gfx_get_video_source + * gfx_get_vbi_source + * gfx_get_vbi_lines + * gfx_get_vbi_total + * gfx_get_video_interlaced + * gfx_get_color_space_YUV + * gfx_get_vertical_scaler_offset + * gfx_get_genlock_delay + * gfx_get_genlock_enable + * gfx_get_video_cursor + * gfx_get_clock_frequency + * gfx_read_crc + * + * Alpha blending read routines (SC1200 ONLY): + * + * gfx_get_alpha_enable + * gfx_get_alpha_size + * gfx_get_alpha_value + * gfx_get_alpha_priority + * gfx_get_alpha_color + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* STATIC VARIABLES FOR VIDEO OVERLAY CONTROL */ +/* These are saved to allow these routines to do clipping. */ + +unsigned long gfx_vid_offset = 0; /* copy from last gfx_set_video_offset */ +unsigned long gfx_vid_uoffset = 0; /* copy from last gfx_set_video_yuv_offsets */ +unsigned long gfx_vid_voffset = 0; /* copy from last gfx_set_video_yuv_offsets */ +unsigned long gfx_vid_srcw = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_srch = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_dstw = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_dsth = 300; /* copy from last gfx_set_video_scale */ +short gfx_vid_xpos = 0; /* copy from last gfx_set_video_window */ +short gfx_vid_ypos = 0; /* copy from last gfx_set_video_window */ +unsigned short gfx_vid_width = 0; /* copy from last gfx_set_video_window */ +unsigned short gfx_vid_height = 0; /* copy from last gfx_set_video_window */ + +int gfx_alpha_select = 0; /* currently selected alpha region */ + +int gfx_set_screen_enable(int enable); /* forward declaration */ + +/* INCLUDE SUPPORT FOR CS5530, IF SPECIFIED. */ + +#if GFX_VIDEO_CS5530 +#include "vid_5530.c" +#endif + +/* INCLUDE SUPPORT FOR SC1200, IF SPECIFIED. */ + +#if GFX_VIDEO_SC1200 +#include "vid_1200.c" +#endif + +/* INLUDE SUPPORT FOR REDCLOUD, IF SPECIFIED. */ + +#if GFX_VIDEO_REDCLOUD +#include "vid_rdcl.c" +#endif + +/*--------------------------------------------------------------------------- + * gfx_select_alpha_region + * + * This routine selects which alpha region should be used for future + * updates. The SC1200, for example, has 3 alpha windows available, + * so valid parameter values are 0..2. + *--------------------------------------------------------------------------- + */ +int +gfx_select_alpha_region(int region) +{ + if (region > 2) + return (GFX_STATUS_BAD_PARAMETER); + + gfx_alpha_select = region; + return (GFX_STATUS_OK); +} + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either CS5530 or SC1200 routines. */ + +#if GFX_VIDEO_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +void +gfx_reset_video(void) +{ +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + cs5530_reset_video(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_reset_video(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_reset_video(); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to configure the display output during a modeset + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_control(int sync_polarities) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_display_control(sync_polarities); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_display_control(sync_polarities); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_display_control(sync_polarities); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_clock_frequency + *----------------------------------------------------------------------------- + */ +void +gfx_set_clock_frequency(unsigned long frequency) +{ +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + cs5530_set_clock_frequency(frequency); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_set_clock_frequency(frequency); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_set_clock_frequency(frequency); +# endif +} + +/*----------------------------------------------------------------------------- + * gfx_set_crt_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_crt_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_crt_enable(enable); +# endif +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_crt_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_crt_enable(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_video_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_enable(enable); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_screen_enable (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine enables or disables the graphics display logic of the video processor. + *--------------------------------------------------------------------------- + */ +int +gfx_set_screen_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_screen_enable(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_format + *----------------------------------------------------------------------------- + */ +int +gfx_set_video_format(unsigned long format) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_format(format); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_format(format); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_format(format); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_size + *----------------------------------------------------------------------------- + */ +int +gfx_set_video_size(unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_size(width, height); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_size(width, height); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_size(width, height); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_yuv_pitch + *----------------------------------------------------------------------------- + */ +int +gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_yuv_pitch(ypitch, uvpitch); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_offset + *----------------------------------------------------------------------------- + */ +int +gfx_set_video_offset(unsigned long offset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_offset(offset); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_offset(offset); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_offset(offset); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_yuv_offsets + *----------------------------------------------------------------------------- + */ +int +gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_yuv_offsets(yoffset, uoffset, voffset); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_scale(srcw, srch, dstw, dsth); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_scale(srcw, srch, dstw, dsth); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_scale(srcw, srch, dstw, dsth); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_upscale + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_upscale(srcw, srch, dstw, dsth); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_vertical_downscale(srch, dsth); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale_enable + *--------------------------------------------------------------------------- + */ +void +gfx_set_video_vertical_downscale_enable(int enable) +{ +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_set_video_vertical_downscale_enable(enable); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_config + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_downscale_config(unsigned short type, unsigned short m) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_downscale_config(type, m); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_downscale_config(type, m); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_coefficients + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = + sc1200_set_video_downscale_coefficients(coef1, coef2, coef3, + coef4); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = + redcloud_set_video_downscale_coefficients(coef1, coef2, coef3, + coef4); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_downscale_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_downscale_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_downscale_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_window(x, y, w, h); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_window(x, y, w, h); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_window(x, y, w, h); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_left_crop(unsigned short x) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_left_crop(x); +# endif +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_left_crop(x); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_left_crop(x); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_color_key(key, mask, graphics); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_color_key(key, mask, graphics); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_color_key(key, mask, graphics); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_filter(int xfilter, int yfilter) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_filter(xfilter, yfilter); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_filter(xfilter, yfilter); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_filter(xfilter, yfilter); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_palette(unsigned long *palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_palette(palette); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_palette(palette); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_palette(palette); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_palette_entry(index, palette); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_palette_entry(index, palette); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_palette_entry(index, palette); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_request + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_request(short x, short y) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_request(x, y); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_request(x, y); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_source + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_source(VideoSourceType source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_source(source); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_source + *--------------------------------------------------------------------------- + */ +int +gfx_set_vbi_source(VbiSourceType source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vbi_source(source); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_lines + *--------------------------------------------------------------------------- + */ +int +gfx_set_vbi_lines(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vbi_lines(even, odd); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_total + *--------------------------------------------------------------------------- + */ +int +gfx_set_vbi_total(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vbi_total(even, odd); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_interlaced + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_interlaced(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_interlaced(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_color_space_YUV + *--------------------------------------------------------------------------- + */ +int +gfx_set_color_space_YUV(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_color_space_YUV(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vertical_scaler_offset + *--------------------------------------------------------------------------- + */ +int +gfx_set_vertical_scaler_offset(char offset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vertical_scaler_offset(offset); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_top_line_in_odd + *--------------------------------------------------------------------------- + */ +int +gfx_set_top_line_in_odd(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_top_line_in_odd(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_delay + *--------------------------------------------------------------------------- + */ +int +gfx_set_genlock_delay(unsigned long delay) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_genlock_delay(delay); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_genlock_enable(int flags) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_genlock_enable(flags); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, + unsigned long color2) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = + sc1200_set_video_cursor(key, mask, select_color2, color1, color2); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = + redcloud_set_video_cursor(key, mask, select_color2, color1, + color2); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_cursor_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_cursor_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_window + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_window(x, y, width, height); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_window(x, y, width, height); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_value + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_value(unsigned char alpha, char delta) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_value(alpha, delta); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_value(alpha, delta); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_priority + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_priority(int priority) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_priority(priority); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_priority(priority); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_color(unsigned long color) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_color(color); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_color(color); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_color_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_color_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_color_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_no_ck_outside_alpha + *--------------------------------------------------------------------------- + */ +int +gfx_set_no_ck_outside_alpha(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_no_ck_outside_alpha(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_no_ck_outside_alpha(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_macrovision_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_macrovision_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_macrovision_enable(enable); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_disable_softvga + *--------------------------------------------------------------------------- + */ +int +gfx_disable_softvga(void) +{ + int status = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_disable_softvga(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_disable_softvga(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_softvga + *--------------------------------------------------------------------------- + */ +int +gfx_enable_softvga(void) +{ + int status = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_enable_softvga(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_enable_softvga(); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_clock_frequency(void) +{ + unsigned long frequency = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + frequency = cs5530_get_clock_frequency(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + frequency = sc1200_get_clock_frequency(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + frequency = redcloud_get_clock_frequency(); +# endif + return (frequency); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_vsa2_softvga_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_vsa2_softvga_enable(void) +{ + int enable = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + enable = cs5530_get_vsa2_softvga_enable(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_vsa2_softvga_enable(); +# endif + return enable; + +} + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + *--------------------------------------------------------------------------- + */ +int +gfx_get_sync_polarities(void) +{ + int polarities = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + polarities = cs5530_get_sync_polarities(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + polarities = sc1200_get_sync_polarities(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + polarities = redcloud_get_sync_polarities(); +# endif + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_get_video_palette_entry(index, palette); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_palette_entry(index, palette); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_get_video_palette_entry(index, palette); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_enable + *----------------------------------------------------------------------------- + */ +int +gfx_get_video_enable(void) +{ + int enable = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + enable = cs5530_get_video_enable(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_video_enable(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + enable = redcloud_get_video_enable(); +# endif + return (enable); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_format + *----------------------------------------------------------------------------- + */ +int +gfx_get_video_format(void) +{ + int format = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + format = cs5530_get_video_format(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + format = sc1200_get_video_format(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + format = redcloud_get_video_format(); +# endif + return (format); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_src_size + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_src_size(void) +{ + unsigned long size = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_src_size(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_src_size(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_src_size(); +# endif + return (size); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_line_size + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_line_size(void) +{ + unsigned long size = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_line_size(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_line_size(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_line_size(); +# endif + return (size); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_xclip + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_xclip(void) +{ + unsigned long size = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_xclip(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_xclip(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_xclip(); +# endif + return (size); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_offset + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_offset(void) +{ + unsigned long offset = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + offset = cs5530_get_video_offset(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + offset = sc1200_get_video_offset(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + offset = redcloud_get_video_offset(); +# endif + return (offset); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_yuv_offsets + *----------------------------------------------------------------------------- + */ +void +gfx_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, + unsigned long *voffset) +{ +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_yuv_offsets(yoffset, uoffset, voffset); +# endif +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_yuv_pitch + *----------------------------------------------------------------------------- + */ +void +gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +{ +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_yuv_pitch(ypitch, uvpitch); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_upscale + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_upscale(void) +{ + unsigned long scale = 0; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + scale = sc1200_get_video_upscale(); +# endif + return (scale); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_scale(void) +{ + unsigned long scale = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + scale = cs5530_get_video_scale(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + scale = sc1200_get_video_scale(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + scale = redcloud_get_video_scale(); +# endif + return (scale); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_delta + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_downscale_delta(void) +{ + unsigned long delta = 0; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + delta = redcloud_get_video_downscale_delta(); +# endif + return (delta); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_vertical_downscale_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_vertical_downscale_enable(void) +{ + int enable = 0; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + enable = redcloud_get_video_vertical_downscale_enable(); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_config + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_downscale_config(type, m); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_get_video_downscale_config(type, m); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_coefficients + *--------------------------------------------------------------------------- + */ +void +gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_video_downscale_coefficients(coef1, coef2, coef3, coef4); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_downscale_coefficients(coef1, coef2, coef3, coef4); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_enable + *--------------------------------------------------------------------------- + */ +void +gfx_get_video_downscale_enable(int *enable) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_video_downscale_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_downscale_enable(enable); +# endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_dst_size(void) +{ + unsigned long size = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_dst_size(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_dst_size(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_dst_size(); +# endif + return (size); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_position(void) +{ + unsigned long position = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + position = cs5530_get_video_position(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + position = sc1200_get_video_position(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + position = redcloud_get_video_position(); +# endif + return (position); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_color_key(void) +{ + unsigned long key = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + key = cs5530_get_video_color_key(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + key = sc1200_get_video_color_key(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + key = redcloud_get_video_color_key(); +# endif + return (key); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_color_key_mask(void) +{ + unsigned long mask = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + mask = cs5530_get_video_color_key_mask(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + mask = sc1200_get_video_color_key_mask(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + mask = redcloud_get_video_color_key_mask(); +# endif + return (mask); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_color_key_src(void) +{ + int src = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + src = cs5530_get_video_color_key_src(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + src = sc1200_get_video_color_key_src(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + src = redcloud_get_video_color_key_src(); +# endif + return (src); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_filter(void) +{ + int filter = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + filter = cs5530_get_video_filter(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + filter = sc1200_get_video_filter(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + filter = redcloud_get_video_filter(); +# endif + return (filter); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_request + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_request(short *x, short *y) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_request(x, y); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_get_video_request(x, y); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_source + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_source(VideoSourceType * source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_source(source); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_source + *--------------------------------------------------------------------------- + */ +int +gfx_get_vbi_source(VbiSourceType * source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_vbi_source(source); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_lines + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_lines(int odd) +{ + unsigned long lines = (unsigned long)GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + lines = sc1200_get_vbi_lines(odd); +# endif + return (lines); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_total + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_total(int odd) +{ + unsigned long total = (unsigned long)GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + total = sc1200_get_vbi_total(odd); +# endif + return (total); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_interlaced + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_interlaced(void) +{ + int interlaced = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + interlaced = sc1200_get_video_interlaced(); +# endif + return (interlaced); +} + +/*--------------------------------------------------------------------------- + * gfx_get_color_space_YUV + *--------------------------------------------------------------------------- + */ +int +gfx_get_color_space_YUV(void) +{ + int color_space = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + color_space = sc1200_get_color_space_YUV(); +# endif + return (color_space); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vertical_scaler_offset + *--------------------------------------------------------------------------- + */ +int +gfx_get_vertical_scaler_offset(char *offset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_vertical_scaler_offset(offset); +# endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_delay + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_genlock_delay(void) +{ + unsigned long delay = (unsigned long)GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + delay = sc1200_get_genlock_delay(); +# endif + return (delay); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_genlock_enable(void) +{ + int enable = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_genlock_enable(); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_cursor + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +{ + int enable = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = + sc1200_get_video_cursor(key, mask, select_color2, color1, color2); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + enable = + redcloud_get_video_cursor(key, mask, select_color2, color1, + color2); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_read_crc(void) +{ + unsigned long crc = 0; + +# if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + crc = cs5530_read_crc(); +# endif +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + crc = sc1200_read_crc(); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + crc = redcloud_read_crc(); +# endif + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc32 + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_read_crc32(void) +{ + unsigned long crc = 0; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + crc = redcloud_read_crc32(); +# endif + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_window_crc + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, int crc32) +{ + unsigned long crc = 0; + +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + crc = redcloud_read_window_crc(source, x, y, width, height, crc32); +# endif + return (crc); +} + +/*----------------------------------------------------------------------------- + * gfx_get_macrovision_enable + *----------------------------------------------------------------------------- + */ +int +gfx_get_macrovision_enable(void) +{ + int enable = 0; + +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_video_enable(); +# endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_enable + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_enable(int *enable) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_enable(enable); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_enable(enable); +# endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_size + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_size(x, y, width, height); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_size(x, y, width, height); +# endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_value + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_value(unsigned char *alpha, char *delta) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_value(alpha, delta); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_value(alpha, delta); +# endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_priority + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_priority(int *priority) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_priority(priority); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_priority(priority); +# endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_color + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_color(unsigned long *color) +{ +# if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_color(color); +# endif +# if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_color(color); +# endif + return; +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_VIDEO_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vip.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vip.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vip.c Tue Dec 10 10:12:26 2002 @@ -0,0 +1,632 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_vip.c,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ +/* + * $Workfile: gfx_vip.c $ + * + * This file contains routines to control the video input port (VIP). + * + * gfx_set_vip_enable + * gfx_set_vip_capture_run_mode + * gfx_set_vip_base + * gfx_set_vip_pitch + * gfx_set_vip_mode + * gfx_set_vbi_enable + * gfx_set_vbi_mode + * gfx_set_vbi_base + * gfx_set_vbi_pitch + * gfx_set_vbi_direct + * gfx_set_vbi_interrupt + * gfx_set_vip_bus_request_threshold_high + * gfx_set_vip_last_line + * gfx_test_vip_odd_field + * gfx_test_vip_bases_updated + * gfx_test_vip_fifo_overflow + * gfx_get_vip_line + * gfx_get_vip_base + * gfx_get_vbi_pitch + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_vip_enable + * gfx_get_vip_pitch + * gfx_get_vip_mode + * gfx_get_vbi_enable + * gfx_get_vbi_mode + * gfx_get_vbi_base + * gfx_get_vbi_direct + * gfx_get_vbi_interrupt + * gfx_get_vip_bus_request_threshold_high + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* INCLUDE SUPPORT FOR SC1200, IF SPECIFIED. */ + +#if GFX_VIP_SC1200 +#include "vip_1200.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either CS5530 or SC1200 routines. */ + +#if GFX_VIP_DYNAMIC + +/*----------------------------------------------------------------------------- + * gfx_set_vip_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_enable(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_capture_run_mode + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_capture_run_mode(int mode) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_capture_run_mode(mode); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_base + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_base(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_base(even, odd); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_pitch + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_pitch(unsigned long pitch) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_pitch(pitch); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_mode + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_mode(int mode) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_mode(mode); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_enable + *----------------------------------------------------------------------------- + */ +int +gfx_set_vbi_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_enable(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_mode + *----------------------------------------------------------------------------- + */ +int +gfx_set_vbi_mode(int mode) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_mode(mode); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_base + *----------------------------------------------------------------------------- + */ +int +gfx_set_vbi_base(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_base(even, odd); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_pitch + *----------------------------------------------------------------------------- + */ +int +gfx_set_vbi_pitch(unsigned long pitch) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_pitch(pitch); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_direct + *----------------------------------------------------------------------------- + */ +int +gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_direct(even_lines, odd_lines); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_interrupt + *----------------------------------------------------------------------------- + */ +int +gfx_set_vbi_interrupt(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_interrupt(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_bus_request_threshold_high + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_bus_request_threshold_high(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_bus_request_threshold_high(enable); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_last_line + *----------------------------------------------------------------------------- + */ +int +gfx_set_vip_last_line(int last_line) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_last_line(last_line); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_test_vip_odd_field + *----------------------------------------------------------------------------- + */ +int +gfx_test_vip_odd_field(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_test_vip_odd_field(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_test_vip_bases_updated + *----------------------------------------------------------------------------- + */ +int +gfx_test_vip_bases_updated(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_test_vip_bases_updated(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_test_vip_fifo_overflow + *----------------------------------------------------------------------------- + */ +int +gfx_test_vip_fifo_overflow(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_test_vip_fifo_overflow(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_line + *----------------------------------------------------------------------------- + */ +int +gfx_get_vip_line(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_get_vip_line(); +# endif + return (status); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vip_base(int odd) +{ + unsigned long base = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + base = sc1200_get_vip_base(odd); +# endif + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_pitch + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_pitch(void) +{ + unsigned long pitch = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + pitch = sc1200_get_vbi_pitch(); +# endif + return (pitch); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*----------------------------------------------------------------------------- + * gfx_get_vip_enable + *----------------------------------------------------------------------------- + */ +int +gfx_get_vip_enable(void) +{ + int enable = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vip_enable(); +# endif + return (enable); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_pitch + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vip_pitch(void) +{ + unsigned long pitch = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + pitch = sc1200_get_vip_pitch(); +# endif + return (pitch); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_mode + *----------------------------------------------------------------------------- + */ +int +gfx_get_vip_mode(void) +{ + int mode = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + mode = sc1200_get_vip_mode(); +# endif + return (mode); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_enable + *----------------------------------------------------------------------------- + */ +int +gfx_get_vbi_enable(void) +{ + int enable = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vbi_enable(); +# endif + return (enable); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_mode + *----------------------------------------------------------------------------- + */ +int +gfx_get_vbi_mode(void) +{ + int mode = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + mode = sc1200_get_vbi_mode(); +# endif + return (mode); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_base + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_base(int odd) +{ + unsigned long base = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + base = sc1200_get_vbi_base(odd); +# endif + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_direct + *----------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_direct(int odd) +{ + unsigned long vbi_direct_lines = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + vbi_direct_lines = sc1200_get_vbi_direct(odd); +# endif + return (vbi_direct_lines); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_interrupt + *----------------------------------------------------------------------------- + */ +int +gfx_get_vbi_interrupt(void) +{ + int enable = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vbi_interrupt(); +# endif + return (enable); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_bus_request_threshold_high + *----------------------------------------------------------------------------- + */ +int +gfx_get_vip_bus_request_threshold_high(void) +{ + int enable = 0; + +# if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vip_bus_request_threshold_high(); +# endif + return (enable); +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_VIP_DYNAMIC */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/history.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/history.h:1.2 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/history.h Wed Feb 5 13:38:43 2003 @@ -0,0 +1,145 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/history.h,v 1.2 2003/02/05 18:38:43 alanh Exp $ */ +/* + * $Workfile: history.h $ + * + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + + +/* Version is in the format of MMmmpp + * where in MM is the Major version, mm is the minor version + * and pp is the patch number (0 - 99) +*/ + +#define DURANGO_VERSION 24902 + +#if 0 + +This file contains specific revision info SINCE THE LAST RELEASE. It is not meant to +be a comprehensive record of all additions. + +#endif +/* END OF FILE */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_acc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_acc.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_acc.c Tue Dec 10 10:12:26 2002 @@ -0,0 +1,990 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_acc.c,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ +/* + * $Workfile: i2c_acc.c $ + * + * This file contains routines to write to and read from the I2C bus using + * the ACCESS.bus hardware in the SC1200. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* SUPER IO DEFINITIONS */ + +#define INDEX_1 0x15C /* base address 1 selected */ +#define DATA_1 0x15D +#define INDEX_2 0x2E /* base address 2 selected */ +#define DATA_2 0x2F +#define PCI_INDEX 0xCF8 /* PCI configuration space INDEX */ +#define PCI_DATA 0xCFC /* PCI configuration space DATA */ +#define BASE_ADR_MSB_REG 0x60 /* base address MSB register */ +#define BASE_ADR_LSB_REG 0x61 /* base address LSB register */ + +#define SIO_BASE_ADR_15C_15D 0x6000000 +#define SIO_BASE_ADR_2E_2F 0x4000000 + +/* SUPER IO GLOBALS */ + +unsigned short index_reg, data_reg; + +/* ACCESS BUS DEFINITIONS */ + +#define ACC_I2C_TIMEOUT 1000000 /* Number of reads before timing out */ +#define ACB1_BASE 0x810 /* ACCESS.bus base addresses */ +#define ACB2_BASE 0x820 +#define ACBSDA 0 /* ACB serial data */ +#define ACBST 1 /* ACB status */ +#define ACBCST 2 /* ACB control status */ +#define ACBCTL1 3 /* ACB control 1 */ +#define ACBADDR 4 /* ACB own address */ +#define ACBCTL2 5 /* ACB control 2 */ +#define LDN 0x7 /* Logical Device Numbers */ +#define ACB1_LDN 0x5 +#define ACB2_LDN 0x6 + +/* INITIAL ACCESS.bus BASE ADDRESS VALUES */ + +unsigned short base_address_array[3] = { 0, ACB1_BASE, ACB2_BASE }; +char Freq = 0x71; + +/* LOCAL ACCESS.bus FUNCTION DECLARATIONS */ + +void acc_i2c_start(unsigned char busnum); +void acc_i2c_stop(unsigned char busnum); +void acc_i2c_abort_data(unsigned char busnum); +void acc_i2c_bus_recovery(unsigned char busnum); +void acc_i2c_stall_after_start(unsigned char busnum, int state); +void acc_i2c_send_address(unsigned char busnum, unsigned char cData); +int acc_i2c_ack(unsigned char busnum, int fPut, int negAck); +void acc_i2c_stop_clock(unsigned char busnum); +void acc_i2c_activate_clock(unsigned char busnum); +void acc_i2c_write_byte(unsigned char busnum, unsigned char cData); +unsigned char acc_i2c_read_byte(unsigned char busnum, int last_byte); +void acc_i2c_reset_bus(unsigned char busnum); +int acc_i2c_request_master(unsigned char busnum); +void acc_i2c_config(unsigned char busnum, short adr, char freq); +char acc_i2c_set_freq(unsigned char busnum, char freq); +unsigned short acc_i2c_set_base_address(unsigned char busnum, short adr); + +/* LOCAL HELPER ROUTINES */ + +void OsPciReadDWord(int bus, int dev, int func, int address, + unsigned long *data); +int sio_set_index_data_reg(void); +void sio_write_reg(unsigned char reg, unsigned char data); +unsigned char sio_read_reg(unsigned char reg); + +int acc_i2c_reset(unsigned char busnum, short adr, char freq); +int acc_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, + unsigned char *data); +int acc_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, + unsigned char *data); +int acc_i2c_select_gpio(int clock, int data); +int acc_i2c_init(void); +void acc_i2c_cleanup(void); + +/*--------------------------------------------------------------------------- + * OsPciReadDWord + * + * This routine reads one double word from the PCI configuration header + * defined by 'bus', 'dev', 'func' and 'address' to the double word + * pointed to by 'data'. + * + * Returns : None. + *--------------------------------------------------------------------------- + */ +void +OsPciReadDWord(int bus, int dev, int func, int address, unsigned long *data) +{ + /* + * The address of a double word in the Configuration Header is built in + * the following way : + * {10000000,bus[23:16],device[15:11],function[10:8],address[7:2],00} + */ + long addr = (0x80000000 | + ((bus & 0xff) << 16) | + ((dev & 0x1f) << 11) | + ((func & 0x7) << 8) | (address & 0xff)); + OUTD(PCI_INDEX, addr); + *data = IND(PCI_DATA); +} + +/*--------------------------------------------------------------------------- + * sio_set_index_data_reg + * + * This routine checks which index and data registers to use + * in order to access the Super I/O registers + * + * Returns : 1 - OK + * 0 - Super I/O disabled or configuration access disabled + * + *--------------------------------------------------------------------------- + */ +int +sio_set_index_data_reg(void) +{ + unsigned long xbus_expention_bar, io_control_reg1; + + OsPciReadDWord(0, 0x12, 5, 0x10, &xbus_expention_bar); + xbus_expention_bar = xbus_expention_bar & 0xfffffffe; + io_control_reg1 = IND((unsigned short)xbus_expention_bar); + + if ((io_control_reg1) & (SIO_BASE_ADR_15C_15D)) { + index_reg = INDEX_1; + data_reg = DATA_1; + return (1); + } + + if ((io_control_reg1) & (SIO_BASE_ADR_2E_2F)) { + index_reg = INDEX_2; + data_reg = DATA_2; + return (1); + } + + return (0); +} + +/*--------------------------------------------------------------------------- + * sio_write_reg + * + * This routine writes 'data' to 'reg' Super I/O register + * + * Returns : None + *--------------------------------------------------------------------------- + */ +void +sio_write_reg(unsigned char reg, unsigned char data) +{ + OUTB(index_reg, reg); + OUTB(data_reg, data); +} + +/*--------------------------------------------------------------------------- + * sio_read_reg + * + * This routine reads data from 'reg' Super I/O register + * + * Returns : The data read from the requested register + *--------------------------------------------------------------------------- + */ +unsigned char +sio_read_reg(unsigned char reg) +{ + OUTB(index_reg, reg); + return INB(data_reg); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_reset + * + * This routine resets the I2C bus as follows : + * · Sets the base address of the ACCESS.bus + * · Sets the frequency of the ACCESS.bus + * · Resets the ACCESS.bus + * + * If 'adr' is -1 the address is read from the hardware. + * If 'freq' is -1 the frequency is set to 56 clock cycles. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_reset(unsigned char busnum, short adr, char freq) +#else +int +gfx_i2c_reset(unsigned char busnum, short adr, char freq) +#endif +{ + if ((busnum != 1) && (busnum != 2)) + return GFX_STATUS_BAD_PARAMETER; + acc_i2c_config(busnum, adr, freq); + if (base_address_array[busnum] == 0) + return GFX_STATUS_ERROR; + acc_i2c_reset_bus(busnum); + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_select_gpio + * + * This routine selects which GPIO pins to use. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_select_gpio(int clock, int data) +#else +int +gfx_i2c_select_gpio(int clock, int data) +#endif +{ + /* THIS ROUTINE DOES NOT APPLY TO THE ACCESS.bus IMPLEMENTATION. */ + + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_write + * + * This routine writes data to the specified I2C address. + * busnum - ACCESS.bus number (1 or 2). + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#else +int +gfx_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#endif +{ + int loop = 0; + + if ((busnum != 1) && (busnum != 2)) + return GFX_STATUS_BAD_PARAMETER; + + /* REQUEST MASTER */ + + if (!acc_i2c_request_master(busnum)) + return (GFX_STATUS_ERROR); + + /* WRITE ADDRESS COMMAND */ + + acc_i2c_ack(busnum, 1, 0); + acc_i2c_stall_after_start(busnum, 1); + acc_i2c_send_address(busnum, (unsigned char)(chipadr & 0xFE)); + acc_i2c_stall_after_start(busnum, 0); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* WRITE COMMAND */ + + acc_i2c_write_byte(busnum, subadr); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* WRITE DATA */ + + for (loop = 0; loop < bytes; loop++) { + acc_i2c_write_byte(busnum, *data); + if (loop < (bytes - 1)) + data += sizeof(unsigned char); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + } + data -= (bytes - 1); + acc_i2c_stop(busnum); + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_read + * + * This routine reads data from the specified I2C address. + * busnum - ACCESS.bus number (1 or 2). + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#else +int +gfx_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#endif +{ + unsigned char bytesRead; + + if ((busnum != 1) && (busnum != 2)) + return GFX_STATUS_BAD_PARAMETER; + + if (bytes == 0) + return GFX_STATUS_OK; + + /* REQUEST MASTER */ + + if (!acc_i2c_request_master(busnum)) + return (GFX_STATUS_ERROR); + + /* WRITE ADDRESS COMMAND */ + + acc_i2c_ack(busnum, 1, 0); + acc_i2c_stall_after_start(busnum, 1); + acc_i2c_send_address(busnum, (unsigned char)(chipadr & 0xFE)); + acc_i2c_stall_after_start(busnum, 0); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* WRITE COMMAND */ + + acc_i2c_write_byte(busnum, subadr); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* START THE READ */ + + acc_i2c_start(busnum); + + /* WRITE ADDRESS COMMAND */ + + acc_i2c_ack(busnum, 1, 1); + acc_i2c_stall_after_start(busnum, 1); + acc_i2c_send_address(busnum, (unsigned char)(chipadr | 0x01)); + + /* IF LAST BYTE */ + + if (bytes == 1) + acc_i2c_ack(busnum, 1, 1); + else + acc_i2c_ack(busnum, 1, 0); + + acc_i2c_stall_after_start(busnum, 0); + + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* READ COMMAND */ + + for (bytesRead = 0; bytesRead < bytes; bytesRead += 1) { + if (bytesRead < (bytes - 2)) { + data[bytesRead] = acc_i2c_read_byte(busnum, 0); + acc_i2c_ack(busnum, 1, 0); + } else if (bytesRead == (bytes - 2)) { /* TWO BYTES LEFT */ + acc_i2c_ack(busnum, 1, 1); + data[bytesRead] = acc_i2c_read_byte(busnum, 0); + acc_i2c_ack(busnum, 1, 1); + } else { /* LAST BYTE */ + + data[bytesRead] = acc_i2c_read_byte(busnum, 1); + acc_i2c_stop(busnum); + } + + /* WHILE NOT LAST BYTE */ + + if ((!(bytesRead == (bytes - 1))) && (!acc_i2c_ack(busnum, 0, 0))) + return (bytesRead); + } + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_init + * + * This routine initializes the use of the ACCESS.BUS. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_init(void) +#else +int +gfx_i2c_init(void) +#endif +{ + /* ### ADD ### THIS ROUTINE IS NOT YET IMPLEMENTED FOR ACCESS.bus */ + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_cleanup + * + * This routine ends the use of the ACCESS.BUS. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +void +acc_i2c_cleanup(void) +#else +void +gfx_i2c_cleanup(void) +#endif +{ + /* ### ADD ### THIS ROUTINE IS NOT YET IMPLEMENTED FOR ACCESS.bus */ +} + +/*--------------------------------------------------------*/ +/* LOCAL ROUTINES SPECIFIC TO ACCESS.bus IMPLEMENTATION */ +/*--------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- + * acc_i2c_reset_bus + * + * This routine resets the I2C bus. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_reset_bus(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + /* Disable the ACCESS.bus device and */ + /* Configure the SCL frequency */ + OUTB((unsigned short)(bus_base_address + ACBCTL2), + (unsigned char)(Freq & 0xFE)); + + /* Configure no interrupt mode (polling) and */ + /* Disable global call address */ + OUTB((unsigned short)(bus_base_address + ACBCTL1), 0x0); + + /* Disable slave address */ + OUTB((unsigned short)(bus_base_address + ACBADDR), 0x0); + + /* Enable the ACCESS.bus device */ + reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg |= 0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); + + /* Issue STOP event */ + + acc_i2c_stop(busnum); + + /* Clear NEGACK, STASTR and BER bits */ + OUTB((unsigned short)(bus_base_address + ACBST), 0x38); + + /* Clear BB (BUS BUSY) bit */ + reg = INB((unsigned short)(bus_base_address + ACBCST)); + reg |= 0x02; + OUTB((unsigned short)(bus_base_address + ACBCST), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_start + * + * This routine starts a transfer on the I2C bus. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_start(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_stop + * + * This routine stops a transfer on the I2C bus. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_stop(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x02; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_abort_data + *--------------------------------------------------------------------------- + */ +void +acc_i2c_abort_data(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + acc_i2c_stop(busnum); + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x10; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_bus_recovery + *--------------------------------------------------------------------------- + */ +void +acc_i2c_bus_recovery(unsigned char busnum) +{ + acc_i2c_abort_data(busnum); + acc_i2c_reset_bus(busnum); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_stall_after_start + *--------------------------------------------------------------------------- + */ +void +acc_i2c_stall_after_start(unsigned char busnum, int state) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + if (state) + reg |= 0x80; + else + reg &= 0x7F; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + + if (!state) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + reg |= 0x08; + OUTB((unsigned short)(bus_base_address + ACBST), reg); + } +} + +/*--------------------------------------------------------------------------- + * acc_i2c_send_address + *--------------------------------------------------------------------------- + */ +void +acc_i2c_send_address(unsigned char busnum, unsigned char cData) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + /* WRITE THE DATA */ + + OUTB((unsigned short)(bus_base_address + ACBSDA), cData); + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if ((reg & 0x38) != 0) /* check STASTR, BER and NEGACK */ + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return; + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return; + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return; + } + +} + +/*--------------------------------------------------------------------------- + * acc_i2c_ack + * + * This routine looks for acknowledge on the I2C bus. + *--------------------------------------------------------------------------- + */ +int +acc_i2c_ack(unsigned char busnum, int fPut, int negAck) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + if (fPut) { /* read operation */ + if (!negAck) { + /* Push Ack onto I2C bus */ + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg &= 0xE7; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + } else { + /* Push negAck onto I2C bus */ + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x10; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + } + } else { /* write operation */ + /* Receive Ack from I2C bus */ + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if ((reg & 0x70) != 0) /* check SDAST, BER and NEGACK */ + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return (0); + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return (0); + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return (0); + } + } + return (1); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_stop_clock + * + * This routine stops the ACCESS.bus clock. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_stop_clock(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg &= ~0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_activate_clock + * + * This routine activates the ACCESS.bus clock. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_activate_clock(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg |= 0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_write_byte + * + * This routine writes a byte to the I2C bus + *--------------------------------------------------------------------------- + */ +void +acc_i2c_write_byte(unsigned char busnum, unsigned char cData) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if (reg & 0x70) + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return; + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return; + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return; + } + + /* WRITE THE DATA */ + + OUTB((unsigned short)(bus_base_address + ACBSDA), cData); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_read_byte + * + * This routine reads a byte from the I2C bus + *--------------------------------------------------------------------------- + */ +unsigned char +acc_i2c_read_byte(unsigned char busnum, int last_byte) +{ + unsigned char cData, reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if (reg & 0x60) + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return (0xEF); + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return (0xEE); + } + + /* READ DATA */ + if (last_byte) + acc_i2c_stop_clock(busnum); + cData = INB((unsigned short)(bus_base_address + ACBSDA)); + if (last_byte) + acc_i2c_activate_clock(busnum); + + return (cData); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_request_master + *--------------------------------------------------------------------------- + */ +int +acc_i2c_request_master(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + acc_i2c_start(busnum); + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if (reg & 0x60) + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return (0); + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_abort_data(busnum); + return (0); + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return (0); + } + return (1); +} + +/*--------------------------------------------------------*/ +/* LOCAL ROUTINES SPECIFIC TO ACCESS.bus INITIALIZATION */ +/*--------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * acc_i2c_config + * + * This routine configures the I2C bus + *---------------------------------------------------------------------------- + */ +void +acc_i2c_config(unsigned char busnum, short adr, char freq) +{ + base_address_array[busnum] = acc_i2c_set_base_address(busnum, adr); + Freq = acc_i2c_set_freq(busnum, freq); +} + +/*---------------------------------------------------------------------------- + * acc_i2c_set_freq + * + * This routine sets the frequency of the I2C bus + *---------------------------------------------------------------------------- + */ +char +acc_i2c_set_freq(unsigned char busnum, char freq) +{ + unsigned short bus_base_address = base_address_array[busnum]; + + OUTB((unsigned short)(bus_base_address + ACBCTL2), 0x0); + + if (freq == -1) + freq = 0x71; + else { + freq = freq << 1; + freq |= 0x01; + } + + OUTB((unsigned short)(bus_base_address + ACBCTL2), freq); + return (freq); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_set_base_address + * + * This routine sets the base address of the I2C bus + *--------------------------------------------------------------------------- + */ +unsigned short +acc_i2c_set_base_address(unsigned char busnum, short adr) +{ + unsigned short ab_base_addr; + + /* Get Super I/O Index and Data registers */ + if (!sio_set_index_data_reg()) + return (0); + + /* Configure LDN to current ACB */ + if (busnum == 1) + sio_write_reg(LDN, ACB1_LDN); + if (busnum == 2) + sio_write_reg(LDN, ACB2_LDN); + + if (adr == -1) { + /* Get ACCESS.bus base address */ + ab_base_addr = sio_read_reg(BASE_ADR_MSB_REG); + ab_base_addr = ab_base_addr << 8; + ab_base_addr |= sio_read_reg(BASE_ADR_LSB_REG); + if (ab_base_addr != 0) + return ab_base_addr; + else + adr = (busnum == 1 ? ACB1_BASE : ACB2_BASE); + } + + /* Set ACCESS.bus base address */ + sio_write_reg(BASE_ADR_LSB_REG, (unsigned char)(adr & 0xFF)); + sio_write_reg(BASE_ADR_MSB_REG, (unsigned char)(adr >> 8)); + + return adr; +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_gpio.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_gpio.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_gpio.c Tue Dec 10 10:12:26 2002 @@ -0,0 +1,749 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/i2c_gpio.c,v 1.1 2002/12/10 15:12:26 alanh Exp $ */ +/* + * $Workfile: i2c_gpio.c $ + * + * This file contains routines to write to and read from the I2C bus using + * the GPIO pins of the CS5530. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* STATIC VARIABLES TO STORE WHAT GPIO PINS TO USE */ + +int gpio_clock = 0; +int gpio_data = 0; + +static int g_initialized = 0; + +#define I2CWRITE 0x00 /* Write address */ +#define I2CREAD 0x01 /* Read address */ + +#define I2CACK 0x00 /* Ack value */ +#define I2CNACK 0x01 /* Not - ack value */ + +#define CS5530_ID (0x80000000 | (0x00<<16) | (0x12<<11) | (0<<8) | 0x00) +#define CS5530_GPIO (0x80000000 | (0x00<<16) | (0x12<<11) | (0<<8) | 0x90) +#define SDA 0x0800 +#define SCL 0x0400 +#define SDADIR 0x0008 +#define SCLDIR 0x0004 + +int I2C_init(void); +void I2C_cleanup(void); + +int I2C_Read(unsigned char address, unsigned int reg, unsigned long *p_value, + unsigned int bytes); +int I2C_Write(unsigned char address, unsigned int reg, unsigned long value, + unsigned int bytes); +int I2CAL_init(void); +void I2CAL_cleanup(void); + +void I2CAL_output_clock(int state); +void I2CAL_output_data(int state); +unsigned char I2CAL_input_data(void); + +void I2CAL_set_data_for_input(void); +void I2CAL_set_data_for_output(void); + +void SendI2CStart(void); +void SendI2CData(unsigned char inData); + +unsigned char ReceiveI2CAck(void); +void SendI2CStop(void); +void SendI2CNack(void); +void SendI2CAck(void); +unsigned char ReceiveI2CData(void); + +int gpio_i2c_reset(unsigned char busnum, short adr, char freq); +int gpio_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, + unsigned char *data); +int gpio_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, + unsigned char *data); +int gpio_i2c_select_gpio(int clock, int data); +int gpio_i2c_init(void); +void gpio_i2c_cleanup(void); + +/* ### ADD ### ANY LOCAL ROUTINE DEFINITIONS SPECIFIC TO GPIO */ + +/*--------------------------------------------------------------------------- + * gfx_i2c_reset + * + * This routine resets the I2C bus. + *--------------------------------------------------------------------------- + */ + +#if GFX_I2C_DYNAMIC +int +gpio_i2c_reset(unsigned char busnum, short adr, char freq) +#else +int +gfx_i2c_reset(unsigned char busnum, short adr, char freq) +#endif +{ + /* ### ADD ### Any code needed to reset the state of the GPIOs. */ + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_select_gpio + * + * This routine selects which GPIO pins to use. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +gpio_i2c_select_gpio(int clock, int data) +#else +int +gfx_i2c_select_gpio(int clock, int data) +#endif +{ + gpio_clock = clock; + gpio_data = data; + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_write + * + * This routine writes data to the specified I2C address. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +gpio_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *value) +#else +int +gfx_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *value) +#endif +{ + /* ### ADD ### CODE TO WRITE BYTE TO I2B BUS */ + + int restart_count = 0; + + while (restart_count++ < 5) { + /* set the access pointer register. */ + /* The address is shifted left by one to make room for Read/Write bit */ + SendI2CStart(); + SendI2CData((char)((address << 1) | I2CWRITE)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + SendI2CData((unsigned char)reg); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + + /* write the first byte */ + SendI2CData(*value); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + + /* write the second byte. */ + if (bytes == 2) { + SendI2CData(*(value + 1)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + } + + /* done. */ + SendI2CStop(); + + return 0; + } + + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_read + * + * This routine reads data from the specified I2C address. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +gpio_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *p_value) +#else +int +gfx_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *p_value) +#endif +{ + /* ### ADD ### CODE TO WRITE BYTE TO I2B BUS */ + /* For now return clock and data pins */ + + int restart_count = 0; + + if (!p_value) + return (1); + + while (restart_count++ < 5) { + /* set the access pointer register. */ + /* The address is shifted left by one to make room for Read/Write bit */ + SendI2CStart(); + SendI2CData((char)((address << 1) | I2CWRITE)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + SendI2CData((unsigned char)(reg & 0xFF)); + SendI2CNack(); + + /* read the first data byte. */ + SendI2CStart(); + SendI2CData((char)((address << 1) | I2CREAD)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + *p_value = ReceiveI2CData(); + + /* read the second byte. */ + if (bytes == 2) { + SendI2CAck(); + *(p_value + 1) = ReceiveI2CData(); + } + + /* done. */ + SendI2CNack(); + SendI2CStop(); + + return 0; + } + + return (1); +} + +/* Added i2c/gpio code to test fs451 chip. */ + +/* +//---------------------------------------------------------------------- +// +// void SendI2CStart(void) +// +// Sends an I2C start signal on the bus. +// +//---------------------------------------------------------------------- +*/ +void +SendI2CStart(void) +{ + I2CAL_output_data(1); + I2CAL_output_clock(1); + I2CAL_output_data(0); + I2CAL_output_clock(0); +} + +/* +//---------------------------------------------------------------------- +// +// void SendI2CStop(void) +// +// Sends an I2C stop signal on the bus. +// +//---------------------------------------------------------------------- +*/ +void +SendI2CStop(void) +{ + I2CAL_output_data(0); + I2CAL_output_clock(1); + I2CAL_output_data(1); +} + +/* +//---------------------------------------------------------------------- +// +// void SendI2CAck(void) +// +// Sends the Ack signal on the I2C bus. +// +//---------------------------------------------------------------------- +*/ +void +SendI2CAck(void) +{ + I2CAL_output_data(0); + I2CAL_output_clock(1); + I2CAL_output_clock(0); +} + +/* +//---------------------------------------------------------------------- +// +// void SendI2CNack(void) +// +// Sends the Nt-Ack signal on the I2C bus. +// +//---------------------------------------------------------------------- +*/ +void +SendI2CNack(void) +{ + I2CAL_output_data(1); + I2CAL_output_clock(1); + I2CAL_output_clock(0); +} + +/* +//---------------------------------------------------------------------- +// +// UInt8 SendI2CData( UInt8 inData ) +// +// Sends a byte of data on the I2C bus and returns the TRUE if the slave ACK'd +// the data. +// +// Input: inData - the byte of data to send +// Output: (return) - TRUE (1) if ACK was received, FALSE (0) if not +// +//---------------------------------------------------------------------- +*/ +void +SendI2CData(unsigned char inData) +{ + unsigned char bit; + + /* Send all 8 bits of data byte, MSB to LSB */ + for (bit = 0x80; bit != 0; bit >>= 1) { + if (inData & bit) + I2CAL_output_data(1); + else + I2CAL_output_data(0); + + I2CAL_output_clock(1); + I2CAL_output_clock(0); + } +} + +/* +//---------------------------------------------------------------------- +// +// UInt8 ReceiveI2CAck( ) +// +// Receives the Ack (or Nack) from the slave. +// +// Output: (return) - TRUE (1) if ACK was received, FALSE (0) if not +// +//---------------------------------------------------------------------- +*/ +unsigned char +ReceiveI2CAck(void) +{ + unsigned char bit; + + /* Test for Ack/Nack */ + I2CAL_set_data_for_input(); + I2CAL_output_data(1); + I2CAL_output_clock(1); + bit = I2CAL_input_data(); + I2CAL_output_clock(0); + I2CAL_set_data_for_output(); + return !bit; +} + +/* +//---------------------------------------------------------------------- +// +// unsigned char ReceiveI2CData(void) +// +// Receives a byte of data from the I2C bus. +// +// Output: (return) - The data byte recehved from the bus +// +//---------------------------------------------------------------------- +*/ +unsigned char +ReceiveI2CData(void) +{ + unsigned char data = 0; + unsigned char x; + + /* make sure the data line is released */ + I2CAL_set_data_for_input(); + I2CAL_output_data(1); + + /* shift in the data */ + for (x = 0; x < 8; x++) { + /* shift the data left */ + I2CAL_output_clock(1); + data <<= 1; + data |= I2CAL_input_data(); + I2CAL_output_clock(0); + } + + I2CAL_set_data_for_output(); + I2CAL_output_data(1); + return data; +} + +/* +//---------------------------------------------------------------------- +// +// void I2C_init(void) +// +// This routine initializes the I2C interface. Clients of the I2C.c +// will call this routine before calling any other routine in the I2C.c +// +//---------------------------------------------------------------------- +*/ + +#if GFX_I2C_DYNAMIC +int +gpio_i2c_init(void) +#else +int +gfx_i2c_init(void) +#endif +{ + int errc; + + /* init I2CAL */ + errc = I2CAL_init(); + if (errc) + return errc; + + /* set the clock and data lines to the proper states */ + I2CAL_output_clock(1); + I2CAL_output_data(1); + I2CAL_set_data_for_output(); + + SendI2CStart(); + SendI2CStop(); + SendI2CStop(); + + g_initialized = 1; + + return 0; +} + +/* +//---------------------------------------------------------------------- +// +// void I2C_cleanup(void) +// +// This routine disables the I2C interface. Clients of the I2C.c will not +// call any other I2C routine after calling this routine. +// +//---------------------------------------------------------------------- +*/ + +#if GFX_I2C_DYNAMIC +void +gpio_i2c_cleanup(void) +#else +void +gfx_i2c_cleanup(void) +#endif +{ + if (g_initialized) { + + /* set the clock and data lines to a harmless state */ + I2CAL_output_clock(1); + I2CAL_output_data(1); + + g_initialized = 0; + } + + I2CAL_cleanup(); +} + +int +I2CAL_init(void) +{ + unsigned long l_reg; + unsigned short reg; + + /* initialize the i2c port. */ + l_reg = gfx_pci_config_read(CS5530_GPIO); + + if (l_reg != 0x01001078) + return 1; + + l_reg = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)l_reg; + + /* both outputs, both high. */ + reg |= (SDADIR | SCLDIR | SDA | SCL); + l_reg = reg; + gfx_pci_config_write(CS5530_GPIO, l_reg); + + g_initialized = 1; + + return 0; +} + +void +I2CAL_cleanup(void) +{ + if (g_initialized) { + + g_initialized = 0; + } +} + +/* +//-------------------------------------------------------------------------------- +// +// set the I2C clock line state +// +//-------------------------------------------------------------------------------- +*/ +void +I2CAL_output_clock(int inState) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + if (inState) { /* write a 1. */ + reg |= SCL; + } else { /* write a 0. */ + reg &= ~SCL; + } + + value = reg; + gfx_pci_config_write(CS5530_GPIO, value); + + /* hold it for a minimum of 4.7us */ + gfx_delay_microseconds(5); +} + +/* +//-------------------------------------------------------------------------------- +// +// set the I2C data line state +// +//-------------------------------------------------------------------------------- +*/ +void +I2CAL_output_data(int inState) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + if (inState) { /* write a 1. */ + reg |= SDA; + } else { + /* write a 0. */ + reg &= ~SDA; + } + value = reg; + gfx_pci_config_write(CS5530_GPIO, value); + + /* 250 ns setup time */ + gfx_delay_microseconds(1); +} + +/* +//-------------------------------------------------------------------------------- +// +// read the state of the data line +// +//-------------------------------------------------------------------------------- +*/ +unsigned char +I2CAL_input_data(void) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + if (reg & SDA) + return 1; + else + return 0; +} + +/* +//-------------------------------------------------------------------------------- +// +// set the I2C data for input mode +// +//-------------------------------------------------------------------------------- +*/ +void +I2CAL_set_data_for_input(void) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + reg &= ~SDADIR; + + value = reg; + + gfx_pci_config_write(CS5530_GPIO, value); +} + +/* +//-------------------------------------------------------------------------------- +// +// set the I2C data for output mode +// +//-------------------------------------------------------------------------------- +*/ +void +I2CAL_set_data_for_output(void) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + reg |= SDADIR; + value = reg; + + gfx_pci_config_write(CS5530_GPIO, value); + +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu1.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu1.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu1.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,363 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu1.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: init_gu1.c $ + * + * This file contains routines used in the initialization of Geode-family + * processors. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +unsigned char gfx_gxm_config_read(unsigned char index); +unsigned long gu1_get_core_freq(void); +unsigned long gu1_detect_cpu(void); +unsigned long gu1_detect_video(void); +unsigned long gu1_get_cpu_register_base(void); +unsigned long gu1_get_graphics_register_base(void); +unsigned long gu1_get_frame_buffer_base(void); +unsigned long gu1_get_frame_buffer_size(void); +unsigned long gu1_get_vid_register_base(void); +unsigned long gu1_get_vip_register_base(void); + +/*----------------------------------------------------------------------------- + * gfx_gxm_config_read + * + * This routine reads the value of the specified GXm configuration register. + *----------------------------------------------------------------------------- + */ +unsigned char +gfx_gxm_config_read(unsigned char index) +{ + unsigned char value = 0xFF; + unsigned char lock; + + OUTB(0x22, GXM_CONFIG_CCR3); + lock = INB(0x23); + OUTB(0x22, GXM_CONFIG_CCR3); + OUTB(0x23, (unsigned char)(lock | 0x10)); + OUTB(0x22, index); + value = INB(0x23); + OUTB(0x22, GXM_CONFIG_CCR3); + OUTB(0x23, lock); + return (value); +} + +/*----------------------------------------------------------------------------- + * gfx_get_core_freq + * + * This routine returns the core clock frequency of a GXm if valid jumper settings are + * detected; 0 if not. It assumes that a 33.3 MHz PCI clock is being used. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_core_freq(void) +#else +unsigned long +gfx_get_core_freq(void) +#endif +{ + unsigned char dir0, dir1; + + dir0 = gfx_gxm_config_read(GXM_CONFIG_DIR0) & 0x0F; + dir1 = gfx_gxm_config_read(GXM_CONFIG_DIR1); + + /* REVISION 4.0 AND UP */ + + if (dir1 >= 0x50) { + switch (dir0) { + case 0: + case 2: + return 133; + + case 5: + return 166; + case 3: + return 200; + case 6: + return 233; + case 7: + return 266; + case 4: + return 300; + case 1: + return 333; + default: + return (0); + } + } else { + switch (dir0) { + case 0: + case 2: + return 133; + + case 7: + return 166; + + case 1: + case 3: + return 200; + + case 4: + case 6: + return 233; + + case 5: + return 266; + default: + return (0); + } + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cpu_register_base + * + * This routine returns the base address for graphics registers. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_cpu_register_base(void) +#else +unsigned long +gfx_get_cpu_register_base(void) +#endif +{ + unsigned long base; + + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_frame_buffer_base + * + * This routine returns the base address for graphics memory. This is an + * offset of 0x00800000 from the base address specified in the GCR register. + * + * The function returns zero if the GCR indicates the graphics subsystem + * is disabled. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_frame_buffer_base(void) +#else +unsigned long +gfx_get_frame_buffer_base(void) +#endif +{ + unsigned long base; + + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + if (base) + base |= 0x00800000; + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_frame_buffer_size + * + * This routine returns the total size of graphics memory, in bytes. + * + * Currently this routine is hardcoded to return 2 Meg. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_frame_buffer_size(void) +#else +unsigned long +gfx_get_frame_buffer_size(void) +#endif +{ +#if FB4MB + return (0x00400000); +#else + return (0x00200000); +#endif +} + +/*----------------------------------------------------------------------------- + * gfx_get_vid_register_base + * + * This routine returns the base address for the video hardware. It assumes + * an offset of 0x00010000 from the base address specified by the GCR. + * + * The function returns zero if the GCR indicates the graphics subsystem + * is disabled. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_vid_register_base(void) +#else +unsigned long +gfx_get_vid_register_base(void) +#endif +{ + unsigned long base; + + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + if (base) + base |= 0x00010000; + return (base); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_register_base + * + * This routine returns the base address for the VIP hardware. This is + * only applicable to the SC1200, for which this routine assumes an offset + * of 0x00015000 from the base address specified by the GCR. + * + * The function returns zero if the GCR indicates the graphics subsystem + * is disabled. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_vip_register_base(void) +#else +unsigned long +gfx_get_vip_register_base(void) +#endif +{ + unsigned long base = 0; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) { + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + if (base) + base |= 0x00015000; + } + return (base); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu2.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu2.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu2.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,267 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/init_gu2.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: init_gu2.c $ + * + * This file contains routines used in Redcloud initialization. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +unsigned long gu2_pci_config_read(unsigned long address); +void gu2_pci_config_write(unsigned long address, unsigned long data); +unsigned long gu2_get_core_freq(void); +unsigned long gu2_detect_cpu(void); +unsigned long gu2_detect_video(void); +unsigned long gu2_get_cpu_register_base(void); +unsigned long gu2_get_graphics_register_base(void); +unsigned long gu2_get_frame_buffer_base(void); +unsigned long gu2_get_frame_buffer_size(void); +unsigned long gu2_get_vid_register_base(void); +unsigned long gu2_get_vip_register_base(void); + +/*----------------------------------------------------------------------------- + * gfx_get_core_freq + * + * Returns the core clock frequency of a GX2. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_core_freq(void) +#else +unsigned long +gfx_get_core_freq(void) +#endif +{ + unsigned long value; + + /* CPU SPEED IS REPORTED BY A VSM IN VSA II */ + /* Virtual Register Class = 0x12 (Sysinfo) */ + /* CPU Speed Register = 0x01 */ + + OUTW(0xAC1C, 0xFC53); + OUTW(0xAC1C, 0x1201); + + value = (unsigned long)(INW(0xAC1E)); + + return (value); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cpu_register_base + * + * This routine returns the base address for display controller registers. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_cpu_register_base(void) +#else +unsigned long +gfx_get_cpu_register_base(void) +#endif +{ + return gfx_pci_config_read(0x80000918); +} + +/*----------------------------------------------------------------------------- + * gfx_get_graphics_register_base + * + * This routine returns the base address for the graphics acceleration. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_graphics_register_base(void) +#else +unsigned long +gfx_get_graphics_register_base(void) +#endif +{ + return gfx_pci_config_read(0x80000914); +} + +/*----------------------------------------------------------------------------- + * gfx_get_frame_buffer_base + * + * This routine returns the base address for graphics memory. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_frame_buffer_base(void) +#else +unsigned long +gfx_get_frame_buffer_base(void) +#endif +{ + return gfx_pci_config_read(0x80000910); +} + +/*----------------------------------------------------------------------------- + * gfx_get_frame_buffer_size + * + * This routine returns the total size of graphics memory, in bytes. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_frame_buffer_size(void) +#else +unsigned long +gfx_get_frame_buffer_size(void) +#endif +{ + unsigned long value; + + /* FRAME BUFFER SIZE IS REPORTED BY A VSM IN VSA II */ + /* Virtual Register Class = 0x02 */ + /* VG_MEM_SIZE (512KB units) = 0x00 */ + + OUTW(0xAC1C, 0xFC53); + OUTW(0xAC1C, 0x0200); + + value = (unsigned long)(INW(0xAC1E)) & 0xFFl; + + return (value << 19); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vid_register_base + * + * This routine returns the base address for the video hardware. + *----------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_vid_register_base(void) +#else +unsigned long +gfx_get_vid_register_base(void) +#endif +{ + return gfx_pci_config_read(0x8000091C); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/msr_rdcl.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/msr_rdcl.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/msr_rdcl.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,729 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/msr_rdcl.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: msr_rdcl.c $ + * + * This file contains MSR access routines for Redcloud. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +int redcloud_msr_init(void); +DEV_STATUS redcloud_id_msr_device(MSR * pDev, unsigned long address); +DEV_STATUS redcloud_get_msr_dev_address(unsigned int device, + unsigned long *address); +DEV_STATUS redcloud_get_glink_id_at_address(unsigned int *device, + unsigned long address); +DEV_STATUS redcloud_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +DEV_STATUS redcloud_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); + +void redcloud_build_mbus_tree(void); /* private routine definition */ +int redcloud_init_msr_devices(MSR aDev[], unsigned int array_size); /* private routine definition */ +DEV_STATUS redcloud_find_msr_device(MSR * pDev); /* private routine definition */ + +/* REDCLOUD MSR BITMASKS */ + +#define MBD_MSR_CAP 0x2000 +#define MSR_CAP_ID_MASK 0xFF000 +#define MSR_CAP_ID_SHIFT 12 +#define MSR_CAP_REV_MASK 0x0F +#define MBIU_CAP 0x86 +#define NUM_PORTS_MASK 0x00380000 +#define NUM_PORTS_SHIFT 19 +#define MBIU_WHOAMI 0x8B +#define WHOAMI_MASK 0x07 + +/* REDCLOUD and CS5535 MSR DEVICES */ + +MSR msrDev[] = { + {FOUND, RC_CC_MBIU, RC_MB0_MBIU0}, + {FOUND, RC_CC_MBIU, RC_MB0_MBIU1}, + {NOT_KNOWN, RC_CC_MCP, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_MPCI, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_MC, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_GP, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_VG, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_DF, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_FG, FAKE_ADDRESS}, + {FOUND, RC_CC_VA, RC_MB0_CPU}, + {FOUND, CP_CC_MBIU, CP_MB0_MBIU0}, + {NOT_KNOWN, CP_CC_MPCI, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_USB2, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_ATAC, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_MDD, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_ACC, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_USB1, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_MCP, FAKE_ADDRESS}, +}; + +#define NUM_DEVS sizeof(msrDev) / sizeof(struct msr) + +/* CAPISTRANO DEVICE INDEX LIMITS */ +/* These defines represent the start and stop indexes into the device array */ +/* for all Capistrano devices. These should be updated whenever a device is */ +/* added or removed to the Capistrano list. */ + +#define CP_INDEX_START CP_ID_MBIU +#define CP_INDEX_STOP CP_ID_MCP + +/* GLOBAL MBUS CACHE STRUCTURES */ +/* These structures contain a "cached" copy of the MBUS topology */ +/* for easy future lookup. */ + +MBUS_NODE MBIU0[8], MBIU1[8], MBIU2[8]; + +/* REGISTER MACROS */ + +#define GET_DEVICE_ID( CAPABILITIES_HIGH, CAPABILITIES_LOW ) \ + ((unsigned int)(( (CAPABILITIES_LOW) & MSR_CAP_ID_MASK ) >> MSR_CAP_ID_SHIFT )) + +#define GET_NUM_PORTS( MBIU_CAP_HIGH, MBIU_CAP_LOW ) (((MBIU_CAP_HIGH) & NUM_PORTS_MASK ) >> NUM_PORTS_SHIFT) + +/*----------------------------------------------------------------------------- + * gfx_msr_init + * + * This routine initializes the base addresses of all known MBUS devices. + *----------------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +int +redcloud_msr_init(void) +#else +int +gfx_msr_init(void) +#endif +{ + Q_WORD msrValue; + int return_value = 1; + + /* CHECK FOR VALID MBUS CONFIGURATION */ + /* The CPU and the two MBIUs are assumed to be at known static addresses, so */ + /* we will check the device IDs at these addresses as proof of a valid mbus */ + /* configuration. */ + + MSR_READ(MBD_MSR_CAP, RC_MB0_CPU, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) != RC_CC_VA) + return_value = 0; + + MSR_READ(MBD_MSR_CAP, RC_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) != RC_CC_MBIU) + return_value = 0; + + MSR_READ(MBD_MSR_CAP, RC_MB0_MBIU1, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) != RC_CC_MBIU) + return_value = 0; + + /* ENUMERATE VALID BUS */ + /* If all static devices were identified, continue with the enumeration */ + + if (return_value) { + /* OPTIMIZATION */ + /* Build a local copy of the MBUS topology. This allows us to */ + /* quickly search the entire MBUS for a given device ID without */ + /* repeated MSR accesses. */ + + redcloud_build_mbus_tree(); + + /* INITIALIZE MSR DEVICES */ + + return_value = redcloud_init_msr_devices(msrDev, NUM_DEVS); + + } + + return return_value; + +} + +/*-------------------------------------------------------------------------- + * void redcloud_build_mbus_tree() (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * This routine walks through the MBUS and records the address value and + * device ID found at each node. If a node (aka port) is not populated, + * that node returns '0'. The deviceID for that node is set to '0' + * (NOT_POPULATED) to reflect this. If the node being queried points back to + * Vail or MBIU0, the deviceID for that node is set to 'REFLECTIVE'. Reflective + * nodes are nodes that forward the given MBUS address BACK to the initiator. + *----------------------------------------------------------------------------- + */ +void +redcloud_build_mbus_tree(void) +{ + unsigned long mbiu_port_count, reflective; + unsigned long port; + Q_WORD msrValue; + + /* */ + /* ENUMERATE MBIU0 */ + /* */ + + /* COUNT MBIU PORTS */ + + MSR_READ(MBIU_CAP, RC_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + mbiu_port_count = GET_NUM_PORTS(msrValue.high, msrValue.low); + + /* FIND REFLECTIVE PORT */ + /* Query the MBIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MBIU_WHOAMI, RC_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + reflective = msrValue.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + /* For every possible port, set the MBIU.deviceId to something. */ + + for (port = 0; port < 8; port++) { + /* FILL IN CLAIMED FIELD */ + /* All MBIU ports can only be assigned to one device from the */ + /* Durango table */ + + MBIU0[port].claimed = 0; + + /* MBIU0 PORT NUMBERS ARE IN ADDRESS BITS 31:29 */ + + MBIU0[port].address = port << 29; + + /* SPECIAL CASE FOR MBIU0 */ + /* MBIU0 port 0 is a special case, as it points back to MBIU0. MBIU0 */ + /* responds at address 0x40000xxx, which does not equal 0 << 29. */ + + if (port == 0) + MBIU0[port].deviceId = RC_CC_MBIU; + else if (port == reflective) + MBIU0[port].deviceId = REFLECTIVE; + else if (port > mbiu_port_count) + MBIU0[port].deviceId = NOT_POPULATED; + else { + MSR_READ(MBD_MSR_CAP, MBIU0[port].address, &(msrValue.high), + &(msrValue.low)); + MBIU0[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); + } + } + + /* */ + /* ENUMERATE MBIU1 */ + /* */ + + /* COUNT MBIU PORTS */ + + MSR_READ(MBIU_CAP, RC_MB0_MBIU1, &(msrValue.high), &(msrValue.low)); + mbiu_port_count = GET_NUM_PORTS(msrValue.high, msrValue.low); + + /* FIND REFLECTIVE PORT */ + /* Query the MBIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MBIU_WHOAMI, RC_MB0_MBIU1, &(msrValue.high), &(msrValue.low)); + reflective = msrValue.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + /* For every possible port, set the MBIU.deviceId to something. */ + + for (port = 0; port < 8; port++) { + /* FILL IN CLAIMED FIELD */ + /* All MBIU ports can only be assigned to one device from the */ + /* Durango table */ + + MBIU1[port].claimed = 0; + + /* MBIU1 PORT NUMBERS ARE IN 28:26 AND 31:29 = 010B */ + + MBIU1[port].address = (0x02l << 29) + (port << 26); + + if (port == reflective) + MBIU1[port].deviceId = REFLECTIVE; + else if (port > mbiu_port_count) + MBIU1[port].deviceId = NOT_POPULATED; + else { + MSR_READ(MBD_MSR_CAP, MBIU1[port].address, &(msrValue.high), + &(msrValue.low)); + MBIU1[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); + } + } + + /* */ + /* ENUMERATE MBIU2 (CS5535) */ + /* (if present) */ + + MSR_READ(MBD_MSR_CAP, CP_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) == CP_CC_MBIU) { + /* COUNT MBIU PORTS */ + + MSR_READ(MBIU_CAP, CP_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + mbiu_port_count = GET_NUM_PORTS(msrValue.high, msrValue.low); + + /* FIND REFLECTIVE PORT */ + /* Query the MBIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MBIU_WHOAMI, CP_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + reflective = msrValue.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + /* For every possible port, set the MBIU.deviceId to something. */ + + for (port = 0; port < 8; port++) { + /* FILL IN CLAIMED FIELD */ + /* All MBIU ports can only be assigned to one device from the */ + /* Durango table */ + + MBIU2[port].claimed = 0; + + /* MBIU2 PORT NUMBERS ARE IN 22:20 AND 31:23 = 010100010B */ + + MBIU2[port].address = + (0x02l << 29) + (0x04l << 26) + (0x02l << 23) + (port << 20); + + if (port == reflective) + MBIU2[port].deviceId = REFLECTIVE; + else if (port > mbiu_port_count) + MBIU2[port].deviceId = NOT_POPULATED; + else { + MSR_READ(MBD_MSR_CAP, MBIU2[port].address, &(msrValue.high), + &(msrValue.low)); + MBIU2[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); + } + } + } else { + /* NO 5535 */ + /* If the CS5535 is not installed, fill in the cached table */ + /* with the 'NOT_INSTALLED' flag. Also, fill in the device */ + /* status from NOT_KNOWN to REQ_NOT_INSTALLED. */ + + for (port = 0; port < 8; port++) { + MBIU2[port].claimed = 0; + MBIU2[port].deviceId = NOT_INSTALLED; + MBIU2[port].address = + (0x02l << 29) + (0x04l << 26) + (0x02l << 23) + (port << 20); + } + for (port = CP_INDEX_START; port <= CP_INDEX_STOP; port++) { + msrDev[port].Present = REQ_NOT_INSTALLED; + } + } +} + +/*------------------------------------------------------------------ + * redcloud_init_msr_devices (PRIVATE ROUTINE - NOT PART OF DURANGO API) + + * Handles the details of finding each possible device on the MBUS. + * If a given device is not found, its structure is left uninitialized. + * If a given device is found, its structure is updated. + * + * This init routine only checks for devices in aDev[]. + * + * Passed: + * aDev - is a pointer to the array of MBUS devices. + * arraySize - number of elements in aDev. + * + * Returns: + * 1 - If, for every device, its address was found. + * 0 - If, for any device, an error was encountered. + *------------------------------------------------------------------ + */ +int +redcloud_init_msr_devices(MSR aDev[], unsigned int array_size) +{ + unsigned int i, issues = 0; + + /* TRY TO FIND EACH ITEM IN THE ARRAY */ + + for (i = 0; i < array_size; i++) { + /* IGNORE DEVICES THAT ARE ALREADY FOUND */ + /* The addresses for "found" devices are already known. */ + + if (aDev[i].Present == FOUND || aDev[i].Present == REQ_NOT_INSTALLED) + continue; + + /* TRY TO FIND THE DEVICE ON THE MBUS */ + + aDev[i].Present = redcloud_find_msr_device(&aDev[i]); + + /* INCREMENT ERROR COUNT IF DEVICE NOT FOUND */ + + if (aDev[i].Present != FOUND) + issues++; + } + + return (issues == 0); +} + +/*------------------------------------------------------------------ + * redcloud_find_msr_device (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Passed: + * pDev - is a pointer to one element in the array of MBUS devices + * + * Returns: + * FOUND - Device was found and pDev->Address has been updated. + * + * REQ_NOT_FOUND - Device was not found and pDev->Address has not + * been updated. + * + *------------------------------------------------------------------ +*/ +DEV_STATUS +redcloud_find_msr_device(MSR * pDev) +{ + unsigned int i; + + /* SEARCH DURANGO'S CACHED MBUS TOPOLOGY */ + /* This gets a little tricky. As the only identifier we have for each */ + /* device is the device ID and we have multiple devices of the same type */ + /* MCP, MPCI, USB, etc. we need to make some assumptions based on table */ + /* order. These are as follows: */ + /* 1. All Redcloud nodes are searched first, as we assume that they */ + /* are first in the table. */ + /* 2. If two devices have the same device ID and are found on the same */ + /* device (GX2, CS5535, etc.) we assume that they are listed such */ + /* that the first device in the table with this device ID has a lower */ + /* port address. */ + /* 3. After a device ID has been matched, the port is marked as */ + /* 'claimed', such that future enumerations continue searching the */ + /* GeodeLink topology. */ + + /* SEARCH MBIU0 */ + + for (i = 0; i < 8; i++) { + if (MBIU0[i].deviceId == pDev->Id && !(MBIU0[i].claimed)) { + MBIU0[i].claimed = 1; + pDev->Address = MBIU0[i].address; + return FOUND; + } + } + + /* SEARCH MBIU1 */ + + for (i = 0; i < 8; i++) { + if (MBIU1[i].deviceId == pDev->Id && !(MBIU1[i].claimed)) { + MBIU1[i].claimed = 1; + pDev->Address = MBIU1[i].address; + return FOUND; + } + } + + /* SEARCH MBIU2 */ + + for (i = 0; i < 8; i++) { + if (MBIU2[i].deviceId == pDev->Id && !(MBIU2[i].claimed)) { + MBIU2[i].claimed = 1; + pDev->Address = MBIU2[i].address; + return FOUND; + } + } + + return REQ_NOT_FOUND; +} + +/*-------------------------------------------------------------------- + * gfx_id_msr_device + * + * This routine handles reading the capabilities MSR register (typically 0x2000) + * and checking if the 'id' field matchs pDev.Id. This routine is + * used by applications/drivers that need to extend the list of known + * MBUS devices beyond those known by Durango. + * + * Passed: + * pDev - Pointer to MSR structure containing the device's ID. + * address - device address. + * + * Returns: + * FOUND - The IDs do match. + * REQ_NOT_FOUND - There was not a match. + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_id_msr_device(MSR * pDev, unsigned long address) +#else +DEV_STATUS +gfx_id_msr_device(MSR * pDev, unsigned long address) +#endif +{ + Q_WORD msrValue; + + MSR_READ(MBD_MSR_CAP, address, &(msrValue.high), &(msrValue.low)); + + if (GET_DEVICE_ID(msrValue.high, msrValue.low) == pDev->Id) + return FOUND; + else + return REQ_NOT_FOUND; +} + +/*-------------------------------------------------------------------- + * gfx_get_msr_dev_address + * + * This function returns the 32-bit address of the requested device. + * The device must be a known MBUS device. (It must be in Durango's + * device table.) DEV_STATUS should be checked to verify that the address + * was updated. + * + * + * Passed: + * device - device index of the device in question. + * *address - ptr to location where address should be stored. + * + * Returns: + * DEV_STATUS of device in question. (NOT_KNOWN if device is out of range.) + * *address - updated if 'device' is within range + * + * Notes: + * This function should only be called after gfx_msr_init + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_get_msr_dev_address(unsigned int device, unsigned long *address) +#else +DEV_STATUS +gfx_get_msr_dev_address(unsigned int device, unsigned long *address) +#endif +{ + if (device < NUM_DEVS) { + if (msrDev[device].Present == FOUND) + *address = msrDev[device].Address; + + return msrDev[device].Present; + } + return NOT_KNOWN; + +} + +/*-------------------------------------------------------------------- + * gfx_get_glink_id_at_address + * + * This function returns the 16-bit deviceId at the requested address. + * DEV_STATUS should be checked to make sure that device was updated. + * + * Passed: + * device - ptr to location where device ID should be stored. + * address - address of desired device ID. + * + * Returns: + * FOUND if address is a valid address, NOT_KNOWN if address cannot be found + * on the mbus. + * *device - updated with device Id info. + * + * Notes: + * This function should be called after gfx_msr_init + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_get_glink_id_at_address(unsigned int *device, unsigned long address) +#else +DEV_STATUS +gfx_get_glink_id_at_address(unsigned int *device, unsigned long address) +#endif +{ + int port; + + for (port = 0; port < 8; port++) { + if (MBIU0[port].address == address) { + *device = MBIU0[port].deviceId; + return FOUND; + } else if (MBIU1[port].address == address) { + *device = MBIU1[port].deviceId; + return FOUND; + } else if (MBIU2[port].address == address) { + *device = MBIU2[port].deviceId; + return FOUND; + } + } + + return NOT_KNOWN; + +} + +/*-------------------------------------------------------------------- + * gfx_msr_read + * + * Performs a 64-bit read from 'msrRegister' in device 'device'. 'device' is + * an index into Durango's table of known MBUS devices. + * + * Returns: + * FOUND - if no errors were detected and msrValue has been updated. + * NOT_KNOWN - an error was detected. msrValue is not updated. + * REQ_NOT_FOUND - 'msrAddress' for 'devID' is unknown. Caller + * should call msrInit() first. msrValue is not updated. + * Notes: + * This function should be called after gfx_msr_init + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +#else +DEV_STATUS +gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) +#endif +{ + if (device < NUM_DEVS) { + if (msrDev[device].Present == FOUND) + MSR_READ(msrRegister, msrDev[device].Address, &(msrValue->high), + &(msrValue->low)); + + return msrDev[device].Present; + } + return NOT_KNOWN; +} + +/*-------------------------------------------------------------------- + * gfx_msr_write + * + * Performs a 64-bit write to 'msrRegister' in device 'devID'. + * + * Returns: + * FOUND - if no errors were detected and msrValue has been updated. + * NOT_KNOWN - an error was detected. msrValue is not updated. + * REQ_NOT_FOUND - 'msrAddress' for 'devID' is unknown. Caller + * should call msrInit() first. msrValue is not updated. + * + * Notes: + * This function is valid to call after initMSR_API() + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +#else +DEV_STATUS +gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +#endif +{ + if (device < NUM_DEVS) { + if (msrDev[device].Present == FOUND) + MSR_WRITE(msrRegister, msrDev[device].Address, &(msrValue->high), + &(msrValue->low)); + + return msrDev[device].Present; + } + return NOT_KNOWN; +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/release.txt diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/release.txt:1.3 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/release.txt Thu Feb 6 12:46:02 2003 @@ -0,0 +1,464 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/release.txt,v 1.3 2003/02/06 17:46:02 alanh Exp $ */ +Durango Release Notes +Version 2.49.01 +Win98/WinXP/DOS/Linux +January 29, 2003 + +----------------------------------------------------------------------------- +PRODUCT INFORMATION +----------------------------------------------------------------------------- +Durango is a graphics/video software support package designed to assist in the +development of display drivers and embedded applications. The core of this +package is source code that performs most of the graphics related +functionality for the National Semiconductor ® Geode family of products. +Development time for new software is reduced by using these routines to access +the hardware. + +----------------------------------------------------------------------------- +INSTALLATION INSTRUCTIONS +----------------------------------------------------------------------------- +Download the file to a directory. Modify and include the file durango.c +according to the needs of the application. + +----------------------------------------------------------------------------- +REVISION HISTORY +----------------------------------------------------------------------------- + +02/05/03 Version 2.49.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Fixed GX2 left clipping for 4:2:0 video. + +============================================================================= + +01/29/03 Version 2.49.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Removed unused variable in CS5530 video code. +* Changed max supported pixel clock for SCx2xx to 157.5 MHz. + +============================================================================= + +01/10/03 Version 2.49.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Added extra wait loop when polling for CRC completion. +* Removed code that sets the pitch offsets for 4:2:0 video within + gfx_set_video_size. +* Fixed panning code to work with any display pitch. +* Added code to clear the PLL bypass bit when setting the dot PLL. +* Fixed panning code so cursor never disappears when panning. +* Changed GX2 delay loops to do a volatile register read to prevent + the entire delay loop from being discarded by a compiler. + +============================================================================= + +11/19/02 Version 2.47.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Updated gfx2_* routines to use a signed stride. +* SW workaround for issue #134.8 - Strange horizontal lines appearing while + drawing lines. +* Implemented gfx_set_video_left_crop for CS5530 +* Updated sub carrier reset values for NTSC and PAL. + +============================================================================= + +08/29/02 Version 2.45.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Modified gfx_set_cursor_position to use cursor position when panning and not adjust + using hotspots. +* Added new routine gfx_get_refreshrate_from_mode. +* Added gfx_text_blt routine. +* Added gfx_get_tv_display_mode_frequency routine. +* Added gfx_get_frequency_from_refreshrate routine. +* Added gfx_set_video_cursor_enable routine. +* Fixed Linux compilation warnings. +* Updated modeset code to clear panning variables. +* Added panel timings for 1600x1200 desktops. +* Removed wait for VBlank when panning using cursor routines. + +============================================================================= + +07/12/02 Version 2.43.03 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Modified gfx_get_display_mode to support 56 Hz modes. +* Added support for 8K pitch when setting a true color mode above 1024x768 +* Added a byte-packed option to gfx2_mono_expand_blt +* Fix for Carmel D2 alpha blending issue. +* Added typecasts for proper compilation. +* Fixed CS5535 MBIU address. +* Added new GX2 routine, gfx2_text_blt +* Added MSR implementations for Linux. +* Further optimized default GX1 string macros. +* Added new routine, gfx_set_panel_present to allow panning without adjusting panel timings. +* Added assembly macros for 32-bit Windows applications. + +============================================================================= + +03/21/02 Version 2.41.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Optimized GX2 Bitmap-to-screen BLTs by using a 2-line offscreen scratch area. +* Fixed a bug in GX2 monochrome bitmap BLTs. +* Fixed gfx_get_clock_frequency for GX2 2.0 +* Added 56 Hz support to gfx_get_clock_frequency +* Changed gfx_set_compression_size to subtract header size +* Changed gfx_get_compression_size to add header size + +============================================================================= + +03/04/02 Version 2.39.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Added support for CS5535 MSRs. +* Fixed a bug in monochrome bitmap BLTs. +* Added support for 32-bit CRC mechanism in GX2 2.0. +* First official GX2 release. +* Added support for new Dot PLL mechanism in GX2 2.0 +* Added support for Carmel D1.1 and D2. + +============================================================================= + +01/24/02 Version 2.37.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Changed gfx_get_clock_frequency, gfx_get_cursor_offset and gfx_get_display_offset + to be outside the GFX_READ_ROUTINES flag. +* Modified the modeset code to set higher FIFO priority levels for high bandwidth + modes. +* Init code no longer returns Redcloud ID when no chip detected. +* Added fix for Redcloud 1.x rev ID +* New GX2 PLL settings - updates to the 14 MHz table and a new 48 MHz table. +* Optimized all bitmap-to-screen routines. Optimizations include new macros that + allow correct operation in a 16-bit environment. +* 3K cache is now assumed to be the default scratchpad configuration. +* gfx_get_frame_buffer_size for GX2 no longer uses a VGA register. This allows + correct operation even with an external VGA card present in the system. +* Added support for 1152x864 desktop resolution on a flat panel. +* Added 24BPP support for large display modes. +* Modified gfx_set_video_scale such that an identity scale is now default. +* Modifed flat panel modeset code to dynamically determine the size of the mode table. +* Added support for Carmel Rev D2. + +============================================================================= + +10/22/01 Version 2.35.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* New release notes format. +* Added fix for SC1200 issue #813 (TVOut field indication is reversed. +* Added check for invalid values in video upscale. +* Fixed compilation warnings and run-time errors under DOS. +* Added new macros for word I/O. +* Optimized VSAII MSR code to used DWORD I/O. +* Fixed SoftVG base PCI base addresses. +* Several fixes to Redcloud API found during bringup. +* Modified Durango to support 4-pixel video alignment for Redcloud. +* Added the functions gfx_test_vip_overflow, gfx_get_vip_line, + gfx_set_decoder_luminance_filter, gfx_set_tv_YV_delya and + gfx_set_tv_field_status_invert. +* Added support for Carmel D1 revision ID. +* Moved gfx_get_vip_base and gfx_get_vbi_pitch outside of the + GXF_READ_ROUTINES flag. +* Minor fixes to saa7114.c and gfx_set_tv-enable. +* Added don't care option in gfx_set_vip_base. +* Added fix for SC1200 issue #1121 (VIP FIFO bus request threshold bit + is inverted. + +============================================================================= + +07/31/01 Version 2.33.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Completed implementation of vertical downscaling support for GX2. +* Added a method to lock the display controller timings. +* Added support for SC1200 Rev C. +* Small modifications to gfx_set_video_format. +* Removed unused and unimplemented I2C functions. +* Changes to prevent errors and compiler warnings in DOS. +* Updated headers to include both BSD and GPL licenses. + +============================================================================= + +06/08/01 Version 2.31.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added new routines to manipulate vertical video downscaling on GX2. +* Minor fixes to the function gfx_read_window_crc. +* Implemented all init routines for GX2 except gfx_get_core_freq. +* Added support for 27MHz reference frequency to the GX2 PLL. +* Added new function gfx_get_softvga_active. +* Minor changes to the function sc1200_reset_video. +* Fixed some minor compiler warnings. + +============================================================================= + +04/25/01 Version 2.29.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Disabled all CSC when setting an RGB video format. +* Modified sc1200_set_video_size to add 2 to the window height. +* Modified code to support the accelerator and cursor in pixel and line double modes. +* Modified gfx_get_core_freq to be a dynamic API routine. +* Added the function gfx_read_window_crc for GX2. +* Added init routine gfx_get_graphics_register_base for GX2. +* Added new macros to access the scratchpad RAM to support Win2K and WinME. +* Added mew macros to access the GP registers for GX2. + +============================================================================= + +04/06/01 Version 2.27.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added new TV read functions: + gfx_get_tv_enable, gfx_get_tv_output, gfx_get_tv_display_mode, + gfx_get_tv_mode_count, gfx_is_tv_display_mode_supported +* Added new function gfx_set_display_bpp. +* Added new function gfx_get_frame_buffer_line_size. +* Modified gfx_set_vbi_base to accept pure physical addresses instead of offsets. +* Implemented video and display controller routines for GX2. +* Modified some initialization routines to be dynamic. +* Created new API extension for GX2 MSR accesses. +* Added new icon routines for GX2. +* Modified gfx_set_tv_display to preserve current bpp. +* Minor modifications to gfx_set_tv_format, gfx_set_video_palette and + gfx_set_video_palette entry. +* Added support for 1152x864@75Hz + +============================================================================= + +03/12/01 Version 2.25.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Adapted new revision format system. +* Synchronized with NSTA Durango. Updated support for all SC1200 features. +* Added support for 640x400 as well as emulated VGA modes. +* Added new routines to access single palette color entries. +* Added new routine to return the maximum supported pixel clock. +* Added new routine gfx_set_crt_enable to manipulate the CRT display logic. +* Added new rendering routine gfx_color_pattern_fill. +* Added 4:2:0 and RGB video format support for CS5530 and SC1200. +* Modified code to allow operation under DOS. + +============================================================================= + +07/21/00 Version 2.04 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Verified Xfree86 driver version 1.1.4 under Linux, and ce v2.3. +* Merged sc1200 changes. +* Added routines to support the query of current display mode. +* Added functions gfx_enable_softvga, dfx_disable_softvga. +* Added code optimization in rendering loops to use 32 bit writes where possible. +* Added gfx_is_mode_supported to query if given mode supported by the h/w. +* Added Flat panel support, realy testing with panel done only for 800x600. +* Removed subtraction of 16 from gfx_set_compression_size. +* Added version.h file to reflect the version of the durango used. + +============================================================================= + +03/03/00 Version 2.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Verified Xfree86 driver version 1.1 under FreeBSD and Linux. +* Added automatic detection of BLT buffer bases in "gfx_set_bpp" routine. +* Fixed improper setting of VGA attrubute controller index register. +* Moved "gfx_get_display_bpp" to always be included. +* Moved "gfx_get_hactive" and "gfx_get_vactive" to always be included. +* Clipped video source size if off bottom or right side. +* Properly adjusted video offset if clipped on the top side. +* Added "gfx_get_video_line_size" and "gfx_get_video_xclip" routines. + +============================================================================= + +02/21/00 Version 2.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added gfx_vga.c. +* Added write to GP_BLIT_STATUS in "gfx_set_bpp" routine. +* Verified alpha blending on SC1200. +* Removed "gfx_set_blt_buffers" routine. + +============================================================================= + +02/09/00 Version 1.20 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Verified display modes and graphics rendering on SC1200. +* Updated PLL table for SC1200 to set modes. +* DURANGO.C FILE CHANGE!: Modifed and added compiler definitions. +* Split gfx_disp.c file into gu1_disp.c and gu2_disp.c +* Split gfx_rndr.c file into gu1_rndr.c and gu2_rndr.c +* Split gfx_vid.c file into vid_5530.c, vid_1400.c, and vid_1200.c +* Split gfx_vip.c file into vip_1400.c and vip_1200.c +* Split gfx_tv.c file into geode_tv.c and fs451_tv.c +* Split gfx_i2c.c file into acc_i2c.c and gpio_i2c.c. +* Split gfx_dcdr.c file to saa7114.c +* Added GFX_READ_ROUTINES compiler definition. +* Moved routines from gfx_read.c (no longer exists) to other files. +* Abstracted display controller access in the video overlay routines. +* Added routines to control display compression hardware. + +============================================================================= + +01/28/00 Version 1.13 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Passes randomly generated rendering tests in Darwin for GXLV. +* Fixed bug for large bitmap to screen BLTs (greater than 64K). +* Fixed bug for pattern fills using solid source data for plane masks. + +============================================================================= + +01/14/00 Version 1.12 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added proper use of hotspot to gfx_set_cursor_position. +* Fixed buffer size to handle all frame buffer start address alignments. +* Added initial version of gfx_tv.c. + +============================================================================= + +01/07/00 Version 1.11 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Fixed bug with transparent BLTs (loading transparent color into BB1). +* Added definition of gfx_color_bitmap_to_screen_blt to gfx_rtns.h. +* Added gfx_color_bitmap_to_screen_xblt (transparent bitmap to screen). + +============================================================================= + +12/21/99 Version 1.10 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added additional video decoder routines to gfx_dcdr.c. +* Added VBI routines to gfx_vip.c. +* Added alpha blending routines for SC1200 to gfx_vid.c + +============================================================================= + +10/01/99 Version 1.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added video port, video decoder, I2C, and hardware query rouines. +* New files: gfx_vip.c, gfx_dcdr.c, gfx_i2c.c, gfx_read.c. + +============================================================================= + +08/27/99 Version 0.05 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* INTERFACE CHANGE: Changed "gfx_csptr[]" to "gfx_vidptr" and "gfx_vipptr". +* Added "gfx_get_vid_register_base" and "gfx_get_vip_register_base". +* Added initial PLL table for SC1400. +* Verified mode set and video overlay routines work correctly on SC1400. +* Updated initilization routines. +* Added update of graphics engine in "gfx_set_display_pitch". + +============================================================================= + +08/20/99 Version 0.04 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* INTERFACE CHANGE: "gfx_load_*" routines changed to "gfx_set_*" for naming + consistency. The "gfx_text_glyph" routine was removed. +* Added video overlay routines. +* Added gfx_vid.c file. + +============================================================================= + +08/16/99 Version 0.03 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* INTERFACE CHANGE: Access to CS5530 now through separate pointer. Project + must declare and map the gfx_csptr[GFX_CSPTR_SIZE] variable. +* Added durango.c file as template for main source file. +* Added gfx_init.c file. + +============================================================================= + +08/04/99 Version 0.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Additional modes in gfx_mode.h file. +* Separated register definitions from gfx_defs.h into gfx_regs.h. + +============================================================================= + +07/30/99 Version 0.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Initial release. +----------------------------------------------------------------------------- + Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu1.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu1.c:1.2 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu1.c Tue Jan 14 04:34:34 2003 @@ -0,0 +1,1750 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu1.c,v 1.2 2003/01/14 09:34:34 alanh Exp $ */ +/* + * $Workfile: rndr_gu1.c $ + * + * This file contains routines to program the 2D acceleration hardware for + * the first generation graphics unit (GXLV, SC1200). + * + * gfx_set_bpp + * gfx_set_solid_pattern + * gfx_set_mono_pattern + * gfx_set_color_pattern + * gfx_set_solid_source + * gfx_set_mono_source + * gfx_set_raster_operation + * gfx_pattern_fill + * gfx_screen_to_screen_blt + * gfx_screen_to_screen_xblt + * gfx_color_bitmap_to_screen_blt + * gfx_color_bitmap_to_screen_xblt + * gfx_mono_bitmap_to_screen_blt + * gfx_bresenham_line + * gfx_wait_until_idle + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +void gu1_set_bpp(unsigned short bpp); +void gu1_set_solid_pattern(unsigned long color); +void gu1_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparency); +void gu1_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparency); +void gu1_load_color_pattern_line(short y, unsigned long *pattern_8x8); +void gu1_set_solid_source(unsigned long color); +void gu1_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent); +void gu1_set_pattern_flags(unsigned short flags); +void gu1_set_raster_operation(unsigned char rop); +void gu1_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height); +void gu1_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern); +void gu1_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height); +void gu1_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color); +void gu1_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch); +void gu1_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch, + unsigned long color); +void gu1_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, unsigned char *data, + short pitch); +void gu1_text_blt(unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data); +void gu1_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); +void gu1_wait_until_idle(void); + +#if GFX_NO_IO_IN_WAIT_MACROS +#define GFX_WAIT_PENDING while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) { ; } +#define GFX_WAIT_BUSY while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY) { ; } +#define GFX_WAIT_PIPELINE while (READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY) { ; } +#else +#define GFX_WAIT_PENDING while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) { INB (0x80); } +#define GFX_WAIT_BUSY while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY) { INB (0x80); } +#define GFX_WAIT_PIPELINE while (READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY) { INB (0x80); } +#endif + +void gu1_detect_blt_buffer_base(void); +int gu1_test_blt_pending(void); +void gu1_solid_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long color); + +/*--------------------------------------------------------------------------- + * GFX_SET_BPP + * + * This routine sets the bits per pixel value in the graphics engine. + * It is also stored in a static variable to use in the future calls to + * the rendering routines. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_bpp(unsigned short bpp) +#else +void +gfx_set_bpp(unsigned short bpp) +#endif +{ + int control = 0; + unsigned short pitch = gfx_get_display_pitch(); + + GFXbpp = bpp; + + /* DETECT BASE ADDRESSES FOR BLT BUFFERS */ + /* Different for 2K or 3K of scratchpad. Also need to calculate */ + /* the number of pixels that can fit in a BLT buffer - need to */ + /* subtract 16 for alignment considerations. The 2K case, for */ + /* example, is 816 bytes wide, allowing 800 pixels in 8 BPP, which */ + /* means rendering operations won't be split for 800x600. */ + + gu1_detect_blt_buffer_base(); + GFXbufferWidthPixels = GFXbb1Base - GFXbb0Base - 16; + if (bpp > 8) { + /* If 16bpp, divide GFXbufferWidthPixels by 2 */ + GFXbufferWidthPixels >>= 1; + } + + /* SET THE GRAPHICS CONTROLLER BPP AND PITCH */ + if (bpp > 8) { + /* Set the 16bpp bit if necessary */ + control = BC_16BPP; + } + if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) { + control |= BC_FB_WIDTH_4096; + } else if (pitch > 1024) { + control |= BC_FB_WIDTH_2048; + } + GFX_WAIT_BUSY; + WRITE_REG32(GP_BLIT_STATUS, control); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_SOLID_SOURCE +// +// This routine is used to specify a solid source color. For the Xfree96 +// display driver, the source color is used to specify a planemask and the +// ROP is adjusted accordingly. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_solid_source(unsigned long color) +#else +void +gfx_set_solid_source(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_COLOR_0, (unsigned short)color); + WRITE_REG16(GP_SRC_COLOR_1, (unsigned short)color); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_MONO_SOURCE +// +// This routine is used to specify the monochrome source colors. +// It must be called *after* loading any pattern data (those routines +// clear the source flags). +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#else +void +gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#endif +{ + /* SET TRANSPARENCY FLAG */ + + GFXsourceFlags = transparent ? RM_SRC_TRANSPARENT : 0; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + bgcolor &= 0x00FF; + bgcolor |= (bgcolor << 8); + fgcolor &= 0x00FF; + fgcolor |= (fgcolor << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_COLOR_0, (unsigned short)bgcolor); + WRITE_REG16(GP_SRC_COLOR_1, (unsigned short)fgcolor); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_SOLID_PATTERN +// +// This routine is used to specify a solid pattern color. It is called +// before performing solid rectangle fills or more complicated BLTs that +// use a solid pattern color. +// +// The driver should always call "gfx_load_raster_operation" after a call +// to this routine to make sure that the pattern flags are set appropriately. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_solid_pattern(unsigned long color) +#else +void +gfx_set_solid_pattern(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = 0; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + + /* SAVE THE REFORMATTED COLOR FOR LATER */ + /* Used to call the "GFX_solid_fill" routine for special cases. */ + + GFXsavedColor = color; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_MONO_PATTERN +// +// This routine is used to specify a monochrome pattern. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparent) +#else +void +gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparent) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = transparent ? RM_PAT_MONO | RM_PAT_TRANSPARENT : + RM_PAT_MONO; + + /* FORMAT 8 BPP COLOR */ + /* GXm requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + bgcolor &= 0x00FF; + bgcolor |= (bgcolor << 8); + fgcolor &= 0x00FF; + fgcolor |= (fgcolor << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)bgcolor); + WRITE_REG16(GP_PAT_COLOR_1, (unsigned short)fgcolor); + WRITE_REG32(GP_PAT_DATA_0, data0); + WRITE_REG32(GP_PAT_DATA_1, data1); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_COLOR_PATTERN +// +// This routine is used to specify a color pattern. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) +#else +void +gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = transparent ? RM_PAT_MONO | RM_PAT_TRANSPARENT : + RM_PAT_MONO; + + GFXpatternFlags |= RM_PAT_COLOR; + /* FORMAT 8 BPP COLOR */ + /* GXm requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + bgcolor &= 0x00FF; + bgcolor |= (bgcolor << 8); + fgcolor &= 0x00FF; + fgcolor |= (fgcolor << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)bgcolor); + WRITE_REG16(GP_PAT_COLOR_1, (unsigned short)fgcolor); + WRITE_REG32(GP_PAT_DATA_0, data0); + WRITE_REG32(GP_PAT_DATA_1, data1); + if (GFXbpp > 8) { + WRITE_REG32(GP_PAT_DATA_2, data2); + WRITE_REG32(GP_PAT_DATA_3, data3); + } +} + +/* +//--------------------------------------------------------------------------- +// GFX_LOAD_COLOR_PATTERN_LINE +// +// This routine is used to load a single line of a 8x8 color pattern. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#else +void +gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = RM_PAT_COLOR; + + y &= 7; + + if (GFXbpp > 8) + pattern_8x8 += (y << 2); + else + pattern_8x8 += (y << 1); + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ + + GFX_WAIT_PENDING; + WRITE_REG32(GP_PAT_DATA_0, pattern_8x8[0]); + WRITE_REG32(GP_PAT_DATA_1, pattern_8x8[1]); + if (GFXbpp > 8) { + WRITE_REG32(GP_PAT_DATA_2, pattern_8x8[2]); + WRITE_REG32(GP_PAT_DATA_3, pattern_8x8[3]); + } +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_RASTER_OPERATION +// +// This routine loads the specified raster operation. It sets the pattern +// flags appropriately. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_raster_operation(unsigned char rop) +#else +void +gfx_set_raster_operation(unsigned char rop) +#endif +{ + unsigned short rop16; + + /* GENERATE 16-BIT VERSION OF ROP WITH PATTERN FLAGS */ + + rop16 = (unsigned short)rop | GFXpatternFlags; + if ((rop & 0x33) ^ ((rop >> 2) & 0x33)) + rop16 |= GFXsourceFlags; + + /* SAVE ROP FOR LATER COMPARISONS */ + /* Need to have the pattern flags included */ + + GFXsavedRop = rop16; + + /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */ + /* True if even bits (0:2:4:6) do not equal the correspinding */ + /* even bits (1:3:5:7). */ + + GFXusesDstData = ((rop & 0x55) ^ ((rop >> 1) & 0x55)); + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_RASTER_MODE, rop16); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SOLID_FILL +// +// This routine MUST be used when performing a solid rectangle fill with +// the ROPs of PATCOPY (0xF0), BLACKNESS (0x00), WHITENESS (0xFF), or +// PATINVERT (0x0F). There is a bug in GXm for these cases that requires a +// workaround. +// +// For BLACKNESS (ROP = 0x00), set the color to 0x0000. +// For WHITENESS (ROP = 0xFF), set the color to 0xFFFF. +// For PATINVERT (ROP = 0x0F), invert the desired color. +// +// X screen X position (left) +// Y screen Y position (top) +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// COLOR fill color +// +// THIS ROUTINE SHOULD NOT BE DIRECTLY CALLED FROM THE DRIVER. The driver +// should always use GFX_pattern_fill and let that routine call this one +// when approipriate. This is to hide quirks specific to MediaGX hardware. +//--------------------------------------------------------------------------- +*/ +void +gu1_solid_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long color) +{ + unsigned short section; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + + /* SET REGISTERS TO DRAW RECTANGLE */ + + WRITE_REG16(GP_DST_XCOOR, x); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_RASTER_MODE, 0x00F0); /* PATCOPY */ + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); + + /* CHECK WIDTH FOR GX BUG WORKAROUND */ + + if (width <= 16) { + /* OK TO DRAW SMALL RECTANGLE IN ONE PASS */ + + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_BLIT_MODE, 0); + } else { + /* DRAW FIRST PART OF RECTANGLE */ + /* Get to a 16 pixel boundary. */ + + section = 0x10 - (x & 0x0F); + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_BLIT_MODE, 0); + + /* POLL UNTIL ABLE TO LOAD THE SECOND RECTANGLE */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, x + section); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_WIDTH, width - section); + WRITE_REG16(GP_BLIT_MODE, 0); + } +} + +/* +//---------------------------------------------------------------------------- +// GFX_PATTERN_FILL +// +// This routine is used to fill a rectangular region. The pattern must +// be previously loaded using one of GFX_load_*_pattern routines. Also, the +// raster operation must be previously specified using the +// "GFX_load_raster_operation" routine. +// +// X screen X position (left) +// Y screen Y position (top) +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#else +void +gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned short section, buffer_width, blit_mode; + + /* CHECK IF OPTIMIZED SOLID CASES */ + /* Check all 16 bits of the ROP to include solid pattern flags. */ + + switch (GFXsavedRop) { + /* CHECK FOR SPECIAL CASES WITHOUT DESTINATION DATA */ + /* Need hardware workaround for fast "burst write" cases. */ + + case 0x00F0: + gu1_solid_fill(x, y, width, height, (unsigned short)GFXsavedColor); + break; + case 0x000F: + gu1_solid_fill(x, y, width, height, (unsigned short)~GFXsavedColor); + break; + case 0x0000: + gu1_solid_fill(x, y, width, height, 0x0000); + break; + case 0x00FF: + gu1_solid_fill(x, y, width, height, 0xFFFF); + break; + + /* REMAINING CASES REQUIRE DESTINATION DATA OR NOT SOLID COLOR */ + + default: + + /* DETERMINE BLT MODE VALUE */ + /* Still here for non-solid patterns without destination data. */ + + blit_mode = GFXusesDstData ? BM_READ_DST_FB0 : 0; + + /* SET SOURCE EXPANSION MODE */ + /* If the ROP requires source data, then the source data is all 1's */ + /* and then expanded into the desired color in GP_SRC_COLOR_1. */ + + blit_mode |= BM_SOURCE_EXPAND; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + + /* SINCE ONLY DESTINATION DATA, WE CAN USE BOTH BB0 AND BB1. */ + /* Therefore, width available = BLT buffer width * 2. */ + + buffer_width = GFXbufferWidthPixels << 1; + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer */ + /* allows. Hardware does not split the operations, so */ + /* software must do it to avoid large scanlines that would */ + /* overflow the BLT buffers. */ + + while (width > 0) { + /* DETERMINE WIDTH OF SECTION */ + + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, x); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + + /* ADJUST PARAMETERS FOR NEXT SECTION */ + + width -= section; + x += section; + } + break; + } +} + +/* +//---------------------------------------------------------------------------- +// GFX_COLOR_PATTERN_FILL +// +// This routine is used to render a rectangle using the current raster +// operation and the specified color pattern. It allows an 8x8 color +// pattern to be rendered without multiple calls to the gfx_set_color_pattern +// and gfx_pattern_fill routines. +// +// X screen X position (left) +// Y screen Y position (top) +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *PATTERN pointer to 8x8 color pattern data +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern) +#else +void +gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern) +#endif +{ + unsigned short blit_mode, passes, cur_y, pat_y, i; + unsigned short buffer_width, line_width; + unsigned short bpp_shift, section, cur_x; + + /* SET APPROPRIATE INCREMENT */ + + bpp_shift = (GFXbpp > 8) ? 2 : 1; + + /* SET DESTINATION REQUIRED */ + + blit_mode = GFXusesDstData ? BM_READ_DST_FB0 : 0; + + /* SET SOURCE EXPANSION */ + + blit_mode |= BM_SOURCE_EXPAND; + + /* OVERRIDE RASTER MODE TO FORCE A COLOR PATTERN */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_RASTER_MODE, + (GFXsavedRop & ~RM_PAT_MASK & ~RM_PAT_TRANSPARENT) | + RM_PAT_COLOR); + + /* WRITE THE REGISTERS THAT DO NOT CHANGE */ + /* If destination data is required, the width and */ + /* x position will be overwritten. */ + + WRITE_REG16(GP_HEIGHT, 1); + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_DST_XCOOR, x); + + /* THE ENTIRE PATTERN WILL NOT BE DRAWN IF THE HEIGHT IS LESS THAN 8 */ + + passes = (height < 8) ? height : 8; + + /* SINCE ONLY DESTINATION DATA, WE CAN USE BOTH BB0 AND BB1. */ + /* Therefore, width available = BLT buffer width * 2. */ + + buffer_width = GFXbufferWidthPixels << 1; + + for (i = 0; i < passes; i++) { + pat_y = ((y + i) & 7) << bpp_shift; + cur_y = y + i; + + /* WRITE THE PATTERN DATA FOR THE ACTIVE LINE */ + + GFX_WAIT_PENDING; + WRITE_REG32(GP_PAT_DATA_0, pattern[pat_y]); + WRITE_REG32(GP_PAT_DATA_1, pattern[pat_y + 1]); + + if (GFXbpp > 8) { + WRITE_REG32(GP_PAT_DATA_2, pattern[pat_y + 2]); + WRITE_REG32(GP_PAT_DATA_3, pattern[pat_y + 3]); + } + + /* SPLIT BLT LINE INTO SECTIONS IF REQUIRED */ + /* If no destination data is required, we can ignore */ + /* the BLT buffers. Otherwise, we must separate the BLT */ + /* so as not to overflow the buffers */ + + if (blit_mode & BM_READ_DST_BB0) { + line_width = width; + cur_x = x; + + while (line_width) { + section = (line_width > buffer_width) ? buffer_width : line_width; + cur_y = y + i; + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, cur_x); + WRITE_REG16(GP_WIDTH, section); + + while (cur_y < y + height) { + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_YCOOR, cur_y); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + cur_y += 8; + } + + cur_x += section; + line_width -= section; + } + + } else { + while (cur_y < y + height) { + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_YCOOR, cur_y); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + cur_y += 8; + } + } + + } + + /* RESTORE ORIGINAL ROP AND FLAGS */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_RASTER_MODE, GFXsavedRop); + +} + +/* +//---------------------------------------------------------------------------- +// SCREEN TO SCREEN BLT +// +// This routine should be used to perform a screen to screen BLT when the +// ROP does not require destination data. +// +// SRCX screen X position to copy from +// SRCY screen Y position to copy from +// DSTX screen X position to copy to +// DSTY screen Y position to copy to +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) +#else +void +gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode; + + /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */ + + blit_mode = GFXusesDstData ? BM_READ_DST_FB1 | BM_READ_SRC_FB : + BM_READ_SRC_FB; + + /* CHECK Y DIRECTION */ + /* Hardware has support for negative Y direction. */ + + if (dsty > srcy) { + blit_mode |= BM_REVERSE_Y; + srcy += height - 1; + dsty += height - 1; + } + + /* CHECK X DIRECTION */ + /* Hardware does not support negative X direction since at the time */ + /* of development all supported resolutions could fit a scanline of */ + /* data at once into the BLT buffers (using both BB0 and BB1). This */ + /* code is more generic to allow for any size BLT buffer. */ + + if (dstx > srcx) { + srcx += width; + dstx += width; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + + /* CHECK AVAILABLE BLT BUFFER SIZE */ + /* Can use both BLT buffers if no destination data is required. */ + + buffer_width = GFXusesDstData ? GFXbufferWidthPixels : + GFXbufferWidthPixels << 1; + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */ + /* Hardware does not split the operations, so software must do it to */ + /* avoid large scanlines that would overflow the BLT buffers. */ + + while (width > 0) { + /* CHECK WIDTH OF CURRENT SECTION */ + + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_YCOOR, srcy); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, section); + + /* CHECK X DIRECTION */ + + if (dstx > srcx) { + /* NEGATIVE X DIRECTION */ + /* Still positive X direction within the section. */ + + srcx -= section; + dstx -= section; + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + } else { + /* POSITIVE X DIRECTION */ + + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + dstx += section; + srcx += section; + } + width -= section; + } +} + +/* +//---------------------------------------------------------------------------- +// SCREEN TO SCREEN TRANSPARENT BLT +// +// This routine should be used to perform a screen to screen BLT when a +// specified color should by transparent. The only supported ROP is SRCCOPY. +// +// SRCX screen X position to copy from +// SRCY screen Y position to copy from +// DSTX screen X position to copy to +// DSTY screen Y position to copy to +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// COLOR transparent color +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) +#else +void +gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode = BM_READ_SRC_FB; + + /* CHECK Y DIRECTION */ + /* Hardware has support for negative Y direction. */ + + if (dsty > srcy) { + blit_mode |= BM_REVERSE_Y; + srcy += height - 1; + dsty += height - 1; + } + + /* CHECK X DIRECTION */ + /* Hardware does not support negative X direction since at the time */ + /* of development all supported resolutions could fit a scanline of */ + /* data at once into the BLT buffers (using both BB0 and BB1). This */ + /* code is more generic to allow for any size BLT buffer. */ + + if (dstx > srcx) { + srcx += width; + dstx += width; + } + + /* CALCULATE BLT BUFFER SIZE */ + /* Need to use BB1 to store the BLT buffer data. */ + + buffer_width = GFXbufferWidthPixels; + + /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + color = (color & 0x0000FFFF) | (color << 16); + + /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */ + /* Need to make sure any previous BLT using BB1 is complete. */ + /* Only need to load 32 bits of BB1 for the 1 pixel BLT that follows. */ + + GFX_WAIT_BUSY; + WRITE_SCRATCH32(GFXbb1Base, color); + + /* DO BOGUS BLT TO LATCH DATA FROM BB1 */ + /* Already know graphics pipeline is idle. */ + /* Only need to latch data into the holding registers for the current */ + /* data from BB1. A 1 pixel wide BLT will suffice. */ + + WRITE_REG32(GP_DST_XCOOR, 0); + WRITE_REG32(GP_SRC_XCOOR, 0); + WRITE_REG32(GP_WIDTH, 0x00010001); + WRITE_REG16(GP_RASTER_MODE, 0x00CC); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1); + + /* WRITE REGISTERS FOR REAL SCREEN TO SCREEN BLT */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_RASTER_MODE, 0x10C6); + WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF); + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */ + /* Hardware does not split the operations, so software must do it to */ + /* avoid large scanlines that would overflow the BLT buffers. */ + + while (width > 0) { + /* CHECK WIDTH OF CURRENT SECTION */ + + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_YCOOR, srcy); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, section); + + /* CHECK X DIRECTION */ + /* Again, this must be done in software, and can be removed if the */ + /* display driver knows that the BLT buffers will always be large */ + /* enough to contain an entire scanline of a screen to screen BLT. */ + + if (dstx > srcx) { + /* NEGATIVE X DIRECTION */ + /* Still positive X direction within the section. */ + + srcx -= section; + dstx -= section; + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + } else { + /* POSITIVE X DIRECTION */ + + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + dstx += section; + srcx += section; + } + width -= section; + } +} + +/* +//---------------------------------------------------------------------------- +// COLOR BITMAP TO SCREEN BLT +// +// This routine transfers color bitmap data to the screen. For most cases, +// when the ROP is SRCCOPY, it may be faster to write a separate routine that +// copies the data to the frame buffer directly. This routine should be +// used when the ROP requires destination data. +// +// Transparency is handled by another routine. +// +// SRCX X offset within source bitmap +// SRCY Y offset within source bitmap +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +// PITCH pitch of bitmap data (bytes between scanlines) +//---------------------------------------------------------------------------- +*/ + +#if GFX_2DACCEL_DYNAMIC +void +gu1_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) +#else +void +gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode = BM_READ_SRC_BB0; + unsigned short temp_height; + unsigned long dword_bytes_needed, bytes_extra; + unsigned long bpp_shift; + long array_offset; + + /* CHECK SIZE OF BLT BUFFER */ + + buffer_width = GFXbufferWidthPixels; + + /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */ + /* If no destination data, we have twice the room for */ + /* source data. */ + + if (GFXusesDstData) + blit_mode |= BM_READ_DST_FB1; + else + buffer_width <<= 1; + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, 1); + + bpp_shift = (GFXbpp + 7) >> 4; + + while (width > 0) { + if (width > buffer_width) + section = buffer_width; + else + section = width; + + dword_bytes_needed = (section << bpp_shift) & ~3l; + bytes_extra = (section << bpp_shift) & 3l; + + temp_height = height; + + /* WRITE THE REGISTERS FOR EACH SECTION */ + /* The GX hardware will auto-increment the Y coordinate, meaning */ + /* that we don't have to. */ + + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + + /* CALCULATE THE BITMAP OFFSET */ + + array_offset = + (unsigned long)srcy *(long)pitch + ((long)srcx << bpp_shift); + + while (temp_height--) { + GFX_WAIT_PIPELINE; + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, + array_offset); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + + array_offset += pitch; + } + + width -= section; + srcx += section; + dstx += section; + } +} + +/* +//---------------------------------------------------------------------------- +// COLOR BITMAP TO SCREEN TRANSPARENT BLT +// +// This routine transfers color bitmap data to the screen with transparency. +// The transparent color is specified. The only supported ROP is SRCCOPY, +// meaning that transparency cannot be applied if the ROP requires +// destination data (this is a hardware restriction). +// +// SRCX X offset within source bitmap +// SRCY Y offset within source bitmap +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +// PITCH pitch of bitmap data (bytes between scanlines) +// COLOR transparent color +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) +#else +void +gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) +#endif +{ + unsigned short section, buffer_width; + unsigned short temp_height; + unsigned long dword_bytes_needed, bytes_extra; + unsigned long bpp_shift; + long array_offset; + + /* CHECK SIZE OF BLT BUFFER */ + + buffer_width = GFXbufferWidthPixels; + + /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + color = (color & 0x0000FFFF) | (color << 16); + + /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */ + /* Need to make sure any previous BLT using BB1 is complete. */ + /* Only need to load 32 bits of BB1 for the 1 pixel BLT that follows. */ + + GFX_WAIT_PIPELINE; + GFX_WAIT_PENDING; + WRITE_SCRATCH32(GFXbb1Base, color); + + /* DO BOGUS BLT TO LATCH DATA FROM BB1 */ + /* Already know graphics pipeline is idle. */ + /* Only need to latch data into the holding registers for the current */ + /* data from BB1. A 1 pixel wide BLT will suffice. */ + + WRITE_REG32(GP_DST_XCOOR, 0); + WRITE_REG32(GP_SRC_XCOOR, 0); + WRITE_REG32(GP_WIDTH, 0x00010001); + WRITE_REG16(GP_RASTER_MODE, 0x00CC); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, 1); + WRITE_REG16(GP_RASTER_MODE, 0x10C6); + WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF); + + bpp_shift = (GFXbpp + 7) >> 4; + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + while (width > 0) { + if (width > buffer_width) + section = buffer_width; + else + section = width; + + dword_bytes_needed = (section << bpp_shift) & ~3l; + bytes_extra = (section << bpp_shift) & 3l; + + temp_height = height; + + /* WRITE THE REGISTERS FOR EACH SECTION */ + /* The GX hardware will auto-increment the Y coordinate, meaning */ + /* that we don't have to. */ + + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + + /* CALCULATE THE BITMAP OFFSET */ + + array_offset = + (unsigned long)srcy *(long)pitch + ((long)srcx << bpp_shift); + + while (temp_height--) { + GFX_WAIT_PIPELINE; + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, + array_offset); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0); + + array_offset += pitch; + } + + width -= section; + srcx += section; + dstx += section; + } +} + +/* +//---------------------------------------------------------------------------- +// MONOCHROME BITMAP TO SCREEN BLT +// +// This routine transfers monochrome bitmap data to the screen. +// +// SRCX X offset within source bitmap +// SRCY Y offset within source bitmap +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +// PITCH pitch of bitmap data (bytes between scanlines) +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +#else +void +gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode = BM_READ_SRC_BB0 | BM_SOURCE_EXPAND; + unsigned short temp_height; + unsigned long dword_bytes_needed, bytes_extra; + long array_offset; + + /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */ + /* If no destination data, the source data will always fit. */ + /* So, in that event we will set the buffer width to a */ + /* fictitiously large value such that the BLT is never split. */ + + if (GFXusesDstData) { + buffer_width = GFXbufferWidthPixels; + blit_mode |= BM_READ_DST_FB1; + } else + buffer_width = 3200; + + /* CHECK IF DATA ALREADY IN BLIT BUFFER */ + /* If the pointer is NULL, data for the full BLT is already there */ + /* WARNING: This could cause problems if destination data is */ + /* involved and it overflows the BLT buffer. Need to remove */ + /* this option and change the drivers to use a temporary buffer. */ + + if (!data) { + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_XCOOR, srcx & 7); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + return; + } + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, 1); + + while (width > 0) { + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* CALCULATE BYTES NEEDED */ + /* Add 1 for possible alignment issues. */ + + dword_bytes_needed = ((section + 7 + (srcx & 7)) >> 3) & ~3l; + bytes_extra = ((section + 7 + (srcx & 7)) >> 3) & 3l; + + temp_height = height; + + /* WRITE THE REGISTERS FOR EACH SECTION */ + /* The GX hardware will auto-increment the Y coordinate, meaning */ + /* that we don't have to. */ + + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_SRC_XCOOR, srcx & 7); + + /* CALCULATE THE BITMAP OFFSET */ + + array_offset = (unsigned long)srcy *(long)pitch + ((long)srcx >> 3); + + while (temp_height--) { + GFX_WAIT_PIPELINE; + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, + array_offset); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + + array_offset += pitch; + } + + width -= section; + srcx += section; + dstx += section; + } +} + +/* +//---------------------------------------------------------------------------- +// MONOCHROME TEXT BLT +// +// This routine transfers contiguous monochrome text data to the screen. +// +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#else +void +gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#endif +{ + unsigned long dword_bytes_needed, bytes_extra; + long pitch, buffer_bytes, data_bytes; + + /* CALCULATE DATA SIZE */ + + pitch = (width + 7) >> 3; + data_bytes = (long)height *pitch; + + /* CHECK FOR SIMPLE CASE */ + /* This routine is designed to render a source copy text glyph. If destination */ + /* data is required or the source data will not fit, we will punt the operation */ + /* to the more versatile (and slow) mono bitmap routine. */ + + if (GFXbpp > 8) + buffer_bytes = GFXbufferWidthPixels << 1; + else + buffer_bytes = GFXbufferWidthPixels; + + if (GFXusesDstData || data_bytes > buffer_bytes) { + gfx_mono_bitmap_to_screen_blt(0, 0, dstx, dsty, width, height, data, + (short)pitch); + return; + } + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + dword_bytes_needed = data_bytes & ~3l; + bytes_extra = data_bytes & 3l; + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_SRC_XCOOR, 0); + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + GFX_WAIT_PIPELINE; + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, 0); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0 | BM_SOURCE_TEXT); +} + +/* +//---------------------------------------------------------------------------- +// BRESENHAM LINE +// +// This routine draws a vector using the specified Bresenham parameters. +// Currently this file does not support a routine that accepts the two +// endpoints of a vector and calculates the Bresenham parameters. If it +// ever does, this routine is still required for vectors that have been +// clipped. +// +// X screen X position to start vector +// Y screen Y position to start vector +// LENGTH length of the vector, in pixels +// INITERR Bresenham initial error term +// AXIALERR Bresenham axial error term +// DIAGERR Bresenham diagonal error term +// FLAGS VM_YMAJOR, VM_MAJOR_INC, VM_MINOR_INC +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu1_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +#else +void +gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +#endif +{ + unsigned short vector_mode = flags; + + if (GFXusesDstData) + vector_mode |= VM_READ_DST_FB; + + /* CHECK NULL LENGTH */ + + if (!length) + return; + + /* LOAD THE REGISTERS FOR THE VECTOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, x); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_VECTOR_LENGTH, length); + WRITE_REG16(GP_INIT_ERROR, initerr); + WRITE_REG16(GP_AXIAL_ERROR, axialerr); + WRITE_REG16(GP_DIAG_ERROR, diagerr); + WRITE_REG16(GP_VECTOR_MODE, vector_mode); +} + +/*--------------------------------------------------------------------------- + * GFX_WAIT_UNTIL_IDLE + * + * This routine waits until the graphics engine is idle. This is required + * before allowing direct access to the frame buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_wait_until_idle(void) +#else +void +gfx_wait_until_idle(void) +#endif +{ + GFX_WAIT_BUSY; +} + +/*--------------------------------------------------------------------------- + * GFX_TEST_BLT_PENDING + * + * This routine returns 1 if a BLT is pending, meaning that a call to + * perform a rendering operation would stall. Otherwise it returns 0. + * It is used by Darwin during random testing to only start a BLT + * operation when it knows the Durango routines won't spin on graphics + * (so Darwin can continue to do frame buffer reads and writes). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +int +gu1_test_blt_pending(void) +#else +int +gfx_test_blt_pending(void) +#endif +{ + if (READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * BLT BUFFERS!!!!! + *--------------------------------------------------------------------------- + */ + +/* THE BOOT CODE MUST SET THE BLT BUFFER BASES USING THE "CPU_WRITE" */ +/* INSTRUCTION TO ONE OF THE FOLLOWING VALUES: */ + +#define BB0_BASE_2K 0x800 +#define BB1_BASE_2K 0xB30 +#define BB0_BASE_3K 0x400 +#define BB1_BASE_3K 0x930 + +/*--------------------------------------------------------------------------- + * gu1_detect_blt_buffer_base + * + * This detection is hidden from the driver by being called from the + * "gfx_set_bpp" routine. + * + * This is fairly ugly for the following reasons: + * + * - It is the boot code that must set the BLT buffer bases to the + * appropriate values and load the scratchpad tags. + * - The old drivers would also set the base address values to what they + * knew they should be for the 2K or 3K scratchpad configuration. + * - Unfortunately, to set the base addresses requires the use of the + * CPU_WRITE instruction, an instruction specific to GX. + * - Using the CPU_WRITE instruction requires the use of assembly to + * produce the appropriate op codes. + * - Assembly is something that is avoided in Durango because it is not + * platform independent. Some compilers do not support inline assembly. + * - Therefore Durango cannot use the CPU_WRITE instruction. + * - Therefore drivers using Durango must rely on the boot code to set + * the appropriate values. Durango uses this routine to check where + * the base addresses have been set. + * - Unfortunately, it is not as simple as using IO to check for 2K or 3K + * scratchpad size. In VSA1, even though the boot code may set it for + * 3K, SoftVGA comes along and resets it to 2K for it's use in text + * redraws. It used to be that the display driver would set it back + * to 3K. + * - So, the Durango code was changed to just always use 2K. + * - But, the XpressROM code sets it for 3K, and the newer versions of + * SoftVGA do not interfere with that, so then Durango needs to use + * the 3K values to work properly. + * - Therefore, Durango does somewhat of a kludge by writing to directly + * to the scratchpad at both the 2K and 3K locations, then performing + * a unobtrusive BLT that loads data into BB0 (the graphics engine + * always knows the true base). After the BLT, Durango looks to see + * which location changed to know where the base address is. + * - This is a relatively simple way to allow Durango to work on old + * and new platforms without using theCPU_WRITE instructions. + * + * To summarize, the BLT buffers are one of the most painful aspects of + * the GX graphics unit design, and have been removed from future designs + * (the graphics unit has its own dedicated RAM). Durango has tried to + * hide the BLT buffer use from the drivers. + *--------------------------------------------------------------------------- + */ +void +gu1_detect_blt_buffer_base(void) +{ + /* ASSUME 2K */ + + GFXbb0Base = BB0_BASE_2K; + GFXbb1Base = BB1_BASE_2K; + + /* CHECK IF SCRATCHPAD IS SET TO 3K OR 4K */ + /* Boot code should still set 3K values for 4K. */ + + if (gfx_gxm_config_read(GXM_CONFIG_GCR) & 0x08) { + /* WRITE DATA TO 3K LOCATION */ + + GFX_WAIT_BUSY; + WRITE_SCRATCH32(BB0_BASE_3K, 0xFEEDFACE); + + /* HAVE THE GRAPHICS UNIT STORE SOMETHING IN BB0 */ + + WRITE_REG32(GP_DST_XCOOR, 0x00000000); /* AT (0,0) */ + WRITE_REG32(GP_WIDTH, 0x00010004); /* 4x1 BLT */ + WRITE_REG16(GP_RASTER_MODE, 0x00AA); /* KEEP DST */ + WRITE_REG16(GP_BLIT_MODE, BM_READ_DST_FB0); /* STORE IN BB0 */ + + /* CHECK 3K LOCATION */ + /* Breaks if data happened to be 0xFEEDFACE - unlikely. */ + + GFX_WAIT_BUSY; + if (READ_SCRATCH32(BB0_BASE_3K) != 0xFEEDFACE) { + GFXbb0Base = BB0_BASE_3K; + GFXbb1Base = BB1_BASE_3K; + } + } +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu2.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu2.c:1.1 --- /dev/null Thu Feb 27 12:31:15 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu2.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,2365 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/rndr_gu2.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: rndr_gu2.c $ + * + * This file contains routines to program the 2D acceleration hardware for + * the second generation graphics unit. + * + * Basic rendering routines (common to all Geode processors): + * gfx_set_bpp + * gfx_set_solid_pattern + * gfx_set_mono_pattern + * gfx_set_color_pattern + * gfx_set_solid_source + * gfx_set_mono_source + * gfx_set_raster_operation + * gfx_pattern_fill + * gfx_color_pattern_fill + * gfx_screen_to_screen_blt + * gfx_screen_to_screen_xblt + * gfx_color_bitmap_to_screen_blt + * gfx_color_bitmap_to_screen_xblt + * gfx_mono_bitmap_to_screen_blt + * gfx_bresenham_line + * gfx_wait_until_idle + * + * Extended rendering routines for second generation functionality: + * gfx2_set_source_stride + * gfx2_set_destination_stride + * gfx2_set_pattern_origins + * gfx2_set_source_transparency + * gfx2_set_alpha_mode + * gfx2_set_alpha_value + * gfx2_pattern_fill + * gfx2_color_pattern_fill + * gfx2_screen_to_screen_blt + * gfx2_mono_expand_blt + * gfx2_color_bitmap_to_screen_blt + * gfx2_mono_bitmap_to_screen_blt + * gfx2_bresenham_line + * gfx2_sync_to_vblank + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +void gu2_set_bpp(unsigned short bpp); +void gu2_set_solid_pattern(unsigned long color); +void gu2_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparency); +void gu2_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparency); +void gu2_load_color_pattern_line(short y, unsigned long *pattern_8x8); +void gu2_set_solid_source(unsigned long color); +void gu2_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent); +void gu2_set_pattern_flags(unsigned short flags); +void gu2_set_raster_operation(unsigned char rop); +void gu2_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height); +void gu2_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern); +void gu2_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height); +void gu2_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color); +void gu2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch); +void gu2_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch, + unsigned long color); +void gu2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, unsigned char *data, + short pitch); +void gu2_text_blt(unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data); +void gu2_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); +void gu2_wait_until_idle(void); +int gu2_test_blt_pending(void); + +/* SECOND GENERATION RENDERING ROUTINES */ + +void gu22_set_source_stride(unsigned short stride); +void gu22_set_destination_stride(unsigned short stride); +void gu22_set_pattern_origin(int x, int y); +void gu22_set_source_transparency(unsigned long color, unsigned long mask); +void gu22_set_alpha_mode(int mode); +void gu22_set_alpha_value(unsigned char value); +void gu22_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height); +void gu22_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern); +void gu22_screen_to_screen_blt(unsigned long srcoffset, + unsigned long dstoffset, unsigned short width, + unsigned short height, int flags); +void gu22_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed); +void gu22_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); +void gu22_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); +void gu22_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data); +void gu22_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); +void gu22_sync_to_vblank(void); +void gu2_reset_pitch(unsigned short pitch); + +#define GU2_WAIT_PENDING while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) +#define GU2_WAIT_BUSY while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) +#define GU2_WAIT_HALF_EMPTY while(!(READ_GP32(MGP_BLT_STATUS) & MGP_BS_HALF_EMPTY)) + +/* PATTERN SWIZZLES */ + +#define WORD_SWIZZLE(x) (((x) << 16) | ((x) >> 16)) +#define BYTE_SWIZZLE(x) (((x) << 24) | ((x) >> 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00)) + +/* GLOBAL VARIABLES USED BY THE RENDERING ROUTINES */ + +unsigned long gu2_bpp; +unsigned long gu2_pitch = 1280; +unsigned long gu2_src_pitch = 1280; +unsigned long gu2_dst_pitch = 1280; +unsigned long gu2_xshift = 1; +unsigned long gu2_pattern_origin = 0; +unsigned long gu2_rop32; +unsigned long gu2_alpha32 = 0; +unsigned long gu2_alpha_value = 0; +unsigned long gu2_alpha_mode = 0; +unsigned long gu2_alpha_active = 0; +unsigned short gu2_alpha_blt_mode = 0; +unsigned short gu2_alpha_vec_mode = 0; +unsigned short gu2_blt_mode = 0; +unsigned short gu2_vector_mode = 0; +unsigned short gu2_bm_throttle = 0; +unsigned short gu2_vm_throttle = 0; +int gu2_current_line = 0; + +/*--------------------------------------------------------------------------- + * GFX_RESET_PITCH (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine resets all pitches in the graphics engine to one value. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_reset_pitch(unsigned short pitch) +#else +void +gfx_reset_pitch(unsigned short pitch) +#endif +{ + gu2_pitch = pitch; + gu2_dst_pitch = pitch; + gu2_src_pitch = pitch; +} + +/*--------------------------------------------------------------------------- + * GFX_SET_BPP + * + * This routine sets the bits per pixel value in the graphics engine. + * It is also stored in the static variable "gu2_bpp" to use in the future + * calls to the rendering routines. That variable contains the hardware + * specific value to load into the MGP_RASTER_MODE register. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_bpp(unsigned short bpp) +#else +void +gfx_set_bpp(unsigned short bpp) +#endif +{ + GFXbpp = bpp; + + /* COVERT TO BPP/FORMAT VALUE */ + /* Save in global to combine with ROP later. */ + /* Could write register here and then use byte access for */ + /* the ROP, but would need to set other 24 bits to make */ + /* sure all are set to their appropriate values. */ + + switch (bpp) { + case 8: + gu2_bpp = MGP_RM_BPPFMT_332; + gu2_xshift = 0; + break; + case 12: + gu2_bpp = MGP_RM_BPPFMT_4444; + gu2_xshift = 1; + break; + case 15: + gu2_bpp = MGP_RM_BPPFMT_1555; + gu2_xshift = 1; + break; + case 16: + gu2_bpp = MGP_RM_BPPFMT_565; + gu2_xshift = 1; + break; + case 32: + gu2_bpp = MGP_RM_BPPFMT_8888; + gu2_xshift = 2; + break; + } + + /* SET INITIAL ROP BASED ONLY ON BPP */ + /* Needs to be set before loading any pattern or source colors. */ + /* We must wait for BUSY because these bits are not pipelined */ + /* in the hardware. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_SOLID_SOURCE +// +// This routine is used to specify a solid source color. For the Xfree96 +// display driver, the source color is used to specify a planemask and the +// ROP is adjusted accordingly. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_solid_source(unsigned long color) +#else +void +gfx_set_solid_source(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* WRITE REGISTERS TO SPECIFY SOURCE COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_MONO_SOURCE +// +// This routine is used to specify the monochrome source colors. +// It must be called *after* loading any pattern data (those routines +// clear the source flags). +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#else +void +gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#endif +{ + /* SET TRANSPARENCY FLAG */ + + GFXsourceFlags = transparent ? MGP_RM_SRC_TRANS : 0; + + /* WRITE COLOR VALUES */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, fgcolor); + WRITE_GP32(MGP_SRC_COLOR_BG, bgcolor); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_SOLID_PATTERN +// +// This routine is used to specify a solid pattern color. It is called +// before performing solid rectangle fills or more complicated BLTs that +// use a solid pattern color. +// +// The driver should always call "gfx_load_raster_operation" after a call +// to this routine to make sure that the pattern flags are set appropriately. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_solid_pattern(unsigned long color) +#else +void +gfx_set_solid_pattern(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = 0; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp); + WRITE_GP32(MGP_PAT_COLOR_0, color); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_MONO_PATTERN +// +// This routine is used to specify a monochrome pattern. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparent) +#else +void +gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned char transparent) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + if (transparent) + GFXpatternFlags = MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS; + else + GFXpatternFlags = MGP_RM_PAT_MONO; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GFXpatternFlags); + WRITE_GP32(MGP_PAT_COLOR_0, bgcolor); + WRITE_GP32(MGP_PAT_COLOR_1, fgcolor); + WRITE_GP32(MGP_PAT_DATA_0, data0); + WRITE_GP32(MGP_PAT_DATA_1, data1); +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_COLOR_PATTERN +// +// This routine is used to specify a color pattern. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) +#else +void +gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) +#endif +{ + /* REMOVE */ +} + +/* +//--------------------------------------------------------------------------- +// GFX_LOAD_COLOR_PATTERN_LINE +// +// This routine is used to load a single line of a 8x8 color pattern. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#else +void +gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#endif +{ + unsigned long temp1, temp2, temp3, temp4; + + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = MGP_RM_PAT_COLOR; + + /* OVERRIDE THE RASTER MODE REGISTER */ + /* If the pattern format is set to anything but color */ + /* before loading the registers, some of the data will */ + /* be duplicated according to the current mode. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, + (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); + + /* LOAD THE PATTERN DATA */ + /* This routine is designed to work in tandem with gfx_pattern_fill. */ + /* It is used for cases when multiple BLTs with color pattern data */ + /* are desired on the same line. It would be inefficient to */ + /* repeatedly call gfx_color_pattern_fill for each single-line BLT. */ + /* So, we will simply replicate the pattern data across all available */ + /* lines such that the pattern y origin plays no part in the BLT. */ + + /* 8 BPP */ + + if (gu2_xshift == 0) { + pattern_8x8 += (y & 7) << 1; + temp1 = BYTE_SWIZZLE(pattern_8x8[0]); + temp2 = BYTE_SWIZZLE(pattern_8x8[1]); + WRITE_GP32(MGP_PAT_DATA_1, temp1); + WRITE_GP32(MGP_PAT_DATA_0, temp2); + WRITE_GP32(MGP_PAT_COLOR_1, temp1); + WRITE_GP32(MGP_PAT_COLOR_0, temp2); + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_3, temp1); + WRITE_GP32(MGP_PAT_COLOR_2, temp2); + WRITE_GP32(MGP_PAT_COLOR_5, temp1); + WRITE_GP32(MGP_PAT_COLOR_4, temp2); + } else if (gu2_xshift == 1) { + pattern_8x8 += (y & 7) << 2; + temp1 = WORD_SWIZZLE(pattern_8x8[0]); + temp2 = WORD_SWIZZLE(pattern_8x8[1]); + temp3 = WORD_SWIZZLE(pattern_8x8[2]); + temp4 = WORD_SWIZZLE(pattern_8x8[3]); + + WRITE_GP32(MGP_PAT_COLOR_1, temp1); + WRITE_GP32(MGP_PAT_COLOR_0, temp2); + WRITE_GP32(MGP_PAT_DATA_1, temp3); + WRITE_GP32(MGP_PAT_DATA_0, temp4); + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, temp1); + WRITE_GP32(MGP_PAT_COLOR_4, temp2); + WRITE_GP32(MGP_PAT_COLOR_3, temp3); + WRITE_GP32(MGP_PAT_COLOR_2, temp4); + } else { + pattern_8x8 += (y & 7) << 3; + + WRITE_GP32(MGP_PAT_COLOR_1, pattern_8x8[4]); + WRITE_GP32(MGP_PAT_COLOR_0, pattern_8x8[5]); + WRITE_GP32(MGP_PAT_DATA_1, pattern_8x8[6]); + WRITE_GP32(MGP_PAT_DATA_0, pattern_8x8[7]); + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, pattern_8x8[0]); + WRITE_GP32(MGP_PAT_COLOR_4, pattern_8x8[1]); + WRITE_GP32(MGP_PAT_COLOR_3, pattern_8x8[2]); + WRITE_GP32(MGP_PAT_COLOR_2, pattern_8x8[3]); + } +} + +/* +//--------------------------------------------------------------------------- +// GFX_SET_RASTER_OPERATION +// +// This routine loads the specified raster operation. It sets the pattern +// flags appropriately. +//--------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_raster_operation(unsigned char rop) +#else +void +gfx_set_raster_operation(unsigned char rop) +#endif +{ + gu2_blt_mode = 0; + + /* DISABLE ALPHA BLENDING */ + + gu2_alpha_active = 0; + + /* GENERATE 32-BIT VERSION OF ROP WITH PATTERN FLAGS */ + + gu2_rop32 = (unsigned long)rop | GFXpatternFlags | gu2_bpp; + + /* CHECK IF SOURCE FLAGS SHOULD BE MERGED */ + + if ((rop & 0x33) ^ ((rop >> 2) & 0x33)) + gu2_rop32 |= GFXsourceFlags; + else + gu2_blt_mode = 0x40; + + /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */ + /* True if even bits (0:2:4:6) do not equal the corresponding */ + /* even bits (1:3:5:7). */ + + if ((rop & 0x55) ^ ((rop >> 1) & 0x55)) { + gu2_blt_mode |= MGP_BM_DST_REQ; + gu2_vector_mode = MGP_VM_DST_REQ; + } else { + gu2_vector_mode = 0; + } +} + +/* +//---------------------------------------------------------------------------- +// GFX_PATTERN_FILL +// +// This routine is used to fill a rectangular region. The pattern must +// be previously loaded using one of GFX_load_*_pattern routines. Also, the +// raster operation must be previously specified using the +// "GFX_load_raster_operation" routine. +// +// X screen X position (left) +// Y screen Y position (top) +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#else +void +gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned long offset = 0, size; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSET */ + + offset = (unsigned long)y *gu2_pitch + (((unsigned long)x) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + offset |= ((unsigned long)(x & 7)) << 26; + offset |= ((unsigned long)(y & 7)) << 29; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP32(MGP_BLT_MODE, gu2_blt_mode); +} + +/* +//---------------------------------------------------------------------------- +// GFX_COLOR_PATTERN_FILL +// +// This routine is used to render a rectangle using the current raster +// operation and the specified color pattern. It allows an 8x8 color +// pattern to be rendered without multiple calls to the gfx_set_color_pattern +// and gfx_pattern_fill routines. +// +// X screen X position (left) +// Y screen Y position (top) +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *PATTERN pointer to 8x8 color pattern data +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern) +#else +void +gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + unsigned long *pattern) +#endif +{ + /* CALL GFX2 ROUTINE TO AVOID DUPLICATION OF CODE */ + + unsigned long offset = (unsigned long)y * gu2_pitch + + (((unsigned long)x) << gu2_xshift); + unsigned long origin = gu2_pattern_origin; + unsigned long pitch = gu2_dst_pitch; + + gfx2_set_pattern_origin(x, y); + gfx2_set_destination_stride((unsigned short)gu2_pitch); + gfx2_color_pattern_fill(offset, width, height, pattern); + + /* RESTORE GFX2 VALUES */ + + gu2_pattern_origin = origin; + gu2_dst_pitch = pitch; +} + +/* +//---------------------------------------------------------------------------- +// SCREEN TO SCREEN BLT +// +// This routine should be used to perform a screen to screen BLT when the +// ROP does not require destination data. +// +// SRCX screen X position to copy from +// SRCY screen Y position to copy from +// DSTX screen X position to copy to +// DSTY screen Y position to copy to +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) +#else +void +gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) +#endif +{ + unsigned long srcoffset, dstoffset, size; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE THE DIRECTION OF THE BLT */ + + blt_mode = gu2_blt_mode | MGP_BM_SRC_FB; + if (dstx > srcx) { + blt_mode |= MGP_BM_NEG_XDIR; + srcx += width - 1; + dstx += width - 1; + } + if (dsty > srcy) { + blt_mode |= MGP_BM_NEG_YDIR; + srcy += height - 1; + dsty += height - 1; + } + + /* CALCULATE STARTING OFFSETS */ + + srcoffset = (unsigned long)srcy *gu2_pitch + + (((unsigned long)srcx) << gu2_xshift); + dstoffset = ((unsigned long)dsty * gu2_pitch + + (((unsigned long)dstx) << gu2_xshift)) & 0xFFFFFF; + + /* MERGE PATTERN INFORMATION */ + /* This must be done after the x and y coordinates have been updated, */ + /* as the x and y pattern origins correspond to the first ROPed pixel. */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */ + /* This is a quirk of the hardware. */ + + if (blt_mode & MGP_BM_NEG_XDIR) { + srcoffset += (1 << gu2_xshift) - 1; + dstoffset += (1 << gu2_xshift) - 1; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch | (gu2_pitch << 16)); + WRITE_GP16(MGP_BLT_MODE, blt_mode); +} + +/* +//---------------------------------------------------------------------------- +// SCREEN TO SCREEN TRANSPARENT BLT +// +// This routine should be used to perform a screen to screen BLT when a +// specified color should by transparent. The only supported ROP is SRCCOPY. +// +// SRCX screen X position to copy from +// SRCY screen Y position to copy from +// DSTX screen X position to copy to +// DSTY screen Y position to copy to +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// COLOR transparent color +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) +#else +void +gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) +#endif +{ + unsigned long rop32; + + /* SAVE ORIGINAL RASTER MODE SETTINGS */ + + rop32 = gu2_rop32; + + /* WRITE REGISTERS TO SPECIFY COLOR TRANSPARENCY */ + /* Match GU1 implementation that only allows SRCCOPY for the ROP. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF); + + /* SET GLOBAL RASTER SETTINGS */ + /* This is needed, as the screen-to-screen BLT */ + /* routine will overwrite the raster mode register. */ + + gu2_rop32 = gu2_bpp | MGP_RM_SRC_TRANS | 0xCC; + + /* CALL NORMAL SCREEN TO SCREEN BLT ROUTINE */ + + gfx_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); + + /* RESTORE GLOBAL RASTER SETTINGS */ + + gu2_rop32 = rop32; +} + +/* +//---------------------------------------------------------------------------- +// COLOR BITMAP TO SCREEN BLT +// +// This routine transfers color bitmap data to the screen. +// +// SRCX X offset within source bitmap +// SRCY Y offset within source bitmap +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +// PITCH pitch of bitmap data (bytes between scanlines) +// +// Transparency is handled by another routine. +//---------------------------------------------------------------------------- +*/ + +#if GFX_2DACCEL_DYNAMIC +void +gu2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) +#else +void +gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) +#endif +{ + unsigned long dstoffset, srcoffset, size, bytes; + unsigned long offset, temp_offset; + unsigned long dword_bytes, bytes_extra; + unsigned short blt_mode; + + blt_mode = gu2_blt_mode | MGP_BM_SRC_FB; + size = (((unsigned long)width) << 16) | 1; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx << gu2_xshift); + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + bytes = width << gu2_xshift; + dword_bytes = bytes & ~0x3L; + bytes_extra = bytes & 0x3L; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* We must wait for BLT busy because the GP may be executing a screen */ + /* to screen BLT from the scratchpad area. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + + /* WRITE DATA ONE LINE AT A TIME */ + /* For speed reasons, data is written to an offscreen scratch area and then */ + /* BLTed using a screen to screen BLT. This is similar to the GX1 BLT buffers, but */ + /* slightly more efficient in that we can queue up data while the GP is rendering */ + /* a line. */ + + while (height--) { + temp_offset = offset; + srcoffset = gfx_gx2_scratch_base; + if (gu2_current_line) + srcoffset += 8192; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + dstoffset += gu2_pitch; + dstoffset += 0x20000000; + + WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, temp_offset); + if (bytes_extra) { + temp_offset += dword_bytes; + srcoffset += dword_bytes; + WRITE_FRAME_BUFFER_STRING8(srcoffset, bytes_extra, data, + temp_offset); + } + WRITE_GP16(MGP_BLT_MODE, blt_mode); + offset += pitch; + gu2_current_line = 1 - gu2_current_line; + } +} + +/* +//---------------------------------------------------------------------------- +// COLOR BITMAP TO SCREEN TRANSPARENT BLT +// +// This routine transfers color bitmap data to the screen with transparency. +// The transparent color is specified. The only supported ROP is SRCCOPY, +// meaning that transparency cannot be applied if the ROP requires +// destination data (this is a hardware restriction). +// +// SRCX X offset within source bitmap +// SRCY Y offset within source bitmap +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +// PITCH pitch of bitmap data (bytes between scanlines) +// COLOR transparent color +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) +#else +void +gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) +#endif +{ + unsigned long rop32; + + /* SAVE EXISTING RASTER MODE SETTINGS */ + + rop32 = gu2_rop32; + + /* WRITE REGISTERS TO SPECIFY COLOR TRANSPARENCY */ + /* Match GU1 implementation that only allows SRCCOPY for the ROP. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF); + + /* SET GLOBAL RASTER SETTINGS */ + /* This is needed, as the screen-to-screen BLT */ + /* routine will overwrite the raster mode register. */ + + gu2_rop32 = gu2_bpp | MGP_RM_SRC_TRANS | 0xCC; + + /* CALL NORMAL COLOR BITMAP TO SCREEN BLT ROUTINE */ + + gfx_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); + + /* RESTORE RASTER SETTINGS */ + + gu2_rop32 = rop32; +} + +/* +//---------------------------------------------------------------------------- +// MONOCHROME BITMAP TO SCREEN BLT +// +// This routine transfers monochrome bitmap data to the screen. +// +// SRCX X offset within source bitmap +// SRCY Y offset within source bitmap +// DSTX screen X position to render data +// DSTY screen Y position to render data +// WIDTH width of rectangle, in pixels +// HEIGHT height of rectangle, in scanlines +// *DATA pointer to bitmap data +// PITCH pitch of bitmap data (bytes between scanlines) +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +#else +void +gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +#endif +{ + unsigned long dstoffset, size, bytes; + unsigned long offset, temp_offset, temp1 = 0, temp2 = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift = 0; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + bytes = ((srcx & 7) + width + 7) >> 3; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* Need to wait for busy instead of pending, since hardware clears */ + /* the host data FIFO at the beginning of a BLT. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | MGP_BM_SRC_HOST | MGP_BM_SRC_MONO); + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL OF THE DATA TO THE HOST SOURCE REGISTER */ + + while (height--) { + temp_offset = offset; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + + /* WRITE REMAINING BYTES */ + + shift = 0; + if (bytes_extra) + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + + offset += pitch; + } +} + +/*--------------------------------------------------------------------------- + * GFX_TEXT_BLT + * + * This routine is similar to the gfx_mono_bitmap_to_screen_blt routine + * but assumes that source data is byte-packed. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#else +void +gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#endif +{ + unsigned long size, bytes; + unsigned long dstoffset, temp1 = 0, temp2 = 0, temp_offset = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift; + + size = (((unsigned long)width) << 16) | height; + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + /* CALCULATE STARTING OFFSETS */ + + bytes = ((width + 7) >> 3) * height; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_SRC_OFFSET, 0); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | MGP_BM_SRC_HOST | + MGP_BM_SRC_BP_MONO); + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + if (dwords_extra || bytes_extra) { + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + if (bytes_extra) { + shift = 0; + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + } + } +} + +/* +//---------------------------------------------------------------------------- +// BRESENHAM LINE +// +// This routine draws a vector using the specified Bresenham parameters. +// Currently this file does not support a routine that accepts the two +// endpoints of a vector and calculates the Bresenham parameters. If it +// ever does, this routine is still required for vectors that have been +// clipped. +// +// X screen X position to start vector +// Y screen Y position to start vector +// LENGTH length of the vector, in pixels +// INITERR Bresenham initial error term +// AXIALERR Bresenham axial error term +// DIAGERR Bresenham diagonal error term +// FLAGS VM_YMAJOR, VM_MAJOR_INC, VM_MINOR_INC +//---------------------------------------------------------------------------- +*/ +#if GFX_2DACCEL_DYNAMIC +void +gu2_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +#else +void +gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +#endif +{ + unsigned long offset; + unsigned long data1 = (((unsigned long)axialerr) << 16) | diagerr; + unsigned long data2 = (((unsigned long)length) << 16) | initerr; + unsigned short vector_mode = gu2_vector_mode | flags; + + /* CALCULATE STARTING OFFSET */ + + offset = (unsigned long)y *gu2_pitch + (((unsigned long)x) << gu2_xshift); + + /* CHECK NULL LENGTH */ + + if (!length) + return; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_VEC_ERR, data1); + WRITE_GP32(MGP_VEC_LEN, data2); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP32(MGP_VECTOR_MODE, vector_mode); +} + +/*--------------------------------------------------------------------------- + * GFX_WAIT_UNTIL_IDLE + * + * This routine waits until the graphics engine is idle. This is required + * before allowing direct access to the frame buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_wait_until_idle(void) +#else +void +gfx_wait_until_idle(void) +#endif +{ + while (READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) ; +} + +/*--------------------------------------------------------------------------- + * GFX_TEST_BLT_PENDING + * + * This routine returns 1 if a BLT is pending, meaning that a call to + * perform a rendering operation would stall. Otherwise it returns 0. + * It is used by Darwin during random testing to only start a BLT + * operation when it knows the Durango routines won't spin on graphics + * (so Darwin can continue to do frame buffer reads and writes). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +int +gu2_test_blt_pending(void) +#else +int +gfx_test_blt_pending(void) +#endif +{ + if (READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) + return (1); + return (0); +} + +/*--------------------------------------------------------------------------- + * NEW ROUTINES FOR REDCLOUD + *--------------------------------------------------------------------------- + */ + +/*--------------------------------------------------------------------------- + * GFX2_SET_SOURCE_STRIDE + * + * This routine sets the stride to be used in successive screen to screen + * BLTs (used by gfx2_screen_to_screen_blt and gfx2_mono_expand_blt). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_source_stride(unsigned short stride) +#else +void +gfx2_set_source_stride(unsigned short stride) +#endif +{ + /* SAVE STRIDE TO BE USED LATER */ + + gu2_src_pitch = (unsigned long)stride; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_DESTINATION_STRIDE + * + * This routine sets the stride used when rendering to the screen. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_destination_stride(unsigned short stride) +#else +void +gfx2_set_destination_stride(unsigned short stride) +#endif +{ + /* SAVE STRIDE TO BE USED LATER */ + + gu2_dst_pitch = (unsigned long)stride; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_PATTERN_ORIGIN + * + * This routine sets the origin within an 8x8 pattern. It is needed if + * using a monochrome or color pattern (not used for a solid pattern). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_pattern_origin(int x, int y) +#else +void +gfx2_set_pattern_origin(int x, int y) +#endif +{ + /* STORE IN FORMAT THAT CAN BE COMBINED WITH THE DESTINATION OFFSET */ + + gu2_pattern_origin = (((unsigned long)(x & 7)) << 26) | + (((unsigned long)(y & 7)) << 29); +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_SOURCE_TRANSPARENCY + * + * This routine sets the source transparency color and mask to be used + * in future rendering operations. If both the color and mask are set + * to zero (normally completely transparent), those values indicate that + * transparency should be disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_source_transparency(unsigned long color, unsigned long mask) +#else +void +gfx2_set_source_transparency(unsigned long color, unsigned long mask) +#endif +{ + /* WRITE REGISTERS TO SPECIFY COLOR TRANSPARENCY */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_SRC_COLOR_BG, mask); + + /* SET TRANSPARENCY FLAG */ + + GFXsourceFlags = (color || mask) ? MGP_RM_SRC_TRANS : 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_ALPHA_MODE + * + * This routine sets the alpha blending mode to be used in successive + * rendering operations. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_alpha_mode(int mode) +#else +void +gfx2_set_alpha_mode(int mode) +#endif +{ + /* SAVE ALPHA MODE FOR LATER */ + + gu2_alpha_mode = mode; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_ALPHA_VALUE + * + * This routine sets the alpha value to be used with certain alpha blending + * modes (ALPHA_MODE_BLEND). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_alpha_value(unsigned char value) +#else +void +gfx2_set_alpha_value(unsigned char value) +#endif +{ + /* SAVE ALPHA VALUE TO BE USED LATER */ + + gu2_alpha_value = (unsigned long)value; + + /* SET GLOBAL FLAG */ + /* gfx2_* routines will use this flag to program alpha values */ + /* appropriately. Normal gfx_* routines will always write */ + /* the current ROP settings. In this way, the alpha mode */ + /* affects only second generation routines. */ + + gu2_alpha_active = 1; + + switch (gu2_alpha_mode) { + case ALPHA_MODE_BLEND: + + /* GENERATE 32-BIT VERSION OF RASTER MODE REGISTER */ + /* Pattern data is not involved in the operation. */ + + gu2_alpha32 = gu2_alpha_value | gu2_bpp; + + /* HANDLE SPECIAL CASES FOR ENDPOINTS */ + /* The 8-bit hardware alpha value is always */ + /* interpreted as a fraction. Consequently, there */ + /* is no way to use values of 255 or 0 to exclude */ + /* one of the inputs. */ + + switch (gu2_alpha_value) { + /* DESTINATION ONLY */ + /* Operation is alpha * A, where A is destination */ + /* and alpha is 1. */ + + case 0: + + gu2_alpha32 |= MGP_RM_SELECT_ALPHA_1 | + MGP_RM_ALPHA_TIMES_A | + MGP_RM_ALPHA_TO_RGB | MGP_RM_DEST_FROM_CHAN_A; + break; + + /* SOURCE ONLY */ + /* Operation is alpha * A, where A is source and */ + /* alpha is 1. */ + + case 255: + + gu2_alpha32 |= MGP_RM_SELECT_ALPHA_1 | + MGP_RM_ALPHA_TO_RGB | MGP_RM_ALPHA_TIMES_A; + break; + + /* DEFAULT */ + /* Operation is alpha * A + (1 - alpha) * B; */ + /* A is source, B is destination and alpha is the */ + /* programmed 8-bit value. */ + + default: + + gu2_alpha32 |= MGP_RM_SELECT_ALPHA_R | + MGP_RM_ALPHA_TO_RGB | MGP_RM_ALPHA_A_PLUS_BETA_B; + + } + + /* CHECK IF SOURCE INFORMATION SHOULD BE MERGED */ + /* Alpha value of 0 indicates destination only. */ + + if (gu2_alpha_value != 0) + gu2_alpha32 |= GFXsourceFlags; + + /* SET FLAG FOR DESTINATION DATA IF NECESSARY */ + /* Alpha value of 255 indicates no destination */ + + if (gu2_alpha_value != 255) { + gu2_alpha_blt_mode = MGP_BM_DST_REQ; + gu2_alpha_vec_mode = MGP_VM_DST_REQ; + } + + break; + } +} + +/*--------------------------------------------------------------------------- + * GFX2_PATTERN_FILL + * + * This routine is similar to the gfx_pattern_fill routine, but allows the + * use of an arbitrary destination stride. The rendering position is + * also specified as an offset instead of an (x,y) position. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +#else +void +gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +#endif +{ + unsigned long size; + + size = (((unsigned long)width) << 16) | height; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP32(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_COLOR_PATTERN_FILL + * + * This routine is used to render a rectangle using the current raster + * operation and the specified color pattern. It allows an 8x8 color + * pattern to be rendered without multiple calls to the gfx_set_color_pattern + * and gfx_pattern_fill routines. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern) +#else +void +gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern) +#endif +{ + int pass; + unsigned long lines, size, patxorigin, patoffset; + + /* ONLY USE HW PATTERN ORIGIN FOR THE X DIRECTION */ + /* Y direction handled by referencing proper location in pattern data. */ + + patxorigin = (gu2_pattern_origin) & 0x1C000000; + + /* OVERRIDE PATTERN FLAGS IN ROP TO FORCE COLOR PATTERN */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, + (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); + + /* ATTEMPT TO OPTIMIZE */ + /* If possible, we can perform the pattern fill in only a few passes */ + /* This is performed by multiplying the pitch by an appropriate amount. */ + /* Consequently, if the multiplied pitch exceeds 16 bits, this */ + /* optimization is impossible. */ + + if ((gu2_dst_pitch << (gu2_xshift + 1)) <= 0xFFFF) { + /* HANDLE VARIOUS COLOR DEPTHS DIFFERENTLY */ + + switch (gu2_xshift) { + case 0: /* 8 BPP */ + + /* TWO PASSES FOR 8 BPP */ + /* Render every other line per pass by doubling the pitch. */ + + patoffset = (gu2_pattern_origin >> 28) & 0x0E; + for (pass = 0; pass < 2; pass++) { + /* CAN WRITE SOME PATTERN REGISTERS WHILE "PENDING" */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + lines = (height + 1 - pass) >> 1; + if (!lines) + break; + size = (((unsigned long)width) << 16) | lines; + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 1); + WRITE_GP32(MGP_PAT_DATA_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_DATA_0, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 4) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 4) & 0x0E; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_3, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_2, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 4) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_5, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, BYTE_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + patoffset = (patoffset + 6) & 0x0E; + } + break; + + case 1: /* 12, 15, OR 16 BPP */ + + /* FOUR PASSES FOR 16 BPP */ + /* Render every 4th line per pass by quadrupling the pitch. */ + + patoffset = (gu2_pattern_origin >> 27) & 0x1C; + for (pass = 0; pass < 4; pass++) { + /* CAN WRITE SOME PATTERN REGISTERS WHILE "PENDING" */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + lines = (height + 3 - pass) >> 2; + if (!lines) + break; + size = (((unsigned long)width) << 16) | lines; + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 2); + WRITE_GP32(MGP_PAT_COLOR_1, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_DATA_1, WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_DATA_0, WORD_SWIZZLE(pattern[patoffset + 3])); + patoffset = (patoffset + 16) & 0x1C; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_COLOR_3, WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_COLOR_2, WORD_SWIZZLE(pattern[patoffset + 3])); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + patoffset = (patoffset + 20) & 0x1C; + } + break; + + case 2: /* 32 BPP */ + + /* EIGHT PASSES FOR 32 BPP */ + /* Render every 8th line per pass by setting pitch * 8. */ + + patoffset = (gu2_pattern_origin >> 26) & 0x38; + for (pass = 0; pass < 8; pass++) { + /* CAN WRITE SOME PATTERN REGISTERS WHILE "PENDING" */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + lines = (height + 7 - pass) >> 3; + if (!lines) + break; + size = (((unsigned long)width) << 16) | lines; + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 3); + WRITE_GP32(MGP_PAT_COLOR_1, pattern[patoffset + 4]); + WRITE_GP32(MGP_PAT_COLOR_0, pattern[patoffset + 5]); + WRITE_GP32(MGP_PAT_DATA_1, pattern[patoffset + 6]); + WRITE_GP32(MGP_PAT_DATA_0, pattern[patoffset + 7]); + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, pattern[patoffset]); + WRITE_GP32(MGP_PAT_COLOR_4, pattern[patoffset + 1]); + WRITE_GP32(MGP_PAT_COLOR_3, pattern[patoffset + 2]); + WRITE_GP32(MGP_PAT_COLOR_2, pattern[patoffset + 3]); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + patoffset = (patoffset + 8) & 0x38; + } + break; + } + } + + else { + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + + switch (gu2_xshift) { + case 0: /* 8 BPP - 4 LINES PER PASS */ + + patoffset = (gu2_pattern_origin >> 28) & 0x0E; + while (height) { + lines = height > 4 ? 4 : height; + + /* CAN WRITE SOME REGISTERS WHILE PENDING */ + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + WRITE_GP32(MGP_WID_HEIGHT, + (((unsigned long)width) << 16) | lines); + WRITE_GP32(MGP_PAT_DATA_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_DATA_0, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_3, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_2, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_5, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch << 2; + height -= (unsigned short)lines; + } + break; + + case 1: /* 12, 15 AND 16 BPP - 2 LINES PER PASS */ + + patoffset = (gu2_pattern_origin >> 27) & 0x1C; + while (height) { + lines = height > 2 ? 2 : height; + + /* CAN WRITE SOME REGISTERS WHILE PENDING */ + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + WRITE_GP32(MGP_WID_HEIGHT, + (((unsigned long)width) << 16) | lines); + WRITE_GP32(MGP_PAT_COLOR_1, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_DATA_1, WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_DATA_0, WORD_SWIZZLE(pattern[patoffset + 3])); + patoffset = (patoffset + 4) & 0x1C; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_COLOR_3, WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_COLOR_2, WORD_SWIZZLE(pattern[patoffset + 3])); + patoffset = (patoffset + 4) & 0x1C; + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch << 1; + height -= (unsigned short)lines; + } + break; + + case 2: /* 32 BPP - 1 LINE PER PASS */ + + patoffset = (gu2_pattern_origin >> 26) & 0x38; + while (height) { + /* CAN WRITE SOME REGISTERS WHILE PENDING */ + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + WRITE_GP32(MGP_WID_HEIGHT, (((unsigned long)width) << 16) | 1l); + WRITE_GP32(MGP_PAT_COLOR_1, pattern[patoffset + 4]); + WRITE_GP32(MGP_PAT_COLOR_0, pattern[patoffset + 5]); + WRITE_GP32(MGP_PAT_DATA_1, pattern[patoffset + 6]); + WRITE_GP32(MGP_PAT_DATA_0, pattern[patoffset + 7]); + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, pattern[patoffset]); + WRITE_GP32(MGP_PAT_COLOR_4, pattern[patoffset + 1]); + WRITE_GP32(MGP_PAT_COLOR_3, pattern[patoffset + 2]); + WRITE_GP32(MGP_PAT_COLOR_2, pattern[patoffset + 3]); + patoffset = (patoffset + 8) & 0x38; + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + height--; + } + break; + } + + } + +} + +/*--------------------------------------------------------------------------- + * GFX2_SCREEN_TO_SCREEN_BLT + * + * This routine is similar to the gfx_screen_to_screen_blt routine but + * allows the use of arbitrary source and destination strides and alpha + * blending. It also allows the use of an arbitrary ROP with transparency. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, + unsigned short width, unsigned short height, + int flags) +#else +void +gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, + unsigned short width, unsigned short height, + int flags) +#endif +{ + unsigned long size, xbytes; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* USE ALPHA SETTINGS, IF REQUESTED */ + + if (gu2_alpha_active) + blt_mode = gu2_alpha_blt_mode | MGP_BM_SRC_FB; + + else + blt_mode = gu2_blt_mode | MGP_BM_SRC_FB; + + /* CALCULATE THE DIRECTION OF THE BLT */ + /* Using offsets, so flags from the calling routine are needed. */ + + if (flags & 1) { + xbytes = (width - 1) << gu2_xshift; + srcoffset += xbytes; + dstoffset += xbytes; + blt_mode |= MGP_BM_NEG_XDIR; + } + if (flags & 2) { + srcoffset += (height - 1) * gu2_src_pitch; + dstoffset += (height - 1) * gu2_dst_pitch; + blt_mode |= MGP_BM_NEG_YDIR; + } + + /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */ + /* This is a quirk of the hardware. */ + + if (blt_mode & MGP_BM_NEG_XDIR) { + srcoffset += (1 << gu2_xshift) - 1; + dstoffset += (1 << gu2_xshift) - 1; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + } + + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch | (gu2_src_pitch << 16)); + WRITE_GP16(MGP_BLT_MODE, blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_MONO_EXPAND_BLT + * + * This routine is similar to the gfx2_screen_to_screen_blt routine but + * expands monochrome data stored in graphics memory. + * WARNING: This routine assumes that the regions in graphics memory + * will not overlap, and therefore does not check the BLT direction. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) +#else +void +gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) +#endif +{ + unsigned long size, srcoffset; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE SOURCE OFFSET */ + + srcoffset = srcbase + (unsigned long)srcy *gu2_src_pitch; + + srcoffset += srcx >> 3; + srcoffset |= ((unsigned long)srcx & 7) << 26; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = gu2_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + } + + if (byte_packed) + blt_mode |= MGP_BM_SRC_FB | MGP_BM_SRC_BP_MONO | gu2_bm_throttle; + else + blt_mode |= MGP_BM_SRC_FB | MGP_BM_SRC_MONO | gu2_bm_throttle; + + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch | (gu2_src_pitch << 16)); + WRITE_GP16(MGP_BLT_MODE, blt_mode); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_COLOR_BITMAP_TO_SCREEN_BLT + * + * This routine is similar to the gfx_color_bitmap_to_screen_blt routine + * but allows the use of an arbitrary destination stride and alpha blending. + * It also allows the use of an arbitrary ROP with transparency. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) +#else +void +gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) +#endif +{ + unsigned long size, bytes; + unsigned long offset, temp_offset; + unsigned long srcoffset, dword_bytes, bytes_extra; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | 1; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx << gu2_xshift); + + dstoffset |= gu2_pattern_origin; + + bytes = width << gu2_xshift; + dword_bytes = bytes & ~0x3L; + bytes_extra = bytes & 0x3L; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* We must wait for BLT busy because the GP may be executing a screen */ + /* to screen BLT from the scratchpad area. */ + + GU2_WAIT_BUSY; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = gu2_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + } + blt_mode |= MGP_BM_SRC_FB | gu2_bm_throttle; + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + WRITE_GP32(MGP_WID_HEIGHT, size); + + /* WRITE DATA ONE LINE AT A TIME */ + /* For speed reasons, data is written to an offscreen scratch area and then */ + /* BLTed using a screen to screen BLT. This is similar to the GX1 BLT buffers, but */ + /* slightly more efficient in that we can queue up data while the GP is rendering */ + /* a line. */ + + while (height--) { + temp_offset = offset; + srcoffset = gfx_gx2_scratch_base; + if (gu2_current_line) + srcoffset += 8192; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + dstoffset += gu2_dst_pitch; + dstoffset += 0x20000000; + + WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, temp_offset); + if (bytes_extra) { + temp_offset += dword_bytes; + srcoffset += dword_bytes; + WRITE_FRAME_BUFFER_STRING8(srcoffset, bytes_extra, data, + temp_offset); + } + WRITE_GP16(MGP_BLT_MODE, blt_mode); + offset += pitch; + gu2_current_line = 1 - gu2_current_line; + } +} + +/*--------------------------------------------------------------------------- + * GFX2_TEXT_BLT + * + * This routine is similar to the gfx2_mono_bitmap_to_screen_blt routine + * but assumes that source data is byte-packed. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data) +#else +void +gfx2_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data) +#endif +{ + unsigned long size, bytes; + unsigned long temp1 = 0, temp2 = 0, temp_offset = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + bytes = ((width + 7) >> 3) * height; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = gu2_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + } + + WRITE_GP32(MGP_SRC_OFFSET, 0); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP16(MGP_BLT_MODE, blt_mode | MGP_BM_SRC_HOST | + MGP_BM_SRC_BP_MONO | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + if (dwords_extra || bytes_extra) { + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + if (bytes_extra) { + shift = 0; + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + } + } +} + +/*--------------------------------------------------------------------------- + * GFX2_MONO_BITMAP_TO_SCREEN_BLT + * + * This routine is similar to the gfx_mono_bitmap_to_screen_blt routine + * but allows the use of an arbitrary destination stride and alpha blending. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) +#else +void +gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) +#endif +{ + unsigned long size, bytes; + unsigned long offset, temp_offset, temp1 = 0, temp2 = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift = 0; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + + bytes = ((srcx & 7) + width + 7) >> 3; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = gu2_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + } + + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP16(MGP_BLT_MODE, blt_mode | MGP_BM_SRC_HOST | + MGP_BM_SRC_MONO | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL OF THE DATA TO THE HOST SOURCE REGISTER */ + + while (height--) { + temp_offset = offset; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + + /* WRITE REMAINING BYTES */ + + shift = 0; + if (bytes_extra) + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + + offset += pitch; + } +} + +/*--------------------------------------------------------------------------- + * GFX2_BRESENHAM_LINE + * + * This routine is similar to the gfx_bresenam_line routine but allows + * the use of an arbitrary destination stride. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_bresenham_line(unsigned long dstoffset, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +#else +void +gfx2_bresenham_line(unsigned long dstoffset, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) +#endif +{ + unsigned long vector_mode = gu2_vector_mode | flags; + unsigned long data1 = (((unsigned long)axialerr) << 16) | diagerr; + unsigned long data2 = (((unsigned long)length) << 16) | initerr; + + /* CHECK NULL LENGTH */ + + if (!length) + return; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + vector_mode = gu2_alpha_vec_mode | flags; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_VEC_ERR, data1); + WRITE_GP32(MGP_VEC_LEN, data2); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP32(MGP_VECTOR_MODE, vector_mode | gu2_vm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_SYNC_TO_VBLANK + * + * This routine sets a flag to synchronize the next rendering routine to + * VBLANK. The flag is cleared by the rendering routine. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_sync_to_vblank(void) +#else +void +gfx2_sync_to_vblank(void) +#endif +{ + /* SET FLAGS TO THROTTLE NEXT RENDERING ROUTINE */ + + gu2_bm_throttle = MGP_BM_THROTTLE; + gu2_vm_throttle = MGP_VM_THROTTLE; +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/saa7114.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/saa7114.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/saa7114.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,1050 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/saa7114.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: saa7114.c $ + * + * This file contains routines to control the Philips SAA7114 video decoder. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/*---------------------------*/ +/* TABLE OF DEFAULT VALUES */ +/*---------------------------*/ + +typedef struct tagGFX_SAA7114_INIT +{ + unsigned char index; + unsigned char value; +} +GFX_SAA7114_INIT; + +/* Task A is for VBI raw data and task B is for video */ + +GFX_SAA7114_INIT gfx_saa7114_init_values[] = { + {0x01, 0x08}, {0x02, 0xC0}, {0x03, 0x00}, {0x04, 0x90}, + {0x05, 0x90}, {0x06, 0xEB}, {0x07, 0xE0}, {0x08, 0x88}, + {0x09, 0x40}, {0x0A, 0x80}, {0x0B, 0x44}, {0x0C, 0x40}, + {0x0D, 0x00}, {0x0E, 0x89}, {0x0F, 0x2E}, {0x10, 0x0E}, + {0x11, 0x00}, {0x12, 0x05}, {0x13, 0x00}, {0x14, 0x08}, + {0x15, 0x11}, {0x16, 0xFE}, {0x17, 0x00}, {0x18, 0x40}, + {0x19, 0x80}, {0x30, 0xBC}, {0x31, 0xDF}, {0x32, 0x02}, + {0x34, 0xCD}, {0x35, 0xCC}, {0x36, 0x3A}, {0x38, 0x03}, + {0x39, 0x10}, {0x3A, 0x00}, {0x40, 0x00}, {0x41, 0xFF}, + {0x42, 0xFF}, {0x43, 0xFF}, {0x44, 0xFF}, {0x45, 0xFF}, + {0x46, 0xFF}, {0x47, 0xFF}, {0x48, 0xFF}, {0x49, 0xFF}, + {0x4A, 0xFF}, {0x4B, 0xFF}, {0x4C, 0xFF}, {0x4D, 0xFF}, + {0x4E, 0xFF}, {0x4F, 0xFF}, {0x50, 0xFF}, {0x51, 0xFF}, + {0x52, 0xFF}, {0x53, 0xFF}, {0x54, 0xFF}, {0x55, 0xFF}, + {0x56, 0xFF}, {0x57, 0xFF}, {0x58, 0x00}, {0x59, 0x47}, + {0x5A, 0x06}, {0x5B, 0x43}, {0x5D, 0x3E}, {0x5E, 0x00}, + {0x80, 0x30}, {0x83, 0x00}, {0x84, 0x60}, {0x85, 0x00}, + {0x86, 0xE5}, {0x87, 0x01}, {0x88, 0xF8}, + + /* VBI task */ + + {0x90, 0x01}, {0x91, 0xC8}, {0x92, 0x08}, {0x93, 0x84}, + {0x94, 0x10}, {0x95, 0x00}, {0x96, 0xD0}, {0x97, 0x02}, + {0x98, 0x05}, {0x99, 0x00}, {0x9A, 0x0B}, {0x9B, 0x00}, + {0x9C, 0xA0}, {0x9D, 0x05}, {0x9E, 0x0B}, {0x9F, 0x00}, + {0xA0, 0x01}, {0xA1, 0x00}, {0xA2, 0x00}, {0xA4, 0x80}, + {0xA5, 0x40}, {0xA6, 0x40}, {0xA8, 0x00}, {0xA9, 0x02}, + {0xAA, 0x00}, {0xAC, 0x00}, {0xAD, 0x01}, {0xAE, 0x00}, + {0xB0, 0x00}, {0xB1, 0x04}, {0xB2, 0x00}, {0xB3, 0x04}, + {0xB4, 0x00}, {0xB8, 0x00}, {0xB9, 0x00}, {0xBA, 0x00}, + {0xBB, 0x00}, {0xBC, 0x00}, {0xBD, 0x00}, {0xBE, 0x00}, + {0xBF, 0x00}, + + /* Video task */ + + {0xC0, 0x80}, {0xC1, 0x08}, {0xC2, 0x00}, {0xC3, 0x80}, + {0xC4, 0x10}, {0xC5, 0x00}, {0xC6, 0xD0}, {0xC7, 0x02}, + {0xC8, 0x11}, {0xC9, 0x00}, {0xCA, 0xF1}, {0xCB, 0x00}, + {0xCC, 0xD0}, {0xCD, 0x02}, {0xCE, 0xF1}, {0xCF, 0x00}, + {0xD0, 0x01}, {0xD1, 0x00}, {0xD2, 0x00}, {0xD4, 0x80}, + {0xD5, 0x40}, {0xD6, 0x40}, {0xD8, 0x00}, {0xD9, 0x04}, + {0xDA, 0x00}, {0xDC, 0x00}, {0xDD, 0x02}, {0xDE, 0x00}, + {0xE0, 0x00}, {0xE1, 0x04}, {0xE2, 0x00}, {0xE3, 0x04}, + {0xE4, 0x00}, {0xE8, 0x00}, {0xE9, 0x00}, {0xEA, 0x00}, + {0xEB, 0x00}, {0xEC, 0x00}, {0xED, 0x00}, {0xEE, 0x00}, + {0xEF, 0x00}, +}; + +#define GFX_NUM_SAA7114_INIT_VALUES sizeof(gfx_saa7114_init_values)/sizeof(GFX_SAA7114_INIT) + +/*-----------------------------------------------------*/ +/* TABLE OF FIR PREFILTER RECOMMENDED VALUES */ +/*-----------------------------------------------------*/ + +int optimize_for_aliasing = 0; + +typedef struct tagGFX_SAA7114_FIR_PREFILTER +{ + unsigned char prescaler; + unsigned char acl_low; + unsigned char prefilter_low; + unsigned char acl_high; + unsigned char prefilter_high; +} +GFX_SAA7114_FIR_PREFILTER; + +GFX_SAA7114_FIR_PREFILTER gfx_saa7114_fir_values[] = { + {0x01, 0x00, 0x00, 0x00, 0x00}, {0x02, 0x02, 0x5A, 0x01, 0x51}, + {0x03, 0x04, 0xAB, 0x03, 0xA2}, {0x04, 0x07, 0xA3, 0x04, 0xAB}, + {0x05, 0x08, 0xAC, 0x07, 0xA3}, {0x06, 0x08, 0xFC, 0x07, 0xF3}, + {0x07, 0x08, 0xFC, 0x07, 0xF3}, {0x08, 0x0F, 0xF4, 0x08, 0xFC}, + {0x09, 0x0F, 0xF4, 0x08, 0xFC}, {0x0A, 0x10, 0xFD, 0x08, 0xFC}, + {0x0B, 0x10, 0xFD, 0x08, 0xFC}, {0x0C, 0x10, 0xFD, 0x08, 0xFC}, + {0x0D, 0x10, 0xFD, 0x10, 0xFD}, {0x0E, 0x10, 0xFD, 0x10, 0xFD}, + {0x0F, 0x1F, 0xF5, 0x10, 0xFD}, {0x10, 0x20, 0xFE, 0x10, 0xFD}, + {0x11, 0x20, 0xFE, 0x10, 0xFD}, {0x12, 0x20, 0xFE, 0x10, 0xFD}, + {0x13, 0x20, 0xFE, 0x20, 0xFE}, {0x14, 0x20, 0xFE, 0x20, 0xFE}, + {0x15, 0x20, 0xFE, 0x20, 0xFE}, {0x16, 0x20, 0xFE, 0x20, 0xFE}, + {0x17, 0x20, 0xFE, 0x20, 0xFE}, {0x18, 0x20, 0xFE, 0x20, 0xFE}, + {0x19, 0x20, 0xFE, 0x20, 0xFE}, {0x1A, 0x20, 0xFE, 0x20, 0xFE}, + {0x1B, 0x20, 0xFE, 0x20, 0xFE}, {0x1C, 0x20, 0xFE, 0x20, 0xFE}, + {0x1D, 0x20, 0xFE, 0x20, 0xFE}, {0x1E, 0x20, 0xFE, 0x20, 0xFE}, + {0x1F, 0x20, 0xFE, 0x20, 0xFE}, {0x20, 0x3F, 0xFF, 0x20, 0xFE}, + {0x21, 0x3F, 0xFF, 0x20, 0xFE}, {0x22, 0x3F, 0xFF, 0x20, 0xFE}, + {0x23, 0x3F, 0xFF, 0x20, 0xFF} +}; + +int saa7114_set_decoder_defaults(void); +int saa7114_set_decoder_analog_input(unsigned char input); +int saa7114_set_decoder_brightness(unsigned char brightness); +int saa7114_set_decoder_contrast(unsigned char contrast); +int saa7114_set_decoder_hue(char hue); +int saa7114_set_decoder_saturation(unsigned char saturation); +int saa7114_set_decoder_input_offset(unsigned short x, unsigned short y); +int saa7114_set_decoder_input_size(unsigned short width, + unsigned short height); +int saa7114_set_decoder_output_size(unsigned short width, + unsigned short height); +int saa7114_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int saa7114_set_decoder_vbi_format(int start, int end, int format); +int saa7114_set_decoder_vbi_enable(int enable); +int saa7114_set_decoder_vbi_upscale(void); +int saa7114_set_decoder_TV_standard(TVStandardType TVStandard); +int saa7114_set_decoder_luminance_filter(unsigned char lufi); +int saa7114_decoder_software_reset(void); +int saa7114_decoder_detect_macrovision(void); +int saa7114_decoder_detect_video(void); + +/* READ ROUTINES IN GFX_DCDR.C */ + +unsigned char saa7114_get_decoder_brightness(void); +unsigned char saa7114_get_decoder_contrast(void); +char saa7114_get_decoder_hue(void); +unsigned char saa7114_get_decoder_saturation(void); +unsigned long saa7114_get_decoder_input_offset(void); +unsigned long saa7114_get_decoder_input_size(void); +unsigned long saa7114_get_decoder_output_size(void); +int saa7114_get_decoder_vbi_format(int line); +int saa7114_write_reg(unsigned char reg, unsigned char val); +int saa7114_read_reg(unsigned char reg, unsigned char *val); + +int +saa7114_write_reg(unsigned char reg, unsigned char val) +{ + return gfx_i2c_write(2, SAA7114_CHIPADDR, reg, 1, &val); +} + +int +saa7114_read_reg(unsigned char reg, unsigned char *val) +{ + return gfx_i2c_read(2, SAA7114_CHIPADDR, reg, 1, val); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_vbi_upscale + * + * This routine configures the video decoder task A to upscale raw VBI data + * horizontally to match a different system clock. + * The upscale is from 13.5 MHz (SAA7114) to 14.318 MHz (Bt835). + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_vbi_upscale(void) +#else +int +gfx_set_decoder_vbi_upscale(void) +#endif +{ + /* Set horizontal output length to 1528 (720 * 2 * 14.318 / 13.5) */ + saa7114_write_reg(SAA7114_TASK_A_HORZ_OUTPUT_LO, 0xF8); + saa7114_write_reg(SAA7114_TASK_A_HORZ_OUTPUT_HI, 0x05); + + /* Set horizontal luminance scaling increment to 484 (1024 * 13.5 / 28.636) */ + saa7114_write_reg(SAA7114_TASK_A_HSCALE_LUMA_LO, 0xE4); + saa7114_write_reg(SAA7114_TASK_A_HSCALE_LUMA_HI, 0x01); + + /* Set horizontal chrominance scaling increment to 242 */ + saa7114_write_reg(SAA7114_TASK_A_HSCALE_CHROMA_LO, 0xF2); + saa7114_write_reg(SAA7114_TASK_A_HSCALE_CHROMA_HI, 0x00); + + return GFX_STATUS_OK; +} + +/*----------------------------------------------------------------------------- + * gfx_decoder_software_reset + * + * This routine performs a software reset of the decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_decoder_software_reset(void) +#else +int +gfx_decoder_software_reset(void) +#endif +{ + saa7114_write_reg(0x88, 0xC0); + /* I2C-bus latency should be sufficient for resetting the internal state machine. */ + /* gfx_delay_milliseconds(10); */ + saa7114_write_reg(0x88, 0xF0); + return GFX_STATUS_OK; +} + +/*----------------------------------------------------------------------------- + * gfx_decoder_detect_macrovision + * + * This routine detects if macrovision exists in the input of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_decoder_detect_macrovision(void) +#else +int +gfx_decoder_detect_macrovision(void) +#endif +{ + unsigned char macrovision = 0xff; + + saa7114_read_reg(SAA7114_STATUS, ¯ovision); + return ((macrovision & 0x02) >> 1); +} + +/*----------------------------------------------------------------------------- + * gfx_decoder_detect_video + * + * This routine detects if video exists in the input of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_decoder_detect_video(void) +#else +int +gfx_decoder_detect_video(void) +#endif +{ + unsigned char video = 0xff; + + saa7114_read_reg(SAA7114_STATUS, &video); + return !((video & 0x40) >> 6); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_defaults + * + * This routine is called to set the initial register values of the + * video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_defaults(void) +#else +int +gfx_set_decoder_defaults(void) +#endif +{ + unsigned int i; + + /* LOOP THROUGH INDEX/DATA PAIRS IN THE TABLE */ + + for (i = 0; i < GFX_NUM_SAA7114_INIT_VALUES; i++) { + saa7114_write_reg(gfx_saa7114_init_values[i].index, + gfx_saa7114_init_values[i].value); + } + + gfx_decoder_software_reset(); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_analog_input + * + * This routine sets the analog input of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_analog_input(unsigned char input) +#else +int +gfx_set_decoder_analog_input(unsigned char input) +#endif +{ + saa7114_write_reg(SAA7114_ANALOG_INPUT_CTRL1, input); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_brightness + * + * This routine sets the brightness of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_brightness(unsigned char brightness) +#else +int +gfx_set_decoder_brightness(unsigned char brightness) +#endif +{ + saa7114_write_reg(SAA7114_BRIGHTNESS, brightness); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_contrast + * + * This routine sets the contrast of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_contrast(unsigned char contrast) +#else +int +gfx_set_decoder_contrast(unsigned char contrast) +#endif +{ + saa7114_write_reg(SAA7114_CONTRAST, (unsigned char)(contrast >> 1)); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_hue + * + * This routine sets the hue control of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_hue(char hue) +#else +int +gfx_set_decoder_hue(char hue) +#endif +{ + saa7114_write_reg(SAA7114_HUE, (unsigned char)hue); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_saturation + * + * This routine sets the saturation adjustment of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_saturation(unsigned char saturation) +#else +int +gfx_set_decoder_saturation(unsigned char saturation) +#endif +{ + saa7114_write_reg(SAA7114_SATURATION, (unsigned char)(saturation >> 1)); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_input_offset + * + * This routine sets the size of the decoder input window. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_input_offset(unsigned short x, unsigned short y) +#else +int +gfx_set_decoder_input_offset(unsigned short x, unsigned short y) +#endif +{ + /* SET THE INPUT WINDOW OFFSET */ + + saa7114_write_reg(SAA7114_HORZ_OFFSET_LO, (unsigned char)(x & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_OFFSET_HI, (unsigned char)(x >> 8)); + saa7114_write_reg(SAA7114_VERT_OFFSET_LO, (unsigned char)(y & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_OFFSET_HI, (unsigned char)(y >> 8)); + + gfx_decoder_software_reset(); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_input_size + * + * This routine sets the size of the decoder input window. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_input_size(unsigned short width, unsigned short height) +#else +int +gfx_set_decoder_input_size(unsigned short width, unsigned short height) +#endif +{ + /* DIVIDE HEIGHT BY TWO FOR INTERLACING */ + + height = (height + 1) >> 1; + + /* SET THE INPUT WINDOW SIZE */ + + saa7114_write_reg(SAA7114_HORZ_INPUT_LO, (unsigned char)(width & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_INPUT_HI, (unsigned char)(width >> 8)); + saa7114_write_reg(SAA7114_VERT_INPUT_LO, (unsigned char)(height & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_INPUT_HI, (unsigned char)(height >> 8)); + + gfx_decoder_software_reset(); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_output_size + * + * This routine sets the size of the decoder output window. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_output_size(unsigned short width, unsigned short height) +#else +int +gfx_set_decoder_output_size(unsigned short width, unsigned short height) +#endif +{ + /* ROUND WIDTH UP TO EVEN NUMBER TO PREVENT DECODER BECOMING STUCK */ + + width = ((width + 1) >> 1) << 1; + + /* DIVIDE HEIGHT BY TWO FOR INTERLACING */ + + height = (height + 1) >> 1; + + /* SET THE OUTPUT WINDOW SIZE */ + + saa7114_write_reg(SAA7114_HORZ_OUTPUT_LO, (unsigned char)(width & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_OUTPUT_HI, (unsigned char)(width >> 8)); + saa7114_write_reg(SAA7114_VERT_OUTPUT_LO, + (unsigned char)(height & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_OUTPUT_HI, (unsigned char)(height >> 8)); + + gfx_decoder_software_reset(); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_scale + * + * This routine sets the scaling of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned char prescale = 0; + int scale = 0; + + /* SET THE HORIZONTAL PRESCALE */ + /* Downscale from 1 to 1/63 source size. */ + + if (dstw) + prescale = (unsigned char)(srcw / dstw); + if (!prescale) + prescale = 1; + if (prescale > 63) + return (1); + saa7114_write_reg(SAA7114_HORZ_PRESCALER, prescale); + + /* USE FIR PREFILTER FUNCTIONALITY (OPTIMISATION) */ + + if (prescale < 36) { + if (optimize_for_aliasing) { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[prescale - 1].acl_low); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[prescale - + 1].prefilter_low); + } else { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[prescale - 1].acl_high); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[prescale - + 1].prefilter_high); + } + } else { + /* SAME SETTINGS FOR RATIO 1/35 DOWNTO 1/63 */ + if (optimize_for_aliasing) { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[34].acl_low); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[34].prefilter_low); + } else { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[34].acl_high); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[34].prefilter_high); + } + } + + /* SET THE HORIZONTAL SCALING */ + + if (!dstw) + return (1); + scale = ((1024 * srcw * 1000) / (dstw * prescale)) / 1000; + if ((scale > 8191) || (scale < 300)) + return (1); + saa7114_write_reg(SAA7114_HSCALE_LUMA_LO, (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_HSCALE_LUMA_HI, (unsigned char)(scale >> 8)); + scale >>= 1; + saa7114_write_reg(SAA7114_HSCALE_CHROMA_LO, + (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_HSCALE_CHROMA_HI, (unsigned char)(scale >> 8)); + + /* SET THE VERTICAL SCALING (INTERPOLATION MODE) */ + + if (!dsth) + return (1); + + /* ROUND DESTINATION HEIGHT UP TO EVEN NUMBER TO PREVENT DECODER BECOMING STUCK */ + + dsth = ((dsth + 1) >> 1) << 1; + + scale = (int)((1024 * srch) / dsth); + saa7114_write_reg(SAA7114_VSCALE_LUMA_LO, (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_VSCALE_LUMA_HI, (unsigned char)(scale >> 8)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_LO, + (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_HI, (unsigned char)(scale >> 8)); + + if (dsth >= (srch >> 1)) { + /* USE INTERPOLATION MODE FOR SCALE FACTOR ABOVE 0.5 */ + + saa7114_write_reg(SAA7114_VSCALE_CONTROL, 0x00); + + /* SET VERTICAL PHASE REGISTER FOR CORRECT SCALED INTERLACED OUTPUT (OPTIMISATION) */ + /* THE OPTIMISATION IS BASED ON OFIDC = 0 (REG 90h[6] = 0 ) */ + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS0, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS1, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS2, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - + 16)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS3, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - + 16)); + + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS0, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS1, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS2, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - + 16)); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS3, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - + 16)); + + /* RESTORE CONTRAST AND SATURATION FOR INTERPOLATION MODE */ + + saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char)0x40); + saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char)0x40); + } else { + /* USE ACCUMULATION MODE FOR DOWNSCALING BY MORE THAN 2x */ + + saa7114_write_reg(SAA7114_VSCALE_CONTROL, 0x01); + + /* SET VERTICAL PHASE OFFSETS OFF (OPTIMISATION) */ + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS0, 0x00); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS1, 0x00); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS2, 0x00); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS3, 0x00); + + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS0, 0x00); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS1, 0x00); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS2, 0x00); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS3, 0x00); + + /* ADJUST CONTRAST AND SATURATION FOR ACCUMULATION MODE */ + + if (srch) + scale = (64 * dsth) / srch; + saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char)scale); + saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char)scale); + } + + gfx_decoder_software_reset(); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_vbi_format + * + * This routine programs the decoder to produce the specified format of VBI + * data for the specified lines. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_vbi_format(int start, int end, int format) +#else +int +gfx_set_decoder_vbi_format(int start, int end, int format) +#endif +{ + int i; + unsigned char data; + + for (i = start; i <= end; i++) { + switch (format) { + case VBI_FORMAT_VIDEO: + data = 0xFF; + break; /* Active video */ + case VBI_FORMAT_RAW: + data = 0x77; + break; /* Raw VBI data */ + case VBI_FORMAT_CC: + data = 0x55; + break; /* US CC */ + case VBI_FORMAT_NABTS: + data = 0xCC; + break; /* US NABTS */ + default: + return GFX_STATUS_BAD_PARAMETER; + } + saa7114_write_reg((unsigned char)(0x3F + i), data); + } + return GFX_STATUS_OK; +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_vbi_enable + * + * This routine enables or disables VBI transfer in the decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_vbi_enable(int enable) +#else +int +gfx_set_decoder_vbi_enable(int enable) +#endif +{ + unsigned char data; + + saa7114_read_reg(SAA7114_IPORT_CONTROL, &data); + if (enable) + data |= 0x80; + else + data &= ~0x80; + saa7114_write_reg(SAA7114_IPORT_CONTROL, data); + return GFX_STATUS_OK; +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_TV_standard + * + * This routine configures the decoder for the required TV standard. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_TV_standard(TVStandardType TVStandard) +#else +int +gfx_set_decoder_TV_standard(TVStandardType TVStandard) +#endif +{ + switch (TVStandard) { + case TV_STANDARD_NTSC: + saa7114_write_reg(0x0E, 0x89); + saa7114_write_reg(0x5A, 0x06); + break; + case TV_STANDARD_PAL: + saa7114_write_reg(0x0E, 0x81); + saa7114_write_reg(0x5A, 0x03); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + gfx_decoder_software_reset(); + return GFX_STATUS_OK; +} + +/*----------------------------------------------------------------------------- + * gfx_set_decoder_luminance_filter + * + * This routine sets the hue control of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_luminance_filter(unsigned char lufi) +#else +int +gfx_set_decoder_luminance_filter(unsigned char lufi) +#endif +{ + unsigned char data; + + saa7114_read_reg(SAA7114_LUMINANCE_CONTROL, &data); + saa7114_write_reg(SAA7114_LUMINANCE_CONTROL, + (unsigned char)((data & ~0x0F) | (lufi & 0x0F))); + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_brightness + * + * This routine returns the current brightness of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned char +saa7114_get_decoder_brightness(void) +#else +unsigned char +gfx_get_decoder_brightness(void) +#endif +{ + unsigned char brightness = 0; + + saa7114_read_reg(SAA7114_BRIGHTNESS, &brightness); + return (brightness); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_contrast + * + * This routine returns the current contrast of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned char +saa7114_get_decoder_contrast(void) +#else +unsigned char +gfx_get_decoder_contrast(void) +#endif +{ + unsigned char contrast = 0; + + saa7114_read_reg(SAA7114_CONTRAST, &contrast); + contrast <<= 1; + return (contrast); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_hue + * + * This routine returns the current hue of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +char +saa7114_get_decoder_hue(void) +#else +char +gfx_get_decoder_hue(void) +#endif +{ + unsigned char hue = 0; + + saa7114_read_reg(SAA7114_HUE, &hue); + return ((char)hue); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_saturation + * + * This routine returns the current saturation of the video decoder. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned char +saa7114_get_decoder_saturation(void) +#else +unsigned char +gfx_get_decoder_saturation(void) +#endif +{ + unsigned char saturation = 0; + + saa7114_read_reg(SAA7114_SATURATION, &saturation); + saturation <<= 1; + return (saturation); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_input_offset + * + * This routine returns the offset into the input window. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned long +saa7114_get_decoder_input_offset(void) +#else +unsigned long +gfx_get_decoder_input_offset(void) +#endif +{ + unsigned long value = 0; + unsigned char data; + + saa7114_read_reg(SAA7114_HORZ_OFFSET_LO, &data); + value = (unsigned long)data; + saa7114_read_reg(SAA7114_HORZ_OFFSET_HI, &data); + value |= ((unsigned long)data) << 8; + saa7114_read_reg(SAA7114_VERT_OFFSET_LO, &data); + value |= ((unsigned long)data) << 16; + saa7114_read_reg(SAA7114_VERT_OFFSET_HI, &data); + value |= ((unsigned long)data) << 24; + return (value); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_input_size + * + * This routine returns the current size of the input window + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned long +saa7114_get_decoder_input_size(void) +#else +unsigned long +gfx_get_decoder_input_size(void) +#endif +{ + unsigned long value = 0; + unsigned char data; + + saa7114_read_reg(SAA7114_HORZ_INPUT_LO, &data); + value = (unsigned long)data; + saa7114_read_reg(SAA7114_HORZ_INPUT_HI, &data); + value |= ((unsigned long)data) << 8; + saa7114_read_reg(SAA7114_VERT_INPUT_LO, &data); + value |= ((unsigned long)data) << 17; + saa7114_read_reg(SAA7114_VERT_INPUT_HI, &data); + value |= ((unsigned long)data) << 25; + return (value); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_output_size + * + * This routine returns the current size of the output window. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned long +saa7114_get_decoder_output_size(void) +#else +unsigned long +gfx_get_decoder_output_size(void) +#endif +{ + unsigned long value = 0; + unsigned char data; + + saa7114_read_reg(SAA7114_HORZ_OUTPUT_LO, &data); + value = (unsigned long)data; + saa7114_read_reg(SAA7114_HORZ_OUTPUT_HI, &data); + value |= ((unsigned long)data) << 8; + saa7114_read_reg(SAA7114_VERT_OUTPUT_LO, &data); + value |= ((unsigned long)data) << 17; + saa7114_read_reg(SAA7114_VERT_OUTPUT_HI, &data); + value |= ((unsigned long)data) << 25; + return (value); +} + +/*----------------------------------------------------------------------------- + * gfx_get_decoder_vbi_format + * + * This routine returns the current format of VBI data for the specified line. + *----------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_get_decoder_vbi_format(int line) +#else +int +gfx_get_decoder_vbi_format(int line) +#endif +{ + unsigned char format = 0, data; + + saa7114_read_reg((unsigned char)(0x3F + line), &data); + switch (data) { + case 0xFF: + format = VBI_FORMAT_VIDEO; + break; /* Active video */ + case 0x77: + format = VBI_FORMAT_RAW; + break; /* Raw VBI data */ + case 0x55: + format = VBI_FORMAT_CC; + break; /* US CC */ + case 0xCC: + format = VBI_FORMAT_NABTS; + break; /* US NABTS */ + } + return (format); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_1200.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_1200.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_1200.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,1113 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_1200.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: tv_1200.c $ + * + * This file contains routines to control the SC1200 TVOUT and TV encoder. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +int sc1200_set_tv_format(TVStandardType format, GfxOnTVType resolution); +int sc1200_set_tv_output(int output); +int sc1200_set_tv_enable(int enable); +int sc1200_set_tv_flicker_filter(int ff); +int sc1200_set_tv_sub_carrier_reset(int screset); +int sc1200_set_tv_vphase(int vphase); +int sc1200_set_tv_YC_delay(int delay); +int sc1200_set_tvenc_reset_interval(int interval); +int sc1200_set_tv_cc_enable(int enable); +int sc1200_set_tv_cc_data(unsigned char data1, unsigned char data2); +int sc1200_set_tv_display(int width, int height); +int sc1200_test_tvout_odd_field(void); +int sc1200_test_tvenc_odd_field(void); +int sc1200_set_tv_field_status_invert(int enable); +int sc1200_get_tv_vphase(void); +int sc1200_get_tv_enable(unsigned int *p_on); +int sc1200_get_tv_output(void); +int sc1200_get_tv_mode_count(TVStandardType format); +int sc1200_get_tv_display_mode(int *width, int *height, int *bpp, int *hz); +int sc1200_get_tv_display_mode_frequency(unsigned short width, + unsigned short height, + TVStandardType format, + int *frequency); +int sc1200_is_tv_display_mode_supported(unsigned short width, + unsigned short height, + TVStandardType format); + +int sc1200_get_tv_standard(unsigned long *p_standard); +int sc1200_get_available_tv_standards(unsigned long *p_standards); +int sc1200_set_tv_standard(unsigned long standard); +int sc1200_get_tv_vga_mode(unsigned long *p_vga_mode); +int sc1200_get_available_tv_vga_modes(unsigned long *p_vga_modes); +int sc1200_set_tv_vga_mode(unsigned long vga_mode); +int sc1200_get_tvout_mode(unsigned long *p_tvout_mode); +int sc1200_set_tvout_mode(unsigned long tvout_mode); +int sc1200_get_sharpness(int *p_sharpness); +int sc1200_set_sharpness(int sharpness); +int sc1200_get_flicker_filter(int *p_flicker); +int sc1200_set_flicker_filter(int flicker); +int sc1200_get_overscan(int *p_x, int *p_y); +int sc1200_set_overscan(int x, int y); +int sc1200_get_position(int *p_x, int *p_y); +int sc1200_set_position(int x, int y); +int sc1200_get_color(int *p_color); +int sc1200_set_color(int color); +int sc1200_get_brightness(int *p_brightness); +int sc1200_set_brightness(int brightness); +int sc1200_get_contrast(int *p_contrast); +int sc1200_set_contrast(int constrast); +int sc1200_get_yc_filter(unsigned int *p_yc_filter); +int sc1200_set_yc_filter(unsigned int yc_filter); +int sc1200_get_aps_trigger_bits(unsigned int *p_trigger_bits); +int sc1200_set_aps_trigger_bits(unsigned int trigger_bits); +unsigned char cc_add_parity_bit(unsigned char data); + +/*----------------------------------------------------------------------------- + * gfx_set_tv_format + * + * This routine sets the TV encoder registers to the specified format + * and resolution. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#else +int +gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#endif +{ + unsigned long ctrl2, mode; + + /* Save TV output mode */ + ctrl2 = + READ_VID32(SC1200_TVENC_TIM_CTRL_2) & (SC1200_TVENC_OUTPUT_YCBCR | + SC1200_TVENC_CFS_MASK); + /* Save flicker filter setting */ + mode = READ_VID32(SC1200_TVOUT_HORZ_SCALING) & + SC1200_TVOUT_FLICKER_FILTER_MASK; + + switch (format) { + case TV_STANDARD_NTSC: + /* Horizontal Sync Start is 848 */ + /* Horizontal Sync End is 856 */ + WRITE_VID32(SC1200_TVOUT_HORZ_SYNC, 0x03580350); + /* Vertical Sync Start is 0 */ + /* Vertical Sync End is 1 */ + /* Vertical Display Start Skew is 1 */ + /* Vertical Display End Skew is 1 */ + WRITE_VID32(SC1200_TVOUT_VERT_SYNC, 0x05001000); + /* Disable vertical down scaling, take all lines */ + if (gfx_chip_revision <= SC1200_REV_B3) + WRITE_VID32(SC1200_TVOUT_VERT_DOWNSCALE, 0xffffffff); + /* Enable video timing */ + /* Reset sub carrier every two frames */ + /* Disable BLANK */ + /* Enable color burst */ + /* Add the IRE offset */ + /* NTSC color encoding */ + /* Video generator timing is 525 lines / 60Hz */ + /* Horizontal and Vertical counters are initialized to HPHASE & VPHASE */ + /* VPHASE is 2, HPHASE is 0x50 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, 0xa2a01050); + /* Increase horizontal blanking interval */ + /* Low Water Mark for Y is 0x1F */ + /* Low Water Mark for Cb is 0xF */ + /* HUE is 0 */ + /* SCPHASE is 0xF9 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, 0x9ff000f9 | ctrl2); + /* Subcarrier Frequency is 3.579545 MHz */ + WRITE_VID32(SC1200_TVENC_SUB_FREQ, 0x21f07c1f); + /* VSTART is 18, HSTART is 113 */ + WRITE_VID32(SC1200_TVENC_DISP_POS, 0x00120071); + /* Display size: HEIGHT is 239, WIDTH is 719 */ + WRITE_VID32(SC1200_TVENC_DISP_SIZE, 0x00ef02cf); + switch (resolution) { + case GFX_ON_TV_SQUARE_PIXELS: + if (gfx_chip_revision <= SC1200_REV_B3) { + /* Horizontal Display start is 116 */ + /* Total number of pixels per line is 857 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x00740359); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Enable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020700 | mode); + /* Horizontal display end is 919, i.e. 720 active pixels */ + /* Total number of display lines per field is 240 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039700f0); + } else { /* Use new scaler available in Rev. C */ + /* Horizontal Display start is 111 */ + /* Total number of pixels per line is 857 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x006f0359); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Set Horizontal upscaling to 64/58 (~ 11/10) */ + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x3A000000); + /* Horizontal display end is 900, i.e. 706 active pixels */ + /* Total number of display lines per field is 240 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x038400f0); + } + break; + case GFX_ON_TV_NO_SCALING: + /* Horizontal Display start is 116 */ + /* Total number of pixels per line is 857 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x00740359); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Disable Horizontal scaling (set to 64/64) */ + if (gfx_chip_revision >= SC1200_REV_C1) + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x40000000); + /* Horizontal display end is 919, i.e. 720 active pixels */ + /* Total number of display lines per field is 240 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039700f0); + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + break; + case TV_STANDARD_PAL: + /* Horizontal Sync Start is 854 */ + /* Horizontal Sync End is 862 */ + WRITE_VID32(SC1200_TVOUT_HORZ_SYNC, 0x035e0356); + /* Vertical Sync Start is 0 */ + /* Vertical Sync End is 1 */ + /* Vertical Display Start Skew is 1 */ + /* Vertical Display End Skew is 1 */ + WRITE_VID32(SC1200_TVOUT_VERT_SYNC, 0x05001000); + /* Disable vertical down scaling, take all lines */ + if (gfx_chip_revision <= SC1200_REV_B3) + WRITE_VID32(SC1200_TVOUT_VERT_DOWNSCALE, 0xffffffff); + /* Enable video timing */ + /* Never reset sub carrier (should be every 4 frames but doesn't work with genlock) */ + /* Disable BLANK */ + /* Enable color burst */ + /* Do not add the IRE offset */ + /* NTSC color encoding */ + /* Video generator timing is 625 lines / 50Hz */ + /* Horizontal and Vertical counters are initialized to HPHASE & VPHASE */ + /* VPHASE is 2, HPHASE is 50 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, 0xB1201050); + /* Increase horizontal blanking interval */ + /* Low Water Mark for Y is 0x1F */ + /* Low Water Mark for Cb is 0xF */ + /* HUE is 0 */ + /* SCPHASE is 0xD9 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, 0x9ff000d9 | ctrl2); + /* Subcarrier Frequency is 4.43361875 MHz */ + WRITE_VID32(SC1200_TVENC_SUB_FREQ, 0x2a098acb); + /* VSTART is 22, HSTART is 123 */ + WRITE_VID32(SC1200_TVENC_DISP_POS, 0x0016007b); + /* Display size: HEIGHT is 287, WIDTH is 719 */ + WRITE_VID32(SC1200_TVENC_DISP_SIZE, 0x011f02cf); + switch (resolution) { + case GFX_ON_TV_NO_SCALING: + /* Horizontal Display start is 124 */ + /* Total number of pixels per line is 863 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x007c035f); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Disable Horizontal scaling (set to 64/64) */ + if (gfx_chip_revision >= SC1200_REV_C1) + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x40000000); + /* Horizontal display end is 924, i.e. 720 active pixels */ + /* Total number of display lines per field is 288 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039c0120); + break; + case GFX_ON_TV_SQUARE_PIXELS: + /* Horizontal Display start is 122 */ + /* Total number of pixels per line is 863 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x007a035f); + if (gfx_chip_revision <= SC1200_REV_B3) { + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Horizontal downscale m/(m+1), m = 11, (i.e. 11/12 - closest possible to 54/59) */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x1002040b | mode); + /* Horizontal display end is 906, i.e. 704 active pixels */ + /* Total number of display lines per field is 288 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x038a0120); + } else { + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Set Horizontal down scaling to 64/70 (closest possible to 54/59) */ + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x46000000); + /* Horizontal display end is 904, i.e. 702 active pixels */ + /* Total number of display lines per field is 288 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x03880120); + } + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_output + * + * This routine sets the TV encoder registers to the specified output type. + * Supported output types are : S-VIDEO, Composite, YUV and SCART. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_output(int output) +#else +int +gfx_set_tv_output(int output) +#endif +{ + unsigned long ctrl2, ctrl3; + + ctrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); + ctrl3 = READ_VID32(SC1200_TVENC_TIM_CTRL_3); + ctrl2 &= ~(SC1200_TVENC_OUTPUT_YCBCR | SC1200_TVENC_CFS_MASK); + ctrl3 &= ~(SC1200_TVENC_CM | SC1200_TVENC_SYNCMODE_MASK | SC1200_TVENC_CS); + switch (output) { + case TV_OUTPUT_COMPOSITE: + /* Analog outputs provide Y, C and CVBS */ + /* Chrominance Lowpass filter is 1.3MHz (for composite video output) */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_CVBS); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, ctrl3); + break; + case TV_OUTPUT_S_VIDEO: + /* Analog outputs provide Y, C and CVBS */ + /* Chrominance Lowpass filter is 1.8MHz (for S-video output) */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_SVIDEO); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, ctrl3); + break; + case TV_OUTPUT_YUV: + /* Analog outputs provide Y, Cb and Cr */ + /* A 7.5 IRE setup is applied to the output */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, + ctrl2 | SC1200_TVENC_OUTPUT_YCBCR | + SC1200_TVENC_CFS_BYPASS); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, + ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_CS); + break; + case TV_OUTPUT_SCART: + /* Analog outputs provide SCART (RGB and CVBS) */ + /* Sync is added to green signal */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_CVBS); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, + ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_SYNC_ON_GREEN); + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + + /* Adjusts the internal voltage reference */ + ctrl2 = READ_VID32(SC1200_TVENC_DAC_CONTROL); + ctrl2 &= ~SC1200_TVENC_TRIM_MASK; + + /* Bypass for issue #926 : Inadequate chroma level of S-Video output */ + if ((gfx_chip_revision == SC1200_REV_B3) && (output == TV_OUTPUT_S_VIDEO)) + ctrl2 |= 0x7; + else + ctrl2 |= 0x5; + + WRITE_VID32(SC1200_TVENC_DAC_CONTROL, ctrl2); + + /* Disable 4:2:2 to 4:4:4 converter interpolation */ + WRITE_VID32(SC1200_TVOUT_DEBUG, SC1200_TVOUT_CONVERTER_INTERPOLATION); + + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_enable + * + * This routine enables or disables the TV output. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_enable(int enable) +#else +int +gfx_set_tv_enable(int enable) +#endif +{ + unsigned long value_tim, value_dac; + + value_tim = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + value_dac = READ_VID32(SC1200_TVENC_DAC_CONTROL); + + if (enable) { + value_tim |= SC1200_TVENC_VIDEO_TIMING_ENABLE; + value_dac &= ~SC1200_TVENC_POWER_DOWN; + /* ENABLE GRAPHICS DISPLAY LOGIC IN VIDEO PROCESSOR */ + gfx_set_screen_enable(1); + } else { + value_tim &= ~SC1200_TVENC_VIDEO_TIMING_ENABLE; + value_dac |= SC1200_TVENC_POWER_DOWN; + /* Do not disable the graphics display logic because it might be needed for CRT */ + } + + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, value_tim); + WRITE_VID32(SC1200_TVENC_DAC_CONTROL, value_dac); + + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_flicker_filter + * + * This routine configures the TV out flicker filter. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_flicker_filter(int ff) +#else +int +gfx_set_tv_flicker_filter(int ff) +#endif +{ + unsigned long mode; + + mode = READ_VID32(SC1200_TVOUT_HORZ_SCALING); + mode &= ~SC1200_TVOUT_FLICKER_FILTER_MASK; + switch (ff) { + case TV_FLICKER_FILTER_NONE: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + mode | SC1200_TVOUT_FLICKER_FILTER_DISABLED); + break; + case TV_FLICKER_FILTER_NORMAL: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + mode | SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH); + break; + case TV_FLICKER_FILTER_INTERLACED: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + mode | SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_sub_carrier_reset + * + * This routine configures the TV encoder sub carrier reset interval. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_sub_carrier_reset(int screset) +#else +int +gfx_set_tv_sub_carrier_reset(int screset) +#endif +{ + unsigned long mode; + + mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + mode &= ~SC1200_TVENC_SUB_CARRIER_RESET_MASK; + switch (screset) { + case TV_SUB_CARRIER_RESET_NEVER: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_NEVER); + break; + case TV_SUB_CARRIER_RESET_EVERY_TWO_LINES: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES); + break; + case TV_SUB_CARRIER_RESET_EVERY_TWO_FRAMES: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES); + break; + case TV_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_vphase + * + * This routine sets the tv encoder VPHASE value. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_vphase(int vphase) +#else +int +gfx_set_tv_vphase(int vphase) +#endif +{ + unsigned long mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + + mode &= ~SC1200_TVENC_VPHASE_MASK; + mode |= (vphase << SC1200_TVENC_VPHASE_POS) & SC1200_TVENC_VPHASE_MASK; + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, mode); + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_YC_delay + * + * This routine configures the TV out Y/C delay. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_YC_delay(int delay) +#else +int +gfx_set_tv_YC_delay(int delay) +#endif +{ + unsigned long mode; + + /* This feature is implemented in Rev C1 */ + if (gfx_chip_revision < SC1200_REV_C1) + return (GFX_STATUS_OK); + + mode = READ_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE); + mode &= ~SC1200_TVOUT_YC_DELAY_MASK; + switch (delay) { + case TV_YC_DELAY_NONE: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_YC_DELAY_NONE); + break; + case TV_Y_DELAY_ONE_PIXEL: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_Y_DELAY_ONE_PIXEL); + break; + case TV_C_DELAY_ONE_PIXEL: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_C_DELAY_ONE_PIXEL); + break; + case TV_C_DELAY_TWO_PIXELS: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_C_DELAY_TWO_PIXELS); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tvenc_reset_interval + * + * This routine sets the interval between external resets of the TV encoder + * timing generator by the TV out. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tvenc_reset_interval(int interval) +#else +int +gfx_set_tvenc_reset_interval(int interval) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_TVOUT_HORZ_SCALING); + value &= ~SC1200_TVENC_EXTERNAL_RESET_INTERVAL_MASK; + switch (interval) { + case TVENC_RESET_EVERY_ODD_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD); + break; + case TVENC_RESET_EVERY_EVEN_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD); + break; + case TVENC_RESET_NEXT_ODD_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD); + break; + case TVENC_RESET_NEXT_EVEN_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD); + break; + case TVENC_RESET_EVERY_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD); + break; + case TVENC_RESET_EVERY_X_ODD_FIELDS: + case TVENC_RESET_EVERY_X_EVEN_FIELDS: + return GFX_STATUS_UNSUPPORTED; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + * + * This routine enables or disables the use of the hardware CC registers + * in the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_cc_enable(int enable) +#else +int +gfx_set_tv_cc_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_TVENC_CC_CONTROL); + value &= ~(0x0005F); + if (enable) + value |= 0x51; + WRITE_VID32(SC1200_TVENC_CC_CONTROL, value); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_tv_display + * + * This routine sets the timings in the display controller to support a + * TV resolution. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_display(int width, int height) +#else +int +gfx_set_tv_display(int width, int height) +#endif +{ + DISPLAYMODE *pMode; + unsigned int i; + + for (i = 0; i < NUM_TV_MODES; i++) { + pMode = &TVTimings[i]; + if ((unsigned)width == pMode->hactive + && (unsigned)height == pMode->vactive) + break; + } + + if (i == NUM_TV_MODES) + return 0; + + gfx_set_display_timings(gfx_get_display_bpp(), + (unsigned short)pMode->flags, pMode->hactive, + pMode->hblankstart, pMode->hsyncstart, + pMode->hsyncend, pMode->hblankend, pMode->htotal, + pMode->vactive, pMode->vblankstart, + pMode->vsyncstart, pMode->vsyncend, + pMode->vblankend, pMode->vtotal, pMode->frequency); + + return 1; +} + +/*----------------------------------------------------------------------------- + * cc_add_parity_bit + * + * This routine adds the (odd) parity bit to the data character. + *----------------------------------------------------------------------------- + */ +unsigned char +cc_add_parity_bit(unsigned char data) +{ + int i, num = 0; + unsigned char d = data; + + for (i = 0; i < 7; i++) { + if (d & 0x1) + num++; + d >>= 1; + } + if (num & 0x1) + return (data & ~0x80); + else + return (data | 0x80); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_cc_data(unsigned char data1, unsigned char data2) +#else +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +#endif +{ + unsigned long value; + + value = cc_add_parity_bit(data1) | (cc_add_parity_bit(data2) << 8); + WRITE_VID32(SC1200_TVENC_CC_DATA, value); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvout_odd_field + * + * This routine returns 1 if the current TVout field is odd. Otherwise returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_test_tvout_odd_field(void) +#else +int +gfx_test_tvout_odd_field(void) +#endif +{ + unsigned long debug = READ_VID32(SC1200_TVOUT_DEBUG); + + WRITE_VID32(SC1200_TVOUT_DEBUG, debug | SC1200_TVOUT_FIELD_STATUS_TV); + if (READ_VID32(SC1200_TVOUT_DEBUG) & SC1200_TVOUT_FIELD_STATUS_EVEN) + return (0); + else + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvenc_odd_field + * + * This routine returns 1 if the current TV encoder field is odd. Otherwise returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_test_tvenc_odd_field(void) +#else +int +gfx_test_tvenc_odd_field(void) +#endif +{ + unsigned long debug = READ_VID32(SC1200_TVOUT_DEBUG); + + WRITE_VID32(SC1200_TVOUT_DEBUG, debug & ~SC1200_TVOUT_FIELD_STATUS_TV); + if (READ_VID32(SC1200_TVOUT_DEBUG) & SC1200_TVOUT_FIELD_STATUS_EVEN) + return (0); + else + return (1); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_field_status_invert + * + * This routines determines whether the tvout/tvencoder field status bit is + * inverted (enable = 1) or not (enable = 0). + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_field_status_invert(int enable) +#else +int +gfx_set_tv_field_status_invert(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_TVOUT_DEBUG); + + if (enable) { + value |= SC1200_TVOUT_FIELD_STATUS_INVERT; + } else { + value &= ~(SC1200_TVOUT_FIELD_STATUS_INVERT); + } + + WRITE_VID32(SC1200_TVOUT_DEBUG, value); + + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_vphase + * + * This routine returns the tv encoder vertical phase. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_vphase(void) +#else +int +gfx_get_tv_vphase(void) +#endif +{ + unsigned long mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + + return (int)((mode & SC1200_TVENC_VPHASE_MASK) >> SC1200_TVENC_VPHASE_POS); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_enable + * + * This routine returns the current tv enable status + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_enable(unsigned int *p_on) +#else +int +gfx_get_tv_enable(unsigned int *p_on) +#endif +{ + unsigned long control = READ_VID32(SC1200_TVENC_DAC_CONTROL); + + *p_on = (unsigned int)(!(control & SC1200_TVENC_POWER_DOWN)); + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_output + * + * This routine returns the current programmed TV output type. It does not + * detect invalid configurations. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_output(void) +#else +int +gfx_get_tv_output(void) +#endif +{ + unsigned long ctrl2, ctrl3; + int format = 0; + + ctrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); + ctrl3 = READ_VID32(SC1200_TVENC_TIM_CTRL_3); + + if ((ctrl2 & SC1200_TVENC_CFS_MASK) == SC1200_TVENC_CFS_SVIDEO) + format = TV_OUTPUT_S_VIDEO; + else if (ctrl2 & SC1200_TVENC_OUTPUT_YCBCR) + format = TV_OUTPUT_YUV; + else if ((ctrl2 & SC1200_TVENC_CFS_MASK) == SC1200_TVENC_CFS_CVBS) { + if (ctrl3 & SC1200_TVENC_CM) + format = TV_OUTPUT_SCART; + else + format = TV_OUTPUT_COMPOSITE; + } + + return format; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_mode_count + * + * This routine returns the number of valid TV out resolutions. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_mode_count(TVStandardType format) +#else +int +gfx_get_tv_mode_count(TVStandardType format) +#endif +{ + unsigned int mode, count = 0; + unsigned long flag; + + switch (format) { + case TV_STANDARD_NTSC: + flag = GFX_MODE_TV_NTSC; + break; + case TV_STANDARD_PAL: + flag = GFX_MODE_TV_PAL; + break; + default: + return 0; + } + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if (TVTimings[mode].flags & flag) + count++; + } + + return count; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode + * + * This routine returns the current TV display parameters. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) +#else +int +gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) +#endif +{ + unsigned long frequency; + unsigned long mode, flags; + + *width = gfx_get_hactive(); + *height = gfx_get_vactive(); + *bpp = gfx_get_display_bpp(); + frequency = gfx_get_clock_frequency(); + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if (TVTimings[mode].hactive == (unsigned short)(*width) && + TVTimings[mode].vactive == (unsigned short)(*height) && + TVTimings[mode].frequency == frequency) { + flags = TVTimings[mode].flags; + + if (flags & GFX_MODE_TV_NTSC) + *hz = 60; + else if (flags & GFX_MODE_TV_PAL) + *hz = 50; + else + *hz = 0; + return (1); + } + } + + return -1; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode_frequency + * + * This routine returns the PLL frequency of a given TV mode. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_display_mode_frequency(unsigned short width, + unsigned short height, + TVStandardType format, int *frequency) +#else +int +gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, + TVStandardType format, int *frequency) +#endif +{ + unsigned long mode, flag; + int retval = -1; + + *frequency = 0; + + switch (format) { + case TV_STANDARD_NTSC: + flag = GFX_MODE_TV_NTSC; + break; + case TV_STANDARD_PAL: + flag = GFX_MODE_TV_PAL; + break; + default: + return -1; + } + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if ((TVTimings[mode].hactive == width) && + (TVTimings[mode].vactive == height) && + (TVTimings[mode].flags & flag)) { + *frequency = TVTimings[mode].frequency; + retval = 1; + } + } + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_is_tv_display_mode_supported + * + * Returns >= 0 if the mode is available, -1 if the mode could not be found + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_is_tv_display_mode_supported(unsigned short width, + unsigned short height, + TVStandardType format) +#else +int +gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, + TVStandardType format) +#endif +{ + unsigned long mode, flag; + + switch (format) { + case TV_STANDARD_NTSC: + flag = GFX_MODE_TV_NTSC; + break; + case TV_STANDARD_PAL: + flag = GFX_MODE_TV_PAL; + break; + default: + return -1; + } + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if (TVTimings[mode].hactive == width && + TVTimings[mode].vactive == height && + (TVTimings[mode].flags & flag)) { + return ((int)mode); + } + } + + return -1; +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,3562 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: tv_fs450.c $ + * + * This file contains routines to control the FS450 tvout encoder. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#define FS450_DIRECTREG 0 + +#include "tv_fs450.h" + +/*========================================================================== +* +* Macros +* +*========================================================================== +*/ + +#undef fsmax +#undef fsmin +#define fsmax(a, b) ((a) > (b) ? (a) : (b)) +#define fsmin(a, b) ((a) < (b) ? (a) : (b)) + +#undef range_limit +#define range_limit(val,min_val,max_val) (fsmax((min_val),fsmin((val),(max_val)))) + +/*========================================================================== +* +* Registers +* +*========================================================================== +*/ + +#define MAX_REGISTERS 32 +#define MAX_BITS 32 + +#define READ 1 +#define WRITE 2 +#define READ_WRITE (READ | WRITE) + +typedef struct +{ + char *name; + unsigned long offset; + unsigned char bit_length; + unsigned char valid_bits; + unsigned char read_write; + char *bitfield_names[MAX_BITS]; +} +S_REGISTER_DESCRIP; + +typedef struct +{ + int source; + char *name; + S_REGISTER_DESCRIP registers[MAX_REGISTERS]; +} +S_SET_DESCRIP; + +const S_SET_DESCRIP *houston_regs(void); +const S_SET_DESCRIP *encoder_regs(void); +const S_SET_DESCRIP *macrovision_regs(void); +const S_SET_DESCRIP *gcc_regs(void); + +/*========================================================================== +* +* Houston Register Addresses & Bit Definitions +* +*========================================================================== +*/ + +#define HOUSTON_IHO 0x00 /*Input Horizontal Offset */ +#define HOUSTON_IVO 0x02 /*Input Vertical Offset */ +#define HOUSTON_IHA 0x04 /*Input Horizontal Active Width */ +#define HOUSTON_VSC 0x06 /*Vertical Scaling Coeficient */ +#define HOUSTON_HSC 0x08 /*Horizontal Scaling Coeficient */ +#define HOUSTON_BYP 0x0A /*Bypass Register */ +#define HOUSTON_CR 0x0C /*Control Register */ +#define HOUSTON_SP 0x0E /*Status */ +#define HOUSTON_NCONL 0x10 /*NCO numerator low word */ +#define HOUSTON_NCONH 0x12 /*NCO numerator high word */ +#define HOUSTON_NCODL 0x14 /*NCO denominator low word */ +#define HOUSTON_NCODH 0x16 /*NCO denominator high word */ +#define HOUSTON_APO 0x18 /**/ +#define HOUSTON_ALO 0x1A /**/ +#define HOUSTON_AFO 0x1C /**/ +#define HOUSTON_HSOUTWID 0x1E /**/ +#define HOUSTON_HSOUTST 0x20 /**/ +#define HOUSTON_HSOUTEND 0x22 /**/ +#define HOUSTON_SHP 0x24 /*Sharpness */ +#define HOUSTON_FLK 0x26 /*Flicker Filter */ +#define HOUSTON_BCONTL 0x28 /**/ +#define HOUSTON_BCONTH 0x2A /**/ +#define HOUSTON_BDONE 0x2C /**/ +#define HOUSTON_BDIAGL 0x2E /**/ +#define HOUSTON_BDIAGH 0x30 /**/ +#define HOUSTON_REV 0x32 /**/ +#define HOUSTON_MISC 0x34 /**/ +#define HOUSTON_FFO 0x36 /**/ +#define HOUSTON_FFO_LAT 0x38 /**/ +#define HOUSTON_VSOUTWID 0x3A +#define HOUSTON_VSOUTST 0x3C +#define HOUSTON_VSOUTEND 0x3E +/*// BYP Register Bits*/ +#define BYP_RGB_BYPASS 0x0001 +#define BYP_HDS_BYPASS 0x0002 +#define BYP_HDS_TBYPASS 0x0004 +#define BYP_CAC_BYPASS 0x0008 +#define BYP_R2V_SBYPASS 0x0010 +#define BYP_R2V_BYPASS 0x0020 +#define BYP_VDS_BYPASS 0x0040 +#define BYP_FFT_BYPASS 0x0080 +#define BYP_FIF_BYPASS 0x0100 +#define BYP_FIF_TBYPASS 0x0200 +#define BYP_HUS_BYPASS 0x0400 +#define BYP_HUS_TBYPASS 0x0800 +#define BYP_CCR_BYPASS 0x1000 +#define BYP_PLL_BYPASS 0x2000 +#define BYP_NCO_BYPASS 0x4000 +#define BYP_ENC_BYPASS 0x8000 +/*// CR Register Bits*/ +#define CR_RESET 0x0001 +#define CR_CLKOFF 0x0002 +#define CR_NCO_EN 0x0004 +#define CR_COMPOFF 0x0008 +#define CR_YCOFF 0x0010 +#define CR_LP_EN 0x0020 +#define CR_CACQ_CLR 0x0040 +#define CR_FFO_CLR 0x0080 +#define CR_656_PAL_NTSC 0x0100 +#define CR_656_STD_VMI 0x0200 +#define CR_OFMT 0x0400 +#define CR_UIM_CLK 0x0800 +#define CR_UIM_DEC 0x1000 +#define CR_BIPGEN_EN1 0x2000 +#define CR_UIM_MOD0 0x4000 +#define CR_UIM_MOD1 0x8000 +/*// Status Register Bits*/ +#define SP_CACQ_ST 0x0001 +#define SP_FFO_ST 0x0002 +#define SP_REVID_MASK 0x7FFC +#define SP_MV_EN 0x8000 +/*// BDONE Register Bits*/ +#define BDONE_BIST_DONE_A 0x0001 +#define BDONE_BIST_DONE_B 0x0002 +#define BDONE_BIST_DONE_C 0x0004 +#define BDONE_BIST_DONE_D 0x0008 +#define BDONE_BIST_DONE_E 0x0010 +#define BDONE_BIST_DONE_F 0x0020 +#define BDONE_BIST_DONE_G 0x0040 +/*// BDIAGL Register Bits*/ +#define BDIAGL_BIST_DIAG_A 0x000F +#define BDIAGL_BIST_DIAG_B 0x00F0 +#define BDIAGL_BIST_DIAG_C 0x0F00 +#define BDIAGL_BIST_DIAG_D 0xF000 +/*// BDIAGH Register Bits*/ +#define BDIAGH_BIST_DIAG_E 0x000F +#define BDIAGH_BIST_DIAG_F 0x000F +#define BDIAGH_BIST_DIAG_G 0x000F +/*// MISC Register Bits*/ +#define MISC_TV_SHORT_FLD 0x0001 +#define MISC_ENC_TEST 0x0002 +#define MISC_DAC_TEST 0x0004 +#define MISC_MV_SOFT_EN 0x0008 +#define MISC_NCO_LOAD0 0x0010 +#define MISC_NCO_LOAD1 0x0020 +#define MISC_VGACKDIV 0x0200 +#define MISC_BRIDGE_SYNC 0x0400 +#define MISC_GTLIO_PD 0x8000 +/*========================================================================== +* +* Encoder Registers & Bit Definitions +* +*========================================================================== +*/ +#define ENC_CHROMA_FREQ 0x40 +#define ENC_CHROMA_PHASE 0x44 +#define ENC_REG05 0x45 +#define ENC_REG06 0x46 +#define ENC_REG07 0x47 +#define ENC_HSYNC_WIDTH 0x48 +#define ENC_BURST_WIDTH 0x49 +#define ENC_BACK_PORCH 0x4A +#define ENC_CB_BURST_LEVEL 0x4B +#define ENC_CR_BURST_LEVEL 0x4C +#define ENC_SLAVE_MODE 0x4D +#define ENC_BLACK_LEVEL 0x4e +#define ENC_BLANK_LEVEL 0x50 +#define ENC_NUM_LINES 0x57 +#define ENC_WHITE_LEVEL 0x5e +#define ENC_CB_GAIN 0x60 +#define ENC_CR_GAIN 0x62 +#define ENC_TINT 0x65 +#define ENC_BREEZE_WAY 0x69 +#define ENC_FRONT_PORCH 0x6C +#define ENC_ACTIVELINE 0x71 +#define ENC_FIRST_LINE 0x73 +#define ENC_REG34 0x74 +#define ENC_SYNC_LEVEL 0x75 +#define ENC_VBI_BLANK_LEVEL 0x7C +#define ENC_RESET 0x7e +#define ENC_NOTCH_FILTER 0x8d +/*========================================================================== +* +* Macrovision Registers & Bit Definitions +* +*========================================================================== +*/ +#define MV_N0 0x59 +#define MV_N1 0x52 +#define MV_N2 0x7b +#define MV_N3 0x53 +#define MV_N4 0x79 +#define MV_N5 0x5d +#define MV_N6 0x7a +#define MV_N7 0x64 +#define MV_N8 0x54 +#define MV_N9 0x55 +#define MV_N10 0x56 +#define MV_N11 0x6d +#define MV_N12 0x6f +#define MV_N13 0x5a +#define MV_N14 0x5b +#define MV_N15 0x5c +#define MV_N16 0x63 +#define MV_N17 0x66 +#define MV_N18 0x68 +#define MV_N19 0x67 +#define MV_N20 0x61 +#define MV_N21 0x6a +#define MV_N22 0x76 +#define MV_AGC_PULSE_LEVEL 0x77 +#define MV_BP_PULSE_LEVEL 0x78 +/*========================================================================== +* +* The TRACE macro can be used to display debug information. It can display +* one or more parameters in a formatted string like printf. No code will be +* generated for a release build. Use double parentheses for compatibility +* with C #define statements. Newline characters are not added +* automatically. Usage example: +* +* TRACE(("Number is %d, Name is %s.\n",iNumber,lpszName)) +* +*========================================================================== +*/ +/*//#ifdef _DEBUG*/ +/*//void trace(const char *p_fmt,...);*/ +/*//#define TRACE(parameters) {trace parameters;}*/ +/*//#else*/ +#define TRACE(parameters) {} +/*//#endif*/ +/****/ +/*// GCC timing structure.*/ +/****/ + typedef struct _S_TIMING_SPECS +{ + int vga_width; + int vga_lines; + int tv_width; + int tv_lines; + int h_total; + int h_sync; + int v_total; + int v_sync; +} +S_TIMING_SPECS; + +/****/ +/*// Revision of Houston chip*/ +/****/ +#define HOUSTON_REV_A 0 +#define HOUSTON_REV_B 1 +static int houston_Rev(void); + +/*========================================================================== +* +* Functions +* +*========================================================================== +*/ + +static int houston_init(void); + +static unsigned char PLAL_FS450_i2c_address(void); +static int PLAL_FS450_UIM_mode(void); +static int PLAL_ReadRegister(S_REG_INFO * p_reg); +static int PLAL_WriteRegister(const S_REG_INFO * p_reg); +static int PLAL_IsTVOn(void); +static int PLAL_EnableVga(void); +static int PLAL_PrepForTVout(void); +static int PLAL_SetTVTimingRegisters(const S_TIMING_SPECS * p_specs); +static int PLAL_FinalEnableTVout(unsigned long vga_mode); + +/****/ +/*Direct Memory Access Functions*/ +/****/ +/*NOTE: Cx5530 is assumed hardcoded at 0x10000 offset*/ +/*from MediaGX base. F4Bar is bogus as described in the*/ +/*Cx5530 datasheet (actually points to GX frame buffer).*/ +/****/ +static int +DMAL_ReadUInt32(unsigned long phys_addr, unsigned long *p_data) +{ + *p_data = READ_REG32(phys_addr); + return 0; +} + +static int +DMAL_WriteUInt32(unsigned long phys_addr, unsigned long data) +{ + WRITE_REG32(phys_addr, data); + return 0; +} + +/****/ +/*Houston register access functions.*/ +/****/ +static int +houston_ReadReg(unsigned int reg, unsigned long *p_value, unsigned int bytes) +{ + return gfx_i2c_read(1, PLAL_FS450_i2c_address(), (unsigned char)reg, + (unsigned char)bytes, (unsigned char *)p_value); +} + +static int +houston_WriteReg(unsigned int reg, unsigned long value, unsigned int bytes) +{ + return gfx_i2c_write(1, PLAL_FS450_i2c_address(), (unsigned char)reg, + (unsigned char)bytes, (unsigned char *)&value); +} + +/****/ +/*TV configuration functions.*/ +/****/ +static int config_init(void); +static const S_TIMING_SPECS *p_specs(void); +static void config_power(int on); +static void config_vga_mode(unsigned long vga_mode); +static void config_tv_std(unsigned long tv_std, unsigned int trigger_bits); +static void conget_tv_std(unsigned long *p_tv_std); +static unsigned long supported_standards(void); +static void config_tvout_mode(unsigned long tvout_mode); +static void conget_tvout_mode(unsigned long *p_tvout_mode); +static void config_overscan_xy(unsigned long tv_std, unsigned long vga_mode, + int overscan_x, int overscan_y, int pos_x, + int pos_y); +static void config_nco(unsigned long tv_std, unsigned long vga_mode); +static void config_sharpness(int sharpness); +static void conget_sharpness(int *p_sharpness); +static void config_flicker(int flicker); +static void conget_flicker(int *p_flicker); +static void config_color(int color); +static void conget_color(int *p_color); +static void config_brightness_contrast(unsigned long tv_std, + unsigned int trigger_bits, + int brightness, int contrast); +static void conget_brightness_contrast(unsigned long tv_std, + unsigned int trigger_bits, + int *p_brightness, int *p_contrast); +static void config_yc_filter(unsigned long tv_std, int luma_filter, + int chroma_filter); +static void conget_yc_filter(int *p_luma_filter, int *p_chroma_filter); +static void config_macrovision(unsigned long tv_std, + unsigned int cp_trigger_bits); +static void conget_macrovision(unsigned long tv_std, + unsigned int *p_cp_trigger_bits); + +/****/ +/*Device settings.*/ +/****/ +typedef struct _S_DEVICE_SETTINGS +{ + int tv_on; + unsigned long vga_mode; + unsigned long tv_std; + unsigned long tvout_mode; + int overscan_x; + int overscan_y; + int position_x; + int position_y; + int sharpness; + int flicker; + int color; + int brightness; + int contrast; + unsigned char yc_filter; + unsigned int aps_trigger_bits; + int last_overscan_y; +} +S_DEVICE_SETTINGS; + +static S_DEVICE_SETTINGS d; + +/*//==========================================================================*/ +/****/ +/*TV Setup Parameters*/ +/****/ +/*//==========================================================================*/ + +static const struct +{ + unsigned long chroma_freq[5]; + unsigned short chroma_phase[5]; + unsigned short cphase_rst[5]; + unsigned short color[5]; + unsigned short cr_burst_level[5]; + unsigned short cb_burst_level[5]; + unsigned short sys625_50[5]; + unsigned short vsync5[5]; + unsigned short pal_mode[5]; + unsigned short hsync_width[5]; + unsigned short burst_width[5]; + unsigned short back_porch[5]; + unsigned short front_porch[5]; + unsigned short breeze_way[5]; + unsigned short activeline[5]; + unsigned short blank_level[5]; + unsigned short vbi_blank_level[5]; + unsigned short black_level[5]; + unsigned short white_level[5]; + unsigned short hamp_offset[5]; + unsigned short sync_level[5]; + unsigned short tv_lines[5]; + unsigned short tv_width[5]; + unsigned short tv_active_lines[5]; + unsigned short tv_active_width[5]; + unsigned char notch_filter[5]; + unsigned short houston_cr[5]; + unsigned short houston_ncodl[5]; + unsigned short houston_ncodh[5]; +} +tvsetup = +{ + /* ntsc, pal, ntsc-eij, pal-m, pal-n */ + { + 0x1f7cf021, 0xcb8a092a, 0x1f7cf021, 0xe3efe621, 0xcb8a092a} + , /*chroma_freq */ + { + 0, 0, 0, 0, 0} + , /*chroma_phase */ + { + 2, 0, 2, 0, 0} + , /*cphase_rst */ + { + 54, 43, 54, 43, 43} + , /*color */ + { + 0, 31, 0, 29, 29} + , /*cr_burst_level */ + { + 59, 44, 59, 41, 41} + , /*cb_burst_level */ + { + 0, 1, 0, 0, 1} + , /*sys625_50 */ + { + 0, 1, 0, 0, 0} + , /*vsync5 */ + { + 0, 1, 0, 1, 1} + , /*pal_mode */ + { + 0x7a, 0x7a, 0x7a, 0x7a, 0x7a} + , /*hsync_width */ + { + 0x40, 0x3c, 0x40, 0x40, 0x3c} + , /*burst_width */ + { + 0x80, 0x9a, 0x80, 0x80, 0x9a} + , /*back_porch */ + { + 0x24, 0x1e, 0x24, 0x24, 0x1e} + , /*front_porch */ + { + 0x19, 0x1a, 0x19, 0x12, 0x1a} + , /*breeze_way */ + { + 0xb4, 0xb4, 0xb4, 0xb4, 0xb4} + , /*active_line */ + { + 240, 251, 240, 240, 240} + , /*blank_level */ + { + 240, 251, 240, 240, 240} + , /*vbi_blank_level */ + { + 284, 252, 240, 252, 252} + , /*black_level */ + { + 823, 821, 823, 821, 821} + , /*white_level */ + { + 60, 48, 60, 48, 48} + , /*hamp_offset */ + { + 0x08, 0x08, 0x08, 0x08, 0x08} + , /*sync_level */ + { + 525, 625, 525, 525, 625} + , /*tv_lines */ + { + 858, 864, 858, 858, 864} + , /*tv_width */ + { + 487, 576, 487, 487, 576} + , /*tv_active_lines */ + { + 800, 800, 800, 800, 800} + , /*tv_active_width */ + { + 0x1a, 0x1d, 0x1a, 0x1d, 0x1d} + , /*notch filter enabled */ + { + 0x0000, 0x0100, 0x0000, 0x0000, 0x0100} + , /*houston cr pal */ + { + 0x7e48, 0xf580, 0x7e48, 0x7e48, 0xf580} + , /*houston ncodl */ + { + 0x001b, 0x0020, 0x001b, 0x001b, 0x0020} /*houston ncodh */ +}; + +/****/ +/*MediaGX default underscan and centered position setups.*/ +/****/ +#define SCANTABLE_ENTRIES 5 +struct _scantable +{ + unsigned long mode; + unsigned short v_total[5]; + unsigned short v_sync[5]; + unsigned short iha[5]; + signed short iho[5]; + signed short hsc[5]; +}; + +static struct _scantable scantable[SCANTABLE_ENTRIES] = { + { + GFX_VGA_MODE_640X480, + {617, 624, 617, 624, 624}, /*v_total */ + {69, 88, 69, 88, 88}, /*v_sync */ + {720, 720, 720, 720, 720}, /*iha */ + {0, 0, 0, 0, 0}, /*iho */ + {-12, 0, -6, 0, 0} /*hsc */ + }, + { + GFX_VGA_MODE_800X600, + {740, 740, 740, 740, 740}, /*v_total */ + {90, 88, 90, 88, 88}, /*v_sync */ + {720, 720, 508, 720, 720}, /*iha */ + {-8, 11, -8, -8, 11}, /*iho */ + {-27, -27, -27, -27, -27} /*hsc */ + }, + { + GFX_VGA_MODE_720X487, + {525, 720, 525, 720, 720}, /*v_total */ + {23, 230, 23, 230, 230}, /*v_sync */ + {720, 720, 720, 720, 720}, /*iha */ + {0xa2, 0xa2, 0xa2, 0xa2, 0xa2}, /*iho */ + {0, 0, 0, 0, 0} /*hsc */ + }, + { + GFX_VGA_MODE_720X576, + {720, 625, 720, 625, 625}, /*v_total */ + {129, 25, 129, 25, 25}, /*v_sync */ + {720, 720, 720, 720, 720}, /*iha */ + {0xaa, 0xaa, 0xaa, 0xaa, 0xaa}, /*iho */ + {0, 0, 0, 0, 0} /*hsc */ + }, + { + GFX_VGA_MODE_1024X768, + {933, 942, 933, 806, 806}, /*v_total */ + {121, 112, 121, 88, 88}, /*v_sync */ + {600, 600, 600, 600, 600}, /*iha */ + {0x3c, 0x23, 0x3c, 0x65, 0x65}, /*iho */ + {35, 26, 35, 26, 26} /*hsc */ + }, +}; + +/****/ +/*Houston fifo configuration constants.*/ +/****/ +struct _ffolat +{ + int v_total; + unsigned short ffolat; +}; + +struct _ffolativo +{ + int v_total; + unsigned short ivo; + unsigned short ffolat; +}; + +/*h_total=832, ivo=40, tv_width=858, tv_lines=525, vga_lines=480*/ +#define SIZE6X4NTSC 66 +static struct _ffolat ffo6x4ntsc[SIZE6X4NTSC + 1] = { + {541, 0x40}, {545, 0x40}, {549, 0x40}, {553, 0x40}, + {557, 0x58}, {561, 0x40}, {565, 0x40}, {569, 0x40}, + {573, 0x48}, {577, 0x40}, {581, 0x40}, {585, 0x40}, + {589, 0x40}, {593, 0x48}, {597, 0x40}, {601, 0x40}, + {605, 0x40}, {609, 0x40}, {613, 0x5b}, {617, 0x48}, + {621, 0x60}, {625, 0x48}, {629, 0x48}, {633, 0x40}, + {637, 0x5e}, {641, 0x40}, {645, 0x50}, {649, 0x56}, + {653, 0x58}, {657, 0x6c}, {661, 0x40}, {665, 0x40}, + {669, 0x40}, {673, 0x40}, {677, 0x40}, {681, 0x40}, + {685, 0x40}, {689, 0x40}, {693, 0x40}, {697, 0x40}, + {701, 0x40}, {705, 0x40}, {709, 0x40}, {713, 0x40}, + {717, 0x40}, {721, 0x40}, {725, 0x40}, {729, 0x40}, + {733, 0x40}, {737, 0x40}, {741, 0x40}, {745, 0x40}, + {749, 0x40}, {753, 0x40}, {757, 0x40}, {761, 0x40}, + {765, 0x40}, {769, 0x40}, {773, 0x40}, {777, 0x40}, + {781, 0x40}, {785, 0x40}, {789, 0x40}, {793, 0x40}, + {797, 0x30}, {801, 0x40}, + {-1, 0} +}; + +#define SIZE6X4PAL 45 +static struct _ffolat ffo6x4pal[SIZE6X4PAL + 1] = { + {625, 0x60}, {629, 0x60}, {633, 0x60}, {637, 0x60}, + {641, 0x50}, {645, 0x60}, {649, 0x60}, {653, 0x60}, + {657, 0x60}, {661, 0x60}, {665, 0x60}, {669, 0x60}, + {673, 0x60}, {677, 0x60}, {681, 0x60}, {685, 0x60}, + {689, 0x60}, {693, 0x60}, {697, 0x60}, {701, 0x60}, + {705, 0x60}, {709, 0x60}, {713, 0x60}, {717, 0x60}, + {721, 0x60}, {725, 0x60}, {729, 0x60}, {733, 0x60}, + {737, 0x60}, {741, 0x60}, {745, 0x60}, {749, 0x60}, + {753, 0x60}, {757, 0x60}, {761, 0x60}, {765, 0x60}, + {769, 0x60}, {773, 0x60}, {777, 0x60}, {781, 0x60}, + {785, 0x60}, {789, 0x60}, {793, 0x60}, {797, 0x60}, + {801, 0x60}, + {-1, 0} +}; + +#define SIZE7X4NTSC 40 +static struct _ffolat ffo7x4ntsc[SIZE7X4NTSC + 1] = { + {525, 0x52}, {529, 0x52}, {533, 0x52}, {537, 0x52}, + {541, 0x52}, {545, 0x40}, {549, 0x40}, {553, 0x40}, + {557, 0x58}, {561, 0x40}, {565, 0x58}, {569, 0x40}, + {573, 0x48}, {577, 0x40}, {581, 0x40}, {585, 0x40}, + {589, 0x40}, {593, 0x48}, {597, 0x40}, {601, 0x40}, + {605, 0x40}, {609, 0x40}, {613, 0x5b}, {617, 0x48}, + {621, 0x60}, {625, 0x48}, {629, 0x48}, {633, 0x40}, + {637, 0x5e}, {641, 0x40}, {645, 0x50}, {649, 0x56}, + {653, 0x58}, {657, 0x6c}, {661, 0x40}, {665, 0x40}, + {669, 0x40}, {673, 0x40}, {677, 0x40}, {681, 0x40}, + {-1, 0} +}; + +#define SIZE7X4PAL 24 +static struct _ffolat ffo7x4pal[SIZE7X4PAL + 1] = { + {625, 0x60}, {629, 0x60}, {633, 0x60}, {637, 0x60}, + {641, 0x50}, {645, 0x60}, {649, 0x60}, {653, 0x60}, + {657, 0x60}, {661, 0x60}, {665, 0x60}, {669, 0x60}, + {673, 0x60}, {677, 0x60}, {681, 0x60}, {685, 0x60}, + {689, 0x60}, {693, 0x60}, {697, 0x60}, {701, 0x60}, + {705, 0x60}, {709, 0x60}, {713, 0x60}, {717, 0x60}, + {-1, 0} +}; + +#define SIZE7X5NTSC 54 +static struct _ffolat ffo7x5ntsc[SIZE7X5NTSC + 1] = { + {590, 0x40}, {594, 0x48}, {598, 0x40}, {602, 0x40}, + {606, 0x40}, {610, 0x40}, {614, 0x5b}, {618, 0x48}, + {622, 0x60}, {626, 0x48}, {630, 0x48}, {634, 0x40}, + {638, 0x5e}, {642, 0x40}, {646, 0x50}, {650, 0x56}, + {654, 0x58}, {658, 0x6c}, {662, 0x40}, {666, 0x40}, + {670, 0x40}, {674, 0x40}, {678, 0x40}, {682, 0x40}, + {686, 0x40}, {690, 0x40}, {694, 0x40}, {698, 0x40}, + {702, 0x40}, {706, 0x40}, {710, 0x40}, {714, 0x40}, + {718, 0x40}, {722, 0x40}, {726, 0x40}, {730, 0x40}, + {734, 0x40}, {738, 0x40}, {742, 0x40}, {746, 0x40}, + {750, 0x40}, {754, 0x40}, {758, 0x40}, {762, 0x40}, + {766, 0x40}, {770, 0x40}, {774, 0x40}, {778, 0x40}, + {782, 0x40}, {786, 0x40}, {790, 0x40}, {794, 0x40}, + {798, 0x30}, {802, 0x40}, + {-1, 0} +}; + +#define SIZE7X5PAL 45 +static struct _ffolat ffo7x5pal[SIZE7X5PAL + 1] = { + {625, 0x60}, {629, 0x60}, {633, 0x60}, {637, 0x60}, + {641, 0x50}, {645, 0x60}, {649, 0x60}, {653, 0x60}, + {657, 0x60}, {661, 0x60}, {665, 0x60}, {669, 0x60}, + {673, 0x60}, {677, 0x60}, {681, 0x60}, {685, 0x60}, + {689, 0x60}, {693, 0x60}, {697, 0x60}, {701, 0x60}, + {705, 0x60}, {709, 0x60}, {713, 0x60}, {717, 0x60}, + {721, 0x60}, {725, 0x60}, {729, 0x60}, {733, 0x60}, + {737, 0x60}, {741, 0x60}, {745, 0x60}, {749, 0x60}, + {753, 0x60}, {757, 0x60}, {761, 0x60}, {765, 0x60}, + {769, 0x60}, {773, 0x60}, {777, 0x60}, {781, 0x60}, + {785, 0x60}, {789, 0x60}, {793, 0x60}, {797, 0x60}, + {801, 0x60}, + {-1, 0} +}; + +/*h_total=1056, vga_lines=600*/ +#define SIZE8X6NTSC 37 +static struct _ffolat ffo8x6ntsc[SIZE8X6NTSC + 1] = { + {620, 0x40}, /*v_total_min >= vsync+10 >= vga_lines+10 = 610 */ + {625, 0x58}, {630, 0x40}, {635, 0x40}, {640, 0x40}, + {645, 0x46}, {650, 0x46}, {655, 0x4f}, {660, 0x4c}, + {665, 0x4a}, {670, 0x50}, {675, 0x2f}, {680, 0x48}, + {685, 0x38}, {690, 0x31}, {695, 0x40}, {700, 0x21}, + {705, 0x25}, {710, 0x40}, {715, 0x48}, {720, 0x50}, + {725, 0x30}, {730, 0x50}, {735, 0x50}, {740, 0x50}, + {745, 0x40}, {750, 0x38}, {755, 0x50}, {760, 0x50}, + {765, 0x40}, {770, 0x38}, {775, 0x40}, {780, 0x40}, + {785, 0x40}, {790, 0x38}, {795, 0x50}, {800, 0x50}, + {-1, 0} +}; + +/*h_total=1056, vga_lines=600*/ +#define SIZE8X6PAL 36 +static struct _ffolat ffo8x6pal[SIZE8X6PAL + 1] = { + {625, 0x80}, {630, 0x80}, {635, 0x5a}, {640, 0x55}, + {645, 0x48}, {650, 0x65}, {655, 0x65}, {660, 0x50}, + {665, 0x80}, {670, 0x70}, {675, 0x56}, {680, 0x80}, + {685, 0x58}, {690, 0x31}, {695, 0x80}, {700, 0x60}, + {705, 0x45}, {710, 0x4a}, {715, 0x50}, {720, 0x50}, + {725, 0x50}, {730, 0x45}, {735, 0x50}, {740, 0x50}, + {745, 0x50}, {750, 0x50}, {755, 0x50}, {760, 0x50}, + {765, 0x50}, {770, 0x50}, {775, 0x50}, {780, 0x50}, + {785, 0x50}, {790, 0x50}, {795, 0x50}, {800, 0x50}, + {-1, 0} +}; + +/*h_total=1344, vga_lines=768*/ +#define SIZE10X7NTSC 45 +static struct _ffolativo ffo10x7ntsc[SIZE10X7NTSC] = { + {783, 0x4d, 0x40}, + {789, 0x47, 0x14}, + {795, 0x47, 0x7f}, + {801, 0x47, 0x53}, + {807, 0x47, 0x11}, + {813, 0x47, 0x78}, + {819, 0x47, 0x54}, + {825, 0x47, 0x40}, + {831, 0x47, 0x0f}, + {837, 0x4d, 0x40}, + {843, 0x47, 0x5a}, + {849, 0x4d, 0x40}, + {855, 0x47, 0x4b}, + {861, 0x4d, 0x40}, + {867, 0x47, 0x4b}, + {873, 0x4d, 0x40}, + {879, 0x47, 0x07}, + {885, 0x48, 0x20}, + {891, 0x47, 0x82}, + {897, 0x47, 0x60}, + {903, 0x47, 0x7f}, + {909, 0x4d, 0x40}, + {915, 0x48, 0x40}, + {921, 0x4c, 0x40}, + {927, 0x49, 0x40}, + {933, 0x48, 0x40}, + {939, 0x4a, 0x40}, + {945, 0x46, 0x40}, + {951, 0x4a, 0x40}, + {957, 0x4a, 0x40}, + {963, 0x4b, 0x40}, + {969, 0x4b, 0x40}, + {975, 0x48, 0x40}, + {981, 0x47, 0x40}, + {987, 0x47, 0x40}, + {993, 0x47, 0x40}, + {999, 0x48, 0x40}, + {1005, 0x48, 0x40}, + {1011, 0x47, 0x40}, + {1017, 0x47, 0x40}, + {1023, 0x48, 0x40}, + {1029, 0x48, 0x40}, + {1035, 0x46, 0x40}, + {1041, 0x47, 0x40}, + {1047, 0x47, 0x40} +}; + +/*h_total=1344, vga_lines=768*/ +#define SIZE10X7PAL 46 +static struct _ffolativo ffo10x7pal[SIZE10X7PAL] = { + {781, 0x49, 0x40}, + {787, 0x46, 0x40}, + {793, 0x48, 0x40}, + {799, 0x46, 0x40}, + {805, 0x49, 0x40}, + {811, 0x47, 0x40}, + {817, 0x46, 0x40}, + {823, 0x46, 0x56}, + {829, 0x46, 0x2d}, + {835, 0x46, 0x40}, + {841, 0x46, 0x2d}, + {847, 0x46, 0x3f}, + {853, 0x46, 0x10}, + {859, 0x46, 0x86}, + {865, 0x46, 0xc9}, + {871, 0x46, 0x83}, + {877, 0x46, 0xa8}, + {883, 0x46, 0x81}, + {889, 0x46, 0xa5}, + {895, 0x46, 0xa9}, + {901, 0x46, 0x81}, + {907, 0x46, 0xa4}, + {913, 0x46, 0xa5}, + {919, 0x46, 0x7f}, + {925, 0x46, 0xa2}, + {931, 0x46, 0x9d}, + {937, 0x46, 0xc1}, + {943, 0x46, 0x96}, + {949, 0x46, 0xb7}, + {955, 0x46, 0xb1}, + {961, 0x46, 0x8a}, + {967, 0x46, 0xa9}, + {973, 0x46, 0xa0}, + {979, 0x46, 0x40}, + {985, 0x46, 0x97}, + {991, 0x46, 0xb5}, + {997, 0x46, 0xaa}, + {1003, 0x46, 0x83}, + {1009, 0x46, 0x9f}, + {1015, 0x47, 0x40}, + {1021, 0x46, 0xad}, + {1027, 0x46, 0x87}, + {1033, 0x46, 0xa2}, + {1039, 0x47, 0x40}, + {1045, 0x46, 0xac}, + {1051, 0x46, 0x86} +}; + +/*//==========================================================================*/ +/****/ +/*FS450 API Functions.*/ +/****/ +/*//==========================================================================*/ + +/****/ +/*Initialize device settings*/ +/****/ +static void +initialize_houston_static_registers(void) +{ + houston_WriteReg(HOUSTON_BYP, 0, 2); + houston_WriteReg(HOUSTON_APO, 0, 2); + houston_WriteReg(HOUSTON_ALO, 0, 2); + houston_WriteReg(HOUSTON_AFO, 0, 2); + houston_WriteReg(HOUSTON_BCONTL, 0, 2); + houston_WriteReg(HOUSTON_BCONTH, 0, 2); + houston_WriteReg(HOUSTON_BDONE, 0, 2); + houston_WriteReg(HOUSTON_BDIAGL, 0, 2); + houston_WriteReg(HOUSTON_BDIAGH, 0, 2); + houston_WriteReg(HOUSTON_MISC, 0, 2); +} + +int +FS450_init(void) +{ + int err; + + TRACE(("FS450_Init()\n")) + + err = houston_init(); + if (err) + return err; + + initialize_houston_static_registers(); + +#if 1 + d.tv_on = PLAL_IsTVOn()? 1 : 0; +#else + d.tv_on = 0; +#endif + +#if 1 + /*get the current tv standard */ + conget_tv_std(&d.tv_std); +#else + /*default to VP_TV_STANDARD_NTSC_M */ + d.tv_std = VP_TV_STANDARD_NTSC_M; + config_tv_std(d.tv_std); +#endif + + d.vga_mode = 0; + +#if 0 + /*get the current tvout mode */ + conget_tvout_mode(&d.tvout_mode); +#else + /*default to VP_TVOUT_MODE_CVBS_YC */ + d.tvout_mode = GFX_TVOUT_MODE_CVBS_YC; +#endif + +#if 0 + /*get the current sharpness */ + conget_sharpness(d.sharpness); +#else + /*default to 1000 out of 1000 */ + d.sharpness = 1000; + config_sharpness(d.sharpness); +#endif + +#if 0 + /*get the current flicker */ + conget_flicker(d.flicker); +#else + /*default to 800 out of 1000 */ + d.flicker = 800; + config_flicker(d.flicker); +#endif + +#if 0 + /*get the current size and position */ +#else + /*default to zeros */ + d.overscan_x = 0; + d.overscan_y = 0; + d.position_x = 0; + d.position_y = 0; +#endif + +#if 0 + /*get the current color */ + conget_color(d.color); +#else + d.color = 50; + /*//d.color = tvsetup.color[k]; */ + config_color(d.color); +#endif + +#if 0 + /*get the current brightness and contrast */ + conget_brightness_contrast(d.tv_std, d.aps_trigger_bits, d.brightness, + d.contrast); +#else + /*default */ + d.brightness = 50; + d.contrast = 60; + config_brightness_contrast(d.tv_std, d.aps_trigger_bits, d.brightness, + d.contrast); +#endif + +#if 1 + /*get the current yc filtering */ + { + int luma_filter, chroma_filter; + + conget_yc_filter(&luma_filter, &chroma_filter); + d.yc_filter = 0; + if (luma_filter) + d.yc_filter |= GFX_LUMA_FILTER; + if (chroma_filter) + d.yc_filter |= GFX_CHROMA_FILTER; + } +#else + /*default */ + d.yc_filter = GFX_LUMA_FILTER + GFX_CHROMA_FILTER; +#endif + +#if 0 + /*get the current cp settings */ + conget_macrovision(d.tv_std, &d.aps_trigger_bits); +#else + d.aps_trigger_bits = 0; + config_macrovision(d.tv_std, d.aps_trigger_bits); +#endif + + d.last_overscan_y = -10000; + + return 0; +} + +void +FS450_cleanup(void) +{ +} + +/*//==========================================================================*/ +/****/ +/*// Required configuration calls to write new settings to the device*/ + +#define REQ_TV_STANDARD_BIT 0x0002 +#define REQ_VGA_MODE_BIT 0x0004 +#define REQ_TVOUT_MODE_BIT 0x0008 +#define REQ_SHARPNESS_BIT 0x0010 +#define REQ_FLICKER_BIT 0x0020 +#define REQ_OVERSCAN_POSITION_BIT 0x0040 +#define REQ_COLOR_BIT 0x0080 +#define REQ_BRIGHTNESS_CONTRAST_BIT 0x0100 +#define REQ_YC_FILTER_BIT 0x0200 +#define REQ_MACROVISION_BIT 0x0400 +#define REQ_NCO_BIT 0x1000 + +#define REQ_TV_STANDARD (REQ_TV_STANDARD_BIT | REQ_OVERSCAN_POSITION | REQ_BRIGHTNESS_CONTRAST | REQ_MACROVISION_BIT | REQ_YC_FILTER) +#define REQ_VGA_MODE (REQ_VGA_MODE_BIT | REQ_OVERSCAN_POSITION) +#define REQ_TVOUT_MODE (REQ_TVOUT_MODE_BIT) +#define REQ_SHARPNESS (REQ_SHARPNESS_BIT) +#define REQ_FLICKER (REQ_FLICKER_BIT) +#define REQ_OVERSCAN_POSITION (REQ_OVERSCAN_POSITION_BIT | REQ_NCO) +#define REQ_COLOR (REQ_COLOR_BIT) +#define REQ_BRIGHTNESS_CONTRAST (REQ_BRIGHTNESS_CONTRAST_BIT) +#define REQ_YC_FILTER (REQ_YC_FILTER_BIT) +#define REQ_MACROVISION (REQ_TV_STANDARD_BIT | REQ_BRIGHTNESS_CONTRAST_BIT | REQ_MACROVISION_BIT) +#define REQ_NCO (REQ_NCO_BIT) +#define REQ_ENCODER (REQ_TV_STANDARD | REQ_COLOR | REQ_BRIGHTNESS_CONTRAST | REQ_YC_FILTER) + +static int +write_config(int req) +{ + unsigned long reg, reg_encoder_reset = 0; + int reset; + + /*if we're changing the nco, and the vertical scaling has changed... */ + reset = ((REQ_NCO_BIT & req) && (d.overscan_y != d.last_overscan_y)); + if (reset) { + /*put the encoder into reset while making changes */ + houston_ReadReg(ENC_RESET, ®, 1); + houston_WriteReg(ENC_RESET, reg | 0x01, 1); + reg_encoder_reset = reg & 0x01; + } + + if (REQ_TV_STANDARD_BIT & req) + config_tv_std(d.tv_std, d.aps_trigger_bits); + + if (REQ_VGA_MODE_BIT & req) + config_vga_mode(d.vga_mode); + + if (REQ_TVOUT_MODE_BIT & req) + config_tvout_mode(d.tvout_mode); + + if (REQ_OVERSCAN_POSITION_BIT & req) { + config_overscan_xy(d.tv_std, + d.vga_mode, + d.overscan_x, + d.overscan_y, d.position_x, d.position_y); + + /*h_timing and v_timing and syncs. */ + if (PLAL_IsTVOn()) + PLAL_SetTVTimingRegisters(p_specs()); + } + + if (REQ_NCO_BIT & req) + config_nco(d.tv_std, d.vga_mode); + + if (REQ_SHARPNESS_BIT & req) + config_sharpness(d.sharpness); + + if (REQ_FLICKER_BIT & req) + config_flicker(d.flicker); + + if (REQ_COLOR_BIT & req) + config_color(d.color); + + if (REQ_BRIGHTNESS_CONTRAST_BIT & req) { + config_brightness_contrast(d.tv_std, + d.aps_trigger_bits, + d.brightness, d.contrast); + } + + if (REQ_YC_FILTER_BIT & req) { + config_yc_filter(d.tv_std, + (d.yc_filter & GFX_LUMA_FILTER), + (d.yc_filter & GFX_CHROMA_FILTER)); + } + + if (REQ_MACROVISION_BIT & req) + config_macrovision(d.tv_std, d.aps_trigger_bits); + + /*if we decided to put the encoder into reset, put it back */ + if (reset) { + houston_ReadReg(ENC_RESET, ®, 1); + houston_WriteReg(ENC_RESET, reg_encoder_reset | (reg & ~0x01), 1); + + d.last_overscan_y = d.overscan_y; + } + return 0; +} + +/*==========================================================================*/ +/****/ +/*// TV On*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tv_enable(unsigned int *p_on) +#else +int +gfx_get_tv_enable(unsigned int *p_on) +#endif +{ + if (!p_on) + return ERR_INVALID_PARAMETER; + + *p_on = d.tv_on; + + return 0; +} + +/*//int FS450_set_tv_on(unsigned int on)*/ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_enable(int on) +#else +int +gfx_set_tv_enable(int on) +#endif +{ + unsigned long reg; + + /*if not mode change, just return */ + if ((d.tv_on && on) || (!d.tv_on && !on)) + return 0; + + /*if turning off... */ + if (!on) { + /*reenable vga. */ + PLAL_EnableVga(); + + /*power down houston */ + config_power(0); + + d.tv_on = 0; + + return 0; + } + + /*turning on... */ + + /*power up houston */ + config_power(1); + + /*assert encoder reset. */ + houston_WriteReg(ENC_RESET, 0x01, 1); + + /*initial platform preparation */ + PLAL_PrepForTVout(); + + /*configure encoder and nco. */ + write_config(REQ_VGA_MODE | + REQ_TV_STANDARD | + REQ_TVOUT_MODE | + REQ_OVERSCAN_POSITION | REQ_YC_FILTER | REQ_MACROVISION); + + /*set LP_EN and UIM */ + houston_ReadReg(HOUSTON_CR, ®, 2); + reg |= CR_LP_EN; + reg &= ~(CR_UIM_MOD0 | CR_UIM_MOD1); + reg |= (PLAL_FS450_UIM_mode() << 14); + houston_WriteReg(HOUSTON_CR, reg, 2); + + /*set platform timing registers */ + PLAL_SetTVTimingRegisters(p_specs()); + + PLAL_FinalEnableTVout(d.vga_mode); + + /*sync bridge */ + { + int retry_count = 0; + + /*sync 50 times */ + while (retry_count++ < 50) { + /*sync bridge. */ + houston_ReadReg(HOUSTON_MISC, ®, 2); + reg |= MISC_BRIDGE_SYNC; + houston_WriteReg(HOUSTON_MISC, reg, 2); + reg &= ~MISC_BRIDGE_SYNC; + houston_WriteReg(HOUSTON_MISC, reg, 2); + } + } + + /*deassert encoder reset. */ + houston_WriteReg(ENC_RESET, 0x00, 1); + + d.tv_on = 1; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tv_defaults(int format) +#else +int +gfx_set_tv_defaults(int format) +#endif +{ + return 0; +} + +/*==========================================================================*/ +/****/ +/*// TV standard*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tv_standard(unsigned long *p_standard) +#else +int +gfx_get_tv_standard(unsigned long *p_standard) +#endif +{ + if (!p_standard) + return ERR_INVALID_PARAMETER; + + *p_standard = d.tv_std; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_get_available_tv_standards(unsigned long *p_standards) +#else +int +gfx_get_available_tv_standards(unsigned long *p_standards) +#endif +{ + if (!p_standards) + return ERR_INVALID_PARAMETER; + + *p_standards = supported_standards(); + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tv_standard(unsigned long standard) +#else +int +gfx_set_tv_standard(unsigned long standard) +#endif +{ + /*verify supported standard. */ + if (!(standard & supported_standards())) + return ERR_INVALID_PARAMETER; + + /*disallow if tv is on */ + if (d.tv_on) + return ERR_CANNOT_CHANGE_WHILE_TV_ON; + + d.tv_std = standard; +/*// d.color = tvsetup.color[k];*/ + + return write_config(REQ_TV_STANDARD); +} + +/*==========================================================================*/ +/****/ +/*// vga mode as known by the driver*/ +#if GFX_TV_DYNAMIC +int +fs450_get_tv_vga_mode(unsigned long *p_vga_mode) +#else +int +gfx_get_tv_vga_mode(unsigned long *p_vga_mode) +#endif +{ + if (!p_vga_mode) + return ERR_INVALID_PARAMETER; + + *p_vga_mode = d.vga_mode; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_get_available_tv_vga_modes(unsigned long *p_vga_modes) +#else +int +gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes) +#endif +{ + if (!p_vga_modes) + return ERR_INVALID_PARAMETER; + + *p_vga_modes = + GFX_VGA_MODE_640X480 | + GFX_VGA_MODE_720X487 | GFX_VGA_MODE_720X576 | GFX_VGA_MODE_800X600; + if (houston_Rev() >= HOUSTON_REV_B) + *p_vga_modes |= GFX_VGA_MODE_1024X768; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tv_vga_mode(unsigned long vga_mode) +#else +int +gfx_set_tv_vga_mode(unsigned long vga_mode) +#endif +{ + /*reject if not a single valid VGA mode */ + switch (vga_mode) { + default: + return ERR_INVALID_PARAMETER; + + case GFX_VGA_MODE_640X480: + case GFX_VGA_MODE_720X487: + case GFX_VGA_MODE_720X576: + case GFX_VGA_MODE_800X600: + break; + + case GFX_VGA_MODE_1024X768: + if (houston_Rev() >= HOUSTON_REV_B) + break; + return ERR_INVALID_PARAMETER; + } + + /*if the mode has changed... */ + if (vga_mode != d.vga_mode) { + d.vga_mode = vga_mode; + + return write_config(REQ_VGA_MODE); + } + + return 0; +} + +/*==========================================================================*/ +/****/ +/*// tvout mode*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tvout_mode(unsigned long *p_tvout_mode) +#else +int +gfx_get_tvout_mode(unsigned long *p_tvout_mode) +#endif +{ + if (!p_tvout_mode) + return ERR_INVALID_PARAMETER; + + *p_tvout_mode = d.tvout_mode; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tvout_mode(unsigned long tvout_mode) +#else +int +gfx_set_tvout_mode(unsigned long tvout_mode) +#endif +{ + d.tvout_mode = tvout_mode; + + return write_config(REQ_TVOUT_MODE); +} + +/*==========================================================================*/ +/****/ +/*// Sharpness*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_sharpness(int *p_sharpness) +#else +int +gfx_get_sharpness(int *p_sharpness) +#endif +{ + if (!p_sharpness) + return ERR_INVALID_PARAMETER; + + *p_sharpness = d.sharpness; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_sharpness(int sharpness) +#else +int +gfx_set_sharpness(int sharpness) +#endif +{ + d.sharpness = range_limit(sharpness, 0, 1000); + + return write_config(REQ_SHARPNESS); +} + +/*==========================================================================*/ +/****/ +/*flicker filter control.*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_flicker_filter(int *p_flicker) +#else +int +gfx_get_flicker_filter(int *p_flicker) +#endif +{ + if (!p_flicker) + return ERR_INVALID_PARAMETER; + + *p_flicker = d.flicker; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_flicker_filter(int flicker) +#else +int +gfx_set_flicker_filter(int flicker) +#endif +{ + d.flicker = range_limit(flicker, 0, 1000); + + return write_config(REQ_FLICKER); +} + +/*==========================================================================*/ +/****/ +/*// Overscan and Position*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_overscan(int *p_x, int *p_y) +#else +int +gfx_get_overscan(int *p_x, int *p_y) +#endif +{ + if (!p_x || !p_y) + return ERR_INVALID_PARAMETER; + + *p_x = d.overscan_x; + *p_y = d.overscan_y; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_overscan(int x, int y) +#else +int +gfx_set_overscan(int x, int y) +#endif +{ + d.overscan_x = range_limit(x, -1000, 1000); + d.overscan_y = range_limit(y, -1000, 1000); + + return write_config(REQ_OVERSCAN_POSITION); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_position(int *p_x, int *p_y) +#else +int +gfx_get_position(int *p_x, int *p_y) +#endif +{ + if (!p_x || !p_y) + return ERR_INVALID_PARAMETER; + + *p_x = d.position_x; + *p_y = d.position_y; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_position(int x, int y) +#else +int +gfx_set_position(int x, int y) +#endif +{ + d.position_x = range_limit(x, -1000, 1000); + d.position_y = range_limit(y, -1000, 1000); + + return write_config(REQ_OVERSCAN_POSITION); +} + +/*==========================================================================*/ +/****/ +/*// Color, Brightness, and Contrast*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_color(int *p_color) +#else +int +gfx_get_color(int *p_color) +#endif +{ + if (!p_color) + return ERR_INVALID_PARAMETER; + + *p_color = d.color; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_color(int color) +#else +int +gfx_set_color(int color) +#endif +{ + d.color = range_limit(color, 0, 100); + + return write_config(REQ_COLOR); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_brightness(int *p_brightness) +#else +int +gfx_get_brightness(int *p_brightness) +#endif +{ + if (!p_brightness) + return ERR_INVALID_PARAMETER; + + *p_brightness = d.brightness; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_brightness(int brightness) +#else +int +gfx_set_brightness(int brightness) +#endif +{ + d.brightness = range_limit(brightness, 0, 100); + + return write_config(REQ_BRIGHTNESS_CONTRAST); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_contrast(int *p_contrast) +#else +int +gfx_get_contrast(int *p_contrast) +#endif +{ + if (!p_contrast) + return ERR_INVALID_PARAMETER; + + *p_contrast = d.contrast; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_contrast(int constrast) +#else +int +gfx_set_contrast(int constrast) +#endif +{ + d.contrast = range_limit(constrast, 0, 100); + + return write_config(REQ_BRIGHTNESS_CONTRAST); +} + +/*==========================================================================*/ +/****/ +/*// YC filters*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_yc_filter(unsigned int *p_yc_filter) +#else +int +gfx_get_yc_filter(unsigned int *p_yc_filter) +#endif +{ + if (!p_yc_filter) + return ERR_INVALID_PARAMETER; + + if (houston_Rev() < HOUSTON_REV_B) + return ERR_NOT_SUPPORTED; + + *p_yc_filter = d.yc_filter; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_yc_filter(unsigned int yc_filter) +#else +int +gfx_set_yc_filter(unsigned int yc_filter) +#endif +{ + if (houston_Rev() < HOUSTON_REV_B) + return ERR_NOT_SUPPORTED; + + /*luma filter. */ + if (yc_filter & GFX_LUMA_FILTER) + d.yc_filter |= GFX_LUMA_FILTER; + else + d.yc_filter &= ~GFX_LUMA_FILTER; + + /*chroma filter. */ + if (yc_filter & GFX_CHROMA_FILTER) + d.yc_filter |= GFX_CHROMA_FILTER; + else + d.yc_filter &= ~GFX_CHROMA_FILTER; + + return write_config(REQ_YC_FILTER); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_aps_trigger_bits(unsigned int *p_trigger_bits) +#else +int +gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits) +#endif +{ + if (!p_trigger_bits) + return ERR_INVALID_PARAMETER; + + *p_trigger_bits = d.aps_trigger_bits; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_aps_trigger_bits(unsigned int trigger_bits) +#else +int +gfx_set_aps_trigger_bits(unsigned int trigger_bits) +#endif +{ + d.aps_trigger_bits = trigger_bits; + + return write_config(REQ_MACROVISION); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_format + * + * This routine sets the TV encoder registers to the specified format + * and resolution. + * Currently only NTSC 640x480 is supported. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#else +int +gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_output + * + * This routine sets the TV encoder registers to the specified output type. + * Supported output types are : S-VIDEO and Composite. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_output(int output) +#else +int +gfx_set_tv_output(int output) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + * + * This routine enables or disables the use of the hardware CC registers + * in the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_cc_enable(int enable) +#else +int +gfx_set_tv_cc_enable(int enable) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_cc_data(unsigned char data1, unsigned char data2) +#else +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +#ifdef FS450_DIRECTREG + +/*//==========================================================================*/ +/****/ +/*// Direct Read and Write registers*/ + +int +FS450_ReadRegister(S_REG_INFO * p_reg) +{ + unsigned long tmp; + + if (PLAL_ReadRegister(p_reg)) + return 0; + + if (SOURCE_HOUSTON == p_reg->source) { + switch (p_reg->size) { + case 1: + case 2: + { + houston_ReadReg((int)p_reg->offset, &tmp, (int)p_reg->size); + p_reg->value = tmp; + } + return 0; + + case 4: + { + houston_ReadReg((unsigned int)p_reg->offset, &tmp, 2); + p_reg->value = (tmp << 16); + houston_ReadReg((unsigned int)(p_reg->offset + 2), &tmp, 2); + p_reg->value |= tmp; + } + return 0; + } + } + + return ERR_INVALID_PARAMETER; +} + +int +FS450_WriteRegister(S_REG_INFO * p_reg) +{ + if (PLAL_WriteRegister(p_reg)) + return 0; + + if (SOURCE_HOUSTON == p_reg->source) { + houston_WriteReg((unsigned int)p_reg->offset, p_reg->value, + p_reg->size); + + return 0; + } + + return ERR_INVALID_PARAMETER; +} + +#endif + +/****/ +/*Houston initialization function.*/ +/****/ +static int g_houston_rev = -1; + +static int +houston_init(void) +{ + /*//int errc; */ + unsigned long write, read; + + TRACE(("houston_init()\n")) + + /*initialize I2C */ + /*errc = I2C_init(); + * if (errc) + * return errc; + */ + /*Before we begin, we must enable power to the TFT */ + read = READ_VID32(CS5530_DISPLAY_CONFIG); + read |= CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN; + WRITE_VID32(CS5530_DISPLAY_CONFIG, read); + + /*simple w/r test. */ + write = 0x0055; + read = 0; + + houston_WriteReg(HOUSTON_IHO, write, 2); + houston_ReadReg(HOUSTON_IHO, &read, 2); + if (read != write) { + houston_WriteReg(HOUSTON_IHO, write, 2); + houston_ReadReg(HOUSTON_IHO, &read, 2); + if (read != write) { + /*chip is not there, do something appropriate? */ + TRACE(("wrote HOUSTON_IHO=0x0055, read 0x%04x\n", read)) + return ERR_DEVICE_NOT_FOUND; + } + } + + /*read chip revision. */ + houston_ReadReg(HOUSTON_REV, &read, 2); + g_houston_rev = (int)read; + + /*ok. */ + return 0; +} + +static int +houston_Rev(void) +{ + return g_houston_rev; +} + +static S_TIMING_SPECS g_specs; + +static const S_TIMING_SPECS * +p_specs(void) +{ + return &g_specs; +} + +/*//==========================================================================*/ +/****/ +/*FS450 configuration functions.*/ +/****/ +/*//==========================================================================*/ +static int +config_init(void) +{ + int err; + + TRACE(("config_init()\n")) + + err = houston_init(); + if (err) + return err; + + return 0; +} + +/*==========================================================================*/ +/****/ +/*convert word to encoder 10 bit value.*/ + +static unsigned short +w10bit2z(unsigned short w) +{ + return (w >> 2) | ((w & 0x03) << 8); +} + +static unsigned short +z2w10bit(unsigned short z) +{ + return (0x03 & (z >> 8)) | ((0xFF & z) << 2); +} + +/*==========================================================================*/ +/****/ +/*// TV Standards*/ + +static const struct +{ + unsigned long standard; + int tvsetup_index; +} +g_tv_standards[] = +{ + { + GFX_TV_STANDARD_NTSC_M, 0} + , { + GFX_TV_STANDARD_NTSC_M_J, 2} + , { + GFX_TV_STANDARD_PAL_B, 1} + , { + GFX_TV_STANDARD_PAL_D, 1} + , { + GFX_TV_STANDARD_PAL_H, 1} + , { + GFX_TV_STANDARD_PAL_I, 1} + , { + GFX_TV_STANDARD_PAL_M, 3} + , { + GFX_TV_STANDARD_PAL_N, 4} + , { + GFX_TV_STANDARD_PAL_G, 1} +,}; + +static int +map_tvstd_to_index(unsigned long tv_std) +{ + unsigned int i; + + for (i = 0; i < sizeof(g_tv_standards) / sizeof(*g_tv_standards); i++) { + if (tv_std == g_tv_standards[i].standard) + return g_tv_standards[i].tvsetup_index; + } + + return -1; +} + +static unsigned long +supported_standards(void) +{ + unsigned long standards = 0; + unsigned int i; + + for (i = 0; i < sizeof(g_tv_standards) / sizeof(*g_tv_standards); i++) { + if (g_tv_standards[i].tvsetup_index >= 0) + standards |= g_tv_standards[i].standard; + } + + return standards; +} + +/*==========================================================================*/ + +static void +config_power(int on) +{ + unsigned long reg; + + if (houston_Rev() < HOUSTON_REV_B) { + /*no power down supported, but still turn of clock in off mode */ + if (on) { + houston_ReadReg(HOUSTON_CR, ®, 2); + reg &= ~(CR_CLKOFF | CR_RESET); + houston_WriteReg(HOUSTON_CR, reg, 2); + reg |= CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + reg &= ~CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + } else { + houston_ReadReg(HOUSTON_CR, ®, 2); + reg |= CR_CLKOFF; + houston_WriteReg(HOUSTON_CR, reg, 2); + } + + return; + } + + if (on) { + /*!CLKOFF, !COMPOFF, !YCOFF */ + /*and reset Houston */ + houston_ReadReg(HOUSTON_CR, ®, 2); + reg &= ~(CR_CLKOFF | CR_RESET | CR_COMPOFF | CR_YCOFF); + houston_WriteReg(HOUSTON_CR, reg, 2); + reg |= CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + reg &= ~CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + + /*!GTLIO_PD */ + houston_ReadReg(HOUSTON_MISC, ®, 2); + reg &= ~MISC_GTLIO_PD; + houston_WriteReg(HOUSTON_MISC, reg, 2); + } else { + /*CLKOFF, COMPOFF, YCOFF */ + houston_ReadReg(HOUSTON_CR, ®, 2); + reg |= (CR_CLKOFF | CR_COMPOFF | CR_YCOFF); + houston_WriteReg(HOUSTON_CR, reg, 2); + + /*GTLIO_PD */ + houston_ReadReg(HOUSTON_MISC, ®, 2); + reg |= MISC_GTLIO_PD; + houston_WriteReg(HOUSTON_MISC, reg, 2); + } +} + +/*==========================================================================*/ +/****/ +/*// VGA mode*/ + +static void +config_vga_mode(unsigned long vga_mode) +{ + /*h_total must be evenly divisible by 32? */ + + static struct + { + unsigned long mode; + int width; + int lines; + int h_total; + } + vgaparams[] = + { + { + GFX_VGA_MODE_640X480, 640, 480, 1056} + , { + GFX_VGA_MODE_720X487, 720, 487, 1056} + , { + GFX_VGA_MODE_720X576, 720, 576, 1056} + , { + GFX_VGA_MODE_800X600, 800, 600, 1056} + , { + GFX_VGA_MODE_1024X768, 1024, 768, 1344} + ,}; + + unsigned long cr, misc, byp; + unsigned int i; + + g_specs.vga_width = 0; + g_specs.vga_lines = 0; + g_specs.h_total = 0; + + for (i = 0; i < sizeof(vgaparams) / sizeof(*vgaparams); i++) { + if (vga_mode == vgaparams[i].mode) { + g_specs.vga_width = vgaparams[i].width; + g_specs.vga_lines = vgaparams[i].lines; + g_specs.h_total = vgaparams[i].h_total; + break; + } + } + if (!g_specs.h_total) + return; + + /*clock mux decimator and vga dual. */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + houston_ReadReg(HOUSTON_MISC, &misc, 2); + houston_ReadReg(HOUSTON_BYP, &byp, 2); + + if (vga_mode == GFX_VGA_MODE_1024X768) { + /*XGA*/ cr |= CR_UIM_DEC; + misc |= MISC_VGACKDIV; + byp |= (BYP_HDS_BYPASS | BYP_CAC_BYPASS); + } else { + /*VGA,SVGA */ + cr &= ~CR_UIM_DEC; + misc &= ~MISC_VGACKDIV; + byp &= ~(BYP_HDS_BYPASS | BYP_CAC_BYPASS); + } + + houston_WriteReg(HOUSTON_CR, cr, 2); + houston_WriteReg(HOUSTON_MISC, misc, 2); + houston_WriteReg(HOUSTON_BYP, byp, 2); +} + +/*==========================================================================*/ +/****/ +/*// Write settings for TV standard to device*/ + +static void +config_tv_std(unsigned long tv_std, unsigned int trigger_bits) +{ + int k; + unsigned short reg34; + unsigned long cr, w; + unsigned long l; + + /*verify supported standard. */ + k = map_tvstd_to_index(tv_std); + if (k < 0) + return; + + /*store tv width and lines */ + g_specs.tv_width = tvsetup.tv_width[k]; + g_specs.tv_lines = tvsetup.tv_lines[k]; + + /*houston CR register. */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + cr &= ~CR_656_PAL_NTSC; + cr |= tvsetup.houston_cr[k]; + houston_WriteReg(HOUSTON_CR, cr, 2); + + /*setup the encoder. */ + l = tvsetup.chroma_freq[k]; + houston_WriteReg(ENC_CHROMA_FREQ, (int)(l & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 1, (int)((l >> 8) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 2, (int)((l >> 16) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 3, (int)((l >> 24) & 0x00ff), 1); + + houston_WriteReg(ENC_CHROMA_PHASE, tvsetup.chroma_phase[k], 1); + houston_WriteReg(ENC_REG05, 0x00, 1); /*reg 0x05 */ + houston_WriteReg(ENC_REG06, 0x89, 1); /*reg 0x06 */ + houston_WriteReg(ENC_REG07, 0x00, 1); /*reg 0x07 */ + houston_WriteReg(ENC_HSYNC_WIDTH, tvsetup.hsync_width[k], 1); + houston_WriteReg(ENC_BURST_WIDTH, tvsetup.burst_width[k], 1); + houston_WriteReg(ENC_BACK_PORCH, tvsetup.back_porch[k], 1); + houston_WriteReg(ENC_CB_BURST_LEVEL, tvsetup.cb_burst_level[k], 1); + houston_WriteReg(ENC_CR_BURST_LEVEL, tvsetup.cr_burst_level[k], 1); + houston_WriteReg(ENC_SLAVE_MODE, 0x01, 1); /*slave mode */ + if (trigger_bits == 0) + w = w10bit2z(tvsetup.blank_level[k]); /*blank level */ + else + w = w10bit2z((unsigned short)(tvsetup.blank_level[k] - + tvsetup.hamp_offset[k])); + houston_WriteReg(ENC_BLANK_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_BLANK_LEVEL + 1, w >> 8, 1); + w = w10bit2z(tvsetup.tv_lines[k]); /*num_lines */ + houston_WriteReg(ENC_NUM_LINES, w & 0x00ff, 1); + houston_WriteReg(ENC_NUM_LINES + 1, w >> 8, 1); + + houston_WriteReg(ENC_TINT, 0x00, 1); /*tint */ + houston_WriteReg(ENC_BREEZE_WAY, tvsetup.breeze_way[k], 1); + houston_WriteReg(ENC_FRONT_PORCH, tvsetup.front_porch[k], 1); + houston_WriteReg(ENC_ACTIVELINE, tvsetup.activeline[k], 1); + houston_WriteReg(ENC_FIRST_LINE, 0x15, 1); /*firstvideoline */ + reg34 = + 0x80 | + (tvsetup.pal_mode[k] << 6) | + (tvsetup.sys625_50[k] << 3) | + (tvsetup.cphase_rst[k] << 1) | (tvsetup.vsync5[k]); + houston_WriteReg(ENC_REG34, reg34, 1); /*reg 0x34 */ + houston_WriteReg(ENC_SYNC_LEVEL, tvsetup.sync_level[k], 1); + if (trigger_bits == 0) + w = w10bit2z(tvsetup.vbi_blank_level[k]); /*blank level */ + else + w = w10bit2z((unsigned short)(tvsetup.vbi_blank_level[k] - 1)); + houston_WriteReg(ENC_VBI_BLANK_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_VBI_BLANK_LEVEL + 1, w >> 8, 1); +} + +static void +conget_tv_std(unsigned long *p_tv_standard) +{ + unsigned long cr; + + if (!p_tv_standard) + return; + + /*just pick between NTSC and PAL */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + if (CR_656_PAL_NTSC & cr) + *p_tv_standard = GFX_TV_STANDARD_PAL_B; + else + *p_tv_standard = GFX_TV_STANDARD_NTSC_M; +} + +/*==========================================================================*/ +/****/ +/*// TVout mode*/ + +static void +config_tvout_mode(unsigned long tvout_mode) +{ + unsigned long cr; + + houston_ReadReg(HOUSTON_CR, &cr, 2); + + /*all dacs off */ + cr |= (CR_COMPOFF | CR_YCOFF); + /*not rgb */ + cr &= ~CR_OFMT; + + /*turn on requested output */ + if (GFX_TVOUT_MODE_CVBS & tvout_mode) + cr &= ~CR_COMPOFF; + if (GFX_TVOUT_MODE_YC & tvout_mode) + cr &= ~CR_YCOFF; + if (GFX_TVOUT_MODE_RGB & tvout_mode) { + cr &= ~(CR_COMPOFF | CR_YCOFF); + cr |= CR_OFMT; + } + + houston_WriteReg(HOUSTON_CR, cr, 2); +} + +static void +conget_tvout_mode(unsigned long *p_tvout_mode) +{ + unsigned long cr; + + if (!p_tvout_mode) + return; + + houston_ReadReg(HOUSTON_CR, &cr, 2); + + if (CR_OFMT & cr) + *p_tvout_mode = GFX_TVOUT_MODE_RGB; + else { + *p_tvout_mode = 0; + if (!(CR_YCOFF & cr)) + *p_tvout_mode |= GFX_TVOUT_MODE_YC; + if (!(CR_COMPOFF & cr)) + *p_tvout_mode |= GFX_TVOUT_MODE_CVBS; + } +} + +/*==========================================================================*/ +/****/ +/*// Size & Position*/ + +#define IS_NTSC(tv_std) (tv_std & ( \ + GFX_TV_STANDARD_NTSC_M | \ + GFX_TV_STANDARD_NTSC_M_J | \ + GFX_TV_STANDARD_PAL_M)) +#define IS_PAL(tv_std) (tv_std & ( \ + GFX_TV_STANDARD_PAL_B | \ + GFX_TV_STANDARD_PAL_D | \ + GFX_TV_STANDARD_PAL_H | \ + GFX_TV_STANDARD_PAL_I | \ + GFX_TV_STANDARD_PAL_N | \ + GFX_TV_STANDARD_PAL_G)) + +/*return fifo delay setting for mode, std, and total lines.*/ + +static void +get_ffolat_ivo(unsigned long vga_mode, + unsigned long tv_std, + long i, unsigned short *ffolat, unsigned short *ivo) +{ + switch (vga_mode) { + case GFX_VGA_MODE_640X480: + if (IS_NTSC(tv_std)) { + if (i > SIZE6X4NTSC - 1) + i = SIZE6X4NTSC - 1; + *ffolat = ffo6x4ntsc[i].ffolat; + *ivo = 0x20; + } else { + if (i > SIZE6X4PAL - 1) + i = SIZE6X4PAL - 1; + *ffolat = ffo6x4pal[i].ffolat; + *ivo = 0x28; + } + break; + + case GFX_VGA_MODE_800X600: + if (IS_NTSC(tv_std)) { + if (i > SIZE8X6NTSC - 1) + i = SIZE8X6NTSC - 1; + *ffolat = ffo8x6ntsc[i].ffolat; + *ivo = 0x3a; + } else { + if (i > SIZE8X6PAL - 1) + i = SIZE8X6PAL - 1; + *ffolat = ffo8x6pal[i].ffolat; + *ivo = 0x39; + } + break; + + case GFX_VGA_MODE_720X487: + *ffolat = 0x40; /*//FFO7x4; */ + *ivo = 0x1a; + break; + + case GFX_VGA_MODE_720X576: + *ffolat = 0x40; /*//FFO7x5; */ + *ivo = 0x1a; + break; + + case GFX_VGA_MODE_1024X768: + default: + if (IS_NTSC(tv_std)) { + if (i > SIZE10X7NTSC - 1) + i = SIZE10X7NTSC - 1; + *ffolat = ffo10x7ntsc[i].ffolat; + *ivo = ffo10x7ntsc[i].ivo; + } else { + if (i > SIZE10X7PAL - 1) + i = SIZE10X7PAL - 1; + *ffolat = ffo10x7pal[i].ffolat; + *ivo = ffo10x7pal[i].ivo; + } + break; + } +} + +/*get vertical line min and max for mode and std.*/ + +static void +get_vtotal_min_max(unsigned long vga_mode, + unsigned long tv_std, + int *v_total_min, int *v_total_max, int *v_step) +{ + int k = map_tvstd_to_index(tv_std); + + switch (vga_mode) { + case GFX_VGA_MODE_640X480: + if (IS_NTSC(tv_std)) { + *v_total_min = ffo6x4ntsc[0].v_total; + *v_total_max = ffo6x4ntsc[SIZE6X4NTSC - 1].v_total; + } else { + *v_total_min = ffo6x4pal[0].v_total; + *v_total_max = ffo6x4pal[SIZE6X4PAL - 1].v_total; + } + *v_step = 4; + break; + + case GFX_VGA_MODE_800X600: + if (IS_NTSC(tv_std)) { + *v_total_min = ffo8x6ntsc[0].v_total; + *v_total_max = ffo8x6ntsc[SIZE8X6NTSC - 1].v_total; + } else { + *v_total_min = ffo8x6pal[0].v_total; + *v_total_max = ffo8x6pal[SIZE8X6PAL - 1].v_total; + } + *v_step = 5; + break; + + case GFX_VGA_MODE_720X487: + case GFX_VGA_MODE_720X576: + *v_total_min = tvsetup.tv_lines[k]; + *v_total_max = tvsetup.tv_lines[k]; + *v_step = 4; + break; + + case GFX_VGA_MODE_1024X768: + if (IS_NTSC(tv_std)) { + *v_total_min = ffo10x7ntsc[0].v_total; + *v_total_max = ffo10x7ntsc[SIZE10X7NTSC - 1].v_total; + } else { + *v_total_min = ffo10x7pal[0].v_total; + *v_total_max = ffo10x7pal[SIZE10X7PAL - 1].v_total; + } + *v_step = 6; + break; + } +} + +static void +config_overscan_xy(unsigned long tv_std, + unsigned long vga_mode, + int overscan_x, int overscan_y, int pos_x, int pos_y) +{ + unsigned int vga_index; + unsigned long reg; + double vsc; + int k; + unsigned short ffolat, ivo; + int base_v_total, range, v_offset; + int v_total_min, v_total_max, v_step; + float r, f; + int vga_pixels, pre_pixels; + float hscale, hscale_min, hscale_max; + int hsc; + int iho, iho_max, ihw; + + /*tv_std is valid. */ + k = map_tvstd_to_index(tv_std); + + /*store tv width and lines */ + g_specs.tv_width = tvsetup.tv_width[k]; + g_specs.tv_lines = tvsetup.tv_lines[k]; + + /*determine vga mode index */ + for (vga_index = 0; vga_index < SCANTABLE_ENTRIES; vga_index++) { + if (scantable[vga_index].mode == vga_mode) + break; + } + if (vga_index >= SCANTABLE_ENTRIES) + return; + + /****/ + /*vertical scaling (v_total setup). */ + /****/ + /*calculate vertical range. */ + get_vtotal_min_max(vga_mode, tv_std, &v_total_min, &v_total_max, &v_step); + TRACE(("v_total min=%d, max=%d\n", v_total_min, v_total_max)) + base_v_total = scantable[vga_index].v_total[k]; + range = fsmax(base_v_total - v_total_min, v_total_max - base_v_total); + TRACE(("v_total range = %d\n", range)) + + /*map +/-1000 overscan y into +/-range. */ + v_offset = (int)((((float)overscan_y * range) / 1000.f) + .5f); + TRACE(("v_offset = %d\n", v_offset)) + + /*range limit v_total. */ + g_specs.v_total = + range_limit(base_v_total + v_offset, v_total_min, v_total_max); + + /*round to calibrated value. */ + v_offset = (g_specs.v_total - v_total_min + (v_step / 2)) / v_step; + g_specs.v_total = v_total_min + v_offset * v_step; + TRACE(("desired v_total=%d\n", g_specs.v_total)) + + /****/ + /*vertical positioning (vsync setup). */ + /****/ + get_ffolat_ivo(vga_mode, tv_std, v_offset, &ffolat, &ivo); + houston_WriteReg(HOUSTON_IVO, ivo, 2); + + /*scale base sync offset by scaling ratio. */ + r = (float)g_specs.v_total / (float)base_v_total; + v_offset = (int)(r * (float)scantable[vga_index].v_sync[k]); + + /*scale ivo. */ + f = (float)ivo; + v_offset -= (int)(f - f / r); + + /*compensate for center screen. */ + f = (float)tvsetup.tv_active_lines[k] / 2.f; + v_offset += (int)(f * r - f); + + /*calculate vsync. */ + g_specs.v_sync = g_specs.v_total - v_offset + pos_y; + TRACE(("desired v_total=%d, desired v_sync=%d\n", g_specs.v_total, + g_specs.v_sync)) + if (g_specs.v_sync < g_specs.vga_lines + 10) { + TRACE(("vsync too low\n")) + /*//d.v_total += d.vga_lines+10-d.v_sync; */ + g_specs.v_sync = g_specs.vga_lines + 10; + } else if (g_specs.v_sync > g_specs.v_total - 10) { + TRACE(("vsync too high\n")) + g_specs.v_sync = g_specs.v_total - 10; + } + TRACE(("v_total=%d v_sync=%d\n", g_specs.v_total, g_specs.v_sync)) + + /*FFOLAT. */ + houston_WriteReg(HOUSTON_FFO_LAT, ffolat, 2); + + /*VSC. */ + vsc = (65536.0f * + (1.0f - (double)g_specs.tv_lines / (double)g_specs.v_total)) + 0.5f; + reg = ((unsigned long)-vsc) & 0xffff; + TRACE(("vsc=%04x, tv_lines=%d, v_total=%d\n", reg, g_specs.tv_lines, + g_specs.v_total)) + houston_WriteReg(HOUSTON_VSC, (int)reg, 2); + + /****/ + /*horizontal scaling. */ + /****/ + + /*vga pixels is vga width, except in 1024x768, where it's half that. */ + vga_pixels = g_specs.vga_width; + if (1024 == vga_pixels) + vga_pixels /= 2; + + /*maximum scaling coefficient is tv_width / vga_pixels */ + /*minimum is about 1/2, but that is quite small. arbitrarily set minimum at 75% maximum. */ + hscale_max = (720.0f / vga_pixels); + hscale_min = fsmax((0.75f * hscale_max), (1.0f - (63.0f / 128.0f))); + TRACE(("hscale_min = %u.%u, hscale_max = %u.%u\n", + (int)hscale_min, + (int)((hscale_min - (int)hscale_min) * 1000), + (int)hscale_max, (int)((hscale_max - (int)hscale_max) * 1000))) + + /*map overscan_x into min to max. */ + hscale = + hscale_min + ((overscan_x + 1000.0f) / 2000.0f) * (hscale_max - + hscale_min); + TRACE(("hscale = %u.%u\n", (int)hscale, + (int)((hscale - (int)hscale) * 1000))) + + /*determine hsc where hscale = (1 + hsc/128) */ + if (hscale >= 1.0f) + hsc = (int)(128.f * (hscale - 1.0f) + .5f); + else + hsc = (int)(128.f * (hscale - 1.0f) - .5f); + TRACE(("hsc = %d\n", hsc)) + if (hsc >= 0) + houston_WriteReg(HOUSTON_HSC, hsc << 8, 2); + else + houston_WriteReg(HOUSTON_HSC, hsc & 0xFF, 2); + + /*recalculate hscale for future formulas */ + hscale = 1.0f + (hsc / 128.0f); + TRACE(("recalculated hscale = %u.%u\n", (int)hscale, + (int)((hscale - (int)hscale) * 1000))) + + /****/ + /*horizontal offset. */ + /****/ + /*place hsync 40 before halfway from vga_width to htotal */ + /*but not less than vga_width + 10 */ + g_specs.h_sync = + fsmax((g_specs.h_total + g_specs.vga_width) / 2 - 40, + g_specs.vga_width + 10); + /*also, make it even */ + g_specs.h_sync &= ~1; + TRACE(("hsync = %u\n", g_specs.h_sync)) + + /*iho range is 0 to iho_max. */ + /*iho_max is 2 * iho_center. */ + /*iho_center is pre_pixels - (tvwidth / hscale - vga pixels) / 2. */ + /*pre_pixels = (htotal - hsync) * (vga_pixels / vga_width) */ + /*note that the range is inverted also, because it specifies the number of pixels */ + /*to skip, or subtract. iho=0 maps to farthest right. */ + /*map -pos_x = +/-1000 into (0 to iho_max) */ + pre_pixels = + (int)((long)(g_specs.h_total - g_specs.h_sync) * vga_pixels / + g_specs.vga_width); + iho_max = (2 * pre_pixels) - ((int)(720.0f / hscale + 0.5f) - vga_pixels); + TRACE(("iho_max = %u\n", iho_max)) + iho = + (int)range_limit(((long)(1000 - pos_x) * iho_max / 2000) + + scantable[vga_index].iho[k], 0, iho_max); + TRACE(("iho = %u\n", iho)) + houston_WriteReg(HOUSTON_IHO, iho, 2); + + /****/ + /*input horizontal width. */ + /****/ + + /*input horizontal width is vga pixels + pre_pixels - iho */ + /*additionally, ihw cannot exceed tv width / hscale */ + /*and if hsc is negative, (ihw)(-hsc/128) cannot exceed ~250. */ + /*and ihw should be even. */ + ihw = fsmin(vga_pixels + pre_pixels - iho, (int)(720.0f / hscale)); + if (hsc < 0) + ihw = (int)fsmin(ihw, 253L * 128 / (-hsc)); + ihw &= ~1; + TRACE(("ihw = %u\n", ihw)) + houston_WriteReg(HOUSTON_IHA, ihw, 2); + + f = (((float)g_specs.h_total * g_specs.v_total) * 27.f) / + ((float)g_specs.tv_width * g_specs.tv_lines); + + TRACE(("freq=%u.%uMHz\n", (int)f, (int)((f - (int)f) * 1000))) +} + +/*==========================================================================*/ +/****/ +/*configure houston nco.*/ + +static void +config_nco(unsigned long tv_std, unsigned long vga_mode) +{ + unsigned long cr, misc; + unsigned long reg; + int k = map_tvstd_to_index(tv_std); + + /*read and store CR. */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + + /*make sure NCO_EN (enable latch) bit is clear */ + cr &= ~CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + + /*clear NCO_LOADX. */ + houston_ReadReg(HOUSTON_MISC, &misc, 2); + misc &= ~(MISC_NCO_LOAD1 + MISC_NCO_LOAD0); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + if (vga_mode == GFX_VGA_MODE_1024X768) { + /*setup for M and N load (Nco_load=1). */ + misc |= (MISC_NCO_LOAD0); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + /*M and N. */ + houston_WriteReg(HOUSTON_NCONL, 1024 - 2, 2); + houston_WriteReg(HOUSTON_NCODL, 128 - 1, 2); + + /*latch M/N in. */ + cr |= CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + cr &= ~CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + + /*setup ncon and ncod load (Nco_load=0). */ + misc &= ~(MISC_NCO_LOAD1 + MISC_NCO_LOAD0); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + /*NCON. */ + reg = ((unsigned long)g_specs.v_total * g_specs.h_total) / 2; + houston_WriteReg(HOUSTON_NCONH, reg >> 16, 2); + houston_WriteReg(HOUSTON_NCONL, reg & 0xffff, 2); + + /*NCOD. */ + houston_WriteReg(HOUSTON_NCODL, tvsetup.houston_ncodl[k], 2); + houston_WriteReg(HOUSTON_NCODH, tvsetup.houston_ncodh[k], 2); + } else { + /*setup for M and N load (Nco_load=2). */ + misc |= (MISC_NCO_LOAD1); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + /*NCON. */ + reg = (unsigned long)g_specs.v_total * g_specs.h_total; + houston_WriteReg(HOUSTON_NCONH, reg >> 16, 2); + houston_WriteReg(HOUSTON_NCONL, reg & 0xffff, 2); + + /*NCOD. */ + houston_WriteReg(HOUSTON_NCODL, tvsetup.houston_ncodl[k], 2); + houston_WriteReg(HOUSTON_NCODH, tvsetup.houston_ncodh[k], 2); + + TRACE(("NCON = %lu (0x%08lx), NCOD = %lu (0x%08lx)\n", + reg, + reg, + ((unsigned long)tvsetup.houston_ncodh[k] << 16) + + tvsetup.houston_ncodl[k], + ((unsigned long)tvsetup.houston_ncodh[k] << 16) + + tvsetup.houston_ncodl[k])) + } + + /*latch M/N and NCON/NCOD in. */ + cr |= CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + cr &= ~CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); +} + +/*==========================================================================*/ +/****/ +/*// Write sharpness settings to device*/ + +static void +config_sharpness(int sharpness) +{ + unsigned int shp; + + /*map 0-1000 to 0-20. */ + shp = (unsigned int)(0.5f + ((float)sharpness * 20.0f / 1000.0f)); + shp = range_limit(shp, 0, 20); + + houston_WriteReg(HOUSTON_SHP, shp, 2); +} + +static void +conget_sharpness(int *p_sharpness) +{ + unsigned long shp; + + if (!p_sharpness) + return; + + houston_ReadReg(HOUSTON_SHP, &shp, 2); + + /*map 0-20 to 0-1000. */ + *p_sharpness = (int)(0.5f + ((float)shp * 1000.0f / 20.0f)); +} + +/*==========================================================================*/ +/****/ +/*// Write flicker settings to device*/ + +static void +config_flicker(int flicker) +{ + unsigned int flk; + + /*map 0-1000 to 0-16. */ + flk = (unsigned int)(0.5f + ((float)flicker * 16.0f / 1000.0f)); + flk = range_limit(flk, 0, 16); + + houston_WriteReg(HOUSTON_FLK, flk, 2); +} + +static void +conget_flicker(int *p_flicker) +{ + unsigned long flk; + + if (!p_flicker) + return; + + houston_ReadReg(HOUSTON_FLK, &flk, 2); + + /*map 0-16 to 0-1000. */ + *p_flicker = (int)(0.5f + ((float)flk * 1000.0f / 16.0f)); +} + +/*==========================================================================*/ +/****/ +/*// Write color settings to device*/ + +static void +config_color(int color) +{ + unsigned long clr; + + /*map 0-100 to 0-255. */ + /*montreal production test needs 169 to be mappable, so */ + /*use .8 rounding factor, 169=(int)(66.*2.55+.8). */ + clr = (unsigned long)(0.8f + ((float)color * 255.0f / 100.0f)); + clr = range_limit(clr, 0, 255); + + houston_WriteReg(ENC_CR_GAIN, clr, 1); + houston_WriteReg(ENC_CB_GAIN, clr, 1); +} + +static void +conget_color(int *p_color) +{ + unsigned long cr_gain; + + if (!p_color) + return; + + /*just get CR GAIN, CB GAIN should match. */ + houston_ReadReg(ENC_CR_GAIN, &cr_gain, 1); + + /*map 0-255 to 0-100. */ + *p_color = (int)(0.5f + ((float)cr_gain * 100.0f / 255.0f)); +} + +/*==========================================================================*/ +/****/ +/*// Write brightness and contrast settings to device*/ + +#define NTSC_BLANK_LEVEL 240 + +static const int min_black_level = NTSC_BLANK_LEVEL + 1; +static const int max_white_level = 1023; + +static void +config_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, + int brightness, int contrast) +{ + int brightness_off; + float contrast_mult; + int black, white; + unsigned short w; + int k = map_tvstd_to_index(tv_std); + + /*0-100 maps to +/-220. */ + brightness_off = (int)(0.5f + ((float)brightness * 440.0f / 100.0f)) - 220; + + /*0-100 maps to .75-1.25. */ + contrast_mult = ((float)contrast * 0.5f / 100.0f) + 0.75f; + + black = tvsetup.black_level[k]; + if (trigger_bits != 0) + black -= tvsetup.hamp_offset[k]; + + white = tvsetup.white_level[k]; + if (trigger_bits != 0) + white -= tvsetup.hamp_offset[k]; + + black = (int)((float)(black + brightness_off) * contrast_mult); + white = (int)((float)(white + brightness_off) * contrast_mult); + if (black < min_black_level) + black = min_black_level; + if (white > max_white_level) + white = max_white_level; + + w = w10bit2z((unsigned short)black); + houston_WriteReg(ENC_BLACK_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_BLACK_LEVEL + 1, w >> 8, 1); + w = w10bit2z((unsigned short)white); + houston_WriteReg(ENC_WHITE_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_WHITE_LEVEL + 1, w >> 8, 1); +} + +static void +conget_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, + int *p_brightness, int *p_contrast) +{ + int brightness_off; + float contrast_mult; + unsigned short black, white; + unsigned long zh, zl; + int k; + + if (!p_brightness || !p_contrast) + return; + + k = map_tvstd_to_index(tv_std); + + houston_ReadReg(ENC_BLACK_LEVEL, &zl, 1); + houston_ReadReg(ENC_BLACK_LEVEL + 1, &zh, 1); + black = z2w10bit((unsigned short)(zl + (zh << 8))); + if (trigger_bits != 0) + black += tvsetup.hamp_offset[k]; + houston_ReadReg(ENC_WHITE_LEVEL, &zl, 1); + houston_ReadReg(ENC_WHITE_LEVEL + 1, &zh, 1); + white = z2w10bit((unsigned short)(zl + (zh << 8))); + if (trigger_bits != 0) + white += tvsetup.hamp_offset[k]; + + /*this reverse computation does not account for clipping, but should */ + /*provide somewhat reasonable numbers */ + contrast_mult = + ((float)white - (float)black) / ((float)tvsetup.white_level[k] - + (float)tvsetup.black_level[k]); + brightness_off = + (int)(((float)black / contrast_mult) - tvsetup.black_level[k]); + + /*+/-220 maps to 0-100. */ + *p_brightness = + range_limit((int) + (0.5f + + ((float)(brightness_off + 220) * 100.0f / 440.0f)), 0, + 100); + + /*.75-1.25 maps to 0-100. */ + *p_contrast = + range_limit((int) + (0.5f + + ((float)(contrast_mult - 0.75f) * 100.0f / 0.5f)), 0, + 100); +} + +/*==========================================================================*/ +/****/ +/*configure luma/chroma filters.*/ + +static void +config_yc_filter(unsigned long tv_std, int luma_filter, int chroma_filter) +{ + unsigned long reg, reg07, reg34; + + if (houston_Rev() < HOUSTON_REV_B) + return; + + /*luma filter. */ + if (luma_filter) + reg = tvsetup.notch_filter[map_tvstd_to_index(tv_std)]; + else + reg = 0; + houston_WriteReg(ENC_NOTCH_FILTER, reg, 1); + + /*chroma filter. */ + houston_ReadReg(ENC_REG07, ®07, 1); + houston_ReadReg(ENC_REG34, ®34, 1); + if (chroma_filter) { + reg07 &= ~0x08; + reg34 &= ~0x20; + } else { + reg07 |= 0x08; + reg34 |= 0x20; + } + houston_WriteReg(ENC_REG07, reg07, 1); + houston_WriteReg(ENC_REG34, reg34, 1); +} + +static void +conget_yc_filter(int *p_luma_filter, int *p_chroma_filter) +{ + unsigned long reg, reg07, reg34; + + if (!p_luma_filter || !p_chroma_filter) + return; + + if (houston_Rev() < HOUSTON_REV_B) { + *p_luma_filter = 0; + *p_chroma_filter = 0; + return; + } + + /*luma filter. */ + houston_ReadReg(ENC_NOTCH_FILTER, ®, 1); + *p_luma_filter = (reg ? 1 : 0); + + /*chroma filter. */ + houston_ReadReg(ENC_REG07, ®07, 1); + houston_ReadReg(ENC_REG34, ®34, 1); + *p_chroma_filter = !((0x08 & reg07) || (0x20 & reg34)); +} + +/*==========================================================================*/ +/****/ +/*// Macrovision*/ + +static void +config_macrovision(unsigned long tv_std, unsigned int trigger_bits) +{ +/****/ +/*Constants to index into mvsetup columns.*/ +/****/ +#define nNTSC_APS00 0 /*ntsc mv off. */ +#define nNTSC_APS01 1 /*ntsc AGC only. */ +#define nNTSC_APS10 2 /*ntsc AGC + 2-line CS. */ +#define nNTSC_APS11 3 /*ntsc AGC + 4-line CS. */ +#define nPAL_APS00 4 /*pal mv off. */ +#define nPAL_APSXX 5 /*pal mv on. */ +#define nMVModes 6 + +/****/ +/*Macrovision setup table.*/ +/****/ + static const struct mvparms + { + unsigned short n0[nMVModes]; + unsigned short n1[nMVModes]; + unsigned short n2[nMVModes]; + unsigned short n3[nMVModes]; + unsigned short n4[nMVModes]; + unsigned short n5[nMVModes]; + unsigned short n6[nMVModes]; + unsigned short n7[nMVModes]; + unsigned short n8[nMVModes]; + unsigned short n9[nMVModes]; + unsigned short n10[nMVModes]; + unsigned short n11[nMVModes]; + unsigned short n12[nMVModes]; + unsigned short n13[nMVModes]; + unsigned short n14[nMVModes]; + unsigned short n15[nMVModes]; + unsigned short n16[nMVModes]; + unsigned short n17[nMVModes]; + unsigned short n18[nMVModes]; + unsigned short n19[nMVModes]; + unsigned short n20[nMVModes]; + unsigned short n21[nMVModes]; + unsigned short n22[nMVModes]; + unsigned short agc_pulse_level[nMVModes]; + unsigned short bp_pulse_level[nMVModes]; + } + + mvsetup = + { /*// ntsc ntsc ntsc ntsc pal pal */ + /*// MV AGC AGC + AGC + MV MV */ + /*// off. only 2-line 4-line off. on. */ + /*// CS. CS. */ + { + 0x00, 0x36, 0x3e, 0x3e, 0x00, 0x3e} + , /*n0 */ + { + 0x1d, 0x1d, 0x1d, 0x17, 0x1a, 0x1a} + , /*n1 */ + { + 0x11, 0x11, 0x11, 0x15, 0x22, 0x22} + , /*n2 */ + { + 0x25, 0x25, 0x25, 0x21, 0x2a, 0x2a} + , /*n3 */ + { + 0x11, 0x11, 0x11, 0x15, 0x22, 0x22} + , /*n4 */ + { + 0x01, 0x01, 0x01, 0x05, 0x05, 0x05} + , /*n5 */ + { + 0x07, 0x07, 0x07, 0x05, 0x02, 0x02} + , /*n6 */ + { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00} + , /*n7 */ + { + 0x1b, 0x1b, 0x1b, 0x1b, 0x1c, 0x1c} + , /*n8 */ + { + 0x1b, 0x1b, 0x1b, 0x1b, 0x3d, 0x3d} + , /*n9 */ + { + 0x24, 0x24, 0x24, 0x24, 0x14, 0x14} + , /*n10 */ + { + 0x780f, 0x780f, 0x780f, 0x780f, 0x7e07, 0x7e07} + , /*n11 */ + { + 0x0000, 0x0000, 0x0000, 0x0000, 0x5402, 0x5402} + , /*n12 */ + { + 0x0f, 0x0f, 0x0f, 0x0f, 0xfe, 0xfe} + , /*n13 */ + { + 0x0f, 0x0f, 0x0f, 0x0f, 0x7e, 0x7e} + , /*n14 */ + { + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60} + , /*n15 */ + { + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00} + , /*n16 */ + { + 0x0a, 0x0a, 0x0a, 0x0a, 0x08, 0x08} + , /*n17 */ + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + , /*n18 */ + { + 0x05, 0x05, 0x05, 0x05, 0x04, 0x04} + , /*n19 */ + { + 0x04, 0x04, 0x04, 0x04, 0x07, 0x07} + , /*n20 */ + { + 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x0155, 0x0155} + , /*n21 */ + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + , /*n22 */ + { + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3} + , /*agc_pulse_level */ + { + 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8} + , /*bp_pulse_level */ + }; + + int nMode; + unsigned long misc; + unsigned short n0; + + trigger_bits &= 0x3; + + /*Determine the OEM Macrovision Program Mode and Register 0 Data. */ + if (IS_NTSC(tv_std)) { + /*NTSC TV Standard. */ + if (trigger_bits == 0) { + /*turn Macrovision OFF. */ + nMode = nNTSC_APS00; + } else if (trigger_bits == 1) { + /*AGC Only. */ + nMode = nNTSC_APS01; + } else if (trigger_bits == 2) { + /*AGC + 2-line CS. */ + nMode = nNTSC_APS10; + } else { + /*AGC + 4-line CS. */ + nMode = nNTSC_APS11; + } + } else { + /*PAL TV Standard. */ + if (trigger_bits == 0) { + /*turn Macrovision OFF. */ + nMode = nPAL_APS00; + } else { + /*APS 01, 10, or 11. */ + nMode = nPAL_APSXX; + } + } + + /*Retrieve the Macrovision Program Mode Data */ + if (tv_std != GFX_TV_STANDARD_PAL_M) + n0 = mvsetup.n0[nMode]; + else { + /*PAL-M sets up like NTSC except for n0. */ + if ((trigger_bits & 0x03) == 0) + n0 = mvsetup.n0[nPAL_APS00]; + else + n0 = mvsetup.n0[nPAL_APSXX]; + } + + /*download settings now. */ + houston_WriteReg(MV_N0, n0, 1); + houston_WriteReg(MV_N1, mvsetup.n1[nMode], 1); + houston_WriteReg(MV_N2, mvsetup.n2[nMode], 1); + houston_WriteReg(MV_N3, mvsetup.n3[nMode], 1); + houston_WriteReg(MV_N4, mvsetup.n4[nMode], 1); + houston_WriteReg(MV_N5, mvsetup.n5[nMode], 1); + houston_WriteReg(MV_N6, mvsetup.n6[nMode], 1); + houston_WriteReg(MV_N7, mvsetup.n7[nMode], 1); + houston_WriteReg(MV_N8, mvsetup.n8[nMode], 1); + houston_WriteReg(MV_N9, mvsetup.n9[nMode], 1); + houston_WriteReg(MV_N10, mvsetup.n10[nMode], 1); + houston_WriteReg(MV_N11, mvsetup.n11[nMode] & 0xff, 1); + houston_WriteReg(MV_N11 + 1, mvsetup.n11[nMode] >> 8, 1); + houston_WriteReg(MV_N12, mvsetup.n12[nMode] & 0xff, 1); + houston_WriteReg(MV_N12 + 1, mvsetup.n12[nMode] >> 8, 1); + houston_WriteReg(MV_N13, mvsetup.n13[nMode], 1); + houston_WriteReg(MV_N14, mvsetup.n14[nMode], 1); + houston_WriteReg(MV_N15, mvsetup.n15[nMode], 1); + houston_WriteReg(MV_N16, mvsetup.n16[nMode], 1); + houston_WriteReg(MV_N17, mvsetup.n17[nMode], 1); + houston_WriteReg(MV_N18, mvsetup.n18[nMode], 1); + houston_WriteReg(MV_N19, mvsetup.n19[nMode], 1); + houston_WriteReg(MV_N20, mvsetup.n20[nMode], 1); + houston_WriteReg(MV_N21, mvsetup.n21[nMode] & 0xff, 1); + houston_WriteReg(MV_N21 + 1, mvsetup.n21[nMode] >> 8, 1); + houston_WriteReg(MV_N22, mvsetup.n22[nMode], 1); + houston_WriteReg(MV_AGC_PULSE_LEVEL, mvsetup.agc_pulse_level[nMode], 1); + houston_WriteReg(MV_BP_PULSE_LEVEL, mvsetup.bp_pulse_level[nMode], 1); + + houston_ReadReg(HOUSTON_MISC, &misc, 2); + if (trigger_bits == 0) + misc &= ~MISC_MV_SOFT_EN; + else + misc |= MISC_MV_SOFT_EN; + houston_WriteReg(HOUSTON_MISC, misc, 2); +} + +static void +conget_macrovision(unsigned long tv_std, unsigned int *p_cp_trigger_bits) +{ + unsigned long n0, n1; + + if (!p_cp_trigger_bits) + return; + + houston_ReadReg(MV_N0, &n0, 1); + houston_ReadReg(MV_N1, &n1, 1); + + *p_cp_trigger_bits = 0; + + if (IS_NTSC(tv_std)) { + switch (n0) { + case 0: + *p_cp_trigger_bits = 0; + break; + + case 0x36: + *p_cp_trigger_bits = 1; + break; + + case 0x3E: + { + if (0x1D == n1) + *p_cp_trigger_bits = 2; + else + *p_cp_trigger_bits = 3; + } + break; + } + } else if (IS_PAL(tv_std)) { + if (0 == n0) + *p_cp_trigger_bits = 0; + else { + /*don't know here what the non-zero trigger bits were */ + *p_cp_trigger_bits = 1; + } + } +} + +/*// PLAL_MediaGX.cpp*/ +/*//==========================================================================*/ +/****/ +/*These functions provides implementation of platform-specific functions*/ +/*MediaGX platform.*/ +/****/ +/*//==========================================================================*/ + +/*MediaGX control registers.*/ +#define CCR3 0xC3 +#define GCR 0xb8 + +/*Media GX registers*/ +/* +#define DC_UNLOCK 0x8300 +#define DC_GENERAL_CFG 0x8304 +#define DC_TIMING_CFG 0x8308 +#define DC_OUTPUT_CFG 0x830c +#define DC_H_TIMING_1 0X8330 +#define DC_H_TIMING_2 0X8334 +#define DC_H_TIMING_3 0X8338 +#define DC_FP_H_TIMING 0X833c +#define DC_V_TIMING_1 0X8340 +#define DC_V_TIMING_2 0X8344 +#define DC_V_TIMING_3 0X8348 +#define DC_FP_V_TIMING 0X834c +*/ +/*Media GX general config register.*/ +#define GX_DCLK_MUL 0x00c0 +#define GX_DCLKx1 0x0040 +#define GX_DCLKx2 0x0080 +#define GX_DCLKx4 0x00c0 + +/*Media GX timing config register.*/ +#define GX_TGEN 0x0020 + +/*Cx5530 register offsets (from GX_BASE).*/ +#define CX_DISPLAY_CONFIG 0x10004 +#define CX_DOT_CLK 0x10024 +#define CX_TV_CONFIG 0x10028 + +/*Cx5530 display configuration register.*/ +#define CX_FPVSYNC_POL 0x0800 +#define CX_FPHSYNC_POL 0x0400 +#define CX_FPDATA_ENB 0x0080 +#define CX_FPPOWER_ENB 0x0040 +#define CX_CRTVSYNC_POL 0x0200 +#define CX_CRTHSYNC_POL 0x0100 + +/*Cx5530 dot clock configuration register.*/ +#define CX_TVCLK_SELECT 0x0400 + +/*Cx5530 tv configuration register*/ +#define CX_INVERT_FPCLK (1 << 6) + +/*//==========================================================================*/ +/****/ +/*// FS450 I2C Address*/ +/****/ +/*// There are two possible 7-bit addresses, 0x4A and 0x6A.*/ +/*// The address if selectable via pins on the FS450.*/ +/*// There are also two possible 10-bit addresses, 0x224 and 0x276, but this*/ +/*// source is not designed to use them.*/ +/****/ + +#define FS450_I2C_ADDRESS (0x4A) + +static unsigned char +PLAL_FS450_i2c_address(void) +{ + return FS450_I2C_ADDRESS; +} + +/*//==========================================================================*/ +/****/ +/*// FS450 UIM mode*/ +/****/ +/*// This mode is programmed in the FS450 command register when enabling TV*/ +/*// out.*/ + +static int +PLAL_FS450_UIM_mode(void) +{ + return 3; +} + +/*//==========================================================================*/ +/****/ +/*// Read and Write MediaGX registers*/ + +static unsigned long +ReadGx(unsigned long inRegAddr) +{ + unsigned long data; + + DMAL_ReadUInt32(inRegAddr, &data); + + return data; +} + +static void +WriteGx(unsigned long inRegAddr, unsigned long inData) +{ + int is_timing_register; + unsigned long reg_timing_cfg; + + /*because the unlock register for the MediaGx video registers may not */ + /*persist, we will write the unlock code before every write. */ + DMAL_WriteUInt32(DC_UNLOCK, 0x4758); + + /*see if register is a timing register */ + is_timing_register = + (DC_H_TIMING_1 == inRegAddr) || + (DC_H_TIMING_2 == inRegAddr) || + (DC_H_TIMING_3 == inRegAddr) || + (DC_FP_H_TIMING == inRegAddr) || + (DC_V_TIMING_1 == inRegAddr) || + (DC_V_TIMING_2 == inRegAddr) || + (DC_V_TIMING_3 == inRegAddr) || (DC_FP_V_TIMING == inRegAddr); + + /*if the register is a timing register, clear the TGEN bit to allow modification */ + if (is_timing_register) { + DMAL_ReadUInt32(DC_TIMING_CFG, ®_timing_cfg); + DMAL_WriteUInt32(DC_TIMING_CFG, reg_timing_cfg & ~GX_TGEN); + } + + /*write the requested register */ + DMAL_WriteUInt32(inRegAddr, inData); + + /*reset the TGEN bit to previous state */ + if (is_timing_register) { + DMAL_WriteUInt32(DC_TIMING_CFG, reg_timing_cfg); + } +} + +#ifdef FS450_DIRECTREG + +/*//==========================================================================*/ +/****/ +/*// Platform-specific processing for a Read or Write Register calls.*/ +/*// The functions should return true if the specified register belongs to*/ +/*// this platform.*/ + +static int +PLAL_ReadRegister(S_REG_INFO * p_reg) +{ + if (!p_reg) + return 0; + + if (SOURCE_GCC == p_reg->source) { + p_reg->value = ReadGx(p_reg->offset); + + return 1; + } + + return 0; +} + +static int +PLAL_WriteRegister(const S_REG_INFO * p_reg) +{ + if (!p_reg) + return 0; + + if (SOURCE_GCC == p_reg->source) { + WriteGx(p_reg->offset, p_reg->value); + + return 1; + } + + return 0; +} + +#endif + +/*//==========================================================================*/ +/****/ +/*// Determine if TV is on*/ + +static int +PLAL_IsTVOn(void) +{ + unsigned long reg; + + /*check Cx5530 dot clock */ + reg = ReadGx(CX_DOT_CLK); + return (reg & CX_TVCLK_SELECT) ? 1 : 0; +} + +/*//==========================================================================*/ +/****/ +/*// Platform-specific actions to reset to VGA mode*/ + +static int +PLAL_EnableVga(void) +{ + unsigned long reg; + + /*2 x dclk */ + reg = ReadGx(DC_GENERAL_CFG); + reg &= ~GX_DCLK_MUL; + reg |= GX_DCLKx2; + WriteGx(DC_GENERAL_CFG, reg); + + /*select pll dot clock. */ + reg = ReadGx(CX_DOT_CLK); + reg &= ~CX_TVCLK_SELECT; + WriteGx(CX_DOT_CLK, reg); + + /*timing config, reset everything on dclk. */ + reg = ReadGx(DC_TIMING_CFG); + reg &= ~GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + reg |= GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + + /*un-invert FP clock */ + reg = ReadGx(CX_TV_CONFIG); + reg &= ~CX_INVERT_FPCLK; + WriteGx(CX_TV_CONFIG, reg); + + return 0; +} + +/*//==========================================================================*/ +/****/ +/*// Platform-specific actions to enter TVout mode*/ + +static int +PLAL_PrepForTVout(void) +{ + unsigned int reg; + + /*Cx5530 tv config. */ + reg = 0; + WriteGx(CX_TV_CONFIG, reg); + + /*invert FP clock */ + reg = (int)ReadGx(CX_TV_CONFIG); + reg |= CX_INVERT_FPCLK; + WriteGx(CX_TV_CONFIG, reg); + + return 0; +} + +static int +PLAL_SetTVTimingRegisters(const S_TIMING_SPECS * p_specs) +{ + unsigned long reg; + + /*timing config, reset everything on dclk. */ + reg = ReadGx(DC_TIMING_CFG); + reg &= ~GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + + /*htotal and hactive. */ + reg = ((p_specs->h_total - 1) << 16) | (p_specs->vga_width - 1); + WriteGx(DC_H_TIMING_1, reg); + + /*hblank. */ + reg = ((p_specs->h_total - 1) << 16) | (p_specs->vga_width - 1); + WriteGx(DC_H_TIMING_2, reg); + + /*hsync. */ + reg = ((p_specs->h_sync + 63) << 16) | p_specs->h_sync; + WriteGx(DC_H_TIMING_3, reg); + + /*fp hsync. */ + WriteGx(DC_FP_H_TIMING, reg); + + /*vtotal and vactive. */ + reg = ((p_specs->v_total - 1) << 16) | (p_specs->vga_lines - 1); + WriteGx(DC_V_TIMING_1, reg); + + /*vblank. */ + reg = ((p_specs->v_total - 1) << 16) | (p_specs->vga_lines - 1); + WriteGx(DC_V_TIMING_2, reg); + + /*vsync. */ + reg = ((p_specs->v_sync) << 16) | (p_specs->v_sync - 1); + WriteGx(DC_V_TIMING_3, reg); + + /*fp vsync. */ + reg = ((p_specs->v_sync - 1) << 16) | (p_specs->v_sync - 2); + WriteGx(DC_FP_V_TIMING, reg); + + /*timing config, reenable all dclk stuff. */ + reg = ReadGx(DC_TIMING_CFG); + reg |= GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + + return 0; +} + +static int +PLAL_FinalEnableTVout(unsigned long vga_mode) +{ + unsigned int reg; + + /*Cx5530 select tv dot clock. */ + reg = (int)ReadGx(CX_DOT_CLK); + reg |= CX_TVCLK_SELECT; + WriteGx(CX_DOT_CLK, reg); + + /*2 x dclk (actually 1x) */ + reg = (int)ReadGx(DC_GENERAL_CFG); + reg &= ~GX_DCLK_MUL; + WriteGx(DC_GENERAL_CFG, reg); + + reg |= GX_DCLKx2; + WriteGx(DC_GENERAL_CFG, reg); + + /*Cx5530 display configuration register. */ + reg = (int)ReadGx(CX_DISPLAY_CONFIG); + reg |= (CX_FPVSYNC_POL | CX_FPHSYNC_POL | CX_FPDATA_ENB | CX_FPPOWER_ENB); + WriteGx(CX_DISPLAY_CONFIG, reg); + +/*disable, shouldn't be necessary*/ +#if 0 + /*kick MediaGX clock multiplier to clean up clock */ + reg = ReadGx(DC_GENERAL_CFG); + reg &= ~GX_DCLK_MUL; + WriteGx(DC_GENERAL_CFG, reg); + reg |= GX_DCLKx2; + WriteGx(DC_GENERAL_CFG, reg); +#endif + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.h:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.h Tue Dec 10 10:12:27 2002 @@ -0,0 +1,307 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.h,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: tv_fs450.h $ + * + * This file defines the common FS450 API. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef __FS450_H__ +#define __FS450_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* ==========================================================================*/ +/* Init and cleanup functions*/ + + int FS450_init(void); + void FS450_cleanup(void); + /* call FS450_init at startup to probe for and initialize FS450. */ + /* returns 0 if successful. */ + +/* ==========================================================================*/ +/* TV output on or off*/ + + int FS450_get_tv_enable(unsigned int *p_on); + int FS450_set_tv_enable(unsigned int on); + /* on is 1 for TV on, 0 for off */ + +/* ==========================================================================*/ +/* TV standard*/ + + int FS450_get_tv_standard(unsigned long *p_standard); + int FS450_get_available_tv_standards(unsigned long *p_standards); + int FS450_set_tv_standard(unsigned long standard); + /* standard is one of the FS450_TV_STANDARD constants */ + /* standards is a bitmask of zero or more FS450_TV_STANDARD constants */ + +/* FS450 TV Standard flags*/ +#define FS450_TV_STANDARD_NTSC_M 0x0001 +#define FS450_TV_STANDARD_NTSC_M_J 0x0002 +#define FS450_TV_STANDARD_PAL_B 0x0004 +#define FS450_TV_STANDARD_PAL_D 0x0008 +#define FS450_TV_STANDARD_PAL_H 0x0010 +#define FS450_TV_STANDARD_PAL_I 0x0020 +#define FS450_TV_STANDARD_PAL_M 0x0040 +#define FS450_TV_STANDARD_PAL_N 0x0080 +#define FS450_TV_STANDARD_PAL_G 0x0100 + +/* ==========================================================================*/ +/* VGA mode assumed by FS450*/ + + int FS450_get_vga_mode(unsigned long *p_vga_mode); + int FS450_get_available_vga_modes(unsigned long *p_vga_modes); + int FS450_set_vga_mode(unsigned long vga_mode); + /* vga_mode is one of the FS450_VGA_MODE constants */ + /* vga_modes is a bitmask of zero or more FS450_VGA_MODE constants */ + +/* FS450 VGA Mode flags*/ +#define FS450_VGA_MODE_UNKNOWN 0 +#define FS450_VGA_MODE_640X480 0x0001 +#define FS450_VGA_MODE_720X487 0x0002 +#define FS450_VGA_MODE_720X576 0x0004 +#define FS450_VGA_MODE_800X600 0x0008 +#define FS450_VGA_MODE_1024X768 0x0010 + +/* ==========================================================================*/ +/* TVout mode*/ + + int FS450_get_tvout_mode(unsigned long *p_tvout_mode); + int FS450_set_tvout_mode(unsigned long tvout_mode); + /* tvout_mode is a bitmask of FS450_TVOUT_MODE constants */ + +/* FS450 TVout mode flags*/ +#define FS450_TVOUT_MODE_CVBS 0x0001 +#define FS450_TVOUT_MODE_YC 0x0002 +#define FS450_TVOUT_MODE_RGB 0x0004 +#define FS450_TVOUT_MODE_CVBS_YC (FS450_TVOUT_MODE_CVBS | FS450_TVOUT_MODE_YC) + +/* ==========================================================================*/ +/* Flicker control*/ + + int FS450_get_sharpness(int *p_sharpness); + int FS450_set_sharpness(int sharpness); + /* sharpness is a percentage in tenths of a percent, 0 to 1000 */ + + int FS450_get_flicker_filter(int *p_flicker); + int FS450_set_flicker_filter(int flicker); + /* flicker_filter is a percentage in tenths of a percent, 0 to 1000 */ + +/* ==========================================================================*/ +/* Size and Position*/ + + int FS450_get_overscan(int *p_x, int *p_y); + int FS450_set_overscan(int x, int y); + int FS450_get_position(int *p_x, int *p_y); + int FS450_set_position(int x, int y); + /* x and y are horizontal and vertical adjustments, -1000 to +1000 */ + +/* ==========================================================================*/ +/* Visual adjustments*/ + + int FS450_get_color(int *p_color); + int FS450_set_color(int color); + /* color is a percentage, 0 to 100 */ + + int FS450_get_brightness(int *p_brightness); + int FS450_set_brightness(int brightness); + /* brightness is a percentage, 0 to 100 */ + + int FS450_get_contrast(int *p_contrast); + int FS450_set_contrast(int constrast); + /* contrast is a percentage, 0 to 100 */ + +/* ==========================================================================*/ +/* Luma and Chroma filter*/ + + int FS450_get_yc_filter(unsigned int *p_yc_filter); + int FS450_set_yc_filter(unsigned int yc_filter); + /* yc_filter is a bitmask of FS450_LUMA_FILTER and/or FS450_CHROMA_FILTER */ + +/* FS450 Luma and Chroma Filters*/ +#define FS450_LUMA_FILTER 0x0001 +#define FS450_CHROMA_FILTER 0x0002 + +/* ==========================================================================*/ +/* Macrovision*/ + + int FS450_get_aps_trigger_bits(unsigned int *p_trigger_bits); + int FS450_set_aps_trigger_bits(unsigned int trigger_bits); + /* trigger_bits is one of the FS450_APS_TRIGGER constants */ + +/* APS Trigger Bits*/ +#define FS450_APS_TRIGGER_OFF 0 +#define FS450_APS_TRIGGER_AGC_ONLY 1 +#define FS450_APS_TRIGGER_AGC_2_LINE 2 +#define FS450_APS_TRIGGER_AGC_4_LINE 3 + +/* ==========================================================================*/ +/* direct access to Houston and platform registers (debug builds only)*/ +/* The two functions FS450_ReadRegister and FS450_WriteRegister allow access*/ +/* to device registers. These functions are intended for debugging purposes*/ +/* only and should not be included in a shipping product.*/ + +#ifdef FS450_DIRECTREG + +#define SOURCE_HOUSTON 0 +#define SOURCE_GCC 1 + + typedef struct _S_REG_INFO + { + int source; + unsigned int size; + unsigned long offset; + unsigned long value; + } + S_REG_INFO; + + int FS450_ReadRegister(S_REG_INFO * p_reg); + int FS450_WriteRegister(S_REG_INFO * p_reg); + +#endif + +/* ==========================================================================*/ +/* Error Codes*/ + +#define ERR_INVALID_PARAMETER 0x1000 +#define ERR_NOT_SUPPORTED 0x1001 +#define ERR_CANNOT_CHANGE_WHILE_TV_ON 0x1002 + +#define ERR_DRIVER_NOT_FOUND 0x1100 +#define ERR_DRIVER_ERROR 0x1101 +#define ERR_DEVICE_NOT_FOUND 0x1120 + +#define ERR_I2C_MISSING_DEVICE 0x1200 +#define ERR_I2C_WRITE_FAILED 0x1201 +#define ERR_I2C_READ_FAILED 0x1202 + +#ifdef __cplusplus +} +#endif + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs451.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs451.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs451.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,246 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs451.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: tv_fs451.c $ + * $Revision: 3 $ + * + * This file contains routines to control the FS451 tvout encoder. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/*----------------------------------------------------------------------------- + * gfx_set_tv_format + * + * This routine sets the TV encoder registers to the specified format + * and resolution. + * Currently only NTSC 640x480 is supported. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs451_set_tv_format(int format, int resolution) +#else +int +gfx_set_tv_format(int format, int resolution) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_output + * + * This routine sets the TV encoder registers to the specified output type. + * Supported output types are : S-VIDEO and Composite. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs451_set_tv_output(int output) +#else +int +gfx_set_tv_output(int output) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_defaults + * + * This routine sets all of the TV encoder registers to default values for + * the specified format. Currently only NTSC is supported. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs451_set_tv_defaults(int format) +#else +int +gfx_set_tv_defaults(int format) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_enable + * + * This routine enables or disables the TV output. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs451_set_tv_enable(int enable) +#else +int +gfx_set_tv_enable(int enable) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + * + * This routine enables or disables the use of the hardware CC registers + * in the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs451_set_tv_cc_enable(int enable) +#else +int +gfx_set_tv_cc_enable(int enable) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs451_set_tv_cc_data(unsigned char data1, unsigned char data2) +#else +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_geode.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_geode.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_geode.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,125 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_geode.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/*----------------------------------------------------------------------------- + * TV_GEODE.C + * + * Version 1.20 - February 9, 2000 + * + * This file contains routines to program the TV encoder when it is + * integrated onto a Geode processor. + * + * History: + * Initial version ported from code by Ilia Stolov. + * Versions 0.1 through 1.20 by Brian Falardeau. + * + * Copyright (c) 1999-2000 National Semiconductor. + *----------------------------------------------------------------------------- + */ + +/*----------------------------------------------------------------------------- + * gfx_set_tv_defaults + * + * This routine sets all of the TV encoder registers to default values for + * the specified format. Currently only NTSC is supported. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +geode_set_tv_defaults(int format) +#else +int +gfx_set_tv_defaults(int format) +#endif +{ + /* SET DEFAULTS FOR NTSC */ + + WRITE_VID32(SC1400_TVOUT_HORZ_TIM, 0x00790359); + WRITE_VID32(SC1400_TVOUT_HORZ_SYNC, 0x03580350); + WRITE_VID32(SC1400_TVOUT_VERT_SYNC, 0x0A002001); + WRITE_VID32(SC1400_TVOUT_LINE_END, 0x039C00F0); + WRITE_VID32(SC1400_TVOUT_VERT_DOWNSCALE, 0xFFFFFFFF); + WRITE_VID32(SC1400_TVOUT_HORZ_SCALING, 0x10220700); + WRITE_VID32(SC1400_TVOUT_EMMA_BYPASS, 0x0002D0F0); + WRITE_VID32(SC1400_TVENC_TIM_CTRL_1, 0xA2E03000); + WRITE_VID32(SC1400_TVENC_TIM_CTRL_2, 0x1FF20000); + WRITE_VID32(SC1400_TVENC_TIM_CTRL_3, 0x00000000); + WRITE_VID32(SC1400_TVENC_SUB_FREQ, 0x21F12000); + WRITE_VID32(SC1400_TVENC_DISP_POS, 0x00030071); + WRITE_VID32(SC1400_TVENC_DISP_SIZE, 0x00EF02CF); + + /* ### ADD ### DEFAULTS FOR PAL */ + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_enable + * + * This routine enables or disables the TV output. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +geode_set_tv_enable(int enable) +#else +int +gfx_set_tv_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1400_DISPLAY_CONFIG); + if (enable) + value |= SC1400_DCFG_TVOUT_EN; + else + value &= ~(SC1400_DCFG_TVOUT_EN); + WRITE_VID32(SC1400_DISPLAY_CONFIG, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + * + * This routine enables or disables the use of the hardware CC registers + * in the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +geode_set_tv_cc_enable(int enable) +#else +int +gfx_set_tv_cc_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1400_TVENC_CC_CONTROL); + value &= ~(0x0005F); + if (enable) + value |= 0x51; + WRITE_VID32(SC1400_TVENC_CC_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *----------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +geode_set_tv_cc_data(unsigned char data1, unsigned char data2) +#else +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +#endif +{ + unsigned long value; + + value = data1 | (((unsigned long)data2) << 8); + WRITE_VID32(SC1400_TVENC_CC_DATA, value); + return (0); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vga_gu1.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vga_gu1.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vga_gu1.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,705 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vga_gu1.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: vga_gu1.c $ + * + * This file contains routines to set modes using the VGA registers. + * Since this file is for the first generation graphics unit, it interfaces + * to SoftVGA registers. It works for both VSA1 and VSA2. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* SoftVGA Extended CRTC register indices and bit definitions */ + +#define CRTC_EXTENDED_REGISTER_LOCK 0x30 +#define CRTC_MODE_SWITCH_CONTROL 0x3F + +/* BIT DEFINITIONS */ + +#define CRTC_BIT_16BPP 0x01 +#define CRTC_BIT_555 0x02 + +/* LOCAL ROUTINE DEFINITIONS */ + +int gu1_detect_vsa2(void); + +/*---------------------------------*/ +/* MODE TABLES FOR VGA REGISTERS */ +/*---------------------------------*/ + +/* FOR SoftVGA, the CRTC_EXTENDED_ADDRESS_CONTROL (0x43) is always equal to + * 0x03 for a packed linear frame buffer organization. The + * CRTC_EXTENDED_DAC_CONTROL (0x4B) is always equal to 0x03 to work with + * older versions of VSA1 (that needed to specify 8 or 16 bit bus to an + * external RAMDAC. This is not used in VSA2. The clock frequency is + * specified in register 0x4D if clock control (0x4C) is set to 0x80. + * Higher resolutions (1280x1024) use the CRTC_EXTENDED_VERTICAL_TIMING + * register (index 0x41). + */ + +gfx_vga_struct gfx_vga_modes[] = { +/*------------------------------------------------------------------------------*/ + {640, 480, 60, /* 640x480 */ + 25, /* 25 MHz clock = 60 Hz refresh rate */ + 0xE3, /* miscOutput register */ + {0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, /* standard CRTC */ + 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xEA, 0x0C, 0xDF, 0x50, 0x00, 0xE7, 0x04, 0xE3, 0xFF}, + {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {640, 480, 72, /* 640x480 */ + 29, /* 29 MHz clock = 72 Hz refresh rate */ + 0xE3, /* miscOutput register */ + {0x63, 0x4f, 0x50, 0x86, 0x55, 0x99, 0x06, 0x3e, /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe9, 0x0c, 0xdf, 0x00, 0x00, 0xe7, 0x00, 0xe3, 0xff}, + {0x6D, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x01, 0x08, 0x80, 0x1F, 0x00, 0x4B}}, +/*------------------------------------------------------------------------------*/ + {640, 480, 75, /* 640x480 */ + 31, /* 31.5 MHz clock = 75 Hz refresh rate */ + 0xE3, /* miscOutput register */ + {0x64, 0x4F, 0x4F, 0x88, 0x54, 0x9B, 0xF2, 0x1F, /* standard CRTC */ + 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE1, 0x04, 0xDF, 0x50, 0x00, 0xDF, 0xF3, 0xE3, 0xFF}, + {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x1F, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {800, 600, 60, /* 800x600 */ + 40, /* 40 MHz clock = 60 Hz refresh rate */ + 0x23, /* miscOutput register */ + {0x7F, 0x63, 0x64, 0x82, 0x6B, 0x1B, 0x72, 0xF0, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x0D, 0x57, 0x64, 0x00, 0x57, 0x73, 0xE3, 0xFF}, + {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x28, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {800, 600, 72, /* 800x600 */ + 47, /* 47 MHz clock = 72 Hz refresh rate */ + 0x2B, /* miscOutput register */ + {0x7D, 0x63, 0x63, 0x81, 0x6D, 0x1B, 0x98, 0xF0, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7D, 0x03, 0x57, 0x00, 0x00, 0x57, 0x9A, 0xE3, 0xFF}, + {0x6F, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x01, 0x08, 0x80, 0x32, 0x00, 0x4B}}, +/*------------------------------------------------------------------------------*/ + {800, 600, 75, /* 800x600 */ + 49, /* 49.5 MHz clock = 75 Hz refresh rate */ + 0x23, /* miscOutput register */ + {0x7F, 0x63, 0x63, 0x83, 0x68, 0x11, 0x6F, 0xF0, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x1C, 0x57, 0x64, 0x00, 0x57, 0x70, 0xE3, 0xFF}, + {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x31, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {1024, 768, 60, /* 1024x768 */ + 65, /* 65 MHz clock = 60 Hz refresh rate */ + 0xE3, /* miscOutput register */ + {0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xF5, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x0A, 0xFF, 0x80, 0x00, 0xFF, 0x25, 0xE3, 0xFF}, + {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x41, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {1024, 768, 70, /* 1024x768 */ + 76, /* 76 MHz clock = 70 Hz refresh rate */ + 0x2B, /* miscOutput register */ + {0xA1, 0x7F, 0x7F, 0x85, 0x85, 0x95, 0x24, 0xF5, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x00, 0x00, 0xFF, 0x26, 0xE3, 0xFF}, + {0x62, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x01, 0x02, 0x80, 0x4B, 0x00, 0x4B}}, +/*------------------------------------------------------------------------------*/ + {1024, 768, 75, /* 1024x768 */ + 79, /* 79 MHz clock = 75 Hz refresh rate */ + 0xE3, /* miscOutput register */ + {0x9F, 0x7F, 0x7F, 0x83, 0x84, 0x8F, 0x1E, 0xF5, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0x80, 0x00, 0xFF, 0x1F, 0xE3, 0xFF}, + {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x4F, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {1280, 1024, 60, /* 1280x1024 */ + 108, /* 108 MHz clock = 60 Hz refresh rate */ + 0x23, /* miscOutput register */ + {0xCF, 0x9F, 0xA0, 0x92, 0xAA, 0x19, 0x28, 0x52, /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, + {0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x6C, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {1280, 1024, 75, /* 1280x1024 */ + 135, /* 135 MHz clock = 75 Hz refresh rate */ + 0x23, /* miscOutput register */ + {0xCE, 0x9F, 0x9F, 0x92, 0xA4, 0x15, 0x28, 0x52, /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, + {0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x87, 0x00, 0x00}}, +/*------------------------------------------------------------------------------*/ + {1280, 1024, 85, /* 1280x1024 */ + 159, /* 159 MHz clock = 85 Hz refresh rate */ + 0x2B, /* miscOutput register */ + {0xD3, 0x9F, 0xA0, 0x98, 0xA8, 0x9C, 0x2E, 0x5A, /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0x00, 0x00, 0xFF, 0x30, 0xE3, 0xFF}, + {0x6B, 0x41, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, /* extended CRTC */ + 0x00, 0x00, 0x01, 0x00, 0x80, 0x9D, 0x00, 0x4B}}, + +/*------------------------------------------------------------------------------*/ +}; + +#define GFX_VGA_MODES sizeof(gfx_vga_modes)/sizeof(gfx_vga_struct) + +/*----------------------------------------------------------------------------- + * gfx_get_softvga_active + * + * This returns the active status of SoftVGA + *----------------------------------------------------------------------------- + */ +int +gfx_get_softvga_active(void) +{ + unsigned short crtcindex, crtcdata; + + if (gu1_detect_vsa2()) + return (gfx_get_vsa2_softvga_enable()); + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + OUTB(crtcindex, CRTC_MODE_SWITCH_CONTROL); + return (INB(crtcdata) & 0x1); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_test_pci + * + * This routine looks for the VGA PCI header. It checks to see that bit 1 + * of the command register is writable to know that SoftVGA is trapping + * the PCI config cuscles. If SoftVGA is not emulating the header, the + * hardware will still respond with the proper device ID, etc. + * + * We need to know that SoftVGA is really there so that we can set the + * command register and have the proper effect (enable trapping of VGA). + * Otherwise, if we enable VGA via the PCI header, trapping really won't be + * enabled and the VGA register writes will go out to the external card. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_test_pci(void) +{ + int softvga = 1; + unsigned long value; + + value = gfx_pci_config_read(0x80009400); + if ((value & 0x0000FFFF) != 0x1078) + softvga = 0; + else { + value = gfx_pci_config_read(0x80009404); + gfx_pci_config_write(0x80009404, value | 0x02); + if (!(gfx_pci_config_read(0x80009404) & 0x02)) + softvga = 0; + gfx_pci_config_write(0x80009404, value); + } + return (softvga); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_get_pci_command + * + * This routine returns the value of the PCI command register. + *----------------------------------------------------------------------------- + */ +unsigned char +gfx_vga_get_pci_command(void) +{ + unsigned long value; + + value = gfx_pci_config_read(0x80009404); + return ((unsigned char)value); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_set_pci_command + * + * This routine writes the value of the PCI command register. It is used + * to enable or disable SoftVGA. + * + * Bit 0: Enable VGA IO + * Bit 1: Enable VGA memory + *----------------------------------------------------------------------------- + */ +int +gfx_vga_set_pci_command(unsigned char command) +{ + unsigned long value; + + value = gfx_pci_config_read(0x80009404) & 0xFFFFFF00; + value |= (unsigned long)command; + gfx_pci_config_write(0x80009404, value); + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_seq_reset + * + * This routine enables or disables SoftVGA. It is used to make SoftVGA + * "be quiet" and not interfere with any of the direct hardware access from + * Durango. For VSA1, the sequencer is reset to stop text redraws. VSA2 may + * provide a better way to have SoftVGA sit in the background. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_seq_reset(int reset) +{ + OUTB(0x3C4, 0); + OUTB(0x3C5, (unsigned char)(reset ? 0x00 : 0x03)); + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_set_graphics_bits + * + * This routine sets the standard VGA sequencer, graphics controller, and + * attribute registers to appropriate values for a graphics mode (packed, + * 8 BPP or greater). This is also known as "VESA" modes. The timings for + * a particular mode are handled by the CRTC registers, which are set by + * the "gfx_vga_restore" routine. Most OSs that use VGA to set modes save + * and restore the standard VGA registers themselves, which is why these + * registers are not part of the save/restore paradigm. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_set_graphics_bits(void) +{ + /* SET GRAPHICS BIT IN GRAPHICS CONTROLLER REG 0x06 */ + + OUTB(0x3CE, 0x06); + OUTB(0x3CF, 0x01); + + /* SET GRAPHICS BIT IN ATTRIBUTE CONTROLLER REG 0x10 */ + + INB(0x3BA); /* Reset flip-flop */ + INB(0x3DA); + OUTB(0x3C0, 0x10); + OUTB(0x3C0, 0x01); + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_mode + * + * This routine searches the VGA mode table for a match of the specified + * mode and then fills in the VGA structure with the associated VGA register + * values. The "gfx_vga_restore" routine can then be called to actually + * set the mode. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, int hz) +{ + unsigned int i; + unsigned short pitch; + + for (i = 0; i < GFX_VGA_MODES; i++) { + if ((gfx_vga_modes[i].xsize == xres) && + (gfx_vga_modes[i].ysize == yres) && (gfx_vga_modes[i].hz == hz)) { + /* COPY ENTIRE STRUCTURE FROM THE TABLE */ + + *vga = gfx_vga_modes[i]; + + /* SET PITCH TO 1K OR 2K */ + /* CRTC_EXTENDED_OFFSET index is 0x45, so offset = 0x05 */ + + pitch = (unsigned short)xres; + if (bpp > 8) + pitch <<= 1; + if (pitch <= 1024) + pitch = 1024 >> 3; + else + pitch = 2048 >> 3; + vga->stdCRTCregs[0x13] = (unsigned char)pitch; + vga->extCRTCregs[0x05] = (unsigned char)((pitch >> 8) & 0x03); + + /* SET PROPER COLOR DEPTH VALUE */ + /* CRTC_EXTENDED_COLOR_CONTROL index is 0x46, so offset = 0x06 */ + + switch (bpp) { + case 15: + vga->extCRTCregs[0x06] = CRTC_BIT_16BPP | CRTC_BIT_555; + break; + case 16: + vga->extCRTCregs[0x06] = CRTC_BIT_16BPP; + break; + default: + vga->extCRTCregs[0x06] = 0; + break; + } + return (GFX_STATUS_OK); + } + } + return (GFX_STATUS_UNSUPPORTED); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_pitch + * + * This routine updates the VGA regisers in the specified VGA structure for + * the specified pitch. It does not program the hardware. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch) +{ + pitch >>= 3; + vga->stdCRTCregs[0x13] = (unsigned char)pitch; + vga->extCRTCregs[0x05] = (unsigned char)((pitch >> 8) & 0x03); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_save + * + * This routine saves the state of the VGA registers into the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_save(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GFX_VGA_FLAG_MISC_OUTPUT) { + /* SAVE MISCCELLANEOUS OUTPUT REGISTER */ + + vga->miscOutput = INB(0x3CC); + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_STD_CRTC) { + /* SAVE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GFX_STD_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)i); + vga->stdCRTCregs[i] = INB(crtcdata); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_EXT_CRTC) { + /* SAVE EXTENDED CRTC REGISTERS */ + + for (i = 0; i < GFX_EXT_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)(0x40 + i)); + vga->extCRTCregs[i] = INB(crtcdata); + } + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_clear_extended + * + * This routine clears the extended SoftVGA register values to have SoftVGA + * behave like standard VGA. + *----------------------------------------------------------------------------- + */ +void +gfx_vga_clear_extended(void) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x57); + OUTB(crtcdata, 0x4C); + for (i = 0x40; i <= 0x4F; i++) { + OUTB(crtcindex, (unsigned char)i); + OUTB(crtcdata, 0); + } + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x00); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_restore + * + * This routine restores the state of the VGA registers from the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_restore(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GFX_VGA_FLAG_MISC_OUTPUT) { + /* RESTORE MISCELLANEOUS OUTPUT REGISTER VALUE */ + + OUTB(0x3C2, vga->miscOutput); + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_STD_CRTC) { + /* UNLOCK STANDARD CRTC REGISTERS */ + + OUTB(crtcindex, 0x11); + OUTB(crtcdata, 0); + + /* RESTORE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GFX_STD_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)i); + OUTB(crtcdata, vga->stdCRTCregs[i]); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_EXT_CRTC) { + /* UNLOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x57); + OUTB(crtcdata, 0x4C); + + /* RESTORE EXTENDED CRTC REGISTERS */ + + for (i = 0; i < GFX_EXT_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)(0x40 + i)); + OUTB(crtcdata, vga->extCRTCregs[i]); + } + + /* LOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x00); + + /* CHECK IF DIRECT FRAME BUFFER MODE (VESA MODE) */ + + if (vga->extCRTCregs[0x03] & 1) { + /* SET BORDER COLOR TO BLACK */ + /* This really should be another thing saved/restored, but */ + /* Durango currently doesn't do the attr controller registers. */ + + INB(0x3BA); /* Reset flip-flop */ + INB(0x3DA); + OUTB(0x3C0, 0x11); + OUTB(0x3C0, 0x00); + } + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_vga_mode_switch + * + * This routine programs the SoftVGA register to indicate that a mode switch + * is in progress. This results in a cleaner mode switch since SoftVGA will + * not validate the hardware with intermediate values. + *----------------------------------------------------------------------------- + */ +int +gfx_vga_mode_switch(int active) +{ + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* UNLOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, CRTC_EXTENDED_REGISTER_LOCK); + OUTB(crtcdata, 0x57); + OUTB(crtcdata, 0x4C); + + /* SIGNAL THE BEGINNING OR END OF THE MODE SWITCH */ + /* SoftVGA will hold off validating the back end hardware. */ + + OUTB(crtcindex, CRTC_MODE_SWITCH_CONTROL); + active = active ? 1 : 0; + OUTB(crtcdata, (unsigned char)active); + + /* WAIT UNTIL SOFTVGA HAS VALIDATED MODE IF ENDING MODE SWITCH */ + /* This is for VSA1 only, where SoftVGA waits until the next */ + /* vertical blank to validate the hardware state. */ + + if ((!active) && (!(gu1_detect_vsa2()))) { + OUTB(crtcindex, 0x33); + while (INB(crtcdata) & 0x80) ; + } + + /* LOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, CRTC_EXTENDED_REGISTER_LOCK); + OUTB(crtcdata, 0x00); + return (0); +} + +/*----------------------------------------------------------------------------- + * gu1_detect_vsa2 + * + * This routine detects if VSA2 is present. The interface to SoftVGA + * changed slightly. + *----------------------------------------------------------------------------- + */ +int +gu1_detect_vsa2(void) +{ + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + OUTB(crtcindex, 0x35); + if (INB(crtcdata) != 'C') + return (0); + OUTB(crtcindex, 0x36); + if (INB(crtcdata) != 'X') + return (0); + return (1); +} + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1200.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1200.c:1.2 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1200.c Tue Jan 14 04:34:34 2003 @@ -0,0 +1,2930 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1200.c,v 1.2 2003/01/14 09:34:34 alanh Exp $ */ +/* + * $Workfile: vid_1200.c $ + * + * This file contains routines to control the SC1200 video overlay hardware. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/*---------------------------------------------------------------------------- + * SC1200 PLL TABLE + *---------------------------------------------------------------------------- + */ + +typedef struct tagSC1200PLL +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long clock_select; /* clock select register (0x2C) */ +} +SC1200PLL; + +SC1200PLL gfx_sc1200_clock_table[] = { + {(25L << 16) | ((1750L * 65536L) / 10000L), 0x0070E00C}, /* 25.1750 (sc=24.9231) */ + {(27L << 16) | ((0000L * 65536L) / 10000L), 0x00300100}, /* 27.0000 */ + {(28L << 16) | ((3220L * 65536L) / 10000L), 0x0070EC0C}, /* 28.3220 (SC=27.000) */ + {(31L << 16) | ((5000L * 65536L) / 10000L), 0x00500D02}, /* 31.5000 */ + {(36L << 16) | ((0000L * 65536L) / 10000L), 0x00500F02}, /* 36.0000 */ + {(37L << 16) | ((5000L * 65536L) / 10000L), 0x0050B108}, /* 37.5000 */ + {(40L << 16) | ((0000L * 65536L) / 10000L), 0x0050D20D}, /* 40.0000 */ + {(44L << 16) | ((9000L * 65536L) / 10000L), 0x0050DC0D}, /* 44.9000 */ + {(49L << 16) | ((5000L * 65536L) / 10000L), 0x00501502}, /* 49.5000 */ + {(50L << 16) | ((0000L * 65536L) / 10000L), 0x0050A404}, /* 50.0000 */ + {(50L << 16) | ((3500L * 65536L) / 10000L), 0x0050E00C}, /* 50.3500 */ + {(54L << 16) | ((0000L * 65536L) / 10000L), 0x00300300}, /* 54.0000 */ + {(56L << 16) | ((3916L * 65536L) / 10000L), 0x0050F40D}, /* 56.3916 */ + {(56L << 16) | ((6440L * 65536L) / 10000L), 0x0050EC0C}, /* 56.6440 */ + {(59L << 16) | ((0000L * 65536L) / 10000L), 0x0030A207}, /* 59.0000 */ + {(63L << 16) | ((0000L * 65536L) / 10000L), 0x00300D02}, /* 63.0000 */ + {(65L << 16) | ((0000L * 65536L) / 10000L), 0x0030CC0F}, /* 65.0000 */ + {(67L << 16) | ((5000L * 65536L) / 10000L), 0x00300400}, /* 67.5000 */ + {(70L << 16) | ((8000L * 65536L) / 10000L), 0x00301403}, /* 70.8000 */ + {(72L << 16) | ((0000L * 65536L) / 10000L), 0x00300F02}, /* 72.0000 */ + {(75L << 16) | ((0000L * 65536L) / 10000L), 0x0030B108}, /* 75.0000 */ + {(78L << 16) | ((7500L * 65536L) / 10000L), 0x0030A205}, /* 78.7500 */ + {(80L << 16) | ((0000L * 65536L) / 10000L), 0x0030D20D}, /* 80.0000 */ + {(87L << 16) | ((2728L * 65536L) / 10000L), 0x0030E00E}, /* 87.2728 */ + {(89L << 16) | ((8000L * 65536L) / 10000L), 0x0030DC0D}, /* 89.8000 */ + {(94L << 16) | ((5000L * 65536L) / 10000L), 0x00300600}, /* 99.0000 */ + {(99L << 16) | ((0000L * 65536L) / 10000L), 0x00301502}, /* 99.0000 */ + {(100L << 16) | ((0000L * 65536L) / 10000L), 0x0030A404}, /* 100.00 */ + {(108L << 16) | ((0000L * 65536L) / 10000L), 0x00100300}, /* 108.00 */ + {(112L << 16) | ((5000L * 65536L) / 10000L), 0x00301802}, /* 108.00 */ + {(130L << 16) | ((0000L * 65536L) / 10000L), 0x0010CC0F}, /* 130.00 */ + {(135L << 16) | ((0000L * 65536L) / 10000L), 0x00100400}, /* 135.00 */ + {(157L << 16) | ((5000L * 65536L) / 10000L), 0x0010A205}, /* 157.50 */ + {(162L << 16) | ((0000L * 65536L) / 10000L), 0x00100500}, /* 162.00 */ + {(175L << 16) | ((0000L * 65536L) / 10000L), 0x0010E00E}, /* 175.50 */ + {(189L << 16) | ((0000L * 65536L) / 10000L), 0x00100600}, /* 189.00 */ + {(202L << 16) | ((0000L * 65536L) / 10000L), 0x0010EF0E}, /* 202.50 */ + {(232L << 16) | ((0000L * 65536L) / 10000L), 0x0010AA04}, /* 232.50 */ + + /* Precomputed inidces in the hardware */ + {0x0018EC4D, 0x000F0000}, /* 24.923052 */ + {0x00192CCC, 0x00000000}, /* 25.1750 */ + {0x001B0000, 0x00300100}, /* 27.0000 */ + {0x001F8000, 0x00010000}, /* 31.5000 */ + {0x00240000, 0x00020000}, /* 36.0000 */ + {0x00280000, 0x00030000}, /* 40.0000 */ + {0x00318000, 0x00050000}, /* 49.5000 */ + {0x00320000, 0x00040000}, /* 50.0000 */ + {0x00384000, 0x00060000}, /* 56.2500 */ + {0x00410000, 0x00080000}, /* 65.0000 */ + {0x004E8000, 0x000A0000}, /* 78.5000 */ + {0x005E8000, 0x000B0000}, /* 94.5000 */ + {0x006C0000, 0x000C0000}, /* 108.0000 */ + {0x00870000, 0x000D0000}, /* 135.0000 */ +}; + +#define NUM_SC1200_FREQUENCIES sizeof(gfx_sc1200_clock_table)/sizeof(SC1200PLL) + +int sc1200_set_video_enable(int enable); +int sc1200_set_video_format(unsigned long format); +int sc1200_set_video_size(unsigned short width, unsigned short height); +int sc1200_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); +int sc1200_set_video_offset(unsigned long offset); +int sc1200_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset); +int sc1200_set_video_window(short x, short y, unsigned short w, + unsigned short h); +int sc1200_set_video_left_crop(unsigned short x); +int sc1200_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int sc1200_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int sc1200_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth); +void sc1200_set_video_vertical_downscale_enable(int enable); +int sc1200_set_video_downscale_config(unsigned short type, unsigned short m); +int sc1200_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); +int sc1200_set_video_filter(int xfilter, int yfilter); +int sc1200_set_video_palette(unsigned long *palette); +int sc1200_set_video_palette_entry(unsigned long index, unsigned long color); +int sc1200_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); +int sc1200_set_video_downscale_enable(int enable); +int sc1200_set_video_source(VideoSourceType source); +int sc1200_set_vbi_source(VbiSourceType source); +int sc1200_set_vbi_lines(unsigned long even, unsigned long odd); +int sc1200_set_vbi_total(unsigned long even, unsigned long odd); +int sc1200_set_video_interlaced(int enable); +int sc1200_set_color_space_YUV(int enable); +int sc1200_set_vertical_scaler_offset(char offset); +int sc1200_set_top_line_in_odd(int enable); +int sc1200_set_genlock_delay(unsigned long delay); +int sc1200_set_genlock_enable(int flags); +int sc1200_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, + unsigned long color1, unsigned long color2); +int sc1200_set_video_cursor_enable(int enable); +int sc1200_set_video_request(short x, short y); + +int sc1200_select_alpha_region(int region); +int sc1200_set_alpha_enable(int enable); +int sc1200_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); +int sc1200_set_alpha_value(unsigned char alpha, char delta); +int sc1200_set_alpha_priority(int priority); +int sc1200_set_alpha_color(unsigned long color); +int sc1200_set_alpha_color_enable(int enable); +int sc1200_set_no_ck_outside_alpha(int enable); +int sc1200_disable_softvga(void); +int sc1200_enable_softvga(void); +int sc1200_set_macrovision_enable(int enable); +void sc1200_reset_video(void); +int sc1200_set_display_control(int sync_polarities); +void sc1200_set_clock_frequency(unsigned long frequency); +int sc1200_set_screen_enable(int enable); +int sc1200_set_crt_enable(int enable); + +/* READ ROUTINES IN GFX_VID.C */ + +int sc1200_get_video_enable(void); +int sc1200_get_video_format(void); +unsigned long sc1200_get_video_src_size(void); +unsigned long sc1200_get_video_line_size(void); +unsigned long sc1200_get_video_xclip(void); +unsigned long sc1200_get_video_offset(void); +void sc1200_get_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset); +void sc1200_get_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long sc1200_get_video_upscale(void); +unsigned long sc1200_get_video_scale(void); +unsigned long sc1200_get_video_downscale_delta(void); +int sc1200_get_video_vertical_downscale_enable(void); +int sc1200_get_video_downscale_config(unsigned short *type, + unsigned short *m); +void sc1200_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); +void sc1200_get_video_downscale_enable(int *enable); +unsigned long sc1200_get_video_dst_size(void); +unsigned long sc1200_get_video_position(void); +unsigned long sc1200_get_video_color_key(void); +unsigned long sc1200_get_video_color_key_mask(void); +int sc1200_get_video_palette_entry(unsigned long index, + unsigned long *palette); +int sc1200_get_video_color_key_src(void); +int sc1200_get_video_filter(void); +int sc1200_get_video_request(short *x, short *y); +int sc1200_get_video_source(VideoSourceType * source); +int sc1200_get_vbi_source(VbiSourceType * source); +unsigned long sc1200_get_vbi_lines(int odd); +unsigned long sc1200_get_vbi_total(int odd); +int sc1200_get_video_interlaced(void); +int sc1200_get_color_space_YUV(void); +int sc1200_get_vertical_scaler_offset(char *offset); +unsigned long sc1200_get_genlock_delay(void); +int sc1200_get_genlock_enable(void); +int sc1200_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); +unsigned long sc1200_read_crc(void); +unsigned long sc1200_read_crc32(void); +unsigned long sc1200_read_window_crc(int source, unsigned short x, + unsigned short y, unsigned short width, + unsigned short height, int crc32); +int sc1200_get_macrovision_enable(void); + +void sc1200_get_alpha_enable(int *enable); +void sc1200_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); +void sc1200_get_alpha_value(unsigned char *alpha, char *delta); +void sc1200_get_alpha_priority(int *priority); +void sc1200_get_alpha_color(unsigned long *color); +unsigned long sc1200_get_clock_frequency(void); +int sc1200_get_vsa2_softvga_enable(void); +int sc1200_get_sync_polarities(void); + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + int i; + + gfx_set_video_enable(0); + + /* SET WINDOW 0 AFTER RESET */ + + for (i = 2; i >= 0; i--) { + gfx_select_alpha_region(i); + gfx_set_alpha_enable(0); + gfx_set_alpha_color_enable(0); + } +} + +/*----------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine configures the display output. + * + * "sync_polarities" is used to set the polarities of the sync pulses according + * to the following mask: + * + * Bit 0: If set to 1, negative horizontal polarity is programmed, + * otherwise positive horizontal polarity is programmed. + * Bit 1: If set to 1, negative vertical polarity is programmed, + * otherwise positive vertical polarity is programmed. + * + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_display_control(int sync_polarities) +#else +int +gfx_set_display_control(int sync_polarities) +#endif +{ + unsigned long dcfg; + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + dcfg &= ~(SC1200_DCFG_CRT_SYNC_SKW_MASK | SC1200_DCFG_PWR_SEQ_DLY_MASK | + SC1200_DCFG_CRT_HSYNC_POL | SC1200_DCFG_CRT_VSYNC_POL | + SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + + dcfg |= (SC1200_DCFG_CRT_SYNC_SKW_INIT | + SC1200_DCFG_PWR_SEQ_DLY_INIT | SC1200_DCFG_GV_PAL_BYP); + + if (PanelEnable) + dcfg |= SC1200_DCFG_FP_PWR_EN; + + /* SET APPROPRIATE SYNC POLARITIES */ + + if (sync_polarities & 0x1) + dcfg |= SC1200_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 0x2) + dcfg |= SC1200_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value, pll; + long min, diff; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = gfx_sc1200_clock_table[0].clock_select; + min = (long)gfx_sc1200_clock_table[0].frequency - frequency; + if (min < 0L) + min = -min; + for (index = 1; index < NUM_SC1200_FREQUENCIES; index++) { + diff = (long)gfx_sc1200_clock_table[index].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + value = gfx_sc1200_clock_table[index].clock_select; + } + } + + /* SET THE DOT CLOCK REGISTER */ + + pll = READ_VID32(SC1200_VID_MISC); + WRITE_VID32(SC1200_VID_MISC, pll | SC1200_PLL_POWER_NORMAL); + WRITE_VID32(SC1200_VID_CLOCK_SELECT, value); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_screen_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine enables or disables the graphics display logic of the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_screen_enable(int enable) +#else +int +gfx_set_screen_enable(int enable) +#endif +{ + unsigned long config; + + config = READ_VID32(SC1200_DISPLAY_CONFIG); + if (enable) + WRITE_VID32(SC1200_DISPLAY_CONFIG, config | SC1200_DCFG_DIS_EN); + else + WRITE_VID32(SC1200_DISPLAY_CONFIG, config & ~SC1200_DCFG_DIS_EN); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_crt_enable + * + * This routine enables or disables the CRT output from the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_crt_enable(int enable) +#else +int +gfx_set_crt_enable(int enable) +#endif +{ + unsigned long config, misc; + + config = READ_VID32(SC1200_DISPLAY_CONFIG); + misc = READ_VID32(SC1200_VID_MISC); + + /* + * IMPORTANT: For all modes do NOT disable the graphics display logic + * because it might be needed for TV + */ + + switch (enable) { + case CRT_DISABLE: /* HSync:Off VSync:Off */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, config & ~(SC1200_DCFG_HSYNC_EN + | SC1200_DCFG_VSYNC_EN + | SC1200_DCFG_DAC_BL_EN)); + WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); + break; + case CRT_ENABLE: /* Enable CRT display, including display logic */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, config | SC1200_DCFG_HSYNC_EN + | SC1200_DCFG_VSYNC_EN | SC1200_DCFG_DAC_BL_EN); + WRITE_VID32(SC1200_VID_MISC, misc & ~SC1200_DAC_POWER_DOWN); + + /* ENABLE GRAPHICS DISPLAY LOGIC */ + gfx_set_screen_enable(1); + break; + case CRT_STANDBY: /* HSync:Off VSync:On */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, (config & ~(SC1200_DCFG_HSYNC_EN + | SC1200_DCFG_DAC_BL_EN)) + | SC1200_DCFG_VSYNC_EN); + WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); + break; + case CRT_SUSPEND: /* HSync:On VSync:Off */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, (config & ~(SC1200_DCFG_VSYNC_EN + | SC1200_DCFG_DAC_BL_EN)) + | SC1200_DCFG_HSYNC_EN); + WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + if (enable) { + /* ENABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(1); + + /* ENABLE SC1200 VIDEO OVERLAY */ + + vcfg |= SC1200_VCFG_VID_EN; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE SC1200 VIDEO OVERLAY */ + + vcfg &= ~SC1200_VCFG_VID_EN; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + + /* DISABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(0); + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_format + * + * Sets input video format type, to one of the YUV formats or to RGB. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long ctrl, vcfg = 0; + + /* SET THE SC1200 VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + ctrl = READ_VID32(SC1200_VID_ALPHA_CONTROL); + ctrl &= ~(SC1200_VIDEO_INPUT_IS_RGB); + vcfg &= ~(SC1200_VCFG_VID_INP_FORMAT | SC1200_VCFG_4_2_0_MODE); + switch (format) { + case VIDEO_FORMAT_UYVY: + vcfg |= SC1200_VCFG_UYVY_FORMAT; + break; + case VIDEO_FORMAT_YUYV: + vcfg |= SC1200_VCFG_YUYV_FORMAT; + break; + case VIDEO_FORMAT_Y2YU: + vcfg |= SC1200_VCFG_Y2YU_FORMAT; + break; + case VIDEO_FORMAT_YVYU: + vcfg |= SC1200_VCFG_YVYU_FORMAT; + break; + case VIDEO_FORMAT_Y0Y1Y2Y3: + vcfg |= SC1200_VCFG_UYVY_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y3Y2Y1Y0: + vcfg |= SC1200_VCFG_Y2YU_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y0Y3Y2: + vcfg |= SC1200_VCFG_YUYV_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y2Y3Y0: + vcfg |= SC1200_VCFG_YVYU_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_RGB: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_UYVY_FORMAT; + break; + case VIDEO_FORMAT_P2M_P2L_P1M_P1L: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_Y2YU_FORMAT; + break; + case VIDEO_FORMAT_P1M_P1L_P2M_P2L: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_YUYV_FORMAT; + break; + case VIDEO_FORMAT_P1M_P2L_P2M_P1L: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_YVYU_FORMAT; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + + /* ALWAYS DISABLE GRAPHICS CSC */ + /* This is enabled in the function gfx_set_color_space_YUV for */ + /* YUV blending on TV. */ + + ctrl &= ~SC1200_CSC_GFX_RGB_TO_YUV; + + if (ctrl & SC1200_VIDEO_INPUT_IS_RGB) + ctrl &= ~SC1200_CSC_VIDEO_YUV_TO_RGB; + else + ctrl |= SC1200_CSC_VIDEO_YUV_TO_RGB; + + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, ctrl); + + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg; + + /* SET THE SC1200 VIDEO LINE SIZE */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + vcfg &= ~(SC1200_VCFG_LINE_SIZE_LOWER_MASK | SC1200_VCFG_LINE_SIZE_UPPER); + size = (width >> 1); + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= SC1200_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + + /* SET TOTAL VIDEO BUFFER SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + /* Add 1 line to bypass issue #803 */ + gfx_set_display_video_size(width, (unsigned short)(height + 2)); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_upscale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS (unless don't-care zero destination arguments are used) */ + /* These are needed for clipping the video window later. */ + + if (dstw != 0) { + gfx_vid_srcw = srcw; + gfx_vid_dstw = dstw; + } + if (dsth != 0) { + gfx_vid_srch = srch; + gfx_vid_dsth = dsth; + } + + /* CALCULATE SC1200 SCALE FACTORS */ + + if (dstw == 0) + xscale = READ_VID32(SC1200_VIDEO_UPSCALE) & 0xffff; /* keep previous if don't-care argument */ + else if (dstw <= srcw) + xscale = 0x2000l; /* horizontal downscaling is currently done in a separate function */ + else if ((srcw == 1) || (dstw == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + xscale = (0x2000l * (srcw - 1l)) / (dstw - 1l); + + if (dsth == 0) + yscale = (READ_VID32(SC1200_VIDEO_UPSCALE) & 0xffff0000) >> 16; /* keep previous if don't-care argument */ + else if (dsth <= srch) + yscale = 0x2000l; /* No vertical downscaling in SC1200 so force to 1x if attempted */ + else if ((srch == 1) || (dsth == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + yscale = (0x2000l * (srch - 1l)) / (dsth - 1l); + + WRITE_VID32(SC1200_VIDEO_UPSCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values effect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + return gfx_set_video_upscale(srcw, srch, dstw, dsth); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_config + * + * This routine sets the downscale type and factor for the video overlay window. + * Note: No downscaling support for RGB565 and YUV420 video formats. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_downscale_config(unsigned short type, unsigned short m) +#else +int +gfx_set_video_downscale_config(unsigned short type, unsigned short m) +#endif +{ + unsigned long downscale; + + if ((m < 1) || (m > 16)) + return GFX_STATUS_BAD_PARAMETER; + + downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); + downscale &= + ~(SC1200_VIDEO_DOWNSCALE_FACTOR_MASK | + SC1200_VIDEO_DOWNSCALE_TYPE_MASK); + downscale |= ((m - 1l) << SC1200_VIDEO_DOWNSCALE_FACTOR_POS); + switch (type) { + case VIDEO_DOWNSCALE_KEEP_1_OF: + downscale |= SC1200_VIDEO_DOWNSCALE_TYPE_A; + break; + case VIDEO_DOWNSCALE_DROP_1_OF: + downscale |= SC1200_VIDEO_DOWNSCALE_TYPE_B; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_coefficients + * + * This routine sets the downscale filter coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) +#else +int +gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) +#endif +{ + if ((coef1 + coef2 + coef3 + coef4) != 16) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(SC1200_VIDEO_DOWNSCALER_COEFFICIENTS, + ((unsigned long)coef1 << SC1200_VIDEO_DOWNSCALER_COEF1_POS) | + ((unsigned long)coef2 << SC1200_VIDEO_DOWNSCALER_COEF2_POS) | + ((unsigned long)coef3 << SC1200_VIDEO_DOWNSCALER_COEF3_POS) | + ((unsigned long)coef4 << SC1200_VIDEO_DOWNSCALER_COEF4_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_enable + * + * This routine enables or disables downscaling for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_downscale_enable(int enable) +#else +int +gfx_set_video_downscale_enable(int enable) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); + downscale &= ~SC1200_VIDEO_DOWNSCALE_ENABLE; + if (enable) + downscale |= SC1200_VIDEO_DOWNSCALE_ENABLE; + WRITE_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * y position is specified in screen relative coordinates, and may be negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + * For the effect of negative x values, call the function + * gfx_set_video_left_crop(). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_window(short x, short y, unsigned short w, unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long control; + unsigned long hadjust, vadjust; + unsigned long xstart, ystart, xend, yend; + + /* For left cropping call the function gfx_set_video_left_crop() */ + + if (x < 0) + return GFX_STATUS_BAD_PARAMETER; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + /* In the case of SC1200 they are also needed for restoring when video is re-enabled */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 14l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + + /* HORIZONTAL START */ + + xstart = (unsigned long)x + hadjust; + + /* HORIZONTAL END */ + /* End positions in register are non-inclusive (one more than the actual end) */ + + if ((x + w) < gfx_get_hactive()) + xend = (unsigned long)x + (unsigned long)w + hadjust; + else /* right clipping needed */ + xend = (unsigned long)gfx_get_hactive() + hadjust; + + /* VERTICAL START */ + + ystart = (unsigned long)y + vadjust; + + /* VERTICAL END */ + + if ((y + h) < gfx_get_vactive()) + yend = (unsigned long)y + (unsigned long)h + vadjust; + else /* bottom clipping needed */ + yend = (unsigned long)gfx_get_vactive() + vadjust; + + /* SET VIDEO LINE INVERT BIT */ + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (y & 0x1) + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control | SC1200_VIDEO_LINE_OFFSET_ODD); + else + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control & ~SC1200_VIDEO_LINE_OFFSET_ODD); + + /* SET VIDEO POSITION */ + + WRITE_VID32(SC1200_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(SC1200_VIDEO_Y_POS, (yend << 16) | ystart); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + * + * This routine sets the number of pixels which will be cropped from the + * beginning of each video line. The video window will begin to display only + * from the pixel following the cropped pixels, and the cropped pixels + * will be ignored. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_left_crop(unsigned short x) +#else +int +gfx_set_video_left_crop(unsigned short x) +#endif +{ + unsigned long vcfg, initread; + + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero */ + + if (gfx_vid_dstw) + initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + + else + initread = 0l; + + /* SET INITIAL READ ADDRESS */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + vcfg &= ~SC1200_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & SC1200_VCFG_INIT_READ_MASK; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * If "graphics" is set to TRUE, the source data is graphics, and color key + * is an RGB value. If "graphics" is set to FALSE, the source data is the video, + * and color key is a YUV value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET SC1200 COLOR KEY VALUE */ + + WRITE_VID32(SC1200_VIDEO_COLOR_KEY, key); + WRITE_VID32(SC1200_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~SC1200_DCFG_VG_CK; + else + dcfg |= SC1200_DCFG_VG_CK; + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE SC1200 VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + vcfg &= ~(SC1200_VCFG_X_FILTER_EN | SC1200_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= SC1200_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= SC1200_VCFG_Y_FILTER_EN; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for SC1200, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + + /* WAIT FOR VERTICAL BLANK TO END */ + /* Otherwise palette will not be written properly. */ + + if (gfx_test_timing_active()) { + if (gfx_test_vertical_active()) { + while (gfx_test_vertical_active()) ; + } + while (!gfx_test_vertical_active()) ; + } + + /* LOAD SC1200 VIDEO PALETTE */ + + WRITE_VID32(SC1200_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = (i << 8) | (i << 16) | (i << 24); + WRITE_VID32(SC1200_PALETTE_DATA, entry); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* WAIT FOR VERTICAL BLANK TO END */ + /* Otherwise palette will not be written properly. */ + + if (gfx_test_timing_active()) { + if (gfx_test_vertical_active()) { + while (gfx_test_vertical_active()) ; + } + while (!gfx_test_vertical_active()) ; + } + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(SC1200_PALETTE_ADDRESS, index); + WRITE_VID32(SC1200_PALETTE_DATA, palette); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_request() + * + * This routine sets the horizontal (pixel) and vertical (line) video request + * values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_request(short x, short y) +#else +int +gfx_set_video_request(short x, short y) +#endif +{ + /* SET SC1200 VIDEO REQUEST */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if ((x < 0) || (x > SC1200_VIDEO_REQUEST_MASK) || + (y < 0) || (y > SC1200_VIDEO_REQUEST_MASK)) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(SC1200_VIDEO_REQUEST, + ((unsigned long)x << SC1200_VIDEO_X_REQUEST_POS) | + ((unsigned long)y << SC1200_VIDEO_Y_REQUEST_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_source() + * + * This routine sets the video source to either memory or Direct VIP. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_source(VideoSourceType source) +#else +int +gfx_set_video_source(VideoSourceType source) +#endif +{ + unsigned long display_mode; + + display_mode = READ_VID32(SC1200_VIDEO_DISPLAY_MODE); + + /* SET SC1200 VIDEO SOURCE */ + switch (source) { + case VIDEO_SOURCE_MEMORY: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | + SC1200_VIDEO_SOURCE_GX1); + break; + case VIDEO_SOURCE_DVIP: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | + SC1200_VIDEO_SOURCE_DVIP); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_source() + * + * This routine sets the vbi source to either memory or Direct VIP. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vbi_source(VbiSourceType source) +#else +int +gfx_set_vbi_source(VbiSourceType source) +#endif +{ + unsigned long display_mode; + + display_mode = READ_VID32(SC1200_VIDEO_DISPLAY_MODE); + + /* SET SC1200 VBI SOURCE */ + switch (source) { + case VBI_SOURCE_MEMORY: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VBI_SOURCE_MASK) | + SC1200_VBI_SOURCE_GX1); + break; + case VBI_SOURCE_DVIP: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VBI_SOURCE_MASK) | + SC1200_VBI_SOURCE_DVIP); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_lines() + * + * This routine sets the VBI lines to pass to the TV encoder. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vbi_lines(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_lines(unsigned long even, unsigned long odd) +#endif +{ + /* SET SC1200 VBI LINES */ + WRITE_VID32(SC1200_VIDEO_EVEN_VBI_LINE_ENABLE, + even & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + WRITE_VID32(SC1200_VIDEO_ODD_VBI_LINE_ENABLE, + odd & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_total() + * + * This routine sets the total number of VBI bytes for each field. + * The total is needed when both VBI and active video are received from memory. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vbi_total(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_total(unsigned long even, unsigned long odd) +#endif +{ + /* SET SC1200 VBI TOTAL */ + WRITE_VID32(SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT, + even & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + WRITE_VID32(SC1200_VIDEO_ODD_VBI_TOTAL_COUNT, + odd & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_interlaced() + * + * This routine configures the video processor video overlay mode to be + * interlaced YUV. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_interlaced(int enable) +#else +int +gfx_set_video_interlaced(int enable) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + /* SET INTERLACED VIDEO */ + if (enable) + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control | SC1200_VIDEO_IS_INTERLACED); + else + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control & ~SC1200_VIDEO_IS_INTERLACED); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_color_space_YUV() + * + * This routine configures the video processor to process graphics and video + * in either YUV or RGB color space. The mode should be set to tune image + * quality. + * Setting "enable" to TRUE improves image quality on TV, + * but in this mode colors on CRT will not be correct. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_color_space_YUV(int enable) +#else +int +gfx_set_color_space_YUV(int enable) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + + /* SET SC1200 VIDEO COLOR SPACE TO YUV OR RGB */ + + if (enable) { + /* ENABLE YUV BLENDING */ + /* YUV blending cannot be enabled in RGB video formats */ + + control |= SC1200_CSC_GFX_RGB_TO_YUV; /* Convert graphics to YUV */ + control &= ~SC1200_CSC_VIDEO_YUV_TO_RGB; /* Leave video in YUV */ + + if (control & SC1200_VIDEO_INPUT_IS_RGB) + return (GFX_STATUS_UNSUPPORTED); /* Can't convert video from RGB to YUV */ + } else { + /* RGB BLENDING */ + + control &= ~SC1200_CSC_GFX_RGB_TO_YUV; /* Leave graphics in RGB */ + if (control & SC1200_VIDEO_INPUT_IS_RGB) + control &= ~SC1200_CSC_VIDEO_YUV_TO_RGB; /* Leave video in RGB */ + else + control |= SC1200_CSC_VIDEO_YUV_TO_RGB; /* Convert video to RGB */ + } + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vertical_scaler_offset() + * + * This routine sets the value by which the odd frame is shifted with respect + * to the even frame. This is useful for de-interlacing in Bob method, by + * setting the shift value to be one line. + * If offset is 0, no shifting occurs. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vertical_scaler_offset(char offset) +#else +int +gfx_set_vertical_scaler_offset(char offset) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (offset == 1) { + control &= ~SC1200_VERTICAL_SCALER_SHIFT_MASK; /* Clear shifting value */ + control |= SC1200_VERTICAL_SCALER_SHIFT_INIT; /* Set shifting value */ + control |= SC1200_VERTICAL_SCALER_SHIFT_EN; /* Enable odd frame shifting */ + } else if (offset == 0) { + control &= ~SC1200_VERTICAL_SCALER_SHIFT_EN; /* No shifting occurs */ + control &= ~SC1200_VERTICAL_SCALER_SHIFT_MASK; /* Clear shifting value */ + } else + return (GFX_STATUS_BAD_PARAMETER); /* TODO: how to program other values ? */ + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_top_line_in_odd() + * + * This routine sets the field in which the top line of input video resides. + * If enable is "0", this is the even field (default). [not to be confused + * with the odd field being the top field on TV]. + * If enable is "1", this is the odd field. + * Use enable "1" for input devices whose field indication is reversed from + * normal, i.e. an indication of "odd" field is given for even field data, + * and vice versa. + * This setting affects the video processor only when it is in either interlaced + * or Bob (scaler offset active) modes. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_top_line_in_odd(int enable) +#else +int +gfx_set_top_line_in_odd(int enable) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (enable) + control |= SC1200_TOP_LINE_IN_ODD; /* Set shifting value */ + else + control &= ~SC1200_TOP_LINE_IN_ODD; /* No shifting occurs */ + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_delay() + * + * This routine sets the delay between VIP VSYNC and display controller VSYNC. + * The delay is in 27 MHz clocks. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_genlock_delay(unsigned long delay) +#else +int +gfx_set_genlock_delay(unsigned long delay) +#endif +{ + /* SET SC1200 GENLOCK DELAY */ + WRITE_VID32(SC1200_GENLOCK_DELAY, delay & SC1200_GENLOCK_DELAY_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_enable() + * + * This routine sets and configures the genlock according to the flags parameter. + * Flags value of 0 disables genlock and resets its configuration. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_genlock_enable(int flags) +#else +int +gfx_set_genlock_enable(int flags) +#endif +{ + unsigned long genlock = 0; + + if (flags) { + /* SET SC1200 GENLOCK CONFIGURATION */ + if (flags & GENLOCK_SINGLE) + genlock |= SC1200_GENLOCK_SINGLE_ENABLE; + if (flags & GENLOCK_FIELD_SYNC) + genlock |= SC1200_GENLOCK_FIELD_SYNC_ENABLE; + if (flags & GENLOCK_CONTINUOUS) + genlock |= SC1200_GENLOCK_CONTINUOUS_ENABLE; + if (flags & GENLOCK_SYNCED_EDGE_FALLING) + genlock |= SC1200_GENLOCK_GX_VSYNC_FALLING_EDGE; + if (flags & GENLOCK_SYNCING_EDGE_FALLING) + genlock |= SC1200_GENLOCK_VIP_VSYNC_FALLING_EDGE; + if (flags & GENLOCK_TIMEOUT) + genlock |= SC1200_GENLOCK_TIMEOUT_ENABLE; + if (flags & GENLOCK_TVENC_RESET_EVEN_FIELD) + genlock |= SC1200_GENLOCK_TVENC_RESET_EVEN_FIELD; + if (flags & GENLOCK_TVENC_RESET_BEFORE_DELAY) + genlock |= SC1200_GENLOCK_TVENC_RESET_BEFORE_DELAY; + if (flags & GENLOCK_TVENC_RESET) + genlock |= SC1200_GENLOCK_TVENC_RESET_ENABLE; + if (flags & GENLOCK_SYNC_TO_TVENC) + genlock |= SC1200_GENLOCK_SYNC_TO_TVENC; + } + WRITE_VID32(SC1200_GENLOCK, genlock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either "color1" + * or "color2" will be used for this pixel, according to the value of bit + * number "select_color2" of the graphics pixel. + * + * key - 24 bit RGB value + * mask - 24 bit mask + * color1, color2 - RGB or YUV, depending on the current color space conversion + * select_color2 - value between 0 to 23 + * + * To disable match, a "mask" and "key" value of 0xffffff should be set, + * because the graphics pixels incoming to the video processor have maximum 16 + * bits set (0xF8FCF8). + * + * This feature is useful for disabling alpha blending of the cursor. + * Otherwise cursor image would be blurred (or completely invisible if video + * alpha is maximum value). + * Note: the cursor pixel replacements take place both inside and outside the + * video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, + unsigned long color2) +#else +int +gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, + unsigned long color2) +#endif +{ + if (select_color2 > SC1200_CURSOR_COLOR_BITS) + return GFX_STATUS_BAD_PARAMETER; + key = (key & SC1200_COLOR_MASK) | ((unsigned long)select_color2 << + SC1200_CURSOR_COLOR_KEY_OFFSET_POS); + WRITE_VID32(SC1200_CURSOR_COLOR_KEY, key); + WRITE_VID32(SC1200_CURSOR_COLOR_MASK, mask); + WRITE_VID32(SC1200_CURSOR_COLOR_1, color1); + WRITE_VID32(SC1200_CURSOR_COLOR_2, color2); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_enable + * + * This routine enables or disables the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_enable(int enable) +#else +int +gfx_set_alpha_enable(int enable) +#endif +{ + unsigned long address = 0, value = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 4); + value = READ_VID32(address); + if (enable) + value |= (SC1200_ACTRL_WIN_ENABLE | SC1200_ACTRL_LOAD_ALPHA); + else + value &= ~(SC1200_ACTRL_WIN_ENABLE); + WRITE_VID32(address, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_window + * + * This routine sets the size of the currently selected alpha region. + * Note: "x" and "y" are signed to enable using negative values needed for + * implementing workarounds of hardware issues. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#else +int +gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned long address = 0; + + /* CHECK FOR CLIPPING */ + + if ((x + width) > gfx_get_hactive()) + width = gfx_get_hactive() - x; + if ((y + height) > gfx_get_vactive()) + height = gfx_get_vactive() - y; + + /* ADJUST POSITIONS */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_XPOS_1 + ((unsigned long)gfx_alpha_select << 4); + + /* End positions in register are non-inclusive (one more than the actual end) */ + + WRITE_VID32(address, (unsigned long)x | + ((unsigned long)(x + width) << 16)); + WRITE_VID32(address + 4l, (unsigned long)y | + ((unsigned long)(y + height) << 16)); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_value + * + * This routine sets the alpha value for the currently selected alpha + * region. It also specifies an increment/decrement value for fading. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_value(unsigned char alpha, char delta) +#else +int +gfx_set_alpha_value(unsigned char alpha, char delta) +#endif +{ + unsigned long address = 0, value = 0; + unsigned char new_value = 0; + int loop = 1; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 4); + value = READ_VID32(address); + value &= SC1200_ACTRL_WIN_ENABLE; /* keep only enable bit */ + value |= (unsigned long)alpha; + value |= (((unsigned long)delta) & 0xff) << 8; + value |= SC1200_ACTRL_LOAD_ALPHA; + WRITE_VID32(address, value); + + /* WORKAROUND FOR ISSUE #1187 */ + /* Need to verify that the alpha operation succeeded */ + + while (1) { + /* WAIT FOR VERTICAL BLANK TO END */ + if (gfx_test_timing_active()) { + if (gfx_test_vertical_active()) + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + } + new_value = + (unsigned + char)((READ_VID32(SC1200_ALPHA_WATCH) >> (gfx_alpha_select << 3)) + & 0xff); + if (new_value == alpha) + return GFX_STATUS_OK; + if (++loop > 10) + return GFX_STATUS_ERROR; + WRITE_VID32(address, value); + } +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_priority + * + * This routine sets the priority of the currently selected alpha region. + * A higher value indicates a higher priority. + * Note: Priority of enabled alpha windows must be different. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_priority(int priority) +#else +int +gfx_set_alpha_priority(int priority) +#endif +{ + unsigned long pos = 0, value = 0; + + if (priority > 3) + return (GFX_STATUS_BAD_PARAMETER); + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + value = READ_VID32(SC1200_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + value &= ~(0x03l << pos); + value |= (unsigned long)priority << pos; + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color + * + * This routine sets the color to be displayed inside the currently selected + * alpha window when there is a color key match (when the alpha color + * mechanism is enabled). + * "color" is a 24 bit RGB value (for RGB blending) or YUV value (for YUV blending). + * In Interlaced YUV blending mode, Y/2 value should be used. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_color(unsigned long color) +#else +int +gfx_set_alpha_color(unsigned long color) +#endif +{ + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 4); + + /* ONLY 24 VALID BITS */ + color &= 0xffffffl; + + /* KEEP UPPER BYTE UNCHANGED */ + WRITE_VID32(address, (color | (READ_VID32(address) & ~0xffffffl))); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color_enable + * + * Enable or disable the color mechanism in the alpha window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_color_enable(int enable) +#else +int +gfx_set_alpha_color_enable(int enable) +#endif +{ + unsigned long color; + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 4); + color = READ_VID32(address); + if (enable) + color |= SC1200_ALPHA_COLOR_ENABLE; + else + color &= ~SC1200_ALPHA_COLOR_ENABLE; + WRITE_VID32(address, color); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_no_ck_outside_alpha + * + * This function affects where inside the video window color key or chroma + * key comparison is done: + * If enable is TRUE, color/chroma key comparison is performed only inside + * the enabled alpha windows. Outside the (enabled) alpha windows, only video + * is displayed if color key is used, and only graphics is displayed if chroma + * key is used. + * If enable is FALSE, color/chroma key comparison is performed in all the + * video window area. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_no_ck_outside_alpha(int enable) +#else +int +gfx_set_no_ck_outside_alpha(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (enable) + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + value | SC1200_NO_CK_OUTSIDE_ALPHA); + else + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + value & ~SC1200_NO_CK_OUTSIDE_ALPHA); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_macrovision_enable + * + * This routine enables or disables macrovision on the tv encoder output. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_macrovision_enable(int enable) +#else +int +gfx_set_macrovision_enable(int enable) +#endif +{ + if (enable) + WRITE_VID32(SC1200_TVENC_MV_CONTROL, SC1200_TVENC_MV_ENABLE); + else + WRITE_VID32(SC1200_TVENC_MV_CONTROL, 0); + return (GFX_STATUS_OK); +} + +#define SC1200_VIDEO_PCI_44 0x80009444 + +/*--------------------------------------------------------------------------- + * gfx_disable_softvga + * + * Disables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be disabled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_disable_softvga(void) +#else +int +gfx_disable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + /* setting video PCI register 44 bit 0 to 1 disables SoftVga */ + reg_val |= 0x1; + gfx_pci_config_write(SC1200_VIDEO_PCI_44, reg_val); + + /* see if we set the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0x1) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_softvga + * + * Enables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be enbled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_enable_softvga(void) +#else +int +gfx_enable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + /* clearing video PCI register 44 bit 0 enables SoftVga */ + gfx_pci_config_write(SC1200_VIDEO_PCI_44, reg_val & 0xfffffffel); + + /* see if we cleared the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + unsigned int index; + unsigned long value, mask; + + mask = 0x007FFF0F; + value = READ_VID32(SC1200_VID_CLOCK_SELECT) & mask; + for (index = 0; index < NUM_SC1200_FREQUENCIES; index++) { + if ((gfx_sc1200_clock_table[index].clock_select & mask) == value) + return (gfx_sc1200_clock_table[index].frequency); + } + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_vsa2_softvga_enable + * + * This function returns the enable status of SoftVGA. It is valid + * only if VSAII is present. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_vsa2_softvga_enable(void) +#else +int +gfx_get_vsa2_softvga_enable(void) +#endif +{ + unsigned long reg_val; + + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(SC1200_DISPLAY_CONFIG) & SC1200_DCFG_CRT_HSYNC_POL) + polarities |= 1; + if (READ_VID32(SC1200_DISPLAY_CONFIG) & SC1200_DCFG_CRT_VSYNC_POL) + polarities |= 2; + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(SC1200_PALETTE_ADDRESS, index); + *palette = READ_VID32(SC1200_PALETTE_DATA); + + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_VID_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long ctrl, vcfg; + + ctrl = READ_VID32(SC1200_VID_ALPHA_CONTROL); + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + + if (ctrl & SC1200_VIDEO_INPUT_IS_RGB) { + switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { + case SC1200_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_RGB; + case SC1200_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_P2M_P2L_P1M_P1L; + case SC1200_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_P1M_P1L_P2M_P2L; + case SC1200_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_P1M_P2L_P2M_P1L; + } + } + + if (vcfg & SC1200_VCFG_4_2_0_MODE) { + switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { + case SC1200_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_Y0Y1Y2Y3; + case SC1200_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y3Y2Y1Y0; + case SC1200_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_Y1Y0Y3Y2; + case SC1200_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_Y1Y2Y3Y0; + } + } else { + switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { + case SC1200_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_UYVY; + case SC1200_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y2YU; + case SC1200_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_YUYV; + case SC1200_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_YVYU; + } + } + return (GFX_STATUS_ERROR); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width = 0, height = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1200 VIDEO LINE SIZE */ + + width = (READ_VID32(SC1200_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_LINE_SIZE_UPPER) + width += 512l; + + if (width) { + /* DETERMINE HEIGHT BY DIVIDING TOTAL SIZE BY WIDTH */ + /* Get total size from display controller - abtracted. */ + + height = gfx_get_display_video_size() / (width << 1); + } + return ((height << 16) | width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1200 VIDEO LINE SIZE */ + + width = (READ_VID32(SC1200_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_LINE_SIZE_UPPER) + width += 512l; + return (width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1200 VIDEO LINE SIZE */ + + clip = (READ_VID32(SC1200_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_upscale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_upscale(void) +#else +unsigned long +gfx_get_video_upscale(void) +#endif +{ + return (READ_VID32(SC1200_VIDEO_UPSCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return gfx_get_video_upscale(); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_config + * + * This routine returns the current type and value of video downscaling. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_downscale_config(unsigned short *type, unsigned short *m) +#else +int +gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); + *m = (unsigned short)((downscale & SC1200_VIDEO_DOWNSCALE_FACTOR_MASK) >> + SC1200_VIDEO_DOWNSCALE_FACTOR_POS) + 1; + + switch (downscale & SC1200_VIDEO_DOWNSCALE_TYPE_MASK) { + case SC1200_VIDEO_DOWNSCALE_TYPE_A: + *type = VIDEO_DOWNSCALE_KEEP_1_OF; + break; + case SC1200_VIDEO_DOWNSCALE_TYPE_B: + *type = VIDEO_DOWNSCALE_DROP_1_OF; + break; + default: + return GFX_STATUS_ERROR; + break; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_coefficients + * + * This routine returns the current video downscaling coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) +#else +void +gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) +#endif +{ + unsigned long coef; + + coef = READ_VID32(SC1200_VIDEO_DOWNSCALER_COEFFICIENTS); + *coef1 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF1_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + *coef2 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF2_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + *coef3 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF3_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + *coef4 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF4_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_enable + * + * This routine returns 1 if video downscaling is currently enabled, + * or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_video_downscale_enable(int *enable) +#else +void +gfx_get_video_downscale_enable(int *enable) +#endif +{ + if (READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL) & + SC1200_VIDEO_DOWNSCALE_ENABLE) + *enable = 1; + else + *enable = 0; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(SC1200_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x7FF) - (xsize & 0x7FF); + ysize = READ_VID32(SC1200_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x7FF) - (ysize & 0x7FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(SC1200_VIDEO_X_POS) & 0x000007FF; + ypos = READ_VID32(SC1200_VIDEO_Y_POS) & 0x000007FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = + (unsigned long)gfx_get_htotal() - + (unsigned long)gfx_get_hsync_end() - 14l; + vadjust = + (unsigned long)gfx_get_vtotal() - + (unsigned long)gfx_get_vsync_end() + 1l; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(SC1200_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(SC1200_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(SC1200_DISPLAY_CONFIG) & SC1200_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_request + * + * This routine returns the horizontal (pixel) and vertical (lines) video + * request values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_request(short *x, short *y) +#else +int +gfx_get_video_request(short *x, short *y) +#endif +{ + int request = 0; + + request = (int)(READ_VID32(SC1200_VIDEO_REQUEST)); + *x = (request >> SC1200_VIDEO_X_REQUEST_POS) & SC1200_VIDEO_REQUEST_MASK; + *y = (request >> SC1200_VIDEO_Y_REQUEST_POS) & SC1200_VIDEO_REQUEST_MASK; + + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_source + * + * This routine returns the current video source. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_source(VideoSourceType * source) +#else +int +gfx_get_video_source(VideoSourceType * source) +#endif +{ + switch (READ_VID32(SC1200_VIDEO_DISPLAY_MODE) & SC1200_VIDEO_SOURCE_MASK) { + case SC1200_VIDEO_SOURCE_GX1: + *source = VIDEO_SOURCE_MEMORY; + break; + case SC1200_VIDEO_SOURCE_DVIP: + *source = VIDEO_SOURCE_DVIP; + break; + default: + return GFX_STATUS_ERROR; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_source + * + * This routine returns the current vbi source. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_vbi_source(VbiSourceType * source) +#else +int +gfx_get_vbi_source(VbiSourceType * source) +#endif +{ + switch (READ_VID32(SC1200_VIDEO_DISPLAY_MODE) & SC1200_VBI_SOURCE_MASK) { + case SC1200_VBI_SOURCE_GX1: + *source = VBI_SOURCE_MEMORY; + break; + case SC1200_VBI_SOURCE_DVIP: + *source = VBI_SOURCE_DVIP; + break; + default: + return GFX_STATUS_ERROR; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_lines + * + * This routine returns the VBI lines which are sent to the TV encoder. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_vbi_lines(int odd) +#else +unsigned long +gfx_get_vbi_lines(int odd) +#endif +{ + if (odd) + return (READ_VID32(SC1200_VIDEO_ODD_VBI_LINE_ENABLE) & + SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + return (READ_VID32(SC1200_VIDEO_EVEN_VBI_LINE_ENABLE) & + SC1200_VIDEO_VBI_LINE_ENABLE_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_total + * + * This routine returns the total number of VBI bytes in the field. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_vbi_total(int odd) +#else +unsigned long +gfx_get_vbi_total(int odd) +#endif +{ + if (odd) + return (READ_VID32(SC1200_VIDEO_ODD_VBI_TOTAL_COUNT) & + SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + return (READ_VID32(SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT) & + SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_interlaced() + * + * This routine returns "1" if input video is currently in interlaced mode. + * "0" otherwise. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_interlaced(void) +#else +int +gfx_get_video_interlaced(void) +#endif +{ + if (READ_VID32(SC1200_VID_ALPHA_CONTROL) & SC1200_VIDEO_IS_INTERLACED) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_color_space_YUV() + * + * This routine returns "1" if video processor color space mode is currently + * YUV. "0" otherwise. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_color_space_YUV(void) +#else +int +gfx_get_color_space_YUV(void) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + + /* IS SC1200 VIDEO COLOR SPACE RGB OR CONVERTED TO RGB */ + if ((control & SC1200_VIDEO_INPUT_IS_RGB) + || (control & SC1200_CSC_VIDEO_YUV_TO_RGB)) + return (0); + else + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vertical_scaler_offset() + * + * This routine sets "offset" to the value by which odd frames are shifted, + * if insert is enabled, and to 0 if no shifting occurs. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_vertical_scaler_offset(char *offset) +#else +int +gfx_get_vertical_scaler_offset(char *offset) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (control & SC1200_VERTICAL_SCALER_SHIFT_EN) { + if ((control & SC1200_VERTICAL_SCALER_SHIFT_MASK) == + SC1200_VERTICAL_SCALER_SHIFT_INIT) + *offset = 1; + else + return GFX_STATUS_ERROR; /* TODO: find the interpretation of other values */ + } else + *offset = 0; + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_delay + * + * This routine returns the genlock delay in 27 MHz clocks. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_genlock_delay(void) +#else +unsigned long +gfx_get_genlock_delay(void) +#endif +{ + return (READ_VID32(SC1200_GENLOCK_DELAY) & SC1200_GENLOCK_DELAY_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_enable + * + * This routine returns "1" if genlock is currently enabled, "0" otherwise. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_genlock_enable(void) +#else +int +gfx_get_genlock_enable(void) +#endif +{ + if (READ_VID32(SC1200_GENLOCK) & + (SC1200_GENLOCK_SINGLE_ENABLE | SC1200_GENLOCK_CONTINUOUS_ENABLE)) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either "color1" + * or "color2" will be used for this pixel, according to the value of the bit + * in offset "select_color2". + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#else +int +gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#endif +{ + *select_color2 = + (unsigned short)(READ_VID32(SC1200_CURSOR_COLOR_KEY) >> + SC1200_CURSOR_COLOR_KEY_OFFSET_POS); + *key = READ_VID32(SC1200_CURSOR_COLOR_KEY) & SC1200_COLOR_MASK; + *mask = READ_VID32(SC1200_CURSOR_COLOR_MASK) & SC1200_COLOR_MASK; + *color1 = READ_VID32(SC1200_CURSOR_COLOR_1) & SC1200_COLOR_MASK; + *color2 = + (unsigned short)(READ_VID32(SC1200_CURSOR_COLOR_2) & + SC1200_COLOR_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + unsigned long crc = 0xFFFFFFFF; + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(SC1200_VID_CRC, 0); + WRITE_VID32(SC1200_VID_CRC, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(SC1200_VID_CRC) >> 8; + } + return (crc); +} + +/*----------------------------------------------------------------------------- + * gfx_get_macrovision_enable + * + * This routine returns the value "one" if macrovision currently enabled in the + * TV encoder, otherwise it returns the value "zero". + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_macrovision_enable(void) +#else +int +gfx_get_macrovision_enable(void) +#endif +{ + if (READ_VID32(SC1200_TVENC_MV_CONTROL) == SC1200_TVENC_MV_ENABLE) + return (1); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_enable + * + * This routine returns 1 if the selected alpha window is currently + * enabled, or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_enable(int *enable) +#else +void +gfx_get_alpha_enable(int *enable) +#endif +{ + unsigned long value = 0; + + *enable = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(SC1200_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 4)); + if (value & SC1200_ACTRL_WIN_ENABLE) + *enable = 1; + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_size + * + * This routine returns the size of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#else +void +gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#endif +{ + unsigned long value = 0; + + *x = 0; + *y = 0; + *width = 0; + *height = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(SC1200_ALPHA_XPOS_1 + + ((unsigned long)gfx_alpha_select << 4)); + *x = (unsigned short)(value & 0x000007FF); + *width = (unsigned short)((value >> 16) & 0x000007FF) - *x; + value = + READ_VID32(SC1200_ALPHA_YPOS_1 + + ((unsigned long)gfx_alpha_select << 4)); + *y = (unsigned short)(value & 0x000007FF); + *height = (unsigned short)((value >> 16) & 0x000007FF) - *y; + } + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_value + * + * This routine returns the alpha value and increment/decrement value of + * the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_value(unsigned char *alpha, char *delta) +#else +void +gfx_get_alpha_value(unsigned char *alpha, char *delta) +#endif +{ + unsigned long value = 0; + + *alpha = 0; + *delta = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(SC1200_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 4)); + *alpha = (unsigned char)(value & 0x00FF); + *delta = (char)((value >> 8) & 0x00FF); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_priority + * + * This routine returns the priority of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_priority(int *priority) +#else +void +gfx_get_alpha_priority(int *priority) +#endif +{ + unsigned long pos = 0, value = 0; + + *priority = 0; + if (gfx_alpha_select <= 2) { + value = READ_VID32(SC1200_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + *priority = (int)((value >> pos) & 3); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_color + * + * This routine returns the color register value for the currently selected + * alpha region. Bit 24 is set if the color register is enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_color(unsigned long *color) +#else +void +gfx_get_alpha_color(unsigned long *color) +#endif +{ + *color = 0; + if (gfx_alpha_select <= 2) { + *color = + READ_VID32(SC1200_ALPHA_COLOR_1 + + ((unsigned long)gfx_alpha_select << 4)); + } + return; +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1400.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1400.c:1.1 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1400.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,924 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_1400.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/*----------------------------------------------------------------------------- + * VID_1400.C + * + * Version 2.0 - February 21, 2000 + * + * This file contains routines to control the SC1400 video overlay hardware. + * + * History: + * Versions 0.1 through 2.0 by Brian Falardeau. + * + * Copyright (c) 1999-2000 National Semiconductor. + *----------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------- + * SC1400 PLL TABLE + *---------------------------------------------------------------------------- + */ + +typedef struct tagSC1400PLL +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long clock_select; /* clock select register (0x2C) */ +} +SC1400PLL; + +SC1400PLL gfx_sc1400_clock_table[] = { + {0x00192CCC, 0x00000000}, /* 25.1750 */ + {0x001C526E, 0x00010000}, /* 28.3220 */ + {0x001F8000, 0x00020000}, /* 31.5000 */ + {0x00240000, 0x000E0000}, /* 36.0000 */ + {0x00258000, 0x0010110C}, /* 37.5000 */ + {0x00280000, 0x00040000}, /* 40.0000 */ + {0x002CE666, 0x00090000}, /* 44.9000 */ + {0x00320000, 0x00100C06}, /* 50.0000 */ + {0x00325999, 0x0050600C}, /* 50.3500 */ + {0x00360000, 0x00100100}, /* 54.0000 */ + {0x0038643F, 0x0010160A}, /* 56.3916 */ + {0x0038A3D7, 0x00506C0C}, /* 56.6440 */ + {0x003B0000, 0x0010170A}, /* 59.6583 */ + {0x003BA886, 0x00100A04}, /* 59.6583 */ + {0x003F0000, 0x00100602}, /* 63.0000 */ + {0x00410000, 0x00060000}, /* 65.0000 */ + {0x00438000, 0x00100401}, /* 67.5000 */ + {0x0046CCCC, 0x00101407}, /* 70.8000 */ + {0x00480000, 0x00100702}, /* 72.0000 */ + {0x004B0000, 0x00070000}, /* 75.0000 */ + {0x004EC000, 0x0010220B}, /* 78.7500 */ + {0x00500000, 0x00304C0C}, /* 80.0000 */ + {0x00510000, 0x00100200}, /* 81.0000 */ + {0x00550000, 0x00080000}, /* 85.0000 */ + {0x0059CCCC, 0x00100902}, /* 89.8000 */ + {0x00630000, 0x00100A02}, /* 99.0000 */ + {0x00640000, 0x00102409}, /* 100.0000 */ + {0x006C0000, 0x00100300}, /* 108.0000 */ + {0x00870000, 0x00050000}, /* 135.0000 */ + {0x009D8000, 0x00102205}, /* 157.5000 */ + {0x00A20000, 0x00100500}, /* 162.0000 */ + {0x00AA0000, 0x000B0000}, /* 170.0000 */ + {0x00AF0000, 0x00100C01}, /* 175.0000 */ + {0x00BD0000, 0x00100600}, /* 189.0000 */ + {0x00CA0000, 0x00100E01}, /* 202.0000 */ + {0x00E80000, 0x00102A04}, /* 232.0000 */ +}; + +#define NUM_SC1400_FREQUENCIES sizeof(gfx_sc1400_clock_table)/sizeof(SC1400PLL) + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1400_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + gfx_set_video_enable(0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1400_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + int index; + unsigned long value; + long min, diff; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = gfx_sc1400_clock_table[0].clock_select; + min = (long)gfx_sc1400_clock_table[0].frequency - frequency; + if (min < 0L) + min = -min; + for (index = 1; index < NUM_SC1400_FREQUENCIES; index++) { + diff = (long)gfx_sc1400_clock_table[index].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + value = gfx_sc1400_clock_table[index].clock_select; + } + } + + /* SET THE DOT CLOCK REGISTER */ + + WRITE_VID32(SC1400_VID_MISC, 0x00001000); + WRITE_VID32(SC1400_VID_CLOCK_SELECT, value); + return; +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + vcfg = READ_VID32(SC1400_VIDEO_CONFIG); + if (enable) { + /* ENABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(1); + + /* SET SC1400 BUS CONTROL PARAMETERS */ + /* Currently always high speed, 8-bit interface. */ + + vcfg |= SC1400_VCFG_HIGH_SPD_INT; + vcfg &= ~(SC1400_VCFG_EARLY_VID_RDY | SC1400_VCFG_16_BIT_EN); + + /* ENABLE SC1400 VIDEO OVERLAY */ + + vcfg |= SC1400_VCFG_VID_EN; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE SC1400 VIDEO OVERLAY */ + + vcfg &= ~SC1400_VCFG_VID_EN; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + + /* DISABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(0); + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_format + * + * Currently only sets 4:2:0 format, Y1 V Y0 U. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long vcfg = 0; + + /* SET THE SC1400 VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(SC1400_VIDEO_CONFIG); + vcfg &= ~(SC1400_VCFG_VID_INP_FORMAT | SC1400_VCFG_4_2_0_MODE); + vcfg &= ~(SC1400_VCFG_CSC_BYPASS); + if (format < 4) + vcfg |= (format << 2); + else + vcfg |= SC1400_VCFG_CSC_BYPASS; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg; + + /* SET THE SC1400 VIDEO LINE SIZE */ + + vcfg = READ_VID32(SC1400_VIDEO_CONFIG); + vcfg &= ~(SC1400_VCFG_LINE_SIZE_LOWER_MASK | SC1400_VCFG_LINE_SIZE_UPPER); + size = (width >> 1); + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= SC1400_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + + /* SET TOTAL VIDEO BUFFER SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_size(width, height); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS */ + /* These are needed for clipping the video window later. */ + + gfx_vid_srcw = srcw; + gfx_vid_srch = srch; + gfx_vid_dstw = dstw; + gfx_vid_dsth = dsth; + + /* CALCULATE SC1400 SCALE FACTORS */ + /* No downscaling in SC1400 so force to 1x if attempted. */ + + if (srcw < dstw) + xscale = (0x2000 * (srcw - 1)) / (dstw - 1); + else + xscale = 0x1FFF; + if (srch < dsth) + yscale = (0x2000 * (srch - 1)) / (dsth - 1); + else + yscale = 0x1FFF; + WRITE_VID32(SC1400_VIDEO_SCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values effect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * position is specified in screen relative coordinates, and may be negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_window(short x, short y, unsigned short w, unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long vcfg = 0; + unsigned long hadjust, vadjust; + unsigned long initread; + unsigned long xstart, ystart, xend, yend; + unsigned long offset, line_size; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 13; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if (x > 0) { + /* NO CLIPPING ON LEFT */ + + xstart = x + hadjust; + initread = 0; + } else { + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero */ + + xstart = hadjust; + initread = -x; + if (gfx_vid_dstw) + initread = ((-x) * gfx_vid_srcw) / gfx_vid_dstw; + else + initread = 0; + } + + /* CLIPPING ON RIGHT */ + + xend = x + w; + if (xend > gfx_get_hactive()) + xend = gfx_get_hactive(); + xend += hadjust; + + /* CLIPPING ON TOP */ + + offset = gfx_vid_offset; + if (y >= 0) { + ystart = y + vadjust; + } else { + ystart = vadjust; + line_size = (READ_VID32(SC1400_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1400_VIDEO_CONFIG) & SC1400_VCFG_LINE_SIZE_UPPER) + line_size += 512; + if (gfx_vid_dsth) + offset = gfx_vid_offset + (line_size << 1) * + (((-y) * gfx_vid_srch) / gfx_vid_dsth); + } + + /* CLIPPING ON BOTTOM */ + + yend = y + h; + if (yend >= gfx_get_vactive()) + yend = gfx_get_vactive(); + yend += vadjust; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + + /* DISABLE REGISTER UPDATES */ + + vcfg = READ_VID32(SC1400_VIDEO_CONFIG); + vcfg &= ~SC1400_VCFG_VID_REG_UPDATE; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + + /* SET VIDEO POSITION */ + + WRITE_VID32(SC1400_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(SC1400_VIDEO_Y_POS, (yend << 16) | ystart); + + /* SET INITIAL READ ADDRESS AND ENABLE REGISTER UPDATES */ + + vcfg &= ~SC1400_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & SC1400_VCFG_INIT_READ_MASK; + vcfg |= SC1400_VCFG_VID_REG_UPDATE; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * The source data can be either graphics data or video data. The bluescreen + * parameter is set to have the hardware compare video data and clear to + * comapare graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET SC1400 COLOR KEY VALUE */ + + WRITE_VID32(SC1400_VIDEO_COLOR_KEY, key); + WRITE_VID32(SC1400_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(SC1400_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~SC1400_DCFG_VG_CK; + else + dcfg |= SC1400_DCFG_VG_CK; + WRITE_VID32(SC1400_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE SC1400 VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(SC1400_VIDEO_CONFIG); + vcfg &= ~(SC1400_VCFG_X_FILTER_EN | SC1400_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= SC1400_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= SC1400_VCFG_Y_FILTER_EN; + WRITE_VID32(SC1400_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for SC1400, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + + /* LOAD SC1400 VIDEO PALETTE */ + + WRITE_VID32(SC1400_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = i | (i << 8) | (i << 16); + WRITE_VID32(SC1400_PALETTE_DATA, entry); + } + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(SC1400_DISPLAY_CONFIG) & 0x00000100) + polarities |= 1; + if (READ_VID32(SC1400_DISPLAY_CONFIG) & 0x00000200) + polarities |= 2; + return (polarities); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(SC1400_VIDEO_CONFIG) & SC1400_VCFG_VID_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long vcfg; + + vcfg = READ_VID32(SC1400_VIDEO_CONFIG); + if (vcfg & SC1400_VCFG_CSC_BYPASS) + return (4); + else + return ((vcfg >> 2) & 3); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width = 0, height = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1400 VIDEO LINE SIZE */ + + width = (READ_VID32(SC1400_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1400_VIDEO_CONFIG) & SC1400_VCFG_LINE_SIZE_UPPER) + width += 512; + + if (width) { + /* DETERMINE HEIGHT BY DIVIDING TOTAL SIZE BY WIDTH */ + /* Get total size from display controller - abtracted. */ + + height = gfx_get_display_video_size() / (width << 1); + } + return ((height << 16) | width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1400 VIDEO LINE SIZE */ + + width = (READ_VID32(SC1400_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1400_VIDEO_CONFIG) & SC1400_VCFG_LINE_SIZE_UPPER) + width += 512; + return (width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1400 VIDEO LINE SIZE */ + + clip = (READ_VID32(SC1400_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return (READ_VID32(SC1400_VIDEO_SCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(SC1400_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x3FF) - (xsize & 0x03FF); + ysize = READ_VID32(SC1400_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x3FF) - (ysize & 0x03FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(SC1400_VIDEO_X_POS) & 0x000003FF; + ypos = READ_VID32(SC1400_VIDEO_Y_POS) & 0x000003FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 13; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(SC1400_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(SC1400_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(SC1400_DISPLAY_CONFIG) & SC1400_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(SC1400_VIDEO_CONFIG) & SC1400_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(SC1400_VIDEO_CONFIG) & SC1400_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + int index; + unsigned long value, mask; + + mask = 0x007FFF0F; + value = READ_VID32(SC1400_VID_CLOCK_SELECT) & mask; + for (index = 0; index < NUM_SC1400_FREQUENCIES; index++) { + if ((gfx_sc1400_clock_table[index].clock_select & mask) == value) + return (gfx_sc1400_clock_table[index].frequency); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + unsigned long crc = 0xFFFFFFFF; + + if (gfx_test_timing_active()) { + // WAIT UNTIL ACTIVE DISPLAY + + while (!gfx_test_vertical_active()) ; + + // RESET CRC DURING ACTIVE DISPLAY + + WRITE_VID32(SC1400_VID_CRC, 0); + WRITE_VID32(SC1400_VID_CRC, 1); + + // WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE + + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(SC1400_VID_CRC) >> 8; + } + return (crc); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_5530.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_5530.c:1.2 --- /dev/null Thu Feb 27 12:31:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_5530.c Fri Feb 21 11:51:10 2003 @@ -0,0 +1,1446 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_5530.c,v 1.2 2003/02/21 16:51:10 alanh Exp $ */ +/* + * $Workfile: vid_5530.c $ + * + * This file contains routines to control the CS5530 video overlay hardware. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/*---------------------------------------------------------------------------- + * CS5530 PLL TABLE + *---------------------------------------------------------------------------- + */ +typedef struct tagCS5530PLLENTRY +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long pll_value; /* associated register value */ +} +CS5530PLLENTRY; + +CS5530PLLENTRY CS5530_PLLtable[] = { + {0x00192CCC, 0x31C45801,}, /* 25.1750 */ + {0x001C526E, 0x20E36802,}, /* 28.3220 */ + {0x001F8000, 0x33915801,}, /* 31.5000 */ + {0x00240000, 0x31EC4801,}, /* 36.0000 */ + {0x00258000, 0x21E22801,}, /* 37.5000 */ + {0x00280000, 0x33088801,}, /* 40.0000 */ + {0x002CE666, 0x33E22801,}, /* 44.9000 */ + {0x00318000, 0x336C4801,}, /* 49.5000 */ + {0x00320000, 0x23088801,}, /* 50.0000 */ + {0x00325999, 0x23088801,}, /* 50.3500 */ + {0x00360000, 0x3708A801,}, /* 54.0000 */ + {0x00384000, 0x23E36802,}, /* 56.2500 */ + {0x0038643F, 0x23E36802,}, /* 56.3916 */ + {0x0038A4DD, 0x23E36802,}, /* 56.6444 */ + {0x003B0000, 0x37C45801,}, /* 59.0000 */ + {0x003F0000, 0x23EC4801,}, /* 63.0000 */ + {0x00410000, 0x37911801,}, /* 65.0000 */ + {0x00438000, 0x37963803,}, /* 67.5000 */ + {0x0046CCCC, 0x37058803,}, /* 70.8000 */ + {0x00480000, 0x3710C805,}, /* 72.0000 */ + {0x004B0000, 0x37E22801,}, /* 75.0000 */ + {0x004EC000, 0x27915801,}, /* 78.7500 */ + {0x00500000, 0x37D8D802,}, /* 80.0000 */ + {0x0059CCCC, 0x27588802,}, /* 89.8000 */ + {0x005E8000, 0x27EC4802,}, /* 94.5000 */ + {0x00630000, 0x27AC6803,}, /* 99.0000 */ + {0x00640000, 0x27088801,}, /* 100.0000 */ + {0x006C0000, 0x2710C805,}, /* 108.0000 */ + {0x00708000, 0x27E36802,}, /* 112.5000 */ + {0x00820000, 0x27C58803,}, /* 130.0000 */ + {0x00870000, 0x27316803,}, /* 135.0000 */ + {0x009D8000, 0x2F915801,}, /* 157.5000 */ + {0x00A20000, 0x2F08A801,}, /* 162.0000 */ + {0x00AF0000, 0x2FB11802,}, /* 175.0000 */ + {0x00BD0000, 0x2FEC4802,}, /* 189.0000 */ + {0x00CA0000, 0x2F963803,}, /* 202.0000 */ + {0x00E80000, 0x2FB1B802,}, /* 232.0000 */ +}; + +#define NUM_CS5530_FREQUENCIES sizeof(CS5530_PLLtable)/sizeof(CS5530PLLENTRY) + +int cs5530_set_video_enable(int enable); +int cs5530_set_video_format(unsigned long format); +int cs5530_set_video_size(unsigned short width, unsigned short height); +int cs5530_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); +int cs5530_set_video_offset(unsigned long offset); +int cs5530_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset); +int cs5530_set_video_window(short x, short y, unsigned short w, + unsigned short h); +int cs5530_set_video_left_crop(unsigned short x); +int cs5530_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int cs5530_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int cs5530_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth); +void cs5530_set_video_vertical_downscale_enable(int enable); +int cs5530_set_video_downscale_config(unsigned short type, unsigned short m); +int cs5530_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); +int cs5530_set_video_filter(int xfilter, int yfilter); +int cs5530_set_video_palette(unsigned long *palette); +int cs5530_set_video_palette_entry(unsigned long index, unsigned long color); +int cs5530_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); +int cs5530_set_video_downscale_enable(int enable); +int cs5530_set_video_source(VideoSourceType source); +int cs5530_set_vbi_source(VbiSourceType source); +int cs5530_set_vbi_lines(unsigned long even, unsigned long odd); +int cs5530_set_vbi_total(unsigned long even, unsigned long odd); +int cs5530_set_video_interlaced(int enable); +int cs5530_set_color_space_YUV(int enable); +int cs5530_set_vertical_scaler_offset(char offset); +int cs5530_set_top_line_in_odd(int enable); +int cs5530_set_genlock_delay(unsigned long delay); +int cs5530_set_genlock_enable(int flags); +int cs5530_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, + unsigned long color1, unsigned long color2); +int cs5530_set_video_cursor_enable(int enable); +int cs5530_set_video_request(short x, short y); + +int cs5530_select_alpha_region(int region); +int cs5530_set_alpha_enable(int enable); +int cs5530_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); +int cs5530_set_alpha_value(unsigned char alpha, char delta); +int cs5530_set_alpha_priority(int priority); +int cs5530_set_alpha_color(unsigned long color); +int cs5530_set_alpha_color_enable(int enable); +int cs5530_set_no_ck_outside_alpha(int enable); +int cs5530_disable_softvga(void); +int cs5530_enable_softvga(void); +int cs5530_set_macrovision_enable(int enable); +int cs5530_set_crt_enable(int enable); +void cs5530_reset_video(void); +int cs5530_set_display_control(int sync_polarities); +void cs5530_set_clock_frequency(unsigned long frequency); + +/* READ ROUTINES IN GFX_VID.C */ + +int cs5530_get_video_enable(void); +int cs5530_get_video_format(void); +unsigned long cs5530_get_video_src_size(void); +unsigned long cs5530_get_video_line_size(void); +unsigned long cs5530_get_video_xclip(void); +unsigned long cs5530_get_video_offset(void); +void cs5530_get_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset); +void cs5530_get_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long cs5530_get_video_upscale(void); +unsigned long cs5530_get_video_scale(void); +unsigned long cs5530_get_video_downscale_delta(void); +int cs5530_get_video_vertical_downscale_enable(void); +int cs5530_get_video_downscale_config(unsigned short *type, + unsigned short *m); +void cs5530_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); +void cs5530_get_video_downscale_enable(int *enable); +unsigned long cs5530_get_video_dst_size(void); +unsigned long cs5530_get_video_position(void); +unsigned long cs5530_get_video_color_key(void); +unsigned long cs5530_get_video_color_key_mask(void); +int cs5530_get_video_palette_entry(unsigned long index, + unsigned long *palette); +int cs5530_get_video_color_key_src(void); +int cs5530_get_video_filter(void); +int cs5530_get_video_request(short *x, short *y); +int cs5530_get_video_source(VideoSourceType * source); +int cs5530_get_vbi_source(VbiSourceType * source); +unsigned long cs5530_get_vbi_lines(int odd); +unsigned long cs5530_get_vbi_total(int odd); +int cs5530_get_video_interlaced(void); +int cs5530_get_color_space_YUV(void); +int cs5530_get_vertical_scaler_offset(char *offset); +unsigned long cs5530_get_genlock_delay(void); +int cs5530_get_genlock_enable(void); +int cs5530_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); +unsigned long cs5530_read_crc(void); +unsigned long cs5530_read_crc32(void); +unsigned long cs5530_read_window_crc(int source, unsigned short x, + unsigned short y, unsigned short width, + unsigned short height, int crc32); +int cs5530_get_macrovision_enable(void); + +void cs5530_get_alpha_enable(int *enable); +void cs5530_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); +void cs5530_get_alpha_value(unsigned char *alpha, char *delta); +void cs5530_get_alpha_priority(int *priority); +void cs5530_get_alpha_color(unsigned long *color); +unsigned long cs5530_get_clock_frequency(void); +int cs5530_get_vsa2_softvga_enable(void); +int cs5530_get_sync_polarities(void); + +/*--------------------------------------------------------------------------- + * gfx_set_crt_enable + * + * This routine enables or disables the CRT output from the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_crt_enable(int enable) +#else +int +gfx_set_crt_enable(int enable) +#endif +{ + unsigned long config; + + config = READ_VID32(CS5530_DISPLAY_CONFIG); + + switch (enable) { + case CRT_DISABLE: /* Disable everything */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | + CS5530_DCFG_DAC_PWDNX)); + break; + + case CRT_ENABLE: /* Enable CRT display, including display logic */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + config | CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | + CS5530_DCFG_DAC_PWDNX); + break; + + case CRT_STANDBY: /* HSync:Off VSync:On */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + (config & + ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) + | CS5530_DCFG_VSYNC_EN); + break; + + case CRT_SUSPEND: /* HSync:On VSync:Off */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + (config & + ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_VSYNC_EN | + CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) + | CS5530_DCFG_HSYNC_EN); + break; + + default: + return (GFX_STATUS_BAD_PARAMETER); + } + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +cs5530_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + gfx_set_video_enable(0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine configures the display output. + * + * "sync_polarities" is used to set the polarities of the sync pulses according + * to the following mask: + * + * Bit 0: If set to 1, negative horizontal polarity is programmed, + * otherwise positive horizontal polarity is programmed. + * Bit 1: If set to 1, negative vertical polarity is programmed, + * otherwise positive vertical polarity is programmed. + * + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_display_control(int sync_polarities) +#else +int +gfx_set_display_control(int sync_polarities) +#endif +{ + unsigned long dcfg; + + /* ENABLE DISPLAY OUTPUT FROM CX5530 */ + + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + + dcfg &= ~(CS5530_DCFG_CRT_SYNC_SKW_MASK | CS5530_DCFG_PWR_SEQ_DLY_MASK | + CS5530_DCFG_CRT_HSYNC_POL | CS5530_DCFG_CRT_VSYNC_POL | + CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + + /* INITIALIZATION */ + + dcfg |= (CS5530_DCFG_CRT_SYNC_SKW_INIT | + CS5530_DCFG_PWR_SEQ_DLY_INIT | CS5530_DCFG_GV_PAL_BYP); + + if (PanelEnable) { + dcfg |= CS5530_DCFG_FP_PWR_EN; + dcfg |= CS5530_DCFG_FP_DATA_EN; + } + + /* SET APPROPRIATE SYNC POLARITIES */ + + if (sync_polarities & 1) + dcfg |= CS5530_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 2) + dcfg |= CS5530_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +cs5530_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value; + long min, diff; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = CS5530_PLLtable[0].pll_value; + min = (long)CS5530_PLLtable[0].frequency - frequency; + if (min < 0L) + min = -min; + for (index = 1; index < NUM_CS5530_FREQUENCIES; index++) { + diff = (long)CS5530_PLLtable[index].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + value = CS5530_PLLtable[index].pll_value; + } + } + + /* SET THE DOT CLOCK REGISTER */ + + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value); + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value | 0x80000100); /* set reset/bypass */ + gfx_delay_milliseconds(1); /* wait for PLL to settle */ + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value & 0x7FFFFFFF); /* clear reset */ + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value & 0x7FFFFEFF); /* clear bypass */ + return; +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + if (enable) { + /* ENABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(1); + + /* SET CS5530 BUS CONTROL PARAMETERS */ + /* Currently always high speed, 8-bit interface. */ + + vcfg |= CS5530_VCFG_HIGH_SPD_INT; + vcfg &= ~(CS5530_VCFG_EARLY_VID_RDY | CS5530_VCFG_16_BIT_EN); + + /* ENABLE CS5530 VIDEO OVERLAY */ + + vcfg |= CS5530_VCFG_VID_EN; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE CS5530 VIDEO OVERLAY */ + + vcfg &= ~CS5530_VCFG_VID_EN; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + /* DISABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(0); + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_format + * + * Currently only sets 4:2:0 format, Y1 V Y0 U. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long vcfg = 0; + + /* SET THE CS5530 VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~(CS5530_VCFG_VID_INP_FORMAT | CS5530_VCFG_4_2_0_MODE); + vcfg &= ~(CS5530_VCFG_CSC_BYPASS); + vcfg &= ~(CS5530_VCFG_GV_SEL); + + if (format < 4) + vcfg |= (format << 2); + else { + if (format == VIDEO_FORMAT_Y0Y1Y2Y3) { + vcfg |= CS5530_VCFG_4_2_0_MODE; + vcfg |= 1 << 2; + } + if (format == VIDEO_FORMAT_RGB) { + vcfg |= CS5530_VCFG_CSC_BYPASS; + vcfg |= CS5530_VCFG_GV_SEL; + } + } + + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg; + + /* SET THE CS5530 VIDEO LINE SIZE */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~(CS5530_VCFG_LINE_SIZE_LOWER_MASK | CS5530_VCFG_LINE_SIZE_UPPER); + size = (width >> 1); + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= CS5530_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + /* SET TOTAL VIDEO BUFFER SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_size(width, height); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS */ + /* These are needed for clipping the video window later. */ + + gfx_vid_srcw = srcw; + gfx_vid_srch = srch; + gfx_vid_dstw = dstw; + gfx_vid_dsth = dsth; + + /* CALCULATE CS5530 SCALE FACTORS */ + /* No downscaling in CS5530 so force to 1x if attempted. */ + + if (dstw <= srcw) + xscale = 0x1FFF; + else if (dstw == 1 || srcw == 1) + return GFX_STATUS_BAD_PARAMETER; + else + xscale = (0x2000l * (srcw - 1l)) / (dstw - 1l); + if (dsth <= srch) + yscale = 0x1FFF; + else if (dsth == 1 || srch == 1) + return GFX_STATUS_BAD_PARAMETER; + else + yscale = (0x2000l * (srch - 1l)) / (dsth - 1l); + WRITE_VID32(CS5530_VIDEO_SCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values effect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * position is specified in screen relative coordinates, and may be negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_window(short x, short y, unsigned short w, unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long vcfg = 0; + unsigned long hadjust, vadjust; + unsigned long xstart, ystart, xend, yend; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 13l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + + /* HORIZONTAL START */ + xstart = (unsigned long)x + hadjust; + + /* HORIZONTAL END */ + /* End positions in register are non-inclusive (one more than the actual end) */ + + if ((x + w) < gfx_get_hactive()) + xend = (unsigned long)x + (unsigned long)w + hadjust; + else /* right clipping needed */ + xend = (unsigned long)gfx_get_hactive() + hadjust; + + /* VERTICAL START */ + + ystart = (unsigned long)y + vadjust; + + /* VERTICAL END */ + + if ((y + h) < gfx_get_vactive()) + yend = (unsigned long)y + (unsigned long)h + vadjust; + else /* bottom clipping needed */ + yend = (unsigned long)gfx_get_vactive() + vadjust; + + /* DISABLE REGISTER UPDATES */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~CS5530_VCFG_VID_REG_UPDATE; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + /* SET VIDEO POSITION */ + + WRITE_VID32(CS5530_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(CS5530_VIDEO_Y_POS, (yend << 16) | ystart); + + vcfg |= CS5530_VCFG_VID_REG_UPDATE; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + * + * This routine sets the number of pixels which will be cropped from the + * beginning of each video line. The video window will begin to display only + * from the pixel following the cropped pixels, and the cropped pixels + * will be ignored. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_left_crop(unsigned short x) +#else +int +gfx_set_video_left_crop(unsigned short x) +#endif +{ + unsigned long vcfg, initread; + + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero */ + + if (gfx_vid_dstw) + initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + + else + initread = 0; + + /* SET INITIAL READ ADDRESS AND ENABLE REGISTER UPDATES */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~CS5530_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & CS5530_VCFG_INIT_READ_MASK; + vcfg |= CS5530_VCFG_VID_REG_UPDATE; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * The source data can be either graphics data or video data. The bluescreen + * parameter is set to have the hardware compare video data and clear to + * comapare graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET CS5530 COLOR KEY VALUE */ + + WRITE_VID32(CS5530_VIDEO_COLOR_KEY, key); + WRITE_VID32(CS5530_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~CS5530_DCFG_VG_CK; + else + dcfg |= CS5530_DCFG_VG_CK; + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE CS5530 VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~(CS5530_VCFG_X_FILTER_EN | CS5530_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= CS5530_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= CS5530_VCFG_Y_FILTER_EN; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for CS5530, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + + /* LOAD CS5530 VIDEO PALETTE */ + + WRITE_VID32(CS5530_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = i | (i << 8) | (i << 16); + WRITE_VID32(CS5530_PALETTE_DATA, entry); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(CS5530_PALETTE_ADDRESS, index); + WRITE_VID32(CS5530_PALETTE_DATA, palette); + + return (0); +} + +#define CX55xx_VIDEO_PCI_44 0x80009444 + +/*--------------------------------------------------------------------------- + * gfx_disable_softvga + * + * Disables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be disabled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_disable_softvga(void) +#else +int +gfx_disable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + /* setting video PCI register 44 bit 0 to 1 disables SoftVga */ + reg_val |= 0x1; + gfx_pci_config_write(CX55xx_VIDEO_PCI_44, reg_val); + + /* see if we set the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0x1) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_enable_softvga + * + * Enables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be enbled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_enable_softvga(void) +#else +int +gfx_enable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + /* clearing video PCI register 44 bit 0 enables SoftVga */ + gfx_pci_config_write(CX55xx_VIDEO_PCI_44, reg_val & 0xfffffffe); + + /* see if we cleared the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + unsigned int index; + unsigned long value, mask; + + mask = 0x7FFFFEDC; + value = READ_VID32(CS5530_DOT_CLK_CONFIG) & mask; + for (index = 0; index < NUM_CS5530_FREQUENCIES; index++) { + if ((CS5530_PLLtable[index].pll_value & mask) == value) + return (CS5530_PLLtable[index].frequency); + } + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_vsa2_softvga_enable + * + * This function returns the enable status of SoftVGA. It is valid + * only if VSAII is present. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_vsa2_softvga_enable(void) +#else +int +gfx_get_vsa2_softvga_enable(void) +#endif +{ + unsigned long reg_val; + + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(CS5530_DISPLAY_CONFIG) & 0x00000100) + polarities |= 1; + if (READ_VID32(CS5530_DISPLAY_CONFIG) & 0x00000200) + polarities |= 2; + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(CS5530_PALETTE_ADDRESS, index); + *palette = READ_VID32(CS5530_PALETTE_DATA); + + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_VID_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long vcfg; + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + if (vcfg & CS5530_VCFG_CSC_BYPASS) + return (VIDEO_FORMAT_RGB); + if (vcfg & CS5530_VCFG_4_2_0_MODE) + return (VIDEO_FORMAT_Y0Y1Y2Y3); + + return ((int)((vcfg >> 2) & 3)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width = 0, height = 0; + + /* DETERMINE SOURCE WIDTH FROM THE CS5530 VIDEO LINE SIZE */ + + width = (READ_VID32(CS5530_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_LINE_SIZE_UPPER) + width += 512l; + + if (width) { + /* DETERMINE HEIGHT BY DIVIDING TOTAL SIZE BY WIDTH */ + /* Get total size from display controller - abtracted. */ + + height = gfx_get_display_video_size() / (width << 1); + } + return ((height << 16) | width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE CS5530 VIDEO LINE SIZE */ + + width = (READ_VID32(CS5530_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_LINE_SIZE_UPPER) + width += 512l; + return (width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE CS5530 VIDEO LINE SIZE */ + + clip = (READ_VID32(CS5530_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return (READ_VID32(CS5530_VIDEO_SCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + * NOTE: This is the displayed window size, which may be different from + * the real window size if clipped. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(CS5530_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x7FF) - (xsize & 0x07FF); + ysize = READ_VID32(CS5530_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x7FF) - (ysize & 0x07FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + * NOTE: This is the displayed window position, which may be different from + * the real window position if clipped. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(CS5530_VIDEO_X_POS) & 0x000007FF; + ypos = READ_VID32(CS5530_VIDEO_Y_POS) & 0x000007FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 13l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(CS5530_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(CS5530_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(CS5530_DISPLAY_CONFIG) & CS5530_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + unsigned long crc = 0xFFFFFFFF; + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(CS5530_CRCSIG_TFT_TV, 0); + WRITE_VID32(CS5530_CRCSIG_TFT_TV, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(CS5530_CRCSIG_TFT_TV) >> 8; + } + return (crc); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_rdcl.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_rdcl.c:1.3 --- /dev/null Thu Feb 27 12:31:17 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_rdcl.c Fri Feb 21 11:51:10 2003 @@ -0,0 +1,2913 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vid_rdcl.c,v 1.3 2003/02/21 16:51:10 alanh Exp $ */ +/* + * $Workfile: vid_rdcl.c $ + * + * This file contains routines to control the Redcloud display filter video overlay hardware. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* REDCLOUD PLL TABLE */ + +typedef struct RCDFPLL +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long post_div3; /* MCP Frequency dividers and multipliers */ + unsigned long pre_mul2; + unsigned long pre_div2; + unsigned long pll_value; /* MCP DotPLL Register Upper 32(0x0015) */ +} +RCDFPLLENTRY; + +RCDFPLLENTRY RCDF_PLLtable48MHz[] = { + {0x00192CCC, 0, 0, 0, 0x00000037}, /* 25.1750 */ + {0x001C526E, 1, 1, 0, 0x00000B1A}, /* 28.3220 */ + {0x001F8000, 1, 0, 0, 0x000002D2}, /* 31.5000 */ + {0x00240000, 1, 1, 0, 0x00000FE2}, /* 36.0000 */ + {0x00258000, 1, 0, 0, 0x0000057A}, /* 37.5000 */ + {0x00280000, 1, 0, 0, 0x0000030A}, /* 40.0000 */ + {0x002CE666, 0, 0, 0, 0x00000063}, /* 44.9000 */ + {0x00318000, 0, 0, 0, 0x0000054B}, /* 49.5000 */ + {0x00320000, 0, 0, 0, 0x0000026E}, /* 50.0000 */ + {0x00325999, 0, 1, 0, 0x00000037}, /* 50.3500 */ + {0x00360000, 1, 1, 0, 0x00000B0D}, /* 54.0000 */ + {0x00384000, 0, 0, 0, 0x00000577}, /* 56.2500 */ + {0x0038643F, 0, 0, 0, 0x000007F7}, /* 56.3916 */ + {0x0038A4DD, 0, 0, 0, 0x0000057B}, /* 56.6444 */ + {0x003B0000, 0, 1, 0, 0x00000707}, /* 59.0000 */ + {0x003F0000, 1, 1, 0, 0x00000B39}, /* 63.0000 */ + {0x00410000, 1, 1, 0, 0x00000B45}, /* 65.0000 */ + {0x00438000, 1, 1, 0, 0x00000FC1}, /* 67.5000 */ + {0x0046CCCC, 1, 0, 0, 0x00000561}, /* 70.8000 */ + {0x00480000, 1, 0, 0, 0x000007E1}, /* 72.0000 */ + {0x004B0000, 0, 0, 0, 0x00000052}, /* 75.0000 */ + {0x004EC000, 0, 0, 0, 0x00000056}, /* 78.7500 */ + {0x00500000, 1, 1, 0, 0x00000709}, /* 80.0000 */ + {0x0059CCCC, 0, 1, 0, 0x00000262}, /* 89.8000 */ + {0x005E8000, 0, 0, 0, 0x000002D2}, /* 94.5000 */ + {0x00630000, 0, 1, 0, 0x00000B4A}, /* 99.0000 */ + {0x00640000, 0, 1, 0, 0x00000036}, /* 100.0000 */ + {0x006C0000, 0, 0, 0, 0x000007E2}, /* 108.0000 */ + {0x00708000, 0, 0, 0, 0x000007F6}, /* 112.5000 */ + {0x00820000, 1, 1, 0, 0x00000FB0}, /* 130.0000 */ + {0x00870000, 1, 1, 0, 0x00000B50}, /* 135.0000 */ + {0x009D8000, 0, 0, 0, 0x00000055}, /* 157.5000 */ + {0x00A20000, 0, 0, 0, 0x000009C1}, /* 162.0000 */ + {0x00AF8000, 0, 0, 0, 0x000002C1}, /* 175.5000 */ + {0x00BD0000, 0, 0, 0, 0x000002D1}, /* 189.0000 */ + {0x00CA8000, 0, 0, 0, 0x00000551}, /* 202.5000 */ + {0x00E58000, 0, 0, 0, 0x0000057D}, /* 229.5000 */ +}; + +RCDFPLLENTRY RCDF_PLLtable14MHz[] = { + {0x00192CCC, 0, 0, 0, 0x00000037}, /* 25.1750 */ + {0x001C526E, 0, 0, 0, 0x00000B7B}, /* 28.3220 */ + {0x001F8000, 0, 0, 0, 0x000004D3}, /* 31.5000 */ + {0x00240000, 0, 0, 0, 0x00000BE3}, /* 36.0000 */ + {0x00258000, 0, 0, 0, 0x0000074F}, /* 37.5000 */ + {0x00280000, 0, 0, 0, 0x0000050B}, /* 40.0000 */ + {0x002CE666, 0, 0, 0, 0x00000063}, /* 44.9000 */ + {0x00318000, 0, 0, 0, 0x0000054B}, /* 49.5000 */ + {0x00320000, 0, 0, 0, 0x0000026E}, /* 50.0000 */ + {0x00325999, 0, 0, 0, 0x000007C3}, /* 50.3500 */ + {0x00360000, 0, 0, 0, 0x000007E3}, /* 54.0000 */ + {0x00384000, 0, 0, 0, 0x00000577}, /* 56.2500 */ + {0x0038643F, 0, 0, 0, 0x000002FB}, /* 56.3916 */ + {0x0038A4DD, 0, 0, 0, 0x0000057B}, /* 56.6444 */ + {0x003B0000, 0, 0, 0, 0x0000058B}, /* 59.0000 */ + {0x003F0000, 0, 0, 0, 0x0000095E}, /* 63.0000 */ + {0x00410000, 0, 0, 0, 0x0000096A}, /* 65.0000 */ + {0x00438000, 0, 0, 0, 0x00000BC2}, /* 67.5000 */ + {0x0046CCCC, 0, 0, 0, 0x0000098A}, /* 70.8000 */ + {0x00480000, 0, 0, 0, 0x00000BE2}, /* 72.0000 */ + {0x004B0000, 0, 0, 0, 0x00000052}, /* 75.0000 */ + {0x004EC000, 0, 0, 0, 0x00000056}, /* 78.7500 */ + {0x00500000, 0, 0, 0, 0x0000050A}, /* 80.0000 */ + {0x0059CCCC, 0, 0, 0, 0x0000078E}, /* 89.8000 */ + {0x005E8000, 0, 0, 0, 0x000002D2}, /* 94.5000 */ + {0x00630000, 0, 0, 0, 0x000011F6}, /* 99.0000 */ + {0x00640000, 0, 0, 0, 0x0000054E}, /* 100.0000 */ + {0x006C0000, 0, 0, 0, 0x000007E2}, /* 108.0000 */ + {0x00708000, 0, 0, 0, 0x000002FA}, /* 112.5000 */ + {0x00820000, 0, 0, 0, 0x00000BB1}, /* 130.0000 */ + {0x00870000, 0, 0, 0, 0x00000975}, /* 135.0000 */ + {0x009D8000, 0, 0, 0, 0x00000055}, /* 157.5000 */ + {0x00A20000, 0, 0, 0, 0x000009C1}, /* 162.0000 */ + {0x00AF8000, 0, 0, 0, 0x000002C1}, /* 175.5000 */ + {0x00BD0000, 0, 0, 0, 0x00000539}, /* 189.0000 */ + {0x00CA8000, 0, 0, 0, 0x00000551}, /* 202.5000 */ + {0x00E58000, 0, 0, 0, 0x0000057D}, /* 229.5000 */ +}; + +#define NUM_RCDF_FREQUENCIES sizeof(RCDF_PLLtable14MHz)/sizeof(RCDFPLLENTRY) + +int redcloud_set_video_enable(int enable); +int redcloud_set_video_format(unsigned long format); +int redcloud_set_video_size(unsigned short width, unsigned short height); +int redcloud_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); +int redcloud_set_video_offset(unsigned long offset); +int redcloud_set_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, + unsigned long voffset); +int redcloud_set_video_window(short x, short y, unsigned short w, + unsigned short h); +int redcloud_set_video_left_crop(unsigned short x); +int redcloud_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int redcloud_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int redcloud_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth); +void redcloud_set_video_vertical_downscale_enable(int enable); +int redcloud_set_video_downscale_config(unsigned short type, + unsigned short m); +int redcloud_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); +int redcloud_set_video_filter(int xfilter, int yfilter); +int redcloud_set_video_palette(unsigned long *palette); +int redcloud_set_video_palette_entry(unsigned long index, + unsigned long color); +int redcloud_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); +int redcloud_set_video_downscale_enable(int enable); +int redcloud_set_video_source(VideoSourceType source); +int redcloud_set_vbi_source(VbiSourceType source); +int redcloud_set_vbi_lines(unsigned long even, unsigned long odd); +int redcloud_set_vbi_total(unsigned long even, unsigned long odd); +int redcloud_set_video_interlaced(int enable); +int redcloud_set_color_space_YUV(int enable); +int redcloud_set_vertical_scaler_offset(char offset); +int redcloud_set_top_line_in_odd(int enable); +int redcloud_set_genlock_delay(unsigned long delay); +int redcloud_set_genlock_enable(int flags); +int redcloud_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, + unsigned long color1, unsigned long color2); +int redcloud_set_video_cursor_enable(int enable); +int redcloud_set_video_request(short x, short y); + +int redcloud_select_alpha_region(int region); +int redcloud_set_alpha_enable(int enable); +int redcloud_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); +int redcloud_set_alpha_value(unsigned char alpha, char delta); +int redcloud_set_alpha_priority(int priority); +int redcloud_set_alpha_color(unsigned long color); +int redcloud_set_alpha_color_enable(int enable); +int redcloud_set_no_ck_outside_alpha(int enable); +int redcloud_disable_softvga(void); +int redcloud_enable_softvga(void); +int redcloud_set_macrovision_enable(int enable); +void redcloud_reset_video(void); +int redcloud_set_display_control(int sync_polarities); +void redcloud_set_clock_frequency(unsigned long frequency); +int redcloud_set_crt_enable(int enable); + +/* READ ROUTINES IN GFX_VID.C */ + +int redcloud_get_video_enable(void); +int redcloud_get_video_format(void); +unsigned long redcloud_get_video_src_size(void); +unsigned long redcloud_get_video_line_size(void); +unsigned long redcloud_get_video_xclip(void); +unsigned long redcloud_get_video_offset(void); +void redcloud_get_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, + unsigned long *voffset); +void redcloud_get_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long redcloud_get_video_upscale(void); +unsigned long redcloud_get_video_scale(void); +unsigned long redcloud_get_video_downscale_delta(void); +int redcloud_get_video_vertical_downscale_enable(void); +int redcloud_get_video_downscale_config(unsigned short *type, + unsigned short *m); +void redcloud_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); +void redcloud_get_video_downscale_enable(int *enable); +unsigned long redcloud_get_video_dst_size(void); +unsigned long redcloud_get_video_position(void); +unsigned long redcloud_get_video_color_key(void); +unsigned long redcloud_get_video_color_key_mask(void); +int redcloud_get_video_palette_entry(unsigned long index, + unsigned long *palette); +int redcloud_get_video_color_key_src(void); +int redcloud_get_video_filter(void); +int redcloud_get_video_request(short *x, short *y); +int redcloud_get_video_source(VideoSourceType * source); +int redcloud_get_vbi_source(VbiSourceType * source); +unsigned long redcloud_get_vbi_lines(int odd); +unsigned long redcloud_get_vbi_total(int odd); +int redcloud_get_video_interlaced(void); +int redcloud_get_color_space_YUV(void); +int redcloud_get_vertical_scaler_offset(char *offset); +unsigned long redcloud_get_genlock_delay(void); +int redcloud_get_genlock_enable(void); +int redcloud_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); +unsigned long redcloud_read_crc(void); +unsigned long redcloud_read_crc32(void); +unsigned long redcloud_read_window_crc(int source, unsigned short x, + unsigned short y, unsigned short width, + unsigned short height, int crc32); +int redcloud_get_macrovision_enable(void); + +void redcloud_get_alpha_enable(int *enable); +void redcloud_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); +void redcloud_get_alpha_value(unsigned char *alpha, char *delta); +void redcloud_get_alpha_priority(int *priority); +void redcloud_get_alpha_color(unsigned long *color); +unsigned long redcloud_get_clock_frequency(void); +int redcloud_get_sync_polarities(void); + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + gfx_set_video_enable(0); + gfx_select_alpha_region(1); + gfx_set_alpha_enable(0); + gfx_select_alpha_region(2); + gfx_set_alpha_enable(0); + + /* SET REGION 0 AFTER RESET */ + + gfx_select_alpha_region(0); + gfx_set_alpha_enable(0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine configures the display output. + * + * "sync_polarities" is used to set the polarities of the sync pulses according + * to the following mask: + * + * Bit 0: If set to 1, negative horizontal polarity is programmed, + * otherwise positive horizontal polarity is programmed. + * Bit 1: If set to 1, negative vertical polarity is programmed, + * otherwise positive vertical polarity is programmed. + * + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_display_control(int sync_polarities) +#else +int +gfx_set_display_control(int sync_polarities) +#endif +{ + unsigned long power; + unsigned long dcfg; + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + dcfg &= ~(RCDF_DCFG_CRT_SYNC_SKW_MASK | RCDF_DCFG_PWR_SEQ_DLY_MASK | + RCDF_DCFG_CRT_HSYNC_POL | RCDF_DCFG_CRT_VSYNC_POL | + RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + + dcfg |= (RCDF_DCFG_CRT_SYNC_SKW_INIT | + RCDF_DCFG_PWR_SEQ_DLY_INIT | RCDF_DCFG_GV_PAL_BYP); + + if (PanelEnable) { + power = READ_VID32(RCDF_POWER_MANAGEMENT); + power |= RCDF_PM_PANEL_POWER_ON; + WRITE_VID32(RCDF_POWER_MANAGEMENT, power); + } + + /* SET APPROPRIATE SYNC POLARITIES */ + + if (sync_polarities & 0x1) + dcfg |= RCDF_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 0x2) + dcfg |= RCDF_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + Q_WORD msr_value; + unsigned int i, index = 0; + unsigned long value; + long timeout = 1000; + long min, diff; + RCDFPLLENTRY *PllTable; + + /* READ PLL REFERENCE FREQUENCY */ + /* The reference frequency of GX2 1.x is different from 2.x and above. */ + + if ((gfx_cpu_version & 0xFF00) >= 0x0200) + PllTable = RCDF_PLLtable48MHz; + else + PllTable = RCDF_PLLtable14MHz; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = PllTable[0].pll_value; + min = (long)PllTable[0].frequency - frequency; + if (min < 0L) + min = -min; + for (i = 1; i < NUM_RCDF_FREQUENCIES; i++) { + diff = (long)PllTable[i].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + index = i; + } + } + + /* PROGRAM THE SETTINGS WITH THE RESET BIT SET */ + /* Clear the bypass bit to ensure that the programmed */ + /* M, N and P values are being used. */ + + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + msr_value.high = PllTable[index].pll_value; + msr_value.low |= 0x00000001; + msr_value.low &= ~MCP_DOTPLL_BYPASS; + gfx_msr_write(RC_ID_MCP, MCP_DOTPLL, &msr_value); + + /* PROGRAM THE MCP DIVIDER VALUES */ + + gfx_msr_read(RC_ID_MCP, MCP_SYS_RSTPLL, &msr_value); + if (PllTable[index].post_div3) + msr_value.low |= MCP_DOTPOSTDIV3; + else + msr_value.low &= ~MCP_DOTPOSTDIV3; + if (PllTable[index].pre_div2) + msr_value.low |= MCP_DOTPREDIV2; + else + msr_value.low &= ~MCP_DOTPREDIV2; + if (PllTable[index].pre_mul2) + msr_value.low |= MCP_DOTPREMULT2; + else + msr_value.low &= ~MCP_DOTPREMULT2; + gfx_msr_write(RC_ID_MCP, MCP_SYS_RSTPLL, &msr_value); + + /* CLEAR THE RESET BIT */ + + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + msr_value.low &= 0xFFFFFFFE; + gfx_msr_write(RC_ID_MCP, MCP_DOTPLL, &msr_value); + + /* WAIT FOR LOCK BIT */ + + do { + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + } while (timeout-- && !(msr_value.low & MCP_DOTPLL_LOCK)); +} + +/*--------------------------------------------------------------------------- + * gfx_set_crt_enable + * + * This routine enables or disables the CRT output from the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_crt_enable(int enable) +#else +int +gfx_set_crt_enable(int enable) +#endif +{ + unsigned long config, misc; + + config = READ_VID32(RCDF_DISPLAY_CONFIG); + misc = READ_VID32(RCDF_VID_MISC); + + switch (enable) { + case CRT_DISABLE: /* DISABLE EVERYTHING */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN)); + WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); + break; + + case CRT_ENABLE: /* ENABLE CRT DISPLAY, INCLUDING DISPLAY LOGIC */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + config | RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN); + WRITE_VID32(RCDF_VID_MISC, + misc & ~RCDF_DAC_POWER_DOWN & ~RCDF_ANALOG_POWER_DOWN); + break; + + case CRT_STANDBY: /* HSYNC:OFF VSYNC:ON */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + (config & + ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_VSYNC_EN); + WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); + break; + + case CRT_SUSPEND: /* HSYNC:ON VSYNC:OFF */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + (config & + ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_VSYNC_EN | + RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_HSYNC_EN); + WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); + break; + + default: + return (GFX_STATUS_BAD_PARAMETER); + } + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + if (enable) { + /* ENABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(1); + + /* ENABLE DISPLAY FILTER VIDEO OVERLAY */ + + vcfg |= RCDF_VCFG_VID_EN; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE DISPLAY FILTER VIDEO OVERLAY */ + + vcfg &= ~RCDF_VCFG_VID_EN; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + + /* DISABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(0); + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_format + * + * Sets input video format type, to one of the YUV formats or to RGB. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long ctrl, vcfg = 0; + + /* SET THE DISPLAY FILTER VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + ctrl = READ_VID32(RCDF_VID_ALPHA_CONTROL); + ctrl &= ~(RCDF_VIDEO_INPUT_IS_RGB | RCDF_CSC_VIDEO_YUV_TO_RGB); + vcfg &= ~(RCDF_VCFG_VID_INP_FORMAT | RCDF_VCFG_4_2_0_MODE); + switch (format) { + case VIDEO_FORMAT_UYVY: + vcfg |= RCDF_VCFG_UYVY_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_YUYV: + vcfg |= RCDF_VCFG_YUYV_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_Y2YU: + vcfg |= RCDF_VCFG_Y2YU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_YVYU: + vcfg |= RCDF_VCFG_YVYU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_Y0Y1Y2Y3: + vcfg |= RCDF_VCFG_UYVY_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y3Y2Y1Y0: + vcfg |= RCDF_VCFG_Y2YU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y0Y3Y2: + vcfg |= RCDF_VCFG_YUYV_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y2Y3Y0: + vcfg |= RCDF_VCFG_YVYU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_RGB: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_UYVY_FORMAT; + break; + case VIDEO_FORMAT_P2M_P2L_P1M_P1L: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_Y2YU_FORMAT; + break; + case VIDEO_FORMAT_P1M_P1L_P2M_P2L: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_YUYV_FORMAT; + break; + case VIDEO_FORMAT_P1M_P2L_P2M_P1L: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_YVYU_FORMAT; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, ctrl); + + /* SET THE VIDEO FORMAT IN THE DISPLAY CONTROLLER */ + /* Use private routine to abstract display controller. */ + + gfx_set_display_video_format(format); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg, vid_420, pitch; + + /* SET THE DISPLAY FILTER VIDEO LINE SIZE */ + /* Match the DC hardware alignment requirement. The line size must */ + /* always be 32-byte aligned. However, we can manage smaller */ + /* alignments by decreasing the pitch and clipping the video window. */ + /* The VG will fetch extra data for each line, but the decreased */ + /* pitch will ensure that it always begins fetching at the start of */ + /* the video line. */ + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + + vid_420 = vcfg & RCDF_VCFG_4_2_0_MODE; + + vcfg &= ~(RCDF_VCFG_LINE_SIZE_LOWER_MASK | RCDF_VCFG_LINE_SIZE_UPPER); + + size = ((width >> 1) + 7) & 0xFFF8; + pitch = ((width << 1) + 7) & 0xFFF8; + + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= RCDF_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + + /* SET VIDEO BUFFER LINE SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_size(width, height); + + /* SET VIDEO PITCH */ + /* We are only maintaining legacy for 4:2:2 video formats. */ + /* 4:2:0 video in previous chips was inadequate for most */ + /* common video formats. */ + + if (!vid_420) + gfx_set_video_yuv_pitch(pitch, pitch << 1); + + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_yuv_offsets + * + * This routine sets the starting offset for the video buffer when displaying + * 4:2:0 video. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset) +#else +int +gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = yoffset; + gfx_vid_uoffset = uoffset; + gfx_vid_voffset = voffset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_yuv_offsets(yoffset, uoffset, voffset); + + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_video_yuv_pitch + * + * This routine sets the byte offset between consecutive scanlines of YUV video data + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#else +int +gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#endif +{ + /* SET VIDEO PITCH IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_yuv_pitch(ypitch, uvpitch); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS (unless don't-care zero destination arguments are used) */ + /* These are needed for clipping the video window later. */ + + if (dstw != 0) { + gfx_vid_srcw = srcw; + gfx_vid_dstw = dstw; + } + if (dsth != 0) { + gfx_vid_srch = srch; + gfx_vid_dsth = dsth; + } + + /* CALCULATE DISPLAY FILTER SCALE FACTORS */ + /* Zero width and height indicate don't care conditions */ + /* Downscaling is performed in a separate function. */ + + if (dstw == 0) + xscale = READ_VID32(RCDF_VIDEO_SCALE) & 0xffff; /* keep previous if don't-care argument */ + else if (dstw <= srcw) + xscale = 0x2000; /* horizontal downscaling is currently done in a separate function */ + else if ((srcw == 1) || (dstw == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + xscale = (0x2000l * (srcw - 1l)) / (dstw - 1l); + + if (dsth == 0) + yscale = (READ_VID32(RCDF_VIDEO_SCALE) & 0xffff0000) >> 16; /* keep previous if don't-care argument */ + else if (dsth <= srch) + yscale = 0x2000; /* vertical downscaling is handled in a separate function */ + else if ((srch == 1) || (dsth == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + yscale = (0x2000l * (srch - 1l)) / (dsth - 1l); + + WRITE_VID32(RCDF_VIDEO_SCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values affect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale + * + * This routine sets the vertical downscale factor for the video overlay window. + * The height of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth) +#else +int +gfx_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) +#endif +{ + /* SET VIDEO SCALE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract hardware */ + + gfx_set_display_video_downscale(srch, dsth); + return 0; +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale_enable + * + * This routine sets the vertical downscale enable for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_set_video_vertical_downscale_enable(int enable) +#else +void +gfx_set_video_vertical_downscale_enable(int enable) +#endif +{ + /* SET VIDEO SCALE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract hardware */ + + gfx_set_display_video_vertical_downscale_enable(enable); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_config + * + * This routine sets the downscale type and factor for the video overlay window. + * Note: No downscaling support for RGB565 and YUV420 video formats. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_downscale_config(unsigned short type, unsigned short m) +#else +int +gfx_set_video_downscale_config(unsigned short type, unsigned short m) +#endif +{ + unsigned long downscale; + + if ((m < 1) || (m > 16)) + return GFX_STATUS_BAD_PARAMETER; + + downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); + downscale &= + ~(RCDF_VIDEO_DOWNSCALE_FACTOR_MASK | RCDF_VIDEO_DOWNSCALE_TYPE_MASK); + downscale |= ((unsigned long)(m - 1) << RCDF_VIDEO_DOWNSCALE_FACTOR_POS); + switch (type) { + case VIDEO_DOWNSCALE_KEEP_1_OF: + downscale |= RCDF_VIDEO_DOWNSCALE_TYPE_A; + break; + case VIDEO_DOWNSCALE_DROP_1_OF: + downscale |= RCDF_VIDEO_DOWNSCALE_TYPE_B; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_coefficients + * + * This routine sets the downscale filter coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) +#else +int +gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) +#endif +{ + if ((coef1 + coef2 + coef3 + coef4) != 16) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(RCDF_VIDEO_DOWNSCALER_COEFFICIENTS, + ((unsigned long)coef1 << RCDF_VIDEO_DOWNSCALER_COEF1_POS) | + ((unsigned long)coef2 << RCDF_VIDEO_DOWNSCALER_COEF2_POS) | + ((unsigned long)coef3 << RCDF_VIDEO_DOWNSCALER_COEF3_POS) | + ((unsigned long)coef4 << RCDF_VIDEO_DOWNSCALER_COEF4_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_enable + * + * This routine enables or disables downscaling for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_downscale_enable(int enable) +#else +int +gfx_set_video_downscale_enable(int enable) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); + if (enable) + downscale |= RCDF_VIDEO_DOWNSCALE_ENABLE; + else + downscale &= ~RCDF_VIDEO_DOWNSCALE_ENABLE; + WRITE_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * x and y positions are specified in screen relative coordinates, and may be negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_window(short x, short y, unsigned short w, + unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xstart, ystart, xend, yend; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 14l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + + /* HORIZONTAL START */ + xstart = (unsigned long)x + hadjust; + + /* HORIZONTAL END */ + /* End positions in register are non-inclusive (one more than the actual end) */ + + if ((x + w) < gfx_get_hactive()) + xend = (unsigned long)x + (unsigned long)w + hadjust; + + /* RIGHT-CLIPPING */ + else + xend = (unsigned long)gfx_get_hactive() + hadjust; + + /* VERTICAL START */ + + ystart = (unsigned long)y + vadjust; + + /* VERTICAL END */ + + if ((y + h) < gfx_get_vactive()) + yend = (unsigned long)y + (unsigned long)h + vadjust; + + /* BOTTOM-CLIPPING */ + else + yend = (unsigned long)gfx_get_vactive() + vadjust; + + /* SET VIDEO POSITION */ + + WRITE_VID32(RCDF_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(RCDF_VIDEO_Y_POS, (yend << 16) | ystart); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + * + * This routine sets the number of pixels which will be cropped from the + * beginning of each video line. The video window will begin to display only + * from the pixel following the cropped pixels, and the cropped pixels + * will be ignored. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_left_crop(unsigned short x) +#else +int +gfx_set_video_left_crop(unsigned short x) +#endif +{ + unsigned long vcfg, initread; + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero. Mask the */ + /* lower three bits when clipping 4:2:0 video. By masking the bits instead */ + /* of rounding up we ensure that we always clip less than or equal to the */ + /* desired number of pixels. This prevents visual artifacts from */ + /* over-clipping. We mask three bits to meet the HW requirement that 4:2:0 */ + /* clipping be 16-byte or 8-pixel aligned. */ + + if (gfx_vid_dstw) { + initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + + if (vcfg & RCDF_VCFG_4_2_0_MODE) + initread &= 0xFFF8; + } else + initread = 0; + + /* SET INITIAL READ ADDRESS */ + + vcfg &= ~RCDF_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & RCDF_VCFG_INIT_READ_MASK; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * If "graphics" is set to TRUE, the source data is graphics, and color key + * is an RGB value. If "graphics" is set to FALSE, the source data is the video, + * and color key is a YUV value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET RCDF COLOR KEY VALUE */ + + WRITE_VID32(RCDF_VIDEO_COLOR_KEY, key); + WRITE_VID32(RCDF_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~RCDF_DCFG_VG_CK; + else + dcfg |= RCDF_DCFG_VG_CK; + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE DISPLAY FILTER VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + vcfg &= ~(RCDF_VCFG_X_FILTER_EN | RCDF_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= RCDF_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= RCDF_VCFG_Y_FILTER_EN; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for Redcloud, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + + /* LOAD REDCLOUD VIDEO PALETTE */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = i | (i << 8) | (i << 16); + WRITE_VID32(RCDF_PALETTE_DATA, entry); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, index); + WRITE_VID32(RCDF_PALETTE_DATA, palette); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_request() + * + * This routine sets the horizontal (pixel) and vertical (line) video request + * values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_request(short x, short y) +#else +int +gfx_set_video_request(short x, short y) +#endif +{ + /* SET DISPLAY FILTER VIDEO REQUEST */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if ((x < 0) || (x > RCDF_VIDEO_REQUEST_MASK) || + (y < 0) || (y > RCDF_VIDEO_REQUEST_MASK)) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(RCDF_VIDEO_REQUEST, + ((unsigned long)x << RCDF_VIDEO_X_REQUEST_POS) | + ((unsigned long)y << RCDF_VIDEO_Y_REQUEST_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either "color1" + * or "color2" will be used for this pixel, according to the value of bit + * number "select_color2" of the graphics pixel. + * + * key - 24 bit RGB value + * mask - 24 bit mask + * color1, color2 - RGB or YUV, depending on the current color space conversion + * select_color2 - value between 0 to 23 + * + * To disable match, a "mask" and "key" value of 0xffffff should be set, + * because the graphics pixels incoming to the video processor have maximum 16 + * bits set (0xF8FCF8). + * + * This feature is useful for disabling alpha blending of the cursor. + * Otherwise cursor image would be blurred (or completely invisible if video + * alpha is maximum value). + * Note: the cursor pixel replacements take place both inside and outside the + * video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, + unsigned long color2) +#else +int +gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, + unsigned long color2) +#endif +{ + if (select_color2 > RCDF_CURSOR_COLOR_BITS) + return GFX_STATUS_BAD_PARAMETER; + key = (key & RCDF_COLOR_MASK) | ((unsigned long)select_color2 << + RCDF_CURSOR_COLOR_KEY_OFFSET_POS); + WRITE_VID32(RCDF_CURSOR_COLOR_KEY, key); + WRITE_VID32(RCDF_CURSOR_COLOR_MASK, mask); + WRITE_VID32(RCDF_CURSOR_COLOR_1, color1); + WRITE_VID32(RCDF_CURSOR_COLOR_2, color2); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either "color1" + * or "color2" will be used for this pixel, according to the value of bit + * number "select_color2" of the graphics pixel. + * + * key - 24 bit RGB value + * mask - 24 bit mask + * color1, color2 - RGB or YUV, depending on the current color space conversion + * select_color2 - value between 0 to 23 + * + * To disable match, a "mask" and "key" value of 0xffffff should be set, + * because the graphics pixels incoming to the video processor have maximum 16 + * bits set (0xF8FCF8). + * + * This feature is useful for disabling alpha blending of the cursor. + * Otherwise cursor image would be blurred (or completely invisible if video + * alpha is maximum value). + * Note: the cursor pixel replacements take place both inside and outside the + * video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_cursor_enable(int enable) +#else +int +gfx_set_video_cursor_enable(int enable) +#endif +{ + unsigned long temp = READ_VID32(RCDF_CURSOR_COLOR_KEY); + + if (enable) + temp |= RCDF_CURSOR_COLOR_KEY_ENABLE; + else + temp &= ~RCDF_CURSOR_COLOR_KEY_ENABLE; + + WRITE_VID32(RCDF_CURSOR_COLOR_KEY, temp); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_enable + * + * This routine enables or disables the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_enable(int enable) +#else +int +gfx_set_alpha_enable(int enable) +#endif +{ + unsigned long address = 0, value = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 5); + value = READ_VID32(address); + if (enable) + value |= RCDF_ACTRL_WIN_ENABLE; + else + value &= ~(RCDF_ACTRL_WIN_ENABLE); + WRITE_VID32(address, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_window + * + * This routine sets the size of the currently selected alpha region. + * Note: "x" and "y" are signed to enable using negative values needed for + * implementing workarounds of hardware issues. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#else +int +gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned long address = 0; + + /* CHECK FOR CLIPPING */ + + if ((x + width) > gfx_get_hactive()) + width = gfx_get_hactive() - x; + if ((y + height) > gfx_get_vactive()) + height = gfx_get_vactive() - y; + + /* ADJUST POSITIONS */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_XPOS_1 + ((unsigned long)gfx_alpha_select << 5); + + /* END POSITIONS IN REGISTERS ARE NON-INCLUSIVE (ONE MORE THAN ACTUAL END) */ + + WRITE_VID32(address, (unsigned long)x | + ((unsigned long)(x + width) << 16)); + WRITE_VID32(address + 8, (unsigned long)y | + ((unsigned long)(y + height) << 16)); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_value + * + * This routine sets the alpha value for the currently selected alpha + * region. It also specifies an increment/decrement value for fading. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_value(unsigned char alpha, char delta) +#else +int +gfx_set_alpha_value(unsigned char alpha, char delta) +#endif +{ + unsigned long address = 0, value = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 5); + value = READ_VID32(address); + value &= RCDF_ACTRL_WIN_ENABLE; /* keep only enable bit */ + value |= (unsigned long)alpha; + value |= (((unsigned long)delta) & 0xff) << 8; + value |= RCDF_ACTRL_LOAD_ALPHA; + WRITE_VID32(address, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_priority + * + * This routine sets the priority of the currently selected alpha region. + * A higher value indicates a higher priority. + * Note: Priority of enabled alpha windows must be different. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_priority(int priority) +#else +int +gfx_set_alpha_priority(int priority) +#endif +{ + unsigned long pos = 0, value = 0; + + if (priority > 3) + return (GFX_STATUS_BAD_PARAMETER); + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + value = READ_VID32(RCDF_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + value &= ~(0x03l << pos); + value |= (unsigned long)priority << pos; + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color + * + * This routine sets the color to be displayed inside the currently selected + * alpha window when there is a color key match (when the alpha color + * mechanism is enabled). + * "color" is an RGB value (for RGB blending) or a YUV value (for YUV blending). + * In Interlaced YUV blending mode, Y/2 value should be used. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_color(unsigned long color) +#else +int +gfx_set_alpha_color(unsigned long color) +#endif +{ + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 5); + WRITE_VID32(address, color); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color_enable + * + * Enable or disable the color mechanism in the alpha window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_color_enable(int enable) +#else +int +gfx_set_alpha_color_enable(int enable) +#endif +{ + unsigned long color; + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 5); + color = READ_VID32(address); + if (enable) + color |= RCDF_ALPHA_COLOR_ENABLE; + else + color &= ~RCDF_ALPHA_COLOR_ENABLE; + WRITE_VID32(address, color); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_no_ck_outside_alpha + * + * This function affects where inside the video window color key or chroma + * key comparison is done: + * If enable is TRUE, color/chroma key comparison is performed only inside + * the enabled alpha windows. Outside the (enabled) alpha windows, only video + * is displayed if color key is used, and only graphics is displayed if chroma + * key is used. + * If enable is FALSE, color/chroma key comparison is performed in all the + * video window area. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_no_ck_outside_alpha(int enable) +#else +int +gfx_set_no_ck_outside_alpha(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(RCDF_VID_ALPHA_CONTROL); + if (enable) + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value | RCDF_NO_CK_OUTSIDE_ALPHA); + else + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value & ~RCDF_NO_CK_OUTSIDE_ALPHA); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + Q_WORD msr_value; + RCDFPLLENTRY *PLLTable; + unsigned int index; + unsigned long value, mask = 0x00001FFF; + unsigned long post_div3 = 0, pre_mult2 = 0; + + /* READ PLL SETTING */ + + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + value = msr_value.high & mask; + + /* READ DIVISOR SETTINGS */ + + if ((gfx_cpu_version & 0xFF00) == 0x200) { + PLLTable = RCDF_PLLtable48MHz; + + gfx_msr_read(RC_ID_MCP, MCP_SYS_RSTPLL, &msr_value); + post_div3 = (msr_value.low & MCP_DOTPOSTDIV3) ? 1 : 0; + pre_mult2 = (msr_value.low & MCP_DOTPREMULT2) ? 1 : 0; + } else + PLLTable = RCDF_PLLtable14MHz; + + /* SEARCH FOR A MATCH */ + + for (index = 0; index < NUM_RCDF_FREQUENCIES; index++) { + if ((PLLTable[index].pll_value & mask) == value && + post_div3 == PLLTable[index].post_div3 && + pre_mult2 == PLLTable[index].pre_mul2) + return (PLLTable[index].frequency); + } + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(RCDF_DISPLAY_CONFIG) & RCDF_DCFG_CRT_HSYNC_POL) + polarities |= 1; + if (READ_VID32(RCDF_DISPLAY_CONFIG) & RCDF_DCFG_CRT_VSYNC_POL) + polarities |= 2; + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, index); + *palette = READ_VID32(RCDF_PALETTE_DATA); + + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_VID_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long ctrl, vcfg; + + ctrl = READ_VID32(RCDF_VID_ALPHA_CONTROL); + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + + if (ctrl & RCDF_VIDEO_INPUT_IS_RGB) { + switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { + case RCDF_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_RGB; + case RCDF_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_P2M_P2L_P1M_P1L; + case RCDF_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_P1M_P1L_P2M_P2L; + case RCDF_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_P1M_P2L_P2M_P1L; + } + } + + if (vcfg & RCDF_VCFG_4_2_0_MODE) { + switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { + case RCDF_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_Y0Y1Y2Y3; + case RCDF_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y3Y2Y1Y0; + case RCDF_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_Y1Y0Y3Y2; + case RCDF_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_Y1Y2Y3Y0; + } + } else { + switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { + case RCDF_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_UYVY; + case RCDF_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y2YU; + case RCDF_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_YUYV; + case RCDF_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_YVYU; + } + } + return (GFX_STATUS_ERROR); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width, height, scale, delta; + int down_enable; + + /* DETERMINE SOURCE WIDTH FROM THE DISPLAY FILTER VIDEO LINE SIZE */ + + width = (READ_VID32(RCDF_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_LINE_SIZE_UPPER) + width += 512l; + + /* DETERMINE SOURCE HEIGHT FROM THE DISPLAY FILTER HEIGHT AND SCALE VALUES */ + /* There is no true "source buffer size" in Redcloud. Instead, the VG module */ + /* provides video data as needed on a per-line basis. The source buffer size */ + /* is always assumed to equal the amount of required video data. The returned */ + /* height is equal to the height of the required video buffer data (before all */ + /* scaling.) */ + + scale = (READ_VID32(RCDF_VIDEO_SCALE) >> 16) & 0x3FFF; + height = ((READ_VID32(RCDF_VIDEO_Y_POS) >> 16) & 0x7FF) - + (READ_VID32(RCDF_VIDEO_Y_POS) & 0x7FF); + delta = gfx_get_video_downscale_delta(); + down_enable = gfx_get_video_vertical_downscale_enable(); + + /* REVERSE UPSCALING */ + + if (height) + height = ((scale * (height - 1l)) / 0x2000l) + 2l; + + /* REVERSE DOWNSCALING */ + /* Original lines = height * (0x3FFF + delta) / 0x3FFF */ + /* As this may cause rounding errors, we add 1 to the */ + /* returned source size. The return value of this */ + /* function could thus be off by 1. */ + + if (down_enable && height) + height = ((height * (0x3FFFl + delta)) / 0x3FFFl) + 1; + + return ((height << 16) | width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE RCDF VIDEO LINE SIZE */ + + width = (READ_VID32(RCDF_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_LINE_SIZE_UPPER) + width += 512l; + return (width); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE RCDF VIDEO LINE SIZE */ + + clip = (READ_VID32(RCDF_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_yuv_offsets + * + * This routine returns the current offsets for the video overlay buffer when in 4:2:0. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, + unsigned long *voffset) +#else +void +gfx_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, + unsigned long *voffset) +#endif +{ + gfx_get_display_video_yuv_offsets(yoffset, uoffset, voffset); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_yuv_pitch + * + * This routine returns the current pitch values for the video overlay buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#else +void +gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#endif +{ + gfx_get_display_video_yuv_pitch(ypitch, uvpitch); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return (READ_VID32(RCDF_VIDEO_SCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_delta + * + * This routine returns the vertical downscale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_downscale_delta(void) +#else +unsigned long +gfx_get_video_downscale_delta(void) +#endif +{ + /* USE PRIVATE ROUTINE TO ABSTRACT THE DIPSLAY CONTROLLER */ + + return (gfx_get_display_video_downscale_delta()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_vertical_downscale_enable + * + * This routine returns the vertical downscale enable for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_vertical_downscale_enable(void) +#else +int +gfx_get_video_vertical_downscale_enable(void) +#endif +{ + /* USE PRIVATE ROUTINE TO ABSTRACT THE DIPSLAY CONTROLLER */ + + return (gfx_get_display_video_downscale_enable()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_config + * + * This routine returns the current type and value of video downscaling. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_downscale_config(unsigned short *type, unsigned short *m) +#else +int +gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); + *m = (unsigned short)((downscale & RCDF_VIDEO_DOWNSCALE_FACTOR_MASK) >> + RCDF_VIDEO_DOWNSCALE_FACTOR_POS) + 1; + + switch (downscale & RCDF_VIDEO_DOWNSCALE_TYPE_MASK) { + case RCDF_VIDEO_DOWNSCALE_TYPE_A: + *type = VIDEO_DOWNSCALE_KEEP_1_OF; + break; + case RCDF_VIDEO_DOWNSCALE_TYPE_B: + *type = VIDEO_DOWNSCALE_DROP_1_OF; + break; + default: + return GFX_STATUS_ERROR; + break; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_coefficients + * + * This routine returns the current video downscaling coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) +#else +void +gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) +#endif +{ + unsigned long coef; + + coef = READ_VID32(RCDF_VIDEO_DOWNSCALER_COEFFICIENTS); + *coef1 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF1_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + *coef2 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF2_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + *coef3 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF3_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + *coef4 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF4_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_enable + * + * This routine returns 1 if video downscaling is currently enabled, + * or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_downscale_enable(int *enable) +#else +void +gfx_get_video_downscale_enable(int *enable) +#endif +{ + if (READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL) & + RCDF_VIDEO_DOWNSCALE_ENABLE) + *enable = 1; + else + *enable = 0; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(RCDF_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x7FF) - (xsize & 0x7FF); + ysize = READ_VID32(RCDF_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x7FF) - (ysize & 0x7FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(RCDF_VIDEO_X_POS) & 0x000007FF; + ypos = READ_VID32(RCDF_VIDEO_Y_POS) & 0x000007FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = + (unsigned long)gfx_get_htotal() - + (unsigned long)gfx_get_hsync_end() - 14l; + vadjust = + (unsigned long)gfx_get_vtotal() - + (unsigned long)gfx_get_vsync_end() + 1l; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(RCDF_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(RCDF_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(RCDF_DISPLAY_CONFIG) & RCDF_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_request + * + * This routine returns the horizontal (pixel) and vertical (lines) video + * request values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_request(short *x, short *y) +#else +int +gfx_get_video_request(short *x, short *y) +#endif +{ + unsigned long request = 0; + + request = (READ_VID32(RCDF_VIDEO_REQUEST)); + *x = (short)((request >> RCDF_VIDEO_X_REQUEST_POS) & + RCDF_VIDEO_REQUEST_MASK); + *y = (short)((request >> RCDF_VIDEO_Y_REQUEST_POS) & + RCDF_VIDEO_REQUEST_MASK); + + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either "color1" + * or "color2" will be used for this pixel, according to the value of the bit + * in offset "select_color2". + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2) +#else +int +gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#endif +{ + *select_color2 = + (unsigned short)(READ_VID32(RCDF_CURSOR_COLOR_KEY) >> + RCDF_CURSOR_COLOR_KEY_OFFSET_POS); + *key = READ_VID32(RCDF_CURSOR_COLOR_KEY) & RCDF_COLOR_MASK; + *mask = READ_VID32(RCDF_CURSOR_COLOR_MASK) & RCDF_COLOR_MASK; + *color1 = READ_VID32(RCDF_CURSOR_COLOR_1) & RCDF_COLOR_MASK; + *color2 = + (unsigned short)(READ_VID32(RCDF_CURSOR_COLOR_2) & RCDF_COLOR_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + Q_WORD msr_value; + unsigned long crc = 0xFFFFFFFF; + + /* DISABLE 32-BIT CRCS */ + /* For GX1.x, this is a reserved bit, and is assumed to be a benign access */ + + gfx_msr_read(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + msr_value.low &= ~RCDF_DIAG_32BIT_CRC; + gfx_msr_write(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(RCDF_VID_CRC, 0); + WRITE_VID32(RCDF_VID_CRC, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(RCDF_VID_CRC) >> 8; + } + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc32 + * + * This routine returns the 32-bit hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_read_crc32(void) +#else +unsigned long +gfx_read_crc32(void) +#endif +{ + Q_WORD msr_value; + unsigned long crc = 0xFFFFFFFF; + + /* ENABLE 32-BIT CRCS */ + /* For GX1.x, this is a reserved bit, and is assumed to be a benign access */ + + gfx_msr_read(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + msr_value.low |= RCDF_DIAG_32BIT_CRC; + gfx_msr_write(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(RCDF_VID_CRC, 0); + WRITE_VID32(RCDF_VID_CRC, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(RCDF_VID_CRC32); + } + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_window_crc + * + * This routine returns the hardware CRC value for a subsection of the display. + * This value is used to debug whole-screen CRC failures. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, + int crc32) +#else +unsigned long +gfx_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, int crc32) +#endif +{ + Q_WORD msr_value; + unsigned long xpos, ypos, crc = 0; + unsigned long old_fmt = 0; + unsigned int vsync_active_base, vsync_inactive_base, hsync_active_base; + unsigned int vsync_active_shift, vsync_inactive_shift, hsync_active_shift; + unsigned int vsync_bit, hsync_bit, sync_polarities = 0; + + /* CONFIGURE DISPLAY FILTER TO LOAD DATA ONTO LOWER 32-BITS */ + + msr_value.high = 0; + msr_value.low = + (source == CRC_SOURCE_GFX_DATA) ? (RCDF_MBD_DIAG_EN0 | 0x0000000F) + : (RCDF_MBD_DIAG_EN0 | 0x0000000B); + gfx_msr_write(RC_ID_DF, MBD_MSR_DIAG, &msr_value); + + /* CONFIGURE DISPLAY FILTER FOR APPROPRIATE OUTPUT */ + + if (source != CRC_SOURCE_GFX_DATA) { + gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + old_fmt = msr_value.low; + msr_value.low &= ~(RCDF_CONFIG_FMT_MASK); + msr_value.low |= ((source == CRC_SOURCE_FP_DATA) ? RCDF_CONFIG_FMT_FP : + RCDF_CONFIG_FMT_CRT); + gfx_msr_write(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + } + + /* CONFIGURE MCP TO LOAD REGB DATA ONTO UPPER 32-BITS */ + + msr_value.low = MCP_MBD_DIAG_EN1 | 0x00050000; + gfx_msr_write(RC_ID_MCP, MBD_MSR_DIAG, &msr_value); + + /* ENABLE HW CLOCK GATING AND SET MCP CLOCK TO DOT CLOCK */ + + msr_value.low = 1l; + gfx_msr_write(RC_ID_MCP, MBD_MSR_PM, &msr_value); + msr_value.low = 0; + gfx_msr_write(RC_ID_MCP, MCP_DBGCLKCTL, &msr_value); + msr_value.low = 3; + gfx_msr_write(RC_ID_MCP, MCP_DBGCLKCTL, &msr_value); + + /* DISABLE MCP ACTIONS */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_DIAGCTL, &msr_value); + + /* SET APPROPRIATE BASE ADDRESS */ + /* M-Sets use normal diag bits, while N-Sets use inverted diag bits */ + /* We thus use the M-sets when polling for a high signal and the N */ + /* sets when polling for a low signal. */ + + if (source != CRC_SOURCE_GFX_DATA) { + sync_polarities = gfx_get_sync_polarities(); + vsync_bit = 29; + hsync_bit = 30; + } else { + vsync_bit = 25; + hsync_bit = 26; + } + + if (sync_polarities & 1) { + hsync_active_base = MCP_SETM0CTL; + hsync_active_shift = 2; + } else { + hsync_active_base = MCP_SETN0CTL; + hsync_active_shift = 1; + } + if (sync_polarities & 2) { + vsync_active_base = MCP_SETM0CTL; + vsync_inactive_base = MCP_SETN0CTL; + vsync_active_shift = 2; + vsync_inactive_shift = 1; + } else { + vsync_active_base = MCP_SETN0CTL; + vsync_inactive_base = MCP_SETM0CTL; + vsync_active_shift = 1; + vsync_inactive_shift = 2; + } + + /* SET STATE TRANSITIONS */ + + /* STATE 0-1 TRANSITION (SET 0) */ + /* XState = 00 and VSync Inactive */ + /* Note: DF VSync = Diag Bus Bit 29 */ + /* VG VSync = Diag Bus Bit 25 */ + + msr_value.low = 0x000000A0; + msr_value.high = 0x00008000 | ((unsigned long)vsync_bit << 16) | + ((unsigned long)vsync_bit << 21) | ((unsigned long)vsync_bit << 26); + gfx_msr_write(RC_ID_MCP, vsync_inactive_base, &msr_value); + + /* STATE 1-2 TRANSITION (SET 4) */ + /* XState = 01 and VSync Active */ + + msr_value.low = 0x000000C0; + gfx_msr_write(RC_ID_MCP, vsync_active_base + 4, &msr_value); + + /* STATE 2-3 TRANSITION (SET 1) */ + /* XState = 10 and VSync Inactive */ + + msr_value.low = 0x00000120; + gfx_msr_write(RC_ID_MCP, vsync_inactive_base + 1, &msr_value); + + /* HORIZONTAL COUNTER (SET 5) */ + /* XState = 10 and HSync Active */ + /* Notes: DF HSync = Diag Bus Bit 30 */ + /* VG HSync = Diag Bus Bit 26 */ + + msr_value.high = 0x00008000 | ((unsigned long)hsync_bit << 16) | + ((unsigned long)hsync_bit << 21) | ((unsigned long)hsync_bit << 26); + msr_value.low = 0x00000120; + gfx_msr_write(RC_ID_MCP, hsync_active_base + 5, &msr_value); + + /* HORIZONTAL COUNTER RESET (SET 4) */ + /* XState = 10 and H. Counter = limit */ + /* Note: H. Counter is lower 16-bits of */ + /* RegB. */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000128; + gfx_msr_write(RC_ID_MCP, vsync_inactive_base + 4, &msr_value); + + /* CRC TRIGGER (SET 0) */ + /* Cmp0 <= xpos < Cmp1 */ + /* Cmp2 <= ypos < Cmp2 */ + + msr_value.high = 0x00000000; + msr_value.low = 0x10C20120; + gfx_msr_write(RC_ID_MCP, vsync_active_base, &msr_value); + + /* SET COMPARATOR VALUES */ + /* Note: The VG data outputs from the DF are delayed by one pixel clock. */ + /* In this mode, we thus add one to horizontal comparator limits. */ + + /* COMPARATOR 0 */ + /* Lower limit = xpos + (h_blank_pixels - 1) - 3 */ + /* Notes: */ + /* 1. 3 is the pipeline delay for MCP register */ + /* data to access the diag bus */ + /* 2. h_blank_pixels = HTOTAL - HSYNC_END */ + + xpos = (unsigned long)x + ((unsigned long)gfx_get_htotal() - + (unsigned long)gfx_get_hsync_end() - 1l) - 3l; + if (source == CRC_SOURCE_GFX_DATA) + xpos++; + msr_value.high = 0x00000000; + msr_value.low = xpos; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0, &msr_value); + + /* COMPARATOR 1 */ + /* Upper limit = xpos + width + (h_blank_pixels - 1) - 3 */ + + msr_value.low = xpos + (unsigned long)width; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 2, &msr_value); + + /* COMPARATOR 2 */ + /* Lower limit = ypos + v_blank_pixels */ + /* Notes: */ + /* 1. v_blank_pixels = VTOTAL - VSYNC_END */ + + ypos = (unsigned long)y + (unsigned long)gfx_get_vtotal() - + (unsigned long)gfx_get_vsync_end(); + msr_value.low = ypos << 16; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 4, &msr_value); + + /* COMPARATOR 3 */ + /* Upper limit = ypos + height + v_blank_pixels */ + + msr_value.low = (ypos + (unsigned long)height) << 16; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 6, &msr_value); + + /* SET COMPARATOR MASKS */ + + /* COMPARATORS 0 AND 1 REFER TO LOWER 16 BITS OF REGB */ + + msr_value.high = 0x00000000; + msr_value.low = 0x0000FFFF; + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0 + 2, &msr_value); + + /* COMPARATORS 2 AND 3 REFER TO UPPER 16 BITS OF REGB */ + + msr_value.low = 0xFFFF0000; + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0 + 4, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0 + 6, &msr_value); + + /* SET REGA MASK TO CRC ONLY 24 BITS OF DATA */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00FFFFFF; + gfx_msr_write(RC_ID_MCP, MCP_REGAMASK, &msr_value); + + /* SET REGB VALUE */ + /* Lower 16 bits use HTOTAL - SYNC TIME - 1 to set the counter rollover limit. */ + /* Upper 16 bits use 0xFFFF to remove auto-clear behavior. */ + + msr_value.high = 0x00000000; + msr_value.low = 0xFFFF0000 | + ((gfx_get_htotal() - (gfx_get_hsync_end() - gfx_get_hsync_start()) - + 1) & 0xFFFF); + gfx_msr_write(RC_ID_MCP, MCP_REGBVAL, &msr_value); + + /* PROGRAM ACTIONS */ + + /* GOTO STATE 01 */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000008 | (1l << vsync_inactive_shift); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 14, &msr_value); + + /* GOTO STATE 10 */ + + msr_value.low = 0x00080000 | (1l << (vsync_active_shift + 16)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 15, &msr_value); + + /* GOTO STATE 11 */ + + msr_value.low = 0x00000080 | (1l << (vsync_inactive_shift + 4)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 16, &msr_value); + + /* CLEAR REGB (COUNTERS) */ + /* RegB is cleared upon transitioning to state 10 */ + /* RegA is not cleared as the initial value must be 0x00000001 */ + + msr_value.low = 0x00080000 | (1l << (vsync_active_shift + 16)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0, &msr_value); + + /* CRC INTO REGA */ + /* INCREMENT H. COUNTER */ + /* cmp0 <= xpos < cmp1 */ + /* cmp2 <= ypos < cmp3 */ + /* XState = 10 */ + + msr_value.low = 0x00000008 | (1l << vsync_active_shift) | + 0x00800000 | (1l << (hsync_active_shift + 20)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 1, &msr_value); + + /* INCREMENT V. COUNTER */ + /* V. Counter is incremented when the H. Counter */ + /* rolls over. */ + + msr_value.low = 0x00080000 | (1l << (vsync_inactive_shift + 16)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 2, &msr_value); + + /* CLEAR ALL OTHER ACTIONS */ + /* This prevents side-effects from previous accesses to the MCP */ + /* debug logic. */ + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 3, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 4, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 5, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 6, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 7, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 8, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 9, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 10, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 11, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 12, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 13, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 17, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 18, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 19, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 20, &msr_value); + + /* SET REGA CRC VALUE TO 1 OR 0 */ + + if (!crc32) + msr_value.low = 0x00000001; + gfx_msr_write(RC_ID_MCP, MCP_REGA, &msr_value); + + /* SET XSTATE TO 0 */ + + msr_value.low = 0; + msr_value.high = 0; + gfx_msr_write(RC_ID_MCP, MCP_XSTATE, &msr_value); + + /* CONFIGURE DIAG CONTROL */ + /* Set all four comparators to watch the upper diag bus. */ + /* Set REGA action1 to legacy CRC or 32-bit CRC. */ + /* Set REGB action1 to increment lower 16 bits and clear at limit. */ + /* Set REGB action2 to increment upper 16 bits. */ + /* Enable all actions. */ + + if (crc32) + msr_value.low = 0x9A820055; + else + msr_value.low = 0x9A840055; + msr_value.high = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_DIAGCTL, &msr_value); + + /* DELAY TWO FRAMES */ + + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + + /* VERIFY THAT XSTATE = 11 */ + + gfx_msr_read(RC_ID_MCP, MCP_XSTATE, &msr_value); + if ((msr_value.low & 3) == 3) { + gfx_msr_read(RC_ID_MCP, MCP_REGA, &msr_value); + + crc = msr_value.low; + if (!crc32) + crc &= 0xFFFFFF; + } + + /* DISABLE MCP AND DF DIAG BUS OUTPUTS */ + + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + gfx_msr_write(RC_ID_DF, MBD_MSR_DIAG, &msr_value); + gfx_msr_write(RC_ID_MCP, MBD_MSR_DIAG, &msr_value); + + /* DISABLE MCP ACTIONS */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_DIAGCTL, &msr_value); + + /* RESTORE PREVIOUS OUTPUT FORMAT */ + + if (source != CRC_SOURCE_GFX_DATA) { + gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + msr_value.low = old_fmt; + gfx_msr_write(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + } + return crc; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_enable + * + * This routine returns 1 if the selected alpha window is currently + * enabled, or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_enable(int *enable) +#else +void +gfx_get_alpha_enable(int *enable) +#endif +{ + unsigned long value = 0; + + *enable = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(RCDF_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 5)); + if (value & RCDF_ACTRL_WIN_ENABLE) + *enable = 1; + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_size + * + * This routine returns the size of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#else +void +gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#endif +{ + unsigned long value = 0; + + *x = 0; + *y = 0; + *width = 0; + *height = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(RCDF_ALPHA_XPOS_1 + + ((unsigned long)gfx_alpha_select << 5)); + *x = (unsigned short)(value & 0x000007FF); + *width = (unsigned short)((value >> 16) & 0x000007FF) - *x; + value = + READ_VID32(RCDF_ALPHA_YPOS_1 + + ((unsigned long)gfx_alpha_select << 5)); + *y = (unsigned short)(value & 0x000007FF); + *height = (unsigned short)((value >> 16) & 0x000007FF) - *y; + } + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_value + * + * This routine returns the alpha value and increment/decrement value of + * the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_value(unsigned char *alpha, char *delta) +#else +void +gfx_get_alpha_value(unsigned char *alpha, char *delta) +#endif +{ + unsigned long value = 0; + + *alpha = 0; + *delta = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(RCDF_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 5)); + *alpha = (unsigned char)(value & 0x00FF); + *delta = (char)((value >> 8) & 0x00FF); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_priority + * + * This routine returns the priority of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_priority(int *priority) +#else +void +gfx_get_alpha_priority(int *priority) +#endif +{ + unsigned long pos = 0, value = 0; + + *priority = 0; + if (gfx_alpha_select <= 2) { + value = READ_VID32(RCDF_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + *priority = (int)((value >> pos) & 3); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_color + * + * This routine returns the color register value for the currently selected + * alpha region. Bit 24 is set if the color register is enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_color(unsigned long *color) +#else +void +gfx_get_alpha_color(unsigned long *color) +#endif +{ + *color = 0; + if (gfx_alpha_select <= 2) { + *color = + READ_VID32(RCDF_ALPHA_COLOR_1 + + ((unsigned long)gfx_alpha_select << 5)); + } + return; +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1200.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1200.c:1.1 --- /dev/null Thu Feb 27 12:31:17 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1200.c Tue Dec 10 10:12:27 2002 @@ -0,0 +1,793 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1200.c,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ +/* + * $Workfile: vip_1200.c $ + * + * This file contains routines to control the SC1200 video input port (VIP) hardware. + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Durango + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +int sc1200_set_vip_enable(int enable); +int sc1200_set_vip_capture_run_mode(int mode); +int sc1200_set_vip_base(unsigned long even, unsigned long odd); +int sc1200_set_vip_pitch(unsigned long pitch); +int sc1200_set_vip_mode(int mode); +int sc1200_set_vbi_enable(int enable); +int sc1200_set_vbi_mode(int mode); +int sc1200_set_vbi_base(unsigned long even, unsigned long odd); +int sc1200_set_vbi_pitch(unsigned long pitch); +int sc1200_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines); +int sc1200_set_vbi_interrupt(int enable); +int sc1200_set_vip_bus_request_threshold_high(int enable); +int sc1200_set_vip_last_line(int last_line); +int sc1200_test_vip_odd_field(void); +int sc1200_test_vip_bases_updated(void); +int sc1200_test_vip_fifo_overflow(void); +int sc1200_get_vip_line(void); + +/* READ ROUTINES IN GFX_VIP.C */ + +int sc1200_get_vip_enable(void); +unsigned long sc1200_get_vip_base(int odd); +unsigned long sc1200_get_vip_pitch(void); +int sc1200_get_vip_mode(void); +int sc1200_get_vbi_enable(void); +int sc1200_get_vbi_mode(void); +unsigned long sc1200_get_vbi_base(int odd); +unsigned long sc1200_get_vbi_pitch(void); +unsigned long sc1200_get_vbi_direct(int odd); +int sc1200_get_vbi_interrupt(void); +int sc1200_get_vip_bus_request_threshold_high(void); + +/*----------------------------------------------------------------------------- + * gfx_set_vip_enable + * + * This routine enables or disables the writes to memory from the video port. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_enable(int enable) +#else +int +gfx_set_vip_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + if (enable) + value |= SC1200_VIP_DATA_CAPTURE_EN; + else + value &= ~SC1200_VIP_DATA_CAPTURE_EN; + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_capture_run_mode + * + * This routine selects VIP capture run mode. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_capture_run_mode(int mode) +#else +int +gfx_set_vip_capture_run_mode(int mode) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + value &= ~SC1200_CAPTURE_RUN_MODE_MASK; + switch (mode) { + case VIP_CAPTURE_STOP_LINE: + value |= SC1200_CAPTURE_RUN_MODE_STOP_LINE; + break; + case VIP_CAPTURE_STOP_FIELD: + value |= SC1200_CAPTURE_RUN_MODE_STOP_FIELD; + break; + case VIP_CAPTURE_START_FIELD: + value |= SC1200_CAPTURE_RUN_MODE_START; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_base + * + * This routine sets the odd and even base address values for the VIP memory + * buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_base(unsigned long even, unsigned long odd) +#else +int +gfx_set_vip_base(unsigned long even, unsigned long odd) +#endif +{ + /* TRUE OFFSET IS SPECIFIED, NEED TO SET BIT 23 FOR HARDWARE */ + + if (even) + WRITE_VIP32(SC1200_VIP_EVEN_BASE, even + (unsigned long)gfx_phys_fbptr); + if (odd) + WRITE_VIP32(SC1200_VIP_ODD_BASE, odd + (unsigned long)gfx_phys_fbptr); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_pitch + * + * This routine sets the number of bytes between scanlines for the VIP data. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_pitch(unsigned long pitch) +#else +int +gfx_set_vip_pitch(unsigned long pitch) +#endif +{ + WRITE_VIP32(SC1200_VIP_PITCH, pitch & SC1200_VIP_PITCH_MASK); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_mode + * + * This routine sets the VIP operating mode. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_mode(int mode) +#else +int +gfx_set_vip_mode(int mode) +#endif +{ + unsigned long config; + + config = READ_VIP32(SC1200_VIP_CONFIG); + config &= ~SC1200_VIP_MODE_MASK; + switch (mode) { + case VIP_MODE_C: + WRITE_VIP32(SC1200_VIP_CONFIG, config | SC1200_VIP_MODE_C); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_enable + * + * This routine enables or disables the VBI data capture. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_enable(int enable) +#else +int +gfx_set_vbi_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + if (enable) + value |= SC1200_VIP_VBI_CAPTURE_EN; + else + value &= ~SC1200_VIP_VBI_CAPTURE_EN; + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_mode + * + * This routine sets the VBI data types captured to memory. + * It receives a mask of all enabled types. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_mode(int mode) +#else +int +gfx_set_vbi_mode(int mode) +#endif +{ + unsigned long config; + + config = READ_VIP32(SC1200_VIP_CONFIG); + config &= + ~(SC1200_VBI_ANCILLARY_TO_MEMORY | SC1200_VBI_TASK_A_TO_MEMORY | + SC1200_VBI_TASK_B_TO_MEMORY); + + if (mode & VBI_ANCILLARY) + config |= SC1200_VBI_ANCILLARY_TO_MEMORY; + if (mode & VBI_TASK_A) + config |= SC1200_VBI_TASK_A_TO_MEMORY; + if (mode & VBI_TASK_B) + config |= SC1200_VBI_TASK_B_TO_MEMORY; + WRITE_VIP32(SC1200_VIP_CONFIG, config); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_base + * + * This routine sets the odd and even base address values for VBI capture. + * + * "even" and "odd" should contain 16-byte aligned physical addresses. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_base(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_base(unsigned long even, unsigned long odd) +#endif +{ + /* VIP HW REQUIRES THAT BASE ADDRESSES BE 16-BYTE ALIGNED */ + + if (even) + WRITE_VIP32(SC1200_VBI_EVEN_BASE, even & ~0xf); + if (odd) + WRITE_VIP32(SC1200_VBI_ODD_BASE, odd & ~0xf); + + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_pitch + * + * This routine sets the number of bytes between scanlines for VBI capture. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_pitch(unsigned long pitch) +#else +int +gfx_set_vbi_pitch(unsigned long pitch) +#endif +{ + WRITE_VIP32(SC1200_VBI_PITCH, pitch & SC1200_VBI_PITCH_MASK); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_direct + * + * This routine sets the VBI lines to be passed to the Direct VIP. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +#else +int +gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +#endif +{ + WRITE_VIP32(SC1200_EVEN_DIRECT_VBI_LINE_ENABLE, + even_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + WRITE_VIP32(SC1200_ODD_DIRECT_VBI_LINE_ENABLE, + odd_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_interrupt + * + * This routine enables or disables the VBI field interrupt. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_interrupt(int enable) +#else +int +gfx_set_vbi_interrupt(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + if (enable) + value |= SC1200_VIP_VBI_FIELD_INTERRUPT_EN; + else + value &= ~SC1200_VIP_VBI_FIELD_INTERRUPT_EN; + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_bus_request_threshold_high + * + * This routine sets the VIP FIFO bus request threshold. + * If enable is TRUE, VIP FIFO will be set to issue a bus request when it filled with 64 bytes. + * If enable is FALSE, VIP FIFO will be set to issue a bus request when it filled with 32 bytes. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_bus_request_threshold_high(int enable) +#else +int +gfx_set_vip_bus_request_threshold_high(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONFIG); + if (enable) + value &= ~SC1200_VIP_BUS_REQUEST_THRESHOLD; + else + value |= SC1200_VIP_BUS_REQUEST_THRESHOLD; + WRITE_VIP32(SC1200_VIP_CONFIG, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_last_line + * + * This routine sets the maximum number of lines captured in each field. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_last_line(int last_line) +#else +int +gfx_set_vip_last_line(int last_line) +#endif +{ + unsigned long value; + + /* This feature is implemented in Rev C1 */ + if (gfx_chip_revision < SC1200_REV_C1) + return (GFX_STATUS_OK); + + value = READ_VIP32(SC1200_VIP_LINE_TARGET); + value &= ~SC1200_VIP_LAST_LINE_MASK; + value |= ((last_line & 0x3FF) << 16); + WRITE_VIP32(SC1200_VIP_LINE_TARGET, value); + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_test_vip_odd_field + * + * This routine returns 1 if the current VIP field is odd. Otherwise returns 0. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_test_vip_odd_field(void) +#else +int +gfx_test_vip_odd_field(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_STATUS) & SC1200_VIP_CURRENT_FIELD_ODD) + return (1); + else + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_test_vip_bases_updated + * + * This routine returns 1 if all of the VIP base registers have been updated, + * i.e. there is no base register which has been written with a new address, + * that VIP has not already captured or started capturing into the new address. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_test_vip_bases_updated(void) +#else +int +gfx_test_vip_bases_updated(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_STATUS) & SC1200_VIP_BASE_NOT_UPDATED) + return (0); + else + return (1); +} + +/*----------------------------------------------------------------------------- + * gfx_test_vip_fifo_overflow + * + * This routine returns 1 if an overflow occurred on the FIFO between the VIP + * and the fast X-bus, 0 otherwise. + * If an overflow occurred, the overflow status indication is reset. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_test_vip_fifo_overflow(void) +#else +int +gfx_test_vip_fifo_overflow(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_STATUS) & SC1200_VIP_FIFO_OVERFLOW) { + /* Bits in vip status register are either read only or reset by writing 1 */ + WRITE_VIP32(SC1200_VIP_STATUS, SC1200_VIP_FIFO_OVERFLOW); + return (1); + } else { + return (0); + } +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_line + * + * This routine returns the number of the current video line being + * received by the VIP interface. + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_line(void) +#else +int +gfx_get_vip_line(void) +#endif +{ + return (int)(READ_VIP32(SC1200_VIP_CURRENT_LINE) & + SC1200_VIP_CURRENT_LINE_MASK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_base + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vip_base(int odd) +#else +unsigned long +gfx_get_vip_base(int odd) +#endif +{ + /* MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET */ + + if (odd) + return (READ_VIP32(SC1200_VIP_ODD_BASE)); + return (READ_VIP32(SC1200_VIP_EVEN_BASE)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vbi_pitch(void) +#else +unsigned long +gfx_get_vbi_pitch(void) +#endif +{ + return (READ_VIP32(SC1200_VBI_PITCH) & SC1200_VBI_PITCH_MASK); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*----------------------------------------------------------------------------- + * gfx_get_vip_enable + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_enable(void) +#else +int +gfx_get_vip_enable(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONTROL) & SC1200_VIP_DATA_CAPTURE_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vip_pitch(void) +#else +unsigned long +gfx_get_vip_pitch(void) +#endif +{ + return (READ_VIP32(SC1200_VIP_PITCH) & SC1200_VIP_PITCH_MASK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_mode + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_mode(void) +#else +int +gfx_get_vip_mode(void) +#endif +{ + switch (READ_VIP32(SC1200_VIP_CONFIG) & SC1200_VIP_MODE_MASK) { + case SC1200_VIP_MODE_C: + return VIP_MODE_C; + default: + return (0); + } +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_enable + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vbi_enable(void) +#else +int +gfx_get_vbi_enable(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONTROL) & SC1200_VIP_VBI_CAPTURE_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_mode + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vbi_mode(void) +#else +int +gfx_get_vbi_mode(void) +#endif +{ + int config; + int mode = 0; + + config = + (int)(READ_VIP32(SC1200_VIP_CONFIG) & + (SC1200_VBI_ANCILLARY_TO_MEMORY | SC1200_VBI_TASK_A_TO_MEMORY | + SC1200_VBI_TASK_B_TO_MEMORY)); + if (config & SC1200_VBI_ANCILLARY_TO_MEMORY) + mode |= VBI_ANCILLARY; + if (config & SC1200_VBI_TASK_A_TO_MEMORY) + mode |= VBI_TASK_A; + if (config & SC1200_VBI_TASK_B_TO_MEMORY) + mode |= VBI_TASK_B; + return mode; +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_base + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vbi_base(int odd) +#else +unsigned long +gfx_get_vbi_base(int odd) +#endif +{ + /* MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET */ + + if (odd) + return (READ_VIP32(SC1200_VBI_ODD_BASE)); + return (READ_VIP32(SC1200_VBI_EVEN_BASE)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_direct + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vbi_direct(int odd) +#else +unsigned long +gfx_get_vbi_direct(int odd) +#endif +{ + /* MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET */ + + if (odd) + return (READ_VIP32(SC1200_ODD_DIRECT_VBI_LINE_ENABLE) & + SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + return (READ_VIP32(SC1200_EVEN_DIRECT_VBI_LINE_ENABLE) & + SC1200_DIRECT_VBI_LINE_ENABLE_MASK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_interrupt + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vbi_interrupt(void) +#else +int +gfx_get_vbi_interrupt(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONTROL) & SC1200_VIP_VBI_FIELD_INTERRUPT_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_bus_request_threshold_high + *----------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_bus_request_threshold_high(void) +#else +int +gfx_get_vip_bus_request_threshold_high(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONFIG) & SC1200_VIP_BUS_REQUEST_THRESHOLD) + return (1); + return (0); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1400.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1400.c:1.1 --- /dev/null Thu Feb 27 12:31:17 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1400.c Tue Dec 10 10:12:28 2002 @@ -0,0 +1,271 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/vip_1400.c,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/*----------------------------------------------------------------------------- + * VIP_1400.C + * + * Version 2.0 - February 21, 2000. + * + * This file routines to control the SC1400 video input port (VIP) hardware. + * + * History: + * Versions 0.1 through 2.0 by Brian Falardeau. + * + * Copyright (c) 1999-2000 National Semiconductor. + *----------------------------------------------------------------------------- + */ + +/*----------------------------------------------------------------------------- + * gfx_set_vip_enable + * + * This routine enables or disables the writes to memory from the video port. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_vip_enable(int enable) +#else +int +gfx_set_vip_enable(int enable) +#endif +{ + unsigned long mcr, value; + + value = READ_VIP32(SC1400_VIP_CONTROL); + + if (enable) { + /* CONFIGURE MCR FOR VIDEO INPUT MODE */ + + mcr = IND(SC1400_CB_BASE_ADDR + SC1400_CB_MISC_CONFIG); + mcr |= (SC1400_MCR_VPOUT_CK_SELECT | SC1400_MCR_VPOUT_CK_SOURCE); + mcr &= ~SC1400_MCR_VPOUT_MODE; + mcr |= SC1400_MCR_VPIN_CCIR656; + mcr &= ~SC1400_MCR_GENLOCK_CONTINUE; + OUTD(SC1400_CB_BASE_ADDR + SC1400_CB_MISC_CONFIG, mcr); + + /* ENABLE CAPTURE */ + /* Hardcode config values for now. */ + + WRITE_VIP32(SC1400_VIP_CONFIG, 0x30012); + value |= 0x103; + } else { + value &= ~(0x102); + } + + WRITE_VIP32(SC1400_VIP_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_base + * + * This routine sets the odd and even base address values for the VIP memory + * buffer. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_vip_base(unsigned long even, unsigned long odd) +#else +int +gfx_set_vip_base(unsigned long even, unsigned long odd) +#endif +{ + // TRUE OFFSET IS SPECIFIED, NEED TO SET BIT 23 FOR HARDWARE + + WRITE_VIP32(SC1400_VIP_EVEN_BASE, even | 0x00800000); + WRITE_VIP32(SC1400_VIP_ODD_BASE, odd | 0x00800000); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vip_pitch + * + * This routine sets the number of bytes between scanlines for the VIP data. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_vip_pitch(unsigned long pitch) +#else +int +gfx_set_vip_pitch(unsigned long pitch) +#endif +{ + WRITE_VIP32(SC1400_VIP_PITCH, pitch & 0x0000FFFC); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_enable + * + * This routine enables or disables the VBI data capture. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_vbi_enable(int enable) +#else +int +gfx_set_vbi_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1400_VIP_CONTROL); + if (enable) + value |= SC1400_VIP_VBI_CAPTURE_EN; + else + value &= ~SC1400_VIP_VBI_CAPTURE_EN; + WRITE_VIP32(SC1400_VIP_CONTROL, value); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_base + * + * This routine sets the odd and even base address values for VBI capture. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_vbi_base(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_base(unsigned long even, unsigned long odd) +#endif +{ + // TRUE OFFSET IS SPECIFIED, NEED TO SET BIT 23 FOR HARDWARE + + WRITE_VIP32(SC1400_VBI_EVEN_BASE, even | 0x00800000); + WRITE_VIP32(SC1400_VBI_ODD_BASE, odd | 0x00800000); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_set_vbi_pitch + * + * This routine sets the number of bytes between scanlines for VBI capture. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_set_vbi_pitch(unsigned long pitch) +#else +int +gfx_set_vbi_pitch(unsigned long pitch) +#endif +{ + WRITE_VIP32(SC1400_VBI_PITCH, pitch & 0x0000FFFC); + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*----------------------------------------------------------------------------- + * gfx_get_vip_enable + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_vip_enable(void) +#else +int +gfx_get_vip_enable(void) +#endif +{ + if (READ_VIP32(SC1400_VIP_CONTROL) & 0x00000100) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_base + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_vip_base(int odd) +#else +unsigned long +gfx_get_vip_base(int odd) +#endif +{ + // MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET + + if (odd) + return (READ_VIP32(SC1400_VIP_ODD_BASE) & 0x007FFFFF); + return (READ_VIP32(SC1400_VIP_EVEN_BASE) & 0x007FFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vip_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_vip_pitch(void) +#else +unsigned long +gfx_get_vip_pitch(void) +#endif +{ + return (READ_VIP32(SC1400_VIP_PITCH) & 0x0000FFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_enable + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1400_get_vbi_enable(void) +#else +int +gfx_get_vbi_enable(void) +#endif +{ + if (READ_VIP32(SC1400_VIP_CONTROL) & 0x00000200) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_base + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_vbi_base(int odd) +#else +unsigned long +gfx_get_vbi_base(int odd) +#endif +{ + // MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET + + if (odd) + return (READ_VIP32(SC1400_VBI_ODD_BASE) & 0x007FFFFF); + return (READ_VIP32(SC1400_VBI_EVEN_BASE) & 0x007FFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_vbi_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1400_get_vbi_pitch(void) +#else +unsigned long +gfx_get_vbi_pitch(void) +#endif +{ + return (READ_VIP32(SC1400_VBI_PITCH) & 0x0000FFFF); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/92xx.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/92xx.h:1.1 --- /dev/null Thu Feb 27 12:31:17 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/92xx.h Tue Dec 10 10:12:28 2002 @@ -0,0 +1,466 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/92xx.h,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: 92xx.h $ + * $Revision: 9 $ + * + * File Contents: This header file defines the Durango routines and + * variables used to access the memory mapped regions. + * + * SubModule: Geode FlatPanel library + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _92XX_h +#define _92XX_h + +typedef unsigned long ULONG; +typedef unsigned char UCHAR; + +#define FALSE 0 +#define TRUE 1 +#define NUM_92XX_MODES 13 +#define ONE_BYTE 1 +#define TWO_BYTES 2 +#define FOUR_BYTES 4 + +/* LCD Registers + * The LCD memory area is shared by both TV and LCD. + * This offset is for LCD access. + */ + +#define CS92xx_LCD_OFFSET 0x00000400 + +/* LCD CONTROL REGISTERS */ + +#define CS92xx_LCD_PAN_TIMING1 CS92xx_LCD_OFFSET + 0x00 + +/* flat panel(FP) timings */ +#define CS92xx_LCD_PAN_TIMING2 CS92xx_LCD_OFFSET + 0x04 + +/* FP panel timings */ +#define CS92xx_LCD_PWR_MAN CS92xx_LCD_OFFSET + 0x08 + +/* FP power management */ +#define CS92xx_LCD_DITH_FR_CNTRL CS92xx_LCD_OFFSET + 0x0C + +/* FP dither and frame rate + * these defines are in revisions prior to C + */ +#define CS92xx_LCD_BLOCK_SEL1 CS92xx_LCD_OFFSET + 0x10 + +/* FRM register */ +#define CS92xx_LCD_BLOCK_SEL2 CS92xx_LCD_OFFSET + 0x14 + +/* FRM register */ +#define CS92xx_LCD_DISPER1 CS92xx_LCD_OFFSET + 0x18 + +/* FRM register */ +#define CS92xx_LCD_DISPER2 CS92xx_LCD_OFFSET + 0x1C + +/* FRM register + * these defines are revision C + */ +#define CS92xx_BLUE_LSFR_SEED CS92xx_LCD_OFFSET + 0x10 + +/* FRM register */ +#define CS92xx_RED_GREEN_LSFR_SEED CS92xx_LCD_OFFSET + 0x14 + +/* FRM register */ +#define CS92xx_FRM_MEMORY_INDEX CS92xx_LCD_OFFSET + 0x18 + +/* FRM register */ +#define CS92xx_FRM_MEMORY_DATA CS92xx_LCD_OFFSET + 0x1C + +/* FRM register */ +#define CS92xx_LCD_MEM_CNTRL CS92xx_LCD_OFFSET + 0x20 + +/* memory PLL register */ +#define CS92xx_LCD_RAM_CNTRL CS92xx_LCD_OFFSET + 0x24 + +/* ram control */ + +#define CS92xx_LCD_RAM_DATA CS92xx_LCD_OFFSET + 0x28 /* ram data */ + +#define CS92xx_LCD_PAN_CRC_SIG CS92xx_LCD_OFFSET + 0x2C + +/* FP CRC signature */ +#define CS92xx_DEV_REV_ID CS92xx_LCD_OFFSET + 0x30 + +/* Device and revision id */ +#define CS92xx_LCD_GPIO_DATA CS92xx_LCD_OFFSET + 0x34 /* GPIO Data */ + +#define CS92xx_LCD_GPIO_CNTRL CS92xx_LCD_OFFSET + 0x38 + +/* GPIO Control */ +int Pnl_Rev_ID; + +typedef struct +{ + /* DISPLAY MODE PARAMETERS */ + int xres; + int yres; + int bpp; + int panel_type; + int color_type; + /* VALUES USED TO SET THE FLAT PANEL DISPLAY CONTROLLER */ + unsigned long panel_timing1; + unsigned long panel_timing2; + unsigned long power_management; + /* the following 5 registers are prior to revision C */ + unsigned long pre_C_dither_frc; + unsigned long block_select1; + unsigned long block_select2; + unsigned long dispersion1; + unsigned long dispersion2; + /* the following 4 registers are revision C only */ + unsigned long rev_C_dither_frc; + unsigned long blue_lsfr_seed; + unsigned long red_green_lsfr_seed; + unsigned long frm_memory_index; + unsigned long frm_memory_data; + unsigned long memory_control; + +} +CS92xx_MODE; + +/* VALUES USED TO SAVE AND RESTORE 9211 REGISTERS. */ +typedef struct +{ + unsigned long panel_state; + /* VALUES USED TO SET THE FLAT PANEL DISPLAY CONTROLLER */ + unsigned long panel_timing1; + unsigned long panel_timing2; + unsigned long power_management; + unsigned long dither_frc_ctrl; + unsigned long blue_lsfr_seed; + unsigned long red_green_lsfr_seed; + unsigned long frm_memory_index; + unsigned long frm_memory_data; + unsigned long memory_control; +} +CS92xx_REGS; + +CS92xx_REGS cs9211_regs; + +/* + *------------------------------------------------------------------------ + * PANEL MODE TABLES: + * GLOBAL ARRAY OF FLAT PANEL MODE STRUCTURES + *------------------------------------------------------------------------ + */ +CS92xx_MODE FPModeParams[] = { + + {640, 480, 8, PNL_SSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x00034000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x21446450, 0x21446450, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {640, 480, 12, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x0f100000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {640, 480, 18, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x0f100000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {640, 480, 16, PNL_DSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x00014000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x048c26ae, 0x048c26ae, /* block select 1, block select 2 */ + 0x02468ace, 0x13579bdf, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {640, 480, 8, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x01e00000, 0x00084000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x21446450, 0x21446450, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {640, 480, 16, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x01e00000, 0x00094000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x81a5d470, 0x29cfb63e, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {800, 600, 12, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x02580000, 0x0f100000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {800, 600, 18, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x02580000, 0x0f100000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {800, 600, 16, PNL_DSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x02580000, 0x00014000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x048c26ae, 0x048c26ae, /* block select 1, block select 2 */ + 0x02468ace, 0x13579bdf, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {800, 600, 8, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x02580000, 0x00084000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x21446450, 0x21446450, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {800, 600, 16, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x02580000, 0x00094000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x81a5d470, 0x29cfb63e, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {1024, 768, 18, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x03000000, 0x0f100000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /*The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /*The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {1024, 768, 24, PNL_DSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x03000000, 0x80024000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /*The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x048c26ae, 0x048c26ae, /* block select 1, block select 2 */ + 0x02468ace, 0x13579bdf, /* dispersion 1, dispersion 2 */ + /*The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000005, /* memory control */ + } +}; + +#endif /* !_92XX_h */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.c:1.1 --- /dev/null Thu Feb 27 12:31:17 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.c Tue Dec 10 10:12:28 2002 @@ -0,0 +1,971 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.c,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: cen9211.c $ + * + * File Contents: This file contains panel functions to interface with + * the centaraus platform. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Geode graphics driver for panel support + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "cen9211.h" + +static unsigned char sioc2_orig_val; +static unsigned char must_restore_97317 = FALSE; + +/******************************************************************** + * + * PASS_FAIL init_GPIO(void); + * Initializes the GPIO pins in the Cx5530 or the National PC97317 + * for use with a 9211 on a Marmot or Centaurus board. Uses + * the global variables RdPCIVal and sioc2_orig_val. + * + *********************************************************************/ + +unsigned char +init_Centaurus_GPIO(void) +{ + unsigned char reg_val; + static unsigned char first_time = TRUE; + + /* The Centaurus board uses ports 1 and 2 of the 97317 for GPIO. + * These ports require bank 0 to be active. The first thing we will + * do is verify that bank 0 is active and set it if it is not. + */ + + /* set the index for access to the configuration register */ + gfx_outb(CENT_CONFIG_INDEX, CENT_SIOC2); + reg_val = gfx_inb(CENT_CONFIG_DATA); + + /* set to bank 0 */ + if (reg_val & CENT_GPIO_BANK_SELECT) { + gfx_outb(CENT_CONFIG_DATA, + (unsigned char)(reg_val & ~CENT_GPIO_BANK_SELECT)); + } + + /* If this is the first time we have modified sioc2, we must + * save the current value (set by the BIOS) for restoration by + * the calling program, set the global flag must_restore_97317, and set + * first_time to FALSE. + */ + + if (first_time == TRUE) { + sioc2_orig_val = reg_val; + must_restore_97317 = TRUE; + first_time = FALSE; + } + + /* set port 1 direction */ + reg_val = gfx_inb(CENT_PORT1_DIRECTION); + + /* make GPIO 14 and 17 outputs */ + reg_val |= CENT_97317_CLOCK_MASK | CENT_97317_DATA_OUT_MASK; + gfx_outb(CENT_PORT1_DIRECTION, reg_val); + + /* set port 2 direction */ + reg_val = gfx_inb(CENT_PORT2_DIRECTION); + + /* make GPIO 20 an output */ + + reg_val |= CENT_97317_CHIP_SEL_MASK; + + /* make GPIO 21 an input */ + + reg_val &= ~CENT_97317_DATA_IN_MASK; + gfx_outb(CENT_PORT2_DIRECTION, reg_val); + + /* make GPIO 14 and 17 push-pull */ + + reg_val = gfx_inb(CENT_PORT1_OUTPUT_TYPE); + reg_val |= CENT_97317_CLOCK_MASK | CENT_97317_DATA_OUT_MASK; + gfx_outb(CENT_PORT1_OUTPUT_TYPE, reg_val); + + /* make GPIO 20 and 21 push-pull */ + reg_val = gfx_inb(CENT_PORT2_OUTPUT_TYPE); + reg_val |= CENT_97317_CHIP_SEL_MASK | CENT_97317_DATA_IN_MASK; + gfx_outb(CENT_PORT2_OUTPUT_TYPE, reg_val); + return CENT_PASS; + +} /* end init_GPIO() */ + +/********************************************************************* + * + * PASS_FAIL init_9211(void); + * Initializes (sets to 0) the clock, chip select, and data pins + * of the Cx9211 on a Marmot or Centaurus board. + * + **********************************************************************/ + +unsigned char +init_Centaurus_9211(void) +{ + unsigned char ReadData; + + /* Uses the 97317 for GPIO. + * we will use the clock port define for port 1 + */ + ReadData = gfx_inb(CENT_97317_CLOCK_PORT); + ReadData &= ~CENT_97317_CLOCK_MASK & ~CENT_97317_DATA_OUT_MASK; + gfx_outb(CENT_97317_CLOCK_PORT, ReadData); + /* we will use the chip select port define for port 2 */ + ReadData = gfx_inb(CENT_97317_CHIP_SELECT); + ReadData &= ~CENT_97317_CHIP_SEL_MASK & ~CENT_97317_DATA_IN_MASK; + gfx_outb(CENT_97317_CHIP_SELECT, ReadData); + return (CENT_PASS); + +} /*end init_9211() */ + +/****************************************************************** + * + * PASS_FAIL restore_97317_SIOC2(void); + * Restores the original value to the 97317 SIOC2 register using + * the global variable sioc2_orig_val. Returns PASS if the value + * was written, FAIL if not. + * + *******************************************************************/ + +unsigned char +restore_Centaurus_97317_SIOC2(void) +{ + /* set the global flag */ + if (must_restore_97317 == TRUE) { + unsigned char cfg; + + /* set the index for access to the configuration register */ + gfx_outb(CENT_CONFIG_INDEX, CENT_SIOC2); + + /* restore the value */ + gfx_outb(CENT_CONFIG_DATA, sioc2_orig_val); + + /* now read and verify */ + cfg = gfx_inb(CENT_CONFIG_DATA); + if (cfg == sioc2_orig_val) + return (CENT_PASS); + else + return (CENT_FAIL); + + } /* end if() */ + return (CENT_FAIL); + +} /* end restore_97317_SIOC2bank() */ + +/* ----------------------------------------------------------------------- + * + * SET_FLAT_PANEL_MODE + * + * This routine sets the specified flat panel moden parameters in + * the 9211. + * Returns PASS if successful, FAIL if the mode parameters could + * not be set. + * + *------------------------------------------------------------------------*/ + +unsigned char +set_Centaurus_92xx_mode(Pnl_PanelStat * pstat) +{ + int mode; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_92XX_MODES; mode++) { + if ((FPModeParams[mode].xres == pstat->XRes) && + (FPModeParams[mode].yres == pstat->YRes) && + (FPModeParams[mode].bpp == pstat->Depth) && + (FPModeParams[mode].panel_type == pstat->Type) && + (FPModeParams[mode].color_type == pstat->MonoColor)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + set_Centaurus_92xx_mode_params(mode); + return (CENT_PASS); + } /* end if() */ + } /* end for() */ + return (CENT_FAIL); + +} /* end set_Centaurus_92xx_mode() */ + +/*------------------------------------------------------------------- + * + * SET_92XX_MODE_PARAMS + * This routine sets the 9211 mode parameters. + * + *-------------------------------------------------------------------*/ + +void +set_Centaurus_92xx_mode_params(int mode) +{ + CS92xx_MODE *pMode = &FPModeParams[mode]; + unsigned long off_data = 0; + + /* Turn the 92xx power off before setting any new parameters. + * Since we are going to reset all the power bit positions, we will + * force the power register to 0. + */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + + /* set 9211 registers using the desired panel settings */ + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_PAN_TIMING1, pMode->panel_timing1); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_PAN_TIMING2, pMode->panel_timing2); + + if (Pnl_Rev_ID == PNL_9211_C) { + + /* load the LSFR seeds */ + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DITH_FR_CNTRL, pMode->rev_C_dither_frc); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_BLUE_LSFR_SEED, pMode->blue_lsfr_seed); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_RED_GREEN_LSFR_SEED, + pMode->red_green_lsfr_seed); + } else { + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DITH_FR_CNTRL, pMode->pre_C_dither_frc); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_BLOCK_SEL1, pMode->block_select1); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_BLOCK_SEL2, pMode->block_select2); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DISPER1, pMode->dispersion1); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DISPER2, pMode->dispersion2); + + CentaurusProgramFRMload(); + } + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_MEM_CNTRL, + pMode->memory_control); + + /* Set the power register last. This will turn the panel on at the 9211. */ + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_PWR_MAN, pMode->power_management); + +} /* end set_Centaurus_92xx_mode_params() */ + +void +Centaurus_write_gpio(int width, ULONG address, unsigned long data) +{ + int num_clock_toggles; + int count; + unsigned long Addr = address; + + enable_Centaurus_9211_chip_select(); + + /* Write 1 Clock period of no valid transfer */ + write_Centaurus_CX9211_GPIO(CENT_NO_DATA); + + /* Write 1 control bit (the data book calls this the control bar write) */ + write_Centaurus_CX9211_GPIO(0x1); + + /* Write the 12-bit address */ + for (count = 0; count < 12; count++) { + write_Centaurus_CX9211_GPIO((unsigned char)(Addr & 0x01)); + /*the 9211 expects data LSB->MSB */ + Addr = Addr >> 1; + } + + /* write */ + write_Centaurus_CX9211_DWdata(data); + + /* a write will require four toggles after disabling CS */ + num_clock_toggles = CENT_NUM_WRITE_CLOCK_TOGGLES; + disable_Centaurus_9211_chip_select(); + + /* now toggle the clock */ + for (count = 0; count < num_clock_toggles; count++) { + toggle_Centaurus_9211_clock(); + } + return; + +} /* end Centaurus_write_gpio() */ + +unsigned long +Centaurus_read_gpio(int width, unsigned long address) +{ + int num_clock_toggles; + int count; + unsigned long Addr = address; + unsigned long data; + + enable_Centaurus_9211_chip_select(); + + /* Write 1 Clock period of no valid transfer */ + write_Centaurus_CX9211_GPIO(CENT_NO_DATA); + + /* Write 1 control bit (the data book calls this the control bar write) */ + write_Centaurus_CX9211_GPIO(0x1); + + /* Write the 12-bit address */ + for (count = 0; count < 12; count++) { + write_Centaurus_CX9211_GPIO((unsigned char)(Addr & 0x01)); + + /*the 9211 expects data LSB->MSB */ + Addr = Addr >> 1; + } + + data = read_Centaurus_CX9211_DWdata(); + + /* a read will require one toggle after disabling CS */ + num_clock_toggles = CENT_NUM_READ_CLOCK_TOGGLES; + disable_Centaurus_9211_chip_select(); + + /* now toggle the clock */ + for (count = 0; count < num_clock_toggles; count++) { + toggle_Centaurus_9211_clock(); + } + return data; + +} /* end Centaurus_read_gpio() */ + +/******************************************************************* + * + * void enable_Centaurus_9211_chip_select(void); + * Enables the chip select of the CX9211 using the National 97317 + * on a Centaurus board. + * + *******************************************************************/ + +void +enable_Centaurus_9211_chip_select(void) +{ + unsigned char cs_port_val; + + /* Set the chip select (GPIO20) high */ + cs_port_val = gfx_inb(CENT_97317_CHIP_SELECT); + gfx_outb(CENT_97317_CHIP_SELECT, + (unsigned char)(cs_port_val | CENT_97317_CHIP_SEL_MASK)); + return; + +} /* end enable_Centaurus_9211_chip_select() */ + +/******************************************************************** + * + * void disable_Centaurus_9211_chip_select(void); + * Disables the chip select of the CX9211 using the National 97317 + * on a Centaurus board. + * + *******************************************************************/ + +void +disable_Centaurus_9211_chip_select(void) +{ + unsigned char cs_port_val; + + /* Set the chip select (GPIO20) low */ + cs_port_val = gfx_inb(CENT_97317_CHIP_SELECT); + gfx_outb(CENT_97317_CHIP_SELECT, + (unsigned char)(cs_port_val & ~CENT_97317_CHIP_SEL_MASK)); + return; + +} /* end disable_Centaurus_9211_chip_select() */ + +/********************************************************************** + * + * void toggle_Centaurus_9211_clock(void); + * Toggles the clock bit of the CX9211 using the National 97317 on a + * Centaurus board. Assumes the 9211 clock bit has previously been + * initialized to 0 (this way we do not have to waste GPIO cycles + * windowing the clock pulse). + * + **********************************************************************/ + +void +toggle_Centaurus_9211_clock(void) +{ + unsigned char port_val; + + /* get the 97317 GPIO port contents for the 9211 clock */ + + port_val = gfx_inb(CENT_97317_CLOCK_PORT); + /* set the clock bit high */ + gfx_outb(CENT_97317_CLOCK_PORT, + (unsigned char)(port_val | CENT_97317_CLOCK_MASK)); + + /* set the clock bit low */ + gfx_outb(CENT_97317_CLOCK_PORT, + (unsigned char)(port_val & ~CENT_97317_CLOCK_MASK)); + +} /* end toggle_Centaurus_9211_clock() */ + +/******************************************************************** + * + * void write_Centaurus_CX9211_GPIO(unsigned char databit); + * Writes the value in bit 0 of the value passed in databit to + * the 9211 through the GPIO interface of the National 97317 on a + * Centaurus board. + * NOTE: This function does not set or reset the chip select line! + * + *******************************************************************/ + +void +write_Centaurus_CX9211_GPIO(unsigned char databit) +{ + unsigned char data_port_val; + + /* Set the data bit for (GPIO17) */ + databit <<= 7; + + /* read the value of the other bits in the 97317 data port */ + data_port_val = gfx_inb(CENT_97317_DATA_OUTPORT); + + /* set the bit accordingly */ + data_port_val &= ~CENT_97317_DATA_OUT_MASK; + data_port_val |= databit; + gfx_outb(CENT_97317_DATA_OUTPORT, data_port_val); + + /* clock the data */ + toggle_Centaurus_9211_clock(); + return; + +} /* end write_Centaurus_CX9211_GPIO() */ + +/***************************************************************** + * + * void write_Centaurus_CX9211_DWdata(unsigned long data); + * Writes the doubleword value passed in data to the CX9211 + * using GPIO Pins of the National 97317 on a Centaurus board. + * This function assumes the Direction register of the 97317 + * and the address register of the CX9211 have been previously set. + * Uses the global variable count. + * NOTE: This function does not set or reset the chip select line! + * + ******************************************************************/ + +void +write_Centaurus_CX9211_DWdata(unsigned long data) +{ + int count; + + /* Send the read/write command to the 9211 first. */ + + write_Centaurus_CX9211_GPIO(CENT_WRITE); + + /* Now write the 32-bit Data */ + for (count = 0; count < 32; count++) { + write_Centaurus_CX9211_GPIO((unsigned char)(data & 0x01)); + + /* the 9211 expects the data LSB->MSB */ + data >>= 1; + } + return; + +} /* end write_Centaurus_CX9211_DWdata() */ + +/********************************************************************* + * + * unsigned char read_Centaurus_CX9211_GPIO(void); + * Returns the current value of the databit of the 9211 in bit 0 + * using the GPIO interface of the National 97317 on a Centaurus board. + * NOTE: This function does not set or reset the chip select line! + * + *********************************************************************/ + +unsigned char +read_Centaurus_CX9211_GPIO(void) +{ + unsigned char data_port_val; + + toggle_Centaurus_9211_clock(); + + /* read the data */ + data_port_val = gfx_inb(CENT_97317_DATA_INPORT); + + /* Save the data from (GPIO21) as bit 0 */ + data_port_val >>= 1; + return (data_port_val & 0x1); + +} /* end read_Centaurus_CX9211_GPIO() */ + +/********************************************************************** + * + * void read_Centaurus_CX9211_DWdata(unsigned long *data); + * Reads a doubleword value from the CX9211 using GPIO Pins of + * the National 97317 on a Centaurus board. + * This function assumes the Direction register of the 97317 and + * the address register of the CX9211 have been previously set. + * NOTE: This function does not set or reset the chip select line! + * + ***********************************************************************/ + +unsigned long +read_Centaurus_CX9211_DWdata(void) +{ + unsigned char ReadData; + int count; + unsigned long Data; + + /* Send read/write command word to the 9211 first. */ + write_Centaurus_CX9211_GPIO(CENT_READ); + + /* The data book (revision 0.1) states 8 clock periods of no valid data. + * However, the data becomes valid on the eighth clock, making the eighth + * clock valid. Since read_Centaurus_GPIO() toggles the clock before + * reading, we will only toggle the clock 7 times here. + */ + for (count = 0; count < 7; count++) /* works */ + toggle_Centaurus_9211_clock(); + + /* Now read the 32-bit Data, bit by bit in a single loop. */ + Data = 0; + for (count = 0; count < 32; count++) { + ReadData = read_Centaurus_CX9211_GPIO(); + /* 9211 sends data LSB->MSB */ + Data = Data | (((unsigned long)ReadData) << count); + } /* end for() */ + + return Data; + +} /* end read_Centaurus_CX9211_DWdata() */ + +void +Centaurus_Get_9211_Details(unsigned long flags, PPnl_PanelParams pParam) +{ + unsigned long PanelType; + int i; + + for (i = 0; i < 0x7fff; i++) { + } + + init_Centaurus_GPIO(); + + for (i = 0; i < 5; i++) + toggle_Centaurus_9211_clock(); + + if (flags & PNL_PANELCHIP) { + + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x430); + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x430); + if ((PanelType & 0xFFFF0000) == 0x92110000) { + + /* found 9211 */ + /* check the values for revision ID */ + if (PanelType >= 0x92110301) + pParam->PanelChip = PNL_9211_C; + else if ((PanelType >= 0x92110101) && (PanelType < 0x92110301)) + pParam->PanelChip = PNL_9211_A; + else + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } else { /* no 9211 present */ + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } + Pnl_Rev_ID = pParam->PanelChip; + } + /* if end */ + if ((pParam->PanelChip != PNL_UNKNOWN_CHIP) && (flags & PNL_PANELSTAT)) { + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x438); + PanelType &= 0x00f8f8f8; + PanelType |= 0x00070000; + Centaurus_write_gpio(FOUR_BYTES, 0x438, PanelType); + PanelType = 0; + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x434); + PanelType = (PanelType >> 8); + PanelType &= 0x7; + + switch (PanelType) { + case 0: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 1: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_SSTN; + break; + case 2: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 3: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 4: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 5: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 24; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 6: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_MONO_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 7: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + default: + break; + } + } + +} + +void +CentaurusProgramFRMload(void) +{ + unsigned long CentaurusFRMtable[] = { + 0x00000000, + 0x00000000, + 0x01000100, + 0x01000100, + 0x01010101, + 0x01010101, + 0x02081041, + 0x02081041, + 0x10111111, + 0x11111101, + 0x49249241, + 0x12412492, + 0x92244891, + 0x92244891, + 0x22252525, + 0x22252525, + 0x528294a5, + 0x2528494a, + 0x294a5295, + 0x294a5295, + 0x54a54a95, + 0x2952a52a, + 0x2a552a55, + 0x2a552a55, + 0x554aa955, + 0x2a9552aa, + 0x2aaa5555, + 0x2aaa5555, + 0x55555555, + 0x2aaaaaaa, + 0x55555555, + 0x55555555, + 0xaaaaaaab, + 0x55555555, + 0x5555aaab, + 0x5555aaab, + 0xaab556ab, + 0x556aad55, + 0x55ab55ab, + 0x55ab55ab, + 0xab5ab56b, + 0x56ad5ad5, + 0x56b5ad6b, + 0x56b5ad6b, + 0xad6d6b5b, + 0x5ad6b6b6, + 0x5b5b5b5b, + 0x5b5b5b5b, + 0x5F6db6db, + 0x5F6db6db, + 0xF776F776, + 0xF776F776, + 0xFBDEFBDE, + 0xFBDEFBDE, + 0x7eFFBFF7, + 0x7eFFBFF7, + 0xFF7FF7F7, + 0xFF7FF7F7, + 0xFF7FFF7F, + 0xFF7FFF7F, + 0xFFF7FFFF, + 0xFFF7FFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + }; + + unsigned char i; + unsigned short index; + unsigned long data; + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_INDEX, 0); + index = CS92xx_FRM_MEMORY_DATA; + for (i = 0; i < 64; i += 2) { + data = CentaurusFRMtable[i]; + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, data); + data = CentaurusFRMtable[i + 1]; + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, data); + } + + /* + * The first FRM location (64 bits) does not program correctly. + * This location always reads back with the last value programmed. + * ie. If 32 64-bit values are programmed, location 0 reads + * back as the 32nd If 30 locations are programmed, location 0 + * reads back as the 30th, etc. + * Fix this by re-writing location 0 after programming all 64 in + * the writeFRM loop in RevCFrmload() in CS9211. + */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_INDEX, 0); + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, 0); + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, 0); +} + +/******************************************************************** + * + * void Centaurus_Enable_Power((void); + * Enables the power of the CX9211 using the National 97317 on + * a Centaurus board. + * + ********************************************************************/ + +void +Centaurus_Power_Up(void) +{ + unsigned long off_data = 0x01000000; + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + return; + +} /* Centaurus_Disable_Power */ + +/*********************************************************************** + * + * void Centaurus_Disable_Power((void); + * Disables the power of the CX9211 using the National 97317 + * on a Centaurus board. + * + **********************************************************************/ + +void +Centaurus_Power_Down(void) +{ + unsigned long off_data = 0; + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + return; + +} /* Centaurus_Disable_Power */ + +void +Centaurus_9211init(Pnl_PanelStat * pstat) +{ + init_Centaurus_GPIO(); + init_Centaurus_9211(); + set_Centaurus_92xx_mode(pstat); + restore_Centaurus_97317_SIOC2(); +} + +void +Centaurus_Save_Panel_State(void) +{ + /* set 9211 registers using the desired panel settings */ + + cs9211_regs.panel_timing1 = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING1); + cs9211_regs.panel_timing2 = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING2); + cs9211_regs.dither_frc_ctrl = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_DITH_FR_CNTRL); + cs9211_regs.blue_lsfr_seed = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_BLUE_LSFR_SEED); + + cs9211_regs.red_green_lsfr_seed = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_RED_GREEN_LSFR_SEED); + /* CentaurusProgramFRMload(); */ + + cs9211_regs.memory_control = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_MEM_CNTRL); + + /* Set the power register last. + * This will turn the panel on at the 9211. + */ + cs9211_regs.power_management = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN); +} + +void +Centaurus_Restore_Panel_State(void) +{ + + unsigned long off_data = 0; + + /* Before restoring the 9211 registers, power off the 9211. */ + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + + /* set 9211 registers using the desired panel settings */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING1, + cs9211_regs.panel_timing1); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING2, + cs9211_regs.panel_timing2); + + /* load the LSFR seeds */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_DITH_FR_CNTRL, + cs9211_regs.dither_frc_ctrl); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_BLUE_LSFR_SEED, + cs9211_regs.blue_lsfr_seed); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_RED_GREEN_LSFR_SEED, + cs9211_regs.red_green_lsfr_seed); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_MEM_CNTRL, + cs9211_regs.memory_control); + + /* Set the power register last. This will turn the panel on at the 9211. */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, + cs9211_regs.power_management); + +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.h:1.1 --- /dev/null Thu Feb 27 12:31:17 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.h Tue Dec 10 10:12:28 2002 @@ -0,0 +1,209 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/cen9211.h,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: cen9211.h $ + * $Revision: 16 $ + * + * File Contents: This header file defines the Durango routines and + * variables used to access the memory mapped regions. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "92xx.h" +#include "panel.h" + +#ifndef _CEN9211_h +#define _CEN9211_h + +/* Centaurus/97317 GPIO PORT defines */ + +#define CENT_97317_CLOCK_PORT 0xE0 +#define CENT_97317_DATA_OUTPORT 0xE0 +#define CENT_97317_CHIP_SELECT 0xE4 +#define CENT_97317_DATA_INPORT 0xE4 +#define CENT_PORT1_DIRECTION 0xE1 +#define CENT_PORT2_DIRECTION 0xE5 +#define CENT_PORT1_OUTPUT_TYPE 0xE2 +#define CENT_PORT2_OUTPUT_TYPE 0xE6 + +/* + * Centaurus/97317 GPIO bit masks. + * In and out are with respect to the 97317. + */ + +#define CENT_97317_CLOCK_MASK 0x10 +#define CENT_97317_CHIP_SEL_MASK 0x01 +#define CENT_97317_DATA_IN_MASK 0x02 +#define CENT_97317_DATA_OUT_MASK 0x80 + +#define CENT_PASS 1 +#define CENT_FAIL 0 +#define CENT_READ 0x0000 +#define CENT_WRITE 0x0001 +#define CENT_NO_DATA 0 + +#define CENT_CONFIG_INDEX 0x2E +#define CENT_SIOC2 0x22 +#define CENT_CONFIG_DATA 0x2F +#define CENT_GPIO_BANK_SELECT 0x80 + +#define CENT_NUM_READ_CLOCK_TOGGLES 1 +#define CENT_NUM_WRITE_CLOCK_TOGGLES 4 + +/* local functions */ +void set_Centaurus_92xx_mode_params(int mode); +void enable_Centaurus_9211_chip_select(void); +void disable_Centaurus_9211_chip_select(void); +void toggle_Centaurus_9211_clock(void); +void write_Centaurus_CX9211_GPIO(unsigned char databit); +void write_Centaurus_CX9211_DWdata(unsigned long data); +void Centaurus_write_gpio(int width, unsigned long address, + unsigned long data); +void Centaurus_Power_Up(void); +void Centaurus_Power_Down(void); +unsigned long Centaurus_read_gpio(int width, unsigned long address); +unsigned char read_Centaurus_CX9211_GPIO(void); +unsigned long read_Centaurus_CX9211_DWdata(void); +unsigned char restore_Centaurus_97317_SIOC2(void); +unsigned char init_Centaurus_GPIO(void); +unsigned char init_Centaurus_9211(void); +unsigned char set_Centaurus_92xx_mode(Pnl_PanelStat * pstat); +void CentaurusProgramFRMload(void); +void Centaurus_Get_9211_Details(unsigned long flags, PPnl_PanelParams pParam); +void Centaurus_Save_Panel_State(void); +void Centaurus_Restore_Panel_State(void); +void Centaurus_9211init(Pnl_PanelStat * pstat); + +#endif /* !_CEN9211_h */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.c:1.1 --- /dev/null Thu Feb 27 12:31:18 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.c Tue Dec 10 10:12:28 2002 @@ -0,0 +1,713 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.c,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: dora9211.c $ + * $Revision: 19 $ + * + * File Contents: This file contains the panel functions to interface + * the dorado platform. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "dora9211.h" + +void +Dorado_Get_9211_Details(unsigned long flags, PPnl_PanelParams pParam) +{ + unsigned long DPanelType; + int i; + + for (i = 0; i < 0x7fff; i++) { + } + + Dorado9211GpioInit(); + + for (i = 0; i < 5; i++) + toggle_Centaurus_9211_clock(); + + if (flags & PNL_PANELCHIP) { + DPanelType = Dorado9211ReadReg(0x430); + + if ((DPanelType & 0xFFFF0000) == 0x92110000) { /* found 9211 */ + /* check the values for revision ID */ + if (DPanelType >= 0x92110301) + pParam->PanelChip = PNL_9211_C; + else if ((DPanelType >= 0x92110101) && (DPanelType < 0x92110301)) + pParam->PanelChip = PNL_9211_A; + else + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } else { /* no 9211 present */ + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } + } + + if ((pParam->PanelChip != PNL_UNKNOWN_CHIP) && (flags & PNL_PANELSTAT)) { + unsigned long PanelTypeOrg; + unsigned char Panel_2Byte; + + DPanelType = Dorado9211ReadReg(0x438); + DPanelType &= 0x00e8e8e8; + DPanelType |= 0x00170000; + Dorado9211WriteReg(0x438, DPanelType); + DPanelType = 0; + + DPanelType = Dorado9211ReadReg(0x434); + DPanelType = (DPanelType >> (DRD_LCDRESGPIO1 + 1)); + PanelTypeOrg = DPanelType >> 8; + Panel_2Byte = (unsigned char)PanelTypeOrg; + Panel_2Byte = (Panel_2Byte >> (DRD_LCDRESGPIO2 - DRD_LCDRESGPIO1 - 1)); + DPanelType = (DPanelType | ((unsigned int)Panel_2Byte << 8)); + DPanelType = DPanelType >> 1; + PanelTypeOrg = DPanelType >> 8; + Panel_2Byte = (unsigned char)PanelTypeOrg; + Panel_2Byte = (Panel_2Byte >> (DRD_LCDRESGPIO3 - DRD_LCDRESGPIO2 - 1)); + DPanelType = (DPanelType | ((unsigned int)Panel_2Byte << 8)); + DPanelType = DPanelType >> 1; + PanelTypeOrg = DPanelType >> 8; + Panel_2Byte = (unsigned char)PanelTypeOrg; + Panel_2Byte = (Panel_2Byte >> (DRD_LCDRESGPIO4 - DRD_LCDRESGPIO3 - 1)); + DPanelType = (DPanelType | ((unsigned int)Panel_2Byte << 8)); + DPanelType = DPanelType >> 5; + DPanelType &= 0xf; + + switch (DPanelType) { + case 8: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + + case 9: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_SSTN; + break; + + case 10: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 11: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 12: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 13: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 24; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 14: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_MONO_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 15: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + default: + break; + } + } + /* if block end */ +} + +void +Dorado9211Init(Pnl_PanelStat * pstat) +{ + int mode; + unsigned long orig_value, pm_value; + + gfx_delay_milliseconds(100); + Dorado9211GpioInit(); + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + + gfx_delay_milliseconds(100); + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x0); + + gfx_delay_milliseconds(100); + gfx_delay_milliseconds(100); + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_92XX_MODES; mode++) { + if ((FPModeParams[mode].xres == pstat->XRes) && + (FPModeParams[mode].yres == pstat->YRes) && + (FPModeParams[mode].bpp == pstat->Depth) && + (FPModeParams[mode].panel_type == pstat->Type) && + (FPModeParams[mode].color_type == pstat->MonoColor)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + CS92xx_MODE *pMode = &FPModeParams[mode]; + + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING1, pMode->panel_timing1); + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING2, pMode->panel_timing2); + Dorado9211WriteReg(CS92xx_LCD_DITH_FR_CNTRL, + pMode->rev_C_dither_frc); + Dorado9211WriteReg(CS92xx_BLUE_LSFR_SEED, pMode->blue_lsfr_seed); + Dorado9211WriteReg(CS92xx_RED_GREEN_LSFR_SEED, + pMode->red_green_lsfr_seed); + DoradoProgramFRMload(); + Dorado9211WriteReg(CS92xx_LCD_MEM_CNTRL, pMode->memory_control); + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, pMode->power_management); + gfx_delay_milliseconds(100); + gfx_delay_milliseconds(100); + Dorado9211ClearCS(); + + /* This code is added to take care of Panel initialization. + * Irrespective of Xpressrom is enabling the panel or not. + */ + orig_value = READ_VID32(0X04); + WRITE_VID32(0x04, 0x00200141); + gfx_delay_milliseconds(21); + pm_value = gfx_ind(0x9030); + + pm_value |= 0x400; + gfx_outd(0x9030, pm_value); + gfx_delay_milliseconds(4); + orig_value &= 0xfff1ffff; + WRITE_VID32(0X4, orig_value); + return; + } /*end if() */ + } /*end for() */ + +} + +void +Dorado9211SetCS(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CSP9211IN); + gfx_outd(DRD_CSP9211OUT, value | DRD_CS9211); +} + +void +Dorado9211ClearCS(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CSP9211IN); + gfx_outd(DRD_CSP9211OUT, value & (~DRD_CS9211)); +} + +void +Dorado9211SetDataOut(void) +{ + unsigned long value; + + value = gfx_ind(DRD_DATAOUTP9211IN); + gfx_outd(DRD_DATAOUTP9211OUT, value | DRD_DATAIN9211); +} + +void +Dorado9211ClearDataOut(void) +{ + unsigned long value; + + value = gfx_ind(DRD_DATAOUTP9211IN); + gfx_outd(DRD_DATAOUTP9211OUT, value & (~DRD_DATAIN9211)); +} + +unsigned char +Dorado9211ReadDataIn(void) +{ + unsigned char readdata = 0; + unsigned long value; + + /* why to read 4 times ??? */ + value = gfx_ind(DRD_DATAINP9211IN); + value = gfx_ind(DRD_DATAINP9211IN); + value = gfx_ind(DRD_DATAINP9211IN); + value = gfx_ind(DRD_DATAINP9211IN); + if (value & DRD_DATAOUT9211) + readdata = 1; + return (readdata); +} + +void +Dorado9211ToggleClock(void) +{ + Dorado9211SetClock(); + Dorado9211ClearClock(); +} + +void +Dorado9211SetClock(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CLOCKP9211IN); + gfx_outd(DRD_CLOCKP9211OUT, value | DRD_CLOCK9211); +} + +void +Dorado9211ClearClock(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CLOCKP9211IN); + gfx_outd(DRD_CLOCKP9211OUT, value & (~DRD_CLOCK9211)); +} + +void +Dorado9211GpioInit(void) +{ + unsigned long value; + + /* set output enable on gpio 7, 9, 11 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_CLOCK9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); + /* set output enable on gpio 7, 9, 11 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_CS9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); + /* set output enable on gpio 7, 9, 18 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_DATAIN9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); + /* disable on gpio 11 - This is the output from the 9211 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_DATAOUT9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 0); + /* Set all PINS low */ + value = gfx_ind(DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0); + value &= ~(DRD_CS9211 | DRD_CLOCK9211 | DRD_DATAIN9211); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0), value); +} + +unsigned long +Dorado9211ReadReg(unsigned short index) +{ + + unsigned char i, readbit; + unsigned long data; + + Dorado9211ClearDataOut(); + + Dorado9211SetCS(); + Dorado9211ToggleClock(); + + Dorado9211SetDataOut(); + Dorado9211ToggleClock(); + + for (i = 0; i < 12; i++) { + if (index & 0x1) { + Dorado9211SetDataOut(); + } else { + Dorado9211ClearDataOut(); + } + Dorado9211ToggleClock(); + index >>= 1; + } + + Dorado9211ClearDataOut(); + Dorado9211ToggleClock(); + + /* Idle clock, 7 clocks, no data set */ + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + + data = 0; + for (i = 0; i < 32; i++) { + Dorado9211ToggleClock(); + readbit = Dorado9211ReadDataIn(); + data |= (((unsigned long)readbit) << i); + } + + Dorado9211ClearCS(); + Dorado9211ToggleClock(); + return (data); + +} + +void +Dorado9211WriteReg(unsigned short index, unsigned long data) +{ + + unsigned char i; + + Dorado9211ClearDataOut(); + Dorado9211SetDataOut(); + Dorado9211SetCS(); + Dorado9211ToggleClock(); + Dorado9211SetDataOut(); + Dorado9211ToggleClock(); + + for (i = 0; i < 12; i++) { + if (index & 0x1) { + Dorado9211SetDataOut(); + } else { + Dorado9211ClearDataOut(); + } + Dorado9211ToggleClock(); + index >>= 1; + } + + Dorado9211SetDataOut(); + Dorado9211ToggleClock(); + + for (i = 0; i < 32; i++) { + if (data & 0x1) { + Dorado9211SetDataOut(); + } else { + Dorado9211ClearDataOut(); + } + Dorado9211ToggleClock(); + data >>= 1; + } + + Dorado9211ClearCS(); + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); +} + +void +DoradoProgramFRMload(void) +{ + unsigned long DoradoFRMtable[] = { + + 0x00000000, + 0x00000000, + 0x01000100, + 0x01000100, + 0x01010101, + 0x01010101, + 0x02081041, + 0x02081041, + 0x10111111, + 0x11111101, + 0x49249241, + 0x12412492, + 0x92244891, + 0x92244891, + 0x22252525, + 0x22252525, + 0x528294a5, + 0x2528494a, + 0x294a5295, + 0x294a5295, + 0x54a54a95, + 0x2952a52a, + 0x2a552a55, + 0x2a552a55, + 0x554aa955, + 0x2a9552aa, + 0x2aaa5555, + 0x2aaa5555, + 0x55555555, + 0x2aaaaaaa, + 0x55555555, + 0x55555555, + 0xaaaaaaab, + 0x55555555, + 0x5555aaab, + 0x5555aaab, + 0xaab556ab, + 0x556aad55, + 0x55ab55ab, + 0x55ab55ab, + 0xab5ab56b, + 0x56ad5ad5, + 0x56b5ad6b, + 0x56b5ad6b, + 0xad6d6b5b, + 0x5ad6b6b6, + 0x5b5b5b5b, + 0x5b5b5b5b, + 0x5F6db6db, + 0x5F6db6db, + 0xF776F776, + 0xF776F776, + 0xFBDEFBDE, + 0xFBDEFBDE, + 0x7eFFBFF7, + 0x7eFFBFF7, + 0xFF7FF7F7, + 0xFF7FF7F7, + 0xFF7FFF7F, + 0xFF7FFF7F, + 0xFFF7FFFF, + 0xFFF7FFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + }; + + unsigned char i; + unsigned short index; + unsigned long data; + + Dorado9211WriteReg(CS92xx_FRM_MEMORY_INDEX, 0); + index = CS92xx_FRM_MEMORY_DATA; + for (i = 0; i < 64; i += 2) { + data = DoradoFRMtable[i]; + Dorado9211WriteReg(index, data); + data = DoradoFRMtable[i + 1]; + Dorado9211WriteReg(index, data); + } + +/* + * The first FRM location (64 bits) does not program correctly. + * This location always reads back with the last value programmed. + * ie. If 32 64-bit values are programmed, location 0 reads back as the 32nd + * If 30 locations are programmed, location 0 reads back as the 30th, etc. + * Fix this by re-writing location 0 after programming all 64 in the writeFRM + * loop in RevCFrmload() in CS9211. + */ + + Dorado9211WriteReg(CS92xx_FRM_MEMORY_INDEX, 0); + Dorado9211WriteReg(CS92xx_FRM_MEMORY_DATA, 0); + Dorado9211WriteReg(CS92xx_FRM_MEMORY_DATA, 0); + +} + +/****************************************************************************** + * void Dorado_Enable_Power((void); + * Enables the power of the CX9211 on Dorado board. + ****************************************************************************** + */ + +void +Dorado_Power_Up(void) +{ + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x01000000); + return; + +} /* disable_Centaurus_Power */ + +/****************************************************************************** + * void Dorado_Disable_Power((void); + * Disables the power of the CX9211 on Dorado board. + ***************************************************************************** + */ + +void +Dorado_Power_Down(void) +{ + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x0); + return; + +} /* disable_Centaurus_Power */ + +void +Dorado_Save_Panel_State(void) +{ + + /* set 9211 registers using the desired panel settings */ + cs9211_regs.panel_timing1 = Dorado9211ReadReg(CS92xx_LCD_PAN_TIMING1); + cs9211_regs.panel_timing2 = Dorado9211ReadReg(CS92xx_LCD_PAN_TIMING2); + + cs9211_regs.dither_frc_ctrl = Dorado9211ReadReg(CS92xx_LCD_DITH_FR_CNTRL); + cs9211_regs.blue_lsfr_seed = Dorado9211ReadReg(CS92xx_BLUE_LSFR_SEED); + cs9211_regs.red_green_lsfr_seed = + Dorado9211ReadReg(CS92xx_RED_GREEN_LSFR_SEED); + + /* CentaurusProgramFRMload(); */ + cs9211_regs.memory_control = Dorado9211ReadReg(CS92xx_LCD_MEM_CNTRL); + + /* Set the power register last. This will turn the panel on at the 9211. */ + cs9211_regs.power_management = Dorado9211ReadReg(CS92xx_LCD_PWR_MAN); + cs9211_regs.panel_state = cs9211_regs.power_management; +} + +void +Dorado_Restore_Panel_State(void) +{ + unsigned long off_data = 0; + + /* Before restoring the 9211 registers, power off the 9211. */ + + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, off_data); + + /* set 9211 registers using the desired panel settings */ + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING1, cs9211_regs.panel_timing1); + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING2, cs9211_regs.panel_timing2); + /* load the LSFR seeds */ + Dorado9211WriteReg(CS92xx_LCD_DITH_FR_CNTRL, cs9211_regs.dither_frc_ctrl); + Dorado9211WriteReg(CS92xx_BLUE_LSFR_SEED, cs9211_regs.blue_lsfr_seed); + Dorado9211WriteReg(CS92xx_RED_GREEN_LSFR_SEED, + cs9211_regs.red_green_lsfr_seed); + + Dorado9211WriteReg(CS92xx_LCD_MEM_CNTRL, cs9211_regs.memory_control); + /* Set the power register last. This will turn the panel on at the 9211. */ + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, cs9211_regs.power_management); +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.h:1.1 --- /dev/null Thu Feb 27 12:31:18 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.h Tue Dec 10 10:12:28 2002 @@ -0,0 +1,203 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/dora9211.h,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: dora9211.h $ + * $Revision: 12 $ + * + * File Contents: This header file defines the Durango routines and + * variables used to access the memory mapped regions. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Geode graphics driver for panel support + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "panel.h" +#include "92xx.h" + +#ifndef _DORA9211_h +#define _DORA9211_h + +/* 9211 Rev.C3 Dorado */ + +/* GPIO Pin Configuration Registers */ + +#define DRD_GEODE_GPPIN_SEL 0x20 /* GPIO Pin Configuration Select */ +#define DRD_GEODE_GPPIN_CFG 0x24 /* GPIO Pin Configuration Access */ +#define DRD_GEODE_GPPIN_RESET 0x28 /* GPIO Pin Reset */ + +#define DRD_GEODE_GPIO_BASE 0x6400 /* F0 GPIO, IO mapped */ +#define DRD_GEODE_GPDI0 0x04 /* GPIO Data In 0 */ +#define DRD_GEODE_GPDO0 0x00 /* GPIO Data Out 0 */ + +/* Data Ports in */ +#define DRD_CLOCKP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 +#define DRD_DATAINP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 +#define DRD_DATAOUTP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 +#define DRD_CSP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 + +/* Data Ports out */ +#define DRD_CLOCKP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 +#define DRD_DATAINP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 +#define DRD_DATAOUTP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 +#define DRD_CSP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 + +/* Pin MASKS */ +#define DRD_CLOCK9211 0x00000080 /*;gpio 7, clock output to 9211 */ +#define DRD_DATAIN9211 0x00040000 /*;gpio 18, data output to 9211 */ +#define DRD_DATAOUT9211 0x00000800 /*;gpio 11, data input from 9211 */ +#define DRD_CS9211 0x00000200 /*;gpio 9, chip select output to 9211 */ + +/* Gpio CFG values to select in */ +#define DRD_CLOCK9211CFG 0x00000007 /* ;gpio 7 */ +#define DRD_DATAIN9211CFG 0x00000012 /* ;gpio 18 */ +#define DRD_DATAOUT9211CFG 0x0000000B /* ;gpio 11 */ +#define DRD_CS9211CFG 0x00000009 /* ;gpio 9 */ + +#define DRD_LCDRESGPIO1 0x00 +#define DRD_LCDRESGPIO2 0x01 +#define DRD_LCDRESGPIO3 0x02 +#define DRD_LCDRESGPIO4 0x04 + +void Dorado9211SetCS(void); +void Dorado9211ClearCS(void); +void Dorado9211SetDataOut(void); +void Dorado9211ClearDataOut(void); +unsigned char Dorado9211ReadDataIn(void); +void Dorado9211ToggleClock(void); +void Dorado9211SetClock(void); +void Dorado9211ClearClock(void); +void Dorado9211GpioInit(void); +unsigned long Dorado9211ReadReg(unsigned short index); +void Dorado9211WriteReg(unsigned short index, unsigned long data); +void DoradoProgramFRMload(void); +void Dorado_Get_9211_Details(unsigned long flags, PPnl_PanelParams pParam); +void Dorado_Power_Up(void); +void Dorado_Power_Down(void); +void Dorado_Save_Panel_State(void); +void Dorado_Restore_Panel_State(void); +void Dorado9211Init(Pnl_PanelStat * pstat); + +#endif /* !_DORA9211_h */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.c:1.2 --- /dev/null Thu Feb 27 12:31:18 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.c Tue Jan 14 04:34:35 2003 @@ -0,0 +1,820 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.c,v 1.2 2003/01/14 09:34:35 alanh Exp $ */ +/* + * $Workfile: drac9210.c $ + * $Revision: 5 $ + * + * File Contents: This file contains the panel library files to the + * platforms with 9210, and 9211 support. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "drac9210.h" + +#define CS9210 0x40 /* Chip select pin */ + +/* 9210 on Draco */ +#define CLOCK9210 0x04 /* Clock pin */ +#define DATAIN9210 0x20 /* Data from 9210 */ +#define DATAOUT9210 0x80 /* Data to 9210 */ + +static void DracoWriteData(unsigned char data); +static void DracoReadData(unsigned char *data); +static void Draco9210GpioInit(); +static void Draco9210SetCS(void); +static unsigned char Draco9210ReadReg(unsigned char index); +static void Draco9210WriteReg(unsigned char index, unsigned char data); +static void Draco9210ClearCS(void); +static void Draco9210SetDataOut(void); +static void Draco9210ClearDataOut(void); +static unsigned char Draco9210ReadDataIn(void); +static void Draco9210ToggleClock(void); + +void +Draco9210Init(Pnl_PanelStat * pstat) +{ + unsigned char panelvalues[] = { + 0x2, 0x80, + 0x2, 0x24, + 0x03, 0x00, + 0xc0, 0x00, + 0xc1, 0x00, + 0xc2, 0x00, + 0xc3, 0x00, + 0xc4, 0x00, + 0xc5, 0x01, + 0xc6, 0xff, + 0xc7, 0xff, + 0xc8, 0x3, + 0xc9, 0xfe, + 0xca, 0x0, + 0xcb, 0x3f, + 0xcc, 0xc, + 0xcd, 0x1, + 0xce, 0xff, + 0xcf, 0xc1, + 0xd0, 0x0, + 0xd1, 0x7e, + 0xd2, 0x3, + 0xd3, 0xfe, + 0xd4, 0x3, + 0xd5, 0x81, + 0xd6, 0xfc, + 0xd7, 0x3f, + 0xd8, 0x14, + 0xd9, 0x1e, + 0xda, 0x0f, + 0xdb, 0xc7, + 0xdc, 0x29, + 0xdd, 0xe1, + 0xde, 0xf1, + 0xdf, 0xf9, + 0xe0, 0x2, + 0xe1, 0xe, + 0xe2, 0x1e, + 0xe3, 0x3e, + 0xe4, 0x04, + 0xe5, 0x71, + 0xe6, 0xe3, + 0xe7, 0xcf, + 0xe8, 0x1, + 0xe9, 0x86, + 0xea, 0x3c, + 0xeb, 0xf3, + 0xec, 0xa, + 0xed, 0x39, + 0xee, 0xc7, + 0xef, 0x3d, + + 0xf0, 0x14, + 0xf1, 0xc6, + 0xf2, 0x39, + 0xf3, 0xce, + 0xf4, 0x3, + 0xf5, 0x19, + 0xf6, 0xce, + 0xf7, 0x77, + 0xf8, 0x0, + 0xf9, 0x66, + 0xfa, 0x33, + 0xfb, 0xbb, + 0xfc, 0x2d, + 0xfd, 0x99, + 0xfe, 0xdd, + 0xff, 0xdd, + + 0x3, 0x1, + 0xc0, 0x2, + 0xc1, 0x22, + 0xc2, 0x66, + 0xc3, 0x66, + 0xc4, 0x0, + 0xc5, 0xcd, + 0xc6, 0x99, + 0xc7, 0xbb, + 0xc8, 0x5, + 0xc9, 0x32, + 0xca, 0x66, + 0xcb, 0xdd, + 0xcc, 0x1a, + 0xcd, 0x4d, + 0xce, 0x9b, + 0xcf, 0x6f, + 0xd0, 0x0, + 0xd1, 0x92, + 0xd2, 0x6d, + 0xd3, 0xb6, + 0xd4, 0x5, + 0xd5, 0x25, + 0xd6, 0xb6, + 0xd7, 0xdb, + 0xd8, 0x2, + 0xd9, 0x5a, + 0xda, 0x4b, + 0xdb, 0x6d, + 0xdc, 0x29, + 0xdd, 0xa5, + 0xde, 0xb5, + 0xdf, 0xb7, + 0xe0, 0x4, + 0xe1, 0x4a, + 0xe2, 0x5a, + 0xe3, 0xda, + 0xe4, 0x12, + 0xe5, 0x95, + 0xe6, 0xad, + 0xe7, 0x6f, + 0xe8, 0x1, + 0xe9, 0x2a, + 0xea, 0x56, + 0xeb, 0xb5, + 0xec, 0xe, + 0xed, 0x55, + 0xee, 0xab, + 0xef, 0x5f, + 0xf0, 0x0, + 0xf1, 0xaa, + 0xf2, 0x55, + 0xf3, 0xea, + 0xf4, 0x1, + 0xf5, 0x55, + 0xf6, 0xaa, + 0xf7, 0xbf, + 0xf8, 0x6, + 0xf9, 0xaa, + 0xfa, 0x55, + 0xfb, 0x55, + 0xfc, 0x39, + 0xfd, 0x55, + 0xfe, 0xff, + 0xff, 0xff, + + 0x3, 0x2, + 0xc0, 0x0, + 0xc1, 0x0, + 0xc2, 0xaa, + 0xc3, 0xaa, + 0xc4, 0x6, + 0xc5, 0xab, + 0xc6, 0x55, + 0xc7, 0x55, + 0xc8, 0x01, + 0xc9, 0x54, + 0xca, 0xaa, + 0xcb, 0xbf, + 0xcc, 0x8, + 0xcd, 0xab, + 0xce, 0x55, + 0xcf, 0xeb, + 0xd0, 0x6, + 0xd1, 0x54, + 0xd2, 0xab, + 0xd3, 0x5e, + 0xd4, 0x1, + 0xd5, 0x2b, + 0xd6, 0x56, + 0xd7, 0xb5, + 0xd8, 0x12, + 0xd9, 0x94, + 0xda, 0xad, + 0xdb, 0x6f, + 0xdc, 0x2d, + 0xdd, 0x4b, + 0xde, 0x5b, + 0xdf, 0xdb, + 0xe0, 0x0, + 0xe1, 0xa4, + 0xe2, 0xb4, + 0xe3, 0xb6, + 0xe4, 0x2, + 0xe5, 0x5b, + 0xe6, 0x4b, + 0xe7, 0x6d, + 0xe8, 0x5, + 0xe9, 0x24, + 0xea, 0xb6, + 0xeb, 0xdb, + 0xec, 0x8, + 0xed, 0x93, + 0xee, 0x6d, + 0xef, 0xb7, + 0xf0, 0x12, + 0xf1, 0x4c, + 0xf2, 0x9b, + 0xf3, 0x6e, + 0xf4, 0x5, + 0xf5, 0x33, + 0xf6, 0x66, + 0xf7, 0xdd, + 0xf8, 0x0, + 0xf9, 0xcc, + 0xfa, 0x99, + 0xfb, 0xbb, + 0xfc, 0x2b, + 0xfd, 0x33, + 0xfe, 0x77, + 0xff, 0x77, + + 0x3, 0x3, + 0xc0, 0x4, + 0xc1, 0x88, + 0xc2, 0xcc, + 0xc3, 0xcc, + 0xc4, 0x0, + 0xc5, 0x67, + 0xc6, 0x33, + 0xc7, 0xbb, + 0xc8, 0x3, + 0xc9, 0x18, + 0xca, 0xce, + 0xcb, 0x77, + 0xcc, 0x1c, + 0xcd, 0xc7, + 0xce, 0x39, + 0xcf, 0xcf, + + 0xd0, 0x2, + 0xd1, 0x38, + 0xd2, 0xc7, + 0xd3, 0x3c, + 0xd4, 0x1, + 0xd5, 0x87, + 0xd6, 0x3c, + 0xd7, 0xf3, + 0xd8, 0x4, + 0xd9, 0x70, + 0xda, 0xe3, + 0xdb, 0xcf, + 0xdc, 0x2b, + 0xdd, 0xf, + 0xde, 0x1f, + 0xdf, 0x3f, + 0xe0, 0x00, + 0xe1, 0xe0, + 0xe2, 0xf0, + 0xe3, 0xf8, + 0xe4, 0x14, + 0xe5, 0x1f, + 0xe6, 0xf, + 0xe7, 0xc7, + 0xe8, 0x3, + 0xe9, 0x80, + 0xea, 0xfc, + 0xeb, 0x3f, + 0xec, 0x8, + 0xed, 0x7f, + 0xee, 0x3, + 0xef, 0xff, + 0xf0, 0x4, + 0xf1, 0x0, + 0xf2, 0xff, + 0xf3, 0xc0, + 0xf4, 0x3, + 0xf5, 0xff, + 0xf6, 0x0, + 0xf7, 0x3f, + 0xf8, 0x0, + 0xf9, 0x0, + 0xfa, 0xff, + 0xfb, 0xff, + 0xfc, 0x3f, + 0xfd, 0xff, + 0xfe, 0xff, + 0xff, 0xff, + 0x3, 0x4, + + /* Setup the Diter to Pattern33 */ + 0x80, 0xdd, + 0x81, 0xdd, + 0x82, 0x33, + 0x83, 0x33, + 0x84, 0xdd, + 0x85, 0xdd, + 0x86, 0x33, + 0x87, 0x33, + 0x88, 0x33, + 0x89, 0x33, + 0x8a, 0x77, + 0x8b, 0x77, + 0x8c, 0x33, + 0x8d, 0x33, + 0x8e, 0x77, + 0x8f, 0x77, + 0x90, 0xdd, + 0x91, 0xdd, + 0x92, 0x33, + 0x93, 0x33, + 0x94, 0xdd, + 0x95, 0xdd, + 0x96, 0x33, + 0x97, 0x33, + 0x98, 0x33, + 0x99, 0x33, + 0x9a, 0x77, + 0x9b, 0x77, + 0x9c, 0x33, + 0x9d, 0x33, + 0x9e, 0x77, + 0x9f, 0x77, + + 0x4, 0x20, + 0x5, 0x3, + 0x6, 0x56, + 0x7, 0x2, + 0x8, 0x1c, + 0x9, 0x0, + 0xa, 0x26, + 0xb, 0x0, + 0xc, 0x15, + 0xd, 0x4, + 0xe, 0x50, + 0xf, 0x4, + 0x10, 0xfa, + 0x11, 0x0, + 0x12, 0xc8, + 0x13, 0x0, + 0x14, 0x31, + 0x15, 0x23, + 0x16, 0x0, + + /* Enable DSTN panel */ + 0x2, 0x64 + }; + unsigned char index, data; + int i; + + gfx_delay_milliseconds(100); + Draco9210GpioInit(); + Draco9210SetCS(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + Draco9210ClearCS(); + +#if defined(_WIN32) /* For Windows */ + for (i = 0; i < 10; i++) { + _asm { + out 0EDh, al} + } + +#elif defined(linux) /* Linux */ + +#endif + + for (i = 0; i < 630; i += 2) { + index = panelvalues[i]; + data = panelvalues[i + 1]; + Draco9210WriteReg(index, data); + } + +} + +static void +DracoWriteData(unsigned char data) +{ + int i; + unsigned char mask = 0x80, databit; + + for (i = 0; i < 8; i++) { + + databit = data & mask; + if (data & mask) { + Draco9210SetDataOut(); + } else { + Draco9210ClearDataOut(); + } + mask >>= 1; + Draco9210ToggleClock(); + } +} + +static void +DracoReadData(unsigned char *data) +{ + int i; + unsigned char tmp = 0, readbit; + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + for (i = 0; i < 7; i++) { + readbit = Draco9210ReadDataIn(); + tmp |= (readbit & 0x1); + tmp <<= 1; + Draco9210ToggleClock(); + } + readbit = Draco9210ReadDataIn(); + tmp |= (readbit & 0x1); + *data = tmp; +} + +#if defined(_WIN32) /* For Windows */ + +void +Draco9210GpioInit() +{ + _asm { + pushf + cli + mov dx, 0CF8h + mov eax, CX55x0_ID + 090h + out dx, eax + mov dx, 0CFCh + mov al, 0CFh + mov ah, 00h + out dx, ax + popf + } +} + +void +Draco9210SetCS() +{ + _asm { + pushf + ;Point to PCI address register + mov dx, 0CF8h + ;55 XX GPIO data register + mov eax, CX55x0_ID + 090h + out dx, eax + ;Point to PCI data register (CFCh) + mov dx, 0CFCh + + in ax, dx + and ah, 30h + mov ah, c92DataReg + or ah, CS9210 + mov c92DataReg, ah + out dx, ax + popf + } +} + +void +Draco9210ClearCS() +{ + _asm { + pushf + ;Point to PCI address register + mov dx, 0CF8h + ;55 XX GPIO data register + mov eax, CX55x0_ID + 090h + out dx, eax + ;Point to PCI data register (CFCh) + mov dx, 0CFCh + ;Set CS LOW + in ax, dx + mov ah, c92DataReg + and ah, NOT CS9210 + mov c92DataReg, ah + out dx, ax + popf + } +} + +void +Draco9210SetDataOut() +{ + _asm { + pushf + ;Point to PCI address register + mov dx, 0CF8h + ;55 XX GPIO data register + mov eax, CX55x0_ID + 090h + out dx, eax + ;Point to PCI data register (CFCh) + mov dx, 0CFCh + ;Set DATA HIGH + in ax, dx + mov ah, c92DataReg + or ah, DATAOUT9210 + mov c92DataReg, ah + out dx, ax + popf + } +} + +void +Draco9210ClearDataOut() +{ + _asm { + pushf + ;Point to PCI address register + mov dx, 0CF8h + mov eax, CX55x0_ID + 090h; + ;55 XX GPIO data register + out dx, eax + ;Point to PCI data register (CFCh) + mov dx, 0CFCh + ;Set Data LOW + in ax, dx + mov ah, c92DataReg + and ah, NOT DATAOUT9210 + mov c92DataReg, ah + out dx, ax + popf + } +} + +unsigned char +Draco9210ReadDataIn() +{ + unsigned char readdata; + + _asm { + pushf + ;Point to PCI address register + mov dx, 0CF8h + ;55 XX GPIO data register + mov eax, CX55x0_ID + 090h + out dx, eax + ;Point to PCI data register (CFCh) + mov dx, 0FCh + + in ax, dx + ;Preserve just Data IN bit + and ah, DATAIN9210 + mov al, ah + cmp al, 0 + ;Is it LOW ? + je readDataLow + ;must be HIGH + mov al, 1 + readDataLow: + mov readdata, al + popf + } + return (readdata); +} + +void +Draco9210ToggleClock() +{ + _asm { + pushf + ;Point to PCI address register + mov dx, 0CF8h + ;55 XX GPIO data register + mov eax, CX55x0_ID + 090h + ;Point to PCI data register (CFCh) + out dx, eax + mov dx, 0CFCh + ;SET CLOCK + in ax, dx + mov ah, c92DataReg + or ah, CLOCK9210 + mov c92DataReg, ah + out dx, ax + out 0EDh, al /* IOPAUSE */ + ;Point to PCI address register + mov dx, 0CF8h + ;55 XX GPIO data register + mov eax, CX55x0_ID + 090h + out dx, eax + ;Point to PCI data register (CFCh) + mov dx, 0CFCh; + ;CLEAR CLOCK + in ax, dx + mov ah, c92DataReg + and ah, NOT CLOCK9210 + mov c92DataReg, ah + out dx, ax + popf + } +} + +#elif defined(linux) /* Linux */ + +void +Draco9210GpioInit() +{ +} +void +Draco9210SetCS() +{ +} +void +Draco9210ClearCS() +{ +} +void +Draco9210SetDataOut() +{ +} +void +Draco9210ClearDataOut() +{ +} +unsigned char +Draco9210ReadDataIn() +{ +} +void +Draco9210ToggleClock() +{ +} + +#endif + +unsigned char +Draco9210ReadReg(unsigned char index) +{ + unsigned char data; + + Draco9210SetCS(); + Draco9210ToggleClock(); + Draco9210SetDataOut(); + Draco9210ToggleClock(); + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + DracoWriteData(index); + DracoReadData(&data); + + return (data); +} + +void +Draco9210WriteReg(unsigned char index, unsigned char data) +{ + + Draco9210SetCS(); + Draco9210ToggleClock(); + + Draco9210SetDataOut(); + Draco9210ToggleClock(); + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + Draco9210SetDataOut(); + Draco9210ToggleClock(); + + DracoWriteData(index); + DracoWriteData(data); + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + Draco9210ClearCS(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.h:1.1 --- /dev/null Thu Feb 27 12:31:19 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.h Tue Dec 10 10:12:28 2002 @@ -0,0 +1,274 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/drac9210.h,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: drac9210.h $ + * $Revision: 5 $ + * + * File Contents: This file contains the panel header file and definition + * for the platform with 9210 support. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Geode graphics driver for panel support + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "panel.h" + +#ifndef _DRAC9210_h +#define _DRAC9210_h +#define CX55x0_ID 0x80009000 +static unsigned char c92DataReg = 0; +#endif /* !_DRAC9210_h */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.c:1.3 --- /dev/null Thu Feb 27 12:31:19 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.c Tue Jan 14 04:34:35 2003 @@ -0,0 +1,382 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.c,v 1.3 2003/01/14 09:34:35 alanh Exp $ */ +/* + * $Workfile: gx2_9211.c $ + * + * This header file defines the pneumonics used when calling Durango routines. + * This file is automatically included by gfx_rtns.h + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "92xx.h" +#include "gx2_9211.h" +#include "pnl_defs.h" + +#if defined(_WIN32) /*windows */ +#include "gfx_defs.h" + +extern DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +extern DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +#endif + +static unsigned long FPBaseAddr; + +void +SetFPBaseAddr(unsigned long addr) +{ + + FPBaseAddr = addr; +} + +/**************************************************************************** + * protected_mode_access( unsigned long mode, unsigned long width, + * unsigned long addr, unsigned char* pdata ) + * This function provides access to physical memory at the requested address. + * mode is: + * GX2_READ or GX2_WRITE (accesses a single byte, word or double + * word depending on the value of "width". Only 1, 2 or 4 supported). + * READ_BYTES, WRITE_BYTES accesses "width" number of bytes (8 bits) + * READ_WORDS, WRITE_WORDS accesses "width" number of words (16 bits) + * READ_DWORDS, WRITE_DWORDS accesses "width" number of dwords (32 bits) + * width is: The size of the access. For READ or WRITE, only 1, 2 and 4 are + * supported. For other modes, width is not limited but will cause + * paging if the block traverses page boundaries. + * addr is: The physical address being accessed + * pdata is: A pointer to the data to be read or written into. + * NOTE! WORD or DWORD accesses can only be made on WORD or DWORD boundaries! + ****************************************************************************/ +void +protected_mode_access(unsigned long mode, + unsigned long width, unsigned long addr, char *pdata) +{ + void *ptr = (void *)(FPBaseAddr + addr); + + /* type specific buffer pointers */ + char *byte_data = (char *)pdata; + unsigned long *word_data = (unsigned long *)pdata; + unsigned long *dword_data = (unsigned long *)pdata; + + if (mode == GX2_READ) { + switch (width) { + case FOUR_BYTES: + *(dword_data) = (unsigned long)(*(unsigned long *)ptr); + break; + case TWO_BYTES: + *(word_data) = (unsigned long)(*(unsigned long *)ptr); + break; + default: + *(byte_data) = (char)(*(char *)ptr); + break; + } + } /* end GX2_READ */ + else if (mode == GX2_WRITE) { + switch (width) { + case FOUR_BYTES: + *(unsigned long *)ptr = *dword_data; + break; + case TWO_BYTES: + *(unsigned long *)ptr = *word_data; + break; + default: + *(char *)ptr = *byte_data; + break; + } /* end switch(mode) */ + } + /* end case GX2_WRITE */ + return; + +} /* End of protected_mode_access. */ + +/************************************************************************* + * void write_video_reg64_low( unsigned long offset, unsigned long value ) + * Writes value to the low 32 bits of the 64 bit memory mapped video + * register indicated by offset. + * This function uses Sys_info.video_reg_base as the base address, so + * the value of offset should be with respect to this base. + *************************************************************************/ +void +write_video_reg64_low(unsigned long offset, unsigned long value) +{ + protected_mode_access(GX2_WRITE, FOUR_BYTES, + FPBaseAddr + offset, (char *)&value); +} /*end write_video_reg64_low() */ + +/************************************************************************* + * unsigned long read_video_reg64_low( unsigned long offset ) + * Returns the contents of the low 32 bits of the 64 bit memory mapped + * video register indicated by offset. + * This function uses Sys_info.video_reg_base as the base address, so + * the value of offset should be with respect to this base. + *************************************************************************/ +unsigned long +read_video_reg64_low(unsigned long offset) +{ + unsigned long data; + + protected_mode_access(GX2_READ, FOUR_BYTES, + FPBaseAddr + offset, (char *)&data); + return (data); +} /*end read_video_reg64_low() */ + +/******************************************************************************* + * void Redcloud_fp_reg( int mode, unsigned long address, unsigned long *data ) + * + * Writes and reads dwords to the Redcloud flat panel registers in the Redcloud + * Display Filter. There's no clock control, chip select or timing to deal with. + * This routine expects the actual GX2 macro definitions for the address. + * + * Parameters: + * mode: An integer value for a GX2_READ or GX2_WRITE operation + * 0 = GX2_Read and 1 = GX2_Write + * address: A dword value representing the offset of the register. + * data: A pointer to a dword value that is to be written in to + * the required register. In case of a Read operation this + * will point to the result of the Read operation. + * + *******************************************************************************/ +void +Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data) +{ + if (mode == GX2_READ) { + *data = read_video_reg64_low(address); + } else { + write_video_reg64_low(address, *data); + } + +} /* End of Redcloud_fp_reg() */ + +/*------------------------------------------------------------------- + * + * SET_92XX_MODE_PARAMS + * This routine sets the 9211 mode parameters. + * + *-------------------------------------------------------------------*/ + +void +set_Redcloud_92xx_mode_params(int mode) +{ + CS92xx_MODE *pMode = &FPModeParams[mode]; + unsigned long temp_data = 0; + unsigned long base_data; + Q_WORD msrValue; + + /* on a Redcloud, we need to set up the DF pad select MSR */ + if (gfx_msr_read(RC_ID_DF, GX2_VP_MSR_PAD_SELECT, &msrValue) == FOUND) { + msrValue.low &= ~GX2_VP_PAD_SELECT_MASK; + if (pMode->panel_type == PNL_TFT || pMode->panel_type == PNL_TWOP) { + msrValue.low = GX2_VP_PAD_SELECT_TFT; + } else { + msrValue.low = GX2_VP_PAD_SELECT_DSTN; + } + gfx_msr_write(RC_ID_DF, GX2_VP_MSR_PAD_SELECT, &msrValue); + } + + /* Turn the 92xx power off before setting any new parameters. */ + temp_data = pMode->power_management & ~GX2_FP_PM_PWR_ON; + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, (unsigned long *)&temp_data); + + /* Set 9211 registers using the desired panel settings */ + + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PAN_TIMING1, + (unsigned long *)&pMode->panel_timing1); + + /* On Redcloud, bit 31 is now reserved. */ + temp_data = pMode->panel_timing2 & 0x7FFFFFFF; + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PAN_TIMING2, + (unsigned long *)&temp_data); + + /* On Redcloud TFT parts, set this to 0x70 so all 8 bits per color run + * thru fp crc but only non-TFT parts. Otherwise, set it to be 0x50. + * (source: Larry G.). + */ + if (pMode->panel_type == PNL_TFT || pMode->panel_type == PNL_TWOP) { + temp_data = GX2_FP_CRC_PASS_THRU_MASK; + } else { + temp_data = pMode->rev_C_dither_frc; + } + Redcloud_fp_reg(GX2_WRITE, GX2_FP_DITH_FR_CNTRL, + (unsigned long *)&temp_data); + Redcloud_fp_reg(GX2_WRITE, GX2_FP_BLFSR, + (unsigned long *)&pMode->blue_lsfr_seed); + Redcloud_fp_reg(GX2_WRITE, GX2_FP_RLFSR, + (unsigned long *)&pMode->red_green_lsfr_seed); + + /* Set the memory information, then the power register last. + * This will turn the panel on at the 9211. + */ + + Redcloud_fp_reg(GX2_READ, GX2_FP_FBB, (unsigned long *)&base_data); + if (base_data != 0x41780000) { + base_data = 0x41780000; + Redcloud_fp_reg(GX2_WRITE, GX2_FP_FBB, (unsigned long *)&base_data); + } + + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, + (unsigned long *)&pMode->power_management); + +} /*end set_92xx_mode_params() */ + +/* ----------------------------------------------------------------------- + * + * SET_FLAT_PANEL_MODE + * + * This routine sets the specified flat panel moden parameters in + * the 9211. + * Returns PASS if successful, FAIL if the mode parameters could + * not be set. + * + *------------------------------------------------------------------------*/ + +unsigned char +set_Redcloud_92xx_mode(Pnl_PanelStat * pstat) +{ + int mode; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_92XX_MODES; mode++) { + if ((FPModeParams[mode].xres == pstat->XRes) && + (FPModeParams[mode].yres == pstat->YRes) && + (FPModeParams[mode].bpp == pstat->Depth) && + (FPModeParams[mode].panel_type == pstat->Type) && + (FPModeParams[mode].color_type == pstat->MonoColor)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + set_Redcloud_92xx_mode_params(mode); + return TRUE; + } /* end if() */ + } /* end for() */ + return FALSE; + +} /* end set_Centaurus_92xx_mode() */ + +void +Redcloud_9211init(Pnl_PanelStat * pstat) +{ + + set_Redcloud_92xx_mode(pstat); + +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.h:1.3 --- /dev/null Thu Feb 27 12:31:19 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.h Tue Jan 14 04:34:35 2003 @@ -0,0 +1,207 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/gx2_9211.h,v 1.3 2003/01/14 09:34:35 alanh Exp $ */ +/* + * $Workfile: gx2_9211.h $ + * + * This header file defines the pneumonics used when calling Durango routines. + * This file is automatically included by gfx_rtns.h + * + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for Durango + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for Durango + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* ----------------------------------------------------------- + * GX2 FLAT PANEL CONTROLLER REGISTER DEFINITIONS + *----------------------------------------------------------- + */ + +#define GX2_VP_MSR_PAD_SELECT 0x2011 +#define GX2_VP_PAD_SELECT_MASK 0x3FFFFFFF +#define GX2_VP_PAD_SELECT_TFT 0x1FFFFFFF +#define GX2_VP_PAD_SELECT_DSTN 0x00000000 + +/* This is useful for generating addresses incrementally + * (ie, vidtest register display code). + */ + +#define GX2_FP_LCD_OFFSET 0x00000400 +#define CS9211_REDCLOUD 0x0400 /* Moved 9211 Rev C3 up to next major no. */ + +#define GX2_FP_PAN_TIMING1 0x0400 /* FP timings 1 */ +#define GX2_FP_PAN_TIMING2 0x0408 /* FP timings 2 */ +#define GX2_FP_PWR_MAN 0x0410 /* FP power management */ +#define GX2_FP_DITH_FR_CNTRL 0x0418 /* FP dither and frame rate */ +#define GX2_FP_BLFSR 0x0420 /* Blue LFSR seed */ +#define GX2_FP_RLFSR 0x0428 /* Red and Green LFSR seed */ +#define GX2_FP_FMI 0x0430 /* FRM Memory Index */ +#define GX2_FP_FMD 0x0438 /* FRM Memory Data */ +#define GX2_FP_DCA 0x0448 /* Dither ram control and address */ +#define GX2_FP_DMD 0x0450 /* Dither memory data */ +#define GX2_FP_PAN_CRC_SIG 0x0458 /* FP CRC signature */ +#define GX2_FP_FBB 0x0460 /* Frame Buffer Base Address */ + +/* GX2_FP_PAN_TIMING2 bits */ + +#define GX2_FP_TFT_PASS_THRU 0x40000000 /* TFT pass through enable */ +#define GX2_FP_PT2_PIX_OUT_MASK 0xFFF8FFFF /* panel output bit formats */ +#define GX2_FP_PT2_PIX_OUT_TFT 0x00000000 /* 8 BIT DSTN or TFT panel */ +#define GX2_FP_PT2_COLOR_MONO 0x00080000 /* color or monochrome */ +#define GX2_FP_PT2_DSTN_TFT_MASK 0xFFCFFFFF /* panel type bits */ +#define GX2_FP_PT2_DSTN_TFT_TFT 0x00100000 /* TFT panel */ +#define GX2_FP_PT2_PSH_CLK_CTL 0x08000000 /* shift clock retrace activity control */ + +/* GX2_FP_PWR_MAN bits */ + +#define GX2_FP_PM_SHFCLK_INVERT 0x00002000 /* Invert shfclk to panel */ +#define GX2_FP_PM_VSYNC_DELAY 0x0000C000 /* Vert Sync delay */ +#define GX2_FP_PM_HSYNC_DELAY 0x00030000 /* Horiz Sync delay */ +#define GX2_FP_PM_PWRDN_PHASE_BIT0 0x00040000 /* panel power down phase bit 0 */ +#define GX2_FP_PM_PWRDN_PHASE_BIT1 0x00080000 /* panel power down phase bit 1 */ +#define GX2_FP_PM_PWRDN_PHASE_BIT2 0x00100000 /* panel power down phase bit 2 */ +#define GX2_FP_PM_PWRUP_PHASE_BIT0 0x00200000 /* panel power up phase bit 0 */ +#define GX2_FP_PM_PWRUP_PHASE_BIT1 0x00400000 /* panel power up phase bit 1 */ +#define GX2_FP_PM_PWRUP_PHASE_BIT2 0x00800000 /* panel power up phase bit 2 */ +#define GX2_FP_PM_PWR_ON 0x01000000 /* panel power ON */ +#define GX2_FP_PM_DIS_OFF_CTL 0x02000000 /* disable the panel back light */ +#define GX2_FP_PM_EXT_PWR_SEQ 0x08000000 /* external power sequence */ + +/* GX2_FP_PAN_CRC_SIG bits */ + +#define GX2_FP_PAN_CRC_SIGE 0x00000001 /* CRC Sig Enable */ +#define GX2_FP_PAN_CRC_SFR 0x00000002 /* CRC Sig Free Run */ + +/* This define is used by the hardware CRC mechanism */ +#define GX2_FP_CRC_PASS_THRU_MASK 0x00000070 + +#define GX2_READ 0 +#define GX2_WRITE 1 + +void SetFPBaseAddr(unsigned long); +void Redcloud_9211init(Pnl_PanelStat *); +void protected_mode_access(unsigned long mode, + unsigned long width, + unsigned long addr, char *pdata); +void write_video_reg64_low(unsigned long offset, unsigned long value); +unsigned long read_video_reg64_low(unsigned long offset); +void Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data); +void set_Redcloud_92xx_mode_params(int mode); +unsigned char set_Redcloud_92xx_mode(Pnl_PanelStat * pstat); Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.c:1.3 --- /dev/null Thu Feb 27 12:31:19 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.c Tue Jan 14 04:34:35 2003 @@ -0,0 +1,179 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.c,v 1.3 2003/01/14 09:34:35 alanh Exp $ */ +/* + * $Workfile: panel.c $ + * $Revision: 19 $ + * + * File Contents: This file contains the file inclusions, macro definitions + * for the panel. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#if defined(linux) /* Linux */ + +#ifdef __KERNEL__ + +#include <linux/string.h> +#include <asm/io.h> + +#elif !defined(XFree86Server) + +#include <linux/fs.h> +#include <asm/mman.h> + +#endif /* __KERNEL__ */ +#elif defined(_WIN32) /* windows */ + +#include <windows.h> + +#endif + +#include "panel.h" +#include "gfx_defs.h" + +extern unsigned char *gfx_virt_regptr; +extern unsigned char *gfx_virt_fbptr; +extern unsigned char *gfx_virt_vidptr; +extern unsigned char *gfx_virt_vipptr; +extern unsigned long gfx_detect_video(void); + +#define PLATFORM_DYNAMIC 1 /* runtime selection */ +#define PLATFORM_DRACO 1 /* Draco + 9210 */ +#define PLATFORM_CENTAURUS 1 /* Centaurus + 9211 RevA */ +#define PLATFORM_DORADO 1 /* Dorado + 9211 RevC */ +#define PLATFORM_REDCLOUD 1 /* GX2 */ + +unsigned char *XpressROMPtr; + +#include "pnl_init.c" +#include "pnl_bios.c" Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.h:1.3 --- /dev/null Thu Feb 27 12:31:19 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.h Tue Jan 14 04:34:36 2003 @@ -0,0 +1,190 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/panel.h,v 1.3 2003/01/14 09:34:36 alanh Exp $ */ +/* + * $Workfile: panel.h $ + * $Revision: 17 $ + * + * File Contents: This file contains the Geode frame buffer panel + * functions prototypes and it includes panel + * definitions header file. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +/* COMPILER OPTION FOR C++ PROGRAMS */ + +#ifndef _panel_h +#define _panel_h + +#include "pnl_defs.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* CLOSE BRACKET FOR C++ COMPLILATION */ + + void Pnl_SetPlatform(int platform); + int Pnl_GetPlatform(void); + int Pnl_IsPanelPresent(void); + void Pnl_SetPanelPresent(int present); + void Pnl_SetPanelChip(int panelChip); + int Pnl_GetPanelChip(void); + void Pnl_SetPanelParam(PPnl_PanelParams pParam); + void Pnl_GetPanelParam(PPnl_PanelParams pParam); + int Pnl_InitPanel(PPnl_PanelParams pParam); + int Detect_Platform(void); + void Pnl_SavePanelState(void); + void Pnl_RestorePanelState(void); + void Pnl_PowerUp(void); + void Pnl_PowerDown(void); + + int Pnl_IsPanelEnabledInBIOS(void); + void Pnl_GetPanelInfoFromBIOS(int *xres, int *yres, int *bpp, int *hz); +/* from durango */ + +#if defined(_WIN32) /* windows */ + extern void gfx_delay_milliseconds(unsigned long milliseconds); + extern unsigned long gfx_ind(unsigned short port); + extern void gfx_outd(unsigned short port, unsigned long data); + extern unsigned char gfx_inb(unsigned short port); + extern void gfx_outb(unsigned short port, unsigned char data); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !_panel_h */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/platform.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/platform.c:1.3 --- /dev/null Thu Feb 27 12:31:19 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/platform.c Tue Jan 14 04:34:36 2003 @@ -0,0 +1,726 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/platform.c,v 1.3 2003/01/14 09:34:36 alanh Exp $ */ +/* + * $Workfile: platform.c $ + * $Revision: 15 $ + * + * File Contents: This file contains platform dependent functions + * which provide interface to that platform. + * + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#define LINUX_ROM_SEGMENT 0x000F +#define SEGMENT_LENGTH 0xFFFF +#define PAGE_LENGTH 0x1000 +#define SYS_BOARD_NAME_LEN 24 + +#define PLT_READ 0 +#define PLT_WRITE 1 +#define PLT_WRITE_BYTES 2 +#define PLT_READ_BYTES 3 +#define PLT_WRITE_WORDS 4 +#define PLT_READ_WORDS 5 +#define PLT_WRITE_DWORDS 6 +#define PLT_READ_DWORDS 7 +#define PLT_UNKNOWN 0xFFFF + +typedef struct +{ + char sys_board_name[SYS_BOARD_NAME_LEN]; + SYS_BOARD sys_board; +} +SYS_BOARD_INFO; + +static SYS_BOARD_INFO Sys_info; + +/* + * The names in the sys_board_name string must exactly match the names in the + * BIOS header. These names are used by FindStringInSeg() to find the names + * in the BIOS header space. The BIOS does not use OTHER; it is a dummy value + * for program useonly. + * + */ + +SYS_BOARD_INFO Sys_board_info_array[] = { + {"Marmot", MARMOT_PLATFORM}, + {"Unicorn", UNICORN_PLATFORM}, + {"Centaurus", CENTAURUS_PLATFORM}, + {"Aries", ARIES_PLATFORM}, + {"Carmel", CARMEL_PLATFORM}, + {"Hyrda", HYDRA_PLATFORM}, + {"Dorado", DORADO_PLATFORM}, + {"Redcloud", REDCLOUD_PLATFORM}, + {"Other", OTHER_PLATFORM} +}; + +#define NUM_SYS_BOARD_TYPES sizeof(Sys_board_info_array)/sizeof(SYS_BOARD_INFO) + +static int Num_sys_board_type = NUM_SYS_BOARD_TYPES; +SYS_BOARD_INFO *Sys_board_array_base = Sys_board_info_array; +int FindStringInSeg(unsigned int, char *); +static unsigned char get_sys_board_type(SYS_BOARD_INFO *, SYS_BOARD_INFO *); + +#if defined(linux) && !defined(__KERNEL__) +#if !defined(XFree86Server) +static void protected_mode_access(unsigned int, unsigned int, + unsigned long, unsigned char *); +static void setup_pma(); +static void close_pma(); +static int fd; +#endif /* IN_MODULE */ +#endif /* __KERNEL__ */ + +/* Detect the Platform */ +int +Detect_Platform(void) +{ +#if defined(linux) && !defined(__KERNEL__) +#if !defined(XFree86Server) + setup_pma(); +#endif /* IN_MODULE */ +#endif /* __KERNEL__ */ + + /* See if we can find the board name using Xpressrom */ + if (get_sys_board_type(&Sys_info, Sys_board_array_base) == TRUE) { +#if 0 + if (Sys_info.sys_board == CENTAURUS_PLATFORM) { + printk("CENTAURUS Platform Found\n"); + } else if (Sys_info.sys_board == DORADO_PLATFORM) { + printk("DORADO Platform Found \n"); + } else { + printk("UNKNOWN Platform Found \n"); + } +#endif + } +#if defined(linux) && !defined(__KERNEL__) +#if !defined(XFree86Server) + close_pma(); +#endif /* IN_MODULE */ +#endif /* __KERNEL__ */ + + return (Sys_info.sys_board); +} + +static int +Strncmp(char *str1, char *str2, int len) +{ + int i; + + if ((str1 == 0x0) || (str2 == 0x0) || (len == 0)) + return (1); + for (i = 0; i < len; i++) { + if (*(str1 + i) > *(str2 + i)) { + return 1; + } else if (*(str1 + i) < *(str2 + i)) { + return -1; + } + } + return 0; +} + +static char * +Strcpy(char *dst, char *src) +{ + int i; + + if ((dst == 0x0) || (src == 0x0)) + return (0); + for (i = 0; src[i] != 0x0; i++) { + dst[i] = src[i]; + } + dst[i] = 0x0; /* NULL termination */ + return dst; +} + +static int +Strlen(char *str) +{ + int i; + + if (str == 0x0) + return 0; + for (i = 0; str[i] != 0x0; i++) ; + return i; +} + +/***********************************************************************/ + +/* Platform Detection Code */ + +/***********************************************************************/ + +/************************************************************************ + * int FindStringInSeg( unsigned int segment_address, char *string_ptr ) + * Returns the offset where the NULL terminated string pointed to by + * string_ptr is located in the segment passed in segment_address. + * Segment_address must be of the form 0xXXXX (i.e 0xf000 for segment f). + * Returns NULL if the string is not found. + ************************************************************************ + */ +int +FindStringInSeg(unsigned int segment_address, char *string_ptr) +{ + int string_length = Strlen(string_ptr); + char *psegment_buf; + unsigned long mem_ptr = (unsigned long)segment_address << 16; + char segment_buffer[SEGMENT_LENGTH + 1]; + int i, cursor; + + /* silence compiler */ + (void)cursor; + (void)mem_ptr; + (void)segment_buffer; + +#if defined(linux) && !defined(XFree86Server) +#ifdef __KERNEL__ + XpressROMPtr = (unsigned char *)ioremap(mem_ptr, SEGMENT_LENGTH + 1); + psegment_buf = (char *)XpressROMPtr; +#else + /* Fill the segment_buffer with 16 page accesses */ + + for (cursor = 0; (cursor * PAGE_LENGTH) < SEGMENT_LENGTH; cursor++) { + protected_mode_access(PLT_READ_BYTES, PAGE_LENGTH, mem_ptr + + (cursor * PAGE_LENGTH), + &(segment_buffer[(cursor * PAGE_LENGTH)])); + } + psegment_buf = segment_buffer; +#endif /* __KERNEL__ */ +#elif defined (XFree86Server) + psegment_buf = (char *)XpressROMPtr; +#elif defined(_WIN32) /* Windows */ + psegment_buf = XpressROMPtr; +#endif + + /* Now search for the first character of the string_ptr */ + for (i = 0; i < SEGMENT_LENGTH + 1; i++) { + if (*(psegment_buf + i) == *string_ptr) { + + /* If we match the first character, do a + * string compare. + */ + + if (!Strncmp(string_ptr, (psegment_buf + i), string_length)) { + /* They match! */ + return (1); + } + } + } + /* if we got this far we didn't find anything. Return NULL. */ + return (0); + +} /* end FindStringInSeg() */ + +/********************************************************************** + + * TRUE_FALSE get_sys_board_type( SYS_BOARD_INFO *sys_info, + * SYS_BOARD_INFO *sys_board_array_base) Checks the system + * BIOS area for Xpressrom information. If found, searches the BIOS + * area for one of names in the array pointed to by sys_board_array_ptr. + * If a match is found, sets the SYS_INFO system_board_name string + * and the system_board variable to the board name and returns TRUE. + * If Xpressrom or a board is not found, sets the variables to + * their default values and returns FALSE. + * Uses the global string pointer *xpress_rom_string_ptr. + * + *********************************************************************** + */ + +static unsigned char +get_sys_board_type(SYS_BOARD_INFO * sys_info, + SYS_BOARD_INFO * sys_board_array_base) +{ + int index; + char *xpress_rom_string_ptr = "XpressStart"; + unsigned int segment = LINUX_ROM_SEGMENT; + + /* See if XpressStart is present in the BIOS area. + * If it is, search for a board string. If not, Xpressrom is + * not present, set system_board information to UNKNOWN and + * return FALSE. + */ + + if (!FindStringInSeg(segment, xpress_rom_string_ptr)) { + sys_info->sys_board = PLT_UNKNOWN; + Strcpy(sys_info->sys_board_name, "Unknown"); + return (FALSE); + } else { + + /* we have Xpressrom, so look for a board */ + for (index = 0; index < Num_sys_board_type; index++) { + if (!FindStringInSeg(segment, (sys_board_array_base + + index)->sys_board_name)) { + continue; + } else { + + /* a match!! */ + sys_info->sys_board = (sys_board_array_base + index)->sys_board; + Strcpy(sys_info->sys_board_name, + (sys_board_array_base + index)->sys_board_name); + return (TRUE); + } + } /* end for() */ + } /* end else */ + + /* if we are here we have failed */ + sys_info->sys_board = PLT_UNKNOWN; + Strcpy(sys_info->sys_board_name, "Unknown"); + return (FALSE); +} /* end get_sys_board_type() */ + +#if defined(linux) && !defined(__KERNEL__) +#if !defined(XFree86Server) + +/****************************************************************** + * + * protected_mode_access( unsigned int mode, unsigned int width, + * unsigned long addr, unsigned char* pdata ) + * This function provides access to physical memory + * at the requested address. + * mode is: PLT_READ or PLT_WRITE (accesses a single byte, word + * or double word depending on the value of "width". + * Only 1, 2 or 4 supported). + * PLT_READ_BYTES, PLT_WRITE_BYTES accesses "width" number + * of bytes (8 bits) + * PLT_READ_WORDS, PLT_WRITE_WORDS accesses "width" number + * of words (16 bits) PLT_READ_DWORDS, PLT_WRITE_DWORDS accesses + * "width" number of dwords (32 bits) + * width is: The size of the access. + * For PLT_READ or PLT_WRITE, only 1, 2 and 4 are + * supported. For other modes, width is not limited but + * will cause paging if the block traverses page boundaries. + * addr is: The physical address being accessed + * pdata is: A pointer to the data to be read or written into. + * NOTE! WORD or DWORD accesses can only be made on + * WORD or DWORD boundaries! + * + ****************************************************************** + */ + +static void +protected_mode_access(unsigned int mode, unsigned int width, + unsigned long addr, unsigned char *pdata) +{ + +#define PMTRASH 0x12345678L + + unsigned long base; /* The physical page address */ + int length = 0x1000; /* the page size is 4k */ + unsigned int offset = 0; /* The physical addr offset into page */ + unsigned int index = 0; /* Used to read/write from/to a block */ + unsigned int chunk = 0; /* The amount to read/wr from THIS block */ + unsigned int size = 0; /* Data size shift value (to avoid math) */ + static void *ptr; /* pointer to real memory location. */ + + static unsigned long lastbase = PMTRASH; + + /* temp storage of previous base used. */ + /* type specific buffer pointers */ + unsigned char *byte_data = (unsigned char *)pdata; + unsigned int *word_data = (unsigned int *)pdata; + unsigned long *dword_data = (unsigned long *)pdata; + + switch (mode) { + + case PLT_READ_WORDS: + case PLT_WRITE_WORDS: + + size = 1; + break; + + case PLT_READ_DWORDS: + case PLT_WRITE_DWORDS: + + size = 2; + } + + /* Check if we're in the user accessable range */ + if (addr < 0xFF000000L) { + + /* We get physical memory in "pages", defined by the + * following "base" address and the "offset" into it. + * "base" will be used with mmap to get "ptr", which + * points to the memory mapped actual physical memory at + * the address pointed-to by "base". + * "width" and "chunk" are in units of whatever data + * type we're reading. + * "length" and "offset" are in units of bytes. + * "width" and "chunk" must be adjusted with "<<size" + * to use with "length" or "offset". Similarly, the + * result must be adjusted with ">>size" to make into the + * proper type units when done. + */ + base = addr & 0xFFFFF000L; + offset = addr & 0x00000FFFL; + do { + if ((offset + (width << size)) > length) { + + /* Block being read extends beyond the + * page boundary. Adjust things. + */ + chunk = (length - offset) >> size; + + /* Figure the chunk size */ + width -= chunk; + + /* Reduce width by the current chunk */ + } else { + + /* Block being read is within the + * page boundary. + */ + chunk = width; + width = 0; + + /* set to zero so we'll exit at the end */ + + } + /* We keep the page around in case we need to + * access it again. + * This saves us some time if we have consecutive + * accesses. + */ + + if (base != lastbase) { + + /* we haven't mmap'd this address + * Have to get a new page. Free the + * previous page, if it's valid (ie, not + * PMTRASH). If not, unmap it and get the + * new page. + */ + if (lastbase != PMTRASH) + munmap(ptr, length); + ptr = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, + base); + if ((int)ptr == -1) { + lastbase = PMTRASH; + return; /* error */ + } + } + + /* Now we're ready to get the data. + * It's pure memory access now, no funny + * function calls, however we do cast things to get + * the right size data. + */ + + /* Scale the offset for the data type size */ + index = offset >> size; + + /* Note that the above line and below lines, + * which shift "offset", discard address information + * if you happen to be trying to write, for example, + * dwords on non-dword boundaries. + */ + /* Note that cases PLT_READ and PLT_WRITE don't + * use "index". They shift "offset" on their own. + * This is because in PLT_READ and PLT_WRITE modes, + * the information on the size of the data + * transaction is in the "width" variable not "size". + * We also need separate cases to cast the values + * right. + */ + switch (mode) { + + case PLT_READ:{ + + switch (chunk) { + + case FOUR_BYTES: + + *(dword_data) = (unsigned long) + (*(((unsigned long *)ptr) + (offset >> 2))); + break; + + case TWO_BYTES: + + *(word_data) = (unsigned int) + (*(((unsigned int *)ptr) + (offset >> 1))); + break; + + default: + + *(byte_data) = (unsigned char) + (*(((unsigned char *)ptr) + (offset))); + break; + + } /* end switch() */ + break; + + } /* end case PLT_READ */ + + case PLT_WRITE:{ + + switch (chunk) { + + case FOUR_BYTES: + + *(((unsigned long *)ptr) + (offset >> 2)) = *dword_data; + break; + + case TWO_BYTES: + + *(((unsigned int *)ptr) + (offset >> 1)) = *word_data; + break; + + default: + + *(((unsigned char *)ptr) + (offset)) = *byte_data; + break; + } /* end switch() */ + break; + + } /* end case PLT_WRITE */ + + case PLT_READ_BYTES:{ + + for (; chunk > 0; chunk--) { + + *(byte_data++) = (unsigned char)(*(((unsigned char *)ptr) + + (index++))); + } + break; + } /* end case PLT_READ_BYTES */ + + case PLT_WRITE_BYTES:{ + + for (; chunk > 0; chunk--) { + *(((unsigned char *)ptr) + (index++)) = *(byte_data++); + } + break; + + } /* end case PLT_WRITE_BYTES */ + + case PLT_READ_WORDS:{ + + for (; chunk > 0; chunk--) { + + *(word_data++) = (unsigned int) + (*(((unsigned int *)ptr) + (index++))); + } + break; + + } /* end case PLT_READ_WORDS */ + + case PLT_WRITE_WORDS:{ + + for (; chunk > 0; chunk--) { + + *(((unsigned int *)ptr) + (index++)) = *(word_data++); + } + break; + + } /* end case PLT_WRITE_WORDS */ + + case PLT_READ_DWORDS:{ + + for (; chunk > 0; chunk--) { + + *(dword_data++) = (*(((unsigned long *)ptr) + (index++))); + } + break; + + } /* end case PLT_READ_DWORDS */ + + case PLT_WRITE_DWORDS:{ + + for (; chunk > 0; chunk--) { + + *(((unsigned long *)ptr) + (index++)) + = *(dword_data++); + } + break; + + } /* end case PLT_WRITE_DWORDS */ + + } /* end switch(mode) */ + + lastbase = base; + + /* Save the page we've just processed. */ + + if (width) { + + /* If there's still width left to get. */ + + base += length; + /* Increment to the next page. */ + + offset = 0; + /* Set the offset to zero. */ + } + + } while (width); /* While there's still data to get. */ + return; + + } /* end for if addr */ + else { + + printf("PMA error: Unable to read ROM address space\n"); + exit(1); + } + return; +} + +/************************************************************************ + * setup_pma() loads the ROM memory access module and initializes + * memory access file descriptor (access is handled through a file-like + * interface). + ************************************************************************ + */ +static void +setup_pma() +{ + fd = open("/dev/mem", 2); /* O_RDWR */ + if (fd == -1) { + + printf("Error: Unable to open /dev/mem !\a\n"); + exit(1); + } + return; +} + +/********************************************************************** + * close_pma() cleans up the open memory access devices and file + * descriptors. + ********************************************************************** + */ +static void +close_pma() +{ + close(fd); + return; +} +#endif /* IN_MODULE */ +#endif /* linux && !__KERNEL__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_bios.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_bios.c:1.3 --- /dev/null Thu Feb 27 12:31:20 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_bios.c Tue Jan 14 04:34:36 2003 @@ -0,0 +1,377 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_bios.c,v 1.3 2003/01/14 09:34:36 alanh Exp $ */ +/* + * $Workfile: pnl_bios.c $ + * $Revision: 6 $ + * + * File Contents: This file panel functions which query for the BIOS for current FP + * Paramters. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "panel.h" + +#if defined(_WIN32) /* windows */ +extern unsigned long gfx_cpu_version; +extern void gfx_outw(unsigned short port, unsigned short data); +extern unsigned short gfx_inw(unsigned short port); +#endif + +#define SOFTVGA_DISPLAY_ENABLE 0x50 +#define SOFTVGA_FPRESOLUTION 0x52 +#define SOFTVGA_FPCLOCKFREQUENCY 0x54 + +/* SOFTVG VIRTUAL REGISTER DEFINITIONS */ + +#define VR_INDEX 0xAC1C +#define VR_DATA 0xAC1E +#define VR_UNLOCK 0xFC53 +#define VRC_VG 0x0002 /* SoftVG Virtual Register Class */ +#define VG_MEM_SIZE 0x0000 /* MemSize Virtual Register */ +#define FP_DETECT_MASK 0x8000 + +#define VG_FP_TYPE 0x0002 /* Flat Panel Info Virtual Register */ + +#define FP_DEV_MASK 0x0003 /* Flat Panel type */ +#define FP_TYPE_SSTN 0x0000 /* SSTN panel type value */ +#define FP_TYPE_DSTN 0x0001 /* DSTN panel type value */ +#define FP_TYPE_TFT 0x0002 /* TFT panel type value */ +#define FP_TYPE_LVDS 0x0003 /* LVDS panel type value */ + +#define FP_RESOLUTION_MASK 0x0038 +#define FP_RES_6X4 0x0000 /* 640x480 resolution value */ +#define FP_RES_8X6 0x0008 /* 800x600 resolution value */ +#define FP_RES_10X7 0x0010 /* 1024x768 resolution value */ +#define FP_RES_12X10 0x0018 /* 1280x1024 resolution value */ +#define FP_RES_16X12 0x0020 /* 1600x1200 resolution value */ + +#define FP_WIDTH_MASK 0x01C0 +#define FP_WIDTH_8 0x0000 /* 8 bit data bus width */ +#define FP_WIDTH_9 0x0040 /* 9 bit data bus width */ +#define FP_WIDTH_12 0x0080 /* 12 bit data bus width */ +#define FP_WIDTH_18 0x00C0 /* 18 bit data bus width */ +#define FP_WIDTH_24 0x0100 /* 24 bit data bus width */ +#define FP_WIDTH_16 0x0140 /* 16 bit data bus width - 16 bit Mono DSTN only */ + +#define FP_COLOR_MASK 0x0200 +#define FP_COLOR_COLOR 0x0000 /* Color panel */ +#define FP_COLOR_MONO 0x0200 /* Mono Panel */ + +#define FP_PPC_MASK 0x0400 +#define FP_PPC_1PPC 0x0000 /* One pixel per clock */ +#define FP_PPC_2PPC 0x0400 /* Two pixels per clock */ + +#define FP_HPOL_MASK 0x0800 +#define FP_H_POL_LGH 0x0000 /* HSync at panel, normally low, active high */ +#define FP_H_POL_HGL 0x0800 /* HSync at panel, normally high, active low */ + +#define FP_VPOL_MASK 0x1000 +#define FP_V_POL_LGH 0x0000 /* VSync at panel, normally low, active high */ +#define FP_V_POL_HGL 0x1000 /* VSync at panel, normally high, active low */ + +#define FP_REF_MASK 0xD000 +#define FP_REF_60 0x0000 /* 60Hz refresh rate */ +#define FP_REF_65 0x2000 /* 65Hz refresh rate */ +#define FP_REF_70 0x4000 /* 70Hz refresh rate */ +#define FP_REF_72 0x6000 /* 72Hz refresh rate */ +#define FP_REF_75 0x8000 /* 75Hz refresh rate */ +#define FP_REF_85 0xA000 /* 85Hz refresh rate */ + +/*----------------------------------------------------------------- + * Pnl_IsPanelEnabledInBIOS + * + * Description: This function specifies whether the panel is enabled + * by the BIOS or not. + * parameters: none. + * return: 1 - Enabled, 0 - Disabled + *-----------------------------------------------------------------*/ +int +Pnl_IsPanelEnabledInBIOS(void) +{ + unsigned char ret = 0; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) { + unsigned short data; + + gfx_outw(VR_INDEX, VR_UNLOCK); + gfx_outw(VR_INDEX, (VRC_VG << 8) | VG_MEM_SIZE); + data = gfx_inw(VR_DATA); + if (data & FP_DETECT_MASK) + ret = 1; + } else { + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK DisplayEnable Reg in SoftVGA */ + + gfx_outb(crtcindex, (unsigned char)SOFTVGA_DISPLAY_ENABLE); + ret = gfx_inb(crtcdata); + } + + return (ret & 0x1); +} + +/*----------------------------------------------------------------- + * Pnl_GetPanelInfoFromBIOS + * + * Description: This function queries the panel information from + * the BIOS. + * parameters: + * xres: width of the panel configured + * yres: height of the panel configured + * bpp: depth of the panel configured + * hz: vertical frequency of the panel configured + * return: none + *-----------------------------------------------------------------*/ +void +Pnl_GetPanelInfoFromBIOS(int *xres, int *yres, int *bpp, int *hz) +{ + unsigned short crtcindex, crtcdata; + unsigned short ret; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) { + gfx_outw(VR_INDEX, VR_UNLOCK); + gfx_outw(VR_INDEX, (VRC_VG << 8) | VG_FP_TYPE); + ret = gfx_inw(VR_DATA); + switch (ret & FP_RESOLUTION_MASK) { + case FP_RES_6X4: + *xres = 640; + *yres = 480; + break; + case FP_RES_8X6: + *xres = 800; + *yres = 600; + break; + case FP_RES_10X7: + *xres = 1024; + *yres = 768; + break; + case FP_RES_12X10: + *xres = 1280; + *yres = 1024; + break; + case FP_RES_16X12: + *xres = 1600; + *yres = 1200; + break; + } + + switch (ret & FP_WIDTH_MASK) { + case FP_WIDTH_8: + *bpp = 8; + break; + case FP_WIDTH_9: + *bpp = 9; + break; + case FP_WIDTH_12: + *bpp = 12; + break; + case FP_WIDTH_18: + *bpp = 18; + break; + case FP_WIDTH_24: + *bpp = 24; + break; + case FP_WIDTH_16: + *bpp = 16; + break; + } + + switch (ret & FP_REF_MASK) { + case FP_REF_60: + *hz = 60; + break; + case FP_REF_65: + *hz = 65; + break; + case FP_REF_70: + *hz = 70; + break; + case FP_REF_72: + *hz = 72; + break; + case FP_REF_75: + *hz = 75; + break; + case FP_REF_85: + *hz = 85; + break; + } + + } else { + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK FPResolution Reg in SoftVGA */ + + gfx_outb(crtcindex, (unsigned char)SOFTVGA_FPRESOLUTION); + ret = gfx_inb(crtcdata); + + switch (ret & 0x3) { + case 0: + *xres = 640; + *yres = 480; + break; + case 1: + *xres = 800; + *yres = 600; + break; + case 2: + *xres = 1024; + *yres = 768; + break; + } + + switch ((ret >> 4) & 0x3) { + case 0: + *bpp = 12; + break; + case 1: + *bpp = 18; + break; + case 2: + *bpp = 16; + break; + case 3: + *bpp = 8; + break; + } + + /* CHECK FPClockFrequency Reg in SoftVGA */ + + gfx_outb(crtcindex, (unsigned char)SOFTVGA_FPCLOCKFREQUENCY); + *hz = gfx_inb(crtcdata); + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_defs.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_defs.h:1.1 --- /dev/null Thu Feb 27 12:31:21 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_defs.h Tue Dec 10 10:12:28 2002 @@ -0,0 +1,203 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_defs.h,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: pnl_defs.h $ + * + * File Contents: This file contains definitions of the Geode + * frame buffer panel data structures. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#ifndef _pnl_defs_h +#define _pnl_defs_h + +typedef enum +{ + MARMOT_PLATFORM = 0, + UNICORN_PLATFORM, + CENTAURUS_PLATFORM, + ARIES_PLATFORM, + CARMEL_PLATFORM, + HYDRA_PLATFORM, + DORADO_PLATFORM, + DRACO_PLATFORM, + REDCLOUD_PLATFORM, + OTHER_PLATFORM +} +SYS_BOARD; + +#define PNL_9210 0x01 +#define PNL_9211_A 0x02 +#define PNL_9211_C 0x04 +#define PNL_UNKNOWN_CHIP 0x08 + +#define PNL_TFT 0x01 +#define PNL_SSTN 0x02 +#define PNL_DSTN 0x04 +#define PNL_TWOP 0x08 +#define PNL_UNKNOWN_PANEL 0x10 + +#define PNL_MONO_PANEL 0x01 +#define PNL_COLOR_PANEL 0x02 +#define PNL_UNKNOWN_COLOR 0x08 + +#define PNL_PANELPRESENT 0x01 +#define PNL_PLATFORM 0x02 +#define PNL_PANELCHIP 0x04 +#define PNL_PANELSTAT 0x08 +#define PNL_OVERRIDE_STAT 0x10 +#define PNL_OVERRIDE_ALL 0x1F + +typedef struct _Pnl_PanelStat_ +{ + int Type; + int XRes; + int YRes; + int Depth; + int MonoColor; +} +Pnl_PanelStat; + +typedef struct _Pnl_Params_ +{ + unsigned long Flags; + int PanelPresent; + int Platform; + int PanelChip; + Pnl_PanelStat PanelStat; +} +Pnl_PanelParams, *PPnl_PanelParams; + +#endif /* _pnl_defs_h */ + +/* END OF FILE */ Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_init.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_init.c:1.1 --- /dev/null Thu Feb 27 12:31:21 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_init.c Tue Dec 10 10:12:28 2002 @@ -0,0 +1,613 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/pnl_init.c,v 1.1 2002/12/10 15:12:28 alanh Exp $ */ +/* + * $Workfile: pnl_init.c $ + * $Revision: 28 $ + * + * File Contents: This file contains the Geode frame buffer panel + * intialization functions. + * + * SubModule: Geode FlatPanel library + * + */ + +/* + * NSC_LIC_ALTERNATIVE_PREAMBLE + * + * Revision 1.0 + * + * National Semiconductor Alternative GPL-BSD License + * + * National Semiconductor Corporation licenses this software + * ("Software"): + * + * Panel Library + * + * under one of the two following licenses, depending on how the + * Software is received by the Licensee. + * + * If this Software is received as part of the Linux Framebuffer or + * other GPL licensed software, then the GPL license designated + * NSC_LIC_GPL applies to this Software; in all other circumstances + * then the BSD-style license designated NSC_LIC_BSD shall apply. + * + * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ + +/* NSC_LIC_BSD + * + * National Semiconductor Corporation Open Source License for + * + * Panel Library + * + * (BSD License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of the National Semiconductor Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * END_NSC_LIC_BSD */ + +/* NSC_LIC_GPL + * + * National Semiconductor Corporation Gnu General Public License for + * + * Panel Library + * + * (GPL License with Export Notice) + * + * Copyright (c) 1999-2001 + * National Semiconductor Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted under the terms of the GNU General + * Public License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version + * + * In addition to the terms of the GNU General Public License, neither + * the name of the National Semiconductor Corporation nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, + * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. See the GNU General Public License for more details. + * + * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF + * YOUR JURISDICTION. It is licensee's responsibility to comply with + * any export regulations applicable in licensee's jurisdiction. Under + * CURRENT (2001) U.S. export regulations this software + * is eligible for export from the U.S. and can be downloaded by or + * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed + * destinations which include Cuba, Iraq, Libya, North Korea, Iran, + * Syria, Sudan, Afghanistan and any other country to which the U.S. + * has embargoed goods and services. + * + * You should have received a copy of the GNU General Public License + * along with this file; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * END_NSC_LIC_GPL */ + +#include "panel.h" +#include "gfx_regs.h" +#include "gfx_type.h" + +/* defaults +Panel : Enabled +Platform : Centaurus +92xx Chip : 9211 Rev. A +PanelType : DSTN +XResxYRes : 800x600 +Depth : 16 +Mono_Color : Color +*/ +static Pnl_PanelParams sPanelParam = { + 0, 1, CENTAURUS_PLATFORM, PNL_9211_A, + {PNL_DSTN, 800, 600, 16, PNL_COLOR_PANEL} +}; + +#if PLATFORM_DRACO +#include "drac9210.c" +#endif + +#if PLATFORM_CENTAURUS +#include "cen9211.c" +#endif + +#if PLATFORM_DORADO +#include "dora9211.c" +#endif + +#if PLATFORM_GX2BASED +#include "gx2_9211.c" +#endif +#include "platform.c" + +/* + * return -1 - UnKnown + * 0 - Draco has 9210 + * 1 - Centaurus has 9211 Rev. A + * 2 - Dorado has 9211 Rev. C + */ + +/*----------------------------------------------------------------- + * Pnl_SetPlatform + * + * Description: This function sets the panel with hardware platform. + * parameters: + * platform: It specify the platform. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SetPlatform(int platform) +{ + /* To Be Implemented */ + sPanelParam.Platform = platform; + +} + +/*----------------------------------------------------------------- + * Pnl_GetPlatform + * + * Description: This function returns the panel platform. + * parameters: none. + * return: On success it returns the panel platform. + *-----------------------------------------------------------------*/ +int +Pnl_GetPlatform(void) +{ + sPanelParam.Platform = Detect_Platform(); + + return sPanelParam.Platform; + +} + +/*----------------------------------------------------------------- + * Pnl_IsPanelPresent + * + * Description: This function specifies whether the panel is prsent + * or not. + * parameters: none. + * return: On success it returns an integer panel present value. + *-----------------------------------------------------------------*/ +int +Pnl_IsPanelPresent(void) +{ + /* To Be Implemented */ + return sPanelParam.PanelPresent; +} + +/*----------------------------------------------------------------- + * Pnl_SetPanelPresent + * + * Description: This function sets the panel_present parameter. + * parameters: + * present: It specifies the panel present value. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SetPanelPresent(int present) +{ + /* To Be Implemented */ + sPanelParam.PanelPresent = present; +} + +/*----------------------------------------------------------------- + * Pnl_SetPanelParam + * + * Description: This function sets the panel parameters + * parameters: + * pParam: It specifies the elements of the panel parameter + * structure. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SetPanelParam(PPnl_PanelParams pParam) +{ + if (pParam->Flags & PNL_PANELPRESENT) { + Pnl_SetPanelPresent(pParam->PanelPresent); + } + if (pParam->Flags & PNL_PLATFORM) { + Pnl_SetPlatform(pParam->Platform); + } + if (pParam->Flags & PNL_PANELCHIP) { + Pnl_SetPanelChip(pParam->PanelChip); + } + if (pParam->Flags & PNL_PANELSTAT) { + sPanelParam.PanelStat.XRes = pParam->PanelStat.XRes; + sPanelParam.PanelStat.YRes = pParam->PanelStat.YRes; + sPanelParam.PanelStat.Depth = pParam->PanelStat.Depth; + sPanelParam.PanelStat.MonoColor = pParam->PanelStat.MonoColor; + sPanelParam.PanelStat.Type = pParam->PanelStat.Type; + } +} + +/*----------------------------------------------------------------- + * Pnl_PowerUp + * + * Description: This function sets the power based on the + * hardware platforms dorado or centaraus. + * parameters: none. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_PowerUp(void) +{ + int Platform; + unsigned long dcfg, hw_video; + + Platform = Pnl_GetPlatform(); + +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Power_Up(); + return; + } +#endif + +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Power_Up(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif + + hw_video = gfx_detect_video(); + + if (hw_video == GFX_VID_CS5530) { + /* READ DISPLAY CONFIG FROM CX5530 */ + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + + /* SET RELEVANT FIELDS */ + dcfg |= (CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + /* Enable the flatpanel power and data */ + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_SC1200) { + /* READ DISPLAY CONFIG FROM SC1200 */ + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + + /* SET RELEVANT FIELDS */ + dcfg |= (SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + /* Enable the flatpanel power and data */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_REDCLOUD) { + /* READ DISPLAY CONFIG FROM REDCLOUD */ + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + + /* SET RELEVANT FIELDS */ + dcfg |= (RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + /* Enable the flatpanel power and data */ + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + } + +} + +/*----------------------------------------------------------------- + * Pnl_PowerDown + * + * Description: This function make power down based on the + * hardware platforms dorado or centaraus. + * parameters: none. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_PowerDown(void) +{ + int Platform; + unsigned long dcfg, hw_video; + + Platform = Pnl_GetPlatform(); + +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Power_Down(); + return; + } +#endif +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Power_Down(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif + + hw_video = gfx_detect_video(); + + if (hw_video == GFX_VID_CS5530) { + /* READ DISPLAY CONFIG FROM CX5530 */ + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + dcfg &= ~(CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + /* Disable the flatpanel power and data */ + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_SC1200) { + /* READ DISPLAY CONFIG FROM SC1200 */ + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + dcfg &= ~(SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + /* Disable the flatpanel power and data */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_REDCLOUD) { + /* READ DISPLAY CONFIG FROM REDCLOUD */ + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + dcfg &= ~(RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + /* Disable the flatpanel power and data */ + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + } +} + +/*----------------------------------------------------------------- + * Pnl_SavePanelState + * + * Description: This function saves the panel state based on the + * hardware platforms dorado or centaraus. + * parameters: none. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SavePanelState(void) +{ + int Platform; + + Platform = Pnl_GetPlatform(); + +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Save_Panel_State(); + return; + } +#endif + +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Save_Panel_State(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif +} + +/*----------------------------------------------------------------- + * Pnl_RestorePanelState + * + * Description: This function restore the panel state based on the + * hardware platforms dorado or centaraus. + * parameters: none. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_RestorePanelState(void) +{ + int Platform; + + Platform = Pnl_GetPlatform(); +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Restore_Panel_State(); + return; + } +#endif + +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Restore_Panel_State(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif +} + +/*----------------------------------------------------------------- + * Pnl_GetPanelParam + * + * Description: This function gets the panel parameters from the + * hardware platforms dorado or centaraus. + * parameters: + * pParam: It specifies the elements of the panel parameter + * structure. + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_GetPanelParam(PPnl_PanelParams pParam) +{ + if (pParam->Flags & PNL_PANELPRESENT) { + pParam->PanelPresent = Pnl_IsPanelPresent(); + } + if (pParam->Flags & PNL_PLATFORM) { + pParam->Platform = Pnl_GetPlatform(); + } + if ((pParam->Flags & PNL_PANELCHIP) || (pParam->Flags & PNL_PANELSTAT)) { +#if PLATFORM_CENTAURUS + if (pParam->Platform == CENTAURUS_PLATFORM) { + Centaurus_Get_9211_Details(pParam->Flags, pParam); + return; + } +#endif + +#if PLATFORM_DORADO + if (pParam->Platform == DORADO_PLATFORM) { + Dorado_Get_9211_Details(pParam->Flags, pParam); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (pParam->Platform == REDCLOUD_PLATFORM) { + } +#endif + + /* if unknown platform put unknown */ + if (pParam->Flags & PNL_PANELCHIP) + pParam->PanelChip = PNL_UNKNOWN_CHIP; + + if (pParam->Flags & PNL_PANELSTAT) { + pParam->PanelStat.XRes = 0; + pParam->PanelStat.YRes = 0; + pParam->PanelStat.Depth = 0; + pParam->PanelStat.MonoColor = PNL_UNKNOWN_COLOR; + pParam->PanelStat.Type = PNL_UNKNOWN_PANEL; + } + } +} + +/*----------------------------------------------------------------- + * Pnl_SetPanelChip + * + * Description: This function sets the panelchip parameter of panel + * structure. + * parameters: + * panelChip: It specifies the panelChip value. + * return: none. + *-----------------------------------------------------------------*/ + +void +Pnl_SetPanelChip(int panelChip) +{ + /* To Be Implemented */ + sPanelParam.PanelChip = panelChip; + +} + +/*----------------------------------------------------------------- + * Pnl_GetPanelChip + * + * Description: This function gets the panelchip parameter of panel + * structure. + * parameters: + * return: On success it returns the panelchip. + *-----------------------------------------------------------------*/ +int +Pnl_GetPanelChip(void) +{ + /* To Be Implemented */ + return sPanelParam.PanelChip; +} + +/*----------------------------------------------------------------- + * Pnl_InitPanel + * + * Description: This function initializes the panel with + * hardware platforms dorado or centaraus. + * parameters: + * pParam: It specifies the elements of the panel parameter + * structure. + * return: none. + *-----------------------------------------------------------------*/ +int +Pnl_InitPanel(PPnl_PanelParams pParam) +{ + PPnl_PanelParams pPtr; + + if (pParam == 0x0) /* NULL use the static table */ + pPtr = &sPanelParam; + else + pPtr = pParam; + + if (!pPtr->PanelPresent) { + return -1; /* error */ + } else { + if ((pPtr->PanelChip < 0) || (pPtr->Platform < 0)) + return -1; /* error */ + +#if PLATFORM_DRACO + /* check we are init. the right one */ + if ((pPtr->Platform == DRACO_PLATFORM) && (pPtr->PanelChip == PNL_9210)) { + Draco9210Init(&(pPtr->PanelStat)); + } +#endif + +#if PLATFORM_CENTAURUS + /* check we are init. the right one */ + if (pPtr->Platform == CENTAURUS_PLATFORM) { + Centaurus_9211init(&(pPtr->PanelStat)); + } +#endif + +#if PLATFORM_DORADO + /* check we are init. the right one */ + if ((pPtr->Platform == DORADO_PLATFORM) && + (pPtr->PanelChip == PNL_9211_C)) { + Dorado9211Init(&(pPtr->PanelStat)); + } +#endif +#if PLATFORM_GX2BASED + if (pPtr->Platform == REDCLOUD_PLATFORM) { + Redcloud_9211init(&(pPtr->PanelStat)); + } +#endif + } /* else end */ + return 1; +} Index: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/readme.txt diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/readme.txt:1.2 --- /dev/null Thu Feb 27 12:31:22 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/readme.txt Tue Dec 10 10:41:27 2002 @@ -0,0 +1,365 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/panel/readme.txt,v 1.2 2002/12/10 15:41:27 alanh Exp $ */ +Panel Library +Release 1.3.2 +OS - Can be used in all OS's. +Dec 10, 2002 +Developer - Sarma Kolluru + +----------------------------------------------------------------------------- +PRODUCT INFORMATION +----------------------------------------------------------------------------- +Panel library is set of functions enabling the driver to give panel support. +The panel library is supported on Centaurus and Dorado. +The panel library can detect the panel support by the jumper settings +selected on the board. The platform can be detected too. + + \readme.txt This file + +----------------------------------------------------------------------------- +BUILD INSTRUCTIONS +----------------------------------------------------------------------------- +Panel library is a set of files which has support for flatpanel. The panel +subdirectory needs to be copied in the driver directory. +----------------------------------------------------------------------------- +INSTALLATION INSTRUCTIONS +----------------------------------------------------------------------------- +These is no instalation and to be treaded as a driver source code extension. +- Run "/root/crlf/crlf -a" in Linux OS. +----------------------------------------------------------------------------- +UNIT TEST +Panel library when compiled is a part of the driver and cannot be unit tested. +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +REVISION HISTORY +----------------------------------------------------------------------------- +Version changes v1.3.2 12/10/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- Did code indentation for XFree release. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + drac9210.c + drac9210.h + gx2_9211.c + gx2_9211.h + panel.h + panel.c + platform.c + pnl_bios.c + pnl_defs.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.3.1 12/06/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- Added function protoype. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +FILE CHANGES + cen9211.h + dora9211.h + gx2_9211.h +----------------------------------------------------------------------------- +Version changes v1.3.0 11/29/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- cursor variable not defined for XFree when not as a module. +----------------------------------------------------------------------------- +FILE CHANGES + platform.c +----------------------------------------------------------------------------- +Version changes v1.2.9 7/31/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added FP setup from user input. +Added Redcloud Panel initialization. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + pnl_init.c + panel.c + platform.c + gx2_9211.c + gx2_9211.h +----------------------------------------------------------------------------- +Version changes v1.2.8 5/16/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added FP detection with BIOS for GX2. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + pnl_bios.c +----------------------------------------------------------------------------- +Version changes v1.2.7 1/20/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added the protoype for gfx_detect_video. +Durango dependency removed. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.c +----------------------------------------------------------------------------- +Version changes v1.2.6 12/1/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o + - Durango 2.35.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Toggle 5530/scx200/RC FlatPanel Power and Data accordingly during +power up/down. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.5 11/1/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o + - Durango 2.35.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Re-Enabled the Draco platform support. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel_defs.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.4 08/12/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1 + - Durango 2.33.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added 2 functions to get the FP setting details from BIOS. + +int Pnl_IsPanelEnabledInBIOS(void); +void Pnl_GetPanelInfoFromBIOS(int *xres, int *yres, int *bpp, int *hz); + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + pnl_bios.c +----------------------------------------------------------------------------- +Version changes v1.2.3 06/05/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1 + - Durango 2.31.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Code cleanup and documentation. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + panel.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.2 04/11/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.27.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added Pnl_PowerUp and Pnl_PowerDown Functions. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + panel.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.1 03/29/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.25 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added Pnl_SavePanelState and Pnl_RestorePanelState Functions. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + 92xx.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + platform.c + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.0 03/04/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.23 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Use inb/out routines from durango directly. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h -inb/outb deleted. +============================================================================= +Version changes v1.0.1 02/02/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.19 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added 9211 Rev. C on Centaurus platform. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h -9211 Rev.C. + cen9211.c - centaurus 9211_C support file. + cen9211.h - centaurus 9211_C support file. + platform.c - Support for detection of platform in which driver runs. +============================================================================= +Version changes v1.0.0 01/21/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.16 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Detection of platform +Detection of 92x chip with version and the panel sected by jumper settings. +initialization of the h/w. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h -common file with all 9211/9210 definitions. + cen9211.c - centaurus 9211_A support file. + cen9211.h - centaurus 9211_A support file. + dora9211.c - dorado 9211_A support file. + dora9211.h - dorado 9211_C support file. + drac9210.c - draco 9210 support file. + drac9210.h - draco 9210 support file. + panel.c - This is the confiuration file to enable support for platforms. + panel.h - centaurus 9211_A support file. + platform.c - Support for detection of platform in which driver runs. + pnl_defs.h - common definitions for panel. + pnl_init.c - configurationto call appropriate platform calls. + readme.txt - this file. +----------------------------------------------------------------------------- +----------------------------------------------------------------------------- +KNOWN ERRATA +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- + Index: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile:1.17 xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile:1.17 Sun Apr 1 16:51:25 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile Mon Feb 17 12:06:43 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.17 2001/04/01 20:51:25 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.19 2003/02/17 17:06:43 dawes Exp $ XCOMM XCOMM This is an Imakefile for the NVIDIA driver. XCOMM @@ -24,7 +24,7 @@ -I$(SERVERSRC)/Xext -I$(XF86SRC)/int10 \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) -I$(SERVERSRC)/fb \ - -I$(SERVERSRC)/render -I$(XF86OSSRC)/vbe + -I$(SERVERSRC)/render -I$(XF86SRC)/vbe #endif DEFINES = -DPSZ=8 @@ -58,8 +58,6 @@ InstallDriverSDKNonExecFile(nv_shadow.c,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_type.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_xaa.c,$(DRIVERSDKDIR)/drivers/nv) -InstallDriverSDKNonExecFile(nvreg.h,$(DRIVERSDKDIR)/drivers/nv) -InstallDriverSDKNonExecFile(nvvga.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(riva_hw.c,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(riva_hw.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(riva_tbl.h,$(DRIVERSDKDIR)/drivers/nv) Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.7 xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.7 Mon Dec 17 15:52:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man Mon Feb 10 19:00:18 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man,v 1.7 2001/12/17 20:52:33 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man,v 1.17 2003/02/11 00:00:18 mvojkovi Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH NV __drivermansuffix__ __vendorversion__ @@ -14,13 +14,13 @@ .fi .SH DESCRIPTION .B nv -is an XFree86 driver for NVIDIA video cards. The driver is fully -accelerated and provides support for the following framebuffer depths: +is an XFree86 driver for NVIDIA video cards. The driver supports full 2D +acceleration and provides support for the following framebuffer depths: 8, 15, 16 (except Riva128) and 24. All visual types are supported for depth 8, TrueColor and DirectColor visuals are supported for the other depths with the exception of -the Riva128 which only supports TrueColor in the higher depths. Multi-head configurations -are supported. +the Riva128 which only supports TrueColor in the higher depths. + .SH SUPPORTED HARDWARE The .B nv @@ -39,12 +39,19 @@ NV10 .TP 22 .B GeForce2, QUADRO2 -NV11 & NV15 (except GeForce2 Go, which is -.B NOT -supported) +NV11 & NV15 .TP 22 -.B GeForce3 +.B GeForce3, QUADRO DCC NV20 +.TP 22 +.B nForce, nForce2 +NV1A, NV1F +.TP 22 +.B GeForce4, QUADRO4 +NV17, NV18, NV25, NV28 +.TP 22 +.B GeForce FX, QUADRO FX +NV30 .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -68,11 +75,36 @@ on all OSs). See fbdevhw(__drivermansuffix__) for further information. Default: off. .TP +.BI "Option \*qCrtcNumber\*q \*q" integer \*q +nForce2, Quadro4, GeForce4 and NV30 may have two video outputs. +The driver attempts to autodetect +which one the monitor is connected to. In the case that autodetection picks +the wrong one, this option may be used to force usage of a particular output. +The options are "0" or "1". +Default: autodetected. +.TP +.BI "Option \*qFlatPanel\*q \*q" boolean \*q +The driver usually cannot autodetect the presence of a flat panel so +this option should be set when used with a flat panel. With this driver +a flat panel will only work if it was POSTed by the BIOS, that is, the +machine must have booted to the panel. +Default: off. +.TP +.BI "Option \*qFPDither\*q \*q" boolean \*q +Most digital flat panels have only 6 bits per component color resolution. +This option tells the driver to dither from 8 bits per component to 6 before +the flat panel truncates it. This is only suported in depth 24 on NV11, +nForce2, GeForce4, Quadro4 and NV30. +Default: off. +.TP .BI "Option \*qRotate\*q \*qCW\*q" .TP .BI "Option \*qRotate\*q \*qCCW\*q" Rotate the display clockwise or counterclockwise. This mode is unaccelerated. Default: no rotation. + +Note: Option Rotate does not work unless the Resize and Rotate extension has +been turned off. .TP .BI "Option \*qShadowFB\*q \*q" boolean \*q Enable or disable use of the shadow framebuffer layer. Default: off. Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.5 Mon Dec 17 17:17:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c Tue Nov 26 18:41:58 2002 @@ -24,36 +24,41 @@ /* Rewritten with reference from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.5 2001/12/17 22:17:55 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.11 2002/11/26 23:41:58 mvojkovi Exp $ */ #include "nv_include.h" -#include "nvreg.h" -#include "nvvga.h" +#include "cursorstr.h" /****************************************************************************\ * * -* XAA HW Cursor Entrypoints * +* HW Cursor Entrypoints * * * \****************************************************************************/ -/* - * RIVA supports full colour cursors as X1R5G5B5. Upper bit is the XOR - * bit. All 0's equals transparency. - */ + #define TRANSPARENT_PIXEL 0 + #define ConvertToRGB555(c) \ (((c & 0xf80000) >> 9 ) | ((c & 0xf800) >> 6 ) | ((c & 0xf8) >> 3 ) | 0x8000) + +#define ConvertToRGB888(c) (c | 0xff000000) + +#define BYTE_SWAP_32(c) ((c & 0xff000000) >> 24) | \ + ((c & 0xff0000) >> 8) | \ + ((c & 0xff00) << 8) | \ + ((c & 0xff) << 24) + -static void ConvertCursor(NVPtr pNv, unsigned int* src, unsigned short *dst) +static void +ConvertCursor1555(NVPtr pNv, CARD32 *src, CARD16 *dst) { - int i, j, b, m; + CARD32 b, m; + int i, j; - for ( i = 0; i < MAX_CURS; i++ ) - { + for ( i = 0; i < 32; i++ ) { b = *src++; m = *src++; - for ( j = 0; j < MAX_CURS; j++ ) - { + for ( j = 0; j < 32; j++ ) { #if X_BYTE_ORDER == X_BIG_ENDIAN if ( m & 0x80000000) *dst = ( b & 0x80000000) ? pNv->curFg : pNv->curBg; @@ -74,67 +79,111 @@ } } + static void -LoadCursor(ScrnInfoPtr pScrn, unsigned short *tmp) +ConvertCursor8888(NVPtr pNv, CARD32 *src, CARD32 *dst) { - int *image, i, numInts; - NVPtr pNv = NVPTR(pScrn); - - numInts = (MAX_CURS*MAX_CURS*2) / sizeof(int); - image = (int *)tmp; - for (i = 0; i < numInts; i++) - pNv->riva.CURSOR[i] = image[i]; + CARD32 b, m; + int i, j; + + for ( i = 0; i < 128; i++ ) { + b = *src++; + m = *src++; + for ( j = 0; j < 32; j++ ) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + if ( m & 0x80000000) + *dst = ( b & 0x80000000) ? pNv->curFg : pNv->curBg; + else + *dst = TRANSPARENT_PIXEL; + b <<= 1; + m <<= 1; +#else + if ( m & 1 ) + *dst = ( b & 1) ? pNv->curFg : pNv->curBg; + else + *dst = TRANSPARENT_PIXEL; + b >>= 1; + m >>= 1; +#endif + dst++; + } + } } + static void +TransformCursor (NVPtr pNv) +{ + CARD32 *tmp; + int i, dwords; + + /* convert to color cursor */ + if(pNv->alphaCursor) { + dwords = 64 * 64; + if(!(tmp = ALLOCATE_LOCAL(dwords * 4))) return; + ConvertCursor8888(pNv, pNv->curImage, tmp); + } else { + dwords = (32 * 32) >> 1; + if(!(tmp = ALLOCATE_LOCAL(dwords * 4))) return; + ConvertCursor1555(pNv, pNv->curImage, (CARD16*)tmp); + } + + for(i = 0; i < dwords; i++) + pNv->riva.CURSOR[i] = tmp[i]; + + DEALLOCATE_LOCAL(tmp); +} + +static void NVLoadCursorImage( ScrnInfoPtr pScrn, unsigned char *src ) { NVPtr pNv = NVPTR(pScrn); - unsigned short tmp[MAX_CURS*MAX_CURS]; - /* Copy image for color changes */ - memcpy(pNv->curImage, src, MAX_CURS*2*4); + /* save copy of image for color changes */ + memcpy(pNv->curImage, src, (pNv->alphaCursor) ? 1024 : 256); - ConvertCursor(pNv, (unsigned int*)src, tmp); - LoadCursor(pScrn, tmp); + TransformCursor(pNv); } - -/* - * This function should display a new cursor at a new position. - */ static void NVSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { NVPtr pNv = NVPTR(pScrn); - pNv->riva.ShowHideCursor(&pNv->riva, 0); - *(pNv->riva.CURSORPOS) = (x & 0xFFFF) | (y << 16); - pNv->riva.ShowHideCursor(&pNv->riva, 1); + pNv->riva.PRAMDAC[0x0000300/4] = (x & 0xFFFF) | (y << 16); } static void NVSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { NVPtr pNv = NVPTR(pScrn); - unsigned short fore, back; - - fore = ConvertToRGB555(fg); - back = ConvertToRGB555(bg); + CARD32 fore, back; + if(pNv->alphaCursor) { + fore = ConvertToRGB888(fg); + back = ConvertToRGB888(bg); +#if X_BYTE_ORDER == X_BIG_ENDIAN + if((pNv->Chipset & 0x0ff0) == 0x0110) { + fore = BYTE_SWAP_32(fore); + back = BYTE_SWAP_32(back); + } +#endif + } else { + fore = ConvertToRGB555(fg); + back = ConvertToRGB555(bg); #if X_BYTE_ORDER == X_BIG_ENDIAN - fore = (fore << 8) | (fore >> 8); - back = (back << 8) | (back >> 8); + if((pNv->Chipset & 0x0ff0) == 0x0110) { + fore = ((fore & 0xff) << 8) | (fore >> 8); + back = ((back & 0xff) << 8) | (back >> 8); + } #endif + } - if (pNv->curFg != fore || pNv->curBg != back) { - unsigned short tmp[MAX_CURS*MAX_CURS]; - + if ((pNv->curFg != fore) || (pNv->curBg != back)) { pNv->curFg = fore; pNv->curBg = back; - ConvertCursor(pNv, pNv->curImage, tmp); - LoadCursor(pScrn, tmp); + TransformCursor(pNv); } } @@ -161,6 +210,55 @@ return TRUE; } +#ifdef ARGB_CURSOR +static Bool +NVUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) +{ + if((pCurs->bits->width <= 64) && (pCurs->bits->height <= 64)) + return TRUE; + + return FALSE; +} + +static void +NVLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) +{ + NVPtr pNv = NVPTR(pScrn); + CARD32 *image = pCurs->bits->argb; + CARD32 *dst = (CARD32*)pNv->riva.CURSOR; + int x, y, w, h; + + w = pCurs->bits->width; + h = pCurs->bits->height; + +#if X_BYTE_ORDER == X_BIG_ENDIAN + if((pNv->Chipset & 0x0ff0) == 0x0110) { + CARD32 tmp; + + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + tmp = *image++; + *dst++ = BYTE_SWAP_32(tmp); + } + for(; x < 64; x++) + *dst++ = 0; + } + } else +#endif + { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) + *dst++ = *image++; + for(; x < 64; x++) + *dst++ = 0; + } + } + + if(y < 64) + memset(dst, 0, 64 * (64 - y) * 4); +} +#endif + Bool NVCursorInit(ScreenPtr pScreen) { @@ -174,9 +272,12 @@ if(!infoPtr) return FALSE; pNv->CursorInfoRec = infoPtr; + + if(pNv->alphaCursor) + infoPtr->MaxWidth = infoPtr->MaxHeight = 64; + else + infoPtr->MaxWidth = infoPtr->MaxHeight = 32; - infoPtr->MaxWidth = MAX_CURS; - infoPtr->MaxHeight = MAX_CURS; infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32; infoPtr->SetCursorColors = NVSetCursorColors; @@ -185,6 +286,16 @@ infoPtr->HideCursor = NVHideCursor; infoPtr->ShowCursor = NVShowCursor; infoPtr->UseHWCursor = NVUseHWCursor; + +#ifdef ARGB_CURSOR + if(pNv->alphaCursor && + (((pNv->Chipset & 0x0ff0) != 0x0110) || + !(pNv->riva.flatPanel & FP_DITHER))) + { + infoPtr->UseHWCursorARGB = NVUseHWCursorARGB; + infoPtr->LoadCursorARGB = NVLoadCursorARGB; + } +#endif return(xf86InitCursor(pScreen, infoPtr)); } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.31 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.15 Tue Dec 11 14:42:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c Thu Jan 2 15:44:56 2003 @@ -24,13 +24,10 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c,v 1.15 2001/12/11 19:42:01 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c,v 1.31 2003/01/02 20:44:56 mvojkovi Exp $ */ #include "nv_include.h" -#include "nvreg.h" -#include "nvvga.h" - Bool NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -71,6 +68,15 @@ if(mode->Flags & V_INTERLACE) vertTotal |= 1; + if(pNv->FlatPanel == 1) { + vertStart = vertTotal - 3; + vertEnd = vertTotal - 2; + vertBlankStart = vertStart; + horizStart = horizTotal - 3; + horizEnd = horizTotal - 2; + horizBlankEnd = horizTotal + 4; + } + pVga->CRTC[0x0] = Set8Bits(horizTotal); pVga->CRTC[0x1] = Set8Bits(horizDisplay); pVga->CRTC[0x2] = Set8Bits(horizBlankStart); @@ -98,6 +104,8 @@ pVga->CRTC[0x15] = Set8Bits(vertBlankStart); pVga->CRTC[0x16] = Set8Bits(vertBlankEnd); + pVga->Attribute[0x10] = 0x01; + nvReg->screen = SetBitField(horizBlankEnd,6:6,4:4) | SetBitField(vertBlankStart,10:10,3:3) | SetBitField(vertStart,10:10,2:2) @@ -147,6 +155,8 @@ if(pNv->riva.Architecture >= NV_ARCH_10) pNv->riva.CURSOR = (U032 *)(pNv->FbStart + pNv->riva.CursorStart); + pNv->riva.LockUnlock(&pNv->riva, 0); + pNv->riva.CalcStateExt(&pNv->riva, nvReg, i, @@ -156,21 +166,73 @@ mode->Clock, mode->Flags); + nvReg->scale = pNv->riva.PRAMDAC[0x00000848/4] & 0xfff000ff; + if(pNv->FlatPanel == 1) { + nvReg->pixel |= (1 << 7); + nvReg->scale |= (1 << 8) ; + } + if(pNv->SecondCRTC) { + nvReg->head = pNv->riva.PCRTC0[0x00000860/4] & ~0x00001000; + nvReg->head2 = pNv->riva.PCRTC0[0x00002860/4] | 0x00001000; + nvReg->crtcOwner = 3; + nvReg->pllsel |= 0x20000800; + nvReg->vpll2 = nvReg->vpll; + } else + if(pNv->riva.twoHeads) { + nvReg->head = pNv->riva.PCRTC0[0x00000860/4] | 0x00001000; + nvReg->head2 = pNv->riva.PCRTC0[0x00002860/4] & ~0x00001000; + nvReg->crtcOwner = 0; + nvReg->vpll2 = pNv->riva.PRAMDAC0[0x00000520/4]; + } + + nvReg->cursorConfig = 0x00000100; + if(mode->Flags & V_DBLSCAN) + nvReg->cursorConfig |= (1 << 4); + if(pNv->alphaCursor) { + nvReg->cursorConfig |= 0x04011000; + nvReg->general |= (1 << 29); + + if((pNv->Chipset & 0x0ff0) == 0x0110) { + nvReg->dither = pNv->riva.PRAMDAC[0x0528/4] & ~0x00010000; + if(pNv->riva.flatPanel & FP_DITHER) + nvReg->dither |= 0x00010000; + else + nvReg->cursorConfig |= (1 << 28); + } else + if((pNv->riva.Chipset & 0x0ff0) >= 0x0170) { + nvReg->dither = pNv->riva.PRAMDAC[0x083C/4] & ~1; + nvReg->cursorConfig |= (1 << 28); + if(pNv->riva.flatPanel & FP_DITHER) + nvReg->dither |= 1; + } else { + nvReg->cursorConfig |= (1 << 28); + } + } else + nvReg->cursorConfig |= 0x02000000; + + nvReg->vpllB = 0; + nvReg->vpll2B = 0; + return (TRUE); } void NVDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, NVRegPtr nvReg, - Bool restoreFonts) + Bool primary) { NVPtr pNv = NVPTR(pScrn); + int restore = VGA_SR_MODE; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVDACRestore\n")); + + if(primary) restore |= VGA_SR_CMAP | VGA_SR_FONTS; + else if((pNv->Chipset & 0xffff) == 0x0018) + restore |= VGA_SR_CMAP; pNv->riva.LoadStateExt(&pNv->riva, nvReg); #if defined(__powerpc__) - restoreFonts = FALSE; + restore &= ~VGA_SR_FONTS; #endif - vgaHWRestore(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | - (restoreFonts? VGA_SR_FONTS : 0)); + vgaHWRestore(pScrn, vgaReg, restore); } /* @@ -184,8 +246,17 @@ { NVPtr pNv = NVPTR(pScrn); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVDACSave\n")); - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | (saveFonts? VGA_SR_FONTS : 0)); + +#if defined(__powerpc__) + saveFonts = FALSE; +#endif + + vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | + (saveFonts? VGA_SR_FONTS : 0)); pNv->riva.UnloadStateExt(&pNv->riva, nvReg); + + if((pNv->Chipset & 0x0ff0) == 0x0110) + nvReg->crtcOwner = ((pNv->Chipset & 0x0fff) == 0x0112) ? 3 : 0; } #define DEPTH_SHIFT(val, w) ((val << (8 - w)) | (val >> ((w << 1) - 8))) @@ -258,7 +329,7 @@ while(!(VGA_RD08(pNv->riva.PCIO, 0x3da) & 0x08)); /* Get the result */ - VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3e); + VGA_WR08(pNv->riva.PCIO, 0x3d4, pNv->DDCBase); val = VGA_RD08(pNv->riva.PCIO, 0x3d5); DEBUG(ErrorF("NV_ddc1Read(%p,...) returns %d\n", pScrn, val)); @@ -272,7 +343,7 @@ unsigned char val; /* Get the result. */ - VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3e); + VGA_WR08(pNv->riva.PCIO, 0x3d4, pNv->DDCBase); val = VGA_RD08(pNv->riva.PCIO, 0x3d5); *clock = (val & DDC_SCL_READ_MASK) != 0; @@ -287,7 +358,7 @@ NVPtr pNv = NVPTR(xf86Screens[b->scrnIndex]); unsigned char val; - VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3f); + VGA_WR08(pNv->riva.PCIO, 0x3d4, pNv->DDCBase + 1); val = VGA_RD08(pNv->riva.PCIO, 0x3d5) & 0xf0; if (clock) val |= DDC_SCL_WRITE_MASK; @@ -299,7 +370,7 @@ else val &= ~DDC_SDA_WRITE_MASK; - VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3f); + VGA_WR08(pNv->riva.PCIO, 0x3d4, pNv->DDCBase + 1); VGA_WR08(pNv->riva.PCIO, 0x3d5, val | 0x1); DEBUG(ErrorF("NV_I2CPutBits(%p, %d, %d) val=0x%x\n", b, clock, data, val)); Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c:1.10 Mon Jan 22 16:32:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c Fri Jan 25 16:56:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c,v 1.10 2001/01/22 21:32:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c,v 1.11 2002/01/25 21:56:06 tsi Exp $ */ #include "nv_local.h" #include "nv_include.h" @@ -234,8 +234,8 @@ NVAdjustFrame(pScrn->pScreen->myNum, x, y, flags); - while(pNv->riva.PCIO[0x3da] & 0x08); - while(!(pNv->riva.PCIO[0x3da] & 0x08)); + while(VGA_RD08(pNv->riva.PCIO, 0x3da) & 0x08); + while(!(VGA_RD08(pNv->riva.PCIO, 0x3da) & 0x08)); pNv->DGAViewportStatus = 0; } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.81 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.101 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.81 Fri Jan 4 16:22:33 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c Mon Feb 10 18:42:51 2003 @@ -24,16 +24,10 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.81 2002/01/04 21:22:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.101 2003/02/10 23:42:51 mvojkovi Exp $ */ #include "nv_include.h" -/* Little hack to declare all the base pointers */ -#define extern -#include "nvreg.h" -#undef extern -#include "nvvga.h" - #include "xf86int10.h" /* @@ -85,84 +79,94 @@ 0 }; -/* Supported chipsets */ -static SymTabRec NVChipsets[] = { - { NV_CHIP_RIVA128, "RIVA128" }, - { NV_CHIP_TNT, "RIVA TNT" }, - { NV_CHIP_TNT2, "RIVA TNT2" }, - { NV_CHIP_UTNT2, "RIVA TNT2 Ultra" }, - { NV_CHIP_VTNT2, "Vanta" }, - { NV_CHIP_UVTNT2, "RIVA TNT2 M64" }, - { NV_CHIP_ITNT2, "Aladdin TNT2" }, - { NV_CHIP_GEFORCE256, "GeForce 256" }, - { NV_CHIP_GEFORCEDDR, "GeForce DDR" }, - { NV_CHIP_QUADRO, "Quadro" }, - { NV_CHIP_GEFORCE2GTS, "GeForce2 GTS/Pro"}, - { NV_CHIP_GEFORCE2GTS_1,"GeForce2 Ti"}, - { NV_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra"}, - { NV_CHIP_QUADRO2PRO, "Quadro2 Pro"}, - { NV_CHIP_GEFORCE2MX, "GeForce2 MX/MX 400"}, - { NV_CHIP_GEFORCE2MXDDR, "GeForce2 MX 100/200"}, - { NV_CHIP_0x0170, "0x0170" }, - { NV_CHIP_0x0171, "0x0171" }, - { NV_CHIP_0x0172, "0x0172" }, - { NV_CHIP_0x0173, "0x0173" }, - { NV_CHIP_0x0174, "0x0174" }, - { NV_CHIP_0x0175, "0x0175" }, - { NV_CHIP_0x0178, "0x0178" }, - { NV_CHIP_0x017A, "0x017A" }, - { NV_CHIP_0x017B, "0x017B" }, - { NV_CHIP_0x017C, "0x017C" }, - { NV_CHIP_IGEFORCE2, "GeForce2 Integrated"}, - { NV_CHIP_QUADRO2MXR, "Quadro2 MXR"}, - { NV_CHIP_GEFORCE2GO, "GeForce2 Go"}, - { NV_CHIP_GEFORCE3, "GeForce3"}, - { NV_CHIP_GEFORCE3_1, "GeForce3 Ti 200"}, - { NV_CHIP_GEFORCE3_2, "GeForce3 Ti 500"}, - { NV_CHIP_QUADRO_DDC, "Quadro DDC"}, - { NV_CHIP_0x0250, "0x0250"}, - { NV_CHIP_0x0258, "0x0258"}, - {-1, NULL } +static SymTabRec NVKnownChipsets[] = +{ + { 0x12D20018, "RIVA 128" }, + { 0x10DE0020, "RIVA TNT" }, + { 0x10DE0028, "RIVA TNT2" }, + { 0x10DE002C, "Vanta" }, + { 0x10DE0029, "RIVA TNT2 Ultra" }, + { 0x10DE002D, "RIVA TNT2 Model 64" }, + { 0x10DE00A0, "Aladdin TNT2" }, + { 0x10DE0100, "GeForce 256" }, + { 0x10DE0101, "GeForce DDR" }, + { 0x10DE0103, "Quadro" }, + { 0x10DE0110, "GeForce2 MX/MX 400" }, + { 0x10DE0111, "GeForce2 MX 100/200" }, + { 0x10DE0112, "GeForce2 Go" }, + { 0x10DE0113, "Quadro2 MXR/EX/Go" }, + { 0x10DE01A0, "GeForce2 Integrated GPU" }, + { 0x10DE0150, "GeForce2 GTS" }, + { 0x10DE0151, "GeForce2 Ti" }, + { 0x10DE0152, "GeForce2 Ultra" }, + { 0x10DE0153, "Quadro2 Pro" }, + { 0x10DE0170, "GeForce4 MX 460" }, + { 0x10DE0171, "GeForce4 MX 440" }, + { 0x10DE0172, "GeForce4 MX 420" }, + { 0x10DE0173, "GeForce4 MX 440-SE" }, + { 0x10DE0174, "GeForce4 440 Go" }, + { 0x10DE0175, "GeForce4 420 Go" }, + { 0x10DE0176, "GeForce4 420 Go 32M" }, + { 0x10DE0177, "GeForce4 460 Go" }, + { 0x10DE0179, "GeForce4 440 Go 64M" }, + { 0x10DE017D, "GeForce4 410 Go 16M" }, + { 0x10DE017C, "Quadro4 500 GoGL" }, + { 0x10DE0178, "Quadro4 550 XGL" }, + { 0x10DE017A, "Quadro4 NVS" }, + { 0x10DE0181, "GeForce4 MX 440 with AGP8X" }, + { 0x10DE0182, "GeForce4 MX 440SE with AGP8X" }, + { 0x10DE0183, "GeForce4 MX 420 with AGP8X" }, + { 0x10DE0186, "GeForce4 448 Go" }, + { 0x10DE0187, "GeForce4 488 Go" }, + { 0x10DE0188, "Quadro4 580 XGL" }, + { 0x10DE018A, "Quadro4 280 NVS" }, + { 0x10DE018B, "Quadro4 380 XGL" }, + { 0x10DE01F0, "GeForce4 MX Integrated GPU" }, + { 0x10DE0200, "GeForce3" }, + { 0x10DE0201, "GeForce3 Ti 200" }, + { 0x10DE0202, "GeForce3 Ti 500" }, + { 0x10DE0203, "Quadro DCC" }, + { 0x10DE0250, "GeForce4 Ti 4600" }, + { 0x10DE0251, "GeForce4 Ti 4400" }, + { 0x10DE0252, "0x0252" }, + { 0x10DE0253, "GeForce4 Ti 4200" }, + { 0x10DE0258, "Quadro4 900 XGL" }, + { 0x10DE0259, "Quadro4 750 XGL" }, + { 0x10DE025B, "Quadro4 700 XGL" }, + { 0x10DE0280, "GeForce4 Ti 4800" }, + { 0x10DE0281, "GeForce4 Ti 4200 with AGP8X" }, + { 0x10DE0282, "GeForce4 Ti 4800 SE" }, + { 0x10DE0286, "GeForce4 4200 Go" }, + { 0x10DE028C, "Quadro4 700 GoGL" }, + { 0x10DE0288, "Quadro4 980 XGL" }, + { 0x10DE0289, "Quadro4 780 XGL" }, + { 0x10DE0300, "0x0300" }, + { 0x10DE0301, "GeForce FX 5800 Ultra" }, + { 0x10DE0302, "GeForce FX 5800" }, + { 0x10DE0308, "Quadro FX 2000" }, + { 0x10DE0309, "Quadro FX 1000" }, + { 0x10DE0311, "0x0311" }, + { 0x10DE0312, "0x0312" }, + { 0x10DE0316, "0x0316" }, + { 0x10DE0317, "0x0317" }, + { 0x10DE0318, "0x0318" }, + { 0x10DE0319, "0x0319" }, + { 0x10DE031A, "0x031A" }, + { 0x10DE031B, "0x031B" }, + { 0x10DE031C, "0x031C" }, + { 0x10DE031D, "0x031D" }, + { 0x10DE031E, "0x031E" }, + { 0x10DE031F, "0x031F" }, + { 0x10DE0321, "0x0321" }, + { 0x10DE0322, "0x0322" }, + { 0x10DE0323, "0x0323" }, + { 0x10DE0326, "0x0326" }, + { 0x10DE032A, "0x032A" }, + { 0x10DE032B, "0x032B" }, + { 0x10DE032E, "0x032E" }, + {-1, NULL} }; -static PciChipsets NVPciChipsets[] = { - { NV_CHIP_RIVA128, NV_CHIP_RIVA128, RES_SHARED_VGA }, - { NV_CHIP_TNT, NV_CHIP_TNT, RES_SHARED_VGA }, - { NV_CHIP_TNT2, NV_CHIP_TNT2, RES_SHARED_VGA }, - { NV_CHIP_UTNT2, NV_CHIP_UTNT2, RES_SHARED_VGA }, - { NV_CHIP_VTNT2, NV_CHIP_VTNT2, RES_SHARED_VGA }, - { NV_CHIP_UVTNT2, NV_CHIP_UVTNT2, RES_SHARED_VGA }, - { NV_CHIP_ITNT2, NV_CHIP_ITNT2, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE256, NV_CHIP_GEFORCE256, RES_SHARED_VGA }, - { NV_CHIP_GEFORCEDDR, NV_CHIP_GEFORCEDDR, RES_SHARED_VGA }, - { NV_CHIP_QUADRO, NV_CHIP_QUADRO, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE2GTS, NV_CHIP_GEFORCE2GTS, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE2GTS_1, NV_CHIP_GEFORCE2GTS_1, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE2ULTRA, NV_CHIP_GEFORCE2ULTRA, RES_SHARED_VGA }, - { NV_CHIP_QUADRO2PRO, NV_CHIP_QUADRO2PRO, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE2MX, NV_CHIP_GEFORCE2MX, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE2MXDDR, NV_CHIP_GEFORCE2MXDDR, RES_SHARED_VGA }, - { NV_CHIP_0x0170, NV_CHIP_0x0170, RES_SHARED_VGA }, - { NV_CHIP_0x0171, NV_CHIP_0x0171, RES_SHARED_VGA }, - { NV_CHIP_0x0172, NV_CHIP_0x0172, RES_SHARED_VGA }, - { NV_CHIP_0x0173, NV_CHIP_0x0173, RES_SHARED_VGA }, - { NV_CHIP_0x0174, NV_CHIP_0x0174, RES_SHARED_VGA }, - { NV_CHIP_0x0175, NV_CHIP_0x0175, RES_SHARED_VGA }, - { NV_CHIP_0x0178, NV_CHIP_0x0178, RES_SHARED_VGA }, - { NV_CHIP_0x017A, NV_CHIP_0x017A, RES_SHARED_VGA }, - { NV_CHIP_0x017B, NV_CHIP_0x017B, RES_SHARED_VGA }, - { NV_CHIP_0x017C, NV_CHIP_0x017C, RES_SHARED_VGA }, - { NV_CHIP_IGEFORCE2, NV_CHIP_IGEFORCE2, RES_SHARED_VGA }, - { NV_CHIP_QUADRO2MXR, NV_CHIP_QUADRO2MXR, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE2GO, NV_CHIP_GEFORCE2GO, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE3, NV_CHIP_GEFORCE3, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE3_1, NV_CHIP_GEFORCE3_1, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE3_2, NV_CHIP_GEFORCE3_2, RES_SHARED_VGA }, - { NV_CHIP_QUADRO_DDC, NV_CHIP_QUADRO_DDC, RES_SHARED_VGA }, - { NV_CHIP_0x0250, NV_CHIP_0x0250, RES_SHARED_VGA }, - { NV_CHIP_0x0258, NV_CHIP_0x0258, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } -}; /* * List of symbols from other modules that this module references. This @@ -179,13 +183,11 @@ "vgaHWGetHWRec", "vgaHWGetIndex", "vgaHWInit", - "vgaHWLock", "vgaHWMapMem", "vgaHWProtect", "vgaHWRestore", "vgaHWSave", "vgaHWSaveScreen", - "vgaHWUnlock", "vgaHWddc1SetSpeed", NULL }; @@ -305,7 +307,9 @@ OPTION_FBDEV, OPTION_ROTATE, OPTION_VIDEO_KEY, - OPTION_FLAT_PANEL + OPTION_FLAT_PANEL, + OPTION_FP_DITHER, + OPTION_CRTC_NUMBER } NVOpts; @@ -319,6 +323,8 @@ { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_FLAT_PANEL, "FlatPanel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FP_DITHER, "FPDither", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CRTC_NUMBER, "CrtcNumber", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -333,7 +339,7 @@ */ static NVRamdacRec DacInit = { FALSE, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, - 0, NULL, NULL, NULL, NULL, NULL + 0, NULL, NULL, NULL, NULL }; @@ -420,10 +426,12 @@ static void NVIdentify(int flags) { - xf86PrintChipsets(NV_NAME, "driver for NVIDIA chipsets", NVChipsets); + xf86PrintChipsets(NV_NAME, "driver for NVIDIA chipsets", NVKnownChipsets); } +#define MAX_CHIPS MAXSCREENS + /* Mandatory */ static Bool NVProbe(DriverPtr drv, int flags) @@ -431,65 +439,82 @@ int i; GDevPtr *devSections; int *usedChips; + SymTabRec NVChipsets[MAX_CHIPS + 1]; + PciChipsets NVPciChipsets[MAX_CHIPS + 1]; + pciVideoPtr *ppPci; int numDevSections; int numUsed; Bool foundScreen = FALSE; - /* - * The aim here is to find all cards that this driver can handle, - * and for the ones not already claimed by another driver, claim the - * slot, and allocate a ScrnInfoRec. - * - * This should be a minimal probe, and it should under no circumstances - * change the state of the hardware. Because a device is found, don't - * assume that it will be used. Don't do any initialisations other than - * the required ScrnInfoRec initialisations. Don't allocate any new - * data structures. - */ - /* - * Check if there has been a chipset override in the config file. - * For this we must find out if there is an active device section which - * is relevant, i.e., which has no driver specified or has THIS driver - * specified. - */ + if ((numDevSections = xf86MatchDevice(NV_DRIVER_NAME, &devSections)) <= 0) + return FALSE; /* no matching device section */ - if ((numDevSections = xf86MatchDevice(NV_DRIVER_NAME, - &devSections)) <= 0) { - /* - * There's no matching device section in the config file, so quit - * now. - */ - return FALSE; - } + if (!(ppPci = xf86GetPciVideoInfo())) + return FALSE; /* no PCI cards found */ - /* - * We need to probe the hardware first. We then need to see how this - * fits in with what is given in the config file, and allow the config - * file info to override any contradictions. - */ + numUsed = 0; - /* - * All of the cards this driver supports are PCI, so the "probing" just - * amounts to checking the PCI data that the server has already collected. - */ - if (xf86GetPciVideoInfo() == NULL) { - /* - * We won't let anything in the config file override finding no - * PCI video cards at all. This seems reasonable now, but we'll see. - */ - return FALSE; - } + /* Create the NVChipsets and NVPciChipsets from found devices */ + while (*ppPci && (numUsed < MAX_CHIPS)) { + if(((*ppPci)->vendor == PCI_VENDOR_NVIDIA_SGS) || + ((*ppPci)->vendor == PCI_VENDOR_NVIDIA)) + { + SymTabRec *nvchips = NVKnownChipsets; + int token = ((*ppPci)->vendor << 16) | (*ppPci)->chipType; + + while(nvchips->name) { + if(token == nvchips->token) + break; + nvchips++; + } + + if(nvchips->name) { /* found one */ + NVChipsets[numUsed].token = nvchips->token; + NVChipsets[numUsed].name = nvchips->name; + NVPciChipsets[numUsed].numChipset = nvchips->token; + NVPciChipsets[numUsed].PCIid = nvchips->token; + NVPciChipsets[numUsed].resList = RES_SHARED_VGA; + numUsed++; + } else if ((*ppPci)->vendor == PCI_VENDOR_NVIDIA) { + /* look for a compatible devices which may be newer than + the NVKnownChipsets list above. */ + switch(token & 0xfff0) { + case 0x0170: + case 0x0180: + case 0x0250: + case 0x0280: + case 0x0300: + case 0x0310: + case 0x0320: + case 0x0330: + case 0x0340: + NVChipsets[numUsed].token = token; + NVChipsets[numUsed].name = "Unknown NVIDIA chip"; + NVPciChipsets[numUsed].numChipset = token; + NVPciChipsets[numUsed].PCIid = token; + NVPciChipsets[numUsed].resList = RES_SHARED_VGA; + numUsed++; + break; + default: break; /* we don't recognize it */ + } + } + } + ppPci++; + } + + /* terminate the list */ + NVChipsets[numUsed].token = -1; + NVChipsets[numUsed].name = NULL; + NVPciChipsets[numUsed].numChipset = -1; + NVPciChipsets[numUsed].PCIid = -1; + NVPciChipsets[numUsed].resList = RES_UNDEFINED; - /* This should match both vendors, PCI_VENDOR_NVIDIA_SGS and - PCI_VENDOR_NVIDIA, see above */ numUsed = xf86MatchPciInstances(NV_NAME, 0, NVChipsets, NVPciChipsets, devSections, numDevSections, drv, &usedChips); - /* Free it since we don't need that list after this */ - xfree(devSections); - if (numUsed <= 0) + if (numUsed <= 0) return FALSE; if (flags & PROBE_DETECT) @@ -518,7 +543,10 @@ foundScreen = TRUE; } } + + xfree(devSections); xfree(usedChips); + return foundScreen; } @@ -566,15 +594,15 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; NVPtr pNv = NVPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "NVEnterVT\n")); - vgaHWUnlock(hwp); - pNv->riva.LockUnlock(&pNv->riva, 0); if (!NVModeInit(pScrn, pScrn->currentMode)) return FALSE; NVAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + if(pNv->overlayAdaptor) + NVResetVideo(pScrn); return TRUE; } @@ -600,13 +628,11 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; NVPtr pNv = NVPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "NVLeaveVT\n")); NVRestore(pScrn); pNv->riva.LockUnlock(&pNv->riva, 1); - vgaHWLock(hwp); } @@ -645,7 +671,6 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - vgaHWPtr hwp = VGAHWPTR(pScrn); NVPtr pNv = NVPTR(pScrn); DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "NVCloseScreen\n")); @@ -653,7 +678,6 @@ if (pScrn->vtSema) { NVRestore(pScrn); pNv->riva.LockUnlock(&pNv->riva, 1); - vgaHWLock(hwp); } NVUnmapMem(pScrn); @@ -732,6 +756,7 @@ return MonInfo; } +#if 0 static xf86MonPtr nvDoDDC1(ScrnInfoPtr pScrn) { @@ -752,7 +777,9 @@ } return MonInfo; } +#endif +/* static xf86MonPtr nvDoDDCVBE(ScrnInfoPtr pScrn) { @@ -776,18 +803,16 @@ } return MonInfo; } - +*/ /* Internally used */ -static xf86MonPtr +xf86MonPtr NVdoDDC(ScrnInfoPtr pScrn) { - vgaHWPtr hwp; NVPtr pNv; NVRamdacPtr NVdac; xf86MonPtr MonInfo = NULL; - hwp = VGAHWPTR(pScrn); pNv = NVPTR(pScrn); NVdac = &pNv->Dac; @@ -800,7 +825,6 @@ /* if ((MonInfo = nvDoDDCVBE(pScrn))) return MonInfo; */ /* Enable access to extended registers */ - vgaHWUnlock(hwp); pNv->riva.LockUnlock(&pNv->riva, 0); /* Save the current state */ NVSave(pScrn); @@ -814,7 +838,6 @@ /* Restore previous state */ NVRestore(pScrn); pNv->riva.LockUnlock(&pNv->riva, 1); - vgaHWLock(hwp); return MonInfo; } @@ -885,25 +908,16 @@ pNv->Primary = xf86IsPrimaryPci(pNv->PciInfo); /* Initialize the card through int10 interface if needed */ - if (xf86LoadSubModule(pScrn, "int10")){ + if (xf86LoadSubModule(pScrn, "int10")) { xf86LoaderReqSymLists(int10Symbols, NULL); #if !defined(__alpha__) && !defined(__powerpc__) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pNv->pInt = xf86InitInt10(pNv->pEnt->index); #endif - } - - { - resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, - {ResShrIoBlock,0x3C0,0x3DF}, - _END }; - resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - {ResShrMemBlock,0xB0000,0xB7FFF}, - _END }; - xf86SetOperatingState(vgaio, pNv->pEnt->index, ResUnusedOpr); - xf86SetOperatingState(vgamem, pNv->pEnt->index, ResDisableOpr); } + + xf86SetOperatingState(resVgaIo, pNv->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pNv->pEnt->index, ResDisableOpr); /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -914,18 +928,22 @@ */ if (pNv->pEnt->device->chipset && *pNv->pEnt->device->chipset) { pScrn->chipset = pNv->pEnt->device->chipset; - pNv->Chipset = xf86StringToToken(NVChipsets, pScrn->chipset); + pNv->Chipset = xf86StringToToken(NVKnownChipsets, pScrn->chipset); from = X_CONFIG; } else if (pNv->pEnt->device->chipID >= 0) { pNv->Chipset = pNv->pEnt->device->chipID; - pScrn->chipset = (char *)xf86TokenToString(NVChipsets, pNv->Chipset); + pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets, + pNv->Chipset); from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", pNv->Chipset); } else { from = X_PROBED; - pNv->Chipset = (pNv->PciInfo->vendor << 16) |pNv->PciInfo->chipType; - pScrn->chipset = (char *)xf86TokenToString(NVChipsets, pNv->Chipset); + pNv->Chipset = (pNv->PciInfo->vendor << 16) | pNv->PciInfo->chipType; + pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets, + pNv->Chipset); + if(!pScrn->chipset) + pScrn->chipset = "Unknown NVIDIA chipset"; } if (pNv->pEnt->device->chipRev >= 0) { pNv->ChipRev = pNv->pEnt->device->chipRev; @@ -972,7 +990,7 @@ /* OK */ break; case 16: - if(pNv->Chipset == NV_CHIP_RIVA128) { + if((pNv->Chipset & 0xffff) == 0x0018) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "The Riva 128 chipset does not support depth 16. " "Using depth 15 instead\n"); @@ -1141,10 +1159,27 @@ (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); } - if (xf86ReturnOptValBool(pNv->Options, OPTION_FLAT_PANEL, FALSE)) { - pNv->FlatPanel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "using flat panel\n"); + if (xf86GetOptValBool(pNv->Options, OPTION_FLAT_PANEL, &(pNv->FlatPanel))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "forcing %s usage\n", + pNv->FlatPanel ? "DFP" : "CRTC"); + } else { + pNv->FlatPanel = -1; /* autodetect later */ } + + pNv->FPDither = FALSE; + if (xf86GetOptValBool(pNv->Options, OPTION_FP_DITHER, &(pNv->FPDither))) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "enabling flat panel dither\n"); + + if (xf86GetOptValInteger(pNv->Options, OPTION_CRTC_NUMBER, + &pNv->forceCRTC)) + { + if((pNv->forceCRTC < 0) || (pNv->forceCRTC > 1)) { + pNv->forceCRTC = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Invalid CRTC number. Must be 0 or 1\n"); + } + } else pNv->forceCRTC = -1; + if (pNv->pEnt->device->MemBase != 0) { /* Require that the config file value matches one of the PCI values. */ @@ -1211,6 +1246,8 @@ return FALSE; } + pNv->alphaCursor = ((pNv->Chipset & 0x0ff0) >= 0x0110); + switch (pNv->Chipset & 0x0ff0) { case 0x0010: NV3Setup(pScrn); @@ -1223,22 +1260,24 @@ case 0x0110: case 0x0150: case 0x0170: + case 0x0180: case 0x01A0: + case 0x01F0: NV10Setup(pScrn); break; - case 0x0200: - case 0x0250: + case 0x0200: + case 0x0250: + case 0x0280: + case 0x0300: + case 0x0310: + case 0x0320: + case 0x0330: + case 0x0340: NV20Setup(pScrn); break; } /* - * fill riva structure etc. - */ - (*pNv->PreInit)(pScrn); - - - /* * If the user has specified the amount of memory in the XF86Config * file, we respect that setting. */ @@ -1258,42 +1297,6 @@ pNv->FbMapSize = pScrn->videoRam * 1024; -#if !defined(__powerpc__) - /* Read and print the Monitor DDC info */ - pScrn->monitor->DDC = NVdoDDC(pScrn); -#endif - -#if 0 - /* - * This code was for testing. It will be removed as soon - * as this is integrated into the common level. - */ - if ((!pScrn->monitor->nHsync || !pScrn->monitor->nVrefresh) - && pScrn->monitor->DDC) { - int i; - int h = (!pScrn->monitor->nHsync) ? 0 : -1; - int v = (!pScrn->monitor->nVrefresh) ? 0 : -1; - xf86MonPtr pMon = (xf86MonPtr)pScrn->monitor->DDC; - for (i = 0; i < DET_TIMINGS; i++) { - if (pMon->det_mon[i].type == DS_RANGES) { - if (h != -1) { - pScrn->monitor->hsync[h].lo - = pMon->det_mon[i].section.ranges.min_h; - pScrn->monitor->hsync[h++].hi - = pMon->det_mon[i].section.ranges.max_h; - } - if (v != -1) { - pScrn->monitor->vrefresh[v].lo - = pMon->det_mon[i].section.ranges.min_v; - pScrn->monitor->vrefresh[v++].hi - = pMon->det_mon[i].section.ranges.max_v; - } - } - } - if (h != -1) pScrn->monitor->nHsync = h; - if (v != -1) pScrn->monitor->nVrefresh = v; - } -#endif /* * If the driver can do gamma correction, it should call xf86SetGamma() * here. @@ -1318,6 +1321,7 @@ case NV_ARCH_04: case NV_ARCH_10: case NV_ARCH_20: + default: pNv->FbUsableSize -= 128 * 1024; break; } @@ -1344,6 +1348,11 @@ clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = TRUE; + if(pNv->FlatPanel == 1) { + clockRanges->interlaceAllowed = FALSE; + clockRanges->doubleScanAllowed = FALSE; + } + /* * xf86ValidateModes will check that the mode HTotal and VTotal values * don't exceed the chipset's limit if pScrn->maxHValue and @@ -1538,9 +1547,7 @@ /* - * Initialise a new mode. This is currently still using the old - * "initialise struct, restore/write struct to HW" model. That could - * be changed. + * Initialise a new mode. */ static Bool @@ -1558,18 +1565,15 @@ return FALSE; pScrn->vtSema = TRUE; - if ( pNv->ModeInit ) { - if (!(*pNv->ModeInit)(pScrn, mode)) - return FALSE; - } + if(!(*pNv->ModeInit)(pScrn, mode)) + return FALSE; /* Program the registers */ vgaHWProtect(pScrn, TRUE); vgaReg = &hwp->ModeReg; nvReg = &pNv->ModeReg; - if ( pNv->Restore ) - (*pNv->Restore)(pScrn, vgaReg, nvReg, FALSE); + (*pNv->Restore)(pScrn, vgaReg, nvReg, FALSE); #if X_BYTE_ORDER == X_BIG_ENDIAN /* turn on LFB swapping */ @@ -1606,14 +1610,39 @@ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVRestore\n")); /* Only restore text mode fonts/text for the primary card */ vgaHWProtect(pScrn, TRUE); - if (pNv->Primary) - (*pNv->Restore)(pScrn, vgaReg, nvReg, TRUE); - else - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + (*pNv->Restore)(pScrn, vgaReg, nvReg, pNv->Primary); vgaHWProtect(pScrn, FALSE); } +static void +NVDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) +{ + unsigned char crtc1A; + vgaHWPtr hwp = VGAHWPTR(pScrn); + + if (!pScrn->vtSema) return; + + crtc1A = hwp->readCrtc(hwp, 0x1A) & ~0xC0; + switch (PowerManagementMode) { + case DPMSModeStandby: /* HSync: Off, VSync: On */ + crtc1A |= 0x80; + break; + case DPMSModeSuspend: /* HSync: On, VSync: Off */ + crtc1A |= 0x40; + break; + case DPMSModeOff: /* HSync: Off, VSync: Off */ + crtc1A |= 0xC0; + break; + case DPMSModeOn: /* HSync: On, VSync: On */ + default: + break; + } + + hwp->writeCrtc(hwp, 0x1A, crtc1A); +} + + /* Mandatory */ /* This gets called at the start of each server generation */ @@ -1666,7 +1695,6 @@ return FALSE; } else { /* Save the current state */ - vgaHWUnlock(hwp); pNv->riva.LockUnlock(&pNv->riva, 0); NVSave(pScrn); /* Initialise the first mode */ @@ -1848,7 +1876,11 @@ /* Call the vgaHW DPMS function directly. XXX There must be a way to get all the DPMS modes. */ +#if 0 xf86DPMSInit(pScreen, vgaHWDPMSSet, 0); +#else + xf86DPMSInit(pScreen, NVDPMSSet, 0); +#endif DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- DPMS set up\n")); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Color maps etc. set up\n")); @@ -1897,12 +1929,6 @@ vgaRegPtr vgaReg = &pVga->SavedReg; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVSave\n")); -#if defined(__powerpc__) - /* The console driver will have to save the fonts, we can't */ - vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE); -#else - vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | VGA_SR_FONTS); -#endif - pNv->riva.UnloadStateExt(&pNv->riva, nvReg); + (*pNv->Save)(pScrn, vgaReg, nvReg, pNv->Primary); } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h:1.6 Fri Nov 3 13:46:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h Fri Jan 25 16:56:06 2002 @@ -36,40 +36,39 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h,v 1.6 2000/11/03 18:46:12 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h,v 1.7 2002/01/25 21:56:06 tsi Exp $ */ #ifndef __NV_LOCAL_H__ #define __NV_LOCAL_H__ + /* - * This file includes any environment or machine specific values to access the HW. - * Put all affected includes, typdefs, etc. here so the riva_hw.* files can stay - * generic in nature. + * This file includes any environment or machine specific values to access the + * HW. Put all affected includes, typdefs, etc. here so the riva_hw.* files + * can stay generic in nature. */ #include "xf86_ansic.h" #include "compiler.h" +#include "xf86_OSproc.h" + /* * Typedefs to force certain sized values. */ typedef unsigned char U008; typedef unsigned short U016; typedef unsigned int U032; + /* - * HW access macros. + * HW access macros. These assume memory-mapped I/O, and not normal I/O space. */ -#include "xf86_OSproc.h" -/* these assume memory-mapped I/O, and not normal I/O space */ #define NV_WR08(p,i,d) MMIO_OUT8((volatile pointer)(p), (i), (d)) #define NV_RD08(p,i) MMIO_IN8((volatile pointer)(p), (i)) #define NV_WR16(p,i,d) MMIO_OUT16((volatile pointer)(p), (i), (d)) #define NV_RD16(p,i) MMIO_IN16((volatile pointer)(p), (i)) #define NV_WR32(p,i,d) MMIO_OUT32((volatile pointer)(p), (i), (d)) #define NV_RD32(p,i) MMIO_IN32((volatile pointer)(p), (i)) -#if 1 + +/* VGA I/O is now always done through MMIO */ #define VGA_WR08(p,i,d) NV_WR08(p,i,d) #define VGA_RD08(p,i) NV_RD08(p,i) -#else -#define VGA_WR08(p,i,d) outb(i,d) -#define VGA_RD08(p,i) inb(i) -#endif -#endif /* __NV_LOCAL_H__ */ +#endif /* __NV_LOCAL_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h:1.6 Tue Mar 27 20:17:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h Tue Nov 26 18:41:59 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.6 2001/03/28 01:17:43 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.8 2002/11/26 23:41:59 mvojkovi Exp $ */ #ifndef __NV_PROTO_H__ #define __NV_PROTO_H__ @@ -6,7 +6,9 @@ /* in nv_driver.c */ Bool NVSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); void NVAdjustFrame(int scrnIndex, int x, int y, int flags); +xf86MonPtr NVdoDDC(ScrnInfoPtr pScrn); + /* in nv_dac.c */ void NVRamdacInit(ScrnInfoPtr pScrn); Bool NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode); @@ -19,6 +21,7 @@ /* in nv_video.c */ void NVInitVideo(ScreenPtr); +void NVResetVideo (ScrnInfoPtr pScrnInfo); /* in nv_setup.c */ void RivaEnterLeave(ScrnInfoPtr pScrn, Bool enter); Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.11 Tue Oct 30 14:38:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c Mon Feb 10 18:42:51 2003 @@ -24,13 +24,10 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.11 2001/10/30 19:38:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.27 2003/02/10 23:42:51 mvojkovi Exp $ */ #include "nv_include.h" -#include "nvreg.h" -#include "nvvga.h" - /* * Override VGA I/O routines. */ @@ -155,7 +152,111 @@ return (VGA_RD08(pNv->riva.PDIO, VGA_DAC_DATA)); } +static Bool +NVIsConnected (ScrnInfoPtr pScrn, Bool second) +{ + NVPtr pNv = NVPTR(pScrn); + volatile U032 *PRAMDAC = pNv->riva.PRAMDAC0; + CARD32 reg52C, reg608; + Bool present; + + if(second) PRAMDAC += 0x800; + + reg52C = PRAMDAC[0x052C/4]; + reg608 = PRAMDAC[0x0608/4]; + + PRAMDAC[0x0608/4] = reg608 & ~0x00010000; + + PRAMDAC[0x052C/4] = reg52C & 0x0000FEEE; + usleep(1000); + PRAMDAC[0x052C/4] |= 1; + + pNv->riva.PRAMDAC0[0x0610/4] = 0x94050140; + pNv->riva.PRAMDAC0[0x0608/4] |= 0x00001000; + + usleep(1000); + + present = (PRAMDAC[0x0608/4] & (1 << 28)) ? TRUE : FALSE; + + pNv->riva.PRAMDAC0[0x0608/4] &= 0x0000EFFF; + + PRAMDAC[0x052C/4] = reg52C; + PRAMDAC[0x0608/4] = reg608; + + return present; +} + +static void +NVOverrideCRTC(ScrnInfoPtr pScrn) +{ + NVPtr pNv = NVPTR(pScrn); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected CRTC controller %i being used\n", + pNv->SecondCRTC ? 1 : 0); + + if(pNv->forceCRTC != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Forcing usage of CRTC %i\n", pNv->forceCRTC); + pNv->SecondCRTC = pNv->forceCRTC; + } +} + +static void +NVIsSecond (ScrnInfoPtr pScrn) +{ + NVPtr pNv = NVPTR(pScrn); + + if(pNv->FlatPanel == 1) { + switch(pNv->Chipset & 0xffff) { + case 0x0174: + case 0x0175: + case 0x0176: + case 0x0177: + case 0x0179: + case 0x017C: + case 0x017D: + case 0x0186: + case 0x0187: + /* this might not be a good default for the chips below */ + case 0x0286: + case 0x028C: + case 0x0316: + case 0x0317: + case 0x031A: + case 0x031B: + case 0x031C: + case 0x031D: + case 0x031E: + case 0x031F: + case 0x0326: + case 0x032E: + pNv->SecondCRTC = TRUE; + break; + default: + pNv->SecondCRTC = FALSE; + break; + } + } else { + if(NVIsConnected(pScrn, 0)) { + if(pNv->riva.PRAMDAC0[0x0000052C/4] & 0x100) + pNv->SecondCRTC = TRUE; + else + pNv->SecondCRTC = FALSE; + } else + if (NVIsConnected(pScrn, 1)) { + pNv->DDCBase = 0x36; + if(pNv->riva.PRAMDAC0[0x0000252C/4] & 0x100) + pNv->SecondCRTC = TRUE; + else + pNv->SecondCRTC = FALSE; + } else /* default */ + pNv->SecondCRTC = FALSE; + } + NVOverrideCRTC(pScrn); +} + static void NVCommonSetup(ScrnInfoPtr pScrn) { @@ -168,7 +269,6 @@ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Regbase %x\n", regBase)); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- riva %x\n", &pNv->riva)); - pNv->PreInit = NVRamdacInit; pNv->Save = NVDACSave; pNv->Restore = NVDACRestore; pNv->ModeInit = NVDACInit; @@ -216,9 +316,9 @@ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; - pNv->riva.PRAMDAC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, + pNv->riva.PRAMDAC0 = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00680000, 0x00003000); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PRAMDAC %x\n", pNv->riva.PRAMDAC)); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PRAMDAC %x\n", pNv->riva.PRAMDAC0)); pNv->riva.PFB = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00100000, 0x00001000); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PFB %x\n", pNv->riva.PFB)); @@ -245,22 +345,117 @@ * These registers are read/write as 8 bit values. Probably have to map * sparse on alpha. */ - pNv->riva.PCIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pNv->riva.PCIO0 = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00601000, - 0x00001000); - pNv->riva.PDIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + 0x00003000); + pNv->riva.PDIO0 = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00681000, - 0x00001000); + 0x00003000); pNv->riva.PVIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x000C0000, 0x00001000); - + + if(pNv->FlatPanel == -1) { + switch(pNv->Chipset & 0xffff) { + case 0x0112: /* known laptop chips */ + case 0x0174: + case 0x0175: + case 0x0176: + case 0x0177: + case 0x0179: + case 0x017C: + case 0x017D: + case 0x0186: + case 0x0187: + case 0x0286: + case 0x028C: + case 0x0316: + case 0x0317: + case 0x031A: + case 0x031B: + case 0x031C: + case 0x031D: + case 0x031E: + case 0x031F: + case 0x0326: + case 0x032E: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "On a laptop. Assuming Digital Flat Panel\n"); + pNv->FlatPanel = 1; + break; + default: + break; + } + } + + pNv->DDCBase = 0x3e; + + switch(pNv->Chipset & 0x0ff0) { + case 0x0110: + if((pNv->Chipset & 0xffff) == 0x0112) + pNv->SecondCRTC = TRUE; +#if defined(__powerpc__) + else if(pNv->FlatPanel == 1) + pNv->SecondCRTC = TRUE; +#endif + NVOverrideCRTC(pScrn); + break; + case 0x0170: + case 0x0180: + case 0x01F0: + case 0x0250: + case 0x0280: + case 0x0300: + case 0x0310: + case 0x0320: + case 0x0330: + case 0x0340: + NVIsSecond(pScrn); + break; + default: + break; + } + + if(pNv->SecondCRTC) { + pNv->riva.PCIO = pNv->riva.PCIO0 + 0x2000; + pNv->riva.PCRTC = pNv->riva.PCRTC0 + 0x800; + pNv->riva.PRAMDAC = pNv->riva.PRAMDAC0 + 0x800; + pNv->riva.PDIO = pNv->riva.PDIO0 + 0x2000; + } else { + pNv->riva.PCIO = pNv->riva.PCIO0; + pNv->riva.PCRTC = pNv->riva.PCRTC0; + pNv->riva.PRAMDAC = pNv->riva.PRAMDAC0; + pNv->riva.PDIO = pNv->riva.PDIO0; + } + RivaGetConfig(pNv); pNv->Dac.maxPixelClock = pNv->riva.MaxVClockFreqKHz; - vgaHWUnlock(VGAHWPTR(pScrn)); pNv->riva.LockUnlock(&pNv->riva, 0); + + NVRamdacInit(pScrn); + +#if !defined(__powerpc__) + /* Read and print the Monitor DDC info */ + pScrn->monitor->DDC = NVdoDDC(pScrn); +#endif + if(pNv->FlatPanel == -1) { + pNv->FlatPanel = 0; + if(pScrn->monitor->DDC) { + xf86MonPtr ddc = (xf86MonPtr)pScrn->monitor->DDC; + + if(ddc->features.input_type) { + pNv->FlatPanel = 1; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "autodetected Digital Flat Panel\n"); + } + } + } + pNv->riva.flatPanel = (pNv->FlatPanel > 0) ? FP_ENABLE : 0; + if(pNv->riva.flatPanel && pNv->FPDither && (pScrn->depth == 24)) + pNv->riva.flatPanel |= FP_DITHER; + } void @@ -289,6 +484,7 @@ frameBase+0x00C00000, 0x00008000); NVCommonSetup(pScrn); + pNv->riva.PCRTC = pNv->riva.PCRTC0 = pNv->riva.PGRAPH; } void @@ -307,11 +503,12 @@ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; pNv->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00710000, 0x00010000); - pNv->riva.PCRTC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, + pNv->riva.PCRTC0 = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00600000, 0x00001000); NVCommonSetup(pScrn); } + void NV10Setup(ScrnInfoPtr pScrn) { @@ -322,14 +519,11 @@ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV10Setup\n")); pNv->riva.Architecture = 0x10; - /* - * Map chip-specific memory-mapped registers. This MUST be done in the OS specific driver code. - */ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; pNv->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00710000, 0x00010000); - pNv->riva.PCRTC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, - regBase+0x00600000, 0x00001000); + pNv->riva.PCRTC0 = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, + regBase+0x00600000, 0x00003000); NVCommonSetup(pScrn); } @@ -341,18 +535,14 @@ CARD32 regBase = pNv->IOAddress; int mmioFlags; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV10Setup\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV20Setup\n")); pNv->riva.Architecture = 0x20; - /* - * Map chip-specific memory-mapped registers. This MUST be done in the OS sp -ecific driver code. - */ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; pNv->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00710000, 0x00010000); - pNv->riva.PCRTC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, - regBase+0x00600000, 0x00001000); + pNv->riva.PCRTC0 = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, + regBase+0x00600000, 0x00003000); NVCommonSetup(pScrn); } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.29 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.39 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.29 Thu Dec 6 19:09:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h Thu Nov 28 18:02:13 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.29 2001/12/07 00:09:56 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.39 2002/11/28 23:02:13 mvojkovi Exp $ */ #ifndef __NV_STRUCT_H__ #define __NV_STRUCT_H__ @@ -10,12 +10,15 @@ #include "xf86Cursor.h" #include "xf86int10.h" + +#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) +#define MASKEXPAND(mask) BITMASK(1?mask,0?mask) +#define SetBF(mask,value) ((value) << (0?mask)) +#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) #define SetBitField(value,from,to) SetBF(to, GetBF(value,from)) #define SetBit(n) (1<<(n)) #define Set8Bits(value) ((value)&0xff) -#define MAX_CURS 32 - typedef RIVA_HW_STATE* NVRegPtr; typedef struct { @@ -32,7 +35,6 @@ void (*SetCursorColors)(ScrnInfoPtr, int, int); long maxPixelClock; void (*LoadPalette)(ScrnInfoPtr, int, int*, LOCO*, VisualPtr); - void (*PreInit)(ScrnInfoPtr); void (*Save)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool); void (*Restore)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool); Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr); @@ -80,7 +82,6 @@ int numDGAModes; Bool DGAactive; int DGAViewportStatus; - void (*PreInit)(ScrnInfoPtr pScrn); void (*Save)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool); void (*Restore)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool); Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr); @@ -89,7 +90,6 @@ CloseScreenProcPtr CloseScreen; Bool FBDev; /* Color expansion */ - Bool useFifo; unsigned char *expandBuffer; unsigned char *expandFifo; int expandWidth; @@ -99,8 +99,8 @@ int Rotate; NVFBLayout CurrentLayout; /* Cursor */ - unsigned short curFg, curBg; - unsigned int curImage[MAX_CURS*2]; + CARD32 curFg, curBg; + CARD32 curImage[256]; /* Misc flags */ unsigned int opaqueMonochrome; int currentRop; @@ -113,8 +113,13 @@ void (*VideoTimerCallback)(ScrnInfoPtr, Time); XF86VideoAdaptorPtr overlayAdaptor; int videoKey; - Bool FlatPanel; + int FlatPanel; + Bool FPDither; + Bool SecondCRTC; + int forceCRTC; OptionInfoPtr Options; + Bool alphaCursor; + unsigned char DDCBase; } NVRec, *NVPtr; #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) @@ -126,41 +131,5 @@ void NVPointerMoved(int index, int x, int y); int RivaGetConfig(NVPtr); - -#define NV_CHIP_RIVA128 ((PCI_VENDOR_NVIDIA_SGS << 16)| PCI_CHIP_RIVA128) -#define NV_CHIP_TNT ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_TNT) -#define NV_CHIP_TNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_TNT2) -#define NV_CHIP_UTNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_UTNT2) -#define NV_CHIP_VTNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_VTNT2) -#define NV_CHIP_UVTNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_UVTNT2) -#define NV_CHIP_ITNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_ITNT2) -#define NV_CHIP_GEFORCE256 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_GEFORCE256) -#define NV_CHIP_GEFORCEDDR ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_GEFORCEDDR) -#define NV_CHIP_QUADRO ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_QUADRO) -#define NV_CHIP_GEFORCE2MX ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2MX) -#define NV_CHIP_GEFORCE2MXDDR ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2MXDDR) -#define NV_CHIP_IGEFORCE2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_IGEFORCE2) -#define NV_CHIP_0x0170 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0170) -#define NV_CHIP_0x0171 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0171) -#define NV_CHIP_0x0172 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0172) -#define NV_CHIP_0x0173 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0173) -#define NV_CHIP_0x0174 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0174) -#define NV_CHIP_0x0175 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0175) -#define NV_CHIP_0x0178 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0178) -#define NV_CHIP_0x017A ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x017A) -#define NV_CHIP_0x017B ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x017B) -#define NV_CHIP_0x017C ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x017C) -#define NV_CHIP_QUADRO2MXR ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2MXR) -#define NV_CHIP_GEFORCE2GO ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GO) -#define NV_CHIP_GEFORCE2GTS ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS) -#define NV_CHIP_GEFORCE2GTS_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS_1) -#define NV_CHIP_GEFORCE2ULTRA ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2ULTRA) -#define NV_CHIP_QUADRO2PRO ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2PRO) -#define NV_CHIP_GEFORCE3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3) -#define NV_CHIP_GEFORCE3_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_1) -#define NV_CHIP_GEFORCE3_2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_2) -#define NV_CHIP_QUADRO_DDC ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO_DDC) -#define NV_CHIP_0x0250 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0250) -#define NV_CHIP_0x0258 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0258) #endif /* __NV_STRUCT_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.6 Thu Dec 13 20:20:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c Tue Nov 26 18:41:59 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.6 2001/12/14 01:20:44 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.11 2002/11/26 23:41:59 mvojkovi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -18,11 +18,8 @@ #include "fourcc.h" #include "nv_include.h" -#include "nvreg.h" -#include "nvvga.h" - #define OFF_DELAY 450 /* milliseconds */ #define FREE_DELAY 10000 @@ -51,6 +48,7 @@ int currentBuffer; Time videoTime; Bool grabbedByV4L; + Bool iturbt_709; FBLinearPtr linear; int pitch; int offset; @@ -59,8 +57,6 @@ static XF86VideoAdaptorPtr NVSetupImageVideo(ScreenPtr); -static void NVResetVideo(ScrnInfoPtr); - static void NVStopOverlay (ScrnInfoPtr); static void NVPutOverlayImage(ScrnInfoPtr pScrnInfo, int offset, @@ -96,14 +92,15 @@ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation, - xvHue, xvAutopaintColorKey, xvSetDefaults, xvDoubleBuffer; + xvHue, xvAutopaintColorKey, xvSetDefaults, xvDoubleBuffer, + xvITURBT709; /* client libraries expect an encoding */ static XF86VideoEncodingRec DummyEncoding = { 0, "XV_IMAGE", - 2046, 2047, + 2046, 2046, {1, 1} }; @@ -115,7 +112,7 @@ {15, DirectColor}, {16, DirectColor}, {24, DirectColor} }; -#define NUM_ATTRIBUTES 8 +#define NUM_ATTRIBUTES 9 XF86AttributeRec NVAttributes[NUM_ATTRIBUTES] = { @@ -126,7 +123,8 @@ {XvSettable | XvGettable, -512, 511, "XV_BRIGHTNESS"}, {XvSettable | XvGettable, 0, 8191, "XV_CONTRAST"}, {XvSettable | XvGettable, 0, 8191, "XV_SATURATION"}, - {XvSettable | XvGettable, 0, 360, "XV_HUE"} + {XvSettable | XvGettable, 0, 360, "XV_HUE"}, + {XvSettable | XvGettable, 0, 1, "XV_ITURBT_709"} }; #define NUM_IMAGES_ALL 4 @@ -151,10 +149,11 @@ pPriv->colorKey = pNv->videoKey; pPriv->autopaintColorKey = TRUE; pPriv->doubleBuffer = TRUE; + pPriv->iturbt_709 = FALSE; } -static void +void NVResetVideo (ScrnInfoPtr pScrnInfo) { NVPtr pNv = NVPTR(pScrnInfo); @@ -345,6 +344,7 @@ xvHue = MAKE_ATOM("XV_HUE"); xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); + xvITURBT709 = MAKE_ATOM("XV_ITURBT_709"); NVResetVideo(pScrnInfo); @@ -434,6 +434,8 @@ if(id != FOURCC_UYVY) dstPitch |= 1 << 16; + if(pPriv->iturbt_709) + dstPitch |= 1 << 24; pRiva->PMC[(0x8958/4) + buffer] = dstPitch; pRiva->PMC[0x00008704/4] = 0; @@ -534,6 +536,12 @@ return BadValue; pPriv->autopaintColorKey = value; } + else if (attribute == xvITURBT709) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->iturbt_709 = value; + } else if (attribute == xvSetDefaults) { NVSetPortDefaults(pScrnInfo, pPriv); @@ -572,6 +580,8 @@ *value = pPriv->colorKey; else if (attribute == xvAutopaintColorKey) *value = (pPriv->autopaintColorKey) ? 1 : 0; + else if (attribute == xvITURBT709) + *value = (pPriv->iturbt_709) ? 1 : 0; else return BadMatch; @@ -714,6 +724,7 @@ int pitch, newSize, offset, s2offset, s3offset; int srcPitch, srcPitch2, dstPitch; int top, left, npixels, nlines, bpp; + Bool skip = FALSE; BoxRec dstBox; CARD32 tmp; @@ -789,10 +800,26 @@ if(!pPriv->linear) return BadAlloc; - offset = pPriv->linear->offset * bpp; + offset = pPriv->linear->offset * bpp; - if(pPriv->doubleBuffer && pPriv->currentBuffer) - offset += (newSize * bpp) >> 1; + if(pPriv->doubleBuffer) { + RIVA_HW_INST *pRiva = &(pNv->riva); + int mask = 1 << (pPriv->currentBuffer << 2); + +#if 0 + /* burn the CPU until the next buffer is available */ + while(pRiva->PMC[0x00008700/4] & mask); +#else + /* overwrite the newest buffer if there's not one free */ + if(pRiva->PMC[0x00008700/4] & mask) { + if(!pPriv->currentBuffer) + offset += (newSize * bpp) >> 1; + skip = TRUE; + } else +#endif + if(pPriv->currentBuffer) + offset += (newSize * bpp) >> 1; + } dst_start = pNv->FbStart + offset; @@ -801,15 +828,6 @@ left = (xa >> 16) & ~1; npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; -#if 0 - /* I have my reservations about this */ - if(pPriv->doubleBuffer) { - RIVA_HW_INST *pRiva = &(pNv->riva); - int mask = 1 << (pPriv->currentBuffer << 2); - while(pRiva->PMC[0x00008700/4] & mask); - } -#endif - switch(id) { case FOURCC_YV12: case FOURCC_I420: @@ -839,10 +857,12 @@ break; } - NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox, xa, ya, xb, yb, - width, height, src_w, src_h, drw_w, drw_h, clipBoxes); - - pPriv->currentBuffer ^= 1; + if(!skip) { + NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox, + xa, ya, xb, yb, + width, height, src_w, src_h, drw_w, drw_h, clipBoxes); + pPriv->currentBuffer ^= 1; + } return Success; } @@ -863,8 +883,8 @@ if(*w > 2046) *w = 2046; - if(*h > 2047) - *h = 2047; + if(*h > 2046) + *h = 2046; *w = (*w + 1) & ~1; if (offsets) @@ -960,7 +980,7 @@ if(pPriv->grabbedByV4L) return BadAlloc; - if((w > 2046) || (h > 2047)) return BadValue; + if((w > 2046) || (h > 2046)) return BadValue; w = (w + 1) & ~1; pPriv->pitch = ((w << 1) + 63) & ~63; @@ -980,6 +1000,7 @@ surface->pitches = &pPriv->pitch; surface->offsets = &pPriv->offset; surface->devPrivate.ptr = (pointer)pPriv; + surface->id = id; /* grab the video */ NVStopOverlay(pScrnInfo); @@ -1109,7 +1130,7 @@ NVStopSurface, NVGetSurfaceAttribute, NVSetSurfaceAttribute, - 2046, 2047, + 2046, 2046, NUM_ATTRIBUTES - 1, &NVAttributes[1] }, @@ -1122,7 +1143,7 @@ NVStopSurface, NVGetSurfaceAttribute, NVSetSurfaceAttribute, - 2046, 2047, + 2046, 2046, NUM_ATTRIBUTES - 1, &NVAttributes[1] }, Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.24 Wed Sep 19 19:40:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c Wed Feb 12 16:26:27 2003 @@ -41,15 +41,12 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.24 2001/09/19 23:40:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.29 2003/02/12 21:26:27 mvojkovi Exp $ */ #include "nv_include.h" #include "xaalocal.h" #include "xaarop.h" -#include "nvreg.h" -#include "nvvga.h" - #include "miline.h" static void @@ -62,7 +59,6 @@ RIVA_FIFO_FREE(pNv->riva, Clip, 2); pNv->riva.Clip->TopLeft = (y1 << 16) | (x1 & 0xffff); pNv->riva.Clip->WidthHeight = (height << 16) | width; - write_mem_barrier(); } @@ -135,6 +131,7 @@ RIVA_FIFO_FREE(pNv->riva, Bitmap, 2); pNv->riva.Bitmap->UnclippedRectangle[0].TopLeft = (x << 16) | y; + write_mem_barrier(); pNv->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h; write_mem_barrier(); } @@ -155,14 +152,12 @@ { NVPtr pNv = NVPTR(pScrn); -/* ErrorF("E SubseqSS\n"); */ RIVA_FIFO_FREE(pNv->riva, Blt, 3); pNv->riva.Blt->TopLeftSrc = (y1 << 16) | x1; pNv->riva.Blt->TopLeftDst = (y2 << 16) | x2; + write_mem_barrier(); pNv->riva.Blt->WidthHeight = (h << 16) | w; write_mem_barrier(); -/* ErrorF("L SubseqSS\n"); */ - } @@ -198,7 +193,6 @@ bg = (bg == -1) ? 0 : bg | pNv->opaqueMonochrome; }; NVSetPattern(pNv, bg, fg, patternx, patterny); - write_mem_barrier(); RIVA_FIFO_FREE(pNv->riva, Bitmap, 1); pNv->riva.Bitmap->Color1A = fg; } @@ -212,6 +206,7 @@ RIVA_FIFO_FREE(pNv->riva, Bitmap, 2); pNv->riva.Bitmap->UnclippedRectangle[0].TopLeft = (x << 16) | y; + write_mem_barrier(); pNv->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h; write_mem_barrier(); } @@ -237,9 +232,7 @@ void NVSync(ScrnInfoPtr pScrn) { NVPtr pNv = NVPTR(pScrn); -/* ErrorF("sync enter\n"); */ RIVA_BUSY(pNv->riva); -/* ErrorF("sync leave\n"); */ } /* Color expansion */ @@ -306,7 +299,6 @@ d[14] = pbits[14]; d[15] = pbits[15]; t -= 16; pbits += 16; - write_mem_barrier(); } if(t) { RIVA_FIFO_FREE(pNv->riva, Bitmap, t); @@ -317,17 +309,17 @@ d[2] = pbits[2]; d[3] = pbits[3]; t -= 4; pbits += 4; - write_mem_barrier(); } while(t--) *(d++) = *(pbits++); - write_mem_barrier(); } if (!(--pNv->expandRows)) { /* hardware bug workaround */ RIVA_FIFO_FREE(pNv->riva, Blt, 1); + write_mem_barrier(); pNv->riva.Blt->TopLeftSrc = 0; } + write_mem_barrier(); } static void @@ -339,6 +331,7 @@ RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth); } else { /* hardware bug workaround */ RIVA_FIFO_FREE(pNv->riva, Blt, 1); + write_mem_barrier(); pNv->riva.Blt->TopLeftSrc = 0; } write_mem_barrier(); @@ -364,7 +357,9 @@ pNv->riva.Bitmap->ClipC.BottomRight = ((y+h) << 16) | ((x+w)&0xffff); pNv->riva.Bitmap->Color1C = pNv->FgColor; pNv->riva.Bitmap->WidthHeightC = (h << 16) | bw; + write_mem_barrier(); pNv->riva.Bitmap->PointC = (y << 16) | (x & 0xFFFF); + write_mem_barrier(); } else { @@ -377,7 +372,9 @@ pNv->riva.Bitmap->Color1E = pNv->FgColor; pNv->riva.Bitmap->WidthHeightInE = (h << 16) | bw; pNv->riva.Bitmap->WidthHeightOutE = (h << 16) | bw; + write_mem_barrier(); pNv->riva.Bitmap->PointE = (y << 16) | (x & 0xFFFF); + write_mem_barrier(); } pNv->expandRows = h; @@ -394,90 +391,12 @@ } } - -/* Image writes */ -static void -NVSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int transparency_color, - int bpp, int depth) -{ - NVSetRopSolid(NVPTR(pScrn), rop); -} - -static void -NVSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h, int skipleft) -{ - NVPtr pNv = NVPTR(pScrn); - int bw; - - pNv->expandWidth = ((w * pScrn->bitsPerPixel) + 31) >> 5; - bw = (pNv->expandWidth << 2) / (pScrn->bitsPerPixel >> 3); - - RIVA_FIFO_FREE( pNv->riva, Pixmap, 3 ); - pNv->riva.Pixmap->TopLeft = (y << 16) | (x & 0xFFFF); - pNv->riva.Pixmap->WidthHeight = (h << 16) | w; - pNv->riva.Pixmap->WidthHeightIn = (h << 16) | bw; -} - - -static void -NVSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) -{ - NVPtr pNv = NVPTR(pScrn); - - int t = pNv->expandWidth; - CARD32 *pbits = (CARD32*)pNv->expandBuffer; - CARD32 *d = (CARD32*)&pNv->riva.Pixmap->Pixels; - - while(t >= 16) - { - RIVA_FIFO_FREE(pNv->riva, Pixmap, 16); - d[0] = pbits[0]; - d[1] = pbits[1]; - d[2] = pbits[2]; - d[3] = pbits[3]; - d[4] = pbits[4]; - d[5] = pbits[5]; - d[6] = pbits[6]; - d[7] = pbits[7]; - d[8] = pbits[8]; - d[9] = pbits[9]; - d[10] = pbits[10]; - d[11] = pbits[11]; - d[12] = pbits[12]; - d[13] = pbits[13]; - d[14] = pbits[14]; - d[15] = pbits[15]; - t -= 16; pbits += 16; - write_mem_barrier(); - } - if(t) { - RIVA_FIFO_FREE(pNv->riva, Pixmap, t); - while(t >= 4) - { - d[0] = pbits[0]; - d[1] = pbits[1]; - d[2] = pbits[2]; - d[3] = pbits[3]; - t -= 4; pbits += 4; - write_mem_barrier(); - } - while(t--) - *(d++) = *(pbits++); - write_mem_barrier(); - } -} - - - static void NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask) { NVPtr pNv = NVPTR(pScrn); NVSetRopSolid(pNv, rop); - write_mem_barrier(); pNv->FgColor = color; } @@ -489,6 +408,7 @@ RIVA_FIFO_FREE(pNv->riva, Line, 3); pNv->riva.Line->Color = pNv->FgColor; pNv->riva.Line->Lin[0].point0 = ((y << 16) | ( x & 0xffff)); + write_mem_barrier(); if ( dir ==DEGREES_0 ) pNv->riva.Line->Lin[0].point1 = ((y << 16) | (( x + len ) & 0xffff)); else @@ -506,13 +426,16 @@ RIVA_FIFO_FREE(pNv->riva, Line, lastPoint ? 5 : 3); pNv->riva.Line->Color = pNv->FgColor; pNv->riva.Line->Lin[0].point0 = ((y1 << 16) | (x1 & 0xffff)); + write_mem_barrier(); pNv->riva.Line->Lin[0].point1 = ((y2 << 16) | (x2 & 0xffff)); + write_mem_barrier(); if (lastPoint) { pNv->riva.Line->Lin[1].point0 = ((y2 << 16) | (x2 & 0xffff)); + write_mem_barrier(); pNv->riva.Line->Lin[1].point1 = (((y2 + 1) << 16) | (x2 & 0xffff)); + write_mem_barrier(); } - write_mem_barrier(); } static void @@ -551,6 +474,13 @@ XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NVPtr pNv = NVPTR(pScrn); + Bool lowClocks; + + /* The hardware POSTs with clocks too low to support some acceleration + on NV20 and higher and we don't know enough about timing particulars + to raise them */ + + lowClocks = ((pNv->Chipset & 0x0ff0) >= 0x0200); pNv->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -566,6 +496,9 @@ infoPtr->SetupForSolidFill = NVSetupForSolidFill; infoPtr->SubsequentSolidFillRect = NVSubsequentSolidFillRect; + if(lowClocks) + infoPtr->SolidFillFlags |= GXCOPY_ONLY; + /* screen to screen copy */ infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; infoPtr->SetupForScreenToScreenCopy = NVSetupForScreenToScreenCopy; @@ -599,10 +532,13 @@ LEFT_EDGE_CLIPPING_NEGATIVE_X; infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - NVSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - NVSubsequentScanlineCPUToScreenColorExpandFill; + + if(!lowClocks) { + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + NVSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + NVSubsequentScanlineCPUToScreenColorExpandFill; + } pNv->expandFifo = (unsigned char*)&pNv->riva.Bitmap->MonochromeData01E; @@ -613,28 +549,8 @@ infoPtr->ScanlineColorExpandBuffers = &pNv->expandBuffer; infoPtr->SubsequentColorExpandScanline = NVSubsequentColorExpandScanline; - - if (pNv->riva.Architecture == 4 && pScrn->bitsPerPixel == 32) - { - /* Image writes */ - infoPtr->ScanlineImageWriteFlags = CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | -/* LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X; */ - NO_PLANEMASK | NO_TRANSPARENCY | - NO_GXCOPY; - - infoPtr->SetupForScanlineImageWrite = NVSetupForScanlineImageWrite; - infoPtr->SubsequentScanlineImageWriteRect = - NVSubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = NVSubsequentImageWriteScanline; - - /* We reuse the color expansion buffer */ - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = &pNv->expandBuffer; - } - infoPtr->SolidLineFlags = NO_PLANEMASK; + infoPtr->SolidLineFlags = infoPtr->SolidFillFlags; infoPtr->SetupForSolidLine = NVSetupForSolidLine; infoPtr->SubsequentSolidHorVertLine = NVSubsequentSolidHorVertLine; Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nvreg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nvreg.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/nv/nvreg.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/nv/nvreg.h:1.5 Thu Nov 11 21:12:41 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nvreg.h Thu Feb 27 12:31:26 2003 @@ -1,209 +0,0 @@ -/* $XConsortium: nvreg.h /main/2 1996/10/28 05:13:41 kaleb $ */ -/* - * Copyright 1996-1997 David J. McKay - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID J. MCKAY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nvreg.h,v 1.5 1999/11/12 02:12:41 mvojkovi Exp $ */ - -#ifndef __NVREG_H_ -#define __NVREG_H_ - -/* Little macro to construct bitmask for contiguous ranges of bits */ -#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) -#define MASKEXPAND(mask) BITMASK(1?mask,0?mask) - -/* Macro to set specific bitfields (mask has to be a macro x:y) ! */ -#define SetBF(mask,value) ((value) << (0?mask)) -#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) - -#define MaskAndSetBF(var,mask,value) (var)=(((var)&(~MASKEXPAND(mask)) \ - | SetBF(mask,value))) - -#define DEVICE_BASE(device) (0?NV##_##device) -#define DEVICE_SIZE(device) ((1?NV##_##device) - DEVICE_BASE(device)+1) - -/* This is where we will have to have conditional compilation */ -#define DEVICE_ACCESS(device,reg) \ - nv##device##Port[((NV_##device##_##reg)-DEVICE_BASE(device))/4] - -#define DEVICE_WRITE(device,reg,value) DEVICE_ACCESS(device,reg)=(value) -#define DEVICE_READ(device,reg) DEVICE_ACCESS(device,reg) -#define DEVICE_PRINT(device,reg) \ - ErrorF("NV_"#device"_"#reg"=#%08lx\n",DEVICE_ACCESS(device,reg)) -#define DEVICE_DEF(device,mask,value) \ - SetBF(NV_##device##_##mask,NV_##device##_##mask##_##value) -#define DEVICE_VALUE(device,mask,value) SetBF(NV_##device##_##mask,value) -#define DEVICE_MASK(device,mask) MASKEXPAND(NV_##device##_##mask) - -#define PDAC_Write(reg,value) DEVICE_WRITE(PDAC,reg,value) -#define PDAC_Read(reg) DEVICE_READ(PDAC,reg) -#define PDAC_Print(reg) DEVICE_PRINT(PDAC,reg) -#define PDAC_Def(mask,value) DEVICE_DEF(PDAC,mask,value) -#define PDAC_Val(mask,value) DEVICE_VALUE(PDAC,mask,value) -#define PDAC_Mask(mask) DEVICE_MASK(PDAC,mask) - -#define PFB_Write(reg,value) DEVICE_WRITE(PFB,reg,value) -#define PFB_Read(reg) DEVICE_READ(PFB,reg) -#define PFB_Print(reg) DEVICE_PRINT(PFB,reg) -#define PFB_Def(mask,value) DEVICE_DEF(PFB,mask,value) -#define PFB_Val(mask,value) DEVICE_VALUE(PFB,mask,value) -#define PFB_Mask(mask) DEVICE_MASK(PFB,mask) - -#define PRM_Write(reg,value) DEVICE_WRITE(PRM,reg,value) -#define PRM_Read(reg) DEVICE_READ(PRM,reg) -#define PRM_Print(reg) DEVICE_PRINT(PRM,reg) -#define PRM_Def(mask,value) DEVICE_DEF(PRM,mask,value) -#define PRM_Val(mask,value) DEVICE_VALUE(PRM,mask,value) -#define PRM_Mask(mask) DEVICE_MASK(PRM,mask) - -#define PGRAPH_Write(reg,value) DEVICE_WRITE(PGRAPH,reg,value) -#define PGRAPH_Read(reg) DEVICE_READ(PGRAPH,reg) -#define PGRAPH_Print(reg) DEVICE_PRINT(PGRAPH,reg) -#define PGRAPH_Def(mask,value) DEVICE_DEF(PGRAPH,mask,value) -#define PGRAPH_Val(mask,value) DEVICE_VALUE(PGRAPH,mask,value) -#define PGRAPH_Mask(mask) DEVICE_MASK(PGRAPH,mask) - -#define PDMA_Write(reg,value) DEVICE_WRITE(PDMA,reg,value) -#define PDMA_Read(reg) DEVICE_READ(PDMA,reg) -#define PDMA_Print(reg) DEVICE_PRINT(PDMA,reg) -#define PDMA_Def(mask,value) DEVICE_DEF(PDMA,mask,value) -#define PDMA_Val(mask,value) DEVICE_VALUE(PDMA,mask,value) -#define PDMA_Mask(mask) DEVICE_MASK(PDMA,mask) - -#define PTIMER_Write(reg,value) DEVICE_WRITE(PTIMER,reg,value) -#define PTIMER_Read(reg) DEVICE_READ(PTIMER,reg) -#define PTIMER_Print(reg) DEVICE_PRINT(PTIMER,reg) -#define PTIMER_Def(mask,value) DEVICE_DEF(PTIMER,mask,value) -#define PTIMER_Val(mask,value) DEVICE_VALUE(PTIEMR,mask,value) -#define PTIMER_Mask(mask) DEVICE_MASK(PTIMER,mask) - -#define PEXTDEV_Write(reg,value) DEVICE_WRITE(PEXTDEV,reg,value) -#define PEXTDEV_Read(reg) DEVICE_READ(PEXTDEV,reg) -#define PEXTDEV_Print(reg) DEVICE_PRINT(PEXTDEV,reg) -#define PEXTDEV_Def(mask,value) DEVICE_DEF(PEXTDEV,mask,value) -#define PEXTDEV_Val(mask,value) DEVICE_VALUE(PEXTDEV,mask,value) -#define PEXTDEV_Mask(mask) DEVICE_MASK(PEXTDEV,mask) - -#define PFIFO_Write(reg,value) DEVICE_WRITE(PFIFO,reg,value) -#define PFIFO_Read(reg) DEVICE_READ(PFIFO,reg) -#define PFIFO_Print(reg) DEVICE_PRINT(PFIFO,reg) -#define PFIFO_Def(mask,value) DEVICE_DEF(PFIFO,mask,value) -#define PFIFO_Val(mask,value) DEVICE_VALUE(PFIFO,mask,value) -#define PFIFO_Mask(mask) DEVICE_MASK(PFIFO,mask) - -#define PRAM_Write(reg,value) DEVICE_WRITE(PRAM,reg,value) -#define PRAM_Read(reg) DEVICE_READ(PRAM,reg) -#define PRAM_Print(reg) DEVICE_PRINT(PRAM,reg) -#define PRAM_Def(mask,value) DEVICE_DEF(PRAM,mask,value) -#define PRAM_Val(mask,value) DEVICE_VALUE(PRAM,mask,value) -#define PRAM_Mask(mask) DEVICE_MASK(PRAM,mask) - -#define PRAMFC_Write(reg,value) DEVICE_WRITE(PRAMFC,reg,value) -#define PRAMFC_Read(reg) DEVICE_READ(PRAMFC,reg) -#define PRAMFC_Print(reg) DEVICE_PRINT(PRAMFC,reg) -#define PRAMFC_Def(mask,value) DEVICE_DEF(PRAMFC,mask,value) -#define PRAMFC_Val(mask,value) DEVICE_VALUE(PRAMFC,mask,value) -#define PRAMFC_Mask(mask) DEVICE_MASK(PRAMFC,mask) - -#define PMC_Write(reg,value) DEVICE_WRITE(PMC,reg,value) -#define PMC_Read(reg) DEVICE_READ(PMC,reg) -#define PMC_Print(reg) DEVICE_PRINT(PMC,reg) -#define PMC_Def(mask,value) DEVICE_DEF(PMC,mask,value) -#define PMC_Val(mask,value) DEVICE_VALUE(PMC,mask,value) -#define PMC_Mask(mask) DEVICE_MASK(PMC,mask) - -#define PMC_Write(reg,value) DEVICE_WRITE(PMC,reg,value) -#define PMC_Read(reg) DEVICE_READ(PMC,reg) -#define PMC_Print(reg) DEVICE_PRINT(PMC,reg) -#define PMC_Def(mask,value) DEVICE_DEF(PMC,mask,value) -#define PMC_Val(mask,value) DEVICE_VALUE(PMC,mask,value) -#define PMC_Mask(mask) DEVICE_MASK(PMC,mask) - - -#define PBUS_Write(reg,value) DEVICE_WRITE(PBUS,reg,value) -#define PBUS_Read(reg) DEVICE_READ(PBUS,reg) -#define PBUS_Print(reg) DEVICE_PRINT(PBUS,reg) -#define PBUS_Def(mask,value) DEVICE_DEF(PBUS,mask,value) -#define PBUS_Val(mask,value) DEVICE_VALUE(PBUS,mask,value) -#define PBUS_Mask(mask) DEVICE_MASK(PBUS,mask) - - -#define PRAMDAC_Write(reg,value) DEVICE_WRITE(PRAMDAC,reg,value) -#define PRAMDAC_Read(reg) DEVICE_READ(PRAMDAC,reg) -#define PRAMDAC_Print(reg) DEVICE_PRINT(PRAMDAC,reg) -#define PRAMDAC_Def(mask,value) DEVICE_DEF(PRAMDAC,mask,value) -#define PRAMDAC_Val(mask,value) DEVICE_VALUE(PRAMDAC,mask,value) -#define PRAMDAC_Mask(mask) DEVICE_MASK(PRAMDAC,mask) - - -#define PDAC_ReadExt(reg) \ - ((PDAC_Write(INDEX_LO,(NV_PDAC_EXT_##reg) & 0xff)),\ - (PDAC_Write(INDEX_HI,((NV_PDAC_EXT_##reg) >> 8) & 0xff)),\ - (PDAC_Read(INDEX_DATA))) - -#define PDAC_WriteExt(reg,value)\ - ((PDAC_Write(INDEX_LO,(NV_PDAC_EXT_##reg) & 0xff)),\ - (PDAC_Write(INDEX_HI,((NV_PDAC_EXT_##reg) >> 8) & 0xff)),\ - (PDAC_Write(INDEX_DATA,(value)))) - -#define CRTC_Write(index,value) outb(0x3d4,(index));outb(0x3d5,value) -#define CRTC_Read(index) (outb(0x3d4,index),inb(0x3d5)) - -#define PCRTC_Write(index,value) CRTC_Write(NV_PCRTC_##index,value) -#define PCRTC_Read(index) CRTC_Read(NV_PCRTC_##index) - -#define PCRTC_Def(mask,value) DEVICE_DEF(PCRTC,mask,value) -#define PCRTC_Val(mask,value) DEVICE_VALUE(PCRTC,mask,value) -#define PCRTC_Mask(mask) DEVICE_MASK(PCRTC,mask) - -#define SR_Write(index,value) outb(0x3c4,(index));outb(0x3c5,value) -#define SR_Read(index) (outb(0x3c4,index),inb(0x3c5)) - - -/* These are the variables which actually point at the register blocks */ -extern volatile unsigned *nvPDACPort; /* Points to the DAC */ -extern volatile unsigned *nvPFBPort; /* Points to the Frame buffer */ -extern volatile unsigned *nvPRMPort; /* Points to real mode stuff */ -extern volatile unsigned *nvPGRAPHPort; /* Graphics unit */ -extern volatile unsigned *nvPDMAPort; /* DMA engine */ -extern volatile unsigned *nvPFIFOPort; /* FIFO registers */ -extern volatile unsigned *nvPTIMERPort; /* TIMER registers */ -extern volatile unsigned *nvPEXTDEVPort; /* EXTDEV registers */ -extern volatile unsigned *nvPRAMPort; /* Priviliged RAM registers */ -extern volatile unsigned *nvPRAMFCPort; /* Priviliged RAM (Fifo) */ -extern volatile unsigned *nvPRAMHTPort; /* Priviliged RAM (hash) */ -extern volatile unsigned *nvPMCPort; /* Priviliged RAM (hash) */ -extern volatile unsigned *nvCHAN0Port; /* User channel 0 */ -extern volatile unsigned *nvPRAMDACPort; /* Points to the RAMDAC */ -extern volatile unsigned *nvPRAMINPort; /* Privileges instance memory */ -extern volatile unsigned *nvPBUSPort; /* Priviled Bus */ -extern volatile unsigned *nvPNVMPort; /* Priviled Bus */ -extern volatile unsigned *dumb; /* FrameBuffer - hack!!!! */ - - -typedef enum {NV1,NV3,NV4,NV10,NumNVChips} NVChipType; - -NVChipType GetChipType(void); - - -#endif - - Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h:1.2 Mon Nov 19 10:33:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h Thu Feb 27 12:31:26 2003 @@ -1,82 +0,0 @@ -/* - * Copyright 1996-1997 David J. McKay - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID J. MCKAY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h,v 1.2 2001/11/19 15:33:41 tsi Exp $ */ - -#ifndef __NVVGA_H__ -#define __NVVGA_H__ - -#include "riva_hw.h" - -#define PALETTE_SIZE 256 - -#define NV_PDAC_CURSOR_SIZE 32 -#define NV_PDAC_CURSOR_PLANE_SIZE (NV_PDAC_CURSOR_SIZE*4) - -/* This is the structure for the NV1. It is not a VGA based core */ - -typedef struct { - unsigned char Nparam, Mparam, Oparam, Pparam; - unsigned char NparamMPLL, MparamMPLL, OparamMPLL, PparamMPLL; - unsigned char dacConfReg0; - unsigned char dacConfReg1; - unsigned char dacRgbPalCtrl; - unsigned long confReg0; - unsigned long green0; /* DPMS and sync polarity control */ - unsigned long memoryTrace; - unsigned long startAddr; /* Where to start reading out from the buffer */ - /* All the following registers control the display */ - unsigned long prmConfig0; /* Controls if text mode on or off */ - unsigned long horFrontPorch; /* Front porch in pixels */ - unsigned long horSyncWidth; /* Sync Width in pixels */ - unsigned long horBackPorch; /* horizontal back porch in in pixels */ - unsigned long horDispWidth; /* Horizontal display width in pixels */ - unsigned long verFrontPorch; /* Vertical front porch in lines */ - unsigned long verSyncWidth; /* Vertical sync width in lines */ - unsigned long verBackPorch; /* Vertical back porch in lines */ - unsigned long verDispWidth; /* Vertical display width in lines */ - /* Hardware cursor registers */ - unsigned char cursorCtrl; - unsigned char xHi,xLo,yHi,yLo; - unsigned char colour1[3]; /* RGB values for cursor planes */ - unsigned char colour2[3]; - unsigned char colour3[3]; - unsigned char plane0[NV_PDAC_CURSOR_PLANE_SIZE]; - unsigned char plane1[NV_PDAC_CURSOR_PLANE_SIZE]; - unsigned char palette[PALETTE_SIZE][3]; -}NV1Registers; - -/* - * Driver data structures. - */ -typedef struct { -/* vgaHWRec std; good old IBM VGA */ - int vgaValid; /* is the above state valid?? */ - NVChipType type; /* What the union holds */ - - union { - NV1Registers nv1; - RIVA_HW_STATE RivaState; - }regs; -} vgaNVRec, *vgaNVPtr; - -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.47 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.21 Mon Dec 17 17:17:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c Mon Feb 10 18:42:51 2003 @@ -36,12 +36,11 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.21 2001/12/17 22:17:55 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.47 2003/02/10 23:42:51 mvojkovi Exp $ */ #include "nv_local.h" #include "compiler.h" #include "nv_include.h" -#include "nvreg.h" #include "riva_hw.h" #include "riva_tbl.h" @@ -70,34 +69,40 @@ { return ((chip->Rop->FifoFree < chip->FifoEmptyCount) || (chip->PGRAPH[0x00000700/4] & 0x01)); } -static void nv3LockUnlock +static void vgaLockUnlock ( RIVA_HW_INST *chip, - int LockUnlock + Bool Lock ) { - VGA_WR08(chip->PVIO, 0x3C4, 0x06); - VGA_WR08(chip->PVIO, 0x3C5, LockUnlock ? 0x99 : 0x57); + CARD8 cr11; + VGA_WR08(chip->PCIO, 0x3D4, 0x11); + cr11 = VGA_RD08(chip->PCIO, 0x3D5); + if(Lock) cr11 |= 0x80; + else cr11 &= ~0x80; + VGA_WR08(chip->PCIO, 0x3D5, cr11); } -static void nv4LockUnlock + +static void nv3LockUnlock ( RIVA_HW_INST *chip, - int LockUnlock + Bool Lock ) { - VGA_WR08(chip->PCIO, 0x3D4, 0x1F); - VGA_WR08(chip->PCIO, 0x3D5, LockUnlock ? 0x99 : 0x57); + VGA_WR08(chip->PVIO, 0x3C4, 0x06); + VGA_WR08(chip->PVIO, 0x3C5, Lock ? 0x99 : 0x57); + vgaLockUnlock(chip, Lock); } -static void nv10LockUnlock +static void nv4LockUnlock ( RIVA_HW_INST *chip, - int LockUnlock + Bool Lock ) { VGA_WR08(chip->PCIO, 0x3D4, 0x1F); - VGA_WR08(chip->PCIO, 0x3D5, LockUnlock ? 0x99 : 0x57); + VGA_WR08(chip->PCIO, 0x3D5, Lock ? 0x99 : 0x57); + vgaLockUnlock(chip, Lock); } - static int ShowHideCursor ( RIVA_HW_INST *chip, @@ -601,7 +606,7 @@ nv3_sim_state sim_data; unsigned int M, N, P, pll, MClk; - pll = chip->PRAMDAC[0x00000504/4]; + pll = chip->PRAMDAC0[0x00000504/4]; M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; MClk = (N * chip->CrystalFreqKHz / M) >> P; sim_data.pix_bpp = (char)pixelDepth; @@ -788,10 +793,10 @@ nv4_sim_state sim_data; unsigned int M, N, P, pll, MClk, NVClk, cfg1; - pll = chip->PRAMDAC[0x00000504/4]; + pll = chip->PRAMDAC0[0x00000504/4]; M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; MClk = (N * chip->CrystalFreqKHz / M) >> P; - pll = chip->PRAMDAC[0x00000500/4]; + pll = chip->PRAMDAC0[0x00000500/4]; M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; NVClk = (N * chip->CrystalFreqKHz / M) >> P; cfg1 = chip->PFB[0x00000204/4]; @@ -1049,10 +1054,10 @@ nv10_sim_state sim_data; unsigned int M, N, P, pll, MClk, NVClk, cfg1; - pll = chip->PRAMDAC[0x00000504/4]; + pll = chip->PRAMDAC0[0x00000504/4]; M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; MClk = (N * chip->CrystalFreqKHz / M) >> P; - pll = chip->PRAMDAC[0x00000500/4]; + pll = chip->PRAMDAC0[0x00000500/4]; M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; NVClk = (N * chip->CrystalFreqKHz / M) >> P; cfg1 = chip->PFB[0x00000204/4]; @@ -1078,6 +1083,66 @@ } } +static void nForceUpdateArbitrationSettings +( + unsigned VClk, + unsigned pixelDepth, + unsigned *burst, + unsigned *lwm, + RIVA_HW_INST *chip +) +{ + nv10_fifo_info fifo_data; + nv10_sim_state sim_data; + unsigned int M, N, P, pll, MClk, NVClk; + unsigned int uMClkPostDiv, memctrl; + + uMClkPostDiv = (pciReadLong(pciTag(0, 0, 3), 0x6C) >> 8) & 0xf; + if(!uMClkPostDiv) uMClkPostDiv = 4; + MClk = 400000 / uMClkPostDiv; + + pll = chip->PRAMDAC0[0x00000500/4]; + M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; + NVClk = (N * chip->CrystalFreqKHz / M) >> P; + sim_data.pix_bpp = (char)pixelDepth; + sim_data.enable_video = 0; + sim_data.enable_mp = 0; + sim_data.memory_type = (pciReadLong(pciTag(0, 0, 1), 0x7C) >> 12) & 1; + sim_data.memory_width = 64; + + memctrl = pciReadLong(pciTag(0, 0, 3), 0x00) >> 16; + + if((memctrl == 0x1A9) || (memctrl == 0x1AB) || (memctrl == 0x1ED)) { + int dimm[3]; + + dimm[0] = (pciReadLong(pciTag(0, 0, 2), 0x40) >> 8) & 0x4F; + dimm[1] = (pciReadLong(pciTag(0, 0, 2), 0x44) >> 8) & 0x4F; + dimm[2] = (pciReadLong(pciTag(0, 0, 2), 0x48) >> 8) & 0x4F; + + if((dimm[0] + dimm[1]) != dimm[2]) { + ErrorF("WARNING: " + "your nForce DIMMs are not arranged in optimal banks!\n"); + } + } + + sim_data.mem_latency = 3; + sim_data.mem_aligned = 1; + sim_data.mem_page_miss = 10; + sim_data.gr_during_vid = 0; + sim_data.pclk_khz = VClk; + sim_data.mclk_khz = MClk; + sim_data.nvclk_khz = NVClk; + nv10CalcArbitration(&fifo_data, &sim_data); + if (fifo_data.valid) + { + int b = fifo_data.graphics_burst_size >> 4; + *burst = 0; + while (b >>= 1) (*burst)++; + *lwm = fifo_data.graphics_lwm >> 3; + } +} + + /****************************************************************************\ * * * RIVA Mode State Routines * @@ -1106,16 +1171,16 @@ VClk = (unsigned)clockIn; - if (chip->CrystalFreqKHz == 14318) + if (chip->CrystalFreqKHz == 13500) { - lowM = 8; - highM = 14 - (chip->Architecture == NV_ARCH_03); - } - else - { lowM = 7; highM = 13 - (chip->Architecture == NV_ARCH_03); } + else + { + lowM = 8; + highM = 14 - (chip->Architecture == NV_ARCH_03); + } highP = 4 - (chip->Architecture == NV_ARCH_03); for (P = 0; P <= highP; P ++) @@ -1125,19 +1190,21 @@ { for (M = lowM; M <= highM; M++) { - N = (VClk * M / chip->CrystalFreqKHz) << P; - Freq = (chip->CrystalFreqKHz * N / M) >> P; - if (Freq > VClk) - DeltaNew = Freq - VClk; - else - DeltaNew = VClk - Freq; - if (DeltaNew < DeltaOld) - { - *mOut = M; - *nOut = N; - *pOut = P; - *clockOut = Freq; - DeltaOld = DeltaNew; + N = (VClk << P) * M / chip->CrystalFreqKHz; + if(N <= 255) { + Freq = (chip->CrystalFreqKHz * N / M) >> P; + if (Freq > VClk) + DeltaNew = Freq - VClk; + else + DeltaNew = VClk - Freq; + if (DeltaNew < DeltaOld) + { + *mOut = M; + *nOut = N; + *pOut = P; + *clockOut = Freq; + DeltaOld = DeltaNew; + } } } } @@ -1211,15 +1278,25 @@ break; case NV_ARCH_10: case NV_ARCH_20: - nv10UpdateArbitrationSettings(VClk, + if(((chip->Chipset & 0xffff) == 0x01A0) || + ((chip->Chipset & 0xffff) == 0x01f0)) + { + nForceUpdateArbitrationSettings(VClk, + pixelDepth * 8, + &(state->arbitration0), + &(state->arbitration1), + chip); + } else { + nv10UpdateArbitrationSettings(VClk, pixelDepth * 8, &(state->arbitration0), &(state->arbitration1), chip); + } state->cursor0 = 0x80 | (chip->CursorStart >> 17); state->cursor1 = (chip->CursorStart >> 11) << 2; state->cursor2 = chip->CursorStart >> 24; - if (flags & V_DBLSCAN) + if (flags & V_DBLSCAN) state->cursor1 |= 2; state->pllsel = 0x10000700; state->config = chip->PFB[0x00000200/4]; @@ -1234,14 +1311,8 @@ state->vpll = (p << 16) | (n << 8) | m; state->repaint0 = (((width/8)*pixelDepth) & 0x700) >> 3; state->pixel = pixelDepth > 2 ? 3 : pixelDepth; - state->offset0 = - state->offset1 = - state->offset2 = - state->offset3 = 0; - state->pitch0 = - state->pitch1 = - state->pitch2 = - state->pitch3 = pixelDepth * width; + state->offset = 0; + state->pitch = pixelDepth * width; } /* * Load fixed function state and pre-calculated/stored state. @@ -1272,18 +1343,10 @@ { case NV_ARCH_04: LOAD_FIXED_STATE(nv4,FIFO); - chip->Tri03 = 0L; - chip->Tri05 = (RivaTexturedTriangle05 *)&(chip->FIFO[0x0000E000/4]); break; case NV_ARCH_10: case NV_ARCH_20: - /* - * Initialize state for the RivaTriangle3D05 routines. - */ - LOAD_FIXED_STATE(nv10tri05,PGRAPH); LOAD_FIXED_STATE(nv10,FIFO); - chip->Tri03 = 0L; - chip->Tri05 = (RivaTexturedTriangle05 *)&(chip->FIFO[0x0000E000/4]); break; } } @@ -1293,7 +1356,7 @@ RIVA_HW_STATE *state ) { - int i; + int i, format; /* * Load HW fixed function state. @@ -1316,31 +1379,28 @@ case 16: LOAD_FIXED_STATE_15BPP(nv3,PRAMIN); LOAD_FIXED_STATE_15BPP(nv3,PGRAPH); - chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); break; case 24: case 32: LOAD_FIXED_STATE_32BPP(nv3,PRAMIN); LOAD_FIXED_STATE_32BPP(nv3,PGRAPH); - chip->Tri03 = 0L; break; case 8: default: LOAD_FIXED_STATE_8BPP(nv3,PRAMIN); LOAD_FIXED_STATE_8BPP(nv3,PGRAPH); - chip->Tri03 = 0L; break; } for (i = 0x00000; i < 0x00800; i++) chip->PRAMIN[0x00000502 + i] = (i << 12) | 0x03; - chip->PGRAPH[0x00000630/4] = state->offset0; - chip->PGRAPH[0x00000634/4] = state->offset1; - chip->PGRAPH[0x00000638/4] = state->offset2; - chip->PGRAPH[0x0000063C/4] = state->offset3; - chip->PGRAPH[0x00000650/4] = state->pitch0; - chip->PGRAPH[0x00000654/4] = state->pitch1; - chip->PGRAPH[0x00000658/4] = state->pitch2; - chip->PGRAPH[0x0000065C/4] = state->pitch3; + chip->PGRAPH[0x00000630/4] = state->offset; + chip->PGRAPH[0x00000634/4] = state->offset; + chip->PGRAPH[0x00000638/4] = state->offset; + chip->PGRAPH[0x0000063C/4] = state->offset; + chip->PGRAPH[0x00000650/4] = state->pitch; + chip->PGRAPH[0x00000654/4] = state->pitch; + chip->PGRAPH[0x00000658/4] = state->pitch; + chip->PGRAPH[0x0000065C/4] = state->pitch; break; case NV_ARCH_04: /* @@ -1355,94 +1415,108 @@ case 15: LOAD_FIXED_STATE_15BPP(nv4,PRAMIN); LOAD_FIXED_STATE_15BPP(nv4,PGRAPH); - chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); break; case 16: LOAD_FIXED_STATE_16BPP(nv4,PRAMIN); LOAD_FIXED_STATE_16BPP(nv4,PGRAPH); - chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); break; case 24: case 32: LOAD_FIXED_STATE_32BPP(nv4,PRAMIN); LOAD_FIXED_STATE_32BPP(nv4,PGRAPH); - chip->Tri03 = 0L; break; case 8: default: LOAD_FIXED_STATE_8BPP(nv4,PRAMIN); LOAD_FIXED_STATE_8BPP(nv4,PGRAPH); - chip->Tri03 = 0L; break; } - chip->PGRAPH[0x00000640/4] = state->offset0; - chip->PGRAPH[0x00000644/4] = state->offset1; - chip->PGRAPH[0x00000648/4] = state->offset2; - chip->PGRAPH[0x0000064C/4] = state->offset3; - chip->PGRAPH[0x00000670/4] = state->pitch0; - chip->PGRAPH[0x00000674/4] = state->pitch1; - chip->PGRAPH[0x00000678/4] = state->pitch2; - chip->PGRAPH[0x0000067C/4] = state->pitch3; + chip->PGRAPH[0x00000640/4] = state->offset; + chip->PGRAPH[0x00000644/4] = state->offset; + chip->PGRAPH[0x00000648/4] = state->offset; + chip->PGRAPH[0x0000064C/4] = state->offset; + chip->PGRAPH[0x00000670/4] = state->pitch; + chip->PGRAPH[0x00000674/4] = state->pitch; + chip->PGRAPH[0x00000678/4] = state->pitch; + chip->PGRAPH[0x0000067C/4] = state->pitch; break; case NV_ARCH_10: case NV_ARCH_20: + if(chip->twoHeads) { + VGA_WR08(chip->PCIO, 0x03D4, 0x44); + VGA_WR08(chip->PCIO, 0x03D5, state->crtcOwner); + chip->LockUnlock(chip, 0); + } + LOAD_FIXED_STATE(nv10,PFIFO); LOAD_FIXED_STATE(nv10,PRAMIN); LOAD_FIXED_STATE(nv10,PGRAPH); switch (state->bpp) { case 15: + format = 2; LOAD_FIXED_STATE_15BPP(nv10,PRAMIN); LOAD_FIXED_STATE_15BPP(nv10,PGRAPH); - chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); break; case 16: + format = 5; LOAD_FIXED_STATE_16BPP(nv10,PRAMIN); LOAD_FIXED_STATE_16BPP(nv10,PGRAPH); - chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); break; - case 24: case 32: + format = 7; LOAD_FIXED_STATE_32BPP(nv10,PRAMIN); LOAD_FIXED_STATE_32BPP(nv10,PGRAPH); - chip->Tri03 = 0L; break; - case 8: default: + format = 1; LOAD_FIXED_STATE_8BPP(nv10,PRAMIN); LOAD_FIXED_STATE_8BPP(nv10,PGRAPH); - chip->Tri03 = 0L; break; } if(chip->Architecture == NV_ARCH_10) { - chip->PGRAPH[0x00000640/4] = state->offset0; - chip->PGRAPH[0x00000644/4] = state->offset1; - chip->PGRAPH[0x00000648/4] = state->offset2; - chip->PGRAPH[0x0000064C/4] = state->offset3; - chip->PGRAPH[0x00000670/4] = state->pitch0; - chip->PGRAPH[0x00000674/4] = state->pitch1; - chip->PGRAPH[0x00000678/4] = state->pitch2; - chip->PGRAPH[0x0000067C/4] = state->pitch3; - chip->PGRAPH[0x00000680/4] = state->pitch3; + chip->PGRAPH[0x00000640/4] = state->offset; + chip->PGRAPH[0x00000644/4] = state->offset; + chip->PGRAPH[0x00000648/4] = state->offset; + chip->PGRAPH[0x0000064C/4] = state->offset; + chip->PGRAPH[0x00000670/4] = state->pitch; + chip->PGRAPH[0x00000674/4] = state->pitch; + chip->PGRAPH[0x00000678/4] = state->pitch; + chip->PGRAPH[0x0000067C/4] = state->pitch; + chip->PGRAPH[0x00000680/4] = state->pitch; } else { - chip->PGRAPH[0x00000820/4] = state->offset0; - chip->PGRAPH[0x00000824/4] = state->offset1; - chip->PGRAPH[0x00000828/4] = state->offset2; - chip->PGRAPH[0x0000082C/4] = state->offset3; - chip->PGRAPH[0x00000850/4] = state->pitch0; - chip->PGRAPH[0x00000854/4] = state->pitch1; - chip->PGRAPH[0x00000858/4] = state->pitch2; - chip->PGRAPH[0x0000085C/4] = state->pitch3; - chip->PGRAPH[0x00000860/4] = state->pitch3; - chip->PGRAPH[0x00000864/4] = state->pitch3; + chip->PGRAPH[0x00000864/4] = 0x01ffffff; + chip->PGRAPH[0x00000868/4] = 0x01ffffff; + chip->PGRAPH[0x0000086c/4] = 0x01ffffff; + chip->PGRAPH[0x00000870/4] = 0x01ffffff; + + chip->PGRAPH[0x00000820/4] = state->offset; + chip->PGRAPH[0x00000824/4] = state->offset; + chip->PGRAPH[0x00000828/4] = state->offset; + chip->PGRAPH[0x0000082C/4] = state->offset; + chip->PGRAPH[0x00000850/4] = state->pitch; + chip->PGRAPH[0x00000854/4] = state->pitch; + chip->PGRAPH[0x00000858/4] = state->pitch; + chip->PGRAPH[0x0000085C/4] = state->pitch; chip->PGRAPH[0x000009A4/4] = chip->PFB[0x00000200/4]; chip->PGRAPH[0x000009A8/4] = chip->PFB[0x00000204/4]; - chip->PRAMDAC[0x0000052C/4] = 0x00000101; - chip->PRAMDAC[0x0000252C/4] = 0x00000001; + + if((chip->Chipset & 0x0ff0) >= 0x0300) { + if(!chip->flatPanel) { + chip->PRAMDAC0[0x0578/4] = state->vpllB; + chip->PRAMDAC0[0x057C/4] = state->vpll2B; + } + chip->PGRAPH[0x00000724/4] = format | (format << 5); + chip->PGRAPH[0x0000008C/4] |= 1; + chip->PGRAPH[0x00000890/4] |= 0x00040000; + } } + if(chip->twoHeads) { + chip->PCRTC0[0x00000860/4] = state->head; + chip->PCRTC0[0x00002860/4] = state->head2; + } chip->PRAMDAC[0x00000404/4] |= (1 << 25); - chip->PRAMDAC[0x00002404/4] |= (1 << 25); chip->PMC[0x00008704/4] = 1; chip->PMC[0x00008140/4] = 0; @@ -1450,15 +1524,16 @@ chip->PMC[0x00008924/4] = 0; chip->PMC[0x00008908/4] = 0x01ffffff; chip->PMC[0x0000890C/4] = 0x01ffffff; + chip->PMC[0x00001588/4] = 0; chip->PFB[0x00000240/4] = 0; - chip->PFB[0x00000244/4] = 0; - chip->PFB[0x00000248/4] = 0; - chip->PFB[0x0000024C/4] = 0; chip->PFB[0x00000250/4] = 0; - chip->PFB[0x00000254/4] = 0; - chip->PFB[0x00000258/4] = 0; - chip->PFB[0x0000025C/4] = 0; + chip->PFB[0x00000260/4] = 0; + chip->PFB[0x00000270/4] = 0; + chip->PFB[0x00000280/4] = 0; + chip->PFB[0x00000290/4] = 0; + chip->PFB[0x000002A0/4] = 0; + chip->PFB[0x000002B0/4] = 0; chip->PGRAPH[0x00000B00/4] = chip->PFB[0x00000240/4]; chip->PGRAPH[0x00000B04/4] = chip->PFB[0x00000244/4]; @@ -1533,14 +1608,36 @@ chip->PGRAPH[0x00000F50/4] = 0x00000040; for (i = 0; i < 4; i++) chip->PGRAPH[0x00000F54/4] = 0x00000000; - break; + + chip->PCRTC[0x00000810/4] = state->cursorConfig; + + if(chip->flatPanel) { + if((chip->Chipset & 0x0ff0) == 0x0110) { + chip->PRAMDAC[0x0528/4] = state->dither; + } else + if((chip->Chipset & 0x0ff0) >= 0x0170) { + chip->PRAMDAC[0x083C/4] = state->dither; + } + + + VGA_WR08(chip->PCIO, 0x03D4, 0x53); + VGA_WR08(chip->PCIO, 0x03D5, 0); + VGA_WR08(chip->PCIO, 0x03D4, 0x54); + VGA_WR08(chip->PCIO, 0x03D5, 0); + VGA_WR08(chip->PCIO, 0x03D4, 0x21); + VGA_WR08(chip->PCIO, 0x03D5, 0xfa); + } + + VGA_WR08(chip->PCIO, 0x03D4, 0x41); + VGA_WR08(chip->PCIO, 0x03D5, state->extra); } + LOAD_FIXED_STATE(Riva,FIFO); UpdateFifoState(chip); + /* * Load HW mode state. */ - VGA_WR08(chip->PCIO, 0x03D4, 0x19); VGA_WR08(chip->PCIO, 0x03D5, state->repaint0); VGA_WR08(chip->PCIO, 0x03D4, 0x1A); @@ -1563,16 +1660,22 @@ VGA_WR08(chip->PCIO, 0x03D5, state->cursor2); VGA_WR08(chip->PCIO, 0x03D4, 0x39); VGA_WR08(chip->PCIO, 0x03D5, state->interlace); - VGA_WR08(chip->PCIO, 0x03D4, 0x41); - VGA_WR08(chip->PCIO, 0x03D5, state->extra); - chip->PRAMDAC[0x00000508/4] = state->vpll; - chip->PRAMDAC[0x0000050C/4] = state->pllsel; + + if(!chip->flatPanel) { + chip->PRAMDAC0[0x00000508/4] = state->vpll; + chip->PRAMDAC0[0x0000050C/4] = state->pllsel; + if(chip->twoHeads) + chip->PRAMDAC0[0x00000520/4] = state->vpll2; + } else { + chip->PRAMDAC[0x00000848/4] = state->scale; + } chip->PRAMDAC[0x00000600/4] = state->general; + /* * Turn off VBlank enable and reset. */ - *(chip->VBLANKENABLE) = 0; - *(chip->VBLANK) = chip->VBlankBit; + chip->PCRTC[0x00000140/4] = 0; + chip->PCRTC[0x00000100/4] = chip->VBlankBit; /* * Set interrupt enable. */ @@ -1588,6 +1691,7 @@ /* Free count from first subchannel */ chip->FifoEmptyCount = chip->Rop->FifoFree; } + static void UnloadStateExt ( RIVA_HW_INST *chip, @@ -1619,44 +1723,46 @@ state->cursor2 = VGA_RD08(chip->PCIO, 0x03D5); VGA_WR08(chip->PCIO, 0x03D4, 0x39); state->interlace = VGA_RD08(chip->PCIO, 0x03D5); - VGA_WR08(chip->PCIO, 0x03D4, 0x41); - state->extra = VGA_RD08(chip->PCIO, 0x03D5); - state->vpll = chip->PRAMDAC[0x00000508/4]; - state->pllsel = chip->PRAMDAC[0x0000050C/4]; + state->vpll = chip->PRAMDAC0[0x00000508/4]; + state->vpll2 = chip->PRAMDAC0[0x00000520/4]; + state->vpllB = chip->PRAMDAC0[0x00000578/4]; + state->vpll2B = chip->PRAMDAC0[0x0000057C/4]; + state->pllsel = chip->PRAMDAC0[0x0000050C/4]; state->general = chip->PRAMDAC[0x00000600/4]; + state->scale = chip->PRAMDAC[0x00000848/4]; state->config = chip->PFB[0x00000200/4]; + switch (chip->Architecture) { case NV_ARCH_03: - state->offset0 = chip->PGRAPH[0x00000630/4]; - state->offset1 = chip->PGRAPH[0x00000634/4]; - state->offset2 = chip->PGRAPH[0x00000638/4]; - state->offset3 = chip->PGRAPH[0x0000063C/4]; - state->pitch0 = chip->PGRAPH[0x00000650/4]; - state->pitch1 = chip->PGRAPH[0x00000654/4]; - state->pitch2 = chip->PGRAPH[0x00000658/4]; - state->pitch3 = chip->PGRAPH[0x0000065C/4]; + state->offset = chip->PGRAPH[0x00000630/4]; + state->pitch = chip->PGRAPH[0x00000650/4]; break; case NV_ARCH_04: - state->offset0 = chip->PGRAPH[0x00000640/4]; - state->offset1 = chip->PGRAPH[0x00000644/4]; - state->offset2 = chip->PGRAPH[0x00000648/4]; - state->offset3 = chip->PGRAPH[0x0000064C/4]; - state->pitch0 = chip->PGRAPH[0x00000670/4]; - state->pitch1 = chip->PGRAPH[0x00000674/4]; - state->pitch2 = chip->PGRAPH[0x00000678/4]; - state->pitch3 = chip->PGRAPH[0x0000067C/4]; + state->offset = chip->PGRAPH[0x00000640/4]; + state->pitch = chip->PGRAPH[0x00000670/4]; break; case NV_ARCH_10: case NV_ARCH_20: - state->offset0 = chip->PGRAPH[0x00000640/4]; - state->offset1 = chip->PGRAPH[0x00000644/4]; - state->offset2 = chip->PGRAPH[0x00000648/4]; - state->offset3 = chip->PGRAPH[0x0000064C/4]; - state->pitch0 = chip->PGRAPH[0x00000670/4]; - state->pitch1 = chip->PGRAPH[0x00000674/4]; - state->pitch2 = chip->PGRAPH[0x00000678/4]; - state->pitch3 = chip->PGRAPH[0x0000067C/4]; + state->offset = chip->PGRAPH[0x00000640/4]; + state->pitch = chip->PGRAPH[0x00000670/4]; + if(chip->twoHeads) { + state->head = chip->PCRTC0[0x00000860/4]; + state->head2 = chip->PCRTC0[0x00002860/4]; + VGA_WR08(chip->PCIO, 0x03D4, 0x44); + state->crtcOwner = VGA_RD08(chip->PCIO, 0x03D5); + } + VGA_WR08(chip->PCIO, 0x03D4, 0x41); + state->extra = VGA_RD08(chip->PCIO, 0x03D5); + state->cursorConfig = chip->PCRTC[0x00000810/4]; + + if((chip->Chipset & 0x0ff0) == 0x0110) { + state->dither = chip->PRAMDAC[0x0528/4]; + } else + if((chip->Chipset & 0x0ff0) >= 0x0170) { + state->dither = chip->PRAMDAC[0x083C/4]; + } + break; } } @@ -1666,6 +1772,15 @@ unsigned start ) { + chip->PCRTC[0x800/4] = start; +} + +static void SetStartAddress3 +( + RIVA_HW_INST *chip, + unsigned start +) +{ int offset = start >> 2; int pan = (start & 3) << 1; unsigned char tmp; @@ -1692,99 +1807,6 @@ VGA_WR08(chip->PCIO, 0x3C0, 0x13); VGA_WR08(chip->PCIO, 0x3C0, pan); } -static void nv3SetSurfaces2D -( - RIVA_HW_INST *chip, - unsigned surf0, - unsigned surf1 -) -{ - RivaSurface *Surface = (RivaSurface *)&(chip->FIFO[0x0000E000/4]); - - RIVA_FIFO_FREE(*chip,Tri03,5); - chip->FIFO[0x00003800] = 0x80000003; - Surface->Offset = surf0; - chip->FIFO[0x00003800] = 0x80000004; - Surface->Offset = surf1; - chip->FIFO[0x00003800] = 0x80000013; -} -static void nv4SetSurfaces2D -( - RIVA_HW_INST *chip, - unsigned surf0, - unsigned surf1 -) -{ - RivaSurface *Surface = (RivaSurface *)&(chip->FIFO[0x0000E000/4]); - - chip->FIFO[0x00003800] = 0x80000003; - Surface->Offset = surf0; - chip->FIFO[0x00003800] = 0x80000004; - Surface->Offset = surf1; - chip->FIFO[0x00003800] = 0x80000014; -} -static void nv10SetSurfaces2D -( - RIVA_HW_INST *chip, - unsigned surf0, - unsigned surf1 -) -{ - RivaSurface *Surface = (RivaSurface *)&(chip->FIFO[0x0000E000/4]); - - chip->FIFO[0x00003800] = 0x80000003; - Surface->Offset = surf0; - chip->FIFO[0x00003800] = 0x80000004; - Surface->Offset = surf1; - chip->FIFO[0x00003800] = 0x80000014; -} -static void nv3SetSurfaces3D -( - RIVA_HW_INST *chip, - unsigned surf0, - unsigned surf1 -) -{ - RivaSurface *Surface = (RivaSurface *)&(chip->FIFO[0x0000E000/4]); - - RIVA_FIFO_FREE(*chip,Tri03,5); - chip->FIFO[0x00003800] = 0x80000005; - Surface->Offset = surf0; - chip->FIFO[0x00003800] = 0x80000006; - Surface->Offset = surf1; - chip->FIFO[0x00003800] = 0x80000013; -} -static void nv4SetSurfaces3D -( - RIVA_HW_INST *chip, - unsigned surf0, - unsigned surf1 -) -{ - RivaSurface *Surface = (RivaSurface *)&(chip->FIFO[0x0000E000/4]); - - chip->FIFO[0x00003800] = 0x80000005; - Surface->Offset = surf0; - chip->FIFO[0x00003800] = 0x80000006; - Surface->Offset = surf1; - chip->FIFO[0x00003800] = 0x80000014; -} -static void nv10SetSurfaces3D -( - RIVA_HW_INST *chip, - unsigned surf0, - unsigned surf1 -) -{ - RivaSurface3D *Surfaces3D = (RivaSurface3D *)&(chip->FIFO[0x0000E000/4]); - - RIVA_FIFO_FREE(*chip,Tri03,4); - chip->FIFO[0x00003800] = 0x80000007; - Surfaces3D->RenderBufferOffset = surf0; - Surfaces3D->ZBufferOffset = surf1; - chip->FIFO[0x00003800] = 0x80000014; -} - /****************************************************************************\ * * * Probe RIVA Chip Configuration * @@ -1848,9 +1870,6 @@ } chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500; chip->CURSOR = &(chip->PRAMIN[0x00008000/4 - 0x0800/4]); - chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); - chip->VBLANKENABLE = &(chip->PGRAPH[0x0140/4]); - chip->VBLANK = &(chip->PGRAPH[0x0100/4]); chip->VBlankBit = 0x00000100; chip->MaxVClockFreqKHz = 256000; /* @@ -1861,9 +1880,7 @@ chip->CalcStateExt = CalcStateExt; chip->LoadStateExt = LoadStateExt; chip->UnloadStateExt = UnloadStateExt; - chip->SetStartAddress = SetStartAddress; - chip->SetSurfaces2D = nv3SetSurfaces2D; - chip->SetSurfaces3D = nv3SetSurfaces3D; + chip->SetStartAddress = SetStartAddress3; chip->LockUnlock = nv3LockUnlock; } static void nv4GetConfig @@ -1909,9 +1926,6 @@ } chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500; chip->CURSOR = &(chip->PRAMIN[0x00010000/4 - 0x0800/4]); - chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); - chip->VBLANKENABLE = &(chip->PCRTC[0x0140/4]); - chip->VBLANK = &(chip->PCRTC[0x0100/4]); chip->VBlankBit = 0x00000001; chip->MaxVClockFreqKHz = 350000; /* @@ -1923,8 +1937,6 @@ chip->LoadStateExt = LoadStateExt; chip->UnloadStateExt = UnloadStateExt; chip->SetStartAddress = SetStartAddress; - chip->SetSurfaces2D = nv4SetSurfaces2D; - chip->SetSurfaces3D = nv4SetSurfaces3D; chip->LockUnlock = nv4LockUnlock; } static void nv10GetConfig @@ -1936,16 +1948,21 @@ #if X_BYTE_ORDER == X_BIG_ENDIAN /* turn on big endian register access */ - chip->PMC[0x00000004/4] = 0x01000001; + if(!(chip->PMC[0x00000004/4] & 0x01000001)) + chip->PMC[0x00000004/4] = 0x01000001; #endif /* * Fill in chip configuration. */ - if(pNv->Chipset == NV_CHIP_IGEFORCE2) { + if((pNv->Chipset && 0xffff) == 0x01a0) { int amt = pciReadLong(pciTag(0, 0, 1), 0x7C); chip->RamAmountKBytes = (((amt >> 6) & 31) + 1) * 1024; + } else if((pNv->Chipset & 0xffff) == 0x01f0) { + int amt = pciReadLong(pciTag(0, 0, 1), 0x84); + + chip->RamAmountKBytes = (((amt >> 4) & 127) + 1) * 1024; } else { switch ((chip->PFB[0x0000020C/4] >> 20) & 0x000000FF) { @@ -1983,15 +2000,30 @@ default: chip->RamBandwidthKBytesPerSec = 1000000; break; + } + + chip->CrystalFreqKHz = (chip->PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : + 13500; + switch(pNv->Chipset & 0x0ff0) { + case 0x0170: + case 0x0180: + case 0x01F0: + case 0x0250: + case 0x0280: + case 0x0300: + case 0x0310: + case 0x0320: + case 0x0330: + case 0x0340: + if(chip->PEXTDEV[0x0000/4] & (1 << 22)) + chip->CrystalFreqKHz = 27000; + break; + default: + break; } - chip->CrystalFreqKHz = (chip->PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : - (chip->PEXTDEV[0x0000/4] & (1 << 22)) ? 27000 : - 13500; + chip->CursorStart = (chip->RamAmountKBytes - 128) * 1024; chip->CURSOR = NULL; /* can't set this here */ - chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); - chip->VBLANKENABLE = &(chip->PCRTC[0x0140/4]); - chip->VBLANK = &(chip->PCRTC[0x0100/4]); chip->VBlankBit = 0x00000001; chip->MaxVClockFreqKHz = 350000; /* @@ -2003,9 +2035,26 @@ chip->LoadStateExt = LoadStateExt; chip->UnloadStateExt = UnloadStateExt; chip->SetStartAddress = SetStartAddress; - chip->SetSurfaces2D = nv10SetSurfaces2D; - chip->SetSurfaces3D = nv10SetSurfaces3D; - chip->LockUnlock = nv10LockUnlock; + chip->LockUnlock = nv4LockUnlock; + + switch(pNv->Chipset & 0x0ff0) { + case 0x0110: + case 0x0170: + case 0x0180: + case 0x01F0: + case 0x0250: + case 0x0280: + case 0x0300: + case 0x0310: + case 0x0320: + case 0x0330: + case 0x0340: + chip->twoHeads = TRUE; + break; + default: + chip->twoHeads = FALSE; + break; + } } int RivaGetConfig ( @@ -2035,6 +2084,7 @@ default: return (-1); } + chip->Chipset = pNv->Chipset; /* * Fill in FIFO pointers. */ @@ -2045,7 +2095,6 @@ chip->Blt = (RivaScreenBlt *)&(chip->FIFO[0x00008000/4]); chip->Bitmap = (RivaBitmap *)&(chip->FIFO[0x0000A000/4]); chip->Line = (RivaLine *)&(chip->FIFO[0x0000C000/4]); - chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); return (0); } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.15 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.15 Mon Oct 8 18:28:53 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h Mon Feb 10 18:42:51 2003 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.15 2001/10/08 22:28:53 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.24 2003/02/10 23:42:51 mvojkovi Exp $ */ #ifndef __RIVA_HW_H__ #define __RIVA_HW_H__ #define RIVA_SW_VERSION 0x00010003 @@ -225,74 +225,6 @@ U032 MonochromeData01E; } RivaBitmap; /* - * 3D textured, Z buffered triangle. - */ -typedef volatile struct -{ - U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else - U016 FifoFree; - U016 Nop; -#endif - U032 reserved01[0x0BC]; - U032 TextureOffset; - U032 TextureFormat; - U032 TextureFilter; - U032 FogColor; -/* This is a problem on LynxOS */ -#ifdef Control -#undef Control -#endif - U032 Control; - U032 AlphaTest; - U032 reserved02[0x339]; - U032 FogAndIndex; - U032 Color; - float ScreenX; - float ScreenY; - float ScreenZ; - float EyeM; - float TextureS; - float TextureT; -} RivaTexturedTriangle03; -typedef volatile struct -{ - U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else - U016 FifoFree; - U016 Nop; -#endif - U032 reserved01[0x0BB]; - U032 ColorKey; - U032 TextureOffset; - U032 TextureFormat; - U032 TextureFilter; - U032 Blend; -/* This is a problem on LynxOS */ -#ifdef Control -#undef Control -#endif - U032 Control; - U032 FogColor; - U032 reserved02[0x39]; - struct - { - float ScreenX; - float ScreenY; - float ScreenZ; - float EyeM; - U032 Color; - U032 Specular; - float TextureS; - float TextureT; - } Vertex[16]; - U032 DrawTriangle3D; -} RivaTexturedTriangle05; -/* * 2D line. */ typedef volatile struct @@ -363,6 +295,9 @@ * * \***************************************************************************/ +#define FP_ENABLE 1 +#define FP_DITHER 2 + struct _riva_hw_inst; struct _riva_hw_state; /* @@ -375,6 +310,7 @@ */ U032 Architecture; U032 Version; + U032 Chipset; U032 CrystalFreqKHz; U032 RamAmountKBytes; U032 MaxVClockFreqKHz; @@ -385,11 +321,14 @@ U032 FifoFreeCount; U032 FifoEmptyCount; U032 CursorStart; + U032 flatPanel; + Bool twoHeads; /* * Non-FIFO registers. */ + volatile U032 *PCRTC0; volatile U032 *PCRTC; - volatile U032 *PRAMDAC; + volatile U032 *PRAMDAC0; volatile U032 *PFB; volatile U032 *PFIFO; volatile U032 *PGRAPH; @@ -399,12 +338,12 @@ volatile U032 *PRAMIN; volatile U032 *FIFO; volatile U032 *CURSOR; - volatile U032 *CURSORPOS; - volatile U032 *VBLANKENABLE; - volatile U032 *VBLANK; + volatile U008 *PCIO0; volatile U008 *PCIO; volatile U008 *PVIO; + volatile U008 *PDIO0; volatile U008 *PDIO; + volatile U032 *PRAMDAC; /* * Common chip functions. */ @@ -413,8 +352,6 @@ void (*LoadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); void (*UnloadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); void (*SetStartAddress)(struct _riva_hw_inst *,U032); - void (*SetSurfaces2D)(struct _riva_hw_inst *,U032,U032); - void (*SetSurfaces3D)(struct _riva_hw_inst *,U032,U032); int (*ShowHideCursor)(struct _riva_hw_inst *,int); void (*LockUnlock)(struct _riva_hw_inst *, int); /* @@ -431,8 +368,6 @@ RivaScreenBlt *Blt; RivaBitmap *Bitmap; RivaLine *Line; - RivaTexturedTriangle03 *Tri03; - RivaTexturedTriangle05 *Tri05; } RIVA_HW_INST; /* * Extended mode state information. @@ -446,26 +381,29 @@ U032 repaint0; U032 repaint1; U032 screen; + U032 scale; + U032 dither; U032 extra; U032 pixel; U032 horiz; U032 arbitration0; U032 arbitration1; U032 vpll; + U032 vpll2; + U032 vpllB; + U032 vpll2B; U032 pllsel; U032 general; + U032 crtcOwner; + U032 head; + U032 head2; U032 config; + U032 cursorConfig; U032 cursor0; U032 cursor1; U032 cursor2; - U032 offset0; - U032 offset1; - U032 offset2; - U032 offset3; - U032 pitch0; - U032 pitch1; - U032 pitch2; - U032 pitch3; + U032 offset; + U032 pitch; } RIVA_HW_STATE; /* @@ -475,6 +413,7 @@ #define RIVA_FIFO_FREE(hwinst,hwptr,cnt) \ { \ while ((hwinst).FifoFreeCount < (cnt)) { \ + mem_barrier(); \ mem_barrier(); \ (hwinst).FifoFreeCount = (hwinst).hwptr->FifoFree >> 2; \ } \ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.8 Wed Sep 19 19:40:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h Tue Jan 29 20:35:03 2002 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.8 2001/09/19 23:40:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.9 2002/01/30 01:35:03 mvojkovi Exp $ */ /* @@ -633,180 +633,6 @@ {0x000001C9, 0x0077D777}, {0x00000186, 0x000070E5}, {0x0000020C, 0x0E0D0D0D} -}; -static unsigned nv10tri05TablePGRAPH[][2] = -{ - {(0x00000E00/4), 0x00000000}, - {(0x00000E04/4), 0x00000000}, - {(0x00000E08/4), 0x00000000}, - {(0x00000E0C/4), 0x00000000}, - {(0x00000E10/4), 0x00001000}, - {(0x00000E14/4), 0x00001000}, - {(0x00000E18/4), 0x4003ff80}, - {(0x00000E1C/4), 0x00000000}, - {(0x00000E20/4), 0x00000000}, - {(0x00000E24/4), 0x00000000}, - {(0x00000E28/4), 0x00000000}, - {(0x00000E2C/4), 0x00000000}, - {(0x00000E30/4), 0x00080008}, - {(0x00000E34/4), 0x00080008}, - {(0x00000E38/4), 0x00000000}, - {(0x00000E3C/4), 0x00000000}, - {(0x00000E40/4), 0x00000000}, - {(0x00000E44/4), 0x00000000}, - {(0x00000E48/4), 0x00000000}, - {(0x00000E4C/4), 0x00000000}, - {(0x00000E50/4), 0x00000000}, - {(0x00000E54/4), 0x00000000}, - {(0x00000E58/4), 0x00000000}, - {(0x00000E5C/4), 0x00000000}, - {(0x00000E60/4), 0x00000000}, - {(0x00000E64/4), 0x10000000}, - {(0x00000E68/4), 0x00000000}, - {(0x00000E6C/4), 0x00000000}, - {(0x00000E70/4), 0x00000000}, - {(0x00000E74/4), 0x00000000}, - {(0x00000E78/4), 0x00000000}, - {(0x00000E7C/4), 0x00000000}, - {(0x00000E80/4), 0x00000000}, - {(0x00000E84/4), 0x00000000}, - {(0x00000E88/4), 0x08000000}, - {(0x00000E8C/4), 0x00000000}, - {(0x00000E90/4), 0x00000000}, - {(0x00000E94/4), 0x00000000}, - {(0x00000E98/4), 0x00000000}, - {(0x00000E9C/4), 0x4B7FFFFF}, - {(0x00000EA0/4), 0x00000000}, - {(0x00000EA4/4), 0x00000000}, - {(0x00000EA8/4), 0x00000000}, - {(0x00000F00/4), 0x07FF0800}, - {(0x00000F04/4), 0x07FF0800}, - {(0x00000F08/4), 0x07FF0800}, - {(0x00000F0C/4), 0x07FF0800}, - {(0x00000F10/4), 0x07FF0800}, - {(0x00000F14/4), 0x07FF0800}, - {(0x00000F18/4), 0x07FF0800}, - {(0x00000F1C/4), 0x07FF0800}, - {(0x00000F20/4), 0x07FF0800}, - {(0x00000F24/4), 0x07FF0800}, - {(0x00000F28/4), 0x07FF0800}, - {(0x00000F2C/4), 0x07FF0800}, - {(0x00000F30/4), 0x07FF0800}, - {(0x00000F34/4), 0x07FF0800}, - {(0x00000F38/4), 0x07FF0800}, - {(0x00000F3C/4), 0x07FF0800}, - {(0x00000F40/4), 0x10000000}, - {(0x00000F44/4), 0x00000000}, - {(0x00000F50/4), 0x00006740}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F50/4), 0x00006750}, - {(0x00000F54/4), 0x40000000}, - {(0x00000F54/4), 0x40000000}, - {(0x00000F54/4), 0x40000000}, - {(0x00000F54/4), 0x40000000}, - {(0x00000F50/4), 0x00006760}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00006770}, - {(0x00000F54/4), 0xC5000000}, - {(0x00000F54/4), 0xC5000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00006780}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x000067A0}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F50/4), 0x00006AB0}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F50/4), 0x00006AC0}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00006C10}, - {(0x00000F54/4), 0xBF800000}, - {(0x00000F50/4), 0x00007030}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00007040}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00007050}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00007060}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00007070}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00007080}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00007090}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x000070A0}, - {(0x00000F54/4), 0x7149F2CA}, - {(0x00000F50/4), 0x00006A80}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F50/4), 0x00006AA0}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00000040}, - {(0x00000F54/4), 0x00000005}, - {(0x00000F50/4), 0x00006400}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x4B7FFFFF}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00006410}, - {(0x00000F54/4), 0xC5000000}, - {(0x00000F54/4), 0xC5000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00006420}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x00006430}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x000064C0}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F54/4), 0x477FFFFF}, - {(0x00000F54/4), 0x3F800000}, - {(0x00000F50/4), 0x000064D0}, - {(0x00000F54/4), 0xC5000000}, - {(0x00000F54/4), 0xC5000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x000064E0}, - {(0x00000F54/4), 0xC4FFF000}, - {(0x00000F54/4), 0xC4FFF000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F50/4), 0x000064F0}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F54/4), 0x00000000}, - {(0x00000F40/4), 0x30000000}, - {(0x00000F44/4), 0x00000004}, - {(0x00000F48/4), 0x10000000}, - {(0x00000F4C/4), 0x00000000} }; static unsigned nv10TablePRAMIN[][2] = { Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile:1.19 xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile:1.19 Wed May 16 02:48:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile Mon Feb 17 12:06:43 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile,v 1.19 2001/05/16 06:48:10 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile,v 1.21 2003/02/17 17:06:43 dawes Exp $ XCOMM XCOMM This is an Imakefile for the Rendition driver. @@ -7,11 +7,11 @@ #define IHaveModules #include <Server.tmpl> -SRCS = rendition.c vboard.c vmodes.c vramdac.c v1krisc.c vvga.c \ - vmisc.c hwcursor.c vloaduc.c accel.c rendition_shadow.c +SRCS = rendition.c vboard.c vmodes.c vramdac.c v1krisc.c \ + hwcursor.c vloaduc.c accel.c rendition_shadow.c -OBJS = rendition.o vboard.o vmodes.o vramdac.o v1krisc.o vvga.o \ - vmisc.o hwcursor.o vloaduc.o accel.o rendition_shadow.o +OBJS = rendition.o vboard.o vmodes.o vramdac.o v1krisc.o \ + hwcursor.o vloaduc.o accel.o rendition_shadow.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -19,7 +19,7 @@ INCLUDES = -I. -I$(SERVERSRC)/fb \ -I$(SERVERSRC)/mi -I$(SERVERSRC)/cfb\ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(XF86SRC)/vgahw \ - -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(XF86OSSRC)/vbe \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(XF86SRC)/vbe \ -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(FONTINCSRC) -I$(XINCLUDESRC) \ -I$(SERVERSRC)/include -I$(XF86SRC)/xaa \ -I$(XF86SRC)/ramdac -I$(SERVERSRC)/Xext \ @@ -61,8 +61,6 @@ InstallDriverSDKNonExecFile(rendition_shadow.c,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(rendition_shadow.h,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(commonregs.h,$(DRIVERSDKDIR)/drivers/rendition) -InstallDriverSDKNonExecFile(vmisc.h,$(DRIVERSDKDIR)/drivers/rendition) -InstallDriverSDKNonExecFile(vmisc.c,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(v1kregs.h,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(v1krisc.c,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(v1krisc.h,$(DRIVERSDKDIR)/drivers/rendition) @@ -75,8 +73,6 @@ InstallDriverSDKNonExecFile(vramdac.c,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(vramdac.h,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(vtypes.h,$(DRIVERSDKDIR)/drivers/rendition) -InstallDriverSDKNonExecFile(vvga.c,$(DRIVERSDKDIR)/drivers/rendition) -InstallDriverSDKNonExecFile(vvga.h,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(v2kregs.h,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(vgafont-vrx.data,$(DRIVERSDKDIR)/drivers/rendition) InstallDriverSDKNonExecFile(vgapalette.data,$(DRIVERSDKDIR)/drivers/rendition) Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.10 Fri Jun 15 17:22:54 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c Thu Apr 4 09:05:45 2002 @@ -3,7 +3,7 @@ * * accelerator functions for X */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.10 2001/06/15 21:22:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.12 2002/04/04 14:05:45 eich Exp $ */ @@ -17,7 +17,6 @@ #include "vboard.h" #include "vmodes.h" #include "vos.h" -#include "vmisc.h" #include "v1kregs.h" #include "v1krisc.h" #include "v2kregs.h" @@ -117,11 +116,11 @@ ErrorF("RENDITION: RENDITIONAccelPreInit called\n"); sleep(1); #endif - +#if 1 if (RENDITIONLoadUcode(pScreenInfo)){ ErrorF ("RENDITION: AccelPreInit - Warning. Loading of microcode failed!!\n"); } - +#endif pRendition->board.fbOffset += MC_SIZE; #ifdef DEBUG @@ -211,10 +210,10 @@ AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; AvailFBArea.x2 = pScreenInfo->displayWidth; - AvailFBArea.y2 = (((pScreenInfo->videoRam*1024)- - pRendition->board.fbOffset) / - ((pScreenInfo->displayWidth * pScreenInfo->bitsPerPixel) / 8)); - + AvailFBArea.y2 = (((pScreenInfo->videoRam*1024) - + pRendition->board.fbOffset) / + ((pScreenInfo->displayWidth * pScreenInfo->bitsPerPixel) + / 8)); xf86InitFBManager(pScreen, &AvailFBArea); XAAInit(pScreen, pXAAinfo); @@ -290,7 +289,7 @@ RENDITIONInitUcode(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; if (0 == verite_getstride(pScreenInfo, NULL, &pRendition->board.mode.stride0, @@ -368,7 +367,7 @@ RENDITIONRestoreUcode(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; vu8 memend; @@ -411,7 +410,7 @@ RENDITIONSaveUcode(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; vu8 memend; #ifdef DEBUG @@ -446,7 +445,7 @@ RENDITIONSyncV1000(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; int c; @@ -556,7 +555,7 @@ int w, int h) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; #ifdef DEBUG @@ -608,7 +607,7 @@ int x, int y, int w, int h) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; #ifdef DEBUG @@ -640,7 +639,7 @@ int bias) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob = pRendition->board.io_base; + IOADDRESS iob = pRendition->board.io_base; #ifdef DEBUG Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c:1.7 Fri Mar 31 15:13:25 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c Thu Apr 4 09:05:45 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c,v 1.7 2000/03/31 20:13:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/hwcursor.c,v 1.8 2002/04/04 14:05:45 eich Exp $ */ /* * includes */ @@ -96,9 +96,9 @@ #endif infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | - HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_AND_SOURCE_WITH_MASK| - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8; + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK| + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8; infoPtr->SetCursorColors = RENDITIONSetCursorColors; Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.46 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.50 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.46 Wed Nov 7 23:15:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c Tue Oct 8 18:14:10 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.46 2001/11/08 04:15:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.50 2002/10/08 22:14:10 tsi Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -42,7 +42,6 @@ */ #define USE_ACCEL 0 - /* * includes */ @@ -55,9 +54,7 @@ #include "vtypes.h" #include "vboard.h" -#include "vmisc.h" #include "vmodes.h" -#include "vvga.h" #include "accel.h" #include "vramdac.h" #include "rendition_shadow.h" @@ -96,10 +93,11 @@ static ModeStatus renditionValidMode(int, DisplayModePtr, Bool, int); static Bool renditionMapMem(ScrnInfoPtr pScreenInfo); static Bool renditionUnmapMem(ScrnInfoPtr pScreenInfo); - +#if 0 static xf86MonPtr renditionDDC(ScrnInfoPtr pScreenInfo); static unsigned int renditionDDC1Read (ScrnInfoPtr pScreenInfo); -static void renditionProbeDDC(ScrnInfoPtr pScrn, int index); +#endif +static xf86MonPtr renditionProbeDDC(ScrnInfoPtr pScrn, int index); static void renditionLoadPalette(ScrnInfoPtr, int, int *, LOCO *, VisualPtr); @@ -342,30 +340,32 @@ } - +#if 0 static Bool renditionClockSelect(ScrnInfoPtr pScreenInfo, int ClockNumber) { + vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); static CARD8 save_misc; switch (ClockNumber) { case CLK_REG_SAVE: - save_misc = inb(0x3CC); + save_misc = inb(pvgaHW->PIOOffset + VGA_MISC_OUT_R); break; case CLK_REG_RESTORE: - outb(0x3C2, save_misc); + outb(pvgaHW->PIOOffset + VGA_MISC_OUT_W, save_misc); break; default: - outb(0x3C2, (save_misc & 0xF3) | ((ClockNumber << 2) & 0x0C)); + outb(pvgaHW->PIOOffset + VGA_MISC_OUT_W, + (save_misc & 0xF3) | ((ClockNumber << 2) & 0x0C)); break; } return TRUE; } - +#endif static renditionPtr renditionGetRec(ScrnInfoPtr pScreenInfo) @@ -405,7 +405,7 @@ #endif } - +#if 0 static void renditionProtect(ScrnInfoPtr pScreenInfo, Bool On) { @@ -421,7 +421,7 @@ sleep(1); #endif } - +#endif static Bool renditionSaveScreen(ScreenPtr pScreen, int mode) @@ -434,6 +434,7 @@ return vgaHWSaveScreen(pScreen, mode); } +#if 0 static void renditionBlankScreen(ScrnInfoPtr pScreenInfo, Bool Unblank) { @@ -448,12 +449,14 @@ sleep(1); #endif } +#endif /* * This function is called once for each screen at the start of the first * server generation to initialise the screen for all server generations. */ + static Bool renditionPreInit(ScrnInfoPtr pScreenInfo, int flags) { @@ -484,7 +487,8 @@ return FALSE; if (flags & PROBE_DETECT) { - renditionProbeDDC(pScreenInfo, pRendition->pEnt->index); + ConfiguredMonitor = + renditionProbeDDC(pScreenInfo, pRendition->pEnt->index); return TRUE; } @@ -511,13 +515,7 @@ * XXX This could be refined if some VGA memory resources are not * decoded in operating mode. */ - { - resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB0000,0xB7FFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - _END }; - xf86SetOperatingState(vgamem, pRendition->pEnt->index, ResUnusedOpr); - } + xf86SetOperatingState(resVgaMem, pRendition->pEnt->index, ResUnusedOpr); if (xf86RegisterResources(pRendition->pEnt->index, NULL, ResExclusive)) return FALSE; @@ -601,8 +599,20 @@ renditionClockRange.clockIndex = -1; } + /***********************************************/ + /* ensure vgahw private structure is allocated */ + + if (!vgaHWGetHWRec(pScreenInfo)) + return FALSE; + + pvgaHW = VGAHWPTR(pScreenInfo); + pvgaHW->MapSize = 0x00010000; /* Standard 64kB VGA window */ + vgaHWGetIOBase(pvgaHW); /* Get VGA I/O base */ + pRendition->board.accel=0; - pRendition->board.io_base=pRendition->PciInfo->ioBase[1]; + pRendition->board.vgaio_base = pvgaHW->PIOOffset; + pRendition->board.io_base = + pRendition->board.vgaio_base + pRendition->PciInfo->ioBase[1]; pRendition->board.mmio_base=0; pRendition->board.vmmio_base=0; pRendition->board.mem_size=0; @@ -622,41 +632,29 @@ /* XXX Is this still true? If so, the wrong base is being checked */ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "Rendition %s @ %x/%x\n", - renditionChipsets[pRendition->board.chip==V1000_DEVICE ? 0:1].name, - pRendition->board.io_base, - pRendition->board.mem_base); + renditionChipsets[pRendition->board.chip==V1000_DEVICE ? 0:1] + .name, + pRendition->PciInfo->ioBase[1], + pRendition->PciInfo->memBase[0]); /* First of all get a "clean" starting state */ verite_resetboard(pScreenInfo); + /* determine video ram -- to do so, we assume a full size memory of 16M, - * then map it and use verite_getmemorysize() to determine the real amount of - * memory */ - pScreenInfo->videoRam=pRendition->board.mem_size=16<<20; + * then map it and use verite_getmemorysize() to determine the real + * amount of memory */ + pScreenInfo->videoRam = 16<<10; + pRendition->board.mem_size = pScreenInfo->videoRam * 1024; renditionMapMem(pScreenInfo); - videoRam=verite_getmemorysize(pScreenInfo)>>10; - /* Unmapping delayed until after micrcode loading */ - /****************************************/ - /* Reserv memory and load the microcode */ - /****************************************/ -#if USE_ACCEL - if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0)) { - RENDITIONAccelPreInit (pScreenInfo); - } - else - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - ("Skipping acceleration on users request\n")); -#else - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - ("Skipping acceleration\n")); -#endif + videoRam=verite_getmemorysize(pScreenInfo)>>10; + renditionUnmapMem(pScreenInfo); From = X_PROBED; xf86DrvMsg(pScreenInfo->scrnIndex, From, "videoRam: %d kBytes\n", videoRam); pScreenInfo->videoRam=videoRam; - pRendition->board.mem_size=videoRam; + pRendition->board.mem_size=videoRam * 1024; - /* Load the needed symbols */ if (!xf86LoadSubModule(pScreenInfo, "vgahw")){ @@ -666,43 +664,44 @@ pRendition->board.shadowfb=TRUE; - if ((in_string = xf86GetOptValString(pRendition->Options, OPTION_ROTATE))) { - if(!xf86NameCmp(in_string, "CW")) { - /* accel is disabled below for shadowFB */ - pRendition->board.shadowfb = TRUE; - pRendition->board.rotate = 1; - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - "Rotating screen clockwise - acceleration disabled\n"); - } else if(!xf86NameCmp(in_string, "CCW")) { - pRendition->board.shadowfb = TRUE; - pRendition->board.rotate = -1; - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Rotating screen " - "counter clockwise - acceleration disabled\n"); - } else { - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "\"%s\" is not a valid" - "value for Option \"Rotate\"\n", in_string); - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Valid options are \"CW\" or \"CCW\"\n"); - } + if ((in_string = xf86GetOptValString(pRendition->Options, OPTION_ROTATE))){ + if(!xf86NameCmp(in_string, "CW")) { + /* accel is disabled below for shadowFB */ + pRendition->board.shadowfb = TRUE; + pRendition->board.rotate = 1; + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n"); + } else if(!xf86NameCmp(in_string, "CCW")) { + pRendition->board.shadowfb = TRUE; + pRendition->board.rotate = -1; + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Rotating screen " + "counter clockwise - acceleration disabled\n"); + } else { + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", + in_string); + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n"); + } } - + if (xf86ReturnOptValBool(pRendition->Options, OPTION_SHADOW_FB,1)|| pRendition->board.rotate) { - if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Oops, \"ShadowFB\" module loading failed, disabling ShadowFB!\n"); - } - else{ - xf86LoaderReqSymLists(shadowfbSymbols, NULL); - pRendition->board.shadowfb=TRUE; - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Using \"Shadow Framebuffer\"\n"); - } + if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Oops, \"ShadowFB\" module loading failed, disabling ShadowFB!\n"); + } + else{ + xf86LoaderReqSymLists(shadowfbSymbols, NULL); + pRendition->board.shadowfb=TRUE; + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Using \"Shadow Framebuffer\"\n"); + } } else { - pRendition->board.shadowfb=FALSE; - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - "\"Shadow Framebuffer\" disabled\n"); + pRendition->board.shadowfb=FALSE; + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "\"Shadow Framebuffer\" disabled\n"); } @@ -715,17 +714,6 @@ xf86LoaderReqSymLists(ramdacSymbols, NULL); } -#if USE_ACCEL - /* Load XAA if needed */ - if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0) && - !pRendition->board.rotate) { - if (!xf86LoadSubModule(pScreenInfo, "xaa")) { - return FALSE; - } - xf86LoaderReqSymLists(xaaSymbols, NULL); - } -#endif - #if 0 /* Load DDC module if needed */ if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NO_DDC,0)){ @@ -750,8 +738,11 @@ ("Loading of DDC library failed, skipping DDC-probe\n")); } else { - xf86LoaderReqSymLists(vbeSymbols, NULL); - renditionProbeDDC(pScreenInfo, pRendition->pEnt->index); + xf86MonPtr mon; + xf86LoaderReqSymLists(vbeSymbols, NULL); + mon = renditionProbeDDC(pScreenInfo, pRendition->pEnt->index); + xf86PrintEDID(mon); + xf86SetDDCproperties(pScreenInfo, mon); } } else { @@ -760,16 +751,6 @@ } #endif - /***********************************************/ - /* ensure vgahw private structure is allocated */ - - if (!vgaHWGetHWRec(pScreenInfo)) - return FALSE; - - pvgaHW = VGAHWPTR(pScreenInfo); - pvgaHW->MapSize = 0x00010000; /* Standard 64kB VGA window */ - vgaHWGetIOBase(pvgaHW); /* Get VGA I/O base */ - /* * Determine clocks. Limit them to the first four because that's all that * can be addressed. @@ -787,8 +768,10 @@ } else { - xf86GetClocks(pScreenInfo, 4, renditionClockSelect, renditionProtect, - renditionBlankScreen, VGAHW_GET_IOBASE() + 0x0A, 0x08, 1, 28322); + xf86GetClocks(pScreenInfo, 4, + renditionClockSelect, renditionProtect, renditionBlankScreen, + pvgaHW->PIOOffset + pvgaHW->IOBase + VGA_IN_STAT_1_OFFSET, + 0x08, 1, 28322); From = X_PROBED; } xf86ShowClocks(pScreenInfo, From); @@ -849,7 +832,31 @@ xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Software cursor selected\n"); - renditionUnmapMem(pScreenInfo); + /* Unmapping delayed until after micrcode loading */ + /****************************************/ + /* Reserve memory and load the microcode */ + /****************************************/ +#if USE_ACCEL + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0) && + !pRendition->board.shadowfb) { + /* Load XAA if needed */ + if (xf86LoadSubModule(pScreenInfo, "xaa")) { + xf86LoaderReqSymLists(xaaSymbols, NULL); + renditionMapMem(pScreenInfo); + RENDITIONAccelPreInit (pScreenInfo); + renditionUnmapMem(pScreenInfo); + pRendition->board.accel = TRUE; + } else xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + ("XAA module not found: " + "Skipping acceleration\n")); + } + else + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + ("Skipping acceleration on users request\n")); +#else + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + ("Skipping acceleration\n")); +#endif #ifdef DEBUG ErrorF("PreInit OK...!!!!\n"); @@ -876,7 +883,7 @@ #endif } - +#if 0 /* Restore the mode that was saved on server entry */ static void renditionRestore(ScrnInfoPtr pScreenInfo) @@ -897,7 +904,7 @@ sleep(1); #endif } - +#endif /* Set a graphics mode */ static Bool @@ -913,6 +920,7 @@ #endif pvgaHW = VGAHWPTR(pScreenInfo); + /* construct a modeinfo for the verite_setmode function */ modeinfo->clock=pMode->SynthClock; modeinfo->hdisplay=pMode->HDisplay; @@ -925,10 +933,10 @@ modeinfo->vsyncend=pMode->VSyncEnd; modeinfo->vtotal=pMode->VTotal; - modeinfo->screenwidth=pMode->HDisplay; - modeinfo->virtualwidth=pScreenInfo->virtualX&0xfff8; - modeinfo->screenheight=pMode->VDisplay; - modeinfo->virtualheight=pScreenInfo->virtualY&0xfff8; + modeinfo->screenwidth = pMode->HDisplay; + modeinfo->virtualwidth = pScreenInfo->virtualX & 0xfff8; + modeinfo->screenheight = pMode->VDisplay; + modeinfo->virtualheight = pScreenInfo->virtualY & 0xfff8; if ((pMode->Flags&(V_PHSYNC|V_NHSYNC)) && (pMode->Flags&(V_PVSYNC|V_NVSYNC))) { @@ -990,64 +998,23 @@ return TRUE; } - -static Bool -renditionEnterGraphics(ScreenPtr pScreen, ScrnInfoPtr pScreenInfo) -{ - vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); - -#ifdef DEBUG - ErrorF("RENDITION: renditionEnterGraphics() called\n"); - sleep(2); -#endif - - /* Map VGA aperture */ - if (!vgaHWMapMem(pScreenInfo)) - return FALSE; - - /* Unlock VGA registers */ - vgaHWUnlock(pvgaHW); - - /* Save the current state and setup the current mode */ - renditionSave(pScreenInfo); - - if (!renditionSetMode(pScreenInfo, pScreenInfo->currentMode)) - return FALSE; - - /* Possibly blank the screen */ - if (pScreen) - renditionSaveScreen(pScreen, SCREEN_SAVER_ON); - - (*pScreenInfo->AdjustFrame)(pScreenInfo->scrnIndex, - pScreenInfo->frameX0, pScreenInfo->frameY0, 0); - -#ifdef DEBUG - ErrorF("Entergraphics OK...!!!!\n"); - sleep(1); -#endif - - return TRUE; -} - - static void renditionLeaveGraphics(ScrnInfoPtr pScreenInfo) { + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + #ifdef DEBUG ErrorF("RENDITION: renditionLeaveGraphics() called\n"); - - ErrorF("Leavegraphics..!!!!\n"); sleep(1); -#endif -#if 0 - verite_textmode(&RENDITIONPTR(pScreenInfo)->board); #endif - renditionRestore(pScreenInfo); + verite_restore(pScreenInfo, &pRendition->saveRegs); + + vgaHWProtect(pScreenInfo, TRUE); + vgaHWRestore(pScreenInfo, &VGAHWPTR(pScreenInfo)->SavedReg, VGA_SR_ALL); + vgaHWProtect(pScreenInfo, FALSE); + vgaHWLock(VGAHWPTR(pScreenInfo)); -#if 0 - verite_textmode(&RENDITIONPTR(pScreenInfo)->board); -#endif #ifdef DEBUG ErrorF("Leavegraphics OK...!!!!\n"); sleep(1); @@ -1065,24 +1032,24 @@ #ifdef DEBUG ErrorF("RENDITION: renditionCloseScreen() called\n"); - sleep(1); #endif if (prenditionPriv->board.hwcursor_used) - RenditionHWCursorRelease(pScreenInfo); + RenditionHWCursorRelease(pScreenInfo); if (prenditionPriv->board.accel) - RENDITIONAccelNone(pScreenInfo); + RENDITIONAccelNone(pScreenInfo); - if (prenditionPriv && (pScreen->CloseScreen = prenditionPriv->CloseScreen)) - { + if (prenditionPriv + && (pScreen->CloseScreen = prenditionPriv->CloseScreen)) { prenditionPriv->CloseScreen = NULL; Closed = (*pScreen->CloseScreen)(scrnIndex, pScreen); } if (pScreenInfo->vtSema) renditionLeaveGraphics(pScreenInfo); + pScreenInfo->vtSema = FALSE; #ifdef DEBUG @@ -1103,13 +1070,11 @@ vgaHWDPMSSet(pScreen, mode, flags); } - static Bool renditionScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - renditionPtr prenditionPriv; Bool Inited = FALSE; unsigned char *FBBase; VisualPtr visual; @@ -1120,46 +1085,66 @@ ErrorF("RENDITION: renditionScreenInit() called\n"); sleep(1); #endif + /* Get vgahw private */ + pvgaHW = VGAHWPTR(pScreenInfo); /* Get driver private */ - prenditionPriv=renditionGetRec(pScreenInfo); - if (NULL == prenditionPriv) /* xcalloc failed */ - return FALSE; + pRendition=renditionGetRec(pScreenInfo); + + /* Save the current state and setup the current mode */ + renditionSave(pScreenInfo); - /* Initialise graphics mode */ - if (!renditionEnterGraphics(pScreen, pScreenInfo)) + /* Map VGA aperture */ + if (!vgaHWMapMem(pScreenInfo)) return FALSE; - /* Get vgahw private */ - pvgaHW = VGAHWPTR(pScreenInfo); + if (!renditionMapMem(pScreenInfo)) + return FALSE; + + /* Unlock VGA registers */ + vgaHWUnlock(pvgaHW); + + verite_save(pScreenInfo); + + if (!renditionSetMode(pScreenInfo, pScreenInfo->currentMode)) + return FALSE; + + /* blank the screen */ + renditionSaveScreen(pScreen, SCREEN_SAVER_ON); + + (*pScreenInfo->AdjustFrame)(pScreenInfo->scrnIndex, + pScreenInfo->frameX0, pScreenInfo->frameY0, 0); + miClearVisualTypes(); if (!miSetVisualTypes(pScreenInfo->depth, - miGetDefaultVisualMask(pScreenInfo->depth), - pScreenInfo->rgbBits, pScreenInfo->defaultVisual)) - return FALSE; + miGetDefaultVisualMask(pScreenInfo->depth), + pScreenInfo->rgbBits, pScreenInfo->defaultVisual)) + return FALSE; miSetPixmapDepths (); if (pRendition->board.rotate) { - height = pScreenInfo->virtualX; - width = pScreenInfo->virtualY; + height = pScreenInfo->virtualX; + width = pScreenInfo->virtualY; } else { - width = pScreenInfo->virtualX; - height = pScreenInfo->virtualY; + width = pScreenInfo->virtualX; + height = pScreenInfo->virtualY; } if(pRendition->board.shadowfb) { - pRendition->board.shadowPitch = BitmapBytePad(pScreenInfo->bitsPerPixel * width); - pRendition->board.shadowPtr = xalloc(pRendition->board.shadowPitch * height); - displayWidth = pRendition->board.shadowPitch / - (pScreenInfo->bitsPerPixel >> 3); - FBBase = pRendition->board.shadowPtr; + pRendition->board.shadowPitch + = BitmapBytePad(pScreenInfo->bitsPerPixel * width); + pRendition->board.shadowPtr + = xalloc(pRendition->board.shadowPitch * height); + displayWidth = pRendition->board.shadowPitch + / (pScreenInfo->bitsPerPixel >> 3); + FBBase = pRendition->board.shadowPtr; } else { - pRendition->board.shadowPtr = NULL; - FBBase = pRendition->board.vmem_base+prenditionPriv->board.fbOffset; - displayWidth=pScreenInfo->displayWidth; + pRendition->board.shadowPtr = NULL; + FBBase = pRendition->board.vmem_base+pRendition->board.fbOffset; + displayWidth=pScreenInfo->displayWidth; } Inited = fbScreenInit(pScreen, FBBase, @@ -1175,53 +1160,14 @@ /* Fixup RGB ordering */ visual=pScreen->visuals+pScreen->numVisuals; while (--visual >= pScreen->visuals) { - if ((visual->class | DynamicClass) == DirectColor){ - visual->offsetRed = pScreenInfo->offset.red; - visual->offsetGreen = pScreenInfo->offset.green; - visual->offsetBlue = pScreenInfo->offset.blue; - visual->redMask = pScreenInfo->mask.red; - visual->greenMask = pScreenInfo->mask.green; - visual->blueMask = pScreenInfo->mask.blue; - } - -#if 0 /* This code is never called ? <DI> */ - else { - switch (pScreenInfo->bitsPerPixel) - { - case 16: - if (pScreenInfo->weight.green == 5){ - /* weight 555 mode */ - ErrorF("RENDITION: 15bit mode\n"); - visual->offsetRed=10; - visual->offsetGreen=5; - visual->offsetBlue=0; - visual->redMask=0x7c00; - visual->greenMask=0x3e0; - visual->blueMask=0x1f; - } - else{ - ErrorF("RENDITION: 16bit mode\n"); - visual->offsetRed=11; - visual->offsetGreen=5; - visual->offsetBlue=0; - visual->redMask=0xf800; - visual->greenMask=0x7e0; - visual->blueMask=0x1f; - } - break; - - case 32: - ErrorF("RENDITION: 32bit mode\n"); - visual->offsetRed=16; - visual->offsetGreen=8; - visual->offsetBlue=0; - visual->redMask=0xff0000; - visual->greenMask=0xff00; - visual->blueMask=0xff; - break; - } - } -#endif /* Never used fixup code */ + if ((visual->class | DynamicClass) == DirectColor){ + visual->offsetRed = pScreenInfo->offset.red; + visual->offsetGreen = pScreenInfo->offset.green; + visual->offsetBlue = pScreenInfo->offset.blue; + visual->redMask = pScreenInfo->mask.red; + visual->greenMask = pScreenInfo->mask.green; + visual->blueMask = pScreenInfo->mask.blue; + } } } @@ -1236,8 +1182,8 @@ /* has to be after fbScreenInit and before cursor init */ /*********************************************************/ #if USE_ACCEL - if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0)) - RENDITIONAccelXAAInit (pScreen); + if (pRendition->board.accel) + RENDITIONAccelXAAInit (pScreen); #endif /* Initialise cursor functions */ @@ -1246,55 +1192,56 @@ if(!xf86ReturnOptValBool(pRendition->Options, OPTION_SW_CURSOR,0)&& !pRendition->board.rotate){ - /* Initialise HW cursor */ - if(!RenditionHWCursorInit(scrnIndex, pScreen)){ - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Hardware Cursor initalization failed!!\n"); - } + /* Initialise HW cursor */ + if(!RenditionHWCursorInit(scrnIndex, pScreen)){ + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Hardware Cursor initalization failed!!\n"); + } } if (pRendition->board.shadowfb) { - RefreshAreaFuncPtr refreshArea = renditionRefreshArea; + RefreshAreaFuncPtr refreshArea = renditionRefreshArea; - if(pRendition->board.rotate) { - if (!pRendition->board.PointerMoved) { - pRendition->board.PointerMoved = pScreenInfo->PointerMoved; - pScreenInfo->PointerMoved = renditionPointerMoved; - } + if(pRendition->board.rotate) { + if (!pRendition->board.PointerMoved) { + pRendition->board.PointerMoved = pScreenInfo->PointerMoved; + pScreenInfo->PointerMoved = renditionPointerMoved; + } - switch(pScreenInfo->bitsPerPixel) { - case 8: refreshArea = renditionRefreshArea8; break; - case 16: refreshArea = renditionRefreshArea16; break; - case 24: refreshArea = renditionRefreshArea24; break; - case 32: refreshArea = renditionRefreshArea32; break; + switch(pScreenInfo->bitsPerPixel) { + case 8: refreshArea = renditionRefreshArea8; break; + case 16: refreshArea = renditionRefreshArea16; break; + case 24: refreshArea = renditionRefreshArea24; break; + case 32: refreshArea = renditionRefreshArea32; break; + } } - } - ShadowFBInit(pScreen, refreshArea); + ShadowFBInit(pScreen, refreshArea); } /* Setup default colourmap */ if (!miCreateDefColormap(pScreen)) - return FALSE; + return FALSE; /* Try the new code based on the new colormap layer */ if (pScreenInfo->depth > 1) - if (!xf86HandleColormaps(pScreen, 256, pScreenInfo->rgbBits, - renditionLoadPalette, NULL, - CMAP_LOAD_EVEN_IF_OFFSCREEN| - CMAP_RELOAD_ON_MODE_SWITCH)) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "Colormap initialization failed\n"); - return FALSE; - } + if (!xf86HandleColormaps(pScreen, 256, pScreenInfo->rgbBits, + renditionLoadPalette, NULL, + CMAP_LOAD_EVEN_IF_OFFSCREEN| + CMAP_RELOAD_ON_MODE_SWITCH)) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Colormap initialization failed\n"); + return FALSE; + } xf86DPMSInit(pScreen, renditionDPMSSet, 0); if (xf86ReturnOptValBool(pRendition->Options, OPTION_OVERCLOCK_MEM,0)) { - RENDITIONPTR(pScreenInfo)->board.overclock_mem=TRUE; + pRendition->board.overclock_mem=TRUE; } /* Wrap the screen's CloseScreen vector and set its SaveScreen vector */ - prenditionPriv->CloseScreen = pScreen->CloseScreen; + pRendition->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = renditionCloseScreen; pScreen->SaveScreen = renditionSaveScreen; @@ -1302,7 +1249,7 @@ renditionCloseScreen(scrnIndex, pScreen); if (serverGeneration == 1) - xf86ShowUnusedOptions(pScreenInfo->scrnIndex, pScreenInfo->options); + xf86ShowUnusedOptions(pScreenInfo->scrnIndex, pScreenInfo->options); #ifdef DEBUG ErrorF("ScreenInit OK...!!!!\n"); @@ -1324,10 +1271,9 @@ static void renditionAdjustFrame(int scrnIndex, int x, int y, int flags) { - ScrnInfoPtr pScreenInfo=xf86Screens[scrnIndex]; - renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - - int offset, virtualwidth, bitsPerPixel; + ScrnInfoPtr pScreenInfo=xf86Screens[scrnIndex]; + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + int offset, virtualwidth, bitsPerPixel; #ifdef DEBUG ErrorF("RENDITION: renditionAdjustFrame() called\n"); @@ -1349,10 +1295,27 @@ static Bool renditionEnterVT(int scrnIndex, int flags) { + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); + #ifdef DEBUG ErrorF("RENDITION: renditionEnterVT() called\n"); #endif - return renditionEnterGraphics(NULL, xf86Screens[scrnIndex]); + + /* Map VGA aperture */ + if (!vgaHWMapMem(pScreenInfo)) + return FALSE; + + /* Unlock VGA registers */ + vgaHWUnlock(pvgaHW); + + if (!renditionSetMode(pScreenInfo, pScreenInfo->currentMode)) + return FALSE; + + (*pScreenInfo->AdjustFrame)(pScreenInfo->scrnIndex, + pScreenInfo->frameX0, pScreenInfo->frameY0, 0); + + return TRUE; } @@ -1374,7 +1337,8 @@ static ModeStatus -renditionValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags) +renditionValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, + int flags) { if (pMode->Flags & V_INTERLACE) return MODE_NO_INTERLACE; @@ -1385,46 +1349,45 @@ static Bool renditionMapMem(ScrnInfoPtr pScreenInfo) { - Bool WriteCombine; - int mapOption; - renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + Bool WriteCombine; + int mapOption; + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); #ifdef DEBUG - ErrorF("Mapping ...\n"); - ErrorF("%d %d %d %x %d\n", pScreenInfo->scrnIndex, VIDMEM_FRAMEBUFFER, - pRendition->pcitag, - pRendition->board.mem_base, pScreenInfo->videoRam); + ErrorF("Mapping ...\n"); + ErrorF("%d %d %d %x %d\n", pScreenInfo->scrnIndex, VIDMEM_FRAMEBUFFER, + pRendition->pcitag, + pRendition->board.mem_base, pScreenInfo->videoRam * 1024); #endif - if (pRendition->board.chip==V1000_DEVICE){ - /* Some V1000 boards are known to have problems with Write-Combining */ - /* V2x00 also found to have similar problems with memcpy & WC ! */ - WriteCombine = 0; - } - else{ - /* Activate Write_Combine if possible */ - WriteCombine = 1; - } - /* Override on users request */ - WriteCombine=xf86ReturnOptValBool(pRendition->Options, OPTION_FBWC, WriteCombine); - if (WriteCombine){ - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - ("Requesting Write-Combined memory access\n")); - mapOption = VIDMEM_FRAMEBUFFER; - } - else { - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - ("Requesting MMIO-style memory access\n")); - mapOption = VIDMEM_MMIO; - } + if (pRendition->board.chip == V1000_DEVICE){ + /* Some V1000 boards are known to have problems with Write-Combining */ + /* V2x00 also found to have similar problems with memcpy & WC ! */ + WriteCombine = 0; + } else { + /* Activate Write_Combine if possible */ + WriteCombine = 1; + } + /* Override on users request */ + WriteCombine + = xf86ReturnOptValBool(pRendition->Options, OPTION_FBWC, WriteCombine); + if (WriteCombine) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + ("Requesting Write-Combined memory access\n")); + mapOption = VIDMEM_FRAMEBUFFER; + } else { + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + ("Requesting MMIO-style memory access\n")); + mapOption = VIDMEM_MMIO; + } pRendition->board.vmem_base= xf86MapPciMem(pScreenInfo->scrnIndex, mapOption, - pRendition->pcitag, - (unsigned long)pRendition->board.mem_base, - pScreenInfo->videoRam); + pRendition->pcitag, + (unsigned long)pRendition->board.mem_base, + pScreenInfo->videoRam * 1024); return TRUE; - + #ifdef DEBUG0 ErrorF("Done\n"); #endif @@ -1437,7 +1400,8 @@ ErrorF("Unmapping ...\n"); #endif xf86UnMapVidMem(pScreenInfo->scrnIndex, - RENDITIONPTR(pScreenInfo)->board.mem_base, pScreenInfo->videoRam); + RENDITIONPTR(pScreenInfo)->board.vmem_base, + pScreenInfo->videoRam * 1024); return TRUE; #ifdef DEBUG0 ErrorF("Done\n"); @@ -1452,12 +1416,28 @@ verite_setpalette(pScreenInfo, numColors, indices, colors, pVisual); } +xf86MonPtr +renditionProbeDDC(ScrnInfoPtr pScreenInfo, int index) +{ + vbeInfoPtr pVbe; + xf86MonPtr mon = NULL; + + if (xf86LoadSubModule(pScreenInfo, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + + pVbe = VBEInit(NULL,index); + mon = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } + return mon; +} +# if 0 static xf86MonPtr renditionDDC (ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base; + IOADDRESS iob=pRendition->board.io_base; vu32 temp; xf86MonPtr MonInfo = NULL; @@ -1490,7 +1470,7 @@ renditionDDC1Read (ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base; + IOADDRESS iob=pRendition->board.io_base; vu32 value = 0; /* wait for Vsync */ @@ -1514,3 +1494,4 @@ vbeFree(pVbe); } } +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c:1.6 Fri Mar 31 15:13:25 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c Fri Jan 25 16:56:07 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c,v 1.6 2000/03/31 20:13:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/v1krisc.c,v 1.7 2002/01/25 21:56:07 tsi Exp $ */ /* * */ @@ -80,18 +80,20 @@ * local function prototypes */ -static void verite_iopoll(vu16 port, vu32 data, vu32 mask); -static void verite_iopoll8(vu16 port, vu8 data, vu8 mask); +static void verite_iopoll(IOADDRESS port, vu32 data, vu32 mask); +static void verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask); -static vu32 readRF(vu16 io_base, vu8 index); -static void writeRF(vu16 io_base, vu8 index, vu32 data); +static vu32 readRF(IOADDRESS io_base, vu8 index); +static void writeRF(IOADDRESS io_base, vu8 index, vu32 data); -static vu32 risc_readmem(vu16 io_base, vu32 addr, vu8 read_type); -static void risc_writemem(vu16 io_base, vu32 addr, vu32 data, vu8 write_type); +static vu32 risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type); +static void risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type); -static void risc_step(vu16 io_base, vu32 count); -static void risc_forcestep(vu16 io_base, vu32 instruction); -static void risc_continue(vu16 io_base); +#if 0 +static void risc_step(IOADDRESS io_base, vu32 count); +#endif +static void risc_forcestep(IOADDRESS io_base, vu32 instruction); +static void risc_continue(IOADDRESS io_base); @@ -108,7 +110,7 @@ v1k_start(ScrnInfoPtr pScreenInfo, vu32 pc) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 io_base=pRendition->board.io_base; + IOADDRESS io_base=pRendition->board.io_base; v1k_stop(pScreenInfo); risc_forcestep(io_base, NOP_INSTR); @@ -147,7 +149,7 @@ { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); vu8 debugreg, statusreg; - vu16 io_base=pRendition->board.io_base; + IOADDRESS io_base=pRendition->board.io_base; vu16 STATUS = 0x4A; /* v2x00 io register offset */ int c; @@ -156,8 +158,8 @@ if (pRendition->board.chip == V2000_DEVICE){ c=0; do { -/* if(!(c%10000))ErrorF("#S1# !0x%x! -- ",verite_in8((vu16)(io_base+STATUS))); */ - statusreg = verite_in8((vu16)(io_base+STATUS)); +/* if(!(c%10000))ErrorF("#S1# !0x%x! -- ",verite_in8(io_base+STATUS)); */ + statusreg = verite_in8(io_base+STATUS); if ((statusreg & 0x8C) == 0x8C) break; } while (c++<0xfffff); @@ -170,8 +172,8 @@ if (pRendition->board.chip == V2000_DEVICE){ c=0; do { -/* if(!(c%10000))ErrorF("#S2# !0x%x! -- ",verite_in8((vu16)(io_base+STATUS))); */ - statusreg = verite_in8((vu16)(io_base+STATUS)); +/* if(!(c%10000))ErrorF("#S2# !0x%x! -- ",verite_in8(io_base+STATUS)); */ + statusreg = verite_in8(io_base+STATUS); if (statusreg & HOLDRISC) break; } while (c++<0xfffff); if (c >= 0xfffff) @@ -202,7 +204,7 @@ { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); vu32 c, p1, p2; - vu16 io_base=pRendition->board.io_base; + IOADDRESS io_base=pRendition->board.io_base; /* first flush store accumulation buffers so data is all in memory */ p1=risc_readmem(io_base, 0, READ_WORD); @@ -250,7 +252,7 @@ v1k_softreset(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 io_base=pRendition->board.io_base; + IOADDRESS io_base=pRendition->board.io_base; verite_out8(io_base+DEBUGREG, SOFTRESET|HOLDRISC); verite_out8(io_base+STATEINDEX, STATEINDEX_PC); @@ -295,19 +297,19 @@ */ /* - * static void verite_iopoll(vu16 port, vu32 data, vu32 mask) + * static void verite_iopoll(IOADDRESS port, vu32 data, vu32 mask) * * Loop on IO read until expected data is read or VERITE_MAX_POLLS is reached. */ static void -verite_iopoll(vu16 port, vu32 data, vu32 mask) +verite_iopoll(IOADDRESS port, vu32 data, vu32 mask) { - vu32 c, d; + vu32 c; c=0; do { c++; - if (((d=verite_in32(port))&mask) == (data&mask)) + if ((verite_in32(port)&mask) == (data&mask)) break; } while (c <= VERITE_MAX_POLLS); } @@ -315,20 +317,19 @@ /* - * static void verite_iopoll8(vu16 port, vu8 data, vu8 mask) + * static void verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask) * * Loop on IO read until expected data is read or VERITE_MAX_POLLS is reached. */ static void -verite_iopoll8(vu16 port, vu8 data, vu8 mask) +verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask) { vu32 c; - vu8 d; c=0; do { c++; - if (((d=verite_in8(port))&mask) == (data&mask)) + if ((verite_in8(port)&mask) == (data&mask)) break; } while (c <= VERITE_MAX_POLLS); } @@ -336,12 +337,12 @@ /* - * static vu32 readRF(vu16 io_base, vu8 index) + * static vu32 readRF(IOADDRESS io_base, vu8 index) * * Reads data from register file. */ static vu32 -readRF(vu16 io_base, vu8 index) +readRF(IOADDRESS io_base, vu8 index) { vu32 data, instr; vu8 debug, stateindex; @@ -374,12 +375,12 @@ /* - * static void writeRF(vu16 io_base, vu8 index, vu32 data) + * static void writeRF(IOADDRESS io_base, vu8 index, vu32 data) * * Set RF register, being careful on how to set regs below 64. */ static void -writeRF(vu16 io_base, vu8 index, vu32 data) +writeRF(IOADDRESS io_base, vu8 index, vu32 data) { vu8 special=0; @@ -413,12 +414,12 @@ /* - * static vu32 risc_readmem(vu16 io_base, vu32 addr, vu8 read_type) + * static vu32 risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type) * * NOTE: Assumes RISC is in hold mode. */ static vu32 -risc_readmem(vu16 io_base, vu32 addr, vu8 read_type) +risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type) { vu32 data; @@ -441,12 +442,12 @@ /* - * static vu32 risc_writemem(vu16 io_base, vu32 addr, vu32 data, vu8 write_type) + * static vu32 risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type) * * NOTE: Assumes RISC is in hold mode. */ static void -risc_writemem(vu16 io_base, vu32 addr, vu32 data, vu8 write_type) +risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type) { writeRF(io_base, RISC_RA, addr); /* point to memory */ writeRF(io_base, RISC_FP, data); /* set data */ @@ -460,13 +461,14 @@ } +#if 0 /* - * static void risc_step(vu16 io_base, vu32 count) + * static void risc_step(IOADDRESS io_base, vu32 count) * * Single step the RISC. NOTE: Do not force instruction into RISCIR! */ static void -risc_step(vu16 io_base, vu32 count) +risc_step(IOADDRESS io_base, vu32 count) { vu32 c, d; vu8 debugreg; @@ -485,16 +487,16 @@ return; /* stall occurred, we're done */ } } - +#endif /* - * static void risc_forcestep(vu16 io_base, vu32 instruction) + * static void risc_forcestep(IOADDRESS io_base, vu32 instruction) * * Single step RISC; force instruction; assumes RISC held. */ static void -risc_forcestep(vu16 io_base, vu32 instruction) +risc_forcestep(IOADDRESS io_base, vu32 instruction) { vu32 c; vu8 debugreg, stateindex; @@ -520,12 +522,12 @@ /* - * static void risc_continue(vu16 io_base) + * static void risc_continue(IOADDRESS io_base) * * Turn off hold bit. */ static void -risc_continue(vu16 io_base) +risc_continue(IOADDRESS io_base) { vu8 debugreg; Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.13 Sat Jun 30 18:41:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c Wed Dec 11 12:23:33 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c,v 1.13 2001/06/30 22:41:48 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c,v 1.16 2002/12/11 17:23:33 dawes Exp $ */ /* * includes */ @@ -20,7 +20,7 @@ #include "cscode.h" /* Global imported during compile-time */ -char MICROCODE_DIR [PATH_MAX] = MODULEDIR; +static char MICROCODE_DIR [PATH_MAX] = MODULEDIR; /* * local function prototypes @@ -33,97 +33,100 @@ int verite_initboard(ScrnInfoPtr pScreenInfo) { - renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - - vu16 iob=pRendition->board.io_base; - vu8 *vmb; - vu32 offset; - vu8 memendian; - int c,pc; + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - /* write "monitor" program to memory */ - v1k_stop(pScreenInfo); - pRendition->board.csucode_base=0x800; - memendian=verite_in8(iob+MEMENDIAN); - verite_out8(iob+MEMENDIAN, MEMENDIAN_NO); + IOADDRESS iob=pRendition->board.io_base; + vu8 *vmb; + vu32 offset; + vu8 memendian; + int c,pc; - /* Note that CS ucode must wait on address in csucode_base - * when initialized for later context switch code to work. */ + /* write "monitor" program to memory */ + v1k_stop(pScreenInfo); + pRendition->board.csucode_base=0x800; + memendian=verite_in8(iob+MEMENDIAN); + verite_out8(iob+MEMENDIAN, MEMENDIAN_NO); + + /* Note that CS ucode must wait on address in csucode_base + * when initialized for later context switch code to work. */ + + ErrorF("Loading csucode @ 0x%x + 0x800\n", pRendition->board.vmem_base); + vmb=pRendition->board.vmem_base; + offset=pRendition->board.csucode_base; + for (c=0; c<sizeof(csrisc)/sizeof(vu32); c++, offset+=sizeof(vu32)) + verite_write_memory32(vmb, offset, csrisc[c]); + + /* Initialize the CS flip semaphore */ + verite_write_memory32(vmb, 0x7f8, 0); + verite_write_memory32(vmb, 0x7fc, 0); + + /* Run the code we just transfered to the boards memory */ + /* ... and start accelerator */ + v1k_flushicache(pScreenInfo); - ErrorF("Loading csucode @ 0x%x + 0x800\n", pRendition->board.vmem_base); - vmb=pRendition->board.vmem_base; - offset=pRendition->board.csucode_base; - for (c=0; c<sizeof(csrisc)/sizeof(vu32); c++, offset+=sizeof(vu32)) - verite_write_memory32(vmb, offset, csrisc[c]); + verite_out8(iob + STATEINDEX, STATEINDEX_PC); + pc = verite_in32(iob + STATEDATA); + v1k_start(pScreenInfo, pRendition->board.csucode_base); - /* Initialize the CS flip semaphore */ - verite_write_memory32(vmb, 0x7f8, 0); - verite_write_memory32(vmb, 0x7fc, 0); + /* Get on loading the ucode */ + verite_out8(iob + STATEINDEX, STATEINDEX_PC); - /* Run the code we just transfered to the boards memory */ - /* ... and start accelerator */ - v1k_flushicache(pScreenInfo); + for (c = 0; c < 0xffffffL; c++){ + v1k_stop(pScreenInfo); + pc = verite_in32(iob + STATEDATA); + v1k_continue(pScreenInfo); + if (pc == pRendition->board.csucode_base) + break; + } + if (pc != pRendition->board.csucode_base){ + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + ("VERITE_INITBOARD -- PC != CSUCODEBASE\n")); + ErrorF ("RENDITION: PC == 0x%x -- CSU == 0x%x\n", + pc,pRendition->board.csucode_base); + } - verite_out8(iob + STATEINDEX, STATEINDEX_PC); - pc = verite_in32(iob + STATEDATA); - v1k_start(pScreenInfo, pRendition->board.csucode_base); + /* reset memory endian */ + verite_out8(iob+MEMENDIAN, memendian); - /* Get on loading the ucode */ - verite_out8(iob + STATEINDEX, STATEINDEX_PC); + if (V1000_DEVICE == pRendition->board.chip){ + c=verite_load_ucfile(pScreenInfo, strcat ((char *)MICROCODE_DIR,"v10002d.uc")); + } + else { + /* V2x00 chip */ + c=verite_load_ucfile(pScreenInfo, strcat ((char *)MICROCODE_DIR,"v20002d.uc")); + } - for (c = 0; c < 0xffffffL; c++){ - v1k_stop(pScreenInfo); - pc = verite_in32(iob + STATEDATA); - v1k_continue(pScreenInfo); - if (pc == pRendition->board.csucode_base) - break; - } - if (pc != pRendition->board.csucode_base){ - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - ("VERITE_INITBOARD -- PC != CSUCODEBASE\n")); - ErrorF ("RENDITION: PC == 0x%x -- CSU == 0x%x\n", - pc,pRendition->board.csucode_base); - } - - /* reset memory endian */ - verite_out8(iob+MEMENDIAN, memendian); - - if (V1000_DEVICE == pRendition->board.chip){ - c=verite_load_ucfile(pScreenInfo, strcat ((char *)MICROCODE_DIR,"v10002d.uc")); - } - else { - /* V2x00 chip */ - c=verite_load_ucfile(pScreenInfo, strcat ((char *)MICROCODE_DIR,"v20002d.uc")); - } - - if (c == -1) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - ("Microcode loading failed !!!\n")); - return 1; - } + if (c == -1) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + ("Microcode loading failed !!!\n")); + return 1; + } - pRendition->board.ucode_entry=c; + pRendition->board.ucode_entry=c; #ifdef DEBUG - ErrorF("UCode_Entry == 0x%x\n",pRendition->board.ucode_entry); */ + ErrorF("UCode_Entry == 0x%x\n",pRendition->board.ucode_entry); */ #endif - /* Everything's OK */ - return 0; + /* Everything's OK */ + return 0; } int verite_resetboard(ScrnInfoPtr pScreenInfo) { - /* renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - */ - v1k_softreset(pScreenInfo); - return 0; -} + vu16 iob=pRendition->board.io_base; + vu8 memendian=verite_in8(iob+MEMENDIAN); + vu32 crtcctl = verite_in32(iob+CRTCCTL); + + v1k_softreset(pScreenInfo); + verite_out8(iob+MEMENDIAN, memendian); + verite_out32(iob+CRTCCTL, crtcctl); - + return 0; +} int verite_getmemorysize(ScrnInfoPtr pScreenInfo) @@ -186,7 +189,7 @@ pRendition->board.mem_size=offset; /* restore default byte swapping */ - verite_out8(pRendition->board.io_base+MEMENDIAN, MEMENDIAN_NO); + verite_out8(pRendition->board.io_base+MEMENDIAN, memendian); #ifdef XSERVER verite_out8(pRendition->board.io_base+MODEREG, modereg); @@ -201,7 +204,7 @@ verite_check_csucode(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base; + IOADDRESS iob=pRendition->board.io_base; vu8 *vmb; vu32 offset; int c; @@ -239,13 +242,6 @@ verite_out8(iob+MEMENDIAN, memend); } - - -/* - * local functions - */ - - /* * end of file vboard.c Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.10 Fri May 4 15:05:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c Wed Dec 11 12:23:33 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c,v 1.10 2001/05/04 19:05:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c,v 1.13 2002/12/11 17:23:33 dawes Exp $ */ /* * file vmodes.c * @@ -16,7 +16,6 @@ #include "v1krisc.h" #include "v1kregs.h" #include "v2kregs.h" -#include "vvga.h" #undef DEBUG @@ -116,7 +115,7 @@ * global data */ -struct width_to_stride_t { +static struct width_to_stride_t { vu32 width8bpp; vu8 stride0; vu8 stride1; @@ -183,13 +182,23 @@ { 0, 0, 0, 0 } }; - +struct V1000ClocksStr { + int h_size; + int pll_val; +} V1000Clocks [] = { + { 72, 0x40000 }, /* For Textmode */ + { 640, 0x2408 }, /* 31500 MHz */ + { 800, 0x1583D }, /* 40000 MHz */ + { 1024, 0x14823 }, /* 65000 MHz */ + { 1280, 0x14414 }, /* 108000 MHz */ + { 0, 0 } +}; /* * local function prototypes */ -void set_PLL(vu16 iob, vu32 value); +static void set_PLL(IOADDRESS iob, vu32 value); static double V1000CalcClock(double target, int *M, int *N, int *P); static double V2200CalcClock(double target, int *m, int *n, int *p); @@ -200,71 +209,6 @@ */ int -verite_setmodefixed(ScrnInfoPtr pScreenInfo) -{ - renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - - int iob=pRendition->board.io_base; - int tmp; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_setmodefixed called\n"); -#endif - -#ifdef SAVEVGA - verite_savetextmode(pRendition->board); -#endif - - v1k_softreset(pScreenInfo); - - /* switching to native mode */ - verite_out8(iob+MODEREG, NATIVE_MODE); - - /* flipping some bytes */ - verite_out8(iob+MEMENDIAN, MEMENDIAN_HW); - - /* try programming 1024x768@70 in highcolor */ - tmp=verite_in32(iob+DRAMCTL)&0xdfff; /* reset bit 13 */ - verite_out32(iob+DRAMCTL, tmp|DEFAULT_WREFRESH); - - /* program pixel clock */ - if (pRendition->board.chip == V1000_DEVICE) { - set_PLL(iob, combineNMP(21, 55, 0)); - } - else { - tmp = (~0x1800) & verite_in32(iob+DRAMCTL); - verite_out32(iob+DRAMCTL, tmp); - verite_out32(iob+PCLKPLL, v2kcombineNMP(2, 21, 2)); - } - usleep(500); - - verite_initdac(pScreenInfo, 16, 0); - - verite_out32(iob+CRTCHORZ, HORZ(24, 136, 144, 1024)); - verite_out32(iob+CRTCVERT, VERT(3, 6, 29, 768)); - - pRendition->board.mode.screenwidth=1024; - pRendition->board.mode.virtualwidth=1024; - pRendition->board.mode.bitsperpixel=16; - pRendition->board.mode.fifosize=128; - - pRendition->board.init=1; - (*pScreenInfo->AdjustFrame)(pScreenInfo->scrnIndex, - pScreenInfo->frameX0, pScreenInfo->frameY0, 0); - - verite_out32(iob+CRTCCTL, CTL(0, 0, 0) - |V_PIXFMT_565 - |CRTCCTL_VIDEOFIFOSIZE128 - |CRTCCTL_HSYNCENABLE - |CRTCCTL_VSYNCENABLE - |CRTCCTL_VIDEOENABLE); - - return 0; -} - - - -int verite_setmode(ScrnInfoPtr pScreenInfo, struct verite_modeinfo_t *mode) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); @@ -333,9 +277,9 @@ /* init the ramdac */ verite_initdac(pScreenInfo, mode->bitsperpixel, doubleclock); - verite_out32(iob+CRTCHORZ, HORZ(mode->hsyncstart-mode->hdisplay, - mode->hsyncend-mode->hsyncstart, - mode->htotal-mode->hsyncend, + verite_out32(iob+CRTCHORZ, HORZ(mode->hsyncstart - mode->hdisplay, + mode->hsyncend - mode->hsyncstart, + mode->htotal - mode->hsyncend, mode->hdisplay)); verite_out32(iob+CRTCVERT, VERT(mode->vsyncstart-mode->vdisplay, mode->vsyncend-mode->vsyncstart, @@ -374,7 +318,91 @@ return 0; } +static double +verite_findtextclock(int width) +{ + int i = 0, val; + while ((val = V1000Clocks[i].h_size) > 0) { + if (val > width) + break; + else + i++; + } + if (i > 0) i--; + return V1000Clocks[i].pll_val; +} + +void +verite_save(ScrnInfoPtr pScreenInfo) +{ + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + int iob=pRendition->board.io_base; + RenditionRegPtr reg = &pRendition->saveRegs; + + reg->memendian = verite_in8(iob+MEMENDIAN); + reg->mode = verite_in8(iob+MODEREG); + reg->sclkpll = verite_in32(iob+SCLKPLL); + reg->dramctl = verite_in32(iob+DRAMCTL); + reg->crtch = verite_in32(iob+CRTCHORZ); + reg->crtcv = verite_in32(iob+CRTCVERT); + /* clock */ + if (V1000_DEVICE ==pRendition->board.chip) { + int width; + /* + * I have no idea how to read back the clock from + * V1000. Therefore we pick a VESA Mode clock from + * a list for the width found. + */ + width = ((reg->crtch & 0xff) + 1) << 3; + reg->pclkpll = verite_findtextclock(width); + reg->plldev= verite_in8(iob+PLLDEV); + } else { + reg->pclkpll = verite_in32(iob+PCLKPLL); + } + /* initdac */ + verite_out8(iob+MODEREG,NATIVE_MODE); + verite_savedac(pScreenInfo); + verite_out8(iob+MODEREG,reg->mode); + + reg->vbasea = verite_in32(iob+FRAMEBASEA); + reg->crtcoff = verite_in32(iob+CRTCOFFSET); + reg->crtcctl = verite_in32(iob+CRTCCTL); +} + +void +verite_restore(ScrnInfoPtr pScreenInfo, RenditionRegPtr reg) +{ + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + int iob=pRendition->board.io_base; + verite_restoredac (pScreenInfo, reg); + verite_out32(iob+MODEREG,reg->mode); + verite_out8(iob+MEMENDIAN,reg->memendian); + verite_out32(iob+DRAMCTL,reg->dramctl); + verite_out32(iob+SCLKPLL,reg->sclkpll); + if (pRendition->board.chip == V1000_DEVICE) { + /* fixme */ + set_PLL(iob, reg->pclkpll); + xf86UDelay(10000); + } else { + verite_out32(iob+PCLKPLL,reg->pclkpll); + /* + * Need to wait 200uS for PLL to stabilize -- + * let's play it safe with 500 + */ + xf86UDelay(10000); + /* wait until VBLANK */ + while ((verite_in32(iob+CRTCSTATUS)&CRTCSTATUS_VERT_MASK) != + CRTCSTATUS_VERT_ACTIVE); + while ((verite_in32(iob+CRTCSTATUS)&CRTCSTATUS_VERT_MASK) == + CRTCSTATUS_VERT_ACTIVE); + } + verite_out32(iob+CRTCHORZ,reg->crtch); + verite_out32(iob+CRTCVERT,reg->crtcv); + verite_out32(iob+FRAMEBASEA, reg->vbasea); + verite_out32(iob+CRTCOFFSET,reg->crtcoff); + verite_out32(iob+CRTCCTL,reg->crtcctl); +} void verite_setframebase(ScrnInfoPtr pScreenInfo, vu32 framebase) @@ -385,10 +413,9 @@ int iob=pRendition->board.io_base; int swidth=pRendition->board.mode.screenwidth; - int vwidth=pRendition->board.mode.virtualwidth; + int vwidth= pRendition->board.mode.virtualwidth; int bytespp=pRendition->board.mode.bitsperpixel>>3; int fifo_size=pRendition->board.mode.fifosize; - return; #ifdef DEBUG ErrorF( "Rendition: Debug verite_setframebase w=%d v=%d b=%d f=%d\n", @@ -422,55 +449,53 @@ /* crtc offset */ verite_out32(iob+CRTCOFFSET, offset&0xffff); - } - - int -verite_getstride(ScrnInfoPtr pScreenInfo, int *width, vu16 *stride0, vu16 *stride1) +verite_getstride(ScrnInfoPtr pScreenInfo, int *width, + vu16 *stride0, vu16 *stride1) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); int bytesperline; - int c=0; + int c = 0; - bytesperline=pRendition->board.mode.virtualwidth*(pRendition->board.mode.bitsperpixel>>3); + bytesperline + = pRendition->board.mode.virtualwidth + * (pRendition->board.mode.bitsperpixel >> 3); #ifdef DEBUG - ErrorF("RENDITION: %d bytes per line\n", bytesperline); + ErrorF("RENDITION: %d bytes per line\n", bytesperline); #endif /* for now, I implemented a linear search only, should be fixed <ml> */ while (0 != width_to_stride_table[c].width8bpp) { - if (width_to_stride_table[c].width8bpp==bytesperline && - ((width_to_stride_table[c].chip == pRendition->board.chip) || - (V2000_DEVICE == pRendition->board.chip))) { - *stride0=width_to_stride_table[c].stride0; - *stride1=width_to_stride_table[c].stride1; + if (width_to_stride_table[c].width8bpp == bytesperline + && ((width_to_stride_table[c].chip == pRendition->board.chip) + || (V2000_DEVICE == pRendition->board.chip))) { + *stride0 = width_to_stride_table[c].stride0; + *stride1 = width_to_stride_table[c].stride1; return 1; } c++; } - return 0; } - - /* * local functions */ /* - * void set_PLL(vu16 iob, vu32 value) + * void set_PLL(IOADDRESS iob, vu32 value) * * Set PLL clock to desired frequency for the V1000. */ + void -set_PLL(vu16 iob, vu32 value) +set_PLL(IOADDRESS iob, vu32 value) { vu32 ulD; int b; - + /* shift out the 20 serial bits */ for (b=19; b>=0; b--) { ulD=(value>>b)&1; @@ -545,6 +570,9 @@ vco = V2_REF_FREQ*mm/nn; if ((vco < V2_MIN_VCO_FREQ) || (vco > V2_MAX_VCO_FREQ)) continue; + pcf = V2_REF_FREQ*mm/nn; + if ((vco < V2_MIN_VCO_FREQ) || (vco > V2_MAX_VCO_FREQ)) + continue; pcf = V2_REF_FREQ/nn; if ((pcf < V2_MIN_PCF_FREQ) || (pcf > V2_MAX_PCF_FREQ)) continue; @@ -569,8 +597,8 @@ return freq; } - /* * end of file vmodes.c */ + Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h:1.4 Fri Mar 31 15:13:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h Thu Apr 4 09:05:45 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h,v 1.4 2000/03/31 20:13:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.h,v 1.5 2002/04/04 14:05:45 eich Exp $ */ /* * file vmodes.h * @@ -22,7 +22,11 @@ * function prototypes */ +#if 0 int verite_setmodefixed(ScrnInfoPtr pScreenInfo); +#endif +void verite_save(ScrnInfoPtr pScreenInfo); +void verite_restore(ScrnInfoPtr pScreenInfo, RenditionRegPtr reg); int verite_setmode(ScrnInfoPtr pScreenInfo, struct verite_modeinfo_t *mode); void verite_setframebase(ScrnInfoPtr pScreenInfo, vu32 framebase); int verite_getstride(ScrnInfoPtr pScreenInfo, int *width, vu16 *stride0, vu16 *stride1); Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h:1.8 Fri Mar 31 15:13:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h Fri Jan 25 16:56:07 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h,v 1.8 2000/03/31 20:13:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vos.h,v 1.9 2002/01/25 21:56:07 tsi Exp $ */ /* * file vos.h * @@ -24,18 +24,18 @@ /* * function prototypes */ -#define /*void*/ verite_out8(/*vu16*/ port, /*vu8*/ data) \ +#define /*void*/ verite_out8(/*IOADDRESS*/ port, /*vu8*/ data) \ outb(port, data) -#define /*void*/ verite_out16(/*vu16*/ port, /*vu16*/ data) \ +#define /*void*/ verite_out16(/*IOADDRESS*/ port, /*vu16*/ data) \ outw(port, data) -#define /*void*/ verite_out32(/*vu16*/ port, /*vu32*/ data) \ +#define /*void*/ verite_out32(/*IOADDRESS*/ port, /*vu32*/ data) \ outl(port, data) -#define /*vu8*/ verite_in8(/*vu16*/ io_base) ((vu8)inb(io_base)) -#define /*vu16*/ verite_in16(/*vu16*/ io_base) ((vu16)inw(io_base)) -#define /*vu32*/ verite_in32(/*vu16*/ io_base) ((vu32)inl(io_base)) +#define /*vu8*/ verite_in8(/*IOADDRESS*/ io_base) ((vu8)inb(io_base)) +#define /*vu16*/ verite_in16(/*IOADDRESS*/ io_base) ((vu16)inw(io_base)) +#define /*vu32*/ verite_in32(/*IOADDRESS*/ io_base) ((vu32)inl(io_base)) /* memory accesses */ #define verite_read_memory32(base, offset) MMIO_IN32(base, offset) Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.13 Wed May 16 02:48:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c Wed Dec 11 12:23:33 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.13 2001/05/16 06:48:10 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.18 2002/12/11 17:23:33 dawes Exp $ */ /* * includes */ @@ -90,18 +90,18 @@ * local function prototypes */ -static void Bt485_write_masked(vu16 port, vu8 reg, vu8 mask, vu8 data); -static void Bt485_write_cmd3_masked(vu16 port, vu8 mask, vu8 data); -static vu8 Bt485_read_masked(vu16 port, vu8 reg, vu8 mask); -static vu8 Bt485_read_cmd3_masked(vu16 port, vu8 mask); - - +static void Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data); +static void Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data); +#if 0 +static vu8 Bt485_read_masked(IOADDRESS port, vu8 reg, vu8 mask); +static vu8 Bt485_read_cmd3_masked(IOADDRESS port, vu8 mask); +#endif /* - * global data + * local data */ -int Cursor_size=0; +static int Cursor_size=0; @@ -117,11 +117,46 @@ * the corresponding field in the verite_board_t struct is set), the clock doubling * is turned on. */ + +void +verite_savedac (ScrnInfoPtr pScreenInfo) +{ + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + int iob=pRendition->board.io_base + RAMDACBASEADDR; + RenditionRegPtr reg = &pRendition->saveRegs; + + reg->daccmd0 = verite_in8(iob+BT485_COMMAND_REG_0); + reg->daccmd1 = verite_in8(iob+BT485_COMMAND_REG_1); + reg->daccmd2 = verite_in8(iob+BT485_COMMAND_REG_2); + verite_out8(iob+BT485_COMMAND_REG_0,reg->daccmd0 + | BT485_CR0_EXTENDED_REG_ACCESS); + verite_out8(iob+BT485_WRITE_ADDR, BT485_COMMAND_REG_3); + reg->daccmd3 = verite_in8(iob+BT485_STATUS_REG); + verite_out8(iob+BT485_COMMAND_REG_0,reg->daccmd0); +} + + +void +verite_restoredac (ScrnInfoPtr pScreenInfo, RenditionRegPtr reg) +{ + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); + int iob=pRendition->board.io_base + RAMDACBASEADDR; + + verite_out8(iob+BT485_COMMAND_REG_0, reg->daccmd0 + | BT485_CR0_EXTENDED_REG_ACCESS); + verite_out8(iob+BT485_COMMAND_REG_1, reg->daccmd1); + verite_out8(iob+BT485_COMMAND_REG_2, reg->daccmd2); + verite_out8(iob+BT485_WRITE_ADDR, BT485_COMMAND_REG_3); + verite_out8(iob+BT485_STATUS_REG, reg->daccmd3); + verite_out8(iob+BT485_COMMAND_REG_0, reg->daccmd0); + +} + int verite_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base+RAMDACBASEADDR; + IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR; vu8 cmd0,cmd1,cmd2; vu8 cmd3_data=0; @@ -232,20 +267,15 @@ BT485_3_COLOR_CURSOR, BT485_X_WINDOW_CURSOR }; static vu8 csizes[]={ BT485_32_BY_32_CURSOR, BT485_64_BY_64_CURSOR }; - vu16 iob=pRendition->board.io_base+RAMDACBASEADDR; + IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR; #ifdef DEBUG ErrorF ("Rendition: Debug verite_enablecursor called type=0x%x\n",type); -#endif - -#if 0 - /* ensure proper ranges */ - size=1; /* Enforce 64x64 Cursor */ #endif - + /* type goes to command register 2 */ Bt485_write_masked(iob, BT485_COMMAND_REG_2, ~BT485_CURSOR_MASK, - ctypes[type]); + ctypes[type]); /* size is in command register 3 */ Bt485_write_cmd3_masked(iob, ~BT485_SIZE_MASK, csizes[size]); @@ -259,9 +289,6 @@ } - - - /* * void verite_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo) * @@ -273,7 +300,7 @@ verite_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base+RAMDACBASEADDR; + IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR; x+=Cursor_size-xo; y+=Cursor_size-yo; @@ -296,7 +323,7 @@ verite_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 fg, vu32 bg) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base+RAMDACBASEADDR; + IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR; #ifdef DEBUG ErrorF ("Rendition: Debug verite_setcursorcolor called FG=0x%x BG=0x%x\n", @@ -311,19 +338,23 @@ verite_out8(iob+BT485_CURS_DATA, 0x00); /* load the cursor color 1 */ - verite_out8(iob+BT485_CURS_DATA, (fg>>16)&0xff); - verite_out8(iob+BT485_CURS_DATA, (fg>>8)&0xff); - verite_out8(iob+BT485_CURS_DATA, fg&0xff); - + verite_out8(iob+BT485_CURS_DATA, (fg>>16) & 0xff); + verite_out8(iob+BT485_CURS_DATA, (fg>>8) & 0xff); + verite_out8(iob+BT485_CURS_DATA, fg&0xff ); + + /* + * The V2xxx and the V1xxx with external BT485 behave differently. + * If we set color 2 to fg both work correctly. + */ /* load the cursor color 2 */ - verite_out8(iob+BT485_CURS_DATA, 0x00); - verite_out8(iob+BT485_CURS_DATA, 0x00); - verite_out8(iob+BT485_CURS_DATA, 0x00); + verite_out8(iob+BT485_CURS_DATA, (fg>>16) & 0xff); + verite_out8(iob+BT485_CURS_DATA, (fg>>8) & 0xff); + verite_out8(iob+BT485_CURS_DATA, fg & 0xff); /* load the cursor color 3 */ - verite_out8(iob+BT485_CURS_DATA, (bg>>16)&0xff); - verite_out8(iob+BT485_CURS_DATA, (bg>>8)&0xff); - verite_out8(iob+BT485_CURS_DATA, bg&0xff); + verite_out8(iob+BT485_CURS_DATA, (bg>>16)&0xff ); + verite_out8(iob+BT485_CURS_DATA, (bg>>8)&0xff ); + verite_out8(iob+BT485_CURS_DATA, bg&0xff ); } @@ -339,7 +370,7 @@ int c, bytes, row; vu8 *src = cursorimage; renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base+RAMDACBASEADDR; + IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR; vu8 tmp; vu8 memend; /* Added for byte-swap fix */ @@ -419,14 +450,14 @@ LOCO *colors, VisualPtr pVisual) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - vu16 iob=pRendition->board.io_base; + IOADDRESS iob=pRendition->board.io_base; vu32 crtc_status; int i, index; #ifdef DEBUG ErrorF ("Rendition: Debug verite_setpalette called\n"); #endif - return; + while (1) { crtc_status=verite_in32(iob+CRTCSTATUS); if (crtc_status & CRTCSTATUS_VERT_SYNC) @@ -443,25 +474,19 @@ verite_out8(iob+BT485_RAMDAC_DATA, colors[index].green); verite_out8(iob+BT485_RAMDAC_DATA, colors[index].blue); } - - - } - - - /* * local functions */ /* - * static void Bt485_write_masked(vu16 port, vu8 reg, vu8 mask, vu8 data) + * static void Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data) * * */ static void -Bt485_write_masked(vu16 port, vu8 reg, vu8 mask, vu8 data) +Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data) { vu8 tmp; @@ -472,45 +497,45 @@ /* - * static void Bt485_write_cmd3_masked(vu16 port, vu8 mask, vu8 data) + * static void Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data) * * */ static void -Bt485_write_cmd3_masked(vu16 port, vu8 mask, vu8 data) +Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data) { /* - Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x80); -*/ + * Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x80); + */ verite_out8(port+BT485_WRITE_ADDR, BT485_COMMAND_REG_3); Bt485_write_masked(port, BT485_STATUS_REG, mask, data); /* - Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x00); -*/ + * Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x00); + */ } +#if 0 /* - * static vu8 Bt485_read_masked(vu16 port, vu8 reg, vu8 mask) + * static vu8 Bt485_read_masked(IOADDRESS port, vu8 reg, vu8 mask) * * */ static vu8 -Bt485_read_masked(vu16 port, vu8 reg, vu8 mask) +Bt485_read_masked(IOADDRESS port, vu8 reg, vu8 mask) { return verite_in8(port+reg)&mask; } - /* - * static vu8 Bt485_read_cmd3_masked(vu16 port, vu8 mask) + * static vu8 Bt485_read_cmd3_masked(IOADDRESS port, vu8 mask) * * */ static vu8 -Bt485_read_cmd3_masked(vu16 port, vu8 mask) +Bt485_read_cmd3_masked(IOADDRESS port, vu8 mask) { vu8 value; @@ -521,7 +546,7 @@ return value; } - +#endif /* Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h:1.5 Fri Mar 31 15:13:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h Thu Apr 4 09:05:45 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h,v 1.5 2000/03/31 20:13:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.h,v 1.6 2002/04/04 14:05:45 eich Exp $ */ /* * file vramdac.h * @@ -36,6 +36,8 @@ * function prototypes */ +void verite_savedac (ScrnInfoPtr pScreenInfo); +void verite_restoredac (ScrnInfoPtr pScreenInfo, RenditionRegPtr reg); int verite_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock); void verite_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size); void verite_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo); Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.8 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h Thu Apr 4 09:05:45 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h,v 1.8 2001/10/28 03:33:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h,v 1.10 2002/04/04 14:05:45 eich Exp $ */ #ifndef _VTYPES_H_ #define _VTYPES_H_ @@ -97,15 +97,31 @@ vu16 stride1; }; +typedef struct _renditionRegs { + CARD8 mode; + CARD8 memendian; + CARD32 sclkpll; + CARD32 dramctl; + CARD8 plldev; + CARD32 pclkpll; + CARD8 daccmd0; + CARD8 daccmd1; + CARD8 daccmd2; + CARD8 daccmd3; + CARD32 crtch; + CARD32 crtcv; + CARD32 vbasea; + CARD32 crtcoff; + CARD32 crtcctl; +} RenditionRegRec, *RenditionRegPtr; - /* structure describing the Verite board and its functionality */ struct verite_board_t { /* type of chip */ vu16 chip; /* */ - vu16 io_base; + IOADDRESS io_base, vgaio_base; vu32 mmio_base; vu32 vmmio_base; vu32 mem_size; @@ -168,6 +184,7 @@ xf86CursorInfoPtr CursorInfoRec; /* Cursor data */ XAAInfoRecPtr AccelInfoRec; /* Needed for XAA */ OptionInfoPtr Options; + RenditionRegRec saveRegs; } renditionRec, *renditionPtr; #define RENDITIONPTR(p) ((renditionPtr)((p)->driverPrivate)) Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.11 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c Thu Feb 27 12:31:31 2003 @@ -1,352 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c,v 1.11 2001/10/28 03:33:44 tsi Exp $ */ -/* - * file vvga.c - * - * Functions that handle the generic vga part of the Verite chips. - */ - -/* - * includes - */ -#include "rendition.h" -#define VVGA_INTERNAL -#include "vvga.h" -#include "vtypes.h" -#include "vos.h" -#include "vmisc.h" -#include "v1kregs.h" -#include "v2kregs.h" - -#undef DEBUG - -void set_PLL(vu16, vu32); - -/* - * global data - */ - -#ifdef STDVGAFONT -#include "vgafont-std.data" -#else -#include "vgafont-vrx.data" -#endif -#include "vgapalette.data" - -/* - * local function prototypes - */ - -static vu8 getvgareg(vu16 port, vu8 index); -static void setvgareg(vu16 port, vu8 index, vu8 value); -static void updattr(vu8 index, vu8 value); - - - -/* - * functions - */ - -#if 0 -#if defined(SAVEVGA) || defined(XSERVER) -static void -verite_resetvga(void) -{ - static struct VIDEO_REGS { - vu8 seq[8]; /* sequencer regs */ - vu8 crtc[26]; /* crtc regs */ - vu8 grph[9]; /* graphics regs */ - vu8 attr[21]; /* attribute regs */ - } mode3={ - /* seq */ - {0x03,0x00,0x03,0x00,0x02,0xfa,0x01,0xfa}, - - /* crtc */ - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x01,0xe0, - 0x9c,0xae,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff,0x19}, - - /* grph */ - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,0xff}, - - /* attr */ - {0x00,0x01,0x02,0x03,0x04,0x05,0x14, - 0x07,0x38,0x39,0x3a,0x3b,0x3c,0x3d, - 0x3e,0x3f,0x0c,0x00,0x0f,0x08,0x00}, - }; - int c; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_resetvga called\n"); -#endif - - /* set attribute controller */ - for (c=0; c<0x15; c++) - updattr(c, mode3.attr[c]); - - /* set CRTC registers */ - for (c=0; c<0x19; c++) - setvgareg(0x3d4, c, mode3.crtc[c]); - - /* set graphics registers */ - for (c=0x00; c<0x09; c++) - setvgareg(0x3ce, c, mode3.grph[c]); - - /* set sequencer registers */ - setvgareg(0x3c4, 0x00, 0x03); /* restart sequencer */ - for (c=0; c<5; c++) - setvgareg(0x3c4, c, mode3.seq[c]); -} - -static void -verite_loadvgafont(void) -{ - int c; - vu8 b; - vu8 *address; - vu8 *vidmem; - vu8 *vbase; - int fbFlags; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_loadvgafont called\n"); -#endif - - /* Assert synchroneous reset while setting the clock mode */ - setvgareg(0x3c4, 0, 1); /* assert synchronous reset */ - verite_out8(0x3c2, 0x67); /* select clock */ - setvgareg(0x3c4, 0, 3); /* de-assert synchronous reset */ - - /* load 8x16 font into plane 2 */ - b=(getvgareg(0x3c4, 0x04)|0x04)&0x07; /* memory mode reg - */ - setvgareg(0x3c4, 0x04, b); /* disable odd/even and chain 4 */ - - /* disable video and enable all to cpu to enable maximum video - * memory access */ - b=getvgareg(0x3c4, 0x01)|0x20; /* clocking mode register - */ - setvgareg(0x3c4, 0x01, b); /* enable all to cpu, disable video */ - - b=getvgareg(0x3ce, 0x05)&0xef; /* graphics controller - */ - setvgareg(0x3ce, 0x05, b); /* disable odd/even */ - - setvgareg(0x3ce, 0x06, 0x05); /* memory map - set it to A000 - * and graphics mode */ - - setvgareg(0x3c4, 2, 4); /* enable write plane 2 */ - - /* fill plane 2 with 8x16 font */ - address=font8x16; - fbFlags = VIDMEM_MMIO; /* VIDMEM_SPARSE is implied on Alpha */ - - vbase = xf86MapVidMem(0, fbFlags, 0xa0000, 64*1024); - vidmem=vbase; - for (c=0; c<=255; c++) { - verite_memtobus_cpy(vbase+(32*c), address, 16); - address+=16; - } - - xf86UnMapVidMem(0, vbase, 64*1024); - /* restore the standard vga register values */ - verite_resetvga(); -} -#endif -#endif - -void -verite_textmode(struct verite_board_t *board) -{ - vu16 iob=board->io_base; - int tmp; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_textmode called\n"); -#endif - - /* dac */ - verite_out8(iob+DACCOMMAND0, 0x80); /* 6 bit op, enable extended */ - verite_out8(iob+DACCOMMAND1, 0x68); /* disable palette bypass */ - verite_out8(iob+DACCOMMAND2, 0x00); /* disable cursor & pixel packing */ - if (V1000_DEVICE == board->chip) { - verite_out8(iob+DACRAMWRITEADR, 0x01); /* select COMMAND3 register */ - verite_out8(iob+DACCOMMAND3, 0x00); /* no clock doubling */ - } - verite_out8(iob+DACCOMMAND0, 0x00); /* 6 bit op */ - - if (V1000_DEVICE == board->chip) { - verite_out32(iob+DRAMCTL, 0x140000); - set_PLL(iob, 0x40000); - usleep(500); - } - else { - /* memctl */ - tmp = 0x1800|verite_in32(iob+DRAMCTL); - verite_out32(iob+DRAMCTL, tmp); /* linear mode */ - - /* pixel clock */ - verite_out32(iob+PCLKPLL, 0x300000); - /* system and memory clock */ - verite_out32(iob+SCLKPLL, 0x2480C); /* mclk=86 sclk=43 */ - - /* Need to wait 200uS for PLL to stabilize -- - * let's play it safe with 500 */ - usleep(500); - - /* wait until VBLANK */ - while ((verite_in32(iob+CRTCSTATUS)&CRTCSTATUS_VERT_MASK) != - CRTCSTATUS_VERT_ACTIVE); - while ((verite_in32(iob+CRTCSTATUS)&CRTCSTATUS_VERT_MASK) == - CRTCSTATUS_VERT_ACTIVE); - } - - /* vga mode */ - verite_out8(iob+MODEREG, VGA_MODE); - - /* crtc */ - verite_out32(iob+CRTCCTL, 0x44cc2); - verite_out32(iob+CRTCHORZ, 0x2b0a4f); - verite_out32(iob+CRTCVERT, 0x9301df); - verite_out32(iob+CRTCOFFSET, 0x40); -#if 0 -#ifdef SAVEVGA - verite_loadvgafont(); - verite_restoretextmode(board); - verite_restorepalette(); -#else -#ifdef XSERVER - verite_loadvgafont(); - verite_restorepalette(); -#endif -#endif -#endif - -} - - - -void -verite_savetextmode(struct verite_board_t *board) -{ - vu8 *vbase; - int fbFlags; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_savetextmode called\n"); -#endif - - /* save the cursor position */ - board->cursor_hi=getvgareg(0x3d4, 0xe); - board->cursor_low=getvgareg(0x3d4, 0xf); - - /* save the screen offset */ - board->offset_hi=getvgareg(0x3d4, 0xc); - board->offset_low=getvgareg(0x3d4, 0xd); - - /* save the screen contents */ - board->scr_contents=(vu8 *)xalloc(0x8000); - fbFlags = VIDMEM_MMIO; /* VIDMEM_SPARSE is implied on Alpha */ - - vbase = xf86MapVidMem(0, fbFlags, 0xb8000, 0x8000); - verite_bustomem_cpy(board->scr_contents, vbase, 0x8000); - xf86UnMapVidMem(0, vbase, 0x8000); -} - - - -static void -verite_restoretextmode(struct verite_board_t *board) -{ - vu8 *vbase; - int fbFlags; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_restoretextmode called\n"); -#endif - - /* restore the cursor position */ - setvgareg(0x3d4, 0xe, board->cursor_hi); - setvgareg(0x3d4, 0xf, board->cursor_low); - - /* restore the screen offset */ - setvgareg(0x3d4, 0xc, board->offset_hi); - setvgareg(0x3d4, 0xd, board->offset_low); - - /* restore the screen contents */ - fbFlags = VIDMEM_MMIO; /* VIDMEM_SPARSE is implied on Alpha */ - - vbase = xf86MapVidMem(0, fbFlags, 0xb8000, 0x8000); - verite_memtobus_cpy(vbase, board->scr_contents, 0x8000); - xf86UnMapVidMem(0, vbase, 0x8000); - xfree(board->scr_contents); -} - - - -static void -verite_restorepalette(void) -{ - int c; - vu8 *pal=vga_pal; - -#ifdef DEBUG - ErrorF ("Rendition: Debug verite_restorepalette called\n"); -#endif - - verite_out8(0x3c8, 0); - for (c=0; c<768; c++) - verite_out8(0x3c9, *pal++); -} - - - -/* - * local functions - */ - -/* - * static vu8 getvgareg(vu16 port, vu8 index) - * - * Reads in a vga register. - */ -static vu8 -getvgareg(vu16 port, vu8 index) -{ - verite_out8(port, index); - return verite_in8(port+1); -} - - - -/* - * static void setvgareg(vu16 port, vu8 index, vu8 value) - * - * Sets a vga register. - */ -static void -setvgareg(vu16 port, vu8 index, vu8 value) -{ - verite_out8(port, index); - verite_out8(port+1, value); -} - - - -/* - * static void updattr(vu8 index, vu8 value) - * - * Used to write the attribute controller registers. - */ -static void -updattr(vu8 index, vu8 value) -{ - verite_in8(0x3da); /* points to index register for color adapter */ - verite_in8(0x3ba); /* points to index register for mono */ - verite_out8(0x3c0, index); - verite_out8(0x3c0, value); - verite_out8(0x3c0, index|0x20); -} - - - -/* - * end of file vvga.c - */ Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.6 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h Thu Feb 27 12:31:31 2003 @@ -1,43 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h,v 1.6 2001/10/28 03:33:44 tsi Exp $ */ -/* - * file vvga.h - * - * Headerfile for vvga.c - */ - -#ifndef __VVGA_H__ -#define __VVGA_H__ - - - -/* - * includes - */ - -#include "vtypes.h" - - - -/* - * function prototypes - */ - -void verite_textmode(struct verite_board_t *board); -void verite_savetextmode(struct verite_board_t *board); -#ifdef VVGA_INTERNAL -#if 0 -#if defined(SAVEVGA) || defined(XSERVER) -static void verite_resetvga(void); -static void verite_loadvgafont(void); -#endif -#endif -static void verite_restoretextmode(struct verite_board_t *board); -static void verite_restorepalette(void); -#endif - - -#endif /* __VVGA_H__ */ - -/* - * end of file vvga.h - */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.9 xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.9 Fri Jul 6 03:52:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile Mon Feb 17 12:06:43 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile,v 1.9 2001/07/06 07:52:01 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile,v 1.10 2003/02/17 17:06:43 dawes Exp $ */ #define IHaveModules #include <Server.tmpl> @@ -23,7 +23,7 @@ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(XF86SRC)/fbdevhw -I$(XF86SRC)/ddc \ - -I$(XF86SRC)/i2c -I$(XF86OSSRC)/vbe \ + -I$(XF86SRC)/i2c -I$(XF86SRC)/vbe \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ -I$(EXTINCSRC) -I$(SERVERSRC)/render #endif Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.14 xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.14 Fri Sep 28 03:45:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h Wed Dec 11 12:30:47 2002 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h,v 1.14 2001/09/28 07:45:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h,v 1.16 2002/12/11 17:30:47 dawes Exp $ */ #ifndef _S3_H @@ -96,8 +96,8 @@ pciVideoPtr PciInfo; PCITAG PciTag; EntityInfoPtr pEnt; - CARD32 IOAddress; - CARD32 FBAddress; + unsigned long IOAddress; + unsigned long FBAddress; unsigned char * FBBase; unsigned char * MMIOBase; unsigned long videoRam; @@ -196,7 +196,7 @@ void S3InitStreams(ScrnInfoPtr pScrn, DisplayModePtr mode); /* IBMRGB */ -extern RamDacSupportedInfoRec IBMRamdacs[]; +extern RamDacSupportedInfoRec S3IBMRamdacs[]; Bool S3ProbeIBMramdac(ScrnInfoPtr pScrn); void S3IBMRGB_PreInit(ScrnInfoPtr pScrn); void S3IBMRGB_Init(ScrnInfoPtr pScrn, DisplayModePtr mode); Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.3 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c Mon Feb 17 11:45:24 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c,v 1.3 2001/10/28 03:33:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c,v 1.5 2003/02/17 16:45:24 dawes Exp $ */ #include "xf86.h" @@ -48,7 +48,7 @@ #define IBMRGB_INDEX_CONTROL 0x3C7 /* CR55 low bit == 1 */ -void S3OutIBMRGBIndReg(ScrnInfoPtr pScrn, CARD32 reg, +static void S3OutIBMRGBIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, unsigned char data) { S3Ptr pS3 = S3PTR(pScrn); @@ -70,7 +70,7 @@ } -unsigned char S3InIBMRGBIndReg(ScrnInfoPtr pScrn, CARD32 reg) +static unsigned char S3InIBMRGBIndReg(ScrnInfoPtr pScrn, CARD32 reg) { S3Ptr pS3 = S3PTR(pScrn); unsigned char tmp, ret; @@ -90,22 +90,22 @@ } -void S3IBMWriteAddress(ScrnInfoPtr pScrn, CARD32 index) +static void S3IBMWriteAddress(ScrnInfoPtr pScrn, CARD32 index) { outb(IBMRGB_WRITE_ADDR, index); } -void S3IBMWriteData(ScrnInfoPtr pScrn, unsigned char data) +static void S3IBMWriteData(ScrnInfoPtr pScrn, unsigned char data) { outb(IBMRGB_INDEX_DATA, data); } -void S3IBMReadAddress(ScrnInfoPtr pScrn, CARD32 index) +static void S3IBMReadAddress(ScrnInfoPtr pScrn, CARD32 index) { outb(IBMRGB_READ_ADDR, index); } -unsigned char S3IBMReadData(ScrnInfoPtr pScrn) +static unsigned char S3IBMReadData(ScrnInfoPtr pScrn) { return inb(IBMRGB_RAMDAC_DATA); } @@ -133,14 +133,14 @@ return FALSE; } - pS3->RamDac = IBMramdacProbe(pScrn, IBMRamdacs); + pS3->RamDac = IBMramdacProbe(pScrn, S3IBMRamdacs); if (pS3->RamDac) return TRUE; return FALSE; } -void S3ProgramIBMRGBClock(ScrnInfoPtr pScrn, int clk, unsigned char m, +static void S3ProgramIBMRGBClock(ScrnInfoPtr pScrn, int clk, unsigned char m, unsigned char n, unsigned char df) { S3OutIBMRGBIndReg(pScrn, IBMRGB_misc_clock, ~1, 1); @@ -153,7 +153,7 @@ } -void S3IBMRGBSetClock(ScrnInfoPtr pScrn, long freq, int clk, long dacspeed, +static void S3IBMRGBSetClock(ScrnInfoPtr pScrn, long freq, int clk, long dacspeed, long fref) { volatile double ffreq, fdacspeed, ffref; Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.4 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c Mon Feb 17 11:45:24 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c,v 1.4 2001/10/28 03:33:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c,v 1.5 2003/02/17 16:45:24 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -93,7 +93,7 @@ } -unsigned char S3InTiIndReg(ScrnInfoPtr pScrn, CARD32 reg) +static unsigned char S3InTiIndReg(ScrnInfoPtr pScrn, CARD32 reg) { S3Ptr pS3 = S3PTR(pScrn); int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; @@ -418,7 +418,7 @@ } -void S3TiDACSetClock(ScrnInfoPtr pScrn, long freq, int clk) +static void S3TiDACSetClock(ScrnInfoPtr pScrn, long freq, int clk) { int m, n, p; Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.4 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c Mon Feb 17 11:45:24 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c,v 1.4 2001/10/28 03:33:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c,v 1.5 2003/02/17 16:45:24 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -216,7 +216,7 @@ } -void S3TrioSetPLL(ScrnInfoPtr pScrn, int clk, unsigned char m, +static void S3TrioSetPLL(ScrnInfoPtr pScrn, int clk, unsigned char m, unsigned char n) { unsigned char tmp; @@ -266,7 +266,7 @@ } -void S3TrioSetClock(ScrnInfoPtr pScrn, long freq, int clk, int min_m, +static void S3TrioSetClock(ScrnInfoPtr pScrn, long freq, int clk, int min_m, int min_n1, int max_n1, int min_n2, int max_n2, int pll_type, long freq_min, long freq_max) { Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c:1.2 Wed Jul 11 03:45:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c Fri Jan 25 16:56:08 2002 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c,v 1.2 2001/07/11 07:45:35 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c,v 1.3 2002/01/25 21:56:08 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,7 +34,8 @@ #include "s3.h" -static unsigned char *find_bios_string(int BIOSbase, char *match1, char *match2) +static unsigned char *find_bios_string(S3Ptr pS3, int BIOSbase, + char *match1, char *match2) { static unsigned char bios[BIOS_BSIZE]; static int init=0; @@ -42,7 +43,7 @@ if (!init) { init = 1; - if (xf86ReadBIOS(BIOSbase, 0, bios, BIOS_BSIZE) != BIOS_BSIZE) + if (xf86ReadDomainMemory(pS3->PciTag, BIOSbase, BIOS_BSIZE, bios) != BIOS_BSIZE) return NULL; if ((bios[0] != 0x55) || (bios[1] != 0xaa)) return NULL; @@ -73,9 +74,10 @@ int S3GetRefClock(ScrnInfoPtr pScrn) { + S3Ptr pS3 = S3PTR(pScrn); int RefClock = 16000; /* default */ - if (find_bios_string(BIOS_BASE, "Number Nine Visual Technology", + if (find_bios_string(pS3, BIOS_BASE, "Number Nine Visual Technology", "Motion 771") != NULL) RefClock = 16000; Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.7 Wed Dec 26 17:24:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c Fri Feb 14 13:06:58 2003 @@ -34,7 +34,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c,v 1.7 2001/12/26 22:24:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c,v 1.12 2003/02/14 18:06:58 dawes Exp $ */ #include "xf86.h" @@ -46,6 +46,7 @@ #include "xf86Resources.h" #include "xf86fbman.h" #include "xf86cmap.h" +#include "xf86RAC.h" #include "compiler.h" #include "xaa.h" #include "mipointer.h" @@ -163,7 +164,7 @@ { -1, NULL, OPTV_NONE, {0}, FALSE } }; -RamDacSupportedInfoRec IBMRamdacs[] = { +RamDacSupportedInfoRec S3IBMRamdacs[] = { { IBM524_RAMDAC }, { IBM524A_RAMDAC }, { -1 } @@ -173,8 +174,9 @@ #ifdef S3_USEFB static const char *fbSymbols[] = { - "fbScreenInit", - NULL + "fbPictureInit", + "fbScreenInit", + NULL }; #else static const char *cfbSymbols[] = { @@ -491,7 +493,7 @@ pS3->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); - xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); + /* don't disable PIO funcs */ xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); if (pEnt->device->chipset && *pEnt->device->chipset) { @@ -698,7 +700,7 @@ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, pScrn->bitsPerPixel, - 128, 2048, pScrn->virtualX, + 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, pScrn->videoRam * 1024, LOOKUP_BEST_REFRESH); @@ -777,7 +779,8 @@ #if 0 S3Regdump(pScrn); #endif - + pScrn->vtSema = TRUE; + S3SaveScreen(pScreen, SCREEN_SAVER_ON); miClearVisualTypes(); @@ -850,7 +853,9 @@ } } } - +#ifdef S3_USEFB + fbPictureInit (pScreen, 0, 0); +#endif S3DGAInit(pScreen); miInitializeBackingStore(pScreen); @@ -896,8 +901,9 @@ if (!miCreateDefColormap(pScreen)) return FALSE; - - if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, pS3->LoadPalette, NULL, + + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, + pS3->LoadPalette, NULL, CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; @@ -909,9 +915,14 @@ xf86DPMSInit(pScreen, S3DisplayPowerManagementSet, 0); + /* XXX Check if I/O and Mem flags need to be the same. */ + pScrn->racIoFlags = pScrn->racMemFlags = RAC_COLORMAP + | RAC_FB | RAC_VIEWPORT | RAC_CURSOR; + #if 0 S3InitVideo(pScreen); #endif + return TRUE; } @@ -1034,8 +1045,9 @@ Bool S3SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) -{ - return S3ModeInit(xf86Screens[scrnIndex], mode); +{ + return S3ModeInit(xf86Screens[scrnIndex], xf86Screens[scrnIndex]->currentMode); + } @@ -1044,7 +1056,7 @@ VisualPtr pVisual) { int i, index; - + for (i=0; i<numColors; i++) { index = indicies[i]; outb(0x3c8, index); @@ -1155,6 +1167,8 @@ if (!vgaHWInit(pScrn, mode)) return FALSE; + + pVga->MiscOutReg |= 0x0c; pVga->Sequencer[0] = 0x03; pVga->CRTC[19] = pS3->s3BppDisplayWidth >> 3; @@ -1170,6 +1184,7 @@ vgaHWProtect(pScrn, TRUE); + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { outb(vgaCRIndex, 0x5c); tmp = inb(vgaCRReg); @@ -1186,6 +1201,8 @@ outw(0x3c4, (pVga->Sequencer[r] << 8) | r); } + /* We need to set this first - S3 *is* broken */ + outw(vgaCRIndex, (pVga->CRTC[17] << 8) | 17); for(r=0; r<25; r++) outw(vgaCRIndex, (pVga->CRTC[r] << 8) | r); @@ -1588,10 +1605,9 @@ else new->cr58 = 0x17; - if (pS3->Chipset == PCI_CHIP_968) - new->cr58 = 0x52; - else if ((pS3->Chipset == PCI_CHIP_964_0) || - (pS3->Chipset == PCI_CHIP_964_1)) + if ((pS3->Chipset == PCI_CHIP_968) || + (pS3->Chipset == PCI_CHIP_964_0) || + (pS3->Chipset == PCI_CHIP_964_1)) new->cr58 |= 0x40; outb(vgaCRIndex, 0x59); @@ -1622,7 +1638,6 @@ vgaHWPtr hwp = VGAHWPTR(pScrn); vgaHWUnlock(hwp); - if (!S3ModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1639,7 +1654,6 @@ int i; vgaHWProtect(pScrn, TRUE); - WaitQueue(8); S3BankZero(pScrn); Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.20 xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.20 Tue Jan 23 19:06:26 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile Mon Feb 17 12:06:43 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile,v 1.20 2001/01/24 00:06:26 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile,v 1.21 2003/02/17 17:06:43 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. @@ -29,7 +29,7 @@ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ - -I$(EXTINCSRC) -I$(XF86OSSRC)/vbe -I$(XF86SRC)/shadowfb \ + -I$(EXTINCSRC) -I$(XF86SRC)/vbe -I$(XF86SRC)/shadowfb \ -I$(SERVERSRC)/render #endif Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.21 xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.21 Mon Jan 14 13:02:58 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES Wed Feb 12 22:21:33 2003 @@ -1,28 +1,26 @@ S3 ViRGE 4.0 devel notes -rev: -10 Jan 2002 KJB -Function Implemented --------- ----------- --required- -S3VProbe; X -S3VPreInit; X -S3VScreenInit; X -S3VSwitchMode; X -S3VAdjustFrame; X -S3VEnterVT; X -S3VLeaveVT; X -S3VFreeScreen; X -S3VValidMode; X - dummy --private- -S3VSave X -S3VRestore X - - Status ------ +1/26/2003 +Ver 1.8.6 +Pre-4.3.0 release. 320x240 doublescan support w/mouse adjust, +power management printouts, DAC error printout fix, log XVideo status based +on chipset, preliminary support for disabling XV when a mode doesn't +support it. + +5/18/2002 +Ver 1.8.5 +320x240 mode support (doublescan). + +2/2/02 +Ver 1.8.4 +Make 320x240 mode work in depth 15 & 16. +Testing, need to switch streams on/off based on dblscan_v flag and mode. +Virge MX panel_on test (doesn't work.) + 1/10/02 Ver 1.8.3 DGA fix, buffer pointer used wrong value. Submitted for 4.2.0 (late). @@ -277,13 +275,25 @@ TODO items ---------- -Put vgaHWUnlockmmio in S3VModeInit (see MGAModeInit for example)? - +1/30/03 General option "videoram" is ignored by the virge driver. + (Meelis Roos) +3/24/02 Xv reported to not work as secondary in Xinerama multihead. + (xav on irc) +3/24/02 DPMS doesn't fully disable the screen. Blue line across the + center in all modes. (xav on irc) +3/25/02 Secondary reports primary BIOS during int10 detection. ie: + +(II) S3VIRGE(1): VESA BIOS detected +(II) S3VIRGE(1): VESA VBE Version 2.0 +(II) S3VIRGE(1): VESA VBE Total Mem: 4194240 kB +(II) S3VIRGE(1): VESA VBE OEM: ATI RAGE128 +(II) S3VIRGE(1): VESA VBE OEM Software Rev: 1.0 +(II) S3VIRGE(1): VESA VBE OEM Vendor: ATI Technologies Inc. +(II) S3VIRGE(1): VESA VBE OEM Product: R128 +(II) S3VIRGE(1): VESA VBE OEM Product Rev: 01.00 -ViRGE MX code appears to be in 3.3.2 tree only, port to 4.0. I have -started to added the chipset info in the main driver code. (KJB) +(xav on irc) -modes notes: move mode Private S3V settings to mode init function? Check CR65 usage, bit 2 set based on S3_EARLY_SC? In my manual bit 2 is enable MMIO to RAMDAC registers. @@ -313,4 +323,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.21 2002/01/14 18:02:58 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.23 2003/02/13 03:21:33 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.8 Wed Jul 25 11:05:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h Fri Jan 25 16:56:08 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h,v 1.8 2001/07/25 15:05:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h,v 1.9 2002/01/25 21:56:08 tsi Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -62,60 +62,6 @@ #ifndef _REGS3V_H #define _REGS3V_H -#if 0 -/* for OUT instructions */ -#include "compiler.h" - -/* for new trio64V+ and 968 mmio */ -#include "newmmio.h" - - -/* S3 chipset definitions */ - - -#define UNLOCK_SYS_REGS do { \ - outb(vgaCRIndex, 0x39); \ - outb(vgaCRReg, 0xa5); } while (0) - - -#ifndef MetroLink -#define VerticalRetraceWait() do { \ - outb(vgaCRIndex, 0x17); \ - if ( inb(vgaCRReg) & 0x80 ) { \ - while ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - while ((inb(vgaIOBase + 0x0A) & 0x08) == 0x08) ; \ - while ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - }\ -} while (0) -#else -#define SPIN_LIMIT 1000000 -#define VerticalRetraceWait() do { \ - outb(vgaCRIndex, 0x17); \ - if ( inb(vgaCRReg) & 0x80 ) { \ - volatile unsigned long _spin_me; \ - for (_spin_me = 0; \ - ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me <= SPIN_LIMIT; \ - _spin_me++) ; \ - if (_spin_me > SPIN_LIMIT) \ - ErrorF("s3v: warning: VerticalRetraceWait timed out.\n"); \ - for (_spin_me = 0; \ - ((inb(vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me <= SPIN_LIMIT; \ - _spin_me++) ; \ - if (_spin_me > SPIN_LIMIT) \ - ErrorF("s3v: warning: VerticalRetraceWait timed out.\n"); \ - for (_spin_me = 0; \ - ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me <= SPIN_LIMIT; \ - _spin_me++) ; \ - if (_spin_me > SPIN_LIMIT) \ - ErrorF("s3v: warning: VerticalRetraceWait timed out.\n"); \ - } \ -} while (0) -#endif - -#endif /* 0 */ - - - #define S3_ViRGE_SERIES(chip) ((chip&0xfff0)==0x31e0) #define S3_ViRGE_GX2_SERIES(chip) (chip == S3_ViRGE_GX2 || chip == S3_TRIO_3D_2X) #define S3_ViRGE_MX_SERIES(chip) (chip == S3_ViRGE_MX || chip == S3_ViRGE_MXP) @@ -135,16 +81,6 @@ #define S3_ViRGE_MXP PCI_CHIP_VIRGE_MXP #define S3_TRIO_3D PCI_CHIP_Trio3D #define S3_TRIO_3D_2X PCI_CHIP_Trio3D_2X - -#if 0 - -/* VESA Approved Register Definitions */ -#define DAC_MASK 0x03c6 -#define DAC_R_INDEX 0x03c7 -#define DAC_W_INDEX 0x03c8 -#define DAC_DATA 0x03c9 - -#endif /* 0 */ /* Subsystem Control Register */ #define GPCTRL_NC 0x0000 Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.29 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.31 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.29 Wed Nov 21 17:43:00 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h Mon Feb 3 21:20:49 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.29 2001/11/21 22:43:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.31 2003/02/04 02:20:49 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -344,32 +344,32 @@ /* #ifndef MetroLink */ #if !defined (MetroLink) && !defined (VertDebug) #define VerticalRetraceWait() do { \ - outb(vgaCRIndex, 0x17); \ - if ( inb(vgaCRReg) & 0x80 ) { \ - while ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - while ((inb(vgaIOBase + 0x0A) & 0x08) == 0x08) ; \ - while ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ + VGAOUT8(vgaCRIndex, 0x17); \ + if ( VGAIN8(vgaCRReg) & 0x80 ) { \ + while ((VGAIN8(vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ + while ((VGAIN8(vgaIOBase + 0x0A) & 0x08) == 0x08) ; \ + while ((VGAIN8(vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ }\ } while (0) #else #define SPIN_LIMIT 1000000 #define VerticalRetraceWait() do { \ - outb(vgaCRIndex, 0x17); \ - if ( inb(vgaCRReg) & 0x80 ) { \ + VGAOUT8(vgaCRIndex, 0x17); \ + if ( VGAIN8(vgaCRReg) & 0x80 ) { \ volatile unsigned long _spin_me; \ for (_spin_me = 0; \ - ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me <= SPIN_LIMIT; \ + ((VGAIN8(vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me <= SPIN_LIMIT; \ _spin_me++) ; \ if (_spin_me > SPIN_LIMIT) \ ErrorF("s3v: warning: VerticalRetraceWait timed out(1:3).\n"); \ for (_spin_me = 0; \ - ((inb(vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me <= SPIN_LIMIT; \ + ((VGAIN8(vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me <= SPIN_LIMIT; \ _spin_me++) ; \ if (_spin_me > SPIN_LIMIT) \ ErrorF("s3v: warning: VerticalRetraceWait timed out(2:3).\n"); \ for (_spin_me = 0; \ - ((inb(vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me <= SPIN_LIMIT; \ + ((VGAIN8(vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me <= SPIN_LIMIT; \ _spin_me++) ; \ if (_spin_me > SPIN_LIMIT) \ ErrorF("s3v: warning: VerticalRetraceWait timed out(3:3).\n"); \ @@ -391,7 +391,8 @@ /* prototypes */ /* s3v_dac.c */ -extern void S3VCommonCalcClock(long freq, int min_m, int min_n1, int max_n1, +extern void S3VCommonCalcClock(ScrnInfoPtr pScrn, DisplayModePtr mode, + long freq, int min_m, int min_n1, int max_n1, int min_n2, int max_n2, long freq_min, long freq_max, unsigned char * mdiv, unsigned char * ndiv); @@ -424,7 +425,7 @@ /* s3v_xv.c X Video Extension support */ void S3VInitVideo(ScreenPtr pScreen); - +int S3VQueryXvCapable(ScrnInfoPtr); #endif /*_S3V_H*/ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c:1.3 Mon Mar 29 07:17:55 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c Mon Feb 3 21:20:50 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c,v 1.3 1999/03/29 12:17:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c,v 1.4 2003/02/04 02:20:50 dawes Exp $ */ /* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved. @@ -44,11 +44,13 @@ /* function */ void -S3VCommonCalcClock(long freq, int min_m, int min_n1, int max_n1, int min_n2, int max_n2, - long freq_min, long freq_max, - unsigned char * mdiv, unsigned char * ndiv) +S3VCommonCalcClock(ScrnInfoPtr pScrn, DisplayModePtr mode, + long freq, int min_m, int min_n1, + int max_n1, int min_n2, int max_n2, + long freq_min, long freq_max, + unsigned char * mdiv, unsigned char * ndiv) { - double ffreq, ffreq_min, ffreq_max; + double ffreq, ffreq_min, ffreq_max, ffreq_min_warn; double div, diff, best_diff; unsigned int m; unsigned char n1, n2; @@ -58,14 +60,24 @@ ffreq_min = freq_min / 1000.0 / BASE_FREQ; ffreq_max = freq_max / 1000.0 / BASE_FREQ; - if (ffreq < ffreq_min / (1<<max_n2)) { - ErrorF("invalid frequency %1.3f MHz [freq >= %1.3f MHz]\n", - ffreq*BASE_FREQ, ffreq_min*BASE_FREQ / (1<<max_n2)); - ffreq = ffreq_min / (1<<max_n2); + /* Doublescan modes can run at half the min frequency */ + /* But only use that value for warning and changing */ + /* ffreq, don't change the actual min used for clock calcs below. */ + if(mode->Flags & V_DBLSCAN && ffreq_min) + ffreq_min_warn = ffreq_min / 2; + else + ffreq_min_warn = ffreq_min; + + if (ffreq < ffreq_min_warn / (1<<max_n2)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "invalid frequency %1.3f MHz [freq <= %1.3f MHz]\n", + ffreq*BASE_FREQ, ffreq_min_warn*BASE_FREQ / (1<<max_n2)); + ffreq = ffreq_min_warn / (1<<max_n2); } if (ffreq > ffreq_max / (1<<min_n2)) { - ErrorF("invalid frequency %1.3f MHz [freq <= %1.3f MHz]\n", - ffreq*BASE_FREQ, ffreq_max*BASE_FREQ / (1<<min_n2)); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "invalid frequency %1.3f MHz [freq >= %1.3f MHz]\n", + ffreq*BASE_FREQ, ffreq_max*BASE_FREQ / (1<<min_n2)); ffreq = ffreq_max / (1<<min_n2); } Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.81 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.86 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.81 Mon Jan 14 13:02:58 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c Mon Feb 3 21:20:50 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.81 2002/01/14 18:02:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.86 2003/02/04 02:20:50 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -112,10 +112,10 @@ #define S3VIRGE_NAME "S3VIRGE" #define S3VIRGE_DRIVER_NAME "s3virge" -#define S3VIRGE_VERSION_NAME "1.8.3" +#define S3VIRGE_VERSION_NAME "1.8.6" #define S3VIRGE_VERSION_MAJOR 1 #define S3VIRGE_VERSION_MINOR 8 -#define S3VIRGE_PATCHLEVEL 3 +#define S3VIRGE_PATCHLEVEL 6 #define S3VIRGE_DRIVER_VERSION ((S3VIRGE_VERSION_MAJOR << 24) | \ (S3VIRGE_VERSION_MINOR << 16) | \ S3VIRGE_PATCHLEVEL) @@ -414,7 +414,7 @@ #endif /* XFree86LOADER */ -static unsigned char *find_bios_string(int BIOSbase, char *match1, char *match2) +static unsigned char *find_bios_string(PCITAG Tag, int BIOSbase, char *match1, char *match2) { #define BIOS_BSIZE 1024 #define BIOS_BASE 0xc0000 @@ -425,7 +425,7 @@ if (!init) { init = 1; - if (xf86ReadBIOS(BIOSbase, 0, bios, BIOS_BSIZE) != BIOS_BSIZE) + if (xf86ReadDomainMemory(Tag, BIOSbase, BIOS_BSIZE, bios) != BIOS_BSIZE) return NULL; if ((bios[0] != 0x55) || (bios[1] != 0xaa)) return NULL; @@ -889,18 +889,6 @@ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "mx_cr3a_fix.\n"); } - if (xf86IsOptionSet(ps3v->Options, OPTION_XVIDEO)) - { - if (xf86GetOptValBool(ps3v->Options, OPTION_XVIDEO ,&ps3v->XVideo)) - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "%s XVideo.\n", - ps3v->XVideo ? "Enabling (default)" : "Disabling"); - } - else - { - ps3v->XVideo = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "XVideo allowed (depends on chipset).\n"); - } - /* Find the PCI slot for this screen */ /* * XXX Ignoring the Type list for now. It might be needed when @@ -937,8 +925,8 @@ ps3v->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index,NULL,ResNone); - xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); - xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); /* * Set the Chipset and ChipRev, allowing config file entries to @@ -992,6 +980,29 @@ ps3v->PciTag = pciTag(ps3v->PciInfo->bus, ps3v->PciInfo->device, ps3v->PciInfo->func); + + /* Handle XVideo after we know chipset, so we can give an */ + /* intelligent comment about support */ + if (xf86IsOptionSet(ps3v->Options, OPTION_XVIDEO)) + { + if(S3VQueryXvCapable(pScrn)) + { + if (xf86GetOptValBool(ps3v->Options, OPTION_XVIDEO ,&ps3v->XVideo)) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "%s XVideo.\n", + ps3v->XVideo ? "Enabling (default)" : "Disabling"); + } + else + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "XVideo not supported.\n"); + } + else + { + ps3v->XVideo = S3VQueryXvCapable(pScrn); + if(ps3v->XVideo) + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "XVideo supported.\n"); + else + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "XVideo not supported.\n"); + } + S3VMapMem(pScrn); hwp = VGAHWPTR(pScrn); @@ -1004,11 +1015,11 @@ vgaCRIndex, vgaIOBase, hwp->MMIOBase ); - #if 0 /* Not needed in 4.0 flavors */ +#if 0 /* Not needed in 4.0 flavors */ /* Unlock sys regs */ VGAOUT8(vgaCRIndex, 0x38); VGAOUT8(vgaCRReg, 0x48); - #endif +#endif /* Next go on to detect amount of installed ram */ @@ -1158,7 +1169,7 @@ usleep(10000); /* wait a little bit... */ } - if (find_bios_string(BIOS_BASE, "S3 86C325", + if (find_bios_string(ps3v->PciTag, BIOS_BASE, "S3 86C325", "MELCO WGP-VG VIDEO BIOS") != NULL) { if (xf86GetVerbosity()) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MELCO BIOS found\n"); @@ -1268,12 +1279,12 @@ * Toshiba Tecra 5x0/7x0 seems to use 28.636 MHz * Compaq Armada 7x00 uses 14.318 MHz */ - if (find_bios_string(BIOS_BASE, "COMPAQ M5 BIOS", NULL) != NULL) { + if (find_bios_string(ps3v->PciTag, BIOS_BASE, "COMPAQ M5 BIOS", NULL) != NULL) { if (xf86GetVerbosity()) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "COMPAQ M5 BIOS found\n"); /* ps3v->refclk_fact = 1.0; */ } - else if (find_bios_string(BIOS_BASE, "TOSHIBA Video BIOS", NULL) != NULL) { + else if (find_bios_string(ps3v->PciTag, BIOS_BASE, "TOSHIBA Video BIOS", NULL) != NULL) { if (xf86GetVerbosity()) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "TOSHIBA Video BIOS found\n"); /* ps3v->refclk_fact = 2.0; */ @@ -1343,15 +1354,15 @@ #endif - #if 0 +#if 0 if (ps3v->Chipset == S3_ViRGE_VX ) { ps3v->minClock = 220000; } else { ps3v->minClock = 135000; } - #else - ps3v->minClock = 20000; /* cep */ - #endif +#else + ps3v->minClock = 10000; /* cep */ +#endif xf86ErrorFVerb(VERBLEV, " S3VPreInit minClock=%d, maxClock=%d\n", @@ -1395,7 +1406,7 @@ clockRanges->maxClock = ps3v->maxClock; clockRanges->clockIndex = -1; /* programmable */ clockRanges->interlaceAllowed = TRUE; /* yes, S3V SVGA 3.3.2 */ - clockRanges->doubleScanAllowed = FALSE; /* no, S3V SVGA 3.3.2 */ + clockRanges->doubleScanAllowed = TRUE; /* Screen pointer */ i = xf86ValidateModes(pScrn, @@ -3019,10 +3030,12 @@ if(ps3v->MCLK> 0) { if (S3_ViRGE_MX_SERIES(ps3v->Chipset)) - S3VCommonCalcClock((int)(ps3v->MCLK / ps3v->refclk_fact), 1, 1, 31, 0, 3, + S3VCommonCalcClock(pScrn, mode, + (int)(ps3v->MCLK / ps3v->refclk_fact), + 1, 1, 31, 0, 3, 135000, 270000, &new->SR11, &new->SR10); else - S3VCommonCalcClock(ps3v->MCLK, 1, 1, 31, 0, 3, + S3VCommonCalcClock(pScrn, mode, ps3v->MCLK, 1, 1, 31, 0, 3, 135000, 270000, &new->SR11, &new->SR10); } else { @@ -3055,7 +3068,7 @@ S3VInitSTREAMS(pScrn, new->STREAMS, mode); new->MMPR0 = 0xc098; /* Adjust FIFO slots */ } - S3VCommonCalcClock(dclk, 1, 1, 31, 0, 4, + S3VCommonCalcClock(pScrn, mode, dclk, 1, 1, 31, 0, 4, 220000, 440000, &new->SR13, &new->SR12); } /* end VX if() */ @@ -3120,17 +3133,21 @@ ps3v->LCDClk = ((int)(ps3v->refclk_fact * 1431818 * (sr13+2)) / (n1+2) / (1 << n2) + 50) / 100; } } - S3VCommonCalcClock((int)(ps3v->LCDClk / ps3v->refclk_fact), 1, 1, 31, 0, 4, + S3VCommonCalcClock(pScrn, mode, + (int)(ps3v->LCDClk / ps3v->refclk_fact), + 1, 1, 31, 0, 4, 170000, 340000, &new->SR13, &ndiv); } else - S3VCommonCalcClock((int)(dclk / ps3v->refclk_fact), 1, 1, 31, 0, 4, + S3VCommonCalcClock(pScrn, mode, + (int)(dclk / ps3v->refclk_fact), + 1, 1, 31, 0, 4, 170000, 340000, &new->SR13, &ndiv); VGAOUT8(0x3c4, 0x08); VGAOUT8(0x3c5, sr8); } else /* S3_ViRGE_GX2 */ - S3VCommonCalcClock(dclk, 1, 1, 31, 0, 4, + S3VCommonCalcClock(pScrn, mode, dclk, 1, 1, 31, 0, 4, 170000, 340000, &new->SR13, &ndiv); new->SR29 = ndiv >> 7; new->SR12 = (ndiv & 0x1f) | ((ndiv & 0x60) << 1); @@ -3178,7 +3195,7 @@ new->MMPR0 = 0x10000; /* Still more FIFO slots */ new->SR0F = 0x10; } - S3VCommonCalcClock(dclk, 1, 1, 31, 0, 4, + S3VCommonCalcClock(pScrn, mode, dclk, 1, 1, 31, 0, 4, 230000, 460000, &new->SR13, &new->SR12); } /* end TRIO_3D if() */ else if(ps3v->Chipset == S3_ViRGE_DXGX) { @@ -3193,11 +3210,18 @@ new->CR67 = 0x30; /* 15bpp */ } else if (pScrn->bitsPerPixel == 16) { - new->CR67 = 0x50 | 0x0c; - /* Flag STREAMS proc. required */ - /* XV support needs STREAMS in depth 16 */ - ps3v->NeedSTREAMS = TRUE; - S3VInitSTREAMS(pScrn, new->STREAMS, mode); + if(mode->Flags & V_DBLSCAN) + { + new->CR67 = 0x50; + } + else + { + new->CR67 = 0x50 | 0x0c; + /* Flag STREAMS proc. required */ + /* XV support needs STREAMS in depth 16 */ + ps3v->NeedSTREAMS = TRUE; + S3VInitSTREAMS(pScrn, new->STREAMS, mode); + } if( ps3v->XVideo ) { new->MMPR0 = 0x107c02; /* Adjust FIFO slots, overlay */ @@ -3228,7 +3252,7 @@ S3VInitSTREAMS(pScrn, new->STREAMS, mode); new->MMPR0 = 0x10000; /* Still more FIFO slots */ } - S3VCommonCalcClock(dclk, 1, 1, 31, 0, 3, + S3VCommonCalcClock(pScrn, mode, dclk, 1, 1, 31, 0, 3, 135000, 270000, &new->SR13, &new->SR12); } /* end DXGX if() */ else { /* Everything else ... (only ViRGE) */ @@ -3259,7 +3283,7 @@ S3VInitSTREAMS(pScrn, new->STREAMS, mode); new->MMPR0 = 0x10000; /* Still more FIFO slots */ } - S3VCommonCalcClock(dclk, 1, 1, 31, 0, 3, + S3VCommonCalcClock(pScrn, mode, dclk, 1, 1, 31, 0, 3, 135000, 270000, &new->SR13, &new->SR12); } /* end great big if()... */ @@ -3312,6 +3336,13 @@ if ((mode->CrtcHSyncEnd >> 3) - (mode->CrtcHSyncStart >> 3) > 32) i |= 0x20; /* add another 32 DCLKs to hsync pulse width */ + /* video playback chokes if sync start and display end are equal */ + if (mode->CrtcHSyncStart - mode->CrtcHDisplay < ps3v->HorizScaleFactor) { + int tmp = vganew->CRTC[4] + ((i&0x10)<<4) + ps3v->HorizScaleFactor; + vganew->CRTC[4] = tmp & 0xff; + i |= ((tmp >> 4) & 0x10); + } + j = ( vganew->CRTC[0] + ((i&0x01)<<8) + vganew->CRTC[4] + ((i&0x10)<<4) + 1) / 2; @@ -3335,7 +3366,11 @@ width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8))>> 3; vganew->CRTC[19] = 0xFF & width; new->CR51 = (0x300 & width) >> 4; /* Extension bits */ - + + /* Set doublescan */ + if( mode->Flags & V_DBLSCAN) + vganew->CRTC[9] |= 0x80; + /* And finally, select clock source 2 for programmable PLL */ vganew->MiscOutReg |= 0x0c; @@ -3392,14 +3427,14 @@ /* in 3.3.3 and never changed. */ /* Also, bit 0 is never set in 3.9Nm, */ /* so I left this out for 4.0. */ - #if 0 +#if 0 if (mode->Private[0] & (1 << S3_INVERT_VCLK)) { if (mode->Private[S3_INVERT_VCLK]) new->CR67 |= 1; else new->CR67 &= ~1; } - #endif +#endif /* S3_BLANK_DELAY settings based on */ /* defaults only. From 3.3.3 */ { @@ -3435,14 +3470,14 @@ /* in 3.3.3 and never changed. */ /* Also, bit 1 is never set in 3.9Nm, */ /* so I left this out for 4.0. */ - #if 0 +#if 0 if (mode->Private[0] & (1 << S3_EARLY_SC)) { if (mode->Private[S3_EARLY_SC]) new->CR65 |= 2; else new->CR65 &= ~2; } - #endif +#endif VGAOUT8(vgaCRIndex, 0x68); new->CR68 = VGAIN8(vgaCRReg); @@ -3709,7 +3744,7 @@ { vgaHWPtr hwp; S3VPtr ps3v; - int vgaCRIndex, vgaCRReg; + IOADDRESS vgaCRIndex, vgaCRReg; unsigned char val; PVERB5(" S3VEnableMmio\n"); @@ -3728,18 +3763,18 @@ * to be set correctly already and MMIO _has_ to be * enabled. */ - val = inb(0x3C3); /*@@@EE*/ - outb(0x3C3,val | 0x01); + val = inb(hwp->PIOOffset + 0x3C3); /*@@@EE*/ + outb(hwp->PIOOffset + 0x3C3, val | 0x01); /* * set CR registers to color mode * in mono mode extended CR registers * are not accessible. (EE 05/04/99) */ - val = inb(VGA_MISC_OUT_R); /*@@@EE*/ - outb(VGA_MISC_OUT_W,val | 0x01); + val = inb(hwp->PIOOffset + VGA_MISC_OUT_R); /*@@@EE*/ + outb(hwp->PIOOffset + VGA_MISC_OUT_W, val | 0x01); vgaHWGetIOBase(hwp); /* Get VGA I/O base */ - vgaCRIndex = hwp->IOBase + 4; - vgaCRReg = hwp->IOBase + 5; + vgaCRIndex = hwp->PIOOffset + hwp->IOBase + 4; + vgaCRReg = vgaCRIndex + 1; #if 1 /* * set linear base register to the PCI register values @@ -3756,14 +3791,13 @@ ps3v->EnableMmioCR53 = inb(vgaCRReg); /* Enable new MMIO, if TRIO mmio is already */ /* enabled, then it stays enabled. */ - outb(vgaCRReg, (ps3v->EnableMmioCR53 | 0x08) ); - outb(VGA_MISC_OUT_W,val); + outb(vgaCRReg, ps3v->EnableMmioCR53 | 0x08); + outb(hwp->PIOOffset + VGA_MISC_OUT_W, val); if (S3_TRIO_3D_SERIES(ps3v->Chipset)) { outb(vgaCRIndex, 0x40); val = inb(vgaCRReg); outb(vgaCRReg, val | 1); } - return; } @@ -3773,26 +3807,24 @@ { vgaHWPtr hwp; S3VPtr ps3v; - int vgaCRIndex, vgaCRReg; + IOADDRESS vgaCRIndex, vgaCRReg; PVERB5(" S3VDisableMmio\n"); hwp = VGAHWPTR(pScrn); - ps3v = S3VPTR(pScrn); - vgaCRIndex = hwp->IOBase + 4; - vgaCRReg = hwp->IOBase + 5; + vgaCRIndex = hwp->PIOOffset + hwp->IOBase + 4; + vgaCRReg = vgaCRIndex + 1; outb(vgaCRIndex, 0x53); /* Restore register's original state */ - outb(vgaCRReg,ps3v->EnableMmioCR53 ); + outb(vgaCRReg, ps3v->EnableMmioCR53); if (S3_TRIO_3D_SERIES(ps3v->Chipset)) { unsigned char val; outb(vgaCRIndex, 0x40); val = inb(vgaCRReg); outb(vgaCRReg, val | 1); } - return; } @@ -3887,6 +3919,7 @@ { S3VPtr ps3v; unsigned char sr8 = 0x0, srd = 0x0; + char modestr[][40] = { "On","Standby","Suspend","Off" }; ps3v = S3VPTR(pScrn); @@ -3927,6 +3960,9 @@ VGAOUT8(0x3c4, 0x0d); VGAOUT8(0x3c5, srd); + xf86ErrorFVerb(VERBLEV, "Power Manag: set:%s\n", + modestr[PowerManagementMode]); + return; } Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c:1.6 Tue Feb 8 12:19:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c Mon Feb 3 21:20:50 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c,v 1.6 2000/02/08 17:19:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c,v 1.7 2003/02/04 02:20:50 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -132,7 +132,10 @@ y = 0; } - /* This is the recomended order to move the cursor */ + /* Double y position for a doublescan mode */ + if(pScrn->currentMode->Flags & V_DBLSCAN) y <<= 1; + + /* This is the recommended order to move the cursor */ outCRReg( 0x46, (x & 0xff00)>>8 ); outCRReg( 0x47, (x & 0xff) ); Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.5 Wed Nov 21 17:43:00 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c Mon Feb 3 21:20:50 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.5 2001/11/21 22:43:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.7 2003/02/04 02:20:50 dawes Exp $ */ /* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. @@ -55,6 +55,7 @@ #ifndef XvExtension void S3VInitVideo(ScreenPtr pScreen) {} +int S3VQueryXvCapable(ScrnInfoPtr) {return FALSE;} #else #if 0 @@ -93,6 +94,25 @@ #endif /* 0 */ +int S3VQueryXvCapable(ScrnInfoPtr pScrn) +{ + S3VPtr ps3v = S3VPTR(pScrn); + + if( + ((pScrn->bitsPerPixel == 24) || + (pScrn->bitsPerPixel == 16) + ) + && + ((ps3v->Chipset == S3_ViRGE_DXGX) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) || + S3_ViRGE_GX2_SERIES(ps3v->Chipset) + )) + return TRUE; + else + return FALSE; +} + + void S3VInitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -115,7 +135,7 @@ && ps3v->XVideo ) { - #if 0 +#if 0 if((pMga->Overlay8Plus24 /* || dualhead */ || pMga->TexturedVideo) && (pScrn->bitsPerPixel != 24)) { @@ -123,12 +143,12 @@ newAdaptor = MGASetupImageVideoTexture(pScreen); pMga->TexturedVideo = TRUE; } else { - #endif +#endif xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using overlay video\n"); newAdaptor = S3VSetupImageVideoOverlay(pScreen); - #if 0 +#if 0 pMga->TexturedVideo = FALSE; }*/ @@ -136,7 +156,7 @@ S3VInitOffscreenImages(pScreen); pMga->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = MGABlockHandler; - #endif +#endif } @@ -762,6 +782,10 @@ vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + /* If streams aren't enabled, do nothing */ + if(!ps3v->NeedSTREAMS) + return; + #if 0 /* got 64 scanlines to do it in */ tmp = INREG(MGAREG_VCOUNT) + 64; @@ -961,6 +985,10 @@ CARD32 tmp; static int once = 1; static int once2 = 1; + + /* If streams aren't enabled, do nothing */ + if(!ps3v->NeedSTREAMS) + return Success; /* Clip */ x1 = src_x; Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.3 Wed Nov 21 17:43:00 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man Wed Feb 12 22:21:33 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man,v 1.3 2001/11/21 22:43:00 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man,v 1.4 2003/02/13 03:21:33 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH s3virge __drivermansuffix__ __vendorversion__ @@ -24,7 +24,11 @@ accelerated, and provides support for the following framebuffer depths: 8, 15, 16, and 24. All visual types are supported for depth 8, and TrueColor -visuals are supported for the other depths. +visuals are supported for the other depths. XVideo hardware up scaling +is supported in depth 16 and 24 on the DX, GX, GX2, MX, MX+, and +Trio3D/2X. Doublescan modes are supported and tested in depth 8 +and 16 on DX, but disable XVideo. Doublescan modes on other chipsets +are untested. .SH SUPPORTED HARDWARE The .B s3virge @@ -218,6 +222,11 @@ .SH SEE ALSO XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) + +.SH KNOWN BUGS +The VideoRam generic driver parameter is presently ignored by the +s3virge driver. On PPC this is reported to cause problems for 2M +cards, because they may autodetect as 4M. .SH SUPPORT For assistance with this driver, or XFree86 in general, check the XFree86 web Index: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.6 xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.6 Mon Dec 10 18:02:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile Mon Feb 17 12:06:44 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.6 2001/12/10 23:02:33 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.8 2003/02/17 17:06:44 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. @@ -42,7 +42,7 @@ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ - -I$(EXTINCSRC) -I$(XF86OSSRC)/vbe -I$(XF86SRC)/shadowfb + -I$(EXTINCSRC) -I$(XF86SRC)/vbe -I$(XF86SRC)/shadowfb #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.5 xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.5 Mon Dec 17 15:52:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man Tue May 14 16:19:51 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.5 2001/12/17 20:52:33 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.6 2002/05/14 20:19:51 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SAVAGE __drivermansuffix__ __vendorversion__ @@ -39,11 +39,17 @@ .B ProSavage KM133 (8a26) .TP 16 -.B Twister +.B Twister (ProSavage PN133) (8d01) .TP 16 -.B TwisterK +.B TwisterK (ProSavage KN133) (8d02) +.TP 16 +.B ProSavage DDR +(8d03) +.TP 16 +.B ProSavage DDR-K +(8d04) .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -75,7 +81,8 @@ Default: no rotation. .TP .BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. This option +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. This option disables acceleration. Default: off. .TP .BI "Option \*qLCDClock\*q \*q" frequency \*q @@ -100,6 +107,7 @@ .B savage driver use your mode line timing exactly, turn off the UseBios option. Default: on (use the BIOS). +.TP .BI "Option \*qShadowStatus\*q \q*" boolean \*q Enables the use of a shadow status register. There is a chip bug in the Savage graphics engine that can cause a bus lock when reading the engine Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.14 Thu Dec 13 13:01:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c Fri Nov 8 13:03:32 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.14 2001/12/13 18:01:50 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.18 2002/11/08 18:03:32 alanh Exp $ */ /* * @@ -399,9 +399,11 @@ xaaptr->SetClippingRectangle = SavageSetClippingRectangle; xaaptr->DisableClipping = SavageDisableClipping; xaaptr->ClippingFlags = 0 +#if 0 | HARDWARE_CLIP_SOLID_FILL | HARDWARE_CLIP_SOLID_LINE | HARDWARE_CLIP_DASHED_LINE +#endif | HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | HARDWARE_CLIP_MONO_8x8_FILL | HARDWARE_CLIP_COLOR_8x8_FILL @@ -415,7 +417,7 @@ #if 1 xaaptr->SetupForScreenToScreenCopy = SavageSetupForScreenToScreenCopy; xaaptr->SubsequentScreenToScreenCopy = SavageSubsequentScreenToScreenCopy; - xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; + xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK | ROP_NEEDS_SOURCE; #endif @@ -424,7 +426,7 @@ #if 1 xaaptr->SetupForSolidFill = SavageSetupForSolidFill; xaaptr->SubsequentSolidFillRect = SavageSubsequentSolidFillRect; - xaaptr->SolidFillFlags = NO_PLANEMASK; + xaaptr->SolidFillFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE; #endif /* Mono 8x8 pattern fills */ @@ -436,6 +438,7 @@ xaaptr->Mono8x8PatternFillFlags = 0 | HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN + | ROP_NEEDS_SOURCE | BIT_ORDER_IN_BYTE_MSBFIRST ; if( psav->Chipset == S3_SAVAGE4 ) @@ -444,16 +447,31 @@ /* Color 8x8 pattern fills */ + /* + * With the exception of the Savage3D and Savage4, all of the Savage + * chips require that bitmap descriptors have a stride that is a + * multiple of 16 pixels. This includes any descriptor used for + * color pattern fills, which COMPLETELY screws the XAA 8x8 color + * pattern support. + * + * We could double the width ourselves into a reserved frame buffer + * section, but since I went 18 months with only ONE report of this + * error, it seems hardly worth the trouble. + */ + #if 1 - xaaptr->SetupForColor8x8PatternFill = - SavageSetupForColor8x8PatternFill; - xaaptr->SubsequentColor8x8PatternFillRect = - SavageSubsequentColor8x8PatternFillRect; - xaaptr->Color8x8PatternFillFlags = 0 - | NO_TRANSPARENCY - | HARDWARE_PATTERN_PROGRAMMED_BITS - | HARDWARE_PATTERN_PROGRAMMED_ORIGIN - ; + if( (psav->Chipset == S3_SAVAGE3D) || (psav->Chipset == S3_SAVAGE4) ) + { + xaaptr->SetupForColor8x8PatternFill = + SavageSetupForColor8x8PatternFill; + xaaptr->SubsequentColor8x8PatternFillRect = + SavageSubsequentColor8x8PatternFillRect; + xaaptr->Color8x8PatternFillFlags = 0 + | NO_TRANSPARENCY + | HARDWARE_PATTERN_PROGRAMMED_BITS + | HARDWARE_PATTERN_PROGRAMMED_ORIGIN + ; + } #endif /* Solid lines */ @@ -467,7 +485,7 @@ xaaptr->SubsequentSolidFillTrap = SavageSubsequentSolidFillTrap; #endif - xaaptr->SolidBresenhamLineErrorTermBits = 16; + xaaptr->SolidBresenhamLineErrorTermBits = 14; #endif /* ImageWrite */ @@ -988,9 +1006,9 @@ pat_offset = (int) (patternx * psav->Bpp + patterny * psav->Bpl); cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP - | BCI_CMD_DEST_GBD | BCI_CMD_PAT_SBD_COLOR_NEW; + | BCI_CMD_DEST_GBD | BCI_CMD_PAT_PBD_COLOR_NEW; - mix = SavageHelpSolidROP( pScrn, &trans_col, planemask, &rop ); + mix = XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop ); BCI_CMD_SET_ROP(cmd, rop); bd = BCI_BD_BW_DISABLE; @@ -1020,10 +1038,11 @@ if( !w || !h ) return; - psav->WaitQueue(psav,5); + psav->WaitQueue(psav,6); BCI_SEND(psav->SavedBciCmd); BCI_SEND(psav->SavedSbdOffset); BCI_SEND(psav->SavedSbd); + BCI_SEND(BCI_X_Y(patternx,patterny)); BCI_SEND(BCI_X_Y(x, y)); BCI_SEND(BCI_W_H(w, h)); } @@ -1048,8 +1067,8 @@ cmd |= BCI_CMD_LINE_LAST_PIXEL; #ifdef DEBUG_EXTRA - ErrorF("BresenhamLine, (%4d,%4d), len %4d, oct %d, err %4d,%4d, clr %08x\n", - x1, y1, length, octant, e2, e1, psav->SavedFgColor ); + ErrorF("BresenhamLine, (%4d,%4d), len %4d, oct %d, err %4d,%4d,%4d clr %08x\n", + x1, y1, length, octant, e1, e2, err, psav->SavedFgColor ); #endif psav->WaitQueue(psav, 5 ); @@ -1059,7 +1078,7 @@ BCI_SEND(BCI_LINE_X_Y(x1, y1)); BCI_SEND(BCI_LINE_STEPS(e2-e1, e2)); BCI_SEND(BCI_LINE_MISC(length, - !!(octant & YMAJOR), + (octant & YMAJOR), !(octant & XDECREASING), !(octant & YDECREASING), e2+err)); Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h:1.2 Mon Oct 1 09:44:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h Wed Oct 2 16:39:54 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.2 2001/10/01 13:44:09 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.4 2002/10/02 20:39:54 alanh Exp $ */ #ifndef _S3BCI_H_ #define _S3BCI_H_ @@ -87,9 +87,11 @@ #define BCI_LINE_X_Y(x, y) (((y) << 16) | ((x) & 0xFFFF)) #define BCI_LINE_STEPS(diag, axi) (((axi) << 16) | ((diag) & 0xFFFF)) #define BCI_LINE_MISC(maj, ym, xp, yp, err) \ -(((maj) & 0xFFF) | (((ym) & 1) << 13) | \ -(((xp) & 1) << 14) | (((yp) & 1) << 15) | \ -((err) << 16)) + (((maj) & 0x1FFF) | \ + ((ym) ? 1<<13 : 0) | \ + ((xp) ? 1<<14 : 0) | \ + ((yp) ? 1<<15 : 0) | \ + ((err) << 16)) #endif /* _S3BCI_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.6 Fri Nov 2 11:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c Sat Jan 18 10:22:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.6 2001/11/02 16:24:51 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.9 2003/01/18 15:22:29 eich Exp $ */ /* * Hardware cursor support for S3 Savage 4.0 driver. Taken with @@ -22,6 +22,8 @@ #define inCRReg(reg) (VGAHWPTR(pScrn))->readCrtc( VGAHWPTR(pScrn), reg ) #define outCRReg(reg, val) (VGAHWPTR(pScrn))->writeCrtc( VGAHWPTR(pScrn), reg, val ) +#define inSRReg(reg) (VGAHWPTR(pScrn))->readSeq( VGAHWPTR(pScrn), reg ) +#define outSRReg(reg, val) (VGAHWPTR(pScrn))->writeSeq( VGAHWPTR(pScrn), reg, val ) #define inStatus1() (VGAHWPTR(pScrn))->readST01( VGAHWPTR(pScrn) ) /* @@ -37,7 +39,28 @@ } #define MAX_CURS 64 +/* + * Disable HW Cursor on stretched LCDs. We don't know how to + * detect if display is stretched. Therefore we cannot rescale + * the HW cursor position. + */ + +static Bool +SavageUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) +{ + ScrnInfoPtr pScrn = xf86Screens[pScr->myNum]; + SavagePtr psav = SAVPTR(pScrn); + if (psav->PanelX != pScrn->currentMode->HDisplay + || psav->PanelY != pScrn->currentMode->VDisplay) { + /* BIT 1 : CRT is active, BIT 2 : LCD is active */ + unsigned char cr6d = inCRReg( 0x6d ); + if (cr6d & 0x02) + return FALSE; + } + return TRUE; +} + Bool SavageHWCursorInit(ScreenPtr pScreen) { @@ -67,7 +90,7 @@ if( ((psav->Chipset != S3_SAVAGE4) - && (inCRReg(0x18) & 0x80) && (inCRReg(0x15) & 0x50) ) + && (inSRReg(0x18) & 0x80) && (inSRReg(0x15) & 0x50) ) || S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) @@ -78,8 +101,12 @@ infoPtr->LoadCursorImage = SavageLoadCursorImage; infoPtr->HideCursor = SavageHideCursor; infoPtr->ShowCursor = SavageShowCursor; - infoPtr->UseHWCursor = NULL; + if ((S3_SAVAGE_MOBILE_SERIES(psav->Chipset) + || (psav->Chipset == S3_PROSAVAGE)) && !psav->CrtOnly) + infoPtr->UseHWCursor = SavageUseHWCursor; + else + infoPtr->UseHWCursor = NULL; if( !psav->CursorKByte ) psav->CursorKByte = pScrn->videoRam - 4; @@ -91,8 +118,9 @@ void SavageShowCursor(ScrnInfoPtr pScrn) { - /* Turn cursor on. */ + /* Turn cursor on. */ outCRReg( 0x45, inCRReg(0x45) | 0x01 ); + SAVPTR(pScrn)->hwc_on = TRUE; } @@ -100,12 +128,12 @@ SavageHideCursor(ScrnInfoPtr pScrn) { /* Turn cursor off. */ - if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) ) { waitHSync(5); } outCRReg( 0x45, inCRReg(0x45) & 0xfe ); + SAVPTR(pScrn)->hwc_on = FALSE; } static void Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.3 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c Sat Jan 18 10:22:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.3 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.6 2003/01/18 15:22:29 eich Exp $ */ /* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. @@ -155,7 +155,8 @@ ); if(oneMore) { /* first one is narrow width */ - mode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; + /* Force stride to multiple of 16 pixels. */ + mode->bytesPerScanline = ((pMode->HDisplay + 15) & ~15) * Bpp; mode->imageWidth = pMode->HDisplay; mode->imageHeight = pMode->VDisplay; mode->pixmapWidth = mode->imageWidth; @@ -172,7 +173,7 @@ goto SECOND_PASS; } else { - mode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L; + mode->bytesPerScanline = ((pScrn->displayWidth + 15) & ~15) * Bpp; mode->imageWidth = pScrn->displayWidth; mode->imageHeight = psav->videoRambytes / mode->bytesPerScanline; mode->pixmapWidth = mode->imageWidth; @@ -260,6 +261,7 @@ static int OldDisplayWidth[MAXSCREENS]; static int OldBitsPerPixel[MAXSCREENS]; static int OldDepth[MAXSCREENS]; + static DisplayModePtr OldMode[MAXSCREENS]; int index = pScrn->pScreen->myNum; SavagePtr psav = SAVPTR(pScrn); @@ -269,11 +271,12 @@ pScrn->displayWidth = OldDisplayWidth[index]; pScrn->bitsPerPixel = OldBitsPerPixel[index]; pScrn->depth = OldDepth[index]; + pScrn->currentMode = OldMode[index]; + psav->DGAactive = FALSE; SavageSwitchMode(index, pScrn->currentMode, 0); - if( psav->hwcursor ) + if( psav->hwcursor && psav->hwc_on ) SavageShowCursor(pScrn); - psav->DGAactive = FALSE; } else { Bool holdBIOS = psav->UseBIOS; @@ -286,13 +289,17 @@ pMode->bitsPerPixel, pMode->depth); #endif - if( psav->hwcursor ) + if( psav->hwcursor && psav->hwc_on) { SavageHideCursor(pScrn); + psav->hwc_on = TRUE; /* save for later restauration */ + } + if(!psav->DGAactive) { /* save the old parameters */ OldDisplayWidth[index] = pScrn->displayWidth; OldBitsPerPixel[index] = pScrn->bitsPerPixel; OldDepth[index] = pScrn->depth; + OldMode[index] = pScrn->currentMode; psav->DGAactive = TRUE; } @@ -302,7 +309,7 @@ pScrn->displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3); - psav->UseBIOS = FALSE; +/* psav->UseBIOS = FALSE; */ SavageSwitchMode(index, pMode->mode, 0); psav->UseBIOS = holdBIOS; } Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.34 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.24 Fri Nov 2 11:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c Mon Feb 24 23:08:21 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.24 2001/11/02 16:24:51 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.34 2003/02/25 04:08:21 dawes Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -74,16 +74,18 @@ static Bool SavageDDC1(int scrnIndex); static unsigned int SavageDDC1Read(ScrnInfoPtr pScrn); static void SavageProbeDDC(ScrnInfoPtr pScrn, int index); +static void SavageGetTvMaxSize(SavagePtr psav); +static Bool SavagePanningCheck(ScrnInfoPtr pScrn); extern ScrnInfoPtr gpScrn; #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.20" +#define DRIVER_VERSION "1.1.26" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 20 +#define PATCHLEVEL 26 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) @@ -132,6 +134,8 @@ { PCI_CHIP_SUPSAV_IX64DDR, "SuperSavage/IX 64" }, { PCI_CHIP_SUPSAV_IXCSDR, "SuperSavage/IXC 64" }, { PCI_CHIP_SUPSAV_IXCDDR, "SuperSavage/IXC 64" }, + { PCI_CHIP_PROSAVAGE_DDR, "ProSavage DDR" }, + { PCI_CHIP_PROSAVAGE_DDRK, "ProSavage DDR-K" }, { -1, NULL } }; @@ -160,6 +164,8 @@ { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_KM, RES_SHARED_VGA }, { S3_PROSAVAGE, PCI_CHIP_S3TWISTER_P, RES_SHARED_VGA }, { S3_PROSAVAGE, PCI_CHIP_S3TWISTER_K, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_DDR, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_DDRK, RES_SHARED_VGA }, { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_MX128, RES_SHARED_VGA }, { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_MX64, RES_SHARED_VGA }, { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_MX64C, RES_SHARED_VGA }, @@ -173,21 +179,24 @@ }; typedef enum { - OPTION_PCI_BURST, - OPTION_PCI_RETRY, - OPTION_NOACCEL, - OPTION_LCD_CENTER, - OPTION_LCDCLOCK, - OPTION_MCLK, - OPTION_REFCLK, - OPTION_SHOWCACHE, - OPTION_SWCURSOR, - OPTION_HWCURSOR, - OPTION_SHADOW_FB, - OPTION_ROTATE, - OPTION_USEBIOS, - OPTION_SHADOW_STATUS, - OPTION_VIDEORAM + OPTION_PCI_BURST + ,OPTION_PCI_RETRY + ,OPTION_NOACCEL + ,OPTION_LCD_CENTER + ,OPTION_LCDCLOCK + ,OPTION_MCLK + ,OPTION_REFCLK + ,OPTION_SHOWCACHE + ,OPTION_SWCURSOR + ,OPTION_HWCURSOR + ,OPTION_SHADOW_FB + ,OPTION_ROTATE + ,OPTION_USEBIOS + ,OPTION_SHADOW_STATUS + ,OPTION_CRT_ONLY + ,OPTION_TV_ON + ,OPTION_TV_PAL + ,OPTION_FORCE_INIT } SavageOpts; @@ -201,7 +210,10 @@ { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LCDCLOCK, "LCDClock", OPTV_FREQ, {0}, FALSE }, { OPTION_SHADOW_STATUS, "ShadowStatus", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_VIDEORAM, "VideoRAM", OPTV_INTEGER, {0}, FALSE }, + { OPTION_CRT_ONLY, "CrtOnly", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_TV_ON, "TvOn", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_TV_PAL, "PAL", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FORCE_INIT,"ForceInit", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -277,9 +289,7 @@ "XAADestroyInfoRec", "XAAFillSolidRects", "XAAHelpPatternROP", -#if 0 "XAAHelpSolidROP", -#endif "XAAInit", "XAAScreenIndex", NULL @@ -682,7 +692,7 @@ unsigned char config1, m, n, n1, n2, sr8, cr66 = 0, tmp; int mclk; vgaHWPtr hwp; - int vgaCRIndex, vgaCRReg, vgaIOBase; + int vgaCRIndex, vgaCRReg; pointer ddc; TRACE(("SavagePreInit(%d)\n", flags)); @@ -719,6 +729,7 @@ return FALSE; else { int requiredBpp; + int altBpp = 0; switch (pScrn->depth) { case 8: @@ -730,6 +741,7 @@ break; case 24: requiredBpp = 32; + altBpp = 24; break; default: @@ -739,7 +751,10 @@ return FALSE; } - if( pScrn->bitsPerPixel != requiredBpp ) { + if( + (pScrn->bitsPerPixel != requiredBpp) && + (pScrn->bitsPerPixel != altBpp) + ) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Depth %d must specify %d bpp; %d was given\n", pScrn->depth, requiredBpp, pScrn->bitsPerPixel ); @@ -763,8 +778,8 @@ if (!xf86SetDefaultVisual(pScrn, -1)) { return FALSE; } else { - /* We don't currently support DirectColor at > 8bpp */ - if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { + /* We don't currently support DirectColor at 16bpp */ + if (pScrn->bitsPerPixel == 16 && pScrn->defaultVisual != TrueColor) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" " (%s) is not supported at depth %d\n", xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); @@ -778,10 +793,14 @@ return FALSE; psav = SAVPTR(pScrn); + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + psav->vgaIOBase = hwp->IOBase; + xf86CollectOptions(pScrn, NULL); if (pScrn->depth == 8) - pScrn->rgbBits = 6; + pScrn->rgbBits = 8/*6*/; if (!(psav->Options = xalloc(sizeof(SavageOptions)))) return FALSE; @@ -839,6 +858,13 @@ psav->NoAccel = TRUE; } + if (pScrn->bitsPerPixel == 24 && !psav->NoAccel) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "HW acceleration not possible with depth 32 and bpp 24.\n"); + psav->NoAccel = TRUE; + } + + /* * The SWCursor setting takes priority over HWCursor. The default * if neither is specified is HW, unless ShadowFB is specified, @@ -863,13 +889,6 @@ xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n", psav->UseBIOS ? "U" : "Not u" ); - pScrn->videoRam = 0; - if( xf86GetOptValInteger(psav->Options, OPTION_VIDEORAM, &pScrn->videoRam ) ) - { - xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, - "Option: VideoRAM %dkB\n", pScrn->videoRam ); - } - psav->LCDClock = 0.0; if( xf86GetOptValFreq( psav->Options, OPTION_LCDCLOCK, OPTUNITS_MHZ, &psav->LCDClock ) ) xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, @@ -880,6 +899,30 @@ "Option: ShadowStatus enabled\n" ); + if( xf86GetOptValBool( psav->Options, OPTION_CRT_ONLY, &psav->CrtOnly)) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: CrtOnly enabled\n" ); + + if( xf86GetOptValBool( psav->Options, OPTION_TV_ON, &psav->TvOn)) { + psav->PAL = FALSE; + SavageGetTvMaxSize(psav); + } + + if( xf86GetOptValBool( psav->Options, OPTION_TV_PAL, &psav->PAL)) { + SavageGetTvMaxSize(psav); + psav->TvOn = TRUE; + } + + if( psav->TvOn ) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "TV enabled in %s format\n", + psav->PAL ? "PAL" : "NTSC" ); + + psav->ForceInit = 0; + if( xf86GetOptValBool( psav->Options, OPTION_FORCE_INIT, &psav->ForceInit)) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: ForceInit enabled\n" ); + /* Add more options here. */ if (pScrn->numEntities > 1) { @@ -908,8 +951,8 @@ psav->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); - xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); - xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); from = X_DEFAULT; if (pEnt->device->chipset && *pEnt->device->chipset) { @@ -943,6 +986,9 @@ } else psav->ChipRev = psav->PciInfo->chipRev; + if (pEnt->device->videoRam != 0) + pScrn->videoRam = pEnt->device->videoRam; + xfree(pEnt); /* maybe throw in some more sanity checks here */ @@ -952,17 +998,14 @@ psav->PciTag = pciTag(psav->PciInfo->bus, psav->PciInfo->device, psav->PciInfo->func); - hwp = VGAHWPTR(pScrn); if (!SavageMapMMIO(pScrn)) { vbeFree(psav->pVbe); return FALSE; } - vgaHWGetIOBase(hwp); - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; + vgaCRIndex = psav->vgaIOBase + 4; + vgaCRReg = psav->vgaIOBase + 5; xf86EnableIO(); /* unprotect CRTC[0-7] */ @@ -1002,19 +1045,6 @@ /* Compute the amount of video memory and offscreen memory. */ - psav->MemOffScreen = 0; - - if( psav->pVbe ) - { - /* If VBE is available, it is the best judge of onboard memory. */ - - VbeInfoBlock* vib; - - vib = VBEGetVBEInfo( psav->pVbe ); - pScrn->videoRam = vib->TotalMemory * 64; - VBEFreeVBEInfo( vib ); - } - if (!pScrn->videoRam) { static unsigned char RamSavage3D[] = { 8, 4, 4, 2 }; static unsigned char RamSavage4[] = { 2, 4, 8, 12, 16, 32, 64, 32 }; @@ -1044,17 +1074,10 @@ break; case S3_SAVAGE_MX: + case S3_SUPERSAVAGE: pScrn->videoRam = RamSavageMX[ (config1 & 0x0E) >> 1 ] * 1024; break; - case S3_SUPERSAVAGE: - vbeFree(psav->pVbe); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Cannot determine video RAM for SuperSavage chips.\n"); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Please set Option \"VideoRAM\" \"xxxxx\" in XF86Config.\n"); - return FALSE; - case S3_PROSAVAGE: pScrn->videoRam = RamSavageNB[ (config1 & 0xE0) >> 5 ] * 1024; break; @@ -1067,22 +1090,35 @@ psav->videoRambytes = pScrn->videoRam * 1024; - if (psav->MemOffScreen) - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "probed videoram: %dk plus %dk offscreen\n", - pScrn->videoRam, - psav->MemOffScreen); - else - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "probed videoram: %dk\n", - pScrn->videoRam); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "probed videoram: %dk\n", + pScrn->videoRam); } else { psav->videoRambytes = pScrn->videoRam * 1024; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "videoram = %dk\n", - pScrn->videoRam); + "videoram = %dk\n", + pScrn->videoRam); } + if( !pScrn->videoRam && psav->pVbe ) + { + /* If VBE is available, ask it about onboard memory. */ + + VbeInfoBlock* vib; + + vib = VBEGetVBEInfo( psav->pVbe ); + pScrn->videoRam = vib->TotalMemory * 64; + VBEFreeVBEInfo( vib ); + + /* VBE often cuts 64k off of the RAM total. */ + + if( pScrn->videoRam & 64 ) + pScrn->videoRam += 64; + + psav->videoRambytes = pScrn->videoRam * 1024; + } + /* * If we're running with acceleration, compute the command overflow * buffer location. The command overflow buffer must END at a @@ -1096,10 +1132,12 @@ psav->cobSize = 0; psav->cobOffset = psav->videoRambytes; } - else if( S3_SAVAGE4_SERIES(psav->Chipset) ) { + else if( (S3_SAVAGE4_SERIES(psav->Chipset)) || + (S3_SUPERSAVAGE == psav->Chipset) ) { /* * The Savage4 and ProSavage have COB coherency bugs which render - * the buffer useless. We disable it. + * the buffer useless. COB seems to make the SuperSavage slower. + * We disable it. */ psav->CursorKByte = pScrn->videoRam - 4; psav->cobIndex = 2; @@ -1108,10 +1146,15 @@ } else { - /* We use 128kB for the COB on all chips. */ + /* We use 128kB for the COB on all other chips. */ - psav->cobIndex = 7; - psav->cobSize = 0x400 << psav->cobIndex; + psav->cobSize = 1 << 17; + if (psav->Chipset == S3_SUPERSAVAGE) { + psav->cobIndex = 2; + } + else { + psav->cobIndex = 7; + } psav->cobOffset = psav->videoRambytes - psav->cobSize; } @@ -1182,11 +1225,13 @@ if ( xf86LoadSubModule(pScrn, "i2c") ) { xf86LoaderReqSymLists(i2cSymbols,NULL); if (SavageI2CInit(pScrn)) { - CARD32 temp = (INREG(DDC_REG)); - OUTREG(DDC_REG,(temp | 0x13)); + unsigned char tmp; + + InI2CREG(psav,tmp); + OutI2CREG(psav,tmp | 0x13); xf86SetDDCproperties(pScrn,xf86PrintEDID( xf86DoEDID_DDC2(pScrn->scrnIndex,psav->I2C))); - OUTREG(DDC_REG,temp); + OutI2CREG(psav,tmp); } } } @@ -1240,7 +1285,7 @@ /* Check LCD panel information */ - if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && !psav->CrtOnly ) { unsigned char cr6b = hwp->readCrtc( hwp, 0x6b ); @@ -1307,7 +1352,7 @@ } } - clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges = xnfcalloc(sizeof(ClockRange),1); clockRanges->next = NULL; clockRanges->minClock = psav->minClock; clockRanges->maxClock = psav->maxClock; @@ -1422,7 +1467,7 @@ xf86LoaderReqSymLists(shadowSymbols, NULL); } vbeFree(psav->pVbe); - + return TRUE; } @@ -1461,10 +1506,8 @@ vgaRegPtr vgaSavePtr = &hwp->SavedReg; SavagePtr psav = SAVPTR(pScrn); SavageRegPtr save = &psav->SavedReg; - int vgaCRIndex, vgaCRReg, vgaIOBase; - vgaIOBase = hwp->IOBase; - vgaCRReg = vgaIOBase + 5; - vgaCRIndex = vgaIOBase + 4; + unsigned short vgaCRReg = psav->vgaIOBase + 5; + unsigned short vgaCRIndex = psav->vgaIOBase + 4; TRACE(("SavageSave()\n")); @@ -1589,6 +1632,8 @@ save->SR30 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x18); save->SR18 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x1b); + save->SR1B = VGAIN8(0x3c5); /* Save flat panel expansion regsters. */ @@ -1650,7 +1695,9 @@ TRACE(("SavageWriteMode(%x)\n", restore->mode)); - if( Entering ) + if( Entering && + (!S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || (psav->ForceInit)) + ) SavageInitialize2DEngine(pScrn); /* @@ -1697,6 +1744,14 @@ VGAOUT8(vgaCRIndex, 0x67); VGAOUT8(vgaCRReg, restore->CR67); + /* Enable gamma correction. */ + + VGAOUT8(0x3c4, 0x1b); + if( (pScrn->bitsPerPixel == 32) && !psav->DGAactive ) + VGAOUT8(0x3c5, 0x28 ); + else + VGAOUT8(0x3c5, 0x00 ); + /* We may need TV/panel fixups here. See s3bios.c line 2904. */ /* Set FIFO fetch delay. */ @@ -1968,6 +2023,11 @@ VGAOUT8(0x3c4, 0x18); VGAOUT8(0x3c5, restore->SR18); + VGAOUT8(0x3c4, 0x1b); + if( psav->DGAactive ) + VGAOUT8(0x3c5, restore->SR1B & ~0x28); + else + VGAOUT8(0x3c5, restore->SR1B); /* load new m, n pll values for dclk & mclk */ VGAOUT8(0x3c4, 0x15); @@ -1985,7 +2045,7 @@ VGAOUT8(0x3c5, restore->SR08); /* now write out cr67 in full, possibly starting STREAMS */ - VerticalRetraceWait(); + VerticalRetraceWait(psav); VGAOUT8(vgaCRIndex, 0x67); #if 0 VGAOUT8(vgaCRReg, 0x50); @@ -2006,7 +2066,7 @@ if( !S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { - VerticalRetraceWait(); + VerticalRetraceWait(psav); OUTREG(FIFO_CONTROL_REG, restore->MMPR0); OUTREG(MIU_CONTROL_REG, restore->MMPR1); OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); @@ -2042,7 +2102,6 @@ static Bool SavageMapMMIO(ScrnInfoPtr pScrn) { SavagePtr psav; - vgaHWPtr hwp; TRACE(("SavageMapMMIO()\n")); @@ -2079,8 +2138,6 @@ psav->BciMem = psav->MapBase + 0x10000; SavageEnableMMIO(pScrn); - hwp = VGAHWPTR(pScrn); - vgaHWGetIOBase(hwp); return TRUE; } @@ -2203,7 +2260,7 @@ miClearVisualTypes(); - if (pScrn->bitsPerPixel > 8) { + if (pScrn->bitsPerPixel == 16) { if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; @@ -2284,11 +2341,16 @@ if (psav->Chipset == S3_SAVAGE4) { if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPaletteSavage4, - NULL, CMAP_RELOAD_ON_MODE_SWITCH)) + NULL, + CMAP_RELOAD_ON_MODE_SWITCH + | CMAP_PALETTED_TRUECOLOR + )) return FALSE; } else { if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPalette, NULL, - CMAP_RELOAD_ON_MODE_SWITCH)) + CMAP_RELOAD_ON_MODE_SWITCH + | CMAP_PALETTED_TRUECOLOR + )) return FALSE; } @@ -2302,7 +2364,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n"); #ifdef XvExtension - if( !psav->NoAccel ) + if( !psav->NoAccel && !SavagePanningCheck(pScrn) ) SavageInitVideo( pScreen ); #endif @@ -2366,8 +2428,18 @@ /* We prohibit modes bigger than the LCD panel. */ /* TODO We should do this only if the panel is active. */ + if( psav->TvOn ) + { + if( pMode->HDisplay > psav->TVSizeX ) + return MODE_VIRTUAL_X; + + if( pMode->VDisplay > psav->TVSizeY ) + return MODE_VIRTUAL_Y; + + } if( - (psav->PanelX) && + !psav->CrtOnly && + psav->PanelX && ( (pMode->HDisplay > psav->PanelX) || (pMode->VDisplay > psav->PanelY) @@ -2470,7 +2542,10 @@ new->CR67 = 0x40; /* 16bpp, 1 pixels/clock */ break; case 24: - new->CR67 = 0xd0; + if (pScrn->bitsPerPixel == 24 ) + new->CR67 = 0x70; + else + new->CR67 = 0xd0; break; } @@ -2565,6 +2640,18 @@ new->SR15 = 0x03 | 0x80; new->SR18 = 0x00; + +/* VGAOUT8(0x3c4, 0x1b); + new->SR1B = VGAIN8(0x3c5); + if( pScrn->depth == 24 ) + new->SR1B |= 0x28; +*/ + if( pScrn->depth == 24 ) + new->SR1B = 0x28; + else + new->SR1B = 0x00; + + new->CR43 = new->CR45 = new->CR65 = 0x00; VGAOUT8(vgaCRIndex, 0x40); @@ -2746,15 +2833,16 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRACE(("SavageSaveScreen(0x%x)\n", mode)); - if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor ) - { + if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor && SAVPTR(pScrn)->hwc_on) { + if( xf86IsUnblank(mode) ) SavageShowCursor( pScrn ); else SavageHideCursor( pScrn ); + SAVPTR(pScrn)->hwc_on = TRUE; } - return vgaHWSaveScreen(pScreen, mode); + return vgaHWSaveScreen(pScreen, mode); } @@ -2808,9 +2896,8 @@ VGAOUT8(0x3c3, val | 0x01); val = VGAIN8(VGA_MISC_OUT_R); VGAOUT8(VGA_MISC_OUT_W, val | 0x01); - vgaHWGetIOBase(hwp); - vgaCRIndex = hwp->IOBase + 4; - vgaCRReg = hwp->IOBase + 5; + vgaCRIndex = psav->vgaIOBase + 4; + vgaCRReg = psav->vgaIOBase + 5; if( psav->Chipset >= S3_SAVAGE4 ) { @@ -2832,9 +2919,8 @@ TRACE(("SavageDisableMMIO\n")); - vgaHWGetIOBase(hwp); - vgaCRIndex = hwp->IOBase + 4; - vgaCRReg = hwp->IOBase + 5; + vgaCRIndex = psav->vgaIOBase + 4; + vgaCRReg = psav->vgaIOBase + 5; if( psav->Chipset >= S3_SAVAGE4 ) { @@ -2876,11 +2962,11 @@ vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; - VerticalRetraceWait(); + VerticalRetraceWait(psav); for (i=0; i<numColors; i++) { if (!(inStatus1()) & 0x08) - VerticalRetraceWait(); + VerticalRetraceWait(psav); index = indicies[i]; VGAOUT8(0x3c8, index); VGAOUT8(0x3c9, colors[index].red); @@ -3116,13 +3202,15 @@ SavageDDC1Read(ScrnInfoPtr pScrn) { register vgaHWPtr hwp = VGAHWPTR(pScrn); - register CARD32 tmp; + register unsigned char tmp; SavagePtr psav = SAVPTR(pScrn); + VerticalRetraceWait(psav); + + InI2CREG(psav,tmp); while (hwp->readST01(hwp)&0x8) {}; while (!(hwp->readST01(hwp)&0x8)) {}; - tmp = (INREG(DDC_REG)); return ((unsigned int) (tmp & 0x08)); } @@ -3131,13 +3219,13 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; SavagePtr psav = SAVPTR(pScrn); - CARD32 tmp; + unsigned char tmp; Bool success = FALSE; xf86MonPtr pMon; /* initialize chipset */ - tmp = INREG(DDC_REG); - OUTREG(DDC_REG,(tmp | 0x12)); + InI2CREG(psav,tmp); + OutI2CREG(psav,tmp | 0x12); if ((pMon = xf86PrintEDID( xf86DoEDID_DDC1(scrnIndex,vgaHWddc1SetSpeed,SavageDDC1Read))) != NULL) @@ -3145,7 +3233,7 @@ xf86SetDDCproperties(pScrn,pMon); /* undo initialization */ - OUTREG(DDC_REG,(tmp)); + OutI2CREG(psav,tmp); return success; } @@ -3160,4 +3248,35 @@ vbeFree(pVbe); } } + + +static void +SavageGetTvMaxSize(SavagePtr psav) +{ + if( psav->PAL ) { + psav->TVSizeX = 800; + psav->TVSizeY = 600; + } + else { + psav->TVSizeX = 640; + psav->TVSizeY = 480; + } +} + + +static Bool +SavagePanningCheck(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + DisplayModePtr pMode; + + pMode = pScrn->currentMode; + psav->iResX = pMode->CrtcHDisplay; + psav->iResY = pMode->CrtcVDisplay; + if( psav->iResX < pScrn->virtualX || psav->iResY < pScrn->virtualY ) + return TRUE; + else + return FALSE; +} + Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.11 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.11 Thu Aug 9 15:14:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h Sat Jan 18 10:22:30 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.11 2001/08/09 19:14:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.16 2003/01/18 15:22:30 eich Exp $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H @@ -35,6 +35,9 @@ #define INREG16(addr) MMIO_IN16(psav->MapBase, addr) #define OUTREG16(addr,val) MMIO_OUT16(psav->MapBase, addr, val) +#define SAVAGE_CRT_ON 1 +#define SAVAGE_LCD_ON 2 +#define SAVAGE_TV_ON 4 typedef struct _S3VMODEENTRY { unsigned short Width; @@ -54,7 +57,7 @@ typedef struct { unsigned int mode, refresh; unsigned char SR08, SR0E, SR0F; - unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR29, SR30; + unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR1B, SR29, SR30; unsigned char SR54[8]; unsigned char Clock; unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C; @@ -115,14 +118,37 @@ Bool fifo_moderate; Bool fifo_aggressive; Bool hwcursor; + Bool hwc_on; Bool NoAccel; Bool shadowFB; Bool UseBIOS; int rotate; double LCDClock; Bool ShadowStatus; - int PanelX; - int PanelY; + Bool CrtOnly; + Bool TvOn; + Bool PAL; + Bool ForceInit; + int iDevInfo; + int iDevInfoPrim; + + int PanelX; /* panel width */ + int PanelY; /* panel height */ + int iResX; /* crtc X display */ + int iResY; /* crtc Y display */ + int XFactor; /* overlay X factor */ + int YFactor; /* overlay Y factor */ + int displayXoffset; /* overlay X offset */ + int displayYoffset; /* overlay Y offset */ + int XExpansion; /* expansion factor in x */ + int XExp1; + int XExp2; + int YExpansion; /* expansion factor in x */ + int YExp1; + int YExp2; + int cxScreen; + int TVSizeX; + int TVSizeY; CloseScreenProcPtr CloseScreen; pciVideoPtr PciInfo; @@ -133,6 +159,7 @@ vbeInfoPtr pVbe; int EntityIndex; int ShadowCounter; + int vgaIOBase; /* 3b0 or 3d0 */ /* The various Savage wait handlers. */ int (*WaitQueue)(struct _Savage *, int); @@ -176,6 +203,7 @@ XF86VideoAdaptorPtr adaptor; int VideoZoomMax; int dwBCIWait2DIdle; + XF86OffscreenImagePtr offscreenImages; } SavageRec, *SavagePtr; @@ -184,6 +212,15 @@ #define VF_STREAMS_ON 0x0001 #define SAVPTR(p) ((SavagePtr)((p)->driverPrivate)) + +/* Make the names of these externals driver-unique */ +#define gpScrn savagegpScrn +#define myOUTREG savageOUTREG +#define readdw savagereaddw +#define readfb savagereadfb +#define writedw savagewritedw +#define writefb savagewritefb +#define writescan savagewritescan /* Prototypes. */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c:1.1 Tue Feb 13 16:15:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c Wed Oct 2 16:39:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c,v 1.1 2001/02/13 21:15:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c,v 1.3 2002/10/02 20:39:55 alanh Exp $ */ /* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. @@ -41,23 +41,25 @@ static void SavageI2CPutBits(I2CBusPtr b, int clock, int data) { - SavagePtr psav = SAVPTR(xf86Screens[b->scrnIndex]); - unsigned int reg = 0x10; + ScrnInfoPtr pScrn = (ScrnInfoPtr)(xf86Screens[b->scrnIndex]); + SavagePtr psav = SAVPTR(pScrn); + unsigned char reg = 0x10; if(clock) reg |= 0x1; if(data) reg |= 0x2; - OUTREG(DDC_REG,reg); + OutI2CREG(psav,reg); /*ErrorF("SavageI2CPutBits: %d %d\n", clock, data); */ } static void SavageI2CGetBits(I2CBusPtr b, int *clock, int *data) { - SavagePtr psav = SAVPTR(xf86Screens[b->scrnIndex]); - unsigned int reg; + ScrnInfoPtr pScrn = (ScrnInfoPtr)(xf86Screens[b->scrnIndex]); + SavagePtr psav = SAVPTR(pScrn); + unsigned char reg = 0x10; - reg = (INREG(DDC_REG)); + InI2CREG(psav,reg); *clock = reg & 0x4; *data = reg & 0x8; Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.5 Thu Aug 9 15:14:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c Tue May 14 16:19:52 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.5 2001/08/09 19:14:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.6 2002/05/14 20:19:52 alanh Exp $ */ #include "savage_driver.h" #include "xaarop.h" Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.10 Sun Nov 4 17:17:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h Wed Oct 2 16:39:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.10 2001/11/04 22:17:48 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.12 2002/10/02 20:39:55 alanh Exp $ */ #ifndef _SAVAGE_REGS_H #define _SAVAGE_REGS_H @@ -22,6 +22,10 @@ #define PCI_CHIP_SUPSAV_IXCSDR 0x8c2e #define PCI_CHIP_SUPSAV_IXCDDR 0x8c2f #endif +#ifndef PCI_CHIP_PROSAVAGE_DDR +#define PCI_CHIP_PROSAVAGE_DDR 0x8d03 +#define PCI_CHIP_PROSAVAGE_DDRK 0x8d04 +#endif #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) @@ -164,9 +168,6 @@ #define MONO_PAT_0 0xa4e8 #define MONO_PAT_1 0xa4ec -#define DDC_REG 0xff20 - - /* Constants for CR69. */ #define CRT_ACTIVE 0x01 @@ -192,14 +193,30 @@ * If not present it will cause lockups on Savage4. * Ask S3, why. */ -#define VerticalRetraceWait() \ +#define VerticalRetraceWait(psav) \ { \ - VGAIN8(vgaCRIndex); \ - VGAOUT8(vgaCRIndex, 0x17); \ - if (VGAIN8(vgaCRReg) & 0x80) { \ - while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x08) ; \ - while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ + VGAIN8(psav->vgaIOBase+4); \ + VGAOUT8(psav->vgaIOBase+4, 0x17); \ + if (VGAIN8(psav->vgaIOBase+5) & 0x80) { \ + while ((VGAIN8(psav->vgaIOBase + 0x0a) & 0x08) == 0x08) ; \ + while ((VGAIN8(psav->vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ } \ } + +#define I2C_REG 0xa0 +#define InI2CREG(psav,a) \ +{ \ + VGAOUT8(psav->vgaIOBase + 4, I2C_REG); \ + a = VGAIN8(psav->vgaIOBase + 5); \ +} + +#define OutI2CREG(psav,a) \ +{ \ + VGAOUT8(psav->vgaIOBase + 4, I2C_REG); \ + VGAOUT8(psav->vgaIOBase + 5, a); \ +} + +#define HZEXP_FACTOR_IGA1 0x59 +#define VTEXP_FACTOR_IGA1 0x5b #endif /* _SAVAGE_REGS_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c:1.1 Fri Dec 1 20:16:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c Tue May 14 16:19:52 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c,v 1.1 2000/12/02 01:16:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c,v 1.2 2002/05/14 20:19:52 alanh Exp $ */ /* Copyright (c) 1999,2000 The XFree86 Project Inc. Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.9 Fri May 18 22:05:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c Wed Oct 2 16:39:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.9 2001/05/19 02:05:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.12 2002/10/02 20:39:55 alanh Exp $ */ #include "savage_driver.h" #include "savage_vbe.h" @@ -14,6 +14,8 @@ #define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) Bool vbeModeInit( vbeInfoPtr, int ); +static int SavageGetDevice( SavagePtr psav ); +/*static int SavageGetTVType( SavagePtr psav );*/ static void SavageClearVM86Regs( xf86Int10InfoPtr pInt ) @@ -31,6 +33,15 @@ void SavageSetTextMode( SavagePtr psav ) { + /* Restore display device if changed. */ + if( psav->iDevInfo != psav->iDevInfoPrim ) { + SavageClearVM86Regs( psav->pInt10 ); + psav->pInt10->ax = 0x4f14; + psav->pInt10->bx = 0x0003; + psav->pInt10->cx = psav->iDevInfoPrim; + xf86ExecX86int10( psav->pInt10 ); + } + SavageClearVM86Regs( psav->pInt10 ); psav->pInt10->ax = 0x83; @@ -42,16 +53,55 @@ void SavageSetVESAMode( SavagePtr psav, int n, int Refresh ) { - /* First, establish the refresh rate for this mode. */ + int iDevInfo; + static int iCount = 0; + + /* Get current display device status. */ + iDevInfo = SavageGetDevice(psav); + psav->iDevInfo = iDevInfo; + if( !iCount++ ) + psav->iDevInfoPrim = psav->iDevInfo; + if( psav->CrtOnly ) + psav->iDevInfo = CRT_ACTIVE; + if( psav->TvOn ) + psav->iDevInfo = TV_ACTIVE; + + /* Establish the refresh rate for this mode. */ + SavageClearVM86Regs( psav->pInt10 ); psav->pInt10->ax = 0x4f14; /* S3 extensions */ psav->pInt10->bx = 0x0001; /* Set default refresh rate */ psav->pInt10->cx = n; - psav->pInt10->di = Refresh; + psav->pInt10->di = Refresh & 0xffff; xf86ExecX86int10( psav->pInt10 ); + /* Set TV type if TV is on. */ + if( psav->TvOn ) { + SavageClearVM86Regs( psav->pInt10 ); + psav->pInt10->ax = 0x4f14; /* S3 extensions */ + psav->pInt10->bx = 0x0007; /* TV extensions */ + psav->pInt10->cx = psav->PAL ? 0x08 : 0x04; + psav->pInt10->dx = 0x0c; + xf86ExecX86int10( psav->pInt10 ); + } + + /* Manipulate output device set. */ + if( psav->iDevInfo != iDevInfo ) { + SavageClearVM86Regs( psav->pInt10 ); + psav->pInt10->ax = 0x4f14; /* S3 extensions */ + psav->pInt10->bx = 0x0003; /* set active devices */ + psav->pInt10->cx = psav->PAL ? 0x08 : 0x04; + xf86ExecX86int10( psav->pInt10 ); + + /* Re-fetch actual device set. */ + psav->iDevInfo = SavageGetDevice( psav ); + iDevInfo = psav->iDevInfo; + psav->CrtOnly = (iDevInfo == 1); + psav->TvOn = !!(iDevInfo & 4); + } + /* Now, make this mode current. */ if( xf86LoaderCheckSymbol( "VBESetVBEMode" ) ) @@ -73,6 +123,20 @@ } +/* Function to get supported device list. */ + +static int SavageGetDevice( SavagePtr psav ) +{ + SavageClearVM86Regs( psav->pInt10 ); + psav->pInt10->ax = 0x4f14; /* S3 extensions */ + psav->pInt10->bx = 0x0103; /* get active devices */ + + xf86ExecX86int10( psav->pInt10 ); + + return ((psav->pInt10->cx) & 0xf); +} + + void SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ) { @@ -128,6 +192,11 @@ vbe = (vbeControllerInfoPtr) psav->pVbe->memory; vbeLinear = xf86Int10AllocPages( psav->pInt10, 1, &vbeReal ); + if( !vbeLinear ) + { + ErrorF( "Cannot allocate scratch page in real mode memory." ); + return 0; + } vmib = (struct vbe_mode_info_block *) vbeLinear; for ( Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h:1.2 Mon Dec 4 17:41:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h Tue May 14 16:19:52 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v 1.2 2000/12/04 22:41:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v 1.3 2002/05/14 20:19:52 alanh Exp $ */ /* This file was originally part of the Linux Real-Mode Interface, or LRMI. Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.7 Wed Nov 21 17:43:01 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c Sat Jan 11 22:55:49 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.7 2001/11/21 22:43:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.11 2003/01/12 03:55:49 tsi Exp $ */ #include "Xv.h" #include "dix.h" @@ -78,6 +78,9 @@ short drw_w, short drw_h ) = NULL; +static void OverlayParamInit(ScrnInfoPtr pScrn); +static void InitStreamsForExpansion(SavagePtr psav); + /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/ #define XVTRACE 4 @@ -136,7 +139,7 @@ XVIMAGE_YV12, XVIMAGE_I420, { - FOURCC_RV16, + FOURCC_RV15, XvRGB, LSBFirst, {'R','V','1','5', @@ -153,7 +156,7 @@ XvTopToBottom }, { - FOURCC_RV15, + FOURCC_RV16, XvRGB, LSBFirst, {'R','V','1','6', @@ -226,6 +229,13 @@ /* CR67[3] = 1 : Mem-mapped regs */ #define USE_MM_FOR_PRI_STREAM 0x08 +#define HDM_SHIFT 16 +#define HDSCALE_4 (2 << HDM_SHIFT) +#define HDSCALE_8 (3 << HDM_SHIFT) +#define HDSCALE_16 (4 << HDM_SHIFT) +#define HDSCALE_32 (5 << HDM_SHIFT) +#define HDSCALE_64 (6 << HDM_SHIFT) + /* Old Streams */ #define ENABLE_STREAMS_OLD 0x0c @@ -264,6 +274,7 @@ #define PSTREAM_WINDOW_SIZE_REG 0x81F4 #define SSTREAM_WINDOW_START_REG 0x81F8 #define SSTREAM_WINDOW_SIZE_REG 0x81FC +#define FIFO_CONTROL 0x8200 #define PSTREAM_FBSIZE_REG 0x8300 #define SSTREAM_FBSIZE_REG 0x8304 #define SSTREAM_FBADDR2_REG 0x8308 @@ -363,6 +374,14 @@ xf86ErrorFVerb(XVTRACE, "SavageInitStreams\n" ); + if( + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && + !psav->CrtOnly && + !psav->TvOn + ) { + OverlayParamInit( pScrn ); + } + /* Primary stream reflects the frame buffer. */ jDelta = pScrn->displayWidth * pScrn->bitsPerPixel / 8; @@ -394,20 +413,14 @@ void SavageStreamsOn(ScrnInfoPtr pScrn, int id) { SavagePtr psav = SAVPTR(pScrn); - vgaHWPtr hwp; unsigned char jStreamsControl; - unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; + unsigned short vgaCRIndex = psav->vgaIOBase + 4; + unsigned short vgaCRReg = psav->vgaIOBase + 5; xf86ErrorFVerb(XVTRACE, "SavageStreamsOn\n" ); /* Sequence stolen from streams.c in M7 NT driver */ - hwp = VGAHWPTR(pScrn); - - vgaHWGetIOBase(hwp); - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; xf86EnableIO(); @@ -419,7 +432,7 @@ VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); - if( (psav->Chipset == S3_SAVAGE_MX) || + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || (psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000) ) { @@ -427,7 +440,7 @@ /* Wait for VBLANK. */ - VerticalRetraceWait(); + VerticalRetraceWait(psav); /* Fire up streams! */ @@ -448,7 +461,7 @@ /* Wait for VBLANK. */ - VerticalRetraceWait(); + VerticalRetraceWait(psav); /* Fire up streams! */ @@ -459,7 +472,7 @@ /* Wait for VBLANK. */ - VerticalRetraceWait(); + VerticalRetraceWait(psav); /* Turn on secondary stream TV flicker filter, once we support TV. */ @@ -473,19 +486,12 @@ void SavageStreamsOff(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); - vgaHWPtr hwp; unsigned char jStreamsControl; - unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; + unsigned short vgaCRIndex = psav->vgaIOBase + 4; + unsigned short vgaCRReg = psav->vgaIOBase + 5; xf86ErrorFVerb(XVTRACE, "SavageStreamsOff\n" ); - hwp = VGAHWPTR(pScrn); - - vgaHWGetIOBase(hwp); - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; - xf86EnableIO(); /* Unlock extended registers. */ @@ -495,7 +501,7 @@ VGAOUT16(0x3c4, 0x0608); VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); - if( (psav->Chipset == S3_SAVAGE_MX) || + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || (psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000) ) jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS; @@ -504,7 +510,7 @@ /* Wait for VBLANK. */ - VerticalRetraceWait(); + VerticalRetraceWait(psav); /* Kill streams. */ @@ -528,8 +534,8 @@ xf86ErrorFVerb(XVTRACE,"SavageInitVideo\n"); if( - (psav->Chipset == S3_SAVAGE_MX) || - (psav->Chipset == S3_SUPERSAVAGE) || + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || + (psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000) ) { @@ -846,6 +852,15 @@ pPriv->brightness = 0; pPriv->contrast = 128; pPriv->saturation = 128; +#if 0 + /* + * The S3 driver has these values for some of the chips. I have yet + * to find any Savage where these make sense. + */ + pPriv->brightness = 64; + pPriv->contrast = 16; + pPriv->saturation = 128; +#endif pPriv->hue = 0; pPriv->lastKnownPitch = 0; @@ -854,10 +869,10 @@ psav->adaptor = adapt; - #if 0 +#if 0 psav->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = SavageBlockHandler; - #endif +#endif return adapt; } @@ -1002,36 +1017,41 @@ pointer data ){ SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; - /*SavagePtr psav = SAVPTR(pScrn);*/ + SavagePtr psav = SAVPTR(pScrn); if(attribute == xvColorKey) { pPriv->colorKey = value; - SavageSetColorKey( pScrn ); + if( psav->videoFlags & VF_STREAMS_ON) + SavageSetColorKey( pScrn ); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); } else if( attribute == xvBrightness) { if((value < -128) || (value > 127)) return BadValue; pPriv->brightness = value; - SavageSetColor( pScrn ); + if( psav->videoFlags & VF_STREAMS_ON) + SavageSetColor( pScrn ); } else if( attribute == xvContrast) { if((value < 0) || (value > 255)) return BadValue; pPriv->contrast = value; - SavageSetColor( pScrn ); + if( psav->videoFlags & VF_STREAMS_ON) + SavageSetColor( pScrn ); } else if( attribute == xvSaturation) { if((value < 0) || (value > 255)) return BadValue; pPriv->saturation = value; - SavageSetColor( pScrn ); + if( psav->videoFlags & VF_STREAMS_ON) + SavageSetColor( pScrn ); } else if( attribute == xvHue) { if((value < -180) || (value > 180)) return BadValue; pPriv->hue = value; - SavageSetColor( pScrn ); + if( psav->videoFlags & VF_STREAMS_ON) + SavageSetColor( pScrn ); } else return BadMatch; @@ -1163,6 +1183,7 @@ pScreen = screenInfo.screens[pScrn->scrnIndex]; + xf86PurgeUnlockedOffscreenAreas(pScreen); new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, numlines, 0, NULL, NULL, NULL); @@ -1200,6 +1221,7 @@ SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; /*DisplayModePtr mode = pScrn->currentMode;*/ int vgaCRIndex, vgaCRReg, vgaIOBase; + unsigned int ssControl; vgaIOBase = hwp->IOBase; @@ -1222,22 +1244,45 @@ /* Calculate horizontal scale factor. */ - OUTREG(SSTREAM_STRETCH_REG, 32768 * src_w / drw_w ); + OUTREG(SSTREAM_STRETCH_REG, (src_w << 15) / drw_w ); /* Calculate vertical scale factor. */ OUTREG(SSTREAM_LINES_REG, src_h ); OUTREG(SSTREAM_VINITIAL_REG, 0 ); - OUTREG(SSTREAM_VSCALE_REG, 32768 * src_h / drw_h ); + OUTREG(SSTREAM_VSCALE_REG, (src_h << 15) / drw_h ); /* Set surface location and stride. */ OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & 0x3ffff0 ); + OUTREG(SSTREAM_FBADDR1_REG, 0 ); + OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff ); OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(dstBox->x1, dstBox->y1) ); OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(drw_w, drw_h) ); + ssControl = 0; + + if( src_w > (drw_w << 1) ) + { + /* BUGBUG shouldn't this be >=? */ + if( src_w <= (drw_w << 2) ) + ssControl |= HDSCALE_4; + else if( src_w > (drw_w << 3) ) + ssControl |= HDSCALE_8; + else if( src_w > (drw_w << 4) ) + ssControl |= HDSCALE_16; + else if( src_w > (drw_w << 5) ) + ssControl |= HDSCALE_32; + else if( src_w > (drw_w << 6) ) + ssControl |= HDSCALE_64; + } + + ssControl |= src_w; + ssControl |= (1 << 24); + OUTREG(SSTREAM_CONTROL_REG, ssControl); + /* Set color key on primary. */ SavageSetColorKey( pScrn ); @@ -1308,6 +1353,19 @@ } else { + if( + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && + !psav->CrtOnly && + !psav->TvOn + ) { + drw_w = (float)(drw_w * psav->XExp1)/(float)psav->XExp2 + 1; + drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2 + 1; + dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2; + dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2; + dstBox->x1 += psav->displayXoffset; + dstBox->y1 += psav->displayYoffset; + } + OUTREG(SEC_STREAM_HSCALING, ((src_w&0xfff)<<20) | ((65536 * src_w / drw_w) & 0x1FFFF )); /* BUGBUG need to add 00040000 if src stride > 2048 */ @@ -1383,6 +1441,11 @@ SavageClipVideo(&dstBox, &x1, &x2, &y1, &y2, REGION_EXTENTS(pScreen, clipBoxes), width, height); + drw_w = dstBox.x2 - dstBox.x1; + drw_h = dstBox.y2 - dstBox.y1; + src_w = ( x2 - x1 ) >> 16; + src_h = ( y2 - y1 ) >> 16; + if((x1 >= x2) || (y1 >= y2)) return Success; @@ -1740,10 +1803,16 @@ SavageInitOffscreenImages(ScreenPtr pScreen) { XF86OffscreenImagePtr offscreenImages; + SavagePtr psav = SAVPTR(xf86Screens[pScreen->myNum]); /* need to free this someplace */ - if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) - return; + if (!psav->offscreenImages) { + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + psav->offscreenImages = offscreenImages; + } else { + offscreenImages = psav->offscreenImages; + } offscreenImages[0].image = &Images[0]; offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | @@ -1761,5 +1830,153 @@ xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); } + +/* Function to get lcd factor, display offset for overlay use + * Input: pScrn; Output: x,yfactor, displayoffset in pScrn + */ +static void OverlayParamInit(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + + psav = SAVPTR(pScrn); + psav->cxScreen = psav->iResX; + InitStreamsForExpansion(psav); +} + +/* Function to calculate lcd expansion x,yfactor and offset for overlay + */ +static void InitStreamsForExpansion(SavagePtr psav) +{ + int PanelSizeX,PanelSizeY; + int ViewPortWidth,ViewPortHeight; + int XFactor, YFactor; + + PanelSizeX = psav->PanelX; + PanelSizeY = psav->PanelY; + ViewPortWidth = psav->iResX; + ViewPortHeight = psav->iResY; + if( PanelSizeX == 1408 ) + PanelSizeX = 1400; + psav->XExpansion = 0x00010001; + psav->YExpansion = 0x00010001; + psav->displayXoffset = 0; + psav->displayYoffset = 0; + + VGAOUT8(0x3C4, HZEXP_FACTOR_IGA1); + XFactor = VGAIN8(0x3C5) >> 4; + VGAOUT8(0x3C4, VTEXP_FACTOR_IGA1); + YFactor = VGAIN8(0x3C5) >> 4; + + switch( XFactor ) + { + case 1: + psav->XExpansion = 0x00010001; + psav->displayXoffset = + (((PanelSizeX - ViewPortWidth) / 2) + 0x7) & 0xFFF8; + break; + + case 3: + psav->XExpansion = 0x00090008; + psav->displayXoffset = + (((PanelSizeX - ((9 * ViewPortWidth)/8)) / 2) + 0x7) & 0xFFF8; + break; + + case 4: + psav->XExpansion = 0x00050004; + + if ((psav->cxScreen == 800) && (PanelSizeX !=1400)) + { + psav->displayXoffset = + (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) ) & 0xFFF8; + } + else + { + psav->displayXoffset = + (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) +0x7) & 0xFFF8; + } + break; + + case 6: + psav->XExpansion = 0x00030002; + psav->displayXoffset = + (((PanelSizeX - ((3 * ViewPortWidth)/2)) / 2) + 0x7) & 0xFFF8; + break; + + case 7: + psav->XExpansion = 0x00020001; + psav->displayXoffset = + (((PanelSizeX - (2 * ViewPortWidth)) / 2) + 0x7) & 0xFFF8; + break; + } + + switch( YFactor ) + { + case 0: + psav->YExpansion = 0x00010001; + psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2; + break; + case 1: + psav->YExpansion = 0x00010001; + psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2; + break; + case 2: + psav->YExpansion = 0x00040003; + psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2; + break; + case 4: + psav->YExpansion = 0x00050004; + psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2; + break; + case 5: + psav->YExpansion = 0x00040003; + + if((psav->cxScreen == 1024)&&(PanelSizeX ==1400)) + { + psav->displayYoffset = + ((PanelSizeY - ((4 * ViewPortHeight)/3)) / 2) - 0x1 ; + } + else + { + psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2; + } + break; + case 6: + psav->YExpansion = 0x00050004; + psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2; + break; + case 7: + psav->YExpansion = 0x00030002; + psav->displayYoffset = (PanelSizeY - ((3 * ViewPortHeight)/2)) / 2; + break; + case 8: + psav->YExpansion = 0x00020001; + psav->displayYoffset = (PanelSizeY - (2 * ViewPortHeight)) /2; + break; + case 9: + psav->YExpansion = 0x00090004; + psav->displayYoffset = (PanelSizeY - ((9 * ViewPortHeight)/4)) /2; + break; + case 11: + psav->YExpansion = 0x00110005; + psav->displayYoffset = (PanelSizeY - ((11 * ViewPortHeight)/5)) /2; + break; + case 12: + psav->YExpansion = 0x00070003; + psav->displayYoffset = (PanelSizeY - ((7 * ViewPortHeight)/3)) /2; + break; + case 14: + psav->YExpansion = 0x00050002; + psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/2)) /2; + break; + case 15: + psav->YExpansion = 0x00040001; + psav->displayYoffset = (PanelSizeY - (4 * ViewPortHeight)) /2; + break; + } + psav->XExp1 = psav->XExpansion >> 16; + psav->XExp2 = psav->XExpansion & 0xFFFF; + psav->YExp1 = psav->YExpansion >> 16; + psav->YExp2 = psav->YExpansion & 0xFFFF; +} /* InitStreamsForExpansionPM */ -#endif /* !XvExtension */ +#endif /* XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile:1.2 Tue Jan 23 19:06:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile Mon Feb 17 12:06:44 2003 @@ -1,5 +1,5 @@ XCOMM Header: //Mercury/Projects/archives/XFree86/4.0/Imakefile.-arc 1.4 02 Aug 2000 13:17:16 Frido $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile,v 1.2 2001/01/24 00:06:27 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile,v 1.3 2003/02/17 17:06:44 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -23,7 +23,7 @@ -I$(SERVERSRC)/Xext -I$(XF86SRC)/int10 \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) -I$(SERVERSRC)/fb \ - -I$(SERVERSRC)/render -I$(XF86OSSRC)/vbe + -I$(SERVERSRC)/render -I$(XF86SRC)/vbe #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h:1.1 Tue Nov 28 15:59:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h Fri Jan 25 16:56:09 2002 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and SIlicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.1 2000/11/28 20:59:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.2 2002/01/25 21:56:09 tsi Exp $ */ #ifndef _REGSMI_H #define _REGSMI_H @@ -57,8 +57,8 @@ } else { - outb(indexPort, index); - return(inb(dataPort)); + outb(pSmi->PIOBase + indexPort, index); + return(inb(pSmi->PIOBase + dataPort)); } } @@ -72,8 +72,8 @@ } else { - outb(indexPort, index); - outb(dataPort, data); + outb(pSmi->PIOBase + indexPort, index); + outb(pSmi->PIOBase + dataPort, data); } } @@ -86,7 +86,7 @@ } else { - return(inb(port)); + return(inb(pSmi->PIOBase + port)); } } @@ -99,7 +99,7 @@ } else { - outb(port, data); + outb(pSmi->PIOBase + port, data); } } Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.8 Thu Dec 20 16:35:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h Sat Jan 11 22:55:49 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.8 2001/12/20 21:35:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.12 2003/01/12 03:55:49 tsi Exp $ */ #ifndef _SMI_H #define _SMI_H @@ -65,8 +65,8 @@ #include "vbe.h" #ifdef XvExtension - #include "xf86xv.h" - #include "Xv.h" +# include "xf86xv.h" +# include "Xv.h" #endif /******************************************************************************/ @@ -74,7 +74,7 @@ /******************************************************************************/ #ifndef SMI_DEBUG - #define SMI_DEBUG 0 +# define SMI_DEBUG 0 #endif #define SMI_USE_IMAGE_WRITES 0 @@ -88,6 +88,7 @@ /* Driver data structure; this should contain all needed info for a mode */ typedef struct { + Bool modeInit; CARD16 mode; CARD8 SR17, SR18, SR21, SR31, SR32, SR6A, SR6B, SR81, SRA0; CARD8 CR33, CR33_2, CR3A; @@ -149,6 +150,7 @@ CARD8 * DataPortBase; /* Base of data port */ int DataPortSize; /* Size of data port */ CARD8 * IOBase; /* Base of MMIO VGA ports */ + IOADDRESS PIOBase; /* Base of I/O ports */ unsigned char * FBBase; /* Base of FB */ CARD32 FBOffset; /* Current visual FB starting location */ @@ -210,8 +212,7 @@ int lcdHeight; /* LCD height */ I2CBusPtr I2C; /* Pointer into I2C module */ - xf86Int10InfoPtr pInt; /* Pointer to INT10 module */ - vbeInfoPtr pVbe; /* Pointer to VBE module */ + xf86Int10InfoPtr pInt10; /* Pointer to INT10 module */ /* Shadow frame buffer (rotation) */ Bool shadowFB; /* Flag if shadow buffer is @@ -262,20 +263,20 @@ /******************************************************************************/ #if SMI_DEBUG - #define VERBLEV 1 - #define ENTER_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "ENTER\t" PROCNAME \ +# define VERBLEV 1 +# define ENTER_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "ENTER\t" PROCNAME \ "(%d)\n", __LINE__); xf86Break1() - #define DEBUG_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "DEBUG\t" PROCNAME \ +# define DEBUG_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "DEBUG\t" PROCNAME \ "(%d)\n", __LINE__); xf86Break2() - #define LEAVE_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "LEAVE\t" PROCNAME \ +# define LEAVE_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "LEAVE\t" PROCNAME \ "(%d)\n", __LINE__); xf86Break1() - #define DEBUG(arg) xf86ErrorFVerb arg +# define DEBUG(arg) xf86ErrorFVerb arg #else - #define VERBLEV 4 - #define ENTER_PROC(PROCNAME) - #define DEBUG_PROC(PROCNAME) - #define LEAVE_PROC(PROCNAME) - #define DEBUG(arg) +# define VERBLEV 4 +# define ENTER_PROC(PROCNAME) +# define DEBUG_PROC(PROCNAME) +# define LEAVE_PROC(PROCNAME) +# define DEBUG(arg) #endif /* Some Silicon Motion structs & registers */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.6 Thu Dec 20 16:35:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c Sat Jan 11 22:55:49 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.6 2001/12/20 21:35:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.7 2003/01/12 03:55:49 tsi Exp $ */ #include "smi.h" @@ -207,14 +207,14 @@ } else { - #if defined(XvExtension) && SMI_USE_VIDEO +#if defined(XvExtension) && SMI_USE_VIDEO numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp * pSmi->height) * 25 / 100 + pSmi->width * pSmi->Bpp - 1) / (pSmi->width * pSmi->Bpp); numLines += pSmi->height; - #else +#else numLines = maxLines; - #endif +#endif } AvailFBArea.x1 = 0; Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.20 Fri Jan 4 16:22:34 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c Wed Feb 5 12:45:29 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from The XFree86 Project or Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.20 2002/01/04 21:22:34 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.28 2003/02/05 17:45:29 eich Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -60,11 +60,11 @@ static void SMI_Save (ScrnInfoPtr pScrn); static void SMI_WriteMode (ScrnInfoPtr pScrn, vgaRegPtr, SMIRegPtr); static Bool SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, - char **argv); + char **argv); static int SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen); static void SMI_PrintRegs(ScrnInfoPtr); static ModeStatus SMI_ValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); + Bool verbose, int flags); static void SMI_DisableVideo(ScrnInfoPtr pScrn); static void SMI_EnableVideo(ScrnInfoPtr pScrn); static Bool SMI_MapMem(ScrnInfoPtr pScrn); @@ -73,9 +73,9 @@ static Bool SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool SMI_SaveScreen(ScreenPtr pScreen, int mode); static void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, - LOCO *colors, VisualPtr pVisual); + LOCO *colors, VisualPtr pVisual); static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, int flags); + int PowerManagementMode, int flags); static Bool SMI_ddc1(int scrnIndex); static unsigned int SMI_ddc1Read(ScrnInfoPtr pScrn); static void SMI_FreeScreen(int ScrnIndex, int flags); @@ -83,15 +83,14 @@ #define SILICONMOTION_NAME "Silicon Motion" -#define SILICONMOTION_DRIVER_NAME "siliconmotion" +#define SILICONMOTION_DRIVER_NAME "siliconmotion" #define SILICONMOTION_VERSION_NAME "1.3.1" -#define SILICONMOTION_VERSION_MAJOR 1 +#define SILICONMOTION_VERSION_MAJOR 1 #define SILICONMOTION_VERSION_MINOR 3 #define SILICONMOTION_PATCHLEVEL 1 -#define SILICONMOTION_DRIVER_VERSION ( (SILICONMOTION_VERSION_MAJOR << 24) \ - | (SILICONMOTION_VERSION_MINOR << 16) \ - | (SILICONMOTION_PATCHLEVEL) \ - ) +#define SILICONMOTION_DRIVER_VERSION ((SILICONMOTION_VERSION_MAJOR << 24) | \ + (SILICONMOTION_VERSION_MINOR << 16) | \ + (SILICONMOTION_PATCHLEVEL)) /* * This contains the functions needed by the server after loading the @@ -256,6 +255,7 @@ "xf86DestroyI2CDevRec", "xf86I2CBusInit", "xf86I2CDevInit", + "xf86I2CReadBytes", "xf86I2CWriteByte", NULL }; @@ -291,7 +291,6 @@ "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", - "cfb24_32ScreenInit", "cfb32ScreenInit", "cfb16BresS", "cfb24BresS", @@ -518,7 +517,8 @@ int mclk; vgaHWPtr hwp; int vgaCRIndex, vgaCRReg, vgaIOBase; - + vbeInfoPtr pVbe = NULL; + ENTER_PROC("SMI_PreInit"); if (flags & PROBE_DETECT) @@ -764,9 +764,9 @@ pSmi->shadowFB ? "enabled" : "disabled"); } - #if 1 /* PDR#932 */ +#if 1 /* PDR#932 */ if ((pScrn->depth == 8) || (pScrn->depth == 16)) - #endif /* PDR#932 */ +#endif /* PDR#932 */ if ((s = xf86GetOptValString(pSmi->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) @@ -859,17 +859,22 @@ LEAVE_PROC("SMI_PreInit"); return(FALSE); } + + if (xf86LoadSubModule(pScrn,"int10")) { + xf86LoaderReqSymLists(int10Symbols,NULL); + pSmi->pInt10 = xf86InitInt10(pEnt->index); + } - if (xf86LoadSubModule(pScrn, "vbe")) + if (pSmi->pInt10 && xf86LoadSubModule(pScrn, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - pSmi->pVbe = VBEInit(NULL, pEnt->index); + xf86LoaderReqSymLists(vbeSymbols, NULL); + pVbe = VBEInit(pSmi->pInt10, pEnt->index); } pSmi->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResExclusive); -/* xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr);*/ -/* xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr);*/ +/* xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); */ +/* xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); */ /* * Set the Chipset and ChipRev, allowing config file entries to @@ -939,6 +944,7 @@ vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; vgaCRReg = vgaIOBase + VGA_CRTC_DATA_OFFSET; + pSmi->PIOBase = hwp->PIOOffset; xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, " "MMIOBase=%x\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase); @@ -957,9 +963,9 @@ xf86LoaderReqSymLists(ddcSymbols, NULL); #if 1 /* PDR#579 */ - if (pSmi->pVbe) + if (pVbe) { - pMon = vbeDoEDID(pSmi->pVbe, NULL); + pMon = vbeDoEDID(pVbe, NULL); if (pMon != NULL) { if ( (pMon->rawData[0] == 0x00) @@ -981,8 +987,8 @@ } } #else - if ( (pSmi->pVbe) - && ((pMon = xf86PrintEDID(vbeDoEDID(pSmi->pVbe, NULL))) != NULL) + if ( (pVbe) + && ((pMon = xf86PrintEDID(vbeDoEDID(pVbe, NULL))) != NULL) ) { xf86SetDDCproperties(pScrn, pMon); @@ -998,11 +1004,10 @@ } } } - if (pSmi->pVbe) - { - vbeFree(pSmi->pVbe); - pSmi->pVbe = NULL; - } + + vbeFree(pVbe); + xf86FreeInt10(pSmi->pInt10); + pSmi->pInt10 = NULL; /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -1129,15 +1134,14 @@ * Setup the ClockRanges, which describe what clock ranges are available, * and what sort of modes they can be used for. */ - clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges = xnfcalloc(sizeof(ClockRange),1); clockRanges->next = NULL; clockRanges->minClock = pSmi->minClock; clockRanges->maxClock = pSmi->maxClock; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = FALSE; - - + i = xf86ValidateModes( pScrn, /* Screen pointer */ pScrn->monitor->Modes, /* Available monitor modes */ @@ -1509,12 +1513,12 @@ pSmi->ModeStructInit = TRUE; } - if (pSmi->useBIOS && (pSmi->pVbe != NULL)) + if (pSmi->useBIOS && (pSmi->pInt10 != NULL)) { - pSmi->pVbe->pInt10->num = 0x10; - pSmi->pVbe->pInt10->ax = 0x0F00; - xf86ExecX86int10(pSmi->pVbe->pInt10); - save->mode = pSmi->pVbe->pInt10->ax & 0x007F; + pSmi->pInt10->num = 0x10; + pSmi->pInt10->ax = 0x0F00; + xf86ExecX86int10(pSmi->pInt10); + save->mode = pSmi->pInt10->ax & 0x007F; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Current mode 0x%02X.\n", save->mode); } @@ -1554,19 +1558,19 @@ /* Wait for engine to become idle */ WaitIdle(); - if (pSmi->useBIOS && (pSmi->pVbe->pInt10 != NULL) + if (pSmi->useBIOS && (pSmi->pInt10 != NULL) && (restore->mode != 0)) { - pSmi->pVbe->pInt10->num = 0x10; - pSmi->pVbe->pInt10->ax = restore->mode | 0x80; + pSmi->pInt10->num = 0x10; + pSmi->pInt10->ax = restore->mode | 0x80; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%02X\n", restore->mode); - xf86ExecX86int10(pSmi->pVbe->pInt10); + xf86ExecX86int10(pSmi->pInt10); /* Enable linear mode. */ - outb(VGA_SEQ_INDEX, 0x18); - tmp = inb(VGA_SEQ_DATA); - outb(VGA_SEQ_DATA, tmp | 0x01); + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18); + tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA); + outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x01); /* Enable DPR/VPR registers. */ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21); @@ -1662,15 +1666,14 @@ } /* Restore the standard VGA registers */ - if (xf86IsPrimaryPci(pSmi->PciInfo)) - { - vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL); - } - else - { - vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE); - } + if (xf86IsPrimaryPci(pSmi->PciInfo)) { + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_CMAP + | VGA_SR_FONTS); + } + if (restore->modeInit) + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE); + if (!SMI_LYNXM_SERIES(pSmi->Chipset)) { VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33); @@ -1981,12 +1984,13 @@ pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (!pSmi->pInt10) { + pSmi->pInt10 = xf86InitInt10(pEnt->index); + } + /* Save the chip/graphics state */ SMI_Save(pScrn); - if (!pSmi->pVbe) { - pSmi->pVbe = VBEInit(NULL, pEnt->index); - } /* Zero the frame buffer, #258 */ memset(pSmi->FBBase, 0, pSmi->videoRAMBytes); @@ -2336,7 +2340,7 @@ if (!pSmi->useBIOS || pSmi->lcd) { - #if 1 /* PDR#983 */ +#if 1 /* PDR#983 */ if (pSmi->zoomOnLCD) { if ( (mode->HDisplay > pSmi->lcdWidth) @@ -2348,7 +2352,7 @@ } } else - #endif +#endif { if ( (mode->HDisplay != pSmi->lcdWidth) || (mode->VDisplay != pSmi->lcdHeight) @@ -2361,7 +2365,7 @@ } - #if 1 /* PDR#944 */ +#if 1 /* PDR#944 */ if (pSmi->rotate) { if ( (mode->HDisplay != pSmi->lcdWidth) @@ -2372,7 +2376,7 @@ return(MODE_PANEL); } } - #endif +#endif LEAVE_PROC("SMI_ValidMode"); return(MODE_OK); @@ -2400,6 +2404,8 @@ return(FALSE); } + new->modeInit = TRUE; + if (pSmi->rotate) { pSmi->width = pScrn->virtualY; @@ -2412,8 +2418,8 @@ } pSmi->Bpp = pScrn->bitsPerPixel / 8; - outb(VGA_SEQ_INDEX, 0x17); - tmp = inb(VGA_SEQ_DATA); + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x17); + tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA); if (pSmi->pci_burst) { new->SR17 = tmp | 0x20; @@ -2423,17 +2429,17 @@ new->SR17 = tmp & ~0x20; } - outb(VGA_SEQ_INDEX, 0x18); - new->SR18 = inb(VGA_SEQ_DATA) | 0x11; + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18); + new->SR18 = inb(pSmi->PIOBase + VGA_SEQ_DATA) | 0x11; - outb(VGA_SEQ_INDEX, 0x21); - new->SR21 = inb(VGA_SEQ_DATA) & ~0x03; + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21); + new->SR21 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x03; - outb(VGA_SEQ_INDEX, 0x31); - new->SR31 = inb(VGA_SEQ_DATA) & ~0xC0; + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x31); + new->SR31 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0xC0; - outb(VGA_SEQ_INDEX, 0x32); - new->SR32 = inb(VGA_SEQ_DATA) & ~0x07; + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x32); + new->SR32 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x07; if (SMI_LYNXM_SERIES(pSmi->Chipset)) { new->SR32 |= 0x04; @@ -2538,12 +2544,11 @@ new->CR40[i] = PanelTable[panelIndex][modeIndex][i]; } } - - /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ - new->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); - if (pSmi->Chipset == SMI_LYNX3DM) { - switch (pScrn->bitsPerPixel) { + /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ + new->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); + if (pSmi->Chipset == SMI_LYNX3DM) { + switch (pScrn->bitsPerPixel) { case 8: new->CCR66 = (new->CCR66 & 0xF3) | 0x00; /* 6 bits-RAM */ break; @@ -2558,12 +2563,11 @@ default: LEAVE_PROC("SMI_ModeInit"); return(FALSE); - } - } - /* end CZ */ + } + } - outb(VGA_SEQ_INDEX, 0x30); - if (inb(VGA_SEQ_DATA) & 0x01) + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x30); + if (inb(pSmi->PIOBase + VGA_SEQ_DATA) & 0x01) { new->SR21 = 0x00; } @@ -2755,7 +2759,7 @@ vgaRegPtr vgaSavePtr = &hwp->SavedReg; SMIRegPtr SMISavePtr = &pSmi->SavedReg; Bool ret; - + ENTER_PROC("SMI_CloseScreen"); if (pScrn->vtSema) @@ -2777,10 +2781,10 @@ { xfree(pSmi->DGAModes); } - if (pSmi->pVbe != NULL) + if (pSmi->pInt10 != NULL) { - vbeFree(pSmi->pVbe); - pSmi->pVbe = NULL; + xf86FreeInt10(pSmi->pInt10); + pSmi->pInt10 = NULL; } #ifdef XvExtension if (pSmi->ptrAdaptor != NULL) @@ -2854,22 +2858,22 @@ if (SMI_LYNX3D_SERIES(pSmi->Chipset)) { Base = (Base + 15) & ~15; - #if 1 /* PDR#1058 */ +#if 1 /* PDR#1058 */ while ((Base % pSmi->Bpp) > 0) { Base -= 16; } - #endif +#endif } else { Base = (Base + 7) & ~7; - #if 1 /* PDR#1058 */ +#if 1 /* PDR#1058 */ while ((Base % pSmi->Bpp) > 0) { Base -= 8; } - #endif +#endif } WRITE_VPR(pSmi, 0x0C, Base >> 3); @@ -2949,16 +2953,16 @@ vgaHWSetStdFuncs(hwp); /* Enable linear mode */ - outb(VGA_SEQ_INDEX, 0x18); - tmp = inb(VGA_SEQ_DATA); + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18); + tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA); pSmi->SR18Value = tmp; /* PDR#521 */ - outb(VGA_SEQ_DATA, tmp | 0x11); + outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x11); /* Enable 2D/3D Engine and Video Processor */ - outb(VGA_SEQ_INDEX, 0x21); - tmp = inb(VGA_SEQ_DATA); + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21); + tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA); pSmi->SR21Value = tmp; /* PDR#521 */ - outb(VGA_SEQ_DATA, tmp & ~0x03); + outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp & ~0x03); LEAVE_PROC("SMI_EnableMmio"); } @@ -2974,12 +2978,12 @@ vgaHWSetStdFuncs(hwp); /* Disable 2D/3D Engine and Video Processor */ - outb(VGA_SEQ_INDEX, 0x21); - outb(VGA_SEQ_DATA, pSmi->SR21Value); /* PDR#521 */ + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21); + outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR21Value); /* PDR#521 */ /* Disable linear mode */ - outb(VGA_SEQ_INDEX, 0x18); - outb(VGA_SEQ_DATA, pSmi->SR18Value); /* PDR#521 */ + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18); + outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR18Value); /* PDR#521 */ LEAVE_PROC("SMI_DisableMmio"); } @@ -3093,47 +3097,47 @@ return; } - #if 1 /* PDR#735 */ - if (pSmi->pVbe->pInt10 != NULL) +#if 1 /* PDR#735 */ + if (pSmi->pInt10 != NULL) { - pSmi->pVbe->pInt10->ax = 0x4F10; + pSmi->pInt10->ax = 0x4F10; switch (PowerManagementMode) { case DPMSModeOn: - pSmi->pVbe->pInt10->bx = 0x0001; + pSmi->pInt10->bx = 0x0001; break; case DPMSModeStandby: - pSmi->pVbe->pInt10->bx = 0x0101; + pSmi->pInt10->bx = 0x0101; break; case DPMSModeSuspend: - pSmi->pVbe->pInt10->bx = 0x0201; + pSmi->pInt10->bx = 0x0201; break; case DPMSModeOff: - pSmi->pVbe->pInt10->bx = 0x0401; + pSmi->pInt10->bx = 0x0401; break; } - pSmi->pVbe->pInt10->cx = 0x0000; - pSmi->pVbe->pInt10->num = 0x10; - xf86ExecX86int10(pSmi->pVbe->pInt10); - if (pSmi->pVbe->pInt10->ax == 0x004F) + pSmi->pInt10->cx = 0x0000; + pSmi->pInt10->num = 0x10; + xf86ExecX86int10(pSmi->pInt10); + if (pSmi->pInt10->ax == 0x004F) { pSmi->CurrentDPMS = PowerManagementMode; - #if 1 /* PDR#835 */ +#if 1 /* PDR#835 */ if (PowerManagementMode == DPMSModeOn) { SR01 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01, SR01 & ~0x20); } - #endif +#endif LEAVE_PROC("SMI_DisplayPowerManagementSet"); return; } } - #endif +#endif /* Save the current SR registers */ if (pSmi->CurrentDPMS == DPMSModeOn) Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.6 Thu Dec 20 16:35:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c Sat Jan 11 22:55:49 2003 @@ -1,5 +1,4 @@ /* Header: //Mercury/Projects/archives/XFree86/4.0/smi_video.c.-arc 1.14 30 Nov 2000 16:51:40 Frido $ */ - /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved. @@ -33,6 +32,7 @@ - SAA7111 support - supports attributes: XV_ENCODING, XV_BRIGHTNESS, XV_CONTRAST, XV_SATURATION, XV_HUE, XV_COLORKEY, XV_INTERLACED + XV_CAPTURE_BRIGHTNESS can be used to set brightness in the capture device - bug fixes - tries not to use acceleration functions (if USE_XAA = 0) - interlaced video for double vertical resolution @@ -41,7 +41,7 @@ Date: 2.11.2001 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.6 2001/12/20 21:35:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.9 2003/01/12 03:55:49 tsi Exp $ */ #include "smi.h" #include "smi_video.h" @@ -134,7 +134,9 @@ BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h); static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadMask); +#if 0 static void SMI_WaitForSync(ScrnInfoPtr pScrn); +#endif /*static int SMI_SendI2C(ScrnInfoPtr pScrn, CARD8 device, char *devName, SMI_I2CDataPtr i2cData);*/ @@ -169,7 +171,7 @@ static Atom xvColorKey; static Atom xvEncoding; -static Atom xvBrightness, xvContrast, xvSaturation, xvHue; +static Atom xvBrightness,xvCapBrightness, xvContrast, xvSaturation, xvHue; static Atom xvInterlaced; @@ -255,6 +257,7 @@ #define XV_ENCODING_NAME "XV_ENCODING" #define XV_BRIGHTNESS_NAME "XV_BRIGHTNESS" +#define XV_CAPTURE_BRIGHTNESS_NAME "XV_CAPTURE_BRIGHTNESS" #define XV_CONTRAST_NAME "XV_CONTRAST" #define XV_SATURATION_NAME "XV_SATURATION" #define XV_HUE_NAME "XV_HUE" @@ -263,9 +266,10 @@ /* fixed order! */ -static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = { +static XF86AttributeRec SMI_VideoAttributesSAA711x[N_ATTRS] = { {XvSettable | XvGettable, 0, N_ENCODINGS-1, XV_ENCODING_NAME}, {XvSettable | XvGettable, 0, 255, XV_BRIGHTNESS_NAME}, + {XvSettable | XvGettable, 0, 255, XV_CAPTURE_BRIGHTNESS_NAME}, {XvSettable | XvGettable, 0, 127, XV_CONTRAST_NAME}, {XvSettable | XvGettable, 0, 127, XV_SATURATION_NAME}, {XvSettable | XvGettable, -128, 127, XV_HUE_NAME}, @@ -273,6 +277,11 @@ {XvSettable | XvGettable, 0, 1, XV_INTERLACED_NAME}, }; +static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = { + {XvSettable | XvGettable, 0, 255, XV_BRIGHTNESS_NAME}, + {XvSettable | XvGettable, 0x000000, 0xFFFFFF, XV_COLORKEY_NAME}, +}; + /**************************************************************************/ static XF86ImageRec SMI_VideoImages[] = @@ -393,7 +402,7 @@ }; - +#if 0 static I2CByte SAA7110InitData[] = { /* Configuration */ @@ -418,7 +427,7 @@ 0x22, 0x40, 0x2C, 0x03, }; - +#endif static I2CByte SAA7111InitData[] = { @@ -616,7 +625,7 @@ if (numAdaptors != 0) { - DEBUG((VERBLEV, "ScreenInit\n")); + DEBUG((VERBLEV, "ScreenInit %i\n",numAdaptors)); xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors); } @@ -635,6 +644,7 @@ * Video codec controls */ +#if 0 /** * scales value value of attribute i to range min, max */ @@ -644,13 +654,16 @@ return min + (value - SMI_VideoAttributes[i].min_value) * (max - min) / (SMI_VideoAttributes[i].max_value - SMI_VideoAttributes[i].min_value); } - +#endif /** * sets video decoder attributes channel, encoding, brightness, contrast, saturation, hue */ static int SetAttr(ScrnInfoPtr pScrn, int i, int value) { + SMIPtr pSmi = SMIPTR(pScrn); + SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; + if (i < XV_ENCODING || i > XV_HUE) return BadMatch; @@ -658,15 +671,16 @@ value = CLAMP(value, SMI_VideoAttributes[i].min_value, SMI_VideoAttributes[i].max_value); -#if 0 - if (pPPriv->I2CDev == SAA7110) { + if (i == XV_BRIGHTNESS) { + int my_value = (value <= 128? value + 128 : value - 128); + WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (my_value << 24)); + } else if (pPort->I2CDev.SlaveAddr == SAA7110) { return SetAttrSAA7110(pScrn, i, value); } - else if (pPPriv->I2CDev == SAA7111) { -#endif + else if (pPort->I2CDev.SlaveAddr == SAA7111) { return SetAttrSAA7111(pScrn, i, value); -#if 0 } +#if 0 else { return XvBadAlloc; } @@ -729,12 +743,12 @@ } } } - else if (i >= XV_BRIGHTNESS && i <= XV_HUE) { + else if (i >= XV_CAPTURE_BRIGHTNESS && i <= XV_HUE) { int slave_adr = 0; switch (i) { - case XV_BRIGHTNESS: + case XV_CAPTURE_BRIGHTNESS: DEBUG((VERBLEV, "SetAttribute XV_BRIGHTNESS: %d\n", value)); slave_adr = 0x0a; break; @@ -764,8 +778,6 @@ return BadMatch; } - pPort->Attribute[i] = value; - /* debug: show registers */ { I2CByte i2c_bytes[32]; @@ -885,39 +897,41 @@ smiPortPtr->I2CDev.DevName = "SAA 7111A"; smiPortPtr->I2CDev.SlaveAddr = SAA7111; smiPortPtr->I2CDev.pI2CBus = pSmi->I2C; - - if (!xf86I2CDevInit(&(smiPortPtr->I2CDev))) - { - LEAVE_PROC("SMI_SetupVideo"); - return(NULL); - } - DEBUG((VERBLEV, "SAA7111 intialized\n")); - if (!xf86I2CWriteVec(&(smiPortPtr->I2CDev), SAA7111InitData, ENTRIES(SAA7111InitData) / 2)) + + if (xf86I2CDevInit(&(smiPortPtr->I2CDev))) { - LEAVE_PROC("SMI_SetupVideo"); - return(NULL); - } - - REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0); - - pSmi->ptrAdaptor = ptrAdaptor; - pSmi->BlockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = SMI_BlockHandler; - - xvEncoding = MAKE_ATOM(XV_ENCODING_NAME); - xvHue = MAKE_ATOM(XV_HUE_NAME); - xvSaturation = MAKE_ATOM(XV_SATURATION_NAME); - xvBrightness = MAKE_ATOM(XV_BRIGHTNESS_NAME); - xvContrast = MAKE_ATOM(XV_CONTRAST_NAME); - + + if (xf86I2CWriteVec(&(smiPortPtr->I2CDev), SAA7111InitData, + ENTRIES(SAA7111InitData) / 2)) { + xvEncoding = MAKE_ATOM(XV_ENCODING_NAME); + xvHue = MAKE_ATOM(XV_HUE_NAME); + xvSaturation = MAKE_ATOM(XV_SATURATION_NAME); + xvContrast = MAKE_ATOM(XV_CONTRAST_NAME); + + xvInterlaced = MAKE_ATOM(XV_INTERLACED_NAME); + DEBUG((VERBLEV, "SAA7111 intialized\n")); + + } else { + xf86DestroyI2CDevRec(&(smiPortPtr->I2CDev),FALSE); + smiPortPtr->I2CDev.SlaveAddr = 0; + } + } else + smiPortPtr->I2CDev.SlaveAddr = 0; + + REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0); + + pSmi->ptrAdaptor = ptrAdaptor; + pSmi->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = SMI_BlockHandler; + xvColorKey = MAKE_ATOM(XV_COLORKEY_NAME); - xvInterlaced = MAKE_ATOM(XV_INTERLACED_NAME); - - SMI_ResetVideo(pScrn); - - LEAVE_PROC("SMI_SetupVideo"); - return(ptrAdaptor); + xvBrightness = MAKE_ATOM(XV_BRIGHTNESS_NAME); + xvCapBrightness = MAKE_ATOM(XV_CAPTURE_BRIGHTNESS_NAME); + + SMI_ResetVideo(pScrn); + LEAVE_PROC("SMI_SetupVideo"); + return(ptrAdaptor); } @@ -934,6 +948,7 @@ SetAttr(pScrn, XV_ENCODING, 0); /* Encoding = pal-composite-0 */ SetAttr(pScrn, XV_BRIGHTNESS, 128); /* Brightness = 128 (CCIR level) */ + SetAttr(pScrn, XV_CAPTURE_BRIGHTNESS, 128); /* Brightness = 128 (CCIR level) */ SetAttr(pScrn, XV_CONTRAST, 71); /* Contrast = 71 (CCIR level) */ SetAttr(pScrn, XV_SATURATION, 64); /* Color saturation = 64 (CCIR level) */ SetAttr(pScrn, XV_HUE, 0); /* Hue = 0 */ @@ -1253,9 +1268,9 @@ OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) & ~0x04); WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) | 0x00200000); - +#if 0 SMI_WaitForSync(pScrn); - +#endif /* Video Window I Left and Top Boundaries */ WRITE_VPR(pSmi, 0x14, dstBox.x1 + (dstBox.y1 << 16)); /* Video Window I Right and Bottom Boundaries */ @@ -1339,11 +1354,11 @@ if (pPort->videoStatus & CLIENT_VIDEO_ON) { WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008); - #if SMI_USE_CAPTURE +#if SMI_USE_CAPTURE WRITE_CPR(pSmi, 0x00, READ_CPR(pSmi, 0x00) & ~0x00000001); WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) & ~0x00F00000); /* #864 OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04); */ - #endif +#endif } if (pPort->area != NULL) { @@ -1415,6 +1430,9 @@ else if (attribute == xvBrightness) { res = SetAttr(pScrn, XV_BRIGHTNESS, value); } + else if (attribute == xvCapBrightness) { + res = SetAttr(pScrn, XV_CAPTURE_BRIGHTNESS, value); + } else if (attribute == xvContrast) { res = SetAttr(pScrn, XV_CONTRAST, value); } @@ -1444,11 +1462,12 @@ SMI_PortPtr pPort = (SMI_PortPtr) data; ENTER_PROC("SMI_GetPortAttribute"); - if (attribute == xvEncoding) *value = pPort->Attribute[XV_ENCODING]; - else if (attribute == xvBrightness) + else if (attribute == xvBrightness) *value = pPort->Attribute[XV_BRIGHTNESS]; + else if (attribute == xvCapBrightness) + *value = pPort->Attribute[XV_CAPTURE_BRIGHTNESS]; else if (attribute == xvContrast) *value = pPort->Attribute[XV_CONTRAST]; else if (attribute == xvSaturation) @@ -1756,7 +1775,7 @@ ** S U P P O R T F U N C T I O N S ** ** ** \******************************************************************************/ - +#if 0 static void SMI_WaitForSync( ScrnInfoPtr pScrn @@ -1770,6 +1789,7 @@ VerticalRetraceWait(); } +#endif static Bool RegionsEqual( @@ -2007,9 +2027,9 @@ { vstretch = 0; } - +#if 0 SMI_WaitForSync(pScrn); - +#endif WRITE_VPR(pSmi, 0x00, vpr00 | (1 << 3) | (1 << 20)); WRITE_VPR(pSmi, 0x14, (dstBox->x1) | (dstBox->y1 << 16)); WRITE_VPR(pSmi, 0x18, (dstBox->x2) | (dstBox->y2 << 16)); @@ -2083,7 +2103,6 @@ } dev = xf86CreateI2CDevRec(); - ErrorF("zz %x\n",dev); if (dev == NULL) { LEAVE_PROC("SMI_SendI2C"); @@ -2130,6 +2149,7 @@ XF86OffscreenImagePtr offscreenImages; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SMIPtr pSmi = SMIPTR(pScrn); + SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; ENTER_PROC("SMI_InitOffscreenImages"); @@ -2151,9 +2171,14 @@ offscreenImages->setAttribute = SMI_SetSurfaceAttribute; offscreenImages->max_width = pSmi->lcdWidth; offscreenImages->max_height = pSmi->lcdHeight; - offscreenImages->num_attributes = nElems(SMI_VideoAttributes); - offscreenImages->attributes = SMI_VideoAttributes; - + if (!pPort->I2CDev.SlaveAddr) { + offscreenImages->num_attributes = nElems(SMI_VideoAttributes); + offscreenImages->attributes = SMI_VideoAttributes; + } else { + offscreenImages->num_attributes = + nElems(SMI_VideoAttributesSAA711x); + offscreenImages->attributes = SMI_VideoAttributesSAA711x; + } xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); LEAVE_PROC("SMI_InitOffscreenImages"); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.3 Thu Dec 20 16:35:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h Mon Sep 16 14:06:01 2002 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.3 2001/12/20 21:35:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.4 2002/09/16 18:06:01 eich Exp $ */ #ifndef _SMI_VIDEO_H #define _SMI_VIDEO_H @@ -56,15 +56,16 @@ * Attributes */ -#define N_ATTRS 7 +#define N_ATTRS 8 #define XV_ENCODING 0 #define XV_BRIGHTNESS 1 -#define XV_CONTRAST 2 -#define XV_SATURATION 3 -#define XV_HUE 4 -#define XV_COLORKEY 5 -#define XV_INTERLACED 6 +#define XV_CAPTURE_BRIGHTNESS 2 +#define XV_CONTRAST 3 +#define XV_SATURATION 4 +#define XV_HUE 5 +#define XV_COLORKEY 6 +#define XV_INTERLACED 7 typedef struct { Index: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h:1.6 --- /dev/null Thu Feb 27 12:31:36 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,3314 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.6 2003/02/10 01:14:16 tsi Exp $ */ + + +/* Register settings for SiS 300 series */ + + +typedef struct _SiS300_StStruct +{ + UCHAR St_ModeID; + USHORT St_ModeFlag; + UCHAR St_StTableIndex; + UCHAR St_CRT2CRTC; + UCHAR St_ResInfo; + UCHAR VB_StTVFlickerIndex; + UCHAR VB_StTVEdgeIndex; + UCHAR VB_StTVYFilterIndex; +} SiS300_StStruct; + +static const SiS300_StStruct SiS300_SModeIDTable[] = +{ + {0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00}, + {0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00}, + {0x01,0x1010,0x17,0x02,0x02,0x00,0x00,0x00}, + {0x03,0x8208,0x03,0x00,0x00,0x00,0x00,0x00}, + {0x03,0x0210,0x16,0x01,0x01,0x00,0x00,0x00}, + {0x03,0x0010,0x18,0x02,0x02,0x00,0x00,0x00}, + {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x00}, + {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x00}, + {0x07,0x0000,0x07,0x03,0x03,0x00,0x00,0x00}, + {0x07,0x0000,0x19,0x02,0x02,0x00,0x00,0x00}, + {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x00}, + {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x00}, + {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x00}, + {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x00}, + {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x00}, + {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x00}, + {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x00}, + {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x00}, + {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x00}, + {0xff, 0, 0, 0, 0, 0, 0, 0} +}; + +typedef struct _SiS300_StandTableStruct +{ + UCHAR CRT_COLS; + UCHAR ROWS; + UCHAR CHAR_HEIGHT; + USHORT CRT_LEN; + UCHAR SR[4]; + UCHAR MISC; + UCHAR CRTC[0x19]; + UCHAR ATTR[0x14]; + UCHAR GRC[9]; +} SiS300_StandTableStruct; + +static const SiS300_StandTableStruct SiS300_StandTable[] = +{ + {0x28,0x18,0x08,0x0800, /* 0x00 */ + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x08,0x0800, /* 0x01 */ + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x08,0x1000, /* 0x02 */ + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x08,0x1000, /* 0x03 */ + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x08,0x4000, /* 0x04 */ + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} }, + {0x28,0x18,0x08,0x4000, /* 0x05 */ + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} }, + {0x50,0x18,0x08,0x4000, /* 0x06 */ + {0x01,0x01,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, + 0xff}, + {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x01,0x00,0x01,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, + 0xff} }, + {0x50,0x18,0x0e,0x1000, /* 0x07 */ + {0x00,0x03,0x00,0x03}, + 0xa6, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} }, +/* MDA_DAC*/ + {0x00,0x00,0x00,0x0000, /* 0x08 */ + {0x00,0x00,0x00,0x15}, + 0x15, + {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15}, + {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f} }, +/* CGA_DAC*/ + {0x00,0x10,0x04,0x0114, /* 0x09 */ + {0x11,0x09,0x15,0x00}, + 0x10, + {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, + 0x04}, + {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, + 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, + 0x3e,0x2b,0x3b,0x2f}, + {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} }, +/* EGA_DAC*/ + {0x00,0x10,0x04,0x0114, /* 0x0a */ + {0x11,0x05,0x15,0x20}, + 0x30, + {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, + 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, + 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, + 0x06}, + {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, + 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, + 0x1e,0x0b,0x1b,0x0f}, + {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} }, +/* VGA_DAC*/ + {0x00,0x10,0x04,0x0114, /* 0x0b */ + {0x11,0x09,0x15,0x2a}, + 0x3a, + {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, + 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, + 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, + 0x1f}, + {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, + 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, + 0x1c,0x0e,0x11,0x15}, + {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, + 0x04} }, + {0x08,0x0c,0x10,0x0a08, /* 0x0c */ + {0x0c,0x0e,0x10,0x0b}, + 0x0c, + {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, + 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, + 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, + 0x06}, + {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, + 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} }, + {0x28,0x18,0x08,0x2000, /* 0x0d */ + {0x09,0x0f,0x00,0x06}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x50,0x18,0x08,0x4000, /* 0x0e */ + {0x01,0x0f,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x00,0x00,0x00,0x0000, /* 0x0f */ /* TW: Standtable for VGA modes */ + {0x01,0x0f,0x00,0x0e}, + 0x23, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} }, + {0x4a,0x36,0x00,0x00c0, /* 0x10 */ + {0x00,0x00,0x00,0x00}, + 0x00, + {0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x3a, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1a,0x00,0x57,0x39,0x00,0xc0, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} }, + {0x50,0x18,0x0e,0x8000, /* 0x11 */ + {0x01,0x0f,0x00,0x06}, + 0xa2, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, + 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, + 0x0b,0x00,0x05,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, + 0xff} }, + {0x50,0x18,0x0e,0x8000, /* 0x12 */ + {0x01,0x0f,0x00,0x06}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x28,0x18,0x0e,0x0800, /* 0x13 */ + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x0e,0x0800, /* 0x14 */ + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x0e,0x1000, /* 0x15 */ + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x0e,0x1000, /* 0x16 */ + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x10,0x0800, /* 0x17 */ + {0x08,0x03,0x00,0x02}, + 0x67, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x10,0x1000, /* 0x18 */ + {0x00,0x03,0x00,0x02}, + 0x67, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x10,0x1000, /* 0x19 */ + {0x00,0x03,0x00,0x02}, + 0x66, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} }, + {0x50,0x1d,0x10,0xa000, /* 0x1a */ + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x00,0xe7,0x04,0xc3, + 0xff}, + {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, + 0xff} }, + {0x50,0x1d,0x10,0xa000, /* 0x1b */ + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x00,0xe7,0x04,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x28,0x18,0x08,0x2000, /* 0x1c */ + {0x01,0x0f,0x00,0x0e}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x41,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} } +}; + +typedef struct _SiS300_ExtStruct +{ + UCHAR Ext_ModeID; + USHORT Ext_ModeFlag; + USHORT Ext_ModeInfo; + USHORT Ext_Point; + USHORT Ext_VESAID; + UCHAR Ext_VESAMEMSize; + UCHAR Ext_RESINFO; + UCHAR VB_ExtTVFlickerIndex; + UCHAR VB_ExtTVEdgeIndex; + UCHAR VB_ExtTVYFilterIndex; + UCHAR REFindex; +} SiS300_ExtStruct; + +static const SiS300_ExtStruct SiS300_EModeIDTable[] = +{ + {0x6a,0x2212,0x47,0x3563,0x0102,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600x? */ + {0x2e,0x0a1b,0x36,0x3539,0x0101,0x08,0x06,0x00,0x00,0x00,0x08}, + {0x2f,0x021b,0x35,0x3532,0x0100,0x08,0x05,0x00,0x00,0x00,0x10}, /* 640x400x8 */ + {0x30,0x2a1b,0x47,0x3563,0x0103,0x08,0x07,0x00,0x00,0x00,0x00}, + {0x31,0x0a1b,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x8 */ + {0x32,0x2a1b,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x16 */ + {0x34,0x2a1d,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x16 */ + {0x35,0x0a1f,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x32 */ + {0x36,0x2a1f,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x32 */ + {0x37,0x0212,0x58,0x358d,0x0104,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x? */ + {0x38,0x0a1b,0x58,0x358d,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x8 */ + {0x3a,0x0e3b,0x69,0x35be,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ + {0x3c,0x063b,0x7a,0x35d4,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, + {0x3d,0x067d,0x7a,0x35d4,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, + {0x40,0x921c,0x00,0x3516,0x010d,0x08,0x00,0x00,0x00,0x00,0x23}, + {0x41,0x921d,0x00,0x3516,0x010e,0x08,0x00,0x00,0x00,0x00,0x23}, + {0x43,0x0a1c,0x36,0x3539,0x0110,0x08,0x06,0x00,0x00,0x00,0x08}, + {0x44,0x0a1d,0x36,0x3539,0x0111,0x08,0x06,0x00,0x00,0x00,0x08}, + {0x46,0x2a1c,0x47,0x3563,0x0113,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */ + {0x47,0x2a1d,0x47,0x3563,0x0114,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */ + {0x49,0x0a3c,0x58,0x358d,0x0116,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x4a,0x0a3d,0x58,0x358d,0x0117,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x4c,0x0e7c,0x69,0x35be,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x69,0x35be,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x50,0x921b,0x01,0x351d,0x0132,0x08,0x01,0x00,0x00,0x00,0x24}, + {0x51,0xb21b,0x13,0x3524,0x0133,0x08,0x03,0x00,0x00,0x00,0x25}, /* 400x300 */ + {0x52,0x921b,0x24,0x352b,0x0134,0x08,0x04,0x00,0x00,0x00,0x26}, + {0x56,0x921d,0x01,0x351d,0x0135,0x08,0x01,0x00,0x00,0x00,0x24}, + {0x57,0xb21d,0x13,0x3524,0x0136,0x08,0x03,0x00,0x00,0x00,0x25}, /* 400x300 */ + {0x58,0x921d,0x24,0x352b,0x0137,0x08,0x04,0x00,0x00,0x00,0x26}, + {0x59,0x921b,0x00,0x3516,0x0138,0x08,0x00,0x00,0x00,0x00,0x23}, + {0x5c,0x921f,0x24,0x352b,0x0000,0x08,0x04,0x00,0x00,0x00,0x26}, /* TW: inserted 512x384x32 */ + {0x5d,0x021d,0x35,0x3532,0x0139,0x08,0x05,0x00,0x00,0x00,0x10}, /* 640x400x16 */ + {0x5e,0x021f,0x35,0x3532,0x0000,0x08,0x05,0x00,0x00,0x00,0x10}, /* TW: inserted 640x400x32 */ + {0x62,0x0a3f,0x36,0x3539,0x013a,0x08,0x06,0x00,0x00,0x00,0x08}, + {0x63,0x2a3f,0x47,0x3563,0x013b,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */ + {0x64,0x0a7f,0x58,0x358d,0x013c,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x65,0x0eff,0x69,0x35be,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x66,0x06ff,0x7a,0x35d4,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, + {0x68,0x067b,0x8b,0x35ef,0x013f,0x08,0x0b,0x00,0x00,0x00,0x27}, + {0x69,0x06fd,0x8b,0x35ef,0x0140,0x08,0x0b,0x00,0x00,0x00,0x27}, + {0x6b,0x07ff,0x8b,0x35ef,0x0000,0x10,0x0b,0x00,0x00,0x00,0x27}, + {0x6c,0x067b,0x9c,0x35f6,0x0000,0x08,0x11,0x00,0x00,0x00,0x28}, /* TW: 2048x1536x8 - not in BIOS! */ + {0x6d,0x06fd,0x9c,0x35f6,0x0000,0x10,0x11,0x00,0x00,0x00,0x28}, /* TW: 2048x1536x16 - not in BIOS! */ + {0x6e,0x0a3b,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x8 */ + {0x6f,0x0a7d,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x16 */ + /* TW: 16:9 modes copied from 310/325 series - not in ANY BIOS */ + {0x70,0x2a1b,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x8 */ + {0x71,0x0a1b,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x8 */ + {0x74,0x0a1d,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x16 */ + {0x75,0x0e3d,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x16 */ + {0x76,0x2a1f,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x32 */ + {0x77,0x0a3f,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x32 */ + {0x78,0x0eff,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x32 */ + {0x79,0x0e3b,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x16 */ + /* TW: End of new 16:9 modes */ + {0x7b,0x0aff,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x32 */ + {0x20,0x0a1b,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, /* 1024x600 */ + {0x21,0x0a3d,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, + {0x22,0x0a7f,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, + {0x23,0x0a1b,0xc5,0x0000,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, /* 1152x768 */ + {0x24,0x0a3d,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, + {0x25,0x0a7f,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, + {0x29,0x0e1b,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, /* TW: NEW 1152x864 - not in BIOS */ + {0x2a,0x0e3d,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, + {0x2b,0x0e7f,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, + {0x39,0x2a1b,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, /* TW: NEW 848x480 - not in BIOS */ + {0x3b,0x2a3d,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, + {0x3e,0x2a7f,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, + {0x3f,0x2a1b,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, /* TW: NEW 856x480 - not in BIOS */ + {0x42,0x2a3d,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, + {0x45,0x2a7f,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, + {0x48,0x223b,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, /* TW: NEW 1360x768 - not in BIOS */ + {0x4b,0x227d,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, + {0x4e,0x22ff,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, + {0xff,0x0000,0x00,0x0000,0xffff,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS300_Ext2Struct +{ + USHORT Ext_InfoFlag; + UCHAR Ext_CRT1CRTC; /* TW: Index in SiS300_CRT1Table */ + UCHAR Ext_CRTVCLK; /* TW: Index in VCLK array */ + UCHAR Ext_CRT2CRTC; /* TW: Index in LCD Paneltype arrays (&3f) */ + UCHAR ModeID; + USHORT XRes; + USHORT YRes; + USHORT ROM_OFFSET; +} SiS300_Ext2Struct; + +static const SiS300_Ext2Struct SiS300_RefIndex[] = +{ /* TW: Don't ever insert anything here, table is indexed */ + {0x085f,0x0d,0x03,0x05,0x6a, 800, 600,0x3563}, /* 00 */ + {0x0467,0x0e,0x44,0x05,0x6a, 800, 600,0x3568}, /* 01 */ + {0x0067,0x0f,0x07,0x48,0x6a, 800, 600,0x356d}, /* 02 - CRT1CRTC was 0x4f */ + {0x0067,0x10,0x06,0x8b,0x6a, 800, 600,0x3572}, /* 03 */ + {0x0147,0x11,0x08,0x00,0x6a, 800, 600,0x3577}, /* 04 */ + {0x0147,0x12,0x0c,0x00,0x6a, 800, 600,0x357c}, /* 05 */ + {0x0047,0x11,0x4e,0x00,0x6a, 800, 600,0x3581}, /* 06 - CRT1CRTC was 0x51 */ + {0x0047,0x11,0x13,0x00,0x6a, 800, 600,0x3586}, /* 07 */ + {0xc85f,0x05,0x00,0x04,0x2e, 640, 480,0x3539}, /* 08 */ + {0xc067,0x06,0x02,0x04,0x2e, 640, 480,0x353e}, /* 09 */ + {0xc067,0x07,0x02,0x47,0x2e, 640, 480,0x3543}, /* 0a */ + {0xc067,0x08,0x03,0x8a,0x2e, 640, 480,0x3548}, /* 0b */ + {0xc047,0x09,0x05,0x00,0x2e, 640, 480,0x354d}, /* 0c */ + {0xc047,0x0a,0x08,0x00,0x2e, 640, 480,0x3552}, /* 0d */ + {0xc047,0x0b,0x0a,0x00,0x2e, 640, 480,0x3557}, /* 0e */ + {0xc047,0x0c,0x10,0x00,0x2e, 640, 480,0x355c}, /* 0f */ + {0x487f,0x04,0x00,0x00,0x2f, 640, 400,0x3532}, /* 10 */ + {0xc00f,0x31,0x01,0x06,0x31, 720, 480,0x3630}, /* 11 */ + {0x000f,0x32,0x03,0x06,0x32, 720, 576,0x3637}, /* 12 */ + {0x0187,0x15,0x05,0x00,0x37,1024, 768,0x358d}, /* 13 */ + {0xc877,0x16,0x09,0x06,0x37,1024, 768,0x3592}, /* 14 */ + {0xc067,0x17,0x0b,0x49,0x37,1024, 768,0x3597}, /* 15 - CRT1CRTC was 0x97 */ + {0x0267,0x18,0x0d,0x00,0x37,1024, 768,0x359c}, /* 16 */ + {0x0047,0x19,0x11,0x8c,0x37,1024, 768,0x35a1}, /* 17 - CRT1CRTC was 0x59 */ + {0x0047,0x1a,0x52,0x00,0x37,1024, 768,0x35a6}, /* 18 */ + {0x0047,0x1b,0x16,0x00,0x37,1024, 768,0x35ab}, /* 19 - CRT1CRTC was 0x5b */ + {0x0387,0x1c,0x4d,0x00,0x3a,1280,1024,0x35be}, /* 1a - CRT1CRTC was 0x5c */ + {0x0077,0x1d,0x14,0x07,0x3a,1280,1024,0x35c3}, /* 1b */ + {0x0047,0x1e,0x17,0x00,0x3a,1280,1024,0x35c8}, /* 1c */ + {0x0007,0x1f,0x98,0x00,0x3a,1280,1024,0x35cd}, /* 1d */ + {0x0007,0x20,0x59,0x00,0x3c,1600,1200,0x35d4}, /* 1e - CRT1CRTC was 0x60 */ + {0x0007,0x21,0x5a,0x00,0x3c,1600,1200,0x35d9}, /* 1f */ + {0x0007,0x22,0x1b,0x00,0x3c,1600,1200,0x35de}, /* 20 */ + {0x0007,0x23,0x1d,0x00,0x3c,1600,1200,0x35e3}, /* 21 - CRT1CRTC was 0x63 */ + {0x0007,0x24,0x1e,0x00,0x3c,1600,1200,0x35e8}, /* 22 */ + {0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3516}, /* 23 */ + {0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x351d}, /* 24 */ + {0x0077,0x02,0x04,0x05,0x51, 400, 300,0x3524}, /* 25 */ + {0xc877,0x03,0x09,0x06,0x52, 512, 384,0x352b}, /* 26 */ /* was c077 */ + {0x8207,0x25,0x1f,0x00,0x68,1920,1440,0x35ef}, /* 27 */ + {0x0007,0x26,0x20,0x00,0x6c,2048,1536,0x35f6}, /* 28 */ + {0x0027,0x27,0x14,0x08,0x6e,1280, 960,0x35b7}, /* 29 - TW: 1280x960-60 */ + {0x0047,0x45,0x3c,0x08,0x6e,1280, 960,0x35b7}, /* 2a - TW: 1280x960-85 */ + {0xc077,0x33,0x09,0x06,0x20,1024, 600,0x0000}, /* 2b */ + {0xc077,0x34,0x0b,0x06,0x23,1152, 768,0x0000}, /* 2c */ /* VCLK 0x09 */ + {0x0057,0x35,0x27,0x08,0x70, 800, 480,0x3b52}, /* 2d - TW: 16:9 modes */ + {0x0047,0x36,0x37,0x08,0x70, 800, 480,0x3b57}, /* 2e */ + {0x0047,0x37,0x08,0x08,0x70, 800, 480,0x3b5c}, /* 2f */ + {0x0057,0x38,0x09,0x09,0x71,1024, 576,0x3b63}, /* 30 */ + {0x0047,0x39,0x38,0x09,0x71,1024, 576,0x3b68}, /* 31 */ + {0x0047,0x3a,0x11,0x09,0x71,1024, 576,0x3b6d}, /* 32 */ + {0x0057,0x3b,0x39,0x0a,0x75,1280, 720,0x3b74}, /* 33 */ + {0x0047,0x3c,0x3a,0x0a,0x75,1280, 720,0x3b79}, /* 34 */ + {0x0047,0x3d,0x3b,0x0a,0x75,1280, 720,0x3b7e}, /* 35 - TW: END of 16:9 modes */ + {0x0047,0x3e,0x34,0x06,0x29,1152, 864,0x0000}, /* 36 TW: 1152x864-75Hz - Non-BIOS, new */ + {0x0047,0x44,0x3a,0x06,0x29,1152, 864,0x0000}, /* 37 TW: 1152x864-85Hz - Non-BIOS, new */ + {0x00c7,0x3f,0x28,0x00,0x39, 848, 480,0x0000}, /* 38 TW: 848x480-38Hzi - Non-BIOS, new */ + {0xc047,0x40,0x3d,0x00,0x39, 848, 480,0x0000}, /* 39 TW: 848x480-60Hz - Non-BIOS, new */ + {0x00c7,0x41,0x28,0x00,0x3f, 856, 480,0x0000}, /* 3a TW: 856x480-38Hzi - Non-BIOS, new */ + {0xc047,0x42,0x28,0x00,0x3f, 856, 480,0x0000}, /* 3b TW: 856x480-60Hz - Non-BIOS, new */ + {0x0047,0x43,0x3e,0x00,0x48,1360, 768,0x0000}, /* 3c TW: 1360x768-60Hz - Non-BIOS, new */ + {0xffff,0,0,0,0,0,0,0} +}; + +/*add for 300 oem util*/ +typedef struct _SiS_VBModeIDTableStruct +{ + UCHAR ModeID; + UCHAR VB_TVDelayIndex; + UCHAR VB_TVFlickerIndex; + UCHAR VB_TVPhaseIndex; + UCHAR VB_TVYFilterIndex; + UCHAR VB_LCDDelayIndex; + UCHAR _VB_LCDHIndex; + UCHAR _VB_LCDVIndex; +}SiS_VBModeIDTableStruct; + +static const SiS_VBModeIDTableStruct SiS300_VBModeIDTable[] = +{ + {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, + {0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x02}, + {0x03,0x00,0x00,0x00,0x02,0x00,0x02,0x00}, + {0x03,0x00,0x00,0x00,0x02,0x00,0x02,0x01}, + {0x03,0x00,0x00,0x00,0x03,0x00,0x03,0x02}, + {0x05,0x00,0x00,0x01,0x04,0x00,0x00,0x00}, + {0x06,0x00,0x00,0x01,0x05,0x00,0x02,0x00}, + {0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x01}, + {0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x02}, + {0x0d,0x00,0x00,0x01,0x04,0x00,0x00,0x00}, + {0x0e,0x00,0x00,0x01,0x05,0x00,0x02,0x00}, + {0x0f,0x00,0x00,0x01,0x05,0x00,0x02,0x01}, + {0x10,0x00,0x00,0x01,0x05,0x00,0x02,0x01}, + {0x11,0x00,0x00,0x01,0x05,0x00,0x02,0x03}, + {0x12,0x00,0x00,0x01,0x05,0x00,0x02,0x03}, + {0x13,0x00,0x00,0x01,0x04,0x00,0x04,0x00}, + {0x6a,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x2e,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x2f,0x00,0x00,0x01,0x05,0x00,0x06,0x06}, + {0x30,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x31,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x32,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x37,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x38,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x3a,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x40,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, + {0x41,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, + {0x43,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x44,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x46,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x47,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x49,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x4a,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x4c,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x4d,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x50,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, + {0x51,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, + {0x52,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, + {0x56,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, + {0x57,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, + {0x58,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, + {0x59,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, + {0x5d,0x00,0x00,0x01,0x07,0x00,0x06,0x06}, + {0x62,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x63,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x64,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x65,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x6e,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x6f,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x7b,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00} /* TW: added! */ +}; +/*end*/ + +typedef struct _SiS300_CRT1TableStruct +{ + UCHAR CR[17]; +} SiS300_CRT1TableStruct; + +static const SiS300_CRT1TableStruct SiS300_CRT1Table[] = +{ + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x00 */ + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, + {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, + 0x01}}, + {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01}}, + {{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, +#if 0 + {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, /* 0x05 */ + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, +#endif + {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */ + 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, + 0x00}}, +#if 0 + {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, /* 0x06 */ + 0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01, + 0x00}}, +#endif + {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* 0x06 - corrected 640x480-72 */ + 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f, + 0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01, + 0x00}}, + {{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, + 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, + 0x00}}, +#if 0 + {{0x66,0x4f,0x4f,0x86,0x56,0x9e,0x03,0x3e, /* 0x09 */ + 0xe4,0x87,0xdf,0xdf,0x04,0x00,0x00,0x01, + 0x00}}, +#endif + {{0x67,0x4f,0x4f,0x8b,0x57,0x83,0x10,0x3e, /* 0x09 - corrected 640x480-100 */ + 0xe7,0x8d,0xdf,0xe6,0x11,0x00,0x00,0x05, + 0x00}}, +#if 0 + {{0x6c,0x4f,0x4f,0x83,0x59,0x9e,0x00,0x3e, /* 0x0a */ + 0xe5,0x8d,0xdf,0xdf,0x01,0x00,0x00,0x01, + 0x00}}, +#endif + {{0x67,0x4f,0x4f,0x8b,0x57,0x83,0x10,0x3e, /* 0x0a - corrected 640x480-120 */ + 0xe7,0x8d,0xdf,0xe6,0x11,0x00,0x00,0x05, + 0x00}}, + {{0x63,0x4f,0x4f,0x87,0x56,0x9d,0xfb,0x1f, + 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x01, + 0x00}}, + {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, + 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* TW: Corrected VDE, VBE */ + 0x00}}, + {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, + 0x01}}, + {{0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, + 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, + 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, + 0x01}}, + {{0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, + 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, + {{0x8c,0x63,0x63,0x87,0x72,0x16,0x7e,0xf0, + 0x59,0x8d,0x57,0x57,0x7f,0x00,0x00,0x06, + 0x01}}, + {{0x7e,0x63,0x63,0x82,0x6c,0x14,0x75,0xe0, + 0x58,0x0b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, + {{0x7e,0x63,0x63,0x82,0x6c,0x14,0x75,0xe0, /* 0x14 */ + 0x58,0x0b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, + {{0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, + 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, + 0x00}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, + 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}}, + {{0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5, + 0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02, + 0x01}}, + {{0x9f,0x7f,0x7f,0x83,0x83,0x93,0x1e,0xf5, /* 0x1a */ + 0x00,0x84,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}}, + {{0xa2,0x7f,0x7f,0x86,0x84,0x94,0x37,0xf5, + 0x0b,0x82,0xff,0xff,0x38,0x10,0x00,0x02, + 0x01}}, + {{0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, + 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, + 0x00}}, + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, /* 0x1e */ + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, + 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, + 0x01}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, /* 36: 1600x1200x85Hz */ + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x3f,0xef,0xef,0x83,0xfd,0x1a,0xda,0x1f, /* 37: 1920x1440x60Hz */ + 0xa0,0x84,0x9f,0x9f,0xdb,0x1f,0x01,0x01, + 0x00}}, + {{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, + 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05, + 0x00}}, +#if 0 + {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 0x27: 1280x960-70 - invalid! */ + 0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07, + 0x01}}, +#endif + {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 0x27: 1280x960-60 - correct */ + 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, /* 0x28 */ + 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, + 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, + 0x01}}, + {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, + 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, + 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, + 0x01}}, + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, + 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, + 0x01}}, + {{0xa7,0x7f,0x7f,0x88,0x89,0x15,0x26,0xf1, + 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, + 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, + 0x01}}, + {{0x6b,0x59,0x59,0x8f,0x5e,0x8c,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x7b,0x59,0x63,0x9f,0x6a,0x93,0x6f,0xf0, /* 0x32 */ + 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* 0x33 - 1024x600 */ + 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, + 0x01}}, +#if 0 + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, /* 0x34 - 1152x768 */ + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, +#endif + {{0xa3,0x8f,0x8f,0x97,0x96,0x97,0x24,0xf5, /* 0x34 - 1152x768 - TW: corrected */ + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, /* 0x35 - NEW 16:9 modes, not in BIOS ------ */ + 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06, + 0x01}}, /* 0x35 */ + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, + 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, + 0x01}}, /* 0x36 */ + {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, + 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, + 0x01}}, /* 0x37 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, + 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, + 0x01}}, /* 0x38 */ + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, + 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, + 0x01}}, /* 0x39 */ + {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */ + 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, + 0x01}}, /* 0x3a */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x3b */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x3c */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, + 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, + 0x01}}, /* 0x3d */ /* TW: End of 16:9 modes --------------- */ + {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* TW: New, 1152x864-75 (not in any BIOS) */ + 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07, + 0x01}}, /* 0x3e */ + {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 848x480-38i, not in BIOS */ + 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, + 0x00}}, /* 0x3f */ +#if 0 + {{0x81,0x69,0x69,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 848x480-60, not in BIOS - incorrect for Philips panel */ + 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, + 0x00}}, /* 0x40 */ +#endif + {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* TW: New, 848x480-60, not in BIOS */ + 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06, + 0x00}}, /* 0x40 */ + {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 856x480-38i, not in BIOS */ + 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, + 0x00}}, /* 0x41 */ + {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 856x480-60, not in BIOS */ + 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, + 0x00}}, /* 0x42 */ + {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* TW: New, 1360x768-60, not in BIOS */ + 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03, + 0x01}}, /* 0x43 */ + {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* TW: New, 1152x864-84 (not in any BIOS) */ + 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03, + 0x01}}, /* 0x44 */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* TW: New, 1280x960-85 (not in any BIOS) */ + 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, + 0x01}} /* 0x45 */ +}; + +typedef struct _SiS300_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; + USHORT CLOCK; +} SiS300_MCLKDataStruct; + +static const SiS300_MCLKDataStruct SiS300_MCLKData_630[] = /* 630 */ +{ /* TW: at 0x54 in BIOS */ + { 0x5a,0x64,0x80, 66}, + { 0xb3,0x45,0x80, 83}, + { 0x37,0x61,0x80,100}, + { 0x37,0x22,0x80,133}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100} +}; + +static const SiS300_MCLKDataStruct SiS300_MCLKData_300[] = /* 300 */ +{ /* TW: at 0x54 in BIOS */ + { 0x68,0x43,0x80,125}, + { 0x68,0x43,0x80,125}, + { 0x68,0x43,0x80,125}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100}, + { 0x37,0x61,0x80,100} +}; + +typedef struct _SiS300_ECLKDataStruct +{ + UCHAR SR2E,SR2F,SR30; + USHORT CLOCK; +} SiS300_ECLKDataStruct; + +static const SiS300_ECLKDataStruct SiS300_ECLKData[] = +{ + { 0x54,0x43,0x80,100}, + { 0x53,0x43,0x80,100}, + { 0x55,0x43,0x80,100}, + { 0x52,0x43,0x80,100}, + { 0x3f,0x42,0x80,100}, + { 0x54,0x43,0x80,100}, + { 0x54,0x43,0x80,100}, + { 0x54,0x43,0x80,100} +}; + +typedef struct _SiS300_VCLKDataStruct +{ + UCHAR SR2B,SR2C; + USHORT CLOCK; +} SiS300_VCLKDataStruct; + +static const SiS300_VCLKDataStruct SiS300_VCLKData[] = +{ + { 0x1b,0xe1, 25}, /* 0x00 */ + { 0x4e,0xe4, 28}, + { 0x57,0xe4, 32}, /* 0x02 */ + { 0xc3,0xc8, 36}, + { 0x42,0xc3, 40}, /* 0x04 */ + { 0x5d,0xc4, 45}, + { 0x52,0x65, 50}, /* 0x06 */ + { 0x53,0x65, 50}, + { 0x6d,0x66, 56}, /* 0x08 */ + { 0x5a,0x64, 65}, + { 0x46,0x44, 68}, /* 0x0a */ + { 0x3e,0x43, 75}, + { 0x6d,0x46, 76}, /* 0x0c: 800x600 | LVDS_2(CH), MITAC(CH); - 730, A901(301B): 0xb1,0x46, 76 */ + { 0x41,0x43, 79}, + { 0x31,0x42, 79}, /* 0x0e */ + { 0x46,0x25, 85}, + { 0x78,0x29, 87}, /* 0x10 */ + { 0x62,0x44, 95}, + { 0x2b,0x22,105}, /* 0x12 */ + { 0x49,0x24,106}, + { 0xc3,0x28,108}, /* 0x14 */ + { 0x3c,0x23,109}, + { 0xf7,0x2c,132}, /* 0x16 */ + { 0xd4,0x28,136}, + { 0x41,0x05,158}, /* 0x18 */ + { 0x43,0x05,162}, + { 0xe1,0x0f,175}, /* 0x1a */ + { 0xfc,0x12,189}, /* 0x1b */ + { 0xde,0x26,194}, /* 0x1c */ + { 0x54,0x05,203}, + { 0x3f,0x03,230}, /* 0x1e */ + { 0x30,0x02,234}, + { 0x24,0x01,266}, /* 0x20 */ + { 0x52,0x2a, 54}, /* 301 TV */ + { 0x52,0x6a, 27}, /* 301 TV */ + { 0x62,0x24, 70}, /* 301 TV */ + { 0x62,0x64, 70}, /* 301 TV */ + { 0xa8,0x4c, 30}, /* 301 TV */ + { 0x20,0x26, 33}, /* 301 TV */ + { 0x31,0xc2, 39}, + { 0xbf,0xc8, 35}, /* 0x28 - 856x480 */ + { 0x60,0x36, 30}, /* 0x29 CH/UNTSC TEXT | LVDS_2(CH) - 730, A901(301B), Mitac(CH): 0xe0, 0xb6, 30 */ + { 0x40,0x4a, 28}, + { 0x9f,0x46, 44}, + { 0x97,0x2c, 26}, + { 0x44,0xe4, 25}, + { 0x7e,0x32, 47}, + { 0x8a,0x24, 31}, /* 0x2f CH/PAL TEXT | LVDS_2(CH), Mitac(CH) - 730, A901(301B): 0x57, 0xe4, 31 */ + { 0x97,0x2c, 26}, + { 0xce,0x3c, 39}, + { 0x52,0x4a, 36}, /* 0x32 CH/PAL 800x600 5/6 */ + { 0x34,0x61, 95}, + { 0x78,0x27,108}, + { 0xce,0x25,189}, /* 0x35 */ + { 0x45,0x6b, 21}, /* 0x36 */ /* TW: Added from Mitac */ + { 0x52,0xe2, 49}, /* 0x37 - added for 16:9 modes (not in any BIOS) */ + { 0x2b,0x61, 78}, /* 0x38 - added for 16:9 modes (not in any BIOS) */ + { 0x70,0x44,108}, /* 0x39 - added for 16:9 modes (not in any BIOS) */ + { 0x54,0x42,135}, /* 0x3a - added for 16:9 modes (not in any BIOS) */ + { 0x41,0x22,157}, /* 0x3b - added for 16:9 modes (not in any BIOS) */ + { 0x52,0x07,149}, /* 0x3c - added for 1280x960-85 (not in any BIOS)*/ + { 0x62,0xc6, 34}, /* 0x3d - added for 848x480-60 (not in any BIOS) */ + { 0x30,0x23, 88}, /* 0x3e - added for 1360x768-60 (not in any BIOS)*/ + { 0x3f,0x64, 46}, /* 0x3f - added for 640x480-100 (not in any BIOS)*/ + { 0x72,0x2a, 76}, /* 0x40 - test for SiS730 */ + { 0x15,0x21, 79}, /* 0x41 - test for SiS730 */ + { 0xff,0x00, 0} +}; + +#if 0 /* TW: This table is in all BIOSes, but not used */ +static const SiS300_VCLKDataStruct SiS300_VBVCLKData[] = +{ + { 0x1b,0xe1, 25}, + { 0x4e,0xe4, 28}, + { 0x57,0xe4, 31}, + { 0xc3,0xc8, 36}, + { 0x42,0x47, 40}, + { 0x5d,0xc4, 44}, + { 0x52,0x47, 49}, + { 0x53,0x47, 50}, + { 0x6d,0x66, 56}, + { 0x5a,0x64, 65}, + { 0x46,0x44, 67}, + { 0x29,0x61, 75}, + { 0x6d,0x46, 75}, + { 0x41,0x43, 78}, + { 0x31,0x42, 79}, + { 0x46,0x25, 84}, + { 0x78,0x29, 86}, /* 0x10 */ + { 0x62,0x44, 94}, + { 0x2b,0x22,104}, + { 0x49,0x24,105}, + { 0x43,0x42,108}, + { 0x3c,0x23,109}, + { 0xe0,0x46,132}, + { 0x70,0x25,135}, + { 0x41,0x22,157}, + { 0x43,0x22,162}, + { 0x30,0x21,175}, + { 0xc1,0x24,189}, + { 0xde,0x26,194}, + { 0x70,0x07,202}, + { 0x3f,0x03,229}, + { 0x30,0x02,234}, /* 0x1f */ + { 0x24,0x01,265}, /* 0x20 */ + { 0x52,0x2a, 54}, + { 0x52,0x6a, 27}, + { 0x62,0x24, 70}, + { 0x62,0x64, 70}, + { 0xa8,0x4c, 30}, + { 0x20,0x26, 33}, + { 0x31,0xc2, 39}, + { 0x2e,0x48, 25}, /* 0x28 */ + { 0x24,0x46, 25}, /* 0x29 */ + { 0x26,0x64, 28}, + { 0x37,0x64, 40}, + { 0xa1,0x42,108}, + { 0x37,0x61,100}, + { 0x78,0x27,108}, + { 0xff,0x00, 0} +}; +#endif + +static const UCHAR SiS300_ScreenOffset[] = +{ + 0x14,0x19,0x20,0x28,0x32,0x40,0x50, + 0x64,0x78,0x80,0x2d,0x35,0x48,0x35, /* 0x35 for 848 and 856 */ + 0x55,0xff /* 0x55 for 1360 */ +}; + +typedef struct _SiS300_StResInfoStruct +{ + USHORT HTotal; + USHORT VTotal; +} SiS300_StResInfoStruct; + +static const SiS300_StResInfoStruct SiS300_StResInfo[] = +{ + { 640,400}, + { 640,350}, + { 720,400}, + { 720,350}, + { 640,480} +}; + +typedef struct _SiS300_ModeResInfoStruct +{ + USHORT HTotal; + USHORT VTotal; + UCHAR XChar; + UCHAR YChar; +} SiS300_ModeResInfoStruct; + +static const SiS300_ModeResInfoStruct SiS300_ModeResInfo[] = +{ + { 320, 200, 8, 8}, /* 0x00 */ + { 320, 240, 8, 8}, /* 0x01 */ + { 320, 400, 8, 8}, /* 0x02 */ + { 400, 300, 8, 8}, /* 0x03 */ + { 512, 384, 8, 8}, /* 0x04 */ + { 640, 400, 8,16}, /* 0x05 */ + { 640, 480, 8,16}, /* 0x06 */ + { 800, 600, 8,16}, /* 0x07 */ + { 1024, 768, 8,16}, /* 0x08 */ + { 1280,1024, 8,16}, /* 0x09 */ + { 1600,1200, 8,16}, /* 0x0a */ + { 1920,1440, 8,16}, /* 0x0b */ + { 720, 480, 8,16}, /* 0x0c */ + { 720, 576, 8,16}, /* 0x0d */ + { 1280, 960, 8,16}, /* 0x0e */ + { 1024, 600, 8,16}, /* 0x0f */ + { 1152, 768, 8,16}, /* 0x10 */ + { 2048,1536, 8,16}, /* 0x11 - TW: Not in BIOS! */ + { 800, 480, 8,16}, /* 0x12 - TW: New, not in any BIOS */ + { 1024, 576, 8,16}, /* 0x13 - TW: New, not in any BIOS */ + { 1280, 720, 8,16}, /* 0x14 - TW: New, not in any BIOS */ + { 1152, 864, 8,16}, /* 0x15 - TW: New, not in any BIOS */ + { 848, 480, 8,16}, /* 0x16 - TW: New, not in any BIOS */ + { 856, 480, 8,16}, /* 0x17 - TW: New, not in any BIOS */ + { 1360, 768, 8,16} /* 0x18 - TW: New, not in any BIOS */ +}; + +static const UCHAR SiS300_OutputSelect = 0x40; + +static const UCHAR SiS300_SoftSetting = 0x30; + +#ifndef LINUX_XF86 +static UCHAR SiS300_SR07 = 0x10; +#endif + +static const UCHAR SiS300_SR15[8][4] = +{ + {0x01,0x09,0xa3,0x00}, + {0x43,0x43,0x43,0x00}, + {0x1e,0x1e,0x1e,0x00}, + {0x2a,0x2a,0x2a,0x00}, + {0x06,0x06,0x06,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00} +}; + +#ifndef LINUX_XF86 +static UCHAR SiS300_SR1F = 0x00; +static UCHAR SiS300_SR21 = 0x16; +static UCHAR SiS300_SR22 = 0xb2; +static UCHAR SiS300_SR23 = 0xf6; +static UCHAR SiS300_SR24 = 0x0d; +static UCHAR SiS300_SR25[] = {0x0,0x0}; +static UCHAR SiS300_SR31 = 0x00; +static UCHAR SiS300_SR32 = 0x11; +static UCHAR SiS300_SR33 = 0x00; +static UCHAR SiS300_CRT2Data_1_2 = 0x40; +static UCHAR SiS300_CRT2Data_4_D = 0x00; +static UCHAR SiS300_CRT2Data_4_E = 0x00; +static UCHAR SiS300_CRT2Data_4_10 = 0x80; + +static const USHORT SiS300_RGBSenseData = 0xd1; +static const USHORT SiS300_VideoSenseData = 0xb3; +static const USHORT SiS300_YCSenseData = 0xb9; +static const USHORT SiS300_RGBSenseData2 = 0x0190; /*301b*/ +static const USHORT SiS300_VideoSenseData2 = 0x0174; +static const USHORT SiS300_YCSenseData2 = 0x016b; + +static const UCHAR SiS300_CR40[5][4]; + +static UCHAR SiS300_CR49[2]; +#endif + +static const UCHAR SiS300_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */ +static const UCHAR SiS300_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */ +static const UCHAR SiS300_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* palmn */ +static const UCHAR SiS300_PALNPhase[] = {0x21,0xF4,0x3E,0xBA}; +static const UCHAR SiS300_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6}; /* 301b */ +static const UCHAR SiS300_PALPhase2[] = {0x2a,0x09,0x86,0xe9}; /* 301b */ +static const UCHAR SiS300_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/ +static const UCHAR SiS300_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/ + +typedef struct _SiS300_PanelDelayTblStruct +{ + UCHAR timer[2]; +} SiS300_PanelDelayTblStruct; + +static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] = +{ + {{0x05,0xaa}}, /* TW: From 2.04.5a */ + {{0x05,0x14}}, + {{0x05,0x36}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x90}}, + {{0x05,0x90}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x20,0x80}}, + {{0x05,0x14}}, + {{0x05,0x40}}, + {{0x05,0x60}} +}; + +static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = +{ + {{0x05,0xaa}}, + {{0x05,0x14}}, + {{0x05,0x36}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x90}}, + {{0x05,0x90}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, /* 2.07a (JVC): 14,96 */ + {{0x05,0x28}}, /* 2.04.5c: 20, 80 - Clevo (2.04.2c): 05, 28 */ + {{0x05,0x14}}, + {{0x05,0x14}}, /* Some BIOSes: 05, 40 */ + {{0x05,0x60}} +}; + +typedef struct _SiS300_LCDDataStruct +{ + USHORT RVBHCMAX; + USHORT RVBHCFACT; + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; +} SiS300_LCDDataStruct; + +static const SiS300_LCDDataStruct SiS300_StLCD1024x768Data[] = +{ + { 66, 31, 992, 510,1320, 816}, + { 66, 31, 992, 510,1320, 816}, + { 176, 75, 900, 510,1320, 816}, + { 176, 75, 900, 510,1320, 816}, + { 66, 31, 992, 510,1320, 816}, + { 27, 16,1024, 650,1350, 832}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[] = +{ + { 12, 5, 896, 512,1344, 806}, + { 12, 5, 896, 510,1344, 806}, + { 32, 15,1008, 505,1344, 806}, + { 32, 15,1008, 514,1344, 806}, + { 12, 5, 896, 500,1344, 806}, + { 42, 25,1024, 625,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 12, 5, 896, 500,1344, 806}, + { 42, 25,1024, 625,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 12, 5, 896, 500,1344, 806}, + { 42, 25,1024, 625,1344, 806}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[] = +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 104, 45, 945, 496,1344, 806}, + { 62, 25, 800, 546,1344, 806}, + { 31, 18,1008, 624,1344, 806}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[] = +{ + { 4, 1, 880, 510,1650,1088}, + { 4, 1, 880, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 4, 1, 880, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = +{ + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 500,1688,1066}, + { 211, 75,1024, 625,1688,1066}, + { 211, 120,1280, 798,1688,1066}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[] = +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS300_LCDDataStruct SiS300_NoScaleData1024x768[] = +{ + { 1, 1, 800, 449, 800, 449}, + { 1, 1, 800, 449, 800, 449}, + { 1, 1, 900, 449, 900, 449}, + { 1, 1, 900, 449, 900, 449}, + { 1, 1, 800, 525, 800, 525}, + { 1, 1,1056, 628,1056, 628}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[] = /* TW: Fake */ +{ + { 1, 1, 800, 449, 800, 449}, + { 1, 1, 800, 449, 800, 449}, + { 1, 1, 900, 449, 900, 449}, + { 1, 1, 900, 449, 900, 449}, + { 1, 1, 800, 525, 800, 525}, + { 1, 1,1056, 628,1056, 628}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS300_LCDDataStruct SiS300_LCD1280x960Data[] = +{ + { 9, 2, 800, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 30, 11,1056, 625,1800,1000}, + { 5, 3,1350, 800,1800,1000}, + { 1, 1,1576,1050,1576,1050}, + { 1, 1,1800,1000,1800,1000} +}; + +static const SiS300_LCDDataStruct SiS300_ExtLCD1400x1050Data[] = /* TW: New */ +{ + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS300_LCDDataStruct SiS300_ExtLCD1600x1200Data[] = /* TW: New */ +{ + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS300_LCDDataStruct SiS300_StLCD1400x1050Data[] = /* TW: New */ +{ + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS300_LCDDataStruct SiS300_StLCD1600x1200Data[] = /* TW: New */ +{ + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS300_LCDDataStruct SiS300_NoScaleData1400x1050[] = /* TW: New */ +{ + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS300_LCDDataStruct SiS300_NoScaleData1600x1200[] = /* TW: New */ +{ + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0} +}; + + +typedef struct _SiS300_TVDataStruct +{ + USHORT RVBHCMAX; + USHORT RVBHCFACT; + USHORT VGAHT; + USHORT VGAVT; + USHORT TVHDE; + USHORT TVVDE; + USHORT RVBHRS; + UCHAR FlickerMode; + USHORT HALFRVBHRS; + UCHAR RY1COE; + UCHAR RY2COE; + UCHAR RY3COE; + UCHAR RY4COE; +} SiS300_TVDataStruct; + +static const SiS300_TVDataStruct SiS300_StPALData[] = +{ + { 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} +}; + +static const SiS300_TVDataStruct SiS300_ExtPALData[] = +{ + { 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, + { 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, + { 12, 5, 954, 448,1270, 530, 50, 0, 50,0xf1,0x04,0x1f,0x18}, + { 9, 4, 960, 463,1644, 438, 50, 0, 50,0xf4,0x0b,0x1c,0x0a}, + { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a}, + { 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, + { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, + { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} + +}; + +static const SiS300_TVDataStruct SiS300_StNTSCData[] = +{ + { 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} +}; + +static const SiS300_TVDataStruct SiS300_ExtNTSCData[] = +{ + { 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, + { 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, + { 143, 70, 924, 443,1270, 440, 92, 0, 92,0xf1,0x04,0x1f,0x18}, + { 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a}, + { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, + { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, + { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, + { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xf1,0x04,0x1f,0x18} +}; + +static const SiS_TVDataStruct SiS300_St1HiTVData[] = +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +static const SiS_TVDataStruct SiS300_St2HiTVData[] = +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +static const SiS_TVDataStruct SiS300_ExtHiTVData[] = +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +static const UCHAR SiS300_NTSCTiming[] = +{ + 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c, + 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b, + 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, /* (in 2.06.50) */ +/* 0x0c,0x50,0x00,0x99,0x00,0xec,0x4a,0x17, (in 2.04.5a) */ + 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, /* (in 2.06.50) */ +/* 0x88,0x00,0x4b,0x00,0x00,0xe2,0x00,0x02, (in 2.04.5a) */ + 0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50, + 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00 +}; + +static const UCHAR SiS300_PALTiming[] = +{ + 0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70, + 0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b, + 0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17, /* (in 2.06.50) */ +/* 0x70,0x50,0x00,0x97,0x00,0xd7,0x5d,0x17, (in 2.04.5a) */ + 0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02, /* (in 2.06.50) */ +/* 0x88,0x00,0x45,0x00,0x00,0xe8,0x00,0x02, (in 2.04.5a) */ + 0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63, + 0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00 +}; + +#ifdef oldHV +static const UCHAR SiS300_HiTVExtTiming[] = /* TW: New */ +{ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, + 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, + 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, + 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 +}; + +static const UCHAR SiS300_HiTVSt1Timing[] = /* TW: New */ +{ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03, + 0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10, + 0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86, + 0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00 +}; + +static const UCHAR SiS300_HiTVSt2Timing[] = /* TW: New */ +{ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, + 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, + 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, + 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 +}; + +static const UCHAR SiS300_HiTVTextTiming[] = /* TW: New */ +{ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03, + 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, + 0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96, + 0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00 +}; + +static const UCHAR SiS300_HiTVGroup3Data[] = /* TW: New */ +{ + 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f, + 0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6, + 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, + 0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44, + 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, + 0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9, + 0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 +}; + +static const UCHAR SiS300_HiTVGroup3Simu[] = /* TW: New */ +{ + 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95, + 0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6, + 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, + 0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11, + 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, + 0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4, + 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 +}; + +static const UCHAR SiS300_HiTVGroup3Text[] = /* TW: New */ +{ + 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7, + 0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6, + 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, + 0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22, + 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, + 0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca, + 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 +}; +#endif + +typedef struct _SiS300_LVDSDataStruct +{ + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; +} SiS300_LVDSDataStruct; + +static const SiS300_LVDSDataStruct SiS300_LVDS320x480Data_1[] = +{ + {848, 433,400, 525}, + {848, 389,400, 525}, + {848, 433,400, 525}, + {848, 389,400, 525}, + {848, 518,400, 525}, + {1056,628,400, 525}, + {400, 525,400, 525}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[] = +{ + {848, 433,1060, 629}, + {848, 389,1060, 629}, + {848, 433,1060, 629}, + {848, 389,1060, 629}, + {848, 518,1060, 629}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[] = +{ + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_1[] = +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_2[] = +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_1[] = +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_2[] = +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1400x1050Data_1[] = /* TW: New */ +{ + {928, 416, 1688, 1066}, + {928, 366, 1688, 1066}, + {928, 416, 1688, 1066}, + {928, 366, 1688, 1066}, + {928, 496, 1688, 1066}, + {1088, 616, 1688, 1066}, + {1312, 784, 1688, 1066}, + {1568, 1040, 1688, 1066}, + {1688, 1066, 1688, 1066} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1400x1050Data_2[] = /* TW: New */ +{ + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1280x768Data_1[]= /* TW: New - TODO */ +{ /* TW: Temp data, invalid (is identical to 1024x768) */ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1280x768Data_2[]= /* TW: New - TODO */ +{ /* TW: Temp data, invalid (is identical to 1024x768) */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: */ +static const SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_1[] = +{ + {840, 604,1344, 800}, + {840, 560,1344, 800}, + {840, 604,1344, 800}, + {840, 560,1344, 800}, + {840, 689,1344, 800}, + {1050, 800,1344, 800}, + {1344, 800,1344, 800}, + {800, 449,1280, 789}, + {800, 525,1280, 785} +}; + +/* TW: New: */ +static const SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_2[] = +{ + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: */ +static const SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_1[] = +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: */ +static const SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_2[] = +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New in 650/LVDS BIOS - 1:1 */ +static const SiS300_LVDSDataStruct SiS300_LVDSXXXxXXXData_1[] = /* TW: New */ +{ + { 800, 449, 800, 449}, + { 800, 449, 800, 449}, + { 900, 449, 900, 449}, + { 900, 449, 900, 449}, + { 800, 525, 800, 525}, + {1056, 628,1056, 628}, + {1344, 806,1344, 806}, + {1688, 806,1688, 806} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS640x480Data_1[] = +{ + {800, 449, 800, 449}, + {800, 449, 800, 449}, + {800, 449, 800, 449}, + {800, 449, 800, 449}, + {800, 525, 800, 525}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1280x960Data_1[] = /* TW: New */ +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LVDS1280x960Data_2[] = /* TW: New */ +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LCDA1400x1050Data_1[] = /* TW: New */ +{ /* TW: Might be temporary (invalid) data */ + {928, 416, 1688, 1066}, + {928, 366, 1688, 1066}, + {1008, 416, 1688, 1066}, + {1008, 366, 1688, 1066}, + {1200, 530, 1688, 1066}, + {1088, 616, 1688, 1066}, + {1312, 784, 1688, 1066}, + {1568, 1040, 1688, 1066}, + {1688, 1066, 1688, 1066} +}; + +static const SiS300_LVDSDataStruct SiS300_LCDA1400x1050Data_2[] = /* TW: New */ +{ /* TW: Temporary data. Not valid */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LCDA1600x1200Data_1[] = /* TW: New */ +{ /* TW: Temporary data. Not valid */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS300_LVDSDataStruct SiS300_LCDA1600x1200Data_2[] = /* TW: New */ +{ /* TW: Temporary data. Not valid */ + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0} +}; + + +/* TW: New: */ +static const SiS300_LVDSDataStruct SiS300_CHTVUNTSCData[] = +{ + {840, 600, 840, 600}, + {840, 600, 840, 600}, + {840, 600, 840, 600}, + {840, 600, 840, 600}, + {784, 600, 784, 600}, + {1064, 750,1064, 750} +}; + +static const SiS300_LVDSDataStruct SiS300_CHTVONTSCData[] = +{ + {840, 525, 840, 525}, + {840, 525, 840, 525}, + {840, 525, 840, 525}, + {840, 525, 840, 525}, + {784, 525, 784, 525}, + {1040, 700,1040, 700} +}; + +static const SiS300_LVDSDataStruct SiS300_CHTVUPALData[] = +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 750, 840, 750}, + {936, 836, 936, 836} +}; + +static const SiS300_LVDSDataStruct SiS300_CHTVOPALData[] = +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 625, 840, 625}, + {960, 750, 960, 750} +}; + +static const SiS300_LVDSDataStruct SiS300_CHTVSOPALData[] = +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 500, 840, 500}, + {944, 625, 944, 625} +}; + +/* TW: new end */ + +typedef struct _SiS300_LVDSDesStruct +{ + USHORT LCDHDES; + USHORT LCDVDES; +} SiS300_LVDSDesStruct; + +static const SiS300_LVDSDesStruct SiS300_PanelType00_1[] = +{ + {0, 626}, + {0, 624}, + {0, 626}, + {0, 624}, + {0, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType01_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType02_1[] = +{ + {0, 626}, + {0, 624}, + {0, 626}, + {0, 624}, + {0, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType03_1[] = +{ + { 8, 436}, + { 8, 440}, + { 8, 436}, + { 8, 440}, + { 8, 512}, + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType04_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType05_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType06_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType07_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType08_1[] = +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType09_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0a_1[] = +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0b_1[] = +{ + {1343, 0}, + {1343, 0}, + {1343, 0}, + {1343, 0}, + {1343, 0}, /* 640x480 - BIOS 1343, 0 */ + {1343, 0}, + { 0, 799}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0c_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0d_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0e_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, /* 640x480 */ + {1343, 0}, /* 800x600 */ + { 0, 805}, /* 1024x768 */ + { 0, 794}, /* 1280x1024 */ + { 0, 0} /* 1280x960 - not applicable */ +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0f_1[] = +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType00_2[] = +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType01_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType02_2[] = +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType03_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + {1152, 622}, + {1152, 597} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType04_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType05_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType06_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType07_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType08_2[] = +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType09_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0a_2[] = +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0b_2[] = +{ + { 1152, 700}, + { 1152, 675}, + { 1152, 700}, + { 1152, 675}, + { 1152, 740}, + { 1232, 799}, + { 0, 799}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0c_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0d_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0e_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType0f_2[] = +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType1076_1[] = /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType1076_2[] = /* TW: New */ +{ + { 1152, 622 }, + { 1152, 597 }, + { 1152, 622 }, + { 1152, 597 }, + { 1152, 622 }, + { 1232, 722 }, + { 0, 0 }, + { 0, 794 }, + { 0, 0 } +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType1210_1[] = /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType1210_2[] = /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType1296_1[] = /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS300_LVDSDesStruct SiS300_PanelType1296_2[] = /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + + +/* TW: New */ +static const SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[] = +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[] = +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[] = +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[] = +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0} +}; +/* TW: New end */ + +/* TW: New for SiS300+301LV */ +typedef struct _SiS300_Part2PortTblStruct +{ + UCHAR CR[12]; +} SiS300_Part2PortTblStruct; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = +{ /* VESA Timing */ + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_1[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_1[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = +{ /* Non-VESA */ + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_2[] = +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_2[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_3[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_3[] = +{ /* TW: Temporary data, invalid */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +typedef struct _SiS300_LVDSCRT1DataStruct +{ +UCHAR CR[15]; +} SiS300_LVDSCRT1DataStruct; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = +{ + {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = +{ + {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00 }}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01 }}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = +{ + {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x04, + 0x00 }}, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = +{ + {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00 }}, + {{0x37,0x27,0x9B,0x2b,0x94,0x97,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x9B,0x2b,0x94,0x97,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x9B,0x2b,0x94,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x41,0x31,0x85,0x35,0x1d,0x7c,0xf0, + 0x5A,0x8F,0x57,0x7D,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3F,0x93,0x45,0x0D,0x24,0xf5, + 0x02,0x88,0xFf,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04, + 0x00 }}, + {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, + 0x00 }}, + {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04, + 0x00 }}, + {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, + 0x00 }}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x04, + 0x00 }}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = +{ + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01 }}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01 }}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = +{ + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, + 0x00 }}, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x93,0x3e,0x86,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba, + 0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x02, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +/* TW: New */ +static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = +{ + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x53,0x9c,0x56,0xba, + 0x18,0x84,0xdf,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x80,0x63,0x84,0x6c,0x17,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x06, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = +{ + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x56,0x9c,0x0b,0x3e, + 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x7d,0x63,0x81,0x6a,0x16,0xba,0xf0, + 0x7f,0x86,0x57,0xbb,0x00,0x00,0x06, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x55,0x80,0xec,0xba, + 0x50,0x84,0xdf,0xed,0x00,0x00,0x05, + 0x00 }}, + {{0x70,0x63,0x94,0x68,0x8d,0x42,0xf1, + 0xc8,0x8c,0x57,0xe9,0x20,0x00,0x05, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x55,0x80,0x6f,0xba, + 0x20,0x83,0xdf,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x73,0x63,0x97,0x69,0x8e,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, + 0x01 }} +}; + +static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x55,0x80,0x6f,0xba, /* TODO */ + 0x20,0x83,0xdf,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x73,0x63,0x97,0x69,0x8e,0xec,0xf0, /* TODO */ + 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, + 0x01 }} +}; +/* TW: New end */ + +/* TW: New */ +typedef struct _SiS300_CHTVRegDataStruct +{ + UCHAR Reg[16]; +} SiS300_CHTVRegDataStruct; + +static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = +{ + {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x6a,0x6a,0x00,0x2d,0xfa,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 17: 640x480 NTSC 7/8 */ + {{0x8d,0xc4,0x00,0x3b,0xfb,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 24: 800x600 NTSC 7/10 */ +}; + +static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = +{ + {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x69,0x6a,0x00,0x1e,0xfd,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 16: 640x480 NTSC 1/1 */ + {{0x8c,0xb4,0x00,0x32,0xf9,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 23: 800x600 NTSC 3/4 */ +}; + +static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = +{ + {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x63,0x94,0x01,0x50,0x30,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 15: 640x480 PAL 5/6 */ + {{0x84,0x64,0x01,0x4e,0x2f,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 21: 800x600 PAL 3/4 */ + +}; + +static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = +{ + {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 1/1 */ + {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x61,0x94,0x01,0x36,0x30,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 14: 640x480 PAL 1/1 */ + {{0x83,0x76,0x01,0x40,0x31,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 20: 800x600 PAL 5/6 */ + +}; + +static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = +{ + {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 5/4 */ + {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x60,0x30,0x00,0x10,0x00,0,0,0,0,0,0,0,0,0,0,0}}, /* TW: Mode 13: 640x480 PAL 5/4 */ + {{0x81,0x50,0x00,0x1b,0x00,0,0,0,0,0,0,0,0,0,0,0}} /* TW: Mode 19: 800x600 PAL 1/1 */ +}; +/* TW: New end */ + +/* TW: New */ +static const UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e}; + +static const UCHAR SiS300_CHTVVCLKONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b}; + +static const UCHAR SiS300_CHTVVCLKSONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b}; + +static const UCHAR SiS300_CHTVVCLKUPAL[] = {0x2f,0x2f,0x2f,0x2f,0x2f,0x31}; + +static const UCHAR SiS300_CHTVVCLKOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x30,0x32}; + +static const UCHAR SiS300_CHTVVCLKSOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x36,0x29}; +/* TW: New end */ + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h:1.5 --- /dev/null Thu Feb 27 12:31:36 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,4673 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.5 2003/02/10 01:14:16 tsi Exp $ */ + + +/* Register settings for SiS 310/325 series */ + + +typedef struct _SiS310_StStruct +{ + UCHAR St_ModeID; + USHORT St_ModeFlag; + UCHAR St_StTableIndex; + UCHAR St_CRT2CRTC; + UCHAR St_ResInfo; + UCHAR VB_StTVFlickerIndex; + UCHAR VB_StTVEdgeIndex; + UCHAR VB_StTVYFilterIndex; +} SiS310_StStruct; + +static const SiS310_StStruct SiS310_SModeIDTable[]= +{ + {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00}, + {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00}, + {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01}, + {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02}, + {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02}, + {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03}, + {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04}, + {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05}, + {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03}, + {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03}, + {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04}, + {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05}, + {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05}, + {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05}, + {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05}, + {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05}, + {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04}, + {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05}, + {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05}, + {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS310_StandTableStruct +{ + UCHAR CRT_COLS; + UCHAR ROWS; + UCHAR CHAR_HEIGHT; + USHORT CRT_LEN; + UCHAR SR[4]; + UCHAR MISC; + UCHAR CRTC[0x19]; + UCHAR ATTR[0x14]; + UCHAR GRC[9]; +} SiS310_StandTableStruct; + +static const SiS310_StandTableStruct SiS310_StandTable[]= +{ +/* MD_0_200 */ + { + 0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_1_200 */ + { + 0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_2_200 */ + { + 0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_3_200 */ + { + 0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_4 */ + { + 0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} + }, +/* MD_5 */ + { + 0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} + }, +/* MD_6 */ + { + 0x50,0x18,0x08,0x4000, + {0x01,0x01,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, + 0xff}, + {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x01,0x00,0x01,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, + 0xff} + }, +/* MD_7 */ + { + 0x50,0x18,0x0e,0x1000, + {0x00,0x03,0x00,0x03}, + 0xa6, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} + }, +/* MDA_DAC */ + { + 0x00,0x00,0x00,0x0000, + {0x00,0x00,0x00,0x15}, + 0x15, + {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15}, + {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f} + }, +/* CGA_DAC */ + { + 0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x00}, + 0x10, + {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, + 0x04}, + {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, + 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, + 0x3e,0x2b,0x3b,0x2f}, + {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} + }, +/* EGA_DAC */ + { + 0x00,0x10,0x04,0x0114, + {0x11,0x05,0x15,0x20}, + 0x30, + {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, + 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, + 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, + 0x06}, + {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, + 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, + 0x1e,0x0b,0x1b,0x0f}, + {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} + }, +/* VGA_DAC */ + { + 0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x2a}, + 0x3a, + {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, + 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, + 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, + 0x1f}, + {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, + 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, + 0x1c,0x0e,0x11,0x15}, + {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, + 0x04} + }, + { + 0x08,0x0c,0x10,0x0a08, + {0x0c,0x0e,0x10,0x0b}, + 0x0c, + {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, + 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, + 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, + 0x06}, + {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, + 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} + }, +/* MD_D */ + { + 0x28,0x18,0x08,0x2000, + {0x09,0x0f,0x00,0x06}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, +/* MD_E */ + { + 0x50,0x18,0x08,0x4000, + {0x01,0x0f,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, +/* ExtVGATable */ + { + 0x00,0x00,0x00,0x0000, + {0x01,0x0f,0x00,0x0e}, + 0x23, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} + }, +/* ROM_SAVEPTR */ + { + 0x9f,0x3b,0x00,0x00c0, + {0x00,0x00,0x00,0x00}, + 0x00, + {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} + }, +/* MD_F */ + { + 0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa2, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, + 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, + 0x0b,0x00,0x05,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, + 0xff} + }, +/* MD_10 */ + { + 0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, +/* MD_0_350 */ + { + 0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_1_350 */ + { + 0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_2_350 */ + { + 0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_3_350 */ + { + 0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_0_1_400 */ + { + 0x28,0x18,0x10,0x0800, + {0x08,0x03,0x00,0x02}, + 0x67, + {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_2_3_400 */ + { + 0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x67, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, +/* MD_7_400 */ + { + 0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x66, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} + }, +/* MD_11 */ + { + 0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3, + 0xff}, + {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, + 0xff} + }, +/* ExtEGATable */ + { + 0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, +/* MD_13 */ + { + 0x28,0x18,0x08,0x2000, + {0x01,0x0f,0x00,0x0e}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x41,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} + } +}; + +typedef struct _SiS310_ExtStruct +{ + UCHAR Ext_ModeID; + USHORT Ext_ModeFlag; + USHORT Ext_ModeInfo; + USHORT Ext_Point; /* TW: Address of table entry in (older) BIOS image */ + USHORT Ext_VESAID; + UCHAR Ext_VESAMEMSize; + UCHAR Ext_RESINFO; + UCHAR VB_ExtTVFlickerIndex; + UCHAR VB_ExtTVEdgeIndex; + UCHAR VB_ExtTVYFilterIndex; + UCHAR REFindex; +} SiS310_ExtStruct; + +/* TW: Checked with 650/LVDS and 650/301LVx 1.10.6s */ +static const SiS310_ExtStruct SiS310_EModeIDTable[]= +{ + {0x6a,0x2212,0x0407,0x3a81,0x0102,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x? */ + {0x2e,0x0a1b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x8 */ +/* {0x2e,0x021b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, */ /* 640x480x8 - 650/LVDS BIOS (no CRt2Mode) */ + {0x2f,0x0a1b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, /* 640x400x8 */ +/* {0x2f,0x021b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, */ /* 640x400x8 - 650/LVDS BIOS (no CRt2Mode) */ + {0x30,0x2a1b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x8 */ +/* {0x30,0x221b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, */ /* 800x600x8 - 650/LVDS BIOS (no CRt2Mode) */ +/* {0x31,0x0a1b,0x030d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, */ /* 720x480x8 */ + {0x31,0x0a1b,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x8 BIOS (301/LVDS) */ + {0x32,0x0a1b,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x16 */ + {0x34,0x2a1d,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x16 */ + {0x35,0x0a1f,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x32 */ + {0x36,0x2a1f,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x32 */ + {0x37,0x0212,0x0508,0x3aab,0x0104,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x? */ + {0x38,0x0a1b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x8 */ +/* {0x38,0x021b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, */ /* 1024x768x8 - 650/LVDS BIOS (no CRt2Mode) */ + {0x3a,0x0e3b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ +/* {0x3a,0x063b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, */ /* 1280x1024x8 - 650/LVDS BIOS*/ + {0x3c,0x0e3b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */ +/* {0x3c,0x063b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, */ /* 1600x1200x8 - 650/LVDS BIOS */ + {0x3d,0x067d,0x070a,0x3af2,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 - 650/301LVx - no CRT2Mode? */ + {0x40,0x9a1c,0x0000,0x3a34,0x010d,0x08,0x00,0x00,0x00,0x04,0x25}, + {0x41,0x9a1d,0x0000,0x3a34,0x010e,0x08,0x00,0x00,0x00,0x04,0x25}, + {0x43,0x0a1c,0x0306,0x3a57,0x0110,0x08,0x06,0x00,0x00,0x05,0x08}, + {0x44,0x0a1d,0x0306,0x3a57,0x0111,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x16 */ + {0x46,0x2a1c,0x0407,0x3a81,0x0113,0x08,0x07,0x00,0x00,0x07,0x00}, + {0x47,0x2a1d,0x0407,0x3a81,0x0114,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x16 */ + {0x49,0x0a3c,0x0508,0x3aab,0x0116,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x4a,0x0a3d,0x0508,0x3aab,0x0117,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x16 */ + {0x4c,0x0e7c,0x0609,0x3adc,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x0609,0x3adc,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x16 */ + {0x50,0x9a1b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, +/* {0x50,0x921b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, */ /* 650/LVDS BIOS */ + {0x51,0xba1b,0x0103,0x3a42,0x0133,0x08,0x03,0x00,0x00,0x07,0x27}, +/* {0x52,0x9a1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, */ + {0x52,0xba1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, /* 650/301 BIOS */ +/* {0x52,0xb21b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, */ /* 650/LVDS BIOS (no CRT2Mode) */ + {0x56,0x9a1d,0x0001,0x3a3b,0x0135,0x08,0x01,0x00,0x00,0x04,0x26}, + {0x57,0xba1d,0x0103,0x3a42,0x0136,0x08,0x03,0x00,0x00,0x07,0x27}, +/* {0x58,0x9a1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, */ + {0x58,0xba1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, /* BIOS (301+LVDS) */ + {0x59,0x9a1b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, +/* {0x59,0x921b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, */ /* 650/LVDS BIOS (no CRT2Mode) */ + {0x5A,0x021b,0x0014,0x3b83,0x0138,0x08,0x01,0x00,0x00,0x04,0x3f}, /* 320x480x8 fstn add new mode*/ + {0x5B,0x0a1d,0x0014,0x3b83,0x0135,0x08,0x01,0x00,0x00,0x04,0x3f}, /* 320x480x16 fstn add new mode*/ + {0x5c,0xba1f,0x0204,0x3a49,0x0000,0x08,0x04,0x00,0x00,0x00,0x28}, /* TW: inserted 512x384x32 */ + {0x5d,0x0a1d,0x0305,0x3a50,0x0139,0x08,0x05,0x00,0x00,0x07,0x10}, + {0x5e,0x0a1f,0x0305,0x3a50,0x0000,0x08,0x05,0x00,0x00,0x07,0x10}, /* TW: Inserted 640x400x32 */ + {0x62,0x0a3f,0x0306,0x3a57,0x013a,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x32 */ + {0x63,0x2a3f,0x0407,0x3a81,0x013b,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x32 */ + {0x64,0x0a7f,0x0508,0x3aab,0x013c,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x32 */ + {0x65,0x0eff,0x0609,0x3adc,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x32 */ + {0x66,0x06ff,0x070a,0x3af2,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x32 */ + {0x68,0x067b,0x080b,0x3b17,0x013f,0x08,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x8 */ + {0x69,0x06fd,0x080b,0x3b17,0x0140,0x08,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x16 */ + {0x6b,0x07ff,0x080b,0x3b17,0x0141,0x10,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x32 */ + {0x6c,0x067b,0x090c,0x3b37,0x0000,0x08,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x8 */ + {0x6d,0x06fd,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x16 */ + {0x6e,0x07ff,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x32 */ + {0x70,0x2a1b,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x8 */ + {0x71,0x0a1b,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x8 */ + {0x74,0x0a1d,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x16 */ + {0x75,0x0a3d,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x16 */ + {0x76,0x2a1f,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x32 */ + {0x77,0x0a1f,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x32 */ + {0x78,0x0a3f,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x32 */ + {0x79,0x0a3b,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x16 */ + {0x7c,0x0e3b,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x8 - TW */ + {0x7d,0x0e7d,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x16 - TW */ + {0x7e,0x0eff,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x32 - TW */ + /* TW: 650/LVDS BIOS new modes */ +/* {0x23,0x063b,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, */ /* 1280x768x8 - 650/LVDS BIOS */ + {0x23,0x0e3b,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x8 */ + {0x24,0x0e7d,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x16 */ + {0x25,0x0eff,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x32 */ + {0x26,0x0e3b,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x8 */ +/* {0x26,0x063b,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, */ /* 1400x1050x8 - 650/LVDS BIOS */ + {0x27,0x0e7d,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x16 */ + {0x28,0x0eff,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x32*/ + {0x29,0x0e1b,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, /* TW: NEW 1152x864 - not in BIOS */ + {0x2a,0x0e3d,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, + {0x2b,0x0e7f,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, + {0x39,0x2a1b,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, /* TW: NEW 848x480 - not in BIOS */ + {0x3b,0x2a3d,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, + {0x3e,0x2a7f,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, + {0x3f,0x2a1b,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, /* TW: NEW 856x480 - not in BIOS */ + {0x42,0x2a3d,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, + {0x45,0x2a7f,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, + {0x48,0x2a1b,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, /* TW: NEW 1360x768 - not in BIOS */ + {0x4b,0x2a3d,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, + {0x4e,0x2a7f,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, + {0xff,0x0000,0x0000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS310_Ext2Struct +{ + USHORT Ext_InfoFlag; + UCHAR Ext_CRT1CRTC; + UCHAR Ext_CRTVCLK; + UCHAR Ext_CRT2CRTC; + UCHAR ModeID; + USHORT XRes; + USHORT YRes; + USHORT ROM_OFFSET; +} SiS310_Ext2Struct; + +static const SiS310_Ext2Struct SiS310_RefIndex[]= +{ +/* {0x005f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, 0x0 - TW: Patch for Chrontel 7019 */ + {0x085f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, /* 0x0 */ + {0x0467,0x0e,0x04,0x05,0x6a, 800, 600,0x3a86}, /* 0x1 */ + {0x0067,0x0f,0x08,0x48,0x6a, 800, 600,0x3a8b}, /* 0x2 */ + {0x0067,0x10,0x07,0x8b,0x6a, 800, 600,0x3a90}, /* 0x3 */ + {0x0147,0x11,0x0a,0x00,0x6a, 800, 600,0x3a95}, /* 0x4 */ + {0x0147,0x12,0x0d,0x00,0x6a, 800, 600,0x3a9a}, /* 0x5 - 4147 TW: Test sync change */ + {0x0047,0x13,0x13,0x00,0x6a, 800, 600,0x3a9f}, /* 0x6 - 4047 */ + {0x0047,0x14,0x1c,0x00,0x6a, 800, 600,0x3aa4}, /* 0x7 - 4047 */ +/* {0xc05f,0x05,0x00,0x04,0x2e, 640, 480,0x3a57}, 0x8 - TW: Patch for Chrontel 7019 */ + {0xc85f,0x05,0x00,0x04,0x2e, 640, 480,0x3a57}, /* 0x8 */ + {0xc067,0x06,0x02,0x04,0x2e, 640, 480,0x3a5c}, /* 0x9 */ + {0xc067,0x07,0x02,0x47,0x2e, 640, 480,0x3a61}, /* 0xa */ + {0xc067,0x08,0x03,0x8a,0x2e, 640, 480,0x3a66}, /* 0xb */ + {0xc047,0x09,0x05,0x00,0x2e, 640, 480,0x3a6b}, /* 0xc - 4047 */ + {0xc047,0x0a,0x09,0x00,0x2e, 640, 480,0x3a70}, /* 0xd - 4047 */ + {0xc047,0x0b,0x0e,0x00,0x2e, 640, 480,0x3a75}, /* 0xe - 4047 */ + {0xc047,0x0c,0x15,0x00,0x2e, 640, 480,0x3a7a}, /* 0xf */ + {0x407f,0x04,0x00,0x00,0x2f, 640, 400,0x3a50}, /* 0x10 */ + {0xc00f,0x3c,0x01,0x06,0x31, 720, 480,0x3b85}, /* 0x11 */ + {0x000f,0x3d,0x03,0x06,0x32, 720, 576,0x3b8c}, /* 0x12 */ + {0x0187,0x15,0x06,0x00,0x37,1024, 768,0x3aab}, /* 0x13 */ + {0xc877,0x16,0x0b,0x06,0x37,1024, 768,0x3ab0}, /* 0x14 301b TV1024x768*/ + {0xc067,0x17,0x0f,0x49,0x37,1024, 768,0x3ab5}, /* 0x15 */ + {0x0267,0x18,0x11,0x00,0x37,1024, 768,0x3aba}, /* 0x16 */ + {0x0047,0x19,0x16,0x8c,0x37,1024, 768,0x3abf}, /* 0x17 */ + {0x0047,0x1a,0x1b,0x00,0x37,1024, 768,0x3ac4}, /* 0x18 - 4047 */ + {0x0047,0x1b,0x1f,0x00,0x37,1024, 768,0x3ac9}, /* 0x19 - 4047 */ + {0x0387,0x1c,0x11,0x00,0x3a,1280,1024,0x3adc}, /* 0x1a */ + {0x0077,0x1d,0x19,0x07,0x3a,1280,1024,0x3ae1}, /* 0x1b */ + {0x0047,0x1e,0x1e,0x00,0x3a,1280,1024,0x3ae6}, /* 0x1c */ + {0x0007,0x1f,0x20,0x00,0x3a,1280,1024,0x3aeb}, /* 0x1d */ + {0x0007,0x20,0x21,0x00,0x3c,1600,1200,0x3af2}, /* 0x1e */ + {0x0007,0x21,0x22,0x00,0x3c,1600,1200,0x3af7}, /* 0x1f */ + {0x0007,0x22,0x23,0x00,0x3c,1600,1200,0x3afc}, /* 0x20 */ + {0x0007,0x23,0x25,0x00,0x3c,1600,1200,0x3b01}, /* 0x21 */ + {0x0007,0x24,0x26,0x00,0x3c,1600,1200,0x3b06}, /* 0x22 */ + {0x0007,0x25,0x2c,0x00,0x3c,1600,1200,0x3b0b}, /* 0x23 */ + {0x0007,0x26,0x34,0x00,0x3c,1600,1200,0x3b10}, /* 0x24 */ + {0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3a34}, /* 0x25 */ + {0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x3a3b}, /* 0x26 */ + {0x007f,0x02,0x04,0x05,0x51, 400, 300,0x3a42}, /* 0x27 */ + {0xc077,0x03,0x0b,0x06,0x52, 512, 384,0x3a49}, /* 0x28 */ + {0x8007,0x27,0x27,0x00,0x68,1920,1440,0x3b17}, /* 0x29 */ + {0x4007,0x28,0x29,0x00,0x68,1920,1440,0x3b1c}, /* 0x2a */ + {0x4007,0x29,0x2e,0x00,0x68,1920,1440,0x3b21}, /* 0x2b */ + {0x4007,0x2a,0x30,0x00,0x68,1920,1440,0x3b26}, /* 0x2c */ + {0x4007,0x2b,0x35,0x00,0x68,1920,1440,0x3b2b}, /* 0x2d */ + {0x4005,0x2c,0x39,0x00,0x68,1920,1440,0x3b30}, /* 0x2e */ + {0x4007,0x2d,0x2b,0x00,0x6c,2048,1536,0x3b37}, /* 0x2f */ + {0x4007,0x2e,0x31,0x00,0x6c,2048,1536,0x3b3c}, /* 0x30 */ + {0x4007,0x2f,0x33,0x00,0x6c,2048,1536,0x3b41}, /* 0x31 */ + {0x4007,0x30,0x37,0x00,0x6c,2048,1536,0x3b46}, /* 0x32 */ + {0x4005,0x31,0x38,0x00,0x6c,2048,1536,0x3b4b}, /* 0x33 */ + {0x0057,0x32,0x40,0x08,0x70, 800, 480,0x3b52}, /* 0x34 */ + {0x0047,0x33,0x07,0x08,0x70, 800, 480,0x3b57}, /* 0x35 */ + {0x0047,0x34,0x0a,0x08,0x70, 800, 480,0x3b5c}, /* 0x36 */ + {0x0057,0x35,0x0b,0x09,0x71,1024, 576,0x3b63}, /* 0x37 */ + {0x0047,0x36,0x11,0x09,0x71,1024, 576,0x3b68}, /* 0x38 */ + {0x0047,0x37,0x16,0x09,0x71,1024, 576,0x3b6d}, /* 0x39 */ + {0x0057,0x38,0x19,0x0a,0x75,1280, 720,0x3b74}, /* 0x3a */ + {0x0047,0x39,0x1e,0x0a,0x75,1280, 720,0x3b79}, /* 0x3b */ + {0x0047,0x3a,0x20,0x0a,0x75,1280, 720,0x3b7e}, /* 0x3c */ + {0x0027,0x3b,0x19,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3d */ + {0x0047,0x4c,0x59,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3e */ + {0xc07f,0x01,0x00,0x06,0x5a, 320, 480,0x3b83}, /* 0x3f */ /* FSTN mode */ + {0x0077,0x42,0x12,0x07,0x23,1280, 768,0x0000}, /* 0x40 */ /* TW: 650/LVDS/301LVx new mode */ + {0x0067,0x43,0x4d,0x08,0x26,1400,1050,0x0000}, /* 0x41 */ /* TW: 650/LVDS/301LVx new mode */ + {0x0067,0x4b,0x5a,0x08,0x26,1400,1050,0x0000}, /* 0x42 */ /* TW: new, not in any BIOS */ + {0x0047,0x44,0x19,0x06,0x29,1152, 864,0x0000}, /* 0x43 TW: Non-BIOS, new */ + {0x0047,0x4a,0x1e,0x06,0x29,1152, 864,0x0000}, /* 0x44 TW: Non-BIOS, new */ + {0x00c7,0x45,0x57,0x00,0x39, 848, 480,0x0000}, /* 0x45 TW: 848x480-38Hzi - Non-BIOS, new */ + {0xc047,0x46,0x55,0x00,0x39, 848, 480,0x0000}, /* 0x46 TW: 848x480-60Hz - Non-BIOS, new */ + {0x00c7,0x47,0x57,0x00,0x3f, 856, 480,0x0000}, /* 0x47 TW: 856x480-38Hzi - Non-BIOS, new */ + {0xc047,0x48,0x57,0x00,0x3f, 856, 480,0x0000}, /* 0x48 TW: 856x480-60Hz - Non-BIOS, new */ + {0x0047,0x49,0x58,0x00,0x48,1360, 768,0x0000}, /* 0x49 TW: 1360x768-60Hz - Non-BIOS, new */ + {0xffff,0x00,0x00,0x00,0x00, 0, 0,0x0000} +}; + +typedef struct _SiS310_CRT1TableStruct +{ + UCHAR CR[17]; +} SiS310_CRT1TableStruct; + +static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= +{ + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, /* 0x0 */ + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, /* 0x1 */ + {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, + 0x01}}, /* 0x2 */ + {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01}}, /* 0x3 */ + {{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, /* 0x4 */ +#if 0 + {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, /* 0x5 */ +#endif + {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */ + 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, + 0x00}}, +#if 0 + {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, + 0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01, + 0x00}}, /* 0x6 */ +#endif + {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* 0x06 - corrected 640x480-72 */ + 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f, + 0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01, + 0x00}}, /* 0x7 */ + {{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, + 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, + 0x00}}, /* 0x8 */ + {{0x65,0x4f,0x4f,0x89,0x58,0x80,0xfb,0x1f, + 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* TW: Corrected VBE */ + 0x61}}, /* 0x9 */ + {{0x65,0x4f,0x4f,0x89,0x58,0x80,0x01,0x3e, + 0xe0,0x83,0xdf,0xdf,0x02,0x00,0x00,0x05, + 0x61}}, /* 0xa */ + {{0x67,0x4f,0x4f,0x8b,0x58,0x81,0x0d,0x3e, + 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* TW: Corrected VBE */ + 0x61}}, /* 0xb */ + {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, + 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* TW: Corrected VDE, VBE */ + 0x00}}, /* 0xc */ + {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, + 0x01}}, /* 0xd */ + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, + 0x01}}, /* 0xe */ + {{0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, + 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, + 0x01}}, /* 0xf */ + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, + 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, + 0x01}}, /* 0x10 */ + {{0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, + 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, /* 0x11 */ + {{0x81,0x63,0x63,0x85,0x6d,0x18,0x7a,0xf0, + 0x58,0x8b,0x57,0x57,0x7b,0x20,0x00,0x06, + 0x61}}, /* 0x12 */ + {{0x83,0x63,0x63,0x87,0x6e,0x19,0x81,0xf0, + 0x58,0x8b,0x57,0x57,0x82,0x20,0x00,0x06, + 0x61}}, /* 0x13 */ + {{0x85,0x63,0x63,0x89,0x6f,0x1a,0x91,0xf0, + 0x58,0x8b,0x57,0x57,0x92,0x20,0x00,0x06, + 0x61}}, /* 0x14 */ + {{0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, + 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, + 0x00}}, /* 0x15 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, /* 0x16 */ + {{0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, /* 0x17 */ + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, + 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}}, /* 0x18 */ + {{0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5, + 0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02, + 0x01}}, /* 0x19 */ + {{0xa9,0x7f,0x7f,0x8d,0x8c,0x9a,0x2c,0xf5, + 0x00,0x83,0xff,0xff,0x2d,0x14,0x00,0x02, + 0x62}}, /* 0x1a */ + {{0xab,0x7f,0x7f,0x8f,0x8d,0x9b,0x35,0xf5, + 0x00,0x83,0xff,0xff,0x36,0x14,0x00,0x02, + 0x62}}, /* 0x1b */ + {{0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, + 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, + 0x00}}, /* 0x1c */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, /* 0x1d */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, /* 0x1e */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, + 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, + 0x01}}, /* 0x1f */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x20 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x21 @ 4084 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x22 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x23 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x24 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x25 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x26 */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x27 */ + {{0x43,0xef,0xef,0x87,0x06,0x00,0xd4,0x1f, + 0xa0,0x83,0x9f,0x9f,0xd5,0x1f,0x41,0x05, + 0x63}}, /* 0x28 */ + {{0x45,0xef,0xef,0x89,0x07,0x01,0xd9,0x1f, + 0xa0,0x83,0x9f,0x9f,0xda,0x1f,0x41,0x05, + 0x63}}, /* 0x29 */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x2a */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x2b */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x2c */ + {{0x59,0xff,0xff,0x9d,0x17,0x13,0x33,0xba, + 0x00,0x83,0xff,0xff,0x34,0x0f,0x41,0x05, + 0x44}}, /* 0x2d */ + {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x38,0xba, + 0x00,0x83,0xff,0xff,0x39,0x0f,0x41,0x05, + 0x44}}, /* 0x2e */ + {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x3d,0xba, + 0x00,0x83,0xff,0xff,0x3e,0x0f,0x41,0x05, + 0x44}}, /* 0x2f */ + {{0x5d,0xff,0xff,0x81,0x19,0x95,0x41,0xba, + 0x00,0x84,0xff,0xff,0x42,0x0f,0x41,0x05, + 0x44}}, /* 0x30 */ + {{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, + 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05, + 0x00}}, /* 0x31 */ + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, + 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06, + 0x01}}, /* 0x32 */ + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, + 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, + 0x01}}, /* 0x33 */ + {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, + 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, + 0x01}}, /* 0x34 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, + 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, + 0x01}}, /* 0x35 */ + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, + 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, + 0x01}}, /* 0x36 */ + {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */ + 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, + 0x01}}, /* 0x37 */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x38 */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x39 */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, + 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, + 0x01}}, /* 0x3a */ +#if 0 + {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 1280x960 - invalid */ + 0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07, + 0x01}}, /* 0x3b */ +#endif + {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 1280x960-60 - corrected */ + 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07, + 0x01}}, /* 0x3b */ + {{0x6b,0x59,0x59,0x8f,0x5e,0x8c,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, /* 0x3c */ + {{0x7b,0x59,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, + 0x01}}, /* 0x3d */ + {{0x86,0x6a,0x6a,0x8a,0x74,0x06,0x8c,0x15, + 0x4f,0x83,0xef,0xef,0x8d,0x30,0x00,0x02, + 0x00}}, /* 0x3e */ + {{0x81,0x6a,0x6a,0x85,0x70,0x00,0x0f,0x3e, + 0xeb,0x8e,0xdf,0xdf,0x10,0x00,0x00,0x02, + 0x00}}, /* 0x3f */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* TW: The following from 650/LVDS BIOS */ + 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, + 0x01}}, /* 0x40 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, /* 0x41 */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x20,0xf5, + 0x03,0x88,0xff,0xff,0x21,0x10,0x00,0x07, + 0x01}}, /* 0x42 */ + {{0xe6,0xae,0xae,0x8a,0xbd,0x90,0x3d,0x10, + 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x00,0x03, + 0x00}}, /* 0x43 */ + {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* TW: New, 1152x864-75, not in any BIOS */ + 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07, + 0x01}}, /* 0x44 */ + {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 848x480-38i, not in BIOS */ + 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, + 0x00}}, /* 0x45 */ +#if 0 + {{0x81,0x69,0x69,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 848x480-60, not in BIOS - incorrect for Philips panel */ + 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, + 0x00}}, /* 0x46 */ +#endif + {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* TW: New, 848x480-60, not in BIOS */ + 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06, + 0x00}}, /* 0x46 */ + {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 856x480-38i, not in BIOS */ + 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, + 0x00}}, /* 0x47 */ + {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 856x480-60, not in BIOS */ + 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, + 0x00}}, /* 0x48 */ + {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* TW: New, 1360x768-60, not in BIOS */ + 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03, + 0x01}}, /* 0x49 */ + {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* TW: New, 1152x864-84, not in any BIOS */ + 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03, + 0x01}}, /* 0x4a */ + {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, /* TW: New, 1400x1050-75, not in any BIOS */ + 0x1b,0x87,0x19,0x1a,0x41,0x0f,0x00,0x03, + 0x00}}, /* 0x4b */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* TW: New, 1280x960-85, not in any BIOS */ + 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, + 0x01}} /* 0x4c */ +}; + + +typedef struct _SiS310_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; + USHORT CLOCK; +} SiS310_MCLKDataStruct; + +static const SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] = +{ + { 0x3b,0x22,0x01,143}, /* TW: Was { 0x5c,0x23,0x01,166}, */ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166} +}; + +static const SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = /* @ 0x54 */ +{ + { 0x5a,0x64,0x82, 66}, + { 0xb3,0x45,0x82, 83}, + { 0x37,0x61,0x82,100}, + { 0x37,0x22,0x82,133}, + { 0x37,0x61,0x82,100}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133} +}; + +static const SiS310_MCLKDataStruct SiS310_MCLKData_0_330[] = /* @ 0x54 */ +{ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x7c,0x08,0x01,200}, + { 0x79,0x06,0x01,250}, + { 0x7c,0x08,0x01,200}, + { 0x7c,0x08,0x01,200}, + { 0x7c,0x08,0x01,200}, + { 0x79,0x06,0x01,250} +}; + +static const SiS310_MCLKDataStruct SiS310_MCLKData_1[] = /* @ 0x155 */ +{ + { 0x29,0x21,0x82,150}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x37,0x21,0x82,200}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133} +}; + +typedef struct _SiS310_ECLKDataStruct +{ + UCHAR SR2E,SR2F,SR30; + USHORT CLOCK; +} SiS310_ECLKDataStruct; + +static const SiS310_ECLKDataStruct SiS310_ECLKData[]= +{ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166} +}; + +typedef struct _SiS310_VCLKDataStruct +{ + UCHAR SR2B,SR2C; + USHORT CLOCK; +} SiS310_VCLKDataStruct; + +static const SiS310_VCLKDataStruct SiS310_VCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x5647 */ + { 0x4e,0xe4, 28}, /* 0x1 */ + { 0x57,0xe4, 31}, /* 0x2 */ + { 0xc3,0xc8, 36}, /* 0x3 */ + { 0x42,0xe2, 40}, /* 0x4 */ + { 0xfe,0xcd, 43}, /* 0x5 */ + { 0x5d,0xc4, 44}, /* 0x6 */ + { 0x52,0xe2, 49}, /* 0x7 */ + { 0x53,0xe2, 50}, /* 0x8 */ + { 0x74,0x67, 52}, /* 0x9 */ + { 0x6d,0x66, 56}, /* 0xa */ + { 0x5a,0x64, 65}, /* 0xb */ /* TW: was 6c c3 - WRONG */ + { 0x46,0x44, 67}, /* 0xc */ + { 0xb1,0x46, 68}, /* 0xd */ + { 0xd3,0x4a, 72}, /* 0xe */ + { 0x29,0x61, 75}, /* 0xf */ + { 0x6e,0x46, 76}, /* 0x10 */ + { 0x2b,0x61, 78}, /* 0x11 */ + { 0x31,0x42, 79}, /* 0x12 */ + { 0xab,0x44, 83}, /* 0x13 */ + { 0x46,0x25, 84}, /* 0x14 */ + { 0x78,0x29, 86}, /* 0x15 */ + { 0x62,0x44, 94}, /* 0x16 */ + { 0x2b,0x41,104}, /* 0x17 */ + { 0x3a,0x23,105}, /* 0x18 */ + { 0x70,0x44,108}, /* 0x19 */ + { 0x3c,0x23,109}, /* 0x1a */ + { 0x5e,0x43,113}, /* 0x1b */ + { 0xbc,0x44,116}, /* 0x1c */ + { 0xe0,0x46,132}, /* 0x1d */ + { 0x54,0x42,135}, /* 0x1e */ + { 0xea,0x2a,139}, /* 0x1f */ + { 0x41,0x22,157}, /* 0x20 */ + { 0x70,0x24,162}, /* 0x21 */ + { 0x30,0x21,175}, /* 0x22 */ + { 0x4e,0x22,189}, /* 0x23 */ + { 0xde,0x26,194}, /* 0x24 */ + { 0x62,0x06,202}, /* 0x25 */ + { 0x3f,0x03,229}, /* 0x26 */ + { 0xb8,0x06,234}, /* 0x27 */ + { 0x34,0x02,253}, /* 0x28 */ + { 0x58,0x04,255}, /* 0x29 */ + { 0x24,0x01,265}, /* 0x2a */ + { 0x9b,0x02,267}, /* 0x2b */ + { 0x70,0x05,270}, /* 0x2c */ + { 0x25,0x01,272}, /* 0x2d */ + { 0x9c,0x02,277}, /* 0x2e */ + { 0x27,0x01,286}, /* 0x2f */ + { 0x3c,0x02,291}, /* 0x30 */ + { 0xef,0x0a,292}, /* 0x31 */ + { 0xf6,0x0a,310}, /* 0x32 */ + { 0x95,0x01,315}, /* 0x33 */ + { 0xf0,0x09,324}, /* 0x34 */ + { 0xfe,0x0a,331}, /* 0x35 */ + { 0xf3,0x09,332}, /* 0x36 */ + { 0xea,0x08,340}, /* 0x37 */ + { 0xe8,0x07,376}, /* 0x38 */ + { 0xde,0x06,389}, /* 0x39 */ + { 0x52,0x2a, 54}, /* 0x3a */ + { 0x52,0x6a, 27}, /* 0x3b */ + { 0x62,0x24, 70}, /* 0x3c */ + { 0x62,0x64, 70}, /* 0x3d */ + { 0xa8,0x4c, 30}, /* 0x3e */ + { 0x20,0x26, 33}, /* 0x3f */ + { 0x31,0xc2, 39}, /* 0x40 */ + /* TW: 650/LVDS BIOS @ 0x574b new: */ + { 0x60,0x36, 30}, /* 0x41 */ /* Chrontel */ + { 0x40,0x4a, 28}, /* 0x42 */ /* Chrontel */ + { 0x9f,0x46, 44}, /* 0x43 */ /* Chrontel */ + { 0x97,0x2c, 26}, /* 0x44 */ + { 0x44,0xe4, 25}, /* 0x45 */ /* Chrontel */ + { 0x7e,0x32, 47}, /* 0x46 */ /* Chrontel */ + { 0x8a,0x24, 31}, /* 0x47 */ /* Chrontel */ + { 0x97,0x2c, 26}, /* 0x48 */ /* Chrontel */ + { 0xce,0x3c, 39}, /* 0x49 */ + { 0x52,0x4a, 36}, /* 0x4a */ /* Chrontel */ + { 0x34,0x61, 95}, /* 0x4b */ + { 0x78,0x27,108}, /* 0x4c - was 102 */ /* TW: Last entry in 650/301 BIOS */ + { 0x66,0x43,123}, /* 0x4d */ /* Modes 0x26-0x28 (1400x1050) */ + { 0x41,0x4e, 21}, /* 0x4e */ + { 0xa1,0x4a, 29}, /* 0x4f */ /* Chrontel */ + { 0x19,0x42, 42}, /* 0x50 */ + { 0x54,0x46, 58}, /* 0x51 */ /* Chrontel */ + { 0x25,0x42, 61}, /* 0x52 */ + { 0x44,0x44, 66}, /* 0x53 */ /* Chrontel */ + { 0x3a,0x62, 70}, /* 0x54 */ /* Chrontel */ + { 0x62,0xc6, 34}, /* 0x55 - added for 848x480-60 (not in any BIOS) */ + { 0x6a,0xc6, 37}, /* 0x56 - added for 848x480-75 (not in any BIOS) - TEMP */ + { 0xbf,0xc8, 35}, /* 0x57 - added for 856x480-38i,60 (not in any BIOS) */ + { 0x30,0x23, 88}, /* 0x58 - added for 1360x768-62 (is 60Hz!) (not in any BIOS) - TEMP */ + { 0x52,0x07,149}, /* 0x59 - added for 1280x960-85 (Not in any BIOS) */ + { 0x56,0x07,156} /* 0x5a - added for 1400x1050-75 */ +}; + +typedef struct _SiS310_VBVCLKDataStruct +{ + UCHAR Part4_A,Part4_B; + USHORT CLOCK; +} SiS310_VBVCLKDataStruct; + +static const SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x579c */ + { 0x4e,0xe4, 28}, /* 0x1 */ + { 0x57,0xe4, 31}, /* 0x2 */ + { 0xc3,0xc8, 36}, /* 0x3 */ + { 0x42,0x47, 40}, /* 0x4 */ + { 0xfe,0xcd, 43}, /* 0x5 */ + { 0x5d,0xc4, 44}, /* 0x6 */ + { 0x52,0x47, 49}, /* 0x7 */ + { 0x53,0x47, 50}, /* 0x8 */ + { 0x74,0x67, 52}, /* 0x9 */ + { 0x6d,0x66, 56}, /* 0xa */ + { 0x35,0x62, 65}, /* 0xb */ /* Was 0x5a,0x64 - 650/LVDS+301 bios: 35,62 */ + { 0x46,0x44, 67}, /* 0xc */ + { 0xb1,0x46, 68}, /* 0xd */ + { 0xd3,0x4a, 72}, /* 0xe */ + { 0x29,0x61, 75}, /* 0xf */ + { 0x6d,0x46, 75}, /* 0x10 */ + { 0x41,0x43, 78}, /* 0x11 */ + { 0x31,0x42, 79}, /* 0x12 */ + { 0xab,0x44, 83}, /* 0x13 */ + { 0x46,0x25, 84}, /* 0x14 */ + { 0x78,0x29, 86}, /* 0x15 */ + { 0x62,0x44, 94}, /* 0x16 */ + { 0x2b,0x22,104}, /* 0x17 */ + { 0x49,0x24,105}, /* 0x18 */ + { 0xf8,0x2f,108}, /* 0x19 */ + { 0x3c,0x23,109}, /* 0x1a */ + { 0x5e,0x43,113}, /* 0x1b */ + { 0xbc,0x44,116}, /* 0x1c */ + { 0xe0,0x46,132}, /* 0x1d */ + { 0xd4,0x28,135}, /* 0x1e */ + { 0xea,0x2a,139}, /* 0x1f */ + { 0x41,0x22,157}, /* 0x20 */ + { 0x70,0x24,162}, /* 0x21 */ + { 0x30,0x21,175}, /* 0x22 */ + { 0x4e,0x22,189}, /* 0x23 */ + { 0xde,0x26,194}, /* 0x24 */ + { 0x70,0x07,202}, /* 0x25 */ + { 0x3f,0x03,229}, /* 0x26 */ + { 0xb8,0x06,234}, /* 0x27 */ + { 0x34,0x02,253}, /* 0x28 */ + { 0x58,0x04,255}, /* 0x29 */ + { 0x24,0x01,265}, /* 0x2a */ + { 0x9b,0x02,267}, /* 0x2b */ + { 0x70,0x05,270}, /* 0x2c */ + { 0x25,0x01,272}, /* 0x2d */ + { 0x9c,0x02,277}, /* 0x2e */ + { 0x27,0x01,286}, /* 0x2f */ + { 0x3c,0x02,291}, /* 0x30 */ + { 0xef,0x0a,292}, /* 0x31 */ + { 0xf6,0x0a,310}, /* 0x32 */ + { 0x95,0x01,315}, /* 0x33 */ + { 0xf0,0x09,324}, /* 0x34 */ + { 0xfe,0x0a,331}, /* 0x35 */ + { 0xf3,0x09,332}, /* 0x36 */ + { 0xea,0x08,340}, /* 0x37 */ + { 0xe8,0x07,376}, /* 0x38 */ + { 0xde,0x06,389}, /* 0x39 */ + { 0x52,0x2a, 54}, /* 0x3a */ + { 0x52,0x6a, 27}, /* 0x3b */ + { 0x62,0x24, 70}, /* 0x3c */ + { 0x62,0x64, 70}, /* 0x3d */ + { 0xa8,0x4c, 30}, /* 0x3e */ + { 0x20,0x26, 33}, /* 0x3f */ + { 0x31,0xc2, 39}, /* 0x40 */ + /* TW: 650/LVDS+301 BIOS (@ 0x58a0 in LVDS) new: */ + { 0x2e,0x48, 25}, /* 0x41 */ + { 0x24,0x46, 25}, /* 0x42 */ + { 0x26,0x64, 28}, /* 0x43 */ + { 0x37,0x64, 40}, /* 0x44 */ + { 0xa1,0x42,108}, /* 0x45 */ + { 0x37,0x61,100}, /* 0x46 */ + { 0x78,0x27,108} /* 0x47 */ + /* --- 0x58bc --- */ +}; + +static const UCHAR SiS310_ScreenOffset[] = +{ + 0x14,0x19,0x20,0x28,0x32,0x40,0x50,0x64, + 0x78,0x80,0x2d,0x35,0x57,0x48,0x55, + 0xff +}; /* TW: Added 1400x1050, 1152x864, 848/856x480, 1360x768 */ + +typedef struct _SiS310_StResInfoStruct +{ + USHORT HTotal; + USHORT VTotal; +} SiS310_StResInfoStruct; + +static const SiS310_StResInfoStruct SiS310_StResInfo[]= +{ + { 640,400}, + { 640,350}, + { 720,400}, + { 720,350}, + { 640,480} +}; + +typedef struct _SiS310_ModeResInfoStruct +{ + USHORT HTotal; + USHORT VTotal; + UCHAR XChar; + UCHAR YChar; +} SiS310_ModeResInfoStruct; + +static const SiS310_ModeResInfoStruct SiS310_ModeResInfo[] = +{ + { 320, 200, 8, 8}, /* 0x00 */ + { 320, 240, 8, 8}, /* 0x01 */ + { 320, 400, 8, 8}, /* 0x02 */ + { 400, 300, 8, 8}, /* 0x03 */ + { 512, 384, 8, 8}, /* 0x04 */ + { 640, 400, 8,16}, /* 0x05 */ + { 640, 480, 8,16}, /* 0x06 */ + { 800, 600, 8,16}, /* 0x07 */ + { 1024, 768, 8,16}, /* 0x08 */ + { 1280,1024, 8,16}, /* 0x09 */ + { 1600,1200, 8,16}, /* 0x0a */ + { 1920,1440, 8,16}, /* 0x0b */ + { 2048,1536, 8,16}, /* 0x0c */ + { 720, 480, 8,16}, /* 0x0d */ + { 720, 576, 8,16}, /* 0x0e */ + { 1280, 960, 8,16}, /* 0x0f */ + { 800, 480, 8,16}, /* 0x10 */ + { 1024, 576, 8,16}, /* 0x11 */ + { 1280, 720, 8,16}, /* 0x12 */ + { 856, 480, 8,16}, /* 0x13 - TW: New, not in any BIOS */ + { 1280, 768, 8,16}, /* 0x14 20; TW: New */ + { 1400,1050, 8,16}, /* 0x15 21; TW: New */ + { 1152, 864, 8,16}, /* 0x16 - TW: New, not in any BIOS */ + { 848, 480, 8,16}, /* 0x17 - TW: New, not in any BIOS */ + { 1360, 768, 8,16} /* 0x18 - TW: New, not in any BIOS */ +}; + +static const UCHAR SiS310_OutputSelect = 0x40; + +static const UCHAR SiS310_SoftSetting = 0x30; /* TW: RAM setting */ + +static const UCHAR SiS310_SR15[8][4]={ + {0x00,0x04,0x60,0x60}, + {0x0f,0x0f,0x0f,0x0f}, + {0xba,0xba,0xba,0xba}, + {0xa9,0xa9,0xac,0xac}, + {0xa0,0xa0,0xa0,0xa8}, + {0x00,0x00,0x02,0x02}, + {0x30,0x30,0x40,0x40}, + {0x00,0xa5,0xfb,0xf6} +}; + +#ifndef LINUX_XF86 + +static UCHAR SiS310_SR07 = 0x18; + +static const UCHAR SiS310_CR40[5][4]={ + {0x77,0x77,0x33,0x33}, + {0x77,0x77,0x33,0x33}, + {0x00,0x00,0x00,0x00}, + {0x5b,0x5b,0x03,0x03}, + {0x00,0x00,0xf0,0xf8} +}; + +static UCHAR SiS310_CR49[] = {0xaa,0x88}; +static UCHAR SiS310_SR1F = 0x00; +static UCHAR SiS310_SR21 = 0xa5; +static UCHAR SiS310_SR22 = 0xfb; +static UCHAR SiS310_SR23 = 0xf6; +static UCHAR SiS310_SR24 = 0x0d; +static UCHAR SiS310_SR25[] = {0x33,0x3}; +static UCHAR SiS310_SR31 = 0x00; +static UCHAR SiS310_SR32 = 0x11; +static UCHAR SiS310_SR33 = 0x00; +static UCHAR SiS310_CRT2Data_1_2 = 0x00; +static UCHAR SiS310_CRT2Data_4_D = 0x00; +static UCHAR SiS310_CRT2Data_4_E = 0x00; +static UCHAR SiS310_CRT2Data_4_10 = 0x80; +static const USHORT SiS310_RGBSenseData = 0xd1; +static const USHORT SiS310_VideoSenseData = 0xb9; +static const USHORT SiS310_YCSenseData = 0xb3; +static const USHORT SiS310_RGBSenseData2 = 0x0190; /*301b*/ +static const USHORT SiS310_VideoSenseData2 = 0x0174; +static const USHORT SiS310_YCSenseData2 = 0x016b; +#endif + +static const UCHAR SiS310_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */ +static const UCHAR SiS310_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */ +static const UCHAR SiS310_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* TW: palm*/ +static const UCHAR SiS310_PALNPhase[] = {0x21,0xF4,0x3E,0xBA}; /* TW: paln*/ +static const UCHAR SiS310_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6}; +static const UCHAR SiS310_PALPhase2[] = {0x2a,0x09,0x86,0xe9}; +static const UCHAR SiS310_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/ +static const UCHAR SiS310_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/ +static const UCHAR SiS310_SpecialPhase[] = {0x1e,0x8c,0x5c,0x7a}; + +typedef struct _SiS310_LCDDataStruct +{ + USHORT RVBHCMAX; + USHORT RVBHCFACT; + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; +} SiS310_LCDDataStruct; + +static const SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]= +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 104, 45, 945, 496,1344, 806}, + { 62, 25, 800, 546,1344, 806}, + { 31, 18,1008, 624,1344, 806}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] = /* TW: Checked */ +{ + { 12, 5, 896, 512,1344, 806}, + { 12, 5, 896, 510,1344, 806}, + { 32, 15,1008, 505,1344, 806}, + { 32, 15,1008, 514,1344, 806}, + { 12, 5, 896, 500,1344, 806}, + { 42, 25,1024, 625,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 12, 5, 896, 500,1344, 806}, + { 42, 25,1024, 625,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 12, 5, 896, 500,1344, 806}, + { 42, 25,1024, 625,1344, 806}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = /* TW: Checked */ +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, +/* { 32, 15, 930, 546,1344, 806}, */ + { 62, 25, 800, 546,1344, 806}, /* TW: Different in 650/301LV BIOS */ + { 104, 45, 945, 496,1344, 806}, + { 62, 25, 800, 546,1344, 806}, + { 31, 18,1008, 624,1344, 806}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] = +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = /* TW: Checked */ +{ + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 500,1688,1066}, + { 211, 75,1024, 625,1688,1066}, + { 211, 120,1280, 798,1688,1066}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] = +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS310_LCDDataStruct SiS310_NoScaleData1024x768[] = /* TW: Checked */ +{ + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806}, + { 1, 1,1344, 806,1344, 806} +}; + +static const SiS310_LCDDataStruct SiS310_NoScaleData1280x1024[] = /* TW: New; Checked */ +{ + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066}, + { 1, 1,1688,1066,1688,1066} +}; + +static const SiS310_LCDDataStruct SiS310_LCD1280x960Data[] = +{ + { 9, 2, 800, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 30, 11,1056, 625,1800,1000}, + { 5, 3,1350, 800,1800,1000}, + { 1, 1,1576,1050,1576,1050}, + { 1, 1,1800,1000,1800,1000} +}; + +static const SiS310_LCDDataStruct SiS310_StLCD1400x1050Data[] = /* TW: New */ +{ /* TW: New from 1.11.6s */ + { 211, 100, 2100, 408, 1688, 1066 }, + { 211, 64, 1536, 358, 1688, 1066 }, + { 211, 100, 2100, 408, 1688, 1066 }, + { 211, 64, 1536, 358, 1688, 1066 }, + { 211, 48, 840, 488, 1688, 1066 }, + { 211, 72, 1008, 609, 1688, 1066 }, + { 211, 128, 1400, 776, 1688, 1066 }, + { 211, 205, 1680, 1041, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 } +}; + +static const SiS310_LCDDataStruct SiS310_ExtLCD1400x1050Data[] = /* TW: New */ +{ /* TW: New from 1.11.6s */ + { 211, 100, 2100, 408, 1688, 1066 }, + { 211, 64, 1536, 358, 1688, 1066 }, + { 211, 100, 2100, 408, 1688, 1066 }, + { 211, 64, 1536, 358, 1688, 1066 }, + { 211, 48, 840, 488, 1688, 1066 }, + { 211, 72, 1008, 609, 1688, 1066 }, + { 211, 128, 1400, 776, 1688, 1066 }, + { 211, 205, 1680, 1041, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 } +}; + +static const SiS310_LCDDataStruct SiS310_NoScaleData1400x1050[] = /* TW: New */ +{ /* TW: To be checked (BIOS uses 1280x1024 data, one line too short) */ + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 }, + { 1, 1, 1688, 1066, 1688, 1066 } +}; + +static const SiS310_LCDDataStruct SiS310_StLCD1600x1200Data[] = /* TW: New */ +{ /* TODO */ + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS310_LCDDataStruct SiS310_ExtLCD1600x1200Data[] = /* TW: New */ +{ /* TODO */ + { 0, 0, 0, 0, 0, 0} +}; + +static const SiS310_LCDDataStruct SiS310_NoScaleData1600x1200[] = /* TW: New */ +{ /* TODO */ + { 0, 0, 0, 0, 0, 0} +}; + +typedef struct _SiS310_TVDataStruct +{ + USHORT RVBHCMAX; + USHORT RVBHCFACT; + USHORT VGAHT; + USHORT VGAVT; + USHORT TVHDE; + USHORT TVVDE; + USHORT RVBHRS; + UCHAR FlickerMode; + USHORT HALFRVBHRS; + UCHAR RY1COE; + UCHAR RY2COE; + UCHAR RY3COE; + UCHAR RY4COE; +} SiS310_TVDataStruct; + +static const SiS310_TVDataStruct SiS310_StPALData[]= +{ + { 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} +}; + +static const SiS310_TVDataStruct SiS310_ExtPALData[] = /* TW: Verfied (1.10.7w) */ +{ + { 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, + { 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, + { 12, 5, 954, 448,1270, 530, 50, 0, 50,0xf1,0x04,0x1f,0x18}, + { 9, 4, 960, 463,1644, 438, 50, 0, 50,0xf4,0x0b,0x1c,0x0a}, + { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a}, /* 640x480 */ + { 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, /* 800x600 */ + { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, /* 720x480/576 */ + { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 */ +}; + +static const SiS310_TVDataStruct SiS310_StNTSCData[]= +{ + { 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} +}; + +static const SiS310_TVDataStruct SiS310_ExtNTSCData[]= +{ + { 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, + { 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, + { 143, 70, 924, 443,1270, 440, 92, 0, 92,0xf1,0x04,0x1f,0x18}, + { 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a}, + { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480 */ + { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, /* 800x600 */ + { 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480/576 */ + { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} /* 1024x768 */ +}; + +/* TW: These tables will need data ! */ +static const SiS310_TVDataStruct SiS310_St1HiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +static const SiS310_TVDataStruct SiS310_St2HiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +static const SiS310_TVDataStruct SiS310_ExtHiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +static const UCHAR SiS310_NTSCTiming[] = { /* TW: New (checked 1.09, 1.10.6s) */ + 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c, + 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b, + 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, + 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, + 0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50, + 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00 +}; + +static const UCHAR SiS310_PALTiming[] = { /* TW: New (checked 1.09, 1.10.6s) */ + 0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70, + 0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b, + 0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17, + 0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02, + 0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63, + 0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00 +}; + +#ifdef oldHV +static const UCHAR SiS310_HiTVExtTiming[] = { /* TW: New */ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, + 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, + 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, + 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 +}; + +static const UCHAR SiS310_HiTVSt1Timing[] = { /* TW: New */ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03, + 0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10, + 0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86, + 0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00 +}; + +static const UCHAR SiS310_HiTVSt2Timing[] = { /* TW: New */ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, + 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, + 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, + 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 +}; + +static const UCHAR SiS310_HiTVTextTiming[] = { /* TW: New */ + 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, + 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, + 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, + 0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03, + 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, + 0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96, + 0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00 +}; + +static const UCHAR SiS310_HiTVGroup3Data[] = { /* TW: New */ + 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f, + 0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6, + 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, + 0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44, + 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, + 0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9, + 0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 +}; + +static const UCHAR SiS310_HiTVGroup3Simu[] = { /* TW: New */ + 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95, + 0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6, + 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, + 0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11, + 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, + 0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4, + 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 +}; + +static const UCHAR SiS310_HiTVGroup3Text[] = { /* TW: New */ + 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7, + 0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6, + 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, + 0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22, + 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, + 0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca, + 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 +}; +#endif + +typedef struct _SiS310_PanelDelayTblStruct +{ + UCHAR timer[2]; +} SiS310_PanelDelayTblStruct; + +static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= /* TW: New */ +{ + {{0x10,0x40}}, /* TW: from 650/301LVx 1.10.6s BIOS */ + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}} +#if 0 + {{0x28,0xc8}}, /* TW: from 650/301LV BIOS */ + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}} +#endif +}; + +static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= +{ + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}} +}; + +typedef struct _SiS310_LVDSDataStruct +{ + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; +} SiS310_LVDSDataStruct; + +static const SiS310_LVDSDataStruct SiS310_LVDS320x480Data_1[]= +{ + {848, 433,400, 525}, + {848, 389,400, 525}, + {848, 433,400, 525}, + {848, 389,400, 525}, + {848, 518,400, 525}, + {1056,628,400, 525}, + {400, 525,400, 525}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS800x600Data_1[]= /* TW: New */ +{ + {848, 433,1060, 629}, + {848, 389,1060, 629}, + {848, 433,1060, 629}, + {848, 389,1060, 629}, + {848, 518,1060, 629}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]= /* TW: New */ +{ + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_1[]= /* TW: New */ +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, /* 640x480 */ + {1050, 638,1344, 806}, /* 800x600 */ + {1344, 806,1344, 806}, /* 1024x768 */ + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_2[]= /* TW: New */ +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_1[]= /* TW: New - TODO */ +{ /* TW: Temp data, invalid (is identical to 1024x768) */ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_2[]= /* TW: New - TODO */ +{ /* TW: Temp data, invalid (is identical to 1024x768) */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_1[]= /* TW: New */ +{ + {928, 416, 1688, 1066}, + {928, 366, 1688, 1066}, + {928, 416, 1688, 1066}, + {928, 366, 1688, 1066}, + {928, 496, 1688, 1066}, + {1088, 616, 1688, 1066}, + {1312, 784, 1688, 1066}, + {1568, 1040, 1688, 1066}, + {1688, 1066, 1688, 1066} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_2[]= /* TW: New */ +{ + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, + {1688,1066, 1688,1066}, +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1280x768Data_1[]= /* TW: New - TODO */ +{ /* TW: Temp data, invalid (is identical to 1024x768) */ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1280x768Data_2[]= /* TW: New - TODO */ +{ /* TW: Temp data, invalid (is identical to 1024x768) */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: - from 300 series */ +static const SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_1[]= +{ + {840, 604,1344, 800}, + {840, 560,1344, 800}, + {840, 604,1344, 800}, + {840, 560,1344, 800}, + {840, 689,1344, 800}, + {1050, 800,1344, 800}, + {1344, 800,1344, 800}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: - from 300 series */ +static const SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_2[]= +{ + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {1344, 800,1344, 800}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: - from 300 series */ +static const SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_1[]= +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New: - from 300 series */ +static const SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_2[]= +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +/* TW: New in 650/LVDS BIOS - pass 1:1 data */ +static const SiS310_LVDSDataStruct SiS310_LVDSXXXxXXXData_1[]= /* TW: New */ +{ + { 800, 449, 800, 449}, + { 800, 449, 800, 449}, + { 900, 449, 900, 449}, + { 900, 449, 900, 449}, + { 800, 525, 800, 525}, + {1056, 628,1056, 628}, + {1344, 806,1344, 806}, + {1688, 806,1688, 806} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS640x480Data_1[]= /* TW: New */ +{ + {800, 449, 800, 449}, + {800, 449, 800, 449}, + {800, 449, 800, 449}, + {800, 449, 800, 449}, + {800, 525, 800, 525}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_1[]= /* TW: New */ +{ + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 438,1344, 806}, + {840, 409,1344, 806}, + {840, 518,1344, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_2[]= /* TW: New */ +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LCDA1400x1050Data_1[]= /* TW: New */ +{ /* TW: Might be temporary (invalid) data */ + {928, 416, 1688, 1066}, + {928, 366, 1688, 1066}, + {1008, 416, 1688, 1066}, + {1008, 366, 1688, 1066}, + {1200, 530, 1688, 1066}, + {1088, 616, 1688, 1066}, + {1312, 784, 1688, 1066}, + {1568, 1040, 1688, 1066}, + {1688, 1066, 1688, 1066} +}; + +static const SiS310_LVDSDataStruct SiS310_LCDA1400x1050Data_2[]= /* TW: New */ +{ /* TW: Temporary data. Not valid */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LCDA1600x1200Data_1[]= /* TW: New */ +{ /* TW: Temporary data. Not valid */ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +static const SiS310_LVDSDataStruct SiS310_LCDA1600x1200Data_2[]= /* TW: New */ +{ /* TW: Temporary data. Not valid */ + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0} +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVUNTSCData[]= /* TW: New */ +{ + { 840, 600, 840, 600}, + { 840, 600, 840, 600}, + { 840, 600, 840, 600}, + { 840, 600, 840, 600}, + { 784, 600, 784, 600}, + {1064, 750,1064, 750}, + {1160, 945,1160, 945} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVONTSCData[]= /* TW: New */ +{ + { 840, 525, 840, 525}, + { 840, 525, 840, 525}, + { 840, 525, 840, 525}, + { 840, 525, 840, 525}, + { 784, 525, 784, 525}, + {1040, 700,1040, 700}, + {1160, 840,1160, 840} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= /* TW: New */ +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + { 840, 625, 840, 625}, + { 960, 750, 960, 750}, + {1400,1000,1400,1000} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= /* TW: New */ +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + { 840, 625, 840, 625}, + { 944, 625, 944, 625}, + {1400, 875,1400, 875} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVUPALMData[]= /* TW: New */ +{ + { 840, 600, 840, 600}, + { 840, 600, 840, 600}, + { 840, 600, 840, 600}, + { 840, 600, 840, 600}, + { 784, 600, 784, 600}, + {1064, 750,1064, 750}, + {1160, 945,1160, 945} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVOPALMData[]= /* TW: New */ +{ + { 840, 525, 840, 525}, + { 840, 525, 840, 525}, + { 840, 525, 840, 525}, + { 840, 525, 840, 525}, + { 784, 525, 784, 525}, + {1040, 700,1040, 700}, + {1160, 840,1160, 840} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVUPALNData[]= /* TW: New */ +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + { 840, 625, 840, 625}, + { 960, 750, 960, 750}, + {1400,1000,1400,1000} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVOPALNData[]= /* TW: New */ +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + { 840, 625, 840, 625}, + { 944, 625, 944, 625}, + {1400, 875,1400, 875} /* TW: For Ch7019 1024 */ +}; + +static const SiS310_LVDSDataStruct SiS310_CHTVSOPALData[]= /* TW: New (super overscan - no effect on 7019) */ +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + { 840, 625, 840, 625}, + { 944, 625, 944, 625}, + {1400, 875,1400, 875} +}; + +typedef struct _SiS310_LVDSDesStruct +{ + USHORT LCDHDES; + USHORT LCDVDES; +} SiS310_LVDSDesStruct; + +/* TW: PanelType arrays taken from 650/LVDS BIOS 1.10.0 */ + +static const SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 805}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 1065}, + { 0, 0}, + { 0, 0} +}; + + +static const SiS310_LVDSDesStruct SiS310_PanelType03_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType04_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType05_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType06_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType07_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* TW: New - to check (1280x768) */ +{ + { 0, 448}, + { 0, 448}, + { 0, 448}, + { 0, 448}, + { 0, 524}, + { 0, 627}, + { 0, 805}, + { 0, 805}, +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* TW: New */ +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= /* TW: New */ +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType00_2[]= /* TW: New */ +{ + {980, 528}, + {980, 503}, + {980, 528}, + {980, 503}, + {980, 568}, + { 0, 628}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType01_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 806}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType02_2[]= /* TW: New */ +{ + {1368, 754}, + {1368, 729}, + {1368, 754}, + {1368, 729}, + {1368, 794}, + {1448, 854}, + {1560, 938}, + { 0,1066}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType03_2[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType04_2[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType05_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType06_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType07_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* TW: New */ +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* TW: New - to check (1280x768) */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* TW: New */ +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = /* TW: New */ +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1076_1[]= /* TW: New */ +{ /* 1024x768 - Checked (1.10.6s) */ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1076_2[]= /* TW: New */ +{ /* 1024x768 - Checked (1.10.6s) */ + { 1184, 622 }, + { 1184, 597 }, + { 1184, 622 }, + { 1184, 597 }, + { 1152, 622 }, + { 1232, 722 }, + { 0, 0 }, + { 0, 794 }, + { 0, 0 } +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1210_1[]= /* TW: New */ +{ /* 1280x1024 - Checked (1.10.6s) */ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1210_2[]= /* TW: New */ +{ /* 1280x1024 - Checked (1.10.6s) */ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1296_1[]= /* TW: New */ +{ /* 1400x1050 - Checked (1.10.6s) */ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1296_2[]= /* TW: New */ +{ /* 1400x1050 - Checked (1.10.6s) - looks heavily invalid */ + { 808 , 740}, + { 0 , 715}, + { 632 , 740}, + { 632 , 715}, + { 1307, 780}, + { 1387,1157}, + { 1499, 924}, + { 1627,1052}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1600_1[]= /* TW: New */ +{ /* 1600x1200 - Checked (1.10.6s) */ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_PanelType1600_2[]= /* TW: New */ +{ /* 1600x1200 - Checked (1.10.6s) - looks heavily invalid */ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +static const SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +typedef struct _SiS310_Part2PortTblStruct +{ + UCHAR CR[12]; +} SiS310_Part2PortTblStruct; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = +{ + {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x38,0x13,0x16,0x0c,0xe6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_1[] = +{ /* TW: Temporary data, invalid */ + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_1[] = +{ /* TW: Temporary data, invalid */ + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_1[] = +{ /* TW: Temporary data, invalid */ + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_2[] = +{ + {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, + {{0x2c,0x12,0x38,0x55,0x2f,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, + {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, + {{0x2c,0x12,0x38,0x55,0x2f,0xc1,0x35,0xb1,0x47,0xe9,0x71,0x33}}, + {{0x2d,0x12,0x79,0x96,0x70,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, + {{0x29,0x12,0xb5,0xd2,0xac,0xe9,0x35,0xd9,0x47,0x11,0x99,0x33}}, + {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_2[] = +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_2[] = +{ + {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}}, + {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}}, + {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_2[] = +{ /* TW: Temporary data, invalid */ + {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, + {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}}, + {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}}, + {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} +}; + + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] = +{ /* TW: Data from 650/301LVx 1.10.6s */ + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x2c,0x13,0x9a,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x25,0x13,0xc9,0x24,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x25,0x13,0xc9,0x25,0xff,0xf9,0x45,0x09,0x07,0xf9,0x09,0x24}} +#if 0 /* TW: Data from 650/301LV */ + {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +#endif +}; + +/* 1 2 4 5 6 1c 1d 1f 20 21 23 25 */ +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_3[] = +{ /* TW: Temporary data, invalid */ + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_3[] = +{ /* TW: Temporary data, invalid */ + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} +}; + +static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_3[] = +{ /* TW: Temporary data, invalid */ + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, + {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} +}; + +typedef struct _SiS310_LCDACRT1DataStruct +{ + UCHAR CR[17]; +}SiS310_LCDACRT1DataStruct; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1[] = +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]= +{ /* TW: Checked (1.10.6s) */ + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, + 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, + 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x04,0x3e, + 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x05, + 0x00}}, + {{0x87,0x63,0x63,0x8B,0x69,0x1A,0x7c,0xf0, + 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x26, + 0x01}}, + {{0xA3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[]= +{ /* Checked (1.10.6s) */ + {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f, + 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, + 0x00}}, + {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f, + 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, + 0x00}}, + {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f, + 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, + 0x00}}, + {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f, + 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, + 0x00}}, + {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x08,0x3e, + 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x06, + 0x00}}, + {{0x92,0x63,0x63,0x96,0x6c,0x1a,0x80,0xf0, + 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x06, + 0x01}}, + {{0xae,0x7f,0x7f,0x92,0x88,0x96,0x28,0xf5, + 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa8,0x16,0x28,0x5a, + 0x00,0x84,0xff,0xff,0x29,0x01,0x00,0x07, + 0x01}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1[]= +{ /* Checked (1.10.6s) */ + {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f, + 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f, + 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f, + 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f, + 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0xee,0x1f, + 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05, + 0x00}}, + {{0x83,0x63,0x63,0x87,0x68,0x16,0x66,0xf0, + 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x06, + 0x01}}, + {{0x9f,0x7f,0x7f,0x83,0x84,0x92,0x0e,0xf5, + 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x02, + 0x01}}, + {{0xbf,0x9f,0x9f,0x83,0xa4,0x12,0x0e,0x5a, + 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x07, + 0x01}}, + {{0xce,0xae,0xae,0x92,0xb3,0x01,0x28,0x10, + 0x1a,0x80,0x19,0x19,0x29,0x0f,0x00,0x03, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1[]= +{ /* MISSING */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1_H[]= +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[]= +{ /* TW: Checked (1.10.6s) */ + {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f, + 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f, + 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x4b,0x27,0x27,0x8f,0x32,0x1b,0x04,0x3e, + 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x45, + 0x00}}, + {{0x55,0x31,0x31,0x99,0x46,0x1d,0x7c,0xf0, + 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x55, + 0x01}}, + {{0x63,0x3F,0x3F,0x87,0x4a,0x93,0x24,0xf5, + 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1_H[]= +{ /* Checked (1.10.6s) */ + {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f, + 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, /* <-- Invalid data - one byte missing in BIOS */ + 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06, + 0x01}}, + {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f, + 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, + 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06, + 0x01}}, + {{0x56,0x27,0x27,0x9a,0x30,0x1e,0x08,0x3e, + 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x05, + 0x00}}, + {{0x60,0x31,0x31,0x84,0x3a,0x88,0x80,0xf0, + 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x01, + 0x01}}, + {{0x6e,0x3f,0x3f,0x92,0x48,0x96,0x28,0xf5, + 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1_H[]= +{ /* Checked (1.10.6s) */ + {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, + 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, + 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x27,0x8b,0x30,0x1e,0x9e,0x1f, + 0x92,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, + 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0xee,0x1f, + 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05, + 0x00}}, + {{0x51,0x31,0x31,0x95,0x36,0x04,0x66,0xf0, + 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x01, + 0x01}}, + {{0x5f,0x3f,0x3f,0x83,0x44,0x92,0x0e,0xf5, + 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x01, + 0x01}}, + {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x0e,0x5a, + 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x05, + 0x01}}, + {{0x76,0x56,0x56,0x9a,0x5b,0x89,0x28,0x10, + 0x1c,0x80,0x19,0x19,0x29,0x0b,0x00,0x05, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1_H[]= +{ /* MISSING */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2[]= +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[]= +{ /* Checked (1.10.6s) */ + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2[]= +{ /* Checked (1.10.6s) */ + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2[]= +{ /* Checked (1.10.6s) */ + {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03, + 0x01}}, + {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9e, + 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x03, + 0x00}}, + {{0xce,0x63,0x63,0x92,0x96,0x04,0x28,0xd4, + 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x07, + 0x01}}, + {{0xce,0x7f,0x7f,0x92,0xa4,0x12,0x28,0xd4, + 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xb4,0x02,0x28,0x5a, + 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x03, + 0x01}}, + {{0xce,0xae,0xae,0x92,0xbc,0x0a,0x28,0x10, + 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x03, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2[]= +{ /* MISSING */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2_H[]= +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[]= +{ /* Checked (1.10.6s) */ + {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x8d,0x5d,0x25,0x30,0x00,0x01, /* <-- invalid data */ + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01, /* <-- invalid data */ + 0x01 }}, + {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2_H[]= +{ /* Checked (1.10.6s) */ + {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x31,0x93,0x3e,0x86,0x24,0xf1, + 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2_H[]= +{ /* Checked (1.10.6s) */ + {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9e, + 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x06, + 0x00}}, + {{0x9c,0x31,0x31,0x80,0x64,0x92,0x28,0xd4, + 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x06, + 0x01}}, + {{0x8e,0x3f,0x3f,0x92,0x64,0x12,0x28,0xd4, + 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x06, + 0x01}}, + {{0x7e,0x4f,0x4f,0x82,0x64,0x12,0x28,0x5a, + 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x06, + 0x01}}, + {{0x76,0x56,0x56,0x9a,0x64,0x92,0x28,0x10, + 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x05, + 0x00}} +}; + +static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2_H[]= +{ /* MISSING */ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00}} +}; + +typedef struct _SiS310_LVDSCRT1DataStruct +{ + UCHAR CR[15]; +} SiS310_LVDSCRT1DataStruct; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1320x480_1[] = +{ + {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }}, + {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, + 0x00 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = /* TW: New */ +{ + {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0xfa,0x1f, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = /* TW: New */ +{ + {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, + 0x00}}, + {{0x87,0x63,0x8B,0x67,0x18,0x7c,0xf0, + 0x5A,0x81,0x57,0x7D,0x00,0x00,0x06, + 0x01}}, + {{0xA3,0x7f,0x87,0x83,0x94,0x24,0xf5, + 0x02,0x89,0xFf,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = /* TW: New */ +{ + {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0x08,0x3e, + 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06, + 0x00 }}, + {{0x92,0x63,0x96,0x6a,0x18,0x80,0xf0, + 0x58,0x8c,0x57,0x81,0x20,0x00,0x06, + 0x01 }}, + {{0xae,0x7f,0x92,0x86,0x94,0x28,0xf5, + 0x00,0x84,0xff,0x29,0x10,0x00,0x02, + 0x01 }}, + {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, + 0x00,0x84,0xff,0x29,0x09,0x00,0x07, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = /* TW: New */ +{ + {{0x43,0x27,0x87,0x2d,0x1d,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x4d,0x31,0x91,0x37,0x07,0x72,0xf0, + 0x58,0x8d,0x57,0x73,0x20,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = /* TW: New */ +{ + {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00 }}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, + 0x00}}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, + 0x00}}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, + 0x00}}, + {{0x55,0x31,0x99,0x35,0x06,0x7c,0xf0, + 0x5A,0x81,0x57,0x7D,0x00,0x00,0x01, + 0x01}}, + {{0x63,0x3F,0x87,0x43,0x94,0x24,0xf5, + 0x02,0x89,0xFf,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = /* TW: New */ +{ + {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, + 0x00 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, + 0x00 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, + 0x00 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, + 0x01 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0x08,0x3e, + 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05, + 0x00 }}, + {{0x60,0x31,0x84,0x38,0x86,0x80,0xf0, + 0x58,0x8c,0x57,0x81,0x20,0x00,0x01, + 0x01 }}, + {{0x6e,0x3f,0x92,0x46,0x94,0x28,0xf5, + 0x00,0x84,0xff,0x29,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= /* TW: New */ +{ + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, + 0x27,0x8c,0xdf,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, + 0x58,0x8d,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = /* TW: New */ +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, + 0x01 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x7f,0x86,0xdf,0x25,0x10,0x00,0x06, + 0x00 }}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xbb,0x82,0x57,0x25,0x10,0x00,0x02, + 0x01 }}, + {{0xa3,0x7f,0x87,0x83,0x94,0x24,0xf5, + 0x02,0x89,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = /* TW: New */ +{ + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, + 0x00 }}, + {{0xce,0x63,0x92,0x8b,0x19,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x03, + 0x01 }}, + {{0xce,0x7f,0x92,0x99,0x07,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x07, + 0x01 }}, + {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, + 0x00,0x84,0xff,0x29,0x09,0x00,0x07, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = /* TW: New */ +{ + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0xba, + 0x27,0x8c,0xdf,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x4d,0x31,0x91,0x3a,0x0a,0x72,0xf0, + 0x63,0x88,0x57,0x73,0x00,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = /* TW: New */ +{ + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x7f,0x86,0xdf,0x25,0x10,0x00,0x01, + 0x00 }}, + {{0x71,0x31,0x95,0x46,0x97,0x24,0xf1, + 0xbb,0x82,0x57,0x25,0x10,0x00,0x01, + 0x01 }}, + {{0x63,0x3f,0x87,0x46,0x97,0x24,0xf5, + 0x0f,0x86,0xff,0x25,0x30,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = /* TW: New */ +{ + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, + 0x00 }}, + {{0x9c,0x31,0x80,0x59,0x87,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, + 0x01 }}, + {{0x8e,0x3f,0x92,0x79,0x07,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x06, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = /* TW: New */ +{ + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x07, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = /* TW: New */ +{ + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, + {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, + 0x01}}, + {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = /* TW: New */ +{ + {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, + 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, + 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0xee,0x1f, + 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, + 0x00}}, + {{0x83,0x63,0x87,0x68,0x16,0x66,0xf0, + 0x5a,0x8e,0x57,0x67,0x20,0x00,0x06, + 0x01}}, + {{0x9f,0x7f,0x83,0x84,0x92,0x0e,0xf5, + 0x02,0x86,0xff,0x0f,0x10,0x00,0x02, + 0x01}}, + {{0xbf,0x9f,0x83,0xa4,0x12,0x0e,0x5a, + 0x02,0x86,0xff,0x0f,0x09,0x00,0x07, + 0x01}}, + {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, + 0x1a,0x80,0x19,0x29,0x0f,0x00,0x03, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = /* TW: New */ +{ + {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, + 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f, + 0x92,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f, + 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, + 0x00}}, + {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0, + 0x5a,0x8e,0x57,0x67,0x20,0x00,0x01, + 0x01}}, + {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf5, + 0x02,0x86,0xff,0x0f,0x10,0x00,0x01, + 0x01}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, + 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, + 0x01}}, + {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10, + 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = /* TW: New */ +{ + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x01}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, + 0x00}}, + {{0xce,0x63,0x92,0x96,0x04,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x07, + 0x01}}, + {{0xce,0x7f,0x92,0xa4,0x12,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x92,0xb4,0x02,0x28,0x5a, + 0x13,0x87,0xff,0x29,0x29,0x00,0x03, + 0x01}}, + {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10, + 0x20,0x84,0x19,0x29,0x0f,0x00,0x03, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = /* TW: New */ +{ + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, + 0x00}}, + {{0x9c,0x31,0x80,0x64,0x92,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, + 0x01}}, + {{0x8e,0x3f,0x92,0x64,0x12,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x06, + 0x01}}, + {{0x7e,0x4f,0x82,0x64,0x12,0x28,0x5a, + 0x13,0x87,0xff,0x29,0x29,0x00,0x06, + 0x01}}, + {{0x76,0x56,0x9a,0x64,0x92,0x28,0x10, + 0x20,0x84,0x19,0x29,0x0f,0x00,0x05, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_1[] = /* TW: New */ +{ /* TW: Temp data, invalid */ + {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, + 0x00 }}, + {{0x7e,0x4f,0x82,0x56,0x04,0x08,0x3e, + 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06, + 0x00 }}, + {{0x92,0x63,0x96,0x6a,0x18,0x80,0xf0, + 0x58,0x8c,0x57,0x81,0x20,0x00,0x06, + 0x01 }}, + {{0xae,0x7f,0x92,0x86,0x94,0x28,0xf5, + 0x00,0x84,0xff,0x29,0x10,0x00,0x02, + 0x01 }}, + {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, + 0x00,0x84,0xff,0x29,0x09,0x00,0x07, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_1_H[] = /* TW: New */ +{ /* TW: Temp data, invalid */ + {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, + 0x00 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, + 0x00 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, + 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, + 0x00 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, + 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, + 0x01 }}, + {{0x56,0x27,0x9a,0x2e,0x1c,0x08,0x3e, + 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05, + 0x00 }}, + {{0x60,0x31,0x84,0x38,0x86,0x80,0xf0, + 0x58,0x8c,0x57,0x81,0x20,0x00,0x01, + 0x01 }}, + {{0x6e,0x3f,0x92,0x46,0x94,0x28,0xf5, + 0x00,0x84,0xff,0x29,0x10,0x00,0x01, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_2[] = /* TW: New */ +{ /* TW: Temp data, invalid */ + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x00 }}, + {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, + 0x00 }}, + {{0xce,0x63,0x92,0x8b,0x19,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x03, + 0x01 }}, + {{0xce,0x7f,0x92,0x99,0x07,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x07, + 0x01 }}, + {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, + 0x00,0x84,0xff,0x29,0x09,0x00,0x07, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_2_H[] = /* TW: New */ +{ /* TW: Temp data, invalid */ + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00 }}, + {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, + 0x00 }}, + {{0x9c,0x31,0x80,0x59,0x87,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, + 0x01 }}, + {{0x8e,0x3f,0x92,0x79,0x07,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x06, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba, + 0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = +{ /* TW: Temporary data - invalid */ + {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, + 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, + 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x6f,0x4f,0x93,0x54,0x82,0xee,0x1f, + 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, + 0x00}}, + {{0x83,0x63,0x87,0x68,0x16,0x66,0xf0, + 0x5a,0x8e,0x57,0x67,0x20,0x00,0x06, + 0x01}}, + {{0x9f,0x7f,0x83,0x84,0x92,0x0e,0xf5, + 0x02,0x86,0xff,0x0f,0x10,0x00,0x02, + 0x01}}, + {{0xbf,0x9f,0x83,0xa4,0x12,0x0e,0x5a, + 0x02,0x86,0xff,0x0f,0x09,0x00,0x07, + 0x01}}, + {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, + 0x1a,0x80,0x19,0x29,0x0f,0x00,0x03, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = +{ /* TW: Temporary data - invalid */ + {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, + 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f, + 0x92,0x86,0x8f,0x9f,0x30,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, + 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + 0x00}}, + {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f, + 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, + 0x00}}, + {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0, + 0x5a,0x8e,0x57,0x67,0x20,0x00,0x01, + 0x01}}, + {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf5, + 0x02,0x86,0xff,0x0f,0x10,0x00,0x01, + 0x01}}, + {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, + 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, + 0x01}}, + {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10, + 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = +{ /* TW: Temporary data - invalid */ + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x01}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, + 0x00}}, + {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, + 0x00}}, + {{0xce,0x63,0x92,0x96,0x04,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x07, + 0x01}}, + {{0xce,0x7f,0x92,0xa4,0x12,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x92,0xb4,0x02,0x28,0x5a, + 0x13,0x87,0xff,0x29,0x29,0x00,0x03, + 0x01}}, + {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10, + 0x20,0x84,0x19,0x29,0x0f,0x00,0x03, + 0x00}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = /* TW: New */ +{ /* TW: Temporary data - invalid */ + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, + 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, + 0x00}}, + {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9e, + 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, + 0x00}}, + {{0x9c,0x31,0x80,0x64,0x92,0x28,0xd4, + 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, + 0x01}}, + {{0x8e,0x3f,0x92,0x64,0x12,0x28,0xd4, + 0x93,0x87,0xff,0x29,0x21,0x00,0x06, + 0x01}}, + {{0x7e,0x4f,0x82,0x64,0x12,0x28,0x5a, + 0x13,0x87,0xff,0x29,0x29,0x00,0x06, + 0x01}}, + {{0x76,0x56,0x9a,0x64,0x92,0x28,0x10, + 0x20,0x84,0x19,0x29,0x0f,0x00,0x05, + 0x00}} +}; + + +static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = /* TW: New */ +{ + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x56,0x99,0x56,0xba, + 0x0a,0x84,0xdf,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x80,0x63,0x84,0x6d,0x0f,0xec,0xf0, + 0x7a,0x8f,0x57,0xed,0x20,0x00,0x06, + 0x01 }}, + {{0x8c,0x7f,0x90,0x86,0x09,0xaf,0xf5, /* TW: 1024x768 */ + 0x36,0x88,0xff,0xb0,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = /* TW: New */ +{ + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x58,0x9d,0x0b,0x3e, + 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x7d,0x63,0x81,0x68,0x0e,0xba,0xf0, + 0x78,0x8a,0x57,0xbb,0x20,0x00,0x06, + 0x01 }}, + {{0x8c,0x7f,0x90,0x82,0x06,0x46,0xf5, /* TW: 1024x768 */ + 0x15,0x88,0xff,0x47,0x70,0x00,0x02, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = /* TW: New */ +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x6f,0xba, + 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, + 0x00 }}, + {{0x73,0x63,0x97,0x69,0x8b,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, + 0x01 }}, + {{0xaa,0x7f,0x8e,0x8e,0x96,0xe6,0xf5, /* TW: 1024x768 */ + 0x50,0x88,0xff,0xe7,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = /* TW: New */ +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba, + 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, + 0x00 }}, + {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0, + 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05, + 0x01 }}, + {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */ + 0x28,0x88,0xff,0x6a,0x10,0x00,0x02, + 0x01 }} +}; + +static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1SOPAL[] = /* TW: New */ +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba, + 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, + 0x00 }}, + {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0, + 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05, + 0x01 }}, + {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */ + 0x28,0x88,0xff,0x6a,0x10,0x00,0x02, + 0x01 }} +}; + +/* TW: New data for Chrontel 7019 (From 650/LVDS BIOS 1.10.0) */ +typedef struct _SiS310_CHTVRegDataStruct +{ + UCHAR Reg[16]; +} SiS310_CHTVRegDataStruct; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = +{ + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x6a,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x7e,0x80,0x98,0x00}}, + {{0xcf,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x88,0x30,0x7f,0x00}}, + {{0xee,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xd3,0xf2,0x36,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = +{ + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x69,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x43,0x04,0x00}}, + {{0xce,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1c,0x00,0x82,0x97,0x00}}, + {{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = +{ + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, + {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x1f,0x84,0x3d,0x28,0x00}}, + {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = +{ + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, + {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00}}, + {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_SOPAL[] = +{ + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, + {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00}}, + {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = +{ + {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x72,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x76,0xdb,0x6e,0x00}}, + {{0xd7,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x84,0x0a,0xc7,0x00}}, + {{0xf6,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xdc,0xb0,0x8d,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = +{ + {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x71,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x1f,0x59,0x00}}, + {{0xd6,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1b,0xf8,0x1f,0x82,0x00}}, + {{0xf5,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x58,0x46,0x9f,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = +{ + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}}, + {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x19,0x78,0xef,0x35,0x00}}, + {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x1a,0x33,0x3f,0x2f,0x00}} +}; + +static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] = +{ + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}}, + {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x1f,0x15,0xc0,0x1e,0x00}}, + {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x1d,0xf1,0x6c,0xcb,0x00}} +}; + +static const UCHAR SiS310_CHTVVCLKUNTSC[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; + +static const UCHAR SiS310_CHTVVCLKONTSC[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51}; + +static const UCHAR SiS310_CHTVVCLKUPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; + +static const UCHAR SiS310_CHTVVCLKOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; + +static const UCHAR SiS310_CHTVVCLKSOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; + +static const UCHAR SiS310_CHTVVCLKUPALM[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; + +static const UCHAR SiS310_CHTVVCLKOPALM[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51}; + +static const UCHAR SiS310_CHTVVCLKUPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; + +static const UCHAR SiS310_CHTVVCLKOPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; + +/* TW: New end */ Index: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.26 xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.31 --- xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.26 Wed May 16 09:43:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile Mon Feb 17 12:06:44 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.26 2001/05/16 13:43:17 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.31 2003/02/17 17:06:44 dawes Exp $ XCOMM XCOMM This is an Imakefile for the SIS driver. XCOMM @@ -6,6 +6,12 @@ #define IHaveModules #include <Server.tmpl> +/* DRI static build only works on Linux */ +#if !defined(LinuxArchitecture) && !DoLoadableServer && BuildXF86DRI +#undef BuildXF86DRI +#define BuildXF86DRI NO +#endif + #if BuildXF86DRI DRISRCS = sis_dri.c DRIOBJS = sis_dri.o @@ -15,12 +21,14 @@ #endif SRCS = sis_driver.c sis_dac.c sis_cursor.c sis_accel.c sis_setup.c\ - sis530_accel.c sis300_accel.c sis_vga.c sis_vb.c\ - sis_opt.c sis_dga.c sis_video.c sis_bios.c sis_shadow.c \ + sis300_accel.c sis310_accel.c sis_vga.c sis_vb.c\ + sis_opt.c sis_dga.c sis_video.c init.c init301.c sis_shadow.c \ + sis6326_video.c \ $(DRISRCS) OBJS = sis_driver.o sis_dac.o sis_cursor.o sis_accel.o sis_setup.o\ - sis530_accel.o sis300_accel.o sis_vga.o sis_vb.o\ - sis_opt.o sis_dga.o sis_video.o sis_bios.o sis_shadow.o \ + sis300_accel.o sis310_accel.o sis_vga.o sis_vb.o\ + sis_opt.o sis_dga.o sis_video.o init.o init301.o sis_shadow.o \ + sis6326_video.o \ $(DRIOBJS) #if defined(XF86DriverSDK) @@ -32,7 +40,7 @@ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ -I$(XF86SRC)/xf24_32bpp \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ - -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(XF86OSSRC)/vbe \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(XF86SRC)/vbe \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XTOP)/include/extensions \ @@ -63,11 +71,19 @@ InstallDriverSDKNonExecFile(sis.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis300_accel.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis300_accel.h,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis530_accel.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis530_accel.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis310_accel.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis310_accel.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_accel.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_bios.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_bios.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(init.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(init.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(init301.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(init301.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(osdef.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(initdef.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(300vtbl.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(310vtbl.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(oem300.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(oem310.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_cursor.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_cursor.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dac.c,$(DRIVERSDKDIR)/drivers/sis) @@ -76,6 +92,7 @@ InstallDriverSDKNonExecFile(sis_dri.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dri.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_driver.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_driver.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_opt.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_regs.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_setup.c,$(DRIVERSDKDIR)/drivers/sis) @@ -85,5 +102,6 @@ InstallDriverSDKNonExecFile(sis_vb.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_vga.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_video.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis6326_video.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKObjectModule(sis,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/init.c:1.6 --- /dev/null Thu Feb 27 12:31:36 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init.c Mon Feb 3 21:44:28 2003 @@ -0,0 +1,5968 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.6 2003/02/04 02:44:28 dawes Exp $ */ +/* + * Mode switching code (CRT1 section) for SiS 300/540/630/730/315/550/650/740/330 + * (Universal module for Linux kernel framebuffer and XFree86 4.x) + * + * Assembler-To-C translation + * Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net> + * Minor parts Copyright SiS, Inc. + * + * Based on BIOS + * 1.10.07, 1.10a for SiS650/LVDS+CH7019 + * 1.11.05 for 650/LVDS (w/o Chrontel) + * 1.07.1b, 1.11.6s, 1.11.6w, 1.11.7w, 1.11.8r for SiS650/301(B/LV) + * 2.04.50 (I) and 2.04.5c (II) for SiS630/301(B) + * 2.06.50 for 630/301B (dual VGA) + * 2.02.3b, 2.03.02, 2.04.5c, 2.07a and 2.08.b3 for 630/LVDS/LVDS+CH7005 + * 2.04.5c, 2.04.6c for 730+LVDS+CH7005 + * 1.09b for 315/301(B) + * 1.16.51 for 300+301LVX (ECS A907) + * 1.01.03 for 330 (Xabre 400) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holder makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * TW says: This code looks awful, I know. But please don't do anything about + * this otherwise debugging will be hell. + * The code is extremely fragile as regards the different chipsets, different + * video bridges and combinations thereof. If anything is changed, extreme + * care has to be taken that that change doesn't break it for other chipsets, + * bridges or combinations thereof. + * All comments in this file are by me, regardless if they are marked TW or not. + * + */ + +#include "init.h" + +#ifdef SIS300 +#include "300vtbl.h" +#endif + +#ifdef SIS315H +#include "310vtbl.h" +#endif + +#ifdef LINUX_XF86 +BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); +DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn); +#ifdef SISDUALHEAD /* TW: For dual head */ +BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); +BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode); +#endif /* dual head */ +#endif /* linux_xf86 */ + +#ifdef LINUXBIOS +BOOLEAN SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +#endif + +#ifdef LINUX_XF86 +BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch); +#else +BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo); +#endif + +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(PAGE,SiSSetMode) +#pragma alloc_text(PAGE,SiSInit) +#endif + +static ULONG GetDRAMSize(SiS_Private *SiS_Pr, + PSIS_HW_DEVICE_INFO HwDeviceExtension); + +static void DelaySeconds(int seconds); +void SiS_DebugCode(SiS_Private *SiS_Pr, UCHAR code); + +#ifdef LINUX_XF86 +/* TW: Mode table for X driver */ +const UShort ModeIndex_320x480[] = {0x5a, 0x5b, 0x00, 0x00}; /* DSTN/FSTN */ +const UShort ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c}; +const UShort ModeIndex_640x400[] = {0x2f, 0x5d, 0x00, 0x5e}; +const UShort ModeIndex_640x480[] = {0x2e, 0x44, 0x00, 0x62}; +const UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35}; +const UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36}; +const UShort ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76}; +const UShort ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63}; +const UShort ModeIndex_848x480[] = {0x39, 0x3b, 0x00, 0x3e}; +const UShort ModeIndex_856x480[] = {0x3f, 0x42, 0x00, 0x45}; +const UShort ModeIndex_1024x768[] = {0x38, 0x4a, 0x00, 0x64}; +const UShort ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77}; +const UShort ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */ +const UShort ModeIndex_1280x1024[] = {0x3a, 0x4d, 0x00, 0x65}; +const UShort ModeIndex_300_1280x960[] = {0x6e, 0x6f, 0x00, 0x7b}; +const UShort ModeIndex_310_1280x960[] = {0x7c, 0x7d, 0x00, 0x7e}; +const UShort ModeIndex_1152x768[] = {0x23, 0x24, 0x00, 0x25}; /* 300 series only */ +const UShort ModeIndex_1152x864[] = {0x29, 0x2a, 0x00, 0x2b}; +const UShort ModeIndex_1280x768[] = {0x23, 0x24, 0x00, 0x25}; /* 310/325 series only */ +const UShort ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; +const UShort ModeIndex_1360x768[] = {0x48, 0x4b, 0x00, 0x4e}; +const UShort ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 310/325 series only */ +const UShort ModeIndex_1600x1200[] = {0x3c, 0x3d, 0x00, 0x66}; +const UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b}; +const UShort ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00}; +const UShort ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e}; +#endif + +static void +DelaySeconds(int seconds) +{ + int i; +#ifdef WIN2000 + int j; +#endif + + for (i=0;i<seconds;i++) { +#ifdef TC + delay(1000); +#endif + +#ifdef WIN2000 + for (j=0;j<20000;j++) + VideoPortStallExecution(50); +#endif + +#ifdef WINCE_HEADER +#endif + +#ifdef LINUX_KERNEL +#endif + } +} + +void +SiS_DebugCode(SiS_Private *SiS_Pr, UCHAR code) +{ + OutPortByte(0x80, code); + DelaySeconds(0x3); +} + +#ifdef SIS300 +static void +InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS300_SModeIDTable; + SiS_Pr->SiS_VBModeIDTable = (SiS_VBModeStruct *)SiS300_VBModeIDTable; + SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS300_StandTable; + SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS300_EModeIDTable; + SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS300_RefIndex; + SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS300_CRT1Table; + if(HwDeviceExtension->jChipType == SIS_300) { + SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_300; /* 300 */ + } else { + SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_630; /* 630 */ + } + SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS300_ECLKData; + SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS300_VCLKData; + SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS300_VCLKData; + SiS_Pr->SiS_ScreenOffset = SiS300_ScreenOffset; + SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS300_StResInfo; + SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS300_ModeResInfo; + + SiS_Pr->pSiS_OutputSelect = &SiS300_OutputSelect; + SiS_Pr->pSiS_SoftSetting = &SiS300_SoftSetting; + + SiS_Pr->SiS_SR15 = SiS300_SR15; + +#ifndef LINUX_XF86 + SiS_Pr->pSiS_SR07 = &SiS300_SR07; + SiS_Pr->SiS_CR40 = SiS300_CR40; + SiS_Pr->SiS_CR49 = SiS300_CR49; + SiS_Pr->pSiS_SR1F = &SiS300_SR1F; + SiS_Pr->pSiS_SR21 = &SiS300_SR21; + SiS_Pr->pSiS_SR22 = &SiS300_SR22; + SiS_Pr->pSiS_SR23 = &SiS300_SR23; + SiS_Pr->pSiS_SR24 = &SiS300_SR24; + SiS_Pr->SiS_SR25 = SiS300_SR25; + SiS_Pr->pSiS_SR31 = &SiS300_SR31; + SiS_Pr->pSiS_SR32 = &SiS300_SR32; + SiS_Pr->pSiS_SR33 = &SiS300_SR33; + SiS_Pr->pSiS_CRT2Data_1_2 = &SiS300_CRT2Data_1_2; + SiS_Pr->pSiS_CRT2Data_4_D = &SiS300_CRT2Data_4_D; + SiS_Pr->pSiS_CRT2Data_4_E = &SiS300_CRT2Data_4_E; + SiS_Pr->pSiS_CRT2Data_4_10 = &SiS300_CRT2Data_4_10; + SiS_Pr->pSiS_RGBSenseData = &SiS300_RGBSenseData; + SiS_Pr->pSiS_VideoSenseData = &SiS300_VideoSenseData; + SiS_Pr->pSiS_YCSenseData = &SiS300_YCSenseData; + SiS_Pr->pSiS_RGBSenseData2 = &SiS300_RGBSenseData2; + SiS_Pr->pSiS_VideoSenseData2 = &SiS300_VideoSenseData2; + SiS_Pr->pSiS_YCSenseData2 = &SiS300_YCSenseData2; +#endif + + SiS_Pr->SiS_NTSCPhase = SiS300_NTSCPhase; + SiS_Pr->SiS_PALPhase = SiS300_PALPhase; + SiS_Pr->SiS_NTSCPhase2 = SiS300_NTSCPhase2; + SiS_Pr->SiS_PALPhase2 = SiS300_PALPhase2; + SiS_Pr->SiS_PALMPhase = SiS300_PALMPhase; + SiS_Pr->SiS_PALNPhase = SiS300_PALNPhase; + SiS_Pr->SiS_PALMPhase2 = SiS300_PALMPhase2; + SiS_Pr->SiS_PALNPhase2 = SiS300_PALNPhase2; + + SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_StLCD1024x768Data; + SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1024x768Data; + SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS300_St2LCD1024x768Data; + SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_StLCD1280x1024Data; + SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1280x1024Data; + SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_St2LCD1280x1024Data; + SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS300_NoScaleData1024x768; + SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS300_NoScaleData1280x1024; + SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS300_LCD1280x960Data; + SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1400x1050Data; + SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1600x1200Data; + SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_StLCD1400x1050Data; + SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_StLCD1600x1200Data; + SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS300_NoScaleData1400x1050; + SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS300_NoScaleData1600x1200; + + SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS300_StPALData; + SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS300_ExtPALData; + SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS300_StNTSCData; + SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS300_ExtNTSCData; +#ifdef oldHV + SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS300_St1HiTVData; + SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS300_St2HiTVData; + SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS300_ExtHiTVData; +#endif + + SiS_Pr->SiS_NTSCTiming = SiS300_NTSCTiming; + SiS_Pr->SiS_PALTiming = SiS300_PALTiming; +#ifdef oldHV + SiS_Pr->SiS_HiTVSt1Timing = SiS300_HiTVSt1Timing; + SiS_Pr->SiS_HiTVSt2Timing = SiS300_HiTVSt2Timing; + SiS_Pr->SiS_HiTVTextTiming = SiS300_HiTVTextTiming; + SiS_Pr->SiS_HiTVGroup3Data = SiS300_HiTVGroup3Data; + SiS_Pr->SiS_HiTVGroup3Simu = SiS300_HiTVGroup3Simu; + SiS_Pr->SiS_HiTVGroup3Text = SiS300_HiTVGroup3Text; +#endif + + SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTbl; + SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTblLVDS; + + SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_1; + SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_2; + SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_1; + SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_2; + SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1; + SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2; + SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1; + SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2; + SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_1; + SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_2; + SiS_Pr->SiS_LVDS1280x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x768Data_1; + SiS_Pr->SiS_LVDS1280x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x768Data_2; + SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_1; + SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_2; + SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_1; + SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_2; + SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS300_LVDSXXXxXXXData_1; + SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS320x480Data_1; + SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS640x480Data_1; + SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_1; + SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_2; + SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_1; + SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_2; + SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData; + SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData; + SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; + SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; + SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVSOPALData; + SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS300_PanelType00_1; + SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS300_PanelType01_1; + SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS300_PanelType02_1; + SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS300_PanelType03_1; + SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1; + SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS300_PanelType05_1; + SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS300_PanelType06_1; + SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS300_PanelType07_1; + SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS300_PanelType08_1; + SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS300_PanelType09_1; + SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_1; + SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_1; + SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_1; + SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_1; + SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_1; + SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_1; + SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS300_PanelType00_2; + SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS300_PanelType01_2; + SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS300_PanelType02_2; + SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS300_PanelType03_2; + SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2; + SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS300_PanelType05_2; + SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS300_PanelType06_2; + SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS300_PanelType07_2; + SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS300_PanelType08_2; + SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS300_PanelType09_2; + SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_2; + SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_2; + SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_2; + SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_2; + SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_2; + SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_2; + SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUNTSCDesData; + SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVONTSCDesData; + SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUPALDesData; + SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVOPALDesData; + SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1; + SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1; + SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1; + SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1; + SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1; + SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1_H; + SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1_H; + SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1_H; + SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1_H; + SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1_H; + SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2; + SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2; + SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2; + SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2; + SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2; + SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2_H; + SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2_H; + SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2_H; + SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2_H; + SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2_H; + SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1SOPAL; + SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; + SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; + SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; + SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_SOPAL; + SiS_Pr->SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC; + SiS_Pr->SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC; + SiS_Pr->SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL; + SiS_Pr->SiS_CHTVVCLKOPAL = SiS300_CHTVVCLKOPAL; + SiS_Pr->SiS_CHTVVCLKUPALM = SiS300_CHTVVCLKUNTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVVCLKOPALM = SiS300_CHTVVCLKONTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVVCLKUPALN = SiS300_CHTVVCLKUPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVVCLKOPALN = SiS300_CHTVVCLKOPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVVCLKSOPAL = SiS300_CHTVVCLKSOPAL; + + /* TW: New from 300/301LV BIOS */ + SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_1; + SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_1; + SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_1; + SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_1; + SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_2; + SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_2; + SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_2; + SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_2; + SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_3; + SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_3; + SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_3; + SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_3; + + /* TW: LCDResInfo will on 300 series be translated to 310/325 series definitions */ + SiS_Pr->SiS_Panel320x480 = Panel_320x480; + SiS_Pr->SiS_Panel640x480 = Panel_640x480; + SiS_Pr->SiS_Panel800x600 = Panel_800x600; + SiS_Pr->SiS_Panel1024x768 = Panel_1024x768; + SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024; + SiS_Pr->SiS_Panel1280x960 = Panel_1280x960; + SiS_Pr->SiS_Panel1024x600 = Panel_1024x600; + SiS_Pr->SiS_Panel1152x768 = Panel_1152x768; + SiS_Pr->SiS_Panel1600x1200 = 16; /* TW: Something illegal */ + SiS_Pr->SiS_Panel1400x1050 = 16; /* TW: Something illegal */ + SiS_Pr->SiS_Panel1152x864 = 16; /* TW: Something illegal */ + SiS_Pr->SiS_Panel1280x768 = 16; /* TW: Something illegal */ + SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */ + SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: Lowest value LVDS */ + SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */ +} +#endif + +#ifdef SIS315H +static void +InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS310_SModeIDTable; + SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS310_StandTable; + SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS310_EModeIDTable; + SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex; + SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS310_CRT1Table; + /* TW: MCLK is different */ + if(HwDeviceExtension->jChipType == SIS_330) { + SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_330; /* 330 */ + } else if(HwDeviceExtension->jChipType > SIS_315PRO) { + SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_650; /* 550, 650 */ + } else { + SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_315; /* 315 */ + } + SiS_Pr->SiS_MCLKData_1 = (SiS_MCLKDataStruct *)SiS310_MCLKData_1; + SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS310_ECLKData; + SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS310_VCLKData; + SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS310_VBVCLKData; + SiS_Pr->SiS_ScreenOffset = SiS310_ScreenOffset; + SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS310_StResInfo; + SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS310_ModeResInfo; + + SiS_Pr->pSiS_OutputSelect = &SiS310_OutputSelect; + SiS_Pr->pSiS_SoftSetting = &SiS310_SoftSetting; + + SiS_Pr->SiS_SR15 = SiS310_SR15; + +#ifndef LINUX_XF86 + SiS_Pr->pSiS_SR07 = &SiS310_SR07; + SiS_Pr->SiS_CR40 = SiS310_CR40; + SiS_Pr->SiS_CR49 = SiS310_CR49; + SiS_Pr->pSiS_SR1F = &SiS310_SR1F; + SiS_Pr->pSiS_SR21 = &SiS310_SR21; + SiS_Pr->pSiS_SR22 = &SiS310_SR22; + SiS_Pr->pSiS_SR23 = &SiS310_SR23; + SiS_Pr->pSiS_SR24 = &SiS310_SR24; + SiS_Pr->SiS_SR25 = SiS310_SR25; + SiS_Pr->pSiS_SR31 = &SiS310_SR31; + SiS_Pr->pSiS_SR32 = &SiS310_SR32; + SiS_Pr->pSiS_SR33 = &SiS310_SR33; + SiS_Pr->pSiS_CRT2Data_1_2 = &SiS310_CRT2Data_1_2; + SiS_Pr->pSiS_CRT2Data_4_D = &SiS310_CRT2Data_4_D; + SiS_Pr->pSiS_CRT2Data_4_E = &SiS310_CRT2Data_4_E; + SiS_Pr->pSiS_CRT2Data_4_10 = &SiS310_CRT2Data_4_10; + SiS_Pr->pSiS_RGBSenseData = &SiS310_RGBSenseData; + SiS_Pr->pSiS_VideoSenseData = &SiS310_VideoSenseData; + SiS_Pr->pSiS_YCSenseData = &SiS310_YCSenseData; + SiS_Pr->pSiS_RGBSenseData2 = &SiS310_RGBSenseData2; + SiS_Pr->pSiS_VideoSenseData2 = &SiS310_VideoSenseData2; + SiS_Pr->pSiS_YCSenseData2 = &SiS310_YCSenseData2; +#endif + + SiS_Pr->SiS_NTSCPhase = SiS310_NTSCPhase; + SiS_Pr->SiS_PALPhase = SiS310_PALPhase; + SiS_Pr->SiS_NTSCPhase2 = SiS310_NTSCPhase2; + SiS_Pr->SiS_PALPhase2 = SiS310_PALPhase2; + SiS_Pr->SiS_PALMPhase = SiS310_PALMPhase; + SiS_Pr->SiS_PALNPhase = SiS310_PALNPhase; + SiS_Pr->SiS_PALMPhase2 = SiS310_PALMPhase2; + SiS_Pr->SiS_PALNPhase2 = SiS310_PALNPhase2; + SiS_Pr->SiS_SpecialPhase = SiS310_SpecialPhase; + + SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_StLCD1024x768Data; + SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1024x768Data; + SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS310_St2LCD1024x768Data; + SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_StLCD1280x1024Data; + SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1280x1024Data; + SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_St2LCD1280x1024Data; + SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS310_NoScaleData1024x768; + SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS310_NoScaleData1280x1024; + SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS310_LCD1280x960Data; + SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1400x1050Data; + SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1600x1200Data; + SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_StLCD1400x1050Data; + SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_StLCD1600x1200Data; + SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS310_NoScaleData1400x1050; + SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS310_NoScaleData1600x1200; + + SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS310_StPALData; + SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS310_ExtPALData; + SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS310_StNTSCData; + SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS310_ExtNTSCData; +#ifdef oldHV + SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS310_St1HiTVData; + SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS310_St2HiTVData; + SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS310_ExtHiTVData; +#endif + + SiS_Pr->SiS_NTSCTiming = SiS310_NTSCTiming; + SiS_Pr->SiS_PALTiming = SiS310_PALTiming; +#ifdef oldHV + SiS_Pr->SiS_HiTVSt1Timing = SiS310_HiTVSt1Timing; + SiS_Pr->SiS_HiTVSt2Timing = SiS310_HiTVSt2Timing; + SiS_Pr->SiS_HiTVTextTiming = SiS310_HiTVTextTiming; + SiS_Pr->SiS_HiTVExtTiming = SiS310_HiTVExtTiming; + SiS_Pr->SiS_HiTVGroup3Data = SiS310_HiTVGroup3Data; + SiS_Pr->SiS_HiTVGroup3Simu = SiS310_HiTVGroup3Simu; + SiS_Pr->SiS_HiTVGroup3Text = SiS310_HiTVGroup3Text; +#endif + + SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTbl; + SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTblLVDS; + + SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_1; + SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_2; + SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_1; + SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_2; + SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_1; + SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_2; + SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_1; + SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_2; + SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_1; + SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_2; + SiS_Pr->SiS_LVDS1280x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x768Data_1; + SiS_Pr->SiS_LVDS1280x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x768Data_2; + SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_1; + SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_2; + SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_1; + SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_2; + SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS310_LVDSXXXxXXXData_1; + SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS320x480Data_1; + SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS640x480Data_1; + SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_1; + SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_2; + SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_1; + SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_2; + SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVUNTSCData; + SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVONTSCData; + SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALData; + SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALData; + SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALMData; + SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALMData; + SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALNData; + SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALNData; + SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVSOPALData; + SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS310_PanelType00_1; + SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS310_PanelType01_1; + SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS310_PanelType02_1; + SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS310_PanelType03_1; + SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS310_PanelType04_1; + SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS310_PanelType05_1; + SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS310_PanelType06_1; + SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS310_PanelType07_1; + SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS310_PanelType08_1; + SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS310_PanelType09_1; + SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_1; + SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_1; + SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_1; + SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_1; + SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_1; + SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_1; + SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS310_PanelType00_2; + SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS310_PanelType01_2; + SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS310_PanelType02_2; + SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS310_PanelType03_2; + SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS310_PanelType04_2; + SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS310_PanelType05_2; + SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS310_PanelType06_2; + SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS310_PanelType07_2; + SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS310_PanelType08_2; + SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS310_PanelType09_2; + SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_2; + SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_2; + SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_2; + SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_2; + SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_2; + SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_2; + + SiS_Pr->LVDS1024x768Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_1; + SiS_Pr->LVDS1280x1024Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_1; + SiS_Pr->LVDS1400x1050Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_1 ; + SiS_Pr->LVDS1600x1200Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_1 ; + SiS_Pr->LVDS1024x768Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_2; + SiS_Pr->LVDS1280x1024Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_2; + SiS_Pr->LVDS1400x1050Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_2; + SiS_Pr->LVDS1600x1200Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_2 ; + + /* TW: New from 650/301LV BIOS */ + SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_1; + SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_1; + SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_1; + SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_1; + SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_2; + SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_2; + SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_2; + SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_2; + SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_3; + SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_3; + SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_3; + SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_3; + + SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUNTSCDesData; + SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVONTSCDesData; + SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUPALDesData; + SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVOPALDesData; + + SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1; + SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1; + SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1; + SiS_Pr->SiS_LVDSCRT11400x1050_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1; + SiS_Pr->SiS_LVDSCRT11280x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_1; + SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1; + SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1; + SiS_Pr->SiS_LVDSCRT11600x1200_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1; + SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1_H; + SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1_H; + SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1_H; + SiS_Pr->SiS_LVDSCRT11400x1050_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1_H; + SiS_Pr->SiS_LVDSCRT11280x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_1_H; + SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1_H; + SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1_H; + SiS_Pr->SiS_LVDSCRT11600x1200_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1_H; + SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2; + SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2; + SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2; + SiS_Pr->SiS_LVDSCRT11400x1050_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2; + SiS_Pr->SiS_LVDSCRT11280x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_2; + SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2; + SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2; + SiS_Pr->SiS_LVDSCRT11600x1200_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2; + SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2_H; + SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2_H; + SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2_H; + SiS_Pr->SiS_LVDSCRT11400x1050_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2_H; + SiS_Pr->SiS_LVDSCRT11280x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_2_H; + SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2_H; + SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2_H; + SiS_Pr->SiS_LVDSCRT11600x1200_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2_H; + SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1XXXxXXX_1; + SiS_Pr->SiS_LVDSCRT1320x480_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1320x480_1; + SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1SOPAL; + SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UNTSC; + SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_ONTSC; + SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPAL; + SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALM; + SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALM; + SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALN; + SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALN; + SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_SOPAL; + SiS_Pr->SiS_LCDACRT1800x600_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1; + SiS_Pr->SiS_LCDACRT11024x768_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1; + SiS_Pr->SiS_LCDACRT11280x1024_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1; + SiS_Pr->SiS_LCDACRT11400x1050_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1; + SiS_Pr->SiS_LCDACRT11600x1200_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1; + SiS_Pr->SiS_LCDACRT1800x600_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1_H; + SiS_Pr->SiS_LCDACRT11024x768_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1_H; + SiS_Pr->SiS_LCDACRT11280x1024_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1_H; + SiS_Pr->SiS_LCDACRT11400x1050_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1_H; + SiS_Pr->SiS_LCDACRT11600x1200_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1_H; + SiS_Pr->SiS_LCDACRT1800x600_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2; + SiS_Pr->SiS_LCDACRT11024x768_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2; + SiS_Pr->SiS_LCDACRT11280x1024_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2; + SiS_Pr->SiS_LCDACRT11400x1050_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2; + SiS_Pr->SiS_LCDACRT11600x1200_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2; + SiS_Pr->SiS_LCDACRT1800x600_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2_H; + SiS_Pr->SiS_LCDACRT11024x768_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2_H; + SiS_Pr->SiS_LCDACRT11280x1024_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2_H; + SiS_Pr->SiS_LCDACRT11400x1050_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2_H; + SiS_Pr->SiS_LCDACRT11600x1200_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2_H; + SiS_Pr->SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC; + SiS_Pr->SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC; + SiS_Pr->SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL; + SiS_Pr->SiS_CHTVVCLKOPAL = SiS310_CHTVVCLKOPAL; + SiS_Pr->SiS_CHTVVCLKUPALM = SiS310_CHTVVCLKUPALM; + SiS_Pr->SiS_CHTVVCLKOPALM = SiS310_CHTVVCLKOPALM; + SiS_Pr->SiS_CHTVVCLKUPALN = SiS310_CHTVVCLKUPALN; + SiS_Pr->SiS_CHTVVCLKOPALN = SiS310_CHTVVCLKOPALN; + SiS_Pr->SiS_CHTVVCLKSOPAL = SiS310_CHTVVCLKSOPAL; + + SiS_Pr->SiS_Panel320x480 = Panel_320x480; + SiS_Pr->SiS_Panel640x480 = Panel_640x480; + SiS_Pr->SiS_Panel800x600 = Panel_800x600; + SiS_Pr->SiS_Panel1024x768 = Panel_1024x768; + SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024; + SiS_Pr->SiS_Panel1280x960 = Panel_1280x960; + SiS_Pr->SiS_Panel1600x1200 = Panel_1600x1200; + SiS_Pr->SiS_Panel1400x1050 = Panel_1400x1050; + SiS_Pr->SiS_Panel1152x768 = Panel_1152x768; + SiS_Pr->SiS_Panel1152x864 = Panel_1152x864; + SiS_Pr->SiS_Panel1280x768 = Panel_1280x768; + SiS_Pr->SiS_Panel1024x600 = Panel_1024x600; + SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */ + SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: lowest value LVDS/LCDA */ + SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */ +} +#endif + +#ifdef LINUXBIOS +/* -------------- SiSInit -----------------*/ +/* TW: I degraded this for LINUXBIOS only, because we + * don't need this otherwise. Under normal + * circumstances, the video BIOS has initialized + * the adapter for us. BTW, this code is incomplete + * and very possibly not functioning on newer chipsets. + */ +BOOLEAN +SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + UCHAR i, temp=0; + UCHAR SR11; +#ifdef LINUX_KERNEL + UCHAR temp1; + ULONG base; +#endif + UCHAR SR13=0, SR14=0, SR16=0 + UCHAR SR17=0, SR19=0, SR1A=0; +#ifdef SIS300 + UCHAR SR18=0, SR12=0; +#endif +#ifdef SIS315H + UCHAR CR37=0, CR38=0, CR79=0, + UCHAR CR7A=0, CR7B=0, CR7C=0; + UCHAR SR1B=0, SR15=0; + PSIS_DSReg pSR; + ULONG Temp; +#endif + UCHAR VBIOSVersion[5]; + + if(FBAddr==0) return (FALSE); + if(BaseAddr==0) return (FALSE); + + SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* Misc */ + +#ifdef SIS315H + if(HwDeviceExtension->jChipType > SIS_315PRO) { + if(!HwDeviceExtension->bIntegratedMMEnabled) + return (FALSE); + } +#endif + + SiS_MemoryCopy(VBIOSVersion,HwDeviceExtension->szVBIOSVer,4); + VBIOSVersion[4]= 0x00; + + SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); + + /* TW: Init pointers */ +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) + InitTo310Pointer(SiS_Pr, HwDeviceExtension); +#endif + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) || + (HwDeviceExtension->jChipType == SIS_300)) + InitTo300Pointer(SiS_Pr, HwDeviceExtension); +#endif + + /* TW: Set SiS Register definitions */ + SiSRegInit(SiS_Pr, BaseAddr); + + /* TW: Determine LVDS/CH70xx/TRUMPION */ + SiS_Set_LVDS_TRUMPION(SiS_Pr, HwDeviceExtension); + + /* TW: Unlock registers */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); + +#ifdef LINUX_KERNEL + +#ifdef SIS300 /* Set SR14 */ + if((HwDeviceExtension->jChipType==SIS_540) || + (HwDeviceExtension->jChipType==SIS_630) || + (HwDeviceExtension->jChipType==SIS_730)) { + base=0x80000060; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 >>= (16+8+4); + temp1 &= 0x07; + temp1++; + temp1 = 1 << temp1; + SR14 = temp1 - 1; + base = 0x80000064; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 &= 0x00000020; + if(temp1) SR14 |= 0x80; + else SR14 |= 0x40; + } +#endif + +#ifdef SIS315H /* Set SR14 */ + if(HwDeviceExtension->jChipType == SIS_550) { + base = 0x80000060; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 >>= (16+8+4); + temp1 &= 0x07; + temp1++; + temp1 = 1 << temp1; + SR14 = temp1 - 1; + base = 0x80000064; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 &= 0x00000020; + if(temp1) SR14 |= 0x80; + else SR14 |= 0x40; + } + + if((HwDeviceExtension->jChipType == SIS_740) || /* Set SR14 */ + (HwDeviceExtension->jChipType == SIS_650)) { + base = 0x80000064; + OutPortLong(base,0xcf8); + temp1=InPortLong(0xcfc); + temp1 >>= 4; + temp1 &= 0x07; + if(temp1 > 2) { + temp = temp1; + switch(temp) { + case 3: temp1 = 0x07; break; + case 4: temp1 = 0x0F; break; + case 5: temp1 = 0x1F; break; + case 6: temp1 = 0x05; break; + case 7: temp1 = 0x17; break; + case 8: break; + case 9: break; + } + } + SR14 = temp1; + base = 0x8000007C; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 &= 0x00000020; + if(temp1) SR14 |= 0x80; + } +#endif + +#endif /* Linux kernel */ + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_540)|| + (HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)) { + SR12 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x12); + SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); + SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17); + SR18 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); + SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19); + SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); + } else if(HwDeviceExtension->jChipType == SIS_300){ + SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); + SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + } +#endif +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_650)) { + SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19); + SR19 = (SR19)||0x01; /* TW: ??? || ??? */ + if(SR19==0x00) { + SR13 = 0x22; + SR14 = 0x00; + SR15 = 0x01; + SR16 = 0x00; + SR17 = 0x00; + SR1A = 0x00; + SR1B = 0x00; + CR37 = 0x00; + CR38 = 0x00; + CR79 = 0x00; + CR7A = 0x00; + CR7B = 0x00; + CR7C = 0x00; + } else { + SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); + SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + SR15 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15); + SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17); + SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); + SR1B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1B); + CR37 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); /* TW: Was 0x02 - why? */ + CR38 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + CR79 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79); + CR7A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7A); + CR7B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7B); + CR7C = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7C); + } + } +#endif + + /* Reset extended registers */ + + for(i=0x06; i< 0x20; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); + for(i=0x21; i<=0x27; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); + for(i=0x31; i<=0x3D; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) || + (HwDeviceExtension->jChipType == SIS_300)) { + for(i=0x38; i<=0x3F; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0); + } +#endif + +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) { + for(i=0x12; i<=0x1B; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); + for(i=0x79; i<=0x7C; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0); + } +#endif + + /* Restore Extended Registers */ + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); + } +#endif + +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_650)) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,SR15); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1B,SR1B); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,CR37); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,CR38); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x79,CR79); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7A,CR7A); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7B,CR7B); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7C,CR7C); + } +#endif + +#ifdef SIS300 + if((HwDeviceExtension->jChipType==SIS_540) || + (HwDeviceExtension->jChipType==SIS_630) || + (HwDeviceExtension->jChipType==SIS_730)) { + temp = (UCHAR)SR1A & 0x03; + } else if(HwDeviceExtension->jChipType == SIS_300) { + /* TW: Nothing */ + } +#endif +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_330) ) { + if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) { + temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A) & 0x03; + } + } + if((HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_650)) { + if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) { + temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07; + } + } +#endif + + SiS_Pr->SiS_RAMType = temp; + SiS_SetMemoryClock(SiS_Pr, ROMAddr, HwDeviceExtension); + + /* Set default register contents */ + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x07,*SiS_Pr->pSiS_SR07); /* DAC speed */ + + if((HwDeviceExtension->jChipType != SIS_540) && + (HwDeviceExtension->jChipType != SIS_630) && + (HwDeviceExtension->jChipType != SIS_730)){ + for(i=0x15;i<0x1C;i++) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SiS_Pr->SiS_SR15[i-0x15][SiS_Pr->SiS_RAMType]); + } + } + +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_330)) { + for(i=0x40;i<=0x44;i++) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,SiS_Pr->SiS_CR40[i-0x40][SiS_Pr->SiS_RAMType]); + } + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x48,0x23); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[0]); + /* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); */ + } +#endif + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,*SiS_Pr->pSiS_SR1F); /* DAC pedestal */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xA0); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x23,*SiS_Pr->pSiS_SR23); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x24,*SiS_Pr->pSiS_SR24); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); + +#ifdef SIS300 + if(HwDeviceExtension->jChipType == SIS_300) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,0x84); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,0x00); + } +#endif + + SR11 = 0x0F; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x11,SR11); /* Power Management & DDC port */ + + SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,*SiS_Pr->pSiS_CRT2Data_1_2); + +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2E,0x08); /* use VB */ +#endif + + temp = *SiS_Pr->pSiS_SR32; + if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)) { + temp &= 0xEF; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_330)) { + HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp); + Temp >>= 20; + Temp &= 0xF; + if (Temp != 1) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[1]); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[1]); + } + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x27,0x1F); + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,*SiS_Pr->pSiS_SR31); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,*SiS_Pr->pSiS_SR32); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x33,*SiS_Pr->pSiS_SR33); + } +#endif + + if (SiS_BridgeIsOn(SiS_Pr, BaseAddr) == 0) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1C); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0D,*SiS_Pr->pSiS_CRT2Data_4_D); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0E,*SiS_Pr->pSiS_CRT2Data_4_E); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,*SiS_Pr->pSiS_CRT2Data_4_10); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0F,0x3F); + } + SiS_LockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + } + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x83,0x00); + +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_330)) { + if(HwDeviceExtension->bSkipDramSizing==TRUE) { + SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr,HwDeviceExtension); + pSR = HwDeviceExtension->pSR; + if(pSR != NULL) { + while(pSR->jIdx != 0xFF) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,pSR->jIdx,pSR->jVal); + pSR++; + } + } + } else SiS_SetDRAMSize_310(SiS_Pr, HwDeviceExtension); + } +#endif + +#ifdef SIS315H + if(HwDeviceExtension->jChipType == SIS_550) { + /* SetDRAMConfig begin */ +/* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); */ + /* SetDRAMConfig end */ + } +#endif + +#ifdef SIS300 + if(HwDeviceExtension->jChipType == SIS_300) { + if (HwDeviceExtension->bSkipDramSizing == TRUE) { +/* SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension); + temp = (HwDeviceExtension->pSR)->jVal; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,temp); + temp = (HwDeviceExtension->pSR)->jVal; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,temp); */ + } else { +#ifdef TC + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x15,0xFF,0x04); +#else + SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension); + SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension); +#endif + } + } + if((HwDeviceExtension->jChipType==SIS_540)|| + (HwDeviceExtension->jChipType==SIS_630)|| + (HwDeviceExtension->jChipType==SIS_730)) { +#if 0 + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); +#endif + } +/* SetDRAMSize end */ +#endif /* SIS300 */ + + /* Set default Ext2Regs */ +#if 0 + AGP=1; + temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); + temp &= 0x30; + if(temp == 0x30) AGP=0; + if(AGP == 0) *SiS_Pr->pSiS_SR21 &= 0xEF; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21); + if(AGP == 1) *SiS_Pr->pSiS_SR22 &= 0x20; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22); +#endif + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22); + +#if 0 + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff); + SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8); +#endif + +#ifdef LINUXBIOS /* TW: This is not needed for our purposes */ + SiS_DetectMonitor(SiS_Pr, HwDeviceExtension,BaseAddr); /* Sense CRT1 */ + SiS_GetSenseStatus(SiS_Pr, HwDeviceExtension,ROMAddr); /* Sense CRT2 */ +#endif + + return(TRUE); +} + +void +SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp = 0; + +#ifdef SiS300 + if((HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) { + /* TW: Read POWER_ON_TRAP and copy to CR37 */ + temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); + temp = (temp & 0xE0) >> 4; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp); + } +#endif +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) { +#if 0 /* TW: This is not required */ + /* TW: Read POWER_ON_TRAP and copy to CR37 */ + temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); + temp = (temp & 0xE0) >> 4; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp); +#endif + } +#endif + + SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, 0); +} + +/* =============== SiS 300 dram sizing begin =============== */ +#ifdef SIS300 +void +SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; + USHORT SR13, SR14=0, buswidth, Done; + SHORT i, j, k; + USHORT data, TotalCapacity, PhysicalAdrOtherPage=0; + ULONG Addr; + UCHAR temp; + int PseudoRankCapacity, PseudoTotalCapacity, PseudoAdrPinCount; + int RankCapacity, AdrPinCount, BankNumHigh, BankNumMid, MB2Bank; + int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage; + + SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e); + + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */ + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0xBF); + + buswidth = SiS_ChkBUSWidth_300(SiS_Pr, FBAddr); + + MB2Bank = 16; + Done = 0; + for(i=6; i>=0; i--) { + if(Done == 1) break; + PseudoRankCapacity = 1 << i; + for(j=4; j>=1; j--) { + if(Done == 1) break; + PseudoTotalCapacity = PseudoRankCapacity * j; + PseudoAdrPinCount = 15 - j; + if(PseudoTotalCapacity <= 64) { + for(k=0; k<=16; k++) { + if(Done == 1) break; + RankCapacity = buswidth * SiS_DRAMType[k][3]; + AdrPinCount = SiS_DRAMType[k][2] + SiS_DRAMType[k][0]; + if(RankCapacity == PseudoRankCapacity) + if(AdrPinCount <= PseudoAdrPinCount) { + if(j == 3) { /* Rank No */ + BankNumHigh = RankCapacity * MB2Bank * 3 - 1; + BankNumMid = RankCapacity * MB2Bank * 1 - 1; + } else { + BankNumHigh = RankCapacity * MB2Bank * j - 1; + BankNumMid = RankCapacity * MB2Bank * j / 2 - 1; + } + PageCapacity = (1 << SiS_DRAMType[k][1]) * buswidth * 4; + PhysicalAdrHigh = BankNumHigh; + PhysicalAdrHalfPage = (PageCapacity / 2 + PhysicalAdrHigh) % PageCapacity; + PhysicalAdrOtherPage = PageCapacity * SiS_DRAMType[k][2] + PhysicalAdrHigh; + /* Write data */ + /*Test*/ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x15,0xFB); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x15,0x04); + /*/Test*/ + TotalCapacity = SiS_DRAMType[k][3] * buswidth; + SR13 = SiS_DRAMType[k][4]; + if(buswidth == 4) SR14 = (TotalCapacity - 1) | 0x80; + if(buswidth == 2) SR14 = (TotalCapacity - 1) | 0x40; + if(buswidth == 1) SR14 = (TotalCapacity - 1) | 0x00; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); + + Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh; + *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHigh; + Addr = FBAddr + (BankNumMid) * 64 * 1024 + PhysicalAdrHigh; + *((USHORT *)(Addr)) = (USHORT)BankNumMid; + Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHalfPage; + *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHalfPage; + Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrOtherPage; + *((USHORT *)(Addr)) = PhysicalAdrOtherPage; + + /* Read data */ + Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh; + data = *((USHORT *)(Addr)); + if(data == PhysicalAdrHigh) Done = 1; + } /* if struct */ + } /* for loop (k) */ + } /* if struct */ + } /* for loop (j) */ + } /* for loop (i) */ +} + +USHORT +SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress) +{ + PULONG pVideoMemory; + + pVideoMemory = (PULONG)FBAddress; + + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + if (pVideoMemory[3]==0xCDEF0123L) { /* Channel A 128bit */ + return(4); + } + if (pVideoMemory[1]==0x456789ABL) { /* Channel B 64bit */ + return(2); + } + return(1); +} +#endif +/* =============== SiS 300 dram sizing end =============== */ + +/* ============ SiS 310/325 dram sizing begin ============== */ +#ifdef SIS315H + +/* TW: Moved Get310DRAMType further down */ + +void +SiS_Delay15us(SiS_Private *SiS_Pr, ULONG ulMicrsoSec) +{ +} + +void +SiS_SDR_MRS(SiS_Private *SiS_Pr, ) +{ + USHORT data; + + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + data &= 0x3F; /* SR16 D7=0, D6=0 */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) low */ + SiS_Delay15us(SiS_Pr, 0x100); + data |= 0x80; /* SR16 D7=1, D6=0 */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) high */ + SiS_Delay15us(SiS_Pr, 0x100); +} + +void +SiS_DDR_MRS(SiS_Private *SiS_Pr) +{ + USHORT data; + + /* SR16 <- 1F,DF,2F,AF */ + + /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */ + data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + data &= 0x0F; + data |= 0x10; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); + + if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10)) + data &= 0x0F; + + /* SR16 D7=1,D6=1 */ + data |= 0xC0; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); + + /* SR16 D7=1,D6=0,D5=1,D4=0 */ + data &= 0x0F; + data |= 0x20; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); + if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10)) + data &= 0x0F; + + /* SR16 D7=1 */ + data |= 0x80; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); +} + +void +SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + if (SiS_Get310DRAMType(ROMAddr,HwDeviceExtension) < 2) + SiS_SDR_MRS(SiS_Pr); + else + /* SR16 <- 0F,CF,0F,8F */ + SiS_DDR_MRS(SiS_Pr); +} + +void +SiS_DisableRefresh(SiS_Private *SiS_Pr) +{ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x17,0xF8); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x19,0x03); +} + +void +SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr) +{ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SiS_Pr->SiS_SR15[2][SiS_Pr->SiS_RAMType]); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SiS_Pr->SiS_SR15[4][SiS_Pr->SiS_RAMType]); +} + +void +SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index, + USHORT SiS_DDRDRAM_TYPE[][5]) +{ + USHORT data; + + data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15); + data &= 0x1F; + switch (SiS_DDRDRAM_TYPE[index][3]) + { + case 64: data |= 0; break; + case 32: data |= 0x20; break; + case 16: data |= 0x40; break; + case 4: data |= 0x60; break; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data); +} + +void +SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index, USHORT DRAMTYPE_TABLE[][5]) +{ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,DRAMTYPE_TABLE[index][4]); + /* should delay 50 ns */ +} + +void +SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT data, temp; + PULONG volatile pVideoMemory; + + pVideoMemory = (PULONG)FBAddress; + + if(HwDeviceExtension->jChipType == SIS_330) temp = 1; + else temp = 2; + + if(SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < temp) { + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00); + if(HwDeviceExtension->jChipType != SIS_330) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x12); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); + } + /* should delay */ + SiS_SDR_MRS(SiS_Pr); + + SiS_Pr->SiS_ChannelAB = 0; + SiS_Pr->SiS_DataBusWidth = 128; + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + pVideoMemory[4] = 0x55555555L; + pVideoMemory[5] = 0x55555555L; + pVideoMemory[6] = 0xFFFFFFFFL; + pVideoMemory[7] = 0xFFFFFFFFL; + if((pVideoMemory[3] != 0xCDEF0123L) || (pVideoMemory[2] != 0x89ABCDEFL)) { + /* Channel A 64Bit */ + SiS_Pr->SiS_DataBusWidth = 64; + SiS_Pr->SiS_ChannelAB = 0; + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x14, 0xFD); + } + if((pVideoMemory[1] != 0x456789ABL) || (pVideoMemory[0] != 0x01234567L)) { + /* Channel B 64Bit */ + SiS_Pr->SiS_DataBusWidth = 64; + SiS_Pr->SiS_ChannelAB = 1; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x14,0xfd,0x01); + } + return; + + } else { + + /* DDR Dual channel */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); /* Channel A, 64bit */ + /* should delay */ + SiS_DDR_MRS(SiS_Pr); + + SiS_Pr->SiS_ChannelAB = 0; + SiS_Pr->SiS_DataBusWidth = 64; + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + pVideoMemory[4] = 0x55555555L; + pVideoMemory[5] = 0x55555555L; + pVideoMemory[6] = 0xAAAAAAAAL; + pVideoMemory[7] = 0xAAAAAAAAL; + + if (pVideoMemory[1] == 0x456789ABL) { + if (pVideoMemory[0] == 0x01234567L) { + /* Channel A 64bit */ + return; + } + } else { + if (pVideoMemory[0] == 0x01234567L) { + /* Channel A 32bit */ + SiS_Pr->SiS_DataBusWidth = 32; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x00); + return; + } + } + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x03); /* Channel B, 64bit */ + SiS_DDR_MRS(SiS_Pr); + + SiS_Pr->SiS_ChannelAB = 1; + SiS_Pr->SiS_DataBusWidth = 64; + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + pVideoMemory[4] = 0x55555555L; + pVideoMemory[5] = 0x55555555L; + pVideoMemory[6] = 0xAAAAAAAAL; + pVideoMemory[7] = 0xAAAAAAAAL; + if(pVideoMemory[1] == 0x456789ABL) { + /* Channel B 64 */ + if(pVideoMemory[0] == 0x01234567L) { + /* Channel B 64bit */ + return; + } else { + /* error */ + } + } else { + if(pVideoMemory[0] == 0x01234567L) { + /* Channel B 32 */ + SiS_Pr->SiS_DataBusWidth = 32; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x01); + } else { + /* error */ + } + } + } +} + +int +SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5]) +{ + USHORT data; + int RankSize; + + if ((RankNo==2)&&(DRAMTYPE_TABLE[index][0]==2)) + return 0; + + RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32; + + if (RankNo * RankSize <= 128) { + data = 0; + while((RankSize >>= 1) > 0) { + data += 0x10; + } + data |= (RankNo - 1) << 2; + data |= (SiS_Pr->SiS_DataBusWidth / 64) & 2; + data |= SiS_Pr->SiS_ChannelAB; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data); + /* should delay */ + SiS_SDR_MRS(SiS_Pr); + return 1; + } else + return 0; +} + +int +SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo, + USHORT DRAMTYPE_TABLE[][5]) +{ + USHORT data; + int RankSize; + + RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32; + /* RankSize = DRAMTYPE_TABLE[index][3]; */ + if (ChannelNo * RankSize <= 128) { + data = 0; + while((RankSize >>= 1) > 0) { + data += 0x10; + } + if(ChannelNo == 2) data |= 0x0C; + data |= (SiS_Pr->SiS_DataBusWidth / 32) & 2; + data |= SiS_Pr->SiS_ChannelAB; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data); + /* should delay */ + SiS_DDR_MRS(SiS_Pr); + return 1; + } else + return 0; +} + +int +SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +{ + int i; + ULONG Increment,Position; + + /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 1); */ + Increment = 1 << (10 + SiS_Pr->SiS_DataBusWidth / 64); + + for (i=0,Position=0;i<2;i++) { + *((PULONG)(FBAddress + Position)) = Position; + Position += Increment; + } + + for (i=0,Position=0;i<2;i++) { +/* if (FBAddress[Position]!=Position) */ + if((*(PULONG)(FBAddress + Position)) != Position) + return 0; + Position += Increment; + } + return 1; +} + +int +SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +{ + int i; + ULONG Increment,Position; + Increment = 1 << (DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 2); + + for (i=0,Position=0;i<4;i++) { +/* FBAddress[Position]=Position; */ + *((PULONG)(FBAddress + Position)) = Position; + Position += Increment; + } + + for (i=0,Position=0;i<4;i++) { +/* if (FBAddress[Position]!=Position) */ + if((*(PULONG)(FBAddress + Position)) != Position) + return 0; + Position += Increment; + } + return 1; +} + +int +SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +{ + int i; + ULONG Increment,Position; + Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] + + DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo); + + for (i=0,Position=0;i<2;i++) { +/* FBAddress[Position]=Position; */ + *((PULONG)(FBAddress+Position))=Position; + /* *((PULONG)(FBAddress))=Position; */ + Position += Increment; + } + + for (i=0,Position=0;i<2;i++) { +/* if (FBAddress[Position]!=Position) */ + if ( (*(PULONG) (FBAddress + Position)) !=Position) + /*if ( (*(PULONG) (FBAddress )) !=Position) */ + return 0; + Position += Increment; + } + return 1; +} + +int +SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +{ + ULONG Increment,Position; + USHORT data; + + Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] + + DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo); + + Increment += Increment/2; + + Position =0; + *((PULONG)(FBAddress+Position + 0)) = 0x01234567; + *((PULONG)(FBAddress+Position + 1)) = 0x456789AB; + *((PULONG)(FBAddress+Position + 2)) = 0x55555555; + *((PULONG)(FBAddress+Position + 3)) = 0x55555555; + *((PULONG)(FBAddress+Position + 4)) = 0xAAAAAAAA; + *((PULONG)(FBAddress+Position + 5)) = 0xAAAAAAAA; + + if ( (*(PULONG) (FBAddress + 1)) == 0x456789AB) + return 1; + + if ( (*(PULONG) (FBAddress + 0)) == 0x01234567) + return 0; + + data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + data &= 0xF3; + data |= 0x08; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data); + data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15); + data += 0x20; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data); + + return 1; +} + +int +SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +{ + int r; + + for (r=RankNo;r>=1;r--) { + if (!SiS_CheckRank(SiS_Pr, r, index, DRAMTYPE_TABLE, FBAddress)) + return 0; + } + if (!SiS_CheckBanks(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress)) + return 0; + + if (!SiS_CheckColumn(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress)) + return 0; + + return 1; +} + +int +SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5], + ULONG FBAddress) +{ + int r; + + for (r=RankNo;r>=1;r--) { + if (!SiS_CheckDDRRank(SiS_Pr, r,index,DRAMTYPE_TABLE,FBAddress)) + return 0; + } + if (!SiS_CheckBanks(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress)) + return 0; + + if (!SiS_CheckColumn(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress)) + return 0; + + return 1; +} + +int +SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress) +{ + int i; + UCHAR j; + + for (i=0;i<13;i++) { + SiS_SetDRAMSizingType(SiS_Pr, i, SiS_SDRDRAM_TYPE); + for (j=2;j>0;j--) { + if (!SiS_SetRank(SiS_Pr, i,(UCHAR) j, SiS_SDRDRAM_TYPE)) + continue; + else { + if (SiS_CheckRanks(SiS_Pr, j,i,SiS_SDRDRAM_TYPE, FBAddress)) + return 1; + } + } + } + return 0; +} + +int +SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress) +{ + + int i; + UCHAR j; + + for (i=0; i<4; i++){ + SiS_SetDRAMSizingType(SiS_Pr, i, SiS_DDRDRAM_TYPE); + SiS_DisableChannelInterleaving(SiS_Pr, i, SiS_DDRDRAM_TYPE); + for (j=2; j>0; j--) { + SiS_SetDDRChannel(SiS_Pr, i, j, SiS_DDRDRAM_TYPE); + if (!SiS_SetRank(SiS_Pr, i, (UCHAR) j, SiS_DDRDRAM_TYPE)) + continue; + else { + if (SiS_CheckDDRRanks(SiS_Pr, j, i, SiS_DDRDRAM_TYPE, FBAddress)) + return 1; + } + } + } + return 0; +} + +/* + check if read cache pointer is correct +*/ +void +SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr) +{ + PUCHAR pVideoMemory = (PUCHAR) FBAddr; + UCHAR i, j; + USHORT Temp,SR21; + + pVideoMemory[0] = 0xaa; /* alan */ + pVideoMemory[16] = 0x55; /* note: PCI read cache is off */ + + if((pVideoMemory[0] != 0xaa) || (pVideoMemory[16] != 0x55)) { + for (i=0,j=16; i<2; i++,j+=16) { + SR21 = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21); + Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,Temp); + + Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x3C); + Temp |= 0x01; /* MCLK reset */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp); + Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3C); + Temp &= 0xFE; /* MCLK normal operation */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,SR21); + + pVideoMemory[16+j] = j; + if(pVideoMemory[16+j] == j) { + pVideoMemory[j] = j; + break; + } + } + } +} + +/* TW: Is this a 315E? */ +int +Is315E(SiS_Private *SiS_Pr) +{ + USHORT data; + + data = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5F); + if(data & 0x10) return 1; + else return 0; +} + +/* TW: For 315 only */ +void +SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; + USHORT data; + +#ifdef SIS301 /* TW: SIS301 ??? */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x40); */ +#endif +#ifdef SIS302 /* TW: SIS302 ??? */ + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x4D); /* alan,should change value */ + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0xc0); /* alan,should change value */ + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,0x3F); /* alan,should change value */ +#endif + + SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e); + + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x21,0xDF); /* disable read cache */ + + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */ + + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x16,0x0F); /* assume lowest speed DRAM */ + + SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr, HwDeviceExtension); + SiS_DisableRefresh(SiS_Pr); + SiS_CheckBusWidth_310(SiS_Pr, ROMAddr, FBAddr, HwDeviceExtension); + + SiS_VerifyMclk(SiS_Pr, FBAddr); + + if(HwDeviceExtension->jChipType == SIS_330) temp = 1; + else temp = 2; + + if(SiS_Get310DRAMType(SiS_Pr, ROMAddr, HwDeviceExtension) < temp) + SiS_SDRSizing(SiS_Pr, FBAddr); + else + SiS_DDRSizing(SiS_Pr, FBAddr); + + if(HwDeviceExtension->jChipType != SIS_330) { + if(Is315E(SiS_Pr)) { + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + if((data & 0x0C) == 0x0C) { /* dual channel */ + if((data & 0xF0) > 0x40) + data = (data & 0x0F) | 0x40; + } else { /* single channel */ + if((data & 0xF0) > 0x50) + data = (data & 0x0F) | 0x50; + } + } + } + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType]); /* restore SR16 */ + + SiS_EnableRefresh(SiS_Pr, ROMAddr); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x21,0x20); /* enable read cache */ +} +#endif + +void +SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR28); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR29); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2A,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR2A); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2E); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2F); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x30,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR30); + +#ifdef SIS315H + if (Is315E(SiS_Pr)) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,0x3B); /* 143 */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,0x22); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,0x3B); /* 143 */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,0x22); + } +#endif +} + +#endif /* ifdef LINUXBIOS */ + +#ifdef SIS315H +UCHAR +SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR data, temp; + + if(*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) { + data = *SiS_Pr->pSiS_SoftSetting & 0x03; + } else { + if((HwDeviceExtension->jChipType > SIS_315PRO) && + (HwDeviceExtension->jChipType < SIS_330)) { + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07; + } else { /* TW: 315, 330 */ + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3a) & 0x03; + if(HwDeviceExtension->jChipType == SIS_330) { + if(data > 1) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0x30; + switch(temp) { + case 0x00: data = 1; break; + case 0x10: data = 3; break; + case 0x20: data = 3; break; + case 0x30: data = 2; break; + } + } else { + data = 0; + } + } + } + } + + return data; +} +#endif + +/* SiSInit END */ + +/* ----------------------------------------- */ + +void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr) +{ + SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; + SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; + SiS_Pr->SiS_P3c0 = BaseAddr + 0x10; + SiS_Pr->SiS_P3ce = BaseAddr + 0x1e; + SiS_Pr->SiS_P3c2 = BaseAddr + 0x12; + SiS_Pr->SiS_P3ca = BaseAddr + 0x1a; + SiS_Pr->SiS_P3c6 = BaseAddr + 0x16; + SiS_Pr->SiS_P3c7 = BaseAddr + 0x17; + SiS_Pr->SiS_P3c8 = BaseAddr + 0x18; + SiS_Pr->SiS_P3c9 = BaseAddr + 0x19; + SiS_Pr->SiS_P3da = BaseAddr + 0x2A; + SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; /* Digital video interface registers (LCD) */ + SiS_Pr->SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; /* 301 TV Encoder registers */ + SiS_Pr->SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; /* 301 Macrovision registers */ + SiS_Pr->SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */ + SiS_Pr->SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14+2; /* 301 palette address port registers */ + SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; /* DDC Port ( = P3C4, SR11/0A) */ +} + +void +SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ +/* #ifdef LINUX_XF86 */ + if ((HwDeviceExtension->jChipType == SIS_540)|| + (HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)|| + (HwDeviceExtension->jChipType == SIS_300)) { + /* TW: Set - PCI LINEAR ADDRESSING ENABLE (0x80) + - PCI IO ENABLE (0x20) + - MMIO ENABLE (0x1) + */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1); + /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */ + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A); + } + if((HwDeviceExtension->jChipType == SIS_315H)|| + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO)|| + (HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) { + /* TW: This seems to be done the same way on these chipsets */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A); + } +/* #endif */ +} + +void +SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) +{ + ULONG temp; + + SiS_Pr->SiS_IF_DEF_LVDS = 0; + SiS_Pr->SiS_IF_DEF_TRUMPION = 0; + SiS_Pr->SiS_IF_DEF_CH70xx = 0; + SiS_Pr->SiS_IF_DEF_HiVision = 0; + SiS_Pr->SiS_IF_DEF_DSTN = 0; + SiS_Pr->SiS_IF_DEF_FSTN = 0; + + SiS_Pr->SiS_ChrontelInit = 0; + + if((ModeNo == 0x5a) || (ModeNo == 0x5b)) { + SiS_Pr->SiS_IF_DEF_DSTN = 1; /* for 550 dstn */ + SiS_Pr->SiS_IF_DEF_FSTN = 1; /* for fstn */ + } + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) + { + /* TW: Check for SiS30x first */ + temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00); + if((temp == 1) || (temp == 2)) return; + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); + temp = (temp & 0x0E) >> 1; + if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1; + if((temp == 4) || (temp == 5)) { + /* TW: Save power status (and error check) - UNUSED */ + SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e); + SiS_Pr->SiS_IF_DEF_CH70xx = 1; + } + } +#endif +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) + { + /* TW: CR37 is different on 310/325 series */ + if(SiS_Pr->SiS_IF_DEF_FSTN) /* fstn: set CR37=0x04 */ + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x04); /* (fake LVDS bridge) */ + + temp=SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); + temp = (temp & 0x0E) >> 1; + if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) { + SiS_Pr->SiS_IF_DEF_CH70xx = 2; + } + + /* HiVision (HDTV) is done differently now. */ + /* SiS_Pr->SiS_IF_DEF_HiVision = 1; */ + } +#endif +} + +void +SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO) || + (HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_330)) + InitTo310Pointer(SiS_Pr, HwDeviceExtension); +#endif + +#ifdef SIS300 + if ((HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) || + (HwDeviceExtension->jChipType == SIS_300)) + InitTo300Pointer(SiS_Pr, HwDeviceExtension); +#endif +} + +void +SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr) +{ + if((ROMAddr) && (HwDeviceExtension->UseROM)) { + if((ROMAddr[0x00] != 0x55) || (ROMAddr[0x01] != 0xAA)) { + SiS_Pr->SiS_UseROM = FALSE; + } else if(HwDeviceExtension->jChipType == SIS_300) { + /* TW: 300: We check if the code starts below 0x220 by + * checking the jmp instruction at the beginning + * of the BIOS image. + */ + if((ROMAddr[3] == 0xe9) && + ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a) + SiS_Pr->SiS_UseROM = TRUE; + else SiS_Pr->SiS_UseROM = FALSE; + } else if(HwDeviceExtension->jChipType < SIS_315H) { + /* TW: Rest of 300 series: We don't use the ROM image if + * the BIOS version < 2.0.0 as such old BIOSes don't + * have the needed data at the expected locations. + */ + if(ROMAddr[0x06] < '2') SiS_Pr->SiS_UseROM = FALSE; + else SiS_Pr->SiS_UseROM = TRUE; + } else { + /* TW: 310/325/330 series stick to the standard */ + SiS_Pr->SiS_UseROM = TRUE; + } + } else SiS_Pr->SiS_UseROM = FALSE; + +} + +/* + ========================================= + ======== SiS SetMode Functions ========== + ========================================= +*/ +#ifdef LINUX_XF86 +/* TW: This is used for non-Dual-Head mode from X */ +BOOLEAN +SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, + DisplayModePtr mode, BOOLEAN IsCustom) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort ModeNo=0; + + SiS_Pr->UseCustomMode = FALSE; + + if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n", + SiS_Pr->CHDisplay, SiS_Pr->CVDisplay); + + return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE)); + + } + + ModeNo = SiS_CalcModeIndex(pScrn, mode); + if(!ModeNo) return FALSE; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting mode 0x%x\n", ModeNo); + + return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE)); +} + +#ifdef SISDUALHEAD +/* TW: Set CRT1 mode (used for dual head) */ +BOOLEAN +SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, + DisplayModePtr mode, BOOLEAN IsCustom) +{ + ULONG temp; + USHORT ModeIdIndex; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + SISPtr pSiS = SISPTR(pScrn); + SISEntPtr pSiSEnt = pSiS->entityPrivate; + unsigned char backupreg=0; + BOOLEAN backupcustom; + + UShort ModeNo=0; + + SiS_Pr->UseCustomMode = FALSE; + + if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting custom mode %dx%d in CRT1\n", + SiS_Pr->CHDisplay, SiS_Pr->CVDisplay); + ModeNo = 0xfe; + + } else { + + ModeNo = SiS_CalcModeIndex(pScrn, mode); + if(!ModeNo) return FALSE; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting mode 0x%x on CRT1\n", ModeNo); + } + + SiSInitPtr(SiS_Pr, HwDeviceExtension); + + SiSRegInit(SiS_Pr, BaseAddr); + + SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); + + SiSInitPCIetc(SiS_Pr, HwDeviceExtension); + + SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo); + + SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); + + /* TW: We don't clear the buffer under X */ + SiS_Pr->SiS_flag_clearbuffer = 0; + + /* 1.Openkey */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); + + SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + + if(!SiS_Pr->UseCustomMode) { + /* 2.Get ModeID Table */ + temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex); + if(temp == 0) return(0); + } else { + ModeIdIndex = 0; + } + + /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ + SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension); + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + } else { + backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + } + } + + SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension); + + /* TW: Get VB information (connectors, connected devices) */ + /* (We don't care if the current mode is a CRT2 mode) */ + SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,0); + SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) { + /* TW: I am not sure the flag's name is correct */ + if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA; + } + + /* TW: New from 650/LV 1.10.6x */ + if(IS_SIS650740) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); + } + } + } + + /* TW: Set mode on CRT1 */ + SiS_SetCRT1Group(SiS_Pr, ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + + pSiSEnt->CRT1ModeNo = ModeNo; + pSiSEnt->CRT1DMode = mode; + + /* TW: SetPitch: Adapt to virtual size & position */ + SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr); + + /* We have to reset CRT2 if changing mode on CRT1 */ + if(pSiSEnt->CRT2ModeNo != -1) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "(Re-)Setting mode 0x%x on CRT2\n", + pSiSEnt->CRT2ModeNo); + backupcustom = SiS_Pr->UseCustomMode; + if(SiS_Pr->UseCustomMode) { + SiS_Pr->CRT1UsesCustomMode = TRUE; + } else { + SiS_Pr->CRT1UsesCustomMode = FALSE; + } + SiSBIOSSetModeCRT2(SiS_Pr, HwDeviceExtension, pSiSEnt->pScrn_1, + pSiSEnt->CRT2DMode); + SiS_Pr->UseCustomMode = backupcustom; + SiS_Pr->CRT1UsesCustomMode = FALSE; + } + + if(IS_SIS650740) { /* TW: *** For 650 only! *** */ + SiS_HandleCRT1(SiS_Pr); + } + + SiS_DisplayOn(SiS_Pr); + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); + + /* TW: New from 650/LV 1.10.6x and 1.10.7w, 630/301B 2.06.50 */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg); + } else if((HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg); + } + } + + /* Backup/Set ModeNo in BIOS scratch area */ + SiS_GetSetModeID(pScrn,ModeNo); + + return TRUE; +} + +/* TW: Set CRT2 mode (used for dual head) */ +BOOLEAN +SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, + DisplayModePtr mode) +{ + ULONG temp; + USHORT ModeIdIndex; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + UShort ModeNo = 0; + SISPtr pSiS = SISPTR(pScrn); + SISEntPtr pSiSEnt = pSiS->entityPrivate; + unsigned char tempr1, tempr2, backupreg=0; + + SiS_Pr->UseCustomMode = FALSE; + + ModeNo = SiS_CalcModeIndex(pScrn, mode); + if(!ModeNo) return FALSE; + + SiSInitPtr(SiS_Pr, HwDeviceExtension); + + SiSRegInit(SiS_Pr, BaseAddr); + + SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); + + SiSInitPCIetc(SiS_Pr, HwDeviceExtension); + + SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo); + + SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); + + /* TW: We don't clear the buffer under X */ + SiS_Pr->SiS_flag_clearbuffer=0; + + /* TW: Save ModeNo so we can set it from within SetMode for CRT1 */ + pSiSEnt->CRT2ModeNo = ModeNo; + pSiSEnt->CRT2DMode = mode; + + /* TW: We can't set CRT2 mode before CRT1 mode is set */ + if(pSiSEnt->CRT1ModeNo == -1) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting CRT2 mode delayed until after setting CRT1 mode\n"); + return TRUE; + } + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting mode 0x%x on CRT2\n", ModeNo); + + /* 1.Openkey */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); + + SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + + /* 2.Get ModeID */ + temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex); + if(temp == 0) return(0); + + /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ + SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension); + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); + if(HwDeviceExtension->jChipType < SIS_330) { + if(ROMAddr && SiS_Pr->SiS_UseROM) { + temp = ROMAddr[VB310Data_1_2_Offset]; + temp |= 0x40; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp); + } + } + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); + + SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x02,0x0c); + + backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + } else { + backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + } + } + + /* TW: Get VB information (connectors, connected devices) */ + SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension); + SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,1); + SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) { + /* TW: I am not sure the flag's name is correct */ + if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA; + } + } + + /* Set mode on CRT2 */ + switch (HwDeviceExtension->ujVBChipID) { + case VB_CHIP_301: + case VB_CHIP_301B: + case VB_CHIP_301LV: + case VB_CHIP_301LVX: + case VB_CHIP_302: + case VB_CHIP_302B: + case VB_CHIP_302LV: + case VB_CHIP_302LVX: + SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); + break; + case VB_CHIP_303: + break; + case VB_CHIP_UNKNOWN: + if (SiS_Pr->SiS_IF_DEF_LVDS == 1 || + SiS_Pr->SiS_IF_DEF_CH70xx != 0 || + SiS_Pr->SiS_IF_DEF_TRUMPION != 0) { + SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); + } + break; + } + + SiS_DisplayOn(SiS_Pr); + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); + } + } + } + + /* TW: New from 650/LV 1.10.6x and 1.10.7w, 630 2.06.50 */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); + } + + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg); + + tempr1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + tempr2 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00); + if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7; + if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,tempr2); + + if(tempr1 & SetCRT2ToLCD) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); + } + } else if((HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg); + } + } + + /* TW: SetPitch: Adapt to virtual size & position */ + SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr); + + return TRUE; +} +#endif /* Dualhead */ +#endif /* Linux_XF86 */ + +#ifdef LINUX_XF86 +/* TW: We need pScrn for setting the pitch correctly */ +BOOLEAN +SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch) +#else +BOOLEAN +SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) +#endif +{ + ULONG temp; + USHORT ModeIdIndex,KeepLockReg; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + unsigned char backupreg=0, tempr1, tempr2; + +#ifndef LINUX_XF86 + SiS_Pr->UseCustomMode = FALSE; + SiS_Pr->CRT1UsesCustomMode = FALSE; +#endif + + if(SiS_Pr->UseCustomMode) { + ModeNo = 0xfe; + } + + SiSInitPtr(SiS_Pr, HwDeviceExtension); + + SiSRegInit(SiS_Pr, BaseAddr); + +#ifdef LINUX_XF86 + if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); + else +#endif + SiS_Pr->SiS_VGAINFO = 0x11; + + SiSInitPCIetc(SiS_Pr, HwDeviceExtension); + + SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo); + + SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); + + if(!SiS_Pr->UseCustomMode) { + /* TW: Shift the clear-buffer-bit away */ + ModeNo = ((ModeNo & 0x80) << 8) | (ModeNo & 0x7f); + } + +#ifdef LINUX_XF86 + /* TW: We never clear the buffer in X */ + ModeNo |= 0x8000; +#endif + + if(ModeNo & 0x8000) { + ModeNo &= 0x7fff; + SiS_Pr->SiS_flag_clearbuffer = 0; + } else { + SiS_Pr->SiS_flag_clearbuffer = 1; + } + + /* 1.Openkey */ + KeepLockReg = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x05); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); + + SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + + if(!SiS_Pr->UseCustomMode) { + + /* 2.Get ModeID Table */ + temp = SiS_SearchModeID(SiS_Pr,ROMAddr,&ModeNo,&ModeIdIndex); + if(temp == 0) return(0); + + } else { + + ModeIdIndex = 0; + + } + + /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ + SiS_GetVBType(SiS_Pr,BaseAddr,HwDeviceExtension); + + /* TW: Init/restore some VB registers */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); + if(HwDeviceExtension->jChipType < SIS_330) { + if(ROMAddr && SiS_Pr->SiS_UseROM) { + temp = ROMAddr[VB310Data_1_2_Offset]; + temp |= 0x40; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp); + } + } + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); + + SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x02,0x0c); + + backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + } else { + backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + } + } + + /* TW: Get VB information (connectors, connected devices) */ + SiS_SetHiVision(SiS_Pr,BaseAddr,HwDeviceExtension); + SiS_GetVBInfo(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,1); + SiS_GetLCDResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + /* 3. Check memory size */ + temp = SiS_CheckMemorySize(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex); + if(!temp) return(0); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) { + /* TW: I am not sure the flag's name is correct */ + if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA; + } + + /* TW: New from 650/LV 1.10.6x */ + if(IS_SIS650740) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); + } + } + } + + /* TW: Set mode on CRT1 */ + if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { + SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + } else { + if(!(SiS_Pr->SiS_VBInfo & SwitchToCRT2)) { + SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + } + } + + /* TW: Set mode on CRT2 */ + if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) { + switch (HwDeviceExtension->ujVBChipID) { + case VB_CHIP_301: + case VB_CHIP_301B: + case VB_CHIP_301LV: + case VB_CHIP_301LVX: + case VB_CHIP_302: + case VB_CHIP_302B: + case VB_CHIP_302LV: + case VB_CHIP_302LVX: + SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); + break; + case VB_CHIP_303: + break; + case VB_CHIP_UNKNOWN: + if(SiS_Pr->SiS_IF_DEF_LVDS == 1 || + SiS_Pr->SiS_IF_DEF_CH70xx != 0 || + SiS_Pr->SiS_IF_DEF_TRUMPION != 0) + SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); + break; + } + } + + if(IS_SIS650740) { /* TW: For 650 only! */ + SiS_HandleCRT1(SiS_Pr); + } + + SiS_DisplayOn(SiS_Pr); + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); + + if(HwDeviceExtension->jChipType >= SIS_315H) { +#if 0 + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + SiS_Handle301B_1400x1050(SiS_Pr, ModeNo); + } + } +#endif + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); + } + } + } + + /* TW: New from 650/LV 1.10.6x and 1.10.7w */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); + } + + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg); + + tempr1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + tempr2 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00); + if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7; + if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,tempr2); + + if((IS_SIS650740) && (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) { + if((ModeNo == 0x03) || (ModeNo == 0x10)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80); + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08); + } + } + + if(tempr1 & SetCRT2ToLCD) { +/* if(ModeNo <= 0x13) { - not in 1.10.8r */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); +/* } */ + } + } else if((HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg); + } + } + +#ifdef LINUX_XF86 + if(pScrn) { + /* TW: SetPitch: Adapt to virtual size & position */ + if((ModeNo > 0x13) && (dosetpitch)) { + SiS_SetPitch(SiS_Pr, pScrn, BaseAddr); + } + + /* Backup/Set ModeNo in BIOS scratch area */ + SiS_GetSetModeID(pScrn, ModeNo); + } +#endif + +#ifndef LINUX_XF86 /* TW: We never lock registers in XF86 */ + if(KeepLockReg == 0xA1) SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); + else SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x00); +#endif + + return TRUE; +} + +void +SiS_SetEnableDstn(SiS_Private *SiS_Pr) /* TW: Called from sis_main.c */ +{ + /* For 550 dstn */ + SiS_Pr->SiS_IF_DEF_DSTN = 1; +} + +void +SiS_HandleCRT1(SiS_Private *SiS_Pr) +{ + /* TW: Do this on 650 only! */ + + /* TW: No, we don't do this at all. There is a new + * CRT1-is-connected-at-boot-time logic in the 650, which + * confuses our own. So just clear the bit and skip the rest. + */ + + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf); + +#if 0 + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15) & 0x01)) + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x63,0x40); + } +#endif +} + +#if 0 +void +SiS_Handle301B_1400x1050(SiS_Private *SiS_Pr, USHORT ModeNo) +{ + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { + if(ModeNo <= 0x13) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (SetNotSimuMode >> 8)) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xFC); + } + } + } +} +#endif + +void +SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr) +{ + USHORT StandTableIndex,RefreshRateTableIndex; + + SiS_Pr->SiS_CRT1Mode = ModeNo; + StandTableIndex = SiS_GetModePtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2)) { + SiS_DisableBridge(SiS_Pr,HwDeviceExtension,BaseAddr); + } + } + + SiS_SetSeqRegs(SiS_Pr,ROMAddr,StandTableIndex); + SiS_SetMiscRegs(SiS_Pr,ROMAddr,StandTableIndex); + SiS_SetCRTCRegs(SiS_Pr,ROMAddr,HwDeviceExtension,StandTableIndex); + SiS_SetATTRegs(SiS_Pr,ROMAddr,StandTableIndex,HwDeviceExtension); + SiS_SetGRCRegs(SiS_Pr,ROMAddr,StandTableIndex); + SiS_ClearExt1Regs(SiS_Pr,HwDeviceExtension); + SiS_ResetCRT1VCLK(SiS_Pr,ROMAddr,HwDeviceExtension); + + SiS_Pr->SiS_SelectCRT2Rate = 0; + SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); + +#ifdef LINUX_XF86 + xf86DrvMsgVerb(0, X_PROBED, 3, "(init: VBType=0x%04x, VBInfo=0x%04x)\n", + SiS_Pr->SiS_VBType, SiS_Pr->SiS_VBInfo); +#endif + + if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } + } + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } + + RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + SiS_Pr->SiS_SetFlag &= ~ProgrammingCRT2; + } + + if(RefreshRateTableIndex != 0xFFFF) { + SiS_SetSync(SiS_Pr,ROMAddr,RefreshRateTableIndex); + SiS_SetCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); + SiS_SetCRT1Offset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); + SiS_SetCRT1VCLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,RefreshRateTableIndex); + } + +#ifdef SIS300 + if(HwDeviceExtension->jChipType == SIS_300) { + SiS_SetCRT1FIFO_300(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex); + } + if((HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) || + (HwDeviceExtension->jChipType == SIS_540)) { + SiS_SetCRT1FIFO_630(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex); + } +#endif +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetCRT1FIFO_310(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + } +#endif + + SiS_SetCRT1ModeRegs(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,RefreshRateTableIndex); + + SiS_LoadDAC(SiS_Pr,HwDeviceExtension,ROMAddr,ModeNo,ModeIdIndex); + +#ifndef LINUX_XF86 + if(SiS_Pr->SiS_flag_clearbuffer) { + SiS_ClearBuffer(SiS_Pr,HwDeviceExtension,ModeNo); + } +#endif + + if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) { + SiS_LongWait(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + } +} + +#ifdef LINUX_XF86 +void +SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr) +{ + SISPtr pSiS = SISPTR(pScrn); + + /* TW: We need to set pitch for CRT1 if bridge is in SlaveMode, too */ + if( (pSiS->VBFlags & DISPTYPE_DISP1) || + ( (pSiS->VBFlags & VB_VIDEOBRIDGE) && + ( ((pSiS->VGAEngine == SIS_300_VGA) && (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0xa0) == 0x20) || + ((pSiS->VGAEngine == SIS_315_VGA) && (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x50) == 0x10) ) ) ) { + SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr); + } + if (pSiS->VBFlags & DISPTYPE_DISP2) { + SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr); + } +} + +void +SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr) +{ + SISPtr pSiS = SISPTR(pScrn); + ULong HDisplay,temp; + + HDisplay = pSiS->scrnPitch / 8; + SiS_SetReg1(SiS_Pr->SiS_P3d4, 0x13, (HDisplay & 0xFF)); + temp = (SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x0E) & 0xF0) | (HDisplay>>8); + SiS_SetReg1(SiS_Pr->SiS_P3c4, 0x0E, temp); +} + +void +SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr) +{ + SISPtr pSiS = SISPTR(pScrn); + ULong HDisplay,temp; + + HDisplay = pSiS->scrnPitch / 8; + + /* Unlock CRT2 */ + if (pSiS->VGAEngine == SIS_315_VGA) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01); + else + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01); + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07, (HDisplay & 0xFF)); + temp = (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x09) & 0xF0) | ((HDisplay >> 8) & 0xFF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09, temp); +} +#endif + +/* TW: Checked against 650/301 and 630/301B BIOS */ +/* TW: Re-written for 650/301LVx 1.10.6s BIOS */ +void +SiS_GetVBType(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT flag=0, rev=0, nolcd=0; + + SiS_Pr->SiS_VBType = 0; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) return; + + flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00); + + /* TW: Illegal values not welcome... */ + if(flag > 10) return; + + rev = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x01); + + if (flag >= 2) { + SiS_Pr->SiS_VBType = VB_SIS302B; + } else if (flag == 1) { + SiS_Pr->SiS_VBType = VB_SIS301; + if(rev >= 0xB0) { + SiS_Pr->SiS_VBType = VB_SIS301B; + if((HwDeviceExtension->jChipType >= SIS_315H) || + (HwDeviceExtension->jChipType == SIS_300)) { + /* 650/301LV and 300/301LV use this, 630/301B does not */ + nolcd = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x23); + if(!(nolcd & 0x02)) + SiS_Pr->SiS_VBType |= VB_NoLCD; + } + } + } + if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) { + if(rev >= 0xD0) { + SiS_Pr->SiS_VBType &= ~(VB_SIS301B | VB_SIS302B); + SiS_Pr->SiS_VBType |= VB_SIS30xLV; + SiS_Pr->SiS_VBType &= ~(VB_NoLCD); + if(rev >= 0xE0) { + SiS_Pr->SiS_VBType &= ~(VB_SIS30xLV); + SiS_Pr->SiS_VBType |= VB_SIS30xNEW; + } + } + } +} + +/* TW: Checked against 650/301LVx 1.10.6s */ +BOOLEAN +SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex) +{ + UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; + + if(*ModeNo <= 0x13) { + + if((*ModeNo) <= 5) (*ModeNo) |= 1; + + for(*ModeIdIndex=0;;(*ModeIdIndex)++) { + if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == (*ModeNo)) break; + if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) return FALSE; + } + + if(*ModeNo == 0x07) { + if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ + /* else 350 lines */ + } + if(*ModeNo <= 3) { + if(!(VGAINFO & 0x80)) (*ModeIdIndex)++; + if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ + /* else 350 lines */ + } + /* else 200 lines */ + + } else { + + for(*ModeIdIndex=0;;(*ModeIdIndex)++) { + if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) break; + if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) return FALSE; + } + + } + return TRUE; +} + +/* For SiS 300 oem util: Search VBModeID */ +BOOLEAN +SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo) +{ + USHORT ModeIdIndex; + UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; + + if(*ModeNo <= 5) *ModeNo |= 1; + + for(ModeIdIndex=0; ; ModeIdIndex++) { + if(SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].ModeID == *ModeNo) break; + if(SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].ModeID == 0xFF) return FALSE; + } + + if(*ModeNo != 0x07) { + if(*ModeNo > 0x03) return ((BOOLEAN)ModeIdIndex); + if(VGAINFO & 0x80) return ((BOOLEAN)ModeIdIndex); + ModeIdIndex++; + } + if(VGAINFO & 0x10) ModeIdIndex++; /* 400 lines */ + /* else 350 lines */ + return ((BOOLEAN)ModeIdIndex); +} + +/* TW: Checked against 630/301B, 315 1.09 and 650/301LVx 1.10.6s BIOS */ +BOOLEAN +SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT memorysize,modeflag; + ULONG temp; + + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + } + + memorysize = modeflag & MemoryInfoFlag; + memorysize >>= MemorySizeShift; /* Get required memory size */ + memorysize++; + + temp = GetDRAMSize(SiS_Pr, HwDeviceExtension); /* Get adapter memory size */ + temp /= (1024*1024); /* (in MB) */ + + if(temp < memorysize) return(FALSE); + else return(TRUE); +} + +UCHAR +SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + UCHAR index; + + if(ModeNo <= 0x13) { + index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex; + } else { + if(SiS_Pr->SiS_ModeType <= 0x02) index = 0x1B; /* 02 -> ModeEGA */ + else index = 0x0F; + } + return index; +} + +/* TW: Checked against 300, 330, 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */ +void +SiS_SetSeqRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex) +{ + UCHAR SRdata; + USHORT i; + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x00,0x03); /* Set SR0 */ + + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0]; + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SRdata |= 0x01; + } + } + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SRdata |= 0x01; /* 8 dot clock */ + } + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SRdata |= 0x01; /* 8 dot clock */ + } + } + } + + SRdata |= 0x20; /* screen off */ + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x01,SRdata); + + for(i = 2; i <= 4; i++) { + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i-1]; + SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SRdata); + } +} + +/* Checked against 300, 650/301LVx 1.10.6s and 650/LVDS 1.10.07 BIOS */ +void +SiS_SetMiscRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex) +{ + UCHAR Miscdata; + + Miscdata = SiS_Pr->SiS_StandTable[StandTableIndex].MISC; + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + Miscdata |= 0x0C; + } + } + + SiS_SetReg3(SiS_Pr->SiS_P3c2,Miscdata); +} + +/* Checked against 300, 330, 650/LVDS (1.10.07) and 650/301LVx (1.10.6s) BIOS (630 code still there!) */ +void +SiS_SetCRTCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT StandTableIndex) +{ + UCHAR CRTCdata; + USHORT i; + + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* Unlock CRTC */ + + for(i = 0; i <= 0x18; i++) { + CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */ + } + if( ( (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) ) && + (HwDeviceExtension->jChipRevision >= 0x30) ) { /* for 630S0 */ + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x18,0xFE); + } + } + } +} + +/* TW: Checked against 300, 650/LVDS (1.10.07), 650/301LVx (1.10.6s) and 630/301B BIOS */ +void +SiS_SetATTRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR ARdata; + USHORT i; + + for(i = 0; i <= 0x13; i++) { + ARdata = SiS_Pr->SiS_StandTable[StandTableIndex].ATTR[i]; +#if 0 + if((i <= 0x0f) || (i == 0x11)) { + if(ds:489 & 0x08) { + continue; + } + } +#endif + if(i == 0x13) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata=0; + } + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0; + } + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + /* TW: From 650/LVDS 1.10.07, 1.10a; 650/301LVx 1.10.6s; not in 330 BIOS */ + ARdata = 0; + } else { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + ARdata=0; + } + } + } + } + SiS_GetReg2(SiS_Pr->SiS_P3da); /* reset 3da */ + SiS_SetReg3(SiS_Pr->SiS_P3c0,i); /* set index */ + SiS_SetReg3(SiS_Pr->SiS_P3c0,ARdata); /* set data */ + } + SiS_GetReg2(SiS_Pr->SiS_P3da); /* reset 3da */ + SiS_SetReg3(SiS_Pr->SiS_P3c0,0x14); /* set index */ + SiS_SetReg3(SiS_Pr->SiS_P3c0,0x00); /* set data */ + + SiS_GetReg2(SiS_Pr->SiS_P3da); + SiS_SetReg3(SiS_Pr->SiS_P3c0,0x20); /* Enable Attribute */ + SiS_GetReg2(SiS_Pr->SiS_P3da); +} + +/* TW: Checked against 300, 330, 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */ +void +SiS_SetGRCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex) +{ + UCHAR GRdata; + USHORT i; + + for(i = 0; i <= 0x08; i++) { + GRdata = SiS_Pr->SiS_StandTable[StandTableIndex].GRC[i]; + SiS_SetReg1(SiS_Pr->SiS_P3ce,i,GRdata); /* Set GR(3ce) */ + } + + if(SiS_Pr->SiS_ModeType > ModeVGA) { + SiS_SetRegAND(SiS_Pr->SiS_P3ce,0x05,0xBF); /* 256 color disable */ + } +} + +/* TW: Checked against 650/LVDS (1.10.07, 1.10a), 650/301LVx (1.10.6s) and 630/301B BIOS */ +void +SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT i; + + for(i = 0x0A; i <= 0x0E; i++) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0x00); /* Clear SR0A-SR0E */ + } + + /* TW: New from 330, 650/LVDS/301LV BIOSes: */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE); + } +} + +/* TW: Checked against 300, 330, 650/LVDS (1.10.07) and 650/301LV BIOS */ +void +SiS_SetSync(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT RefreshRateTableIndex) +{ + USHORT sync; + USHORT temp; + + if(SiS_Pr->UseCustomMode) { + sync = SiS_Pr->CInfoFlag >> 8; + } else { + sync = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; + } + + sync &= 0xC0; + temp = 0x2F | sync; + SiS_SetReg3(SiS_Pr->SiS_P3c2,temp); /* Set Misc(3c2) */ +} + +/* TW: Checked against 300, 330, 650/LVDS (1.10.07) and 650/301LVx (1.10.6s) BIOS */ +void +SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR index; + USHORT tempah,i,modeflag,j; +#ifdef SIS315H + USHORT temp; + USHORT ResInfo,DisplayType; + const SiS_LCDACRT1DataStruct *LCDACRT1Ptr = NULL; +#endif + + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */ + + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + } + + if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + +#ifdef SIS315H + + /* LCDA */ + + temp = SiS_GetLCDACRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,&ResInfo,&DisplayType); + + switch(DisplayType) { + case Panel_800x600 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_1; break; + case Panel_1024x768 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break; + case Panel_1280x1024 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1; break; + case Panel_1400x1050 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1; break; + case Panel_1600x1200 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1; break; + case Panel_800x600 + 16 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_1_H; break; + case Panel_1024x768 + 16 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1_H; break; + case Panel_1280x1024 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1_H; break; + case Panel_1400x1050 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1_H; break; + case Panel_1600x1200 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1_H; break; + case Panel_800x600 + 32 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_2; break; + case Panel_1024x768 + 32 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2; break; + case Panel_1280x1024 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2; break; + case Panel_1400x1050 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2; break; + case Panel_1600x1200 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2; break; + case Panel_800x600 + 48 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_2_H; break; + case Panel_1024x768 + 48 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2_H; break; + case Panel_1280x1024 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2_H; break; + case Panel_1400x1050 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2_H; break; + case Panel_1600x1200 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2_H; break; + default: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break; + } + + tempah = (LCDACRT1Ptr+ResInfo)->CR[0]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,tempah); + for(i=0x01,j=1;i<=0x07;i++,j++){ + tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x10,j=8;i<=0x12;i++,j++){ + tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x15,j=11;i<=0x16;i++,j++){ + tempah =(LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x0A,j=13;i<=0x0C;i++,j++){ + tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3c4,i,tempah); + } + + tempah = (LCDACRT1Ptr+ResInfo)->CR[16]; + tempah &= 0x0E0; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); + + tempah = (LCDACRT1Ptr+ResInfo)->CR[16]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode) tempah |= 0x080; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); + +#endif + + } else { + + /* LVDS, 301, 301B, 301LV, 302LV, ... (non-LCDA) */ + + if(SiS_Pr->UseCustomMode) { + + for(i=0,j=0;i<=07;i++,j++) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); + } + for(j=0x10;i<=10;i++,j++) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); + } + for(j=0x15;i<=12;i++,j++) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); + } + for(j=0x0A;i<=15;i++,j++) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,j,SiS_Pr->CCRT1CRTC[i]); + } + + tempah = SiS_Pr->CCRT1CRTC[16] & 0xE0; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); + + tempah = SiS_Pr->CCRT1CRTC[16]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode) tempah |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,tempah); + + + } else { + + index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */ +#if 0 /* Not any longer... */ + if(HwDeviceExtension->jChipType < SIS_315H) { + index &= 0x3F; + } +#endif + + for(i=0,j=0;i<=07;i++,j++) { + tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah); + } + for(j=0x10;i<=10;i++,j++) { + tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah); + } + for(j=0x15;i<=12;i++,j++) { + tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah); + } + for(j=0x0A;i<=15;i++,j++) { + tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; + SiS_SetReg1(SiS_Pr->SiS_P3c4,j,tempah); + } + + tempah = SiS_Pr->SiS_CRT1Table[index].CR[16]; + tempah &= 0xE0; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); + + tempah = SiS_Pr->SiS_CRT1Table[index].CR[16]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode) tempah |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,tempah); + + } + } + + if(SiS_Pr->SiS_ModeType > ModeVGA) SiS_SetReg1(SiS_Pr->SiS_P3d4,0x14,0x4F); +} + +BOOLEAN +SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *ResInfo, + USHORT *DisplayType) + { + USHORT tempbx=0,modeflag=0; + USHORT CRT2CRTC=0; + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + CRT2CRTC = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + CRT2CRTC = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + tempbx = SiS_Pr->SiS_LCDResInfo; + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 32; + if(modeflag & HalfDCLK) tempbx += 16; + + *ResInfo = CRT2CRTC & 0x3F; + *DisplayType = tempbx; + + return 1; +} + +/* TW: Set offset and pitch - partly overruled by SetPitch() in XF86 */ +/* TW: Checked against 330, 650/LVDS (1.10.07), 650/301LV and 315 BIOS */ +void +SiS_SetCRT1Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp, DisplayUnit, infoflag; + + if(SiS_Pr->UseCustomMode) { + infoflag = SiS_Pr->CInfoFlag; + } else { + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + } + + DisplayUnit = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + + temp = (DisplayUnit >> 8) & 0x0f; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,temp); + + temp = DisplayUnit & 0xFF; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x13,temp); + + if(infoflag & InterlaceMode) DisplayUnit >>= 1; + + DisplayUnit <<= 5; + temp = (DisplayUnit & 0xff00) >> 8; + if (DisplayUnit & 0xff) temp++; + temp++; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x10,temp); +} + +/* TW: New from 650/LVDS 1.10.07, 630/301B and 630/LVDS BIOS */ +void +SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT index; + + /* TW: We only need to do this if Panel Link is to be + * initialized, thus on 630/LVDS/301B, and 650/LVDS + */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if (SiS_Pr->SiS_IF_DEF_LVDS == 0) return; + } else { + if( (SiS_Pr->SiS_IF_DEF_LVDS == 0) && + (!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) { + return; + } + } + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xCF,0x20); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x20); + } + index = 1; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x10); + } + index = 0; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); +} + +/* TW: Checked against 300, 330, 650/LVDS, 650/301LVx, 315, 630/301B, 630/LVDS BIOS */ +void +SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT RefreshRateTableIndex) +{ + USHORT index=0; + + if(!SiS_Pr->UseCustomMode) { + index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + + if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) + && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ){ + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VBVCLKData[index].Part4_A); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VBVCLKData[index].Part4_B); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x01); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); + } + + } else { + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x00); + } + + if(SiS_Pr->UseCustomMode) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->CSR2B); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->CSR2C); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C); + } + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x01); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); + } + } +} + +#if 0 /* TW: Not used */ +void +SiS_IsLowResolution(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT ModeFlag; + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0x7F); + + if(ModeNo > 0x13) { + ModeFlag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x80); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xF7); + } + } +} +#endif + +/* TW: Checked against 300, 630/LVDS, 650/LVDS, 315 and 330 BIOS */ +void +SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex) +{ + USHORT data,data2,data3; + USHORT infoflag=0,modeflag; + USHORT resindex,xres; + + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + infoflag = SiS_Pr->CInfoFlag; + } else { + if(ModeNo > 0x13) { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + } else { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } + } + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); /* DAC pedestal */ + + if(ModeNo > 0x13) data = infoflag; + else data = 0; + + data2 = 0; + if(ModeNo > 0x13) { + if(SiS_Pr->SiS_ModeType > 0x02) { + data2 |= 0x02; + data3 = (SiS_Pr->SiS_ModeType - ModeVGA) << 2; + data2 |= data3; + } + } +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Debug: Mode infoflag = %x, Chiptype %d\n", + data, HwDeviceExtension->jChipType); +#endif + if(data & InterlaceMode) data2 |= 0x20; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data2); + + if(SiS_Pr->UseCustomMode) { + xres = SiS_Pr->CHDisplay; + } else { + resindex = SiS_GetResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + if(ModeNo <= 0x13) { + xres = SiS_Pr->SiS_StResInfo[resindex].HTotal; + } else { + xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal; + } + } + + if(HwDeviceExtension->jChipType != SIS_300) { + data = 0x0000; + if(infoflag & InterlaceMode) { + if(xres == 1024) data = 0x0035; + else data = 0x0048; + } + data2 = data & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x19,data2); + data2 = (data & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,data2); + } + + if(modeflag & HalfDCLK) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08); + } + + if(HwDeviceExtension->jChipType == SIS_300) { + if(modeflag & LineCompareOff) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x08); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xF7); + } + } else if(HwDeviceExtension->jChipType < SIS_315H) { + if(modeflag & LineCompareOff) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7); + } + /* 630 BIOS does something for mode 0x12 here */ + } else { + if(modeflag & LineCompareOff) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7); + } + } + + if(HwDeviceExtension->jChipType != SIS_300) { + if(SiS_Pr->SiS_ModeType == ModeEGA) { + if(ModeNo > 0x13) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x40); + } + } + } + +#ifdef SIS315H + /* TW: 315 BIOS sets SR17 at this point */ + if(HwDeviceExtension->jChipType == SIS_315PRO) { + data = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension); + data = SiS_Pr->SiS_SR15[2][data]; + if(SiS_Pr->SiS_ModeType == ModeText) { + data &= 0xc7; + } else { + data2 = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + data2 >>= 1; + if(infoflag & InterlaceMode) data2 >>= 1; + data3 = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + data3 >>= 1; + if(data3 == 0) data3++; + data2 /= data3; + if(data2 >= 0x50) { + data &= 0x0f; + data |= 0x50; + } + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,data); + } + + /* TW: 330 BIOS sets SR17 at this point */ + if(HwDeviceExtension->jChipType == SIS_330) { + data = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension); + data = SiS_Pr->SiS_SR15[2][data]; + if(SiS_Pr->SiS_ModeType <= ModeEGA) { + data &= 0xc7; + } else { + if(SiS_Pr->UseCustomMode) { + data2 = SiS_Pr->CSRClock; + } else { + data2 = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK; + } + + data3 = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + data3 >>= 1; + + data2 *= data3; + + data3 = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension); + data3 *= 1024; + + data2 = data3 / data2; + + if(SiS_Pr->SiS_ModeType != Mode16Bpp) { + if(data2 >= 0x19c) data = 0xba; + else if(data2 >= 0x140) data = 0x7a; + else if(data2 >= 0x101) data = 0x3a; + else if(data2 >= 0xf5) data = 0x32; + else if(data2 >= 0xe2) data = 0x2a; + else if(data2 >= 0xc4) data = 0x22; + else if(data2 >= 0xac) data = 0x1a; + else if(data2 >= 0x9e) data = 0x12; + else if(data2 >= 0x8e) data = 0x0a; + else data = 0x02; + } else { + if(data2 >= 0x127) data = 0xba; + else data = 0x7a; + } + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,data); + } +#endif + + data = 0x60; + if(SiS_Pr->SiS_ModeType != ModeText) { + data ^= 0x60; + if(SiS_Pr->SiS_ModeType != ModeEGA) { + data ^= 0xA0; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data); + + SiS_SetVCLKState(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,RefreshRateTableIndex,ModeIdIndex); + +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x40) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x52,0x2c); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x52,0x6c); + } + } +#endif +} + +/* TW: Checked against 300, 315, 330, 650/LVDS, 650/301LVx, 630/301B and 630/LVDS BIOS */ +void +SiS_SetVCLKState(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT RefreshRateTableIndex, + USHORT ModeIdIndex) +{ + USHORT data, data2=0; + USHORT VCLK, index=0; + + if (ModeNo <= 0x13) VCLK = 0; + else { + if(SiS_Pr->UseCustomMode) { + VCLK = SiS_Pr->CSRClock; + } else { + index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; + } + } + + if(HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */ + + data2 = 0x00; + if(VCLK > 150) data2 |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data2); /* DAC speed */ + + data2 = 0x00; + if(VCLK >= 150) data2 |= 0x08; /* VCLK > 150 */ + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data2); + + } else { /* 310/325 series */ + + data = 0; + if(VCLK >= 166) data |= 0x0c; /* TW: Was 200; is 166 in 650, 315 and 330 BIOSes */ + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); + + if(VCLK >= 166) { /* TW: Was 200, is 166 in 650, 315 and 330 BIOSes */ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7); + } +#if 0 /* Not done in 315 and 650/301LV/LVDS BIOSes: */ + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* DAC pedestal */ + data &= 0xE7; + if(VCLK<200) data |= 0x10; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,data); /* DAC pedestal */ +#endif + } + + data2 = 0x03; + if((VCLK >= 135) && (VCLK < 160)) data2 = 0x02; + if((VCLK >= 160) && (VCLK < 260)) data2 = 0x01; + if(VCLK >= 260) data2 = 0x00; + + if(HwDeviceExtension->jChipType == SIS_540) { + if((VCLK == 203) || (VCLK < 234)) data2 = 0x02; + } + + if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data2); /* DAC speed */ + } else { + if(HwDeviceExtension->jChipType > SIS_315PRO) { + /* TW: This "if" is done in 330 and 650/LVDS/301LV BIOSes; Not in 315 BIOS */ + if(ModeNo > 0x13) data2 &= 0xfc; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data2); /* DAC speed */ + } +} + +/* TW: Checked against 650/301LVx 1.10.6s, 315, 630/301B BIOS */ +void +SiS_LoadDAC(SiS_Private *SiS_Pr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT data,data2; + USHORT time,i,j,k; + USHORT m,n,o; + USHORT si,di,bx,dl; + USHORT al,ah,dh; + USHORT DACAddr, DACData, shiftflag; + const USHORT *table = NULL; +#if 0 + USHORT tempah,tempch,tempcl,tempdh,tempal,tempbx; +#endif + + if(ModeNo <= 0x13) { + data = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + if(SiS_Pr->UseCustomMode) { + data = SiS_Pr->CModeFlag; + } else { + data = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + } + +#if 0 + if(!(ds:489 & 0x08)) { +#endif + + data &= DACInfoFlag; + time = 64; + if(data == 0x00) table = SiS_MDA_DAC; + if(data == 0x08) table = SiS_CGA_DAC; + if(data == 0x10) table = SiS_EGA_DAC; + if(data == 0x18) { + time = 256; + table = SiS_VGA_DAC; + } + if(time == 256) j = 16; + else j = time; + + if( ( (HwDeviceExtension->jChipType == SIS_630) && /* 630/301B LCD */ + (SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) || + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) || /* LCDA */ + (!(SiS_Pr->SiS_SetFlag & ProgrammingCRT2)) ) { /* Programming CRT1 */ + DACAddr = SiS_Pr->SiS_P3c8; + DACData = SiS_Pr->SiS_P3c9; + shiftflag = 0; + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); + } else { + shiftflag = 1; + DACAddr = SiS_Pr->SiS_Part5Port; + DACData = SiS_Pr->SiS_Part5Port + 1; + } + + SiS_SetReg3(DACAddr,0x00); + + for(i=0; i<j; i++) { + data = table[i]; + for(k=0; k<3; k++) { + data2 = 0; + if(data & 0x01) data2 = 0x2A; + if(data & 0x02) data2 += 0x15; + if(shiftflag) data2 <<= 2; + SiS_SetReg3(DACData,data2); + data >>= 2; + } + } + + if(time == 256) { + for(i = 16; i < 32; i++) { + data = table[i]; + if(shiftflag) data <<= 2; + for(k=0; k<3; k++) SiS_SetReg3(DACData,data); + } + si = 32; + for(m = 0; m < 9; m++) { + di = si; + bx = si + 4; + dl = 0; + for(n = 0; n < 3; n++) { + for(o = 0; o < 5; o++) { + dh = table[si]; + ah = table[di]; + al = table[bx]; + si++; + SiS_WriteDAC(SiS_Pr,DACData,shiftflag,dl,ah,al,dh); + } + si -= 2; + for(o = 0; o < 3; o++) { + dh = table[bx]; + ah = table[di]; + al = table[si]; + si--; + SiS_WriteDAC(SiS_Pr,DACData,shiftflag,dl,ah,al,dh); + } + dl++; + } /* for n < 3 */ + si += 5; + } /* for m < 9 */ + } +#if 0 + } /* ds:489 & 0x08 */ +#endif + +#if 0 + if((!(ds:489 & 0x08)) && (ds:489 & 0x06)) { + tempbx = 0; + for(i=0; i< 256; i++) { + SiS_SetReg3(SiS_Pr->SiS_P3c8-1,tempbx); /* 7f87 */ + tempah = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); /* 7f83 */ + tempch = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); + tempcl = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); + tempdh = tempah; + tempal = 0x4d * tempdh; /* 7fb8 */ + tempbx += tempal; + tempal = 0x97 * tempch; + tempbx += tempal; + tempal = 0x1c * tempcl; + tempbx += tempal; + if((tempbx & 0x00ff) > 0x80) tempbx += 0x100; + tempdh = (tempbx & 0x00ff) >> 8; + tempch = tempdh; + tempcl = tempdh; + SiS_SetReg3(SiS_Pr->SiS_P3c8,(tempbx & 0xff)); /* 7f7c */ + SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempdh); /* 7f92 */ + SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempch); + SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempcl); + } + } +#endif +} + +void +SiS_WriteDAC(SiS_Private *SiS_Pr, USHORT DACData, USHORT shiftflag, + USHORT dl, USHORT ah, USHORT al, USHORT dh) +{ + USHORT temp; + USHORT bh,bl; + + bh = ah; + bl = al; + if(dl != 0) { + temp = bh; + bh = dh; + dh = temp; + if(dl == 1) { + temp = bl; + bl = dh; + dh = temp; + } else { + temp = bl; + bl = bh; + bh = temp; + } + } + if(shiftflag) { + dh <<= 2; + bh <<= 2; + bl <<= 2; + } + SiS_SetReg3(DACData,(USHORT)dh); + SiS_SetReg3(DACData,(USHORT)bh); + SiS_SetReg3(DACData,(USHORT)bl); +} + +static ULONG +GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + ULONG AdapterMemorySize = 0; +#ifdef SIS315H + USHORT counter; +#endif + +#ifdef SIS315H + if ((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO)) { + + counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + AdapterMemorySize = 1 << ((counter & 0xF0) >> 4); + counter >>= 2; + counter &= 0x03; + if(counter == 0x02) { + AdapterMemorySize += (AdapterMemorySize / 2); /* DDR asymetric */ + } else if(counter != 0) { + AdapterMemorySize <<= 1; /* SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK */ + } + AdapterMemorySize *= (1024*1024); + + } else if(HwDeviceExtension->jChipType == SIS_330) { + + counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + AdapterMemorySize = 1 << ((counter & 0xF0) >> 4); + counter &= 0x0c; + if(counter != 0) { + AdapterMemorySize <<= 1; + } + AdapterMemorySize *= (1024*1024); + + } else if((HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_650)) { + + counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F; + counter++; + AdapterMemorySize = counter * 4; + AdapterMemorySize *= (1024*1024); + } +#endif + +#ifdef SIS300 + if ((HwDeviceExtension->jChipType==SIS_300) || + (HwDeviceExtension->jChipType==SIS_540) || + (HwDeviceExtension->jChipType==SIS_630) || + (HwDeviceExtension->jChipType==SIS_730)) { + + AdapterMemorySize = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F; + AdapterMemorySize++; + AdapterMemorySize *= (1024*1024); + + } +#endif + + return AdapterMemorySize; +} + +#ifndef LINUX_XF86 +void +SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) +{ + PVOID VideoMemoryAddress = (PVOID)HwDeviceExtension->pjVideoMemoryAddress; + ULONG AdapterMemorySize = (ULONG)HwDeviceExtension->ulVideoMemorySize; + PUSHORT pBuffer; + int i; + + if (SiS_Pr->SiS_ModeType>=ModeEGA) { + if(ModeNo > 0x13) { + AdapterMemorySize = GetDRAMSize(SiS_Pr, HwDeviceExtension); + SiS_SetMemory(VideoMemoryAddress,AdapterMemorySize,0); + } else { + pBuffer = VideoMemoryAddress; + for(i=0; i<0x4000; i++) + pBuffer[i] = 0x0000; + } + } else { + pBuffer = VideoMemoryAddress; + if (SiS_Pr->SiS_ModeType < ModeCGA) { + for(i=0; i<0x4000; i++) + pBuffer[i] = 0x0720; + } else { + SiS_SetMemory(VideoMemoryAddress,0x8000,0); + } + } +} +#endif + +void +SiS_DisplayOn(SiS_Private *SiS_Pr) +{ + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x00); +} + +void +SiS_DisplayOff(SiS_Private *SiS_Pr) +{ + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x20); +} + + +/* ========================================== */ +/* SR CRTC GR */ +void +SiS_SetReg1(USHORT port, USHORT index, USHORT data) +{ + OutPortByte(port,index); + OutPortByte(port+1,data); +} + +/* ========================================== */ +/* AR(3C0) */ +void +SiS_SetReg2(SiS_Private *SiS_Pr, USHORT port, USHORT index, USHORT data) +{ + InPortByte(port+0x3da-0x3c0); + OutPortByte(SiS_Pr->SiS_P3c0,index); + OutPortByte(SiS_Pr->SiS_P3c0,data); + OutPortByte(SiS_Pr->SiS_P3c0,0x20); +} + +void +SiS_SetReg3(USHORT port, USHORT data) +{ + OutPortByte(port,data); +} + +void +SiS_SetReg4(USHORT port, ULONG data) +{ + OutPortLong(port,data); +} + +void +SiS_SetReg5(USHORT port, USHORT data) +{ + OutPortWord(port,data); +} + +UCHAR SiS_GetReg1(USHORT port, USHORT index) +{ + UCHAR data; + + OutPortByte(port,index); + data = InPortByte(port+1); + + return(data); +} + +UCHAR +SiS_GetReg2(USHORT port) +{ + UCHAR data; + + data= InPortByte(port); + + return(data); +} + +ULONG +SiS_GetReg3(USHORT port) +{ + ULONG data; + + data = InPortLong(port); + + return(data); +} + +USHORT +SiS_GetReg4(USHORT port) +{ + ULONG data; + + data = InPortWord(port); + + return(data); +} + +void +SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG port) +{ + int i; + + OutPortByte(port, 0); + port++; + for (i=0; i < (256 * 3); i++) { + OutPortByte(port, 0); + } + +} + +#if 0 /* TW: Unused */ +void +SiS_SetInterlace(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex) +{ + ULONG Temp; + USHORT data,Temp2; + + if (ModeNo<=0x13) return; + + Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x01); + Temp++; + Temp <<= 3; + + if(Temp == 1024) data = 0x0035; + else if(Temp == 1280) data = 0x0048; + else data = 0x0000; + + Temp2 = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + Temp2 &= InterlaceMode; + if(Temp2 == 0) data=0x0000; + + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x19,data); + + Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x1A); + Temp = (USHORT)(Temp & 0xFC); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x1A,(USHORT)Temp); + + Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x0f); + Temp2 = (USHORT)Temp & 0xBF; + if(ModeNo==0x37) Temp2 |= 0x40; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x1A,(USHORT)Temp2); +} +#endif + +/* TW: Checked against 330, 650/LVDS (1.10.07), 650/301LVx (1.10.6s) and 315 BIOS */ +#ifdef SIS315H +void +SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT modeflag; + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); /* disable auto-threshold */ + + if(ModeNo > 0x13) { + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + if( (!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0x34); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0xAE); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); + } + } else { + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0xAE); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); + } +} +#endif + +#ifdef SIS300 +void +SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT RefreshRateTableIndex) +{ + USHORT ThresholdLow = 0; + USHORT index, VCLK, MCLK, colorth=0; + USHORT tempah, temp; + + if(ModeNo > 0x13) { + + if(SiS_Pr->UseCustomMode) { + VCLK = SiS_Pr->CSRClock; + } else { + index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + index &= 0x3F; + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + } + + switch (SiS_Pr->SiS_ModeType - ModeEGA) { /* Get half colordepth */ + case 0 : colorth = 1; break; + case 1 : colorth = 1; break; + case 2 : colorth = 2; break; + case 3 : colorth = 2; break; + case 4 : colorth = 3; break; + case 5 : colorth = 4; break; + } + + index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); + index &= 0x07; + MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ + + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + tempah &= 0xc3; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,tempah); + + do { + ThresholdLow = SiS_CalcDelay(SiS_Pr, ROMAddr, VCLK, colorth, MCLK); + ThresholdLow++; + if(ThresholdLow < 0x13) break; + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x16,0xfc); + ThresholdLow = 0x13; + tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + tempah >>= 6; + if(!(tempah)) break; + tempah--; + tempah <<= 6; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3f,tempah); + } while(0); + + } else ThresholdLow = 2; + + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + temp = (ThresholdLow << 4) | 0x0f; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,temp); + + temp = (ThresholdLow & 0x10) << 1; + if(ModeNo > 0x13) temp |= 0x40; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp); + + /* What is this? */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3B,0x09); + + /* Write CRT/CPU threshold high */ + temp = ThresholdLow + 3; + if(temp > 0x0f) temp = 0x0f; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x09,temp); +} + +USHORT +SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT VCLK, USHORT colordepth, USHORT MCLK) +{ + USHORT tempax, tempbx; + + tempbx = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 0); + tempax = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 1); + if(tempax < 4) tempax = 4; + tempax -= 4; + if(tempbx < tempax) tempbx = tempax; + return(tempbx); +} + +USHORT +SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key) +{ + const UCHAR ThLowA[] = { 61, 3,52, 5,68, 7,100,11, + 43, 3,42, 5,54, 7, 78,11, + 34, 3,37, 5,47, 7, 67,11 }; + + const UCHAR ThLowB[] = { 81, 4,72, 6,88, 8,120,12, + 55, 4,54, 6,66, 8, 90,12, + 42, 4,45, 6,55, 8, 75,12 }; + + const UCHAR ThTiming[] = { 1, 2, 2, 3, 0, 1, 1, 2 }; + + USHORT tempah, tempal, tempcl, tempbx, temp; + ULONG longtemp; + + tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); + tempah &= 0x62; + tempah >>= 1; + tempal = tempah; + tempah >>= 3; + tempal |= tempah; + tempal &= 0x07; + tempcl = ThTiming[tempal]; + tempbx = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + tempbx >>= 6; + tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + tempah >>= 4; + tempah &= 0x0c; + tempbx |= tempah; + tempbx <<= 1; + if(key == 0) { + tempal = ThLowA[tempbx + 1]; + tempal *= tempcl; + tempal += ThLowA[tempbx]; + } else { + tempal = ThLowB[tempbx + 1]; + tempal *= tempcl; + tempal += ThLowB[tempbx]; + } + longtemp = tempal * VCLK * colordepth; + temp = longtemp % (MCLK * 16); + longtemp /= (MCLK * 16); + if(temp) longtemp++; + return((USHORT)longtemp); +} + +#if 0 /* TW: Old fragment, unused */ +USHORT +SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT key) +{ + USHORT data,data2,temp0,temp1; + UCHAR ThLowA[]= {61,3,52,5,68,7,100,11, + 43,3,42,5,54,7, 78,11, + 34,3,37,5,47,7, 67,11}; + + UCHAR ThLowB[]= {81,4,72,6,88,8,120,12, + 55,4,54,6,66,8, 90,12, + 42,4,45,6,55,8, 75,12}; + + UCHAR ThTiming[]= {1,2,2,3,0,1,1,2}; + + data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + data=data>>6; + data2=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + data2=(data2>>4)&0x0C; + data=data|data2; + data=data<1; + if(key==0) { + temp0=(USHORT)ThLowA[data]; + temp1=(USHORT)ThLowA[data+1]; + } else { + temp0=(USHORT)ThLowB[data]; + temp1=(USHORT)ThLowB[data+1]; + } + + data2=0; + data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); + if(data&0x02) data2=data2|0x01; + if(data&0x20) data2=data2|0x02; + if(data&0x40) data2=data2|0x04; + + data=temp1*ThTiming[data2]+temp0; + return(data); +} +#endif + +void +SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT RefreshRateTableIndex) +{ + USHORT i,index,data,VCLK,MCLK,colorth=0; + ULONG B,eax,bl,data2; + USHORT ThresholdLow=0; + UCHAR FQBQData[]= { + 0x01,0x21,0x41,0x61,0x81, + 0x31,0x51,0x71,0x91,0xb1, + 0x00,0x20,0x40,0x60,0x80, + 0x30,0x50,0x70,0x90,0xb0, + 0xFF + }; + UCHAR FQBQData730[]= { + 0x34,0x74,0xb4, + 0x23,0x63,0xa3, + 0x12,0x52,0x92, + 0x01,0x41,0x81, + 0x00,0x40,0x80, + 0xff + }; + + i=0; + if(ModeNo >= 0x13) { + if(SiS_Pr->UseCustomMode) { + VCLK = SiS_Pr->CSRClock; + } else { + index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + index &= 0x3F; + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + } + + index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); + index &= 0x07; + MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ + + data2 = SiS_Pr->SiS_ModeType - ModeEGA; /* Get half colordepth */ + switch (data2) { + case 0 : colorth = 1; break; + case 1 : colorth = 1; break; + case 2 : colorth = 2; break; + case 3 : colorth = 2; break; + case 4 : colorth = 3; break; + case 5 : colorth = 4; break; + } + + if(HwDeviceExtension->jChipType == SIS_730) { + + do { + B = SiS_CalcDelay2(SiS_Pr, ROMAddr, FQBQData730[i], HwDeviceExtension) * VCLK * colorth; + bl = B / (MCLK * 16); + + if(B == bl * 16 * MCLK) { + bl = bl + 1; + } else { + bl = bl + 2; + } + + if(bl > 0x13) { + if(FQBQData730[i+1] == 0xFF) { + ThresholdLow = 0x13; + break; + } + i++; + } else { + ThresholdLow = bl; + break; + } + } while(FQBQData730[i] != 0xFF); + + } else { + + do { + B = SiS_CalcDelay2(SiS_Pr, ROMAddr, FQBQData[i], HwDeviceExtension) * VCLK * colorth; + bl = B / (MCLK * 16); + + if(B == bl * 16 * MCLK) { + bl = bl + 1; + } else { + bl = bl + 2; + } + + if(bl > 0x13) { + if(FQBQData[i+1] == 0xFF) { + ThresholdLow = 0x13; + break; + } + i++; + } else { + ThresholdLow = bl; + break; + } + } while(FQBQData[i] != 0xFF); + } + } + else { + if(HwDeviceExtension->jChipType == SIS_730) { + } else { + i = 9; + } + ThresholdLow = 0x02; + } + + /* Write foreground and background queue */ + if(HwDeviceExtension->jChipType == SIS_730) { + + data2 = FQBQData730[i]; + data2 = (data2 & 0xC0) >> 5; + data2 <<= 8; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x80000050); + eax = SiS_GetReg3(0xcfc); + eax &= 0xfffff9ff; + eax |= data2; + SiS_SetReg4(0xcfc,eax); +#else + /* We use pci functions X offers. We use pcitag 0, because + * we want to read/write to the host bridge (which is always + * 00:00.0 on 630, 730 and 540), not the VGA device. + */ + eax = pciReadLong(0x00000000, 0x50); + eax &= 0xfffff9ff; + eax |= data2; + pciWriteLong(0x00000000, 0x50, eax); +#endif + + /* Write GUI grant timer (PCI config 0xA3) */ + data2 = FQBQData730[i] << 8; + data2 = (data2 & 0x0f00) | ((data2 & 0x3000) >> 8); + data2 <<= 20; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x800000A0); + eax = SiS_GetReg3(0xcfc); + eax &= 0x00ffffff; + eax |= data2; + SiS_SetReg4(0xcfc,eax); +#else + eax = pciReadLong(0x00000000, 0xA0); + eax &= 0x00ffffff; + eax |= data2; + pciWriteLong(0x00000000, 0xA0, eax); +#endif + + } else { + + data2 = FQBQData[i]; + data2 = (data2 & 0xf0) >> 4; + data2 <<= 24; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x80000050); + eax = SiS_GetReg3(0xcfc); + eax &= 0xf0ffffff; + eax |= data2; + SiS_SetReg4(0xcfc,eax); +#else + eax = pciReadLong(0x00000000, 0x50); + eax &= 0xf0ffffff; + eax |= data2; + pciWriteLong(0x00000000, 0x50, eax); +#endif + + /* Write GUI grant timer (PCI config 0xA3) */ + data2 = FQBQData[i]; + data2 &= 0x0f; + data2 <<= 24; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x800000A0); + eax = SiS_GetReg3(0xcfc); + eax &= 0xf0ffffff; + eax |= data2; + SiS_SetReg4(0xcfc,eax); +#else + eax = pciReadLong(0x00000000, 0xA0); + eax &= 0xf0ffffff; + eax |= data2; + pciWriteLong(0x00000000, 0xA0, eax); +#endif + + } + + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + data = ((ThresholdLow & 0x0f) << 4) | 0x0f; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,data); + + data = (ThresholdLow & 0x10) << 1; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data); + + /* What is this? */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3B,0x09); + + /* Write CRT/CPU threshold high (gap = 3) */ + data = ThresholdLow + 3; + if(data > 0x0f) data = 0x0f; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); +} + +USHORT +SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr,UCHAR key, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT data,index; + const UCHAR LatencyFactor[] = { + 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */ + 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */ + 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */ + 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */ + 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */ + 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */ + 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */ + 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */ + }; + const UCHAR LatencyFactor730[] = { + 69, 63, 61, + 86, 79, 77, + 103, 96, 94, + 120,113,111, + 137,130,128, /* --- Table ends with this entry, data below */ + 137,130,128, /* to avoid using illegal values */ + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + }; + + if(HwDeviceExtension->jChipType == SIS_730) { + index = ((key & 0x0f) * 3) + ((key & 0xC0) >> 6); + data = LatencyFactor730[index]; + } else { + index = (key & 0xE0) >> 5; + if(key & 0x10) index +=6; + if(!(key & 0x01)) index += 24; + data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + if(data & 0x0080) index += 12; + data = LatencyFactor[index]; + } + return(data); +} +#endif + +/* =============== Autodetection ================ */ +/* I N C O M P L E T E */ + +BOOLEAN +SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + const USHORT PanelTypeTable300[16] = { + 0xc101, 0xc117, 0x0121, 0xc135, 0xc142, 0xc152, 0xc162, 0xc072, + 0xc181, 0xc192, 0xc1a1, 0xc1b6, 0xc1c2, 0xc0d2, 0xc1e2, 0xc1f2 + }; + const USHORT PanelTypeTable31030x[16] = { + 0xc102, 0xc112, 0x0122, 0xc132, 0xc142, 0xc152, 0xc169, 0xc179, + 0x0189, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + }; + const USHORT PanelTypeTable310LVDS[16] = { + 0xc111, 0xc122, 0xc133, 0xc144, 0xc155, 0xc166, 0xc177, 0xc188, + 0xc199, 0xc0aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + }; + USHORT tempax,tempbx,tempah,temp; + + if(HwDeviceExtension->jChipType < SIS_315H) { + + tempax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); + tempbx = tempax & 0x0F; + if(!(tempax & 0x10)){ + if(SiS_Pr->SiS_IF_DEF_LVDS == 1){ + tempbx = 0; + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38); + if(temp & 0x40) tempbx |= 0x08; + if(temp & 0x20) tempbx |= 0x02; + if(temp & 0x01) tempbx |= 0x01; + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x39); + if(temp & 0x80) tempbx |= 0x04; + } else { + return 0; + } + } + tempbx = PanelTypeTable300[tempbx]; + tempbx |= LCDSync; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); + temp = (tempbx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp); + + } else { + + tempax = tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1a); + tempax &= 0x1e; + tempax >>= 1; + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(tempax == 0) { + /* TODO: Include HUGE detection routine + (Probably not worth bothering) + */ + return 0; + } + temp = tempax & 0xff; + tempax--; + tempbx = PanelTypeTable310LVDS[tempax]; + } else { + tempbx = PanelTypeTable31030x[tempax]; + temp = tempbx & 0xff; + } + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); + tempbx = (tempbx & 0xff00) >> 8; + temp = tempbx & 0xc1; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp); + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp = tempbx & 0x04; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x39,0xfb,temp); + } + + } + return 1; +} + + +#ifdef LINUXBIOS + +void +SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) +{ + UCHAR DAC_TEST_PARMS[] = {0x0F,0x0F,0x0F}; + UCHAR DAC_CLR_PARMS[] = {0x00,0x00,0x00}; + USHORT SR1F; + + SR1F = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* backup DAC pedestal */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1F,0x04); + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(!(SiS_BridgeIsOn(SiS_Pr, BaseAddr))) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x41); + } + } + + SiSSetMode(SiS_Pr,HwDeviceExtension,0x2E); + if(HwDeviceExtension->jChipType >= SIS_650) { + /* TW: On 650 only - enable CRT1 */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf); + } + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff); + SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8); + SiS_LongWait(SiS_Pr); + SiS_LongWait(SiS_Pr); + SiS_LongWait(SiS_Pr); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x00); + if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20); + } else if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20); + } + SiS_TestMonitorType(SiS_Pr, DAC_CLR_PARMS[0],DAC_CLR_PARMS[1],DAC_CLR_PARMS[2]); + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,SR1F); +} + +USHORT +SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC) +{ + USHORT temp,tempbx; + + tempbx = R_DAC * 0x4d + G_DAC * 0x97 + B_DAC * 0x1c; + if((tempbx & 0x00ff) > 0x80) tempbx += 0x100; + tempbx = (tempbx & 0xFF00) >> 8; + R_DAC = (UCHAR) tempbx; + G_DAC = (UCHAR) tempbx; + B_DAC = (UCHAR) tempbx; + + SiS_SetReg3(SiS_Pr->SiS_P3c8,0x00); + SiS_SetReg3(SiS_Pr->SiS_P3c9,R_DAC); + SiS_SetReg3(SiS_Pr->SiS_P3c9,G_DAC); + SiS_SetReg3(SiS_Pr->SiS_P3c9,B_DAC); + SiS_LongWait(SiS_Pr); + temp=SiS_GetReg2(SiS_Pr->SiS_P3c2); + if(temp & 0x10) return(1); + else return(0); +} + +void +SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr) +{ + USHORT tempax=0,tempbx,tempcx,temp; + USHORT P2reg0=0,SenseModeNo=0,OutputSelect=*SiS_Pr->pSiS_OutputSelect; + USHORT ModeIdIndex,i; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1){ + SiS_GetPanelID(SiS_Pr); + temp=LCDSense; + temp=temp|SiS_SenseCHTV(SiS_Pr); + tempbx=~(LCDSense|AVIDEOSense|SVIDEOSense); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,tempbx,temp); + } else { /* for 301 */ + if(SiS_Pr->SiS_IF_DEF_HiVision==1) { /* for HiVision */ + tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38); + temp=tempax&0x01; + tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); + temp=temp|(tempax&0x02); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xA0,temp); + } else { + if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)==0) { /* TW: Inserted "==0" */ + P2reg0 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00); + if(!(SiS_BridgeIsEnable(SiS_Pr, BaseAddr,HwDeviceExtension))) { + SenseModeNo=0x2e; + temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&SenseModeNo,&ModeIdIndex); + SiS_Pr->SiS_SetFlag = 0x00; + SiS_Pr->SiS_ModeType = ModeVGA; + SiS_Pr->SiS_VBInfo = SetCRT2ToRAMDAC |LoadDACFlag |SetInSlaveMode; + SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension); + for(i=0;i<20;i++) { + SiS_LongWait(SiS_Pr); + } + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1c); + tempax=0; + tempbx=*SiS_Pr->pSiS_RGBSenseData; + if(SiS_Is301B(SiS_Pr, BaseAddr)){ + tempbx=*SiS_Pr->pSiS_RGBSenseData2; + } + tempcx=0x0E08; + if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ + if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ + tempax=tempax|Monitor2Sense; + } + } + tempbx=*SiS_Pr->pSiS_YCSenseData; + if(SiS_Is301B(SiS_Pr, BaseAddr)){ + tempbx=*SiS_Pr->pSiS_YCSenseData2; + } + tempcx=0x0604; + if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ + if(SiS_Sense(SiS_Pr,tempbx,tempcx)){ + tempax=tempax|SVIDEOSense; + } + } + + if(ROMAddr && SiS_Pr->SiS_UseROM) { +#ifdef SIS300 + if((HwDeviceExtension->jChipType==SIS_630)|| + (HwDeviceExtension->jChipType==SIS_730)) { + OutputSelect = ROMAddr[0xfe]; + } +#endif +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + OutputSelect = ROMAddr[0xf3]; + if(HwDeviceExtension->jChipType == SIS_330) { + OutputSelect = ROMAddr[0x11b]; + } + } +#endif + } + if(OutputSelect & BoardTVType){ + tempbx = *SiS_Pr->pSiS_VideoSenseData; + if(SiS_Is301B(SiS_Pr, BaseAddr)){ + tempbx = *SiS_Pr->pSiS_VideoSenseData2; + } + tempcx = 0x0804; + if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ + if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ + tempax |= AVIDEOSense; + } + } + } else { + if(!(tempax & SVIDEOSense)){ + tempbx = *SiS_Pr->pSiS_VideoSenseData; + if(SiS_Is301B(SiS_Pr, BaseAddr)){ + tempbx = *SiS_Pr->pSiS_VideoSenseData2; + } + tempcx = 0x0804; + if(SiS_Sense(SiS_Pr,tempbx,tempcx)){ + if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ + tempax |= AVIDEOSense; + } + } + } + } + } + + if(SiS_SenseLCD(SiS_Pr, HwDeviceExtension)){ + tempax |= LCDSense; + } + + tempbx=0; + tempcx=0; + SiS_Sense(SiS_Pr, tempbx,tempcx); + + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { + tempax &= 0x00ef; /* 301lv to disable CRT2*/ + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,~0xDF,tempax); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,P2reg0); + if(!(P2reg0 & 0x20)) { + SiS_Pr->SiS_VBInfo = DisableCRT2Display; + SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension); + } + } + } +} + +BOOLEAN +SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx) +{ + USHORT temp,i,tempch; + + temp = tempbx & 0xFF; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x11,temp); + temp = (tempbx & 0xFF00) >> 8; + temp |= (tempcx & 0x00FF); + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,~0x1F,temp); + + for(i=0; i<10; i++) SiS_LongWait(SiS_Pr); + + tempch = (tempcx & 0x7F00) >> 8; + temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x03); + temp ^= 0x0E; + temp &= tempch; + if(temp>0) return 1; + else return 0; +} + +USHORT +SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp; + + temp=SiS_GetPanelID(SiS_Pr); + if(!temp) temp=SiS_GetLCDDDCInfo(SiS_Pr, HwDeviceExtension); + return(temp); +} + +BOOLEAN +SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp; + /*add lcd sense*/ + if(HwDeviceExtension->ulCRT2LCDType==LCD_UNKNOWN) + return 0; + else{ + temp=(USHORT)HwDeviceExtension->ulCRT2LCDType; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); + return 1; + } +} + +USHORT +SiS_SenseCHTV(SiS_Private *SiS_Pr) +{ + USHORT temp,push0e,status; + + status=0; + push0e = SiS_GetCH700x(SiS_Pr, 0x0e); + push0e = (push0e << 8) | 0x0e; + SiS_SetCH700x(SiS_Pr, 0x0b0e); + SiS_SetCH700x(SiS_Pr, 0x0110); + SiS_SetCH700x(SiS_Pr, 0x0010); + temp = SiS_GetCH700x(SiS_Pr, 0x10); + if(temp & 0x08) status |= SVIDEOSense; + if(temp & 0x02) status |= AVIDEOSense; + SiS_SetCH700x(SiS_Pr, push0e); + return(status); +} +#endif /* LINUXBIOS */ + +/* ================ for TC only ================= */ + +#ifdef TC + +int +INT1AReturnCode(union REGS regs) +{ + if (regs.x.cflag) + { + /*printf("Error to find pci device!\n"); */ + return 1; + } + + switch(regs.h.ah) + { + case 0: return 0; + break; + case 0x81: printf("Function not support\n"); + break; + case 0x83: printf("bad vendor id\n"); + break; + case 0x86: printf("device not found\n"); + break; + case 0x87: printf("bad register number\n"); + break; + case 0x88: printf("set failed\n"); + break; + case 0x89: printf("buffer too small"); + break; + } + return 1; +} + +unsigned +FindPCIIOBase(unsigned index,unsigned deviceid) +{ + union REGS regs; + + regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ + regs.h.al = 0x02; /*FIND_PCI_DEVICE */ + regs.x.cx = deviceid; + regs.x.dx = 0x1039; + regs.x.si = index; /* find n-th device */ + + int86(0x1A, ®s, ®s); + + if (INT1AReturnCode(regs)!=0) + return 0; + + /* regs.h.bh *//* bus number */ + /* regs.h.bl *//* device number */ + regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ + regs.h.al = 0x09; /*READ_CONFIG_WORD */ + regs.x.cx = deviceid; + regs.x.dx = 0x1039; + regs.x.di = 0x18; /* register number */ + int86(0x1A, ®s, ®s); + + if (INT1AReturnCode(regs)!=0) + return 0; + return regs.x.cx; +} + + +void +main(int argc, char *argv[]) +{ + SIS_HW_DEVICE_INFO HwDeviceExtension; + USHORT temp; + USHORT ModeNo; + + /*HwDeviceExtension.pjVirtualRomBase =(PUCHAR) MK_FP(0xC000,0); */ + /*HwDeviceExtension.pjVideoMemoryAddress = (PUCHAR)MK_FP(0xA000,0);*/ + +#ifdef SIS300 + HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x6300)&0xFF80) + 0x30; + HwDeviceExtension.jChipType = SIS_630; +#endif + +#ifdef SIS315H +// HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x5315)&0xFF80) + 0x30; +// HwDeviceExtension.jChipType = SIS_550; + HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x325)&0xFF80) + 0x30; + HwDeviceExtension.jChipType = SIS_315H; +#endif + + HwDeviceExtension.ujVBChipID = VB_CHIP_301; + strcpy(HwDeviceExtension.szVBIOSVer,"0.84"); + HwDeviceExtension.bSkipDramSizing = FALSE; + HwDeviceExtension.ulVideoMemorySize = 0; + if(argc==2) { + ModeNo=atoi(argv[1]); + } + else { + ModeNo=0x2e; + /*ModeNo=0x37; */ /* 1024x768x 4bpp */ + /*ModeNo=0x38; *//* 1024x768x 8bpp */ + /*ModeNo=0x4A; *//* 1024x768x 16bpp */ + /*ModeNo=0x47;*/ /* 800x600x 16bpp */ + } + /* SiSInit(SiS_Pr, &HwDeviceExtension);*/ + SiSSetMode(SiS_Pr, &HwDeviceExtension, ModeNo); +} +#endif /* TC END */ + +/* ================ LINUX XFREE86 ====================== */ + +/* Helper functions */ + +#ifdef LINUX_XF86 +USHORT +SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1; + UShort ModeIndex = 0; + + if((pSiS->HaveCustomModes) && (!(mode->type & M_T_DEFAULT))) + return 0xfe; + + switch(mode->HDisplay) + { + case 320: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_320x480[i]; + } + break; + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } else if(mode->VDisplay == 400) { + ModeIndex = ModeIndex_640x400[i]; + } + break; + case 720: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_720x480[i]; + } else if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_720x576[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } else if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_800x480[i]; + } + break; + case 848: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_848x480[i]; + } + break; + case 856: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_856x480[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1024x768[i]; + } else if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_1024x576[i]; + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_1024x600[i]; + } + } + break; + case 1152: + if(mode->VDisplay == 864) { + ModeIndex = ModeIndex_1152x864[i]; + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1152x768[i]; + } + } + break; + case 1280: + if(mode->VDisplay == 960) { + if(pSiS->VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_1280x960[i]; + } else { + ModeIndex = ModeIndex_310_1280x960[i]; + } + } else if (mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[i]; + } else if (mode->VDisplay == 720) { + ModeIndex = ModeIndex_1280x720[i]; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if (mode->VDisplay == 768) { + ModeIndex = ModeIndex_1280x768[i]; + } + } + break; + case 1360: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1360x768[i]; + } + break; + case 1400: + if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 1050) { + ModeIndex = ModeIndex_1400x1050[i]; + } + } + break; + case 1600: + if(mode->VDisplay == 1200) { + ModeIndex = ModeIndex_1600x1200[i]; + } + break; + case 1920: + if(mode->VDisplay == 1440) { + ModeIndex = ModeIndex_1920x1440[i]; + } + break; + case 2048: + if(mode->VDisplay == 1536) { + if(pSiS->VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_2048x1536[i]; + } else { + ModeIndex = ModeIndex_310_2048x1536[i]; + } + } + break; + } + + return(ModeIndex); +} + +USHORT +SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1; + UShort ModeIndex = 0; + + if(VBFlags & CRT2_LCD) { + + if( (mode->HDisplay <= pSiS->LCDwidth) && + (mode->VDisplay <= pSiS->LCDheight) ) { + + if(VBFlags & VB_LVDS) { /* LCD on LVDS */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + if(pSiS->LCDwidth != 1024 || pSiS->LCDheight != 600) { /* not supported on 1024x600 panels */ + ModeIndex = ModeIndex_512x384[i]; + } + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } else if(mode->VDisplay == 400) { + ModeIndex = ModeIndex_640x400[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1024x768[i]; + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 600) { + if(pSiS->LCDheight == 600) { /* This mode only supported on 1024x600 panels */ + ModeIndex = ModeIndex_1024x600[i]; + } + } + } + break; + case 1152: + if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1152x768[i]; + } + } + break; + case 1280: + if(mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[i]; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1280x768[i]; + } + } + break; + case 1400: + if(mode->VDisplay == 1050) { + if(pSiS->VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1400x1050[i]; + } + } + break; + } + + } else { /* LCD on 301(B) */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } else if(mode->VDisplay == 400) { + ModeIndex = ModeIndex_640x400[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1024x768[i]; + } + break; + case 1280: + if(mode->VDisplay == 960) { + if(pSiS->VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_1280x960[i]; + } else { + ModeIndex = ModeIndex_310_1280x960[i]; + } + } else if (mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[i]; + } + break; + case 1400: + if(mode->VDisplay == 1050) { + if(pSiS->VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1400x1050[i]; + } + } + break; + case 1600: + if(mode->VDisplay == 1200) { + ModeIndex = ModeIndex_1600x1200[i]; + } + break; + } + + } + + } + + } else if(VBFlags & CRT2_TV) { + + if(VBFlags & VB_CHRONTEL) { /* TV on Chrontel */ + + switch(mode->HDisplay) + { + case 512: + if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } else if(mode->VDisplay == 400) { + ModeIndex = ModeIndex_640x400[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + if(pSiS->VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1024x768[i]; + } + } + break; + } + + } else { /* TV on 301(B/LV) */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } + break; + case 720: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_720x480[i]; + } else if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_720x576[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + case 1024: /* Not supported with depth 32 */ + if((mode->VDisplay == 768) && (i != 3) ) { + if(VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + ModeIndex = ModeIndex_1024x768[i]; + } + } + break; + } + + } + + } else if(VBFlags & CRT2_VGA) { /* CRT2 is VGA2 */ + + switch(mode->HDisplay) + { + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } else if(mode->VDisplay == 400) { + ModeIndex = ModeIndex_640x400[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } else if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_800x480[i]; + } + break; + case 848: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_848x480[i]; + } + break; + case 856: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_856x480[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1024x768[i]; + } else if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_1024x576[i]; + } + break; + case 1152: + if(mode->VDisplay == 864) { + ModeIndex = ModeIndex_1152x864[i]; + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1152x768[i]; + } + } + break; + case 1280: + if (mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[i]; + } else if (mode->VDisplay == 720) { + ModeIndex = ModeIndex_1280x720[i]; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if (mode->VDisplay == 768) { + ModeIndex = ModeIndex_1280x768[i]; + } + } + break; + } + + } else { /* CRT1 only, no CRT2 */ + + ModeIndex = SiS_CalcModeIndex(pScrn, mode); + + } + + return(ModeIndex); +} + +USHORT +SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) +{ + SISPtr pSiS = SISPTR(pScrn); + int out_n, out_dn, out_div, out_sbit, out_scale; + int depth = pSiS->CurrentLayout.bitsPerPixel; + +#ifdef SISDUALHEAD + if( ((!pSiS->DualHeadMode) && (VBFlags & DISPTYPE_DISP2)) || + ((pSiS->DualHeadMode) && (!pSiS->SecondHead)) ) return 0; +#else + if(VBFlags & DISPTYPE_DISP2) return 0; +#endif + + pSiS->SiS_Pr->CDClock = mode->Clock; + + pSiS->SiS_Pr->CHDisplay = mode->HDisplay; + pSiS->SiS_Pr->CHSyncStart = mode->HSyncStart; + pSiS->SiS_Pr->CHSyncEnd = mode->HSyncEnd; + pSiS->SiS_Pr->CHTotal = mode->HTotal; + pSiS->SiS_Pr->CHBlankStart = pSiS->SiS_Pr->CHDisplay; + pSiS->SiS_Pr->CHBlankEnd = pSiS->SiS_Pr->CHTotal; + + pSiS->SiS_Pr->CVDisplay = mode->VDisplay; + pSiS->SiS_Pr->CVSyncStart = mode->VSyncStart; + pSiS->SiS_Pr->CVSyncEnd = mode->VSyncEnd; + pSiS->SiS_Pr->CVTotal = mode->VTotal; + pSiS->SiS_Pr->CVBlankStart = pSiS->SiS_Pr->CVSyncStart - 1; + pSiS->SiS_Pr->CVBlankEnd = pSiS->SiS_Pr->CVTotal; + + pSiS->SiS_Pr->CFlags = mode->Flags; + + SiS_compute_vclk(pSiS->SiS_Pr->CDClock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale); + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n", + pSiS->SiS_Pr->CDClock, out_n, out_dn, out_div, out_sbit, out_scale); +#endif + + pSiS->SiS_Pr->CSR2B = (out_div == 2) ? 0x80 : 0x00; + pSiS->SiS_Pr->CSR2B |= ((out_n - 1) & 0x7f); + pSiS->SiS_Pr->CSR2C = (out_dn - 1) & 0x1f; + pSiS->SiS_Pr->CSR2C |= (((out_scale - 1) & 3) << 5); + pSiS->SiS_Pr->CSR2C |= ((out_sbit & 0x01) << 7); + pSiS->SiS_Pr->CSRClock = (pSiS->SiS_Pr->CDClock / 1000) + 1; + + pSiS->SiS_Pr->CCRT1CRTC[0] = ((pSiS->SiS_Pr->CHTotal >> 3) - 5) & 0xff; + pSiS->SiS_Pr->CCRT1CRTC[1] = (pSiS->SiS_Pr->CHDisplay >> 3) - 1; + pSiS->SiS_Pr->CCRT1CRTC[2] = (pSiS->SiS_Pr->CHBlankStart >> 3) - 1; + pSiS->SiS_Pr->CCRT1CRTC[3] = (((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; + pSiS->SiS_Pr->CCRT1CRTC[4] = (pSiS->SiS_Pr->CHSyncStart >> 3) + 3; + pSiS->SiS_Pr->CCRT1CRTC[5] = ((((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | + (((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); + + pSiS->SiS_Pr->CCRT1CRTC[6] = (pSiS->SiS_Pr->CVTotal - 2) & 0xFF; + pSiS->SiS_Pr->CCRT1CRTC[7] = (((pSiS->SiS_Pr->CVTotal - 2) & 0x100) >> 8) + | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x100) >> 7) + | ((pSiS->SiS_Pr->CVSyncStart & 0x100) >> 6) + | (((pSiS->SiS_Pr->CVBlankStart - 1) & 0x100) >> 5) + | 0x10 + | (((pSiS->SiS_Pr->CVTotal - 2) & 0x200) >> 4) + | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x200) >> 3) + | ((pSiS->SiS_Pr->CVSyncStart & 0x200) >> 2); + + pSiS->SiS_Pr->CCRT1CRTC[16] = ((((pSiS->SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* cr9 */ + +#if 0 + if (mode->VScan >= 32) + regp->CRTC[9] |= 0x1F; + else if (mode->VScan > 1) + regp->CRTC[9] |= mode->VScan - 1; +#endif + + pSiS->SiS_Pr->CCRT1CRTC[8] = (pSiS->SiS_Pr->CVSyncStart - 1) & 0xFF; /* cr10 */ + pSiS->SiS_Pr->CCRT1CRTC[9] = ((pSiS->SiS_Pr->CVSyncEnd - 1) & 0x0F) | 0x80; /* cr11 */ + pSiS->SiS_Pr->CCRT1CRTC[10] = (pSiS->SiS_Pr->CVDisplay - 1) & 0xFF; /* cr12 */ + pSiS->SiS_Pr->CCRT1CRTC[11] = (pSiS->SiS_Pr->CVBlankStart - 1) & 0xFF; /* cr15 */ + pSiS->SiS_Pr->CCRT1CRTC[12] = (pSiS->SiS_Pr->CVBlankEnd - 1) & 0xFF; /* cr16 */ + + pSiS->SiS_Pr->CCRT1CRTC[13] = + GETBITSTR((pSiS->SiS_Pr->CVTotal -2), 10:10, 0:0) | + GETBITSTR((pSiS->SiS_Pr->CVDisplay -1), 10:10, 1:1) | + GETBITSTR((pSiS->SiS_Pr->CVBlankStart-1), 10:10, 2:2) | + GETBITSTR((pSiS->SiS_Pr->CVSyncStart ), 10:10, 3:3) | + GETBITSTR((pSiS->SiS_Pr->CVBlankEnd -1), 8:8, 4:4) | + GETBITSTR((pSiS->SiS_Pr->CVSyncEnd -1), 4:4, 5:5) ; + + pSiS->SiS_Pr->CCRT1CRTC[14] = + GETBITSTR((pSiS->SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | + GETBITSTR((pSiS->SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) | + GETBITSTR((pSiS->SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) | + GETBITSTR((pSiS->SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ; + + + pSiS->SiS_Pr->CCRT1CRTC[15] = + GETBITSTR((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | + GETBITSTR((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ; + + switch(depth) { + case 8: + pSiS->SiS_Pr->CModeFlag = 0x223b; + break; + case 16: + pSiS->SiS_Pr->CModeFlag = 0x227d; + break; + case 32: + pSiS->SiS_Pr->CModeFlag = 0x22ff; + break; + default: + return 0; + } + + if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) + pSiS->SiS_Pr->CModeFlag |= DoubleScanMode; + if((pSiS->SiS_Pr->CVDisplay >= 1024) || + (pSiS->SiS_Pr->CVTotal >= 1024) || + (pSiS->SiS_Pr->CHDisplay >= 1024)) + pSiS->SiS_Pr->CModeFlag |= LineCompareOff; + if(pSiS->SiS_Pr->CFlags & V_CLKDIV2) + pSiS->SiS_Pr->CModeFlag |= HalfDCLK; + + pSiS->SiS_Pr->CInfoFlag = 0x0007; + if(pSiS->SiS_Pr->CFlags & V_NHSYNC) + pSiS->SiS_Pr->CInfoFlag |= 0x4000; + if(pSiS->SiS_Pr->CFlags & V_NVSYNC) + pSiS->SiS_Pr->CInfoFlag |= 0x8000; + if(pSiS->SiS_Pr->CFlags & V_INTERLACE) + pSiS->SiS_Pr->CInfoFlag |= InterlaceMode; + + pSiS->SiS_Pr->UseCustomMode = TRUE; +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Custom mode %dx%d:\n", + pSiS->SiS_Pr->CHDisplay,pSiS->SiS_Pr->CVDisplay); + xf86DrvMsg(0, X_INFO, "Modeflag %04x, Infoflag %04x\n", + pSiS->SiS_Pr->CModeFlag, pSiS->SiS_Pr->CInfoFlag); + xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", + pSiS->SiS_Pr->CCRT1CRTC[0], + pSiS->SiS_Pr->CCRT1CRTC[1], + pSiS->SiS_Pr->CCRT1CRTC[2], + pSiS->SiS_Pr->CCRT1CRTC[3], + pSiS->SiS_Pr->CCRT1CRTC[4], + pSiS->SiS_Pr->CCRT1CRTC[5], + pSiS->SiS_Pr->CCRT1CRTC[6], + pSiS->SiS_Pr->CCRT1CRTC[7]); + xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", + pSiS->SiS_Pr->CCRT1CRTC[8], + pSiS->SiS_Pr->CCRT1CRTC[9], + pSiS->SiS_Pr->CCRT1CRTC[10], + pSiS->SiS_Pr->CCRT1CRTC[11], + pSiS->SiS_Pr->CCRT1CRTC[12], + pSiS->SiS_Pr->CCRT1CRTC[13], + pSiS->SiS_Pr->CCRT1CRTC[14], + pSiS->SiS_Pr->CCRT1CRTC[15]); + xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", pSiS->SiS_Pr->CCRT1CRTC[16]); + xf86DrvMsg(0, X_INFO, "Clock: 0x%02x, 0x%02x, %d\n", + pSiS->SiS_Pr->CSR2B, + pSiS->SiS_Pr->CSR2C, + pSiS->SiS_Pr->CSRClock); +#endif + return 1; +} + +/* TW: Build a list of supported modes */ +DisplayModePtr +SiSBuildBuiltInModeList(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned short VRE, VBE, VRS, VBS, VDE, VT; + unsigned short HRE, HBE, HRS, HBS, HDE, HT; + unsigned char sr_data, cr_data, cr_data2, cr_data3; + unsigned char sr2b, sr2c; + float num, denum, postscalar, divider; + int A, B, C, D, E, F, temp, i, j, index, vclkindex; + DisplayModePtr new = NULL, current = NULL, first = NULL, backup = NULL; + + pSiS->backupmodelist = NULL; + + /* Initialize our pointers */ + if(pSiS->VGAEngine == SIS_300_VGA) { +#ifdef SIS300 + InitTo300Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); +#else + return NULL; +#endif + } else if(pSiS->VGAEngine == SIS_315_VGA) { +#ifdef SIS315H + InitTo310Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); +#else + return NULL; +#endif + } else return NULL; + + i = 0; + while(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag != 0xFFFF) { + + index = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC; +#if 0 /* Not any longer */ + if(pSiS->VGAEngine == SIS_300_VGA) index &= 0x3F; +#endif + + if(((pSiS->SiS_Pr->SiS_RefIndex[i].XRes < 512) && (!pSiS->DSTN)) || + ((pSiS->DSTN) && + (pSiS->SiS_Pr->SiS_RefIndex[i].XRes < 512) && + (pSiS->SiS_Pr->SiS_RefIndex[i].XRes != 320) && + (pSiS->SiS_Pr->SiS_RefIndex[i].YRes != 480))) { + i++; + continue; + } + + if(!(new = xalloc(sizeof(DisplayModeRec)))) return first; + memset(new, 0, sizeof(DisplayModeRec)); + if(!(new->name = xalloc(10))) { + xfree(new); + return first; + } + if(!first) first = new; + if(current) { + current->next = new; + new->prev = current; + } + + current = new; + + sprintf(current->name, "%dx%d", pSiS->SiS_Pr->SiS_RefIndex[i].XRes, + pSiS->SiS_Pr->SiS_RefIndex[i].YRes); + + current->status = MODE_OK; + + current->type = M_T_DEFAULT; + + vclkindex = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK; + if(pSiS->VGAEngine == SIS_300_VGA) vclkindex &= 0x3F; + + sr2b = pSiS->SiS_Pr->SiS_VCLKData[vclkindex].SR2B; + sr2c = pSiS->SiS_Pr->SiS_VCLKData[vclkindex].SR2C; + + divider = (sr2b & 0x80) ? 2.0 : 1.0; + postscalar = (sr2c & 0x80) ? + ( (((sr2c >> 5) & 0x03) == 0x02) ? 6.0 : 8.0) : (((sr2c >> 5) & 0x03) + 1.0); + num = (sr2b & 0x7f) + 1.0; + denum = (sr2c & 0x1f) + 1.0; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "------------\n"); + xf86DrvMsg(0, X_INFO, "sr2b: %x sr2c %x div %f ps %f num %f denum %f\n", + sr2b, sr2c, divider, postscalar, num, denum); +#endif + + current->Clock = (int)(14318 * (divider / postscalar) * (num / denum)); + + sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[14]; + /* inSISIDXREG(SISSR, 0x0b, sr_data); */ + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[0]; + /* inSISIDXREG(SISCR, 0x00, cr_data); */ + + /* Horizontal total */ + HT = (cr_data & 0xff) | + ((unsigned short) (sr_data & 0x03) << 8); + A = HT + 5; + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[1]; + /* inSISIDXREG(SISCR, 0x01, cr_data); */ + + /* Horizontal display enable end */ + HDE = (cr_data & 0xff) | + ((unsigned short) (sr_data & 0x0C) << 6); + E = HDE + 1; + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[4]; + /* inSISIDXREG(SISCR, 0x04, cr_data); */ + + /* Horizontal retrace (=sync) start */ + HRS = (cr_data & 0xff) | + ((unsigned short) (sr_data & 0xC0) << 2); + F = HRS - E - 3; + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[2]; + /* inSISIDXREG(SISCR, 0x02, cr_data); */ + + /* Horizontal blank start */ + HBS = (cr_data & 0xff) | + ((unsigned short) (sr_data & 0x30) << 4); + + sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[15]; + /* inSISIDXREG(SISSR, 0x0c, sr_data); */ + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[3]; + /* inSISIDXREG(SISCR, 0x03, cr_data); */ + + cr_data2 = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[5]; + /* inSISIDXREG(SISCR, 0x05, cr_data2); */ + + /* Horizontal blank end */ + HBE = (cr_data & 0x1f) | + ((unsigned short) (cr_data2 & 0x80) >> 2) | + ((unsigned short) (sr_data & 0x03) << 6); + + /* Horizontal retrace (=sync) end */ + HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3); + + temp = HBE - ((E - 1) & 255); + B = (temp > 0) ? temp : (temp + 256); + + temp = HRE - ((E + F + 3) & 63); + C = (temp > 0) ? temp : (temp + 64); + + D = B - F - C; + + current->HDisplay = (E * 8); + current->HSyncStart = (E * 8) + (F * 8); + current->HSyncEnd = (E * 8) + (F * 8) + (C * 8); + current->HTotal = (E * 8) + (F * 8) + (C * 8) + (D * 8); + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, + "H: A %d B %d C %d D %d E %d F %d HT %d HDE %d HRS %d HBS %d HBE %d HRE %d\n", + A, B, C, D, E, F, HT, HDE, HRS, HBS, HBE, HRE); +#endif + + sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[13]; + /* inSISIDXREG(SISSR, 0x0A, sr_data); */ + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[6]; + /* inSISIDXREG(SISCR, 0x06, cr_data); */ + + cr_data2 = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[7]; + /* inSISIDXREG(SISCR, 0x07, cr_data2); */ + + /* Vertical total */ + VT = (cr_data & 0xFF) | + ((unsigned short) (cr_data2 & 0x01) << 8) | + ((unsigned short)(cr_data2 & 0x20) << 4) | + ((unsigned short) (sr_data & 0x01) << 10); + A = VT + 2; + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[10]; + /* inSISIDXREG(SISCR, 0x12, cr_data); */ + + /* Vertical display enable end */ + VDE = (cr_data & 0xff) | + ((unsigned short) (cr_data2 & 0x02) << 7) | + ((unsigned short) (cr_data2 & 0x40) << 3) | + ((unsigned short) (sr_data & 0x02) << 9); + E = VDE + 1; + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[8]; + /* inSISIDXREG(SISCR, 0x10, cr_data); */ + + /* Vertical retrace (=sync) start */ + VRS = (cr_data & 0xff) | + ((unsigned short) (cr_data2 & 0x04) << 6) | + ((unsigned short) (cr_data2 & 0x80) << 2) | + ((unsigned short) (sr_data & 0x08) << 7); + F = VRS + 1 - E; + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[11]; + /* inSISIDXREG(SISCR, 0x15, cr_data); */ + + cr_data3 = (pSiS->SiS_Pr->SiS_CRT1Table[index].CR[16] & 0x01) << 5; + /* inSISIDXREG(SISCR, 0x09, cr_data3); */ + + /* Vertical blank start */ + VBS = (cr_data & 0xff) | + ((unsigned short) (cr_data2 & 0x08) << 5) | + ((unsigned short) (cr_data3 & 0x20) << 4) | + ((unsigned short) (sr_data & 0x04) << 8); + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[12]; + /* inSISIDXREG(SISCR, 0x16, cr_data); */ + + /* Vertical blank end */ + VBE = (cr_data & 0xff) | + ((unsigned short) (sr_data & 0x10) << 4); + temp = VBE - ((E - 1) & 511); + B = (temp > 0) ? temp : (temp + 512); + + cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[9]; + /* inSISIDXREG(SISCR, 0x11, cr_data); */ + + /* Vertical retrace (=sync) end */ + VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1); + temp = VRE - ((E + F - 1) & 31); + C = (temp > 0) ? temp : (temp + 32); + + D = B - F - C; + + current->VDisplay = VDE + 1; + current->VSyncStart = VRS + 1; + current->VSyncEnd = ((VRS & ~0x1f) | VRE) + 1; + if(VRE <= (VRS & 0x1f)) current->VSyncEnd += 32; + current->VTotal = E + D + C + F; + +#if 0 + current->VDisplay = E; + current->VSyncStart = E + D; + current->VSyncEnd = E + D + C; + current->VTotal = E + D + C + F; +#endif + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, + "V: A %d B %d C %d D %d E %d F %d VT %d VDE %d VRS %d VBS %d VBE %d VRE %d\n", + A, B, C, D, E, F, VT, VDE, VRS, VBS, VBE, VRE); +#endif + + if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x4000) + current->Flags |= V_NHSYNC; + else + current->Flags |= V_PHSYNC; + + if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x8000) + current->Flags |= V_NVSYNC; + else + current->Flags |= V_PVSYNC; + + if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x0080) + current->Flags |= V_INTERLACE; + + j = 0; + while(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) { + if(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID == + pSiS->SiS_Pr->SiS_RefIndex[i].ModeID) { + if(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) { + current->Flags |= V_DBLSCAN; + } + break; + } + j++; + } + + if(current->Flags & V_INTERLACE) { + current->VDisplay <<= 1; + current->VSyncStart <<= 1; + current->VSyncEnd <<= 1; + current->VTotal <<= 1; + current->VTotal |= 1; + } + if(current->Flags & V_DBLSCAN) { + current->Clock >>= 1; + current->VDisplay >>= 1; + current->VSyncStart >>= 1; + current->VSyncEnd >>= 1; + current->VTotal >>= 1; + } + + if((backup = xalloc(sizeof(DisplayModeRec)))) { + if(!pSiS->backupmodelist) pSiS->backupmodelist = backup; + else { + pSiS->backupmodelist->next = backup; + backup->prev = pSiS->backupmodelist; + } + backup->next = NULL; + backup->HDisplay = current->HDisplay; + backup->HSyncStart = current->HSyncStart; + backup->HSyncEnd = current->HSyncEnd; + backup->HTotal = current->HTotal; + backup->VDisplay = current->VDisplay; + backup->VSyncStart = current->VSyncStart; + backup->VSyncEnd = current->VSyncEnd; + backup->VTotal = current->VTotal; + backup->Flags = current->Flags; + backup->Clock = current->Clock; + } + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Built-in: %s %.2f %d %d %d %d %d %d %d %d\n", + current->name, (float)current->Clock / 1000, + current->HDisplay, current->HSyncStart, current->HSyncEnd, current->HTotal, + current->VDisplay, current->VSyncStart, current->VSyncEnd, current->VTotal); +#endif + + i++; + } + + return first; + +} + +#define MODEID_OFF 0x449 + +unsigned char +SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id) +{ + return(SiS_GetSetBIOSScratch(pScrn, MODEID_OFF, id)); +} + +unsigned char +SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value) +{ + unsigned char ret; + unsigned char *base; + + base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000); + if(!base) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "(init.c: Could not map BIOS scratch area)\n"); + return 0; + } + + ret = *(base + offset); + + /* value != 0xff means: set register */ + if (value != 0xff) + *(base + offset) = value; + + xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000); + + return ret; +} + +#endif + + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/init.h:1.5 --- /dev/null Thu Feb 27 12:31:36 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,316 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.5 2003/02/10 01:14:16 tsi Exp $ */ + +#ifndef _INIT_ +#define _INIT_ + +#include "osdef.h" +#include "initdef.h" +#include "vgatypes.h" +#include "vstruct.h" + +#ifdef TC +#include <stdio.h> +#include <string.h> +#include <conio.h> +#include <dos.h> +#include <stdlib.h> +#endif + +#ifdef LINUX_XF86 +#include "xf86.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86_OSproc.h" +#include "sis.h" +#include "sis_regs.h" +#endif + +#ifdef LINUX_KERNEL +#include <linux/types.h> +#include <asm/io.h> +#include <linux/sisfb.h> +#endif + +#ifdef WIN2000 +#include <stdio.h> +#include <string.h> +#include <miniport.h> +#include "dderror.h" +#include "devioctl.h" +#include "miniport.h" +#include "ntddvdeo.h" +#include "video.h" +#include "sisv.h" +#include "tools.h" +#endif + +const USHORT SiS_DRAMType[17][5]={ + {0x0C,0x0A,0x02,0x40,0x39}, + {0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35}, + {0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31}, + {0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34}, + {0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21}, + {0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11}, + {0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01}, + {0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20}, + {0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00} +}; + +const USHORT SiS_SDRDRAM_TYPE[13][5] = +{ + { 2,12, 9,64,0x35}, + { 1,13, 9,64,0x44}, + { 2,12, 8,32,0x31}, + { 2,11, 9,32,0x25}, + { 1,12, 9,32,0x34}, + { 1,13, 8,32,0x40}, + { 2,11, 8,16,0x21}, + { 1,12, 8,16,0x30}, + { 1,11, 9,16,0x24}, + { 1,11, 8, 8,0x20}, + { 2, 9, 8, 4,0x01}, + { 1,10, 8, 4,0x10}, + { 1, 9, 8, 2,0x00} +}; + +const USHORT SiS_DDRDRAM_TYPE[4][5] = +{ + { 2,12, 9,64,0x35}, + { 2,12, 8,32,0x31}, + { 2,11, 8,16,0x21}, + { 2, 9, 8, 4,0x01} +}; + +const USHORT SiS_MDA_DAC[] = +{ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F +}; + +const USHORT SiS_CGA_DAC[] = +{ + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F +}; + +const USHORT SiS_EGA_DAC[] = +{ + 0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, + 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, + 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, + 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, + 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, + 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, + 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F +}; + +const USHORT SiS_VGA_DAC[] = +{ + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, + 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, + 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, + 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, + 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, + 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, + 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, + 0x0B,0x0C,0x0D,0x0F,0x10 +}; + +void SiS_SetReg1(USHORT, USHORT, USHORT); +void SiS_SetReg2(SiS_Private *, USHORT, USHORT, USHORT); +void SiS_SetReg3(USHORT, USHORT); +void SiS_SetReg4(USHORT, ULONG); +void SiS_SetReg5(USHORT, USHORT); +UCHAR SiS_GetReg1(USHORT, USHORT); +UCHAR SiS_GetReg2(USHORT); +ULONG SiS_GetReg3(USHORT); +USHORT SiS_GetReg4(USHORT); +void SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG); +void SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +BOOLEAN SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo); +void SiS_IsLowResolution(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); + +#ifdef SIS300 +void SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +USHORT SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress); +#endif + +#ifdef SIS315H +UCHAR SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_DDR_MRS(SiS_Private *SiS_Pr); +void SiS_SDR_MRS(SiS_Private *SiS_Pr); +void SiS_DisableRefresh(SiS_Private *SiS_Pr); +void SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr); +void SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO); +void SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index,USHORT SiS_DDRDRAM_TYPE[][5]); +void SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5]); +void SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +int SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5]); +int SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo, + USHORT DRAMTYPE_TABLE[][5]); +int SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress); +int SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress); +int SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress); +int SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress); +int SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress); +int SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress); +int SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress); +int SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress); +int Is315E(SiS_Private *SiS_Pr); +void SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr); +#endif + +void SiS_HandleCRT1(SiS_Private *SiS_Pr); +void SiS_Handle301B_1400x1050(SiS_Private *SiS_Pr, USHORT ModeNo); +void SiS_SetEnableDstn(SiS_Private *SiS_Pr); +void SiS_Delay15us(SiS_Private *SiS_Pr); +BOOLEAN SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex); +BOOLEAN SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT ModeIdIndex); +UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex); +void SiS_SetSeqRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex); +void SiS_SetMiscRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex); +void SiS_SetCRTCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT StandTableIndex); +void SiS_SetATTRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGRCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex); +void SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetSync(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT RefreshRateTableIndex); +void SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +BOOLEAN SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *ResInfo,USHORT *DisplayType); +void SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO, + USHORT RefreshRateTableIndex); +void SiS_SetVCLKState(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO, USHORT ModeNo, + USHORT RefreshRateTableIndex, USHORT ModeIdIndex); +void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +void SiS_WriteDAC(SiS_Private *SiS_Pr, USHORT, USHORT, USHORT, USHORT, USHORT, USHORT); +void SiS_DisplayOn(SiS_Private *SiS_Pr); +void SiS_DisplayOff(SiS_Private *SiS_Pr); +void SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO,USHORT ModeNo, + USHORT ModeIdIndex,USHORT RefreshRateTableIndex); +void SiS_GetVBType(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO); +USHORT SiS_ChkBUSWidth(SiS_Private *SiS_Pr, UCHAR *ROMAddr); +USHORT SiS_GetModeIDLength(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT); +USHORT SiS_GetRefindexLength(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT); +void SiS_SetInterlace(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex); +void SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT1Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT,USHORT,USHORT,PSIS_HW_DEVICE_INFO); +#ifdef SIS315H +void SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT,USHORT,PSIS_HW_DEVICE_INFO); +#endif +#ifdef SIS300 +void SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO, + USHORT RefreshRateTableIndex); +void SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO, + USHORT RefreshRateTableIndex); +USHORT SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT VCLK, + USHORT colordepth, USHORT MCLK); +USHORT SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key); +USHORT SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, UCHAR,PSIS_HW_DEVICE_INFO HwDeviceExtension); +#endif +void SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT ModeNo); +void SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr); +void SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr); +void SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr); +USHORT SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC); +USHORT SiS_SenseCHTV(SiS_Private *SiS_Pr); +BOOLEAN SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx); +BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO); +BOOLEAN SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO); +USHORT SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO); +void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr); +void SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo); +void SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr); + +#ifdef LINUX_XF86 +USHORT SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); +USHORT SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags); +USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags); +void SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr); +void SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr); +void SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr); +unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id); +unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value); +extern int SiS_compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, + int *out_sbit, int *out_scale); +#endif + +extern USHORT SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +extern void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +extern BOOLEAN SiS_SetCRT2Group301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern void SiS_PresetScratchregister(SiS_Private *SiS_Pr, USHORT SiS_P3d4, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr); +extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr); +extern BOOLEAN SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr); +extern BOOLEAN SiS_BridgeIsEnable(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO ); +extern void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension, int chkcrt2mode); +extern BOOLEAN SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern void SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern USHORT SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern void SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo); +extern void SiS_LongWait(SiS_Private *SiS_Pr); +extern void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR); +extern void SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND); +extern void SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR); +extern USHORT SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempax); +extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempax); +extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempax); +extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempax); +extern void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempax); +extern USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempax); +extern BOOLEAN SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + USHORT *ResInfo,USHORT *DisplayType); +extern USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern BOOLEAN SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr); +extern BOOLEAN SiS_IsM650(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +extern BOOLEAN SiS_LowModeStuff(SiS_Private *SiS_Pr, USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern BOOLEAN SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +extern BOOLEAN SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +extern USHORT SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension); + +#endif + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c:1.10 --- /dev/null Thu Feb 27 12:31:36 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c Mon Feb 3 21:44:28 2003 @@ -0,0 +1,10798 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.10 2003/02/04 02:44:28 dawes Exp $ */ +/* + * Mode switching code (CRT2 section) for SiS 300/540/630/730/315/550/650/740/330 + * (Universal module for Linux kernel framebuffer, XFree86 4.x) + * + * Assembler-To-C translation + * Copyright 2002, 2003 by Thomas Winischhofer <thomas@winischhofer.net> + * Minor parts Copyright SiS, Inc. + * + * Based on BIOS + * 1.10.07, 1.10a for SiS650/LVDS+CH7019 + * 1.11.05 for 650/LVDS (w/o Chrontel) + * 1.07.1b, 1.10.6s, 1.11.6w, 1.11.7w, 1.11.8r for SiS650/301(B/LV), 650/301LVx + * 2.04.50 (I) and 2.04.5c (II) for SiS630/301(B) + * 2.02.3b, 2.03.02, 2.04.2c, 2.04.5c, 2.07a and 2.08.b3 for 630/LVDS/LVDS+CH7005 + * 2.04.5c, 2.04.6c for 730+LVDS+CH7005 + * 1.09b for 315/301(B) + * 1.16.51 for 300+301LVX (ECS A907) + * 1.01.03 for 330 (Xabre 400) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holder makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * TW says: This code looks awful, I know. But please don't do anything about + * this otherwise debugging will be hell. + * The code is extremely fragile as regards the different chipsets, different + * video bridges and combinations thereof. If anything is changed, extreme + * care has to be taken that that change doesn't break it for other chipsets, + * bridges or combinations thereof. + * All comments in this file are by me, regardless if they are marked TW or not. + * + */ + +#include "init301.h" + +#if 0 +#define TWNEWPANEL +#endif + +#if 1 /* TW: Emulate 650/301LVx BIOS 1.10.6s (should be set) */ +#define SIS650301NEW +#endif + +#ifdef SIS300 +#include "oem300.h" +#endif + +#ifdef SIS315H +#include "oem310.h" +#endif + +#define SiS_I2CDELAY 1000 +#define SiS_I2CDELAYSHORT 333 + +BOOLEAN +SiS_SetCRT2Group301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT ModeIdIndex; + USHORT RefreshRateTableIndex; + + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + + if(!SiS_Pr->UseCustomMode) { + SiS_SearchModeID(SiS_Pr,ROMAddr,&ModeNo,&ModeIdIndex); + } else { + ModeIdIndex = 0; + } + + /* TW: Used for shifting CR33 */ + SiS_Pr->SiS_SelectCRT2Rate = 4; + + SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + + RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + SiS_SaveCRT2Info(SiS_Pr,ModeNo); + + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + SiS_DisableBridge(SiS_Pr,HwDeviceExtension,BaseAddr); + if((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (HwDeviceExtension->jChipType == SIS_730)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x80); + } + SiS_SetCRT2ModeRegs(SiS_Pr,BaseAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + } + + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) { + SiS_LockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr); + SiS_DisplayOn(SiS_Pr); + return(TRUE); + } + + if(SiS_Pr->UseCustomMode) return(FALSE); + + SiS_GetCRT2Data(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + + /* LVDS, 650/301LV(LCDA) and 630/301B BIOS set up Panel Link */ + /* 300+LV does not */ + if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || + ((HwDeviceExtension->jChipType != SIS_300) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV))) { + SiS_GetLVDSDesData(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + } else { + SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0; + } + +#ifdef LINUX_XF86 +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "(init301: LCDHDES 0x%03x LCDVDES 0x%03x)\n", SiS_Pr->SiS_LCDHDES, SiS_Pr->SiS_LCDVDES); + xf86DrvMsg(0, X_INFO, "(init301: HDE 0x%03x VDE 0x%03x)\n", SiS_Pr->SiS_HDE, SiS_Pr->SiS_VDE); + xf86DrvMsg(0, X_INFO, "(init301: VGAHDE 0x%03x VGAVDE 0x%03x)\n", SiS_Pr->SiS_VGAHDE, SiS_Pr->SiS_VGAVDE); + xf86DrvMsg(0, X_INFO, "(init301: HT 0x%03x VT 0x%03x)\n", SiS_Pr->SiS_HT, SiS_Pr->SiS_VT); + xf86DrvMsg(0, X_INFO, "(init301: VGAHT 0x%03x VGAVT 0x%03x)\n", SiS_Pr->SiS_VGAHT, SiS_Pr->SiS_VGAVT); +#endif +#endif + + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + SiS_SetGroup1(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + + SiS_SetGroup2(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + SiS_SetGroup3(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension); + SiS_SetGroup4(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + SiS_SetGroup5(SiS_Pr,HwDeviceExtension, BaseAddr,ROMAddr, + ModeNo,ModeIdIndex); + + /* TW: 630/301B BIOS does all this: */ + if((HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300)) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if(!((SiS_Pr->SiS_SetFlag & CRT2IsVGA) && ((ModeNo == 0x03) || (ModeNo = 0x10)))) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SiS_ModCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + } + } + SiS_SetCRT2ECLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + } + + } + + } else { + + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if (SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { + SiS_ModCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + } + if(SiS_Pr->SiS_IF_DEF_FSTN == 0) { + SiS_SetCRT2ECLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + /* TW: Inserted from 650/LVDS BIOS */ + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + SiS_SetCH701xForLCD(SiS_Pr,HwDeviceExtension,BaseAddr); + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + /* TW: Set Chrontel registers only if CRT2 is TV */ + SiS_SetCHTVReg(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex); + } + } + } + + } + +#ifdef SIS300 + if ( (HwDeviceExtension->jChipType == SIS_540) || + (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) || + (HwDeviceExtension->jChipType == SIS_300) ) + { + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + if(SiS_Pr->SiS_UseOEM) { + if((SiS_Pr->SiS_UseROM) && ROMAddr && (SiS_Pr->SiS_UseOEM == -1)) { + if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) { + SiS_OEM300Setting(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo); + } + } else { + SiS_OEM300Setting(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo); + } + } + } + } +#endif + +#ifdef SIS315H + if ( (HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315) || + (HwDeviceExtension->jChipType == SIS_315PRO)|| + (HwDeviceExtension->jChipType == SIS_550) || + (HwDeviceExtension->jChipType == SIS_740) || + (HwDeviceExtension->jChipType == SIS_650) || + (HwDeviceExtension->jChipType == SIS_330) ) + { + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { +#ifdef SIS650301NEW + SiS_FinalizeLCD(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, HwDeviceExtension); +#else + SiS_OEMLCD(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); +#endif + if(SiS_Pr->SiS_UseOEM) { + SiS_OEM310Setting(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + } + SiS_CRT2AutoThreshold(SiS_Pr,BaseAddr); + } + } +#endif + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(HwDeviceExtension->jChipType != SIS_730) { + SiS_DisplayOn(SiS_Pr); + } + } + } + + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(HwDeviceExtension->jChipType == SIS_730) { + SiS_DisplayOn(SiS_Pr); + } + } + SiS_EnableBridge(SiS_Pr,HwDeviceExtension,BaseAddr); + } + + SiS_DisplayOn(SiS_Pr); + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + /* TW: Disable LCD panel when using TV */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x11,0x0C); + } else { + /* TW: Disable TV when using LCD */ + SiS_SetCH70xxANDOR(SiS_Pr,0x010E,0xF8); + } + } + + if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { + SiS_LockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr); + } + + return 1; +} + +/* TW: Checked with 330, 650/LVDS (1.10.07) and 630+301B/LVDS BIOS */ +BOOLEAN +SiS_LowModeStuff(SiS_Private *SiS_Pr, USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,temp1,temp2; + + if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12)) + return(1); + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x11); + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80); + temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x00); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,0x55); + temp2 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x00); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,temp1); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x11,temp); + if((HwDeviceExtension->jChipType >= SIS_315H) || + (HwDeviceExtension->jChipType == SIS_300)) { + if(temp2 == 0x55) return(0); + else return(1); + } else { + if(temp2 != 0x55) return(1); + else { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + return(0); + } + } +} + +/* TW: Set Part1 registers */ +/* TW: Checked with 650/LVDS (1.10.07), 650/301LV (II) and 630/301B (II) BIOS */ +/* TW: Pass 2: Checked with 650/301LVx 1.10.6s, 630/301B 2.04.5a */ +void +SiS_SetGroup1(SiS_Private *SiS_Pr,USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT RefreshRateTableIndex) +{ + USHORT temp=0, tempax=0, tempbx=0, tempcx=0; + USHORT pushbx=0, CRT1Index=0; +#ifdef SIS315H + USHORT pushcx=0, tempbl=0; +#endif + USHORT modeflag, resinfo=0; + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + /* TW: LCDA exists with LVDS as well */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + + SiS_SetCRT2Sync(SiS_Pr,BaseAddr,ROMAddr,ModeNo, + RefreshRateTableIndex,HwDeviceExtension); + + SiS_SetGroup1_LCDA(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + + } else { + + if( (HwDeviceExtension->jChipType >= SIS_315H) && + (SiS_Pr->SiS_IF_DEF_LVDS == 1) && + (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + + SiS_SetCRT2Sync(SiS_Pr,BaseAddr,ROMAddr,ModeNo, + RefreshRateTableIndex,HwDeviceExtension); + + } else { + + SiS_SetCRT2Offset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + + if (HwDeviceExtension->jChipType < SIS_315H ) { +#ifdef SIS300 + SiS_SetCRT2FIFO_300(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension); +#endif + } else { +#ifdef SIS315H + SiS_SetCRT2FIFO_310(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension); +#endif + } + + SiS_SetCRT2Sync(SiS_Pr,BaseAddr,ROMAddr,ModeNo, + RefreshRateTableIndex,HwDeviceExtension); + + /* 1. Horizontal setup */ + + if (HwDeviceExtension->jChipType < SIS_315H ) { + +#ifdef SIS300 /* ------------- 300 series --------------*/ + + temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */ + + temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */ + + temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */ + + pushbx = SiS_Pr->SiS_VGAHDE + 12; /* bx BTVGA@HRS 0x0B,0x0C */ + tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2; + tempbx = pushbx + tempcx; + tempcx <<= 1; + tempcx += tempbx; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){ + /* CRT1Index &= 0x3F; - Not any longer */ + tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; + tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2); + tempbx = (tempbx - 1) << 3; + tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; + tempcx &= 0x1F; + temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; + temp = (temp & 0x04) << (6-2); + tempcx = ((tempcx | temp) - 1) << 3; + } + + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){ + tempbx = 1040; + tempcx = 1042; + } + } + } + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */ +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* ----------------- 310/325 series ------------- */ + + tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */ + pushcx = tempcx; + if(modeflag & HalfDCLK) { + if((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_IF_DEF_CH70xx == 0)) { + tempax = SiS_Pr->SiS_VGAHDE >> 1; + tempcx = SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE + tempax; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + tempcx = SiS_Pr->SiS_HT - tempax; + } + } else { + tempcx >>= 1; + } + } + tempcx--; + + temp = tempcx & 0xff; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */ + + temp = ((tempcx & 0xff00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */ + + tempcx = pushcx; /* BTVGA2HDEE 0x0A,0x0C */ + tempbx = SiS_Pr->SiS_VGAHDE; + tempcx -= tempbx; + tempcx >>= 2; + if(modeflag & HalfDCLK) { + tempbx >>= 1; + tempcx >>= 1; + } + tempbx += 16; + + temp = tempbx & 0xff; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */ + + pushbx = tempbx; + tempcx >>= 1; + tempbx += tempcx; + tempcx += tempbx; + + if(SiS_Pr->SiS_IF_DEF_LVDS==0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; + tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2); + tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */ + tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; + tempcx &= 0x1F; + temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; + temp = (temp & 0x04) << (5-2); /* VGAHRE D[5] */ + tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ + tempcx &= 0x00FF; + tempcx |= (tempbx & 0xFF00); + tempbx += 16; + tempcx += 16; + tempax = SiS_Pr->SiS_VGAHT; + if (modeflag & HalfDCLK) tempax >>= 1; + tempax--; + if (tempcx > tempax) tempcx = tempax; + } + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){ + tempbx = 1040; + tempcx = 1042; + } + } + /* TW: Makes no sense, but is in 650/301LVx 1.10.6s */ + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + tempbx = 1040; + tempcx = 1042; + } + } + } + } + + temp = tempbx & 0xff; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */ +#endif /* SIS315H */ + + } /* 310 series */ + + /* TW: The following is done for all bridge/chip types/series */ + + tempax = tempbx & 0xFF00; + tempbx = pushbx; + tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); + tempax |= (tempbx & 0xFF00); + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp); /* TW: Overflow */ + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp); /* TW: CRT2 Horizontal Retrace End */ + + /* 2. Vertical setup */ + + tempcx = SiS_Pr->SiS_VGAVT - 1; + temp = tempcx & 0x00FF; + + /* TW: Matches 650/301LV, 650/LVDS, 630/LVDS(CLEVO), 630/LVDS(no-Ch7005) */ + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO|SetCRT2ToAVIDEO)) { + temp--; + } + } + } else { + temp--; + } + } else if(HwDeviceExtension->jChipType >= SIS_315H) { + /* TW: Inserted from 650/301LVx 1.10.6s */ + temp--; + } + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp); /* TW: CRT2 Vertical Total */ + + tempbx = SiS_Pr->SiS_VGAVDE - 1; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,temp); /* TW: CRT2 Vertical Display Enable End */ + + temp = ((tempbx & 0xFF00) << 3) >> 8; + temp |= ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,temp); /* TW: Overflow (and HWCursor Test Mode) */ + + /* TW: For 650/LVDS (1.10.07), 650/301LVx (1.10.6s) */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + tempbx++; + tempax = tempbx; + tempcx++; + tempcx -= tempax; + tempcx >>= 2; + tempbx += tempcx; + if(tempcx < 4) tempcx = 4; + tempcx >>= 2; + tempcx += tempbx; + tempcx++; + } else { + /* TW: For 300/630/LVDS/301B: */ + tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */ + tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */ + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){ + tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8]; + temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7]; + if(temp & 0x04) tempbx |= 0x0100; + if(temp & 0x80) tempbx |= 0x0200; + temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13]; + if(temp & 0x08) tempbx |= 0x0400; + temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9]; + tempcx = (tempcx & 0xFF00) | (temp & 0x00FF); + } + } + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); /* TW: CRT2 Vertical Retrace Start */ + + temp = ((tempbx & 0xFF00) >> 8) << 4; + temp |= (tempcx & 0x000F); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,temp); /* TW: CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */ + + /* 3. Panel compensation delay */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* ---------- 300 series -------------- */ + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp = 0x20; + + if(HwDeviceExtension->jChipType == SIS_300) { + temp = 0x10; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; + } + if(SiS_Pr->SiS_VBType & VB_SIS301) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; + } +#if 0 /* TW: Not in 630/301B BIOS */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; +#endif + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c; + else temp = 0x20; + } +#endif + if((ROMAddr) && (SiS_Pr->SiS_UseROM) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + if(ROMAddr[0x220] & 0x80) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) + temp = ROMAddr[0x221]; + else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) + temp = ROMAddr[0x222]; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) + temp = ROMAddr[0x223]; + else + temp = ROMAddr[0x224]; + temp &= 0x3c; + } + } + if(HwDeviceExtension->pdc) { + temp = HwDeviceExtension->pdc & 0x3c; + } + } else { + temp = 0x20; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) temp = 0x04; + } + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(ROMAddr[0x220] & 0x80) { + temp = ROMAddr[0x220] & 0x3c; + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(HwDeviceExtension->pdc) { + temp = HwDeviceExtension->pdc & 0x3c; + } + } + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x03C,temp); /* TW: Panel Link Delay Compensation; (Software Command Reset; Power Saving) */ + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* ----------- 310/325 series ---------------*/ + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp = 0x10; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08; + tempbl = 0xF0; + } else { + temp = 0x00; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a; + tempbl = 0xF0; + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F; + } + } +#if 0 /* TW: Not done in 650/301LVx 1.10.6s */ + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp >>= 2; + } +#endif + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp); /* TW: Panel Link Delay Compensation */ + + tempax = 0; + if (modeflag & DoubleScanMode) tempax |= 0x80; + if (modeflag & HalfDCLK) tempax |= 0x40; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax); + +#endif /* SIS315H */ + + } + + } /* Slavemode */ + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + /* TW: 630/301B BIOS sets up Panel Link, too! (300/301LV and 650/LV do not) */ + if( (HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) { + + SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + + } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + + SiS_SetGroup1_301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + } + + } else { + + if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + } else { + /* TW: For 650/LVDS */ + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + } + } else { + SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + } + } + + } + } /* LCDA */ +} + +/* TW: Checked against 650/301LV and 630/301B (II) BIOS */ +/* TW: Pass 2: Checked with 650/301LVx (1.10.6s) and 630/301B (2.04.5a) */ +void +SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex) +{ + USHORT push1,push2; + USHORT tempax,tempbx,tempcx,temp; + USHORT resinfo,modeflag; + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + /* TW: The following is only done if bridge is in slave mode: */ + + tempax = 0xFFFF; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr); + + /* TW: 630/301B, 300/301LV do not check this flag, assume it is set */ + /* 650/LV and 650/301LVx BIOS do not check this either; so we set it... */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + modeflag |= Charx8Dot; + } + + if(modeflag & Charx8Dot) tempcx = 0x08; + else tempcx = 0x09; + + if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT; + + if(modeflag & HalfDCLK) tempax >>= 1; + + tempax = (tempax / tempcx) - 5; + tempbx = tempax & 0xFF; + + temp = 0xFF; /* set MAX HT */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,temp); + + tempax = SiS_Pr->SiS_VGAHDE; /* 0x04 Horizontal Display End */ + if(modeflag & HalfDCLK) tempax >>= 1; + tempax = (tempax / tempcx) - 1; + tempbx |= ((tempax & 0x00FF) << 8); + temp = tempax & 0xFF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x04,temp); + + temp = (tempbx & 0xFF00) >> 8; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + temp += 2; + } +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(resinfo == 7) temp -= 2; + } +#endif + } + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */ + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ + +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + temp = (tempbx & 0x00FF) - 1; + if(!(modeflag & HalfDCLK)) { + temp -= 6; + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + temp -= 2; + if(ModeNo > 0x13) temp -= 10; + } + } + } else { +#endif + tempcx = tempbx & 0x00FF; + tempbx = (tempbx & 0xFF00) >> 8; + tempcx = (tempcx + tempbx) >> 1; + temp = (tempcx & 0x00FF) + 2; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV){ + temp--; + if(!(modeflag & HalfDCLK)){ + if((modeflag & Charx8Dot)){ + temp += 4; + if(SiS_Pr->SiS_VGAHDE >= 800) temp -= 6; + /* TW: Inserted from 650/301 BIOS, 630/301B/301 don't do this */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VGAHDE == 800) temp += 2; + } + } + } + } else { + if(!(modeflag & HalfDCLK)) { + temp -= 4; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) { + if(SiS_Pr->SiS_VGAHDE >= 800){ + temp -= 7; + if(HwDeviceExtension->jChipType < SIS_315H) { + /* 650/301LV(x) does not do this, 630/301B, 300/301LV do */ + if(SiS_Pr->SiS_ModeType == ModeEGA){ + if(SiS_Pr->SiS_VGAVDE == 1024){ + temp += 15; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) temp += 7; + } + } + } + if(SiS_Pr->SiS_VGAHDE >= 1280){ + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) { + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) temp += 28; + } + } + } + } + } + } +#ifdef oldHV + } +#endif + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,temp); /* 0x07 Horizontal Retrace Start */ + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x00); /* 0x08 Horizontal Retrace End */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + if(ModeNo <= 1) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2a); + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x61); + } else { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x41); + } + } else if(SiS_Pr->SiS_ModeType == ModeText) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x54); + } else { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x55); + } + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x00); + } else if(ModeNo <= 0x13) { + if(modeflag & HalfDCLK) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x30); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); + } else { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2f); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x02); + } + } else { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x5b); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); + } + } else if( ((HwDeviceExtension->jChipType >= SIS_315H) && (ModeNo == 0x50)) || + ((HwDeviceExtension->jChipType < SIS_315H) && (resinfo == 0 || resinfo == 1)) ) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x30); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); + } else { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2f); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); + } + } + + } + } + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x03); /* 0x18 SR08 */ + + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x19,0xF0); + + tempbx = SiS_Pr->SiS_VGAVT; + push1 = tempbx; + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ + + tempcx = 0x121; + tempbx = SiS_Pr->SiS_VGAVDE; /* 0x0E Vertical Display End */ + if(tempbx == 357) tempbx = 350; + if(tempbx == 360) tempbx = 350; + if(tempbx == 375) tempbx = 350; + if(tempbx == 405) tempbx = 400; + if(tempbx == 420) tempbx = 400; + if(tempbx == 525) tempbx = 480; + push2 = tempbx; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(tempbx == 350) tempbx += 5; + if(tempbx == 480) tempbx += 5; + } + } + } + tempbx--; + temp = tempbx & 0x00FF; + tempbx--; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); /* 0x10 vertical Blank Start */ + + tempbx = push2; + tempbx--; + temp = tempbx & 0x00FF; +#if 0 + /* TW: Missing code from 630/301B 2.04.5a and 650/301LVx 1.10.6s (calles int 2f) */ + if(xxx()) { + if(temp == 0xdf) temp = 0xda; + } +#endif + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp); + + if(tempbx & 0x0100) { + tempcx |= 0x0002; + if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x000a; + } + + tempax = 0x000B; + if(modeflag & DoubleScanMode) tempax |= 0x8000; + + if(tempbx & 0x0200) { + tempcx |= 0x0040; + if(SiS_Pr->SiS_VBType & VB_SIS301) tempax |= 0x2000; + } + + if(SiS_Pr->SiS_VBType & VB_SIS301) { + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + if(SiS_Pr->SiS_VGAVDE == 480) { + tempax = (tempax & 0x00ff) | 0x2000; + if(modeflag & DoubleScanMode) tempax |= 0x8000; + } + } + } + + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); + + if(tempbx & 0x0400) tempcx |= 0x0600; + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */ + + tempax = push1; + tempax -= tempbx; + tempax >>= 2; + push1 = tempax; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(ModeNo > 0x13) { + if(resinfo != 0x09) { + tempax <<= 1; + tempbx += tempax; + } + } else { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) { + tempax <<= 1; + tempbx += tempax; + } + } + } else if((resinfo != 0x09) || (SiS_Pr->SiS_VBType & VB_SIS301)) { + tempax <<= 1; + tempbx += tempax; + } +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + tempbx -= 10; + } else { +#endif + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + if(!(SiS_Pr->SiS_HiVision & 0x03)) { + tempbx += 40; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10; + } + } + } + } +#ifdef oldHV + } +#endif + tempax = push1; + tempax >>= 2; + tempax++; + tempax += tempbx; + push1 = tempax; + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + if(tempbx <= 513) { + if(tempax >= 513) tempbx = 513; + } + } + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp); /* 0x0C Vertical Retrace Start */ + + if(!(SiS_Pr->SiS_VBType & VB_SIS301)) { + tempbx--; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); + + if(tempbx & 0x0100) tempcx |= 0x0008; + + if(tempbx & 0x0200) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x0B,0x20); + } + + tempbx++; + } + if(tempbx & 0x0100) tempcx |= 0x0004; + if(tempbx & 0x0200) tempcx |= 0x0080; + if(tempbx & 0x0400) { + if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800; + else tempcx |= 0x0C00; + } + + tempbx = push1; + temp = tempbx & 0x00FF; + temp &= 0x0F; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp); /* 0x0D vertical Retrace End */ + + if(tempbx & 0x0010) tempcx |= 0x2000; + + temp = tempcx & 0x00FF; + if(SiS_Pr->SiS_VBType & VB_SIS301) { + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + if(SiS_Pr->SiS_VGAVDE == 480) temp = 0xa3; + } + } + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* 0x0A CR07 */ + + temp = (tempcx & 0xFF00) >> 8; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* 0x17 SR0A */ + + tempax = modeflag; + temp = (tempax & 0xFF00) >> 8; + temp = (temp >> 1) & 0x09; + /* TW: Inserted from 630/301B and 650/301(LV/LVX) BIOS; not in 630/301 BIOS */ + if(!(SiS_Pr->SiS_VBType & VB_SIS301)) { + temp |= 0x01; + } + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* 0x16 SR01 */ + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */ + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,0x00); /* 0x12 CR17 */ + + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { + temp = 0x80; + } + } else temp = 0x80; + } else temp = 0x00; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp); /* 0x1A SR0E */ + + return; +} + +/* TW: Checked against 650/LVDS 1.10.07, 630/301B (I,II) and 630/LVDS BIOS */ +void +SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr,USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT RefreshRateTableIndex) +{ + USHORT modeflag, resinfo; + USHORT push1, push2, tempax, tempbx, tempcx, temp; +#ifdef SIS315H + USHORT pushcx; +#endif + ULONG tempeax=0, tempebx, tempecx, tempvcfact=0; + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + /* TW: Set up Panel Link */ + + /* 1. Horizontal setup */ + + tempax = SiS_Pr->SiS_LCDHDES; + + if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) && (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) { + tempax -= 8; + } + + tempcx = SiS_Pr->SiS_HT; /* Horiz. Total */ + + tempbx = SiS_Pr->SiS_HDE; /* Horiz. Display End */ + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + if(!SiS_Pr->SiS_IF_DEF_DSTN) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempbx = 800; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 1024; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempbx = 1024; /* TW: not done in BIOS */ + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempbx = 1152; /* TW: not done in BIOS */ + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempbx = 1280; /* TW */ + else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) tempbx = 1400; /* TW */ + } + } + tempcx = (tempcx - tempbx) >> 2; /* HT-HDE / 4 */ + + push1 = tempax; + + tempax += tempbx; + + if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT; + + push2 = tempax; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(!SiS_Pr->SiS_IF_DEF_DSTN){ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0028; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0030; + else if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) || + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) ) { + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + tempcx = 0x0017; +#ifdef TWNEWPANEL + tempcx = 0x0018; +#endif + } else { + tempcx = 0x0017; /* A901; other 301B BIOS 0x0018; */ + } + } else { + tempcx = 0x0018; + } + } + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0018; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0040; + else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) tempcx = 0x0030; + } + } + + tempcx += tempax; /* lcdhrs */ + if(tempcx >= SiS_Pr->SiS_HT) tempcx -= SiS_Pr->SiS_HT; + + tempax = tempcx >> 3; /* BPLHRS */ + temp = tempax & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h; TW: Panel Link Horizontal Retrace Start */ + + temp = (tempax & 0x00FF) + 10; + + /* TW: Inserted this entire "if"-section from 650/LVDS BIOS */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(!SiS_Pr->SiS_IF_DEF_DSTN){ + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + temp += 6; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) { + temp++; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) { + temp += 7; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) { + temp -= 10; + } + } + } + } + } + } + } + + temp &= 0x1F; + temp |= ((tempcx & 0x0007) << 5); + if(SiS_Pr->SiS_IF_DEF_FSTN) temp = 0x20; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h; TW: Panel Link Horizontal Retrace End/Skew */ + + tempbx = push2; + tempcx = push1; /* lcdhdes */ + + temp = (tempcx & 0x0007); /* BPLHDESKEW */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah; TW: Panel Link Vertical Retrace Start (2:0) */ + + tempcx >>= 3; /* BPLHDES */ + temp = (tempcx & 0x00FF); + if(ModeNo == 0x5b) temp--; /* fix fstn mode=5b */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h; TW: Panel Link Horizontal Display Enable Start */ + + if(HwDeviceExtension->jChipType < SIS_315H) { /* TW: Not done in LVDS BIOS 1.10.07 */ + if(tempbx & 0x07) tempbx += 8; /* TW: Done in 630/301B and 630/LVDS BIOSes */ + } + tempbx >>= 3; /* BPLHDEE */ + temp = tempbx & 0x00FF; + if(ModeNo == 0x5b) temp--; /* fix fstn mode=5b */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h; TW: Panel Link Horizontal Display Enable End */ + + /* 2. Vertical setup */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + + /* TW: This entire section from 630/301B and 630/LVDS/LVDS+CH BIOS */ + tempcx = SiS_Pr->SiS_VGAVT; + tempbx = SiS_Pr->SiS_VGAVDE; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + tempbx = 600; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) { + tempbx = 768; + if( (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) && + (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1152x768) ) { + tempbx = 600; + } + } + } + } + tempcx -= tempbx; + + } else { + + tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE; /* VGAVT-VGAVDE */ + + } + + tempbx = SiS_Pr->SiS_LCDVDES; /* VGAVDES */ + push1 = tempbx; + + tempax = SiS_Pr->SiS_VGAVDE; + + if((SiS_Pr->SiS_IF_DEF_TRUMPION == 0) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11)) + && (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(!SiS_Pr->SiS_IF_DEF_DSTN){ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempax = 600; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempax = 768; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempax = 600; /* TW */ + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempax = 768; /* TW */ + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempax = 1024; /* TW */ + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempax = 1050; /* TW */ + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempax = 1200; /* TW */ + else tempax = 600; + } + } + } + + tempbx += tempax; + if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; + + push2 = tempbx; + + tempcx >>= 1; + + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480)){ + if(!SiS_Pr->SiS_IF_DEF_DSTN){ + if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) || + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) ) { /* TW: @@@ TEST - not in BIOS! */ + tempcx = 0x0001; + } else if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) || + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) ) { + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + tempcx = 0x0002; +#ifdef TWNEWPANEL + tempcx = 0x0003; +#endif + } else { + tempcx = 0x0002; /* TW: A901; other 301B BIOS sets 0x0003; */ + } + } else tempcx = 0x0003; + } + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 0x0003; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0001; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0001; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0001; + else tempcx = 0x0057; + } + } + + tempbx += tempcx; /* BPLVRS */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + tempbx++; + } + + if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h; TW: Panel Link Vertical Retrace Start */ + + tempcx >>= 3; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if( (HwDeviceExtension->jChipType < SIS_315H) && + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) ) tempcx = 0x0001; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0002; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0002; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0003; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0005; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempcx = 0x0005; + else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + tempcx = 0x0004; +#ifdef TWNEWPANEL + tempcx = 0x0005; +#endif + } else { + tempcx = 0x0004; /* A901; Other BIOS sets 0x0005; */ + } + } else { + tempcx = 0x0005; + } + } + } + + tempcx = tempcx + tempbx + 1; /* BPLVRE */ + temp = tempcx & 0x000F; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xf0,temp); /* Part1_19h; TW: Panel Link Vertical Retrace End (3:0); Misc. */ + + temp = ((tempbx & 0x0700) >> 8) << 3; /* BPLDESKEW =0 */ + if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40; + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40; + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { /* TW: Inserted from 650/LVDS 1.10.07 */ + temp |= 0x80; + } + } else { + if( (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) ) { + if(HwDeviceExtension->jChipRevision >= 0x30) { + temp |= 0x80; + } + } + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah; TW: Panel Link Control Signal (7:3); Vertical Retrace Start (2:0) */ + + if (HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* 300 series */ + + tempeax = SiS_Pr->SiS_VGAVDE << 6; + temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE); + tempeax = tempeax / (ULONG)SiS_Pr->SiS_VDE; + if(temp != 0) tempeax++; + tempebx = tempeax; /* BPLVCFACT */ + + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) { + tempebx = 0x003F; + } + + temp = (USHORT)(tempebx & 0x00FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,temp); /* Part1_1Eh; TW: Panel Link Vertical Scaling Factor */ + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* 310/325 series */ + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,0x23); + + tempeax = SiS_Pr->SiS_VGAVDE << 18; + temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE); + tempeax = tempeax / SiS_Pr->SiS_VDE; + if(temp != 0) tempeax++; + tempebx = tempeax; /* BPLVCFACT */ + tempvcfact = tempeax; + temp = (USHORT)(tempebx & 0x00FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x37,temp); /* Part1_37h; TW: Panel Link Vertical Scaling Factor */ + temp = (USHORT)((tempebx & 0x00FF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x36,temp); /* Part1_36h; TW: Panel Link Vertical Scaling Factor */ + temp = (USHORT)((tempebx & 0x00030000) >> 16); + if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x35,temp); /* Part1_35h; TW: Panel Link Vertical Scaling Factor */ + +#endif /* SIS315H */ + + } + + tempbx = push2; /* p bx temppush1 BPLVDEE */ + tempcx = push1; + + push1 = temp; /* TW: For 630/301B and 630/LVDS */ + + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(!SiS_Pr->SiS_IF_DEF_DSTN){ + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + if(resinfo == 15) tempcx++; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + if(resinfo == 7) tempcx++; + } + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { + if(resinfo == 7) tempcx++; + if(resinfo == 8) tempcx++; /* TW: Doesnt make sense anyway... */ + } else if(resinfo == 8) tempcx++; + } else { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { + if(resinfo == 7) tempcx++; + } + } + } + } + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { + tempcx = SiS_Pr->SiS_VGAVDE; + tempbx = SiS_Pr->SiS_VGAVDE - 1; + } + + temp = ((tempbx & 0x0700) >> 8) << 3; + temp |= ((tempcx & 0x0700) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh; TW: Vertical Display Overflow; Control Signal */ + + temp = tempbx & 0x00FF; + if(SiS_Pr->SiS_IF_DEF_FSTN) temp++; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch; TW: Panel Link Vertical Display Enable End */ + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh; TW: Panel Link Vertical Display Enable Start */ + + /* 3. Additional horizontal setup (scaling, etc) */ + + tempecx = SiS_Pr->SiS_VGAHDE; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(modeflag & HalfDCLK) + tempecx >>= 1; + } + tempebx = SiS_Pr->SiS_HDE; + if(tempecx == tempebx) tempeax = 0xFFFF; + else { + tempeax = tempecx; + tempeax <<= 16; + temp = (USHORT)(tempeax % tempebx); + tempeax = tempeax / tempebx; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(temp) tempeax++; + } + } + tempecx = tempeax; + + if (HwDeviceExtension->jChipType >= SIS_315H) { + tempeax = SiS_Pr->SiS_VGAHDE; + if(modeflag & HalfDCLK) + tempeax >>= 1; + tempeax <<= 16; + tempeax = (tempeax / tempecx) - 1; + } else { + tempeax = ((SiS_Pr->SiS_VGAHT << 16) / tempecx) - 1; + } + tempecx <<= 16; + tempecx |= (tempeax & 0xFFFF); + temp = (USHORT)(tempecx & 0x00FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh; TW: Panel Link DDA Operational Number in each horiz. line */ + + tempbx = SiS_Pr->SiS_VDE; + if (HwDeviceExtension->jChipType >= SIS_315H) { + tempeax = (SiS_Pr->SiS_VGAVDE << 18) / tempvcfact; + tempbx = (USHORT)(tempeax & 0x0FFFF); + } else { + tempax = SiS_Pr->SiS_VGAVDE << 6; + tempbx = push1; + tempbx &= 0x3f; + if(tempbx == 0) tempbx = 64; + tempax = tempax / tempbx; + tempbx = tempax; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--; + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempbx = 1; + + temp = ((tempbx & 0xFF00) >> 8) << 3; + temp |= (USHORT)((tempecx & 0x0700) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h; TW: Overflow register */ + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h; TW: Panel Link Vertical Accumulator Register */ + + tempecx >>= 16; /* BPLHCFACT */ + if(HwDeviceExtension->jChipType < SIS_315H) { + if(modeflag & HalfDCLK) tempecx >>= 1; + } + temp = (USHORT)((tempecx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h; TW: Panel Link Horizontal Scaling Factor High */ + + temp = (USHORT)(tempecx & 0x00FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x23,temp); /* Part1_22h; TW: Panel Link Horizontal Scaling Factor Low */ + + /* 630/301B and 630/LVDS do something for 640x480 panels here */ + +#ifdef SIS315H + /* TW: DSTN/FSTN initialisation - hardcoded for 320x480 panel */ + if(SiS_Pr->SiS_IF_DEF_DSTN) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,0x01); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x25,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x26,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x27,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x28,0x87); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x29,0x5A); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2A,0x4B); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x007,0x03); + tempbx = SiS_Pr->SiS_HDE + 64; /*Blps = lcdhdee(lcdhdes+HDE) + 64*/ + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x38,temp); + temp=((tempbx & 0xFF00) >> 8) << 3; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,~0x078,temp); + tempbx += 32; /*Blpe=lBlps+32*/ + temp = tempbx & 0x00FF; + if(SiS_Pr->SiS_IF_DEF_FSTN) temp=0; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x39,temp); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3A,0x00); /*Bflml=0*/ + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x007,0x00); + tempbx = SiS_Pr->SiS_VDE / 2; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3B,temp); + temp = ((tempbx & 0xFF00) >> 8) << 3; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x038,temp); + tempeax = SiS_Pr->SiS_HDE << 2; /* BDxFIFOSTOP = (HDE*4)/128 */ + tempebx = 128; + temp = (USHORT)(tempeax % tempebx); + tempeax = tempeax / tempebx; + if(temp != 0) tempeax++; + temp = (USHORT)(tempeax & 0x003F); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x45,~0x0FF,temp); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3F,0x00); /* BDxWadrst0 */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3E,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3D,0x10); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x040,0x00); + tempax = SiS_Pr->SiS_HDE >> 4; /* BDxWadroff = HDE*4/8/8 */ + pushcx = tempax; + temp = tempax & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x43,temp); + temp = ((tempax & 0xFF00) >> 8) << 3; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x0F8,temp); + tempax = SiS_Pr->SiS_VDE; /*BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */ + tempeax = (tempax * pushcx); + tempebx = 0x00100000 + tempeax; + temp = (USHORT)tempebx & 0x000000FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x42,temp); + temp = (USHORT)((tempebx & 0x0000FF00)>>8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x41,temp); + temp = (USHORT)((tempebx & 0x00FF0000)>>16); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x40,temp); + temp = (USHORT)(((tempebx & 0x01000000)>>24) << 7); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x080,temp); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2F,0x03); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,0x50); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x04,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2F,0x01); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x13,0x00); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); /* Unlock */ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1e,0x62); + if(SiS_Pr->SiS_IF_DEF_FSTN){ + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2b,0x1b); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2c,0xe3); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1e,0x62); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2e,0x04); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2f,0x42); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,0x01); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2b,0x02); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2c,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2d,0x00); + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,0x30); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1e,0x7d); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2e,0xe0); + } +#endif /* SIS315H */ + + return; + +} + +#ifdef SIS315H +void +SiS_CRT2AutoThreshold(SiS_Private *SiS_Pr, USHORT BaseAddr) +{ + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40); +} +#endif + + +/* TW: For LVDS / 302b/lv - LCDA (this must only be called on 310/325 series!) */ +/* TW: Double-checked against 650/LVDS and 650/301 BIOS */ +void +SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex) +{ + USHORT modeflag,resinfo; + USHORT push1,push2,tempax,tempbx,tempcx,temp; + ULONG tempeax=0,tempebx,tempecx,tempvcfact; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* TW: From 650/LVDS BIOS */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); /* TW: From 650/LVDS BIOS */ + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* TW: From 650/LVDS 1.10.07 */ + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00); /* TW: From 650/LVDS 1.10.07 */ + } else { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2D,0x0f); /* TW: From 650/301Lvx 1.10.6s */ + } + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + tempax = SiS_Pr->SiS_LCDHDES; + tempbx = SiS_Pr->SiS_HDE; + tempcx = SiS_Pr->SiS_HT; + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 1024; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 1400; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 1600; + else tempbx = 1280; + + } + tempcx -= tempbx; /* HT-HDE */ + push1 = tempax; + tempax += tempbx; /* lcdhdee */ + tempbx = SiS_Pr->SiS_HT; + if(tempax >= tempbx) tempax -= tempbx; + + push2 = tempax; /* push ax lcdhdee */ + + tempcx >>= 2; + + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x28; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x30; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 0x18; + else tempcx = 0x30; + } + } + + tempcx += tempax; /* lcdhrs */ + if(tempcx >= tempbx) tempcx -= tempbx; + /* v ah,cl */ + tempax = tempcx; + tempax >>= 3; /* BPLHRS */ + temp = tempax & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h */ + + temp += 10; + temp &= 0x1F; + temp |= ((tempcx & 0x07) << 5); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h */ + + tempbx = push2; /* lcdhdee */ + tempcx = push1; /* lcdhdes */ + temp = (tempcx & 0x00FF); + temp &= 0x07; /* BPLHDESKEW */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah */ + + tempcx >>= 3; /* BPLHDES */ + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h */ + + if(tempbx & 0x07) tempbx += 8; + tempbx >>= 3; /* BPLHDEE */ + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h */ + + tempcx = SiS_Pr->SiS_VGAVT; + tempbx = SiS_Pr->SiS_VGAVDE; + tempcx -= tempbx; /* GAVT-VGAVDE */ + tempbx = SiS_Pr->SiS_LCDVDES; /* VGAVDES */ + push1 = tempbx; /* push bx temppush1 */ + if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0){ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempax = 768; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempax = 1024; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempax = 1050; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempax = 1200; + else tempax = 960; +#if 0 /* TW: Removed (650/LVDS BIOS) */ + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + tempax = SiS_Pr->SiS_VGAVDE; + } + } +#endif + } else tempax = SiS_Pr->SiS_VGAVDE; /* Trumpion */ + + tempbx += tempax; + tempax = SiS_Pr->SiS_VT; /* VT */ + if(tempbx >= tempax) tempbx -= tempax; + + push2 = tempbx; /* push bx temppush2 */ + tempcx >>= 2; /* TO CHECK - was 1 */ + + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 1; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 3; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 3; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 1; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 1; + else tempcx = 0x0057; + } + } + + tempbx += tempcx; + tempbx++; /* BPLVRS */ + if(tempbx >= tempax) tempbx -= tempax; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h */ + + tempcx >>= 3; + tempcx += tempbx; + tempcx++; /* BPLVRE */ + temp = tempcx & 0x00FF; + temp &= 0x0F; + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + /* TW: Inserted from 650/LVDS BIOS */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xf0,temp); + } else { + /* TW: Inserted from 650/301LVx 1.10.6s */ + temp |= 0xC0; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp); /* Part1_19h */ + } + + temp = (tempbx & 0xFF00) >> 8; + temp &= 0x07; + temp <<= 3; /* BPLDESKEW =0 */ + tempbx = SiS_Pr->SiS_VGAVDE; + if(tempbx != SiS_Pr->SiS_VDE) temp |= 0x40; + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40; + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + /* TW: Inserted from 650/LVDS 1.10.07 */ + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah */ + } else { + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { + if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) temp |= 0x80; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah */ + } + + tempbx = push2; /* p bx temppush2 BPLVDEE */ + tempcx = push1; /* pop cx temppush1 NPLVDES */ + push1 = (USHORT)(tempeax & 0xFFFF); + + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { + if(resinfo == 7) tempcx++; + } + } + /* TW: Inserted from 650/301LVx+LVDS BIOSes */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { + tempbx = SiS_Pr->SiS_VGAVDE; + tempcx = tempbx; + tempbx--; + } + + temp = (tempbx & 0xFF00) >> 8; + temp &= 0x07; + temp <<= 3; + temp = temp | (((tempcx & 0xFF00) >> 8) & 0x07); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh */ + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch */ + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh */ + + tempecx = SiS_Pr->SiS_VGAVT; + tempebx = SiS_Pr->SiS_VDE; + tempeax = SiS_Pr->SiS_VGAVDE; + tempecx -= tempeax; /* VGAVT-VGAVDE */ + tempeax <<= 18; + temp = (USHORT)(tempeax % tempebx); + tempeax = tempeax / tempebx; + if(temp) tempeax++; + tempebx = tempeax; /* BPLVCFACT */ + tempvcfact = tempeax; + temp = (USHORT)(tempebx & 0x00FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x37,temp); + + temp = (USHORT)((tempebx & 0x00FF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x36,temp); + + temp = (USHORT)((tempebx & 0x00030000) >> 16); + if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x35,temp); + + tempecx = SiS_Pr->SiS_VGAHDE; + tempebx = SiS_Pr->SiS_HDE; + tempeax = tempecx; + tempeax <<= 16; + temp = tempeax % tempebx; + tempeax = tempeax / tempebx; + if(temp) tempeax++; + if(tempebx == tempecx) tempeax = 0xFFFF; + tempecx = tempeax; + tempeax = SiS_Pr->SiS_VGAHDE; + tempeax <<= 16; + tempeax = tempeax / tempecx; + tempecx <<= 16; + tempeax--; + tempecx = tempecx | (tempeax & 0xFFFF); + temp = (USHORT)(tempecx & 0x00FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh */ + + tempeax = SiS_Pr->SiS_VGAVDE; + tempeax <<= 18; + tempeax = tempeax / tempvcfact; + tempbx = (USHORT)(tempeax & 0x0FFFF); + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--; + + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempbx = 1; + + temp = ((tempbx & 0xFF00) >> 8) << 3; + temp = temp | (USHORT)(((tempecx & 0x0000FF00) >> 8) & 0x07); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h */ + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h */ + + tempecx >>= 16; /* BPLHCFACT */ + if(modeflag & HalfDCLK) tempecx >>= 1; + temp = (USHORT)((tempecx & 0x0000FF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h */ + + temp=(USHORT)(tempecx & 0x000000FF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x23,temp); + +#if 0 + /* TW: Missing code (calles int 2f) (650/301LVx 1.10.6s; 1.10.7w doesn't do this) */ + if(xxx()) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0e,0xda); + } +#endif + + /* TW: Only for 650/LVDS and 30xLV/30xLVX */ + if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBInfo & (VB_SIS30xLV|VB_SIS30xNEW))){ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1e,0x20); + } + + return; +} + +/* TW: Double-checked against 650/LVDS (1.10.07) and 650/301 BIOS */ +void SiS_SetCRT2Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex ,USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT offset; + UCHAR temp; + + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) return; + + offset = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + temp = (UCHAR)(offset & 0xFF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,temp); + temp = (UCHAR)((offset & 0xFF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09,temp); + temp = (UCHAR)(((offset >> 3) & 0xFF) + 1); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,temp); +} + +/* TW: Checked with 650/LVDS and 650/301 BIOS */ +USHORT +SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,colordepth; + USHORT modeinfo,index,infoflag; + + if(SiS_Pr->UseCustomMode) { + infoflag = SiS_Pr->CInfoFlag; + temp = SiS_Pr->CHDisplay / 16; + } else { + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + modeinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeInfo; + + if(HwDeviceExtension->jChipType < SIS_315H ) { + index = (modeinfo >> 4) & 0xFF; + } else { + index = (modeinfo >> 8) & 0xFF; + } + + temp = SiS_Pr->SiS_ScreenOffset[index]; + } + + colordepth = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + + if(infoflag & InterlaceMode) temp <<= 1; + + temp *= colordepth; + + /* TW: For 1400x1050 and 856x480 */ + if( ( ((ModeNo >= 0x26) && (ModeNo <= 0x28)) || + ModeNo == 0x3f || + ModeNo == 0x42 || + ModeNo == 0x45 ) || + (SiS_Pr->UseCustomMode && (SiS_Pr->CHDisplay % 16)) ) { + colordepth >>= 1; + temp += colordepth; + } + + return(temp); +} + +/* TW: Checked with 650/LVDS BIOS */ +USHORT +SiS_GetColorDepth(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT ColorDepth[6] = { 1, 2, 4, 4, 6, 8}; + SHORT index; + USHORT modeflag; + + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + if(ModeNo <= 0x13) + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + index = (modeflag & ModeInfoFlag) - ModeEGA; + if(index < 0) index = 0; + return(ColorDepth[index]); +} + +/* TW: Checked against 630/301/301B/LVDS, 650/301LVx/LVDS */ +void +SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempah=0,tempbl,infoflag,flag; + + flag = 0; + tempbl = 0xC0; + + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* LVDS */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempah = SiS_Pr->SiS_LCDInfo; + if(HwDeviceExtension->jChipType >= SIS_315H) { + tempbl = tempah & 0xc0; + } + if(SiS_Pr->SiS_LCDInfo & LCDSync) { + flag = 1; + } + } + if(flag != 1) tempah = infoflag >> 8; + tempah &= 0xC0; + tempah |= 0x20; + if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; + + if (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { + /* TW: BIOS does something here @@@ */ + } + + tempah &= 0x3f; + tempah |= tempbl; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + + } else { + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* ---- 300 series --- */ + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 630 - 301B */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempah = SiS_Pr->SiS_LCDInfo; + if(SiS_Pr->SiS_LCDInfo & LCDSync) { + flag = 1; + } + } + if(flag != 1) tempah = infoflag >> 8; + tempah &= 0xC0; + tempah |= 0x20; + + if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; + + if (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { + /* TW: BIOS does something here @@@ */ + } + + tempah &= 0x3f; + tempah |= tempbl; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + + } else { /* 630 - 301 */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempah = SiS_Pr->SiS_LCDInfo; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpandingShift) { /* ! */ + flag = 1; + } + } + if(flag != 1) tempah = infoflag >> 8; + tempah &= 0xC0; + tempah |= 0x30; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x3F,tempah); + + } + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* ----- 310/325 series ---- */ + + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 310/325 - 301LV/LVX */ + + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); + tempah &= 0xC0; + tempah |= 0x20; + if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + + } else { /* 310/325 - 301, 301B */ + + tempah = infoflag >> 8; + tempah &= 0xC0; + tempah |= 0x20; + + if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; + + if (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { + /* TW: BIOS does something here @@@ */ + } + + tempah &= 0x3f; + tempah |= tempbl; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + + } +#endif /* SIS315H */ + } + } +} + +/* TW: Set CRT2 FIFO on 300/630/730 */ +/* TW: Checked against 630/301B BIOS; BIOS does not set PCI registers */ +#ifdef SIS300 +void +SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,index; + USHORT modeidindex,refreshratetableindex; + USHORT VCLK=0,MCLK,colorth=0,data2=0; + USHORT tempal, tempah, tempbx, tempcl, tempax; + USHORT CRT1ModeNo,CRT2ModeNo; + USHORT SelectRate_backup; + ULONG data,eax; + const UCHAR LatencyFactor[] = { + 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */ + 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */ + 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */ + 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */ + 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */ + 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */ + 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */ + 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */ + }; + const UCHAR LatencyFactor730[] = { + 69, 63, 61, + 86, 79, 77, + 103, 96, 94, + 120,113,111, + 137,130,128, /* <-- last entry, data below */ + 137,130,128, /* to avoid using illegal values */ + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + 137,130,128, + }; + const UCHAR ThLowB[] = { + 81, 4, 72, 6, 88, 8,120,12, + 55, 4, 54, 6, 66, 8, 90,12, + 42, 4, 45, 6, 55, 8, 75,12 + }; + const UCHAR ThTiming[] = { + 1, 2, 2, 3, 0, 1, 1, 2 + }; + + SelectRate_backup = SiS_Pr->SiS_SelectCRT2Rate; + + if(!SiS_Pr->CRT1UsesCustomMode) { + + CRT1ModeNo = SiS_Pr->SiS_CRT1Mode; /* get CRT1 ModeNo */ + SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT1ModeNo,&modeidindex); + SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); + SiS_Pr->SiS_SelectCRT2Rate = 0; + refreshratetableindex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT1ModeNo, + modeidindex,HwDeviceExtension); + + if(CRT1ModeNo >= 0x13) { + index = SiS_Pr->SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK; + index &= 0x3F; + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + data2 = SiS_Pr->SiS_ModeType - 2; + } + + } else { + + CRT1ModeNo = 0xfe; + VCLK = SiS_Pr->CSRClock; /* Get VCLK */ + data2 = (SiS_Pr->CModeFlag & ModeInfoFlag) - 2; + + } + + if(CRT1ModeNo >= 0x13) { + if(HwDeviceExtension->jChipType == SIS_300) { + index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); + } else { + index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); + } + index &= 0x07; + MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: CRT1Mode 0x%x VCLK %d MCLK %d modetype-2 = %d\n", + CRT1ModeNo, VCLK, MCLK, data2); +#endif + + switch(data2) { /* Get color depth */ + case 0 : colorth = 1; break; + case 1 : colorth = 1; break; + case 2 : colorth = 2; break; + case 3 : colorth = 2; break; + case 4 : colorth = 3; break; + case 5 : colorth = 4; break; + default: colorth = 2; break; + } + data2 = (colorth * VCLK) / MCLK; + + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + temp = ((temp & 0x00FF) >> 6) << 1; + if(temp == 0) temp = 1; + temp <<= 2; + temp &= 0xff; + + data2 = temp - data2; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: data2 (step1) = %d\n", + data2); +#endif + + if((28 * 16) % data2) { + data2 = (28 * 16) / data2; + data2++; + } else { + data2 = (28 * 16) / data2; + } + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: data2 (step2) = %d\n", + data2); +#endif + + if(HwDeviceExtension->jChipType == SIS_300) { + + tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); + tempah &= 0x62; + tempah >>= 1; + tempal = tempah; + tempah >>= 3; + tempal |= tempah; + tempal &= 0x07; + tempcl = ThTiming[tempal]; + tempbx = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + tempbx >>= 6; + tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + tempah >>= 4; + tempah &= 0x0c; + tempbx |= tempah; + tempbx <<= 1; + tempal = ThLowB[tempbx + 1]; + tempal *= tempcl; + tempal += ThLowB[tempbx]; + data = tempal; + + } else if(HwDeviceExtension->jChipType == SIS_730) { + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x80000050); + eax = SiS_GetReg3(0xcfc); +#else + eax = pciReadLong(0x00000000, 0x50); +#endif + tempal = (USHORT)(eax >> 8); + tempal &= 0x06; + tempal <<= 5; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x800000A0); + eax = SiS_GetReg3(0xcfc); +#else + eax = pciReadLong(0x00000000, 0xA0); +#endif + temp = (USHORT)(eax >> 28); + temp &= 0x0F; + tempal |= temp; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: Latencyfactorindex = 0x%x\n", tempal); +#endif + + tempbx = tempal; /* BIOS BUG (2.04.5d, 2.04.6a use ah here, which is unset!) */ + tempbx = 0; /* -- do it like the BIOS anyway... */ + tempax = tempbx; + tempbx &= 0xc0; + tempbx >>= 6; + tempax &= 0x0f; + tempax *= 3; + tempbx += tempax; + + data = LatencyFactor730[tempbx]; + data += 15; + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + if(!(temp & 0x80)) data += 5; + + } else { + + index = 0; + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + if(temp & 0x0080) index += 12; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x800000A0); + eax = SiS_GetReg3(0xcfc); +#else + /* TW: We use pci functions X offers. We use tag 0, because + * we want to read/write to the host bridge (which is always + * 00:00.0 on 630, 730 and 540), not the VGA device. + */ + eax = pciReadLong(0x00000000, 0xA0); +#endif + temp = (USHORT)(eax >> 24); + if(!(temp&0x01)) index += 24; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x80000050); + eax = SiS_GetReg3(0xcfc); +#else + eax = pciReadLong(0x00000000, 0x50); +#endif + temp=(USHORT)(eax >> 24); + if(temp & 0x01) index += 6; + + temp = (temp & 0x0F) >> 1; + index += temp; + + data = LatencyFactor[index]; + data += 15; + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); + if(!(temp & 0x80)) data += 5; + } + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: latencyfactor (CRT1) = %d\n", data); +#endif + + data += data2; /* CRT1 Request Period */ + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: CRT1 request period = %d\n", data); +#endif + + CRT2ModeNo = ModeNo; + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup; + SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT2ModeNo,&modeidindex); + + refreshratetableindex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT2ModeNo, + modeidindex,HwDeviceExtension); + + index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,CRT2ModeNo,modeidindex, + refreshratetableindex,HwDeviceExtension); + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + + data2 = SiS_Pr->SiS_ModeType - 2; + switch(data2) { /* Get color depth */ + case 0 : colorth = 1; break; + case 1 : colorth = 1; break; + case 2 : colorth = 2; break; + case 3 : colorth = 2; break; + case 4 : colorth = 3; break; + case 5 : colorth = 4; break; + default: colorth = 2; break; + } + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: CRT2Mode 0x%x VCLK %d MCLK %d modetype-2 = %d, colorth %d\n", + CRT2ModeNo, VCLK, MCLK, data2, colorth); +#endif + + data = data * VCLK * colorth; + if(data % (MCLK << 4)) { + data = data / (MCLK << 4); + data++; + } else { + data = data / (MCLK << 4); + } + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "FIFO2: data (unclipped) = 0x%x\n", data); +#endif + + if(data <= 6) data = 6; + if(data > 0x14) data = 0x14; + + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x01); + if(HwDeviceExtension->jChipType == SIS_300) { + if(data <= 0x0f) temp = (temp & (~0x1F)) | 0x13; + else temp = (temp & (~0x1F)) | 0x16; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + temp = (temp & (~0x1F)) | 0x13; + } + } else { + if( ( (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) ) && + (HwDeviceExtension->jChipRevision >= 0x30) ) /* 630s or 730(s?) */ + { + temp = (temp & (~0x1F)) | 0x1b; + } else { + temp = (temp & (~0x1F)) | 0x16; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0xe0,temp); + + if( (HwDeviceExtension->jChipType == SIS_630) && + (HwDeviceExtension->jChipRevision >= 0x30) ) /* 630s, NOT 730 */ + { + if(data > 0x13) data = 0x13; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,0xe0,data); + + } else { /* If mode <= 0x13, we just restore everything */ + + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup; + + } +} +#endif + +/* TW: Set FIFO on 310 series */ +#ifdef SIS315H +void +SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + + UCHAR CombCode[] = { 1, 1, 1, 4, 3, 1, 3, 4, + 4, 1, 4, 4, 5, 1, 5, 4}; + UCHAR CRT2ThLow[] = { 39, 63, 55, 79, 78,102, 90,114, + 55, 87, 84,116,103,135,119,151}; + USHORT temp3,tempax,tempbx,tempcx; + USHORT tempcl, tempch; + USHORT index; + USHORT CRT1ModeNo,CRT2ModeNo; + USHORT ModeIdIndex; + USHORT RefreshRateTableIndex; + USHORT SelectRate_backup; + + SelectRate_backup = SiS_Pr->SiS_SelectCRT2Rate; + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x01,0x3B); + + if(!SiS_Pr->CRT1UsesCustomMode) { + + CRT1ModeNo = SiS_Pr->SiS_CRT1Mode; /* get CRT1 ModeNo */ + SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT1ModeNo,&ModeIdIndex); + + SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); + SiS_Pr->SiS_SelectCRT2Rate = 0; + + /* Get REFIndex for crt1 refreshrate */ + RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT1ModeNo, + ModeIdIndex,HwDeviceExtension); + + index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,CRT1ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + tempax = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + + tempbx = SiS_GetColorDepth(SiS_Pr,ROMAddr,CRT1ModeNo,ModeIdIndex); /* Get colordepth */ + tempbx >>= 1; + if(!tempbx) tempbx++; + + } else { + + tempax = SiS_Pr->CSRClock; /* Get VCLK */ + tempbx = (SiS_Pr->CModeFlag & ModeInfoFlag) - 2; + switch(tempbx) { /* Get color depth */ + case 0 : tempbx = 1; break; + case 1 : tempbx = 1; break; + case 2 : tempbx = 2; break; + case 3 : tempbx = 2; break; + case 4 : tempbx = 3; break; + case 5 : tempbx = 4; break; + default: tempbx = 2; break; + } + + } + + tempax *= tempbx; + + tempbx = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension); /* Get MCLK */ + + tempax /= tempbx; + + tempbx = tempax; + +#if 0 /* TW: BIOS code is skrewed */ + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x02) { + tempax = 16; + } else { + tempax = 8; + } +#endif + tempax = 16; + + tempax -= tempbx; + + tempbx = tempax; /* tempbx = 16-DRamBus - DCLK*BytePerPixel/MCLK */ + + tempax = ((52 * 16) / tempbx); + + if ((52*16 % tempbx) != 0) { + tempax++; + } + tempcx = tempax; + tempcx += 40; + + /* get DRAM latency */ + tempcl = (SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) >> 3) & 0x7; /* SR17[5:3] DRAM Queue depth */ + tempch = (SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) >> 6) & 0x3; /* SR17[7:6] DRAM Grant length */ + + for (temp3 = 0; temp3 < 16; temp3 += 2) { + if ((CombCode[temp3] == tempcl) && (CombCode[temp3+1] == tempch)) { + temp3 = CRT2ThLow[temp3 >> 1]; + } + } + + tempcx += temp3; /* CRT1 Request Period */ + + CRT2ModeNo = ModeNo; /* get CRT2 ModeNo */ + SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT2ModeNo,&ModeIdIndex); /* Get ModeID Table */ + + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup; + + RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT2ModeNo, + ModeIdIndex,HwDeviceExtension); + + index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,CRT2ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + tempax = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + + tempbx = SiS_GetColorDepth(SiS_Pr,ROMAddr,CRT2ModeNo,ModeIdIndex); /* Get colordepth */ + tempbx >>= 1; + if(!tempbx) tempbx++; + + tempax *= tempbx; + + tempax *= tempcx; + + tempbx = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension); /* Get MCLK */ + tempbx <<= 4; + + tempcx = tempax; + tempax /= tempbx; + if(tempcx % tempbx) tempax++; /* CRT1 Request period * TCLK * BytePerPixel / (MCLK*16) */ + + if (tempax > 0x37) tempax = 0x37; + + /* TW: 650/LVDS (1.10.07, 1.10.00), 650/301LV overrule calculated value; 315 does not */ + if(HwDeviceExtension->jChipType == SIS_650) { + tempax = 0x04; + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3F,tempax); +} + +USHORT +SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT index; + + index = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension); + if(index >= 4) { + index -= 4; + return(SiS_Pr->SiS_MCLKData_1[index].CLOCK); + } else { + return(SiS_Pr->SiS_MCLKData_0[index].CLOCK); + } +} +#endif + +/* TW: Checked against 650/LVDS 1.10.07 BIOS */ +void +SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT modeflag; + USHORT PanelIndex,ResIndex; + const SiS_LVDSDesStruct *PanelDesPtr = NULL; + + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ) { + + SiS_GetLVDSDesPtrA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &PanelIndex,&ResIndex); + switch (PanelIndex) + { + case 0: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break; /* --- expanding --- */ + case 1: PanelDesPtr = SiS_Pr->LVDS1280x1024Des_1; break; + case 2: PanelDesPtr = SiS_Pr->LVDS1400x1050Des_1; break; + case 3: PanelDesPtr = SiS_Pr->LVDS1600x1200Des_1; break; + case 4: PanelDesPtr = SiS_Pr->LVDS1024x768Des_2; break; /* --- non expanding --- */ + case 5: PanelDesPtr = SiS_Pr->LVDS1280x1024Des_2; break; + case 6: PanelDesPtr = SiS_Pr->LVDS1400x1050Des_2; break; + case 7: PanelDesPtr = SiS_Pr->LVDS1600x1200Des_2; break; + default: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break; + } + + } else { + + SiS_GetLVDSDesPtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &PanelIndex,&ResIndex,HwDeviceExtension); + + switch (PanelIndex) + { + case 0: PanelDesPtr = SiS_Pr->SiS_PanelType00_1; break; /* --- expanding --- | */ + case 1: PanelDesPtr = SiS_Pr->SiS_PanelType01_1; break; + case 2: PanelDesPtr = SiS_Pr->SiS_PanelType02_1; break; + case 3: PanelDesPtr = SiS_Pr->SiS_PanelType03_1; break; + case 4: PanelDesPtr = SiS_Pr->SiS_PanelType04_1; break; + case 5: PanelDesPtr = SiS_Pr->SiS_PanelType05_1; break; + case 6: PanelDesPtr = SiS_Pr->SiS_PanelType06_1; break; + case 7: PanelDesPtr = SiS_Pr->SiS_PanelType07_1; break; + case 8: PanelDesPtr = SiS_Pr->SiS_PanelType08_1; break; + case 9: PanelDesPtr = SiS_Pr->SiS_PanelType09_1; break; + case 10: PanelDesPtr = SiS_Pr->SiS_PanelType0a_1; break; + case 11: PanelDesPtr = SiS_Pr->SiS_PanelType0b_1; break; + case 12: PanelDesPtr = SiS_Pr->SiS_PanelType0c_1; break; + case 13: PanelDesPtr = SiS_Pr->SiS_PanelType0d_1; break; + case 14: PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; break; + case 15: PanelDesPtr = SiS_Pr->SiS_PanelType0f_1; break; + case 16: PanelDesPtr = SiS_Pr->SiS_PanelType00_2; break; /* --- non-expanding --- */ + case 17: PanelDesPtr = SiS_Pr->SiS_PanelType01_2; break; + case 18: PanelDesPtr = SiS_Pr->SiS_PanelType02_2; break; + case 19: PanelDesPtr = SiS_Pr->SiS_PanelType03_2; break; + case 20: PanelDesPtr = SiS_Pr->SiS_PanelType04_2; break; + case 21: PanelDesPtr = SiS_Pr->SiS_PanelType05_2; break; + case 22: PanelDesPtr = SiS_Pr->SiS_PanelType06_2; break; + case 23: PanelDesPtr = SiS_Pr->SiS_PanelType07_2; break; + case 24: PanelDesPtr = SiS_Pr->SiS_PanelType08_2; break; + case 25: PanelDesPtr = SiS_Pr->SiS_PanelType09_2; break; + case 26: PanelDesPtr = SiS_Pr->SiS_PanelType0a_2; break; + case 27: PanelDesPtr = SiS_Pr->SiS_PanelType0b_2; break; + case 28: PanelDesPtr = SiS_Pr->SiS_PanelType0c_2; break; + case 29: PanelDesPtr = SiS_Pr->SiS_PanelType0d_2; break; + case 30: PanelDesPtr = SiS_Pr->SiS_PanelType0e_2; break; + case 31: PanelDesPtr = SiS_Pr->SiS_PanelType0f_2; break; + case 32: PanelDesPtr = SiS_Pr->SiS_CHTVUNTSCDesData; break; + case 33: PanelDesPtr = SiS_Pr->SiS_CHTVONTSCDesData; break; + case 34: PanelDesPtr = SiS_Pr->SiS_CHTVUPALDesData; break; + case 35: PanelDesPtr = SiS_Pr->SiS_CHTVOPALDesData; break; + default: + if(HwDeviceExtension->jChipType < SIS_315H) + PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; + else + PanelDesPtr = SiS_Pr->SiS_PanelType01_1; + break; + } + } + SiS_Pr->SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES; + SiS_Pr->SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES; + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding){ + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + if(!(modeflag & HalfDCLK)) { + SiS_Pr->SiS_LCDHDES = 632; + } + } + } else { + if(!(SiS_Pr->SiS_SetFlag & CRT2IsVGA)) { + if((HwDeviceExtension->jChipType < SIS_315H) || (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)) { /* TW: New from 650/LVDS 1.10.07 */ + if(SiS_Pr->SiS_LCDResInfo >= SiS_Pr->SiS_Panel1024x768){ + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + if(HwDeviceExtension->jChipType < SIS_315H) { + if(!(modeflag & HalfDCLK)) { + SiS_Pr->SiS_LCDHDES = 320; + } + } else { + /* TW: New from 650/LVDS 1.10.07 */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) + SiS_Pr->SiS_LCDHDES = 480; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) + SiS_Pr->SiS_LCDHDES = 804; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) + SiS_Pr->SiS_LCDHDES = 704; + if(!(modeflag & HalfDCLK)) { + SiS_Pr->SiS_LCDHDES = 320; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) + SiS_Pr->SiS_LCDHDES = 632; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) + SiS_Pr->SiS_LCDHDES = 542; + } + } + } + } + } + } + } + } + return; +} + +/* TW: Checked against 630/LVDS (2.04.5c) and 650/LVDS (1.10.07) BIOS */ +void +SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *PanelIndex, + USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempbx,tempal,modeflag; + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + tempbx = 0; + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + tempbx = 32; + if((SiS_Pr->SiS_VBInfo & SetPALTV) && (!SiS_Pr->SiS_CHPALM)) tempbx += 2; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + /* TW: Nothing special needed for SOverscan */ + /* PALM uses NTSC data, PALN uses PAL data */ + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempbx = SiS_Pr->SiS_LCDTypeInfo; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 16; + /* TW: Inserted from 650/LVDS (1.10.07) BIOS */ + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + if(modeflag & HalfDCLK) tempbx += 16; + } + } + /* TW: Inserted from 630/LVDS and 650/LVDS (1.10.07) BIOS */ + if(SiS_Pr->SiS_SetFlag & CRT2IsVGA) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + tempal = 0x07; + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++; + } + } + } + + *PanelIndex = tempbx; + *ResIndex = tempal & 0x1F; +} + +void +SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *PanelIndex, + USHORT *ResIndex) +{ + USHORT tempbx=0,tempal; + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tempbx = 3; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { + tempbx = 4; + } else tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_PanelMinLVDS; + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 4; + + if(ModeNo<=0x13) + tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + *PanelIndex = tempbx; + *ResIndex = tempal & 0x1F; +} + +/* TW: Checked against 650/LVDS (1.10.07), 650/301LV, 650/301LVx (!), 630/301 and 630/301B (II) BIOS */ +void +SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT BaseAddr, USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT i,j,modeflag; + USHORT tempcl,tempah=0; +#ifdef SIS300 + USHORT temp; +#endif +#ifdef SIS315H + USHORT tempbl; +#endif + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + } + + /* TW: BIOS does not do this (neither 301 nor LVDS) */ + /* (But it's harmless; see SetCRT2Offset) */ + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,0x00); /* fix write part1 index 0 BTDRAM bit Bug */ + + /* TW: Removed 301B302B301LV302LV check here to match 650/LVDS BIOS */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + + /* TW: 1. for LVDS/302B/302LV **LCDA** */ + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xAF,0x40); /* FUNCTION CONTROL */ + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2E,0xF7); + + } else { + + for(i=0,j=4; i<3; i++,j++) SiS_SetReg1(SiS_Pr->SiS_Part1Port,j,0); + + tempcl = SiS_Pr->SiS_ModeType; + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* ---- 300 series ---- */ + + /* TW: Inserted entire if-section from 630/301B BIOS */ + if((HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32); + temp &= 0xef; + temp |= 0x02; + /* If 0x10 not set when using VGA2, monitor will stay black */ + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) || (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) { + temp |= 0x10; + temp &= 0xfd; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + } + + if(ModeNo > 0x13) { + tempcl -= ModeVGA; + if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */ + tempah = ((0x10 >> tempcl) | 0x80); + } + } else tempah = 0x80; + + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0xA0; + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* ---- 310 series ---- */ + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x08); + } + } + + if(ModeNo > 0x13) { + tempcl -= ModeVGA; + if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */ + tempah = (0x08 >> tempcl); + if (tempah == 0) tempah = 1; + tempah |= 0x40; + } + } else tempah = 0x40; + + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50; + +#endif /* SIS315H */ + + } + + if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0; + + if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,tempah); /* FUNCTION CONTROL */ + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xa0,tempah); /* FUNCTION CONTROL */ + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + /* TW: 2. for 301 (301B, 302B 301LV, 302LV non-LCDA) */ + + tempah = 0x01; + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + tempah |= 0x02; + } + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) { + tempah ^= 0x05; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + tempah ^= 0x01; + } + } + + if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0; + + if(HwDeviceExtension->jChipType < SIS_315H) { + + /* --- 300 series --- */ + + tempah = (tempah << 5) & 0xFF; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x01,tempah); + tempah = (tempah >> 5) & 0xFF; + + } else { + + /* --- 310 series --- */ + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2E,0xF8,tempah); + + } + + if((SiS_Pr->SiS_ModeType == ModeVGA) && (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) { + tempah |= 0x10; + } + + /* TW: Inserted from 630/301 BIOS */ + if((HwDeviceExtension->jChipType < SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301)) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + tempah |= 0x80; + } + } else { + tempah |= 0x80; + } + + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)){ + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + tempah |= 0x20; + } + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0D,0x40,tempah); + + tempah = 0; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + SiS_Pr->SiS_SetFlag |= RPLLDIV2XO; + tempah |= 0x40; + } else { + if(!(SiS_Pr->SiS_SetFlag & TVSimuMode)) { +#ifdef oldHV + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { +#endif + SiS_Pr->SiS_SetFlag |= RPLLDIV2XO; + tempah |= 0x40; +#ifdef oldHV + } +#endif + } + } + } else { + SiS_Pr->SiS_SetFlag |= RPLLDIV2XO; + tempah |= 0x40; + } + } + /* TW: Inserted from 630/301LVx BIOS 1.10.6s */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) + tempah |= 0x40; + } + } + + if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960)) { + tempah |= 0x80; + } + + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0C,tempah); + + } else { + + /* TW: 3. for LVDS */ + + /* TW: Inserted if-statement - Part1Port 0x2e not assigned on 300 series */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + + /* TW: Inserted this entire section (BIOS 650/LVDS); added ModeType check + * (LVDS can only be slave in 8bpp modes) + */ + tempah = 0x80; + if( (modeflag & CRT2Mode) && (SiS_Pr->SiS_ModeType > ModeVGA) ) { + if (SiS_Pr->SiS_VBInfo & DriverMode) { + tempah |= 0x02; + } + } + + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + tempah |= 0x02; + } + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + tempah ^= 0x01; + } + + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) { + tempah = 1; + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2e,0xF0,tempah); + + } else { + + /* TW: (added ModeType check) */ + tempah = 0; + if( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) && (SiS_Pr->SiS_ModeType > ModeVGA) ) { + tempah |= 0x02; + } + tempah <<= 5; + + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0; + + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x01,tempah); + + } + + } + + } + + /* TW: Inserted the entire following section */ + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + if(HwDeviceExtension->jChipType >= SIS_315H) { + +#ifdef SIS315H + tempah = 0x04; /* For all bridges */ + tempbl = 0xfb; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + tempah = 0x00; + if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)) + tempbl = 0xff; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,tempbl,tempah); + + /* TW: This in order to fix "TV-blue-bug" on 315+301 */ + if(SiS_Pr->SiS_VBType & VB_SIS301) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2c,0xCF); /* For 301 */ + } else { + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,0xCF,0x30); /* For 301LV */ + } else { + tempah = 0x30; /* For 301B */ + tempbl = 0xcf; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + tempah = 0x00; + if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)) { + tempbl = 0xff; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,tempbl,tempah); + } + } + + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* For 301LV */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,0x3f,0xc0); + } else { /* For 301, 301B */ + tempah = 0xc0; + tempbl = 0x3f; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + tempah = 0x00; + if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)) { + tempbl = 0xff; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,tempbl,tempah); + } + + tempah = 0x00; /* For all bridges */ + tempbl = 0x7f; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + tempbl = 0xff; + if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) + tempah |= 0x80; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah); + +#endif /* SIS315H */ + + } else if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x21,0x3f); + + if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) || + ( (HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) ) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x23,0x7F); + } else { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x23,0x80); + } + + } + + } else { /* LVDS */ + +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + + tempah = 0x04; + tempbl = 0xfb; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + tempah = 0x00; + if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)) + tempbl = 0xff; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,tempbl,tempah); + + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x00); + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,0xcf,0x30); + + } + + } +#endif + + } + +} + +void +SiS_GetCRT2Data(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + + SiS_GetCRT2DataLVDS(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + } else { + + if((HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + + SiS_GetCRT2Data301(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + + /* TW: Need LVDS Data for LCD on 630/301B! */ + SiS_GetCRT2DataLVDS(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + + } else { + + SiS_GetCRT2Data301(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + } + + } + + } else { + + SiS_GetCRT2Data301(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + } + + } else { + + SiS_GetCRT2DataLVDS(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + } +} + +/* Checked with 650/LVDS 1.10.07 BIOS */ +void +SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT CRT2Index, ResIndex; + const SiS_LVDSDataStruct *LVDSData = NULL; + + SiS_GetCRT2ResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + + SiS_Pr->SiS_NewFlickerMode = 0; + SiS_Pr->SiS_RVBHRS = 50; + SiS_Pr->SiS_RY1COE = 0; + SiS_Pr->SiS_RY2COE = 0; + SiS_Pr->SiS_RY3COE = 0; + SiS_Pr->SiS_RY4COE = 0; + + SiS_GetCRT2PtrA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&ResIndex); + + switch (CRT2Index) { + case 0: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; + case 1: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break; + case 2: LVDSData = SiS_Pr->SiS_LVDS1280x960Data_1; break; + case 3: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_1; break; + case 4: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_1; break; + case 5: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break; + case 6: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break; + case 7: LVDSData = SiS_Pr->SiS_LVDS1280x960Data_2; break; + case 8: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_2; break; + case 9: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_2; break; + default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; + } + + } else { + + /* TW: SiS630/301B needs LVDS Data! */ + if( (HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) { + SiS_Pr->SiS_IF_DEF_LVDS = 1; + } + + SiS_GetCRT2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&ResIndex,HwDeviceExtension); + + /* TW: SiS630/301B needs LVDS Data! */ + if( (HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) { + SiS_Pr->SiS_IF_DEF_LVDS = 0; + } + + switch (CRT2Index) { + case 0: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break; + case 1: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; + case 2: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break; + case 3: LVDSData = SiS_Pr->SiS_LVDS800x600Data_2; break; + case 4: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break; + case 5: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break; + case 6: LVDSData = SiS_Pr->SiS_LVDS640x480Data_1; break; + case 7: LVDSData = SiS_Pr->SiS_LVDSXXXxXXXData_1; break; /* TW: New */ + case 8: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_1; break; /* TW: New */ + case 9: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_2; break; /* TW: New */ + case 10: LVDSData = SiS_Pr->SiS_CHTVUNTSCData; break; + case 11: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break; + case 12: LVDSData = SiS_Pr->SiS_CHTVUPALData; break; + case 13: LVDSData = SiS_Pr->SiS_CHTVOPALData; break; + case 14: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; break; + case 15: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; /* TW: New */ + case 16: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_1; break; /* TW: New */ + case 17: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_2; break; /* TW: New */ + case 18: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_2; break; /* TW: New */ + case 19: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_1; break; /* TW: New */ + case 20: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_2; break; /* TW: New */ + case 90: LVDSData = SiS_Pr->SiS_CHTVUPALMData; break; + case 91: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break; + case 92: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break; + case 93: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break; + case 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break; /* TW: Super Overscan */ + default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; + } + } + + SiS_Pr->SiS_VGAHT = (LVDSData+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (LVDSData+ResIndex)->VGAVT; + SiS_Pr->SiS_HT = (LVDSData+ResIndex)->LCDHT; + SiS_Pr->SiS_VT = (LVDSData+ResIndex)->LCDVT; + + if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + + if(!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)){ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768){ + SiS_Pr->SiS_HDE = 1024; + SiS_Pr->SiS_VDE = 768; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024){ + SiS_Pr->SiS_HDE = 1280; + SiS_Pr->SiS_VDE = 1024; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050){ + SiS_Pr->SiS_HDE = 1400; + SiS_Pr->SiS_VDE = 1050; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200){ + SiS_Pr->SiS_HDE = 1600; + SiS_Pr->SiS_VDE = 1200; + } else { + SiS_Pr->SiS_HDE = 1280; + SiS_Pr->SiS_VDE = 960; + } + } + + } else { + + if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if((!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) || (SiS_Pr->SiS_SetFlag & CRT2IsVGA)) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { + SiS_Pr->SiS_HDE = 800; + SiS_Pr->SiS_VDE = 600; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + SiS_Pr->SiS_HDE = 1024; + SiS_Pr->SiS_VDE = 768; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + SiS_Pr->SiS_HDE = 1280; + SiS_Pr->SiS_VDE = 1024; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + SiS_Pr->SiS_HDE = 1024; + SiS_Pr->SiS_VDE = 600; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + SiS_Pr->SiS_HDE = 1400; + SiS_Pr->SiS_VDE = 1050; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { + SiS_Pr->SiS_HDE = 1152; + SiS_Pr->SiS_VDE = 768; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x864) { + SiS_Pr->SiS_HDE = 1152; + SiS_Pr->SiS_VDE = 864; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { + SiS_Pr->SiS_HDE = 1280; + SiS_Pr->SiS_VDE = 768; + } else { + SiS_Pr->SiS_HDE = 1600; + SiS_Pr->SiS_VDE = 1200; + } + if(SiS_Pr->SiS_IF_DEF_FSTN) { + SiS_Pr->SiS_HDE = 320; + SiS_Pr->SiS_VDE = 480; + } + } + } + } + } + } +} + +/* TW: Checked against 630/301B BIOS; does not check VDE values for LCD */ +void +SiS_GetCRT2Data301(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempax,tempbx,modeflag; + USHORT resinfo; + USHORT CRT2Index,ResIndex; + const SiS_LCDDataStruct *LCDPtr = NULL; + const SiS_TVDataStruct *TVPtr = NULL; + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + SiS_Pr->SiS_NewFlickerMode = 0; + SiS_Pr->SiS_RVBHRS = 50; + SiS_Pr->SiS_RY1COE = 0; + SiS_Pr->SiS_RY2COE = 0; + SiS_Pr->SiS_RY3COE = 0; + SiS_Pr->SiS_RY4COE = 0; + + SiS_GetCRT2ResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + /* TW: For VGA2 ("RAMDAC2") */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){ + SiS_GetRAMDAC2DATA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + return; + } + + /* TW: For TV */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + + SiS_GetCRT2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&ResIndex,HwDeviceExtension); + + switch (CRT2Index) { +#ifdef oldHV + case 2: TVPtr = SiS_Pr->SiS_ExtHiTVData; break; + case 7: TVPtr = SiS_Pr->SiS_St1HiTVData; break; + case 12: TVPtr = SiS_Pr->SiS_St2HiTVData; break; +#endif + case 3: TVPtr = SiS_Pr->SiS_ExtPALData; break; + case 4: TVPtr = SiS_Pr->SiS_ExtNTSCData; break; + case 8: TVPtr = SiS_Pr->SiS_StPALData; break; + case 9: TVPtr = SiS_Pr->SiS_StNTSCData; break; + default: TVPtr = SiS_Pr->SiS_StPALData; break; /* TW: Just to avoid a crash */ + } + + SiS_Pr->SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX; + SiS_Pr->SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT; + SiS_Pr->SiS_VGAHT = (TVPtr+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT; + SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE; + SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE; + SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS; + SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode; + if(modeflag & HalfDCLK) { + SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS; + } + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { /* TW: NOT oldHV! */ + + if(resinfo == 0x08) SiS_Pr->SiS_NewFlickerMode = 0x40; + if(resinfo == 0x09) SiS_Pr->SiS_NewFlickerMode = 0x40; + if(resinfo == 0x12) SiS_Pr->SiS_NewFlickerMode = 0x40; + + if(SiS_Pr->SiS_VGAVDE == 350) SiS_Pr->SiS_SetFlag |= TVSimuMode; + + SiS_Pr->SiS_HT = ExtHiTVHT; + SiS_Pr->SiS_VT = ExtHiTVVT; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + SiS_Pr->SiS_HT = StHiTVHT; + SiS_Pr->SiS_VT = StHiTVVT; + if(!(modeflag & Charx8Dot)){ + SiS_Pr->SiS_HT = StHiTextTVHT; + SiS_Pr->SiS_VT = StHiTextTVVT; + } + } + } + + } else { + + SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE; + SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE; + SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE; + SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE; + + if(modeflag & HalfDCLK) { + SiS_Pr->SiS_RY1COE = 0x00; + SiS_Pr->SiS_RY2COE = 0xf4; + SiS_Pr->SiS_RY3COE = 0x10; + SiS_Pr->SiS_RY4COE = 0x38; + } + + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + SiS_Pr->SiS_HT = NTSCHT; +/* if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { */ /* TW: ALL newer 650 BIOSes do this, no idea about 301B */ + if((ModeNo == 0x4a) || (ModeNo == 0x38)) SiS_Pr->SiS_HT = NTSC2HT; +/* } */ + SiS_Pr->SiS_VT = NTSCVT; + } else { + SiS_Pr->SiS_HT = PALHT; + SiS_Pr->SiS_VT = PALVT; + } + + } + + return; + } + + /* TW: For LCD */ + /* TW: Checked against 650/301LV; CRT2Index different (but does not matter) */ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + + SiS_GetCRT2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&ResIndex,HwDeviceExtension); + + switch (CRT2Index) { + case 0: LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; /* VESA Timing */ + case 1: LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break; /* VESA Timing */ + case 5: LCDPtr = SiS_Pr->SiS_StLCD1024x768Data; break; /* Obviously unused */ + case 6: LCDPtr = SiS_Pr->SiS_StLCD1280x1024Data; break; /* Obviously unused */ + case 10: LCDPtr = SiS_Pr->SiS_St2LCD1024x768Data; break; /* Non-VESA Timing */ + case 11: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; /* Non-VESA Timing */ + case 13: LCDPtr = SiS_Pr->SiS_NoScaleData1024x768; break; /* Non-expanding */ + case 14: LCDPtr = SiS_Pr->SiS_NoScaleData1280x1024; break; /* Non-expanding */ + case 15: LCDPtr = SiS_Pr->SiS_LCD1280x960Data; break; /* 1280x960 */ + case 20: LCDPtr = SiS_Pr->SiS_ExtLCD1400x1050Data; break; /* VESA Timing */ + case 21: LCDPtr = SiS_Pr->SiS_NoScaleData1400x1050; break; /* Non-expanding */ + case 22: LCDPtr = SiS_Pr->SiS_StLCD1400x1050Data; break; /* Non-VESA Timing */ + case 23: LCDPtr = SiS_Pr->SiS_ExtLCD1600x1200Data; break; /* VESA Timing */ + case 24: LCDPtr = SiS_Pr->SiS_NoScaleData1600x1200; break; /* Non-expanding */ + case 25: LCDPtr = SiS_Pr->SiS_StLCD1600x1200Data; break; /* Non-VESA Timing */ + default: LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; /* Just to avoid a crash */ + } + + SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX; + SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT; + SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT; + SiS_Pr->SiS_HT = (LCDPtr+ResIndex)->LCDHT; + SiS_Pr->SiS_VT = (LCDPtr+ResIndex)->LCDVT; + + tempax = 1024; + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 560; + else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640; + else tempbx = 768; + } else { + if (SiS_Pr->SiS_VGAVDE == 357) tempbx = 527; + else if(SiS_Pr->SiS_VGAVDE == 420) tempbx = 620; + else if(SiS_Pr->SiS_VGAVDE == 525) tempbx = 775; + else if(SiS_Pr->SiS_VGAVDE == 600) tempbx = 775; + else if(SiS_Pr->SiS_VGAVDE == 350) tempbx = 560; + else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640; + else tempbx = 768; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024){ + tempax = 1280; + if (SiS_Pr->SiS_VGAVDE == 360) tempbx = 768; + else if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 800; + else if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 864; + else tempbx = 1024; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960){ + tempax = 1280; + if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 700; + else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 800; + else if(SiS_Pr->SiS_VGAVDE == 1024) tempbx = 960; + else tempbx = 960; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050){ + tempax = 1400; + tempbx = 1050; + } + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + tempax = SiS_Pr->SiS_VGAHDE; + tempbx = SiS_Pr->SiS_VGAVDE; + } + SiS_Pr->SiS_HDE = tempax; + SiS_Pr->SiS_VDE = tempbx; + return; + } +} + +USHORT +SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT resindex; + + if(ModeNo<=0x13) + resindex=SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + else + resindex=SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + + return(resindex); +} + +/* TW: Checked against 650/301LV, 650/LVDS, 630/LVDS, 630/301 and 630/301B BIOS */ +void +SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT xres,yres,modeflag=0,resindex; + + resindex = SiS_GetResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + + if(ModeNo <= 0x13) { + xres = SiS_Pr->SiS_StResInfo[resindex].HTotal; + yres = SiS_Pr->SiS_StResInfo[resindex].VTotal; + } else { + xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal; + yres = SiS_Pr->SiS_ModeResInfo[resindex].VTotal; + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + /* TW: Inserted entire if-section from 650/LVDS BIOS 1.10.07: */ + if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 1)) { + if((ModeNo != 0x03) && (SiS_Pr->SiS_SetFlag & CRT2IsVGA)) { + if(yres == 350) yres = 400; + } + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x3a) & 0x01) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x34) == 0x12) + yres = 400; + } + } + + if(ModeNo > 0x13) { + if(SiS_Pr->SiS_IF_DEF_FSTN == 1){ + xres *= 2; + yres *= 2; + } else { + if(modeflag & HalfDCLK) xres *= 2; + if(modeflag & DoubleScanMode) yres *= 2; + } + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + /* TW: Inserted from 650/301LV BIOS */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if(xres == 720) xres = 640; + } else { + if((HwDeviceExtension->jChipType != SIS_300) || + (SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | + SetCRT2ToSCART | SetCRT2ToLCD | SetCRT2ToHiVisionTV))) { + if(xres == 720) xres = 640; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(yres == 400) yres = 405; + if(yres == 350) yres = 360; + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + if(yres == 360) yres = 375; + } + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768){ + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + if(yres == 350) yres = 357; + if(yres == 400) yres = 420; + if(yres == 480) yres = 525; + } + } + } + /* TW: Inserted for 630/301B */ + if( ( (HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300) ) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) { + if(xres == 720) xres = 640; + } + } + } else { + if(xres == 720) xres = 640; + /* TW: Inserted from 650/LVDS and 630/LVDS BIOS */ + if(SiS_Pr->SiS_SetFlag & CRT2IsVGA) { + yres = 400; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480; + } else { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480; + } + } + } + SiS_Pr->SiS_VGAHDE = SiS_Pr->SiS_HDE = xres; + SiS_Pr->SiS_VGAVDE = SiS_Pr->SiS_VDE = yres; +} + +/* TW: Checked against 650/301 and 650/LVDS (1.10.07) BIOS; modified for new panel resolutions */ +/* TW: Done differently in 630/301B BIOS; but same effect; checked against 630/301 */ +void +SiS_GetCRT2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempbx=0,tempal=0; + USHORT Flag,resinfo=0; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { /* LCD */ + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { + tempbx = 15; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tempbx = 20; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx = 21; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 22; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { + tempbx = 23; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx = 24; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 25; + } else if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + tempbx = 13; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempbx++; + } else { + tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_Panel1024x768; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + tempbx += 5; + /* GetRevisionID(); */ + /* TW: BIOS only adds 5 once */ + tempbx += 5; + } + } + + } else { /* TV */ +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV){ + if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_SetFlag &= (~TVSimuMode); /* TW: Was "(!TVSimuMode)" - WRONG */ + tempbx = 2; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(!(SiS_Pr->SiS_SetFlag & TVSimuMode)) tempbx = 12; /* TW: Was 10! - WRONG */ + } + } else { +#endif + if(SiS_Pr->SiS_VBInfo & SetPALTV) tempbx = 3; + else tempbx = 4; + if(SiS_Pr->SiS_SetFlag & TVSimuMode) tempbx += 5; +#ifdef oldHV + } +#endif + } + + if(ModeNo <= 0x13) { + tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + tempal &= 0x3F; + + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + (SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV))) { + if(tempal == 0x06) tempal = 0x07; + } + + /* TW: Inserted from 300/301LV BIOS */ + if((HwDeviceExtension->jChipType == SIS_300) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + if(ModeNo > 0x13) { + if((resinfo == 0x0c) || (resinfo == 0x0d)) /* 720 (index diff. on 310/325!) */ + tempal = 6; + } + } + + if(HwDeviceExtension->jChipType != SIS_300) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if((ModeNo == 0x31) || (ModeNo == 0x32)) tempal = 6; + } + } + + *CRT2Index = tempbx; + *ResIndex = tempal; + + } else { /* LVDS */ + + Flag = 1; + tempbx = 0; + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + Flag = 0; + tempbx = 10; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + tempbx += 2; + if(SiS_Pr->SiS_CHSOverScan) tempbx = 99; + if(SiS_Pr->SiS_CHPALM) { + tempbx = 90; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + } else if(SiS_Pr->SiS_CHPALN) { + tempbx = 92; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + } + + } + } + } + + if(Flag == 1) { + tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_PanelMinLVDS; + if(SiS_Pr->SiS_LCDResInfo <= SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 3; + } else { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tempbx = 8; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx++; + } + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + tempbx = 7; + } + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) tempbx = 6; + + /* TW: Inserted from 630/LVDS 2.04.5c BIOS */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + tempbx = 15; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { + tempbx = 16; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { + tempbx = 18; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx++; + } + } + } + + if(ModeNo <= 0x13) + tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else { + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + if(SiS_Pr->SiS_IF_DEF_FSTN){ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480){ + tempbx = 14; + tempal = 6; + } + } + + /* TW: Inserted from 650/LVDS BIOS */ + if(SiS_Pr->SiS_SetFlag & CRT2IsVGA) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) tempal = 7; + if(HwDeviceExtension->jChipType < SIS_315H) { + /* TW: Inserted from 630/LVDS (2.04.5c) and 630/301B (II) BIOS */ + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++; + } + + } + + /* TW: Inserted from 630/301B BIOS */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(ModeNo > 0x13) { + if(HwDeviceExtension->jChipType < SIS_315H) { + if((resinfo == 0x0c) || (resinfo == 0x0d)) /* 720 */ + tempal = 6; + } else { + if((resinfo == 0x0d) || (resinfo == 0x0e)) /* 720 */ + tempal = 6; + } + } + } + + *CRT2Index = tempbx; + *ResIndex = tempal & 0x1F; + } +} + +void +SiS_GetCRT2PtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index, + USHORT *ResIndex) +{ + USHORT tempbx,tempal; + + tempbx = SiS_Pr->SiS_LCDResInfo; + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { + tempbx = 4; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tempbx = 3; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { + tempbx = 2; + } else { + tempbx -= SiS_Pr->SiS_Panel1024x768; + } + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 5; + + if(ModeNo <= 0x13) + tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + *CRT2Index = tempbx; + *ResIndex = tempal & 0x1F; +} + +/* TW: New from 650/301LVx BIOS */ +void +SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index, + USHORT *ResIndex) +{ + USHORT tempbx,tempal; + + if(ModeNo <= 0x13) + tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + tempbx = SiS_Pr->SiS_LCDResInfo; + + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 16; + else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx += 32; + + *CRT2Index = tempbx; + *ResIndex = tempal & 0x3F; +} + +/* TW: Checked against all (incl 650/LVDS (1.10.07), 630/301B, 630/301) BIOSes */ +USHORT +SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + SHORT LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, + 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01 }; + USHORT RefreshRateTableIndex,i,backup_i; + USHORT modeflag,index,temp,backupindex; + + if(SiS_Pr->UseCustomMode) return 0; + + if(ModeNo <= 0x13) + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(modeflag & HalfDCLK) return(0); + } + } + + if(ModeNo < 0x14) return(0xFFFF); + + /* TW: CR33 holds refresh rate index for CRT1 [3:0] and CRT2 [7:4]. + * On LVDS machines, CRT2 index is always 0 and will be + * set to 0 by the following code; this causes the function + * to take the first non-interlaced mode in SiS_Ext2Struct + */ + + index = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x33); + index >>= SiS_Pr->SiS_SelectCRT2Rate; + index &= 0x0F; + backupindex = index; + + if(index > 0) index--; + + if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) index = 0; + } else { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if((HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300)) + index = 0; + else if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) + index = backupindex = 0; + } + } + } + + if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + index = 0; + } + } + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + /* TW: This is not done in 630/301B BIOS */ + temp = LCDRefreshIndex[SiS_Pr->SiS_LCDResInfo]; + if(index > temp) index = temp; + } else { + index = 0; + } + } + } + + RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; + ModeNo = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID; + + /* TW: Inserted from 650/LVDS 1.10.07, 650/301LVx 1.10.6s */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(!(SiS_Pr->SiS_VBInfo & DriverMode)) { + if( (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x105) || + (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x107) ) { + if(backupindex <= 1) + RefreshRateTableIndex++; + } + } + } + + i = 0; + do { + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].ModeID != ModeNo) break; + temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag; + temp &= ModeInfoFlag; + if(temp < SiS_Pr->SiS_ModeType) break; + i++; + index--; + } while(index != 0xFFFF); + + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i - 1].Ext_InfoFlag; + if(temp & InterlaceMode) { + i++; + } + } + } + + i--; + + if((SiS_Pr->SiS_SetFlag & ProgrammingCRT2) && (!(SiS_Pr->SiS_VBInfo & DisableCRT2Display))) { + backup_i = i; + if (!(SiS_AdjustCRT2Rate(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,&i,HwDeviceExtension))) { + /* TW: This is for avoiding random data to be used; i is + * in an undefined state if no matching CRT2 mode is + * found. + */ + i = backup_i; + } + } + + return(RefreshRateTableIndex + i); +} + +/* Checked against all (incl 650/LVDS (1.10.07), 630/301) BIOSes */ +BOOLEAN +SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *i,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempax,tempbx,resinfo; + USHORT modeflag,infoflag; + + if (ModeNo <= 0x13) + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + tempbx = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID; + + tempax = 0; + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + /* TW: For 301, 301B, 302B, 301LV, 302LV */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + tempax |= SupportRAMDAC2; + if(HwDeviceExtension->jChipType >= SIS_315H) { + tempax |= SupportTV; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == 0x0a) tempax |= SupportTV1024; + } + } + } + } + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + tempax |= SupportLCD; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) { + if((resinfo == 6) && (SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + tempax |= SupportAllCRT2; + (*i) = 0; /* TW: Restore RefreshTableIndex (BIOS 650/301LVx 1.10.6s) */ + return(1); + } else { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) { + if((resinfo == 6) && (SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + return(0); + } else { + if((resinfo >= 9) && (resinfo != 0x14)) { + tempax = 0; + return(0); + } + } + } + } + } + } + } + } else { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + if((resinfo != 0x0f) && ((resinfo == 4) || (resinfo >= 8))) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { + if((resinfo != 0x10) && (resinfo > 8)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { + if((resinfo != 0x0e) && (resinfo > 8)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(resinfo > 9) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(resinfo > 8) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { + if((resinfo == 4) || (resinfo > 7)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { + if((resinfo == 4) || (resinfo == 3) || (resinfo > 6)) return(0); + } + } + } +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { /* for HiTV */ + tempax |= SupportHiVisionTV; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode){ + if(resinfo == 4) return(0); + if(resinfo == 3) { + if(SiS_Pr->SiS_SetFlag & TVSimuMode) return(0); + } + if(resinfo > 7) return(0); + } + } else { +#endif + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)) { + tempax |= SupportTV; + tempax |= SupportTV1024; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if((SiS_Pr->SiS_VBInfo & SetNotSimuMode) && (SiS_Pr->SiS_VBInfo & SetPALTV)) { + if(resinfo != 8) { + if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) || + ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 4)) ) { + tempax &= ~(SupportTV1024); + if(HwDeviceExtension->jChipType >= SIS_315H) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) || + ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) { + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0); + } + } + } else { + if( (resinfo != 3) || + (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == 3) return(0); + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0); + } + } + } else return(0); + } + } + } + } else { + tempax &= ~(SupportTV1024); + if(HwDeviceExtension->jChipType >= SIS_315H) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) || + ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) { + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0); + } + } + } else { + if( (resinfo != 3) || + (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == 3) return(0); + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0); + } + } + } else return(0); + } + } + } else { /* slavemode */ + if(resinfo != 8) { + if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) || + ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 4) ) ) { + tempax &= ~(SupportTV1024); + if(HwDeviceExtension->jChipType >= SIS_315H) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) || + ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) { + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0); + } + } + } else { + if( (resinfo != 3) || + (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == 3) return(0); + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0); + } + } + } else return(0); + } + } + } + } + } else { /* 301 */ + tempax &= ~(SupportTV1024); + if(HwDeviceExtension->jChipType >= SIS_315H) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) || + ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) { + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0); + } + } + } else { + if( (resinfo != 3) || + (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == 3) return(0); + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0); + } + } + } else return(0); + } + } + } +#ifdef oldHV + } +#endif + } else { /* TW: for LVDS */ + + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + tempax |= SupportCHTV; + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempax |= SupportLCD; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { + if((resinfo != 0x14) && (resinfo > 0x09)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + if((resinfo != 0x0f) && (resinfo > 0x08)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { + if((resinfo != 0x10) && (resinfo > 0x08)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + if((resinfo != 0x15) && (resinfo > 0x09)) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(resinfo > 0x09) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(resinfo > 0x08) return(0); + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600){ + if(resinfo > 0x07) return(0); + if(resinfo == 0x04) return(0); + } + } + } + /* TW: Look backwards in table for matching CRT2 mode */ + for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == tempbx; (*i)--) { + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag; + if(infoflag & tempax) { + return(1); + } + if ((*i) == 0) break; + } + /* TW: Look through the whole mode-section of the table from the beginning + * for a matching CRT2 mode if no mode was found yet. + */ + for((*i) = 0; ; (*i)++) { + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag; + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != tempbx) { + return(0); + } + if(infoflag & tempax) { + return(1); + } + } + return(1); +} + +/* Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */ +void +SiS_SaveCRT2Info(SiS_Private *SiS_Pr, USHORT ModeNo) +{ + USHORT temp1,temp2; + + /* TW: We store CRT1 ModeNo in CR34 */ + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,ModeNo); + temp1 = (SiS_Pr->SiS_VBInfo & SetInSlaveMode) >> 8; + temp2 = ~(SetInSlaveMode >> 8); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x31,temp2,temp1); +} + +/* TW: Checked against 650+301, 650/LVDS (1.10.07) and 650/301LVx (1.10.6s) BIOS */ +void +SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension, + int checkcrt2mode) +{ + USHORT tempax,tempbx,temp; + USHORT modeflag, resinfo=0; + UCHAR OutputSelect = *SiS_Pr->pSiS_OutputSelect; + + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + if (ModeNo <= 0x13) + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + } + + SiS_Pr->SiS_SetFlag = 0; + + SiS_Pr->SiS_ModeType = modeflag & ModeInfoFlag; + + tempbx = 0; + if(SiS_BridgeIsOn(SiS_Pr,BaseAddr,HwDeviceExtension) == 0) { /* TW: "== 0" inserted from 630/301B BIOS */ + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + /* SiS_HiVision is only used on 310/325+30xB/LV/LVX */ + if(SiS_Pr->SiS_HiVision & 0x03) { /* TW: New from 650/301LVx 1.10.6s */ + temp &= (SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode); /* 0x83 */ + temp |= SetCRT2ToHiVisionTV; /* 0x80 */ + } + if(SiS_Pr->SiS_HiVision & 0x04) { /* TW: New from 650/301LVx 1.10.6s */ + temp &= (SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode); /* 0x83 */ + temp |= SetCRT2ToSVIDEO; /* 0x08 */ + } + if(SiS_Pr->SiS_IF_DEF_FSTN) { /* fstn must set CR30=0x21 */ + temp = (SetCRT2ToLCD | SetSimuScanMode); + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,temp); + } + tempbx |= temp; + tempax = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) << 8; + tempax &= (LoadDACFlag | DriverMode | SetDispDevSwitch | SetNotSimuMode | SetPALTV); + tempbx |= tempax; + tempbx &= ~(SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display);; + +#ifdef SIS315H + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & (VB_SIS302B | VB_SIS30xLV | VB_SIS30xNEW)) { +#if 0 /* Not in 1.10.8r */ + if(ModeNo == 3) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf); + } +#endif +#if 0 /* Not in 1.10.8r */ + if(!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); + } +#endif + if((tempbx & SetCRT2ToLCD) && (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD)) { + if((SiS_GetReg1(SiS_Pr->SiS_P3d4, 0x36) & 0x0f) == SiS_Pr->SiS_Panel1400x1050) { + if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */ + } + } + } else { + if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */ + } + } + } + } + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) { + tempbx |= SetCRT2ToLCDA; + } + } + /* TW: Inserted from 650/LVDS 1.10.07 BIOS: */ + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(temp & SetToLCDA) + tempbx |= SetCRT2ToLCDA; + if(temp & EnableLVDSHiVision) + tempbx |= SetCRT2ToHiVisionTV; + } + } + +#endif /* SIS315H */ + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp = SetCRT2ToLCDA | SetCRT2ToSCART | SetCRT2ToLCD | + SetCRT2ToRAMDAC | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO; /* = 0x807C; */ + if(SiS_Pr->SiS_IF_DEF_HiVision == 1) + temp |= SetCRT2ToHiVisionTV; /* = 0x80FC; */ + } else { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) + temp = SetCRT2ToLCDA | SetCRT2ToSCART | + SetCRT2ToLCD | SetCRT2ToHiVisionTV | + SetCRT2ToAVIDEO | SetCRT2ToSVIDEO; /* = 0x80bc */ + else + temp = SetCRT2ToLCDA | SetCRT2ToLCD; + } else { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) + temp = SetCRT2ToTV | SetCRT2ToLCD; + else + temp = SetCRT2ToLCD; + } + } + + if(!(tempbx & temp)) { + tempax = DisableCRT2Display; + tempbx = 0; + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(tempbx & SetCRT2ToLCDA) { + tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode); + } + if(tempbx & SetCRT2ToRAMDAC) { + tempbx &= (0xFF00|SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode); + } + if((tempbx & SetCRT2ToLCD) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) { + tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + } + if(tempbx & SetCRT2ToSCART) { + tempbx &= (0xFF00|SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode); + tempbx |= SetPALTV; + } +#if 0 /* TW: Not done in 650/301LVx 1.10.6s BIOS */ + } else if(tempbx & SetCRT2ToHiVisionTV){ + tempbx &= (0xFF00|SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode); + tempbx |= SetPALTV; + } +#endif + } else { /* LVDS */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(tempbx & SetCRT2ToLCDA) + tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode); + } + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(tempbx & SetCRT2ToTV) + tempbx &= (0xFF00|SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode); + } + if(tempbx & SetCRT2ToLCD) { + tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + } + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(tempbx & SetCRT2ToLCDA) + tempbx |= SetCRT2ToLCD; + } + } + + if(tempax & DisableCRT2Display) { + if(!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) { + tempbx = SetSimuScanMode | DisableCRT2Display; + } + } + + if(!(tempbx & DriverMode)){ + tempbx |= SetSimuScanMode; + } + + /* TW: LVDS (LCD/TV) and 630+301B (LCD) can only be slave in 8bpp modes */ + if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_ModeType <= ModeVGA) ) { + modeflag &= (~CRT2Mode); + } + if( (HwDeviceExtension->jChipType < SIS_315H) && + (HwDeviceExtension->jChipType != SIS_300) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + if(SiS_Pr->SiS_ModeType <= ModeVGA) { + if(tempbx & SetCRT2ToLCD) { + modeflag &= (~CRT2Mode); + } + } + } + /* TW end */ + + if(!(tempbx & SetSimuScanMode)){ + if(tempbx & SwitchToCRT2) { + if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) { + if( (HwDeviceExtension->jChipType >= SIS_315H) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) { + if(resinfo != 0x0a) + tempbx |= SetSimuScanMode; + } else { + tempbx |= SetSimuScanMode; + } + } + } else { + if(!(SiS_BridgeIsEnable(SiS_Pr,BaseAddr,HwDeviceExtension))) { + if(!(tempbx & DriverMode)) { + if(SiS_BridgeInSlave(SiS_Pr)) { + tempbx |= SetSimuScanMode; + } + } + } + } + } + + if(!(tempbx & DisableCRT2Display)) { + if(tempbx & DriverMode) { + if(tempbx & SetSimuScanMode) { + if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) { + if( (HwDeviceExtension->jChipType >= SIS_315H) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) { + if(resinfo != 0x0a) { /* TW: Inserted from 650/301 BIOS */ + tempbx |= SetInSlaveMode; + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(tempbx & SetCRT2ToTV) { + if(!(tempbx & SetNotSimuMode)) + SiS_Pr->SiS_SetFlag |= TVSimuMode; + } + } + } /* TW: Inserted from 650/301 BIOS */ + } else { + tempbx |= SetInSlaveMode; + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(tempbx & SetCRT2ToTV) { + if(!(tempbx & SetNotSimuMode)) + SiS_Pr->SiS_SetFlag |= TVSimuMode; + } + } + } + } + } + } else { + tempbx |= SetInSlaveMode; + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(tempbx & SetCRT2ToTV) { + if(!(tempbx & SetNotSimuMode)) + SiS_Pr->SiS_SetFlag |= TVSimuMode; + } + } + } + } + + if(SiS_Pr->SiS_CHOverScan) { + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + if((temp & TVOverScan) || (SiS_Pr->SiS_CHOverScan == 1) ) + tempbx |= SetCHTVOverScan; + } + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79); + if( (temp & 0x80) || (SiS_Pr->SiS_CHOverScan == 1) ) + tempbx |= SetCHTVOverScan; + } + } + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { +#ifdef SIS300 + if((HwDeviceExtension->jChipType==SIS_630) || + (HwDeviceExtension->jChipType==SIS_730)) { + if(ROMAddr && SiS_Pr->SiS_UseROM) { + OutputSelect = ROMAddr[0xfe]; + } + if(!(OutputSelect & EnablePALMN)) + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0x3F); + if(tempbx & SetCRT2ToTV) { + if(tempbx & SetPALTV) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + if(temp & EnablePALM) tempbx &= (~SetPALTV); + } + } + } +#endif +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(ROMAddr && SiS_Pr->SiS_UseROM) { + OutputSelect = ROMAddr[0xf3]; + if(HwDeviceExtension->jChipType == SIS_330) { + OutputSelect = ROMAddr[0x11b]; + } + } + if(!(OutputSelect & EnablePALMN)) + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0x3F); + if(tempbx & SetCRT2ToTV) { + if(tempbx & SetPALTV) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(temp & EnablePALM) tempbx &= (~SetPALTV); + } + } + } +#endif + } + + /* PALM/PALN on Chrontel 7019 */ + SiS_Pr->SiS_CHPALM = SiS_Pr->SiS_CHPALN = FALSE; + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + if(tempbx & SetCRT2ToTV) { + if(tempbx & SetPALTV) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(temp & EnablePALM) SiS_Pr->SiS_CHPALM = TRUE; + else if(temp & EnablePALN) SiS_Pr->SiS_CHPALN = TRUE; + } + } + } + + SiS_Pr->SiS_VBInfo = tempbx; + + if(HwDeviceExtension->jChipType == SIS_630) { + SiS_WhatIsThis(SiS_Pr, SiS_Pr->SiS_VBInfo); + } + +#ifdef TWDEBUG +#ifdef LINUX_KERNEL + printk(KERN_DEBUG "sisfb: (VBInfo= 0x%04x, SetFlag=0x%04x)\n", + SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); +#endif +#ifdef LINUX_XF86 + xf86DrvMsgVerb(0, X_PROBED, 3, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n", + SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); +#endif +#endif + +#if 0 /* TW: Incomplete! (But does not seem to be required) */ + if(HwDeviceExtension->jChipType < SIS_315H) { + /* TW: From A901/630+301B BIOS */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) + } + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) + if( [si] == 3) ModeIdIndex = 0x3f2b; + } + } + SiS_SetRegAND(SiS_Pr->SiS_P3d4, 0x31, 0xF7); + if(ModeNo == 0x13) bp+4 = 0x03; + } else { + /* From 650/301LVx BIOS: */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4, 0x31, 0xF7); + if(ModeNo == 0x13) bp+4 = 0x03; + else bp+4 = ModeNo; + } +#endif + + /* TW: 630/301B and 650/301 (not 301LV!) BIOSes do more here, but this seems for DOS mode */ + +} + +void +SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo) +{ + unsigned long eax, temp; + unsigned short temp1; + + if(!(SiS_Pr->SiS_ChSW)) return; + +#ifndef LINUX_XF86 + SiS_SetReg4(0xcf8,0x80000874); + eax = SiS_GetReg3(0xcfc); +#else + eax = pciReadLong(0x00000800, 0x74); +#endif + eax &= 0xFFFF; + temp = eax; + eax += 0x3c; + temp1 = SiS_GetReg4((USHORT)eax); + temp1 &= 0xFEFF; + SiS_SetReg5((USHORT)eax, temp1); + temp1 = SiS_GetReg4((USHORT)eax); + eax = temp; + eax += 0x3a; + temp1 = SiS_GetReg4((USHORT)eax); + temp1 &= 0xFEFF; + if(!(myvbinfo & SetCRT2ToTV)) { + temp1 |= 0x0100; + } + SiS_SetReg5((USHORT)eax, temp1); + temp1 = SiS_GetReg4((USHORT)eax); +} + +void +SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempax,tempbx,temp; + USHORT temp1,modeflag=0,tempcx; + USHORT StandTableIndex,CRT1Index; + USHORT ResInfo,DisplayType; + const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr = NULL; + + SiS_Pr->SiS_RVBHCMAX = 1; + SiS_Pr->SiS_RVBHCFACT = 1; + + if(ModeNo <= 0x13){ + + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + StandTableIndex = SiS_GetModePtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); + tempax = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[0]; + tempbx = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[6]; + temp1 = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[7]; + + } else { + + if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ) { + + temp = SiS_GetLVDSCRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,&ResInfo,&DisplayType); + + if(temp == 0) return; + + switch(DisplayType) { + case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break; + case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break; + case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break; + case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break; + case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break; + case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break; + case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break; + case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break; + case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break; + case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break; + case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break; + case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break; + case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break; + case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1; break; + case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1_H; break; + case 16: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2; break; + case 17: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2_H; break; + case 18: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break; + case 19: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break; + case 20: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break; + case 21: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break; + case 22: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break; + case 23: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1; break; + case 24: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1_H; break; + case 25: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2; break; + case 26: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2_H; break; + case 27: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1; break; + case 28: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1_H; break; + case 29: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2; break; + case 30: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2_H; break; + case 36: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1; break; + case 37: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1_H; break; + case 38: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2; break; + case 39: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2_H; break; + case 99: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break; + default: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + } + tempax = (LVDSCRT1Ptr+ResInfo)->CR[0]; + tempax |= (LVDSCRT1Ptr+ResInfo)->CR[14] << 8; + tempax &= 0x03FF; + tempbx = (LVDSCRT1Ptr+ResInfo)->CR[6]; + tempcx = (LVDSCRT1Ptr+ResInfo)->CR[13] << 8; + tempcx &= 0x0100; + tempcx <<= 2; + tempbx |= tempcx; + temp1 = (LVDSCRT1Ptr+ResInfo)->CR[7]; + + } else { + + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; +#if 0 /* Not any longer */ + if(HwDeviceExtension->jChipType < SIS_315H) CRT1Index &= 0x3F; +#endif + tempax = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[0]; + tempax |= SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] << 8; + tempax &= 0x03FF; + tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[6]; + tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13] << 8; + tempcx &= 0x0100; + tempcx <<= 2; + tempbx |= tempcx; + temp1 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7]; + + } + + } + + if(temp1 & 0x01) tempbx |= 0x0100; + if(temp1 & 0x20) tempbx |= 0x0200; + + tempax += 5; + + /* Charx8Dot is no more used (and assumed), so we set it */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + modeflag |= Charx8Dot; + } + + if(modeflag & Charx8Dot) tempax *= 8; + else tempax *= 9; + + /* TW: From 650/301LVx 1.10.6s */ + if(modeflag & HalfDCLK) tempax <<= 1; + + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = tempax; + tempbx++; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = tempbx; +} + +void +SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) +{ + if(HwDeviceExtension->jChipType >= SIS_315H) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2f,0x01); + else + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01); +} + +void +SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) +{ + if(HwDeviceExtension->jChipType >= SIS_315H) + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2F,0xFE); + else + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x24,0xFE); +} + +void +SiS_EnableCRT2(SiS_Private *SiS_Pr) +{ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); +} + +/* Checked against all BIOSes */ +void +SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT tempah,pushax=0; +#endif + USHORT temp=0; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + + if (SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== TW: For 30xB/LV ===== */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* 300 series */ + + if(HwDeviceExtension->jChipType == SIS_300) { /* New for 300+301LV */ + + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + } + if(SiS_Is301B(SiS_Pr,BaseAddr)) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f); + SiS_ShortDelay(SiS_Pr,1); + } + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); + SiS_DisplayOff(SiS_Pr); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + if( (!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) || + (!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) ) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + } + + } else { + + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + } + if(SiS_Is301B(SiS_Pr,BaseAddr)) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f); + SiS_ShortDelay(SiS_Pr,1); + } + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); + SiS_DisplayOff(SiS_Pr); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x80); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40); + if( (!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) || + (!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) ) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + } + } + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* 310/325 series */ + + if(IS_SIS650740) { /* 650, 740 */ + +#if 0 + if(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00) != 1) return; /* From 1.10.7w */ +#endif + + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { + + if(!(SiS_IsM650or651(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0xef; + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0xf7; + } + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah); + } + + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); + + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00); + } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00); + } + + SiS_SetReg3(SiS_Pr->SiS_P3c6,0x00); + + pushax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06); + + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + + } + + if(SiS_Pr->SiS_VBType & (VB_SIS301B|VB_SIS302B)) { + tempah = 0x3f; + if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0x7f; + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0xbf; + } + } + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah); + } + + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + + if(SiS_Pr->SiS_VBType & (VB_SIS301B|VB_SIS302B)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF); + SiS_DisplayOff(SiS_Pr); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + } else { + SiS_DisplayOff(SiS_Pr); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF); + } + + } else { + + if(SiS_Pr->SiS_VBType & (VB_SIS301B|VB_SIS302B)) { + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf); + SiS_DisplayOff(SiS_Pr); + } + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp); + } else { + SiS_DisplayOff(SiS_Pr); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp); + } + + } + + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { + + tempah = 0x3f; + if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0x7f; + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0xbf; + } + } + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah); + + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f); + + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf); + } + + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) { + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFD,0x00); + } + } + } + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x06,pushax); + + } + + + } else { /* 315, 330 */ + + if(SiS_Is301B(SiS_Pr,BaseAddr)) { + tempah = 0x3f; + if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0x7f; + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0xbf; + } + } + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah); + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_DisplayOff(SiS_Pr); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + } + } + if( (!(SiS_Is301B(SiS_Pr,BaseAddr))) || + (!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) ) { + + if( (!(SiS_Is301B(SiS_Pr,BaseAddr))) || + (!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) ) { + + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); + SiS_DisplayOff(SiS_Pr); + + } + + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp); + + } + + } /* 315/330 */ + +#endif /* SIS315H */ + + } + + } else { /* ============ TW: For 301 ================ */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF0,0x0B); + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 1); + } + } + + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); /* disable VB */ + SiS_DisplayOff(SiS_Pr); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + } + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); /* disable lock mode */ + + if(HwDeviceExtension->jChipType >= SIS_315H) { + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); /* disable CRT2 */ + } + + } + + } else { /* ============ TW: For LVDS =============*/ + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* 300 series */ + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { + SiS_SetCH700x(SiS_Pr,0x090E); + } + + if(HwDeviceExtension->jChipType == SIS_730) { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x11) & 0x08)) { + SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension); + } + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + } + } else { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x11) & 0x08)) { + + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) { + + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + + SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension); + + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06) & 0x1c)) { + SiS_DisplayOff(SiS_Pr); + } + + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + } + } + } + } + + SiS_DisplayOff(SiS_Pr); + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x80); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40); + + if( (!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) || + (!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) ) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + } + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* 310/325 series */ + + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_Chrontel701xBLOff(SiS_Pr); + SiS_Chrontel701xOff(SiS_Pr); + } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_Chrontel701xBLOff(SiS_Pr); + SiS_Chrontel701xOff(SiS_Pr); + } + + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetCH701x(SiS_Pr,0x0149); + } else if(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetCH701x(SiS_Pr,0x0149); + } + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + SiS_DisplayOff(SiS_Pr); + } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_DisplayOff(SiS_Pr); + } else if(!(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_DisplayOff(SiS_Pr); + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + } else if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80); + } + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + } else if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + if(SiS_CRT2IsLCD(SiS_Pr, BaseAddr,HwDeviceExtension)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1e,0xdf); + } + } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1e,0xdf); + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xff); + } else { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); + } + } + + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr); + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7); + } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7); + } else if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7); + } + +#if 0 /* TW: BIOS code makes no sense */ + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + if(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) { + /* Nothing there! */ + } + } + } +#endif + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + if(SiS_CRT2IsLCD(SiS_Pr, BaseAddr,HwDeviceExtension)) { + if(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + } + } + } + +#endif /* SIS315H */ + + } /* 310 series */ + + } /* LVDS */ + +} + +/* TW: Checked against all BIOSes */ +void +SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ + USHORT temp=0,tempah; +#ifdef SIS315H + USHORT temp1,pushax=0; + BOOLEAN delaylong = FALSE; +#endif + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* TW: ====== For 301B et al ====== */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* 300 series */ + + if(HwDeviceExtension->jChipType == SIS_300) { + + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); + if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) { + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0); + } + } + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */ + if(SiS_BridgeInSlave(SiS_Pr)) { + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */ + if(SiS_Is301B(SiS_Pr,BaseAddr)) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0); + SiS_DisplayOn(SiS_Pr); + } else { + SiS_VBLongWait(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + SiS_VBLongWait(SiS_Pr); + } + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16) & 0x10)) { + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xfe,0x01); + } + } + } + + } else { + + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) { + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0); + } + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* Enable CRT2 */ +/* DoSomeThingPCI_On(SiS_Pr) */ + SiS_DisplayOn(SiS_Pr); + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr); + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF); + if(SiS_BridgeInSlave(SiS_Pr)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40); + } + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16) & 0x10)) { + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + } + SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x00); + } + } + } else { + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */ + if(SiS_BridgeInSlave(SiS_Pr)) { + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */ + if(SiS_Is301B(SiS_Pr,BaseAddr)) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0); + SiS_DisplayOn(SiS_Pr); + } else { + SiS_VBLongWait(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + SiS_VBLongWait(SiS_Pr); + } + } + + } +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* 310/325 series */ + + if(IS_SIS650740) { /* 650, 740 */ + +#if 0 + if(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00) != 1) return; /* From 1.10.7w */ +#endif + + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { + + if(!(SiS_IsM650or651(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0x10; + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0x08; + } + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,tempah); + } + + SiS_SetReg3(SiS_Pr->SiS_P3c6,0x00); + + SiS_DisplayOff(SiS_Pr); + + pushax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06); + + if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) || + (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) ) { + if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); + } + } + + if(!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x40)) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + delaylong = TRUE; + } + + } + + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; + if(SiS_BridgeInSlave(SiS_Pr)) { + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */ + if(SiS_Pr->SiS_VBType & (VB_SIS301B|VB_SIS302B)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f); + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2e); + if(!(temp & 0x80)) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80); + } + } else { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2); + } + } + + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20); + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20); + + if(SiS_Pr->SiS_VBType & (VB_SIS301B|VB_SIS302B)) { + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2e); + if(!(temp & 0x80)) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80); + } + } + + tempah = 0xc0; + if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0x80; + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0x40; + } + } + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah); + + if(SiS_Pr->SiS_VBType & (VB_SIS301B|VB_SIS302B)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); + } + + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { + + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80); + + if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) { + if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) || + ((SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) ) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + if(delaylong) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3); + } + SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension); + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xfe,0x01); + } + } + + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x06,pushax); + SiS_DisplayOn(SiS_Pr); + SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff); + + if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); + } + + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c); + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x31,0x05); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x32,0x60); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x33,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10); + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); + + } + + + } else { /* 315, 330 */ + + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; + if(SiS_BridgeInSlave(SiS_Pr)) { + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */ + + temp=SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E); + if (!(temp & 0x80)) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80); + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20); + + if(SiS_Is301B(SiS_Pr,BaseAddr)) { + + temp=SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E); + if (!(temp & 0x80)) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80); + + tempah = 0xc0; + if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) { + tempah = 0x80; + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + tempah = 0x40; + } + } + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah); + + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); + + } else { + + SiS_VBLongWait(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7F); + SiS_VBLongWait(SiS_Pr); + + } + + } /* 315, 330 */ + +#endif /* SIS315H */ + + } + + } else { /* ============ TW: For 301 ================ */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF0,0x0B); + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0); + } + } + + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */ + if(SiS_BridgeInSlave(SiS_Pr)) { + tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20; + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); + + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */ + + if(HwDeviceExtension->jChipType >= SIS_315H) { + temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E); + if(!(temp & 0x80)) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80); /* BVBDOENABLE=1 */ + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */ + + SiS_VBLongWait(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); + } + SiS_VBLongWait(SiS_Pr); + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 1); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF0,0x03); + } + } + + } + + } else { /* =================== TW: For LVDS ================== */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 /* 300 series */ + + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + if(HwDeviceExtension->jChipType == SIS_730) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + } + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 0); + } + } + + SiS_EnableCRT2(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr); + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF); + if(SiS_BridgeInSlave(SiS_Pr)) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40); + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { + if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) { + SiS_SetCH700x(SiS_Pr,0x0B0E); + } + } + + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) { + if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16) & 0x10)) { + if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) { + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1); + } + SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7); + } + } + } + +#endif /* SIS300 */ + + } else { + +#ifdef SIS315H /* 310/325 series */ + +#if 0 /* BIOS code makes no sense */ + if(SiS_IsVAMode()) { + if(SiS_IsLCDOrLCDA()) { + } + } +#endif + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0); + } + } + + SiS_EnableCRT2(SiS_Pr); + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr); + + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7); + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetCH701x(SiS_Pr,0x66); + temp &= 0x20; + SiS_Chrontel701xBLOff(SiS_Pr); + } + + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f); + + temp1 = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E); + if (!(temp1 & 0x80)) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80); + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + if(temp) { + SiS_Chrontel701xBLOn(SiS_Pr); + } + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x20); + } + } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x20); + } + + if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + + if(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_Chrontel701xOn(SiS_Pr,HwDeviceExtension, BaseAddr); + } + + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_ChrontelDoSomething1(SiS_Pr,HwDeviceExtension, BaseAddr); + } else if(SiS_IsLCDOrLCDA(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_ChrontelDoSomething1(SiS_Pr,HwDeviceExtension, BaseAddr); + } + + } + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) { + if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_Chrontel701xBLOn(SiS_Pr); + SiS_ChrontelDoSomething4(SiS_Pr,HwDeviceExtension, BaseAddr); + } else if(SiS_IsLCDOrLCDA(SiS_Pr,HwDeviceExtension, BaseAddr)) { +/* if(!SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) { */ /* TW: makes no sense */ + SiS_Chrontel701xBLOn(SiS_Pr); + SiS_ChrontelDoSomething4(SiS_Pr,HwDeviceExtension, BaseAddr); +/* } */ + } + } + } else if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) { + if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) { + SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 1); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7); + } + } + } + +#endif /* SIS315H */ + + } /* 310 series */ + + } /* LVDS */ + +} + +void +SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + + /* TW: Switch on LCD backlight on SiS30xLV */ + if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) || + (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) ) { + if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); + SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension); + } + if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x01)) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01); + } + } +} + +void +SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + + /* TW: Switch off LCD backlight on SiS30xLV */ + if( (!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) || + (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00); + } + + if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) { + if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) { + if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFD,0x00); + } + } + } +} + +BOOLEAN +SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,temp1; + UCHAR *ROMAddr; + + if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xff; + temp >>= 4; + temp = 1 << temp; + temp1 = (ROMAddr[0x23c] << 8) | ROMAddr[0x23b]; + if(temp1 & temp) return(1); + else return(0); + } else { + return(0); + } +} + +BOOLEAN +SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,temp1; + UCHAR *ROMAddr; + + if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xff; + temp >>= 4; + temp = 1 << temp; + temp1 = (ROMAddr[0x23e] << 8) | ROMAddr[0x23d]; + if(temp1 & temp) return(1); + else return(0); + } else { + return(0); + } +} + +void +SiS_SetPanelDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT DelayTime) +{ + USHORT PanelID, DelayIndex, Delay; +#ifdef SIS300 + USHORT temp; +#endif + + if(HwDeviceExtension->jChipType < SIS_315H) { + +#ifdef SIS300 + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 300 series, LVDS */ + + PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36); + + DelayIndex = PanelID >> 4; + + if((DelayTime >= 2) && ((PanelID & 0x0f) == 1)) { + Delay = 3; + } else { + if(DelayTime >= 2) DelayTime -= 2; + + if(!(DelayTime & 0x01)) { + Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0]; + } else { + Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; + } + if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { + if(ROMAddr[0x220] & 0x40) { + if(!(DelayTime & 0x01)) { + Delay = (USHORT)ROMAddr[0x225]; + } else { + Delay = (USHORT)ROMAddr[0x226]; + } + } + } + } + SiS_ShortDelay(SiS_Pr,Delay); + + } else { /* 300 series, 301(B) */ + + PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36); + temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); + if(!(temp & 0x10)) PanelID = 0x12; + + DelayIndex = PanelID >> 4; + + if((DelayTime >= 2) && ((PanelID & 0x0f) == 1)) { + Delay = 3; + } else { + if(DelayTime >= 2) DelayTime -= 2; + + if(!(DelayTime & 0x01)) { + Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0]; + } else { + Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; + } + if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { + if(ROMAddr[0x220] & 0x40) { + if(!(DelayTime & 0x01)) { + Delay = (USHORT)ROMAddr[0x225]; + } else { + Delay = (USHORT)ROMAddr[0x226]; + } + } + } + } + SiS_ShortDelay(SiS_Pr,Delay); + + } + +#endif /* SIS300 */ + + } else { + + if(HwDeviceExtension->jChipType == SIS_330) return; + +#ifdef SIS315H + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 310/325 series, LVDS */ + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { + PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36); + DelayIndex = PanelID >> 4; + if((DelayTime >= 2) && ((PanelID & 0x0f) == 1)) { + Delay = 3; + } else { + if(DelayTime >= 2) DelayTime -= 2; + + if(!(DelayTime & 0x01)) { + Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[0]; + } else { + Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[1]; + } + if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { + if(ROMAddr[0x13c] & 0x40) { + if(!(DelayTime & 0x01)) { + Delay = (USHORT)ROMAddr[0x17e]; + } else { + Delay = (USHORT)ROMAddr[0x17f]; + } + } + } + } + SiS_ShortDelay(SiS_Pr,Delay); + } + + } else { /* 310/325 series, 301(B) */ + + PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36); + DelayIndex = PanelID >> 4; + if(!(DelayTime & 0x01)) { + Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0]; + } else { + Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; + } + SiS_DDC2Delay(SiS_Pr, Delay * 4); + + } + +#endif /* SIS315H */ + + } + +} + +void +SiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay) +{ + while(delay--) { + SiS_GenericDelay(SiS_Pr,0x19df); + } +} + +void +SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay) +{ + while(delay--) { + SiS_GenericDelay(SiS_Pr,0x42); + } +} + +void +SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay) +{ + USHORT temp,flag; + + flag = SiS_GetReg3(0x61) & 0x10; + + while(delay) { + temp = SiS_GetReg3(0x61) & 0x10; + if(temp == flag) continue; + flag = temp; + delay--; + } +} + +BOOLEAN +SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr) +{ + USHORT flag; + + flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x01); + if(flag >= 0x0B0) return(1); + else return(0); +} + +BOOLEAN +SiS_CRT2IsLCD(SiS_Private *SiS_Pr, USHORT BaseAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT flag; + + if(HwDeviceExtension->jChipType == SIS_730) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); + if(flag & 0x20) return(1); + } + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(flag & 0x20) return(1); + else return(0); +} + +BOOLEAN +SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if((HwDeviceExtension->jChipType != SIS_650) || (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(flag & EnableDualEdge) return(1); + else return(0); + } else return(0); + } else +#endif + return(0); +} + +BOOLEAN +SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if((flag & EnableDualEdge) && (flag & SetToLCDA)) return(1); +#if 0 /* Not done in 650/301LVx 1.10.6s, but in 650/301LV */ + else if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(flag) return(1); + else return(0); + } +#endif + else + return(0); + } else +#endif + return(0); + } + +BOOLEAN +SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79); + if(flag & 0x10) return(1); + else return(0); + } else +#endif + return(0); + } + +#if 0 +BOOLEAN +SiS_Is315E(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f); + if(flag & 0x10) return(1); + else return(0); + } else +#endif + return(0); +} +#endif + +BOOLEAN +SiS_IsM650or651(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f); + flag &= 0xF0; + if((flag == 0xb0) || (flag == 0x90)) return 0; + else return 1; + } else +#endif + return 1; +} + +BOOLEAN +SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(flag & EnableLVDSHiVision) return(1); /* = YPrPb = 0x08 */ + else return(0); + } else +#endif + return(0); +} + +BOOLEAN +SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(flag & EnableLVDSScart) return(1); /* = Scart = 0x04 */ + else return(0); + } else +#endif + return(0); +} + +BOOLEAN +SiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ + USHORT flag; + +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(flag & SetCRT2ToTV) return(1); + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(flag & EnableLVDSHiVision) return(1); /* = YPrPb = 0x08 */ + if(flag & EnableLVDSScart) return(1); /* = Scart = 0x04- TW inserted */ + else return(0); + } else +#endif + { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(flag & SetCRT2ToTV) return(1); + } + return(0); +} + +BOOLEAN +SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ + USHORT flag; + +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(flag & SetCRT2ToLCD) return(1); + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(flag & SetToLCDA) return(1); + else return(0); + } else +#endif + { + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(flag & SetCRT2ToLCD) return(1); + } + return(0); + +} + +BOOLEAN +SiS_IsDisableCRT2(SiS_Private *SiS_Pr, USHORT BaseAddr) +{ + USHORT flag; + + flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); + if(flag & 0x20) return(0); + else return(1); +} + +BOOLEAN +SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT flag; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + return(0); + } else { + flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00); + if((flag == 1) || (flag == 2)) return(0); + else return(1); + } +} + +BOOLEAN +SiS_BridgeIsEnable(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT flag; + + if(!(SiS_BridgeIsOn(SiS_Pr,BaseAddr,HwDeviceExtension))) { + flag = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00); + if(HwDeviceExtension->jChipType < SIS_315H) { + /* 300 series (630/301B 2.04.5a) */ + flag &= 0xa0; + if((flag == 0x80) || (flag == 0x20)) return 0; + else return 1; + } else { + /* 310/325 series (650/301LVx 1.10.6s) */ + flag &= 0x50; + if((flag == 0x40) || (flag == 0x10)) return 0; + else return 1; + } + } + return 1; +} + +BOOLEAN +SiS_BridgeInSlave(SiS_Private *SiS_Pr) +{ + USHORT flag1; + + flag1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31); + if(flag1 & (SetInSlaveMode >> 8)) return 1; + else return 0; +} + +/* TW: New from 650/301LV(x) 1.10.6s BIOS */ +void +SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ +#ifdef SIS315H + USHORT temp; +#endif + + /* Note: This variable is only used on 30x/B/LV systems. + CR38 has a different meaning on LVDS/CH7019 systems. + */ + + SiS_Pr->SiS_HiVision = 0; + if(HwDeviceExtension->jChipType >= SIS_315H) { +#ifdef SIS315H + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + /* TW: New from 650/301LVx BIOS 1.10.6s */ + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + if(temp & 0x04) { + temp &= 0x30; + switch(temp) { + case 0x00: SiS_Pr->SiS_HiVision = 4; break; + case 0x10: SiS_Pr->SiS_HiVision = 1; break; + case 0x20: SiS_Pr->SiS_HiVision = 2; break; + default: SiS_Pr->SiS_HiVision = 3; break; + } + } + } +#endif /* SIS315H */ + } +} + +/* TW: Checked against 630/LVDS 2.08, 650/LVDS and 650/301LV BIOS */ +BOOLEAN +SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,modeflag,resinfo=0; + const unsigned char SiS300SeriesLCDRes[] = + { 0, 1, 2, 3, 7, 4, 5, 8, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + SiS_Pr->SiS_LCDResInfo = 0; + SiS_Pr->SiS_LCDTypeInfo = 0; + SiS_Pr->SiS_LCDInfo = 0; + + if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + } + + if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return 0; + + if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2))) return 0; + + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36); + + /* FSTN: Fake CR36 (TypeInfo 2, ResInfo SiS_Panel320x480) */ + if(SiS_Pr->SiS_IF_DEF_FSTN) { + temp = 0x20 | SiS_Pr->SiS_Panel320x480; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); + } + + if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_Pr->SiS_LCDTypeInfo = temp >> 4; + } else { + SiS_Pr->SiS_LCDTypeInfo = (temp & 0x0F) - 1; + } + temp &= 0x0f; + if(HwDeviceExtension->jChipType < SIS_315H) { + /* TW: Translate 300 series LCDRes to 310/325 series for unified usage */ + temp = SiS300SeriesLCDRes[temp]; + } + SiS_Pr->SiS_LCDResInfo = temp; + + if(SiS_Pr->SiS_IF_DEF_FSTN){ + SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_Panel320x480; + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMin301) + SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMin301; + } else { + if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMinLVDS) + SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMinLVDS; + } + + if(SiS_Pr->SiS_LCDResInfo > SiS_Pr->SiS_PanelMax) + SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_Panel1024x768; + + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); + if(SiS_Pr->SiS_IF_DEF_FSTN){ + /* TW: Fake LVDS bridge for FSTN */ + temp = 0x04; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,temp); + } + SiS_Pr->SiS_LCDInfo = temp; + + /* TW: Inserted entire 315-block from 650/LVDS/301+LVx BIOSes */ + if(HwDeviceExtension->jChipType >= SIS_315H) { +#ifdef SIS315H + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + if(ModeNo == 0x3a || ModeNo == 0x4d || ModeNo == 0x65) { + SiS_Pr->SiS_LCDInfo |= LCDNonExpanding; + } + } + } + } + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x01) { + SiS_Pr->SiS_LCDInfo &= 0xFFEF; + SiS_Pr->SiS_LCDInfo |= LCDPass11; + } +#endif + } else { +#ifdef SIS300 + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x235] & 0x02)) { + SiS_Pr->SiS_LCDInfo &= 0xEF; + } + } + } else { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if((SiS_Pr->SiS_SetFlag & CRT2IsVGA) && ((ModeNo == 0x03) || (ModeNo == 0x10))) { + SiS_Pr->SiS_LCDInfo &= 0xEF; + } + } + } +#endif + } + +#ifdef LINUX_KERNEL + printk(KERN_DEBUG "sisfb: (LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x)\n", + SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo); +#endif +#ifdef LINUX_XF86 + xf86DrvMsgVerb(0, X_PROBED, 3, + "(init301: LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x)\n", + SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo); +#endif + + /* TW: With Trumpion, always Expanding */ + if(SiS_Pr->SiS_IF_DEF_TRUMPION != 0){ + SiS_Pr->SiS_LCDInfo &= (~LCDNonExpanding); + } + + if(!((HwDeviceExtension->jChipType < SIS_315H) && (SiS_Pr->SiS_SetFlag & CRT2IsVGA))) { + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + if(ModeNo > 0x13) { + if(!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + if((resinfo == 7) || (resinfo == 3)) { + SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } + } + } + } + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } + } + + if(modeflag & HalfDCLK) { + if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { + if(!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + if(!(((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (HwDeviceExtension->jChipType < SIS_315H)) && + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480))) { + if(ModeNo > 0x13) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(resinfo == 4) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; /* 512x384 */ + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { + if(resinfo == 3) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; /* 400x300 */ + } + } + } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } + + } + + /* TW: wdr: if (VBInfo & LCD) && (VBInfo & (SetSimuScanMode | SwitchToCRT2)) { */ + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(SiS_Pr->SiS_VBInfo & SetNotSimuMode) { + SiS_Pr->SiS_SetFlag |= LCDVESATiming; + } + } else { + SiS_Pr->SiS_SetFlag |= LCDVESATiming; + } + +#ifdef SIS315H + /* TW: Inserted from 650/301LVx BIOS 1.10.6s */ + if(HwDeviceExtension->jChipType > SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) { + temp = 0x00; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) temp = 0x04; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x04; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) temp = 0x04; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x39,temp); + } else if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x39,0x00); + } + } +#endif + + return 1; +} + +void +SiS_PresetScratchregister(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + return; + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x21); */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0x41); */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x32,0x28); */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x33,0x22); */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,0x43); */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,0x01); */ + /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x00); */ +} + +void +SiS_LongWait(SiS_Private *SiS_Pr) +{ + USHORT i; + + i = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); + + if(!(i & 0xC0)) { + for(i=0; i<0xFFFF; i++) { + if(!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) + break; + } + for(i=0; i<0xFFFF; i++) { + if((SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) + break; + } + } +} + +void +SiS_VBLongWait(SiS_Private *SiS_Pr) +{ + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + SiS_VBWait(SiS_Pr); + } else { + SiS_LongWait(SiS_Pr); + } + return; +} + +void +SiS_VBWait(SiS_Private *SiS_Pr) +{ + USHORT tempal,temp,i,j; + + temp = 0; + for(i=0; i<3; i++) { + for(j=0; j<100; j++) { + tempal = SiS_GetReg2(SiS_Pr->SiS_P3da); + if(temp & 0x01) { + if((tempal & 0x08)) continue; + if(!(tempal & 0x08)) break; + } else { + if(!(tempal & 0x08)) continue; + if((tempal & 0x08)) break; + } + } + temp ^= 0x01; + } +} + +void +SiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + if(HwDeviceExtension->jChipType < SIS_315H) { +#ifdef SIS300 + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x20)) return; + } + if(!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x80)) { + SiS_WaitRetrace1(SiS_Pr,HwDeviceExtension); + } else { + SiS_WaitRetrace2(SiS_Pr,HwDeviceExtension); + } +#endif + } else { +#ifdef SIS315H + if(!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x40)) { + SiS_WaitRetrace1(SiS_Pr,HwDeviceExtension); + } else { + SiS_WaitRetrace2(SiS_Pr,HwDeviceExtension); + } +#endif + } +} + +void +SiS_WaitRetrace1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT watchdog; +#ifdef SIS300 + USHORT i; +#endif + + if(HwDeviceExtension->jChipType >= SIS_315H) { +#ifdef SIS315H + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return; + watchdog = 65535; + while( (SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08) && --watchdog); + watchdog = 65535; + while( (!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog); +#endif + } else { +#ifdef SIS300 +#if 0 /* TW: Not done in A901 BIOS */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return; + } +#endif + for(i=0; i<10; i++) { + watchdog = 65535; + while( (SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08) && --watchdog); + if(watchdog) break; + } + for(i=0; i<10; i++) { + watchdog = 65535; + while( (!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog); + if(watchdog) break; + } +#endif + } +} + +void +SiS_WaitRetraceDDC(SiS_Private *SiS_Pr) +{ + USHORT watchdog; + + if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return; + watchdog = 65535; + while( (SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08) && --watchdog); + watchdog = 65535; + while( (!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog); +} + +void +SiS_WaitRetrace2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT watchdog; +#ifdef SIS300 + USHORT i; +#endif + + if(HwDeviceExtension->jChipType >= SIS_315H) { +#ifdef SIS315H + watchdog = 65535; + while( (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x30) & 0x02) && --watchdog); + watchdog = 65535; + while( (!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x30) & 0x02)) && --watchdog); +#endif + } else { +#ifdef SIS300 + for(i=0; i<10; i++) { + watchdog = 65535; + while( (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x25) & 0x02) && --watchdog); + if(watchdog) break; + } + for(i=0; i<10; i++) { + watchdog = 65535; + while( (!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x25) & 0x02)) && --watchdog); + if(watchdog) break; + } +#endif + } +} + +/* =========== Set and Get register routines ========== */ + +void +SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR) +{ + USHORT temp; + + temp = SiS_GetReg1(Port,Index); + temp = (temp & (DataAND)) | DataOR; + SiS_SetReg1(Port,Index,temp); +} + +void +SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND) +{ + USHORT temp; + + temp = SiS_GetReg1(Port,Index); + temp &= DataAND; + SiS_SetReg1(Port,Index,temp); +} + +void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR) +{ + USHORT temp; + + temp = SiS_GetReg1(Port,Index); + temp |= DataOR; + SiS_SetReg1(Port,Index,temp); +} + +/* ========================================================= */ + +/* TW: Set 301 TV Encoder (and some LCD relevant) registers */ +void +SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo, + USHORT ModeIdIndex,USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT i, j, tempax, tempbx, tempcx, temp, temp1; + USHORT push1, push2; + const UCHAR *PhasePoint; + const UCHAR *TimingPoint; + const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL; + USHORT modeflag, resinfo, crt2crtc, resindex, CRT2Index; + ULONG longtemp, tempeax, tempebx, temp2, tempecx; + const UCHAR atable[] = { + 0xc3,0x9e,0xc3,0x9e,0x02,0x02,0x02, + 0xab,0x87,0xab,0x9e,0xe7,0x02,0x02 + }; + + /* TW: Inserted from 650/301LV BIOS */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + /* TW: Inserted from 650/301LVx 1.10.6s: (Is at end of SetGroup2!) */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xfc,0x03); + temp = 1; + if(ModeNo <= 0x13) temp = 3; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0b,temp); + } + } + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((ModeNo == 0x4a) || (ModeNo == 0x38)) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1c,0xa7); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1d,0x07); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1e,0xf2); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1f,0x6e); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x20,0x17); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x21,0x8b); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x22,0x73); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,0x53); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x24,0x13); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x25,0x40); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x26,0x34); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x27,0xf4); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x28,0x63); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x29,0xbb); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2a,0xcc); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2b,0x7a); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2c,0x58); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2d,0xe4); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2e,0x73); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,0xda); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0x13); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x43,0x72); + } + } + } + } + return; + } + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + tempcx = SiS_Pr->SiS_VBInfo; + tempax = (tempcx & 0x00FF) << 8; + tempbx = (tempcx & 0x00FF) | ((tempcx & 0x00FF) << 8); + tempbx &= 0x0410; + temp = (tempax & 0x0800) >> 8; + temp >>= 1; + temp |= (((tempbx & 0xFF00) >> 8) << 1); + temp |= ((tempbx & 0x00FF) >> 3); + temp ^= 0x0C; + + /* TW: From 1.10.7w (no vb check there) */ + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV | VB_SIS30xNEW)) { + temp |= 0x0c; + } + + PhasePoint = SiS_Pr->SiS_PALPhase; + TimingPoint = SiS_Pr->SiS_PALTiming; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { /* PALPhase */ + temp ^= 0x01; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + TimingPoint = SiS_Pr->SiS_HiTVSt2Timing; + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + if(modeflag & Charx8Dot) TimingPoint = SiS_Pr->SiS_HiTVSt1Timing; + else TimingPoint = SiS_Pr->SiS_HiTVTextTiming; + } + } else TimingPoint = SiS_Pr->SiS_HiTVExtTiming; + } else { +#endif + if(SiS_Pr->SiS_VBInfo & SetPALTV){ + + TimingPoint = SiS_Pr->SiS_PALTiming; + PhasePoint = SiS_Pr->SiS_PALPhase; + + if( (SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) && + ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) { + PhasePoint = SiS_Pr->SiS_PALPhase2; + } + + } else { + + temp |= 0x10; + TimingPoint = SiS_Pr->SiS_NTSCTiming; + PhasePoint = SiS_Pr->SiS_NTSCPhase; + + if( (SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) && + ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) { + PhasePoint = SiS_Pr->SiS_NTSCPhase2; + } + + } +#ifdef oldHV + } +#endif + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,temp); + + temp = 0; + if((HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)) { + temp = 0x35; + } + if(HwDeviceExtension->jChipType >= SIS_315H) { + temp = 0x38; + } + if(temp) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) { + temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,temp); + if(temp1 & EnablePALM) { /* 0x40 */ + PhasePoint = SiS_Pr->SiS_PALMPhase; + if( (SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) && + ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) { + PhasePoint = SiS_Pr->SiS_PALMPhase2; + } + } + if(temp1 & EnablePALN) { /* 0x80 */ + PhasePoint = SiS_Pr->SiS_PALNPhase; + if( (SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) && + ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) { + PhasePoint = SiS_Pr->SiS_PALNPhase2; + } + } + } + } + } + +#ifdef SIS315H + /* TW: Inserted from 650/301LV BIOS */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 650/301LV : 301LV | 302LV */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((ModeNo == 0x4a) || (ModeNo == 0x38)) { + PhasePoint = SiS_Pr->SiS_SpecialPhase; + } + } + } + } + } +#endif + + for(i=0x31, j=0; i<=0x34; i++, j++){ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,PhasePoint[j]); + } + + for(i=0x01, j=0; i<=0x2D; i++, j++){ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]); + } + for(i=0x39; i<=0x45; i++, j++){ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]); + } + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(!(SiS_Pr->SiS_ModeType & 0x07)) + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x3A,0x1F); + } else { + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x3A,0x1F); + } + } + + SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x0A,SiS_Pr->SiS_NewFlickerMode); + + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x35,SiS_Pr->SiS_RY1COE); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x36,SiS_Pr->SiS_RY2COE); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x37,SiS_Pr->SiS_RY3COE); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x38,SiS_Pr->SiS_RY4COE); + +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) tempax = 950; + else { +#endif + if(SiS_Pr->SiS_VBInfo & SetPALTV) tempax = 520; + else tempax = 440; +#ifdef oldHV + } +#endif + + if( ( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_HiVision == 3) ) && (SiS_Pr->SiS_VDE <= tempax) ) || + ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (SiS_Pr->SiS_HiVision != 3) && + ( (SiS_Pr->SiS_VGAHDE == 1024) || ((SiS_Pr->SiS_VGAHDE != 1024) && (SiS_Pr->SiS_VDE <= tempax)) ) ) ) { + + tempax -= SiS_Pr->SiS_VDE; + tempax >>= 2; + tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8); + + temp = (tempax & 0xFF00) >> 8; + temp += (USHORT)TimingPoint[0]; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,temp); + + temp = (tempax & 0xFF00) >> 8; + temp += (USHORT)TimingPoint[1]; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,temp); + + if( (SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && + (SiS_Pr->SiS_HiVision != 3) && + (SiS_Pr->SiS_VGAHDE >= 1024) ) { + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x19); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x52); + } else { + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x17); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x1d); + } else { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x0b); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x11); + } + } + } + + } + + tempcx = SiS_Pr->SiS_HT; + + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) { + tempcx >>= 1; + } + } + + tempcx--; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + tempcx--; + } + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1B,temp); + temp = (tempcx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,temp); + + tempcx++; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + tempcx++; + } + tempcx >>= 1; + + push1 = tempcx; + + tempcx += 7; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) tempcx -= 4; +#endif + temp = (tempcx & 0x00FF) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x22,0x0F,temp); + + tempbx = TimingPoint[j] | ((TimingPoint[j+1]) << 8); + tempbx += tempcx; + + push2 = tempbx; + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x24,temp); + temp = ((tempbx & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,temp); + + tempbx = push2; + + tempbx += 8; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + tempbx -= 4; + tempcx = tempbx; + } +#endif + temp = (tempbx & 0x00FF) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,temp); + + j += 2; + tempcx += ((TimingPoint[j] | ((TimingPoint[j+1]) << 8))); + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x27,temp); + temp = ((tempcx & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,temp); + + tempcx += 8; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) tempcx -= 4; +#endif + temp = (tempcx & 0x00FF) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,temp); + + tempcx = push1; + + j += 2; + tempcx -= (TimingPoint[j] | ((TimingPoint[j+1]) << 8)); + temp = (tempcx & 0x00FF) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2D,0x0F,temp); + + tempcx -= 11; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + tempax = SiS_GetVGAHT2(SiS_Pr) - 1; + tempcx = tempax; + } + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2E,temp); + + tempbx = SiS_Pr->SiS_VDE; + if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746; + if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 746; + if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 853; + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1; + } else { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + tempbx >>= 1; + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + if(ModeNo <= 0x13) { + if(crt2crtc == 1) { + tempbx++; + } + } + } else { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(crt2crtc == 4) /* TW: BIOS calls GetRatePtrCRT2 here - does not make sense */ + if(SiS_Pr->SiS_ModeType <= 3) tempbx++; + } + } + } + } + tempbx -= 2; + temp = tempbx & 0x00FF; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(ModeNo == 0x2f) temp++; + } + } +#endif + /* TW: From 1.10.7w - doesn't make sense */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { /* SetFlag?? */ + if(ModeNo == 0x03) temp++; + } + } + } + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2F,temp); + + tempax = (tempcx & 0xFF00) | (tempax & 0x00FF); + tempbx = ((tempbx & 0xFF00) << 6) | (tempbx & 0x00FF); + tempax |= (tempbx & 0xFF00); +#ifdef oldHV + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { +#endif + if(HwDeviceExtension->jChipType < SIS_315H) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART)) { /* TW: New from 630/301B (II) BIOS */ + tempax |= 0x1000; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) tempax |= 0x2000; + } + } else { + tempax |= 0x1000; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) tempax |= 0x2000; + } +#ifdef oldHV + } +#endif + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,temp); + + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(HwDeviceExtension->jChipType > SIS_315H) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) || + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) ) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x10,0x60); + } + } + } + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* tv gatingno */ + tempbx = SiS_Pr->SiS_VDE; + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + tempbx >>= 1; + } + tempbx -= 3; + tempbx &= 0x03ff; + temp = ((tempbx & 0xFF00) >> 8) << 5; + temp |= 0x18; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x46,temp); + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x47,temp); + if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: Inserted from 650/301LVx 1.10.6s */ + tempax = 0; + if(SiS_Pr->SiS_HiVision & 0x07) { + if(SiS_Pr->SiS_HiVision & 0x04) tempax = 0x1000; + else if(SiS_Pr->SiS_HiVision & 0x01) tempax = 0x3000; + else tempax = 0x5000; + } + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4d,temp); + } + } + + tempbx &= 0x00FF; + if(!(modeflag & HalfDCLK)) { + tempcx = SiS_Pr->SiS_VGAHDE; + if(tempcx >= SiS_Pr->SiS_HDE) { + tempbx |= 0x2000; + tempax &= 0x00FF; + } + } + + tempcx = 0x0101; +/*if(SiS_Pr->SiS_VBInfo & (SetPALTV | SetCRT2ToTV)) { */ /*301b- TW: BIOS BUG? */ + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { + if(!(SiS_Pr->SiS_HiVision & 0x03)) { + if(SiS_Pr->SiS_VGAHDE >= 1024) { + if((!(modeflag & HalfDCLK)) || + (HwDeviceExtension->jChipType < SIS_315H)) { /* TW: This check not in 630/301B */ + tempcx = 0x1920; + if(SiS_Pr->SiS_VGAHDE >= 1280) { + tempcx = 0x1420; + tempbx &= 0xDFFF; + } + } + } + } + } + + if(!(tempbx & 0x2000)){ + if(modeflag & HalfDCLK) { + tempcx = (tempcx & 0xFF00) | (((tempcx & 0x00FF) << 1) & 0xff); + } + push1 = tempbx; + tempeax = SiS_Pr->SiS_VGAHDE; + tempebx = (tempcx & 0xFF00) >> 8; + longtemp = tempeax * tempebx; + tempecx = tempcx & 0x00FF; + longtemp /= tempecx; + longtemp <<= 0x0d; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + longtemp <<= 3; + } + tempecx = SiS_Pr->SiS_HDE; + temp2 = longtemp % tempecx; + tempeax = longtemp / tempecx; + if(temp2 != 0) tempeax++; + tempax = (USHORT)tempeax; + tempbx = push1; + tempcx = (tempcx & 0xff00) | (((tempax & 0xFF00) >> 8) >> 5); + tempbx |= (tempax & 0x1F00); + tempax = ((tempax & 0x00FF) << 8) | (tempax & 0x00FF); + } + + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x44,temp); + temp = (tempbx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x45,0xC0,temp); + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + temp = tempcx & 0x00FF; + if(tempbx & 0x2000) temp = 0; + temp |= 0x18; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x46,0xE0,temp); + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + tempbx = 0x0382; /* TW: BIOS; Was 0x0364; */ + tempcx = 0x007e; /* TW: BIOS; Was 0x009c; */ + } else { + tempbx = 0x0369; /* TW: BIOS; Was 0x0346; */ + tempcx = 0x0061; /* TW: BIOS; Was 0x0078; */ + } + temp = (tempbx & 0x00FF) ; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4B,temp); + temp = (tempcx & 0x00FF) ; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4C,temp); + tempbx &= 0x03FF; + temp = (tempcx & 0xFF00) >> 8; + temp = (temp & 0x0003) << 2; + temp |= (tempbx >> 8); + if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4D,temp); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x4D,0xF0,temp); + } + + temp = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x43); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x43,(USHORT)(temp - 3)); + } + + temp = 0; + if((HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730)) { + temp = 0x35; + } else if(HwDeviceExtension->jChipType >= SIS_315H) { + temp = 0x38; + } + if(temp) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,temp) & EnablePALM) { /* 0x40 */ + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xEF); + temp = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x01); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,temp - 1); + } + } + } + } + + +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0B,0x00); + } + } +#endif + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + SiS_Set300Part2Regs(SiS_Pr, HwDeviceExtension, ModeIdIndex, + RefreshRateTableIndex, BaseAddr, ModeNo); + return; + } + } else { + /* TW: !!! The following is a duplicate, done for LCDA as well (see above) */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 650/301LV: (VB_SIS301LV | VB_SIS302LV)) */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((ModeNo == 0x4a) || (ModeNo == 0x38)) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1c,0xa7); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1d,0x07); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1e,0xf2); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1f,0x6e); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x20,0x17); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x21,0x8b); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x22,0x73); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,0x53); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x24,0x13); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x25,0x40); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x26,0x34); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x27,0xf4); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x28,0x63); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x29,0xbb); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2a,0xcc); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2b,0x7a); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2c,0x58); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2d,0xe4); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2e,0x73); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,0xda); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0x13); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x43,0x72); + } + } + } + } + return; + } + } + + /* TW: From here: Part2 LCD setup */ + + tempbx = SiS_Pr->SiS_HDE; + /* TW: Inserted from 650/301LVx 1.10.6s */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempbx >>= 1; + } + tempbx--; /* RHACTE=HDE-1 */ + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2C,temp); + temp = (tempbx & 0xFF00) >> 8; + temp <<= 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,temp); + + temp = 0x01; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_ModeType == ModeEGA) { + if(SiS_Pr->SiS_VGAHDE >= 1024) { + temp = 0x02; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + temp = 0x01; + } + } + } + } + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0B,temp); + + tempbx = SiS_Pr->SiS_VDE; /* RTVACTEO=(VDE-1)&0xFF */ + push1 = tempbx; + + tempbx--; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x03,temp); + temp = ((tempbx & 0xFF00) >> 8) & 0x07; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,temp); + + tempcx = SiS_Pr->SiS_VT; + push2 = tempcx; + + tempcx--; + temp = tempcx & 0x00FF; /* RVTVT=VT-1 */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x19,temp); + + temp = (tempcx & 0xFF00) >> 8; + temp <<= 5; + if((HwDeviceExtension->jChipType == SIS_300) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp |= 0x10; + } else if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp |= 0x10; + else { + if(SiS_Pr->SiS_LCDInfo & LCDSync) /* TW: 630/301 BIOS checks this */ + temp |= 0x10; + } + } else { + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + /* TW: Inserted from 630/301LVx 1.10.6s */ + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { + if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { + temp |= 0x10; + } + } + } else { + temp |= 0x10; + } + } + + /* 630/301 does not do all this */ + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) { + /* TW: Inserted from 650/301LVx 1.10.6s */ + temp |= (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37) >> 6); + temp |= 0x08; /* From 1.10.7w */ + if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) temp |= 0x04; /* From 1.10.7w */ + } else { + tempbx = (tempbx & 0xFF00) | (SiS_Pr->SiS_LCDInfo & 0x0FF); + if(tempbx & LCDSync) { + tempbx &= (0xFF00 | LCDSyncBit); + tempbx = (tempbx & 0xFF00) | ((tempbx & 0x00FF) >> LCDSyncShift); + temp |= (tempbx & 0x00FF); + } + } + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1A,temp); + + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x09,0xF0); + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x0A,0xF0); + + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x17,0xFB); + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x18,0xDF); + + /* 1280x960, 1280x1024 and 1600x1200 data invalid/missing in tables, use old calculation */ + if((HwDeviceExtension->jChipType >= SIS_315H) && + (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) && + (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) && + (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960)) { + /* ------------- 310 series ------------ */ + + /* TW: Inserted this entire section from 650/301LV(x) BIOS */ + + SiS_GetCRT2Part2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&resindex); + + switch(CRT2Index) { + case Panel_1024x768 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; break; /* "Normal" */ + case Panel_1280x1024 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_1; break; + case Panel_1400x1050 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_1; break; + case Panel_1600x1200 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_1; break; + case Panel_1024x768 + 16 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_2; break; /* Non-Expanding */ + case Panel_1280x1024 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_2; break; + case Panel_1400x1050 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_2; break; + case Panel_1600x1200 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_2; break; + case Panel_1024x768 + 32 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; /* VESA Timing */ + case Panel_1280x1024 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_3; break; + case Panel_1400x1050 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_3; break; + case Panel_1600x1200 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_3; break; + default: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x02,0x80,(CRT2Part2Ptr+resindex)->CR[1]); + for(i = 2, j = 0x04; j <= 0x06; i++, j++ ) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + } + for(j = 0x1c; j <= 0x1d; i++, j++ ) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + } + for(j = 0x1f; j <= 0x21; i++, j++ ) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]); + + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(SiS_Pr->SiS_VGAVDE == 0x20d) { + temp = 0xc3; + if(SiS_Pr->SiS_ModeType <= ModeVGA) { + temp++; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2; + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0xb3); + } + if(SiS_Pr->SiS_VGAVDE == 0x1a4) { + temp = 0x4d; + if(SiS_Pr->SiS_ModeType <= ModeVGA) { + temp++; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++; + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp); + } + } + + /* TW: Inserted from 650/301LVx 1.10.6s: */ + /* !!! This is a duplicate, done for LCDA as well - see above */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xfc,0x03); /* Not done in 1.10.7w */ + temp = 1; + if(ModeNo <= 0x13) temp = 3; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0b,temp); + } + } + + } else { /* ------------- 300 series (and other LCD resolutions) ----------- */ + + tempcx++; + tempbx = 768; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) { + tempbx = 1024; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) { + tempbx = 1200; + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) { + if(tempbx != SiS_Pr->SiS_VDE) { + tempbx = 960; + } + } + } + } + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + tempbx = SiS_Pr->SiS_VDE - 1; + tempcx--; + } + tempax = 1; + if(!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + if(tempbx != SiS_Pr->SiS_VDE){ + tempax = tempbx; + if(tempax < SiS_Pr->SiS_VDE) { + tempax = 0; + tempcx = 0; + } else { + tempax -= SiS_Pr->SiS_VDE; + } + tempax >>= 1; + } + tempcx -= tempax; /* lcdvdes */ + tempbx -= tempax; /* lcdvdee */ + } else { + tempax >>= 1; + tempcx -= tempax; /* lcdvdes */ + tempbx -= tempax; /* lcdvdee */ + } + + temp = tempcx & 0x00FF; /* RVEQ1EQ=lcdvdes */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x05,temp); + temp = tempbx & 0x00FF; /* RVEQ2EQ=lcdvdee */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,temp); + + temp = ((tempbx & 0xFF00) >> 8 ) << 3; + temp |= ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,temp); + + tempbx = push2; + tempax = push1; + tempcx = tempbx; + tempcx -= tempax; + tempcx >>= 4; + tempbx += tempax; + tempbx >>= 1; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx -= 10; + + temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,temp); + + temp = ((tempbx & 0xFF00) >> 8) << 4; + tempbx += (tempcx + 1); + temp |= (tempbx & 0x000F); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,temp); + + /* TW: Code from 630/301B (I+II) BIOS */ + + if( ( ( (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) ) && + (HwDeviceExtension->jChipRevision > 2) ) && + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) && + (!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) && + (!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) ) { + if(ModeNo == 0x13) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,0xB9); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x05,0xCC); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,0xA6); + } else { + if((crt2crtc & 0x3F) == 4) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x2B); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x13); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,0xE5); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x05,0x08); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,0xE2); + } + } + } + + /* TW: Inserted missing code from 630/301B BIOS: (II: 3258) */ + + if(SiS_Pr->SiS_LCDTypeInfo == 0x0c) { + crt2crtc &= 0x1f; + tempcx = 0; + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { + if (SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + tempcx += 7; + } + } + tempcx += crt2crtc; + if (crt2crtc >= 4) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,0xff); + } + + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(crt2crtc == 4) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x28); + } + } + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x18); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,atable[tempcx]); + } + + tempcx = (SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE) >> 2; /* (HT-HDE)>>2 */ + tempbx = SiS_Pr->SiS_HDE + 7; /* lcdhdee */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + tempbx += 2; + } + push1 = tempbx; + temp = tempbx & 0x00FF; /* RHEQPLE=lcdhdee */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,temp); + temp = (tempbx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,temp); + + temp = 7; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + temp += 2; + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1F,temp); /* RHBLKE=lcdhdes */ + + SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x20,0x0F); + + tempbx += tempcx; + push2 = tempbx; + temp = tempbx & 0xFF; /* RHBURSTS=lcdhrs */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) { + if(SiS_Pr->SiS_HDE == 1280) temp = 0x47; + } + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1C,temp); + temp = ((tempbx & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,temp); + + tempbx = push2; + tempcx <<= 1; + tempbx += tempcx; + temp = tempbx & 0x00FF; /* RHSYEXP2S=lcdhre */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x21,temp); + + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(SiS_Pr->SiS_VGAVDE == 525) { + if(SiS_Pr->SiS_ModeType <= ModeVGA) + temp=0xC6; + else + temp=0xC3; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0xB3); + } else if(SiS_Pr->SiS_VGAVDE == 420) { + if(SiS_Pr->SiS_ModeType <= ModeVGA) + temp=0x4F; + else + temp=0x4D; /* 650: 4e */ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp); + } + } + SiS_Set300Part2Regs(SiS_Pr, HwDeviceExtension, ModeIdIndex, + RefreshRateTableIndex, BaseAddr, ModeNo); + + } /* HwDeviceExtension */ +} + +USHORT +SiS_GetVGAHT2(SiS_Private *SiS_Pr) +{ + ULONG tempax,tempbx; + + tempbx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) * SiS_Pr->SiS_RVBHCMAX) & 0xFFFF; + tempax = (SiS_Pr->SiS_VT - SiS_Pr->SiS_VDE) * SiS_Pr->SiS_RVBHCFACT; + tempax = (tempax * SiS_Pr->SiS_HT) / tempbx; + return((USHORT) tempax); +} + +/* TW: New from 300/301LV BIOS 1.16.51. Seems highly preliminary. */ +void +SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeIdIndex, USHORT RefreshRateTableIndex, + USHORT BaseAddr, USHORT ModeNo) +{ + USHORT crt2crtc, resindex; + int i,j; + const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL; + + if(HwDeviceExtension->jChipType != SIS_300) return; + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return; + + if(ModeNo<=0x13) { + crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + resindex = crt2crtc & 0x3F; + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; + else CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_2; + + /* TW: The BIOS code (1.16.51) is obviously a fragment! */ + if(ModeNo > 0x13) { + CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; + resindex = 4; + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x02,0x80,(CRT2Part2Ptr+resindex)->CR[1]); + for(i = 2, j = 0x04; j <= 0x06; i++, j++ ) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + } + for(j = 0x1c; j <= 0x1d; i++, j++ ) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + } + for(j = 0x1f; j <= 0x21; i++, j++ ) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + } + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]); +} + +/* TW: Set 301 Macrovision(tm) registers */ +/* TW: Double-Checked against 650/301LV, 650/301LVx and 630/301B BIOS */ +void +SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp; +#ifdef oldHV + USHORT i; + const UCHAR *tempdi; +#endif + USHORT modeflag; + + /* TW: Inserted from 650/301LVx 1.10.6s, 1.10.7w */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return; + + if(ModeNo<=0x13) + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x00,0x00); + + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xFA); + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xC8); + } else { + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xF5); + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xB7); + } else { + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xF6); + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xBf); + } + } + + temp = 0; + if((HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)) { + temp = 0x35; + } else if(HwDeviceExtension->jChipType >= SIS_315H) { + temp = 0x38; + } + if(temp) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,temp) & EnablePALM){ /* 0x40 */ + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xFA); + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xC8); + SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x3D,0xA8); + } + } + } + } + +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + tempdi = SiS_Pr->SiS_HiTVGroup3Data; + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + tempdi = SiS_Pr->SiS_HiTVGroup3Simu; + if(!(modeflag & Charx8Dot)) { + tempdi = SiS_Pr->SiS_HiTVGroup3Text; + } + } + for(i=0; i<=0x3E; i++){ + SiS_SetReg1(SiS_Pr->SiS_Part3Port,i,tempdi[i]); + } + } +#endif + + return; +} + +/* TW: Set 301 VGA2 registers */ +/* TW: Double-Checked against 650/301LV(x) and 630/301B BIOS */ +void +SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempax,tempcx,tempbx,modeflag,temp,temp2,resinfo; + ULONG tempebx,tempeax,templong; + + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + /* TW: From 650/301LVx 1.10.6s BIOS */ + if(SiS_Pr->SiS_VBType & (VB_SIS30xLV | VB_SIS30xNEW)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x24,0x0e); + } + } + + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x10,0x9f); + } + } + + /* TW: From 650/301LV BIOS (any, incl. 1.10.6s, 1.10.7w) */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + /* TW: This is a duplicate; done at the end, too */ + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c); + } + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10); + return; + } + + temp = SiS_Pr->SiS_RVBHCFACT; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x13,temp); + + tempbx = SiS_Pr->SiS_RVBHCMAX; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x14,temp); + + temp2 = (((tempbx & 0xFF00) >> 8) << 7) & 0x00ff; + + tempcx = SiS_Pr->SiS_VGAHT - 1; + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x16,temp); + + temp = (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff; + temp2 |= temp; + + tempcx = SiS_Pr->SiS_VGAVT - 1; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5; + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x17,temp); + + temp = temp2 | ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x15,temp); + + tempcx = SiS_Pr->SiS_VBInfo; + tempbx = SiS_Pr->SiS_VGAHDE; + if(modeflag & HalfDCLK) tempbx >>= 1; + + /* TW: New for 650/301LV and 630/301B */ + temp = 0xA0; +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + temp = 0; + if(tempbx > 800) { + temp = 0xA0; + if(tempbx != 1024) { + temp = 0xC0; + if(tempbx != 1280) temp = 0; + } + } + } else +#endif + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(tempbx <= 800) { + temp = 0x80; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD){ + temp = 0; + if(tempbx > 800) temp = 0x60; + } + } + } else { + temp = 0x80; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD){ + temp = 0; + if(tempbx > 800) temp = 0x60; + } + } + if(SiS_Pr->SiS_HiVision & 0x03) { + temp = 0; + if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20; + } + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) temp = 0; + } + + if(SiS_Pr->SiS_VBType & VB_SIS301) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) + temp |= 0x0A; + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0E,0x10,temp); + + tempebx = SiS_Pr->SiS_VDE; + +#ifdef oldHV + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(!(temp & 0xE0)) tempebx >>=1; + } +#endif + + tempcx = SiS_Pr->SiS_RVBHRS; + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x18,temp); + + tempeax = SiS_Pr->SiS_VGAVDE; + tempcx |= 0x4000; + if(tempeax <= tempebx){ + tempcx ^= 0x4000; + } else { + tempeax -= tempebx; + } + + templong = (tempeax * 256 * 1024) % tempebx; + tempeax = (tempeax * 256 * 1024) / tempebx; + tempebx = tempeax; + if(templong != 0) tempebx++; + + temp = (USHORT)(tempebx & 0x000000FF); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1B,temp); + temp = (USHORT)((tempebx & 0x0000FF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1A,temp); + + tempbx = (USHORT)(tempebx >> 16); + temp = tempbx & 0x00FF; + temp <<= 4; + temp |= ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x19,temp); + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1C,0x28); + tempbx = 0; + tempax = SiS_Pr->SiS_VGAHDE; + if(modeflag & HalfDCLK) tempax >>= 1; + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->SiS_HiVision & 0x03)) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempax >>= 1; + else if(tempax > 800) tempax -= 800; + } else { + if(tempax > 800) tempax -= 800; + } + } + +/* if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetPALTV)) && (!(SiS_Pr->SiS_HiVision & 0x03))) { */ + if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + if(tempax > 800) { + tempbx = 8; + if(tempax == 1024) + tempax *= 25; + else + tempax *= 20; + + temp = tempax % 32; + tempax /= 32; + tempax--; + if (temp!=0) tempax++; + } + } + tempax--; + temp = (tempax & 0xFF00) >> 8; + temp &= 0x03; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* From 1.10.7w */ + if(ModeNo > 0x13) { /* From 1.10.7w */ + if(resinfo == 8) tempax = 0x1f; /* From 1.10.7w */ + } /* From 1.10.7w */ + } /* From 1.10.7w */ + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1D,tempax & 0x00FF); + temp <<= 4; + temp |= tempbx; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1E,temp); + + if(HwDeviceExtension->jChipType > SIS_315H) { + temp = 0x0026; /* From 1.10.7w; 1.10.6s: 0x0036 */ + } else { + temp = 0x0036; + } + if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && + (!(SiS_Pr->SiS_HiVision & 0x03))) { + temp |= 0x01; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(!(SiS_Pr->SiS_SetFlag & TVSimuMode)) + temp &= 0xFE; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp); + + tempbx = SiS_Pr->SiS_HT; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempbx >>= 1; + } + tempbx >>= 1; + tempbx -= 2; + temp = ((tempbx & 0x0700) >> 8) << 3; + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,0xC0,temp); + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x22,temp); + if( (SiS_Pr->SiS_VBType & (VB_SIS30xLV | VB_SIS30xNEW)) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) { + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x24,0x0e); + } + + /* TW: 650 BIOS does this for all bridge types - assumingly wrong */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + /* TW: This is a duplicate; done for LCDA as well (see above) */ + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c); + } + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10); + } else if(HwDeviceExtension->jChipType == SIS_300) { + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10); + } + + } /* 301B */ + + SiS_SetCRT2VCLK(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); +} + +/* TW: Double-Checked against 650/301LV(x) and 630/301B BIOS */ +void +SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT vclkindex; + USHORT tempah; + + vclkindex = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_A; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0A,tempah); + tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_B; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0B,tempah); + /* TW: New from 650/301LV, LVx BIOS (300/301LV does not do this) */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 650/301LV: (VB_SIS301LV | VB_SIS302LV)) */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { + if((ModeNo == 0x4a) || (ModeNo == 0x38)) { + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0a,0x57); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0b,0x46); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1f,0xf6); + } + } + } + } + } + } else { /* 650/301LVx does not do this anymore, jumps to SetRegs above - BUG? */ + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0A,0x01); + tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_B; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0B,tempah); + tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_A; + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0A,tempah); + } + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x12,0x00); + tempah = 0x08; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + tempah |= 0x20; + } + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x12,tempah); +} + +/* TW: Double-checked against 650/LVDS (1.10.07), 630/301B/LVDS/LVDS+CH, 650/301LVx (1.10.6s) BIOS */ +USHORT +SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempbx; +#ifdef SIS300 + const USHORT LCDXlat1VCLK300[4] = {VCLK65, VCLK65, VCLK65, VCLK65}; + const USHORT LCDXlat2VCLK300[4] = {VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2}; + const USHORT LVDSXlat2VCLK300[4]= {VCLK65, VCLK65, VCLK65, VCLK65}; + const USHORT LVDSXlat3VCLK300[4]= {VCLK65, VCLK65, VCLK65, VCLK65}; +#endif +#ifdef SIS315H + const USHORT LCDXlat1VCLK310[4] = {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2}; + const USHORT LCDXlat2VCLK310[4] = {VCLK108_2+5,VCLK108_2+5,VCLK108_2+5,VCLK108_2+5}; + const USHORT LVDSXlat2VCLK310[4]= {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2}; + const USHORT LVDSXlat3VCLK310[4]= {VCLK108_2+5,VCLK108_2+5,VCLK108_2+5,VCLK108_2+5}; + /* {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2}; - 650/LVDS 1.10.07 */ +#endif + const USHORT LCDXlat0VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40}; + const USHORT LVDSXlat1VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40}; + USHORT CRT2Index,VCLKIndex=0; + USHORT modeflag,resinfo; + const UCHAR *CHTVVCLKPtr=NULL; + const USHORT *LCDXlatVCLK1 = NULL; + const USHORT *LCDXlatVCLK2 = NULL; + const USHORT *LVDSXlatVCLK2 = NULL; + const USHORT *LVDSXlatVCLK3 = NULL; + + if(HwDeviceExtension->jChipType >= SIS_315H) { +#ifdef SIS315H + LCDXlatVCLK1 = LCDXlat1VCLK310; + LCDXlatVCLK2 = LCDXlat2VCLK310; + LVDSXlatVCLK2 = LVDSXlat2VCLK310; + LVDSXlatVCLK3 = LVDSXlat3VCLK310; +#endif + } else { +#ifdef SIS300 + LCDXlatVCLK1 = LCDXlat1VCLK300; + LCDXlatVCLK2 = LCDXlat2VCLK300; + LVDSXlatVCLK2 = LVDSXlat2VCLK300; + LVDSXlatVCLK3 = LVDSXlat3VCLK300; +#endif + } + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + CRT2Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { /* 301 */ + + if (SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { + + CRT2Index >>= 6; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)){ /* LCD */ + if(HwDeviceExtension->jChipType < SIS_315H) { + /* TW: Inserted from 630/301B BIOS */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) + VCLKIndex = LCDXlat0VCLK[CRT2Index]; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) + VCLKIndex = LCDXlatVCLK1[CRT2Index]; + else + VCLKIndex = LCDXlatVCLK2[CRT2Index]; + } else { + /* TW: 330, 650/301LV BIOS does not check expanding, 315 does */ + if( (HwDeviceExtension->jChipType > SIS_315PRO) || + (!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) ) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + VCLKIndex = 0x19; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + VCLKIndex = 0x19; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { + VCLKIndex = 0x21; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + VCLKIndex = LCDXlatVCLK1[CRT2Index]; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { + VCLKIndex = 0x45; /* TW: TODO: This is certainly wrong */ + if(resinfo == 0x09) VCLKIndex++; + } else { + VCLKIndex = LCDXlatVCLK2[CRT2Index]; + } + } else { + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02)); /* Port 3cch */ + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + } + if(ModeNo <= 0x13) { /* TW: Inserted from 315 BIOS */ + if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x42; + } + if(VCLKIndex == 0) VCLKIndex = 0x41; + if(VCLKIndex == 1) VCLKIndex = 0x43; + if(VCLKIndex == 4) VCLKIndex = 0x44; + } + } + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */ + if((SiS_Pr->SiS_IF_DEF_HiVision == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { + if(SiS_Pr->SiS_SetFlag & RPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2; + else VCLKIndex = HiTVVCLK; + if(SiS_Pr->SiS_SetFlag & TVSimuMode) { + if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK; + else VCLKIndex = HiTVTextVCLK; + } + } else { + if(SiS_Pr->SiS_SetFlag & RPLLDIV2XO) VCLKIndex = TVVCLKDIV2; + else VCLKIndex = TVVCLK; + } + if(HwDeviceExtension->jChipType >= SIS_315H) { + VCLKIndex += 25; + } + } else { /* RAMDAC2 */ + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwDeviceExtension->jChipType < SIS_315H) { + VCLKIndex &= 0x3f; + if( (HwDeviceExtension->jChipType == SIS_630) && + (HwDeviceExtension->jChipRevision >= 0x30)) { + if(VCLKIndex == 0x14) VCLKIndex = 0x2e; + } + } + } + } + + } else { /* If not programming CRT2 */ + + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwDeviceExtension->jChipType < SIS_315H) { + VCLKIndex &= 0x3f; + if( (HwDeviceExtension->jChipType != SIS_630) && + (HwDeviceExtension->jChipType != SIS_300) ) { + if(VCLKIndex == 0x1b) VCLKIndex = 0x35; + } + } + } + } + + } else { /* LVDS */ + + VCLKIndex = CRT2Index; + + if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { /* programming CRT2 */ + + if( (SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) { + + VCLKIndex &= 0x1f; + tempbx = 0; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + tempbx += 2; + if(SiS_Pr->SiS_CHSOverScan) tempbx = 8; + if(SiS_Pr->SiS_CHPALM) { + tempbx = 4; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + } else if(SiS_Pr->SiS_CHPALN) { + tempbx = 6; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + } + } + switch(tempbx) { + case 0: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUNTSC; break; + case 1: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKONTSC; break; + case 2: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPAL; break; + case 3: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break; + case 4: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALM; break; + case 5: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALM; break; + case 6: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALN; break; + case 7: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALN; break; + case 8: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKSOPAL; break; + default: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break; + } + VCLKIndex = CHTVVCLKPtr[VCLKIndex]; + + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + + VCLKIndex >>= 6; + if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) || + (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480)) + VCLKIndex = LVDSXlat1VCLK[VCLKIndex]; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) + VCLKIndex = LVDSXlatVCLK2[VCLKIndex]; + else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) + VCLKIndex = LVDSXlatVCLK2[VCLKIndex]; + else VCLKIndex = LVDSXlatVCLK3[VCLKIndex]; + + } else { + + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwDeviceExtension->jChipType < SIS_315H) { + VCLKIndex &= 0x3F; + } + if( (HwDeviceExtension->jChipType == SIS_630) && + (HwDeviceExtension->jChipRevision >= 0x30) ) { + if(VCLKIndex == 0x14) VCLKIndex = 0x2e; + } + } + } + + } else { /* if not programming CRT2 */ + + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwDeviceExtension->jChipType < SIS_315H) { + VCLKIndex &= 0x3F; + if( (HwDeviceExtension->jChipType != SIS_630) && + (HwDeviceExtension->jChipType != SIS_300) ) { + if(VCLKIndex == 0x1b) VCLKIndex = 0x35; + } +#if 0 + if(HwDeviceExtension->jChipType == SIS_730) { + if(VCLKIndex == 0x0b) VCLKIndex = 0x40; /* 1024x768-70 */ + if(VCLKIndex == 0x0d) VCLKIndex = 0x41; /* 1024x768-75 */ + } +#endif + } + } + + } + + } +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "VCLKIndex %d (0x%x)\n", VCLKIndex, VCLKIndex); +#endif + return (VCLKIndex); +} + +/* TW: Set 301 Palette address port registers */ +/* TW: Checked against 650/301LV BIOS */ +void +SiS_SetGroup5(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, + UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +{ + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return; + + if(SiS_Pr->SiS_ModeType == ModeVGA){ + if(!(SiS_Pr->SiS_VBInfo & (SetInSlaveMode | LoadDACFlag))){ + SiS_EnableCRT2(SiS_Pr); + SiS_LoadDAC(SiS_Pr,HwDeviceExtension,ROMAddr,ModeNo,ModeIdIndex); + } + } + return; +} + +/* TW: Checked against 650/LVDS and 630/301B BIOS */ +void +SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,tempah,i,modeflag,j; + USHORT ResInfo,DisplayType; + const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL; + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + temp = SiS_GetLVDSCRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &ResInfo,&DisplayType); + + if(temp == 0) return; + + /* TW: Inserted from 630/LVDS BIOS */ + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_SetFlag & CRT2IsVGA) return; + } + + switch(DisplayType) { + case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break; + case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break; + case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break; + case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break; + case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break; + case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break; + case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break; + case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break; + case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break; + case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break; + case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break; + case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break; + case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break; + case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1; break; + case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1_H; break; + case 16: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2; break; + case 17: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2_H; break; + case 18: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break; + case 19: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break; + case 20: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break; + case 21: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break; + case 22: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break; /* FSTN */ + case 23: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1; break; + case 24: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1_H; break; + case 25: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2; break; + case 26: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2_H; break; + case 27: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1; break; + case 28: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1_H; break; + case 29: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2; break; + case 30: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2_H; break; + case 36: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1; break; + case 37: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1_H; break; + case 38: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2; break; + case 39: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2_H; break; + case 99: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1SOPAL; break; + default: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + } + + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */ + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[0]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,tempah); + + for(i=0x02,j=1;i<=0x05;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x06,j=5;i<=0x07;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x10,j=7;i<=0x11;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x15,j=9;i<=0x16;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x0A,j=11;i<=0x0C;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3c4,i,tempah); + } + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[14]; + tempah &= 0xE0; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1f,tempah); /* TW: Modfied (650/LVDS); Was SetReg(tempah) */ + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[14]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode){ + tempah |= 0x080; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); + + /* TW: Inserted from 650/LVDS BIOS */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(modeflag & HalfDCLK) + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); + } + + return; +} + +#if 0 /* TW: Unused */ +/*301b*/ +void +SiS_CHACRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex) +{ + USHORT temp,tempah,i,modeflag,j; + USHORT ResInfo,DisplayType; + SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL; + + if(ModeNo<=0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ + } + + temp=SiS_GetLVDSCRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &ResInfo,&DisplayType); + if(temp==0){ + return; + } + + switch(DisplayType) { + case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break; + case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break; + case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break; + case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break; + case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break; + case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break; + case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break; + case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break; + case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break; + case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break; + case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break; + case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break; + case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break; + case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1; break; + case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1_H; break; + case 16: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2; break; + case 17: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2_H; break; + case 18: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break; + case 19: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break; + case 20: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break; + case 21: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break; + case 22: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break; /* FSTN */ + case 99: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break; + } + + tempah=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x11); /*unlock cr0-7 */ + tempah=tempah&0x7F; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x11,tempah); + tempah = (LVDSCRT1Ptr+ResInfo)->CR[0]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x0,tempah); + for(i=0x02,j=1;i<=0x05;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x06,j=5;i<=0x07;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x10,j=7;i<=0x11;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + for(i=0x15,j=9;i<=0x16;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); + } + + for(i=0x0A,j=11;i<=0x0C;i++,j++){ + tempah = (LVDSCRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_Pr->SiS_P3c4,i,tempah); + } + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[14]; + tempah=tempah&0x0E0; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[14]; + tempah=tempah&0x01; + tempah=tempah<<5; + if(modeflag&DoubleScanMode){ + tempah=tempah|0x080; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); + return; +} +#endif + +/* TW: Checked against 650/LVDS BIOS: modified for new panel resolutions */ +BOOLEAN +SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *ResInfo, + USHORT *DisplayType) + { + USHORT tempbx,modeflag=0; + USHORT Flag,CRT2CRTC; + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + /* TW: Inserted from 650/LVDS BIOS */ + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return 0; + } + } + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + CRT2CRTC = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + CRT2CRTC = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + Flag = 1; + tempbx = 0; + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + Flag = 0; + tempbx = 18; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx++; + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + tempbx += 2; + if(SiS_Pr->SiS_CHSOverScan) tempbx = 99; + if(SiS_Pr->SiS_CHPALM) { + tempbx = 18; /* PALM uses NTSC data */ + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx++; + } else if(SiS_Pr->SiS_CHPALN) { + tempbx = 20; /* PALN uses PAL data */ + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx++; + } + } + } + } + if(Flag) { + tempbx = SiS_Pr->SiS_LCDResInfo; + tempbx -= SiS_Pr->SiS_PanelMinLVDS; + if(SiS_Pr->SiS_LCDResInfo <= SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 6; + if(modeflag & HalfDCLK) tempbx += 3; + } else { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tempbx = 14; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + tempbx = 12; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { + tempbx = 23; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { + tempbx = 27; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { + tempbx = 36; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } + } + } + if(SiS_Pr->SiS_IF_DEF_FSTN){ + if(SiS_Pr->SiS_LCDResInfo==SiS_Pr->SiS_Panel320x480){ + tempbx=22; + } + } + *ResInfo = CRT2CRTC & 0x3F; + *DisplayType = tempbx; + return 1; +} + +/* TW: Checked against 650/LVDS (1.10a, 1.10.07), 630/301B (I/II) and 630/LVDS BIOS */ +void +SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempah,tempal,pushax; + USHORT vclkindex=0; + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) return; + } + } + + if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) || (SiS_Pr->SiS_IF_DEF_TRUMPION == 1)) { + SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + tempal &= 0x3F; + if(tempal == 2) RefreshRateTableIndex--; + vclkindex = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } else { + vclkindex = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + + tempal = 0x02B; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + tempal += 3; + } + } + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); + pushax = tempal; + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x20); + tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2B; + SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah); + tempal++; + tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2C; + SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x10); + tempal = pushax; + tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2B; + SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah); + tempal++; + tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2C; + SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah); + SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x00); + tempal = pushax; + tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2B; + SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah); + tempal++; + tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2C; + SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah); + return; +} + +#if 0 /* TW: Not used */ +void +SiS_SetDefCRT2ExtRegs(SiS_Private *SiS_Pr, USHORT BaseAddr) +{ + USHORT temp; + + if(SiS_Pr->SiS_IF_DEF_LVDS==0) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,0x40); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,0x80); + temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); + temp &= 0xC3; + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,temp); + } else { + SiS_SetReg1(SiS_Pr->SiS_P3d4,0x32,0x02); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,0x00); + } +} +#endif + +/* TW: Start of Chrontel 70xx functions ---------------------- */ + +/* Set-up the Chrontel Registers */ +void +SiS_SetCHTVReg(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex) +{ + USHORT temp, tempbx, tempcl; + USHORT TVType, resindex; + const SiS_CHTVRegDataStruct *CHTVRegData = NULL; + + if(ModeNo <= 0x13) + tempcl = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempcl = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + TVType = 0; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) TVType += 1; + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + TVType += 2; + if(SiS_Pr->SiS_CHSOverScan) TVType = 8; + if(SiS_Pr->SiS_CHPALM) { + TVType = 4; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) TVType += 1; + } else if(SiS_Pr->SiS_CHPALN) { + TVType = 6; + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) TVType += 1; + } + } + switch(TVType) { + case 0: CHTVRegData = SiS_Pr->SiS_CHTVReg_UNTSC; break; + case 1: CHTVRegData = SiS_Pr->SiS_CHTVReg_ONTSC; break; + case 2: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPAL; break; + case 3: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break; + case 4: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALM; break; + case 5: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALM; break; + case 6: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALN; break; + case 7: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALN; break; + case 8: CHTVRegData = SiS_Pr->SiS_CHTVReg_SOPAL; break; + default: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break; + } + resindex = tempcl & 0x3F; + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { + + /* Chrontel 7005 */ + + /* TW: We don't support modes >800x600 */ + if (resindex > 5) return; + + if(SiS_Pr->SiS_VBInfo & SetPALTV) { + SiS_SetCH700x(SiS_Pr,0x4304); /* TW: 0x40=76uA (PAL); 0x03=15bit non-multi RGB*/ + SiS_SetCH700x(SiS_Pr,0x6909); /* TW: Black level for PAL (105)*/ + } else { + SiS_SetCH700x(SiS_Pr,0x0304); /* TW: upper nibble=71uA (NTSC), 0x03=15bit non-multi RGB*/ + SiS_SetCH700x(SiS_Pr,0x7109); /* TW: Black level for NTSC (113)*/ + } + + temp = CHTVRegData[resindex].Reg[0]; + tempbx=((temp&0x00FF)<<8)|0x00; /* TW: Mode register */ + SiS_SetCH700x(SiS_Pr,tempbx); + temp = CHTVRegData[resindex].Reg[1]; + tempbx=((temp&0x00FF)<<8)|0x07; /* TW: Start active video register */ + SiS_SetCH700x(SiS_Pr,tempbx); + temp = CHTVRegData[resindex].Reg[2]; + tempbx=((temp&0x00FF)<<8)|0x08; /* TW: Position overflow register */ + SiS_SetCH700x(SiS_Pr,tempbx); + temp = CHTVRegData[resindex].Reg[3]; + tempbx=((temp&0x00FF)<<8)|0x0A; /* TW: Horiz Position register */ + SiS_SetCH700x(SiS_Pr,tempbx); + temp = CHTVRegData[resindex].Reg[4]; + tempbx=((temp&0x00FF)<<8)|0x0B; /* TW: Vertical Position register */ + SiS_SetCH700x(SiS_Pr,tempbx); + + /* TW: Set minimum flicker filter for Luma channel (SR1-0=00), + minimum text enhancement (S3-2=10), + maximum flicker filter for Chroma channel (S5-4=10) + =00101000=0x28 (When reading, S1-0->S3-2, and S3-2->S1-0!) + */ + SiS_SetCH700x(SiS_Pr,0x2801); + + /* TW: Set video bandwidth + High bandwith Luma composite video filter(S0=1) + low bandwith Luma S-video filter (S2-1=00) + disable peak filter in S-video channel (S3=0) + high bandwidth Chroma Filter (S5-4=11) + =00110001=0x31 + */ + SiS_SetCH700x(SiS_Pr,0xb103); /* old: 3103 */ + + /* TW: Register 0x3D does not exist in non-macrovision register map + (Maybe this is a macrovision register?) + */ + /* SiS_SetCH70xx(SiS_Pr,0x003D); */ + + /* TW: Register 0x10 only contains 1 writable bit (S0) for sensing, + all other bits a read-only. Macrovision? + */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0010,0x1F); + + /* TW: Register 0x11 only contains 3 writable bits (S0-S2) for + contrast enhancement (set to 010 -> gain 1 Yout = 17/16*(Yin-30) ) + */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0211,0xF8); + + /* TW: Clear DSEN + */ + SiS_SetCH70xxANDOR(SiS_Pr,0x001C,0xEF); + + if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { /* ---- NTSC ---- */ + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) { + if(resindex == 0x04) { /* 640x480 overscan: Mode 16 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on, no need to set FSCI */ + } else { + if(resindex == 0x05) { /* 800x600 overscan: Mode 23 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0118,0xF0); /* 0x18-0x1f: FSCI 469,762,048 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0C19,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x001A,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x001B,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x001C,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x001D,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x001E,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x001F,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x0120,0xEF); /* Loop filter on for mode 23 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0021,0xFE); /* ACIV off, need to set FSCI */ + } + } + } else { + if(resindex == 0x04) { /* ----- 640x480 underscan; Mode 17 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); + } else { + if(resindex == 0x05) { /* ----- 800x600 underscan: Mode 24 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0118,0xF0); /* (FSCI was 0x1f1c71c7 - this is for mode 22) */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0919,0xF0); /* FSCI for mode 24 is 428,554,851 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x081A,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x0b1B,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x031C,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x0a1D,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x061E,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x031F,0xF0); + SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off for mode 24 */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0021,0xFE); /* ACIV off, need to set FSCI */ + } + } + } + } else { /* ---- PAL ---- */ + /* TW: We don't play around with FSCI in PAL mode */ + if (resindex == 0x04) { + SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on */ + } else { + SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on */ + } + } + + } else { + + /* Chrontel 7019 */ + + /* TW: We don't support modes >1024x768 */ + if (resindex > 6) return; + + temp = CHTVRegData[resindex].Reg[0]; + tempbx=((temp & 0x00FF) <<8 ) | 0x00; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[1]; + tempbx=((temp & 0x00FF) <<8 ) | 0x01; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[2]; + tempbx=((temp & 0x00FF) <<8 ) | 0x02; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[3]; + tempbx=((temp & 0x00FF) <<8 ) | 0x04; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[4]; + tempbx=((temp & 0x00FF) <<8 ) | 0x03; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[5]; + tempbx=((temp & 0x00FF) <<8 ) | 0x05; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[6]; + tempbx=((temp & 0x00FF) <<8 ) | 0x06; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[7]; + tempbx=((temp & 0x00FF) <<8 ) | 0x07; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[8]; + tempbx=((temp & 0x00FF) <<8 ) | 0x08; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[9]; + tempbx=((temp & 0x00FF) <<8 ) | 0x15; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[10]; + tempbx=((temp & 0x00FF) <<8 ) | 0x1f; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[11]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0c; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[12]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0d; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[13]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0e; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[14]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0f; + SiS_SetCH701x(SiS_Pr,tempbx); + + temp = CHTVRegData[resindex].Reg[15]; + tempbx=((temp & 0x00FF) <<8 ) | 0x10; + SiS_SetCH701x(SiS_Pr,tempbx); + + } +} + +/* TW: Chrontel 701x functions ================================= */ + +void +SiS_SetCH701xForLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) +{ + UCHAR regtable[] = { 0x1c, 0x5f, 0x64, 0x6f, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x76, 0x78, 0x7d }; + UCHAR table1024[] = { 0x60, 0x02, 0x00, 0x07, 0x40, 0xed, + 0xa3, 0xc8, 0xc7, 0xac, 0x60, 0x02 }; + UCHAR table1400[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xef, + 0xad, 0xdb, 0xf6, 0xac, 0x60, 0x02 }; + UCHAR *tableptr = NULL; + USHORT tempbh; + int i; + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tableptr = table1400; + } else { + tableptr = table1024; + } + tempbh = SiS_GetCH701x(SiS_Pr,0x74); + if((tempbh == 0xf6) || (tempbh == 0xc7)) { + tempbh = SiS_GetCH701x(SiS_Pr,0x73); + if(tempbh == 0xc8) { + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) return; + } else if(tempbh == 0xdb) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) return; + } + } + for(i=0; i<0x0c; i++) { + SiS_SetCH701x(SiS_Pr,(tableptr[i] << 8) | regtable[i]); + } + SiS_ChrontelPowerSequencing(SiS_Pr); + tempbh = SiS_GetCH701x(SiS_Pr,0x1e); + tempbh |= 0xc0; + SiS_SetCH701x(SiS_Pr,(tempbh << 8) | 0x1e); +} + +void +SiS_ChrontelPowerSequencing(SiS_Private *SiS_Pr) +{ + UCHAR regtable[] = { 0x67, 0x68, 0x69, 0x6a, 0x6b }; + UCHAR table1024[] = { 0x01, 0x02, 0x01, 0x01, 0x02 }; + UCHAR table1400[] = { 0x01, 0x02, 0x01, 0x01, 0x02 }; + UCHAR *tableptr = NULL; + int i; + + /* Set up Power up/down timing */ + + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + tableptr = table1400; + } else { + tableptr = table1024; + } + + for(i=0; i<5; i++) { + SiS_SetCH701x(SiS_Pr,(tableptr[i] << 8) | regtable[i]); + } +} + +void +SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr) +{ + USHORT temp; + + /* TW: Enable Chrontel 7019 LCD panel backlight */ + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetCH701x(SiS_Pr,0x66); + temp |= 0x20; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66); + } +} + +void +SiS_Chrontel701xOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) +{ + USHORT temp; + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + if(SiS_IsYPbPr(SiS_Pr,HwDeviceExtension, BaseAddr)) { + temp = SiS_GetCH701x(SiS_Pr,0x01); + temp &= 0x3f; + temp |= 0x80; /* TW: Enable YPrPb (HDTV) */ + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x01); + } + if(SiS_IsChScart(SiS_Pr,HwDeviceExtension, BaseAddr)) { + temp = SiS_GetCH701x(SiS_Pr,0x01); + temp &= 0x3f; + temp |= 0xc0; /* TW: Enable SCART + CVBS */ + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x01); + } + SiS_SetCH701x(SiS_Pr,0x2049); /* TW: Enable TV path */ + temp = SiS_GetCH701x(SiS_Pr,0x49); + if(SiS_IsYPbPr(SiS_Pr,HwDeviceExtension, BaseAddr)) { + temp = SiS_GetCH701x(SiS_Pr,0x73); + temp |= 0x60; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x73); + } + temp = SiS_GetCH701x(SiS_Pr,0x47); + temp &= 0x7f; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47); + SiS_LongDelay(SiS_Pr,2); + temp = SiS_GetCH701x(SiS_Pr,0x47); + temp |= 0x80; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47); + } +} + +void +SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr) +{ + USHORT temp; + + /* TW: Disable Chrontel 7019 LCD panel backlight */ + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetCH701x(SiS_Pr,0x66); + temp &= 0xDF; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66); + } +} + +void +SiS_Chrontel701xOff(SiS_Private *SiS_Pr) +{ + USHORT temp; + + if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { + SiS_LongDelay(SiS_Pr,2); + /* TW: Complete power down of LVDS */ + temp = SiS_GetCH701x(SiS_Pr,0x76); + temp &= 0xfc; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76); + SiS_SetCH701x(SiS_Pr,0x0066); + } +} + +void +SiS_ChrontelResetDB(SiS_Private *SiS_Pr) +{ + /* TW: Reset Chrontel 7019 datapath */ + SiS_SetCH701x(SiS_Pr,0x1048); + SiS_LongDelay(SiS_Pr,1); + SiS_SetCH701x(SiS_Pr,0x1848); +} + +void +SiS_ChrontelDoSomething4(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ + USHORT temp; + + SiS_SetCH701x(SiS_Pr,0xaf76); /* Power up LVDS block */ + temp = SiS_GetCH701x(SiS_Pr,0x49); + temp &= 1; + if(temp != 1) { /* TV block powered? (0 = yes, 1 = no) */ + temp = SiS_GetCH701x(SiS_Pr,0x47); + temp &= 0x70; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47); /* enable VSYNC */ + SiS_LongDelay(SiS_Pr,3); + temp = SiS_GetCH701x(SiS_Pr,0x47); + temp |= 0x80; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47); /* disable VSYNC */ + } +} + +void +SiS_ChrontelDoSomething3(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr) +{ + USHORT temp,temp1; + + temp1 = 0; + temp = SiS_GetCH701x(SiS_Pr,0x61); + if(temp < 2) { + temp++; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x61); + temp1 = 1; + } + SiS_SetCH701x(SiS_Pr,0xac76); + temp = SiS_GetCH701x(SiS_Pr,0x66); + temp |= 0x5f; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66); + if(ModeNo > 0x13) { + if(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) { + SiS_GenericDelay(SiS_Pr,0x3ff); + } else { + SiS_GenericDelay(SiS_Pr,0x2ff); + } + } else { + if(!temp1) + SiS_GenericDelay(SiS_Pr,0x2ff); + } + temp = SiS_GetCH701x(SiS_Pr,0x76); + temp |= 0x03; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76); + temp = SiS_GetCH701x(SiS_Pr,0x66); + temp &= 0x7f; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66); + SiS_LongDelay(SiS_Pr,1); +} + +void +SiS_ChrontelDoSomething2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ + USHORT temp,tempcl,tempch; + + SiS_LongDelay(SiS_Pr, 1); + tempcl = 3; + tempch = 0; + + do { + temp = SiS_GetCH701x(SiS_Pr,0x66); + temp &= 0x04; + if(temp == 0x04) break; + + SiS_SetCH701xForLCD(SiS_Pr,HwDeviceExtension,BaseAddr); + + if(tempcl == 0) { + if(tempch == 3) break; + SiS_ChrontelResetDB(SiS_Pr); + tempcl = 3; + tempch++; + } + tempcl--; + temp = SiS_GetCH701x(SiS_Pr,0x76); + temp &= 0xfb; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76); + SiS_LongDelay(SiS_Pr,2); + temp = SiS_GetCH701x(SiS_Pr,0x76); + temp |= 0x04; + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76); + SiS_SetCH701x(SiS_Pr,0x6078); + SiS_LongDelay(SiS_Pr,2); + } while(0); + + SiS_SetCH701x(SiS_Pr,0x0077); +} + +void +SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr) +{ + USHORT temp; + + temp = SiS_GetCH701x(SiS_Pr,0x03); + temp |= 0x80; /* Set datapath 1 to TV */ + temp &= 0xbf; /* Set datapath 2 to LVDS */ + SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x03); + + SiS_ChrontelResetDB(SiS_Pr); + + SiS_ChrontelDoSomething2(SiS_Pr,HwDeviceExtension,BaseAddr); + + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x34); + SiS_ChrontelDoSomething3(SiS_Pr,temp,HwDeviceExtension,BaseAddr); + + SiS_SetCH701x(SiS_Pr,0xaf76); +} + +/* TW: End of Chrontel 701x functions ==================================== */ + +/* TW: Generic Read/write routines for Chrontel ========================== */ + +/* TW: The Chrontel is connected to the 630/730 via + * the 630/730's DDC/I2C port. + * + * On 630(S)T chipset, the index changed from 0x11 to 0x0a, + * possibly for working around the DDC problems + */ + +void +SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx) +{ + if (SiS_Pr->SiS_IF_DEF_CH70xx == 1) + SiS_SetCH700x(SiS_Pr,tempbx); + else + SiS_SetCH701x(SiS_Pr,tempbx); +} + +/* TW: Write to Chrontel 700x */ +/* Parameter is [Data (S15-S8) | Register no (S7-S0)] */ +void +SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx) +{ + USHORT tempah,temp,i; + + if(!(SiS_Pr->SiS_ChrontelInit)) { + SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */ + } + + for(i=0;i<10;i++) { /* TW: Do only 10 attempts to write */ + /* SiS_SetSwitchDDC2(SiS_Pr); */ + if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = tempbx & 0x00FF; /* TW: Write RAB */ + tempah |= 0x80; /* TW: (set bit 7, see datasheet) */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = (tempbx & 0xFF00) >> 8; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write data */ + if(temp) continue; /* TW: (ERROR: no ack) */ + if(SiS_SetStop(SiS_Pr)) continue; /* TW: Set stop condition */ + SiS_Pr->SiS_ChrontelInit = 1; + return; + } + + /* TW: For 630ST */ + if(!(SiS_Pr->SiS_ChrontelInit)) { + SiS_Pr->SiS_DDC_Index = 0x0a; /* TW: Bit 7 = SC; Bit 6 = SD */ + SiS_Pr->SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */ + SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */ + + for(i=0;i<10;i++) { /* TW: Do only 10 attempts to write */ + /* SiS_SetSwitchDDC2(SiS_Pr); */ + if (SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = tempbx & 0x00FF; /* TW: Write RAB */ + tempah |= 0x80; /* TW: (set bit 7, see datasheet) */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = (tempbx & 0xFF00) >> 8; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write data */ + if(temp) continue; /* TW: (ERROR: no ack) */ + if(SiS_SetStop(SiS_Pr)) continue; /* TW: Set stop condition */ + SiS_Pr->SiS_ChrontelInit = 1; + return; + } + } +} + +/* TW: Write to Chrontel 701x */ +/* Parameter is [Data (S15-S8) | Register no (S7-S0)] */ +void +SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx) +{ + USHORT tempah,temp,i; + + SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */ + SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */ + + for(i=0;i<10;i++) { /* TW: Do only 10 attempts to write */ + if (SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = tempbx & 0x00FF; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write RAB */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = (tempbx & 0xFF00) >> 8; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write data */ + if(temp) continue; /* TW: (ERROR: no ack) */ + if(SiS_SetStop(SiS_Pr)) continue; /* TW: Set stop condition */ + return; + } +} + +/* TW: Read from Chrontel 70xx */ +/* Parameter is [Register no (S7-S0)] */ +USHORT +SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx) +{ + if (SiS_Pr->SiS_IF_DEF_CH70xx == 1) + return(SiS_GetCH700x(SiS_Pr,tempbx)); + else + return(SiS_GetCH701x(SiS_Pr,tempbx)); +} + +/* TW: Read from Chrontel 700x */ +/* Parameter is [Register no (S7-S0)] */ +USHORT +SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx) +{ + USHORT tempah,temp,i; + + if(!(SiS_Pr->SiS_ChrontelInit)) { + SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB */ + } + + SiS_Pr->SiS_DDC_ReadAddr = tempbx; + + for(i=0;i<20;i++) { /* TW: Do only 20 attempts to read */ + /* SiS_SetSwitchDDC2(SiS_Pr); */ + if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = SiS_Pr->SiS_DDC_ReadAddr | 0x80; /* TW: Write RAB | 0x80 */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); + if(temp) continue; /* TW: (ERROR: no ack) */ + if (SiS_SetStart(SiS_Pr)) continue; /* TW: Re-start */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: DAB (S0=1=read) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = SiS_ReadDDC2Data(SiS_Pr,tempah); /* TW: Read byte */ + if (SiS_SetStop(SiS_Pr)) continue; /* TW: Stop condition */ + SiS_Pr->SiS_ChrontelInit = 1; + return(tempah); + } + + /* TW: For 630ST */ + if(!SiS_Pr->SiS_ChrontelInit) { + SiS_Pr->SiS_DDC_Index = 0x0a; /* TW: Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */ + SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */ + + for(i=0;i<20;i++) { /* TW: Do only 20 attempts to read */ + /* SiS_SetSwitchDDC2(SiS_Pr); */ + if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = SiS_Pr->SiS_DDC_ReadAddr | 0x80; /* TW: Write RAB | 0x80 */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); + if(temp) continue; /* TW: (ERROR: no ack) */ + if (SiS_SetStart(SiS_Pr)) continue; /* TW: Re-start */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: DAB (S0=1=read) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = SiS_ReadDDC2Data(SiS_Pr,tempah); /* TW: Read byte */ + if (SiS_SetStop(SiS_Pr)) continue; /* TW: Stop condition */ + SiS_Pr->SiS_ChrontelInit = 1; + return(tempah); + } + } + return(0xFFFF); +} + +/* TW: Read from Chrontel 701x */ +/* Parameter is [Register no (S7-S0)] */ +USHORT +SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx) +{ + USHORT tempah,temp,i; + + SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */ + SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB */ + SiS_Pr->SiS_DDC_ReadAddr = tempbx; + + for(i=0;i<20;i++) { /* TW: Do only 20 attempts to read */ + if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = SiS_Pr->SiS_DDC_ReadAddr; /* TW: Write RAB */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); + if(temp) continue; /* TW: (ERROR: no ack) */ + if (SiS_SetStart(SiS_Pr)) continue; /* TW: Re-start */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */ + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: DAB (S0=1=read) */ + if(temp) continue; /* TW: (ERROR: no ack) */ + tempah = SiS_ReadDDC2Data(SiS_Pr,tempah); /* TW: Read byte */ + SiS_SetStop(SiS_Pr); /* TW: Stop condition */ + return(tempah); + } + return 0xFFFF; +} + +#ifdef LINUX_XF86 +/* TW: Our own DDC functions */ +USHORT +SiS_InitDDCRegs(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, USHORT DDCdatatype) +{ + unsigned char ddcdtype[] = { 0xa0, 0xa0, 0xa0, 0xa2, 0xa6}; + unsigned char flag, cr32; + USHORT temp = 0, myadaptnum = adaptnum; + + SiS_Pr->SiS_ChrontelInit = 0; /* force re-detection! */ + + SiS_Pr->SiS_DDC_SecAddr = 0; + SiS_Pr->SiS_DDC_DeviceAddr = ddcdtype[DDCdatatype]; + SiS_Pr->SiS_DDC_Port = SiS_Pr->SiS_P3c4; + SiS_Pr->SiS_DDC_Index = 0x11; + flag = 0xff; + + cr32 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x32); + + if(pSiS->VGAEngine == SIS_300_VGA) { /* 300 series */ + + if(pSiS->VBFlags & VB_SISBRIDGE) { + if(myadaptnum == 0) { + if(!(cr32 & 0x20)) { + myadaptnum = 2; + if(!(cr32 & 0x10)) { + myadaptnum = 1; + if(!(cr32 & 0x08)) { + myadaptnum = 0; + } + } + } + } + } + + if(myadaptnum != 0) { + flag = 0; + if(pSiS->VBFlags & VB_SISBRIDGE) { + SiS_Pr->SiS_DDC_Port = SiS_Pr->SiS_Part4Port; + SiS_Pr->SiS_DDC_Index = 0x0f; + } + } + + if(cr32 & 0x80) { + if(myadaptnum >= 1) { + if(!(cr32 & 0x08)) { + myadaptnum = 1; + if(!(cr32 & 0x10)) return 0xFFFF; + } + } + } + + temp = 4 - (myadaptnum * 2); + if(flag) temp = 0; + + SiS_Pr->SiS_DDC_Data = 0x02 << temp; + SiS_Pr->SiS_DDC_Clk = 0x01 << temp; + + } else { /* 310/325 series */ + + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) myadaptnum = 0; + + if(pSiS->VBFlags & VB_SISBRIDGE) { + if(myadaptnum == 0) { + if(!(cr32 & 0x20)) { + myadaptnum = 2; + if(!(cr32 & 0x10)) { + myadaptnum = 1; + if(!(cr32 & 0x08)) { + myadaptnum = 0; + } + } + } + } + if(myadaptnum == 2) { + myadaptnum = 1; + } + } + + if(myadaptnum == 1) { + flag = 0; + if(pSiS->VBFlags & VB_SISBRIDGE) { + SiS_Pr->SiS_DDC_Port = SiS_Pr->SiS_Part4Port; + SiS_Pr->SiS_DDC_Index = 0x0f; + } + } + + if(cr32 & 0x80) { + if(myadaptnum >= 1) { + if(!(cr32 & 0x08)) { + myadaptnum = 1; + if(!(cr32 & 0x10)) return 0xFFFF; + } + } + } + + temp = myadaptnum; + if(myadaptnum == 1) { + temp = 0; + if(pSiS->VBFlags & VB_LVDS) flag = 0xff; + } + + if(flag) temp = 0; + + SiS_Pr->SiS_DDC_Data = 0x02 << temp; + SiS_Pr->SiS_DDC_Clk = 0x01 << temp; + + } + return 0; +} + +USHORT +SiS_WriteDABDDC(SiS_Private *SiS_Pr) +{ + SiS_SetStart(SiS_Pr); + if(SiS_WriteDDC2Data(SiS_Pr, SiS_Pr->SiS_DDC_DeviceAddr)) return 0xFFFF; + if(SiS_WriteDDC2Data(SiS_Pr, SiS_Pr->SiS_DDC_SecAddr)) return 0xFFFF; + return(0); +} + +USHORT +SiS_PrepareReadDDC(SiS_Private *SiS_Pr) +{ + SiS_SetStart(SiS_Pr); + if(SiS_WriteDDC2Data(SiS_Pr, (SiS_Pr->SiS_DDC_DeviceAddr | 0x01))) return 0xFFFF; + return(0); +} + +USHORT +SiS_PrepareDDC(SiS_Private *SiS_Pr) +{ + if(SiS_WriteDABDDC(SiS_Pr)) SiS_WriteDABDDC(SiS_Pr); + if(SiS_PrepareReadDDC(SiS_Pr)) return(SiS_PrepareReadDDC(SiS_Pr)); + return(0); +} + +void +SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno) +{ + SiS_SetSCLKLow(SiS_Pr); + if(yesno) { + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data, SiS_Pr->SiS_DDC_Data); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data, 0); + } + SiS_SetSCLKHigh(SiS_Pr); +} + +USHORT +SiS_DoProbeDDC(SiS_Private *SiS_Pr) +{ + unsigned char mask, value; + USHORT temp, ret; + + SiS_SetSwitchDDC2(SiS_Pr); + if(SiS_PrepareDDC(SiS_Pr)) { + SiS_SetStop(SiS_Pr); + return(0xFFFF); + } + mask = 0xf0; + value = 0x20; + if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) { + temp = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0); + SiS_SendACK(SiS_Pr, 0); + if(temp == 0) { + mask = 0xff; + value = 0xff; + } + } + temp = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0); + SiS_SendACK(SiS_Pr, 1); + temp &= mask; + if(temp == value) ret = 0; + else { + ret = 0xFFFF; + if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) { + if(value == 0x30) ret = 0; + } + } + SiS_SetStop(SiS_Pr); + return(ret); +} + +USHORT +SiS_ProbeDDC(SiS_Private *SiS_Pr) +{ + USHORT flag; + + flag = 0x180; + SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; + if(!(SiS_DoProbeDDC(SiS_Pr))) flag |= 0x02; + SiS_Pr->SiS_DDC_DeviceAddr = 0xa2; + if(!(SiS_DoProbeDDC(SiS_Pr))) flag |= 0x08; + SiS_Pr->SiS_DDC_DeviceAddr = 0xa6; + if(!(SiS_DoProbeDDC(SiS_Pr))) flag |= 0x10; + if(!(flag & 0x1a)) flag = 0; + return(flag); +} + +USHORT +SiS_ReadDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT DDCdatatype, unsigned char *buffer) +{ + USHORT flag, length, i; + unsigned char chksum,gotcha; + + if(DDCdatatype > 3) return 0xFFFF; /* incomplete! */ + + flag = 0; + SiS_SetSwitchDDC2(SiS_Pr); + if(!(SiS_PrepareDDC(SiS_Pr))) { + length = 127; + if(DDCdatatype != 1) length = 255; + chksum = 0; + gotcha = 0; + for(i=0; i<length; i++) { + buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0); + chksum += buffer[i]; + gotcha |= buffer[i]; + SiS_SendACK(SiS_Pr, 0); + } + buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0); + chksum += buffer[i]; + SiS_SendACK(SiS_Pr, 1); + if(gotcha) flag = (USHORT)chksum; + else flag = 0xFFFF; + } else { + flag = 0xFFFF; + } + SiS_SetStop(SiS_Pr); + return(flag); +} + +USHORT +SiS_ReadLCDDDC(SiS_Private *SiS_Pr, USHORT length, unsigned char *buffer) +{ + USHORT i=0, flag=0; + + length--; + + SiS_SetSwitchDDC2(SiS_Pr); + if(!(SiS_PrepareDDC(SiS_Pr))) { + for(i=0; i<length; i++) { + buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0); + SiS_SendACK(SiS_Pr, 0); + } + buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0); + SiS_SendACK(SiS_Pr, 1); + } else flag = 0xFFFF; + + SiS_SetStop(SiS_Pr); + return(0); +} + +/* TW: Our private DDC function + + It complies somewhat with the corresponding VESA function + in arguments and return values. + + Since this is probably called before the mode is changed, + we use our pre-detected pSiS-values instead of SiS_Pr as + regards chipset and video bridge type. + + Arguments: + adaptnum: 0=CRT1, 1=CRT2 + CRT2 DDC is not supported in some cases. + DDCdatatype: 0=Probe, 1=EDID, 2=VDIF(not supported), 3=?, 4=?(not supported) + buffer: ptr to 256 data bytes which will be filled with read data. + + Returns 0xFFFF if error, otherwise + if DDCdatatype > 0: Returns 0 if reading OK (included a correct checksum) + if DDCdatatype = 0: Returns supported DDC modes + + */ +USHORT +SiS_HandleDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, + USHORT DDCdatatype, unsigned char *buffer) +{ + if(DDCdatatype == 2) return 0xFFFF; + if(adaptnum > 2) return 0xFFFF; + if(pSiS->VGAEngine == SIS_300_VGA) { + if((adaptnum != 0) && (DDCdatatype != 0)) return 0xFFFF; + } + if((!(pSiS->VBFlags & VB_VIDEOBRIDGE)) && (adaptnum > 0)) return 0xFFFF; + if(SiS_InitDDCRegs(SiS_Pr, pSiS, adaptnum, DDCdatatype) == 0xFFFF) return 0xFFFF; + if(DDCdatatype == 0) { + return(SiS_ProbeDDC(SiS_Pr)); + } else { + if(DDCdatatype > 4) return 0xFFFF; + return(SiS_ReadDDC(SiS_Pr, pSiS, DDCdatatype, buffer)); + } +} + +#if 0 /* for future use */ + +USHORT +SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS, unsigned char *buffer) +{ + USHORT flag, temp; + unsigned char buffer[8]; + unsigned char cr36=0, cr37=0; + unsigned chat tempal, tempah, tempbl, tempbh; + USHORT tempax, tempbx tempcx, push1, push2, push3; + unsigned char addresstable[] = { 0x00, 0x22, 0x30, 0x40 }; + + if(SiS_InitDDCRegs(SiS_Pr, pSiS, 1, 0) == 0xFFFF) return 0xFFFF; + flag = SiS_ProbeDDC(SiS_Pr); + + if(flag & 0x02) { + SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; + SiS_Pr->SiS_DDC_SecAddr = 0x3a; + } else if(flag & 0x08) { + SiS_Pr->SiS_DDC_DeviceAddr = 0xa2; + SiS_Pr->SiS_DDC_SecAddr = 0x76; + } else if(flag & 0x10) { + SiS_Pr->SiS_DDC_DeviceAddr = 0xa6; + SiS_Pr->SiS_DDC_SecAddr = 0x76; + } else return 0xFFFF; + + SiS_ReadLCDDDC(SiS_Pr, 4, buffer); + tempbl = buffer[0]; + tempbh = buffer[1]; + if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) { + tempah = 0x02; + tempbl &= 0xf0; + if(tempbl != 0x40) { + tempah = 0x03; + if(tempbl == 0x50) { + if(!tempbh) { + tempbh = buffer[3] & 0xf0; + if(tempbh == 0x30) { + SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; + SiS_Pr->SiS_DDC_SecAddr = 0x23; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempbl = buffer[0]; + tempbh = buffer[1]; + if(tempbl) cr37 |= 0x10; + tempah = 0x0a; + } + if(tempbh == 0x40) { + SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; + SiS_Pr->SiS_DDC_SecAddr = 0x23; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempbl = buffer[0]; + tempbh = buffer[1]; + if(tempbl) cr37 |= 0x10; + tempah = 0x03; + } + tempbh = 0x00; + } + } + if(tempbh == 0x00) goto cr36ready; + tempah = 0x07; + if(tempbh == 0xc0) goto cr36ready; + } + SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; + SiS_Pr->SiS_DDC_SecAddr = 0x18; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempbl = buffer[0]; + tempbh = buffer[1]; + if(tempbl & 0x02) goto cr36ready; + SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; + SiS_Pr->SiS_DDC_SecAddr = 0x23; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempbl = buffer[0]; + tempbh = buffer[1]; + tempah = 0x03; + if(!tempbh & 0x01)) tempah = 0x02; + if(!tempbl) cr37 |= 0x10; + + } else { + + tempah = 0x02; + tempbx = tempbl | (tempbh << 8); + if(tempbx != 1024) tempah = 0x03; + + } + +cr36ready: + cr36 = tempah; + + if((SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) { + + SiS_Pr->SiS_DDC_SecAddr = 0x47; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempah = buffer[0]; + tempah &= 0x06; + tempah ^= 0x06; + tempah <<= 5; + tempah |= 0x20; + cr37 &= 0x1f; + cr37 |= tempah; + if((cr36 & 0x07) == 0x07) cr37 &= 0x0e; + + } else { + + push1 = tempah; + SiS_Pr->SiS_DDC_SecAddr = 0x45; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempah = 0x01; + if((buffer[0] != 0x20) && (buffer[0] != 0x34)) { + tempah = 0x00; + } + cr37 &= 0xfe; + cr37 |= tempah; + + SiS_Pr->SiS_DDC_SecAddr = 0x7e; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempax = (USHORT)(buffer[0] | (buffer[1] << 8)); + push2 = tempax; + tempax &= 0x0003; + tempax *= 0x1b; + push3 = tempax; + tempax = (USHORT)buffer[0]; + tempax &= 0x001c; + tempax >>= 2; + tempax *= 8; + tempbx = push3; + tempbx += tempax; + if(buffer[0] & 0x20) { + SiS_Pr->SiS_DDC_SecAddr = 0x80; + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempax = buffer[0] | (buffer[1] << 8); + tempax &= 0x1f; + if(buffer[0] & 0x70) tempax <<= 1; + tempax++; + tempbx += tempax; + } + tempcx = push2; + tempax = push1 << 8; + tempbx = (tempbx & 0xff00) | (((tempbx & 0x00ff) + 0x80) & 0x00ff); + if(tempcx & 0xf800) { + tempal = addresstable[((tempax & 0xff00) >> 8)]; + tempcx &= 0xf8ff; + tempcx >>= 11; + for(i=0; i<tempcx; i++) { + SiS_Pr->SiS_DDC_SecAddr = (tempbx & 0x00ff); + SiS_ReadLCDDDC(SiS_Pr, 2, buffer); + tempbx += 0x04; + if(buffer[0] == tempal) break; + } + tempah = buffer[1]; + tempah &= 0x0c; + tempah ^= 0x0c; + tempah <<= 4; + tempah |= 0x20; + cr37 &= 0x1f; + cr37 |= tempah; + if((cr36 & 0x07) == 0x07) cr37 &= 0x0e; + } + } + xf86DrvMsg(0, X_INFO, "DDC: cr36 = 0x%02x, cr37 = 0x%02x\n", cr36, cr37); + +} + +#endif + +/* TW: Generic I2C functions (compliant to i2c library) */ + +#if 0 +USHORT +SiS_I2C_GetByte(SiS_Private *SiS_Pr) +{ + return(SiS_ReadDDC2Data(SiS_Pr,0)); +} + +Bool +SiS_I2C_PutByte(SiS_Private *SiS_Pr, USHORT data) +{ + if(SiS_WriteDDC2Data(SiS_Pr,data)) return FALSE; + return TRUE; +} + +Bool +SiS_I2C_Address(SiS_Private *SiS_Pr, USHORT addr) +{ + if(SiS_SetStart(SiS_Pr)) return FALSE; + if(SiS_WriteDDC2Data(SiS_Pr,addr)) return FALSE; + return TRUE; +} + +void +SiS_I2C_Stop(SiS_Private *SiS_Pr) +{ + SiS_SetStop(SiS_Pr); +} +#endif + +#endif + +void +SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh) +{ + USHORT tempal,tempah,tempbl; + + tempal = tempax & 0x00FF; + tempah =(tempax >> 8) & 0x00FF; + tempbl = SiS_GetCH70xx(SiS_Pr,tempal); + tempbl = (((tempbl & tempbh) | tempah) << 8 | tempal); + SiS_SetCH70xx(SiS_Pr,tempbl); +} + +/* TW: Generic I2C functions for Chrontel --------- */ + +void +SiS_SetSwitchDDC2(SiS_Private *SiS_Pr) +{ + SiS_SetSCLKHigh(SiS_Pr); + /* SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAY); */ + SiS_WaitRetraceDDC(SiS_Pr); + + SiS_SetSCLKLow(SiS_Pr); + /* SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAY); */ + SiS_WaitRetraceDDC(SiS_Pr); +} + +/* TW: Set I2C start condition */ +/* TW: This is done by a SD high-to-low transition while SC is high */ +USHORT +SiS_SetStart(SiS_Private *SiS_Pr) +{ + if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* TW: (SC->low) */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: SD->high */ + if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: SC->high */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,0x00); /* TW: SD->low = start condition */ + if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: (SC->low) */ + return 0; +} + +/* TW: Set I2C stop condition */ +/* TW: This is done by a SD low-to-high transition while SC is high */ +USHORT +SiS_SetStop(SiS_Private *SiS_Pr) +{ + if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* TW: (SC->low) */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,0x00); /* TW: SD->low */ + if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: SC->high */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: SD->high = stop condition */ + if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: (SC->high) */ + return 0; +} + +/* TW: Write 8 bits of data */ +USHORT +SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax) +{ + USHORT i,flag,temp; + + flag=0x80; + for(i=0;i<8;i++) { + SiS_SetSCLKLow(SiS_Pr); /* TW: SC->low */ + if(tempax & flag) { + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: Write bit (1) to SD */ + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,0x00); /* TW: Write bit (0) to SD */ + } + SiS_SetSCLKHigh(SiS_Pr); /* TW: SC->high */ + flag >>= 1; + } + temp = SiS_CheckACK(SiS_Pr); /* TW: Check acknowledge */ + return(temp); +} + +USHORT +SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax) +{ + USHORT i,temp,getdata; + + getdata=0; + for(i=0; i<8; i++) { + getdata <<= 1; + SiS_SetSCLKLow(SiS_Pr); + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); + SiS_SetSCLKHigh(SiS_Pr); + temp = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); + if(temp & SiS_Pr->SiS_DDC_Data) getdata |= 0x01; + } + return(getdata); +} + +USHORT +SiS_SetSCLKLow(SiS_Private *SiS_Pr) +{ + USHORT temp, watchdog=50000; + + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Clk,0x00); /* SetSCLKLow() */ + do { + temp = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); + } while((temp & SiS_Pr->SiS_DDC_Clk) && --watchdog); + if (!watchdog) return 0xFFFF; + SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT); + return 0; +} + +USHORT +SiS_SetSCLKHigh(SiS_Private *SiS_Pr) +{ + USHORT temp,watchdog=50000; + + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Clk,SiS_Pr->SiS_DDC_Clk); /* SetSCLKHigh() */ + do { + temp = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); + } while((!(temp & SiS_Pr->SiS_DDC_Clk)) && --watchdog); + if (!watchdog) return 0xFFFF; + SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT); + return 0; +} + +void +SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime) +{ + USHORT i; + + for(i=0; i<delaytime; i++) { + SiS_GetReg1(SiS_Pr->SiS_P3c4,0x05); + } +} + +/* TW: Check I2C acknowledge */ +/* Returns 0 if ack ok, non-0 if ack not ok */ +USHORT +SiS_CheckACK(SiS_Private *SiS_Pr) +{ + USHORT tempah; + + SiS_SetSCLKLow(SiS_Pr); /* TW: (SC->low) */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, + ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: (SD->high) */ + SiS_SetSCLKHigh(SiS_Pr); /* TW: SC->high = clock impulse for ack */ + tempah = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);/* TW: Read SD */ + SiS_SetSCLKLow(SiS_Pr); /* TW: SC->low = end of clock impulse */ + if(tempah & SiS_Pr->SiS_DDC_Data) return(1); /* TW: Ack OK if bit = 0 */ + else return(0); +} + +/* TW: End of I2C functions ----------------------- */ + + +/* =============== SiS 310/325 O.E.M. ================= */ + +#ifdef SIS315H + +static USHORT +GetLCDPtrIndex(SiS_Private *SiS_Pr) +{ + USHORT index; + + index = SiS_Pr->SiS_LCDResInfo & 0x0F; + index--; + index *= 3; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) index += 2; + else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) index++; + + return index; +} + +/* +--------------------------------------------------------- + GetTVPtrIndex() + return 0 : NTSC Enhanced/Standard + 1 : NTSC Standard TVSimuMode + 2 : PAL Enhanced/Standard + 3 : PAL Standard TVSimuMode + 4 : HiVision Enhanced/Standard + 5 : HiVision Standard TVSimuMode +--------------------------------------------------------- +*/ +static USHORT +GetTVPtrIndex(SiS_Private *SiS_Pr) +{ + USHORT index; + + index = 0; + if(SiS_Pr->SiS_VBInfo & SetPALTV) index++; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index++; /* Hivision TV use PAL */ + + index <<= 1; + + if((SiS_Pr->SiS_VBInfo & SetInSlaveMode) && (SiS_Pr->SiS_SetFlag & TVSimuMode)) + index++; + + return index; +} + +/* TW: Checked against 650/LVDS (1.10.07) and 650/301LVx (1.10.6s) BIOS (including data) */ +static void +SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr, USHORT ModeNo) +{ + USHORT delay,index,temp,romptr=0; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(HwDeviceExtension->jChipType != SIS_330) { + romptr = ROMAddr[0x128] | (ROMAddr[0x129] << 8); /* 301, LVDS */ + if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) + romptr = ROMAddr[0x12a] | (ROMAddr[0x12b] << 8); + } else { + romptr = ROMAddr[0x1a8] | (ROMAddr[0x1a9] << 8); /* 301, LVDS */ + if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) + romptr = ROMAddr[0x1aa] | (ROMAddr[0x1ab] << 8); + } + } + if(romptr) delay = ROMAddr[romptr]; + else { + delay = SiS310_CRT2DelayCompensation1; + if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) + delay = SiS310_CRT2DelayCompensation2; + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) + delay = SiS310_CRT2DelayCompensation3; + } + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + index = GetLCDPtrIndex(SiS_Pr); + delay = SiS310_LCDDelayCompensation1[index]; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) + delay = SiS310_LCDDelayCompensation2[index]; + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) + delay = SiS310_LCDDelayCompensation3[index]; + if((IS_SIS650740) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) { + if(SiS_IsM650or651(SiS_Pr,HwDeviceExtension, BaseAddr)) { + delay = SiS310_LCDDelayCompensation4[index]; /* 652c */ + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) + delay = SiS310_LCDDelayCompensation5[index]; /* 6541 */ + } else { + delay = SiS310_LCDDelayCompensation6[index]; /* 6550 */ + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) + delay = SiS310_LCDDelayCompensation7[index]; /* 655f */ + } + } + } else { + index = GetTVPtrIndex(SiS_Pr); + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(HwDeviceExtension->jChipType != SIS_330) { + romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8); + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) + romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8); + } else { + romptr = ROMAddr[0x194] | (ROMAddr[0x195] << 8); + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) + romptr = ROMAddr[0x19a] | (ROMAddr[0x19b] << 8); + } + } + if(romptr) delay = ROMAddr[romptr + index]; + else { + delay = SiS310_TVDelayCompensation1[index]; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) + delay = SiS310_TVDelayCompensation2[index]; + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) + delay = SiS310_TVDelayCompensation3[index]; + } + if((IS_SIS650740) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) { + romptr = 0; + if(SiS_IsM650or651(SiS_Pr,HwDeviceExtension, BaseAddr)) { + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8); + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) + romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8); + } + if(romptr) delay = ROMAddr[romptr + index]; + else { + delay = SiS310_TVDelayCompensation4[index]; /* 656e @ 0x114 */ + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) + delay = SiS310_TVDelayCompensation5[index]; /* 6574 @ 0x11a */ + } + } else { + delay = SiS310_TVDelayCompensation6[index]; /* 657a */ + if(SiS_Pr->SiS_VBType & VB_SIS30xNEW) + delay = SiS310_TVDelayCompensation7[index]; /* 6580 */ + } + } + } + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0xF0,delay); + } else { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + delay <<= 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0x0F,delay); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0xF0,delay); + } + } + } else { + if((IS_SIS650740) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + temp = (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xf0) >> 4; + if(temp == 8) { + delay &= 0x0f; + delay |= 0xb0; + } else if(temp == 6) { + delay &= 0x0f; + delay |= 0xc0; + } + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2D,delay); /* index 2D D[3:0] */ + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0xF0,delay); + } + } +} + +/* TW: Checked against 650/301LVx 1.10.6s BIOS (including data) */ +static void +SetAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,temp,romptr=0; + + temp = GetTVPtrIndex(SiS_Pr); + temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ + + if(ModeNo<=0x13) + index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex; + else + index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex; + + if(ROMAddr && SiS_Pr->SiS_UseROM) { + romptr = ROMAddr[0x112] | (ROMAddr[0x113] << 8); + if(HwDeviceExtension->jChipType == SIS_330) { + romptr = ROMAddr[0x192] | (ROMAddr[0x193] << 8); + } + } + + if(romptr) { + temp <<= 1; + temp = ROMAddr[romptr + temp + index]; + } else { + temp = SiS310_TVAntiFlick1[temp][index]; + } + temp <<= 4; + + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0A,0x8f,temp); /* index 0A D[6:4] */ +} + +/* TW: Checked against 650/301LVx 1.10.6s BIOS (including data) */ +static void +SetEdgeEnhance(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,temp,romptr=0; + + temp = GetTVPtrIndex(SiS_Pr); + temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ + + if(ModeNo<=0x13) + index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex; + else + index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex; + + if(ROMAddr && SiS_Pr->SiS_UseROM) { + romptr = ROMAddr[0x124] | (ROMAddr[0x125] << 8); + if(HwDeviceExtension->jChipType == SIS_330) { + romptr = ROMAddr[0x1a4] | (ROMAddr[0x1a5] << 8); + } + } + + if(romptr) { + temp <<= 1; + temp = ROMAddr[romptr + temp + index]; + } else { + temp = SiS310_TVEdge1[temp][index]; + } + temp <<= 5; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x3A,0x1F,temp); /* index 0A D[7:5] */ +} + +/* TW: Checked against 650/301LVx 1.10.6s BIOS (incl data) */ +static void +SetYFilter(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index, temp, i, j; + UCHAR OutputSelect = *SiS_Pr->pSiS_OutputSelect; + + temp = GetTVPtrIndex(SiS_Pr); + temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ + + if (ModeNo<=0x13) { + index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex; + } else { + index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex; + } + + if(SiS_Pr->SiS_VBInfo&SetCRT2ToHiVisionTV) temp = 1; /* Hivision TV uses PAL */ + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVYFilter2[temp][index][j]); + } + for(i=0x48; i<=0x4A; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVYFilter2[temp][index][j]); + } + } else { + for(i=0x35, j=0; i<=0x38; i++, j++){ + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVYFilter1[temp][index][j]); + } + } + + if(ROMAddr && SiS_Pr->SiS_UseROM) { + OutputSelect = ROMAddr[0xf3]; + if(HwDeviceExtension->jChipType == SIS_330) { + OutputSelect = ROMAddr[0x11b]; + } + } + if(OutputSelect & EnablePALMN) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) { + temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); + temp &= (EnablePALM | EnablePALN); + if(temp == EnablePALM) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALMFilter2[index][j]); + } + for(i=0x48; i<=0x4A; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALMFilter2[index][j]); + } + } else { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALMFilter[index][j]); + } + } + } + if(temp == EnablePALN) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALNFilter2[index][j]); + } + for(i=0x48, j=0; i<=0x4A; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALNFilter2[index][j]); + } + } else { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALNFilter[index][j]); + } + } + } + } + } +} + +/* TW: Checked against 650/301LVx 1.10.6s BIOS (including data) */ +static void +SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,temp,temp1,i,j,resinfo,romptr=0; + + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) return; + + temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); /* if PALM/N not set */ + temp1 &= (EnablePALM | EnablePALN); + if(temp1) return; + + if (ModeNo<=0x13) { + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + temp = GetTVPtrIndex(SiS_Pr); + /* 0: NTSC Graphics, 1: NTSC Text, 2: PAL Graphics, + * 3: PAL Text, 4: HiTV Graphics 5: HiTV Text + */ + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + romptr = ROMAddr[0x116] | (ROMAddr[0x117] << 8); + if(HwDeviceExtension->jChipType == SIS_330) { + romptr = ROMAddr[0x196] | (ROMAddr[0x197] << 8); + } + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + romptr = ROMAddr[0x11c] | (ROMAddr[0x11d] << 8); + if(HwDeviceExtension->jChipType == SIS_330) { + romptr = ROMAddr[0x19c] | (ROMAddr[0x19d] << 8); + } + if((SiS_Pr->SiS_VBInfo & SetInSlaveMode) && (!(SiS_Pr->SiS_SetFlag & TVSimuMode))) { + romptr = ROMAddr[0x116] | (ROMAddr[0x117] << 8); + if(HwDeviceExtension->jChipType == SIS_330) { + romptr = ROMAddr[0x196] | (ROMAddr[0x197] << 8); + } + } + } + } + if(romptr) { + romptr += (temp << 2); + for(j=0, i=0x31; i<=0x34; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]); + } + } else { + index = temp % 2; + temp >>= 1; /* 0:NTSC, 1:PAL, 2:HiTV */ + for(j=0, i=0x31; i<=0x34; i++, j++) { + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVPhaseIncr1[temp][index][j]); + else if((!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || (SiS_Pr->SiS_SetFlag & TVSimuMode)) + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVPhaseIncr2[temp][index][j]); + else + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVPhaseIncr1[temp][index][j]); + } + } + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* TW: 650/301LV: (VB_SIS301LV | VB_SIS302LV)) */ + if((!(SiS_Pr->SiS_VBInfo & SetPALTV)) && (ModeNo > 0x13)) { + if(resinfo == 6) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x31,0x21); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x32,0xf0); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x33,0xf5); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x34,0x7f); + } else if (resinfo == 7) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x31,0x21); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x32,0xf0); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x33,0xf5); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x34,0x7f); + } else if (resinfo == 8) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x31,0x1e); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x32,0x8b); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x33,0xfb); + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x34,0x7b); + } + } + } +} + +void +SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + SetDelayComp(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo); + /* TW: The TV functions are not for LVDS */ + if( (SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) { + SetAntiFlicker(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + SetPhaseIncr(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + SetYFilter(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + SetEdgeEnhance(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + } + } +} + +/* TW: New from 650/301LVx 1.10.6s, 1.10.7w - clashes with OEMLCD() */ +void +SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT tempcl,tempch,tempbl,tempbh,tempbx,tempax,temp; + USHORT resinfo,modeflag; + + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return; + + if(ModeNo <= 0x13) { + resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10); + } + tempch = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36); + tempch &= 0xf0; + tempch >>= 4; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1f,0x76); + } + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { /* From 1.10.8w */ + if(!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,0x90); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x01); + if((ModeNo > 0x13) && (resinfo == 8)) { + tempbx = 806; /* 0x326 */ + tempbx--; + temp = tempbx & 0xff; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,temp); + temp = (tempbx >> 8) & 0x03; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1d,0xf8,temp); + } + } else { + if(ModeNo <= 0x13) { + if(ModeNo <= 1) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x70); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,0xff); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x48); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1d,0x12); + } + if(!(modeflag & HalfDCLK)) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,0x20); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,0x1a); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,0x28); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,0x00); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x4c); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,0xdc); + if(ModeNo == 0x12) { + switch(tempch) { + case 0: + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x95); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,0xdc); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1a,0x10); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x95); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1c,0x48); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1d,0x12); + break; + case 2: + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x95); + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x48); + break; + case 3: + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x95); + break; + } + } + } + } + } + } + } else { + tempcl = tempbh = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x01); + tempcl &= 0x0f; + tempbh &= 0x70; + tempbh >>= 4; + tempbl = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x04); + tempbx = (tempbh << 8) | tempbl; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if((resinfo == 8) || (!(SiS_Pr->SiS_LCDInfo & LCDNonExpanding))) { + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + tempbx = 770; + } else { + if(tempbx > 770) tempbx = 770; + if(SiS_Pr->SiS_VGAVDE < 600) { + tempax = 768 - SiS_Pr->SiS_VGAVDE; + tempax >>= 4; /* From 1.10.7w; 1.10.6s: 3; */ + if(SiS_Pr->SiS_VGAVDE <= 480) tempax >>= 4; /* From 1.10.7w; 1.10.6s: < 480; >>=1; */ + tempbx -= tempax; + } + } + } else return; + } +#if 0 + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + } +#endif + temp = tempbx & 0xff; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,temp); + temp = (tempbx & 0xff00) >> 8; + temp <<= 4; + temp |= tempcl; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,temp); + } + } +} + +/* TW: New and checked from 650/301LV BIOS */ +/* This might clash with newer "FinalizeLCD()" function */ +void +SiS_OEMLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT tempbx,tempah,tempbl,tempbh,tempcl; + + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); + tempbh = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x1a); + tempbh &= 0x38; + tempbh >>= 3; + tempbl = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x18); + tempbx = (tempbh << 8) | tempbl; + if(SiS_Pr->SiS_LCDTypeInfo == 1) tempbx -= 0x12; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,tempbx & 0x00ff); + tempah = (tempbx & 0xff00) >> 8; + tempah &= 0x07; + tempah <<= 3; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0xc7,tempah); + tempah = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x19); + tempah &= 0x0f; + if(SiS_Pr->SiS_LCDTypeInfo == 1) tempah -= 2; + tempah &= 0x0f; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,tempah); + tempah = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x14); + if(SiS_Pr->SiS_LCDTypeInfo == 1) tempah++; + tempah -= 8; + SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,tempah); + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempcl = tempbh = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x01); + tempbh &= 0x70; + tempbh >>= 4; + tempbl = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x04); + tempbx = (tempbh << 8) | tempbl; + if(SiS_Pr->SiS_LCDTypeInfo == 1) { + tempbx -= 0x1e; + tempcl &= 0x0f; + tempcl -= 4; + tempcl &= 0x0f; + } + tempbl = tempbx & 0x00ff; + tempbh = (tempbx >> 8) & 0x00ff; + SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,tempbl); + tempbh <<= 4; + tempbh |= tempcl; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,tempbh); + } +} +#endif + + +/* ================= SiS 300 O.E.M. ================== */ + +#ifdef SIS300 + +#if 0 /* Not used */ +static USHORT +GetRevisionID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + ULONG temp1; +#ifndef LINUX_XF86 + ULONG base; +#endif + USHORT temp2 = 0; + + if((HwDeviceExtension->jChipType==SIS_540)|| + (HwDeviceExtension->jChipType==SIS_630)|| + (HwDeviceExtension->jChipType==SIS_730)) { +#ifndef LINUX_XF86 + base = 0x80000008; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); +#else + temp1=pciReadLong(0x00000000, 0x08); +#endif + temp1 &= 0x000000FF; + temp2 = (USHORT)(temp1); + return temp2; + } + return 0; +} +#endif + +/* TW: Checked against 630/301B BIOS (incl data) */ +static USHORT +GetOEMLCDPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr, int Flag) +{ + USHORT tempbx=0,romptr=0; + UCHAR customtable300[] = { + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff + }; + UCHAR customtable630[] = { + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff + }; + + if(HwDeviceExtension->jChipType == SIS_300) { + + tempbx = SiS_Pr->SiS_LCDResInfo - 2; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 4; + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 3; + } + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(ROMAddr[0x235] & 0x80) { + tempbx = SiS_Pr->SiS_LCDTypeInfo; + if(Flag) { + romptr = ROMAddr[0x255] | (ROMAddr[0x256] << 8); + if(romptr) { + tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo]; + } else { + tempbx = customtable300[SiS_Pr->SiS_LCDTypeInfo]; + } + if(tempbx == 0xFF) return 0xFFFF; + } + tempbx <<= 1; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx++; + } + } + + } else { + + if(Flag) { + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + romptr = ROMAddr[0x255] | (ROMAddr[0x256] << 8); + if(romptr) { + tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo]; + } else { + tempbx = 0xff; + } + } else { + tempbx = customtable630[SiS_Pr->SiS_LCDTypeInfo]; + } + if(tempbx == 0xFF) return 0xFFFF; + tempbx <<= 2; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempbx += 2; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx++; + return tempbx; + } + tempbx = SiS_Pr->SiS_LCDTypeInfo << 2; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempbx += 2; + if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx++; + } + return tempbx; +} + +/* TW: Checked against 630/301B and 630/LVDS BIOS (incl data) */ +static void +SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,temp,romptr=0; + + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x237] & 0x01)) return; + if(!(ROMAddr[0x237] & 0x02)) return; + romptr = ROMAddr[0x24b] | (ROMAddr[0x24c] << 8); + } + + /* TW: The Panel Compensation Delay should be set according to tables + * here. Unfortunately, various BIOS versions don't case about + * a uniform way using eg. ROM byte 0x220, but use different + * hard coded delays (0x04, 0x20, 0x18) in SetGroup1(). + * Thus we don't set this if the user select a custom pdc or if + * we otherwise detected a valid pdc. + */ + if(HwDeviceExtension->pdc) return; + + temp = GetOEMLCDPtr(SiS_Pr,HwDeviceExtension, ROMAddr, 0); + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_LCDDelayIndex; + + if(HwDeviceExtension->jChipType != SIS_300) { + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += index; + temp = ROMAddr[romptr]; + } else { + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp = SiS300_OEMLCDDelay2[temp][index]; + } else { + temp = SiS300_OEMLCDDelay3[temp][index]; + } + } + } else { + if((ROMAddr) && SiS_Pr->SiS_UseROM && (ROMAddr[0x235] & 0x80)) { + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += index; + temp = ROMAddr[romptr]; + } else { + temp = SiS300_OEMLCDDelay5[temp][index]; + } + } else { + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + romptr = ROMAddr[0x249] | (ROMAddr[0x24a] << 8); + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += index; + temp = ROMAddr[romptr]; + } else { + temp = SiS300_OEMLCDDelay4[temp][index]; + } + } else { + temp = SiS300_OEMLCDDelay4[temp][index]; + } + } + } + temp &= 0x3c; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */ +} + +static void +SetOEMLCDData(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ +#if 0 /* TW: Unfinished; VData table missing */ + USHORT index,temp; + + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x237] & 0x01)) return; + if(!(ROMAddr[0x237] & 0x04)) return; + /* No rom pointer in BIOS header! */ + } + + temp = GetOEMLCDPtr(SiS_Pr,HwDeviceExtension, ROMAddr, 1); + if(temp = 0xFFFF) return; + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex]._VB_LCDHIndex; + for(i=0x14, j=0; i<=0x17; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,i,SiS300_LCDHData[temp][index][j]); + } + SiS_SetRegANDOR(SiS_SiS_Part1Port,0x1a, 0xf8, (SiS300_LCDHData[temp][index][j] & 0x07)); + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex]._VB_LCDVIndex; + SiS_SetReg1(SiS_SiS_Part1Port,0x18, SiS300_LCDVData[temp][index][0]); + SiS_SetRegANDOR(SiS_SiS_Part1Port,0x19, 0xF0, SiS300_LCDVData[temp][index][1]); + SiS_SetRegANDOR(SiS_SiS_Part1Port,0x1A, 0xC7, (SiS300_LCDVData[temp][index][2] & 0x38)); + for(i=0x1b, j=3; i<=0x1d; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part1Port,i,SiS300_LCDVData[temp][index][j]); + } +#endif +} + +/* TW: Checked against 630/301B 2.04.50 and 630/LVDS BIOS */ +static USHORT +GetOEMTVPtr(SiS_Private *SiS_Pr) +{ + USHORT index; + + index = 0; + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) index += 4; + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) index += 2; + else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index += 3; + else if(SiS_Pr->SiS_VBInfo & SetPALTV) index += 1; + } else { + if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) index += 2; + if(SiS_Pr->SiS_VBInfo & SetPALTV) index += 1; + } + return index; +} + +/* TW: Checked against 630/301B 2.04.50 and 630/LVDS BIOS (incl data) */ +static void +SetOEMTVDelay(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,temp,romptr=0; + + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x238] & 0x01)) return; + if(!(ROMAddr[0x238] & 0x02)) return; + romptr = ROMAddr[0x241] | (ROMAddr[0x242] << 8); + } + + temp = GetOEMTVPtr(SiS_Pr); + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVDelayIndex; + + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += index; + temp = ROMAddr[romptr]; + } else { + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + temp = SiS300_OEMTVDelay301[temp][index]; + } else { + temp = SiS300_OEMTVDelayLVDS[temp][index]; + } + } + temp &= 0x3c; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */ +} + +/* TW: Checked against 630/301B 2.04.50 BIOS (incl data) */ +static void +SetOEMAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex) +{ + USHORT index,temp,romptr=0; + + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x238] & 0x01)) return; + if(!(ROMAddr[0x238] & 0x04)) return; + romptr = ROMAddr[0x243] | (ROMAddr[0x244] << 8); + } + + temp = GetOEMTVPtr(SiS_Pr); + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVFlickerIndex; + + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += index; + temp = ROMAddr[romptr]; + } else { + temp = SiS300_OEMTVFlicker[temp][index]; + } + temp &= 0x70; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0A,0x8F,temp); /* index 0A D[6:4] */ +} + +/* TW: Checked against 630/301B 2.04.50 BIOS (incl data) */ +static void +SetOEMPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,i,j,temp,romptr=0; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) return; + + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x238] & 0x01)) return; + if(!(ROMAddr[0x238] & 0x08)) return; + romptr = ROMAddr[0x245] | (ROMAddr[0x246] << 8); + } + + temp = GetOEMTVPtr(SiS_Pr); + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVPhaseIndex; + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x31, j=0; i<=0x34; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Phase2[temp][index][j]); + } + } else { + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += (index * 4); + for(i=0x31, j=0; i<=0x34; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]); + } + } else { + for(i=0x31, j=0; i<=0x34; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Phase1[temp][index][j]); + } + } + } +} + +/* TW: Checked against 630/301B 2.04.50 BIOS (incl data) */ +static void +SetOEMYFilter(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT index,temp,temp1,i,j,romptr=0; + + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVisionTV)) return; + + if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(!(ROMAddr[0x238] & 0x01)) return; + if(!(ROMAddr[0x238] & 0x10)) return; + romptr = ROMAddr[0x247] | (ROMAddr[0x248] << 8); + } + + temp = GetOEMTVPtr(SiS_Pr); + + index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVYFilterIndex; + + if(HwDeviceExtension->jChipType > SIS_300) { + if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) { + temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + if(temp1 & (EnablePALM | EnablePALN)) { + temp = 8; + if(!(temp1 & EnablePALM)) temp = 9; + } + } + } + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Filter2[temp][index][j]); + } + for(i=0x48; i<=0x4A; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Filter2[temp][index][j]); + } + } else { + if(romptr) { + romptr += (temp * 2); + romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr += (index * 4); + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]); + } + } else { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Filter1[temp][index][j]); + } + } + } +} + +void +SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo) +{ + USHORT ModeIdIndex; + + ModeIdIndex = SiS_SearchVBModeID(SiS_Pr,ROMAddr,&ModeNo); + if(!(ModeIdIndex)) return; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + SetOEMLCDDelay(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + SetOEMLCDData(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + SetOEMTVDelay(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { + SetOEMAntiFlicker(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + SetOEMPhaseIncr(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + SetOEMYFilter(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + } + } +} +#endif + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h:1.9 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h Mon Feb 3 21:44:28 2003 @@ -0,0 +1,285 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.9 2003/02/04 02:44:28 dawes Exp $ */ +#ifndef _INIT301_ +#define _INIT301_ + +#include "osdef.h" +#include "initdef.h" +#include "vgatypes.h" +#include "vstruct.h" + +#ifdef TC +#include <stdio.h> +#include <string.h> +#include <conio.h> +#include <dos.h> +#include <stdlib.h> +#endif + +#ifdef LINUX_XF86 +#include "xf86.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "sis.h" +#include "sis_regs.h" +#endif + +#ifdef LINUX_KERNEL +#include <asm/io.h> +#include <linux/types.h> +#include <linux/sisfb.h> +#endif + +#ifdef WIN2000 +#include <stdio.h> +#include <string.h> +#include <miniport.h> +#include "dderror.h" +#include "devioctl.h" +#include "miniport.h" +#include "ntddvdeo.h" +#include "video.h" +#include "sisv.h" +#endif + +#if 0 +extern const USHORT SiS_MDA_DAC[]; +extern const USHORT SiS_CGA_DAC[]; +extern const USHORT SiS_EGA_DAC[]; +extern const USHORT SiS_VGA_DAC[]; +#endif + +extern BOOLEAN SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *RomAddr, USHORT *); + +BOOLEAN SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr); +BOOLEAN SiS_IsM650or651(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_IsDisableCRT2(SiS_Private *SiS_Pr, USHORT BaseAddr); +BOOLEAN SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_CRT2IsLCD(SiS_Private *SiS_Pr, USHORT BaseAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetDefCRT2ExtRegs(SiS_Private *SiS_Pr, USHORT BaseAddr); +USHORT SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +BOOLEAN SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT MODEIdIndex, + USHORT RefreshRateTableIndex,USHORT *i,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SaveCRT2Info(SiS_Private *SiS_Pr, USHORT ModeNo); +void SiS_GetCRT2Data(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetCRT2PtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex); +void SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index, USHORT *ResIndex); +void SiS_GetCRT2Data301(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +USHORT SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +void SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetCRT2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT BaseAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO ); +void SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT2Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +USHORT SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +USHORT SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +USHORT SiS_CalcDelayVB(SiS_Private *SiS_Pr); +USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR); +void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR); +void SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND); +USHORT SiS_GetVGAHT2(SiS_Private *SiS_Pr); +void SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeIdIndex, USHORT RefreshRateTableIndex, + USHORT BaseAddr, USHORT ModeNo); +void SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup5(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex); +void SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_EnableCRT2(SiS_Private *SiS_Pr); +void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension, int checkcrt2mode); +BOOLEAN SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO); +BOOLEAN SiS_BridgeIsEnable(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO); +BOOLEAN SiS_BridgeInSlave(SiS_Private *SiS_Pr); +void SiS_PresetScratchregister(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetTVSystem(SiS_Private *SiS_Pr); +void SiS_LongWait(SiS_Private *SiS_Pr); +USHORT SiS_GetQueueConfig(SiS_Private *SiS_Pr); +void SiS_VBLongWait(SiS_Private *SiS_Pr); +USHORT SiS_GetVCLKLen(SiS_Private *SiS_Pr, UCHAR *ROMAddr); +void SiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_WaitRetrace1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_WaitRetrace2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_WaitRetraceDDC(SiS_Private *SiS_Pr); +void SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex); +void SiS_SetTPData(SiS_Private *SiS_Pr); +void SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo); +void SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCHTVReg(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex); +void SiS_GetCHTVRegPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex); +void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempax); +USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempax); +void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempax); +USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempax); +void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempax); +USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempax); +#ifdef LINUX_XF86 +USHORT SiS_I2C_GetByte(SiS_Private *SiS_Pr); +Bool SiS_I2C_PutByte(SiS_Private *SiS_Pr, USHORT data); +Bool SiS_I2C_Address(SiS_Private *SiS_Pr, USHORT addr); +void SiS_I2C_Stop(SiS_Private *SiS_Pr); +#endif +void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh); +void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr); +USHORT SiS_SetStart(SiS_Private *SiS_Pr); +USHORT SiS_SetStop(SiS_Private *SiS_Pr); +void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime); +USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr); +USHORT SiS_SetSCLKHigh(SiS_Private *SiS_Pr); +USHORT SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax); +USHORT SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax); +USHORT SiS_CheckACK(SiS_Private *SiS_Pr); +USHORT SiS_ReadLCDDDC(SiS_Private *SiS_Pr, USHORT length, unsigned char *buffer); +#ifdef SIS315H +void SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +void SiS_OEMLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +#endif +#ifdef SIS300 +void SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo); +#endif +BOOLEAN SiS_LowModeStuff(SiS_Private *SiS_Pr, USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension); + +BOOLEAN SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +/* void SiS_CHACRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex); */ + +BOOLEAN SiS_SetCRT2Group301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex); +void SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex); +void SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex); +void SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex); +#ifdef SIS300 +void SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +#endif +#ifdef SIS315H +void SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_CRT2AutoThreshold(SiS_Private *SiS_Pr, USHORT BaseAddr); +#endif +BOOLEAN SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +void SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +void SiS_SetPanelDelay(SiS_Private *SiS_Pr, UCHAR* ROMAddr,PSIS_HW_DEVICE_INFO,USHORT DelayTime); +void SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay); +void SiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay); +void SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay); +void SiS_VBWait(SiS_Private *SiS_Pr); + +void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); + +/* TW: New functions (with mostly temporary names) */ +void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr); +void SiS_Chrontel701xOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr); +void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr); +void SiS_Chrontel701xOff(SiS_Private *SiS_Pr); +void SiS_ChrontelResetDB(SiS_Private *SiS_Pr); +void SiS_ChrontelDoSomething4(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +void SiS_ChrontelDoSomething3(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +void SiS_ChrontelDoSomething2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +void SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +#if 0 +BOOLEAN SiS_IsSomethingCR5F(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +#endif +BOOLEAN SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +BOOLEAN SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +void SiS_SetCH701xForLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); +void SiS_ChrontelPowerSequencing(SiS_Private *SiS_Pr); +BOOLEAN SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +BOOLEAN SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +BOOLEAN SiS_IsSR13_CR30(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +/* TW end */ + +extern void SiS_SetReg1(USHORT, USHORT, USHORT); +extern void SiS_SetReg3(USHORT, USHORT); +extern UCHAR SiS_GetReg1(USHORT, USHORT); +extern UCHAR SiS_GetReg2(USHORT); +extern BOOLEAN SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex); +extern BOOLEAN SiS_GetRatePtr(SiS_Private *SiS_Pr, ULONG, USHORT); +extern void SiS_SetReg4(USHORT, ULONG); +extern ULONG SiS_GetReg3(USHORT); +extern void SiS_SetReg5(USHORT, USHORT); +extern USHORT SiS_GetReg4(USHORT); +extern void SiS_DisplayOff(SiS_Private *SiS_Pr); +extern void SiS_DisplayOn(SiS_Private *SiS_Pr); +extern UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex); +extern BOOLEAN SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *ResInfo,USHORT *DisplayType); +extern BOOLEAN SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *ResInfo,USHORT *DisplayType); +extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO, UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex); +#ifdef SIS315H +extern UCHAR SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension); +#endif + +#ifdef LINUX_XF86 +/* DDC functions */ +USHORT SiS_InitDDCRegs(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, USHORT DDCdatatype); +USHORT SiS_WriteDABDDC(SiS_Private *SiS_Pr); +USHORT SiS_PrepareReadDDC(SiS_Private *SiS_Pr); +USHORT SiS_PrepareDDC(SiS_Private *SiS_Pr); +void SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno); +USHORT SiS_DoProbeDDC(SiS_Private *SiS_Pr); +USHORT SiS_ProbeDDC(SiS_Private *SiS_Pr); +USHORT SiS_ReadDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT DDCdatatype, unsigned char *buffer); +USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, + USHORT DDCdatatype, unsigned char *buffer); +#endif + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h:1.9 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h Mon Feb 3 21:44:28 2003 @@ -0,0 +1,434 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.9 2003/02/04 02:44:28 dawes Exp $ */ + + +#ifndef _INITDEF_ +#define _INITDEF_ + +#define SiS300 0x0300 +#define SiS540 0x5300 +#define SiS630 0x6300 +#define SiS730 0x6300 + +/* SiS_VBType */ +#define VB_SIS301 0x0001 +#define VB_SIS301B 0x0002 +#define VB_SIS302B 0x0004 +#define VB_SIS30xLV 0x0008 +#define VB_SIS30xNEW 0x0010 +#define VB_NoLCD 0x8000 +#define VB_SIS301BLV302BLV (VB_SIS301B|VB_SIS302B|VB_SIS30xLV|VB_SIS30xNEW) +#define VB_SIS301B302B (VB_SIS301B|VB_SIS302B) +#define VB_SIS301LV302LV (VB_SIS30xLV|VB_SIS30xNEW) + +#define IS_SIS650740 ((HwDeviceExtension->jChipType >= SIS_650) && (HwDeviceExtension->jChipType < SIS_330)) + +#define CRT1Len 17 +#define LVDSCRT1Len 15 +#define CHTVRegDataLen 5 + +/* SiS_ModeType */ +#define ModeText 0x00 +#define ModeCGA 0x01 +#define ModeEGA 0x02 +#define ModeVGA 0x03 +#define Mode15Bpp 0x04 +#define Mode16Bpp 0x05 +#define Mode24Bpp 0x06 +#define Mode32Bpp 0x07 + +#define ModeInfoFlag 0x07 +#define IsTextMode 0x07 + +#define DACInfoFlag 0x0018 +#define MemoryInfoFlag 0x01E0 +#define MemorySizeShift 5 + +/* modeflag */ +#define Charx8Dot 0x0200 +#define LineCompareOff 0x0400 +#define CRT2Mode 0x0800 +#define HalfDCLK 0x1000 +#define NoSupportSimuTV 0x2000 +#define DoubleScanMode 0x8000 + +/* Infoflag */ +#define SupportAllCRT2 0x0078 +#define SupportTV 0x0008 +#define SupportHiVisionTV 0x0010 +#define SupportLCD 0x0020 +#define SupportRAMDAC2 0x0040 +#define NoSupportTV 0x0070 +#define NoSupportHiVisionTV 0x0060 +#define NoSupportLCD 0x0058 +#define SupportCHTV 0x0800 +#define SupportTV1024 0x0800 +#define InterlaceMode 0x0080 +#define SyncPP 0x0000 +#define SyncPN 0x4000 +#define SyncNP 0x8000 +#define SyncNN 0xc000 +#define ECLKindex0 0x0000 +#define ECLKindex1 0x0100 +#define ECLKindex2 0x0200 +#define ECLKindex3 0x0300 +#define ECLKindex4 0x0400 + +/* VBInfo */ +#define SetSimuScanMode 0x0001 /* CR 30 */ +#define SwitchToCRT2 0x0002 +#define SetCRT2ToAVIDEO 0x0004 +#define SetCRT2ToSVIDEO 0x0008 +#define SetCRT2ToSCART 0x0010 +#define SetCRT2ToLCD 0x0020 +#define SetCRT2ToRAMDAC 0x0040 +#define SetCRT2ToHiVisionTV 0x0080 +#define SetCRT2ToTV 0x009C /* alias */ +#define SetNTSCTV 0x0000 /* CR 31 */ +#define SetPALTV 0x0100 +#define SetInSlaveMode 0x0200 +#define SetNotSimuMode 0x0400 +#define SetNotSimuTVMode 0x0400 +#define SetDispDevSwitch 0x0800 +#define LoadDACFlag 0x1000 +#define SetCHTVOverScan 0x1000 /* TW: Re-defined (from 0x8000) */ +#define DisableCRT2Display 0x2000 +#define CRT2DisplayFlag 0x2000 +#define DriverMode 0x4000 +#define HotKeySwitch 0x8000 /* TW: ? */ +#define SetCRT2ToLCDA 0x8000 + +#define PanelRGB18Bit 0x0100 +#define PanelRGB24Bit 0x0000 + +#define TVOverScan 0x10 /* Bit in CR35 (300 series only) */ +#define TVOverScanShift 4 +#define ClearBufferFlag 0x20 + +/* CR32 (Newer 630, and 310/325 series) + + [0] VB connected with CVBS + [1] VB connected with SVHS + [2] VB connected with SCART + [3] VB connected with LCD + [4] VB connected with CRT2 (secondary VGA) + [5] CRT1 monitor is connected + [6] VB connected with Hi-Vision TV + [7] VB connected with DVI combo connector + + + CR37 + + [0] Set 24/18 bit (0/1) RGB to LVDS/TMDS transmitter (set by BIOS) + [3:1] External chip + 300 series: + 001 SiS301 (never seen) + 010 LVDS + 011 LVDS + Tumpion Zurac + 100 LVDS + Chrontel 7005 + 110 Chrontel 7005 + 310/325 series + 001 SiS30x (never seen) + 010 LVDS + 011 LVDS + Chrontel 7019 + All other combinations reserved + [4] LVDS: Expanding(0)/Non-expanding(1) LCD display + 30x: SiS30x(0)/LCD monitor(1) scaling display + [5] LCD polarity select + 0: VESA DMT Standard + 1: EDID 2.x defined + [6] LCD horizontal polarity select + 0: High active + 1: Low active + [7] LCD vertical polarity select + 0: High active + 1: Low active +*/ + +/* CR38 (310/325 series) */ +#define EnableDualEdge 0x01 +#define SetToLCDA 0x02 /* LCD channel A (302B/LV and 650+LVDS only) */ +#define EnableSiSHiVision 0x04 /* HiVision (HDTV) on SiS bridge */ +#define EnableLVDSScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */ +#define EnableLVDSHiVision 0x08 /* YPbPr color format (480i HDTV); only on 650/Ch7019 systems */ +#define SiSHiVision1 0x10 /* See SetHiVision() */ +#define SiSHiVision2 0x20 +#define EnablePALM 0x40 /* 1 = Set PALM */ +#define EnablePALN 0x80 /* 1 = Set PALN */ + +#define SetSCARTOutput 0x01 +#define BoardTVType 0x02 + +#define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */ + +/* CR39 (650) */ +#define LCDPass1_1 0x01 /* LVDS only; set by driver to pass 1:1 data to LVDS output */ +#define SomeThingTV_LVNEW 0x04 /* 30xNEW only; set by mode switching function */ + + +/* CR79 (310/325 series only) + [3-0] Notify driver + 0001 Mode Switch event (set by BIOS) + 0010 Epansion On/Off event + 0011 TV UnderScan/OverScan event + 0100 Set Brightness event + 0101 Set Contrast event + 0110 Set Mute event + 0111 Set Volume Up/Down event + [4] Enable Backlight Control by BIOS/driver (set by driver) + [5] PAL/NTSC (set by BIOS) + [6] Expansion On/Off (set by BIOS; copied to CR32[4]) + [7] TV UnderScan/OverScan (set by BIOS) +*/ + +/* SetFlag */ +#define ProgrammingCRT2 0x01 +#define TVSimuMode 0x02 +#define RPLLDIV2XO 0x04 +#define LCDVESATiming 0x08 +#define EnableLVDSDDA 0x10 +#define SetDispDevSwitchFlag 0x20 +#define CheckWinDos 0x40 +#define SetJDOSMode 0x80 +#define CRT2IsVGA 0x80 /* TW: Not sure about this name... */ + +/* LCDResInfo */ +#define Panel300_800x600 0x01 /* CR36 */ +#define Panel300_1024x768 0x02 +#define Panel300_1280x1024 0x03 +#define Panel300_1280x960 0x04 +#define Panel300_640x480 0x05 +#define Panel300_1024x600 0x06 +#define Panel300_1152x768 0x07 +#define Panel300_320x480 0x08 /* fstn - TW: This is fake, can be any */ + +#define Panel310_800x600 0x01 +#define Panel310_1024x768 0x02 +#define Panel310_1280x1024 0x03 +#define Panel310_640x480 0x04 +#define Panel310_1024x600 0x05 +#define Panel310_1152x864 0x06 +#define Panel310_1280x960 0x07 +#define Panel310_1152x768 0x08 /* LVDS only */ +#define Panel310_1400x1050 0x09 +#define Panel310_1280x768 0x0a /* LVDS only */ +#define Panel310_1600x1200 0x0b +#define Panel310_320x480 0x0c /* fstn - TW: This is fake, can be any */ + +#define Panel_800x600 0x01 /* Unified values */ +#define Panel_1024x768 0x02 +#define Panel_1280x1024 0x03 +#define Panel_640x480 0x04 +#define Panel_1024x600 0x05 +#define Panel_1152x864 0x06 +#define Panel_1280x960 0x07 +#define Panel_1152x768 0x08 /* LVDS only */ +#define Panel_1400x1050 0x09 +#define Panel_1280x768 0x0a /* LVDS only */ +#define Panel_1600x1200 0x0b +#define Panel_320x480 0x0c /* fstn - TW: This is fake, can be any */ + +#define ExtChipType 0x0e +#define ExtChip301 0x02 +#define ExtChipLVDS 0x04 +#define ExtChipTrumpion 0x06 +#define ExtChipCH7005 0x08 +#define ExtChipMitacTV 0x0a /* TW: Incorrect, 0x0a = Chrontel 7005 only */ + +#define IsM650 0x80 /* TW: CR5F */ + +/* LCDInfo */ +#define LCDRGB18Bit 0x01 +#define LCDNonExpanding 0x10 +#define LCDNonExpandingShift 4 +#define LCDSync 0x20 +#define LCDPass11 0x100 +#define LCDSyncBit 0xe0 +#define LCDSyncShift 6 + +#define LCDDataLen 8 +#define HiTVDataLen 12 +#define TVDataLen 16 +#define SetPALTV 0x0100 +#define HalfDCLK 0x1000 /* modeflag */ +#define NTSCHT 1716 +#define NTSC2HT 1920 +#define NTSCVT 525 +#define PALHT 1728 +#define PALVT 625 +#define StHiTVHT 892 +#define StHiTVVT 1126 +#define StHiTextTVHT 1000 +#define StHiTextTVVT 1126 +#define ExtHiTVHT 2100 +#define ExtHiTVVT 1125 + +#define VCLKStartFreq 25 +#define SoftDramType 0x80 + +#define VCLK40 0x04 /* Index in VCLKData array */ +#define VCLK65 0x09 /* Index in VCLKData array */ +#define VCLK108_2 0x14 /* Index in VCLKData array */ +#define TVVCLKDIV2 0x21 /* Indices in (VB)VCLKData arrays */ +#define TVVCLK 0x22 +#define HiTVVCLKDIV2 0x23 +#define HiTVVCLK 0x24 +#define HiTVSimuVCLK 0x25 +#define HiTVTextVCLK 0x26 + +#define LoadDACFlag 0x1000 +#define AfterLockCRT2 0x4000 +#define SetCRT2ToAVIDEO 0x0004 +#define SetCRT2ToSCART 0x0010 +#define Ext2StructSize 5 + +#define SetSCARTOutput 0x01 +#define AVIDEOSense 0x01 +#define SVIDEOSense 0x02 +#define SCARTSense 0x04 +#define LCDSense 0x08 +#define Monitor1Sense 0x20 +#define Monitor2Sense 0x10 +#define HiTVSense 0x40 +#define BoardTVType 0x02 +#define HotPlugFunction 0x08 +#define StStructSize 0x06 + +#define SIS_CRT2_PORT_04 0x04 - 0x30 +#define SIS_CRT2_PORT_10 0x10 - 0x30 +#define SIS_CRT2_PORT_12 0x12 - 0x30 +#define SIS_CRT2_PORT_14 0x14 - 0x30 + +#define ADR_CRT2PtrData 0x20E +#define offset_Zurac 0x210 /* TW: Trumpion Zurac data pointer */ +#define ADR_LVDSDesPtrData 0x212 +#define ADR_LVDSCRT1DataPtr 0x214 +#define ADR_CHTVVCLKPtr 0x216 +#define ADR_CHTVRegDataPtr 0x218 + +#define LVDSDataLen 6 +#define EnableLVDSDDA 0x10 +#define LVDSDesDataLen 3 +#define ActiveNonExpanding 0x40 +#define ActiveNonExpandingShift 6 +#define ActivePAL 0x20 +#define ActivePALShift 5 +#define ModeSwitchStatus 0x0F +#define SoftTVType 0x40 +#define SoftSettingAddr 0x52 +#define ModeSettingAddr 0x53 + +#define SelectCRT1Rate 0x4 + +#define _PanelType00 0x00 +#define _PanelType01 0x08 +#define _PanelType02 0x10 +#define _PanelType03 0x18 +#define _PanelType04 0x20 +#define _PanelType05 0x28 +#define _PanelType06 0x30 +#define _PanelType07 0x38 +#define _PanelType08 0x40 +#define _PanelType09 0x48 +#define _PanelType0A 0x50 +#define _PanelType0B 0x58 +#define _PanelType0C 0x60 +#define _PanelType0D 0x68 +#define _PanelType0E 0x70 +#define _PanelType0F 0x78 + +#define PRIMARY_VGA 0 /* 1: SiS is primary vga 0:SiS is secondary vga */ +#define BIOSIDCodeAddr 0x235 /* TW: Offsets to ptrs in BIOS image */ +#define OEMUtilIDCodeAddr 0x237 +#define VBModeIDTableAddr 0x239 +#define OEMTVPtrAddr 0x241 +#define PhaseTableAddr 0x243 +#define NTSCFilterTableAddr 0x245 +#define PALFilterTableAddr 0x247 +#define OEMLCDPtr_1Addr 0x249 +#define OEMLCDPtr_2Addr 0x24B +#define LCDHPosTable_1Addr 0x24D +#define LCDHPosTable_2Addr 0x24F +#define LCDVPosTable_1Addr 0x251 +#define LCDVPosTable_2Addr 0x253 +#define OEMLCDPIDTableAddr 0x255 + +#define VBModeStructSize 5 +#define PhaseTableSize 4 +#define FilterTableSize 4 +#define LCDHPosTableSize 7 +#define LCDVPosTableSize 5 +#define OEMLVDSPIDTableSize 4 +#define LVDSHPosTableSize 4 +#define LVDSVPosTableSize 6 + +#define VB_ModeID 0 +#define VB_TVTableIndex 1 +#define VB_LCDTableIndex 2 +#define VB_LCDHIndex 3 +#define VB_LCDVIndex 4 + +#define OEMLCDEnable 0x0001 +#define OEMLCDDelayEnable 0x0002 +#define OEMLCDPOSEnable 0x0004 +#define OEMTVEnable 0x0100 +#define OEMTVDelayEnable 0x0200 +#define OEMTVFlickerEnable 0x0400 +#define OEMTVPhaseEnable 0x0800 +#define OEMTVFilterEnable 0x1000 + +#define OEMLCDPanelIDSupport 0x0080 + +/* + ============================================================= + for 310/325 series + ============================================================= +*/ +#define SoftDRAMType 0x80 +#define SoftSetting_OFFSET 0x52 +#define SR07_OFFSET 0x7C +#define SR15_OFFSET 0x7D +#define SR16_OFFSET 0x81 +#define SR17_OFFSET 0x85 +#define SR19_OFFSET 0x8D +#define SR1F_OFFSET 0x99 +#define SR21_OFFSET 0x9A +#define SR22_OFFSET 0x9B +#define SR23_OFFSET 0x9C +#define SR24_OFFSET 0x9D +#define SR25_OFFSET 0x9E +#define SR31_OFFSET 0x9F +#define SR32_OFFSET 0xA0 +#define SR33_OFFSET 0xA1 + +#define CR40_OFFSET 0xA2 +#define SR25_1_OFFSET 0xF6 +#define CR49_OFFSET 0xF7 + +#define VB310Data_1_2_Offset 0xB6 +#define VB310Data_4_D_Offset 0xB7 +#define VB310Data_4_E_Offset 0xB8 +#define VB310Data_4_10_Offset 0xBB + +#define RGBSenseDataOffset 0xBD +#define YCSenseDataOffset 0xBF +#define VideoSenseDataOffset 0xC1 +#define OutputSelectOffset 0xF3 + +#define ECLK_MCLK_DISTANCE 0x14 +#define VBIOSTablePointerStart 0x100 +#define StandTablePtrOffset VBIOSTablePointerStart+0x02 +#define EModeIDTablePtrOffset VBIOSTablePointerStart+0x04 +#define CRT1TablePtrOffset VBIOSTablePointerStart+0x06 +#define ScreenOffsetPtrOffset VBIOSTablePointerStart+0x08 +#define VCLKDataPtrOffset VBIOSTablePointerStart+0x0A +#define MCLKDataPtrOffset VBIOSTablePointerStart+0x0E +#define CRT2PtrDataPtrOffset VBIOSTablePointerStart+0x10 +#define TVAntiFlickPtrOffset VBIOSTablePointerStart+0x12 +#define TVDelayPtr1Offset VBIOSTablePointerStart+0x14 +#define TVPhaseIncrPtr1Offset VBIOSTablePointerStart+0x16 +#define TVYFilterPtr1Offset VBIOSTablePointerStart+0x18 +#define LCDDelayPtr1Offset VBIOSTablePointerStart+0x20 +#define TVEdgePtr1Offset VBIOSTablePointerStart+0x24 +#define CRT2Delay1Offset VBIOSTablePointerStart+0x28 + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h:1.3 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,1005 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h,v 1.3 2003/02/10 01:14:16 tsi Exp $ */ + +/* OEM Data for 300 series */ + +const UCHAR SiS300_OEMTVDelay301[8][4] = +{ + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x2c,0x2c,0x2c,0x2c}, + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x20,0x20,0x20,0x20} +}; + +const UCHAR SiS300_OEMTVDelayLVDS[8][4] = +{ + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20} +}; + +const UCHAR SiS300_OEMTVFlicker[8][4] = +{ + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00} +}; + +#if 0 /* TW: Not used */ +const UCHAR SiS300_OEMLCDDelay1[12][4]={ + {0x2c,0x2c,0x2c,0x2c}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x2c,0x2c,0x2c,0x2c}, + {0x2c,0x2c,0x2c,0x2c}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x24,0x24,0x24,0x24}, + {0x24,0x24,0x24,0x24}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x24,0x24,0x24,0x24} +}; +#endif + +/* TW: From 630/301B BIOS */ +const UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */ +{ + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20} +}; + +/* TW: From 300/301LV BIOS */ +const UCHAR SiS300_OEMLCDDelay4[12][4] = +{ + {0x2c,0x2c,0x2c,0x2c}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x2c,0x2c,0x2c,0x2c}, + {0x2c,0x2c,0x2c,0x2c}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x24,0x24,0x24,0x24}, + {0x24,0x24,0x24,0x24}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x24,0x24,0x24,0x24} +}; + +/* TW: From 300/301LV BIOS */ +const UCHAR SiS300_OEMLCDDelay5[32][4] = +{ + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, +}; + +/* TW: Added for LVDS */ +const UCHAR SiS300_OEMLCDDelay3[64][4] = { /* For LVDS */ + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20} +}; + +const UCHAR SiS300_Phase1[8][6][4] = +{ + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + } +}; + + +const UCHAR SiS300_Phase2[8][6][4] = +{ + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + } +}; + +const UCHAR SiS300_Filter1[10][16][4] = +{ + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18} + }, +}; + +const UCHAR SiS300_Filter2[10][9][7] = +{ + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + } +}; + +const UCHAR SiS300_LCDHData[24][11][5] = { + { + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x65,0xef,0x83,0x5c,0x00}, + {0x65,0xef,0x83,0x5c,0x00}, + {0x8a,0x14,0x00,0x80,0x00}, + {0x8a,0x14,0x00,0x80,0x00} + }, + { + {0x4e,0x18,0x90,0x38,0x00}, + {0x4e,0x18,0x90,0x38,0x00}, + {0x8e,0x18,0x28,0x78,0x00}, + {0x8e,0x18,0x28,0x78,0x00}, + {0x8e,0x18,0x28,0x78,0x00}, + {0x4e,0x18,0x90,0x38,0x00}, + {0x4e,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9a,0x56,0x00}, + {0x67,0x11,0x9a,0x56,0x00}, + {0x8a,0x14,0x00,0x80,0x00}, + {0x8a,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x65,0xef,0x83,0x5c,0x00}, + {0x65,0xef,0x83,0x5c,0x00}, + {0x8a,0x14,0x00,0x80,0x00}, + {0x8a,0x14,0x00,0x80,0x00} + }, + { + {0x4e,0x18,0x90,0x38,0x00}, + {0x4e,0x18,0x90,0x38,0x00}, + {0x8e,0x18,0x28,0x78,0x00}, + {0x8e,0x18,0x28,0x78,0x00}, + {0x8e,0x18,0x28,0x78,0x00}, + {0x4e,0x18,0x90,0x38,0x00}, + {0x4e,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9a,0x56,0x00}, + {0x67,0x11,0x9a,0x56,0x00}, + {0x8a,0x14,0x00,0x80,0x00}, + {0x8a,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x67,0x91,0x84,0x5e,0x00}, + {0x65,0xef,0x83,0x5c,0x00}, + {0x65,0xef,0x83,0x5c,0x00}, + {0x8a,0x14,0x00,0x80,0x00}, + {0x8a,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x67,0x91,0x84,0x5E,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x65,0xEF,0x83,0x5C,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + }, + { + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x8E,0x18,0x28,0x78,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x4E,0x18,0x90,0x38,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x67,0x11,0x9A,0x56,0x00}, + {0x8A,0x14,0x00,0x80,0x00}, + {0x8A,0x14,0x00,0x80,0x00} + } +}; + +#if 0 +const UCHAR SiS300_LCDVData[24][11][6] = { + { + { + }, +}; +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h:1.4 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,377 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.4 2003/02/10 01:14:16 tsi Exp $ */ + +/* OEM Data for 310/325 series */ + +const UCHAR SiS310_CRT2DelayCompensation1 = 0x04; /* 301 */ + +const UCHAR SiS310_CRT2DelayCompensation2 = 0x00; /* 301B */ + +const UCHAR SiS310_CRT2DelayCompensation3 = 0x00; /* LVDS */ + +const UCHAR SiS310_LCDDelayCompensation1[] = /* 301 */ +{ + 0x00,0x00,0x00, /* 800x600 */ + 0x0b,0x0b,0x0b, /* 1024x768 */ + 0x08,0x08,0x08, /* 1280x1024 */ + 0x00,0x00,0x00, /* 640x480 (unknown) */ + 0x00,0x00,0x00, /* 1024x600 (unknown) */ + 0x00,0x00,0x00, /* 1152x864 (unknown) */ + 0x08,0x08,0x08, /* 1280x960 (guessed) */ + 0x00,0x00,0x00, /* 1152x768 (unknown) */ + 0x08,0x08,0x08, /* 1400x1050 */ + 0x08,0x08,0x08, /* 1280x768 (guessed) */ + 0x00,0x00,0x00, /* 1600x1200 */ + 0x00,0x00,0x00, /* 320x480 (unknown) */ + 0x00,0x00,0x00, + 0x00,0x00,0x00, + 0x00,0x00,0x00 +}; + +UCHAR SiS310_LCDDelayCompensation2[] = /* 30xB,LV,LVX */ +{ + 0x01,0x01,0x01, /* 800x600 */ + 0x01,0x01,0x01, /* 1024x768 */ + 0x01,0x01,0x01, /* 1280x1024 */ + 0x01,0x01,0x01, /* 640x480 (unknown) */ + 0x01,0x01,0x01, /* 1024x600 (unknown) */ + 0x01,0x01,0x01, /* 1152x864 (unknown) */ + 0x01,0x01,0x01, /* 1280x960 (guessed) */ + 0x01,0x01,0x01, /* 1152x768 (unknown) */ + 0x01,0x01,0x01, /* 1400x1050 */ + 0x01,0x01,0x01, /* 1280x768 (guessed) */ + 0x01,0x01,0x01, /* 1600x1200 */ + 0x02,0x02,0x02, + 0x02,0x02,0x02, + 0x02,0x02,0x02, + 0x02,0x02,0x02 +}; + +const UCHAR SiS310_LCDDelayCompensation3[] = /* LVDS */ +{ + 0x00,0x00,0x00, /* 800x600 */ + 0x00,0x00,0x00, /* 1024x768 */ + 0x00,0x00,0x00, /* 1280x1024 */ + 0x00,0x00,0x00, /* 640x480 (unknown) */ + 0x00,0x00,0x00, /* 1024x600 (unknown) */ + 0x00,0x00,0x00, /* 1152x864 (unknown) */ + 0x00,0x00,0x00, /* 1280x960 (guessed) */ + 0x00,0x00,0x00, /* 1152x768 (unknown) */ + 0x00,0x00,0x00, /* 1400x1050 */ + 0x00,0x00,0x00, /* 1280x768 (guessed) */ + 0x00,0x00,0x00, /* 1600x1200 */ + 0x00,0x00,0x00, + 0x00,0x00,0x00, + 0x00,0x00,0x00, + 0x00,0x00,0x00 +}; + +const UCHAR SiS310_LCDDelayCompensation4[] = /* 650 */ +{ + 0x01,0x01,0x01, /* 800x600 (guessed)*/ + 0x01,0x01,0x01, /* 1024x768 */ + 0x01,0x01,0x01, /* 1280x1024 */ + 0x01,0x01,0x01, /* 640x480 (unknown) */ + 0x01,0x01,0x01, /* 1024x600 (unknown) */ + 0x01,0x01,0x01, /* 1152x864 (unknown) */ + 0x01,0x01,0x01, /* 1280x960 (guessed) */ + 0x01,0x01,0x01, /* 1152x768 (unknown) */ + 0x01,0x01,0x01, /* 1400x1050 */ + 0x01,0x01,0x01, /* 1280x768 (guessed) */ + 0x01,0x01,0x01, /* 1600x1200 */ + 0x01,0x01,0x01, + 0x01,0x01,0x01, + 0x01,0x01,0x01, + 0x01,0x01,0x01 +}; + +const UCHAR SiS310_LCDDelayCompensation5[] = /* 650 LVX */ +{ + 0x01,0x01,0x01, /* 800x600 (guessed) */ + 0x01,0x01,0x01, /* 1024x768 */ + 0x01,0x01,0x01, /* 1280x1024 */ + 0x01,0x01,0x01, /* 640x480 (unknown) */ + 0x01,0x01,0x01, /* 1024x600 (unknown) */ + 0x01,0x01,0x01, /* 1152x864 (unknown) */ + 0x01,0x01,0x01, /* 1280x960 (guessed) */ + 0x01,0x01,0x01, /* 1152x768 (unknown) */ + 0x01,0x01,0x01, /* 1400x1050 */ + 0x01,0x01,0x01, /* 1280x768 (guessed) */ + 0x01,0x01,0x01, /* 1600x1200 */ + 0x01,0x01,0x01, + 0x01,0x01,0x01, + 0x01,0x01,0x01, + 0x01,0x01,0x01 +}; + +const UCHAR SiS310_LCDDelayCompensation6[] = /* M650/651 */ +{ + 0x33,0x33,0x33, /* 800x600 (guessed) */ + 0x33,0x33,0x33, /* 1024x768 */ + 0x33,0x33,0x33, /* 1280x1024 */ + 0x33,0x33,0x33, /* 640x480 (unknown) */ + 0x33,0x33,0x33, /* 1024x600 (unknown) */ + 0x33,0x33,0x33, /* 1152x864 (unknown) */ + 0x33,0x33,0x33, /* 1280x960 (guessed) */ + 0x33,0x33,0x33, /* 1152x768 (unknown) */ + 0x33,0x33,0x33, /* 1400x1050 */ + 0x33,0x33,0x33, /* 1280x768 (guessed) */ + 0x33,0x33,0x33, /* 1600x1200 */ + 0x33,0x33,0x33, + 0x33,0x33,0x33, + 0x33,0x33,0x33, + 0x33,0x33,0x33 +}; + +const UCHAR SiS310_LCDDelayCompensation7[] = /* M650/651 301LVX */ +{ + 0x33,0x33,0x33, /* 800x600 (guessed) */ + 0x33,0x33,0x33, /* 1024x768 */ + 0x33,0x33,0x33, /* 1280x1024 */ + 0x33,0x33,0x33, /* 640x480 (unknown) */ + 0x33,0x33,0x33, /* 1024x600 (unknown) */ + 0x33,0x33,0x33, /* 1152x864 (unknown) */ + 0x33,0x33,0x33, /* 1280x960 (guessed) */ + 0x33,0x33,0x33, /* 1152x768 (unknown) */ + 0x33,0x33,0x33, /* 1400x1050 */ + 0x33,0x33,0x33, /* 1280x768 (guessed) */ + 0x33,0x33,0x33, /* 1600x1200 */ + 0x33,0x33,0x33, + 0x33,0x33,0x33, + 0x33,0x33,0x33, + 0x33,0x33,0x33 +}; + +const UCHAR SiS310_TVDelayCompensation1[] = /* 301 */ +{ + 0x02,0x02, /* NTSC Enhanced, Standard */ + 0x02,0x02, /* PAL */ + 0x08,0x0b /* HiVision */ +}; + +const UCHAR SiS310_TVDelayCompensation2[] = /* 301B;LV */ +{ + 0x03,0x03, + 0x03,0x03, + 0x03,0x03 +}; + +const UCHAR SiS310_TVDelayCompensation3[] = /* LVDS */ +{ + 0x0a,0x0a, + 0x0a,0x0a, + 0x0a,0x0a +}; + +const UCHAR SiS310_TVDelayCompensation4[] = /* 650 */ +{ + 0x03,0x03, + 0x03,0x03, + 0x03,0x03 +}; + +const UCHAR SiS310_TVDelayCompensation5[] = /* 650 LVX */ +{ + 0x03,0x03, + 0x03,0x03, + 0x03,0x03 +}; + +const UCHAR SiS310_TVDelayCompensation6[] = /* M650, 651 */ +{ + 0x33,0x33, + 0x33,0x33, + 0x33,0x33 +}; + +const UCHAR SiS310_TVDelayCompensation7[] = /* M650, 651, LVX */ +{ + 0x33,0x33, + 0x33,0x33, + 0x33,0x33 +}; + +const UCHAR SiS310_TVAntiFlick1[3][2] = +{ + {0x4,0x0}, + {0x4,0x8}, + {0x0,0x0} +}; + +const UCHAR SiS310_TVEdge1[3][2] = +{ + {0x0,0x4}, + {0x0,0x4}, + {0x0,0x0} +}; + +const UCHAR SiS310_TVYFilter1[3][8][4] = +{ + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xf1,0x04,0x1f,0x18}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xee,0x0c,0x22,0x08}, + {0xeb,0x15,0x25,0xf6} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0xfc,0xfb,0x14,0x2a} + }, + { + {0x00,0x00,0x00,0x00}, + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xee,0x0c,0x22,0x08} + } +}; + +const UCHAR SiS310_TVYFilter2[3][9][7] = +{ + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22} + } +}; + +const UCHAR SiS310_PALMFilter[16][4] = +{ + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18} +}; + +const UCHAR SiS310_PALNFilter[16][4] = +{ + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18} +}; + + +const UCHAR SiS310_PALMFilter2[9][7] = +{ + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} +}; + +const UCHAR SiS310_PALNFilter2[9][7] = +{ + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} +}; + +const UCHAR SiS310_TVPhaseIncr1[3][2][4] = +{ + { + {0x21,0xed,0xba,0x08}, + {0x21,0xed,0xba,0x08} + }, + { + {0x2a,0x05,0xe3,0x00}, + {0x2a,0x05,0xe3,0x00} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00} + } +}; + +const UCHAR SiS310_TVPhaseIncr2[3][2][4] = +{ + { + {0x21,0xf0,0x7b,0xd6}, /* 1.10.7w; 1.10.6s: {0x1e,0x8b,0xda,0xa7}, old: {0x21,0xF1,0x37,0x56} */ + {0x21,0xf0,0x7b,0xd6} /* 1.10.7w; 1.10.6s: {0x1e,0x8b,0xda,0xa7} old: {0x21,0xF1,0x37,0x56} */ + }, + { + {0x2a,0x0a,0x41,0xe9}, /* 1.10.7w, 1.10.6s. old: {0x2a,0x09,0x86,0xe9}, */ + {0x2a,0x0a,0x41,0xe9} /* 1.10.7w, 1.10.6s. old: {0x2a,0x09,0x86,0xe9} */ + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00} + } +}; + + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h:1.2 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,169 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h,v 1.2 2003/02/10 01:14:16 tsi Exp $ */ + +/* OS depending defines */ + +/* The choices are: */ +/* #define WINCE_HEADER */ /* Incomplete! */ +/* #define WIN2000 */ /* Incomplete! */ +/* #define TC */ /* Incomplete! */ +/* #define LINUX_KERNEL */ /* Kernel framebuffer */ +#define LINUX_XF86 /* XFree86 */ + +/**********************************************************************/ +#ifdef LINUX_KERNEL /* ----------------------------*/ + +#include <linux/config.h> +#ifdef CONFIG_FB_SIS_300 +#define SIS300 +#endif + +#ifdef CONFIG_FB_SIS_315 +#define SIS315H +#endif + +#else /* if not LINUX_KERNEL --------------------- */ +/* #define SIS300*/ +#define SIS315H + +#endif /* if LINUX_KERNEL ------------------------ */ + +#ifdef LINUX_XF86 /* Linux Xfree86 ---------------- */ + +#define SIS300 +/* #define SIS315H */ /* TW: done above */ +#endif + +/**********************************************************************/ +#ifdef TC +#endif +#ifdef WIN2000 +#endif +#ifdef WINCE_HEADER +#endif +#ifdef LINUX_XF86 +#endif +#ifdef LINUX_KERNEL +#endif +/**********************************************************************/ +#ifdef TC +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize); +#endif +#ifdef WIN2000 +#define SiS_SetMemory(MemoryAddress,MemorySize,value) MemFill((PVOID) MemoryAddress,(ULONG) MemorySize,(UCHAR) value); +#endif +#ifdef WINCE_HEADER +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize); +#endif +#ifdef LINUX_XF86 +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) +#endif +#ifdef LINUX_KERNEL +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) +#endif +/**********************************************************************/ + +/**********************************************************************/ + +#ifdef TC +#define SiS_MemoryCopy(Destination,Soruce,Length) memmove(Destination, Soruce, Length); +#endif +#ifdef WIN2000 +#define SiS_MemoryCopy(Destination,Soruce,Length) /*VideoPortMoveMemory((PUCHAR)Destination , Soruce,length);*/ +#endif +#ifdef WINCE_HEADER +#define SiS_MemoryCopy(Destination,Soruce,Length) memmove(Destination, Soruce, Length); +#endif +#ifdef LINUX_XF86 +#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length) +#endif +#ifdef LINUX_KERNEL +#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length) +#endif + +/**********************************************************************/ + +#ifdef OutPortByte +#undef OutPortByte +#endif /* OutPortByte */ + +#ifdef OutPortWord +#undef OutPortWord +#endif /* OutPortWord */ + +#ifdef OutPortLong +#undef OutPortLong +#endif /* OutPortLong */ + +#ifdef InPortByte +#undef InPortByte +#endif /* InPortByte */ + +#ifdef InPortWord +#undef InPortWord +#endif /* InPortWord */ + +#ifdef InPortLong +#undef InPortLong +#endif /* InPortLong */ + +/**********************************************************************/ +/* TC */ +/**********************************************************************/ + +#ifdef TC +#define OutPortByte(p,v) outp((unsigned short)(p),(unsigned char)(v)) +#define OutPortWord(p,v) outp((unsigned short)(p),(unsigned short)(v)) +#define OutPortLong(p,v) outp((unsigned short)(p),(unsigned long)(v)) +#define InPortByte(p) inp((unsigned short)(p)) +#define InPortWord(p) inp((unsigned short)(p)) +#define InPortLong(p) ((inp((unsigned short)(p+2))<<16) | inp((unsigned short)(p))) +#endif + +/**********************************************************************/ +/* LINUX XF86 */ +/**********************************************************************/ + +#ifdef LINUX_XF86 +#define OutPortByte(p,v) outb((CARD16)(p),(CARD8)(v)) +#define OutPortWord(p,v) outw((CARD16)(p),(CARD16)(v)) +#define OutPortLong(p,v) outl((CARD16)(p),(CARD32)(v)) +#define InPortByte(p) inb((CARD16)(p)) +#define InPortWord(p) inw((CARD16)(p)) +#define InPortLong(p) inl((CARD16)(p)) +#endif + +#ifdef LINUX_KERNEL +#define OutPortByte(p,v) outb((u8)(v),(u16)(p)) +#define OutPortWord(p,v) outw((u16)(v),(u16)(p)) +#define OutPortLong(p,v) outl((u32)(v),(u16)(p)) +#define InPortByte(p) inb((u16)(p)) +#define InPortWord(p) inw((u16)(p)) +#define InPortLong(p) inl((u16)(p)) +#endif + +/**********************************************************************/ +/* WIN 2000 */ +/**********************************************************************/ + +#ifdef WIN2000 +#define OutPortByte(p,v) VideoPortWritePortUchar ((PUCHAR) (p), (UCHAR) (v)) +#define OutPortWord(p,v) VideoPortWritePortUshort((PUSHORT) (p), (USHORT) (v)) +#define OutPortLong(p,v) VideoPortWritePortUlong ((PULONG) (p), (ULONG) (v)) +#define InPortByte(p) VideoPortReadPortUchar ((PUCHAR) (p)) +#define InPortWord(p) VideoPortReadPortUshort ((PUSHORT) (p)) +#define InPortLong(p) VideoPortReadPortUlong ((PULONG) (p)) +#endif + + +/**********************************************************************/ +/* WIN CE */ +/**********************************************************************/ + +#ifdef WINCE_HEADER +#define OutPortByte(p,v) WRITE_PORT_UCHAR ((PUCHAR) (p), (UCHAR) (v)) +#define OutPortWord(p,v) WRITE_PORT_USHORT((PUSHORT) (p), (USHORT) (v)) +#define OutPortLong(p,v) WRITE_PORT_ULONG ((PULONG) (p), (ULONG) (v)) +#define InPortByte(p) READ_PORT_UCHAR ((PUCHAR) (p)) +#define InPortWord(p) READ_PORT_USHORT ((PUSHORT) (p)) +#define InPortLong(p) READ_PORT_ULONG ((PULONG) (p)) +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.25 xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.25 Thu Jan 17 04:57:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h Wed Jan 29 10:42:16 2003 @@ -1,19 +1,21 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.29 2003/01/29 15:42:16 eich Exp $ */ /* * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holder not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holder makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR @@ -23,13 +25,37 @@ * Mike Chapman <mike@paranoia.com>, * Juanjo Santamarta <santamarta@ctv.es>, * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * David Thomas <davtom@dream.org.uk>. + * + * Thomas Winischhofer <thomas@winischhofer.net>: + * - 310/325 series (315/550/650/651/740/M650) support + * - (possibly incomplete) Xabre (SiS330) support + * - new mode switching code for 300, 310/325 and 330 series + * - many fixes for 300/540/630/730 chipsets, + * - many fixes for 5597/5598, 6326 and 530/620 chipsets, + * - VESA mode switching (deprecated), + * - extended CRT2/video bridge handling support, + * - dual head support on 300, 310/325 and 330 series + * - 650/LVDS (up to 1400x1050), 650/Chrontel 701x support + * - 30xB/30xLV/30xLVX video bridge support (300, 310/325, 330 series) + * - Xv support for 5597/5598, 6326, 530/620 and 310/325 series + * - video overlay enhancements for 300 series + * - TV and hi-res support for the 6326 + * - Color hardware cursor support for 300/310/325/330 series + * - etc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.25 2002/01/17 09:57:29 eich Exp $ */ + #ifndef _SIS_H #define _SIS_H_ +/* Always unlock the registers (should be set!) */ +#define UNLOCK_ALWAYS + +#if 0 +#define TWDEBUG /* for debugging */ +#endif + #include "xf86Pci.h" #include "xf86Cursor.h" #include "xf86_ansic.h" @@ -38,6 +64,9 @@ #include "xaa.h" #include "vgaHW.h" #include "vbe.h" +#include "osdef.h" +#include "vgatypes.h" +#include "vstruct.h" #ifdef XF86DRI #include "xf86drm.h" @@ -49,6 +78,53 @@ #include "sis_dri.h" #endif +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0) +typedef unsigned long IOADDRESS; +#endif + +#if 1 +#define SISDUALHEAD /* TW: Include Dual Head code */ +#endif + +#if 1 +#define USE6326VIDEO /* TW: Include 6326/530/620 Xv code */ +#endif + +#if 1 /* TW: Include code for 330 - highly preliminary */ +#define INCL_SIS330 +#endif + +#if 1 /* TW: Include code for cycling CRT2 type via keyboard */ +#define CYCLECRT2 /* (not functional yet) */ +#endif + +#if 1 +#define SISGAMMA /* TW: Include code for gamma correction */ +#endif + +#if 1 /* TW: Include code for color hardware cursors */ +#define SIS_ARGB_CURSOR +#endif + +/* TW: new for SiS315/550/650/740/330 - these should be moved elsewhere! */ +#ifndef PCI_CHIP_SIS315H +#define PCI_CHIP_SIS315H 0x0310 +#endif +#ifndef PCI_CHIP_SIS315 +#define PCI_CHIP_SIS315 0x0315 +#endif +#ifndef PCI_CHIP_SIS315PRO +#define PCI_CHIP_SIS315PRO 0x0325 +#endif +#ifndef PCI_CHIP_SIS550 +#define PCI_CHIP_SIS550 0x5315 /* This is 550_VGA */ +#endif +#ifndef PCI_CHIP_SIS650 +#define PCI_CHIP_SIS650 0x6325 /* This is 650_VGA and 740_VGA */ +#endif +#ifndef PCI_CHIP_SIS330 +#define PCI_CHIP_SIS330 0x0330 +#endif #define SIS_NAME "SIS" #define SIS_DRIVER_NAME "sis" @@ -58,126 +134,327 @@ #define SIS_CURRENT_VERSION ((SIS_MAJOR_VERSION << 16) | \ (SIS_MINOR_VERSION << 8) | SIS_PATCHLEVEL ) -#define UMA 0x00000001 -#define MMIOMODE 0x00000001 -#define LFBQMODE 0x00000002 -#define AGPQMODE 0x00000004 +/* pSiS->Flags (old series only) */ +#define SYNCDRAM 0x00000001 +#define RAMFLAG 0x00000002 +#define ESS137xPRESENT 0x00000004 +#define SECRETFLAG 0x00000008 +#define A6326REVAB 0x00000010 +#define MMIOMODE 0x00010000 +#define LFBQMODE 0x00020000 +#define AGPQMODE 0x00040000 +#define UMA 0x80000000 #define BIOS_BASE 0xC0000 #define BIOS_SIZE 0x10000 +/* TW: New mode switching code */ +#define SR_BUFFER_SIZE 5 +#define CR_BUFFER_SIZE 5 + +/* TW: VBFlags */ #define CRT2_DEFAULT 0x00000001 -#define CRT2_LCD 0x00000010 -#define CRT2_TV 0x00000020 -#define CRT2_VGA 0x00000040 -#define CRT2_ENABLE 0x00000070 -#define DISPTYPE_DISP2 (CRT2_LCD | CRT2_TV | CRT2_VGA) /* TW */ -#define LCD_640x480 0x00000080 /* TW */ -#define LCD_800x600 0x00000100 -#define LCD_1024x768 0x00000200 -#define LCD_1280x1024 0x00000400 -#define LCD_1280x960 0x00000800 /* TW */ -#define LCD_TYPE 0x00000F80 /* TW */ -#define TV_NTSC 0x00001000 -#define TV_PAL 0x00002000 -#define TV_HIVISION 0x00004000 -#define TV_TYPE 0x00007000 -#define TV_AVIDEO 0x00010000 -#define TV_SVIDEO 0x00020000 -#define TV_SCART 0x00040000 -#define TV_INTERFACE 0x00070000 -#define DISPTYPE_CRT1 0x00080000 /* TW: CRT1 connected and used */ -#define DISPTYPE_DISP1 DISPTYPE_CRT1 /* TW */ -#define VB_301 0x00100000 -#define VB_302 0x00200000 -#define VB_303 0x00400000 -#define VB_301B 0x00800000 /* TW */ +#define CRT2_LCD 0x00000002 /* TW: Never change the order of the CRT2_XXX entries */ +#define CRT2_TV 0x00000004 /* (see SISCycleCRT2Type()) */ +#define CRT2_VGA 0x00000008 +#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) +#define DISPTYPE_DISP2 CRT2_ENABLE +#define TV_NTSC 0x00000010 +#define TV_PAL 0x00000020 +#define TV_HIVISION 0x00000040 +#define TV_TYPE (TV_NTSC | TV_PAL | TV_HIVISION) +#define TV_AVIDEO 0x00000100 +#define TV_SVIDEO 0x00000200 +#define TV_SCART 0x00000400 +#define TV_INTERFACE (TV_AVIDEO | TV_SVIDEO | TV_SCART | TV_CHSCART | TV_CHHDTV) +#define TV_PALM 0x00001000 +#define TV_PALN 0x00002000 +#define TV_CHSCART 0x00008000 +#define TV_CHHDTV 0x00010000 +#define VGA2_CONNECTED 0x00040000 +#define DISPTYPE_CRT1 0x00080000 /* TW: CRT1 connected and used */ +#define DISPTYPE_DISP1 DISPTYPE_CRT1 +#define VB_301 0x00100000 /* Video bridge type */ +#define VB_301B 0x00200000 +#define VB_302B 0x00400000 +#define VB_303 0x00800000 #define VB_LVDS 0x01000000 #define VB_CHRONTEL 0x02000000 -#define VB_VIDEOBRIDGE (VB_301|VB_301B|VB_302|VB_303|VB_LVDS|VB_CHRONTEL) /* TW */ -#define VB_NOLCD 0x04000000 /* TW */ -#define VB_LCDA 0x08000000 /* TW */ -#define SINGLE_MODE 0x10000000 /* TW: CRT1 or CRT2; old: 0x00000000 */ -#define VB_DISPMODE_SINGLE SINGLE_MODE /* TW */ -#define MIRROR_MODE 0x20000000 /* TW: CRT1 + CRT2 */ -#define VB_DISPMODE_MIRROR MIRROR_MODE /* TW */ -#define DUALVIEW_MODE 0x40000000 /* TW: CRT1 + CRT2 independent (not used) */ -/* #define SIMU_MODE 0x10000000 */ /* TW */ -/* #define MM_MODE 0x20000000 */ /* TW */ -#define DISPLAY_MODE 0x70000000 /* TW: Mask; old 0x30000000 */ -#define MASK_DISPTYPE_CRT2 0x04 /* Connect LCD */ -#define MASK_DISPTYPE_LCD 0x02 /* Connect LCD */ -#define MASK_DISPTYPE_TV 0x01 /* Connect TV */ -#define MASK_DISPTYPE_DISP2 (MASK_DISPTYPE_LCD | MASK_DISPTYPE_TV | MASK_DISPTYPE_CRT2) +#define VB_30xLV 0x04000000 +#define VB_30xLVX 0x08000000 +#define VB_TRUMPION 0x10000000 +#define VB_VIDEOBRIDGE (VB_301|VB_301B|VB_302B|VB_303|VB_30xLV|VB_30xLVX| \ + VB_LVDS|VB_CHRONTEL|VB_TRUMPION) /* TW */ +#define VB_SISBRIDGE (VB_301|VB_301B|VB_302B|VB_303|VB_30xLV|VB_30xLVX) +#define SINGLE_MODE 0x20000000 /* TW: CRT1 or CRT2; determined by DISPTYPE_CRTx */ +#define VB_DISPMODE_SINGLE SINGLE_MODE /* TW: alias */ +#define MIRROR_MODE 0x40000000 /* TW: CRT1 + CRT2 identical (mirror mode) */ +#define VB_DISPMODE_MIRROR MIRROR_MODE /* TW: alias */ +#define DUALVIEW_MODE 0x80000000 /* TW: CRT1 + CRT2 independent (dual head mode) */ +#define VB_DISPMODE_DUAL DUALVIEW_MODE /* TW: alias */ +#define DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) /* TW */ + +/* TW: pSiS->VBLCDFlags */ +#define VB_LCD_320x480 0x00000001 /* TW: DSTN/FSTN for 550 */ +#define VB_LCD_640x480 0x00000002 +#define VB_LCD_800x600 0x00000004 +#define VB_LCD_1024x768 0x00000008 +#define VB_LCD_1280x1024 0x00000010 +#define VB_LCD_1280x960 0x00000020 +#define VB_LCD_1600x1200 0x00000040 +#define VB_LCD_2048x1536 0x00000080 +#define VB_LCD_1400x1050 0x00000100 +#define VB_LCD_1152x864 0x00000200 +#define VB_LCD_1152x768 0x00000400 +#define VB_LCD_1280x768 0x00000800 +#define VB_LCD_1024x600 0x00001000 + +/* TW: More or less useful macros (although we often use pSiS->VGAEngine instead) */ +#define SIS_IS_300_CHIPSET (pSiS->Chipset == PCI_CHIP_SIS300) || \ + (pSiS->Chipset == PCI_CHIP_SIS630) || \ + (pSiS->Chipset == PCI_CHIP_SIS540) || \ + (pSiS->Chipset == PCI_CHIP_SIS730) + +/* This preliminaryly also contains SIS330 */ +#define SIS_IS_315_CHIPSET (pSiS->Chipset == PCI_CHIP_SIS315) || \ + (pSiS->Chipset == PCI_CHIP_SIS315H) || \ + (pSiS->Chipset == PCI_CHIP_SIS315PRO) || \ + (pSiS->Chipset == PCI_CHIP_SIS550) || \ + (pSiS->Chipset == PCI_CHIP_SIS650) || \ + (pSiS->Chipset == PCI_CHIP_SIS330) + +/* SiS6326Flags */ +#define SIS6326_HASTV 0x00000001 +#define SIS6326_TVSVIDEO 0x00000002 +#define SIS6326_TVCVBS 0x00000004 +#define SIS6326_TVPAL 0x00000008 +#define SIS6326_TVDETECTED 0x00000010 +#define SIS6326_TVON 0x80000000 +#define HW_DEVICE_EXTENSION SIS_HW_DEVICE_INFO + #ifdef DEBUG #define PDEBUG(p) p #else #define PDEBUG(p) #endif +typedef unsigned long ULong; +typedef unsigned short UShort; +typedef unsigned char UChar; + +/* TW: VGA engine types */ +#define UNKNOWN_VGA 0 +#define SIS_530_VGA 1 +#define SIS_OLD_VGA 2 +#define SIS_300_VGA 3 +#define SIS_315_VGA 4 + +/* TW: oldChipset */ +#define OC_UNKNOWN 0 +#define OC_SIS6205A 3 +#define OC_SIS6205B 4 +#define OC_SIS82204 5 +#define OC_SIS6205C 6 +#define OC_SIS6225 7 +#define OC_SIS5597 8 +#define OC_SIS6326 9 +#define OC_SIS530A 11 +#define OC_SIS530B 12 + +/* TW: Chrontel type */ +#define CHRONTEL_700x 0 +#define CHRONTEL_701x 1 + +/* Flags650 */ +#define SiS650_LARGEOVERLAY 0x00000001 + +/* TW: For backup of register contents */ typedef struct { unsigned char sisRegs3C4[0x50]; - unsigned char sisRegs3D4[0x40]; + unsigned char sisRegs3D4[0x90]; unsigned char sisRegs3C2; - unsigned char VBPart1[0x29]; - unsigned char VBPart2[0x46]; - unsigned char VBPart3[0x3F]; - unsigned char VBPart4[0x1C]; - unsigned short ch7005[0x11]; + unsigned char VBPart1[0x50]; + unsigned char VBPart2[0x50]; + unsigned char VBPart3[0x50]; + unsigned char VBPart4[0x50]; + unsigned short ch70xx[64]; + unsigned long sisMMIO85C0; /* TW: Queue location for 310/325 series */ + unsigned char sis6326tv[0x46]; + unsigned long sisRegsPCI50, sisRegsPCIA0; } SISRegRec, *SISRegPtr; +typedef struct _sisModeInfoPtr { + int width; + int height; + int bpp; + int n; + struct _sisModeInfoPtr *next; +} sisModeInfoRec, *sisModeInfoPtr; + +/* TW: SISFBLayout is mainly there because of DGA. It holds the + current layout parameters needed for acceleration and other + stuff. When switching mode using DGA, these are set up + accordingly and not necessarily match pScrn's. Therefore, + driver modules should read these values instead of pScrn's. + */ +typedef struct { + int bitsPerPixel; /* TW: Copy from pScrn->bitsPerPixel */ + int depth; /* TW: Copy from pScrn->depth */ + int displayWidth; /* TW: Copy from pScrn->displayWidth */ + DisplayModePtr mode; /* TW: Copy from pScrn->currentMode */ +} SISFBLayout; + +/* TW: Dual head private entity structure */ +#ifdef SISDUALHEAD +typedef struct { + ScrnInfoPtr pScrn_1; + ScrnInfoPtr pScrn_2; + unsigned char * BIOS; + SiS_Private * SiS_Pr; /* TW: For new mode switching code */ + int CRT1ModeNo; /* Current display mode for CRT1 */ + DisplayModePtr CRT1DMode; /* Current display mode for CRT1 */ + int CRT2ModeNo; /* Current display mode for CRT2 */ + DisplayModePtr CRT2DMode; /* Current display mode for CRT2 */ + int refCount; + int lastInstance; /* number of entities */ + Bool DisableDual; /* Emergency flag */ + Bool ErrorAfterFirst; /* Emergency flag: Error after first init -> Abort second */ + Bool HWCursor; /* Backup master settings for use on slave */ + Bool TurboQueue; + int ForceCRT2Type; + int OptTVStand; + int OptTVOver; + int OptTVSOver; + int OptROMUsage; + int PDC; + Bool NoAccel; + Bool NoXvideo; + int forceCRT1; + int DSTN; + Bool XvOnCRT2; + int maxUsedClock; /* Max used pixelclock on master head */ + unsigned long masterFbAddress; /* Framebuffer addresses and sizes */ + unsigned long masterFbSize; + unsigned long slaveFbAddress; + unsigned long slaveFbSize; + unsigned char * FbBase; /* VRAM linear address */ + unsigned char * IOBase; /* MMIO linear address */ + unsigned short MapCountIOBase; /* map/unmap queue counter */ + unsigned short MapCountFbBase; /* map/unmap queue counter */ + Bool forceUnmapIOBase; /* ignore counter and unmap */ + Bool forceUnmapFbBase; /* ignore counter and unmap */ +#ifdef __alpha__ + unsigned char * IOBaseDense; /* MMIO for Alpha platform */ + unsigned short MapCountIOBaseDense; + Bool forceUnmapIOBaseDense; /* ignore counter and unmap */ +#endif + int chtvlumabandwidthcvbs; /* TW: TV settings for Chrontel TV encoder */ + int chtvlumabandwidthsvideo; + int chtvlumaflickerfilter; + int chtvchromabandwidth; + int chtvchromaflickerfilter; + int chtvcvbscolor; + int chtvtextenhance; + int chtvcontrast; + int sistvedgeenhance; /* TW: TV settings for SiS bridge */ + int sistvantiflicker; + int sistvsaturation; + int tvxpos; + int tvypos; + int ForceTVType; + int chtvtype; + int NonDefaultPAL; + unsigned short tvx, tvy; + unsigned char p2_01, p2_02, p2_2d; + unsigned short cursorBufferNum; + BOOLEAN restorebyset; +} SISEntRec, *SISEntPtr; +#endif + #define SISPTR(p) ((SISPtr)((p)->driverPrivate)) #define XAAPTR(p) ((XAAInfoRecPtr)(SISPTR(p)->AccelInfoPtr)) typedef struct { - ScrnInfoPtr pScrn; - pciVideoPtr PciInfo; + ScrnInfoPtr pScrn; /* -------------- DON'T INSERT ANYTHING HERE --------------- */ + pciVideoPtr PciInfo; /* -------- OTHERWISE sis_dri.so MUST BE RECOMPILED -------- */ PCITAG PciTag; EntityInfoPtr pEnt; int Chipset; int ChipRev; - unsigned long FbAddress; /* VRAM physical address */ - - unsigned char * FbBase; /* VRAM linear address */ + int VGAEngine; /* TW: see above */ + int hasTwoOverlays; /* TW: Chipset supports two video overlays? */ + HW_DEVICE_EXTENSION sishw_ext; /* TW: For new mode switching code */ + SiS_Private * SiS_Pr; /* TW: For new mode switching code */ + int DSTN; /* TW: For 550 FSTN/DSTN; set by option, no detection */ + unsigned long FbAddress; /* VRAM physical address (in DHM: for each Fb!) */ + unsigned long realFbAddress; /* For DHM/PCI mem mapping: store global FBAddress */ + unsigned char * FbBase; /* VRAM virtual linear address */ CARD32 IOAddress; /* MMIO physical address */ unsigned char * IOBase; /* MMIO linear address */ + IOADDRESS IODBase; /* Base of PIO memory area */ #ifdef __alpha__ unsigned char * IOBaseDense; /* MMIO for Alpha platform */ #endif - CARD16 RelIO; /* Relocate IO Base */ + CARD16 RelIO; /* Relocated IO Ports baseaddress */ unsigned char * BIOS; int MemClock; int BusWidth; int MinClock; int MaxClock; int Flags; /* HW config flags */ - long FbMapSize; + long FbMapSize; /* Used for Mem Mapping - DON'T CHANGE THIS */ + long availMem; /* Really available Fb mem (minus TQ, HWCursor) */ unsigned long maxxfbmem; /* limit fb memory X is to use to this (KB) */ + unsigned long sisfbMem; /* heapstart of sisfb (if running) */ +#ifdef SISDUALHEAD + unsigned long dhmOffset; /* Offset to memory for each head (0 or ..) */ +#endif DGAModePtr DGAModes; int numDGAModes; Bool DGAactive; int DGAViewportStatus; + int OldMode; /* TW: Back old modeNo (if available) */ Bool NoAccel; Bool NoXvideo; + Bool XvOnCRT2; /* TW: see sis_opt.c */ Bool HWCursor; Bool UsePCIRetry; Bool TurboQueue; int VESA; int ForceCRT2Type; + int OptTVStand; + int OptTVOver; + int OptROMUsage; + int UseCHOverScan; Bool ValidWidth; - Bool FastVram; - int VBFlags; - short scrnOffset; + Bool FastVram; /* TW: now unused */ + int forceCRT1; + Bool CRT1changed; + unsigned char oldCR17; + unsigned char oldCR32; + unsigned char newCR32; + int VBFlags; /* TW: Video bridge configuration */ + int VBFlags_backup; /* TW: Backup for SlaveMode-modes */ + int VBLCDFlags; /* TW: Moved LCD panel size bits here */ + int ChrontelType; /* TW: CHRONTEL_700x or CHRONTEL_701x */ + int PDC; /* TW: PanelDelayCompensation */ + short scrnOffset; /* TW: Screen pitch (data) */ + short scrnPitch; /* TW: Screen pitch (display; regarding interlace) */ short DstColor; - int Xdirection; - int Ydirection; + int xcurrent; /* for temp use in accel */ + int ycurrent; /* for temp use in accel */ + long SiS310_AccelDepth; /* used in accel for 310/325 series */ + int Xdirection; /* for temp use in accel */ + int Ydirection; /* for temp use in accel */ int sisPatternReg[4]; int ROPReg; int CommandReg; int MaxCMDQueueLen; int CurCMDQueueLen; int MinCMDQueueLen; + CARD16 CursorSize; /* TW: Size of HWCursor area (bytes) */ + CARD32 cursorOffset; /* TW: see sis_driver.c and sis_cursor.c */ int DstX; int DstY; unsigned char * XAAScanlineColorExpandBuffers[2]; @@ -190,83 +467,157 @@ XAAInfoRecPtr AccelInfoPtr; CloseScreenProcPtr CloseScreen; unsigned int (*ddc1Read)(ScrnInfoPtr); - Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); - void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSave3)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSaveLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSaveChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore3)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestoreLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestoreChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, + Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); + void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSave3)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSaveLVDSChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore3)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestoreLVDSChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); - void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, - int *indicies, LOCO *colors, VisualPtr pVisual); - - int *cmdQueueLenPtr; - unsigned long agpHandle; - CARD32 agpAddr; - unsigned char *agpBase; - unsigned int agpSize; - CARD32 agpCmdBufAddr; - unsigned char *agpCmdBufBase; - unsigned int agpCmdBufSize; - unsigned int agpCmdBufFree; - Bool irqEnabled; - int irq; - int ColorExpandRingHead; - int ColorExpandRingTail; - int PerColorExpandBufferSize; - int ColorExpandBufferNumber; - int ColorExpandBufferCountMask; - unsigned char *ColorExpandBufferAddr[32]; - int ColorExpandBufferScreenOffset[32]; - int ImageWriteBufferSize; - unsigned char *ImageWriteBufferAddr; - - int Rotate; - void (*PointerMoved)(int index, int x, int y); - - /* ShadowFB support */ - Bool ShadowFB; - unsigned char *ShadowPtr; - int ShadowPitch; + void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, VisualPtr pVisual); + int cmdQueueLen; /* TW: Current cmdQueueLength (for 2D and 3D) */ + int *cmdQueueLenPtr; + unsigned long agpHandle; + CARD32 agpAddr; + unsigned char *agpBase; + unsigned int agpSize; + CARD32 agpCmdBufAddr; + unsigned char *agpCmdBufBase; + unsigned int agpCmdBufSize; + unsigned int agpCmdBufFree; + Bool irqEnabled; + int irq; + + int ColorExpandRingHead; + int ColorExpandRingTail; + int PerColorExpandBufferSize; + int ColorExpandBufferNumber; + int ColorExpandBufferCountMask; + unsigned char *ColorExpandBufferAddr[32]; + int ColorExpandBufferScreenOffset[32]; + int ImageWriteBufferSize; + unsigned char *ImageWriteBufferAddr; + + int Rotate; + void (*PointerMoved)(int index, int x, int y); + + /* ShadowFB support */ + Bool ShadowFB; + unsigned char *ShadowPtr; + int ShadowPitch; #ifdef XF86DRI - Bool directRenderingEnabled; - DRIInfoPtr pDRIInfo; - int drmSubFD; - int numVisualConfigs; - __GLXvisualConfig* pVisualConfigs; - SISConfigPrivPtr pVisualConfigsPriv; - SISRegRec DRContextRegs; -#endif - XF86VideoAdaptorPtr adaptor; - ScreenBlockHandlerProcPtr BlockHandler; - - OptionInfoPtr Options; - unsigned char LCDon; - Bool Blank; - unsigned char BIOSModeSave; - int CRT1off; /* TW: 1=CRT1 off, 0=CRT1 on */ - CARD16 LCDheight; /* TW: Vertical resolution of LCD panel */ - vbeInfoPtr pVbe; /* TW: all following for VESA switching with 630+LVDS */ - CARD16 vesamajor; - CARD16 vesaminor; - VbeInfoBlock *vbeInfo; - int UseVESA; - xf86MonPtr monitor; - CARD16 maxBytesPerScanline; - CARD32 *pal, *savedPal; - int mapPhys, mapOff, mapSize; - int statePage, stateSize, stateMode; - CARD8 *fonts; - CARD8 *state, *pstate; - void *base, *VGAbase; + Bool directRenderingEnabled; + DRIInfoPtr pDRIInfo; + int drmSubFD; + int numVisualConfigs; + __GLXvisualConfig* pVisualConfigs; + SISConfigPrivPtr pVisualConfigsPriv; + SISRegRec DRContextRegs; +#endif + + XF86VideoAdaptorPtr adaptor; + ScreenBlockHandlerProcPtr BlockHandler; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + + OptionInfoPtr Options; + unsigned char LCDon; +#ifdef SISDUALHEAD + Bool BlankCRT1, BlankCRT2; +#endif + Bool Blank; + unsigned char BIOSModeSave; + int CRT1off; /* TW: 1=CRT1 off, 0=CRT1 on */ + CARD16 LCDheight; /* TW: Vertical resolution of LCD panel */ + CARD16 LCDwidth; /* TW: Horizontal resolution of LCD panel */ + vbeInfoPtr pVbe; /* TW: For VESA mode switching */ + CARD16 vesamajor; + CARD16 vesaminor; + VbeInfoBlock *vbeInfo; + int UseVESA; + sisModeInfoPtr SISVESAModeList; + xf86MonPtr monitor; + CARD16 maxBytesPerScanline; + CARD32 *pal, *savedPal; + int mapPhys, mapOff, mapSize; + int statePage, stateSize, stateMode; + CARD8 *fonts; + CARD8 *state, *pstate; + void *base, *VGAbase; +#ifdef SISDUALHEAD + BOOL DualHeadMode; /* TW: TRUE if we use dual head mode */ + BOOL SecondHead; /* TW: TRUE is this is the second head */ + SISEntPtr entityPrivate; /* TW: Ptr to private entity (see above) */ + BOOL SiSXinerama; /* TW: Do we use Xinerama mode? */ +#endif + SISFBLayout CurrentLayout; /* TW: Current framebuffer layout */ + Bool (*i2cInit)(ScrnInfoPtr);/* I2C stuff */ + I2CBusPtr I2C; + USHORT SiS_DDC2_Index; + USHORT SiS_DDC2_Data; + USHORT SiS_DDC2_Clk; + BOOL Primary; /* TW: Display adapter is primary */ + xf86Int10InfoPtr pInt; /* TW: Our int10 */ + int oldChipset; /* TW: Type of old chipset */ + CARD32 RealVideoRam; /* TW: 6326 can only address 4MB, but TQ can be above */ + CARD32 CmdQueLenMask; /* TW: Mask of queue length in MMIO register */ + CARD32 CmdQueLenFix; /* TW: Fix value to subtract from QueLen (530/620) */ + CARD32 CmdQueMaxLen; /* TW: (6326/5597/5598) Amount of cmds the queue can hold */ + CARD32 TurboQueueLen; /* TW: For future use */ + CARD32 detectedCRT2Devices; /* TW: detected CRT2 devices before mask-out */ + Bool NoHostBus; /* TW: Enable/disable 5597/5598 host bus */ + Bool noInternalModes; /* TW: Use our own default modes? */ + char * sbiosn; /* TW: For debug */ + int OptUseOEM; /* TW: Use internal OEM data? */ + int chtvlumabandwidthcvbs; /* TW: TV settings for Chrontel TV encoder */ + int chtvlumabandwidthsvideo; + int chtvlumaflickerfilter; + int chtvchromabandwidth; + int chtvchromaflickerfilter; + int chtvcvbscolor; + int chtvtextenhance; + int chtvcontrast; + int sistvedgeenhance; /* TW: TV settings for SiS bridges */ + int sistvantiflicker; + int sistvsaturation; + int OptTVSOver; /* TW: Chrontel 7005: Superoverscan */ + int tvxpos; + int tvypos; + int SiS6326Flags; /* TW: SiS6326 TV settings */ + int sis6326antiflicker; + int sis6326enableyfilter; + int sis6326yfilterstrong; + BOOL donttrustpdc; /* TW: Don't trust the detected PDC */ + unsigned char sisfbpdc; + int NoYV12; /* TW: Disable Xv YV12 support (old series) */ + unsigned char postVBCR32; + int newFastVram; /* TW: Replaces FastVram */ + int ForceTVType; + int NonDefaultPAL; + unsigned long lockcalls; /* TW: Count unlock calls for debug */ + unsigned short tvx, tvy; /* TW: Backup TV position registers */ + unsigned char p2_01, p2_02, p2_2d; /* TW: Backup TV position registers */ + unsigned short tvx1, tvx2, tvx3, tvy1; /* TW: Backup TV position registers */ + BOOLEAN ForceCursorOff; + BOOLEAN HaveCustomModes; + BOOLEAN IsCustom; + DisplayModePtr backupmodelist; + int chtvtype; + Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation; + Atom xvAutopaintColorKey, xvSetDefaults; + unsigned long Flags650; + BOOLEAN UseHWARGBCursor; + int OptUseColorCursor; + int OptUseColorCursorBlend; + CARD32 OptColorCursorBlendThreshold; + unsigned short cursorBufferNum; + BOOLEAN restorebyset; } SISRec, *SISPtr; typedef struct _ModeInfoData { @@ -274,13 +625,86 @@ VbeModeInfoBlock *data; VbeCRTCInfoBlock *block; } ModeInfoData; - -typedef struct _sisModeInfoPtr { - int width; - int height; - int bpp; - int n; - struct _sisModeInfoPtr *next; -} sisModeInfoRec, *sisModeInfoPtr; +typedef struct _myhddctiming { + int whichone; + unsigned char mask; + float rate; +} myhddctiming; + +typedef struct _myvddctiming { + int whichone; + unsigned char mask; + int rate; +} myvddctiming; + +typedef struct _myddcstdmodes { + int hsize; + int vsize; + int refresh; + float hsync; +} myddcstdmodes; + +typedef struct _pdctable { + int subsysVendor; + int subsysCard; + int pdc; + char *vendorName; + char *cardName; +} pdctable; + +typedef struct _chswtable { + int subsysVendor; + int subsysCard; + char *vendorName; + char *cardName; +} chswtable; + +extern void sisSaveUnlockExtRegisterLock(SISPtr pSiS, unsigned char *reg1, unsigned char *reg2); +extern void sisRestoreExtRegisterLock(SISPtr pSiS, unsigned char reg1, unsigned char reg2); +extern void SiSOptions(ScrnInfoPtr pScrn); +extern const OptionInfoRec * SISAvailableOptions(int chipid, int busid); +extern void SiSSetup(ScrnInfoPtr pScrn); +extern void SISVGAPreInit(ScrnInfoPtr pScrn); +extern Bool SiSAccelInit(ScreenPtr pScreen); +extern Bool SiS300AccelInit(ScreenPtr pScreen); +extern Bool SiS310AccelInit(ScreenPtr pScreen); +extern Bool SiS530AccelInit(ScreenPtr pScreen); +extern Bool SiSHWCursorInit(ScreenPtr pScreen); +extern Bool SISDGAInit(ScreenPtr pScreen); +extern void SISInitVideo(ScreenPtr pScreen); +extern void SIS6326InitVideo(ScreenPtr pScreen); + +extern void SiS_SetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVlumaflickerfilter(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVchromabandwidth(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVchromaflickerfilter(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVcvbscolor(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVtextenhance(ScrnInfoPtr pScrn, int val); +extern void SiS_SetCHTVcontrast(ScrnInfoPtr pScrn, int val); +extern void SiS_SetSISTVedgeenhance(ScrnInfoPtr pScrn, int val); +extern void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val); +extern void SiS_SetSISTVsaturation(ScrnInfoPtr pScrn, int val); +extern void SiS_SetSIS6326TVantiflicker(ScrnInfoPtr pScrn, int val); +extern void SiS_SetSIS6326TVenableyfilter(ScrnInfoPtr pScrn, int val); +extern void SiS_SetSIS6326TVyfilterstrong(ScrnInfoPtr pScrn, int val); +extern void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val); +extern void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val); +extern int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVlumaflickerfilter(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVchromabandwidth(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVchromaflickerfilter(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVcvbscolor(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVtextenhance(ScrnInfoPtr pScrn); +extern int SiS_GetCHTVcontrast(ScrnInfoPtr pScrn); +extern int SiS_GetSISTVedgeenhance(ScrnInfoPtr pScrn); +extern int SiS_GetSISTVantiflicker(ScrnInfoPtr pScrn); +extern int SiS_GetSISTVsaturation(ScrnInfoPtr pScrn); +extern int SiS_GetSIS6326TVantiflicker(ScrnInfoPtr pScrn); +extern int SiS_GetSIS6326TVenableyfilter(ScrnInfoPtr pScrn); +extern int SiS_GetSIS6326TVyfilterstrong(ScrnInfoPtr pScrn); +extern int SiS_GetTVxposoffset(ScrnInfoPtr pScrn); +extern int SiS_GetTVyposoffset(ScrnInfoPtr pScrn); #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.6 Thu Jan 10 14:05:43 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man Wed Jan 29 10:42:16 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.6 2002/01/10 19:05:43 eich Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.10 2003/01/29 15:42:16 eich Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SIS __drivermansuffix__ __vendorversion__ @@ -13,70 +13,60 @@ .B EndSection .fi .SH DESCRIPTION -.B sis -is an XFree86 driver for SiS video cards. The driver is accelerated, and +.B sis +is an XFree86 driver for SiS video chips. The driver is accelerated, and provides support for 8, 16 and 24 colordepths. XVideo, Render and other extensions are supported as well. .SH SUPPORTED HARDWARE The .B sis driver supports PCI and AGP video cards based on the following chipsets: +.PP +.B SiS5597/5598 +.B SiS530/620 +.B SiS6326/AGP/DVD +.B SiS300/305 +.B SiS540 +.B SiS630/730 +.B SiS315/H/PRO +.B SiS550 +.B SiS650/651/650M/740 +.B SiS330 (Xabre) +.PP +In the following text, the following terms are used: +.PP +.B old series +for SiS5597/5598, 530/620 and 6326/AGP/DVD +.PP +.B 300 series +for SiS300/305, 540 and 630/730 .PP -.B SIS5597 -.B SIS5598 -.B SIS530 -.B SIS6326 -.B SIS300 -.B SIS540 -.B SIS630 +.B 310/325/330 series +for SiS315/H/PRO, 550 and 650/651/650M/740, 330 .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this -driver. -.PP -The driver will auto-detect the amount of video memory present for all -chips, but in the 6326 case, it will limit the memory size to 4MB. This -is because of a bug (in docs at least). You can override this using the -.B \*qVideoRAM\*q -option in the device section if your board has more than -4MB and you need to use it (maybe with cursor problems). +driver. Please note that support for the SiS330 is new and there may be +some problems. .PP -If you have problems getting high resolutions because of dot clock -limitations, try using the -.B \*qDacSpeed\*q -option, also in the device section. +.I "1. For all supported chipsets" .PP The following driver .B Options -are supported: +are supported on all chipsets: .TP .BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. +Disable or enable 2D acceleration. Please note: On chipsets with XVideo +support, this also disables XVideo. Default: acceleration is enabled. .TP .BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. +Enable or disable the HW cursor. Default: HWCursor is on. .TP .BI "Option \*qSWCursor\*q \*q" boolean \*q -The opposite of HWCursor. Default: off. -.TP -.BI "Option \*qNoXVideo*q \*q" boolean \*q -Disable XV (XVideo) extension support. Default: off. -.TP -.BI "Option \*qSetMClk\*q \*q" integer \*q -Set the memory clock. Value in MHz. Default: autodetect. -.TP -.BI "Option \*qPciRetry\*q \*q" boolean \*q -Enable or disable PCI retries. Default: on. -.TP -.BI "Option \*qTurboQueue\*q \*q" boolean \*q -Enable or disable TurboQueue mode. Default: off for SIS530, on for the -others -.TP -.BI "Option \*qFastVram\*q \*q" boolean \*q -Enable or disable FastVram mode. Default: on. +The opposite of HWCursor. Default: SWCursor is off. .TP .BI "Option \*qRotate\*q \*qCW\*q" -Rotate the display clockwise. This mode is unaccelerated, and uses +Rotate the display clockwise. This mode is unaccelerated, and uses the Shadow Frame Buffer layer. Default: no rotation. .TP @@ -85,26 +75,339 @@ uses the Shadow Frame Buffer layer. Default: no rotation. .TP -.BI "Option \*qForceCRT2Type\*q \*qstring\*q" -Force display type to one of: TV, LCD or VGA. Default: auto detect. -.TP .BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. Default: off. +Enable or disable use of the shadow framebuffer layer. +Default: Shadow framebuffer is off. +.PP +.I "2. Old series specific information" +.PP +The driver will auto-detect the amount of video memory present for all +these chips, but in the 6326 case, it will limit the memory size to 4MB. +This is because the 6326's 2D engine can only address 4MB. The remaining +memory seems to be intended for 3D texture data, since only the 3D +engine can address RAM above 4MB. However, you can override this forced +limitation using the +.B \*qVideoRAM\*q +option in the device section if your board has more than +4MB and you need to use it. However, 2D acceleration, Xvideo and the +HWCursor will be disabled in this case. +.PP +The driver will also auto-detect the maximum dotclock and DAC speed. +If you have problems getting high resolutions because of dot clock +limitations, try using the +.B \*qDacSpeed\*q +option, also in the device section. However, this is not recommended +for the 6326. For this chipset, the driver has two built-in modes for +high resolutions which you should use instead. These are named +.B \*qSIS1280x1024-75\*q +and +.B \*qSIS1600x1200-60\*q +and they will be added to the list of default modes. To use these modes, +just place them in your Screen section. Example: +.PP +.BI "Modes \*qSIS1600x1200-60\*q \*qSIS1280x1024x75\*q \*q1024x768\*q ... +.PP +1280x1024 is only available at 8, 15 and 16bpp. 1600x1200 is available +at 8bpp only. +.PP +TV support for the 6326 +.PP +TV output is supported on the 6326. The driver will auto detect a +TV connected, and in this case add the following modes to the list +of default modes: "PAL800x600", "PAL800x600U", "PAL720x540", +"PAL640x480", "NTSC640x480", "NTSC640x480U" and "NTSC640x400". +Use these modes like the hi-res modes described above. +.PP +The following driver +.B Options +are supported on the old series: .TP +.BI "Option \*qTurboQueue\*q \*q" boolean \*q +Enable or disable TurboQueue mode. Default: off for SIS530/620, on for +the others +.TP +.BI "Option \*qFastVram\*q \*q" boolean \*q +Enable or disable FastVram mode. Enabling this sets the video RAM timing +to only one cycle per read operation instead of two cycles. Disabling +this will set 2 cycles for read and write operations. Leaving this +option out uses the default. +Default: off for read, on for write. +.TP +.BI "Option \*qNoHostBus\*q \*q" boolean \*q +(SiS5597/5598 only). Disable CPU-to-VGA host bus support. This +speeds up CPU to video RAM transfers. Default: Host bus is enabled. +.TP .BI "Option \*qNoXVideo\*q \*q" boolean \*q -Enable or disable use of the video scaler. Default: off. +Disable XV (XVideo) extension support. Default: XVideo is on. .TP -.BI "Option \*qVESA\*q \*q" boolean \*q -Force use of VESA BIOS initialization on or off. -Default: If option is not set: chipset dependent. +.BI "Option \*qTVStandard\*q \*q" string \*q +(6326 only) Possible parameters are +.B PAL +or +.B NTSC. +The default is set by a jumper on the card. +.TP +.BI "Option \*qTVXPosOffset\*q \*q" integer \*q +(6326 only) This option allows horizontal relocation the TV output. +The range is from -16 to 16. +.TP +.BI "Option \*qTVYPosOffset\*q \*q" integer \*q +(6326 only) This option allows vertical relocation the TV output. +The range is from -16 to 16. +.TP +.BI "Option \*qSIS6326TVEnableYFilter\*q \*q" boolean \*q +(6326 only) This option allows enabling/disabling the Y filter for +TV output. +.TP +.BI "Option \*qSIS6326TVAntiFlicker\*q \*q" string \*q +(6326 only) This option allow enabling/disabling the anti flicker +facility for TV output. Possible parameters are +.B OFF, LOW, MED, HIGH +or +.B ADAPTIVE. +By experience, +.B ADAPTIVE +yields the best results. +.PP +.I "2. 300 and 310/325/330 series specific information" +.PP +The 300 and 310/325/330 series very often come with a video bridge for +controlling LCD and TV output. Hereinafter, the term +.B CRT1 +refers to the VGA output of the chip, and +.B CRT2 +refers to either LCD, TV or secondary VGA. Due to timing reasons, +only one CRT2 output can be active at the same time. But this +limitation does not apply to using CRT1 and CRT2 at the same time +which makes it possible to run the driver in dual head mode. +.PP +The driver supports the following video bridges: +.PP +.B SiS301 +.B SiS301B +.B SiS301LV +.B SiS302B +.B SiS302LV +.PP +Instead of a video bridge, some machines have a +.B LVDS +transmitter to control LCD panels, and a +.B "Chrontel 7005" +or +.B "7019" +for TV output. All these are supported as well. +.PP +About TV output +.PP +On the SiS301 and the Chrontel 7005, only resolutions up to 800x600 +are supported. On all others, resolutions up to 1024x768 are supported. +.PP +About XVideo support +.PP +XVideo is supported on all chipsets of both families. However, there +are some differences in hardware features which cause limitations. +The 300 series as well as the SiS550, 650M, 651 and 330 support two video +overlays. The SiS315/H/PRO and 650/740 support only one such overlay. +On chips with two overlays, one overlay is used for CRT1, the other +for CRT2. On the other chipsets, the option +.B \*qXvOnCRT2\*q +can be used to select the desired output channel. +.PP +About dual-head support +.PP +Dual head mode has some limitations as regards color depth and +resolution. Due to memory bandwidth limits, CRT1 might have a +reduced refresh rate if running on higher resolutions than +1280x1024. +.PP +Colordepth 8 is not supported when running in dual head mode. +.PP +The following driver +.B Options +are supported on the 300 and 310/325 series: +.TP +.BI "Option \*qNoXVideo\*q \*q" boolean \*q +Disable XV (XVideo) extension support. +Default: XVideo is on. .TP +.BI "Option \*qXvOnCRT2\*q \*q" boolean \*q +On chipsets with only one video overlay, this option can +used to bind the overlay to CRT1 ( if a monitor is detected +and if this option is either unset or set to +.B false +) or CRT2 ( if a CRT2 device is detected or forced, and if this +option is set to +.B true +). If either only CRT1 or CRT2 is detected, the driver decides +automatically. +Default: overlay is used on CRT1 +.TP +.BI "Option \*qForceCRT1\*q \*q" boolean \*q +The BIOS detects VGA monitors connected to CRT1 at boot time +and the X driver by default relies on the information passed +by the BIOS. However, some old monitors are not detected +correctly. If this is the case, or if you connected the VGA +monitor after you booted the machine, you may set this +option to +.B true +in order to make the X driver ignore the +information from the BIOS and initialize CRT1 anyway. +If this option is set to +.B false +, the driver will switch +off CRT1 and thus save memory bandwidth. +Default: auto detect CRT1 +.TP +.BI "Option \*qForceCRT2Type\*q \*q" string \*q +Force display type to one of: +.B NONE +, +.B TV +, +.B SVIDEO +, +.B COMPOSITE +, +.B SCART, +, +.B LCD +, +.B VGA +; +.B NONE +will disable CRT2. The SVIDEO, COMPOSITE and SCART parameters +can be used to force the driver to use a specific TV output +connector (if present). +Default: auto detect. +.TP +.BI "Option \*qPanelDelayCompensation\*q \*q" integer \*q +This option is only for machines with a 300 series chipset +and either a SiS301B video bridge or a LVDS transmitter. +Different LCD panels require different delay compensation +values. In most cases, the driver can autodetect this value. +However, due to bad BIOS design this might fail in rare +cases. If your LCD shows small horizontal waves, set the +parameter of this option first to +.B 4 +, +.B 32 +or +.B 24 +and if the problem persists, try using other values between +4 and 60 in steps of 4. +.TP +.BI "Option \*qUseROMData\*q \*q" boolean \*q +The driver reads some data from the BIOS ROM, especially +LCD dependent information. If the folks at SiS some day +decide to change the location of this data inside the +BIOS image, the display might not be initialized correctly. +In order to prevent this, set this option's parameter to +.B false. +Default: ROM data is used +.TP +.BI "Option \*qTVStandard\*q \*q" string \*q +Force the TV standard to either +.B PAL +or +.B NTSC. +On some machines with 630, 730 or 650/740, +.B PALM +and +.B PALN +are supported as well. Default: BIOS setting. +.TP +.BI "Option \*qTVXPosOffset\*q \*q" integer \*q +This option allows horizontal relocation the TV output. +The range is from -32 to 32. Not supported on the Chrontel +7019 yet. +.TP +.BI "Option \*qTVYPosOffset\*q \*q" integer \*q +This option allows vertical relocation the TV output. +The range is from -32 to 32. Not supported on the Chrontel +7019 yet. +.TP +.BI "Option \*qCHTVOverscan\*q \*q" boolean \*q +On machines with a Chrontel TV encoder, this can be used to +force the TV mode to overscan or underscan. +.B True +means overscan, +.B false +means underscan. +Default: BIOS setting. +.TP +.BI "Option \*qCHTVSuperOverscan\*q \*q" boolean \*q +On machines with a Chrontel 7005 TV encoder, this option +enables a super-overscan mode. This is only supported if +the TV standard is PAL. Super overscan will produce an +image on the TV which is larger than the viewable area. +.PP +.I "3. 300 series specific information" +.PP +DRI is supported on the 300 series only. DRI requires +the kernel's SiS framebuffer driver ( +.B sisfb +) and some other modules +which come with either the kernel or XFree86. +.PP +Sisfb takes care of memory management for texture +data. In order to prevent the X driver and sisfb from +overwriting each others video memory, sisfb reserves +an amount of video memory for the X driver. This amount +can either be selected using sisfb's mem parameter, or +auto-selected depending on the amount of total video RAM +available. However, the X driver needs to know about the +amount of RAM sisfb reserved. For this purpose, the +.TP .BI "Option \*qMaxXFBMem\*q \*q" integer \*q -Amount of video memory to use for X. This option is useful to reserve -some memory from the top of the video memory for 3D. Under Linux 3D -memory is currently handled by the sisfb kernel driver. -Default: use all video memory for X. +.PP +exists. +.PP +At the moment (2002), the SiS DRI driver is not +maintained, lacks support for memory swapping and +has a few bugs. If you intend to use DRI, I recommend +setting the total video memory in the BIOS to 64MB +in order to at least overcome the lack of memory +swap functions. +.PP +Sisfb can be used for memory management only, or as +a complete framebuffer driver. If you start sisfb +with a valid mode (ie you gain a graphical console), +the X driver can communicate with sisfb and doesn't +require setting the +.B \*qMaxXFBMem\*q +option at all. The X driver will receive enough information +from sisfb in this case. +.PP +However, if you use sisfb for memory management only, ie +you started sisfb with mode=none and still have a text +mode console, there is no communication between sisfb +and the X driver. In this case, you need to set +.B \*qMaxXFBMem\*q +to the same value as you gave sisfb with its mem +parameter. If you didn't specify any mem parameter, +sisfb will reserve +.TP +12288KB if more than 16MB of total video RAM is available, +.TP +8192KB if between 12 and 16MB of video RAM is available, +.TP +4096KB in all other cases. +.PP +Then you need to specify any of these amounts as the +parameter for the +.B \*qMaxXFBMem\*q +option. The value is to be given without 'KB'. +.SH "KNOWN BUGS" +For some reason, PAL TV output on the SiS301LV bridge is +only black and white. NTSC is OK, though. +.PP +LCD panels with a resolution of 1280x1024 do not work +correctly. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.PP +.B "http://www.winischhofer.net" +for more information and updates .SH AUTHORS Authors include: Alan Hourihane, Mike Chapman, Juanjo Santamarta, Mitani -Hiroshi, David Thomas, Sung-Ching Lin, Ademar Reis +Hiroshi, David Thomas, Sung-Ching Lin, Ademar Reis, Thomas Winischhofer Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.11 Fri Jan 11 10:37:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c Wed Jan 29 10:42:16 2003 @@ -1,14 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.11 2002/01/11 15:37:32 dawes Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.14 2003/01/29 15:42:16 eich Exp $ */ /* + * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620 + * + * Copyright Xavier Ducoin <x.ducoin@lectra.com> + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. * - * Acceleration for SiS300 SiS630 SiS540. - * It is done in a separate file because the register formats are - * very different from the previous chips. + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. * + * Authors: * - * * Xavier Ducoin <x.ducoin@lectra.com> + * Thomas Winischhofer <thomas@winischhofer.net> + * */ #if 0 #define DEBUG @@ -25,11 +44,19 @@ #include "sis.h" #include "sis300_accel.h" -#ifdef DEBUG -static void MMIODump(ScrnInfoPtr pScrn); +#ifdef SISDUALHEAD +/* TW: This is the offset to the memory for each head */ +#define HEADOFFSET (pSiS->dhmOffset) #endif + +#undef STSCE /* TW: Use/Don't use ScreenToScreenColorExpand - does not work */ + +#undef TRAP /* TW: Use/Don't use Trapezoid Fills - does not work - XAA provides + * illegal trapezoid data (left and right edges cross each other + * sometimes) which causes drawing errors. Further, I have not found + * out how to draw polygones with a height greater than 127... + */ -Bool SiS300AccelInit(ScreenPtr pScreen); static void SiSInitializeAccelerator(ScrnInfoPtr pScrn); static void SiSSync(ScrnInfoPtr pScrn); static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, @@ -42,6 +69,11 @@ int rop, unsigned int planemask); static void SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h); +#ifdef TRAP +static void SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR); +#endif static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, @@ -60,6 +92,13 @@ static void SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h); +#ifdef TRAP +static void SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ); +#endif #if 0 static void SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, @@ -68,11 +107,15 @@ static void SiSSubsequentColorPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h); +#endif +#if 0 static void SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void SiSSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); +#endif +#ifdef STSCE static void SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -80,20 +123,18 @@ int x, int y, int w, int h, int srcx, int srcy, int skipleft); #endif -static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, +static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask); static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, + int x, int y, int w, int h, int skipleft); static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -#if 0 -static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int trans_color, - int bpp, int depth); -static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h, int skipleft); + +#ifdef SISDUALHEAD +static void SiSRestoreAccelState(ScrnInfoPtr pScrn); #endif + static void SiSInitializeAccelerator(ScrnInfoPtr pScrn) { @@ -116,71 +157,74 @@ int i; pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) - return FALSE; + if (!infoPtr) return FALSE; SiSInitializeAccelerator(pScrn); infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; + OFFSCREEN_PIXMAPS | + PIXMAP_CACHE; /* sync */ infoPtr->Sync = SiSSync; - if ((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && - (pScrn->bitsPerPixel != 32)) return FALSE; + /* Acceleration only supported at 8, 16 and 32 bpp */ + if((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && + (pScrn->bitsPerPixel != 32)) + return FALSE; - /* BitBlt */ + /* screen to screen copy - TW: We now support transparent copies */ infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; + infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | + TRANSPARENCY_GXCOPY_ONLY; /* solid fills */ infoPtr->SetupForSolidFill = SiSSetupForSolidFill; infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; +#ifdef TRAP + infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap; +#endif infoPtr->SolidFillFlags = NO_PLANEMASK; /* solid line */ infoPtr->SetupForSolidLine = SiSSetupForSolidLine; infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; - infoPtr->SolidFillFlags = NO_PLANEMASK; + infoPtr->SolidLineFlags = NO_PLANEMASK; /* dashed line */ infoPtr->SetupForDashedLine = SiSSetupForDashedLine; infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; infoPtr->DashPatternMaxLength = 64; - infoPtr->DashedLineFlags = NO_PLANEMASK | - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; + infoPtr->DashedLineFlags = NO_PLANEMASK | + LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; /* 8x8 mono pattern fill */ infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - SiSSubsequentMonoPatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMonoPatternFill; +#ifdef TRAP + infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap; +#endif infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - NO_TRANSPARENCY | - BIT_ORDER_IN_BYTE_MSBFIRST ; + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS | + NO_TRANSPARENCY | + BIT_ORDER_IN_BYTE_MSBFIRST ; -#if 0 - /* 8x8 color pattern fill ---seems not useful by xaa */ - infoPtr->SetupForColor8x8PatternFill = - SiSSetupForColorPatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - SiSSubsequentColorPatternFill; - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS ; - +#ifdef STSCE /* Screen To Screen Color Expand */ + /* TW: The hardware does support this the way we need it */ infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; + SiSSetupForScreenToScreenColorExpand; infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpand; - - /* CPU To Screen Color Expand ---implement another instead of this one! */ + SiSSubsequentScreenToScreenColorExpand; + infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST ; +#endif + +#if 0 + /* CPU To Screen Color Expand --- implement another instead of this one! */ infoPtr->SetupForCPUToScreenColorExpandFill = SiSSetupForCPUToScreenColorExpand; infoPtr->SubsequentCPUToScreenColorExpandFill = @@ -195,62 +239,55 @@ HARDWARE_PATTERN_PROGRAMMED_BITS ; #endif - /* per-scanline color expansion*/ - pSiS->ColorExpandBufferNumber = 16; - pSiS->ColorExpandBufferCountMask = 0x0F; - pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; + /* per-scanline color expansion (using indirect method) */ + if(pSiS->VGAEngine == SIS_530_VGA) { + pSiS->ColorExpandBufferNumber = 4; + pSiS->ColorExpandBufferCountMask = 0x03; + } else { + pSiS->ColorExpandBufferNumber = 16; + pSiS->ColorExpandBufferCountMask = 0x0F; + } + pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0]; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiSSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = SiSSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = SiSSubsequentColorExpandScanline; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + SiSSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + SiSSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + SiSSubsequentColorExpandScanline; infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING; - -#if 0 - divider = ((pScrn->virtualX*pScrn->bitsPerPixel)/8)+8; - pSiS->ImageWriteBufferSize = (((12*1024)+divider-1)/divider)*divider; - infoPtr->SetupForImageWrite = SiSSetupForImageWrite; - infoPtr->SubsequentImageWriteRect = SiSSubsequentImageWriteRect; - infoPtr->ImageWriteFlags = CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - LEFT_EDGE_CLIPPING | - NO_PLANEMASK| - NO_TRANSPARENCY | - NO_GXCOPY | - SYNC_AFTER_IMAGE_WRITE; + +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + infoPtr->RestoreAccelState = SiSRestoreAccelState; + } #endif /* init Frame Buffer Manager */ - - /* TW: check if maxxfbmem must contain TurboQueue and HWCursor */ topFB = pSiS->maxxfbmem; - if ((topFB) - >= (pSiS->FbMapSize) - - ((pSiS->TurboQueue) ? (1024*512) : 0) - - ((pSiS->HWCursor) ? 4096 : 0)) { - topFB = pSiS->FbMapSize; - /* TurboQueue len is always 512k */ - if (pSiS->TurboQueue) topFB -= 1024*512; - /* HWCursor len is always 4096 */ - if (pSiS->HWCursor) topFB -= 4096; - } - reservedFbSize = (pSiS->ColorExpandBufferNumber - * pSiS->PerColorExpandBufferSize); - /* TW: New for MaxXFBmem Option */ - UsableFbSize = topFB - reservedFbSize; - /* Layout: - * |--------------++++++++++++++++++++^******==========~~~~~~~~~~~~| - * UsableFbSize ColorExpandBuffers | Heap HWCursor TurboQueue - * topFB + + reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize; + + UsableFbSize = topFB - reservedFbSize; + + /* Layout: (Sizes do not reflect correct proportions) + * |--------------++++++++++++++++++++^************==========~~~~~~~~~~~~| + * UsableFbSize ColorExpandBuffers | DRI-Heap | HWCursor TurboQueue 300/310/325 series + * |--------------++++++++++++++++++++| ====================~~~~~~~~~~~~| + * UsableFbSize ColorExpandBuffers | TurboQueue HWCursor 530/620 + * topFB */ + AvailBufBase = pSiS->FbBase + UsableFbSize; for (i = 0; i < pSiS->ColorExpandBufferNumber; i++) { - pSiS->ColorExpandBufferAddr[i] = AvailBufBase + + pSiS->ColorExpandBufferAddr[i] = AvailBufBase + i * pSiS->PerColorExpandBufferSize; pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize + i * pSiS->PerColorExpandBufferSize; @@ -258,17 +295,30 @@ Avail.x1 = 0; Avail.y1 = 0; Avail.x2 = pScrn->displayWidth; - Avail.y2 = UsableFbSize - / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1; - if (Avail.y2 < 0) - Avail.y2 = 32767; - + Avail.y2 = (UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8)) - 1; + + if(Avail.y2 < 0) Avail.y2 = 32767; + + if(Avail.y2 < pScrn->currentMode->VDisplay) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Not enough video RAM for accelerator. At least " + "%dKB needed, %dKB available\n", + ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* TW: +8 for make it sure */ + * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8, + pSiS->maxxfbmem/1024); + pSiS->NoAccel = TRUE; + pSiS->NoXvideo = TRUE; + XAADestroyInfoRec(pSiS->AccelInfoPtr); + pSiS->AccelInfoPtr = NULL; + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Frame Buffer From (%d,%d) To (%d,%d)\n", Avail.x1, Avail.y1, Avail.x2, Avail.y2); - + xf86InitFBManager(pScreen, &Avail); - + return(XAAInit(pScreen, infoPtr)); } @@ -283,8 +333,27 @@ pSiS->DoColorExpand = FALSE; SiSIdle } + +#ifdef SISDUALHEAD +static void +SiSRestoreAccelState(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + /* TW: We don't need to do anything special here; forcing the + * other head to re-read the CmdQueLen is not necessary: + * After the Sync in RestoreAccelState(), the real queue + * length is always larger than (or at least equal to) + * the amount stored in CmdQueueLen of the other head, + * so the only thing that might happen is one unnecessary + * Sync on the other head. I think we can live with that. + */ + pSiS->DoColorExpand = FALSE; + SiSIdle +} +#endif -static int sisALUConv[] = +static const int sisALUConv[] = { 0x00, /* dest = 0; 0, GXclear, 0 */ 0x88, /* dest &= src; DSa, GXand, 0x1 */ @@ -304,7 +373,7 @@ 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ }; /* same ROP but with Pattern as Source */ -static int sisPatALUConv[] = +static const int sisPatALUConv[] = { 0x00, /* dest = 0; 0, GXclear, 0 */ 0xA0, /* dest &= src; DPa, GXand, 0x1 */ @@ -329,58 +398,25 @@ unsigned int planemask, int trans_color) { SISPtr pSiS = SISPTR(pScrn); -/* XAAInfoRecPtr pXAA = XAAPTR(pScrn);*/ PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n", xdir, ydir, rop, planemask, trans_color)); -/* - ErrorF("XAAInfoPtr->UsingPixmapCache = %s\n" - "XAAInfoPtr->CanDoMono8x8 = %s\n" - "XAAInfoPtr->CanDoColor8x8 = %s\n" - "XAAInfoPtr->CachePixelGranularity = %d\n" - "XAAInfoPtr->MaxCacheableTileWidth = %d\n" - "XAAInfoPtr->MaxCacheableTileHeight = %d\n" - "XAAInfoPtr->MaxCacheableStippleWidth = %d\n" - "XAAInfoPtr->MaxCacheableStippleHeight = %d\n" - "XAAInfoPtr->MonoPatternPitch = %d\n" - "XAAInfoPtr->CacheWidthMono8x8Pattern = %d\n" - "XAAInfoPtr->CacheHeightMono8x8Pattern = %d\n" - "XAAInfoPtr->ColorPatternPitch = %d\n" - "XAAInfoPtr->CacheWidthColor8x8Pattern = %d\n" - "XAAInfoPtr->CacheHeightColor8x8Pattern = %d\n" - "XAAInfoPtr->CacheColorExpandDensity = %d\n" - "XAAInfoPtr->maxOffPixWidth = %d\n" - "XAAInfoPtr->maxOffPixHeight= %d\n" - "XAAInfoPtr->NeedToSync = %s\n" - "\n", - pXAA->UsingPixmapCache ? "True" : "False", - pXAA->CanDoMono8x8 ? "True" : "False", - pXAA->CanDoColor8x8 ? "True" : "False", - pXAA->CachePixelGranularity, - pXAA->MaxCacheableTileWidth, - pXAA->MaxCacheableTileHeight, - pXAA->MaxCacheableStippleWidth, - pXAA->MaxCacheableStippleHeight, - pXAA->MonoPatternPitch, - pXAA->CacheWidthMono8x8Pattern, - pXAA->CacheHeightMono8x8Pattern, - pXAA->ColorPatternPitch, - pXAA->CacheWidthColor8x8Pattern, - pXAA->CacheHeightColor8x8Pattern, - pXAA->CacheColorExpandDensity, - pXAA->maxOffPixWidth, - pXAA->maxOffPixHeight, - pXAA->NeedToSync ? "True" : "False"); -*/ - - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupSRCPitch(pSiS->scrnOffset) SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupROP(sisALUConv[rop]) - if (xdir > 0) { + + if(trans_color != -1) { + SiSSetupROP(0x0A) + SiSSetupSRCTrans(trans_color) + SiSSetupCMDFlag(TRANSPARENT_BITBLT) + } else { + SiSSetupROP(sisALUConv[rop]) + } + if(xdir > 0) { SiSSetupCMDFlag(X_INC) } - if (ydir > 0) { + if(ydir > 0) { SiSSetupCMDFlag(Y_INC) } } @@ -396,27 +432,35 @@ src_x, src_y, dst_x, dst_y, width, height)); srcbase = dstbase = 0; - if (src_y >= 2048) { + if(src_y >= 2048) { srcbase = pSiS->scrnOffset * src_y; src_y = 0; - } - if (dst_y >= pScrn->virtualY) { - dstbase = pSiS->scrnOffset*dst_y; + } + if( (dst_y >= pScrn->virtualY) || (dst_y >= 2048) ) { + dstbase = pSiS->scrnOffset * dst_y; dst_y = 0; - } + } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + srcbase += HEADOFFSET; + dstbase += HEADOFFSET; + } +#endif SiSSetupSRCBase(srcbase); SiSSetupDSTBase(dstbase); - if (!(pSiS->CommandReg & X_INC)) { + + if(!(pSiS->CommandReg & X_INC)) { src_x += width-1; dst_x += width-1; } - if (!(pSiS->CommandReg & Y_INC)) { + if(!(pSiS->CommandReg & Y_INC)) { src_y += height-1; dst_y += height-1; } SiSSetupRect(width, height) SiSSetupSRCXY(src_x, src_y) SiSSetupDSTXY(dst_x, dst_y) + SiSDoCMD } @@ -430,11 +474,10 @@ color, rop, planemask)); SiSSetupPATFG(color) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | PATFG | BITBLT) + /* SiSSetupCMDFlag(PATFG) - is zero */ } static void @@ -447,15 +490,136 @@ PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n", x, y, w, h)); dstbase = 0; - if (y >= 2048) { - dstbase=pSiS->scrnOffset*y; + + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; y = 0; } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif SiSSetupDSTBase(dstbase) SiSSetupDSTXY(x,y) SiSSetupRect(w,h) + /* Clear commandReg because Setup can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | + T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + TRAPAZOID_FILL); + SiSSetupCMDFlag(X_INC | Y_INC | BITBLT) + + SiSDoCMD +} + +/* TW: Trapezoid */ +/* This would work better if XAA would provide us with valid trapezoids. + * In fact, with small trapezoids the left and the right edge often cross + * each other or result in a line length of 0 which causes drawing errors + * (filling over whole scanline). + * Furthermore, I have not found out how to draw trapezoids with a height + * greater than 127. + */ +#ifdef TRAP +static void +SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; +#if 0 + float kL, kR; +#endif + + dstbase = 0; + if (y >= 2048) { + dstbase=pSiS->scrnOffset*y; + y = 0; + } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif + SiSSetupDSTBase(dstbase) + /* SiSSetupRect(w,h) */ + +#if 1 + SiSSetupPATFG(0xff0000) /* FOR TESTING */ +#endif + + /* Clear CommandReg because SetUp can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + T_XISMAJORL | T_XISMAJORR | + BITBLT); + + xf86DrvMsg(0, X_INFO, "Trap (%d %d %d %d) dxL %d dyL %d eL %d dxR %d dyR %d eR %d\n", + left, right, y, h, dxL, dyL, eL, dxR, dyR, eR); + + /* Unfortunately, we must check if the right and the left edge + * cross each other... INCOMPLETE (line equation wrong) + */ +#if 0 + if (dxL == 0) kL = 0; + else kL = (float)dyL / (float)dxL; + if (dxR == 0) kR = 0; + else kR = (float)dyR / (float)dxR; + xf86DrvMsg(0, X_INFO, "kL %f kR %f!\n", kL, kR); + if ( (kR != kL) && + (!(kR == 0 && kL == 0)) && + (!(kR < 0 && kL > 0)) ) { + xf86DrvMsg(0, X_INFO, "Inside if (%f - %d)\n", ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - left) + y), h+y); + if ( ( ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - (float)left) + (float)y) < (h + y) ) ) { + xf86DrvMsg(0, X_INFO, "Cross detected!\n"); + } + } +#endif + + /* Determine egde angles */ + if (dxL < 0) { dxL = -dxL; } + else { SiSSetupCMDFlag(T_L_X_INC) } + if (dxR < 0) { dxR = -dxR; } + else { SiSSetupCMDFlag(T_R_X_INC) } + + /* (Y direction always positive - do this anyway) */ + if (dyL < 0) { dyL = -dyL; } + else { SiSSetupCMDFlag(T_L_Y_INC) } + if (dyR < 0) { dyR = -dyR; } + else { SiSSetupCMDFlag(T_R_Y_INC) } + + /* Determine major axis */ + if (dxL >= dyL) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORL) + } + if (dxR >= dyR) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORR) + } + + /* Set up deltas */ + SiSSetupdL(dxL, dyL) + SiSSetupdR(dxR, dyR) + +#if 0 /* Could it be that this crappy engine can only draw trapezoids up to 127 pixels high? */ + h &= 0x7F; + if (h == 0) h = 10; +#endif + + /* Set up y, h, left, right */ + SiSSetupYH(y,h) + SiSSetupLR(left,right) + + /* Set up initial error term */ + SiSSetupEL(eL) + SiSSetupER(eR) + + SiSSetupCMDFlag(TRAPAZOID_FILL); + SiSDoCMD } +#endif static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, @@ -468,9 +632,8 @@ SiSSetupLineCount(1) SiSSetupPATFG(color) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupROP(sisPatALUConv[rop]) SiSSetupCMDFlag(PATFG | LINE) } @@ -488,17 +651,26 @@ dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; - if (maxy >= 2048) { - dstbase = pSiS->scrnOffset*miny; + if(maxy >= 2048) { + dstbase = pSiS->scrnOffset * miny; y1 -= miny; y2 -= miny; } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif SiSSetupDSTBase(dstbase) SiSSetupX0Y0(x1,y1) SiSSetupX1Y1(x2,y2) - if (flags & OMIT_LAST) + if (flags & OMIT_LAST) { SiSSetupCMDFlag(NO_LAST_PIXEL) + } else { + pSiS->CommandReg &= ~(NO_LAST_PIXEL); + } + SiSDoCMD } @@ -512,20 +684,26 @@ PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", x, y, len, dir)); len--; /* starting point is included! */ + dstbase = 0; - if ((y >= 2048) || ((y + len) >= 2048)) { + if((y >= 2048) || ((y + len) >= 2048)) { dstbase = pSiS->scrnOffset * y; y = 0; } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif SiSSetupDSTBase(dstbase) SiSSetupX0Y0(x,y) if (dir == DEGREES_0) { SiSSetupX1Y1(x + len, y); - } - else { + } else { SiSSetupX1Y1(x, y + len); } + SiSDoCMD } @@ -540,15 +718,19 @@ fg, bg, rop, planemask, length, *(pattern+4), *pattern)); SiSSetupLineCount(1) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupStyleLow(*pattern) SiSSetupStyleHigh(*(pattern+4)) + SiSSetupStylePeriod(length-1); /* TW: This was missing!!! */ SiSSetupROP(sisPatALUConv[rop]) SiSSetupPATFG(fg) - if (bg != -1) + SiSSetupCMDFlag(LINE | LINE_STYLE) /* TW: This was missing!!! */ + if(bg != -1) { SiSSetupPATBG(bg) + } else { + SiSSetupCMDFlag(TRANSPARENT); /* TW: This was missing!!! */ + } } static void @@ -563,20 +745,28 @@ x1, y1, x2, y2, flags, phase)); dstbase = 0; - miny=(y1 > y2) ? y2 : y1; - maxy=(y1 > y2) ? y1 : y2; - if (maxy >= 2048) { + miny = (y1 > y2) ? y2 : y1; + maxy = (y1 > y2) ? y1 : y2; + if(maxy >= 2048) { dstbase = pSiS->scrnOffset * miny; y1 -= miny; y2 -= miny; } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif SiSSetupDSTBase(dstbase) SiSSetupX0Y0(x1,y1) SiSSetupX1Y1(x2,y2) - if (flags & OMIT_LAST) { + if(flags & OMIT_LAST) { SiSSetupCMDFlag(NO_LAST_PIXEL) + } else { + pSiS->CommandReg &= ~(NO_LAST_PIXEL); } + SiSDoCMD } @@ -589,13 +779,12 @@ PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n", patx, paty, fg, bg, rop, planemask)); - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupMONOPAT(patx,paty) SiSSetupPATFG(fg) SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATMONO | X_INC | Y_INC) + SiSSetupCMDFlag(PATMONO) SiSSetupPATBG(bg) } @@ -610,18 +799,103 @@ PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", patx, paty, x, y, w, h)); dstbase = 0; - if (y >= 2048) { + + if (y >= 2048) { dstbase = pSiS->scrnOffset * y; y = 0; } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x, y) + SiSSetupRect(w, h) + /* Clear commandReg because Setup can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | + T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + TRAPAZOID_FILL); + SiSSetupCMDFlag(X_INC | Y_INC) + SiSDoCMD +} + +/* Trapezoid */ +#ifdef TRAP +static void +SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent Mono8x8PatternFillTrap(%d, %d, %d - %d %d/%d %d/%d)\n", + y, h, left, right, dxL, dxR, eL, eR)); + + dstbase = 0; + if (y >= 2048) { + dstbase=pSiS->scrnOffset*y; + y = 0; + } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif SiSSetupDSTBase(dstbase) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) + + /* Clear CommandReg because SetUp can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | + T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + BITBLT); + + if (dxL < 0) { dxL = -dxL; } + else { SiSSetupCMDFlag(T_L_X_INC) } + if (dxR < 0) { dxR = -dxR; } + else { SiSSetupCMDFlag(T_R_X_INC) } + + if (dyL < 0) { dyL = -dyL; } + else { SiSSetupCMDFlag(T_L_Y_INC) } + if (dyR < 0) { dyR = -dyR; } + else { SiSSetupCMDFlag(T_R_Y_INC) } + + /* Determine major axis */ + if (dxL >= dyL) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORL) + } + if (dxR >= dyR) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORR) + } + + SiSSetupYH(y,h) + SiSSetupLR(left,right) + + SiSSetupdL(dxL, dyL) + SiSSetupdR(dxR, dyR) + + SiSSetupEL(eL) + SiSSetupER(eR) + + SiSSetupCMDFlag(TRAPAZOID_FILL); + SiSDoCMD } +#endif + #if 0 + +/* TW: The following (already commented) functions have NOT been adapted for dual-head mode */ + + +/* ------- Color Pattern Fill --- is not useful for XAA -------------- */ + static void SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, @@ -635,7 +909,7 @@ /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupROP(sisPatALUConv[rop]) SiSSetupCMDFlag(PATPATREG | X_INC | Y_INC) } @@ -662,6 +936,11 @@ SiSDoCMD } +/* ----- CPU To Screen Color Expand (single task) ------------------------- */ + +/* This does not work. Assumingly for the same + * reason why STSColorExpand does not work either. + */ static void SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, @@ -674,7 +953,7 @@ /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupSRCXY(0,0) SiSSetupSRCFG(fg) SiSSetupROP(sisPatALUConv[rop]) @@ -711,7 +990,13 @@ /* SiSDoCMD*/ pSiS->DoColorExpand = TRUE; } +#endif + +/* ------ Screen To Screen Color Expand ------------------------------- */ +/* TW: The hareware does not seem to support this the way we need it */ + +#ifdef STSCE static void SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, @@ -722,62 +1007,291 @@ PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n", fg, bg, rop)); - SiSSetupDSTBase(0) -/* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ + SiSSetupDSTColorDepth(pSiS->DstColor) SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCFG(fg) - SiSSetupSRCBG(bg) - SiSSetupSRCXY(0,0) SiSSetupROP(sisALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | ENCOLOREXP) + SiSSetupSRCFG(fg) + /* SiSSetupSRCXY(0,0) */ + + if(bg == -1) { + SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | X_INC | + Y_INC | SRCVIDEO); + } else { + SiSSetupSRCBG(bg); + SiSSetupCMDFlag(ENCOLOREXP | X_INC | Y_INC | + SRCVIDEO); + }; } +#endif + +/* TW. This method blits in a single task; this does not seem to work + * because the hardware does not use the source pitch as scanline + * offset but only to calculate pattern address from source X and Y. + * XAA provides the pattern bitmap with scrnOffset (displayWidth * bpp/8) + * offset, but this does not seem to be supported by the hardware. + */ +#ifdef STSCE +/* For testing, these are the methods: (use only one at a time!) */ + +#undef npitch /* Normal: Use srcx/y as srcx/y, use scrnOffset as source pitch + * This would work if the hareware used the source pitch for + * incrementing the source address after each scanline - but + * it doesn't do this! The first line of the area is correctly + * color expanded, but since the source pitch is ignored and + * the source address not incremented correctly, the following + * lines are color expanded with any bit pattern that is left + * in the unused space of the source bitmap (which is organized + * with the depth of the screen framebuffer hence with a pitch + * of scrnOffset). + */ + +#undef pitchdw /* Use source pitch "displayWidth / 8" instead + * of scrnOffset (=displayWidth * bpp / 8) + * This can't work, because the pitch of the source + * bitmap is scrnoffset! + */ + +#define nopitch /* Calculate srcbase with srcx and srcy, set the + * pitch to scrnOffset (which IS the correct pitch + * for the source bitmap) and set srcx and srcy both + * to 0. + * This would work if the hareware used the source pitch for + * incrementing the source address after each scanline - but + * it doesn't do this! Again: The first line of the area is + * correctly color expanded, but since the source pitch is + * ignored for scanline address incremention, the following + * lines are not correctly color expanded. + * WHATEVER I write to source pitch is ignored! + */ + static void SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); + long srcbase, dstbase; +#if 0 + int _x0, _y0, _x1, _y1; +#endif +#ifdef pitchdw + int newsrcx, newsrcy; - PDEBUG(ErrorF("Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", - x, y, w, h, srcx, srcy, skipleft)); + /* srcx and srcy are provided based on a scrnOffset pitch ( = displayWidth * bpp / 8 ) + * We recalulate srcx and srcy based on pitch = displayWidth / 8 + */ + newsrcy = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) / + (pScrn->displayWidth/8); + newsrcx = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) % + (pScrn->displayWidth/8); +#endif + xf86DrvMsg(0, X_INFO, "Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", + x, y, w, h, srcx, srcy, skipleft); - SiSSetupSRCPitch(((w+31)&0xFFE0)/8) - SiSSetupDSTXY(x,y) + srcbase = dstbase = 0; + +#ifdef pitchdw + if (newsrcy >= 2048) { + srcbase = (pScrn->displayWidth / 8) * newsrcy; + newsrcy = 0; + } +#endif +#ifdef nopitch + srcbase = (pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8)); +#endif +#ifdef npitch + if (srcy >= 2048) { + srcbase = pSiS->scrnOffset * srcy; + srcy = 0; + } +#endif + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + srcbase += HEADOFFSET; + dstbase += HEADOFFSET; + } +#endif + SiSSetupSRCBase(srcbase) + SiSSetupDSTBase(dstbase) + +#ifdef pitchdw + SiSSetupSRCPitch(pScrn->displayWidth/8) +#endif +#ifdef nopitch + SiSSetupSRCPitch(pSiS->scrnOffset) + /* SiSSetupSRCPitch(100) */ /* For test - has NO effect WHATSOEVER */ +#endif +#ifdef npitch + SiSSetupSRCPitch(pSiS->scrnOffset) +#endif + SiSSetupRect(w,h) + +#if 0 /* How do I implement the offset? Not this way, that's for sure.. */ + if (skipleft > 0) { + _x0 = x+skipleft; + _y0 = y; + _x1 = x+w; + _y1 = y+h; + SiSSetupClipLT(_x0, _y0); + SiSSetupClipRB(_x1, _y1); + SiSSetupCMDFlag(CLIPENABLE); + } +#endif +#ifdef pitchdw + SiSSetupSRCXY(newsrcx, newsrcy) +#endif +#ifdef nopitch + SiSSetupSRCXY(0,0) +#endif +#ifdef npitch + SiSSetupSRCXY(srcx, srcy) +#endif + + SiSSetupDSTXY(x,y) + SiSDoCMD } #endif -static void -SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) +/* TW: TEST: Do it scanline-wise because the other way does not seem to + * be supported by the hardware. (The source pitch seems to be + * displayWidth * (bbp/8) as opposed by the XAA HOWTO, where + * it is stated that the pitch would be displayWidth pixels; + * besides, the hardware seems to ignore the source pitch + * for address increments.) + * Apart from this (which can be solved by doing the color + * expand scanline-wise), I don't know how to implement the + * offset argument. The current method (which uses hardware + * clipping) does not work. + * + * THIS DOES NOT WORK IN THE CURRENT STATE. + */ +#if 0 +static void +SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int srcx, int srcy, int offset) { + SISPtr pSiS = SISPTR(pScrn); + long srcbase, dstbase; + int _x0, _y0, _x1, _y1; + + int newsrcx, newsrcy; + + newsrcy = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) / + (((((w+7)/8)+3) >> 2) * 4); + /* (pScrn->displayWidth/8); */ + newsrcx = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) % + (((((w+7)/8)+3) >> 2) * 4); + /* (pScrn->displayWidth/8); */ + + xf86DrvMsg(0, X_INFO, "Sub STS CE(%d,%d, %d,%d, %d,%d, %d)\n", + x, y, w, h, srcx, srcy, skipleft); + + srcbase = dstbase = 0; + if (newsrcy >= 2048) { + srcbase = (((((w+7)/8)+3) >> 2) * 4) * newsrcy; + /* (pScrn->displayWidth/8) * newsrcy; */ + /* pSiS->scrnOffset * srcy; */ + newsrcy = 0; + } + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } +#ifdef SISDUALHEAD + srcbase += HEADOFFSET; + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + + SiSSetupRect(w, 1) + + SiSSetupSRCXY(newsrcx, newsrcy) + + /* SiSSetupSRCPitch(pScrn->displayWidth/8) */ /* old: (((w+31)&0xFFE0)/8) */ + SiSSetupSRCPitch(((((w+7)/8)+3) >> 2) * 4) +#if 1 + if (offset > 0) { + SiSSetupCMDFlag(CLIPENABLE) + } else + pSiS->CommandReg &= ~CLIPENABLE; +#endif + + while (h) { + + SiSSetupSRCBase(srcbase) +#if 1 + if (offset > 0) { + _x0 = x+skipleft; + _y0 = y; + _x1 = x+w; + _y1 = y+h; + SiSSetupClipLT(_x0, _y0); + SiSSetupClipRB(_x1, _y1); + } +#endif + SiSSetupDSTXY(x,y) + + SiSDoCMD + + srcbase += ((((w+7)/8)+3) >> 2) * 4 * 8* ((pScrn->bitsPerPixel+7)/8); + /* pSiS->scrnOffset; */ + y++; + h--; + } +} +#endif + + +/* ----- CPU To Screen Color Expand (scanline-wise) ----------------- */ + +/* We do it using the indirect method */ + +static void +SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask) +{ SISPtr pSiS=SISPTR(pScrn); - - while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00)!=0) {} + + /* TW: Make sure that current CPU-driven BitBlt buffer stage is 0 + * This is required!!! (Otherwise -> drawing errors) + */ + while((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */ + +#if 0 /* TW: This is obviously not needed */ pSiS->ColorExpandRingHead = 0; pSiS->ColorExpandRingTail = pSiS->ColorExpandBufferNumber - 1; +#endif + SiSSetupSRCXY(0,0); SiSSetupROP(sisALUConv[rop]); SiSSetupSRCFG(fg); SiSSetupDSTRect(pSiS->scrnOffset, -1); SiSSetupDSTColorDepth(pSiS->DstColor); - if (bg == -1) { - SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | X_INC | - Y_INC|SRCSYSTEM); - } - else { + if(bg == -1) { + SiSSetupCMDFlag(TRANSPARENT | + ENCOLOREXP | + X_INC | Y_INC | + SRCCPUBLITBUF); + } else { SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP | X_INC | Y_INC | - SRCSYSTEM); - }; + SiSSetupCMDFlag(ENCOLOREXP | + X_INC | Y_INC | + SRCCPUBLITBUF); + } } + -static int srcpitch; -static int xcurrent, ycurrent; -static void SiSSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, int x, int y, int w, +static void +SiSSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { SISPtr pSiS = SISPTR(pScrn); @@ -786,72 +1300,98 @@ dstbase = 0; if (y >= 2048) { - dstbase = pSiS->scrnOffset*y; + dstbase = pSiS->scrnOffset * y; y = 0; } +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + dstbase += HEADOFFSET; + } +#endif + + /* TW: Wait until there is no color expansion command in queue + * (This solves the OpenOffice.org window-move bug) + * Added Idle-check - bit 23 is set sometimes, although + * engine is actually idle! + * Update: Bit 23 is not reliable. After heavy 3D engine + * action, this bit never gets cleared again. So do + * SiSIdle instead. + */ + if((MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { + /* while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ + SiSIdle + } + SiSSetupDSTBase(dstbase) if (skipleft > 0) { - _x0 = x+skipleft; + _x0 = x + skipleft; _y0 = y; - _x1 = x+w; - _y1 = y+h; + _x1 = x + w; + _y1 = y + h; SiSSetupClipLT(_x0, _y0); SiSSetupClipRB(_x1, _y1); - SiSSetupCMDFlag(CLIPENABLE); - } + SiSSetupCMDFlag(CLIPENABLE); + } else { + pSiS->CommandReg &= (~CLIPENABLE); + } + SiSSetupRect(w, 1); - srcpitch = ((((w+7)/8)+3) >> 2) * 4; - SiSSetupSRCPitch(srcpitch); - ycurrent = y; - xcurrent = x; + SiSSetupSRCPitch(((((w+7)/8)+3) >> 2) * 4); + pSiS->xcurrent = x; + pSiS->ycurrent = y; } -static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +static void +SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { - SISPtr pSiS=SISPTR(pScrn); + SISPtr pSiS=SISPTR(pScrn); +#if 0 int newhead,bltbufstage,newtail; +#endif + long cbo; - SiSSetupSRCBase(pSiS->ColorExpandBufferScreenOffset[bufno]); - SiSSetupDSTXY(xcurrent, ycurrent); - ycurrent++; - SiSDoCMD - newhead = pSiS->ColorExpandRingHead = (bufno + 1) & - pSiS->ColorExpandBufferCountMask; - while (newhead == pSiS->ColorExpandRingTail) { - bltbufstage = (int)((MMIO_IN16(pSiS->IOBase,0x8242) & - 0x1F00)>>8); - newtail = newhead - (bltbufstage + 1); - pSiS->ColorExpandRingTail = (newtail >= 0) ? - newtail: (pSiS->ColorExpandBufferNumber+newtail); + cbo = pSiS->ColorExpandBufferScreenOffset[bufno]; +#ifdef SISDUALHEAD + if(pSiS->VGAEngine != SIS_530_VGA) { + cbo += HEADOFFSET; } -} +#endif -#if 0 -static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int trans_color, int bpp, int depth) -{ - return; -} + /* TW: Wait until there is no color expansion command in queue + * (This solves the GTK-big-font bug) + * Added Idle-check - bit 23 is set sometimes, although + * engine is actually idle! + * Update: Bit 23 is not reliable. After heavy 3D engine + * action, this bit never gets cleared again. So do + * SiSIdle instead. + */ + if((MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { + /* while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ + SiSIdle + } -static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) -{ - return; -} -#endif + SiSSetupSRCBase(cbo); -#ifdef DEBUG -static void -MMIODump(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - int i; + SiSSetupDSTXY(pSiS->xcurrent, pSiS->ycurrent); - SiSIdle - for (i=0x8200; i <= 0x823c; i += 4) { - ErrorF("[%x] %0X \n", i, - MMIO_IN32(pSiS->IOBase,i)); + SiSDoCMD + + pSiS->ycurrent++; + + if(pSiS->VGAEngine == SIS_530_VGA) { + while(MMIO_IN8(pSiS->IOBase, 0x8242) & 0x80) {} } -} + +#if 0 /* TW: What is this good for? The Head/Tail data is never ever used elsewhere! */ + pSiS->ColorExpandRingHead = newhead = + (bufno + 1) & pSiS->ColorExpandBufferCountMask; + while (newhead == pSiS->ColorExpandRingTail) { + bltbufstage = (int)((MMIO_IN16(pSiS->IOBase,0x8242) & 0x1F00) >> 8); + newtail = newhead - (bltbufstage + 1); + pSiS->ColorExpandRingTail = (newtail >= 0) ? + newtail : (pSiS->ColorExpandBufferNumber + newtail); + } #endif +} + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.5 Fri Jan 11 10:37:33 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h Wed Jan 29 10:42:16 2003 @@ -1,5 +1,9 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.8 2003/01/29 15:42:16 eich Exp $ */ /* + * 2D acceleration for SiS530/620 and 300 series + * * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2002 Thomas Winischhofer, Vienna, Austria * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -25,46 +29,61 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. * Xavier Ducoin <x.ducoin@lectra.com> + * Thomas Winischhofer <thomas@winischhofer.net> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.5 2002/01/11 15:37:33 dawes Exp $ */ /* Definitions for the SIS engine communication. */ -#define PATREGSIZE 384 +#define PATREGSIZE 384 /* Pattern register size. 384 bytes @ 0x8300 */ #define BR(x) (0x8200 | (x) << 2) #define PBR(x) (0x8300 | (x) << 2) -/* Definitions for the SiS300 engine command */ -#define BITBLT 0x00000000 -#define COLOREXP 0x00000001 -#define ENCOLOREXP 0x00000002 -#define MULTIPLE_SCANLINE 0x00000003 -#define LINE 0x00000004 -#define TRAPAZOID_FILL 0x00000005 -#define TRANSPARENT_BITBLT 0x00000006 - -#define SRCVIDEO 0x00000000 -#define SRCSYSTEM 0x00000010 -#define SRCAGP 0x00000020 - -#define PATFG 0x00000000 -#define PATPATREG 0x00000040 -#define PATMONO 0x00000080 +/* SiS300 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 */ + +/* 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 */ #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 +/* Trapezoid */ +#define T_XISMAJORL 0x00800000 /* X axis is driving axis (left) */ +#define T_XISMAJORR 0x01000000 /* X axis is driving axis (right) */ +#define T_L_Y_INC Y_INC /* left edge direction Y */ +#define T_L_X_INC X_INC /* left edge direction X */ +#define T_R_Y_INC 0x00400000 /* right edge direction Y */ +#define T_R_X_INC 0x00200000 /* right edge direction X */ + +/* ? */ #define DSTAGP 0x02000000 #define DSTVIDEO 0x02000000 @@ -73,93 +92,117 @@ #define NO_RESET_COUNTER 0x00400000 #define NO_LAST_PIXEL 0x00200000 + /* Macros to do useful things with the SIS BitBLT engine */ -/* +/* BR(16) (0x8240): + 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 (530/620: 12:0) + */ /* TW: BR(16)+2 = 0x8242 */ -static int CmdQueLen; +#define CmdQueLen pSiS->cmdQueueLen #define SiSIdle \ { \ while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - CmdQueLen=MMIO_IN16(pSiS->IOBase, 0x8240); \ + CmdQueLen = (MMIO_IN16(pSiS->IOBase, 0x8240) & pSiS->CmdQueLenMask) - pSiS->CmdQueLenFix; \ } /* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */ #define SiSSetupSRCBase(base) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(0), base);\ - CmdQueLen --; - + CmdQueLen--; #define SiSSetupSRCPitch(pitch) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT16(pSiS->IOBase, BR(1), pitch);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupSRCXY(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(2), (x)<<16 | (y) );\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupDSTBase(base) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(4), base);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupDSTXY(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(3), (x)<<16 | (y) );\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupDSTRect(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(5), (y)<<16 | (x) );\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupDSTColorDepth(bpp) \ - if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, BR(1)+2, bpp);\ - CmdQueLen --; + if(pSiS->VGAEngine != SIS_530_VGA) { \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, BR(1)+2, bpp);\ + CmdQueLen--; \ + } #define SiSSetupRect(w,h) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(6), (h)<<16 | (w) );\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupPATFG(color) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(7), color);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupPATBG(color) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(8), color);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupSRCFG(color) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(9), color);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupSRCBG(color) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(10), color);\ - CmdQueLen --; + CmdQueLen--; + +/* 0x8224 src colorkey high */ +/* 0x8228 src colorkey low */ +/* 0x821c dest colorkey high */ +/* 0x8220 dest colorkey low */ +#define SiSSetupSRCTrans(color) \ + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x8224, color);\ + MMIO_OUT32(pSiS->IOBase, 0x8228, color);\ + CmdQueLen -= 2; + +#define SiSSetupDSTTrans(color) \ + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x821C, color); \ + MMIO_OUT32(pSiS->IOBase, 0x8220, color); \ + CmdQueLen -= 2; #define SiSSetupMONOPAT(p0,p1) \ if (CmdQueLen <= 1) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(11), p0);\ MMIO_OUT32(pSiS->IOBase, BR(12), p1);\ - CmdQueLen =CmdQueLen-2; + CmdQueLen -= 2; #define SiSSetupClipLT(left,top) \ if (CmdQueLen <= 0) SiSIdle;\ @@ -169,46 +212,86 @@ #define SiSSetupClipRB(right,bottom) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ - CmdQueLen --; + CmdQueLen--; +/* General */ #define SiSSetupROP(rop) \ - pSiS->CommandReg = (rop) << 8; + pSiS->CommandReg = (rop) << 8; #define SiSSetupCMDFlag(flags) \ - pSiS->CommandReg |= (flags); + pSiS->CommandReg |= (flags); #define SiSDoCMD \ if (CmdQueLen <= 1) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(15), pSiS->CommandReg); \ - MMIO_OUT32(pSiS->IOBase, BR(16), 0);\ - CmdQueLen =CmdQueLen-2; + CmdQueLen--; \ + if(pSiS->VGAEngine != SIS_530_VGA) { \ + MMIO_OUT32(pSiS->IOBase, BR(16), 0);\ + CmdQueLen--; \ + } else { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, BR(16)); \ + } \ +/* Line */ #define SiSSetupX0Y0(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(2), (y)<<16 | (x) );\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupX1Y1(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(3), (y)<<16 | (x) );\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupLineCount(c) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT16(pSiS->IOBase, BR(6), c);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupStylePeriod(p) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT16(pSiS->IOBase, BR(6)+2, p);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupStyleLow(ls) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(11), ls);\ - CmdQueLen --; + CmdQueLen--; #define SiSSetupStyleHigh(ls) \ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(12), ls);\ - CmdQueLen --; + CmdQueLen--; + +/* TW: Trapezoid */ +#define SiSSetupYH(y,h) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x8208, (y)<<16 | (h) );\ + CmdQueLen--; + +#define SiSSetupLR(left,right) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x820C, (right)<<16 | (left) );\ + CmdQueLen--; + +#define SiSSetupdL(dxL,dyL) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x8244, (dyL)<<16 | (dxL) );\ + CmdQueLen--; + +#define SiSSetupdR(dxR,dyR) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x8248, (dyR)<<16 | (dxR) );\ + CmdQueLen--; + +#define SiSSetupEL(eL) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x824C, eL);\ + CmdQueLen--; + +#define SiSSetupER(eR) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, 0x8250, eR);\ + CmdQueLen--; + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c:1.2 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c Wed Jan 29 10:42:16 2003 @@ -0,0 +1,894 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.2 2003/01/29 15:42:16 eich Exp $ */ +/* + * 2D Acceleration for SiS 310/325 series (315, 550, 650, 740, M650, 651) + * + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Thomas Winischhofer not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Winischhofer makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS WINISCHHOFER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS WINISCHHOFER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Based on sis300_accel.c + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "compiler.h" +#include "xaa.h" + +#include "sis.h" +#include "sis310_accel.h" + +#ifdef SISDUALHEAD +/* TW: This is the offset to the memory for each head */ +#define HEADOFFSET (pSiS->dhmOffset) +#endif + +#undef TRAP /* TW: Use/Don't use Trapezoid Fills - does not work - XAA provides + * illegal trapezoid data (left and right edges cross each other + * sometimes) which causes drawing errors. + */ + +#define CTSCE /* Use/Don't use CPUToScreenColorExpand. */ + +/* Accelerator functions */ +static void SiSInitializeAccelerator(ScrnInfoPtr pScrn); +static void SiSSync(ScrnInfoPtr pScrn); +static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, int trans_color); +static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, + int width, int height); +static void SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask); +static void SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h); +#ifdef TRAP +static void SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR); +#endif +static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask); +static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, + int y1, int x2, int y2, int flags); +static void SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, + int x, int y, int len, int dir); +static void SiSSetupForDashedLine(ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask, + int length, unsigned char *pattern); +static void SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, + int flags, int phase); +static void SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, + int patx, int paty, int fg, int bg, + int rop, unsigned int planemask); +static void SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, + int patx, int paty, + int x, int y, int w, int h); +#ifdef TRAP +static void SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR); +#endif +#ifdef CTSCE +static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask); +static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft); +static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#endif + +#ifdef SISDUALHEAD +static void SiSRestoreAccelState(ScrnInfoPtr pScrn); +#endif + +static void +SiSInitializeAccelerator(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + pSiS->DoColorExpand = FALSE; +} + +Bool +SiS310AccelInit(ScreenPtr pScreen) +{ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + int topFB; + int reservedFbSize; + int UsableFbSize; + unsigned char *AvailBufBase; + BoxRec Avail; + int i; + + pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); + if (!infoPtr) + return FALSE; + + SiSInitializeAccelerator(pScrn); + + infoPtr->Flags = LINEAR_FRAMEBUFFER | + OFFSCREEN_PIXMAPS | + PIXMAP_CACHE; + + /* sync */ + infoPtr->Sync = SiSSync; + + if ((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && + (pScrn->bitsPerPixel != 32)) + return FALSE; + + /* BitBlt */ + infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; + infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | TRANSPARENCY_GXCOPY_ONLY; + /*| NO_TRANSPARENCY; */ + + /* solid fills */ + infoPtr->SetupForSolidFill = SiSSetupForSolidFill; + infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; +#ifdef TRAP + infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap; +#endif + infoPtr->SolidFillFlags = NO_PLANEMASK; + + /* solid line */ + infoPtr->SetupForSolidLine = SiSSetupForSolidLine; + infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; + infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; + infoPtr->SolidLineFlags = NO_PLANEMASK; + + /* dashed line */ + infoPtr->SetupForDashedLine = SiSSetupForDashedLine; + infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; + infoPtr->DashPatternMaxLength = 64; + infoPtr->DashedLineFlags = NO_PLANEMASK | + LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; + + /* 8x8 mono pattern fill */ + infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMonoPatternFill; +#ifdef TRAP + infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap; +#endif + infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS | + NO_TRANSPARENCY | + BIT_ORDER_IN_BYTE_MSBFIRST ; + +#if 0 + /* Screen To Screen Color Expand */ + /* TW: The hardware does not seem to support this the way we need it */ + infoPtr->SetupForScreenToScreenColorExpandFill = + SiSSetupForScreenToScreenColorExpand; + infoPtr->SubsequentScreenToScreenColorExpandFill = + SiSSubsequentScreenToScreenColorExpand; + infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST ; +#endif + + /* per-scanline color expansion - indirect method */ + pSiS->ColorExpandBufferNumber = 16; + pSiS->ColorExpandBufferCountMask = 0x0F; + pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; +#ifdef CTSCE + infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; + infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0]; + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiSSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = SiSSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = SiSSubsequentColorExpandScanline; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + NO_PLANEMASK | + CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST | + LEFT_EDGE_CLIPPING; +#endif + +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + infoPtr->RestoreAccelState = SiSRestoreAccelState; + } +#endif + + /* init Frame Buffer Manager */ + + topFB = pSiS->maxxfbmem; + + reservedFbSize = (pSiS->ColorExpandBufferNumber + * pSiS->PerColorExpandBufferSize); + /* TW: New for MaxXFBmem Option */ + UsableFbSize = topFB - reservedFbSize; + /* Layout: + * |--------------++++++++++++++++++++^************==========~~~~~~~~~~~~| + * UsableFbSize ColorExpandBuffers | DRI-Heap HWCursor CommandQueue + * topFB + */ + AvailBufBase = pSiS->FbBase + UsableFbSize; + for (i = 0; i < pSiS->ColorExpandBufferNumber; i++) { + pSiS->ColorExpandBufferAddr[i] = AvailBufBase + + i * pSiS->PerColorExpandBufferSize; + pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize + + i * pSiS->PerColorExpandBufferSize; + } + Avail.x1 = 0; + Avail.y1 = 0; + Avail.x2 = pScrn->displayWidth; + Avail.y2 = UsableFbSize + / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1; + if (Avail.y2 < 0) + Avail.y2 = 32767; + if (Avail.y2 < pScrn->currentMode->VDisplay) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Not enough video RAM for accelerator. At least " + "%dKB needed, %dKB available\n", + ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* TW: +8 for make it sure */ + * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8, + pSiS->maxxfbmem/1024); + pSiS->NoAccel = TRUE; + pSiS->NoXvideo = TRUE; + XAADestroyInfoRec(pSiS->AccelInfoPtr); + pSiS->AccelInfoPtr = NULL; + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Frame Buffer From (%d,%d) To (%d,%d)\n", + Avail.x1, Avail.y1, Avail.x2, Avail.y2); + + xf86InitFBManager(pScreen, &Avail); + + return(XAAInit(pScreen, infoPtr)); +} + +static void +SiSSync(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("SiSSync()\n")); + + pSiS->DoColorExpand = FALSE; + SiSIdle +} + +#ifdef SISDUALHEAD +static void +SiSRestoreAccelState(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + /* TW: We don't need to do anything special here */ + pSiS->DoColorExpand = FALSE; + SiSIdle +} +#endif + +static const int sisALUConv[] = +{ + 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 sisPatALUConv[] = +{ + 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 */ +}; + +static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, int trans_color) +{ + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n", + xdir, ydir, rop, planemask, trans_color)); + + /* "AGP base" - color depth depending value (see sis_vga.c) */ + SiSSetupDSTColorDepth(pSiS->DstColor); + /* SRC pitch */ + SiSSetupSRCPitch(pSiS->scrnOffset) + /* DST pitch and height (-1 for disabling merge-clipping) */ + SiSSetupDSTRect(pSiS->scrnOffset, -1) + /* Init CommandReg and set ROP */ + if (trans_color != -1) { + SiSSetupROP(0x0A) + SiSSetupSRCTrans(trans_color) + SiSSetupCMDFlag(TRANSPARENT_BITBLT) + } else { + SiSSetupROP(sisALUConv[rop]) + /* Set command - not needed, both 0 */ + /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */ + } + /* Set some color depth depending value (see sis_vga.c) */ + SiSSetupCMDFlag(pSiS->SiS310_AccelDepth) + + /* TW: The 310/325 series is smart enough to know the direction */ +} + +static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int src_x, int src_y, int dst_x, int dst_y, + int width, int height) +{ + SISPtr pSiS = SISPTR(pScrn); + long srcbase, dstbase; + + PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n", + src_x, src_y, dst_x, dst_y, width, height)); + + srcbase = dstbase = 0; + if (src_y >= 2048) { + srcbase = pSiS->scrnOffset * src_y; + src_y = 0; + } + if ((dst_y >= pScrn->virtualY) || (dst_y >= 2048)) { + dstbase = pSiS->scrnOffset*dst_y; + dst_y = 0; + } +#ifdef SISDUALHEAD + srcbase += HEADOFFSET; + dstbase += HEADOFFSET; +#endif + SiSSetupSRCBase(srcbase); + SiSSetupDSTBase(dstbase); + SiSSetupRect(width, height) + SiSSetupSRCXY(src_x, src_y) + SiSSetupDSTXY(dst_x, dst_y) + SiSDoCMD +} + +static void +SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask) +{ + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup SolidFill(0x%x, 0x%x, 0x%x)\n", + color, rop, planemask)); + + SiSSetupPATFG(color) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(pSiS->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATFG | pSiS->SiS310_AccelDepth) +} + +static void +SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n", + x, y, w, h)); + dstbase = 0; + if (y >= 2048) { + dstbase=pSiS->scrnOffset*y; + y = 0; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | + T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + TRAPAZOID_FILL); + SiSSetupCMDFlag(BITBLT) + SiSDoCMD +} + +/* TW: Trapezoid */ +/* This would work better if XAA would provide us with valid trapezoids. + * In fact, with small trapezoids the left and the right edge often cross + * each other which causes drawing errors (filling over whole scanline). + */ +#ifdef TRAP +static void +SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; +#if 0 + float kL, kR; +#endif + + dstbase = 0; + if (y >= 2048) { + dstbase=pSiS->scrnOffset*y; + y = 0; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + +#if 1 + SiSSetupPATFG(0xff0000) /* FOR TESTING */ +#endif + + /* Clear CommandReg because SetUp can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + T_XISMAJORL | T_XISMAJORR | + BITBLT); + + xf86DrvMsg(0, X_INFO, "Trap (%d %d %d %d) dxL %d dyL %d eL %d dxR %d dyR %d eR %d\n", + left, right, y, h, dxL, dyL, eL, dxR, dyR, eR); + + /* Unfortunately, we must check if the right and the left edge + * cross each other... INCOMPLETE (equation wrong) + */ +#if 0 + if (dxL == 0) kL = 0; + else kL = (float)dyL / (float)dxL; + if (dxR == 0) kR = 0; + else kR = (float)dyR / (float)dxR; + xf86DrvMsg(0, X_INFO, "kL %f kR %f!\n", kL, kR); + if ( (kR != kL) && + (!(kR == 0 && kL == 0)) && + (!(kR < 0 && kL > 0)) ) { + xf86DrvMsg(0, X_INFO, "Inside if (%f - %d)\n", ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - left) + y), h+y); + if ( ( ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - (float)left) + (float)y) < (h + y) ) ) { + xf86DrvMsg(0, X_INFO, "Cross detected!\n"); + } + } +#endif + + /* Determine egde angles */ + if (dxL < 0) { dxL = -dxL; } + else { SiSSetupCMDFlag(T_L_X_INC) } + if (dxR < 0) { dxR = -dxR; } + else { SiSSetupCMDFlag(T_R_X_INC) } + + /* (Y direction always positive - do this anyway) */ + if (dyL < 0) { dyL = -dyL; } + else { SiSSetupCMDFlag(T_L_Y_INC) } + if (dyR < 0) { dyR = -dyR; } + else { SiSSetupCMDFlag(T_R_Y_INC) } + + /* Determine major axis */ + if (dxL >= dyL) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORL) + } + if (dxR >= dyR) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORR) + } + + /* Set up deltas */ + SiSSetupdL(dxL, dyL) + SiSSetupdR(dxR, dyR) + + /* Set up y, h, left, right */ + SiSSetupYH(y,h) + SiSSetupLR(left,right) + + /* Set up initial error term */ + SiSSetupEL(eL) + SiSSetupER(eR) + + SiSSetupCMDFlag(TRAPAZOID_FILL); + + SiSDoCMD +} +#endif + +static void +SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask) +{ + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n", + color, rop, planemask)); + + SiSSetupLineCount(1) + SiSSetupPATFG(color) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(pSiS->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATFG | LINE | pSiS->SiS310_AccelDepth) +} + +static void +SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, int flags) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase,miny,maxy; + + PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n", + x1, y1, x2, y2, flags)); + + dstbase = 0; + miny = (y1 > y2) ? y2 : y1; + maxy = (y1 > y2) ? y1 : y2; + if (maxy >= 2048) { + dstbase = pSiS->scrnOffset*miny; + y1 -= miny; + y2 -= miny; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + + SiSSetupX0Y0(x1,y1) + SiSSetupX1Y1(x2,y2) + if (flags & OMIT_LAST) { + SiSSetupCMDFlag(NO_LAST_PIXEL) + } else { + pSiS->CommandReg &= ~(NO_LAST_PIXEL); + } + SiSDoCMD +} + +static void +SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, + int x, int y, int len, int dir) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", + x, y, len, dir)); + + len--; /* starting point is included! */ + dstbase = 0; + if ((y >= 2048) || ((y + len) >= 2048)) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + + SiSSetupX0Y0(x,y) + if (dir == DEGREES_0) { + SiSSetupX1Y1(x + len, y); + } else { + SiSSetupX1Y1(x, y + len); + } + SiSDoCMD +} + +static void +SiSSetupForDashedLine(ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask, + int length, unsigned char *pattern) +{ + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup DashedLine(0x%x, 0x%x, 0x%x, 0x%x, %d, 0x%x:%x)\n", + fg, bg, rop, planemask, length, *(pattern+4), *pattern)); + + SiSSetupLineCount(1) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(pSiS->DstColor); + SiSSetupStyleLow(*pattern) + SiSSetupStyleHigh(*(pattern+4)) + SiSSetupStylePeriod(length-1); /* TW: This was missing!!! */ + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupPATFG(fg) + SiSSetupCMDFlag(LINE | LINE_STYLE) /* TW: This was missing!!! */ + if (bg != -1) { + SiSSetupPATBG(bg) + } else { + SiSSetupCMDFlag(TRANSPARENT) /* TW: This was missing!!! */ + } + SiSSetupCMDFlag(pSiS->SiS310_AccelDepth) +} + +static void +SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, + int flags, int phase) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase,miny,maxy; + + PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n", + x1, y1, x2, y2, flags, phase)); + + dstbase = 0; + miny=(y1 > y2) ? y2 : y1; + maxy=(y1 > y2) ? y1 : y2; + if (maxy >= 2048) { + dstbase = pSiS->scrnOffset * miny; + y1 -= miny; + y2 -= miny; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + + SiSSetupX0Y0(x1,y1) + SiSSetupX1Y1(x2,y2) + if (flags & OMIT_LAST) { + SiSSetupCMDFlag(NO_LAST_PIXEL) + } else { + pSiS->CommandReg &= ~(NO_LAST_PIXEL); + } + SiSDoCMD +} + +static void +SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, + int patx, int paty, int fg, int bg, + int rop, unsigned int planemask) +{ + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n", + patx, paty, fg, bg, rop, planemask)); + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(pSiS->DstColor); + SiSSetupMONOPAT(patx,paty) + SiSSetupPATFG(fg) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATMONO | pSiS->SiS310_AccelDepth) + SiSSetupPATBG(bg) +} + +static void +SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, + int patx, int paty, + int x, int y, int w, int h) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", + patx, paty, x, y, w, h)); + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + /* Clear commandReg because Setup can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | + T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + TRAPAZOID_FILL); + SiSDoCMD +} + +/* TW: Trapezoid */ +#ifdef TRAP +static void +SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR) +{ + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent Mono8x8PatternFillTrap(%d, %d, %d - %d %d/%d %d/%d)\n", + y, h, left, right, dxL, dxR, eL, eR)); + + dstbase = 0; + if (y >= 2048) { + dstbase=pSiS->scrnOffset*y; + y = 0; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + SiSSetupDSTBase(dstbase) + + /* Clear CommandReg because SetUp can be used for Rect and Trap */ + pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | + T_L_X_INC | T_L_Y_INC | + T_R_X_INC | T_R_Y_INC | + BITBLT); + + if (dxL < 0) { dxL = -dxL; } + else { SiSSetupCMDFlag(T_L_X_INC) } + if (dxR < 0) { dxR = -dxR; } + else { SiSSetupCMDFlag(T_R_X_INC) } + + if (dyL < 0) { dyL = -dyL; } + else { SiSSetupCMDFlag(T_L_Y_INC) } + if (dyR < 0) { dyR = -dyR; } + else { SiSSetupCMDFlag(T_R_Y_INC) } + + /* Determine major axis */ + if (dxL >= dyL) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORL) + } + if (dxR >= dyR) { /* X is major axis */ + SiSSetupCMDFlag(T_XISMAJORR) + } + + SiSSetupYH(y,h) + SiSSetupLR(left,right) + + SiSSetupdL(dxL, dyL) + SiSSetupdR(dxR, dyR) + + SiSSetupEL(eL) + SiSSetupER(eR) + + SiSSetupCMDFlag(TRAPAZOID_FILL); + + SiSDoCMD +} +#endif + +/* ---- CPUToScreen Color Expand */ + +#ifdef CTSCE +/* We use the indirect method */ +static void +SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask) +{ + SISPtr pSiS=SISPTR(pScrn); + + /* TW: FIXME: How do I check the "CPU driven blit stage" on the + * 310/325 series? + * That's the 300 series method but definitely wrong for + * 310/325 series (bit 28 is already used for idle!) + */ + /* while ((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x1F00) != 0) {} */ + + /* TW: Do Idle instead... */ + SiSIdle + + SiSSetupSRCXY(0,0); + SiSSetupROP(sisALUConv[rop]); + SiSSetupSRCFG(fg); + SiSSetupDSTRect(pSiS->scrnOffset, -1); + SiSSetupDSTColorDepth(pSiS->DstColor); + if (bg == -1) { + SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCCPUBLITBUF + | pSiS->SiS310_AccelDepth); + } else { + SiSSetupSRCBG(bg); + SiSSetupCMDFlag(ENCOLOREXP | SRCCPUBLITBUF + | pSiS->SiS310_AccelDepth); + }; +} + +static void +SiSSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, int y, int w, + int h, int skipleft) +{ + SISPtr pSiS = SISPTR(pScrn); + int _x0, _y0, _x1, _y1; + long dstbase; + + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset*y; + y = 0; + } +#ifdef SISDUALHEAD + dstbase += HEADOFFSET; +#endif + + if((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { + SiSIdle; + } + + SiSSetupDSTBase(dstbase) + + if (skipleft > 0) { + _x0 = x+skipleft; + _y0 = y; + _x1 = x+w; + _y1 = y+h; + SiSSetupClipLT(_x0, _y0); + SiSSetupClipRB(_x1, _y1); + SiSSetupCMDFlag(CLIPENABLE); + } else { + pSiS->CommandReg &= (~CLIPENABLE); + } + SiSSetupRect(w, 1); + SiSSetupSRCPitch(((((w+7)/8)+3) >> 2) * 4); + pSiS->ycurrent = y; + pSiS->xcurrent = x; +} + +static void +SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + SISPtr pSiS=SISPTR(pScrn); + long cbo; + + cbo = pSiS->ColorExpandBufferScreenOffset[bufno]; +#ifdef SISDUALHEAD + cbo += HEADOFFSET; +#endif + + if((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { + SiSIdle; + } + + SiSSetupSRCBase(cbo); + + SiSSetupDSTXY(pSiS->xcurrent, pSiS->ycurrent); + + SiSDoCMD + + pSiS->ycurrent++; + + SiSIdle +} +#endif + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h:1.2 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h Wed Jan 29 10:42:16 2003 @@ -0,0 +1,341 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.2 2003/01/29 15:42:16 eich Exp $ */ +/* + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Thomas Winischhofer not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Winischhofer makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS WINISCHHOFER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS WINISCHHOFER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Based on sis300_accel.h + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + */ + +/* Definitions for the SIS engine communication. */ + + +/* SiS310 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 */ +#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 */ + +/* Command bits */ + +/* Source selection */ +#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 source selection */ +#define PATFG 0x00000000 /* foreground color */ +#define PATPATREG 0x00000040 /* pattern in pattern buffer (0x8300) */ +#define PATMONO 0x00000080 /* mono pattern */ + +/* 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 + +/* Subfunctions for Color/Enhanced Color Expansion */ +#define COLOR_TO_MONO 0x00100000 +#define AA_TEXT 0x00200000 + +/* Line */ +#define LINE_STYLE 0x00800000 +#define NO_RESET_COUNTER 0x00400000 +#define NO_LAST_PIXEL 0x00200000 + +/* Trapezoid */ +#define T_XISMAJORL 0x00800000 /* X axis is driving axis (left) */ +#define T_XISMAJORR 0x08000000 /* X axis is driving axis (right) */ +#define T_L_Y_INC 0x00000020 /* left edge direction Y */ +#define T_L_X_INC 0x00000010 /* left edge direction X */ +#define T_R_Y_INC 0x00400000 /* right edge direction Y */ +#define T_R_X_INC 0x00200000 /* right edge direction X */ + +/* Some general registers */ +#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 + +/* Trapezoid registers */ +#define TRAP_YH SRC_Y /* 0x8208 */ +#define TRAP_LR DST_Y /* 0x820C */ +#define TRAP_DL 0x8244 +#define TRAP_DR 0x8248 +#define TRAP_EL 0x824C +#define TRAP_ER 0x8250 + +/* 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 */ + +/* Macros to do useful things with the SIS 310 BitBLT engine */ + +/* Q_STATUS: + bit 31 = 1: All engines idle and all queues empty + bit 30 = 1: Hardware Queue (=HW CQ, 2D queue, 3D queue) empty + bit 29 = 1: 2D engine is idle + bit 28 = 1: 3D engine is idle + bit 27 = 1: HW command queue empty + bit 26 = 1: 2D queue empty + bit 25 = 1: 3D queue empty + bit 24 = 1: SW command queue empty + bits 23:16: 2D counter 3 + bits 15:8: 2D counter 2 + bits 7:0: 2D counter 1 + + Where is the command queue length (current amount of commands the queue + can accept) on the 310 series? (The current implementation is taken + from 300 series and certainly wrong...) +*/ + +int CmdQueLen; + +/* TW: FIXME: CmdQueLen is... where....? */ +#define SiSIdle \ + { \ + while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + CmdQueLen=MMIO_IN16(pSiS->IOBase, Q_STATUS); \ + } + /* TW: (do twice like on 300 series?) */ + +#define SiSSetupSRCBase(base) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, SRC_ADDR, base);\ + CmdQueLen--; + +#define SiSSetupSRCPitch(pitch) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, SRC_PITCH, pitch);\ + CmdQueLen--; + +#define SiSSetupSRCXY(x,y) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, SRC_Y, (x)<<16 | (y) );\ + CmdQueLen--; + +#define SiSSetupDSTBase(base) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, DST_ADDR, base);\ + CmdQueLen--; + +#define SiSSetupDSTXY(x,y) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, DST_Y, (x)<<16 | (y) );\ + CmdQueLen--; + +#define SiSSetupDSTRect(x,y) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, DST_PITCH, (y)<<16 | (x) );\ + CmdQueLen--; + +#define SiSSetupDSTColorDepth(bpp) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, AGP_BASE, bpp);\ + CmdQueLen--; + +#define SiSSetupRect(w,h) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, RECT_WIDTH, (h)<<16 | (w) );\ + CmdQueLen--; + +#define SiSSetupPATFG(color) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, PAT_FGCOLOR, color);\ + CmdQueLen--; + +#define SiSSetupPATBG(color) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, PAT_BGCOLOR, color);\ + CmdQueLen--; + +#define SiSSetupSRCFG(color) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, SRC_FGCOLOR, color);\ + CmdQueLen--; + +#define SiSSetupSRCBG(color) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, SRC_BGCOLOR, color);\ + CmdQueLen--; + +#define SiSSetupSRCTrans(color) \ + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_HIGH, color);\ + MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_LOW, color);\ + CmdQueLen -= 2; + +#define SiSSetupDSTTrans(color) \ + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_HIGH, color); \ + MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_LOW, color); \ + CmdQueLen -= 2; + +#define SiSSetupMONOPAT(p0,p1) \ + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, MONO_MASK, p0);\ + MMIO_OUT32(pSiS->IOBase, MONO_MASK+4, p1);\ + CmdQueLen=CmdQueLen-2; + +#define SiSSetupClipLT(left,top) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16 );\ + CmdQueLen--; + +#define SiSSetupClipRB(right,bottom) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16 );\ + CmdQueLen--; + +#define SiSSetupROP(rop) \ + pSiS->CommandReg = (rop) << 8; + +#define SiSSetupCMDFlag(flags) \ + pSiS->CommandReg |= (flags); + +#define SiSDoCMD \ + if (CmdQueLen <= 1) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, COMMAND_READY, pSiS->CommandReg); \ + MMIO_OUT32(pSiS->IOBase, FIRE_TRIGGER, 0); \ + CmdQueLen=CmdQueLen-2; + +#define SiSSetupX0Y0(x,y) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, LINE_X0, (y)<<16 | (x) );\ + CmdQueLen--; + +#define SiSSetupX1Y1(x,y) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, LINE_X1, (y)<<16 | (x) );\ + CmdQueLen--; + +#define SiSSetupLineCount(c) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, LINE_COUNT, c);\ + CmdQueLen--; + +#define SiSSetupStylePeriod(p) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT16(pSiS->IOBase, LINE_STYLE_PERIOD, p);\ + CmdQueLen--; + +#define SiSSetupStyleLow(ls) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, LINE_STYLE_0, ls);\ + CmdQueLen--; + +#define SiSSetupStyleHigh(ls) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, LINE_STYLE_1, ls);\ + CmdQueLen--; + +/* Trapezoid */ +#define SiSSetupYH(y,h) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRAP_YH, (y)<<16 | (h) );\ + CmdQueLen --; + +#define SiSSetupLR(left,right) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRAP_LR, (right)<<16 | (left) );\ + CmdQueLen --; + +#define SiSSetupdL(dxL,dyL) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRAP_DL, (dyL)<<16 | (dxL) );\ + CmdQueLen --; + +#define SiSSetupdR(dxR,dyR) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRAP_DR, (dyR)<<16 | (dxR) );\ + CmdQueLen --; + +#define SiSSetupEL(eL) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRAP_EL, eL);\ + CmdQueLen --; + +#define SiSSetupER(eR) \ + if (CmdQueLen <= 0) SiSIdle;\ + MMIO_OUT32(pSiS->IOBase, TRAP_ER, eR);\ + CmdQueLen --; + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.3 Thu Jan 10 14:05:43 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c Thu Feb 27 12:31:37 2003 @@ -1,459 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c,v 1.3 2002/01/10 19:05:43 eich Exp $ */ - -/* - * Acceleration for SiS530 SiS620. - * It is done in a separate file because the register formats are - * very different from the previous chips. - * - * Xavier Ducoin <x.ducoin@lectra.com> - */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "sis530_accel.h" -#include "sis.h" - - -Bool SiS530AccelInit(ScreenPtr pScreen); -static void SiS2Sync(ScrnInfoPtr pScrn); -static void SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); -static void SiS2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, - int y, int w, int h); -static void SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, int x2, - int y2, int w, int h); -static void SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, - int transparency_color); -static void SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, int fg, int bg, - int rop, unsigned int planemask); -static void SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, int x, int y, - int w, int h); -static void SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask); -#if 0 -static void SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft); -#endif -static void SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -static void SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - - -static void -SiS2InitializeAccelerator(ScrnInfoPtr pScrn) -{ -} - -Bool -SiS530AccelInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSiS = SISPTR(pScrn); - BoxRec AvailFBArea; - int offset = 0; - int topFB; - int OffscreenAvailable, BLTPatternOffscreenSize; - - pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - SiS2InitializeAccelerator(pScrn); - - /* fill out infoPtr here */ - infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; - - /* sync */ - infoPtr->Sync = SiS2Sync; - - - /* solid fills */ - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = SiS2SetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = SiS2SubsequentFillRectSolid; - - - /* screen to screen copy */ - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; - infoPtr->SetupForScreenToScreenCopy = - SiS2SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - SiS2SubsequentScreenToScreenCopy; - - - /* 8x8 mono patterns */ - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - NO_TRANSPARENCY | /* transp does not work right now */ - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForMono8x8PatternFill = - SiS2SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - SiS2SubsequentMono8x8PatternFillRect; - - /* screen to screen color expansion */ -#if 0 - /* don't know how to specify the with, height of the - source bitmap for the replication along Width, Height of destination area - */ - infoPtr->ScreenToScreenColorExpandFillFlags = - BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | - /*GXCOPY_ONLY | be careful not fully tested */ - TRANSPARENCY_ONLY | /* opaque does not work right now */ - NO_PLANEMASK; - - infoPtr->SetupForScreenToScreenColorExpandFill = - SiS2SetupForScreenToScreenColorExpandFill; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiS2SubsequentScreenToScreenColorExpandFill; -#endif - { - /* - * |......~~~~~~~~~~~~~~~~=================| - * 0/32k TurboQueue 0/32k HWCursor - */ - if (pSiS->HWCursor && pSiS->TurboQueue) - offset = 65536; - else if (pSiS->TurboQueue || pSiS->HWCursor) - offset = 32768; - } - topFB = (pSiS->maxxfbmem >= pSiS->FbMapSize - offset) ? - pSiS->maxxfbmem : pSiS->FbMapSize - offset; - - /* CPU To screen color expansion indirect method */ - OffscreenAvailable = topFB - pScrn->displayWidth * pScrn->virtualY - * (pScrn->bitsPerPixel / 8) ; - BLTPatternOffscreenSize = 2 * (((pScrn->virtualX + 31)/32) * 4); - if (OffscreenAvailable < BLTPatternOffscreenSize) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0, - "Not enough off-screen video memory for expand color.\n"); - } - else { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - SYNC_AFTER_COLOR_EXPAND | - BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | - /*GXCOPY_ONLY | not fully tested */ - TRANSPARENCY_ONLY | /* opaque doesn't work*/ - NO_PLANEMASK; - - pSiS->XAAScanlineColorExpandBuffers[0] = - pSiS->FbBase + topFB - (((pScrn->virtualX + 31)/32) * 4); - pSiS->XAAScanlineColorExpandBuffers[1] = - pSiS->FbBase + topFB - (((pScrn->virtualX + 31)/32) * 4)*2; - - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = - pSiS->XAAScanlineColorExpandBuffers; - topFB -= BLTPatternOffscreenSize; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - SiS2SetupForScreenToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - SiS2SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - SiS2SubsequentColorExpandScanline; - } - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = topFB / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); - - xf86InitFBManager(pScreen, &AvailFBArea); - - return(XAAInit(pScreen, infoPtr)); -} - -static void -SiS2Sync(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - sisBLTSync; -} - -static int sisALUConv[] = -{ - 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 int sisPatALUConv[] = -{ - 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 */ -}; - -static void -SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("SiS2SetupForFillRectSolid()\n")); - sisBLTWAIT; - sisSETPATFGCOLOR(color); - sisSETROP(sisPatALUConv[rop & 0xF]); - sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ - - sisSETSRCADDR(0); - sisSETDSTADDR(0); - sisSETSRCXSRCY(0,0); - -} - -static void -SiS2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - int op; - - op = sisCMDBLT | sisTOP2BOTTOM | sisLEFT2RIGHT | sisROP; - - sisSETHEIGHTWIDTH(h, w); - sisSETDSTXDSTY(x,y); - - sisSETCMD(op); - -} - -static void -SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int transparency_color) -{ - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("SiS2SetupForScreenToScreenCopy()\n")); - sisBLTWAIT; - sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); - sisSETROP(sisALUConv[rop & 0xF]); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ - sisSETSRCADDR(0); - sisSETDSTADDR(0); - pSiS->Xdirection = xdir; - pSiS->Ydirection = ydir; -} - -static void -SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - int op ; - - op = sisCMDBLT | sisSRCVIDEO | sisROP; - if (pSiS->Ydirection == -1) { - op |= sisBOTTOM2TOP; - y1 += h-1; - y2 += h-1; - } else { - op |= sisTOP2BOTTOM; - } - if (pSiS->Xdirection == -1) { - op |= sisRIGHT2LEFT; - x1 += w-1; - x2 += w-1; - } else { - op |= sisLEFT2RIGHT; - } - - sisSETHEIGHTWIDTH(h, w); - sisSETSRCXSRCY(x1,y1); - sisSETDSTXDSTY(x2,y2); - - sisSETCMD(op); -} - -static void -SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, - int fg, int bg, int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - unsigned int *patternRegPtr ; - int dstpitch; - int isTransparent = ( bg == -1 ); - int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | - sisPATMASK; - - PDEBUG(ErrorF("SiS2SetupFor8x8PatternColorExpand()\n")); - - dstpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; - /* - * check transparency - */ - /* becareful with rop */ - if (isTransparent) { - op |= sisTRANSPARENT; - PDEBUG(ErrorF("doesn't work right now: should never be called\n")); - } - - sisBLTWAIT; - sisSETPATBGCOLOR(bg); - sisSETPATFGCOLOR(fg); - sisSETROP(sisPatALUConv[rop & 0xF]); /* pat copy */ - - sisSETPITCH(1, dstpitch); - sisSETSRCADDR(0); - sisSETDSTADDR(0); - sisSETSRCXSRCY(0,0); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ - pSiS->CommandReg = op | sisROP ; - - patternRegPtr = (unsigned int *)sisSETPATMASKREG(); - patternRegPtr[0] = patternx ; - patternRegPtr[1] = patterny ; -} - -static void -SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - /* - * what do I need to do with patternx, patterny ? - */ - - sisSETDSTXDSTY(x,y); - sisSETHEIGHTWIDTH(h, w); - - sisSETCMD(pSiS->CommandReg); -} - -static void -SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - int isTransparent = ( bg == -1 ); - int op ; - - PDEBUG(ErrorF("SiS2SetupScreenToScreenColorExpand()\n")); - - op = sisCMDENHCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT; - - if (isTransparent) { - op |= sisTRANSPARENT; - } - - sisBLTWAIT; - sisSETPATBGCOLOR(bg); - sisSETPATFGCOLOR(fg); - /* becareful with rop */ - sisSETROP(sisPatALUConv[rop & 0xF]); - - sisSETDSTADDR(0); - sisSETSRCADDR(0); - sisSETSRCXSRCY(0,0); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ - - pSiS->CommandReg = op | sisROP; - -} -#if 0 -static void -SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - - int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8; - - sisBLTWAIT; - sisSETPITCH(pitch, pitch); - sisSETHEIGHTWIDTH(h, w); - sisSETSRCXSRCY(srcx, srcy); - sisSETDSTXDSTY(x, y); - sisSETCMD(pSiS->CommandReg); -} -#endif - -static void -SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8; - int srcpitch = ((w + 31)& ~31) /8 ; - - PDEBUG(ErrorF("SiS2SubsequentScanlineCPUToScreenColorExpandFill\n")); - - sisBLTWAIT; - sisSETDSTXDSTY(x,y); - sisSETHEIGHTWIDTH(1, w); - sisSETPITCH(srcpitch, pitch); - - pSiS->DstX = x; - pSiS->DstY = y; - -} - -static void -SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, - int bufno) -{ - SISPtr pSiS = SISPTR(pScrn); - int srcaddr; - - PDEBUG(ErrorF("SiS2SubsequentColorExpandScanline\n")); - - srcaddr = pSiS->XAAScanlineColorExpandBuffers[bufno] - pSiS->FbBase; - - sisBLTWAIT; - sisSETSRCADDR(srcaddr); - sisSETDSTXDSTY(pSiS->DstX, pSiS->DstY); - sisSETCMD(pSiS->CommandReg); - sisBLTWAIT; - pSiS->DstY++; -} Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h:1.1 Thu Apr 19 08:45:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h Thu Feb 27 12:31:37 2003 @@ -1,198 +0,0 @@ -/* - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. - * Xavier Ducoin <x.ducoin@lectra.com> - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h,v 1.1 2001/04/19 12:45:22 alanh Exp $ */ - -/* 3C4 */ -#define BankReg 0x06 -#define ExtGraphicControl 0x06 -#define ClockReg 0x07 -#define CPUThreshold 0x08 -#define CRTThreshold 0x09 -#define CRTCOff 0x0A -#define DualBanks 0x0B -#define MMIOEnable 0x0B -#define RAMSize 0x0C -#define Mode64 0x0C -#define ExtConfStatus1 0x0E -#define ExtHoznOver 0x12 -#define ClockBase 0x13 -#define LinearAdd0 0x20 -#define LinearAdd1 0x21 -#define GraphEng 0x27 -#define MemClock0 0x28 -#define MemClock1 0x29 -#define XR2A 0x2A -#define XR2B 0x2B -#define TurboQueueBase 0x2C -#define FBSize 0x2F -#define ExtMiscCont5 0x34 -#define ExtMiscCont9 0x3C - -/* 3x4 */ -#define Offset 0x13 - -#define read_xr(num,var) do {outb(0x3c4, num);var=inb(0x3c5);} while (0) - -/* Definitions for the SIS engine communication. */ - -extern int sis2Reg32MMIO[]; -#define BR(x) sis2Reg32MMIO[x] - -#define sisLEFT2RIGHT 0x00010000 -#define sisRIGHT2LEFT 0x00000000 -#define sisTOP2BOTTOM 0x00020000 -#define sisBOTTOM2TOP 0x00000000 - -#define sisSRCSYSTEM 0x00000010 -#define sisSRCVIDEO 0x00000000 - -#define sisNOMERGECLIP 0x04000000 - -#define sisCMDBLT 0x00000000 -#define sisCMDCOLEXP 0x00000001 -#define sisCMDLINE 0x00000004 -#define sisCMDENHCOLEXP 0x00000002 - -#define sisTRANSPARENT 0x00100000 - -#define sisCLIPINTRN 0x00000000 -#define sisCLIPEXTRN 0x04000000 -#define sisCLIPENABL 0x00040000 - -#define sisPATFG 0x00000000 -#define sisPATREG 0x00000040 -#define sisPATMASK 0x00000080 - -/* Macros to do useful things with the SIS BitBLT engine */ - -/* - bit 31 2D engine: 1 is idle, - bit 30 3D engine: 1 is idle, - bit 29 Command queue: 1 is empty -*/ -#define sisBLTSync \ - while((*(volatile unsigned short *)(pSiS->IOBase + BR(16)+2) & \ - 0xE000) != 0xE000){} - -#define sisBLTWAIT \ - if (!pSiS->TurboQueue) {\ - while(!(*(volatile unsigned short *)(pSiS->IOBase + BR(16)+2) & \ - (0x8000))){}} - -#define sisSETPATMASKREG()\ - ((unsigned char *)(pSiS->IOBase + BR(11))) - -#define sisSETPATREG()\ - ((unsigned char *)(pSiS->IOBase + BR(17))) - -#define sisSETCMD(op) \ - *(volatile unsigned long *)(pSiS->IOBase + BR(15) ) = op - -#define sisSETROP(op) \ - pSiS->ROPReg = (op<<8) - -#define sisROP pSiS->ROPReg - -#define sisSETSRCADDR(srcAddr) \ - *(volatile unsigned long *)(pSiS->IOBase + BR(0)) = srcAddr - -#define sisSETDSTADDR(dstAddr) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = dstAddr - -#define sisSETPITCH(srcPitch,dstPitch) \ - *(volatile unsigned short *)(pSiS->IOBase + BR(1)) = (srcPitch); \ - *(volatile unsigned short *)(pSiS->IOBase + BR(5)) = (dstPitch) - -#define sisSETHEIGHTWIDTH(Height,Width)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((Height)&0xFFFF)<<16) | ((Width)&0xFFFF) - -#define sisSETDSTHEIGHT(Height)\ - *(volatile unsigned short *)(pSiS->IOBase + BR(5)+2) = (Height) - - -#define sisSETSRCXSRCY(X,Y)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = (((X)&0xFFFF)<<16)| \ - ((Y)&0xFFFF) - -#define sisSETDSTXDSTY(X,Y)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((X)&0xFFFF)<<16)| \ - ((Y)&0xFFFF) - -#define sisSETCLIPTOP(x,y)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(13)) = (((y)&0xFFFF)<<16)| \ - ((x)&0xFFFF) - -#define sisSETCLIPBOTTOM(x,y)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(14)) = (((y)&0xFFFF)<<16)| \ - ((x)&0xFFFF) - - -#define sisSETBGCOLOR(bgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(10)) = (bgColor) - -#define sisSETFGCOLOR(fgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (fgColor) - - -#define sisSETPATBGCOLOR(bgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (bgColor) - -#define sisSETPATFGCOLOR(fgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(7)) = (fgColor) - - -#define sisEnableCRT1HWCursor()\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8500) |= 0x40000000; -#define sisDisableCRT1HWCursor()\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8500) &= 0xBFFFFFFF; - -#define sisSetCRT1CursorBGColor(color)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8504) = (color); -#define sisSetCRT1CursorFGColor(color)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8508) = (color); - -#define sisSetCRT1CursorPositionX(x,preset)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x850C) = (x) | ((preset) << 16); -#define sisSetCRT1CursorPositionY(y,preset)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8510) = (y) | ((preset) << 16); - -#define sisEnableCRT2HWCursor()\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8520) |= 0x40000000; -#define sisDisableCRT2HWCursor()\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8520) &= 0xBFFFFFFF; - -#define sisSetCRT2CursorBGColor(color)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8524) = (color); -#define sisSetCRT2CursorFGColor(color)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8528) = (color); - -#define sisSetCRT2CursorPositionX(x,preset)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x852C) = (x) | ((preset) << 16); -#define sisSetCRT2CursorPositionY(y,preset)\ - *(volatile unsigned int *)(pSiS->IOBase + 0x8530) = (y) | ((preset) << 16); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c:1.2 --- /dev/null Thu Feb 27 12:31:37 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c Wed Jan 29 10:42:16 2003 @@ -0,0 +1,1662 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c,v 1.2 2003/01/29 15:42:16 eich Exp $ */ +/* + * Xv driver for SiS 5597/5598, 6236 and 530/620. + * + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria. + * + * Based on sis_video.c which is + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * Parts Copyright 2002 by Thomas Winischhofer, Vienna, Austria. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Thomas Winischhofer <thomas@winischhofer.net> + */ + +#include "sis.h" +#ifdef USE6326VIDEO + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +#include "sis_regs.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +#define WATCHDOG_DELAY 500000 /* Watchdog counter for Vertical Restrace waiting */ + +static XF86VideoAdaptorPtr SIS6326SetupImageVideo(ScreenPtr); +static void SIS6326StopVideo(ScrnInfoPtr, pointer, Bool); +static int SIS6326SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int SIS6326GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void SIS6326QueryBestSize(ScrnInfoPtr, Bool, short, short, short, + short, unsigned int *,unsigned int *, pointer); +static int SIS6326PutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int SIS6326QueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); +static void SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now); +static void SIS6326InitOffscreenImages(ScreenPtr pScrn); + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey; +static Atom xvAutopaintColorKey, xvSetDefaults; + +#define IMAGE_MIN_WIDTH 32 /* Minimum and maximum image sizes */ +#define IMAGE_MIN_HEIGHT 24 +#define IMAGE_MAX_WIDTH 720 /* Are these correct for the chips ? */ +#define IMAGE_MAX_HEIGHT 576 +#define IMAGE_MAX_WIDTH_5597 384 +#define IMAGE_MAX_HEIGHT_5597 288 + +#if 0 +static int oldH, oldW; +#endif + +/**************************************************************************** + * Raw register access : These routines directly interact with the sis's + * control aperature. Must not be called until after + * the board's pci memory has been mapped. + ****************************************************************************/ + +#if 0 +static CARD32 _sisread(SISPtr pSiS, CARD32 reg) +{ + return *(pSiS->IOBase + reg); +} + +static void _siswrite(SISPtr pSiS, CARD32 reg, CARD32 data) +{ + *(pSiS->IOBase + reg) = data; +} +#endif + +static CARD8 getvideoreg(SISPtr pSiS, CARD8 reg) +{ + CARD8 ret; + inSISIDXREG(SISCR, reg, ret); + return(ret); +} + +static void setvideoreg(SISPtr pSiS, CARD8 reg, CARD8 data) +{ + outSISIDXREG(SISCR, reg, data); +} + +static void setvideoregmask(SISPtr pSiS, CARD8 reg, CARD8 data, CARD8 mask) +{ + CARD8 old; + + inSISIDXREG(SISCR, reg, old); + data = (data & mask) | (old & (~mask)); + outSISIDXREG(SISCR, reg, data); +} + +/* VBlank */ +static CARD8 vblank_active_CRT1(SISPtr pSiS) +{ + return (inSISREG(SISINPSTAT) & 0x08); +} + +/* Scanline - unused */ +#if 0 +static CARD32 get_scanline_CRT1(SISPtr pSiS) +{ + CARD8 temp; + + temp = getvideoreg(pSiS, 0x20); + temp = getvideoreg(pSiS, 0x1b); + return((getvideoreg(pSiS, 0x1d) << 8) | getvideoreg(pSiS, 0x1c)); +} +#endif + +void SIS6326InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + + newAdaptor = SIS6326SetupImageVideo(pScreen); + if(newAdaptor) + SIS6326InitOffscreenImages(pScreen); + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + /* need to free this someplace */ + newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); +#if 0 + oldW = 0; oldH = 0; /* DEBUG */ +#endif +} + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding = +{ + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} +}; + +static XF86VideoEncodingRec DummyEncoding5597 = +{ + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH_5597, IMAGE_MAX_HEIGHT_5597, + {1, 1} +}; + +#define NUM_FORMATS 4 + +static XF86VideoFormatRec SIS6326Formats[NUM_FORMATS] = +{ + { 8, PseudoColor}, + {15, TrueColor}, + {16, TrueColor}, + {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 5 + +static XF86AttributeRec SIS6326Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable , 0, 0, "XV_SET_DEFAULTS"} +}; + +#define NUM_IMAGES 6 +#define NUM_IMAGES_NOYV12 4 +#define PIXEL_FMT_YV12 FOURCC_YV12 /* 0x32315659 */ +#define PIXEL_FMT_UYVY FOURCC_UYVY /* 0x59565955 */ +#define PIXEL_FMT_YUY2 FOURCC_YUY2 /* 0x32595559 */ +#define PIXEL_FMT_I420 FOURCC_I420 /* 0x30323449 */ +#define PIXEL_FMT_RGB5 0x35315652 +#define PIXEL_FMT_RGB6 0x36315652 + +static XF86ImageRec SIS6326Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, /* TW: If order is changed, SIS6326OffscreenImages must be adapted */ + XVIMAGE_UYVY, + XVIMAGE_YV12, + XVIMAGE_I420, + { + 0x35315652, + XvRGB, + LSBFirst, + {'R','V','1','5', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, +/* 15, 0x001F, 0x03E0, 0x7C00, - incorrect! */ + 15, 0x7C00, 0x03E0, 0x001F, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R', 'V', 'B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, + { + 0x36315652, + XvRGB, + LSBFirst, + {'R','V','1','6', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, +/* 16, 0x001F, 0x07E0, 0xF800, - incorrect! */ + 16, 0xF800, 0x07E0, 0x001F, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R', 'V', 'B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + } +}; + +static XF86ImageRec SIS6326ImagesNoYV12[NUM_IMAGES_NOYV12] = +{ + XVIMAGE_YUY2, /* TW: If order is changed, SIS6326OffscreenImages must be adapted */ + XVIMAGE_UYVY, + { + 0x35315652, + XvRGB, + LSBFirst, + {'R','V','1','5', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, +/* 15, 0x001F, 0x03E0, 0x7C00, */ + 15, 0x7C00, 0x03E0, 0x001F, /* TW: Should be more correct than the other... */ + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R', 'V', 'B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, + { + 0x36315652, + XvRGB, + LSBFirst, + {'R','V','1','6', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, +/* 16, 0x001F, 0x07E0, 0xF800, */ + 16, 0xF800, 0x07E0, 0x001F, /* TW: Should be more correct than the other... */ + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R', 'V', 'B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + } +}; + +typedef struct { + int pixelFormat; + + CARD16 pitch; + + CARD8 keyOP; + + CARD8 HUSF; + CARD8 VUSF; + CARD8 HIntBit; + CARD8 wHPre; + CARD8 PitchMult; + + CARD16 srcW; + CARD16 srcH; + + BoxRec dstBox; + + CARD32 PSY; + CARD32 PSV; + CARD32 PSU; + CARD8 YUVEnd; + + CARD8 lineBufSize; + + CARD8 (*VBlankActiveFunc)(SISPtr); +/* CARD32 (*GetScanLineFunc)(SISPtr pSiS); */ + +} SISOverlayRec, *SISOverlayPtr; + +typedef struct { + FBLinearPtr linear; /* TW: We now use Linear, not Area */ + CARD32 bufAddr[2]; + + unsigned char currentBuf; + + short drw_x, drw_y, drw_w, drw_h; + short src_x, src_y, src_w, src_h; + int id; + short srcPitch, height, width; + CARD32 totalSize; + + char brightness; + unsigned char contrast; + + RegionRec clip; + CARD32 colorKey; + Bool autopaintColorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; + + short oldx1, oldx2, oldy1, oldy2; + int mustwait; + + Bool grabbedByV4L; /* V4L stuff */ + int pitch; + int offset; + +} SISPortPrivRec, *SISPortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (SISPortPrivPtr)((SISPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +static void +SIS6326SetPortDefaults (ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) +{ + pPriv->colorKey = 0x000101fe; + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 4; + pPriv->autopaintColorKey = TRUE; +} + +static void +SIS6326ResetVideo(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + /* Unlock registers */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + if(getvideoreg (pSiS, Index_VI6326_Passwd) != 0xa1) { + setvideoreg (pSiS, Index_VI6326_Passwd, 0x86); + if(getvideoreg (pSiS, Index_VI6326_Passwd) != 0xa1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Xv: Video password could not unlock video registers\n"); + } + + /* Initialize the overlay ----------------------------------- */ + + switch(pSiS->Chipset) { + case PCI_CHIP_SIS6326: + /* Disable overlay (D[1]) & capture (D[0]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x03); + + /* What do these do? (Datasheet names these bits "reserved") */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18); + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c); + + /* Select YUV format (D[6]) and "gfx + video" mode (D[4]), odd polarity? (D[7]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0xD0); + /* No interrupt, no filter, disable dithering */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x7A); + /* Disable VMI (D[4:3]), Brooktree support (D[6]) and system memory framebuffer (D[7]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0xF8); + /* Disable video decimation */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc6, 0x00, 0x80); + break; + case PCI_CHIP_SIS5597: + /* Disable overlay (D[1]) & capture (D[0]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x03); + + /* What do these do? (Datasheet names these bits "reserved") */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18); + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c); + + /* Select YUV format (D[6]) and "gfx + video" mode (D[4]), odd polarity? (D[7]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0xD0); + /* No interrupt, no filter, disable dithering */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x7A); + /* Disable Brooktree support (D[6]) and system memory framebuffer (D[7]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0xC0); + /* Disable video decimation (has a really strange effect if enabled) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc6, 0x00, 0x80); + break; + case PCI_CHIP_SIS530: + /* What is this? (Bit is "reserved") */ + setvideoregmask (pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40); + /* Disable overlay (D[1]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x02); + + /* What do these do? (Datasheet names these bits "reserved") */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18); + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c); + + /* Select YUV format (D[6]) and "gfx + video" mode (D[4]) */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0x50); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal error: SiS6326ResetVideo() called with invalid chipset (%x)\n", + pSiS->Chipset); + return; + } + + /* Clear format selection */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x04); + setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x00, 0x07); + + /* Select RGB Chromakey format (D[2]=0), CCIR 601 UV data format (D[1]=0) */ + /* D[1]: 1 = 2's complement, 0 = CCIR 601 format */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0x06); + + /* Reset contrast control */ + setvideoregmask(pSiS, Index_VI6326_Contrast_Enh_Ctrl, 0x04, 0x1F); + + /* Set treshold */ + if(pSiS->oldChipset < OC_SIS6326) { + CARD8 temp; + inSISIDXREG(SISSR, 0x33, temp); /* Synchronous DRAM Timing? */ + if(temp & 0x01) temp = 0x50; + else temp = 0; + setvideoreg(pSiS, Index_VI6326_Play_Threshold_Low, temp); + setvideoreg(pSiS, Index_VI6326_Play_Threshold_High, temp); + } else { + CARD8 temp; + setvideoreg(pSiS, Index_VI6326_Play_Threshold_Low, 0x00); + setvideoreg(pSiS, Index_VI6326_Play_Threshold_High, 0x00); + inSISIDXREG(SISSR, 0x33, temp); /* Are we using SGRAM Timing? */ + if(temp & 0x01) temp = 0x10; + else temp = 0; + setvideoregmask(pSiS, Index_VI6326_Control_Misc4, temp, 0x10); + } + + /* set default properties for overlay ------------------------------- */ + + setvideoregmask (pSiS, Index_VI6326_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSiS, Index_VI6326_Brightness, 0x20); + + if(pSiS->oldChipset < OC_SIS6205A || pSiS->oldChipset > OC_SIS82204) { + setvideoregmask(pSiS, Index_VI6326_AlphaGraph, 0x00, 0xF8); + setvideoregmask(pSiS, Index_VI6326_AlphaVideo, 0xF8, 0xF8); + } else { + setvideoregmask(pSiS, Index_VI6326_AlphaGraph, 0x00, 0xE1); + setvideoregmask(pSiS, Index_VI6326_AlphaVideo, 0xE1, 0xE1); + } +} + +static XF86VideoAdaptorPtr +SIS6326SetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + XF86VideoAdaptorPtr adapt; + SISPortPrivPtr pPriv; + + if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(SISPortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "SIS 5597/5598/6326/530/620 Video Overlay"; + adapt->nEncodings = 1; + if(pSiS->oldChipset < OC_SIS6326) { + adapt->pEncodings = &DummyEncoding5597; + } else { + adapt->pEncodings = &DummyEncoding; + } + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = SIS6326Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPriv = (SISPortPrivPtr)(&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = SIS6326Attributes; + adapt->nAttributes = NUM_ATTRIBUTES; + if(pSiS->NoYV12 == 1) { + adapt->nImages = NUM_IMAGES_NOYV12; + adapt->pImages = SIS6326ImagesNoYV12; + } else { + adapt->nImages = NUM_IMAGES; + adapt->pImages = SIS6326Images; + } + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = SIS6326StopVideo; + adapt->SetPortAttribute = SIS6326SetPortAttribute; + adapt->GetPortAttribute = SIS6326GetPortAttribute; + adapt->QueryBestSize = SIS6326QueryBestSize; + adapt->PutImage = SIS6326PutImage; + adapt->QueryImageAttributes = SIS6326QueryImageAttributes; + + pPriv->videoStatus = 0; + pPriv->currentBuf = 0; + pPriv->linear = NULL; + pPriv->grabbedByV4L= FALSE; + + SIS6326SetPortDefaults(pScrn, pPriv); + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pSiS->adaptor = adapt; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); + + SIS6326ResetVideo(pScrn); + + return adapt; +} + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} + +static int +SIS6326SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 value, pointer data) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + + if(attribute == xvBrightness) { + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + } else if(attribute == xvContrast) { + if((value < 0) || (value > 7)) + return BadValue; + pPriv->contrast = value; + } else if(attribute == xvColorKey) { + pPriv->colorKey = value; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else if (attribute == xvAutopaintColorKey) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->autopaintColorKey = value; + } else if (attribute == xvSetDefaults) { + SIS6326SetPortDefaults(pScrn, pPriv); + } else return BadMatch; + return Success; +} + +static int +SIS6326GetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + + if(attribute == xvBrightness) { + *value = pPriv->brightness; + } else if(attribute == xvContrast) { + *value = pPriv->contrast; + } else if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } else if (attribute == xvAutopaintColorKey) + *value = (pPriv->autopaintColorKey) ? 1 : 0; + else return BadMatch; + return Success; +} + +static void +SIS6326QueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + *p_w = drw_w; + *p_h = drw_h; + + /* TODO: report the HW limitation */ +} + +static void /* V 530/6326 */ +calc_scale_factor(SISPtr pSiS, SISOverlayPtr pOverlay, ScrnInfoPtr pScrn, + SISPortPrivPtr pPriv) +{ + CARD32 temp=0; + + int dstW = pOverlay->dstBox.x2 - pOverlay->dstBox.x1; + int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1; + int srcW = pOverlay->srcW; + int srcH = pOverlay->srcH; + +#if 0 + /* DEBUG */ + if((oldH != dstH) || (oldW != dstW)){ + xf86DrvMsg(0, X_INFO, "Video size %dx%d\n", dstW, dstH); + oldH = dstH; oldW = dstW; + } + /* /DEBUG */ +#endif + + /* TW: For double scan modes, we need to double the height */ + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + dstH <<= 1; + } + /* TW: For interlace modes, we need to half the height */ + if(pSiS->CurrentLayout.mode->Flags & V_INTERLACE) { + dstH >>= 1; + } + + /* Horizontal */ + if(dstW < IMAGE_MIN_WIDTH) dstW = IMAGE_MIN_WIDTH; + if(dstW == srcW) { + pOverlay->HUSF = 0x00; + pOverlay->HIntBit = 0x01; + } else if(dstW > srcW) { + pOverlay->HIntBit = 0x00; + temp = srcW * 64 / (dstW + 1); + if(temp > 63) temp = 63; + pOverlay->HUSF = temp; + } else { + /* TW: 6326 can't scale below factor .440 - to check with 530/620 */ + if(((dstW * 1000) / srcW) < 440) dstW = ((srcW * 440) / 1000) + 1; + temp = srcW / dstW; + if(temp > 15) temp = 15; + pOverlay->HIntBit = temp; + temp = srcW * 64 / dstW; + pOverlay->HUSF = temp - (pOverlay->HIntBit * 64); + } + + /* Vertical */ + if(dstH < IMAGE_MIN_HEIGHT) dstH = IMAGE_MIN_HEIGHT; + if(dstH == srcH) { + pOverlay->VUSF = 0x00; + pOverlay->PitchMult = 1; + } else if(dstH > srcH) { + temp = srcH * 64 / (dstH + 1); + if (temp > 63) temp = 63; + pOverlay->VUSF = temp; + pOverlay->PitchMult = 1; + } else { + /* TW: 6326 can't scale below factor .440 - to check with 530/620 */ + if(((dstH * 1000) / srcH) < 440) dstH = ((srcH * 440) / 1000) + 1; + temp = srcH / dstH; + if(srcH % dstH) { + temp++; + pOverlay->VUSF = (srcH * 64) / (temp * dstH); + } else { + pOverlay->VUSF = 0x00; + } + pOverlay->PitchMult = temp; + } +} + +static void /* V 530/6326 */ +calc_line_buf_size(SISOverlayPtr pOverlay) +{ + CARD32 I; + CARD32 line = pOverlay->srcW; + + if( (pOverlay->pixelFormat == PIXEL_FMT_YV12) || + (pOverlay->pixelFormat == PIXEL_FMT_I420) ) + { + I = (line >> 5) + (((line >> 6) * 2)) + 3; + I <<= 5; + } else { /* YUV2, UYVY, RGB */ + I = line << 1; + if(I & 7) I += 8; + } + I += 8; + I >>= 3; + pOverlay->lineBufSize = (CARD8)I; +} + +static void /* V 530/6326 */ +merge_line_buf(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable) +{ + if(enable) { + setvideoregmask(pSiS, Index_VI6326_Control_Misc5, 0x10, 0x10); + } else { + setvideoregmask(pSiS, Index_VI6326_Control_Misc5, 0x00, 0x10); + } +} + +static void /* V 530/6326 */ +set_format(SISPtr pSiS, SISOverlayPtr pOverlay) +{ + CARD8 fmt, misc0, misc1, misc4; + + switch (pOverlay->pixelFormat){ + case PIXEL_FMT_YV12: + case PIXEL_FMT_I420: /* V/530 V/6326 */ + fmt = 0x80; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */ + misc0 = 0x40; /* D[6]: 1 = YUV, 0 = RGB */ + misc4 = 0x05; /* D[1:0] 00 RGB 555, 01 YUV 422, 10 RGB 565; D[2] 1 = YUV420 mode */ + misc1 = 0xff; + break; + case PIXEL_FMT_UYVY: + fmt = 0x00; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */ + misc0 = 0x40; /* D[6]: 1 = YUV, 0 = RGB */ + misc4 = 0x00; /* D[1:0] 00 RGB 555, 01 YUV 422, 10 RGB 565; D[2] 1 = YUV420 mode */ + misc1 = 0xff; + break; + case PIXEL_FMT_YUY2: /* V/530 V/6326 */ + fmt = 0x80; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */ + misc0 = 0x40; /* D[6]: 1 = YUV, 0 = RGB */ + misc4 = 0x00; /* D[1:0] 00 RGB 555, 01 YUV 422, 10 RGB 565; D[2] 1 = YUV420 mode */ + misc1 = 0xff; + break; + case PIXEL_FMT_RGB6: /* V/530 V/6326 */ + fmt = 0x40; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */ + misc0 = 0x00; /* D[6]: 1 = YUV, 0 = RGB */ + misc4 = 0xff; + misc1 = 0x00; /* D[2] = Capture format selection (DS5597) - WDR sets this */ + break; + case PIXEL_FMT_RGB5: /* V/530 V/6326 */ + default: + fmt = 0x00; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */ + misc0 = 0x00; /* D[6]: 1 = YUV, 0 = RGB */ + misc4 = 0xff; + misc1 = 0x04; /* D[2] = Capture format selection (DS5597) - WDR sets this */ + break; + } + + setvideoregmask(pSiS, Index_VI6326_VideoFormatSelect, fmt, 0xC0); + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, misc0, 0x40); + if(misc4 == 0xff) { + setvideoregmask(pSiS, Index_VI6326_Control_Misc1, misc1, 0x04); + if(pSiS->oldChipset >= OC_SIS5597) { + setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x00, 0x05); + } + } else { + if(pSiS->oldChipset >= OC_SIS5597) { + setvideoregmask(pSiS, Index_VI6326_Control_Misc4, misc4, 0x05); + } + setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x04); + } +} + +static void /* V 6326/530 */ +set_colorkey(SISPtr pSiS, CARD32 colorkey) +{ + CARD8 r, g, b, s; + + b = (CARD8)(colorkey & 0xFF); + g = (CARD8)((colorkey>>8) & 0xFF); + r = (CARD8)((colorkey>>16) & 0xFF); + + if(pSiS->CurrentLayout.bitsPerPixel >= 24) { + s = b; + b = r; + r = s; + } + + setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Blue_Min ,(CARD8)b); + setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Green_Min ,(CARD8)g); + setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Red_Min ,(CARD8)r); + + setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Blue_Max ,(CARD8)b); + setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Green_Max ,(CARD8)g); + setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Red_Max ,(CARD8)r); +} + +static void +set_brightness(SISPtr pSiS, CARD8 brightness) +{ + setvideoreg(pSiS, Index_VI6326_Brightness, brightness); +} + +static void +set_contrast(SISPtr pSiS, CARD8 contrast) +{ + setvideoregmask(pSiS, Index_VI6326_Contrast_Enh_Ctrl, contrast, 0x07); +} + +static void +set_contrast_data(SISPtr pSiS, int value) +{ + unsigned long temp; + + if(value < 10000) temp = 0; + else temp = (value - 10000) / 20000; + if(temp > 3) temp = 3; + setvideoregmask(pSiS, Index_VI6326_Contrast_Enh_Ctrl, (temp << 6), 0xC0); + switch(temp) { + case 0: temp = 2048; break; + case 1: temp = 4096; break; + case 2: temp = 8192; break; + case 3: temp = 16384; break; + } + temp <<= 10; + temp /= value; + setvideoreg(pSiS, Index_VI6326_Contrast_Factor, temp); +} + +static void +set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index) +{ + ScrnInfoPtr pScrn = pSiS->pScrn; + + CARD16 pitch=0; + CARD8 h_over=0, v_over=0; + CARD16 top, bottom, left, right; + CARD16 screenX = pSiS->CurrentLayout.mode->HDisplay; + CARD16 screenY = pSiS->CurrentLayout.mode->VDisplay; + CARD32 watchdog; + + top = pOverlay->dstBox.y1; + bottom = pOverlay->dstBox.y2; + if(bottom > screenY) { + bottom = screenY; + } + + left = pOverlay->dstBox.x1; + right = pOverlay->dstBox.x2; + if(right > screenX) { + right = screenX; + } + + /* TW: DoubleScan modes require Y coordinates * 2 */ + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + top <<= 1; + bottom <<= 1; + } + /* TW: Interlace modes require Y coordinates / 2 */ + if(pSiS->CurrentLayout.mode->Flags & V_INTERLACE) { + top >>= 1; + bottom >>= 1; + } + + h_over = (((left>>8) & 0x07) | ((right>>4) & 0x70)); + v_over = (((top>>8) & 0x07) | ((bottom>>4) & 0x70)); + + pitch = pOverlay->pitch * pOverlay->PitchMult; + pitch >>= 2; /* Datasheet: Unit = double word - verified */ + if(pitch > 0xfff) { + pitch = pOverlay->pitch * (0xFFF * 2 / pOverlay->pitch); + pOverlay->VUSF = 0x3F; + } + + /* set color key */ + set_colorkey(pSiS, pPriv->colorKey); + + /* set color key mode */ + setvideoregmask(pSiS, Index_VI6326_Key_Overlay_OP, pOverlay->keyOP, 0x0f); + + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c); + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18); + + /* Set Y buf pitch */ /* Datasheet: Unit = double word - verified */ + setvideoreg(pSiS, Index_VI6326_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch)); + setvideoregmask(pSiS, Index_VI6326_Disp_Y_Buf_Pitch_High, (CARD8)(pitch>>8), 0x0f); + /* Set U/V pitch if using planar formats */ + if( (pOverlay->pixelFormat == PIXEL_FMT_YV12) || + (pOverlay->pixelFormat == PIXEL_FMT_I420) ) { + /* Set U/V pitch */ /* Datasheet: Unit = double word - verified */ + setvideoreg(pSiS, Index_VI6326_Disp_UV_Buf_Pitch_Low, (CARD8)pitch >> 1); + setvideoregmask(pSiS, Index_VI6326_Disp_UV_Buf_Pitch_High, (CARD8)(pitch >> 9), 0x0f); + } + + /* set line buffer size */ + setvideoreg(pSiS, Index_VI6326_Line_Buffer_Size, pOverlay->lineBufSize); + + /* set scale factor */ + setvideoreg(pSiS, Index_VI6326_Hor_Scale, (CARD8)((pOverlay->HUSF) | 0xC0)); + setvideoregmask(pSiS, Index_VI6326_Hor_Scale_Integer, (CARD8)(pOverlay->HIntBit), 0x0F); + setvideoregmask(pSiS, Index_VI6326_Ver_Scale, (CARD8)(pOverlay->VUSF), 0x3F); + + /* TW: We don't have to wait for vertical retrace in all cases */ + if(pPriv->mustwait) { + watchdog = WATCHDOG_DELAY; + while ((!pOverlay->VBlankActiveFunc(pSiS)) && --watchdog); + if(!watchdog) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Xv: Waiting for vertical retrace timed-out\n"); + } + + /* set destination window position */ + setvideoreg(pSiS, Index_VI6326_Win_Hor_Disp_Start_Low, (CARD8)left); + setvideoreg(pSiS, Index_VI6326_Win_Hor_Disp_End_Low, (CARD8)right); + setvideoreg(pSiS, Index_VI6326_Win_Hor_Over, (CARD8)h_over); + + setvideoreg(pSiS, Index_VI6326_Win_Ver_Disp_Start_Low, (CARD8)top); + setvideoreg(pSiS, Index_VI6326_Win_Ver_Disp_End_Low, (CARD8)bottom); + setvideoreg(pSiS, Index_VI6326_Win_Ver_Over, (CARD8)v_over); + + /* Set Y start address */ + setvideoreg (pSiS, Index_VI6326_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY)); + setvideoreg (pSiS, Index_VI6326_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8)); + if(pSiS->oldChipset <= OC_SIS6326) { /* all old chipsets incl 6326 */ + /* Set overflow bits */ + setvideoregmask (pSiS, Index_VI6326_Disp_Capt_Y_Buf_Start_High, + (CARD8)(((pOverlay->PSY)>>12) & 0xF0), 0xF0); + /* Set framebuffer end address */ + setvideoreg (pSiS, Index_VI6326_Disp_Y_End, (CARD8)(pOverlay->YUVEnd)); + } else { /* 530/620 */ + /* Set overflow bits */ + setvideoregmask (pSiS, Index_VI6326_Disp_Capt_Y_Buf_Start_High, + (CARD8)(((pOverlay->PSY)>>13) & 0xF8), 0xF8); + } + + /* Set U/V start addresses if using plane formats */ + if( (pOverlay->pixelFormat == PIXEL_FMT_YV12) || + (pOverlay->pixelFormat == PIXEL_FMT_I420) ) { + + CARD32 PSU = pOverlay->PSU; + CARD32 PSV = pOverlay->PSV; + + /* set U/V start address */ + setvideoreg (pSiS, Index_VI6326_U_Buf_Start_Low, (CARD8)PSU); + setvideoreg (pSiS, Index_VI6326_U_Buf_Start_Middle,(CARD8)(PSU >> 8)); + + setvideoreg (pSiS, Index_VI6326_V_Buf_Start_Low, (CARD8)PSV); + setvideoreg (pSiS, Index_VI6326_V_Buf_Start_Middle,(CARD8)(PSV >> 8)); + + setvideoreg (pSiS, Index_VI6326_UV_Buf_Start_High, + (CARD8)(((PSU >> 16) & 0x0F) | ((PSV >> 12) & 0xF0)) ); + + if(pSiS->oldChipset > OC_SIS6326) { + /* Set bit 20 of the addresses in Misc5 (530/620 only) */ + setvideoreg (pSiS, Index_VI6326_Control_Misc5, + (CARD8)(((PSU >> (20-1)) & 0x02) | ((PSV >> (20-2)) & 0x04)) ); + } + } + + /* set brightness and contrast */ + set_brightness(pSiS, pPriv->brightness); + if(pSiS->oldChipset > OC_SIS6205C) { + set_contrast_data(pSiS, (pOverlay->dstBox.x2 - pOverlay->dstBox.x1) * + (pOverlay->dstBox.y2 - pOverlay->dstBox.y1)); + set_contrast(pSiS, pPriv->contrast); + } + + /* set format */ + set_format(pSiS, pOverlay); +} + +/* TW: Overlay MUST NOT be switched off while beam is over it */ +static void +close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv) +{ + CARD32 watchdog; + + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT1(pSiS)) && --watchdog); + if(pSiS->oldChipset > OC_SIS6326) { + /* what is this? */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40); + } + /* disable overlay */ + setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x02); +} + +static void +SIS6326DisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) +{ + SISPtr pSiS = SISPTR(pScrn); + + short srcPitch = pPriv->srcPitch; + short height = pPriv->height; + short width = pPriv->width; + SISOverlayRec overlay; + int srcOffsetX=0, srcOffsetY=0; + int sx, sy; + int index = 0; + int pitch; + + memset(&overlay, 0, sizeof(overlay)); + overlay.pixelFormat = pPriv->id; + overlay.pitch = srcPitch; + overlay.keyOP = VI6326_ROP_DestKey; /* DestKey mode */ + + overlay.dstBox.x1 = pPriv->drw_x - pScrn->frameX0; + overlay.dstBox.x2 = pPriv->drw_x + pPriv->drw_w - pScrn->frameX0; + overlay.dstBox.y1 = pPriv->drw_y - pScrn->frameY0; + overlay.dstBox.y2 = pPriv->drw_y + pPriv->drw_h - pScrn->frameY0; + + if((overlay.dstBox.x1 > overlay.dstBox.x2) || + (overlay.dstBox.y1 > overlay.dstBox.y2)) + return; + + if((overlay.dstBox.x2 < 0) || (overlay.dstBox.y2 < 0)) + return; + + if(overlay.dstBox.x1 < 0) { + srcOffsetX = pPriv->src_w * (-overlay.dstBox.x1) / pPriv->drw_w; + overlay.dstBox.x1 = 0; + } + if(overlay.dstBox.y1 < 0) { + srcOffsetY = pPriv->src_h * (-overlay.dstBox.y1) / pPriv->drw_h; + overlay.dstBox.y1 = 0; + } + + switch(pPriv->id){ + case PIXEL_FMT_YV12: + sx = (pPriv->src_x + srcOffsetX) & ~7; + sy = (pPriv->src_y + srcOffsetY) & ~1; + pitch = (width + 3) & ~3; + overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy * pitch; + overlay.PSV = overlay.PSY + pitch * height; + overlay.PSU = overlay.PSV + ((((width >> 1) + 3) & ~3) * (height >> 1)); + overlay.PSY >>= 2; + overlay.PSV >>= 2; + overlay.PSU >>= 2; + break; + case PIXEL_FMT_I420: + sx = (pPriv->src_x + srcOffsetX) & ~7; + sy = (pPriv->src_y + srcOffsetY) & ~1; + pitch = (width + 3) & ~3; + overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy * pitch; + overlay.PSU = overlay.PSY + pitch * height; + overlay.PSV = overlay.PSU + ((((width >> 1) + 3) & ~3) * (height >> 1)); + overlay.PSY >>= 2; + overlay.PSV >>= 2; + overlay.PSU >>= 2; + break; + case PIXEL_FMT_YUY2: + case PIXEL_FMT_UYVY: + case PIXEL_FMT_RGB6: + case PIXEL_FMT_RGB5: + default: + sx = (pPriv->src_x + srcOffsetX) & ~1; + sy = (pPriv->src_y + srcOffsetY); + overlay.PSY = (pPriv->bufAddr[pPriv->currentBuf] + sx*2 + sy*srcPitch); + overlay.PSY >>= 2; + break; + } + + /* FIXME: Is this correct? (Is it required to set the end address? + * Datasheet is not clear) - (reg does not exist on 530/620) + */ + overlay.YUVEnd = (pPriv->bufAddr[pPriv->currentBuf] + pPriv->totalSize) >> 14; + + /* FIXME: is it possible that srcW < 0 */ + overlay.srcW = pPriv->src_w - (sx - pPriv->src_x); + overlay.srcH = pPriv->src_h - (sy - pPriv->src_y); + + if ( (pPriv->oldx1 != overlay.dstBox.x1) || + (pPriv->oldx2 != overlay.dstBox.x2) || + (pPriv->oldy1 != overlay.dstBox.y1) || + (pPriv->oldy2 != overlay.dstBox.y2) ) { + pPriv->mustwait = 1; + pPriv->oldx1 = overlay.dstBox.x1; pPriv->oldx2 = overlay.dstBox.x2; + pPriv->oldy1 = overlay.dstBox.y1; pPriv->oldy2 = overlay.dstBox.y2; + } + + /* calculate line buffer length */ + calc_line_buf_size(&overlay); + + overlay.VBlankActiveFunc = vblank_active_CRT1; +/* overlay.GetScanLineFunc = get_scanline_CRT1; */ + + /* calculate scale factor */ + calc_scale_factor(pSiS, &overlay, pScrn, pPriv); + + /* set (not only determine) if line buffer is to be merged */ + if(pSiS->oldChipset > OC_SIS5597) { + int temp; + if(pSiS->oldChipset <= OC_SIS6326) temp = 352; + else temp = 384; + merge_line_buf(pSiS, pPriv, (overlay.srcW > temp)); + } + + /* set overlay */ + set_overlay(pSiS, &overlay, pPriv, index); + + /* enable overlay */ + if(pSiS->oldChipset > OC_SIS6326) { + setvideoregmask (pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40); + } + setvideoregmask (pSiS, Index_VI6326_Control_Misc0, 0x02, 0x02); + + pPriv->mustwait = 0; +} + +static FBLinearPtr +SIS6326AllocateOverlayMemory( + ScrnInfoPtr pScrn, + FBLinearPtr linear, + int size +){ + ScreenPtr pScreen; + FBLinearPtr new_linear; + + if(linear) { + if(linear->size >= size) + return linear; + + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; + + xf86FreeOffscreenLinear(linear); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, + NULL, NULL, NULL); + + if(!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 32, + PRIORITY_EXTREME); + + if(max_size < size) return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, + NULL, NULL, NULL); + } + if (!new_linear) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Xv: Failed to allocate %dK of video memory\n", size/1024); + + return new_linear; +} + +static void +SIS6326FreeOverlayMemory(ScrnInfoPtr pScrn) +{ + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } +} + +static void +SIS6326StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + SISPtr pSiS = SISPTR(pScrn); + + if(pPriv->grabbedByV4L) + return; + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(shutdown) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + close_overlay(pSiS, pPriv); + pPriv->mustwait = 1; + } + SIS6326FreeOverlayMemory(pScrn); + pPriv->videoStatus = 0; + pSiS->VideoTimerCallback = NULL; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + pSiS->VideoTimerCallback = SIS6326VideoTimerCallback; + } + } +} + +static int +SIS6326PutImage( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data +){ + SISPtr pSiS = SISPTR(pScrn); + SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + + int totalSize=0; + int depth = pSiS->CurrentLayout.bitsPerPixel >> 3; + + if(pPriv->grabbedByV4L) + return Success; + + pPriv->drw_x = drw_x; + pPriv->drw_y = drw_y; + pPriv->drw_w = drw_w; + pPriv->drw_h = drw_h; + pPriv->src_x = src_x; + pPriv->src_y = src_y; + pPriv->src_w = src_w; + pPriv->src_h = src_h; + pPriv->id = id; + pPriv->height = height; + pPriv->width = width; + + /* TW: Pixel formats: + 1. YU12: 3 planes: H V + Y sample period 1 1 (8 bit per pixel) + V sample period 2 2 (8 bit per pixel, subsampled) + U sample period 2 2 (8 bit per pixel, subsampled) + + Y plane is fully sampled (width*height), U and V planes + are sampled in 2x2 blocks, hence a group of 4 pixels requires + 4 + 1 + 1 = 6 bytes. The data is planar, ie in single planes + for Y, U and V. + 2. UYVY: 3 planes: H V + Y sample period 1 1 (8 bit per pixel) + V sample period 2 1 (8 bit per pixel, subsampled) + U sample period 2 1 (8 bit per pixel, subsampled) + Y plane is fully sampled (width*height), U and V planes + are sampled in 2x1 blocks, hence a group of 4 pixels requires + 4 + 2 + 2 = 8 bytes. The data is bit packed, there are no separate + Y, U or V planes. + Bit order: U0 Y0 V0 Y1 U2 Y2 V2 Y3 ... + 3. I420: Like YU12, but planes U and V are in reverse order. + 4. YUY2: Like UYVY, but order is + Y0 U0 Y1 V0 Y2 U2 Y3 V2 ... + */ + + switch(id){ + case PIXEL_FMT_YV12: + case PIXEL_FMT_I420: + pPriv->srcPitch = (width + 7) & ~7; + /* Size = width * height * 3 / 2 */ + totalSize = (pPriv->srcPitch * height * 3) >> 1; + break; + case PIXEL_FMT_YUY2: + case PIXEL_FMT_UYVY: + case PIXEL_FMT_RGB5: + case PIXEL_FMT_RGB6: + default: + pPriv->srcPitch = ((width << 1) + 3) & ~3; + /* Size = width * 2 * height */ + totalSize = pPriv->srcPitch * height; + } + + pPriv->totalSize = totalSize; + + /* allocate memory (we do doublebuffering) */ + if(!(pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear, + totalSize<<1))) + return BadAlloc; + + /* fixup pointers */ + pPriv->bufAddr[0] = (pPriv->linear->offset * depth); + pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize; + + /* copy data */ + memcpy(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); + + SIS6326DisplayVideo(pScrn, pPriv); + + /* update cliplist */ + if( pPriv->autopaintColorKey && + (pPriv->grabbedByV4L || !RegionsEqual(&pPriv->clip, clipBoxes))) { + /* We always paint colorkey for V4L */ + if (!pPriv->grabbedByV4L) + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + /* xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); - for X4.2 */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + pPriv->currentBuf ^= 1; + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + pSiS->VideoTimerCallback = SIS6326VideoTimerCallback; + + return Success; +} + +static int +SIS6326QueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + SISPtr pSiS = SISPTR(pScrn); + int pitchY, pitchUV; + int size, sizeY, sizeUV; + + if(*w < IMAGE_MIN_WIDTH) *w = IMAGE_MIN_WIDTH; + if(*h < IMAGE_MIN_HEIGHT) *h = IMAGE_MIN_HEIGHT; + + if(pSiS->oldChipset < OC_SIS6326) { + if(*w > IMAGE_MAX_WIDTH_5597) *w = IMAGE_MAX_WIDTH_5597; + if(*h > IMAGE_MAX_HEIGHT_5597) *h = IMAGE_MAX_HEIGHT_5597; + } else { + if(*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; + } + + switch(id) { + case PIXEL_FMT_YV12: + case PIXEL_FMT_I420: + *w = (*w + 7) & ~7; + *h = (*h + 1) & ~1; + pitchY = *w; + pitchUV = *w >> 1; + if(pitches) { + pitches[0] = pitchY; + pitches[1] = pitches[2] = pitchUV; + } + sizeY = pitchY * (*h); + sizeUV = pitchUV * ((*h) >> 1); + if(offsets) { + offsets[0] = 0; + offsets[1] = sizeY; + offsets[2] = sizeY + sizeUV; + } + size = sizeY + (sizeUV << 1); + break; + case PIXEL_FMT_YUY2: + case PIXEL_FMT_UYVY: + case PIXEL_FMT_RGB5: + case PIXEL_FMT_RGB6: + default: + *w = (*w + 1) & ~1; + pitchY = *w << 1; + if(pitches) pitches[0] = pitchY; + if(offsets) offsets[0] = 0; + size = pitchY * (*h); + break; + } + + return size; +} + +static void +SIS6326VideoTimerCallback (ScrnInfoPtr pScrn, Time now) +{ + SISPtr pSiS = SISPTR(pScrn); + SISPortPrivPtr pPriv = NULL; + unsigned char sridx, cridx; + + pSiS->VideoTimerCallback = NULL; + + if(!pScrn->vtSema) return; + + if(pSiS->adaptor) { + pPriv = GET_PORT_PRIVATE(pScrn); + if(!pPriv->videoStatus) + pPriv = NULL; + } + + if(pPriv) { + if(pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if(pPriv->offTime < currentTime.milliseconds) { + if(pPriv->videoStatus & OFF_TIMER) { + /* Turn off the overlay */ + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); + close_overlay(pSiS, pPriv); + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); + pPriv->mustwait = 1; + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + pSiS->VideoTimerCallback = SIS6326VideoTimerCallback; + } else + if(pPriv->videoStatus & FREE_TIMER) { + SIS6326FreeOverlayMemory(pScrn); + pPriv->mustwait = 1; + pPriv->videoStatus = 0; + } + } else + pSiS->VideoTimerCallback = SIS6326VideoTimerCallback; + } + } +} + +/* TW: Offscreen surface stuff for v4l */ + +static int +SIS6326AllocSurface ( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +) +{ + SISPtr pSiS = SISPTR(pScrn); + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + int size, depth; + + if((w < IMAGE_MIN_WIDTH) || (h < IMAGE_MIN_HEIGHT)) + return BadValue; + + if(pSiS->oldChipset < OC_SIS6326) { + if((w > IMAGE_MAX_WIDTH_5597) || (h > IMAGE_MAX_HEIGHT_5597)) + return BadValue; + } else { + if((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT)) + return BadValue; + } + + if(pPriv->grabbedByV4L) + return BadAlloc; + + depth = pSiS->CurrentLayout.bitsPerPixel >> 3; + + w = (w + 1) & ~1; + pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */ + size = h * pPriv->pitch; + pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear, size); + if(!pPriv->linear) + return BadAlloc; + + pPriv->totalSize = size; + + pPriv->offset = pPriv->linear->offset * depth; + + surface->width = w; + surface->height = h; + surface->pScrn = pScrn; + surface->id = id; + surface->pitches = &pPriv->pitch; + surface->offsets = &pPriv->offset; + surface->devPrivate.ptr = (pointer)pPriv; + + close_overlay(pSiS, pPriv); + pPriv->videoStatus = 0; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + pSiS->VideoTimerCallback = NULL; + pPriv->grabbedByV4L = TRUE; + return Success; +} + +static int +SIS6326StopSurface (XF86SurfacePtr surface) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); + SISPtr pSiS = SISPTR(surface->pScrn); + + if(pPriv->grabbedByV4L && pPriv->videoStatus) { + close_overlay(pSiS, pPriv); + pPriv->mustwait = 1; + pPriv->videoStatus = 0; + } + return Success; +} + +static int +SIS6326FreeSurface (XF86SurfacePtr surface) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); + + if(pPriv->grabbedByV4L) { + SIS6326StopSurface(surface); + SIS6326FreeOverlayMemory(surface->pScrn); + pPriv->grabbedByV4L = FALSE; + } + return Success; +} + +static int +SIS6326GetSurfaceAttribute ( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +) +{ + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + return SIS6326GetPortAttribute(pScrn, attribute, value, (pointer)pPriv); +} + +static int +SIS6326SetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +) +{ + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);; + + return SIS6326SetPortAttribute(pScrn, attribute, value, (pointer)pPriv); +} + +static int +SIS6326DisplaySurface ( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +) +{ + ScrnInfoPtr pScrn = surface->pScrn; + SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); + + if(!pPriv->grabbedByV4L) + return Success; + + pPriv->drw_x = drw_x; + pPriv->drw_y = drw_y; + pPriv->drw_w = drw_w; + pPriv->drw_h = drw_h; + pPriv->src_x = src_x; + pPriv->src_y = src_y; + pPriv->src_w = src_w; + pPriv->src_h = src_h; + pPriv->id = surface->id; + pPriv->height = surface->height; + pPriv->bufAddr[0] = surface->offsets[0]; + pPriv->currentBuf = 0; + pPriv->srcPitch = surface->pitches[0]; + + SIS6326DisplayVideo(pScrn, pPriv); + + if(pPriv->autopaintColorKey) { + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + +XF86OffscreenImageRec SIS6326OffscreenImages[2] = +{ + { + &SIS6326Images[0], /* YUV2 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SIS6326AllocSurface, + SIS6326FreeSurface, + SIS6326DisplaySurface, + SIS6326StopSurface, + SIS6326GetSurfaceAttribute, + SIS6326SetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES, + &SIS6326Attributes[0] /* Support all attributes */ + }, + { + &SIS6326Images[1], /* UYVY */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SIS6326AllocSurface, + SIS6326FreeSurface, + SIS6326DisplaySurface, + SIS6326StopSurface, + SIS6326GetSurfaceAttribute, + SIS6326SetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES, + &SIS6326Attributes[0] /* Support all attributes */ + }, +}; + +static void +SIS6326InitOffscreenImages(ScreenPtr pScrn) +{ + xf86XVRegisterOffscreenImages(pScrn, SIS6326OffscreenImages, 2); +} +#else +int sis_foo; +#endif + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.23 Thu Jan 10 14:05:43 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c Wed Jan 29 10:42:16 2003 @@ -1,4 +1,37 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.23 2002/01/10 19:05:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.25 2003/01/29 15:42:16 eich Exp $ */ +/* + * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2002 Thomas Winischhofer, Vienna, Austria. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk> + * Thomas Winischhofer <thomas@winischhofer.net> + */ + +#if 0 +#define CTSCE /* TW: Include enhanced color expansion code */ +#endif /* This produces drawing errors sometimes */ #include "xf86.h" #include "xf86_OSproc.h" @@ -7,11 +40,11 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" +#include "sis_accel.h" #include "sis_regs.h" #include "sis.h" #include "xaarop.h" -Bool SiSAccelInit(ScreenPtr pScreen); static void SiSSync(ScrnInfoPtr pScrn); static void SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); @@ -23,7 +56,7 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h); -static void SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, +static void SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, int rop, unsigned int planemask); static void SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, @@ -38,37 +71,60 @@ int srcx, int srcy, int offset ); #endif static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, - int left, int top, int right, int bottom); + int left, int top, int right, int bottom); static void SiSDisableClipping (ScrnInfoPtr pScrn); -static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, +static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags); + int x1, int y1, int x2, int y2, int flags); static void SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir); - + int x, int y, int len, int dir); +#ifdef CTSCE +static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask); +static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft); +static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#endif -Bool +Bool SiSAccelInit(ScreenPtr pScreen) { - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSiS = SISPTR(pScrn); - BoxRec AvailFBArea; - int offset, topFB; + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + BoxRec AvailFBArea; + int topFB, i; + int reservedFbSize; + int UsableFbSize; + unsigned char *AvailBufBase; pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) - return FALSE; + if (!infoPtr) return FALSE; + + infoPtr->Flags = LINEAR_FRAMEBUFFER | + OFFSCREEN_PIXMAPS | + PIXMAP_CACHE; - infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; - + /* Sync */ infoPtr->Sync = SiSSync; - /* Clipping and lines only works on 5597 and 6326 + + /* Screen To Screen copy */ + infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; + + /* Solid fill */ + infoPtr->SetupForSolidFill = SiSSetupForFillRectSolid; + infoPtr->SubsequentSolidFillRect = SiSSubsequentFillRectSolid; + infoPtr->SolidFillFlags = NO_PLANEMASK; + + /* On 5597/5598 and 6326, clipping and lines only work for 1024, 2048, 4096 logical width */ - if (pSiS->ValidWidth) { + if(pSiS->ValidWidth) { + /* Clipping */ infoPtr->SetClippingRectangle = SiSSetClippingRectangle; infoPtr->DisableClipping = SiSDisableClipping; infoPtr->ClippingFlags = @@ -77,135 +133,188 @@ HARDWARE_CLIP_MONO_8x8_FILL | HARDWARE_CLIP_SOLID_FILL ; - /* Solid Lines */ - infoPtr->SolidLineFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorVertLine; + /* Solid Lines */ + infoPtr->SetupForSolidLine = SiSSetupForSolidLine; + infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; + infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorVertLine; + infoPtr->SolidLineFlags = NO_PLANEMASK; } - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = SiSSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = SiSSubsequentFillRectSolid; - - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; - infoPtr->SetupForScreenToScreenCopy = - SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - SiSSubsequentScreenToScreenCopy; - - if (pScrn->bitsPerPixel != 24) { - infoPtr->Mono8x8PatternFillFlags = - NO_PLANEMASK | + if(pScrn->bitsPerPixel != 24) { + /* 8x8 mono pattern */ + infoPtr->SetupForMono8x8PatternFill = SiSSetupForMono8x8PatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMono8x8PatternFillRect; + infoPtr->Mono8x8PatternFillFlags = + NO_PLANEMASK | HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_PROGRAMMED_ORIGIN | BIT_ORDER_IN_BYTE_MSBFIRST; - infoPtr->SetupForMono8x8PatternFill = - SiSSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - SiSSubsequentMono8x8PatternFillRect; } - -#if 0 /* Don't work until we implement skipleft */ - if (pScrn->bitsPerPixel != 24) { - infoPtr->ScreenToScreenColorExpandFillFlags = GXCOPY_ONLY | - CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpandFill; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpandFill; +#ifdef CTSCE + if(pScrn->bitsPerPixel != 24) { + /* TW: per-scanline color expansion (using indirect method) */ + pSiS->ColorExpandBufferNumber = 4; + pSiS->ColorExpandBufferCountMask = 0x03; + pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31) / 32) * 4; + + infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; + infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0]; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + SiSSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + SiSSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + SiSSubsequentColorExpandScanline; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + NO_PLANEMASK | + CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST | + LEFT_EDGE_CLIPPING; + } else { + pSiS->ColorExpandBufferNumber = 0; } +#else + pSiS->ColorExpandBufferNumber = 0; #endif + topFB = pSiS->maxxfbmem; + + reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize; + + UsableFbSize = topFB - reservedFbSize; + + /* Layout: (Sizes do not reflect correct proportions) + * |--------------++++++++++++++++++++| ====================~~~~~~~~~~~~| + * UsableFbSize ColorExpandBuffers | TurboQueue HWCursor + * topFB + */ + + if(pSiS->ColorExpandBufferNumber) { + AvailBufBase = pSiS->FbBase + UsableFbSize; + for (i = 0; i < pSiS->ColorExpandBufferNumber; i++) { + pSiS->ColorExpandBufferAddr[i] = AvailBufBase + + i * pSiS->PerColorExpandBufferSize; + pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize + + i * pSiS->PerColorExpandBufferSize; + } + } AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->displayWidth; - if (pSiS->HWCursor || pSiS->TurboQueue) - offset = 262144; - else - offset = 0; - - topFB = (pSiS->maxxfbmem >= (pSiS->FbMapSize - offset)) ? - pSiS->maxxfbmem : pSiS->FbMapSize - offset; - AvailFBArea.y2 = (topFB) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); + AvailFBArea.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel / 8) - 1; if (AvailFBArea.y2 < 0) AvailFBArea.y2 = 32767; + if(AvailFBArea.y2 < pScrn->currentMode->VDisplay) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Not enough video RAM for accelerator. At least " + "%dKB needed, %dKB available\n", + ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* TW: +8 for make it sure */ + * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8, + pSiS->maxxfbmem/1024); + pSiS->NoAccel = TRUE; + pSiS->NoXvideo = TRUE; + XAADestroyInfoRec(pSiS->AccelInfoPtr); + pSiS->AccelInfoPtr = NULL; + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Frame Buffer From (%d,%d) To (%d,%d)\n", + AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2); + xf86InitFBManager(pScreen, &AvailFBArea); return(XAAInit(pScreen, infoPtr)); } +/* sync */ static void SiSSync(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); sisBLTSync; } -static void -SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) +/* Clipping */ +static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, + int left, int top, int right, int bottom) { SISPtr pSiS = SISPTR(pScrn); sisBLTSync; - sisSETFGCOLOR(color); - sisSETBGCOLOR(color); - sisSETROP(XAACopyROP[rop]); - sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); - /* - * If you don't support a write planemask, and have set the - * appropriate flag, then the planemask can be safely ignored. - * The same goes for the raster-op if only GXcopy is supported. - */ - /*SETWRITEPLANEMASK(planemask);*/ + sisSETCLIPTOP(left,top); + sisSETCLIPBOTTOM(right,bottom); + pSiS->ClipEnabled = TRUE; } -static void -SiSSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) +static void SiSDisableClipping (ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int destaddr, op; - - destaddr = y * pScrn->displayWidth + x; - op = sisCMDBLT | sisSRCBG | sisTOP2BOTTOM | sisLEFT2RIGHT; - if (pSiS->ClipEnabled) - op |= sisCLIPINTRN | sisCLIPENABL; - destaddr *= (pScrn->bitsPerPixel / 8); - - sisBLTSync; - sisSETHEIGHTWIDTH(h-1, w * (pScrn->bitsPerPixel/8)-1); - sisSETDSTADDR(destaddr); - sisSETCMD(op); + pSiS->ClipEnabled = FALSE; } -static void -SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, +static const int sisALUConv[] = +{ + 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 sisPatALUConv[] = +{ + 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 */ +}; + + +/* Screen to screen copy */ +static void +SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int transparency_color) { SISPtr pSiS = SISPTR(pScrn); sisBLTSync; - sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); + sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset); + sisSETROP(XAACopyROP[rop]); pSiS->Xdirection = xdir; pSiS->Ydirection = ydir; } -static void -SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, +static void +SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h) { SISPtr pSiS = SISPTR(pScrn); @@ -213,16 +322,16 @@ int op ; op = sisCMDBLT | sisSRCVIDEO; - if (pSiS->Ydirection == -1) { + if(pSiS->Ydirection == -1) { op |= sisBOTTOM2TOP; - srcaddr = (y1 + h - 1) * pScrn->displayWidth; - destaddr = (y2 + h - 1) * pScrn->displayWidth; + srcaddr = (y1 + h - 1) * pSiS->CurrentLayout.displayWidth; + destaddr = (y2 + h - 1) * pSiS->CurrentLayout.displayWidth; } else { op |= sisTOP2BOTTOM; - srcaddr = y1 * pScrn->displayWidth; - destaddr = y2 * pScrn->displayWidth; + srcaddr = y1 * pSiS->CurrentLayout.displayWidth; + destaddr = y2 * pSiS->CurrentLayout.displayWidth; } - if (pSiS->Xdirection == -1) { + if(pSiS->Xdirection == -1) { op |= sisRIGHT2LEFT; srcaddr += x1 + w - 1; destaddr += x2 + w - 1; @@ -231,22 +340,58 @@ srcaddr += x1; destaddr += x2; } - if (pSiS->ClipEnabled) + if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; - srcaddr *= (pScrn->bitsPerPixel/8); - destaddr *= (pScrn->bitsPerPixel/8); - if (((pScrn->bitsPerPixel/8)>1) && (pSiS->Xdirection == -1)) { - srcaddr += (pScrn->bitsPerPixel/8)-1; - destaddr += (pScrn->bitsPerPixel/8)-1; + + srcaddr *= (pSiS->CurrentLayout.bitsPerPixel/8); + destaddr *= (pSiS->CurrentLayout.bitsPerPixel/8); + if(((pSiS->CurrentLayout.bitsPerPixel / 8) > 1) && (pSiS->Xdirection == -1)) { + srcaddr += (pSiS->CurrentLayout.bitsPerPixel/8)-1; + destaddr += (pSiS->CurrentLayout.bitsPerPixel/8)-1; } sisBLTSync; sisSETSRCADDR(srcaddr); + sisSETDSTADDR(destaddr); + sisSETHEIGHTWIDTH(h-1, w * (pSiS->CurrentLayout.bitsPerPixel/8)-1); + sisSETCMD(op); +} + +/* solid fill */ +static void +SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask) +{ + SISPtr pSiS = SISPTR(pScrn); + + sisBLTSync; + sisSETBGROPCOL(XAACopyROP[rop], color); + sisSETFGROPCOL(XAACopyROP[rop], color); + sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset); +} + +static void +SiSSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + SISPtr pSiS = SISPTR(pScrn); + int destaddr, op; + + destaddr = y * pSiS->CurrentLayout.displayWidth + x; + + op = sisCMDBLT | sisSRCBG | sisTOP2BOTTOM | sisLEFT2RIGHT; + + if(pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; + + destaddr *= (pSiS->CurrentLayout.bitsPerPixel / 8); + + sisBLTSync; + sisSETHEIGHTWIDTH(h-1, w * (pSiS->CurrentLayout.bitsPerPixel/8)-1); sisSETDSTADDR(destaddr); - sisSETHEIGHTWIDTH(h-1, w * (pScrn->bitsPerPixel/8)-1); sisSETCMD(op); } +/* 8x8 mono */ static void SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, int rop, unsigned int planemask) @@ -254,21 +399,17 @@ SISPtr pSiS = SISPTR(pScrn); unsigned int *patternRegPtr; int i; - int dstpitch; (void)XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop); - dstpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; sisBLTSync; - sisSETBGCOLOR(bg); - sisSETFGCOLOR(fg); - if (bg != -1) { - sisSETROPBG(0xcc); /* copy */ + if(bg != -1) { + sisSETBGROPCOL(0xcc, bg); /* copy */ } else { - sisSETROPBG(0xAA); /* dst */ + sisSETBGROPCOL(0xAA, bg); /* noop */ } - sisSETROPFG(rop); - sisSETPITCH(0, dstpitch); + sisSETFGROPCOL(rop, fg); + sisSETPITCH(0, pSiS->scrnOffset); sisSETSRCADDR(0); patternRegPtr = (unsigned int *)sisSETPATREG(); pSiS->sisPatternReg[0] = pSiS->sisPatternReg[2] = patternx ; @@ -283,28 +424,35 @@ SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - int dstaddr; - register unsigned char *patternRegPtr ; - register unsigned char *srcPatternRegPtr ; - register unsigned int *patternRegPtrL ; - int i, k ; - unsigned short tmp; - int shift ; - int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | - sisPATFG | sisSRCBG ; + SISPtr pSiS = SISPTR(pScrn); + int dstaddr; + register unsigned char *patternRegPtr; + register unsigned char *srcPatternRegPtr; + register unsigned int *patternRegPtrL; + int i, k; + unsigned short tmp; + int shift; + int op = sisCMDCOLEXP | + sisTOP2BOTTOM | + sisLEFT2RIGHT | + sisPATFG | + sisSRCBG; + if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + + dstaddr = ( y * pSiS->CurrentLayout.displayWidth + x ) * + pSiS->CurrentLayout.bitsPerPixel / 8; - dstaddr = ( y * pScrn->displayWidth + x ) * pScrn->bitsPerPixel / 8; sisBLTSync; + patternRegPtr = sisSETPATREG(); srcPatternRegPtr = (unsigned char *)pSiS->sisPatternReg ; shift = 8 - patternx ; for ( i = 0, k = patterny ; i < 8 ; i++, k++ ) { tmp = srcPatternRegPtr[k]<<8 | srcPatternRegPtr[k] ; tmp >>= shift ; - patternRegPtr[i] = tmp & 0xff ; + patternRegPtr[i] = tmp & 0xff; } patternRegPtrL = (unsigned int *)sisSETPATREG(); for ( i = 2 ; i < 16 /* sisPatternHeight */; ) { @@ -313,119 +461,21 @@ } sisSETDSTADDR(dstaddr); - sisSETHEIGHTWIDTH(h-1, w*(pScrn->bitsPerPixel/8)-1); + sisSETHEIGHTWIDTH(h-1, w*(pSiS->CurrentLayout.bitsPerPixel/8)-1); sisSETCMD(op); } - -#if 0 -/* - * setup for screen-to-screen color expansion - */ -static void -SiSSetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - int isTransparent = (bg == -1); - - /*ErrorF("SISSetupScreenToScreenColorExpand()\n");*/ - - /* - * check transparency - */ - /* becareful with rop */ - - sisBLTSync; - if (isTransparent) { - sisSETBGCOLOR(bg); - sisSETFGCOLOR(fg); - sisSETROPFG(0xf0); /* pat copy */ - sisSETROPBG(0xAA); /* dst */ - } else { - sisSETBGCOLOR(bg); - sisSETFGCOLOR(fg); - sisSETROPFG(0xf0); /* pat copy */ - sisSETROPBG(0xcc); /* copy */ - } -} - -/* - * executing screen-to-screen color expansion - */ -static void -SiSSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int offset ) -/* Offset needs to be taken into account. By now, is not used */ -{ - SISPtr pSiS = SISPTR(pScrn); - int destpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; - int srcaddr = srcy * destpitch * + srcx ; - int destaddr = y * destpitch + x * pScrn->bitsPerPixel / 8; - int srcpitch ; - int ww ; - int widthTodo ; - int op ; - - op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | sisPATFG | sisSRCBG | sisCMDENHCOLEXP ; - if (pSiS->ClipEnabled) - op |= sisCLIPINTRN | sisCLIPENABL; - - -/* ErrorF("SISSubsequentScreenToScreenColorExpand()\n"); */ -#define maxWidth 144 - /* can't expand more than maxWidth in one time. - it's a work around for scanline greater than maxWidth - */ - destpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; - srcpitch = ((w + 31)& ~31) /8 ; - sisBLTSync; - sisSETPITCH(srcpitch, destpitch); - widthTodo = w ; - do { - ww = widthTodo < maxWidth ? widthTodo : maxWidth ; - sisSETDSTADDR(destaddr); - sisSETSRCADDR(srcaddr); - sisSETHEIGHTWIDTH(h-1, ww*(pScrn->bitsPerPixel / 8)-1); - sisSETCMD(op); - srcaddr += ww ; - destaddr += ww*pScrn->bitsPerPixel / 8 ; - widthTodo -= ww ; - } while ( widthTodo > 0 ) ; -} -#endif - -static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, - int left, int top, int right, int bottom) -{ - SISPtr pSiS = SISPTR(pScrn); - - sisBLTSync; - sisSETCLIPTOP(left,top); - sisSETCLIPBOTTOM(right,bottom); - pSiS->ClipEnabled = TRUE; - -} -static void SiSDisableClipping (ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - pSiS->ClipEnabled = FALSE; -} - +/* Line */ static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); sisBLTSync; - sisSETFGCOLOR(color); - sisSETBGCOLOR(0); - sisSETROP(XAACopyROP[rop]); /* dst */ + sisSETBGROPCOL(XAACopyROP[rop], 0); + sisSETFGROPCOL(XAACopyROP[rop], color); } - static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) @@ -433,25 +483,30 @@ SISPtr pSiS = SISPTR(pScrn); int op ; int major, minor, err,K1,K2, tmp; + op = sisCMDLINE | sisSRCFG; + if ((flags & OMIT_LAST)) op |= sisLASTPIX; - if (pSiS->ClipEnabled) + + if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + if ((major = x2 - x1) <= 0) { major = -major; - } else - op |= sisXINCREASE;; + } else + op |= sisXINCREASE; + if ((minor = y2 - y1) <= 0) { minor = -minor; - } else + } else op |= sisYINCREASE; + if (minor >= major) { tmp = minor; minor = major; major = tmp; - } - else + } else op |= sisXMAJOR; K1 = (minor - major)<<1; @@ -465,31 +520,132 @@ sisSETLineErrorTerm((short)err); sisSETLineMajorCount((short)major); sisSETCMD(op); -/* sisBLTSync;*/ } - static void SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir) { SISPtr pSiS = SISPTR(pScrn); int destaddr, op; + + destaddr = y * pSiS->CurrentLayout.displayWidth + x; - destaddr = y * pScrn->displayWidth + x; op = sisCMDBLT | sisSRCFG | sisTOP2BOTTOM | sisLEFT2RIGHT; + if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; - destaddr *= (pScrn->bitsPerPixel / 8); + + destaddr *= (pSiS->CurrentLayout.bitsPerPixel / 8); sisBLTSync; - sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); + + sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset); + + if(dir == DEGREES_0) { + sisSETHEIGHTWIDTH(0, len * (pSiS->CurrentLayout.bitsPerPixel >> 3) - 1); + } else { + sisSETHEIGHTWIDTH(len - 1, (pSiS->CurrentLayout.bitsPerPixel >> 3) - 1); + } + + sisSETDSTADDR(destaddr); + sisSETCMD(op); +} + +#ifdef CTSCE +/* TW: ----- CPU To Screen Color Expand (scanline-wise) ------ */ +static void +SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask) +{ + SISPtr pSiS=SISPTR(pScrn); + + pSiS->CommandReg = 0; + + pSiS->CommandReg |= (sisCMDECOLEXP | + sisLEFT2RIGHT | + sisTOP2BOTTOM); + + sisBLTSync; + + /* TW: The combination of flags in the following + * is not understandable. However, this is the + * only combination that seems to work. + */ + if(bg == -1) { + sisSETROPBG(0xAA); /* dst = dst (=noop) */ + pSiS->CommandReg |= sisSRCFG; + } else { + sisSETBGROPCOL(sisPatALUConv[rop], bg); + pSiS->CommandReg |= sisSRCFG | sisPATBG; + } + + sisSETFGROPCOL(sisALUConv[rop], fg); + + sisSETDSTPITCH(pSiS->scrnOffset); +} - if(dir == DEGREES_0) - sisSETHEIGHTWIDTH(0, len * (pScrn->bitsPerPixel>>3)-1); - else - sisSETHEIGHTWIDTH(len-1, (pScrn->bitsPerPixel>>3)-1 ); +static void +SiSSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, int y, int w, + int h, int skipleft) +{ + SISPtr pSiS = SISPTR(pScrn); + int _x0, _y0, _x1, _y1; + int op = pSiS->CommandReg; + + if(skipleft > 0) { + _x0 = x + skipleft; + _y0 = y; + _x1 = x + w; + _y1 = y + h; + sisSETCLIPTOP(_x0, _y0); + sisSETCLIPBOTTOM(_x1, _y1); + op |= sisCLIPENABL; + } else { + op &= (~(sisCLIPINTRN | sisCLIPENABL)); + } + + sisSETSRCPITCH(((((w+7)/8)+3) >> 2) * 4); + + sisSETHEIGHTWIDTH(1-1, (w * (pSiS->CurrentLayout.bitsPerPixel/8)) - 1); + + pSiS->xcurrent = x; + pSiS->ycurrent = y; + + pSiS->CommandReg = op; +} + +static void +SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + SISPtr pSiS = SISPTR(pScrn); + long cbo = pSiS->ColorExpandBufferScreenOffset[bufno]; + int op = pSiS->CommandReg; + int destaddr; + + destaddr = (pSiS->ycurrent * pSiS->CurrentLayout.displayWidth) + pSiS->xcurrent; + destaddr *= (pSiS->CurrentLayout.bitsPerPixel / 8); + + /* TW: Wait until there is no color expansion command in queue */ + /* sisBLTSync; */ + + sisSETSRCADDR(cbo); + sisSETDSTADDR(destaddr); + sisSETCMD(op); + + pSiS->ycurrent++; + + /* TW: Wait for eventual color expand commands to finish */ + /* (needs to be done, otherwise the data in the buffer may + * be overwritten while accessed by the hardware) + */ + while((MMIO_IN32(pSiS->IOBase, 0x8284) & 0x80000000)) {} + + sisBLTSync; } +#endif /* CTSCE */ + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h:1.2 --- /dev/null Thu Feb 27 12:31:38 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h Wed Jan 29 10:42:16 2003 @@ -0,0 +1,237 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.2 2003/01/29 15:42:16 eich Exp $ */ +/* + * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk> + * Thomas Winischhofer <thomas@winischhofer.net> + */ + +/* Definitions for the SIS engine communication. ------------------------------------ */ + +/* For pre-530 chipsets only!!! */ + +/* Engine Registers for 1st generation engines (5597/5598/6326) */ +const int sisReg32MMIO[] = { + 0x8280,0x8284,0x8288,0x828C,0x8290,0x8294, + 0x8298,0x829C,0x82A0,0x82A4,0x82A8,0x82AC +}; + +#define BR(x) sisReg32MMIO[x] + +/* These are done using Memory Mapped IO, of the registers */ +/* + * Modified for Sis by Xavier Ducoin (xavier@rd.lectra.fr) + * + */ + +/* Command Reg 0 (0x82aa, [15:0]) */ +#define sisSRCBG 0x0000 /* source select */ +#define sisSRCFG 0x0001 +#define sisSRCVIDEO 0x0002 +#define sisSRCSYSTEM 0x0003 + +#define sisPATFG 0x0004 /* pattern select */ +#define sisPATREG 0x0008 +#define sisPATBG 0x0000 + +#define sisLEFT2RIGHT 0x0010 /* Direction select */ +#define sisRIGHT2LEFT 0x0000 +#define sisTOP2BOTTOM 0x0020 +#define sisBOTTOM2TOP 0x0000 +#define sisXINCREASE sisLEFT2RIGHT +#define sisYINCREASE sisTOP2BOTTOM + +#define sisCLIPENABL 0x0040 /* Clipping select */ +#define sisCLIPINTRN 0x0080 +#define sisCLIPEXTRN 0x0000 + +#define sisCMDBLT 0x0000 /* Command select */ +#define sisCMDBLTMSK 0x0100 +#define sisCMDCOLEXP 0x0200 +#define sisCMDLINE 0x0300 +#define sisFLGECOLEXP 0x2000 +#define sisCMDECOLEXP (sisCMDCOLEXP | sisFLGECOLEXP) + +#define sisLASTPIX 0x0800 /* Line parameters */ +#define sisXMAJOR 0x0400 + + +/* Macros to do useful things with the SIS BitBLT engine */ + +#define sisBLTSync \ + while(MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} + +/* According to SiS 6326 2D programming guide, 16 bits position at */ +/* 0x82A8 returns queue free. But this don't work, so don't wait */ +/* anything when turbo-queue is enabled. If there are frequent syncs */ +/* this should work. But not for xaa_benchmark :-( */ + +/* TW: Bit 16 only applies to the hardware queue, not the software + * (=turbo) queue. + */ + +#define sisBLTWAIT \ + if(!pSiS->TurboQueue) { \ + while(MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} \ + } else { \ + sisBLTSync \ + } + +#define sisSETPATREG() \ + ((unsigned char *)(pSiS->IOBase + BR(11))) + +#define sisSETPATREGL() \ + ((unsigned long *)(pSiS->IOBase + BR(11))) + +/* trigger command */ +#define sisSETCMD(op) \ + { \ + unsigned long temp; \ + MMIO_OUT16(pSiS->IOBase, BR(10) + 2, op); \ + temp = MMIO_IN32(pSiS->IOBase, BR(10)); \ + } + +/* set foreground color and fg ROP */ +#define sisSETFGROPCOL(rop, color) \ + MMIO_OUT32(pSiS->IOBase, BR(4), ((rop << 24) | (color & 0xFFFFFF))); + +/* set background color and bg ROP */ +#define sisSETBGROPCOL(rop, color) \ + MMIO_OUT32(pSiS->IOBase, BR(5), ((rop << 24) | (color & 0xFFFFFF))); + +/* background color */ +#define sisSETBGCOLOR(bgColor) \ + MMIO_OUT32(pSiS->IOBase, BR(5), (bgColor)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor) +#endif + +/* foreground color */ +#define sisSETFGCOLOR(fgColor) \ + MMIO_OUT32(pSiS->IOBase, BR(4), (fgcolor)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor) +#endif + +/* ROP */ +#define sisSETROPFG(op) \ + MMIO_OUT8(pSiS->IOBase, BR(4) + 3, op); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(4)))&0xffffff) | (op<<24) +#endif + +#define sisSETROPBG(op) \ + MMIO_OUT8(pSiS->IOBase, BR(5) + 3, op); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(5)))&0xffffff) | (op<<24) +#endif + +#define sisSETROP(op) \ + sisSETROPFG(op); sisSETROPBG(op); + +/* source and dest address */ +#define sisSETSRCADDR(srcAddr) \ + MMIO_OUT32(pSiS->IOBase, BR(0), (srcAddr & 0x3FFFFFL)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = srcAddr & 0x3FFFFFL +#endif + +#define sisSETDSTADDR(dstAddr) \ + MMIO_OUT32(pSiS->IOBase, BR(1), (dstAddr & 0x3FFFFFL)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = dstAddr & 0x3FFFFFL +#endif + +/* pitch */ +#define sisSETPITCH(srcPitch,dstPitch) \ + MMIO_OUT32(pSiS->IOBase, BR(2), ((((dstPitch) & 0xFFFF) << 16) | ((srcPitch) & 0xFFFF))); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = ((dstPitch&0xFFFF)<<16)| \ + (srcPitch&0xFFFF) +#endif + +#define sisSETSRCPITCH(srcPitch) \ + MMIO_OUT16(pSiS->IOBase, BR(2), ((srcPitch) & 0xFFFF)); + +#define sisSETDSTPITCH(dstPitch) \ + MMIO_OUT16(pSiS->IOBase, BR(2) + 2, ((dstPitch) & 0xFFFF)); + +/* Height and width + * According to SIS 2D Engine Programming Guide + * height -1, width - 1 independant of Bpp + */ +#define sisSETHEIGHTWIDTH(Height, Width) \ + MMIO_OUT32(pSiS->IOBase, BR(3), ((((Height) & 0xFFFF) << 16) | ((Width) & 0xFFFF))); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((Height)&0xFFFF)<<16)| \ + ((Width)&0xFFFF) +#endif + +/* Clipping */ +#define sisSETCLIPTOP(x, y) \ + MMIO_OUT32(pSiS->IOBase, BR(8), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (((y)&0xFFFF)<<16)| \ + ((x)&0xFFFF) +#endif + +#define sisSETCLIPBOTTOM(x, y) \ + MMIO_OUT32(pSiS->IOBase, BR(9), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (((y)&0xFFFF)<<16)| \ + ((x)&0xFFFF) +#endif + +/* Line drawing */ +#define sisSETXStart(XStart) \ + MMIO_OUT32(pSiS->IOBase, BR(0), ((XStart) & 0xFFFF)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = XStart&0xFFFF +#endif + +#define sisSETYStart(YStart) \ + MMIO_OUT32(pSiS->IOBase, BR(1), ((YStart) & 0xFFFF)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = YStart&0xFFFF +#endif + +#define sisSETLineMajorCount(MajorAxisCount) \ + MMIO_OUT32(pSiS->IOBase, BR(3), ((MajorAxisCount) & 0xFFFF)); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = MajorAxisCount&0xFFFF +#endif + +#define sisSETLineSteps(K1,K2) \ + MMIO_OUT32(pSiS->IOBase, BR(6), ((((K1) & 0xFFFF) << 16) | ((K2) & 0xFFFF))); +#if 0 + *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((K1)&0xFFFF)<<16)| \ + ((K2)&0xFFFF) +#endif + +#define sisSETLineErrorTerm(ErrorTerm) \ + MMIO_OUT16(pSiS->IOBase, BR(7), (ErrorTerm)); +#if 0 + *(volatile unsigned short *)(pSiS->IOBase + BR(7)) = ErrorTerm +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:1.15 Thu Jan 17 05:49:35 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c Thu Feb 27 12:31:38 2003 @@ -1,4951 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c,v 1.15 2002/01/17 10:49:35 eich Exp $ */ - -#include "xf86.h" -#include "xf86PciInfo.h" -#include "xf86_OSproc.h" - -#include "sis.h" -#include "sis_regs.h" -#include "sis_bios.h" - -PDEBUG(static int scrnidx;) - -#if 0 -static UShort DRAMType[17][5]={{0x0C,0x0A,0x02,0x40,0x39},{0x0D,0x0A,0x01,0x40,0x48}, - {0x0C,0x09,0x02,0x20,0x35},{0x0D,0x09,0x01,0x20,0x44}, - {0x0C,0x08,0x02,0x10,0x31},{0x0D,0x08,0x01,0x10,0x40}, - {0x0C,0x0A,0x01,0x20,0x34},{0x0C,0x09,0x01,0x08,0x32}, - {0x0B,0x08,0x02,0x08,0x21},{0x0C,0x08,0x01,0x08,0x30}, - {0x0A,0x08,0x02,0x04,0x11},{0x0B,0x0A,0x01,0x10,0x28}, - {0x09,0x08,0x02,0x02,0x01},{0x0B,0x09,0x01,0x08,0x24}, - {0x0B,0x08,0x01,0x04,0x20},{0x0A,0x08,0x01,0x02,0x10}, - {0x09,0x08,0x01,0x01,0x00}}; -#endif - -static UShort MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; - -static UShort CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; - -static UShort EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, - 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, - 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, - 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, - 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, - 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, - 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; - -static UShort VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, - 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, - - 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, - 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, - 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, - 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, - 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, - 0x0B,0x0C,0x0D,0x0F,0x10}; - -static UShort ModeIndex_640x480[] = {0x2E, 0x44, 0x45, 0x62}; -static UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35}; -static UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36}; -static UShort ModeIndex_800x600[] = {0x30, 0x47, 0x48, 0x63}; -static UShort ModeIndex_1024x768[] = {0x38, 0x4A, 0x4B, 0x64}; -static UShort ModeIndex_1280x1024[] = {0x3A, 0x4D, 0x4E, 0x65}; -static UShort ModeIndex_1600x1200[] = {0x3C, 0x3D, 0x3E, 0x66}; -static UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x6A, 0x6B}; -static UShort RefreshRate[8][8] = { - {60, 72, 75, 85, 100, 120, 160, 200}, /* 640x480 */ - {56, 60, 72, 75, 85, 100, 120, 160}, /* 800x600 */ - {43, 60, 70, 75, 85, 100, 120, 0}, /* 1024x768 */ - {43, 60, 75, 85, 0, 0, 0, 0}, /* 1280x1024 */ - {60, 65, 70, 75, 85, 0, 0, 0}, /* 1600x1200 */ - {60, 0 , 0 , 0 , 0 , 0 , 0 , 0 }, /* 720x480 */ - {50, 0 , 0 , 0 , 0 , 0 , 0 , 0 }, /* 720x576 */ - {60, 0 , 0 , 0 , 0 , 0 , 0 , 0 }}; /* 1920x1440 */ -#define MODEID_OFF 0x449 - -static UShort StResInfo[5][2]={{640,400},{640,350},{720,400},{720,350},{640,480}}; -static UShort ModeResInfo[15][4]={{320,200,8,8},{320,240,8,8},{320,400,8,8}, - {400,300,8,8},{512,384,8,8},{640,400,8,16}, - {640,480,8,16},{800,600,8,16},{1024,768,8,16}, - {1280,1024,8,16},{1600,1200,8,16},{1920,1440,8,16}, - {720,480,8,16},{720,576,8,16},{1280,960,8,16}}; - -static UShort HiTVExtTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, - 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, - 0x64,0x90,0x33,0x8C,0x18,0x36,0x3E,0x13, - 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, - 0x8E,0x8E,0x82,0x07,0x0B, - 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x14,0x3D,0x63,0x4F, - 0x027,0xFFFC,0x6A}; - -static UShort HiTVSt1Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, - 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, - 0x65,0x90,0x7B,0xA8,0x03,0xF0,0x87,0x03, - 0x11,0x15,0x11,0xCF,0x10,0x11,0xCF,0x10, - 0x35,0x35,0x3B,0x69,0x1D, - 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x04,0x86,0xAF,0x5D, - 0xE,0xFFFC,0x2D}; - -static UShort HiTVSt2Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, - 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, - 0x64,0x90,0x33,0x8C,0x18,0x36,0x3E,0x13, - 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, - 0x8E,0x8E,0x82,0x07,0x0B, - 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x14,0x3D,0x63,0x4F, - 0x27,0xFFFC,0x6A}; - -static UShort HiTVTextTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, - 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, - 0x65,0x90,0xE7,0xBC,0x03,0x0C,0x97,0x03, - 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, - 0xC8,0xC8,0x3B,0xD2,0x26, - 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x04,0x96,0x72,0x5C, - 0x11,0xFFFC,0x32}; - -static UShort HiTVGroup3Data[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x5F, - 0x05,0x21,0xB2,0xB2,0x55,0x77,0x2A,0xA6, - 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, - 0x8C,0x6E,0x60,0x2E,0x58,0x48,0x72,0x44, - 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, - 0x4F,0x7F,0x03,0xA8,0x7D,0x20,0x1A,0xA9, - 0x14,0x05,0x03,0x7E,0x64,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; - -static UShort HiTVGroup3Simu[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x95, - 0xDB,0x20,0xB8,0xB8,0x55,0x47,0x2A,0xA6, - 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, - 0x8C,0x6E,0x60,0x15,0x26,0xD3,0xE4,0x11, - 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, - 0x67,0x36,0x01,0x47,0x0E,0x10,0xBE,0xB4, - 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; - -static UShort HiTVGroup3Text[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0xA7, - 0xF5,0x20,0xCE,0xCE,0x55,0x47,0x2A,0xA6, - 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, - 0x8C,0x6E,0x60,0x18,0x2C,0x0C,0x20,0x22, - 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, - 0x93,0x3C,0x01,0x50,0x2F,0x10,0xF4,0xCA, - 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; - - -static UShort NTSCTiming[61]={0x017,0x01D,0x003,0x009,0x005,0x006,0x00C,0x00C, - 0x094,0x049,0x001,0x00A,0x006,0x00D,0x004,0x00A, - 0x006,0x014,0x00D,0x004,0x00A,0x000,0x085,0x01B, - 0x00C,0x050,0x000,0x099,0x000,0x0EC,0x04A,0x017, - 0x088,0x000,0x04B,0x000,0x000,0x0E2,0x000,0x002, - 0x003,0x00A,0x065,0x09D,0x008, - 0x092,0x08F,0x040,0x060,0x080,0x014,0x090,0x08C, - 0x060,0x014,0x050,0x000,0x040, - 0x00044,0x002DB,0x0003B}; /* Ajust xxx */ - -static UShort PALTiming[61]={ 0x019,0x052,0x035,0x06E,0x004,0x038,0x03D,0x070, - 0x094,0x049,0x001,0x012,0x006,0x03E,0x035,0x06D, - 0x006,0x014,0x03E,0x035,0x06D,0x000,0x045,0x02B, - 0x070,0x050,0x000,0x097,0x000,0x0D7,0x05D,0x017, - 0x088,0x000,0x045,0x000,0x000,0x0E8,0x000,0x002, - 0x00D,0x000,0x068,0x0B0,0x00B, - 0x092,0x08F,0x040,0x060,0x080,0x014,0x090,0x08C, - 0x060,0x014,0x063,0x000,0x040, - 0x0003E,0x002E1,0x00028}; /* Ajust xxx */ - -#if 0 -static UShort NTSCGroup3Data[63]= {0x000,0x014,0x015,0x025,0x055,0x015,0x00B,0x089, - 0x0D7,0x040,0x0B0,0x0B0,0x0FF,0x0C4,0x045,0x0A6, - 0x025,0x02F,0x067,0x0F6,0x0BF,0x0FF,0x08E,0x020, - 0x08C,0x0DA,0x060,0x092,0x0C8,0x055,0x08B,0x000, - 0x051,0x004,0x018,0x00A,0x0F8,0x087,0x000,0x080, - 0x03B,0x03B,0x000,0x0F0,0x0F0,0x000,0x0F0,0x0F0, - 0x000,0x051,0x00F,0x00F,0x008,0x00F,0x008,0x06F, - 0x018,0x005,0x005,0x005,0x04C,0x0AA,0x001}; - -static UShort PALGroup3Data[63]={0x000,0x01A,0x022,0x063,0x062,0x022,0x008,0x085, - 0x0C3,0x020,0x0A4,0x0A4,0x055,0x047,0x02A,0x0A6, - 0x025,0x02F,0x047,0x0FA,0x0C8,0x0FF,0x08E,0x020, - 0x08C,0x0DC,0x060,0x092,0x0C8,0x04F,0x085,0x000, - 0x056,0x036,0x04F,0x06E,0x0FE,0x083,0x054,0x081, - 0x030,0x030,0x000,0x0F3,0x0F3,0x000,0x0A2,0x0A2, - 0x000,0x048,0x0FE,0x07E,0x008,0x040,0x008,0x091, - 0x018,0x005,0x018,0x005,0x04C,0x0A8,0x001}; -static UShort Part1[41]={0x30, 0x16, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3f, 0x30, 0x8c, 0xbc, 0x22, 0x1c, 0x05, 0xdf, - 0xf3, 0x16, 0x0a, 0x20, 0x89, 0x93, 0x00, 0x80, - 0x14, 0xf7, 0x58, 0x00, 0x00, 0x18, 0x28, 0x32, - 0x15, 0xff, 0xa0, 0x00, 0x01, 0x03, 0x2c, 0x11, - 0x92}; -#endif - -static UShort P3c4,P3d4,P3c0,P3ce,P3c2,P3ca,P3c6,P3c7,P3c8,P3c9,P3da; -static UShort CRT1VCLKLen; /*VCLKData table length of bytes of each entry*/ -#if 0 -static UShort flag_clearbuffer; /*0: no clear frame buffer 1:clear frame buffer*/ -static int RAMType; -#endif -static int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData; -#if 0 -static int MCLKData, ECLKData; -#endif -static int REFIndex,ModeType; -static UShort IF_DEF_LVDS; -static UShort IF_DEF_HiVision; -static UShort IF_DEF_CH7005; -static UShort VBInfo, SetFlag,RVBHCFACT,RVBHCMAX,VGAVT,VGAHT,VT,HT,VGAVDE,VGAHDE; -static UShort VDE,HDE,RVBHRS,NewFlickerMode,RY1COE,RY2COE,RY3COE,RY4COE; -static UShort LCDResInfo,LCDTypeInfo,LCDInfo,VCLKLen; -static UShort LCDHDES,LCDVDES; -static UShort DDC_Port; -static UShort DDC_Index; -static UShort DDC_DataShift; -static UShort DDC_DeviceAddr; -#if 0 -static UShort DDC_Flag; -#endif -static UShort DDC_ReadAddr; -#if 0 -static UShort DDC_Buffer; -#endif - -static Bool SearchModeID(ULong ROMAddr, UShort ModeNo); -static Bool CheckMemorySize(ULong ROMAddr); -static void GetModePtr(ULong ROMAddr, UShort ModeNo); -static void SetSeqRegs(ULong ROMAddr); -static void SetMiscRegs(ULong ROMAddr); -static void SetCRTCRegs(ULong ROMAddr); -static void SetATTRegs(ULong ROMAddr); -static void SetGRCRegs(ULong ROMAddr); -static void ClearExt1Regs(void); -static Bool GetRatePtr(ULong ROMAddr, UShort ModeNo); -static void SetSync(ULong ROMAddr); -static void SetCRT1CRTC(ULong ROMAddr); -static void SetCRT1Offset(ULong ROMAddr); -static void SetCRT1VCLK(ULong ROMAddr); -static void SetCRT1ModeRegs(ULong ROMAddr, UShort ModeNo); -static void SetVCLKState(ULong ROMAddr, UShort ModeNo); -static void LoadDAC(ULong ROMAddr); -static void WriteDAC(UShort dl, UShort ah, UShort al, UShort dh); -static void DisplayOn(void); -static void DisplayOff(void); -static void SetReg3(UShort port, UShort data); -/* static UShort SiSGetReg1(UShort port, UShort index); */ -static UShort GetReg2(UShort port); -static UShort GetModeIDLength(ULong ROMAddr, UShort ModeNo); -static UShort GetRefindexLength(ULong ROMAddr, UShort ModeNo); -static void SetInterlace(ULong ROMAddr, UShort ModeNo); -static void SetCRT1FIFO(ULong ROMAddr); -static UShort CalcDelay(ULong ROMAddr,UShort key); -static void SetCRT1FIFO2(ULong ROMAddr); -static UShort CalcDelay2(ULong ROMAddr,UShort key); -static void SetReg4(UShort port, ULong data); -static ULong GetReg3(UShort port); -static void SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr); -static UShort CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode); -static void WaitVertical(void); -static Bool SetCRT2Group(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, ScrnInfoPtr pScrn); -static void SetDefCRT2ExtRegs(UShort BaseAddr); -static UShort GetRatePtrCRT2(ULong ROMAddr, UShort ModeNo); -static Bool AjustCRT2Rate(ULong ROMAddr); -static void SaveCRT2Info(UShort ModeNo); -static void DisableLockRegs(void); -static void DisableCRT2(void); -static void GetCRT2Data(ULong ROMAddr,UShort ModeNo); -static void GetCRT2DataLVDS(ULong ROMAddr,UShort ModeNo); -static void GetCRT2Data301(ULong ROMAddr,UShort ModeNo); -static void GetResInfo(ULong ROMAddr,UShort ModeNo); -static void GetLVDSDesData(ULong ROMAddr,UShort ModeNo); -static void GetRAMDAC2DATA(ULong ROMAddr,UShort ModeNo); -static void GetCRT2Ptr(ULong ROMAddr,UShort ModeNo); -static void SetCRT2ModeRegs(UShort BaseAddr,UShort ModeNo); -static void SetGroup1(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, - ScrnInfoPtr pScrn); -static void SetGroup1_LVDS(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, - ScrnInfoPtr pScrn); -static void SetTPData(void); -static void SetGroup1_301(UShort BaseAddr,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn); -static void SetCRT2Offset(UShort Part1Port,ULong ROMAddr); -static UShort GetOffset(ULong ROMAddr); -static UShort GetColorDepth(ULong ROMAddr); -static void SetCRT2FIFO(UShort Part1Port,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn); -static UShort GetVCLK(ULong ROMAddr,UShort ModeNo); -static UShort GetQueueConfig(void); -static UShort GetVCLKPtr(ULong ROMAddr,UShort ModeNo); -static UShort GetColorTh(ULong ROMAddr); -static UShort GetMCLK(ULong ROMAddr); -static UShort GetMCLKPtr(ULong ROMAddr); -static UShort GetDRAMType(ULong ROMAddr); -static UShort CalcDelayVB(void); -static UShort GetVCLK2Ptr(ULong ROMAddr,UShort ModeNo); -static UShort GetVCLKLen(ULong ROMAddr); -static void SetCRT2Sync(UShort BaseAddr,ULong ROMAddr,UShort ModeNo); -static void GetCRT1Ptr(ULong ROMAddr); -static void SetRegANDOR(UShort Port,UShort Index,UShort DataAND,UShort DataOR); -static void SetRegAND (UShort Port,UShort Index,UShort DataAND); -static void SetRegOR (UShort Port,UShort Index,UShort DataOR); -static UShort GetVGAHT2(void); -static void SetGroup2(UShort BaseAddr,ULong ROMAddr, UShort ModeNo); -static void SetGroup3(UShort BaseAddr,ULong ROMAddr); -static void SetGroup4(UShort BaseAddr,ULong ROMAddr,UShort ModeNo); -static void SetCRT2VCLK(UShort BaseAddr,ULong ROMAddr,UShort ModeNo); -static void SetGroup5(UShort BaseAddr,ULong ROMAddr); -static void EnableCRT2(void); -static void LoadDAC2(ULong ROMAddr,UShort Part5Port); -static void WriteDAC2(UShort Pdata,UShort dl, UShort ah, UShort al, UShort dh); -/* static void SetLockRegs(void); */ -static void GetVBInfo(UShort BaseAddr,ULong ROMAddr); -static Bool BridgeIsEnable(UShort BaseAddr); -static Bool BridgeInSlave(void); -static Bool IsDualEdge301B(UShort BaseAddr); -static Bool IsVAMode301B (UShort BaseAddr); -static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4Reg); -static void PresetScratchregister(UShort P3d4Reg); -/* static Bool GetLCDDDCInfo(ScrnInfoPtr pScrn); */ -/* static void SetTVSystem(void); */ -static void LongWait(void); -/* static void VBLongWait(void); */ -/* static Bool WaitVBRetrace(UShort BaseAddr); */ -static void ModCRT1CRTC(ULong ROMAddr,UShort ModeNo); -static void SetCRT2ECLK(ULong ROMAddr, UShort ModeNo); -static UShort GetLVDSDesPtr(ULong ROMAddr,UShort ModeNo); -static Bool GetLVDSCRT1Ptr(ULong ROMAddr,UShort ModeNo); -static void SetCHTVReg(ULong ROMAddr,UShort ModeNo); -static void SetCHTVRegANDOR(UShort tempax,UShort tempbh); -static void GetCHTVRegPtr(ULong ROMAddr,UShort ModeNo); -static void SetSwitchDDC2(void); -static void SetStart(void); -static void SetStop(void); -static UShort WriteDDC2Data(UShort tempax); -static UShort ReadDDC2Data(UShort tempax); -static void SetSCLKLow(void); -static void SetSCLKHigh(void); -static void DDC2Delay(void); -static UShort CheckACK(void); - -void SiSRegInit(UShort BaseAddr) -{ - P3c4=BaseAddr+0x14; - P3d4=BaseAddr+0x24; - P3c0=BaseAddr+0x10; - P3ce=BaseAddr+0x1e; - P3c2=BaseAddr+0x12; - P3ca=BaseAddr+0x1a; - P3c6=BaseAddr+0x16; - P3c7=BaseAddr+0x17; - P3c8=BaseAddr+0x18; - P3c9=BaseAddr+0x19; - P3da=BaseAddr+0x2A; -} - -Bool SiSBIOSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - SISPtr pSiS = SISPTR(pScrn); - ULong temp; - UShort cr30flag,cr31flag; - ULong ROMAddr = (ULong) SISPTR(pScrn)->BIOS; - UShort BaseAddr = (UShort) (SISPTR(pScrn)->RelIO +0x30); - UShort ModeNo=0; - UShort Rate; - - SiSRegInit(BaseAddr); /* TW: Set global SiS Regs definitions */ - - - ModeNo = SiSCalcModeIndex(pScrn, mode); - if (!ModeNo) return FALSE; - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Mode # 0x%2.2x\n",ModeNo); - - SiSSetReg1(P3c4,0x05,0x86); /* TW: Unlock regs */ - - PDEBUG(scrnidx = pScrn->scrnIndex); - - Rate = CalcRefreshRate(pScrn, mode); - SiSSetReg1(P3d4, 0x33, Rate); - - /* TW: Enable PCI adressing (0x80) & MMIO enable (0x1) & ? (0x40) */ - SiSSetReg1(P3c4, 0x20, 0xa1); - /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */ - SiSSetReg1(P3c4, 0x1E, 0x5A); - - if(pSiS->VBFlags & VB_LVDS) - IF_DEF_LVDS = 1; - else - IF_DEF_LVDS = 0; - if(pSiS->VBFlags & VB_CHRONTEL) - IF_DEF_CH7005 = 1; - else - IF_DEF_CH7005 = 0; - -/* ynlai begin */ - IF_DEF_HiVision=0; -/* ynlai end */ - - PresetScratchregister(P3d4); /* add for CRT2 */ - /* replace GetSenseStatus,SetTVSystem,SetDisplayInfo */ - - DisplayOff(); - SiSSetReg1(P3c4,0x05,0x86); /* 1.Openkey */ - temp=SearchModeID(ROMAddr,ModeNo); /* 2.Get ModeID Table */ - if(temp==0) return(0); - - /* SetTVSystem(); */ /* add for CRT2 */ - /*GetLCDDDCInfo(pScrn);*/ /* add for CRT2 */ - GetVBInfo(BaseAddr,ROMAddr); /* add for CRT2 */ - GetLCDResInfo(ROMAddr, P3d4); /* add for CRT2 */ - - temp=CheckMemorySize(ROMAddr); /* 3.Check memory size */ - if(temp==0) return(0); - - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VBInfo = 0x%x\n", VBInfo)); - - cr30flag=(UChar)SiSGetReg1(P3d4,0x30); - if(((cr30flag&0x01)==1)||((cr30flag&0x02)==0)){ - /* if cr30 d[0]=1 or d[1]=0 set crt1 */ - SiSSetReg1(P3d4,0x34,ModeNo); - /* set CR34->CRT1 ModeNofor CRT2 FIFO */ - GetModePtr(ROMAddr,ModeNo); /* 4.GetModePtr */ - SetSeqRegs(ROMAddr); /* 5.SetSeqRegs */ - SetMiscRegs(ROMAddr); /* 6.SetMiscRegs */ - SetCRTCRegs(ROMAddr); /* 7.SetCRTCRegs */ - SetATTRegs(ROMAddr); /* 8.SetATTRegs */ - SetGRCRegs(ROMAddr); /* 9.SetGRCRegs */ - ClearExt1Regs(); /* 10.Clear Ext1Regs */ - temp=GetRatePtr(ROMAddr,ModeNo); /* 11.GetRatePtr */ - if(temp) { - SetSync(ROMAddr); /* 12.SetSync */ - SetCRT1CRTC(ROMAddr); /* 13.SetCRT1CRTC */ - SetCRT1Offset(ROMAddr); /* 14.SetCRT1Offset */ - SetCRT1VCLK(ROMAddr); /* 15.SetCRT1VCLK */ - SetVCLKState(ROMAddr, ModeNo); - if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) - SetCRT1FIFO2(ROMAddr); - else - SetCRT1FIFO(ROMAddr); - } - SetCRT1ModeRegs(ROMAddr, ModeNo); - /* if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) */ /* TW: wrong */ - if( (pSiS->Chipset != PCI_CHIP_SIS630) && (pSiS->Chipset != PCI_CHIP_SIS540) && - (pSiS->Chipset != PCI_CHIP_SIS300) ) - SetInterlace(ROMAddr,ModeNo); - LoadDAC(ROMAddr); - } - cr31flag=(UChar)SiSGetReg1(P3d4,0x31); - if(((cr30flag&0x01)==1)||((cr30flag&0x03)==0x02)|| - (((cr30flag&0x03)==0x00)&&((cr31flag&0x20)==0x20))) { - /* if CR30 d[0]=1 or d[1:0]=10, set CRT2 or cr30 cr31== 0x00 0x20 */ - SetCRT2Group(BaseAddr,ROMAddr,ModeNo, pScrn); /* add for CRT2 */ - } - -/* ynlai begin test */ -/* ynlai end test */ - - SetPitch(pScrn, BaseAddr); /* 16.SetPitch */ - WaitVertical(); - DisplayOn(); /* 17.DisplayOn */ - SiSGetSetModeID(pScrn,ModeNo); - - return TRUE; -} - -static Bool SearchModeID(ULong ROMAddr, UShort ModeNo) -{ - UChar ModeID; - UShort usIDLength; - - ModeIDOffset=*((UShort *)(ROMAddr+0x20A)); /* Get EModeIDTable */ - ModeID=*((UChar *)(ROMAddr+ModeIDOffset)); /* Offset 0x20A */ - usIDLength = GetModeIDLength(ROMAddr, ModeNo); - while(ModeID!=0xff && ModeID!=ModeNo) { -/* ModeIDOffset=ModeIDOffset+10; */ /*StructSize */ - ModeIDOffset=ModeIDOffset+usIDLength; - ModeID=*((UChar *)(ROMAddr+ModeIDOffset)); - } - if(ModeID==0xff) return(FALSE); - else return(TRUE); -} - -static Bool CheckMemorySize(ULong ROMAddr) -{ - UShort memorysize; - UShort modeflag; - UShort temp; - - modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - ModeType=modeflag&ModeInfoFlag; /* Get mode type */ - - memorysize=modeflag&MemoryInfoFlag; - memorysize=memorysize>MemorySizeShift; - memorysize++; /* Get memory size */ - - temp=SiSGetReg1(P3c4,0x14); /* Get DRAM Size */ - temp=temp&0x3F; - temp++; - - if(temp<memorysize) return(FALSE); - else return(TRUE); -} - -static void GetModePtr(ULong ROMAddr, UShort ModeNo) -{ - UChar index; - - StandTable=*((UShort *)(ROMAddr+0x202)); /* Get First 0x202 */ - /* StandTable Offset */ - if(ModeNo<=0x13) { /* TW: this was decimal 13, which is definitely wrong! */ - index=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+St_ModeFlag */ - } - else { - if(ModeType <= 0x02) index=0x1B; /* 02 -> ModeEGA */ - else index=0x0F; - } - StandTable=StandTable+64*index; -} - -static void SetSeqRegs(ULong ROMAddr) -{ - UChar SRdata; - UShort i; - - SiSSetReg1(P3c4,0x00,0x03); /* Set SR0 */ - StandTable=StandTable+0x05; - SRdata=*((UChar *)(ROMAddr+StandTable)); /* Get SR01 from file */ - if(IF_DEF_LVDS==1){ - if(IF_DEF_CH7005==1) { - if(VBInfo&SetCRT2ToTV) { - if(VBInfo&SetInSlaveMode) { - SRdata=SRdata|0x01; - } - } - } - if(VBInfo&SetCRT2ToLCD){ - if(VBInfo&SetInSlaveMode){ - if(LCDInfo&LCDNonExpanding){ - SRdata=SRdata|0x01; - } - } - } - } - SRdata=SRdata|0x20; - SiSSetReg1(P3c4,0x01,SRdata); /* Set SR1 */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SeqReg 1 -> 0x%x\n", SRdata)); - for(i=02;i<=04;i++) { - StandTable++; - SRdata=*((UChar *)(ROMAddr+StandTable)); /* Get SR2,3,4 from file */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SeqReg %x -> 0x%x\n", i, SRdata)); - SiSSetReg1(P3c4,i,SRdata); /* Set SR2 3 4 */ - } -} - -static void SetMiscRegs(ULong ROMAddr) -{ - UChar Miscdata; - - StandTable++; - Miscdata=*((UChar *)(ROMAddr+StandTable)); /* Get Misc from file */ - SetReg3(P3c2,Miscdata); /* Set Misc(3c2) */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "MiscReg -> 0x%x\n", Miscdata)); -} - -static void SetCRTCRegs(ULong ROMAddr) -{ - UChar CRTCdata; - UShort i; - - CRTCdata=(UChar)SiSGetReg1(P3d4,0x11); - CRTCdata=CRTCdata&0x7f; - SiSSetReg1(P3d4,0x11,CRTCdata); /* Unlock CRTC */ - - for(i=0;i<=0x18;i++) { - StandTable++; - CRTCdata=*((UChar *)(ROMAddr+StandTable)); /* Get CRTC from file */ - SiSSetReg1(P3d4,i,CRTCdata); /* Set CRTC(3d4) */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "CRTReg %x -> 0x%x\n", i, CRTCdata)); - } -} - -static void SetATTRegs(ULong ROMAddr) -{ - UChar ARdata; - UShort i; - - for(i=0;i<=0x13;i++) { - StandTable++; - ARdata=*((UChar *)(ROMAddr+StandTable)); /* Get AR for file */ - if(IF_DEF_LVDS==1){ /*for LVDS*/ - if(IF_DEF_CH7005==1) { - if(VBInfo&SetCRT2ToTV) { - if(VBInfo&SetInSlaveMode) { - if(i==0x13) ARdata=0; - } - } - } - if(VBInfo&SetCRT2ToLCD){ - if(VBInfo&SetInSlaveMode){ - if(i==0x13) ARdata=0; - } - } - } - GetReg2(P3da); /* reset 3da */ - SetReg3(P3c0,i); /* set index */ - SetReg3(P3c0,ARdata); /* set data */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "AttReg index %d -> 0x%x\n", i, ARdata)); - } - - GetReg2(P3da); /* reset 3da */ - SetReg3(P3c0,0x14); /* set index */ - SetReg3(P3c0,0x00); /* set data */ - GetReg2(P3da); /* Enable Attribute */ - SetReg3(P3c0,0x20); -} - -static void SetGRCRegs(ULong ROMAddr) -{ - UChar GRdata; - UShort i; - - for(i=0;i<=0x08;i++) { - StandTable++; - GRdata=*((UChar *)(ROMAddr+StandTable)); /* Get GR from file */ - SiSSetReg1(P3ce,i,GRdata); /* Set GR(3ce) */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "GRCReg %x -> 0x%x\n", i, GRdata)); - } - if(ModeType>ModeVGA){ - GRdata=(UChar)SiSGetReg1(P3ce,0x05); - GRdata=GRdata&0xBF; - SiSSetReg1(P3ce,0x05,GRdata); - } -} - -static void ClearExt1Regs() -{ - UShort i; - - for(i=0x0A;i<=0x0E;i++) SiSSetReg1(P3c4,i,0x00); /* Clear SR0A-SR0E */ -} - - -static Bool GetRatePtr(ULong ROMAddr, UShort ModeNo) -{ - short index; - UShort temp; - UShort ulRefIndexLength; - - if(ModeNo<0x14) return(FALSE); /* Mode No <= 13h then return */ - - index=SiSGetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ - index=index&0x0F; /* Frame rate index */ - if(index!=0) index--; - REFIndex=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ - - ulRefIndexLength = GetRefindexLength(ROMAddr, ModeNo); - do { - temp=*((UShort *)(ROMAddr+REFIndex)); /* di => REFIndex */ - if(temp==0xFFFF) break; - temp=temp&ModeInfoFlag; - if(temp<ModeType) break; - - REFIndex=REFIndex+ulRefIndexLength; /* rate size */ - index--; - } while(index>=0); - - REFIndex=REFIndex-ulRefIndexLength; /* rate size */ - return(TRUE); -} - -static void SetSync(ULong ROMAddr) -{ - UShort sync; - UShort temp; - - sync=*((UShort *)(ROMAddr+REFIndex)); /* di+0x00 */ - sync=sync&0xC0; - temp=0x2F; - temp=temp|sync; - SetReg3(P3c2,temp); /* Set Misc(3c2) */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "Setsync 0x%x\n", temp)); -} - -static void SetCRT1CRTC(ULong ROMAddr) -{ - UChar index; - UChar data; - UShort i; - - index=*((UChar *)(ROMAddr+REFIndex+0x02)) & 0x3F; /* Get index */ - CRT1Table=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ - CRT1Table=CRT1Table+index*CRT1Len; - - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "CRT1CRT: CRT1Table %x index %d CRT1Len %d REFIndex %x", - CRT1Table, index, CRT1Len, REFIndex)); - - data=(UChar)SiSGetReg1(P3d4,0x11); - data=data&0x7F; - SiSSetReg1(P3d4,0x11,data); /* Unlock CRTC */ - - CRT1Table--; - for(i=0;i<=0x05;i++) { - CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); - SiSSetReg1(P3d4,i,data); - } - for(i=0x06;i<=0x07;i++) { - CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); - SiSSetReg1(P3d4,i,data); - } - for(i=0x10;i<=0x12;i++) { - CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); - SiSSetReg1(P3d4,i,data); - } - for(i=0x15;i<=0x16;i++) { - CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); - SiSSetReg1(P3d4,i,data); - } - for(i=0x0A;i<=0x0C;i++) { - CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); - SiSSetReg1(P3c4,i,data); - } - - CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); - data=data&0xE0; - SiSSetReg1(P3c4,0x0E,data); - - data=(UChar)SiSGetReg1(P3d4,0x09); - data=data&0xDF; - i=*((UChar *)(ROMAddr+CRT1Table)); - i=i&0x01; - i=i<<5; - data=data|i; - i=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - i=i&DoubleScanMode; - if(i) data=data|0x80; - SiSSetReg1(P3d4,0x09,data); - - if(ModeType>0x03) SiSSetReg1(P3d4,0x14,0x4F); -} - -static void SetCRT1Offset(ULong ROMAddr) -{ - UShort temp,ah,al; - UShort temp2,i; - UShort DisplayUnit; - - temp=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(offset) ModeInfo %x\n", temp)); - temp=temp>>4; /* index */ - ScreenOffset=*((UShort *)(ROMAddr+0x206)); /* ScreenOffset */ - temp=*((UChar *)(ROMAddr+ScreenOffset+temp)); /* data */ - - temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(offset) Infoflag %x\n", temp2)); - temp2=temp2&InterlaceMode; - if(temp2) temp=temp<<1; - temp2=ModeType-ModeEGA; - switch (temp2) { - case 0 : temp2=1; break; - case 1 : temp2=2; break; - case 2 : temp2=4; break; - case 3 : temp2=4; break; - case 4 : temp2=6; break; - case 5 : temp2=8; break; - } - temp=temp*temp2; - DisplayUnit=temp; - - temp2=temp; - temp=temp>>8; /* ah */ - temp=temp&0x0F; - i=SiSGetReg1(P3c4,0x0E); - i=i&0xF0; - i=i|temp; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1Offset) 0e = 0x%x\n", i)); - SiSSetReg1(P3c4,0x0E,i); - - temp=(UChar)temp2; - temp=temp&0xFF; /* al */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1Offset) 13 = 0x%x\n", temp)); - SiSSetReg1(P3d4,0x13,temp); - - temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); - temp2=temp2&InterlaceMode; - if(temp2) DisplayUnit>>=1; - - DisplayUnit=DisplayUnit<<5; - ah=(DisplayUnit&0xff00)>>8; - al=DisplayUnit&0x00ff; - if(al==0) ah=ah+1; - else ah=ah+2; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1Offset) 10 = 0x%x\n", ah)); - SiSSetReg1(P3c4,0x10,ah); -} - -static void SetCRT1VCLK(ULong ROMAddr) -{ - UShort i; - UChar index,data; - - index=*((UChar *)(ROMAddr+REFIndex+0x03)) & 0x3F; - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((UShort *)(ROMAddr+0x208)); - VCLKData=VCLKData+data; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLKData %x CRT1VCLKLen %x index %x data %x SiS_BIOS_REFIndex %x\n", - VCLKData, CRT1VCLKLen, index, data, REFIndex)); - - SiSSetReg1(P3c4,0x31,0); - for(i=0x2B;i<=0x2C;i++) { - data=*((UChar *)(ROMAddr+VCLKData)); - SiSSetReg1(P3c4,i,data); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1VCLK) Reg %x -> 0x%x\n", i, data)); - VCLKData++; - } - SiSSetReg1(P3c4,0x2D,0x80); -} - - -static void SetCRT1ModeRegs(ULong ROMAddr, UShort ModeNo) -{ - UShort data,data2,data3; - - if(ModeNo>0x13) data=*((UShort *)(ROMAddr+REFIndex+0x00)); - else data=0; - data2=0; - if(ModeNo>0x13) - if(ModeType>0x02) { - data2=data2|0x02; - data3=ModeType-ModeVGA; - data3=data3<<2; - data2=data2|data3; - } - - data=data&InterlaceMode; - if(data) data2=data2|0x20; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1ModeRegs) 06 -> 0x%x\n", data2)); - SiSSetReg1(P3c4,0x06,data2); - - data=SiSGetReg1(P3c4,0x01); - data=data&0xF7; - data2=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - data2=data2&HalfDCLK; - if(data2) data=data|0x08; - SiSSetReg1(P3c4,0x01,data); - - data=SiSGetReg1(P3c4,0x0F); - data=data&0xF7; - data2=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - data2=data2&LineCompareOff; - if(data2) data=data|0x08; - SiSSetReg1(P3c4,0x0F,data); - - data=SiSGetReg1(P3c4,0x21); - data=data&0x1F; - if(ModeType==0x00) data=data|0x60; /* Text Mode */ - else if(ModeType<=0x02) data=data|0x00; /* EGA Mode */ - else data=data|0xA0; /* VGA Mode */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1ModeRegs) 21 -> 0x%x\n", data)); - SiSSetReg1(P3c4,0x21,data); -} - -/* TW: values identical to sisfb */ -static void SetVCLKState(ULong ROMAddr, UShort ModeNo) -{ - UShort data,data2; - UShort VCLK; - UChar index; - - index=*((UChar *)(ROMAddr+REFIndex+0x03)); - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((UShort *)(ROMAddr+0x208)); - VCLKData=VCLKData+data+(CRT1VCLKLen-2); - VCLK=*((UShort *)(ROMAddr+VCLKData)); - - if(ModeNo<=0x13) VCLK=0; - - data=SiSGetReg1(P3c4,0x07); - data=data&0x7B; - if(VCLK>150) data=data|0x80; /* VCLK > 150; TW: was >= */ - SiSSetReg1(P3c4,0x07,data); - - data=SiSGetReg1(P3c4,0x32); - data=data&0xD7; - if(VCLK>=150) data=data|0x08; /* VCLK > 150 */ - SiSSetReg1(P3c4,0x32,data); - - data2=0x03; - if(VCLK>=135) data2=0x02; /* TW: was > */ - if(VCLK>=160) data2=0x01; /* TW: was > */ - if(VCLK>260) data2=0x00; - - data=SiSGetReg1(P3c4,0x07); - data=data&0xFC; - data=data|data2; - SiSSetReg1(P3c4,0x07,data); -} - -static void LoadDAC(ULong ROMAddr) -{ - UShort data,data2; - UShort time,i,j,k; - UShort m,n,o; - UShort si,di,bx,dl; - UShort al,ah,dh; - UShort *table=0; - - data=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - data=data&DACInfoFlag; - time=64; - if(data==0x00) table=MDA_DAC; - if(data==0x08) table=CGA_DAC; - if(data==0x10) table=EGA_DAC; - if(data==0x18) { - time=256; - table=VGA_DAC; - } - if(time==256) j=16; - else j=time; - - SetReg3(P3c6,0xFF); - SetReg3(P3c8,0x00); - - for(i=0;i<j;i++) { - data=table[i]; - for(k=0;k<3;k++) { - data2=0; - if(data&0x01) data2=0x2A; - if(data&0x02) data2=data2+0x15; - SetReg3(P3c9,data2); - data=data>>2; - } - } - - if(time==256) { - for(i=16;i<32;i++) { - data=table[i]; - for(k=0;k<3;k++) SetReg3(P3c9,data); - } - si=32; - for(m=0;m<9;m++) { - di=si; - bx=si+0x04; - dl=0; - for(n=0;n<3;n++) { - for(o=0;o<5;o++) { - dh=table[si]; - ah=table[di]; - al=table[bx]; - si++; - WriteDAC(dl,ah,al,dh); - } /* for 5 */ - si=si-2; - for(o=0;o<3;o++) { - dh=table[bx]; - ah=table[di]; - al=table[si]; - si--; - WriteDAC(dl,ah,al,dh); - } /* for 3 */ - dl++; - } /* for 3 */ - si=si+5; - } /* for 9 */ - } -} - -static void WriteDAC(UShort dl, UShort ah, UShort al, UShort dh) -{ - UShort temp; - UShort bh,bl; - - bh=ah; - bl=al; - if(dl!=0) { - temp=bh; - bh=dh; - dh=temp; - if(dl==1) { - temp=bl; - bl=dh; - dh=temp; - } - else { - temp=bl; - bl=bh; - bh=temp; - } - } - SetReg3(P3c9,(UShort)dh); - SetReg3(P3c9,(UShort)bh); - SetReg3(P3c9,(UShort)bl); -} - -static void DisplayOn(void) -{ - UShort data; - - data=SiSGetReg1(P3c4,0x01); - data=data&0xDF; - SiSSetReg1(P3c4,0x01,data); -} - -static void DisplayOff(void) -{ - UShort data; - - data=SiSGetReg1(P3c4,0x01); - data=data|0x20; - SiSSetReg1(P3c4,0x01,data); -} - -void SiSSetReg1(UShort port, UShort index, UShort data) -{ - outb(port ,(UChar)(index & 0xff)); - port++; - outb(port ,(UChar)(data & 0xff)); -} - -static void SetReg3(UShort port, UShort data) -{ - outb(port, (UChar)(data & 0xff)); -} - -UShort SiSGetReg1(UShort port, UShort index) -{ - UChar data; - - outb(port, (UChar)(index & 0xff)); - port += 1; - data = inb(port); - return(data); -} - -static UShort GetReg2(UShort port) -{ - UChar data; - - data = inb(port); - - return(data); -} - -static UShort GetModeIDLength(ULong ROMAddr, UShort ModeNo) -{ - UChar ModeID; - UShort modeidlength; - UShort usModeIDOffset; - - return(10); - modeidlength=0; - usModeIDOffset=*((UShort *)(ROMAddr+0x20A)); /* Get EModeIDTable */ - ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ - while(ModeID!=0x2E) { - modeidlength++; - usModeIDOffset=usModeIDOffset+1; /* 10 <= ExtStructSize */ - ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); - } - return(modeidlength); -} - -static UShort GetRefindexLength(ULong ROMAddr, UShort ModeNo) -{ - UChar ModeID; - UChar temp; - UShort refindexlength; - UShort usModeIDOffset; - UShort usREFIndex; - UShort usIDLength; - - usModeIDOffset=*((UShort *)(ROMAddr+0x20A)); /* Get EModeIDTable */ - ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ - usIDLength = GetModeIDLength(ROMAddr, ModeNo); - while(ModeID!=0x40) { - usModeIDOffset=usModeIDOffset+usIDLength; /*10 <= ExtStructSize */ - ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); - } - - refindexlength=1; - usREFIndex=*((UShort *)(ROMAddr+usModeIDOffset+0x04)); /* si+Ext_point */ - usREFIndex++; - temp=*((UChar *)(ROMAddr+usREFIndex)); /* di => REFIndex */ - while(temp!=0xFF) { - refindexlength++; - usREFIndex++; - temp=*((UChar *)(ROMAddr+usREFIndex)); /* di => REFIndex */ - } - return(refindexlength); -} - -static void SetInterlace(ULong ROMAddr, UShort ModeNo) -{ - ULong Temp; - UShort data,Temp2; - - Temp = (ULong)SiSGetReg1(P3d4, 0x01); - Temp++; - Temp=Temp*8; - - if(Temp==1024) data=0x0035; - else if(Temp==1280) data=0x0048; - else data=0x0000; - - Temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); - Temp2 &= InterlaceMode; - if(Temp2 == 0) data=0x0000; - - SiSSetReg1(P3d4,0x19,data); - - Temp = (ULong)SiSGetReg1(P3d4, 0x1A); - Temp2= (UShort)(Temp & 0xFC); - SiSSetReg1(P3d4,0x1A,(UShort)Temp); - - Temp = (ULong)SiSGetReg1(P3c4, 0x0f); - Temp2= (UShort)Temp & 0xBF; - if(ModeNo==0x37) Temp2=Temp2|0x40; - SiSSetReg1(P3d4,0x1A,(UShort)Temp2); -} - -static void SetCRT1FIFO(ULong ROMAddr) -{ - UShort index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; - UShort ah,bl,A,B; - - index=*((UChar *)(ROMAddr+REFIndex+0x03)); - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((UShort *)(ROMAddr+0x208)); - VCLKData=VCLKData+data+(CRT1VCLKLen-2); - VCLK=*((UShort *)(ROMAddr+VCLKData)); /* Get VCLK */ - - MCLKOffset=*((UShort *)(ROMAddr+0x20C)); - index=SiSGetReg1(P3c4,0x1A); /* TW: was 0x3A - WRONG! */ - index=index&07; - MCLKOffset=MCLKOffset+index*5; - MCLK=*((UChar *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ - - data2=ModeType-0x02; - switch (data2) { - case 0 : colorth=1; break; - case 1 : colorth=2; break; - case 2 : colorth=4; break; - case 3 : colorth=4; break; - case 4 : colorth=6; break; - case 5 : colorth=8; break; - } - - do{ -/*==============*/ - B=(UShort)(CalcDelay(ROMAddr,0)*VCLK*colorth); - B=B/(16*MCLK); - B++; - - A=(CalcDelay(ROMAddr,1)*VCLK*colorth); - A=A/(16*MCLK); - A++; - - if(A<4) A=0; - else A=A-4; - - if(A>B) bl=A; - else bl=B; - - bl++; - if(bl>0x13) { - data=SiSGetReg1(P3c4,0x16); - data=data>>6; - if(data!=0) { - data--; - data=data<<6; - data2=SiSGetReg1(P3c4,0x16); - data2=(data2&0x3f)|data; - SiSSetReg1(P3c4,0x16,data2); - } - else bl=0x13; - } -/*==============*/ - } while(bl>0x13); - - ah=bl; - ah=ah<<4; - ah=ah|0x0f; - SiSSetReg1(P3c4,0x08,ah); - - data=bl; - data=data&0x10; - data=data<<1; - data2=SiSGetReg1(P3c4,0x0F); - data2=data2&0x9f; - data2=data2|data; - SiSSetReg1(P3c4,0x0F,data2); - - data=bl+3; - if(data>0x0f) data=0x0f; - SiSSetReg1(P3c4,0x3b,0x00); - data2=SiSGetReg1(P3c4,0x09); - data2=data2&0xF0; - data2=data2|data; - SiSSetReg1(P3c4,0x09,data2); -} - -static UShort CalcDelay(ULong ROMAddr,UShort key) -{ - UShort data,data2,temp0,temp1; - UChar ThLowA[]= {61,3,52,5,68,7,100,11, - 43,3,42,5,54,7, 78,11, - 34,3,37,5,47,7, 67,11}; - UChar ThLowB[]= {81,4,72,6,88,8,120,12, - 55,4,54,6,66,8, 90,12, - 42,4,45,6,55,8, 75,12}; - UChar ThTiming[]= {1,2,2,3,0,1,1,2}; - - data=SiSGetReg1(P3c4,0x16); - data=data>>6; - data2=SiSGetReg1(P3c4,0x14); - data2=(data2>>4)&0x0C; - data=data|data2; - data=data<1; - if(key==0) { - temp0=(UShort)ThLowA[data]; - temp1=(UShort)ThLowA[data+1]; - } - else { - temp0=(UShort)ThLowB[data]; - temp1=(UShort)ThLowB[data+1]; - } - - data2=0; - data=SiSGetReg1(P3c4,0x18); - if(data&0x02) data2=data2|0x01; - if(data&0x20) data2=data2|0x02; - if(data&0x40) data2=data2|0x04; - - data=temp1*ThTiming[data2]+temp0; - return(data); -} - -static void SetCRT1FIFO2(ULong ROMAddr) -{ - UShort index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; - UShort ah,bl=0,B; - ULong eax; - - index=*((UChar *)(ROMAddr+REFIndex+0x03)); - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((UShort *)(ROMAddr+0x208)); - VCLKData=VCLKData+data+(CRT1VCLKLen-2); - VCLK=*((UShort *)(ROMAddr+VCLKData)); /* Get VCLK */ - - MCLKOffset=*((UShort *)(ROMAddr+0x20C)); - index=SiSGetReg1(P3c4,0x1A); - index=index&07; - MCLKOffset=MCLKOffset+index*5; - MCLK=*((UShort *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ - - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(FIFO2) VCLK %x MCLK %x ModeType %x\n", VCLK, MCLK, ModeType)); - - data2=ModeType-0x02; - switch (data2) { - case 0 : colorth=1; break; /* TW: was 1 - WRONG */ - case 1 : colorth=2; break; /* TW: was 1 - WRONG */ - case 2 : colorth=4; break; /* TW: was 2 - WRONG */ - case 3 : colorth=4; break; /* TW: was 2 - WRONG */ - case 4 : colorth=6; break; /* TW: was 3 - WRONG */ - case 5 : colorth=8; break; /* TW: was 4 - WRONG */ - } - - do{ -/*==============*/ - B=(CalcDelay2(ROMAddr,0)*VCLK*colorth); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1FIFO2) CalcDelay returned %x\n", B)); - if (B%(16*MCLK) == 0) - { - B=B/(16*MCLK); - bl=B+1; - } - else - { - B=B/(16*MCLK); - bl=B+2; - } - - if(bl>0x13) { - data=SiSGetReg1(P3c4,0x15); - data=data&0xf0; - if(data!=0xb0) { - data=data+0x20; - if(data==0xa0) data=0x30; - - data2=SiSGetReg1(P3c4,0x15); - data2=(data2&0x0f)|data; - SiSSetReg1(P3c4,0x15,data2); - } - else bl=0x13; - } -/*==============*/ - } while(bl>0x13); - - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1FIFO2) Threshold %x\n", bl)); - - data2=SiSGetReg1(P3c4,0x15); - data2=(data2&0xf0)>>4; - data2=data2<<24; - -/* ========================*/ - SetReg4(0xcf8,0x80000050); - eax=GetReg3(0xcfc); - eax=eax&0x0f0ffffff; - eax=eax|data2; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) Reg 4 cfc -> 0x%x\n", eax)); - SetReg4(0xcfc,eax); -/* ========================*/ - - ah=bl; - ah=ah<<4; - ah=ah|0x0f; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) 08 -> 0x%x\n", ah)); - SiSSetReg1(P3c4,0x08,ah); - - data=bl; - data=data&0x10; - data=data<<1; - data2=SiSGetReg1(P3c4,0x0F); - data2=data2&0x9f; /* TW: x: 0x9f (works) sisfb: 0xdf */ - data2=data2|data; - SiSSetReg1(P3c4,0x0F,data2); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) 0f -> | 0x%x\n", data)); - - SiSSetReg1(P3c4,0x3b,0x09); /* TW: x: 00 sisfb: 09 (works) */ - - data=bl+3; - if(data>0x0f) data=0x0f; - data2=SiSGetReg1(P3c4,0x09); - data2=data2&0xF0; /* TW: x: 0xf0 (works) sisfb: 0x80 */ - data2=data2|data; - SiSSetReg1(P3c4,0x09,data2); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) 09 -> | 0x%x\n", data)); -} - -static UShort CalcDelay2(ULong ROMAddr,UShort key) -{ - UShort data,index; -#if 0 /* x driver values */ - UChar LatencyFactor[]={88,80,78,72,70,00, - 00,79,77,71,69,49, - 88,80,78,72,70,00, - 00,72,70,64,62,44}; -#endif - -#if 1 /* TW: sisfb values - better */ - static UChar LatencyFactor[] = - { 97, 88, 86, 79, 77, 00, - 00, 87, 85, 78, 76, 54, - 97, 88, 86, 79, 77, 00, - 00, 79, 77, 70, 68, 48, - }; -#endif - - index=0; - data=SiSGetReg1(P3c4,0x14); - if(data&0x80) index=index+12; - - data=SiSGetReg1(P3c4,0x15); - data=(data&0xf0)>>4; - if(data&0x01) index=index+6; - - data=data>>1; - index=index+data; - data=LatencyFactor[index]; - - return(data); -} - -static void SetReg4(UShort port, ULong data) -{ - outl(port, (ULong)(data & 0xffffffff)); -} - -ULong GetReg3(UShort port) -{ - ULong data; - - data = inl(port); - return(data); -} - -static void SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr) -{ - SISPtr pSiS = SISPTR(pScrn); - ULong HDisplay; - ULong temp; - UShort Port = BaseAddr + IND_SIS_CRT2_PORT_04; - - HDisplay = pSiS->scrnOffset / 8; - SiSSetReg1(P3d4, 0x13, HDisplay); - temp = (SiSGetReg1(P3c4, 0x0E) & 0xF0) | (HDisplay>>8); - SiSSetReg1(P3c4, 0x0E, temp); - - SiSSetReg1(Port, 0x24, 1); - SiSSetReg1(Port, 0x07, HDisplay); - temp = (SiSGetReg1(Port, 0x09) & 0xF0) | (HDisplay>>8); - SiSSetReg1(Port, 0x09, temp); - -} - -UShort SiSCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - UShort i = (pScrn->bitsPerPixel+7)/8 - 1; - UShort ModeIndex = 0; - switch(mode->HDisplay) - { - case 640: - ModeIndex = ModeIndex_640x480[i]; - break; - case 720: - if(mode->VDisplay == 480) - ModeIndex = ModeIndex_720x480[i]; - else - ModeIndex = ModeIndex_720x576[i]; - break; - case 800: - ModeIndex = ModeIndex_800x600[i]; - break; - case 1024: - ModeIndex = ModeIndex_1024x768[i]; - break; - case 1280: - ModeIndex = ModeIndex_1280x1024[i]; - break; - case 1600: - ModeIndex = ModeIndex_1600x1200[i]; - break; - case 1920: - ModeIndex = ModeIndex_1920x1440[i]; - break; - } - - return(ModeIndex); -} - -/* TW: Calc CRT1 Refresh Rate (to be written to CR33) */ -static UShort CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - SISPtr pSiS = SISPTR(pScrn); - UShort Index=0; - UShort i=0; - UShort Rate=1; - UShort temp = (int)(mode->VRefresh+0.5); - - switch(mode->HDisplay) - { - case 640: - Index = 0; - break; - case 800: - Index = 1; - break; - case 1024: - Index = 2; - Rate = 2; - break; - case 1280: - Index = 3; - Rate = 2; - break; - case 1600: - Index = 4; - break; - case 1920: - Index = 7; - break; - case 720: - if(mode->VDisplay == 480) - Index = 5; - else - Index = 6; - break; - - } - while(RefreshRate[Index][i] != 0) - { - if(temp == RefreshRate[Index][i]) - { - Rate=i+1; - break; - } - else - i++; - } - if(pSiS->VBFlags & CRT2_VGA) - Rate |= Rate << 4; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, - "(CalcRate) temp=%d, Index=%d, Rate=%d\n", temp, Index, Rate)); - return(Rate); -} - -static void WaitVertical(void) -{ -#if 0 - UShort tempax,tempdx; - - tempdx=0x3da; - do { - tempax=GetReg2(tempdx); - } while(!(tempax&01)); - - do { - tempax=GetReg2(tempdx); - } while(!(tempax&01)); -#endif -} - -static Bool SetCRT2Group(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, ScrnInfoPtr pScrn) -{ - UShort temp; - - SetFlag=SetFlag|ProgrammingCRT2; - SearchModeID(ROMAddr,ModeNo); - temp=GetRatePtrCRT2(ROMAddr,ModeNo); - if(((temp&0x02)==0) && ((VBInfo&CRT2DisplayFlag)==0)) - return(FALSE); - SaveCRT2Info(ModeNo); - SiSDisableBridge(BaseAddr); - SiSUnLockCRT2(BaseAddr); - SetDefCRT2ExtRegs(BaseAddr); - SetCRT2ModeRegs(BaseAddr,ModeNo); - if(IF_DEF_LVDS==0) { - if(VBInfo&CRT2DisplayFlag){ - SiSLockCRT2(BaseAddr); - return 0; - } - } - GetCRT2Data(ROMAddr,ModeNo); - if(IF_DEF_LVDS==1) { - GetLVDSDesData(ROMAddr,ModeNo); - } - SetGroup1(BaseAddr,ROMAddr,ModeNo,pScrn); - if(IF_DEF_LVDS==0) { - SetGroup2(BaseAddr,ROMAddr,ModeNo); - SetGroup3(BaseAddr,ROMAddr); - SetGroup4(BaseAddr,ROMAddr,ModeNo); - SetGroup5(BaseAddr,ROMAddr); - } - else { - if(IF_DEF_CH7005==1) SetCHTVReg(ROMAddr,ModeNo); - ModCRT1CRTC(ROMAddr,ModeNo); - SetCRT2ECLK(ROMAddr,ModeNo); - } - EnableCRT2(); - SiSEnableBridge(BaseAddr); - if(IF_DEF_LVDS==0) { - /* SetLockRegs(); */ - } - SiSLockCRT2(BaseAddr); - return 1; -} - -static void SetDefCRT2ExtRegs(UShort BaseAddr) -{ - UShort Part1Port,Part2Port,Part4Port; - UShort temp; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - if(IF_DEF_LVDS==0) { - SiSSetReg1(Part1Port,0x02,0x40); - SiSSetReg1(Part4Port,0x10,0x80); - temp=(UChar)SiSGetReg1(P3c4,0x16); - temp=temp&0xC3; - SiSSetReg1(P3d4,0x35,temp); - } - else { - /* TW: Set VB to SVIDEO and clear eg. CRT1 and LCD ?! */ - /* Why touch this? CR32 should be read only */ - /* SiSSetReg1(P3d4,0x32,0x02); */ - SiSSetReg1(Part1Port,0x02,0x00); - } -} - -static UShort GetRatePtrCRT2(ULong ROMAddr, UShort ModeNo) -{ /* return bit0=>0:standard mode 1:extended mode */ - short index; /* bit1=>0:crt2 no support this mode */ - UShort temp; /* 1:crt2 support this mode */ - UShort ulRefIndexLength; - UShort temp1,modeflag1,Flag; - short LCDRefreshIndex[2]={0x03,0x01}; - - if(IF_DEF_CH7005==1) { - if(VBInfo&SetCRT2ToTV) { - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&HalfDCLK) return(0); - } - } - if(ModeNo<0x14) return(0); /* Mode No <= 13h then return */ - - index=SiSGetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ - index=index>>SelectCRT2Rate; /* For CRT2,cl=SelectCRT2Rate=4, shr ah,cl */ - index=index&0x0F; /* Frame rate index */ - if(index!=0) index--; - - if(SetFlag&ProgrammingCRT2){ - Flag=1; - if(IF_DEF_CH7005==1) { - if(VBInfo&SetCRT2ToTV) { - index=0; - Flag=0; - } - } - if((Flag)&&(VBInfo&SetCRT2ToLCD)){ - if(IF_DEF_LVDS==0) { - temp=LCDResInfo; - temp1=LCDRefreshIndex[temp]; - if(index>temp1){ - index=temp1; - } - } - else { - index=0; - } - } - } - - REFIndex=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ - - ulRefIndexLength =Ext2StructSize; - do { - temp=*((UShort *)(ROMAddr+REFIndex)); /* di => REFIndex */ - if(temp==0xFFFF) break; - temp=temp&ModeInfoFlag; - if(temp<ModeType) break; - - REFIndex=REFIndex+ulRefIndexLength; /* rate size */ - index--; - if(index<0){ - if(!(VBInfo&SetCRT2ToRAMDAC)){ - if(VBInfo&SetInSlaveMode){ - temp1=*((UShort *)(ROMAddr+REFIndex+0-Ext2StructSize)); - if(temp1&InterlaceMode){ - index=0; - } - } - } - } - } while(index>=0); - REFIndex=REFIndex-ulRefIndexLength; /* rate size */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "RefIndex after GetRatePtrCRT2: %x\n", REFIndex)); - if((SetFlag&ProgrammingCRT2)){ - temp1=AjustCRT2Rate(ROMAddr); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "RefIndex after AdjustCRT2Rate: %x\n", REFIndex)); - }else{ - temp1=0; - } - - return(0x01|(temp1<<1)); -} - -static Bool AjustCRT2Rate(ULong ROMAddr) -{ - UShort tempax,tempbx=0,temp,resinfo; - UShort tempextinfoflag,Flag; - tempax=0; - if(IF_DEF_LVDS==0) { - if(VBInfo&SetCRT2ToRAMDAC){ - tempax=tempax|SupportRAMDAC2; - } - if(VBInfo&SetCRT2ToLCD){ - tempax=tempax|SupportLCD; - if(LCDResInfo!=Panel1280x1024){ - temp=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ - if(temp>=9) tempax=0; - } - } -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - tempax=tempax|SupportHiVisionTV; - if(VBInfo&SetInSlaveMode){ - resinfo=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /*si+Ext_ResInfo */ - if(resinfo==4) return(0); - if(resinfo==3) { - if(SetFlag&TVSimuMode) return(0); - } - if(resinfo>7) return(0); - } - } - else { - if(VBInfo&(SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)){ - tempax=tempax|SupportTV; - if(!(VBInfo&SetPALTV)){ - tempextinfoflag=*((UShort *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ - if(tempextinfoflag&NoSupportSimuTV){ - if(VBInfo&SetInSlaveMode){ - if(!(VBInfo&SetNotSimuMode)){ - return 0; - } - } - } - } - } - } -/* ynlai end */ - tempbx=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ - } - else { /* for LVDS */ - Flag=1; - if(IF_DEF_CH7005==1) { - if(VBInfo&SetCRT2ToTV) { - tempax=tempax|SupportCHTV; - Flag=0; - } - } - tempbx=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); - if((Flag)&&(VBInfo&SetCRT2ToLCD)){ - tempax=tempax|SupportLCD; - temp=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /*si+Ext_ResInfo */ - if(temp>0x08) return(0); /*1024x768 */ - if(LCDResInfo<Panel1024x768){ - if(temp>0x07) return(0); /*800x600 */ - if(temp==0x04) return(0); /*512x384 */ - } - } - } - for(;REFIndex>tempbx;REFIndex-=Ext2StructSize){ - tempextinfoflag=*((UShort *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ - if(tempextinfoflag&tempax){ - return 1; - } - } - for(REFIndex=tempbx;;REFIndex+=Ext2StructSize){ - tempextinfoflag=*((UShort *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ - if(tempextinfoflag==0x0FFFF){ - return 0; - } - if(tempextinfoflag&tempax){ - return 1; - } - } - return(FALSE); -} - -static void SaveCRT2Info(UShort ModeNo) -{ - UShort temp1,temp2,temp3; - temp1=(VBInfo&SetInSlaveMode)>>8; - temp2=~(SetInSlaveMode>>8); - temp3=(UChar)SiSGetReg1(P3d4,0x31); - temp3=((temp3&temp2)|temp1); - SiSSetReg1(P3d4,0x31,(UShort)temp3); - temp3=(UChar)SiSGetReg1(P3d4,0x35); - temp3=temp3&0xF3; - SiSSetReg1(P3d4,0x35,(UShort)temp3); -} - -static void DisableLockRegs(void) -{ - UChar temp3; - temp3=(UChar)SiSGetReg1(P3c4,0x32); - temp3=temp3&0xDF; - SiSSetReg1(P3c4,0x32,(UShort)temp3); -} - -static void DisableCRT2(void) -{ - UChar temp3; - temp3=(UChar)SiSGetReg1(P3c4,0x1E); - temp3=temp3&0xDF; - SiSSetReg1(P3c4,0x1E,(UShort)temp3); -} - -void SiSDisableBridge(UShort BaseAddr) -{ - if(IF_DEF_LVDS==0) { - SiSDisableBridge301(BaseAddr); - } else { - SiSDisableBridgeLVDS(BaseAddr); - } -} - -void SiSDisableBridge301(UShort BaseAddr) /* TW: needed for external X driver using VESA */ -{ - UChar temp3,part2_02,part2_05; - UShort Part2Port; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - - part2_02=(UChar)SiSGetReg1(Part2Port,0x02); - part2_05=(UChar)SiSGetReg1(Part2Port,0x05); -/* if(!WaitVBRetrace(BaseAddr)) */ /* return 0:no enable read dram */ - { - LongWait(); - DisableLockRegs(); - } - SiSSetReg1(Part2Port,0x02,0x38); - SiSSetReg1(Part2Port,0x05,0xFF); - temp3=(UChar)SiSGetReg1(Part2Port,0x00); - temp3=temp3&0xDF; - SiSSetReg1(Part2Port,0x00,(UShort)temp3); - SiSSetReg1(Part2Port,0x02,part2_02); - SiSSetReg1(Part2Port,0x05,part2_05); - DisableCRT2(); -} - -void SiSDisableBridge301B(UShort BaseAddr) /* TW: needed for external X driver using VESA */ -{ - UChar temp3; - UShort Part4Port,Part2Port=0; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - - SetRegANDOR (P3c4,0x11,0xF7,0x08); - - SetRegAND(P3c4, 0x32, 0xDF); - if ((!(IsDualEdge301B(BaseAddr))) && (!(IsVAMode301B(BaseAddr)))) - temp3 = 0x7F; - else if ((!(IsDualEdge301B(BaseAddr))) && (IsVAMode301B(BaseAddr))) - temp3 = 0xBF; - else temp3 = 0x3F; - SetRegAND (Part4Port,0x1F,temp3); -} - -void SiSDisableBridgeLVDS(UShort BaseAddr) /* TW: needed for external X driver using VESA */ -{ - UShort Part2Port,Part1Port=0; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - - DisableLockRegs(); - DisableCRT2(); - SiSUnLockCRT2(BaseAddr); - SetRegANDOR(Part1Port,0x02,0xFF,0x40); /*et Part1Port ,index 2, D6=1, */ -} - -static Bool IsDualEdge301B(UShort BaseAddr) -{ -#if 0 /* TW: This is only for SiS315 */ - UShort flag; - flag = SiSGetReg1(P3d4,0x38); - if (flag & EnableDualEdge) - return (0); - else -#endif - return (1); -} - -static Bool IsVAMode301B (UShort BaseAddr) -{ -#if 0 /* TW: This is only for SiS315 */ - UShort flag; - - flag = SiSGetReg1(P3d4,0x38); - if ((flag & EnableDualEdge) && (flag & SetToLCDA)) - return (0); - else -#endif - return (1); -} - - -static void GetCRT2Data(ULong ROMAddr,UShort ModeNo) -{ - if(IF_DEF_LVDS==0){ /*301 */ - GetCRT2Data301(ROMAddr,ModeNo); - return; - }else{ /*LVDS */ - GetCRT2DataLVDS(ROMAddr,ModeNo); - return; - } -} - -static void GetCRT2DataLVDS(ULong ROMAddr,UShort ModeNo) -{ - UShort tempax,tempbx,OldREFIndex; - - OldREFIndex=(UShort)REFIndex; /*push di */ - GetResInfo(ROMAddr,ModeNo); - GetCRT2Ptr(ROMAddr,ModeNo); - - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "BIOSIndex: 0x%x, ModeNo 0x%x\n", REFIndex, ModeNo)); - - tempax=*((UShort *)(ROMAddr+REFIndex)); - tempax=tempax&0x0FFF; - VGAHT=tempax; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS VGAHT: 0x%x\n", tempax)); - - tempax=*((UShort *)(ROMAddr+REFIndex+1)); - tempax=tempax>>4; - tempax=tempax&0x07FF; - VGAVT=tempax; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS VGAVT: 0x%x\n", tempax)); - - tempax=*((UShort *)(ROMAddr+REFIndex+3)); - tempax=tempax&0x0FFF; - tempbx=*((UShort *)(ROMAddr+REFIndex+4)); - tempbx=tempbx>>4; - tempbx=tempbx&0x07FF; - - HT=tempax; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS LCDHT: 0x%x\n", tempax)); - VT=tempbx; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS LCDVT: 0x%x\n", tempbx)); - - if(IF_DEF_TRUMPION==0){ - if(VBInfo&SetCRT2ToLCD){ - if(!(LCDInfo&LCDNonExpanding)){ - if(LCDResInfo==Panel800x600){ - tempax=800; - tempbx=600; - }else if(LCDResInfo==Panel1024x768){ - tempax=1024; - tempbx=768; - }else{ - tempax=1280; - tempbx=1024; - } - HDE=tempax; - VDE=tempbx; - } - } - } - REFIndex=OldREFIndex; /*pop di */ - return; -} - -static void GetCRT2Data301(ULong ROMAddr,UShort ModeNo) -{ - UShort tempax,tempbx,modeflag1,OldREFIndex; - UShort tempal,tempah,tempbl,resinfo; - - OldREFIndex=REFIndex; /* push di */ - RVBHRS=50;NewFlickerMode=0;RY1COE=0; - RY2COE=0;RY3COE=0;RY4COE=0; - - GetResInfo(ROMAddr,ModeNo); - if(VBInfo&SetCRT2ToRAMDAC){ - GetRAMDAC2DATA(ROMAddr,ModeNo); - REFIndex=OldREFIndex; /* pop di */ - return; - } - GetCRT2Ptr(ROMAddr,ModeNo); - - tempal=*((UChar *)(ROMAddr+REFIndex)); - tempah=*((UChar *)(ROMAddr+REFIndex+4)); - tempax=tempal|(((tempah<<8)>>7)&0xFF00); - RVBHCMAX=tempax; - - tempal=*((UChar *)(ROMAddr+REFIndex+1)); - RVBHCFACT=tempal; - - tempax=*((UShort *)(ROMAddr+REFIndex+2)); - VGAHT=(tempax&0x0FFF); - - tempax=*((UShort *)(ROMAddr+REFIndex+3)); - VGAVT=((tempax>>4)&0x07FF); - - tempax=*((UShort *)(ROMAddr+REFIndex+5)); - tempax=(tempax&0x0FFF); - tempbx=*((UShort *)(ROMAddr+REFIndex+6)); - tempbx=((tempbx>>4)&0x07FF); - tempbl=tempbx&0x00FF; - - if(VBInfo&SetCRT2ToTV){ - tempax=*((UShort *)(ROMAddr+REFIndex+5)); - tempax=(tempax&0x0FFF); - HDE=tempax; - tempax=*((UShort *)(ROMAddr+REFIndex+6)); - tempax=((tempax>>4)&0x07FF); - VDE=tempax; - tempax=*((UShort *)(ROMAddr+REFIndex+8)); - tempbl=(tempax>>8); - tempax=tempax&0x0FFF; - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&HalfDCLK){ - tempax=*((UShort *)(ROMAddr+REFIndex+10)); - } - RVBHRS=tempax; -/* ynlai begin */ - tempbl=tempbl&0x80; - if(IF_DEF_HiVision==1) { - resinfo=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ - if(resinfo==8) tempbl=0x40; - else if(resinfo==9) tempbl=0x40; - else if(resinfo==10) tempbl=0x40; - } -/* ynlai end */ - NewFlickerMode=tempbl; - -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - if(VGAVDE==350) SetFlag=SetFlag|TVSimuMode; - tempax=ExtHiTVHT; - tempbx=ExtHiTVVT; - if(VBInfo&SetInSlaveMode) { - if(SetFlag&TVSimuMode) { - tempax=StHiTVHT; - tempbx=StHiTVVT; - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(!(modeflag1&Charx8Dot)){ - tempax=StHiTextTVHT; - tempbx=StHiTextTVVT; - } - } - } - } - else { - tempax=*((UShort *)(ROMAddr+REFIndex+12)); - RY1COE=(tempax&0x00FF); - RY2COE=((tempax&0xFF00)>>8); - tempax=*((UShort *)(ROMAddr+REFIndex+14)); - RY3COE=(tempax&0x00FF); - RY4COE=((tempax&0xFF00)>>8); - if(!(VBInfo&SetPALTV)){ - tempax=NTSCHT; - tempbx=NTSCVT; - }else{ - tempax=PALHT; - tempbx=PALVT; - } - } -/* ynlai end */ - } - HT=tempax; - VT=tempbx; - if(!(VBInfo&SetCRT2ToLCD)){ - REFIndex=OldREFIndex; /* pop di */ - return; - } - - tempax=1024; - if(VGAVDE==350){ /* cx->VGAVDE */ - tempbx=560; - }else if(VGAVDE==400){ - tempbx=640; - }else{ - tempbx=768; - } - - if(LCDResInfo==Panel1280x1024){ - tempax=1280; - if(VGAVDE==360){ - tempbx=768; - }else if(VGAVDE==375){ - tempbx=800; - }else if(VGAVDE==405){ - tempbx=864; - }else{ - tempbx=1024; - } - } - - HDE=tempax; - VDE=tempbx; - REFIndex=OldREFIndex; /* pop di */ - return; -} - -static void GetResInfo(ULong ROMAddr,UShort ModeNo) -{ - UShort temp,xres,yres,modeflag1; - if(ModeNo<=0x13){ - temp=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x05)); /* si+St_ResInfo */ - xres=StResInfo[temp][0]; - yres=StResInfo[temp][1]; - }else{ - temp=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ - xres=ModeResInfo[temp][0]; /* xres->ax */ - yres=ModeResInfo[temp][1]; /* yres->bx */ - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&HalfDCLK){ xres=xres*2;} - if(modeflag1&DoubleScanMode){yres=yres*2;} - } - if(!(LCDResInfo==Panel1024x768)){ - if(yres==400) yres=405; - if(yres==350) yres=360; - if(SetFlag&LCDVESATiming){ - if(yres==360) yres=375; - } - } - if(IF_DEF_LVDS==1) { - if(xres==720) xres=640; - } - VGAHDE=xres; - HDE=xres; - VGAVDE=yres; - VDE=yres; -} - -static void GetLVDSDesData(ULong ROMAddr,UShort ModeNo) -{ - UShort old_REFIndex,tempax; - - old_REFIndex=(UShort)REFIndex; /*push di */ - REFIndex=GetLVDSDesPtr(ROMAddr,ModeNo); - - tempax=*((UShort *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes ROMData 1: %x\n", tempax)); - tempax=tempax&0x0FFF; - LCDHDES=tempax; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes LCDHDES: %x\n", tempax)); - - if(LCDInfo&LCDNonExpanding){ /*hw walk-a-round */ - if(LCDResInfo>=Panel1024x768){ - if(ModeNo<=0x13){ - LCDHDES=320; - } - } - } - - tempax=*((UShort *)(ROMAddr+REFIndex+1)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes ROMData 2: %x\n", tempax)); - tempax=tempax>>4; - tempax=tempax&0x07FF; - LCDVDES=tempax; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes LCDVDES: %x\n", tempax)); - - REFIndex=old_REFIndex; /*pop di */ - return; -} - - -static void GetRAMDAC2DATA(ULong ROMAddr,UShort ModeNo) -{ - UShort tempax,tempbx,tempbh,modeflag1,t1=0,t2; - RVBHCMAX=1;RVBHCFACT=1; - if(ModeNo<=0x13){ - tempax=*((UChar *)(ROMAddr+REFIndex+10)); - tempbx=*((UShort *)(ROMAddr+REFIndex+16)); - }else{ - t1=*((UChar *)(ROMAddr+REFIndex+0x2)); /* Ext_CRT1CRTC=2 */ - t1=t1*CRT1Len; - REFIndex=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ - REFIndex=REFIndex+t1; - t1=*((UChar *)(ROMAddr+REFIndex+0)); - t2=*((UChar *)(ROMAddr+REFIndex+14)); - tempax=(t1&0xFF)|((t2&0x03)<<8); - tempbx=*((UShort *)(ROMAddr+REFIndex+6)); - t1=*((UChar *)(ROMAddr+REFIndex+13)); - t1=(t1&0x01)<<2; - } - - tempbh=tempbx>>8; - tempbh=((tempbh&0x20)>>4)|(tempbh&0x01); - tempbh=tempbh|t1; - tempbx=(tempbx&0xFF)|(tempbh<<8); - tempax=tempax+5; - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&Charx8Dot){ - tempax=tempax*8; - }else{ - tempax=tempax*9; - } - - VGAHT=tempax; - HT=tempax; - tempbx++; - VGAVT=tempbx; - VT=tempbx; - -} - -static void GetCRT2Ptr(ULong ROMAddr,UShort ModeNo) -{ - UShort tempcl,tempbx,tempal,tempax,CRT2PtrData=0; - UShort Flag; - - if(IF_DEF_LVDS==0) { - if(VBInfo&SetCRT2ToLCD){ /* LCD */ - tempbx=LCDResInfo; - tempcl=LCDDataLen; - tempbx=tempbx-Panel1024x768; - if(!(SetFlag&LCDVESATiming)) tempbx+=5; - } -/* ynlai begin */ - else { - if(IF_DEF_HiVision==1) { - if(VGAVDE>480) SetFlag=SetFlag&(!TVSimuMode); - tempcl=HiTVDataLen; - tempbx=2; - if(VBInfo&SetInSlaveMode) { - if(!(SetFlag&TVSimuMode)) tempbx=10; - } - } - else { - if(VBInfo&SetPALTV){ - tempcl=TVDataLen; - tempbx=3; - } - else{ - tempbx=4; - tempcl=TVDataLen; - } - } - } -/* ynlai end */ - if(SetFlag&TVSimuMode){ - tempbx=tempbx+4; - } - if(ModeNo<=0x13){ - tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - }else{ - tempal=*((UChar *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ - } - tempal=tempal&0x1F; - - tempax=tempal*tempcl; - REFIndex=*((UShort *)(ROMAddr + 0x20E + tempbx*2)); - REFIndex+=tempax; - } - else { /* LVDS */ - Flag=1; - tempbx=0; - if(IF_DEF_CH7005==1) { - if(!(VBInfo&SetCRT2ToLCD)) { - Flag=0; - tempbx=7; - if(VBInfo&SetPALTV) tempbx=tempbx+2; - if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; - } - } - tempcl=LVDSDataLen; - if(Flag==1) { - tempbx=LCDResInfo-Panel800x600; - if(LCDInfo&LCDNonExpanding){ - tempbx=tempbx+3; - } - } - if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - else tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ - tempal=tempal&0x1F; - tempax=tempal*tempcl; - CRT2PtrData=*((UShort *)(ROMAddr+ADR_CRT2PtrData)); /*ADR_CRT2PtrData is defined in init.def */ - REFIndex=*((UShort *)(ROMAddr+CRT2PtrData+tempbx*2)); - REFIndex+=tempax; - } -} - -void SiSUnLockCRT2(UShort BaseAddr) -{ - UChar temp3; - UShort Part1Port; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - temp3=(UChar)SiSGetReg1(Part1Port,0x24); - temp3=temp3|0x01; - SiSSetReg1(Part1Port,0x24,(UShort)temp3); -} - -static void SetCRT2ModeRegs(UShort BaseAddr,UShort ModeNo) -{ - UShort i,j; - UShort tempcl,tempah,temp3; - UShort Part4Port; - UShort Part1Port; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - for(i=0,j=4;i<3;i++,j++){ - SiSSetReg1(Part1Port,j,0); - } - - tempcl=ModeType; - if(ModeNo>0x13){ - tempcl=tempcl-ModeVGA; - if((tempcl>0)||(tempcl==0)){ - tempah=((0x010>>tempcl)|0x080); - } - }else{ - tempah=0x080; - } - - if(VBInfo&SetInSlaveMode){ - tempah=(tempah^0x0A0); - } - if(VBInfo&CRT2DisplayFlag){ - tempah=0; - } - SiSSetReg1(Part1Port,0,tempah); - - - if(IF_DEF_LVDS==0) { /* (TW) 301 */ - tempah=0x01; - if(!(VBInfo&SetInSlaveMode)){ - tempah=(tempah|0x02); - } - if(!(VBInfo&SetCRT2ToRAMDAC)){ - tempah=(tempah^0x05); - if(!(VBInfo&SetCRT2ToLCD)){ - tempah=(tempah^0x01); - } - } - tempah=(tempah<<5)&0xFF; - if(VBInfo&CRT2DisplayFlag){ - tempah=0; - } - SiSSetReg1(Part1Port,0x01,tempah); - - tempah=tempah>>5; - if((ModeType==ModeVGA)&&(!(VBInfo&SetInSlaveMode))){ - tempah=tempah|0x010; - } - if(LCDResInfo!=Panel1024x768){ - tempah=tempah|0x080; - } - if(VBInfo&SetCRT2ToTV){ - if(VBInfo&SetInSlaveMode){ - tempah=tempah|0x020; - } - } - - temp3=(UChar)SiSGetReg1(Part4Port,0x0D); - temp3=temp3&(~0x0BF); - temp3=temp3|tempah; - SiSSetReg1(Part4Port,0x0D,(UShort)temp3); - -/* ynlai begin */ - tempah=0; - if(VBInfo&SetCRT2ToTV) { - if(VBInfo&SetInSlaveMode) { - if(!(SetFlag&TVSimuMode)) { - if(IF_DEF_HiVision==0) { - SetFlag=SetFlag|RPLLDIV2XO; - tempah=tempah|0x40; - } - } - } - else { - SetFlag=SetFlag|RPLLDIV2XO; - tempah=tempah|0x40; - } - } - if(LCDResInfo==Panel1280x1024) tempah=tempah|0x80; - if(LCDResInfo==Panel1280x960) tempah=tempah|0x80; - SiSSetReg1(Part4Port,0x0C,(UShort)temp3); -/* ynlai end */ - } - else { /* (TW) - LVDS */ - tempah=0; - if(!(VBInfo&SetInSlaveMode)){ - tempah=tempah|0x02; - } - tempah=(tempah<<5)&0x0FF; - if(VBInfo&CRT2DisplayFlag){ - tempah=0; - } - - /* - * @@@ bits 5,6,7 cause my display to go goofy. This cannot be - * correct. Therefore we leave it as it is. I need to get in touch - * with somebody at SiS who can explain to me how to set up - * this register. - */ -#if 0 - SiSSetReg1(Part1Port,0x01,tempah); -#endif - -/* TW start */ -/* In kernel sisfb, the following is done instead of the line "#if 0"-ed above: - (has no visual effect, therefore I assume it's good for something) */ - SetRegANDOR(Part1Port, 0x2e, 0xF0, tempah); -/* TW end */ - } -} - -static void SetGroup1(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, - ScrnInfoPtr pScrn) -{ - if(IF_DEF_LVDS==0){ /*301 */ - SetGroup1_301(BaseAddr,ROMAddr,ModeNo,pScrn); - }else{ /*LVDS */ - SetGroup1_LVDS(BaseAddr,ROMAddr,ModeNo,pScrn); - } -} - -static void SetGroup1_LVDS(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, - ScrnInfoPtr pScrn) -{ - UShort temp1,temp2,tempcl,tempch,tempbh,tempal,tempah,tempax,tempbx; - UShort tempcx,OldREFIndex,lcdhdee; - UShort Part1Port; - UShort temppush1,temppush2; - unsigned long int tempeax,tempebx,tempecx,templong; - - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - OldREFIndex=(UShort)REFIndex; /*push di */ - - SetCRT2Offset(Part1Port,ROMAddr); - SetCRT2FIFO(Part1Port,ROMAddr,ModeNo,pScrn); - SetCRT2Sync(BaseAddr,ROMAddr,ModeNo); - - temp1=(VGAHT-1)&0x0FF; /*BTVGA2HT 0x08,0x09 */ - SiSSetReg1(Part1Port,0x08,temp1); - temp1=(((VGAHT-1)&0xFF00)>>8)<<4; - SetRegANDOR(Part1Port,0x09,~0x0F0,temp1); - - temp1=(VGAHDE+12)&0x0FF; /*BTVGA2HDEE 0x0A,0x0C */ - SiSSetReg1(Part1Port,0x0A,temp1); - /*temp1=((VGAHDE+12)&0xFF00)>>8; Wrong */ - /*SiSSetReg1(Part1Port,0x0C,temp1); */ - - temp1=VGAHDE+12; /*bx BTVGA@HRS 0x0B,0x0C */ - temp2=(VGAHT-VGAHDE)>>2; /* */ - temp1=temp1+temp2; - temp2=(temp2<<1)+temp1; - tempcl=temp2&0x0FF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0b -> 0x%x\n", temp1)); - SiSSetReg1(Part1Port,0x0B,(UShort)(temp1&0x0FF)); - - tempah=(temp1&0xFF00)>>8; - tempbh=((((VGAHDE+12)&0xFF00)>>8)<<4)&0x0FF; - tempah=tempah|tempbh; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0c -> 0x%x\n", tempah)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0d -> 0x%x\n", tempcl)); - SiSSetReg1(Part1Port,0x0C,tempah); - SiSSetReg1(Part1Port,0x0D,tempcl); /*BTVGA2HRE 0x0D */ - tempcx=(VGAVT-1); - tempah=tempcx&0x0FF; - if(IF_DEF_CH7005==1) { - if(VBInfo&0x0C) tempah=tempah-1; - } - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0e -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x0E,tempah); /*BTVGA2TV 0x0E,0x12 */ - tempbx=VGAVDE-1; - tempah=tempbx&0x0FF; - if(IF_DEF_CH7005==1) { - if(VBInfo&0x0C) tempah=tempah-1; - } - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0f -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x0F,tempah); /*BTVGA2VDEE 0x0F,0x12 */ - tempah=((tempbx&0xFF00)<<3)>>8; - tempah=tempah|((tempcx&0xFF00)>>8); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 12 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x12,tempah); - - tempbx=(VGAVT+VGAVDE)>>1; /*BTVGA2VRS 0x10,0x11 */ - tempcx=((VGAVT-VGAVDE)>>4)+tempbx+1; /*BTVGA2VRE 0x11 */ - - tempah=tempbx&0x0FF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 10 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x10,tempah); - tempbh=(tempbx&0xFF00)>>8; - tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 11 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x11,tempah); - - /* TW: new */ - if (IF_DEF_LVDS==0) { - tempah = 0x20; - if (LCDResInfo == Panel1280x1024) - tempah = 0x20; - if (LCDResInfo == Panel1280x960) - tempah = 0x24; - if (VBInfo & SetCRT2ToTV) - tempah = 0x08; - if (VBInfo & SetCRT2ToHiVisionTV) { - if (VBInfo & SetInSlaveMode) - tempah = 0x2c; - else - tempah = 0x20; - } - } else { - tempah = 0x20; - } - /* TW end */ - /* TW: old comment: */ - /* @@@ This can't be right! For now we just leave it as it is */ - /* TW: This is right - with the new code above! */ -#if 1 - SetRegANDOR(Part1Port,0x13,~0x03C,tempah); -#endif - - /*lines below are newly added for LVDS */ - tempax=LCDHDES; - tempbx=HDE; - tempcx=HT; - tempcx=tempcx-tempbx; /*HT-HDE */ - /*push ax lcdhdes */ - tempax=tempax+tempbx; /*lcdhdee */ - tempbx=HT; - if(tempax>=tempbx){ - tempax=tempax-tempbx; - } - /*push ax lcdhdee */ - lcdhdee=tempax; - tempcx=tempcx>>2; /*temp */ - tempcx=tempcx+tempax; /*lcdhrs */ - if(tempcx>=tempbx){ - tempcx=tempcx-tempbx; - } - /* v ah,cl */ - tempax=tempcx; - tempax=tempax>>3; /*BPLHRS */ - tempah=tempax&0x0FF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 14 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x14,tempah); /*Part1_14h */ - tempah=tempah+2; - tempah=tempah+0x01F; - tempcl=tempcx&0x0FF; - tempcl=tempcl&0x07; - tempcl=(tempcl<<5)&0xFF; /* PHLHSKEW */ - tempah=tempah|tempcl; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 15 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x15,tempah); /*Part1_15h */ - tempbx=lcdhdee; /*lcdhdee */ - tempcx=LCDHDES; /*lcdhdes */ - tempah=(tempcx&0xFF); - tempah=tempah&0x07; /*BPLHDESKEW */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1a -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x1A,tempah); /*Part1_1Ah */ - tempcx=tempcx>>3; /*BPLHDES */ - tempah=(tempcx&0xFF); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 16 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x16,tempah); /*Part1_16h */ - if (tempbx&0x07) - tempbx=tempbx+8; - tempbx=tempbx>>3; /*BPLHDEE */ - tempah=tempbx&0xFF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 17 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x17,tempah); /*Part1_17h */ - - tempcx=VGAVT; - tempbx=VGAVDE; - tempcx=tempcx-tempbx; /* GAVT-VGAVDE */ - tempbx=LCDVDES; /*VGAVDES */ - temppush1=tempbx; /*push bx temppush1 */ - if(IF_DEF_TRUMPION==0){ - if(IF_DEF_CH7005==1) tempax=VGAVDE; - if(VBInfo&SetCRT2ToLCD) { - if(LCDResInfo==Panel800x600) tempax=600; - else tempax=768; - } - } - else tempax=VGAVDE; - tempbx=tempbx+tempax; - tempax=VT; /*VT */ - if(tempbx>=VT){ - tempbx=tempbx-tempax; - } - temppush2=tempbx; /*push bx temppush2 */ - tempcx=tempcx>>1; - tempbx=tempbx+tempcx; - tempbx++; /*BPLVRS */ - if(tempbx>=tempax){ - tempbx=tempbx-tempax; - } - tempah=tempbx&0xFF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 18 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x18,tempah); /*Part1_18h */ - tempcx=tempcx>>3; - tempcx=tempcx+tempbx; - tempcx++; /*BPLVRE */ - tempah=tempcx&0xFF; - tempah=tempah&0x0F; - tempah=tempah|0x030; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 19 -> 0x%x\n", tempah)); - SetRegANDOR(Part1Port,0x19,~0x03F,tempah); /*Part1_19h */ - tempbh=(tempbx&0xFF00)>>8; - tempbh=tempbh&0x07; - tempah=tempbh; - tempah=(tempah<<3)&0xFF; /*BPLDESKEW =0 */ - /*movzx */ - tempbx=VGAVDE; - if(tempbx!=VDE){ - tempah=tempah|0x40; - } - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1a -> 0x%x\n", tempah)); - SetRegANDOR(Part1Port,0x1A,0x07,tempah); /*Part1_1Ah */ - - tempecx=VGAVT; - tempebx=VDE; - tempeax=VGAVDE; - tempecx=tempecx-tempeax; /*VGAVT-VGAVDE */ - tempeax=tempeax*64; - templong=tempeax/tempebx; - if(templong*tempebx<tempeax){ - templong++; - } - tempebx=templong; /*BPLVCFACT */ - if(SetFlag&EnableLVDSDDA){ - tempebx=tempebx&0x03F; - } - tempah=(UShort)(tempebx&0x0FF); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1e -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x1E,tempah); /*Part1_1Eh */ - - tempbx=temppush2; /* p bx temppush2 BPLVDEE */ - tempcx=temppush1; /*pop cx temppush1 NPLVDES */ - tempbh=(tempbx&0xFF00)>>8; - tempah=tempah&0x07; - tempah=tempbh; - tempah=tempah<<3; - tempch=(tempcx&0xFF00)>>8; - tempch=tempch&0x07; - tempah=tempah|tempch; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1d -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x1D,tempah); /*Part1_1Dh */ - tempah=tempbx&0xFF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1c -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x1C,tempah); /*Part1_1Ch */ - tempah=tempcx&0xFF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1b -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x1B,tempah); /*Part1_1Bh */ - - tempecx=VGAHDE; - tempebx=HDE; - tempeax=tempecx; - tempeax=tempeax<<6; - tempeax=tempeax<<10; - tempeax=tempeax/tempebx; - if(tempebx==tempecx){ - tempeax=65535; - } - tempecx=tempeax; - tempeax=VGAHT; - tempeax=tempeax<<6; - tempeax=tempeax<<10; - tempeax=tempeax/tempecx; - tempecx=tempecx<<16; - tempeax=tempeax-1; - tempax=(UShort)(tempeax&0x00FFFF); - tempcx=tempax; - tempah=tempcx&0x0FF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1f -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x1F,tempah); /*Part1_1Fh */ - tempbx=VDE; - tempbx--; /*BENPLACCEND */ - if(SetFlag&EnableLVDSDDA){ - tempbx=1; - } - tempah=(tempbx&0xFF00)>>8; - tempah=(tempah<<3)&0xFF; - tempch=(tempcx&0xFF00)>>8; - tempch=tempch&0x07; - tempah=tempah|tempch; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 20 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x20,tempah); /*Part1_20h */ - tempah=tempbx&0xFF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 21 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x21,tempah); /*Part1_21h */ - tempecx=tempecx>>16; /*BPLHCFACT */ - temp1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(temp1&HalfDCLK){ - tempecx=tempecx>>1; - } - tempcx=(UShort)(tempecx&0x0FFFF); - tempah=(tempcx&0xFF00)>>8; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 22 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x22,tempah); /*Part1_22h */ - tempah=tempcx&0x0FF; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 23 -> 0x%x\n", tempah)); - SiSSetReg1(Part1Port,0x23,tempah); /*Part1_23h */ - if(IF_DEF_TRUMPION==1){ - tempal=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x05)); /* si+St_ResInfo */ - if(ModeNo>0x13){ - SetFlag=SetFlag|ProgrammingCRT2; - GetRatePtrCRT2(ROMAddr,ModeNo); - tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ - tempal=tempal&0x1F; - } - tempah=0x80; - tempal=tempal*tempah; - REFIndex= offset_Zurac; /*offset Zurac need added in rompost.asm */ - REFIndex=REFIndex+tempal; - SetTPData(); /*this function not implemented yet */ - } - - REFIndex=OldREFIndex; /*pop di */ - - return; -} - -static void SetTPData(void) -{ - return; -} - - -static void SetGroup1_301(UShort BaseAddr,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - UShort temp1,temp2,tempcl,tempch,tempbl,tempbh,tempal,tempah,tempax,tempbx; - UShort tempcx,OldREFIndex; - UShort Part1Port,resinfo,modeflag; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - OldREFIndex=REFIndex; /* push di */ - - SetCRT2Offset(Part1Port,ROMAddr); - SetCRT2FIFO(Part1Port,ROMAddr,ModeNo,pScrn); - SetCRT2Sync(BaseAddr,ROMAddr,ModeNo); - - GetCRT1Ptr(ROMAddr); - - temp1=(VGAHT-1)&0x0FF; /* BTVGA2HT 0x08,0x09 */ - SiSSetReg1(Part1Port,0x08,temp1); - temp1=(((VGAHT-1)&0xFF00)>>8)<<4; - SetRegANDOR(Part1Port,0x09,~0x0F0,temp1); - - temp1=(VGAHDE+12)&0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ - SiSSetReg1(Part1Port,0x0A,temp1); - - temp1=VGAHDE+12; /* bx BTVGA@HRS 0x0B,0x0C */ - temp2=(VGAHT-VGAHDE)>>2; /* cx */ - temp1=temp1+temp2; - temp2=(temp2<<1)+temp1; - tempcl=temp2&0x0FF; - if(VBInfo&SetCRT2ToRAMDAC){ - tempbl=*((UChar *)(ROMAddr+REFIndex+4)); /* di+4 */ - tempbh=*((UChar *)(ROMAddr+REFIndex+14)); /* di+14 */ - temp1=((tempbh>>6)<<8)|tempbl; /* temp1->bx */ - temp1=(temp1-1)<<3; - tempcl=*((UChar *)(ROMAddr+REFIndex+5)); /* di+5 */ - tempch=*((UChar *)(ROMAddr+REFIndex+15)); /* di+15 */ - tempcl=tempcl&0x01F; - tempch=(tempch&0x04)<<(6-2); - tempcl=((tempcl|tempch)-1)<<3; - } - SiSSetReg1(Part1Port,0x0B,(UShort)(temp1&0x0FF)); - tempah=(temp1&0xFF00)>>8; - tempbh=((((VGAHDE+12)&0xFF00)>>8)<<4)&0x0FF; - tempah=tempah|tempbh; - SiSSetReg1(Part1Port,0x0C,tempah); - SiSSetReg1(Part1Port,0x0D,tempcl); /* BTVGA2HRE 0x0D */ - tempcx=(VGAVT-1); - tempah=tempcx&0x0FF; - SiSSetReg1(Part1Port,0x0E,tempah); /* BTVGA2TV 0x0E,0x12 */ - tempbx=VGAVDE-1; - tempah=tempbx&0x0FF; - SiSSetReg1(Part1Port,0x0F,tempah); /* BTVGA2VDEE 0x0F,0x12 */ - tempah=((tempbx&0xFF00)<<3)>>8; - tempah=tempah|((tempcx&0xFF00)>>8); - SiSSetReg1(Part1Port,0x12,tempah); - - tempbx=(VGAVT+VGAVDE)>>1; /* BTVGA2VRS 0x10,0x11 */ - tempcx=((VGAVT-VGAVDE)>>4)+tempbx+1; /* BTVGA2VRE 0x11 */ - if(VBInfo&SetCRT2ToRAMDAC){ - tempbx=*((UChar *)(ROMAddr+REFIndex+8)); /* di+8 */ - temp1=*((UChar *)(ROMAddr+REFIndex+7)); /* di+7 */ - if(temp1&0x04){ - tempbx=tempbx|0x0100; - } - if(temp1&0x080){ - tempbx=tempbx|0x0200; - } - temp1=*((UChar *)(ROMAddr+REFIndex+13)); /* di+13 */ - if(temp1&0x08){ - tempbx=tempbx|0x0400; - } - tempcl= *((UChar *)(ROMAddr+REFIndex+9)); /* di+9 */ - tempcx=(tempcx&0xFF00)|(tempcl&0x00FF); - } - tempah=tempbx&0x0FF; - SiSSetReg1(Part1Port,0x10,tempah); - tempbh=(tempbx&0xFF00)>>8; - tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); - SiSSetReg1(Part1Port,0x11,tempah); - - if( pSiS->Chipset == PCI_CHIP_SIS300 ){ - tempah=0x10; - if((LCDResInfo!=Panel1024x768)&&(LCDResInfo==Panel1280x1024)) tempah=0x20; - } - else tempah=0x20; - if(VBInfo&SetCRT2ToTV) tempah=0x08; -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - if(VBInfo&SetInSlaveMode) tempah=0x2c; - else tempah=0x20; - } -/* ynlai end */ - SetRegANDOR(Part1Port,0x13,~0x03C,tempah); - - if(!(VBInfo&SetInSlaveMode)){ - REFIndex=OldREFIndex; - return; - } - if(VBInfo&SetCRT2ToTV){ - tempax=0xFFFF; - }else{ - tempax=GetVGAHT2(); - } - tempcl=0x08; /* Reg 0x03 Horozontal Total */ - temp1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(!(temp1&Charx8Dot)){ /* temp1->St_ModeFlag */ - tempcl=0x09; - } - if(tempax>=VGAHT){ - tempax=VGAHT; - } - if(temp1&HalfDCLK){ - tempax=tempax>>1; - } - tempax=(tempax/tempcl)-5; - tempbl=tempax; - tempah=0xFF; /* set MAX HT */ - SiSSetReg1(Part1Port,0x03,tempah); - - tempax=VGAHDE; /* 0x04 Horizontal Display End */ - if(temp1&HalfDCLK){ - tempax=tempax>>1; - } - tempax=(tempax/tempcl)-1; - tempbh=tempax; - SiSSetReg1(Part1Port,0x04,tempax); - - tempah=tempbh; - if(VBInfo&SetCRT2ToTV){ - tempah=tempah+2; - } -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - resinfo=*(UShort *)(ROMAddr+ModeIDOffset+0x09); /* si+Ext_ResInfo */ - if(resinfo==7) tempah=tempah-2; - } -/* ynlai end */ - SiSSetReg1(Part1Port,0x05,tempah); /* 0x05 Horizontal Display Start */ - SiSSetReg1(Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ - /* 0x07 horizontal Retrace Start */ -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - tempah=tempbl-1; - modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(!(modeflag&HalfDCLK)) { - tempah=tempah-6; - if(SetFlag&TVSimuMode) { - tempah=tempah-4; - if(ModeNo>0x13) tempah=tempah-10; - } - } - } -/* ynlai end */ - else { - tempcx=(tempbl+tempbh)>>1; - tempah=(tempcx&0xFF)+2; - - if(VBInfo&SetCRT2ToTV){ - tempah=tempah-1; - if(!(temp1&HalfDCLK)){ - if((temp1&Charx8Dot)){ - tempah=tempah+4; - if(VGAHDE>=800){ - tempah=tempah-6; - } - } - } - }else{ - if(!(temp1&HalfDCLK)){ - tempah=tempah-4; - if(VGAHDE>=800){ - tempah=tempah-7; - if(ModeType==ModeEGA){ - if(VGAVDE==1024){ - tempah=tempah+15; - if(LCDResInfo!=Panel1280x1024){ - tempah=tempah+7; - } - } - } - if(VGAHDE>=1280){ - tempah=tempah+28; - } - } - } - } - } - SiSSetReg1(Part1Port,0x07,tempah); /* 0x07 Horizontal Retrace Start */ - - SiSSetReg1(Part1Port,0x08,0); /* 0x08 Horizontal Retrace End */ - SiSSetReg1(Part1Port,0x18,0x03); /* 0x18 SR08 */ - SiSSetReg1(Part1Port,0x19,0); /* 0x19 SR0C */ - SiSSetReg1(Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ - - tempcx=0x121; - tempcl=0x21; - tempch=0x01; - tempbx=VGAVDE; /* 0x0E Virtical Display End */ - if(tempbx==360) tempbx=350; - if(tempbx==375) tempbx=350; - if(tempbx==405) tempbx=400; - tempbx--; - tempah=tempbx&0x0FF; - SiSSetReg1(Part1Port,0x0E,tempah); - SiSSetReg1(Part1Port,0x10,tempah); /* 0x10 vertical Blank Start */ - tempbh=(tempbx&0xFF00)>>8; - if(tempbh&0x01){ - tempcl=tempcl|0x0A; - } - tempah=0;tempal=0x0B; - if(temp1&DoubleScanMode){ - tempah=tempah|0x080; - } - if(tempbh&0x02){ - tempcl=tempcl|0x040; - tempah=tempah|0x020; - } - SiSSetReg1(Part1Port,0x0B,tempah); - if(tempbh&0x04){ - tempch=tempch|0x06; - } - - SiSSetReg1(Part1Port,0x11,0); /* 0x11 Vertival Blank End */ - - tempax=VGAVT-tempbx; /* 0x0C Vertical Retrace Start */ - tempax=tempax>>2; - temp2=tempax; /* push ax */ - tempax=tempax<<1; - tempbx=tempax+tempbx; -/* ynlai begin */ -/* ynlai end */ - if((SetFlag&TVSimuMode)&&(VBInfo&SetPALTV)&&(VGAHDE==800)){ - tempbx=tempbx+40; - } - tempah=(tempbx&0x0FF); - SiSSetReg1(Part1Port,0x0C,tempah); - tempbh=(tempbx&0xFF00)>>8; - if(tempbh&0x01){ - tempcl=tempcl|0x04; - } - if(tempbh&0x02){ - tempcl=tempcl|0x080; - } - if(tempbh&0x04){ - tempch=tempch|0x08; - } - - tempax=temp2; /* pop ax */ - tempax=(tempax>>2)+1; - tempbx=tempbx+tempax; - tempah=(tempbx&0x0FF)&0x0F; - SiSSetReg1(Part1Port,0x0D,tempah); /* 0x0D vertical Retrace End */ - tempbl=tempbx&0x0FF; - if(tempbl&0x10){ - tempch=tempch|0x020; - } - - tempah=tempcl; - SiSSetReg1(Part1Port,0x0A,tempah); /* 0x0A CR07 */ - tempah=tempch; - SiSSetReg1(Part1Port,0x17,tempah); /* 0x17 SR0A */ - tempax=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - tempah=(tempax&0xFF00)>>8; - tempah=(tempah>>1)&0x09; - SiSSetReg1(Part1Port,0x16,tempah); /* 0x16 SR01 */ - SiSSetReg1(Part1Port,0x0F,0); /* 0x0F CR14 */ - SiSSetReg1(Part1Port,0x12,0); /* 0x12 CR17 */ - SiSSetReg1(Part1Port,0x1A,0); /* 0x1A SR0E */ - - REFIndex=OldREFIndex; /* pop di */ -} - -static void SetCRT2Offset(UShort Part1Port,ULong ROMAddr) -{ - UShort offset; - if(VBInfo&SetInSlaveMode){ - return; - } - offset=GetOffset(ROMAddr); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT2Offset) offset %x\n", offset)); - SiSSetReg1(Part1Port,0x07,(UShort)(offset&0xFF)); - SiSSetReg1(Part1Port,0x09,(UShort)((offset&0xFF00)>>8)); - SiSSetReg1(Part1Port,0x03,(UShort)(((offset>>3)&0xFF)+1)); -} - -static UShort GetOffset(ULong ROMAddr) -{ - UShort tempal,temp1,colordepth; - tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ - tempal=(tempal>>4)&0xFF; - ScreenOffset=*((UShort *)(ROMAddr+0x206)); /* Get ScreeOffset table */ - tempal=*((UChar *)(ROMAddr+ScreenOffset+tempal)); /* get ScreenOffset */ - tempal=tempal&0xFF; - temp1=*((UChar *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ - if(temp1&InterlaceMode){ - tempal=tempal<<1; - } - colordepth=GetColorDepth(ROMAddr); - return(tempal*colordepth); -} - -static UShort GetColorDepth(ULong ROMAddr) -{ - UShort ColorDepth[6]={1,2,4,4,6,8}; - UShort temp; - int temp1; - temp=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - temp1=(temp&ModeInfoFlag)-ModeEGA; - if(temp1<0) temp1=0; - return(ColorDepth[temp1]); -} - -static void SetCRT2FIFO(UShort Part1Port,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - UShort temp,temp1,temp2,temp3,flag; - UShort vclk2ptr,latencyindex; - UShort oldREFIndex,CRT1ModeNo,oldModeIDOffset; - long int longtemp; - -#if 1 /* TW: sisfb values - better */ - static UShort LatencyFactor[] = { 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */ - 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */ - 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */ - 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */ - 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */ - 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */ - 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */ - 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */ - }; -#endif - -#if 0 /* TW: x driver values */ - static UShort LatencyFactor[48]={ 88, 80, 78, 72, 70, 00, /* 64 bit BQ=2 */ - 00, 79, 77, 71, 69, 49, /* 64 bit BQ=1 */ - 88, 80, 78, 72, 70, 00, /* 128 bit BQ=2 */ - 00, 72, 70, 64, 62, 44, /* 128 bit BQ=1 */ - 73, 65, 63, 57, 55, 00, /* 64 bit BQ=2 */ - 00, 64, 62, 56, 54, 34, /* 64 bit BQ=1 */ - 78, 70, 68, 62, 60, 00, /* 128 bit BQ=2 */ - 00, 62, 60, 54, 52, 34}; /* 128 bit BQ=1 */ -#endif - - oldREFIndex=REFIndex; /* push REFIndex(CRT2 now) */ - oldModeIDOffset=ModeIDOffset; /* push ModeIDOffset */ - - CRT1ModeNo=(UChar)SiSGetReg1(P3d4,0x34); /* get CRT1 ModeNo */ - SearchModeID(ROMAddr,CRT1ModeNo); /* Get ModeID Table */ - - GetRatePtr(ROMAddr,CRT1ModeNo); /* Set REFIndex-> for crt1 refreshrate */ - temp1=GetVCLK(ROMAddr,CRT1ModeNo); - temp2=GetColorTh(ROMAddr); - temp3=GetMCLK(ROMAddr); - PDEBUG(xf86DrvMsg(0, X_PROBED, - "(FIFO) VCLK %x MCLK %x Colorth=%d\n", temp1, temp3, temp2)); - temp=((UShort)(temp1*temp2)/temp3); /* temp->bx */ - temp1=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ - temp1=temp1>>6; - temp1=temp1<<1; - if(temp1==0) temp1=1; - temp1=temp1<<2; /* temp1->ax */ - - longtemp=temp1-temp; - -#if 1 /* X driver code */ - temp2=(UShort)((28*16)/(int)longtemp); /* temp2->cx */ - if(!((temp2*(int)longtemp)==(28*16))) temp2++; -#else /* sisfb code - WRONG! */ - temp2=(UShort)((int)longtemp/(28*16)); /* temp2->cx */ - if(!((temp2*(28*16)==(int)longtemp))) temp2++; -#endif - - if( pSiS->Chipset == PCI_CHIP_SIS300 ){ - temp1=CalcDelayVB(); - }else{ /* for Trojan and Spartan */ - flag=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ - if(flag&0x80){ - latencyindex=12; /* 128 bit */ - }else{ - latencyindex=0; /* 64 bit */ - } - flag=GetQueueConfig(); - if(!(flag&0x01)){ - latencyindex+=24; /* GUI timing =0 */ - } - if(flag&0x10){ - latencyindex+=6; /* BQ =2 */ - } - latencyindex=latencyindex + (flag>>5); - temp1= LatencyFactor[latencyindex]; - temp1=temp1+15; - flag=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ - if(!(flag&0x80)){ - temp1=temp1+5; /* 64 bit */ - } - } - - temp2=temp2+temp1; - - REFIndex=oldREFIndex; /* pop REFIndex(CRT2) */ - ModeIDOffset=oldModeIDOffset; /* pop ModeIDOffset */ - - vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); - temp1=*((UShort *)(ROMAddr+vclk2ptr+(VCLKLen-2))); - temp3=GetColorTh(ROMAddr); - - longtemp=temp1*temp2*temp3; - - temp3=GetMCLK(ROMAddr); - temp3=temp3<<4; - temp2=(int)(longtemp/temp3); - if((long int)temp2*(long int)temp3<(long int)longtemp) { - temp2++; /* temp2->cx */ - } - - /* ynlai begin */ - if(IF_DEF_HiVision==1) { if(temp2<10) temp2=10; } - else { if(IF_DEF_LVDS==1) { if(temp2<8) temp2=8; } - /* TW: LVDS doesn't like values < 8 */ - else { if(temp2<6) temp2=6;} } - /* ynlai end */ - - if(temp2>0x14) temp2=0x14; - - temp1=(UChar)SiSGetReg1(Part1Port,0x01); /* part1port index 01 */ - temp1=(temp1&(~0x1F))|temp2; - /* TW: temp2 was 0x16 and made calculations void! */ - SiSSetReg1(Part1Port,0x01,temp1); - - temp1=(UChar)SiSGetReg1(Part1Port,0x02); /* part1port index 02 */ - temp1=(temp1&(~0x1F))|temp2; - SiSSetReg1(Part1Port,0x02,temp1); -} - -static UShort GetVCLK(ULong ROMAddr,UShort ModeNo) -{ - UShort tempptr; - UShort temp1; - tempptr=GetVCLKPtr(ROMAddr,ModeNo); - temp1=*((UShort *)(ROMAddr+tempptr+(VCLKLen-2))); - return temp1; -} - -static UShort GetQueueConfig(void) -{ - UShort tempal,tempbl; - ULong tempeax; - - SetReg4(0xcf8,0x80000050); - tempeax=GetReg3(0xcfc); - tempeax=(tempeax>>24)&0x0f; - tempbl=(UShort)tempeax; - tempbl=tempbl<<4; - - SetReg4(0xcf8,0x800000A0); - tempeax=GetReg3(0xcfc); - tempeax=(tempeax>>24)&0x0f; - tempal=(UShort)tempeax; - tempbl=tempbl|tempal; - - return(tempbl); -} - -static UShort GetVCLKPtr(ULong ROMAddr,UShort ModeNo) -{ - UShort tempal=0; - if(IF_DEF_LVDS==0) { - tempal=(UChar)GetReg2((UShort)(P3ca+0x02)); /* Port 3cch */ - tempal=((tempal>>2)&0x03); - if(ModeNo>0x13){ - tempal=*((UChar *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ - } - VCLKLen=GetVCLKLen(ROMAddr); - tempal=tempal*VCLKLen; - tempal=tempal+(*((UShort *)(ROMAddr+0x208))); /* VCLKData */ - return ((UShort)tempal); - } else { - if(LCDResInfo==Panel800x600) { - tempal=VCLK40; - } else if(LCDResInfo==Panel1024x768) { - tempal=VCLK65; - } - VCLKLen=GetVCLKLen(ROMAddr); - tempal=tempal*VCLKLen; - tempal=tempal+(*((UShort *)(ROMAddr+0x208))); - return((UShort)tempal); - } -} - -static UShort GetColorTh(ULong ROMAddr) -{ - UShort temp; - temp=GetColorDepth(ROMAddr); - temp=temp>>1; - if(temp==0) temp++; - return temp; -} - -static UShort GetMCLK(ULong ROMAddr) -{ - UShort tempmclkptr; - UShort tempmclk; - tempmclkptr=GetMCLKPtr(ROMAddr); - tempmclk=*((UShort *)(ROMAddr+tempmclkptr+0x03)); /* di+3 */ - return tempmclk; -} - -static UShort GetMCLKPtr(ULong ROMAddr) -{ - UShort tempdi; - UShort tempdramtype,tempax; - - tempdi=*((UShort *)(ROMAddr+0x20C)); /* MCLKData */ - tempdramtype=GetDRAMType(ROMAddr); - tempax=5*tempdramtype; - tempdi=tempdi+tempax; - return (tempdi); -} - -static UShort GetDRAMType(ULong ROMAddr) -{ - UShort tsoftsetting,temp3; - tsoftsetting=*((UChar *)(ROMAddr+0x52)); - if(!(tsoftsetting&SoftDramType)){ - temp3=(UChar)SiSGetReg1(P3c4,0x1A); - /* TW: 0x1A was 0x3A = POWER_ON_TRAP_III ? WRONG! */ - tsoftsetting=temp3; - } - tsoftsetting=tsoftsetting&0x07; - return(tsoftsetting); -} - -static UShort CalcDelayVB(void) -{ - UShort tempal,tempah,temp1,tempbx; - UShort ThTiming[8]={1,2,2,3,0,1,1,2}; - UShort ThLowB[24]={81,4,72,6,88,8,120,12, - 55,4,54,6,66,8,90,12, - 42,4,45,6,55,8,75,12}; - - tempah=(UChar)SiSGetReg1(P3c4,0x18); /* SR_18 */ - tempah=tempah&0x62; - tempah=tempah>>1; - tempal=tempah; - tempah=tempah>>3; - tempal=tempal|tempah; - tempal=tempal&0x07; - - temp1=ThTiming[tempal]; /* temp1->cl */ - - tempbx=(UChar)SiSGetReg1(P3c4,0x16); /* SR_16 */ - tempbx=tempbx>>6; - tempah=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ - tempah=((tempah>>4)&0x0C); - tempbx=((tempbx|tempah)<<1); - - tempal=ThLowB[tempbx+1]*temp1; - tempbx=ThLowB[tempbx]; - tempbx=tempal+tempbx; - - return(tempbx); -} - -static UShort GetVCLK2Ptr(ULong ROMAddr,UShort ModeNo) -{ - UShort tempal,tempbx,temp; - UShort LCDXlat1VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; - UShort LCDXlat2VCLK[4]={VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2}; - UShort LVDSXlat1VCLK[4]={VCLK40,VCLK40,VCLK40,VCLK40}; - UShort LVDSXlat2VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; - UShort LVDSXlat3VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; - - if(IF_DEF_LVDS==0) { - if(ModeNo<=0x13){ - tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - }else{ - tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ - } - tempal=tempal>>6; - if(LCDResInfo!=Panel1024x768){ - tempal=LCDXlat2VCLK[tempal]; - }else{ - tempal=LCDXlat1VCLK[tempal]; - } - - if(VBInfo&SetCRT2ToLCD){ - tempal=tempal; - } -/* ynlai begin */ - else { /* for TV */ - if(VBInfo&SetCRT2ToTV) { - if(IF_DEF_HiVision==1) { - if(SetFlag&RPLLDIV2XO) tempal=HiTVVCLKDIV2; - else tempal=HiTVVCLK; - if(SetFlag&TVSimuMode){ - temp=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(temp&Charx8Dot) tempal=HiTVSimuVCLK; - else tempal=HiTVTextVCLK; - } - } - else { - if(VBInfo&SetCRT2ToTV){ - if(SetFlag&RPLLDIV2XO) tempal=TVVCLKDIV2; - else tempal=TVVCLK; - } - else { - tempal=(UChar)GetReg2((UShort)(P3ca+0x02)); /* Port 3cch */ - tempal=((tempal>>2)&0x03); - if(ModeNo>0x13) tempal=*((UChar *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ - } - } - } - } - } -/* ynlai end */ - else { /* LVDS */ - if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); - else tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); - -/* TW: The following looks like nonsense: - * First, check if system HAS as CHRONTEL, then check if CRT2 is LCD - * if CRT2 is LCD, do NOTHING and accept tempal as index. - * Otherwise (if no CHRONTEL _exists_), read index from tables. - * What's the difference between a system that has CHRONTEL but CRT2 is LCD and - * a machine without CHRONTEL but with CRT2 = LCD, too? - * (If the first 2 ifs are put together with &&, return value is wrong.) - */ - if ((IF_DEF_CH7005==1)) { - if(!(VBInfo&SetCRT2ToLCD)) { - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLK (CH) tempal = %x\n", tempal)); - tempal=tempal&0x1f; - tempbx=0; - if(VBInfo&SetPALTV) tempbx=tempbx+2; - if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; - tempbx=tempbx<<1; - temp=(*((UShort *)(ROMAddr+ADR_CHTVVCLKPtr))); - tempbx=(*((UShort *)(ROMAddr+temp+tempbx))); - tempal=(*((UShort *)(ROMAddr+tempbx+tempal))); - tempal=tempal&0x00FF; - } - } - else { - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLK (else) tempal = %x (%x %x %x)\n", - tempal, LCDResInfo, Panel800x600, Panel1024x768)); - tempal=tempal>>6; - if(LCDResInfo==Panel800x600) tempal=LVDSXlat1VCLK[tempal]; - else if(LCDResInfo==Panel1024x768) tempal=LVDSXlat2VCLK[tempal]; - else tempal=LVDSXlat3VCLK[tempal]; - } - } - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLK tempal = %x, REFIndex=%d\n", tempal, REFIndex)); - VCLKLen=GetVCLKLen(ROMAddr); - tempal=tempal*VCLKLen; - tempal=tempal+(*((UShort *)(ROMAddr+0x208))); /* VCLKData */ - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLKData = %x\n", tempal)); - return ((UShort)tempal); -} - -static UShort GetVCLKLen(ULong ROMAddr) -{ - UShort VCLKDataStart,vclklabel,temp; - VCLKDataStart=*((UShort *)(ROMAddr+0x208)); - for(temp=0;;temp++){ - vclklabel=*((UShort *)(ROMAddr+VCLKDataStart+temp)); - if(vclklabel==VCLKStartFreq){ - temp=temp+2; - return(temp); - } - } - return(0); -} - - -static void SetCRT2Sync(UShort BaseAddr,ULong ROMAddr,UShort ModeNo) -{ - UShort temp1,tempah=0; - UShort temp; - UShort Part1Port; - - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - - if(IF_DEF_LVDS==1){ - if(VBInfo&SetCRT2ToLCD){ - tempah=LCDInfo; - if(!(tempah&LCDSync)){ - temp=*((UShort *)(ROMAddr+REFIndex)); /*di+Ext_InfoFlag */ - tempah=(temp>>8)&0x0C0; - }else{ - tempah=tempah&0x0C0; - } - } - } - else { - temp=*((UShort *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ - tempah=(temp>>8)&0x0C0; - } - temp1=(UChar)SiSGetReg1(Part1Port,0x19); /* part1port index 02 */ - temp1=(temp1&(~0x0C0))|tempah; - SiSSetReg1(Part1Port,0x19,temp1); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT2Sync) 19 -> | %x\n", tempah)); -} - -static void GetCRT1Ptr(ULong ROMAddr) -{ - UShort temprefcrt1; - UShort temp; - temp=*((UChar *)(ROMAddr+REFIndex+0x02)); /* di+Ext_CRT1CRTC */ - temp=temp*CRT1Len; - temprefcrt1=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ - REFIndex=temprefcrt1+temp; /* di->CRT1Table+Ext_CRT1CRTC*CRT1Len */ -} - -static void SetRegANDOR(UShort Port,UShort Index,UShort DataAND,UShort DataOR) -{ - UShort temp1; - temp1=SiSGetReg1(Port,Index); /* part1port index 02 */ - temp1=(temp1&(DataAND))|DataOR; - SiSSetReg1(Port,Index,temp1); -} - -static void SetRegAND (UShort Port, UShort Index, UShort DataAND) -{ - UShort temp; - - temp=SiSGetReg1(Port,Index); /* Part1Port index 02 */ - temp=temp&DataAND; - SiSSetReg1(Port,Index,temp); -} - -static void SetRegOR (UShort Port, UShort Index, UShort DataOR) -{ - UShort temp; - - temp=SiSGetReg1(Port,Index); /* Part1Port index 02 */ - temp=temp|DataOR; - SiSSetReg1(Port,Index,temp); -} - -static UShort GetVGAHT2(void) -{ - long int temp1,temp2; - temp1=(VGAVT-VGAVDE)*RVBHCMAX; - temp1=temp1&0x0FFFF; - temp2=(VT-VDE)*RVBHCFACT; - temp2=temp2&0x0FFFF; - temp2=temp2*HT; - temp2=temp2/temp1; - return((UShort)temp2); -} - -static void SetGroup2(UShort BaseAddr,ULong ROMAddr, UShort ModeNo) -{ - UShort tempah,tempbl,tempbh,tempcl,i,j,tempcx,pushcx,tempbx,tempax; - UShort tempmodeflag,tempflowflag; - UChar *temp1; - UShort *temp2; - UShort pushbx; - UShort Part2Port; - UShort modeflag; - long int longtemp; - - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - tempcx=VBInfo; - tempah=VBInfo&0x0FF; - tempbl=VBInfo&0x0FF; - tempbh=VBInfo&0x0FF; - tempbx=(tempbl&0xFF)|(tempbh<<8); - tempbl=tempbl&0x10; - tempbh=(tempbh&0x04)<<1; - tempah=(tempah&0x08)>>1; - tempah=tempah|tempbh; - tempbl=tempbl>>3; - tempah=tempah|tempbl; - tempah=tempah^0x0C; - - if(IF_DEF_HiVision==1) { - temp1=(UChar *)(ROMAddr+0x0F1); /* PALPhase */ - tempah=tempah^0x01; - if(VBInfo&SetInSlaveMode) { - temp2=HiTVSt2Timing; - if(SetFlag&TVSimuMode) { - modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - if(modeflag&Charx8Dot) temp2=HiTVSt1Timing; - else temp2=HiTVTextTiming; - } - } - else temp2=HiTVExtTiming; - } - else { - if(VBInfo&SetPALTV){ - temp1=(UChar *)(ROMAddr+0x0F1); /* PALPhase */ - temp2=PALTiming; - }else{ - tempah=tempah|0x10; - temp1=(UChar *)(ROMAddr+0x0ED); /* NTSCPhase */ - temp2=NTSCTiming; - } - } - SiSSetReg1(Part2Port,0x0,tempah); - for(i=0x31;i<=0x34;i++,temp1++){ - SiSSetReg1(Part2Port,i,*(UChar *)temp1); - } - for(i=0x01,j=0;i<=0x2D;i++,j++){ - SiSSetReg1(Part2Port,i,temp2[j]); - } - for(i=0x39;i<=0x45;i++,j++){ - SiSSetReg1(Part2Port,i,temp2[j]); /* di->temp2[j] */ - } - - tempah=SiSGetReg1(Part2Port,0x0A); - tempah=tempah|NewFlickerMode; - SiSSetReg1(Part2Port,0x0A,tempah); - - SiSSetReg1(Part2Port,0x35,RY1COE); - SiSSetReg1(Part2Port,0x36,RY2COE); - SiSSetReg1(Part2Port,0x37,RY3COE); - SiSSetReg1(Part2Port,0x38,RY4COE); - -/* ynlai begin */ - if(IF_DEF_HiVision==1) tempax=950; - else { - if(VBInfo&SetPALTV) tempax=520; - else tempax=440; - } - if(VDE<=tempax) { - tempax=tempax-VDE; - tempax=tempax>>2; - tempah=(tempax&0xFF00)>>8; - tempah=tempah+temp2[0]; - SiSSetReg1(Part2Port,0x01,tempah); - tempah=tempax&0x00FF; - tempah=tempah+temp2[1]; - SiSSetReg1(Part2Port,0x02,tempah); - } -/* begin end */ - - tempcx=HT-1; - tempah=tempcx&0xFF; - SiSSetReg1(Part2Port,0x1B,tempah); - tempah=(tempcx&0xFF00)>>8; - SetRegANDOR(Part2Port,0x1D,~0x0F,(UChar)tempah); - - tempcx=HT>>1; - pushcx=tempcx; /* push cx */ - - tempcx=tempcx+7; -/* ynlai begin */ - if(IF_DEF_HiVision==1) tempcx=tempcx-4; -/* ynlai end */ - tempah=(tempcx&0xFF); - tempah=(tempah<<4)&0xFF; - SetRegANDOR(Part2Port,0x22,~0x0F0,tempah); - - - tempbx=temp2[j]; - tempbx=tempbx+tempcx; - tempah=tempbx&0xFF; - SiSSetReg1(Part2Port,0x24,tempah); - tempah=(tempbx&0xFF00)>>8; - tempah=(tempah<<4)&0xFF; - SetRegANDOR(Part2Port,0x25,~0x0F0,tempah); - - tempbx=tempbx+8; -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - tempbx=tempbx-4; - tempcx=tempbx; - } -/* ynlai end */ - tempah=((tempbx&0xFF)<<4)&0xFF; - SetRegANDOR(Part2Port,0x29,~0x0F0,tempah); - - tempcx=tempcx+temp2[++j]; - tempah=tempcx&0xFF; - SiSSetReg1(Part2Port,0x27,tempah); - tempah=(((tempcx&0xFF00)>>8)<<4)&0xFF; - SetRegANDOR(Part2Port,0x28,~0x0F0,tempah); - - tempcx=tempcx+8; -/* ynlai begin */ - if(IF_DEF_HiVision==1) tempcx=tempcx-4; -/* ynlai end */ - tempah=tempcx&0xFF; - tempah=(tempah<<4)&0xFF; - SetRegANDOR(Part2Port,0x2A,~0x0F0,tempah); - - tempcx=pushcx; /* pop cx */ - tempcx=tempcx-temp2[++j]; - tempah=tempcx&0xFF; - tempah=(tempah<<4)&0xFF; - SetRegANDOR(Part2Port,0x2D,~0x0F0,tempah); - - tempcx=tempcx-11; - if(!(VBInfo&SetCRT2ToTV)){ - tempax=GetVGAHT2(); - tempcx=tempax-1; - } - tempah=tempcx&0xFF; - SiSSetReg1(Part2Port,0x2E,tempah); - - tempbx=VDE; - if(VGAVDE==360){ - tempbx=746; - } - if(VGAVDE==375){ - tempbx=746; - } - if(VGAVDE==405){ - tempbx=853; - } - /* assuming <<ifndef>> HivisionTV */ - if((VBInfo&SetCRT2ToTV)){ - tempbx=tempbx>>1; - } - - tempbx=tempbx-2; - tempah=tempbx&0xFF; -/* ynlai begin */ - if(IF_DEF_HiVision==1) - if(VBInfo&SetInSlaveMode) - if(ModeNo==0x2f) tempah=tempah+1; -/* ynlai end */ - SiSSetReg1(Part2Port,0x2F,tempah); - - tempah=(tempcx&0xFF00)>>8; - tempbh=(tempbx&0xFF00)>>8; - tempbh=(tempbh<<6)&0xFF; - tempah=tempah|tempbh; - /* assuming <<ifndef>> hivisiontv */ -/* ynlai begin */ - if(IF_DEF_HiVision==0) { - tempah=tempah|0x10; - if(!(VBInfo&SetCRT2ToSVIDEO)){ - tempah=tempah|0x20; - } - } -/* ynlai end */ - SiSSetReg1(Part2Port,0x30,tempah); - - tempbh=0; - tempbx=tempbx&0xFF; - - tempmodeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - tempflowflag=0; - if(!(tempmodeflag&HalfDCLK)){ - tempcx=VGAHDE; - if(tempcx>=HDE){ - tempbh=tempbh|0x20; - tempbx=(tempbh<<8)|(tempbx&0xFF); - tempah=0; - } - } - tempcx=0x0101; -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - if(VGAHDE>=1024) { - tempcx=0x1920; - if(VGAHDE>=1280) tempcx=0x1420; - } - } -/* ynlai end */ - if(!(tempbh&0x20)){ - if(tempmodeflag&HalfDCLK){ - tempcl=((tempcx&0xFF)<<1)&0xFF; - tempcx=(tempcx&0xFF00)|tempcl; - } - pushbx=tempbx; - tempax=VGAHDE; - tempbx=(tempcx&0xFF00)>>8; - longtemp=tempax*tempbx; - tempcx=tempcx&0xFF; - longtemp=longtemp/tempcx; - longtemp=longtemp*8*1024; - tempax=(longtemp)/HDE; - if(tempax*HDE<longtemp){ - tempax=tempax+1; - }else{ - tempax=tempax; - } - tempbx=pushbx; - tempah=((tempax&0xFF00)>>8)&0x01F; - tempbh=tempbh|tempah; - tempah=tempax&0xFF; - } - - SiSSetReg1(Part2Port,0x44,tempah); - tempah=tempbh; - SetRegANDOR(Part2Port,0x45,~0x03F,tempah); - - if(IF_DEF_HiVision==1) { - if(!(VBInfo&SetInSlaveMode)) { - SiSSetReg1(Part2Port,0x0B,0x00); - } - } - - if(VBInfo&SetCRT2ToTV){ - return; - } - tempah=0x01; - if(LCDResInfo==Panel1280x1024){ - if(ModeType==ModeEGA){ - if(VGAHDE>=1024){ - tempah=0x02; - } - } - } - SiSSetReg1(Part2Port,0x0B,tempah); - - tempbx=HDE-1; /* RHACTE=HDE-1 */ - tempah=tempbx&0xFF; - SiSSetReg1(Part2Port,0x2C,tempah); - tempah=(tempbx&0xFF00)>>8; - tempah=(tempah<<4)&0xFF; - SetRegANDOR(Part2Port,0x2B,~0x0F0,tempah); - - tempbx=VDE-1; /* RTVACTEO=(VDE-1)&0xFF */ - tempah=tempbx&0xFF; - SiSSetReg1(Part2Port,0x03,tempah); - tempah=((tempbx&0xFF00)>>8)&0x07; - SetRegANDOR(Part2Port,0x0C,~0x07,tempah); - - tempcx=VT-1; - tempah=tempcx&0xFF; /* RVTVT=VT-1 */ - SiSSetReg1(Part2Port,0x19,tempah); - tempah=(tempcx&0xFF00)>>8; - tempah=(tempah<<5)&0xFF; - if(LCDInfo&LCDRGB18Bit){ - tempah=tempah|0x10; - } - SiSSetReg1(Part2Port,0x1A,tempah); - - tempcx++; - if(LCDResInfo==Panel1024x768){ - tempbx=768; - }else{ - tempbx=1024; - } - - if(tempbx==VDE){ - tempax=1; - }else{ - tempax=tempbx; - tempax=(tempax-VDE)>>1; - } - tempcx=tempcx-tempax; /* lcdvdes */ - tempbx=tempbx-tempax; /* lcdvdee */ - - tempah=tempcx&0xFF; /* RVEQ1EQ=lcdvdes */ - SiSSetReg1(Part2Port,0x05,tempah); - tempah=tempbx&0xFF; /* RVEQ2EQ=lcdvdee */ - SiSSetReg1(Part2Port,0x06,tempah); - - tempah=(tempbx&0xFF00)>>8; - tempah=(tempah<<3)&0xFF; - tempah=tempah|((tempcx&0xFF00)>>8); - SiSSetReg1(Part2Port,0x02,tempah); - - tempcx=(VT-VDE)>>4; /* (VT-VDE)>>4 */ - tempbx=(VT+VDE)>>1; - tempah=tempbx&0xFF; /* RTVACTEE=lcdvrs */ - SiSSetReg1(Part2Port,0x04,tempah); - - tempah=(tempbx&0xFF00)>>8; - tempah=(tempah<<4)&0xFF; - tempbx=tempbx+tempcx+1; - tempbl=(tempbx&0x0F); - tempah=tempah|tempbl; /* RTVACTSO=lcdvrs&0x700>>4+lcdvre */ - SiSSetReg1(Part2Port,0x01,tempah); - - tempah=SiSGetReg1(Part2Port,0x09); - tempah=tempah&0xF0; - SiSSetReg1(Part2Port,0x09,tempah); - - tempah=SiSGetReg1(Part2Port,0x0A); - tempah=tempah&0xF0; - SiSSetReg1(Part2Port,0x0A,tempah); - - tempcx=(HT-HDE)>>2; /* (HT-HDE)>>2 */ - tempbx=(HDE+7); /* lcdhdee */ - tempah=tempbx&0xFF; /* RHEQPLE=lcdhdee */ - SiSSetReg1(Part2Port,0x23,tempah); - tempah=(tempbx&0xFF00)>>8; - SetRegANDOR(Part2Port,0x25,~0x0F,tempah); - - SiSSetReg1(Part2Port,0x1F,0x07); /* RHBLKE=lcdhdes */ - tempah=SiSGetReg1(Part2Port,0x20); - tempah=tempah&0x0F; - SiSSetReg1(Part2Port,0x20,tempah); - - tempbx=tempbx+tempcx; - tempah=tempbx&0xFF; /* RHBURSTS=lcdhrs */ - SiSSetReg1(Part2Port,0x1C,tempah); - tempah=(tempbx&0xFF00)>>8; - tempah=(tempah<<4)&0xFF; - SetRegANDOR(Part2Port,0x1D,~0x0F0,tempah); - - tempbx=tempbx+tempcx; - tempah=tempbx&0xFF; /* RHSYEXP2S=lcdhre */ - SiSSetReg1(Part2Port,0x21,tempah); - - tempah=SiSGetReg1(Part2Port,0x17); - tempah=tempah&0xFB; - SiSSetReg1(Part2Port,0x17,tempah); - - tempah=SiSGetReg1(Part2Port,0x18); - tempah=tempah&0xDF; - SiSSetReg1(Part2Port,0x18,tempah); - return; -} - -static void SetGroup3(UShort BaseAddr,ULong ROMAddr) -{ - UShort i; - UShort *tempdi; - UShort Part3Port; - UShort modeflag; - Part3Port=BaseAddr+IND_SIS_CRT2_PORT_12; -/* ynlai begin */ - SiSSetReg1(Part3Port,0x00,0x00); - if(VBInfo&SetPALTV){ - SiSSetReg1(Part3Port,0x13,0xFA); - SiSSetReg1(Part3Port,0x14,0xC8); - } - else { - SiSSetReg1(Part3Port,0x13,0xF6); - SiSSetReg1(Part3Port,0x14,0xBF); - } - if(IF_DEF_HiVision==1) { - tempdi=HiTVGroup3Data; - if(SetFlag&TVSimuMode) { - tempdi=HiTVGroup3Simu; - modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - if(!(modeflag&Charx8Dot)) { - tempdi=HiTVGroup3Text; - } - } - for(i=0;i<=0x3E;i++){ - SiSSetReg1(Part3Port,i,tempdi[i]); - } - } -/* ynlai end */ - return; -} - -static void SetGroup4(UShort BaseAddr,ULong ROMAddr,UShort ModeNo) -{ - UShort Part4Port; - UShort tempax,tempah,tempcx,tempbx,tempbh,tempch,tempmodeflag; - long int tempebx,tempeax,templong; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - - tempax=0x0c; - if(VBInfo&SetCRT2ToTV){ - if(VBInfo&SetInSlaveMode){ - if(!(SetFlag&TVSimuMode)){ - SetFlag=SetFlag|RPLLDIV2XO; - tempax=tempax|0x04000; - } - }else{ - SetFlag=SetFlag|RPLLDIV2XO; - tempax=tempax|0x04000; - } - } - - if(LCDResInfo!=Panel1024x768){ - tempax=tempax|0x08000; - } - tempah=(tempax&0xFF00)>>8; - SiSSetReg1(Part4Port,0x0C,tempah); - - tempah=RVBHCFACT; - SiSSetReg1(Part4Port,0x13,tempah); - - tempbx=RVBHCMAX; - tempah=tempbx&0xFF; - SiSSetReg1(Part4Port,0x14,tempah); - tempbh=(((tempbx&0xFF00)>>8)<<7)&0xFF; - - tempcx=VGAHT-1; - tempah=tempcx&0xFF; - SiSSetReg1(Part4Port,0x16,tempah); - tempch=(((tempcx&0xFF00)>>8)<<3)&0xFF; - tempbh=tempbh|tempch; - - tempcx=VGAVT-1; - if(!(VBInfo&SetCRT2ToTV)){ - tempcx=tempcx-5; - } - tempah=tempcx&0xFF; - SiSSetReg1(Part4Port,0x17,tempah); - tempbh=tempbh|((tempcx&0xFF00)>>8); - tempah=tempbh; - SiSSetReg1(Part4Port,0x15,tempah); - - tempcx=VBInfo; - tempbx=VGAHDE; - tempmodeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(tempmodeflag&HalfDCLK){ - tempbx=tempbx>>1; - } - -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - tempah=0xA0; - if(tempbx!=1024) { - tempah=0xC0; - if(tempbx!=1280) tempah=0; - } - } - else { - if(VBInfo&SetCRT2ToLCD){ - tempah=0; - if(tempbx>800){ - tempah=0x60; - } - }else{ - tempah=0x080; - } - } -/* ynlai end */ - if(LCDResInfo!=Panel1280x1024){ - tempah=tempah|0x0A; - } - - SetRegANDOR(Part4Port,0x0E,~0xEF,tempah); - - tempebx=VDE; - -/* ynlai begin */ - if(IF_DEF_HiVision==1) { - if(!(tempah&0xE0)) tempbx=tempbx>>1; - } -/* ynlai end */ - - tempcx=RVBHRS; - tempah=tempcx&0xFF; - SiSSetReg1(Part4Port,0x18,tempah); - - tempeax=VGAVDE; - tempcx=tempcx|0x04000; - tempeax=tempeax-tempebx; - if(tempeax<0){ - tempcx=tempcx^(0x04000); - tempeax=VGAVDE; - } - - templong=(tempeax*256*1024)/tempebx; - if(tempeax*256*1024-templong*tempebx>0){ - tempebx=templong+1; - }else{ - tempebx=templong; - } - - - tempah=tempebx&0xFF; - SiSSetReg1(Part4Port,0x1B,tempah); - tempah=(tempebx&0xFF00)>>8; - SiSSetReg1(Part4Port,0x1A,tempah); - tempebx=tempebx>>16; - tempah=tempebx&0xFF; - tempah=(tempah<<4)&0xFF; - tempah=tempah|((tempcx&0xFF00)>>8); - SiSSetReg1(Part4Port,0x19,tempah); - - SetCRT2VCLK(BaseAddr,ROMAddr,ModeNo); -} - -static void SetCRT2VCLK(UShort BaseAddr,ULong ROMAddr,UShort ModeNo) -{ - UShort vclk2ptr; - UShort tempah,temp1; - UShort Part4Port; - - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); - SiSSetReg1(Part4Port,0x0A,0x01); - tempah=*((UChar *)(ROMAddr+vclk2ptr+0x01)); /* di+1 */ - SiSSetReg1(Part4Port,0x0B,tempah); - tempah=*((UChar *)(ROMAddr+vclk2ptr+0x00)); /* di */ - SiSSetReg1(Part4Port,0x0A,tempah); - SiSSetReg1(Part4Port,0x12,0x00); - tempah=0x08; - if(VBInfo&SetCRT2ToRAMDAC){ - tempah=tempah|0x020; - } - temp1=SiSGetReg1(Part4Port,0x12); - tempah=tempah|temp1; - SiSSetReg1(Part4Port,0x12,tempah); -} - -static void SetGroup5(UShort BaseAddr,ULong ROMAddr) -{ - UShort Part5Port; - UShort Pindex,Pdata; - Part5Port=BaseAddr+IND_SIS_CRT2_PORT_14+2; - Pindex=Part5Port; - Pdata=Part5Port+1; - if(ModeType==ModeVGA){ - if(!(VBInfo&(SetInSlaveMode|LoadDACFlag|CRT2DisplayFlag))){ - EnableCRT2(); - LoadDAC2(ROMAddr,Part5Port); - } - } - return; -} - -static void EnableCRT2(void) -{ - UShort temp1; - temp1=SiSGetReg1(P3c4,0x1E); - temp1=temp1|0x20; - SiSSetReg1(P3c4,0x1E,temp1); /* SR 1E */ -} - -static void LoadDAC2(ULong ROMAddr,UShort Part5Port) -{ - UShort data,data2; - UShort time,i,j,k; - UShort m,n,o; - UShort si,di,bx,dl; - UShort al,ah,dh; - UShort *table=0; - UShort Pindex,Pdata; - Pindex=Part5Port; - Pdata=Part5Port+1; - data=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); - data=data&DACInfoFlag; - time=64; - if(data==0x00) table=MDA_DAC; - if(data==0x08) table=CGA_DAC; - if(data==0x10) table=EGA_DAC; - if(data==0x18) { - time=256; - table=VGA_DAC; - } - if(time==256) j=16; - else j=time; - - SetReg3(Pindex,0x00); - - for(i=0;i<j;i++) { - data=table[i]; - for(k=0;k<3;k++) { - data2=0; - if(data&0x01) data2=0x2A; - if(data&0x02) data2=data2+0x15; - SetReg3(Pdata,data2); - data=data>>2; - } - } - - if(time==256) { - for(i=16;i<32;i++) { - data=table[i]; - for(k=0;k<3;k++) SetReg3(Pdata,data); - } - si=32; - for(m=0;m<9;m++) { - di=si; - bx=si+0x04; - dl=0; - for(n=0;n<3;n++) { - for(o=0;o<5;o++) { - dh=table[si]; - ah=table[di]; - al=table[bx]; - si++; - WriteDAC2(Pdata,dl,ah,al,dh); - } /* for 5 */ - si=si-2; - for(o=0;o<3;o++) { - dh=table[bx]; - ah=table[di]; - al=table[si]; - si--; - WriteDAC2(Pdata,dl,ah,al,dh); - } /* for 3 */ - dl++; - } /* for 3 */ - si=si+5; - } /* for 9 */ - } -} - -static void WriteDAC2(UShort Pdata,UShort dl, UShort ah, UShort al, UShort dh) -{ - UShort temp; - UShort bh,bl; - - bh=ah; - bl=al; - if(dl!=0) { - temp=bh; - bh=dh; - dh=temp; - if(dl==1) { - temp=bl; - bl=dh; - dh=temp; - } - else { - temp=bl; - bl=bh; - bh=temp; - } - } - SetReg3(Pdata,(UShort)dh); - SetReg3(Pdata,(UShort)bh); - SetReg3(Pdata,(UShort)bl); -} - -void SiSLockCRT2(UShort BaseAddr) -{ - UShort Part1Port; - UShort Part4Port; - UShort temp1; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - temp1=SiSGetReg1(Part1Port,0x24); - temp1=temp1&0xFE; - SiSSetReg1(Part1Port,0x24,temp1); -} - -#if 0 -static void SetLockRegs(void) -{ - UShort temp1; - - if((VBInfo&SetInSlaveMode)&&(!(VBInfo&SetCRT2ToRAMDAC))){ - VBLongWait(); - temp1=SiSGetReg1(P3c4,0x32); - temp1=temp1|0x20; - SiSSetReg1(P3c4,0x32,temp1); - VBLongWait(); - } -} -#endif - -void SiSEnableBridge(UShort BaseAddr) -{ - UShort Part1Port; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - - if(IF_DEF_LVDS==0) { - SiSEnableBridge301(BaseAddr); - } else { - SiSEnableBridgeLVDS(BaseAddr); - - } -} - -void SiSEnableBridge301(UShort BaseAddr) -{ - UShort part2_02,part2_05; - UShort Part2Port, Part1Port; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - - part2_02=(UChar)SiSGetReg1(Part2Port,0x02); - part2_05=(UChar)SiSGetReg1(Part2Port,0x05); - SiSSetReg1(Part2Port,0x02,0x38); - SiSSetReg1(Part2Port,0x05,0xFF); - LongWait(); - SetRegANDOR(Part2Port,0x00,~0x0E0,0x020); - /* WaitVBRetrace(BaseAddr); */ - SiSSetReg1(Part2Port,0x02,part2_02); - SiSSetReg1(Part2Port,0x05,part2_05); - } - -/* TW: New for 301b (used externally only yet) */ -void SiSEnableBridge301B(UShort BaseAddr) -{ - UShort temp, tempah; - UShort Part4Port,Part2Port,Part1Port; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - - SetRegANDOR(P3c4,0x11,0xFB,0x00); - - SetRegANDOR(Part2Port,0x00,0x1F,0x20); - LongWait(); - - temp=SiSGetReg1(Part1Port,0x2E); - if (!(temp&0x80)) SetRegOR(Part1Port,0x2E,0x80); - if ((!(IsDualEdge301B(BaseAddr))) && (!(IsVAMode301B(BaseAddr)))) - tempah=0x80; - else if ((!(IsDualEdge301B(BaseAddr))) && (IsVAMode301B(BaseAddr))) - tempah=0x40; - else tempah=0xC0; - SetRegOR(Part4Port,0x1F,tempah); -} - -void SiSEnableBridgeLVDS(UShort BaseAddr) -{ - UShort Part2Port, Part1Port; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - - EnableCRT2(); - SiSUnLockCRT2(BaseAddr); - /* TW: new 10/2/01 */ - SetRegANDOR(Part1Port,0x02,~0x040,0x0); - if (BridgeInSlave ()) { - SetRegANDOR (Part1Port, 0x01, 0x1F, 0x00); - } else { - SetRegANDOR (Part1Port, 0x01, 0x1F, 0x40); - } - /* TW end */ -} - -static void GetVBInfo(UShort BaseAddr,ULong ROMAddr) -{ - UShort flag1,tempbx,tempbl,tempbh,tempah,temp; - - SetFlag=0; - tempbx=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - tempbl=tempbx&ModeInfoFlag; - ModeType=tempbl; - tempbx=0; - flag1=SiSGetReg1(P3c4,0x38); /* call BridgeisOn */ - if(IF_DEF_LVDS==0) { /* for 301 */ - if(!(flag1&0x20)){ - VBInfo=CRT2DisplayFlag; - return; - } - } - tempbl=SiSGetReg1(P3d4,0x30); - tempbh=SiSGetReg1(P3d4,0x31); - - tempah=((SetCHTVOverScan>>8)|(SetInSlaveMode>>8)|(DisableCRT2Display>>8)); - tempah=tempah^0xFF; - tempbh=tempbh&tempah; -/* ynlai begin */ - if(IF_DEF_LVDS==1){ /* for LVDS */ - if(IF_DEF_CH7005==1) temp=SetCRT2ToLCD|SetCRT2ToTV; - else temp=SetCRT2ToLCD; - } - else { - if(IF_DEF_HiVision==1) temp=0xFC; - else temp=0x7C; - } - if(!(tempbl&temp)) { - VBInfo=DisableCRT2Display; - return; - } -/* ynlai end */ - if(IF_DEF_LVDS==0) { - if(tempbl&SetCRT2ToRAMDAC){ - tempbl=tempbl&(SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode); - }else if(tempbl&SetCRT2ToLCD){ - tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); - }else if(tempbl&SetCRT2ToSCART){ - tempbl=tempbl&(SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode); - tempbh=tempbh|(SetPALTV>>8); - }else if(tempbl&SetCRT2ToHiVisionTV){ - tempbl=tempbl&(SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode); -/* ynlai begin */ - tempbh=tempbh|(SetPALTV>>8); -/* ynlai end */ - } - } - else { - if(IF_DEF_CH7005==1) { - if(tempbl&SetCRT2ToTV) - tempbl=tempbl&(SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode); - } - if(tempbl&SetCRT2ToLCD) - tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); - } - tempah=SiSGetReg1(P3d4,0x31); - if(tempah&(CRT2DisplayFlag>>8)){ - if(!(tempbl&(SwitchToCRT2|SetSimuScanMode))){ - tempbx=SetSimuScanMode|CRT2DisplayFlag; - tempbh=((tempbx&0xFF00)>>8); - tempbl=tempbx&0xFF; - } - } - if(!(tempbh&(DriverMode>>8))){ - tempbl=tempbl|SetSimuScanMode; - } - VBInfo=tempbl|(tempbh<<8); - if(!(VBInfo&SetSimuScanMode)){ - if(!(VBInfo&SwitchToCRT2)){ - if(BridgeIsEnable(BaseAddr)){ - if(BridgeInSlave()){ - VBInfo=VBInfo|SetSimuScanMode; - } - } - } - else { - flag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(!(flag1&CRT2Mode)) { - VBInfo=VBInfo|SetSimuScanMode; - } - } - } - if(!(VBInfo&DisableCRT2Display)) { - if(VBInfo&DriverMode) { - if(VBInfo&SetSimuScanMode) { - flag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(!(flag1&CRT2Mode)) { - VBInfo=VBInfo|SetInSlaveMode; - } - } - } - else { - VBInfo=VBInfo|SetSimuScanMode; - if(IF_DEF_LVDS==0) { - if(VBInfo&SetCRT2ToTV) { - if(!(VBInfo&SetNotSimuMode)) SetFlag=SetFlag|TVSimuMode; - } - } - } - } - if(IF_DEF_CH7005==1) { - tempah=SiSGetReg1(P3d4,0x35); - if(tempah&TVOverScan) VBInfo=VBInfo|SetCHTVOverScan; - } -} - -static Bool BridgeIsEnable(UShort BaseAddr) -{ - UShort flag1; - UShort Part1Port; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - - if(IF_DEF_LVDS==1){ - return 1; - } - flag1=SiSGetReg1(P3c4,0x38); /* call BridgeisOn */ - if(!(flag1&0x20)){ return 0;} - flag1=SiSGetReg1(Part1Port,0x0); - if(flag1&0x0a0){ - return 1; - }else{ - return 0; - } -} - -static Bool BridgeInSlave(void) -{ - UShort flag1; - flag1=SiSGetReg1(P3d4,0x31); - if(flag1&(SetInSlaveMode>>8)){ - return 1; - }else{ - return 0; - } -} - -static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4Reg) -{ - UShort tempah,tempbh,tempflag; - - tempah=(UChar)SiSGetReg1(P3d4Reg,0x36); - tempbh=tempah; - tempah=tempah&0x0F; -/* if(tempah!=0) tempah--; */ - if(tempah>Panel1280x1024) tempah=0; - LCDResInfo=tempah; - tempbh=tempbh>>4; - LCDTypeInfo=tempbh; - - tempah=(UChar)SiSGetReg1(P3d4Reg,0x37); - LCDInfo=tempah; - - if(IF_DEF_LVDS==1){ - tempflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(tempflag&HalfDCLK){ - if(IF_DEF_TRUMPION==0){ - if(!(LCDInfo&LCDNonExpanding)){ - if(LCDResInfo==Panel1024x768){ - tempflag=*((UChar *)(ROMAddr+ModeIDOffset+0x09));/*si+Ext_ResInfo*/ - if(tempflag==4){ /*512x384 */ - SetFlag=SetFlag|EnableLVDSDDA; - } - }else{ - if(LCDResInfo==Panel800x600){ - tempflag=*((UChar*)(ROMAddr+ModeIDOffset+0x09));/*si+Ext_ResInfo*/ - if(tempflag==3){ /*400x300 */ - SetFlag=SetFlag|EnableLVDSDDA; - } - } - } - }else{ - SetFlag=SetFlag|EnableLVDSDDA; - } - }else{ - SetFlag=SetFlag|EnableLVDSDDA; - } - } - } - - if(!(VBInfo&SetCRT2ToLCD)){ - return 1; - } - if(!(VBInfo&(SetSimuScanMode|SwitchToCRT2))){ - return 1; - } - if(VBInfo&SetInSlaveMode){ - if(VBInfo&SetNotSimuMode){ - SetFlag=SetFlag|LCDVESATiming; - } - }else{ - SetFlag=SetFlag|LCDVESATiming; - } - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SetFlag=0x%x, LCDTypeInfo=%d, LCDResInfo=%d, LCDInfo=0x%x\n", - SetFlag, LCDTypeInfo, LCDResInfo, LCDInfo)); - - return 1; -} - -static void PresetScratchregister(UShort P3d4Reg) -{ - SiSSetReg1(P3d4Reg,0x37,0x00); -} - -#if 0 -static Bool GetLCDDDCInfo(ScrnInfoPtr pScrn) -{ - UShort tempah; -/*tempah=(HwDeviceExtension->usLCDType);// set in sisv.c */ - tempah=1; - SiSSetReg1(P3d4,0x36,tempah); /* cr 36 0:no LCD 1:1024x768 2:1280x1024 */ - if(tempah>0) return 1; - else return 0; -} -#endif - -#if 0 -static void SetTVSystem(void) -{ - UShort tempah; - tempah=SiSGetReg1(P3c4,0x38); /* SR 38 */ - tempah=tempah&0x01; /* get SR 38 D0 TV Type Selection */ - /* 0:NTSC 1:PAL */ - SetRegANDOR(P3d4,0x31,~0x01,tempah); /* set CR 31 D0= SR 38 D0 */ -} -#endif - -static void LongWait(void) -{ - UShort i; - - i = SiSGetReg1(P3c4, 0x1F); - if (!(i & 0xC0)) { - - for(i=0; i<0xFFFF; i++) { - if(!(inSISREG(P3da) & 0x08)) - break; - } - for(i=0; i<0xFFFF; i++) { - if((inSISREG(P3da) & 0x08)) - break; - } - } -} - -#if 0 -static void VBLongWait(void) -{ - UShort regsr1f,tempah,temp; - - regsr1f=SiSGetReg1(P3c4,0x1F); - tempah=regsr1f&(~0xC0); - SiSSetReg1(P3c4,0x1F,tempah); - - for(temp=1;temp>0;){ - temp=GetReg2(P3da); - temp=temp&0x08; - } - for(;temp==0;){ - temp=GetReg2(P3da); - temp=temp&0x08; - } - - SiSSetReg1(P3c4,0x1F,regsr1f); - return; -} -#endif - -#if 0 -static Bool WaitVBRetrace(UShort BaseAddr) -{ - UShort temp; - UShort Part1Port; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - temp=SiSGetReg1(Part1Port,0x00); - if(!(temp&0x80)){ - return 0; - } - - for(temp=0;temp==0;){ - temp=SiSGetReg1(Part1Port,0x25); - temp=temp&0x01; - } - for(;temp>0;){ - temp=SiSGetReg1(Part1Port,0x25); - temp=temp&0x01; - } - return 1; -} -#endif - -static void ModCRT1CRTC(ULong ROMAddr,UShort ModeNo) -{ - UShort OldREFIndex,temp,tempah,i,modeflag1; - - OldREFIndex=(UShort)REFIndex; - temp=GetLVDSCRT1Ptr(ROMAddr,ModeNo); - if(temp==0){ - REFIndex=OldREFIndex; - return; - } - tempah=(UChar)SiSGetReg1(P3d4,0x11);/*unlock cr0-7 */ - tempah=tempah&0x7F; - SiSSetReg1(P3d4,0x11,tempah); - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data 0: %x\n", tempah)); - SiSSetReg1(P3d4,0x0,tempah); - REFIndex++; - for(i=0x02;i<=0x05;REFIndex++,i++){ - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); - SiSSetReg1(P3d4,i,tempah); - } - for(i=0x06;i<=0x07;REFIndex++,i++){ - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); - SiSSetReg1(P3d4,i,tempah); - } - for(i=0x10;i<=0x11;REFIndex++,i++){ - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); - SiSSetReg1(P3d4,i,tempah); - } - for(i=0x15;i<=0x16;REFIndex++,i++){ - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); - SiSSetReg1(P3d4,i,tempah); - } - - for(i=0x0A;i<=0x0C;REFIndex++,i++){ - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); - SiSSetReg1(P3c4,i,tempah); - } - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); - tempah=tempah&0x0E0; - SiSSetReg1(P3c4,0x0E,tempah); - - tempah=*((UChar *)(ROMAddr+REFIndex)); - tempah=tempah&0x01; - tempah=tempah<<5; - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&DoubleScanMode){ - tempah=tempah|0x080; - } - SetRegANDOR(P3d4,0x09,~0x020,tempah); - REFIndex=OldREFIndex; - return; -} - -static void SetCRT2ECLK(ULong ROMAddr, UShort ModeNo) -{ - UShort OldREFIndex,tempah,tempal; - UShort P3cc=P3c9+3; - - OldREFIndex=(UShort)REFIndex; - if(IF_DEF_TRUMPION==0){ /*no trumpion */ - tempal=GetReg2(P3cc); - tempal=tempal&0x0C; - REFIndex=GetVCLK2Ptr(ROMAddr,ModeNo); - }else{ /*trumpion */ - SetFlag=SetFlag&(~ProgrammingCRT2); - tempal=*((UChar *)(ROMAddr+REFIndex+0x03)); /*&di+Ext_CRTVCLK */ - tempal=tempal&0x03F; - if(tempal==0x02){ /*31.5MHz */ - REFIndex=REFIndex-Ext2StructSize; - } - REFIndex=GetVCLKPtr(ROMAddr,ModeNo); - SetFlag=SetFlag|ProgrammingCRT2; - } - tempal=0x02B; - if(!(VBInfo&SetInSlaveMode)){ - tempal=tempal+3; - } - SiSSetReg1(P3c4,0x05,0x86); - tempah=*((UChar *)(ROMAddr+REFIndex)); - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SetCRT2ECLK: Reg %x -> 0x%x\n", tempal, tempah)); - SiSSetReg1(P3c4,tempal,tempah); - tempah=*((UChar *)(ROMAddr+REFIndex+1)); - tempal++; - PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SetCRT2ECLK: Reg %x -> 0x%x\n", tempal, tempah)); - SiSSetReg1(P3c4,tempal,tempah); - tempal++; - SiSSetReg1(P3c4,tempal,0x80); - REFIndex=OldREFIndex; - return; -} - -static UShort GetLVDSDesPtr(ULong ROMAddr,UShort ModeNo) -{ - UShort tempcl,tempbx,tempal,tempptr,LVDSDesPtrData; - UShort Flag; - - Flag=1; - tempbx=0; - if(IF_DEF_CH7005==1) { - if(!(VBInfo&SetCRT2ToLCD)) { - Flag=0; - tempbx=32; - if(VBInfo&SetPALTV) tempbx=tempbx+2; - if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; - } - } - tempcl=LVDSDesDataLen; - if(Flag) { - tempbx=LCDTypeInfo; - if(LCDInfo&LCDNonExpanding){ - tempbx=tempbx+16; - } - } - if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - else tempal=*((UChar *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ - tempal=tempal&0x1F; - tempal=tempal*tempcl; - tempbx=tempbx<<1; - LVDSDesPtrData=*((UShort *)(ROMAddr+ADR_LVDSDesPtrData)); - tempptr=*((UShort *)(ROMAddr+LVDSDesPtrData+tempbx)); - tempptr=tempptr+tempal; - return(tempptr); - -} - -static Bool GetLVDSCRT1Ptr(ULong ROMAddr,UShort ModeNo) -{ - UShort tempal,tempbx,modeflag1; - UShort LVDSCRT1DataPtr,Flag; - - if(!(VBInfo&SetInSlaveMode)){ -/* return 0; */ - } - Flag=1; - tempbx=0; - if(IF_DEF_CH7005==1) { - if(!(VBInfo&SetCRT2ToLCD)) { - Flag=0; - tempbx=12; - if(VBInfo&SetPALTV) tempbx=tempbx+2; - if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; - } - } - if(Flag) { - tempbx=LCDResInfo; - tempbx=tempbx-Panel800x600; - if(LCDInfo&LCDNonExpanding) tempbx=tempbx+6; - modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&HalfDCLK) tempbx=tempbx+3; - } - if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - else tempal=*((UChar *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ - tempal=tempal&0x3F; - - tempbx=tempbx<<1; - LVDSCRT1DataPtr=*((UShort *)(ROMAddr+ADR_LVDSCRT1DataPtr)); - REFIndex=*((UShort *)(ROMAddr+LVDSCRT1DataPtr+tempbx)); - tempal=tempal*LVDSCRT1Len; - REFIndex=REFIndex+tempal; - return 1; - -} - -static void SetCHTVReg(ULong ROMAddr,UShort ModeNo) -{ - UShort old_REFIndex,temp,tempbx,tempcl; - - old_REFIndex=(UShort)REFIndex; /*push di */ - GetCHTVRegPtr(ROMAddr,ModeNo); - - if(VBInfo&SetPALTV) { - SiSSetCH7005(0x4304); - SiSSetCH7005(0x6909); - } - else { - SiSSetCH7005(0x0304); - SiSSetCH7005(0x7109); - } - - temp=*((UShort *)(ROMAddr+REFIndex+0x00)); - tempbx=((temp&0x00FF)<<8)|0x00; - SiSSetCH7005(tempbx); - temp=*((UShort *)(ROMAddr+REFIndex+0x01)); - tempbx=((temp&0x00FF)<<8)|0x07; - SiSSetCH7005(tempbx); - temp=*((UShort *)(ROMAddr+REFIndex+0x02)); - tempbx=((temp&0x00FF)<<8)|0x08; - SiSSetCH7005(tempbx); - temp=*((UShort *)(ROMAddr+REFIndex+0x03)); - tempbx=((temp&0x00FF)<<8)|0x0A; - SiSSetCH7005(tempbx); - temp=*((UShort *)(ROMAddr+REFIndex+0x04)); - tempbx=((temp&0x00FF)<<8)|0x0B; - SiSSetCH7005(tempbx); - - SiSSetCH7005(0x2801); - SiSSetCH7005(0x3103); - SiSSetCH7005(0x003D); - SetCHTVRegANDOR(0x0010,0x1F); - SetCHTVRegANDOR(0x0211,0xF8); - SetCHTVRegANDOR(0x001C,0xEF); - - if(!(VBInfo&SetPALTV)) { - if(ModeNo<=0x13) tempcl=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - else tempcl=*((UChar *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ - tempcl=tempcl&0x3F; - if(VBInfo&SetCHTVOverScan) { - if(tempcl==0x04) { /* 640x480 underscan */ - SetCHTVRegANDOR(0x0020,0xEF); - SetCHTVRegANDOR(0x0121,0xFE); - } - else { - if(tempcl==0x05) { /* 800x600 underscan */ - SetCHTVRegANDOR(0x0118,0xF0); - SetCHTVRegANDOR(0x0C19,0xF0); - SetCHTVRegANDOR(0x001A,0xF0); - SetCHTVRegANDOR(0x001B,0xF0); - SetCHTVRegANDOR(0x001C,0xF0); - SetCHTVRegANDOR(0x001D,0xF0); - SetCHTVRegANDOR(0x001E,0xF0); - SetCHTVRegANDOR(0x001F,0xF0); - SetCHTVRegANDOR(0x0120,0xEF); - SetCHTVRegANDOR(0x0021,0xFE); - } - } - } - else { - if(tempcl==0x04) { /* 640x480 overscan */ - SetCHTVRegANDOR(0x0020,0xEF); - SetCHTVRegANDOR(0x0121,0xFE); - } - else { - if(tempcl==0x05) { /* 800x600 overscan */ - SetCHTVRegANDOR(0x0118,0xF0); - SetCHTVRegANDOR(0x0F19,0xF0); - SetCHTVRegANDOR(0x011A,0xF0); - SetCHTVRegANDOR(0x0C1B,0xF0); - SetCHTVRegANDOR(0x071C,0xF0); - SetCHTVRegANDOR(0x011D,0xF0); - SetCHTVRegANDOR(0x0C1E,0xF0); - SetCHTVRegANDOR(0x071F,0xF0); - SetCHTVRegANDOR(0x0120,0xEF); - SetCHTVRegANDOR(0x0021,0xFE); - } - } - } - } - - REFIndex=old_REFIndex; -} - -static void SetCHTVRegANDOR(UShort tempax,UShort tempbh) -{ - UShort tempal,tempah,tempbl; - - tempal=tempax&0x00FF; - tempah=(tempax>>8)&0x00FF; - tempbl=SiSGetCH7005(tempal); - tempbl=(((tempbl&tempbh)|tempah)<<8|tempal); - SiSSetCH7005(tempbl); -} - -static void GetCHTVRegPtr(ULong ROMAddr,UShort ModeNo) -{ - UShort tempbx,tempal,tempcl,CHTVRegDataPtr; - - if(VBInfo&SetCRT2ToTV) { - tempbx=0; - if(VBInfo&SetPALTV) tempbx=tempbx+2; - if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; - - if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ - else tempal=*((UChar *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ - tempal=tempal&0x3F; - - tempcl=CHTVRegDataLen; - tempal=tempal*tempcl; - tempbx=tempbx<<1; - - CHTVRegDataPtr=*((UShort *)(ROMAddr+ADR_CHTVRegDataPtr)); - REFIndex=*((UShort *)(ROMAddr+CHTVRegDataPtr+tempbx)); - REFIndex=REFIndex+tempal; - } -} - -void SiSSetCH7005(UShort tempbx) -{ - UShort tempah,temp; - - DDC_Port=0x3c4; - DDC_Index=0x11; - DDC_DataShift=0x00; - DDC_DeviceAddr=0xEA; - - SetSwitchDDC2(); - SetStart(); - tempah=DDC_DeviceAddr; - temp=WriteDDC2Data(tempah); - tempah=tempbx&0x00FF; - temp=WriteDDC2Data(tempah); - tempah=(tempbx&0xFF00)>>8; - temp=WriteDDC2Data(tempah); - SetStop(); -} - -UShort SiSGetCH7005(UShort tempbx) -{ - UShort tempah; - - DDC_Port=0x3c4; - DDC_Index=0x11; - DDC_DataShift=0x00; - DDC_DeviceAddr=0xEA; - DDC_ReadAddr=tempbx; - - SetSwitchDDC2(); - SetStart(); - tempah=DDC_DeviceAddr; - WriteDDC2Data(tempah); - tempah=DDC_ReadAddr; - WriteDDC2Data(tempah); - - SetStart(); - tempah=DDC_DeviceAddr; - tempah=tempah|0x01; - if(WriteDDC2Data(tempah)) { - } - tempah=ReadDDC2Data(tempah); - SetStop(); - return(tempah); -} - -static void SetSwitchDDC2(void) -{ - UShort i; - - SetSCLKHigh(); - for(i=0;i<1000;i++) { - SiSGetReg1(DDC_Port,0x05); - } - SetSCLKLow(); - for(i=0;i<1000;i++) { - SiSGetReg1(DDC_Port,0x05); - } -} - - -static void SetStart(void) -{ - SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ - SetSCLKHigh(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ - SetSCLKHigh(); -} - -static void SetStop(void) -{ - SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ - SetSCLKHigh(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ - SetSCLKHigh(); -} - -static UShort WriteDDC2Data(UShort tempax) -{ - UShort i,flag; - - flag=0x80; - for(i=0;i<8;i++) { - SetSCLKLow(); - if(tempax&flag) { - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); - } - else { - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); - } - SetSCLKHigh(); - flag=flag>>1; - } - return(CheckACK()); -} - -static UShort ReadDDC2Data(UShort tempax) -{ - UShort i,temp,getdata; - - getdata=0; - for(i=0;i<8;i++) { - getdata=getdata<<1; - SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); - SetSCLKHigh(); - temp=SiSGetReg1(DDC_Port,DDC_Index); - if(temp&0x02) getdata=getdata|0x01; - } - return(getdata); -} - -static void SetSCLKLow(void) -{ - SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x00); /* SetSCLKLow() */ - DDC2Delay(); -} - - -static void SetSCLKHigh(void) -{ - UShort temp; - - SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x01); /* SetSCLKLow() */ - do { - temp=SiSGetReg1(DDC_Port,DDC_Index); - } while(!(temp&0x01)); - DDC2Delay(); -} - -static void DDC2Delay(void) -{ - UShort i; - - for(i=0;i<DDC2DelayTime;i++) { - SiSGetReg1(P3c4,0x05); - } -} - -static UShort CheckACK(void) -{ - UShort tempah; - - SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); - SetSCLKHigh(); - tempah=SiSGetReg1(DDC_Port,DDC_Index); - SetSCLKLow(); - if(tempah&0x01) return(1); - else return(0); -} - -unsigned char SiSGetSetModeID(ScrnInfoPtr pScrn, unsigned char id) -{ - unsigned char ret; - - unsigned char* base = xf86MapVidMem(pScrn->scrnIndex, - VIDMEM_MMIO, 0, 0x2000); - ret = *(base + MODEID_OFF); - - /* id != 0xff means: set mode */ - if (id != 0xff) - *(base + MODEID_OFF) = id; - xf86UnMapVidMem(pScrn->scrnIndex,base,0x2000); - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:1.8 Thu Jan 17 04:57:29 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h Thu Feb 27 12:31:38 2003 @@ -1,218 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h,v 1.8 2002/01/17 09:57:29 eich Exp $ */ - -typedef unsigned long ULong; -typedef unsigned short UShort; -typedef unsigned char UChar; - -#define Bool Bool - -#define CRT1Len 17 -#define LVDSCRT1Len 15 -#define CHTVRegDataLen 5 - -#define ModeInfoFlag 0x07 -#define IsTextMode 0x07 -#define ModeText 0x00 -#define ModeCGA 0x01 -#define ModeEGA 0x02 -#define ModeVGA 0x03 -#define Mode15Bpp 0x04 -#define Mode16Bpp 0x05 -#define Mode24Bpp 0x06 -#define Mode32Bpp 0x07 - -#define DACInfoFlag 0x18 -#define MemoryInfoFlag 0x1E0 -#define MemorySizeShift 0x05 - -#define Charx8Dot 0x0200 -#define LineCompareOff 0x0400 -#define CRT2Mode 0x0800 -#define HalfDCLK 0x1000 -#define NoSupportSimuTV 0x2000 -#define DoubleScanMode 0x8000 - -#define SupportAllCRT2 0x0078 -#define SupportTV 0x0008 -#define SupportHiVisionTV 0x0010 -#define SupportLCD 0x0020 -#define SupportRAMDAC2 0x0040 -#define NoSupportTV 0x0070 -#define NoSupportHiVisionTV 0x0060 -#define NoSupportLCD 0x0058 -#define SupportCHTV 0x0800 -#define InterlaceMode 0x0080 -#define SyncPP 0x0000 -#define SyncPN 0x4000 -#define SyncNP 0x8000 -#define SyncNN 0xc000 -#define ECLKindex0 0x0000 -#define ECLKindex1 0x0100 -#define ECLKindex2 0x0200 -#define ECLKindex3 0x0300 -#define ECLKindex4 0x0400 - -#define SetSimuScanMode 0x0001 /* CR 30 */ -#define SwitchToCRT2 0x0002 -#define SetCRT2ToTV 0x009C -#define SetCRT2ToAVIDEO 0x0004 -#define SetCRT2ToSVIDEO 0x0008 -#define SetCRT2ToSCART 0x0010 -#define SetCRT2ToLCD 0x0020 -#define SetCRT2ToRAMDAC 0x0040 -#define SetCRT2ToHiVisionTV 0x0080 -#define SetNTSCTV 0x0000 /* CR 31 */ -#define SetPALTV 0x0100 -#define SetInSlaveMode 0x0200 -#define SetNotSimuMode 0x0400 -#define SetDispDevSwitch 0x0800 -#define LoadDACFlag 0x1000 -#define DisableCRT2Display 0x2000 -#define DriverMode 0x4000 -#define HotKeySwitch 0x8000 -#define SetCHTVOverScan 0x8000 - -#define TVOverScan 0x10 -#define TVOverScanShift 4 -#define ClearBufferFlag 0x20 - -#define SetSCARTOutput 0x01 -#define BoardTVType 0x02 - -#define ProgrammingCRT2 0x01 -#define TVSimuMode 0x02 -#define RPLLDIV2XO 0x04 -#define LCDVESATiming 0x08 -#define EnableLVDSDDA 0x10 -#define SetDispDevSwitchFlag 0x20 -#define CheckWinDos 0x40 -#define SetJDOSMode 0x80 - -#define Panel800x600 0x01 -#define Panel1024x768 0x02 -#define Panel1280x1024 0x03 -#define Panel1280x960 0x04 -#define Panel640x480 0x05 -#define LCDRGB18Bit 0x01 -#define ExtChipType 0x0e -#define ExtChip301 0x02 -#define ExtChipLVDS 0x04 -#define ExtChipTrumpion 0x06 -#define ExtChipCH7005 0x08 -#define ExtChipMitacTV 0x0a -#define LCDNonExpanding 0x10 -#define LCDNonExpandingShift 4 -#define LCDSync 0x20 -#define LCDSyncBit 0xe0 -#define LCDSyncshift 6 - -#define DDC2DelayTime 10 - -#define CRT2DisplayFlag 0x2000 -#define LCDDataLen 8 -#define HiTVDataLen 12 -#define TVDataLen 16 -#define SetPALTV 0x0100 -#define HalfDCLK 0x1000 -#define NTSCHT 1716 -#define NTSCVT 525 -#define PALHT 1728 -#define PALVT 625 -#define StHiTVHT 892 -#define StHiTVVT 1126 -#define StHiTextTVHT 1000 -#define StHiTextTVVT 1126 -#define ExtHiTVHT 2100 -#define ExtHiTVVT 1125 - -#define SelectCRT2Rate 0x4 -#define VCLKStartFreq 25 -#define SoftDramType 0x80 -#define VCLK40 0x04 -#define VCLK65 0x09 -#define VCLK108_2 0x14 -#define LCDRGB18Bit 0x01 -#define LoadDACFlag 0x1000 -#define AfterLockCRT2 0x4000 -#define SetCRT2ToAVIDEO 0x0004 -#define SetCRT2ToSCART 0x0010 -#define Ext2StructSize 5 -#define TVVCLKDIV2 0x021 -#define TVVCLK 0x022 -#define HiTVVCLKDIV2 0x023 -#define HiTVVCLK 0x024 -#define HiTVSimuVCLK 0x025 -#define HiTVTextVCLK 0x026 -#define SwitchToCRT2 0x0002 -#define LCDVESATiming 0x08 -#define SetSCARTOutput 0x01 -#define SCARTSense 0x04 -#define Monitor1Sense 0x20 -#define Monitor2Sense 0x10 -#define SVIDEOSense 0x02 -#define AVIDEOSense 0x01 -#define LCDSense 0x08 -#define BoardTVType 0x02 -#define HotPlugFunction 0x08 -#define StStructSize 0x06 - -#define IND_SIS_CRT2_PORT_04 0x04 - 0x030 -#define IND_SIS_CRT2_PORT_10 0x10 - 0x30 -#define IND_SIS_CRT2_PORT_12 0x12 - 0x30 -#define IND_SIS_CRT2_PORT_14 0x14 - 0x30 - -#define IF_DEF_TRUMPION 0 -#define LCDNonExpanding 0x10 -#define ADR_CRT2PtrData 0x20E -#define offset_Zurac 0x210 -#define ADR_LVDSDesPtrData 0x212 -#define ADR_LVDSCRT1DataPtr 0x214 -#define ADR_CHTVVCLKPtr 0x216 -#define ADR_CHTVRegDataPtr 0x218 - -#define LVDSDataLen 6 -#define EnableLVDSDDA 0x10 -#define LVDSDesDataLen 3 -#define ActiveNonExpanding 0x40 -#define ActiveNonExpandingShift 6 -#define ModeSwitchStatus 0x0F -#define SoftTVType 0x40 - -#define SelectCRT1Rate 0x4 -#define SelectCRT2Rate 0x4 - -#define PanelType00 0x00 -#define PanelType01 0x08 -#define PanelType02 0x10 -#define PanelType03 0x18 -#define PanelType04 0x20 -#define PanelType05 0x28 -#define PanelType06 0x30 -#define PanelType07 0x38 -#define PanelType08 0x40 -#define PanelType09 0x48 -#define PanelType0A 0x50 -#define PanelType0B 0x58 -#define PanelType0C 0x60 -#define PanelType0D 0x68 -#define PanelType0E 0x70 -#define PanelType0F 0x78 - -Bool SiSBIOSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); -void SiSRegInit(UShort BaseAddr); -UShort SiSCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); -void SiSSetReg1(UShort port, UShort index, UShort data); -UShort SiSGetReg1(UShort port, UShort index); -void SiSDisableBridge(UShort BaseAddr); -void SiSDisableBridgeLVDS(UShort BaseAddr); -void SiSDisableBridge301(UShort BaseAddr); -void SiSDisableBridge301B(UShort BaseAddr); -void SiSUnLockCRT2(UShort BaseAddr); -void SiSLockCRT2(UShort BaseAddr); -void SiSEnableBridge(UShort BaseAddr); -void SiSEnableBridgeLVDS(UShort BaseAddr); -void SiSEnableBridge301(UShort BaseAddr); -void SiSEnableBridge301B(UShort BaseAddr); -void SiSSetCH7005(UShort tempbx); -UShort SiSGetCH7005(UShort tempbx); -unsigned char SiSGetSetModeID(ScrnInfoPtr pScrn, unsigned char id); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.6 Fri Sep 28 03:47:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c Thu Jan 30 16:43:33 2003 @@ -1,31 +1,33 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.10 2003/01/30 21:43:33 tsi Exp $ */ /* * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holders not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Thomas Winischhofer <thomas@winischhofer.net>: */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.6 2001/09/28 07:47:22 alanh Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -33,20 +35,34 @@ #include "vgaHW.h" #include "sis.h" +#include "sis_regs.h" #include "sis_cursor.h" +#if 0 +#define SIS300_USE_ARGB16 +#endif -Bool SiSHWCursorInit(ScreenPtr pScreen); +extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); +extern void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); static void SiSShowCursor(ScrnInfoPtr pScrn) { - unsigned char temp; + SISPtr pSiS = SISPTR(pScrn); + unsigned char sridx, cridx; - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock Registers */ - outb(VGA_SEQ_INDEX, 0x06); - temp = inb(VGA_SEQ_DATA) | 0x40; - outb(VGA_SEQ_DATA, temp); + /* TW: Backup current indices of SR and CR since we run async:ly + * and might be interrupting an on-going register read/write + */ + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + orSISIDXREG(SISSR, 0x06, 0x40); + + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); } static void @@ -54,43 +70,189 @@ { SISPtr pSiS = SISPTR(pScrn); - sis300EnableHWCursor() - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor(); +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis300EnableHWARGB16Cursor() +#else + sis300EnableHWARGBCursor() +#endif + } else { + sis300EnableHWCursor() + } + } else { + /* TW: Head 1 is always CRT2 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis301EnableHWARGB16Cursor() +#else + sis301EnableHWARGBCursor() +#endif + } else { + sis301EnableHWCursor() + } + } + } else { +#endif + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis300EnableHWARGB16Cursor() +#else + sis300EnableHWARGBCursor() +#endif + if(pSiS->VBFlags & CRT2_ENABLE) { +#ifdef SIS300_USE_ARGB16 + sis301EnableHWARGB16Cursor() +#else + sis301EnableHWARGBCursor() +#endif + } + } else { + sis300EnableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor() + } + } +#ifdef SISDUALHEAD } +#endif } +/* TW: 310/325 series */ static void +SiS310ShowCursor(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + } else { + sis310EnableHWCursor() + } + } else { + /* TW: Head 1 is always CRT2 */ + if(pSiS->UseHWARGBCursor) { + sis301EnableHWARGBCursor310() + } else { + sis301EnableHWCursor310() + } + } + } else { +#endif + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWARGBCursor310() + } + } else { + sis310EnableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor310() + } + } +#ifdef SISDUALHEAD + } +#endif +} + +static void SiSHideCursor(ScrnInfoPtr pScrn) { - unsigned char temp; + SISPtr pSiS = SISPTR(pScrn); + unsigned char sridx, cridx; + + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + andSISIDXREG(SISSR, 0x06, 0xBF); - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock Registers */ - outb(VGA_SEQ_INDEX, 0x06); - temp = inb(VGA_SEQ_DATA) & 0xBF; - outb(VGA_SEQ_DATA, temp); + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); } static void SiS300HideCursor(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + } else { + /* TW: Head 1 is always CRT2 */ + sis301DisableHWCursor() + sis301SetCursorPositionY(2000, 0) + } + } else { +#endif + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301DisableHWCursor() + sis301SetCursorPositionY(2000, 0) + } +#ifdef SISDUALHEAD + } +#endif +} - sis300DisableHWCursor() - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301DisableHWCursor() +/* TW: 310/325 series */ +static void +SiS310HideCursor(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + } else { + /* TW: Head 1 is always CRT2 */ + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } + } else { +#endif + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } +#ifdef SISDUALHEAD } +#endif } static void SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { - unsigned char x_preset = 0; - unsigned char y_preset = 0; - int temp; + SISPtr pSiS = SISPTR(pScrn); + unsigned char x_preset = 0; + unsigned char y_preset = 0; + int temp; + unsigned char sridx, cridx; + + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock Registers */ - if (x < 0) { x_preset = (-x); x = 0; @@ -106,25 +268,74 @@ y /= 2; else if (pScrn->currentMode->Flags & V_DBLSCAN) y *= 2; + + outSISIDXREG(SISSR, 0x1A, x & 0xff); + outSISIDXREG(SISSR, 0x1B, (x & 0xff00) >> 8); + outSISIDXREG(SISSR, 0x1D, y & 0xff); + + inSISIDXREG(SISSR, 0x1E, temp); + temp &= 0xF8; + outSISIDXREG(SISSR, 0x1E, temp | ((y >> 8) & 0x07)); - outw(VGA_SEQ_INDEX, (x&0xFF)<<8 | 0x1A); - outw(VGA_SEQ_INDEX, (x&0xFF00) | 0x1B); - outw(VGA_SEQ_INDEX, (y&0xFF)<<8 | 0x1D); - outb(VGA_SEQ_INDEX, 0x1E); - temp = inb(VGA_SEQ_DATA) & 0xF8; - outw(VGA_SEQ_INDEX, ((y&0x0700) | (temp<<8)) | 0x1E); - outw(VGA_SEQ_INDEX, x_preset<<8 | 0x1C); - outw(VGA_SEQ_INDEX, y_preset<<8 | 0x1F); + outSISIDXREG(SISSR, 0x1C, x_preset); + outSISIDXREG(SISSR, 0x1F, y_preset); + + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); } static void SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); + unsigned char x_preset = 0; + unsigned char y_preset = 0; + + if (x < 0) { + x_preset = (-x); + x = 0; + } + if (y < 0) { + y_preset = (-y); + y = 0; + } + + /* are we in interlaced/doublescan mode? */ + if(pScrn->currentMode->Flags & V_INTERLACE) + y /= 2; + else if(pScrn->currentMode->Flags & V_DBLSCAN) + y *= 2; - unsigned char x_preset = 0; - unsigned char y_preset = 0; +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + if (pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + } else { + /* TW: Head 1 is always CRT2 */ + sis301SetCursorPositionX(x+13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } + } else { +#endif + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorPositionX(x+13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } +#ifdef SISDUALHEAD + } +#endif +} +static void +SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char x_preset = 0; + unsigned char y_preset = 0; + if (x < 0) { x_preset = (-x); x = 0; @@ -135,26 +346,48 @@ } /* are we in interlaced/doublescan mode? */ - if (pScrn->currentMode->Flags & V_INTERLACE) + if(pScrn->currentMode->Flags & V_INTERLACE) y /= 2; - else if (pScrn->currentMode->Flags & V_DBLSCAN) + else if(pScrn->currentMode->Flags & V_DBLSCAN) y *= 2; - sis300SetCursorPositionX(x, x_preset) - sis300SetCursorPositionY(y, y_preset) - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorPositionX(x+13, x_preset) - sis301SetCursorPositionY(y, y_preset) +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + if (pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis310SetCursorPositionX(x, x_preset) + sis310SetCursorPositionY(y, y_preset) + } else { + /* TW: Head 1 is always CRT2 */ + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) + } + } else { +#endif + sis310SetCursorPositionX(x, x_preset) + sis310SetCursorPositionY(y, y_preset) + if (pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) + } +#ifdef SISDUALHEAD } +#endif } static void SiSSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { + SISPtr pSiS = SISPTR(pScrn); unsigned char f_red, f_green, f_blue; unsigned char b_red, b_green, b_blue; + unsigned char sridx, cridx; + + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); - outw(VGA_SEQ_INDEX, 0x8605); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif f_red = (fg & 0x00FF0000) >> (16+2); f_green = (fg & 0x0000FF00) >> (8+2); @@ -163,12 +396,14 @@ b_green = (bg & 0x0000FF00) >> (8+2); b_blue = (bg & 0x000000FF) >> 2; - outw(VGA_SEQ_INDEX, b_red <<8 | 0x14); - outw(VGA_SEQ_INDEX, b_green <<8 | 0x15); - outw(VGA_SEQ_INDEX, b_blue <<8 | 0x16); - outw(VGA_SEQ_INDEX, f_red <<8 | 0x17); - outw(VGA_SEQ_INDEX, f_green <<8 | 0x18); - outw(VGA_SEQ_INDEX, f_blue <<8 | 0x19); + outSISIDXREG(SISSR, 0x14, b_red); + outSISIDXREG(SISSR, 0x15, b_green); + outSISIDXREG(SISSR, 0x16, b_blue); + outSISIDXREG(SISSR, 0x17, f_red); + outSISIDXREG(SISSR, 0x18, f_green); + outSISIDXREG(SISSR, 0x19, f_blue); + + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); } static void @@ -176,47 +411,107 @@ { SISPtr pSiS = SISPTR(pScrn); - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + } else { + /* TW: Head 1 is always CRT2 */ + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } + } else { +#endif + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } +#ifdef SISDUALHEAD } +#endif } static void -SiSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { SISPtr pSiS = SISPTR(pScrn); - int cursor_addr; - unsigned char temp; - outw(VGA_SEQ_INDEX, 0x8605); +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) + } else { + /* TW: Head 1 is always CRT2 */ + sis301SetCursorBGColor310(bg) + sis301SetCursorFGColor310(fg) + } + } else { +#endif + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorBGColor310(bg) + sis301SetCursorFGColor310(fg) + } +#ifdef SISDUALHEAD + } +#endif +} +static void +SiSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +{ + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr; + unsigned char temp; + unsigned char sridx, cridx; + + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + cursor_addr = pScrn->videoRam - 1; - memcpy((unsigned char *)pSiS->FbBase + cursor_addr * 1024, src, 1024); + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + int i; + for(i = 0; i < 32; i++) { + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i), + src + (16 * i), 16); + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i) + 16, + src + (16 * i), 16); + } + } else { + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024), src, 1024); + } /* copy bits [21:18] into the top bits of SR38 */ - outb(VGA_SEQ_INDEX, 0x38); - temp = inb(VGA_SEQ_DATA) & 0x0F; - outb(VGA_SEQ_DATA, temp | ((cursor_addr & 0xF00) >> 4)); - - /* if set, store the bit [22] to SR3E */ - if (cursor_addr & 0x1000) { - outb(VGA_SEQ_INDEX, 0x3E); - temp = inb(VGA_SEQ_DATA) | 0x04; - outb(VGA_SEQ_DATA, temp); + inSISIDXREG(SISSR, 0x38, temp); + temp &= 0x0F; + outSISIDXREG(SISSR, 0x38, temp | ((cursor_addr & 0xF00) >> 4)); + + if(pSiS->Chipset == PCI_CHIP_SIS530) { + /* store the bit [22] to SR3E */ + if(cursor_addr & 0x1000) { + orSISIDXREG(SISSR, 0x3E, 0x04); + } else { + andSISIDXREG(SISSR, 0x3E, ~0x04); + } } /* set HW cursor pattern, use pattern 0xF */ - outb(VGA_SEQ_INDEX, 0x1E); - temp = inb(VGA_SEQ_DATA) | 0xF0; - outb(VGA_SEQ_DATA, temp); + orSISIDXREG(SISSR, 0x1E, 0xF0); /* disable the hardware cursor side pattern */ - outb(VGA_SEQ_INDEX, 0x1E); - temp = inb(VGA_SEQ_DATA) & 0xF7; - outb(VGA_SEQ_DATA, temp); + andSISIDXREG(SISSR, 0x1E, 0xF7); + + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); } static void @@ -224,44 +519,493 @@ { SISPtr pSiS = SISPTR(pScrn); int cursor_addr; - - if (pSiS->TurboQueue) - cursor_addr = pScrn->videoRam-512-1; /* 1K boundary */ - else - cursor_addr = pScrn->videoRam - 1; /* 1K boundary */ + CARD32 status1 = 0, status2 = 0; - memcpy((unsigned char *)pSiS->FbBase + cursor_addr * 1024, src, 1024); - sis300SetCursorAddress(cursor_addr) - sis300SetCursorPatternSelect(0) - if (pSiS->VBFlags & CRT2_ENABLE) { +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */ + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + /* TW: Use the global (real) FbBase in DHM */ + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + int i; + for(i = 0; i < 32; i++) { + memcpy((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024) + (32 * i), + src + (16 * i), 16); + memcpy((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024) + (32 * i) + 16, + src + (16 * i), 16); + } + } else { + memcpy((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024), src, 1024); + } + } else +#endif + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + int i; + for(i = 0; i < 32; i++) { + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i), + src + (16 * i), 16); + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i) + 16, + src + (16 * i), 16); + } + } else { + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024), src, 1024); + } + + if(pSiS->UseHWARGBCursor) { + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis300GetCursorStatus; + sis300DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + } + SISWaitRetraceCRT1(pScrn); + sis300SwitchToMONOCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } + } + } + sis300SetCursorAddress(cursor_addr); + sis300SetCursorPatternSelect(0); + if(status1) sis300SetCursorStatus(status1) + + if(pSiS->VBFlags & CRT2_ENABLE) { + if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } sis301SetCursorAddress(cursor_addr) sis301SetCursorPatternSelect(0) + if(status2) sis301SetCursorStatus(status2) } + + pSiS->UseHWARGBCursor = FALSE; } +static void +SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +{ + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr; + CARD32 status1 = 0, status2 = 0; + +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */ + +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + /* TW: Use the global (real) FbBase in DHM */ + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + int i; + for(i = 0; i < 32; i++) { + memcpy((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024) + (32 * i), + src + (16 * i), 16); + memcpy((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024) + (32 * i) + 16, + src + (16 * i), 16); + } + } else { + memcpy((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024), src, 1024); + } + } else +#endif + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + int i; + for(i = 0; i < 32; i++) { + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i), + src + (16 * i), 16); + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i) + 16, + src + (16 * i), 16); + } + } else { + memcpy((unsigned char *)pSiS->FbBase + (cursor_addr * 1024), src, 1024); + } + + if(pSiS->UseHWARGBCursor) { + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis310GetCursorStatus; + sis310DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus310; + sis301DisableHWCursor310() + } + SISWaitRetraceCRT1(pScrn); + sis310SwitchToMONOCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor310(); + } + } + } + sis310SetCursorAddress(cursor_addr); + sis310SetCursorPatternSelect(0); + if(status1) sis310SetCursorStatus(status1) + + if(pSiS->VBFlags & CRT2_ENABLE) { + if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus310; + sis301DisableHWCursor310() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor310(); + } + sis301SetCursorAddress310(cursor_addr) + sis301SetCursorPatternSelect310(0) + if(status2) sis301SetCursorStatus310(status2) + } + + pSiS->UseHWARGBCursor = FALSE; +} + static Bool SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - return TRUE; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + DisplayModePtr mode = pScrn->currentMode; + SISPtr pSiS = SISPTR(pScrn); + + if(pSiS->Chipset != PCI_CHIP_SIS6326) return TRUE; + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return TRUE; + if((strcmp(mode->name, "PAL800x600U") == 0) || + (strcmp(mode->name, "NTSC640x480U") == 0)) + return FALSE; + else + return TRUE; } static Bool SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - DisplayModePtr mode = pScrn->currentMode; SISPtr pSiS = SISPTR(pScrn); + DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ switch (pSiS->Chipset) { - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - if (mode->Flags & V_INTERLACE) + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + if(mode->Flags & V_INTERLACE) + return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; + break; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + if(mode->Flags & V_INTERLACE) return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; break; + default: + if(mode->Flags & V_INTERLACE) + return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; + break; } return TRUE; } +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) +#ifdef ARGB_CURSOR +#ifdef SIS_ARGB_CURSOR +static Bool +SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + DisplayModePtr mode = pScrn->currentMode; + SISPtr pSiS = SISPTR(pScrn); + + switch (pSiS->Chipset) { + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + if(mode->Flags & V_INTERLACE) + return FALSE; + if(pCurs->bits->height > 32 || pCurs->bits->width > 32) + return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 16)) + return FALSE; + break; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + if(mode->Flags & V_INTERLACE) + return FALSE; + if(pCurs->bits->height > 64 || pCurs->bits->width > 64) + return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; + break; + default: + return FALSE; + } + return TRUE; +} + +static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) +{ + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr, i, j, maxheight = 32; + CARD32 *src = pCurs->bits->argb, *p; +#ifdef SIS300_USE_ARGB16 + CARD16 *dest, *pb; + CARD16 temp1; +#define MYSISPTRTYPE CARD16 +#else + CARD32 *pb, *dest; +#define MYSISPTRTYPE CARD32 +#endif + int srcwidth = pCurs->bits->width; + int srcheight = pCurs->bits->height; + BOOLEAN sizedouble = FALSE; + CARD32 temp, status1 = 0, status2 = 0; + +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); + + if(srcwidth > 32) srcwidth = 32; + if(srcheight > 32) srcheight = 32; + +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) + /* TW: Use the global (real) FbBase in DHM */ + dest = (MYSISPTRTYPE *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); + else +#endif + dest = (MYSISPTRTYPE *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); + + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + sizedouble = TRUE; + if(srcheight > 16) srcheight = 16; + maxheight = 16; + } + +#ifdef SIS300_USE_ARGB16 /* Use 16 Bit RGB pointer */ + for(i = 0; i < srcheight; i++) { + p = src; + pb = dest; + src += pCurs->bits->width; + for(j = 0; j < srcwidth; j++) { + temp = *p++; + if(temp & 0xffffff) { + temp1 = ((temp & 0xff) >> 3) | + ((((temp & 0xff00) >> (8 + 3)) << 5) & 0x03e0) | + ((((temp & 0xff0000) >> (16 + 3)) << 10) & 0x7c00); + } else temp1 = 0x8000; + *dest++ = temp1; + } + if(srcwidth < 32) { + for(; j < 32; j++) { + *dest++ = 0x8000; + } + } + } + if(srcheight < maxheight) { + for(; i < maxheight; i++) + for(j = 0; j < 32; j++) { + *dest++ = 0x8000; + } + if(sizedouble) { + for(j = 0; j < 32; j++) + *dest++ = 0x0000; + } + } +#else /* Use 32bit RGB pointer - preferred, saves us from the conversion */ + for(i = 0; i < srcheight; i++) { + p = src; + pb = dest; + src += pCurs->bits->width; + for(j = 0; j < srcwidth; j++) { + temp = *p++; +/* *dest1++ = ((temp ^ 0xff000000) << 4) | (((temp ^ 0xff000000) & 0xf0000000) >> 28); */ + if(pSiS->OptUseColorCursorBlend) { + if(temp & 0xffffff) { + if((temp & 0xff000000) > pSiS->OptColorCursorBlendThreshold) { + temp &= 0x00ffffff; + } else { + temp = 0xff111111; + } + } else temp = 0xff000000; + } else { + if(temp & 0xffffff) temp &= 0x00ffffff; + else temp = 0xff000000; + } + *dest++ = temp; + } + if(srcwidth < 32) { + for(; j < 32; j++) { + *dest++ = 0xff000000; + } + } + if(sizedouble) { + for(j = 0; j < 32; j++) { + *dest++ = *pb++; + } + } + + } + if(srcheight < maxheight) { + for(; i < maxheight; i++) { + for(j = 0; j < 32; j++) { + *dest++ = 0xff000000; + } + if(sizedouble) { + for(j = 0; j < 32; j++) { + *dest++ = 0xff000000; + } + } + } + } +#endif + + if(!pSiS->UseHWARGBCursor) { + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis300GetCursorStatus; + sis300DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + } + SISWaitRetraceCRT1(pScrn); + sis300SwitchToRGBCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor(); + } + } + } + sis300SetCursorAddress(cursor_addr); + sis300SetCursorPatternSelect(0); + if(status1) sis300SetCursorStatus(status1) + + if(pSiS->VBFlags & CRT2_ENABLE) { + if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor(); + } + sis301SetCursorAddress(cursor_addr) + sis301SetCursorPatternSelect(0) + if(status2) sis301SetCursorStatus(status2) + } + + pSiS->UseHWARGBCursor = TRUE; +} + +static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) +{ + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr, i, j, maxheight = 64; + CARD32 *src = pCurs->bits->argb, *p, *pb, *dest; + int srcwidth = pCurs->bits->width; + int srcheight = pCurs->bits->height; + BOOLEAN sizedouble = FALSE; + CARD32 status1 = 0, status2 = 0; + +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); + + if(srcwidth > 64) srcwidth = 64; + if(srcheight > 64) srcheight = 64; + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) + /* TW: Use the global (real) FbBase in DHM */ + dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); + else +#endif + dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); + + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + sizedouble = TRUE; + if(srcheight > 32) srcheight = 32; + maxheight = 32; + } + + for(i = 0; i < srcheight; i++) { + p = src; + pb = dest; + src += pCurs->bits->width; + for(j = 0; j < srcwidth; j++) *dest++ = *p++; + if(srcwidth < 64) { + for(; j < 64; j++) *dest++ = 0; + } + if(sizedouble) { + for(j = 0; j < 64; j++) { + *dest++ = *pb++; + } + } + } + if(srcheight < maxheight) { + for(; i < maxheight; i++) + for(j = 0; j < 64; j++) *dest++ = 0; + if(sizedouble) { + for(j = 0; j < 64; j++) *dest++ = 0; + } + } + + if(!pSiS->UseHWARGBCursor) { + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis310GetCursorStatus; + sis310DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus310; + sis301DisableHWCursor310() + } + SISWaitRetraceCRT1(pScrn); + sis310SwitchToRGBCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor310(); + } + } + } + sis310SetCursorAddress(cursor_addr); + sis310SetCursorPatternSelect(0); + if(status1) sis310SetCursorStatus(status1) + + if(pSiS->VBFlags & CRT2_ENABLE) { + if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus310; + sis301DisableHWCursor310() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor310(); + } + sis301SetCursorAddress310(cursor_addr) + sis301SetCursorPatternSelect310(0) + if(status2) sis301SetCursorStatus310(status2) + } + + pSiS->UseHWARGBCursor = TRUE; +} +#endif +#endif +#endif + Bool SiSHWCursorInit(ScreenPtr pScreen) { @@ -275,19 +1019,62 @@ return FALSE; pSiS->CursorInfoPtr = infoPtr; + pSiS->UseHWARGBCursor = FALSE; - infoPtr->MaxWidth = 64; - infoPtr->MaxHeight = 64; switch (pSiS->Chipset) { - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + infoPtr->MaxWidth = 64; + infoPtr->MaxHeight = 64; infoPtr->ShowCursor = SiS300ShowCursor; infoPtr->HideCursor = SiS300HideCursor; infoPtr->SetCursorPosition = SiS300SetCursorPosition; infoPtr->SetCursorColors = SiS300SetCursorColors; infoPtr->LoadCursorImage = SiS300LoadCursorImage; + infoPtr->UseHWCursor = SiS300UseHWCursor; +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) +#ifdef ARGB_CURSOR +#ifdef SIS_ARGB_CURSOR + if(pSiS->OptUseColorCursor) { + infoPtr->UseHWCursorARGB = SiSUseHWCursorARGB; + infoPtr->LoadCursorARGB = SiS300LoadCursorImageARGB; + } +#endif +#endif +#endif + infoPtr->Flags = + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_INVERT_MASK | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64; + break; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + infoPtr->MaxWidth = 64; + infoPtr->MaxHeight = 64; + infoPtr->ShowCursor = SiS310ShowCursor; + infoPtr->HideCursor = SiS310HideCursor; + infoPtr->SetCursorPosition = SiS310SetCursorPosition; + infoPtr->SetCursorColors = SiS310SetCursorColors; + infoPtr->LoadCursorImage = SiS310LoadCursorImage; infoPtr->UseHWCursor = SiS300UseHWCursor; +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) +#ifdef ARGB_CURSOR +#ifdef SIS_ARGB_CURSOR + if(pSiS->OptUseColorCursor) { + infoPtr->UseHWCursorARGB = SiSUseHWCursorARGB; + infoPtr->LoadCursorARGB = SiS310LoadCursorImageARGB; + } +#endif +#endif +#endif infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_INVERT_MASK | @@ -296,7 +1083,9 @@ HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64; break; - default: + default: + infoPtr->MaxWidth = 64; + infoPtr->MaxHeight = 64; infoPtr->SetCursorPosition = SiSSetCursorPosition; infoPtr->ShowCursor = SiSShowCursor; infoPtr->HideCursor = SiSHideCursor; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h:1.2 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h Thu Feb 6 08:14:04 2003 @@ -1,78 +1,427 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.5 2003/02/06 13:14:04 eich Exp $ */ /* * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holders not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Thomas Winischhofer <thomas@winischhofer.net>: */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.2 2001/04/19 12:40:33 alanh Exp $ */ #define CS(x) (0x8500+(x<<2)) -#define sis300EnableHWCursor()\ - *(volatile CARD32 *)(pSiS->IOBase + CS(0)) |= 0x40000000; +/* 300 series, CRT1 */ + +/* 80000000 = RGB(1) - MONO(0) + * 40000000 = enable(1) - disable(0) + * 20000000 = 32(1) / 16(1) bit RGB + * 10000000 = "ghost"(1) - [other effect](0) + */ + +#define sis300GetCursorStatus \ + MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; + +#define sis300SetCursorStatus(status) \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xbfffffff; \ + temp |= status; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis300EnableHWCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0x0fffffff; \ + temp |= 0x40000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis300EnableHWARGBCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp |= 0xF0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis300EnableHWARGB16Cursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0x0fffffff; \ + temp |= 0xD0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis300SwitchToMONOCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0x4fffffff; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis300SwitchToRGBCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp |= 0xB0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + #define sis300DisableHWCursor()\ - *(volatile CARD32 *)(pSiS->IOBase + CS(0)) &= 0x3FFFFFFF; + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xbFFFFFFF; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } #define sis300SetCursorBGColor(color)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(1)) = (color); + MMIO_OUT32(pSiS->IOBase, CS(1), (color)); #define sis300SetCursorFGColor(color)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(2)) = (color); + MMIO_OUT32(pSiS->IOBase, CS(2), (color)); #define sis300SetCursorPositionX(x,preset)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(3)) = (x) | ((preset) << 16); + MMIO_OUT32(pSiS->IOBase, CS(3), ((x) | ((preset) << 16))); #define sis300SetCursorPositionY(y,preset)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(4)) = (y) | ((preset) << 16); + MMIO_OUT32(pSiS->IOBase, CS(4), ((y) | ((preset) << 16))); #define sis300SetCursorAddress(address)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(0)) &= 0xFFFF0000;\ - *(volatile CARD32 *)(pSiS->IOBase + CS(0)) |= address; + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xFFFF0000; \ + temp |= address; \ + MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ + } #define sis300SetCursorPatternSelect(pat_id)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(0)) &= 0xF0FFFFFF;\ - *(volatile CARD32 *)(pSiS->IOBase + CS(0)) |= ((pat_id) << 24); - - + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xF0FFFFFF; \ + temp |= (pat_id) << 24; \ + MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ + } + +/* 300 series, CRT2 */ + +/* 80000000 = RGB(1) - MONO(0) + * 40000000 = enable(1) - disable(0) + * 20000000 = 32(1) / 16(1) bit RGB + * 10000000 = unused (always "ghosting") + */ +#define sis301GetCursorStatus \ + MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; + +#define sis301SetCursorStatus(status) \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xbfffffff; \ + temp |= status; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + #define sis301EnableHWCursor()\ - *(volatile CARD32 *)(pSiS->IOBase + CS(8)) |= 0x40000000; + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0x0fffffff; \ + temp |= 0x40000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301EnableHWARGBCursor()\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp |= 0xF0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301EnableHWARGB16Cursor()\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0x0FFFFFFF; \ + temp |= 0xD0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301SwitchToRGBCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp |= 0xB0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301SwitchToMONOCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0x4fffffff; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + #define sis301DisableHWCursor()\ - *(volatile CARD32 *)(pSiS->IOBase + CS(8)) &= 0xBFFFFFFF; - + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xbFFFFFFF; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + #define sis301SetCursorBGColor(color)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(9)) = (color); + MMIO_OUT32(pSiS->IOBase, CS(9), (color)); #define sis301SetCursorFGColor(color)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(10)) = (color); + MMIO_OUT32(pSiS->IOBase, CS(10), (color)); #define sis301SetCursorPositionX(x,preset)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(11)) = (x) | ((preset) << 16); + MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); #define sis301SetCursorPositionY(y,preset)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(12)) = (y) | ((preset) << 16); + MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); #define sis301SetCursorAddress(address)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(8)) &= 0xFFFF0000;\ - *(volatile CARD32 *)(pSiS->IOBase + CS(8)) |= address; + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xFFFF0000; \ + temp |= address; \ + MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ + } #define sis301SetCursorPatternSelect(pat_id)\ - *(volatile CARD32 *)(pSiS->IOBase + CS(8)) &= 0xF0FFFFFF;\ - *(volatile CARD32 *)(pSiS->IOBase + CS(8)) |= ((pat_id) << 24); + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xF0FFFFFF; \ + temp |= (pat_id) << 24; \ + MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ + } + +/* 310/325/330 series CRT1 */ + +/* 80000000 = RGB(1) - MONO(0) + * 40000000 = enable(1) - disable(0) + * 20000000 = 32(1) / 16(1) bit RGB + * 10000000 = "ghost"(1) - Alpha Blend(0) + */ + +#define sis310GetCursorStatus \ + MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; + +#define sis310SetCursorStatus(status) \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xbfffffff; \ + temp |= status; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis310EnableHWCursor()\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0x0fffffff; \ + temp |= 0x40000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis310EnableHWARGBCursor()\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0x0FFFFFFF; \ + temp |= 0xE0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis310SwitchToMONOCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0x4fffffff; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis310SwitchToRGBCursor() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xBFFFFFFF; \ + temp |= 0xA0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis310DisableHWCursor()\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xBFFFFFFF; \ + MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + } + +#define sis310SetCursorBGColor(color)\ + MMIO_OUT32(pSiS->IOBase, CS(1), (color)); +#define sis310SetCursorFGColor(color)\ + MMIO_OUT32(pSiS->IOBase, CS(2), (color)); + +#define sis310SetCursorPositionX(x,preset)\ + MMIO_OUT32(pSiS->IOBase, CS(3), ((x) | ((preset) << 16))); +#define sis310SetCursorPositionY(y,preset)\ + MMIO_OUT32(pSiS->IOBase, CS(4), ((y) | ((preset) << 16))); + +#define sis310SetCursorAddress(address)\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xFFF00000; \ + temp |= address; \ + MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ + } + +#define sis310SetCursorPatternSelect(pat_id)\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp &= 0xF0FFFFFF; \ + temp |= (pat_id) << 24; \ + MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ + } + +/* 310/325/330 series CRT2 */ + +/* 80000000 = RGB(1) - MONO(0) + * 40000000 = enable(1) - disable(0) + * 20000000 = 32(1) / 16(1) bit RGB + * 10000000 = "ghost"(1) - Alpha Blend(0) ? + */ + +#define sis301GetCursorStatus310 \ + MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; + +#define sis301SetCursorStatus310(status) \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xbfffffff; \ + temp |= status; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301EnableHWCursor310()\ + { \ + unsigned long temp, temp1, temp2; \ + temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \ + temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0x0fffffff; \ + temp |= 0x40000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \ + MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \ + } + +#define sis301EnableHWARGBCursor310()\ + { \ + unsigned long temp, temp1, temp2; \ + temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \ + temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0x0FFFFFFF; \ + temp |= 0xE0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \ + MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \ + } + +#define sis301SwitchToRGBCursor310() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xBFFFFFFF; \ + temp |= 0xA0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301SwitchToMONOCursor310() \ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0x4fffffff; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301DisableHWCursor310()\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xBFFFFFFF; \ + MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + } + +#define sis301SetCursorBGColor310(color)\ + MMIO_OUT32(pSiS->IOBase, CS(9), (color)); +#define sis301SetCursorFGColor310(color)\ + MMIO_OUT32(pSiS->IOBase, CS(10), (color)); + +#define sis301SetCursorPositionX310(x,preset)\ + MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); +#define sis301SetCursorPositionY310(y,preset)\ + MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); + +#define sis301SetCursorAddress310(address)\ + { \ + unsigned long temp; \ + if(pSiS->sishw_ext.jChipType == SIS_315H) { \ + if(address & 0x10000) { \ + address &= ~0x10000; \ + orSISIDXREG(SISSR, 0x37, 0x80); \ + } else { \ + andSISIDXREG(SISSR, 0x37, 0x7f); \ + } \ + } \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xFFF00000; \ + temp |= address; \ + MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ + } + +#define sis301SetCursorPatternSelect310(pat_id)\ + { \ + unsigned long temp; \ + temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp &= 0xF0FFFFFF; \ + temp |= (pat_id) << 24; \ + MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ + } + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.24 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c Wed Feb 5 12:53:22 2003 @@ -1,31 +1,33 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.30 2003/02/05 17:53:22 eich Exp $ */ /* * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the provider not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The provider makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE PROVIDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE PROVIDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk> + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Thomas Winischhofer <thomas@winischhofer.net> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.24 2002/01/17 09:57:30 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -33,43 +35,48 @@ #include "xf86Version.h" #include "xf86PciInfo.h" #include "xf86Pci.h" +#include "xf86DDC.h" -#include "vgaHW.h" - #include "sis.h" #include "sis_dac.h" #include "sis_regs.h" #include "sis_vb.h" -#include "sis_bios.h" static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS310Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSLVDSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS310Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSLVDSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSLVDSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); -static void SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); -static void SiS630Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); -static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); static void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr); +#if 0 +Bool SiSI2CInit(ScrnInfoPtr pScrn); +#endif -static unsigned short ch7005idx[0x11]={0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; +static const unsigned short ch700xidx[] = { + 0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a, + 0x1b,0x1c,0x1d,0x1e,0x1f, /* 0x0e, - TW: Don't save the power register */ + 0x01,0x03,0x06,0x0d,0x11,0x13,0x14,0x15,0x17,0x22,0x23,0x24 + }; + +static const unsigned short ch701xidx[] = { + 0x1c,0x5f,0x64,0x6f,0x70,0x71,0x72,0x73,0x74,0x76,0x78,0x7d, + 0x67,0x68,0x69,0x6a,0x6b,0x1e,0x00,0x01,0x02,0x04,0x03,0x05, + 0x06,0x07,0x08,0x15,0x1f,0x0c,0x0d,0x0e,0x0f,0x10 + }; -int -SiScompute_vclk( +int SiS_compute_vclk( int Clock, int *out_n, int *out_dn, @@ -166,7 +173,7 @@ } *out_n = best_n; *out_dn = best_dn; - PDEBUG(ErrorF("SiScompute_vclk: Clock=%d, n=%d, dn=%d, div=%d, sbit=%d," + PDEBUG(ErrorF("SiS_compute_vclk: Clock=%d, n=%d, dn=%d, div=%d, sbit=%d," " scale=%d\n", Clock, best_n, best_dn, *out_div, *out_sbit, *out_scale)); return 1; @@ -203,11 +210,11 @@ #define Fref 14318180 /* stability constraints for internal VCO -- MAX_VCO also determines * the maximum Video pixel clock */ -#define MIN_VCO Fref -#define MAX_VCO 135000000 +#define MIN_VCO Fref +#define MAX_VCO 135000000 #define MAX_VCO_5597 353000000 -#define MAX_PSN 0 /* no pre scaler for this chip */ -#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ +#define MAX_PSN 0 /* no pre scaler for this chip */ +#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ int M_min = 2; int M_max = 128; @@ -216,7 +223,6 @@ target = clock * 1000; - if (pSiS->Chipset == PCI_CHIP_SIS5597 || pSiS->Chipset == PCI_CHIP_SIS6326){ int low_N = 2; int high_N = 5; @@ -321,10 +327,11 @@ bestVLD = VLD; bestFout = Fout; } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,3,"Freq. selected: %.2f MHz, M=%d, N=%d, VLD=%d," - " P=%d, PSN=%d\n", + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,3, + "Freq. selected: %.2f MHz, M=%d, N=%d, VLD=%d, P=%d, PSN=%d\n", (float)(clock / 1000.), M, N, P, VLD, PSN); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,3,"Freq. set: %.2f MHz\n", Fout / 1.0e6); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,3, + "Freq. set: %.2f MHz\n", Fout / 1.0e6); } } } @@ -353,914 +360,1604 @@ SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - int vgaIOBase; int i,max; - - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); - outw(VGA_SEQ_INDEX, 0x8605); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif switch (pSiS->Chipset) { case PCI_CHIP_SIS5597: - max=0x39; + max=0x3C; break; case PCI_CHIP_SIS6326: case PCI_CHIP_SIS530: - max=0x3F; + max=0x3F; break; default: max=0x37; break; } + /* Save extended SR registers */ for (i = 0x06; i <= max; i++) { - outb(VGA_SEQ_INDEX, i); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "XR%02X Contents - %02X \n", i, inb(VGA_SEQ_DATA)); - sisReg->sisRegs3C4[i] = inb(VGA_SEQ_DATA); + inSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]); +#ifdef DEBUG + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "XR%02X Contents - %02X \n", i, sisReg->sisRegs3C4[i]); +#endif +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SR%02X - %02X \n", i,sisReg->sisRegs3C4[i]); +#endif + } + +#ifdef TWDEBUG + for (i = 0x00; i <= 0x3f; i++) { + inSISIDXREG(SISCR, i, max); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CR%02X - %02X \n", i,max); } +#endif + + /* Save lock (will not be restored in SiSRestore()!) */ + inSISIDXREG(SISCR, 0x80, sisReg->sisRegs3D4[0x80]); + + sisReg->sisRegs3C2 = inSISREG(SISMISCR); /* Misc */ - /*sisReg->sisRegs3C2 = inb(0x3CC);*/ - sisReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c); + /* TW: Save TV registers */ + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + outSISIDXREG(SISCR, 0x80, 0x86); + for(i = 0x00; i <= 0x44; i++) { + sisReg->sis6326tv[i] = SiS6326GetTVReg(pScrn, i); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VR%02X - %02X \n", i,sisReg->sis6326tv[i]); +#endif + } + } } static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - int vgaIOBase; int i,max; + unsigned char tmp; +#ifdef DEBUG + int temp; +#endif xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n"); - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; - - outw(VGA_SEQ_INDEX, 0x8605); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif switch (pSiS->Chipset) { case PCI_CHIP_SIS5597: - max=0x39; + max = 0x3C; break; case PCI_CHIP_SIS6326: - max=0x3F; - break; - case PCI_CHIP_SIS530: - max=0x3F; + case PCI_CHIP_SIS530: + max = 0x3F; break; default: - max=0x37; + max = 0x37; break; } - - for (i = 0x06; i <= max; i++) { - outb(VGA_SEQ_INDEX,i); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, - "XR%X Contents - %02X ", i, inb(VGA_SEQ_DATA)); - outb(VGA_SEQ_DATA,sisReg->sisRegs3C4[i]); + /* Disable TV on 6326 before restoring */ + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + outSISIDXREG(SISCR, 0x80, 0x86); + tmp = SiS6326GetTVReg(pScrn, 0x00); + tmp &= ~0x04; + SiS6326SetTVReg(pScrn, 0x00, tmp); + } + + /* Restore VCLKs */ +#if 0 /* TW: No, we didn't save SR2x-1 and SR2x-2! */ + andSISIDXREG(SISSR, 0x38, 0xfc); + inSISIDXREG(SISSR, 0x13, tmp); + tmp &= ~0x40; + tmp |= (sisReg->sisRegs3C4[0x13] & 0x40); + outSISIDXREG(SISSR, 0x13, tmp); + outSISIDXREG(SISSR, 0x2a, sisReg->sisRegs3C4[0x2a]); + outSISIDXREG(SISSR, 0x2b, sisReg->sisRegs3C4[0x2b]); + orSISIDXREG(SISSR, 0x38, 0x01); + inSISIDXREG(SISSR, 0x13, tmp); + tmp &= ~0x40; + tmp |= (sisReg->sisRegs3C4[0x13] & 0x40); + outSISIDXREG(SISSR, 0x13, tmp); + outSISIDXREG(SISSR, 0x2a, sisReg->sisRegs3C4[0x2a]); + outSISIDXREG(SISSR, 0x2b, sisReg->sisRegs3C4[0x2b]); + andSISIDXREG(SISSR, 0x38, 0xfc); + orSISIDXREG(SISSR, 0x38, 0x02); + inSISIDXREG(SISSR, 0x13, tmp); + tmp &= ~0x40; + tmp |= (sisReg->sisRegs3C4[0x13] & 0x40); + outSISIDXREG(SISSR, 0x13, tmp); + outSISIDXREG(SISSR, 0x2a, sisReg->sisRegs3C4[0x2a]); + outSISIDXREG(SISSR, 0x2b, sisReg->sisRegs3C4[0x2b]); + andSISIDXREG(SISSR, 0x38, 0xfc); +#endif - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, - "Restore to - %02X Read after - %02X\n", - sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); + /* Restore other extended SR registers */ + for (i = 0x06; i <= max; i++) { + if((i == 0x13) || (i == 0x2a) || (i == 0x2b)) continue; +#ifdef DEBUG + inSISIDXREG(SISSR, i, temp); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "SR%X Contents: %02X - ", i, temp); +#endif + outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]); +#ifdef DEBUG + inSISIDXREG(SISSR, i, temp); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "Restored to %02X - Read: %02X\n", + sisReg->sisRegs3C4[i], temp); +#endif } - - /*outb(0x3C2, sisReg->sisRegs3C2);*/ - outb(pSiS->RelIO+0x42, sisReg->sisRegs3C2); - /* MemClock needs this to take effect */ + /* Now restore VCLK (with correct SR38 setting) */ + outSISIDXREG(SISSR, 0x13, sisReg->sisRegs3C4[0x13]); + outSISIDXREG(SISSR, 0x2a, sisReg->sisRegs3C4[0x2a]); + outSISIDXREG(SISSR, 0x2b, sisReg->sisRegs3C4[0x2b]); - outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ - outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ + /* Misc */ + outSISREG(SISMISCW, sisReg->sisRegs3C2); + /* MemClock needs this to take effect */ + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + usleep(10000); + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ + + /* TW: Restore TV registers */ + pSiS->SiS6326Flags &= ~SIS6326_TVON; + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + for(i = 0x01; i <= 0x44; i++) { + SiS6326SetTVReg(pScrn, i, sisReg->sis6326tv[i]); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VR%02x restored to %02x\n", + i, sisReg->sis6326tv[i]); +#endif + } + tmp = SiS6326GetXXReg(pScrn, 0x13); + SiS6326SetXXReg(pScrn, 0x13, 0xfa); + tmp = SiS6326GetXXReg(pScrn, 0x14); + SiS6326SetXXReg(pScrn, 0x14, 0xc8); + if(!(sisReg->sisRegs3C4[0x0D] & 0x04)) { + tmp = SiS6326GetXXReg(pScrn, 0x13); + SiS6326SetXXReg(pScrn, 0x13, 0xf6); + tmp = SiS6326GetXXReg(pScrn, 0x14); + SiS6326SetXXReg(pScrn, 0x14, 0xbf); + } + if(sisReg->sis6326tv[0] & 0x04) pSiS->SiS6326Flags |= SIS6326_TVON; + } } +/* Save SiS 300 series register contents */ static void SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - int vgaIOBase; - int i,max; + int i; PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); - - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; - - outw(VGA_SEQ_INDEX, 0x8605); + "SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); - max=0x3D; +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif - for (i = 0x06; i <= max; i++) { - outb(VGA_SEQ_INDEX, i); - sisReg->sisRegs3C4[i] = inb(VGA_SEQ_DATA); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "XR%02X Contents - %02X \n", i,sisReg->sisRegs3C4[i]); + /* Save SR registers */ + for (i = 0x00; i <= 0x3D; i++) { + inSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SR%02X - %02X \n", i,sisReg->sisRegs3C4[i]); +#endif } - for (i=0x19; i<0x40; i++) { - inSISIDXREG(pSiS->RelIO+CROFFSET, i, sisReg->sisRegs3D4[i]); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "3D4-%02X Contents - %02X \n", i,sisReg->sisRegs3D4[i]); + /* Save CR registers */ + for (i = 0x00; i < 0x40; i++) { + inSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CR%02X Contents - %02X \n", i,sisReg->sisRegs3D4[i]); +#endif } - /*sisReg->sisRegs3C2 = inb(0x3CC);*/ - sisReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c); + /* Save Misc register */ + sisReg->sisRegs3C2 = inSISREG(SISMISCR); + + /* Save FQBQ and GUI timer settings */ + if(pSiS->Chipset == PCI_CHIP_SIS630) { + sisReg->sisRegsPCI50 = pciReadLong(0x00000000, 0x50); + sisReg->sisRegsPCIA0 = pciReadLong(0x00000000, 0xA0); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PCI Config 50 = %lx\n", sisReg->sisRegsPCI50); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PCI Config A0 = %lx\n", sisReg->sisRegsPCIA0); +#endif + } -#if 1 /* TW: Saving bridge data not yet needed; will possibly be when fixing VESA scaling problem */ - if (!pSiS->UseVESA) { /* TW: No need for touching the bridge registers when using VESA */ + /* Save panel link/video bridge registers */ +#ifndef TWDEBUG + if(!pSiS->UseVESA) { #endif - if ((pSiS->VBFlags & VB_LVDS)) /* && (pSiS->VBFlags & CRT2_LCD)) */ - (*pSiS->SiSSaveLVDS)(pScrn, sisReg); - if ((pSiS->VBFlags & (VB_CHRONTEL))) /* | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) */ - (*pSiS->SiSSaveChrontel)(pScrn,sisReg); -#if 1 + if (pSiS->VBFlags & (VB_LVDS|VB_CHRONTEL)) + (*pSiS->SiSSaveLVDSChrontel)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301|VB_303)) + (*pSiS->SiSSave2)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) + (*pSiS->SiSSave3)(pScrn, sisReg); +#ifndef TWDEBUG } #endif - if ((pSiS->VBFlags & (VB_301|VB_303))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ - (*pSiS->SiSSave2)(pScrn, sisReg); -#if 1 - if (!pSiS->UseVESA) { /* TW: Don't touch the 301B/302 when using VESA (PRILIMINARY) */ -#endif - if ((pSiS->VBFlags & (VB_301B|VB_302))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ - (*pSiS->SiSSave3)(pScrn, sisReg); -#if 1 - } + + /* Save Mode number */ +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) + if(!(pSiS->UseVESA)) #endif - - if ((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_LCD)) - pSiS->BIOSModeSave = SiSGetSetModeID(pScrn,0xFF); + pSiS->BIOSModeSave = SiS_GetSetModeID(pScrn,0xFF); + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "BIOS mode ds:449 = 0x%x\n", pSiS->BIOSModeSave); +#endif } + +/* Restore SiS300 series register contents */ static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - int vgaIOBase; - int i,max, temp; + int i,temp; + CARD32 temp1; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n"); - - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + "SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n"); - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock registers */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif - /* TW: Wait for accellerator to finish on-going drawing operations. */ - xf86DrvMsg(0, X_PROBED, "Before wait\n"); - outb(VGA_SEQ_INDEX, 0x1E); - temp = inb(VGA_SEQ_DATA); - if (temp & (0x40|0x10)) { /* TW: 0x40 = 2D, 0x10 = 3D enabled*/ + /* TW: Wait for accelerator to finish on-going drawing operations. */ + inSISIDXREG(SISSR, 0x1E, temp); + if(temp & (0x40|0x10|0x02)) { while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; + while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; - } /* TW: do it twice as in sis300_accel.h */ - xf86DrvMsg(0, X_PROBED, "After wait\n"); + } + + if (!(pSiS->UseVESA)) { + if(pSiS->VBFlags & VB_LVDS) { + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + } + } - max=0x3D; - for (i = 0x19; i < 0x40; i++) { - outSISIDXREG(pSiS->RelIO+CROFFSET, i, sisReg->sisRegs3D4[i]); + /* Restore extended CR registers */ + for(i = 0x19; i < 0x40; i++) { + outSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]); } - if (pSiS->Chipset != PCI_CHIP_SIS300) { + + if(pSiS->Chipset != PCI_CHIP_SIS300) { unsigned char val; - inSISIDXREG(pSiS->RelIO+CROFFSET,0x1A,val); - if (val == sisReg->sisRegs3D4[0x19]) - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x1A, sisReg->sisRegs3D4[0x19]); - inSISIDXREG(pSiS->RelIO+CROFFSET,0x19,val); - if (val == sisReg->sisRegs3D4[0x1A]) - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x19, sisReg->sisRegs3D4[0x1A]); + inSISIDXREG(SISCR, 0x1A, val); + if(val == sisReg->sisRegs3D4[0x19]) + outSISIDXREG(SISCR, 0x1A, sisReg->sisRegs3D4[0x19]); + inSISIDXREG(SISCR,0x19,val); + if(val == sisReg->sisRegs3D4[0x1A]) + outSISIDXREG(SISCR, 0x19, sisReg->sisRegs3D4[0x1A]); } - /* On 630, set SR20 | 0x20 if accellerators are on */ /*0x40*/ - if ((pSiS->Chipset == PCI_CHIP_SIS630) && (sisReg->sisRegs3C4[0x1e] & 0x50)) { + /* Set (and leave) PCI_IO_ENABLE on if accelerators are on */ + if(sisReg->sisRegs3C4[0x1e] & 0x50) { sisReg->sisRegs3C4[0x20] |= 0x20; - outb(VGA_SEQ_INDEX, 0x20); - outb(VGA_SEQ_DATA, sisReg->sisRegs3C4[0x20]); - /* outw(VGA_SEQ_INDEX, sisReg->sisRegs3C4[0x20] << 8 | 0x20); */ + outSISIDXREG(SISSR, 0x20, sisReg->sisRegs3C4[0x20]); } - /* TW: If TQ is switched on, don't switch it off ever again */ - if (!pSiS->NoAccel) { - if (pSiS->TurboQueue) { - temp = (pScrn->videoRam/64) - 8; - sisReg->sisRegs3C4[0x26] = temp & 0xFF; - sisReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) | 0xF0; - } + /* TW: If TQ is switched on, don't switch it off ever again! + * Therefore, always restore registers with TQ enabled. + */ + if((!pSiS->NoAccel) && (pSiS->TurboQueue)) { + temp = (pScrn->videoRam/64) - 8; + sisReg->sisRegs3C4[0x26] = temp & 0xFF; + sisReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) | 0xF0; + } + + /* Restore extended SR registers */ + for (i = 0x06; i <= 0x3D; i++) { + temp = sisReg->sisRegs3C4[i]; + if(!(pSiS->UseVESA)) { + if(pSiS->VBFlags & VB_LVDS) { + if(i == 0x11) { + inSISIDXREG(SISSR,0x11,temp); + temp &= 0x0c; + temp |= (sisReg->sisRegs3C4[i] & 0xf3); + } + } + } + outSISIDXREG(SISSR, i, temp); } + + /* TW: Restore VCLK and ECLK */ + if(pSiS->VBFlags & (VB_LVDS | VB_301B)) { + outSISIDXREG(SISSR,0x31,0x20); + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x80); + outSISIDXREG(SISSR,0x31,0x10); + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x80); + } + outSISIDXREG(SISSR,0x31,0x00); + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x80); + if(pSiS->VBFlags & (VB_LVDS | VB_301B)) { + outSISIDXREG(SISSR,0x31,0x20); + outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]); + outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]); + outSISIDXREG(SISSR,0x31,0x10); + outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]); + outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]); + outSISIDXREG(SISSR,0x31,0x00); + outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]); + outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]); + } + + /* Restore Misc register */ + outSISREG(SISMISCW, sisReg->sisRegs3C2); + + /* Restore FQBQ and GUI timer settings */ + if(pSiS->Chipset == PCI_CHIP_SIS630) { + temp1 = pciReadLong(0x00000000, 0x50); + if(pciReadLong(0x00000000, 0x00) == 0x06301039) { + temp1 &= 0xf0ffffff; + temp1 |= (sisReg->sisRegsPCI50 & ~0xf0ffffff); + } else { /* 730 */ + temp1 &= 0xfffff9ff; + temp1 |= (sisReg->sisRegsPCI50 & ~0xfffff9ff); + } + pciWriteLong(0x00000000, 0x50, temp1); + + temp1 = pciReadLong(0x00000000, 0xA0); + if(pciReadLong(0x00000000, 0x00) == 0x06301039) { + temp1 &= 0xf0ffffff; + temp1 |= (sisReg->sisRegsPCIA0 & ~0xf0ffffff); + } else { /* 730 */ + temp1 &= 0x00ffffff; + temp1 |= (sisReg->sisRegsPCIA0 & ~0x00ffffff); + } + pciWriteLong(0x00000000, 0xA0, temp1); + } + + /* Restore panel link/video bridge registers */ + if (!(pSiS->UseVESA)) { + if (pSiS->VBFlags & (VB_LVDS|VB_CHRONTEL)) + (*pSiS->SiSRestoreLVDSChrontel)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301|VB_303)) + (*pSiS->SiSRestore2)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) + (*pSiS->SiSRestore3)(pScrn, sisReg); + } + + /* MemClock needs this to take effect */ + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ - for (i = 0x06; i <= max; i++) { - outb(VGA_SEQ_INDEX,i); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "XR%X Contents - %02X ", i, inb(VGA_SEQ_DATA)); - outb(VGA_SEQ_DATA,sisReg->sisRegs3C4[i]); + /* Restore mode number */ +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) + if(!(pSiS->UseVESA)) +#endif + SiS_GetSetModeID(pScrn,pSiS->BIOSModeSave); +} + +/* Save SiS310 series register contents */ +static void +SiS310Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + int i; + + PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SiS310Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + /* Save SR registers */ + for (i = 0x00; i <= 0x3F; i++) { + inSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]); +#ifdef DEBUG + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "SR%02X - %02X \n", i,sisReg->sisRegs3C4[i]); +#endif +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SR%02X - %02X \n", i,sisReg->sisRegs3C4[i]); +#endif + } + + /* TW: Save command queue location */ + sisReg->sisMMIO85C0 = MMIO_IN32(pSiS->IOBase, 0x85C0); + + /* Save CR registers */ + for (i = 0x00; i <= 0x5f; i++) { + inSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]); +#ifdef DEBUG xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "Restore to - %02X Read after - %02X\n", - sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); + "CR%02X - %02X \n", i,sisReg->sisRegs3D4[i]); +#endif +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CR%02X Contents - %02X \n", i,sisReg->sisRegs3D4[i]); +#endif } -#if 1 /* TW: Saving bridge data not yet needed; will possibly be when fixing VESA scaling problem */ - if (!pSiS->UseVESA) { /* TW: No need for touching the bridge registers when using VESA */ + + /* Save Misc register */ + sisReg->sisRegs3C2 = inSISREG(SISMISCR); + + /* Save panel link/video bridge registers */ +#ifndef TWDEBUG + if (!pSiS->UseVESA) { #endif - if ((pSiS->VBFlags & VB_LVDS)) /* && (pSiS->VBFlags & CRT2_LCD)) */ - (*pSiS->SiSRestoreLVDS)(pScrn, sisReg); - if ((pSiS->VBFlags & (VB_CHRONTEL))) /* | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) */ - (*pSiS->SiSRestoreChrontel)(pScrn,sisReg); -#if 1 + if (pSiS->VBFlags & (VB_LVDS|VB_CHRONTEL)) + (*pSiS->SiSSaveLVDSChrontel)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301|VB_303)) + (*pSiS->SiSSave2)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) + (*pSiS->SiSSave3)(pScrn, sisReg); +#ifndef TWDEBUG } #endif - if ((pSiS->VBFlags & (VB_301|VB_303))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ - (*pSiS->SiSRestore2)(pScrn, sisReg); -#if 1 - if (!pSiS->UseVESA) { /* TW: Don't touch the 301B/302 when using VESA */ + + /* Save mode number */ +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) + if(!(pSiS->UseVESA)) #endif - if ((pSiS->VBFlags & (VB_301B|VB_302))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ - (*pSiS->SiSRestore3)(pScrn, sisReg); -#if 1 - } + pSiS->BIOSModeSave = SiS_GetSetModeID(pScrn,0xFF); +} + +/* Restore SiS310 series register contents */ +static void +SiS310Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + int i,temp; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "SiS310Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n"); + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif - /*outb(0x3C2, sisReg->sisRegs3C2);*/ - outb(pSiS->RelIO+0x42, sisReg->sisRegs3C2); + /* TW: Wait for accelerator to finish on-going drawing operations. */ + inSISIDXREG(SISSR, 0x1E, temp); + if (temp & (0x40|0x10|0x02)) { /* TW: 0x40 = 2D, 0x10 = 3D enabled*/ + while ( (MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){}; + while ( (MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){}; + while ( (MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){}; + } - /* MemClock needs this to take effect */ - outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ - outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ + /* Restore extended CR registers */ + for (i = 0x19; i < 0x5C; i++) { + outSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]); + } - if ((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_LCD)) - SiSGetSetModeID(pScrn,pSiS->BIOSModeSave); + /* TW: Leave PCI_IO_ENABLE on if accelerators are on (Is this required?) */ + if (sisReg->sisRegs3C4[0x1e] & 0x50) { /*0x40=2D, 0x10=3D*/ + sisReg->sisRegs3C4[0x20] |= 0x20; + outSISIDXREG(SISSR, 0x20, sisReg->sisRegs3C4[0x20]); + } + + /* TW: We reset the command queue before restoring. + * This might be required because we never know what + * console driver (like the kernel framebuffer driver) + * or application is running and which queue mode it + * uses. + */ + outSISIDXREG(SISSR, 0x27, 0x1F); + outSISIDXREG(SISSR, 0x26, 0x01); + /* Restore extended SR registers */ + for (i = 0x06; i <= 0x3F; i++) { +#ifdef DEBUG + inSISIDXREG(SISSR, i, temp); +#endif + outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]); +#ifdef DEBUG + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "XR%X Contents %02X - ", i, temp); + inSISIDXREG(SISSR, i, temp); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "Restored to %02X - Read: %02X\n", + sisReg->sisRegs3C4[i], temp); +#endif + } + /* TW: Restore VCLK and ECLK */ + andSISIDXREG(SISSR,0x31,0xcf); + if(pSiS->VBFlags & VB_LVDS) { + orSISIDXREG(SISSR,0x31,0x20); + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x80); + andSISIDXREG(SISSR,0x31,0xcf); + orSISIDXREG(SISSR,0x31,0x10); + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x80); + andSISIDXREG(SISSR,0x31,0xcf); + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x01); + outSISIDXREG(SISSR,0x31,0x20); + outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]); + outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]); + outSISIDXREG(SISSR,0x31,0x10); + outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]); + outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]); + outSISIDXREG(SISSR,0x31,0x00); + outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]); + outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]); + } else { + outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]); + outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]); + outSISIDXREG(SISSR,0x2d,0x01); + } + + /* TW: Initialize read/write pointer for command queue */ + MMIO_OUT32(pSiS->IOBase, 0x85C4, MMIO_IN32(pSiS->IOBase, 0x85C8)); + /* TW: Restore queue location */ + MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); + + /* Restore Misc register */ + outSISREG(SISMISCW, sisReg->sisRegs3C2); + + /* Restore panel link/video bridge registers */ + if (!(pSiS->UseVESA)) { + if (pSiS->VBFlags & (VB_LVDS|VB_CHRONTEL)) + (*pSiS->SiSRestoreLVDSChrontel)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301|VB_303)) + (*pSiS->SiSRestore2)(pScrn, sisReg); + if (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) + (*pSiS->SiSRestore3)(pScrn, sisReg); + } + + /* MemClock needs this to take effect */ + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ + + /* Restore Mode number */ +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) + if(!(pSiS->UseVESA)) +#endif + SiS_GetSetModeID(pScrn,pSiS->BIOSModeSave); } +/* Save SiS301 bridge register contents */ static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); int i; + int Part1max=0, Part2max=0, Part3max=0, Part4max=0; - /* for SiS301 only */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + /* Highest register number to save/restore */ + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + Part1max = 0x1d; + Part2max = 0x45; + Part3max = 0x3e; + Part4max = 0x1b; + break; + case SIS_315_VGA: + Part1max = 0x2e; /* 0x23, but we also need 2d-2e */ + Part2max = 0x45; + Part3max = 0x3e; + Part4max = 0x1b; + break; + } + + for (i=0; i<=Part1max; i++) { + inSISIDXREG(SISPART1, i, sisReg->VBPart1[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301Save: Part1Port 0x%02x = 0x%02x\n", i, sisReg->VBPart1[i]); +#endif } - for (i=0; i<0x46; i++) { - inSISIDXREG(pSiS->RelIO+0x10, i, sisReg->VBPart2[i]); + for (i=0; i<=Part2max; i++) { + inSISIDXREG(SISPART2, i, sisReg->VBPart2[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301Save: Part2Port 0x%02x = 0x%02x\n", i, sisReg->VBPart2[i]); +#endif } - for (i=0; i<0x3F; i++) { - inSISIDXREG(pSiS->RelIO+0x12, i, sisReg->VBPart3[i]); + for (i=0; i<=Part3max; i++) { + inSISIDXREG(SISPART3, i, sisReg->VBPart3[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301Save: Part3Port 0x%02x = 0x%02x\n", i, sisReg->VBPart3[i]); +#endif } - for (i=0; i<0x1C; i++) { - inSISIDXREG(pSiS->RelIO+0x14, i, sisReg->VBPart4[i]); + for (i=0; i<=Part4max; i++) { + inSISIDXREG(SISPART4, i, sisReg->VBPart4[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301Save: Part4Port 0x%02x = 0x%02x\n", i, sisReg->VBPart4[i]); +#endif } - sisReg->VBPart2[0] &= ~0x20; /* Disable VB Processor */ - sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ + + sisReg->VBPart2[0] &= ~0x20; /* Disable VB Processor */ + sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ +} + +/* Restore SiS301 bridge register contents */ +static void +SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + int Part1max=0, Part2max=0, Part3max=0, Part4max=0; + + /* Highest register number to save/restore */ + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + Part1max = 0x1d; + Part2max = 0x45; + Part3max = 0x3e; + Part4max = 0x1b; + break; + case SIS_315_VGA: + Part1max = 0x23; + Part2max = 0x45; + Part3max = 0x3e; + Part4max = 0x1b; + break; + } + + SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + + /* Pre-restore Part1 */ + outSISIDXREG(SISPART1, 0x04, 0x00); + outSISIDXREG(SISPART1, 0x05, 0x00); + outSISIDXREG(SISPART1, 0x06, 0x00); + outSISIDXREG(SISPART1, 0x00, sisReg->VBPart1[0]); + outSISIDXREG(SISPART1, 0x01, sisReg->VBPart1[1]); + + /* Pre-restore Part4 */ + outSISIDXREG(SISPART4, 0x0D, sisReg->VBPart4[0x0D]); + outSISIDXREG(SISPART4, 0x0C, sisReg->VBPart4[0x0C]); + + if (!(sisReg->sisRegs3D4[0x30] & 0x03) && + (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + return; + } + + /* Restore Part1 */ + SetBlock(SISPART1, 0x02, Part1max, &(sisReg->VBPart1[0x02])); + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + /* TW: Nothing special here. */ + break; + case SIS_315_VGA: + /* TW: Restore extra registers on 310 series */ + SetBlock(SISPART1, 0x2C, 0x2E, &(sisReg->VBPart1[0x2C])); + break; + } + + /* Restore Part2 */ + SetBlock(SISPART2, 0x00, Part2max, &(sisReg->VBPart2[0x00])); + + /* Restore Part3 */ + SetBlock(SISPART3, 0x00, Part3max, &(sisReg->VBPart3[0x00])); + + /* Restore Part4 */ + SetBlock(SISPART4, 0x0E, 0x11, &(sisReg->VBPart4[0x0E])); + SetBlock(SISPART4, 0x13, Part4max, &(sisReg->VBPart4[0x13])); + + /* Post-restore Part4 (CRT2VCLK) */ + outSISIDXREG(SISPART4, 0x0A, 0x01); + outSISIDXREG(SISPART4, 0x0B, sisReg->VBPart4[0x0B]); + outSISIDXREG(SISPART4, 0x0A, sisReg->VBPart4[0x0A]); + outSISIDXREG(SISPART4, 0x12, 0x00); + outSISIDXREG(SISPART4, 0x12, sisReg->VBPart4[0x12]); + + SiS_EnableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + SiS_DisplayOn(pSiS->SiS_Pr); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); } +/* Save SiS301B/302B/30xLV bridge register contents */ static void SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); int i; + int Part1max=0, Part2max=0, Part3max=0, Part4max=0; - /* for SiS301 only */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + Part1max = 0x37; /* 0x1d, but we also need 2c-2e, 35-37 */ + Part2max = 0x4d; + Part3max = 0x3e; + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) + Part4max = 0x24; + else + Part4max = 0x23; + break; + case SIS_315_VGA: + Part1max = 0x37; /* 0x23, but we also need 2c-2e, 35-37 */ + Part2max = 0x4d; + Part3max = 0x3e; + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) + Part4max = 0x24; + else + Part4max = 0x23; + break; + } + + for (i=0; i<=Part1max; i++) { + inSISIDXREG(SISPART1, i, sisReg->VBPart1[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301BSave: Part1Port 0x%02x = 0x%02x\n", i, sisReg->VBPart1[i]); +#endif } - for (i=0; i<0x46; i++) { - inSISIDXREG(pSiS->RelIO+0x10, i, sisReg->VBPart2[i]); + for (i=0; i<=Part2max; i++) { + inSISIDXREG(SISPART2, i, sisReg->VBPart2[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301BSave: Part2Port 0x%02x = 0x%02x\n", i, sisReg->VBPart2[i]); +#endif } - for (i=0; i<0x3F; i++) { - inSISIDXREG(pSiS->RelIO+0x12, i, sisReg->VBPart3[i]); + for (i=0; i<=Part3max; i++) { + inSISIDXREG(SISPART3, i, sisReg->VBPart3[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301BSave: Part3Port 0x%02x = 0x%02x\n", i, sisReg->VBPart3[i]); +#endif } - for (i=0; i<0x1C; i++) { - inSISIDXREG(pSiS->RelIO+0x14, i, sisReg->VBPart4[i]); + for (i=0; i<=Part4max; i++) { + inSISIDXREG(SISPART4, i, sisReg->VBPart4[i]); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301BSave: Part4Port 0x%02x = 0x%02x\n", i, sisReg->VBPart4[i]); +#endif } - sisReg->VBPart2[0] &= ~0x20; /* Disable VB Processor */ - sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ + sisReg->VBPart2[0] &= ~0x20; /* Disable VB Processor */ + sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ } +/* Restore SiS301B/302B/301LV/302LV bridge register contents */ static void -SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) +SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - int i; + int Part1max=0, Part2max=0, Part3max=0, Part4max=0; + + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + Part1max = 0x23; + Part2max = 0x4d; + Part3max = 0x3e; + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) + Part4max = 0x24; + else + Part4max = 0x22; + break; + case SIS_315_VGA: + Part1max = 0x23; + Part2max = 0x4d; + Part3max = 0x3e; + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) + Part4max = 0x24; + else + Part4max = 0x22; + break; + } + + SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + + /* Pre-restore Part1 */ + outSISIDXREG(SISPART1, 0x04, 0x00); + outSISIDXREG(SISPART1, 0x05, 0x00); + outSISIDXREG(SISPART1, 0x06, 0x00); + outSISIDXREG(SISPART1, 0x00, sisReg->VBPart1[0x00]); + outSISIDXREG(SISPART1, 0x01, sisReg->VBPart1[0x01]); + /* Mode reg 0x01 became 0x2e on 310 series (0x01 still contains FIFO) */ + if(pSiS->VGAEngine == SIS_315_VGA) + outSISIDXREG(SISPART1, 0x2e, sisReg->VBPart1[0x2e]); + + /* Pre-restore Part4 */ + outSISIDXREG(SISPART4, 0x0D, sisReg->VBPart4[0x0D]); + outSISIDXREG(SISPART4, 0x0C, sisReg->VBPart4[0x0C]); + + if (!(sisReg->sisRegs3D4[0x30] & 0x03) && + (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + return; + } - /* for SiS LVDS only */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + /* Restore Part1 */ + SetBlock(SISPART1, 0x02, Part1max, &(sisReg->VBPart1[0x02])); + if(pSiS->VGAEngine == SIS_315_VGA) { + SetBlock(SISPART1, 0x2C, 0x2D, &(sisReg->VBPart1[0x2C])); + SetBlock(SISPART1, 0x35, 0x37, &(sisReg->VBPart1[0x35])); } - sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ + + /* Restore Part2 */ + SetBlock(SISPART2, 0x00, Part2max, &(sisReg->VBPart2[0x00])); + + /* Restore Part3 */ + SetBlock(SISPART3, 0x00, Part3max, &(sisReg->VBPart3[0x00])); + + /* Restore Part4 */ + SetBlock(SISPART4, 0x0E, 0x11, &(sisReg->VBPart4[0x0E])); + SetBlock(SISPART4, 0x13, Part4max, &(sisReg->VBPart4[0x13])); + + /* Post-restore Part4 (CRT2VCLK) */ + outSISIDXREG(SISPART4, 0x0A, sisReg->VBPart4[0x0A]); + outSISIDXREG(SISPART4, 0x0B, sisReg->VBPart4[0x0B]); + outSISIDXREG(SISPART4, 0x12, 0x00); + outSISIDXREG(SISPART4, 0x12, sisReg->VBPart4[0x12]); + + SiS_EnableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + SiS_DisplayOn(pSiS->SiS_Pr); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); } +/* Save LVDS bridge (+ Chrontel) register contents */ static void -SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) +SiSLVDSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); int i; + + /* Save Part1 */ + for (i=0; i<0x46; i++) { + inSISIDXREG(SISPART1, i, sisReg->VBPart1[i]); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "LVDSSave: Part1Port 0x%02x = 0x%02x\n", + i, sisReg->VBPart1[i]); +#endif + } - /* for SiS Chrontel TV */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + /* Save Chrontel registers */ + if (pSiS->VBFlags & VB_CHRONTEL) { + if (pSiS->ChrontelType == CHRONTEL_700x) { + for (i=0; i<0x1D; i++) { + sisReg->ch70xx[i] = SiS_GetCH700x(pSiS->SiS_Pr, ch700xidx[i]); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "LVDSSave: Chrontel 0x%02x = 0x%02x\n", + ch700xidx[i], sisReg->ch70xx[i]); +#endif + + } + } else { + for (i=0; i<34; i++) { + sisReg->ch70xx[i] = SiS_GetCH701x(pSiS->SiS_Pr, ch701xidx[i]); + } + } } - for (i=0; i<0x11; i++) - sisReg->ch7005[i]=SiSGetCH7005(ch7005idx[i]); sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ } +/* Restore LVDS bridge (+ Chrontel) register contents */ static void -SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +SiSLVDSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - unsigned char temp, temp1; + int i; + USHORT wtemp; - SiSDisableBridge301(pSiS->RelIO+0x30); - SiSUnLockCRT2(pSiS->RelIO+0x30); - - /* SetCRT2ModeRegs() */ - outSISIDXREG(pSiS->RelIO+0x04, 4, 0); - outSISIDXREG(pSiS->RelIO+0x04, 5, 0); - outSISIDXREG(pSiS->RelIO+0x04, 6, 0); - outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); - outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0D, sisReg->VBPart4[0x0D]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); + SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + if(pSiS->sishw_ext.jChipType == SIS_730) { + outSISIDXREG(SISPART1, 0x00, 0x80); + } + + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + + if(pSiS->VBFlags & VB_CHRONTEL) { + /* Restore Chrontel registers */ + if(pSiS->ChrontelType == CHRONTEL_700x) { + for(i=0; i<0x11; i++) { + wtemp = ((sisReg->ch70xx[i]) << 8) | (ch700xidx[i] & 0x00FF); + SiS_SetCH700x(pSiS->SiS_Pr, wtemp); + } + } else { + for(i=0; i<34; i++) { + wtemp = ((sisReg->ch70xx[i]) << 8) | (ch701xidx[i] & 0x00FF); + SiS_SetCH701x(pSiS->SiS_Pr, wtemp); + } + } + } + + /* pre-restore Part1 */ + outSISIDXREG(SISPART1, 0x04, 0x00); + outSISIDXREG(SISPART1, 0x05, 0x00); + outSISIDXREG(SISPART1, 0x06, 0x00); + outSISIDXREG(SISPART1, 0x00, sisReg->VBPart1[0]); + if(pSiS->VGAEngine == SIS_300_VGA) { + outSISIDXREG(SISPART1, 0x01, (sisReg->VBPart1[1] | 0x80)); + } else { + outSISIDXREG(SISPART1, 0x01, sisReg->VBPart1[1]); + } if (!(sisReg->sisRegs3D4[0x30] & 0x03) && (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - SiSLockCRT2(pSiS->RelIO+0x30); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); return; } - SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); - SetBlock(pSiS->RelIO+0x10, 0x00, 0x45, &(sisReg->VBPart2[0x00])); - SetBlock(pSiS->RelIO+0x12, 0x00, 0x3E, &(sisReg->VBPart3[0x00])); - SetBlock(pSiS->RelIO+0x14, 0x0E, 0x11, &(sisReg->VBPart4[0x0E])); - SetBlock(pSiS->RelIO+0x14, 0x13, 0x1B, &(sisReg->VBPart4[0x13])); - - outSISIDXREG(pSiS->RelIO+0x14, 0x0A, 1); - outSISIDXREG(pSiS->RelIO+0x14, 0x0B, sisReg->VBPart4[0x0B]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0A, sisReg->VBPart4[0x0A]); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, 0); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, sisReg->VBPart4[0x12]); - - temp1 = 0; - if(!(pSiS->VBFlags & CRT2_VGA)) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); - if (temp & (SET_IN_SLAVE_MODE >> 8)) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); - if (!(temp & (SET_CRT2_TO_RAMDAC >> 8))) { - temp1 = 0x20; - } - } + + /* Restore Part1 */ + if(pSiS->VGAEngine == SIS_300_VGA) { + outSISIDXREG(SISPART1, 0x02, (sisReg->VBPart1[2] | 0x40)); + } else { + outSISIDXREG(SISPART1, 0x02, sisReg->VBPart1[2]); + } + SetBlock(SISPART1, 0x03, 0x23, &(sisReg->VBPart1[0x03])); + if(pSiS->VGAEngine == SIS_315_VGA) { + SetBlock(SISPART1, 0x2C, 0x2E, &(sisReg->VBPart1[0x2C])); + SetBlock(SISPART1, 0x35, 0x37, &(sisReg->VBPart1[0x35])); /* Panel Link Scaler */ } - setSISIDXREG(pSiS->RelIO+SROFFSET, 0x32, ~0x20, temp1); - orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); - andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ - SiSEnableBridge301(pSiS->RelIO+0x30); - SiSLockCRT2(pSiS->RelIO+0x30); + /* TW: For 550 DSTN registers */ + if (pSiS->DSTN) { + SetBlock(SISPART1, 0x25, 0x2E, &(sisReg->VBPart1[0x25])); + SetBlock(SISPART1, 0x30, 0x45, &(sisReg->VBPart1[0x30])); + } + + SiS_EnableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + SiS_DisplayOn(pSiS->SiS_Pr); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); } -/* TW: Preliminary - do the same as for 301 */ -static void -SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +/* TW: Restore output selection registers (CR30, 31, 33, 35/38) */ +void +SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg) { - SISPtr pSiS = SISPTR(pScrn); - unsigned char temp, temp1; - - SiSDisableBridge301B(pSiS->RelIO+0x30); - SiSUnLockCRT2(pSiS->RelIO+0x30); + SISPtr pSiS = SISPTR(pScrn); + unsigned char temp = 0; - /* SetCRT2ModeRegs() */ - outSISIDXREG(pSiS->RelIO+0x04, 4, 0); - outSISIDXREG(pSiS->RelIO+0x04, 5, 0); - outSISIDXREG(pSiS->RelIO+0x04, 6, 0); - outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); - outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0D, sisReg->VBPart4[0x0D]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif - if (!(sisReg->sisRegs3D4[0x30] & 0x03) && - (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - SiSLockCRT2(pSiS->RelIO+0x30); - return; - } - SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); - SetBlock(pSiS->RelIO+0x10, 0x00, 0x45, &(sisReg->VBPart2[0x00])); - SetBlock(pSiS->RelIO+0x12, 0x00, 0x3E, &(sisReg->VBPart3[0x00])); - SetBlock(pSiS->RelIO+0x14, 0x0E, 0x11, &(sisReg->VBPart4[0x0E])); - SetBlock(pSiS->RelIO+0x14, 0x13, 0x1B, &(sisReg->VBPart4[0x13])); - - outSISIDXREG(pSiS->RelIO+0x14, 0x0A, 1); - outSISIDXREG(pSiS->RelIO+0x14, 0x0B, sisReg->VBPart4[0x0B]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0A, sisReg->VBPart4[0x0A]); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, 0); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, sisReg->VBPart4[0x12]); - - temp1 = 0; - if(!(pSiS->VBFlags & CRT2_VGA)) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); - if (temp & (SET_IN_SLAVE_MODE >> 8)) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); - if (!(temp & (SET_CRT2_TO_RAMDAC >> 8))) { - temp1 = 0x20; - } + outSISIDXREG(SISCR, 0x30, sisReg->sisRegs3D4[0x30]); + outSISIDXREG(SISCR, 0x31, sisReg->sisRegs3D4[0x31]); + outSISIDXREG(SISCR, 0x33, sisReg->sisRegs3D4[0x33]); + if(pSiS->Chipset != PCI_CHIP_SIS300) { + switch(pSiS->VGAEngine) { + case SIS_300_VGA: temp = 0x35; break; + case SIS_315_VGA: temp = 0x38; break; } - } - setSISIDXREG(pSiS->RelIO+SROFFSET, 0x32, ~0x20, temp1); - orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); - andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ - - SiSEnableBridge301B(pSiS->RelIO+0x30); - SiSLockCRT2(pSiS->RelIO+0x30); + if(temp) { + outSISIDXREG(SISCR, temp, sisReg->sisRegs3D4[temp]); + } + } } -static void -SiSLVDSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +unsigned int +SiSddc1Read(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); + unsigned char temp; - SiSDisableBridgeLVDS(pSiS->RelIO+0x30); - SiSUnLockCRT2(pSiS->RelIO+0x30); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif - /* SetCRT2ModeRegs() */ - outSISIDXREG(pSiS->RelIO+0x04, 4, 0); - outSISIDXREG(pSiS->RelIO+0x04, 5, 0); - outSISIDXREG(pSiS->RelIO+0x04, 6, 0); - outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); - outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); - - if (!(sisReg->sisRegs3D4[0x30] & 0x03) && - (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - SiSLockCRT2(pSiS->RelIO+0x30); - return; - } - SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); + /* Wait until vertical retrace is in progress. */ + while(inSISREG(SISINPSTAT) & 0x08); + while(!(inSISREG(SISINPSTAT) & 0x08)); - orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); - andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ + /* Get the result */ + inSISIDXREG(SISSR, 0x11, temp); - SiSEnableBridgeLVDS(pSiS->RelIO+0x30); - SiSLockCRT2(pSiS->RelIO+0x30); + return((temp & 0x02)>>1); } +#if 0 /* TW: I2C functions not in use */ +/* static void -SiSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +SiS_I2CGetBits(I2CBusPtr b, int *clock, int *data) { - SISPtr pSiS = SISPTR(pScrn); - int i; - unsigned short wtemp; + SISPtr pSiS = SISPTR(xf86Screens[b->scrnIndex]); + unsigned char val; - SiSDisableBridgeLVDS(pSiS->RelIO+0x30); - SiSUnLockCRT2(pSiS->RelIO+0x30); + outSISIDXREG(SISSR, 0x05, 0x86); + inSISIDXREG(SISSR, pSiS->SiS_DDC2_Index, val); + *clock = (val & pSiS->SiS_DDC2_Clk) != 0; + *data = (val & pSiS->SiS_DDC2_Data) != 0; +} - for (i=0; i<0x11; i++) - { wtemp = ((sisReg->ch7005[i]) << 8) + (ch7005idx[i] & 0x00FF); - SiSSetCH7005(wtemp); - } +static void +SiS_I2CPutBits(I2CBusPtr b, int clock, int data) +{ + SISPtr pSiS = SISPTR(xf86Screens[b->scrnIndex]); + unsigned char temp; - /* SetCRT2ModeRegs() */ - outSISIDXREG(pSiS->RelIO+0x04, 4, 0); - outSISIDXREG(pSiS->RelIO+0x04, 5, 0); - outSISIDXREG(pSiS->RelIO+0x04, 6, 0); - outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); - outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); - - if (!(sisReg->sisRegs3D4[0x30] & 0x03) && - (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - SiSLockCRT2(pSiS->RelIO+0x30); - return; - } - SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); + outSISIDXREG(SISSR, 0x05, 0x86); + inSISIDXREG(SISSR, pSiS->SiS_DDC2_Index, temp); + + temp &= ~(pSiS->SiS_DDC2_Clk | pSiS->SiS_DDC2_Data); - orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); - andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ + temp |= ((clock ? pSiS->SiS_DDC2_Clk : 0) | (data ? pSiS->SiS_DDC2_Data : 0)); - SiSEnableBridgeLVDS(pSiS->RelIO+0x30); - SiSLockCRT2(pSiS->RelIO+0x30); + outSISIDXREG(SISSR, pSiS->SiS_DDC2_Index, temp); } +*/ -/* TW: Restores CRT2 output registers (needs to be called before VESARestore) */ -void -SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg) +static Bool +SiS_I2CAddress(I2CDevPtr d, I2CSlaveAddr addr) { - SISPtr pSiS = SISPTR(pScrn); + I2CBusPtr b = d->pI2CBus; + SISPtr pSiS = SISPTR(xf86Screens[b->scrnIndex]); + SiS_SetSwitchDDC2(pSiS->SiS_Pr); + return(SiS_I2C_Address(pSiS->SiS_Pr, addr)); +} - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock registers */ +static void +SiS_I2CStop(I2CDevPtr d) +{ + I2CBusPtr b = d->pI2CBus; + SISPtr pSiS = SISPTR(xf86Screens[b->scrnIndex]); + SiS_I2C_Stop(pSiS->SiS_Pr); +} - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x33, sisReg->sisRegs3D4[0x33]); - usleep(2000); - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, sisReg->sisRegs3D4[0x30]); - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, sisReg->sisRegs3D4[0x31]); +static Bool +SiS_I2CGetByte(I2CDevPtr d, I2CByte *data, Bool last) +{ + I2CBusPtr b = d->pI2CBus; + SISPtr pSiS = SISPTR(xf86Screens[b->scrnIndex]); + USHORT temp = SiS_I2C_GetByte(pSiS->SiS_Pr); + if(temp == 0xffff) return FALSE; + return TRUE; } +static Bool +SiS_I2CPutByte(I2CDevPtr d, I2CByte data) +{ + I2CBusPtr b = d->pI2CBus; + SISPtr pSiS = SISPTR(xf86Screens[b->scrnIndex]); + return(SiS_I2C_PutByte(pSiS->SiS_Pr, (USHORT)data)); +} -unsigned int -SiSddc1Read(ScrnInfoPtr pScrn) +Bool +SiSI2CInit(ScrnInfoPtr pScrn) { -#if 0 SISPtr pSiS = SISPTR(pScrn); -#endif - int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - unsigned char temp, temp2; + I2CBusPtr I2CPtr; + USHORT temp, i; + unsigned char buffer[256]; + xf86MonPtr pMonitor; - outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ - temp2 = inb(VGA_SEQ_DATA); - outw(VGA_SEQ_INDEX, 0x8605); + I2CPtr = xf86CreateI2CBusRec(); + if(!I2CPtr) return FALSE; - /* Wait until vertical retrace is in progress. */ - while (inb(vgaIOBase + 0xA) & 0x08); - while (!(inb(vgaIOBase + 0xA) & 0x08)); + pSiS->I2C = I2CPtr; - /* Get the result */ - outb(VGA_SEQ_INDEX, 0x11); temp = inb(VGA_SEQ_DATA); + I2CPtr->BusName = "DDC"; + I2CPtr->scrnIndex = pScrn->scrnIndex; +/* + I2CPtr->I2CPutBits = SiS_I2CPutBits; + I2CPtr->I2CGetBits = SiS_I2CGetBits; +*/ + I2CPtr->I2CPutByte = SiS_I2CPutByte; + I2CPtr->I2CGetByte = SiS_I2CGetByte; + I2CPtr->I2CAddress = SiS_I2CAddress; + I2CPtr->I2CStop = SiS_I2CStop; + I2CPtr->AcknTimeout = 30; + - outw(VGA_SEQ_INDEX, (temp2 << 8) | 0x05); - return ((temp & 0x02)>>1); + pSiS->SiS_Pr->SiS_DDC_Index = pSiS->SiS_DDC2_Index; + pSiS->SiS_Pr->SiS_DDC_Data = pSiS->SiS_DDC2_Data; + pSiS->SiS_Pr->SiS_DDC_Clk = pSiS->SiS_DDC2_Clk; + pSiS->SiS_Pr->SiS_DDC_DataShift = 0x00; + + if (!xf86I2CBusInit(I2CPtr)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not create I2C bus record\n"); + return FALSE; + } + + return TRUE; +} +#endif + +#if 0 /* TW: The following function should take a threshold value + * from predefined tables. This is only needed on some + * 530 boards, which have an ESS sound device on-board. + * However, I don't know how to calculate the index to + * be submitted to this function. + */ +unsigned short +SiS_CalcSpecial530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, int index) +{ + SISPtr pSiS = SISPTR(pScrn); + static const unsigned char t640x480[3][24] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,A9, /* b4 - 9d - depth 8 */ + 0, 0,11,14,14, 0, 0, 0, 0, 0, 0,9D }, + { 0, 0, 0, 0, 0,12,15, 0, 0, 0,92,91, /* 9c - 85 - depth 16 */ + 0,31,31,31,31, 0, 0, 0, 0, 0, 0,85 }, + { 0, 0, 0, 0, 0,17,22,25, 0, 0, 0,79, /* 84 - ? - depth 32 */ + 0,31,31, 0, 0, 0, 0, 0, 0, 0, 0,6d } + } + static const unsigned char t800x600[3][24] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,61, + 0,18,25,30,27,31,31,31, 0, 0, 0, 0 }, + {55, 0, 0, 0, 0, 9,10,15,18,19, 0, 0, + ... to be continued + + depthindex = (pSiS->CurrentLayout.bitsPerPixel + 1) >> 3; + if(depthindex == 3) return(0); + if(depthindex == 4) depthindex--; + depthindex--; + + switch(mode->HDisplay) { + case 640: + if(mode->VDisplay == 480) { + return(t640x480[depthindex][index]; + } else return(0); + case 800: + if(mode->VDisplay == 600) { + return(t800x600[depthindex][index]; + } else return(0); + case 1024: + if(mode->VDisplay == 768) { + return(t1024x768[depthindex][index]; + } else return(0); + case 1280: + if(mode->VDisplay == 1024) { + return(t1280x1024[depthindex][index]; + } else return(0); + case 1600: + if(mode->VDisplay == 1200) { + return(t1600x1200[depthindex][index]; + } else return(0); + default: return(0); + } +} +#endif + +/* TW: Stub */ +static void +SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, + unsigned short *Low, unsigned short *High) +{ + return; } + /* Auxiliary function to find real memory clock (in Khz) */ +/* TW: Not for 530/620 if UMA (on these, the mclk is stored in SR10) */ int SiSMclk(SISPtr pSiS) { - int mclk; - unsigned char Num, Denum, Base; + int mclk; + unsigned char Num, Denum, Base; - /* Numerator */ switch (pSiS->Chipset) { - case PCI_CHIP_SG86C201: - case PCI_CHIP_SG86C202: - case PCI_CHIP_SG86C205: - case PCI_CHIP_SG86C215: - case PCI_CHIP_SG86C225: case PCI_CHIP_SIS5597: case PCI_CHIP_SIS6326: case PCI_CHIP_SIS530: - read_xr(MemClock0,Num); - mclk=14318*((Num & 0x7f)+1); + /* Numerator */ + inSISIDXREG(SISSR, MemClock0, Num); + mclk = 14318 * ((Num & 0x7f) + 1); /* Denumerator */ - read_xr(MemClock1,Denum); - mclk=mclk/((Denum & 0x1f)+1); + inSISIDXREG(SISSR, MemClock1, Denum); + mclk = mclk / ((Denum & 0x1f) + 1); - /* Divider. Don't seems to work for mclk in older cards */ - if ( (Num & 0x80)!=0 ) { - mclk = mclk*2; - } - - /* Post-scaler. Values depends on SR13 bit 7 */ - outb(VGA_SEQ_INDEX, ClockBase); - Base = inb(VGA_SEQ_DATA); + /* Divider. Doesn't seem to work for mclk in older cards */ + if((Num & 0x80) != 0) mclk *= 2; - if ( (Base & 0x80)==0 ) { - mclk = mclk / (((Denum & 0x60) >> 5)+1); - } - else { + /* Post-scaler. Values' meaning depends on SR13 bit 7 */ + inSISIDXREG(SISSR, ClockBase, Base); + if((Base & 0x80) == 0) { + mclk = mclk / (((Denum & 0x60) >> 5) + 1); + } else { /* Values 00 and 01 are reserved */ - if ((Denum & 0x60) == 0x40) { mclk=mclk/6; } - if ((Denum & 0x60) == 0x60) { mclk=mclk/8; } + if ((Denum & 0x60) == 0x40) mclk /= 6; + if ((Denum & 0x60) == 0x60) mclk /= 8; } break; case PCI_CHIP_SIS300: case PCI_CHIP_SIS540: case PCI_CHIP_SIS630: + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: /* Numerator */ - read_xr(0x28, Num); - mclk = 14318*((Num &0x7f)+1); + inSISIDXREG(SISSR, 0x28, Num); + mclk = 14318 * ((Num & 0x7f) + 1); /* Denumerator */ - read_xr(0x29, Denum); - mclk = mclk/((Denum & 0x1f)+1); + inSISIDXREG(SISSR, 0x29, Denum); + mclk = mclk / ((Denum & 0x1f) + 1); /* Divider */ - if ((Num & 0x80)!=0) { - mclk = mclk * 2; - } + if((Num & 0x80) != 0) mclk *= 2; /* Post-Scaler */ - if ((Denum & 0x80)==0) { + if((Denum & 0x80) == 0) { mclk = mclk / (((Denum & 0x60) >> 5) + 1); - } - else { + } else { mclk = mclk / ((((Denum & 0x60) >> 5) + 1) * 2); } break; default: + xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR, + "Internal error: SiSMClk() called with invalid chipset (0x%x)\n", + pSiS->Chipset); mclk = 0; } return(mclk); } +/* TW: This estimates the CRT2 clock we are going to use. + * The total bandwidth is to be reduced by the value + * returned here in order to get an idea of the maximum + * dotclock left for CRT1. + * Since we don't know yet, what mode the user chose, + * we return the maximum dotclock used by + * - either the LCD attached, or + * - TV + * For VGA2, we share the bandwith equally. + */ +static int +SiSEstimateCRT2Clock(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + if(pSiS->VBFlags & CRT2_LCD) { + if(pSiS->VBLCDFlags & (VB_LCD_320x480 | VB_LCD_800x600 | VB_LCD_640x480)) + return 40000; + else if(pSiS->VBLCDFlags & (VB_LCD_1024x768 | VB_LCD_1024x600)) + return 65000; + else if(pSiS->VBLCDFlags & (VB_LCD_1152x768 | VB_LCD_1280x1024 | VB_LCD_1280x960)) + return 108000; + else if(pSiS->VBLCDFlags & VB_LCD_1400x1050) + return 122000; + else if(pSiS->VBLCDFlags & VB_LCD_1600x1200) + return 162000; + else + return 108000; + } else if(pSiS->VBFlags & CRT2_TV) { + if(pSiS->VBFlags & VB_CHRONTEL) { + switch(pSiS->VGAEngine) { + case SIS_300_VGA: + return 50000; + case SIS_315_VGA: + default: + return 70000; + } + } else if(pSiS->VBFlags & VB_SISBRIDGE) { + return 70000; + } + } + + return 0; +} + +/* Calculate the maximum dotclock */ int SiSMemBandWidth(ScrnInfoPtr pScrn) -{ +{ SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif int bus = pSiS->BusWidth; int mclk = pSiS->MemClock; - int bpp = pScrn->bitsPerPixel; - float magic, total; - const float magic300[4] = { 1.2, 1.368421, 2.263158, 1.2}; + int bpp = pSiS->CurrentLayout.bitsPerPixel; + int bytesperpixel = (bpp + 7) / 8; + float magic=0.0, total, crt2used; + int crt2clock, max=0; + const float magic300[4] = { 1.2, 1.368421, 2.263158, 1.2}; const float magic630[4] = { 1.441177, 1.441177, 2.588235, 1.441177 }; + const float magic315[4] = { 1.2, 1.368421, 1.368421, 1.2 }; + const float magic550[4] = { 1.441177, 1.441177, 2.588235, 1.441177 }; switch (pSiS->Chipset) { - case PCI_CHIP_SIS6326: - return 175000; /* guest */ - + case PCI_CHIP_SIS5597: - if (((pReg->sisRegs3C4[Mode64] >> 1) & 3) == 0) /* Only 1 bank Vram */ - mclk = (mclk * 8); - else - mclk = (mclk * 16); - if ((pReg->sisRegs3C4[ExtMiscCont5] & 0xC0) == 0xC0) - mclk=mclk*2; - return(mclk); + total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel; + if(total > 135000) total = 135000; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Maximum pixel clock at %d bpp is %g MHz\n", + bpp, total/1000); + return(int)(total); + + case PCI_CHIP_SIS6326: + total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel; + if(total > 175500) total = 175500; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Maximum pixel clock at %d bpp is %g MHz\n", + bpp, total/1000); + return(int)(total); + + case PCI_CHIP_SIS530: + total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel; + if(total > 230000) total = 230000; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Maximum pixel clock at %d bpp is %g MHz\n", + bpp, total/1000); + return(int)(total); case PCI_CHIP_SIS300: case PCI_CHIP_SIS540: case PCI_CHIP_SIS630: - if (pSiS->Chipset==PCI_CHIP_SIS300) - magic = magic300[bus/64]; - else - magic = magic630[bus/64]; - + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS330: + switch(pSiS->Chipset) { + case PCI_CHIP_SIS300: + magic = magic300[bus/64]; + max = 540000; + break; + case PCI_CHIP_SIS540: + case PCI_CHIP_SIS630: + magic = magic630[bus/64]; + max = 540000; + break; + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + magic = magic315[bus/64]; + max = 780000; + break; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + magic = magic550[bus/64]; + max = 780000; + } + PDEBUG(ErrorF("mclk: %d, bus: %d, magic: %g, bpp: %d\n", mclk, bus, magic, bpp)); - - total = mclk*bus/bpp; - - ErrorF("Total Adapter Bandwidth is %gM\n", total/1000); - - if (pSiS->VBFlags & CRT2_ENABLE) { - if (total/2 > 540000) - total -= 540000; - else + + total = mclk * bus / bpp; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Memory bandwidth at %d bpp is %g MHz\n", bpp, total/1000); + + if(pSiS->VBFlags & CRT2_ENABLE) { + + crt2used = 0.0; + crt2clock = SiSEstimateCRT2Clock(pScrn); + if(crt2clock) { + crt2used = crt2clock + 2000; + } + +#ifdef SISDUALHEAD + if((pSiS->DualHeadMode) && (pSiSEnt)) { + + if(!pSiS->SecondHead) { + + /* TW: First head = CRT2 */ + + if(crt2clock) { + /* TW: We use the mem bandwidth as max clock; this + * might exceed the 70% limit a bit, but that + * does not matter; we take care of that limit + * when we calc CRT1. Overall, we might use up + * to 85% of the memory bandwidth, which seems + * enough to use accel and video. + * The "* macic" is just to compensate the + * calculation below. + */ + total = crt2used * magic; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth reserved for CRT2 is %g Mhz\n", + crt2used/1000); + } else { + /* We don't know about the second head's + * depth yet. So we assume it uses the + * same. + */ total /= 2; - ErrorF("CRT1 Used Bandwidth is %gM\n", total/1000); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth reserved for CRT2 is %g Mhz\n", + total/1000); + } + + } else { + + /* TW: Second head = CRT1 */ + + /* Now We know about the first head's depth, + * so we can calculate more accurately. + */ + + if(crt2clock) { + total -= (crt2used * pSiSEnt->pScrn_1->bitsPerPixel / bpp); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth reserved for CRT2 at %d bpp is %g Mhz\n", + bpp, + (crt2used * pSiSEnt->pScrn_1->bitsPerPixel / bpp)/1000); + } else { + total -= (pSiSEnt->maxUsedClock * pSiSEnt->pScrn_1->bitsPerPixel / bpp); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth reserved for CRT2 at %d bpp is %d Mhz\n", + bpp, + (pSiSEnt->maxUsedClock * pSiSEnt->pScrn_1->bitsPerPixel / bpp)/1000); + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth available for CRT1 is %g MHz\n", total/1000); + + } + + } else { +#endif + if(crt2clock) { + total -= crt2used; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth reserved for CRT2 is %g Mhz\n", crt2used/1000); + } else { + total /= 2; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth reserved for CRT2 is %g Mhz\n", total/1000); + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bandwidth available for CRT1 is %g MHz\n", total/1000); +#ifdef SISDUALHEAD + } +#endif + } - return (int)(total/magic); + total /= magic; + if(total > (max / 2)) total = max / 2; + return (int)(total); - case PCI_CHIP_SIS530: - return 230000; /* guest */ default: - return 135000; /* guest */ + return 135000; /* guessed */ } } +/* TW: Load the palette. We do this for all supported color depths + * in order to support gamma correction. We hereby convert the + * given colormap to a complete 24bit color palette and enable + * the correspoding bit in SR7 to enable the 24bit lookup table. + * Gamma correction is only supported on CRT1. + * Why are there 6-bit-RGB values submitted even if bpp is 16 and + * weight is 565? (Maybe because rgbBits is 6?) + */ void -SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, - VisualPtr pVisual) +SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, + VisualPtr pVisual) { SISPtr pSiS = SISPTR(pScrn); - int i, index; + int i, j, index; PDEBUG(ErrorF("SiSLoadPalette(%d)\n", numColors)); - for (i=0; i<numColors; i++) { - index = indicies[i]; -#if 0 - outSISREG(0x3c8, index); - outSISREG(0x3c9, colors[index].red >> 2); - outSISREG(0x3c9, colors[index].green >> 2); - outSISREG(0x3c9, colors[index].blue >> 2); -#endif - outSISREG(pSiS->RelIO+0x48, index); - outSISREG(pSiS->RelIO+0x49, colors[index].red >> 2); - outSISREG(pSiS->RelIO+0x49, colors[index].green >> 2); - outSISREG(pSiS->RelIO+0x49, colors[index].blue >> 2); - } - switch (pSiS->Chipset) { - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - case PCI_CHIP_SIS300: - if (pSiS->VBFlags & CRT2_ENABLE) { - (*pSiS->LoadCRT2Palette)(pScrn, numColors, indicies, - colors, pVisual); + +#ifdef SISDUALHEAD + /* TW: No palette changes on CRT2 if in dual head mode */ + if((pSiS->DualHeadMode) && (!pSiS->SecondHead)) return; +#endif + + switch(pSiS->CurrentLayout.depth) { +#ifdef SISGAMMA + case 15: + orSISIDXREG(SISSR, 0x07, 0x04); + for(i=0; i<numColors; i++) { + index = indices[i]; + if(index < 32) { /* Paranoia */ + for(j=0; j<8; j++) { + outSISREG(SISCOLIDX, (index * 8) + j); + outSISREG(SISCOLDATA, colors[index].red << (8- pScrn->rgbBits)); + outSISREG(SISCOLDATA, colors[index].green << (8 - pScrn->rgbBits)); + outSISREG(SISCOLDATA, colors[index].blue << (8 - pScrn->rgbBits)); + } + } + } + break; + case 16: + orSISIDXREG(SISSR, 0x07, 0x04); + for(i=0; i<numColors; i++) { + index = indices[i]; + if(index < 64) { /* Paranoia */ + for(j=0; j<4; j++) { + outSISREG(SISCOLIDX, (index * 4) + j); + outSISREG(SISCOLDATA, colors[index/2].red << (8 - pScrn->rgbBits)); + outSISREG(SISCOLDATA, colors[index].green << (8 - pScrn->rgbBits)); + outSISREG(SISCOLDATA, colors[index/2].blue << (8 - pScrn->rgbBits)); + } + } + } + break; + case 24: + orSISIDXREG(SISSR, 0x07, 0x04); + for(i=0; i<numColors; i++) { + index = indices[i]; + if(index < 256) { /* Paranoia */ + outSISREG(SISCOLIDX, index); + outSISREG(SISCOLDATA, colors[index].red); + outSISREG(SISCOLDATA, colors[index].green); + outSISREG(SISCOLDATA, colors[index].blue); + } + } + break; +#endif + default: + if(pScrn->rgbBits == 8) + orSISIDXREG(SISSR, 0x07, 0x04); + else + andSISIDXREG(SISSR, 0x07, ~0x04); + for(i=0; i<numColors; i++) { + index = indices[i]; + outSISREG(SISCOLIDX, index); + outSISREG(SISCOLDATA, colors[index].red >> (8 - pScrn->rgbBits)); + outSISREG(SISCOLDATA, colors[index].green >> (8 - pScrn->rgbBits)); + outSISREG(SISCOLDATA, colors[index].blue >> (8 - pScrn->rgbBits)); + } + } + + switch(pSiS->VGAEngine) { + case SIS_300_VGA: + case SIS_315_VGA: + if(pSiS->VBFlags & CRT2_ENABLE) { + /* TW: Only the SiS bridges support a CRT2 palette */ + if(pSiS->VBFlags & VB_SISBRIDGE) { + (*pSiS->LoadCRT2Palette)(pScrn, numColors, indices, + colors, pVisual); + } } break; } + } static void -SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, +SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) { SISPtr pSiS = SISPTR(pScrn); int i, index; PDEBUG(ErrorF("SiS301LoadPalette(%d)\n", numColors)); - for (i=0; i<numColors; i++) { - index = indicies[i]; - outSISREG(pSiS->RelIO+0x16, index); - outSISREG(pSiS->RelIO+0x17, colors[index].red); - outSISREG(pSiS->RelIO+0x17, colors[index].green); - outSISREG(pSiS->RelIO+0x17, colors[index].blue); - } -} - -struct QConfig { - int GT; - int QC; -}; - -static struct QConfig qconfig[20] = { - {1, 0x0}, {1, 0x2}, {1, 0x4}, {1, 0x6}, {1, 0x8}, - {1, 0x3}, {1, 0x5}, {1, 0x7}, {1, 0x9}, {1, 0xb}, - {0, 0x0}, {0, 0x2}, {0, 0x4}, {0, 0x6}, {0, 0x8}, - {0, 0x3}, {0, 0x5}, {0, 0x7}, {0, 0x9}, {0, 0xb}}; - -static int cycleA[20][2] = { - {88,88}, {80,80}, {78,78}, {72,72}, {70,70}, - {79,72}, {77,70}, {71,64}, {69,62}, {49,44}, - {73,78}, {65,70}, {63,68}, {57,62}, {55,60}, - {64,62}, {62,60}, {56,54}, {54,52}, {34,34}}; - -static void -SiS630Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High) -{ - SISPtr pSiS = SISPTR(pScrn); - int mclk = pSiS->MemClock; - int vclk = mode->Clock; - int bpp = pScrn->bitsPerPixel/8; - int buswidth = pSiS->BusWidth; - CARD32 temp; - PCITAG NBridge; - int cyclea; - int low, lowa; - - int i, j; - - - if (!bpp) - bpp = 1; - - i = 0; - j = buswidth/128; - - while (1) { -#ifdef DEBUG - ErrorF("Config %d GT = %d, QC = %x, CycleA = %d\n", - i, qconfig[i].GT, qconfig[i].QC, cycleA[i][j]); -#endif - cyclea = cycleA[i][j]; - lowa = cyclea * vclk * bpp; - lowa = (lowa + (mclk-1)) / mclk; - lowa = (lowa + 15) / 16; - low = lowa + 1; - if (low <= 0x13) - break; - else - if (i < 19) - i++; - else { - low = 0x13; - PDEBUG(ErrorF("This mode may has threshold " - "problem and had better removed\n")); - break; - } - } - PDEBUG(ErrorF("Using Config %d with CycleA = %d\n", i, cyclea)); - *Low = low; - if (lowa+4 > 15) - *High = 0x0F; - else - *High = lowa+4; - - /* write PCI configuration space */ - NBridge = pciTag(0, 0, 0); - temp = pciReadLong(NBridge, 0x50); - temp &= 0xF0FFFFFF; - temp |= qconfig[i].QC << 24; - pciWriteLong(NBridge, 0x50, temp); - - temp = pciReadLong(NBridge, 0xA0); - temp &= 0xF0FFFFFF; - temp |= qconfig[i].GT << 24; - pciWriteLong(NBridge, 0xA0, temp); -} - -struct funcargc { - char base; - char inc; -}; - -static struct funcargc funca[12] = { - {61, 3}, {52, 5}, {68, 7}, {100, 11}, - {43, 3}, {42, 5}, {54, 7}, {78, 11}, - {34, 3}, {37, 5}, {47, 7}, {67, 11}}; -static struct funcargc funcb[12] = { - {81, 4}, {72, 6}, {88, 8}, {120, 12}, - {55, 4}, {54, 6}, {66, 8}, {90, 12}, - {42, 4}, {45, 6}, {55, 8}, {75, 12}}; -static char timing[8] = {1, 2, 2, 3, 0, 1, 1, 2}; - -static void -SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High) -{ - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; - int mclk = pSiS->MemClock; - int vclk = mode->Clock; - int bpp = pScrn->bitsPerPixel/8; - int lowa, lowb, low; - struct funcargc *p; - unsigned int i, j; - - pReg->sisRegs3C4[0x16] = pSiS->SavedReg.sisRegs3C4[0x16]; - - if (!bpp) bpp = 1; - - do { - i = GETBITSTR(pReg->sisRegs3C4[0x18], 6:5, 2:1) | - GETBITS(pReg->sisRegs3C4[0x18], 1:1); - j = GETBITSTR(pReg->sisRegs3C4[0x14], 7:6, 3:2) | - GETBITS(pReg->sisRegs3C4[0x16], 7:6); - p = &funca[j]; - - lowa = (p->base + p->inc*timing[i])*vclk*bpp; - lowa = (lowa + (mclk-1)) / mclk; - lowa = (lowa + 15)/16; - - p = &funcb[j]; - lowb = (p->base + p->inc*timing[i])*vclk*bpp; - lowb = (lowb + (mclk-1)) / mclk; - lowb = (lowb + 15)/16; - - if (lowb < 4) - lowb = 0; - else - lowb -= 4; - - low = (lowa > lowb)? lowa: lowb; - - low++; - - if (low <= 0x13) { - break; - } else { - i = GETBITS(pReg->sisRegs3C4[0x16], 7:6); - if (!i) { - low = 0x13; - break; - } else { - i--; - pReg->sisRegs3C4[0x16] &= 0x3C; - pReg->sisRegs3C4[0x16] |= (i << 6); - } + for(i=0; i<numColors; i++) { + index = indices[i]; + outSISREG(SISCOL2IDX, index); + outSISREG(SISCOL2DATA, colors[index].red); + outSISREG(SISCOL2DATA, colors[index].green); + outSISREG(SISCOL2DATA, colors[index].blue); } - } while (1); - - *Low = low; - if (low+3 > 15) - *High = 0x0F; - else - *High = low+3; } -static void -SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High) -{ - SISPtr pSiS = SISPTR(pScrn); - unsigned int factor, z; - unsigned int vclk = mode->Clock, - bpp = pScrn->bitsPerPixel, - mclk = pSiS->MemClock, - buswidth = pSiS->BusWidth; - - if (pSiS->Flags & UMA) - factor = 0x60; - else - factor = 0x30; - z = factor * vclk * bpp; - z = z / mclk / buswidth; - *Low = (z+1)/2 + 4; - if (*Low > 0x1F) - *Low = 0x1F; - *High = 0x1F; -} - -static void -SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High) -{ - return; - -} - +#ifdef DEBUG +/* TW: Debug function to dump registers */ void SiSIODump(ScrnInfoPtr pScrn) -{ SISPtr pSiS = SISPTR(pScrn); - int i, max3c4, min3d4, max3d4; - int SR5State; - unsigned char temp; +{ + SISPtr pSiS = SISPTR(pScrn); + int i, max3c4, min3d4, max3d4; + unsigned char temp; switch (pSiS->Chipset) { case PCI_CHIP_SIS6326: @@ -1276,20 +1973,29 @@ case PCI_CHIP_SIS300: case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: - max3c4 = 0x3D; + max3c4 = 0x3D; max3d4 = 0x37; min3d4 = 0x30; break; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + max3c4 = 0x3D; + max3d4 = 0x5f; + min3d4 = 0x30; + break; default: max3c4 = 0x38; max3d4 = 0x19; min3d4 = 0x26; } /* dump Misc Registers */ - /*temp = inb(0x3CC);*/ temp = inb(pSiS->RelIO+0x4c); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Misc Output 3CC=%x\n", temp); - /*temp = inb(0x3CA);*/ + temp = inb(pSiS->RelIO+0x4a); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Feature Control 3CA=%x\n", temp); @@ -1298,10 +2004,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Registers 3CE\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "-------------\n"); for (i=0; i<=8; i++) { - /*outb(0x3ce, i); - temp = inb(0x3cf);*/ - outb(pSiS->RelIO+0x4e, i); - temp = inb(pSiS->RelIO+0x4f); + inSISIDXREG(SISGR, i, temp); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%2x]=%2x\n", i, temp); } @@ -1310,26 +2013,16 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Registers 3C4\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "-------------\n"); for (i=0; i<=4; i++) { - /*outb(0x3c4, i); - temp = inb(0x3c5);*/ - outb(pSiS->RelIO+0x44, i); - temp = inb(pSiS->RelIO+0x45); + inSISIDXREG(SISSR, i, temp); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%2x]=%2x\n", i, temp); } /* dump extended SR */ - /*outb(0x3c4, 5); - SR5State = inb(0x3c5);*/ - outb(pSiS->RelIO+0x44, 5); - SR5State = inb(pSiS->RelIO+0x45); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[05]=%2x\n", SR5State); - /*outw(0x3c4, 0x8605);*/ - outw(pSiS->RelIO+0x44, 0x8605); - for (i=6; i<=max3c4; i++) { - /*outb(0x3c4, i); - temp = inb(0x3c5);*/ - outb(pSiS->RelIO+0x44, i); - temp = inb(pSiS->RelIO+0x45); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + for (i=5; i<=max3c4; i++) { + inSISIDXREG(SISSR, i, temp); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%2x]=%2x\n", i, temp); } @@ -1338,19 +2031,16 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Registers 3D4\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "-------------\n"); for (i=0; i<=0x18; i++) { - outb(0x3d4, i); - temp = inb(0x3d5); + inSISIDXREG(SISCR, i, temp); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%2x]=%2x\n", i, temp); } - for (i=min3d4; i<=max3d4; i++) { /* dump extended CR */ - outb(0x3d4, i); - temp = inb(0x3d5); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%2x]=%2x\n", i, temp); + /* dump extended CR */ + for (i=min3d4; i<=max3d4; i++) { + inSISIDXREG(SISCR, i, temp); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%2x]=%2x\n", i, temp); } - /*outw(0x3c4, SR5State << 8 | 0x05);*/ - outw(pSiS->RelIO+0x44, SR5State << 8 | 0x05); } - +#endif void SISDACPreInit(ScrnInfoPtr pScrn) @@ -1358,54 +2048,51 @@ SISPtr pSiS = SISPTR(pScrn); switch (pSiS->Chipset) { - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - pSiS->MaxClock = SiSMemBandWidth(pScrn); - pSiS->SiSSave = SiS300Save; - pSiS->SiSSave2 = SiS301Save; - pSiS->SiSSave3 = SiS301BSave; - pSiS->SiSSaveLVDS = SiSLVDSSave; - pSiS->SiSSaveChrontel = SiSChrontelSave; - pSiS->SiSRestore = SiS300Restore; - pSiS->SiSRestore2 = SiS301Restore; - pSiS->SiSRestore3 = SiS301BRestore; - pSiS->SiSRestoreLVDS = SiSLVDSRestore; - pSiS->SiSRestoreChrontel= SiSChrontelRestore; - pSiS->LoadCRT2Palette = SiS301LoadPalette; - pSiS->SetThreshold = SiS630Threshold; - break; - case PCI_CHIP_SIS300: - pSiS->MaxClock = SiSMemBandWidth(pScrn); - pSiS->SiSSave = SiS300Save; - pSiS->SiSSave2 = SiS301Save; - pSiS->SiSSave3 = SiS301BSave; - pSiS->SiSSaveLVDS = SiSLVDSSave; - pSiS->SiSSaveChrontel = SiSChrontelSave; - pSiS->SiSRestore = SiS300Restore; - pSiS->SiSRestore2 = SiS301Restore; - pSiS->SiSRestore3 = SiS301BRestore; - pSiS->SiSRestoreLVDS = SiSLVDSRestore; - pSiS->SiSRestoreChrontel= SiSChrontelRestore; - pSiS->LoadCRT2Palette = SiS301LoadPalette; - pSiS->SetThreshold = SiS300Threshold; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSSave = SiS310Save; + pSiS->SiSSave2 = SiS301Save; + pSiS->SiSSave3 = SiS301BSave; + pSiS->SiSSaveLVDSChrontel = SiSLVDSChrontelSave; + pSiS->SiSRestore = SiS310Restore; + pSiS->SiSRestore2 = SiS301Restore; + pSiS->SiSRestore3 = SiS301BRestore; + pSiS->SiSRestoreLVDSChrontel = SiSLVDSChrontelRestore; + pSiS->LoadCRT2Palette = SiS301LoadPalette; + pSiS->SetThreshold = SiSThreshold; + pSiS->i2cInit = NULL; /* SiSI2CInit; */ break; - case PCI_CHIP_SIS530: - pSiS->MaxClock = SiSMemBandWidth(pScrn); - pSiS->SiSRestore = SiSRestore; - pSiS->SiSSave = SiSSave; - pSiS->SetThreshold = SiS530Threshold; + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSSave = SiS300Save; + pSiS->SiSSave2 = SiS301Save; + pSiS->SiSSave3 = SiS301BSave; + pSiS->SiSSaveLVDSChrontel = SiSLVDSChrontelSave; + pSiS->SiSRestore = SiS300Restore; + pSiS->SiSRestore2 = SiS301Restore; + pSiS->SiSRestore3 = SiS301BRestore; + pSiS->SiSRestoreLVDSChrontel = SiSLVDSChrontelRestore; + pSiS->LoadCRT2Palette = SiS301LoadPalette; + pSiS->SetThreshold = SiSThreshold; + pSiS->i2cInit = NULL; /* SiSI2CInit; */ break; - case PCI_CHIP_SIS6326: - pSiS->MaxClock = SiSMemBandWidth(pScrn); - pSiS->SiSRestore = SiSRestore; - pSiS->SiSSave = SiSSave; - pSiS->SetThreshold = SiSThreshold; + case PCI_CHIP_SIS5597: + case PCI_CHIP_SIS6326: + case PCI_CHIP_SIS530: + default: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSRestore = SiSRestore; + pSiS->SiSSave = SiSSave; + pSiS->SetThreshold = SiSThreshold; + pSiS->i2cInit = NULL; break; - default: - pSiS->MaxClock = SiSMemBandWidth(pScrn); - pSiS->SiSRestore = SiSRestore; - pSiS->SiSSave = SiSSave; - pSiS->SetThreshold = SiSThreshold; } } @@ -1417,4 +2104,45 @@ for (index=from; index <= to; index++, DataPtr++) { outSISIDXREG(port, index, *DataPtr); } +} + +void +SiS6326SetTVReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data) +{ + SISPtr pSiS = SISPTR(pScrn); + outSISIDXREG(SISCR, 0xE0, index); + outSISIDXREG(SISCR, 0xE1, data); +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "SiS6326: Setting Tv %02x to %02x\n", index, data); +#endif +} + +unsigned char +SiS6326GetTVReg(ScrnInfoPtr pScrn, CARD8 index) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char data; + + outSISIDXREG(SISCR, 0xE0, index); + inSISIDXREG(SISCR, 0xE1, data); + return(data); +} + +void +SiS6326SetXXReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data) +{ + SISPtr pSiS = SISPTR(pScrn); + outSISIDXREG(SISCR, 0xE2, index); + outSISIDXREG(SISCR, 0xE3, data); +} + +unsigned char +SiS6326GetXXReg(ScrnInfoPtr pScrn, CARD8 index) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char data; + + outSISIDXREG(SISCR, 0xE2, index); + inSISIDXREG(SISCR, 0xE3, data); + return(data); } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.4 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h Wed Jan 29 10:42:17 2003 @@ -1,5 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.4 2002/01/17 09:57:30 eich Exp $ */ -int SiScompute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.7 2003/01/29 15:42:17 eich Exp $ */ + +int SiS_compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, int *out_sbit, int *out_scale); void SISDACPreInit(ScrnInfoPtr pScrn); unsigned int SiSddc1Read(ScrnInfoPtr pScrn); @@ -9,7 +10,44 @@ unsigned int *vclk); void SiSIODump(ScrnInfoPtr pScrn); -int SiSMemBandWidth(ScrnInfoPtr pScrn); -int SiSMclk(SISPtr pSiS); +int SiSMemBandWidth(ScrnInfoPtr pScrn); +int SiSMclk(SISPtr pSiS); void SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg); + +extern void SiS6326SetTVReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data); +extern unsigned char SiS6326GetTVReg(ScrnInfoPtr pScrn, CARD8 index); +extern void SiS6326SetXXReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data); +extern unsigned char SiS6326GetXXReg(ScrnInfoPtr pScrn, CARD8 index); + +extern int SiSCalcVRate(DisplayModePtr mode); + +/* TW: Functions from init.c & init301.c */ +extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +extern void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +extern void SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr); +extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx); +extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx); +extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); +extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); +extern USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx); +extern void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx); +extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh); +extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime); +extern USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, + USHORT DDCdatatype, unsigned char *buffer); +extern void SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo); +extern void SiS_DisplayOn(SiS_Private *SiS_Pr); +extern unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id); +#if 0 +extern void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr); +extern USHORT SiS_I2C_GetByte(SiS_Private *SiS_Pr); +extern Bool SiS_I2C_PutByte(SiS_Private *SiS_Pr, USHORT data); +extern Bool SiS_I2C_Address(SiS_Private *SiS_Pr, USHORT addr); +extern void SiS_I2C_Stop(SiS_Private *SiS_Pr); +#endif + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.3 Thu Jan 10 14:05:45 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c Wed Jan 29 10:42:17 2003 @@ -1,27 +1,33 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.5 2003/01/29 15:42:17 eich Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK. + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria * + * Portions from radeon_dga.c which is + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and + * VA Linux Systems Inc., Fremont, California. + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the providers not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The providers make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE PROVIDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE PROVIDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> + * Thomas Winischhofer <thomas@winischhofer.net> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.3 2002/01/10 19:05:45 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,7 +40,6 @@ #include "sis_regs.h" #include "dgaproc.h" -Bool SISDGAInit(ScreenPtr pScreen); static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, int *, int *); static Bool SIS_SetMode(ScrnInfoPtr, DGAModePtr); @@ -43,10 +48,8 @@ static void SIS_SetViewport(ScrnInfoPtr, int, int, int); static void SIS_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void SIS_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 -static void SIS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, +static void SIS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); -#endif static DGAFunctionRec SISDGAFuncs = { @@ -58,107 +61,200 @@ SIS_Sync, SIS_FillRect, SIS_BlitRect, -#if 0 - SIS_BlitTransRect, -#else NULL -#endif }; -Bool -SISDGAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSIS = SISPTR(pScrn); - DGAModePtr modes = NULL, newmodes = NULL, currentMode; +static +DGAFunctionRec SISDGAFuncs3xx = { + SIS_OpenFramebuffer, + NULL, + SIS_SetMode, + SIS_SetViewport, + SIS_GetViewport, + SIS_Sync, + SIS_FillRect, + SIS_BlitRect, + SIS_BlitTransRect +}; + +static DGAModePtr +SISSetupDGAMode( + ScrnInfoPtr pScrn, + DGAModePtr modes, + int *num, + int bitsPerPixel, + int depth, + Bool pixmap, + int secondPitch, + unsigned long red, + unsigned long green, + unsigned long blue, + short visualClass +){ + SISPtr pSiS = SISPTR(pScrn); + DGAModePtr newmodes = NULL, currentMode; DisplayModePtr pMode, firstMode; - int Bpp = pScrn->bitsPerPixel >> 3; - int num = 0; + int otherPitch, Bpp = bitsPerPixel >> 3; Bool oneMore; pMode = firstMode = pScrn->modes; - while(pMode) { + while (pMode) { -#if 0 - if(pScrn->displayWidth != pMode->HDisplay) { - newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec)); - oneMore = TRUE; - } else { -#endif - newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); - oneMore = FALSE; - /* } */ - - if(!newmodes) { - xfree(modes); - return FALSE; - } - modes = newmodes; + otherPitch = secondPitch ? secondPitch : pMode->HDisplay; + + if(pMode->HDisplay != otherPitch) { + + newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec)); + oneMore = TRUE; + + } else { + + newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)); + oneMore = FALSE; + + } + + if(!newmodes) { + xfree(modes); + return NULL; + } + modes = newmodes; SECOND_PASS: - currentMode = modes + num; - num++; + currentMode = modes + *num; + (*num)++; - currentMode->mode = pMode; - currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; - if(pMode->Flags & V_DBLSCAN) - currentMode->flags |= DGA_DOUBLESCAN; - if(pMode->Flags & V_INTERLACE) - currentMode->flags |= DGA_INTERLACED; - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = pScrn->depth; - currentMode->bitsPerPixel = pScrn->bitsPerPixel; - currentMode->red_mask = pScrn->mask.red; - currentMode->green_mask = pScrn->mask.green; - currentMode->blue_mask = pScrn->mask.blue; - currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = 1; - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - currentMode->address = pSIS->FbBase; - - if(oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pMode->VDisplay; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = - ((pScrn->displayWidth * Bpp) + 3) & ~3L; - currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pMode->VDisplay; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - } - - pMode = pMode->next; - if(pMode == firstMode) - break; + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS; + if(pixmap) + currentMode->flags |= DGA_PIXMAP_AVAILABLE; + if(!pSiS->NoAccel) { + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if((pSiS->VGAEngine == SIS_300_VGA) || + (pSiS->VGAEngine == SIS_315_VGA) || + (pSiS->VGAEngine == SIS_530_VGA)) { + currentMode->flags |= DGA_BLIT_RECT_TRANS; + } + } + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = depth; + currentMode->bitsPerPixel = bitsPerPixel; + currentMode->red_mask = red; + currentMode->green_mask = green; + currentMode->blue_mask = blue; + currentMode->visualClass = visualClass; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pSiS->FbBase; + + if(oneMore) { + + /* first one is narrow width */ + currentMode->bytesPerScanline = (((pMode->HDisplay * Bpp) + 3) & ~3L); + currentMode->imageWidth = pMode->HDisplay; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = (currentMode->imageHeight - + currentMode->viewportHeight); + oneMore = FALSE; + goto SECOND_PASS; + + } else { + + currentMode->bytesPerScanline = ((otherPitch * Bpp) + 3) & ~3L; + currentMode->imageWidth = otherPitch; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = (currentMode->imageWidth - + currentMode->viewportWidth); + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = (currentMode->imageHeight - + currentMode->viewportHeight); + } + + pMode = pMode->next; + if (pMode == firstMode) + break; + } + + return modes; +} + + +Bool +SISDGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + DGAModePtr modes = NULL; + int num = 0; + + /* 8 */ +#ifdef SISDUALHEAD + /* TW: We don't ever use 8bpp modes in dual head mode, + so don't offer them to DGA either + */ + if(!pSiS->DualHeadMode) { +#endif + modes = SISSetupDGAMode(pScrn, modes, &num, 8, 8, + (pScrn->bitsPerPixel == 8), + ((pScrn->bitsPerPixel != 8) + ? 0 : pScrn->displayWidth), + 0, 0, 0, PseudoColor); +#ifdef SISDUALHEAD + } +#endif + + /* 16 */ + modes = SISSetupDGAMode(pScrn, modes, &num, 16, 16, + (pScrn->bitsPerPixel == 16), + ((pScrn->depth != 16) + ? 0 : pScrn->displayWidth), + 0xf800, 0x07e0, 0x001f, TrueColor); + + if((pSiS->VGAEngine == SIS_530_VGA) || (pSiS->VGAEngine == SIS_OLD_VGA)) { + /* 24 */ + modes = SISSetupDGAMode(pScrn, modes, &num, 24, 24, + (pScrn->bitsPerPixel == 24), + ((pScrn->bitsPerPixel != 24) + ? 0 : pScrn->displayWidth), + 0xff0000, 0x00ff00, 0x0000ff, TrueColor); } - pSIS->numDGAModes = num; - pSIS->DGAModes = modes; + if(pSiS->VGAEngine != SIS_OLD_VGA) { + /* 32 */ + modes = SISSetupDGAMode(pScrn, modes, &num, 32, 24, + (pScrn->bitsPerPixel == 32), + ((pScrn->bitsPerPixel != 32) + ? 0 : pScrn->displayWidth), + 0xff0000, 0x00ff00, 0x0000ff, TrueColor); + } + + pSiS->numDGAModes = num; + pSiS->DGAModes = modes; - return DGAInit(pScreen, &SISDGAFuncs, modes, num); + if((pSiS->VGAEngine == SIS_300_VGA) || + (pSiS->VGAEngine == SIS_315_VGA) || + (pSiS->VGAEngine == SIS_530_VGA)) { + return DGAInit(pScreen, &SISDGAFuncs3xx, modes, num); + } else { + return DGAInit(pScreen, &SISDGAFuncs, modes, num); + } } @@ -167,27 +263,39 @@ ScrnInfoPtr pScrn, DGAModePtr pMode ){ - static int OldDisplayWidth[MAXSCREENS]; + static SISFBLayout BackupLayouts[MAXSCREENS]; int index = pScrn->pScreen->myNum; - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); if(!pMode) { /* restore the original mode */ - /* put the ScreenParameters back */ - pScrn->displayWidth = OldDisplayWidth[index]; + if(pSiS->DGAactive) { + /* put the ScreenParameters back */ + memcpy(&pSiS->CurrentLayout, &BackupLayouts[index], sizeof(SISFBLayout)); + } + + pScrn->currentMode = pSiS->CurrentLayout.mode; + (*pScrn->SwitchMode)(index, pScrn->currentMode, 0); - pSIS->DGAactive = FALSE; - } else { - if(!pSIS->DGAactive) { /* save the old parameters */ - OldDisplayWidth[index] = pScrn->displayWidth; + (*pScrn->AdjustFrame)(index, pScrn->frameX0, pScrn->frameY0, 0); + pSiS->DGAactive = FALSE; + + } else { /* set new mode */ - pSIS->DGAactive = TRUE; + if(!pSiS->DGAactive) { + /* save the old parameters */ + memcpy(&BackupLayouts[index], &pSiS->CurrentLayout, sizeof(SISFBLayout)); + pSiS->DGAactive = TRUE; } - pScrn->displayWidth = pMode->bytesPerScanline / - (pMode->bitsPerPixel >> 3); + pSiS->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel; + pSiS->CurrentLayout.depth = pMode->depth; + pSiS->CurrentLayout.displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3); (*pScrn->SwitchMode)(index, pMode->mode, 0); + /* TW: Adjust viewport to 0/0 after mode switch */ + /* This should fix the vmware-in-dualhead problems */ + (*pScrn->AdjustFrame)(index, 0, 0, 0); } return TRUE; @@ -197,21 +305,21 @@ SIS_GetViewport( ScrnInfoPtr pScrn ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - return pSIS->DGAViewportStatus; + return pSiS->DGAViewportStatus; } static void SIS_SetViewport( - ScrnInfoPtr pScrn, + ScrnInfoPtr pScrn, int x, int y, int flags ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags); - pSIS->DGAViewportStatus = 0; /* SISAdjustFrame loops until finished */ + pSiS->DGAViewportStatus = 0; /* There are never pending Adjusts */ } static void @@ -220,12 +328,12 @@ int x, int y, int w, int h, unsigned long color ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - if(pSIS->AccelInfoPtr) { - (*pSIS->AccelInfoPtr->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pSIS->AccelInfoPtr->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pSIS->AccelInfoPtr); + if(pSiS->AccelInfoPtr) { + (*pSiS->AccelInfoPtr->SetupForSolidFill)(pScrn, color, GXcopy, ~0); + (*pSiS->AccelInfoPtr->SubsequentSolidFillRect)(pScrn, x, y, w, h); + SET_SYNC_FLAG(pSiS->AccelInfoPtr); } } @@ -233,10 +341,10 @@ SIS_Sync( ScrnInfoPtr pScrn ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - if(pSIS->AccelInfoPtr) { - (*pSIS->AccelInfoPtr->Sync)(pScrn); + if(pSiS->AccelInfoPtr) { + (*pSiS->AccelInfoPtr->Sync)(pScrn); } } @@ -247,22 +355,21 @@ int w, int h, int dstx, int dsty ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - if(pSIS->AccelInfoPtr) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pSIS->AccelInfoPtr->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pSIS->AccelInfoPtr->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pSIS->AccelInfoPtr); + if(pSiS->AccelInfoPtr) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pSiS->AccelInfoPtr->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, (CARD32)~0, -1); + (*pSiS->AccelInfoPtr->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + SET_SYNC_FLAG(pSiS->AccelInfoPtr); } } -#if 0 -static void +static void SIS_BlitTransRect( ScrnInfoPtr pScrn, int srcx, int srcy, @@ -270,25 +377,34 @@ int dstx, int dsty, unsigned long color ){ - /* this one should be separate since the XAA function would - prohibit usage of ~0 as the key */ + SISPtr pSiS = SISPTR(pScrn); + + if(pSiS->AccelInfoPtr) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pSiS->AccelInfoPtr->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, ~0, color); + (*pSiS->AccelInfoPtr->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + SET_SYNC_FLAG(pSiS->AccelInfoPtr); + } } -#endif static Bool SIS_OpenFramebuffer( - ScrnInfoPtr pScrn, + ScrnInfoPtr pScrn, char **name, unsigned char **mem, int *size, int *offset, int *flags ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)pSIS->FbAddress; - *size = pSIS->maxxfbmem; + *mem = (unsigned char*)pSiS->FbAddress; + *size = pSiS->maxxfbmem; *offset = 0; *flags = DGA_NEED_ROOT; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.20 Fri Dec 14 19:59:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c Wed Jan 29 10:42:17 2003 @@ -1,6 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.20 2001/12/15 00:59:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.25 2003/01/29 15:42:17 eich Exp $ */ -/* modified from tdfx_dri.c, mga_dri.c */ +/* + * DRI wrapper for 300, 540, 630, 730 + * (310/325 series experimental and incomplete) + * + * taken and modified from tdfx_dri.c, mga_dri.c + */ #include "xf86.h" #include "xf86_OSproc.h" @@ -15,14 +20,28 @@ #include "sis.h" #include "sis_dri.h" -#include "xf86drmSiS.h" +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) +#include "xf86drmCompat.h" +#endif +/* TW: Idle function for 300 series */ #define BR(x) (0x8200 | (x) << 2) #define SiSIdle \ while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ MMIO_IN16(pSiS->IOBase, 0x8240); +/* TW: Idle function for 310/325 series */ +#define Q_STATUS 0x85CC +#define SiS310Idle \ + { \ + while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + MMIO_IN16(pSiS->IOBase, Q_STATUS); \ + } + + extern void GlxSetVisualConfigs( int nconfigs, __GLXvisualConfig *configs, @@ -53,6 +72,10 @@ static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) +extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); +#endif + static Bool SISInitVisualConfigs(ScreenPtr pScreen) { @@ -222,11 +245,22 @@ pDRIInfo->ddxDriverMajorVersion = 0; pDRIInfo->ddxDriverMinorVersion = 1; pDRIInfo->ddxDriverPatchVersion = 0; + pDRIInfo->frameBufferPhysicalAddress = pSIS->FbAddress; - pDRIInfo->frameBufferSize = pSIS->FbMapSize; + + /* TW: This was FbMapSize which is wrong as we must not + * ever overwrite HWCursor and TQ area. On the other + * hand, using availMem here causes MTRR allocation + * to fail ("base is not aligned to size"). Since + * DRI memory management is done via framebuffer + * device, I assume that the size given here + * is NOT used for eventual memory management. + */ + pDRIInfo->frameBufferSize = pSIS->FbMapSize; /* availMem; */ - /* ?? */ + /* TW: scrnOffset is being calulated in sis_vga.c */ pDRIInfo->frameBufferStride = pSIS->scrnOffset; + pDRIInfo->ddxDrawableTableEntry = SIS_MAX_DRAWABLES; if (SAREA_MAX_DRAWABLES < SIS_MAX_DRAWABLES) @@ -235,11 +269,12 @@ pDRIInfo->maxDrawableTableEntry = SIS_MAX_DRAWABLES; #ifdef NOT_DONE - /* FIXME need to extend DRI protocol to pass this size back to client + /* FIXME need to extend DRI protocol to pass this size back to client * for SAREA mapping that includes a device private record */ - pDRIInfo->SAREASize = - ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */ + pDRIInfo->SAREASize = + ((sizeof(XF86DRISAREARec) + getpagesize() - 1) & getpagesize()); /* round to page */ + /* ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); */ /* round to page */ /* + shared memory device private rec */ #else /* For now the mapping works by using a fixed size defined @@ -492,8 +527,15 @@ /* frame control */ saPriv->FrameCount = 0; - *(unsigned long *)(pSiS->IOBase+0x8a2c) = 0; - SiSIdle + if (pSiS->VGAEngine == SIS_315_VGA) { /* 310/325 series */ +#if 0 + *(unsigned long *)(pSiS->IOBase+0x8a2c) = 0; /* FIXME: Where is this on the 310 series ? */ +#endif + SiS310Idle + } else { /* 300 series (and below) */ + *(unsigned long *)(pSiS->IOBase+0x8a2c) = 0; + SiSIdle + } } return DRIFinishScreenInit(pScreen); @@ -505,7 +547,7 @@ DRIContextType newContextType, void *newContext) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); #if 0 if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && @@ -522,10 +564,16 @@ /* * TODO: do this only if X-Server get lock. If kernel supports delayed * signal, needless to do this - */ - *(pSIS->IOBase + 0X8B50) = 0xff; - *(unsigned int *)(pSIS->IOBase + 0x8B60) = -1; - + */ + if (pSiS->VGAEngine == SIS_315_VGA) { +#if 0 + *(pSiS->IOBase + 0x8B50) = 0xff; /* FIXME: Where is this on 310 series */ + *(unsigned int *)(pSiS->IOBase + 0x8B60) = -1; /* FIXME: Where is this on 310 series */ +#endif + } else { + *(pSiS->IOBase + 0x8B50) = 0xff; + *(unsigned int *)(pSiS->IOBase + 0x8B60) = -1; + } } static void @@ -535,7 +583,11 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - SiSIdle + if (pSiS->VGAEngine == SIS_315_VGA) { + SiS310Idle /* 310/325 series */ + } else { + SiSIdle /* 300 series */ + } } static void @@ -546,7 +598,11 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - SiSIdle + if (pSiS->VGAEngine == SIS_315_VGA) { + SiS310Idle /* 310/325 series */ + } else { + SiSIdle /* 300 series and below */ + } } #if 0 Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.78 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.86 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.78 Thu Jan 17 05:49:35 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c Mon Feb 3 21:44:29 2003 @@ -1,33 +1,49 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.86 2003/02/04 02:44:29 dawes Exp $ */ /* * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holder not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holder makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. * - * Fixes for 630 chipsets: Thomas Winischhofer. + * Thomas Winischhofer <thomas@winischhofer.net>: + * - 310/325 series (315/550/650/651/740/M650) support + * - (possibly incomplete) Xabre (SiS330) support + * - new mode switching code for 300, 310/325 and 330 series + * - many fixes for 300/540/630/730 chipsets, + * - many fixes for 5597/5598, 6326 and 530/620 chipsets, + * - VESA mode switching (deprecated), + * - extended CRT2/video bridge handling support, + * - dual head support on 300, 310/325 and 330 series + * - 650/LVDS (up to 1400x1050), 650/Chrontel 701x support + * - 30xB/30xLV/30xLVX video bridge support (300, 310/325, 330 series) + * - Xv support for 5597/5598, 6326, 530/620 and 310/325 series + * - video overlay enhancements for 300 series + * - TV and hi-res support for the 6326 + * - Color HW cursor support for 300(emulated), 310/325 and 330 series + * - etc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.78 2002/01/17 10:49:35 eich Exp $ */ #include "fb.h" #include "xf1bpp.h" @@ -38,6 +54,7 @@ #include "xf86_OSproc.h" #include "xf86Resources.h" #include "xf86_ansic.h" +#include "dixstruct.h" #include "xf86Version.h" #include "xf86PciInfo.h" #include "xf86Pci.h" @@ -54,10 +71,11 @@ #include "sis.h" #include "sis_regs.h" -#include "sis_bios.h" #include "sis_vb.h" #include "sis_dac.h" +#include "sis_driver.h" + #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" @@ -73,20 +91,21 @@ #ifdef XF86DRI #include "dri.h" #endif - -/* mandatory functions */ +/* Mandatory functions */ static void SISIdentify(int flags); static Bool SISProbe(DriverPtr drv, int flags); static Bool SISPreInit(ScrnInfoPtr pScrn, int flags); -static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, - char **argv); +static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); static Bool SISEnterVT(int scrnIndex, int flags); static void SISLeaveVT(int scrnIndex, int flags); static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool SISSaveScreen(ScreenPtr pScreen, int mode); static Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); static void SISAdjustFrame(int scrnIndex, int x, int y, int flags); +#ifdef SISDUALHEAD +static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode); +#endif /* Optional functions */ static void SISFreeScreen(int scrnIndex, int flags); @@ -94,44 +113,68 @@ int flags); /* Internally used functions */ -static Bool SISMapMem(ScrnInfoPtr pScrn); -static Bool SISUnmapMem(ScrnInfoPtr pScrn); -static void SISSave(ScrnInfoPtr pScrn); -static void SISRestore(ScrnInfoPtr pScrn); -static void SISVESARestore(ScrnInfoPtr pScrn); -static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -static void SISModifyModeInfo(DisplayModePtr mode); -static void SiSPreSetMode(ScrnInfoPtr pScrn, int LockAfterwards); -static void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg, int LockAfterwards); -static Bool SiSSetVESAMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); -static void SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe); -static UShort CalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); -static void SISBridgeRestore(ScrnInfoPtr pScrn); -unsigned char SISSearchCRT1Rate(DisplayModePtr mode); -static void SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); - -void SiSOptions(ScrnInfoPtr pScrn); -const OptionInfoRec * SISAvailableOptions(int chipid, int busid); -void SiSSetup(ScrnInfoPtr pScrn); -void SISVGAPreInit(ScrnInfoPtr pScrn); -Bool SiSAccelInit(ScreenPtr pScreen); -Bool SiS300AccelInit(ScreenPtr pScreen); -Bool SiS530AccelInit(ScreenPtr pScreen); -Bool SiSHWCursorInit(ScreenPtr pScreen); -Bool SISDGAInit(ScreenPtr pScreen); -void SISInitVideo(ScreenPtr pScreen); - +static Bool SISMapMem(ScrnInfoPtr pScrn); +static Bool SISUnmapMem(ScrnInfoPtr pScrn); +static void SISSave(ScrnInfoPtr pScrn); +static void SISRestore(ScrnInfoPtr pScrn); +static void SISVESARestore(ScrnInfoPtr pScrn); +static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SISModifyModeInfo(DisplayModePtr mode); +static void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS6326PostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static Bool SiSSetVESAMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); +static void SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe); +static UShort SiSCalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); +static void SISBridgeRestore(ScrnInfoPtr pScrn); +static void SiSEnableTurboQueue(ScrnInfoPtr pScrn); +unsigned char SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SISWaitVBRetrace(ScrnInfoPtr pScrn); + +void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); +void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); + +BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn); +#ifdef CYCLECRT2 +Bool SISCycleCRT2Type(int scrnIndex, DisplayModePtr mode); +#endif -#ifdef DEBUG +#ifdef DEBUG static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); #endif +/* TW: New mode switching functions */ +extern BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); +extern BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch); +extern USHORT SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); +extern USHORT SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags); +extern void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr); +extern DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn); +#ifdef SISDUALHEAD +extern BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); +extern BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode); +#endif + +/* TW: For power management for 310/325 series */ +extern void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr); +extern void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr); +extern void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern void SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); + +#ifdef SISDUALHEAD +static int SISEntityIndex = -1; +#endif + /* * This is intentionally screen-independent. It indicates the binding * choice made in the first PreInit. */ static int pix24bpp = 0; - /* * This contains the functions needed by the server after loading the driver @@ -152,83 +195,40 @@ }; static SymTabRec SISChipsets[] = { -#if 0 - { PCI_CHIP_SG86C201, "SIS86c201" }, - { PCI_CHIP_SG86C202, "SIS86c202" }, - { PCI_CHIP_SG86C205, "SIS86c205" }, - { PCI_CHIP_SG86C215, "SIS86c215" }, - { PCI_CHIP_SG86C225, "SIS86c225" }, -#endif - { PCI_CHIP_SIS5597, "SIS5597" }, - { PCI_CHIP_SIS530, "SIS530" }, - { PCI_CHIP_SIS6326, "SIS6326" }, - { PCI_CHIP_SIS300, "SIS300" }, - { PCI_CHIP_SIS630, "SIS630" }, + { PCI_CHIP_SIS5597, "SIS5597/5598" }, + { PCI_CHIP_SIS530, "SIS530/620" }, + { PCI_CHIP_SIS6326, "SIS6326/AGP/DVD" }, + { PCI_CHIP_SIS300, "SIS300/305" }, + { PCI_CHIP_SIS630, "SIS630/730" }, { PCI_CHIP_SIS540, "SIS540" }, + { PCI_CHIP_SIS315, "SIS315" }, + { PCI_CHIP_SIS315H, "SIS315H" }, + { PCI_CHIP_SIS315PRO, "SIS315PRO" }, + { PCI_CHIP_SIS550, "SIS550" }, + { PCI_CHIP_SIS650, "SIS650/M650/651/740" }, +#ifdef INCL_SIS330 /* TW: New for SiS330 (untested) */ + { PCI_CHIP_SIS330, "SIS330(Xabre)" }, +#endif { -1, NULL } }; static PciChipsets SISPciChipsets[] = { -#if 0 - { PCI_CHIP_SG86C201, PCI_CHIP_SG86C201, RES_SHARED_VGA }, - { PCI_CHIP_SG86C202, PCI_CHIP_SG86C202, RES_SHARED_VGA }, - { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, - { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, -#endif { PCI_CHIP_SIS5597, PCI_CHIP_SIS5597, RES_SHARED_VGA }, { PCI_CHIP_SIS530, PCI_CHIP_SIS530, RES_SHARED_VGA }, { PCI_CHIP_SIS6326, PCI_CHIP_SIS6326, RES_SHARED_VGA }, { PCI_CHIP_SIS300, PCI_CHIP_SIS300, RES_SHARED_VGA }, { PCI_CHIP_SIS630, PCI_CHIP_SIS630, RES_SHARED_VGA }, { PCI_CHIP_SIS540, PCI_CHIP_SIS540, RES_SHARED_VGA }, + { PCI_CHIP_SIS550, PCI_CHIP_SIS550, RES_SHARED_VGA }, + { PCI_CHIP_SIS315, PCI_CHIP_SIS315, RES_SHARED_VGA }, + { PCI_CHIP_SIS315H, PCI_CHIP_SIS315H, RES_SHARED_VGA }, + { PCI_CHIP_SIS315PRO, PCI_CHIP_SIS315PRO, RES_SHARED_VGA }, + { PCI_CHIP_SIS650, PCI_CHIP_SIS650, RES_SHARED_VGA }, +#ifdef INCL_SIS330 /* TW: New for SiS330 */ + { PCI_CHIP_SIS330, PCI_CHIP_SIS330, RES_SHARED_VGA }, +#endif { -1, -1, RES_UNDEFINED } }; - - -int sisReg32MMIO[]={0x8280,0x8284,0x8288,0x828C,0x8290,0x8294,0x8298,0x829C, - 0x82A0,0x82A4,0x82A8,0x82AC}; -/* Engine Register for the 2nd Generation Graphics Engine */ -int sis2Reg32MMIO[]={0x8200,0x8204,0x8208,0x820C,0x8210,0x8214,0x8218,0x821C, - 0x8220,0x8224,0x8228,0x822C,0x8230,0x8234,0x8238,0x823C, - 0x8240, 0x8300}; - -/* TW: The following was re-included because there are BIOSes out there that - * report incomplete mode lists. These are BIOS versions <2.01.2x - * NOTE: Mode numbers for 1280, 1600 and 1920 are unofficial but they work here! - * TW: VBE 3.0 on SiS630 does not support 24 fpp modes (only 32fpp when depth = 24); - */ - /* 8 16 24 32 */ -static UShort VESAModeIndex_640x480[] = {0x100, 0x111, 0x112, 0x13a}; -static UShort VESAModeIndex_720x480[] = {0x000, 0x000, 0x000, 0x000}; -static UShort VESAModeIndex_720x576[] = {0x000, 0x000, 0x000, 0x000}; -static UShort VESAModeIndex_800x600[] = {0x103, 0x114, 0x115, 0x13b}; -static UShort VESAModeIndex_1024x768[] = {0x105, 0x117, 0x118, 0x13c}; -static UShort VESAModeIndex_1280x1024[] = {0x107, 0x11a, 0x11b, 0x13d}; -static UShort VESAModeIndex_1600x1200[] = {0x13e, 0x13f, 0x000, 0x140}; -static UShort VESAModeIndex_1920x1440[] = {0x141, 0x142, 0x000, 0x143}; - -static struct _sis_vrate { - CARD16 idx; - CARD16 xres; - CARD16 yres; - CARD16 refresh; -} sisx_vrate[] = { - {1, 640, 480, 60}, {2, 640, 480, 72}, {3, 640, 480, 75}, {4, 640, 480, 85}, - {5, 640, 480, 100}, {6, 640, 480, 120}, {7, 640, 480, 160}, {8, 640, 480, 200}, - {1, 720, 480, 60}, {1, 720, 576, 50}, - {1, 800, 600, 56}, {2, 800, 600, 60}, {3, 800, 600, 72}, {4, 800, 600, 75}, - {5, 800, 600, 85}, {6, 800, 600, 100}, {7, 800, 600, 120}, {8, 800, 600, 160}, - {1, 1024, 768, 43}, {2, 1024, 768, 60}, {3, 1024, 768, 70}, {4, 1024, 768, 75}, - {5, 1024, 768, 85}, {6, 1024, 768, 100}, {7, 1024, 768, 120}, - {1, 1280, 1024, 43}, {2, 1280, 1024, 60}, {3, 1280, 1024, 75}, {4, 1280, 1024, 85}, - {1, 1600, 1200, 60}, {2, 1600, 1200, 65}, {3, 1600, 1200, 70}, {4, 1600, 1200, 75}, - {5, 1600, 1200, 85}, - {1, 1920, 1440, 60}, - {0, 0, 0, 0} -}; - - -sisModeInfoPtr SISVesaModeList = NULL; static const char *xaaSymbols[] = { "XAACopyROP", @@ -283,6 +283,11 @@ static const char *ddcSymbols[] = { "xf86PrintEDID", "xf86SetDDCproperties", + "xf86InterpretEDID", + "xf86DoEDID_DDC1", +#ifdef SISI2C + "xf86DoEDID_DDC2", +#endif NULL }; @@ -292,10 +297,29 @@ NULL }; +static const char *int10Symbols[] = { + "xf86FreeInt10", + "xf86InitInt10", + NULL +}; + static const char *vbeSymbols[] = { +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) "VBEInit", +#else + "VBEExtendedInit", +#endif "vbeDoEDID", "vbeFree", + "VBEGetVBEInfo", + "VBEFreeVBEInfo", + "VBEGetModeInfo", + "VBEFreeModeInfo", + "VBESaveRestore", + "VBESetVBEMode", + "VBEGetVBEMode", + "VBESetDisplayStart", + "VBESetGetLogicalScanlineLength", NULL }; @@ -331,7 +355,6 @@ }; #endif - #ifdef XFree86LOADER static MODULESETUPPROTO(sisSetup); @@ -362,7 +385,7 @@ xf86AddDriver(&SIS, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, xaaSymbols, miscfbSymbols, shadowSymbols, ramdacSymbols, - vbeSymbols, + vbeSymbols, int10Symbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif @@ -388,7 +411,9 @@ return TRUE; pScrn->driverPrivate = xnfcalloc(sizeof(SISRec), 1); - /* Initialise it */ + + /* Initialise it to 0 */ + memset(pScrn->driverPrivate, 0, sizeof(SISRec)); return TRUE; } @@ -397,9 +422,44 @@ SISFreeRec(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - - if (pSiS->pstate) xfree(pSiS->pstate); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = NULL; +#endif + + /* TW: Just to make sure... */ + if(!pSiS) return; + + pSiSEnt = pSiS->entityPrivate; + + if(pSiS->pstate) xfree(pSiS->pstate); pSiS->pstate = NULL; + if(pSiS->fonts) xfree(pSiS->fonts); + pSiS->fonts = NULL; +#ifdef SISDUALHEAD + if(pSiSEnt) { + if(!pSiS->SecondHead) { + /* TW: Free memory only if we are first head; in case of an error + * during init of the second head, the server will continue - + * and we need the BIOS image and SiS_Private for the first + * head. + */ + if(pSiSEnt->BIOS) xfree(pSiSEnt->BIOS); + pSiSEnt->BIOS = pSiS->BIOS = NULL; + if(pSiSEnt->SiS_Pr) xfree(pSiSEnt->SiS_Pr); + pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL; + } else { + pSiS->BIOS = NULL; + pSiS->SiS_Pr = NULL; + } + } else { +#endif + if(pSiS->BIOS) xfree(pSiS->BIOS); + pSiS->BIOS = NULL; + if(pSiS->SiS_Pr) xfree(pSiS->SiS_Pr); + pSiS->SiS_Pr = NULL; +#ifdef SISDUALHEAD + } +#endif if (pSiS->pVbe) vbeFree(pSiS->pVbe); pSiS->pVbe = NULL; if (pScrn->driverPrivate == NULL) @@ -408,74 +468,294 @@ pScrn->driverPrivate = NULL; } -static void +static void SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { SISPtr pSiS = SISPTR(pScrn); - unsigned char extDDC_PCR; - unsigned char crtc17 = 0; - unsigned char seq1 = 0; - int vgaIOBase = VGAHWPTR(pScrn)->IOBase; + unsigned char extDDC_PCR=0; + unsigned char crtc17, seq1; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); + "SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); - outb(vgaIOBase + 4, 0x17); - crtc17 = inb(vgaIOBase + 5); - /* enable access to extended sequencer registers */ - outw(VGA_SEQ_INDEX, 0x8605); - outb(VGA_SEQ_INDEX, 0x11); - extDDC_PCR = inb(VGA_SEQ_DATA); - /* if not blanked obtain state of LCD blank flags set by BIOS */ - if (!pSiS->Blank) - pSiS->LCDon = extDDC_PCR; - /* erase LCD blank flags */ - extDDC_PCR &= ~0xC; - - switch (PowerManagementMode) - { - case DPMSModeOn: - /* HSync: On, VSync: On */ - seq1 = 0x00 ; - /* don't just unblanking; use LCD state set by BIOS */ - extDDC_PCR |= (pSiS->LCDon & 0x0C); + /* unlock registers */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + /* Read CR17 */ + inSISIDXREG(SISCR, 0x17, crtc17); + + /* Read SR1 */ + inSISIDXREG(SISSR, 0x01, seq1); + + if(pSiS->VBFlags & CRT2_LCD) { + if(((pSiS->VGAEngine == SIS_300_VGA) && + (!(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)))) || + ((pSiS->VGAEngine == SIS_315_VGA) && + ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) { + /* Read Power Control Register (SR11) */ + inSISIDXREG(SISSR, 0x11, extDDC_PCR); + /* if not blanked, obtain state of LCD blank flags set by BIOS */ + if(!pSiS->Blank) { + pSiS->LCDon = extDDC_PCR; + } + /* erase LCD blank flags */ + extDDC_PCR &= ~0x0C; + } + } + + switch (PowerManagementMode) { + + case DPMSModeOn: /* HSync: On, VSync: On */ + pSiS->Blank = FALSE; + seq1 &= ~0x20; crtc17 |= 0x80; + if(pSiS->VBFlags & CRT2_LCD) { + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->VBFlags & VB_CHRONTEL) { + SiS_Chrontel701xBLOn(pSiS->SiS_Pr); + } else if(pSiS->VBFlags & VB_LVDS) { + extDDC_PCR |= (pSiS->LCDon & 0x0C); + } else if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + extDDC_PCR |= (pSiS->LCDon & 0x0C); + } + } + } + break; + + case DPMSModeStandby: /* HSync: Off, VSync: On */ + case DPMSModeSuspend: /* HSync: On, VSync: Off */ + + pSiS->Blank = TRUE; + seq1 |= 0x20 ; + if(pSiS->VBFlags & CRT2_LCD) { + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->VBFlags & VB_CHRONTEL) { + SiS_Chrontel701xBLOff(pSiS->SiS_Pr); + } else if(pSiS->VBFlags & VB_LVDS) { + extDDC_PCR |= 0x08; + } else if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + extDDC_PCR |= 0x08; + } + } + } break; - case DPMSModeStandby: - /* HSync: Off, VSync: On */ - seq1 = 0x20 ; - extDDC_PCR |= 0x8; - pSiS->Blank = TRUE; + + case DPMSModeOff: /* HSync: Off, VSync: Off */ + + pSiS->Blank = TRUE; + seq1 |= 0x20; + if(pSiS->VGAEngine == SIS_300_VGA || + pSiS->VGAEngine == SIS_315_VGA) { + /* TW: We can't switch off CRT1 if bridge is in slavemode */ + if(pSiS->VBFlags & CRT2_ENABLE) { + if(!(SiSBridgeIsInSlaveMode(pScrn))) crtc17 &= ~0x80; + } else crtc17 &= ~0x80; + } else { + crtc17 &= ~0x80; + } + if(pSiS->VBFlags & CRT2_LCD) { + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->VBFlags & VB_CHRONTEL) { + SiS_Chrontel701xBLOff(pSiS->SiS_Pr); + } else if(pSiS->VBFlags & VB_LVDS) { + extDDC_PCR |= 0x0C; + } else if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + extDDC_PCR |= 0x0C; + } + } + } + break; + + } + + outSISIDXREG(SISSR, 0x01, seq1); /* Set/Clear "Display On" bit */ + + outSISIDXREG(SISCR, 0x17, crtc17); + + if(pSiS->VBFlags & CRT2_LCD) { + if(((pSiS->VGAEngine == SIS_300_VGA) && + (!(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)))) || + ((pSiS->VGAEngine == SIS_315_VGA) && + ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) { + outSISIDXREG(SISSR, 0x11, extDDC_PCR); + } + } + + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + usleep(10000); + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ + +} + +#ifdef SISDUALHEAD +/* TW: DPMS for dual head mode */ +static void +SISDisplayPowerManagementSetDH(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char crtc17 = 0; + unsigned char extDDC_PCR=0; + unsigned char seq1 = 0; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SISDisplayPowerManagementSetDH(%d)\n",PowerManagementMode); + + /* unlock registers */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + if (pSiS->SecondHead) { + + /* TW: Second (slave) head is always CRT1 */ + + /* Read CR17 and SR01 */ + inSISIDXREG(SISCR, 0x17, crtc17); + inSISIDXREG(SISSR, 0x01, seq1); + + switch (PowerManagementMode) + { + case DPMSModeOn: /* HSync: On, VSync: On */ + seq1 &= ~0x20 ; + crtc17 |= 0x80; + pSiS->BlankCRT1 = FALSE; break; - case DPMSModeSuspend: - /* HSync: On, VSync: Off */ - seq1 = 0x20 ; - extDDC_PCR |= 0x8; - pSiS->Blank = TRUE; + + case DPMSModeStandby: /* HSync: Off, VSync: On */ + case DPMSModeSuspend: /* HSync: On, VSync: Off */ + seq1 |= 0x20; + pSiS->BlankCRT1 = TRUE; break; - case DPMSModeOff: - /* HSync: Off, VSync: Off */ - seq1 = 0x20 ; - extDDC_PCR |= 0xC; - pSiS->Blank = TRUE; - /* DPMSModeOff is not supported with ModeStandby | ModeSuspend */ - /* need same as the generic VGA function */ + + case DPMSModeOff: /* HSync: Off, VSync: Off */ + seq1 |= 0x20 ; + pSiS->BlankCRT1 = TRUE; crtc17 &= ~0x80; break; + } + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + + outSISIDXREG(SISSR, 0x01, seq1); /* Set/Clear "Display On" bit */ + + usleep(10000); + + outSISIDXREG(SISCR, 0x17, crtc17); + + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ + + } else { + + /* TW: Master head is always CRT2 */ + + /* TV can not be managed */ + if(!(pSiS->VBFlags & CRT2_LCD)) return; + + if(((pSiS->VGAEngine == SIS_300_VGA) && + (!(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)))) || + ((pSiS->VGAEngine == SIS_315_VGA) && + ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) { + /* Read Power Control Register (SR11) */ + inSISIDXREG(SISSR, 0x11, extDDC_PCR); + /* if not blanked obtain state of LCD blank flags set by BIOS */ + if(!pSiS->BlankCRT2) { + pSiS->LCDon = extDDC_PCR; + } + /* erase LCD blank flags */ + extDDC_PCR &= ~0xC; + } + + switch (PowerManagementMode) { + + case DPMSModeOn: + pSiS->BlankCRT2 = FALSE; + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->VBFlags & VB_CHRONTEL) { + SiS_Chrontel701xBLOn(pSiS->SiS_Pr); + } else if(pSiS->VBFlags & VB_LVDS) { + extDDC_PCR |= (pSiS->LCDon & 0x0C); + } else if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOn(pSiS->SiS_Pr, &pSiS->sishw_ext); + } + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOn(pSiS->SiS_Pr, &pSiS->sishw_ext); + } else { + extDDC_PCR |= (pSiS->LCDon & 0x0C); + } + } + break; + + case DPMSModeStandby: + case DPMSModeSuspend: + pSiS->BlankCRT2 = TRUE; + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->VBFlags & VB_CHRONTEL) { + SiS_Chrontel701xBLOff(pSiS->SiS_Pr); + } else if(pSiS->VBFlags & VB_LVDS) { + extDDC_PCR |= 0x08; + } else if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr, &pSiS->sishw_ext); + } + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr, &pSiS->sishw_ext); + } else { + extDDC_PCR |= 0x08; + } + } + break; + + case DPMSModeOff: + pSiS->BlankCRT2 = TRUE; + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->VBFlags & VB_CHRONTEL) { + SiS_Chrontel701xBLOff(pSiS->SiS_Pr); + } else if(pSiS->VBFlags & VB_LVDS) { + extDDC_PCR |= 0x0C; + } else if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr, &pSiS->sishw_ext); + } + } else if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + SiS_SiS30xBLOff(pSiS->SiS_Pr, &pSiS->sishw_ext); + } else { + extDDC_PCR |= 0x0C; + } + } + break; + } + + if(((pSiS->VGAEngine == SIS_300_VGA) && + (!(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)))) || + ((pSiS->VGAEngine == SIS_315_VGA) && + ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) { + outSISIDXREG(SISSR, 0x11, extDDC_PCR); + } + } - outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ - outb(VGA_SEQ_INDEX, 0x01); /* Select SEQ1 */ - seq1 |= inb(VGA_SEQ_DATA) & ~0x20; - outb(VGA_SEQ_DATA, seq1); - usleep(10000); - outb(vgaIOBase + 4, 0x17); - outb(vgaIOBase + 5, crtc17); - outb(VGA_SEQ_INDEX, 0x11); - outb(VGA_SEQ_DATA, extDDC_PCR); - outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ } - +#endif /* Mandatory */ static void @@ -489,27 +769,27 @@ { SISPtr pSiS = SISPTR(pScrn); - outb(pSiS->RelIO+0x48, 0x00); - outb(pSiS->RelIO+0x49, 0x00); - outb(pSiS->RelIO+0x49, 0x00); - outb(pSiS->RelIO+0x49, 0x00); - - outb(pSiS->RelIO+0x48, 0x3F); - outb(pSiS->RelIO+0x49, 0x3F); - outb(pSiS->RelIO+0x49, 0x3F); - outb(pSiS->RelIO+0x49, 0x3F); + outSISREG(SISCOLIDX, 0x00); + outSISREG(SISCOLDATA, 0x00); + outSISREG(SISCOLDATA, 0x00); + outSISREG(SISCOLDATA, 0x00); + + outSISREG(SISCOLIDX, 0x3f); + outSISREG(SISCOLDATA, 0x3f); + outSISREG(SISCOLDATA, 0x3f); + outSISREG(SISCOLDATA, 0x3f); } /* Mandatory */ static Bool SISProbe(DriverPtr drv, int flags) { - int i; + int i; GDevPtr *devSections; - int *usedChips; - int numDevSections; - int numUsed; - Bool foundScreen = FALSE; + int *usedChips; + int numDevSections; + int numUsed; + Bool foundScreen = FALSE; /* * The aim here is to find all cards that this driver can handle, @@ -522,8 +802,6 @@ * the required ScrnInfoRec initialisations. Don't allocate any new * data structures. * - * Since this test version still uses vgaHW, we'll only actually claim - * one for now, and just print a message about the others. */ /* @@ -543,11 +821,6 @@ } /* - * While we're VGA-dependent, can really only have one such instance, but - * we'll ignore that. - */ - - /* * We need to probe the hardware first. We then need to see how this * fits in with what is given in the config file, and allow the config * file info to override any contradictions. @@ -578,13 +851,16 @@ foundScreen = TRUE; else for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn; +#ifdef SISDUALHEAD + EntityInfoPtr pEnt; +#endif /* Allocate a ScrnInfoRec and claim the slot */ pScrn = NULL; if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - SISPciChipsets, NULL, NULL, - NULL, NULL, NULL))) { + SISPciChipsets, NULL, NULL, + NULL, NULL, NULL))) { /* Fill in what we can of the ScrnInfoRec */ pScrn->driverVersion = SIS_CURRENT_VERSION; pScrn->driverName = SIS_DRIVER_NAME; @@ -600,25 +876,255 @@ pScrn->ValidMode = SISValidMode; foundScreen = TRUE; } +#ifdef SISDUALHEAD + pEnt = xf86GetEntityInfo(usedChips[i]); + + /* TW: I assume these chipsets as - basically - dual head capable. */ + if (pEnt->chipset == PCI_CHIP_SIS630 || pEnt->chipset == PCI_CHIP_SIS540 || + pEnt->chipset == PCI_CHIP_SIS650 || pEnt->chipset == PCI_CHIP_SIS550 || + pEnt->chipset == PCI_CHIP_SIS315 || pEnt->chipset == PCI_CHIP_SIS315H || + pEnt->chipset == PCI_CHIP_SIS315PRO || pEnt->chipset == PCI_CHIP_SIS330 || + pEnt->chipset == PCI_CHIP_SIS300) { + + SISEntPtr pSiSEnt = NULL; + DevUnion *pPriv; + + xf86SetEntitySharable(usedChips[i]); + if (SISEntityIndex < 0) + SISEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], SISEntityIndex); + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(SISEntRec), 1); + pSiSEnt = pPriv->ptr; + pSiSEnt->lastInstance = -1; + pSiSEnt->DisableDual = FALSE; + pSiSEnt->ErrorAfterFirst = FALSE; + pSiSEnt->MapCountIOBase = pSiSEnt->MapCountFbBase = 0; + pSiSEnt->FbBase = pSiSEnt->IOBase = NULL; + pSiSEnt->forceUnmapIOBase = FALSE; + pSiSEnt->forceUnmapFbBase = FALSE; +#ifdef __alpha__ + pSiSEnt->MapCountIOBaseDense = 0; + pSiSEnt->IOBaseDense = NULL; + pSiSEnt->forceUnmapIOBaseDense = FALSE; +#endif + } else { + pSiSEnt = pPriv->ptr; + } + pSiSEnt->lastInstance++; + xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0], + pSiSEnt->lastInstance); + } +#endif } xfree(usedChips); return foundScreen; } -#if 0 /* xf86ValidateModes() takes care of this */ -/* - * GetAccelPitchValues - - * - * This function returns a list of display width (pitch) values that can - * be used in accelerated mode. + +/* TW: If monitor section has no HSync/VRefresh data, + * derive it from DDC data. */ -static int -GetAccelPitchValues(ScrnInfoPtr pScrn) +static void +SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) { - return ((pScrn->displayWidth + 7) & ~7); + MonPtr mon = pScrn->monitor; + xf86MonPtr ddc = mon->DDC; + int i,j; + float myhhigh, myhlow; + int myvhigh, myvlow; + unsigned char temp; + const myhddctiming myhtiming[11] = { + { 1, 0x20, 31.6 }, /* rounded up by .1 */ + { 1, 0x02, 35.3 }, + { 1, 0x04, 37.6 }, + { 1, 0x08, 38.0 }, + { 1, 0x01, 38.0 }, + { 2, 0x40, 47.0 }, + { 2, 0x80, 48.2 }, + { 2, 0x08, 48.5 }, + { 2, 0x04, 56.6 }, + { 2, 0x02, 60.1 }, + { 2, 0x01, 80.1 } + }; + const myvddctiming myvtiming[10] = { + { 1, 0x02, 56 }, + { 1, 0x01, 60 }, + { 2, 0x08, 60 }, + { 2, 0x04, 70 }, + { 1, 0x08, 72 }, + { 2, 0x80, 72 }, + { 1, 0x04, 75 }, + { 2, 0x40, 75 }, + { 2, 0x02, 75 }, + { 2, 0x01, 75 } + }; + /* "Future modes"; we only check the really high ones */ + const myddcstdmodes mystdmodes[8] = { + { 1280, 1024, 85, 91.1 }, + { 1600, 1200, 60, 75.0 }, + { 1600, 1200, 65, 81.3 }, + { 1600, 1200, 70, 87.5 }, + { 1600, 1200, 75, 93.8 }, + { 1600, 1200, 85, 106.3 }, + { 1920, 1440, 60, 90.0 }, + { 1920, 1440, 75, 112.5 } + }; + + if(flag) { /* HSync */ + for (i = 0; i < 4; i++) { + if (ddc->det_mon[i].type == DS_RANGES) { + mon->nHsync = 1; + mon->hsync[0].lo = ddc->det_mon[i].section.ranges.min_h; + mon->hsync[0].hi = ddc->det_mon[i].section.ranges.max_h; + return; + } + } + /* If no sync ranges detected in detailed timing table, we + * derive them from supported VESA modes. */ + myhlow = myhhigh = 0.0; + for(i=0; i<11; i++) { + if(myhtiming[i].whichone == 1) temp = ddc->timings1.t1; + else temp = ddc->timings1.t2; + if(temp & myhtiming[i].mask) { + if((i==0) || (myhlow > myhtiming[i].rate)) + myhlow = myhtiming[i].rate; + } + if(myhtiming[10-i].whichone == 1) temp = ddc->timings1.t1; + else temp = ddc->timings1.t2; + if(temp & myhtiming[10-i].mask) { + if((i==0) || (myhhigh < myhtiming[10-i].rate)) + myhhigh = myhtiming[10-i].rate; + } + } + for(i=0;i<STD_TIMINGS;i++) { + if(ddc->timings2[i].hsize > 256) { + for(j=0; j<8; j++) { + if((ddc->timings2[i].hsize == mystdmodes[j].hsize) && + (ddc->timings2[i].vsize == mystdmodes[j].vsize) && + (ddc->timings2[i].refresh == mystdmodes[j].refresh)) { + if(mystdmodes[j].hsync > myhhigh) + myhhigh = mystdmodes[j].hsync; + } + } + } + } + if((myhhigh) && (myhlow)) { + mon->nHsync = 1; + mon->hsync[0].lo = myhlow - 0.1; + mon->hsync[0].hi = myhhigh; + } + + + } else { /* Vrefresh */ + + for (i = 0; i < 4; i++) { + if (ddc->det_mon[i].type == DS_RANGES) { + mon->nVrefresh = 1; + mon->vrefresh[0].lo = ddc->det_mon[i].section.ranges.min_v; + mon->vrefresh[0].hi = ddc->det_mon[i].section.ranges.max_v; + return; + } + } + + myvlow = myvhigh = 0; + for(i=0; i<10; i++) { + if(myvtiming[i].whichone == 1) temp = ddc->timings1.t1; + else temp = ddc->timings1.t2; + if(temp & myvtiming[i].mask) { + if((i==0) || (myvlow > myvtiming[i].rate)) + myvlow = myvtiming[i].rate; + } + if(myvtiming[9-i].whichone == 1) temp = ddc->timings1.t1; + else temp = ddc->timings1.t2; + if(temp & myvtiming[9-i].mask) { + if((i==0) || (myvhigh < myvtiming[9-i].rate)) + myvhigh = myvtiming[9-i].rate; + } + } + for(i=0;i<STD_TIMINGS;i++) { + if(ddc->timings2[i].hsize > 256) { + for(j=0; j<8; j++) { + if((ddc->timings2[i].hsize == mystdmodes[j].hsize) && + (ddc->timings2[i].vsize == mystdmodes[j].vsize) && + (ddc->timings2[i].refresh == mystdmodes[j].refresh)) { + if(mystdmodes[j].refresh > myvhigh) + myvhigh = mystdmodes[j].refresh; + } + } + } + } + if((myvhigh) && (myvlow)) { + mon->nVrefresh = 1; + mon->vrefresh[0].lo = myvlow; + mon->vrefresh[0].hi = myvhigh; + } + + } } -#endif +static xf86MonPtr +SiSInternalDDC(ScrnInfoPtr pScrn, int crtno) +{ + SISPtr pSiS = SISPTR(pScrn); + USHORT temp, i; + unsigned char buffer[256]; + xf86MonPtr pMonitor = NULL; + + /* TW: If CRT1 is off, skip DDC */ + if((pSiS->CRT1off) && (!crtno)) return NULL; + + temp = SiS_HandleDDC(pSiS->SiS_Pr, pSiS, crtno, 0, &buffer[0]); + if((!temp) || (temp == 0xffff)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "CRT%d DDC probing failed, now trying via VBE\n", crtno + 1); + return(NULL); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CRT%d DDC supported\n", crtno + 1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CRT%d DDC level: %s%s%s%s\n", + crtno + 1, + (temp & 0x1a) ? "" : "[none of the supported]", + (temp & 0x02) ? "2 " : "", + (temp & 0x08) ? "3 " : "", + (temp & 0x10) ? "4" : ""); + if(temp & 0x02) { + i = 3; /* Number of retrys */ + do { + temp = SiS_HandleDDC(pSiS->SiS_Pr, pSiS, crtno, 1, &buffer[0]); + } while((temp) && i--); + if(!temp) { + if((pMonitor = xf86InterpretEDID(pScrn->scrnIndex, &buffer[0]))) { + return(pMonitor); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "CRT%d DDC EDID corrupt\n", crtno + 1); + return(NULL); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "CRT%d DDC reading failed\n", crtno + 1); + return(NULL); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "DDC levels 3 and 4 not supported by this driver yet.\n"); + return(NULL); + } + } +} + +static xf86MonPtr +SiSDoPrivateDDC(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + if((pSiS->DualHeadMode) && (!pSiS->SecondHead)) + return(SiSInternalDDC(pScrn, 1)); + else +#endif + return(SiSInternalDDC(pScrn, 0)); +} /* Mandatory */ static Bool @@ -626,13 +1132,23 @@ { SISPtr pSiS; MessageType from; - int vgaIOBase; - unsigned char unlock; + unsigned char usScratchCR17, CR5F; + unsigned char usScratchCR32; unsigned long int i; + int temp; ClockRangePtr clockRanges; char *mod = NULL; const char *Sym = NULL; int pix24flags; +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = NULL; +#endif + DisplayModePtr first, p, n; + DisplayModePtr tempmode, delmode, mymodes; + unsigned char srlockReg,crlockReg; + unsigned char tempreg; + xf86MonPtr pMonitor = NULL; + Bool didddc2; vbeInfoPtr pVbe; VbeInfoBlock *vbe; @@ -640,8 +1156,13 @@ if (flags & PROBE_DETECT) { if (xf86LoadSubModule(pScrn, "vbe")) { int index = xf86GetEntityInfo(pScrn->entityList[0])->index; - if ((pVbe = VBEInit(NULL,index))) { - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + if((pVbe = VBEInit(NULL,index))) { +#else + if((pVbe = VBEExtendedInit(NULL,index,0))) { +#endif + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); vbeFree(pVbe); } } @@ -652,59 +1173,130 @@ * Note: This function is only called once at server startup, and * not at the start of each server generation. This means that * only things that are persistent across server generations can - * be initialised here. xf86Screens[] is (pScrn is a pointer to one - * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() - * are too, and should be used for data that must persist across - * server generations. + * be initialised here. xf86Screens[] is the array of all screens, + * (pScrn is a pointer to one of these). Privates allocated using + * xf86AllocateScrnInfoPrivateIndex() are too, and should be used + * for data that must persist across server generations. * * Per-generation data should be allocated with * AllocateScreenPrivateIndex() from the ScreenInit() function. */ /* Check the number of entities, and fail if it isn't one. */ - if (pScrn->numEntities != 1) + if(pScrn->numEntities != 1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Number of entities is not 1\n"); return FALSE; + } /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "vgahw")) + if(!xf86LoadSubModule(pScrn, "vgahw")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not load vgahw module\n"); return FALSE; + } xf86LoaderReqSymLists(vgahwSymbols, NULL); - /* - * Allocate a vgaHWRec - */ - if (!vgaHWGetHWRec(pScrn)) - return FALSE; - - VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SiS driver (31/01/03-1) by " + "Thomas Winischhofer <thomas@winischhofer.net>\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "See http://www.winischhofer.net/linuxsisvga.shtml " + "for documentation and updates\n"); - if (!vgaHWMapMem(pScrn)) + /* Allocate a vgaHWRec */ + if(!vgaHWGetHWRec(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not allocate VGA private\n"); return FALSE; - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + } /* Allocate the SISRec driverPrivate */ - if (!SISGetRec(pScrn)) { + if(!SISGetRec(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not allocate memory for pSiS private\n"); return FALSE; } pSiS = SISPTR(pScrn); pSiS->pScrn = pScrn; +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + pSiS->IODBase = 0; +#else + pSiS->IODBase = pScrn->domainIOBase; +#endif + /* Get the entity, and make sure it is PCI. */ pSiS->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - if (pSiS->pEnt->location.type != BUS_PCI) + if(pSiS->pEnt->location.type != BUS_PCI) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Entity's bus type is not PCI\n"); + SISFreeRec(pScrn); return FALSE; + } + +#ifdef SISDUALHEAD + /* TW: Allocate an entity private if necessary */ + if(xf86IsEntityShared(pScrn->entityList[0])) { + pSiSEnt = xf86GetEntityPrivate(pScrn->entityList[0], + SISEntityIndex)->ptr; + pSiS->entityPrivate = pSiSEnt; + + /* TW: If something went wrong, quit here */ + if ((pSiSEnt->DisableDual) || (pSiSEnt->ErrorAfterFirst)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "First head encountered fatal error, can't continue\n"); + SISFreeRec(pScrn); + return FALSE; + } + } +#endif /* Find the PCI info for this screen */ pSiS->PciInfo = xf86GetPciInfoForEntity(pSiS->pEnt->index); - pSiS->PciTag = pciTag(pSiS->PciInfo->bus, pSiS->PciInfo->device, - pSiS->PciInfo->func); + pSiS->PciTag = pSiS->sishw_ext.PciTag = pciTag(pSiS->PciInfo->bus, + pSiS->PciInfo->device, pSiS->PciInfo->func); - /* - * XXX This could be refined if some VGA memory resources are not - * decoded in operating mode. + pSiS->Primary = xf86IsPrimaryPci(pSiS->PciInfo); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "This adapter is %s display adapter\n", + (pSiS->Primary ? "primary" : "secondary")); + + if(pSiS->Primary) { + VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */ + if(!vgaHWMapMem(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map VGA memory\n"); + SISFreeRec(pScrn); + return FALSE; + } + } + vgaHWGetIOBase(VGAHWPTR(pScrn)); + + /* TW: We "patch" the PIOOffset inside vgaHW in order to force + * the vgaHW module to use our relocated i/o ports. */ + VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380; + + pSiS->pInt = NULL; + if(!pSiS->Primary) { +#if !defined(__alpha__) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Initializing display adapter through int10\n"); +#endif + if(xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); +#if !defined(__alpha__) + pSiS->pInt = xf86InitInt10(pSiS->pEnt->index); +#endif + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not load int10 module\n"); + } + } + +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) { resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, {ResShrMemBlock,0xB0000,0xB7FFF}, @@ -712,28 +1304,35 @@ _END }; xf86SetOperatingState(vgamem, pSiS->pEnt->index, ResUnusedOpr); } +#else + xf86SetOperatingState(resVgaMem, pSiS->pEnt->index, ResUnusedOpr); +#endif /* Operations for which memory access is required */ pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; - /* Operations for which I/O access is required (XXX check this) */ + /* Operations for which I/O access is required */ pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; /* The ramdac module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "ramdac")) + if(!xf86LoadSubModule(pScrn, "ramdac")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not load ramdac module\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; + } xf86LoaderReqSymLists(ramdacSymbols, NULL); /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; - /* TW: ---EGBERT: Remove this before committing !*/ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Unofficial driver (16.01.02) by Thomas Winischhofer\n"); - /* * Set the Chipset and ChipRev, allowing config file entries to - * override. + * override. DANGEROUS! */ if (pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) { pScrn->chipset = pSiS->pEnt->device->chipset; @@ -758,6 +1357,34 @@ } else { pSiS->ChipRev = pSiS->PciInfo->chipRev; } + pSiS->sishw_ext.jChipRevision = pSiS->ChipRev; + + /* TW: Determine SiS6326 chiprevision. This is not yet used for + * anything, but it will as soon as I found out on which revisions + * the hardware video overlay really works. + * According to SiS the only differences are: + * Chip name Chip type TV-Out MPEG II decoder + * 6326 AGP Rev. G0/H0 no no + * 6326 DVD Rev. D2 yes yes + * 6326 Rev. Cx yes yes + */ + pSiS->SiS6326Flags = 0; + if(pSiS->Chipset == PCI_CHIP_SIS6326) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chipset is SiS6326 %s (revision 0x%02x)\n", + (pSiS->ChipRev == 0xaf) ? "(Ax)" : + ((pSiS->ChipRev == 0x0a) ? "AGP (G0)" : + ((pSiS->ChipRev == 0x0b) ? "AGP (H0)" : + (((pSiS->ChipRev & 0xf0) == 0xd0) ? "DVD (Dx)" : + (((pSiS->ChipRev & 0xf0) == 0x90) ? "(9x)" : + (((pSiS->ChipRev & 0xf0) == 0xc0) ? "(Cx)" : + "(unknown)"))))), + pSiS->ChipRev); + if((pSiS->ChipRev != 0x0a) && (pSiS->ChipRev != 0x0b)) { + pSiS->SiS6326Flags |= SIS6326_HASTV; + } + } + /* * This shouldn't happen because such problems should be caught in @@ -766,127 +1393,877 @@ if (pScrn->chipset == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04X is not recognised\n", pSiS->Chipset); +#ifdef SISDUALHEAD + if (pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; } if (pSiS->Chipset < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Chipset \"%s\" is not recognised\n", pScrn->chipset); +#ifdef SISDUALHEAD + if (pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; } + /* TW: Determine chipset and VGA engine type for new mode switching code */ + switch(pSiS->Chipset) { + case PCI_CHIP_SIS300: + pSiS->sishw_ext.jChipType = SIS_300; + pSiS->VGAEngine = SIS_300_VGA; + break; + case PCI_CHIP_SIS630: /* 630 + 730 */ + pSiS->sishw_ext.jChipType = SIS_630; + if(pciReadLong(0x00000000, 0x00) == 0x07301039) { + pSiS->sishw_ext.jChipType = SIS_730; + } + pSiS->VGAEngine = SIS_300_VGA; + break; + case PCI_CHIP_SIS540: + pSiS->sishw_ext.jChipType = SIS_540; + pSiS->VGAEngine = SIS_300_VGA; + break; + case PCI_CHIP_SIS315H: + pSiS->sishw_ext.jChipType = SIS_315H; + pSiS->VGAEngine = SIS_315_VGA; + break; + case PCI_CHIP_SIS315: + /* TW: Override for simplicity */ + pSiS->Chipset = PCI_CHIP_SIS315H; + pSiS->sishw_ext.jChipType = SIS_315; + pSiS->VGAEngine = SIS_315_VGA; + break; + case PCI_CHIP_SIS315PRO: + /* TW: Override for simplicity */ + pSiS->Chipset = PCI_CHIP_SIS315H; + pSiS->sishw_ext.jChipType = SIS_315PRO; + pSiS->VGAEngine = SIS_315_VGA; + break; + case PCI_CHIP_SIS550: + pSiS->sishw_ext.jChipType = SIS_550; + pSiS->VGAEngine = SIS_315_VGA; + break; + case PCI_CHIP_SIS650: /* 650 + 740 */ + pSiS->sishw_ext.jChipType = SIS_650; + pSiS->VGAEngine = SIS_315_VGA; + break; + case PCI_CHIP_SIS330: + pSiS->sishw_ext.jChipType = SIS_330; + pSiS->VGAEngine = SIS_315_VGA; + break; + case PCI_CHIP_SIS530: + pSiS->sishw_ext.jChipType = SIS_530; + pSiS->VGAEngine = SIS_530_VGA; + break; + default: + pSiS->sishw_ext.jChipType = SIS_OLD; + pSiS->VGAEngine = SIS_OLD_VGA; + break; + } + + /* TW: Now check if sisfb is loaded. Since sisfb only supports + * the 300 and 310/325 series, we only do this for these chips. + * We use this for checking where sisfb starts its memory + * heap in order to automatically detect the correct MaxXFBMem + * setting (which normally is given by the option of the same name). + * That only works if sisfb is completely running, ie with + * a video mode (because the fbdev will not be installed otherwise.) + */ + + pSiS->donttrustpdc = FALSE; + pSiS->sisfbpdc = 0; + + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { + + int fd, i; + sisfb_info mysisfbinfo; + BOOL found = FALSE; + char name[10]; + + i=0; + do { + sprintf(name, "/dev/fb%1d", i); + if((fd = open(name, 'r'))) { + + if(!ioctl(fd, SISFB_GET_INFO, &mysisfbinfo)) { + + if(mysisfbinfo.sisfb_id == SISFB_ID) { + + if((mysisfbinfo.sisfb_version >= 1) && + (mysisfbinfo.sisfb_revision >=5) && + (mysisfbinfo.sisfb_patchlevel >= 8)) { + /* TW: Added PCI bus/slot/func into in sisfb Version 1.5.08. + Check this to make sure we run on the same card as sisfb + */ + if((mysisfbinfo.sisfb_pcibus == pSiS->PciInfo->bus) && + (mysisfbinfo.sisfb_pcislot == pSiS->PciInfo->device) && + (mysisfbinfo.sisfb_pcifunc == pSiS->PciInfo->func) ) { + found = TRUE; + } + } else found = TRUE; + + if(found) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %02d:%02d.%d)\n", + &name[5], + mysisfbinfo.sisfb_version, + mysisfbinfo.sisfb_revision, + mysisfbinfo.sisfb_patchlevel, + pSiS->PciInfo->bus, + pSiS->PciInfo->device, + pSiS->PciInfo->func); + /* TW: Added version/rev/pl in sisfb 1.4.0 */ + if(mysisfbinfo.sisfb_version == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Old version of sisfb found. Please update\n"); + } + pSiS->sisfbMem = mysisfbinfo.heapstart; + /* TW: Basically, we can't trust the pdc register if sisfb is loaded */ + pSiS->donttrustpdc = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "sisfb: memory heap starts at %dKB\n", pSiS->sisfbMem); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "sisfb: using video mode 0x%02x\n", mysisfbinfo.fbvidmode); + if((mysisfbinfo.sisfb_version >= 1) && + (mysisfbinfo.sisfb_revision >=5) && + (mysisfbinfo.sisfb_patchlevel >= 6)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "sisfb: %sreserved hardware cursor, using %s command queue\n", + (mysisfbinfo.sisfb_caps & 0x80) ? "" : "not ", + (mysisfbinfo.sisfb_caps & 0x40) ? "SiS300 series Turbo" : + (mysisfbinfo.sisfb_caps & 0x20) ? "SiS310/325 series AGP" : + (mysisfbinfo.sisfb_caps & 0x10) ? "SiS310/325 series VRAM" : + (mysisfbinfo.sisfb_caps & 0x08) ? "SiS310/325 series MMIO" : + "no"); + } + if((mysisfbinfo.sisfb_version >= 1) && + (mysisfbinfo.sisfb_revision >=5) && + (mysisfbinfo.sisfb_patchlevel >= 10)) { + /* TW: We can trust the pdc value if sisfb is of recent version */ + pSiS->donttrustpdc = FALSE; + if(mysisfbinfo.sisfb_patchlevel >= 11) { + pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc; + } + } + } + } + } + close (fd); + } + i++; + } while((i <= 7) && (!found)); + } + /* * The first thing we should figure out is the depth, bpp, etc. - * Our default depth is 8, so pass it to the helper function. - * Our preference for depth 24 is 24bpp, so tell it that too. + * TW: Additionally, determine the size of the HWCursor memory + * area. */ - switch (pSiS->Chipset) { - case PCI_CHIP_SIS530: - pix24flags = Support32bppFb | Support24bppFb | - SupportConvert24to32 | SupportConvert32to24; - break; - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - pix24flags = Support32bppFb | SupportConvert24to32; + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + pSiS->CursorSize = 4096; + pix24flags = Support32bppFb | + SupportConvert24to32; + break; + case SIS_315_VGA: + pSiS->CursorSize = 16384; + pix24flags = Support32bppFb | + SupportConvert24to32; break; - default: + case SIS_530_VGA: + pSiS->CursorSize = 2048; + pix24flags = Support32bppFb | + Support24bppFb | + SupportConvert24to32 | + SupportConvert32to24; + break; + default: + pSiS->CursorSize = 2048; pix24flags = Support24bppFb | - SupportConvert32to24 | PreferConvert32to24; + SupportConvert32to24 | + PreferConvert32to24; break; } - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) - return FALSE; +#ifdef SISDUALHEAD + /* TW: In case of Dual Head, we need to determine if we are the "master" head or + * the "slave" head. In order to do that, we set PrimInit to DONE in the + * shared entity at the end of the first initialization. The second + * initialization then knows that some things have already been done. THIS + * ALWAYS ASSUMES THAT THE FIRST DEVICE INITIALIZED IS THE MASTER! + */ - /* Check that the returned depth is one we support */ - switch (pScrn->depth) { - case 8: - case 15: - case 16: - case 24: - /* OK */ - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by this driver\n", - pScrn->depth); - return FALSE; + if(xf86IsEntityShared(pScrn->entityList[0])) { + if(pSiSEnt->lastInstance > 0) { + if(!xf86IsPrimInitDone(pScrn->entityList[0])) { + /* First Head (always CRT2) */ + pSiS->SecondHead = FALSE; + pSiSEnt->pScrn_1 = pScrn; + pSiSEnt->CRT1ModeNo = pSiSEnt->CRT2ModeNo = -1; + pSiS->DualHeadMode = TRUE; + pSiSEnt->DisableDual = FALSE; + pSiSEnt->BIOS = NULL; + pSiSEnt->SiS_Pr = NULL; + } else { + /* Second Head (always CRT1) */ + pSiS->SecondHead = TRUE; + pSiSEnt->pScrn_2 = pScrn; + pSiS->DualHeadMode = TRUE; + } + } else { + /* TW: Only one screen in config file - disable dual head mode */ + pSiS->SecondHead = FALSE; + pSiS->DualHeadMode = FALSE; + pSiSEnt->DisableDual = TRUE; + } + } else { + /* TW: Entity is not shared - disable dual head mode */ + pSiS->SecondHead = FALSE; + pSiS->DualHeadMode = FALSE; } +#endif - xf86PrintDepthBpp(pScrn); + pSiS->ForceCursorOff = FALSE; - /* Get the depth24 pixmap format */ - if (pScrn->depth == 24 && pix24bpp == 0) - pix24bpp = xf86GetBppFromDepth(pScrn, 24); + /* TW: Allocate SiS_Private (for mode switching code) and initialize it */ + pSiS->SiS_Pr = NULL; +#ifdef SISDUALHEAD + if(pSiSEnt) { + if(pSiSEnt->SiS_Pr) pSiS->SiS_Pr = pSiSEnt->SiS_Pr; + } +#endif + if(!pSiS->SiS_Pr) { + if(!(pSiS->SiS_Pr = xnfcalloc(sizeof(SiS_Private), 1))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not allocate memory for SiS_Pr private\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); + return FALSE; + } +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->SiS_Pr = pSiS->SiS_Pr; +#endif + memset(pSiS->SiS_Pr, 0, sizeof(SiS_Private)); + } + pSiS->SiS_Pr->SiS_Backup70xx = 0xff; + pSiS->SiS_Pr->SiS_CHOverScan = -1; + pSiS->SiS_Pr->SiS_ChSW = FALSE; + pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE; + + /* TW: Get our relocated IO registers */ + pSiS->RelIO = (pSiS->PciInfo->ioBase[2] & 0xFFFC) + pSiS->IODBase; + pSiS->sishw_ext.ulIOAddress = pSiS->RelIO + 0x30; + xf86DrvMsg(pScrn->scrnIndex, from, "Relocated IO registers at 0x%lX\n", + (unsigned long)pSiS->RelIO); - /* + /* TW: Initialize SiS Port Reg definitions for externally used + * BIOS emulation (init.c/init301.c) functions. + */ + SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30); + + /* TW: The following identifies the old chipsets. This is only + * partly used since the really old chips are not supported, + * but I keep it here for future use. + */ + if(pSiS->VGAEngine == SIS_OLD_VGA || pSiS->VGAEngine == SIS_530_VGA) { + switch(pSiS->Chipset) { + case PCI_CHIP_SG86C205: /* Just for making it complete */ + { + unsigned char temp; + sisSaveUnlockExtRegisterLock(pSiS, &srlockReg, &crlockReg); + inSISIDXREG(SISSR, 0x10, temp); + if(temp & 0x80) pSiS->oldChipset = OC_SIS6205B; + else pSiS->oldChipset = (pSiS->ChipRev == 0x11) ? + OC_SIS6205C : OC_SIS6205A; + break; + } + case PCI_CHIP_SIS82C204: /* Just for making it complete */ + pSiS->oldChipset = OC_SIS82204; break; + case 0x6225: /* Just for making it complete */ + pSiS->oldChipset = OC_SIS6225; break; + case PCI_CHIP_SIS5597: + pSiS->oldChipset = OC_SIS5597; break; + case PCI_CHIP_SIS6326: + pSiS->oldChipset = OC_SIS6326; break; + case PCI_CHIP_SIS530: + if((pSiS->ChipRev & 0x0f) < 0x0a) + pSiS->oldChipset = OC_SIS530A; + else pSiS->oldChipset = OC_SIS530B; + break; + default: + pSiS->oldChipset = OC_UNKNOWN; + } + } + + if(!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86SetDepthBpp() error\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); + return FALSE; + } + + /* Check that the returned depth is one we support */ + temp = 0; + switch(pScrn->depth) { + case 8: + case 16: + case 24: + break; + case 15: + if((pSiS->VGAEngine == SIS_300_VGA) || + (pSiS->VGAEngine == SIS_315_VGA)) + temp = 1; + break; + default: + temp = 1; + } + + if(temp) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver/chipset\n", + pScrn->depth); + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); + return FALSE; + } + + xf86PrintDepthBpp(pScrn); + + /* Get the depth24 pixmap format */ + if(pScrn->depth == 24 && pix24bpp == 0) + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + + /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. */ - if (pScrn->depth > 8) { + if(pScrn->depth > 8) { /* The defaults are OK for us */ rgb zeros = {0, 0, 0}; - if (!xf86SetWeight(pScrn, zeros, zeros)) { + if(!xf86SetWeight(pScrn, zeros, zeros)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86SetWeight() error\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; } else { - /* XXX check that weight returned is supported */ - ; + Bool ret = FALSE; + switch(pScrn->depth) { + case 15: + if((pScrn->weight.red != 5) || + (pScrn->weight.green != 5) || + (pScrn->weight.blue != 5)) ret = TRUE; + break; + case 16: + if((pScrn->weight.red != 5) || + (pScrn->weight.green != 6) || + (pScrn->weight.blue != 5)) ret = TRUE; + break; + case 24: + if((pScrn->weight.red != 8) || + (pScrn->weight.green != 8) || + (pScrn->weight.blue != 8)) ret = TRUE; + break; + } + if(ret) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RGB Weight %d%d%d at depth %d not supported by hardware\n", + pScrn->weight.red, pScrn->weight.green, + pScrn->weight.blue, pScrn->depth); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); + return FALSE; + } } } - if (!xf86SetDefaultVisual(pScrn, -1)) { + /* TW: Set the current layout parameters */ + pSiS->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel; + pSiS->CurrentLayout.depth = pScrn->depth; + /* (Inside this function, we can use pScrn's contents anyway) */ + + if(!xf86SetDefaultVisual(pScrn, -1)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86SetDefaultVisual() error\n"); +#ifdef SISDUALHEAD + if (pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; } else { - /* We don't currently support DirectColor at > 8bpp */ + /* We don't support DirectColor at > 8bpp */ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" - " (%s) is not supported at depth %d\n", + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual " + "(%s) is not supported at depth %d\n", xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); +#ifdef SISDUALHEAD + if (pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; } } /* - * The new cmap layer needs this to be initialised. + * The cmap layer needs this to be initialised. */ - { Gamma zeros = {0.0, 0.0, 0.0}; - if (!xf86SetGamma(pScrn, zeros)) { + if(!xf86SetGamma(pScrn, zeros)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86SetGamma() error\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + SISFreeRec(pScrn); return FALSE; } } - /* We use a programmable clock */ + /* We use a programamble clock */ pScrn->progClock = TRUE; /* Set the bits per RGB for 8bpp mode */ - if (pScrn->depth == 8) { + if(pScrn->depth == 8) { pScrn->rgbBits = 6; } - pSiS->ddc1Read = SiSddc1Read; /* this cap will be modified */ + pSiS->ddc1Read = SiSddc1Read; from = X_DEFAULT; - outb(VGA_SEQ_INDEX, 0x05); unlock = inb(VGA_SEQ_DATA); - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock registers */ + /* Unlock registers */ + sisSaveUnlockExtRegisterLock(pSiS, &srlockReg, &crlockReg); - /* get VBIOS image */ - if (!(pSiS->BIOS=xcalloc(1, BIOS_SIZE))) { - ErrorF("Allocate memory fail !!\n"); - return FALSE; - } - if (xf86ReadBIOS(BIOS_BASE, 0, pSiS->BIOS, BIOS_SIZE) != BIOS_SIZE) { - xfree(pSiS->BIOS); - ErrorF("Read VBIOS image fail !!\n"); - return FALSE; + /* TW: We need no backup area (300/310/325 new mode switching code) */ + pSiS->sishw_ext.pSR = NULL; + pSiS->sishw_ext.pCR = NULL; + + /* TW: Read BIOS for 300 and 310/325 series customization */ + pSiS->sishw_ext.pjVirtualRomBase = NULL; + pSiS->BIOS = NULL; + pSiS->sishw_ext.UseROM = FALSE; + + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { +#ifdef SISDUALHEAD + if(pSiSEnt) { + if(pSiSEnt->BIOS) { + pSiS->BIOS = pSiSEnt->BIOS; + pSiS->sishw_ext.pjVirtualRomBase = pSiS->BIOS; + } + } +#endif + if(!pSiS->BIOS) { + if(!(pSiS->BIOS = xcalloc(1, BIOS_SIZE))) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Could not allocate memory for video BIOS image\n"); + } else { + unsigned long segstart; + unsigned short romptr; + BOOLEAN found; + int i; + static const char sis_rom_sig[] = "Silicon Integrated Systems"; + static const char *sis_sig[10] = { + "300", "540", "630", "730", + "315", "315", "315", "5315", "6325", + "Xabre" + }; + static const unsigned short sis_nums[10] = { + SIS_300, SIS_540, SIS_630, SIS_730, + SIS_315PRO, SIS_315H, SIS_315, SIS_550, SIS_650, + SIS_330 + }; + + found = FALSE; + for(segstart=BIOS_BASE; segstart<0x000f0000; segstart+=0x00001000) { + +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + if(xf86ReadBIOS(segstart, 0, pSiS->BIOS, BIOS_SIZE) != BIOS_SIZE) continue; +#else + if(xf86ReadDomainMemory(pSiS->PciTag, segstart, BIOS_SIZE, pSiS->BIOS) != BIOS_SIZE) continue; +#endif + + if((pSiS->BIOS[0] != 0x55) || (pSiS->BIOS[1] != 0xaa)) continue; + + romptr = pSiS->BIOS[0x12] | (pSiS->BIOS[0x13] << 8); + if(romptr > (BIOS_SIZE - strlen(sis_rom_sig))) continue; + if(strncmp(sis_rom_sig, (char *)&pSiS->BIOS[romptr], strlen(sis_rom_sig)) != 0) continue; + + romptr = pSiS->BIOS[0x14] | (pSiS->BIOS[0x15] << 8); + if(romptr > (BIOS_SIZE - 5)) continue; + for(i = 0; (i < 10) && (!found); i++) { + if(strncmp(sis_sig[i], (char *)&pSiS->BIOS[romptr], strlen(sis_sig[i])) == 0) { + if(sis_nums[i] == pSiS->sishw_ext.jChipType) { + found = TRUE; + break; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Ignoring BIOS for SiS %s at %p\n", sis_sig[i], segstart); + } + } + } + if(found) break; + } + + if(!found) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Could not find/read video BIOS\n"); + xfree(pSiS->BIOS); + pSiS->BIOS = NULL; + } else { +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->BIOS = pSiS->BIOS; +#endif + pSiS->sishw_ext.pjVirtualRomBase = pSiS->BIOS; + romptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Video BIOS version \"%7s\" found at %p\n", + &pSiS->BIOS[romptr], segstart); + } + + } + } + if(pSiS->BIOS) pSiS->sishw_ext.UseROM = TRUE; + else pSiS->sishw_ext.UseROM = FALSE; } + /* Evaluate options */ SiSOptions(pScrn); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!pSiS->SecondHead) { + /* TW: Copy some option settings to entity private */ + pSiSEnt->HWCursor = pSiS->HWCursor; + pSiSEnt->ForceCRT2Type = pSiS->ForceCRT2Type; + pSiSEnt->ForceTVType = pSiS->ForceTVType; + pSiSEnt->TurboQueue = pSiS->TurboQueue; + pSiSEnt->PDC = pSiS->PDC; + pSiSEnt->OptTVStand = pSiS->OptTVStand; + pSiSEnt->NonDefaultPAL = pSiS->NonDefaultPAL; + pSiSEnt->OptTVOver = pSiS->OptTVOver; + pSiSEnt->OptTVSOver = pSiS->OptTVSOver; + pSiSEnt->OptROMUsage = pSiS->OptROMUsage; + pSiSEnt->DSTN = pSiS->DSTN; + pSiSEnt->XvOnCRT2 = pSiS->XvOnCRT2; + pSiSEnt->NoAccel = pSiS->NoAccel; + pSiSEnt->NoXvideo = pSiS->NoXvideo; + pSiSEnt->forceCRT1 = pSiS->forceCRT1; + pSiSEnt->chtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs; + pSiSEnt->chtvlumabandwidthsvideo = pSiS->chtvlumabandwidthsvideo; + pSiSEnt->chtvlumaflickerfilter = pSiS->chtvlumaflickerfilter; + pSiSEnt->chtvchromabandwidth = pSiS->chtvchromabandwidth; + pSiSEnt->chtvchromaflickerfilter = pSiS->chtvchromaflickerfilter; + pSiSEnt->chtvtextenhance = pSiS->chtvtextenhance; + pSiSEnt->chtvcontrast = pSiS->chtvcontrast; + pSiSEnt->chtvcvbscolor = pSiS->chtvcvbscolor; + pSiSEnt->sistvedgeenhance = pSiS->sistvedgeenhance; + pSiSEnt->sistvantiflicker = pSiS->sistvantiflicker; + pSiSEnt->sistvsaturation = pSiS->sistvsaturation; + pSiSEnt->tvxpos = pSiS->tvxpos; + pSiSEnt->tvypos = pSiS->tvypos; + pSiSEnt->restorebyset = pSiS->restorebyset; + } else { + /* We always use same cursor type on both screens */ + if(pSiS->HWCursor != pSiSEnt->HWCursor) { + pSiS->HWCursor = pSiSEnt->HWCursor; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent HWCursor setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: HWCursor shall be %s\n", + pSiS->HWCursor ? "enabled" : "disabled"); + } + /* We need to use identical CRT2 Type setting */ + if(pSiS->ForceCRT2Type != pSiSEnt->ForceCRT2Type) { + if(pSiS->ForceCRT2Type != CRT2_DEFAULT) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Ignoring inconsistent ForceCRT2Type setting. Master head rules\n"); + } + pSiS->ForceCRT2Type = pSiSEnt->ForceCRT2Type; + } + if(pSiS->ForceTVType != pSiSEnt->ForceTVType) { + if(pSiS->ForceTVType != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Ignoring inconsistent ForceTVType setting. Master head rules\n"); + } + pSiS->ForceTVType = pSiSEnt->ForceTVType; + } + /* We need identical TurboQueue setting */ + if(pSiS->TurboQueue != pSiSEnt->TurboQueue) { + pSiS->TurboQueue = pSiSEnt->TurboQueue; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent TurboQueue setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: Turboqueue shall be %s\n", + pSiS->TurboQueue ? "enabled" : "disabled"); + } + /* We need identical PDC setting */ + if(pSiS->PDC != pSiSEnt->PDC) { + pSiS->PDC = pSiSEnt->PDC; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent PanelDelayCompensation setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: PanelDelayCompensation shall be %d%s\n", + pSiS->PDC, + (pSiS->PDC == -1) ? " (autodetected)" : ""); + } + /* We need identical TVStandard setting */ + if( (pSiS->OptTVStand != pSiSEnt->OptTVStand) || + (pSiS->NonDefaultPAL != pSiSEnt->NonDefaultPAL) ) { + if(pSiS->OptTVStand != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent TVStandard setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: TVStandard shall be %s\n", + (pSiSEnt->OptTVStand ? + ( (pSiSEnt->NonDefaultPAL == -1) ? "PAL" : + ((pSiSEnt->NonDefaultPAL) ? "PALM" : "PALN") ) + : "NTSC")); + } + pSiS->OptTVStand = pSiSEnt->OptTVStand; + pSiS->NonDefaultPAL = pSiSEnt->NonDefaultPAL; + } + /* We need identical UseROMData setting */ + if(pSiS->OptROMUsage != pSiSEnt->OptROMUsage) { + if(pSiS->OptROMUsage != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent UseROMData setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: Video ROM data usage shall be %s\n", + pSiSEnt->OptROMUsage ? "enabled" : "disabled"); + } + pSiS->OptROMUsage = pSiSEnt->OptROMUsage; + } + /* We need identical DSTN setting */ + if(pSiS->DSTN != pSiSEnt->DSTN) { + pSiS->DSTN = pSiSEnt->DSTN; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent DSTN setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: DSTN shall be %s\n", + pSiS->DSTN ? "enabled" : "disabled"); + } + /* We need identical XvOnCRT2 setting */ + if(pSiS->XvOnCRT2 != pSiSEnt->XvOnCRT2) { + pSiS->XvOnCRT2 = pSiSEnt->XvOnCRT2; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent XvOnCRT2 setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: Xv shall be used on CRT%d\n", + pSiS->XvOnCRT2 ? 2 : 1); + } + /* We need identical NoAccel setting */ + if(pSiS->NoAccel != pSiSEnt->NoAccel) { + pSiS->NoAccel = pSiSEnt->NoAccel; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent NoAccel setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: Acceleration shall be %s\n", + pSiS->NoAccel ? "disabled" : "enabled"); + } + /* We need identical ForceCRT1 setting */ + if(pSiS->forceCRT1 != pSiSEnt->forceCRT1) { + if(pSiS->forceCRT1 != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent ForceCRT1 setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: CRT1 shall be %s\n", + pSiSEnt->forceCRT1 ? "enabled" : "disabled"); + } + pSiS->forceCRT1 = pSiSEnt->forceCRT1; + } + /* We need identical TVOverscan setting */ + if(pSiS->OptTVOver != pSiSEnt->OptTVOver) { + if(pSiS->OptTVOver != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVOverscan setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: CHTVOverscan shall be %s\n", + pSiSEnt->OptTVOver ? "true (=overscan)" : "false (=underscan)"); + } + pSiS->OptTVOver = pSiSEnt->OptTVOver; + } + /* We need identical TVSOverscan setting */ + if(pSiS->OptTVSOver != pSiSEnt->OptTVSOver) { + if(pSiS->OptTVSOver != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVSuperOverscan setting\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Master head ruled: CHTVSuperOverscan shall be %s\n", + pSiSEnt->OptTVSOver ? "true" : "false"); + } + pSiS->OptTVSOver = pSiSEnt->OptTVSOver; + } + /* We need identical TV settings */ + if(pSiS->chtvtype != pSiSEnt->chtvtype) { + if(pSiS->chtvtype != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVType setting; set to %s\n", + (pSiSEnt->chtvtype) ? "SCART" : "HDTV"); + } + pSiS->chtvtype = pSiSEnt->chtvtype; + } + if(pSiS->chtvlumabandwidthcvbs != pSiSEnt->chtvlumabandwidthcvbs) { + if(pSiS->chtvlumabandwidthcvbs != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVLumaBandWidthCVBS setting; set to %d\n", + pSiSEnt->chtvlumabandwidthcvbs); + } + pSiS->chtvlumabandwidthcvbs = pSiSEnt->chtvlumabandwidthcvbs; + } + if(pSiS->chtvlumabandwidthsvideo != pSiSEnt->chtvlumabandwidthsvideo) { + if(pSiS->chtvlumabandwidthsvideo != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVLumaBandWidthSVIDEO setting; set to %d\n", + pSiSEnt->chtvlumabandwidthsvideo); + } + pSiS->chtvlumabandwidthsvideo = pSiSEnt->chtvlumabandwidthsvideo; + } + if(pSiS->chtvlumaflickerfilter != pSiSEnt->chtvlumaflickerfilter) { + if(pSiS->chtvlumaflickerfilter != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVLumaFlickerFilter setting; set to %d\n", + pSiSEnt->chtvlumaflickerfilter); + } + pSiS->chtvlumaflickerfilter = pSiSEnt->chtvlumaflickerfilter; + } + if(pSiS->chtvchromabandwidth != pSiSEnt->chtvchromabandwidth) { + if(pSiS->chtvchromabandwidth != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVChromaBandWidth setting; set to %d\n", + pSiSEnt->chtvchromabandwidth); + } + pSiS->chtvchromabandwidth = pSiSEnt->chtvchromabandwidth; + } + if(pSiS->chtvchromaflickerfilter != pSiSEnt->chtvchromaflickerfilter) { + if(pSiS->chtvchromaflickerfilter != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVChromaFlickerFilter setting; set to %d\n", + pSiSEnt->chtvchromaflickerfilter); + } + pSiS->chtvchromaflickerfilter = pSiSEnt->chtvchromaflickerfilter; + } + if(pSiS->chtvcvbscolor != pSiSEnt->chtvcvbscolor) { + if(pSiS->chtvcvbscolor != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVCVBSColor setting; set to %s\n", + pSiSEnt->chtvcvbscolor ? "true" : "false"); + } + pSiS->chtvcvbscolor = pSiSEnt->chtvcvbscolor; + } + if(pSiS->chtvtextenhance != pSiSEnt->chtvtextenhance) { + if(pSiS->chtvtextenhance != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVTextEnhance setting; set to %d\n", + pSiSEnt->chtvtextenhance); + } + pSiS->chtvtextenhance = pSiSEnt->chtvtextenhance; + } + if(pSiS->chtvcontrast != pSiSEnt->chtvcontrast) { + if(pSiS->chtvcontrast != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent CHTVContrast setting; set to %d\n", + pSiSEnt->chtvcontrast); + } + pSiS->chtvcontrast = pSiSEnt->chtvcontrast; + } + if(pSiS->sistvedgeenhance != pSiSEnt->sistvedgeenhance) { + if(pSiS->sistvedgeenhance != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent SISTVEdgeEnhance setting; set to %d\n", + pSiSEnt->sistvedgeenhance); + } + pSiS->sistvedgeenhance = pSiSEnt->sistvedgeenhance; + } + if(pSiS->sistvantiflicker != pSiSEnt->sistvantiflicker) { + if(pSiS->sistvantiflicker != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent SISTVAntiFlicker setting; set to %d\n", + pSiSEnt->sistvantiflicker); + } + pSiS->sistvantiflicker = pSiSEnt->sistvantiflicker; + } + if(pSiS->sistvsaturation != pSiSEnt->sistvsaturation) { + if(pSiS->sistvsaturation != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent SISTVSaturation setting; set to %d\n", + pSiSEnt->sistvsaturation); + } + pSiS->sistvsaturation = pSiSEnt->sistvsaturation; + } + if(pSiS->tvxpos != pSiSEnt->tvxpos) { + if(pSiS->tvxpos != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent TVXPosOffset setting; set to %d\n", + pSiSEnt->tvxpos); + } + pSiS->tvxpos = pSiSEnt->tvxpos; + } + if(pSiS->tvypos != pSiSEnt->tvypos) { + if(pSiS->tvypos != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Ignoring inconsistent TVYPosOffset setting; set to %d\n", + pSiSEnt->tvypos); + } + pSiS->tvypos = pSiSEnt->tvypos; + } + if(pSiS->restorebyset != pSiSEnt->restorebyset) { + pSiS->restorebyset = pSiSEnt->restorebyset; + } + } + } +#endif + /* TW: Handle UseROMData and NoOEM options */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + from = X_PROBED; + if(pSiS->OptROMUsage == 0) { + pSiS->sishw_ext.UseROM = FALSE; + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Video ROM data usage is %s\n", + pSiS->sishw_ext.UseROM ? "enabled" : "disabled"); + + if(!pSiS->OptUseOEM) + xf86DrvMsg(pScrn->scrnIndex, from, "Internal OEM LCD/TV data usage is disabled\n"); + + if(pSiS->sbiosn) { + if(pSiS->BIOS) { + FILE *fd = NULL; + int i; + if((fd = fopen(pSiS->sbiosn, "w" ))) { + i = fwrite(pSiS->BIOS, 65536, 1, fd); + fclose(fd); + } + } + xfree(pSiS->sbiosn); + } + } + + /* Do basic configuration */ SiSSetup(pScrn); from = X_PROBED; @@ -900,9 +2277,17 @@ } else { pSiS->FbAddress = pSiS->PciInfo->memBase[0] & 0xFFFFFFF0; } + + pSiS->realFbAddress = pSiS->FbAddress; - xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) + xf86DrvMsg(pScrn->scrnIndex, from, "Global linear framebuffer at 0x%lX\n", (unsigned long)pSiS->FbAddress); + else +#endif + xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", + (unsigned long)pSiS->FbAddress); if (pSiS->pEnt->device->IOBase != 0) { /* @@ -915,18 +2300,20 @@ pSiS->IOAddress = pSiS->PciInfo->memBase[1] & 0xFFFFFFF0; } - from = X_PROBED; xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pSiS->IOAddress); - - pSiS->RelIO = pSiS->PciInfo->ioBase[2] & 0xFFFC; - xf86DrvMsg(pScrn->scrnIndex, from, "Relocate IO registers at 0x%lX\n", - (unsigned long)pSiS->RelIO); + pSiS->sishw_ext.bIntegratedMMEnabled = TRUE; /* Register the PCI-assigned resources. */ - if (xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) { + if(xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86RegisterResources() found resource conflicts\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); + SISFreeRec(pScrn); return FALSE; } @@ -936,78 +2323,299 @@ from = X_CONFIG; } - if ((pSiS->Chipset == PCI_CHIP_SIS6326) - && (pScrn->videoRam >= 8192) + pSiS->RealVideoRam = pScrn->videoRam; + if((pSiS->Chipset == PCI_CHIP_SIS6326) + && (pScrn->videoRam > 4096) && (from != X_CONFIG)) { pScrn->videoRam = 4096; - xf86DrvMsg(pScrn->scrnIndex, from, "Limiting VideoRAM to %d KB\n", - pScrn->videoRam); + xf86DrvMsg(pScrn->scrnIndex, from, + "SiS6326: Detected %d KB VideoRAM, limiting to %d KB\n", + pSiS->RealVideoRam, pScrn->videoRam); } else xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d KB\n", pScrn->videoRam); - /* - * TW: New option: limit size of framebuffer memory for avoiding - * clash with DRI: - * Kernel framebuffer driver (sisfb) starts its memory heap - * at 8MB if it detects more VideoRAM than that(otherwise at 4MB). - * Therefore a setting of 8192 is recommended if DRI is - * to be used when there's more than 8MB video RAM available. - * This option can be left out if DRI is not to be used. - * Attention: TurboQueue and HWCursor should use videoRam value, - * not FbMapSize; these two are always located at the very top - * of the videoRAM. Both are already initialized by framebuffer - * driver, so they should not wander around while starting X. - */ - - pSiS->FbMapSize = pScrn->videoRam * 1024; - /* TW: Touching FbMapSize doesn't work; now use maxxfbmem in accel*.c */ - - if (pSiS->maxxfbmem) { - if (pSiS->maxxfbmem > pSiS->FbMapSize) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Invalid MaxXFBMem setting. Using all VideoRAM for framebuffer\n"); - pSiS->maxxfbmem = pSiS->FbMapSize; + if((pSiS->Chipset == PCI_CHIP_SIS6326) && + (pScrn->videoRam > 4096)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SiS6326 engines do not support more than 4096KB RAM, therefore\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "TurboQueue, HWCursor, 2D acceleration and XVideo are disabled.\n"); + pSiS->TurboQueue = FALSE; + pSiS->HWCursor = FALSE; + pSiS->NoXvideo = TRUE; + pSiS->NoAccel = TRUE; + } + + pSiS->FbMapSize = pSiS->availMem = pScrn->videoRam * 1024; + pSiS->sishw_ext.ulVideoMemorySize = pScrn->videoRam * 1024; + pSiS->sishw_ext.bSkipDramSizing = TRUE; + + /* TW: Calculate real availMem according to Accel/TurboQueue and + * HWCursur setting. Also, initialize some variables used + * in other modules. + */ + pSiS->cursorOffset = 0; + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + pSiS->TurboQueueLen = 512; + if(pSiS->TurboQueue) { + pSiS->availMem -= (pSiS->TurboQueueLen*1024); + pSiS->cursorOffset = 512; + } + if(pSiS->HWCursor) { + pSiS->availMem -= pSiS->CursorSize; + if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize; + } + pSiS->CmdQueLenMask = 0xFFFF; + pSiS->CmdQueLenFix = 0; + pSiS->cursorBufferNum = 0; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->cursorBufferNum = 0; +#endif + break; + case SIS_315_VGA: + if(pSiS->TurboQueue) { + pSiS->availMem -= (512*1024); /* Command Queue is 512k */ + pSiS->cursorOffset = 512; + } + if(pSiS->HWCursor) { + pSiS->availMem -= pSiS->CursorSize; + if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize; + } + pSiS->cursorBufferNum = 0; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->cursorBufferNum = 0; +#endif + break; + default: + /* TW: cursorOffset not used in cursor functions for 530 and + * older chips, because the cursor is *above* the TQ. + * On 5597 and older revisions of the 6326, the TQ is + * max 32K, on newer 6326 revisions and the 530 either 30 + * (or 32?) or 62K (or 64?). However, to make sure, we + * use only 30K (or 32?), but reduce the available memory + * by 64, and locate the TQ at the beginning of this last + * 64K block. (We do this that way even when using the + * HWCursor, because the cursor only takes 2K, and the queue + * does not seem to last that far anyway.) + * The TQ must be located at 32KB boundaries. + */ + if(pSiS->RealVideoRam < 3072) { + if(pSiS->TurboQueue) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not enough video RAM for TurboQueue. TurboQueue disabled\n"); + } + pSiS->TurboQueue = FALSE; + } + pSiS->CmdQueMaxLen = 32; + if(pSiS->TurboQueue) { + pSiS->availMem -= (64*1024); + pSiS->CmdQueMaxLen = 900; /* TW: To make sure; should be 992 */ + } else if (pSiS->HWCursor) { + pSiS->availMem -= pSiS->CursorSize; + } + if(pSiS->Chipset == PCI_CHIP_SIS530) { + /* TW: Check if Flat Panel is enabled */ + inSISIDXREG(SISSR, 0x0e, tempreg); + if(!tempreg & 0x04) pSiS->availMem -= pSiS->CursorSize; + + /* TW: Set up mask for MMIO register */ + pSiS->CmdQueLenMask = (pSiS->TurboQueue) ? 0x1FFF : 0x00FF; + } else { + /* TW: TQ is never used on 6326/5597, because the accelerator + * always Syncs. So this is just cosmentic work. (And I + * am not even sure that 0x7fff is correct. MMIO 0x83a8 + * holds 0xec0 if (30k) TQ is enabled, 0x20 if TQ disabled. + * The datasheet has no real explanation on the queue length + * if the TQ is enabled. Not syncing and waiting for a + * suitable queue length instead does not work. + */ + pSiS->CmdQueLenMask = (pSiS->TurboQueue) ? 0x7FFF : 0x003F; + } + + /* TW: This is to be subtracted from MMIO queue length register contents + * for getting the real Queue length. + */ + pSiS->CmdQueLenFix = (pSiS->TurboQueue) ? 32 : 0; + } + +#ifdef SISDUALHEAD + /* TW: In dual head mode, we share availMem equally - so align it + * to 8KB; this way, the address of the FB of the second + * head is aligned to 4KB for mapping. + */ + if (pSiS->DualHeadMode) + pSiS->availMem &= 0xFFFFE000; +#endif + + /* TW: Check MaxXFBMem setting */ +#ifdef SISDUALHEAD + /* TW: Since DRI is not supported in dual head mode, we + don't need MaxXFBMem setting. */ + if (pSiS->DualHeadMode) { + if(pSiS->maxxfbmem) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "MaxXFBMem not used in Dual Head mode. Using all VideoRAM.\n"); + } + pSiS->maxxfbmem = pSiS->availMem; + } else +#endif + if (pSiS->maxxfbmem) { + if (pSiS->maxxfbmem > pSiS->availMem) { + if (pSiS->sisfbMem) { + pSiS->maxxfbmem = pSiS->sisfbMem * 1024; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Invalid MaxXFBMem setting. Using sisfb heap start information\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Invalid MaxXFBMem setting. Using all VideoRAM for framebuffer\n"); + pSiS->maxxfbmem = pSiS->availMem; + } + } else if (pSiS->sisfbMem) { + if (pSiS->maxxfbmem > pSiS->sisfbMem * 1024) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "MaxXFBMem beyond sisfb heap start. Using sisfb heap start information\n"); + pSiS->maxxfbmem = pSiS->sisfbMem * 1024; + } } - } else pSiS->maxxfbmem = pSiS->FbMapSize; + } else if (pSiS->sisfbMem) { + pSiS->maxxfbmem = pSiS->sisfbMem * 1024; + } + else pSiS->maxxfbmem = pSiS->availMem; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %dK of framebuffer memory\n", + pSiS->maxxfbmem / 1024); - /* TW: Detect video bridge */ + /* TW: Check if the chipset supports two video overlays */ + pSiS->Flags650 = 0; + if ( (!pSiS->NoXvideo) && + ( pSiS->VGAEngine == SIS_300_VGA || + pSiS->VGAEngine == SIS_315_VGA || + pSiS->Chipset == PCI_CHIP_SIS530 || + pSiS->Chipset == PCI_CHIP_SIS6326 || + pSiS->Chipset == PCI_CHIP_SIS5597 ) ) { + pSiS->hasTwoOverlays = FALSE; + switch (pSiS->Chipset) { + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS330: /* ? */ + pSiS->hasTwoOverlays = TRUE; + break; + case PCI_CHIP_SIS650: + { + static const char *id650str[] = { + "0", "0", "0", "0", + "0 A0 AA", "0 A2 CA", "0", "0", + "0M A0", "0M A1 AA", "1 A0 AA", "1 A1 AA" + "0", "0", "0", "0" + }; + inSISIDXREG(SISCR, 0x5F, CR5F); + CR5F &= 0xf0; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS650 revision ID %x (SiS65%s)\n", CR5F, id650str[CR5F >> 4]); + if((CR5F == 0x80) || (CR5F == 0x90) || (CR5F == 0xa0) || (CR5F == 0xb0)) { + pSiS->hasTwoOverlays = TRUE; /* TW: This is an M650 or 651 */ + pSiS->Flags650 |= SiS650_LARGEOVERLAY; + } + break; + } + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Hardware supports %s video overlay%s\n", + pSiS->hasTwoOverlays ? "two" : "one", + pSiS->hasTwoOverlays ? "s" : ""); + } + + /* TW: Backup VB connection and CRT1 on/off register */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + inSISIDXREG(SISCR, 0x32, pSiS->oldCR32); + inSISIDXREG(SISCR, 0x17, pSiS->oldCR17); + pSiS->postVBCR32 = pSiS->oldCR32; + } + + if(pSiS->forceCRT1 != -1) { + if(pSiS->forceCRT1) pSiS->CRT1off = 0; + else pSiS->CRT1off = 1; + } else pSiS->CRT1off = -1; + + /* TW: There are some strange machines out there which require a special + * manupulation of ISA bridge registers in order to make the Chrontel + * work. Try to find out if we're running on such a machine. + */ + pSiS->SiS_Pr->SiS_ChSW = FALSE; + if(pSiS->Chipset == PCI_CHIP_SIS630) { + int i=0; + do { + if(mychswtable[i].subsysVendor == pSiS->PciInfo->subsysVendor && + mychswtable[i].subsysCard == pSiS->PciInfo->subsysCard) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PCI card/vendor found in list for Chrontel/ISA bridge poking\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Vendor: %s (ID %04x)\n", + mychswtable[i].vendorName, pSiS->PciInfo->subsysCard); + pSiS->SiS_Pr->SiS_ChSW = TRUE; + } + i++; + } while(mychswtable[i].subsysVendor != 0); + } + + /* TW: Detect video bridge and sense connected devices */ SISVGAPreInit(pScrn); + /* TW: Detect CRT1 */ + SISCRT1PreInit(pScrn); /* TW: Detect CRT2-LCD and LCD size */ SISLCDPreInit(pScrn); /* TW: Detect CRT2-TV and PAL/NTSC mode */ SISTVPreInit(pScrn); /* TW: Detect CRT2-VGA */ SISCRT2PreInit(pScrn); + + /* TW: Backup detected CRT2 devices */ + pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD | CRT2_TV | CRT2_VGA); + /* TW: Eventually overrule detected CRT2 type */ - if (pSiS->ForceCRT2Type == CRT2_DEFAULT) - { - if (pSiS->VBFlags & CRT2_VGA) + if(pSiS->ForceCRT2Type == CRT2_DEFAULT) { + if(pSiS->VBFlags & CRT2_VGA) pSiS->ForceCRT2Type = CRT2_VGA; - else if (pSiS->VBFlags & CRT2_LCD) + else if(pSiS->VBFlags & CRT2_LCD) pSiS->ForceCRT2Type = CRT2_LCD; - else if (pSiS->VBFlags & CRT2_TV) + else if(pSiS->VBFlags & CRT2_TV) pSiS->ForceCRT2Type = CRT2_TV; } - switch (pSiS->ForceCRT2Type) - { - case CRT2_TV: + + switch(pSiS->ForceCRT2Type) { + case CRT2_TV: pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD | CRT2_VGA); - if (pSiS->VBFlags & VB_VIDEOBRIDGE) + if(pSiS->VBFlags & VB_VIDEOBRIDGE) pSiS->VBFlags = pSiS->VBFlags | CRT2_TV; else pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV); break; - case CRT2_LCD: + case CRT2_LCD: pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_VGA); - if (pSiS->VBFlags & VB_VIDEOBRIDGE) + if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (pSiS->VBLCDFlags)) pSiS->VBFlags = pSiS->VBFlags | CRT2_LCD; - else + else { pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Can't force CRT2 to LCD, no panel detected\n"); + } break; - case CRT2_VGA: + case CRT2_VGA: + if(pSiS->VBFlags & VB_LVDS) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "LVDS does not support secondary VGA\n"); + break; + } + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiS30xLV bridge does not support secondary VGA\n"); + break; + } pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_LCD); - if (pSiS->VBFlags & VB_VIDEOBRIDGE) + if(pSiS->VBFlags & VB_VIDEOBRIDGE) pSiS->VBFlags = pSiS->VBFlags | CRT2_VGA; else pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_VGA); @@ -1015,31 +2623,429 @@ default: pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA); } + + /* TW: Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART) */ + if(pSiS->ForceTVType != -1) { + if(pSiS->VBFlags & VB_SISBRIDGE) { + pSiS->VBFlags &= ~(TV_INTERFACE); + pSiS->VBFlags |= pSiS->ForceTVType; + } + } + + /* TW: Handle ForceCRT1 option */ + pSiS->CRT1changed = FALSE; + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + usScratchCR17 = pSiS->oldCR17; + usScratchCR32 = pSiS->postVBCR32; + if(pSiS->VESA != 1) { + /* TW: Copy forceCRT1 option to CRT1off if option is given */ +#ifdef SISDUALHEAD + /* TW: In DHM, handle this option only for master head, not the slave */ + if( (pSiS->forceCRT1 != -1) && + (!(pSiS->DualHeadMode && pSiS->SecondHead)) ) { +#else + if(pSiS->forceCRT1 != -1) { +#endif + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "CRT1 detection overruled by ForceCRT1 option\n"); + if(pSiS->forceCRT1) { + pSiS->CRT1off = 0; + if (!(usScratchCR17 & 0x80)) pSiS->CRT1changed = TRUE; + usScratchCR17 |= 0x80; + usScratchCR32 |= 0x20; + } else { + if( ! ( (pScrn->bitsPerPixel == 8) && + ( (pSiS->VBFlags & VB_LVDS) || + ((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->VBFlags & VB_301B)) ) ) ) { + pSiS->CRT1off = 1; + if (usScratchCR17 & 0x80) pSiS->CRT1changed = TRUE; + usScratchCR32 &= ~0x20; + /* TW: We must not actually switch off CRT1 before we changed the mode! */ + } + } + outSISIDXREG(SISCR, 0x17, usScratchCR17); + outSISIDXREG(SISCR, 0x32, usScratchCR32); + if(pSiS->CRT1changed) { + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + usleep(10000); + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CRT1 status changed by ForceCRT1 option\n"); + } + } + } + /* TW: Store the new VB connection register contents for later mode changes */ + pSiS->newCR32 = usScratchCR32; + } - /* TW: Check if CRT1 used (or needed; this if no CRT2 detected) */ + /* TW: Check if CRT1 used (or needed; this eg. if no CRT2 detected) */ if (pSiS->VBFlags & VB_VIDEOBRIDGE) { - if (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) + + /* TW: No CRT2 output? Then we NEED CRT1! + * We also need CRT1 if depth = 8 and bridge=LVDS|630+301B + */ + if ( (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) || + ( (pScrn->bitsPerPixel == 8) && + ( (pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) || + ((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->VBFlags & VB_301B)) ) ) ) { pSiS->CRT1off = 0; - } - else /* TW: no video bridge? Then we NEED CRT1! */ + } + /* TW: No CRT2 output? Then we can't use Xv on CRT2 */ + if (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) + pSiS->XvOnCRT2 = FALSE; + + } else { /* TW: no video bridge? */ + + /* Then we NEED CRT1... */ pSiS->CRT1off = 0; + /* ... and can't use CRT2 for Xv output */ + pSiS->XvOnCRT2 = FALSE; + } + + /* TW: Handle TVStandard option */ + if(pSiS->NonDefaultPAL != -1) { + if( (!(pSiS->VBFlags & VB_SISBRIDGE)) && + (!((pSiS->VBFlags & VB_CHRONTEL)) && (pSiS->ChrontelType == CHRONTEL_701x)) ) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PALM and PALN only supported on Chrontel 701x and SiS30x/B/LV\n"); + pSiS->NonDefaultPAL = -1; + pSiS->VBFlags &= ~(TV_PALN | TV_PALM); + } + } + if(pSiS->NonDefaultPAL != -1) { + if((pSiS->Chipset == PCI_CHIP_SIS300) || (pSiS->Chipset == PCI_CHIP_SIS540)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PALM and PALN not supported on SiS300 and SiS540\n"); + pSiS->NonDefaultPAL = -1; + pSiS->VBFlags &= ~(TV_PALN | TV_PALM); + } + } + if(pSiS->OptTVStand != -1) { + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + if(!(pSiS->Flags & (TV_CHSCART | TV_CHHDTV))) { + pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM); + if(pSiS->OptTVStand) pSiS->VBFlags |= TV_PAL; + else pSiS->VBFlags |= TV_NTSC; + if(pSiS->NonDefaultPAL == 1) pSiS->VBFlags |= TV_PALM; + else if(!pSiS->NonDefaultPAL) pSiS->VBFlags |= TV_PALN; + } else { + pSiS->OptTVStand = pSiS->NonDefaultPAL = -1; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Option TVStandard ignored for SCART and 480i HDTV\n"); + } + } else if(pSiS->Chipset == PCI_CHIP_SIS6326) { + pSiS->SiS6326Flags &= ~SIS6326_TVPAL; + if(pSiS->OptTVStand) pSiS->SiS6326Flags |= SIS6326_TVPAL; + } + } + + /* TW: Do some checks */ + if(pSiS->OptTVOver != -1) { + if(pSiS->VBFlags & VB_CHRONTEL) { + pSiS->UseCHOverScan = pSiS->OptTVOver; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CHTVOverscan option only supported on CHRONTEL 70xx\n"); + pSiS->UseCHOverScan = -1; + } + } else pSiS->UseCHOverScan = -1; + + if(pSiS->sistvedgeenhance != -1) { + if(!(pSiS->VBFlags & VB_301)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SISTVEdgeEnhance option only supported on SiS301\n"); + pSiS->sistvedgeenhance = -1; + } + } - /* TW: Determine CRT1<>CRT2 mode */ - if (pSiS->VBFlags & DISPTYPE_DISP2) { - if (pSiS->CRT1off) /* TW: CRT2 only */ + /* TW: Determine CRT1<>CRT2 mode + * Note: When using VESA or if the bridge is in slavemode, display + * is ALWAYS in MIRROR_MODE! + * This requires extra checks in functions using this flag! + * (see sis_video.c for example) + */ + if(pSiS->VBFlags & DISPTYPE_DISP2) { + if(pSiS->CRT1off) { /* TW: CRT2 only ------------------------------- */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "CRT1 not detected or forced off. Dual Head mode can't initialize.\n"); + if(pSiSEnt) pSiSEnt->DisableDual = TRUE; + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); + SISFreeRec(pScrn); + return FALSE; + } +#endif pSiS->VBFlags |= VB_DISPMODE_SINGLE; - else /* TW: CRT1 and CRT2 - mirror image */ - pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1); - } else /* TW: CRT1 only */ + /* TW: No CRT1? Then we use the video overlay on CRT2 */ + pSiS->XvOnCRT2 = TRUE; + } else /* TW: CRT1 and CRT2 - mirror or dual head ----- */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiS->VBFlags |= (VB_DISPMODE_DUAL | DISPTYPE_CRT1); + if(pSiS->VESA != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VESA option not used in Dual Head mode. VESA disabled.\n"); + } + if (pSiSEnt) pSiSEnt->DisableDual = FALSE; + pSiS->VESA = 0; + } else +#endif + pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1); + } else { /* TW: CRT1 only ------------------------------- */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No CRT2 output selected or no bridge detected. " + "Dual Head mode can't initialize.\n"); + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); + SISFreeRec(pScrn); + return FALSE; + } +#endif pSiS->VBFlags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1); + } + + if( (pSiS->VGAEngine == SIS_315_VGA) || + (pSiS->VGAEngine == SIS_300_VGA) ) { + if ( (!pSiS->NoXvideo) && + (!pSiS->hasTwoOverlays) ) { + xf86DrvMsg(pScrn->scrnIndex, from, + "Using Xv overlay on CRT%d\n", + pSiS->XvOnCRT2 ? 2 : 1); + } + } + /* TW: Init Ptrs for Save/Restore functions and calc MaxClock */ SISDACPreInit(pScrn); + + /* ********** end of VBFlags setup ********** */ + + /* TW: VBFlags are initialized now. Back them up for SlaveMode modes. */ + pSiS->VBFlags_backup = pSiS->VBFlags; + + /* TW: Find out about paneldelaycompensation and evaluate option */ + pSiS->sishw_ext.pdc = 0; + + if(pSiS->VGAEngine == SIS_300_VGA) { + + if(pSiS->VBFlags & (VB_LVDS | VB_301B | VB_302B)) { + /* TW: Save the current PDC if the panel is used at the moment. + * This seems by far the safest way to find out about it. + * If the system is using an old version of sisfb, we can't + * trust the pdc register value. If sisfb saved the pdc for + * us, use it. + */ + if(pSiS->sisfbpdc) { + pSiS->sishw_ext.pdc = pSiS->sisfbpdc; + } else { + if(!(pSiS->donttrustpdc)) { + unsigned char tmp; + inSISIDXREG(SISCR, 0x30, tmp); + if(tmp & 0x20) { + inSISIDXREG(SISPART1, 0x13, pSiS->sishw_ext.pdc); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); + } + } + pSiS->sishw_ext.pdc &= 0x3c; + if(pSiS->sishw_ext.pdc) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD PanelDelayCompensation %d\n", + pSiS->sishw_ext.pdc); + } + + /* If we haven't been able to find out, use our other methods */ + if(pSiS->sishw_ext.pdc == 0) { + + int i=0; + do { + if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor && + mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PCI card/vendor found in list for non-default PanelDelayCompensation\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: %d\n", + mypdctable[i].vendorName, mypdctable[i].cardName, + pSiS->PciInfo->subsysCard, mypdctable[i].pdc); + if(pSiS->PDC == -1) { + pSiS->PDC = mypdctable[i].pdc; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "PanelDelayCompensation overruled by option\n"); + } + break; + } + i++; + } while(mypdctable[i].subsysVendor != 0); + + } + + if(pSiS->PDC != -1) { + if(pSiS->BIOS) { + if(pSiS->VBFlags & VB_LVDS) { + if(pSiS->BIOS[0x220] & 0x80) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS contains custom LCD Panel Delay Compensation %d\n", + pSiS->BIOS[0x220] & 0x3c); + pSiS->BIOS[0x220] &= 0x7f; + } + } + if(pSiS->VBFlags & (VB_301B|VB_302B)) { + if(pSiS->BIOS[0x220] & 0x80) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS contains custom LCD Panel Delay Compensation %d\n", + ( (pSiS->VBLCDFlags & VB_LCD_1280x1024) ? + pSiS->BIOS[0x223] : pSiS->BIOS[0x224] ) & 0x3c); + pSiS->BIOS[0x220] &= 0x7f; + } + } + } + pSiS->sishw_ext.pdc = (pSiS->PDC & 0x3c); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using LCD Panel Delay Compensation %d\n", pSiS->PDC); + } + } + } + +#ifdef SISDUALHEAD + /* TW: In dual head mode, both heads (currently) share the maxxfbmem equally. + * If memory sharing is done differently, the following has to be changed; + * the other modules (eg. accel and Xv) use dhmOffset for hardware + * pointer settings relative to VideoRAM start and won't need to be changed. + */ + if (pSiS->DualHeadMode) { + if (pSiS->SecondHead == FALSE) { + /* ===== First head (always CRT2) ===== */ + /* We use only half of the memory available */ + pSiS->maxxfbmem /= 2; + /* Initialize dhmOffset */ + pSiS->dhmOffset = 0; + /* Copy framebuffer addresses & sizes to entity */ + pSiSEnt->masterFbAddress = pSiS->FbAddress; + pSiSEnt->masterFbSize = pSiS->maxxfbmem; + pSiSEnt->slaveFbAddress = pSiS->FbAddress + pSiS->maxxfbmem; + pSiSEnt->slaveFbSize = pSiS->maxxfbmem; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%dKB video RAM at 0x%lx available for master head (CRT2)\n", + pSiS->maxxfbmem/1024, pSiS->FbAddress); + } else { + /* ===== Second head (always CRT1) ===== */ + /* We use only half of the memory available */ + pSiS->maxxfbmem /= 2; + /* Adapt FBAddress */ + pSiS->FbAddress += pSiS->maxxfbmem; + /* Initialize dhmOffset */ + pSiS->dhmOffset = pSiS->availMem - pSiS->maxxfbmem; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%dKB video RAM at 0x%lx available for slave head (CRT1)\n", + pSiS->maxxfbmem/1024, pSiS->FbAddress); + } + } else + pSiS->dhmOffset = 0; +#endif + + /* TW: Note: Do not use availMem for anything from now. Use + * maxxfbmem instead. (availMem does not take dual head + * mode into account.) + */ + + /* TW: Now for something completely different: DDC. + For 300 and 310/325 series, we provide our + own functions (in order to probe CRT2 as well) + If these fail, use the VBE. + All other chipsets will use VBE. No need to re-invent + the wheel there. + */ + + pSiS->pVbe = NULL; + didddc2 = FALSE; + + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + if(xf86LoadSubModule(pScrn, "ddc")) { + xf86LoaderReqSymLists(ddcSymbols, NULL); + if((pMonitor = SiSDoPrivateDDC(pScrn))) { + didddc2 = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "DDC monitor info:\n"); + xf86PrintEDID(pMonitor); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "End of DDC monitor info\n"); + xf86SetDDCproperties(pScrn, pMonitor); + pScrn->monitor->DDC = pMonitor; + } + } + } + +#ifdef SISDUALHEAD + /* TW: In dual head mode, probe DDC using VBE only for CRT1 (second head) */ + if((pSiS->DualHeadMode) && (!didddc2) && (!pSiS->SecondHead)) + didddc2 = TRUE; +#endif - /* Lock extended registers */ - outw(VGA_SEQ_INDEX, (unlock << 8) | 0x05); + /* TW: If CRT1 is off (eventually forced), skip DDC */ + if((!didddc2) && (pSiS->CRT1off)) didddc2 = TRUE; + /* TW: Now (re-)load and initialize the DDC module */ + if(!didddc2) { + + if(xf86LoadSubModule(pScrn, "ddc")) { + + xf86LoaderReqSymLists(ddcSymbols, NULL); + + /* TW: Now load and initialize VBE module. */ + if(xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + pSiS->pVbe = VBEInit(pSiS->pInt,pSiS->pEnt->index); +#else + pSiS->pVbe = VBEExtendedInit(pSiS->pInt,pSiS->pEnt->index, + SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); +#endif + if(!pSiS->pVbe) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Could not initialize VBE module for DDC\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Could not load VBE module for DDC\n"); + } + + if(pSiS->pVbe) { + if((pMonitor = vbeDoEDID(pSiS->pVbe,NULL))) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "VBE DDC monitor info:\n"); + xf86SetDDCproperties(pScrn, xf86PrintEDID(pMonitor)); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "End of VBE DDC monitor info:\n"); + pScrn->monitor->DDC = pMonitor; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Could not retrieve DDC data\n"); + } + } + } + +#if 0 /* TW: DDC1 obviously no longer supported by SiS chipsets */ + if (!ret && pSiS->ddc1Read) + xf86SetDDCproperties(pScrn, xf86PrintEDID(xf86DoEDID_DDC1( + pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ))); +#endif + + /* end of DDC */ + /* Set the min pixel clock */ - pSiS->MinClock = 16250; /* XXX Guess, need to check this */ + pSiS->MinClock = 12000; /* XXX Guess, need to check this (TW: good for even 50Hz interlace) */ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %d MHz\n", pSiS->MinClock / 1000); @@ -1048,10 +3054,9 @@ * If the user has specified ramdac speed in the XF86Config * file, we respect that setting. */ - if (pSiS->pEnt->device->dacSpeeds[0]) { + if(pSiS->pEnt->device->dacSpeeds[0]) { int speed = 0; - - switch (pScrn->bitsPerPixel) { + switch(pScrn->bitsPerPixel) { case 8: speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP8]; break; @@ -1065,7 +3070,7 @@ speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP32]; break; } - if (speed == 0) + if(speed == 0) pSiS->MaxClock = pSiS->pEnt->device->dacSpeeds[0]; else pSiS->MaxClock = speed; @@ -1084,8 +3089,131 @@ clockRanges->maxClock = pSiS->MaxClock; clockRanges->clockIndex = -1; /* programmable */ clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = TRUE; /* XXX check this */ + clockRanges->doubleScanAllowed = TRUE; + + /* TW: If there is no HSync or VRefresh data for the monitor, + derive it from DDC data. (Idea taken from radeon driver) + */ + if(pScrn->monitor->DDC) { + if(pScrn->monitor->nHsync <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Substituting missing monitor HSync data by DDC data\n"); + SiSSetSyncRangeFromEdid(pScrn, 1); + } + if(pScrn->monitor->nVrefresh <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Substituting missing monitor VRefresh data by DDC data\n"); + SiSSetSyncRangeFromEdid(pScrn, 0); + } + } + + /* + * TW: Since we have lots of built-in modes for 300/310/325/330 series + * with vb support, we replace the given default mode list with our + * own. In case the video bridge is to be used, no other than our + * built-in modes are supported; therefore, delete the entire modelist + * given. + */ + + pSiS->HaveCustomModes = FALSE; + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + if(!(pSiS->noInternalModes)) { + if((mymodes = SiSBuildBuiltInModeList(pScrn))) { +#ifdef SISDUALHEAD + if( (pSiS->UseVESA) || + ((pSiS->DualHeadMode) && (!pSiS->SecondHead)) || + ((!pSiS->DualHeadMode) && (pSiS->VBFlags & DISPTYPE_DISP2)) ) { +#else + if((pSiS->UseVESA) || (pSiS->VBFlags & DISPTYPE_DISP2)) { +#endif + while(pScrn->monitor->Modes) + xf86DeleteMode(&pScrn->monitor->Modes, pScrn->monitor->Modes); + pScrn->monitor->Modes = mymodes; + } else { + delmode = pScrn->monitor->Modes; + while(delmode) { + if(delmode->type & M_T_DEFAULT) { + tempmode = delmode->next; + xf86DeleteMode(&pScrn->monitor->Modes, delmode); + delmode = tempmode; + } else { + delmode = delmode->next; + } + } + tempmode = pScrn->monitor->Modes; + if(tempmode) pSiS->HaveCustomModes = TRUE; + pScrn->monitor->Modes = mymodes; + while(mymodes) { + if(!mymodes->next) break; + else mymodes = mymodes->next; + } + mymodes->next = tempmode; + if(tempmode) { + tempmode->prev = mymodes; + } + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Replaced %s mode list with built-in modes\n", + pSiS->HaveCustomModes ? "default" : "entire"); +#ifdef TWDEBUG + pScrn->modes = pScrn->monitor->Modes; + xf86PrintModes(pScrn); + pScrn->modes = NULL; +#endif + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Building list of built-in modes failed, using XFree86 defaults\n"); + } + } + } + + /* + * TW: Add our built-in modes for TV on the 6326 + */ + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Adding %s TV modes for 6326 to mode list:\n", + (pSiS->SiS6326Flags & SIS6326_TVPAL) ? "PAL" : "NTSC"); + if(pSiS->SiS6326Flags & SIS6326_TVPAL) { + SiS6326PAL800x600Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &SiS6326PAL640x480Mode; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "\"PAL800x600\" \"PAL800x600U\" \"PAL720x540\" \"PAL640x480\"\n"); + } else { + SiS6326NTSC640x480Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &SiS6326NTSC640x400Mode; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "\"NTSC640x480\" \"NTSC640x480U\" \"NTSC640x400\"\n"); + } + } + } + + /* + * TW: Add our built-in hi-res modes on the 6326 + */ + if(pSiS->Chipset == PCI_CHIP_SIS6326) { + if(pScrn->bitsPerPixel == 8) { + SiS6326SIS1600x1200_60Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &SiS6326SIS1600x1200_60Mode; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Adding mode \"SIS1600x1200-60\" (depth 8 only)\n"); + } + if(pScrn->bitsPerPixel <= 16) { + SiS6326SIS1280x1024_75Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &SiS6326SIS1280x1024_75Mode; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Adding mode \"SIS1280x1024-75\" (depth 8, 15 and 16 only)\n"); + } + } + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "\"Unknown reason\" in the following list means that the mode\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "is not supported on the chipset/bridge/current output device.\n"); + } + /* * xf86ValidateModes will check that the mode HTotal and VTotal values * don't exceed the chipset's limit if pScrn->maxHValue and @@ -1095,8 +3223,8 @@ /* Select valid modes from those available */ /* - * XXX Assuming min pitch 256, max 4096 ==> 8192 - * XXX Assuming min height 128, max 4096 + * Assuming min pitch 256, max 4096 ==> 8192 + * Assuming min height 128, max 4096 */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, @@ -1107,16 +3235,146 @@ pSiS->maxxfbmem, LOOKUP_BEST_REFRESH); - if (i == -1) { + if(i == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86ValidateModes() error\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); SISFreeRec(pScrn); return FALSE; } + /* TW: Go through mode list and mark all those modes as bad, + * - which are unsuitable for dual head mode (if running dhm), + * - which exceed the LCD panels specs (if running on LCD) + * - TODO: which exceed TV capabilities (if running on TV) + * Also, find the highest used pixelclock on the master head. + */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!pSiS->SecondHead) pSiSEnt->maxUsedClock = 0; + } +#endif + if((p = first = pScrn->modes)) { + do { + n = p->next; + + /* TW: Check the modes if they comply with our built-in tables. + * This is of practical use only if the user disabled the + * usage of the internal (built-in) modes. + */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + if(p->type & M_T_DEFAULT) { + if( ( (strcmp(p->name, "320x200") != 0) && + (strcmp(p->name, "320x240") != 0) && + (strcmp(p->name, "400x300") != 0) && + (strcmp(p->name, "512x384") != 0) ) && + (p->Flags & V_DBLSCAN) ) { + p->status = MODE_NO_DBLESCAN; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (mode not supported as doublescan)\n", p->name); + } + if( ( (strcmp(p->name, "1024x768") != 0) && + (strcmp(p->name, "1280x1024") != 0) && + (strcmp(p->name, "848x480") != 0) && + (strcmp(p->name, "856x480") != 0)) && + (p->Flags & V_INTERLACE) ) { + p->status = MODE_NO_INTERLACE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (mode not supported as interlaced)\n", p->name); + } + if( ( (strcmp(p->name, "320x200") == 0) || + (strcmp(p->name, "320x240") == 0) || + (strcmp(p->name, "400x300") == 0) || + (strcmp(p->name, "512x384") == 0) ) && + (!(p->Flags & V_DBLSCAN)) ) { + p->status = MODE_CLOCK_RANGE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (only supported as doublescan)\n", p->name); + } + } + } +#ifdef SISDUALHEAD + /* TW: Modes that require the bridge to operate in SlaveMode + * are not suitable for Dual Head mode. Also check for + * modes that exceed panel dimension. + */ + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead == FALSE) { + if( (strcmp(p->name, "320x200") == 0) || + (strcmp(p->name, "320x240") == 0) || + (strcmp(p->name, "400x300") == 0) || + (strcmp(p->name, "512x384") == 0) || + (strcmp(p->name, "640x400") == 0) ) { + p->status = MODE_BAD; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (not suitable for dual head mode)\n", + p->name); + } + } + if(pSiS->VBFlags & DISPTYPE_DISP2) { + if(pSiS->VBFlags & CRT2_LCD) { + if(pSiS->SecondHead == FALSE) { + if((p->HDisplay > pSiS->LCDwidth) || (p->VDisplay > pSiS->LCDheight)) { + p->status = MODE_PANEL; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (exceeds LCD panel dimension)\n", p->name); + } + if(p->Flags & V_INTERLACE) { + p->status = MODE_BAD; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (interlace on LCD not supported)\n", + p->name); + } + } + } + /* TO DO: TV */ + } + /* TW: Search for the highest clock on first head in order to calculate + * max clock for second head (CRT1) + */ + if(!pSiS->SecondHead) { + if((p->status == MODE_OK) && (p->Clock > pSiSEnt->maxUsedClock)) { + pSiSEnt->maxUsedClock = p->Clock; + } + } + } else { +#endif + if(pSiS->VBFlags & DISPTYPE_DISP2) { + if(pSiS->VBFlags & CRT2_LCD) { + if((p->HDisplay > pSiS->LCDwidth) || (p->VDisplay > pSiS->LCDheight)) { + p->status = MODE_PANEL; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (exceeds LCD panel dimension)\n", p->name); + } + if(p->Flags & V_INTERLACE) { + p->status = MODE_BAD; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%s\" (interlace on LCD not supported)\n", + p->name); + } + } + } +#ifdef SISDUALHEAD + } +#endif + p = n; + } while (p != NULL && p != first); + } + /* Prune the modes marked as invalid */ xf86PruneDriverModes(pScrn); - if (i == 0 || pScrn->modes == NULL) { + if(i == 0 || pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); SISFreeRec(pScrn); return FALSE; } @@ -1126,117 +3384,143 @@ /* Set the current mode to the first in the list */ pScrn->currentMode = pScrn->modes; + /* TW: Copy to CurrentLayout */ + pSiS->CurrentLayout.mode = pScrn->currentMode; + pSiS->CurrentLayout.displayWidth = pScrn->displayWidth; + /* Print the list of modes being used */ xf86PrintModes(pScrn); +#ifdef SISDUALHEAD + /* TW: Due to palette & timing problems we don't support 8bpp in DHM */ + if((pSiS->DualHeadMode) && (pScrn->bitsPerPixel == 8)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Colordepth 8 not supported in Dual Head mode.\n"); + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); + SISFreeRec(pScrn); + return FALSE; + } +#endif + /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); /* Load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 1: + switch(pScrn->bitsPerPixel) { + case 1: mod = "xf1bpp"; Sym = "xf1bppScreenInit"; break; - case 4: + case 4: mod = "xf4bpp"; Sym = "xf4bppScreenInit"; break; - case 8: - case 16: - case 24: - case 32: + case 8: + case 16: + case 24: + case 32: mod = "fb"; break; } - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + if(mod && xf86LoadSubModule(pScrn, mod) == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not load %s module", mod); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); SISFreeRec(pScrn); return FALSE; } - if (mod) { - if (Sym) { + if(mod) { + if(Sym) { xf86LoaderReqSymbols(Sym, NULL); } else { xf86LoaderReqSymLists(fbSymbols, NULL); } } - if (!xf86LoadSubModule(pScrn, "i2c")) { - SISFreeRec(pScrn); - return FALSE; - } - - xf86LoaderReqSymLists(i2cSymbols, NULL); - /* Load XAA if needed */ - if (!pSiS->NoAccel) { - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Accel Enable\n"); - if (!xf86LoadSubModule(pScrn, "xaa")) { + if(!pSiS->NoAccel) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Accel enabled\n"); + if(!xf86LoadSubModule(pScrn, "xaa")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not load xaa module\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); SISFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(xaaSymbols, NULL); } /* Load shadowfb if needed */ - if (pSiS->ShadowFB) { - if (!xf86LoadSubModule(pScrn, "shadowfb")) { - SISFreeRec(pScrn); - return FALSE; + if(pSiS->ShadowFB) { + if(!xf86LoadSubModule(pScrn, "shadowfb")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not load shadowfb module\n"); +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; +#endif + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); + SISFreeRec(pScrn); + return FALSE; } xf86LoaderReqSymLists(shadowSymbols, NULL); } - /* Load DDC if needed */ - /* This gives us DDC1 - we should be able to get DDC2B using i2c */ - if (!xf86LoadSubModule(pScrn, "ddc")) { - SISFreeRec(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(ddcSymbols, NULL); -/* TW: Now load and initialize VBE module. The default behavior - * for SiS630 with SiS301B, SiS302 or LVDS/CHRONTEL bridge - * is to use VESA for mode switching. This can be overruled - * with the option "VESA". - */ + /* TW: Now load and initialize VBE module for VESA. */ + pSiS->UseVESA = 0; + if(pSiS->VESA == 1) { + if(!pSiS->pVbe) { + if(xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + pSiS->pVbe = VBEInit(pSiS->pInt,pSiS->pEnt->index); +#else + pSiS->pVbe = VBEExtendedInit(pSiS->pInt,pSiS->pEnt->index, + SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); +#endif + } + } + if(pSiS->pVbe) { + vbe = VBEGetVBEInfo(pSiS->pVbe); + pSiS->vesamajor = (unsigned)(vbe->VESAVersion >> 8); + pSiS->vesaminor = vbe->VESAVersion & 0xff; + pSiS->vbeInfo = vbe; + SiSBuildVesaModeList(pScrn, pSiS->pVbe, vbe); + VBEFreeVBEInfo(vbe); + pSiS->UseVESA = 1; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Could not load and initialize VBE module. VESA disabled.\n"); + } + } - { - Bool ret; - pSiS->UseVESA=0; - if (xf86LoadSubModule(pScrn, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - if ((pSiS->pVbe = VBEInit(NULL,pSiS->pEnt->index))) { - ret = xf86SetDDCproperties(pScrn, - xf86PrintEDID(vbeDoEDID(pSiS->pVbe,NULL))); - if ( (pSiS->VESA == 1) - || ( (pSiS->VESA != 0) - && (pSiS->Chipset == PCI_CHIP_SIS630) - && (pSiS->VBFlags & (VB_301B|VB_302|VB_LVDS|VB_CHRONTEL))) ) { - vbe = VBEGetVBEInfo(pSiS->pVbe); - pSiS->vesamajor = (unsigned)(vbe->VESAVersion >> 8); - pSiS->vesaminor = vbe->VESAVersion & 0xff; - pSiS->vbeInfo = vbe; - SiSBuildVesaModeList(pScrn, pSiS->pVbe, vbe); - VBEFreeVBEInfo(vbe); - pSiS->UseVESA = 1; - /* TW: from now, use VESA functions for mode switching */ - } - } - } - vbeFree(pSiS->pVbe); - pSiS->pVbe = NULL; + if(pSiS->pVbe) { + vbeFree(pSiS->pVbe); + pSiS->pVbe = NULL; } - -#if 0 - if (!ret && pSiS->ddc1Read) - xf86SetDDCProperties(xf86PrintEDID(xf86DoEDID_DDC1( - pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ))); + +#ifdef SISDUALHEAD + xf86SetPrimInitDone(pScrn->entityList[0]); #endif + sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); + + if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); + pSiS->pInt = NULL; + return TRUE; } @@ -1250,9 +3534,15 @@ { SISPtr pSiS; int mmioFlags; - +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = NULL; +#endif pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + pSiSEnt = pSiS->entityPrivate; +#endif + /* * Map IO registers to virtual address space */ @@ -1264,30 +3554,83 @@ * byte/short access. */ mmioFlags = VIDMEM_MMIO | VIDMEM_SPARSE; +#endif + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt->MapCountIOBase++; + if(!(pSiSEnt->IOBase)) { + /* TW: Only map if not mapped previously */ + pSiSEnt->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pSiS->PciTag, pSiS->IOAddress, 0x10000); + } + pSiS->IOBase = pSiSEnt->IOBase; + } else #endif - pSiS->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pSiS->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pSiS->PciTag, pSiS->IOAddress, 0x10000); - if (pSiS->IOBase == NULL) + + if(pSiS->IOBase == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map MMIO area\n"); return FALSE; + } #ifdef __alpha__ /* * for Alpha, we need to map DENSE memory as well, for * setting CPUToScreenColorExpandBase. */ - pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt->MapCountIOBaseDense++; + if(!(pSiSEnt->IOBaseDense)) { + /* TW: Only map if not mapped previously */ + pSiSEnt->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pSiS->PciTag, pSiS->IOAddress, 0x10000); + } + pSiS->IOBaseDense = pSiSEnt->IOBaseDense; + } else +#endif + pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pSiS->PciTag, pSiS->IOAddress, 0x10000); - if (pSiS->IOBaseDense == NULL) + if(pSiS->IOBaseDense == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map MMIO dense area\n"); return FALSE; + } + #endif /* __alpha__ */ - pSiS->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pSiS->PciTag, - (unsigned long)pSiS->FbAddress, +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt->MapCountFbBase++; + if(!(pSiSEnt->FbBase)) { + /* TW: Only map if not mapped previously */ + pSiSEnt->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pSiS->PciTag, (unsigned long)pSiS->realFbAddress, pSiS->FbMapSize); - if (pSiS->FbBase == NULL) - return FALSE; + pSiS->sishw_ext.pjVideoMemoryAddress = (UCHAR *)pSiSEnt->FbBase; + } + pSiS->FbBase = pSiSEnt->FbBase; + /* TW: Adapt FbBase (for DHM; dhmOffset is 0 otherwise) */ + pSiS->FbBase += pSiS->dhmOffset; + } else { +#endif + pSiS->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pSiS->PciTag, (unsigned long)pSiS->FbAddress, + pSiS->FbMapSize); + pSiS->sishw_ext.pjVideoMemoryAddress = (UCHAR *)pSiS->FbBase; +#ifdef SISDUALHEAD + } +#endif + + if(pSiS->FbBase == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map framebuffer area\n"); + return FALSE; + } return TRUE; } @@ -1301,22 +3644,67 @@ SISUnmapMem(ScrnInfoPtr pScrn) { SISPtr pSiS; +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = NULL; +#endif pSiS = SISPTR(pScrn); - /* - * Unmap IO registers to virtual address space - */ - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, 0x10000); - pSiS->IOBase = NULL; +#ifdef SISDUALHEAD + pSiSEnt = pSiS->entityPrivate; +#endif +/* TW: In dual head mode, we must not unmap if the other head still + * assumes memory as mapped +*/ +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + if (pSiSEnt->MapCountIOBase) { + pSiSEnt->MapCountIOBase--; + if ((pSiSEnt->MapCountIOBase == 0) || (pSiSEnt->forceUnmapIOBase)) { + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, 0x10000); + pSiSEnt->IOBase = NULL; + pSiSEnt->MapCountIOBase = 0; + pSiSEnt->forceUnmapIOBase = FALSE; + } + pSiS->IOBase = NULL; + } #ifdef __alpha__ - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, 0x10000); - pSiS->IOBaseDense = NULL; + if (pSiSEnt->MapCountIOBaseDense) { + pSiSEnt->MapCountIOBaseDense--; + if ((pSiSEnt->MapCountIOBaseDense == 0) || (pSiSEnt->forceUnmapIOBaseDense)) { + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, 0x10000); + pSiSEnt->IOBaseDense = NULL; + pSiSEnt->MapCountIOBaseDense = 0; + pSiSEnt->forceUnmapIOBaseDense = FALSE; + } + pSiS->IOBaseDense = NULL; + } #endif /* __alpha__ */ + if (pSiSEnt->MapCountFbBase) { + pSiSEnt->MapCountFbBase--; + if ((pSiSEnt->MapCountFbBase == 0) || (pSiSEnt->forceUnmapFbBase)) { + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->FbBase, pSiS->FbMapSize); + pSiSEnt->FbBase = NULL; + pSiSEnt->MapCountFbBase = 0; + pSiSEnt->forceUnmapFbBase = FALSE; - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->FbBase, pSiS->FbMapSize); - pSiS->FbBase = NULL; + } + pSiS->FbBase = NULL; + } + } else { +#endif + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, 0x10000); + pSiS->IOBase = NULL; +#ifdef __alpha__ + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, 0x10000); + pSiS->IOBaseDense = NULL; +#endif + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->FbBase, pSiS->FbMapSize); + pSiS->FbBase = NULL; +#ifdef SISDUALHEAD + } +#endif return TRUE; } @@ -1331,27 +3719,264 @@ SISRegPtr sisReg; pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + /* TW: We always save master & slave */ + if(pSiS->DualHeadMode && pSiS->SecondHead) return; +#endif + vgaReg = &VGAHWPTR(pScrn)->SavedReg; sisReg = &pSiS->SavedReg; vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); + sisSaveUnlockExtRegisterLock(pSiS,&sisReg->sisRegs3C4[0x05],&sisReg->sisRegs3D4[0x80]); + (*pSiS->SiSSave)(pScrn, sisReg); + if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_SAVE); + + /* TW: Save these as they may have been changed prior to SISSave() call */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + sisReg->sisRegs3D4[0x17] = pSiS->oldCR17; + if(vgaReg->numCRTC >= 0x17) vgaReg->CRTC[0x17] = pSiS->oldCR17; + sisReg->sisRegs3D4[0x32] = pSiS->oldCR32; + } +} + +/* + * TW: Just adapted from the std* functions in vgaHW.c + */ +static void +SiS_WriteAttr(SISPtr pSiS, int index, int value) +{ + CARD8 tmp; + + tmp = inb(pSiS->IODBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + + index |= 0x20; + outb(pSiS->IODBase + VGA_ATTR_INDEX, index); + outb(pSiS->IODBase + VGA_ATTR_DATA_W, value); +} + +static int +SiS_ReadAttr(SISPtr pSiS, int index) +{ + CARD8 tmp; + + tmp = inb(pSiS->IODBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + + index |= 0x20; + outb(pSiS->IODBase + VGA_ATTR_INDEX, index); + return (inb(pSiS->IODBase + VGA_ATTR_DATA_R)); +} + + +static void +SiS_SaveFonts(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4, scrn; +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + CARD8 *vgaIOBase = (CARD8 *)VGAHWPTR(pScrn)->IOBase; +#else + pointer vgaIOBase = VGAHWPTR(pScrn)->Base; +#endif + + if (pSiS->fonts != NULL) + return; + + /* If in graphics mode, don't save anything */ + attr10 = SiS_ReadAttr(pSiS, 0x10); + if (attr10 & 0x01) + return; + + pSiS->fonts = xalloc(16384); + + /* save the registers that are needed here */ + miscOut = inSISREG(SISMISCR); + inSISIDXREG(SISGR, 0x04, gr4); + inSISIDXREG(SISGR, 0x05, gr5); + inSISIDXREG(SISGR, 0x06, gr6); + inSISIDXREG(SISSR, 0x02, seq2); + inSISIDXREG(SISSR, 0x04, seq4); + + /* Force into color mode */ + outSISREG(SISMISCW, miscOut | 0x01); + + inSISIDXREG(SISSR, 0x01, scrn); + outSISIDXREG(SISSR, 0x00, 0x01); + outSISIDXREG(SISSR, 0x01, scrn | 0x20); + outSISIDXREG(SISSR, 0x00, 0x03); + + SiS_WriteAttr(pSiS, 0x10, 0x01); /* graphics mode */ + + /*font1 */ + outSISIDXREG(SISSR, 0x02, 0x04); /* write to plane 2 */ + outSISIDXREG(SISSR, 0x04, 0x06); /* enable plane graphics */ + outSISIDXREG(SISGR, 0x04, 0x02); /* read plane 2 */ + outSISIDXREG(SISGR, 0x05, 0x00); /* write mode 0, read mode 0 */ + outSISIDXREG(SISGR, 0x06, 0x05); /* set graphics */ + slowbcopy_frombus(vgaIOBase, pSiS->fonts, 8192); + + /* font2 */ + outSISIDXREG(SISSR, 0x02, 0x08); /* write to plane 3 */ + outSISIDXREG(SISSR, 0x04, 0x06); /* enable plane graphics */ + outSISIDXREG(SISGR, 0x04, 0x03); /* read plane 3 */ + outSISIDXREG(SISGR, 0x05, 0x00); /* write mode 0, read mode 0 */ + outSISIDXREG(SISGR, 0x06, 0x05); /* set graphics */ + slowbcopy_frombus(vgaIOBase, pSiS->fonts + 8192, 8192); + + inSISIDXREG(SISSR, 0x01, scrn); + outSISIDXREG(SISSR, 0x00, 0x01); + outSISIDXREG(SISSR, 0x01, scrn & ~0x20); + outSISIDXREG(SISSR, 0x00, 0x03); + + /* Restore clobbered registers */ + SiS_WriteAttr(pSiS, 0x10, attr10); + outSISIDXREG(SISSR, 0x02, seq2); + outSISIDXREG(SISSR, 0x04, seq4); + outSISIDXREG(SISGR, 0x04, gr4); + outSISIDXREG(SISGR, 0x05, gr5); + outSISIDXREG(SISGR, 0x06, gr6); + outSISREG(SISMISCW, miscOut); +} + +static void +SiS_RestoreFonts(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4, scrn; +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + CARD8 *vgaIOBase = (CARD8 *)VGAHWPTR(pScrn)->IOBase; +#else + pointer vgaIOBase = VGAHWPTR(pScrn)->Base; +#endif + + if (pSiS->fonts == NULL) + return; + +#if 0 + if (pVesa->mapPhys == 0xa0000 && pVesa->curBank != 0) + VESABankSwitch(pScrn->pScreen, 0); +#endif + + /* save the registers that are needed here */ + miscOut = inSISREG(SISMISCR); + attr10 = SiS_ReadAttr(pSiS, 0x10); + inSISIDXREG(SISGR, 0x01, gr1); + inSISIDXREG(SISGR, 0x03, gr3); + inSISIDXREG(SISGR, 0x04, gr4); + inSISIDXREG(SISGR, 0x05, gr5); + inSISIDXREG(SISGR, 0x06, gr6); + inSISIDXREG(SISGR, 0x08, gr8); + inSISIDXREG(SISSR, 0x02, seq2); + inSISIDXREG(SISSR, 0x04, seq4); + + /* Force into color mode */ + outSISREG(SISMISCW, miscOut | 0x01); + inSISIDXREG(SISSR, 0x01, scrn); + outSISIDXREG(SISSR, 0x00, 0x01); + outSISIDXREG(SISSR, 0x01, scrn | 0x20); + outSISIDXREG(SISSR, 0x00, 0x03); + + SiS_WriteAttr(pSiS, 0x10, 0x01); /* graphics mode */ + if (pScrn->depth == 4) { + outSISIDXREG(SISGR, 0x03, 0x00); /* don't rotate, write unmodified */ + outSISIDXREG(SISGR, 0x08, 0xFF); /* write all bits in a byte */ + outSISIDXREG(SISGR, 0x01, 0x00); /* all planes come from CPU */ + } + + outSISIDXREG(SISSR, 0x02, 0x04); /* write to plane 2 */ + outSISIDXREG(SISSR, 0x04, 0x06); /* enable plane graphics */ + outSISIDXREG(SISGR, 0x04, 0x02); /* read plane 2 */ + outSISIDXREG(SISGR, 0x05, 0x00); /* write mode 0, read mode 0 */ + outSISIDXREG(SISGR, 0x06, 0x05); /* set graphics */ + slowbcopy_tobus(pSiS->fonts, vgaIOBase, 8192); + + outSISIDXREG(SISSR, 0x02, 0x08); /* write to plane 3 */ + outSISIDXREG(SISSR, 0x04, 0x06); /* enable plane graphics */ + outSISIDXREG(SISGR, 0x04, 0x03); /* read plane 3 */ + outSISIDXREG(SISGR, 0x05, 0x00); /* write mode 0, read mode 0 */ + outSISIDXREG(SISGR, 0x06, 0x05); /* set graphics */ + slowbcopy_tobus(pSiS->fonts + 8192, vgaIOBase, 8192); + + inSISIDXREG(SISSR, 0x01, scrn); + outSISIDXREG(SISSR, 0x00, 0x01); + outSISIDXREG(SISSR, 0x01, scrn & ~0x20); + outSISIDXREG(SISSR, 0x00, 0x03); + + /* restore the registers that were changed */ + outSISREG(SISMISCW, miscOut); + SiS_WriteAttr(pSiS, 0x10, attr10); + outSISIDXREG(SISGR, 0x01, gr1); + outSISIDXREG(SISGR, 0x03, gr3); + outSISIDXREG(SISGR, 0x04, gr4); + outSISIDXREG(SISGR, 0x05, gr5); + outSISIDXREG(SISGR, 0x06, gr6); + outSISIDXREG(SISGR, 0x08, gr8); + outSISIDXREG(SISSR, 0x02, seq2); + outSISIDXREG(SISSR, 0x04, seq4); } +/* TW: VESASaveRestore taken from vesa driver */ static void SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) { SISPtr pSiS; pSiS = SISPTR(pScrn); + + /* Query amount of memory to save state */ + if (function == MODE_QUERY || + (function == MODE_SAVE && pSiS->state == NULL)) { + + /* Make sure we save at least this information in case of failure */ + (void)VBEGetVBEMode(pSiS->pVbe, &pSiS->stateMode); + SiS_SaveFonts(pScrn); + + if (pSiS->vesamajor > 1) { + if (!VBESaveRestore(pSiS->pVbe,function,(pointer)&pSiS->state, + &pSiS->stateSize,&pSiS->statePage)) + return; + + } + } + + /* Save/Restore Super VGA state */ + if (function != MODE_QUERY) { + Bool retval = TRUE; + + if (pSiS->vesamajor > 1) { + if (function == MODE_RESTORE) + memcpy(pSiS->state, pSiS->pstate, pSiS->stateSize); + + if ((retval = VBESaveRestore(pSiS->pVbe,function, + (pointer)&pSiS->state, + &pSiS->stateSize,&pSiS->statePage)) + && function == MODE_SAVE) { + /* don't rely on the memory not being touched */ + if (pSiS->pstate == NULL) + pSiS->pstate = xalloc(pSiS->stateSize); + memcpy(pSiS->pstate, pSiS->state, pSiS->stateSize); + } + } + + if (function == MODE_RESTORE) { + VBESetVBEMode(pSiS->pVbe, pSiS->stateMode, NULL); + SiS_RestoreFonts(pScrn); + } +#if 0 + if (!retval) + return (FALSE); +#endif - if (pSiS->vesamajor > 1 - && (function == MODE_SAVE || pSiS->pstate)) { + } +#if 0 + if ( (pSiS->vesamajor > 1) && + (function == MODE_SAVE || pSiS->pstate) ) { if (function == MODE_RESTORE) memcpy(pSiS->state, pSiS->pstate, pSiS->stateSize); - ErrorF("VBESaveRestore\n"); if ((VBESaveRestore(pSiS->pVbe,function, (pointer)&pSiS->state, &pSiS->stateSize,&pSiS->statePage))) { @@ -1361,23 +3986,26 @@ pSiS->pstate = xalloc(pSiS->stateSize); memcpy(pSiS->pstate, pSiS->state, pSiS->stateSize); } - ErrorF("VBESaveRestore done with success\n"); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "VBESaveRestore done with success\n"); return; } - ErrorF("VBESaveRestore done\n"); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "VBESaveRestore done\n"); } else { if (function == MODE_SAVE) (void)VBEGetVBEMode(pSiS->pVbe, &pSiS->stateMode); else VBESetVBEMode(pSiS->pVbe, pSiS->stateMode, NULL); } +#endif } /* - * Initialise a new mode. This is currently still using the old - * "initialise struct, restore/write struct to HW" model. That could - * be changed. - * TW: Why? + * Initialise a new mode. This is currently done using the + * "initialise struct, restore/write struct to HW" model for + * the old chipsets (5597/530/6326). For newer chipsets, + * we use either VESA or our own mode switching code. */ static Bool @@ -1389,17 +4017,25 @@ SISRegPtr sisReg; vgaHWUnlock(hwp); - + SISModifyModeInfo(mode); - /* TW: Initialize SiS Port Reg definitions for externally used - * sis_bios functions. + /* TW: Initialize SiS Port Register definitions for externally used + * BIOS emulation (native code switching) functions. */ - SiSRegInit(pSiS->RelIO+0x30); + if( pSiS->VGAEngine == SIS_300_VGA || + pSiS->VGAEngine == SIS_315_VGA ) { + SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30); + } if (pSiS->UseVESA) { /* With VESA: */ + +#ifdef SISDUALHEAD + /* TW: No dual head mode when using VESA */ + if (pSiS->SecondHead) return TRUE; +#endif /* - * This order is required: + * TW: This order is required: * The video bridge needs to be adjusted before the * BIOS is run as the BIOS sets up CRT2 according to * these register settings. @@ -1407,16 +4043,33 @@ * registers need to be readjusted as the BIOS may * very probably have messed them up. */ - SiSPreSetMode(pScrn, 1); - /* TW: mode was pScrn->currentMode - VidModeExt did not work! */ - if (!SiSSetVESAMode(pScrn, mode)) + if( pSiS->VGAEngine == SIS_300_VGA || + pSiS->VGAEngine == SIS_315_VGA ) { + SiSPreSetMode(pScrn, mode); + } + if(!SiSSetVESAMode(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSSetVESAMode() failed\n"); return FALSE; - SiSPreSetMode(pScrn, 1); - SiSPostSetMode(pScrn, &pSiS->ModeReg, 1); - - /* Prepare the register contents */ - if (!(*pSiS->ModeInit)(pScrn, mode)) + } + sisSaveUnlockExtRegisterLock(pSiS,NULL,NULL); + if( pSiS->VGAEngine == SIS_300_VGA || + pSiS->VGAEngine == SIS_315_VGA ) { + SiSPreSetMode(pScrn, mode); + SiSPostSetMode(pScrn, &pSiS->ModeReg); + } + /* TW: Prepare some register contents and set + * up some mode dependent variables. + */ +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "REAL REGISTER CONTENTS AFTER SETMODE:\n"); +#endif + if (!(*pSiS->ModeInit)(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ModeInit() failed\n"); return FALSE; + } pScrn->vtSema = TRUE; @@ -1425,51 +4078,134 @@ (*pSiS->SiSRestore)(pScrn, &pSiS->ModeReg); vgaHWProtect(pScrn, FALSE); PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "HDisplay: %d, VDisplay: %d \n", - mode->HDisplay, mode->VDisplay)); - - } else { /* Without VESA: */ - /* Initialise the ModeReg values */ - if (!vgaHWInit(pScrn, mode)) - return FALSE; + "HDisplay: %d, VDisplay: %d \n", + mode->HDisplay, mode->VDisplay)); - if (!(*pSiS->ModeInit)(pScrn, mode)) - return FALSE; + } else { /* Without VESA: */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!(*pSiS->ModeInit)(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ModeInit() failed\n"); + return FALSE; + } + + pScrn->vtSema = TRUE; + + if(!(pSiS->SecondHead)) { + /* TW: Head 1 (master) is always CRT2 */ + SiSPreSetMode(pScrn, mode); + if (!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSBIOSSetModeCRT2() failed\n"); + return FALSE; + } + SiSPostSetMode(pScrn, &pSiS->ModeReg); + } else { + /* TW: Head 2 (slave) is always CRT1 */ + SiSPreSetMode(pScrn, mode); + if (!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, mode, pSiS->IsCustom)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSBIOSSetModeCRT1() failed\n"); + return FALSE; + } + SiSPostSetMode(pScrn, &pSiS->ModeReg); + } + } else { +#endif + if(pSiS->VGAEngine == SIS_300_VGA || + pSiS->VGAEngine == SIS_315_VGA) { - pScrn->vtSema = TRUE; + /* TW: Prepare the register contents; On 300/310/325, + * we actually "abuse" this only for setting + * up some variables; the registers are NOT + * being written to the hardware as the BIOS + * emulation (native mode switching code) + * takes care of this. + */ + if(!(*pSiS->ModeInit)(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ModeInit() failed\n"); + return FALSE; + } + + pScrn->vtSema = TRUE; + + /* 300/310/325 series: Use our own code for mode switching */ + SiSPreSetMode(pScrn, mode); + + if(!SiSBIOSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, mode, pSiS->IsCustom)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSBIOSSetMode() failed\n"); + return FALSE; + } + + SiSPostSetMode(pScrn, &pSiS->ModeReg); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "REAL REGISTER CONTENTS AFTER SETMODE:\n"); + (*pSiS->ModeInit)(pScrn, mode); +#endif + } else { - PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "HDisplay: %d, VDisplay: %d \n", - mode->HDisplay, mode->VDisplay)); + /* For other chipsets, use the old method */ - /* Program the registers */ - vgaHWProtect(pScrn, TRUE); - vgaReg = &hwp->ModeReg; - sisReg = &pSiS->ModeReg; + /* Initialise the ModeReg values */ + if(!vgaHWInit(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "vgaHWInit() failed\n"); + return FALSE; + } + + /* Reset our PIOOffset as vgaHWInit might have reset it */ + VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380; + + /* Prepare the register contents */ + if(!(*pSiS->ModeInit)(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ModeInit() failed\n"); + return FALSE; + } + + pScrn->vtSema = TRUE; + + /* Program the registers */ + vgaHWProtect(pScrn, TRUE); + vgaReg = &hwp->ModeReg; + sisReg = &pSiS->ModeReg; + + vgaReg->Attribute[0x10] = 0x01; + if(pScrn->bitsPerPixel > 8) { + vgaReg->Graphics[0x05] = 0x00; + } + + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + + (*pSiS->SiSRestore)(pScrn, sisReg); + + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + SiS6326PostSetMode(pScrn, &pSiS->ModeReg); + } + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "REAL REGISTER CONTENTS AFTER SETMODE:\n"); + (*pSiS->ModeInit)(pScrn, mode); +#endif - vgaReg->Attribute[0x10] = 0x01; - if (pScrn->bitsPerPixel > 8) - vgaReg->Graphics[0x05] = 0x00; - - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - - if ( (pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540) ) { - SiSPreSetMode(pScrn, 0); - if (!SiSBIOSSetMode(pScrn, mode)) - return FALSE; - } - else (*pSiS->SiSRestore)(pScrn, sisReg); - - vgaHWProtect(pScrn, FALSE); + vgaHWProtect(pScrn, FALSE); + } +#ifdef SISDUALHEAD + } +#endif } -/* Reserved for debug - * - SiSDumpModeInfo(pScrn, mode); - * - */ + /* TW: Update Currentlayout */ + pSiS->CurrentLayout.mode = mode; + + /* Debug */ +/* SiSDumpModeInfo(pScrn, mode); */ + return TRUE; } @@ -1481,51 +4217,212 @@ pSiS = SISPTR(pScrn); - if (!(mode = CalcVESAModeIndex(pScrn, pMode))) return FALSE; - ErrorF("mode: %x\n",mode); + if (!(mode = SiSCalcVESAModeIndex(pScrn, pMode))) return FALSE; - mode |= 1 << 15; /* TW: Don't clear framebuffer */ - mode |= 1 << 14; /* TW: always use linear adressing */ + mode |= 1 << 15; /* TW: Don't clear framebuffer */ + mode |= 1 << 14; /* TW: Use linear adressing */ - if (VBESetVBEMode(pSiS->pVbe, mode, NULL) == FALSE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Setting mode 0x%x failed\n", - mode & 0x0fff); + if(VBESetVBEMode(pSiS->pVbe, mode, NULL) == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Setting VESA mode 0x%x failed\n", + mode & 0x0fff); return (FALSE); } - if (pMode->HDisplay != pScrn->virtualX) + if(pMode->HDisplay != pScrn->virtualX) VBESetLogicalScanline(pSiS->pVbe, pScrn->virtualX); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x succeeded\n", - mode & 0x0fff); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Setting VESA mode 0x%x succeeded\n", + mode & 0x0fff); return (TRUE); } - /* - * Restore the initial (text) mode. + * Restore the initial mode. To be used internally only! */ static void SISRestore(ScrnInfoPtr pScrn) { - vgaHWPtr hwp; - vgaRegPtr vgaReg; - SISPtr pSiS; - SISRegPtr sisReg; + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr sisReg = &pSiS->SavedReg; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + Bool doit = FALSE, doitlater = FALSE; + + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + +#ifdef SISDUALHEAD + /* TW: We always restore master AND slave */ + if(pSiS->DualHeadMode && pSiS->SecondHead) return; +#endif - hwp = VGAHWPTR(pScrn); - pSiS = SISPTR(pScrn); - vgaReg = &hwp->SavedReg; - sisReg = &pSiS->SavedReg; + /* TW: We must not disable the sequencer if the bridge is in SlaveMode! */ + if(!(SiSBridgeIsInSlaveMode(pScrn))) { + vgaHWProtect(pScrn, TRUE); + } + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL,NULL); +#endif + + /* TW: First, restore CRT1 on/off and VB connection registers */ + outSISIDXREG(SISCR, 0x32, pSiS->oldCR32); + if(!(pSiS->oldCR17 & 0x80)) { /* TW: CRT1 was off */ + if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* TW: Bridge is NOT in SlaveMode now -> do it */ + doit = TRUE; + } else { + doitlater = TRUE; + } + } else { /* TW: CRT1 was on -> do it now */ + doit = TRUE; + } + + if(doit) { + outSISIDXREG(SISCR, 0x17, pSiS->oldCR17); + } + + /* TW: For 30xB/LV, restoring the registers does not + * work. We "manually" set the old mode, instead. + * The same applies for SiS730 machines with LVDS. + * Finally, this behavior can be forced by setting + * the option RestoreBySetMode. + */ + if( ( (pSiS->restorebyset) || + (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) || + ((pSiS->sishw_ext.jChipType == SIS_730) && (pSiS->VBFlags & VB_LVDS)) ) && + (pSiS->OldMode) ) { + + if(pSiS->AccelInfoPtr) { + (*pSiS->AccelInfoPtr->Sync)(pScrn); + } + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Restoring by setting old mode 0x%02x\n", pSiS->OldMode); + + if( (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) && + (!pSiS->restorebyset) ) { + if(pSiS->OldMode == 0x03) pSiS->OldMode = 0x13; + } + + pSiS->SiS_Pr->UseCustomMode = FALSE; + pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE; + SiSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, pSiS->OldMode, FALSE); +#ifdef TWDEBUG + { + SISRegPtr pReg = &pSiS->ModeReg; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "REAL REGISTER CONTENTS AFTER RESTORE BY SETMODE:\n"); + (*pSiS->SiSSave)(pScrn, pReg); + } +#endif + + } else { + + if(pSiS->VBFlags & VB_VIDEOBRIDGE) { + /* TW: If a video bridge is present, we need to restore + * non-extended (=standard VGA) SR and CR registers + * before restoring the extended ones and the bridge + * registers itself. Unfortunately, the vgaHWRestore + * routine clears CR17[7] - which must not be done if + * the bridge is in slave mode. + */ + if(!(SiSBridgeIsInSlaveMode(pScrn))) { + vgaHWProtect(pScrn, TRUE); + + if(pSiS->Primary) { + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + } + } + } + + (*pSiS->SiSRestore)(pScrn, sisReg); + + } - vgaHWProtect(pScrn, TRUE); + if(doitlater) { + outSISIDXREG(SISCR, 0x17, pSiS->oldCR17); + } + + sisRestoreExtRegisterLock(pSiS,sisReg->sisRegs3C4[0x05],sisReg->sisRegs3D4[0x80]); + + if( ( (pSiS->sishw_ext.jChipType == SIS_730) && (pSiS->VBFlags & VB_LVDS)) || + (pSiS->restorebyset) ) { + + /* TW: SiS730/LVDS has extreme problems restoring the text display due + * to over-sensible LCD panels + */ + + vgaHWProtect(pScrn, TRUE); + + if(pSiS->Primary) { + vgaHWRestore(pScrn, vgaReg, (VGA_SR_FONTS | VGA_SR_CMAP)); + } + + vgaHWProtect(pScrn, FALSE); + + } else { + + vgaHWProtect(pScrn, TRUE); + + if(pSiS->Primary) { + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + } + + vgaHWProtect(pScrn, FALSE); + + } + + } else { /* All other chipsets */ + + vgaHWProtect(pScrn, TRUE); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL,NULL); +#endif + (*pSiS->SiSRestore)(pScrn, sisReg); - (*pSiS->SiSRestore)(pScrn, sisReg); + vgaHWProtect(pScrn, TRUE); + if(pSiS->Primary) { + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + } + + /* TW: Restore TV. This is rather complicated, but if we don't do it, + * TV output will flicker terribly + */ + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + if(sisReg->sis6326tv[0] & 0x04) { + unsigned char tmp; + int val; + + orSISIDXREG(SISSR, 0x01, 0x20); + tmp = SiS6326GetTVReg(pScrn,0x00); + tmp &= ~0x04; + while(!(inSISREG(SISINPSTAT) & 0x08)); /* Wait while NOT vb */ + SiS6326SetTVReg(pScrn,0x00,tmp); + for(val=0; val < 2; val++) { + while(!(inSISREG(SISINPSTAT) & 0x08)); /* Wait while NOT vb */ + while(inSISREG(SISINPSTAT) & 0x08); /* wait while vb */ + } + SiS6326SetTVReg(pScrn, 0x00, sisReg->sis6326tv[0]); + tmp = inSISREG(SISINPSTAT); + outSISREG(SISAR, 0x20); + tmp = inSISREG(SISINPSTAT); + while(inSISREG(SISINPSTAT) & 0x01); + while(!(inSISREG(SISINPSTAT) & 0x01)); + andSISIDXREG(SISSR, 0x01, ~0x20); + for(val=0; val < 10; val++) { + while(!(inSISREG(SISINPSTAT) & 0x08)); /* Wait while NOT vb */ + while(inSISREG(SISINPSTAT) & 0x08); /* wait while vb */ + } + andSISIDXREG(SISSR, 0x01, ~0x20); + } + } - vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + sisRestoreExtRegisterLock(pSiS,sisReg->sisRegs3C4[5],sisReg->sisRegs3D4[0x80]); - vgaHWProtect(pScrn, FALSE); + vgaHWProtect(pScrn, FALSE); + } } static void @@ -1536,26 +4433,49 @@ if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_RESTORE); } -/* TW: Restore bridge output registers - to be called BEFORE VESARestore */ +/* TW: Restore bridge registers - to be called BEFORE VESARestore */ static void SISBridgeRestore(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + /* We only restore for master head */ + if(pSiS->DualHeadMode && pSiS->SecondHead) return; +#endif + + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { + SiSRestoreBridge(pScrn, &pSiS->SavedReg); + } +} + +/* TW: Our generic BlockHandler for Xv */ +static void +SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + SISPtr pSiS = SISPTR(pScrn); - if ( (pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540) ) { + pScreen->BlockHandler = pSiS->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = SISBlockHandler; - SiSRestoreBridge(pScrn, &pSiS->SavedReg); + if(pSiS->VideoTimerCallback) { + (*pSiS->VideoTimerCallback)(pScrn, currentTime.milliseconds); } } /* Mandatory - * This gets called at the start of each server generation */ + * This gets called at the start of each server generation + * + * TW: We use pScrn and not CurrentLayout here, because the + * properties we use have not changed (displayWidth, + * depth, bitsPerPixel) + */ static Bool SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { - /* The vgaHW references will disappear one day */ ScrnInfoPtr pScrn; vgaHWPtr hwp; SISPtr pSiS; @@ -1565,45 +4485,99 @@ unsigned long OnScreenSize; int height, width, displayWidth; unsigned char *FBStart; +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = NULL; +#endif - /* - * First get the ScrnInfoRec - */ pScrn = xf86Screens[pScreen->myNum]; hwp = VGAHWPTR(pScrn); - hwp->MapSize = 0x10000; /* Standard 64k VGA window */ - pSiS = SISPTR(pScrn); + + if(pSiS->UseVESA) { +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + pSiS->pVbe = VBEInit(NULL, pSiS->pEnt->index); +#else + pSiS->pVbe = VBEExtendedInit(NULL, pSiS->pEnt->index, + SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); +#endif + } - if (pSiS->UseVESA) - pSiS->pVbe = VBEInit(NULL,pSiS->pEnt->index); +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt = pSiS->entityPrivate; + pSiSEnt->refCount++; + } +#endif /* Map the VGA memory and get the VGA IO base */ - if (!vgaHWMapMem(pScrn)) - return FALSE; + if(pSiS->Primary) { + hwp->MapSize = 0x10000; /* Standard 64k VGA window */ + if(!vgaHWMapMem(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map VGA window\n"); + return FALSE; + } + } vgaHWGetIOBase(hwp); + /* TW: Patch the PIOOffset inside vgaHW to use + * our relocated IO ports. + */ + VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380; + /* Map the SIS memory and MMIO areas */ - if (!SISMapMem(pScrn)) + if(!SISMapMem(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSMapMem() failed\n"); return FALSE; + } + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + /* TW: Enable TurboQueue so that SISSave() saves it in enabled + * state. If we don't do this, X will hang after a restart! + * (Happens for some unknown reason only when using VESA + * for mode switching; assumingly a BIOS issue.) + * This is done on 300 and 310/325 series only. + */ + if(pSiS->UseVESA) { + SiSEnableTurboQueue(pScrn); + } + /* Save the current state */ SISSave(pScrn); + /* TW: Save the current mode number */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + inSISIDXREG(SISCR, 0x34, pSiS->OldMode); + } + /* Initialise the first mode */ - if (!SISModeInit(pScrn, pScrn->currentMode)) + if(!SISModeInit(pScrn, pScrn->currentMode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSModeInit() failed\n"); return FALSE; - - /* Clear frame buffer */ - OnScreenSize = pScrn->displayWidth * pScrn->currentMode->VDisplay * (pScrn->bitsPerPixel / 8); - memset(pSiS->FbBase, 0, OnScreenSize); + } - /* Darken the screen for aesthetic reasons and set the viewport */ + /* Darken the screen for aesthetic reasons */ + /* TW: Not using Dual Head variant on purpose; we darken + * the screen for both displays, and un-darken + * it when the second head is finished + */ SISSaveScreen(pScreen, SCREEN_SAVER_ON); + + /* Set the viewport */ SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + /* Clear frame buffer */ + OnScreenSize = pScrn->displayWidth * pScrn->currentMode->VDisplay + * (pScrn->bitsPerPixel / 8); + bzero(pSiS->FbBase, OnScreenSize); + /* * The next step is to setup the screen's visuals, and initialise the * framebuffer code. In cases where the framebuffer's default @@ -1621,36 +4595,41 @@ */ miClearVisualTypes(); - /* Setup the visuals we support. */ /* * For bpp > 8, the default visuals are not acceptable because we only * support TrueColor and not DirectColor. */ - - if (pScrn->bitsPerPixel > 8) { - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, - pScrn->defaultVisual)) - return FALSE; - + if(pScrn->bitsPerPixel > 8) { + if(!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, + pScrn->defaultVisual)) { + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "miSetVisualTypes() failed (bpp %d)\n", pScrn->bitsPerPixel); + return FALSE; + } } else { - if (!miSetVisualTypes(pScrn->depth, + if(!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) + pScrn->rgbBits, pScrn->defaultVisual)) { + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "miSetVisualTypes() failed (bpp %d)\n", pScrn->bitsPerPixel); return FALSE; + } } width = pScrn->virtualX; height = pScrn->virtualY; displayWidth = pScrn->displayWidth; - if (pSiS->Rotate) { + if(pSiS->Rotate) { height = pScrn->virtualX; width = pScrn->virtualY; } - if (pSiS->ShadowFB) { + if(pSiS->ShadowFB) { pSiS->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); pSiS->ShadowPtr = xalloc(pSiS->ShadowPitch * height); displayWidth = pSiS->ShadowPitch / (pScrn->bitsPerPixel >> 3); @@ -1660,18 +4639,39 @@ FBStart = pSiS->FbBase; } - if (!miSetPixmapDepths()) + if(!miSetPixmapDepths()) { + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "miSetPixmapDepths() failed\n"); return FALSE; - - { - static int GlobalHWQueueLength = 0; - - pSiS->cmdQueueLenPtr = &(GlobalHWQueueLength); } +#ifdef SISDUALHEAD + if(pSiS->SecondHead) + pSiS->cmdQueueLenPtr = &(SISPTR(pSiSEnt->pScrn_1)->cmdQueueLen); + else +#endif + pSiS->cmdQueueLenPtr = &(pSiS->cmdQueueLen); + + pSiS->cmdQueueLen = 0; /* TW: Force an EngineIdle() at start */ + #ifdef XF86DRI - pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen); - /* Force the initialization of the context */ +#ifdef SISDUALHEAD + /* TW: No DRI in dual head mode */ + if(pSiS->DualHeadMode) { + pSiS->directRenderingEnabled = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "DRI not supported in Dual Head mode\n"); + } else +#endif + /* Force the initialization of the context */ + if(pSiS->VGAEngine != SIS_315_VGA) { + pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_NOT_IMPLEMENTED, + "DRI not supported on this chipset\n"); + pSiS->directRenderingEnabled = FALSE; + } #endif /* @@ -1679,41 +4679,42 @@ * pScreen fields. */ - switch (pScrn->bitsPerPixel) { - case 1: + switch(pScrn->bitsPerPixel) { + case 1: ret = xf1bppScreenInit(pScreen, FBStart, width, - height, pScrn->xDpi, pScrn->yDpi, + height, pScrn->xDpi, pScrn->yDpi, displayWidth); break; - case 4: + case 4: ret = xf4bppScreenInit(pScreen, FBStart, width, - height, pScrn->xDpi, pScrn->yDpi, + height, pScrn->xDpi, pScrn->yDpi, displayWidth); break; - case 8: - case 16: - case 24: - case 32: + case 8: + case 16: + case 24: + case 32: ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); init_picture = 1; break; - default: + default: xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in SISScrnInit\n", pScrn->bitsPerPixel); ret = FALSE; break; } - if (!ret) - { - ErrorF ("SetMode Error@!\n"); + if (!ret) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf1bpp/xf4bpp/fbScreenInit() failed\n"); + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); return FALSE; } - if (pScrn->bitsPerPixel > 8) { + if(pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -1726,80 +4727,142 @@ visual->blueMask = pScrn->mask.blue; } } - } else if (pScrn->depth == 1) { + } else if(pScrn->depth == 1) { SIS1bppColorMap(pScrn); } - /* must be after RGB ordering fixed */ - if (init_picture) - fbPictureInit(pScreen, 0, 0); - if (!pSiS->ShadowFB) /* hardware cursor needs to wrap this layer */ - SISDGAInit(pScreen); + /* Initialize RENDER ext; must be after RGB ordering fixed */ + if(init_picture) fbPictureInit(pScreen, 0, 0); + + /* hardware cursor needs to wrap this layer <-- TW: what does that mean? */ + if(!pSiS->ShadowFB) SISDGAInit(pScreen); + xf86SetBlackWhitePixels(pScreen); - if (!pSiS->NoAccel) { - if ( pSiS->Chipset == PCI_CHIP_SIS300 || - pSiS->Chipset == PCI_CHIP_SIS630 || - pSiS->Chipset == PCI_CHIP_SIS540) + if(!pSiS->NoAccel) { + switch(pSiS->VGAEngine) { + case SIS_530_VGA: + case SIS_300_VGA: SiS300AccelInit(pScreen); - else if (pSiS->Chipset == PCI_CHIP_SIS530) - SiS530AccelInit(pScreen); - else + break; + case SIS_315_VGA: + SiS310AccelInit(pScreen); + break; + default: SiSAccelInit(pScreen); + } } miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); /* Initialise cursor functions */ - miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if (pSiS->HWCursor) + if(pSiS->HWCursor) SiSHWCursorInit(pScreen); /* Initialise default colourmap */ - if (!miCreateDefColormap(pScreen)) + if(!miCreateDefColormap(pScreen)) { + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "miCreateDefColormap() failed\n"); return FALSE; - -/* marked by archer for adding VB palette - if (!vgaHWHandleColormaps(pScreen)) - return FALSE; -*/ - - if (!xf86HandleColormaps(pScreen, 256, 8, SISLoadPalette, NULL, - CMAP_RELOAD_ON_MODE_SWITCH)) + } + + if(!xf86HandleColormaps(pScreen, 256, (pScrn->depth == 8) ? 8 : pScrn->rgbBits, + SISLoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) { + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86HandleColormaps() failed\n"); return FALSE; + } if(pSiS->ShadowFB) { - RefreshAreaFuncPtr refreshArea = SISRefreshArea; - - if(pSiS->Rotate) { - if (!pSiS->PointerMoved) { - pSiS->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = SISPointerMoved; - } + RefreshAreaFuncPtr refreshArea = SISRefreshArea; - switch(pScrn->bitsPerPixel) { - case 8: refreshArea = SISRefreshArea8; break; - case 16: refreshArea = SISRefreshArea16; break; - case 24: refreshArea = SISRefreshArea24; break; - case 32: refreshArea = SISRefreshArea32; break; + if(pSiS->Rotate) { + if(!pSiS->PointerMoved) { + pSiS->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = SISPointerMoved; + } + + switch(pScrn->bitsPerPixel) { + case 8: refreshArea = SISRefreshArea8; break; + case 16: refreshArea = SISRefreshArea16; break; + case 24: refreshArea = SISRefreshArea24; break; + case 32: refreshArea = SISRefreshArea32; break; + } } - } - ShadowFBInit(pScreen, refreshArea); + ShadowFBInit(pScreen, refreshArea); } - - xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) + /* TW: DPMS for dual head mode */ + xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSetDH, 0); + else +#endif + xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); + + /* Init memPhysBase and fbOffset in pScrn */ + pScrn->memPhysBase = pSiS->FbAddress; + pScrn->fbOffset = 0; #ifdef XvExtension - if (!pSiS->NoXvideo) { - /* HW Xv for SiS630 */ - if (pSiS->Chipset == PCI_CHIP_SIS630) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using SiS630 HW Xv\n" ); - SISInitVideo(pScreen); - } - else { /* generic Xv */ + if(!pSiS->NoXvideo) { +#ifdef SISDUALHEAD + /* TW: On chipsets with only one overlay, we support + * Xv only in "real" dual head mode, not Xinerama + */ + if ( ((pSiS->VGAEngine == SIS_300_VGA) || + (pSiS->VGAEngine == SIS_315_VGA) ) + && + ((pSiS->hasTwoOverlays) || + (!pSiS->DualHeadMode) || + (noPanoramiXExtension) ) ) { +#else + if ( (pSiS->VGAEngine == SIS_300_VGA) || + (pSiS->VGAEngine == SIS_315_VGA) ) { +#endif +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + if ( pSiS->hasTwoOverlays || + (pSiS->XvOnCRT2 && (!pSiS->SecondHead)) || + ((!pSiS->XvOnCRT2 && pSiS->SecondHead)) ) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using SiS300/310/325 series HW Xv on CRT%d\n", + (pSiS->SecondHead ? 1 : 2)); + SISInitVideo(pScreen); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using SiS300/310/325 series HW Xv on CRT%d\n", + (pSiS->SecondHead ? 1 : 2)); + } + } else { +#endif + if (pSiS->hasTwoOverlays) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using SiS300/310/325 series HW Xv\n" ); + else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using SiS300/310/325 series HW Xv on CRT%d\n", + (pSiS->XvOnCRT2 ? 2 : 1)); + SISInitVideo(pScreen); +#ifdef SISDUALHEAD + } +#endif +#ifdef USE6326VIDEO + } else if( pSiS->Chipset == PCI_CHIP_SIS6326 || + pSiS->Chipset == PCI_CHIP_SIS530 || + pSiS->Chipset == PCI_CHIP_SIS5597 ) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using SiS5597/5598/6326/530/620 HW Xv\n" ); + SIS6326InitVideo(pScreen); +#endif + } else { /* generic Xv */ XF86VideoAdaptorPtr *ptr; int n; @@ -1809,48 +4872,126 @@ xf86XVScreenInit(pScreen, ptr, n); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using generic Xv\n" ); } + if (!noPanoramiXExtension) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "HW Xv not supported in Xinerama mode\n"); } } #endif #ifdef XF86DRI - if (pSiS->directRenderingEnabled) { + if(pSiS->directRenderingEnabled) { /* Now that mi, drm and others have done their thing, * complete the DRI setup. */ pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen); } - if (pSiS->directRenderingEnabled) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n"); + if(pSiS->directRenderingEnabled) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n"); /* TODO */ /* SISSetLFBConfig(pSiS); */ } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n"); } #endif pSiS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SISCloseScreen; - pScreen->SaveScreen = SISSaveScreen; +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) + pScreen->SaveScreen = SISSaveScreenDH; + else +#endif + pScreen->SaveScreen = SISSaveScreen; + /* Install BlockHandler */ + pSiS->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = SISBlockHandler; + /* Report any unused options (only for the first generation) */ - if (serverGeneration == 1) { - xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + if(serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } /* Turn on the screen now */ - SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + /* TW: We do this in dual head mode after second head is finished */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); + } else +#endif + SISSaveScreen(pScreen, SCREEN_SAVER_OFF); return TRUE; } - /* Usually mandatory */ Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SISPtr pSiS = SISPTR(pScrn); + + if(!pSiS->NoAccel) { + if(pSiS->AccelInfoPtr) { + (*pSiS->AccelInfoPtr->Sync)(pScrn); + } + } + + return SISModeInit(xf86Screens[scrnIndex], mode); +} + +#ifdef CYCLECRT2 +/* TW: Cycle CRT2 output devices */ +Bool +SISCycleCRT2Type(int scrnIndex, DisplayModePtr mode) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SISPtr pSiS = SISPTR(pScrn); + int i = 0; + + /* TW: Only on 300 and 310/325 series */ + if(pSiS->VGAEngine != SIS_300_VGA && + pSiS->VGAEngine != SIS_315_VGA) return FALSE; + + /* TW: Only if there is a video bridge */ + if(pSiS->VBFlags & VB_VIDEOBRIDGE) return FALSE; + + /* TW: Only if there were more than 1 CRT2 devices detected */ + if(pSiS->detectedCRT2Devices & CRT2_VGA) i++; + if(pSiS->detectedCRT2Devices & CRT2_LCD) i++; + if(pSiS->detectedCRT2Devices & CRT2_TV) i++; + if(i <= 1) return FALSE; + + /* TW: Cycle CRT2 type */ + i = (pSiS->VBFlags & DISPTYPE_DISP2) << 1; + while(!(i & pSiS->detectedCRT2Devices)) { + i <<= 1; + if(i > CRT2_VGA) i = CRT2_LCD; + } + + /* TW: Check if mode is suitable for desired output device */ + if(!SiS_CheckCalcModeIndex(pScrn, pScrn->currentMode, + ((pSiS->VBFlags & ~(DISPTYPE_DISP2)) | i))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Current mode not suitable for desired CRT2 output device\n"); + return FALSE; + } + + /* TW: Sync the accelerators */ + if(!pSiS->NoAccel) { + if(pSiS->AccelInfoPtr) { + (*pSiS->AccelInfoPtr->Sync)(pScrn); + } + } + + pSiS->VBFlags &= ~(DISPTYPE_DISP2); + pSiS->VBFlags |= i; + return SISModeInit(xf86Screens[scrnIndex], mode); } +#endif /* * This function is used to initialize the Start Address - the first @@ -1863,104 +5004,142 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; SISPtr pSiS; vgaHWPtr hwp; - int base = y * pScrn->displayWidth + x; - int vgaIOBase; - unsigned char SR5State, temp; + int base; + unsigned char temp; hwp = VGAHWPTR(pScrn); pSiS = SISPTR(pScrn); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + + base = y * pSiS->CurrentLayout.displayWidth + x; - if (pSiS->UseVESA) { + if(pSiS->UseVESA) { + /* TW: Let BIOS adjust frame if using VESA */ VBESetDisplayStart(pSiS->pVbe, x, y, TRUE); - } - else { - outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ - SR5State = inb(VGA_SEQ_DATA); - outw(VGA_SEQ_INDEX, 0x8605); - if (pScrn->bitsPerPixel < 8) { - base = (y * pScrn->displayWidth + x + 3) >> 3; } else { - base = y * pScrn->displayWidth + x ; - /* calculate base bpp dep. */ - switch (pScrn->bitsPerPixel) { - case 16: - base >>= 1; - break; - case 24: - base = ((base * 3)) >> 2; - base -= base % 6; - break; - case 32: - break; - default: /* 8bpp */ - base >>= 2; - break; - } - } - outw(vgaIOBase + 4, (base & 0x00FF00) | 0x0C); - outw(vgaIOBase + 4, ((base & 0x00FF) << 8) | 0x0D); - switch (pSiS->Chipset) { - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - outb(VGA_SEQ_INDEX, 0x0D); - temp = (base & 0xFF0000) >> 16; - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "3C5/0Dh set to hex %2X, base 0x%x\n", temp, base)); - outb(VGA_SEQ_DATA, temp); - if (pSiS->VBFlags) { -/* SiSUnLockCRT2(pSiS->RelIO); */ - SiSUnLockCRT2(pSiS->RelIO+0x30); - outSISIDXREG(pSiS->RelIO+4, 6, GETVAR8(base)); - outSISIDXREG(pSiS->RelIO+4, 5, GETBITS(base, 15:8)); - outSISIDXREG(pSiS->RelIO+4, 4, GETBITS(base, 23:16)); -/* SiSLockCRT2(pSiS->RelIO); */ - SiSLockCRT2(pSiS->RelIO+0x30); - } - break; - default: - outb(VGA_SEQ_INDEX, 0x27); - temp = inb(VGA_SEQ_DATA) & 0xF0; - temp |= (base & 0x0F0000) >> 16; - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "3C5/27h set to hex %2X, base %d\n", temp, base)); - outb(VGA_SEQ_DATA, temp); - } +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif - outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ + if(pScrn->bitsPerPixel < 8) { + base = (y * pSiS->CurrentLayout.displayWidth + x + 3) >> 3; + } else { + base = y * pSiS->CurrentLayout.displayWidth + x; + + /* calculate base bpp dep. */ + switch(pSiS->CurrentLayout.bitsPerPixel) { + case 16: + base >>= 1; + break; + case 24: + base = ((base * 3)) >> 2; + base -= base % 6; + break; + case 32: + break; + default: /* 8bpp */ + base >>= 2; + break; + } + } - } /* if not VESA */ +#ifdef SISDUALHEAD + if (pSiS->DualHeadMode) { + /* TW: We assume that DualHeadMode only can be true for + * dual head capable chipsets (and thus save the check + * for chipset here) + */ + if (!pSiS->SecondHead) { + /* TW: Head 1 (master) is always CRT2 */ + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + outSISIDXREG(SISPART1, 0x06, GETVAR8(base)); + outSISIDXREG(SISPART1, 0x05, GETBITS(base, 15:8)); + outSISIDXREG(SISPART1, 0x04, GETBITS(base, 23:16)); + if (pSiS->VGAEngine == SIS_315_VGA) { + setSISIDXREG(SISPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7); + } + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + } else { + /* TW: Head 2 (slave) is always CRT1 */ + base += (pSiS->dhmOffset/4); + outSISIDXREG(SISCR, 0x0D, base & 0xFF); + outSISIDXREG(SISCR, 0x0C, (base >> 8) & 0xFF); + outSISIDXREG(SISSR, 0x0D, (base >> 16) & 0xFF); + if (pSiS->VGAEngine == SIS_315_VGA) { + setSISIDXREG(SISSR, 0x37, 0xFE, (base >> 24) & 0x01); + } + } + } else { +#endif + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + outSISIDXREG(SISCR, 0x0D, base & 0xFF); + outSISIDXREG(SISCR, 0x0C, (base >> 8) & 0xFF); + outSISIDXREG(SISSR, 0x0D, (base >> 16) & 0xFF); + if (pSiS->VBFlags & CRT2_ENABLE) { + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + outSISIDXREG(SISPART1, 0x06, GETVAR8(base)); + outSISIDXREG(SISPART1, 0x05, GETBITS(base, 15:8)); + outSISIDXREG(SISPART1, 0x04, GETBITS(base, 23:16)); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + } + break; + case SIS_315_VGA: + outSISIDXREG(SISCR, 0x0D, base & 0xFF); + outSISIDXREG(SISCR, 0x0C, (base >> 8) & 0xFF); + outSISIDXREG(SISSR, 0x0D, (base >> 16) & 0xFF); + setSISIDXREG(SISSR, 0x37, 0xFE, (base >> 24) & 0x01); + if (pSiS->VBFlags & CRT2_ENABLE) { + SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + outSISIDXREG(SISPART1, 0x06, GETVAR8(base)); + outSISIDXREG(SISPART1, 0x05, GETBITS(base, 15:8)); + outSISIDXREG(SISPART1, 0x04, GETBITS(base, 23:16)); + setSISIDXREG(SISPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pSiS->RelIO+0x30); + } + break; + default: + outSISIDXREG(SISCR, 0x0D, base & 0xFF); + outSISIDXREG(SISCR, 0x0C, (base >> 8) & 0xFF); + inSISIDXREG(SISSR, 0x27, temp); + temp &= 0xF0; + temp |= (base & 0x0F0000) >> 16; + outSISIDXREG(SISSR, 0x27, temp); + } +#ifdef SISDUALHEAD + } +#endif + } /* if not VESA */ } + /* * This is called when VT switching back to the X server. Its job is * to reinitialise the video mode. - * - * We may wish to unmap video/MMIO memory too. - * (TW: This might be dangerous with TQ) + * Mandatory! */ - -/* Mandatory */ static Bool SISEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; -#ifdef XF86DRI SISPtr pSiS = SISPTR(pScrn); -#endif - if (!SISModeInit(pScrn, pScrn->currentMode)) + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); + + if(!SISModeInit(pScrn, pScrn->currentMode)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "SiSEnterVT: SISModeInit() failed\n"); return FALSE; + } SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); -#ifdef XF86DRI /* TW: this is to be done AFTER switching the mode */ - if (pSiS->directRenderingEnabled) +#ifdef XF86DRI + /* TW: this is to be done AFTER switching the mode */ + if(pSiS->directRenderingEnabled) DRIUnlock(screenInfo.screens[scrnIndex]); #endif @@ -1970,45 +5149,65 @@ /* * This is called when VT switching away from the X server. Its job is * to restore the previous (text) mode. - * - * We may wish to remap video/MMIO memory too. + * Mandatory! */ - -/* Mandatory */ static void SISLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); - SISPtr pSiS; - + SISPtr pSiS = SISPTR(pScrn); #ifdef XF86DRI ScreenPtr pScreen; -#endif - - pSiS = SISPTR(pScrn); -#ifdef XF86DRI /* TW: to be done before mode change */ - if (pSiS->directRenderingEnabled) { + /* TW: to be done before mode change */ + if(pSiS->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); } #endif +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode && pSiS->SecondHead) return; +#endif + + if(pSiS->CursorInfoPtr) { +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!pSiS->SecondHead) { + pSiS->ForceCursorOff = TRUE; + pSiS->CursorInfoPtr->HideCursor(pScrn); + SISWaitVBRetrace(pScrn); + pSiS->ForceCursorOff = FALSE; + } + } else { +#endif + pSiS->CursorInfoPtr->HideCursor(pScrn); + SISWaitVBRetrace(pScrn); +#ifdef SISDUALHEAD + } +#endif + } + SISBridgeRestore(pScrn); - if (pSiS->UseVESA) { + if(pSiS->UseVESA) { + /* TW: This is a q&d work-around for a BIOS bug. In case we disabled CRT2, - * VBESaveRestore() does not re-enable CRT1. So we set any mode now, + * VBESaveRestore() does not restore CRT1. So we set any mode now, * because VBESetVBEMode correctly restores CRT1. Afterwards, we * can call VBESaveRestore to restore original mode. */ if ( (pSiS->VBFlags & VB_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2)) ) - VBESetVBEMode(pSiS->pVbe, (SISVesaModeList->n) | 0xc000, NULL); + VBESetVBEMode(pSiS->pVbe, (pSiS->SISVESAModeList->n) | 0xc000, NULL); + SISVESARestore(pScrn); - } - SISRestore(pScrn); + } else { + + SISRestore(pScrn); + + } vgaHWLock(hwp); } @@ -2017,48 +5216,113 @@ /* * This is called at the end of each server generation. It restores the * original (text) mode. It should really also unmap the video memory too. + * Mandatory! */ - -/* Mandatory */ static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); SISPtr pSiS = SISPTR(pScrn); - xf86CursorInfoPtr pCursorInfo = pSiS->CursorInfoPtr; +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif #ifdef XF86DRI - if (pSiS->directRenderingEnabled) { + if(pSiS->directRenderingEnabled) { SISDRICloseScreen(pScreen); - pSiS->directRenderingEnabled=FALSE; + pSiS->directRenderingEnabled = FALSE; } #endif + + if(pScrn->vtSema) { + + if(pSiS->CursorInfoPtr) { +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!pSiS->SecondHead) { + pSiS->ForceCursorOff = TRUE; + pSiS->CursorInfoPtr->HideCursor(pScrn); + SISWaitVBRetrace(pScrn); + pSiS->ForceCursorOff = FALSE; + } + } else { +#endif + pSiS->CursorInfoPtr->HideCursor(pScrn); + SISWaitVBRetrace(pScrn); +#ifdef SISDUALHEAD + } +#endif + } - if (pScrn->vtSema) { - if (pCursorInfo) - pCursorInfo->HideCursor(pScrn); SISBridgeRestore(pScrn); - if (pSiS->UseVESA) { - /* TW: This is a q&d work-around for a BIOS bug. In case we disabled CRT2, - * VBESaveRestore() does not re-enable CRT1. So we set any mode now, + + if(pSiS->UseVESA) { + + /* TW: This is a q&d work-around for a BIOS bug. In case we disabled CRT2, + * VBESaveRestore() does not restore CRT1. So we set any mode now, * because VBESetVBEMode correctly restores CRT1. Afterwards, we * can call VBESaveRestore to restore original mode. */ - if ( (pSiS->VBFlags & VB_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2))) - VBESetVBEMode(pSiS->pVbe, (SISVesaModeList->n) | 0xc000, NULL); + if( (pSiS->VBFlags & VB_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2))) + VBESetVBEMode(pSiS->pVbe, (pSiS->SISVESAModeList->n) | 0xc000, NULL); + SISVESARestore(pScrn); + + } else { + + SISRestore(pScrn); + } - SISRestore(pScrn); + vgaHWLock(hwp); - SISUnmapMem(pScrn); + } + + SISUnmapMem(pScrn); + vgaHWUnmapMem(pScrn); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt = pSiS->entityPrivate; + pSiSEnt->refCount--; + } +#endif + + if(pSiS->pInt) { + xf86FreeInt10(pSiS->pInt); + pSiS->pInt = NULL; } - if(pSiS->AccelInfoPtr) + + if(pSiS->AccelInfoPtr) { XAADestroyInfoRec(pSiS->AccelInfoPtr); - if(pCursorInfo) - xf86DestroyCursorInfoRec(pCursorInfo); + pSiS->AccelInfoPtr = NULL; + } + + if(pSiS->CursorInfoPtr) { + xf86DestroyCursorInfoRec(pSiS->CursorInfoPtr); + pSiS->CursorInfoPtr = NULL; + } + + if(pSiS->ShadowPtr) { + xfree(pSiS->ShadowPtr); + pSiS->ShadowPtr = NULL; + } + + if(pSiS->DGAModes) { + xfree(pSiS->DGAModes); + pSiS->DGAModes = NULL; + } + + if(pSiS->adaptor) { + xfree(pSiS->adaptor); + pSiS->adaptor = NULL; + } + pScrn->vtSema = FALSE; - + + /* Restore Blockhandler */ + pScreen->BlockHandler = pSiS->BlockHandler; + pScreen->CloseScreen = pSiS->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -2084,18 +5348,24 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; SISPtr pSiS = SISPTR(pScrn); + + if(pSiS->UseVESA) { + if(SiSCalcVESAModeIndex(pScrn, mode)) + return(MODE_OK); + else + return(MODE_BAD); + } + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { +#ifdef SISDUALHEAD + if((pSiS->DualHeadMode) && (pSiS->SecondHead)) { + /* DHM: Only check modes for CRT1 */ + if(SiS_CalcModeIndex(pScrn, mode) < 0x14) + return(MODE_BAD); + } else +#endif + if(SiS_CheckCalcModeIndex(pScrn, mode, pSiS->VBFlags) < 0x14) + return(MODE_BAD); - if (pSiS->UseVESA) { - if (CalcVESAModeIndex(pScrn, mode)) - return (MODE_OK); - else - return (MODE_BAD); - } - if ((pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540)) { - if (SiSCalcModeIndex(pScrn, mode) < 0x14) - return (MODE_BAD); } return(MODE_OK); @@ -2108,33 +5378,175 @@ SISSaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + if ((pScrn != NULL) && pScrn->vtSema) { SISPtr pSiS = SISPTR(pScrn); + /* enable access to extended sequencer registers */ - outw(VGA_SEQ_INDEX, 0x8605); - outb(VGA_SEQ_INDEX, 0x11); - /* if not blanked obtain state of LCD blank flags set by BIOS */ - if (!pSiS->Blank) { - unsigned char val; - val = inb(VGA_SEQ_DATA); - pSiS->LCDon = val; - } - if (!xf86IsUnblank(mode)) { - pSiS->Blank = TRUE; - outb(VGA_SEQ_DATA, (pSiS->LCDon | 0x8)); - } else { - pSiS->Blank = FALSE; - /* don't just unblanking; use LCD state set by BIOS */ - outb(VGA_SEQ_DATA, (pSiS->LCDon)); +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + if(pSiS->VGAEngine == SIS_300_VGA) { + + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + if(!xf86IsUnblank(mode)) { + pSiS->Blank = TRUE; + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + pSiS->Blank = FALSE; + SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } else { + /* if not blanked obtain state of LCD blank flags set by BIOS */ + if(!pSiS->Blank) { + inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + + if(!xf86IsUnblank(mode)) { + pSiS->Blank = TRUE; + outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08); + } else { + pSiS->Blank = FALSE; + /* don't just unblanking; use LCD state set by BIOS */ + outSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + } + + } else if(pSiS->VGAEngine == SIS_315_VGA) { + + if(!pSiS->Blank) { + inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + + if(pSiS->VBFlags & VB_CHRONTEL) { + if(!xf86IsUnblank(mode)) { + pSiS->Blank = TRUE; + SiS_Chrontel701xBLOff(pSiS->SiS_Pr); + } else { + pSiS->Blank = FALSE; + SiS_Chrontel701xBLOn(pSiS->SiS_Pr); + } + } else if(pSiS->VBFlags & VB_LVDS) { + if(!xf86IsUnblank(mode)) { + pSiS->Blank = TRUE; + outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08); + } else { + pSiS->Blank = FALSE; + outSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + } else if(pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + if(!xf86IsUnblank(mode)) { + pSiS->Blank = TRUE; + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + pSiS->Blank = FALSE; + SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } + } + } return vgaHWSaveScreen(pScreen, mode); } -#ifdef DEBUG -/* local used for debug */ +#ifdef SISDUALHEAD +/* TW: SaveScreen for dual head mode */ +static Bool +SISSaveScreenDH(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if ((pScrn != NULL) && pScrn->vtSema) { + + SISPtr pSiS = SISPTR(pScrn); + if (pSiS->SecondHead) { + + /* Slave head is always CRT1 */ + return vgaHWSaveScreen(pScreen, mode); + + } else { + + /* Master head is always CRT2 */ + + /* We can only blank LCD, not other CRT2 devices */ + if(!(pSiS->VBFlags & CRT2_LCD)) return TRUE; + + /* enable access to extended sequencer registers */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + if(pSiS->VGAEngine == SIS_300_VGA) { + + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + if(!xf86IsUnblank(mode)) { + pSiS->BlankCRT2 = TRUE; + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + pSiS->BlankCRT2 = FALSE; + SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } else { + /* if not blanked obtain state of LCD blank flags set by BIOS */ + if(!pSiS->BlankCRT2) { + inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + + if (!xf86IsUnblank(mode)) { + pSiS->BlankCRT2 = TRUE; + outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08); + } else { + pSiS->BlankCRT2 = FALSE; + /* don't just unblank; use LCD state set by BIOS */ + outSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + } + + } else if(pSiS->VGAEngine == SIS_315_VGA) { + + if(!pSiS->BlankCRT2) { + inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + + if(pSiS->VBFlags & VB_CHRONTEL) { + if(!xf86IsUnblank(mode)) { + pSiS->BlankCRT2 = TRUE; + SiS_Chrontel701xBLOff(pSiS->SiS_Pr); + } else { + pSiS->BlankCRT2 = FALSE; + SiS_Chrontel701xBLOn(pSiS->SiS_Pr); + } + } else if(pSiS->VBFlags & VB_LVDS) { + if(!xf86IsUnblank(mode)) { + pSiS->BlankCRT2 = TRUE; + outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08); + } else { + pSiS->BlankCRT2 = FALSE; + outSISIDXREG(SISSR, 0x11, pSiS->LCDon); + } + } else if(pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + if(!xf86IsUnblank(mode)) { + pSiS->BlankCRT2 = TRUE; + SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext); + } else { + pSiS->BlankCRT2 = FALSE; + SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext); + } + } + + } + } + } + return TRUE; +} +#endif + +#ifdef DEBUG +/* locally used for debug */ static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -2154,19 +5566,6 @@ xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Blank End : %x\n", mode->CrtcVBlankEnd); xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Total : %x\n", mode->CrtcVTotal); xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt VAdjusted : %x\n", mode->CrtcVAdjusted); - -/* - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Display : %x\n", mode->HDisplay); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Sync Start : %x\n", mode->HSyncStart); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Sync End : %x\n", mode->HSyncEnd); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Total : %x\n", mode->HTotal); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Skew : %x\n", mode->HSkew); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Display : %x\n", mode->VDisplay); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Sync Start : %x\n", mode->VSyncStart); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Sync End : %x\n", mode->VSyncEnd); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Total : %x\n", mode->VTotal); - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Scan : %x\n", mode->VScan); -*/ } #endif @@ -2174,177 +5573,1737 @@ static void SISModifyModeInfo(DisplayModePtr mode) { -/* - mode->Clock = 31500; - mode->CrtcHTotal = 832; - mode->CrtcHDisplay = 640; - mode->CrtcHBlankStart = 648; - mode->CrtcHSyncStart = 664; - mode->CrtcHSyncEnd = 704; - mode->CrtcHBlankEnd = 824; - - mode->CrtcVTotal = 520; - mode->CrtcVDisplay = 480; - mode->CrtcVBlankStart = 488; - mode->CrtcVSyncStart = 489; - mode->CrtcVSyncEnd = 492; - mode->CrtcVBlankEnd = 512; -*/ - if (mode->CrtcHBlankStart == mode->CrtcHDisplay) +#if 1 + if(mode->CrtcHBlankStart == mode->CrtcHDisplay) mode->CrtcHBlankStart++; - if (mode->CrtcHBlankEnd == mode->CrtcHTotal) + if(mode->CrtcHBlankEnd == mode->CrtcHTotal) mode->CrtcHBlankEnd--; - if (mode->CrtcVBlankStart == mode->CrtcVDisplay) + if(mode->CrtcVBlankStart == mode->CrtcVDisplay) mode->CrtcVBlankStart++; - if (mode->CrtcVBlankEnd == mode->CrtcVTotal) + if(mode->CrtcVBlankEnd == mode->CrtcVTotal) mode->CrtcVBlankEnd--; +#endif } -void SiSPreSetMode(ScrnInfoPtr pScrn, int LockAfterwards) +/* TW: Enable the TurboQueue (For 300 and 310/325 series only) */ +void +SiSEnableTurboQueue(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - unsigned char usScratchCR30, usScratchCR31; - unsigned char usScratchCR32, usScratchCR33; unsigned short SR26, SR27; - unsigned char SR5State; unsigned long temp; - int vbflag; - outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ - SR5State = inb(VGA_SEQ_DATA); - outw(VGA_SEQ_INDEX, 0x8605); - - usScratchCR30 = usScratchCR31 = usScratchCR33 = 0; - outb(SISCR, 0x31); - usScratchCR31 = inb(SISCR+1); - outb(SISCR, 0x33); /* TW: CRT1 refresh rate index */ - usScratchCR33 = inb(SISCR+1); - outb(SISCR, 0x32); /* TW: Bridge connection info */ - usScratchCR32 = inb(SISCR+1); - outb(SISCR, 0x30); - usScratchCR30 = inb(SISCR+1); - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Bridge registers were 30=0x%02x, 31=0x%02x, 32=0x%02x, 33=0x%02x (VBFlags = 0x%x)\n", - usScratchCR30, usScratchCR31, usScratchCR32, usScratchCR33, pSiS->VBFlags); - usScratchCR30 = 0; - usScratchCR31 &= ~0x60; /* TW: clear VB_Drivermode & VB_OutputDisable */ - - vbflag=pSiS->VBFlags; - switch (vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) - { case CRT2_TV: - if (vbflag & TV_HIVISION) - usScratchCR30 |= 0x80; - else if (vbflag & TV_SVIDEO) - usScratchCR30 |= 0x08; - else if (vbflag & TV_AVIDEO) - usScratchCR30 |= 0x04; - else if (vbflag & TV_SCART) - usScratchCR30 |= 0x10; - if (vbflag & TV_PAL) - usScratchCR31 |= 0x01; - else - usScratchCR31 &= ~0x01; -#if 0 /* TW: Old code */ - if (vbflag & TV_HIVISION) usScratchCR30 |= 0x80; - else if (vbflag & TV_PAL) usScratchCR31 |= 0x01; - - if (vbflag & TV_AVIDEO) usScratchCR30 |= 0x04; - else if (vbflag & TV_SVIDEO) usScratchCR30 |= 0x08; - else if (vbflag & TV_SCART) usScratchCR30 |= 0x10; + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + if ((!pSiS->NoAccel) && (pSiS->TurboQueue)) { + /* TQ size is always 512k */ + temp = (pScrn->videoRam/64) - 8; + SR26 = temp & 0xFF; + inSISIDXREG(SISSR, 0x27, SR27); + SR27 &= 0xFC; + SR27 |= (0xF0 | ((temp >> 8) & 3)); + outSISIDXREG(SISSR, 0x26, SR26); + outSISIDXREG(SISSR, 0x27, SR27); + } + break; + case SIS_315_VGA: + if (!pSiS->NoAccel) { + /* TW: On 310/325 series, there are three queue modes available + * which are chosen by setting bits 7:5 in SR26: + * 1. MMIO queue mode (bit 5, 0x20). The hardware will keep + * track of the queue, the FIFO, command parsing and so + * on. This is the one comparable to the 300 series. + * 2. VRAM queue mode (bit 6, 0x40). In this case, one will + * have to do queue management himself. Register 0x85c4 will + * hold the location of the next free queue slot, 0x85c8 + * is the "queue read pointer" whose way of working is + * unknown to me. Anyway, this mode would require a + * translation of the MMIO commands to some kind of + * accelerator assembly and writing these commands + * to the memory location pointed to by 0x85c4. + * We will not use this, as nobody knows how this + * "assembly" works, and as it would require a complete + * re-write of the accelerator code. + * 3. AGP queue mode (bit 7, 0x80). Works as 2., but keeps the + * queue in AGP memory space. + * We go MMIO here. + * SR26 bit 4 is called "Bypass H/W queue". + * SR26 bit 1 is called "Enable Command Queue Auto Correction" + * SR26 bit 0 resets the queue + * Size of queue memory is encoded in bits 3:2 like this: + * 00 (0x00) 512K + * 01 (0x04) 1M + * 10 (0x08) 2M + * 11 (0x0C) 4M + * The queue location is to be written to 0x85C0. + */ +#if 0 + if (pSiS->TurboQueue) { #endif - usScratchCR30 |= 0x01; - usScratchCR31 &= ~0x04; - break; - case CRT2_LCD: - usScratchCR30 |= 0x21; - usScratchCR31 |= 0x02; - break; - case CRT2_VGA: - usScratchCR30 |= 0x41; - break; - default: /* TW: When CRT2Type is NONE, we can calculate a proper rate for CRT1 */ - usScratchCR30 |= 0x00; - usScratchCR31 |= 0x20; /* TW: VB_OUTPUT_DISABLE */ - if (pSiS->UseVESA) - usScratchCR33 = SISSearchCRT1Rate(pScrn->currentMode); - } - /* - * TW: for VESA: no DRIVERMODE, otherwise - * -) CRT2 will not be initialized correctly when using mode - * where LCD has to scale - * -) CRT1 will have too low rate - */ - if (pSiS->UseVESA) usScratchCR31 &= ~0x40; - else usScratchCR31 |= 0x40; /* 0x40=drivermode */ - - SiSSetReg1(SISCR, 0x30, usScratchCR30); - SiSSetReg1(SISCR, 0x31, usScratchCR31); - SiSSetReg1(SISCR, 0x33, usScratchCR33); - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Bridge registers set to 30=0x%02x, 31=0x%02x, 33=0x%02x\n", - usScratchCR30, usScratchCR31, usScratchCR33); - - /* Set Turbo Queue as 512K */ - /* TW: This is done here _and_ in SiS300Init() because SiS300Init() only - * sets up structure but structure is not written to hardware (using - * SiS300Restore) on SiS630, 300, 540 (unless VESA is used). - */ - if (!pSiS->NoAccel) { - if (pSiS->TurboQueue) { - temp = (pScrn->videoRam/64) - 8; - SR26 = temp & 0xFF; - SR27 = ((temp >> 8) & 3) | 0xF0; - SiSSetReg1(SISSR, 0x26, SR26); - SiSSetReg1(SISSR, 0x27, SR27); - } + /* TW: We only use MMIO Cmd Queue, not VRAM or AGP */ + /* TW: Set Command Queue Threshold to max value 11111b */ + outSISIDXREG(SISSR, 0x27, 0x1F); + /* TW: Syncronous reset for Command Queue */ + outSISIDXREG(SISSR, 0x26, 0x01); + /* TW: Do some magic (cp readport to writeport) */ + temp = MMIO_IN32(pSiS->IOBase, 0x85C8); + MMIO_OUT32(pSiS->IOBase, 0x85C4, temp); + /* TW: Enable MMIO Command Queue mode (0x20), + * Enable_command_queue_auto_correction (0x02) + * (no idea, but sounds good, so use it) + * 512k (0x00) (does this apply to MMIO mode?) */ + outSISIDXREG(SISSR, 0x26, 0x22); + /* TW: Calc Command Queue position (Q is always 512k)*/ + temp = (pScrn->videoRam - 512) * 1024; + /* TW: Set Q position */ + MMIO_OUT32(pSiS->IOBase, 0x85C0, temp); +#if 0 + } else { + /* TW: Is there a non-TurboQueue mode within MMIO mode? */ + } +#endif + } + break; + default: + break; } - - if (LockAfterwards) - outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ } -/* TW: This doesn't work yet. Switching CRT1 off this way causes a white screen on CRT2 */ -void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg, int LockAfterwards) +/* TW: Things to do before a ModeSwitch. We set up the + * video bridge configuration and the TurboQueue. + */ +void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { -#if 0 - SISPtr pSiS = SISPTR(pScrn); - unsigned char usScratchCR17; - unsigned char SR5State; - - outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ - SR5State = inb(VGA_SEQ_DATA); - outw(VGA_SEQ_INDEX, 0x8605); + SISPtr pSiS = SISPTR(pScrn); + unsigned char usScratchCR30, usScratchCR31; + unsigned char usScratchCR32, usScratchCR33; + unsigned char usScratchCR17, usScratchCR38 = 0; + int vbflag, temp = 0; + int crt1rateindex = 0; - if ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) && - pScrn->bitsPerPixel == 8) - pSiS->CRT1off = 0; +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); /* Unlock Registers */ +#endif - xf86DrvMsg(0, X_PROBED, "CRT1off %d\n", pSiS->CRT1off); + vbflag = pSiS->VBFlags; + pSiS->IsCustom = FALSE; + + if(pSiS->HaveCustomModes) { + if(!(mode->type & M_T_DEFAULT)) { + pSiS->IsCustom = TRUE; + } + } - outb(SISCR, 0x17); - usScratchCR17 = inb(SISCR+1); + /* TW: The CR3x registers are for communicating with our BIOS emulation + * code (native code in init.c/init301.c) or the BIOS (via VESA) + */ + inSISIDXREG(SISCR, 0x30, usScratchCR30); /* Bridge config */ + inSISIDXREG(SISCR, 0x31, usScratchCR31); /* Bridge config */ + usScratchCR32 = pSiS->newCR32; /* Bridge connection info (use our new value) */ + inSISIDXREG(SISCR, 0x33, usScratchCR33); /* CRT1 refresh rate index */ + if(pSiS->Chipset != PCI_CHIP_SIS300) { + switch(pSiS->VGAEngine) { + case SIS_300_VGA: temp = 0x35; break; + case SIS_315_VGA: temp = 0x38; break; + } + } + if(temp) inSISIDXREG(SISCR, temp, usScratchCR38); /* PAL-M, PAL-N selection */ - xf86DrvMsg(0, X_PROBED, "CR17 was 0x%2x\n", usScratchCR17); - if (pSiS->CRT1off) - usScratchCR17 &= ~0x80; /* sisReg->sisRegs3D4[0x17] &= ~0x80; */ - else - usScratchCR17 |= 0x80; /* sisReg->sisRegs3D4[0x17] |= 0x80; */ + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "VBFlags=0x%x\n", pSiS->VBFlags); - xf86DrvMsg(0, X_PROBED, "CR17 set to 0x%2x\n", usScratchCR17); - /*SiSSetReg1(SISCR, 0x17, usScratchCR17); */ + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 3, + "Before: CR30=0x%02x, CR31=0x%02x, CR32=0x%02x, CR33=0x%02x, CR%02x=0x%02x\n", + usScratchCR30, usScratchCR31, usScratchCR32, usScratchCR33, temp, usScratchCR38); - if (LockAfterwards) - outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ + usScratchCR30 = 0; + usScratchCR31 &= ~0x60; /* TW: Clear VB_Drivermode & VB_OutputDisable */ +#if 0 /* TW: For future use */ + if( (pSiS->VBFlags & VB_LVDS) || + (pSiS->VBFlags & VB_301) || + ( (pSiS->VBFlags & (VB_301B | VB_302B |VB_30xLV | VB_30xLVX)) && + (!(pSiS->VBLCDFlags & VB_LCD_1400x1050)) ) ) { #endif -} + usScratchCR31 |= 0x04; /* TW: Set VB_NotSimuMode (not for 30xB/1400x1050?) */ +#if 0 + } +#endif -static void -SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe) + switch(vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) { + case CRT2_TV: + if(vbflag & TV_CHSCART) { + usScratchCR38 |= 0x04; + usScratchCR31 |= 0x01; + } else if(vbflag & TV_CHHDTV) { + usScratchCR38 |= 0x08; + usScratchCR31 &= ~0x01; + } else if(vbflag & TV_HIVISION) + usScratchCR30 |= 0x80; + else if(vbflag & TV_SVIDEO) + usScratchCR30 |= 0x08; + else if(vbflag & TV_AVIDEO) + usScratchCR30 |= 0x04; + else if(vbflag & TV_SCART) + usScratchCR30 |= 0x10; + else + usScratchCR30 |= 0x08; /* default: SVIDEO */ + + if(!(vbflag & (TV_CHSCART | TV_CHHDTV))) { + if(vbflag & TV_PAL) { + usScratchCR31 |= 0x01; + usScratchCR38 &= ~0xC0; + if( (vbflag & VB_SISBRIDGE) || + ((vbflag & VB_CHRONTEL) && (pSiS->ChrontelType == CHRONTEL_701x)) ) { + if(vbflag & TV_PALM) usScratchCR38 |= 0x40; + else if(vbflag & TV_PALN) usScratchCR38 |= 0x80; + } + } else + usScratchCR31 &= ~0x01; + } + + usScratchCR30 |= 0x01; /* Set SimuScanMode */ + + usScratchCR31 &= ~0x04; /* Clear NotSimuMode */ + pSiS->SiS_Pr->SiS_CHOverScan = pSiS->UseCHOverScan; + if(pSiS->OptTVSOver == 1) { + pSiS->SiS_Pr->SiS_CHSOverScan = TRUE; + } else { + pSiS->SiS_Pr->SiS_CHSOverScan = FALSE; + } + break; + case CRT2_LCD: + usScratchCR30 |= 0x21; /* LCD + SimuScanMode */ + break; + case CRT2_VGA: + usScratchCR30 |= 0x41; /* VGA2 + SimuScanMode */ + break; + default: + usScratchCR30 |= 0x00; + usScratchCR31 |= 0x20; /* VB_OUTPUT_DISABLE */ + if(pSiS->UseVESA) { + crt1rateindex = SISSearchCRT1Rate(pScrn, mode); + } + } + /* TW: for VESA: no DRIVERMODE, otherwise + * -) CRT2 will not be initialized correctly when using mode + * where LCD has to scale, and + * -) CRT1 will have too low rate + */ + if (pSiS->UseVESA) { + usScratchCR31 &= 0x40; /* TW: Clear Drivermode */ +#ifdef TWDEBUG + usScratchCR31 |= 0x40; /* DEBUG (for non-slave mode VESA) */ + crt1rateindex = SISSearchCRT1Rate(pScrn, mode); +#endif + } else { + usScratchCR31 |= 0x40; /* TW: Set Drivermode */ + if(!pSiS->IsCustom) { + crt1rateindex = SISSearchCRT1Rate(pScrn, mode); + } else { + crt1rateindex = usScratchCR33; + } + } + outSISIDXREG(SISCR, 0x30, usScratchCR30); + outSISIDXREG(SISCR, 0x31, usScratchCR31); + if(temp) { + usScratchCR38 &= ~0x03; /* Clear LCDA/DualEdge bits */ + outSISIDXREG(SISCR, temp, usScratchCR38); + } + + pSiS->SiS_Pr->SiS_UseOEM = pSiS->OptUseOEM; + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + /* CRT1 */ + usScratchCR33 &= 0xf0; + usScratchCR33 |= (crt1rateindex & 0x0f); + } else { + /* CRT2 */ + usScratchCR33 &= 0x0f; + if(vbflag & CRT2_VGA) usScratchCR33 |= ((crt1rateindex << 4) & 0xf0); + } + } else { +#endif + if(vbflag & CRT2_VGA) { + usScratchCR33 = (crt1rateindex & 0x0f) | ((crt1rateindex & 0x0f) << 4); + } else { + usScratchCR33 = crt1rateindex & 0x0f; + } + if((!(pSiS->UseVESA)) && (vbflag & CRT2_ENABLE)) { +#ifndef TWDEBUG + if(pSiS->CRT1off) usScratchCR33 &= 0xf0; +#endif + } +#ifdef SISDUALHEAD + } +#endif + outSISIDXREG(SISCR, 0x33, usScratchCR33); + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "After: CR30=0x%02x, CR31=0x%02x, CR33=0x%02x\n", + usScratchCR30, usScratchCR31, usScratchCR33); + + /* Enable TurboQueue */ + SiSEnableTurboQueue(pScrn); + + if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) { + /* Switch on CRT1 for modes that require the bridge in SlaveMode */ + inSISIDXREG(SISCR, 0x17, usScratchCR17); + if(!(usScratchCR17 & 0x80)) { + orSISIDXREG(SISCR, 0x17, 0x80); + outSISIDXREG(SISSR, 0x00, 0x01); + usleep(10000); + outSISIDXREG(SISSR, 0x00, 0x03); + } + } + +} + +/* Functions for adjusting various TV settings */ + +/* These are used by the PostSetMode() functions as well as + * the (hopefully) upcoming display properties extension/tool. + * + * There is each a Set and a Get routine. The Set functions + * take a value of the same range as the corresponding option. + * The Get routines return a value of the same range (although + * not necessarily the same value as previously set because + * of the lower resolution of the respective setting compared + * to the valid range). + * The Get routines return -2 on error (eg. hardware does not + * support this setting). + * Note: The x and y positioning routines accept a position + * RELATIVE to the default position. All other routines + * take ABSOLUTE values. + * + * The Set functions will store the property regardless if TV is + * currently used or not and if the hardware supports the property + * or not. The Get routines will return this stored + * value if TV is not currently used (because the register does + * not contain the correct value then) or if the hardware supports + * the respective property. This should make it easier for the + * display property tool because it does not have to know the + * hardware features. + * + * All the routines are dual head aware. It does not matter + * if the function is called from the CRT1 or CRT2 session. + * The values will be stored in pSiSEnt if we're running dual. + */ + +void SiS_SetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvlumabandwidthcvbs = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvlumabandwidthcvbs = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + val /= 8; + if((val == 0) || (val == 1)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 8) | 0x03),0xFE); + } + break; + case CHRONTEL_701x: + val /= 4; + if((val >= 0) && (val <= 3)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 8) | 0x02),0xFC); + } + break; + } +} + +int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvlumabandwidthcvbs; + else +#endif + return (int)pSiS->chtvlumabandwidthcvbs; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x01) * 8); + case CHRONTEL_701x: + return(int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x03) * 4); + default: + return -2; + } + } +} + +void SiS_SetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvlumabandwidthsvideo = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvlumabandwidthsvideo = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + val /= 6; + if((val >= 0) && (val <= 2)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 9) | 0x03),0xF9); + } + break; + case CHRONTEL_701x: + val /= 4; + if((val >= 0) && (val <= 3)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 10) | 0x02),0xF3); + } + break; + } +} + +int SiS_GetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvlumabandwidthsvideo; + else +#endif + return (int)pSiS->chtvlumabandwidthsvideo; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x06) >> 1) * 6); + case CHRONTEL_701x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x0c) >> 2) * 4); + default: + return -2; + } + } +} + +void SiS_SetCHTVlumaflickerfilter(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvlumaflickerfilter = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvlumaflickerfilter = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + val /= 6; + if((val >= 0) && (val <= 2)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 10) | 0x01),0xF3); + } + break; + case CHRONTEL_701x: + val /= 4; + if((val >= 0) && (val <= 3)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 10) | 0x01),0xF3); + } + break; + } +} + +int SiS_GetCHTVlumaflickerfilter(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvlumaflickerfilter; + else +#endif + return (int)pSiS->chtvlumaflickerfilter; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x0c) >> 2) * 6); + case CHRONTEL_701x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x0c) >> 2) * 4); + default: + return -2; + } + } +} + +void SiS_SetCHTVchromabandwidth(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvchromabandwidth = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvchromabandwidth = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + val /= 4; + if((val >= 0) && (val <= 3)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 12) | 0x03),0xCF); + } + break; + case CHRONTEL_701x: + val /= 8; + if((val >= 0) && (val <= 1)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 12) | 0x02),0xEF); + } + break; + } +} + +int SiS_GetCHTVchromabandwidth(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvchromabandwidth; + else +#endif + return (int)pSiS->chtvchromabandwidth; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x30) >> 4) * 4); + case CHRONTEL_701x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x10) >> 4) * 8); + default: + return -2; + } + } +} + +void SiS_SetCHTVchromaflickerfilter(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvchromaflickerfilter = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvchromaflickerfilter = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + val /= 6; + if((val >= 0) && (val <= 2)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 12) | 0x01),0xCF); + } + break; + case CHRONTEL_701x: + val /= 4; + if((val >= 0) && (val <= 3)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 12) | 0x01),0xCF); + } + break; + } +} + +int SiS_GetCHTVchromaflickerfilter(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvchromaflickerfilter; + else +#endif + return (int)pSiS->chtvchromaflickerfilter; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x30) >> 4) * 6); + case CHRONTEL_701x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x30) >> 4) * 4); + default: + return -2; + } + } +} + +void SiS_SetCHTVcvbscolor(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvcvbscolor = val ? 1 : 0; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvcvbscolor = pSiS->chtvcvbscolor; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + if(!val) SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x4003,0x00); + else SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x0003,~0x40); + break; + case CHRONTEL_701x: + if(!val) SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x0002,~0x20); + else SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x2002,0x00); + break; + } +} + +int SiS_GetCHTVcvbscolor(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvcvbscolor; + else +#endif + return (int)pSiS->chtvcvbscolor; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x40) >> 6) ^ 0x01); + case CHRONTEL_701x: + return(int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x20) >> 5) ^ 0x01); + default: + return -2; + } + } +} + +void SiS_SetCHTVtextenhance(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvtextenhance = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvtextenhance = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + val /= 6; + if((val >= 0) && (val <= 2)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 8) | 0x01),0xFC); + } + break; + case CHRONTEL_701x: + val /= 2; + if((val >= 0) && (val <= 7)) { + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 8) | 0x03),0xF8); + } + break; + } +} + +int SiS_GetCHTVtextenhance(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvtextenhance; + else +#endif + return (int)pSiS->chtvtextenhance; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x03) * 6); + case CHRONTEL_701x: + return(int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x07) * 2); + default: + return -2; + } + } +} + +void SiS_SetCHTVcontrast(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->chtvcontrast = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->chtvcontrast = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_CHRONTEL)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + val /= 2; + if((val >= 0) && (val <= 7)) { + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 8) | 0x11),0xF8); + break; + case CHRONTEL_701x: + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((val << 8) | 0x08),0xF8); + break; + } + } +} + +int SiS_GetCHTVcontrast(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_CHRONTEL && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->chtvcontrast; + else +#endif + return (int)pSiS->chtvcontrast; + } else { +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + return(int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x11) & 0x07) * 2); + case CHRONTEL_701x: + return(int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x08) & 0x07) * 2); + default: + return -2; + } + } +} + +void SiS_SetSISTVedgeenhance(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->sistvedgeenhance = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->sistvedgeenhance = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_301)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + val /= 2; + if((val >= 0) && (val <= 7)) { + setSISIDXREG(SISPART2,0x3A, 0x1F, (val << 5)); + } +} + +int SiS_GetSISTVedgeenhance(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_301 && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->sistvedgeenhance; + else +#endif + return (int)pSiS->sistvedgeenhance; + } else { + unsigned char temp; +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + inSISIDXREG(SISPART2, 0x3a, temp); + return(int)(((temp & 0xe0) >> 5) * 2); + } +} + +void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->sistvantiflicker = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->sistvantiflicker = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + val /= 2; + if((val >= 0) && (val <= 7)) { + setSISIDXREG(SISPART2,0x0A,0x8F, (val << 4)); + } +} + +int SiS_GetSISTVantiflicker(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_SISBRIDGE && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->sistvantiflicker; + else +#endif + return (int)pSiS->sistvantiflicker; + } else { + unsigned char temp; +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + inSISIDXREG(SISPART2, 0x0a, temp); + return(int)(((temp & 0x70) >> 4) * 2); + } +} + +void SiS_SetSISTVsaturation(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + pSiS->sistvsaturation = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->sistvsaturation = val; +#endif + + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + val /= 2; + if((val >= 0) && (val <= 7)) { + setSISIDXREG(SISPART4,0x21,0xF8, val); + } +} + +int SiS_GetSISTVsaturation(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + + if(!(pSiS->VBFlags & VB_SISBRIDGE && pSiS->VBFlags & CRT2_TV)) { +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->sistvsaturation; + else +#endif + return (int)pSiS->sistvsaturation; + } else { + unsigned char temp; +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + inSISIDXREG(SISPART4, 0x21, temp); + return(int)((temp & 0x07) * 2); + } +} + +void SiS_SetSIS6326TVantiflicker(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + + pSiS->sis6326antiflicker = val; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) return; + + /* Valid values: 0=off, 1=low, 2=med, 3=high, 4=adaptive */ + if(val >= 0 && val <= 4) { + tmp &= 0x1f; + tmp |= (val << 5); + SiS6326SetTVReg(pScrn,0x00,tmp); + } +} + +int SiS_GetSIS6326TVantiflicker(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) { + return (int)pSiS->sis6326antiflicker; + } + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) { + return (int)pSiS->sis6326antiflicker; + } else { + return (int)((tmp >> 5) & 0x07); + } +} + +void SiS_SetSIS6326TVenableyfilter(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + + if(val) val = 1; + pSiS->sis6326enableyfilter = val; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) return; + + tmp = SiS6326GetTVReg(pScrn,0x43); + tmp &= ~0x10; + tmp |= ((val & 0x01) << 4); + SiS6326SetTVReg(pScrn,0x43,tmp); +} + +int SiS_GetSIS6326TVenableyfilter(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) { + return (int)pSiS->sis6326enableyfilter; + } + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) { + return (int)pSiS->sis6326enableyfilter; + } else { + tmp = SiS6326GetTVReg(pScrn,0x43); + return (int)((tmp >> 4) & 0x01); + } +} + +void SiS_SetSIS6326TVyfilterstrong(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + + if(val) val = 1; + pSiS->sis6326yfilterstrong = val; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) return; + + tmp = SiS6326GetTVReg(pScrn,0x43); + if(tmp & 0x10) { + tmp &= ~0x40; + tmp |= ((val & 0x01) << 6); + SiS6326SetTVReg(pScrn,0x43,tmp); + } +} + +int SiS_GetSIS6326TVyfilterstrong(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) { + return (int)pSiS->sis6326yfilterstrong; + } + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) { + return (int)pSiS->sis6326yfilterstrong; + } else { + tmp = SiS6326GetTVReg(pScrn,0x43); + if(!(tmp & 0x10)) { + return (int)pSiS->sis6326yfilterstrong; + } else { + return (int)((tmp >> 6) & 0x01); + } + } +} + +void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + pSiS->tvxpos = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->tvxpos = val; +#endif + + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { + + if(pSiS->VBFlags & CRT2_TV) { + + if(pSiS->VBFlags & VB_CHRONTEL) { + + int x = pSiS->tvx; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) x = pSiSEnt->tvx; +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + if((val >= -32) && (val <= 32)) { + x += val; + if(x < 0) x = 0; + SiS_SetCH700x(pSiS->SiS_Pr, (((x & 0xff) << 8) | 0x0a)); + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, (((x & 0x0100) << 1) | 0x08),0xFD); + } + break; + case CHRONTEL_701x: + /* TO DO */ + break; + } + + } else if(pSiS->VBFlags & VB_SISBRIDGE) { + + if((val >= -32) && (val <= 32)) { + unsigned char p2_1f,p2_2b,p2_2c,p2_2d,p2_43; + const unsigned char p2_left_ntsc[8][4] = { + { 0x48, 0x63, 0x49, 0xf4 }, + { 0x45, 0x60, 0x46, 0xf1 }, + { 0x43, 0x6e, 0x44, 0xff }, + { 0x40, 0x6b, 0x41, 0xfc }, + { 0x3e, 0x69, 0x3f, 0xfa }, + { 0x3c, 0x67, 0x3d, 0xf8 }, + { 0x39, 0x64, 0x3a, 0xf5 }, + { 0x37, 0x62, 0x38, 0xf3 } + }; + const unsigned char p2_right_ntsc[8][4] = { + { 0x4b, 0x66, 0x4c, 0xf7 }, + { 0x4c, 0x67, 0x4d, 0xf8 }, + { 0x4e, 0x69, 0x4f, 0xfa }, + { 0x4f, 0x6a, 0x50, 0xfb }, + { 0x51, 0x6c, 0x52, 0xfd }, + { 0x53, 0x6e, 0x54, 0xff }, + { 0x55, 0x60, 0x56, 0xf1 }, + { 0x56, 0x61, 0x57, 0xf2 } + }; + const unsigned char p2_left_pal[8][4] = { + { 0x5b, 0x66, 0x5c, 0x87 }, + { 0x59, 0x64, 0x5a, 0x85 }, + { 0x56, 0x61, 0x57, 0x82 }, + { 0x53, 0x6e, 0x54, 0x8f }, + { 0x50, 0x6b, 0x51, 0x8c }, + { 0x4d, 0x68, 0x4e, 0x89 }, + { 0x4a, 0x65, 0x4b, 0x86 }, + { 0x49, 0x64, 0x4a, 0x85 } + }; + const unsigned char p2_right_pal[8][4] = { + { 0x5f, 0x6a, 0x60, 0x8b }, + { 0x61, 0x6c, 0x62, 0x8d }, + { 0x63, 0x6e, 0x64, 0x8f }, + { 0x65, 0x60, 0x66, 0x81 }, + { 0x66, 0x61, 0x67, 0x82 }, + { 0x68, 0x63, 0x69, 0x84 }, + { 0x69, 0x64, 0x6a, 0x85 }, + { 0x6b, 0x66, 0x6c, 0x87 } + }; + val /= 4; + p2_2d = pSiS->p2_2d; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) p2_2d = pSiSEnt->p2_2d; +#endif + p2_2d &= 0xf0; + if(val < 0) { + val = -val; + if(val == 8) val = 7; + if(pSiS->VBFlags & TV_PAL) { + p2_1f = p2_left_pal[val][0]; + p2_2b = p2_left_pal[val][1]; + p2_2c = p2_left_pal[val][2]; + p2_2d |= (p2_left_pal[val][3] & 0x0f); + } else { + p2_1f = p2_left_ntsc[val][0]; + p2_2b = p2_left_ntsc[val][1]; + p2_2c = p2_left_ntsc[val][2]; + p2_2d |= (p2_left_ntsc[val][3] & 0x0f); + } + } else { + if(val == 8) val = 7; + if(pSiS->VBFlags & TV_PAL) { + p2_1f = p2_right_pal[val][0]; + p2_2b = p2_right_pal[val][1]; + p2_2c = p2_right_pal[val][2]; + p2_2d |= (p2_right_pal[val][3] & 0x0f); + } else { + p2_1f = p2_right_ntsc[val][0]; + p2_2b = p2_right_ntsc[val][1]; + p2_2c = p2_right_ntsc[val][2]; + p2_2d |= (p2_right_ntsc[val][3] & 0x0f); + } + } + p2_43 = p2_1f + 3; + SISWaitRetraceCRT2(pScrn); + outSISIDXREG(SISPART2,0x1f,p2_1f); + outSISIDXREG(SISPART2,0x2b,p2_2b); + outSISIDXREG(SISPART2,0x2c,p2_2c); + outSISIDXREG(SISPART2,0x2d,p2_2d); + outSISIDXREG(SISPART2,0x43,p2_43); + } + } + } + + } else if(pSiS->Chipset == PCI_CHIP_SIS6326) { + + if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) { + + unsigned char tmp; + unsigned short temp1, temp2, temp3; + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(tmp & 0x04) { + + temp1 = pSiS->tvx1; + temp2 = pSiS->tvx2; + temp3 = pSiS->tvx3; + if((val >= -16) && (val <= 16)) { + if(val > 0) { + temp1 += (val * 4); + temp2 += (val * 4); + while((temp1 > 0x0fff) || (temp2 > 0x0fff)) { + temp1 -= 4; + temp2 -= 4; + } + } else { + val = -val; + temp3 += (val * 4); + while(temp3 > 0x03ff) { + temp3 -= 4; + } + } + } + SiS6326SetTVReg(pScrn,0x3a,(temp1 & 0xff)); + tmp = SiS6326GetTVReg(pScrn,0x3c); + tmp &= 0xf0; + tmp |= ((temp1 & 0x0f00) >> 8); + SiS6326SetTVReg(pScrn,0x3c,tmp); + SiS6326SetTVReg(pScrn,0x26,(temp2 & 0xff)); + tmp = SiS6326GetTVReg(pScrn,0x27); + tmp &= 0x0f; + tmp |= ((temp2 & 0x0f00) >> 4); + SiS6326SetTVReg(pScrn,0x27,tmp); + SiS6326SetTVReg(pScrn,0x12,(temp3 & 0xff)); + tmp = SiS6326GetTVReg(pScrn,0x13); + tmp &= ~0xC0; + tmp |= ((temp3 & 0x0300) >> 2); + SiS6326SetTVReg(pScrn,0x13,tmp); + } + } + } +} + +int SiS_GetTVxposoffset(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; + + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->tvxpos; + else +#endif + return (int)pSiS->tvxpos; +} + +void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + pSiS->tvypos = val; +#ifdef SISDUALHEAD + if(pSiSEnt) pSiSEnt->tvypos = val; +#endif + + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { + + if(pSiS->VBFlags & CRT2_TV) { + + if(pSiS->VBFlags & VB_CHRONTEL) { + + int y = pSiS->tvy; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) y = pSiSEnt->tvy; +#endif + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + if((val >= -32) && (val <= 32)) { + y -= val; + if(y < 0) y = 0; + SiS_SetCH700x(pSiS->SiS_Pr, (((y & 0xff) << 8) | 0x0b)); + SiS_SetCH70xxANDOR(pSiS->SiS_Pr, ((y & 0x0100) | 0x08),0xFE); + } + break; + case CHRONTEL_701x: + /* TO DO */ + break; + } + + } else if(pSiS->VBFlags & VB_SISBRIDGE) { + + if((val >= -32) && (val <= 32)) { + char p2_01, p2_02; + val /= 4; + p2_01 = pSiS->p2_01; + p2_02 = pSiS->p2_02; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) { + p2_01 = pSiSEnt->p2_01; + p2_02 = pSiSEnt->p2_02; + } +#endif + p2_01 += (val * 2); + p2_02 += (val * 2); + while((p2_01 <= 0) || (p2_02 <= 0)) { + p2_01 += 2; + p2_02 += 2; + } + SISWaitRetraceCRT2(pScrn); + outSISIDXREG(SISPART2,0x01,p2_01); + outSISIDXREG(SISPART2,0x02,p2_02); + } + } + + } + + } else if(pSiS->Chipset == PCI_CHIP_SIS6326) { + + if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) { + + unsigned char tmp; + int temp1, limit; + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(tmp & 0x04) { + + if((val >= -16) && (val <= 16)) { + temp1 = (unsigned short)pSiS->tvy1; + limit = (pSiS->SiS6326Flags & SIS6326_TVPAL) ? 625 : 525; + if(val > 0) { + temp1 += (val * 4); + if(temp1 > limit) temp1 -= limit; + } else { + val = -val; + temp1 -= (val * 2); + if(temp1 <= 0) temp1 += (limit -1); + } + SiS6326SetTVReg(pScrn,0x11,(temp1 & 0xff)); + tmp = SiS6326GetTVReg(pScrn,0x13); + tmp &= ~0x30; + tmp |= ((temp1 & 0x300) >> 4); + SiS6326SetTVReg(pScrn,0x13,tmp); + if(temp1 == 1) tmp = 0x10; + else { + if(pSiS->SiS6326Flags & SIS6326_TVPAL) { + if((temp1 <= 3) || (temp1 >= (limit - 2))) tmp = 0x08; + else if(temp1 < 22) tmp = 0x02; + else tmp = 0x04; + } else { + if((temp1 <= 5) || (temp1 >= (limit - 4))) tmp = 0x08; + else if(temp1 < 19) tmp = 0x02; + else tmp = 0x04; + } + } + SiS6326SetTVReg(pScrn,0x21,tmp); + } + } + } + } +} + +int SiS_GetTVyposoffset(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; + + if(pSiSEnt && pSiS->DualHeadMode) + return (int)pSiSEnt->tvypos; + else +#endif + return (int)pSiS->tvypos; +} + +/* TW: Disable CRT1 for saving bandwidth. This doesn't work with VESA; + * VESA uses the bridge in SlaveMode and switching CRT1 off while the + * bridge is in SlaveMode not that clever... + */ +void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) { + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif + unsigned char usScratchCR17; + Bool flag = FALSE; + Bool doit = TRUE; + int temp; + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CRT1off is %d\n", pSiS->CRT1off); +#endif + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) { + + if(pSiS->VBFlags != pSiS->VBFlags_backup) { + pSiS->VBFlags = pSiS->VBFlags_backup; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VBFlags restored to %0lx\n", pSiS->VBFlags); + } + + /* TW: -) We can't switch off CRT1 if bridge is in SlaveMode. + * -) If we change to a SlaveMode-Mode (like 512x384), we + * need to adapt VBFlags for eg. Xv. + */ +#ifdef SISDUALHEAD + if(!pSiS->DualHeadMode) { +#endif + if(SiSBridgeIsInSlaveMode(pScrn)) { + doit = FALSE; + temp = pSiS->VBFlags; + pSiS->VBFlags &= (~VB_DISPMODE_SINGLE); + pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_DISP1); + if(temp != pSiS->VBFlags) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VBFlags changed to 0x%0lx\n", pSiS->VBFlags); + } + } +#ifdef SISDUALHEAD + } +#endif + if(doit) { + inSISIDXREG(SISCR, 0x17, usScratchCR17); + if(pSiS->CRT1off) { + if(usScratchCR17 & 0x80) flag = TRUE; + usScratchCR17 &= ~0x80; + } else { + if(!(usScratchCR17 & 0x80)) flag = TRUE; + usScratchCR17 |= 0x80; + } + outSISIDXREG(SISCR, 0x17, usScratchCR17); + /* TW: Reset only if status changed */ + if(flag) { + outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */ + usleep(10000); + outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */ + } + } + } + + /* TW: Apply TV settings given by options + Do this even in DualHeadMode: + - if this is called by SetModeCRT1, CRT2 mode has been reset by SetModeCRT1 + - if this is called by SetModeCRT2, CRT2 mode has changed (duh!) + -> In both cases, the settings must be re-applied. + */ + if(pSiS->VBFlags & CRT2_TV) { + int val; + if(pSiS->VBFlags & VB_CHRONTEL) { + int mychtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs; + int mychtvlumabandwidthsvideo = pSiS->chtvlumabandwidthsvideo; + int mychtvlumaflickerfilter = pSiS->chtvlumaflickerfilter; + int mychtvchromabandwidth = pSiS->chtvchromabandwidth; + int mychtvchromaflickerfilter = pSiS->chtvchromaflickerfilter; + int mychtvcvbscolor = pSiS->chtvcvbscolor; + int mychtvtextenhance = pSiS->chtvtextenhance; + int mychtvcontrast = pSiS->chtvcontrast; + int mytvxpos = pSiS->tvxpos; + int mytvypos = pSiS->tvypos; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) { + mychtvlumabandwidthcvbs = pSiSEnt->chtvlumabandwidthcvbs; + mychtvlumabandwidthsvideo = pSiSEnt->chtvlumabandwidthsvideo; + mychtvlumaflickerfilter = pSiSEnt->chtvlumaflickerfilter; + mychtvchromabandwidth = pSiSEnt->chtvchromabandwidth; + mychtvchromaflickerfilter = pSiSEnt->chtvchromaflickerfilter; + mychtvcvbscolor = pSiSEnt->chtvcvbscolor; + mychtvtextenhance = pSiSEnt->chtvtextenhance; + mychtvcontrast = pSiSEnt->chtvcontrast; + mytvxpos = pSiSEnt->tvxpos; + mytvypos = pSiSEnt->tvypos; + } +#endif + if((val = mychtvlumabandwidthcvbs) != -1) { + SiS_SetCHTVlumabandwidthcvbs(pScrn, val); + } + if((val = mychtvlumabandwidthsvideo) != -1) { + SiS_SetCHTVlumabandwidthsvideo(pScrn, val); + } + if((val = mychtvlumaflickerfilter) != -1) { + SiS_SetCHTVlumaflickerfilter(pScrn, val); + } + if((val = mychtvchromabandwidth) != -1) { + SiS_SetCHTVchromabandwidth(pScrn, val); + } + if((val = mychtvchromaflickerfilter) != -1) { + SiS_SetCHTVchromaflickerfilter(pScrn, val); + } + if((val = mychtvcvbscolor) != -1) { + SiS_SetCHTVcvbscolor(pScrn, val); + } + if((val = mychtvtextenhance) != -1) { + SiS_SetCHTVtextenhance(pScrn, val); + } + if((val = mychtvcontrast) != -1) { + SiS_SetCHTVcontrast(pScrn, val); + } + /* Backup default TV position registers */ + switch(pSiS->ChrontelType) { + case CHRONTEL_700x: + pSiS->tvx = SiS_GetCH700x(pSiS->SiS_Pr, 0x0a); + pSiS->tvx |= (((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x02) >> 1) << 8); + pSiS->tvy = SiS_GetCH700x(pSiS->SiS_Pr, 0x0b); + pSiS->tvy |= ((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x01) << 8); +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) { + pSiSEnt->tvx = pSiS->tvx; + pSiSEnt->tvy = pSiS->tvy; + } +#endif + break; + case CHRONTEL_701x: + /* TO DO */ + break; + } + if((val = mytvxpos) != 0) { + SiS_SetTVxposoffset(pScrn, val); + } + if((val = mytvypos) != 0) { + SiS_SetTVyposoffset(pScrn, val); + } + } + if(pSiS->VBFlags & VB_301) { + int mysistvedgeenhance = pSiS->sistvedgeenhance; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) { + mysistvedgeenhance = pSiSEnt->sistvedgeenhance; + } +#endif + if((val = mysistvedgeenhance) != -1) { + SiS_SetSISTVedgeenhance(pScrn, val); + } + } + if(pSiS->VBFlags & VB_SISBRIDGE) { + int mysistvantiflicker = pSiS->sistvantiflicker; + int mysistvsaturation = pSiS->sistvsaturation; + int mytvxpos = pSiS->tvxpos; + int mytvypos = pSiS->tvypos; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) { + mysistvantiflicker = pSiSEnt->sistvantiflicker; + mysistvsaturation = pSiSEnt->sistvsaturation; + mytvxpos = pSiSEnt->tvxpos; + mytvypos = pSiSEnt->tvypos; + } +#endif + /* Backup default TV position registers */ + inSISIDXREG(SISPART2,0x2d,pSiS->p2_2d); + inSISIDXREG(SISPART2,0x01,pSiS->p2_01); + inSISIDXREG(SISPART2,0x02,pSiS->p2_02); +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) { + pSiSEnt->p2_2d = pSiS->p2_2d; + pSiSEnt->p2_01 = pSiS->p2_01; + pSiSEnt->p2_02 = pSiS->p2_02; + } +#endif + if((val = mysistvantiflicker) != -1) { + SiS_SetSISTVantiflicker(pScrn, val); + } + if((val = mysistvsaturation) != -1) { + SiS_SetSISTVsaturation(pScrn, val); + } + if((val = mytvxpos) != 0) { + SiS_SetTVxposoffset(pScrn, val); + } + if((val = mytvypos) != 0) { + SiS_SetTVyposoffset(pScrn, val); + } + } + } + +} + +/* Post-set SiS6326 TV registers */ +void SiS6326PostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char tmp; + int val; + + if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return; + +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + + /* Backup default TV position registers */ + pSiS->tvx1 = SiS6326GetTVReg(pScrn,0x3a); + pSiS->tvx1 |= ((SiS6326GetTVReg(pScrn,0x3c) & 0x0f) << 8); + pSiS->tvx2 = SiS6326GetTVReg(pScrn,0x26); + pSiS->tvx2 |= ((SiS6326GetTVReg(pScrn,0x27) & 0xf0) << 4); + pSiS->tvx3 = SiS6326GetTVReg(pScrn,0x12); + pSiS->tvx3 |= ((SiS6326GetTVReg(pScrn,0x13) & 0xC0) << 2); + pSiS->tvy1 = SiS6326GetTVReg(pScrn,0x11); + pSiS->tvy1 |= ((SiS6326GetTVReg(pScrn,0x13) & 0x30) << 4); + + /* TW: Handle TVPosOffset options (BEFORE switching on TV) */ + if((val = pSiS->tvxpos) != 0) { + SiS_SetTVxposoffset(pScrn, val); + } + if((val = pSiS->tvypos) != 0) { + SiS_SetTVyposoffset(pScrn, val); + } + + /* TW: Switch on TV output. This is rather complicated, but + * if we don't do it, TV output will flicker terribly. + */ + if(pSiS->SiS6326Flags & SIS6326_TVON) { + orSISIDXREG(SISSR, 0x01, 0x20); + tmp = SiS6326GetTVReg(pScrn,0x00); + tmp &= ~0x04; + while(!(inSISREG(SISINPSTAT) & 0x08)); /* Wait while NOT vb */ + SiS6326SetTVReg(pScrn,0x00,tmp); + for(val=0; val < 2; val++) { + while(!(inSISREG(SISINPSTAT) & 0x08)); /* Wait while NOT vb */ + while(inSISREG(SISINPSTAT) & 0x08); /* wait while vb */ + } + SiS6326SetTVReg(pScrn, 0x00, sisReg->sis6326tv[0]); + tmp = inSISREG(SISINPSTAT); + outSISREG(SISAR, 0x20); + tmp = inSISREG(SISINPSTAT); + while(inSISREG(SISINPSTAT) & 0x01); + while(!(inSISREG(SISINPSTAT) & 0x01)); + andSISIDXREG(SISSR, 0x01, ~0x20); + for(val=0; val < 10; val++) { + while(!(inSISREG(SISINPSTAT) & 0x08)); /* Wait while NOT vb */ + while(inSISREG(SISINPSTAT) & 0x08); /* wait while vb */ + } + andSISIDXREG(SISSR, 0x01, ~0x20); + } + + tmp = SiS6326GetTVReg(pScrn,0x00); + if(!(tmp & 0x04)) return; + + /* TW: Apply TV settings given by options */ + if((val = pSiS->sis6326antiflicker) != -1) { + SiS_SetSIS6326TVantiflicker(pScrn, val); + } + if((val = pSiS->sis6326enableyfilter) != -1) { + SiS_SetSIS6326TVenableyfilter(pScrn, val); + } + if((val = pSiS->sis6326yfilterstrong) != -1) { + SiS_SetSIS6326TVyfilterstrong(pScrn, val); + } + +} + +/* Check if video bridge is in slave mode */ +BOOLEAN +SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char usScratchP1_00; + + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return FALSE; + + inSISIDXREG(SISPART1,0x00,usScratchP1_00); + if( ((pSiS->VGAEngine == SIS_300_VGA) && (usScratchP1_00 & 0xa0) == 0x20) || + ((pSiS->VGAEngine == SIS_315_VGA) && (usScratchP1_00 & 0x50) == 0x10) ) { + return TRUE; + } else { + return FALSE; + } +} + +/* TW: Build a list of the VESA modes the BIOS reports as valid */ +static void +SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe) +{ + SISPtr pSiS = SISPTR(pScrn); int i = 0; - while (vbe->VideoModePtr[i] != 0xffff) { + + while(vbe->VideoModePtr[i] != 0xffff) { sisModeInfoPtr m; VbeModeInfoBlock *mode; int id = vbe->VideoModePtr[i++]; @@ -2354,37 +7313,37 @@ continue; bpp = mode->BitsPerPixel; - /* TW: Doesn't work on SiS630 VBE 3.0: */ - /* mode->GreenMaskSize + mode->BlueMaskSize - + mode->RedMaskSize; */ m = xnfcalloc(sizeof(sisModeInfoRec),1); m->width = mode->XResolution; m->height = mode->YResolution; m->bpp = bpp; m->n = id; - m->next = SISVesaModeList; + m->next = pSiS->SISVESAModeList; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", m->n, m->width, m->height, m->bpp); - SISVesaModeList = m; + pSiS->SISVESAModeList = m; VBEFreeModeInfo(mode); } } -static UShort CalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +/* TW: Calc VESA mode from given resolution/depth */ +static UShort +SiSCalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) { - sisModeInfoPtr m = SISVesaModeList; - UShort i = (pScrn->bitsPerPixel+7)/8 - 1; /* bitsperpixel was depth */ + SISPtr pSiS = SISPTR(pScrn); + sisModeInfoPtr m = pSiS->SISVESAModeList; + UShort i = (pScrn->bitsPerPixel+7)/8 - 1; UShort ModeIndex = 0; - while (m) { - if (pScrn->bitsPerPixel == m->bpp - && mode->HDisplay == m->width - && mode->VDisplay == m->height) + while(m) { + if(pScrn->bitsPerPixel == m->bpp && + mode->HDisplay == m->width && + mode->VDisplay == m->height) return m->n; m = m->next; } @@ -2393,99 +7352,297 @@ "No valid BIOS VESA mode found for %dx%dx%d; searching built-in table.\n", mode->HDisplay, mode->VDisplay, pScrn->bitsPerPixel); - switch(mode->HDisplay) - { - case 640: - ModeIndex = VESAModeIndex_640x480[i]; + switch(mode->HDisplay) { + case 512: + if(mode->VDisplay == 384) + ModeIndex = VESAModeIndex_512x384[i]; break; - case 720: + case 640: if(mode->VDisplay == 480) - ModeIndex = VESAModeIndex_720x480[i]; - else - ModeIndex = VESAModeIndex_720x576[i]; + ModeIndex = VESAModeIndex_640x480[i]; break; - case 800: - ModeIndex = VESAModeIndex_800x600[i]; + case 800: + if(mode->VDisplay == 600) + ModeIndex = VESAModeIndex_800x600[i]; break; - case 1024: - ModeIndex = VESAModeIndex_1024x768[i]; + case 1024: + if(mode->VDisplay == 768) + ModeIndex = VESAModeIndex_1024x768[i]; break; - case 1280: - ModeIndex = VESAModeIndex_1280x1024[i]; + case 1280: + if(mode->VDisplay == 1024) + ModeIndex = VESAModeIndex_1280x1024[i]; break; - case 1600: - ModeIndex = VESAModeIndex_1600x1200[i]; + case 1600: + if(mode->VDisplay == 1200) + ModeIndex = VESAModeIndex_1600x1200[i]; break; - case 1920: - ModeIndex = VESAModeIndex_1920x1440[i]; + case 1920: + if(mode->VDisplay == 1440) + ModeIndex = VESAModeIndex_1920x1440[i]; break; } - if (!ModeIndex) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "No valid mode found for %dx%dx%d in built-in table either.", + if(!ModeIndex) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "No valid mode found for %dx%dx%d in built-in table either.\n", mode->HDisplay, mode->VDisplay, pScrn->bitsPerPixel); return(ModeIndex); } -/* TW: Calculate CR33 (rate index) for CRT1 if CRT2 is disabled. - Calculation is done using currentmode structure, therefore - it is recommended to set VertRefresh and HorizSync to correct - values in Config file. - */ -unsigned char SISSearchCRT1Rate(DisplayModePtr mode) +/* TW: Calculate the vertical refresh rate from a mode */ +int +SiSCalcVRate(DisplayModePtr mode) { float hsync, refresh = 0; - int i = 0; - unsigned short xres=mode->HDisplay; - unsigned short yres=mode->VDisplay; - unsigned char index; - if (mode->HSync > 0.0) + if(mode->HSync > 0.0) hsync = mode->HSync; - else if (mode->HTotal > 0) + else if(mode->HTotal > 0) hsync = (float)mode->Clock / (float)mode->HTotal; else hsync = 0.0; - if (mode->VTotal > 0) + + if(mode->VTotal > 0) refresh = hsync * 1000.0 / mode->VTotal; - if (mode->Flags & V_INTERLACE) { + + if(mode->Flags & V_INTERLACE) refresh *= 2.0; - } - if (mode->Flags & V_DBLSCAN) { + + if(mode->Flags & V_DBLSCAN) refresh /= 2.0; - } - if (mode->VScan > 1) { + + if(mode->VScan > 1) refresh /= mode->VScan; - } - if (mode->VRefresh > 0.0) + + if(mode->VRefresh > 0.0) refresh = mode->VRefresh; - if (hsync == 0 || refresh == 0) - return 0x02; /* TW: Default mode index */ - else { - index = 0; - while ((sisx_vrate[i].idx != 0) && (sisx_vrate[i].xres <= xres)) { - if ((sisx_vrate[i].xres == xres) - && (sisx_vrate[i].yres == yres)) { - if (sisx_vrate[i].refresh == refresh) { - index = sisx_vrate[i].idx; - break; - } else if (sisx_vrate[i].refresh > refresh) { - if ((sisx_vrate[i].refresh - refresh) <= 2) { - index = sisx_vrate[i].idx; - } else if (((refresh - sisx_vrate[i - 1].refresh) <= 2) - && (sisx_vrate[i].idx != 1)) { - index = sisx_vrate[i - 1].idx; - } - break; + + if(hsync == 0 || refresh == 0) return(0); + + return((int)(refresh)); +} + +/* TW: Calculate CR33 (rate index) for CRT1. + * Calculation is done using currentmode, therefore it is + * recommended to set VertRefresh and HorizSync to correct + * values in config file. + */ +unsigned char +SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + SISPtr pSiS = SISPTR(pScrn); + int i = 0; + int irefresh; + unsigned short xres = mode->HDisplay; + unsigned short yres = mode->VDisplay; + unsigned char index; + BOOLEAN checksis730 = FALSE; + + irefresh = SiSCalcVRate(mode); + if(!irefresh) { + if(xres == 800 || xres == 1024 || xres == 1280) return 0x02; + else return 0x01; + } + + /* SiS730 has troubles on CRT2 if CRT1 is at 32bpp */ + if( (pSiS->sishw_ext.jChipType == SIS_730) && + (pSiS->VBFlags & VB_VIDEOBRIDGE) && + (pSiS->CurrentLayout.bitsPerPixel == 32) ) { +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + checksis730 = TRUE; + } + } else +#endif + if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE) && (!pSiS->CRT1off)) { + checksis730 = TRUE; + } + } + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Debug: CalcVRate returned %d\n", irefresh); +#endif + + /* We need the REAL refresh rate here */ + if(mode->Flags & V_INTERLACE) + irefresh /= 2; + + /* Do not multiply by 2 when DBLSCAN! */ + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Debug: Rate after correction = %d\n", irefresh); +#endif + + index = 0; + while((sisx_vrate[i].idx != 0) && (sisx_vrate[i].xres <= xres)) { + if((sisx_vrate[i].xres == xres) && (sisx_vrate[i].yres == yres)) { + if((checksis730 == FALSE) || (sisx_vrate[i].SiS730valid32bpp == TRUE)) { + if(sisx_vrate[i].refresh == irefresh) { + index = sisx_vrate[i].idx; + break; + } else if(sisx_vrate[i].refresh > irefresh) { + if((sisx_vrate[i].refresh - irefresh) <= 3) { + index = sisx_vrate[i].idx; + } else if( ((checksis730 == FALSE) || (sisx_vrate[i - 1].SiS730valid32bpp == TRUE)) && + ((irefresh - sisx_vrate[i - 1].refresh) <= 2) && + (sisx_vrate[i].idx != 1) ) { + index = sisx_vrate[i - 1].idx; + } + break; + } } } i++; - } - if (index > 0) + } + if(index > 0) return index; - else - return 0x02; /* TW: Default Rate index */ + else { + /* TW: Default Rate index */ + if(xres == 800 || xres == 1024 || xres == 1280) return 0x02; + else return 0x01; + } +} + +void +SISWaitRetraceCRT1(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int watchdog; + unsigned char temp; + + inSISIDXREG(SISCR,0x17,temp); + if(!(temp & 0x80)) return; + + watchdog = 65536; + while((!(inSISREG(SISINPSTAT) & 0x08)) && --watchdog); + watchdog = 65536; + while((inSISREG(SISINPSTAT) & 0x08) && --watchdog); +} + +void +SISWaitRetraceCRT2(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int watchdog; + unsigned char temp, reg; + + switch(pSiS->VGAEngine) { + case SIS_300_VGA: + reg = 0x28; + break; + case SIS_315_VGA: + reg = 0x33; + break; + default: + return; } + + watchdog = 65536; + do { + inSISIDXREG(SISPART1, reg, temp); + if(temp & 0x80) break; + } while(--watchdog); + watchdog = 65536; + do { + inSISIDXREG(SISPART1, reg, temp); + if(!(temp & 0x80)) break; + } while(--watchdog); +} + +static void +SISWaitVBRetrace(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) + SISWaitRetraceCRT1(pScrn); + else + SISWaitRetraceCRT2(pScrn); + } else { +#endif + if(pSiS->VBFlags & DISPTYPE_DISP1) { + SISWaitRetraceCRT1(pScrn); + } + if(pSiS->VBFlags & DISPTYPE_DISP2) { + if(!(SiSBridgeIsInSlaveMode(pScrn))) { + SISWaitRetraceCRT2(pScrn); + } + } +#ifdef SISDUALHEAD + } +#endif +} + +void +sisSaveUnlockExtRegisterLock(SISPtr pSiS, unsigned char *reg1, unsigned char *reg2) +{ + register unsigned char val; + unsigned long mylockcalls; + + pSiS->lockcalls++; + mylockcalls = pSiS->lockcalls; + + /* check if already unlocked */ + inSISIDXREG(SISSR, 0x05, val); + if(val != 0xa1) { + /* save State */ + if(reg1) *reg1 = val; + /* unlock */ + outSISIDXREG(SISSR, 0x05, 0x86); + inSISIDXREG(SISSR, 0x05, val); + if(val != 0xA1) { +#ifdef TWDEBUG + unsigned char val1, val2; + int i; +#endif + xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR, + "Failed to unlock sr registers (%p, %x, 0x%02x; %d)\n", + pSiS, pSiS->RelIO, val, mylockcalls); +#ifdef TWDEBUG + for(i = 0; i <= 0x3f; i++) { + inSISIDXREG(SISSR, i, val1); + inSISIDXREG(0x3c4, i, val2); + xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO, + "SR%02d: RelIO=0x%02x 0x3c4=0x%02x (%d)\n", i, val1, val2, mylockcalls); + } +#endif + if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) { + /* Emergency measure: unlock at 0x3c4, and try to enable Relocated IO ports */ + outSISIDXREG(0x3c4,0x05,0x86); + andSISIDXREG(0x3c4,0x33,~0x20); + outSISIDXREG(SISSR, 0x05, 0x86); + } + } + } + if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) { + inSISIDXREG(SISCR, 0x80, val); + if(val != 0xa1) { + /* save State */ + if(reg2) *reg2 = val; + outSISIDXREG(SISCR, 0x80, 0x86); + inSISIDXREG(SISCR, 0x80, val); + if(val != 0xA1) { + xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR, + "Failed to unlock cr registers (%p, %x, 0x%02x)\n", + pSiS, pSiS->RelIO, val); + } + } + } +} + +void +sisRestoreExtRegisterLock(SISPtr pSiS, unsigned char reg1, unsigned char reg2) +{ + /* restore lock */ +#ifndef UNLOCK_ALWAYS + outSISIDXREG(SISSR, 0x05, reg1 == 0xA1 ? 0x86 : 0x00); + if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) { + outSISIDXREG(SISCR, 0x80, reg2 == 0xA1 ? 0x86 : 0x00); + } +#endif } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h:1.7 --- /dev/null Thu Feb 27 12:31:39 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h Mon Feb 3 21:44:29 2003 @@ -0,0 +1,512 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.7 2003/02/04 02:44:29 dawes Exp $ */ +/* + * sis_driver.h + * + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holder makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net>: + * - 310/325 series (315/550/650/651/740/M650) support + * - new mode switching code for 300 and 310/325 series + * - many fixes for 300/540/630/730 chipsets, + * - many fixes for 5597/5598, 6326 and 530/620 chipsets, + * - VESA mode switching (deprecated), + * - extended CRT2/video bridge handling support, + * - dual head support on 300 and 310/325 series + * - 650/LVDS (up to 1400x1050), 650/Chrontel 701x support + * - 30xB/30xLV/30xLVX video bridge support (300, 310/325 series) + * - Xv support for 5597/5598, 6326, 530/620 and 310/325 series + * - video overlay enhancements for 300 series + * - etc. + */ + +/* VESA */ +/* TW: The following is included because there are BIOSes out there that + * report incomplete mode lists. These are 630 BIOS versions <2.01.2x + * + * -) VBE 3.0 on SiS300 and 310/325 series do not support 24 fpp modes + * -) Only SiS310/325 series support 1920x1440x32 + */ + /* 8 16 (24) 32 */ +static const UShort VESAModeIndex_512x384[] = {0x134, 0x137, 0x000, 0x000}; +static const UShort VESAModeIndex_640x480[] = {0x101, 0x111, 0x000, 0x13a}; +static const UShort VESAModeIndex_800x600[] = {0x103, 0x114, 0x000, 0x13b}; +static const UShort VESAModeIndex_1024x768[] = {0x105, 0x117, 0x000, 0x13c}; +static const UShort VESAModeIndex_1280x1024[] = {0x107, 0x11a, 0x000, 0x13d}; +static const UShort VESAModeIndex_1600x1200[] = {0x130, 0x131, 0x000, 0x13e}; +static const UShort VESAModeIndex_1920x1440[] = {0x13f, 0x140, 0x000, 0x141}; + +/* TW: For calculating refresh rate index (CR33) */ +static const struct _sis_vrate { + CARD16 idx; + CARD16 xres; + CARD16 yres; + CARD16 refresh; + BOOLEAN SiS730valid32bpp; +} sisx_vrate[] = { + {1, 512, 384, 60, TRUE}, + {1, 640, 400, 72, TRUE}, + {1, 640, 480, 60, TRUE}, {2, 640, 480, 72, TRUE}, {3, 640, 480, 75, TRUE}, + {4, 640, 480, 85, TRUE}, {5, 640, 480, 100, TRUE}, {6, 640, 480, 120, TRUE}, + {7, 640, 480, 160, TRUE}, {8, 640, 480, 200, TRUE}, + {1, 720, 480, 60, TRUE}, + {1, 720, 576, 58, TRUE}, + {1, 800, 480, 60, TRUE}, {2, 800, 480, 75, TRUE}, {3, 800, 480, 85, TRUE}, + {1, 800, 600, 56, TRUE}, {2, 800, 600, 60, TRUE}, {3, 800, 600, 72, TRUE}, + {4, 800, 600, 75, TRUE}, {5, 800, 600, 85, TRUE}, {6, 800, 600, 105, TRUE}, + {7, 800, 600, 120, TRUE}, {8, 800, 600, 160, TRUE}, + {1, 848, 480, 39, TRUE}, {2, 848, 480, 60, TRUE}, + {1, 856, 480, 39, TRUE}, {2, 856, 480, 60, TRUE}, + {1, 1024, 768, 43, TRUE}, {2, 1024, 768, 60, TRUE}, {3, 1024, 768, 70, FALSE}, + {4, 1024, 768, 75, FALSE}, {5, 1024, 768, 85, TRUE}, {6, 1024, 768, 100, TRUE}, + {7, 1024, 768, 120, TRUE}, + {1, 1024, 576, 60, TRUE}, {2, 1024, 576, 75, TRUE}, {3, 1024, 576, 85, TRUE}, + {1, 1024, 600, 60, TRUE}, + {1, 1152, 768, 60, TRUE}, + {1, 1152, 864, 75, TRUE}, {2, 1152, 864, 84, TRUE}, + {1, 1280, 720, 60, TRUE}, {2, 1280, 720, 75, TRUE}, {3, 1280, 720, 85, TRUE}, + {1, 1280, 768, 60, TRUE}, + {1, 1280, 1024, 43, TRUE}, {2, 1280, 1024, 60, TRUE}, {3, 1280, 1024, 75, TRUE}, + {4, 1280, 1024, 85, TRUE}, + {1, 1280, 960, 60, TRUE}, {2, 1280, 960, 85, TRUE}, + {1, 1360, 768, 60, TRUE}, + {1, 1400, 1050, 60, TRUE}, {2, 1400, 1050, 75, TRUE}, + {1, 1600, 1200, 60, TRUE}, {2, 1600, 1200, 65, TRUE}, {3, 1600, 1200, 70, TRUE}, + {4, 1600, 1200, 75, TRUE}, {5, 1600, 1200, 85, TRUE}, {6, 1600, 1200, 100, TRUE}, + {7, 1600, 1200, 120, TRUE}, + {1, 1920, 1440, 60, TRUE}, {2, 1920, 1440, 65, TRUE}, {3, 1920, 1440, 70, TRUE}, + {4, 1920, 1440, 75, TRUE}, {5, 1920, 1440, 85, TRUE}, {6, 1920, 1440, 100, TRUE}, + {1, 2048, 1536, 60, TRUE}, {2, 2048, 1536, 65, TRUE}, {3, 2048, 1536, 70, TRUE}, + {4, 2048, 1536, 75, TRUE}, {5, 2048, 1536, 85, TRUE}, + {0, 0, 0, 0, FALSE} +}; + +/* TW: Some 300-series laptops have a badly designed BIOS and make it + * impossible to detect the correct panel delay compensation. This + * table used to detect such machines by their PCI subsystem IDs; + * however, I don't know how reliable this method is. (With Asus + * machines, it is to general, ASUS uses the same ID for different + * boxes) + */ +static const pdctable mypdctable[] = { + { 0x1071, 0x7522, 32, "Mitac", "7521T" }, + { 0, 0, 0, "" , "" } +}; + +static const chswtable mychswtable[] = { + { 0x1631, 0x1002, "Mitachi", "0x1002" }, + { 0, 0, "" , "" } +}; + +/* TW: Our TV modes for the 6326. The data in these structures + * is mainly correct, but since we use our private CR and + * clock values anyway, small errors do no matter. + */ +static DisplayModeRec SiS6326PAL800x600Mode = { + NULL, NULL, /* prev, next */ + "PAL800x600", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 36000, /* Clock frequency */ + 800, /* HDisplay */ + 848, /* HSyncStart */ + 912, /* HSyncEnd */ + 1008, /* HTotal */ + 0, /* HSkew */ + 600, /* VDisplay */ + 600, /* VSyncStart */ + 602, /* VSyncEnd */ + 625, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 36000, /* SynthClock */ + 800, /* CRTC HDisplay */ + 808, /* CRTC HBlankStart */ + 848, /* CRTC HSyncStart */ + 912, /* CRTC HSyncEnd */ + 1008, /* CRTC HBlankEnd */ + 1008, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 600, /* CRTC VDisplay */ + 600, /* CRTC VBlankStart */ + 600, /* CRTC VSyncStart */ + 602, /* CRTC VSyncEnd */ + 625, /* CRTC VBlankEnd */ + 625, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +/* TW: Due to the scaling method this mode uses, the vertical data here + * does not match the CR data. But this does not matter, we use our + * private CR data anyway. + */ +static DisplayModeRec SiS6326PAL800x600UMode = { + NULL, /* prev */ + &SiS6326PAL800x600Mode, /* next */ + "PAL800x600U", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 37120, /* Clock frequency */ + 800, /* HDisplay */ + 872, /* HSyncStart */ + 984, /* HSyncEnd */ + 1088, /* HTotal */ + 0, /* HSkew */ + 600, /* VDisplay (548 due to scaling) */ + 600, /* VSyncStart (584) */ + 602, /* VSyncEnd (586) */ + 625, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 37120, /* SynthClock */ + 800, /* CRTC HDisplay */ + 808, /* CRTC HBlankStart */ + 872, /* CRTC HSyncStart */ + 984, /* CRTC HSyncEnd */ + 1024, /* CRTC HBlankEnd */ + 1088, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 600, /* CRTC VDisplay (548 due to scaling) */ + 600, /* CRTC VBlankStart (600) */ + 600, /* CRTC VSyncStart (584) */ + 602, /* CRTC VSyncEnd (586) */ + 625, /* CRTC VBlankEnd */ + 625, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +static DisplayModeRec SiS6326PAL720x540Mode = { + NULL, /* prev */ + &SiS6326PAL800x600UMode, /* next */ + "PAL720x540", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 36000, /* Clock frequency */ + 720, /* HDisplay */ + 816, /* HSyncStart */ + 920, /* HSyncEnd */ + 1008, /* HTotal */ + 0, /* HSkew */ + 540, /* VDisplay */ + 578, /* VSyncStart */ + 580, /* VSyncEnd */ + 625, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 36000, /* SynthClock */ + 720, /* CRTC HDisplay */ + 736, /* CRTC HBlankStart */ + 816, /* CRTC HSyncStart */ + 920, /* CRTC HSyncEnd */ + 1008, /* CRTC HBlankEnd */ + 1008, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 540, /* CRTC VDisplay */ + 577, /* CRTC VBlankStart */ + 578, /* CRTC VSyncStart */ + 580, /* CRTC VSyncEnd */ + 625, /* CRTC VBlankEnd */ + 625, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +static DisplayModeRec SiS6326PAL640x480Mode = { + NULL, /* prev */ + &SiS6326PAL720x540Mode, /* next */ + "PAL640x480", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 36000, /* Clock frequency */ + 640, /* HDisplay */ + 768, /* HSyncStart */ + 920, /* HSyncEnd */ + 1008, /* HTotal */ + 0, /* HSkew */ + 480, /* VDisplay */ + 532, /* VSyncStart */ + 534, /* VSyncEnd */ + 625, /* VTotal */ + 0, /* VScan */ + V_NHSYNC | V_NVSYNC, /* Flags */ + -1, /* ClockIndex */ + 36000, /* SynthClock */ + 640, /* CRTC HDisplay */ + 648, /* CRTC HBlankStart */ + 768, /* CRTC HSyncStart */ + 920, /* CRTC HSyncEnd */ + 944, /* CRTC HBlankEnd */ + 1008, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 480, /* CRTC VDisplay */ + 481, /* CRTC VBlankStart */ + 532, /* CRTC VSyncStart */ + 534, /* CRTC VSyncEnd */ + 561, /* CRTC VBlankEnd */ + 625, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +static DisplayModeRec SiS6326NTSC640x480Mode = { + NULL, NULL, /* prev, next */ + "NTSC640x480", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 27000, /* Clock frequency */ + 640, /* HDisplay */ + 664, /* HSyncStart */ + 760, /* HSyncEnd */ + 800, /* HTotal */ + 0, /* HSkew */ + 480, /* VDisplay */ + 489, /* VSyncStart */ + 491, /* VSyncEnd */ + 525, /* VTotal */ + 0, /* VScan */ + V_NHSYNC | V_NVSYNC, /* Flags */ + -1, /* ClockIndex */ + 27000, /* SynthClock */ + 640, /* CRTC HDisplay */ + 648, /* CRTC HBlankStart */ + 664, /* CRTC HSyncStart */ + 760, /* CRTC HSyncEnd */ + 792, /* CRTC HBlankEnd */ + 800, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 480, /* CRTC VDisplay */ + 488, /* CRTC VBlankStart */ + 489, /* CRTC VSyncStart */ + 491, /* CRTC VSyncEnd */ + 517, /* CRTC VBlankEnd */ + 525, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +/* TW: Due to the scaling method this mode uses, the vertical data here + * does not match the CR data. But this does not matter, we use our + * private CR data anyway. + */ +static DisplayModeRec SiS6326NTSC640x480UMode = { + NULL, /* prev */ + &SiS6326NTSC640x480Mode, /* next */ + "NTSC640x480U", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 32215, /* Clock frequency */ + 640, /* HDisplay */ + 696, /* HSyncStart */ + 840, /* HSyncEnd */ + 856, /* HTotal */ + 0, /* HSkew */ + 480, /* VDisplay (439 due to scaling) */ + 489, /* VSyncStart (473) */ + 491, /* VSyncEnd (475) */ + 525, /* VTotal */ + 0, /* VScan */ + V_NHSYNC | V_NVSYNC, /* Flags */ + -1, /* ClockIndex */ + 32215, /* SynthClock */ + 640, /* CRTC HDisplay */ + 656, /* CRTC HBlankStart */ + 696, /* CRTC HSyncStart */ + 840, /* CRTC HSyncEnd */ + 856, /* CRTC HBlankEnd */ + 856, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 480, /* CRTC VDisplay */ + 488, /* CRTC VBlankStart */ + 489, /* CRTC VSyncStart */ + 491, /* CRTC VSyncEnd */ + 517, /* CRTC VBlankEnd */ + 525, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + + +static DisplayModeRec SiS6326NTSC640x400Mode = { + NULL, /* prev */ + &SiS6326NTSC640x480UMode, /* next */ + "NTSC640x400", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 27000, /* Clock frequency */ + 640, /* HDisplay */ + 664, /* HSyncStart */ + 760, /* HSyncEnd */ + 800, /* HTotal */ + 0, /* HSkew */ + 400, /* VDisplay */ + 459, /* VSyncStart */ + 461, /* VSyncEnd */ + 525, /* VTotal */ + 0, /* VScan */ + V_NHSYNC | V_NVSYNC, /* Flags */ + -1, /* ClockIndex */ + 27000, /* SynthClock */ + 640, /* CRTC HDisplay */ + 648, /* CRTC HBlankStart */ + 664, /* CRTC HSyncStart */ + 760, /* CRTC HSyncEnd */ + 792, /* CRTC HBlankEnd */ + 800, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 400, /* CRTC VDisplay */ + 407, /* CRTC VBlankStart */ + 459, /* CRTC VSyncStart */ + 461, /* CRTC VSyncEnd */ + 490, /* CRTC VBlankEnd */ + 525, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +/* TW: Built-in hi-res modes for the 6326. + * For some reason, our default mode lines and the + * clock calculation functions in sis_dac.c do no + * good job on higher clocks. It seems, the hardware + * needs some tricks so make mode with higher clock + * rates than ca. 120MHz work. I didn't bother trying + * to find out what exactly is going wrong, so I + * implemented two special modes instead for 1280x1024 + * and 1600x1200. These two are automatically added + * to the list if they are supported with the current + * depth. + * The data in the strucures below is a proximation, + * in sis_vga.c the register contents are fetched from + * fixed tables anyway. + */ +static DisplayModeRec SiS6326SIS1280x1024_75Mode = { + NULL, /* prev */ + NULL, /* next */ + "SIS1280x1024-75", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 135000, /* Clock frequency */ + 1280, /* HDisplay */ + 1296, /* HSyncStart */ + 1440, /* HSyncEnd */ + 1688, /* HTotal */ + 0, /* HSkew */ + 1024, /* VDisplay */ + 1025, /* VSyncStart */ + 1028, /* VSyncEnd */ + 1066, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 135000, /* SynthClock */ + 1280, /* CRTC HDisplay */ + 1280, /* CRTC HBlankStart */ + 1296, /* CRTC HSyncStart */ + 1440, /* CRTC HSyncEnd */ + 1680, /* CRTC HBlankEnd */ + 1688, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 1024, /* CRTC VDisplay */ + 1024, /* CRTC VBlankStart */ + 1025, /* CRTC VSyncStart */ + 1028, /* CRTC VSyncEnd */ + 1065, /* CRTC VBlankEnd */ + 1066, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + +static DisplayModeRec SiS6326SIS1600x1200_60Mode = { + NULL, /* prev */ + NULL, /* next */ + "SIS1600x1200-60", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 162000, /* Clock frequency */ + 1600, /* HDisplay */ + 1664, /* HSyncStart */ + 1856, /* HSyncEnd */ + 2160, /* HTotal */ + 0, /* HSkew */ + 1200, /* VDisplay */ + 1201, /* VSyncStart */ + 1204, /* VSyncEnd */ + 1250, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 162000, /* SynthClock */ + 1600, /* CRTC HDisplay */ + 1600, /* CRTC HBlankStart */ + 1664, /* CRTC HSyncStart */ + 1856, /* CRTC HSyncEnd */ + 2152, /* CRTC HBlankEnd */ + 2160, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 1200, /* CRTC VDisplay */ + 1200, /* CRTC VBlankStart */ + 1201, /* CRTC VSyncStart */ + 1204, /* CRTC VSyncEnd */ + 1249, /* CRTC VBlankEnd */ + 1250, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.10 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c Mon Feb 3 21:44:29 2003 @@ -1,55 +1,147 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.10 2002/01/17 09:57:30 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.15 2003/02/04 02:44:29 dawes Exp $ */ +/* + * + * SiS driver option evaluation + * + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the supplier not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The supplier makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE SUPPLIER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: ? + * Thomas Winischhofer <thomas@winischhofer.net> + */ #include "xf86.h" #include "xf86PciInfo.h" +#include "xf86str.h" +#include "xf86Cursor.h" #include "sis.h" typedef enum { OPTION_SW_CURSOR, OPTION_HW_CURSOR, - OPTION_PCI_RETRY, - OPTION_RGB_BITS, +/* OPTION_PCI_RETRY, */ OPTION_NOACCEL, OPTION_TURBOQUEUE, OPTION_FAST_VRAM, - OPTION_SET_MEMCLOCK, + OPTION_NOHOSTBUS, +/* OPTION_SET_MEMCLOCK, */ OPTION_FORCE_CRT2TYPE, - OPTION_SHADOW_FB, + OPTION_SHADOW_FB, OPTION_ROTATE, - OPTION_NOXVIDEO, + OPTION_NOXVIDEO, OPTION_VESA, - OPTION_MAXXFBMEM + OPTION_MAXXFBMEM, + OPTION_FORCECRT1, + OPTION_DSTN, + OPTION_XVONCRT2, + OPTION_PDC, + OPTION_TVSTANDARD, + OPTION_USEROMDATA, + OPTION_NOINTERNALMODES, + OPTION_USEOEM, + OPTION_SBIOSN, + OPTION_NOYV12, + OPTION_CHTVOVERSCAN, + OPTION_CHTVSOVERSCAN, + OPTION_CHTVLUMABANDWIDTHCVBS, + OPTION_CHTVLUMABANDWIDTHSVIDEO, + OPTION_CHTVLUMAFLICKERFILTER, + OPTION_CHTVCHROMABANDWIDTH, + OPTION_CHTVCHROMAFLICKERFILTER, + OPTION_CHTVCVBSCOLOR, + OPTION_CHTVTEXTENHANCE, + OPTION_CHTVCONTRAST, + OPTION_SISTVEDGEENHANCE, + OPTION_SISTVANTIFLICKER, + OPTION_SISTVSATURATION, + OPTION_TVXPOSOFFSET, + OPTION_TVYPOSOFFSET, + OPTION_SIS6326ANTIFLICKER, + OPTION_SIS6326ENABLEYFILTER, + OPTION_SIS6326YFILTERSTRONG, + OPTION_CHTVTYPE, + OPTION_USERGBCURSOR, + OPTION_USERGBCURSORBLEND, + OPTION_USERGBCURSORBLENDTH, + OPTION_RESTOREBYSET } SISOpts; static const OptionInfoRec SISOptions[] = { - { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_RGB_BITS, "rgbbits", OPTV_INTEGER, {0}, -1 }, - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, - { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type",OPTV_ANYSTR, {0}, FALSE }, - { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, - { OPTION_NOXVIDEO, "NoXvideo", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, -1 }, - { -1, NULL, OPTV_NONE, {0}, FALSE } + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, +/* { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, */ + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE }, +/* { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, */ + { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOHOSTBUS, "NoHostBus", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_NOXVIDEO, "NoXvideo", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, -1 }, + { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DSTN, "DSTN", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, -1 }, + { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, -1 }, + { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_NOINTERNALMODES, "NoInternalModes", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_SBIOSN, "BIOSFile", OPTV_STRING, {0}, FALSE }, + { OPTION_NOYV12, "NoYV12", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_CHTVTYPE, "CHTVType", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_CHTVOVERSCAN, "CHTVOverscan", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_CHTVSOVERSCAN, "CHTVSuperOverscan", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_CHTVLUMABANDWIDTHCVBS, "CHTVLumaBandwidthCVBS", OPTV_INTEGER, {0}, -1 }, + { OPTION_CHTVLUMABANDWIDTHSVIDEO, "CHTVLumaBandwidthSVIDEO",OPTV_INTEGER, {0}, -1 }, + { OPTION_CHTVLUMAFLICKERFILTER, "CHTVLumaFlickerFilter", OPTV_INTEGER, {0}, -1 }, + { OPTION_CHTVCHROMABANDWIDTH, "CHTVChromaBandwidth", OPTV_INTEGER, {0}, -1 }, + { OPTION_CHTVCHROMAFLICKERFILTER, "CHTVChromaFlickerFilter",OPTV_INTEGER, {0}, -1 }, + { OPTION_CHTVCVBSCOLOR, "CHTVCVBSColor", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_CHTVTEXTENHANCE, "CHTVTextEnhance", OPTV_INTEGER, {0}, -1 }, + { OPTION_CHTVCONTRAST, "CHTVContrast", OPTV_INTEGER, {0}, -1 }, + { OPTION_SISTVEDGEENHANCE, "SISTVEdgeEnhance", OPTV_INTEGER, {0}, -1 }, + { OPTION_SISTVANTIFLICKER, "SISTVAntiFlicker", OPTV_INTEGER, {0}, -1 }, + { OPTION_SISTVSATURATION, "SISTVSaturation", OPTV_INTEGER, {0}, -1 }, + { OPTION_TVXPOSOFFSET, "TVXPosOffset", OPTV_INTEGER, {0}, -1 }, + { OPTION_TVYPOSOFFSET, "TVYPosOffset", OPTV_INTEGER, {0}, -1 }, + { OPTION_SIS6326ANTIFLICKER, "SIS6326TVAntiFlicker", OPTV_STRING, {0}, FALSE }, + { OPTION_SIS6326ENABLEYFILTER, "SIS6326TVEnableYFilter", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_SIS6326YFILTERSTRONG, "SIS6326TVYFilterStrong", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER, {0}, -1 }, + { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, -1 }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; -void SiSOptions(ScrnInfoPtr pScrn); -const OptionInfoRec * SISAvailableOptions(int chipid, int busid); - void SiSOptions(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - MessageType from; - double temp; - char *strptr; + SISPtr pSiS = SISPTR(pScrn); + MessageType from; +/* double temp; */ + char *strptr; /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); @@ -57,12 +149,15 @@ /* Process the options */ if (!(pSiS->Options = xalloc(sizeof(SISOptions)))) return; + memcpy(pSiS->Options, SISOptions, sizeof(SISOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSiS->Options); /* initalize some defaults */ - pSiS->FastVram = TRUE; - pSiS->UsePCIRetry = TRUE; + pSiS->newFastVram = -1; /* TW: Default: write only; if set, read + write */ + pSiS->NoHostBus = FALSE; +/* pSiS->UsePCIRetry = TRUE; */ pSiS->TurboQueue = TRUE; pSiS->HWCursor = TRUE; pSiS->Rotate = FALSE; @@ -70,172 +165,605 @@ pSiS->VESA = -1; pSiS->NoXvideo = FALSE; pSiS->maxxfbmem = 0; - - switch(pSiS->Chipset) { - case PCI_CHIP_SIS530: - pSiS->TurboQueue = FALSE; /* FIXME ? */ - break; - default: - break; - } - -#if 0 /* we only work with a depth greater or equal to 8 */ - if (pScrn->depth <= 8) { - if (xf86GetOptValInteger(pSiS->Options, OPTION_RGB_BITS, - &pScrn->rgbBits)) - { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Bits per RGB set to %d\n", pScrn->rgbBits); - } + pSiS->forceCRT1 = -1; + pSiS->DSTN = FALSE; /* TW: For using 550 FSTN/DSTN registers */ + pSiS->XvOnCRT2 = FALSE; /* TW: For chipsets with only one overlay */ + pSiS->NoYV12 = -1; + pSiS->PDC = -1; /* TW: Panel Delay Compensation for 300 (and 310/325) series */ + pSiS->OptTVStand = -1; + pSiS->OptROMUsage = -1; + pSiS->noInternalModes = FALSE; + pSiS->OptUseOEM = -1; + pSiS->OptTVOver = -1; + pSiS->OptTVSOver = -1; + pSiS->chtvlumabandwidthcvbs = -1; /* TW: Chrontel TV settings */ + pSiS->chtvlumabandwidthsvideo = -1; + pSiS->chtvlumaflickerfilter = -1; + pSiS->chtvchromabandwidth = -1; + pSiS->chtvchromaflickerfilter = -1; + pSiS->chtvcvbscolor = -1; + pSiS->chtvtextenhance = -1; + pSiS->chtvcontrast = -1; + pSiS->sistvedgeenhance = -1; /* TW: SiS30x TV settings */ + pSiS->sistvantiflicker = -1; + pSiS->sistvsaturation = -1; + pSiS->sis6326antiflicker = -1; /* TW: SiS6326 TV settings */ + pSiS->sis6326enableyfilter = -1; + pSiS->sis6326yfilterstrong = -1; + pSiS->tvxpos = 0; /* TW: Some day hopefully general TV settings */ + pSiS->tvypos = 0; + pSiS->NonDefaultPAL = -1; + pSiS->chtvtype = -1; +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) + pSiS->OptUseColorCursor = 0; +#else + if(pSiS->VGAEngine == SIS_300_VGA) { + pSiS->OptUseColorCursor = 0; + pSiS->OptUseColorCursorBlend = 1; + pSiS->OptColorCursorBlendThreshold = 0x37000000; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + pSiS->OptUseColorCursor = 1; + } +#endif + pSiS->restorebyset = 0; + + if(pSiS->Chipset == PCI_CHIP_SIS530) { + /* TW: TQ still broken on 530/620? */ + pSiS->TurboQueue = FALSE; } -#endif /* sw/hw cursor */ from = X_DEFAULT; - if (xf86GetOptValBool(pSiS->Options, OPTION_HW_CURSOR, &pSiS->HWCursor)) { + if(xf86GetOptValBool(pSiS->Options, OPTION_HW_CURSOR, &pSiS->HWCursor)) { from = X_CONFIG; } - if (xf86ReturnOptValBool(pSiS->Options, OPTION_SW_CURSOR, FALSE)) { + if(xf86ReturnOptValBool(pSiS->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pSiS->HWCursor = FALSE; + pSiS->OptUseColorCursor = 0; } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pSiS->HWCursor ? "HW" : "SW"); + +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) +#ifdef ARGB_CURSOR +#ifdef SIS_ARGB_CURSOR + if((pSiS->HWCursor) && ((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA))) { + from = X_DEFAULT; + if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSOR, &pSiS->OptUseColorCursor)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Color HW cursor is %s\n", + pSiS->OptUseColorCursor ? "enabled" : "disabled"); + + if(pSiS->VGAEngine == SIS_300_VGA) { + from = X_DEFAULT; + if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) { + from = X_CONFIG; + } + if(pSiS->OptUseColorCursor) { + xf86DrvMsg(pScrn->scrnIndex, from, + "HW cursor color blending emulation is %s\n", + (pSiS->OptUseColorCursorBlend) ? "enabled" : "disabled"); + } + { + int temp; + from = X_DEFAULT; + if(xf86GetOptValInteger(pSiS->Options, OPTION_USERGBCURSORBLENDTH, &temp)) { + if((temp >= 0) && (temp <= 255)) { + from = X_CONFIG; + pSiS->OptColorCursorBlendThreshold = (temp << 24); + } else { + temp = pSiS->OptColorCursorBlendThreshold >> 24; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal color HW cursor blending threshold, valid range 0-255\n"); + } + } + if(pSiS->OptUseColorCursor) { + if(pSiS->OptUseColorCursorBlend) { + xf86DrvMsg(pScrn->scrnIndex, from, + "HW cursor color blending emulation threshold is %d\n", temp); + } + } + } + } + } +#endif +#endif +#endif /* Accel */ - if (xf86ReturnOptValBool(pSiS->Options, OPTION_NOACCEL, FALSE)) { + if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOACCEL, FALSE)) { pSiS->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + pSiS->NoXvideo = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration and Xv disabled\n"); } - /* PCI retry */ +#if 0 + /* PCI retry - TW: What the heck is/was this for? */ from = X_DEFAULT; - if (xf86GetOptValBool(pSiS->Options, OPTION_PCI_RETRY, &pSiS->UsePCIRetry)) { + if(xf86GetOptValBool(pSiS->Options, OPTION_PCI_RETRY, &pSiS->UsePCIRetry)) { from = X_CONFIG; } xf86DrvMsg(pScrn->scrnIndex, from, "PCI retry %s\n", pSiS->UsePCIRetry ? "enabled" : "disabled"); +#endif /* Mem clock */ - if (xf86GetOptValFreq(pSiS->Options, OPTION_SET_MEMCLOCK, OPTUNITS_MHZ, +#if 0 /* TW: This is not used */ + if(xf86GetOptValFreq(pSiS->Options, OPTION_SET_MEMCLOCK, OPTUNITS_MHZ, &temp)) { pSiS->MemClock = (int)(temp * 1000.0); - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Memory clock set to %.3f MHz\n", pSiS->MemClock/1000.0); } - - /* fast VRAM */ - from = X_DEFAULT; - if (xf86GetOptValBool(pSiS->Options, OPTION_FAST_VRAM, &pSiS->FastVram)) { - from = X_CONFIG; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM %s\n", - pSiS->FastVram ? "enabled" : "disabled"); +#endif - /* Turbo QUEUE */ - from = X_DEFAULT; - if (xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) { - from = X_CONFIG; + /* Fast VRAM (not for 300/310/325 series) */ + if((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) { + from = X_DEFAULT; + if(xf86GetOptValBool(pSiS->Options, OPTION_FAST_VRAM, &pSiS->newFastVram)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM %s\n", + (pSiS->newFastVram == -1) ? "enabled (for write only)" : + (pSiS->newFastVram ? "enabled (for read and write)" : "disabled")); + } + + /* NoHostBus (5597/5598 only) */ + if((pSiS->Chipset == PCI_CHIP_SIS5597)) { + from = X_DEFAULT; + if(xf86GetOptValBool(pSiS->Options, OPTION_NOHOSTBUS, &pSiS->NoHostBus)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "SiS5597/5598 VGA-to-CPU host bus %s\n", + pSiS->NoHostBus ? "disabled" : "enabled"); + } + + if(pSiS->VGAEngine != SIS_315_VGA) { + /* Turbo QUEUE */ + /* (TW: We always use this on 310/325 series) */ + from = X_DEFAULT; + if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n", + pSiS->TurboQueue ? "enabled" : "disabled"); } - xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n", - pSiS->TurboQueue ? "enabled" : "disabled"); - /* CRT2 type */ + /* Force CRT2 type (300/310/325 series only) + TW: SVIDEO, COMPOSITE and SCART for overriding detection + */ pSiS->ForceCRT2Type = CRT2_DEFAULT; - strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE); - if (strptr != NULL) - { - if (!strcmp(strptr,"TV")) + pSiS->ForceTVType = -1; + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE); + if(strptr != NULL) { + if((!strcmp(strptr,"TV")) || (!strcmp(strptr,"tv"))) + pSiS->ForceCRT2Type = CRT2_TV; + else if((!strcmp(strptr,"SVIDEO")) || (!strcmp(strptr,"svideo"))) { pSiS->ForceCRT2Type = CRT2_TV; - if (!strcmp(strptr,"LCD")) + pSiS->ForceTVType = TV_SVIDEO; + } else if((!strcmp(strptr,"COMPOSITE")) || (!strcmp(strptr,"composite"))) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_AVIDEO; + } else if((!strcmp(strptr,"SCART")) || (!strcmp(strptr,"scart"))) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_SCART; + } else if((!strcmp(strptr,"LCD")) || (!strcmp(strptr,"lcd"))) pSiS->ForceCRT2Type = CRT2_LCD; - if (!strcmp(strptr,"VGA")) + else if((!strcmp(strptr,"DVI")) || (!strcmp(strptr,"dvi"))) + pSiS->ForceCRT2Type = CRT2_LCD; + else if((!strcmp(strptr,"VGA")) || (!strcmp(strptr,"vga"))) pSiS->ForceCRT2Type = CRT2_VGA; - if (!strcmp(strptr,"NONE")) + else if((!strcmp(strptr,"NONE")) || (!strcmp(strptr,"none"))) pSiS->ForceCRT2Type = 0; + else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "\"%s\" is not a valid parameter for Option \"ForceCRT2Type\"\n", strptr); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid parameters are \"LCD\" (alias \"DVI\"), \"TV\", \"SVIDEO\", \"COMPOSITE\", \"SCART\", \"VGA\" or \"NONE\"\n"); + } - if (pSiS->ForceCRT2Type != CRT2_DEFAULT) + if(pSiS->ForceCRT2Type != CRT2_DEFAULT) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "CRT2 type shall be %s\n", strptr); + } + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE); + if(strptr != NULL) { + if((!strcmp(strptr,"SCART")) || (!strcmp(strptr,"scart"))) + pSiS->chtvtype = 1; + else if((!strcmp(strptr,"HDTV")) || (!strcmp(strptr,"hdtv"))) + pSiS->chtvtype = 0; + else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "\"%s\" is not a valid parameter for Option \"CHTVType\"\n", strptr); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid parameters are \"SCART\" or \"HDTV\"\n"); + } + if(pSiS->chtvtype != -1) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "CRT2 Type set to: %s\n", strptr); + "Chrontel TV type shall be %s\n", strptr); + } } /* ShadowFB */ from = X_DEFAULT; - if (xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) { + if(xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) { from = X_CONFIG; } - if (pSiS->ShadowFB) { - pSiS->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, from, - "Using \"Shadow Frame Buffer\" - acceleration disabled\n"); - } + if(pSiS->ShadowFB) { + pSiS->NoAccel = TRUE; + pSiS->NoXvideo = TRUE; + xf86DrvMsg(pScrn->scrnIndex, from, + "Using \"Shadow Frame Buffer\" - acceleration and Xv disabled\n"); + } /* Rotate */ - if ((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ROTATE))) { + if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ROTATE))) { if(!xf86NameCmp(strptr, "CW")) { pSiS->ShadowFB = TRUE; pSiS->NoAccel = TRUE; + pSiS->NoXvideo = TRUE; pSiS->HWCursor = FALSE; pSiS->Rotate = 1; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Rotating screen clockwise - acceleration disabled\n"); + "Rotating screen clockwise (acceleration and Xv disabled)\n"); } else - if (!xf86NameCmp(strptr, "CCW")) { + if(!xf86NameCmp(strptr, "CCW")) { pSiS->ShadowFB = TRUE; pSiS->NoAccel = TRUE; + pSiS->NoXvideo = TRUE; pSiS->HWCursor = FALSE; pSiS->Rotate = -1; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Rotating screen counter clockwise - acceleration disabled\n"); + "Rotating screen counter clockwise (acceleration and Xv disabled)\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "\"%s\" is not a valid value for Option \"Rotate\"\n", strptr); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "\"%s\" is not a valid parameter for Option \"Rotate\"\n", strptr); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Valid options are \"CW\" or \"CCW\"\n"); + "Valid parameters are \"CW\" or \"CCW\"\n"); } } - - /* NOXvideo */ - if (xf86ReturnOptValBool(pSiS->Options, OPTION_NOXVIDEO, FALSE)) { + + /* RestoreBySetMode */ + /* TW: Set this to force the driver to set the old mode instead of restoring + * the register contents. This can be used to overcome problems with + * LCD panels and video bridges. + */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + Bool val; + if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) { + if(val) pSiS->restorebyset = TRUE; + else pSiS->restorebyset = FALSE; + } + } + + /* NOXvideo: + * Set this to TRUE to disable Xv hardware video acceleration + */ + if(!pSiS->NoAccel) { + if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOXVIDEO, FALSE)) { pSiS->NoXvideo = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo Extension Disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension disabled\n"); + } + + if(!pSiS->NoXvideo) { + Bool val; + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + /* TW: XvOnCRT2: + * On chipsets with only one overlay (315, 650), the user should + * choose to display the overlay on CRT1 or CRT2. By setting this + * option to TRUE, the overlay will be displayed on CRT2. The + * default is: CRT1 if only CRT1 available, CRT2 if only CRT2 + * available, and CRT1 if both is available and detected. + */ + if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) { + if(val) pSiS->XvOnCRT2 = TRUE; + else pSiS->XvOnCRT2 = FALSE; + } + } + if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) { + /* TW: NoYV12 (for 5597/5598, 6326 and 530/620 only) + * YV12 has problems with videos larger than 384x288. So + * allow the user to disable YV12 support to force the + * application to use YUV2 instead. + */ + if(xf86GetOptValBool(pSiS->Options, OPTION_NOYV12, &val)) { + if(val) pSiS->NoYV12 = 1; + else pSiS->NoYV12 = 0; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Xv YV12/I420 support is %s\n", + pSiS->NoYV12 ? "disabled" : "enabled"); + } + } + } } - /* VESA */ - /* - * This option is for overriding the default behavior. - * By default it depends on the chipset/video bridge - * combination if the VESA BIOS code is used to prevent - * the "melting" screen effect due to lack of nowledge - * about programming details. - * You will normally not need this option. + /* TW: VESA - DEPRECATED + * This option is for forcing the driver to use + * the VESA BIOS extension for mode switching. */ { Bool val; - - if (xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) { - if (val) - pSiS->VESA = 1; - else - pSiS->VESA = 0; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "VESA usage %s\n", + if(xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) { + if(val) pSiS->VESA = 1; + else pSiS->VESA = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "VESA: VESA usage shall be %s\n", val ? "enabled":"disabled"); } } - /* With the option "MaxXFBMem" you can limit the amount of video memory X + + /* TW: MaxXFBMem + * With the option "MaxXFBMem" you can limit the amount of video memory X * uses for screen and off-screen buffers. This option should be used if * you intend to use DRI/DRM. The framebuffer driver required for DRM will - * start its memory heap at 8MB if it detects more than that. So, if you - * limit the amount of memory X uses, you avoid a clash between the framebuffer + * start its memory heap at 12MB if it detects more than 16MB, at 8MB if + * between 8 and 16MB are available, otherwise at 4MB. So, if you limit + * the amount of memory X uses, you avoid a clash between the framebuffer * driver and X as regards overwriting memory portions of each other. * The amount is to be specified in KB. */ - if (xf86GetOptValULong(pSiS->Options, OPTION_MAXXFBMEM, + if(xf86GetOptValULong(pSiS->Options, OPTION_MAXXFBMEM, &pSiS->maxxfbmem)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Framebuffer memory limited to %d KB\n", pSiS->maxxfbmem); + "MaxXFBMem: Framebuffer memory shall be limited to %d KB\n", + pSiS->maxxfbmem); pSiS->maxxfbmem *= 1024; + } + + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + /* TW: ForceCRT1 (300/310/325 series only) + * This option can be used to force CRT1 to be switched on/off. Its + * intention is mainly for old monitors that can't be detected + * automatically. This is only useful on machines with a video bridge. + * In normal cases, this option won't be necessary. + */ + Bool val; + if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) { + if(val) pSiS->forceCRT1 = 1; + else pSiS->forceCRT1 = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "CRT1 shall be forced to %s\n", + val ? "ON" : "OFF"); + } + } + + if(pSiS->Chipset == PCI_CHIP_SIS550) { + /* TW: SiS 550 DSTN/FSTN + * This is for notifying the driver to use the DSTN registers on 550. + * DSTN/FSTN is a special LCD port of the SiS550 (notably not the 551 + * and 552, which I don't know how to detect) that uses an extended + * register range. The only effect of this option is that the driver + * saves and restores these registers. DSTN display modes are chosen + * by using resultion 320x480x8 or 320x480x16. + */ + if(xf86ReturnOptValBool(pSiS->Options, OPTION_DSTN, FALSE)) { + pSiS->DSTN = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "SiS 550 DSTN/FSTN enabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "SiS 550 DSTN/FSTN disabled\n"); + } + } + + /* TW: PanelDelayCompensation (300/310/325 series only) + * This might be required if the LCD panel shows "small waves". + * The parameter is an integer, usually either 4, 32 or 24. + * Why this option? Simply because SiS did poor BIOS design. + * The PDC value depends on the very LCD panel used in a + * particular machine. For most panels, the driver is able + * to detect the correct value. However, some panels require + * a different setting. The value given must be within the mask 0x3c. + */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &pSiS->PDC)) { + if(pSiS->PDC & ~0x3c) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal PanelDelayCompensation value\n"); + pSiS->PDC = -1; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Panel delay compensation shall be %d\n", + pSiS->PDC); + } + } + } + + /* TW: TVStandard (300/310/325 series and 6326 w/ TV only) + * This option is for overriding the autodetection of + * the BIOS option for PAL / NTSC + */ + if((pSiS->VGAEngine == SIS_300_VGA) || + (pSiS->VGAEngine == SIS_315_VGA) || + ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) { + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD); + if(strptr != NULL) { + if((!strcmp(strptr,"PAL")) || (!strcmp(strptr,"pal"))) + pSiS->OptTVStand = 1; + else if((!strcmp(strptr,"PALM")) || (!strcmp(strptr,"palm"))) { + pSiS->OptTVStand = 1; + pSiS->NonDefaultPAL = 1; + } else if((!strcmp(strptr,"PALN")) || (!strcmp(strptr,"paln"))) { + pSiS->OptTVStand = 1; + pSiS->NonDefaultPAL = 0; + } else if((!strcmp(strptr,"NTSC")) || (!strcmp(strptr,"ntsc"))) + pSiS->OptTVStand = 0; + else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "\"%s\" is not a valid parameter for Option \"TVStandard\"\n", strptr); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"PAL\", \"PALM\", \"PALN\" or \"NTSC\"\n"); + } + + if(pSiS->OptTVStand != -1) { + if(pSiS->Chipset == PCI_CHIP_SIS6326) { + pSiS->NonDefaultPAL = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Standard shall be %s\n", + pSiS->OptTVStand ? "PAL" : "NTSC"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Standard shall be %s\n", + (pSiS->OptTVStand ? + ( (pSiS->NonDefaultPAL == -1) ? "PAL" : + ((pSiS->NonDefaultPAL) ? "PALM" : "PALN") ) + : "NTSC")); + } + } + } + } + + /* TW: TVOverscan (300/310/325 series only) + * This option is for overriding the BIOS option for + * TV Overscan. Some BIOS don't even have such an option. + * This is only effective on LVDS+CHRONTEL 70xx systems. + */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + Bool val; + if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVOVERSCAN, &val)) { + if(val) pSiS->OptTVOver = 1; + else pSiS->OptTVOver = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Chrontel: TV overscan shall be %s\n", + val ? "enabled":"disabled"); + } + if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &pSiS->OptTVSOver)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Chrontel: TV super overscan shall be %s\n", + pSiS->OptTVSOver ? "enabled":"disabled"); + } + } + + /* TW: UseROMData (300/310/325 series only) + * This option is enabling/disabling usage of some machine + * specific data from the BIOS ROM. This option can - and + * should - be used in case the driver makes problems + * because SiS changed the location of this data. + * TW: NoOEM (300/310/325 series only) + * The driver contains quite a lot data for OEM LCD panels + * and TV connector specifics which override the defaults. + * If this data is incorrect, the TV may lose color and + * the LCD panel might show some strange effects. Use this + * option to disable the usage of this data. + */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + Bool val; + if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) { + if(val) pSiS->OptROMUsage = 1; + else pSiS->OptROMUsage = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Video ROM data usage shall be %s\n", + val ? "enabled":"disabled"); + } + if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) { + if(val) pSiS->OptUseOEM = 1; + else pSiS->OptUseOEM = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Internal LCD/TV OEM data usage shall be %s\n", + val ? "enabled":"disabled"); + } + pSiS->sbiosn = NULL; + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SBIOSN); + if(strptr != NULL) { + pSiS->sbiosn = xalloc(strlen(strptr)+1); + if(pSiS->sbiosn) strcpy(pSiS->sbiosn, strptr); + } + } + + /* TW: NoInternalModes (300/310/325 series only) + * Since the mode switching code for these chipsets is a + * Asm-to-C translation of BIOS code, we only have timings + * for a pre-defined number of modes. The default behavior + * is to replace XFree's default modes with a mode list + * generated out of the known and supported modes. Use + * this option to disable this. However, even if using + * out built-in mode list will NOT make it possible to + * use modelines. + */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + from = X_DEFAULT; + if(xf86GetOptValBool(pSiS->Options, OPTION_NOINTERNALMODES, &pSiS->noInternalModes)) + from = X_CONFIG; + + xf86DrvMsg(pScrn->scrnIndex, from, "Usage of built-in modes is %s\n", + pSiS->noInternalModes ? "disabled":"enabled"); + } + + /* TW: Various parameters for TV output via SiS bridge, Chrontel or SiS6326 */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + int tmp = 0; + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS, + &pSiS->chtvlumabandwidthcvbs); + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHSVIDEO, + &pSiS->chtvlumabandwidthsvideo); + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMAFLICKERFILTER, + &pSiS->chtvlumaflickerfilter); + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMABANDWIDTH, + &pSiS->chtvchromabandwidth); + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMAFLICKERFILTER, + &pSiS->chtvchromaflickerfilter); + xf86GetOptValBool(pSiS->Options, OPTION_CHTVCVBSCOLOR, + &pSiS->chtvcvbscolor); + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVTEXTENHANCE, + &pSiS->chtvtextenhance); + xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCONTRAST, + &pSiS->chtvcontrast); + xf86GetOptValInteger(pSiS->Options, OPTION_SISTVEDGEENHANCE, + &pSiS->sistvedgeenhance); + xf86GetOptValInteger(pSiS->Options, OPTION_SISTVANTIFLICKER, + &pSiS->sistvantiflicker); + xf86GetOptValInteger(pSiS->Options, OPTION_SISTVSATURATION, + &pSiS->sistvsaturation); + xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET, + &pSiS->tvxpos); + xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET, + &pSiS->tvypos); + if(pSiS->tvxpos > 32) { pSiS->tvxpos = 32; tmp = 1; } + if(pSiS->tvxpos < -32) { pSiS->tvxpos = -32; tmp = 1; } + if(pSiS->tvypos > 32) { pSiS->tvypos = 32; tmp = 1; } + if(pSiS->tvypos < -32) { pSiS->tvypos = -32; tmp = 1; } + if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal TV x or y offset. Range is from -32 to 32\n"); + } + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + int tmp = 0; + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326ANTIFLICKER); + if (strptr != NULL) { + if((!strcmp(strptr,"OFF")) || (!strcmp(strptr,"off"))) + pSiS->sis6326antiflicker = 0; + else if((!strcmp(strptr,"LOW")) || (!strcmp(strptr,"low"))) + pSiS->sis6326antiflicker = 1; + else if((!strcmp(strptr,"MED")) || (!strcmp(strptr,"med"))) + pSiS->sis6326antiflicker = 2; + else if((!strcmp(strptr,"HIGH")) || (!strcmp(strptr,"high"))) + pSiS->sis6326antiflicker = 3; + else if((!strcmp(strptr,"ADAPTIVE")) || (!strcmp(strptr,"adaptive"))) + pSiS->sis6326antiflicker = 4; + else { + pSiS->sis6326antiflicker = -1; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "\"%s\" is not a valid parameter for Option \"SIS6326TVAntiFlicker\"\n", strptr); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid parameters are \"OFF\", \"LOW\", \"MED\", \"HIGH\" or \"ADAPTIVE\"\n"); + } + } + xf86GetOptValBool(pSiS->Options, OPTION_SIS6326ENABLEYFILTER, + &pSiS->sis6326enableyfilter); + xf86GetOptValBool(pSiS->Options, OPTION_SIS6326YFILTERSTRONG, + &pSiS->sis6326yfilterstrong); + xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET, + &pSiS->tvxpos); + xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET, + &pSiS->tvypos); + if(pSiS->tvxpos > 16) { pSiS->tvxpos = 16; tmp = 1; } + if(pSiS->tvxpos < -16) { pSiS->tvxpos = -16; tmp = 1; } + if(pSiS->tvypos > 16) { pSiS->tvypos = 16; tmp = 1; } + if(pSiS->tvypos < -16) { pSiS->tvypos = -16; tmp = 1; } + if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal TV x or y offset. Range is from -16 to 16\n"); } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h:1.15 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h:1.15 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h Wed Jan 29 10:42:17 2003 @@ -1,31 +1,50 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.17 2003/01/29 15:42:17 eich Exp $ */ /* * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holder not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holder makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE PROVIDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE PROVIDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk> + * + * Thomas Winischhofer <thomas@winischhofer.net> + * - 310/325 series (315/550/650/651/740/M650) support + * - (possibly incomplete) Xabre (SiS330) support + * - new mode switching code for 300, 310/325 and 330 series + * - many fixes for 300/540/630/730 chipsets, + * - many fixes for 5597/5598, 6326 and 530/620 chipsets, + * - VESA mode switching (deprecated), + * - extended CRT2/video bridge handling support, + * - dual head support on 300, 310/325 and 330 series + * - 650/LVDS (up to 1400x1050), 650/Chrontel 701x support + * - 30xB/30xLV/30xLVX video bridge support (300, 310/325, 330 series) + * - Xv support for 5597/5598, 6326, 530/620 and 310/325 series + * - video overlay enhancements for 300 series + * - TV and hi-res support for the 6326 + * - etc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.15 2001/04/19 12:40:33 alanh Exp $ */ + +/* For general use --------------------------------------------------------------- */ #define inSISREG(base) inb(base) #define outSISREG(base,val) outb(base,val) @@ -41,9 +60,6 @@ #define inSISIDXREG(base,idx,var) do { \ outb(base,idx); var=inb((base)+1); \ } while (0) -#if 0 -#define outSISIDXREG(base,idx,val) outw(base, (val)<<8 | (idx)); -#endif #define outSISIDXREG(base,idx,val) do { \ outb(base,idx); outb((base)+1,val); \ } while (0) @@ -69,40 +85,68 @@ #define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) #define GENMASK(mask) BITMASK(1?mask,0?mask) -#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) -#define SETBITS(val,mask) ((val) << (0?mask)) -#define SETBIT(n) (1<<(n)) +#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) +#define SETBITS(val,mask) ((val) << (0?mask)) +#define SETBIT(n) (1<<(n)) #define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) #define SETVARBITS(var,val,from,to) (((var)&(~(GENMASK(to)))) | \ - GETBITSTR(val,from,to)) + GETBITSTR(val,from,to)) #define GETVAR8(var) ((var)&0xFF) #define SETVAR8(var,val) (var) = GETVAR8(val) -#define VGA_RELIO_BASE 0x380 +/* #define VGA_RELIO_BASE 0x380 */ -#define AROFFSET VGA_ATTR_INDEX - VGA_RELIO_BASE -#define ARROFFSET VGA_ATTR_DATA_R - VGA_RELIO_BASE -#define GROFFSET VGA_GRAPH_INDEX - VGA_RELIO_BASE -#define SROFFSET VGA_SEQ_INDEX - VGA_RELIO_BASE -#define CROFFSET VGA_CRTC_INDEX_OFFSET + VGA_IOBASE_COLOR-VGA_RELIO_BASE -#define MISCROFFSET VGA_MISC_OUT_R - VGA_RELIO_BASE -#define MISCWOFFSET VGA_MISC_OUT_W - VGA_RELIO_BASE - -#define SISAR pSiS->RElIO+AROFFSET -#define SISARR pSiS->RELIO+ARROFFSET -#define SISGR pSiS->RELIO+GROFFSET -#define SISSR pSiS->RelIO+SROFFSET -#define SISCR pSiS->RelIO+CROFFSET -#define SISMISCR pSiS->RelIO+MISCROFFSET -#define SISMISCW pSiS->RelIO+MISCWOFFSET -#define SISPART1 pSiS->RelIO+0x04 -#define SISPART2 pSiS->RelIO+0x10 -#define SISPART3 pSiS->RelIO+0x12 -#define SISPART4 pSiS->RelIO+0x14 -#define SISPART5 pSiS->RelIO+0x16 +#define AROFFSET 0x40 /* VGA_ATTR_INDEX - VGA_RELIO_BASE */ +#define ARROFFSET 0x41 /* VGA_ATTR_DATA_R - VGA_RELIO_BASE */ +#define GROFFSET 0x4e /* VGA_GRAPH_INDEX - VGA_RELIO_BASE */ +#define SROFFSET 0x44 /* VGA_SEQ_INDEX - VGA_RELIO_BASE */ +#define CROFFSET 0x54 /* VGA_CRTC_INDEX_OFFSET + VGA_IOBASE_COLOR - VGA_RELIO_BASE */ +#define MISCROFFSET 0x4c /* VGA_MISC_OUT_R - VGA_RELIO_BASE */ +#define MISCWOFFSET 0x42 /* VGA_MISC_OUT_W - VGA_RELIO_BASE */ +#define INPUTSTATOFFSET 0x5A +#define PART1OFFSET 0x04 +#define PART2OFFSET 0x10 +#define PART3OFFSET 0x12 +#define PART4OFFSET 0x14 +#define PART5OFFSET 0x16 +#define VIDEOOFFSET 0x02 +#define COLREGOFFSET 0x48 + +#define SISAR pSiS->RelIO + AROFFSET +#define SISARR pSiS->RelIO + ARROFFSET +#define SISGR pSiS->RelIO + GROFFSET +#define SISSR pSiS->RelIO + SROFFSET +#define SISCR pSiS->RelIO + CROFFSET +#define SISMISCR pSiS->RelIO + MISCROFFSET +#define SISMISCW pSiS->RelIO + MISCWOFFSET +#define SISINPSTAT pSiS->RelIO + INPUTSTATOFFSET +#define SISPART1 pSiS->RelIO + PART1OFFSET +#define SISPART2 pSiS->RelIO + PART2OFFSET +#define SISPART3 pSiS->RelIO + PART3OFFSET +#define SISPART4 pSiS->RelIO + PART4OFFSET +#define SISPART5 pSiS->RelIO + PART5OFFSET +#define SISVID pSiS->RelIO + VIDEOOFFSET +#define SISCOLIDX pSiS->RelIO + COLREGOFFSET +#define SISCOLDATA pSiS->RelIO + COLREGOFFSET + 1 +#define SISCOL2IDX SISPART5 +#define SISCOL2DATA SISPART5 + 1 + + +#define vc_index_offset 0x00 /* Video capture - unused */ +#define vc_data_offset 0x01 +#define vi_index_offset VIDEOOFFSET +#define vi_data_offset (VIDEOOFFSET + 1) +#define crt2_index_offset PART1OFFSET +#define crt2_port_offset (PART1OFFSET + 1) +#define sr_index_offset SROFFSET +#define sr_data_offset (SROFFSET + 1) +#define cr_index_offset CROFFSET +#define cr_data_offset (CROFFSET + 1) +#define input_stat INPUTSTATOFFSET -/* 3C4 */ +/* For old chipsets (5597/5598, 6326, 530/620) ------------ */ +/* SR (3C4) */ #define BankReg 0x06 #define ClockReg 0x07 #define CPUThreshold 0x08 @@ -128,159 +172,9 @@ /* 3x4 */ #define Offset 0x13 - -#define read_xr(num,var) do {outb(0x3c4, num);var=inb(0x3c5);} while (0) - -/* Definitions for the SIS engine communication. */ - -extern int sisReg32MMIO[]; -#define BR(x) sisReg32MMIO[x] - -/* These are done using Memory Mapped IO, of the registers */ -/* - * Modified for Sis by Xavier Ducoin (xavier@rd.lectra.fr) - */ - -#define sisLEFT2RIGHT 0x10 -#define sisRIGHT2LEFT 0x00 -#define sisTOP2BOTTOM 0x20 -#define sisBOTTOM2TOP 0x00 - -#define sisSRCSYSTEM 0x03 -#define sisSRCVIDEO 0x02 -#define sisSRCFG 0x01 -#define sisSRCBG 0x00 - -#define sisCMDBLT 0x0000 -#define sisCMDBLTMSK 0x0100 -#define sisCMDCOLEXP 0x0200 -#define sisCMDLINE 0x0300 - -#define sisCMDENHCOLEXP 0x2000 - -#define sisXINCREASE 0x10 -#define sisYINCREASE 0x20 -#define sisCLIPENABL 0x40 -#define sisCLIPINTRN 0x80 -#define sisCLIPEXTRN 0x00 - - -#define sisPATREG 0x08 -#define sisPATFG 0x04 -#define sisPATBG 0x00 - -#define sisLASTPIX 0x0800 -#define sisXMAJOR 0x0400 - - -/* Macros to do useful things with the SIS BitBLT engine */ - -#define sisBLTSync \ - while(*(volatile unsigned short *)(pSiS->IOBase + BR(10)+2) & \ - (0x4000)){} - -/* According to SiS 6326 2D programming guide, 16 bits position at */ -/* 0x82A8 returns queue free. But this don't work, so don't wait */ -/* anything when turbo-queue is enabled. If there are frequent syncs */ -/* this should work. But not for xaa_benchmark :-( */ - -#define sisBLTWAIT \ - if (!pSiS->TurboQueue) {\ - while(*(volatile unsigned short *)(pSiS->IOBase + BR(10)+2) & \ - (0x4000)){}} /* \ - else {while(*(volatile unsigned short *)(pSiS->IOBase + BR(10)) < \ - 63){}} */ - -#define sisSETPATREG()\ - ((unsigned char *)(pSiS->IOBase + BR(11))) - -#define sisSETPATREGL()\ - ((unsigned long *)(pSiS->IOBase + BR(11))) - -#define sisSETCMD(op) \ - *(volatile unsigned short *)(pSiS->IOBase + BR(10) +2 ) = op - -#define sisSETROPFG(op) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(4)))&0xffffff) | (op<<24) - -#define sisSETROPBG(op) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(5)))&0xffffff) | (op<<24) - -#define sisSETROP(op) \ - sisSETROPFG(op);sisSETROPBG(op); - - -#define sisSETSRCADDR(srcAddr) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = srcAddr&0x3FFFFFL - -#define sisSETDSTADDR(dstAddr) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = dstAddr&0x3FFFFFL - -#define sisSETPITCH(srcPitch,dstPitch) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = ((dstPitch&0xFFFF)<<16)| \ - (srcPitch&0xFFFF) - -/* according to SIS 2D Engine Programming Guide - * width -1 independant of Bpp - */ -#define sisSETHEIGHTWIDTH(Height,Width)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((Height)&0xFFFF)<<16)| \ - ((Width)&0xFFFF) - -#define sisSETCLIPTOP(x,y)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (((y)&0xFFFF)<<16)| \ - ((x)&0xFFFF) -#define sisSETCLIPBOTTOM(x,y)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (((y)&0xFFFF)<<16)| \ - ((x)&0xFFFF) +/* SiS Registers for 300, 540, 630, 730, 315, 550, 650, 740 ---------------------- */ -#define sisSETBGCOLOR(bgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor) - -#define sisSETBGCOLOR8(bgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor&0xFF) - -#define sisSETBGCOLOR16(bgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor&0xFFFF) - -#define sisSETBGCOLOR24(bgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor&0xFFFFFF) - - -#define sisSETFGCOLOR(fgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor) - -#define sisSETFGCOLOR8(fgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor&0xFF) - -#define sisSETFGCOLOR16(fgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor&0xFFFF) - -#define sisSETFGCOLOR24(fgColor)\ - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor&0xFFFFFF) - -/* Line drawing */ - -#define sisSETXStart(XStart) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = XStart&0xFFFF - -#define sisSETYStart(YStart) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = YStart&0xFFFF - -#define sisSETLineMajorCount(MajorAxisCount) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = MajorAxisCount&0xFFFF - -#define sisSETLineSteps(K1,K2) \ - *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((K1)&0xFFFF)<<16)| \ - ((K2)&0xFFFF) - -#define sisSETLineErrorTerm(ErrorTerm) \ - *(volatile unsigned short *)(pSiS->IOBase + BR(7)) = ErrorTerm - - -/* SiS Registers for Xv */ - /* VGA standard register */ #define Index_SR_Graphic_Mode 0x06 #define Index_SR_RAMDAC_Ctrl 0x07 @@ -305,44 +199,55 @@ #define Index_SR_Power_On_Trap2 0x39 #define Index_SR_Power_On_Trap3 0x3A -/* video registers */ +/* video registers (300/630/730/315/550/650/740 only) */ #define Index_VI_Passwd 0x00 + +/* Video overlay horizontal start/end, unit=screen pixels */ #define Index_VI_Win_Hor_Disp_Start_Low 0x01 #define Index_VI_Win_Hor_Disp_End_Low 0x02 -#define Index_VI_Win_Hor_Over 0x03 +#define Index_VI_Win_Hor_Over 0x03 /* Overflow */ +/* Video overlay vertical start/end, unit=screen pixels */ #define Index_VI_Win_Ver_Disp_Start_Low 0x04 #define Index_VI_Win_Ver_Disp_End_Low 0x05 -#define Index_VI_Win_Ver_Over 0x06 +#define Index_VI_Win_Ver_Over 0x06 /* Overflow */ +/* Y Plane (4:2:0) or YUV (4:2:2) buffer start address, unit=word */ #define Index_VI_Disp_Y_Buf_Start_Low 0x07 #define Index_VI_Disp_Y_Buf_Start_Middle 0x08 #define Index_VI_Disp_Y_Buf_Start_High 0x09 +/* U Plane (4:2:0) buffer start address, unit=word */ #define Index_VI_U_Buf_Start_Low 0x0A #define Index_VI_U_Buf_Start_Middle 0x0B #define Index_VI_U_Buf_Start_High 0x0C +/* V Plane (4:2:0) buffer start address, unit=word */ #define Index_VI_V_Buf_Start_Low 0x0D #define Index_VI_V_Buf_Start_Middle 0x0E #define Index_VI_V_Buf_Start_High 0x0F +/* Pitch for Y, UV Planes, unit=word */ #define Index_VI_Disp_Y_Buf_Pitch_Low 0x10 #define Index_VI_Disp_UV_Buf_Pitch_Low 0x11 -#define Index_VI_Disp_Y_UV_Buf_Pitch_High 0x12 +#define Index_VI_Disp_Y_UV_Buf_Pitch_Middle 0x12 +/* What is this ? */ #define Index_VI_Disp_Y_Buf_Preset_Low 0x13 #define Index_VI_Disp_Y_Buf_Preset_Middle 0x14 + #define Index_VI_UV_Buf_Preset_Low 0x15 #define Index_VI_UV_Buf_Preset_Middle 0x16 #define Index_VI_Disp_Y_UV_Buf_Preset_High 0x17 +/* Scaling control registers */ #define Index_VI_Hor_Post_Up_Scale_Low 0x18 #define Index_VI_Hor_Post_Up_Scale_High 0x19 #define Index_VI_Ver_Up_Scale_Low 0x1A #define Index_VI_Ver_Up_Scale_High 0x1B #define Index_VI_Scale_Control 0x1C +/* Playback line buffer control */ #define Index_VI_Play_Threshold_Low 0x1D #define Index_VI_Play_Threshold_High 0x1E #define Index_VI_Line_Buffer_Size 0x1F @@ -355,7 +260,7 @@ #define Index_VI_Overlay_ColorKey_Green_Max 0x24 #define Index_VI_Overlay_ColorKey_Blue_Max 0x25 -/* Source color key */ +/* Source color key, YUV color space */ #define Index_VI_Overlay_ChromaKey_Red_Y_Min 0x26 #define Index_VI_Overlay_ChromaKey_Green_U_Min 0x27 #define Index_VI_Overlay_ChromaKey_Blue_V_Min 0x28 @@ -363,8 +268,8 @@ #define Index_VI_Overlay_ChromaKey_Green_U_Max 0x2A #define Index_VI_Overlay_ChromaKey_Blue_V_Max 0x2B -#define Index_VI_Contrast_Factor 0x2C - +/* Contrast enhancement and brightness control */ +#define Index_VI_Contrast_Factor 0x2C /* obviously unused/undefined */ #define Index_VI_Brightness 0x2D #define Index_VI_Contrast_Enh_Ctrl 0x2E @@ -373,16 +278,269 @@ #define Index_VI_Control_Misc0 0x30 #define Index_VI_Control_Misc1 0x31 #define Index_VI_Control_Misc2 0x32 + +/* TW: Subpicture registers */ +#define Index_VI_SubPict_Buf_Start_Low 0x33 +#define Index_VI_SubPict_Buf_Start_Middle 0x34 +#define Index_VI_SubPict_Buf_Start_High 0x35 + +/* TW: What is this ? */ +#define Index_VI_SubPict_Buf_Preset_Low 0x36 +#define Index_VI_SubPict_Buf_Preset_Middle 0x37 + +/* TW: Subpicture pitch, unit=16 bytes */ +#define Index_VI_SubPict_Buf_Pitch 0x38 + +/* TW: Subpicture scaling control */ +#define Index_VI_SubPict_Hor_Scale_Low 0x39 +#define Index_VI_SubPict_Hor_Scale_High 0x3A +#define Index_VI_SubPict_Vert_Scale_Low 0x3B +#define Index_VI_SubPict_Vert_Scale_High 0x3C + +#define Index_VI_SubPict_Scale_Control 0x3D +/* (0x40 = enable/disable subpicture) */ + +/* TW: Subpicture line buffer control */ +#define Index_VI_SubPict_Threshold 0x3E + +/* TW: What is this? */ +#define Index_VI_FIFO_Max 0x3F + +/* TW: Subpicture palette; 16 colors, total 32 bytes address space */ +#define Index_VI_SubPict_Pal_Base_Low 0x40 +#define Index_VI_SubPict_Pal_Base_High 0x41 + +/* I wish I knew how to use these ... */ +#define Index_MPEG_Read_Ctrl0 0x60 /* MPEG auto flip */ +#define Index_MPEG_Read_Ctrl1 0x61 /* MPEG auto flip */ +#define Index_MPEG_Read_Ctrl2 0x62 /* MPEG auto flip */ +#define Index_MPEG_Read_Ctrl3 0x63 /* MPEG auto flip */ -#define Index_MPEG_Read_Ctrl0 0x60 -#define Index_MPEG_Read_Ctrl1 0x61 -#define Index_MPEG_Read_Ctrl2 0x62 -#define Index_MPEG_Read_Ctrl3 0x63 +/* TW: MPEG AutoFlip scale */ #define Index_MPEG_Ver_Up_Scale_Low 0x64 #define Index_MPEG_Ver_Up_Scale_High 0x65 +#define Index_MPEG_Y_Buf_Preset_Low 0x66 +#define Index_MPEG_Y_Buf_Preset_Middle 0x67 +#define Index_MPEG_UV_Buf_Preset_Low 0x68 +#define Index_MPEG_UV_Buf_Preset_Middle 0x69 +#define Index_MPEG_Y_UV_Buf_Preset_High 0x6A + +/* TW: The following registers only exist on the 310/325 series */ + +/* TW: Bit 16:24 of Y_U_V buf start address (?) */ +#define Index_VI_Y_Buf_Start_Over 0x6B +#define Index_VI_U_Buf_Start_Over 0x6C +#define Index_VI_V_Buf_Start_Over 0x6D + +#define Index_VI_Disp_Y_Buf_Pitch_High 0x6E +#define Index_VI_Disp_UV_Buf_Pitch_High 0x6F + +/* Hue and saturation */ +#define Index_VI_Hue 0x70 +#define Index_VI_Saturation 0x71 + +#define Index_VI_SubPict_Start_Over 0x72 +#define Index_VI_SubPict_Buf_Pitch_High 0x73 + +#define Index_VI_Control_Misc3 0x74 + + +/* TW: Bits (and helpers) for Index_VI_Control_Misc0 */ +#define VI_Misc0_Enable_Overlay 0x02 +#define VI_Misc0_420_Plane_Enable 0x04 /* Select Plane or Packed mode */ +#define VI_Misc0_422_Enable 0x20 /* Select 422 or 411 mode */ +#define VI_Misc0_Fmt_YVU420P 0x0C /* YUV420 Planar (I420, YV12) */ +#define VI_Misc0_Fmt_YUYV 0x28 /* YUYV Packed (YUY2) */ +#define VI_Misc0_Fmt_UYVY 0x08 /* (UYVY) */ + +/* TW: Bits for Index_VI_Control_Misc1 */ +/* #define VI_Misc1_? 0x01 */ +#define VI_Misc1_BOB_Enable 0x02 +#define VI_Misc1_Line_Merge 0x04 +#define VI_Misc1_Field_Mode 0x08 +/* #define VI_Misc1_? 0x10 */ +#define VI_Misc1_Non_Interleave 0x20 /* 300 series only? */ +#define VI_Misc1_Buf_Addr_Lock 0x20 /* 310 series only? */ +/* #define VI_Misc1_? 0x40 */ +/* #define VI_Misc1_? 0x80 */ + +/* TW: Bits for Index_VI_Control_Misc2 */ +#define VI_Misc2_Select_Video2 0x01 +#define VI_Misc2_Video2_On_Top 0x02 +/* #define VI_Misc2_? 0x04 */ +#define VI_Misc2_Vertical_Interpol 0x08 +#define VI_Misc2_Dual_Line_Merge 0x10 +#define VI_Misc2_All_Line_Merge 0x20 /* 310 series only? */ +#define VI_Misc2_Auto_Flip_Enable 0x40 /* 300 series only? */ +#define VI_Misc2_Video_Reg_Write_Enable 0x80 /* 310 series only? */ + +/* TW: Bits for Index_VI_Control_Misc3 */ +#define VI_Misc3_Submit_Video_1 0x01 /* AKA "address ready" */ +#define VI_Misc3_Submit_Video_2 0x02 /* AKA "address ready" */ +#define VI_Misc3_Submit_SubPict 0x04 /* AKA "address ready" */ + +/* TW: Values for Index_VI_Key_Overlay_OP (0x2F) */ +#define VI_ROP_Never 0x00 +#define VI_ROP_DestKey 0x03 +#define VI_ROP_Always 0x0F + + +/* video registers (6326 and 530/620) --------------- */ +#define Index_VI6326_Passwd 0x80 + +/* Video overlay horizontal start/end, unit=screen pixels */ +#define Index_VI6326_Win_Hor_Disp_Start_Low 0x81 +#define Index_VI6326_Win_Hor_Disp_End_Low 0x82 +#define Index_VI6326_Win_Hor_Over 0x83 /* Overflow */ + +/* Video overlay vertical start/end, unit=screen pixels */ +#define Index_VI6326_Win_Ver_Disp_Start_Low 0x84 +#define Index_VI6326_Win_Ver_Disp_End_Low 0x85 +#define Index_VI6326_Win_Ver_Over 0x86 /* Overflow */ + +/* Y Plane (4:2:0) or YUV (4:2:2) buffer start address, unit=dword */ +#define Index_VI6326_Disp_Y_Buf_Start_Low 0x8A +#define Index_VI6326_Disp_Y_Buf_Start_Middle 0x8B +#define Index_VI6326_Disp_Capt_Y_Buf_Start_High 0x89 /* 6326: 7:4 display, 3:0 capture */ + /* 530/620: 7:3 display. 2:0 reserved */ +/* End address of Y plane (in 16k unit) - 6326 ONLY */ +#define Index_VI6326_Disp_Y_End 0x8D + +/* U Plane (4:2:0) buffer start address, unit=dword */ +#define Index_VI6326_U_Buf_Start_Low 0xB7 +#define Index_VI6326_U_Buf_Start_Middle 0xB8 + +/* V Plane (4:2:0) buffer start address, unit=dword */ +#define Index_VI6326_V_Buf_Start_Low 0xBA +#define Index_VI6326_V_Buf_Start_Middle 0xBB + +/* U/V plane start address overflow bits 19:16 */ +#define Index_VI6326_UV_Buf_Start_High 0xB9 + +/* Pitch for Y, UV Planes, unit=dword(6326 & 530/620) */ +#define Index_VI6326_Disp_Y_Buf_Pitch_Low 0x8C /* 7:0 */ +#define Index_VI6326_Disp_Y_Buf_Pitch_High 0x8E /* 11:8 (3:0 here) */ + +#define Index_VI6326_Disp_UV_Buf_Pitch_Low 0xBC /* 7:0 */ +#define Index_VI6326_Disp_UV_Buf_Pitch_High 0xBD /* 11:8 (3:0 here) */ + +/* Scaling control registers */ +#define Index_VI6326_Hor_Scale 0x92 +#define Index_VI6326_Hor_Scale_Integer 0x94 +#define Index_VI6326_Ver_Scale 0x93 + +/* Playback line buffer control */ +#define Index_VI6326_Play_Threshold_Low 0x9E +#define Index_VI6326_Play_Threshold_High 0x9F +#define Index_VI6326_Line_Buffer_Size 0xA0 /* 530 & 6326: quad-word */ + +/* Destination color key */ +#define Index_VI6326_Overlay_ColorKey_Red_Min 0x97 +#define Index_VI6326_Overlay_ColorKey_Green_Min 0x96 +#define Index_VI6326_Overlay_ColorKey_Blue_Min 0x95 +#define Index_VI6326_Overlay_ColorKey_Red_Max 0xA3 +#define Index_VI6326_Overlay_ColorKey_Green_Max 0xA2 +#define Index_VI6326_Overlay_ColorKey_Blue_Max 0xA1 + +/* Source color key */ +#define Index_VI6326_Overlay_ChromaKey_Red_Y_Min 0x9C +#define Index_VI6326_Overlay_ChromaKey_Green_U_Min 0x9B +#define Index_VI6326_Overlay_ChromaKey_Blue_V_Min 0x9A +#define Index_VI6326_Overlay_ChromaKey_Red_Y_Max 0xA6 +#define Index_VI6326_Overlay_ChromaKey_Green_U_Max 0xA5 +#define Index_VI6326_Overlay_ChromaKey_Blue_V_Max 0xA4 + +/* Contrast enhancement and brightness control */ +#define Index_VI6326_Contrast_Factor 0xB3 +#define Index_VI6326_Brightness 0xB4 +#define Index_VI6326_Contrast_Enh_Ctrl 0xB5 + +/* Alpha (ALL 6326 only?) */ +#define Index_VI6326_AlphaGraph 0xA7 +#define Index_VI6326_AlphaVideo 0xA8 + +#define Index_VI6326_Key_Overlay_OP 0xA9 + +#define Index_VI6326_Control_Misc0 0x98 +#define Index_VI6326_Control_Misc1 0x99 /* (Datasheet: 6326 ONLY - not correct?) */ +#define Index_VI6326_Control_Misc3 0x9D +#define Index_VI6326_Control_Misc4 0xB6 +#define Index_VI6326_VideoFormatSelect Index_VI6326_Ver_Scale +#define Index_VI6326_Control_Misc5 0xBE /* (Datasheet: 530/620 ONLY - not correct) */ +#define Index_VI6326_Control_Misc6 0xB2 /* 5597 and 6326 only! */ + +/* TW: What is this? not a register, obviously */ +#define Index_VI6326_FIFO_Max 0x3F + +/* TW: Bits (and helpers) for Index_VI6326_Control_Misc0 */ +#define VI6326_Misc0_EnableCapture 0x01 /* 1 = on, 0 = off (6326 only) */ +#define VI6326_Misc0_EnableOverlay 0x02 /* 1 = on, 0 = off */ +#define VI6326_Misc0_VideoOnly 0x10 /* 1 = video only, 0 = gfx + video */ +#define VI6326_Misc0_CaptureInterlace 0x20 /* 1 = capture data is interlace, 0 = not (6326 only) */ +#define VI6326_Misc0_VideoFormat 0x40 /* 1 = YUV, 0 = RGB */ +#define VI6326_Misc0_FieldPolarity 0x80 /* 1 = *Odd / Even, 0 = Odd / *Even (6326 only) */ + +/* TW: Bits for Index_VI6326_Control_Misc1 (ALL 6326 ONLY) */ +#define VI6326_Misc1_EnableYUVCapture 0x01 /* 0 = RGB, 1 = YUV */ +#define VI6326_Misc1_EnableCaptureDithering 0x02 /* 0 = disable, 1 = enable */ +#define VI6326_Misc1_CaptureFormat555 0x04 /* 1 = 555, 0 = 565 */ +#define VI6326_Misc1_FilterModeMask 0x38 +#define VI6326_Misc1_FilterMode0 0x00 /* 1 */ +#define VI6326_Misc1_FilterMode1 0x08 /* 1/8(1+3z^-1+3z^-2+z^-3)*/ +#define VI6326_Misc1_FilterMode2 0x10 /* 1/4(1+2z^-1+z^-2) */ +#define VI6326_Misc1_FilterMode3 0x18 /* 1/2(1+z^-1) */ +#define VI6326_Misc1_FilterMode4 0x20 /* 1/8(1+2z^-1+2z^-2+2z^-3+z^-4) */ +#define VI6326_Misc1_EnableVBSyncIRQ 0x40 /* 1 = Enable IRQ on vertical blank */ +#define VI6326_Misc1_ClearVBSyncIRQ 0x80 /* Clear pending irq */ + +/* TW: Bits for Index_VI6326_Control_Misc3 */ +#define VI6326_Misc3_UVCaptureFormat 0x01 /* 1 = 2's complement, 0 = CCIR 601 (6326 only) */ +#define VI6326_Misc3_UVOverlayFormat 0x02 /* 1 = 2's complement, 0 = CCIR 601 */ +#define VI6326_Misc3_ChromaKeyFormat 0x04 /* 1 = YUV, 0 = RGB */ +#define VI6326_Misc3_VMIAccess 0x08 /* 1 = enable, 0 = disable (6326 only) */ +#define VI6326_Misc3_VMIEnable 0x10 /* 1 = enable, 0 = disable (6326 only) */ +#define VI6326_Misc3_VMIIRQ 0x20 /* 1 = enable, 0 = disable (6326 only) */ +#define VI6326_Misc3_BT819A 0x40 /* 1 = enable, 0 = disable (6326 only) */ +#define VI6326_Misc3_SystemMemFB 0x80 /* 1 = enable, 0 = disable (6326 only) */ + +/* TW: Bits for Index_VI6326_Control_Misc4 */ +#define VI6326_Misc4_CPUVideoFormatMask 0x03 +#define VI6326_Misc4_CPUVideoFormatRGB555 0x00 +#define VI6326_Misc4_CPUVideoFormatYUV422 0x01 +#define VI6326_Misc4_CPUVideoFormatRGB565 0x02 +#define VI6326_Misc4_EnableYUV420 0x04 /* 1 = enable, 0 = disable */ +/** #define WHATISTHIS 0x40 */ + +/* TW: Bits for Index_VI6326_Control_Misc5 (all 530/620 only) */ +#define VI6326_Misc5_LineBufferMerge 0x10 /* 0 = disable, 1=enable */ +#define VI6326_Misc5_VPlaneBit20 0x04 +#define VI6326_Misc5_UPlaneBit20 0x02 + +/* TW: Bits for Index_VI6326_Control_Misc6 (5597 and 6326 only) */ +#define VI6326_Misc6_Decimation 0x80 /* 0=disable 1=enable video decimation */ + +/* Video format selection */ +#define VI_6326_VideoUYVY422 0x00 +#define VI_6326_VideoVYUY422 0x40 +#define VI_6326_VideoYUYV422 0x80 +#define VI_6326_VideoYVYU422 0xC0 +#define VI_6326_VideoRGB555 0x00 +#define VI_6326_VideoRGB565 0x40 + +/* TW: Values for Index_VI6326_Key_Overlay_OP */ +#define VI6326_ROP_Never 0x00 +#define VI6326_ROP_DestKey 0x03 +#define VI6326_ROP_Always 0x0F + +/* --- end of 6326 video registers ---------------------------------- */ + +/* TW register base (6326 only) */ +#define Index_TV6326_TVOutIndex 0xE0 +#define Index_TV6326_TVOutData 0xE1 + /* - CRT_2 function control register + * CRT_2 function control register --------------------------------- */ #define Index_CRT2_FC_CONTROL 0x00 #define Index_CRT2_FC_SCREEN_HIGH 0x04 @@ -393,6 +551,9 @@ #define Index_CRT2_FC_VCount 0x27 #define Index_CRT2_FC_VCount1 0x28 +#define Index_310_CRT2_FC_VR 0x30 /* d[1] = vertical retrace */ +#define Index_310_CRT2_FC_RT 0x33 /* d[7] = retrace in progress */ + /* video attributes - these should probably be configurable on the fly * so users with different desktop sizes can keep * captured data off the desktop @@ -408,19 +569,8 @@ #define _VIN_FIELD_ODD 2 #define _VIN_FIELD_BOTH 4 -#define vc_index_offset 0x00 -#define vc_data_offset 0x01 -#define vi_index_offset 0x02 -#define vi_data_offset 0x03 -#define crt2_index_offset 0x04 -#define crt2_port_offset 0x05 -#define sr_index_offset 0x44 -#define sr_data_offset 0x45 -#define cr_index_offset 0x54 -#define cr_data_offset 0x55 -#define input_stat 0x5A -/* i2c registers */ +/* i2c registers (TW; not on 300/310/325 series) */ #define X_INDEXREG 0x14 #define X_PORTREG 0x15 #define X_DATA 0x0f @@ -428,5 +578,10 @@ #define I2C_SDA 0x01 #define I2C_DELAY 10 -/* mmio registers */ +/* mmio registers for video */ #define REG_PRIM_CRT_COUNTER 0x8514 + +/* TW: MPEG MMIO registers (630 and later) ----------------------------------------- */ + +/* Not public (yet?) */ + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c:1.5 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c Mon Feb 3 21:44:29 2003 @@ -1,43 +1,48 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.9 2003/02/04 02:44:29 dawes Exp $ */ /* + * Basic hardware and memory detection + * * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holder not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holder makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, + * Mike Chapman <mike@paranoia.com>, * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Thomas Winischhofer <thomas@winischhofer.net> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.5 2001/04/19 12:40:33 alanh Exp $ */ - - + +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86.h" #include "fb.h" #include "xf1bpp.h" #include "xf4bpp.h" -#include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" #include "xf86_ansic.h" #include "xf86Version.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" + +#include "xf86pciBus.h" #include "xf86cmap.h" #include "sis.h" @@ -51,112 +56,473 @@ #define DPMS_SERVER #include "extensions/dpms.h" -static char *dramTypeStr[] = { +static const char *dramTypeStr[] = { "Fast Page DRAM", "2 cycle EDO RAM", "1 cycle EDO RAM", "SDRAM/SGRAM", "SDRAM", "SGRAM", - "ESDRAM" + "ESDRAM", + "DDR RAM", /* for 550/650 */ + "DDR RAM", /* for 550/650 */ "" }; - -static int clockTable[4] = { 66, 75, 83, 100 }; -void SiSSetup(ScrnInfoPtr pScrn); +/* TW: MCLK tables for SiS6326 */ +static const int SiS6326MCLKIndex[4][8] = { + { 10, 12, 14, 16, 17, 18, 19, 7 }, /* SGRAM */ + { 4, 6, 8, 10, 11, 12, 13, 3 }, /* Fast Page */ + { 9, 11, 12, 13, 15, 16, 5, 7 }, /* 2 cycle EDO */ + { 10, 12, 14, 16, 17, 18, 19, 7 } /* ? (Not 1 cycle EDO) */ +}; + +static const struct _sis6326mclk { + CARD16 mclk; + unsigned char sr13; + unsigned char sr28; + unsigned char sr29; +} SiS6326MCLK[] = { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 45, 0, 0x2b, 0x26 }, + { 53, 0, 0x49, 0xe4 }, + { 55, 0, 0x7c, 0xe7 }, + { 56, 0, 0x7c, 0xe7 }, + { 60, 0, 0x42, 0xe3 }, + { 61, 0, 0x21, 0xe1 }, + { 65, 0, 0x5a, 0xe4 }, + { 66, 0, 0x5a, 0xe4 }, + { 70, 0, 0x61, 0xe4 }, + { 75, 0, 0x3e, 0xe2 }, + { 80, 0, 0x42, 0xe2 }, + { 83, 0, 0xb3, 0xc5 }, + { 85, 0, 0x5e, 0xe3 }, + { 90, 0, 0xae, 0xc4 }, + {100, 0, 0x37, 0xe1 }, + {115, 0, 0x78, 0x0e }, + {134, 0, 0x4a, 0xa3 } +}; +/* For 5597, 6326, 530/620 */ static void -sisOldChipSetup(ScrnInfoPtr pScrn) +sisOldSetup(ScrnInfoPtr pScrn) { - int ramsize[4] = {1024, 2048, 4096, 1024}; - - SISPTR(pScrn)->TurboQueue = FALSE; - - outb(VGA_SEQ_INDEX, RAMSize); - pScrn->videoRam = ramsize[inb(VGA_SEQ_DATA) & 3]; -} - -static void -sis530Setup(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - int ramsize[8] = { 1, 2, 4, 0, 0, 2, 4, 8}; - int buswidth[8] = { 0, 64, 64, 0, 0, 32, 32, 64 }; + SISPtr pSiS = SISPTR(pScrn); + int ramsize[8] = { 1, 2, 4, 0, 0, 2, 4, 8}; + int buswidth[8] = {32, 64, 64, 0, 0, 32, 32, 64 }; + int clockTable[4] = { 66, 75, 83, 100 }; + int ramtype[4] = { 5, 0, 1, 3 }; int config; - int temp; - - if (pSiS->Chipset == PCI_CHIP_SIS5597) { - outb(VGA_SEQ_INDEX, FBSize); - pScrn->videoRam = ((inb(VGA_SEQ_DATA) & 7) + 1)*256; - outb(VGA_SEQ_INDEX, Mode64); - if (inb(VGA_SEQ_DATA) & 6) - pScrn->videoRam *= 2; - } else { - outb(VGA_SEQ_INDEX, RAMSize); - temp = inb(VGA_SEQ_DATA); + int temp, i; + unsigned char sr23, sr33, sr34, sr37; +#if 0 + unsigned char newsr13, newsr28, newsr29; +#endif + pciConfigPtr pdptr, *systemPCIdevices = NULL; + + if(pSiS->Chipset == PCI_CHIP_SIS5597) { + inSISIDXREG(SISSR, FBSize, temp); + pScrn->videoRam = ((temp & 0x07) + 1) * 256; + inSISIDXREG(SISSR, Mode64, temp); + if(temp & 0x06) { + pScrn->videoRam *= 2; + pSiS->BusWidth = 64; + } else pSiS->BusWidth = 32; + } else { + inSISIDXREG(SISSR, RAMSize, temp); config = ((temp & 0x10) >> 2 ) | ((temp & 0x6) >> 1); pScrn->videoRam = ramsize[config] * 1024; pSiS->BusWidth = buswidth[config]; } + + if(pSiS->Chipset == PCI_CHIP_SIS530) { + + inSISIDXREG(SISSR, 0x0D, temp); + pSiS->Flags &= ~(UMA); + if(temp & 0x01) { + pSiS->Flags |= UMA; /* TW: Shared fb mode */ + inSISIDXREG(SISSR, 0x10, temp); + pSiS->MemClock = clockTable[temp & 0x03] * 1000; + } else pSiS->MemClock = SiSMclk(pSiS); /* TW: Local fb mode */ + + } else if(pSiS->Chipset == PCI_CHIP_SIS6326) { + + inSISIDXREG(SISSR,0x0e,temp); + i = temp & 0x03; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected DRAM type: %s\n", + dramTypeStr[ramtype[i]]); + + temp = (temp >> 5) & 0x07; + i = SiS6326MCLKIndex[i][temp]; + pSiS->MemClock = SiS6326MCLK[i].mclk; +#if 0 + /* TW: Correct invalid MCLK settings by old BIOSes */ + newsr13 = SiS6326MCLK[i].sr13; + newsr28 = SiS6326MCLK[i].sr28; + newsr29 = SiS6326MCLK[i].sr29; + if((pSiS->ChipRev == 0x92) || + (pSiS->ChipRev == 0xd1) || + (pSiS->ChipRev == 0xd2)) { + if(pSiS->MemClock == 60) { + newsr28 = 0xae; + newsr29 = 0xc4; + } + } +#endif + pSiS->MemClock *= 1000; +#if 0 + inSISIDXREG(SISSR, 0x13, temp); + temp &= 0x80; + temp |= (newsr13 & 0x80); + outSISIDXREG(SISSR,0x13,temp); + outSISIDXREG(SISSR,0x28,newsr28); + outSISIDXREG(SISSR,0x29,newsr29); +#endif - if (pSiS->Chipset == PCI_CHIP_SIS530) { - outb(VGA_SEQ_INDEX, 0x10); - pSiS->MemClock = clockTable[inb(VGA_SEQ_DATA) & 0x03] * 1000; - outb(VGA_SEQ_INDEX, 0x0d); - if (inb(VGA_SEQ_DATA) & 0x01) - pSiS->Flags |= UMA; - } else + } else { + pSiS->MemClock = SiSMclk(pSiS); + } + + pSiS->Flags &= ~(SYNCDRAM | RAMFLAG); + if(pSiS->oldChipset >= OC_SIS82204) { + inSISIDXREG(SISSR, 0x23, sr23); + inSISIDXREG(SISSR, 0x33, sr33); + inSISIDXREG(SISSR, 0x34, sr34); + if(sr33 & 0x09) { /* 5597: Sync DRAM timing | One cycle EDO ram; */ + pSiS->Flags |= (sr33 & SYNCDRAM); /* 6326: Enable SGRam timing | One cycle EDO ram */ + pSiS->Flags |= RAMFLAG; /* 530: Enable SGRAM timing | reserved (0) */ + } else if(sr23 & 0x20) { /* 5597, 6326: EDO DRAM enabled */ + pSiS->Flags |= SYNCDRAM; /* 530/620: reserved (0) */ + } + } + + pSiS->Flags &= ~(ESS137xPRESENT); + if(pSiS->Chipset == PCI_CHIP_SIS530) { + if(pSiS->oldChipset == OC_SIS530A) { + if((systemPCIdevices = xf86GetPciConfigInfo())) { + i = 0; + while((pdptr = systemPCIdevices[i])) { + if((pdptr->pci_vendor == 0x1274) && + ((pdptr->pci_device == 0x5000) || + ((pdptr->pci_device & 0xFFF0) == 0x1370))) { + pSiS->Flags |= ESS137xPRESENT; + break; + } + i++; + } + } + if(pSiS->Flags & ESS137xPRESENT) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS530/620: Found ESS device\n"); + } + } + } + + pSiS->Flags &= ~(SECRETFLAG); + if(pSiS->oldChipset >= OC_SIS5597) { + inSISIDXREG(SISSR, 0x37, sr37); + if(sr37 & 0x80) pSiS->Flags |= SECRETFLAG; + } + + pSiS->Flags &= ~(A6326REVAB); + if(pSiS->Chipset == PCI_CHIP_SIS6326) { + if(((pSiS->ChipRev & 0x0f) == 0x0a) || + ((pSiS->ChipRev & 0x0f) == 0x0b)) { + pSiS->Flags |= A6326REVAB; + } + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected memory clock: %3.3f MHz\n", + pSiS->MemClock/1000.0); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected memory clock : %3.3fMHz\n", pSiS->MemClock/1000.0); + "Detected DRAM bus width: %d bit\n", + pSiS->BusWidth); } static void sis300Setup(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int bus[4] = {32, 64, 128, 32}; + SISPtr pSiS = SISPTR(pScrn); + const int bus[4] = {32, 64, 128, 32}; + const int adaptermclk[8] = { 66, 83, 100, 133, + 100, 100, 100, 100}; + const int adaptermclk300[8] = { 125, 125, 125, 100, + 100, 100, 100, 100}; unsigned int config; + unsigned char temp; + int cpubuswidth; + int from = X_PROBED; pSiS->MemClock = SiSMclk(pSiS); - outb(VGA_SEQ_INDEX, 0x14); - config = inb(VGA_SEQ_DATA); + inSISIDXREG(SISSR, 0x14, config); pScrn->videoRam = ((config & 0x3F) + 1) * 1024; - pSiS->BusWidth =bus[config >> 6]; + cpubuswidth = bus[config >> 6]; + + switch(pSiS->Chipset) { + case PCI_CHIP_SIS300: + pSiS->BusWidth = cpubuswidth; + break; + case PCI_CHIP_SIS540: + pSiS->BusWidth = 64; + from = X_INFO; + break; + case PCI_CHIP_SIS630: + pSiS->BusWidth = 64; + from = X_INFO; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal error: sis300setup() called with invalid chipset!\n"); + pSiS->BusWidth = 64; + from = X_INFO; + } - outb(VGA_SEQ_INDEX, 0x3A); - config = inb(VGA_SEQ_DATA) & 3; + inSISIDXREG(SISSR, 0x3A, config); + config &= 0x03; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected DRAM type: %s\n", + dramTypeStr[config+4]); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected DRAM type : %s\n", dramTypeStr[config+4]); + "Detected memory clock: %3.3f MHz\n", + pSiS->MemClock/1000.0); + + if(pSiS->Chipset == PCI_CHIP_SIS300) { + if(pSiS->ChipRev > 0x13) { + inSISIDXREG(SISSR, 0x3A, temp); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "(Adapter assumes MCLK being %d Mhz)\n", + adaptermclk300[(temp & 0x07)]); + } + } else { + inSISIDXREG(SISSR, 0x1A, temp); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "(Adapter assumes MCLK being %d Mhz)\n", + adaptermclk[(temp & 0x07)]); + } + + xf86DrvMsg(pScrn->scrnIndex, from, + "%s DRAM bus width: %d bit\n", + (from == X_PROBED) ? "Detected" : "Assuming", + pSiS->BusWidth); +} + +/* TW: for 315, 315H, 315PRO, 330 */ +static void +sis310Setup(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int busSDR[4] = {64, 64, 128, 128}; + int busDDR[4] = {32, 32, 64, 64}; + int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2}; + unsigned int config, config1, config2; + char *dramTypeStr310[] = { + "Single Channel 1 rank SDR SDRAM", + "Single Channel 1 rank SDR SGRAM", + "Single Channel 1 rank DDR SDRAM", + "Single Channel 1 rank DDR SGRAM", + "Single Channel 2 rank SDR SDRAM", + "Single Channel 2 rank SDR SGRAM", + "Single Channel 2 rank DDR SDRAM", + "Single Channel 2 rank DDR SGRAM", + "Asymmetric SDR SDRAM", + "Asymmetric SDR SGRAM", + "Asymmetric DDR SDRAM", + "Asymmetric DDR SGRAM", + "Dual channel SDR SDRAM", + "Dual channel SDR SGRAM", + "Dual channel DDR SDRAM", + "Dual channel DDR SGRAM"}; + char *dramTypeStr330[] = { + "Single Channel SDR SDRAM", + "", + "Single Channel DDR SDRAM", + "", + "--unknown--", + "", + "--unknown--", + "", + "Asymetric Dual Channel SDR SDRAM", + "", + "Asymetric Dual Channel DDR SDRAM", + "", + "Dual channel SDR SDRAM", + "", + "Dual channel DDR SDRAM", + ""}; + + inSISIDXREG(SISSR, 0x14, config); + config1 = (config & 0x0C) >> 2; + inSISIDXREG(SISSR, 0x3A, config2); + config2 &= 0x03; + + pScrn->videoRam = (1 << ((config & 0xF0) >> 4)) * 1024; + + if(pSiS->Chipset == PCI_CHIP_SIS330) { + + if(config1) pScrn->videoRam <<= 1; + + } else { + + /* If SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK -> mem * 2 */ + if((config1 == 0x01) || (config1 == 0x03)) + pScrn->videoRam <<= 1; + + /* If DDR asymetric -> mem * 1,5 */ + if(config1 == 0x02) + pScrn->videoRam += pScrn->videoRam/2; + + } + + pSiS->MemClock = SiSMclk(pSiS); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected DRAM type: %s\n", + (pSiS->Chipset == PCI_CHIP_SIS330) ? + dramTypeStr330[(config1 * 4) + (config2 & 0x02)] : + dramTypeStr310[(config1 * 4) + config2]); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected memory clock: %3.3f MHz\n", + pSiS->MemClock/1000.0); + + /* TW: DDR -> mclk * 2 - needed for bandwidth calculation */ + if(pSiS->Chipset == PCI_CHIP_SIS330) { + if(config2 & 0x02) { + pSiS->MemClock *= 2; + if(config1 == 0x02) { + pSiS->BusWidth = busDDRA[0]; + } else { + pSiS->BusWidth = busDDR[(config & 0x02)]; + } + } else { + if(config1 == 0x02) { + pSiS->BusWidth = busDDRA[2]; + } else { + pSiS->BusWidth = busSDR[(config & 0x02)]; + } + } + } else { + if(config2 & 0x02) pSiS->MemClock *= 2; + if(config1 == 0x02) + pSiS->BusWidth = busDDRA[(config & 0x03)]; + else if(config2 & 0x02) + pSiS->BusWidth = busDDR[(config & 0x03)]; + else + pSiS->BusWidth = busSDR[(config & 0x03)]; + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected DRAM bus width: %d bit\n", + pSiS->BusWidth); +} + +/* TW: for 550, 650, 740 */ +static void +sis550Setup(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned int config; + CARD8 pcimemcode; + + /* TW: Some of the following is guessed; however, + since our mode switching code is omniscient + anyway, we only need some reasonable values + to prevent X from deleting modes from the + list + */ + + inSISIDXREG(SISSR, 0x14, config); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected DRAM type: %s\n", + dramTypeStr[(((config & 0x80) >> 7) << 2) + 4]); + + pSiS->MemClock = SiSMclk(pSiS); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected memory clock : %3.3fMHz\n", + "Detected memory clock: %3.3f MHz\n", pSiS->MemClock/1000.0); + + /* TW: DDR -> Mclk * 2 - needed for bandwidth calculation */ + if(config & 0x80) pSiS->MemClock *= 2; + + pSiS->BusWidth = (config & 0x40) ? 128 : 64; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected VRAM bus width is %d\n", pSiS->BusWidth); + "Detected DRAM bus width: %d bit\n", + pSiS->BusWidth); + + pScrn->videoRam = (((config & 0x3F) + 1) * 4) * 1024; + + /* TW: Some 550 BIOSes don't seem to set SR14 correctly. We have + * to read PCI configuration in order to get a correct size. + */ + if (pSiS->Chipset == PCI_CHIP_SIS550) { + if((pScrn->videoRam != 4*1024) && + (pScrn->videoRam != 8*1024) && + (pScrn->videoRam != 16*1024) && + (pScrn->videoRam != 24*1024) && + (pScrn->videoRam != 32*1024) && + (pScrn->videoRam != 48*1024) && + (pScrn->videoRam != 64*1024) && + (pScrn->videoRam != 96*1024) && + (pScrn->videoRam != 128*1024) && + (pScrn->videoRam != 256*1024)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Invalid memory size (%d) encountered, reading PCI configuration\n", + pScrn->videoRam); + pcimemcode = pciReadByte(0x00000000, 0x63); + pScrn->videoRam = (1 << (((pcimemcode & 0x70) >> 4) + 21)) / 1024; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "PCI config reported %dKB video RAM\n", pScrn->videoRam); + } + } } void SiSSetup(ScrnInfoPtr pScrn) { - SISPTR(pScrn)->Flags = 0; + SISPtr pSiS = SISPTR(pScrn); + + pSiS->Flags = 0; + pSiS->VBFlags = 0; - SISPTR(pScrn)->VBFlags = 0; switch (SISPTR(pScrn)->Chipset) { case PCI_CHIP_SIS5597: case PCI_CHIP_SIS6326: case PCI_CHIP_SIS530: - sis530Setup(pScrn); + sisOldSetup(pScrn); break; case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: + case PCI_CHIP_SIS630: /* +730 */ case PCI_CHIP_SIS540: sis300Setup(pScrn); break; + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: + sis310Setup(pScrn); + break; + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: /* + 740 */ + sis550Setup(pScrn); + break; default: - sisOldChipSetup(pScrn); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Internal error: SiSSetup() called with invalid Chipset (0x%x)\n", + pSiS->Chipset); break; } } + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c:1.2 Thu Apr 19 10:11:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c Wed Jan 29 10:42:17 2003 @@ -1,8 +1,11 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.4 2003/01/29 15:42:17 eich Exp $ */ /* * Copyright (c) 1999, The XFree86 Project Inc. * based on code written by Mark Vojkovich <markv@valinux.com> + * + * TW: This module doesn't use CurrentLayout, because it is never + * active when DGA is active and vice versa. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.6 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c Wed Jan 29 10:42:17 2003 @@ -1,4 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.6 2002/01/17 09:57:30 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.10 2003/01/29 15:42:17 eich Exp $ */ +/* + * Video bridge detection and configuration for 300 and 310/325 series + * + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Thomas Winischhofer not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Winischhofer makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS WINISCHHOFER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS WINISCHHOFER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * (Completely rewritten) + */ #include "xf86.h" #include "xf86_ansic.h" @@ -9,148 +35,319 @@ #include "sis_regs.h" #include "sis_vb.h" -/* TW: Detect CRT2-LCD and LCD size */ +static const SiS_LCD_StStruct SiS300_LCD_Type[]= +{ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* 0 - invalid */ + { VB_LCD_800x600, 800, 600, LCD_800x600, 0}, /* 1 */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* 2 */ + { VB_LCD_1280x1024,1280, 1024, LCD_1280x1024, 2}, /* 3 */ + { VB_LCD_1280x960, 1280, 960, LCD_1280x960, 3}, /* 4 */ + { VB_LCD_640x480, 640, 480, LCD_640x480, 4}, /* 5 */ + { VB_LCD_1024x600, 1024, 600, LCD_1024x600, 10}, /* 6 */ + { VB_LCD_1152x768, 1152, 768, LCD_1152x768, 7}, /* 7 */ + { VB_LCD_320x480, 320, 480, LCD_320x480, 6}, /* 8 */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* 9 */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* a */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* b */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* c */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* d */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* e */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* f */ +}; + +static const SiS_LCD_StStruct SiS310_LCD_Type[]= +{ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* 0 - invalid */ + { VB_LCD_800x600, 800, 600, LCD_800x600, 0}, /* 1 */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* 2 */ + { VB_LCD_1280x1024, 1280,1024, LCD_1280x1024, 2}, /* 3 */ + { VB_LCD_640x480, 640, 480, LCD_640x480, 4}, /* 4 */ + { VB_LCD_1024x600, 1024, 600, LCD_1024x600, 10}, /* 5 */ + { VB_LCD_1152x864, 1152, 864, LCD_1152x864, 11}, /* 6 */ + { VB_LCD_1280x960, 1280, 960, LCD_1280x960, 3}, /* 7 */ + { VB_LCD_1152x768, 1152, 768, LCD_1152x768, 7}, /* 8 */ + { VB_LCD_1400x1050, 1400,1050, LCD_1400x1050, 8}, /* 9 */ + { VB_LCD_1280x768, 1280, 768, LCD_1280x768, 9}, /* a */ + { VB_LCD_1600x1200, 1600,1200, LCD_1600x1200, 5}, /* b */ + { VB_LCD_320x480, 320, 480, LCD_320x480, 6}, /* c */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* d */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1}, /* e */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768, 1} /* f */ +}; + +static const char *panelres[] = { + "800x600", + "1024x768", + "1280x1024", + "1280x960", + "640x480", + "1600x1200", + "320x480", + "1152x768", + "1400x1050", + "1280x768", + "1024x600", + "1152x864" +}; + +/* Detect CRT1 */ +void SISCRT1PreInit(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char CR32, SR17; + unsigned char CRT1Detected = 0; + unsigned char OtherDevices = 0; + + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) { + pSiS->CRT1off = 0; + return; + } + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode && pSiS->SecondHead) { + pSiS->CRT1off = 0; + return; + } +#endif + + inSISIDXREG(SISCR, 0x32, CR32); + inSISIDXREG(SISSR, 0x17, SR17); + + if ( (pSiS->VGAEngine == SIS_300_VGA) && + (pSiS->Chipset != PCI_CHIP_SIS300) && + (SR17 & 0x0F) ) { + + if(SR17 & 0x01) CRT1Detected = 1; + if(SR17 & 0x0E) OtherDevices = 1; + + } else { + + if(CR32 & 0x20) CRT1Detected = 1; + if(CR32 & 0x5F) OtherDevices = 1; + + } + + if(pSiS->CRT1off == -1) { + if(!CRT1Detected) { + + /* BIOS detected no CRT1. */ + /* If other devices exist, switch it off */ + if(OtherDevices) pSiS->CRT1off = 1; + else pSiS->CRT1off = 0; + + } else { + + /* BIOS detected CRT1, leave/switch it on */ + pSiS->CRT1off = 0; + + } + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%sCRT1 connection detected\n", + CRT1Detected ? "" : "No "); +} + +/* Detect CRT2-LCD and LCD size */ void SISLCDPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int CR32, SR17, CR36; - - if (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, CR32); - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x17, SR17); - - if ( (SR17 & 0x0F) && (pSiS->Chipset != PCI_CHIP_SIS300) ) { - if ( (SR17 & 0x01) && (!pSiS->CRT1off) ) - pSiS->CRT1off = 0; - else { - if (SR17 & 0x0E) - pSiS->CRT1off = 1; - else - pSiS->CRT1off = 0; - } - if (SR17 & 0x02) - pSiS->VBFlags |= CRT2_LCD; + unsigned char CR32, SR17, CR36, CR37; + USHORT textindex; + + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) { + return; + } + + inSISIDXREG(SISCR, 0x32, CR32); + inSISIDXREG(SISSR, 0x17, SR17); + + if( (pSiS->VGAEngine == SIS_300_VGA) && + (pSiS->Chipset != PCI_CHIP_SIS300) && + (SR17 & 0x0F) ) { + if(SR17 & 0x02) + pSiS->VBFlags |= CRT2_LCD; } else { - if ( (CR32 & 0x20) && (!pSiS->CRT1off) ) - pSiS->CRT1off = 0; - else { - if (CR32 & 0x5F) - pSiS->CRT1off = 1; - else - pSiS->CRT1off = 0; - } - if (CR32 & 0x08) - pSiS->VBFlags |= CRT2_LCD; - } - - if (pSiS->VBFlags & CRT2_LCD) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, CR36); - switch (CR36) { - case 1: - pSiS->VBFlags |= LCD_800x600; - pSiS->LCDheight = 600; - break; - case 2: - pSiS->VBFlags |= LCD_1024x768; - pSiS->LCDheight = 768; - break; - case 3: - pSiS->VBFlags |= LCD_1280x1024; - pSiS->LCDheight = 1024; - break; - case 4: - pSiS->VBFlags |= LCD_1280x960; /* TW */ - pSiS->LCDheight = 960; - break; - case 5: - pSiS->VBFlags |= LCD_640x480; /* TW */ - pSiS->LCDheight = 480; - break; - default: - pSiS->VBFlags |= LCD_1024x768; /* TW */ - pSiS->LCDheight = 768; - break; + if(CR32 & 0x08) + pSiS->VBFlags |= CRT2_LCD; + } + + if(pSiS->VBFlags & CRT2_LCD) { + inSISIDXREG(SISCR, 0x36, CR36); + inSISIDXREG(SISCR, 0x37, CR37); + if((pSiS->VGAEngine == SIS_315_VGA) && (!CR36)) { + /* TW: Old 650/301LV BIOS version "forgot" to set CR36, CR37 */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS-provided LCD information invalid, probing myself...\n"); + if(pSiS->VBFlags & VB_LVDS) pSiS->SiS_Pr->SiS_IF_DEF_LVDS = 1; + else pSiS->SiS_Pr->SiS_IF_DEF_LVDS = 0; + SiS_GetPanelID(pSiS->SiS_Pr, &pSiS->sishw_ext); + inSISIDXREG(SISCR, 0x36, CR36); + inSISIDXREG(SISCR, 0x37, CR37); + } + if(pSiS->VGAEngine == SIS_300_VGA) { + pSiS->VBLCDFlags |= SiS300_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag; + pSiS->LCDheight = SiS300_LCD_Type[(CR36 & 0x0f)].LCDheight; + pSiS->LCDwidth = SiS300_LCD_Type[(CR36 & 0x0f)].LCDwidth; + pSiS->sishw_ext.ulCRT2LCDType = SiS300_LCD_Type[(CR36 & 0x0f)].LCDtype; + textindex = SiS300_LCD_Type[(CR36 & 0x0f)].LCDrestextindex; + } else { + pSiS->VBLCDFlags |= SiS310_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag; + pSiS->LCDheight = SiS310_LCD_Type[(CR36 & 0x0f)].LCDheight; + pSiS->LCDwidth = SiS310_LCD_Type[(CR36 & 0x0f)].LCDwidth; + pSiS->sishw_ext.ulCRT2LCDType = SiS310_LCD_Type[(CR36 & 0x0f)].LCDtype; + textindex = SiS310_LCD_Type[(CR36 & 0x0f)].LCDrestextindex; } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD panel resolution %s (type %d, %s%s)\n", + panelres[textindex], + (pSiS->VGAEngine == SIS_315_VGA) ? ((CR36 & 0x0f) - 1) : ((CR36 & 0xf0) >> 4), + (pSiS->VBFlags & VB_LVDS) ? + (CR37 & 0x10 ? "non-expanding, " : "expanding, ") : + ( ((pSiS->VBFlags & VB_301B) && (pSiS->VGAEngine == SIS_300_VGA)) ? + (CR37 & 0x10 ? "non-expanding, " : "expanding, ") : + (CR37 & 0x10 ? "self-scaling, " : "non-self-scaling, ") ), + CR37 & 0x01 ? "RGB18" : "RGB24"); } } - -/* TW: Detect CRT2-TV connector type and PAL/NTSC flag */ + +/* Detect CRT2-TV connector type and PAL/NTSC flag */ void SISTVPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int CR32, CR38, SR16, SR17; - - if (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, CR32); - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x17, SR17); - - if ( (SR17 & 0x0F) && (pSiS->Chipset != PCI_CHIP_SIS300) ) { - if (SR17 & 0x04) /* { */ /* TW: Determine TV type even if not using TV output */ - pSiS->VBFlags |= CRT2_TV; - - if (SR17 & 0x20) - pSiS->VBFlags |= TV_SVIDEO; - else if (SR17 & 0x10) - pSiS->VBFlags |= TV_AVIDEO; - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x16, SR16); - if (SR16 & 0x20) - pSiS->VBFlags |= TV_PAL; - else - pSiS->VBFlags |= TV_NTSC; - /* } */ - } else { - if (CR32 & 0x47) /* { */ - pSiS->VBFlags |= CRT2_TV; - if (CR32 & 0x04) - pSiS->VBFlags |= TV_SCART; - else if (CR32 & 0x02) - pSiS->VBFlags |= TV_SVIDEO; - else if (CR32 & 0x01) - pSiS->VBFlags |= TV_AVIDEO; - else if (CR32 & 0x40) - pSiS->VBFlags |= (TV_SVIDEO | TV_HIVISION); - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, CR38); - if (CR38 & 0x01) - pSiS->VBFlags |= TV_PAL; - else - pSiS->VBFlags |= TV_NTSC; - /* } */ - } - - /* TW: This is old code: */ - - /* TW: Reading PAL/NTSC flag from 0x31 is not a good idea. We'd - * better read this from POWER_ON_TRAP (0x38) some day. */ -#if 0 - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); - if (temp & 0x01) - pSiS->VBFlags |= TV_PAL; - else - pSiS->VBFlags |= TV_NTSC; + unsigned char SR16, SR17, SR38, CR32, CR38=0, CR79; + int temp = 0; + + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) + return; + + inSISIDXREG(SISCR, 0x32, CR32); + inSISIDXREG(SISSR, 0x17, SR17); + inSISIDXREG(SISSR, 0x16, SR16); + inSISIDXREG(SISSR, 0x38, SR38); + switch(pSiS->VGAEngine) { + case SIS_300_VGA: + if(pSiS->Chipset != PCI_CHIP_SIS300) temp = 0x35; + break; + case SIS_315_VGA: + temp = 0x38; + break; + } + if(temp) { + inSISIDXREG(SISCR, temp, CR38); + } + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "(vb.c: SR17=%02x CR32=%02x)\n", SR17, CR32); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "(vb.c: SR16=%02x SR38=%02x)\n", SR16, SR38); #endif + + if( (pSiS->VGAEngine == SIS_300_VGA) && + (pSiS->Chipset != PCI_CHIP_SIS300) && + (SR17 & 0x0F) ) { + + if(SR17 & 0x04) + pSiS->VBFlags |= CRT2_TV; + + if(SR17 & 0x20) + pSiS->VBFlags |= TV_SVIDEO; + else if (SR17 & 0x10) + pSiS->VBFlags |= TV_AVIDEO; + + if(pSiS->VBFlags & (TV_SVIDEO | TV_AVIDEO)) { + if(SR16 & 0x20) + pSiS->VBFlags |= TV_PAL; + else + pSiS->VBFlags |= TV_NTSC; + } + + } else { + + if(CR32 & 0x47) + pSiS->VBFlags |= CRT2_TV; + + if(CR32 & 0x04) + pSiS->VBFlags |= TV_SCART; + else if(CR32 & 0x02) + pSiS->VBFlags |= TV_SVIDEO; + else if(CR32 & 0x01) + pSiS->VBFlags |= TV_AVIDEO; + else if(CR32 & 0x40) + pSiS->VBFlags |= (TV_SVIDEO | TV_HIVISION); + else if((CR38 & 0x04) && (pSiS->VBFlags & VB_CHRONTEL)) + pSiS->VBFlags |= (TV_CHSCART | TV_PAL); + else if((CR38 & 0x08) && (pSiS->VBFlags & VB_CHRONTEL)) + pSiS->VBFlags |= (TV_CHHDTV | TV_NTSC); + + if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION)) { + if( (pSiS->Chipset == PCI_CHIP_SIS550) || /* TW: ? */ + (pSiS->Chipset == PCI_CHIP_SIS650) ) { + inSISIDXREG(SISCR, 0x79, CR79); + if(CR79 & 0x20) { + pSiS->VBFlags |= TV_PAL; + if(CR38 & 0x40) pSiS->VBFlags |= TV_PALM; + else if(CR38 & 0x80) pSiS->VBFlags |= TV_PALN; + } else + pSiS->VBFlags |= TV_NTSC; + } else if(pSiS->VGAEngine == SIS_300_VGA) { + /* TW: Should be SR38 here as well, but this + * does not work. Looks like a BIOS bug (2.04.5c). + */ + if(SR16 & 0x20) + pSiS->VBFlags |= TV_PAL; + else + pSiS->VBFlags |= TV_NTSC; + } else { /* 315, 330 */ + if(SR38 & 0x01) { + pSiS->VBFlags |= TV_PAL; + if(CR38 & 0x40) pSiS->VBFlags |= TV_PALM; + else if(CR38 & 0x80) pSiS->VBFlags |= TV_PALN; + } else + pSiS->VBFlags |= TV_NTSC; + } + } + } + if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART | TV_CHHDTV)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%sTV standard %s\n", + (pSiS->VBFlags & (TV_CHSCART | TV_CHHDTV)) ? "Using " : "Detected default ", + (pSiS->VBFlags & TV_NTSC) ? + ((pSiS->VBFlags & TV_CHHDTV) ? "480i HDTV" : "NTSC") : + ((pSiS->VBFlags & TV_PALM) ? "PALM" : + ((pSiS->VBFlags & TV_PALN) ? "PALN" : "PAL"))); + } } - - /* TW: Detect CRT2-VGA */ - void SISCRT2PreInit(ScrnInfoPtr pScrn) + +/* Detect CRT2-VGA */ +void SISCRT2PreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int SR17, CR32; - + unsigned char SR17, CR32; + if (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, CR32); - inSISIDXREG(pSiS->RelIO+SROFFSET, 0x17, SR17); - - if ( (SR17 & 0x0F) && (pSiS->Chipset != PCI_CHIP_SIS300) ) { - if (SR17 & 0x08) - pSiS->VBFlags |= CRT2_VGA; + return; + + /* CRT2-VGA not supported on LVDS and 30xLV(X) */ + if (pSiS->VBFlags & (VB_LVDS|VB_30xLV|VB_30xLVX)) + return; + + inSISIDXREG(SISCR, 0x32, CR32); + inSISIDXREG(SISSR, 0x17, SR17); + + if( (pSiS->VGAEngine == SIS_300_VGA) && + (pSiS->Chipset != PCI_CHIP_SIS300) && + (SR17 & 0x0F) ) { + + if(SR17 & 0x08) + pSiS->VBFlags |= CRT2_VGA; + } else { - if (CR32 & 0x10) - pSiS->VBFlags |= CRT2_VGA; + + if(CR32 & 0x10) + pSiS->VBFlags |= CRT2_VGA; + } } + + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.5 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h Wed Jan 29 10:42:17 2003 @@ -1,33 +1,43 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.5 2002/01/17 09:57:30 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.7 2003/01/29 15:42:17 eich Exp $ */ +/* + * Video bridge detection and configuration for 300 and 310/325 series + * + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Thomas Winischhofer not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Winischhofer makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS WINISCHHOFER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS WINISCHHOFER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * (Completely rewritten) + */ -/* CR30 VBInfo = CR31:CR30 */ -#define SET_SIMU_SCAN_MODE 0x0001 -#define SWITCH_TO_CRT2 0x0002 -#define SET_CRT2_TO_AVIDEO 0x0004 /* Composite */ -#define SET_CRT2_TO_SVIDEO 0x0008 -#define SET_CRT2_TO_SCART 0x0010 -#define SET_CRT2_TO_LCD 0x0020 -#define SET_CRT2_TO_RAMDAC 0x0040 -#define SET_CRT2_TO_HIVISION_TV 0x0080 -#define SET_CRT2_TO_TV (SET_CRT2_TO_AVIDEO | SET_CRT2_TO_SVIDEO | \ - SET_CRT2_TO_SCART | SET_CRT2_TO_HIVISION_TV) -/* CR31 */ -#define SET_PAL_TV 0x0100 -#define SET_IN_SLAVE_MODE 0x0200 -#define SET_NO_SIMU_ON_LOCK 0x0400 -#define SET_NO_SIMU_TV_ON_LOCK SET_NO_SIMU_ON_LOCK -#define DISABLE_LOAD_CRT2DAC 0x1000 -#define DISABLE_CRT2_DISPLAY 0x2000 -#define DRIVER_MODE 0x4000 +typedef struct _SiS_LCD_StStruct +{ + ULONG VBLCD_lcdflag; + USHORT LCDwidth; + USHORT LCDheight; + USHORT LCDtype; + UCHAR LCDrestextindex; +} SiS_LCD_StStruct; -typedef struct _SiS301Reg { - CARD8 *VBPart1; - CARD8 *VBPart2; - CARD8 *VBPart3; - CARD8 *VBPart4; -} SiS301RegRec, SiS301RegPtr; - - +void SISCRT1PreInit(ScrnInfoPtr pScrn); void SISLCDPreInit(ScrnInfoPtr pScrn); void SISTVPreInit(ScrnInfoPtr pScrn); void SISCRT2PreInit(ScrnInfoPtr pScrn); + +extern BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.12 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c Wed Jan 29 10:42:17 2003 @@ -1,19 +1,23 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.16 2003/01/29 15:42:17 eich Exp $ */ /* + * Mode setup and video bridge detection + * * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Parts Copyright 2001, 2002 by Thomas Winischhofer, Vienna, Austria. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in + * documentation, and that the name of the copyright holder not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations + * specific, written prior permission. The copyright holder makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR @@ -21,11 +25,11 @@ * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, + * Juanjo Santamarta <santamarta@ctv.es>, * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * David Thomas <davtom@dream.org.uk>. + * Thomas Winischhofer <thomas@winischhofer.net> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.12 2002/01/17 09:57:30 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -38,652 +42,1494 @@ #include "sis_regs.h" #include "sis_dac.h" -#define Midx 0 -#define Nidx 1 -#define VLDidx 2 -#define Pidx 3 -#define PSNidx 4 -#define Fref 14318180 +#define Midx 0 +#define Nidx 1 +#define VLDidx 2 +#define Pidx 3 +#define PSNidx 4 +#define Fref 14318180 /* stability constraints for internal VCO -- MAX_VCO also determines * the maximum Video pixel clock */ -#define MIN_VCO Fref -#define MAX_VCO 135000000 +#define MIN_VCO Fref +#define MAX_VCO 135000000 #define MAX_VCO_5597 353000000 -#define MAX_PSN 0 /* no pre scaler for this chip */ -#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ +#define MAX_PSN 0 /* no pre scaler for this chip */ +#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ -void SISVGAPreInit(ScrnInfoPtr pScrn); -static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -static Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode); +static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode); +/* TW: To be used internally only */ +int SISDoSense(ScrnInfoPtr pScrn, int tempbl, int tempbh, int tempcl, int tempch); +void SISSense30x(ScrnInfoPtr pScrn); +int SIS6326DoSense(ScrnInfoPtr pScrn, int tempbh, int tempbl, int tempch, int tempcl); +void SISSense6326(ScrnInfoPtr pScrn); +static void SiS6326TVDelay(ScrnInfoPtr pScrn, int delay); + +const CARD8 SiS6326TVRegs1_NTSC[6][14] = { + {0x81,0x3f,0x49,0x1b,0xa9,0x03,0x00,0x09,0x08,0x7d,0x00,0x88,0x30,0x60}, + {0x81,0x3f,0x49,0x1d,0xa0,0x03,0x00,0x09,0x08,0x7d,0x00,0x88,0x30,0x60}, + {0x81,0x45,0x24,0x8e,0x26,0x0b,0x00,0x09,0x02,0xfe,0x00,0x09,0x51,0x60}, + {0x81,0x45,0x24,0x8e,0x26,0x07,0x00,0x29,0x04,0x30,0x10,0x3b,0x61,0x60}, + {0x81,0x3f,0x24,0x8e,0x26,0x09,0x00,0x09,0x02,0x30,0x10,0x3b,0x51,0x60}, + {0x83,0x5d,0x21,0xbe,0x75,0x03,0x00,0x09,0x08,0x42,0x10,0x4d,0x61,0x79} /* 640x480u */ +}; + +const CARD8 SiS6326TVRegs2_NTSC[6][54] = { + {0x11, 0x17, 0x03, 0x09, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, + 0x0C, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, + 0xFC, 0xDF, 0x94, 0x1F, 0x4A, 0x03, 0x71, 0x07, 0x97, 0x10, 0x40, + 0x48, 0x00, 0x26, 0xB6, 0x10, 0x5C, 0xEC, 0x21, 0x2E, 0xBE, 0x10, + 0x64, 0xF4, 0x21, 0x13, 0x75, 0x08, 0x31, 0x6A, 0x01, 0xA0}, + {0x11, 0x17, 0x03, 0x0A, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, + 0x0D, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, + 0xFF, 0xDF, 0x94, 0x1F, 0x4A, 0x03, 0x71, 0x07, 0x97, 0x10, 0x40, + 0x48, 0x00, 0x26, 0xB6, 0x10, 0x5C, 0xEC, 0x21, 0x2E, 0xBE, 0x10, + 0x64, 0xF4, 0x21, 0x13, 0x75, 0x08, 0x31, 0x6A, 0x01, 0xA0}, + {0x11, 0x17, 0x03, 0x0A, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, + 0x0D, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, + 0xFF, 0xDF, 0x94, 0x3F, 0x8C, 0x06, 0xCE, 0x07, 0x27, 0x30, 0x73, + 0x7B, 0x00, 0x48, 0x68, 0x30, 0xB2, 0xD2, 0x52, 0x50, 0x70, 0x30, + 0xBA, 0xDA, 0x52, 0xDC, 0x02, 0xD1, 0x53, 0xF7, 0x02, 0xA0}, + {0x11, 0x17, 0x03, 0x09, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, + 0x0C, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, + 0xDC, 0xDF, 0x94, 0x3F, 0x8C, 0x06, 0xCE, 0x07, 0x27, 0x30, 0x73, + 0x7B, 0x00, 0x48, 0x68, 0x30, 0xB2, 0xD2, 0x52, 0x50, 0x70, 0x30, + 0xBA, 0xDA, 0x52, 0x00, 0x02, 0xF5, 0x53, 0xF7, 0x02, 0xA0}, + {0x11, 0x17, 0x03, 0x09, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, + 0x0C, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, + 0xDC, 0xDF, 0x94, 0x3F, 0x8C, 0x06, 0xCE, 0x07, 0x27, 0x30, 0x73, + 0x7B, 0x00, 0x48, 0x68, 0x30, 0xB2, 0xD2, 0x52, 0x50, 0x70, 0x30, + 0xBA, 0xDA, 0x52, 0xDC, 0x02, 0xD1, 0x53, 0xF7, 0x02, 0xA0}, + {0x11, 0x17, 0x03, 0x09, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, /* 640x480u */ + 0x0C, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, + 0xDC, 0xDF, 0x94, 0xAF, 0x95, 0x06, 0xDD, 0x07, 0x5F, 0x30, 0x7E, + 0x86, 0x00, 0x4C, 0xA4, 0x30, 0xE3, 0x3B, 0x62, 0x54, 0xAC, 0x30, + 0xEB, 0x43, 0x62, 0x48, 0x34, 0x3D, 0x63, 0x29, 0x03, 0xA0} +}; + +const CARD8 SiS6326TVRegs1_PAL[6][14] = { + {0x81,0x2d,0xc8,0x07,0xb2,0x0b,0x00,0x09,0x02,0xed,0x00,0xf8,0x30,0x40}, + {0x80,0x2d,0xa4,0x03,0xd9,0x0b,0x00,0x09,0x02,0xed,0x10,0xf8,0x71,0x40}, + {0x81,0x2d,0xa4,0x03,0xd9,0x0b,0x00,0x09,0x02,0xed,0x10,0xf8,0x71,0x40}, + {0x81,0x2d,0xa4,0x03,0xd9,0x0b,0x00,0x09,0x02,0x8f,0x10,0x9a,0x71,0x40}, + {0x83,0x63,0xa1,0x7a,0xa3,0x0a,0x00,0x09,0x02,0xb5,0x11,0xc0,0x81,0x59}, /* 800x600u */ + {0x81,0x63,0xa4,0x03,0xd9,0x01,0x00,0x09,0x10,0x9f,0x10,0xaa,0x71,0x59} /* 720x540 */ +}; + +const CARD8 SiS6326TVRegs2_PAL[6][54] = { + {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, + 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, + 0xE5, 0xDF, 0x94, 0xEF, 0x5A, 0x03, 0x7F, 0x07, 0xFF, 0x10, 0x4E, + 0x56, 0x00, 0x2B, 0x23, 0x20, 0xB4, 0xAC, 0x31, 0x33, 0x2B, 0x20, + 0xBC, 0xB4, 0x31, 0x83, 0xE1, 0x78, 0x31, 0xD6, 0x01, 0xA0}, + {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, + 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, + 0xE5, 0xDF, 0x94, 0xDF, 0xB2, 0x07, 0xFB, 0x07, 0xF7, 0x30, 0x90, + 0x98, 0x00, 0x4F, 0x3F, 0x40, 0x62, 0x52, 0x73, 0x57, 0x47, 0x40, + 0x6A, 0x5A, 0x73, 0x03, 0xC1, 0xF8, 0x63, 0xB6, 0x03, 0xA0}, + {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, + 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, + 0xE5, 0xDF, 0x94, 0xDF, 0xB2, 0x07, 0xFB, 0x07, 0xF7, 0x30, 0x90, + 0x98, 0x00, 0x4F, 0x3F, 0x40, 0x62, 0x52, 0x73, 0x57, 0x47, 0x40, + 0x6A, 0x5A, 0x73, 0x03, 0xC1, 0xF8, 0x63, 0xB6, 0x03, 0xA0}, + {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, + 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, + 0xE5, 0xDF, 0x94, 0xDF, 0xB2, 0x07, 0xFB, 0x07, 0xF7, 0x30, 0x90, + 0x98, 0x00, 0x4F, 0x3F, 0x40, 0x62, 0x52, 0x73, 0x57, 0x47, 0x40, + 0x6A, 0x5A, 0x73, 0xA0, 0xC1, 0x95, 0x73, 0xB6, 0x03, 0xA0}, + {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, /* 800x600u */ + 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, + 0xE5, 0xDF, 0x94, 0x7F, 0xBD, 0x08, 0x0E, 0x07, 0x47, 0x40, 0x9D, + 0xA5, 0x00, 0x54, 0x94, 0x40, 0xA4, 0xE4, 0x73, 0x5C, 0x9C, 0x40, + 0xAC, 0xEC, 0x73, 0x0B, 0x0E, 0x00, 0x84, 0x03, 0x04, 0xA0}, + {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, /* 720x540 */ + 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, + 0xE5, 0xDF, 0x94, 0xDF, 0xB0, 0x07, 0xFB, 0x07, 0xF7, 0x30, 0x9D, + 0xA5, 0x00, 0x4F, 0x3F, 0x40, 0x62, 0x52, 0x73, 0x57, 0x47, 0x40, + 0x6A, 0x5A, 0x73, 0xA0, 0xC1, 0x95, 0x73, 0xB6, 0x03, 0xA0} +}; + +const CARD8 SiS6326TVRegs1[14] = { + 0x00,0x01,0x02,0x03,0x04,0x11,0x12,0x13,0x21,0x26,0x27,0x3a,0x3c,0x43 +}; + +const CARD8 SiS6326CR[9][15] = { + {0x79,0x63,0x64,0x1d,0x6a,0x93,0x00,0x6f,0xf0,0x58,0x8a,0x57,0x57,0x70,0x20}, /* PAL 800x600 */ + {0x79,0x4f,0x50,0x95,0x60,0x93,0x00,0x6f,0xba,0x14,0x86,0xdf,0xe0,0x30,0x00}, /* PAL 640x480 */ + {0x5f,0x4f,0x50,0x82,0x53,0x9f,0x00,0x0b,0x3e,0xe9,0x8b,0xdf,0xe7,0x04,0x00}, /* NTSC 640x480 */ + {0x5f,0x4f,0x50,0x82,0x53,0x9f,0x00,0x0b,0x3e,0xcb,0x8d,0x8f,0x96,0xe9,0x00}, /* NTSC 640x400 */ + {0x83,0x63,0x64,0x1f,0x6d,0x9b,0x00,0x6f,0xf0,0x48,0x0a,0x23,0x57,0x70,0x20}, /* PAL 800x600u */ + {0x79,0x59,0x5b,0x1d,0x66,0x93,0x00,0x6f,0xf0,0x42,0x04,0x1b,0x40,0x70,0x20}, /* PAL 720x540 */ + {0x66,0x4f,0x51,0x0a,0x57,0x89,0x00,0x0b,0x3e,0xd9,0x0b,0xb6,0xe7,0x04,0x00}, /* NTSC 640x480u */ + {0xce,0x9f,0x9f,0x92,0xa4,0x16,0x00,0x28,0x5a,0x00,0x04,0xff,0xff,0x29,0x39}, /* 1280x1024-75 */ + {0x09,0xc7,0xc7,0x0d,0xd2,0x0a,0x01,0xe0,0x10,0xb0,0x04,0xaf,0xaf,0xe1,0x1f} /* 1600x1200-60 */ +}; +/* Initialize a display mode on 5597/5598, 6326 and 530/620 */ static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; - vgaRegPtr vgaReg = &VGAHWPTR(pScrn)->ModeReg; - int gap, safetymargin, MemBand; - int vgaIOBase; - unsigned char temp; - int Base,mclk; - int offset; - int clock = mode->Clock; - unsigned int vclk[5]; - unsigned short CRT_CPUthresholdLow ; - unsigned short CRT_CPUthresholdHigh ; - unsigned short CRT_ENGthreshold ; - - int num, denum, div, sbit, scale; + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr pReg = &pSiS->ModeReg; + vgaRegPtr vgaReg = &VGAHWPTR(pScrn)->ModeReg; + unsigned char temp; + int mclk = pSiS->MemClock; + int offset; + int clock = mode->Clock; + int width = mode->HDisplay; + int height = mode->VDisplay; + int rate = SiSCalcVRate(mode); + int buswidth = pSiS->BusWidth; + unsigned int vclk[5]; + unsigned short CRT_CPUthresholdLow; + unsigned short CRT_CPUthresholdHigh; + unsigned short CRT_ENGthreshold; + double a, b, c; + int d, factor; + int num, denum, div, sbit, scale; + BOOL sis6326tvmode, sis6326himode; PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "SISInit()\n")); - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + /* Save the registers for further processing */ (*pSiS->SiSSave)(pScrn, pReg); - pSiS->scrnOffset = pScrn->displayWidth * pScrn->bitsPerPixel / 8; + /* TW: Determine if chosen mode is suitable for TV on the 6326 + and if the mode is one of our special hi-res modes. + */ + sis6326tvmode = FALSE; + sis6326himode = FALSE; + if(pSiS->Chipset == PCI_CHIP_SIS6326) { + if(pSiS->SiS6326Flags & SIS6326_HASTV) { + if((pSiS->SiS6326Flags & SIS6326_TVDETECTED) && + ((strcmp(mode->name, "PAL800x600") == 0) || /* TW: Special TV modes */ + (strcmp(mode->name, "PAL800x600U") == 0) || + (strcmp(mode->name, "PAL720x540") == 0) || + (strcmp(mode->name, "PAL640x480") == 0) || + (strcmp(mode->name, "NTSC640x480") == 0) || + (strcmp(mode->name, "NTSC640x480U") == 0) || + (strcmp(mode->name, "NTSC640x400") == 0))) { + sis6326tvmode = TRUE; + } else { + pReg->sis6326tv[0x00] &= 0xfb; + } + } + if((strcmp(mode->name, "SIS1280x1024-75") == 0) || /* TW: Special high-res modes */ + (strcmp(mode->name, "SIS1600x1200-60") == 0)) { + sis6326himode = TRUE; + } + } - outw(VGA_SEQ_INDEX, 0x8605); +#ifdef UNLOCK_ALWAYS + outSISIDXREG(SISSR, 0x05, 0x86); +#endif pReg->sisRegs3C4[0x06] &= 0x01; - - if ((mode->Flags & V_INTERLACE)==0) { - offset = pScrn->displayWidth >> 3; - pReg->sisRegs3C4[0x06] &= 0xDF; + + /* set interlace */ + if(!(mode->Flags & V_INTERLACE)) { + offset = pSiS->CurrentLayout.displayWidth >> 3; } else { - offset = pScrn->displayWidth >> 2; + offset = pSiS->CurrentLayout.displayWidth >> 2; pReg->sisRegs3C4[0x06] |= 0x20; } + + /* Enable Linear and Enhanced Gfx Mode */ + pReg->sisRegs3C4[0x06] |= 0x82; - /* Enable Linear */ - switch (pSiS->Chipset) { + /* Enable MMIO at PCI Register 14H (D[6:5]: 11) */ + pReg->sisRegs3C4[0x0B] |= 0x60; + + /* Enable 32bit mem access (D7), read-ahead cache (D4) */ + pReg->sisRegs3C4[0x0C] |= 0xA0; + + /* TW: Some speed-up stuff */ + switch(pSiS->Chipset) { case PCI_CHIP_SIS5597: + /* TW: enable host bus */ + if(pSiS->NoHostBus) { + pReg->sisRegs3C4[0x34] &= ~0x08; + } else { + pReg->sisRegs3C4[0x34] |= 0x08; + } + /* TW: fall through */ case PCI_CHIP_SIS6326: - case PCI_CHIP_SIS530: - pReg->sisRegs3C4[BankReg] |= 0x82; - pReg->sisRegs3C4[0x0C] |= 0xA0; - pReg->sisRegs3C4[0x0B] |= 0x60; - break; - default: - pReg->sisRegs3C4[BankReg] |= 0x82; + case PCI_CHIP_SIS530: + /* TW: Enable "dual segment register mode" (D2) and "i/o gating while + * write buffer is not empty" (D3) + */ + pReg->sisRegs3C4[0x0B] |= 0x0C; } - switch (pScrn->bitsPerPixel) { + /* set colordepth */ + if(pSiS->Chipset == PCI_CHIP_SIS530) { + pReg->sisRegs3C4[0x09] &= 0x7F; + } + switch(pSiS->CurrentLayout.bitsPerPixel) { case 8: break; - case 15: - offset <<= 1; - pReg->sisRegs3C4[BankReg] |= 0x04; - break; case 16: - offset <<= 1; - pReg->sisRegs3C4[BankReg] |= 0x08; + offset <<= 1; + if(pSiS->CurrentLayout.depth == 15) + pReg->sisRegs3C4[0x06] |= 0x04; + else + pReg->sisRegs3C4[0x06] |= 0x08; break; case 24: offset += (offset << 1); - pReg->sisRegs3C4[BankReg] |= 0x10; - pReg->sisRegs3C4[MMIOEnable] |= 0x90; + pReg->sisRegs3C4[0x06] |= 0x10; + pReg->sisRegs3C4[0x0B] |= 0x90; break; case 32: - offset <<= 2; - if (pSiS->Chipset == PCI_CHIP_SIS530) { - pReg->sisRegs3C4[BankReg] |= 0x10; - pReg->sisRegs3C4[MMIOEnable] |= 0x90; - pReg->sisRegs3C4[0x09] |= 0x80; - } else { - return FALSE; - } + if(pSiS->Chipset == PCI_CHIP_SIS530) { + offset <<= 2; + pReg->sisRegs3C4[0x06] |= 0x10; + pReg->sisRegs3C4[0x0B] |= 0x90; + pReg->sisRegs3C4[0x09] |= 0x80; + } else return FALSE; break; } - switch (pScrn->videoRam) { + + /* save screen pitch for acceleration functions */ + pSiS->scrnOffset = pSiS->CurrentLayout.displayWidth * + ((pSiS->CurrentLayout.bitsPerPixel + 7) / 8); + + /* set linear framebuffer addresses */ + switch(pScrn->videoRam) { case 512: - temp = 0x00; - break; + temp = 0x00; break; case 1024: - temp = 0x20; - break; + temp = 0x20; break; case 2048: - temp = 0x40; - break; + temp = 0x40; break; case 4096: - temp = 0x60; - break; + temp = 0x60; break; case 8192: - temp = 0x80; - break; + temp = 0x80; break; default: temp = 0x20; - } - switch (pSiS->Chipset) { - case PCI_CHIP_SG86C225: - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - pReg->sisRegs3C4[LinearAdd0] = (pSiS->FbAddress & 0x07F80000) >> 19; - pReg->sisRegs3C4[LinearAdd1] =((pSiS->FbAddress & 0xF8000000) >> 27) - | temp; /* Enable linear with max 4M */ - break; - case PCI_CHIP_SIS530: - pReg->sisRegs3C4[LinearAdd0] = (pSiS->FbAddress & 0x07F80000) >> 19; - pReg->sisRegs3C4[LinearAdd1] =((pSiS->FbAddress & 0xF8000000) >> 27) - | temp; /* Enable linear with max 8M */ - break; } + pReg->sisRegs3C4[0x20] = (pSiS->FbAddress & 0x07F80000) >> 19; + pReg->sisRegs3C4[0x21] = ((pSiS->FbAddress & 0xF8000000) >> 27) | temp; - /* Screen Offset */ + /* Set screen offset */ vgaReg->CRTC[0x13] = offset & 0xFF; - pReg->sisRegs3C4[CRTCOff] = ((offset & 0xF00) >> 4) | - (((mode->CrtcVTotal-2) & 0x400) >> 10 ) | - (((mode->CrtcVDisplay-1) & 0x400) >> 9 ) | - (((mode->CrtcVSyncStart-1) & 0x400) >> 8 ) | - (((mode->CrtcVSyncStart) & 0x400) >> 7 ) ; - - /* Extended Horizontal Overflow Register */ - pReg->sisRegs3C4[0x12] &= 0xE0; - pReg->sisRegs3C4[0x12] |= ( - (((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8 | - (((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7 | - (((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6 | - ((mode->CrtcHSyncStart >> 3) & 0x100) >> 5 | - (((mode->CrtcHBlankEnd >> 3) -1) & 0x40) >> 2); -/* ((mode->CrtcHSyncEnd >> 3) & 0x40) >> 2); */ + + /* Set CR registers for our built-in TV and hi-res modes */ + if((sis6326tvmode) || (sis6326himode)) { + + int index,i; + + /* TW: We need our very private data for hi-res and TV modes */ + if(sis6326himode) { + if(strcmp(mode->name, "SIS1280x1024-75") == 0) index = 7; + else index = 8; + } else { + if(pSiS->SiS6326Flags & SIS6326_TVPAL) { + switch(width) { + case 800: + if((strcmp(mode->name, "PAL800x600U") == 0)) + index = 4; + else + index = 0; + break; + case 720: + index = 5; + break; + case 640: + default: + index = 1; + } + } else { + switch(height) { + case 400: + index = 3; + break; + case 480: + default: + if((strcmp(mode->name, "NTSC640x480U") == 0)) + index = 6; + else + index = 2; + } + } + } + for(i=0; i<=5; i++) { + vgaReg->CRTC[i] = SiS6326CR[index][i]; + } + pReg->sisRegs3C4[0x12] = SiS6326CR[index][6]; + vgaReg->CRTC[6] = SiS6326CR[index][7]; + vgaReg->CRTC[7] = SiS6326CR[index][8]; + vgaReg->CRTC[0x10] = SiS6326CR[index][9]; + vgaReg->CRTC[0x11] = SiS6326CR[index][10]; + vgaReg->CRTC[0x12] = SiS6326CR[index][11]; + vgaReg->CRTC[0x15] = SiS6326CR[index][12]; + vgaReg->CRTC[0x16] = SiS6326CR[index][13]; + vgaReg->CRTC[9] &= ~0x20; + vgaReg->CRTC[9] |= (SiS6326CR[index][14] & 0x20); + pReg->sisRegs3C4[0x0A] = ((offset & 0xF00) >> 4) | (SiS6326CR[index][14] & 0x0f); + + } else { + + /* Set extended vertical overflow register */ + pReg->sisRegs3C4[0x0A] = ((offset & 0xF00) >> 4) | + (((mode->CrtcVTotal-2) & 0x400) >> 10 ) | + (((mode->CrtcVDisplay-1) & 0x400) >> 9 ) | +/* (((mode->CrtcVSyncStart-1) & 0x400) >> 8 ) | */ + (((mode->CrtcVBlankStart-1)& 0x400) >> 8 ) | +/* (((mode->CrtcVBlankStart-1)& 0x400) >> 7 ); */ + (((mode->CrtcVSyncStart) & 0x400) >> 7 ); + + /* Set extended horizontal overflow register */ + pReg->sisRegs3C4[0x12] &= 0xE0; + pReg->sisRegs3C4[0x12] |= ( + (((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8 | + (((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7 | +/* (((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6 | */ + (((mode->CrtcHBlankStart >> 3) - 1) & 0x100) >> 6 | + ((mode->CrtcHSyncStart >> 3) & 0x100) >> 5 | + (((mode->CrtcHBlankEnd >> 3) - 1) & 0x40) >> 2); + } - if (mode->CrtcVDisplay > 1024) - /* disable line compare */ +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "HDisplay %d HSyncStart %d HSyncEnd %d HTotal %d\n", + mode->CrtcHDisplay, mode->CrtcHSyncStart, + mode->CrtcHSyncEnd, mode->CrtcHTotal); + xf86DrvMsg(0, X_INFO, "HBlankSt %d HBlankE %d\n", + mode->CrtcHBlankStart, mode->CrtcHBlankEnd); + + xf86DrvMsg(0, X_INFO, "VDisplay %d VSyncStart %d VSyncEnd %d VTotal %d\n", + mode->CrtcVDisplay, mode->CrtcVSyncStart, + mode->CrtcVSyncEnd, mode->CrtcVTotal); + xf86DrvMsg(0, X_INFO, "VBlankSt %d VBlankE %d\n", + mode->CrtcVBlankStart, mode->CrtcVBlankEnd); +#endif + + /* enable (or disable) line compare */ + if(mode->CrtcVDisplay >= 1024) pReg->sisRegs3C4[0x38] |= 0x04; else pReg->sisRegs3C4[0x38] &= 0xFB; - if (( pScrn->depth == 24) || (pScrn->depth == 32) || - (mode->CrtcHDisplay >= 1280)) - /* Enable high speed DCLK */ - pReg->sisRegs3C4[0x3E] |= 1; - else - pReg->sisRegs3C4[0x3E] &= 0xFE; + /* Enable (or disable) high speed DCLK (some 6326 and 530/620 only) */ + if( ( (pSiS->Chipset == PCI_CHIP_SIS6326) && + ( (pSiS->ChipRev == 0xd0) || (pSiS->ChipRev == 0xd1) || + (pSiS->ChipRev == 0xd2) || (pSiS->ChipRev == 0x92) || + (pSiS->Flags & A6326REVAB) ) ) || + (pSiS->oldChipset > OC_SIS6326) ) { + if( (pSiS->CurrentLayout.bitsPerPixel == 24) || + (pSiS->CurrentLayout.bitsPerPixel == 32) || + (mode->CrtcHDisplay >= 1280) ) + pReg->sisRegs3C4[0x3E] |= 0x01; + else + pReg->sisRegs3C4[0x3E] &= 0xFE; + } + /* We use the internal VCLK */ + pReg->sisRegs3C4[0x38] &= 0xFC; - /* Set vclk */ - if (SiScompute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { - switch (pSiS->Chipset) { - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - case PCI_CHIP_SIS530: - pReg->sisRegs3C4[XR2A] = (num - 1) & 0x7f ; - pReg->sisRegs3C4[XR2A] |= (div == 2) ? 0x80 : 0; - pReg->sisRegs3C4[XR2B] = ((denum -1) & 0x1f); - pReg->sisRegs3C4[XR2B] |= (((scale -1)&3) << 5); - /* When set VCLK, you should set SR13 first */ - if (sbit) - pReg->sisRegs3C4[ClockBase] |= 0x40; - else - pReg->sisRegs3C4[ClockBase] &= 0xBF; - - break; + /* Set VCLK */ + if((sis6326tvmode) || (sis6326himode)) { + /* TW: For our built-in modes, the calculation is not suitable */ + if(sis6326himode) { + if((strcmp(mode->name, "SIS1280x1024-75") == 0)) { + pReg->sisRegs3C4[0x2A] = 0x5d; /* 1280x1024-75 */ + pReg->sisRegs3C4[0x2B] = 0xa4; + } else { + pReg->sisRegs3C4[0x2A] = 0x59; /* 1600x1200-60 */ + pReg->sisRegs3C4[0x2B] = 0xa3; } - } - else { - /* if SiScompute_vclk cannot handle the request clock try sisCalcClock! */ + pReg->sisRegs3C4[0x13] &= ~0x40; + } else { + if(pSiS->SiS6326Flags & SIS6326_TVPAL) { + /* PAL: 31.500 Mhz */ + if((strcmp(mode->name, "PAL800x600U") == 0)) { + pReg->sisRegs3C4[0x2A] = 0x46; + pReg->sisRegs3C4[0x2B] = 0x49; + } else { + pReg->sisRegs3C4[0x2A] = 0xab; + pReg->sisRegs3C4[0x2B] = 0xe9; + } + pReg->sisRegs3C4[0x13] &= ~0x40; + } else { + /* NTSC: 27.000 Mhz */ + if((strcmp(mode->name, "NTSC640x480U") == 0)) { + pReg->sisRegs3C4[0x2A] = 0x5a; + pReg->sisRegs3C4[0x2B] = 0x65; + } else { + pReg->sisRegs3C4[0x2A] = 0x29; + pReg->sisRegs3C4[0x2B] = 0xe2; + } + pReg->sisRegs3C4[0x13] |= 0x40; + } + } + } else if(SiS_compute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { + pReg->sisRegs3C4[0x2A] = (num - 1) & 0x7f ; + pReg->sisRegs3C4[0x2A] |= (div == 2) ? 0x80 : 0; + pReg->sisRegs3C4[0x2B] = ((denum - 1) & 0x1f); + pReg->sisRegs3C4[0x2B] |= (((scale -1) & 3) << 5); + + /* When setting VCLK, we should set SR13 first */ + if(sbit) + pReg->sisRegs3C4[0x13] |= 0x40; + else + pReg->sisRegs3C4[0x13] &= 0xBF; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "2a: %x 2b: %x 13: %x clock %d\n", + pReg->sisRegs3C4[0x2A], pReg->sisRegs3C4[0x2B], pReg->sisRegs3C4[0x13], clock); +#endif + + } else { + /* if SiS_compute_vclk cannot handle the requested clock, try sisCalcClock */ SiSCalcClock(pScrn, clock, 2, vclk); - switch (pSiS->Chipset) { - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - case PCI_CHIP_SIS530: - pReg->sisRegs3C4[XR2A] = (vclk[Midx] - 1) & 0x7f ; - pReg->sisRegs3C4[XR2A] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; - - /* bits [4:0] contain denumerator -MC */ - pReg->sisRegs3C4[XR2B] = (vclk[Nidx] -1) & 0x1f ; - - if (vclk[Pidx] <= 4){ - /* postscale 1,2,3,4 */ - pReg->sisRegs3C4[XR2B] |= (vclk[Pidx] -1 ) << 5 ; - pReg->sisRegs3C4[ClockBase] &= 0xBF; - } else { - /* postscale 6,8 */ - pReg->sisRegs3C4[XR2B] |= ((vclk[Pidx] / 2) -1 ) << 5 ; - pReg->sisRegs3C4[ClockBase] |= 0x40; - } - pReg->sisRegs3C4[XR2B] |= 0x80 ; /* gain for high frequency */ - break; - } - } /* end of set vclk */ + + pReg->sisRegs3C4[0x2A] = (vclk[Midx] - 1) & 0x7f; + pReg->sisRegs3C4[0x2A] |= ((vclk[VLDidx] == 2) ? 1 : 0) << 7; - if (clock > 135000) - pReg->sisRegs3C4[ClockReg] |= 0x02; + /* bits [4:0] contain denumerator */ + pReg->sisRegs3C4[0x2B] = (vclk[Nidx] - 1) & 0x1f; - /* pReg->sisRegs3C2 = inb(0x3CC) | 0x0C;*/ /* Programmable Clock */ - pReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c) | 0x0C; /* Programmable Clock */ + if (vclk[Pidx] <= 4){ + /* postscale 1,2,3,4 */ + pReg->sisRegs3C4[0x2B] |= (vclk[Pidx] - 1) << 5; + pReg->sisRegs3C4[0x13] &= 0xBF; + } else { + /* postscale 6,8 */ + pReg->sisRegs3C4[0x2B] |= ((vclk[Pidx] / 2) - 1) << 5; + pReg->sisRegs3C4[0x13] |= 0x40; + } + pReg->sisRegs3C4[0x2B] |= 0x80 ; /* gain for high frequency */ + } - if (pSiS->FastVram && ((pSiS->Chipset == PCI_CHIP_SIS530) || - (pSiS->Chipset == PCI_CHIP_SIS6326) || - (pSiS->Chipset == PCI_CHIP_SIS5597))) - pReg->sisRegs3C4[ExtMiscCont5]|= 0xC0; - else - pReg->sisRegs3C4[ExtMiscCont5]&= ~0xC0; + /* High speed DAC */ + if(clock > 135000) + pReg->sisRegs3C4[0x07] |= 0x02; + + /* Programmable Clock */ + pReg->sisRegs3C2 = inb(SISMISCR) | 0x0C; + + /* 1 or 2 cycle DRAM (set by option FastVram) */ + if(pSiS->newFastVram == -1) { + pReg->sisRegs3C4[0x34] |= 0x80; + pReg->sisRegs3C4[0x34] &= ~0x40; + } else if(pSiS->newFastVram == 1) + pReg->sisRegs3C4[0x34] |= 0xC0; + else + pReg->sisRegs3C4[0x34] &= ~0xC0; + /* Logical line length */ pSiS->ValidWidth = TRUE; - if ((pSiS->Chipset == PCI_CHIP_SIS5597) || - (pSiS->Chipset == PCI_CHIP_SIS6326) || - (pSiS->Chipset == PCI_CHIP_SIS530)) - { - pReg->sisRegs3C4[GraphEng] &= 0xCF; /* Clear logical width bits */ - if (pScrn->bitsPerPixel == 24) { - pReg->sisRegs3C4[GraphEng] |= 0x30; /* Invalid logical width */ - pSiS->ValidWidth = FALSE; - } - else { - switch ( pScrn->virtualX * (pScrn->bitsPerPixel >> 3) ) { - case 1024: - pReg->sisRegs3C4[GraphEng] |= 0x00; /* | 00 = No change */ - break; - case 2048: - pReg->sisRegs3C4[GraphEng] |= 0x10; - break; - case 4096: - pReg->sisRegs3C4[GraphEng] |= 0x20; - break; - default: - /* Invalid logical width */ - pReg->sisRegs3C4[GraphEng] = 0x30; - pSiS->ValidWidth = FALSE; - break; - } - } + pReg->sisRegs3C4[0x27] &= 0xCF; + if(pSiS->CurrentLayout.bitsPerPixel == 24) { + /* Invalid logical width */ + pReg->sisRegs3C4[0x27] |= 0x30; + pSiS->ValidWidth = FALSE; + } else { + switch(pScrn->virtualX * (pSiS->CurrentLayout.bitsPerPixel >> 3)) { + case 1024: + pReg->sisRegs3C4[0x27] |= 0x00; + break; + case 2048: + pReg->sisRegs3C4[0x27] |= 0x10; + break; + case 4096: + pReg->sisRegs3C4[0x27] |= 0x20; + break; + default: + /* Invalid logical width */ + pReg->sisRegs3C4[0x27] |= 0x30; + pSiS->ValidWidth = FALSE; + break; + } } - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "virtualX = %d depth = %d Logical width = %d\n", - pScrn->virtualX, pScrn->bitsPerPixel, - pScrn->virtualX * pScrn->bitsPerPixel/8)); - if (!pSiS->NoAccel) { - switch (pSiS->Chipset) { - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - case PCI_CHIP_SIS530: - pReg->sisRegs3C4[GraphEng] |= 0x40; - if (pSiS->TurboQueue) { - pReg->sisRegs3C4[GraphEng] |= 0x80; - /* All Queue for 2D */ - pReg->sisRegs3C4[ExtMiscCont9] &= 0xFC; - if (pSiS->HWCursor) - pReg->sisRegs3C4[TurboQueueBase] = (pScrn->videoRam/32) - 2; - else - pReg->sisRegs3C4[TurboQueueBase] = (pScrn->videoRam/32) - 1; - } - pReg->sisRegs3C4[MMIOEnable] |= 0x60; /* At PCI base */ - pReg->sisRegs3C4[Mode64] |= 0x80; - break; - } + /* Acceleration stuff */ + if(!pSiS->NoAccel) { + pReg->sisRegs3C4[0x27] |= 0x40; /* Enable engine programming registers */ + if( (pSiS->TurboQueue) && /* Handle TurboQueue */ + ( (pSiS->Chipset != PCI_CHIP_SIS530) || + (pSiS->CurrentLayout.bitsPerPixel != 24) ) ) { + pReg->sisRegs3C4[0x27] |= 0x80; /* Enable TQ */ + if((pSiS->Chipset == PCI_CHIP_SIS530) || + ((pSiS->Chipset == PCI_CHIP_SIS6326 && + (pSiS->ChipRev == 0xd0 || pSiS->ChipRev == 0xd1 || + pSiS->ChipRev == 0xd2 || pSiS->ChipRev == 0x92 || + pSiS->ChipRev == 0x0a || pSiS->ChipRev == 0x1a || + pSiS->ChipRev == 0x2a || pSiS->ChipRev == 0x0b || + pSiS->ChipRev == 0x1b || pSiS->ChipRev == 0x2b) ) ) ) { + /* pReg->sisRegs3C4[0x3D] |= 0x80; */ /* Queue is 62K (530/620 specs) */ + pReg->sisRegs3C4[0x3D] &= 0x7F; /* Queue is 30K (530/620 specs) */ + } + /* TW: Locate the TQ at the beginning of the last 64K block of + * video RAM. The address is to be specified in 32K steps. + */ + pReg->sisRegs3C4[0x2C] = (pScrn->videoRam - 64) / 32; + if(pSiS->Chipset != PCI_CHIP_SIS530) { /* 530/620: Reserved (don't touch) */ + pReg->sisRegs3C4[0x3C] &= 0xFC; /* 6326: Queue is all for 2D */ + } /* 5597: Must be 0 */ + } else { + pReg->sisRegs3C4[0x27] &= 0x7F; + } + } + + /* TW: No idea what this does. The Windows driver does it, so we do it as well */ + if(pSiS->Chipset == PCI_CHIP_SIS6326) { + if((pSiS->ChipRev == 0xd0) || (pSiS->ChipRev == 0xd1) || + (pSiS->ChipRev == 0xd2) || (pSiS->ChipRev == 0x92) || + (pSiS->Flags & A6326REVAB)) { + if((pSiS->Flags & (SYNCDRAM | RAMFLAG)) == (SYNCDRAM | RAMFLAG)) { + if(!(pReg->sisRegs3C4[0x0E] & 0x03)) { + pReg->sisRegs3C4[0x3E] |= 0x02; + } + } + } } + - /* Set memclock */ - if ((pSiS->Chipset == PCI_CHIP_SIS5597) || (pSiS->Chipset == PCI_CHIP_SIS6326)) { - if (pSiS->MemClock > 66000) { + /* Set memclock */ +#if 0 + /* TW: We don't need to do this; the SetMClk option was not used since 4.0. */ + if((pSiS->Chipset == PCI_CHIP_SIS5597) || (pSiS->Chipset == PCI_CHIP_SIS6326)) { + if(pSiS->MemClock > 66000) { SiSCalcClock(pScrn, pSiS->MemClock, 1, vclk); - - pReg->sisRegs3C4[MemClock0] = (vclk[Midx] - 1) & 0x7f ; - pReg->sisRegs3C4[MemClock0] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; - pReg->sisRegs3C4[MemClock1] = (vclk[Nidx] -1) & 0x1f ; /* bits [4:0] contain denumerator -MC */ - if (vclk[Pidx] <= 4){ - pReg->sisRegs3C4[MemClock1] |= (vclk[Pidx] -1 ) << 5 ; /* postscale 1,2,3,4 */ - pReg->sisRegs3C4[ClockBase] &= 0x7F; + + pReg->sisRegs3C4[0x28] = (vclk[Midx] - 1) & 0x7f ; + pReg->sisRegs3C4[0x28] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; + pReg->sisRegs3C4[0x29] = (vclk[Nidx] -1) & 0x1f ; /* bits [4:0] contain denumerator -MC */ + if(vclk[Pidx] <= 4) { + pReg->sisRegs3C4[0x29] |= (vclk[Pidx] - 1) << 5 ; /* postscale 1,2,3,4 */ + pReg->sisRegs3C4[0x13] &= 0x7F; } else { - pReg->sisRegs3C4[MemClock1] |= ((vclk[Pidx] / 2) -1 ) << 5 ; /* postscale 6,8 */ - pReg->sisRegs3C4[ClockBase] |= 0x80; + pReg->sisRegs3C4[0x29] |= ((vclk[Pidx] / 2) - 1) << 5 ; /* postscale 6,8 */ + pReg->sisRegs3C4[0x13] |= 0x80; } - -#if 1 /* Check programmed memory clock. Enable only to check the above code */ - mclk=14318*((pReg->sisRegs3C4[MemClock0] & 0x7f)+1); - mclk=mclk/((pReg->sisRegs3C4[MemClock1] & 0x0f)+1); - Base = pReg->sisRegs3C4[ClockBase]; - if ( (Base & 0x80)==0 ) { - mclk = mclk / (((pReg->sisRegs3C4[MemClock1] & 0x60) >> 5)+1); - } else { - if ((pReg->sisRegs3C4[MemClock1] & 0x60) == 0x40) { mclk=mclk/6;} - if ((pReg->sisRegs3C4[MemClock1] & 0x60) == 0x60) { mclk=mclk/8;} + /* Check programmed memory clock. Enable only to check the above code */ +/* + mclk = 14318 * ((pReg->sisRegs3C4[0x28] & 0x7f) + 1); + mclk /= ((pReg->sisRegs3C4[0x29] & 0x0f) + 1); + if(!(pReg->sisRegs3C4[0x13] & 0x80)) { + mclk /= (((pReg->sisRegs3C4[0x29] & 0x60) >> 5) + 1); + } else { + if ((pReg->sisRegs3C4[0x29] & 0x60) == 0x40) mclk /= 6; + if ((pReg->sisRegs3C4[0x29] & 0x60) == 0x60) mclk /= 8; } xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,2, - "Setting memory clock to %.3f MHz\n", - mclk/1000.0); -#endif + "Setting memory clock to %.3f MHz\n", + mclk/1000.0); +*/ } } +#endif - /* set threshold value */ - switch (pSiS->Chipset) { - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - MemBand = SiSMemBandWidth(pScrn) / 10 ; - safetymargin = 1; - gap = 4; - - CRT_ENGthreshold = 0x0F; - CRT_CPUthresholdLow = ((pScrn->depth*clock) / - MemBand)+safetymargin; - CRT_CPUthresholdHigh =((pScrn->depth*clock) / - MemBand)+gap+safetymargin; - - if ( CRT_CPUthresholdLow > (pScrn->depth < 24 ? 0xe:0x0d) ) { - CRT_CPUthresholdLow = (pScrn->depth < 24 ? 0xe:0x0d); - } - - if ( CRT_CPUthresholdHigh > (pScrn->depth < 24 ? 0x10:0x0f) ) { - CRT_CPUthresholdHigh = (pScrn->depth < 24 ? 0x10:0x0f); - } - - pReg->sisRegs3C4[CPUThreshold] = (CRT_ENGthreshold & 0x0F) | - (CRT_CPUthresholdLow & 0x0F)<<4 ; - pReg->sisRegs3C4[CRTThreshold] = CRT_CPUthresholdHigh & 0x0F; + /* TW: set threshold values (rewritten) */ + /* + * CPU/CRT Threshold: FIFO + * MCLK ___________ VCLK + * cpu/engine <---o o--------->|___________| -----------> CRT + * ^ ^ ^ ^ + * \ / | | + * \ / |< gap >| + * \ / | | + * selector switch Thrsh. low high + * + * CRT consumes the data in the FIFO during scanline display. When the + * amount of data in the FIFO reaches the Threshold low value, the selector + * switch will switch to the right, and the FIFO will be refilled with data. + * When the amount of data in the FIFO reaches the Threshold high value, the + * selector switch will switch to the left and allows the CPU and the chip + * engines to access video RAM. + * + * The Threshold low values should be increased at higher bpps, simply because + * there is more data needed for the CRT. When Threshold low and high are very + * close to each other, the selector switch will be activated more often, which + * decreases performance. + * + */ + switch(pSiS->Chipset) { + case PCI_CHIP_SIS5597: factor = 65; break; + case PCI_CHIP_SIS6326: factor = 30; break; + case PCI_CHIP_SIS530: factor = (pSiS->Flags & UMA) ? 60 : 30; break; + default: factor = (pScrn->videoRam > (1024*1024)) ? 24 : 12; + } + a = width * height * rate * 1.40 * factor * ((pSiS->CurrentLayout.bitsPerPixel + 1) / 8); + b = (mclk / 1000) * 999488.0 * (buswidth / 8); + c = ((a / b) + 1.0) / 2; + d = (int)c + 2; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, + "Debug: w %d h %d r %d mclk %d bus %d factor %d bpp %d\n", + width, height, rate, mclk/1000, buswidth, factor, + pSiS->CurrentLayout.bitsPerPixel); + xf86DrvMsg(0, X_INFO, "Debug: a %f b %f c %f d %d (flags %x)\n", + a, b, c, d, pSiS->Flags); +#endif - break; - case PCI_CHIP_SIS530: - (*pSiS->SetThreshold)(pScrn, mode, &CRT_CPUthresholdLow, - &CRT_CPUthresholdHigh); - pReg->sisRegs3C4[8] = (CRT_CPUthresholdLow & 0xf) << 4 | 0xF; - pReg->sisRegs3C4[9] &= 0xF0; - pReg->sisRegs3C4[9] |= (CRT_CPUthresholdHigh & 0xF); - pReg->sisRegs3C4[0x3F] &= 0xE3; - pReg->sisRegs3C4[0x3F] |= (CRT_CPUthresholdHigh & 0x10) | - (CRT_CPUthresholdLow & 0x10) >> 2 | - 0x08; - break; + CRT_CPUthresholdLow = d; + if((pSiS->Flags & (RAMFLAG | SYNCDRAM)) == (RAMFLAG | SYNCDRAM)) { + CRT_CPUthresholdLow += 2; + } + CRT_CPUthresholdHigh = CRT_CPUthresholdLow + 3; + + CRT_ENGthreshold = 0x0F; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Debug: Thlow %d thhigh %d\n", + CRT_CPUthresholdLow, CRT_CPUthresholdHigh); +#endif + +#if 0 /* TW: See comment in sis_dac.c on why this is commented */ + if(pSiS->Chipset == PCI_CHIP_SIS530) { + if((pSiS->oldChipset == OC_SIS530A) && + (pSiS->Flags & UMA) && + (mclk == 100000) && + (pSiS->Flags & ESS137xPRESENT)) { + if(!(pSiS->Flags & SECRETFLAG)) index = 0; + if((temp = SiS_CalcSpecial530Threshold(pSiS, mode, index)) { + CRT_CPUthresholdLow = temp; + break; + } + } + } +#endif + + switch(pSiS->Chipset) { + case PCI_CHIP_SIS530: + if(CRT_CPUthresholdLow > 0x1f) CRT_CPUthresholdLow = 0x1f; + CRT_CPUthresholdHigh = 0x1f; + break; + case PCI_CHIP_SIS5597: + case PCI_CHIP_SIS6326: + default: + if(CRT_CPUthresholdLow > 0x0f) CRT_CPUthresholdLow = 0x0f; + if(CRT_CPUthresholdHigh > 0x0f) CRT_CPUthresholdHigh = 0x0f; + } + + pReg->sisRegs3C4[0x08] = ((CRT_CPUthresholdLow & 0x0F) << 4) | + (CRT_ENGthreshold & 0x0F); + + pReg->sisRegs3C4[0x09] &= 0xF0; + pReg->sisRegs3C4[0x09] |= (CRT_CPUthresholdHigh & 0x0F); + + pReg->sisRegs3C4[0x3F] &= 0xEB; + pReg->sisRegs3C4[0x3F] |= (CRT_CPUthresholdHigh & 0x10) | + ((CRT_CPUthresholdLow & 0x10) >> 2); + + if(pSiS->oldChipset >= OC_SIS530A) { + pReg->sisRegs3C4[0x3F] &= 0xDF; + pReg->sisRegs3C4[0x3F] |= 0x58; } + /* TW: Set SiS6326 TV registers */ + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (sis6326tvmode)) { + unsigned char tmp; + int index=0, i, j, k; + + if(pSiS->SiS6326Flags & SIS6326_TVPAL) { + pReg->sisRegs3C4[0x0D] |= 0x04; + switch(width) { + case 800: + if((strcmp(mode->name, "PAL800x600U") == 0)) index = 4; + else index = 3; + break; + case 720: + index = 5; + break; + case 640: + default: + index = 2; + break; + } + for(i=0; i<14; i++) { + pReg->sis6326tv[SiS6326TVRegs1[i]] = SiS6326TVRegs1_PAL[index][i]; + } + } else { + pReg->sisRegs3C4[0x0D] &= ~0x04; + if((strcmp(mode->name, "NTSC640x480U") == 0)) index = 5; + else index = 4; + for(i=0; i<14; i++) { + pReg->sis6326tv[SiS6326TVRegs1[i]] = SiS6326TVRegs1_NTSC[index][i]; + } + } + tmp = pReg->sis6326tv[0x43]; + if(pSiS->SiS6326Flags & SIS6326_TVCVBS) tmp |= 0x10; + tmp |= 0x08; + pReg->sis6326tv[0x43] = tmp; + j = 0; k = 0; + for(i=0; i<=0x44; i++) { + if(SiS6326TVRegs1[j] == i) { + j++; + continue; + } + if(pSiS->SiS6326Flags & SIS6326_TVPAL) { + tmp = SiS6326TVRegs2_PAL[index][k]; + } else { + tmp = SiS6326TVRegs2_NTSC[index][k]; + } + pReg->sis6326tv[i] = tmp; + k++; + } + pReg->sis6326tv[0x43] |= 0x08; + if((pSiS->ChipRev == 0xc1) || (pSiS->ChipRev == 0xc2)) { + pReg->sis6326tv[0x43] &= ~0x08; + } + + tmp = pReg->sis6326tv[0]; + tmp |= 0x18; + if(pSiS->SiS6326Flags & SIS6326_TVCVBS) tmp &= ~0x10; + else tmp &= ~0x08; + tmp |= 0x04; + pReg->sis6326tv[0] = tmp; + } + return(TRUE); } -/* TW: Initialize various regs for mode. This is done to - * structure, not hardware. (SiSRestore would write - * structure to hardware registers.) - * This function is not used on SiS300, 540, 630 (unless - * VESA is used for mode switching); on these chips, - * the BIOS emulation (sis_bioc.s) does the job. +/* TW: Init a mode for SiS 300 and 310/325 series + * The original intention of the followling procedure was + * to initialize various registers for the selected mode. + * This was actually done to a structure, not the hardware. + * (SiSRestore would write the structure to the hardware + * registers.) + * This function is now only used for setting up some + * variables (eg. scrnOffset). */ Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) { - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; - vgaRegPtr vgaReg = &VGAHWPTR(pScrn)->ModeReg; - int vgaIOBase; - unsigned short temp; - int offset=0; - int clock = mode->Clock; - unsigned int vclk[5]; + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr pReg = &pSiS->ModeReg; + unsigned short temp; - int num, denum, div, sbit, scale; - unsigned short Threshold_Low, Threshold_High; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SIS300Init()\n"); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "virtualX = %d depth = %d Logical width = %d\n", - pScrn->virtualX, pScrn->bitsPerPixel, - pScrn->virtualX * pScrn->bitsPerPixel/8); - - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + pScrn->virtualX, pSiS->CurrentLayout.bitsPerPixel, + pScrn->virtualX * pSiS->CurrentLayout.bitsPerPixel/8); + /* Copy current register settings to structure */ (*pSiS->SiSSave)(pScrn, pReg); - pSiS->scrnOffset = pScrn->displayWidth * ((pScrn->bitsPerPixel+7)/8); + /* TW: Calculate Offset/Display Pitch */ + pSiS->scrnOffset = pSiS->CurrentLayout.displayWidth * + ((pSiS->CurrentLayout.bitsPerPixel+7)/8); + pSiS->scrnPitch = pSiS->scrnOffset; + if (mode->Flags & V_INTERLACE) pSiS->scrnPitch <<= 1; - outw(VGA_SEQ_INDEX, 0x8605); - - /* TW: The following MUST be done even with VESA */ - pReg->sisRegs3C4[6] &= ~GENMASK(4:2); +#ifdef UNLOCK_ALWAYS + outSISIDXREG(SISSR, 0x05, 0x86); +#endif - switch (pScrn->bitsPerPixel) { + switch(pSiS->CurrentLayout.bitsPerPixel) { case 8: pSiS->DstColor = 0x0000; - pReg->sisRegs3C4[6] |= 0x03; + pSiS->SiS310_AccelDepth = 0x00000000; break; case 16: - if (pScrn->depth==15) { - pSiS->DstColor = 0x4000; - pReg->sisRegs3C4[6] |= ((1 << 2) | 0x03); - } else { + if(pSiS->CurrentLayout.depth == 15) + pSiS->DstColor = (short) 0x4000; + else pSiS->DstColor = (short) 0x8000; - pReg->sisRegs3C4[6] |= ((2 << 2) | 0x03); - } + pSiS->SiS310_AccelDepth = 0x00010000; break; case 24: - pReg->sisRegs3C4[6] |= ((3 << 2) | 0x03); break; case 32: pSiS->DstColor = (short) 0xC000; - pReg->sisRegs3C4[6] |= ((4 << 2) | 0x03); + pSiS->SiS310_AccelDepth = 0x00020000; break; } - - if (!pSiS->UseVESA) { /* TW: Don't do the following when using VESA (NEW) */ - pReg->sisRegs3D4[0x19] = 0; - pReg->sisRegs3D4[0x1A] &= 0xFC; - - if (mode->Flags & V_INTERLACE) { - offset = pSiS->scrnOffset >> 2; - pReg->sisRegs3C4[0x06] |= 0x20; - if (pSiS->Chipset != PCI_CHIP_SIS300) { - temp = (mode->CrtcHSyncStart >> 3) - - (mode->CrtcHTotal >> 3)/2; - pReg->sisRegs3D4[0x19] = GETVAR8(temp); - pReg->sisRegs3D4[0x1A] |= GETBITS(temp, 9:8); - } - } else { - offset = pSiS->scrnOffset >> 3; - pReg->sisRegs3C4[0x06] &= ~0x20; - } - - pReg->sisRegs3C4[0x07] |= 0x10; /* enable High Speed DAC */ - pReg->sisRegs3C4[0x07] &= 0xFC; - if (clock < 100000) - pReg->sisRegs3C4[0x07] |= 0x03; - else if (clock < 200000) - pReg->sisRegs3C4[0x07] |= 0x02; - else if (clock < 250000) - pReg->sisRegs3C4[0x07] |= 0x01; - - pReg->sisRegs3C4[0x0A] = /* Extended Vertical Overflow */ - GETBITSTR(mode->CrtcVTotal -2, 10:10, 0:0) | - GETBITSTR(mode->CrtcVDisplay -1, 10:10, 1:1) | - GETBITSTR(mode->CrtcVBlankStart , 10:10, 2:2) | - GETBITSTR(mode->CrtcVSyncStart , 10:10, 3:3) | - GETBITSTR(mode->CrtcVBlankEnd , 8:8, 4:4) | - GETBITSTR(mode->CrtcVSyncEnd , 4:4, 5:5) ; - - pReg->sisRegs3C4[0x0B] = /* Extended Horizontal Overflow */ - GETBITSTR((mode->CrtcHTotal >> 3) - 5, 9:8, 1:0) | - GETBITSTR((mode->CrtcHDisplay >> 3) - 1, 9:8, 3:2) | - GETBITSTR((mode->CrtcHBlankStart >> 3) , 9:8, 5:4) | - GETBITSTR((mode->CrtcHSyncStart >> 3) , 9:8, 7:6) ; - - pReg->sisRegs3C4[0x0C] &= 0xF8; - pReg->sisRegs3C4[0x0C] |= - GETBITSTR(mode->CrtcHBlankEnd >> 3, 7:6, 1:0) | - GETBITSTR(mode->CrtcHSyncEnd >> 3, 5:5, 2:2) ; - - - vgaReg->CRTC[0x13] = GETVAR8(offset); /* Screen Offset */ - pReg->sisRegs3C4[0x0E] &= 0xF0; - pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); - - if (mode->CrtcHDisplay > 0) /* line compare */ - pReg->sisRegs3C4[0x0F] |= 0x08; - else - pReg->sisRegs3C4[0x0F] &= 0xF7; - - pReg->sisRegs3C4[0x10] = - ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; - } /* VESA */ -/* TW: Enable PCI adressing (0x80) & MMIO enable (0x1) & ? (0x20) */ + /* TW: Enable PCI LINEAR ADDRESSING (0x80), MMIO (0x01), PCI_IO (0x20) */ pReg->sisRegs3C4[0x20] = 0xA1; -/* TW: Enable 3D accelerator & ? */ -/* TW: 0x42 enables 2D accellerator (done below), 0x18 enables 3D engine */ -/* pReg->sisRegs3C4[0x1E] = 0x18; */ -/* TW: !!! now done according to NoAccel setting !!! */ - - if (!pSiS->UseVESA) { /* TW: clocks have surely been set by VESA, so don't touch them now */ - if (SiScompute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { /* Set vclk */ - pReg->sisRegs3C4[0x2B] = (num -1) & 0x7f; - if (div == 2) - pReg->sisRegs3C4[0x2B] |= 0x80; - pReg->sisRegs3C4[0x2C] = ((denum -1) & 0x1f); - pReg->sisRegs3C4[0x2C] |= (((scale-1)&3) << 5); - if (sbit) - pReg->sisRegs3C4[0x2C] |= 0x80; - pReg->sisRegs3C4[0x2D] = 0x80; - } - else { - /* if SiScompute_vclk cannot handle the request clock try sisCalcClock! */ - SiSCalcClock(pScrn, clock, 2, vclk); - pReg->sisRegs3C4[0x2B] = (vclk[Midx] - 1) & 0x7f ; - pReg->sisRegs3C4[0x2B] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; - - /* bits [4:0] contain denumerator -MC */ - pReg->sisRegs3C4[0x2C] = (vclk[Nidx] -1) & 0x1f ; - - if (vclk[Pidx] <= 4) { - /* postscale 1,2,3,4 */ - pReg->sisRegs3C4[0x2C] |= (vclk[Pidx] -1 ) << 5 ; - pReg->sisRegs3C4[0x2C] &= 0x7F; - } else { - /* postscale 6,8 */ - pReg->sisRegs3C4[0x2C] |= ((vclk[Pidx] / 2) -1 ) << 5 ; - pReg->sisRegs3C4[0x2C] |= 0x80; - } - pReg->sisRegs3C4[0x2D] = 0x80; - } /* end of set vclk */ - - if (clock > 150000) { /* enable two-pixel mode */ - pReg->sisRegs3C4[0x07] |= 0x80; - pReg->sisRegs3C4[0x32] |= 0x08; - } else { - pReg->sisRegs3C4[0x07] &= 0x7F; - pReg->sisRegs3C4[0x32] &= 0xF7; - } - pReg->sisRegs3C2 = inb(0x3CC) | 0x0C; /* Programmable Clock */ - } /* VESA */ - /* TW: Now initialize TurboQueue. TB is always located at the very top of - the videoRAM (notably NOT the x framebuffer memory, which can/should - be limited when using DRI) -*/ + * the videoRAM (notably NOT the x framebuffer memory, which can/should + * be limited by MaxXFbMem when using DRI). Also, enable the accelerators. + */ if (!pSiS->NoAccel) { - pReg->sisRegs3C4[0x1E] |= 0x42; /* TW: Enable 2D accellerator */ - pReg->sisRegs3C4[0x1E] |= 0x18; /* TW: Enable 3D accellerator */ - if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ + pReg->sisRegs3C4[0x1E] |= 0x42; /* TW: Enable 2D accelerator */ + pReg->sisRegs3C4[0x1E] |= 0x18; /* TW: Enable 3D accelerator */ + switch (pSiS->VGAEngine) { + case SIS_300_VGA: + if(pSiS->TurboQueue) { /* set Turbo Queue as 512k */ temp = ((pScrn->videoRam/64)-8); /* TW: 8=512k, 4=256k, 2=128k, 1=64k */ pReg->sisRegs3C4[0x26] = temp & 0xFF; pReg->sisRegs3C4[0x27] = (pReg->sisRegs3C4[0x27] & 0xfc) | (((temp >> 8) & 3) | 0xF0); - } /* TW: line above new for saving D2&3 of state register */ - } - - if (!pSiS->UseVESA) { - /* set threshold value */ - (*pSiS->SetThreshold)(pScrn, mode, &Threshold_Low, &Threshold_High); - pReg->sisRegs3C4[0x08] = GETBITSTR(Threshold_Low, 3:0, 7:4) | 0xF; - pReg->sisRegs3C4[0x0F] &= ~GENMASK(5:5); - pReg->sisRegs3C4[0x0F] |= GETBITSTR(Threshold_Low, 4:4, 5:5); - pReg->sisRegs3C4[0x09] &= ~GENMASK(3:0); - pReg->sisRegs3C4[0x09] |= GETBITS(Threshold_High, 3:0); + } /* TW: line above new for saving D2&3 of status register */ + break; + case SIS_315_VGA: + /* See comments in sis_driver.c */ + pReg->sisRegs3C4[0x27] = 0x1F; + pReg->sisRegs3C4[0x26] = 0x22; + pReg->sisMMIO85C0 = (pScrn->videoRam - 512) * 1024; + break; + } } return(TRUE); } -/* TW: Detect video bridge and set VBFlags accordingly */ -void SISVGAPreInit(ScrnInfoPtr pScrn) +int +SISDoSense(ScrnInfoPtr pScrn, int tempbl, int tempbh, int tempcl, int tempch) { SISPtr pSiS = SISPTR(pScrn); - int temp; - char BIOSversion[]="x.xx.xx\0"; - unsigned short usOffsetHigh, usOffsetLow, vBiosRevision; - unsigned long ROMAddr = (unsigned long) SISPTR(pScrn)->BIOS; - - for (temp = 0; temp < 7; temp++) { - BIOSversion[temp] = *((unsigned char *)(ROMAddr+temp+0x06)); - } - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Video BIOS version %s detected\n", BIOSversion); - - usOffsetHigh = *((unsigned char *)(ROMAddr+0x08)) - 0x30; - usOffsetLow = *((unsigned char *)(ROMAddr+0x09)) - 0x30; - vBiosRevision = usOffsetHigh << 4 | usOffsetLow; -#if 0 /* TW: What's this good for? Check the BIOS revision???? That can't be correct! */ - if (vBiosRevision < 0x02) { - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x37, 0); - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - temp &= 0x07; - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - } -#endif - outb(SISPART4, 0x00); - temp = inb(SISPART4+1) & 0x0F; - pSiS->VBFlags = 0; /*reset*/ - if (temp == 1) { - outb(SISPART4, 0x01); /* TW: new for 301b; support is yet incomplete */ - temp = inb(SISPART4+1) & 0xff; - if (temp >= 0xB0) { - pSiS->VBFlags|=VB_301B; /* TW: 301b */ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS301B video bridge\n"); + int temp; + + outSISIDXREG(SISPART4,0x11,tempbl); + temp = tempbh | tempcl; + setSISIDXREG(SISPART4,0x10,0xe0,temp); + usleep(200000); + tempch &= 0x7f; + inSISIDXREG(SISPART4,0x03,temp); + temp ^= 0x0e; + temp &= tempch; + return(temp); +} + +/* TW: Sense connected devices on 30x */ +void SISSense30x(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char backupP4_0d,biosflag; + unsigned char testsvhs_tempbl, testsvhs_tempbh; + unsigned char testsvhs_tempcl, testsvhs_tempch; + unsigned char testcvbs_tempbl, testcvbs_tempbh; + unsigned char testcvbs_tempcl, testcvbs_tempch; + unsigned char testvga2_tempbl, testvga2_tempbh; + unsigned char testvga2_tempcl, testvga2_tempch; + int myflag, result; + unsigned short temp; + + inSISIDXREG(SISPART4,0x0d,backupP4_0d); + outSISIDXREG(SISPART4,0x0d,(backupP4_0d | 0x04)); + + if(pSiS->VGAEngine == SIS_315_VGA) { + if(pSiS->sishw_ext.UseROM) { + temp = 0xf3; + if(pSiS->Chipset == PCI_CHIP_SIS330) temp = 0x11b; + if(pSiS->BIOS[temp] & 0x08) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS30x: Video bridge has (unsupported) DVI combo connector\n"); + orSISIDXREG(SISCR, 0x32, 0x80); + } else { + andSISIDXREG(SISCR, 0x32, 0x7f); + } + } + } + + if(pSiS->VGAEngine == SIS_300_VGA) { + + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xf9]; testvga2_tempbl = pSiS->BIOS[0xf8]; + testsvhs_tempbh = pSiS->BIOS[0xfb]; testsvhs_tempbl = pSiS->BIOS[0xfa]; + testcvbs_tempbh = pSiS->BIOS[0xfd]; testcvbs_tempbl = pSiS->BIOS[0xfc]; + biosflag = pSiS->BIOS[0xfe]; } else { - pSiS->VBFlags|=VB_301; /*301*/ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS301 video bridge\n"); + testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3; + biosflag = 0; } - outb(SISPART4, 0x23); /* TW: new */ - temp = inb(SISPART4+1) & 0xff; - if (!(temp & 0x02)) { - pSiS->VBFlags|=VB_NOLCD; /* TW: flag yet unused */ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "[SiS301: NoLCD flag detected]\n"); - } - } - else if (temp == 2) { - pSiS->VBFlags|=VB_302; /*302*/ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS302(B) video bridge\n"); - outb(SISPART4, 0x38); /* TW: new; LCDA (?) support - yet incomplete */ - temp = inb(SISPART4+1) & 0xff; - if (temp == 0x03) { - pSiS->VBFlags|=VB_LCDA; /* TW: flag yet unused */ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "[SiS302: LCDA flag detected]\n"); + if(pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + testvga2_tempbh = 0x01; testvga2_tempbl = 0x90; + testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b; + testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74; } - } - else if (temp == 3) { - pSiS->VBFlags|=VB_303; /*303*/ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS303 video bridge\n"); - } - else { - outb(SISCR, 0x37); - temp = ((inb(SISCR+1))>>1) & 0x07; - if ((temp == 2) || (temp == 3) || (temp == 4)) { - pSiS->VBFlags |= VB_LVDS; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LVDS video bridge (Type %d)\n", temp); - } - if ((temp == 4) || (temp == 5)) { - pSiS->VBFlags |= VB_CHRONTEL; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected CHRONTEL 7500 VGA->TV converter (Type %d)\n", temp); - } - if (temp == 3) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected TRUMPION TV converter. This device is not supported yet.\n"); + inSISIDXREG(SISPART4,0x01,myflag); + if(myflag & 0x04) { + testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xdd; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xee; + } + testvga2_tempch = 0x0e; testvga2_tempcl = 0x08; + testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04; + testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04; + + } else if((pSiS->Chipset == PCI_CHIP_SIS315) || + (pSiS->Chipset == PCI_CHIP_SIS315H) || + (pSiS->Chipset == PCI_CHIP_SIS315PRO)) { + + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xbe]; testvga2_tempbl = pSiS->BIOS[0xbd]; + testsvhs_tempbh = pSiS->BIOS[0xc0]; testsvhs_tempbl = pSiS->BIOS[0xbf]; + testcvbs_tempbh = pSiS->BIOS[0xc2]; testcvbs_tempbl = pSiS->BIOS[0xc1]; + biosflag = pSiS->BIOS[0xf3]; + } else { + testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3; + biosflag = 0; + } + if(pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xc4]; testvga2_tempbl = pSiS->BIOS[0xc3]; + testsvhs_tempbh = pSiS->BIOS[0xc6]; testsvhs_tempbl = pSiS->BIOS[0xc5]; + testcvbs_tempbh = pSiS->BIOS[0xc8]; testcvbs_tempbl = pSiS->BIOS[0xc7]; + } else { + testvga2_tempbh = 0x01; testvga2_tempbl = 0x90; + testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b; + testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74; + } + } + inSISIDXREG(SISPART4,0x01,myflag); + if(myflag & 0x04) { + testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xdd; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xee; + } + testvga2_tempch = 0x0e; testvga2_tempcl = 0x08; + testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04; + testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04; + + } else if(pSiS->Chipset == PCI_CHIP_SIS330) { + + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xe6]; testvga2_tempbl = pSiS->BIOS[0xe5]; + testsvhs_tempbh = pSiS->BIOS[0xe8]; testsvhs_tempbl = pSiS->BIOS[0xe7]; + testcvbs_tempbh = pSiS->BIOS[0xea]; testcvbs_tempbl = pSiS->BIOS[0xe9]; + biosflag = pSiS->BIOS[0x11b]; + } else { + testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3; + biosflag = 0; + } + if(pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xec]; testvga2_tempbl = pSiS->BIOS[0xeb]; + testsvhs_tempbh = pSiS->BIOS[0xee]; testsvhs_tempbl = pSiS->BIOS[0xed]; + testcvbs_tempbh = pSiS->BIOS[0xf0]; testcvbs_tempbl = pSiS->BIOS[0xef]; + } else { + testvga2_tempbh = 0x01; testvga2_tempbl = 0x90; + testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b; + testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74; + } + } + inSISIDXREG(SISPART4,0x01,myflag); + if(myflag & 0x04) { + testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xdd; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xee; + } + testvga2_tempch = 0x0e; testvga2_tempcl = 0x08; + testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04; + testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04; + + } else { /* 550?, 650, 740 */ + + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xbe]; testvga2_tempbl = pSiS->BIOS[0xbd]; + testsvhs_tempbh = pSiS->BIOS[0xc0]; testsvhs_tempbl = pSiS->BIOS[0xbf]; + testcvbs_tempbh = pSiS->BIOS[0xc2]; testcvbs_tempbl = pSiS->BIOS[0xc1]; + biosflag = pSiS->BIOS[0xf3]; + } else { + testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1; + testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9; + testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3; + biosflag = 0; } - if ((temp < 2) || (temp > 5)) { + testvga2_tempch = 0x0e; testvga2_tempcl = 0x08; + testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04; + testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04; + + /* TW: Different BIOS versions use different values for the 301LV. + These values are from the newest versions 1.10.6? and 1.10.7?. + I have no idea if these values are suitable for the 301B as well. + */ + + if(pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { + if(pSiS->sishw_ext.UseROM) { + testvga2_tempbh = pSiS->BIOS[0xc4]; testvga2_tempbl = pSiS->BIOS[0xc3]; + testsvhs_tempbh = pSiS->BIOS[0xc6]; testsvhs_tempbl = pSiS->BIOS[0xc5]; + testcvbs_tempbh = pSiS->BIOS[0xc8]; testcvbs_tempbl = pSiS->BIOS[0xc7]; + biosflag = pSiS->BIOS[0xf3]; + } else { + testvga2_tempbh = 0x01; testvga2_tempbl = 0x90; + testsvhs_tempbh = 0x02; testsvhs_tempbl = 0x00; + testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x00; + biosflag = 0; + } + testvga2_tempch = 0x0e; testvga2_tempcl = 0x08; + testsvhs_tempch = 0x04; testsvhs_tempcl = 0x08; + testcvbs_tempch = 0x08; testcvbs_tempcl = 0x08; + } + + } + + /* TW: No VGA2 or SCART on LV bridges */ + if(pSiS->VBFlags & (VB_30xLV|VB_30xLVX)) { + testvga2_tempbh = testvga2_tempbl = 0x00; + testvga2_tempch = testvga2_tempcl = 0x00; + } + + if(testvga2_tempch || testvga2_tempcl || testvga2_tempbh || testvga2_tempbl) { +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SiS30x: Scanning for VGA2/SCART (%x %x %x %x)\n", + testvga2_tempbh, testvga2_tempbl, testvga2_tempch, testvga2_tempcl); +#endif + + result = SISDoSense(pScrn, testvga2_tempbl, testvga2_tempbh, + testvga2_tempcl, testvga2_tempch); + if(result) { + if(biosflag & 0x01) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS30x: Detected TV connected to SCART output\n"); + pSiS->VBFlags |= TV_SCART; + orSISIDXREG(SISCR, 0x32, 0x04); + pSiS->postVBCR32 |= 0x04; + } else if(!(pSiS->VBFlags & (VB_30xLV|VB_30xLVX))) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS30x: Detected secondary VGA connection\n"); + pSiS->VBFlags |= VGA2_CONNECTED; + orSISIDXREG(SISCR, 0x32, 0x10); + pSiS->postVBCR32 |= 0x10; + } + } + } + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SiS30x: Scanning for TV (%x %x %x %x; %x %x %x %x)\n", + testsvhs_tempbh, testsvhs_tempbl, testsvhs_tempch, testsvhs_tempcl, + testcvbs_tempbh, testcvbs_tempbl, testcvbs_tempch, testcvbs_tempcl); +#endif + + result = SISDoSense(pScrn, testsvhs_tempbl, testsvhs_tempbh, + testsvhs_tempcl, testsvhs_tempch); + if(result) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS30x: Detected TV connected to SVIDEO output\n"); + /* TW: So we can be sure that there IS a SVIDEO output */ + pSiS->VBFlags |= TV_SVIDEO; + orSISIDXREG(SISCR, 0x32, 0x02); + pSiS->postVBCR32 |= 0x02; + } + + if((biosflag & 0x02) || (!(result))) { + + result = SISDoSense(pScrn, testcvbs_tempbl, testcvbs_tempbh, + testcvbs_tempcl, testcvbs_tempch); + if(result) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected unknown bridge type (%d)\n", temp); + "SiS30x: Detected TV connected to COMPOSITE output\n"); + /* TW: So we can be sure that there IS a CVBS output */ + pSiS->VBFlags |= TV_AVIDEO; + orSISIDXREG(SISCR, 0x32, 0x01); + pSiS->postVBCR32 |= 0x01; } } + SISDoSense(pScrn, 0, 0, 0, 0); + + outSISIDXREG(SISPART4,0x0d,backupP4_0d); +} + +static void +SiS6326TVDelay(ScrnInfoPtr pScrn, int delay) +{ + SISPtr pSiS = SISPTR(pScrn); + int i; + unsigned char temp; + + for(i=0; i<delay; i++) { + inSISIDXREG(SISSR, 0x05, temp); + } +} + +int +SIS6326DoSense(ScrnInfoPtr pScrn, int tempbh, int tempbl, int tempch, int tempcl) +{ + unsigned char temp; + SiS6326SetTVReg(pScrn, 0x42, tempbl); + temp = SiS6326GetTVReg(pScrn, 0x43); + temp &= 0xfc; + temp |= tempbh; + SiS6326SetTVReg(pScrn, 0x43, temp); + SiS6326TVDelay(pScrn, 0x1000); + temp = SiS6326GetTVReg(pScrn, 0x43); + temp |= 0x04; + SiS6326SetTVReg(pScrn, 0x43, temp); + SiS6326TVDelay(pScrn, 0x8000); + temp = SiS6326GetTVReg(pScrn, 0x44); + if(!(tempch & temp)) tempcl = 0; + return(tempcl); +} + +void +SISSense6326(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char temp; + int result; + + pSiS->SiS6326Flags &= (SIS6326_HASTV | SIS6326_TVPAL); + temp = SiS6326GetTVReg(pScrn, 0x43); + temp &= 0xfb; + SiS6326SetTVReg(pScrn, 0x43, temp); + result = SIS6326DoSense(pScrn, 0x01, 0xb0, 0x06, SIS6326_TVSVIDEO); /* 0x02 */ + pSiS->SiS6326Flags |= result; + result = SIS6326DoSense(pScrn, 0x01, 0xa0, 0x01, SIS6326_TVCVBS); /* 0x04 */ + pSiS->SiS6326Flags |= result; + temp = SiS6326GetTVReg(pScrn, 0x43); + temp &= 0xfb; + SiS6326SetTVReg(pScrn, 0x43, temp); + if(pSiS->SiS6326Flags & (SIS6326_TVSVIDEO | SIS6326_TVCVBS)) { + pSiS->SiS6326Flags |= SIS6326_TVDETECTED; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS6326: Detected TV connected to %s output\n", + (pSiS->SiS6326Flags & SIS6326_TVSVIDEO) ? + "SVIDEO" : "COMPOSITE"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS6326: No TV detected\n"); + } +} + +/* TW: Detect video bridge and set VBFlags accordingly */ +void SISVGAPreInit(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int temp,temp1,temp2; + int upperlimitlvds, lowerlimitlvds; + int upperlimitch, lowerlimitch; + int chronteltype, chrontelidreg; + static const char *ChrontelTypeStr[] = { + "7004", + "7005", + "7007", + "7006", + "7008", + "7013", + "7019", + "7020", + "(unknown)" + }; + switch (pSiS->Chipset) { case PCI_CHIP_SIS300: case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: + case PCI_CHIP_SIS550: + case PCI_CHIP_SIS650: + case PCI_CHIP_SIS315: + case PCI_CHIP_SIS315H: + case PCI_CHIP_SIS315PRO: + case PCI_CHIP_SIS330: pSiS->ModeInit = SIS300Init; break; default: pSiS->ModeInit = SISInit; } + + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { + unsigned char sr0d; + inSISIDXREG(SISSR, 0x0d, sr0d); + if(sr0d & 0x04) { + pSiS->SiS6326Flags |= SIS6326_TVPAL; + } + SISSense6326(pScrn); + } + + pSiS->VBFlags = 0; /* reset VBFlags */ + + /* TW: Videobridges only available for 300/310/325 series */ + if((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) + return; + + inSISIDXREG(SISPART4, 0x00, temp); + temp &= 0x0F; + if (temp == 1) { + inSISIDXREG(SISPART4, 0x01, temp1); + temp1 &= 0xff; + if (temp1 >= 0xE0) { + pSiS->VBFlags |= VB_30xLVX; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LVX; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS301LVX video bridge (Revision 0x%x)\n", + temp1); + } else if (temp1 >= 0xD0) { + pSiS->VBFlags |= VB_30xLV; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS301LV video bridge (Revision 0x%x)\n", + temp1); + } else if (temp1 >= 0xB0) { + pSiS->VBFlags |= VB_301B; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS301B video bridge (Revision 0x%x)\n", + temp1); + } else { + pSiS->VBFlags |= VB_301; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_301; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS301 video bridge (Revision 0x%x)\n", + temp1); + } + if (pSiS->VBFlags & (VB_30xLV | VB_30xLVX)) { + inSISIDXREG(SISCR, 0x38, temp); + if((temp & 0x03) == 0x03) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "[SiS301LV/LVX: LCD channel A]\n"); + } + } + + SISSense30x(pScrn); + + } else if (temp == 2) { + + inSISIDXREG(SISPART4, 0x01, temp1); + temp1 &= 0xff; + if (temp1 >= 0xE0) { + pSiS->VBFlags |= VB_30xLVX; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LVX; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS302LVX video bridge (Revision 0x%x)\n", + temp1); + } else if (temp1 >= 0xD0) { + pSiS->VBFlags |= VB_30xLV; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS302LV video bridge (Revision 0x%x)\n", + temp1); + } else { + pSiS->VBFlags |= VB_302B; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS302B video bridge (Revision 0x%x)\n", + temp1); + } + if (pSiS->VBFlags & (VB_302B | VB_30xLV | VB_30xLVX)) { + inSISIDXREG(SISCR, 0x38, temp); + if((temp & 0x03) == 0x03) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "[SiS302B/LV/LVX: LCD channel A]\n"); + } + } + + SISSense30x(pScrn); + + } else if (temp == 3) { + + pSiS->VBFlags |= VB_303; + pSiS->sishw_ext.ujVBChipID = VB_CHIP_303; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS303 video bridge\n"); + + } else { + + pSiS->sishw_ext.ujVBChipID = VB_CHIP_UNKNOWN; + inSISIDXREG(SISCR, 0x37, temp); + temp = (temp >> 1) & 0x07; +#if 0 /* TW: This does not seem to be used on any machine */ + if ( (temp == 0) || (temp == 1)) { + pSiS->VBFlags|=VB_301; /* TW: 301 ? */ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected SiS301 video bridge (Irregular bridge type %d)\n", temp); + } +#endif + if(pSiS->VGAEngine == SIS_300_VGA) { + lowerlimitlvds = 2; upperlimitlvds = 4; + lowerlimitch = 4; upperlimitch = 5; + chronteltype = 1; chrontelidreg = 0x25; + } else { + lowerlimitlvds = 2; upperlimitlvds = 3; + lowerlimitch = 3; upperlimitch = 3; + chronteltype = 2; chrontelidreg = 0x4b; + } + + if((temp >= lowerlimitlvds) && (temp <= upperlimitlvds)) { + pSiS->VBFlags |= VB_LVDS; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LVDS transmitter (Bridge type %d)\n", temp); + if(pSiS->Chipset == PCI_CHIP_SIS650) { + inSISIDXREG(SISCR, 0x38, temp1); + if(temp1 & 0x02) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "[LVDS: LCD channel A]\n"); + } + if(temp1 & 0x08) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "[LVDS: HDTV]\n"); + } + if(temp1 & 0x08) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "[LVDS: SCART]\n"); + } + } + } + if((temp >= lowerlimitch) && (temp <= upperlimitch)) { + /* TW: Set global for init301.c */ + pSiS->SiS_Pr->SiS_IF_DEF_CH70xx = chronteltype; + + if(chronteltype == 1) { + /* TW: Do something mysterious (found in Mitac BIOS) */ + SiS_WhatIsThis(pSiS->SiS_Pr, 0x9c); + } + + /* TW: Read Chrontel version number */ + temp1 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg); + if(chronteltype == 1) { + /* TW: See Chrontel TB31 for explanation */ + temp2 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e); + if(((temp2 & 0x07) == 0x01) || (temp & 0x04)) { + SiS_SetCH700x(pSiS->SiS_Pr, 0x0b0e); + SiS_DDC2Delay(pSiS->SiS_Pr, 300); + } + temp2 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg); + if(temp2 != temp1) temp1 = temp2; + } + if(temp1 == 0xFFFF) { /* 0xFFFF = error reading DDC port */ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Detected Chrontel 70xx, but encountered error reading I2C port\n"); + } + /* TW: We only support device ids 0x19-200; other values may indicate DDC problems */ + else if((temp1 >= 0x19) && (temp1 <= 200)) { + pSiS->VBFlags |= VB_CHRONTEL; + switch (temp1) { + case 0x32: temp2 = 0; pSiS->ChrontelType = CHRONTEL_700x; break; + case 0x3A: temp2 = 1; pSiS->ChrontelType = CHRONTEL_700x; break; + case 0x50: temp2 = 2; pSiS->ChrontelType = CHRONTEL_700x; break; + case 0x2A: temp2 = 3; pSiS->ChrontelType = CHRONTEL_700x; break; + case 0x40: temp2 = 4; pSiS->ChrontelType = CHRONTEL_700x; break; + case 0x22: temp2 = 5; pSiS->ChrontelType = CHRONTEL_700x; break; + case 0x19: temp2 = 6; pSiS->ChrontelType = CHRONTEL_701x; break; + case 0x20: temp2 = 7; pSiS->ChrontelType = CHRONTEL_701x; break; /* ID for 7020? */ + default: temp2 = 8; pSiS->ChrontelType = CHRONTEL_701x; break; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected Chrontel %s TV encoder (ID 0x%02x; bridge type %d)\n", + ChrontelTypeStr[temp2], temp1, temp); + + /* TW: Sense connected TV's */ + + if(chronteltype == 1) { + + /* Chrontel 700x */ + + /* TW: Read power status */ + temp1 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e); /* Power status */ + if((temp1 & 0x03) != 0x03) { + /* TW: Power all outputs */ + SiS_SetCH700x(pSiS->SiS_Pr, 0x0B0E); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x96); + } + /* TW: Sense connected TV devices */ + SiS_SetCH700x(pSiS->SiS_Pr, 0x0110); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x96); + SiS_SetCH700x(pSiS->SiS_Pr, 0x0010); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x96); + temp1 = SiS_GetCH700x(pSiS->SiS_Pr, 0x10); + if(!(temp1 & 0x08)) temp1 = 0x02; + else if(!(temp1 & 0x02)) temp1 = 0x01; + else temp1 = 0; + + } else { + + /* Chrontel 701x */ + + /* TW: Backup Power register */ + temp1 = SiS_GetCH701x(pSiS->SiS_Pr, 0x49); + + /* TW: Enable TV path */ + SiS_SetCH701x(pSiS->SiS_Pr, 0x2049); + + SiS_DDC2Delay(pSiS->SiS_Pr, 0x96); + + /* TW: Sense connected TV devices */ + temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20); + temp2 |= 0x01; + SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20); + + SiS_DDC2Delay(pSiS->SiS_Pr, 0x96); + + temp2 ^= 0x01; + SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20); + + SiS_DDC2Delay(pSiS->SiS_Pr, 0x96); + + temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20); + + /* TW: Restore Power register */ + SiS_SetCH701x(pSiS->SiS_Pr, (temp1 << 8) | 0x49); + + temp1 = 0; + if(temp2 & 0x02) temp1 |= 0x01; + if(temp2 & 0x10) temp1 |= 0x01; + if(temp2 & 0x04) temp1 |= 0x02; + + if( (temp1 & 0x01) && (temp1 & 0x02) ) temp1 = 0x04; + + } + + switch(temp1) { + case 0x01: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chrontel: Detected TV connected to COMPOSITE output\n"); + /* TW: So we can be sure that there IS a CVBS output */ + pSiS->VBFlags |= TV_AVIDEO; + orSISIDXREG(SISCR, 0x32, 0x01); + pSiS->postVBCR32 |= 0x01; + break; + case 0x02: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chrontel: Detected TV connected to SVIDEO output\n"); + /* TW: So we can be sure that there IS a SVIDEO output */ + pSiS->VBFlags |= TV_SVIDEO; + orSISIDXREG(SISCR, 0x32, 0x02); + pSiS->postVBCR32 |= 0x02; + break; + case 0x04: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chrontel: Detected TV connected to SCART output or 480i HDTV\n"); + if(pSiS->chtvtype == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Chrontel: Use CHTVType option to select either SCART or HDTV\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Chrontel: Using SCART by default\n"); + pSiS->chtvtype = 1; + } + if(pSiS->chtvtype) + pSiS->VBFlags |= TV_CHSCART; + else + pSiS->VBFlags |= TV_CHHDTV; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chrontel: No TV detected.\n"); + } + + } else if(temp1==0) { + /* TW: This indicates a communication problem, but it only occures if there + * is no TV attached. + */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected Chrontel TV encoder in promiscuous state (DDC/I2C mix-up)\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Chrontel: Unsupported device id (%d) detected\n",temp1); + } + if(chronteltype == 1) { + /* TW: Do something mysterious (found in Mitac BIOS) */ + SiS_WhatIsThis(pSiS->SiS_Pr, 0x00); + } + } + if ((pSiS->VGAEngine == SIS_300_VGA) && (temp == 3)) { + pSiS->VBFlags |= VB_TRUMPION; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected Trumpion Zurac (I/II/III) LVDS scaler\n"); + } + if (temp > upperlimitlvds) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Detected unknown bridge type (%d)\n", temp); + } + } } + + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.6 Thu Jan 17 04:57:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c Mon Feb 3 21:44:29 2003 @@ -1,40 +1,65 @@ -/*************************************************************************** - -Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.6 2002/01/17 09:57:30 eich Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.10 2003/02/04 02:44:29 dawes Exp $ */ /* - * sis_video.c: SIS Xv driver. Based on the mga Xv driver by Mark Vojkovich - * and i810 Xv driver by Jonathan Bian <jonathan.bian@intel.com>. + * Xv driver for SiS 300 and 310/325 series. + * + * (Based on the mga Xv driver by Mark Vojkovich and i810 Xv + * driver by Jonathan Bian <jonathan.bian@intel.com>.) + * + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * Copyright 2002,2003 by Thomas Winischhofer, Vienna, Austria. + * All Rights Reserved. * - * Authors: + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: * Sung-Ching Lin <sclin@sis.com.tw> + * + * Thomas Winischhofer <thomas@winischhofer.net>: + * - 310/325 series (315/550/650/651/740/M650) support + * - (possibly incomplete) Xabre (SiS330) support + * - new mode switching code for 300, 310/325 and 330 series + * - many fixes for 300/540/630/730 chipsets, + * - many fixes for 5597/5598, 6326 and 530/620 chipsets, + * - VESA mode switching (deprecated), + * - extended CRT2/video bridge handling support, + * - dual head support on 300, 310/325 and 330 series + * - 650/LVDS (up to 1400x1050), 650/Chrontel 701x support + * - 30xB/30xLV/30xLVX video bridge support (300, 310/325, 330 series) + * - Xv support for 5597/5598, 6326, 530/620 and 310/325 series + * - video overlay enhancements for 300 series + * - TV and hi-res support for the 6326 + * - etc. * - * Notes: + * TW: This supports the following chipsets: + * SiS300: No registers >0x65, offers one overlay + * SiS630/730: No registers >0x6b, offers two overlays (one used for CRT1, one for CRT2) + * SiS550: Full register range, offers two overlays (one used for CRT1, one for CRT2) + * SiS315: Full register range, offers one overlay (used for both CRT1 and CRT2 alt.) + * SiS650/740: Full register range, offers one overlay (used for both CRT1 and CRT2 alt.) + * SiSM650/651: Full register range, two overlays (one used for CRT1, one for CRT2) * + * Help for reading the code: + * 315/550/650/740/M650/651 = SIS_315_VGA + * 300/630/730 = SIS_300_VGA + * For chipsets with 2 overlays, hasTwoOverlays will be true */ #include "xf86.h" @@ -53,159 +78,163 @@ #include "xaa.h" #include "xaalocal.h" #include "dixstruct.h" +#include "fourcc.h" #include "sis_regs.h" -#define OFF_DELAY 200 /* milliseconds */ -#define FREE_DELAY 60000 +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 -#define OFF_TIMER 0x01 -#define FREE_TIMER 0x02 +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 #define CLIENT_VIDEO_ON 0x04 #define TIMER_MASK (OFF_TIMER | FREE_TIMER) -void SISInitVideo(ScreenPtr pScreen); -static XF86VideoAdaptorPtr SISSetupImageVideo(ScreenPtr); -static void SISStopVideo(ScrnInfoPtr, pointer, Bool); -static int SISSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); -static int SISGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); -static void SISQueryBestSize(ScrnInfoPtr, Bool, - short, short, short, short, unsigned int *, unsigned int *, pointer); -static int SISPutImage( ScrnInfoPtr, - short, short, short, short, short, short, short, short, - int, unsigned char*, short, short, Bool, RegionPtr, pointer); -static int SISQueryImageAttributes(ScrnInfoPtr, - int, unsigned short *, unsigned short *, int *, int *); -static void SISBlockHandler(int, pointer, pointer, pointer); +#define WATCHDOG_DELAY 500000 /* Watchdog counter for Vertical Restrace waiting */ +static XF86VideoAdaptorPtr SISSetupImageVideo(ScreenPtr); +static void SISStopVideo(ScrnInfoPtr, pointer, Bool); +static int SISSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int SISGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void SISQueryBestSize(ScrnInfoPtr, Bool, short, short, short, + short, unsigned int *,unsigned int *, pointer); +static int SISPutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int SISQueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); +static void SISVideoTimerCallback(ScrnInfoPtr pScrn, Time now); +static void SISInitOffscreenImages(ScreenPtr pScrn); + #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +extern BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn); -static Atom xvBrightness, xvContrast, xvColorKey; +#define IMAGE_MIN_WIDTH 32 /* Minimum and maximum source image sizes */ +#define IMAGE_MIN_HEIGHT 24 +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 +#define IMAGE_MAX_WIDTH_M650 1920 +#define IMAGE_MAX_HEIGHT_M650 1080 + +#define OVERLAY_MIN_WIDTH 32 /* Minimum overlay sizes */ +#define OVERLAY_MIN_HEIGHT 24 + +#define DISPMODE_SINGLE1 0x1 /* TW: CRT1 only */ +#define DISPMODE_SINGLE2 0x2 /* TW: CRT2 only */ +#define DISPMODE_MIRROR 0x4 /* TW: CRT1 + CRT2 MIRROR (see note below) */ -#define IMAGE_MIN_WIDTH 32 -#define IMAGE_MIN_HEIGHT 24 -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 - -#define DISPMODE_SINGLE1 0x1 -#define DISPMODE_SINGLE2 0x2 -#define DISPMODE_MIRROR 0x4 +#ifdef SISDUALHEAD +#define HEADOFFSET (pSiS->dhmOffset) +#endif +/* TW: Note on "MIRROR": + * When using VESA on machines with an enabled video bridge, this means + * a real mirror. CRT1 and CRT2 have the exact same resolution and + * refresh rate. The same applies to modes which require the bridge to + * operate in slave mode. + * When not using VESA and the bridge is not in slave mode otherwise, + * CRT1 and CRT2 have the same resolution but possibly a different + * refresh rate. + */ + /**************************************************************************** -* raw register access : these routines directly interact with the sis's -* control aperature. must not be called until after -* the board's pci memory has been mapped. -****************************************************************************/ + * Raw register access : These routines directly interact with the sis's + * control aperature. Must not be called until after + * the board's pci memory has been mapped. + ****************************************************************************/ -static CARD32 _sisread(SISPtr pSIS, CARD32 reg) +#if 0 +static CARD32 _sisread(SISPtr pSiS, CARD32 reg) { - return *(pSIS->IOBase + reg); + return *(pSiS->IOBase + reg); } -static void _siswrite(SISPtr pSIS, CARD32 reg, CARD32 data) +static void _siswrite(SISPtr pSiS, CARD32 reg, CARD32 data) { - *(pSIS->IOBase + reg) = data; + *(pSiS->IOBase + reg) = data; } +#endif -static CARD8 getvideoreg(SISPtr pSIS, CARD8 reg) +static CARD8 getvideoreg(SISPtr pSiS, CARD8 reg) { - outb (pSIS->RelIO + vi_index_offset, reg); - return inb(pSIS->RelIO + vi_data_offset); + CARD8 ret; + inSISIDXREG(SISVID, reg, ret); + return(ret); } -static void setvideoreg(SISPtr pSIS, CARD8 reg, CARD8 data) +static void setvideoreg(SISPtr pSiS, CARD8 reg, CARD8 data) { - outb (pSIS->RelIO + vi_index_offset, reg); - outb (pSIS->RelIO + vi_data_offset, data); + outSISIDXREG(SISVID, reg, data); } -static void setvideoregmask(SISPtr pSIS, CARD8 reg, CARD8 data, CARD8 mask) +static void setvideoregmask(SISPtr pSiS, CARD8 reg, CARD8 data, CARD8 mask) { CARD8 old; - outb (pSIS->RelIO + vi_index_offset, reg); - old = inb(pSIS->RelIO + vi_data_offset); + inSISIDXREG(SISVID, reg, old); data = (data & mask) | (old & (~mask)); - outb (pSIS->RelIO + vi_data_offset, data); + outSISIDXREG(SISVID, reg, data); } -static CARD8 getsrreg(SISPtr pSIS, CARD8 reg) +static void setsrregmask(SISPtr pSiS, CARD8 reg, CARD8 data, CARD8 mask) { - outb (pSIS->RelIO + sr_index_offset, 0x05); - if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) - outb (pSIS->RelIO + sr_data_offset, 0x86); - outb (pSIS->RelIO + sr_index_offset, reg); - return inb(pSIS->RelIO + sr_data_offset); -} - -static void setsrreg(SISPtr pSIS, CARD8 reg, CARD8 data) -{ - outb (pSIS->RelIO + sr_index_offset, 0x05); - if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) - outb (pSIS->RelIO + sr_data_offset, 0x86); - outb (pSIS->RelIO + sr_index_offset, reg); - outb (pSIS->RelIO + sr_data_offset, data); -} - -static void setsrregmask(SISPtr pSIS, CARD8 reg, CARD8 data, CARD8 mask) -{ CARD8 old; - outb (pSIS->RelIO + sr_index_offset, 0x05); - if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) - outb (pSIS->RelIO + sr_data_offset, 0x86); - outb (pSIS->RelIO + sr_index_offset, reg); - old = inb(pSIS->RelIO + sr_data_offset); + inSISIDXREG(SISSR, reg, old); data = (data & mask) | (old & (~mask)); - outb (pSIS->RelIO + sr_data_offset, data); + outSISIDXREG(SISSR, reg, data); } -static CARD8 getsisreg(SISPtr pSIS, CARD8 index_offset, CARD8 reg) -{ - outb (pSIS->RelIO + index_offset, reg); - return inb(pSIS->RelIO + index_offset+1); -} - #if 0 -static void setsisreg(SISPtr pSIS, CARD8 index_offset, CARD8 reg, CARD8 data) +static CARD8 getsisreg(SISPtr pSiS, CARD8 index_offset, CARD8 reg) { - outb (pSIS->RelIO + index_offset, reg); - outb (pSIS->RelIO + index_offset+1, data); + CARD8 ret; + inSISIDXREG(index_offset, reg, ret); + return(ret); } #endif /* VBlank */ -static CARD8 vblank_active_CRT1(SISPtr pSIS) +static CARD8 vblank_active_CRT1(SISPtr pSiS) { - return (inb(pSIS->RelIO + input_stat) & 0x08); + return (inSISREG(SISINPSTAT) & 0x08); } -static CARD8 vblank_active_CRT2(SISPtr pSIS) +static CARD8 vblank_active_CRT2(SISPtr pSiS) { - return (getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VR) & 0x02); + CARD8 ret; + if(pSiS->VGAEngine == SIS_315_VGA) { + inSISIDXREG(SISPART1, Index_310_CRT2_FC_VR, ret); + } else { + inSISIDXREG(SISPART1, Index_CRT2_FC_VR, ret); + } + return((ret & 0x02) ^ 0x02); } -/* Scanline */ -static CARD32 get_scanline_CRT1(SISPtr pSIS) +/* Scanline - unused */ +#if 0 +static CARD32 get_scanline_CRT1(SISPtr pSiS) { CARD32 line; - _siswrite (pSIS, REG_PRIM_CRT_COUNTER, 0x00000001); - line = _sisread (pSIS, REG_PRIM_CRT_COUNTER); + _siswrite (pSiS, REG_PRIM_CRT_COUNTER, 0x00000001); + line = _sisread (pSiS, REG_PRIM_CRT_COUNTER); return ((line >> 16) & 0x07FF); } -static CARD32 get_scanline_CRT2(SISPtr pSIS) +static CARD32 get_scanline_CRT2(SISPtr pSiS) { CARD32 line; - line = (CARD32)(getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount1) & 0x70) * 16 - + getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount); + line = (CARD32)(getsisreg(pSiS, SISPART1, Index_CRT2_FC_VCount1) & 0x70) * 16 + + getsisreg(pSiS, SISPART1, Index_CRT2_FC_VCount); return line; } +#endif void SISInitVideo(ScreenPtr pScreen) { @@ -213,111 +242,144 @@ XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int num_adaptors; - - if (pScrn->bitsPerPixel != 8) { - newAdaptor = SISSetupImageVideo(pScreen); - } + newAdaptor = SISSetupImageVideo(pScreen); + if(newAdaptor) + SISInitOffscreenImages(pScreen); + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); if(newAdaptor) { - if(!num_adaptors) { - num_adaptors = 1; - adaptors = &newAdaptor; - } else { - /* need to free this someplace */ - newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * - sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + /* need to free this someplace */ + newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } } if(num_adaptors) xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + xfree(newAdaptors); } - /* client libraries expect an encoding */ -static XF86VideoEncodingRec DummyEncoding[1] = +static XF86VideoEncodingRec DummyEncoding = { - { 0, "XV_IMAGE", IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, {1, 1} - } }; -#define NUM_FORMATS 2 +static XF86VideoEncodingRec DummyEncoding_M650 = +{ + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH_M650, IMAGE_MAX_HEIGHT_M650, + {1, 1} +}; -static XF86VideoFormatRec Formats[NUM_FORMATS] = +#define NUM_FORMATS 3 + +static XF86VideoFormatRec SISFormats[NUM_FORMATS] = { - {16, TrueColor}, {24, TrueColor} + { 8, PseudoColor}, + {16, TrueColor}, + {24, TrueColor} }; -#define NUM_ATTRIBUTES 3 +#define NUM_ATTRIBUTES_300 5 +#define NUM_ATTRIBUTES_325 7 -static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = +static XF86AttributeRec SISAttributes_300[NUM_ATTRIBUTES_300] = { {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, - {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable , 0, 0, "XV_SET_DEFAULTS"} }; -#define NUM_IMAGES 2 -#define PIXEL_FMT_YV12 0x32315659 -#define PIXEL_FMT_YUY2 0x32595559 - -static XF86ImageRec Images[NUM_IMAGES] = -{ - { - PIXEL_FMT_YUY2, - XvYUV, - LSBFirst, - {'Y','U','Y','2', - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, - 16, - XvPacked, - 1, - 0, 0, 0, 0 , - 8, 8, 8, - 1, 2, 2, - 1, 1, 1, - {'Y','U','Y','V', - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - XvTopToBottom - }, - { - PIXEL_FMT_YV12, - XvYUV, - LSBFirst, - {'Y','V','1','2', - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, - 12, - XvPlanar, - 3, - 0, 0, 0, 0 , - 8, 8, 8, - 1, 2, 2, - 1, 2, 2, - {'Y','V','U', - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - XvTopToBottom - } +static XF86AttributeRec SISAttributes_325[NUM_ATTRIBUTES_325] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"}, + {XvSettable | XvGettable, -7, 7, "XV_SATURATION"}, + {XvSettable | XvGettable, -8, 7, "XV_HUE"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable , 0, 0, "XV_SET_DEFAULTS"} +}; + +#define NUM_IMAGES 6 +#define PIXEL_FMT_YV12 FOURCC_YV12 /* 0x32315659 */ +#define PIXEL_FMT_UYVY FOURCC_UYVY /* 0x59565955 */ +#define PIXEL_FMT_YUY2 FOURCC_YUY2 /* 0x32595559 */ +#define PIXEL_FMT_I420 FOURCC_I420 /* 0x30323449 */ +#define PIXEL_FMT_RGB5 0x35315652 +#define PIXEL_FMT_RGB6 0x36315652 + +static XF86ImageRec SISImages[NUM_IMAGES] = +{ + XVIMAGE_YUY2, /* TW: If order is changed, SISOffscreenImages must be adapted */ + XVIMAGE_YV12, + XVIMAGE_UYVY, + XVIMAGE_I420 + , + { /* RGB 555 */ + 0x35315652, + XvRGB, + LSBFirst, + {'R','V','1','5', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, +/* 15, 0x001F, 0x03E0, 0x7C00, - incorrect! */ + 15, 0x7C00, 0x03E0, 0x001F, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R', 'V', 'B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, + { /* RGB 565 */ + 0x36315652, + XvRGB, + LSBFirst, + {'R','V','1','6', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, +/* 16, 0x001F, 0x07E0, 0xF800, - incorrect! */ + 16, 0xF800, 0x07E0, 0x001F, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R', 'V', 'B',0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + } }; typedef struct { int pixelFormat; CARD16 pitch; + CARD16 origPitch; CARD8 keyOP; CARD16 HUSF; @@ -339,14 +401,36 @@ CARD8 contrastFactor; CARD8 lineBufSize; + + CARD8 (*VBlankActiveFunc)(SISPtr); +#if 0 + CARD32 (*GetScanLineFunc)(SISPtr pSiS); +#endif + + CARD16 SCREENheight; - CARD8 (*VBlankActiveFunc)(SISPtr); - CARD32 (*GetScanLineFunc)(SISPtr pSIS); +#if 0 + /* TW: The following are not used yet */ + CARD16 SubPictHUSF; /* Subpicture scaling */ + CARD16 SubpictVUSF; + CARD8 SubpictIntBit; + CARD8 SubPictwHPre; + CARD16 SubPictsrcW; /* Subpicture source width */ + CARD16 SubPictsrcH; /* Subpicture source height */ + BoxRec SubPictdstBox; /* SubPicture destination box */ + CARD32 SubPictAddr; /* SubPicture address */ + CARD32 SubPictPitch; /* SubPicture pitch */ + CARD32 SubPictOrigPitch; /* SubPicture real pitch (needed for scaling twice) */ + CARD32 SubPictPreset; /* Subpicture Preset */ + + CARD32 MPEG_Y; /* MPEG Y Buffer Addr */ + CARD32 MPEG_UV; /* MPEG UV Buffer Addr */ +#endif + } SISOverlayRec, *SISOverlayPtr; typedef struct { - FBAreaPtr fbAreaPtr; - int fbSize; + FBLinearPtr linear; /* TW: We now use Linear, not Area */ CARD32 bufAddr[2]; unsigned char currentBuf; @@ -356,115 +440,287 @@ int id; short srcPitch, height; - unsigned char brightness; + char brightness; unsigned char contrast; + char hue; + char saturation; RegionRec clip; CARD32 colorKey; + Bool autopaintColorKey; CARD32 videoStatus; Time offTime; Time freeTime; + + CARD32 displayMode; + Bool bridgeIsSlave; + + Bool hasTwoOverlays; /* TW: Chipset has two overlays */ + Bool dualHeadMode; /* TW: We're running in DHM */ + + Bool needToScale; /* TW: Need to scale video */ - CARD32 displayMode; + int shiftValue; /* 550/650 need word addr/pitch, 630 double word */ + + short oldx1, oldx2, oldy1, oldy2; + int mustwait; + + Bool grabbedByV4L; /* V4L stuff */ + int pitch; + int offset; + } SISPortPrivRec, *SISPortPrivPtr; #define GET_PORT_PRIVATE(pScrn) \ (SISPortPrivPtr)((SISPTR(pScrn))->adaptor->pPortPrivates[0].ptr) +static void +SISSetPortDefaults (ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) +{ + pPriv->colorKey = 0x000101fe; + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 4; + pPriv->hue = 0; + pPriv->saturation = 0; + pPriv->autopaintColorKey = TRUE; +} static void -SISResetVideo(ScrnInfoPtr pScrn) +SISResetVideo(ScrnInfoPtr pScrn) { - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); - if (getsrreg (pSIS, 0x05) != 0xa1) - { - setsrreg (pSIS, 0x05, 0x86); - if (getsrreg (pSIS, 0x05) != 0xa1) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Standard password not initialize\n"); - } - if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) - { - setvideoreg (pSIS, Index_VI_Passwd, 0x86); - if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Video password not initialize\n"); + /* Unlock registers */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + if (getvideoreg (pSiS, Index_VI_Passwd) != 0xa1) { + setvideoreg (pSiS, Index_VI_Passwd, 0x86); + if (getvideoreg (pSiS, Index_VI_Passwd) != 0xa1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Xv: Video password could not unlock registers\n"); } + + /* Initialize first overlay (CRT1) ------------------------------- */ + + /* Write-enable video registers */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x80, 0x81); + + /* Disable overlay */ + setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02); - /* Initial first set */ - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x80, 0x81); - setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); - setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); - setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); + /* Disable bobEnable */ + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x02, 0x02); + + /* Reset scale control and contrast */ + setvideoregmask(pSiS, Index_VI_Scale_Control, 0x60, 0x60); + setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); - - /* Initial second set */ - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x81, 0x81); - setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); - setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); - setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); - - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); - - /* set default contrast */ - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x00, 0x01); - setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); - setvideoreg (pSIS, Index_VI_Brightness, 0x20); + setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); + setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); + setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Low, 0x00); + setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Middle, 0x00); + setvideoreg(pSiS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); + setvideoreg(pSiS, Index_VI_Play_Threshold_Low, 0x00); + setvideoreg(pSiS, Index_VI_Play_Threshold_High, 0x00); + + /* Initialize second overlay (CRT2) ---- only for 630/730, 550, M650/651 */ + if (pPriv->hasTwoOverlays) { + /* Write-enable video registers */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x81, 0x81); + + /* Disable overlay */ + setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02); + + /* Disable bobEnable */ + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x02, 0x02); + + /* Reset scale control and contrast */ + setvideoregmask(pSiS, Index_VI_Scale_Control, 0x60, 0x60); + setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); + + setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); + setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); + setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Low, 0x00); + setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Middle, 0x00); + setvideoreg(pSiS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); + setvideoreg(pSiS, Index_VI_Play_Threshold_Low, 0x00); + setvideoreg(pSiS, Index_VI_Play_Threshold_High, 0x00); + } - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x01, 0x01); - setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); - setvideoreg (pSIS, Index_VI_Brightness, 0x20); + /* set default properties for overlay 1 (CRT1) -------------------------- */ + setvideoregmask (pSiS, Index_VI_Control_Misc2, 0x00, 0x01); + setvideoregmask (pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSiS, Index_VI_Brightness, 0x20); + if (pSiS->VGAEngine == SIS_315_VGA) { + setvideoreg (pSiS, Index_VI_Hue, 0x00); + setvideoreg (pSiS, Index_VI_Saturation, 0x00); + } + /* set default properties for overlay 2(CRT2) only 630/730 and 550 ------ */ + if (pPriv->hasTwoOverlays) { + setvideoregmask (pSiS, Index_VI_Control_Misc2, 0x01, 0x01); + setvideoregmask (pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSiS, Index_VI_Brightness, 0x20); + if (pSiS->VGAEngine == SIS_315_VGA) { + setvideoreg (pSiS, Index_VI_Hue, 0x00); + setvideoreg (pSiS, Index_VI_Saturation, 0x00); + } + } } +/* TW: Set display mode (single CRT1/CRT2, mirror). + * MIRROR mode is only available on chipsets with two overlays. + * On the other chipsets, if only CRT1 or only CRT2 are used, + * the correct display CRT is chosen automatically. If both + * CRT1 and CRT2 are connected, the user can choose between CRT1 and + * CRT2 by using the option XvOnCRT2. + */ +static void +set_dispmode(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) +{ + SISPtr pSiS = SISPTR(pScrn); -static XF86VideoAdaptorPtr + pPriv->dualHeadMode = pPriv->bridgeIsSlave = FALSE; + + if(SiSBridgeIsInSlaveMode(pScrn)) pPriv->bridgeIsSlave = TRUE; + + if( (pSiS->VBFlags & VB_DISPMODE_MIRROR) || + ((pPriv->bridgeIsSlave) && (pSiS->VBFlags & DISPTYPE_DISP2)) ) { + if(pPriv->hasTwoOverlays) + pPriv->displayMode = DISPMODE_MIRROR; /* TW: CRT1 + CRT2 (2 overlays) */ + else if(pSiS->XvOnCRT2) + pPriv->displayMode = DISPMODE_SINGLE2; + else + pPriv->displayMode = DISPMODE_SINGLE1; + } else { +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pPriv->dualHeadMode = TRUE; + if(pSiS->SecondHead) + /* TW: Slave is always CRT1 */ + pPriv->displayMode = DISPMODE_SINGLE1; + else + /* TW: Master is always CRT2 */ + pPriv->displayMode = DISPMODE_SINGLE2; + } else +#endif + if(pSiS->VBFlags & DISPTYPE_DISP1) { + pPriv->displayMode = DISPMODE_SINGLE1; /* TW: CRT1 only */ + } else { + pPriv->displayMode = DISPMODE_SINGLE2; /* TW: CRT2 only */ + } + } +} + +static void +set_disptype_regs(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) +{ + SISPtr pSiS = SISPTR(pScrn); + + /* TW: + * SR06[7:6] + * Bit 7: Enable overlay 2 on CRT2 + * Bit 6: Enable overlay 1 on CRT2 + * SR32[7:6] + * Bit 7: DCLK/TCLK overlay 2 + * 0=DCLK (overlay on CRT1) + * 1=TCLK (overlay on CRT2) + * Bit 6: DCLK/TCLK overlay 1 + * 0=DCLK (overlay on CRT1) + * 1=TCLK (overlay on CRT2) + * + * On chipsets with two overlays, we can freely select and also + * have a mirror mode. However, we use overlay 1 for CRT1 and + * overlay 2 for CRT2. + * For chipsets with only one overlay, user must choose whether + * to display the overlay on CRT1 or CRT2 by setting XvOnCRT2 + * to TRUE (CRT2) or FALSE (CRT1). The hardware does not + * support any kind of "Mirror" mode on these chipsets. + */ +#ifdef UNLOCK_ALWAYS + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + switch (pPriv->displayMode) + { + case DISPMODE_SINGLE1: /* TW: CRT1 only */ + if (pPriv->hasTwoOverlays) { + if (pPriv->dualHeadMode) { + setsrregmask (pSiS, 0x06, 0x00, 0x40); + setsrregmask (pSiS, 0x32, 0x00, 0x40); + } else { + setsrregmask (pSiS, 0x06, 0x00, 0xc0); + setsrregmask (pSiS, 0x32, 0x00, 0xc0); + } + } else { + setsrregmask (pSiS, 0x06, 0x00, 0xc0); + setsrregmask (pSiS, 0x32, 0x00, 0xc0); + } + break; + case DISPMODE_SINGLE2: /* TW: CRT2 only */ + if (pPriv->hasTwoOverlays) { + if (pPriv->dualHeadMode) { + setsrregmask (pSiS, 0x06, 0x80, 0x80); + setsrregmask (pSiS, 0x32, 0x80, 0x80); + } else { + setsrregmask (pSiS, 0x06, 0x80, 0xc0); + setsrregmask (pSiS, 0x32, 0x80, 0xc0); + } + } else { + setsrregmask (pSiS, 0x06, 0x40, 0xc0); + setsrregmask (pSiS, 0x32, 0x40, 0xc0); + } + break; + case DISPMODE_MIRROR: /* TW: CRT1 + CRT2 */ + default: + setsrregmask (pSiS, 0x06, 0x80, 0xc0); + setsrregmask (pSiS, 0x32, 0x80, 0xc0); + break; + } +} + +static XF86VideoAdaptorPtr SISSetupImageVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); XF86VideoAdaptorPtr adapt; SISPortPrivPtr pPriv; if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + - sizeof(SISPortPrivRec) + - sizeof(DevUnion)))) - return NULL; + sizeof(SISPortPrivRec) + + sizeof(DevUnion)))) + return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "SIS Video Overlay"; + adapt->name = "SIS 300/310/325 series Video Overlay"; adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; + if(pSiS->Flags650 & SiS650_LARGEOVERLAY) { + adapt->pEncodings = &DummyEncoding_M650; + } else { + adapt->pEncodings = &DummyEncoding; + } adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; + adapt->pFormats = SISFormats; adapt->nPorts = 1; adapt->pPortPrivates = (DevUnion*)(&adapt[1]); pPriv = (SISPortPrivPtr)(&adapt->pPortPrivates[1]); adapt->pPortPrivates[0].ptr = (pointer)(pPriv); - adapt->pAttributes = Attributes; - adapt->nImages = 2; - adapt->nAttributes = 3; - adapt->pImages = Images; + adapt->nImages = NUM_IMAGES; + if(pSiS->VGAEngine == SIS_300_VGA) { + adapt->pAttributes = SISAttributes_300; + adapt->nAttributes = NUM_ATTRIBUTES_300; + } else { + adapt->pAttributes = SISAttributes_325; + adapt->nAttributes = NUM_ATTRIBUTES_325; + } + adapt->pImages = SISImages; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; @@ -476,53 +732,58 @@ adapt->PutImage = SISPutImage; adapt->QueryImageAttributes = SISQueryImageAttributes; - pPriv->colorKey = 0x000101fe; pPriv->videoStatus = 0; - pPriv->brightness = 0; - pPriv->contrast = 128; + pPriv->currentBuf = 0; + pPriv->linear = NULL; + pPriv->grabbedByV4L= FALSE; - pPriv->currentBuf = 0; - - pPriv->fbAreaPtr = NULL; - pPriv->fbSize = 0; + SISSetPortDefaults(pScrn, pPriv); /* gotta uninit this someplace */ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); - pSIS->adaptor = adapt; + pSiS->adaptor = adapt; - pSIS->BlockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = SISBlockHandler; + pSiS->xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + pSiS->xvContrast = MAKE_ATOM("XV_CONTRAST"); + pSiS->xvColorKey = MAKE_ATOM("XV_COLORKEY"); + if(pSiS->VGAEngine == SIS_315_VGA) { + pSiS->xvSaturation = MAKE_ATOM("XV_SATURATION"); + pSiS->xvHue = MAKE_ATOM("XV_HUE"); + } + pSiS->xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + pSiS->xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvContrast = MAKE_ATOM("XV_CONTRAST"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - - /* set display mode */ - /* TODO: support CRT2-only mode */ - if(pSIS->VBFlags & VB_DISPMODE_MIRROR) { /* TW: CRT1 + CRT2 */ - pPriv->displayMode = DISPMODE_MIRROR; - setsrregmask (pSIS, 0x06, 0x80, 0xc0); - setsrregmask (pSIS, 0x32, 0x80, 0xc0); - } - else { - if (pSIS->VBFlags & DISPTYPE_DISP1) { /* TW: CRT1 only */ - pPriv->displayMode = DISPMODE_SINGLE1; - setsrregmask (pSIS, 0x06, 0x00, 0xc0); - setsrregmask (pSIS, 0x32, 0x00, 0xc0); - } else { /* TW: CRT2 only */ - pPriv->displayMode = DISPMODE_SINGLE2; - setsrregmask (pSIS, 0x06, 0x00, 0xc0); /* No idea... do the same as for CRT1 now */ - setsrregmask (pSIS, 0x32, 0x00, 0xc0); - } + /* TW: Setup chipset type helpers */ + if (pSiS->hasTwoOverlays) + pPriv->hasTwoOverlays = TRUE; + else + pPriv->hasTwoOverlays = FALSE; + + /* TW: 300 series require double words for addresses and pitches, + * 310/325 series accept word. + */ + switch (pSiS->VGAEngine) { + case SIS_315_VGA: + pPriv->shiftValue = 1; + break; + case SIS_300_VGA: + default: + pPriv->shiftValue = 2; + break; } + /* Set displayMode according to VBFlags */ + set_dispmode(pScrn, pPriv); + + /* Set SR(06, 32) registers according to DISPMODE */ + set_disptype_regs(pScrn, pPriv); + SISResetVideo(pScrn); return adapt; } - static Bool RegionsEqual(RegionPtr A, RegionPtr B) { @@ -543,41 +804,50 @@ dataB = (int*)REGION_RECTS(B); while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; } return TRUE; } - - -static int -SISSetPortAttribute( - ScrnInfoPtr pScrn, - Atom attribute, - INT32 value, - pointer data -){ +static int +SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 value, pointer data) +{ SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + SISPtr pSiS = SISPTR(pScrn); - if(attribute == xvBrightness) { + if(attribute == pSiS->xvBrightness) { if((value < -128) || (value > 127)) return BadValue; pPriv->brightness = value; - } else - if(attribute == xvContrast) { - if((value < 0) || (value > 255)) + } else if(attribute == pSiS->xvContrast) { + if((value < 0) || (value > 7)) return BadValue; pPriv->contrast = value; - } else - if(attribute == xvColorKey) { + } else if(attribute == pSiS->xvColorKey) { pPriv->colorKey = value; - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else if(attribute == pSiS->xvAutopaintColorKey) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->autopaintColorKey = value; + } else if(attribute == pSiS->xvSetDefaults) { + SISSetPortDefaults(pScrn, pPriv); + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if(attribute == pSiS->xvHue) { + if((value < -8) || (value > 7)) + return BadValue; + pPriv->hue = value; + } else if(attribute == pSiS->xvSaturation) { + if((value < -7) || (value > 7)) + return BadValue; + pPriv->saturation = value; + } else return BadMatch; } else return BadMatch; - return Success; } @@ -589,17 +859,23 @@ pointer data ){ SISPortPrivPtr pPriv = (SISPortPrivPtr)data; + SISPtr pSiS = SISPTR(pScrn); - if(attribute == xvBrightness) { + if(attribute == pSiS->xvBrightness) { *value = pPriv->brightness; - } else - if(attribute == xvContrast) { + } else if(attribute == pSiS->xvContrast) { *value = pPriv->contrast; - } else - if(attribute == xvColorKey) { + } else if(attribute == pSiS->xvColorKey) { *value = pPriv->colorKey; + } else if (attribute == pSiS->xvAutopaintColorKey) { + *value = (pPriv->autopaintColorKey) ? 1 : 0; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if(attribute == pSiS->xvHue) { + *value = pPriv->hue; + } else if(attribute == pSiS->xvSaturation) { + *value = pPriv->saturation; + } else return BadMatch; } else return BadMatch; - return Success; } @@ -614,47 +890,85 @@ ){ *p_w = drw_w; *p_h = drw_h; - - /* TODO: report the HW limitation */ } - static void -set_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn) +calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn, + SISPortPrivPtr pPriv, int index, int iscrt2) { - SISPtr pSIS = SISPTR(pScrn); - CARD32 I=0; - + SISPtr pSiS = SISPTR(pScrn); + CARD32 I=0,mult=0; + int flag=0; + int dstW = pOverlay->dstBox.x2 - pOverlay->dstBox.x1; - int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1; + int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1; int srcW = pOverlay->srcW; int srcH = pOverlay->srcH; - CARD16 LCDheight = pSIS->LCDheight; - CARD16 SCREENheight = pScrn->currentMode->VDisplay; - - int srcPitch = pOverlay->pitch; - - /* TW: Scale image due to idiotic VESA modes that scale CRT2 _and_ CRT1 */ - if ( (pSIS->UseVESA) && (pSIS->VBFlags & CRT2_LCD) ) { - dstH = (dstH * LCDheight) / SCREENheight; + CARD16 LCDheight = pSiS->LCDheight; + int srcPitch = pOverlay->origPitch; + int origdstH = dstH; + + /* TW: Stretch image due to idiotic LCD "auto"-scaling on LVDS (and 630+301B) */ + if(pSiS->VBFlags & CRT2_LCD) { + if(pPriv->bridgeIsSlave) { + if(pSiS->VBFlags & VB_LVDS) { + dstH = (dstH * LCDheight) / pOverlay->SCREENheight; + } else if( (pSiS->VGAEngine == SIS_300_VGA) && + (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) ) { + dstH = (dstH * LCDheight) / pOverlay->SCREENheight; + } + } else if(iscrt2) { + if (pSiS->VBFlags & VB_LVDS) { + dstH = (dstH * LCDheight) / pOverlay->SCREENheight; + if (pPriv->displayMode == DISPMODE_MIRROR) flag = 1; + } else if ( (pSiS->VGAEngine == SIS_300_VGA) && + (pSiS->VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) ) { + dstH = (dstH * LCDheight) / pOverlay->SCREENheight; + if (pPriv->displayMode == DISPMODE_MIRROR) flag = 1; + } + } + } + /* TW: For double scan modes, we need to double the height + * (Perhaps we also need to scale LVDS, but I'm not sure.) + * On 310/325 series, we need to double the width as well. + * Interlace mode vice versa. + */ + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + dstH = origdstH << 1; + flag = 0; + if(pSiS->VGAEngine == SIS_315_VGA) { + dstW <<= 1; + } } + if(pSiS->CurrentLayout.mode->Flags & V_INTERLACE) { + dstH = origdstH >> 1; + flag = 0; + } - if (dstW == srcW) { + if(dstW < OVERLAY_MIN_WIDTH) dstW = OVERLAY_MIN_WIDTH; + if (dstW == srcW) { pOverlay->HUSF = 0x00; pOverlay->IntBit = 0x05; - } - else if (dstW > srcW) { - dstW += 2; + pOverlay->wHPre = 0; + } else if (dstW > srcW) { + dstW += 2; pOverlay->HUSF = (srcW << 16) / dstW; pOverlay->IntBit = 0x04; - } - else { + pOverlay->wHPre = 0; + } else { int tmpW = dstW; - I = 0x00; + /* TW: It seems, the hardware can't scale below factor .125 (=1/8) if the + pitch isn't a multiple of 256. + TODO: Test this on the 310/325 series! + */ + if((srcPitch % 256) || (srcPitch < 256)) { + if(((dstW * 1000) / srcW) < 125) dstW = tmpW = ((srcW * 125) / 1000) + 1; + } + + I = 0; pOverlay->IntBit = 0x01; - while (srcW >= tmpW) - { + while (srcW >= tmpW) { tmpW <<= 1; I++; } @@ -664,44 +978,39 @@ pOverlay->HUSF = ((srcW - dstW) << 16) / dstW; else pOverlay->HUSF = 0x00; - } + } - if (dstH == srcH) { + if(dstH < OVERLAY_MIN_HEIGHT) dstH = OVERLAY_MIN_HEIGHT; + if (dstH == srcH) { pOverlay->VUSF = 0x00; pOverlay->IntBit |= 0x0A; - } - else if (dstH > srcH) { + } else if (dstH > srcH) { dstH += 0x02; pOverlay->VUSF = (srcH << 16) / dstH; pOverlay->IntBit |= 0x08; - } - else { + } else { CARD32 realI; I = realI = srcH / dstH; pOverlay->IntBit |= 0x02; - if (I < 2) - { - pOverlay->VUSF = ((srcH - dstH)<<16)/dstH; - } - else - { + if (I < 2) { + pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; + /* TW: Needed for LCD-scaling modes */ + if ((flag) && (mult = (srcH / origdstH)) >= 2) + pOverlay->pitch /= mult; + } else { #if 0 if (((pOverlay->bobEnable & 0x08) == 0x00) && - (((srcPitch * I)>>2) > 0xFFF)) - { + (((srcPitch * I)>>2) > 0xFFF)){ pOverlay->bobEnable |= 0x08; srcPitch >>= 1; } #endif - if (((srcPitch * I)>>2) > 0xFFF) - { + if (((srcPitch * I)>>2) > 0xFFF) { I = (0xFFF*2/srcPitch); pOverlay->VUSF = 0xFFFF; - } - else - { + } else { dstH = I * dstH; if (srcH % dstH) pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; @@ -711,61 +1020,59 @@ /* set video frame buffer offset */ pOverlay->pitch = (CARD16)(srcPitch*I); } - } + } } - static void set_line_buf_size(SISOverlayPtr pOverlay) { - CARD8 preHIDF; + CARD8 preHIDF; CARD32 I; CARD32 line = pOverlay->srcW; - if (pOverlay->pixelFormat == PIXEL_FMT_YV12) + if ( (pOverlay->pixelFormat == PIXEL_FMT_YV12) || + (pOverlay->pixelFormat == PIXEL_FMT_I420) ) { preHIDF = pOverlay->wHPre & 0x07; switch (preHIDF) { case 3 : if ((line & 0xffffff00) == line) - I = (line >> 8); + I = (line >> 8); else - I = (line >> 8) + 1; + I = (line >> 8) + 1; pOverlay->lineBufSize = (CARD8)(I * 32 - 1); break; case 4 : if ((line & 0xfffffe00) == line) - I = (line >> 9); + I = (line >> 9); else - I = (line >> 9) + 1; + I = (line >> 9) + 1; pOverlay->lineBufSize = (CARD8)(I * 64 - 1); break; case 5 : if ((line & 0xfffffc00) == line) - I = (line >> 10); + I = (line >> 10); else - I = (line >> 10) + 1; + I = (line >> 10) + 1; pOverlay->lineBufSize = (CARD8)(I * 128 - 1); break; case 6 : if ((line & 0xfffff800) == line) - I = (line >> 11); + I = (line >> 11); else - I = (line >> 11) + 1; + I = (line >> 11) + 1; pOverlay->lineBufSize = (CARD8)(I * 256 - 1); break; default : if ((line & 0xffffff80) == line) - I = (line >> 7); + I = (line >> 7); else - I = (line >> 7) + 1; + I = (line >> 7) + 1; pOverlay->lineBufSize = (CARD8)(I * 16 - 1); break; } - } - else - { + } else { /* YUV2, UYVY */ if ((line & 0xffffff8) == line) I = (line >> 3); else @@ -775,53 +1082,113 @@ } static void -merge_line_buf(SISPtr pSIS, SISPortPrivPtr pPriv, Bool enable) +merge_line_buf(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable) { if(enable) { - if(pPriv->displayMode == DISPMODE_MIRROR) { - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x00, 0x11); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x04, 0x04); - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x01, 0x11); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x04, 0x04); - } - else { - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x10, 0x11); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x11, 0x11); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); + switch (pPriv->displayMode){ + case DISPMODE_SINGLE1: + if (pPriv->hasTwoOverlays) { + if (pPriv->dualHeadMode) { + /* line merge */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x04, 0x04); + } else { + /* dual line merge */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x10, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + } + } else { + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x10, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + } + break; + case DISPMODE_SINGLE2: + if (pPriv->hasTwoOverlays) { + if (pPriv->dualHeadMode) { + /* line merge */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x04, 0x04); + } else { + /* line merge */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x04, 0x04); + } + } else { + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x10, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + } + break; + case DISPMODE_MIRROR: + default: + /* line merge */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x04, 0x04); + if (pPriv->hasTwoOverlays) { + /* line merge */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x04, 0x04); + } + break; } - } - else { - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x00, 0x11); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x01, 0x11); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x00, 0x04); + } else { + switch (pPriv->displayMode) { + case DISPMODE_SINGLE1: + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + break; + case DISPMODE_SINGLE2: + if (pPriv->hasTwoOverlays) { + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + } else { + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + } + break; + case DISPMODE_MIRROR: + default: + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + if (pPriv->hasTwoOverlays) { + setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x11); + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04); + } + break; + } } } - static void -set_format(SISPtr pSIS, SISOverlayPtr pOverlay) +set_format(SISPtr pSiS, SISOverlayPtr pOverlay) { CARD8 fmt; - switch (pOverlay->pixelFormat) - { - case PIXEL_FMT_YV12: + switch (pOverlay->pixelFormat){ + case PIXEL_FMT_YV12: + case PIXEL_FMT_I420: fmt = 0x0c; break; - case PIXEL_FMT_YUY2: - fmt = 0x28; + case PIXEL_FMT_YUY2: + fmt = 0x28; + break; + case PIXEL_FMT_UYVY: + fmt = 0x08; break; - default: + case PIXEL_FMT_RGB5: /* D[5:4] : 00 RGB555, 01 RGB 565 */ + fmt = 0x00; + break; + case PIXEL_FMT_RGB6: + fmt = 0x10; + break; + default: fmt = 0x00; break; } - setvideoregmask(pSIS, Index_VI_Control_Misc0, fmt, 0x7c); + setvideoregmask(pSiS, Index_VI_Control_Misc0, fmt, 0x7c); } static void -set_colorkey(SISPtr pSIS, CARD32 colorkey) +set_colorkey(SISPtr pSiS, CARD32 colorkey) { CARD8 r, g, b; @@ -830,144 +1197,478 @@ r = (CARD8)((colorkey>>16) & 0xFF); /* Activate the colorkey mode */ - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Min ,(CARD8)b); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Min ,(CARD8)g); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Min ,(CARD8)r); + setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Blue_Min ,(CARD8)b); + setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Green_Min ,(CARD8)g); + setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Red_Min ,(CARD8)r); + + setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Blue_Max ,(CARD8)b); + setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Green_Max ,(CARD8)g); + setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Red_Max ,(CARD8)r); +} - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Max ,(CARD8)b); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Max ,(CARD8)g); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Max ,(CARD8)r); +static void +set_brightness(SISPtr pSiS, CARD8 brightness) +{ + setvideoreg(pSiS, Index_VI_Brightness, brightness); } +static void +set_contrast(SISPtr pSiS, CARD8 contrast) +{ + setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, contrast, 0x07); +} +/* 310/325 series only */ static void -set_brightness(SISPtr pSIS, CARD8 brightness) +set_saturation(SISPtr pSiS, char saturation) { - setvideoreg(pSIS, Index_VI_Brightness ,brightness); + CARD8 temp = 0; + + if(saturation < 0) { + temp |= 0x88; + saturation = -saturation; + } + temp |= (saturation & 0x07); + temp |= ((saturation & 0x07) << 4); + + setvideoreg(pSiS, Index_VI_Saturation, temp); } +/* 310/325 series only */ +static void +set_hue(SISPtr pSiS, CARD8 hue) +{ + setvideoreg(pSiS, Index_VI_Hue, (hue & 0x08) ? (hue ^ 0x07) : hue); +} + +#ifdef NOT_YET_IMPLEMENTED /* ----------- TW: FOR FUTURE USE -------------------- */ + +/* TW: Set Alpha */ +static void +set_alpha(SISPtr pSiS, CARD8 alpha) +{ + CARD8 data; + + data = getvideoreg(pSiS, Index_VI_Key_Overlay_OP); + data &= 0x0F; + setvideoreg(pSiS,Index_VI_Key_Overlay_OP, data | (alpha << 4)); +} + +/* TW: Set SubPicture Start Address (yet unused) */ +static void +set_subpict_start_offset(SISPtr pSiS, SISOverlayPtr pOverlay, int index) +{ + CARD32 temp; + CARD8 data; + + temp = pOverlay->SubPictAddr >> 4; /* TW: 630 <-> 315 shiftValue? */ + + setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_Low, temp & 0xFF); + setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_Middle, (temp>>8) & 0xFF); + setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_High, (temp>>16) & 0x3F); + if (pSiS->VGAEngine == SIS_315_VGA) { + setvideoreg(pSiS,Index_VI_SubPict_Start_Over, (temp>>22) & 0x01); + /* Submit SubPict offset ? */ + /* data=getvideoreg(pSiS,Index_VI_Control_Misc3); */ + setvideoreg(pSiS,Index_VI_Control_Misc3, (1 << index) | 0x04); + } +} + +/* TW: Set SubPicture Pitch (yet unused) */ +static void +set_subpict_pitch(SISPtr pSiS, SISOverlayPtr pOverlay, int index) +{ + CARD32 temp; + CARD8 data; + + temp = pOverlay->SubPictPitch >> 4; /* TW: 630 <-> 315 shiftValue? */ + + setvideoreg(pSiS,Index_VI_SubPict_Buf_Pitch, temp & 0xFF); + if (pSiS->VGAEngine == SIS_315_VGA) { + setvideoreg(pSiS,Index_VI_SubPict_Buf_Pitch_High, (temp>>8) & 0xFF); + /* Submit SubPict pitch ? */ + /* data=getvideoreg(pSiS,Index_VI_Control_Misc3); */ + setvideoreg(pSiS,Index_VI_Control_Misc3, (1 << index) | 0x04); + } +} +/* TW: Calculate and set SubPicture scaling (untested, unused yet) */ static void -set_overlay(SISPtr pSIS, SISOverlayPtr pOverlay) +set_subpict_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn, + SISPortPrivPtr pPriv, int index, int iscrt2) { - ScrnInfoPtr pScrn = pSIS->pScrn; + SISPtr pSiS = SISPTR(pScrn); + CARD32 I=0,mult=0; + int flag=0; + + int dstW = pOverlay->SubPictdstBox.x2 - pOverlay->SubPictdstBox.x1; + int dstH = pOverlay->SubPictdstBox.y2 - pOverlay->SubPictdstBox.y1; + int srcW = pOverlay->SubPictsrcW; + int srcH = pOverlay->SubPictsrcH; + CARD16 LCDheight = pSiS->LCDheight; + int srcPitch = pOverlay->SubPictOrigPitch; + int origdstH = dstH; + + /* TW: Stretch image due to idiotic LCD "auto"-scaling */ + /* INCOMPLETE - See set_scale_factor() */ + if ( (pPriv->bridgeIsSlave) && (pSiS->VBFlags & CRT2_LCD) ) { + dstH = (dstH * LCDheight) / pOverlay->SCREENheight; + } else if ((index) && (pSiS->VBFlags & CRT2_LCD)) { + dstH = (dstH * LCDheight) / pOverlay->SCREENheight; + if (pPriv->displayMode == DISPMODE_MIRROR) flag = 1; + } + if (dstW == srcW) { + pOverlay->SubPictHUSF = 0x00; + pOverlay->SubPictIntBit = 0x01; + } else if (dstW > srcW) { + pOverlay->SubPictHUSF = (srcW << 16) / dstW; + pOverlay->SubPictIntBit = 0x00; + } else { + int tmpW = dstW; + + I = 0x00; + while (srcW >= tmpW) { + tmpW <<= 1; + I++; + } + pOverlay->SubPictwHPre = (CARD8)(I - 1); + dstW <<= (I - 1); + if ((srcW % dstW)) + pOverlay->SubPictHUSF = ((srcW - dstW) << 16) / dstW; + else + pOverlay->SubPictHUSF = 0x00; + + pOverlay->SubPictIntBit = 0x01; + } + + if (dstH == srcH) { + pOverlay->SubPictVUSF = 0x00; + pOverlay->SubPictIntBit |= 0x02; + } else if (dstH > srcH) { + dstH += 0x02; + pOverlay->SubPictVUSF = (srcH << 16) / dstH; + /* pOverlay->SubPictIntBit |= 0x00; */ + } else { + CARD32 realI; + + I = realI = srcH / dstH; + pOverlay->SubPictIntBit |= 0x02; + + if (I < 2) { + pOverlay->SubPictVUSF = ((srcH - dstH) << 16) / dstH; + /* TW: Needed for LCD-scaling modes */ + if ((flag) && (mult = (srcH / origdstH)) >= 2) + pOverlay->SubPictPitch /= mult; + } else { + if (((srcPitch * I)>>2) > 0xFFF) { + I = (0xFFF*2/srcPitch); + pOverlay->SubPictVUSF = 0xFFFF; + } else { + dstH = I * dstH; + if (srcH % dstH) + pOverlay->SubPictVUSF = ((srcH - dstH) << 16) / dstH; + else + pOverlay->SubPictVUSF = 0x00; + } + /* set video frame buffer offset */ + pOverlay->SubPictPitch = (CARD16)(srcPitch*I); + } + } + /* set SubPicture scale factor */ + setvideoreg (pSiS, Index_VI_SubPict_Hor_Scale_Low, (CARD8)(pOverlay->SubPictHUSF)); + setvideoreg (pSiS, Index_VI_SubPict_Hor_Scale_High, (CARD8)((pOverlay->SubPictHUSF)>>8)); + setvideoreg (pSiS, Index_VI_SubPict_Vert_Scale_Low, (CARD8)(pOverlay->SubPictVUSF)); + setvideoreg (pSiS, Index_VI_SubPict_Vert_Scale_High,(CARD8)((pOverlay->SubPictVUSF)>>8)); + + setvideoregmask (pSiS, Index_VI_SubPict_Scale_Control, + (pOverlay->SubPictIntBit << 3) | + (pOverlay->SubPictwHPre), 0x7f); +} + +/* TW: Set SubPicture Preset (yet unused) */ +static void +set_subpict_preset(SISPtr pSiS, SISOverlayPtr pOverlay) +{ + CARD32 temp; + CARD8 data; + + temp = pOverlay->SubPictPreset >> 4; /* TW: 630 <-> 315 ? */ + + setvideoreg(pSiS,Index_VI_SubPict_Buf_Preset_Low, temp & 0xFF); + setvideoreg(pSiS,Index_VI_SubPict_Buf_Preset_Middle, (temp>>8) & 0xFF); + data = getvideoreg(pSiS,Index_VI_SubPict_Buf_Start_High); + if (temp > 0xFFFF) + data |= 0x40; + else + data &= ~0x40; + setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_High, data); +} + +static void +enable_subpict_overlay(SISPtr pSiS, Bool enable) +{ + setvideoregmask(pSiS, Index_VI_SubPict_Scale_Control, + enable ? 0x40 : 0x00, + 0x40); +} + +/* TW: Set overlay for subpicture */ +static void +set_subpict_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index) +{ + ScrnInfoPtr pScrn = pSiS->pScrn; + + set_subpict_pitch(pSiS, &overlay, index); + set_subpict_start_offset(pSiS, &overlay, index); + set_subpict_scale_factor(&overlay, pScrn, pPriv, index); + /* set_subpict_preset(pSiS, &overlay); */ + /* enable_subpict_overlay(pSiS, 1); */ +} + + +/* TW: Set MPEG Field Preset (yet unused) */ +static void +set_mpegfield_preset(SISPtr pSiS, SISOverlayPtr pOverlay) +{ + setvideoreg(pSiS,Index_MPEG_Y_Buf_Preset_Low, pOverlay->MPEG_Y & 0xFF); + setvideoreg(pSiS,Index_MPEG_Y_Buf_Preset_Middle, (pOverlay->MPEG_Y>>8) & 0xFF); + + setvideoreg(pSiS,Index_MPEG_UV_Buf_Preset_Low, pOverlay->MPEG_UV & 0xFF); + setvideoreg(pSiS,Index_MPEG_UV_Buf_Preset_Middle, (pOverlay->MPEG_UV>>8) & 0xFF); + + setvideoreg(pSiS,Index_MPEG_Y_UV_Buf_Preset_High, + ((pOverlay->MPEG_Y>>16) & 0x0F) | ((pOverlay->MPEG_UV>>12) & 0xF0)); +} + +static void +set_mpegfield_scale(SISPtr pSiS, SISOverlayPtr pOverlay) +{ + /* Empty for now */ +} + +#endif /* ------------------------------------------------------------------- */ + +static void +set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index) +{ + ScrnInfoPtr pScrn = pSiS->pScrn; + CARD16 pitch=0; CARD8 h_over=0, v_over=0; - CARD16 bottom, right; - CARD16 screenX = pScrn->currentMode->HDisplay; - CARD16 screenY = pScrn->currentMode->VDisplay; + CARD16 top, bottom, left, right; + CARD16 screenX = pSiS->CurrentLayout.mode->HDisplay; + CARD16 screenY = pSiS->CurrentLayout.mode->VDisplay; + CARD8 data; + CARD32 watchdog; + top = pOverlay->dstBox.y1; bottom = pOverlay->dstBox.y2; - if (bottom > screenY) + if (bottom > screenY) { bottom = screenY; + } + left = pOverlay->dstBox.x1; right = pOverlay->dstBox.x2; - if (right > screenX) + if (right > screenX) { right = screenX; + } - h_over = (((pOverlay->dstBox.x1>>8) & 0x0f) | ((right>>4) & 0xf0)); - v_over = (((pOverlay->dstBox.y1>>8) & 0x0f) | ((bottom>>4) & 0xf0)); + /* TW: DoubleScan modes require Y coordinates * 2 */ + if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) { + top <<= 1; + bottom <<= 1; + } + /* TW: Interlace modes require Y coordinates / 2 */ + if(pSiS->CurrentLayout.mode->Flags & V_INTERLACE) { + top >>= 1; + bottom >>= 1; + } - pitch = pOverlay->pitch; + h_over = (((left>>8) & 0x0f) | ((right>>4) & 0xf0)); + v_over = (((top>>8) & 0x0f) | ((bottom>>4) & 0xf0)); + pitch = pOverlay->pitch >> pPriv->shiftValue; + /* set line buffer size */ - setvideoreg(pSIS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize); - - setvideoregmask (pSIS, Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0f); + setvideoreg(pSiS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize); - while (pOverlay->VBlankActiveFunc(pSIS)); - while (!pOverlay->VBlankActiveFunc(pSIS)); - - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch>>2)); - setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 10), 0x0f); + /* set color key mode */ + setvideoregmask (pSiS, Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0f); - setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x20, 0x20); - if (pOverlay->pixelFormat == PIXEL_FMT_YV12) - { + /* TW: We don't have to wait for vertical retrace in all cases */ + if(pPriv->mustwait) { + watchdog = WATCHDOG_DELAY; + while (pOverlay->VBlankActiveFunc(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while ((!pOverlay->VBlankActiveFunc(pSiS)) && --watchdog); + if (!watchdog) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Xv: Waiting for vertical retrace timed-out\n"); + } + + /* Unlock address registers */ + data = getvideoreg(pSiS, Index_VI_Control_Misc1); + setvideoreg (pSiS, Index_VI_Control_Misc1, data | 0x20); + /* TEST: Is this required? */ + setvideoreg (pSiS, Index_VI_Control_Misc1, data | 0x20); + /* TEST end */ + + /* TEST: Is this required? */ + if (pSiS->Chipset == SIS_315_VGA) + setvideoreg (pSiS, Index_VI_Control_Misc3, 0x00); + /* TEST end */ + + /* Set Y buf pitch */ + setvideoreg (pSiS, Index_VI_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch)); + setvideoregmask (pSiS, Index_VI_Disp_Y_UV_Buf_Pitch_Middle, (CARD8)(pitch>>8), 0x0f); + + /* Set Y start address */ + setvideoreg (pSiS, Index_VI_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY)); + setvideoreg (pSiS, Index_VI_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8)); + setvideoreg (pSiS, Index_VI_Disp_Y_Buf_Start_High, (CARD8)((pOverlay->PSY)>>16)); + + /* set 310/325 series overflow bits for Y plane */ + if (pSiS->VGAEngine == SIS_315_VGA) { + setvideoreg (pSiS, Index_VI_Disp_Y_Buf_Pitch_High, (CARD8)(pitch>>12)); + setvideoreg (pSiS, Index_VI_Y_Buf_Start_Over, ((CARD8)((pOverlay->PSY)>>24) & 0x01)); + } + + /* Set U/V data if using plane formats */ + if ( (pOverlay->pixelFormat == PIXEL_FMT_YV12) || + (pOverlay->pixelFormat == PIXEL_FMT_I420) ) { + CARD32 PSU=0, PSV=0; PSU = pOverlay->PSU; PSV = pOverlay->PSV; - setvideoreg (pSIS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)(pitch >> 3)); - setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 7), 0xf0); + /* Set U/V pitch */ + setvideoreg (pSiS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)(pitch >> 1)); + setvideoregmask (pSiS, Index_VI_Disp_Y_UV_Buf_Pitch_Middle, (CARD8)(pitch >> 5), 0xf0); + /* set U/V start address */ - setvideoreg (pSIS, Index_VI_U_Buf_Start_Low, (CARD8)PSU); - setvideoreg (pSIS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU>>8)); - setvideoreg (pSIS, Index_VI_U_Buf_Start_High, (CARD8)(PSU>>16)); - - setvideoreg (pSIS, Index_VI_V_Buf_Start_Low, (CARD8)PSV); - setvideoreg (pSIS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV>>8)); - setvideoreg (pSIS, Index_VI_V_Buf_Start_High, (CARD8)(PSV>>16)); + setvideoreg (pSiS, Index_VI_U_Buf_Start_Low, (CARD8)PSU); + setvideoreg (pSiS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU>>8)); + setvideoreg (pSiS, Index_VI_U_Buf_Start_High, (CARD8)(PSU>>16)); + + setvideoreg (pSiS, Index_VI_V_Buf_Start_Low, (CARD8)PSV); + setvideoreg (pSiS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV>>8)); + setvideoreg (pSiS, Index_VI_V_Buf_Start_High, (CARD8)(PSV>>16)); + + /* 310/325 series overflow bits */ + if (pSiS->VGAEngine == SIS_315_VGA) { + setvideoreg (pSiS, Index_VI_Disp_UV_Buf_Pitch_High, (CARD8)(pitch>>13)); + setvideoreg (pSiS, Index_VI_U_Buf_Start_Over, ((CARD8)(PSU>>24) & 0x01)); + setvideoreg (pSiS, Index_VI_V_Buf_Start_Over, ((CARD8)(PSV>>24) & 0x01)); + } } + + if (pSiS->VGAEngine == SIS_315_VGA) { + /* Trigger register copy for 310 series */ + setvideoreg(pSiS, Index_VI_Control_Misc3, 1 << index); + } + /* set scale factor */ - setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF)); - setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF)>>8)); - setvideoreg (pSIS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF)); - setvideoreg (pSIS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF)>>8)); - - setvideoregmask (pSIS, Index_VI_Scale_Control, (pOverlay->IntBit << 3)|(pOverlay->wHPre), 0x7f); - - /* set destination position */ - setvideoreg(pSIS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)pOverlay->dstBox.x1); - setvideoreg(pSIS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right); - setvideoreg(pSIS, Index_VI_Win_Hor_Over, (CARD8)h_over); - - setvideoreg(pSIS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)pOverlay->dstBox.y1); - setvideoreg(pSIS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom); - setvideoreg(pSIS, Index_VI_Win_Ver_Over, (CARD8)v_over); - - /* set display start address */ - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY)); - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8)); - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_High, (CARD8)((pOverlay->PSY)>>16)); - setvideoregmask(pSIS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a); - setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x00, 0x20); - - /* set contrast factor */ -/* - setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, pOverlay->contrastCtrl<<6, 0xc0); - setvideoreg (pSIS, Index_VI_Contrast_Factor, pOverlay->contrastFactor); -*/ -} + setvideoreg (pSiS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF)); + setvideoreg (pSiS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF)>>8)); + setvideoreg (pSiS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF)); + setvideoreg (pSiS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF)>>8)); + + setvideoregmask (pSiS, Index_VI_Scale_Control, (pOverlay->IntBit << 3) + |(pOverlay->wHPre), 0x7f); + + /* set destination window position */ + setvideoreg(pSiS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)left); + setvideoreg(pSiS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right); + setvideoreg(pSiS, Index_VI_Win_Hor_Over, (CARD8)h_over); + setvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)top); + setvideoreg(pSiS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom); + setvideoreg(pSiS, Index_VI_Win_Ver_Over, (CARD8)v_over); + setvideoregmask(pSiS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a); + + /* Lock the address registers */ + setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x20); +} + +/* TW: Overlay MUST NOT be switched off while beam is over it */ static void -close_overlay(SISPtr pSIS, SISPortPrivPtr pPriv) +close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv) { - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0, 0x01); - setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); - setvideoregmask (pSIS, Index_VI_Control_Misc2, 1, 0x01); - setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); -} + CARD32 watchdog; + if ((pPriv->displayMode == DISPMODE_SINGLE2) || + (pPriv->displayMode == DISPMODE_MIRROR)) { + if (pPriv->hasTwoOverlays) { + setvideoregmask (pSiS, Index_VI_Control_Misc2, 0x01, 0x01); + watchdog = WATCHDOG_DELAY; + while(vblank_active_CRT2(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT2(pSiS)) && --watchdog); + setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02); + watchdog = WATCHDOG_DELAY; + while(vblank_active_CRT2(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT2(pSiS)) && --watchdog); + } else if (pPriv->displayMode == DISPMODE_SINGLE2) { + setvideoregmask (pSiS, Index_VI_Control_Misc2, 0x00, 0x01); + watchdog = WATCHDOG_DELAY; + while(vblank_active_CRT1(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT1(pSiS)) && --watchdog); + setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02); + watchdog = WATCHDOG_DELAY; + while(vblank_active_CRT1(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT1(pSiS)) && --watchdog); + } + } + if ((pPriv->displayMode == DISPMODE_SINGLE1) || + (pPriv->displayMode == DISPMODE_MIRROR)) { + setvideoregmask (pSiS, Index_VI_Control_Misc2, 0x00, 0x01); + watchdog = WATCHDOG_DELAY; + while(vblank_active_CRT1(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT1(pSiS)) && --watchdog); + setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02); + watchdog = WATCHDOG_DELAY; + while(vblank_active_CRT1(pSiS) && --watchdog); + watchdog = WATCHDOG_DELAY; + while((!vblank_active_CRT1(pSiS)) && --watchdog); + } +} static void SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) { - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); short srcPitch = pPriv->srcPitch; short height = pPriv->height; SISOverlayRec overlay; int srcOffsetX=0, srcOffsetY=0; int sx, sy; - int index = 0; + int index = 0, iscrt2 = 0; memset(&overlay, 0, sizeof(overlay)); overlay.pixelFormat = pPriv->id; - overlay.pitch = srcPitch; - overlay.keyOP = 0x03; + overlay.pitch = overlay.origPitch = srcPitch; + overlay.keyOP = 0x03; /* DestKey mode */ /* overlay.bobEnable = 0x02; */ - overlay.bobEnable = 0x00; + overlay.bobEnable = 0x00; /* Disable BOB (whatever that is) */ + + overlay.SCREENheight = pSiS->CurrentLayout.mode->VDisplay; overlay.dstBox.x1 = pPriv->drw_x - pScrn->frameX0; overlay.dstBox.x2 = pPriv->drw_x + pPriv->drw_w - pScrn->frameX0; overlay.dstBox.y1 = pPriv->drw_y - pScrn->frameY0; overlay.dstBox.y2 = pPriv->drw_y + pPriv->drw_h - pScrn->frameY0; + + if((overlay.dstBox.x1 > overlay.dstBox.x2) || + (overlay.dstBox.y1 > overlay.dstBox.y2)) + return; - /* FIXME: assume (x2 > x1), (y2 > y1) */ if((overlay.dstBox.x2 < 0) || (overlay.dstBox.y2 < 0)) return; @@ -987,133 +1688,236 @@ overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy*srcPitch; overlay.PSV = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch + ((sx + sy*srcPitch/2) >> 1); overlay.PSU = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch*5/4 + ((sx + sy*srcPitch/2) >> 1); - overlay.PSY >>= 2; - overlay.PSV >>= 2; - overlay.PSU >>= 2; +#ifdef SISDUALHEAD + overlay.PSY += HEADOFFSET; + overlay.PSV += HEADOFFSET; + overlay.PSU += HEADOFFSET; +#endif + overlay.PSY >>= pPriv->shiftValue; + overlay.PSV >>= pPriv->shiftValue; + overlay.PSU >>= pPriv->shiftValue; break; + case PIXEL_FMT_I420: + sx = (pPriv->src_x + srcOffsetX) & ~7; + sy = (pPriv->src_y + srcOffsetY) & ~1; + overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy*srcPitch; + overlay.PSV = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch*5/4 + ((sx + sy*srcPitch/2) >> 1); + overlay.PSU = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch + ((sx + sy*srcPitch/2) >> 1); +#ifdef SISDUALHEAD + overlay.PSY += HEADOFFSET; + overlay.PSV += HEADOFFSET; + overlay.PSU += HEADOFFSET; +#endif + overlay.PSY >>= pPriv->shiftValue; + overlay.PSV >>= pPriv->shiftValue; + overlay.PSU >>= pPriv->shiftValue; + break; case PIXEL_FMT_YUY2: + case PIXEL_FMT_UYVY: + case PIXEL_FMT_RGB6: + case PIXEL_FMT_RGB5: default: sx = (pPriv->src_x + srcOffsetX) & ~1; sy = (pPriv->src_y + srcOffsetY); - overlay.PSY = (pPriv->bufAddr[pPriv->currentBuf] + sx*2 + sy*srcPitch) >> 2; + overlay.PSY = (pPriv->bufAddr[pPriv->currentBuf] + sx*2 + sy*srcPitch); +#ifdef SISDUALHEAD + overlay.PSY += HEADOFFSET; +#endif + overlay.PSY >>= pPriv->shiftValue; break; } /* FIXME: is it possible that srcW < 0 */ overlay.srcW = pPriv->src_w - (sx - pPriv->src_x); overlay.srcH = pPriv->src_h - (sy - pPriv->src_y); + + if ( (pPriv->oldx1 != overlay.dstBox.x1) || + (pPriv->oldx2 != overlay.dstBox.x2) || + (pPriv->oldy1 != overlay.dstBox.y1) || + (pPriv->oldy2 != overlay.dstBox.y2) ) { + pPriv->mustwait = 1; + pPriv->oldx1 = overlay.dstBox.x1; pPriv->oldx2 = overlay.dstBox.x2; + pPriv->oldy1 = overlay.dstBox.y1; pPriv->oldy2 = overlay.dstBox.y2; + } - /* merge line buffer */ - /* TODO: unnecessay to do it several times */ - merge_line_buf (pSIS, pPriv, (overlay.srcW > 384)); + /* TW: setup dispmode (MIRROR, SINGLEx) */ + set_dispmode(pScrn, pPriv); - /* set line buffer length */ - set_line_buf_size (&overlay); - - /* set scale factor */ - set_scale_factor (&overlay, pScrn); + /* TW: set display mode SR06,32 (CRT1, CRT2 or mirror) */ + set_disptype_regs(pScrn, pPriv); - if( (pPriv->displayMode == DISPMODE_SINGLE2) ) { - index = 1; + /* set (not only calc) merge line buffer */ + merge_line_buf(pSiS, pPriv, (overlay.srcW > 384)); + + /* calculate (not set!) line buffer length */ + set_line_buf_size(&overlay); + + if (pPriv->displayMode == DISPMODE_SINGLE2) { + if (pPriv->hasTwoOverlays) { + /* TW: On chips with two overlays we use + * overlay 2 for CRT2 */ + index = 1; iscrt2 = 1; + } else { + /* TW: On chips with only one overlay we + * use that only overlay for CRT2 */ + index = 0; iscrt2 = 1; + } overlay.VBlankActiveFunc = vblank_active_CRT2; - overlay.GetScanLineFunc = get_scanline_CRT2; - } - else { - index = 0; + /* overlay.GetScanLineFunc = get_scanline_CRT2; */ + } else { + index = 0; iscrt2 = 0; overlay.VBlankActiveFunc = vblank_active_CRT1; - overlay.GetScanLineFunc = get_scanline_CRT1; + /* overlay.GetScanLineFunc = get_scanline_CRT1; */ } + /* TW: Do the following in a loop for CRT1 and CRT2 ----------------- */ MIRROR: - setvideoregmask (pSIS, Index_VI_Control_Misc2, index, 0x01); + /* calculate (not set!) scale factor */ + calc_scale_factor(&overlay, pScrn, pPriv, index, iscrt2); - /* set scale temporarily */ - { - int dstW = overlay.dstBox.x2 - overlay.dstBox.x1; - int srcW = overlay.srcW; - unsigned char i = 0; - - dstW <<= 1; - while(srcW > dstW) { - dstW <<= 1; - i++; - } - setvideoregmask (pSIS, Index_VI_Scale_Control, i, 0x07); - } - + /* Select video1 (used for CRT1) or video2 (used for CRT2) */ + setvideoregmask(pSiS, Index_VI_Control_Misc2, index, 0x01); + /* set format */ - set_format(pSIS, &overlay); - + set_format(pSiS, &overlay); + /* set color key */ - /* TODO: update only when colorkey changed */ - /* FIXME, is the RGB order correct? */ - set_colorkey(pSIS, pPriv->colorKey); + set_colorkey(pSiS, pPriv->colorKey); - /* set brightness */ - set_brightness(pSIS, pPriv->brightness); - + /* set brightness, contrast, hue and saturation */ + set_brightness(pSiS, pPriv->brightness); + set_contrast(pSiS, pPriv->contrast); + if (pSiS->VGAEngine == SIS_315_VGA) { + set_hue(pSiS, pPriv->hue); + set_saturation(pSiS, pPriv->saturation); + } + /* set overlay */ - set_overlay(pSIS, &overlay); - - /* enable overlay */ - setvideoregmask (pSIS, Index_VI_Control_Misc0, 0x02, 0x02); + set_overlay(pSiS, &overlay, pPriv, index); + + /* enable overlay */ + setvideoregmask (pSiS, Index_VI_Control_Misc0, 0x02, 0x02); - if(((pPriv->displayMode == DISPMODE_MIRROR) && (index == 0))) { - index = 1; + if(index == 0 && + pPriv->displayMode == DISPMODE_MIRROR && + pPriv->hasTwoOverlays) { + index = 1; iscrt2 = 1; overlay.VBlankActiveFunc = vblank_active_CRT2; - overlay.GetScanLineFunc = get_scanline_CRT2; + /* overlay.GetScanLineFunc = get_scanline_CRT2; */ goto MIRROR; } + pPriv->mustwait = 0; } +static FBLinearPtr +SISAllocateOverlayMemory( + ScrnInfoPtr pScrn, + FBLinearPtr linear, + int size +){ + ScreenPtr pScreen; + FBLinearPtr new_linear; -static void + if(linear) { + if(linear->size >= size) + return linear; + + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; + + xf86FreeOffscreenLinear(linear); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8, + NULL, NULL, NULL); + + if(!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 8, + PRIORITY_EXTREME); + + if(max_size < size) return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8, + NULL, NULL, NULL); + } + if (!new_linear) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Xv: Failed to allocate %dK of video memory\n", size/1024); +#ifdef TWDEBUG + else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Xv: Allocated %dK of video memory\n", size/1024); +#endif + + return new_linear; +} + +static void +SISFreeOverlayMemory(ScrnInfoPtr pScrn) +{ + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } +} + +static void SISStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { SISPortPrivPtr pPriv = (SISPortPrivPtr)data; - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); + + if(pPriv->grabbedByV4L) + return; - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - close_overlay(pSIS, pPriv); + close_overlay(pSiS, pPriv); + pPriv->mustwait = 1; } - if(pPriv->fbAreaPtr) { - xf86FreeOffscreenArea(pPriv->fbAreaPtr); - pPriv->fbAreaPtr = NULL; - pPriv->fbSize = 0; - } + SISFreeOverlayMemory(pScrn); pPriv->videoStatus = 0; + pSiS->VideoTimerCallback = NULL; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - pPriv->videoStatus |= OFF_TIMER; - pPriv->offTime = currentTime.milliseconds + OFF_DELAY; - /* FIXME */ -/* SISDisplayVideo(pScrn, pPriv); */ + pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + pSiS->VideoTimerCallback = SISVideoTimerCallback; } } } - -static int -SISPutImage( - ScrnInfoPtr pScrn, - short src_x, short src_y, +static int +SISPutImage( + ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, - short src_w, short src_h, + short src_w, short src_h, short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, + int id, unsigned char* buf, + short width, short height, Bool sync, RegionPtr clipBoxes, pointer data ){ - SISPtr pSIS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); SISPortPrivPtr pPriv = (SISPortPrivPtr)data; int totalSize=0; - + int depth = pSiS->CurrentLayout.bitsPerPixel >> 3; + + if(pPriv->grabbedByV4L) + return Success; + pPriv->drw_x = drw_x; pPriv->drw_y = drw_y; pPriv->drw_w = drw_w; @@ -1125,160 +1929,526 @@ pPriv->id = id; pPriv->height = height; + /* TW: Pixel formats: + 1. YU12: 3 planes: H V + Y sample period 1 1 (8 bit per pixel) + V sample period 2 2 (8 bit per pixel, subsampled) + U sample period 2 2 (8 bit per pixel, subsampled) + + Y plane is fully sampled (width*height), U and V planes + are sampled in 2x2 blocks, hence a group of 4 pixels requires + 4 + 1 + 1 = 6 bytes. The data is planar, ie in single planes + for Y, U and V. + 2. UYVY: 3 planes: H V + Y sample period 1 1 (8 bit per pixel) + V sample period 2 1 (8 bit per pixel, subsampled) + U sample period 2 1 (8 bit per pixel, subsampled) + Y plane is fully sampled (width*height), U and V planes + are sampled in 2x1 blocks, hence a group of 4 pixels requires + 4 + 2 + 2 = 8 bytes. The data is bit packed, there are no separate + Y, U or V planes. + Bit order: U0 Y0 V0 Y1 U2 Y2 V2 Y3 ... + 3. I420: Like YU12, but planes U and V are in reverse order. + 4. YUY2: Like UYVY, but order is + Y0 U0 Y1 V0 Y2 U2 Y3 V2 ... + */ + switch(id){ case PIXEL_FMT_YV12: + case PIXEL_FMT_I420: pPriv->srcPitch = (width + 7) & ~7; - totalSize = (pPriv->srcPitch * height * 3) >> 1; + /* Size = width * height * 3 / 2 */ + totalSize = (pPriv->srcPitch * height * 3) >> 1; /* Verified */ break; case PIXEL_FMT_YUY2: + case PIXEL_FMT_UYVY: + case PIXEL_FMT_RGB6: + case PIXEL_FMT_RGB5: default: - pPriv->srcPitch = (width*2 + 3) & ~3; + pPriv->srcPitch = ((width << 1) + 3) & ~3; /* Verified */ + /* Size = width * 2 * height */ totalSize = pPriv->srcPitch * height; } - - /* allocate memory */ - do { - int lines, pitch, depth; - BoxPtr pBox; - - if(totalSize == pPriv->fbSize) - break; - - pPriv->fbSize = totalSize; - /* TODO: use xf86AllocateOffscreenLinear is better */ - if(pPriv->fbAreaPtr) { - /* TODO: resize */ - xf86FreeOffscreenArea(pPriv->fbAreaPtr); - } - depth = (pScrn->bitsPerPixel + 7 ) / 8; - pitch = pScrn->displayWidth * depth; - lines = ((totalSize * 2) / pitch) + 1; - pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen, - pScrn->displayWidth, - lines, 0, NULL, NULL, NULL); - - if(!pPriv->fbAreaPtr) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Allocate video memory fails\n"); - return BadAlloc; - } - pBox = &(pPriv->fbAreaPtr->box); - pPriv->bufAddr[0] = (pBox->x1 * depth) + (pBox->y1 * pitch); - pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize; - } while(0); + /* allocate memory (we do doublebuffering) */ + if(!(pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, + totalSize<<1))) + return BadAlloc; + + /* fixup pointers */ + pPriv->bufAddr[0] = (pPriv->linear->offset * depth); + pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize; /* copy data */ /* TODO: subimage */ - memcpy(pSIS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); - + memcpy(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); + SISDisplayVideo(pScrn, pPriv); - /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); - /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + /* update cliplist */ + if(pPriv->autopaintColorKey && + (pPriv->grabbedByV4L || !RegionsEqual(&pPriv->clip, clipBoxes))) { + /* We always paint colorkey for V4L */ + if (!pPriv->grabbedByV4L) + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + /* xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); - for X4.2 */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); - } + } - if (pPriv->currentBuf == 0) - pPriv->currentBuf = 1; - else - pPriv->currentBuf = 0; - - pPriv->videoStatus = CLIENT_VIDEO_ON; + pPriv->currentBuf ^= 1; - return Success; -} + pPriv->videoStatus = CLIENT_VIDEO_ON; + pSiS->VideoTimerCallback = SISVideoTimerCallback; -static int + return Success; +} + +static int SISQueryImageAttributes( - ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, int *pitches, int *offsets ){ - int pitchY, pitchUV; - int size, sizeY, sizeUV; + int pitchY, pitchUV; + int size, sizeY, sizeUV; + SISPtr pSiS = SISPTR(pScrn); if(*w < IMAGE_MIN_WIDTH) *w = IMAGE_MIN_WIDTH; if(*h < IMAGE_MIN_HEIGHT) *h = IMAGE_MIN_HEIGHT; - if(*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; - if(*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; + if(pSiS->Flags650 & SiS650_LARGEOVERLAY) { + if(*w > IMAGE_MAX_WIDTH_M650) *w = IMAGE_MAX_WIDTH_M650; + if(*h > IMAGE_MAX_HEIGHT_M650) *h = IMAGE_MAX_HEIGHT_M650; + } else { + if(*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; + } switch(id) { case PIXEL_FMT_YV12: + case PIXEL_FMT_I420: *w = (*w + 7) & ~7; *h = (*h + 1) & ~1; pitchY = *w; - pitchUV = *w >> 1; - if(pitches) { - pitches[0] = pitchY; - pitches[1] = pitches[2] = pitchUV; + pitchUV = *w >> 1; + if(pitches) { + pitches[0] = pitchY; + pitches[1] = pitches[2] = pitchUV; } - sizeY = pitchY * (*h); - sizeUV = pitchUV * ((*h) >> 1); - if(offsets) { + sizeY = pitchY * (*h); + sizeUV = pitchUV * ((*h) >> 1); + if(offsets) { offsets[0] = 0; offsets[1] = sizeY; offsets[2] = sizeY + sizeUV; } size = sizeY + (sizeUV << 1); - break; + break; case PIXEL_FMT_YUY2: + case PIXEL_FMT_UYVY: + case PIXEL_FMT_RGB6: + case PIXEL_FMT_RGB5: default: *w = (*w + 1) & ~1; pitchY = *w << 1; - if(pitches) pitches[0] = pitchY; - if(offsets) offsets[0] = 0; - size = pitchY * (*h); - break; + if(pitches) pitches[0] = pitchY; + if(offsets) offsets[0] = 0; + size = pitchY * (*h); + break; } return size; } static void -SISBlockHandler ( - int i, - pointer blockData, - pointer pTimeout, - pointer pReadmask -){ - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; - SISPtr pSIS = SISPTR(pScrn); +SISVideoTimerCallback (ScrnInfoPtr pScrn, Time now) +{ + SISPtr pSiS = SISPTR(pScrn); + SISPortPrivPtr pPriv = NULL; + unsigned char sridx, cridx; + + pSiS->VideoTimerCallback = NULL; + + if(!pScrn->vtSema) return; + + if (pSiS->adaptor) { + pPriv = GET_PORT_PRIVATE(pScrn); + if(!pPriv->videoStatus) + pPriv = NULL; + } + + if (pPriv) { + if(pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if(pPriv->offTime < currentTime.milliseconds) { + if(pPriv->videoStatus & OFF_TIMER) { + /* Turn off the overlay */ + sridx = inSISREG(SISSR); cridx = inSISREG(SISCR); + close_overlay(pSiS, pPriv); + outSISREG(SISSR, sridx); outSISREG(SISCR, cridx); + pPriv->mustwait = 1; + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + pSiS->VideoTimerCallback = SISVideoTimerCallback; + } else + if(pPriv->videoStatus & FREE_TIMER) { + SISFreeOverlayMemory(pScrn); + pPriv->mustwait = 1; + pPriv->videoStatus = 0; + } + } else + pSiS->VideoTimerCallback = SISVideoTimerCallback; + } + } +} + +/* TW: Offscreen surface stuff */ + +static int +SISAllocSurface ( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +) +{ + SISPtr pSiS = SISPTR(pScrn); SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + int size, depth; - pScreen->BlockHandler = pSIS->BlockHandler; - - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Xv: SISAllocSurface called\n"); +#endif + + if((w < IMAGE_MIN_WIDTH) || (h < IMAGE_MIN_HEIGHT)) + return BadValue; + if(pSiS->Flags650 & SiS650_LARGEOVERLAY) { + if((w > IMAGE_MAX_WIDTH_M650) || (h > IMAGE_MAX_HEIGHT_M650)) + return BadValue; + } else { + if((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT)) + return BadValue; + } + + if(pPriv->grabbedByV4L) + return BadAlloc; + + depth = pSiS->CurrentLayout.bitsPerPixel >> 3; + w = (w + 1) & ~1; + pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */ + size = h * pPriv->pitch; /* / depth; - Why? */ + pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, size); + if(!pPriv->linear) + return BadAlloc; + + pPriv->offset = pPriv->linear->offset * depth; + + surface->width = w; + surface->height = h; + surface->pScrn = pScrn; + surface->id = id; + surface->pitches = &pPriv->pitch; + surface->offsets = &pPriv->offset; + surface->devPrivate.ptr = (pointer)pPriv; + + close_overlay(pSiS, pPriv); + pPriv->videoStatus = 0; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + pSiS->VideoTimerCallback = NULL; + pPriv->grabbedByV4L = TRUE; + return Success; +} + +static int +SISStopSurface (XF86SurfacePtr surface) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); + SISPtr pSiS = SISPTR(surface->pScrn); + + if(pPriv->grabbedByV4L && pPriv->videoStatus) { + close_overlay(pSiS, pPriv); + pPriv->mustwait = 1; + pPriv->videoStatus = 0; + } + return Success; +} + +static int +SISFreeSurface (XF86SurfacePtr surface) +{ + SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); + + if(pPriv->grabbedByV4L) { + SISStopSurface(surface); + SISFreeOverlayMemory(surface->pScrn); + pPriv->grabbedByV4L = FALSE; + } + return Success; +} + +static int +SISGetSurfaceAttribute ( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +) +{ + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + + return SISGetPortAttribute(pScrn, attribute, value, (pointer)pPriv); +} + +static int +SISSetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +) +{ + SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);; + + return SISSetPortAttribute(pScrn, attribute, value, (pointer)pPriv); +} + +static int +SISDisplaySurface ( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +) +{ + ScrnInfoPtr pScrn = surface->pScrn; + SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); + +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Xv: DisplaySurface called\n"); +#endif + + if(!pPriv->grabbedByV4L) + return Success; + + pPriv->drw_x = drw_x; + pPriv->drw_y = drw_y; + pPriv->drw_w = drw_w; + pPriv->drw_h = drw_h; + pPriv->src_x = src_x; + pPriv->src_y = src_y; + pPriv->src_w = src_w; + pPriv->src_h = src_h; + pPriv->id = surface->id; + pPriv->height = surface->height; + pPriv->bufAddr[0] = surface->offsets[0]; + pPriv->currentBuf = 0; + pPriv->srcPitch = surface->pitches[0]; + + SISDisplayVideo(pScrn, pPriv); + + if(pPriv->autopaintColorKey) { + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} - pScreen->BlockHandler = SISBlockHandler; +#define NUMOFFSCRIMAGES 4 - if(pPriv->videoStatus & TIMER_MASK) { - UpdateCurrentTime(); - if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < currentTime.milliseconds) { - /* Turn off the overlay */ - close_overlay(pSIS, pPriv); +static XF86OffscreenImageRec SISOffscreenImages_300[NUMOFFSCRIMAGES] = +{ + { + &SISImages[0], /* YUV2 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_300, + &SISAttributes_300[0] /* Support all attributes */ + }, + { + &SISImages[2], /* UYVY */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_300, + &SISAttributes_300[0] /* Support all attributes */ + } + , + { + &SISImages[4], /* RV15 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_300, + &SISAttributes_300[0] /* Support all attributes */ + }, + { + &SISImages[5], /* RV16 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_300, + &SISAttributes_300[0] /* Support all attributes */ + } +}; + +static XF86OffscreenImageRec SISOffscreenImages_325[NUMOFFSCRIMAGES] = +{ + { + &SISImages[0], /* YUV2 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + }, + { + &SISImages[2], /* UYVY */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + } + , + { + &SISImages[4], /* RV15 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + }, + { + &SISImages[5], /* RV16 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + } +}; + +static XF86OffscreenImageRec SISOffscreenImages_M650[NUMOFFSCRIMAGES] = +{ + { + &SISImages[0], /* YUV2 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH_M650, IMAGE_MAX_HEIGHT_M650, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + }, + { + &SISImages[2], /* UYVY */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH_M650, IMAGE_MAX_HEIGHT_M650, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + } + , + { + &SISImages[4], /* RV15 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH_M650, IMAGE_MAX_HEIGHT_M650, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + }, + { + &SISImages[5], /* RV16 */ + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + SISAllocSurface, + SISFreeSurface, + SISDisplaySurface, + SISStopSurface, + SISGetSurfaceAttribute, + SISSetSurfaceAttribute, + IMAGE_MAX_WIDTH_M650, IMAGE_MAX_HEIGHT_M650, + NUM_ATTRIBUTES_325, + &SISAttributes_325[0] /* Support all attributes */ + } +}; + +static void +SISInitOffscreenImages(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); - pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; - } - } else { /* FREE_TIMER */ - if(pPriv->freeTime < currentTime.milliseconds) { - if(pPriv->fbAreaPtr) { - xf86FreeOffscreenArea(pPriv->fbAreaPtr); - pPriv->fbAreaPtr = NULL; - pPriv->fbSize = 0; - } - pPriv->videoStatus = 0; - } - } + if(pSiS->VGAEngine == SIS_300_VGA) { + xf86XVRegisterOffscreenImages(pScreen, SISOffscreenImages_300, NUMOFFSCRIMAGES); + } else { + if(pSiS->Flags650 & SiS650_LARGEOVERLAY) { + xf86XVRegisterOffscreenImages(pScreen, SISOffscreenImages_M650, NUMOFFSCRIMAGES); + } else { + xf86XVRegisterOffscreenImages(pScreen, SISOffscreenImages_325, NUMOFFSCRIMAGES); + } } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h:1.3 --- /dev/null Thu Feb 27 12:31:39 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h Sun Feb 9 20:14:16 2003 @@ -0,0 +1,368 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.3 2003/02/10 01:14:16 tsi Exp $ */ + +#ifndef _VGATYPES_ +#define _VGATYPES_ + +#ifdef LINUX_XF86 +#include "xf86Pci.h" +#endif + +#ifdef LINUX_KERNEL /* TW: We don't want the X driver to depend on kernel source */ +#include <linux/ioctl.h> +#endif + +#ifndef TC +#define far +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef CHAR +typedef char CHAR; +#endif + +#ifndef SHORT +typedef short SHORT; +#endif + +#ifndef LONG +typedef long LONG; +#endif + +#ifndef UCHAR +typedef unsigned char UCHAR; +#endif + +#ifndef USHORT +typedef unsigned short USHORT; +#endif + +#ifndef ULONG +typedef unsigned long ULONG; +#endif + +#ifndef PUCHAR +typedef UCHAR far *PUCHAR; +#endif + +#ifndef PUSHORT +typedef USHORT far *PUSHORT; +#endif + +#ifndef PULONG +typedef ULONG far *PULONG; +#endif + +#ifndef PVOID +typedef void far *PVOID; +#endif +#ifndef VOID +typedef void VOID; +#endif + +#ifndef BOOLEAN +typedef UCHAR BOOLEAN; +#endif + +#ifndef WINCE_HEADER +#ifndef bool +typedef UCHAR bool; +#endif +#endif /*WINCE_HEADER*/ + +#ifndef VBIOS_VER_MAX_LENGTH +#define VBIOS_VER_MAX_LENGTH 4 +#endif + +#ifndef LINUX_KERNEL /* For kernel, this is defined in sisfb.h */ +#ifndef WIN2000 +#ifndef SIS_CHIP_TYPE +typedef enum _SIS_CHIP_TYPE { + SIS_VGALegacy = 0, +#ifdef LINUX_XF86 + SIS_530, /* TW */ + SIS_OLD, /* TW */ +#endif + SIS_300, + SIS_630, + SIS_730, + SIS_540, + SIS_315H, /* SiS 310 */ + SIS_315, + SIS_315PRO, /* SiS 325 */ + SIS_550, + SIS_650, + SIS_740, + SIS_330, + MAX_SIS_CHIP +} SIS_CHIP_TYPE; +#endif +#endif +#endif + +#ifndef WIN2000 +#ifndef SIS_VB_CHIP_TYPE +typedef enum _SIS_VB_CHIP_TYPE { + VB_CHIP_Legacy = 0, + VB_CHIP_301, + VB_CHIP_301B, + VB_CHIP_301LV, + VB_CHIP_301LVX, + VB_CHIP_302, + VB_CHIP_302B, + VB_CHIP_302LV, + VB_CHIP_302LVX, + VB_CHIP_303, + VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */ + MAX_VB_CHIP +} SIS_VB_CHIP_TYPE; +#endif +#endif + +#ifndef WIN2000 +#ifndef SIS_LCD_TYPE +typedef enum _SIS_LCD_TYPE { + LCD_INVALID = 0, + LCD_800x600, + LCD_1024x768, + LCD_1280x1024, + LCD_1280x960, + LCD_640x480, + LCD_1600x1200, + LCD_1920x1440, + LCD_2048x1536, + LCD_320x480, /* TW: FSTN */ + LCD_1400x1050, + LCD_1152x864, + LCD_1152x768, + LCD_1280x768, + LCD_1024x600, + LCD_UNKNOWN +} SIS_LCD_TYPE; +#endif +#endif + +#ifndef WIN2000 /* mark by Paul, Move definition to sisv.h*/ +#ifndef PSIS_DSReg +typedef struct _SIS_DSReg +{ + UCHAR jIdx; + UCHAR jVal; +} SIS_DSReg, *PSIS_DSReg; +#endif + +#ifndef SIS_HW_DEVICE_INFO + +typedef struct _SIS_HW_DEVICE_INFO SIS_HW_DEVICE_INFO, *PSIS_HW_DEVICE_INFO; + +typedef BOOLEAN (*PSIS_QUERYSPACE) (PSIS_HW_DEVICE_INFO, ULONG, ULONG, ULONG *); + + +struct _SIS_HW_DEVICE_INFO +{ + PVOID pDevice; /* The pointer to the physical device data structure + in each OS or NULL for unused. */ + UCHAR *pjVirtualRomBase; /* base virtual address of VBIOS ROM Space */ + /* or base virtual address of ROM image file. */ + /* if NULL, then read from pjROMImage; */ + /* Note:ROM image file is the file of VBIOS ROM */ + + BOOLEAN UseROM; /* TW: Use the ROM image if provided */ + + UCHAR *pjCustomizedROMImage;/* base virtual address of ROM image file. */ + /* wincE:ROM image file is the file for OEM */ + /* customized table */ + /* Linux: not used */ + /* NT : not used */ + /* Note : pjCustomizedROMImage=NULL if no ROM image file */ + + UCHAR *pjVideoMemoryAddress;/* base virtual memory address */ + /* of Linear VGA memory */ + + ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */ + ULONG ulIOAddress; /* base I/O address of VGA ports (0x3B0) */ + UCHAR jChipType; /* Used to Identify SiS Graphics Chip */ + /* defined in the data structure type */ + /* "SIS_CHIP_TYPE" */ + + UCHAR jChipRevision; /* Used to Identify SiS Graphics Chip Revision */ + UCHAR ujVBChipID; /* the ID of video bridge */ + /* defined in the data structure type */ + /* "SIS_VB_CHIP_TYPE" */ + + USHORT usExternalChip; /* NO VB or other video bridge(not */ + /* SiS video bridge) */ + /* if ujVBChipID = VB_CHIP_UNKNOWN, */ + /* then bit0=1 : LVDS,bit1=1 : trumpion, */ + /* bit2=1 : CH7005 & no video bridge if */ + /* usExternalChip = 0. */ + /* Note: CR37[3:1]: */ + /* 001:SiS 301 */ + /* 010:LVDS */ + /* 011:Trumpion LVDS Scaling Chip */ + /* 100:LVDS(LCD-out)+Chrontel 7005 */ + /* 101:Single Chrontel 7005 */ + /* TW: This has changed on 310/325 series! */ + + ULONG ulCRT2LCDType; /* defined in the data structure type */ + /* "SIS_LCD_TYPE" */ + + BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */ + + BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */ + PSIS_DSReg pSR; /* restore SR registers in initial function. */ + /* end data :(idx, val) = (FF, FF). */ + /* Note : restore SR registers if */ + /* bSkipDramSizing = TRUE */ + + PSIS_DSReg pCR; /* restore CR registers in initial function. */ + /* end data :(idx, val) = (FF, FF) */ + /* Note : restore cR registers if */ + /* bSkipDramSizing = TRUE */ + + PSIS_QUERYSPACE pQueryVGAConfigSpace; /* Get/Set VGA Configuration */ + /* space */ + + PSIS_QUERYSPACE pQueryNorthBridgeSpace;/* Get/Set North Bridge */ + /* space */ + + UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH]; + + UCHAR pdc; /* TW: PanelDelayCompensation */ + +#ifdef LINUX_XF86 + PCITAG PciTag; /* PCI Tag for Linux XF86 */ +#endif +}; +#endif +#endif + + +/* TW: Addtional IOCTL for communication sisfb <> X driver */ +/* If changing this, sisfb.h must also be changed (for sisfb) */ + +#ifdef LINUX_XF86 /* We don't want the X driver to depend on the kernel source */ + +/* TW: ioctl for identifying and giving some info (esp. memory heap start) */ +#define SISFB_GET_INFO 0x80046ef8 /* Wow, what a terrible hack... */ + +/* TW: Structure argument for SISFB_GET_INFO ioctl */ +typedef struct _SISFB_INFO sisfb_info, *psisfb_info; + +struct _SISFB_INFO { + unsigned long sisfb_id; /* for identifying sisfb */ +#ifndef SISFB_ID +#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ +#endif + int chip_id; /* PCI ID of detected chip */ + int memory; /* video memory in KB which sisfb manages */ + int heapstart; /* heap start (= sisfb "mem" argument) in KB */ + unsigned char fbvidmode; /* current sisfb mode */ + + unsigned char sisfb_version; + unsigned char sisfb_revision; + unsigned char sisfb_patchlevel; + + unsigned char sisfb_caps; /* sisfb's capabilities */ + + int sisfb_tqlen; /* turbo queue length (in KB) */ + + unsigned int sisfb_pcibus; /* The card's PCI ID */ + unsigned int sisfb_pcislot; + unsigned int sisfb_pcifunc; + + unsigned char sisfb_lcdpdc; + + char reserved[236]; /* for future use */ +}; +#endif + +#ifndef WIN2000 +#ifndef WINCE_HEADER +#ifndef BUS_DATA_TYPE +typedef enum _BUS_DATA_TYPE { + ConfigurationSpaceUndefined = -1, + Cmos, + EisaConfiguration, + Pos, + CbusConfiguration, + PCIConfiguration, + VMEConfiguration, + NuBusConfiguration, + PCMCIAConfiguration, + MPIConfiguration, + MPSAConfiguration, + PNPISAConfiguration, + MaximumBusDataType +} BUS_DATA_TYPE, *PBUS_DATA_TYPE; +#endif +#endif /* WINCE_HEADER */ + +#ifndef PCI_TYPE0_ADDRESSES +#define PCI_TYPE0_ADDRESSES 6 +#endif + +#ifndef PCI_TYPE1_ADDRESSES +#define PCI_TYPE1_ADDRESSES 2 +#endif + +#ifndef WINCE_HEADER +#ifndef PCI_COMMON_CONFIG +typedef struct _PCI_COMMON_CONFIG { + USHORT VendorID; /* (ro) */ + USHORT DeviceID; /* (ro) */ + USHORT Command; /* Device control */ + USHORT Status; + UCHAR RevisionID; /* (ro) */ + UCHAR ProgIf; /* (ro) */ + UCHAR SubClass; /* (ro) */ + UCHAR BaseClass; /* (ro) */ + UCHAR CacheLineSize; /* (ro+) */ + UCHAR LatencyTimer; /* (ro+) */ + UCHAR HeaderType; /* (ro) */ + UCHAR BIST; /* Built in self test */ + + union { + struct _PCI_HEADER_TYPE_0 { + ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; + ULONG CIS; + USHORT SubVendorID; + USHORT SubSystemID; + ULONG ROMBaseAddress; + ULONG Reserved2[2]; + + UCHAR InterruptLine; /* */ + UCHAR InterruptPin; /* (ro) */ + UCHAR MinimumGrant; /* (ro) */ + UCHAR MaximumLatency; /* (ro) */ + } type0; + + + } u; + + UCHAR DeviceSpecific[192]; + +} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; +#endif +#endif /* WINCE_HEADER */ + +#ifndef FIELD_OFFSET +#define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) +#endif + +#ifndef PCI_COMMON_HDR_LENGTH +#define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET (PCI_COMMON_CONFIG, DeviceSpecific)) +#endif +#endif + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h:1.3 --- /dev/null Thu Feb 27 12:31:39 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h Sun Feb 9 20:14:17 2003 @@ -0,0 +1,571 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.3 2003/02/10 01:14:17 tsi Exp $ */ + +#ifdef _INIT_ +#define EXTERN +#else +#define EXTERN extern +#endif /* _INIT_ */ + +#ifndef _VSTRUCT_ +#define _VSTRUCT_ + +typedef struct _SiS_PanelDelayTblStruct +{ + UCHAR timer[2]; +} SiS_PanelDelayTblStruct; + +typedef struct _SiS_LCDDataStruct +{ + USHORT RVBHCMAX; + USHORT RVBHCFACT; + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; +} SiS_LCDDataStruct; + +typedef struct _SiS_TVDataStruct +{ + USHORT RVBHCMAX; + USHORT RVBHCFACT; + USHORT VGAHT; + USHORT VGAVT; + USHORT TVHDE; + USHORT TVVDE; + USHORT RVBHRS; + UCHAR FlickerMode; + USHORT HALFRVBHRS; + UCHAR RY1COE; + UCHAR RY2COE; + UCHAR RY3COE; + UCHAR RY4COE; +} SiS_TVDataStruct; + +typedef struct _SiS_LVDSDataStruct +{ + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; +} SiS_LVDSDataStruct; + +typedef struct _SiS_LVDSDesStruct +{ + USHORT LCDHDES; + USHORT LCDVDES; +} SiS_LVDSDesStruct; + +typedef struct _SiS_LVDSCRT1DataStruct +{ + UCHAR CR[15]; +} SiS_LVDSCRT1DataStruct; + +/*add for LCDA*/ +typedef struct _SiS_LCDACRT1DataStruct +{ + UCHAR CR[17]; +} SiS_LCDACRT1DataStruct; + +typedef struct _SiS_CHTVRegDataStruct +{ + UCHAR Reg[16]; +} SiS_CHTVRegDataStruct; + +typedef struct _SiS_StStruct +{ + UCHAR St_ModeID; + USHORT St_ModeFlag; + UCHAR St_StTableIndex; + UCHAR St_CRT2CRTC; + UCHAR St_ResInfo; + UCHAR VB_StTVFlickerIndex; + UCHAR VB_StTVEdgeIndex; + UCHAR VB_StTVYFilterIndex; +} SiS_StStruct; + +typedef struct _SiS_VBModeStruct +{ + UCHAR ModeID; + UCHAR VB_TVDelayIndex; + UCHAR VB_TVFlickerIndex; + UCHAR VB_TVPhaseIndex; + UCHAR VB_TVYFilterIndex; + UCHAR VB_LCDDelayIndex; + UCHAR _VB_LCDHIndex; + UCHAR _VB_LCDVIndex; +} SiS_VBModeStruct; + +typedef struct _SiS_StandTableStruct +{ + UCHAR CRT_COLS; + UCHAR ROWS; + UCHAR CHAR_HEIGHT; + USHORT CRT_LEN; + UCHAR SR[4]; + UCHAR MISC; + UCHAR CRTC[0x19]; + UCHAR ATTR[0x14]; + UCHAR GRC[9]; +} SiS_StandTableStruct; + +typedef struct _SiS_ExtStruct +{ + UCHAR Ext_ModeID; + USHORT Ext_ModeFlag; + USHORT Ext_ModeInfo; + USHORT Ext_Point; + USHORT Ext_VESAID; + UCHAR Ext_VESAMEMSize; + UCHAR Ext_RESINFO; + UCHAR VB_ExtTVFlickerIndex; + UCHAR VB_ExtTVEdgeIndex; + UCHAR VB_ExtTVYFilterIndex; + UCHAR REFindex; +} SiS_ExtStruct; + +typedef struct _SiS_Ext2Struct +{ + USHORT Ext_InfoFlag; + UCHAR Ext_CRT1CRTC; + UCHAR Ext_CRTVCLK; + UCHAR Ext_CRT2CRTC; + UCHAR ModeID; + USHORT XRes; + USHORT YRes; + USHORT ROM_OFFSET; +} SiS_Ext2Struct; + +typedef struct _SiS_Part2PortTblStruct +{ + UCHAR CR[12]; +} SiS_Part2PortTblStruct; + +typedef struct _SiS_CRT1TableStruct +{ + UCHAR CR[17]; +} SiS_CRT1TableStruct; + +typedef struct _SiS_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; + USHORT CLOCK; +} SiS_MCLKDataStruct; + +typedef struct _SiS_ECLKDataStruct +{ + UCHAR SR2E,SR2F,SR30; + USHORT CLOCK; +} SiS_ECLKDataStruct; + +typedef struct _SiS_VCLKDataStruct +{ + UCHAR SR2B,SR2C; + USHORT CLOCK; +} SiS_VCLKDataStruct; + +typedef struct _SiS_VBVCLKDataStruct +{ + UCHAR Part4_A,Part4_B; + USHORT CLOCK; +} SiS_VBVCLKDataStruct; + +typedef struct _SiS_StResInfoStruct +{ + USHORT HTotal; + USHORT VTotal; +} SiS_StResInfoStruct; + +typedef struct _SiS_ModeResInfoStruct +{ + USHORT HTotal; + USHORT VTotal; + UCHAR XChar; + UCHAR YChar; +} SiS_ModeResInfoStruct; + +typedef UCHAR DRAM4Type[4]; + +typedef struct _SiS_Private +{ +#ifdef LINUX_KERNEL + USHORT RelIO; +#endif + USHORT SiS_P3c4; + USHORT SiS_P3d4; + USHORT SiS_P3c0; + USHORT SiS_P3ce; + USHORT SiS_P3c2; + USHORT SiS_P3ca; + USHORT SiS_P3c6; + USHORT SiS_P3c7; + USHORT SiS_P3c8; + USHORT SiS_P3c9; + USHORT SiS_P3da; + USHORT SiS_Part1Port; + USHORT SiS_Part2Port; + USHORT SiS_Part3Port; + USHORT SiS_Part4Port; + USHORT SiS_Part5Port; + USHORT SiS_IF_DEF_LVDS; + USHORT SiS_IF_DEF_TRUMPION; + USHORT SiS_IF_DEF_DSTN; + USHORT SiS_IF_DEF_FSTN; + USHORT SiS_IF_DEF_CH70xx; + USHORT SiS_IF_DEF_HiVision; + UCHAR SiS_VGAINFO; + BOOLEAN SiS_UseROM; + int SiS_CHOverScan; + BOOLEAN SiS_CHSOverScan; + BOOLEAN SiS_ChSW; + int SiS_UseOEM; + USHORT SiS_Backup70xx; + USHORT SiS_CRT1Mode; + USHORT SiS_flag_clearbuffer; + int SiS_RAMType; + UCHAR SiS_ChannelAB; + UCHAR SiS_DataBusWidth; + USHORT SiS_ModeType; + USHORT SiS_VBInfo; + USHORT SiS_LCDResInfo; + USHORT SiS_LCDTypeInfo; + USHORT SiS_LCDInfo; + USHORT SiS_VBType; + USHORT SiS_VBExtInfo; + USHORT SiS_HiVision; + USHORT SiS_SelectCRT2Rate; + USHORT SiS_SetFlag; + USHORT SiS_RVBHCFACT; + USHORT SiS_RVBHCMAX; + USHORT SiS_RVBHRS; + USHORT SiS_VGAVT; + USHORT SiS_VGAHT; + USHORT SiS_VT; + USHORT SiS_HT; + USHORT SiS_VGAVDE; + USHORT SiS_VGAHDE; + USHORT SiS_VDE; + USHORT SiS_HDE; + USHORT SiS_NewFlickerMode; + USHORT SiS_RY1COE; + USHORT SiS_RY2COE; + USHORT SiS_RY3COE; + USHORT SiS_RY4COE; + USHORT SiS_LCDHDES; + USHORT SiS_LCDVDES; + USHORT SiS_DDC_Port; + USHORT SiS_DDC_Index; + USHORT SiS_DDC_Data; + USHORT SiS_DDC_Clk; + USHORT SiS_DDC_DataShift; + USHORT SiS_DDC_DeviceAddr; + USHORT SiS_DDC_ReadAddr; + USHORT SiS_DDC_SecAddr; + USHORT SiS_Panel800x600; + USHORT SiS_Panel1024x768; + USHORT SiS_Panel1280x1024; + USHORT SiS_Panel1600x1200; + USHORT SiS_Panel1280x960; + USHORT SiS_Panel1400x1050; + USHORT SiS_Panel320x480; + USHORT SiS_Panel1152x768; + USHORT SiS_Panel1280x768; + USHORT SiS_Panel1024x600; + USHORT SiS_Panel640x480; + USHORT SiS_Panel1152x864; + USHORT SiS_PanelMax; + USHORT SiS_PanelMinLVDS; + USHORT SiS_PanelMin301; + USHORT SiS_ChrontelInit; + + /* Pointers: */ + const SiS_StStruct *SiS_SModeIDTable; + const SiS_StandTableStruct *SiS_StandTable; + const SiS_ExtStruct *SiS_EModeIDTable; + const SiS_Ext2Struct *SiS_RefIndex; + const SiS_VBModeStruct *SiS_VBModeIDTable; + const SiS_CRT1TableStruct *SiS_CRT1Table; + const SiS_MCLKDataStruct *SiS_MCLKData_0; + const SiS_MCLKDataStruct *SiS_MCLKData_1; + const SiS_ECLKDataStruct *SiS_ECLKData; + const SiS_VCLKDataStruct *SiS_VCLKData; + const SiS_VBVCLKDataStruct *SiS_VBVCLKData; + const SiS_StResInfoStruct *SiS_StResInfo; + const SiS_ModeResInfoStruct *SiS_ModeResInfo; + const UCHAR *SiS_ScreenOffset; + + const UCHAR *pSiS_OutputSelect; + const UCHAR *pSiS_SoftSetting; + + const DRAM4Type *SiS_SR15; /* pointer : point to array */ +#ifndef LINUX_XF86 + UCHAR *pSiS_SR07; + const DRAM4Type *SiS_CR40; /* pointer : point to array */ + UCHAR *SiS_CR49; + UCHAR *SiS_SR25; + UCHAR *pSiS_SR1F; + UCHAR *pSiS_SR21; + UCHAR *pSiS_SR22; + UCHAR *pSiS_SR23; + UCHAR *pSiS_SR24; + UCHAR *pSiS_SR31; + UCHAR *pSiS_SR32; + UCHAR *pSiS_SR33; + UCHAR *pSiS_CRT2Data_1_2; + UCHAR *pSiS_CRT2Data_4_D; + UCHAR *pSiS_CRT2Data_4_E; + UCHAR *pSiS_CRT2Data_4_10; + const USHORT *pSiS_RGBSenseData; + const USHORT *pSiS_VideoSenseData; + const USHORT *pSiS_YCSenseData; + const USHORT *pSiS_RGBSenseData2; /*301b*/ + const USHORT *pSiS_VideoSenseData2; + const USHORT *pSiS_YCSenseData2; +#endif + const UCHAR *SiS_NTSCPhase; + const UCHAR *SiS_PALPhase; + const UCHAR *SiS_NTSCPhase2; + const UCHAR *SiS_PALPhase2; + const UCHAR *SiS_PALMPhase; + const UCHAR *SiS_PALNPhase; + const UCHAR *SiS_PALMPhase2; + const UCHAR *SiS_PALNPhase2; + const UCHAR *SiS_SpecialPhase; + const SiS_LCDDataStruct *SiS_StLCD1024x768Data; + const SiS_LCDDataStruct *SiS_ExtLCD1024x768Data; + const SiS_LCDDataStruct *SiS_St2LCD1024x768Data; + const SiS_LCDDataStruct *SiS_StLCD1280x1024Data; + const SiS_LCDDataStruct *SiS_ExtLCD1280x1024Data; + const SiS_LCDDataStruct *SiS_St2LCD1280x1024Data; + const SiS_LCDDataStruct *SiS_NoScaleData1024x768; + const SiS_LCDDataStruct *SiS_NoScaleData1280x1024; + const SiS_LCDDataStruct *SiS_LCD1280x960Data; + const SiS_LCDDataStruct *SiS_NoScaleData1400x1050; + const SiS_LCDDataStruct *SiS_NoScaleData1600x1200; + const SiS_LCDDataStruct *SiS_StLCD1400x1050Data; + const SiS_LCDDataStruct *SiS_StLCD1600x1200Data; + const SiS_LCDDataStruct *SiS_ExtLCD1400x1050Data; + const SiS_LCDDataStruct *SiS_ExtLCD1600x1200Data; + const SiS_TVDataStruct *SiS_StPALData; + const SiS_TVDataStruct *SiS_ExtPALData; + const SiS_TVDataStruct *SiS_StNTSCData; + const SiS_TVDataStruct *SiS_ExtNTSCData; +#ifdef oldHV + const SiS_TVDataStruct *SiS_St1HiTVData; + const SiS_TVDataStruct *SiS_St2HiTVData; + const SiS_TVDataStruct *SiS_ExtHiTVData; +#endif + const UCHAR *SiS_NTSCTiming; + const UCHAR *SiS_PALTiming; +#ifdef oldHV + const UCHAR *SiS_HiTVExtTiming; + const UCHAR *SiS_HiTVSt1Timing; + const UCHAR *SiS_HiTVSt2Timing; + const UCHAR *SiS_HiTVTextTiming; + const UCHAR *SiS_HiTVGroup3Data; + const UCHAR *SiS_HiTVGroup3Simu; + const UCHAR *SiS_HiTVGroup3Text; +#endif + const SiS_PanelDelayTblStruct *SiS_PanelDelayTbl; + const SiS_PanelDelayTblStruct *SiS_PanelDelayTblLVDS; + const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1; + const SiS_LVDSDataStruct *SiS_LVDS800x600Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1280x960Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1280x960Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1280x768Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1280x768Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_2; + const SiS_LVDSDataStruct *SiS_LVDS1152x768Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1152x768Data_2; + const SiS_LVDSDataStruct *SiS_LVDS640x480Data_1; + const SiS_LVDSDataStruct *SiS_LVDS320x480Data_1; + const SiS_LVDSDataStruct *SiS_LCDA1400x1050Data_1; + const SiS_LVDSDataStruct *SiS_LCDA1400x1050Data_2; + const SiS_LVDSDataStruct *SiS_LCDA1600x1200Data_1; + const SiS_LVDSDataStruct *SiS_LCDA1600x1200Data_2; + const SiS_LVDSDataStruct *SiS_LVDSXXXxXXXData_1; + const SiS_LVDSDataStruct *SiS_CHTVUNTSCData; + const SiS_LVDSDataStruct *SiS_CHTVONTSCData; + const SiS_LVDSDataStruct *SiS_CHTVUPALData; + const SiS_LVDSDataStruct *SiS_CHTVOPALData; + const SiS_LVDSDataStruct *SiS_CHTVUPALMData; + const SiS_LVDSDataStruct *SiS_CHTVOPALMData; + const SiS_LVDSDataStruct *SiS_CHTVUPALNData; + const SiS_LVDSDataStruct *SiS_CHTVOPALNData; + const SiS_LVDSDataStruct *SiS_CHTVSOPALData; + const SiS_LVDSDesStruct *SiS_PanelType00_1; + const SiS_LVDSDesStruct *SiS_PanelType01_1; + const SiS_LVDSDesStruct *SiS_PanelType02_1; + const SiS_LVDSDesStruct *SiS_PanelType03_1; + const SiS_LVDSDesStruct *SiS_PanelType04_1; + const SiS_LVDSDesStruct *SiS_PanelType05_1; + const SiS_LVDSDesStruct *SiS_PanelType06_1; + const SiS_LVDSDesStruct *SiS_PanelType07_1; + const SiS_LVDSDesStruct *SiS_PanelType08_1; + const SiS_LVDSDesStruct *SiS_PanelType09_1; + const SiS_LVDSDesStruct *SiS_PanelType0a_1; + const SiS_LVDSDesStruct *SiS_PanelType0b_1; + const SiS_LVDSDesStruct *SiS_PanelType0c_1; + const SiS_LVDSDesStruct *SiS_PanelType0d_1; + const SiS_LVDSDesStruct *SiS_PanelType0e_1; + const SiS_LVDSDesStruct *SiS_PanelType0f_1; + const SiS_LVDSDesStruct *SiS_PanelType00_2; + const SiS_LVDSDesStruct *SiS_PanelType01_2; + const SiS_LVDSDesStruct *SiS_PanelType02_2; + const SiS_LVDSDesStruct *SiS_PanelType03_2; + const SiS_LVDSDesStruct *SiS_PanelType04_2; + const SiS_LVDSDesStruct *SiS_PanelType05_2; + const SiS_LVDSDesStruct *SiS_PanelType06_2; + const SiS_LVDSDesStruct *SiS_PanelType07_2; + const SiS_LVDSDesStruct *SiS_PanelType08_2; + const SiS_LVDSDesStruct *SiS_PanelType09_2; + const SiS_LVDSDesStruct *SiS_PanelType0a_2; + const SiS_LVDSDesStruct *SiS_PanelType0b_2; + const SiS_LVDSDesStruct *SiS_PanelType0c_2; + const SiS_LVDSDesStruct *SiS_PanelType0d_2; + const SiS_LVDSDesStruct *SiS_PanelType0e_2; + const SiS_LVDSDesStruct *SiS_PanelType0f_2; + + const SiS_LVDSDesStruct *LVDS1024x768Des_1; + const SiS_LVDSDesStruct *LVDS1280x1024Des_1; + const SiS_LVDSDesStruct *LVDS1400x1050Des_1; + const SiS_LVDSDesStruct *LVDS1600x1200Des_1; + const SiS_LVDSDesStruct *LVDS1024x768Des_2; + const SiS_LVDSDesStruct *LVDS1280x1024Des_2; + const SiS_LVDSDesStruct *LVDS1400x1050Des_2; + const SiS_LVDSDesStruct *LVDS1600x1200Des_2; + + const SiS_LVDSDesStruct *SiS_CHTVUNTSCDesData; + const SiS_LVDSDesStruct *SiS_CHTVONTSCDesData; + const SiS_LVDSDesStruct *SiS_CHTVUPALDesData; + const SiS_LVDSDesStruct *SiS_CHTVOPALDesData; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_1_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_2; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_2_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1_H; + const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UNTSC; + const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC; + const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL; + const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1OPAL; + const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1SOPAL; + + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1; + + const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_1; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_1; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_1; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_1_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_1_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_1_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_2; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_2; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_2; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_2_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_2_H; + const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_2_H; + + /* TW: New for 650/301LV */ + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_1; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_1; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_1; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_1; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_2; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_2; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_2; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_2; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_3; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_3; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_3; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_3; + + const SiS_CHTVRegDataStruct *SiS_CHTVReg_UNTSC; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_ONTSC; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPAL; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPAL; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPALM; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPALM; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPALN; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPALN; + const SiS_CHTVRegDataStruct *SiS_CHTVReg_SOPAL; + const UCHAR *SiS_CHTVVCLKUNTSC; + const UCHAR *SiS_CHTVVCLKONTSC; + const UCHAR *SiS_CHTVVCLKUPAL; + const UCHAR *SiS_CHTVVCLKOPAL; + const UCHAR *SiS_CHTVVCLKUPALM; + const UCHAR *SiS_CHTVVCLKOPALM; + const UCHAR *SiS_CHTVVCLKUPALN; + const UCHAR *SiS_CHTVVCLKOPALN; + const UCHAR *SiS_CHTVVCLKSOPAL; + + BOOLEAN UseCustomMode; + BOOLEAN CRT1UsesCustomMode; + USHORT CHDisplay; + USHORT CHSyncStart; + USHORT CHSyncEnd; + USHORT CHTotal; + USHORT CHBlankStart; + USHORT CHBlankEnd; + USHORT CVDisplay; + USHORT CVSyncStart; + USHORT CVSyncEnd; + USHORT CVTotal; + USHORT CVBlankStart; + USHORT CVBlankEnd; + ULONG CDClock; + ULONG CFlags; + UCHAR CCRT1CRTC[17]; + UCHAR CSR2B; + UCHAR CSR2C; + USHORT CSRClock; + USHORT CModeFlag; + USHORT CInfoFlag; + BOOLEAN SiS_CHPALM; + BOOLEAN SiS_CHPALN; +} SiS_Private; + +#endif + Index: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c:1.6 Wed May 16 02:48:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c Fri Dec 6 11:44:38 2002 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c,v 1.6 2001/05/16 06:48:11 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c,v 1.7 2002/12/06 16:44:38 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -658,10 +658,26 @@ /* Mandatory */ static Bool CG6SaveScreen(ScreenPtr pScreen, int mode) - /* this function should blank the screen when unblank is FALSE and - unblank it when unblank is TRUE -- it doesn't actually seem to be - used for much though */ { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + Cg6Ptr pCg6 = GET_CG6_FROM_SCRN(pScrn); + unsigned int tmp = pCg6->thc->thc_misc; + + switch(mode) + { + case SCREEN_SAVER_ON: + case SCREEN_SAVER_CYCLE: + tmp &= ~CG6_THC_MISC_SYNC_ENAB; + break; + case SCREEN_SAVER_OFF: + case SCREEN_SAVER_FORCER: + tmp |= CG6_THC_MISC_SYNC_ENAB; + break; + default: + return FALSE; + } + + pCg6->thc->thc_misc = tmp; return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile:1.6 xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile:1.6 Sat Mar 3 17:41:34 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile Mon Sep 16 14:06:01 2002 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the ffb driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.6 2001/03/03 22:41:34 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.7 2002/09/16 18:06:01 eich Exp $ #define IHaveModules #include <Server.tmpl> @@ -38,7 +38,7 @@ #define FFBsObjectRule(name) @@\ name.o: name.s @@\ $(RM) $@ @@\ - $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\ + $(CPP) $*.s | $(AS) $(GCCVISOPTION) -o $@ - @@\ dd if=/dev/zero bs=1 count=3 2>/dev/null | \ dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\ dd if=/dev/zero bs=1 count=1 2>/dev/null | \ @@ -49,7 +49,7 @@ #define FFBsObjectRule(name) @@\ name.o: name.s @@\ $(RM) $@ @@\ - $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - + $(CPP) $*.s | $(AS) $(GCCVISOPTION) -o $@ - #endif #else VISOBJS = Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h:1.7 Fri May 4 15:05:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h Thu Dec 5 21:44:03 2002 @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.7 2001/05/04 19:05:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.8 2002/12/06 02:44:03 tsi Exp $ */ #ifndef FFB_H #define FFB_H @@ -43,7 +43,12 @@ #include "xf86drm.h" #include "ffb_drishare.h" #endif +#ifndef DPMS_SERVER +#define DPMS_SERVER +#endif /* DPMS_SERVER */ +#include "extensions/dpms.h" + /* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */ /* Note: do not mmap FFB_DFB8R_VOFF and following mappings using one mmap together with any previous SFB mapping, otherwise the OS won't be able to use 4M pages @@ -233,6 +238,8 @@ extern void FFBDacFini(FFBPtr); extern void FFBDacEnterVT(FFBPtr); extern void FFBDacLeaveVT(FFBPtr); +extern Bool FFBDacSaveScreen(FFBPtr, int); +extern void FFBDacDPMSMode(FFBPtr, int, int); /* Exported WID layer routines. */ extern void FFBWidPoolInit(FFBPtr); Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c:1.3 Thu Apr 5 13:42:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c Thu Dec 5 21:44:03 2002 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.4 2002/12/06 02:44:03 tsi Exp $ */ #include "ffb.h" #include "ffb_rcache.h" @@ -33,6 +33,14 @@ #include "xf86DDC.h" +/* + * Used for stabilize time after playing with power management on the display + */ + +#ifndef DPMS_SPIN_COUNT +#define DPMS_SPIN_COUNT 100 +#endif /* DPMS_SPIN_COUNT */ + /* Cursor programming */ void @@ -493,4 +501,112 @@ /* Restore kernel DAC and x-channel state. */ dac_state_restore(pFfb, &p->kern_dac_state); restore_kernel_xchannel(pFfb); +} + +/* DPMS stuff, courtesy of a hint from David S. Miller. + * 05.xii.01, FEM + */ + +/* + * I don't know why, if at all, this is needed, but JJ or DSM do it + * on restore. I observe that when just blanking/unblanking, everything + * works fine without it, but that sometimes DPMS -> Standby actually + * results in Off. Maybe related? + */ +static void +SPIN(ffb_dacPtr d, int count) { + while(count-- > 0) { + (void) DACCFG_READ(d, FFBDAC_CFG_TGVC); + } + return; +} + +/* Screen save (blank) restore */ +Bool +FFBDacSaveScreen(FFBPtr pFfb, int mode) { + int tmp; + ffb_dacPtr dac; + if(!pFfb) return FALSE; /* Is there any way at all this could happen? */ + else dac = pFfb -> dac; + + tmp = DACCFG_READ(dac, FFBDAC_CFG_TGEN); /* Get the timing information */ + + switch(mode) { + case SCREEN_SAVER_ON: + case SCREEN_SAVER_CYCLE: + tmp &= ~FFBDAC_CFG_TGEN_VIDE; /* Kill the video */ + break; + + case SCREEN_SAVER_OFF: + case SCREEN_SAVER_FORCER: + tmp |= FFBDAC_CFG_TGEN_VIDE; /* Turn the video on */ + break; + + default: + return FALSE; /* Don't know what to do; gently fail. */ + } + DACCFG_WRITE(dac, FFBDAC_CFG_TGEN, tmp); /* Restore timing register, video set as asked */ + SPIN(dac, DPMS_SPIN_COUNT/10); + return TRUE; +} + +/* DPMS Control, also hinted at by David Miller. + + The rule seems to be: + + StandBy = -HSYNC +VSYNC -VIDEO + Suspend = +HSYNC -VSYNC -VIDEO + Off = -HSYNC -VSYNC -VIDEO + On = +HSYNC +VSINC +VIDEO + + If you don't force video off, someone periodically tries to turn the + monitor on for some reason. I don't know who or why, so I kill the video + when trying to go into some sort of energy saving mode. (In real life, + 'xset s blank s xx' could well have taken care of this.) + + Also, on MY monitor, StandBy as above defined (-H+V-Vid) in fact + gives the same as Off, which I don't want. Hence, I just do (-Vid) + + 05.xii.01, FEM + 08.xii.01, FEM +*/ +void +FFBDacDPMSMode(FFBPtr pFfb, int DPMSMode, int flags) { + int tmp; + ffb_dacPtr dac = pFfb -> dac; + + tmp = DACCFG_READ(dac, FFBDAC_CFG_TGEN); /* Get timing control */ + + switch(DPMSMode) { + + case DPMSModeOn: + tmp &= ~(FFBDAC_CFG_TGEN_VSD | FFBDAC_CFG_TGEN_HSD); /* Turn off VSYNC, HSYNC + disable bits */ + tmp |= FFBDAC_CFG_TGEN_VIDE; /* Turn the video on */ + break; + + case DPMSModeStandby: +#ifdef DPMS_TRUE_STANDBY + tmp |= FFBDAC_CFG_TGEN_HSD; /* HSYNC = OFF */ +#endif /* DPMS_TRUE_STANDBY */ + tmp &= ~FFBDAC_CFG_TGEN_VSD; /* VSYNC = ON */ + tmp &= ~FFBDAC_CFG_TGEN_VIDE; /* Kill the video */ + break; + + case DPMSModeSuspend: + tmp |= FFBDAC_CFG_TGEN_VSD; /* VSYNC = OFF */ + tmp &= ~FFBDAC_CFG_TGEN_HSD; /* HSYNC = ON */ + tmp &= ~FFBDAC_CFG_TGEN_VIDE; /* Kill the video */ + break; + + case DPMSModeOff: + tmp |= (FFBDAC_CFG_TGEN_VSD | FFBDAC_CFG_TGEN_HSD); /* Kill HSYNC, VSYNC both */ + tmp &= ~FFBDAC_CFG_TGEN_VIDE; /* Kill the video */ + break; + + default: + return; /* If we get here, we really should log an error */ + } + DACCFG_WRITE(dac, FFBDAC_CFG_TGEN,tmp); /* Restore timing register, video set as asked */ + SPIN(dac, DPMS_SPIN_COUNT); /* Is this necessary? Why? */ } Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c:1.1 Tue May 23 00:47:44 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c Mon Feb 10 22:19:02 2003 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c,v 1.1 2000/05/23 04:47:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c,v 1.2 2003/02/11 03:19:02 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS @@ -892,10 +892,11 @@ return TRUE; } -extern Bool DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct)(ScreenPtr, DbeScreenPrivPtr)); +extern void DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct)(ScreenPtr, DbeScreenPrivPtr)); Bool FFBDbePreInit(ScreenPtr pScreen) { - return DbeRegisterFunction(pScreen, FFBDbeInit); + DbeRegisterFunction(pScreen, FFBDbeInit); + return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c:1.9 Fri May 4 15:05:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c Thu Dec 5 21:44:04 2002 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.9 2001/05/04 19:05:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.11 2002/12/06 02:44:04 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -60,7 +60,7 @@ static void FFBFreeScreen(int scrnIndex, int flags); static int FFBValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); - +static void FFBDPMSMode(ScrnInfoPtr pScrn, int DPMSMode, int flags); /* ffb_dga.c */ extern void FFB_InitDGA(ScreenPtr pScreen); @@ -436,7 +436,12 @@ return FALSE; } -#ifdef XF86DRI +#if 0 +/*#ifdef XF86DRI*/ +/* + * Loading this automatically isn't compatible + * to the behavior of other drivers + */ if (xf86LoadSubModule(pScrn, "drm") == NULL) { FFBFreeRec(pScrn); return FALSE; @@ -937,6 +942,8 @@ pScreen->CloseScreen = FFBCloseScreen; pScreen->SaveScreen = FFBSaveScreen; + (void) xf86DPMSInit(pScreen, FFBDPMSMode, 0); + /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -1085,11 +1092,14 @@ /* Mandatory */ static Bool FFBSaveScreen(ScreenPtr pScreen, int mode) - /* this function should blank the screen when unblank is FALSE and - unblank it when unblank is TRUE -- it doesn't actually seem to be - used for much though */ + /* This function blanks the screen when mode=SCREEN_SAVER_ON and + unblanks it when mode=SCREEN_SAVER_OFF. It is used internally in the + FFBScreenInit code `for aesthetic reasons,' and it is used for + blanking if you set "xset s on s blank." The work (such as it is) is + done in "ffb_dac.c" `for aesthetic reasons.' + */ { - return TRUE; + return FFBDacSaveScreen(GET_FFB_FROM_SCREEN(pScreen), mode); } /* @@ -1099,4 +1109,14 @@ FFBSync(ScrnInfoPtr pScrn) { return; +} + +/* + Hook for DPMS Mode. +*/ + +static void +FFBDPMSMode(ScrnInfoPtr pScrn, int DPMSMode, int flags) +{ + FFBDacDPMSMode(GET_FFB_FROM_SCRN(pScrn), DPMSMode, flags); } Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.21 xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.21 Mon May 21 17:43:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile Mon Feb 17 12:06:44 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.21 2001/05/21 21:43:55 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.22 2003/02/17 17:06:44 dawes Exp $ XCOMM XCOMM This is the Imakefile for the TDFX driver. XCOMM @@ -36,7 +36,7 @@ -I$(XF86SRC)/xaa -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/ddc -I$(XF86OSSRC)/vbe -I$(SERVERSRC)/Xext \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/vbe -I$(SERVERSRC)/Xext \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) -I$(SERVERSRC)/render \ $(DRIINCLUDES) Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.25 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.25 Fri Aug 17 22:51:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h Wed Oct 16 21:02:08 2002 @@ -5,7 +5,7 @@ Copyright: 1998,1999 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.25 2001/08/18 02:51:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.27 2002/10/17 01:02:08 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ @@ -138,7 +138,7 @@ unsigned char *MMIOBase[MAXCHIPS]; unsigned char *FbBase; unsigned char *myFbBase; - unsigned int PIOBase[MAXCHIPS]; + IOADDRESS PIOBase[MAXCHIPS]; long FbMapSize; int pixelFormat; int stride; @@ -219,6 +219,8 @@ int videoKey; void (*VideoTimerCallback)(ScrnInfoPtr, Time); FBLinearPtr overlayBuffer; + FBLinearPtr overlayBuffer2; /* for double-buffering */ + int whichOverlayBuffer; /* flip-flop */ FBAreaPtr textureBuffer; Bool TextureXvideo; XF86VideoAdaptorPtr overlayAdaptor; Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.23 Mon May 21 17:43:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c Sat Feb 8 16:26:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.23 2001/05/21 21:43:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.25 2003/02/08 21:26:59 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -195,7 +195,7 @@ else pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; + pConfigs[i].bufferSize = (pScrn->bitsPerPixel==32) ? 32 : 24; if (depth) { if (pTDFX->cpp > 2) pConfigs[i].depthSize = 24; @@ -634,6 +634,11 @@ if(pTDFX->overlayBuffer) { xf86FreeOffscreenLinear(pTDFX->overlayBuffer); pTDFX->overlayBuffer = NULL; + } + + if(pTDFX->overlayBuffer2) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer2); + pTDFX->overlayBuffer2 = NULL; } if(pTDFX->textureBuffer) { Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.87 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.92 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.87 Fri Jan 4 16:22:35 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c Mon Nov 25 09:05:00 2002 @@ -27,7 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.87 2002/01/04 21:22:35 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.92 2002/11/25 14:05:00 eich Exp $ */ /* * Authors: @@ -189,6 +189,7 @@ }; static const char *vgahwSymbols[] = { + "vgaHWEnable", "vgaHWFreeHWRec", "vgaHWGetHWRec", "vgaHWGetIOBase", @@ -582,7 +583,8 @@ pTDFX->PciTag[pTDFX->numChips] = pciTag((*ppPci)->bus, (*ppPci)->device, (*ppPci)->func); - pTDFX->PIOBase[pTDFX->numChips] = (*ppPci)->ioBase[2]&0xFFFFFFFC; + pTDFX->PIOBase[pTDFX->numChips] = + pScrn->domainIOBase + ((*ppPci)->ioBase[2] & 0xFFFFFFFCU); pTDFX->numChips++; } } @@ -740,7 +742,7 @@ * We don't need VGA resources during OPERATING state. However I'm * not sure if they are disabled. */ - xf86SetOperatingState(RES_SHARED_VGA, pTDFX->pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaIo, pTDFX->pEnt->index, ResDisableOpr); #if 0 pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; pScrn->racMemFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; @@ -750,21 +752,22 @@ /* Is VGA memory disabled during OPERATING state? */ - xf86SetOperatingState(resVgaMemShared, pTDFX->pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaMem, pTDFX->pEnt->index, ResDisableOpr); #else pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; #endif #endif -#if 0 +#if 1 /* * I'm sure we don't need to set these. All resources * for these operations are exclusive. */ - if (pTDFX->usePIO) - pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; - else - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + if (pTDFX->usePIO) { + pScrn->racMemFlags = RAC_FB; + pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + } else + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; #endif /* Set pScrn->monitor */ @@ -875,9 +878,7 @@ xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at addr 0x%lX\n", (unsigned long)pTDFX->MMIOAddr[0]); - if (match->ioBase[2]) { - pTDFX->PIOBase[0] = match->ioBase[2]&0xFFFFFFFC; - } else { + if (!match->ioBase[2]) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid PIO address in PCI config space\n"); TDFXFreeRec(pScrn); @@ -2392,7 +2393,7 @@ static int TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { TDFXTRACE("TDFXValidMode start\n"); - if ((mode->HDisplay>2046) || (mode->VDisplay>1536)) + if ((mode->HDisplay>2048) || (mode->VDisplay>1536)) return MODE_BAD; /* Banshee doesn't support interlace. Does V3? */ if (mode->Flags&V_INTERLACE) Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.15 Tue Jul 31 20:44:54 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c Wed Oct 16 21:02:08 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.15 2001/08/01 00:44:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.16 2002/10/17 01:02:08 dawes Exp $ */ #include "xf86.h" #include "tdfx.h" @@ -712,6 +712,9 @@ int nbox; int format; + TDFXTRACE("TDFXPutImageTexture(src_x=%d, src_y=%d, drw_x=%d, drw_y=%d, .. sync=%d\n", + src_x, src_y, drw_x, drw_y, sync); + /* Check the source format */ if (id == FOURCC_YV12) format = SST_2D_FORMAT_YUYV; else if (id == FOURCC_UYVY) format = SST_2D_FORMAT_UYVY; @@ -832,6 +835,10 @@ xf86FreeOffscreenLinear(pTDFX->overlayBuffer); pTDFX->overlayBuffer = NULL; } + if(pTDFX->overlayBuffer2) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer2); + pTDFX->overlayBuffer2 = NULL; + } pPriv->videoStatus = 0; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { @@ -842,6 +849,56 @@ } +/* * * * * * + +Decoder... + +VIDPROCCFG: 0x5c: Video Processor Configuration register + +#define VIDPROCCFGMASK 0xa2e3eb6c + 3 2 1 0 + 10987654321098765432109876543210 + 10100010111000111110101101101100 + +The "1" bits are the bits cleared to 0 in pTDFX->ModeReg.vidcfg + + +Then we or in 0x320: + + 11 + 109876543210 +320 = 001100100000 + +bit 11=0: Do not bypass clut (colour lookup) for overlay +bit 10=0: Do not bypass clut for desktop +bit 9=1: use video-in buffer address as overlay start + address (auto-flipping) +bit 8=1: fetch overlay surface +bit 7=0: do not fetch the desktop surface (?) +bit 6=0: chromakey not inverted +bit 5=1: chromakey enabled +bit 4=0: half-mode disabled +bit 3=0: not interlaced (interlace doesn't work on Avenger) +bit 2=0: overlay stereo disabled +bit 1=0: Windows cursor mode +bit 0=0: Video processor off, VGA mode on + +SST_VIDEO_2X_MODE_EN: bit26: means 2 pixels per screen clock mode is on + +VIDOVERLAYSTARTCOORDS: x&y coords of overlay on the screen +VIDOVERLAYENDSCREENCOORDS: x&y coorder of bot-right of overlay on the screen +VIDOVERLAYDUDX: step size in source per hoz step in screen space (x-mag) +VIDOVERLAYDUDXOFFSETSRCWIDTH: +VIDOVERLAYDVDY: step size in sourcxe per vertical step in screen (y-mag) +VIDOVERLAYDVDYOFFSET: initial offset of DVDY +VIDDESKTOPOVERLAYSTRIDE: desktop surface stride + +SST_3D_LEFTOVERLAYBUF: starting physical address of the overlay surface buffer +VIDINADDR0: starting address of video-in buffer-0 + [this is set, but this is for video _input_ as I understand docs...?] + +* * * * * */ + static void TDFXDisplayVideoOverlay( ScrnInfoPtr pScrn, @@ -889,8 +946,51 @@ pTDFX->writeLong(pTDFX, VIDDESKTOPOVERLAYSTRIDE, pTDFX->ModeReg.stride); pTDFX->writeLong(pTDFX, SST_3D_LEFTOVERLAYBUF, offset & ~3); pTDFX->writeLong(pTDFX, VIDINADDR0, offset & ~3); + TDFXTRACE("TDFXDisplayVideoOverlay: done, offset=0x%x\n"); +} + + +#if 0 + +/* * * * * + +TDFXSwapVideoOverlayBuffer tries to use the Avenger SWAPBUFFER +capability to change frames without tearing. + +Use this in preference to TDFXDisplayVideoOverlay where all image +parameters are the same as the previous frame - ie where only the +SST_3D_LEFTOVERLAYBUF register would have been changed. + +NOTE: Work in progress - doesn't seem to sync to VSYNC, and only every +other frame gets displayed... + +Seeing that the buffer swap initiated by DisplayVideoOverlay gets +synced to VSYNC anyway, just adding double-buffering to PutImageOverlay +appears to do the job. Still - I leave this code in in case we can +get it working later + + -- Steve Davies 2002-10-04 + -- <steve@daviesfam.org> + +* * * * * */ + +static void +TDFXSwapVideoOverlayBuffer( + ScrnInfoPtr pScrn, + int offset, + int left +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + offset += ((left >> 16) & ~1) << 1; + /* Write mew buffer address */ + pTDFX->writeLong(pTDFX, SST_3D_LEFTOVERLAYBUF, offset & ~3); + /* Incremement the swap-pending counter */ + pTDFX->writeLong(pTDFX, SST_3D_SWAPPENDING, 0); + /* write the swapbuffer command - triggered by (next) VSYNC */ + pTDFX->writeLong(pTDFX, SST_3D_SWAPBUFFERCMD, 1); } +#endif static int TDFXPutImageOverlay( @@ -916,6 +1016,9 @@ BoxRec dstBox; CARD32 tmp; + TDFXTRACE("TDFXPutImageOverlay: src_x=%d, src_y=%d, drw_x=%d, drw_y=%d, src_w=%d, src_h=%d, drw_w=%d, drw_h=%d, id=%d, width=%d, height=%d, sync=%d\n", + src_x, src_y, drw_x, drw_y, src_w, src_h, drw_w, drw_h, id, width, height, Sync); + /* * s2offset, s3offset - byte offsets into U and V plane of the * source where copying starts. Y plane is @@ -973,13 +1076,26 @@ if(!(pTDFX->overlayBuffer = TDFXAllocateMemoryLinear(pScrn, pTDFX->overlayBuffer, new_size))) return BadAlloc; + /* Second buffer for double-buffering (If we can't get the memory then we just don't double-buffer) */ + if (!(pTDFX->overlayBuffer2 = TDFXAllocateMemoryLinear(pScrn, pTDFX->overlayBuffer2, new_size))) + pTDFX->whichOverlayBuffer = 0; + TDFXTRACE("TDFXPutImageOverlay: %s have a second overlay buffer for double-buffering\n", + pTDFX->overlayBuffer2 ? "Do" : "Do not"); /* copy data */ top = ya >> 16; left = (xa >> 16) & ~1; npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; + + /* Get buffer offset */ + if (pTDFX->whichOverlayBuffer == 0) + offset = (pTDFX->overlayBuffer->offset * bpp) + (top * dstPitch) + pTDFX->fbOffset; + else + offset = (pTDFX->overlayBuffer2->offset * bpp) + (top * dstPitch) + pTDFX->fbOffset; - offset = (pTDFX->overlayBuffer->offset * bpp) + (top * dstPitch) + pTDFX->fbOffset; + /* Flip to other buffer for next time */ + pTDFX->whichOverlayBuffer ^= 1; + dst_start = pTDFX->FbBase + offset; switch(id) { @@ -996,6 +1112,7 @@ s3offset = tmp; } nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; + TDFXTRACE("TDFXPutImageOverlay: using copymungeddata\n"); TDFXCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, buf + s3offset, dst_start, srcPitch, srcPitch2, dstPitch, nlines, npixels); @@ -1007,6 +1124,7 @@ buf += (top * srcPitch) + left; nlines = ((yb + 0xffff) >> 16) - top; dst_start += left; + TDFXTRACE("TDFXPutImageOverlay: using copydata\n"); TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } @@ -1025,6 +1143,15 @@ pTDFX->VideoTimerCallback = TDFXVideoTimerCallback; + /* Display some swap-buffer related info...: vidCurrOverlayStartAddr, fbiSwapHistory */ + /* To give us some insight into workings or otherwise of swapbuffer stuff */ + TDFXTRACE("TDFXPutImageOverlay: vidCurrOverlayStrtAdr=%x, fbiSwpHist=%x, whchBuf=%d, 3Dstus=%x\n", + pTDFX->readLong(pTDFX, VIDCUROVERLAYSTARTADDR), + pTDFX->readLong(pTDFX, SST_3D_FBISWAPHISTORY), + pTDFX->whichOverlayBuffer, + pTDFX->readLong(pTDFX, SST_3D_STATUS) + ); + return Success; } @@ -1049,6 +1176,10 @@ if(pTDFX->overlayBuffer) { xf86FreeOffscreenLinear(pTDFX->overlayBuffer); pTDFX->overlayBuffer = NULL; + } + if(pTDFX->overlayBuffer2) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer2); + pTDFX->overlayBuffer2 = NULL; } pPriv->videoStatus = 0; pTDFX->VideoTimerCallback = NULL; Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h:1.12 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h:1.12 Thu Apr 5 17:29:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h Wed Oct 16 21:02:08 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.12 2001/04/05 21:29:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.13 2002/10/17 01:02:08 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.1 @@ -197,12 +197,16 @@ /* 3D Registers */ #define SST_3D_OFFSET 0x200000 +#define SST_3D_STATUS SST_3D_OFFSET+0 #define SST_3D_LFBMODE SST_3D_OFFSET+0x114 #define SST_3D_COMMAND SST_3D_OFFSET+0x120 +#define SST_3D_SWAPBUFFERCMD SST_3D_OFFSET+0x128 #define SST_3D_SLICTRL SST_3D_OFFSET+0x20C #define SST_3D_AACTRL SST_3D_OFFSET+0x210 +#define SST_3D_SWAPPENDING SST_3D_OFFSET+0x24C #define SST_3D_LEFTOVERLAYBUF SST_3D_OFFSET+0x250 #define SST_3D_RIGHTOVERLAYBUF SST_3D_OFFSET+0x254 +#define SST_3D_FBISWAPHISTORY SST_3D_OFFSET+0x258 /* NAPALM REGISTERS */ #define CFG_PCI_COMMAND 4 Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h:1.11 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h:1.11 Fri Oct 20 08:57:26 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h Mon May 13 01:22:37 2002 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h,v 1.11 2000/10/20 12:57:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h,v 1.12 2002/05/13 05:22:37 keithp Exp $ */ /* TGA hardware description (minimal) * @@ -151,7 +151,7 @@ #define BPP24 (0x03 << 8) #define CAP_ENDS 0x8000 #define X11 0x0000 -#define WIN32 0x2000 +#define MODE_WIN32 0x2000 /* copy mode */ #define COPY 0x07 /* opaque fill mode */ Index: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile:1.28 xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile:1.31 --- xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile:1.28 Tue Jan 23 19:06:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile Mon Feb 17 12:06:44 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile,v 1.28 2001/01/24 00:06:31 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile,v 1.31 2003/02/17 17:06:44 dawes Exp $ XCOMM XCOMM This is an Imakefile for the TRIDENT driver. XCOMM @@ -9,11 +9,11 @@ SRCS = trident_driver.c trident_dac.c tridenthelper.c \ trident_accel.c trident_i2c.c trident_bank.c \ image_accel.c blade_accel.c tvga_dac.c trident_dga.c \ - trident_shadow.c trident_video.c + trident_shadow.c trident_video.c xp_accel.c OBJS = trident_driver.o trident_dac.o tridenthelper.o \ trident_accel.o trident_i2c.o trident_bank.o \ image_accel.o blade_accel.o tvga_dac.o trident_dga.o \ - trident_shadow.o trident_video.o + trident_shadow.o trident_video.o xp_accel.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -27,7 +27,7 @@ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XTOP)/include/extensions -I$(XF86OSSRC)/vbe + -I$(EXTINCSRC) -I$(XF86SRC)/vbe #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.17 xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.17 Sat Oct 27 23:33:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c Tue Oct 8 18:14:11 2002 @@ -23,7 +23,7 @@ * * Trident Blade3D accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.17 2001/10/28 03:33:51 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.18 2002/10/08 22:14:11 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -67,12 +67,14 @@ int xdir, int ydir, int rop, unsigned int planemask, int transparency_color); +#if 0 static void BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int offset); +#endif static void BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -498,6 +500,7 @@ BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff)); } +#if 0 static void BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -533,6 +536,7 @@ IMAGE_OUT(0x24, 0x80000000 | 3<<22 | 1<<7 | pTrident->BltScanDirection | (pTrident->ROP == GXcopy ? 0 : 1<<10) | offset<<25); } +#endif static void BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.51 xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.56 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.51 Sat Jan 12 19:15:52 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h Mon Sep 16 14:06:02 2002 @@ -21,7 +21,8 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.51 2002/01/13 00:15:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.56 2002/09/16 18:06:02 eich Exp $ */ +/*#define VBE_INFO*/ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ @@ -36,6 +37,8 @@ #include "shadowfb.h" #include "shadow.h" #include "xf86xv.h" +#include "xf86Pci.h" +#include "vbe.h" typedef struct { unsigned char tridentRegs3x4[0x100]; @@ -64,6 +67,7 @@ unsigned char * IOBase; unsigned char * FbBase; long FbMapSize; + IOADDRESS PIOBase; Bool NoAccel; Bool HWCursor; Bool UsePCIRetry; @@ -123,6 +127,10 @@ RamDacRecPtr RamDacRec; xf86CursorInfoPtr CursorInfoRec; xf86Int10InfoPtr Int10; + vbeInfoPtr pVbe; +#ifdef VBE_INFO + vbeModeInfoPtr vbeModes; +#endif XAAInfoRecPtr AccelInfoRec; CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; @@ -149,6 +157,12 @@ int OverrideRskew; OptionInfoPtr Options; Bool shadowNew; + int displaySize; + int dspOverride; + Bool GammaBrightnessOn; + int brightness; + double gamma; + int FPDelay; /* just for debugging - will go away */ } TRIDENTRec, *TRIDENTPtr; typedef struct { @@ -168,6 +182,9 @@ int shadow_HiOrd; } tridentLCD; +#define LCD_ACTIVE 0x01 +#define CRT_ACTIVE 0x02 + extern tridentLCD LCD[]; typedef struct { @@ -200,6 +217,7 @@ void TridentSave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg); Bool TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode); Bool TridentAccelInit(ScreenPtr pScreen); +Bool XPAccelInit(ScreenPtr pScreen); Bool ImageAccelInit(ScreenPtr pScreen); Bool BladeAccelInit(ScreenPtr pScreen); Bool TridentHWCursorInit(ScreenPtr pScreen); @@ -275,8 +293,7 @@ CYBERBLADEAI1, CYBERBLADEAI1D, CYBERBLADEE4, - CYBERBLADEXPm8, - CYBERBLADEXPm16, + BLADEXP, CYBERBLADEXPAI1 } TRIDENTType; @@ -288,7 +305,9 @@ (xf86IsPrimaryIsa())) #define HAS_DST_TRANS ((pTrident->Chipset == PROVIDIA9682) || \ - (pTrident->Chipset == PROVIDIA9685)) + (pTrident->Chipset == PROVIDIA9685) || \ + (pTrident->Chipset == BLADEXP) || \ + (pTrident->Chipset == CYBERBLADEXPAI1)) #define Is3Dchip ((pTrident->Chipset == CYBER9397) || \ (pTrident->Chipset == CYBER9397DVD) || \ @@ -305,8 +324,7 @@ (pTrident->Chipset == CYBERBLADEAI1D) || \ (pTrident->Chipset == BLADE3D) || \ (pTrident->Chipset == CYBERBLADEXPAI1) || \ - (pTrident->Chipset == CYBERBLADEXPm8) || \ - (pTrident->Chipset == CYBERBLADEXPm16)) + (pTrident->Chipset == BLADEXP)) /* * Trident DAC's @@ -322,6 +340,7 @@ #define VID_ZOOM_INV 0x1 #define VID_ZOOM_MINI 0x2 #define VID_OFF_SHIFT_4 0x4 - +#define VID_ZOOM_NOMINI 0x8 +#define VID_DOUBLE_LINEBUFFER_FOR_WIDE_SRC 0x10 #endif /* _TRIDENT_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.10 xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.10 Sun Jan 13 16:06:59 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man Mon Jan 6 05:15:26 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.10 2002/01/13 21:06:59 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.12 2003/01/06 10:15:26 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH TRIDENT __drivermansuffix__ __vendorversion__ @@ -26,9 +26,7 @@ .TP 12 .B Blade Blade3D, CyberBlade series i1, i7 (DSTN), i1, i1 (DSTN), Ai1, Ai1 (DSTN), -CyberBlade/e4, CyberBladeXPm8, CyberBladeXPm16, CyberBladeAi1/XP, BladeXP -NOTE: The XP series are NOT hardware accelerated due to the specifications -of the chip not being released. +CyberBlade/e4, CyberBladeXP, CyberBladeAi1/XP, BladeXP .TP 12 .B Image 3DImage975, 3DImage985, Cyber9520, Cyber9525, Cyber9397, Cyber9397DVD @@ -91,6 +89,7 @@ This is used to center the Xv image on the screen. By default the values are assigned based on the video card. Default: 0. +.TP .BI "Option \*qXvBskew\*q \*q" integer \*q Override the default Bottom skew value for the Xv extension. This is used to extend the Xv image on the screen at the bottom. By @@ -102,6 +101,24 @@ This is used to extend the Xv image on the screen at the right. By default the values are assigned based on the video card. Default: 0. +.TP +.BI "Option \*qDisplay\*q \*q" string \*q +Override the display. +Possible values are \*qCRT\*q, \*qLCD\*q and \*qDual\*q. +Please note that this option is only experimentally. +Default: Use display active when X started. +.TP +.BI "Option \*qDisplay1400\*q \*q" boolean \*q +Inform driver to expect 1400x1050 display instead of a 1280x1024. +Default: off. +.TP +.BI "Option \*qGammaBrightness\*q \*q" string \*q +Set display gamma value and brightness. \*q\fIstring\fP\*q is +\*q\fIgamma\fP, \fIbrightness\fP\*q, where \fIgamma\fP is a floating +point value greater than 0 and less or equal to 10. \fIbrightness\fP is +an integer value greater or equal to 0 and less than 128. +Default: gamma and brightness control is turned off. +Note: This is not supported on all chipsets. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHOR Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.22 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.22 Mon Sep 24 07:19:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c Wed Feb 12 16:46:42 2003 @@ -23,7 +23,7 @@ * * Trident accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.22 2001/09/24 11:19:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.26 2003/02/12 21:46:42 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -79,6 +79,7 @@ int patternx, int patterny, int x, int y, int w, int h); #endif +#if 0 static void TridentSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -87,6 +88,7 @@ ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); static void TridentSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#endif static void @@ -183,7 +185,6 @@ TridentSetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = TridentSubsequentMono8x8PatternFillRect; - infoPtr->MonoPatternPitch = 64; } #if 0 /* Not convinced this works 100% yet */ @@ -199,23 +200,27 @@ TridentSubsequentColor8x8PatternFillRect; #endif - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | +#if 0 /* This is buggy, it only seems to work 95% of the time.... */ + { + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | NO_TRANSPARENCY | BIT_ORDER_IN_BYTE_MSBFIRST; - pTrident->XAAScanlineColorExpandBuffers[0] = + pTrident->XAAScanlineColorExpandBuffers[0] = xnfalloc(((pScrn->virtualX + 63)) *4* (pScrn->bitsPerPixel / 8)); - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->ScanlineColorExpandBuffers = pTrident->XAAScanlineColorExpandBuffers; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = TridentSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = TridentSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = TridentSubsequentColorExpandScanline; + } +#endif return(XAAInit(pScreen, infoPtr)); } @@ -473,6 +478,7 @@ TridentSync(pScrn); } +#if 0 static void MoveDWORDS( register CARD32* dest, register CARD32* src, @@ -500,6 +506,7 @@ dest += 1; src += 1; } +#endif static void TridentSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, @@ -600,6 +607,7 @@ } #endif +#if 0 static void TridentSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, @@ -662,3 +670,4 @@ TGUI_COMMAND(GE_BLT); } } +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.63 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.70 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.63 Fri Jan 11 08:06:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c Sun Jan 5 13:09:00 2003 @@ -1,4 +1,3 @@ - /* * Copyright 1992-2000 by Alan Hourihane, Wigan, England. * @@ -22,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.63 2002/01/11 13:06:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.70 2003/01/05 18:09:00 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -96,7 +95,8 @@ { 640, 480, 0x13, 0x61 }, { 800, 600, 0x13, 0x61 }, { 1024, 768, 0x3b, 0x63 }, - { 1280, 1024, 0x7b, 0x64 } + { 1280, 1024, 0x7b, 0x64 }, + { 1400, 1050, 0x11, 0x7b } }; int @@ -175,6 +175,57 @@ return; } +static void +tridentSetBrightnessAndGamma(TRIDENTRegPtr tridentReg, + Bool on, double exp,int brightness) +{ + int pivots[] = {0,3,15,63,255}; + + double slope; + double y_0; + double x, x_prev = 0, y, y_prev = 0; + int i; + CARD8 i_slopes[4]; + CARD8 intercepts[4]; + + if (!on) { + tridentReg->tridentRegs3C4[0xB4] &= ~0x80; + return; + } + + for (i = 0; i < 4; i++) { + x = pivots[i + 1] / 255.0; + y = pow(x,exp); + slope = (y - y_prev) / (x - x_prev); + y_0 = y - x * slope; + { +#define RND(x) ((((x) - (int) (x)) < 0.5) ? (int)(x) : (int)(x) + 1) + int val = slope; + if (val > 7) + i_slopes[i] = (3 << 4) | (RND(slope) & 0xf); + else if (val > 3) + i_slopes[i] = (2 << 4) | (RND(slope * 2) & 0xf); + else if (val > 1) + i_slopes[i] = (1 << 4) | (RND(slope * 4) & 0xf); + else + i_slopes[i] = (RND(slope * 8) & 0xf); +#undef RND + } + intercepts[i] = (char)(y_0 * 256 / 4); + x_prev = x; + y_prev = y; + } + + tridentReg->tridentRegs3C4[0xB4] = 0x80 | i_slopes[0]; + tridentReg->tridentRegs3C4[0xB5] = i_slopes[1]; + tridentReg->tridentRegs3C4[0xB6] = i_slopes[2]; + tridentReg->tridentRegs3C4[0xB7] = i_slopes[3]; + tridentReg->tridentRegs3C4[0xB8] = (intercepts[0] + brightness); + tridentReg->tridentRegs3C4[0xB9] = (intercepts[1] + brightness); + tridentReg->tridentRegs3C4[0xBA] = (intercepts[2] + brightness); + tridentReg->tridentRegs3C4[0xBB] = (intercepts[3] + brightness); +} + Bool TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -184,20 +235,21 @@ int vgaIOBase; int offset = 0; int clock = pTrident->currentClock; - CARD8 protect; + CARD8 protect = 0; Bool fullSize = FALSE; Bool isShadow = FALSE; vgaHWPtr hwp = VGAHWPTR(pScrn); vgaRegPtr regp = &hwp->ModeReg; vgaRegPtr vgaReg = &hwp->ModeReg; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; - + /* Unprotect */ - OUTB(0x3C4, 0x11); - protect = INB(0x3C5); - OUTB(0x3C5, 0x92); + if (pTrident->Chipset > PROVIDIA9685) { + OUTB(0x3C4, Protection); + protect = INB(0x3C5); + OUTB(0x3C5, 0x92); + } OUTB(0x3C4, 0x0B); INB(0x3C5); /* Ensure we are in New Mode */ @@ -230,13 +282,31 @@ ShadowModeActive = ((INB(0x3CF) & 0x81) == 0x81); #endif OUTB(0x3CE, FPConfig); - LCDActive = (INB(0x3CF) & 0x10); - + pReg->tridentRegs3CE[FPConfig] = INB(0x3CF); + if (pTrident->dspOverride) { + if (pTrident->dspOverride & LCD_ACTIVE) { + pReg->tridentRegs3CE[FPConfig] |= 0x10; + LCDActive = TRUE; + } else { + pReg->tridentRegs3CE[FPConfig] &= ~0x10; + LCDActive = FALSE; + } + if (pTrident->dspOverride & CRT_ACTIVE) + pReg->tridentRegs3CE[FPConfig] |= 0x20; + else + pReg->tridentRegs3CE[FPConfig] &= ~0x20; + } else { + LCDActive = (pReg->tridentRegs3CE[FPConfig] & 0x10); + } + OUTB(0x3CE, CyberEnhance); #if 0 pReg->tridentRegs3CE[CyberEnhance] = INB(0x3CF); #else pReg->tridentRegs3CE[CyberEnhance] = INB(0x3CF) & 0x8F; + if (mode->CrtcVDisplay > 1024) + pReg->tridentRegs3CE[CyberEnhance] |= 0x50; + else if (mode->CrtcVDisplay > 768) pReg->tridentRegs3CE[CyberEnhance] |= 0x30; else @@ -340,8 +410,11 @@ pReg->tridentRegs3CE[CyberControl] &= 0x7E; xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n"); } - - + if (pTrident->FPDelay < 6) { + pReg->tridentRegs3CE[CyberControl] &= 0xC7; + pReg->tridentRegs3CE[CyberControl] |= (pTrident->FPDelay + 2) << 3; + } + if (pTrident->CyberShadow) { pReg->tridentRegs3CE[CyberControl] &= 0x7E; isShadow = FALSE; @@ -397,7 +470,7 @@ pReg->tridentRegs3x4[PreEndFetch] = INB(vgaIOBase + 5); #endif /* set mode */ - if (pTrident->Chipset < CYBERBLADEXPm8) { + if (pTrident->Chipset < BLADEXP) { pReg->tridentRegs3CE[BiosMode] = TridentFindMode( pScrn->currentMode->HDisplay, pScrn->currentMode->VDisplay, @@ -417,7 +490,10 @@ }; /* no stretch */ - pReg->tridentRegs3CE[BiosReg] = 0; + if (pTrident->Chipset != CYBERBLADEXPAI1) + pReg->tridentRegs3CE[BiosReg] = 0; + else + pReg->tridentRegs3CE[BiosReg] = 8; if (pTrident->CyberStretch) { pReg->tridentRegs3CE[VertStretch] |= 0x01; @@ -429,8 +505,7 @@ /* Enable Chipset specific options */ switch (pTrident->Chipset) { case CYBERBLADEXPAI1: - case CYBERBLADEXPm8: - case CYBERBLADEXPm16: + case BLADEXP: case CYBERBLADEI7: case CYBERBLADEI7D: case CYBERBLADEI1: @@ -478,7 +553,6 @@ } } - /* Defaults for all trident chipsets follows */ switch (pScrn->bitsPerPixel) { case 1: @@ -517,7 +591,8 @@ break; case 32: pReg->tridentRegs3CE[MiscExtFunc] |= 0x02; - if (pTrident->Chipset != CYBERBLADEE4) { + if (pTrident->Chipset != CYBERBLADEE4 + && pTrident->Chipset != CYBERBLADEXPAI1) { /* Clock Division by 2*/ pReg->tridentRegs3CE[MiscExtFunc] |= 0x08; clock *= 2; /* Double the clock */ @@ -525,11 +600,12 @@ offset = pScrn->displayWidth >> 1; pReg->tridentRegs3x4[PixelBusReg] = 0x09; pReg->tridentRegsDAC[0x00] = 0xD0; - if (pTrident->Chipset == CYBERBLADEE4) { + if (pTrident->Chipset == CYBERBLADEE4 + || pTrident->Chipset == CYBERBLADEXPAI1) { OUTB(vgaIOBase+ 4, New32); pReg->tridentRegs3x4[New32] = INB(vgaIOBase + 5) | 0x80; /* With new mode 32bpp we set the packed flag */ - pReg->tridentRegs3x4[PixelBusReg] |= 0x20; + pReg->tridentRegs3x4[PixelBusReg] |= 0x20; } break; } @@ -572,8 +648,7 @@ OUTB(vgaIOBase+ 4, Performance); pReg->tridentRegs3x4[Performance] = INB(vgaIOBase + 5); - - if (pTrident->Chipset < CYBERBLADEXPm8) + if (pTrident->Chipset < BLADEXP) pReg->tridentRegs3x4[Performance] |= 0x10; OUTB(vgaIOBase+ 4, DRAMControl); @@ -582,6 +657,11 @@ if (pTrident->IsCyber && !pTrident->MMIOonly) pReg->tridentRegs3x4[DRAMControl] |= 0x20; + if (pTrident->NewClockCode && pTrident->Chipset <= CYBER9397DVD) { + OUTB(vgaIOBase + 4, ClockControl); + pReg->tridentRegs3x4[ClockControl] = INB(vgaIOBase + 5) | 0x01; + } + OUTB(vgaIOBase+ 4, AddColReg); pReg->tridentRegs3x4[AddColReg] = INB(vgaIOBase + 5) & 0xEF; pReg->tridentRegs3x4[AddColReg] |= (offset & 0x100) >> 4; @@ -621,15 +701,32 @@ } } + if (pTrident->Chipset >= CYBER9388) { + if (pTrident->GammaBrightnessOn) + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1, + "Setting Gamma: %f Brightness: %i\n", + pTrident->gamma, pTrident->brightness); + tridentSetBrightnessAndGamma(pReg, + pTrident->GammaBrightnessOn, + pTrident->gamma, pTrident->brightness); + } + /* Video */ OUTB(0x3C4,0x20); pReg->tridentRegs3C4[SSetup] = INB(0x3C5) | 0x4; pReg->tridentRegs3C4[SKey] = 0x00; pReg->tridentRegs3C4[SPKey] = 0xC0; - + OUTB(0x3C4,0x12); + pReg->tridentRegs3C4[Threshold] = INB(0x3C5); + if (pScrn->bitsPerPixel > 16) + pReg->tridentRegs3C4[Threshold] = + (pReg->tridentRegs3C4[Threshold] & 0xf0) | 0x2; + /* restore */ - OUTB(0x3C4, 0x11); - OUTB(0x3C5, protect); + if (pTrident->Chipset > PROVIDIA9685) { + OUTB(0x3C4, Protection); + OUTB(0x3C5, protect); + } return(TRUE); } @@ -640,7 +737,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp; int vgaIOBase; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; if (pTrident->Chipset > PROVIDIA9685) { @@ -684,11 +780,24 @@ OUTW_3CE(MiscIntContReg); OUTW_3CE(MiscExtFunc); OUTW_3x4(Offset); - OUTW_3C4(SSetup); - OUTW_3C4(SKey); - OUTW_3C4(SPKey); - OUTW_3x4(PreEndControl); - OUTW_3x4(PreEndFetch); + if (pTrident->NewClockCode && pTrident->Chipset <= CYBER9397DVD) + OUTW_3x4(ClockControl); + if (pTrident->Chipset >= CYBER9388) { + OUTW_3C4(Threshold); + OUTW_3C4(SSetup); + OUTW_3C4(SKey); + OUTW_3C4(SPKey); + OUTW_3x4(PreEndControl); + OUTW_3x4(PreEndFetch); + OUTW_3C4(GBslope1); + OUTW_3C4(GBslope2); + OUTW_3C4(GBslope3); + OUTW_3C4(GBslope4); + OUTW_3C4(GBintercept1); + OUTW_3C4(GBintercept2); + OUTW_3C4(GBintercept3); + OUTW_3C4(GBintercept4); + } if (pTrident->Chipset >= CYBER9385) OUTW_3x4(Enhancement0); if (pTrident->Chipset >= BLADE3D) OUTW_3x4(RAMDACTiming); if (pTrident->Chipset == CYBERBLADEE4) OUTW_3x4(New32); @@ -697,13 +806,14 @@ OUTW_3CE(VertStretch); OUTW_3CE(HorStretch); - if (pTrident->Chipset < CYBERBLADEXPm8) { + if (pTrident->Chipset < BLADEXP) { OUTW_3CE(BiosMode); } else { OUTW_3CE(BiosNewMode1); OUTW_3CE(BiosNewMode2); }; - OUTW_3CE(BiosReg); + OUTW_3CE(BiosReg); + OUTW_3CE(FPConfig); OUTW_3CE(CyberControl); OUTW_3CE(CyberEnhance); SHADOW_ENABLE(tmp); @@ -764,7 +874,7 @@ OUTB(0x3C5, tridentReg->tridentRegs3C4[Protection]); } - OUTW(0x3C4, ((tridentReg->tridentRegs3C4[NewMode1] ^ 0x02) << 8)| NewMode1); + OUTW(0x3C4, ((tridentReg->tridentRegs3C4[NewMode1] ^ 0x02) << 8)| NewMode1); } void @@ -773,7 +883,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp; int vgaIOBase; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* Goto New Mode */ @@ -786,7 +895,8 @@ /* Unprotect registers */ OUTW(0x3C4, ((0xC0 ^ 0x02) << 8) | NewMode1); - OUTW(0x3C4, (0x92 << 8) | Protection); + if (pTrident->Chipset > PROVIDIA9685) + OUTW(0x3C4, (0x92 << 8) | Protection); INB_3x4(Offset); INB_3x4(LinearAddReg); @@ -801,11 +911,24 @@ INB_3x4(GraphEngReg); INB_3x4(PCIReg); INB_3x4(PCIRetry); - INB_3C4(SSetup); - INB_3C4(SKey); - INB_3C4(SPKey); - INB_3x4(PreEndControl); - INB_3x4(PreEndFetch); + if (pTrident->NewClockCode && pTrident->Chipset <= CYBER9397DVD) + INB_3x4(ClockControl); + if (pTrident->Chipset >= CYBER9388) { + INB_3C4(Threshold); + INB_3C4(SSetup); + INB_3C4(SKey); + INB_3C4(SPKey); + INB_3x4(PreEndControl); + INB_3x4(PreEndFetch); + INB_3C4(GBslope1); + INB_3C4(GBslope2); + INB_3C4(GBslope3); + INB_3C4(GBslope4); + INB_3C4(GBintercept1); + INB_3C4(GBintercept2); + INB_3C4(GBintercept3); + INB_3C4(GBintercept4); + } if (pTrident->Chipset >= CYBER9385) INB_3x4(Enhancement0); if (pTrident->Chipset >= BLADE3D) INB_3x4(RAMDACTiming); if (pTrident->Chipset == CYBERBLADEE4) INB_3x4(New32); @@ -813,10 +936,14 @@ CARD8 tmp; INB_3CE(VertStretch); INB_3CE(HorStretch); - INB_3CE(BiosMode); + if (pTrident->Chipset < BLADEXP) { + INB_3CE(BiosMode); + } else { INB_3CE(BiosNewMode1); INB_3CE(BiosNewMode2); + } INB_3CE(BiosReg); + INB_3CE(FPConfig); INB_3CE(CyberControl); INB_3CE(CyberEnhance); SHADOW_ENABLE(tmp); @@ -886,7 +1013,6 @@ { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int vgaIOBase; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* 64x64 */ @@ -897,7 +1023,6 @@ TridentHideCursor(ScrnInfoPtr pScrn) { int vgaIOBase; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; OUTW(vgaIOBase + 4, 0x4150); @@ -908,7 +1033,6 @@ { int vgaIOBase; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; if (x < 0) { @@ -934,7 +1058,6 @@ { int vgaIOBase; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; OUTW(vgaIOBase + 4, (fg & 0x000000FF)<<8 | 0x48); OUTW(vgaIOBase + 4, (fg & 0x0000FF00) | 0x49); @@ -954,7 +1077,6 @@ { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int vgaIOBase; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; memcpy((CARD8 *)pTrident->FbBase + (pScrn->videoRam * 1024) - 4096, Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c:1.3 Tue Oct 26 18:46:59 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c Tue Oct 8 18:14:11 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c,v 1.3 1999/10/26 22:46:59 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c,v 1.4 2002/10/08 22:14:11 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -20,8 +20,10 @@ static void TRIDENT_SetViewport(ScrnInfoPtr, int, int, int); static void TRIDENT_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void TRIDENT_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void TRIDENT_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec TRIDENTDGAFuncs = { @@ -237,8 +239,8 @@ SET_SYNC_FLAG(pTrident->AccelInfoRec); } } - +#if 0 static void TRIDENT_BlitTransRect( ScrnInfoPtr pScrn, @@ -250,7 +252,7 @@ /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } - +#endif static Bool TRIDENT_OpenFramebuffer( Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.160 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.176 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.160 Tue Jan 15 13:31:19 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c Mon Feb 10 22:41:38 2003 @@ -28,7 +28,7 @@ * Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the * clockchip programming code. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.160 2002/01/15 18:31:19 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.176 2003/02/11 03:41:38 dawes Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -166,8 +166,7 @@ { CYBERBLADEI1D, "cyberbladei1d" }, { CYBERBLADEAI1, "cyberbladeAi1" }, { CYBERBLADEAI1D, "cyberbladeAi1d" }, - { CYBERBLADEXPm8, "cyberbladeXPm/8" }, - { CYBERBLADEXPm16, "cyberbladeXPm/16" }, + { BLADEXP, "bladeXP" }, { CYBERBLADEXPAI1, "cyberbladeXPAi1" }, { -1, NULL } }; @@ -209,8 +208,7 @@ { CYBERBLADEI1D, PCI_CHIP_8520, RES_SHARED_VGA }, { CYBERBLADEAI1, PCI_CHIP_8600, RES_SHARED_VGA }, { CYBERBLADEAI1D, PCI_CHIP_8620, RES_SHARED_VGA }, - { CYBERBLADEXPm8, PCI_CHIP_9910, RES_SHARED_VGA }, - { CYBERBLADEXPm16, PCI_CHIP_9930, RES_SHARED_VGA }, + { BLADEXP, PCI_CHIP_9910, RES_SHARED_VGA }, { CYBERBLADEXPAI1, PCI_CHIP_8820, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -233,7 +231,11 @@ OPTION_XV_HSYNC, OPTION_XV_VSYNC, OPTION_XV_BSKEW, - OPTION_XV_RSKEW + OPTION_XV_RSKEW, + OPTION_FP_DELAY, + OPTION_1400_DISPLAY, + OPTION_DISPLAY, + OPTION_GB } TRIDENTOpts; static const OptionInfoRec TRIDENTOptions[] = { @@ -254,6 +256,10 @@ { OPTION_XV_VSYNC, "XvVsync", OPTV_INTEGER, {0}, FALSE }, { OPTION_XV_BSKEW, "XvBskew", OPTV_INTEGER, {0}, FALSE }, { OPTION_XV_RSKEW, "XvRskew", OPTV_INTEGER, {0}, FALSE }, + { OPTION_FP_DELAY, "FpDelay", OPTV_INTEGER, {0}, FALSE }, + { OPTION_1400_DISPLAY, "Display1400", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DISPLAY, "Display", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_GB, "GammaBrightness", OPTV_ANYSTR, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -460,6 +466,7 @@ { 3,800,600,40000,0x7f,0x00,0x69,0x7f,0x72,0xf0,0x59,0x0d,0x00,0x08}, { 2,1024,768,65000,0xa3,0x00,0x84,0x94,0x24,0xf5,0x03,0x09,0x24,0x08}, { 0,1280,1024,108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8}, + { 4,1400,1050,122000,0xe6,0xcd,0xba,0x1d,0x38,0x00,0x1c,0x28,0x28,0xf8}, { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; #endif @@ -697,15 +704,15 @@ black. I'm sure there's a better way to do that, just lazy to search the docs. */ -#if 1 - hwp->writeDacWriteAddr(hwp, 0x00); - hwp->writeDacData(hwp, 0x00); hwp->writeDacData(hwp, 0x00); hwp->writeDacData(hwp, 0x00); - hwp->writeDacWriteAddr(hwp, 0x3F); - hwp->writeDacData(hwp, 0x3F); hwp->writeDacData(hwp, 0x3F); hwp->writeDacData(hwp, 0x3F); -#else - outb(0x3C8, 0x00); outb(0x3C9, 0x00); outb(0x3C9, 0x00); outb(0x3C9, 0x00); - outb(0x3C8, 0x3F); outb(0x3C9, 0x3F); outb(0x3C9, 0x3F); outb(0x3C9, 0x3F); -#endif + (*hwp->writeDacWriteAddr)(hwp, 0x00); + (*hwp->writeDacData)(hwp, 0x00); + (*hwp->writeDacData)(hwp, 0x00); + (*hwp->writeDacData)(hwp, 0x00); + + (*hwp->writeDacWriteAddr)(hwp, 0x3F); + (*hwp->writeDacData)(hwp, 0x3F); + (*hwp->writeDacData)(hwp, 0x3F); + (*hwp->writeDacData)(hwp, 0x3F); } Bool @@ -1006,9 +1013,17 @@ static int * GetAccelPitchValues(ScrnInfoPtr pScrn) { + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int *linePitches = NULL; int lines[4] = { 512, 1024, 2048, 4096 }; /* 9440AGi */ int i, n = 0; + + if (pTrident->Chipset >= BLADEXP) { + lines[0] = 1024; + lines[1] = 2048; + lines[2] = 4096; + lines[3] = 8192; + } for (i = 0; i < 4; i++) { n++; @@ -1040,6 +1055,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) { TRIDENTPtr pTrident; + vgaHWPtr hwp; MessageType from; CARD8 videoram, videorammask; char *ramtype = NULL, *chipset = NULL; @@ -1156,10 +1172,12 @@ if (!vgaHWGetHWRec(pScrn)) return FALSE; - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + vgaIOBase = hwp->IOBase; + pTrident->PIOBase = hwp->PIOOffset; - xf86SetOperatingState(RES_SHARED_VGA, pTrident->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVga, pTrident->pEnt->index, ResUnusedOpr); /* The ramdac module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "ramdac")) @@ -1248,6 +1266,9 @@ pTrident->UsePCIBurst = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI Burst disbled\n"); } + if (xf86ReturnOptValBool(pTrident->Options, OPTION_1400_DISPLAY, FALSE)) { + pTrident->displaySize = 1400; + } if(xf86GetOptValInteger(pTrident->Options, OPTION_VIDEO_KEY, &(pTrident->videoKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", @@ -1268,9 +1289,71 @@ " with NoMMIO\n"); else { pTrident->MMIOonly = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MMIO Disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MMIO only enabled\n"); + } + } + + pTrident->dspOverride = 0; + if ((s = xf86GetOptValString(pTrident->Options, OPTION_DISPLAY))) { + if(!xf86NameCmp(s, "CRT")) { + pTrident->dspOverride = CRT_ACTIVE; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"LCD off CRT on\n"); + } else if (!xf86NameCmp(s, "LCD")) { + pTrident->dspOverride = LCD_ACTIVE; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"LCD on CRT off\n"); + } else if (!xf86NameCmp(s, "Dual")) { + pTrident->dspOverride = LCD_ACTIVE | CRT_ACTIVE; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"LCD on CRT on\n"); + } else + xf86DrvMsg(pScrn->scrnIndex,X_ERROR, + "%s is an unknown display option\n",s); + } + if ((s = xf86GetOptValString(pTrident->Options, OPTION_GB))) { + int brightness = -1; + double gamma = -1.0; + Bool error = FALSE; + int i; + + i = sscanf(s,"%lf %i",&gamma,&brightness); + + if (i != 2 || brightness == -1 || gamma == -1.0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Invalid Gamma/Brightness argument: %s\n",s); + error = TRUE; + } else { + if (brightness < 0 || brightness > 128) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "brightness out of range [0,128]: %i\n",brightness); + error = TRUE; + } + if (gamma <= 0.0 || gamma > 10.0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "gamma out of range (0,10.0]: %f\n",gamma); + error = TRUE; + } + } + + if (!error) { + pTrident->GammaBrightnessOn = TRUE; + pTrident->gamma = gamma; + pTrident->brightness = brightness; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"Gamma: %f Brightness: %i\n", + gamma,brightness); } } + + /* The following is a temporary hack */ + pTrident->FPDelay = 7; /* invalid value */ + if (xf86GetOptValInteger(pTrident->Options, OPTION_FP_DELAY, + &pTrident->FPDelay)) { + if (pTrident->FPDelay < -2 || pTrident->FPDelay > 5) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FPDelay %i out if range " + "(-2 < FPDelay < 5)\n",pTrident->FPDelay); + pTrident->FPDelay = 7; + } else + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "FP Delay set to %i\n", + pTrident->FPDelay); + } if (xf86ReturnOptValBool(pTrident->Options, OPTION_CYBER_SHADOW, FALSE)) { pTrident->CyberShadow = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cyber Shadow enabled\n"); @@ -1298,6 +1381,18 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Vsync set to %d\n", pTrident->OverrideVsync); } + pTrident->OverrideHsync = 0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_HSYNC, + &pTrident->OverrideHsync)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Hsync set to %d\n", + pTrident->OverrideHsync); + } + pTrident->OverrideVsync = 0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_VSYNC, + &pTrident->OverrideVsync)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Vsync set to %d\n", + pTrident->OverrideVsync); + } pTrident->OverrideRskew = 0; if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_RSKEW, &pTrident->OverrideRskew)) { @@ -1330,7 +1425,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring Option ROTATE " "in non-Linear Mode\n"); else if (pScrn->depth < 8) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Tgnoring Option ROTATE " + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring Option ROTATE " "when depth < 8"); else { if(!xf86NameCmp(s, "CW")) { @@ -1419,6 +1514,15 @@ xf86LoaderReqSymLists(vbeSymbols, NULL); pVbe = VBEInit(NULL,pTrident->pEnt->index); pMon = vbeDoEDID(pVbe, NULL); +#ifdef VBE_INFO + { + VbeInfoBlock* vbeInfoBlockPtr; + if ((vbeInfoBlockPtr = VBEGetVBEInfo(pVbe))) { + pTrident->vbeModes = VBEBuildVbeModeList(pVbe,vbeInfoBlockPtr); + VBEFreeVBEInfo(vbeInfoBlockPtr); + } + } +#endif vbeFree(pVbe); if (pMon) { if (!xf86LoadSubModule(pScrn, "ddc")) { @@ -1432,7 +1536,7 @@ } } - + if (IsPciCard && UseMMIO) { if (!TRIDENTMapMem(pScrn)) return FALSE; @@ -1852,36 +1956,37 @@ pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; - case CYBERBLADEXPm8: + case BLADEXP: /* 0x9910 */ pTrident->ddc1Read = Tridentddc1Read; ramtype = "SGRAM"; pTrident->HasSGRAM = TRUE; - pTrident->NoAccel = TRUE; /* Disable acceleration */ - pTrident->HWCursor = FALSE; - pTrident->IsCyber = TRUE; Support24bpp = TRUE; - chipset = "CyberBladeXPm/8"; pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; - break; - case CYBERBLADEXPm16: - pTrident->ddc1Read = Tridentddc1Read; - ramtype = "SGRAM"; - pTrident->HasSGRAM = TRUE; - pTrident->NoAccel = TRUE; /* Disable acceleration */ - pTrident->HWCursor = FALSE; - pTrident->IsCyber = TRUE; - Support24bpp = TRUE; - chipset = "CyberBladeXPm/16"; - pTrident->NewClockCode = TRUE; - pTrident->frequency = NTSC; + OUTB(0x3C4, 0x5D); + if (pTrident->PciInfo->subsysVendor != 0x1023) { + chipset = "CyberBladeXP"; + pTrident->IsCyber = TRUE; + } else + if (!(INB(0x3C5) & 0x01)) { + chipset = "BladeXP"; + } else { + CARD8 mem1, mem2; + OUTB(vgaIOBase + 0x04, SPR); + mem1 = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 0x04, 0xC1); + mem2 = INB(vgaIOBase + 5); + if ((mem1 & 0x0e) && (mem2 == 0x11)) { + chipset = "BladeT64"; + } else { + chipset = "BladeT16"; + } + } break; case CYBERBLADEXPAI1: pTrident->ddc1Read = Tridentddc1Read; ramtype = "SGRAM"; pTrident->HasSGRAM = TRUE; - pTrident->NoAccel = TRUE; /* Disable acceleration */ - pTrident->HWCursor = FALSE; pTrident->IsCyber = TRUE; pTrident->shadowNew = TRUE; Support24bpp = TRUE; @@ -1890,8 +1995,6 @@ pTrident->frequency = NTSC; break; } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", - pTrident->HWCursor ? "HW" : "SW"); if (!pScrn->progClock) { pScrn->numClocks = NoClocks; @@ -1927,22 +2030,21 @@ /* HW bpp matches reported bpp */ pTrident->HwBpp = pScrn->bitsPerPixel; + /* Due to bugs in the chip, turn it off */ + if (pTrident->Chipset >= CYBERBLADEI7 && pTrident->Chipset <= CYBERBLADEAI1D) + pTrident->HWCursor = FALSE; + from = X_PROBED; if (pTrident->pEnt->device->videoRam != 0) { pScrn->videoRam = pTrident->pEnt->device->videoRam; from = X_CONFIG; + + /* Due to only 12bits of cursor location, if user has overriden + * disable the cursor automatically */ + if (pTrident->Chipset >= CYBER9397 && pTrident->Chipset < CYBERBLADEE4) + if (pTrident->pEnt->device->videoRam > 4096) + pTrident->HWCursor = FALSE; } else { - if (pTrident->Chipset == CYBERBLADEXPAI1) { - pScrn->videoRam = 16384; /* NOTE: I have no idea what the real - * value is. BIOS takes about 20M RAM - * for its own and vid RAM */ - } else - if (pTrident->Chipset == CYBERBLADEXPm8) { - pScrn->videoRam = 8192; - } else - if (pTrident->Chipset == CYBERBLADEXPm16) { - pScrn->videoRam = 16384; - } else if (pTrident->Chipset == CYBER9525DVD) { pScrn->videoRam = 2560; } else @@ -1954,31 +2056,65 @@ else videorammask = 0x0F; switch (videoram & videorammask) { - case 0x01: - pScrn->videoRam = 512; - break; - case 0x03: - pScrn->videoRam = 1024; - break; - case 0x04: /* 8MB, but - hw cursor can't store above 4MB */ - /* So, we force to 4MB for now */ - /* pScrn->videoRam = 8192; */ - /* Apparantly this isn't true for the CYBER9397DVD */ - /* maybe some other chipsets aren't affected either */ - /* XXX this needs to be investigated further */ - if (pTrident->HWCursor && (pTrident->Chipset != CYBER9397DVD)) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + case 0x01: + pScrn->videoRam = 512; + break; + case 0x02: /* XP */ + pScrn->videoRam = 6144; + break; + case 0x03: + pScrn->videoRam = 1024; + break; + case 0x04: + /* + * 8MB, but - hw cursor can't store above 4MB + * This only affects Image series chipsets, but for + * some reason, reports suggest that the 9397DVD isn't + * affected. XXX needs furthur investigation ! + */ + if (pTrident->HWCursor && (pTrident->Chipset != CYBER9397DVD) && + (pTrident->Chipset < CYBERBLADEE4)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Found 8MB board, using 4MB\n"); - pScrn->videoRam = 4096; - } else - pScrn->videoRam = 8192; - break; - case 0x07: - pScrn->videoRam = 2048; - break; - case 0x0F: - pScrn->videoRam = 4096; - break; + pScrn->videoRam = 4096; + } else + pScrn->videoRam = 8192; + break; + case 0x06: /* XP */ + pScrn->videoRam = 10240; + break; + case 0x07: + pScrn->videoRam = 2048; + break; + case 0x08: /* XP */ + pScrn->videoRam = 12288; + break; + case 0x0A: /* XP */ + pScrn->videoRam = 14336; + break; + case 0x0C: /* XP */ + pScrn->videoRam = 16384; + break; + case 0x0E: /* XP */ + OUTB(vgaIOBase + 4, 0xC1); + switch (INB(vgaIOBase + 5) & 0x11) { + case 0x00: + pScrn->videoRam = 20480; + break; + case 0x01: + pScrn->videoRam = 24576; + break; + case 0x10: + pScrn->videoRam = 28672; + break; + case 0x11: + pScrn->videoRam = 32768; + break; + } + break; + case 0x0F: + pScrn->videoRam = 4096; + break; default: pScrn->videoRam = 1024; xf86DrvMsg(pScrn->scrnIndex, from, @@ -1989,6 +2125,9 @@ } } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pTrident->HWCursor ? "HW" : "SW"); + xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam); @@ -2003,17 +2142,50 @@ dsp1 = INB(0x3CF); OUTB(0x3CE,0x52); mod = INB(0x3CF); - for (i = 0; LCD[i].mode != 0xff; i++) { - if (LCD[i].mode == ((mod >> 4) & 3)) { - pTrident->lcdMode = i; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %ix%i found\n", + /* + * Only allow display size override if 1280x1024 is detected + * Currently 1400x1050 is supported - which is detected as + * 1280x1024 + */ + if (pTrident->displaySize) { + if (((mod >> 4) & 3) == 0) { + for (i = 0; LCD[i].mode != 0xff; i++) { + if (pTrident->displaySize == LCD[i].display_x) + pTrident->lcdMode = LCD[i].mode; + } + xf86DrvMsg(pScrn->scrnIndex, + X_CONFIG,"%s Panel %ix%i found\n", (dsp & 0x80) ? "TFT" : ((dsp1 & 0x20) ? "DSTN" : "STN"), - LCD[i].display_x,LCD[i].display_y); + LCD[i].display_x,LCD[i].display_y); + } else { + xf86DrvMsg(pScrn->scrnIndex,X_WARNING, + "Display size override only for 1280x1024\n"); + pTrident->displaySize = 0; } } - OUTB(0x3CE, FPConfig); - pTrident->lcdActive = (INB(0x3CF) & 0x10); + + if (!pTrident->displaySize) { + for (i = 0; LCD[i].mode != 0xff; i++) { + if (LCD[i].mode == ((mod >> 4) & 3)) { + pTrident->lcdMode = i; + xf86DrvMsg(pScrn->scrnIndex, + X_PROBED,"%s Panel %ix%i found\n", + (dsp & 0x80) ? "TFT" : + ((dsp1 & 0x20) ? "DSTN" : "STN"), + LCD[i].display_x,LCD[i].display_y); + } + } + } + if (pTrident->dspOverride) { + if (pTrident->dspOverride & LCD_ACTIVE) + pTrident->lcdActive = TRUE; + else + pTrident->lcdActive = FALSE; + } else { + OUTB(0x3CE, FPConfig); + pTrident->lcdActive = (INB(0x3CF) & 0x10); + } } pTrident->MCLK = 0; @@ -2251,6 +2423,7 @@ switch (pScrn->displayWidth * pScrn->bitsPerPixel / 8) { case 512: + case 8192: pTrident->EngineOperation |= 0x00; break; case 1024: @@ -2315,8 +2488,8 @@ pTrident->IOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pTrident->PciTag, pTrident->IOAddress, mapsize); else { - pTrident->IOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, - pTrident->IOAddress, 0x1000); + pTrident->IOBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO, + pTrident->PciTag, pTrident->IOAddress, 0x1000); pTrident->IOBase += 0xF00; } @@ -2389,7 +2562,8 @@ vgaReg = &VGAHWPTR(pScrn)->SavedReg; tridentReg = &pTrident->SavedReg; - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | (IsPrimaryCard ? VGA_SR_FONTS : 0)); + vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP | + (IsPrimaryCard ? VGA_SR_FONTS : 0)); if (pScrn->progClock) TridentSave(pScrn, tridentReg); @@ -2436,8 +2610,7 @@ case CYBERBLADEE4: case CYBER9397: case CYBER9397DVD: - case CYBERBLADEXPm8: - case CYBERBLADEXPm16: + case BLADEXP: case CYBERBLADEXPAI1: /* Get ready for MUX mode */ if (pTrident->MUX && @@ -2508,18 +2681,6 @@ return TRUE; } -#if 0 -Bool -TridentCyberBIOSModeInit(ScrnInfoPtr pScrn) -{ - int mode = TridentFindMode(pScrn->currentMode->HDisplay, - pScrn->currentMode->VDisplay, - pScrn->depth); - TridentUnstretch(); - -} -#endif - /* * Restore the initial (text) mode. */ @@ -2543,7 +2704,8 @@ else TVGARestore(pScrn, tridentReg); - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE|(IsPrimaryCard ? VGA_SR_FONTS : 0)); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP | + (IsPrimaryCard ? VGA_SR_FONTS : 0)); vgaHWProtect(pScrn, FALSE); } @@ -2582,10 +2744,18 @@ return FALSE; if (!xf86IsPc98()) { - if (xf86LoadSubModule(pScrn, "int10")) { - xf86LoaderReqSymLists(int10Symbols, NULL); - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); - pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); +#ifdef VBE_INFO + if (pTrident->vbeModes) { + pTrident->pVbe = VBEInit(NULL,pTrident->pEnt->index); + pTrident->Int10 = pTrident->pVbe->pInt10; + } else +#endif + { + if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); + pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); + } } } @@ -2598,7 +2768,6 @@ vgaHWSetMmioFuncs(hwp, pTrident->IOBase, 0); } - vgaHWGetIOBase(hwp); vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* Save the current state */ @@ -2642,7 +2811,10 @@ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) { - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); return FALSE; } @@ -2702,7 +2874,10 @@ break; } if (!ret) { - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); return FALSE; } if (pScrn->bitsPerPixel > 8) { @@ -2742,7 +2917,10 @@ /* Setup the vga banking variables */ pBankInfo = xnfcalloc(sizeof(miBankInfoRec),1); if (pBankInfo == NULL) { - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); return FALSE; } pBankInfo->pBankA = pTrident->FbBase; @@ -2760,7 +2938,10 @@ pScrn->displayWidth, pBankInfo)) { xfree(pBankInfo); pBankInfo = NULL; - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); return FALSE; } } @@ -2776,6 +2957,9 @@ (pTrident->Chipset == BLADE3D)) BladeAccelInit(pScreen); else + if (pTrident->Chipset >= BLADEXP) + XPAccelInit(pScreen); + else ImageAccelInit(pScreen); } else { TridentAccelInit(pScreen); @@ -2797,12 +2981,18 @@ /* Initialise default colourmap */ if (!miCreateDefColormap(pScreen)) { - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); return FALSE; } if(!xf86HandleColormaps(pScreen, 256, 6, TridentLoadPalette, TridentSetOverscan, CMAP_RELOAD_ON_MODE_SWITCH|CMAP_PALETTED_TRUECOLOR)) { - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); return FALSE; } if(pTrident->ShadowFB) { @@ -2995,7 +3185,10 @@ if(pTrident->BlockHandler) pScreen->BlockHandler = pTrident->BlockHandler; - xf86FreeInt10(pTrident->Int10); + if (pTrident->pVbe) + vbeFree(pTrident->pVbe); + else + xf86FreeInt10(pTrident->Int10); pScreen->CloseScreen = pTrident->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -3056,9 +3249,9 @@ static void TRIDENTEnableMMIO(ScrnInfoPtr pScrn) { - int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - CARD8 temp = 0; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + IOADDRESS vgaIOBase = pTrident->PIOBase + VGAHWPTR(pScrn)->IOBase; + CARD8 temp = 0, protect = 0; /* * Skip MMIO Enable in PC-9821 PCI Trident Card!! @@ -3068,17 +3261,29 @@ return; /* Goto New Mode */ - outb(0x3C4, 0x0B); inb(0x3C5); + outb(pTrident->PIOBase + 0x3C4, 0x0B); + inb(pTrident->PIOBase + 0x3C5); /* Unprotect registers */ - outb(0x3C4, NewMode1); temp = inb(0x3C5); - outb(0x3C5, 0x80); + if (pTrident->Chipset > PROVIDIA9685) { + outb(pTrident->PIOBase + 0x3C4, Protection); + protect = inb(pTrident->PIOBase + 0x3C5); + outb(pTrident->PIOBase + 0x3C5, 0x92); + } + outb(pTrident->PIOBase + 0x3C4, NewMode1); + temp = inb(pTrident->PIOBase + 0x3C5); + outb(pTrident->PIOBase + 0x3C5, 0x80); /* Enable MMIO */ - outb(vgaIOBase + 4, PCIReg); pTrident->REGPCIReg = inb(vgaIOBase + 5); + outb(vgaIOBase + 4, PCIReg); + pTrident->REGPCIReg = inb(vgaIOBase + 5); outb(vgaIOBase + 5, pTrident->REGPCIReg | 0x01); /* Enable it */ /* Protect registers */ + if (pTrident->Chipset > PROVIDIA9685) { + OUTB(0x3C4, Protection); + OUTB(0x3C5, protect); + } OUTB(0x3C4, NewMode1); OUTB(0x3C5, temp); } @@ -3087,7 +3292,7 @@ TRIDENTDisableMMIO(ScrnInfoPtr pScrn) { int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - CARD8 temp = 0; + CARD8 temp = 0, protect = 0; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); /* @@ -3103,6 +3308,11 @@ /* Unprotect registers */ OUTB(0x3C4, NewMode1); temp = INB(0x3C5); OUTB(0x3C5, 0x80); + if (pTrident->Chipset > PROVIDIA9685) { + OUTB(0x3C4, Protection); + protect = INB(0x3C5); + OUTB(0x3C5, 0x92); + } /* Disable MMIO access */ OUTB(vgaIOBase + 4, PCIReg); @@ -3110,9 +3320,14 @@ OUTB(vgaIOBase + 5, pTrident->REGPCIReg & 0xFE); /* Protect registers */ - outb(0x3C4, NewMode1); - outb(0x3C5, temp); + if (pTrident->Chipset > PROVIDIA9685) { + outb(pTrident->PIOBase + 0x3C4, Protection); + outb(pTrident->PIOBase + 0x3C5, protect); + } + outb(pTrident->PIOBase + 0x3C4, NewMode1); + outb(pTrident->PIOBase + 0x3C5, temp); } + /* Initialize VGA Block for Trident Chip on PC-98x1 */ static void PC98TRIDENTInit(ScrnInfoPtr pScrn) @@ -3366,13 +3581,37 @@ tridentSetModeBIOS(ScrnInfoPtr pScrn, DisplayModePtr mode) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - if (pTrident->IsCyber && pTrident->lcdMode) { + + +#ifdef VBE_INFO + if (pTrident->vbeModes) { + vbeSaveRestoreRec vbesr; + vbesr.stateMode = VBECalcVbeModeIndex(pTrident->vbeModes, + mode, pScrn->bitsPerPixel); + vbesr.pstate = NULL; + if (vbesr.stateMode) { + if (IsPciCard && UseMMIO) + TRIDENTDisableMMIO(pScrn); + VBEVesaSaveRestore(pTrident->pVbe,&vbesr,MODE_RESTORE); + if (IsPciCard && UseMMIO) + TRIDENTEnableMMIO(pScrn); + return; + } else + xf86DrvMsg(pScrn->scrnIndex,X_WARNING,"No BIOS Mode matches " + "%ix%I@%ibpp\n",mode->HDisplay,mode->VDisplay, + pScrn->bitsPerPixel); + } +#endif + /* This function is only for LCD screens, and also when we have + * int10 available */ + + if (pTrident->IsCyber && pTrident->lcdMode && pTrident->Int10) { int i = pTrident->lcdMode; if ((pScrn->currentMode->HDisplay != LCD[i].display_x) /* !fullsize? */ || (pScrn->currentMode->VDisplay != LCD[i].display_y)) { if (pTrident->lcdActive) { /* LCD Active ?*/ int h_str, v_str; - + OUTB(0x3CE,HorStretch); h_str = INB(0x3CF) & 0x01; OUTB(0x3CE,VertStretch); v_str = INB(0x3CF) & 0x01; if (h_str || v_str) { @@ -3381,12 +3620,13 @@ pTrident->Int10->ax = 0x3; pTrident->Int10->num = 0x10; if (IsPciCard && UseMMIO) - TRIDENTDisableMMIO(pScrn); + TRIDENTDisableMMIO(pScrn); xf86ExecX86int10(pTrident->Int10); if (IsPciCard && UseMMIO) - TRIDENTEnableMMIO(pScrn); + TRIDENTEnableMMIO(pScrn); } } } } } + Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.22 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.22 Fri Jan 11 08:06:30 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h Mon Sep 16 14:06:03 2002 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.22 2002/01/11 13:06:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.26 2002/09/16 18:06:03 eich Exp $ */ #define DEBUG 1 @@ -40,6 +40,7 @@ #define OldMode1 0x0E #define NewMode1 0x0E #define Protection 0x11 +#define Threshold 0x12 #define MCLKLow 0x16 #define MCLKHigh 0x17 #define ClockLow 0x18 @@ -47,6 +48,14 @@ #define SSetup 0x20 #define SKey 0x37 #define SPKey 0x57 +#define GBslope1 0xB4 +#define GBslope2 0xB5 +#define GBslope3 0xB6 +#define GBslope4 0xB7 +#define GBintercept1 0xB8 +#define GBintercept2 0xB9 +#define GBintercept3 0xBA +#define GBintercept4 0xBB /* 3x4 */ #define Offset 0x13 @@ -196,6 +205,7 @@ /* Defines for BLADE Graphics Engine */ #define BLADE_GE_STATUS 0x2120 +#define BLADE_XP_GER_OPERMODE 0x2125 #define REPLICATE(r) \ { \ @@ -222,6 +232,8 @@ /* Merge XY */ #define XY_MERGE(x,y) \ ((((CARD32)(y)&0xFFFF) << 16) | ((CARD32)(x) & 0xffff)) +#define XP_XY_MERGE(y,x) \ + ((((CARD32)(y)&0xFFFF) << 16) | ((CARD32)(x) & 0xffff)) #define TRIDENT_WRITE_REG(v,r) \ MMIO_OUT32(pTrident->IOBase,(r),(v)) @@ -234,7 +246,7 @@ if (IsPciCard && UseMMIO) { \ MMIO_OUT8(pTrident->IOBase, addr, data); \ } else { \ - outb(addr, data); \ + outb(pTrident->PIOBase + (addr), data); \ } \ } #define OUTW(addr, data) \ @@ -242,10 +254,15 @@ if (IsPciCard && UseMMIO) { \ MMIO_OUT16(pTrident->IOBase, addr, data); \ } else { \ - outw(addr, data); \ + outw(pTrident->PIOBase + (addr), data); \ } \ } -#define INB(addr) ((IsPciCard && UseMMIO) ? MMIO_IN8(pTrident->IOBase, addr) : inb(addr)) +#define INB(addr) \ +( \ + (IsPciCard && UseMMIO) ? \ + MMIO_IN8(pTrident->IOBase, addr) : \ + inb(pTrident->PIOBase + (addr)) \ +) #define OUTW_3C4(reg) \ OUTW(0x3C4, (tridentReg->tridentRegs3C4[reg])<<8 | (reg)) @@ -284,6 +301,8 @@ MMIO_OUT8(pTrident->IOBase, OLDGER_STATUS, (c)) #define TGUI_OPERMODE(c) \ MMIO_OUT16(pTrident->IOBase, GER_OPERMODE, (c)) +#define BLADE_XP_OPERMODE(c) \ + MMIO_OUT8(pTrident->IOBase, BLADE_XP_GER_OPERMODE, (c)) /* XXX */ #define OLDTGUI_OPERMODE(c) \ { \ @@ -317,14 +336,20 @@ MMIO_OUT8(pTrident->IOBase, OLDGER_BMIX, (c)) #define TGUI_DIM_XY(w,h) \ MMIO_OUT32(pTrident->IOBase, GER_DIM_XY, XY_MERGE((w)-1,(h)-1)) +#define XP_DIM_XY(w,h) \ + MMIO_OUT32(pTrident->IOBase, GER_DIM_XY, XY_MERGE((h),(w))) #define TGUI_STYLE(c) \ MMIO_OUT32(pTrident->IOBase, GER_STYLE, (c)) #define OLDTGUI_DIMXY(w,h) \ MMIO_OUT32(pTrident->IOBase, OLDGER_DIMXY, XY_MERGE((w)-1,(h)-1)) #define TGUI_SRC_XY(x,y) \ MMIO_OUT32(pTrident->IOBase, GER_SRC_XY, XY_MERGE(x,y)) +#define XP_SRC_XY(x,y) \ + MMIO_OUT32(pTrident->IOBase, GER_SRC_XY, XP_XY_MERGE(x,y)) #define TGUI_DEST_XY(x,y) \ MMIO_OUT32(pTrident->IOBase, GER_DEST_XY, XY_MERGE(x,y)) +#define XP_DEST_XY(x,y) \ + MMIO_OUT32(pTrident->IOBase, GER_DEST_XY, XP_XY_MERGE(x,y)) #define OLDTGUI_DESTXY(x,y) \ MMIO_OUT32(pTrident->IOBase, OLDGER_DESTXY, XY_MERGE(x,y)) #define OLDTGUI_DESTLINEAR(c) \ Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.31 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.21 Sat Jan 12 19:15:52 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c Sun Dec 22 13:54:43 2002 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.21 2002/01/13 00:15:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.31 2002/12/22 18:54:43 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -41,7 +41,7 @@ #include "dixstruct.h" #include "fourcc.h" -#define OFF_DELAY 200 /* milliseconds */ +#define OFF_DELAY 800 /* milliseconds */ #define FREE_DELAY 60000 #define OFF_TIMER 0x01 @@ -63,16 +63,15 @@ static int TRIDENTQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); static void TRIDENTVideoTimerCallback(ScrnInfoPtr pScrn, Time time); -static void tridentSetVideoGamma(TRIDENTPtr pTrident,int value,int brightness); static void tridentSetVideoContrast(TRIDENTPtr pTrident,int value); static void tridentSetVideoParameters(TRIDENTPtr pTrident, int brightness, int saturation, int hue); void tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame); +static void WaitForSync(ScrnInfoPtr pScrn); - #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static Atom xvColorKey, xvSaturation, xvBrightness, xvHUE, xvGamma, xvContrast; +static Atom xvColorKey, xvSaturation, xvBrightness, xvHUE, xvContrast; void TRIDENTInitVideo(ScreenPtr pScreen) { @@ -81,11 +80,12 @@ XF86VideoAdaptorPtr newAdaptor = NULL; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int num_adaptors; - + /* * The following has been tested on: * * 9525 : flags: None + * Cyber9397(DVD) : flags: VID_ZOOM_NOMINI * CyberBlade/i7: flags: VID_ZOOM_INV | VID_ZOOM_MINI * CyberBlade/i1: flags: VID_ZOOM_INV | VID_ZOOM_MINI * CyberBlade/Ai1: flags: VID_ZOOM_INV @@ -103,7 +103,12 @@ || pTrident->Chipset > CYBERBLADEAI1D) pTrident->videoFlags |= VID_OFF_SHIFT_4; } - + if (pTrident->Chipset == CYBER9397 || pTrident->Chipset == CYBER9397DVD) + pTrident->videoFlags = VID_ZOOM_NOMINI; + + if (pTrident->Chipset == CYBER9397DVD || pTrident->Chipset >= CYBER9525DVD) + pTrident->videoFlags |= VID_DOUBLE_LINEBUFFER_FOR_WIDE_SRC; + newAdaptor = TRIDENTSetupImageVideo(pScreen); TRIDENTInitOffscreenImages(pScreen); @@ -132,10 +137,13 @@ if(newAdaptors) xfree(newAdaptors); - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"XvFlags: %s %s %s\n", + if (pTrident->videoFlags) + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3, + "Trident Video Flags: %s %s %s\n", pTrident->videoFlags & VID_ZOOM_INV ? "VID_ZOOM_INV" : "", - pTrident->videoFlags & VID_ZOOM_MINI ? "VID_ZOOM_MINI" : "", - pTrident->videoFlags & VID_OFF_SHIFT_4 ? "VID_OFF_SHIFT_4" + pTrident->videoFlags & VID_ZOOM_MINI ? "VID_ZOOM_MINI" : "", pTrident->videoFlags & VID_OFF_SHIFT_4 ? "VID_OFF_SHIFT_4" + : "", + pTrident->videoFlags & VID_ZOOM_NOMINI ? "VID_ZOOM_NOMINI" : ""); } @@ -158,7 +166,11 @@ {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; +#ifdef TRIDENT_XV_GAMMA #define NUM_ATTRIBUTES 6 +#else +#define NUM_ATTRIBUTES 5 +#endif static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { @@ -166,15 +178,19 @@ {XvSettable | XvGettable, 0, 187, "XV_SATURATION"}, {XvSettable | XvGettable, 0, 0x3F, "XV_BRIGHTNESS"}, {XvSettable | XvGettable, 0, 360 , "XV_HUE"}, - {XvSettable | XvGettable, -128, 127, "XV_GAMMA"}, {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"} }; -#define NUM_IMAGES 4 +#if 0 +# define NUM_IMAGES 4 +#else +# define NUM_IMAGES 4 +#endif static XF86ImageRec Images[NUM_IMAGES] = { - { +#if 0 + { 0x35315652, XvRGB, LSBFirst, @@ -191,6 +207,7 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, XvTopToBottom }, +#endif { 0x36315652, XvRGB, @@ -200,7 +217,7 @@ 16, XvPacked, 1, - 16, 0x001F, 0x07E0, 0xF800, + 16, 0xF800, 0x07E0, 0x001F, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -219,7 +236,6 @@ CARD8 Saturation; CARD8 Brightness; CARD16 HUE; - INT8 Gamma; INT8 Contrast; CARD32 videoStatus; Time offTime; @@ -238,31 +254,30 @@ int vgaIOBase = VGAHWPTR(pScrn)->IOBase; int red, green, blue; int tmp; - - OUTW(vgaIOBase + 4, 0x008E); - OUTW(vgaIOBase + 4, 0x008F); - if (pTrident->Chipset >= CYBER9397) { + if (pTrident->Chipset >= CYBER9388) { OUTW(vgaIOBase + 4, 0x80B9); + OUTW(vgaIOBase + 4, 0x00BE); OUTW(0x3C4, 0xC057); - OUTW(0x3C4, 0x3421); + OUTW(0x3C4, 0x3420); OUTW(0x3C4, 0x3037); } else { if (pTrident->Chipset >= PROVIDIA9682) { OUTB(0x83C8, 0x57); OUTB(0x83C6, 0xC0); - OUTW(vgaIOBase + 4, 0x24BE); + OUTW(vgaIOBase + 4, 0x26BE); } else { OUTB(0x83C8, 0x37); OUTB(0x83C6, 0x01); + OUTB(0x83C8, 0x00); + OUTB(0x83C6, 0x00); } } - if (pTrident->Chipset >= CYBERBLADEXPm8) { + if (pTrident->Chipset >= BLADEXP) { OUTW(0x3C4, 0x007A); OUTW(0x3C4, 0x007D); } - switch (pScrn->depth) { case 8: VIDEOOUT(pPriv->colorKey, pTrident->keyOffset); @@ -304,11 +319,15 @@ VIDEOOUT(0xFF, (pTrident->keyOffset + 6)); break; } - } - tridentSetVideoGamma(pTrident,pPriv->Gamma,pPriv->Brightness); - tridentSetVideoContrast(pTrident,pPriv->Contrast); - tridentSetVideoParameters(pTrident,pPriv->Brightness,pPriv->Saturation, + } + + if (pTrident->Chipset >= CYBER9388) { + tridentSetVideoContrast(pTrident,pPriv->Contrast); + tridentSetVideoParameters(pTrident,pPriv->Brightness,pPriv->Saturation, pPriv->HUE); + } + + OUTW(vgaIOBase + 4, 0x848E); } @@ -338,7 +357,11 @@ adapt->pPortPrivates[0].ptr = (pointer)(pPriv); adapt->pAttributes = Attributes; adapt->nImages = NUM_IMAGES; - adapt->nAttributes = NUM_ATTRIBUTES; + if (pTrident->Chipset >= CYBER9388) { + adapt->nAttributes = NUM_ATTRIBUTES; + } else { + adapt->nAttributes = 1; /* Just colorkey */ + } adapt->pImages = Images; adapt->PutVideo = NULL; adapt->PutStill = NULL; @@ -355,7 +378,6 @@ pPriv->Brightness = 45; pPriv->Saturation = 80; pPriv->Contrast = 4; - pPriv->Gamma = 0; pPriv->HUE = 0; pPriv->videoStatus = 0; pPriv->fixFrame = 100; @@ -367,11 +389,10 @@ xvColorKey = MAKE_ATOM("XV_COLORKEY"); - if (pTrident->Chipset >= CYBER9397) { + if (pTrident->Chipset >= CYBER9388) { xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); xvSaturation = MAKE_ATOM("XV_SATURATION"); xvHUE = MAKE_ATOM("XV_HUE"); - xvGamma = MAKE_ATOM("XV_GAMMA"); xvContrast = MAKE_ATOM("XV_CONTRAST"); } @@ -428,8 +449,9 @@ if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - OUTW(vgaIOBase + 4, 0x008E); - OUTW(vgaIOBase + 4, 0x008F); + OUTW(vgaIOBase + 4, 0x0091); + WaitForSync(pScrn); + OUTW(vgaIOBase + 4, 0x848E); } if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); @@ -454,59 +476,6 @@ OUTW(0x3C4, (((value & 0x7)|((value & 0x7) << 4)) << 8) | 0xBC); } -static void -tridentSetVideoGamma(TRIDENTPtr pTrident,int value,int brightness) -{ - int pivots[] = {0,3,15,63,255}; - - int slope; - int y_0; - float x, x_prev = 0, y, y_prev = 0; - int i; - int exp; - CARD8 i_slopes[4]; - CARD8 intercepts[4]; - - brightness = (brightness - 0x20); - if (value == 0) { - OUTW(0x3C4, 0x80 << 8 | 0xB4); - OUTW(0x3C4, (brightness) << 8 | 0xB8); - OUTW(0x3C4, (brightness) << 8 | 0xB9); - OUTW(0x3C4, (brightness) << 8 | 0xBA); - OUTW(0x3C4, (brightness) << 8 | 0xBB); - return; - } - exp = log(value); - for (i = 0; i < 4; i++) { - x = pivots[i-1] / 255.0; - y = pow(x,exp); - slope = (y - y_prev) / (x - x_prev); - y_0 = y - x * slope; - { - int val = slope; - if (val > 7) - i_slopes[i] = (3 << 4) | (val & 0xf); - else if (val > 3) - i_slopes[i] = (2 << 4) | ((int)(slope / 2) & 0xf); - else if (val > 2) - i_slopes[i] = (1 << 4) | ((int)(slope / 4) & 0xf); - else - i_slopes[i] = ((int)(slope / 8) & 0xf); - } - intercepts[i] = y_0 * 256 / 4; - x_prev = x; - y_prev = y; - } - OUTW(0x3C4, i_slopes[0] << 8 | 0xB4); - OUTW(0x3C4, i_slopes[1] << 8 | 0xB5); - OUTW(0x3C4, i_slopes[2] << 8 | 0xB6); - OUTW(0x3C4, i_slopes[3] << 8 | 0xB7); - OUTW(0x3C4, (intercepts[0] + brightness) << 8 | 0xB8); - OUTW(0x3C4, (intercepts[1] + brightness) << 8 | 0xB9); - OUTW(0x3C4, (intercepts[2] + brightness) << 8 | 0xBA); - OUTW(0x3C4, (intercepts[3] + brightness) << 8 | 0xBB); -} - static void tridentSetVideoParameters(TRIDENTPtr pTrident, int brightness, int saturation, int hue) @@ -595,18 +564,12 @@ pPriv->HUE = value; tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, pPriv->HUE); - tridentSetVideoGamma(pTrident,pPriv->Gamma,pPriv->Brightness); - } else if (attribute == xvGamma) { - if ((value < -128) || (value > 127)) - return BadValue; - pPriv->Gamma = value; - tridentSetVideoGamma(pTrident,value,pPriv->Brightness); } else if (attribute == xvContrast) { - if ((value < 0) || (value > 127)) + if ((value < 0) || (value > 7)) return BadValue; pPriv->Contrast = value; tridentSetVideoContrast(pTrident,value); - } else + } else return BadMatch; return Success; @@ -629,8 +592,6 @@ *value = pPriv->Saturation; } else if (attribute == xvHUE) { *value = pPriv->HUE; - } else if (attribute == xvGamma) { - *value = pPriv->Gamma; } else if (attribute == xvContrast) { *value = pPriv->Contrast; } else @@ -762,12 +723,13 @@ int zoomx1, zoomx2, zoomy1, zoomy2; int tx1,tx2; int ty1,ty2; - + switch(id) { case 0x35315652: /* RGB15 */ case 0x36315652: /* RGB16 */ - if (pTrident->Chipset >= CYBER9397) { + if (pTrident->Chipset >= CYBER9388) { OUTW(vgaIOBase + 4, 0x22BF); + OUTW(vgaIOBase + 4, 0x248F); } else { OUTW(vgaIOBase + 4, 0x118F); } @@ -775,8 +737,9 @@ case FOURCC_YV12: /* YV12 */ case FOURCC_YUY2: /* YUY2 */ default: - if (pTrident->Chipset >= CYBER9397) { + if (pTrident->Chipset >= CYBER9388) { OUTW(vgaIOBase + 4, 0x00BF); + OUTW(vgaIOBase + 4, 0x208F); } else { OUTW(vgaIOBase + 4, 0x108F); } @@ -807,93 +770,95 @@ OUTW(vgaIOBase + 4, ((width<<1) & 0xff00) | 0x91); OUTW(vgaIOBase + 4, ((offset) & 0xff) << 8 | 0x92); OUTW(vgaIOBase + 4, ((offset) & 0xff00) | 0x93); - OUTW(vgaIOBase + 4, ((offset) & 0xff0000) >> 8 | 0x94); - + OUTW(vgaIOBase + 4, ((offset) & 0x070000) >> 8 | 0x94); + /* Horizontal Zoom */ if (pTrident->videoFlags & VID_ZOOM_INV) { if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_w > drw_w) - zoomx2 = (int)((float)drw_w/(float)src_w * 1024) - | (((int)((float)src_w/(float)drw_w) - 1)&7)<<10 | 0x8000; + zoomx2 = (int)((float)drw_w/(float)src_w * 1024) + | (((int)((float)src_w/(float)drw_w) - 1)&7)<<10 | 0x8000; else - zoomx2 = (int)(float)src_w/(float)drw_w * 1024; - + zoomx2 = (int)(float)src_w/(float)drw_w * 1024; + OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); OUTW(vgaIOBase + 4, (zoomx2&0x9f00) | 0x81); - } else { - if (drw_w == src_w) { - OUTW(vgaIOBase + 4, 0x0080); - OUTW(vgaIOBase + 4, 0x0081); - } else - if (drw_w > src_w) { - float z; - - z = (float)drw_w/(float)src_w - 1; - zoomx1 = z; - zoomx2 = (z - (int)zoomx1 ) * 1024; + } else { + if (drw_w == src_w + || ((pTrident->videoFlags & VID_ZOOM_NOMINI) && (src_w > drw_w))) { + OUTW(vgaIOBase + 4, 0x0080); + OUTW(vgaIOBase + 4, 0x0081); + } else + if (drw_w > src_w) { + float z; + + z = (float)((drw_w)/(float)src_w) - 1.0; - OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); + zoomx1 = z; + zoomx2 = (z - (int)zoomx1 ) * 1024; + + OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); OUTW(vgaIOBase + 4, (zoomx1&0x0f)<<10 | (zoomx2&0x0300) |0x81); - } else { - zoomx1 = ((float)drw_w/(float)src_w); - zoomx2 = ( ((float)drw_w/(float)src_w) - (int)zoomx1 ) * 1024; - OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); - OUTW(vgaIOBase + 4, (zoomx2&0x0300)| - (((int)((float)src_w/(float)drw_w)-1)&7)<<10 | 0x8081); - } + } else { + zoomx1 = ((float)drw_w/(float)src_w); + zoomx2 = ( ((float)drw_w/(float)src_w) - (int)zoomx1 ) * 1024; + OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); + OUTW(vgaIOBase + 4, (zoomx2&0x0300)| + (((int)((float)src_w/(float)drw_w)-1)&7)<<10 | 0x8081); + } } - + /* Vertical Zoom */ if (pTrident->videoFlags & VID_ZOOM_INV) { - if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_h > drw_h) - zoomy2 = (int)(( ((float)drw_h/(float)src_h)) * 1024) - | (((int)((float)src_h/(float)drw_h)-1)&7)<<10 - | 0x8000; - else - zoomy2 = ( ((float)src_h/(float)drw_h)) * 1024; + if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_h > drw_h) + zoomy2 = (int)(( ((float)drw_h/(float)src_h)) * 1024) + | (((int)((float)src_h/(float)drw_h)-1)&7)<<10 + | 0x8000; + else + zoomy2 = ( ((float)src_h/(float)drw_h)) * 1024; OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); OUTW(vgaIOBase + 4, (zoomy2&0x9f00) | 0x0083); } else { - if (drw_h == src_h) { - OUTW(vgaIOBase + 4, 0x0082); - OUTW(vgaIOBase + 4, 0x0083); - } else - if (drw_h > src_h) { - float z; - - z = (float)drw_h/(float)src_h - 1; - zoomy1 = z; - zoomy2 = (z - (int)zoomy1 ) * 1024; - - OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); + if (drw_h == src_h + || ((pTrident->videoFlags & VID_ZOOM_NOMINI) && (src_h > drw_h))) { + OUTW(vgaIOBase + 4, 0x0082); + OUTW(vgaIOBase + 4, 0x0083); + } else + if (drw_h > src_h) { + float z; + + z = (float)drw_h/(float)src_h - 1; + zoomy1 = z; + zoomy2 = (z - (int)zoomy1 ) * 1024; + + OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); OUTW(vgaIOBase + 4, (zoomy1&0x0f)<<10 | (zoomy2&0x0300) |0x83); - } else { - zoomy1 = ((float)drw_h/(float)src_h); - zoomy2 = ( ((float)drw_h/(float)src_h) - (int)zoomy1 ) * 1024; - OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); - OUTW(vgaIOBase + 4, (zoomy2&0x0300)| - (((int)((float)src_h/(float)drw_h)-1)&7)<<10 | 0x8083); - } + } else { + zoomy1 = ((float)drw_h/(float)src_h); + zoomy2 = ( ((float)drw_h/(float)src_h) - (int)zoomy1 ) * 1024; + OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); + OUTW(vgaIOBase + 4, (zoomy2&0x0300)| + (((int)((float)src_h/(float)drw_h)-1)&7)<<10 | 0x8083); + } } - if (pTrident->Chipset >= CYBER9397) { + if (pTrident->Chipset >= CYBER9388) { int lb = (width+2) >> 2; OUTW(vgaIOBase + 4, ((lb & 0x100)>>1) | 0x0895); OUTW(vgaIOBase + 4, (lb & 0xFF)<<8 | 0x0096); - - if (src_w > 384) { + if ((pTrident->videoFlags & VID_DOUBLE_LINEBUFFER_FOR_WIDE_SRC) + && (src_w > 384)) { OUTW(0x3C4, 0x0497); /* 2x line buffers */ } else { OUTW(0x3C4, 0x0097); /* 1x line buffers */ } - OUTW(vgaIOBase + 4, 0x0097); + OUTW(vgaIOBase + 4, 0x8097); OUTW(vgaIOBase + 4, 0x00BA); OUTW(vgaIOBase + 4, 0x00BB); OUTW(vgaIOBase + 4, 0xFFBC); OUTW(vgaIOBase + 4, 0xFFBD); OUTW(vgaIOBase + 4, 0x04BE); - OUTW(vgaIOBase + 4, 0xD48E); - OUTW(vgaIOBase + 4, 0x208F); + OUTW(vgaIOBase + 4, 0x948E); } else { OUTW(vgaIOBase + 4, ((((id == FOURCC_YV12) || (id == FOURCC_YUY2)) @@ -901,7 +866,7 @@ OUTW(vgaIOBase + 4, ((((id == FOURCC_YV12) || (id == FOURCC_YUY2)) ? ((width+2) >> 2) : ((width+2) >> 6)) << 8) |0x96); - OUTW(vgaIOBase + 4, 0x938E); + OUTW(vgaIOBase + 4, 0x948E); OUTB(0x83C8, 0x00); OUTB(0x83C6, 0x95); } @@ -1136,8 +1101,10 @@ if(pPriv->isOn) { TRIDENTPtr pTrident = TRIDENTPTR(surface->pScrn); int vgaIOBase = VGAHWPTR(surface->pScrn)->IOBase; - OUTW(vgaIOBase + 4, 0x008E); - OUTW(vgaIOBase + 4, 0x008F); + + OUTW(vgaIOBase + 4, 0x0091); + WaitForSync(surface->pScrn); + OUTW(vgaIOBase + 4, 0x848E); pPriv->isOn = FALSE; } @@ -1243,6 +1210,8 @@ static void TRIDENTInitOffscreenImages(ScreenPtr pScreen) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); XF86OffscreenImagePtr offscreenImages; /* need to free this someplace */ @@ -1260,7 +1229,11 @@ offscreenImages[0].getAttribute = TRIDENTGetSurfaceAttribute; offscreenImages[0].max_width = 1024; offscreenImages[0].max_height = 1024; - offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + if (pTrident->Chipset >= CYBER9388) { + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + } else { + offscreenImages[0].num_attributes = 1; /* just colorkey */ + } offscreenImages[0].attributes = Attributes; xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); @@ -1276,8 +1249,9 @@ if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { if(pPriv->offTime < time) { - OUTW(vgaIOBase + 4, 0x008E); - OUTW(vgaIOBase + 4, 0x008F); + OUTW(vgaIOBase + 4, 0x0091); + WaitForSync(pScrn); + OUTW(vgaIOBase + 4, 0x848E); pPriv->videoStatus = FREE_TIMER; pPriv->freeTime = time + FREE_DELAY; } @@ -1302,115 +1276,133 @@ tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame) { - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - int HTotal, HSyncStart; - int VTotal, VSyncStart; - int h_off = 0; - int v_off = 0; - unsigned char CRTC[0x11]; - Bool isShadow; - unsigned char shadow = 0; + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int vgaIOBase = VGAHWPTR(pScrn)->IOBase; + int HTotal, HSyncStart; + int VTotal, VSyncStart; + int h_off = 0; + int v_off = 0; + unsigned char CRTC[0x11]; + Bool isShadow; + unsigned char shadow = 0; - if ((*fixFrame)++ < 100) - return; + if ((*fixFrame)++ < 100) + return; *fixFrame = 0; - isShadow = (pTrident->ModeReg.tridentRegs3CE[CyberControl] & 0x81) == 0x81; + + OUTB(0x3CE, CyberControl); + isShadow = ((INB(0x3CF) & 0x81) == 0x81); if (isShadow) - SHADOW_ENABLE(shadow); + SHADOW_ENABLE(shadow); - OUTB(vgaIOBase + 4, 0x0); - CRTC[0x0] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4, 0x4); - CRTC[0x4] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4, 0x5); - CRTC[0x5] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4, 0x6); - CRTC[0x6] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4, 0x7); - CRTC[0x7] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4, 0x10); - CRTC[0x10] = INB(vgaIOBase + 5); - - HTotal = CRTC[0] << 3; - VTotal = CRTC[6] - | ((CRTC[7] & (1<<0)) << 8) - | ((CRTC[7] & (1<<5)) << 4); - HSyncStart = (CRTC[4] - + ((CRTC[5] >> 5) & 0x3)) << 3; - VSyncStart = CRTC[0x10] - | ((CRTC[7] & (1<<2)) << 6) - | ((CRTC[7] & (1<<7)) << 2); - - if (isShadow) { - SHADOW_RESTORE(shadow); - if (pTrident->lcdMode != 0xff) { - h_off = (LCD[pTrident->lcdMode].display_x - - pScrn->currentMode->HDisplay) >> 1; - v_off = (LCD[pTrident->lcdMode].display_y - - pScrn->currentMode->VDisplay) >> 1; - } - } + OUTB(vgaIOBase + 4, 0x0); + CRTC[0x0] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x4); + CRTC[0x4] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x5); + CRTC[0x5] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x6); + CRTC[0x6] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x7); + CRTC[0x7] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x10); + CRTC[0x10] = INB(vgaIOBase + 5); + + HTotal = CRTC[0] << 3; + VTotal = CRTC[6] + | ((CRTC[7] & (1<<0)) << 8) + | ((CRTC[7] & (1<<5)) << 4); + HSyncStart = (CRTC[4] + + ((CRTC[5] >> 5) & 0x3)) << 3; + VSyncStart = CRTC[0x10] + | ((CRTC[7] & (1<<2)) << 6) + | ((CRTC[7] & (1<<7)) << 2); + + if (isShadow) { + SHADOW_RESTORE(shadow); + if (pTrident->lcdMode != 0xff) { + h_off = (LCD[pTrident->lcdMode].display_x + - pScrn->currentMode->HDisplay) >> 1; + v_off = (LCD[pTrident->lcdMode].display_y + - pScrn->currentMode->VDisplay) >> 1; + } + } - pTrident->hsync = (HTotal - HSyncStart) + 23 + h_off; - pTrident->vsync = (VTotal - VSyncStart) - 2 + v_off; + pTrident->hsync = (HTotal - HSyncStart) + 23 + h_off; + pTrident->vsync = (VTotal - VSyncStart) - 2 + v_off; + pTrident->hsync_rskew = 0; + pTrident->vsync_bskew = 0; - /* - * HACK !! As awful as this is, it appears to be the only way....Sigh! - * We have XvHsync and XvVsync as options now, which adjust - * at the very end of this function. It'll be helpful for now - * and we can get more data on some of these skew values. - */ - switch (pTrident->Chipset) { - case TGUI9680: - /* Furthur tweaking needed */ -#if 0 - pTrident->hsync -= (mode->CrtcHTotal / 16); -#endif - pTrident->vsync += 2; - break; - case PROVIDIA9682: - /* Furthur tweaking needed */ - pTrident->hsync += 7; - break; - case PROVIDIA9685: - /* Spot on */ - break; - case CYBERBLADEXPm8: - case CYBERBLADEXPm16: - case CYBERBLADEXPAI1: - pTrident->hsync -= 15; - pTrident->hsync_rskew = 3; - break; - case BLADE3D: - if (pScrn->depth == 24) - pTrident->hsync -= 8; - else - pTrident->hsync -= 6; - break; - case CYBERBLADEI7: - case CYBERBLADEI7D: - case CYBERBLADEI1: - case CYBERBLADEI1D: - pTrident->hsync -= 8; - break; - case CYBERBLADEAI1: - pTrident->hsync -= 7; - break; - case CYBERBLADEAI1D: - pTrident->vsync += 2; - pTrident->vsync_bskew = -4; - pTrident->hsync -= 5; - break; - case CYBERBLADEE4: - pTrident->hsync -= 8; - break; - } - pTrident->hsync+=pTrident->OverrideHsync; - pTrident->vsync+=pTrident->OverrideVsync; - pTrident->hsync_rskew+=pTrident->OverrideRskew; - pTrident->vsync_bskew+=pTrident->OverrideBskew; + /* + * HACK !! As awful as this is, it appears to be the only way....Sigh! + * We have XvHsync and XvVsync as options now, which adjust + * at the very end of this function. It'll be helpful for now + * and we can get more data on some of these skew values. + */ + switch (pTrident->Chipset) { + case TGUI9680: + /* Furthur tweaking needed */ + pTrident->hsync -= 84; + pTrident->vsync += 2; + break; + case PROVIDIA9682: + /* Furthur tweaking needed */ + pTrident->hsync += 7; + break; + case PROVIDIA9685: + /* Spot on */ + break; + case BLADEXP: + case CYBERBLADEXPAI1: + pTrident->hsync -= 15; + pTrident->hsync_rskew = 3; + break; + case BLADE3D: + if (pScrn->depth == 24) + pTrident->hsync -= 8; + else + pTrident->hsync -= 6; + break; + case CYBERBLADEI7: + case CYBERBLADEI7D: + case CYBERBLADEI1: + case CYBERBLADEI1D: + pTrident->hsync -= 8; + break; + case CYBERBLADEAI1: + pTrident->hsync -= 7; + break; + case CYBERBLADEAI1D: + pTrident->vsync += 2; + pTrident->vsync_bskew = -4; + pTrident->hsync -= 5; + break; + case CYBERBLADEE4: + pTrident->hsync -= 8; + break; + case CYBER9397: + pTrident->hsync -= 1; + pTrident->vsync -= 0; + pTrident->vsync_bskew = 0; + break; + case CYBER9397DVD: + pTrident->hsync_rskew = -1; + pTrident->vsync_bskew = -1; + break; + } + pTrident->hsync+=pTrident->OverrideHsync; + pTrident->vsync+=pTrident->OverrideVsync; + pTrident->hsync_rskew += pTrident->OverrideRskew; + pTrident->vsync_bskew += pTrident->OverrideBskew; } +static void +WaitForSync(ScrnInfoPtr pScrn) +{ + register vgaHWPtr hwp = VGAHWPTR(pScrn); + + while (!(hwp->readST01(hwp)&0x8)) {}; + while (hwp->readST01(hwp)&0x8) {}; +} Index: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c:1.5 Wed Sep 12 09:50:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c Fri Mar 29 13:33:29 2002 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c,v 1.5 2001/09/12 13:50:12 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c,v 1.6 2002/03/29 18:33:29 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -43,7 +43,6 @@ int vgaIOBase; int offset = 0; int clock = mode->Clock; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; OUTB(0x3C4, 0x0B); INB(0x3C5); /* Ensure we are in New Mode */ @@ -140,7 +139,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp; int vgaIOBase; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* Goto Old Mode */ @@ -188,7 +186,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp; int vgaIOBase; - vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; temp = INB(0x3C8); Index: xc/programs/Xserver/hw/xfree86/drivers/trident/xp_accel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/trident/xp_accel.c:1.4 --- /dev/null Thu Feb 27 12:31:46 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/xp_accel.c Wed Oct 9 12:38:20 2002 @@ -0,0 +1,601 @@ +/* + * Copyright 1992-2002 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> + * + * BladeXP accelerated options. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/xp_accel.c,v 1.4 2002/10/09 16:38:20 tsi Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "xf86PciInfo.h" +#include "xf86Pci.h" + +#include "miline.h" + +#include "trident.h" +#include "trident_regs.h" + +#include "xaalocal.h" +#include "xaarop.h" + +static void XPSync(ScrnInfoPtr pScrn); +#if 0 +static void XPSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, + int rop, unsigned int planemask, int length, + unsigned char *pattern); +static void XPSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, + int x, int y, int dmaj, int dmin, int e, + int len, int octant, int phase); +static void XPSetupForSolidLine(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask); +static void XPSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, + int x, int y, int dmaj, int dmin, int e, + int len, int octant); +#endif +static void XPSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, + int len, int dir); +static void XPSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask); +static void XPSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, + int y, int w, int h); +static void XPSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int x1, int y1, int x2, + int y2, int w, int h); +static void XPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, + int transparency_color); +static void XPSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, + int patternx, int patterny, int fg, int bg, + int rop, unsigned int planemask); +static void XPSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, + int patternx, int patterny, int x, int y, + int w, int h); +#if 0 +static void XPSetupForScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask); +static void XPSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, + int y, int w, int h, int skipleft); +static void XPSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#endif + +static void +XPInitializeAccelerator(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int shift; + + /* This forces updating the clipper */ + pTrident->Clipping = TRUE; + + CHECKCLIPPING; + + BLADE_XP_OPERMODE(pTrident->EngineOperation); + pTrident->EngineOperation |= 0x40; + switch (pScrn->bitsPerPixel) { + case 8: + default: /* Muffle compiler */ + shift = 18; + break; + case 16: + shift = 19; + break; + case 32: + shift = 20; + break; + } + MMIO_OUT32(pTrident->IOBase, 0x2154, (pScrn->displayWidth) << shift); + MMIO_OUT32(pTrident->IOBase, 0x2150, (pScrn->displayWidth) << shift); + MMIO_OUT8(pTrident->IOBase, 0x2126, 3); +} + +Bool +XPAccelInit(ScreenPtr pScreen) +{ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + BoxRec AvailFBArea; + + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * + pScrn->bitsPerPixel / 8); + + if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + + xf86InitFBManager(pScreen, &AvailFBArea); + + if (pTrident->NoAccel) + return FALSE; + + pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); + if (!infoPtr) return FALSE; + + infoPtr->Flags = PIXMAP_CACHE | + OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER; + + pTrident->InitializeAccelerator = XPInitializeAccelerator; + XPInitializeAccelerator(pScrn); + + infoPtr->Sync = XPSync; + +#if 0 /* TO DO for the XP */ + infoPtr->SolidLineFlags = NO_PLANEMASK; + infoPtr->SetupForSolidLine = XPSetupForSolidLine; + infoPtr->SolidBresenhamLineErrorTermBits = 12; + infoPtr->SubsequentSolidBresenhamLine = XPSubsequentSolidBresenhamLine; + + infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED | + NO_PLANEMASK | + LINE_PATTERN_POWER_OF_2_ONLY; + infoPtr->SetupForDashedLine = XPSetupForDashedLine; + infoPtr->DashedBresenhamLineErrorTermBits = 12; + infoPtr->SubsequentDashedBresenhamLine = + XPSubsequentDashedBresenhamLine; + infoPtr->DashPatternMaxLength = 16; +#endif + + infoPtr->SolidFillFlags = NO_PLANEMASK; + infoPtr->SetupForSolidFill = XPSetupForFillRectSolid; + infoPtr->SubsequentSolidFillRect = XPSubsequentFillRectSolid; + infoPtr->SubsequentSolidHorVertLine = XPSubsequentSolidHorVertLine; + + infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; + + infoPtr->SetupForScreenToScreenCopy = + XPSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = + XPSubsequentScreenToScreenCopy; + + infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | + HARDWARE_PATTERN_PROGRAMMED_BITS | + BIT_ORDER_IN_BYTE_MSBFIRST; + + infoPtr->SetupForMono8x8PatternFill = + XPSetupForMono8x8PatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = + XPSubsequentMono8x8PatternFillRect; + +#if 0 /* Needs fixing */ + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST; + + pTrident->XAAScanlineColorExpandBuffers[0] = + xnfalloc(((pScrn->virtualX + 63)) *4* (pScrn->bitsPerPixel / 8)); + + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->ScanlineColorExpandBuffers = + pTrident->XAAScanlineColorExpandBuffers; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + XPSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + XPSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + XPSubsequentColorExpandScanline; +#endif + + return(XAAInit(pScreen, infoPtr)); +} + +static void +XPSync(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int count = 0, timeout = 0; + int busy; + + BLADE_XP_OPERMODE(pTrident->EngineOperation); + + for (;;) { + BLTBUSY(busy); + if (busy != GE_BUSY) { + return; + } + count++; + if (count == 10000000) { + ErrorF("XP: BitBLT engine time-out.\n"); + count = 9990000; + timeout++; + if (timeout == 8) { + /* Reset BitBLT Engine */ + TGUI_STATUS(0x00); + return; + } + } + } +} + +static void +XPClearSync(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int count = 0, timeout = 0; + int busy; + + for (;;) { + BLTBUSY(busy); + if (busy != GE_BUSY) { + return; + } + count++; + if (count == 10000000) { + ErrorF("XP: BitBLT engine time-out.\n"); + count = 9990000; + timeout++; + if (timeout == 8) { + /* Reset BitBLT Engine */ + TGUI_STATUS(0x00); + return; + } + } + } +} + +static void +XPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, int transparency_color) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int dst = 0; + + pTrident->BltScanDirection = 0; + if (xdir < 0) pTrident->BltScanDirection |= XNEG; + if (ydir < 0) pTrident->BltScanDirection |= YNEG; + + REPLICATE(transparency_color); + if (transparency_color != -1) { + dst |= 3<<16; + MMIO_OUT32(pTrident->IOBase, 0x2134, transparency_color); + } + + TGUI_DRAWFLAG(pTrident->BltScanDirection | SCR2SCR | dst); + TGUI_FMIX(XAACopyROP[rop]); +} + +static void +XPSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, + int x2, int y2, int w, int h) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + if (pTrident->BltScanDirection & YNEG) { + y1 = y1 + h - 1; + y2 = y2 + h - 1; + } + if (pTrident->BltScanDirection & XNEG) { + x1 = x1 + w - 1; + x2 = x2 + w - 1; + } + XP_SRC_XY(x1,y1); + XP_DEST_XY(x2,y2); + XP_DIM_XY(w,h); + TGUI_COMMAND(GE_BLT); + XPClearSync(pScrn); +} + +#if 0 +static void +XPSetupForSolidLine(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + pTrident->BltScanDirection = 0; + REPLICATE(color); + TGUI_FMIX(XAAPatternROP[rop]); + if (pTrident->Chipset >= PROVIDIA9685) { + TGUI_FPATCOL(color); + } else { + TGUI_FCOLOUR(color); + } +} + +static void +XPSubsequentSolidBresenhamLine( ScrnInfoPtr pScrn, + int x, int y, int dmaj, int dmin, int e, int len, int octant) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int tmp = pTrident->BltScanDirection; + + if (octant & YMAJOR) tmp |= YMAJ; + if (octant & XDECREASING) tmp |= XNEG; + if (octant & YDECREASING) tmp |= YNEG; + TGUI_DRAWFLAG(SOLIDFILL | STENCIL | tmp); + XP_SRC_XY(dmin-dmaj,dmin); + XP_DEST_XY(x,y); + XP_DIM_XY(dmin+e,len); + TGUI_COMMAND(GE_BRESLINE); + XPSync(pScrn); +} +#endif + +static void +XPSubsequentSolidHorVertLine( + ScrnInfoPtr pScrn, + int x, int y, + int len, int dir +){ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + TGUI_DRAWFLAG(SOLIDFILL); + if (dir == DEGREES_0) { + XP_DIM_XY(len,1); + XP_DEST_XY(x,y); + } else { + XP_DIM_XY(1,len); + XP_DEST_XY(x,y); + } + TGUI_COMMAND(GE_BLT); + XPSync(pScrn); +} + +#if 0 +void +XPSetupForDashedLine( + ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask, + int length, + unsigned char *pattern +){ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + CARD32 *DashPattern = (CARD32*)pattern; + CARD32 NiceDashPattern = DashPattern[0]; + + NiceDashPattern = *((CARD16 *)pattern) & ((1<<length) - 1); + switch(length) { + case 2: NiceDashPattern |= NiceDashPattern << 2; + case 4: NiceDashPattern |= NiceDashPattern << 4; + case 8: NiceDashPattern |= NiceDashPattern << 8; + } + pTrident->BltScanDirection = 0; + REPLICATE(fg); + if (pTrident->Chipset >= PROVIDIA9685) { + TGUI_FPATCOL(fg); + if (bg == -1) { + pTrident->BltScanDirection |= 1<<12; + TGUI_BPATCOL(~fg); + } else { + REPLICATE(bg); + TGUI_BPATCOL(bg); + } + } else { + TGUI_FCOLOUR(fg); + if (bg == -1) { + pTrident->BltScanDirection |= 1<<12; + TGUI_BCOLOUR(~fg); + } else { + REPLICATE(bg); + TGUI_BCOLOUR(bg); + } + } + TGUI_FMIX(XAAPatternROP[rop]); + pTrident->LinePattern = NiceDashPattern; +} + +void +XPSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, + int x, int y, int dmaj, int dmin, int e, int len, int octant, int phase) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int tmp = pTrident->BltScanDirection; + + if (octant & YMAJOR) tmp |= YMAJ; + if (octant & XDECREASING) tmp |= XNEG; + if (octant & YDECREASING) tmp |= YNEG; + + TGUI_STYLE(((pTrident->LinePattern >> phase) | + (pTrident->LinePattern << (16-phase))) & 0x0000FFFF); + TGUI_DRAWFLAG(STENCIL | tmp); + XP_SRC_XY(dmin-dmaj,dmin); + XP_DEST_XY(x,y); + XP_DIM_XY(e+dmin,len); + TGUI_COMMAND(GE_BRESLINE); + XPSync(pScrn); +} +#endif + +static void +XPSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + REPLICATE(color); + TGUI_FMIX(XAAPatternROP[rop]); + MMIO_OUT32(pTrident->IOBase, 0x2158, color); + TGUI_DRAWFLAG(SOLIDFILL); +} + +static void +XPSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + XP_DIM_XY(w,h); + XP_DEST_XY(x,y); + TGUI_COMMAND(GE_BLT); + XPSync(pScrn); +} + +#if 0 +static void MoveDWORDS( + register CARD32* dest, + register CARD32* src, + register int dwords ) +{ + while(dwords & ~0x03) { + *dest = *src; + *(dest + 1) = *(src + 1); + *(dest + 2) = *(src + 2); + *(dest + 3) = *(src + 3); + src += 4; + dest += 4; + dwords -= 4; + } + if (!dwords) return; + *dest = *src; + dest += 1; + src += 1; + if (dwords == 1) return; + *dest = *src; + dest += 1; + src += 1; + if (dwords == 2) return; + *dest = *src; + dest += 1; + src += 1; +} +#endif + +#if 0 +static void MoveDWORDS_FixedBase( + register CARD32* dest, + register CARD32* src, + register int dwords ) +{ + while(dwords & ~0x03) { + *dest = *src; + *dest = *(src + 1); + *dest = *(src + 2); + *dest = *(src + 3); + dwords -= 4; + src += 4; + } + + if(!dwords) return; + *dest = *src; + if(dwords == 1) return; + *dest = *(src + 1); + if(dwords == 2) return; + *dest = *(src + 2); +} +#endif + + +static void +XPSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, + int patternx, int patterny, + int fg, int bg, int rop, + unsigned int planemask) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int drawflag = 0; + + REPLICATE(fg); + MMIO_OUT32(pTrident->IOBase, 0x2158, fg); + + if (bg == -1) { + drawflag |= 1<<12; + MMIO_OUT32(pTrident->IOBase, 0x215C, ~fg); + } else { + REPLICATE(bg); + MMIO_OUT32(pTrident->IOBase, 0x215C, bg); + } + + drawflag |= 7<<18; + TGUI_DRAWFLAG(PATMONO | drawflag); + MMIO_OUT32(pTrident->IOBase, 0x2180, patternx); + MMIO_OUT32(pTrident->IOBase, 0x2184, patterny); + TGUI_FMIX(XAAPatternROP[rop]); +} + +static void +XPSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, + int patternx, int patterny, + int x, int y, + int w, int h) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + XP_DEST_XY(x,y); + XP_DIM_XY(w,h); + TGUI_COMMAND(GE_BLT); + XPSync(pScrn); +} + +#if 0 +static void +XPSetupForScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask +){ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + TGUI_FMIX(XAACopyROP[rop]); + if (bg == -1) { + TGUI_DRAWFLAG(SRCMONO | 1<<12); + REPLICATE(fg); + TGUI_FCOLOUR(fg); + } else { + TGUI_DRAWFLAG(SRCMONO); + REPLICATE(fg); + REPLICATE(bg); + TGUI_FCOLOUR(fg); + TGUI_BCOLOUR(bg); + } +} + +static void +XPSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft +){ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + pTrident->dwords = (w + 31) >> 5; + pTrident->h = h; + + XP_DEST_XY(x,y); + XP_DIM_XY(w>>1,h); + TGUI_COMMAND(GE_BLT); +} + +static void +XPSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + XAAInfoRecPtr infoRec; + infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); + + MoveDWORDS_FixedBase((CARD32 *)pTrident->IOBase + 0x2160, + (CARD32 *)pTrident->XAAScanlineColorExpandBuffers[0], + pTrident->dwords); + + pTrident->h--; + if (pTrident->h) + XPSync(pScrn); +} +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h:1.36 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h:1.37 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h:1.36 Fri May 4 15:05:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h Thu Apr 4 09:05:49 2002 @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.36 2001/05/04 19:05:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.37 2002/04/04 14:05:49 eich Exp $ */ @@ -67,7 +67,8 @@ TYPE_ET4000W32I, TYPE_ET4000W32P, TYPE_ET6000, - TYPE_ET6100 + TYPE_ET6100, + TYPE_TSENG } t_tseng_type; /* revision ID for W32 chips: currently used for W32i and W32p */ Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.89 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.91 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.89 Fri Jan 4 16:22:36 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c Tue Jul 23 21:47:34 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.89 2002/01/04 21:22:36 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.91 2002/07/24 01:47:34 tsi Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -140,6 +140,7 @@ {TYPE_ET4000W32P, "ET4000W32p"}, {TYPE_ET6000, "ET6000"}, {TYPE_ET6100, "ET6100"}, + {TYPE_TSENG, ""}, {-1, NULL} }; @@ -159,6 +160,7 @@ {TYPE_ET4000, RES_EXCLUSIVE_VGA}, {TYPE_ET4000W32, RES_EXCLUSIVE_VGA}, {TYPE_ET4000W32I, RES_EXCLUSIVE_VGA}, + {TYPE_TSENG, RES_EXCLUSIVE_VGA}, {-1, RES_UNDEFINED} }; @@ -459,7 +461,7 @@ * This code is only called when the chipset is not given beforehand, * and if the PCI code hasn't detected one previously. */ -#if 0 +#if 1 static Bool ET4000MinimalProbe(void) { @@ -505,6 +507,9 @@ TsengFindIsaDevice(GDevPtr dev) { /* XXX Need to implement this */ + if (ET4000MinimalProbe()) + return TYPE_TSENG; + return -1; } @@ -873,6 +878,8 @@ pTseng->Bustype = T_BUS_PCI; pTseng->LinFbAddressMask = 0xFF000000; break; + case TYPE_TSENG: /* generic */ + break; } } @@ -1768,7 +1775,7 @@ * but to play safe, it is marked as "unused" for now. * Changed this to "disable". Otherwise it might interfere with DGA. */ - xf86SetOperatingState(resVgaMemShared, pTseng->pEnt->index, ResDisableOpr); + xf86SetOperatingState(resVgaMem, pTseng->pEnt->index, ResDisableOpr); } /* hibit processing (TsengProcessOptions() must have been called first) */ Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.29 xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.29 Wed Oct 31 17:50:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c Tue May 14 16:19:53 2002 @@ -2,7 +2,7 @@ * video4linux Xv Driver * based on Michael Schimek's permedia 2 driver. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.29 2001/10/31 22:50:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.30 2002/05/14 20:19:53 alanh Exp $ */ #include "videodev.h" #include "xf86.h" @@ -132,7 +132,7 @@ XF86OffscreenImagePtr format; /* list */ int nformat; /* # if list entries */ XF86OffscreenImagePtr myfmt; /* which one is YUY2 (packed) */ - int have_yuv; + int yuv_format; int yuv_width,yuv_height; XF86SurfacePtr surface; @@ -286,7 +286,7 @@ return Success; } - if (pPPriv->have_yuv) { + if (0 != pPPriv->yuv_format) { DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n")); width = pPPriv->enc[pPPriv->cenc].width; height = pPPriv->enc[pPPriv->cenc].height/2; /* no interlace */ @@ -338,7 +338,7 @@ perror("ioctl VIDIOCSFBUF"); if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict)) perror("ioctl VIDIOCGPICT"); - pPPriv->pict.palette = VIDEO_PALETTE_YUV422; + pPPriv->pict.palette = pPPriv->yuv_format; pPPriv->pict.depth = 16; if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) perror("ioctl VIDIOCSPICT"); @@ -585,7 +585,7 @@ } else if (attribute == xvFreq) { if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&value)) perror("ioctl VIDIOCSFREQ"); - } else if (pPPriv->have_yuv && + } else if (0 != pPPriv->yuv_format && pPPriv->myfmt->setAttribute) { /* not mine -> pass to yuv scaler driver */ ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value); @@ -636,7 +636,7 @@ } } else if (attribute == xvFreq) { ioctl(V4L_FD,VIDIOCGFREQ,value); - } else if (pPPriv->have_yuv && + } else if (0 != pPPriv->yuv_format && pPPriv->myfmt->getAttribute) { /* not mine -> pass to yuv scaler driver */ ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value); @@ -660,7 +660,7 @@ int maxx = pPPriv->enc[pPPriv->cenc].width; int maxy = pPPriv->enc[pPPriv->cenc].height; - if (pPPriv->have_yuv) { + if (0 != pPPriv->yuv_format) { *p_w = pPPriv->myfmt->max_width; *p_h = pPPriv->myfmt->max_height; } else { @@ -838,10 +838,54 @@ (*count)++; } +/* setup yuv overlay + hw scaling: look if we find some common video + format which both v4l driver and the X-Server can handle */ +static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv, + char *dev, int fd) +{ + static const struct { + unsigned int v4l_palette; + unsigned int v4l_depth; + unsigned int xv_id; + unsigned int xv_format; + } yuvlist[] = { + { VIDEO_PALETTE_YUV422, 16, 0x32595559, XvPacked }, + { VIDEO_PALETTE_UYVY, 16, 0x59565955, XvPacked }, + { 0 /* end of list */ }, + }; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + int fmt,i; + + pPPriv->format = xf86XVQueryOffscreenImages(pScreen,&pPPriv->nformat); + for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) { + /* check v4l ... */ + ioctl(fd,VIDIOCGPICT,&pPPriv->pict); + pPPriv->pict.palette = yuvlist[fmt].v4l_palette; + pPPriv->pict.depth = yuvlist[fmt].v4l_depth; + if (-1 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict)) + continue; + ioctl(fd,VIDIOCGPICT,&pPPriv->pict); + if (pPPriv->pict.palette != yuvlist[fmt].v4l_palette) + continue; + /* ... works, check available offscreen image formats now ... */ + for (i = 0; i < pPPriv->nformat; i++) { + if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id && + pPPriv->format[i].image->format == yuvlist[fmt].xv_format) { + /* ... match found, good. */ + pPPriv->yuv_format = yuvlist[fmt].v4l_palette; + pPPriv->myfmt = pPPriv->format+i; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "v4l[%s]: using hw video scaling [%4.4s].\n", + dev,(char*)&(pPPriv->format[i].image->id)); + return; + } + } + } +} + static int V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) { - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; PortPrivPtr pPPriv; DevUnion *Private; XF86VideoAdaptorPtr *VAR = NULL; @@ -880,35 +924,7 @@ V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels); if (NULL == pPPriv->enc) return FALSE; - -#if 1 - /* test v4l device for yuv support: check if the driver - accepts VIDEO_PALETTE_YUV422 */ - ioctl(fd,VIDIOCGPICT,&pPPriv->pict); - pPPriv->pict.palette = VIDEO_PALETTE_YUV422; - pPPriv->pict.depth = 16; - if (0 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict)) { - ioctl(fd,VIDIOCGPICT,&pPPriv->pict); - if (VIDEO_PALETTE_YUV422 == pPPriv->pict.palette) { - /* works, check screen capabilities */ - DEBUG(xf86Msg(X_INFO, "v4l: kernel driver supports yuv422.\n")); - pPPriv->format = xf86XVQueryOffscreenImages - (pScreen,&pPPriv->nformat); - DEBUG(xf86Msg(X_INFO, "v4l: screen driver supports %d yuv formats (%p)\n", - pPPriv->nformat,pPPriv->format)); - for (j = 0; j < pPPriv->nformat; j++) { - DEBUG(xf86Msg(X_INFO, "v4l: yuv format: %4.4s\n", - (char*)&(pPPriv->format[j].image->id))); - if (pPPriv->format[j].image->id == 0x32595559 && - pPPriv->format[j].image->format == XvPacked) { - pPPriv->have_yuv = 1; - pPPriv->myfmt = pPPriv->format+j; - DEBUG(xf86Msg(X_INFO, "v4l: matching format found, offscreen yuv enabled.\n")); - } - } - } - } -#endif + v4l_check_yuv(pScrn,pPPriv,dev,fd); /* alloc VideoAdaptorRec */ VAR = xrealloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1)); @@ -938,7 +954,7 @@ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, &FreqAttr); } - if (pPPriv->have_yuv) { + if (0 != pPPriv->yuv_format) { /* pass throuth scaler attributes */ for (j = 0; j < pPPriv->myfmt->num_attributes; j++) { v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile:1.4 Thu Feb 15 20:44:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile Mon Feb 17 12:06:44 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile,v 1.4 2001/02/16 01:44:50 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile,v 1.6 2003/02/17 17:06:44 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -18,8 +18,8 @@ -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/include -I$(FONTINCSRC) -I$(XINCLUDESRC)\ -I$(XF86SRC)/rac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/os-support/vbe -I$(XF86SRC)/int10 \ - -I$(XTOP)/include/extensions + -I$(XF86SRC)/vbe -I$(XF86SRC)/int10 \ + -I$(EXTINCSRC) #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.36 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.24 Mon Oct 1 09:44:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c Thu Jan 23 12:20:46 2003 @@ -26,8 +26,9 @@ * Conectiva Linux. * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + * David Dawes <dawes@xfree86.org> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.24 2001/10/01 13:44:12 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.36 2003/01/23 17:20:46 tsi Exp $ */ #include "vesa.h" @@ -129,12 +130,14 @@ }; typedef enum { - OPTION_SHADOW_FB + OPTION_SHADOW_FB, + OPTION_DFLT_REFRESH } VESAOpts; static const OptionInfoRec VESAOptions[] = { - { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DFLT_REFRESH, "DefaultRefresh", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; /* @@ -150,7 +153,6 @@ "xf4bppScreenInit", "afbScreenInit", "mfbScreenInit", - "cfb24_32ScreenInit", NULL }; @@ -171,17 +173,21 @@ static const char *vbeSymbols[] = { "VBEBankSwitch", - "VBEFreeModeInfo", + "VBEExtendedInit", + "VBEFindSupportedDepths", "VBEGetModeInfo", "VBEGetVBEInfo", "VBEGetVBEMode", - "VBEInit", + "VBEPrintModes", "VBESaveRestore", "VBESetDisplayStart", "VBESetGetDACPaletteFormat", "VBESetGetLogicalScanlineLength", "VBESetGetPaletteData", + "VBESetModeNames", + "VBESetModeParameters", "VBESetVBEMode", + "VBEValidateModes", "vbeDoEDID", "vbeFree", NULL @@ -193,13 +199,6 @@ NULL }; -#if 0 -static const char *vgahwSymbols[] = { - "vgaHWDPMSSet", - NULL -}; -#endif - #ifdef XFree86LOADER /* Module loader interface */ @@ -365,13 +364,13 @@ /* There's no need to unlock VGA CRTC registers here */ /* VGA has one more read/write attribute register than EGA */ - (void) inb(GenericIOBase + 0x0AU); /* Reset flip-flop */ - outb(0x3C0, 0x14 | 0x20); - CurrentValue = inb(0x3C1); - outb(0x3C0, CurrentValue ^ 0x0F); - outb(0x3C0, 0x14 | 0x20); - TestValue = inb(0x3C1); - outb(0x3C0, CurrentValue); + (void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */ + outb(VGA_ATTR_INDEX, 0x14 | 0x20); + CurrentValue = inb(VGA_ATTR_DATA_R); + outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F); + outb(VGA_ATTR_INDEX, 0x14 | 0x20); + TestValue = inb(VGA_ATTR_DATA_R); + outb(VGA_ATTR_DATA_R, CurrentValue); /* Quit now if no VGA is present */ if ((CurrentValue ^ 0x0F) != TestValue) @@ -401,7 +400,7 @@ if (mode) { do { if (mode->Private) { - ModeInfoData *data = (ModeInfoData*)mode->Private; + VbeModeInfoData *data = (VbeModeInfoData*)mode->Private; if (data->block) xfree(data->block); @@ -432,15 +431,17 @@ { VESAPtr pVesa; VbeInfoBlock *vbe; - DisplayModePtr pMode, tmp; + DisplayModePtr pMode; VbeModeInfoBlock *mode; - ModeInfoData *data = NULL; char *mod = NULL; const char *reqSym = NULL; Gamma gzeros = {0.0, 0.0, 0.0}; rgb rzeros = {0, 0, 0}; pointer pVbeModule, pDDCModule; int i; + int flags24 = 0; + int defaultDepth = 0; + int depths = 0; if (flags & PROBE_DETECT) return (FALSE); @@ -464,7 +465,9 @@ xf86LoaderReqSymLists(vbeSymbols, NULL); - if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) + if ((pVesa->pVbe = VBEExtendedInit(NULL, pVesa->pEnt->index, + SET_BIOS_SCRATCH + | RESTORE_BIOS_SCRATCH)) == NULL) return (FALSE); if (pVesa->pEnt->location.type == BUS_PCI) { @@ -481,16 +484,50 @@ pScrn->progClock = TRUE; pScrn->rgbBits = 8; - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb)) { + if ((vbe = VBEGetVBEInfo(pVesa->pVbe)) == NULL) + return (FALSE); + pVesa->major = (unsigned)(vbe->VESAVersion >> 8); + pVesa->minor = vbe->VESAVersion & 0xff; + pVesa->vbeInfo = vbe; + pScrn->videoRam = vbe->TotalMemory * 64; + + /* + * Find what depths are available. + */ + depths = VBEFindSupportedDepths(pVesa->pVbe, pVesa->vbeInfo, &flags24, + V_MODETYPE_VBE); + + /* Preferred order for default depth selection. */ + if (depths & V_DEPTH_16) + defaultDepth = 16; + else if (depths & V_DEPTH_15) + defaultDepth = 15; + else if (depths & V_DEPTH_8) + defaultDepth = 8; + else if (depths & V_DEPTH_24) + defaultDepth = 24; + else if (depths & V_DEPTH_4) + defaultDepth = 4; + else if (depths & V_DEPTH_1) + defaultDepth = 1; + + /* + * Setting this avoids a "Driver can't support depth 24" message, + * which could be misleading. + */ + if (!flags24) + flags24 = Support24bppFb; + + /* Prefer 24bpp for fb since it potentially allows larger modes. */ + if (flags24 & Support24bppFb) + flags24 |= SupportConvert32to24 | PreferConvert32to24; + + if (!xf86SetDepthBpp(pScrn, defaultDepth, 0, 0, flags24)) { vbeFree(pVesa->pVbe); return (FALSE); } xf86PrintDepthBpp(pScrn); - /* Get the depth24 pixmap format */ - if (pScrn->depth == 24 && pVesa->pix24bpp == 0) - pVesa->pix24bpp = xf86GetBppFromDepth(pScrn, 24); - /* color weight */ if (pScrn->depth > 8 && !xf86SetWeight(pScrn, rzeros, rzeros)) { vbeFree(pVesa->pVbe); @@ -504,18 +541,12 @@ xf86SetGamma(pScrn, gzeros); - vbe = VBEGetVBEInfo(pVesa->pVbe); - pVesa->major = (unsigned)(vbe->VESAVersion >> 8); - pVesa->minor = vbe->VESAVersion & 0xff; - pVesa->vbeInfo = vbe; - pScrn->videoRam = vbe->TotalMemory * 64 * 1024; - if (pVesa->major >= 2) { /* Load ddc module */ - if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) { - vbeFree(pVesa->pVbe); + if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) { + vbeFree(pVesa->pVbe); return (FALSE); - } + } if ((pVesa->monitor = vbeDoEDID(pVesa->pVbe, pDDCModule)) != NULL) { xf86PrintEDID(pVesa->monitor); @@ -524,163 +555,24 @@ xf86UnloadSubModule(pDDCModule); } - /* Set display resolution */ - xf86SetDpi(pScrn, 0, 0); - if ((pScrn->monitor->DDC = pVesa->monitor) != NULL) xf86SetDDCproperties(pScrn, pVesa->monitor); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB, "Searching for matching VESA mode(s):\n"); - - i = 0; - while (vbe->VideoModePtr[i] != 0xffff) { - int id = vbe->VideoModePtr[i++]; - if ((mode = VBEGetModeInfo(pVesa->pVbe, id)) == NULL) - continue; - xf86ErrorFVerb(DEBUG_VERB, - "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); - xf86ErrorFVerb(DEBUG_VERB, - " ModeAttributes: 0x%x\n", mode->ModeAttributes); - xf86ErrorFVerb(DEBUG_VERB, - " WinAAttributes: 0x%x\n", mode->WinAAttributes); - xf86ErrorFVerb(DEBUG_VERB, - " WinBAttributes: 0x%x\n", mode->WinBAttributes); - xf86ErrorFVerb(DEBUG_VERB, - " WinGranularity: %d\n", mode->WinGranularity); - xf86ErrorFVerb(DEBUG_VERB, - " WinSize: %d\n", mode->WinSize); - xf86ErrorFVerb(DEBUG_VERB, - " WinASegment: 0x%x\n", mode->WinASegment); - xf86ErrorFVerb(DEBUG_VERB, - " WinBSegment: 0x%x\n", mode->WinBSegment); - xf86ErrorFVerb(DEBUG_VERB, - " WinFuncPtr: 0x%x\n", mode->WinFuncPtr); - xf86ErrorFVerb(DEBUG_VERB, - " BytesPerScanline: %d\n", mode->BytesPerScanline); - xf86ErrorFVerb(DEBUG_VERB, - " XResolution: %d\n", mode->XResolution); - xf86ErrorFVerb(DEBUG_VERB, - " YResolution: %d\n", mode->YResolution); - xf86ErrorFVerb(DEBUG_VERB, - " XCharSize: %d\n", mode->XCharSize); - xf86ErrorFVerb(DEBUG_VERB, - " YCharSize: %d\n", mode->YCharSize); - xf86ErrorFVerb(DEBUG_VERB, - " NumberOfPlanes: %d\n", mode->NumberOfPlanes); - xf86ErrorFVerb(DEBUG_VERB, - " BitsPerPixel: %d\n", mode->BitsPerPixel); - xf86ErrorFVerb(DEBUG_VERB, - " NumberOfBanks: %d\n", mode->NumberOfBanks); - xf86ErrorFVerb(DEBUG_VERB, - " MemoryModel: %d\n", mode->MemoryModel); - xf86ErrorFVerb(DEBUG_VERB, - " BankSize: %d\n", mode->BankSize); - xf86ErrorFVerb(DEBUG_VERB, - " NumberOfImages: %d\n", mode->NumberOfImages); - xf86ErrorFVerb(DEBUG_VERB, - " RedMaskSize: %d\n", mode->RedMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " RedFieldPosition: %d\n", mode->RedFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " GreenMaskSize: %d\n", mode->GreenMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " GreenFieldPosition: %d\n", mode->GreenFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " BlueMaskSize: %d\n", mode->BlueMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " BlueFieldPosition: %d\n", mode->BlueFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " RsvdMaskSize: %d\n", mode->RsvdMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); - if (pVesa->major >= 2) { - xf86ErrorFVerb(DEBUG_VERB, - " PhysBasePtr: 0x%x\n", mode->PhysBasePtr); - if (pVesa->major >= 3) { - xf86ErrorFVerb(DEBUG_VERB, - " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); - xf86ErrorFVerb(DEBUG_VERB, - " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); - xf86ErrorFVerb(DEBUG_VERB, - " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); - xf86ErrorFVerb(DEBUG_VERB, - " LinRedMaskSize: %d\n", mode->LinRedMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); - xf86ErrorFVerb(DEBUG_VERB, - " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); - xf86ErrorFVerb(DEBUG_VERB, - " MaxPixelClock: %d\n", mode->MaxPixelClock); - } - } - - if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ - !(mode->ModeAttributes & (1 << 4)) || /* text mode */ - (pScrn->bitsPerPixel != 1 && !(mode->ModeAttributes & (1 << 3))) || /* monochrome */ - (mode->BitsPerPixel > 8 && - (mode->RedMaskSize + mode->GreenMaskSize + - mode->BlueMaskSize != pScrn->depth)) || - /* only linear mode, but no PhysBasePtr */ - ((mode->ModeAttributes & (1 << 6)) && - (mode->ModeAttributes & (1 << 7)) && !mode->PhysBasePtr) || - ((mode->ModeAttributes & (1 << 6)) && - !(mode->ModeAttributes & (1 << 7))) || - mode->BitsPerPixel != pScrn->bitsPerPixel) { - VBEFreeModeInfo(mode); - continue; - } - - pMode = xcalloc(sizeof(DisplayModeRec), 1); - pMode->prev = pMode->next = NULL; - - pMode->status = MODE_OK; - pMode->type = M_T_DEFAULT;/*M_T_BUILTIN;*/ - - /* for adjust frame */ - pMode->HDisplay = mode->XResolution; - pMode->VDisplay = mode->YResolution; - - data = xcalloc(sizeof(ModeInfoData), 1); - data->mode = id; - data->data = mode; - pMode->PrivSize = sizeof(ModeInfoData); - pMode->Private = (INT32*)data; - - if (pScrn->modePool == NULL) { - pScrn->modePool = pMode; - pMode->next = pMode->prev = pMode; - } - else { - tmp = pScrn->modePool; - - tmp->prev = pMode; - while (tmp->next != pScrn->modePool) - tmp = tmp->next; - tmp->next = pMode; - pMode->prev = tmp; - pMode->next = pScrn->modePool; - } - - } + /* + * Check the available BIOS modes, and extract those that match the + * requirements into the modePool. Note: modePool is a NULL-terminated + * list. + */ + pScrn->modePool = VBEGetModePool (pScrn, pVesa->pVbe, pVesa->vbeInfo, + V_MODETYPE_VBE); xf86ErrorFVerb(DEBUG_VERB, "\n"); - xf86ErrorFVerb(DEBUG_VERB, - "Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory, - (vbe->TotalMemory * 65536) / (1024 * 1024)); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB, + "Total Memory: %d 64KB banks (%dkB)\n", vbe->TotalMemory, + (vbe->TotalMemory * 65536) / 1024); pVesa->mapSize = vbe->TotalMemory * 65536; if (pScrn->modePool == NULL) { @@ -688,115 +580,118 @@ vbeFree(pVesa->pVbe); return (FALSE); } - for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) { - pMode = pScrn->modePool; - - do { - DisplayModePtr next = pMode->next; - int width, height; - - if (sscanf(pScrn->display->modes[i], "%dx%d", &width, &height) == 2 && - width == pMode->HDisplay && height == pMode->VDisplay) { - pMode->name = strdup(pScrn->display->modes[i]); - - pMode->prev->next = pMode->next; - pMode->next->prev = pMode->prev; - - if (pScrn->modes == NULL) { - pScrn->modes = pMode; - pMode->next = pMode->prev = pMode; - } - else { - tmp = pScrn->modes; - - tmp->prev = pMode; - while (tmp->next != pScrn->modes) - tmp = tmp->next; - pMode->prev = tmp; - tmp->next = pMode; - pMode->next = pScrn->modes; - } - if (pMode == pScrn->modePool) - pScrn->modePool = (next == pMode) ? NULL : next; - break; - } - pMode = next; - } while (pMode != pScrn->modePool && pScrn->modePool != NULL); - } - if (pScrn->modes == NULL) - pScrn->modes = pScrn->modePool; - tmp = pScrn->modes; - do { - mode = ((ModeInfoData*)tmp->Private)->data; - if (mode->XResolution > pScrn->virtualX) { - pScrn->virtualX = mode->XResolution; - pVesa->maxBytesPerScanline = mode->BytesPerScanline; - } - if (mode->YResolution > pScrn->virtualY) - pScrn->virtualY = mode->YResolution; - } while ((tmp = tmp->next) != pScrn->modes); + VBESetModeNames(pScrn->modePool); + /* + * If DDC information is available, use it to try to set the monitor + * parameters if they're not already set. + * + * The common layer will already do this, but doesn't try as hard. If + * this proves useful, it should probably be moved into the common layer. + */ if (pVesa->monitor != NULL) { - pMode = pScrn->modes; - - do { - int maxClock = 0; - DisplayModePtr last = pScrn->monitor->Modes; + MonPtr pMon; - for (i = 0; i < 4; i++) - if (pVesa->monitor->det_mon[i].type == DT && - pVesa->monitor->det_mon[i].section.d_timings.h_active == - pMode->HDisplay && - pVesa->monitor->det_mon[i].section.d_timings.v_active == - pMode->VDisplay) { - maxClock = pVesa->monitor-> - det_mon[i].section.d_timings.clock / 1000; - break; + pMon = pScrn->monitor; + if (pMon->nHsync == 0 || pMon->nVrefresh == 0) { + struct monitor_ranges *mRange; + float hmin = 1e6, hmax = 0.0, vmin = 1e6, vmax = 0.0; + float h; + struct std_timings *t; + int j, k; + + j = 0; + for (i = 0; i < DET_TIMINGS; i++) { + if (pVesa->monitor->det_mon[i].type == DS_RANGES) { + mRange = &pVesa->monitor->det_mon[i].section.ranges; + pMon->hsync[j].lo = mRange->min_h; + pMon->hsync[j].hi = mRange->max_h; + pMon->vrefresh[j].lo = mRange->min_v; + pMon->vrefresh[j].hi = mRange->max_v; + j++; + } else if (pVesa->monitor->det_mon[i].type == DS_STD_TIMINGS) { + t = pVesa->monitor->det_mon[i].section.std_t; + for (k = 0; k < 5; k++) { + if (t[k].hsize > 256) { /* sanity check */ + if (t[k].refresh < vmin) + vmin = t[i].refresh; + if (t[k].refresh > vmax) + vmax = t[i].refresh; + h = t[k].refresh * 1.07 * t[k].vsize / 1000.0; + if (h < hmin) + hmin = h; + if (h > hmax) + hmax = h; + } + } } + + if (j > MAX_HSYNC) + break; + } - tmp = NULL; - if (maxClock) { - for (; last != NULL; last = last->next) { - if (pMode->name != NULL && - strcmp(pMode->name, last->name) == 0 && - last->Clock <= maxClock) { - tmp = last; - /* keep looping to find the best refresh */ + if (j == 0) { + t = pVesa->monitor->timings2; + for (i = 0; i < STD_TIMINGS; i++) { + if (t[i].hsize > 256) { /* sanity check */ + if (t[i].refresh < vmin) + vmin = t[i].refresh; + if (t[i].refresh > vmax) + vmax = t[i].refresh; + h = t[i].refresh * 1.07 * t[i].vsize / 1000.0; + if (h < hmin) + hmin = h; + if (h > hmax) + hmax = h; } } + if (hmax > 0.0) { + pMon->hsync[j].lo = hmin; + pMon->hsync[j].hi = hmax; + pMon->vrefresh[j].lo = vmin; + pMon->vrefresh[j].hi = vmax; + j++; + } } - - if (tmp != NULL) { - int from = (int)(&((DisplayModePtr)0)->Clock); - int to = (int)(&((DisplayModePtr)0)->ClockIndex); - - data->mode |= (1 << 11); - - /* copy the "interesting" information */ - memcpy((char*)pMode + from, (char*)tmp + from, to - from); - data = (ModeInfoData*)pMode->Private; - data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1); - data->block->HorizontalTotal = pMode->HTotal; - data->block->HorizontalSyncStart = pMode->HSyncStart; - data->block->HorizontalSyncEnd = pMode->HSyncEnd; - data->block->VerticalTotal = pMode->VTotal; - data->block->VerticalSyncStart = pMode->VSyncStart; - data->block->VerticalSyncEnd = pMode->VSyncEnd; - data->block->Flags = ((pMode->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) | - ((pMode->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0); - data->block->PixelClock = pMode->Clock * 1000; - data->block->RefreshRate = ((double)(pMode->Clock * 1000) / - (double)(pMode->HTotal * pMode->VTotal)) * 100; + if (j > 0) { + pMon->nHsync = pMon->nVrefresh = j; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Monitor parameters set to DDC-probed values\n"); } - pMode = pMode->next; - } while (pMode != pScrn->modes); + } } + i = VBEValidateModes(pScrn, NULL, pScrn->display->modes, + NULL, NULL, 0, 2048, 1, 0, 2048, + pScrn->display->virtualX, + pScrn->display->virtualY, + pVesa->mapSize, LOOKUP_BEST_REFRESH); + + if (i <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes\n"); + vbeFree(pVesa->pVbe); + return (FALSE); + } + + xf86PruneDriverModes(pScrn); + + pMode = pScrn->modes; + do { + mode = ((VbeModeInfoData*)pMode->Private)->data; + if (mode->BytesPerScanline > pVesa->maxBytesPerScanline) { + pVesa->maxBytesPerScanline = mode->BytesPerScanline; + } + pMode = pMode->next; + } while (pMode != pScrn->modes); + pScrn->currentMode = pScrn->modes; pScrn->displayWidth = pScrn->virtualX; + + VBEPrintModes(pScrn); - xf86PrintModes(pScrn); + /* Set display resolution */ + xf86SetDpi(pScrn, 0, 0); if (pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes\n"); @@ -816,8 +711,14 @@ /* Use shadow by default */ if (xf86ReturnOptValBool(pVesa->Options, OPTION_SHADOW_FB, TRUE)) pVesa->shadowFB = TRUE; + + if (xf86ReturnOptValBool(pVesa->Options, OPTION_DFLT_REFRESH, FALSE)) + pVesa->defaultRefresh = TRUE; + + if (!pVesa->defaultRefresh) + VBESetModeParameters(pScrn, pVesa->pVbe); - mode = ((ModeInfoData*)pScrn->modes->Private)->data; + mode = ((VbeModeInfoData*)pScrn->modes->Private)->data; switch (mode->MemoryModel) { case 0x0: /* Text mode */ case 0x1: /* CGA graphics */ @@ -859,13 +760,8 @@ switch (pScrn->bitsPerPixel) { case 8: case 16: - case 32: - break; case 24: - if (pVesa->pix24bpp == 32) { - mod = "xf24_32bpp"; - reqSym = "cfb24_32ScreenInit"; - } + case 32: break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -918,11 +814,13 @@ int flags; int init_picture = 0; - if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) + if ((pVesa->pVbe = VBEExtendedInit(NULL, pVesa->pEnt->index, + SET_BIOS_SCRATCH + | RESTORE_BIOS_SCRATCH)) == NULL) return (FALSE); if (pVesa->mapPhys == 0) { - mode = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + mode = ((VbeModeInfoData*)(pScrn->currentMode->Private))->data; pScrn->videoRam = pVesa->mapSize; pVesa->mapPhys = mode->PhysBasePtr; pVesa->mapOff = 0; @@ -944,6 +842,10 @@ return (FALSE); } + /* Set bpp to 8 for depth 4 when using shadowfb. */ + if (pVesa->shadowFB && pScrn->bitsPerPixel == 4) + pScrn->bitsPerPixel = 8; + if (pVesa->shadowFB && (pVesa->shadowPtr = shadowAlloc(pScrn->virtualX, pScrn->virtualY, pScrn->bitsPerPixel)) == NULL) @@ -976,7 +878,7 @@ if (!miSetPixmapDepths()) return (FALSE); - mode = ((ModeInfoData*)pScrn->modes->Private)->data; + mode = ((VbeModeInfoData*)pScrn->modes->Private)->data; switch (mode->MemoryModel) { case 0x0: /* Text mode */ case 0x1: /* CGA graphics */ @@ -1032,18 +934,9 @@ case 0x4: /* Packed pixel */ case 0x6: /* Direct Color */ switch (pScrn->bitsPerPixel) { - case 24: - if (pVesa->pix24bpp == 32) { - if (!cfb24_32ScreenInit(pScreen, - pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth)) - return (FALSE); - break; - } case 8: case 16: + case 24: case 32: if (!fbScreenInit(pScreen, pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, @@ -1207,12 +1100,12 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) { VESAPtr pVesa; - ModeInfoData *data; + VbeModeInfoData *data; int mode; pVesa = VESAGetRec(pScrn); - data = (ModeInfoData*)pMode->Private; + data = (VbeModeInfoData*)pMode->Private; mode = data->mode | (1 << 15); @@ -1221,16 +1114,19 @@ mode |= 1 << 14; if (VBESetVBEMode(pVesa->pVbe, mode, data->block) == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBESetVBEMode failed"); if ((data->block || (data->mode & (1 << 11))) && VBESetVBEMode(pVesa->pVbe, (mode & ~(1 << 11)), NULL) == TRUE) { /* Some cards do not like setting the clock. * Free it as it will not be any longer useful */ + xf86ErrorF("...Tried again without customized values.\n"); xfree(data->block); data->block = NULL; data->mode &= ~(1 << 11); } else { + ErrorF("\n"); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); return (FALSE); } @@ -1239,8 +1135,8 @@ pVesa->bankSwitchWindowB = !((data->data->WinBSegment == 0) && (data->data->WinBAttributes == 0)); - if (data->data->XResolution != pScrn->virtualX) - VBESetLogicalScanline(pVesa->pVbe, pScrn->virtualX); + if (data->data->XResolution != pScrn->displayWidth) + VBESetLogicalScanline(pVesa->pVbe, pScrn->displayWidth); if (pScrn->bitsPerPixel >= 8 && pVesa->vbeInfo->Capabilities[0] & 0x01) VBESetGetDACPaletteFormat(pVesa->pVbe, 8); @@ -1280,20 +1176,25 @@ pVesa->pciTag, pScrn->memPhysBase, pVesa->mapSize); else - pVesa->base = xf86MapVidMem(pScrn->scrnIndex, 0, - pScrn->memPhysBase, pVesa->mapSize); + pVesa->base = xf86MapDomainMemory(pScrn->scrnIndex, 0, pVesa->pciTag, + pScrn->memPhysBase, pVesa->mapSize); if (pVesa->base) { if (pVesa->mapPhys != 0xa0000) - pVesa->VGAbase = xf86MapVidMem(pScrn->scrnIndex, 0, - 0xa0000, 0x10000); + pVesa->VGAbase = xf86MapDomainMemory(pScrn->scrnIndex, 0, + pVesa->pciTag, + 0xa0000, 0x10000); else pVesa->VGAbase = pVesa->base; } - xf86ErrorFVerb(DEBUG_VERB, - "virtual address = %p - physical address = %p - size = %d\n", - pVesa->base, pScrn->memPhysBase, pVesa->mapSize); + pVesa->ioBase = pScrn->domainIOBase; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB, + "virtual address = %p,\n" + "\tphysical address = %p, size = %d\n", + pVesa->base, pScrn->memPhysBase, pVesa->mapSize); + return (pVesa->base != NULL); } @@ -1317,12 +1218,12 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); - VbeModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + VbeModeInfoBlock *data = ((VbeModeInfoData*)(pScrn->currentMode->Private))->data; int window; int mask = 1 << (offset & 3); - outb(0x3c4, 2); - outb(0x3c5, mask); + outb(pVesa->ioBase + VGA_SEQ_INDEX, 2); + outb(pVesa->ioBase + VGA_SEQ_DATA, mask); offset = (offset >> 2) + pVesa->maxBytesPerScanline * row; window = offset / (data->WinGranularity * 1024); pVesa->windowAoffset = window * data->WinGranularity * 1024; @@ -1350,7 +1251,7 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); - VbeModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + VbeModeInfoBlock *data = ((VbeModeInfoData*)(pScrn->currentMode->Private))->data; int window; offset += pVesa->maxBytesPerScanline * row; @@ -1367,10 +1268,13 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) { + VESAPtr pVesa = VESAGetRec(pScrn); + int i, idx; + #if 0 + /* This code works, but is very slow for programs that use it intensively */ - VESAPtr pVesa = VESAGetRec(pScrn); - int i, idx, base; + int base; if (pVesa->pal == NULL) pVesa->pal = xcalloc(1, sizeof(CARD32) * 256); @@ -1393,28 +1297,27 @@ if (idx - 1 == indices[i - 1]) VBESetGetPaletteData(pVesa->pVbe, TRUE, base, idx - base, pVesa->pal + base, FALSE, TRUE); + #else -#define WriteDacWriteAddr(value) outb(VGA_DAC_WRITE_ADDR, value) -#define WriteDacData(value) outb(VGA_DAC_DATA, value); -#undef DACDelay -#define DACDelay() \ - do { \ - unsigned char temp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); \ - temp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); \ - } while (0) - int i, idx; + +#define VESADACDelay() \ + do { \ + (void)inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); \ + (void)inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); \ + } while (0) for (i = 0; i < numColors; i++) { idx = indices[i]; - WriteDacWriteAddr(idx); - DACDelay(); - WriteDacData(colors[idx].red); - DACDelay(); - WriteDacData(colors[idx].green); - DACDelay(); - WriteDacData(colors[idx].blue); - DACDelay(); + outb(pVesa->ioBase + VGA_DAC_WRITE_ADDR, idx); + VESADACDelay(); + outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].red); + VESADACDelay(); + outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].green); + VESADACDelay(); + outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].blue); + VESADACDelay(); } + #endif } @@ -1422,64 +1325,67 @@ * Just adapted from the std* functions in vgaHW.c */ static void -WriteAttr(int index, int value) +WriteAttr(VESAPtr pVesa, int index, int value) { CARD8 tmp; - tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + tmp = inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); index |= 0x20; - outb(VGA_ATTR_INDEX, index); - outb(VGA_ATTR_DATA_W, value); + outb(pVesa->ioBase + VGA_ATTR_INDEX, index); + outb(pVesa->ioBase + VGA_ATTR_DATA_W, value); } static int -ReadAttr(int index) +ReadAttr(VESAPtr pVesa, int index) { CARD8 tmp; - tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + tmp = inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); index |= 0x20; - outb(VGA_ATTR_INDEX, index); - return (inb(VGA_ATTR_DATA_R)); + outb(pVesa->ioBase + VGA_ATTR_INDEX, index); + return (inb(pVesa->ioBase + VGA_ATTR_DATA_R)); } -#define WriteMiscOut(value) outb(VGA_MISC_OUT_W, value) -#define ReadMiscOut() inb(VGA_MISC_OUT_R) -#define WriteSeq(index, value) outb(VGA_SEQ_INDEX, index);\ - outb(VGA_SEQ_DATA, value) +#define WriteMiscOut(value) outb(pVesa->ioBase + VGA_MISC_OUT_W, value) +#define ReadMiscOut() inb(pVesa->ioBase + VGA_MISC_OUT_R) +#define WriteSeq(index, value) outb(pVesa->ioBase + VGA_SEQ_INDEX, index);\ + outb(pVesa->ioBase + VGA_SEQ_DATA, value) static int -ReadSeq(int index) +ReadSeq(VESAPtr pVesa, int index) { - outb(VGA_SEQ_INDEX, index); + outb(pVesa->ioBase + VGA_SEQ_INDEX, index); - return (inb(VGA_SEQ_DATA)); + return (inb(pVesa->ioBase + VGA_SEQ_DATA)); } + +#define WriteGr(index, value) \ + outb(pVesa->ioBase + VGA_GRAPH_INDEX, index); \ + outb(pVesa->ioBase + VGA_GRAPH_DATA, value) -#define WriteGr(index, value) outb(VGA_GRAPH_INDEX, index);\ - outb(VGA_GRAPH_DATA, value) static int -ReadGr(int index) +ReadGr(VESAPtr pVesa, int index) { - outb(VGA_GRAPH_INDEX, index); + outb(pVesa->ioBase + VGA_GRAPH_INDEX, index); - return (inb(VGA_GRAPH_DATA)); + return (inb(pVesa->ioBase + VGA_GRAPH_DATA)); } -#define WriteCrtc(index, value) outb(VGA_CRTC_INDEX_OFFSET, index);\ - outb(VGA_CRTC_DATA_OFFSET, value) +#define WriteCrtc(index, value) \ + outb(pVesa->ioBase + (VGA_IOBASE_COLOR + VGA_CRTC_INDEX_OFFSET), index); \ + outb(pVesa->ioBase + (VGA_IOBASE_COLOR + VGA_CRTC_DATA_OFFSET), value) static int -ReadCrtc(int index) +ReadCrtc(VESAPtr pVesa, int index) { - outb(VGA_CRTC_INDEX_OFFSET, index); - return inb(VGA_CRTC_DATA_OFFSET); + outb(pVesa->ioBase + (VGA_IOBASE_COLOR + VGA_CRTC_INDEX_OFFSET), index); + return inb(pVesa->ioBase + (VGA_IOBASE_COLOR + VGA_CRTC_DATA_OFFSET)); } static void -SeqReset(Bool start) +SeqReset(VESAPtr pVesa, Bool start) { if (start) { WriteSeq(0x00, 0x01); /* Synchronous Reset */ @@ -1499,7 +1405,7 @@ return; /* If in graphics mode, don't save anything */ - attr10 = ReadAttr(0x10); + attr10 = ReadAttr(pVesa, 0x10); if (attr10 & 0x01) return; @@ -1507,21 +1413,21 @@ /* save the registers that are needed here */ miscOut = ReadMiscOut(); - gr4 = ReadGr(0x04); - gr5 = ReadGr(0x05); - gr6 = ReadGr(0x06); - seq2 = ReadSeq(0x02); - seq4 = ReadSeq(0x04); + gr4 = ReadGr(pVesa, 0x04); + gr5 = ReadGr(pVesa, 0x05); + gr6 = ReadGr(pVesa, 0x06); + seq2 = ReadSeq(pVesa, 0x02); + seq4 = ReadSeq(pVesa, 0x04); /* Force into colour mode */ WriteMiscOut(miscOut | 0x01); - scrn = ReadSeq(0x01) | 0x20; - SeqReset(TRUE); + scrn = ReadSeq(pVesa, 0x01) | 0x20; + SeqReset(pVesa, TRUE); WriteSeq(0x01, scrn); - SeqReset(FALSE); + SeqReset(pVesa, FALSE); - WriteAttr(0x10, 0x01); /* graphics mode */ + WriteAttr(pVesa, 0x10, 0x01); /* graphics mode */ /*font1 */ WriteSeq(0x02, 0x04); /* write to plane 2 */ @@ -1539,13 +1445,13 @@ WriteGr(0x06, 0x05); /* set graphics */ slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts + 8192, 8192); - scrn = ReadSeq(0x01) & ~0x20; - SeqReset(TRUE); + scrn = ReadSeq(pVesa, 0x01) & ~0x20; + SeqReset(pVesa, TRUE); WriteSeq(0x01, scrn); - SeqReset(FALSE); + SeqReset(pVesa, FALSE); /* Restore clobbered registers */ - WriteAttr(0x10, attr10); + WriteAttr(pVesa, 0x10, attr10); WriteSeq(0x02, seq2); WriteSeq(0x04, seq4); WriteGr(0x04, gr4); @@ -1568,25 +1474,25 @@ /* save the registers that are needed here */ miscOut = ReadMiscOut(); - attr10 = ReadAttr(0x10); - gr1 = ReadGr(0x01); - gr3 = ReadGr(0x03); - gr4 = ReadGr(0x04); - gr5 = ReadGr(0x05); - gr6 = ReadGr(0x06); - gr8 = ReadGr(0x08); - seq2 = ReadSeq(0x02); - seq4 = ReadSeq(0x04); + attr10 = ReadAttr(pVesa, 0x10); + gr1 = ReadGr(pVesa, 0x01); + gr3 = ReadGr(pVesa, 0x03); + gr4 = ReadGr(pVesa, 0x04); + gr5 = ReadGr(pVesa, 0x05); + gr6 = ReadGr(pVesa, 0x06); + gr8 = ReadGr(pVesa, 0x08); + seq2 = ReadSeq(pVesa, 0x02); + seq4 = ReadSeq(pVesa, 0x04); /* Force into colour mode */ WriteMiscOut(miscOut | 0x01); - scrn = ReadSeq(0x01) | 0x20; - SeqReset(TRUE); + scrn = ReadSeq(pVesa, 0x01) | 0x20; + SeqReset(pVesa, TRUE); WriteSeq(0x01, scrn); - SeqReset(FALSE); + SeqReset(pVesa, FALSE); - WriteAttr(0x10, 0x01); /* graphics mode */ + WriteAttr(pVesa, 0x10, 0x01); /* graphics mode */ if (pScrn->depth == 4) { /* GJA */ WriteGr(0x03, 0x00); /* don't rotate, write unmodified */ @@ -1608,14 +1514,14 @@ WriteGr(0x06, 0x05); /* set graphics */ slowbcopy_tobus(pVesa->fonts + 8192, pVesa->VGAbase, 8192); - scrn = ReadSeq(0x01) & ~0x20; - SeqReset(TRUE); + scrn = ReadSeq(pVesa, 0x01) & ~0x20; + SeqReset(pVesa, TRUE); WriteSeq(0x01, scrn); - SeqReset(FALSE); + SeqReset(pVesa, FALSE); /* restore the registers that were changed */ WriteMiscOut(miscOut); - WriteAttr(0x10, attr10); + WriteAttr(pVesa, 0x10, attr10); WriteGr(0x01, gr1); WriteGr(0x03, gr3); WriteGr(0x04, gr4); @@ -1630,21 +1536,22 @@ VESASaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + VESAPtr pVesa = VESAGetRec(pScrn); Bool on = xf86IsUnblank(mode); if (on) SetTimeSinceLastInputEvent(); if (pScrn->vtSema) { - unsigned char scrn = ReadSeq(0x01); + unsigned char scrn = ReadSeq(pVesa, 0x01); if (on) scrn &= ~0x20; else scrn |= 0x20; - SeqReset(TRUE); + SeqReset(pVesa, TRUE); WriteSeq(0x01, scrn); - SeqReset(FALSE); + SeqReset(pVesa, FALSE); } return (TRUE); @@ -1653,10 +1560,9 @@ static int VESABankSwitch(ScreenPtr pScreen, unsigned int iBank) { - VESAPtr pVesa; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + VESAPtr pVesa = VESAGetRec(pScrn); - pVesa = VESAGetRec(pScrn); if (pVesa->curBank == iBank) return (0); if (!VBEBankSwitch(pVesa->pVbe, iBank, 0)) @@ -1733,10 +1639,7 @@ VESADisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, int flags) { -#if 0 - /* XXX How can this work without the vgahw module being initialized? */ - vgaHWDPMSSet(pScrn, mode, flags); -#else + VESAPtr pVesa = VESAGetRec(pScrn); unsigned char seq1 = 0, crtc17 = 0; if (!pScrn->vtSema) @@ -1765,13 +1668,12 @@ break; } WriteSeq(0x00, 0x01); /* Synchronous Reset */ - seq1 |= ReadSeq(0x01) & ~0x20; + seq1 |= ReadSeq(pVesa, 0x01) & ~0x20; WriteSeq(0x01, seq1); - crtc17 |= ReadCrtc(0x17) & ~0x80; + crtc17 |= ReadCrtc(pVesa, 0x17) & ~0x80; usleep(10000); WriteCrtc(0x17, crtc17); WriteSeq(0x00, 0x03); /* End Reset */ -#endif } Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h:1.9 Fri May 4 15:05:49 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h Thu Jan 16 11:09:10 2003 @@ -26,7 +26,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.9 2001/05/04 19:05:49 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.14 2003/01/16 16:09:10 eich Exp $ */ #ifndef _VESA_H_ @@ -52,6 +52,7 @@ /* VBE/DDC support */ #include "vbe.h" +#include "vbeModes.h" #include "xf86DDC.h" /* ShadowFB support */ @@ -97,30 +98,26 @@ miBankInfoRec bank; int curBank, bankSwitchWindowB; CARD16 maxBytesPerScanline; - int mapPhys, mapOff, mapSize; /* video memory */ + unsigned long mapPhys, mapOff, mapSize; /* video memory */ void *base, *VGAbase; CARD8 *state, *pstate; /* SVGA state */ int statePage, stateSize, stateMode; int page; - int pix24bpp; CARD32 *pal, *savedPal; CARD8 *fonts; xf86MonPtr monitor; Bool shadowFB, primary; CARD8 *shadowPtr; CARD32 windowAoffset; + /* Don't override the default refresh rate. */ + Bool defaultRefresh; /* DGA info */ DGAModePtr pDGAMode; int nDGAMode; CloseScreenProcPtr CloseScreen; OptionInfoPtr Options; + IOADDRESS ioBase; } VESARec, *VESAPtr; - -typedef struct _ModeInfoData { - int mode; - VbeModeInfoBlock *data; - VbeCRTCInfoBlock *block; -} ModeInfoData; #endif /* _VESA_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.58 xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.62 --- xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.58 Fri Jan 4 17:03:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c Mon Dec 2 20:58:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.58 2002/01/04 22:03:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.62 2002/12/03 01:58:58 dickey Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -36,7 +36,6 @@ * Marc Aurele La France <tsi@xfree86.org> */ -#define DEBUG(x) #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -67,13 +66,13 @@ #define VGA_VERSION_NAME "4.0" #define VGA_VERSION_MAJOR 4 #define VGA_VERSION_MINOR 0 -#define VGA_PATCHLEVEL 0 +#define VGA_PATCHLEVEL 0 #define VGA_VERSION_CURRENT ((VGA_VERSION_MAJOR << 24) | \ (VGA_VERSION_MINOR << 16) | VGA_PATCHLEVEL) /* Forward definitions */ -static const OptionInfoRec * GenericAvailableOptions(int chipid, int busid); +static const OptionInfoRec * GenericAvailableOptions(int chipid, int busid); static void GenericIdentify(int); static Bool GenericProbe(DriverPtr, int); static Bool GenericPreInit(ScrnInfoPtr, int); @@ -102,18 +101,23 @@ 0 }; -typedef enum { +typedef enum +{ OPTION_SHADOW_FB, - OPTION_VGA_CLOCKS + OPTION_VGA_CLOCKS, + OPTION_KGA_UNIVERSAL } GenericOpts; -static const OptionInfoRec GenericOptions[] = { +static const OptionInfoRec GenericOptions[] = +{ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_VGA_CLOCKS, "VGAClocks", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_KGA_UNIVERSAL, "KGAUniversal", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; -static const char *vgahwSymbols[] = { +static const char *vgahwSymbols[] = +{ "vgaHWBlankScreen", "vgaHWDPMSSet", "vgaHWFreeHWRec", @@ -133,25 +137,29 @@ NULL }; -static const char *miscfbSymbols[] = { +static const char *miscfbSymbols[] = +{ "xf1bppScreenInit", "xf4bppScreenInit", NULL }; -static const char *fbSymbols[] = { +static const char *fbSymbols[] = +{ "fbPictureInit", "fbScreenInit", NULL }; -static const char *shadowfbSymbols[] = { +static const char *shadowfbSymbols[] = +{ "ShadowFBInit", NULL }; -static const char *int10Symbols[] = { - "xf86InitInt10", +static const char *int10Symbols[] = +{ + "xf86ExtendedInitInt10", "xf86FreeInt10", NULL }; @@ -189,15 +197,15 @@ if (!Initialised) { - Initialised = TRUE; - xf86AddDriver(&VGA, Module, 0); + Initialised = TRUE; + xf86AddDriver(&VGA, Module, 0); LoaderRefSymLists(vgahwSymbols, miscfbSymbols, fbSymbols, - shadowfbSymbols, int10Symbols,NULL); - return (pointer)TRUE; + shadowfbSymbols, int10Symbols, NULL); + return (pointer)TRUE; } if (ErrorMajor) - *ErrorMajor = LDR_ONCEONLY; + *ErrorMajor = LDR_ONCEONLY; return NULL; } @@ -216,22 +224,24 @@ {-1, NULL} }; -static PciChipsets GenericPCIchipsets[] = { - { CHIP_VGA_GENERIC, PCI_CHIP_VGA, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED }, +static PciChipsets GenericPCIchipsets[] = +{ + {CHIP_VGA_GENERIC, PCI_CHIP_VGA, RES_SHARED_VGA}, + {-1, -1, RES_UNDEFINED}, }; -static IsaChipsets GenericISAchipsets[] = { - {CHIP_VGA_GENERIC, RES_EXCLUSIVE_VGA}, - {-1, 0 } +static IsaChipsets GenericISAchipsets[] = +{ + {CHIP_VGA_GENERIC, RES_EXCLUSIVE_VGA}, + {-1, 0} }; static void GenericIdentify(int flags) { xf86PrintChipsets(VGA_NAME, - "Generic VGA driver (version " VGA_VERSION_NAME ") for chipsets", - GenericChipsets); + "Generic VGA driver (version " VGA_VERSION_NAME ") for chipsets", + GenericChipsets); } static const OptionInfoRec * @@ -258,27 +268,31 @@ * Find the config file Device sections that match this * driver, and return if there are none. */ - if ((numDevSections = xf86MatchDevice(VGA_NAME, - &devSections)) <= 0) { + if ((numDevSections = xf86MatchDevice(VGA_NAME, &devSections)) <= 0) return FALSE; - } - + /* PCI BUS */ - if (xf86GetPciVideoInfo() ) { + if (xf86GetPciVideoInfo()) + { numUsed = xf86MatchPciInstances(VGA_NAME, PCI_VENDOR_GENERIC, - GenericChipsets, GenericPCIchipsets, - devSections,numDevSections, + GenericChipsets, GenericPCIchipsets, + devSections, numDevSections, drv, &usedChips); - if (numUsed > 0) { + if (numUsed > 0) + { if (flags & PROBE_DETECT) foundScreen = TRUE; - else { - for (i = 0; i < numUsed; i++) { + else + { + for (i = 0; i < numUsed; i++) + { ScrnInfoPtr pScrn = NULL; /* Allocate a ScrnInfoRec */ - if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i], - GenericPCIchipsets,NULL, - NULL,NULL,NULL,NULL))){ + pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + GenericPCIchipsets, NULL, + NULL, NULL, NULL, NULL); + if (pScrn) + { pScrn->driverVersion = VGA_VERSION_CURRENT; pScrn->driverName = VGA_DRIVER_NAME; pScrn->name = VGA_NAME; @@ -298,21 +312,24 @@ xfree(usedChips); } } - + /* Isa Bus */ - numUsed = xf86MatchIsaInstances(VGA_NAME,GenericChipsets, - GenericISAchipsets,drv, - VGAFindIsaDevice,devSections, - numDevSections,&usedChips); - if(numUsed > 0) { + numUsed = xf86MatchIsaInstances(VGA_NAME, GenericChipsets, + GenericISAchipsets, drv, + VGAFindIsaDevice, devSections, + numDevSections, &usedChips); + if (numUsed > 0) + { if (flags & PROBE_DETECT) foundScreen = TRUE; - else for (i = 0; i < numUsed; i++) { + else for (i = 0; i < numUsed; i++) + { ScrnInfoPtr pScrn = NULL; - if ((pScrn = xf86ConfigIsaEntity(pScrn,0,usedChips[i], - GenericISAchipsets,NULL, - NULL,NULL,NULL,NULL))) { - + pScrn = xf86ConfigIsaEntity(pScrn, 0, usedChips[i], + GenericISAchipsets, + NULL, NULL, NULL, NULL, NULL); + if (pScrn) + { pScrn->driverVersion = VGA_VERSION_CURRENT; pScrn->driverName = VGA_DRIVER_NAME; pScrn->name = VGA_NAME; @@ -327,8 +344,9 @@ pScrn->ValidMode = GenericValidMode; foundScreen = TRUE; } + + xfree(usedChips); } - xfree(usedChips); } xfree(devSections); @@ -339,24 +357,25 @@ VGAFindIsaDevice(GDevPtr dev) { #ifndef PC98_EGC - CARD16 GenericIOBase = VGAHW_GET_IOBASE(); - CARD8 CurrentValue, TestValue; - - /* There's no need to unlock VGA CRTC registers here */ - - /* VGA has one more read/write attribute register than EGA */ - (void) inb(GenericIOBase + 0x0AU); /* Reset flip-flop */ - outb(0x3C0, 0x14 | 0x20); - CurrentValue = inb(0x3C1); - outb(0x3C0, CurrentValue ^ 0x0F); - outb(0x3C0, 0x14 | 0x20); - TestValue = inb(0x3C1); - outb(0x3C0, CurrentValue); - - /* Quit now if no VGA is present */ - if ((CurrentValue ^ 0x0F) != TestValue) - return -1; + CARD16 GenericIOBase = VGAHW_GET_IOBASE(); + CARD8 CurrentValue, TestValue; + + /* There's no need to unlock VGA CRTC registers here */ + + /* VGA has one more read/write attribute register than EGA */ + (void) inb(GenericIOBase + 0x0AU); /* Reset flip-flop */ + outb(VGA_ATTR_INDEX, 0x14 | 0x20); + CurrentValue = inb(VGA_ATTR_DATA_R); + outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F); + outb(VGA_ATTR_INDEX, 0x14 | 0x20); + TestValue = inb(VGA_ATTR_DATA_R); + outb(VGA_ATTR_DATA_W, CurrentValue); + + /* Quit now if no VGA is present */ + if ((CurrentValue ^ 0x0F) != TestValue) + return -1; #endif + return (int)CHIP_VGA_GENERIC; } @@ -364,22 +383,24 @@ GenericClockSelect(ScrnInfoPtr pScreenInfo, int ClockNumber) { # ifndef PC98_EGC - static CARD8 save_misc; + vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); + static CARD8 save_misc; - switch (ClockNumber) - { - case CLK_REG_SAVE: - save_misc = inb(0x3CC); - break; - - case CLK_REG_RESTORE: - outb(0x3C2, save_misc); - break; - - default: - outb(0x3C2, (save_misc & 0xF3) | ((ClockNumber << 2) & 0x0C)); - break; - } + switch (ClockNumber) + { + case CLK_REG_SAVE: + save_misc = inb(pvgaHW->PIOOffset + VGA_MISC_OUT_R); + break; + + case CLK_REG_RESTORE: + outb(pvgaHW->PIOOffset + VGA_MISC_OUT_W, save_misc); + break; + + default: + outb(pvgaHW->PIOOffset + VGA_MISC_OUT_W, + (save_misc & 0xF3) | ((ClockNumber << 2) & 0x0C)); + break; + } # endif return TRUE; @@ -392,6 +413,7 @@ typedef struct _GenericRec { Bool ShadowFB; + Bool KGAUniversal; CARD8 * ShadowPtr; CARD32 ShadowPitch; CloseScreenProcPtr CloseScreen; @@ -403,7 +425,7 @@ GenericGetRec(ScrnInfoPtr pScreenInfo) { if (!pScreenInfo->driverPrivate) - pScreenInfo->driverPrivate = xcalloc(sizeof(GenericRec), 1); + pScreenInfo->driverPrivate = xcalloc(sizeof(GenericRec), 1); return (GenericPtr)pScreenInfo->driverPrivate; } @@ -470,16 +492,18 @@ GenericPreInit(ScrnInfoPtr pScreenInfo, int flags) { static rgb defaultWeight = {0, 0, 0}; - static ClockRange GenericClockRange = {NULL, 0, 80000, 0, FALSE, TRUE, 1, 1, 0}; + static ClockRange GenericClockRange = + {NULL, 0, 80000, 0, FALSE, TRUE, 1, 1, 0}; MessageType From; int i, videoRam, Rounding, nModes = 0; const char *Module = NULL; - const char *Sym = NULL; + const char *Sym = NULL; vgaHWPtr pvgaHW; GenericPtr pGenericPriv; EntityInfoPtr pEnt; - if (flags & PROBE_DETECT) return FALSE; + if (flags & PROBE_DETECT) + return FALSE; /* Set the monitor */ pScreenInfo->monitor = pScreenInfo->confScreen->monitor; @@ -490,51 +514,55 @@ if (pEnt->resources) return FALSE; - if (xf86LoadSubModule(pScreenInfo, "int10")) { - xf86Int10InfoPtr pInt; - xf86LoaderReqSymLists(int10Symbols, NULL); - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "initializing int10\n"); - pInt = xf86InitInt10(pEnt->index); + if (xf86LoadSubModule(pScreenInfo, "int10")) + { + xf86Int10InfoPtr pInt; + xf86LoaderReqSymLists(int10Symbols, NULL); + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "initializing int10.\n"); + pInt = xf86ExtendedInitInt10(pEnt->index, + SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); xf86FreeInt10(pInt); } + - { - static resRange unusedmem[] = { {ResShrMemBlock,0xB0000,0xB7FFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, + static resRange unusedmem[] = { {ResShrMemBlock, 0xB0000, 0xB7FFF}, + {ResShrMemBlock, 0xB8000, 0xBFFFF}, _END }; - + /* XXX Should this be "disabled" or "unused"? */ xf86SetOperatingState(unusedmem, pEnt->index, ResUnusedOpr); } /* Determine depth, bpp, etc. */ if (!xf86SetDepthBpp(pScreenInfo, 4, 0, 4, NoDepth24Support)) - return FALSE; - pScreenInfo->chipset = (char *)xf86TokenToString(GenericChipsets, - pEnt->chipset); + return FALSE; + pScreenInfo->chipset = + (char *)xf86TokenToString(GenericChipsets, pEnt->chipset); switch (pScreenInfo->depth) { - case 1: Module = "xf1bpp"; Sym = "xf1bppScreenInit"; break; - case 4: Module = "xf4bpp"; Sym = "xf4bppScreenInit"; break; - default: Module = "fb"; break; + case 1: Module = "xf1bpp"; Sym = "xf1bppScreenInit"; break; + case 4: Module = "xf4bpp"; Sym = "xf4bppScreenInit"; break; + default: Module = "fb"; break; } + xf86PrintDepthBpp(pScreenInfo); /* Determine colour weights */ pScreenInfo->rgbBits = 6; if (!xf86SetWeight(pScreenInfo, defaultWeight, defaultWeight)) - return FALSE; + return FALSE; /* XXX: Check that returned weight is supported */ /* Determine default visual */ if (!xf86SetDefaultVisual(pScreenInfo, -1)) - return FALSE; + return FALSE; /* The gamma fields must be initialised when using the new cmap code */ - if (pScreenInfo->depth > 1) { + if (pScreenInfo->depth > 1) + { Gamma zeros = {0.0, 0.0, 0.0}; if (!xf86SetGamma(pScreenInfo, zeros)) @@ -547,51 +575,52 @@ */ if ((videoRam = pEnt->device->videoRam)) { - pScreenInfo->videoRam = videoRam; - if (pScreenInfo->depth == 8) - { - if (videoRam > 64) - pScreenInfo->videoRam = 64; - } - else - { - if (videoRam > 256) - pScreenInfo->videoRam = 256; - } - From = X_CONFIG; + pScreenInfo->videoRam = videoRam; + if (pScreenInfo->depth == 8) + { + if (videoRam > 64) + pScreenInfo->videoRam = 64; + } + else + { + if (videoRam > 256) + pScreenInfo->videoRam = 256; + } + From = X_CONFIG; } else { - if (pScreenInfo->depth == 8) - videoRam = 64; - else - videoRam = 256; - pScreenInfo->videoRam = videoRam; - From = X_DEFAULT; /* Instead of X_PROBED */ + if (pScreenInfo->depth == 8) + videoRam = 64; + else + videoRam = 256; + pScreenInfo->videoRam = videoRam; + From = X_DEFAULT; /* Instead of X_PROBED */ } + if (pScreenInfo->depth == 1) - pScreenInfo->videoRam >>= 2; + pScreenInfo->videoRam >>= 2; xf86DrvMsg(pScreenInfo->scrnIndex, From, "videoRam: %d kBytes", videoRam); if (videoRam != pScreenInfo->videoRam) - xf86ErrorF(" (using %d kBytes)", pScreenInfo->videoRam); + xf86ErrorF(" (using %d kBytes)", pScreenInfo->videoRam); xf86ErrorF(".\n"); - if (xf86RegisterResources(pEnt->index,NULL,ResNone)) + if (xf86RegisterResources(pEnt->index, NULL, ResNone)) return FALSE; - + /* Ensure vgahw entry points are available for the clock probe */ if (!xf86LoadSubModule(pScreenInfo, "vgahw")) - return FALSE; + return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); /* Allocate driver private structure */ if (!(pGenericPriv = GenericGetRec(pScreenInfo))) - return FALSE; + return FALSE; /* Ensure vgahw private structure is allocated */ if (!vgaHWGetHWRec(pScreenInfo)) - return FALSE; + return FALSE; pvgaHW = VGAHWPTR(pScreenInfo); pvgaHW->MapSize = 0x00010000; /* Standard 64kB VGA window */ @@ -603,15 +632,15 @@ if (!(pGenericPriv->Options = xalloc(sizeof(GenericOptions)))) return FALSE; memcpy(pGenericPriv->Options, GenericOptions, sizeof(GenericOptions)); - xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, + xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, pGenericPriv->Options); #ifndef __NOT_YET__ if (pScreenInfo->depth == 8) { - pScreenInfo->numClocks = 1; - pScreenInfo->clock[0] = 25175; - goto SetDefaultMode; + pScreenInfo->numClocks = 1; + pScreenInfo->clock[0] = 25175; + goto SetDefaultMode; } #endif @@ -620,66 +649,71 @@ * can be addressed. */ if ((pScreenInfo->numClocks = pEnt->device->numclocks)) + { + if (pScreenInfo->numClocks > 4) + pScreenInfo->numClocks = 4; + for (i = 0; i < pScreenInfo->numClocks; i++) + pScreenInfo->clock[i] = pEnt->device->clock[i]; + From = X_CONFIG; + } + else + if (xf86ReturnOptValBool(pGenericPriv->Options, OPTION_VGA_CLOCKS, FALSE)) + { + pScreenInfo->numClocks = 2; + pScreenInfo->clock[0] = 25175; + pScreenInfo->clock[1] = 28322; + } + else { - if (pScreenInfo->numClocks > 4) - pScreenInfo->numClocks = 4; - for (i = 0; i < pScreenInfo->numClocks; i++) - pScreenInfo->clock[i] = pEnt->device->clock[i]; - From = X_CONFIG; - } else - if (xf86ReturnOptValBool(pGenericPriv->Options,OPTION_VGA_CLOCKS,FALSE)) { - pScreenInfo->numClocks = 2; - pScreenInfo->clock[0] = 25175; - pScreenInfo->clock[1] = 28322; - } else { - xf86GetClocks(pScreenInfo, 4, GenericClockSelect, GenericProtect, - GenericBlankScreen, VGAHW_GET_IOBASE() + 0x0A, 0x08, 1, 28322); - From = X_PROBED; + xf86GetClocks(pScreenInfo, 4, + GenericClockSelect, GenericProtect, GenericBlankScreen, + pvgaHW->PIOOffset + pvgaHW->IOBase + VGA_IN_STAT_1_OFFSET, + 0x08, 1, 28322); + From = X_PROBED; } xf86ShowClocks(pScreenInfo, From); - { - /* Set the virtual X rounding (in bits) */ - if (pScreenInfo->depth == 8) - Rounding = 16 * 8; - else - Rounding = 16; - - /* - * Validate the modes. Note that the limits passed to - * xf86ValidateModes() are VGA CRTC architectural limits. - */ - pScreenInfo->maxHValue = 2080; - pScreenInfo->maxVValue = 1025; - nModes = xf86ValidateModes(pScreenInfo, - pScreenInfo->monitor->Modes, pScreenInfo->display->modes, - &GenericClockRange, NULL, 8, 2040, Rounding, 1, 1024, - pScreenInfo->display->virtualX, pScreenInfo->display->virtualY, - 0x10000, LOOKUP_CLOSEST_CLOCK | LOOKUP_CLKDIV2); + /* Set the virtual X rounding (in bits) */ + if (pScreenInfo->depth == 8) + Rounding = 16 * 8; + else + Rounding = 16; - if (nModes < 0) - return FALSE; + /* + * Validate the modes. Note that the limits passed to xf86ValidateModes() + * are VGA CRTC architectural limits. + */ + pScreenInfo->maxHValue = 2080; + pScreenInfo->maxVValue = 1025; + nModes = xf86ValidateModes(pScreenInfo, pScreenInfo->monitor->Modes, + pScreenInfo->display->modes, &GenericClockRange, + NULL, 8, 2040, Rounding, 1, 1024, + pScreenInfo->display->virtualX, + pScreenInfo->display->virtualY, 0x10000, + LOOKUP_CLOSEST_CLOCK | LOOKUP_CLKDIV2); - /* Remove invalid modes */ - xf86PruneDriverModes(pScreenInfo); - } + if (nModes < 0) + return FALSE; + + /* Remove invalid modes */ + xf86PruneDriverModes(pScreenInfo); if (!nModes || !pScreenInfo->modes) { #ifndef __NOT_YET__ SetDefaultMode: #endif - /* Set a default mode, overridding any virtual settings */ - pScreenInfo->virtualX = pScreenInfo->displayWidth = 320; - pScreenInfo->virtualY = 200; - pScreenInfo->modes = xalloc(sizeof(DisplayModeRec)); - if (!pScreenInfo->modes) - return FALSE; - *pScreenInfo->modes = GenericDefaultMode; - pScreenInfo->modes->prev = pScreenInfo->modes; - pScreenInfo->modes->next = pScreenInfo->modes; + /* Set a default mode, overridding any virtual settings */ + pScreenInfo->virtualX = pScreenInfo->displayWidth = 320; + pScreenInfo->virtualY = 200; + pScreenInfo->modes = xalloc(sizeof(DisplayModeRec)); + if (!pScreenInfo->modes) + return FALSE; + *pScreenInfo->modes = GenericDefaultMode; + pScreenInfo->modes->prev = pScreenInfo->modes; + pScreenInfo->modes->next = pScreenInfo->modes; - pScreenInfo->virtualFrom = X_DEFAULT; + pScreenInfo->virtualFrom = X_DEFAULT; } /* Set CRTC values for the modes */ @@ -694,22 +728,35 @@ /* Set display resolution */ xf86SetDpi(pScreenInfo, 0, 0); - if (xf86ReturnOptValBool(pGenericPriv->Options, OPTION_SHADOW_FB, FALSE)) { + if (xf86ReturnOptValBool(pGenericPriv->Options, OPTION_SHADOW_FB, FALSE)) + { pGenericPriv->ShadowFB = TRUE; xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - "Using \"Shadow Framebuffer\"\n"); + "Using \"Shadow Framebuffer\".\n"); } + + if (xf86ReturnOptValBool(pGenericPriv->Options, OPTION_KGA_UNIVERSAL, + FALSE)) + { + pGenericPriv->KGAUniversal = TRUE; + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "Enabling universal \"KGA\" treatment.\n"); + } + #ifdef SPECIAL_FB_BYTE_ACCESS - if (!pGenericPriv->ShadowFB && (pScreenInfo->depth == 4)) { + if (!pGenericPriv->ShadowFB && (pScreenInfo->depth == 4)) + { xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Architecture requires special FB access for this depth:" - " ShadowFB enabled\n"); - pGenericPriv->ShadowFB = TRUE; + "Architecture requires special FB access for this depth:" + " ShadowFB enabled.\n"); + pGenericPriv->ShadowFB = TRUE; } #endif - if (pGenericPriv->ShadowFB) { - pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + + if (pGenericPriv->ShadowFB) + { + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; Module = "fb"; Sym = NULL; if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) @@ -718,21 +765,21 @@ } /* Ensure depth-specific entry points are available */ - if (Module && !xf86LoadSubModule(pScreenInfo, Module)) - return FALSE; + if (Module) + { + if (!xf86LoadSubModule(pScreenInfo, Module)) + return FALSE; - if (Module) { - if (Sym) { + if (Sym) xf86LoaderReqSymbols(Sym, NULL); - } else { + else xf86LoaderReqSymLists(fbSymbols, NULL); - } } /* Only one chipset here */ if (!pScreenInfo->chipset) - pScreenInfo->chipset = (char *)GenericChipsets[0].name; - + pScreenInfo->chipset = (char *)GenericChipsets[0].name; + return TRUE; /* Tada! */ } @@ -762,36 +809,45 @@ GenericSetMode(ScrnInfoPtr pScreenInfo, DisplayModePtr pMode) { vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); + GenericPtr pGenericPriv = GenericGetRec(pScreenInfo); if (!vgaHWInit(pScreenInfo, pMode)) - return FALSE; + return FALSE; + if (pGenericPriv->KGAUniversal) + { +#define KGA_FLAGS (KGA_FIX_OVERSCAN | KGA_BE_TOT_DEC) + vgaHWHBlankKGA(pMode, &pvgaHW->ModeReg, 0, KGA_FLAGS); + vgaHWHBlankKGA(pMode, &pvgaHW->ModeReg, 0, KGA_FLAGS); +#undef KGA_FLAGS + } + pScreenInfo->vtSema = TRUE; #ifndef __NOT_YET__ if (pScreenInfo->depth == 8) { - int i; + int i; - static const CARD8 CRTC[24] = - { + static const CARD8 CRTC[24] = + { #ifndef DEBUGOVERSCAN - 0x5F, 0x4F, 0x4F, 0x80, 0x54, 0x00, 0xBE, 0x1F, - 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9C, 0x0E, 0x8F, 0x28, 0x40, 0x8F, 0xBF, 0xA3 + 0x5F, 0x4F, 0x4F, 0x80, 0x54, 0x00, 0xBE, 0x1F, + 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9C, 0x0E, 0x8F, 0x28, 0x40, 0x8F, 0xBF, 0xA3 #else /* These values make some of the overscan area visible */ - 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0xBF, 0x1F, - 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9C, 0x8E, 0x8F, 0x28, 0x40, 0x96, 0xB9, 0xA3 + 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0xBF, 0x1F, + 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9C, 0x8E, 0x8F, 0x28, 0x40, 0x96, 0xB9, 0xA3 #endif - }; + }; - /* Override vgaHW's CRTC timings */ - for (i = 0; i < 24; i++) - pvgaHW->ModeReg.CRTC[i] = CRTC[i]; + /* Override vgaHW's CRTC timings */ + for (i = 0; i < 24; i++) + pvgaHW->ModeReg.CRTC[i] = CRTC[i]; - /* Clobber any CLKDIV2 */ - pvgaHW->ModeReg.Sequencer[1] = 0x01; + /* Clobber any CLKDIV2 */ + pvgaHW->ModeReg.Sequencer[1] = 0x01; } #endif @@ -815,14 +871,14 @@ /* Save the current state and setup the current mode */ GenericSave(pScreenInfo); if (!GenericSetMode(pScreenInfo, pScreenInfo->currentMode)) - return FALSE; + return FALSE; /* Possibly blank the screen */ if (pScreen) - GenericSaveScreen(pScreen, SCREEN_SAVER_ON); + GenericSaveScreen(pScreen, SCREEN_SAVER_ON); (*pScreenInfo->AdjustFrame)(pScreenInfo->scrnIndex, - pScreenInfo->frameX0, pScreenInfo->frameY0, 0); + pScreenInfo->frameX0, pScreenInfo->frameY0, 0); return TRUE; } @@ -844,19 +900,21 @@ GenericPtr pGenericPriv = GenericGetRec(pScreenInfo); Bool Closed = TRUE; - if(pGenericPriv->ShadowPtr) + if (pGenericPriv->ShadowPtr) xfree(pGenericPriv->ShadowPtr); if (pGenericPriv && (pScreen->CloseScreen = pGenericPriv->CloseScreen)) { - pGenericPriv->CloseScreen = NULL; - Closed = (*pScreen->CloseScreen)(scrnIndex, pScreen); + pGenericPriv->CloseScreen = NULL; + Closed = (*pScreen->CloseScreen)(scrnIndex, pScreen); } - if (pScreenInfo->vtSema) { + if (pScreenInfo->vtSema) + { GenericLeaveGraphics(pScreenInfo); pScreenInfo->vtSema = FALSE; } + vgaHWUnmapMem(pScreenInfo); return Closed; @@ -877,30 +935,35 @@ vgaHWPtr pvgaHW = VGAHWPTR(pScrn); int width, height, FBPitch, left, i, j, phase; CARD8 *dst, *dstPtr, *src, *srcPtr; - + FBPitch = pScrn->displayWidth >> 3; - while(num--) { + while (num--) + { left = pbox->x1 & ~7; - width = ((pbox->x2 - left) + 7) >> 3; - height = pbox->y2 - pbox->y1; - src = pPriv->ShadowPtr + (pbox->y1 * pPriv->ShadowPitch) + (left >> 3); - dst = (CARD8*)pvgaHW->Base + (pbox->y1 * FBPitch) + (left >> 3); + width = ((pbox->x2 - left) + 7) >> 3; + height = pbox->y2 - pbox->y1; + src = pPriv->ShadowPtr + (pbox->y1 * pPriv->ShadowPitch) + (left >> 3); + dst = (CARD8*)pvgaHW->Base + (pbox->y1 * FBPitch) + (left >> 3); - if((phase = (long)dst & 3L)) { + if ((phase = (long)dst & 3L)) + { phase = 4 - phase; - if(phase > width) phase = width; + if (phase > width) + phase = width; width -= phase; } - while(height--) { + while (height--) + { dstPtr = dst; srcPtr = src; i = width; j = phase; - while(j--) - *dstPtr++ = byte_reversed[*srcPtr++]; - while(i >= 4) { + while (j--) + *dstPtr++ = byte_reversed[*srcPtr++]; + while (i >= 4) + { *((CARD32*)dstPtr) = byte_reversed[srcPtr[0]] | (byte_reversed[srcPtr[1]] << 8) | (byte_reversed[srcPtr[2]] << 16) | @@ -909,16 +972,16 @@ dstPtr += 4; i -= 4; } - while(i--) - *dstPtr++ = byte_reversed[*srcPtr++]; - dst += FBPitch; - src += pPriv->ShadowPitch; - } - - pbox++; + while (i--) + *dstPtr++ = byte_reversed[*srcPtr++]; + dst += FBPitch; + src += pPriv->ShadowPitch; + } + + pbox++; } -} +} #ifndef SPECIAL_FB_BYTE_ACCESS @@ -932,7 +995,7 @@ CARD8 s1, s2, s3, s4; CARD32 *src, *srcPtr; CARD8 *dst, *dstPtr; - + FBPitch = pScrn->displayWidth >> 3; SRCPitch = pPriv->ShadowPitch >> 2; @@ -940,47 +1003,53 @@ (*pvgaHW->writeGr)(pvgaHW, 0x01, 0x00); (*pvgaHW->writeGr)(pvgaHW, 0x08, 0xFF); - while(num--) { + while (num--) + { left = pbox->x1 & ~7; - width = ((pbox->x2 - left) + 7) >> 3; - height = pbox->y2 - pbox->y1; - src = (CARD32*)pPriv->ShadowPtr + (pbox->y1 * SRCPitch) + (left >> 2); - dst = (CARD8*)pvgaHW->Base + (pbox->y1 * FBPitch) + (left >> 3); + width = ((pbox->x2 - left) + 7) >> 3; + height = pbox->y2 - pbox->y1; + src = (CARD32*)pPriv->ShadowPtr + (pbox->y1 * SRCPitch) + (left >> 2); + dst = (CARD8*)pvgaHW->Base + (pbox->y1 * FBPitch) + (left >> 3); - if((phase = (long)dst & 3L)) { + if ((phase = (long)dst & 3L)) + { phase = 4 - phase; - if(phase > width) phase = width; + if (phase > width) phase = width; width -= phase; } - while(height--) { + while (height--) + { (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1); dstPtr = dst; srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); - *dstPtr++ = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + *dstPtr++ = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); - s1 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s1 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); m = (srcPtr[3] & 0x01010101) | ((srcPtr[2] & 0x01010101) << 4); - s2 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s2 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); m = (srcPtr[5] & 0x01010101) | ((srcPtr[4] & 0x01010101) << 4); - s3 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s3 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); m = (srcPtr[7] & 0x01010101) | ((srcPtr[6] & 0x01010101) << 4); - s4 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s4 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); *((CARD32*)dstPtr) = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); - *dstPtr++ = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + *dstPtr++ = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); srcPtr += 2; } @@ -989,28 +1058,31 @@ srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); - *dstPtr++ = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + *dstPtr++ = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); - s1 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s1 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); m = (srcPtr[3] & 0x02020202) | ((srcPtr[2] & 0x02020202) << 4); - s2 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s2 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); m = (srcPtr[5] & 0x02020202) | ((srcPtr[4] & 0x02020202) << 4); - s3 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s3 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); m = (srcPtr[7] & 0x02020202) | ((srcPtr[6] & 0x02020202) << 4); - s4 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s4 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); *((CARD32*)dstPtr) = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); - *dstPtr++ = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + *dstPtr++ = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); srcPtr += 2; } @@ -1019,71 +1091,77 @@ srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); - *dstPtr++ = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + *dstPtr++ = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); - s1 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s1 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); m = (srcPtr[3] & 0x04040404) | ((srcPtr[2] & 0x04040404) << 4); - s2 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s2 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); m = (srcPtr[5] & 0x04040404) | ((srcPtr[4] & 0x04040404) << 4); - s3 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s3 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); m = (srcPtr[7] & 0x04040404) | ((srcPtr[6] & 0x04040404) << 4); - s4 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s4 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); *((CARD32*)dstPtr) = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); - *dstPtr++ = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + *dstPtr++ = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); srcPtr += 2; } - + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 3); dstPtr = dst; srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); - *dstPtr++ = (m >> 27) | (m >> 18) | (m >> 9) | m; + *dstPtr++ = (m >> 27) | (m >> 18) | (m >> 9) | m; srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); - s1 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s1 = (m >> 27) | (m >> 18) | (m >> 9) | m; m = (srcPtr[3] & 0x08080808) | ((srcPtr[2] & 0x08080808) << 4); - s2 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s2 = (m >> 27) | (m >> 18) | (m >> 9) | m; m = (srcPtr[5] & 0x08080808) | ((srcPtr[4] & 0x08080808) << 4); - s3 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s3 = (m >> 27) | (m >> 18) | (m >> 9) | m; m = (srcPtr[7] & 0x08080808) | ((srcPtr[6] & 0x08080808) << 4); - s4 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s4 = (m >> 27) | (m >> 18) | (m >> 9) | m; *((CARD32*)dstPtr) = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); - *dstPtr++ = (m >> 27) | (m >> 18) | (m >> 9) | m; + *dstPtr++ = (m >> 27) | (m >> 18) | (m >> 9) | m; srcPtr += 2; } + + dst += FBPitch; + src += SRCPitch; + } - dst += FBPitch; - src += SRCPitch; - } - - pbox++; + pbox++; } -} +} -#else +#else static void GenericRefreshArea4bpp(ScrnInfoPtr pScrn, int num, BoxPtr pbox) @@ -1095,7 +1173,7 @@ CARD8 s1, s2, s3, s4; CARD32 *src, *srcPtr; int dst, dstPtr; - + FBPitch = pScrn->displayWidth >> 3; SRCPitch = pPriv->ShadowPitch >> 2; @@ -1103,49 +1181,55 @@ (*pvgaHW->writeGr)(pvgaHW, 0x01, 0x00); (*pvgaHW->writeGr)(pvgaHW, 0x08, 0xFF); - while(num--) { + while (num--) + { left = pbox->x1 & ~7; - width = ((pbox->x2 - left) + 7) >> 3; - height = pbox->y2 - pbox->y1; - src = (CARD32*)pPriv->ShadowPtr + (pbox->y1 * SRCPitch) + (left >> 2); - dst = (pbox->y1 * FBPitch) + (left >> 3); + width = ((pbox->x2 - left) + 7) >> 3; + height = pbox->y2 - pbox->y1; + src = (CARD32*)pPriv->ShadowPtr + (pbox->y1 * SRCPitch) + (left >> 2); + dst = (pbox->y1 * FBPitch) + (left >> 3); - if((phase = (long)dst & 3L)) { + if ((phase = (long)dst & 3L)) + { phase = 4 - phase; - if(phase > width) phase = width; + if (phase > width) phase = width; width -= phase; } - while(height--) { + while (height--) + { (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1); dstPtr = dst; srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 24) | (m >> 15) | (m >> 6) | (m << 3)); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); - s1 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s1 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); m = (srcPtr[3] & 0x01010101) | ((srcPtr[2] & 0x01010101) << 4); - s2 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s2 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); m = (srcPtr[5] & 0x01010101) | ((srcPtr[4] & 0x01010101) << 4); - s3 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + s3 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); m = (srcPtr[7] & 0x01010101) | ((srcPtr[6] & 0x01010101) << 4); - s4 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); - MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s4 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + MMIO_OUT32((CARD32*)pvgaHW->Base, dstPtr, s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 24) | (m >> 15) | (m >> 6) | (m << 3)); srcPtr += 2; } @@ -1155,30 +1239,33 @@ srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 25) | (m >> 16) | (m >> 7) | (m << 2)); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); - s1 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s1 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); m = (srcPtr[3] & 0x02020202) | ((srcPtr[2] & 0x02020202) << 4); - s2 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s2 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); m = (srcPtr[5] & 0x02020202) | ((srcPtr[4] & 0x02020202) << 4); - s3 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + s3 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); m = (srcPtr[7] & 0x02020202) | ((srcPtr[6] & 0x02020202) << 4); - s4 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); - MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s4 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + MMIO_OUT32((CARD32*)pvgaHW->Base, dstPtr, s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 25) | (m >> 16) | (m >> 7) | (m << 2)); srcPtr += 2; } @@ -1188,75 +1275,80 @@ srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 26) | (m >> 17) | (m >> 8) | (m << 1)); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); - s1 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s1 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); m = (srcPtr[3] & 0x04040404) | ((srcPtr[2] & 0x04040404) << 4); - s2 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s2 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); m = (srcPtr[5] & 0x04040404) | ((srcPtr[4] & 0x04040404) << 4); - s3 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + s3 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); m = (srcPtr[7] & 0x04040404) | ((srcPtr[6] & 0x04040404) << 4); - s4 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); - MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s4 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + MMIO_OUT32((CARD32*)pvgaHW->Base, dstPtr, s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 26) | (m >> 17) | (m >> 8) | (m << 1)); srcPtr += 2; } - + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 3); dstPtr = dst; srcPtr = src; i = width; j = phase; - while(j--) { + while (j--) + { m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 27) | (m >> 18) | (m >> 9) | m); srcPtr += 2; } - while(i >= 4) { + while (i >= 4) + { m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); - s1 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s1 = (m >> 27) | (m >> 18) | (m >> 9) | m; m = (srcPtr[3] & 0x08080808) | ((srcPtr[2] & 0x08080808) << 4); - s2 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s2 = (m >> 27) | (m >> 18) | (m >> 9) | m; m = (srcPtr[5] & 0x08080808) | ((srcPtr[4] & 0x08080808) << 4); - s3 = (m >> 27) | (m >> 18) | (m >> 9) | m; + s3 = (m >> 27) | (m >> 18) | (m >> 9) | m; m = (srcPtr[7] & 0x08080808) | ((srcPtr[6] & 0x08080808) << 4); - s4 = (m >> 27) | (m >> 18) | (m >> 9) | m; - MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s4 = (m >> 27) | (m >> 18) | (m >> 9) | m; + MMIO_OUT32((CARD32*)pvgaHW->Base, dstPtr, s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); srcPtr += 8; dstPtr += 4; i -= 4; } - while(i--) { + while (i--) + { m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); - MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + MMIO_OUT8((CARD8*)pvgaHW->Base, dstPtr++, (m >> 27) | (m >> 18) | (m >> 9) | m); srcPtr += 2; } - dst += FBPitch; - src += SRCPitch; - } - - pbox++; - } + dst += FBPitch; + src += SRCPitch; + } -} + pbox++; + } +} #endif /* SPECIAL_FB_BYTE_ACCESS */ @@ -1274,17 +1366,19 @@ /* Map VGA aperture */ #ifdef SPECIAL_FB_BYTE_ACCESS - if (pGenericPriv->ShadowFB && (pScreenInfo->depth == 4)) { + if (pGenericPriv->ShadowFB && (pScreenInfo->depth == 4)) + { if (!GenericMapMem(pScreenInfo)) return FALSE; - } else + } + else #endif if (!vgaHWMapMem(pScreenInfo)) return FALSE; /* Initialise graphics mode */ if (!GenericEnterGraphics(pScreen, pScreenInfo)) - return FALSE; + return FALSE; /* Get vgahw private */ pvgaHW = VGAHWPTR(pScreenInfo); @@ -1301,16 +1395,17 @@ /* Initialise the framebuffer */ switch (pScreenInfo->depth) { - case 1: - if (pGenericPriv->ShadowFB) { - pGenericPriv->ShadowPitch = - ((pScreenInfo->virtualX + 31) >> 3) & ~3L; - pGenericPriv->ShadowPtr = xalloc(pGenericPriv->ShadowPitch * - pScreenInfo->virtualY); - if(pGenericPriv->ShadowPtr == NULL) + case 1: + if (pGenericPriv->ShadowFB) + { + pGenericPriv->ShadowPitch = + ((pScreenInfo->virtualX + 31) >> 3) & ~3L; + pGenericPriv->ShadowPtr = + xalloc(pGenericPriv->ShadowPitch * pScreenInfo->virtualY); + if (pGenericPriv->ShadowPtr == NULL) return FALSE; Inited = fbScreenInit(pScreen, pGenericPriv->ShadowPtr, - pScreenInfo->virtualX, + pScreenInfo->virtualX, pScreenInfo->virtualY, pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth, @@ -1321,25 +1416,28 @@ fbPictureInit (pScreen, 0, 0); #endif ShadowFBInit(pScreen, GenericRefreshArea1bpp); - } else { + } + else + { Inited = xf1bppScreenInit(pScreen, pvgaHW->Base, - pScreenInfo->virtualX, + pScreenInfo->virtualX, pScreenInfo->virtualY, pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth); } - break; - case 4: - if (pGenericPriv->ShadowFB) { - /* in order to use ShadowFB we do depth 4 / bpp 8 */ + break; + case 4: + if (pGenericPriv->ShadowFB) + { + /* In order to use ShadowFB we do depth 4 / bpp 8 */ pScreenInfo->bitsPerPixel = 8; pGenericPriv->ShadowPitch = (pScreenInfo->virtualX + 3) & ~3L; - pGenericPriv->ShadowPtr = xalloc(pGenericPriv->ShadowPitch * - pScreenInfo->virtualY); - if(pGenericPriv->ShadowPtr == NULL) + pGenericPriv->ShadowPtr = + xalloc(pGenericPriv->ShadowPitch * pScreenInfo->virtualY); + if (pGenericPriv->ShadowPtr == NULL) return FALSE; Inited = fbScreenInit(pScreen, pGenericPriv->ShadowPtr, - pScreenInfo->virtualX, + pScreenInfo->virtualX, pScreenInfo->virtualY, pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth, @@ -1350,16 +1448,18 @@ fbPictureInit (pScreen, 0, 0); #endif ShadowFBInit(pScreen, GenericRefreshArea4bpp); - } else { + } + else + { Inited = xf4bppScreenInit(pScreen, pvgaHW->Base, - pScreenInfo->virtualX, + pScreenInfo->virtualX, pScreenInfo->virtualY, pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth); } - break; - case 8: - Inited = fbScreenInit(pScreen, pvgaHW->Base, + break; + case 8: + Inited = fbScreenInit(pScreen, pvgaHW->Base, pScreenInfo->virtualX, pScreenInfo->virtualY, pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth, @@ -1367,11 +1467,16 @@ #ifdef RENDER fbPictureInit (pScreen, 0, 0); #endif - break; + break; + default: + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Depth %i not supported by this driver\n", + pScreenInfo->depth); + break; } if (!Inited) - return FALSE; + return FALSE; miInitializeBackingStore(pScreen); @@ -1385,7 +1490,7 @@ /* Try the new code based on the new colormap layer */ if (pScreenInfo->depth > 1) - vgaHWHandleColormaps(pScreen); + vgaHWHandleColormaps(pScreen); xf86DPMSInit(pScreen, GenericDPMSSet, 0); @@ -1395,7 +1500,7 @@ pScreen->SaveScreen = GenericSaveScreen; if (!Inited) - GenericCloseScreen(scrnIndex, pScreen); + GenericCloseScreen(scrnIndex, pScreen); pScreenInfo->racIoFlags = RAC_COLORMAP | RAC_VIEWPORT; if (pScreenInfo->depth < 8) @@ -1419,12 +1524,14 @@ GenericAdjustFrame(int scrnIndex, int x, int y, int flags) { # ifndef PC98_EGC - ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; - vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); - int Base = (y * pScreenInfo->displayWidth + x) >> 3; - - outw(pvgaHW->IOBase + 4, (Base & 0x00FF00) | 0x0C); - outw(pvgaHW->IOBase + 4, ((Base & 0x0000FF) << 8) | 0x0D); + ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + vgaHWPtr pvgaHW = VGAHWPTR(pScreenInfo); + int Base = (y * pScreenInfo->displayWidth + x) >> 3; + + outw(pvgaHW->PIOOffset + pvgaHW->IOBase + 4, + (Base & 0x00FF00) | 0x0C); + outw(pvgaHW->PIOOffset + pvgaHW->IOBase + 4, + ((Base & 0x0000FF) << 8) | 0x0D); # endif } @@ -1454,7 +1561,7 @@ GenericValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags) { if (pMode->Flags & V_INTERLACE) - return MODE_NO_INTERLACE; + return MODE_NO_INTERLACE; return MODE_OK; } @@ -1466,7 +1573,7 @@ { vgaHWPtr hwp = VGAHWPTR(scrp); int scr_index = scrp->scrnIndex; - + if (hwp->Base) return TRUE; @@ -1476,8 +1583,8 @@ if (hwp->MapPhys == 0) hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR; - hwp->Base = xf86MapVidMem(scr_index, VIDMEM_MMIO, - hwp->MapPhys, hwp->MapSize); + hwp->Base = xf86MapDomainMemory(scr_index, VIDMEM_MMIO, hwp->Tag, + hwp->MapPhys, hwp->MapSize); return hwp->Base != NULL; } Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile:1.2 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile Mon Feb 17 12:06:45 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile,v 1.2 2001/05/16 06:48:12 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile,v 1.6 2003/02/17 17:06:45 dawes Exp $ XCOMM XCOMM This is an Imakefile for the VMware virtual SVGA driver. XCOMM @@ -6,15 +6,9 @@ #define IHaveModules #include <Server.tmpl> -SRCS = vmware.c vmwaregc.c vmwarefs.c vmwarepolypnt.c vmwarepush.c \ - vmwareglblt.c vmwaretext.c vmwarerect.c vmwarefillarc.c \ - vmwareply1rct.c vmwarezerarc.c vmwareline.c vmwareblt.c vmwareimage.c \ - vmwarewindow.c vmwarecurs.c vmwarebstor.c bits2pixels.c +SRCS = vmware.c vmwarecurs.c vmwarexaa.c bits2pixels.c offscreen_manager.c -OBJS = vmware.o vmwaregc.o vmwarefs.o vmwarepolypnt.o vmwarepush.o \ - vmwareglblt.o vmwaretext.o vmwarerect.o vmwarefillarc.o \ - vmwareply1rct.o vmwarezerarc.o vmwareline.o vmwareblt.o vmwareimage.o \ - vmwarewindow.o vmwarecurs.o vmwarebstor.o bits2pixels.o +OBJS = vmware.o vmwarecurs.o vmwarexaa.o bits2pixels.o offscreen_manager.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -27,7 +21,7 @@ -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) \ - -I$(XF86OSSRC)/vbe $(DRIINCLUDES) + -I$(XF86SRC)/vbe $(DRIINCLUDES) #endif DEFINES = $(DRIDEFINES) Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/README diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.4 xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.4 Mon Dec 17 15:52:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/README Wed Oct 16 18:12:53 2002 @@ -1,5 +1,5 @@ -Copyright (C) 1999-2001 VMware, Inc. +Copyright (C) 1999-2002 VMware, Inc. All Rights Reserved The code here may be used/distributed under the terms of the standard @@ -254,6 +254,8 @@ SVGA_CMD_DISPLAY_CURSOR SVGA_CAP_CURSOR SVGA_CMD_MOVE_CURSOR SVGA_CAP_CURSOR SVGA_CMD_DEFINE_ALPHA_CURSOR SVGA_CAP_ALPHA_CURSOR + SVGA_CMD_DRAW_GLYPH SVGA_CAP_GLYPH + SVGA_CMD_DRAW_GLYPH_CLIPPED SVGA_CAP_GLYPH_CLIPPING Note: SVGA_CMD_DISPLAY_CURSOR and SVGA_CMD_MOVE_CURSOR should not be used. Drivers wishing hardware cursor support should use cursor bypass (see below). @@ -289,6 +291,19 @@ SVGA_REG_HOST_BITS_PER_PIXEL and a driver should assume SVGA_REG_BITS_PER_PIXEL is both read-only and initialized to the only available value if SVGA_CAP_8BIT_EMULATION is not set. + + SVGA_CAP_OFFSCREEN_1 + SVGA_CMD_RECT_FILL, SVGA_CMD_RECT_COPY, SVGA_CMD_RECT_ROP_FILL, + SVGA_CMD_RECT_ROP_COPY can operate with a source or destination (or + both) in offscreen memory. + + Usable offscreen memory is a rectangle located below the last scanline + of the visible memory: + x1 = 0 + y1 = (SVGA_REG_FB_SIZE + SVGA_REG_BYTES_PER_LINE - 1) / + SVGA_REG_BYTES_PER_LINE + x2 = SVGA_REG_BYTES_PER_LINE / SVGA_REG_DEPTH + y2 = SVGA_REG_VRAM_SIZE / SVGA_REG_BYTES_PER_LINE Cursor Handling @@ -351,6 +366,8 @@ Version 10.5 - [Never released or well defined] Version 10.6 - The version that knows about SVGA_CAP_8BIT_EMULATION Version 10.7 - The version that knows about SVGA_CAP_ALPHA_CURSOR +Version 10.8 - The version that knows about SVGA_CAP_GLYPH +Version 10.9 - The version that knows about SVGA_CAP_OFFSCREEN_1 Note that this is merely the convention used by SVGA drivers written and maintained by VMware, Inc. and describes the capabilities of the driver, not @@ -512,4 +529,14 @@ SVGA hardware will never put the hardware cursor in the framebuffer while in window mode, so everything will appear to work correctly there. -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.4 2001/12/17 20:52:35 dawes Exp $ + +8. Why do my accelerated glyphs look funny? OR Why does the fifo complain +about invalid commands when I draw accelerated glyphs? + +The bitmap data passed to SVGA_CMD_DRAW_GLYPH_* must not have any per-scanline +alignment. If there are any remaining bits left in the last byte of a scanline, +the first bits of the next scanline should use them. + +The bitmap data as a whole must be 4 byte aligned. + +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.5 2002/10/16 22:12:53 alanh Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c:1.1 Thu Apr 5 15:29:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c Wed Dec 11 12:07:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c,v 1.1 2001/04/05 19:29:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c,v 1.2 2002/12/11 17:07:58 dawes Exp $ */ /* ********************************************************** * Copyright (C) 1999-2001 VMware, Inc. * All Rights Reserved @@ -23,19 +23,19 @@ * Local functions */ -void RasterBitsToPixels8(uint8 *bits, uint32 bits_increment, +static void RasterBitsToPixels8(uint8 *bits, uint32 bits_increment, uint8 *pix, uint32 pix_increment, uint32 width, uint32 height, uint32 fg, uint32 bg); -void RasterBitsToPixels16(uint8 *bits, uint32 bits_increment, +static void RasterBitsToPixels16(uint8 *bits, uint32 bits_increment, uint8 *pix, uint32 pix_increment, uint32 width, uint32 height, uint32 fg, uint32 bg); -void RasterBitsToPixels24(uint8 *bits, uint32 bits_increment, +static void RasterBitsToPixels24(uint8 *bits, uint32 bits_increment, uint8 *pix, uint32 pix_increment, uint32 width, uint32 height, uint32 fg, uint32 bg); -void RasterBitsToPixels32(uint8 *bits, uint32 bits_increment, +static void RasterBitsToPixels32(uint8 *bits, uint32 bits_increment, uint8 *pix, uint32 pix_increment, uint32 width, uint32 height, uint32 fg, uint32 bg); @@ -43,7 +43,7 @@ /* *---------------------------------------------------------------------- * - * Raster_BitsToPixels -- + * vmwareRaster_BitsToPixels -- * * Convert a bitmap to a pixmap, converting 1 bits to the foreground * color (fg) and 0 bits to the background color (bg). @@ -58,7 +58,7 @@ */ void -Raster_BitsToPixels(uint8 *bits, uint32 bits_increment, +vmwareRaster_BitsToPixels(uint8 *bits, uint32 bits_increment, uint8 *pix, uint32 pix_increment, int bytes_per_pixel, uint32 width, uint32 height, uint32 fg, uint32 bg) { Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h Wed Dec 11 12:07:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h,v 1.2 2002/12/11 17:07:58 dawes Exp $ */ /* ********************************************************** * Copyright (C) 1999-2001 VMware, Inc. * All Rights Reserved @@ -18,8 +18,8 @@ #include "includeCheck.h" void -Raster_BitsToPixels(uint8 *bits, uint32 bits_increment, - uint8 *pix, uint32 pix_increment, int bytes_per_pixel, - uint32 width, uint32 height, uint32 fg, uint32 bg); +vmwareRaster_BitsToPixels(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, int bytes_per_pixel, + uint32 width, uint32 height, uint32 fg, uint32 bg); #endif /* _BITS4PIXELS_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h:1.2 Fri Apr 6 13:44:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h Wed Oct 16 18:12:53 2002 @@ -1,2 +1,3 @@ /* This space intentionally left blank. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h,v 1.2 2001/04/06 17:44:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h,v 1.3 2002/10/16 22:12:53 alanh Exp $ */ + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.c:1.2 --- /dev/null Thu Feb 27 12:31:47 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.c Wed Dec 11 12:07:58 2002 @@ -0,0 +1,132 @@ +/* ********************************************************** + * Copyright (C) 1998-2002 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.c,v 1.2 2002/12/11 17:07:58 dawes Exp $ */ + +#include "vmware.h" + +struct _Heap { + CARD8* ptr; + CARD32 size; + CARD32 maxSlots; + CARD32 startOffset; + SVGASurface* frontBuffer; + SVGASurface* slotsStart; + Bool clear; +}; + +static SVGASurface* FillInSurface(Heap* heap, SVGASurface* surface, + CARD32 width, CARD32 height, + CARD32 bpp, CARD32 pitch, CARD32 size, + CARD32 sizeUsed); + +Heap* +vmwareHeap_Create(CARD8* ptr, CARD32 size, CARD32 maxSlots, CARD32 startOffset, + CARD32 sWidth, CARD32 sHeight, CARD32 sBPP, CARD32 sPitch, + CARD32 sFbOffset) +{ + Heap* newHeap = malloc(sizeof (Heap)); + + newHeap->ptr = ptr; + newHeap->size = size - sizeof(SVGASurface); /* leave room for frontbuffer */ + newHeap->maxSlots = maxSlots; + newHeap->startOffset = startOffset; + + newHeap->frontBuffer = FillInSurface(newHeap, + (SVGASurface*)(ptr + newHeap->size), + sWidth, sHeight, sBPP, sPitch, + sHeight * sPitch, 0); + newHeap->frontBuffer->dataOffset = sFbOffset; + newHeap->frontBuffer->numQueued = newHeap->frontBuffer->numDequeued = 0; + + newHeap->slotsStart = (SVGASurface*)(newHeap->ptr + newHeap->size) - + newHeap->maxSlots; + newHeap->clear = FALSE; + vmwareHeap_Clear(newHeap); + + return newHeap; +} + +void +vmwareHeap_Destroy(Heap* heap) +{ + free(heap); +} + +void +vmwareHeap_Clear(Heap* heap) +{ + if (!heap->clear) { + memset(heap->slotsStart, 0, heap->maxSlots * sizeof (SVGASurface)); + heap->clear = TRUE; + } +} + +static SVGASurface* +FillInSurface(Heap* heap, SVGASurface* surface, CARD32 width, CARD32 height, + CARD32 bpp, CARD32 pitch, CARD32 size, CARD32 offset) +{ + surface->size = sizeof (SVGASurface); + surface->version = SVGA_SURFACE_VERSION_1; + surface->bpp = bpp; + surface->width = width; + surface->height = height; + surface->pitch = pitch; + if (surface->userData == 0) { + /* + * We allocate exactly what we need the first time we use a slot, so + * all reuses of this slot will be equal or smaller. + */ + surface->userData = size; + } + surface->dataOffset = offset + heap->startOffset; + + return surface; +} + +SVGASurface* +vmwareHeap_GetFrontBuffer(Heap* heap) +{ + return heap->frontBuffer; +} + +SVGASurface* +vmwareHeap_AllocSurface(Heap* heap, CARD32 width, CARD32 height, + CARD32 pitch, CARD32 bpp) +{ + CARD32 size = pitch * height; + CARD32 sizeUsed = 0; + SVGASurface* surface = heap->slotsStart; + int i; + + /* + * NOTE: we use SVGASurface::userData to store the largest this slot's + * size has ever been, since we don't ever compact anything. + */ + + /* find a free slot that's big enough */ + for (i = 0; i < heap->maxSlots; i++) { + if (surface[i].userData == 0) { /* this surface has never been used */ + if ((CARD8*)heap->slotsStart - heap->ptr - sizeUsed < size) { + /* no room left for data*/ + return NULL; + } + + heap->clear = FALSE; + return FillInSurface(heap, surface + i, width, height, bpp, + pitch, size, sizeUsed); + } + + if (surface[i].numQueued == surface[i].numDequeued && + surface[i].userData >= size) { /* free and big enough, sweet! */ + heap->clear = FALSE; + return FillInSurface(heap, surface + i, width, height, bpp, + pitch, size, sizeUsed); + } + + sizeUsed += surface[i].userData; + } + + return NULL; +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.h:1.2 --- /dev/null Thu Feb 27 12:31:47 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.h Wed Dec 11 12:07:58 2002 @@ -0,0 +1,25 @@ +/* ********************************************************** + * Copyright (C) 1998-2002 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/offscreen_manager.h,v 1.2 2002/12/11 17:07:58 dawes Exp $ */ + +#ifndef OFFSCREEN_MANAGER_H +#define OFFSCREEN_MANAGER_H + +struct _Heap; +typedef struct _Heap Heap; + +extern Heap* vmwareHeap_Create(CARD8* ptr, CARD32 size, CARD32 maxSlots, + CARD32 startOffset, CARD32 sWidth, CARD32 sHeight, + CARD32 sBPP, CARD32 sPitch, CARD32 sFbOffset); +extern void vmwareHeap_Destroy(Heap* heap); + +extern void vmwareHeap_Clear(Heap* heap); + +extern SVGASurface* vmwareHeap_GetFrontBuffer(Heap* heap); + +extern SVGASurface* vmwareHeap_AllocSurface(Heap* heap, CARD32 width, CARD32 height, + CARD32 pitch, CARD32 bpp); + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h Wed Oct 16 18:12:53 2002 @@ -1,12 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h,v 1.2 2002/10/16 22:12:53 alanh Exp $ */ /* ********************************************************** * Copyright (C) 1998-2001 VMware, Inc. * All Rights Reserved - * Id: svga_limits.h,v 1.8 2001/01/26 23:32:15 yoel Exp $ + * $Id: svga_limits.h,v 1.10 2002/06/26 22:26:22 tonyc Exp $ * **********************************************************/ /* - * svga_reg.h -- + * svga_limits.h -- * * SVGA limits */ @@ -19,9 +19,9 @@ #include "includeCheck.h" /* - * Location and size of SVGA frame buffer. + * Location and size of SVGA frame buffer and the FIFO. */ -#define SVGA_FB_MAX_SIZE (16*1024*1024) +#define SVGA_VRAM_SIZE (16*1024*1024) #define SVGA_MEM_SIZE (256*1024) /* Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.4 Thu Sep 13 04:36:24 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h Mon Feb 3 20:39:53 2003 @@ -1,8 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.4 2001/09/13 08:36:24 alanh Exp $ */ /* ********************************************************** * Copyright (C) 1998-2001 VMware, Inc. * All Rights Reserved - * $Id: svga_reg.h,v 1.16 2001/07/25 22:41:24 mgoodman Exp $ + * $Id: svga_reg.h,v 1.26 2002/08/26 16:36:55 tonyc Exp $ * **********************************************************/ /* @@ -10,6 +9,7 @@ * * SVGA hardware definitions */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.8 2003/02/04 01:39:53 dawes Exp $ */ #ifndef _SVGA_REG_H_ #define _SVGA_REG_H_ @@ -24,20 +24,20 @@ * Memory and port addresses and fundamental constants */ -#define SVGA_MAX_WIDTH 2364 -#define SVGA_MAX_HEIGHT 1773 +/* + * Note-- MAX_WIDTH and MAX_HEIGHT are largely ignored by the code. This + * isn't such a bad thing for forward compatibility. --Jeremy. + */ +#define SVGA_MAX_WIDTH 2360 +#define SVGA_MAX_HEIGHT 1770 +#define SVGA_MAX_BITS_PER_PIXEL 32 -#ifdef VMX86_SERVER -#define SVGA_DEFAULT_MAX_WIDTH 1600 -#define SVGA_DEFAULT_MAX_HEIGHT 1200 -#else -#define SVGA_DEFAULT_MAX_WIDTH SVGA_MAX_WIDTH -#define SVGA_DEFAULT_MAX_HEIGHT SVGA_MAX_HEIGHT -#endif +#define PAGE_SHIFT 12 +#define SVGA_FB_MAX_SIZE \ + ((((SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * \ + SVGA_MAX_BITS_PER_PIXEL / 8) >> PAGE_SHIFT) + 1) << PAGE_SHIFT) -#define SVGA_MAX_BITS_PER_PIXEL 32 -#if SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * SVGA_MAX_BITS_PER_PIXEL / 8 > \ - SVGA_FB_MAX_SIZE +#if SVGA_FB_MAX_SIZE > SVGA_VRAM_SIZE #error "Bad SVGA maximum sizes" #endif #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 @@ -101,7 +101,7 @@ SVGA_REG_BYTES_PER_LINE = 12, SVGA_REG_FB_START = 13, SVGA_REG_FB_OFFSET = 14, - SVGA_REG_FB_MAX_SIZE = 15, + SVGA_REG_VRAM_SIZE = 15, SVGA_REG_FB_SIZE = 16, SVGA_REG_CAPABILITIES = 17, @@ -127,16 +127,21 @@ * Capabilities */ -#define SVGA_CAP_RECT_FILL 0x0001 -#define SVGA_CAP_RECT_COPY 0x0002 -#define SVGA_CAP_RECT_PAT_FILL 0x0004 -#define SVGA_CAP_OFFSCREEN 0x0008 -#define SVGA_CAP_RASTER_OP 0x0010 -#define SVGA_CAP_CURSOR 0x0020 -#define SVGA_CAP_CURSOR_BYPASS 0x0040 -#define SVGA_CAP_CURSOR_BYPASS_2 0x0080 -#define SVGA_CAP_8BIT_EMULATION 0x0100 -#define SVGA_CAP_ALPHA_CURSOR 0x0200 +#define SVGA_CAP_NONE 0x0000 +#define SVGA_CAP_RECT_FILL 0x0001 +#define SVGA_CAP_RECT_COPY 0x0002 +#define SVGA_CAP_RECT_PAT_FILL 0x0004 +#define SVGA_CAP_LEGACY_OFFSCREEN 0x0008 +#define SVGA_CAP_RASTER_OP 0x0010 +#define SVGA_CAP_CURSOR 0x0020 +#define SVGA_CAP_CURSOR_BYPASS 0x0040 +#define SVGA_CAP_CURSOR_BYPASS_2 0x0080 +#define SVGA_CAP_8BIT_EMULATION 0x0100 +#define SVGA_CAP_ALPHA_CURSOR 0x0200 +#define SVGA_CAP_GLYPH 0x0400 +#define SVGA_CAP_GLYPH_CLIPPING 0x0800 +#define SVGA_CAP_OFFSCREEN_1 0x1000 +#define SVGA_CAP_ALPHA_BLEND 0x2000 /* @@ -162,9 +167,75 @@ #define SVGA_ROP_UNSUPPORTED 0x10 #define SVGA_NUM_SUPPORTED_ROPS 16 -#define SVGA_ROP_ALL 0x0000ffff +#define SVGA_ROP_ALL (MASK(SVGA_NUM_SUPPORTED_ROPS)) +#define SVGA_IS_VALID_ROP(rop) (rop >= 0 && rop < SVGA_NUM_SUPPORTED_ROPS) /* + * Ops + * For each pixel, the four channels of the image are computed with: + * + * C = Ca * Fa + Cb * Fb + * + * where C, Ca, Cb are the values of the respective channels and Fa + * and Fb come from the following table: + * + * BlendOp Fa Fb + * ------------------------------------------ + * Clear 0 0 + * Src 1 0 + * Dst 0 1 + * Over 1 1-Aa + * OverReverse 1-Ab 1 + * In Ab 0 + * InReverse 0 Aa + * Out 1-Ab 0 + * OutReverse 0 1-Aa + * Atop Ab 1-Aa + * AtopReverse 1-Ab Aa + * Xor 1-Ab 1-Aa + * Add 1 1 + * Saturate min(1,(1-Ab)/Aa) 1 + * + * Flags + * You can use the following flags to achieve additional affects: + * + * Flag Effect + * ------------------------------------------ + * ConstantSourceAlpha Ca = Ca * Param0 + * ConstantDestAlpha Cb = Cb * Param1 + * + * Flag effects resolve before the op. For example + * BlendOp == Add && Flags == ConstantSourceAlpha | + * ConstantDestAlpha results in: + * + * C = (Ca * Param0) + (Cb * Param1) + */ + +#define SVGA_BLENDOP_CLEAR 0 +#define SVGA_BLENDOP_SRC 1 +#define SVGA_BLENDOP_DST 2 +#define SVGA_BLENDOP_OVER 3 +#define SVGA_BLENDOP_OVER_REVERSE 4 +#define SVGA_BLENDOP_IN 5 +#define SVGA_BLENDOP_IN_REVERSE 6 +#define SVGA_BLENDOP_OUT 7 +#define SVGA_BLENDOP_OUT_REVERSE 8 +#define SVGA_BLENDOP_ATOP 9 +#define SVGA_BLENDOP_ATOP_REVERSE 10 +#define SVGA_BLENDOP_XOR 11 +#define SVGA_BLENDOP_ADD 12 +#define SVGA_BLENDOP_SATURATE 13 + +#define SVGA_NUM_BLENDOPS 14 +#define SVGA_IS_VALID_BLENDOP(op) (op >= 0 && op < SVGA_NUM_BLENDOPS) + +#define SVGA_BLENDFLAG_CONSTANT_SOURCE_ALPHA 0x01 +#define SVGA_BLENDFLAG_CONSTANT_DEST_ALPHA 0x02 +#define SVGA_NUM_BLENDFLAGS 2 +#define SVGA_BLENDFLAG_ALL (MASK(SVGA_NUM_BLENDFLAGS)) +#define SVGA_IS_VALID_BLENDFLAG(flag) ((flag & ~SVGA_BLENDFLAG_ALL) == 0) + +/* * Memory area offsets (viewed as an array of 32-bit words) */ @@ -186,24 +257,46 @@ #define SVGA_MAX_ID 499 /* - * Macros to compute variable length items (sizes in 32-bit words) + * Macros to compute variable length items (sizes in 32-bit words, except + * for SVGA_GLYPH_SCANLINE_SIZE, which is in bytes). */ #define SVGA_BITMAP_SIZE(w,h) ((((w)+31) >> 5) * (h)) #define SVGA_BITMAP_SCANLINE_SIZE(w) (( (w)+31 ) >> 5) -#define SVGA_PIXMAP_SIZE(w,h,d) ((( ((w)*(d))+31 ) >> 5) * (h)) -#define SVGA_PIXMAP_SCANLINE_SIZE(w,d) (( ((w)*(d))+31 ) >> 5) +#define SVGA_PIXMAP_SIZE(w,h,bpp) ((( ((w)*(bpp))+31 ) >> 5) * (h)) +#define SVGA_PIXMAP_SCANLINE_SIZE(w,bpp) (( ((w)*(bpp))+31 ) >> 5) +#define SVGA_GLYPH_SIZE(w,h) ((((((w) + 7) >> 3) * (h)) + 3) >> 2) +#define SVGA_GLYPH_SCANLINE_SIZE(w) (((w) + 7) >> 3) /* + * Get the width and height of VRAM in the current mode (for offscreen memory) + */ +#define SVGA_VRAM_WIDTH_HEIGHT(width /* out */, height /* out */) { \ + uint32 pitch = svga->reg[SVGA_REG_BYTES_PER_LINE]; \ + width = (pitch * 8) / ((svga->reg[SVGA_REG_BITS_PER_PIXEL] + 7) & ~7); \ + height = (svga->reg[SVGA_REG_VRAM_SIZE] - \ + svga->reg[SVGA_REG_FB_OFFSET]) / pitch; \ +} + +/* * Increment from one scanline to the next of a bitmap or pixmap */ #define SVGA_BITMAP_INCREMENT(w) ((( (w)+31 ) >> 5) * sizeof (uint32)) -#define SVGA_PIXMAP_INCREMENT(w,d) ((( ((w)*(d))+31 ) >> 5) * sizeof (uint32)) +#define SVGA_PIXMAP_INCREMENT(w,bpp) ((( ((w)*(bpp))+31 ) >> 5) * sizeof (uint32)) /* + * Transparent color for DRAW_GLYPH_CLIPPED + */ +#define SVGA_COLOR_TRANSPARENT (~0) + +/* * Commands in the command FIFO */ +#define SVGA_CMD_INVALID_CMD 0 + /* FIFO layout: + <nothing> (well, undefined) */ + #define SVGA_CMD_UPDATE 1 /* FIFO layout: X, Y, Width, Height */ @@ -296,7 +389,68 @@ /* FIFO layout: ID, Hotspot X, Hotspot Y, Width, Height, <scanlines> */ + +#define SVGA_CMD_DRAW_GLYPH 23 + /* FIFO layout: + X, Y, W, H, FGCOLOR, <stencil buffer> */ + +#define SVGA_CMD_DRAW_GLYPH_CLIPPED 24 + /* FIFO layout: + X, Y, W, H, FGCOLOR, BGCOLOR, <cliprect>, <stencil buffer> + Transparent color expands are done by setting BGCOLOR to ~0 */ + +#define SVGA_CMD_UPDATE_VERBOSE 25 + /* FIFO layout: + X, Y, Width, Height, Reason */ + +#define SVGA_CMD_SURFACE_FILL 26 + /* FIFO layout: + color, dstSurfaceOffset, x, y, w, h, rop */ -#define SVGA_CMD_MAX 23 +#define SVGA_CMD_SURFACE_COPY 27 + /* FIFO layout: + srcSurfaceOffset, dstSurfaceOffset, srcX, srcY, + destX, destY, w, h, rop */ + +#define SVGA_CMD_SURFACE_ALPHA_BLEND 28 + /* FIFO layout: + srcSurfaceOffset, dstSurfaceOffset, srcX, srcY, + destX, destY, w, h, op (SVGA_BLENDOP*), flags (SVGA_BLENDFLAGS*), + param1, param2 */ + +#define SVGA_CMD_MAX 29 + +/* SURFACE_ALPHA_BLEND currently has the most (non-data) arguments: 12 */ +#define SVGA_CMD_MAX_ARGS 12 + + +/* + * A sync request is sent via a non-zero write to the SVGA_REG_SYNC + * register. In devel builds, the driver will write a specific value + * indicating exactly why the sync is necessary + */ +enum { + SVGA_SYNC_INVALIDREASON = 0, /* Don't ever write a zero */ + SVGA_SYNC_GENERIC = 1, /* Legacy drivers will always write a 1 */ + SVGA_SYNC_FIFOFULL = 2, /* Need to drain FIFO for next write */ + SVGA_SYNC_FB_WRITE = 3, /* About write to shadow frame buffer (generic) */ + SVGA_SYNC_FB_BITBLT = 4, /* Unaccelerated DrvBitBlt */ + SVGA_SYNC_FB_COPYBITS = 5, /* Unacclerated DrvCopyBits bits */ + SVGA_SYNC_FB_FILLPATH = 6, /* Unacclerated DrvFillPath */ + SVGA_SYNC_FB_LINETO = 7, /* Unacclerated DrvLineTo */ + SVGA_SYNC_FB_PAINT = 8, /* Unacclerated DrvPaint */ + SVGA_SYNC_FB_STRETCHBLT = 9, /* Unacclerated DrvStretchBlt */ + SVGA_SYNC_FB_STROKEFILL = 10, /* Unacclerated DrvStrokeAndFillPath */ + SVGA_SYNC_FB_STROKE = 11, /* Unacclerated DrvStrokePath */ + SVGA_SYNC_FB_TEXTOUT = 12, /* Unacclerated DrvTextOut */ + SVGA_SYNC_FB_ALPHABLEND = 13, /* Unacclerated DrvAlphaBlend */ + SVGA_SYNC_FB_GRADIENT = 14, /* Unacclerated DrvGradientFill */ + SVGA_SYNC_FB_PLGBLT = 15, /* Unacclerated DrvPlgBlt */ + SVGA_SYNC_FB_STRETCHROP = 16, /* Unacclerated DrvStretchBltROP */ + SVGA_SYNC_FB_TRANSPARENT = 17, /* Unacclerated DrvTransparentBlt */ + SVGA_SYNC_FB_NEWCURSOR = 18, /* Defined a new cursor */ + SVGA_SYNC_FB_SYNCSURFACE = 19, /* DrvSynchrnoizeSurface call */ + SVGA_SYNC_FB_NUM_REASONS /* Total number of reasons */ +}; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_struct.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_struct.h:1.1 --- /dev/null Thu Feb 27 12:31:47 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_struct.h Mon Dec 9 23:17:19 2002 @@ -0,0 +1,40 @@ +/* ********************************************************** + * Copyright (C) 1998-2000 VMware, Inc. + * All Rights Reserved + * **********************************************************/ + +#ifndef _SVGA_STRUCT_H_ +#define _SVGA_STRUCT_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#include "includeCheck.h" + + /* + * Offscreen memory surface structure + * + */ + +enum SVGASurfaceVersion { + SVGA_SURFACE_VERSION_1 = 1 /* Initial version... */ +}; + +typedef struct _SVGASurface { + uint32 size; /* Size of the structure */ + uint32 version; /* Version of this surface structure. */ + uint32 bpp; /* Format of the surface */ + uint32 width; /* Width of the surface */ + uint32 height; /* Height of the surface */ + uint32 pitch; /* Pitch of the surface */ + volatile uint32 numQueued; /* Number of times this bitmap has been queued */ + volatile uint32 numDequeued; /* Number of times this bitmap has been dequeued */ + uint32 userData; /* Driver defined data */ + uint32 dataOffset; /* Offset to the data */ +} SVGASurface; + +typedef struct SVGAPoint { + int16 x; + int16 y; +} SVGAPoint; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.8 Sat Oct 27 23:33:53 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c Tue Feb 18 14:10:36 2003 @@ -4,10 +4,13 @@ * **********************************************************/ #ifdef VMX86_DEVEL char rcsId_vmware[] = - "Id: vmware.c,v 1.11 2001/02/23 02:10:39 yoel Exp $"; #endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.8 2001/10/28 03:33:53 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.17 2003/02/18 19:10:36 alanh Exp $ */ + +/* + * TODO: support the vmware linux kernel fb driver (Option "UseFBDev"). + */ #include "xf86.h" #include "xf86_OSproc.h" @@ -24,6 +27,7 @@ #include "micmap.h" /* mi color map */ #include "vgaHW.h" /* VGA hardware */ #include "fb.h" +#include "shadowfb.h" /* ShadowFB wrappers */ #include "xf86cmap.h" /* xf86HandleColormaps */ @@ -49,30 +53,30 @@ * This is the only way I know to turn a #define of an integer constant into * a constant string. */ -#define VMW_INNERSTRINGIFY(s) #s -#define VMW_STRING(str) VMW_INNERSTRINGIFY(str) +#define VMW_INNERSTRINGIFY(s) #s +#define VMW_STRING(str) VMW_INNERSTRINGIFY(str) -#define VMWARE_NAME "VMWARE" -#define VMWARE_DRIVER_NAME "vmware" +#define VMWARE_NAME "VMWARE" +#define VMWARE_DRIVER_NAME "vmware" #define VMWARE_MAJOR_VERSION 10 -#define VMWARE_MINOR_VERSION 7 -#define VMWARE_PATCHLEVEL 0 -#define VERSION (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) - -static const char VMWAREBuildStr[] = - "VMware Guest X Server " VMW_STRING(VMWARE_MAJOR_VERSION) - "." VMW_STRING(VMWARE_MINOR_VERSION) - "." VMW_STRING(VMWARE_PATCHLEVEL) " - build=$Name: $\n"; +#define VMWARE_MINOR_VERSION 10 +#define VMWARE_PATCHLEVEL 2 +#define VERSION (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) + +static const char VMWAREBuildStr[] = "VMware Guest X Server " + VMW_STRING(VMWARE_MAJOR_VERSION) "." VMW_STRING(VMWARE_MINOR_VERSION) + "." VMW_STRING(VMWARE_PATCHLEVEL) " - build=$Name: $\n"; static SymTabRec VMWAREChipsets[] = { - { PCI_CHIP_VMWARE0405, "vmware0405" }, - { PCI_CHIP_VMWARE0710, "vmware0710" }, - { -1, NULL } + { PCI_CHIP_VMWARE0405, "vmware0405" }, + { PCI_CHIP_VMWARE0710, "vmware0710" }, + { -1, NULL } }; static resRange vmwareLegacyRes[] = { - { ResExcIoBlock, SVGA_LEGACY_BASE_PORT, SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)}, - _VGA_EXCLUSIVE, _END + { ResExcIoBlock, SVGA_LEGACY_BASE_PORT, + SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)}, + _VGA_EXCLUSIVE, _END }; /* @@ -83,93 +87,118 @@ */ static PciChipsets VMWAREPciChipsets[] = { - { PCI_CHIP_VMWARE0405, PCI_CHIP_VMWARE0405, RES_EXCLUSIVE_VGA }, - { PCI_CHIP_VMWARE0710, PCI_CHIP_VMWARE0710, vmwareLegacyRes }, - { -1, -1, RES_UNDEFINED } + { PCI_CHIP_VMWARE0405, PCI_CHIP_VMWARE0405, RES_EXCLUSIVE_VGA }, + { PCI_CHIP_VMWARE0710, PCI_CHIP_VMWARE0710, vmwareLegacyRes }, + { -1, -1, RES_UNDEFINED } }; static const char *vgahwSymbols[] = { - "vgaHWGetHWRec", - "vgaHWGetIOBase", - "vgaHWGetIndex", - "vgaHWInit", - "vgaHWProtect", - "vgaHWRestore", - "vgaHWSave", - "vgaHWSaveScreen", - "vgaHWUnlock", - NULL + "vgaHWGetHWRec", + "vgaHWGetIOBase", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", + "vgaHWUnlock", + NULL }; static const char *fbSymbols[] = { - "fbPictureInit", - "fbScreenInit", - NULL + "fbCreateDefColormap", + "fbPictureInit", + "fbScreenInit", + NULL +}; + +static const char *ramdacSymbols[] = { + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL }; +static const char *shadowfbSymbols[] = { + "ShadowFBInit2", + NULL +}; + #ifdef XFree86LOADER static XF86ModuleVersionInfo vmwareVersRec = { - "vmware", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - VMWARE_MAJOR_VERSION, VMWARE_MINOR_VERSION, VMWARE_PATCHLEVEL, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - MOD_CLASS_VIDEODRV, - { 0, 0, 0, 0} + "vmware", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + VMWARE_MAJOR_VERSION, VMWARE_MINOR_VERSION, VMWARE_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + { 0, 0, 0, 0} }; #endif /* XFree86LOADER */ typedef enum { - OPTION_HW_CURSOR, - OPTION_NOACCEL + OPTION_HW_CURSOR, + OPTION_NOACCEL } VMWAREOpts; static const OptionInfoRec VMWAREOptions[] = { - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } + { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; +static void VMWAREStopFIFO(ScrnInfoPtr pScrn); + static Bool VMWAREGetRec(ScrnInfoPtr pScrn) { - if (pScrn->driverPrivate != NULL) { - return TRUE; - } - pScrn->driverPrivate = xnfcalloc(sizeof(VMWARERec), 1); - /* FIXME: Initialize driverPrivate... */ - return TRUE; + if (pScrn->driverPrivate != NULL) { + return TRUE; + } + pScrn->driverPrivate = xnfcalloc(sizeof(VMWARERec), 1); + /* FIXME: Initialize driverPrivate... */ + return TRUE; } static void VMWAREFreeRec(ScrnInfoPtr pScrn) { - if (pScrn->driverPrivate) { - xfree(pScrn->driverPrivate); - pScrn->driverPrivate = NULL; - } + if (pScrn->driverPrivate) { + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; + } } - -static void ScreenToPrivate(ScreenPtr, ScrnInfoPtr); -static void ScreenFromPrivate(ScreenPtr, ScrnInfoPtr); -/* VMware specific functions */ - -static CARD32 +CARD32 vmwareReadReg(VMWAREPtr pVMWARE, int index) { + /* + * Block SIGIO for the duration, so we don't get interrupted after the + * outl but before the inl by a mouse move (which write to our registers). + */ + int oldsigio, ret; + oldsigio = xf86BlockSIGIO(); outl(pVMWARE->indexReg, index); - return inl(pVMWARE->valueReg); + ret = inl(pVMWARE->valueReg); + xf86UnblockSIGIO(oldsigio); + return ret; } void vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value) { + /* + * Block SIGIO for the duration, so we don't get interrupted in between + * the outls by a mouse move (which write to our registers). + */ + int oldsigio; + oldsigio = xf86BlockSIGIO(); outl(pVMWARE->indexReg, index); outl(pVMWARE->valueReg, value); + xf86UnblockSIGIO(oldsigio); } void @@ -181,24 +210,24 @@ if ((vmwareFIFO[SVGA_FIFO_NEXT_CMD] + sizeof(CARD32) == vmwareFIFO[SVGA_FIFO_STOP]) || (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] - sizeof(CARD32) && vmwareFIFO[SVGA_FIFO_STOP] == vmwareFIFO[SVGA_FIFO_MIN])) { - vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); - while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ; + VmwareLog(("Syncing because of full fifo\n")); + vmwareWaitForFB(pVMWARE); } + vmwareFIFO[vmwareFIFO[SVGA_FIFO_NEXT_CMD] / sizeof(CARD32)] = value; - vmwareFIFO[SVGA_FIFO_NEXT_CMD] += sizeof(CARD32); - if (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX]) { - vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN]; + if(vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] - + sizeof(CARD32)) { + vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN]; + } else { + vmwareFIFO[SVGA_FIFO_NEXT_CMD] += sizeof(CARD32); } } void vmwareWaitForFB(VMWAREPtr pVMWARE) { - if (pVMWARE->vmwareFIFOMarkSet) { - vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); - while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ; - pVMWARE->vmwareFIFOMarkSet = FALSE; - } + vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); + while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)); } void @@ -229,9 +258,9 @@ CARD32 weight; for (weight = 0; mask; mask >>= 1) { - if (mask & 1) { - weight++; - } + if (mask & 1) { + weight++; + } } return weight; } @@ -256,39 +285,39 @@ static uint32 VMXGetVMwareSvgaId(VMWAREPtr pVMWARE) { - uint32 vmware_svga_id; + uint32 vmware_svga_id; - /* Any version with any SVGA_ID_* support will initialize SVGA_REG_ID - * to SVGA_ID_0 to support versions of this driver with SVGA_ID_0. - * - * Versions of SVGA_ID_0 ignore writes to the SVGA_REG_ID register. - * - * Versions of SVGA_ID_1 will allow us to overwrite the content - * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1. - * - * Versions of SVGA_ID_2 will allow us to overwrite the content - * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1 - * or SVGA_ID_2. - */ - - vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_2); - vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); - if (vmware_svga_id == SVGA_ID_2) { - return SVGA_ID_2; - } - - vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_1); - vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); - if (vmware_svga_id == SVGA_ID_1) { - return SVGA_ID_1; - } - - if (vmware_svga_id == SVGA_ID_0) { - return SVGA_ID_0; - } + /* Any version with any SVGA_ID_* support will initialize SVGA_REG_ID + * to SVGA_ID_0 to support versions of this driver with SVGA_ID_0. + * + * Versions of SVGA_ID_0 ignore writes to the SVGA_REG_ID register. + * + * Versions of SVGA_ID_1 will allow us to overwrite the content + * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1. + * + * Versions of SVGA_ID_2 will allow us to overwrite the content + * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1 + * or SVGA_ID_2. + */ + + vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_2); + vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); + if (vmware_svga_id == SVGA_ID_2) { + return SVGA_ID_2; + } - /* No supported VMware SVGA devices found */ - return SVGA_ID_INVALID; + vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_1); + vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); + if (vmware_svga_id == SVGA_ID_1) { + return SVGA_ID_1; + } + + if (vmware_svga_id == SVGA_ID_0) { + return SVGA_ID_0; + } + + /* No supported VMware SVGA devices found */ + return SVGA_ID_INVALID; } @@ -341,805 +370,1013 @@ static void VMWAREIdentify(int flags) { - xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets); + xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets); } static const OptionInfoRec * VMWAREAvailableOptions(int chipid, int busid) { - return VMWAREOptions; + return VMWAREOptions; } static Bool VMWAREPreInit(ScrnInfoPtr pScrn, int flags) { - MessageType from; - VMWAREPtr pVMWARE; - OptionInfoPtr options; - int bpp24flags; - uint32 id; - int i; - ClockRange* clockRanges; + MessageType from; + VMWAREPtr pVMWARE; + OptionInfoPtr options; + int bpp24flags; + uint32 id; + int i; + ClockRange* clockRanges; + IOADDRESS domainIOBase = 0; - if (flags & PROBE_DETECT) { - return FALSE; - } +#ifndef BUILD_FOR_420 + domainIOBase = pScrn->domainIOBase; +#endif - if (pScrn->numEntities != 1) { - return FALSE; - } + if (flags & PROBE_DETECT) { + return FALSE; + } - if (!VMWAREGetRec(pScrn)) { - return FALSE; - } - pVMWARE = VMWAREPTR(pScrn); + if (pScrn->numEntities != 1) { + return FALSE; + } - pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - if (pVMWARE->pEnt->location.type != BUS_PCI) { - return FALSE; - } - pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index); - if (pVMWARE->PciInfo == NULL) { - return FALSE; - } + if (!VMWAREGetRec(pScrn)) { + return FALSE; + } + pVMWARE = VMWAREPTR(pScrn); - if (pVMWARE->PciInfo->chipType == PCI_CHIP_VMWARE0710) { - pVMWARE->indexReg = - SVGA_LEGACY_BASE_PORT + SVGA_INDEX_PORT*sizeof(uint32); - pVMWARE->valueReg = - SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT*sizeof(uint32); - } else { - pVMWARE->indexReg = - pVMWARE->PciInfo->ioBase[0] + SVGA_INDEX_PORT; - pVMWARE->valueReg = - pVMWARE->PciInfo->ioBase[0] + SVGA_VALUE_PORT; - } - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "VMware SVGA regs at (0x%04x, 0x%04x)\n", - pVMWARE->indexReg, pVMWARE->valueReg); - - id = VMXGetVMwareSvgaId(pVMWARE); - if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No supported VMware SVGA found (read ID 0x%08x).\n", id); - return FALSE; - } + pVMWARE->pvtSema = &pScrn->vtSema; - if (!xf86LoadSubModule(pScrn, "vgahw")) { - return FALSE; - } + pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (pVMWARE->pEnt->location.type != BUS_PCI) { + return FALSE; + } + pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index); + if (pVMWARE->PciInfo == NULL) { + return FALSE; + } - xf86LoaderReqSymLists(vgahwSymbols, NULL); + if (pVMWARE->PciInfo->chipType == PCI_CHIP_VMWARE0710) { + pVMWARE->indexReg = domainIOBase + + SVGA_LEGACY_BASE_PORT + SVGA_INDEX_PORT*sizeof(uint32); + pVMWARE->valueReg = domainIOBase + + SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT*sizeof(uint32); + } else { + /* Note: This setting of valueReg causes unaligned I/O */ + pVMWARE->indexReg = domainIOBase + + pVMWARE->PciInfo->ioBase[0] + SVGA_INDEX_PORT; + pVMWARE->valueReg = domainIOBase + + pVMWARE->PciInfo->ioBase[0] + SVGA_VALUE_PORT; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "VMware SVGA regs at (0x%04x, 0x%04x)\n", + pVMWARE->indexReg, pVMWARE->valueReg); + + id = VMXGetVMwareSvgaId(pVMWARE); + if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No supported VMware SVGA found (read ID 0x%08x).\n", id); + return FALSE; + } - if (!vgaHWGetHWRec(pScrn)) { - return FALSE; - } + if (!xf86LoadSubModule(pScrn, "vgahw")) { + return FALSE; + } + + xf86LoaderReqSymLists(vgahwSymbols, NULL); - pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device, - pVMWARE->PciInfo->func); - pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo); + if (!vgaHWGetHWRec(pScrn)) { + return FALSE; + } - pScrn->monitor = pScrn->confScreen->monitor; + pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device, + pVMWARE->PciInfo->func); + pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo); -#define ACCELERATE_OPS + pScrn->monitor = pScrn->confScreen->monitor; + #ifdef ACCELERATE_OPS - pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES); + pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES); #else - pVMWARE->vmwareCapability = 0; + pVMWARE->vmwareCapability = 0; #endif - if (pVMWARE->vmwareCapability & SVGA_CAP_8BIT_EMULATION) { - pVMWARE->bitsPerPixel = - vmwareReadReg(pVMWARE, SVGA_REG_HOST_BITS_PER_PIXEL); - vmwareWriteReg(pVMWARE, - SVGA_REG_BITS_PER_PIXEL, pVMWARE->bitsPerPixel); - } else { - pVMWARE->bitsPerPixel = - vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); - } - pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); - pVMWARE->videoRam = vmwareReadReg(pVMWARE, SVGA_REG_FB_MAX_SIZE); - pVMWARE->memPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_FB_START); - pVMWARE->maxWidth = vmwareReadReg(pVMWARE, SVGA_REG_MAX_WIDTH); - pVMWARE->maxHeight = vmwareReadReg(pVMWARE, SVGA_REG_MAX_HEIGHT); - pVMWARE->cursorDefined = FALSE; - pVMWARE->mouseHidden = FALSE; - - if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS_2) { - pVMWARE->cursorRemoveFromFB = SVGA_CURSOR_ON_REMOVE_FROM_FB; - pVMWARE->cursorRestoreToFB = SVGA_CURSOR_ON_RESTORE_TO_FB; - } else { - pVMWARE->cursorRemoveFromFB = SVGA_CURSOR_ON_HIDE; - pVMWARE->cursorRestoreToFB = SVGA_CURSOR_ON_SHOW; - } - - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps: 0x%08X\n", pVMWARE->vmwareCapability); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "depth: %d\n", pVMWARE->depth); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "bpp: %d\n", pVMWARE->bitsPerPixel); - - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vram: %d\n", pVMWARE->videoRam); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: %p\n", pVMWARE->memPhysBase); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mwidt: %d\n", pVMWARE->maxWidth); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mheig: %d\n", pVMWARE->maxHeight); - - switch (pVMWARE->depth) { - case 16: - /* - * In certain cases, the Windows host appears to - * report 16 bpp and 16 depth but 555 weight. Just - * silently convert it to depth of 15. - */ - if (pVMWARE->bitsPerPixel == 16 && - pVMWARE->weight.green == 5) - pVMWARE->depth = 15; - case 8: - case 15: - bpp24flags = NoDepth24Support; - break; - - case 32: - /* - * There is no 32 bit depth, apparently it can get - * reported this way sometimes on the Windows host. - */ - if (pVMWARE->bitsPerPixel == 32) - pVMWARE->depth = 24; - case 24: - if (pVMWARE->bitsPerPixel == 24) - bpp24flags = Support24bppFb; - else - bpp24flags = Support32bppFb; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Adapter is using an unsupported depth (%d).\n", - pVMWARE->depth); - return FALSE; - } + if (pVMWARE->vmwareCapability & SVGA_CAP_8BIT_EMULATION) { + pVMWARE->bitsPerPixel = + vmwareReadReg(pVMWARE, SVGA_REG_HOST_BITS_PER_PIXEL); + vmwareWriteReg(pVMWARE, + SVGA_REG_BITS_PER_PIXEL, pVMWARE->bitsPerPixel); + } else { + pVMWARE->bitsPerPixel = + vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + } + pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); + pVMWARE->videoRam = vmwareReadReg(pVMWARE, SVGA_REG_VRAM_SIZE); + pVMWARE->memPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_FB_START); + pVMWARE->maxWidth = vmwareReadReg(pVMWARE, SVGA_REG_MAX_WIDTH); + pVMWARE->maxHeight = vmwareReadReg(pVMWARE, SVGA_REG_MAX_HEIGHT); + pVMWARE->cursorDefined = FALSE; + pVMWARE->cursorShouldBeHidden = FALSE; + + if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS_2) { + pVMWARE->cursorRemoveFromFB = SVGA_CURSOR_ON_REMOVE_FROM_FB; + pVMWARE->cursorRestoreToFB = SVGA_CURSOR_ON_RESTORE_TO_FB; + } else { + pVMWARE->cursorRemoveFromFB = SVGA_CURSOR_ON_HIDE; + pVMWARE->cursorRestoreToFB = SVGA_CURSOR_ON_SHOW; + } - if (!xf86SetDepthBpp(pScrn, pVMWARE->depth, pVMWARE->bitsPerPixel, pVMWARE->bitsPerPixel, bpp24flags)) { - return FALSE; - } + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps: 0x%08X\n", pVMWARE->vmwareCapability); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "depth: %d\n", pVMWARE->depth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "bpp: %d\n", pVMWARE->bitsPerPixel); + + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vram: %d\n", pVMWARE->videoRam); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: %p\n", pVMWARE->memPhysBase); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mwidt: %d\n", pVMWARE->maxWidth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mheig: %d\n", pVMWARE->maxHeight); - if (pScrn->bitsPerPixel != pVMWARE->bitsPerPixel) { - if (pScrn->bitsPerPixel == 8 && - pVMWARE->vmwareCapability & SVGA_CAP_8BIT_EMULATION) { - vmwareWriteReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL, 8); - pVMWARE->bitsPerPixel = - vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Currently unavailable depth/bpp of %d/%d requested.\n" - "\tThe guest X server must run at the same depth and bpp as the host\n" - "\t(which are currently %d/%d). This is automatically detected. Please\n" - "\tdo not specify a depth on the command line or via the config file.\n", - pScrn->depth, pScrn->bitsPerPixel, - pVMWARE->depth, pVMWARE->bitsPerPixel); - return FALSE; - } - } + switch (pVMWARE->depth) { + case 16: + /* + * In certain cases, the Windows host appears to + * report 16 bpp and 16 depth but 555 weight. Just + * silently convert it to depth of 15. + */ + if (pVMWARE->bitsPerPixel == 16 && + pVMWARE->weight.green == 5) + pVMWARE->depth = 15; + case 8: + case 15: + bpp24flags = NoDepth24Support; + break; + case 32: /* - * Reread depth and defer reading the colour registers until here - * in case we changed bpp above. + * There is no 32 bit depth, apparently it can get + * reported this way sometimes on the Windows host. */ + if (pVMWARE->bitsPerPixel == 32) + pVMWARE->depth = 24; + case 24: + if (pVMWARE->bitsPerPixel == 24) + bpp24flags = Support24bppFb; + else + bpp24flags = Support32bppFb; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Adapter is using an unsupported depth (%d).\n", + pVMWARE->depth); + return FALSE; + } - pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); - pVMWARE->weight.red = - vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_RED_MASK)); - pVMWARE->weight.green = - vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_GREEN_MASK)); - pVMWARE->weight.blue = - vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_BLUE_MASK)); - pVMWARE->offset.blue = 0; - pVMWARE->offset.green = pVMWARE->weight.blue; - pVMWARE->offset.red = pVMWARE->weight.green + pVMWARE->offset.green; - pVMWARE->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? - PseudoColor : TrueColor; - - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, - 2, "depth: %d\n", pVMWARE->depth); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, - 2, "bpp: %d\n", pVMWARE->bitsPerPixel); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, - 2, "w.red: %d\n", pVMWARE->weight.red); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, - 2, "w.grn: %d\n", pVMWARE->weight.green); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, - 2, "w.blu: %d\n", pVMWARE->weight.blue); - xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, - 2, "vis: %d\n", pVMWARE->defaultVisual); - - if (pScrn->depth != pVMWARE->depth) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Currently unavailable depth of %d requested.\n" - "\tThe guest X server must run at the same depth as the host (which\n" - "\tis currently %d). This is automatically detected. Please do not\n" - "\tspecify a depth on the command line or via the config file.\n", - pScrn->depth, pVMWARE->depth); - return FALSE; - } - xf86PrintDepthBpp(pScrn); + if (!xf86SetDepthBpp(pScrn, pVMWARE->depth, pVMWARE->bitsPerPixel, pVMWARE->bitsPerPixel, bpp24flags)) { + return FALSE; + } + + if (pScrn->bitsPerPixel != pVMWARE->bitsPerPixel) { + if (pScrn->bitsPerPixel == 8 && + pVMWARE->vmwareCapability & SVGA_CAP_8BIT_EMULATION) { + vmwareWriteReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL, 8); + pVMWARE->bitsPerPixel = + vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Currently unavailable depth/bpp of %d/%d requested.\n" + "\tThe guest X server must run at the same depth and bpp as the host\n" + "\t(which are currently %d/%d). This is automatically detected. Please\n" + "\tdo not specify a depth on the command line or via the config file.\n", + pScrn->depth, pScrn->bitsPerPixel, + pVMWARE->depth, pVMWARE->bitsPerPixel); + return FALSE; + } + } + + /* + * Reread depth and defer reading the colour registers until here + * in case we changed bpp above. + */ + + pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); + pVMWARE->weight.red = + vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_RED_MASK)); + pVMWARE->weight.green = + vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_GREEN_MASK)); + pVMWARE->weight.blue = + vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_BLUE_MASK)); + pVMWARE->offset.blue = 0; + pVMWARE->offset.green = pVMWARE->weight.blue; + pVMWARE->offset.red = pVMWARE->weight.green + pVMWARE->offset.green; + pVMWARE->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? + PseudoColor : TrueColor; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "depth: %d\n", pVMWARE->depth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "bpp: %d\n", pVMWARE->bitsPerPixel); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "w.red: %d\n", pVMWARE->weight.red); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "w.grn: %d\n", pVMWARE->weight.green); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "w.blu: %d\n", pVMWARE->weight.blue); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "vis: %d\n", pVMWARE->defaultVisual); + + if (pScrn->depth != pVMWARE->depth) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Currently unavailable depth of %d requested.\n" + "\tThe guest X server must run at the same depth as the host (which\n" + "\tis currently %d). This is automatically detected. Please do not\n" + "\tspecify a depth on the command line or via the config file.\n", + pScrn->depth, pVMWARE->depth); + return FALSE; + } + xf86PrintDepthBpp(pScrn); #if 0 - if (pScrn->depth == 24 && pix24bpp == 0) { - pix24bpp = xf86GetBppFromDepth(pScrn, 24); - } + if (pScrn->depth == 24 && pix24bpp == 0) { + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + } #endif - if (pScrn->depth > 8) { - rgb zeros = { 0, 0, 0 }; + if (pScrn->depth > 8) { + rgb zeros = { 0, 0, 0 }; - if (!xf86SetWeight(pScrn, pVMWARE->weight, zeros)) { - return FALSE; - } - /* FIXME check returned weight */ - } - if (!xf86SetDefaultVisual(pScrn, pVMWARE->defaultVisual)) { - return FALSE; - } - if (pScrn->defaultVisual != pVMWARE->defaultVisual) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given visual (%d) is not supported by this driver (%d is required)\n", - pScrn->defaultVisual, pVMWARE->defaultVisual); - return FALSE; - } + if (!xf86SetWeight(pScrn, pVMWARE->weight, zeros)) { + return FALSE; + } + /* FIXME check returned weight */ + } + if (!xf86SetDefaultVisual(pScrn, pVMWARE->defaultVisual)) { + return FALSE; + } + if (pScrn->defaultVisual != pVMWARE->defaultVisual) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given visual (%d) is not supported by this driver (%d is required)\n", + pScrn->defaultVisual, pVMWARE->defaultVisual); + return FALSE; + } #if 0 - bytesPerPixel = pScrn->bitsPerPixel / 8; + bytesPerPixel = pScrn->bitsPerPixel / 8; #endif - pScrn->progClock = TRUE; + pScrn->progClock = TRUE; #if 0 /* MGA does not do this */ - if (pScrn->visual != 0) { /* FIXME */ - /* print error message */ - return FALSE; - } + if (pScrn->visual != 0) { /* FIXME */ + /* print error message */ + return FALSE; + } #endif - xf86CollectOptions(pScrn, NULL); - if (!(options = xalloc(sizeof(VMWAREOptions)))) - return FALSE; - memcpy(options, VMWAREOptions, sizeof(VMWAREOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + xf86CollectOptions(pScrn, NULL); + if (!(options = xalloc(sizeof(VMWAREOptions)))) + return FALSE; + memcpy(options, VMWAREOptions, sizeof(VMWAREOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); - if (pScrn->depth <= 8) { - pScrn->rgbBits = 8; - } + if (pScrn->depth <= 8) { + pScrn->rgbBits = 8; + } - from = X_PROBED; - pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, pVMWARE->PciInfo->chipType); + from = X_PROBED; + pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, pVMWARE->PciInfo->chipType); - if (!pScrn->chipset) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04 is not recognised\n", pVMWARE->PciInfo->chipType); - return FALSE; - } + if (!pScrn->chipset) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04 is not recognised\n", pVMWARE->PciInfo->chipType); + return FALSE; + } - from = X_DEFAULT; - pVMWARE->hwCursor = TRUE; - if (xf86GetOptValBool(options, OPTION_HW_CURSOR, &pVMWARE->hwCursor)) { - from = X_CONFIG; - } - if (pVMWARE->hwCursor && !(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HW cursor is not supported in this configuration\n"); - from = X_PROBED; - pVMWARE->hwCursor = FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", - pVMWARE->hwCursor ? "HW" : "SW"); - if (xf86IsOptionSet(options, OPTION_NOACCEL)) { - pVMWARE->noAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); - pVMWARE->vmwareCapability = 0; - } else { - pVMWARE->noAccel = FALSE; - } - pScrn->videoRam = pVMWARE->videoRam / 1024; - pScrn->memPhysBase = pVMWARE->memPhysBase; - xfree(options); - - { - Gamma zeros = { 0.0, 0.0, 0.0 }; - if (!xf86SetGamma(pScrn, zeros)) { - return FALSE; - } - } -#if 0 - if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL)) != 1) { - /* print error message */ - VMWAREFreeRec(pScrn); - if (i > 0) { - xfree(pciList); - } - return FALSE; - } -#endif - clockRanges = xnfcalloc(sizeof(ClockRange), 1); - clockRanges->next = NULL; - clockRanges->minClock = 1; - clockRanges->maxClock = 400000000; - clockRanges->clockIndex = -1; - clockRanges->interlaceAllowed = FALSE; - clockRanges->doubleScanAllowed = FALSE; - clockRanges->ClockMulFactor = 1; - clockRanges->ClockDivFactor = 1; - - i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, - clockRanges, NULL, 256, pVMWARE->maxWidth, 32 * 32, - 128, pVMWARE->maxHeight, - pScrn->display->virtualX, pScrn->display->virtualY, - pVMWARE->videoRam, - LOOKUP_BEST_REFRESH); - if (i == -1) { - VMWAREFreeRec(pScrn); - return FALSE; - } - xf86PruneDriverModes(pScrn); - if (i == 0 || pScrn->modes == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); - VMWAREFreeRec(pScrn); - return FALSE; - } - xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); - pScrn->currentMode = pScrn->modes; - xf86PrintModes(pScrn); - xf86SetDpi(pScrn, 0, 0); - if (!xf86LoadSubModule(pScrn, "fb")) { - VMWAREFreeRec(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(fbSymbols, NULL); + from = X_DEFAULT; + pVMWARE->hwCursor = TRUE; + if (xf86GetOptValBool(options, OPTION_HW_CURSOR, &pVMWARE->hwCursor)) { + from = X_CONFIG; + } + if (pVMWARE->hwCursor && !(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HW cursor is not supported in this configuration\n"); + from = X_PROBED; + pVMWARE->hwCursor = FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pVMWARE->hwCursor ? "HW" : "SW"); + if (xf86IsOptionSet(options, OPTION_NOACCEL)) { + pVMWARE->noAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + } else { + pVMWARE->noAccel = FALSE; + } + pScrn->videoRam = pVMWARE->videoRam / 1024; + pScrn->memPhysBase = pVMWARE->memPhysBase; + xfree(options); + + { + Gamma zeros = { 0.0, 0.0, 0.0 }; + if (!xf86SetGamma(pScrn, zeros)) { + return FALSE; + } + } #if 0 - /* XXX This driver doesn't use XAA! */ - if (!pVMWARE->noAccel || pVMWARE->hwCursor) { - if (!xf86LoadSubModule(pScrn, "xaa")) { - VMWAREFreeRec(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(xaaSymbols, NULL); - } + if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL)) != 1) { + /* print error message */ + VMWAREFreeRec(pScrn); + if (i > 0) { + xfree(pciList); + } + return FALSE; + } #endif - return TRUE; + clockRanges = xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->minClock = 1; + clockRanges->maxClock = 400000000; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = FALSE; + clockRanges->doubleScanAllowed = FALSE; + clockRanges->ClockMulFactor = 1; + clockRanges->ClockDivFactor = 1; + + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, + clockRanges, NULL, 256, pVMWARE->maxWidth, 32 * 32, + 128, pVMWARE->maxHeight, + pScrn->display->virtualX, pScrn->display->virtualY, + pVMWARE->videoRam, + LOOKUP_BEST_REFRESH); + if (i == -1) { + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86PruneDriverModes(pScrn); + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + pScrn->currentMode = pScrn->modes; + xf86PrintModes(pScrn); + xf86SetDpi(pScrn, 0, 0); + if (!xf86LoadSubModule(pScrn, "fb") || + !xf86LoadSubModule(pScrn, "shadowfb")) { + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(fbSymbols, shadowfbSymbols, NULL); + + /* Need ramdac for hwcursor */ + if (pVMWARE->hwCursor) { + if (!xf86LoadSubModule(pScrn, "ramdac")) { + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(ramdacSymbols, NULL); + } + + if (!pVMWARE->noAccel) { + if (!xf86LoadSubModule(pScrn, "xaa")) { + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(vmwareXaaSymbols, NULL); + } + + return TRUE; } static Bool VMWAREMapMem(ScrnInfoPtr pScrn) { - VMWAREPtr pVMWARE; + VMWAREPtr pVMWARE; - pVMWARE = VMWAREPTR(pScrn); + pVMWARE = VMWAREPTR(pScrn); - pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pVMWARE->PciTag, pVMWARE->memPhysBase, pVMWARE->videoRam); - if (!pVMWARE->FbBase) - return FALSE; - pVMWARE->FbSize = pVMWARE->videoRam; - - VmwareLog(("FB Mapped: %p/%u -> %p/%u\n", - pVMWARE->memPhysBase, pVMWARE->videoRam, - pVMWARE->FbBase, pVMWARE->FbSize)); - return TRUE; + pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pVMWARE->PciTag, + pVMWARE->memPhysBase, + pVMWARE->videoRam); + if (!pVMWARE->FbBase) + return FALSE; + + VmwareLog(("FB Mapped: %p/%u -> %p/%u\n", + pVMWARE->memPhysBase, pVMWARE->videoRam, + pVMWARE->FbBase, pVMWARE->videoRam)); + return TRUE; } static Bool VMWAREUnmapMem(ScrnInfoPtr pScrn) { - VMWAREPtr pVMWARE; + VMWAREPtr pVMWARE; - pVMWARE = VMWAREPTR(pScrn); + pVMWARE = VMWAREPTR(pScrn); - VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->FbSize)); + VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->videoRam)); - xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->FbSize); - pVMWARE->FbBase = NULL; - return TRUE; + xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->videoRam); + pVMWARE->FbBase = NULL; + return TRUE; } static void VMWARESave(ScrnInfoPtr pScrn) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaRegPtr vgaReg = &hwp->SavedReg; - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; - vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); + vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); - vmwareReg->svga_reg_enable = 0; - /* FIXME: Save VMWARE state */ + vmwareReg->svga_reg_enable = vmwareReadReg(pVMWARE, SVGA_REG_ENABLE); + vmwareReg->svga_reg_width = vmwareReadReg(pVMWARE, SVGA_REG_WIDTH); + vmwareReg->svga_reg_height = vmwareReadReg(pVMWARE, SVGA_REG_HEIGHT); + vmwareReg->svga_reg_bits_per_pixel = + vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + + /* XXX this should be based on the cap bit, not hwCursor... */ + if (pVMWARE->hwCursor) { + vmwareReg->svga_reg_cursor_on = + vmwareReadReg(pVMWARE, SVGA_REG_CURSOR_ON); + vmwareReg->svga_reg_cursor_x = + vmwareReadReg(pVMWARE, SVGA_REG_CURSOR_X); + vmwareReg->svga_reg_cursor_y = + vmwareReadReg(pVMWARE, SVGA_REG_CURSOR_Y); + vmwareReg->svga_reg_cursor_id = + vmwareReadReg(pVMWARE, SVGA_REG_CURSOR_ID); + } + + vmwareReg->svga_fifo_enabled = vmwareReadReg(pVMWARE, SVGA_REG_CONFIG_DONE); } static void VMWARERestoreRegs(ScrnInfoPtr pScrn, VMWARERegPtr vmwareReg) { - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - - if (vmwareReg->svga_reg_enable) { - vmwareWriteReg(pVMWARE, SVGA_REG_WIDTH, vmwareReg->svga_reg_width); - vmwareWriteReg(pVMWARE, SVGA_REG_HEIGHT, vmwareReg->svga_reg_height); - vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); - vmwareWriteReg(pVMWARE, SVGA_REG_GUEST_ID, GUEST_OS_LINUX); - } else { - vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); - } + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VmwareLog(("VMWARERestoreRegs: W: %d, H: %d, BPP: %d, Enable: %d\n", + vmwareReg->svga_reg_width, vmwareReg->svga_reg_height, + vmwareReg->svga_reg_bits_per_pixel, vmwareReg->svga_reg_enable)); + if (vmwareReg->svga_reg_enable) { + vmwareWriteReg(pVMWARE, SVGA_REG_WIDTH, vmwareReg->svga_reg_width); + vmwareWriteReg(pVMWARE, SVGA_REG_HEIGHT, vmwareReg->svga_reg_height); + vmwareWriteReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL, + vmwareReg->svga_reg_bits_per_pixel); + vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); + vmwareWriteReg(pVMWARE, SVGA_REG_GUEST_ID, GUEST_OS_LINUX); + if (pVMWARE->hwCursor) { + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, + vmwareReg->svga_reg_cursor_id); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, + vmwareReg->svga_reg_cursor_x); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, + vmwareReg->svga_reg_cursor_y); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, + vmwareReg->svga_reg_cursor_on); + } + } else { + vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); + } } static void VMWARERestore(ScrnInfoPtr pScrn) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaRegPtr vgaReg = &hwp->SavedReg; - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; - - /* FIXME: Sync */ - vgaHWProtect(pScrn, TRUE); - VMWARERestoreRegs(pScrn, vmwareReg); - vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); - vgaHWProtect(pScrn, FALSE); + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; + + vmwareWaitForFB(pVMWARE); + if (!vmwareReg->svga_fifo_enabled) { + VMWAREStopFIFO(pScrn); + } + + vgaHWProtect(pScrn, TRUE); + VMWARERestoreRegs(pScrn, vmwareReg); + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + vgaHWProtect(pScrn, FALSE); } static Bool VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaRegPtr vgaReg = &hwp->ModeReg; - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - VMWARERegPtr vmwareReg = &pVMWARE->ModeReg; - - vgaHWUnlock(hwp); - if (!vgaHWInit(pScrn, mode)) - return FALSE; - pScrn->vtSema = TRUE; - - if (!vgaHWInit(pScrn, mode)) - return FALSE; - - vmwareReg->svga_reg_enable = 1; - vmwareReg->svga_reg_width = max(mode->HDisplay, pScrn->virtualX); - vmwareReg->svga_reg_height = max(mode->VDisplay, pScrn->virtualY); - - vgaHWProtect(pScrn, TRUE); - - vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); - VMWARERestoreRegs(pScrn, vmwareReg); - - VmwareLog(("Required mode: %ux%u\n", mode->HDisplay, mode->VDisplay)); - VmwareLog(("Virtual: %ux%u\n", pScrn->virtualX, pScrn->virtualY)); - VmwareLog(("dispWidth: %u\n", pScrn->displayWidth)); - pVMWARE->fbOffset = vmwareReadReg(pVMWARE, SVGA_REG_FB_OFFSET); - pVMWARE->fbPitch = vmwareReadReg(pVMWARE, SVGA_REG_BYTES_PER_LINE); - - pScrn->displayWidth = (pVMWARE->fbPitch * 8) / ((pScrn->bitsPerPixel + 7) & ~7); - VmwareLog(("fbOffset: %u\n", pVMWARE->fbOffset)); - VmwareLog(("fbPitch: %u\n", pVMWARE->fbPitch)); - VmwareLog(("New dispWidth: %u\n", pScrn->displayWidth)); - - vgaHWProtect(pScrn, FALSE); - pVMWARE->CurrentLayout.mode = mode; - return TRUE; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->ModeReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->ModeReg; + + vgaHWUnlock(hwp); + if (!vgaHWInit(pScrn, mode)) + return FALSE; + pScrn->vtSema = TRUE; + + vmwareReg->svga_reg_enable = 1; + vmwareReg->svga_reg_width = max(mode->HDisplay, pScrn->virtualX); + vmwareReg->svga_reg_height = max(mode->VDisplay, pScrn->virtualY); + vmwareReg->svga_reg_bits_per_pixel = pVMWARE->bitsPerPixel; + + vgaHWProtect(pScrn, TRUE); + + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + VMWARERestoreRegs(pScrn, vmwareReg); + + if (pVMWARE->hwCursor) { + vmwareCursorModeInit(pScrn, mode); + } + + VmwareLog(("Required mode: %ux%u\n", mode->HDisplay, mode->VDisplay)); + VmwareLog(("Virtual: %ux%u\n", pScrn->virtualX, pScrn->virtualY)); + VmwareLog(("dispWidth: %u\n", pScrn->displayWidth)); + pVMWARE->fbOffset = vmwareReadReg(pVMWARE, SVGA_REG_FB_OFFSET); + pVMWARE->fbPitch = vmwareReadReg(pVMWARE, SVGA_REG_BYTES_PER_LINE); + pVMWARE->FbSize = vmwareReadReg(pVMWARE, SVGA_REG_FB_SIZE); + + pScrn->displayWidth = (pVMWARE->fbPitch * 8) / ((pScrn->bitsPerPixel + 7) & ~7); + VmwareLog(("fbOffset: %u\n", pVMWARE->fbOffset)); + VmwareLog(("fbPitch: %u\n", pVMWARE->fbPitch)); + VmwareLog(("fbSize: %u\n", pVMWARE->FbSize)); + VmwareLog(("New dispWidth: %u\n", pScrn->displayWidth)); + + vgaHWProtect(pScrn, FALSE); + + /* + * XXX -- If we want to check that we got the mode we asked for, this + * would be a good place. + */ + + /* + * Let XAA know about the mode change. + */ + if (!pVMWARE->noAccel) { + if (!vmwareXAAModeInit(pScrn, mode)) { + return FALSE; + } + } + + return TRUE; } static void VMWAREAdjustFrame(int scrnIndex, int x, int y, int flags) { - /* FIXME */ + /* FIXME */ } static void VMWAREInitFIFO(ScrnInfoPtr pScrn) { - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - CARD32* vmwareFIFO; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + CARD32* vmwareFIFO; + + TRACEPOINT - pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START); - pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3; - pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVMWARE->PciTag, pVMWARE->mmioPhysBase, pVMWARE->mmioSize); - vmwareFIFO = pVMWARE->vmwareFIFO = (CARD32*)pVMWARE->mmioVirtBase; - vmwareFIFO[SVGA_FIFO_MIN] = 4 * sizeof(CARD32); - vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize; - vmwareFIFO[SVGA_FIFO_NEXT_CMD] = 4 * sizeof(CARD32); - vmwareFIFO[SVGA_FIFO_STOP] = 4 * sizeof(CARD32); - pVMWARE->vmwareFIFOMarkSet = FALSE; - vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 1); + pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START); + pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3; + pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pVMWARE->PciTag, + pVMWARE->mmioPhysBase, + pVMWARE->mmioSize); + vmwareFIFO = pVMWARE->vmwareFIFO = (CARD32*)pVMWARE->mmioVirtBase; + vmwareFIFO[SVGA_FIFO_MIN] = 4 * sizeof(CARD32); + vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize; + vmwareFIFO[SVGA_FIFO_NEXT_CMD] = 4 * sizeof(CARD32); + vmwareFIFO[SVGA_FIFO_STOP] = 4 * sizeof(CARD32); + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 1); } static void VMWAREStopFIFO(ScrnInfoPtr pScrn) { - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + TRACEPOINT - /* ??? */ - vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0); + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0); + xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->mmioVirtBase, pVMWARE->mmioSize); } static Bool VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - VMWARERestore(pScrn); - VMWAREStopFIFO(pScrn); - VMWAREUnmapMem(pScrn); - pScrn->vtSema = FALSE; - ScreenFromPrivate(pScreen, pScrn); - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + ScreenPtr save = &pVMWARE->ScrnFuncs; + + VmwareLog(("cursorSema: %d\n", pVMWARE->cursorSema)); + + if (*pVMWARE->pvtSema) { + if (pVMWARE->CursorInfoRec) { + vmwareCursorCloseScreen(pScreen); + } + + if (pVMWARE->xaaInfo) { + vmwareXAACloseScreen(pScreen); + } + + VMWARERestore(pScrn); + VMWAREUnmapMem(pScrn); + + pScrn->vtSema = FALSE; + } + + pScreen->CloseScreen = save->CloseScreen; + pScreen->SaveScreen = save->SaveScreen; + + return (*pScreen->CloseScreen)(scrnIndex, pScreen); } static Bool VMWARESaveScreen(ScreenPtr pScreen, int mode) { - return vgaHWSaveScreen(pScreen, mode); + VmwareLog(("VMWareSaveScreen() mode = %d\n", mode)); + + /* + * This thoroughly fails to do anything useful to svga mode. I doubt + * we care; who wants to idle-blank their VM's screen anyway? + */ + return vgaHWSaveScreen(pScreen, mode); } +/* disabled by default to reduce spew in DEBUG_LOGGING mode. */ +/*#define DEBUG_LOG_UPDATES*/ + static void -VMWARELoadPalette(ScrnInfoPtr pScrn, int numColors, int* indices, - LOCO* colors, VisualPtr pVisual) +VMWAREPreDirtyBBUpdate(ScrnInfoPtr pScrn, int nboxes, BoxPtr boxPtr) { - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - int i; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - for (i = 0; i < numColors; i++) { - vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 0, colors[*indices].red); - vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 1, colors[*indices].green); - vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 2, colors[*indices].blue); - indices++; - } +#ifdef DEBUG_LOG_UPDATES + { + int i; + for (i = 0; i < nboxes; i++) { + VmwareLog(("PreUpdate #%d (%d, %d, w = %d, h = %d)\n", nboxes - i, + boxPtr[i].x1, boxPtr[i].y1, + boxPtr[i].x2 - boxPtr[i].x1, + boxPtr[i].y2 - boxPtr[i].y1)); + } + } +#endif + + /* + * We only register this callback if we have a HW cursor. + */ + while (nboxes--) { + if (BOX_INTERSECT(*boxPtr, pVMWARE->hwcur.box)) { + PRE_OP_HIDE_CURSOR(); + pVMWARE->cursorExcludedForUpdate = TRUE; + break; + } + boxPtr++; + } +} + +static void +VMWAREPostDirtyBBUpdate(ScrnInfoPtr pScrn, int nboxes, BoxPtr boxPtr) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + while (nboxes--) { +#ifdef DEBUG_LOG_UPDATES + VmwareLog(("PostUpdate #%d (%d, %d, w = %d, h = %d)\n", nboxes, + boxPtr->x1, boxPtr->y1, + boxPtr->x2 - boxPtr->x1, boxPtr->y2 - boxPtr->y1)); +#endif + + /* Clip off (y only) for offscreen memory */ + if (boxPtr->y2 >= pVMWARE->ModeReg.svga_reg_height) + boxPtr->y2 = pVMWARE->ModeReg.svga_reg_height; + if (boxPtr->y1 >= pVMWARE->ModeReg.svga_reg_height) + boxPtr->y1 = pVMWARE->ModeReg.svga_reg_height; + if (boxPtr->y1 == boxPtr->y2) { + boxPtr++; + continue; + } + + vmwareSendSVGACmdUpdate(pVMWARE, boxPtr++); + } + + if (pVMWARE->hwCursor && pVMWARE->cursorExcludedForUpdate) { + POST_OP_SHOW_CURSOR(); + pVMWARE->cursorExcludedForUpdate = FALSE; + } +} + +static void +VMWARELoadPalette(ScrnInfoPtr pScrn, int numColors, int* indices, + LOCO* colors, VisualPtr pVisual) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + int i; - pVMWARE->checkCursorColor = TRUE; - VmwareLog(("Palette loading done\n")); + for (i = 0; i < numColors; i++) { + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 0, colors[*indices].red); + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 1, colors[*indices].green); + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 2, colors[*indices].blue); + indices++; + } + VmwareLog(("Palette loading done\n")); } static Bool VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { - ScrnInfoPtr pScrn; - vgaHWPtr hwp; - VMWAREPtr pVMWARE; - Bool ret; - - /* Get the ScrnInfoRec */ - pScrn = xf86Screens[pScreen->myNum]; - pVMWARE = VMWAREPTR(pScrn); + ScrnInfoPtr pScrn; + vgaHWPtr hwp; + VMWAREPtr pVMWARE; + + /* Get the ScrnInfoRec */ + pScrn = xf86Screens[pScreen->myNum]; + pVMWARE = VMWAREPTR(pScrn); - /* - * If using the vgahw module, its data structures and related - * things are typically initialised/mapped here. - */ + /* + * If using the vgahw module, its data structures and related + * things are typically initialised/mapped here. + */ - hwp = VGAHWPTR(pScrn); - vgaHWGetIOBase(hwp); + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); - /* Save the current video state */ - VMWARESave(pScrn); + /* Save the current video state */ + VMWARESave(pScrn); - VMWAREInitFIFO(pScrn); + VMWAREInitFIFO(pScrn); - /* Initialise the first mode */ - VMWAREModeInit(pScrn, pScrn->currentMode); - - /* Set the viewport if supported */ - VMWAREAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - - /* - * Setup the screen's visuals, and initialise the framebuffer - * code. - */ - VMWAREMapMem(pScrn); - - /* Reset the visual list */ - miClearVisualTypes(); - - /* - * Setup the visuals supported. This driver only supports - * TrueColor for bpp > 8, so the default set of visuals isn't - * acceptable. To deal with this, call miSetVisualTypes with - * the appropriate visual mask. - */ - - if (pScrn->bitsPerPixel > 8) { - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, - pScrn->rgbBits, pScrn->defaultVisual)) { - return FALSE; - } - } else { - if (!miSetVisualTypes(pScrn->depth, - miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) { - return FALSE; - } - } + /* Initialise the first mode */ + VMWAREModeInit(pScrn, pScrn->currentMode); - miSetPixmapDepths (); + /* Set the viewport if supported */ + VMWAREAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - /* - * Initialise the framebuffer. - */ - - ret = fbScreenInit (pScreen, pVMWARE->FbBase, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, - pScrn->bitsPerPixel); - - if (!ret) - return FALSE; - - /* Override the default mask/offset settings */ - if (pScrn->bitsPerPixel > 8) { - int i; - VisualPtr visual; - - for (i = 0, visual = pScreen->visuals; - i < pScreen->numVisuals; i++, visual++) { - if ((visual->class | DynamicClass) == DirectColor) { - visual->offsetRed = pScrn->offset.red; - visual->offsetGreen = pScrn->offset.green; - visual->offsetBlue = pScrn->offset.blue; - visual->redMask = pScrn->mask.red; - visual->greenMask = pScrn->mask.green; - visual->blueMask = pScrn->mask.blue; - } - } - } + /* + * Setup the screen's visuals, and initialise the framebuffer + * code. + */ + VMWAREMapMem(pScrn); - /* must be after RGB ordering fixed */ - fbPictureInit (pScreen, 0, 0); + /* + * Clear the framebuffer (and any black-border mode areas). + */ + memset(pVMWARE->FbBase, 0, pVMWARE->FbSize); + vmwareSendSVGACmdUpdateFullScreen(pVMWARE); - /* - * Wrap the CloseScreen vector and set SaveScreen. - */ - ScreenToPrivate(pScreen, pScrn); - /* - * If backing store is to be supported (as is usually the case), - * initialise it. - */ - miInitializeBackingStore(pScreen); + /* Reset the visual list */ + miClearVisualTypes(); - /* - * Set initial black & white colourmap indices. - */ - xf86SetBlackWhitePixels(pScreen); + /* + * Setup the visuals supported. This driver only supports + * TrueColor for bpp > 8, so the default set of visuals isn't + * acceptable. To deal with this, call miSetVisualTypes with + * the appropriate visual mask. + */ - /* - * Install colourmap functions. If using the vgahw module, - * vgaHandleColormaps would usually be called here. - */ + if (pScrn->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, + pScrn->rgbBits, pScrn->defaultVisual)) { + return FALSE; + } + } else { + if (!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) { + return FALSE; + } + } - /* - * Initialise cursor functions. This example is for the mi - * software cursor. - */ - if (pVMWARE->hwCursor) { - vmwareCursorInit(0, pScreen); - } else { - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - } + miSetPixmapDepths(); - if (!fbCreateDefColormap(pScreen)) - return FALSE; + /* + * Initialise the framebuffer. + */ + if (!fbScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, + pScrn->bitsPerPixel)) { + return FALSE; + } - if (!xf86HandleColormaps(pScreen, 256, 8, - VMWARELoadPalette, NULL, - CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) { - return FALSE; - } + /* Override the default mask/offset settings */ + if (pScrn->bitsPerPixel > 8) { + int i; + VisualPtr visual; + + for (i = 0, visual = pScreen->visuals; + i < pScreen->numVisuals; i++, visual++) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); - /* Report any unused options (only for the first generation) */ - if (serverGeneration == 1) { - xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); - } + /* + * Save the old screen vector, then wrap CloseScreen and + * set SaveScreen. + */ + pVMWARE->ScrnFuncs = *pScreen; + pScreen->CloseScreen = VMWARECloseScreen; + pScreen->SaveScreen = VMWARESaveScreen; - vmwareSendSVGACmdUpdateFullScreen(pVMWARE); - if (pVMWARE->hwCursor) { - vmwareRestoreCursor(pScreen); - } - /* Done */ - return TRUE; + /* + * Set initial black & white colourmap indices. + */ + xf86SetBlackWhitePixels(pScreen); + + /* + * Initialize shadowfb to notify us of dirty rectangles. We only + * need preFB access callbacks if we're using the hw cursor. + */ + if (!ShadowFBInit2(pScreen, + pVMWARE->hwCursor ? VMWAREPreDirtyBBUpdate : NULL, + VMWAREPostDirtyBBUpdate)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ShadowFB initialization failed\n"); + return FALSE; + } + + /* + * If we have a hw cursor, we need to hook functions that might + * read from the framebuffer. + */ + if (pVMWARE->hwCursor) { + vmwareCursorHookWrappers(pScreen); + } + + /* + * Initialize acceleration. + */ + if (!pVMWARE->noAccel) { + if (!vmwareXAAScreenInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "XAA initialization failed -- running unaccelerated!\n"); + pVMWARE->noAccel = TRUE; + } + } + + /* + * If backing store is to be supported (as is usually the case), + * initialise it. + */ + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + + /* + * Initialize software cursor. + */ + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + + /* + * Initialize hardware cursor. + */ + if (pVMWARE->hwCursor) { + if (!vmwareCursorInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + pVMWARE->hwCursor = FALSE; + } + } + + /* + * Install colourmap functions. If using the vgahw module, + * vgaHandleColormaps would usually be called here. + */ + + if (!fbCreateDefColormap(pScreen)) + return FALSE; + + if (!xf86HandleColormaps(pScreen, 256, 8, + VMWARELoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | + CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + + /* Report any unused options (only for the first generation) */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + } + + /* Done */ + return TRUE; } static Bool VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - return VMWAREModeInit(xf86Screens[scrnIndex], mode); + return VMWAREModeInit(xf86Screens[scrnIndex], mode); } static Bool VMWAREEnterVT(int scrnIndex, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - return VMWAREModeInit(pScrn, pScrn->currentMode); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + if (!pVMWARE->SavedReg.svga_fifo_enabled) { + VMWAREInitFIFO(pScrn); + } + return VMWAREModeInit(pScrn, pScrn->currentMode); } static void VMWARELeaveVT(int scrnIndex, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - VMWARERestore(pScrn); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWARERestore(pScrn); } static void VMWAREFreeScreen(int scrnIndex, int flags) { - /* - * If the vgahw module is used vgaHWFreeHWRec() would be called - * here. - */ - VMWAREFreeRec(xf86Screens[scrnIndex]); + /* + * If the vgahw module is used vgaHWFreeHWRec() would be called + * here. + */ + VMWAREFreeRec(xf86Screens[scrnIndex]); } static Bool VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { - /* FIXME... possible */ - return MODE_OK; + return MODE_OK; } static Bool VMWAREProbe(DriverPtr drv, int flags) { - int numDevSections, numUsed; - GDevPtr *devSections; - int *usedChips; - int i; - Bool foundScreen = FALSE; - char buildString[sizeof(VMWAREBuildStr)]; + int numDevSections, numUsed; + GDevPtr *devSections; + int *usedChips; + int i; + Bool foundScreen = FALSE; + char buildString[sizeof(VMWAREBuildStr)]; - RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr)); - xf86MsgVerb(X_PROBED, 4, "%s", buildString); + RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr)); + xf86MsgVerb(X_PROBED, 4, "%s", buildString); - numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections); - if (numDevSections <= 0) { + numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections); + if (numDevSections <= 0) { #ifdef DEBUG - xf86MsgVerb(X_ERROR, 0, "No vmware driver section\n"); + xf86MsgVerb(X_ERROR, 0, "No vmware driver section\n"); #endif - return FALSE; - } - if (xf86GetPciVideoInfo()) { - VmwareLog(("Some PCI Video Info Exists\n")); - numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE, - VMWAREChipsets, VMWAREPciChipsets, devSections, - numDevSections, drv, &usedChips); - xfree(devSections); - if (numUsed <= 0) - return FALSE; - if (flags & PROBE_DETECT) - foundScreen = TRUE; - else for (i = 0; i < numUsed; i++) { - ScrnInfoPtr pScrn = NULL; - - VmwareLog(("Even some VMware SVGA PCI instances exists\n")); - pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i], - VMWAREPciChipsets, NULL, NULL, NULL, - NULL, NULL); - if (pScrn) { - VmwareLog(("And even configuration suceeded\n")); - pScrn->driverVersion = VERSION; - pScrn->driverName = VMWARE_DRIVER_NAME; - pScrn->name = VMWARE_NAME; - pScrn->Probe = VMWAREProbe; - pScrn->PreInit = VMWAREPreInit; - pScrn->ScreenInit = VMWAREScreenInit; - pScrn->SwitchMode = VMWARESwitchMode; - pScrn->AdjustFrame = VMWAREAdjustFrame; - pScrn->EnterVT = VMWAREEnterVT; - pScrn->LeaveVT = VMWARELeaveVT; - pScrn->FreeScreen = VMWAREFreeScreen; - pScrn->ValidMode = VMWAREValidMode; - foundScreen = TRUE; - } - } - xfree(usedChips); - } - return foundScreen; + return FALSE; + } + if (xf86GetPciVideoInfo()) { + VmwareLog(("Some PCI Video Info Exists\n")); + numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE, + VMWAREChipsets, VMWAREPciChipsets, devSections, + numDevSections, drv, &usedChips); + xfree(devSections); + if (numUsed <= 0) + return FALSE; + if (flags & PROBE_DETECT) + foundScreen = TRUE; + else + for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + + VmwareLog(("Even some VMware SVGA PCI instances exists\n")); + pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i], + VMWAREPciChipsets, NULL, NULL, NULL, + NULL, NULL); + if (pScrn) { + VmwareLog(("And even configuration suceeded\n")); + pScrn->driverVersion = VERSION; + pScrn->driverName = VMWARE_DRIVER_NAME; + pScrn->name = VMWARE_NAME; + pScrn->Probe = VMWAREProbe; + pScrn->PreInit = VMWAREPreInit; + pScrn->ScreenInit = VMWAREScreenInit; + pScrn->SwitchMode = VMWARESwitchMode; + pScrn->AdjustFrame = VMWAREAdjustFrame; + pScrn->EnterVT = VMWAREEnterVT; + pScrn->LeaveVT = VMWARELeaveVT; + pScrn->FreeScreen = VMWAREFreeScreen; + pScrn->ValidMode = VMWAREValidMode; + foundScreen = TRUE; + } + } + xfree(usedChips); + } + return foundScreen; } DriverRec VMWARE = { - VERSION, - VMWARE_DRIVER_NAME, - VMWAREIdentify, - VMWAREProbe, - VMWAREAvailableOptions, - NULL, - 0 + VERSION, + VMWARE_DRIVER_NAME, + VMWAREIdentify, + VMWAREProbe, + VMWAREAvailableOptions, + NULL, + 0 }; #ifdef XFree86LOADER @@ -1150,288 +1387,20 @@ static pointer vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin) { - static Bool setupDone = FALSE; + static Bool setupDone = FALSE; - if (!setupDone) { - setupDone = TRUE; - xf86AddDriver(&VMWARE, module, 0); + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&VMWARE, module, 0); - LoaderRefSymLists(vgahwSymbols, fbSymbols, NULL); - - return (pointer)1; - } - if (errmaj) { - *errmaj = LDR_ONCEONLY; - } - return NULL; -} -#endif /* XFree86LOADER */ - -ScreenPtr funcglob; -ScrnInfoPtr scrnglob; -int vmwareGCPrivateIndex; - -static void -ScreenToPrivate(ScreenPtr pScreen, ScrnInfoPtr pScrn) -{ - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - - pVMWARE->ScrnFuncs = *pScreen; - funcglob = &pVMWARE->ScrnFuncs; - scrnglob = pScrn; - - pScreen->CloseScreen = VMWARECloseScreen; - pScreen->SaveScreen = VMWARESaveScreen; + LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols, + shadowfbSymbols, vmwareXaaSymbols, NULL); -#if 0 - pScreen->QueryBestSize = vmwareQueryBestSize; - pScreen->GetImage = vmwareGetImage; - pScreen->GetSpans = vmwareGetSpans; - pScreen->PointerNonInterestBox = vmwarePointerNonInterestBox; - pScreen->SourceValidate = vmwareSourceValidate; - - pScreen->CreateWindow = vmwareCreateWindow; - pScreen->DestroyWindow = vmwareDestroyWindow; - pScreen->PositionWindow = vmwarePositionWindow; - pScreen->ChangeWindowAttributes = vmwareChangeWindowAttributes; - pScreen->RealizeWindow = vmwareRealizeWindow; - pScreen->UnrealizeWindow = vmwareUnrealizeWindow; - pScreen->ValidateTree = vmwareValidateTree; -// pScreen->PostValidateTree = vmwarePostValidateTree; - pScreen->WindowExposures = vmwareWindowExposures; - pScreen->PaintWindowBackground = vmwarePaintWindowBackground; - pScreen->PaintWindowBorder = vmwarePaintWindowBorder; - pScreen->CopyWindow = vmwareCopyWindow; - pScreen->ClearToBackground = vmwareClearToBackground; - pScreen->ClipNotify = vmwareClipNotify; - pScreen->RestackWindow = vmwareRestackWindow; - - /* Pixmap procedures */ - - pScreen->CreatePixmap = vmwareCreatePixmap; - pScreen->DestroyPixmap = vmwareDestroyPixmap; - - /* Backing store procedures */ - - pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas; - pScreen->RestoreAreas = vmwareRestoreAreas; - pScreen->ExposeCopy = vmwareExposeCopy; - pScreen->TranslateBackingStore = vmwareTranslateBackingStore; - pScreen->ClearBackingStore = vmwareClearBackingStore; - pScreen->DrawGuarantee = vmwareDrawGuarantee; - /* - * A read/write copy of the lower level backing store vector is needed now - * that the functions can be wrapped. - */ -// pScreen->BackingStoreFuncs = vmwareBackingStoreFuncs; - - /* Font procedures */ - - pScreen->RealizeFont = vmwareRealizeFont; - pScreen->UnrealizeFont = vmwareUnrealizeFont; - - /* Cursor Procedures */ - - pScreen->ConstrainCursor = vmwareConstrainCursor; - pScreen->CursorLimits = vmwareCursorLimits; - pScreen->DisplayCursor = vmwareDisplayCursor; - pScreen->RealizeCursor = vmwareRealizeCursor; - pScreen->UnrealizeCursor = vmwareUnrealizeCursor; - pScreen->RecolorCursor = vmwareRecolorCursor; - pScreen->SetCursorPosition = vmwareSetCursorPosition; - - /* GC procedures */ - - pScreen->CreateGC = vmwareCreateGC; - - /* Colormap procedures */ - - pScreen->CreateColormap = vmwareCreateColormap; - pScreen->DestroyColormap = vmwareDestroyColormap; - pScreen->InstallColormap = vmwareInstallColormap; - pScreen->UninstallColormap = vmwareUninstallColormap; - pScreen->ListInstalledColormaps = vmwareListInstalledColormaps; - pScreen->StoreColors = vmwareStoreColors; - pScreen->ResolveColor = vmwareResolveColor; - - - pScreen->GetWindowPixmap = vmwareGetWindowPixmap; - pScreen->SetWindowPixmap = vmwareSetWindowPixmap; - pScreen->GetScreenPixmap = vmwareGetScreenPixmap; - pScreen->SetScreenPixmap = vmwareSetScreenPixmap; - -#endif - - pScreen->PaintWindowBackground = vmwarePaintWindow; - pScreen->PaintWindowBorder = vmwarePaintWindow; - pScreen->CopyWindow = vmwareCopyWindow; - pScreen->CreateGC = vmwareCreateGC; - pScreen->GetSpans = vmwareGetSpans; - pScreen->GetImage = vmwareGetImage; - pScreen->BlockHandler = vmwareBlockHandler; - pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas; - pScreen->RestoreAreas = vmwareRestoreAreas; - - vmwareGCPrivateIndex = AllocateGCPrivateIndex(); - if (!AllocateGCPrivate(pScreen, vmwareGCPrivateIndex, - sizeof(vmwarePrivGC))) return; - - - switch (pScrn->bitsPerPixel) { - case 8: - pVMWARE->Pmsk = 0x000000FF; - break; - case 16: - pVMWARE->Pmsk = 0x0000FFFF; - break; - case 24: - pVMWARE->Pmsk = 0x00FFFFFF; - break; - case 32: - pVMWARE->Pmsk = 0xFFFFFFFF; - break; + return (pointer)1; } -} - -static void ScreenFromPrivate(ScreenPtr pScreen, ScrnInfoPtr p) -{ - VMWAREPtr pVMWARE = VMWAREPTR(p); - ScreenPtr save = &pVMWARE->ScrnFuncs; - - /* Random screen procedures */ - - pScreen->CloseScreen = save->CloseScreen; - pScreen->QueryBestSize = save->QueryBestSize; - pScreen->SaveScreen = save->SaveScreen; - pScreen->GetImage = save->GetImage; - pScreen->GetSpans = save->GetSpans; - pScreen->PointerNonInterestBox = save->PointerNonInterestBox; - pScreen->SourceValidate = save->SourceValidate; - - /* Window Procedures */ - - pScreen->CreateWindow = save->CreateWindow; - pScreen->DestroyWindow = save->DestroyWindow; - pScreen->PositionWindow = save->PositionWindow; - pScreen->ChangeWindowAttributes = save->ChangeWindowAttributes; - pScreen->RealizeWindow = save->RealizeWindow; - pScreen->UnrealizeWindow = save->UnrealizeWindow; - pScreen->ValidateTree = save->ValidateTree; - pScreen->PostValidateTree = save->PostValidateTree; - pScreen->WindowExposures = save->WindowExposures; - pScreen->PaintWindowBackground = save->PaintWindowBackground; - pScreen->PaintWindowBorder = save->PaintWindowBorder; - pScreen->CopyWindow = save->CopyWindow; - pScreen->ClearToBackground = save->ClearToBackground; - pScreen->ClipNotify = save->ClipNotify; - pScreen->RestackWindow = save->RestackWindow; - - /* Pixmap procedures */ - - pScreen->CreatePixmap = save->CreatePixmap; - pScreen->DestroyPixmap = save->DestroyPixmap; - - /* Backing store procedures */ - - pScreen->SaveDoomedAreas = save->SaveDoomedAreas; - pScreen->RestoreAreas = save->RestoreAreas; - pScreen->ExposeCopy = save->ExposeCopy; - pScreen->TranslateBackingStore = save->TranslateBackingStore; - pScreen->ClearBackingStore = save->ClearBackingStore; - pScreen->DrawGuarantee = save->DrawGuarantee; - /* - * A read/write copy of the lower level backing store vector is needed now - * that the functions can be wrapped. - */ - pScreen->BackingStoreFuncs = save->BackingStoreFuncs; - - /* Font procedures */ - - pScreen->RealizeFont = save->RealizeFont; - pScreen->UnrealizeFont = save->UnrealizeFont; - - /* Cursor Procedures */ - - pScreen->ConstrainCursor = save->ConstrainCursor; - pScreen->CursorLimits = save->CursorLimits; - pScreen->DisplayCursor = save->DisplayCursor; - pScreen->RealizeCursor = save->RealizeCursor; - pScreen->UnrealizeCursor = save->UnrealizeCursor; - pScreen->RecolorCursor = save->RecolorCursor; - pScreen->SetCursorPosition = save->SetCursorPosition; - - /* GC procedures */ - - pScreen->CreateGC = save->CreateGC; - - /* Colormap procedures */ - - pScreen->CreateColormap = save->CreateColormap; - pScreen->DestroyColormap = save->DestroyColormap; - pScreen->InstallColormap = save->InstallColormap; - pScreen->UninstallColormap = save->UninstallColormap; - pScreen->ListInstalledColormaps = save->ListInstalledColormaps; - pScreen->StoreColors = save->StoreColors; - pScreen->ResolveColor = save->ResolveColor; - - /* Region procedures */ - -#ifdef NEED_SCREEN_REGIONS - pScreen->RegionCreate = save->RegionCreate; - pScreen->RegionInit = save->RegionInit; - pScreen->RegionCopy = save->RegionCopy; - pScreen->RegionDestroy = save->RegionDestroy; - pScreen->RegionUninit = save->RegionUninit; - pScreen->Intersect = save->Intersect; - pScreen->Union = save->Union; - pScreen->Subtract = save->Subtract; - pScreen->Inverse = save->Inverse; - pScreen->RegionReset = save->RegionReset; - pScreen->TranslateRegion = save->TranslateRegion; - pScreen->RectIn = save->RectIn; - pScreen->PointInRegion = save->PointInRegion; - pScreen->RegionNotEmpty = save->RegionNotEmpty; - pScreen->RegionBroken = save->RegionBroken; - pScreen->RegionBreak = save->RegionBreak; - pScreen->RegionEmpty = save->RegionEmpty; - pScreen->RegionExtents = save->RegionExtents; - pScreen->RegionAppend = save->RegionAppend; - pScreen->RegionValidate = save->RegionValidate; -#endif /* NEED_SCREEN_REGIONS */ - pScreen->BitmapToRegion = save->BitmapToRegion; -#ifdef NEED_SCREEN_REGIONS - pScreen->RectsToRegion = save->RectsToRegion; -#endif /* NEED_SCREEN_REGIONS */ - pScreen->SendGraphicsExpose = save->SendGraphicsExpose; - - /* os layer procedures */ - - pScreen->BlockHandler = save->BlockHandler; - pScreen->WakeupHandler = save->WakeupHandler; - - pScreen->CreateScreenResources = save->CreateScreenResources; - pScreen->ModifyPixmapHeader = save->ModifyPixmapHeader; - - pScreen->GetWindowPixmap = save->GetWindowPixmap; - pScreen->SetWindowPixmap = save->SetWindowPixmap; - pScreen->GetScreenPixmap = save->GetScreenPixmap; - pScreen->SetScreenPixmap = save->SetScreenPixmap; - - pScreen->MarkWindow = save->MarkWindow; - pScreen->MarkOverlappedWindows = save->MarkOverlappedWindows; - pScreen->ChangeSaveUnder = save->ChangeSaveUnder; - pScreen->PostChangeSaveUnder = save->PostChangeSaveUnder; - pScreen->MoveWindow = save->MoveWindow; - pScreen->ResizeWindow = save->ResizeWindow; - pScreen->GetLayerWindow = save->GetLayerWindow; - pScreen->HandleExposures = save->HandleExposures; - pScreen->ReparentWindow = save->ReparentWindow; - -#ifdef SHAPE - pScreen->SetShape = save->SetShape; -#endif /* SHAPE */ - - pScreen->ChangeBorderWidth = save->ChangeBorderWidth; - pScreen->MarkUnrealizedWindow = save->MarkUnrealizedWindow; + if (errmaj) { + *errmaj = LDR_ONCEONLY; + } + return NULL; } - +#endif /* XFree86LOADER */ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.3 Thu Sep 13 04:36:24 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h Mon Feb 3 20:39:53 2003 @@ -3,7 +3,7 @@ * All Rights Reserved * Id: vmware.h,v 1.6 2001/01/30 18:13:47 bennett Exp $ * **********************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.3 2001/09/13 08:36:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.10 2003/02/04 01:39:53 dawes Exp $ */ #ifndef VMWARE_H #define VMWARE_H @@ -13,749 +13,253 @@ #include "xf86_ansic.h" #include "xf86Resources.h" -#include "compiler.h" /* inb/outb */ +#include "compiler.h" /* inb/outb */ #include "xf86PciInfo.h" /* pci vendor id */ #include "xf86Pci.h" /* pci */ +#include "xf86Cursor.h" /* hw cursor */ -#include "mipointer.h" /* sw cursor */ -#include "mibstore.h" /* backing store */ -#include "micmap.h" /* mi color map */ #include "vgaHW.h" /* VGA hardware */ #include "fb.h" +#include "xaa.h" #include "xf86cmap.h" /* xf86HandleColormaps */ #include "vm_basic_types.h" #include "svga_reg.h" +#include "svga_struct.h" +#include "offscreen_manager.h" + +/* Arbitrarily choose max cursor dimensions. The emulation doesn't care. */ +#define MAX_CURS 32 + typedef struct { - CARD32 svga_reg_enable; - CARD32 svga_reg_width; - CARD32 svga_reg_height; + CARD32 svga_reg_enable; + CARD32 svga_reg_width; + CARD32 svga_reg_height; + CARD32 svga_reg_bits_per_pixel; + + CARD32 svga_reg_cursor_on; + CARD32 svga_reg_cursor_x; + CARD32 svga_reg_cursor_y; + CARD32 svga_reg_cursor_id; + + Bool svga_fifo_enabled; } VMWARERegRec, *VMWARERegPtr; typedef struct { - DisplayModePtr mode; -} VMWAREFBLayout; + EntityInfoPtr pEnt; + pciVideoPtr PciInfo; + PCITAG PciTag; + Bool Primary; + int depth; + int bitsPerPixel; + rgb weight; + rgb offset; + int defaultVisual; + int videoRam; + unsigned long memPhysBase; + unsigned long fbOffset; + unsigned long fbPitch; + unsigned long ioBase; + int maxWidth; + int maxHeight; + unsigned int vmwareCapability; + + unsigned char* FbBase; + unsigned long FbSize; + + VMWARERegRec SavedReg; + VMWARERegRec ModeReg; + + Bool* pvtSema; + + Bool noAccel; + Bool hwCursor; + Bool cursorDefined; + int cursorSema; + Bool cursorExcludedForUpdate; + Bool cursorShouldBeHidden; + + unsigned int cursorRemoveFromFB; + unsigned int cursorRestoreToFB; + +#ifdef RENDER + CompositeProcPtr Composite; +#endif /* RENDER */ + + unsigned long mmioPhysBase; + unsigned long mmioSize; + + unsigned char* mmioVirtBase; + CARD32* vmwareFIFO; + + xf86CursorInfoPtr CursorInfoRec; + struct { + int bg, fg, x, y; + BoxRec box; + + uint32 mask[SVGA_BITMAP_SIZE(MAX_CURS, MAX_CURS)]; + uint32 maskPixmap[SVGA_PIXMAP_SIZE(MAX_CURS, MAX_CURS, 32)]; + uint32 source[SVGA_BITMAP_SIZE(MAX_CURS, MAX_CURS)]; + uint32 sourcePixmap[SVGA_PIXMAP_SIZE(MAX_CURS, MAX_CURS, 32)]; + } hwcur; + + IOADDRESS indexReg, valueReg; + + ScreenRec ScrnFuncs; + + /* + * XAA info rec and misc storage + */ + XAAInfoRecPtr xaaInfo; + int xaaFGColor; + int xaaBGColor; + int xaaRop; -typedef struct { - EntityInfoPtr pEnt; - pciVideoPtr PciInfo; - PCITAG PciTag; - Bool Primary; - int depth; - int bitsPerPixel; - rgb weight; - rgb offset; - int defaultVisual; - int videoRam; - unsigned long memPhysBase; - unsigned long fbOffset; - unsigned long fbPitch; - unsigned long ioBase; - int maxWidth; - int maxHeight; - unsigned int vmwareCapability; - - unsigned char* FbBase; - unsigned long FbSize; - - VMWARERegRec SavedReg; - VMWARERegRec ModeReg; - - VMWAREFBLayout CurrentLayout; - Bool noAccel; - Bool hwCursor; - Bool cursorDefined; - Bool mouseHidden; - - unsigned int cursorRemoveFromFB; - unsigned int cursorRestoreToFB; - - unsigned long mmioPhysBase; - unsigned long mmioSize; - - unsigned char* mmioVirtBase; - CARD32* vmwareFIFO; - Bool vmwareFIFOMarkSet; - BoxRec vmwareAccelArea; - struct { - BoxRec Box; - unsigned int Width; - unsigned int Height; - unsigned int XHot; - unsigned int YHot; - } Mouse; - Bool checkCursorColor; - unsigned int vmwareBBLevel; - unsigned long Pmsk; + unsigned char* xaaColorExpScanLine[1]; + unsigned int xaaColorExpSize; /* size of current scan line in DWords */ + + Heap* heap; + SVGASurface* frontBuffer; - uint16 indexReg, valueReg; + SVGASurface* curPict; + int op; - ScreenRec ScrnFuncs; - /* ... */ } VMWARERec, *VMWAREPtr; #define VMWAREPTR(p) ((VMWAREPtr)((p)->driverPrivate)) static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) { - return xf86Screens[s->myNum]; + return xf86Screens[s->myNum]; } -#include "gcstruct.h" +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define MAX(a,b) ((a)>(b)?(a):(b)) +#define ABS(x) (((x) >= 0) ? (x) : -(x)) -#define MIN(a,b) ((a)<(b)?(a):(b)) -#define MAX(a,b) ((a)>(b)?(a):(b)) - -#define GC_FUNC_PROLOGUE(pGC) \ -{ \ - vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \ - (pGC)->funcs = pGCPriv->wrapFuncs; \ - (pGC)->ops = pGCPriv->wrapOps; \ -} - -#define GC_FUNC_EPILOGUE(pGC) \ -{ \ - vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \ - pGCPriv->wrapFuncs = (pGC)->funcs; \ - (pGC)->funcs = &vmwareGCFuncs; \ - pGCPriv->wrapOps = (pGC)->ops; \ - (pGC)->ops = &vmwareGCOps; \ -} - -#define GC_OPS(pGC) ((vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr)->wrapOps - -#define MOUSE_ID 1 - -#define UPDATE_ACCEL_AREA(pVMWARE,box) \ -{ \ - if (!(pVMWARE)->vmwareFIFOMarkSet) { \ - (pVMWARE)->vmwareFIFOMarkSet = TRUE; \ - (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \ - (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \ - (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \ - (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \ - } else { \ - if ((box).x1 < (pVMWARE)->vmwareAccelArea.x1) \ - (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \ - if ((box).y1 < (pVMWARE)->vmwareAccelArea.y1) \ - (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \ - if ((box).x2 > (pVMWARE)->vmwareAccelArea.x2) \ - (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \ - if ((box).y2 > (pVMWARE)->vmwareAccelArea.y2) \ - (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \ - } \ -} - -#define ABS(x) (((x) >= 0) ? (x) : -(x)) #define BOX_INTERSECT(a, b) \ (ABS(((a).x1 + (a).x2) - ((b).x1 + (b).x2)) <= \ ((a).x2 - (a).x1) + ((b).x2 - (b).x1) && \ ABS(((a).y1 + (a).y2) - ((b).y1 + (b).y2)) <= \ ((a).y2 - (a).y1) + ((b).y2 - (b).y1)) -#define HIDE_CURSOR(vmPtr,box) \ -{ \ - if (!(vmPtr)->mouseHidden) { \ - if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ - BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ - (vmPtr)->mouseHidden = TRUE; \ - if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \ - vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \ - vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, \ - (vmPtr)->cursorRemoveFromFB); \ - } else { \ - vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ - vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ - vmwareWriteWordToFIFO(vmPtr, 0); \ - UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ - } \ - } \ - } \ -} +#define SVGA_GLYPH_SCANLINE_SIZE_DWORDS(w) (((w) + 31) >> 5) -#define HIDE_CURSOR_ACCEL(vmPtr,box) \ -{ \ - if (!(vmPtr)->mouseHidden) { \ - if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ - !((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) && \ - BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ - (vmPtr)->mouseHidden = TRUE; \ - vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ - vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ - vmwareWriteWordToFIFO(vmPtr, 0); \ - UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ +#define PRE_OP_HIDE_CURSOR() \ + if (pVMWARE->cursorDefined && *pVMWARE->pvtSema) { \ + pVMWARE->cursorSema++; \ + if (pVMWARE->cursorSema == 1) { \ + vmwareWriteCursorRegs(pVMWARE, FALSE, FALSE); \ } \ - } \ -} - - -#define SHOW_CURSOR(vmPtr,box) \ -{ \ - if ((vmPtr)->mouseHidden) { \ - if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ - BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ - (vmPtr)->mouseHidden = FALSE; \ - if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \ - vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \ - vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, \ - (vmPtr)->cursorRestoreToFB); \ - } else { \ - vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ - vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ - vmwareWriteWordToFIFO(vmPtr, 1); \ - UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ - } \ - } \ - } \ -} + } +#define POST_OP_SHOW_CURSOR() \ + if (pVMWARE->cursorDefined && *pVMWARE->pvtSema) { \ + pVMWARE->cursorSema--; \ + if (!pVMWARE->cursorSema && !pVMWARE->cursorShouldBeHidden) { \ + vmwareWriteCursorRegs(pVMWARE, TRUE, FALSE); \ + } \ + } -/* Only use this for debugging */ +#define MOUSE_ID 1 -#define HIDE_CURSOR_ALWAYS(vmPtr,box) \ -{ \ - vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ - vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ - vmwareWriteWordToFIFO(vmPtr, 0); \ - (vmPtr)->mouseHidden = TRUE; \ - vmwareFIFOMarkSet = TRUE; \ - UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ -} +extern const char *vmwareXaaSymbols[]; -#define SHOW_CURSOR_ALWAYS(vmPtr,box) \ -{ \ - vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ - vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ - vmwareWriteWordToFIFO(vmPtr, 1); \ - (vmPtr)->mouseHidden = FALSE; \ - vmwareFIFOMarkSet = TRUE; \ -} - /*#define DEBUG_LOGGING*/ -#undef DEBUG_LOGGING #ifdef DEBUG_LOGGING -#define VmwareLog(args) ErrorF args -#define TRACEPOINT VmwareLog((__FUNCTION__ ":" __FILE__ "\n")); +# define VmwareLog(args) ErrorF args +# define TRACEPOINT VmwareLog((__FUNCTION__ ":" __FILE__ "\n")); #else -#define VmwareLog(args) -#define TRACEPOINT +# define VmwareLog(args) +# define TRACEPOINT #endif /* Undefine this to kill all acceleration */ #define ACCELERATE_OPS -typedef struct vmwarePrivGC -{ - GCFuncs *wrapFuncs; - GCOps *wrapOps; -} -vmwarePrivGC, *vmwarePrivGCPtr; - - -extern int vmwareGCPrivateIndex; - -#define GEN_FUNC_WRAPPER(cond,init,setBB,op) \ - if ((cond)) { \ - init; \ - \ - if (pVMWARE->vmwareBBLevel == 0) { \ - BoxRec BB; \ - \ - setBB; \ - HIDE_CURSOR(pVMWARE, BB); \ - vmwareWaitForFB(pVMWARE); \ - pVMWARE->vmwareBBLevel++; \ - op; \ - pVMWARE->vmwareBBLevel--; \ - vmwareSendSVGACmdUpdate(pVMWARE, &BB); \ - SHOW_CURSOR(pVMWARE, BB); \ - } else { \ - vmwareWaitForFB(pVMWARE); \ - op; \ - } \ - } else { \ - op; \ - } -#define VM_FUNC_WRAPPER(cond,setBB,op) \ - GEN_FUNC_WRAPPER(cond,,setBB,op) - -#define GC_FUNC_WRAPPER(cond,screen,setBB,op) \ - GEN_FUNC_WRAPPER(cond, VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)), setBB, op) - -#define GC_FUNC_ACCEL_WRAPPER(cond,screen,setBB,accelcond,accel,op) \ - GEN_FUNC_WRAPPER(cond, \ - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)); \ - if (accelcond) { \ - BoxRec BB; \ - Bool hidden = pVMWARE->mouseHidden; \ - \ - setBB; \ - if (!hidden) { \ - HIDE_CURSOR_ACCEL(pVMWARE, BB); \ - } \ - accel; \ - if (!hidden) { \ - SHOW_CURSOR(pVMWARE, BB); \ - } \ - UPDATE_ACCEL_AREA(pVMWARE, BB); \ - return; \ - }, \ - setBB, op) - void vmwareWriteReg( #if NeedFunctionPrototypes - VMWAREPtr pVMWARE, int index, CARD32 value + VMWAREPtr pVMWARE, int index, CARD32 value #endif + ); + +CARD32 vmwareReadReg( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, int index +#endif ); void vmwareWriteWordToFIFO( #if NeedFunctionPrototypes - VMWAREPtr pVMWARE, CARD32 value + VMWAREPtr pVMWARE, CARD32 value #endif - ); + ); void vmwareWaitForFB( #ifdef NeedFunctionPrototypes - VMWAREPtr pVMWARE + VMWAREPtr pVMWARE #endif - ); + ); void vmwareSendSVGACmdUpdate( -#if NeedFunctionPrototypes - VMWAREPtr pVMWARE, BoxPtr pBB -#endif - ); - -/* vmwaregc.c */ - -void vmwareInitGC( -#if NeedFunctionPrototypes - void -#endif - ); - -Bool vmwareCreateGC( -#if NeedFunctionPrototypes - GCPtr pGC -#endif - ); - -void vmwareValidateGC( -#if NeedFunctionPrototypes - GCPtr pGC, unsigned long changes, DrawablePtr pDrawable -#endif - ); - -void vmwareChangeGC( -#if NeedFunctionPrototypes - GCPtr pGC, unsigned long changes -#endif - ); - -void vmwareCopyGC( -#if NeedFunctionPrototypes - GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst -#endif - ); - -void vmwareDestroyGC( -#if NeedFunctionPrototypes - GCPtr pGC -#endif - ); - -void vmwareChangeClip( -#if NeedFunctionPrototypes - GCPtr pGC, int type, pointer pValue, int nrects -#endif - ); - -void vmwareDestroyClip( -#if NeedFunctionPrototypes - GCPtr pGC -#endif - ); - -void vmwareCopyClip( -#if NeedFunctionPrototypes - GCPtr pGCDst, GCPtr pGCSrc -#endif - ); - -/* vmwareinit.c */ - -void vmwareInitEnvironment( -#if NeedFunctionPrototypes - void -#endif - ); - -void vmwareInitDisplay( -#if NeedFunctionPrototypes - int screen_idx -#endif - ); - -void vmwareCleanUp( -#if NeedFunctionPrototypes - void -#endif - ); - -/* vmwarescrin.c */ -CARD32 vmwareCalculateOffset(CARD32 mask); - -Bool vmwareScreenInit( -#if NeedFunctionPrototypes - ScreenPtr pScreen, - pointer pbits, int xsize, int ysize, int dpix, int dpiy, int width -#endif - ); - -/* vmwarevga.c */ - -void vmwareSaveVGAInfo( -#if NeedFunctionPrototypes - int screen_idx -#endif - ); - -void vmwareRestoreVGAInfo( -#if NeedFunctionPrototypes - void -#endif - ); - -/* vmwarecmap.c */ - -void vmwareSetPaletteBase( -#if NeedFunctionPrototypes - int pal -#endif - ); - -int vmwareListInstalledColormaps( -#if NeedFunctionPrototypes - ScreenPtr pScreen, Colormap * pmaps -#endif - ); - -int vmwareGetInstalledColormaps( -#if NeedFunctionPrototypes - ScreenPtr pScreen, ColormapPtr * pmap -#endif - ); - -void vmwareStoreColors( #if NeedFunctionPrototypes - ColormapPtr pmap, int ndef, xColorItem * pdefs + VMWAREPtr pVMWARE, BoxPtr pBB #endif - ); + ); -void vmwareInstallColormap( -#if NeedFunctionPrototypes - ColormapPtr pmap -#endif - ); - -void vmwareUninstallColormap( -#if NeedFunctionPrototypes - ColormapPtr pmap -#endif - ); - -void vmwareRestoreColor0( -#if NeedFunctionPrototypes - ScreenPtr pScreen -#endif - ); - /* vmwarecurs.c */ Bool vmwareCursorInit( #if NeedFunctionPrototypes - char *pm, ScreenPtr pScr + ScreenPtr pScr #endif - ); + ); -Bool vmwareRealizeCursor( +void vmwareCursorModeInit( #if NeedFunctionPrototypes - ScreenPtr pScr, CursorPtr pCurs + ScrnInfoPtr pScrn, + DisplayModePtr mode #endif - ); + ); -Bool vmwareUnrealizeCursor( +void vmwareCursorCloseScreen( #if NeedFunctionPrototypes - ScreenPtr pScr, CursorPtr pCurs -#endif - ); - -void vmwareSetCursor( -#if NeedFunctionPrototypes - ScreenPtr pScr, CursorPtr pCurs, int x, int y -#endif - ); - -void vmwareRepositionCursor( -#if NeedFunctionPrototypes - ScreenPtr pScr -#endif - ); - -void vmwareRestoreCursor( -#if NeedFunctionPrototypes - ScreenPtr pScr -#endif - ); - -void vmwareMoveCursor( -#if NeedFunctionPrototypes - ScreenPtr pScr, int x, int y -#endif - ); - -void vmwareRenewCursorColor( -#if NeedFunctionPrototypes ScreenPtr pScr #endif ); - -void vmwareRecolorCursor( -#if NeedFunctionPrototypes - ScreenPtr pScr, CursorPtr pCurs, Bool displayed -#endif - ); - -void vmwareWarpCursor( -#if NeedFunctionPrototypes - ScreenPtr pScr, int x, int y -#endif - ); - -void vmwareQueryBestSize( -#if NeedFunctionPrototypes - int class, unsigned short *pwidth, unsigned short *pheight, ScreenPtr pScr -#endif - ); -void vmwareCursorOff( +void vmwareWriteCursorRegs( #if NeedFunctionPrototypes - VMWAREPtr pVMWARE + VMWAREPtr pVMWARE, + Bool visible, + Bool force #endif - ); - -void vmwareClearSavedCursor( -#if NeedFunctionPrototypes - int scr_index -#endif - ); - -void vmwareBlockHandler( -#if NeedFunctionPrototypes - int i, pointer blockData, pointer pTimeout, pointer pReadmask -#endif - ); - -/* BEGIN Screen functions that draw */ - -void vmwareCopyWindow( -#if NeedFunctionPrototypes - WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc -#endif - ); - -void vmwarePaintWindow( -#if NeedFunctionPrototypes - WindowPtr pWindow, RegionPtr pRegion, int what -#endif - ); + ); -void vmwareGetSpans( +void vmwareCursorHookWrappers( #if NeedFunctionPrototypes - DrawablePtr pDrawable, - int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst + ScreenPtr pScreen #endif - ); + ); -void vmwareGetImage( -#if NeedFunctionPrototypes - DrawablePtr src, - int x, - int y, - int w, - int h, unsigned int format, unsigned long planeMask, char *pBinImage -#endif - ); -void vmwareSaveDoomedAreas( +/* vmwarexaa.c */ +Bool vmwareXAAScreenInit( #if NeedFunctionPrototypes - WindowPtr pWin, RegionPtr prgnSave, int xorg, int yorg + ScreenPtr pScreen #endif - ); + ); -RegionPtr vmwareRestoreAreas( +Bool vmwareXAAModeInit( #if NeedFunctionPrototypes - WindowPtr pWin, - RegionPtr prgnRestore + ScrnInfoPtr pScrn, DisplayModePtr mode #endif ); - -/* END Screen functions that draw */ -/* BEGIN GCOps */ - -void vmwareFillSpans( +void vmwareXAACloseScreen( #if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted + ScreenPtr pScreen #endif - ); - -void vmwareSetSpans( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, - char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted -#endif - ); - -void vmwarePutImage( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, - int depth, - int x, int y, int w, int h, int leftPad, int format, char *pBits -#endif - ); - -void -vmwareDoBitblt(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure); - -RegionPtr vmwareCopyArea( -#if NeedFunctionPrototypes - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty -#endif - ); - -RegionPtr vmwareCopyPlane( -#if NeedFunctionPrototypes - DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - int srcx, - int srcy, - int width, int height, int dstx, int dsty, unsigned long bitPlane -#endif - ); - -void vmwarePolyPoint( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit -#endif - ); - -void vmwarePolylines( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit -#endif - ); - -void vmwarePolySegment( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs -#endif - ); - -void vmwarePolyRectangle( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle * pRects -#endif - ); - -void vmwarePolyArc( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs -#endif - ); - -void vmwareFillPolygon( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts -#endif - ); - -void vmwarePolyFillRect( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle * prectInit -#endif - ); - -void vmwarePolyFillArc( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs -#endif - ); - -int vmwarePolyText8( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars -#endif - ); - -int vmwarePolyText16( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, unsigned short *chars -#endif - ); - -void vmwareImageText8( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars -#endif - ); - -void vmwareImageText16( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, unsigned short *chars -#endif - ); - -void vmwareImageGlyphBlt( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase -#endif - ); - -void vmwarePolyGlyphBlt( -#if NeedFunctionPrototypes - DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase -#endif - ); - -void vmwarePushPixels( -#if NeedFunctionPrototypes - GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y -#endif - ); + ); -/* END GCOps */ #endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:1.3 Wed Sep 5 18:13:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c Thu Feb 27 12:31:48 2003 @@ -1,208 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwareblt[] = - - "Id: vmwareblt.c,v 1.4 2001/01/27 00:28:15 bennett Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c,v 1.3 2001/09/05 22:13:10 keithp Exp $ */ - -#include "X.h" -#include "fb.h" -#include "vmware.h" - -void -vmwareDoBitblt(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - VMWAREPtr pVMWARE; - CARD8 alu; - - pVMWARE = VMWAREPTR(infoFromScreen(pSrc->pScreen)); - if (pGC) - alu = pGC->alu; - else - alu = GXcopy; - - /* Send the commands */ - while (nbox--) { - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_COPY); - vmwareWriteWordToFIFO(pVMWARE, pbox->x1 + dx); - vmwareWriteWordToFIFO(pVMWARE, pbox->y1 + dy); - vmwareWriteWordToFIFO(pVMWARE, pbox->x1); - vmwareWriteWordToFIFO(pVMWARE, pbox->y1); - vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); - vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); - vmwareWriteWordToFIFO(pVMWARE, alu); - pbox++; - } -} - -RegionPtr -vmwareCopyArea(DrawablePtr pSrcDrawable, -DrawablePtr pDstDrawable, -GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - RegionPtr prgn; - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen)); - - TRACEPOINT - if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY) && - (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) && - pSrcDrawable->type == DRAWABLE_WINDOW && - pDstDrawable->type == DRAWABLE_WINDOW && - (pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk) { - fbCopyProc doBitBlt; - BoxRec updateBB; - BoxRec mouseBB; - Bool hidden = pVMWARE->mouseHidden; - - updateBB.x1 = pDstDrawable->x + dstx; - updateBB.y1 = pDstDrawable->y + dsty; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); - mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); - mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; - mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; - doBitBlt = vmwareDoBitblt; - if (!hidden) { - HIDE_CURSOR_ACCEL(pVMWARE, mouseBB); - } - prgn = fbDoCopy (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, - height, dstx, dsty, doBitBlt, 0, 0); - if (!hidden) { - SHOW_CURSOR(pVMWARE, mouseBB); - } - UPDATE_ACCEL_AREA(pVMWARE, updateBB); - } else if (pDstDrawable->type == DRAWABLE_WINDOW || - pSrcDrawable->type == DRAWABLE_WINDOW) { - if (pVMWARE->vmwareBBLevel == 0) { - BoxRec updateBB; - BoxRec mouseBB; - - if (pDstDrawable->type == DRAWABLE_WINDOW && - pSrcDrawable->type != DRAWABLE_WINDOW) { - updateBB.x1 = pDstDrawable->x + dstx; - updateBB.y1 = pDstDrawable->y + dsty; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB = updateBB; - } else if (pDstDrawable->type != DRAWABLE_WINDOW && - pSrcDrawable->type == DRAWABLE_WINDOW) { - updateBB.x1 = pSrcDrawable->x + srcx; - updateBB.y1 = pSrcDrawable->y + srcy; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB = updateBB; - } else { - updateBB.x1 = pDstDrawable->x + dstx; - updateBB.y1 = pDstDrawable->y + dsty; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); - mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); - mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; - mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; - } - HIDE_CURSOR(pVMWARE, mouseBB); - vmwareWaitForFB(pVMWARE); - pVMWARE->vmwareBBLevel++; - prgn = - GC_OPS(pGC)->CopyArea(pSrcDrawable, - pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); - pVMWARE->vmwareBBLevel--; - if (pDstDrawable->type == DRAWABLE_WINDOW) { - vmwareSendSVGACmdUpdate(pVMWARE, &updateBB); - } - SHOW_CURSOR(pVMWARE, mouseBB); - } else { - vmwareWaitForFB(pVMWARE); - prgn = - GC_OPS(pGC)->CopyArea(pSrcDrawable, - pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); - } - } else { - prgn = - GC_OPS(pGC)->CopyArea(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); - } - return prgn; -} - -RegionPtr -vmwareCopyPlane(DrawablePtr pSrcDrawable, -DrawablePtr pDstDrawable, -GCPtr pGC, -int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) -{ - RegionPtr prgn; - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen)); - - TRACEPOINT - - if (pDstDrawable->type == DRAWABLE_WINDOW || - pSrcDrawable->type == DRAWABLE_WINDOW) { - if (pVMWARE->vmwareBBLevel == 0) { - BoxRec updateBB; - BoxRec mouseBB; - - if (pDstDrawable->type == DRAWABLE_WINDOW && - pSrcDrawable->type != DRAWABLE_WINDOW) { - updateBB.x1 = pDstDrawable->x + dstx; - updateBB.y1 = pDstDrawable->y + dsty; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB = updateBB; - } else if (pDstDrawable->type != DRAWABLE_WINDOW && - pSrcDrawable->type == DRAWABLE_WINDOW) { - updateBB.x1 = pSrcDrawable->x + srcx; - updateBB.y1 = pSrcDrawable->y + srcy; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB = updateBB; - } else { - updateBB.x1 = pDstDrawable->x + dstx; - updateBB.y1 = pDstDrawable->y + dsty; - updateBB.x2 = updateBB.x1 + width; - updateBB.y2 = updateBB.y1 + height; - mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); - mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); - mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; - mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; - } - HIDE_CURSOR(pVMWARE, mouseBB); - vmwareWaitForFB(pVMWARE); - pVMWARE->vmwareBBLevel++; - prgn = fbCopyPlane(pSrcDrawable, - pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, - bitPlane); - pVMWARE->vmwareBBLevel--; - if (pDstDrawable->type == DRAWABLE_WINDOW) { - vmwareSendSVGACmdUpdate(pVMWARE, &updateBB); - } - SHOW_CURSOR(pVMWARE, mouseBB); - } else { - vmwareWaitForFB(pVMWARE); - prgn = fbCopyPlane(pSrcDrawable, - pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, - bitPlane); - } - } else { - prgn = fbCopyPlane(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - } - return prgn; -} - Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c Thu Feb 27 12:31:48 2003 @@ -1,65 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarebstor[] = - - "Id: vmwarebstor.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -void -vmwareSaveDoomedAreas(WindowPtr pWin, - RegionPtr prgnSave, int xorg, int yorg) -{ - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); - - TRACEPOINT - - if (pVMWARE->vmwareBBLevel == 0) { - BoxRec BB; - - BB = *REGION_EXTENTS(pWin->drawable.pScreen, prgnSave); - BB.x1 += xorg; - BB.x2 += xorg; - BB.y1 += yorg; - BB.y2 += yorg; - HIDE_CURSOR(pVMWARE, BB); - vmwareWaitForFB(pVMWARE); - pVMWARE->vmwareBBLevel++; - pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg); - pVMWARE->vmwareBBLevel--; - SHOW_CURSOR(pVMWARE, BB); - } else { - pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg); - } -} - -RegionPtr -vmwareRestoreAreas(WindowPtr pWin, - RegionPtr prgnRestore) -{ - RegionPtr res; - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); - - TRACEPOINT - - if (pVMWARE->vmwareBBLevel == 0) { - BoxPtr pBB; - - pBB = REGION_EXTENTS(pWin->drawable.pScreen, prgnRestore); - HIDE_CURSOR(pVMWARE, *pBB); - vmwareWaitForFB(pVMWARE); - pVMWARE->vmwareBBLevel++; - res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore); - pVMWARE->vmwareBBLevel--; - vmwareSendSVGACmdUpdate(pVMWARE, pBB); - SHOW_CURSOR(pVMWARE, *pBB); - } else { - res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore); - } - return res; -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.3 Thu Sep 13 04:36:24 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c Wed Feb 5 07:47:42 2003 @@ -4,436 +4,442 @@ * **********************************************************/ #ifdef VMX86_DEVEL char rcsId_vmwarecurs[] = - "Id: vmwarecurs.c,v 1.5 2001/01/30 23:33:02 bennett Exp $"; #endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c,v 1.3 2001/09/13 08:36:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c,v 1.11 2003/02/05 12:47:42 dawes Exp $ */ #include "vmware.h" -#include "cursorstr.h" #include "bits2pixels.h" -typedef struct _VMwareCursPriv { - uint8 *bSource; - uint8 *bMask; - uint8 *pSource; - uint8 *pMask; -} VMwareCursPriv; - -static int vmwareCursGeneration = -1; -static CursorPtr vmwareSaveCursors[MAXSCREENS]; - -static miPointerSpriteFuncRec vmwarePointerSpriteFuncs = { - vmwareRealizeCursor, - vmwareUnrealizeCursor, - vmwareSetCursor, - vmwareMoveCursor, -}; +static void VMWAREGetImage(DrawablePtr src, int x, int y, int w, int h, + unsigned int format, unsigned long planeMask, + char *pBinImage); +static void VMWARECopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +#ifdef RENDER +static void VMWAREComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, + INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, + CARD16 width, CARD16 height); +#endif /* RENDER */ -Bool -vmwareCursorInit(char *pm, - ScreenPtr pScr) +static void +RedefineCursor(VMWAREPtr pVMWARE) { - TRACEPOINT - if (vmwareCursGeneration != serverGeneration) { - miPointerScreenFuncPtr xf86scrn = xf86GetPointerScreenFuncs(); - - pScr->QueryBestSize = vmwareQueryBestSize; - if (!(miPointerInitialize(pScr, &vmwarePointerSpriteFuncs, - xf86scrn, FALSE))) - return FALSE; - - pScr->RecolorCursor = vmwareRecolorCursor; - vmwareCursGeneration = serverGeneration; - } - return TRUE; -} - -static void ZeroBits(uint8 *buf, int preserveBits, int totalBits) { - while (preserveBits > 8) { - buf++; - preserveBits -= 8; - totalBits -= 8; - } - *buf &= ~(~0 << preserveBits); - buf++; - preserveBits -= 8; - totalBits -= 8; - while (totalBits > 0) { - *buf++ = 0; - totalBits -= 8; + int i; + + VmwareLog(("RedefineCursor\n")); + + pVMWARE->cursorDefined = FALSE; + + /* Define cursor */ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, 0); /* HotX/HotY seem to be zero? */ + vmwareWriteWordToFIFO(pVMWARE, 0); /* HotX/HotY seem to be zero? */ + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->CursorInfoRec->MaxWidth); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->CursorInfoRec->MaxHeight); + vmwareWriteWordToFIFO(pVMWARE, 1); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); + + /* + * Since we have AND and XOR masks rather than 'source' and 'mask', + * color expand 'mask' with all zero as its foreground and all one as + * its background. This makes 'image & 0 ^ 'source' = source. We + * arange for 'image' & 1 ^ 'source' = 'image' below when we clip + * 'source' below. + */ + vmwareRaster_BitsToPixels((uint8 *) pVMWARE->hwcur.mask, + SVGA_BITMAP_INCREMENT(pVMWARE->CursorInfoRec->MaxWidth), + (uint8 *) pVMWARE->hwcur.maskPixmap, + SVGA_PIXMAP_INCREMENT(pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->bitsPerPixel), + pVMWARE->bitsPerPixel / 8, + pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->CursorInfoRec->MaxHeight, 0, ~0); + for (i = 0; i < SVGA_BITMAP_SIZE(pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->CursorInfoRec->MaxHeight); i++) { + vmwareWriteWordToFIFO(pVMWARE, ~pVMWARE->hwcur.mask[i]); + } + + vmwareRaster_BitsToPixels((uint8 *) pVMWARE->hwcur.source, + SVGA_BITMAP_INCREMENT(pVMWARE->CursorInfoRec->MaxWidth), + (uint8 *) pVMWARE->hwcur.sourcePixmap, + SVGA_PIXMAP_INCREMENT(pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->bitsPerPixel), + pVMWARE->bitsPerPixel / 8, + pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->CursorInfoRec->MaxHeight, + pVMWARE->hwcur.fg, pVMWARE->hwcur.bg); + /* + * As pointed out above, we need to clip the expanded 'source' against + * the expanded 'mask' since we actually have AND and XOR masks in the + * virtual hardware. Effectively, 'source' becomes a three color fg/bg/0 + * pixmap that XORs appropriately. + */ + for (i = 0; i < SVGA_PIXMAP_SIZE(pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->CursorInfoRec->MaxHeight, + pVMWARE->bitsPerPixel); i++) { + pVMWARE->hwcur.sourcePixmap[i] &= ~pVMWARE->hwcur.maskPixmap[i]; + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->hwcur.sourcePixmap[i]); } + + /* Sync the FIFO, so that the definition preceeds any use of the cursor */ + vmwareWaitForFB(pVMWARE); + pVMWARE->cursorDefined = TRUE; } -Bool -vmwareRealizeCursor(ScreenPtr pScr, - CursorPtr pCurs) +static void +vmwareSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { - pointer *pPriv = &pCurs->bits->devPriv[pScr->myNum]; - VMwareCursPriv *cursPriv; - int i; - uint8 *bits; - VMWAREPtr pVMWARE; - + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); TRACEPOINT - if (pCurs->bits->refcnt > 1) - return TRUE; - cursPriv = (VMwareCursPriv *) xcalloc(1, sizeof(VMwareCursPriv)); - if (!cursPriv) - return FALSE; - cursPriv->bSource = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); - if (!cursPriv->bSource) { - xfree(cursPriv); - return FALSE; - } - pVMWARE = VMWAREPTR(infoFromScreen(pScr)); - - memcpy(cursPriv->bSource, pCurs->bits->source, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); - bits = cursPriv->bSource; - /* Handle cursors that do not have zero bits beyond the right edge of each scanline */ - for (i = 0; i < pCurs->bits->height; i++) { - ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8); - bits += PixmapBytePad(pCurs->bits->width, 1); - } - /* Raster_BitsToPixels expects most significant bit first */ - for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) { - cursPriv->bSource[i] = - (cursPriv->bSource[i] & 0x01) << 7 | - (cursPriv->bSource[i] & 0x02) << 5 | - (cursPriv->bSource[i] & 0x04) << 3 | - (cursPriv->bSource[i] & 0x08) << 1 | - (cursPriv->bSource[i] & 0x10) >> 1 | - (cursPriv->bSource[i] & 0x20) >> 3 | - (cursPriv->bSource[i] & 0x40) >> 5 | - (cursPriv->bSource[i] & 0x80) >> 7; - } - cursPriv->bMask = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); - if (!cursPriv->bMask) { - xfree(cursPriv->bSource); - xfree(cursPriv); - return FALSE; - } - memcpy(cursPriv->bMask, pCurs->bits->mask, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); - bits = cursPriv->bMask; - /* Handle cursors that do not have zero bits beyond the right edge of each scanline */ - for (i = 0; i < pCurs->bits->height; i++) { - ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8); - bits += PixmapBytePad(pCurs->bits->width, 1); - } - for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) { - cursPriv->bMask[i] = - (cursPriv->bMask[i] & 0x01) << 7 | - (cursPriv->bMask[i] & 0x02) << 5 | - (cursPriv->bMask[i] & 0x04) << 3 | - (cursPriv->bMask[i] & 0x08) << 1 | - (cursPriv->bMask[i] & 0x10) >> 1 | - (cursPriv->bMask[i] & 0x20) >> 3 | - (cursPriv->bMask[i] & 0x40) >> 5 | - (cursPriv->bMask[i] & 0x80) >> 7; - } - cursPriv->pSource = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel)); - if (!cursPriv->pSource) { - xfree(cursPriv->bMask); - xfree(cursPriv->bSource); - xfree(cursPriv); - return FALSE; - } - cursPriv->pMask = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel)); - if (!cursPriv->pMask) { - xfree(cursPriv->pSource); - xfree(cursPriv->bMask); - xfree(cursPriv->bSource); - xfree(cursPriv); - return FALSE; - } - Raster_BitsToPixels(cursPriv->bMask, PixmapBytePad(pCurs->bits->width, 1), - cursPriv->pMask, 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel), - pVMWARE->bitsPerPixel / 8, - pCurs->bits->width, pCurs->bits->height, 0, ~0); - *pPriv = (pointer) cursPriv; - return TRUE; + + if (pVMWARE->hwcur.fg != fg || pVMWARE->hwcur.bg != bg) { + VmwareLog(("SetCursorColors(0x%08x, 0x%08x)\n", bg, fg)); + pVMWARE->hwcur.fg = fg; + pVMWARE->hwcur.bg = bg; + RedefineCursor(pVMWARE); + } } -Bool -vmwareUnrealizeCursor(ScreenPtr pScr, - CursorPtr pCurs) +static void +vmwareLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src ) { - VMwareCursPriv *cursPriv; - + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + const int imageSize = SVGA_BITMAP_SIZE(pVMWARE->CursorInfoRec->MaxWidth, + pVMWARE->CursorInfoRec->MaxHeight); TRACEPOINT - if (pCurs->bits->refcnt <= 1 && - (cursPriv = pCurs->bits->devPriv[pScr->myNum])) { - xfree(cursPriv->pMask); - xfree(cursPriv->pSource); - xfree(cursPriv->bMask); - xfree(cursPriv->bSource); - xfree(cursPriv); - } - return TRUE; + + memcpy(pVMWARE->hwcur.source, src, imageSize * sizeof(uint32)); + memcpy(pVMWARE->hwcur.mask, + src + imageSize * sizeof(uint32), imageSize * sizeof(uint32)); + RedefineCursor(pVMWARE); } +#ifdef ARGB_CURSOR +#include "cursorstr.h" + +static Bool +vmwareUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScrn = infoFromScreen(pScreen); + return pCurs->bits->height <= MAX_CURS && + pCurs->bits->width <= MAX_CURS && + pScrn->bitsPerPixel > 8; +} + static void -vmwareLoadCursor(ScreenPtr pScr, - CursorPtr pCurs, - int x, - int y) +vmwareLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) { - VMWAREPtr pVMWARE; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + CARD32 width = pCurs->bits->width; + CARD32 height = pCurs->bits->height; + CARD32* image = pCurs->bits->argb; + CARD32* imageEnd = image + (width * height); - TRACEPOINT + pVMWARE->cursorDefined = FALSE; - if (!pCurs) - return; + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_ALPHA_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, 0); + vmwareWriteWordToFIFO(pVMWARE, 0); + vmwareWriteWordToFIFO(pVMWARE, width); + vmwareWriteWordToFIFO(pVMWARE, height); - pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + while (image != imageEnd) { + vmwareWriteWordToFIFO(pVMWARE, *image++); + } - pVMWARE->Mouse.Width = pCurs->bits->width; - pVMWARE->Mouse.Height = pCurs->bits->height; - pVMWARE->Mouse.XHot = pCurs->bits->xhot; - pVMWARE->Mouse.YHot = pCurs->bits->yhot; - vmwareRecolorCursor(pScr, pCurs, TRUE); - vmwareMoveCursor(pScr, x, y); + vmwareWaitForFB(pVMWARE); - if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) { - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); - vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); - vmwareWriteWordToFIFO(pVMWARE, 1); - } + pVMWARE->cursorDefined = TRUE; } +#endif void -vmwareSetCursor(ScreenPtr pScr, - CursorPtr pCurs, - int x, - int y) +vmwareWriteCursorRegs(VMWAREPtr pVMWARE, Bool visible, Bool force) { - int index = pScr->myNum; + int enableVal; - TRACEPOINT + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); + if (visible) { + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, pVMWARE->hwcur.x); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, pVMWARE->hwcur.y); + } - if (!pCurs) - return; + if (force) { + enableVal = visible ? SVGA_CURSOR_ON_SHOW : SVGA_CURSOR_ON_HIDE; + } else { + enableVal = visible ? pVMWARE->cursorRestoreToFB : + pVMWARE->cursorRemoveFromFB; + } + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, enableVal); +} + +/* disabled by default to reduce spew in DEBUG_LOGGING mode. */ +/* #define DEBUG_LOG_MOUSE_HIDE_SHOW */ - vmwareSaveCursors[index] = pCurs; - vmwareLoadCursor(pScr, pCurs, x, y); +static void +vmwareShowCursor(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); +#ifdef DEBUG_LOG_MOUSE_HIDE_SHOW + VmwareLog(("Show: %d %d %d\n", pVMWARE->cursorSema, pVMWARE->cursorDefined, + pVMWARE->cursorShouldBeHidden)); +#endif + pVMWARE->cursorShouldBeHidden = FALSE; + if (pVMWARE->cursorSema == 0 && pVMWARE->cursorDefined) { + vmwareWriteCursorRegs(pVMWARE, TRUE, TRUE); + } } -void -vmwareRestoreCursor(ScreenPtr pScr) +static void +vmwareHideCursor(ScrnInfoPtr pScrn) { - int index = pScr->myNum; - int x, y; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); +#ifdef DEBUG_LOG_MOUSE_HIDE_SHOW + VmwareLog(("Hide: %d %d %d\n", pVMWARE->cursorSema, pVMWARE->cursorDefined, + pVMWARE->cursorShouldBeHidden)); +#endif + if (pVMWARE->cursorDefined) { + vmwareWriteCursorRegs(pVMWARE, FALSE, TRUE); + } + pVMWARE->cursorShouldBeHidden = TRUE; +} - TRACEPOINT - - miPointerPosition(&x, &y); - vmwareLoadCursor(pScr, vmwareSaveCursors[index], x, y); +/* disabled by default to reduce spew in DEBUG_LOGGING mode. */ +/* #define DEBUG_LOG_MOUSE_MOVE */ + +static void +vmwareSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); +#ifdef DEBUG_LOG_MOUSE_MOVE + VmwareLog(("Move: %d %d %d\n", pVMWARE->cursorSema, pVMWARE->cursorDefined, + pVMWARE->cursorShouldBeHidden)); +#endif + /* + * We're bad people. We have no concept of a frame (VMWAREAdjustFrame() + * is a NOP). The hwcursor code expects us to be frame aware though, so + * we have to do this. I'm open to suggestions. I tried not even + * hooking AdjustFrame and it didn't help. + */ + pVMWARE->hwcur.x = x + pScrn->frameX0; + pVMWARE->hwcur.y = y + pScrn->frameY0; + pVMWARE->hwcur.box.x1 = pVMWARE->hwcur.x; + pVMWARE->hwcur.box.x2 = pVMWARE->hwcur.x + pVMWARE->CursorInfoRec->MaxWidth; + pVMWARE->hwcur.box.y1 = pVMWARE->hwcur.y; + pVMWARE->hwcur.box.y2 = pVMWARE->hwcur.y + pVMWARE->CursorInfoRec->MaxHeight; + + vmwareShowCursor(pScrn); } void -vmwareMoveCursor(ScreenPtr pScr, - int x, - int y) +vmwareCursorModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { - VMWAREPtr pVMWARE; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - TRACEPOINT - - pVMWARE = VMWAREPTR(infoFromScreen(pScr)); - - pVMWARE->Mouse.Box.x1 = x - pVMWARE->Mouse.XHot; - if (pVMWARE->Mouse.Box.x1 < 0) pVMWARE->Mouse.Box.x1 = 0; - pVMWARE->Mouse.Box.y1 = y - pVMWARE->Mouse.YHot; - if (pVMWARE->Mouse.Box.y1 < 0) pVMWARE->Mouse.Box.y1 = 0; - - pVMWARE->Mouse.Box.x2 = pVMWARE->Mouse.Box.x1 + pVMWARE->Mouse.Width; - pVMWARE->Mouse.Box.y2 = pVMWARE->Mouse.Box.y1 + pVMWARE->Mouse.Height; - - if (pVMWARE->cursorDefined && !pVMWARE->mouseHidden) { - if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, x); - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, y); - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, SVGA_CURSOR_ON_SHOW); - } else { - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_MOVE_CURSOR); - vmwareWriteWordToFIFO(pVMWARE, x); - vmwareWriteWordToFIFO(pVMWARE, y); - UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); - } + if (pVMWARE->cursorDefined) { + vmwareWriteCursorRegs(pVMWARE, !pVMWARE->cursorShouldBeHidden, TRUE); } } -void -vmwareRecolorCursor(ScreenPtr pScr, - CursorPtr pCurs, - Bool displayed) -{ - xColorItem sourceColor; - xColorItem maskColor; - VMwareCursPriv *cursPriv = pCurs->bits->devPriv[pScr->myNum]; - uint32 *b1, *b2; - int i; - VMWAREPtr pVMWARE; +Bool +vmwareCursorInit(ScreenPtr pScreen) +{ + xf86CursorInfoPtr infoPtr; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pScreen)); + Bool ret; TRACEPOINT - if (!displayed) - return; - - pVMWARE = VMWAREPTR(infoFromScreen(pScr)); - - sourceColor.red = pCurs->foreRed; - sourceColor.green = pCurs->foreGreen; - sourceColor.blue = pCurs->foreBlue; - - maskColor.red = pCurs->backRed; - maskColor.green = pCurs->backGreen; - maskColor.blue = pCurs->backBlue; - - if (pScr->rootDepth > 8) - { - sourceColor.pixel = (sourceColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red | - (sourceColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green | - (sourceColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue; - maskColor.pixel = (maskColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red | - (maskColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green | - (maskColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue; - } - else - { - ColormapPtr pmap; - - pmap = miInstalledMaps[pScr->myNum]; - - FakeAllocColor(pmap, &sourceColor); - FakeAllocColor(pmap, &maskColor); - - FakeFreeColor(pmap, sourceColor.pixel); - FakeFreeColor(pmap, maskColor.pixel); - - maskColor.red = maskColor.red >> 8; - maskColor.green = maskColor.green >> 8; - maskColor.blue = maskColor.blue >> 8; - - sourceColor.red = sourceColor.red >> 8; - sourceColor.green = sourceColor.green >> 8; - sourceColor.blue = sourceColor.blue >> 8; - } - - /* Calculate XOR mask */ - Raster_BitsToPixels(cursPriv->bSource, PixmapBytePad(pCurs->bits->width, 1), - cursPriv->pSource, - 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel), - pVMWARE->bitsPerPixel / 8, - pCurs->bits->width, pCurs->bits->height, sourceColor.pixel, maskColor.pixel); - b1 = (uint32 *) cursPriv->pSource; - b2 = (uint32 *) cursPriv->pMask; - for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { - *b1++ &= ~*b2++; + /* Require cursor bypass for hwcursor. Ignore deprecated FIFO hwcursor */ + if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) { + return FALSE; } - /* Define cursor */ - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_CURSOR); - vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); - vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->xhot); - vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->yhot); - vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->width); - vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->height); - vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); - vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); - b1 = (uint32 *) cursPriv->pSource; - b2 = (uint32 *) cursPriv->pMask; - for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { - vmwareWriteWordToFIFO(pVMWARE, *b2++); - } - for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { - vmwareWriteWordToFIFO(pVMWARE, *b1++); - /* vmwareWriteWordToFIFO(~0); */ + infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + + pVMWARE->CursorInfoRec = infoPtr; + + infoPtr->MaxWidth = MAX_CURS; + infoPtr->MaxHeight = MAX_CURS; + infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; + infoPtr->SetCursorColors = vmwareSetCursorColors; + infoPtr->SetCursorPosition = vmwareSetCursorPosition; + infoPtr->LoadCursorImage = vmwareLoadCursorImage; + infoPtr->HideCursor = vmwareHideCursor; + infoPtr->ShowCursor = vmwareShowCursor; + +#ifdef ARGB_CURSOR + if (pVMWARE->vmwareCapability & SVGA_CAP_ALPHA_CURSOR) { + infoPtr->UseHWCursorARGB = vmwareUseHWCursorARGB; + infoPtr->LoadCursorARGB = vmwareLoadCursorARGB; } - pVMWARE->checkCursorColor = FALSE; +#endif - /* Sync the FIFO, so that the definition preceeds any use of the cursor */ - UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); - vmwareWaitForFB(pVMWARE); - pVMWARE->cursorDefined = TRUE; + ret = xf86InitCursor(pScreen, infoPtr); + if (!ret) { + xf86DestroyCursorInfoRec(infoPtr); + pVMWARE->CursorInfoRec = NULL; + } + return ret; } void -vmwareRenewCursorColor(ScreenPtr pScr) +vmwareCursorCloseScreen(ScreenPtr pScreen) { - TRACEPOINT + ScrnInfoPtr pScrn = infoFromScreen(pScreen); + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +#endif + + pScreen->GetImage = pVMWARE->ScrnFuncs.GetImage; + pScreen->CopyWindow = pVMWARE->ScrnFuncs.CopyWindow; +#ifdef RENDER + if (ps) { + ps->Composite = pVMWARE->Composite; + } +#endif /* RENDER */ - if (vmwareSaveCursors[pScr->myNum]) - vmwareRecolorCursor(pScr, vmwareSaveCursors[pScr->myNum], TRUE); + vmwareHideCursor(pScrn); + xf86DestroyCursorInfoRec(pVMWARE->CursorInfoRec); } +/*** Wrap functions that read from the framebuffer ***/ + void -vmwareBlockHandler(i, blockData, pTimeout, pReadmask) - int i; - pointer blockData; - pointer pTimeout; - pointer pReadmask; +vmwareCursorHookWrappers(ScreenPtr pScreen) { - VMWAREPtr pVMWARE; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pScreen)); +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +#endif TRACEPOINT + + pVMWARE->ScrnFuncs.GetImage = pScreen->GetImage; + pVMWARE->ScrnFuncs.CopyWindow = pScreen->CopyWindow; + pScreen->GetImage = VMWAREGetImage; + pScreen->CopyWindow = VMWARECopyWindow; + +#ifdef RENDER + if (ps) { + pVMWARE->Composite = ps->Composite; + ps->Composite = VMWAREComposite; + } +#endif /* RENDER */ - pVMWARE = VMWAREPTR(xf86Screens[i]); - if (pVMWARE->checkCursorColor) - vmwareRenewCursorColor(screenInfo.screens[i]); } -void -vmwareQueryBestSize(class, pwidth, pheight, pScr) - int class; - unsigned short *pwidth; - unsigned short *pheight; - ScreenPtr pScr; +static void +VMWAREGetImage(DrawablePtr src, int x, int y, int w, int h, + unsigned int format, unsigned long planeMask, char *pBinImage) { - TRACEPOINT - - if (*pwidth > 0) { + ScreenPtr pScreen = src->pScreen; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(src->pScreen)); + BoxRec box; + Bool hidden = FALSE; + + VmwareLog(("VMWAREGetImage(%p, %d, %d, %d, %d, %d, %d, %p)\n", + src, x, y, w, h, format, planeMask, pBinImage)); - switch (class) { + box.x1 = src->x + x; + box.y1 = src->y + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; - case CursorShape: - if (*pwidth > 64) - *pwidth = 64; - if (*pheight > 64) - *pheight = 64; - break; - default: - fbQueryBestSize(class, pwidth, pheight, pScr); - break; - } + if (BOX_INTERSECT(box, pVMWARE->hwcur.box)) { + PRE_OP_HIDE_CURSOR(); + hidden = TRUE; } -} -void -vmwareCursorOff(VMWAREPtr pVMWARE) -{ - TRACEPOINT + pScreen->GetImage = pVMWARE->ScrnFuncs.GetImage; + (*pScreen->GetImage)(src, x, y, w, h, format, planeMask, pBinImage); + pScreen->GetImage = VMWAREGetImage; - if (pVMWARE->cursorDefined) { - if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, SVGA_CURSOR_ON_HIDE); - } else { - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); - vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); - vmwareWriteWordToFIFO(pVMWARE, 0); - UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); - } + if (hidden) { + POST_OP_SHOW_CURSOR(); } } -void -vmwareClearSavedCursor(int scr_index) +static void +VMWARECopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { - TRACEPOINT + ScreenPtr pScreen = pWin->drawable.pScreen; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + BoxPtr pBB; + Bool hidden = FALSE; + + /* + * We only worry about the source region here, since shadowfb will + * take care of the destination region. + */ + pBB = REGION_EXTENTS(pWin->drawable.pScreen, prgnSrc); + + VmwareLog(("VMWARECopyWindow(%p, (%d, %d), (%d, %d - %d, %d)\n", + pWin, ptOldOrg.x, ptOldOrg.y, + pBB->x1, pBB->y1, pBB->x2, pBB->y2)); + + if (BOX_INTERSECT(*pBB, pVMWARE->hwcur.box)) { + PRE_OP_HIDE_CURSOR(); + hidden = TRUE; + } - vmwareSaveCursors[scr_index] = NULL; + pScreen->CopyWindow = pVMWARE->ScrnFuncs.CopyWindow; + (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); + pScreen->CopyWindow = VMWARECopyWindow; + + if (hidden) { + POST_OP_SHOW_CURSOR(); + } } +#ifdef RENDER +static void +VMWAREComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, + INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, + CARD16 width, CARD16 height) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pScreen)); + PictureScreenPtr ps = GetPictureScreen(pScreen); + BoxRec box; + Bool hidden = FALSE; + + VmwareLog(("VMWAREComposite op = %d, pSrc = %p, pMask = %p, pDst = %p," + " src = (%d, %d), mask = (%d, %d), dst = (%d, %d), w = %d," + " h = %d\n", op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height)); + + /* + * We only worry about the source region here, since shadowfb or XAA will + * take care of the destination region. + */ + box.x1 = pSrc->pDrawable->x + xSrc; + box.y1 = pSrc->pDrawable->y + ySrc; + box.x2 = box.x1 + width; + box.y2 = box.y1 + height; + + if (BOX_INTERSECT(box, pVMWARE->hwcur.box)) { + PRE_OP_HIDE_CURSOR(); + hidden = TRUE; + } + + ps->Composite = pVMWARE->Composite; + (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + ps->Composite = VMWAREComposite; + if (hidden) { + POST_OP_SHOW_CURSOR(); + } +} +#endif /* RENDER */ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c Thu Feb 27 12:31:48 2003 @@ -1,62 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarefillarc[] = - - "Id: vmwarefillarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static void -computeBBarc(DrawablePtr pDrawable, - GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB) -{ - if (narcs <= 0) - return; - pBB->x1 = parcs->x; - pBB->y1 = parcs->y; - pBB->x2 = parcs->x + parcs->width; - pBB->y2 = parcs->y + parcs->height; - while (--narcs) { - parcs++; - if (parcs->x < pBB->x1) - pBB->x1 = parcs->x; - if (parcs->y < pBB->y1) - pBB->y1 = parcs->y; - if ((parcs->x + parcs->width) > pBB->x2) - pBB->x2 = parcs->x + parcs->width; - if ((parcs->y + parcs->height) > pBB->y2) - pBB->y2 = parcs->y + parcs->height; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBarc(pDrawable, pGC, narcs, parcs, &BB), - GC_OPS(pGC)->PolyFillArc(pDrawable, pGC, narcs, parcs)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c Thu Feb 27 12:31:48 2003 @@ -1,63 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarefs[] = - - "Id: vmwarefs.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static __inline void -vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable) -{ - BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width; - BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height; -} - -void -vmwareFillSpans(DrawablePtr pDrawable, - GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pDrawable->pScreen, - vmwareDrawableToBox(&BB, pDrawable), - GC_OPS(pGC)->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)); -} - -void -vmwareSetSpans(DrawablePtr pDrawable, - GCPtr pGC, - char *pcharsrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pDrawable->pScreen, - vmwareDrawableToBox(&BB, pDrawable), - GC_OPS(pGC)->SetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)); -} - -void -vmwareGetSpans(DrawablePtr pDrawable, - int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst) -{ - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen)); - - TRACEPOINT - - VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - (BB.x1 = 0, BB.y1 = 0, - BB.x2 = pDrawable->pScreen->width, - BB.y2 = pDrawable->pScreen->height), - pVMWARE->ScrnFuncs.GetSpans(pDrawable, wMax, pPoints, pWidths, nSpans, pDst)); -} - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:1.3 Thu Sep 13 04:36:24 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c Thu Feb 27 12:31:48 2003 @@ -1,127 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwaregc[] = - - "Id: vmwaregc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c,v 1.3 2001/09/13 08:36:24 alanh Exp $ */ - -#include "X.h" -#include "fb.h" -#include "vmware.h" - -GCFuncs vmwareGCFuncs = { - vmwareValidateGC, - vmwareChangeGC, - vmwareCopyGC, - vmwareDestroyGC, - vmwareChangeClip, - vmwareDestroyClip, - vmwareCopyClip -}; - -GCOps vmwareGCOps = { - vmwareFillSpans, - vmwareSetSpans, - vmwarePutImage, - vmwareCopyArea, - vmwareCopyPlane, - vmwarePolyPoint, - vmwarePolylines, - vmwarePolySegment, - vmwarePolyRectangle, - vmwarePolyArc, - vmwareFillPolygon, - vmwarePolyFillRect, - vmwarePolyFillArc, - vmwarePolyText8, - vmwarePolyText16, - vmwareImageText8, - vmwareImageText16, - vmwareImageGlyphBlt, - vmwarePolyGlyphBlt, - vmwarePushPixels, -#ifdef NEED_LINEHELPER - , NULL -#endif -}; - -unsigned long Pmsk; - -Bool -vmwareCreateGC(GCPtr pGC) -{ - Bool ret; - - TRACEPOINT - GC_FUNC_PROLOGUE(pGC); - ret = VMWAREPTR(infoFromScreen(pGC->pScreen))->ScrnFuncs.CreateGC(pGC); - GC_FUNC_EPILOGUE(pGC); - return ret; -} - -void -vmwareValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGC); - pGC->funcs->ValidateGC(pGC, changes, pDrawable); - GC_FUNC_EPILOGUE(pGC); -} - -void -vmwareChangeGC(GCPtr pGC, unsigned long changes) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGC); - pGC->funcs->ChangeGC(pGC, changes); - GC_FUNC_EPILOGUE(pGC); -} - -void -vmwareCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGCDst); - pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst); - GC_FUNC_EPILOGUE(pGCDst); -} - -void -vmwareDestroyGC(GCPtr pGC) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGC); - pGC->funcs->DestroyGC(pGC); - GC_FUNC_EPILOGUE(pGC); -} - -void -vmwareChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGC); - pGC->funcs->ChangeClip(pGC, type, pValue, nrects); - GC_FUNC_EPILOGUE(pGC); -} - -void -vmwareDestroyClip(GCPtr pGC) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGC); - pGC->funcs->DestroyClip(pGC); - GC_FUNC_EPILOGUE(pGC); -} - -void -vmwareCopyClip(GCPtr pGCDst, GCPtr pGCSrc) -{ - TRACEPOINT - GC_FUNC_PROLOGUE(pGCDst); - pGCDst->funcs->CopyClip(pGCDst, pGCSrc); - GC_FUNC_EPILOGUE(pGCDst); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c Thu Feb 27 12:31:48 2003 @@ -1,47 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwareglblt[] = - - "Id: vmwareglblt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static __inline void -vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable) -{ - BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width; - BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height; -} - -void -vmwareImageGlyphBlt(DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareDrawableToBox(&BB, pDrawable), - GC_OPS(pGC)->ImageGlyphBlt(pDrawable, pGC, x, y, - nglyph, ppci, pglyphBase)); -} - -void -vmwarePolyGlyphBlt(DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareDrawableToBox(&BB, pDrawable), - GC_OPS(pGC)->PolyGlyphBlt(pDrawable, pGC, x, y, - nglyph, ppci, pglyphBase)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c Thu Feb 27 12:31:48 2003 @@ -1,59 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwareimage[] = - - "Id: vmwareimage.c,v 1.3 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -/* - * vmwarePutImage does not optimize ops because a downstream call is made - * to CopyArea. - */ - -static __inline void -vmwareImageToBox(BoxPtr BB, DrawablePtr pDrawable, int x, int y, int w, int h) -{ - BB->x2 = (BB->x1 = pDrawable->x + x) + w; - BB->y2 = (BB->y1 = pDrawable->y + y) + h; -} - -void -vmwarePutImage(DrawablePtr pDrawable, - GCPtr pGC, - int depth, - int x, int y, int w, int h, int leftPad, int format, char *pImage) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareImageToBox(&BB, pDrawable, x, y, w, h), - GC_OPS(pGC)->PutImage(pDrawable, pGC, depth, x, y, - w, h, leftPad, format, pImage)); -} - -void -vmwareGetImage(DrawablePtr pDrawable, - int x, - int y, - int w, - int h, unsigned int format, unsigned long planeMask, char *pBinImage) -{ - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen)); - - TRACEPOINT - - VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - vmwareImageToBox(&BB, pDrawable, x, y, w, h), - pVMWARE->ScrnFuncs.GetImage(pDrawable, x, y, w, h, format, planeMask, pBinImage)); -} - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c Thu Feb 27 12:31:48 2003 @@ -1,141 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwareline[] = - - "Id: vmwareline.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static void -computeBBpoints(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB) -{ - int x, y; - - if (npt <= 0) - return; - x = pptInit->x; - y = pptInit->y; - pBB->x1 = x; - pBB->y1 = y; - pBB->x2 = x + 1; - pBB->y2 = y + 1; - while (--npt) { - pptInit++; - if (mode == CoordModeOrigin) { - x = pptInit->x; - y = pptInit->y; - } else { - x += pptInit->x; - y += pptInit->y; - } - if (x < pBB->x1) - pBB->x1 = x; - if (y < pBB->y1) - pBB->y1 = y; - if (x + 1 > pBB->x2) - pBB->x2 = x + 1; - if (y + 1 > pBB->y2) - pBB->y2 = y + 1; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolylines(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBpoints(pDrawable, pGC, mode, npt, pPts, &BB), - GC_OPS(pGC)->Polylines(pDrawable, pGC, mode, npt, pPts)); -} - -static void -computeBBsegments(DrawablePtr pDrawable, - GCPtr pGC, int nseg, xSegment * pSegs, BoxPtr pBB) -{ - if (nseg <= 0) - return; - pBB->x1 = pSegs->x1; - pBB->y1 = pSegs->y1; - pBB->x2 = pSegs->x1 + 1; - pBB->y2 = pSegs->y1 + 1; - if (pSegs->x2 < pBB->x1) - pBB->x1 = pSegs->x2; - if (pSegs->y2 < pBB->y1) - pBB->y1 = pSegs->y2; - if (pSegs->x2 + 1 > pBB->x2) - pBB->x2 = pSegs->x2 + 1; - if (pSegs->y2 + 1 > pBB->y2) - pBB->y2 = pSegs->y2 + 1; - while (--nseg) { - pSegs++; - if (pSegs->x1 < pBB->x1) - pBB->x1 = pSegs->x1; - if (pSegs->y1 < pBB->y1) - pBB->y1 = pSegs->y1; - if (pSegs->x1 + 1 > pBB->x2) - pBB->x2 = pSegs->x1 + 1; - if (pSegs->y1 + 1 > pBB->y2) - pBB->y2 = pSegs->y1 + 1; - if (pSegs->x2 < pBB->x1) - pBB->x1 = pSegs->x2; - if (pSegs->y2 < pBB->y1) - pBB->y1 = pSegs->y2; - if (pSegs->x2 + 1 > pBB->x2) - pBB->x2 = pSegs->x2 + 1; - if (pSegs->y2 + 1 > pBB->y2) - pBB->y2 = pSegs->y2 + 1; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolySegment(DrawablePtr pDrawable, - GCPtr pGC, int nseg, xSegment * pSegs) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBsegments(pDrawable, pGC, nseg, pSegs, &BB), - GC_OPS(pGC)->PolySegment(pDrawable, pGC, nseg, pSegs)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c Thu Feb 27 12:31:48 2003 @@ -1,80 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwareply1rct[] = - - "Id: vmwareply1rct.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static void -computeBBpoly(DrawablePtr pDrawable, - GCPtr pGC, int mode, int count, DDXPointPtr pptInit, BoxPtr pBB) -{ - int x, y; - - if (count <= 0) - return; - x = pptInit->x; - y = pptInit->y; - pBB->x1 = x; - pBB->y1 = y; - pBB->x2 = x + 1; - pBB->y2 = y + 1; - while (--count) { - pptInit++; - if (mode == CoordModeOrigin) { - x = pptInit->x; - y = pptInit->y; - } else { - x += pptInit->x; - y += pptInit->y; - } - if (x < pBB->x1) - pBB->x1 = x; - if (y < pBB->y1) - pBB->y1 = y; - if (x + 1 > pBB->x2) - pBB->x2 = x + 1; - if (y + 1 > pBB->y2) - pBB->y2 = y + 1; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwareFillPolygon(DrawablePtr pDrawable, - GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBpoly(pDrawable, pGC, mode, count, pPts, &BB), - GC_OPS(pGC)->FillPolygon(pDrawable, pGC, shape, mode, - count, pPts)); -} - - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c Thu Feb 27 12:31:48 2003 @@ -1,74 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarepolypnt[] = - - "Id: vmwarepolypnt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static void -computeBBpoints(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB) -{ - int x, y; - - if (npt <= 0) - return; - x = pptInit->x; - y = pptInit->y; - pBB->x1 = x; - pBB->y1 = y; - pBB->x2 = x + 1; - pBB->y2 = y + 1; - while (--npt) { - pptInit++; - if (mode == CoordModeOrigin) { - x = pptInit->x; - y = pptInit->y; - } else { - x += pptInit->x; - y += pptInit->y; - } - if (x < pBB->x1) - pBB->x1 = x; - if (y < pBB->y1) - pBB->y1 = y; - if (x + 1 > pBB->x2) - pBB->x2 = x + 1; - if (y + 1 > pBB->y2) - pBB->y2 = y + 1; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, - xPoint * pptInit) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBpoints(pDrawable, pGC, mode, npt, pptInit, &BB), - GC_OPS(pGC)->PolyPoint(pDrawable, pGC, mode, npt, pptInit)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c Thu Feb 27 12:31:48 2003 @@ -1,43 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarepush[] = - - "Id: vmwarepush.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static __inline void -vmwarePushToBox(BoxPtr BB, const GCPtr pGC, PixmapPtr pBitmap, - DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) -{ - BB->x1 = - MAX(pDrawable->x + xOrg, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x1); - BB->y1 = - MAX(pDrawable->y + yOrg, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y1); - BB->x2 = - MIN(pDrawable->x + xOrg + dx, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x2); - BB->y2 = - MIN(pDrawable->y + yOrg + dy, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePushPixels(GCPtr pGC, - PixmapPtr pBitmap, - DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwarePushToBox(&BB, pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg), - GC_OPS(pGC)->PushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c:1.2 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c Thu Feb 27 12:31:48 2003 @@ -1,272 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarerect[] = - - "Id: vmwarerect.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ - -#include "X.h" -#include "fb.h" -#include "vmware.h" - -static void -computeBBrect(DrawablePtr pDrawable, - GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB) -{ - if (nrectFill <= 0) - return; - pBB->x1 = prectInit->x; - pBB->y1 = prectInit->y; - pBB->x2 = prectInit->x + prectInit->width + 1; - pBB->y2 = prectInit->y + prectInit->height + 1; - while (--nrectFill) { - prectInit++; - if (prectInit->x < pBB->x1) - pBB->x1 = prectInit->x; - if (prectInit->y < pBB->y1) - pBB->y1 = prectInit->y; - if ((prectInit->x + prectInit->width + 1) > pBB->x2) - pBB->x2 = prectInit->x + prectInit->width + 1; - if ((prectInit->y + prectInit->height + 1) > pBB->y2) - pBB->y2 = prectInit->y + prectInit->height + 1; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolyRectangle(DrawablePtr pDrawable, - GCPtr pGC, int nrectFill, xRectangle * prectInit) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBrect(pDrawable, pGC, nrectFill, prectInit, &BB), - GC_OPS(pGC)->PolyRectangle(pDrawable, pGC, nrectFill, prectInit)); -} - -static void -accelFillRectSolid(VMWAREPtr pVMWARE, DrawablePtr pDrawable, GCPtr pGC, int nBox, BoxPtr pBox) -{ - while (nBox) { - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_FILL); - vmwareWriteWordToFIFO(pVMWARE, pGC->fgPixel); - vmwareWriteWordToFIFO(pVMWARE, pBox->x1); - vmwareWriteWordToFIFO(pVMWARE, pBox->y1); - vmwareWriteWordToFIFO(pVMWARE, pBox->x2 - pBox->x1); - vmwareWriteWordToFIFO(pVMWARE, pBox->y2 - pBox->y1); - vmwareWriteWordToFIFO(pVMWARE, pGC->alu); - pBox++; - nBox--; - } -} - -#define NUM_STACK_RECTS 1024 - -static void -accelPolyFillRect(VMWAREPtr pVMWARE, DrawablePtr pDrawable, - GCPtr pGC, int nrectFill, xRectangle * prectInit) -{ - xRectangle *prect; - RegionPtr prgnClip; - BoxPtr pbox; - BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - int numRects; - int n; - int xorg, yorg; - - prgnClip = fbGetCompositeClip(pGC); - - prect = prectInit; - xorg = pDrawable->x; - yorg = pDrawable->y; - if (xorg || yorg) { - prect = prectInit; - n = nrectFill; - while (n--) { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - prect = prectInit; - - numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; - if (numRects > NUM_STACK_RECTS) { - pboxClippedBase = (BoxPtr) ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); - if (!pboxClippedBase) - return; - } else - pboxClippedBase = stackRects; - - pboxClipped = pboxClippedBase; - - if (REGION_NUM_RECTS(prgnClip) == 1) { - int x1, y1, x2, y2, bx2, by2; - - pextent = REGION_RECTS(prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - if ((pboxClipped->x1 = prect->x) < x1) - pboxClipped->x1 = x1; - - if ((pboxClipped->y1 = prect->y) < y1) - pboxClipped->y1 = y1; - - bx2 = (int)prect->x + (int)prect->width; - if (bx2 > x2) - bx2 = x2; - pboxClipped->x2 = bx2; - - by2 = (int)prect->y + (int)prect->height; - if (by2 > y2) - by2 = y2; - pboxClipped->y2 = by2; - - prect++; - if ((pboxClipped->x1 < pboxClipped->x2) && - (pboxClipped->y1 < pboxClipped->y2)) { - pboxClipped++; - } - } - } else { - int x1, y1, x2, y2, bx2, by2; - - pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - BoxRec box; - - if ((box.x1 = prect->x) < x1) - box.x1 = x1; - - if ((box.y1 = prect->y) < y1) - box.y1 = y1; - - bx2 = (int)prect->x + (int)prect->width; - if (bx2 > x2) - bx2 = x2; - box.x2 = bx2; - - by2 = (int)prect->y + (int)prect->height; - if (by2 > y2) - by2 = y2; - box.y2 = by2; - - prect++; - - if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) - continue; - - n = REGION_NUM_RECTS(prgnClip); - pbox = REGION_RECTS(prgnClip); - - /* clip the rectangle to each box in the clip region - * this is logically equivalent to calling Intersect() - */ - while (n--) { - pboxClipped->x1 = max(box.x1, pbox->x1); - pboxClipped->y1 = max(box.y1, pbox->y1); - pboxClipped->x2 = min(box.x2, pbox->x2); - pboxClipped->y2 = min(box.y2, pbox->y2); - pbox++; - - /* see if clipping left anything */ - if (pboxClipped->x1 < pboxClipped->x2 && - pboxClipped->y1 < pboxClipped->y2) { - pboxClipped++; - } - } - } - } - if (pboxClipped != pboxClippedBase) - accelFillRectSolid(pVMWARE, pDrawable, pGC, - pboxClipped - pboxClippedBase, pboxClippedBase); - if (pboxClippedBase != stackRects) - DEALLOCATE_LOCAL(pboxClippedBase); -} - -static void -computeBBfillrect(DrawablePtr pDrawable, - GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB) -{ - if (nrectFill <= 0) - return; - pBB->x1 = prectInit->x; - pBB->y1 = prectInit->y; - pBB->x2 = prectInit->x + prectInit->width; - pBB->y2 = prectInit->y + prectInit->height; - while (--nrectFill) { - prectInit++; - if (prectInit->x < pBB->x1) - pBB->x1 = prectInit->x; - if (prectInit->y < pBB->y1) - pBB->y1 = prectInit->y; - if ((prectInit->x + prectInit->width) > pBB->x2) - pBB->x2 = prectInit->x + prectInit->width; - if ((prectInit->y + prectInit->height) > pBB->y2) - pBB->y2 = prectInit->y + prectInit->height; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolyFillRect(DrawablePtr pDrawable, - GCPtr pGC, int nrectFill, xRectangle * prectInit) -{ - TRACEPOINT - - GC_FUNC_ACCEL_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBfillrect(pDrawable, pGC, nrectFill, prectInit, &BB), - (pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) && - (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) && - pGC->fillStyle == FillSolid && ((pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk), - accelPolyFillRect(pVMWARE, pDrawable, pGC, nrectFill, prectInit), - GC_OPS(pGC)->PolyFillRect(pDrawable, pGC, nrectFill, prectInit)); -} - Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c Thu Feb 27 12:31:48 2003 @@ -1,180 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwaretext[] = - - "Id: vmwaretext.c,v 1.3 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" -#include "dixfontstr.h" - -static void -vmwareTextExtent(FontPtr pFont, int count, char* chars, FontEncoding fontEncoding, BoxPtr box) -{ - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ - - GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars, - fontEncoding, &n, charinfo); - w = 0; - for (i=0; i < n; i++) { - w += charinfo[i]->metrics.characterWidth; - } - if (i) { - w += charinfo[i - 1]->metrics.rightSideBearing; - } - - box->x1 = 0; - if (n) { - if (charinfo[0]->metrics.leftSideBearing < 0) { - box->x1 = charinfo[0]->metrics.leftSideBearing; - } - } - box->x2 = w; - box->y1 = -FONTMAXBOUNDS(pFont,ascent); - box->y2 = FONTMAXBOUNDS(pFont,descent); -} - -static __inline void -vmwareFontToBox(BoxPtr BB, DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, char *chars, - int wide) -{ - FontPtr pFont; - - pFont = pGC->font; - if (pFont->info.constantWidth) { - int ascent, descent, left, right = 0; - - ascent = - MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent); - descent = - MAX(pFont->info.fontDescent, - pFont->info.maxbounds.descent); - left = pFont->info.maxbounds.leftSideBearing; - if (count > 0) { - right = - (count - 1) * pFont->info.maxbounds.characterWidth; - } - right += pFont->info.maxbounds.rightSideBearing; - BB->x1 = - MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x1); - BB->y1 = - MAX(pDrawable->y + y - ascent, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y1); - BB->x2 = - MIN(pDrawable->x + x + right, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x2); - BB->y2 = - MIN(pDrawable->y + y + descent, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y2); - } else { - vmwareTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, BB); - BB->x1 = - MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x1); - BB->y1 = - MAX(pDrawable->y + y + BB->y1, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y1); - BB->x2 = - MIN(pDrawable->x + x + BB->x2, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x2); - BB->y2 = - MIN(pDrawable->y + y + BB->y2, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y2); - } -} - -static __inline void -vmwareImageFontToBox(BoxPtr BB, DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, char *chars, - int wide) -{ - FontPtr pFont; - - pFont = pGC->font; - vmwareTextExtent(pFont, count, chars, - wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, - BB); - BB->x1 = - MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x1); - BB->y1 = - MAX(pDrawable->y + y + BB->y1, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y1); - BB->x2 = - MIN(pDrawable->x + x + BB->x2, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->x2); - BB->y2 = - MIN(pDrawable->y + y + BB->y2, - (REGION_EXTENTS(pGC->pScreen, - &((WindowPtr) pDrawable)->winSize))->y2); -} - -int -vmwarePolyText8(DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, char *chars) -{ - int n; - - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0), - n = GC_OPS(pGC)->PolyText8(pDrawable, pGC, x, y, count, chars)); - return n; -} - -int -vmwarePolyText16(DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - int n; - - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1), - n = GC_OPS(pGC)->PolyText16(pDrawable, pGC, x, y, count, chars)); - return n; -} - -void -vmwareImageText8(DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, char *chars) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0), - GC_OPS(pGC)->ImageText8(pDrawable, pGC, x, y, count, chars)); -} - -void -vmwareImageText16(DrawablePtr pDrawable, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1), - GC_OPS(pGC)->ImageText16(pDrawable, pGC, x, y, count, chars)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c:1.2 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c Thu Feb 27 12:31:48 2003 @@ -1,130 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarewindow[] = - - "Id: vmwarewindow.c,v 1.4 2001/01/27 00:28:15 bennett Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ - -#include "vmware.h" - -void -vmwareCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - RegionRec rgnDst; - int dx, dy; - WindowPtr pwinRoot; - BoxPtr pBB; - - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); - - TRACEPOINT - if (!(pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY)) { - pVMWARE->ScrnFuncs.CopyWindow(pWin, ptOldOrg, prgnSrc); - return; - } - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0); - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, - prgnSrc); - pBB = REGION_EXTENTS(pWin->drawable.pScreen, &rgnDst); - HIDE_CURSOR_ACCEL(pVMWARE, *pBB); - - fbCopyRegion ((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot, - 0, - &rgnDst, dx, dy, vmwareDoBitblt, 0, 0); - - SHOW_CURSOR(pVMWARE, *pBB); - UPDATE_ACCEL_AREA(pVMWARE, *pBB); - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - -static void -accelPaintWindow(VMWAREPtr pVMWARE, WindowPtr pWin, RegionPtr pRegion, int what, BoxPtr pBB) -{ - Pixel pixel; - RegionRec drawRegion; - RegionRec BBRegion; - BoxPtr pbox; - int nbox; - - if (what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) { - pixel = pWin->background.pixel; - } else if (what == PW_BORDER && pWin->borderIsPixel) { - pixel = pWin->border.pixel; - } else { - /* - * The caller has guaranteed that this case has been excluded, - * but the compiler doesn't know that. So this line is just to - * eliminate the compiler warning. - */ - pixel = 0; - } - - REGION_INIT(pWin->drawable.pScreen, &drawRegion, NullBox, 0); - REGION_INIT(pWin->drawable.pScreen, &BBRegion, pBB, 1); - REGION_INTERSECT(pWin->drawable.pScreen, &drawRegion, pRegion, &BBRegion); - pbox = REGION_RECTS(&drawRegion); - nbox = REGION_NUM_RECTS(&drawRegion); - while (nbox) { - vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_FILL); - vmwareWriteWordToFIFO(pVMWARE, pixel); - vmwareWriteWordToFIFO(pVMWARE, pbox->x1); - vmwareWriteWordToFIFO(pVMWARE, pbox->y1); - vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); - vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); - pbox++; - nbox--; - } - REGION_UNINIT(pWin->drawable.pScreen, &BBRegion); - REGION_UNINIT(pWin->drawable.pScreen, &drawRegion); -} - -void -vmwarePaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) -{ - VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); - - TRACEPOINT - /* Accelerate solid fills */ - if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) && - ((what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) - || (what == PW_BORDER && pWin->borderIsPixel))) { - BoxPtr pBB; - Bool hidden = pVMWARE->mouseHidden; - - pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion); - if (!hidden) { - HIDE_CURSOR(pVMWARE, *pBB); - } - accelPaintWindow(pVMWARE, pWin, pRegion, what, pBB); - if (!hidden) { - SHOW_CURSOR(pVMWARE, *pBB); - } - UPDATE_ACCEL_AREA(pVMWARE, *pBB); - /* vmwareWaitForFB(); */ /* XXX */ - return; - } - if (pVMWARE->vmwareBBLevel == 0) { - BoxPtr pBB; - - pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion); - HIDE_CURSOR(pVMWARE, *pBB); - vmwareWaitForFB(pVMWARE); - pVMWARE->vmwareBBLevel++; - pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what); - pVMWARE->vmwareBBLevel--; - vmwareSendSVGACmdUpdate(pVMWARE, pBB); - SHOW_CURSOR(pVMWARE, *pBB); - } else { - VmwareLog(("vmwarePaintWindow not called at top level\n")); - vmwareWaitForFB(pVMWARE); - pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what); - } -} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarexaa.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarexaa.c:1.5 --- /dev/null Thu Feb 27 12:31:48 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarexaa.c Mon Feb 3 20:39:53 2003 @@ -0,0 +1,549 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarexaa[] = + "Id: $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarexaa.c,v 1.5 2003/02/04 01:39:53 dawes Exp $ */ + +#include "vmware.h" + +#define OFFSCREEN_SCRATCH_SIZE 1*1024*1024 +/* We'll assume we average about 32x32 alpha surfaces (4096 bytes) or larger */ +#define OFFSCREEN_SCRATCH_MAX_SLOTS OFFSCREEN_SCRATCH_SIZE / 4096 + +const char *vmwareXaaSymbols[] = { + "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAInit", + NULL +}; + +static void vmwareXAASync(ScrnInfoPtr pScrn); + +static void vmwareSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask); +static void vmwareSubsequentSolidFillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h); + +static void vmwareSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, + int trans_color); +static void vmwareSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int x1, int y1, + int x2, int y2, + int width, int height); + +static void vmwareSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask); +static void vmwareSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft ); +static void vmwareSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); + +#ifdef RENDER +static Bool vmwareSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, int op, + CARD16 red, CARD16 green, + CARD16 blue, CARD16 alpha, + int alphaType, CARD8 *alphaPtr, + int alphaPitch, + int width, int height, + int flags); + +static Bool vmwareSetupForCPUToScreenTexture(ScrnInfoPtr pScrn, int op, + int texType, CARD8 *texPtr, + int texPitch, + int width, int height, + int flags); + +static void vmwareSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, + int dstx, int dsty, + int srcx, int srcy, + int width, int height); + +CARD32 vmwareAlphaTextureFormats[2] = {PICT_a8, 0}; +CARD32 vmwareTextureFormats[2] = {PICT_a8r8g8b8, 0}; + +#endif + +#define DESTROY_XAA_INFO(pVMWARE) \ + if (pVMWARE->xaaInfo) { XAADestroyInfoRec(pVMWARE->xaaInfo); \ + pVMWARE->xaaInfo = NULL; } + +Bool +vmwareXAAScreenInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + XAAInfoRecPtr xaaInfo; + + pVMWARE->xaaInfo = XAACreateInfoRec(); + if (!pVMWARE->xaaInfo) { + return FALSE; + } + + xaaInfo = pVMWARE->xaaInfo; + + xaaInfo->Sync = vmwareXAASync; + + if (pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) { + xaaInfo->SetupForSolidFill = vmwareSetupForSolidFill; + xaaInfo->SubsequentSolidFillRect = vmwareSubsequentSolidFillRect; + + xaaInfo->SolidFillFlags = NO_PLANEMASK | + (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP ? 0 : GXCOPY_ONLY); + } + + if (pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY) { + xaaInfo->SetupForScreenToScreenCopy = vmwareSetupForScreenToScreenCopy; + xaaInfo->SubsequentScreenToScreenCopy = + vmwareSubsequentScreenToScreenCopy; + + xaaInfo->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK | + (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP ? 0 : GXCOPY_ONLY); + } + + /* + * We don't support SVGA_CAP_GLYPH without clipping, since we use clipping + * for normal glyphs. + */ + if (pVMWARE->vmwareCapability & SVGA_CAP_GLYPH_CLIPPING) { + xaaInfo->SetupForScanlineCPUToScreenColorExpandFill = + vmwareSetupForScanlineCPUToScreenColorExpandFill; + xaaInfo->SubsequentScanlineCPUToScreenColorExpandFill = + vmwareSubsequentScanlineCPUToScreenColorExpandFill; + xaaInfo->SubsequentColorExpandScanline = + vmwareSubsequentColorExpandScanline; + + xaaInfo->NumScanlineColorExpandBuffers = 1; + xaaInfo->ScanlineColorExpandBuffers = pVMWARE->xaaColorExpScanLine; + + xaaInfo->ScanlineCPUToScreenColorExpandFillFlags = GXCOPY_ONLY | + NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING; + } + + if (pVMWARE->vmwareCapability & SVGA_CAP_OFFSCREEN_1) { + int scratchSizeBytes = ((OFFSCREEN_SCRATCH_SIZE + pVMWARE->fbPitch - 1) / + pVMWARE->fbPitch) * pVMWARE->fbPitch; + BoxRec box; + RegionRec region; + + box.x1 = 0; + box.y1 = (pVMWARE->FbSize + pVMWARE->fbPitch - 1) / pVMWARE->fbPitch; + box.x2 = pScrn->displayWidth; + box.y2 = pVMWARE->videoRam / pVMWARE->fbPitch; + +#ifdef RENDER + if (pVMWARE->vmwareCapability & SVGA_CAP_ALPHA_BLEND && + pScrn->bitsPerPixel > 8) { + if (box.y2 - (scratchSizeBytes / pVMWARE->fbPitch) > box.y1 + 4) { + CARD8* osPtr = pVMWARE->FbBase + pVMWARE->videoRam - + scratchSizeBytes; + box.y2 -= scratchSizeBytes / pVMWARE->fbPitch; + + VmwareLog(("Allocated %d bytes at offset %d for alpha scratch\n", + scratchSizeBytes, + pVMWARE->videoRam - scratchSizeBytes)); + + pVMWARE->heap = vmwareHeap_Create(osPtr, + scratchSizeBytes, + OFFSCREEN_SCRATCH_MAX_SLOTS, + pVMWARE->videoRam - scratchSizeBytes, + pScrn->virtualX, + pScrn->virtualY, + pVMWARE->bitsPerPixel, + pVMWARE->fbPitch, + pVMWARE->fbOffset); + pVMWARE->frontBuffer = vmwareHeap_GetFrontBuffer(pVMWARE->heap); + + xaaInfo->SetupForCPUToScreenAlphaTexture = + vmwareSetupForCPUToScreenAlphaTexture; + xaaInfo->SubsequentCPUToScreenAlphaTexture = + vmwareSubsequentCPUToScreenTexture; + xaaInfo->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE | + XAA_RENDER_NO_SRC_ALPHA; + xaaInfo->CPUToScreenAlphaTextureFormats = vmwareAlphaTextureFormats; + + xaaInfo->SetupForCPUToScreenTexture = + vmwareSetupForCPUToScreenTexture; + xaaInfo->SubsequentCPUToScreenTexture = + vmwareSubsequentCPUToScreenTexture; + xaaInfo->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE; + xaaInfo->CPUToScreenTextureFormats = vmwareTextureFormats; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Allocation of offscreen " + "scratch area for alpha blending failed\n"); + } + } +#endif + + if (box.y2 > box.y1) { + REGION_INIT(pScreen, ®ion, &box, 1); + + if (REGION_NOTEMPTY(pScreen, ®ion) && + xf86InitFBManagerRegion(pScreen, ®ion)) { + VmwareLog(("Offscreen memory initialized: (%d, %d) - (%d, %d)\n", + box.x1, box.y1, box.x2, box.y2)); + + xaaInfo->Flags = + LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Offscreen memory manager " + "initialization failed.\n"); + } + + REGION_UNINIT(pScreen, ®ion); + } + } + + if (!XAAInit(pScreen, xaaInfo)) { + DESTROY_XAA_INFO(pVMWARE); + return FALSE; + } + + return TRUE; +} + +Bool +vmwareXAAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + /* + * Alloc a sufficiently large buffer for XAA to render scanlines + * for a color expand into. + */ + if (pVMWARE->vmwareCapability & SVGA_CAP_GLYPH) { + /* + * This formula came straight from the XAA.HOWTO doc. The +62 is + * there because we potentially have 31 extra bits off to the left, + * since we claim LEFT_EDGE_CLIPPING support. + */ + int scanLineSize = ((pScrn->virtualX + 62)/32) * 4; + if (pVMWARE->xaaColorExpScanLine[0]) { + xfree(pVMWARE->xaaColorExpScanLine[0]); + } + pVMWARE->xaaColorExpScanLine[0] = xalloc(scanLineSize); + return pVMWARE->xaaColorExpScanLine[0] != NULL; + } + + return TRUE; +} + +void +vmwareXAACloseScreen(ScreenPtr pScreen) +{ + VMWAREPtr pVMWARE = VMWAREPTR(xf86Screens[pScreen->myNum]); + + if (pVMWARE->xaaColorExpScanLine[0]) { + xfree(pVMWARE->xaaColorExpScanLine[0]); + pVMWARE->xaaColorExpScanLine[0] = NULL; + } + + DESTROY_XAA_INFO(pVMWARE); + +#ifdef RENDER + if (pVMWARE->heap) { + vmwareHeap_Destroy(pVMWARE->heap); + pVMWARE->heap = NULL; + } +#endif +} + +static void +vmwareXAASync(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + VmwareLog(("Sync\n")); + + vmwareWaitForFB(pVMWARE); + +#ifdef RENDER + if (pVMWARE->heap) { + vmwareHeap_Clear(pVMWARE->heap); + } +#endif +} + +static void +vmwareSetupForSolidFill(ScrnInfoPtr pScrn, + int color, int rop, unsigned int planemask) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + pVMWARE->xaaFGColor = color; + pVMWARE->xaaRop = rop; + + VmwareLog(("Setup Solid Fill (color = %d, rop = %d)\n", color, rop)); +} + +static void +vmwareSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + VmwareLog((" Do Solid Fill (x = %d, y = %d, w = %d, h = %d)\n", x, y, w, h)); + + if (pVMWARE->xaaRop != GXcopy) { + /* + * We'll never get here if SVGA_CAP_RASTER_OP isn't set, since + * we tell XAA we are GXCOPY_ONLY. + */ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_FILL); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaFGColor); + vmwareWriteWordToFIFO(pVMWARE, x); + vmwareWriteWordToFIFO(pVMWARE, y); + vmwareWriteWordToFIFO(pVMWARE, w); + vmwareWriteWordToFIFO(pVMWARE, h); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaRop); + } else { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_FILL); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaFGColor); + vmwareWriteWordToFIFO(pVMWARE, x); + vmwareWriteWordToFIFO(pVMWARE, y); + vmwareWriteWordToFIFO(pVMWARE, w); + vmwareWriteWordToFIFO(pVMWARE, h); + } +} + +static void +vmwareSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, + int trans_color) +{ + /* + * We can safely ignore xdir and ydir since our "hardware" is smart + * enough to figure out the direction from the srcx/y, dstx/y, w and h. + */ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + pVMWARE->xaaRop = rop; + + VmwareLog(("Setup Screen2Screen copy (rop = %d)\n", rop)); +} + +static void +vmwareSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int x1, int y1, + int x2, int y2, + int width, int height) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + VmwareLog((" Do Screen2Screen copy (x1 = %d, y1 = %d, x2 = %d, y2 = %d," + " w = %d, h = %d)\n", x1, y1, x2, y2, width, height)); + + if (pVMWARE->xaaRop != GXcopy) { + /* + * We'll never get here if SVGA_CAP_RASTER_OP isn't set, since + * we tell XAA we are GXCOPY_ONLY. + */ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_COPY); + vmwareWriteWordToFIFO(pVMWARE, x1); + vmwareWriteWordToFIFO(pVMWARE, y1); + vmwareWriteWordToFIFO(pVMWARE, x2); + vmwareWriteWordToFIFO(pVMWARE, y2); + vmwareWriteWordToFIFO(pVMWARE, width); + vmwareWriteWordToFIFO(pVMWARE, height); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaRop); + } else { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_COPY); + vmwareWriteWordToFIFO(pVMWARE, x1); + vmwareWriteWordToFIFO(pVMWARE, y1); + vmwareWriteWordToFIFO(pVMWARE, x2); + vmwareWriteWordToFIFO(pVMWARE, y2); + vmwareWriteWordToFIFO(pVMWARE, width); + vmwareWriteWordToFIFO(pVMWARE, height); + } +} + +static void +vmwareSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->xaaFGColor = fg; + pVMWARE->xaaBGColor = bg; + VmwareLog(("Setup color expand (fg = %d, bg = %d, rop = %d)\n", + fg, bg, rop)); +} + +static void +vmwareSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft ) +{ + /* + * XXX TODO: if xaaColorExpSize will fit entirely into the FIFO, + * temporarily switch to direct mode, and have XAA write bits + * directly into the fifo. See ATI driver for an example. + */ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->xaaColorExpSize = SVGA_GLYPH_SCANLINE_SIZE_DWORDS(w); + + VmwareLog((" Do color expand (x = %d, y = %d, w = %d, h = %d," + " skipleft = %d, sizedw = %d)\n", + x, y, w, h, skipleft, pVMWARE->xaaColorExpSize)); + + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DRAW_GLYPH_CLIPPED); + vmwareWriteWordToFIFO(pVMWARE, x); + vmwareWriteWordToFIFO(pVMWARE, y); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaColorExpSize * 32U); + vmwareWriteWordToFIFO(pVMWARE, h); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaFGColor); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->xaaBGColor); + vmwareWriteWordToFIFO(pVMWARE, x + skipleft); + vmwareWriteWordToFIFO(pVMWARE, y); + vmwareWriteWordToFIFO(pVMWARE, w - skipleft); + vmwareWriteWordToFIFO(pVMWARE, h); +} + +static void +vmwareSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + CARD32* scanLine = (CARD32*)pVMWARE->xaaColorExpScanLine[0]; + unsigned int dwords = pVMWARE->xaaColorExpSize; + + while (dwords--) { + vmwareWriteWordToFIFO(pVMWARE, *scanLine++); + } +} + +#ifdef RENDER + +static void +RGBPlusAlphaChannelToPremultipliedRGBA( + CARD8 red, CARD8 blue, CARD8 green, + CARD8 *alphaPtr, /* in bytes */ + int alphaPitch, + CARD32 *dstPtr, + int dstPitch, /* in dwords */ + int width, int height) +{ + int x; + + while (height--) { + for (x = 0; x < width; x++) { + CARD8 alpha = alphaPtr[x]; + dstPtr[x] = (alpha << 24) | + ((red * alpha / 255) << 16) | + ((green * alpha / 255) << 8) | + (blue * alpha / 255); + } + dstPtr += dstPitch; + alphaPtr += alphaPitch; + } +} + +Bool +vmwareSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, int op, + CARD16 red, CARD16 green, + CARD16 blue, CARD16 alpha, + int alphaType, CARD8 *alphaPtr, + int alphaPitch, + int width, int height, + int flags) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + SVGASurface* surf; + + VmwareLog(("Setup alpha texture (op = %d, r = %d, g = %d, b = %d," + " a = %d, alphaType = %d, alphaPitch = %d, w = %d, h = %d," + " flags = %d)\n", op, red, green, blue, alpha, alphaType, + alphaPitch, width, height, flags)); + + if (op > PictOpSaturate) { + return FALSE; + } + + surf = vmwareHeap_AllocSurface(pVMWARE->heap, width, height, width * 4, 32); + + if (!surf) { + return FALSE; + } + + RGBPlusAlphaChannelToPremultipliedRGBA( + red >> 8, green >> 8, blue >> 8, + alphaPtr, alphaPitch, + (CARD32*)(pVMWARE->FbBase + surf->dataOffset), + width, width, height); + + pVMWARE->curPict = surf; + pVMWARE->op = op; + + return TRUE; +} + +Bool +vmwareSetupForCPUToScreenTexture(ScrnInfoPtr pScrn, int op, + int texType, CARD8 *texPtr, + int texPitch, + int width, int height, + int flags) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + SVGASurface* surf; + + VmwareLog(("Setup texture (op = %d, texType = %d, texPitch = %d," + " w = %d, h = %d, flags = %d)\n", op, texType, texPitch, + width, height, flags)); + + if (op > PictOpSaturate) { + return FALSE; + } + + surf = vmwareHeap_AllocSurface(pVMWARE->heap, width, height, texPitch, 32); + + if (!surf) { + return FALSE; + } + + memcpy(pVMWARE->FbBase + surf->dataOffset, texPtr, texPitch * height); + + pVMWARE->curPict = surf; + pVMWARE->op = op; + + return TRUE; +} + +void +vmwareSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, + int dstx, int dsty, + int srcx, int srcy, + int width, int height) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + VmwareLog((" Do texture (dstx = %d, dsty = %d, srcx = %d, srcy = %d" + " w = %d, h = %d)\n", dstx, dsty, srcx, srcy, width, height)); + + pVMWARE->curPict->numQueued++; + pVMWARE->frontBuffer->numQueued++; + + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_SURFACE_ALPHA_BLEND); + vmwareWriteWordToFIFO(pVMWARE, (CARD8*)pVMWARE->curPict - pVMWARE->FbBase); + vmwareWriteWordToFIFO(pVMWARE, (CARD8*)pVMWARE->frontBuffer - pVMWARE->FbBase); + vmwareWriteWordToFIFO(pVMWARE, srcx); + vmwareWriteWordToFIFO(pVMWARE, srcy); + vmwareWriteWordToFIFO(pVMWARE, dstx); + vmwareWriteWordToFIFO(pVMWARE, dsty); + vmwareWriteWordToFIFO(pVMWARE, width); + vmwareWriteWordToFIFO(pVMWARE, height); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->op); + vmwareWriteWordToFIFO(pVMWARE, 0); /* flags */ + vmwareWriteWordToFIFO(pVMWARE, 0); /* param1 */ + vmwareWriteWordToFIFO(pVMWARE, 0); /* param2 */ +} +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c Thu Feb 27 12:31:48 2003 @@ -1,62 +0,0 @@ -/* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * **********************************************************/ -#ifdef VMX86_DEVEL -char rcsId_vmwarezerarc[] = - - "Id: vmwarezerarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; -#endif -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ - -#include "vmware.h" - -static void -computeBBarc(DrawablePtr pDrawable, - GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB) -{ - if (narcs <= 0) - return; - pBB->x1 = parcs->x; - pBB->y1 = parcs->y; - pBB->x2 = parcs->x + parcs->width + 1; - pBB->y2 = parcs->y + parcs->height + 1; - while (--narcs) { - parcs++; - if (parcs->x < pBB->x1) - pBB->x1 = parcs->x; - if (parcs->y < pBB->y1) - pBB->y1 = parcs->y; - if ((parcs->x + parcs->width + 1) > pBB->x2) - pBB->x2 = parcs->x + parcs->width + 1; - if ((parcs->y + parcs->height + 1) > pBB->y2) - pBB->y2 = parcs->y + parcs->height + 1; - } - pBB->x1 = - MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x1); - pBB->y1 = - MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y1); - pBB->x2 = - MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->x2); - pBB->y2 = - MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, - (REGION_EXTENTS(pGC->pScreen, -&((WindowPtr) pDrawable)->winSize))->y2); -} - -void -vmwarePolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) -{ - TRACEPOINT - - GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, - pGC->pScreen, - computeBBarc(pDrawable, pGC, narcs, parcs, &BB), - GC_OPS(pGC)->PolyArc(pDrawable, pGC, narcs, parcs)); -} Index: xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c diff -u xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c:1.1 xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c:1.2 --- xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c:1.1 Sat Feb 12 22:06:39 2000 +++ xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c Sat Nov 9 04:00:13 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c,v 1.1 2000/02/13 03:06:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c,v 1.2 2002/11/09 09:00:13 herrb Exp $ */ #include "X.h" #include "os.h" @@ -77,3 +77,16 @@ free(p); } +char * +Xstrdup(const char *s) +{ + char *sd; + + if (s == NULL) + return NULL; + + sd = (char *)Xalloc(strlen(s) + 1); + if (sd != NULL) + strcpy(sd, s); + return sd; +} Index: xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c diff -u xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c:1.1 xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c:1.3 --- xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c:1.1 Sat Oct 27 23:33:54 2001 +++ xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c Tue Dec 24 10:50:43 2002 @@ -1,9 +1,21 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c,v 1.1 2001/10/28 03:33:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c,v 1.3 2002/12/24 15:50:43 tsi Exp $ */ #include "xf86.h" resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex) +{ + return rlist; +} + +void +xf86FreeResList(resPtr rlist) +{ + return; +} + +resPtr +xf86DupResList(const resPtr rlist) { return rlist; } Index: xc/programs/Xserver/hw/xfree86/etc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.40 xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.49 --- xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.40 Sun Jun 24 16:19:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/Imakefile Thu Nov 14 16:01:20 2002 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.40 2001/06/24 20:19:11 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.49 2002/11/14 21:01:20 tsi Exp $ #include <Server.tmpl> #if SystemV @@ -22,7 +22,7 @@ INSTPROG = install.sv4 XDMCONF = XdmConf.svr4 #ifdef SunArchitecture - MISCFILES = apSolx86.shar xcode.xfree86 + MISCFILES = apSolaris.shar xcode.xfree86 #else MISCFILES = 2key.c xcode.xfree86 #endif @@ -62,7 +62,6 @@ SERVEREXTRASYSLIBS = ServerExtraSysLibs #endif - all:: $(FILES) #if defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) @@ -80,20 +79,20 @@ #if BuildScanpci SRCS2 = scanpci.c -#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \ +#if defined(i386Architecture) && \ + defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \ && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2) DEFINES = -DUSE_I386_IOPL -SYS_LIBRARIES = -li386 #endif AllTarget(ProgramTargetName(scanpci)) -NormalProgramTarget(scanpci,scanpci.o,$(XF86OSSRC)/libxf86_os.a,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +NormalProgramTarget(scanpci,scanpci.o,$(XF86OSSRC)/libxf86_os.a ../scanpci/libscanpci.a ../dummylib/libdummy.a,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(scanpci,$(BINDIR)) InstallManPage(scanpci,$(MANDIR)) #endif -#if JoystickSupport || Joystick2Support +#if JoystickSupport SRCS3 = joycal.c AllTarget(ProgramTargetName(joycal)) @@ -105,11 +104,82 @@ SRCS4 = pcitweak.c AllTarget(ProgramTargetName(pcitweak)) -NormalProgramTarget(pcitweak,pcitweak.o,$(XF86OSSRC)/libxf86_os.a,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +NormalProgramTarget(pcitweak,pcitweak.o,$(XF86OSSRC)/libxf86_os.a ../dummylib/libdummy.a,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(pcitweak,$(BINDIR)) InstallManPage(pcitweak,$(MANDIR)) + +#if 0 /*BuildMatchagp*/ + SRCS5 = matchagp.c + +# if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \ + && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2) +DEFINES = -DUSE_I386_IOPL +SYS_LIBRARIES = -li386 +# endif + +AllTarget(ProgramTargetName(matchagp)) + +NormalProgramTarget(matchagp,matchagp.o,$(XF86OSSRC)/libxf86_os.a ../dummylib/libdummy.a,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +InstallProgram(matchagp,$(BINDIR)) +#endif /* BuildMatchagp */ + + SRCS6 = mmapr.c + +AllTarget(ProgramTargetName(mmapr)) +NormalProgramTarget(mmapr,mmapr.o,NullParameter,NullParameter,NullParameter) +InstallProgram(mmapr,$(BINDIR)) + + SRCS7 = mmapw.c + +AllTarget(ProgramTargetName(mmapw)) +NormalProgramTarget(mmapw,mmapw.o,NullParameter,NullParameter,NullParameter) +InstallProgram(mmapw,$(BINDIR)) + +#if defined(i386Architecture) || \ + defined(AlphaArchitecture) || \ + defined(ia64Architecture) || \ + defined(x86_64Architecture) + + SRCS8 = ioport.c + +AllTarget(ProgramTargetName(ioport)) +NormalProgramTarget(ioport,ioport.o,$(XF86OSSRC)/libxf86_os.a ../dummylib/libdummy.a,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS) MathLibrary,NullParameter) +InstallProgram(ioport,$(BINDIR)) + +IOPORT_NAMES = ProgramTargetName(inb) \ + ProgramTargetName(inw) \ + ProgramTargetName(inl) \ + ProgramTargetName(outb) \ + ProgramTargetName(outw) \ + ProgramTargetName(outl) + +all:: $(IOPORT_NAMES) + +$(IOPORT_NAMES): ProgramTargetName(ioport) + RemoveFile($@) + $(LN) $? $@ + +clean:: + RemoveFiles($(IOPORT_NAMES)) + +install:: + @for i in $(IOPORT_NAMES); do (set -x; \ + $(RM) $(DESTDIR)$(BINDIR)/$$i; \ + (cd $(DESTDIR)/$(BINDIR); $(LN) ioport $$i)); \ + done + +#endif + + SRCS9 = gtf.c + +AllTarget(ProgramTargetName(gtf)) + +NormalProgramTarget(gtf,gtf.o,NullParameter,MathLibrary,NullParameter) +InstallProgram(gtf,$(BINDIR)) +InstallManPage(gtf,$(MANDIR)) - SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) + SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS6) $(SRCS7) \ + $(SRCS8) $(SRCS9) #if (SystemV && !defined(i386ScoArchitecture)) || SystemV4 InstallNamedProg($(INSTPROG),xf86install,$(LIBDIR)/etc) Index: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh diff -u xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.37 xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.48 --- xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.37 Thu Jan 17 15:54:23 2002 +++ xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh Sun Feb 23 23:24:17 2003 @@ -1,13 +1,13 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.37 2002/01/17 20:54:23 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.48 2003/02/24 04:24:17 dawes Exp $ # # Copyright © 2000 by Precision Insight, Inc. # Copyright © 2000, 2001 by VA Linux Systems, Inc. -# Copyright © 1996-2002 by The XFree86 Project, Inc. +# Copyright © 1996-2003 by The XFree86 Project, Inc. # -# This script should be used to install XFree86 4.2.0. +# This script should be used to install XFree86 4.3.0. # # Parts of this script are based on the old preinst.sh and postinst.sh # scripts. @@ -20,15 +20,24 @@ # Fallbacks for when the bindist version can't be auto-detected. # These should be updated for each release. -FULLPREFIX=4.2 -PATCHLEVEL=0 -VERSION=$FULLPREFIX.$PATCHLEVEL -FULLVERSION=$FULLPREFIX.0 +SNAPSHOT=n + +if [ $SNAPSHOT = y ]; then + FULLPREFIX=XXX + VERSION=4.2.99.902 + PATCHLEVEL=0 + FULLVERSION=$VERSION +else + FULLPREFIX=4.3 + PATCHLEVEL=0 + VERSION=$FULLPREFIX.$PATCHLEVEL + FULLVERSION=$FULLPREFIX.0 +fi SCRIPTVERSION=$VERSION # XXX Could get this (and above) version info from imake... -FreetypeCurrent=8 -FreetypeAge=2 +FreetypeCurrent=9 +FreetypeAge=3 BINDISTFULLPREFIX= BINDISTPATCHLEVEL= @@ -73,7 +82,7 @@ fi RUNDIR=$ROOTDIR/usr/X11R6 -ETCDIR=$ROOTDIR/etc/X11 +ETCDIR=$ROOTDIR/etc VARDIR=$ROOTDIR/var OLDFILES="" @@ -148,8 +157,13 @@ XftConfig \ " +ETCFONTFILES=" \ + fonts.conf \ + fonts.dtd \ + " + -XKBDIR="$ETCDIR/xkb" +XKBDIR="$ETCDIR/X11/xkb" XKBDBDIR= FONTDIRS=" \ @@ -250,7 +264,7 @@ Xaout*) echo "a.out compatibility libraries";; Xquartz*) - echo "Mac OS X Quartz compatible X server";; + echo "Mac OS X Quartz X server and extensions";; Xupd.tgz) echo "Post-release updates";; *) @@ -435,11 +449,14 @@ 1.[2-3]*) DistName="Darwin-ppc-1.x" ;; - 1.4.* | 5.*) + 1.4* | 5.*) DistName="Darwin-ppc-5.x" + ;; + 6.*) + DistName="Darwin-ppc-6.x" ;; - [6-9].*) - Message="No Darwin/ppc binaries available for this OS version. Try Darwin-ppc-5.x" + [7-9].*) + Message="No Darwin/ppc binaries available for this OS version. Try Darwin-ppc-6.x" ;; *) Message="No Darwin/ppc binaries available for this OS version" @@ -448,12 +465,15 @@ ;; x86*) case "$OsVersion" in - 1.4.* | 5.*) + 1.4* | 5.*) DistName="Darwin-ix86-5.x" ;; - [6-9].*) - Message="No Darwin/ix86 binaries available for this OS version. Try Darwin-ix86-5.x" + 6.*) + DistName="Darwin-ix86-6.x" ;; + [7-9].*) + Message="No Darwin/ix86 binaries available for this OS version. Try Darwin-ix86-6.x" + ;; *) Message="No Darwin/ix86 binaries available for this OS version" ;; @@ -727,7 +747,14 @@ echo "Bindist version is $BINDISTVERSION" BINDISTFULLPREFIX=`expr $BINDISTVERSION : '\([0-9]*\.[0-9]*\)\.'` BINDISTPATCHLEVEL=`expr $BINDISTVERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'` - BINDISTFULLVERSION=$BINDISTFULLPREFIX.0 + case $BINDISTPATCHLEVEL in + 99) + BINDISTFULLVERSION=$BINDISTVERSION + ;; + *) + BINDISTFULLVERSION=$BINDISTFULLPREFIX.0 + ;; + esac else echo "Warning: can't detect the bindist version" fi @@ -860,6 +887,9 @@ echo "" fi done + # update Fontconfig cache + Echo "Updating the index of Freetype fonts..." + $RUNDIR/bin/fc-cache -v echo "" echo "Update installation complete." @@ -876,10 +906,10 @@ echo " Welcome to the XFree86 $SCRIPTVERSION installer" echo "" echo "You are strongly advised to backup your existing XFree86 installation" -echo "before proceeding. This includes the $ROOTDIR/usr/X11R6 and $ROOTDIR/etc/X11" -echo "directories. The installation process will overwrite existing files" -echo "in those directories, and this may include some configuration files" -echo "that may have been customised." +echo "before proceeding. This includes the $ROOTDIR/usr/X11R6, $ROOTDIR/etc/X11" +echo "and $ROOTDIR/etc/fonts directories. The installation process will" +echo "overwrite existing files in those directories, and this may include" +echo "some configuration files that may have been customised." echo "" echo "If you are installing a version different from $SCRIPTVERSION, you" echo "may need an updated version of this installer script." @@ -915,7 +945,6 @@ SERVDIST="Xxserv.tgz Xquartz.tgz" else SERVDIST="Xxserv.tgz" - EXTRAOPTDIST="Xquartz.tgz" fi ;; FreeBSD|NetBSD|OpenBSD) @@ -1086,7 +1115,7 @@ exit 0 fi -# Create $RUNDIR and $ETCDIR if they don't already exist +# Create $RUNDIR, $ETCDIR/X11 and $ETCDIR/fonts if they don't already exist if [ ! -d $RUNDIR ]; then NewRunDir=YES @@ -1101,10 +1130,14 @@ echo "Creating $RUNDIR/lib/X11" mkdir $RUNDIR/lib/X11 fi -if [ ! -d $ETCDIR ]; then +if [ ! -d $ETCDIR/X11 ]; then NewEtcDir=YES - echo "Creating $ETCDIR" - mkdir $ETCDIR + echo "Creating $ETCDIR/X11" + mkdir $ETCDIR/X11 +fi +if [ ! -d $ETCDIR/fonts ]; then + echo "Creating $ETCDIR/fonts" + mkdir $ETCDIR/fonts fi if [ -d $RUNDIR -a -d $RUNDIR/bin -a -d $RUNDIR/lib ]; then @@ -1162,13 +1195,13 @@ if [ X"$EtcDirToMove" != X -o X"$EtcFileToMove" != X ]; then echo "XFree86 now installs most customisable configuration files under" - echo "$ETCDIR instead of under $RUNDIR/lib/X11, and has symbolic links" + echo "$ETCDIR/X11 instead of under $RUNDIR/lib/X11, and has symbolic links" echo "under $RUNDIR/lib/X11 that point to $ETCDIR. You currently have" echo "files under the following subdirectories of $RUNDIR/lib/X11:" echo "" echo "$EtcDirToMove $EtcFileToMove" echo "" - echo "Do you want to move them to $ETCDIR and create the necessary" + echo "Do you want to move them to $ETCDIR/X11 and create the necessary" Echo "links? (y/n) [y] " read response case "$response" in @@ -1182,20 +1215,20 @@ echo "" if [ X"$NoSymLinks" != XYES ]; then for i in $EtcDirToMove; do - echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/$i ..." - if [ ! -d $ETCDIR/$i ]; then - mkdir $ETCDIR/$i + echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/X11/$i ..." + if [ ! -d $ETCDIR/X11/$i ]; then + mkdir $ETCDIR/X11/$i fi $TAR -C $RUNDIR/lib/X11/$i -c -f - . | \ - $TAR -C $ETCDIR/$i -v -x -p -U -f - && \ + $TAR -C $ETCDIR/X11/$i -v -x -p -U -f - && \ rm -fr $RUNDIR/lib/X11/$i && \ - ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i + ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i done for i in $EtcFileToMove; do - echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/$i ..." - cp -p $RUNDIR/lib/X11/$i $ETCDIR/$i && \ + echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/X11/$i ..." + cp -p $RUNDIR/lib/X11/$i $ETCDIR/X11/$i && \ rm -fr $RUNDIR/lib/X11/$i && \ - ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i + ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i done fi fi @@ -1226,18 +1259,18 @@ if [ $DoCopy = YES ]; then echo "Installing the $i config files ..." if [ X"$NoSymLinks" != XYES ]; then - if [ ! -d $ETCDIR/$i ]; then - mkdir $ETCDIR/$i + if [ ! -d $ETCDIR/X11/$i ]; then + mkdir $ETCDIR/X11/$i fi if [ ! -d $RUNDIR/lib/X11/$i ]; then - ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i + ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i fi else if [ ! -d $RUNDIR/lib/X11/$i ]; then mkdir $RUNDIR/lib/X11/$i fi fi - $TAR -C .etctmp/$i -c -f - . | \ + $TAR -C .etctmp/X11/$i -c -f - . | \ $TAR -C $RUNDIR/lib/X11/$i -v -x -p -U -f - fi done @@ -1259,24 +1292,43 @@ echo "Installing the $i config file ..." if [ X"$NoSymLinks" != XYES ]; then if [ ! -f $RUNDIR/lib/X11/$i ]; then - ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i + ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i fi fi - (set -x; cp -p .etctmp/$i $RUNDIR/lib/X11/$i) + (set -x; cp -p .etctmp/X11/$i $RUNDIR/lib/X11/$i) fi done if [ X"$XKBDIR" != X ]; then if [ X"$NoSymLinks" = XYES ]; then XKBDIR=$RUNDIR/lib/X11/xkb/compiled fi - if [ -d .etctmp/xkb ]; then + if [ -d .etctmp/X11/xkb ]; then if [ ! -d $XKBDIR ]; then mkdir $XKBDIR fi - $TAR -C .etctmp/xkb -c -f - . | \ + $TAR -C .etctmp/X11/xkb -c -f - . | \ $TAR -C $XKBDIR -v -x -p -U -f - fi fi +for i in $ETCFONTFILES; do + DoCopy=YES + if [ -f $ETCDIR/fonts/$i ]; then + Echo "Do you want to overwrite the $i config file? (y/n) [n] " + read response + case "$response" in + [yY]*) + : OK + ;; + *) + DoCopy=NO + ;; + esac + fi + if [ $DoCopy = YES ]; then + echo "Installing the $i config file ..." + (set -x; cp -p .etctmp/fonts/$i $ETCDIR/fonts/$i) + fi +done rm -fr .etctmp echo "" Index: xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar diff -u xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar:1.1 xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar:1.3 --- xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar:1.1 Sat Oct 27 23:33:55 2001 +++ xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar Fri Oct 4 15:45:33 2002 @@ -1,74 +1,30 @@ #!/bin/sh -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar,v 1.1 2001/10/28 03:33:55 tsi Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar,v 1.3 2002/10/04 19:45:33 tsi Exp $ # This is a shell archive (produced by GNU sharutils 4.2c). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # -# Made on 2001-10-01 14:53 MDT by <tsi@xfree86.org>. +# Made on 2002-10-04 13:41 MDT by <root@abcyxhiz>. # Source directory was `/archives'. # # Existing files will *not* be overwritten unless `-c' is specified. +# This format requires very little intelligence at unshar time. +# "if test", "echo", "mkdir", and "sed" may be needed. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ -# 1609 -rw-r--r-- aperture/Makefile +# 1521 -rw-r--r-- aperture/Makefile # 1659 -rw-r--r-- aperture/README -# 7514 -rw-r--r-- aperture/aperture.c +# 7557 -rw-r--r-- aperture/aperture.c # 450 -rw-r--r-- aperture/aperture.conf # 87 -rw-r--r-- aperture/devlink.tab -# 1518 -rw-r--r-- aperture/Makefile.sun4u +# 1062 -rw-r--r-- aperture/Makefile.sun4u # -save_IFS="${IFS}" -IFS="${IFS}:" -gettext_dir=FAILED -locale_dir=FAILED -first_param="$1" -for dir in $PATH -do - if test "$gettext_dir" = FAILED && test -f $dir/gettext \ - && ($dir/gettext --version >/dev/null 2>&1) - then - set `$dir/gettext --version 2>&1` - if test "$3" = GNU - then - gettext_dir=$dir - fi - fi - if test "$locale_dir" = FAILED && test -f $dir/shar \ - && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) - then - locale_dir=`$dir/shar --print-text-domain-dir` - fi -done -IFS="$save_IFS" -if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED -then - echo=echo -else - TEXTDOMAINDIR=$locale_dir - export TEXTDOMAINDIR - TEXTDOMAIN=sharutils - export TEXTDOMAIN - echo="$gettext_dir/gettext -s" -fi -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - shar_n= shar_c=' +echo=echo +shar_tty= shar_n= shar_c=' ' - else - shar_n=-n shar_c= - fi -else - shar_n= shar_c='\c' -fi -$echo $shar_n 'x -' 'lock directory' "\`_sh10724': "$shar_c -if mkdir _sh10724; then - $echo 'created' -else - $echo 'failed to create' - exit 1 -fi +mkdir _sh09806 || ( echo 'failed to create locking directory' '_sh09806'; exit 1 ) # ============= aperture/Makefile ============== if test ! -d 'aperture'; then $echo $echo_n 'x -' 'aperture: '$echo_c @@ -87,24 +43,19 @@ X# Date: 2/23/94 X# - Changed name, and debugging structure X# Modified: Marc Aurele La France (tsi@xfree86.org) -X# Date: 2001.06-08 +X# Date: 2001.06.08 X# - SPARC support, cleanup and turf aptest. X# X# >>NOTE<< Have a look at Makefile.sun4u for sun4u specifics. X# X# GNU gcc compiler -X#CC=gcc -X#CFLGS=-fno-builtin -W -Waggregate-return -Wbad-function-cast -Wcast-align \ -X# -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wformat \ -X# -Wimplicit -Wimport -Wmissing-declarations -Wmissing-prototypes \ -X# -Wnested_externs -Wparentheses -Wpointer-arith -Wredundant-decls \ -X# -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wtraditional \ -X# -Wtrigraphs -Wuninitialized +XCC=gcc +XCFLGS=-fno-builtin -Wall -O3 X X# X# Proworks compiler -XCC=/opt/SUNWspro/bin/cc -XCFLGS=-Xa -xarch=v9 -xnolib -xO3 +X#CC=/opt/SUNWspro/bin/cc +X#CFLGS=-Xa -xnolib -xO3 X X# X# Debug error reporting @@ -124,10 +75,15 @@ Xall: $(DRIVER) X X$(DRIVER): $(OBJS) -X ld -r -o $(DRIVER) $(OBJS) +X @if [ -f "Makefile.`uname -m`" ]; then \ +X make -f Makefile.`uname -m` $(DRIVER); \ +X else \ +X rm -f $(DRIVER); \ +X ld -r -o $(DRIVER) $(OBJS); \ +X fi X Xinstall: $(DRIVER) -X if [ -f "Makefile.`uname -m`" ]; then \ +X @if [ -f "Makefile.`uname -m`" ]; then \ X make -f Makefile.`uname -m` install; \ X else \ X cp aperture.conf /kernel/drv; \ @@ -135,10 +91,10 @@ X fi X Xadd_drv: -X if [ -f "Makefile.`uname -m`" ]; then \ +X @if [ -f "Makefile.`uname -m`" ]; then \ X make -f Makefile.`uname -m` add_drv; \ X else \ -X add_drv /kernel/drv/aperture; +X add_drv /kernel/drv/aperture; \ X fi X Xclean: @@ -148,20 +104,16 @@ X X.c.i: X $(CC) -E $(CFLAGS) $*.c > $@ -SHAR_EOF - chmod 0644 'aperture/Makefile' || - $echo 'restore of' 'aperture/Makefile' 'failed' - if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ - && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then - md5sum -c << SHAR_EOF >/dev/null 2>&1 \ - || $echo 'aperture/Makefile:' 'MD5 check failed' -b441bb09109f0d3247890d1833ef6be1 aperture/Makefile +X +X.c.o: +X @if [ -f "Makefile.`uname -m`" ]; then \ +X make -f Makefile.`uname -m` $@; \ +X else \ +X rm -f $@; \ +X $(CC) -c $(CFLAGS) $*.c -o $@; \ +X fi SHAR_EOF - else - shar_count="`LC_ALL=C wc -c < 'aperture/Makefile'`" - test 1609 -eq "$shar_count" || - $echo 'aperture/Makefile:' 'original size' '1609,' 'current size' "$shar_count!" - fi + : || $echo 'restore of' 'aperture/Makefile' 'failed' fi # ============= aperture/README ============== if test -f 'aperture/README' && test "$first_param" != -c; then @@ -219,20 +171,8 @@ X # init 6 X XBug reports, questions, suggestions, etc can be sent to xfree86@xfree86.org. -SHAR_EOF - chmod 0644 'aperture/README' || - $echo 'restore of' 'aperture/README' 'failed' - if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ - && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then - md5sum -c << SHAR_EOF >/dev/null 2>&1 \ - || $echo 'aperture/README:' 'MD5 check failed' -9a792c50901ed8099a7f60eecd43ef22 aperture/README SHAR_EOF - else - shar_count="`LC_ALL=C wc -c < 'aperture/README'`" - test 1659 -eq "$shar_count" || - $echo 'aperture/README:' 'original size' '1659,' 'current size' "$shar_count!" - fi + : || $echo 'restore of' 'aperture/README' 'failed' fi # ============= aperture/aperture.c ============== if test -f 'aperture/aperture.c' && test "$first_param" != -c; then @@ -359,7 +299,7 @@ X X#endif X -X pf = btop(off); +X pf = btop((unsigned long)off); X X /* Deal with mmap(9E) interface limits */ X error = (int)pf; @@ -524,7 +464,8 @@ X else X { X error = ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR, -X ddi_get_instance(dip), NULL, NODESPECIFIC_DEV); +X (minor_t)ddi_get_instance(dip), +X NULL, NODESPECIFIC_DEV); X X if (error == DDI_SUCCESS) X { @@ -713,19 +654,7 @@ X return error; X} SHAR_EOF - chmod 0644 'aperture/aperture.c' || - $echo 'restore of' 'aperture/aperture.c' 'failed' - if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ - && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then - md5sum -c << SHAR_EOF >/dev/null 2>&1 \ - || $echo 'aperture/aperture.c:' 'MD5 check failed' -6b1d5b5fd036811e56982b8f6350c4df aperture/aperture.c -SHAR_EOF - else - shar_count="`LC_ALL=C wc -c < 'aperture/aperture.c'`" - test 7514 -eq "$shar_count" || - $echo 'aperture/aperture.c:' 'original size' '7514,' 'current size' "$shar_count!" - fi + : || $echo 'restore of' 'aperture/aperture.c' 'failed' fi # ============= aperture/aperture.conf ============== if test -f 'aperture/aperture.conf' && test "$first_param" != -c; then @@ -749,20 +678,8 @@ X# Purpose: This conf file is used by the aperture driver. X# Xname="aperture" parent="pseudo"; -SHAR_EOF - chmod 0644 'aperture/aperture.conf' || - $echo 'restore of' 'aperture/aperture.conf' 'failed' - if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ - && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then - md5sum -c << SHAR_EOF >/dev/null 2>&1 \ - || $echo 'aperture/aperture.conf:' 'MD5 check failed' -7898b8401e400ad797aa1eb4fb35d492 aperture/aperture.conf SHAR_EOF - else - shar_count="`LC_ALL=C wc -c < 'aperture/aperture.conf'`" - test 450 -eq "$shar_count" || - $echo 'aperture/aperture.conf:' 'original size' '450,' 'current size' "$shar_count!" - fi + : || $echo 'restore of' 'aperture/aperture.conf' 'failed' fi # ============= aperture/devlink.tab ============== if test -f 'aperture/devlink.tab' && test "$first_param" != -c; then @@ -773,19 +690,7 @@ X# The following entry is for the aperture driver Xtype=ddi_pseudo;name=aperture fbs/\M0 SHAR_EOF - chmod 0644 'aperture/devlink.tab' || - $echo 'restore of' 'aperture/devlink.tab' 'failed' - if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ - && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then - md5sum -c << SHAR_EOF >/dev/null 2>&1 \ - || $echo 'aperture/devlink.tab:' 'MD5 check failed' -9711411e1d2caacb420cd58c817b4985 aperture/devlink.tab -SHAR_EOF - else - shar_count="`LC_ALL=C wc -c < 'aperture/devlink.tab'`" - test 87 -eq "$shar_count" || - $echo 'aperture/devlink.tab:' 'original size' '87,' 'current size' "$shar_count!" - fi + : || $echo 'restore of' 'aperture/devlink.tab' 'failed' fi # ============= aperture/Makefile.sun4u ============== if test -f 'aperture/Makefile.sun4u' && test "$first_param" != -c; then @@ -801,27 +706,20 @@ X# Date: 2/23/94 X# - Changed name, and debugging structure X# Modified: Marc Aurele La France (tsi@xfree86.org) -X# Date: 2001.06-08 +X# Date: 2001.06.08 X# - SPARC support, cleanup and turf aptest. X# X X# -X# GNU gcc compiler, for when it can generate 64-bit binaries. Apparently -X# GCC 3.0 can, but it has not been tried... +X# GNU gcc compiler, version 3.2 or later X# -X#CC=gcc -X#CFLGS=-fno-builtin -W -Waggregate-return -Wbad-function-cast -Wcast-align \ -X# -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wformat \ -X# -Wimplicit -Wimport -Wmissing-declarations -Wmissing-prototypes \ -X# -Wnested_externs -Wparentheses -Wpointer-arith -Wredundant-decls \ -X# -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wtraditional \ -X# -Wtrigraphs -Wuninitialized -X# (+ whatever is needed to generate 64-bit object) +XCC=gcc +XCFLGS=-fno-builtin -Wall -O3 -m64 X X# X# Proworks compiler -XCC=/opt/SUNWspro/bin/cc -XCFLGS=-Xa -xarch=v9 -xnolib -xO3 +X#CC=/opt/SUNWspro/bin/cc +X#CFLGS=-Xa -xarch=v9 -xnolib -xO3 X X# X# Debug error reporting @@ -841,6 +739,7 @@ Xall: $(DRIVER) X X$(DRIVER): $(OBJS) +X rm -f $(DRIVER) X ld -r -o $(DRIVER) $(OBJS) X Xinstall: $(DRIVER) @@ -857,23 +756,11 @@ X X.c.i: X $(CC) -E $(CFLAGS) $*.c > $@ -SHAR_EOF - chmod 0644 'aperture/Makefile.sun4u' || - $echo 'restore of' 'aperture/Makefile.sun4u' 'failed' - if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ - && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then - md5sum -c << SHAR_EOF >/dev/null 2>&1 \ - || $echo 'aperture/Makefile.sun4u:' 'MD5 check failed' -4e5c934bd99816318d20972318a93ad0 aperture/Makefile.sun4u SHAR_EOF - else - shar_count="`LC_ALL=C wc -c < 'aperture/Makefile.sun4u'`" - test 1518 -eq "$shar_count" || - $echo 'aperture/Makefile.sun4u:' 'original size' '1518,' 'current size' "$shar_count!" - fi + : || $echo 'restore of' 'aperture/Makefile.sun4u' 'failed' fi -$echo $shar_n 'x -' 'lock directory' "\`_sh10724': " $shar_c -if rm -fr _sh10724; then +$echo $shar_n 'x -' 'lock directory' "\`_sh09806': " $shar_c +if rm -fr _sh09806; then $echo 'removed' else $echo 'failed to remove' Index: xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar diff -u xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar:3.4 xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar:removed --- xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar:3.4 Mon Dec 23 01:47:07 1996 +++ xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar Thu Feb 27 12:31:49 2003 @@ -1,1339 +0,0 @@ -#!/bin/sh -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar,v 3.4 1996/12/23 06:47:07 dawes Exp $ -# This is a shell archive (produced by shar 3.49) -# To extract the files from this archive, save it to a file, remove -# everything above the "!/bin/sh" line above, and type "sh file_name". -# -# made 09/25/1994 14:29 UTC by davidh@barite -# Source directory /usr10/davidh/aperture -# -# $XConsortium: apSolx86.shar /main/4 1996/02/21 17:47:22 kaleb $ -# -# existing files will NOT be overwritten unless -c is specified -# -# This shar contains: -# length mode name -# ------ ---------- ------------------------------------------ -# 1342 -rw-r--r-- aperture/Makefile -# 4042 -rw-r--r-- aperture/aperture.h -# 95 -rw-r--r-- aperture/devlink.tab -# 2914 -rw-r--r-- aperture/README -# 20528 -rw-r--r-- aperture/aperture.c -# 518 -rw-r--r-- aperture/aperture.conf -# 3530 -rw-r--r-- aperture/aptest.c -# 2174 -rw-r--r-- aperture/DISCLAIMER -# -# ============= aperture/Makefile ============== -if test ! -d 'aperture'; then - echo 'x - creating directory aperture' - mkdir 'aperture' -fi -if test -f 'aperture/Makefile' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/Makefile (File already exists)' -else -echo 'x - extracting aperture/Makefile (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/Makefile' && -# -# File: makefile for aperture Framebuffer Driver -# Author: Doug Anson (danson@lgc.com) -# Date: 2/15/94 -# Modified: David Holland (davidh@use.com) -# Date: 2/23/94 -# - Changed name, and debugging structure -# -# $Id -# -# Debug flags may be set to the following values: -# -# APERTURE_DEBUG = 1 -- basic log reporting (mininal) -# APERTURE_DEBUG = 2 -- more log reporting (mmap results) -# APERTURE_DEBUG = 3 -- verbose log reporting (kernel entry points) -# -X -# -# GNU gcc compiler (2.4.5 or 2.5.8) -CC=gcc -CFLGS=-fno-builtin -X -# -# Proworks compiler (untested!) -#CC= /opt/SUNWspro/bin/cc -#CFLGS=-Xa -X -# -# location of lint program (untested!) -LINT= /usr/opt/SUNWspro/bin/lint -X -# -# Debug error reporting -#DEBUG_FLG= -#DEBUG_FLG=-DAPERTURE_DEBUG=1 -#DEBUG_FLG=-DAPERTURE_DEBUG=2 -DEBUG_FLG=-DAPERTURE_DEBUG=3 -X -# -# Files and object declarations -KERNEL_FLGS=-D_KERNEL -DSUNDDI -I. -CFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG) -CFILES= aperture.c -HEADERS= aperture.h -OBJS= aperture.o -DRIVER= aperture -APTEST= aptest -APTESTOBJ= aptest.o -X -# -# Make rules -all: aperture aptest -X -aperture: $(OBJS) -X ld -r -o aperture aperture.o -X -install: aperture aptest -X cp aperture aperture.conf /kernel/drv -X -aptest: $(APTESTOBJ) -X $(CC) -o $(APTEST) $(APTESTOBJ) -X -clean: -X rm -f *% *.BAK $(OBJS) $(APTESTOBJ) $(APTEST) $(DRIVER) core -X -lint: -X $(LINT) -D_KERNEL -x -u $(CFILES) -SHAR_EOF -chmod 0644 aperture/Makefile || -echo 'restore of aperture/Makefile failed' -Wc_c="`wc -c < 'aperture/Makefile'`" -test 1342 -eq "$Wc_c" || - echo 'aperture/Makefile: original size 1342, current size' "$Wc_c" -fi -# ============= aperture/aperture.h ============== -if test -f 'aperture/aperture.h' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/aperture.h (File already exists)' -else -echo 'x - extracting aperture/aperture.h (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.h' && -/* -X * Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com -X * -X * File: aperture.h -X * Author: Doug Anson -X * Date: 1/31/94 -X * -X * Modified: David Holland (davidh@use.com) -X * Log: Modified for new name 2/23/9 -X * -X * Purpose: This header is the master header for the Solaris 2.1 x86 -X * framebuffer mmap driver. Portions of this driver are taken -X * from mmapio.h 1.4 copyright 93/06/03 Sun Microsystems, Inc. -X * -X * Disclamer: -X * -X * This code is based largely upon the sample device drivers provided -X * by Sun Microsystems Inc. -X * -X * Original copyright notice: -X * @(#)mmapio.h 1.4 copyright 93/06/03 Sun Microsystems, Inc. -X * -X * Our copyright notice: -X * Permission to use, copy, modify, distribute, and sell this software and its -X * documentation for any purpose is hereby granted without fee, provided that -X * the above copyright notice appear in all copies and that both that -X * copyright notice and this permission notice appear in supporting -X * documentation, and that the name of Doug Anson, and David Holland be used in -X * advertising or publicity pertaining to distribution of the software -X * Doug Anson, and David Holland make no * representations about the -X * suitability of this software for any purpose. -X * It is provided "as is" without express or implied warranty. -X * -X * Original disclamer from Sun Microsystems, Inc.: -X * This is a package of sample device drivers for Solaris 2.x (SunOS -X * 5.x). You may use, modify and distribute these drivers and/or binaries -X * derived from them. However please note that: -X * -X * These examples are provided with no warranties of any kind, including -X * without limitation accuracy and usefulness, and Sun expressly disclaims -X * all implied warranties of merchantability, fitness for a particular -X * purpose and non-infringement. In no event shall Sun be liable for any -X * damages, including without limitation, direct, special, indirect, or -X * consequential damages arising out of, or relating to, use of these -X * examples by customer or any third party. Sun is under no obligation to -X * provide support to customer for this software. -X * -X * Our disclaimer: -X * DOUG ANSON, AND DAVID HOLLAND DISCLAIMS ALL WARRIENTS WITH REGARD TO THIS -X * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS, -X * IN NO EVENT SHALL DOUG ANSON, OR DAVID HOLLAND BE LIABLE FOR ANY SPECIAL, -X * INDIRECT, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM -X * USAGE OF THIS SOFTWARE. -X */ -X -/* -X * linear framebuffer aperture driver header file -X * -X * $Id -X */ -X -#ifndef APERTURE_H -#define APERTURE_H -X -/* -X * Framebuffer identification definitions -X */ -#define APERTURE_NAME "aperture" -#define DEV_BANNER_STRING "SVGA Framebuffer Driver v0.99" -#define DEV_IDENT_STRING APERTURE_NAME -X -/* -X * driver.conf(4) "reg" property definition for aperture driver: -X * FORMAT: reg=AP_REGNUM,AP_ADDR,AP_SIZE -X */ -#define AP_REGNUM 0 /* register number is 1st number in "reg" prop */ -#define AP_ADDR 1 /* fb base address is 2nd number in "reg" prop */ -#define AP_SIZE 2 /* fb length value is 3rd number in "reg" prop */ -#define AP_MAX 3 /* number of values in "reg" property */ -X -/* -X * How big a chunk of register we map with each ddi_map_regs(9F) -X */ -#define AP_MEM_CHUNK sizeof(int) -X -/* -X * Error value for mmap(2) failure status -X */ -#define AP_MEM_FAILURE -1 -X -/* -X * Main memory map structure for the Framebuffer mmap driver -X */ -struct mmap -{ -X u_int regnum; /* registers number */ -X volatile caddr_t regbase; /* base address of device to mmap */ -X off_t regsize; /* length of region to mmap(2) */ -X off_t reglength; /* map length for ddi_map_regs(9F) */ -X volatile caddr_t kaddr; /* kernel address of mapped device */ -X off_t off; /* offset from mmap(2) call */ -X volatile off_t mapaddr; /* base address of mmap(2) region */ -X kmutex_t map_lock; /* device map mutex lock */ -X dev_info_t *dip; /* device information pointer */ -}; -typedef struct mmap Mmap; -X -#endif /* APERTURE_H */ -SHAR_EOF -chmod 0644 aperture/aperture.h || -echo 'restore of aperture/aperture.h failed' -Wc_c="`wc -c < 'aperture/aperture.h'`" -test 4042 -eq "$Wc_c" || - echo 'aperture/aperture.h: original size 4042, current size' "$Wc_c" -fi -# ============= aperture/devlink.tab ============== -if test -f 'aperture/devlink.tab' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/devlink.tab (File already exists)' -else -echo 'x - extracting aperture/devlink.tab (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/devlink.tab' && -# The following entry is for the SVGA framebuffer driver -type=ddi_pseudo;name=aperture fbs/\M0 -SHAR_EOF -chmod 0644 aperture/devlink.tab || -echo 'restore of aperture/devlink.tab failed' -Wc_c="`wc -c < 'aperture/devlink.tab'`" -test 95 -eq "$Wc_c" || - echo 'aperture/devlink.tab: original size 95, current size' "$Wc_c" -fi -# ============= aperture/README ============== -if test -f 'aperture/README' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/README (File already exists)' -else -echo 'x - extracting aperture/README (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/README' && -Framebuffer apperture driver. -X -(Note, see the DISCLAIMER file before using this driver! -X - Sorry, we've gotta cover ourselves) -X -This driver was written to help work around one particular limitation in the -x86 /dev/mem driver. -X -1) No Solaris x86 device we've found allows access to memory regions that -X exist above the amount of RAM in the machine. So one could not -X access the linear frame buffer of a Mach32 VLB board that decodes -X is memory aperture at the 124Megabyte mark. -X -This driver attempts to work around some of those problems. All it simply -does is allow a user to mmap() any physical address less than 128Megs -back into user address space. -X -It is the corroborative work of Doug Anson (danson@lgc.com), and -David Holland (davidh@use.com). -X -Many thanks to the XFree86[tm] Alpha, and Beta teams, for without -all their hard work, there wouldn't be any need for this driver. -X -Installation instructions: -X -1) Check the Makefile, for appropriate CC, and CFLAGS defintions. -X Compiling with APERTURE_DEBUG defined (via -DAPERTURE_DEBUG=?) means -X the driver will generate reams of debugging output. You'll probably -X want to leave this off, or set to zero.. -X -2) type 'make'. The driver and test program should compile with out any -X problems. There also should not be any warning messages. -X -3) Become 'root'. -X -4) type 'make install' and run 'add_drv /kernel/drv/aperture'. -X The screen should look something like this: -X -X # make install -X cp aperture aperture.conf /kernel/drv -X # add_drv /kernel/drv/aperture -X -X This installs the driver in the system. -X -5) While as root modify the file /etc/devlink.tab, adding these lines: -X -# The following entry is for the SVGA framebuffer driver -type=ddi_pseudo;name=aperture fbs/\M0 -X -X Add that line exactly as shown. You may also simply add the -X contents of the devlink.tab file supplied to /etc/devlink.tab. -X It contains the lines as well. (Yes, that is a tab between -X aperture, and fbs, not spaces - very important) -X -6) Perform a reconfiguration boot of the system. -X -X # touch /reconfigure -X # init 6 -X -7) Login as root and run the aptest program. It tests that the -X mmap driver is working properly, by mmaping the main bios -X into user address space. If you happen to have AMI bios the -X output will look something like so: -X -# ./aptest -NOTICE: BIOS mapped [0xf0000 ,size=4096) to addr=0x8000b000... -0123AAAAMMMMIIII05/05/91(C)1990 American Megatrends Inc., All Rights Reserved -DONE displaying memory contents (80 bytes) -UNMAPPING [0xf0000 ,size=4096) to addr=0x8000b000... and closing...DONE. -Exiting successful... -# -X -X -8) Nope, there are not any man pages, I don't know nroff. As for programming -X suggestions, take a look at aptest.c a working example is obviously -X in there. -X -Bug reports, questions, suggestions, etc can be sent to -X -Doug Anson -danson@lgc.com -X -X or -X -David Holland -davidh@use.com -X -Flames can be sent to -/dev/null -SHAR_EOF -chmod 0644 aperture/README || -echo 'restore of aperture/README failed' -Wc_c="`wc -c < 'aperture/README'`" -test 2914 -eq "$Wc_c" || - echo 'aperture/README: original size 2914, current size' "$Wc_c" -fi -# ============= aperture/aperture.c ============== -if test -f 'aperture/aperture.c' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/aperture.c (File already exists)' -else -echo 'x - extracting aperture/aperture.c (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.c' && -/* -X * Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com -X * -X * File: aperture.c -X * Author: Doug Anson (danson@lgc.com) -X * Date: 1/31/94 -X * -X * Modified: David Holland (davidh@use.com) -X * Date: 2/23/94 -X * Changes: Changed general name of driver -X * Debugging flags -X * Removed a few extraneous erorr messages. -X * -X * -X * Purpose: This file is the master device file for the Solaris 2.1 x86 -X * framebuffer aperture driver. Portions of this driver are taken -X * from mmap.c 1.4 copyright 93/06/03 Sun Microsystems, Inc. -X * (Sample memory mapped driver for Solaris 2.0/Sun OS 5.0) -X * -X * This driver allows accelerated SVGA graphics cards that are -X * attached vi 32-bit paths (VESA/EISA/MC) and that have -X * linear framebuffer capabilities to have their framebuffer -X * memory mapped into the user process space. -X * -X * Disclamer: -X * -X * This code is based largely upon the sample device drivers provided -X * by Sun Microsystems Inc. -X * -X * Original copyright notice: -X * @(#)mmap.c 1.3 copyright 93/06/03 Sun Microsystems, Inc. -X * -X * Our copyright notice: -X * Permission to use, copy, modify, distribute, and sell this software and its -X * documentation for any purpose is hereby granted without fee, provided that -X * the above copyright notice appear in all copies and that both that -X * copyright notice and this permission notice appear in supporting -X * documentation, and that the name of Doug Anson, and David Holland be used in -X * advertising or publicity pertaining to distribution of the software -X * Doug Anson, and David Holland make no * representations about the -X * suitability of this software for any purpose. -X * It is provided "as is" without express or implied warranty. -X * -X * Original disclamer from Sun Microsystems, Inc.: -X * This is a package of sample device drivers for Solaris 2.x (SunOS -X * 5.x). You may use, modify and distribute these drivers and/or binaries -X * derived from them. However please note that: -X * -X * These examples are provided with no warranties of any kind, including -X * without limitation accuracy and usefulness, and Sun expressly disclaims -X * all implied warranties of merchantability, fitness for a particular -X * purpose and non-infringement. In no event shall Sun be liable for any -X * damages, including without limitation, direct, special, indirect, or -X * consequential damages arising out of, or relating to, use of these -X * examples by customer or any third party. Sun is under no obligation to -X * provide support to customer for this software. -X * -X * Our disclaimer: -X * DOUG ANSON, AND DAVID HOLLAND DISCLAIMS ALL WARRIENTS WITH REGARD TO THIS -X * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS, -X * IN NO EVENT SHALL DOUG ANSON, OR DAVID HOLLAND BE LIABLE FOR ANY SPECIAL, -X * INDIRECT, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM -X * USAGE OF THIS SOFTWARE. -X */ -X -/* -X * linear framebuffer aperture driver -X * -X * $Id -X */ -X -#include <sys/types.h> -#include <sys/param.h> -#include <sys/errno.h> -#include <sys/file.h> -#include <sys/conf.h> -#include <sys/uio.h> -#include <sys/map.h> -#include <sys/debug.h> -#include <sys/modctl.h> -#include <sys/kmem.h> -#include <sys/cmn_err.h> -#include <sys/open.h> -#include <sys/stat.h> -#include <sys/ddi.h> -#include <sys/sunddi.h> -X -#include "aperture.h" -X -/* opaque handle top of state structs */ -static void *state_head = NULL; -X -/* -X * Solaris DDI/DKI driver entry points -X */ -#if defined(__STDC__) -static int aperture_getinfo(dev_info_t *, ddi_info_cmd_t, void *,void **); -static int aperture_identify(dev_info_t *dip); -static int aperture_probe(dev_info_t *dip); -static int aperture_attach(dev_info_t *, ddi_attach_cmd_t); -static int aperture_open(dev_t *, int, int, cred_t *); -static int aperture_close(dev_t, int, int, cred_t *); -static int aperture_detach(dev_info_t *, ddi_detach_cmd_t); -static int aperture_mmap(dev_t, off_t, int); -#else -static int aperture_getinfo(); -static int aperture_identify(); -static int aperture_probe(); -static int aperture_attach(); -static int aperture_open(); -static int aperture_close(); -static int aperture_detach(); -static int aperture_mmap(); -#endif /* __STDC__ */ -X -/* -X * Solaris DDI/DKI module linkeage structure declarations -X */ -static struct cb_ops aperture_cb_ops = -{ -X aperture_open, /* XXopen routine */ -X aperture_close, /* XXclose routine */ -X nodev, /* XXstrategy routine */ -X nodev, /* XXprint routine */ -X nodev, /* XXdump routine */ -X nodev, /* XXread routine */ -X nodev, /* XXwrite routine */ -X nodev, /* XXioctl routine */ -X nodev, /* XXdevmap routine */ -X aperture_mmap, /* XXmmap routine */ -X ddi_segmap, /* XXsegmap routine */ -X nochpoll, /* XXchpoll routine */ -X ddi_prop_op, /* XXprop_op routine */ -X (struct streamtab *)0, /* not a STREAMS driver */ -X D_NEW | D_MP, /* safe for multi-thread/multi-processor*/ -}; -X -static struct dev_ops aperture_ops = -{ -X DEVO_REV, /* DEVO_REV indicated by manual */ -X 0, /* device reference count */ -X aperture_getinfo, /* devo_getinfo routine */ -X aperture_identify, /* devo_identiry routine */ -X aperture_probe, /* device probe for non-self-id */ -X aperture_attach, /* devo_attach routine */ -X aperture_detach, /* devo_detach routine */ -X nodev, /* device reset routine */ -X &aperture_cb_ops, /* cb_ops structure pointer */ -X (struct bus_ops *)0, /* bus operations */ -}; -X -extern struct mod_ops mod_driverops; -static struct modldrv modldrv = -{ -X &mod_driverops, /* mod_ops structure pointer */ -X DEV_BANNER_STRING, /* device banner string */ -X &aperture_ops, /* dev_ops structure pointer */ -}; -X -static struct modlinkage modlinkage = -{ -X MODREV_1, /* as indicated indicated by manual */ -X (void *)&modldrv, /* module driver structure pointer */ -X NULL, /* termination of list of linkage structures */ -}; -X -/* -X * Function: _init() -X * Purpose: Solaris DDI/DKI _init(9E) entry point -X * Author: Doug Anson -X * Calls: -X * Log: DMA -- Origional Version -X * DWH - Removed extra cmn_err() calls 2/23/94 -X * DWH - Changed debugging 2/23/94 -X */ -#if defined(__STDC__) -int _init(void) -#else -int _init() -#endif /* __STDC__ */ -{ -X register int error; -X -#if APERTURE_DEBUG >= 3 -X -X /* enterance announcement */ -X cmn_err(CE_CONT,"%s: entering _init(aperture)\n", DEV_IDENT_STRING); -X -#endif -X -X if ((error = ddi_soft_state_init(&state_head, sizeof (Mmap), 1)) != 0) -X { -X /* failed to get state structure */ -X return (error); -X } -X -X if ((error = mod_install(&modlinkage)) != 0) -X ddi_soft_state_fini(&state_head); -X -X return (error); -} -X -/* -X * Function: _info() -X * Purpose: Solaris DDI/DKI _info(9E) entry point -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - Changed debugging 2/23/94 -X */ -#if defined(__STDC__) -int _info(struct modinfo *modinfop) -#else -int _info(modinfop) -struct modinfo *modinfop; -#endif /* __STDC__ */ -{ -X -#if APERTURE_DEBUG >= 3 -X -X /* entrance announcement */ -X cmn_err(CE_CONT,"%s: entering _info(aperture)\n", DEV_IDENT_STRING); -X -#endif /* APERTURE_DEBUG >= 3 */ -X -X return (mod_info(&modlinkage, modinfop)); -} -X -/* -X * Function: _fini() -X * Purpose: Solaris DDI/DKI _fini(9E) entry point -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - Changed debugging -X */ -#if defined(__STDC__) -int _fini(void) -#else -int _fini() -#endif /* __STDC__ */ -{ -X int status; -X -#if APERTURE_DEBUG >= 3 -X -/* entrance announcement */ -cmn_err(CE_CONT,"%s: entering _fini(aperture)\n", DEV_IDENT_STRING); -X -#endif /* APERTURE_DEBUG >= 3*/ -X -X if ((status = mod_remove(&modlinkage)) != 0) -X return (status); -X -X ddi_soft_state_fini(&state_head); -X -X return (status); -} -X -/* -X * Function: aperture_getinfo() -X * Purpose: This function provides the getinfo(9E) functionality -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - Changed function name/variables/debugging 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, -X void *arg, void **result) -#else -static int aperture_getinfo(dip,infocmd,arg,result) -dev_info_t *dip; -ddi_info_cmd_t infocmd; -void *arg; -void **result; -#endif /* __STDC__ */ -{ -X register int error; -X register Mmap *aperture_p = NULL; -X -#if APERTURE_DEBUG >= 3 -X -X /* enterance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_getinfo()\n", DEV_IDENT_STRING); -X -#endif -X -X switch (infocmd) -X { -X case DDI_INFO_DEVT2DEVINFO: -X aperture_p = (Mmap *)ddi_get_soft_state(state_head, getminor((dev_t)arg)); -X if (aperture_p == NULL) -X { -X /* could not get state structure */ -X *result = NULL; -X error = DDI_FAILURE; -X } -X else -X { -X /* got state structure */ -X *result = aperture_p->dip; -X error = DDI_SUCCESS; -X } -X break; -X case DDI_INFO_DEVT2INSTANCE: -X *result = (void *)getminor((dev_t)arg); -X error = DDI_SUCCESS; -X break; -X default: -X *result = NULL; -X error = DDI_FAILURE; -X break; -X } -X return (error); -} -X -/* -X * Function: aperture_identify() -X * Purpose: This function implements the identify(9E) functionality -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - Changed function name/debugging/variables 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_identify(dev_info_t *dip) -#else -static int aperture_identify(dip) -dev_info_t *dip; -#endif /* __STDC__ */ -{ -#if APERTURE_DEBUG >= 3 -X -X /* entrance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_identify()\n", DEV_IDENT_STRING); -X -#endif -X -X /* check the driver name and respond */ -X if (strcmp(ddi_get_name(dip), APERTURE_NAME) == 0) -X return (DDI_IDENTIFIED); /* device driver is identified */ -X else -X return (DDI_NOT_IDENTIFIED); /* device driver not identified */ -} -X -/* -X * Function: aperture_probe() -X * Purpose: This function implements the probe(9E) functionality. -X * Currently this function returns a "dont care" result -X * as nothing is probed. -X * Author: Doug Anson -X * Calls: -X * Modfied: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - changed function name/variables/debugging 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_probe(dev_info_t *dip) -#else -static int aperture_probe(dip) -dev_info_t *dip; -#endif /* __STDC__ */ -{ -X -#if APERTURE_DEBUG >= 3 -X -X /* enterance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_probe()\n", DEV_IDENT_STRING); -X -#endif -X -X /* return success as we really aren't probing for anything */ -X return (DDI_PROBE_SUCCESS); -} -X -/* -X * Function: aperture_attach() -X * Purpose: This function implements the attach(9E) functionality -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - changed function name/variables/debugging 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -#else -static int aperture_attach(dip,cmd) -dev_info_t *dip; -ddi_attach_cmd_t cmd; -#endif /* __STDC__ */ -{ -X register Mmap *aperture_p = NULL; -X int buf[AP_MAX]; -X int length; -X int instance; -X -#if APERTURE_DEBUG >= 3 -X -X /* entrance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_attach()\n", DEV_IDENT_STRING); -X -#endif -X -X /* only continue if doing a DDI_ATTACH */ -X if (cmd == DDI_ATTACH) -X { -X /* get and initialize our state structure */ -X instance = ddi_get_instance(dip); -X if (ddi_soft_state_zalloc(state_head, instance) != DDI_SUCCESS) -X { -X /* could not allocate state structure */ -X return (DDI_FAILURE); -X } -X -X /* get the state structure */ -X aperture_p = (Mmap *)ddi_get_soft_state(state_head, instance); -X -X if (aperture_p == NULL) -X { -X /* failed to get the soft state */ -X return (DDI_FAILURE); -X } -X -X /* initialize the mutex driver (ATOMIC) */ -X mutex_init(&aperture_p->map_lock, "apperture mmap lock", MUTEX_DRIVER, 0); -X -X /* ENTER the critical region */ -X mutex_enter(&aperture_p->map_lock); -X -X /* get the "reg" property from the .conf file */ -X length = sizeof(buf); -X if (ddi_getlongprop_buf(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg", (caddr_t)buf, &length) != DDI_PROP_SUCCESS) -X { -X /* could not get the framebuffer properties */ -X return (DDI_FAILURE); -X } -X -X /* remember our register configuration */ -X aperture_p->regnum = (u_int)buf[AP_REGNUM]; -X aperture_p->regbase = (caddr_t)buf[AP_ADDR]; -X aperture_p->regsize = (off_t)buf[AP_SIZE]; -X -X /* initialize the mmap state info */ -X aperture_p->reglength = (off_t)AP_MEM_CHUNK; -X aperture_p->kaddr = (caddr_t)0; -X aperture_p->off = (off_t)0; -X aperture_p->mapaddr = AP_MEM_FAILURE; -X -X /* initialize internal accounting */ -X aperture_p->dip = dip; -X -X /* EXIT the critical region */ -X mutex_exit(&aperture_p->map_lock); -X -X /* create the device node */ -X /* DDI_PSEUDO, CLONE_DEV */ -X if (ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR, instance, NULL, (int)NULL) == DDI_FAILURE) -X { -X /* failed to make the device leaf or in error state */ -X mutex_destroy(&aperture_p->map_lock); -X ddi_soft_state_free(state_head, instance); -X return (DDI_FAILURE); -X } -X -X /* device driver attached successfully */ -X ddi_report_dev(aperture_p->dip); -X return (DDI_SUCCESS); -X } -X else -X { -X /* command not DDI_ATTACH -- return failure */ -X return (DDI_FAILURE); -X } -} -X -/* -X * Function: aperture_detach() -X * Purpose: This function implements the detach(9E) functionality -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - changed function name/variables/debugging 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -#else -static int aperture_detach(dip,cmd) -dev_info_t *dip; -ddi_detach_cmd_t cmd; -#endif /* __STDC__ */ -{ -X register Mmap *aperture_p = NULL; -X int instance; -X -#if APERTURE_DEBUG >= 3 -X -X /* entrance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_detach()\n", DEV_IDENT_STRING); -X -#endif -X -X /* check the parameter list */ -X if (cmd != DDI_DETACH) -X { -X return (DDI_FAILURE); -X } -X -X /* get the instance info and state structure */ -X instance = ddi_get_instance(dip); -X aperture_p = (Mmap *)ddi_get_soft_state(state_head, instance); -X if (aperture_p == NULL) -X { -X /* failed to get the soft state */ -X return (DDI_FAILURE); -X } -X -X /* clean up the driver */ -X mutex_destroy(&aperture_p->map_lock); -X ddi_remove_minor_node(dip, NULL); -X ddi_soft_state_free(state_head, instance); -X -X /* device driver detached successfully */ -X return (DDI_SUCCESS); -} -X -/* -X * Function: aperture_open() -X * Purpose: This function is called in response to the open(2) system call -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - Changed function name/variables/debugging -X */ -#if defined(__STDC__) -static int aperture_open(dev_t *dev, int openflags, int otyp, cred_t *credp) -#else -static int aperture_open(dev, openflags, otyp, credp) -dev_t *dev; -int openflags; -int otyp; -cred_t *credp; -#endif /* __STDC__ */ -{ -X register Mmap *aperture_p = NULL; -X -#if APERTURE_DEBUG >= 3 -X -X /* entrance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_open()\n", DEV_IDENT_STRING); -X -#endif -X -X /* get the state structure */ -X aperture_p = (Mmap *)ddi_get_soft_state(state_head, getminor(*dev)); -X if (aperture_p == NULL) -X { -X /* failed to get the soft state */ -X return (ENXIO); -X } -X -X /* check the parameter list for correctness */ -X if (otyp != OTYP_CHR) -X { -X /* invalid parameter list */ -X return (EINVAL); -X } -X -X return (0); -} -X -/* -X * Function: aperture_close() -X * Purpose: This function is called after the last process that has -X * the device open calls close(2) -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - changed function name/variables/debugging 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_close(dev_t dev, int closeflags, int otyp, cred_t *credp) -#else -static int aperture_close(dev, closeflags, otyp, credp) -dev_t dev; -int closeflags; -int otyp; -cred_t *credp; -#endif /* __STDC__ */ -{ -X register Mmap *aperture_p = NULL; -X -#if APERTURE_DEBUG >= 3 -X -X /* enterance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_close()\n", DEV_IDENT_STRING); -X -#endif -X -X /* get the state structure */ -X aperture_p = (Mmap *)ddi_get_soft_state(state_head, getminor(dev)); -X if (aperture_p == NULL) -X { -X /* failed to get the soft state */ -X return (ENXIO); -X } -X -X /* check the paramter list for correctness */ -X if (otyp != OTYP_CHR) -X { -X /* invalid parameter */ -X return (EINVAL); -X } -X -X /* do nothing but return successful */ -X return (0); -} -X -/* -X * Function: aperture_mmap() -X * Purpose: This function gets called when the user process tries to mmap -X * the framebuffer device using mmap(2). -X * Author: Doug Anson -X * Calls: -X * Modified: David Holland (davidh@use.com) -X * Log: DMA -- Origional Version -X * DWH - changed function name/variables/debugging 2/23/94 -X */ -#if defined(__STDC__) -static int aperture_mmap(dev_t dev, off_t off, int prot) -#else -static int aperture_mmap(dev, off, prot) -dev_t dev; -off_t off; -int prot; -#endif /* __STDC__ */ -{ -X register Mmap *aperture_p = NULL; -X -#if APERTURE_DEBUG >= 3 -X -X /* enterance announcement */ -X cmn_err(CE_CONT,"%s: entering aperture_mmap()\n", DEV_IDENT_STRING); -X -#endif -X -X /* get the state structure */ -X aperture_p = (Mmap *)ddi_get_soft_state(state_head, getminor(dev)); -X if (aperture_p == NULL) -X { -X /* failed to get the soft state */ -X return (AP_MEM_FAILURE); -X } -X -X /* check that we dont mmap out of bounds */ -X if (off > aperture_p->regsize) -X { -X /* offset is out of range for register length */ -X return (AP_MEM_FAILURE); -X } -X -X /* check that READ/WRITE only priv only */ -X if (!((prot & PROT_READ) || (prot & PROT_WRITE))) -X { -X /* invalid prot parameter in mmap(2) call */ -X return (AP_MEM_FAILURE); -X } -X -X /* ENTER the critical region */ -X mutex_enter(&aperture_p->map_lock); -X -X /* map the registers CRITICAL REGION ASSIGNMENT */ -X -X aperture_p->off = off; -X if (ddi_map_regs(aperture_p->dip, aperture_p->regnum, (caddr_t *)&(aperture_p->kaddr), -X aperture_p->off, aperture_p->reglength) == DDI_FAILURE) -X { -X -#if APERTURE_DEBUG >= 2 -X -X /* report error */ -X cmn_err(CE_CONT, "%s: ERROR: mmap failed (map regs). kaddr=0x%x off=0x%x\n", -X DEV_IDENT_STRING,aperture_p->kaddr,aperture_p->off); -X -#endif -X -X aperture_p->mapaddr = (off_t)AP_MEM_FAILURE; -X } -X else -X { -X /* fill in our state structure CRITICAL REGION ASSIGNMENT */ -X aperture_p->mapaddr = (off_t)hat_getkpfnum((caddr_t)aperture_p->kaddr); -X if ((u_int)aperture_p->mapaddr == (u_int)AP_MEM_FAILURE) -X { -X -#if APERTURE_DEBUG >= 2 -X -X /* report error */ -X cmn_err(CE_CONT, "%s: ERROR: mmap failed (kpf). kaddr=0x%x off=0x%x\n", -X DEV_IDENT_STRING,aperture_p->kaddr,aperture_p->off); -#endif -X -X } -X -X /* now unmap the region CRITICAL REGION ASSIGNMENT */ -X -X ddi_unmap_regs(aperture_p->dip, aperture_p->regnum, (caddr_t *)&(aperture_p->kaddr), -X aperture_p->off, aperture_p->reglength); -X -#if APERTURE_DEBUG >= 2 -X /* report register mmaping status */ -X if (aperture_p->mapaddr != AP_MEM_FAILURE) -X { -X /* mmap successful */ -X cmn_err(CE_CONT,"%s: mmap [off=0x%x,length=0x%x) successful\n", -X DEV_IDENT_STRING,aperture_p->off,aperture_p->regsize); -X -X cmn_err(CE_CONT,"%s: configuration:\n",DEV_IDENT_STRING); -X cmn_err(CE_CONT," REG(%d): regbase=0x%x regsize=0x%x\n", -X aperture_p->regnum, aperture_p->regbase, aperture_p->regsize); -X -X cmn_err(CE_CONT," kaddr=0x%x mmap off=0x%x mmap addr=0x%x\n", -X aperture_p->kaddr, aperture_p->off, aperture_p->mapaddr); -X } -X else -X { -X /* error in mmap routine */ -X cmn_err(CE_CONT,"%s: mmap not established due to errors", DEV_IDENT_STRING); -X } -#endif -X -X } -X -X /* EXIT the critical region */ -X mutex_exit(&aperture_p->map_lock); -X -X /* return the page frame number (PFN) */ -X -#if APERTURE_DEBUG >= 3 -X -X /* report exit - determining where the long delay is... */ -X cmn_err(CE_CONT, "%s: _mmap routine exiting\n", DEV_IDENT_STRING); -X -#endif -X -X return ((int)(aperture_p->mapaddr)); -} -SHAR_EOF -chmod 0644 aperture/aperture.c || -echo 'restore of aperture/aperture.c failed' -Wc_c="`wc -c < 'aperture/aperture.c'`" -test 20528 -eq "$Wc_c" || - echo 'aperture/aperture.c: original size 20528, current size' "$Wc_c" -fi -# ============= aperture/aperture.conf ============== -if test -f 'aperture/aperture.conf' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/aperture.conf (File already exists)' -else -echo 'x - extracting aperture/aperture.conf (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.conf' && -# -# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com -# -# File: aperture.conf -# Author: Doug Anson (danson@lgc.com) -# -# Modified: David Holland (davidh@use.com) -# Log: Change comments 2/23/94 -# Log: Change defaults/comments 9/25/94 -# -# Purpose: This conf file is used by the aperture Framebuffer aperture -# driver. Do NOT! change the first two numbers of of -# the 'reg' property. They should be 0, and 0x0, -# respectivly. -# -name="aperture" class="sysbus" reg=0,0x0,0x7fffffff; -SHAR_EOF -chmod 0644 aperture/aperture.conf || -echo 'restore of aperture/aperture.conf failed' -Wc_c="`wc -c < 'aperture/aperture.conf'`" -test 518 -eq "$Wc_c" || - echo 'aperture/aperture.conf: original size 518, current size' "$Wc_c" -fi -# ============= aperture/aptest.c ============== -if test -f 'aperture/aptest.c' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/aptest.c (File already exists)' -else -echo 'x - extracting aperture/aptest.c (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/aptest.c' && -/* -X * Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com -X * -X * Author: Doug Anson (danson@lgc.com) -X * Date : 2/21/94 -X * Modifed: David Holland (davidh@use.com) -X * Log: -X * DWH - Changed names/added comments 2/23/94 -X * DWH - Removed annoying delays. 2/23/94 -X * -X * This program test the fb aperture driver by 'cheating' -X * it uses the aperture driver to access/read the main -X * system BIOS header -X * -X * Copyright notice: -X * Permission to use, copy, modify, distribute, and sell this software and its -X * documentation for any purpose is hereby granted without fee, provided that -X * the above copyright notice appear in all copies and that both that -X * copyright notice and this permission notice appear in supporting -X * documentation, and that the name of Doug Anson, and David Holland be used in -X * advertising or publicity pertaining to distribution of the software -X * Doug Anson, and David Holland make no * representations about the -X * suitability of this software for any purpose. -X * It is provided "as is" without express or implied warranty. -X * -X * Disclaimer: -X * DOUG ANSON, AND DAVID HOLLAND DISCLAIMS ALL WARRIENTS WITH REGARD TO THIS -X * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS, -X * IN NO EVENT SHALL DOUG ANSON, OR DAVID HOLLAND BE LIABLE FOR ANY SPECIAL, -X * INDIRECT, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM -X * USAGE OF THIS SOFTWARE. -X */ -X -/* -X * linear framebuffer aperture driver test program -X */ -X -/* -X * $Id -X */ -X -X -#include <stdio.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -X -#if !defined(sun) -extern void exit(int); -extern caddr_t mmap(); -extern int close(); -extern int munmap(); -#endif -X -/* framebuffer access defines */ -#define AP_DEV "/dev/fbs/aperture" /* framebuffer apperture device */ -#define PADDR 0xf0000 /* offset from fbmem base */ -#define BUF_LENGTH 0x1000 /* length in bytes -- ignored */ -X -/* debug testing defines */ -#define START_INDEX 0 /* display starting index(>=0)*/ -#define STOP_INDEX 80 /* display stopping index */ -#define INCR 1 /* display increment */ -X -/* main program */ -int main(int argc,char **argv) -{ -X caddr_t addr = (caddr_t)0; -X int fb_dev; -X long start = START_INDEX; -X long stop = STOP_INDEX; -X int i; -X -X /* open the framebuffer device */ -X fb_dev = open (AP_DEV,O_RDWR); -X if (fb_dev < 0) -X { -X /* failed to open framebuffer driver */ -X printf("ERROR: failed to open %s\n",AP_DEV); -X perror("ERROR: open()"); -X exit(1); -X } -X -X /* memory map the framebuffer */ -X addr = (caddr_t)mmap((caddr_t)0,BUF_LENGTH,PROT_READ|PROT_WRITE,MAP_SHARED, -X fb_dev,(off_t)PADDR); -X if (addr == (caddr_t)-1) -X { -X /* failed to memory map framebuffer driver */ -X printf("ERROR: failed to mmap [0x%x ,size=%d bytes)\n", -X PADDR,BUF_LENGTH); -X perror("ERROR: mmap()"); -X close(fb_dev); -X exit(1); -X } -X else -X { -X /* frame buffer mapped */ -X close(fb_dev); -X printf("NOTICE: BIOS mapped [0x%x ,size=%d) to addr=0x%x...\n", -X PADDR,BUF_LENGTH,(int)addr); -X -X /* display the buffer */ -X for(i=start;i<stop;i=i+INCR) -X printf("%c",addr[i]); -X /* printf("addr[%d]=%c\n",i,addr[i]); -X */ -X printf("\nDONE displaying memory contents (%d bytes)\n",stop); -X -X /* unmap and close */ -X printf("UNMAPPING [0x%x ,size=%d) to addr=0x%x... and closing...", -X PADDR,BUF_LENGTH,(int)addr); -X munmap(addr,BUF_LENGTH); -X printf("DONE.\n"); -X printf("Exiting successful...\n"); -X exit(0); -X } -X return 1; -} -SHAR_EOF -chmod 0644 aperture/aptest.c || -echo 'restore of aperture/aptest.c failed' -Wc_c="`wc -c < 'aperture/aptest.c'`" -test 3530 -eq "$Wc_c" || - echo 'aperture/aptest.c: original size 3530, current size' "$Wc_c" -fi -# ============= aperture/DISCLAIMER ============== -if test -f 'aperture/DISCLAIMER' -a X"$1" != X"-c"; then - echo 'x - skipping aperture/DISCLAIMER (File already exists)' -else -echo 'x - extracting aperture/DISCLAIMER (Text)' -sed 's/^X//' << 'SHAR_EOF' > 'aperture/DISCLAIMER' && -/* -X * Copyright 1994 Doug Anson (danson@lgc.com) & David Holland (davidh@use.com) -X * -X * This code is based largely upon the sample device drivers provided -X * by Sun Microsystems Inc. -X * -X * Original copyright notice: -X * @(#)mmap.c 1.3 copyright 93/06/03 Sun Microsystems, Inc. -X * -X * Our copyright notice: -X * Permission to use, copy, modify, distribute, and sell this software and its -X * documentation for any purpose is hereby granted without fee, provided that -X * the above copyright notice appear in all copies and that both that -X * copyright notice and this permission notice appear in supporting -X * documentation, and that the name of Doug Anson, and David Holland be used in -X * advertising or publicity pertaining to distribution of the software -X * Doug Anson, and David Holland make no * representations about the -X * suitability of this software for any purpose. -X * It is provided "as is" without express or implied warranty. -X * -X * Original disclamer from Sun Microsystems, Inc.: -X * This is a package of sample device drivers for Solaris 2.x (SunOS -X * 5.x). You may use, modify and distribute these drivers and/or binaries -X * derived from them. However please note that: -X * -X * These examples are provided with no warranties of any kind, including -X * without limitation accuracy and usefulness, and Sun expressly disclaims -X * all implied warranties of merchantability, fitness for a particular -X * purpose and non-infringement. In no event shall Sun be liable for any -X * damages, including without limitation, direct, special, indirect, or -X * consequential damages arising out of, or relating to, use of these -X * examples by customer or any third party. Sun is under no obligation to -X * provide support to customer for this software. -X * -X * Our disclaimer: -X * DOUG ANSON, AND DAVID HOLLAND DISCLAIMS ALL WARRIENTS WITH REGARD TO THIS -X * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS, -X * IN NO EVENT SHALL DOUG ANSON, OR DAVID HOLLAND BE LIABLE FOR ANY SPECIAL, -X * INDIRECT, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM -X * USAGE OF THIS SOFTWARE. -X */ -X -/* -X * linear framebuffer aperture driver -X * -X * $Id -X */ -SHAR_EOF -chmod 0644 aperture/DISCLAIMER || -echo 'restore of aperture/DISCLAIMER failed' -Wc_c="`wc -c < 'aperture/DISCLAIMER'`" -test 2174 -eq "$Wc_c" || - echo 'aperture/DISCLAIMER: original size 2174, current size' "$Wc_c" -fi -exit 0 Index: xc/programs/Xserver/hw/xfree86/etc/extramodes diff -u xc/programs/Xserver/hw/xfree86/etc/extramodes:1.4 xc/programs/Xserver/hw/xfree86/etc/extramodes:1.6 --- xc/programs/Xserver/hw/xfree86/etc/extramodes:1.4 Wed Nov 14 17:56:48 2001 +++ xc/programs/Xserver/hw/xfree86/etc/extramodes Sun Nov 10 23:21:46 2002 @@ -1,12 +1,15 @@ // // Extra modes to include as default modes in the X server. // -// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.4 2001/11/14 22:56:48 dawes Exp $ +// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.6 2002/11/11 04:21:46 dawes Exp $ // # 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync +# 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz +ModeLine "1152x768" 64.995 1152 1178 1314 1472 768 771 777 806 +hsync +vsync + # 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync @@ -15,4 +18,16 @@ # 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz Modeline "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync + +# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz +Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync + +# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz +Modeline "2048x1536" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync + +# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz +Modeline "2048x1536" 340.48 2048 2216 2440 2832 1536 1537 1540 1603 -hsync +vsync + +# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz +Modeline "2048x1536" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync Index: xc/programs/Xserver/hw/xfree86/etc/extrapci.ids diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/extrapci.ids:1.7 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/extrapci.ids Wed Feb 5 23:18:09 2003 @@ -0,0 +1,45 @@ +# +# Modifications and additions to the standard list of PCI IDs in +# pci.ids. +# +# To modify an entry, simply add the modified version here. +# To leave part of an entry unchanged, use '"' for the name +# (e.g., leave the vendor name unchanged while adding/modifying +# a device). To delete an entry, set the name to '-'. +# +# One syntax extension is allowing a 16-bit class value to be +# specified for a device (see the syntax description below). +# +# Don't make gratuitous changes, and please send back +# changes/additions that aren't XFree86-specific to the pciids +# project (http://pciids.sf.net/). +# +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/extrapci.ids,v 1.7 2003/02/06 04:18:09 dawes Exp $ +# + +# Vendors, devices and subsystems. Please keep sorted. + +# Syntax: +# vendor vendor_name +# device device_name <-- single tab +# C class <-- two tabs +# subvendor subdevice subsystem_name <-- two tabs +# +# Use lower-case hex digits for all numeric values. + +# Example: Add a new chipset for vendor who's ID is xyzw +# +# xyzw " +# 20ce New Chipset Description + +1102 " + 0002 " + C 0401 + +# Intel(R) 852GM/855GM, 865G +8086 " + 3580 852GM/852GME/855GM/855GME Chipset Host-Hub Bridge + 3582 852GM/852GME/855GM/855GME Chipset Graphics Controller + 2570 865G Chipset Host-Hub Bridge + 2572 865G Chipset Graphics Controller + Index: xc/programs/Xserver/hw/xfree86/etc/gtf.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/gtf.c:1.3 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/gtf.c Fri Dec 20 21:35:20 2002 @@ -0,0 +1,743 @@ +/* gtf.c Generate mode timings using the GTF Timing Standard + * + * gcc gtf.c -o gtf -lm -Wall + * + * Copyright (c) 2001, Andy Ritger aritger@nvidia.com + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * o Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * o Neither the name of NVIDIA nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * + * + * This program is based on the Generalized Timing Formula(GTF TM) + * Standard Version: 1.0, Revision: 1.0 + * + * The GTF Document contains the following Copyright information: + * + * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards + * Association. Duplication of this document within VESA member + * companies for review purposes is permitted. All other rights + * reserved. + * + * While every precaution has been taken in the preparation + * of this standard, the Video Electronics Standards Association and + * its contributors assume no responsibility for errors or omissions, + * and make no warranties, expressed or implied, of functionality + * of suitability for any purpose. The sample code contained within + * this standard may be used without restriction. + * + * + * + * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive) + * implementation of the GTF Timing Standard, is available at: + * + * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls + * + * + * + * This program takes a desired resolution and vertical refresh rate, + * and computes mode timings according to the GTF Timing Standard. + * These mode timings can then be formatted as an XFree86 modeline + * or a mode description for use by fbset(8). + * + * + * + * NOTES: + * + * The GTF allows for computation of "margins" (the visible border + * surrounding the addressable video); on most non-overscan type + * systems, the margin period is zero. I've implemented the margin + * computations but not enabled it because 1) I don't really have + * any experience with this, and 2) neither XFree86 modelines nor + * fbset fb.modes provide an obvious way for margin timings to be + * included in their mode descriptions (needs more investigation). + * + * The GTF provides for computation of interlaced mode timings; + * I've implemented the computations but not enabled them, yet. + * I should probably enable and test this at some point. + * + * + * + * TODO: + * + * o Add support for interlaced modes. + * + * o Implement the other portions of the GTF: compute mode timings + * given either the desired pixel clock or the desired horizontal + * frequency. + * + * o It would be nice if this were more general purpose to do things + * outside the scope of the GTF: like generate double scan mode + * timings, for example. + * + * o Printing digits to the right of the decimal point when the + * digits are 0 annoys me. + * + * o Error checking. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/gtf.c,v 1.3 2002/12/21 02:35:20 dawes Exp $ */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + + +#if defined(__Lynx__) +#define rint(x) floor(x) +#endif + +#define MARGIN_PERCENT 1.8 /* % of active vertical image */ +#define CELL_GRAN 8.0 /* assumed character cell granularity */ +#define MIN_PORCH 1 /* minimum front porch */ +#define V_SYNC_RQD 3 /* width of vsync in lines */ +#define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */ +#define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */ +#define M 600.0 /* blanking formula gradient */ +#define C 40.0 /* blanking formula offset */ +#define K 128.0 /* blanking formula scaling factor */ +#define J 20.0 /* blanking formula scaling factor */ + +/* C' and M' are part of the Blanking Duty Cycle computation */ + +#define C_PRIME (((C - J) * K/256.0) + J) +#define M_PRIME (K/256.0 * M) + + +/* struct definitions */ + +typedef struct __mode +{ + int hr, hss, hse, hfl; + int vr, vss, vse, vfl; + float pclk, h_freq, v_freq; +} mode; + + +typedef struct __options +{ + int x, y; + int xf86mode, fbmode; + float v_freq; +} options; + + + + +/* prototypes */ + +void print_value(int n, char *name, float val); +void print_xf86_mode (mode *m); +void print_fb_mode (mode *m); +mode *vert_refresh (int h_pixels, int v_lines, float freq, + int interlaced, int margins); +options *parse_command_line (int argc, char *argv[]); + + + + +/* + * print_value() - print the result of the named computation; this is + * useful when comparing against the GTF EXCEL spreadsheet. + */ + +int global_verbose = 0; + +void print_value(int n, char *name, float val) +{ + if (global_verbose) { + printf("%2d: %-27s: %15f\n", n, name, val); + } +} + + + +/* print_xf86_mode() - print the XFree86 modeline, given mode timings. */ + +void print_xf86_mode (mode *m) +{ + printf ("\n"); + printf (" # %dx%d @ %.2f Hz (GTF) hsync: %.2f kHz; pclk: %.2f MHz\n", + m->hr, m->vr, m->v_freq, m->h_freq, m->pclk); + + printf (" Modeline \"%dx%d_%.2f\" %.2f" + " %d %d %d %d" + " %d %d %d %d" + " -HSync +Vsync\n\n", + m->hr, m->vr, m->v_freq, m->pclk, + m->hr, m->hss, m->hse, m->hfl, + m->vr, m->vss, m->vse, m->vfl); + +} + + + +/* + * print_fb_mode() - print a mode description in fbset(8) format; + * see the fb.modes(8) manpage. The timing description used in + * this is rather odd; they use "left and right margin" to refer + * to the portion of the hblank before and after the sync pulse + * by conceptually wrapping the portion of the blank after the pulse + * to infront of the visible region; ie: + * + * + * Timing description I'm accustomed to: + * + * + * + * <--------1--------> <--2--> <--3--> <--4--> + * _________ + * |-------------------|_______| |_______ + * + * R SS SE FL + * + * 1: visible image + * 2: blank before sync (aka front porch) + * 3: sync pulse + * 4: blank after sync (aka back porch) + * R: Resolution + * SS: Sync Start + * SE: Sync End + * FL: Frame Length + * + * + * But the fb.modes format is: + * + * + * <--4--> <--------1--------> <--2--> <--3--> + * _________ + * _______|-------------------|_______| | + * + * The fb.modes(8) manpage refers to <4> and <2> as the left and + * right "margin" (as well as upper and lower margin in the vertical + * direction) -- note that this has nothing to do with the term + * "margin" used in the GTF Timing Standard. + * + * XXX always prints the 32 bit mode -- should I provide a command + * line option to specify the bpp? It's simple enough for a user + * to edit the mode description after it's generated. + */ + +void print_fb_mode (mode *m) +{ + printf ("\n"); + printf ("mode \"%dx%d %.2fHz 32bit (GTF)\"\n", + m->hr, m->vr, m->v_freq); + printf (" # PCLK: %.2f MHz, H: %.2f kHz, V: %.2f Hz\n", + m->pclk, m->h_freq, m->v_freq); + printf (" geometry %d %d %d %d 32\n", + m->hr, m->vr, m->hr, m->vr); + printf (" timings %d %d %d %d %d %d %d\n", + (int) rint(1000000.0/m->pclk),/* pixclock in picoseconds */ + m->hfl - m->hse, /* left margin (in pixels) */ + m->hss - m->hr, /* right margin (in pixels) */ + m->vfl - m->vse, /* upper margin (in pixel lines) */ + m->vss - m->vr, /* lower margin (in pixel lines) */ + m->hse - m->hss, /* horizontal sync length (pixels) */ + m->vse - m->vss); /* vert sync length (pixel lines) */ + printf (" hsync low\n"); + printf (" vsync high\n"); + printf ("endmode\n\n"); + +} + + + + +/* + * vert_refresh() - as defined by the GTF Timing Standard, compute the + * Stage 1 Parameters using the vertical refresh frequency. In other + * words: input a desired resolution and desired refresh rate, and + * output the GTF mode timings. + * + * XXX All the code is in place to compute interlaced modes, but I don't + * feel like testing it right now. + * + * XXX margin computations are implemented but not tested (nor used by + * XFree86 of fbset mode descriptions, from what I can tell). + */ + +mode *vert_refresh (int h_pixels, int v_lines, float freq, + int interlaced, int margins) +{ + float h_pixels_rnd; + float v_lines_rnd; + float v_field_rate_rqd; + float top_margin; + float bottom_margin; + float interlace; + float h_period_est; + float vsync_plus_bp; + float v_back_porch; + float total_v_lines; + float v_field_rate_est; + float h_period; + float v_field_rate; + float v_frame_rate; + float left_margin; + float right_margin; + float total_active_pixels; + float ideal_duty_cycle; + float h_blank; + float total_pixels; + float pixel_freq; + float h_freq; + + float h_sync; + float h_front_porch; + float v_odd_front_porch_lines; + + mode *m = (mode*) malloc (sizeof (mode)); + + + /* 1. In order to give correct results, the number of horizontal + * pixels requested is first processed to ensure that it is divisible + * by the character size, by rounding it to the nearest character + * cell boundary: + * + * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND]) + */ + + h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN; + + print_value(1, "[H PIXELS RND]", h_pixels_rnd); + + + /* 2. If interlace is requested, the number of vertical lines assumed + * by the calculation must be halved, as the computation calculates + * the number of vertical lines per field. In either case, the + * number of lines is rounded to the nearest integer. + * + * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0), + * ROUND([V LINES],0)) + */ + + v_lines_rnd = interlaced ? + rint((float) v_lines) / 2.0 : + rint((float) v_lines); + + print_value(2, "[V LINES RND]", v_lines_rnd); + + + /* 3. Find the frame rate required: + * + * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2, + * [I/P FREQ RQD]) + */ + + v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq); + + print_value(3, "[V FIELD RATE RQD]", v_field_rate_rqd); + + + /* 4. Find number of lines in Top margin: + * + * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y", + * ROUND(([MARGIN%]/100*[V LINES RND]),0), + * 0) + */ + + top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0); + + print_value(4, "[TOP MARGIN (LINES)]", top_margin); + + + /* 5. Find number of lines in Bottom margin: + * + * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y", + * ROUND(([MARGIN%]/100*[V LINES RND]),0), + * 0) + */ + + bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0); + + print_value(5, "[BOT MARGIN (LINES)]", bottom_margin); + + + /* 6. If interlace is required, then set variable [INTERLACE]=0.5: + * + * [INTERLACE]=(IF([INT RQD?]="y",0.5,0)) + */ + + interlace = interlaced ? 0.5 : 0.0; + + print_value(6, "[INTERLACE]", interlace); + + + /* 7. Estimate the Horizontal period + * + * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) / + * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) + + * [MIN PORCH RND]+[INTERLACE]) * 1000000 + */ + + h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0)) + / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace) + * 1000000.0); + + print_value(7, "[H PERIOD EST]", h_period_est); + + + /* 8. Find the number of lines in V sync + back porch: + * + * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0) + */ + + vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est); + + print_value(8, "[V SYNC+BP]", vsync_plus_bp); + + + /* 9. Find the number of lines in V back porch alone: + * + * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND] + * + * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]? + */ + + v_back_porch = vsync_plus_bp - V_SYNC_RQD; + + print_value(9, "[V BACK PORCH]", v_back_porch); + + + /* 10. Find the total number of lines in Vertical field period: + * + * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] + + * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] + + * [MIN PORCH RND] + */ + + total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp + + interlace + MIN_PORCH; + + print_value(10, "[TOTAL V LINES]", total_v_lines); + + + /* 11. Estimate the Vertical field frequency: + * + * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000 + */ + + v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0; + + print_value(11, "[V FIELD RATE EST]", v_field_rate_est); + + + /* 12. Find the actual horizontal period: + * + * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST]) + */ + + h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est); + + print_value(12, "[H PERIOD]", h_period); + + + /* 13. Find the actual Vertical field frequency: + * + * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000 + */ + + v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0; + + print_value(13, "[V FIELD RATE]", v_field_rate); + + + /* 14. Find the Vertical frame frequency: + * + * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE])) + */ + + v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate; + + print_value(14, "[V FRAME RATE]", v_frame_rate); + + + /* 15. Find number of pixels in left margin: + * + * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", + * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / + * [CELL GRAN RND]),0)) * [CELL GRAN RND], + * 0)) + */ + + left_margin = margins ? + rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : + 0.0; + + print_value(15, "[LEFT MARGIN (PIXELS)]", left_margin); + + + /* 16. Find number of pixels in right margin: + * + * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", + * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / + * [CELL GRAN RND]),0)) * [CELL GRAN RND], + * 0)) + */ + + right_margin = margins ? + rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : + 0.0; + + print_value(16, "[RIGHT MARGIN (PIXELS)]", right_margin); + + + /* 17. Find total number of active pixels in image and left and right + * margins: + * + * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] + + * [RIGHT MARGIN (PIXELS)] + */ + + total_active_pixels = h_pixels_rnd + left_margin + right_margin; + + print_value(17, "[TOTAL ACTIVE PIXELS]", total_active_pixels); + + + /* 18. Find the ideal blanking duty cycle from the blanking duty cycle + * equation: + * + * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000) + */ + + ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0); + + print_value(18, "[IDEAL DUTY CYCLE]", ideal_duty_cycle); + + + /* 19. Find the number of pixels in the blanking time to the nearest + * double character cell: + * + * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] * + * [IDEAL DUTY CYCLE] / + * (100-[IDEAL DUTY CYCLE]) / + * (2*[CELL GRAN RND])), 0)) + * * (2*[CELL GRAN RND]) + */ + + h_blank = rint(total_active_pixels * + ideal_duty_cycle / + (100.0 - ideal_duty_cycle) / + (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN); + + print_value(19, "[H BLANK (PIXELS)]", h_blank); + + + /* 20. Find total number of pixels: + * + * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)] + */ + + total_pixels = total_active_pixels + h_blank; + + print_value(20, "[TOTAL PIXELS]", total_pixels); + + + /* 21. Find pixel clock frequency: + * + * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD] + */ + + pixel_freq = total_pixels / h_period; + + print_value(21, "[PIXEL FREQ]", pixel_freq); + + + /* 22. Find horizontal frequency: + * + * [H FREQ] = 1000 / [H PERIOD] + */ + + h_freq = 1000.0 / h_period; + + print_value(22, "[H FREQ]", h_freq); + + + + /* Stage 1 computations are now complete; I should really pass + the results to another function and do the Stage 2 + computations, but I only need a few more values so I'll just + append the computations here for now */ + + + + /* 17. Find the number of pixels in the horizontal sync period: + * + * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] / + * [CELL GRAN RND]),0))*[CELL GRAN RND] + */ + + h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN; + + print_value(17, "[H SYNC (PIXELS)]", h_sync); + + + /* 18. Find the number of pixels in the horizontal front porch period: + * + * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)] + */ + + h_front_porch = (h_blank / 2.0) - h_sync; + + print_value(18, "[H FRONT PORCH (PIXELS)]", h_front_porch); + + + /* 36. Find the number of lines in the odd front porch period: + * + * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE]) + */ + + v_odd_front_porch_lines = MIN_PORCH + interlace; + + print_value(36, "[V ODD FRONT PORCH(LINES)]", v_odd_front_porch_lines); + + + /* finally, pack the results in the mode struct */ + + m->hr = (int) (h_pixels_rnd); + m->hss = (int) (h_pixels_rnd + h_front_porch); + m->hse = (int) (h_pixels_rnd + h_front_porch + h_sync); + m->hfl = (int) (total_pixels); + + m->vr = (int) (v_lines_rnd); + m->vss = (int) (v_lines_rnd + v_odd_front_porch_lines); + m->vse = (int) (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD); + m->vfl = (int) (total_v_lines); + + m->pclk = pixel_freq; + m->h_freq = h_freq; + m->v_freq = freq; + + return (m); + +} + + + + +/* + * parse_command_line() - parse the command line and return an + * alloced structure containing the results. On error print usage + * and return NULL. + */ + +options *parse_command_line (int argc, char *argv[]) +{ + int n; + + options *o = (options *) calloc (1, sizeof (options)); + + if (argc < 4) goto bad_option; + + o->x = atoi (argv[1]); + o->y = atoi (argv[2]); + o->v_freq = atof (argv[3]); + + /* XXX should check for errors in the above */ + + n = 4; + + while (n < argc) { + if ((strcmp (argv[n], "-v") == 0) || + (strcmp (argv[n], "--verbose") == 0)) { + global_verbose = 1; + } else if ((strcmp (argv[n], "-f") == 0) || + (strcmp (argv[n], "--fbmode") == 0)) { + o->fbmode = 1; + } else if ((strcmp (argv[n], "-x") == 0) || + (strcmp (argv[n], "--xf86mode") == 0)) { + o->xf86mode = 1; + } else { + goto bad_option; + } + + n++; + } + + /* if neither xf86mode nor fbmode were requested, default to + xf86mode */ + + if (!o->fbmode && !o->xf86mode) o->xf86mode = 1; + + return (o); + + bad_option: + + fprintf (stderr, "\n"); + fprintf (stderr, "usage: %s x y refresh [-v|--verbose] " + "[-f|--fbmode] [-x|-xf86mode]\n", argv[0]); + + fprintf (stderr, "\n"); + + fprintf (stderr, " x : the desired horizontal " + "resolution (required)\n"); + fprintf (stderr, " y : the desired vertical " + "resolution (required)\n"); + fprintf (stderr, " refresh : the desired refresh " + "rate (required)\n"); + fprintf (stderr, " -v|--verbose : enable verbose printouts " + "(traces each step of the computation)\n"); + fprintf (stderr, " -f|--fbmode : output an fbset(8)-style mode " + "description\n"); + fprintf (stderr, " -x|-xf86mode : output an XFree86-style mode " + "description (this is the default\n" + " if no mode description is requested)\n"); + + fprintf (stderr, "\n"); + + free (o); + return (NULL); + +} + + + +int main (int argc, char *argv[]) +{ + mode *m; + options *o; + + o = parse_command_line (argc, argv); + if (!o) exit (1); + + m = vert_refresh (o->x, o->y, o->v_freq, 0, 0); + if (!m) exit (1); + + if (o->xf86mode) + print_xf86_mode(m); + + if (o->fbmode) + print_fb_mode(m); + + return 0; + +} Index: xc/programs/Xserver/hw/xfree86/etc/gtf.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/gtf.man:1.1 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/gtf.man Mon Nov 11 20:31:23 2002 @@ -0,0 +1,45 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/gtf.man,v 1.1 2002/11/12 01:31:23 dawes Exp $ +.TH GTF 1 __vendorversion__ +.SH NAME +gtf - calculate VESA GTF mode lines +.SH SYNOPSIS +.B gtf +.I h-resolution +.I v-resolution +.I refresh +.RB [ \-v | \-\-verbose ] +.RB [ \-f | \-\-fbmode ] +.RB [ \-x | \-\-xf86mode ] +.SH DESCRIPTION +.I Gtf +is a utility for calculating VESA GTF modes. Given the desired +horizontal and vertical resolutions and refresh rate (in Hz), the parameters +for a matching VESA GTF mode are printed out. Two output formats are +supported: mode lines suitable for the XFree86 +.B XF86Config(__filemansuffix__) +file, and mode parameters suitable for the Linux +.B fbset(8) +utility. + +.SH OPTIONS +.TP 8 +.BR \-v | \-\-verbose +Enable verbose printouts This shows a trace for each step of the +computation. +.TP 8 +.BR \-x | \-\-xf86mode +Print the mode parameters as XFree86-style mode lines. This is the +default format. +.TP 8 +.BR \-f | \-\-fbset +Print the mode parameters in a format suitable for +.BR fbset(8) . +.SH "SEE ALSO" +XF86Config(__filemansuffix__) +.SH AUTHOR +Andy Ritger. +.PP +This program is based on the Generalized Timing Formula (GTF(TM)) Standard +Version: 1.0, Revsion: 1.0. The GTF Excel(TM) spreadsheet, a sample +(and the definitive) implementation of the GTF Timing Standard is +available at <ftp://ftp.vesa.org/pub/GTF/VTF_V1R1.xls>. Index: xc/programs/Xserver/hw/xfree86/etc/ioport.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/ioport.c:1.4 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/ioport.c Wed Jan 1 14:16:41 2003 @@ -0,0 +1,493 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/ioport.c,v 1.4 2003/01/01 19:16:41 tsi Exp $ */ +/* + * Copyright 2002 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "compiler.h" +#include "xf86_OSproc.h" + +#include <errno.h> + +static char *MyName; +static int Port = -1, Index = -1; +static unsigned int Value; + +static void +inb_usage +( +#ifdef __STDC__ + void +#endif +) +{ + fprintf(stderr, "inb [-i <index>] <port>\n"); +} + +static void +inw_usage +( +#ifdef __STDC__ + void +#endif +) +{ + fprintf(stderr, "inw [-i <index>] <port>\n"); +} + +static void +inl_usage +( +#ifdef __STDC__ + void +#endif +) +{ + fprintf(stderr, "inl [-i <index>] <port>\n"); +} + + +static void +outb_usage +( +#ifdef __STDC__ + void +#endif +) +{ + fprintf(stderr, "outb [-i <index>] <port> <value>\n"); +} + +static void +outw_usage +( +#ifdef __STDC__ + void +#endif +) +{ + fprintf(stderr, "outw [-i <index>] <port> <value>\n"); +} + +static void +outl_usage +( +#ifdef __STDC__ + void +#endif +) +{ + fprintf(stderr, "outl [-i <index>] <port> <value>\n"); +} + +static int +#ifdef __STDC__ +parse_number +( + const char *String, + void (* Usage)(void), + unsigned int Maximum) +#else +parse_number(String, Usage, Maximum) + const char *String; + void (* Usage)(); + unsigned int Maximum; +#endif +{ + char *BadString = (char *)0; + unsigned int Number = strtoul(String, &BadString, 0); + if ((Number > Maximum) || errno || + (BadString && *BadString)) + { + (*Usage)(); + exit(1); + } + + return (Number); +} + +static void +#ifdef __STDC__ +input_parse +( + int argc, + char **argv, + void (* Usage)(void)) +#else +input_parse(argc, argv, Usage) + int argc; + char **argv; + void (* Usage)(); +#endif +{ + if ((argc < 2) || (argc > 4)) + { + (*Usage)(); + exit(1); + } + + for(; (++argv, --argc); ) + { + if ((Index < 0) && + (argv[0][0] == '-') && + (argv[0][1] == 'i')) + { + if ((++argv[0], *(++argv[0])) || (++argv, --argc)) + Index = parse_number(argv[0], Usage, 0xFFU); + else + { + (*Usage)(); + exit(1); + } + } + else if (Port < 0) + { + Port = parse_number(argv[0], Usage, 0xFFFFU); + } + else + { + (*Usage)(); + exit(1); + } + } +} + +static void +#ifdef __STDC__ +output_parse +( + int argc, + char **argv, + void (* Usage)(void), + unsigned int Maximum +) +#else +output_parse(argc, argv, Usage, Maximum) + int argc; + char **argv; + void (* Usage)(); + unsigned int Maximum; +#endif +{ + char ValueSpecified = 0; + + if ((argc < 3) || (argc > 5)) + { + (*Usage)(); + exit(1); + } + + for (; (++argv, --argc); ) + { + if ((Index < 0) && + (argv[0][0] == '-') && + (argv[0][1] == 'i')) + { + if ((++argv[0], *(++argv[0])) || (++argv, --argc)) + Index = parse_number(argv[0], Usage, 0xFFU); + else + { + (*Usage)(); + exit(1); + } + } + else if (Port < 0) + { + Port = parse_number(argv[0], Usage, 0xFFFFU); + } + else if (!ValueSpecified) + { + Value = parse_number(argv[0], Usage, Maximum); + ValueSpecified = 1; + } + else + { + (*Usage)(); + exit(1); + } + } + + if (!ValueSpecified) + { + (*Usage)(); + exit(1); + } +} + +static void +#ifdef __STDC__ +do_inb +( + int argc, + char **argv +) +#else +do_inb(argc, argv) + int argc; + char **argv; +#endif +{ + input_parse(argc, argv, inb_usage); + + xf86EnableIO(); + + if (Index >= 0) + { + if (Port == 0x03C0U) + { /* Attribute Controller is different */ + unsigned short gens1; + + gens1 = ((inb(0x03CCU) & 0x01U) << 5) + 0x03BA; + (void) inb(gens1); + Index = (Index & 0x1FU) | 0x20U; + } + outb(Port, Index); + Port++; + } + Value = inb(Port); + + xf86DisableIO(); + + printf("0x%02X\n", Value); +} + +static void +#ifdef __STDC__ +do_inw +( + int argc, + char **argv +) +#else +do_inw(argc, argv) + int argc; + char **argv; +#endif +{ + input_parse(argc, argv, inw_usage); + + xf86EnableIO(); + + if (Index >= 0) + { + outb(Port, Index); + Port++; + } + Value = inw(Port); + + xf86DisableIO(); + + printf("0x%04X\n", Value); +} + +static void +#ifdef __STDC__ +do_inl +( + int argc, + char **argv +) +#else +do_inl(argc, argv) + int argc; + char **argv; +#endif +{ + input_parse(argc, argv, inl_usage); + + xf86EnableIO(); + + if (Index >= 0) + { + outb(Port, Index); + Port++; + } + Value = inl(Port); + + xf86DisableIO(); + + printf("0x%08X\n", Value); +} + +static void +#ifdef __STDC__ +do_outb +( + int argc, + char **argv +) +#else +do_outb(argc, argv) + int argc; + char **argv; +#endif +{ + output_parse(argc, argv, outb_usage, 0xFFU); + + xf86EnableIO(); + + if (Index >= 0) + { + if (Port == 0x03C0U) + { /* Attribute controller is different */ + unsigned short gens1; + + gens1 = ((inb(0x03CCU) & 0x01U) << 5) + 0x03BA; + (void) inb(gens1); + outb(0x03C0U, (Index & 0x1FU) | 0x20U); + } + else + { + outb(Port, Index); + Port++; + } + } + outb(Port, Value); + + xf86DisableIO(); + +} + +static void +#ifdef __STDC__ +do_outw +( + int argc, + char **argv +) +#else +do_outw(argc, argv) + int argc; + char **argv; +#endif +{ + output_parse(argc, argv, outw_usage, 0xFFFFU); + + xf86EnableIO(); + + if (Index >= 0) + { + outb(Port, Index); + Port++; + } + outw(Port, Value); + + xf86DisableIO(); + +} + +static void +#ifdef __STDC__ +do_outl +( + int argc, + char **argv +) +#else +do_outl(argc, argv) + int argc; + char **argv; +#endif +{ + output_parse(argc, argv, outl_usage, 0xFFFFFFFFU); + + xf86EnableIO(); + + if (Index >= 0) + { + outb(Port, Index); + Port++; + } + outl(Port, Value); + + xf86DisableIO(); + +} + +static void +usage +( +#ifdef __STDC__ + void +#endif +) +{ + inb_usage(); + inw_usage(); + inl_usage(); + outb_usage(); + outw_usage(); + outl_usage(); + exit(1); +} + +int +#ifdef __STDC__ +main +( + int argc, + char **argv +) +#else +main(argc, argv) + int argc; + char **argv; +#endif +{ + struct + { + char *Name; +#ifdef __STDC__ + void (* Function)(int, char **); +#else + void (* Function)(); +#endif + } + *Function_Entry, Function_Table[] = + { + {"inb", do_inb}, + {"inw", do_inw}, + {"inl", do_inl}, + {"outb", do_outb}, + {"outw", do_outw}, + {"outl", do_outl}, +#ifdef __STDC__ + {(char *)0, (void (*)(int, char **))usage} +#else + {(char *)0, usage} +#endif + }; + + /* Get name by which we were invoked */ + for (MyName = argv[0]; argv[0][0]; ) + if (*(argv[0]++) == '/') + MyName = argv[0]; + + /* Look up name in table and call corresponding function */ + for (Function_Entry = Function_Table; + Function_Entry->Name && + strcmp(MyName, Function_Entry->Name); + Function_Entry++); + (*Function_Entry->Function)(argc, argv); + + return (0); +} + +#include "xf86getpagesize.c" Index: xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar diff -u xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar:3.2 xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar:3.3 --- xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar:3.2 Mon Dec 23 01:47:16 1996 +++ xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar Tue Oct 8 19:07:43 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar,v 3.2 1996/12/23 06:47:16 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar,v 3.3 2002/10/08 23:07:43 dawes Exp $ # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". @@ -534,10 +534,6 @@ X Under ISC you can check the output of the tstmap, e.g. with: X X # hd -s 0xF0000 /dev/mem | more -X -X Another option to do this is: -X -X # tail +983040c /dev/mem | more X X 6. Run the mmapstat utility hereafter, which should give following output: Index: xc/programs/Xserver/hw/xfree86/etc/mmapr.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/mmapr.c:1.6 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/mmapr.c Wed Jan 1 14:16:41 2003 @@ -0,0 +1,236 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/mmapr.c,v 1.6 2003/01/01 19:16:41 tsi Exp $ */ +/* + * Copyright 2002 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#undef __STRICT_ANSI__ +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#ifndef MAP_FAILED +# define MAP_FAILED ((void *)(-1)) +#endif + +#if defined(_SCO_DS) && !defined(_SCO_DS_LL) +#define strtoull (unsigned long long)strtoul +#endif + +#if !defined(strtoull) && \ + (defined(CSRG_BASED) || \ + (defined(__GNU_LIBRARY__) && \ + (__GNU_LIBRARY__ < 6))) +# define strtoull strtouq +#endif + +static unsigned char datab; +static unsigned short dataw; +static unsigned int datal; +static unsigned long dataL; +static unsigned long long dataq; + +static void +usage(void) +{ + fprintf(stderr, "\n" + "mmapr [-{bwlqL}] <file> <offset> <length>\n\n" + "endianness flags:\n\n" + " -b output one byte at a time\n" + " -w output up to two aligned bytes at a time\n" + " -l output up to four aligned bytes at a time (default)\n" + " -q output up to eight aligned bytes at a time\n"); + switch (sizeof(dataL)) + { + case sizeof(datab): + fprintf(stderr, " -L same as -b\n\n"); + break; + + case sizeof(dataw): + fprintf(stderr, " -L same as -w\n\n"); + break; + + case sizeof(datal): + fprintf(stderr, " -L same as -l\n\n"); + break; + + case sizeof(dataq): + fprintf(stderr, " -L same as -q\n\n"); + break; + + default: + fprintf(stderr, "\n"); + break; + } + + exit(1); +} + +int +main(int argc, char **argv) +{ + off_t Offset = 0, offset; + size_t Length = 0, length; + char *BadString; + void *buffer; + int fd, pagesize; + char size = sizeof(datal); + + switch (argc) + { + case 4: + break; + + case 5: + if (argv[1][0] != '-') + usage(); + + switch (argv[1][1]) + { + case 'b': + size = sizeof(datab); + break; + + case 'w': + size = sizeof(dataw); + break; + + case 'l': + size = sizeof(datal); + break; + + case 'L': + size = sizeof(dataL); + break; + + case 'q': + size = sizeof(dataq); + break; + + default: + usage(); + } + + if (argv[1][2]) + usage(); + + argc--; + argv++; + break; + + default: + usage(); + } + + BadString = (char *)0; + Offset = strtoull(argv[2], &BadString, 0); + if (errno || (BadString && *BadString)) + usage(); + + BadString = (char *)0; + Length = strtoul(argv[3], &BadString, 0); + if (errno || (BadString && *BadString)) + usage(); + + if (Length <= 0) + return 0; + + if ((fd = open(argv[1], O_RDONLY)) < 0) + { + fprintf(stderr, "mmapr: Unable to open \"%s\": %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + pagesize = getpagesize(); + offset = Offset & (off_t)(-pagesize); + length = ((Offset + Length + pagesize - 1) & (off_t)(-pagesize)) - offset; + buffer = mmap((caddr_t)0, length, PROT_READ, MAP_SHARED, fd, offset); + close(fd); + if (buffer == MAP_FAILED) + { + fprintf(stderr, "mmapr: Unable to mmap \"%s\": %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + Offset -= offset; + while (Length > 0) + { + if ((Offset & sizeof(datab)) || + (Length < sizeof(dataw)) || + (size < sizeof(dataw))) + { + datab = *(volatile unsigned char *)((char *)buffer + Offset); + fwrite((void *)&datab, sizeof(datab), 1, stdout); + Offset += sizeof(datab); + Length -= sizeof(datab); + } + else + if ((Offset & sizeof(dataw)) || + (Length < sizeof(datal)) || + (size < sizeof(datal))) + { + dataw = *(volatile unsigned short *)((char *)buffer + Offset); + fwrite((void *)&dataw, sizeof(dataw), 1, stdout); + Offset += sizeof(dataw); + Length -= sizeof(dataw); + } + else + if ((Offset & sizeof(datal)) || + (Length < sizeof(dataL)) || + (size < sizeof(dataL))) + { + datal = *(volatile unsigned int *)((char *)buffer + Offset); + fwrite((void *)&datal, sizeof(datal), 1, stdout); + Offset += sizeof(datal); + Length -= sizeof(datal); + } + else + if ((Offset & sizeof(dataL)) || + (Length < sizeof(dataq)) || + (size < sizeof(dataq))) + { + dataL = *(volatile unsigned long *)((char *)buffer + Offset); + fwrite((void *)&dataL, sizeof(dataL), 1, stdout); + Offset += sizeof(dataL); + Length -= sizeof(dataL); + } + else + { + dataq = *(volatile unsigned long long *)((char *)buffer + Offset); + fwrite((void *)&dataq, sizeof(dataq), 1, stdout); + Offset += sizeof(dataq); + Length -= sizeof(dataq); + } + } + + munmap(buffer, length); + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/etc/mmapw.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/mmapw.c:1.3 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/mmapw.c Wed Jan 1 14:16:42 2003 @@ -0,0 +1,200 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/mmapw.c,v 1.3 2003/01/01 19:16:42 tsi Exp $ */ +/* + * Copyright 2002 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#undef __STRICT_ANSI__ +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#ifndef MAP_FAILED +# define MAP_FAILED ((void *)(-1)) +#endif + +#if defined(_SCO_DS) && !defined(_SCO_DS_LL) +#define strtoull (unsigned long long)strtoul +#endif + +#if !defined(strtoull) && \ + (defined(CSRG_BASED) || \ + (defined(__GNU_LIBRARY__) && \ + (__GNU_LIBRARY__ < 6))) +# define strtoull strtouq +#endif + +static unsigned char datab; +static unsigned short dataw; +static unsigned int datal; +static unsigned long dataL; +static unsigned long long dataq; + +static void +usage(void) +{ + fprintf(stderr, "\n" + "mmapw [-{bwlqL}] <file> <offset> <value>\n\n" + "endianness flags:\n\n" + " -b write one byte\n" + " -w write two aligned bytes\n" + " -l write four aligned bytes (default)\n" + " -q write eight aligned bytes\n"); + switch (sizeof(dataL)) + { + case sizeof(datab): + fprintf(stderr, " -L same as -b\n\n"); + break; + + case sizeof(dataw): + fprintf(stderr, " -L same as -w\n\n"); + break; + + case sizeof(datal): + fprintf(stderr, " -L same as -l\n\n"); + break; + + case sizeof(dataq): + fprintf(stderr, " -L same as -q\n\n"); + break; + + default: + fprintf(stderr, "\n"); + break; + } + + exit(1); +} + +int +main(int argc, char **argv) +{ + unsigned long long data; + off_t Offset = 0, offset; + size_t Length = 0, length; + char *BadString; + void *buffer; + int fd, pagesize; + char size = sizeof(datal); + + switch (argc) + { + case 4: + break; + + case 5: + if (argv[1][0] != '-') + usage(); + + switch (argv[1][1]) + { + case 'b': + size = sizeof(datab); + break; + + case 'w': + size = sizeof(dataw); + break; + + case 'l': + size = sizeof(datal); + break; + + case 'L': + size = sizeof(dataL); + break; + + case 'q': + size = sizeof(dataq); + break; + + default: + usage(); + } + + if (argv[1][2]) + usage(); + + argc--; + argv++; + break; + + default: + usage(); + } + + BadString = (char *)0; + Offset = strtoull(argv[2], &BadString, 0); + if (errno || (BadString && *BadString) || (Offset & (size - 1))) + usage(); + + BadString = (char *)0; + data = strtoull(argv[3], &BadString, 0); + if (errno || (BadString && *BadString)) + usage(); + + if ((fd = open(argv[1], O_RDWR)) < 0) + { + fprintf(stderr, "mmapr: Unable to open \"%s\": %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + pagesize = getpagesize(); + offset = Offset & (off_t)(-pagesize); + length = ((Offset + Length + pagesize - 1) & (off_t)(-pagesize)) - offset; + buffer = mmap((caddr_t)0, length, PROT_WRITE, MAP_SHARED, fd, offset); + close(fd); + if (buffer == MAP_FAILED) + { + fprintf(stderr, "mmapr: Unable to mmap \"%s\": %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + Offset -= offset; + if (size == sizeof(datab)) + *(volatile unsigned char *)((char *)buffer + Offset) = + (unsigned char)data; + else if (size == sizeof(dataw)) + *(volatile unsigned short *)((char *)buffer + Offset) = + (unsigned short)data; + else if (size == sizeof(datal)) + *(volatile unsigned int *)((char *)buffer + Offset) = + (unsigned int)data; + else if (size == sizeof(dataL)) + *(volatile unsigned long *)((char *)buffer + Offset) = + (unsigned long)data; + else if (size == sizeof(dataq)) + *(volatile unsigned long long *)((char *)buffer + Offset) = + (unsigned long long)data; + + munmap(buffer, length); + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/etc/pci.ids diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/pci.ids:1.5 --- /dev/null Thu Feb 27 12:31:49 2003 +++ xc/programs/Xserver/hw/xfree86/etc/pci.ids Wed Feb 26 05:07:11 2003 @@ -0,0 +1,7299 @@ +# +# List of PCI ID's +# +# Maintained by Martin Mares <mj@ucw.cz> and other volunteers from the +# Linux PCI ID's Project at http://pciids.sf.net/. New data are always +# welcome (if they are accurate), we're eagerly expecting new entries, +# so if you have anything to contribute, please visit the home page or +# send a diff -u against the most recent pci.ids to pci-ids@ucw.cz. +# +# Daily snapshot on Tue 2003-02-25 11:00:06 +# + +# Vendors, devices and subsystems. Please keep sorted. + +# Syntax: +# vendor vendor_name +# device device_name <-- single tab +# subvendor subdevice subsystem_name <-- two tabs + +0000 Gammagraphx, Inc. +001a Ascend Communications, Inc. +0033 Paradyne corp. +003d Lockheed Martin-Marietta Corp +# Real TJN ID is e159, but they got it wrong several times --mj +0059 Tiger Jet Network Inc. (Wrong ID) +0070 Hauppauge computer works Inc. +0100 Ncipher Corp Ltd +0675 Dynalink + 1700 IS64PH ISDN Adapter + 1702 IS64PH ISDN Adapter +# Wrong ID used in subsystem ID of VIA USB controllers. +0925 VIA Technologies, Inc. (Wrong ID) +09c1 Arris + 0704 CM 200E Cable Modem +0a89 BREA Technologies Inc +0e11 Compaq Computer Corporation + 0001 PCI to EISA Bridge + 0002 PCI to ISA Bridge + 0049 NC7132 Gigabit Upgrade Module + 004a NC6136 Gigabit Server Adapter + 0508 Netelligent 4/16 Token Ring + 1000 Triflex/Pentium Bridge, Model 1000 + 2000 Triflex/Pentium Bridge, Model 2000 + 3032 QVision 1280/p + 3033 QVision 1280/p + 3034 QVision 1280/p + 4000 4000 [Triflex] + 6010 HotPlug PCI Bridge 6010 + 7020 USB Controller + a0ec Fibre Channel Host Controller + a0f0 Advanced System Management Controller + a0f3 Triflex PCI to ISA Bridge + a0f7 PCI Hotplug Controller + 8086 002a PCI Hotplug Controller A + 8086 002b PCI Hotplug Controller B + a0f8 ZFMicro Chipset USB + a0fc Fibre Channel Host Controller + ae10 Smart-2/P RAID Controller + 0e11 4030 Smart-2/P Array Controller + 0e11 4031 Smart-2SL Array Controller + 0e11 4032 Smart Array Controller + 0e11 4033 Smart 3100ES Array Controller + ae29 MIS-L + ae2a MPC + ae2b MIS-E + ae31 System Management Controller + ae32 Netelligent 10/100 + ae33 Triflex Dual EIDE Controller + ae34 Netelligent 10 + ae35 Integrated NetFlex-3/P + ae40 Netelligent 10/100 Dual + ae43 ProLiant Integrated Netelligent 10/100 + ae69 CETUS-L + ae6c Northstar + ae6d NorthStar CPU to PCI Bridge + b011 Integrated Netelligent 10/100 + b012 Netelligent 10 T/2 + b01e NC3120 Fast Ethernet NIC + b01f NC3122 Fast Ethernet NIC + b02f NC1120 Ethernet NIC + b030 Netelligent WS 5100 + b04a 10/100 TX PCI Intel WOL UTP Controller + b060 Smart Array 5300 Controller + b0c6 NC3161 Fast Ethernet NIC + b0c7 NC3160 Fast Ethernet NIC + b0d7 NC3121 Fast Ethernet NIC + b0dd NC3131 Fast Ethernet NIC + b0de NC3132 Fast Ethernet Module + b0df NC6132 Gigabit Module + b0e0 NC6133 Gigabit Module + b0e1 NC3133 Fast Ethernet Module + b123 NC6134 Gigabit NIC + b134 NC3163 Fast Ethernet NIC + b13c NC3162 Fast Ethernet NIC + b144 NC3123 Fast Ethernet NIC + b163 NC3134 Fast Ethernet NIC + b164 NC3165 Fast Ethernet Upgrade Module + b178 Smart Array 5i/532 + b1a4 NC7131 Gigabit Server Adapter + f130 NetFlex-3/P ThunderLAN 1.0 + f150 NetFlex-3/P ThunderLAN 2.3 +0e55 HaSoTec GmbH +# Formerly NCR +1000 LSI Logic / Symbios Logic + 0001 53c810 + 1000 1000 8100S + 0002 53c820 + 0003 53c825 + 0004 53c815 + 0005 53c810AP + 0006 53c860 + 000a 53c1510 + 000b 53c896 + 000c 53c895 + 1de1 3907 DC-390U2W + 000d 53c885 + 000f 53c875 + 0e11 7004 Embedded Ultra Wide SCSI Controller + 1092 8760 FirePort 40 Dual SCSI Controller + 1de1 3904 DC390F Ultra Wide SCSI Controller + 0010 53c895 + 0e11 4040 Integrated Array Controller + 0e11 4048 Integrated Array Controller + 0012 53c895a + 0013 53c875a + 0020 53c1010 Ultra3 SCSI Adapter + 1de1 1020 DC-390U3W + 0021 53c1010 66MHz Ultra3 SCSI Adapter + 0030 53c1030 + 1028 1010 LSI U320 SCSI Controller + 0040 53c1035 + 008f 53c875J + 1092 8000 FirePort 40 SCSI Controller + 1092 8760 FirePort 40 Dual SCSI Host Adapter + 0621 FC909 + 0622 FC929 + 0623 FC929 LAN + 0624 FC919 + 0625 FC919 LAN + 0626 FC929X + 0627 FC929X LAN + 0628 FC919X + 0629 FC919X LAN + 0701 83C885 NT50 DigitalScape Fast Ethernet + 0702 Yellowfin G-NIC gigabit ethernet + 1318 0000 PEI100X + 0901 61C102 + 1000 63C815 + 1960 PowerEdge Expandable RAID Controller 4 + 1028 0518 PowerEdge Expandable RAID Controller 4/DC + 1028 0520 PowerEdge Expandable RAID Controller 4/SC + 1028 0531 PowerEdge Expandable RAID Controller 4/QC +1001 Kolter Electronic + 0010 PCI 1616 Measurement card with 32 digital I/O lines + 0011 OPTO-PCI Opto-Isolated digital I/O board + 0012 PCI-AD/DA Analogue I/O board + 0013 PCI-OPTO-RELAIS Digital I/O board with relay outputs + 0014 PCI-Counter/Timer Counter Timer board + 0015 PCI-DAC416 Analogue output board + 0016 PCI-MFB Analogue I/O board + 0017 PROTO-3 PCI Prototyping board + 9100 INI-9100/9100W SCSI Host +1002 ATI Technologies Inc +# New support forthcoming in XFree86 4.3.0 + 4144 Radeon R300 AD [Radeon 9500 Pro] +# New support forthcoming in XFree86 4.3.0 + 4145 Radeon R300 AE [Radeon 9500 Pro] +# New support forthcoming in XFree86 4.3.0 + 4146 Radeon R300 AF [Radeon 9500 Pro] +# Update: Oops, AF was a typo above for 4147, should be AG + 4147 Radeon R300 AG [FireGL Z1/X1] + 4158 68800AX [Mach32] + 4242 Radeon R200 BB [Radeon All in Wonder 8500DV] + 1002 02aa Radeon 8500 AIW DV Edition + 4336 Radeon Mobility U1 + 4337 Radeon IGP 340M + 4354 215CT [Mach64 CT] + 4358 210888CX [Mach64 CX] + 4554 210888ET [Mach64 ET] + 4654 Mach64 VT + 4742 3D Rage Pro AGP 1X/2X + 1002 0040 Rage Pro Turbo AGP 2X + 1002 0044 Rage Pro Turbo AGP 2X + 1002 0061 Rage Pro AIW AGP 2X + 1002 0062 Rage Pro AIW AGP 2X + 1002 0063 Rage Pro AIW AGP 2X + 1002 0080 Rage Pro Turbo AGP 2X + 1002 0084 Rage Pro Turbo AGP 2X + 1002 4742 Rage Pro Turbo AGP 2X + 1002 8001 Rage Pro Turbo AGP 2X + 1028 0082 Rage Pro Turbo AGP 2X + 1028 4082 Optiplex GX1 Onboard Display Adapter + 1028 8082 Rage Pro Turbo AGP 2X + 1028 c082 Rage Pro Turbo AGP 2X + 8086 4152 Xpert 98D AGP 2X + 8086 464a Rage Pro Turbo AGP 2X + 4744 3D Rage Pro AGP 1X + 1002 4744 Rage Pro Turbo AGP + 4747 3D Rage Pro + 4749 3D Rage Pro + 1002 0061 Rage Pro AIW + 1002 0062 Rage Pro AIW + 474c Rage XC + 474d Rage XL AGP 2X + 1002 0004 Xpert 98 RXL AGP 2X + 1002 0008 Xpert 98 RXL AGP 2X + 1002 0080 Rage XL AGP 2X + 1002 0084 Xpert 98 AGP 2X + 1002 474d Rage XL AGP + 1033 806a Rage XL AGP + 474e Rage XC AGP + 1002 474e Rage XC AGP + 474f Rage XL + 1002 0008 Rage XL + 1002 474f Rage XL + 4750 3D Rage Pro 215GP + 1002 0040 Rage Pro Turbo + 1002 0044 Rage Pro Turbo + 1002 0080 Rage Pro Turbo + 1002 0084 Rage Pro Turbo + 1002 4750 Rage Pro Turbo + 4751 3D Rage Pro 215GQ + 4752 Rage XL + 1002 0008 Rage XL + 1002 4752 Rage XL + 1002 8008 Rage XL + 1028 00d1 PowerEdge 2550 + 4753 Rage XC + 1002 4753 Rage XC + 4754 3D Rage I/II 215GT [Mach64 GT] + 4755 3D Rage II+ 215GTB [Mach64 GTB] + 4756 3D Rage IIC 215IIC [Mach64 GT IIC] + 1002 4756 Rage IIC + 4757 3D Rage IIC AGP + 1002 4757 Rage IIC AGP + 1028 0089 Rage 3D IIC + 1028 4082 Rage 3D IIC + 1028 8082 Rage 3D IIC + 1028 c082 Rage 3D IIC + 4758 210888GX [Mach64 GX] + 4759 3D Rage IIC + 475a 3D Rage IIC AGP + 1002 0087 Rage 3D IIC + 1002 475a Rage IIC AGP + 4964 Radeon R250 Id [Radeon 9000] + 4965 Radeon R250 Ie [Radeon 9000] + 4966 Radeon R250 If [Radeon 9000] + 10f1 0002 R250 If [Tachyon G9000 PRO] + 148c 2039 R250 If [Radeon 9000 Pro "Evil Commando"] + 1509 9a00 R250 If [Radeon 9000 "AT009"] +# New subdevice - 3D Prophet 9000 PCI by Hercules. AGP version probably would have same ID, so not specified. + 1681 0040 R250 If [3D prophet 9000] + 174b 7176 R250 If [Sapphire Radeon 9000 Pro] + 174b 7192 R250 If [Radeon 9000 "Atlantis"] + 17af 2005 R250 If [Excalibur Radeon 9000 Pro] + 17af 2006 R250 If [Excalibur Radeon 9000] + 4967 Radeon R250 Ig [Radeon 9000] + 496e Radeon R250 [Radeon 9000] (Secondary) + 4c42 3D Rage LT Pro AGP-133 + 0e11 b0e8 Rage 3D LT Pro + 0e11 b10e 3D Rage LT Pro (Compaq Armada 1750) + 1002 0040 Rage LT Pro AGP 2X + 1002 0044 Rage LT Pro AGP 2X + 1002 4c42 Rage LT Pro AGP 2X + 1002 8001 Rage LT Pro AGP 2X + 1028 0085 Rage 3D LT Pro + 4c44 3D Rage LT Pro AGP-66 + 4c45 Rage Mobility M3 AGP + 4c46 Rage Mobility M3 AGP 2x + 4c47 3D Rage LT-G 215LG + 4c49 3D Rage LT Pro + 1002 0004 Rage LT Pro + 1002 0040 Rage LT Pro + 1002 0044 Rage LT Pro + 1002 4c49 Rage LT Pro + 4c4d Rage Mobility P/M AGP 2x + 0e11 b111 Armada M700 + 1002 0084 Xpert 98 AGP 2X (Mobility) + 1014 0154 ThinkPad A20m + 4c4e Rage Mobility L AGP 2x + 4c50 3D Rage LT Pro + 1002 4c50 Rage LT Pro + 4c51 3D Rage LT Pro + 4c52 Rage Mobility P/M + 4c53 Rage Mobility L + 4c54 264LT [Mach64 LT] + 4c57 Radeon Mobility M7 LW [Radeon Mobility 7500] + 1014 0517 ThinkPad T30 + 1028 00e6 Radeon Mobility M7 LW (Dell Inspiron 8100) + 144d c006 Radeon Mobility M7 LW in vpr Matrix 170B4 +# Update: More correct labelling for this FireGL chipset + 4c58 Radeon RV200 LX [Mobility FireGL 7800 M7] + 4c59 Radeon Mobility M6 LY + 1014 0235 ThinkPad A30p (2653-64G) + 1014 0239 ThinkPad X22/X23/X24 + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 4c5a Radeon Mobility M6 LZ +# Update: Add M9 to product name + 4c64 Radeon R250 Ld [Radeon Mobility 9000 M9] +# Update: Add M9 to product name + 4c65 Radeon R250 Le [Radeon Mobility 9000 M9] +# Update: Add M9 to product name + 4c66 Radeon R250 Lf [Radeon Mobility 9000 M9] +# Update: Add M9 to product name + 4c67 Radeon R250 Lg [Radeon Mobility 9000 M9] + 4d46 Rage Mobility M4 AGP + 4d4c Rage Mobility M4 AGP + 4e44 Radeon R300 ND [Radeon 9700] + 4e45 Radeon R300 NE [Radeon 9700] + 4e46 Radeon R300 NF [Radeon 9700] +# Update: This is FireGL X1, not Radeon 9700 + 4e47 Radeon R300 NG [FireGL X1] +# Update + 4e64 Radeon R300 [Radeon 9700 Pro] (Secondary) + 4e65 Radeon R300 [Radeon 9700] (Secondary) + 4e66 Radeon R300 [Radeon 9700] (Secondary) + 4e67 Radeon R300 [FireGL X1] (Secondary) + 5041 Rage 128 PA/PRO + 5042 Rage 128 PB/PRO AGP 2x + 5043 Rage 128 PC/PRO AGP 4x + 5044 Rage 128 PD/PRO TMDS + 1002 0028 Rage 128 AIW + 1002 0029 Rage 128 AIW + 5045 Rage 128 PE/PRO AGP 2x TMDS + 5046 Rage 128 PF/PRO AGP 4x TMDS + 1002 0004 Rage Fury Pro + 1002 0008 Rage Fury Pro/Xpert 2000 Pro + 1002 0014 Rage Fury Pro + 1002 0018 Rage Fury Pro/Xpert 2000 Pro + 1002 0028 Rage 128 Pro AIW AGP + 1002 002a Rage 128 Pro AIW AGP + 1002 0048 Rage Fury Pro + 1002 2000 Rage Fury MAXX AGP 4x (TMDS) (VGA device) + 1002 2001 Rage Fury MAXX AGP 4x (TMDS) (Extra device?!) + 5047 Rage 128 PG/PRO + 5048 Rage 128 PH/PRO AGP 2x + 5049 Rage 128 PI/PRO AGP 4x + 504a Rage 128 PJ/PRO TMDS + 504b Rage 128 PK/PRO AGP 2x TMDS + 504c Rage 128 PL/PRO AGP 4x TMDS + 504d Rage 128 PM/PRO + 504e Rage 128 PN/PRO AGP 2x + 504f Rage 128 PO/PRO AGP 4x + 5050 Rage 128 PP/PRO TMDS [Xpert 128] + 1002 0008 Xpert 128 + 5051 Rage 128 PQ/PRO AGP 2x TMDS + 5052 Rage 128 PR/PRO AGP 4x TMDS + 5053 Rage 128 PS/PRO + 5054 Rage 128 PT/PRO AGP 2x + 5055 Rage 128 PU/PRO AGP 4x + 5056 Rage 128 PV/PRO TMDS + 5057 Rage 128 PW/PRO AGP 2x TMDS + 5058 Rage 128 PX/PRO AGP 4x TMDS +# Update: This same chip is used in all 32Mb and 64Mb SDR/DDR orig Radeons, and is now known as 7200 + 5144 Radeon R100 QD [Radeon 7200] + 1002 0008 Radeon 7000/Radeon VE + 1002 0009 Radeon 7000/Radeon + 1002 000a Radeon 7000/Radeon + 1002 001a Radeon 7000/Radeon + 1002 0029 Radeon AIW + 1002 0038 Radeon 7000/Radeon + 1002 0039 Radeon 7000/Radeon + 1002 008a Radeon 7000/Radeon + 1002 00ba Radeon 7000/Radeon + 1002 0139 Radeon 7000/Radeon + 1002 028a Radeon 7000/Radeon + 1002 02aa Radeon AIW + 1002 053a Radeon 7000/Radeon + 5145 Radeon R100 QE + 5146 Radeon R100 QF + 5147 Radeon R100 QG + 5148 Radeon R200 QH [Radeon 8500] + 1002 010a FireGL 8800 64Mb + 1002 0152 FireGL 8800 128Mb + 1002 0162 FireGL 8700 32Mb + 1002 0172 FireGL 8700 64Mb + 5149 Radeon R200 QI + 514a Radeon R200 QJ + 514b Radeon R200 QK + 514c Radeon R200 QL [Radeon 8500 LE] + 1002 003a Radeon R200 QL [Radeon 8500 LE] + 1002 013a Radeon 8500 + 148c 2026 R200 QL [Radeon 8500 Evil Master II Multi Display Edition] + 174b 7149 Radeon R200 QL [Sapphire Radeon 8500 LE] +# New: Radeon 9100 is basically a Radeon 8500LE branded as 9100 by Sapphire + 514d Radeon R200 QM [Radeon 9100] +# New: Radeon 8500LE chip + 514e Radeon R200 QN [Radeon 8500LE] +# New: Radeon 8500LE chip + 514f Radeon R200 QO [Radeon 8500LE] + 5157 Radeon RV200 QW [Radeon 7500] + 1002 013a Radeon 7500 + 1458 4000 RV200 QW [RADEON 7500 PRO MAYA AR] + 148c 2024 RV200 QW [Radeon 7500LE Dual Display] + 148c 2025 RV200 QW [Radeon 7500 Evil Master Multi Display Edition] + 148c 2036 RV200 QW [Radeon 7500 PCI Dual Display] + 174b 7147 RV200 QW [Sapphire Radeon 7500LE] + 174b 7161 Radeon RV200 QW [Radeon 7500 LE] + 17af 0202 RV200 QW [Excalibur Radeon 7500LE] + 5158 Radeon RV200 QX [Radeon 7500] +# Update: More correct name + 5159 Radeon RV100 QY [Radeon 7000/VE] + 1002 000a Radeon 7000/Radeon VE + 1002 000b Radeon 7000 + 1002 0038 Radeon 7000/Radeon VE + 1002 003a Radeon 7000/Radeon VE + 1002 00ba Radeon 7000/Radeon VE + 1002 013a Radeon 7000/Radeon VE + 1458 4002 RV100 QY [RADEON 7000 PRO MAYA AV Series] + 148c 2003 RV100 QY [Radeon 7000 Multi-Display Edition] + 148c 2023 RV100 QY [Radeon 7000 Evil Master Multi-Display] + 174b 7112 RV100 QY [Sapphire Radeon VE 7000] + 1787 0202 RV100 QY [Excalibur Radeon 7000] +# Update: More correct name + 515a Radeon RV100 QZ [Radeon 7000/VE] + 5168 Radeon R200 Qh + 5169 Radeon R200 Qi + 516a Radeon R200 Qj + 516b Radeon R200 Qk +# new: This one is not in ATI documentation, but is in XFree86 source code + 516c Radeon R200 Ql + 5245 Rage 128 RE/SG + 1002 0008 Xpert 128 + 1002 0028 Rage 128 AIW + 1002 0029 Rage 128 AIW + 1002 0068 Rage 128 AIW + 5246 Rage 128 RF/SG AGP + 1002 0004 Magnum/Xpert 128/Xpert 99 + 1002 0008 Magnum/Xpert128/X99/Xpert2000 + 1002 0028 Rage 128 AIW AGP + 1002 0044 Rage Fury/Xpert 128/Xpert 2000 + 1002 0068 Rage 128 AIW AGP + 1002 0448 Rage Fury + 5247 Rage 128 RG + 524b Rage 128 RK/VR + 524c Rage 128 RL/VR AGP + 1002 0008 Xpert 99/Xpert 2000 + 1002 0088 Xpert 99 + 5345 Rage 128 SE/4x + 5346 Rage 128 SF/4x AGP 2x + 5347 Rage 128 SG/4x AGP 4x + 5348 Rage 128 SH + 534b Rage 128 SK/4x + 534c Rage 128 SL/4x AGP 2x + 534d Rage 128 SM/4x AGP 4x + 1002 0008 Xpert 99/Xpert 2000 + 1002 0018 Xpert 2000 + 534e Rage 128 4x + 5354 Mach 64 VT + 1002 5654 Mach 64 reference + 5446 Rage 128 Pro Ultra TF + 1002 0004 Rage Fury Pro + 1002 0008 Rage Fury Pro/Xpert 2000 Pro + 1002 0018 Rage Fury Pro/Xpert 2000 Pro + 1002 0028 Rage 128 AIW Pro AGP + 1002 0029 Rage 128 AIW + 1002 002a Rage 128 AIW Pro AGP + 1002 002b Rage 128 AIW + 1002 0048 Xpert 2000 Pro + 544c Rage 128 Pro Ultra TL + 5452 Rage 128 Pro Ultra TR + 1002 001c Rage 128 Pro 4XL + 103c 1279 Rage 128 Pro 4XL + 5453 Rage 128 Pro Ultra TS + 5454 Rage 128 Pro Ultra TT + 5455 Rage 128 Pro Ultra TU + 5654 264VT [Mach64 VT] + 1002 5654 Mach64VT Reference + 5655 264VT3 [Mach64 VT3] + 5656 264VT4 [Mach64 VT4] + 700f U1/A3 AGP Bridge [IGP 320M] +1003 ULSI Systems + 0201 US201 +1004 VLSI Technology Inc + 0005 82C592-FC1 + 0006 82C593-FC1 + 0007 82C594-AFC2 + 0008 82C596/7 [Wildcat] + 0009 82C597-AFC2 + 000c 82C541 [Lynx] + 000d 82C543 [Lynx] + 0101 82C532 + 0102 82C534 [Eagle] + 0103 82C538 + 0104 82C535 + 0105 82C147 + 0200 82C975 + 0280 82C925 + 0304 QSound ThunderBird PCI Audio + 1004 0304 QSound ThunderBird PCI Audio + 122d 1206 DSP368 Audio + 1483 5020 XWave Thunder 3D Audio + 0305 QSound ThunderBird PCI Audio Gameport + 1004 0305 QSound ThunderBird PCI Audio Gameport + 122d 1207 DSP368 Audio Gameport + 1483 5021 XWave Thunder 3D Audio Gameport + 0306 QSound ThunderBird PCI Audio Support Registers + 1004 0306 QSound ThunderBird PCI Audio Support Registers + 122d 1208 DSP368 Audio Support Registers + 1483 5022 XWave Thunder 3D Audio Support Registers + 0307 Thunderbird + 0308 Thunderbird + 0702 VAS96011 [Golden Gate II] + 0703 Tollgate +1005 Avance Logic Inc. [ALI] + 2064 ALG2032/2064 + 2128 ALG2364A + 2301 ALG2301 + 2302 ALG2302 + 2364 ALG2364 + 2464 ALG2364A + 2501 ALG2564A/25128A +1006 Reply Group +1007 NetFrame Systems Inc +1008 Epson +100a Phoenix Technologies +100b National Semiconductor Corporation + 0001 DP83810 + 0002 87415/87560 IDE + 000e 87560 Legacy I/O + 000f FireWire Controller + 0011 NS87560 National PCI System I/O + 0012 USB Controller + 0020 DP83815 (MacPhyter) Ethernet Controller + 0022 DP83820 10/100/1000 Ethernet Controller + 0500 SCx200 Bridge + 0501 SCx200 SMI + 0502 SCx200 IDE + 0503 SCx200 Audio + 0504 SCx200 Video + 0505 SCx200 XBus + d001 87410 IDE +100c Tseng Labs Inc + 3202 ET4000/W32p rev A + 3205 ET4000/W32p rev B + 3206 ET4000/W32p rev C + 3207 ET4000/W32p rev D + 3208 ET6000 + 4702 ET6300 +100d AST Research Inc +100e Weitek + 9000 P9000 Viper + 9001 P9000 Viper + 9002 P9000 Viper + 9100 P9100 Viper Pro/SE +1010 Video Logic, Ltd. +1011 Digital Equipment Corporation + 0001 DECchip 21050 + 0002 DECchip 21040 [Tulip] + 0004 DECchip 21030 [TGA] + 0007 NVRAM [Zephyr NVRAM] + 0008 KZPSA [KZPSA] + 0009 DECchip 21140 [FasterNet] + 1025 0310 21140 Fast Ethernet + 10b8 2001 SMC9332BDT EtherPower 10/100 + 10b8 2002 SMC9332BVT EtherPower T4 10/100 + 10b8 2003 SMC9334BDT EtherPower 10/100 (1-port) + 1109 2400 ANA-6944A/TX Fast Ethernet + 1112 2300 RNS2300 Fast Ethernet + 1112 2320 RNS2320 Fast Ethernet + 1112 2340 RNS2340 Fast Ethernet + 1113 1207 EN-1207-TX Fast Ethernet + 1186 1100 DFE-500TX Fast Ethernet + 1186 1112 DFE-570TX Fast Ethernet + 1186 1140 DFE-660 Cardbus Ethernet 10/100 + 1186 1142 DFE-660 Cardbus Ethernet 10/100 + 11f6 0503 Freedomline Fast Ethernet + 1282 9100 AEF-380TXD Fast Ethernet + 1385 1100 FA310TX Fast Ethernet + 2646 0001 KNE100TX Fast Ethernet + 000a 21230 Video Codec + 000d PBXGB [TGA2] + 000f DEFPA + 0014 DECchip 21041 [Tulip Pass 3] + 1186 0100 DE-530+ + 0016 DGLPB [OPPO] + 0019 DECchip 21142/43 + 1011 500a DE500A Fast Ethernet + 1011 500b DE500B Fast Ethernet + 1014 0001 10/100 EtherJet Cardbus + 1025 0315 ALN315 Fast Ethernet + 1033 800c PC-9821-CS01 100BASE-TX Interface Card + 1033 800d PC-9821NR-B06 100BASE-TX Interface Card + 108d 0016 Rapidfire 2327 10/100 Ethernet + 108d 0017 GoCard 2250 Ethernet 10/100 Cardbus + 10b8 2005 SMC8032DT Extreme Ethernet 10/100 + 10b8 8034 SMC8034 Extreme Ethernet 10/100 + 10ef 8169 Cardbus Fast Ethernet + 1109 2a00 ANA-6911A/TX Fast Ethernet + 1109 2b00 ANA-6911A/TXC Fast Ethernet + 1109 3000 ANA-6922/TX Fast Ethernet + 1113 1207 Cheetah Fast Ethernet + 1113 2220 Cardbus Fast Ethernet + 115d 0002 Cardbus Ethernet 10/100 + 1179 0203 Fast Ethernet + 1179 0204 Cardbus Fast Ethernet + 1186 1100 DFE-500TX Fast Ethernet + 1186 1101 DFE-500TX Fast Ethernet + 1186 1102 DFE-500TX Fast Ethernet + 1259 2800 AT-2800Tx Fast Ethernet + 1266 0004 Eagle Fast EtherMAX + 12af 0019 NetFlyer Cardbus Fast Ethernet + 1374 0001 Cardbus Ethernet Card 10/100 + 1374 0002 Cardbus Ethernet Card 10/100 + 1374 0007 Cardbus Ethernet Card 10/100 + 1374 0008 Cardbus Ethernet Card 10/100 + 1385 2100 FA510 + 1395 0001 10/100 Ethernet CardBus PC Card + 13d1 ab01 EtherFast 10/100 Cardbus (PCMPC200) + 8086 0001 EtherExpress PRO/100 Mobile CardBus 32 + 001a Farallon PN9000SX + 0021 DECchip 21052 + 0022 DECchip 21150 + 0023 DECchip 21150 + 0024 DECchip 21152 + 0025 DECchip 21153 + 0026 DECchip 21154 + 0034 56k Modem Cardbus + 1374 0003 56k Modem Cardbus + 0045 DECchip 21553 + 0046 DECchip 21554 + 0e11 4050 Integrated Smart Array + 0e11 4051 Integrated Smart Array + 0e11 4058 Integrated Smart Array + 103c 10c2 Hewlett-Packard NetRAID-4M + 12d9 000a VoIP PCI Gateway + 9005 0365 Adaptec 5400S + 9005 1364 Dell PowerEdge RAID Controller 2 + 9005 1365 Dell PowerEdge RAID Controller 2 + e4bf 1000 CC8-1-BLUES + 1065 StrongARM DC21285 + 1069 0020 DAC960P / DAC1164P +1012 Micronics Computers Inc +1013 Cirrus Logic + 0038 GD 7548 + 0040 GD 7555 Flat Panel GUI Accelerator + 004c GD 7556 Video/Graphics LCD/CRT Ctrlr + 00a0 GD 5430/40 [Alpine] + 00a2 GD 5432 [Alpine] + 00a4 GD 5434-4 [Alpine] + 00a8 GD 5434-8 [Alpine] + 00ac GD 5436 [Alpine] + 00b0 GD 5440 + 00b8 GD 5446 + 00bc GD 5480 + 1013 00bc CL-GD5480 + 00d0 GD 5462 + 00d2 GD 5462 [Laguna I] + 00d4 GD 5464 [Laguna] + 00d5 GD 5464 BD [Laguna] + 00d6 GD 5465 [Laguna] + 13ce 8031 Barco Metheus 2 Megapixel, Dual Head + 13cf 8031 Barco Metheus 2 Megapixel, Dual Head + 00e8 GD 5436U + 1100 CL 6729 + 1110 PD 6832 PCMCIA/CardBus Ctrlr + 1112 PD 6834 PCMCIA/CardBus Ctrlr + 1113 PD 6833 PCMCIA/CardBus Ctrlr + 1200 GD 7542 [Nordic] + 1202 GD 7543 [Viking] + 1204 GD 7541 [Nordic Light] + 4400 CD 4400 + 6001 CS 4610/11 [CrystalClear SoundFusion Audio Accelerator] + 1014 1010 CS4610 SoundFusion Audio Accelerator + 6003 CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] + 1013 4280 Crystal SoundFusion PCI Audio Accelerator + 1681 0050 Game Theater XP + 1681 a011 Fortissimo III 7.1 + 6004 CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] + 6005 Crystal CS4281 PCI Audio + 1013 4281 Crystal CS4281 PCI Audio + 10cf 10a8 Crystal CS4281 PCI Audio + 10cf 10a9 Crystal CS4281 PCI Audio + 10cf 10aa Crystal CS4281 PCI Audio + 10cf 10ab Crystal CS4281 PCI Audio + 10cf 10ac Crystal CS4281 PCI Audio + 10cf 10ad Crystal CS4281 PCI Audio + 10cf 10b4 Crystal CS4281 PCI Audio + 1179 0001 Crystal CS4281 PCI Audio + 14c0 000c Crystal CS4281 PCI Audio +1014 IBM + 0002 PCI to MCA Bridge + 0005 Alta Lite + 0007 Alta MP + 000a Fire Coral + 0017 CPU to PCI Bridge + 0018 TR Auto LANstreamer + 001b GXT-150P + 001c Carrera + 001d 82G2675 + 0020 MCA + 0022 IBM27-82351 + 002d Python + 002e ServeRAID Controller + 1014 002e ServeRAID-3x + 1014 022e ServeRAID-4H + 0036 Miami + 003a CPU to PCI Bridge + 003e 16/4 Token ring UTP/STP controller + 1014 003e Token-Ring Adapter + 1014 00cd Token-Ring Adapter + Wake-On-LAN + 1014 00ce 16/4 Token-Ring Adapter 2 + 1014 00cf 16/4 Token-Ring Adapter Special + 1014 00e4 High-Speed 100/16/4 Token-Ring Adapter + 1014 00e5 16/4 Token-Ring Adapter 2 + Wake-On-LAN + 1014 016d iSeries 2744 Card + 0045 SSA Adapter + 0046 MPIC interrupt controller + 0047 PCI to PCI Bridge + 0048 PCI to PCI Bridge + 0049 Warhead SCSI Controller + 004e ATM Controller (14104e00) + 004f ATM Controller (14104f00) + 0050 ATM Controller (14105000) + 0053 25 MBit ATM Controller + 0057 MPEG PCI Bridge + 005c i82557B 10/100 + 007c ATM Controller (14107c00) + 007d 3780IDSP [MWave] + 0090 GXT 3000P + 1014 008e GXT-3000P + 0095 20H2999 PCI Docking Bridge + 0096 Chukar chipset SCSI controller + 1014 0097 iSeries 2778 DASD IOA + 1014 0098 iSeries 2763 DASD IOA + 1014 0099 iSeries 2748 DASD IOA + 00a5 ATM Controller (1410a500) + 00a6 ATM 155MBPS MM Controller (1410a600) + 00b7 256-bit Graphics Rasterizer [Fire GL1] + 00be ATM 622MBPS Controller (1410be00) + 00dc Advanced Systems Management Adapter (ASMA) + 00fc CPC710 Dual Bridge and Memory Controller (PCI-64) + 0105 CPC710 Dual Bridge and Memory Controller (PCI-32) + 010f Remote Supervisor Adapter (RSA) + 0142 Yotta Video Compositor Input + 1014 0143 Yotta Input Controller (ytin) + 0144 Yotta Video Compositor Output + 1014 0145 Yotta Output Controller (ytout) + 0156 405GP PLB to PCI Bridge + 01a7 PCI-X to PCI-X Bridge + 01bd ServeRAID Controller + 1014 01be ServeRAID-4M + 1014 01bf ServeRAID-4L + 1014 0208 ServeRAID-4Mx + 1014 020e ServeRAID-4Lx + 1014 022e ServeRAID-4H + 1014 0258 ServeRAID-5i + 1014 0259 ServeRAID-5i + 0302 XA-32 chipset [Summit] + ffff MPIC-2 interrupt controller +1015 LSI Logic Corp of Canada +1016 ICL Personal Systems +1017 SPEA Software AG + 5343 SPEA 3D Accelerator +1018 Unisys Systems +1019 Elitegroup Computer Systems +101a AT&T GIS (NCR) + 0005 100VG ethernet +101b Vitesse Semiconductor +101c Western Digital + 0193 33C193A + 0196 33C196A + 0197 33C197A + 0296 33C296A + 3193 7193 + 3197 7197 + 3296 33C296A + 4296 34C296 + 9710 Pipeline 9710 + 9712 Pipeline 9712 + c24a 90C +101e American Megatrends Inc. + 1960 MegaRAID + 101e 0471 MegaRAID 471 Enterprise 1600 RAID Controller + 101e 0475 MegaRAID 475 Express 500 RAID Controller + 101e 0493 MegaRAID 493 Elite 1600 RAID Controller + 1028 0471 PowerEdge RAID Controller 3/QC + 1028 0475 PowerEdge RAID Controller 3/SC + 1028 0493 PowerEdge RAID Controller 3/DC + 1028 0511 PowerEdge Cost Effective RAID Controller ATA100/4Ch + 9010 MegaRAID 428 Ultra RAID Controller + 9030 EIDE Controller + 9031 EIDE Controller + 9032 EIDE & SCSI Controller + 9033 SCSI Controller + 9040 Multimedia card + 9060 MegaRAID 434 Ultra GT RAID Controller + 9063 MegaRAC + 101e 0767 Dell Remote Assistant Card 2 +101f PictureTel +1020 Hitachi Computer Products +1021 OKI Electric Industry Co. Ltd. +1022 Advanced Micro Devices [AMD] + 1100 K8 NorthBridge + 1101 K8 NorthBridge + 1102 K8 NorthBridge + 1103 K8 NorthBridge + 2000 79c970 [PCnet32 LANCE] + 1014 2000 NetFinity 10/100 Fast Ethernet + 103c 104c Ethernet with LAN remote power Adapter + 103c 1064 Ethernet with LAN remote power Adapter + 103c 1065 Ethernet with LAN remote power Adapter + 103c 106c Ethernet with LAN remote power Adapter + 103c 106e Ethernet with LAN remote power Adapter + 103c 10ea Ethernet with LAN remote power Adapter + 1113 1220 EN1220 10/100 Fast Ethernet + 1259 2450 AT-2450 10/100 Fast Ethernet + 1259 2454 AT-2450v4 10Mb Ethernet Adapter + 1259 2700 AT-2700TX 10/100 Fast Ethernet + 1259 2701 AT-2700FX 100Mb Ethernet + 2001 79c978 [HomePNA] + 1092 0a78 Multimedia Home Network Adapter + 1668 0299 ActionLink Home Network Adapter + 2020 53c974 [PCscsi] + 2040 79c974 + 3000 ELanSC520 Microcontroller + 7006 AMD-751 [Irongate] System Controller + 7007 AMD-751 [Irongate] AGP Bridge + 700c AMD-760 MP [IGD4-2P] System Controller + 700d AMD-760 MP [IGD4-2P] AGP Bridge + 700e AMD-760 [IGD4-1P] System Controller + 700f AMD-760 [IGD4-1P] AGP Bridge + 7400 AMD-755 [Cobra] ISA + 7401 AMD-755 [Cobra] IDE + 7403 AMD-755 [Cobra] ACPI + 7404 AMD-755 [Cobra] USB + 7408 AMD-756 [Viper] ISA + 7409 AMD-756 [Viper] IDE + 740b AMD-756 [Viper] ACPI + 740c AMD-756 [Viper] USB + 7410 AMD-766 [ViperPlus] ISA + 7411 AMD-766 [ViperPlus] IDE + 7413 AMD-766 [ViperPlus] ACPI + 7414 AMD-766 [ViperPlus] USB + 7440 AMD-768 [Opus] ISA + 1043 8044 A7M-D Mainboard + 7441 AMD-768 [Opus] IDE + 7443 AMD-768 [Opus] ACPI + 1043 8044 A7M-D Mainboard + 7445 AMD-768 [Opus] Audio + 7446 AMD-768 [Opus] MC97 Modem (Smart Link HAMR5600 compatible) + 7448 AMD-768 [Opus] PCI + 7449 AMD-768 [Opus] USB + 7450 AMD-8131 PCI-X Bridge + 7451 AMD-8131 PCI-X APIC + 7454 AMD-8151 System Controller + 7455 AMD-8151 AGP Bridge + 7460 AMD-8111 PCI + 7461 AMD-8111 USB + 7462 AMD-8111 Ethernet + 7464 AMD-8111 USB + 7468 AMD-8111 LPC + 7469 AMD-8111 IDE + 746a AMD-8111 SMBus 2.0 + 746b AMD-8111 ACPI + 746d AMD-8111 AC97 Audio + 746e AMD-8111 MC97 Modem +1023 Trident Microsystems + 0194 82C194 + 2000 4DWave DX + 2001 4DWave NX + 8400 CyberBlade/i7 + 1023 8400 CyberBlade i7 AGP + 8420 CyberBlade/i7d + 0e11 b15a CyberBlade i7 AGP + 8500 CyberBlade/i1 + 8520 CyberBlade i1 + 0e11 b16e CyberBlade i1 AGP + 1023 8520 CyberBlade i1 AGP + 8620 CyberBlade/i1 + 1014 0502 ThinkPad T30 + 8820 CyberBlade XPAi1 + 9320 TGUI 9320 + 9350 GUI Accelerator + 9360 Flat panel GUI Accelerator + 9382 Cyber 9382 [Reference design] + 9383 Cyber 9383 [Reference design] + 9385 Cyber 9385 [Reference design] + 9386 Cyber 9386 + 9388 Cyber 9388 + 9397 Cyber 9397 + 939a Cyber 9397DVD + 9420 TGUI 9420 + 9430 TGUI 9430 + 9440 TGUI 9440 + 9460 TGUI 9460 + 9470 TGUI 9470 + 9520 Cyber 9520 + 9525 Cyber 9525 + 10cf 1094 Lifebook C6155 + 9540 Cyber 9540 + 9660 TGUI 9660/938x/968x + 9680 TGUI 9680 + 9682 TGUI 9682 + 9683 TGUI 9683 + 9685 ProVIDIA 9685 + 9750 3DImage 9750 + 1014 9750 3DImage 9750 + 1023 9750 3DImage 9750 + 9753 TGUI 9753 + 9754 TGUI 9754 + 9759 TGUI 975 + 9783 TGUI 9783 + 9785 TGUI 9785 + 9850 3DImage 9850 + 9880 Blade 3D PCI/AGP + 1023 9880 Blade 3D + 9910 CyberBlade/XP + 9930 CyberBlade/XPm +1024 Zenith Data Systems +1025 Acer Incorporated [ALI] + 1435 M1435 + 1445 M1445 + 1449 M1449 + 1451 M1451 + 1461 M1461 + 1489 M1489 + 1511 M1511 + 1512 ALI M1512 Aladdin + 1513 M1513 + 1521 ALI M1521 Aladdin III CPU Bridge + 10b9 1521 ALI M1521 Aladdin III CPU Bridge + 1523 ALI M1523 ISA Bridge + 10b9 1523 ALI M1523 ISA Bridge + 1531 M1531 Northbridge [Aladdin IV/IV+] + 1533 M1533 PCI-to-ISA Bridge + 10b9 1533 ALI M1533 Aladdin IV/V ISA South Bridge + 1535 M1535 PCI Bridge + Super I/O + FIR + 1541 M1541 Northbridge [Aladdin V] + 10b9 1541 ALI M1541 Aladdin V/V+ AGP+PCI North Bridge + 1542 M1542 Northbridge [Aladdin V] + 1543 M1543 PCI-to-ISA Bridge + Super I/O + FIR + 1561 M1561 Northbridge [Aladdin 7] + 1621 M1621 Northbridge [Aladdin-Pro II] + 1631 M1631 Northbridge+3D Graphics [Aladdin TNT2] + 1641 M1641 Northbridge [Aladdin-Pro IV] + 1647 M1647 [MaGiK1] PCI North Bridge + 3141 M3141 + 3143 M3143 + 3145 M3145 + 3147 M3147 + 3149 M3149 + 3151 M3151 + 3307 M3307 MPEG-I Video Controller + 3309 M3309 MPEG-II Video w/ Software Audio Decoder + 3321 M3321 MPEG-II Audio/Video Decoder + 5212 M4803 + 5215 ALI PCI EIDE Controller + 5217 M5217H + 5219 M5219 + 5225 M5225 + 5229 M5229 + 5235 M5235 + 5237 M5237 PCI USB Host Controller + 5240 EIDE Controller + 5241 PCMCIA Bridge + 5242 General Purpose Controller + 5243 PCI to PCI Bridge Controller + 5244 Floppy Disk Controller + 5247 M1541 PCI to PCI Bridge + 5251 M5251 P1394 Controller + 5427 PCI to AGP Bridge + 5451 M5451 PCI AC-Link Controller Audio Device + 5453 M5453 PCI AC-Link Controller Modem Device + 7101 M7101 PCI PMU Power Management Controller + 10b9 7101 M7101 PCI PMU Power Management Controller +1028 Dell Computer Corporation + 0001 PowerEdge Expandable RAID Controller 2/Si + 1028 0001 PowerEdge Expandable RAID Controller 2/Si + 0002 PowerEdge Expandable RAID Controller 3 + 1028 0002 PowerEdge Expandable RAID Controller 3/Di + 1028 00d1 PowerEdge Expandable RAID Controller 3/Di + 1028 00d9 PowerEdge Expandable RAID Controller 3/Di + 0003 PowerEdge Expandable RAID Controller 3/Si + 1028 0003 PowerEdge Expandable RAID Controller 3/Si + 0004 PowerEdge Expandable RAID Controller 3/Si + 1028 00d0 PowerEdge Expandable RAID Controller 3/Si + 0005 PowerEdge Expandable RAID Controller 3/Di + 0006 PowerEdge Expandable RAID Controller 3/Di + 0007 Remote Assistant Card 3 + 0008 PowerEdge Expandable RAID Controller 3/Di + 000a PowerEdge Expandable RAID Controller 3 + 1028 0106 PowerEdge Expandable RAID Controller 3/Di + 1028 011b PowerEdge Expandable RAID Controller 3/Di + 1028 0121 PowerEdge Expandable RAID Controller 3/Di + 000c Embedded Systems Management Device 4 + 000e PowerEdge Expandable RAID Controller + 000f PowerEdge Expandable RAID Controller 4/Di +1029 Siemens Nixdorf IS +102a LSI Logic + 0000 HYDRA + 0010 ASPEN +102b Matrox Graphics, Inc. +# DJ: I've a suspicion that 0010 is a duplicate of 0d10. + 0010 MGA-I [Impression?] + 0518 MGA-II [Athena] + 0519 MGA 2064W [Millennium] + 051a MGA 1064SG [Mystique] + 102b 0100 MGA-1064SG Mystique + 102b 1100 MGA-1084SG Mystique + 102b 1200 MGA-1084SG Mystique + 1100 102b MGA-1084SG Mystique + 110a 0018 Scenic Pro C5 (D1025) + 051b MGA 2164W [Millennium II] + 102b 051b MGA-2164W Millennium II + 102b 1100 MGA-2164W Millennium II + 102b 1200 MGA-2164W Millennium II + 051e MGA 1064SG [Mystique] AGP + 051f MGA 2164W [Millennium II] AGP + 0520 MGA G200 + 102b dbc2 G200 Multi-Monitor + 102b dbc8 G200 Multi-Monitor + 102b dbe2 G200 Multi-Monitor + 102b dbe8 G200 Multi-Monitor + 102b ff03 Millennium G200 SD + 102b ff04 Marvel G200 + 0521 MGA G200 AGP + 1014 ff03 Millennium G200 AGP + 102b 48e9 Mystique G200 AGP + 102b 48f8 Millennium G200 SD AGP + 102b 4a60 Millennium G200 LE AGP + 102b 4a64 Millennium G200 AGP + 102b c93c Millennium G200 AGP + 102b c9b0 Millennium G200 AGP + 102b c9bc Millennium G200 AGP + 102b ca60 Millennium G250 LE AGP + 102b ca6c Millennium G250 AGP + 102b dbbc Millennium G200 AGP + 102b dbc2 Millennium G200 MMS (Dual G200) + 102b dbc3 G200 Multi-Monitor + 102b dbc8 Millennium G200 MMS (Dual G200) + 102b dbd2 G200 Multi-Monitor + 102b dbd3 G200 Multi-Monitor + 102b dbd4 G200 Multi-Monitor + 102b dbd5 G200 Multi-Monitor + 102b dbd8 G200 Multi-Monitor + 102b dbd9 G200 Multi-Monitor + 102b dbe2 Millennium G200 MMS (Quad G200) + 102b dbe3 G200 Multi-Monitor + 102b dbe8 Millennium G200 MMS (Quad G200) + 102b dbf2 G200 Multi-Monitor + 102b dbf3 G200 Multi-Monitor + 102b dbf4 G200 Multi-Monitor + 102b dbf5 G200 Multi-Monitor + 102b dbf8 G200 Multi-Monitor + 102b dbf9 G200 Multi-Monitor + 102b f806 Mystique G200 Video AGP + 102b ff00 MGA-G200 AGP + 102b ff02 Mystique G200 AGP + 102b ff03 Millennium G200 AGP + 102b ff04 Marvel G200 AGP + 110a 0032 MGA-G200 AGP + 0525 MGA G400 AGP + 0e11 b16f MGA-G400 AGP + 102b 0328 Millennium G400 16Mb SDRAM + 102b 0338 Millennium G400 16Mb SDRAM + 102b 0378 Millennium G400 32Mb SDRAM + 102b 0541 Millennium G450 Dual Head + 102b 0542 Millennium G450 Dual Head LX + 102b 0543 Millennium G450 Single Head LX + 102b 0641 Millennium G450 32Mb SDRAM Dual Head + 102b 0642 Millennium G450 32Mb SDRAM Dual Head LX + 102b 0643 Millennium G450 32Mb SDRAM Single Head LX + 102b 07c0 Millennium G450 Dual Head LE + 102b 07c1 Millennium G450 SDR Dual Head LE + 102b 0d41 Millennium G450 Dual Head PCI + 102b 0d42 Millennium G450 Dual Head LX PCI + 102b 0e00 Marvel G450 eTV + 102b 0e01 Marvel G450 eTV + 102b 0e02 Marvel G450 eTV + 102b 0e03 Marvel G450 eTV + 102b 0f80 Millennium G450 Low Profile + 102b 0f81 Millennium G450 Low Profile + 102b 0f82 Millennium G450 Low Profile DVI + 102b 0f83 Millennium G450 Low Profile DVI + 102b 19d8 Millennium G400 16Mb SGRAM + 102b 19f8 Millennium G400 32Mb SGRAM + 102b 2159 Millennium G400 Dual Head 16Mb + 102b 2179 Millennium G400 MAX/Dual Head 32Mb + 102b 217d Millennium G400 Dual Head Max + 102b 23c0 Millennium G450 + 102b 23c1 Millennium G450 + 102b 23c2 Millennium G450 DVI + 102b 23c3 Millennium G450 DVI + 102b 2f58 Millennium G400 + 102b 2f78 Millennium G400 + 102b 3693 Marvel G400 AGP + 102b 5dd0 4Sight II + 102b 5f50 4Sight II + 102b 5f51 4Sight II + 102b 5f52 4Sight II + 102b 9010 Millennium G400 Dual Head + 1458 0400 GA-G400 + 1705 0001 Millennium G450 32MB SGRAM + 1705 0002 Millennium G450 16MB SGRAM + 1705 0003 Millennium G450 32MB + 1705 0004 Millennium G450 16MB + 0527 MGA Parhelia AGP + 102b 0840 Parhelia 128Mb + 0d10 MGA Ultima/Impression + 1000 MGA G100 [Productiva] + 102b ff01 Productiva G100 + 102b ff05 Productiva G100 Multi-Monitor + 1001 MGA G100 [Productiva] AGP + 102b 1001 MGA-G100 AGP + 102b ff00 MGA-G100 AGP + 102b ff01 MGA-G100 Productiva AGP + 102b ff03 Millennium G100 AGP + 102b ff04 MGA-G100 AGP + 102b ff05 MGA-G100 Productiva AGP Multi-Monitor + 110a 001e MGA-G100 AGP + 2007 MGA Mistral + 2527 MGA G550 AGP + 102b 0f83 Millennium G550 + 102b 0f84 Millennium G550 Dual Head DDR 32Mb + 102b 1e41 Millennium G550 + 4536 VIA Framegrabber + 6573 Shark 10/100 Multiport SwitchNIC +102c Chips and Technologies + 00b8 F64310 + 00c0 F69000 HiQVideo + 102c 00c0 F69000 HiQVideo + 00d0 F65545 + 00d8 F65545 + 00dc F65548 + 00e0 F65550 + 00e4 F65554 + 00e5 F65555 HiQVPro + 0e11 b049 Armada 1700 Laptop Display Controller + 00f0 F68554 + 00f4 F68554 HiQVision + 00f5 F68555 + 0c30 F69030 +102d Wyse Technology Inc. + 50dc 3328 Audio +102e Olivetti Advanced Technology +102f Toshiba America + 0009 r4x00 + 0020 ATM Meteor 155 + 102f 00f8 ATM Meteor 155 +1030 TMC Research +1031 Miro Computer Products AG + 5601 DC20 ASIC + 5607 Video I/O & motion JPEG compressor + 5631 Media 3D + 6057 MiroVideo DC10/DC30+ +1032 Compaq +1033 NEC Corporation + 0001 PCI to 486-like bus Bridge + 0002 PCI to VL98 Bridge + 0003 ATM Controller + 0004 R4000 PCI Bridge + 0005 PCI to 486-like bus Bridge + 0006 PC-9800 Graphic Accelerator + 0007 PCI to UX-Bus Bridge + 0008 PC-9800 Graphic Accelerator + 0009 PCI to PC9800 Core-Graph Bridge + 0016 PCI to VL Bridge + 001a [Nile II] + 0021 Vrc4373 [Nile I] + 0029 PowerVR PCX1 + 002a PowerVR 3D + 002c Star Alpha 2 + 002d PCI to C-bus Bridge + 0035 USB + 1179 0001 USB + 12ee 7000 Root Hub + 1799 0001 Root Hub + 003b PCI to C-bus Bridge + 003e NAPCCARD Cardbus Controller + 0046 PowerVR PCX2 [midas] + 005a Vrc5074 [Nile 4] + 0063 Firewarden + 0067 PowerVR Neon 250 Chipset + 1010 0020 PowerVR Neon 250 AGP 32Mb + 1010 0080 PowerVR Neon 250 AGP 16Mb + 1010 0088 PowerVR Neon 250 16Mb + 1010 0090 PowerVR Neon 250 AGP 16Mb + 1010 0098 PowerVR Neon 250 16Mb + 1010 00a0 PowerVR Neon 250 AGP 32Mb + 1010 00a8 PowerVR Neon 250 32Mb + 1010 0120 PowerVR Neon 250 AGP 32Mb + 0074 56k Voice Modem + 1033 8014 RCV56ACF 56k Voice Modem + 009b Vrc5476 + 00a6 VRC5477 AC97 + 00cd IEEE 1394 [OrangeLink] Host Controller + 12ee 8011 Root hub + 00e0 USB 2.0 + 12ee 7001 Root hub + 1799 0002 Root Hub +1034 Framatome Connectors USA Inc. +1035 Comp. & Comm. Research Lab +1036 Future Domain Corp. + 0000 TMC-18C30 [36C70] +1037 Hitachi Micro Systems +1038 AMP, Inc +1039 Silicon Integrated Systems [SiS] +# This is what all my tests report. I don't know if this is equivalent to "5591/5592 AGP". + 0001 SiS 530 Virtual PCI-to-PCI bridge (AGP) + 0002 SG86C202 + 0006 85C501/2/3 + 0008 85C503/5513 + 0009 ACPI + 0018 SiS85C503/5513 (LPC Bridge) + 0200 5597/5598/6326 VGA + 1039 0000 SiS5597 SVGA (Shared RAM) + 0204 82C204 + 0205 SG86C205 + 0300 SiS300/305 PCI/AGP VGA Display Adapter + 107d 2720 Leadtek WinFast VR300 + 0310 SiS315H PCI/AGP VGA Display Adapter + 0315 SiS315 PCI/AGP VGA Display Adapter + 0325 SiS315PRO PCI/AGP VGA Display Adapter + 0330 SiS330 [Xabre] PCI/AGP VGA Display Adapter + 0406 85C501/2 + 0496 85C496 + 0530 530 Host + 0540 540 Host + 0597 5513C + 0601 85C601 + 0620 620 Host + 0630 630 Host + 0633 633 Host + 0635 635 Host + 0645 SiS645 Host & Memory & AGP Controller + 0646 SiS645DX Host & Memory & AGP Controller + 0650 650 Host + 0651 SiS651 Host + 0730 730 Host + 0733 733 Host + 0735 735 Host + 0740 740 Host + 0745 745 Host + 0900 SiS900 10/100 Ethernet + 1039 0900 SiS900 10/100 Ethernet Adapter + 0961 SiS961 [MuTIOL Media IO] + 0962 SiS962 [MuTIOL Media IO] + 3602 83C602 + 5107 5107 + 5300 SiS540 PCI Display Adapter + 5315 SiS550 AGP/VGA VGA Display Adapter + 5401 486 PCI Chipset + 5511 5511/5512 + 5513 5513 [IDE] + 1019 0970 P6STP-FL motherboard + 1039 5513 SiS5513 EIDE Controller (A,B step) + 5517 5517 + 5571 5571 + 5581 5581 Pentium Chipset + 5582 5582 + 5591 5591/5592 Host + 5596 5596 Pentium Chipset + 5597 5597 [SiS5582] + 5600 5600 Host + 6204 Video decoder & MPEG interface + 6205 VGA Controller + 6236 6236 3D-AGP + 6300 SiS630 GUI Accelerator+3D + 1019 0970 P6STP-FL motherboard + 6306 SiS530 3D PCI/AGP + 1039 6306 SiS530,620 GUI Accelerator+3D + 6325 SiS650/651/M650/740 PCI/AGP VGA Display Adapter + 6326 86C326 5598/6326 + 1039 6326 SiS6326 GUI Accelerator + 1092 0a50 SpeedStar A50 + 1092 0a70 SpeedStar A70 + 1092 4910 SpeedStar A70 + 1092 4920 SpeedStar A70 + 1569 6326 SiS6326 GUI Accelerator + 7001 SiS7001 USB Controller + 1039 7000 Onboard USB Controller + 7002 SiS7002 USB 2.0 + 1509 7002 Onboard USB Controller + 7007 FireWire Controller + 7012 SiS7012 PCI Audio Accelerator + 7013 Intel 537 [56k Winmodem] + 7016 SiS7016 10/100 Ethernet Adapter + 1039 7016 SiS7016 10/100 Ethernet Adapter + 7018 SiS PCI Audio Accelerator + 1014 01b6 SiS PCI Audio Accelerator + 1014 01b7 SiS PCI Audio Accelerator + 1019 7018 SiS PCI Audio Accelerator + 1025 000e SiS PCI Audio Accelerator + 1025 0018 SiS PCI Audio Accelerator + 1039 7018 SiS PCI Audio Accelerator + 1043 800b SiS PCI Audio Accelerator + 1054 7018 SiS PCI Audio Accelerator + 107d 5330 SiS PCI Audio Accelerator + 107d 5350 SiS PCI Audio Accelerator + 1170 3209 SiS PCI Audio Accelerator + 1462 400a SiS PCI Audio Accelerator + 14a4 2089 SiS PCI Audio Accelerator + 14cd 2194 SiS PCI Audio Accelerator + 14ff 1100 SiS PCI Audio Accelerator + 152d 8808 SiS PCI Audio Accelerator + 1558 1103 SiS PCI Audio Accelerator + 1558 2200 SiS PCI Audio Accelerator + 1563 7018 SiS PCI Audio Accelerator + 15c5 0111 SiS PCI Audio Accelerator + 270f a171 SiS PCI Audio Accelerator + a0a0 0022 SiS PCI Audio Accelerator +103a Seiko Epson Corporation +103b Tatung Co. of America +103c Hewlett-Packard Company + 1005 A4977A Visualize EG + 1006 Visualize FX6 + 1008 Visualize FX4 + 100a Visualize FX2 + 1028 Tach TL Fibre Channel Host Adapter + 1029 Tach XL2 Fibre Channel Host Adapter + 107e 000f Interphase 5560 Fibre Channel Adapter + 9004 9210 1Gb/2Gb Family Fibre Channel Controller + 9004 9211 1Gb/2Gb Family Fibre Channel Controller + 102a Tach TS Fibre Channel Host Adapter + 107e 000e Interphase 5540/5541 Fibre Channel Adapter + 9004 9110 1Gb/2Gb Family Fibre Channel Controller + 9004 9111 1Gb/2Gb Family Fibre Channel Controller + 1030 J2585A DeskDirect 10/100VG NIC + 1031 J2585B HP 10/100VG PCI LAN Adapter + 103c 1040 J2973A DeskDirect 10BaseT NIC + 103c 1041 J2585B DeskDirect 10/100VG NIC + 103c 1042 J2970A DeskDirect 10BaseT/2 NIC + 1040 J2973A DeskDirect 10BaseT NIC + 1041 J2585B DeskDirect 10/100 NIC + 1042 J2970A DeskDirect 10BaseT/2 NIC + 1048 Diva Serial [GSP] Multiport UART + 103c 1049 Tosca Console + 103c 104a Tosca Secondary + 103c 104b Maestro SP2 + 103c 1223 Halfdome Console + 103c 1226 Keystone SP2 + 103c 1227 Powerbar SP2 + 103c 1282 Everest SP2 + 1064 79C970 PCnet Ethernet Controller + 108b Visualize FXe + 10c1 NetServer Smart IRQ Router + 10ed TopTools Remote Control + 1200 82557B 10/100 NIC + 1219 NetServer PCI Hot-Plug Controller + 121a NetServer SMIC Controller + 121b NetServer Legacy COM Port Decoder + 121c NetServer PCI COM Port Decoder + 1229 zx1 System Bus Adapter + 122a zx1 I/O Controller + 122e zx1 Local Bus Adapter + 1290 Auxiliary Diva Serial Port + 2910 E2910A PCIBus Exerciser + 2925 E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer +103e Solliday Engineering +103f Synopsys/Logic Modeling Group +1040 Accelgraphics Inc. +1041 Computrend +1042 Micron + 1000 FDC 37C665 + 1001 37C922 + 3000 Samurai_0 + 3010 Samurai_1 + 3020 Samurai_IDE +1043 Asustek Computer, Inc. + 0675 ISDNLink P-IN100-ST-D + 4021 v7100 Combo Deluxe [GeForce2 MX + TV tuner] +1044 Distributed Processing Technology + 1012 Domino RAID Engine + a400 SmartCache/Raid I-IV Controller + a500 PCI Bridge + a501 SmartRAID V Controller + 1044 c001 PM1554U2 Ultra2 Single Channel + 1044 c002 PM1654U2 Ultra2 Single Channel + 1044 c003 PM1564U3 Ultra3 Single Channel + 1044 c004 PM1564U3 Ultra3 Dual Channel + 1044 c005 PM1554U2 Ultra2 Single Channel (NON ACPI) + 1044 c00a PM2554U2 Ultra2 Single Channel + 1044 c00b PM2654U2 Ultra2 Single Channel + 1044 c00c PM2664U3 Ultra3 Single Channel + 1044 c00d PM2664U3 Ultra3 Dual Channel + 1044 c00e PM2554U2 Ultra2 Single Channel (NON ACPI) + 1044 c00f PM2654U2 Ultra2 Single Channel (NON ACPI) + 1044 c014 PM3754U2 Ultra2 Single Channel (NON ACPI) + 1044 c015 PM3755U2B Ultra2 Single Channel (NON ACPI) + 1044 c016 PM3755F Fibre Channel (NON ACPI) + 1044 c01e PM3757U2 Ultra2 Single Channel + 1044 c01f PM3757U2 Ultra2 Dual Channel + 1044 c020 PM3767U3 Ultra3 Dual Channel + 1044 c021 PM3767U3 Ultra3 Quad Channel + 1044 c028 PM2865U3 Ultra3 Single Channel + 1044 c029 PM2865U3 Ultra3 Dual Channel + 1044 c02a PM2865F Fibre Channel + 1044 c03c 2000S Ultra3 Single Channel + 1044 c03d 2000S Ultra3 Dual Channel + 1044 c03e 2000F Fibre Channel + 1044 c046 3000S Ultra3 Single Channel + 1044 c047 3000S Ultra3 Dual Channel + 1044 c048 3000F Fibre Channel + 1044 c050 5000S Ultra3 Single Channel + 1044 c051 5000S Ultra3 Dual Channel + 1044 c052 5000F Fibre Channel + 1044 c05a 2400A UDMA Four Channel + 1044 c05b 2400A UDMA Four Channel DAC + 1044 c064 3010S Ultra3 Dual Channel + 1044 c065 3010S Ultra3 Four Channel + 1044 c066 3010S Fibre Channel + a511 SmartRAID V Controller +1045 OPTi Inc. + a0f8 82C750 [Vendetta] USB Controller + c101 92C264 + c178 92C178 + c556 82X556 [Viper] + c557 82C557 [Viper-M] + c558 82C558 [Viper-M ISA+IDE] + c567 82C750 [Vendetta], device 0 + c568 82C750 [Vendetta], device 1 + c569 82C579 [Viper XPress+ Chipset] + c621 82C621 [Viper-M/N+] + c700 82C700 [FireStar] + c701 82C701 [FireStar Plus] + c814 82C814 [Firebridge 1] + c822 82C822 + c824 82C824 + c825 82C825 [Firebridge 2] + c832 82C832 + c861 82C861 + c895 82C895 + c935 EV1935 ECTIVA MachOne PCI Audio + d568 82C825 [Firebridge 2] + d721 IDE [FireStar] +1046 IPC Corporation, Ltd. +1047 Genoa Systems Corp +1048 Elsa AG + 0d22 Quadro4 900XGL [ELSA GLoria4 900XGL] + 1000 QuickStep 1000 + 3000 QuickStep 3000 +1049 Fountain Technologies, Inc. +104a SGS Thomson Microelectronics + 0008 STG 2000X + 0009 STG 1764X + 0010 STG4000 [3D Prophet Kyro Series] +# From <http://gatekeeper.dec.com/pub/BSD/FreeBSD/FreeBSD-stable/src/share/misc/pci_vendors> + 0210 STPC Atlas ISA Bridge + 0981 DEC-Tulip compatible 10/100 Ethernet + 1746 STG 1764X + 2774 DEC-Tulip compatible 10/100 Ethernet + 3520 MPEG-II decoder card +104b BusLogic + 0140 BT-946C (old) [multimaster 01] + 1040 BT-946C (BA80C30) [MultiMaster 10] + 8130 Flashpoint LT +104c Texas Instruments + 0500 100 MBit LAN Controller + 0508 TMS380C2X Compressor Interface + 1000 Eagle i/f AS + 104c PCI1510 PC card Cardbus Controller + 3d04 TVP4010 [Permedia] + 3d07 TVP4020 [Permedia 2] + 1011 4d10 Comet + 1040 000f AccelStar II + 1040 0011 AccelStar II + 1048 0a31 WINNER 2000 + 1048 0a32 GLoria Synergy + 1048 0a35 GLoria Synergy + 107d 2633 WinFast 3D L2300 + 1092 0127 FIRE GL 1000 PRO + 1092 0136 FIRE GL 1000 PRO + 1092 0141 FIRE GL 1000 PRO + 1092 0146 FIRE GL 1000 PRO + 1092 0148 FIRE GL 1000 PRO + 1092 0149 FIRE GL 1000 PRO + 1092 0152 FIRE GL 1000 PRO + 1092 0154 FIRE GL 1000 PRO + 1092 0155 FIRE GL 1000 PRO + 1092 0156 FIRE GL 1000 PRO + 1092 0157 FIRE GL 1000 PRO + 1097 3d01 Jeronimo Pro + 1102 100f Graphics Blaster Extreme + 3d3d 0100 Reference Permedia 2 3D + 8000 PCILynx/PCILynx2 IEEE 1394 Link Layer Controller + e4bf 1010 CF1-1-SNARE + e4bf 1020 CF1-2-SNARE + 8009 FireWire Controller + 104d 8032 8032 OHCI i.LINK (IEEE 1394) Controller + 8017 PCI4410 FireWire Controller + 8019 TSB12LV23 IEEE-1394 Controller + 11bd 000a Studio DV500-1394 + 11bd 000e Studio DV + e4bf 1010 CF2-1-CYMBAL + 8020 TSB12LV26 IEEE-1394 Controller (Link) + 8021 TSB43AA22 IEEE-1394 Controller (PHY/Link Integrated) + 104d 80df Vaio PCG-FX403 + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 8022 TSB43AB22 IEEE-1394a-2000 Controller (PHY/Link) + 8023 TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link) + 8024 TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link) + 8026 TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link) + 8027 PCI4451 IEEE-1394 Controller + 1028 00e6 PCI4451 IEEE-1394 Controller (Dell Inspiron 8100) + 8400 ACX 100 22Mbps Wireless Interface + a001 TDC1570 + a100 TDC1561 + a102 TNETA1575 HyperSAR Plus w/PCI Host i/f & UTOPIA i/f + a106 TMS320C6205 + ac10 PCI1050 + ac11 PCI1053 + ac12 PCI1130 + ac13 PCI1031 + ac15 PCI1131 + ac16 PCI1250 + ac17 PCI1220 + ac18 PCI1260 + ac19 PCI1221 + ac1a PCI1210 + ac1b PCI1450 + 0e11 b113 Armada M700 + ac1c PCI1225 + ac1d PCI1251A + ac1e PCI1211 + ac1f PCI1251B + ac20 TI 2030 + ac21 PCI2031 + ac22 PCI2032 PCI Docking Bridge + ac23 PCI2250 PCI-to-PCI Bridge + ac28 PCI2050 PCI-to-PCI Bridge + ac30 PCI1260 PC card Cardbus Controller + ac40 PCI4450 PC card Cardbus Controller + ac41 PCI4410 PC card Cardbus Controller + ac42 PCI4451 PC card Cardbus Controller + 1028 00e6 PCI4451 PC card CardBus Controller (Dell Inspiron 8100) + ac50 PCI1410 PC card Cardbus Controller + ac51 PCI1420 + 1014 023b ThinkPad T23 (2647-4MG) + 10cf 1095 Lifebook C6155 + e4bf 1000 CP2-2-HIPHOP + ac52 PCI1451 PC card Cardbus Controller + ac53 PCI1421 PC card Cardbus Controller + ac55 PCI1250 PC card Cardbus Controller + 1014 0512 ThinkPad T30 + ac56 PCI1510 PC card Cardbus Controller + ac60 PCI2040 PCI to DSP Bridge Controller + fe00 FireWire Host Controller + fe03 12C01A FireWire Host Controller +104d Sony Corporation + 8009 CXD1947Q i.LINK Controller + 8039 CXD3222 i.LINK Controller + 8056 Rockwell HCF 56K modem + 808a Memory Stick Controller +104e Oak Technology, Inc + 0017 OTI-64017 + 0107 OTI-107 [Spitfire] + 0109 Video Adapter + 0111 OTI-64111 [Spitfire] + 0217 OTI-64217 + 0317 OTI-64317 +104f Co-time Computer Ltd +1050 Winbond Electronics Corp + 0000 NE2000 + 0001 W83769F + 0105 W82C105 + 0840 W89C840 + 1050 0001 W89C840 Ethernet Adapter + 1050 0840 W89C840 Ethernet Adapter + 0940 W89C940 + 5a5a W89C940F + 6692 W6692 + 9970 W9970CF +1051 Anigma, Inc. +1052 ?Young Micro Systems +1053 Young Micro Systems +1054 Hitachi, Ltd +1055 Efar Microsystems + 9130 SLC90E66 [Victory66] IDE + 9460 SLC90E66 [Victory66] ISA + 9462 SLC90E66 [Victory66] USB + 9463 SLC90E66 [Victory66] ACPI +1056 ICL +# Motorola made a mistake and used 1507 instead of 1057 in some chips. Please look at the 1507 entry as well when updating this. +1057 Motorola + 0001 MPC105 [Eagle] + 0002 MPC106 [Grackle] + 0003 MPC8240 [Kahlua] + 0004 MPC107 + 0006 MPC8245 [Unity] + 0100 MC145575 [HFC-PCI] + 0431 KTI829c 100VG + 1801 Audio I/O Controller (MIDI) + ecc0 0030 Layla + 18c0 MPC8265A/MPC8266 + 4801 Raven + 4802 Falcon + 4803 Hawk + 4806 CPX8216 + 4d68 20268 + 5600 SM56 PCI Modem + 1057 0300 SM56 PCI Speakerphone Modem + 1057 0301 SM56 PCI Voice Modem + 1057 0302 SM56 PCI Fax Modem + 1057 5600 SM56 PCI Voice modem + 13d2 0300 SM56 PCI Speakerphone Modem + 13d2 0301 SM56 PCI Voice modem + 13d2 0302 SM56 PCI Fax Modem + 1436 0300 SM56 PCI Speakerphone Modem + 1436 0301 SM56 PCI Voice modem + 1436 0302 SM56 PCI Fax Modem + 144f 100c SM56 PCI Fax Modem + 1494 0300 SM56 PCI Speakerphone Modem + 1494 0301 SM56 PCI Voice modem + 14c8 0300 SM56 PCI Speakerphone Modem + 14c8 0302 SM56 PCI Fax Modem + 1668 0300 SM56 PCI Speakerphone Modem + 1668 0302 SM56 PCI Fax Modem + 6400 MPC190 Security Processor (S1 family, encryption) +1058 Electronics & Telecommunications RSH +1059 Teknor Industrial Computers Inc +105a Promise Technology, Inc. + 0d30 20265 + 105a 4d33 Ultra100 + 0d38 20263 + 105a 4d39 Fasttrak66 + 1275 20275 + 3376 PDC20376 + 4d30 20267 + 105a 4d33 Ultra100 + 105a 4d39 Fasttrak100 + 4d33 20246 + 105a 4d33 20246 IDE Controller + 4d38 20262 + 105a 4d30 Ultra Device on SuperTrak + 105a 4d33 Ultra66 + 105a 4d39 Fasttrak66 + 4d68 20268 + 105a 4d68 Ultra100TX2 + 4d69 20269 + 5275 PDC20276 IDE + 105a 0275 SuperTrak SX6000 IDE + 5300 DC5300 + 6268 20268R + 6269 PDC20271 + 105a 6269 FastTrak TX2/TX2000 + 6621 PDC20621 [SX4000] 4 Channel IDE RAID Controller + 7275 PDC20277 +105b Foxconn International, Inc. +105c Wipro Infotech Limited +105d Number 9 Computer Company + 2309 Imagine 128 + 2339 Imagine 128-II + 105d 0000 Imagine 128 series 2 4Mb VRAM + 105d 0001 Imagine 128 series 2 4Mb VRAM + 105d 0002 Imagine 128 series 2 4Mb VRAM + 105d 0003 Imagine 128 series 2 4Mb VRAM + 105d 0004 Imagine 128 series 2 4Mb VRAM + 105d 0005 Imagine 128 series 2 4Mb VRAM + 105d 0006 Imagine 128 series 2 4Mb VRAM + 105d 0007 Imagine 128 series 2 4Mb VRAM + 105d 0008 Imagine 128 series 2e 4Mb DRAM + 105d 0009 Imagine 128 series 2e 4Mb DRAM + 105d 000a Imagine 128 series 2 8Mb VRAM + 105d 000b Imagine 128 series 2 8Mb H-VRAM + 11a4 000a Barco Metheus 5 Megapixel + 13cc 0000 Barco Metheus 5 Megapixel + 13cc 0004 Barco Metheus 5 Megapixel + 13cc 0005 Barco Metheus 5 Megapixel + 13cc 0006 Barco Metheus 5 Megapixel + 13cc 0008 Barco Metheus 5 Megapixel + 13cc 0009 Barco Metheus 5 Megapixel + 13cc 000a Barco Metheus 5 Megapixel + 13cc 000c Barco Metheus 5 Megapixel + 493d Imagine 128 T2R [Ticket to Ride] + 11a4 000a Barco Metheus 5 Megapixel, Dual Head + 11a4 000b Barco Metheus 5 Megapixel, Dual Head + 13cc 0002 Barco Metheus 4 Megapixel, Dual Head + 13cc 0003 Barco Metheus 5 Megapixel, Dual Head + 13cc 0007 Barco Metheus 5 Megapixel, Dual Head + 13cc 0008 Barco Metheus 5 Megapixel, Dual Head + 13cc 0009 Barco Metheus 5 Megapixel, Dual Head + 13cc 000a Barco Metheus 5 Megapixel, Dual Head + 5348 Revolution 4 +105e Vtech Computers Ltd +105f Infotronic America Inc +1060 United Microelectronics [UMC] + 0001 UM82C881 + 0002 UM82C886 + 0101 UM8673F + 0881 UM8881 + 0886 UM8886F + 0891 UM8891A + 1001 UM886A + 673a UM8886BF + 673b EIDE Master/DMA + 8710 UM8710 + 886a UM8886A + 8881 UM8881F + 8886 UM8886F + 888a UM8886A + 8891 UM8891A + 9017 UM9017F + 9018 UM9018 + 9026 UM9026 + e881 UM8881N + e886 UM8886N + e88a UM8886N + e891 UM8891N +1061 I.I.T. + 0001 AGX016 + 0002 IIT3204/3501 +1062 Maspar Computer Corp +1063 Ocean Office Automation +1064 Alcatel +1065 Texas Microsystems +1066 PicoPower Technology + 0000 PT80C826 + 0001 PT86C521 [Vesuvius v1] Host Bridge + 0002 PT86C523 [Vesuvius v3] PCI-ISA Bridge Master + 0003 PT86C524 [Nile] PCI-to-PCI Bridge + 0004 PT86C525 [Nile-II] PCI-to-PCI Bridge + 0005 National PC87550 System Controller + 8002 PT86C523 [Vesuvius v3] PCI-ISA Bridge Slave +1067 Mitsubishi Electric + 1002 VG500 [VolumePro Volume Rendering Accelerator] +1068 Diversified Technology +1069 Mylex Corporation + 0001 DAC960P + 0002 DAC960PD + 0010 DAC960PX + 0050 AcceleRAID 352/170/160 support Device + ba55 eXtremeRAID 1100 support Device + ba56 eXtremeRAID 2000/3000 support Device +106a Aten Research Inc +106b Apple Computer Inc. + 0001 Bandit PowerPC host bridge + 0002 Grand Central I/O + 0003 Control Video + 0004 PlanB Video-In + 0007 O'Hare I/O + 000e Hydra Mac I/O + 0010 Heathrow Mac I/O + 0017 Paddington Mac I/O + 0018 UniNorth FireWire + 0019 KeyLargo USB + 001e UniNorth Internal PCI + 001f UniNorth PCI + 0020 UniNorth AGP + 0021 UniNorth GMAC (Sun GEM) + 0022 KeyLargo Mac I/O + 0024 UniNorth/Pangea GMAC (Sun GEM) + 0025 KeyLargo/Pangea Mac I/O + 0026 KeyLargo/Pangea USB + 0027 UniNorth/Pangea AGP + 0028 UniNorth/Pangea PCI + 0029 UniNorth/Pangea Internal PCI + 002d UniNorth 1.5 AGP + 002e UniNorth 1.5 PCI + 002f UniNorth 1.5 Internal PCI + 0030 UniNorth/Pangea FireWire + 0031 UniNorth 2 FireWire + 0032 UniNorth 2 GMAC (Sun GEM) + 0033 UniNorth 2 ATA/100 + 0034 UniNorth 2 AGP + 1645 Tigon3 Gigabit Ethernet NIC (BCM5701) +106c Hyundai Electronics America + 8801 Dual Pentium ISA/PCI Motherboard + 8802 PowerPC ISA/PCI Motherboard + 8803 Dual Window Graphics Accelerator + 8804 LAN Controller + 8805 100-BaseT LAN +106d Sequent Computer Systems +106e DFI, Inc +106f City Gate Development Ltd +1070 Daewoo Telecom Ltd +1071 Mitac +1072 GIT Co Ltd +1073 Yamaha Corporation + 0001 3D GUI Accelerator + 0002 YGV615 [RPA3 3D-Graphics Controller] + 0003 YMF-740 + 0004 YMF-724 + 1073 0004 YMF724-Based PCI Audio Adapter + 0005 DS1 Audio + 1073 0005 DS-XG PCI Audio CODEC + 0006 DS1 Audio + 0008 DS1 Audio + 1073 0008 DS-XG PCI Audio CODEC + 000a DS1L Audio + 1073 0004 DS-XG PCI Audio CODEC + 1073 000a DS-XG PCI Audio CODEC + 000c YMF-740C [DS-1L Audio Controller] + 107a 000c DS-XG PCI Audio CODEC + 000d YMF-724F [DS-1 Audio Controller] + 1073 000d DS-XG PCI Audio CODEC + 0010 YMF-744B [DS-1S Audio Controller] + 1073 0006 DS-XG PCI Audio CODEC + 1073 0010 DS-XG PCI Audio CODEC + 0012 YMF-754 [DS-1E Audio Controller] + 1073 0012 DS-XG PCI Audio Codec + 0020 DS-1 Audio + 2000 DS2416 Digital Mixing Card + 1073 2000 DS2416 Digital Mixing Card +1074 NexGen Microsystems + 4e78 82c500/1 +1075 Advanced Integrations Research +1076 Chaintech Computer Co. Ltd +1077 QLogic Corp. + 1016 ISP10160 Single Channel Ultra3 SCSI Processor + 1020 ISP1020 Fast-wide SCSI + 1022 ISP1022 Fast-wide SCSI + 1080 ISP1080 SCSI Host Adapter + 1216 ISP12160 Dual Channel Ultra3 SCSI Processor + 101e 8471 QLA12160 on AMI MegaRAID + 101e 8493 QLA12160 on AMI MegaRAID + 1240 ISP1240 SCSI Host Adapter + 1280 ISP1280 + 2020 ISP2020A Fast!SCSI Basic Adapter + 2100 QLA2100 64-bit Fibre Channel Adapter + 1077 0001 QLA2100 64-bit Fibre Channel Adapter + 2200 QLA2200 + 2300 QLA2300 64-bit FC-AL Adapter + 2312 QLA2312 Fibre Channel Adapter +1078 Cyrix Corporation + 0000 5510 [Grappa] + 0001 PCI Master + 0002 5520 [Cognac] + 0100 5530 Legacy [Kahlua] + 0101 5530 SMI [Kahlua] + 0102 5530 IDE [Kahlua] + 0103 5530 Audio [Kahlua] + 0104 5530 Video [Kahlua] + 0400 ZFMicro PCI Bridge + 0401 ZFMicro Chipset SMI + 0402 ZFMicro Chipset IDE + 0403 ZFMicro Expansion Bus +1079 I-Bus +107a NetWorth +107b Gateway 2000 +107c LG Electronics [Lucky Goldstar Co. Ltd] +107d LeadTek Research Inc. + 0000 P86C850 +107e Interphase Corporation + 0001 5515 ATM Adapter [Flipper] + 0002 100 VG AnyLan Controller + 0004 5526 Fibre Channel Host Adapter + 0005 x526 Fibre Channel Host Adapter + 0008 5525/5575 ATM Adapter (155 Mbit) [Atlantic] + 9003 5535-4P-BRI-ST + 9007 5535-4P-BRI-U + 9008 5535-1P-SR + 900c 5535-1P-SR-ST + 900e 5535-1P-SR-U + 9011 5535-1P-PRI + 9013 5535-2P-PRI + 9023 5536-4P-BRI-ST + 9027 5536-4P-BRI-U + 9031 5536-1P-PRI + 9033 5536-2P-PRI +107f Data Technology Corporation + 0802 SL82C105 +1080 Contaq Microsystems + 0600 82C599 + c691 Cypress CY82C691 + c693 82c693 +1081 Supermac Technology + 0d47 Radius PCI to NuBUS Bridge +1082 EFA Corporation of America +1083 Forex Computer Corporation + 0001 FR710 +1084 Parador +1085 Tulip Computers Int.B.V. +1086 J. Bond Computer Systems +1087 Cache Computer +1088 Microcomputer Systems (M) Son +1089 Data General Corporation +# Formerly Bit3 Computer Corp. +108a SBS Technologies + 0001 VME Bridge Model 617 + 0010 VME Bridge Model 618 + 0040 dataBLIZZARD + 3000 VME Bridge Model 2706 +108c Oakleigh Systems Inc. +108d Olicom + 0001 Token-Ring 16/4 PCI Adapter (3136/3137) + 0002 16/4 Token Ring + 0004 RapidFire 3139 Token-Ring 16/4 PCI Adapter + 108d 0004 OC-3139/3140 RapidFire Token-Ring 16/4 Adapter + 0005 GoCard 3250 Token-Ring 16/4 CardBus PC Card + 0006 OC-3530 RapidFire Token-Ring 100 + 0007 RapidFire 3141 Token-Ring 16/4 PCI Fiber Adapter + 108d 0007 OC-3141 RapidFire Token-Ring 16/4 Adapter + 0008 RapidFire 3540 HSTR 100/16/4 PCI Adapter + 108d 0008 OC-3540 RapidFire HSTR 100/16/4 Adapter + 0011 OC-2315 + 0012 OC-2325 + 0013 OC-2183/2185 + 0014 OC-2326 + 0019 OC-2327/2250 10/100 Ethernet Adapter + 108d 0016 OC-2327 Rapidfire 10/100 Ethernet Adapter + 108d 0017 OC-2250 GoCard 10/100 Ethernet Adapter + 0021 OC-6151/6152 [RapidFire ATM 155] + 0022 ATM Adapter +108e Sun Microsystems Computer Corp. + 0001 EBUS + 1000 EBUS + 1001 Happy Meal + 1100 RIO EBUS + 1101 RIO GEM + 1102 RIO 1394 + 1103 RIO USB + 2bad GEM + 5000 Simba Advanced PCI Bridge + 5043 SunPCI Co-processor + 8000 Psycho PCI Bus Module + 8001 Schizo PCI Bus Module + a000 Ultra IIi + a001 Ultra IIe +108f Systemsoft +1090 Encore Computer Corporation +1091 Intergraph Corporation + 0020 3D graphics processor + 0021 3D graphics processor w/Texturing + 0040 3D graphics frame buffer + 0041 3D graphics frame buffer + 0060 Proprietary bus bridge + 00e4 Powerstorm 4D50T + 0720 Motion JPEG codec +1092 Diamond Multimedia Systems + 00a0 Speedstar Pro SE + 00a8 Speedstar 64 + 0550 Viper V550 + 08d4 Supra 2260 Modem + 094c SupraExpress 56i Pro + 1092 Viper V330 + 6120 Maximum DVD + 8810 Stealth SE + 8811 Stealth 64/SE + 8880 Stealth + 8881 Stealth + 88b0 Stealth 64 + 88b1 Stealth 64 + 88c0 Stealth 64 + 88c1 Stealth 64 + 88d0 Stealth 64 + 88d1 Stealth 64 + 88f0 Stealth 64 + 88f1 Stealth 64 + 9999 DMD-I0928-1 "Monster sound" sound chip +1093 National Instruments + 0160 PCI-DIO-96 + 0162 PCI-MIO-16XE-50 + 1170 PCI-MIO-16XE-10 + 1180 PCI-MIO-16E-1 + 1190 PCI-MIO-16E-4 + 1330 PCI-6031E + 1350 PCI-6071E + 2a60 PCI-6023E + b001 IMAQ-PCI-1408 + b011 IMAQ-PXI-1408 + b021 IMAQ-PCI-1424 + b031 IMAQ-PCI-1413 + b041 IMAQ-PCI-1407 + b051 IMAQ-PXI-1407 + b061 IMAQ-PCI-1411 + b071 IMAQ-PCI-1422 + b081 IMAQ-PXI-1422 + b091 IMAQ-PXI-1411 + c801 PCI-GPIB + c831 PCI-GPIB bridge +1094 First International Computers [FIC] +1095 CMD Technology Inc + 0640 PCI0640 + 0643 PCI0643 + 0646 PCI0646 + 0647 PCI0647 + 0648 PCI0648 + 0649 PCI0649 + 0e11 005d Integrated Ultra ATA-100 Dual Channel Controller + 0e11 007e Integrated Ultra ATA-100 IDE RAID Controller + 101e 0649 AMI MegaRAID IDE 100 Controller + 0650 PBC0650A + 0670 USB0670 + 1095 0670 USB0670 + 0673 USB0673 + 0680 PCI0680 + 3112 Silicon Image SiI 3112 SATARaid Controller +1096 Alacron +1097 Appian Technology +1098 Quantum Designs (H.K.) Ltd + 0001 QD-8500 + 0002 QD-8580 +1099 Samsung Electronics Co., Ltd +109a Packard Bell +109b Gemlight Computer Ltd. +109c Megachips Corporation +109d Zida Technologies Ltd. +109e Brooktree Corporation + 0350 Bt848 Video Capture + 0351 Bt849A Video capture + 0369 Bt878 Video Capture + 1002 0001 TV-Wonder + 1002 0003 TV-Wonder/VE + 036c Bt879(??) Video Capture + 13e9 0070 Win/TV (Video Section) + 036e Bt878 Video Capture + 0070 13eb WinTV Series + 0070 ff01 Viewcast Osprey 200 + 107d 6606 WinFast TV 2000 + 11bd 0012 PCTV pro (TV + FM stereo receiver) + 11bd 001c PCTV Sat (DBC receiver) + 127a 0001 Bt878 Mediastream Controller NTSC + 127a 0002 Bt878 Mediastream Controller PAL BG + 127a 0003 Bt878a Mediastream Controller PAL BG + 127a 0048 Bt878/832 Mediastream Controller + 144f 3000 MagicTView CPH060 - Video + 1461 0004 AVerTV WDM Video Capture + 14f1 0001 Bt878 Mediastream Controller NTSC + 14f1 0002 Bt878 Mediastream Controller PAL BG + 14f1 0003 Bt878a Mediastream Controller PAL BG + 14f1 0048 Bt878/832 Mediastream Controller + 1851 1850 FlyVideo'98 - Video + 1851 1851 FlyVideo II + 1852 1852 FlyVideo'98 - Video (with FM Tuner) + bd11 1200 PCTV pro (TV + FM stereo receiver) + 036f Bt879 Video Capture + 127a 0044 Bt879 Video Capture NTSC + 127a 0122 Bt879 Video Capture PAL I + 127a 0144 Bt879 Video Capture NTSC + 127a 0222 Bt879 Video Capture PAL BG + 127a 0244 Bt879a Video Capture NTSC + 127a 0322 Bt879 Video Capture NTSC + 127a 0422 Bt879 Video Capture NTSC + 127a 1122 Bt879 Video Capture PAL I + 127a 1222 Bt879 Video Capture PAL BG + 127a 1322 Bt879 Video Capture NTSC + 127a 1522 Bt879a Video Capture PAL I + 127a 1622 Bt879a Video Capture PAL BG + 127a 1722 Bt879a Video Capture NTSC + 14f1 0044 Bt879 Video Capture NTSC + 14f1 0122 Bt879 Video Capture PAL I + 14f1 0144 Bt879 Video Capture NTSC + 14f1 0222 Bt879 Video Capture PAL BG + 14f1 0244 Bt879a Video Capture NTSC + 14f1 0322 Bt879 Video Capture NTSC + 14f1 0422 Bt879 Video Capture NTSC + 14f1 1122 Bt879 Video Capture PAL I + 14f1 1222 Bt879 Video Capture PAL BG + 14f1 1322 Bt879 Video Capture NTSC + 14f1 1522 Bt879a Video Capture PAL I + 14f1 1622 Bt879a Video Capture PAL BG + 14f1 1722 Bt879a Video Capture NTSC + 1851 1850 FlyVideo'98 - Video + 1851 1851 FlyVideo II + 1852 1852 FlyVideo'98 - Video (with FM Tuner) + 0370 Bt880 Video Capture + 1851 1850 FlyVideo'98 + 1851 1851 FlyVideo'98 EZ - video + 1852 1852 FlyVideo'98 (with FM Tuner) + 0878 Bt878 Audio Capture + 0070 13eb WinTV Series + 0070 ff01 Viewcast Osprey 200 + 1002 0001 TV-Wonder + 1002 0003 TV-Wonder/VE + 11bd 0012 PCTV pro (TV + FM stereo receiver, audio section) + 11bd 001c PCTV Sat (DBC receiver) + 127a 0001 Bt878 Video Capture (Audio Section) + 127a 0002 Bt878 Video Capture (Audio Section) + 127a 0003 Bt878 Video Capture (Audio Section) + 127a 0048 Bt878 Video Capture (Audio Section) + 13e9 0070 Win/TV (Audio Section) + 144f 3000 MagicTView CPH060 - Audio + 1461 0004 AVerTV WDM Audio Capture + 14f1 0001 Bt878 Video Capture (Audio Section) + 14f1 0002 Bt878 Video Capture (Audio Section) + 14f1 0003 Bt878 Video Capture (Audio Section) + 14f1 0048 Bt878 Video Capture (Audio Section) + bd11 1200 PCTV pro (TV + FM stereo receiver, audio section) + 0879 Bt879 Audio Capture + 127a 0044 Bt879 Video Capture (Audio Section) + 127a 0122 Bt879 Video Capture (Audio Section) + 127a 0144 Bt879 Video Capture (Audio Section) + 127a 0222 Bt879 Video Capture (Audio Section) + 127a 0244 Bt879 Video Capture (Audio Section) + 127a 0322 Bt879 Video Capture (Audio Section) + 127a 0422 Bt879 Video Capture (Audio Section) + 127a 1122 Bt879 Video Capture (Audio Section) + 127a 1222 Bt879 Video Capture (Audio Section) + 127a 1322 Bt879 Video Capture (Audio Section) + 127a 1522 Bt879 Video Capture (Audio Section) + 127a 1622 Bt879 Video Capture (Audio Section) + 127a 1722 Bt879 Video Capture (Audio Section) + 14f1 0044 Bt879 Video Capture (Audio Section) + 14f1 0122 Bt879 Video Capture (Audio Section) + 14f1 0144 Bt879 Video Capture (Audio Section) + 14f1 0222 Bt879 Video Capture (Audio Section) + 14f1 0244 Bt879 Video Capture (Audio Section) + 14f1 0322 Bt879 Video Capture (Audio Section) + 14f1 0422 Bt879 Video Capture (Audio Section) + 14f1 1122 Bt879 Video Capture (Audio Section) + 14f1 1222 Bt879 Video Capture (Audio Section) + 14f1 1322 Bt879 Video Capture (Audio Section) + 14f1 1522 Bt879 Video Capture (Audio Section) + 14f1 1622 Bt879 Video Capture (Audio Section) + 14f1 1722 Bt879 Video Capture (Audio Section) + 0880 Bt880 Audio Capture + 2115 BtV 2115 Mediastream controller + 2125 BtV 2125 Mediastream controller + 2164 BtV 2164 + 2165 BtV 2165 + 8230 Bt8230 ATM Segment/Reassembly Ctrlr (SRC) + 8472 Bt8472 + 8474 Bt8474 +109f Trigem Computer Inc. +10a0 Meidensha Corporation +10a1 Juko Electronics Ind. Co. Ltd +10a2 Quantum Corporation +10a3 Everex Systems Inc +10a4 Globe Manufacturing Sales +10a5 Smart Link Ltd. + 5449 SmartPCI561 modem +10a6 Informtech Industrial Ltd. +10a7 Benchmarq Microelectronics +10a8 Sierra Semiconductor + 0000 STB Horizon 64 +10a9 Silicon Graphics, Inc. + 0001 Crosstalk to PCI Bridge + 0002 Linc I/O controller + 0003 IOC3 I/O controller + 0004 O2 MACE + 0005 RAD Audio + 0006 HPCEX + 0007 RPCEX + 0008 DiVO VIP + 0009 Alteon Gigabit Ethernet + 0010 AMP Video I/O + 0011 GRIP + 0012 SGH PSHAC GSN + 1001 Magic Carpet + 1002 Lithium + 1003 Dual JPEG 1 + 1004 Dual JPEG 2 + 1005 Dual JPEG 3 + 1006 Dual JPEG 4 + 1007 Dual JPEG 5 + 1008 Cesium + 2001 Fibre Channel + 2002 ASDE + 8001 O2 1394 + 8002 G-net NT +10aa ACC Microelectronics + 0000 ACCM 2188 +10ab Digicom +10ac Honeywell IAC +10ad Symphony Labs + 0001 W83769F + 0003 SL82C103 + 0005 SL82C105 + 0103 SL82c103 + 0105 SL82c105 + 0565 W83C553 +10ae Cornerstone Technology +10af Micro Computer Systems Inc +10b0 CardExpert Technology +10b1 Cabletron Systems Inc +10b2 Raytheon Company +10b3 Databook Inc + 3106 DB87144 + b106 DB87144 +10b4 STB Systems Inc + 1b1d Velocity 128 3D + 10b4 237e Velocity 4400 +10b5 PLX Technology, Inc. + 0001 i960 PCI bus interface + 1076 VScom 800 8 port serial adaptor + 1077 VScom 400 4 port serial adaptor + 1078 VScom 210 2 port serial and 1 port parallel adaptor + 1103 VScom 200 2 port serial adaptor + 1146 VScom 010 1 port parallel adaptor + 1147 VScom 020 2 port parallel adaptor + 2724 Thales PCSM Security Card + 9030 PCI <-> IOBus Bridge Hot Swap + 15ed 1002 MCCS 8-port Serial Hot Swap + 15ed 1003 MCCS 16-port Serial Hot Swap + 9036 9036 + 9050 PCI <-> IOBus Bridge + 10b5 2036 SatPak GPS + 10b5 2273 SH-ARC SoHard ARCnet card + 10b5 9050 MP9050 + 1522 0001 RockForce 4 Port V.90 Data/Fax/Voice Modem + 1522 0002 RockForce 2 Port V.90 Data/Fax/Voice Modem + 1522 0003 RockForce 6 Port V.90 Data/Fax/Voice Modem + 1522 0004 RockForce 8 Port V.90 Data/Fax/Voice Modem + 1522 0010 RockForce2000 4 Port V.90 Data/Fax/Voice Modem + 1522 0020 RockForce2000 2 Port V.90 Data/Fax/Voice Modem + 15ed 1000 Macrolink MCCS 8-port Serial + 15ed 1001 Macrolink MCCS 16-port Serial + 15ed 1002 Macrolink MCCS 8-port Serial Hot Swap + 15ed 1003 Macrolink MCCS 16-port Serial Hot Swap + 5654 5634 OpenLine4 Telephony Card + d531 c002 PCIntelliCAN 2xSJA1000 CAN bus + d84d 4006 EX-4006 1P + d84d 4008 EX-4008 1P EPP/ECP + d84d 4014 EX-4014 2P + d84d 4018 EX-4018 3P EPP/ECP + d84d 4025 EX-4025 1S(16C550) RS-232 + d84d 4027 EX-4027 1S(16C650) RS-232 + d84d 4028 EX-4028 1S(16C850) RS-232 + d84d 4036 EX-4036 2S(16C650) RS-232 + d84d 4037 EX-4037 2S(16C650) RS-232 + d84d 4038 EX-4038 2S(16C850) RS-232 + d84d 4052 EX-4052 1S(16C550) RS-422/485 + d84d 4053 EX-4053 2S(16C550) RS-422/485 + d84d 4055 EX-4055 4S(16C550) RS-232 + d84d 4058 EX-4055 4S(16C650) RS-232 + d84d 4065 EX-4065 8S(16C550) RS-232 + d84d 4068 EX-4068 8S(16C650) RS-232 + d84d 4078 EX-4078 2S(16C552) RS-232+1P + 9054 PCI <-> IOBus Bridge + 10b5 2455 Wessex Techology PHIL-PCI + 9060 9060 + 906d 9060SD + 125c 0640 Aries 16000P + 906e 9060ES + 9080 9080 + 10b5 9080 9080 [real subsystem ID not set] + 129d 0002 Aculab PCI Prosidy card +10b6 Madge Networks + 0001 Smart 16/4 PCI Ringnode + 0002 Smart 16/4 PCI Ringnode Mk2 + 10b6 0002 Smart 16/4 PCI Ringnode Mk2 + 10b6 0006 16/4 CardBus Adapter + 0003 Smart 16/4 PCI Ringnode Mk3 + 0e11 b0fd Compaq NC4621 PCI, 4/16, WOL + 10b6 0003 Smart 16/4 PCI Ringnode Mk3 + 10b6 0007 Presto PCI Plus Adapter + 0004 Smart 16/4 PCI Ringnode Mk1 + 0006 16/4 Cardbus Adapter + 10b6 0006 16/4 CardBus Adapter + 0007 Presto PCI Adapter + 10b6 0007 Presto PCI + 0009 Smart 100/16/4 PCI-HS Ringnode + 10b6 0009 Smart 100/16/4 PCI-HS Ringnode + 000a Smart 100/16/4 PCI Ringnode + 10b6 000a Smart 100/16/4 PCI Ringnode + 000b 16/4 CardBus Adapter Mk2 + 10b6 0008 16/4 CardBus Adapter Mk2 + 10b6 000b 16/4 Cardbus Adapter Mk2 + 000c RapidFire 3140V2 16/4 TR Adapter + 10b6 000c RapidFire 3140V2 16/4 TR Adapter + 1000 Collage 25/155 ATM Client Adapter + 1001 Collage 155 ATM Server Adapter +10b7 3Com Corporation + 0001 3c985 1000BaseSX (SX/TX) + 1006 MINI PCI type 3B Data Fax Modem + 1007 Mini PCI 56k Winmodem + 10b7 615c Mini PCI 56K Modem + 3390 3c339 TokenLink Velocity + 3590 3c359 TokenLink Velocity XL + 10b7 3590 TokenLink Velocity XL Adapter (3C359/359B) + 4500 3c450 Cyclone/unknown + 5055 3c555 Laptop Hurricane + 5057 3c575 [Megahertz] 10/100 LAN CardBus + 10b7 5a57 3C575 Megahertz 10/100 LAN Cardbus PC Card + 5157 3c575 [Megahertz] 10/100 LAN CardBus + 10b7 5b57 3C575 Megahertz 10/100 LAN Cardbus PC Card + 5257 3CCFE575CT Cyclone CardBus + 10b7 5c57 FE575C-3Com 10/100 LAN CardBus-Fast Ethernet + 5900 3c590 10BaseT [Vortex] + 5920 3c592 EISA 10mbps Demon/Vortex + 5950 3c595 100BaseTX [Vortex] + 5951 3c595 100BaseT4 [Vortex] + 5952 3c595 100Base-MII [Vortex] + 5970 3c597 EISA Fast Demon/Vortex + 5b57 3c595 [Megahertz] 10/100 LAN CardBus + 10b7 5b57 3C575 Megahertz 10/100 LAN Cardbus PC Card + 6055 3c556 Hurricane CardBus + 6056 3c556B Hurricane CardBus + 10b7 6556 10/100 Mini PCI Ethernet Adapter + 6560 3CCFE656 Cyclone CardBus + 10b7 656a 3CCFEM656 10/100 LAN+56K Modem CardBus + 6561 3CCFEM656 10/100 LAN+56K Modem CardBus + 10b7 656b 3CCFEM656 10/100 LAN+56K Modem CardBus + 6562 3CCFEM656 [id 6562] Cyclone CardBus + 10b7 656b 3CCFEM656B 10/100 LAN+56K Modem CardBus + 6563 3CCFEM656B 10/100 LAN+56K Modem CardBus + 10b7 656b 3CCFEM656 10/100 LAN+56K Modem CardBus + 6564 3CCFEM656 [id 6564] Cyclone CardBus + 7646 3cSOHO100-TX Hurricane + 7940 3c803 FDDILink UTP Controller + 7980 3c804 FDDILink SAS Controller + 7990 3c805 FDDILink DAS Controller + 8811 Token ring + 9000 3c900 10BaseT [Boomerang] + 9001 3c900 Combo [Boomerang] + 9004 3c900B-TPO [Etherlink XL TPO] + 10b7 9004 3C900B-TPO Etherlink XL TPO 10Mb + 9005 3c900B-Combo [Etherlink XL Combo] + 10b7 9005 3C900B-Combo Etherlink XL Combo + 9006 3c900B-TPC [Etherlink XL TPC] + 900a 3c900B-FL [Etherlink XL FL] + 9050 3c905 100BaseTX [Boomerang] + 9051 3c905 100BaseT4 [Boomerang] + 9055 3c905B 100BaseTX [Cyclone] + 1028 0080 3C905B Fast Etherlink XL 10/100 + 1028 0081 3C905B Fast Etherlink XL 10/100 + 1028 0082 3C905B Fast Etherlink XL 10/100 + 1028 0083 3C905B Fast Etherlink XL 10/100 + 1028 0084 3C905B Fast Etherlink XL 10/100 + 1028 0085 3C905B Fast Etherlink XL 10/100 + 1028 0086 3C905B Fast Etherlink XL 10/100 + 1028 0087 3C905B Fast Etherlink XL 10/100 + 1028 0088 3C905B Fast Etherlink XL 10/100 + 1028 0089 3C905B Fast Etherlink XL 10/100 + 1028 0090 3C905B Fast Etherlink XL 10/100 + 1028 0091 3C905B Fast Etherlink XL 10/100 + 1028 0092 3C905B Fast Etherlink XL 10/100 + 1028 0093 3C905B Fast Etherlink XL 10/100 + 1028 0094 3C905B Fast Etherlink XL 10/100 + 1028 0095 3C905B Fast Etherlink XL 10/100 + 1028 0096 3C905B Fast Etherlink XL 10/100 + 1028 0097 3C905B Fast Etherlink XL 10/100 + 1028 0098 3C905B Fast Etherlink XL 10/100 + 1028 0099 3C905B Fast Etherlink XL 10/100 + 10b7 9055 3C905B Fast Etherlink XL 10/100 + 9056 3c905B-T4 [Fast EtherLink XL 10/100] + 9058 3c905B-Combo [Deluxe Etherlink XL 10/100] + 905a 3c905B-FX [Fast Etherlink XL FX 10/100] + 9200 3c905C-TX/TX-M [Tornado] + 1028 0095 Integrated 3C905C-TX Fast Etherlink for PC Management NIC + 10b7 1000 3C905C-TX Fast Etherlink for PC Management NIC + 10b7 7000 10/100 Mini PCI Ethernet Adapter + 9201 3C920B-EMB Integrated Fast Ethernet Controller + 9300 3CSOHO100B-TX [910-A01] + 9800 3c980-TX [Fast Etherlink XL Server Adapter] + 10b7 9800 3c980-TX Fast Etherlink XL Server Adapter + 9805 3c980-TX 10/100baseTX NIC [Python-T] + 10b7 1201 3c982-TXM 10/100baseTX Dual Port A [Hydra] + 10b7 1202 3c982-TXM 10/100baseTX Dual Port B [Hydra] + 10b7 9805 3c980 10/100baseTX NIC [Python-T] + 10f1 2462 Thunder K7 S2462 + 9900 3C990-TX [Typhoon] + 9902 3CR990-TX-95 [Typhoon 56-bit] + 9903 3CR990-TX-97 [Typhoon 168-bit] + 9904 3C990B-TX-M/3C990BSVR [Typhoon2] + 10b7 1000 3CR990B-TX-M [Typhoon2] + 10b7 2000 3CR990BSVR [Typhoon2 Server] + 9905 3CR990-FX-95/97/95 [Typhon Fiber] + 10b7 1101 3CR990-FX-95 [Typhoon Fiber 56-bit] + 10b7 1102 3CR990-FX-97 [Typhoon Fiber 168-bit] + 10b7 2101 3CR990-FX-95 Server [Typhoon Fiber 56-bit] + 10b7 2102 3CR990-FX-97 Server [Typhoon Fiber 168-bit] + 9908 3CR990SVR95 [Typhoon Server 56-bit] + 9909 3CR990SVR97 [Typhoon Server 168-bit] + 990b 3C990SVR [Typhoon Server] +10b8 Standard Microsystems Corp [SMC] + 0005 83C170QF + 1055 e000 LANEPIC 10/100 [EVB171Q-PCI] + 1055 e002 LANEPIC 10/100 [EVB171G-PCI] + 10b8 a011 EtherPower II 10/100 + 10b8 a014 EtherPower II 10/100 + 10b8 a015 EtherPower II 10/100 + 10b8 a016 EtherPower II 10/100 + 10b8 a017 EtherPower II 10/100 + 0006 LANEPIC + 1055 e100 LANEPIC Cardbus Fast Ethernet Adapter + 1055 e102 LANEPIC Cardbus Fast Ethernet Adapter + 1055 e300 LANEPIC Cardbus Fast Ethernet Adapter + 1055 e302 LANEPIC Cardbus Fast Ethernet Adapter + 10b8 a012 LANEPIC Cardbus Fast Ethernet Adapter + 13a2 8002 LANEPIC Cardbus Fast Ethernet Adapter + 13a2 8006 LANEPIC Cardbus Fast Ethernet Adapter + 1000 FDC 37c665 + 1001 FDC 37C922 + a011 83C170QF + b106 SMC34C90 +10b9 ALi Corporation + 0111 C-Media CMI8738/C3DX Audio Device (OEM) + 10b9 0111 C-Media CMI8738/C3DX Audio Device (OEM) + 1435 M1435 + 1445 M1445 + 1449 M1449 + 1451 M1451 + 1461 M1461 + 1489 M1489 + 1511 M1511 [Aladdin] + 1512 M1512 [Aladdin] + 1513 M1513 [Aladdin] + 1521 M1521 [Aladdin III] + 10b9 1521 ALI M1521 Aladdin III CPU Bridge + 1523 M1523 + 10b9 1523 ALI M1523 ISA Bridge + 1531 M1531 [Aladdin IV] + 1533 M1533 PCI to ISA Bridge [Aladdin IV] + 10b9 1533 ALI M1533 Aladdin IV ISA Bridge + 1541 M1541 + 10b9 1541 ALI M1541 Aladdin V/V+ AGP System Controller + 1543 M1543 + 1563 M1563 HyperTransport South Bridge + 1621 M1621 + 1631 ALI M1631 PCI North Bridge Aladdin Pro III + 1632 M1632M Northbridge+Trident + 1641 ALI M1641 PCI North Bridge Aladdin Pro IV + 1644 M1644/M1644T Northbridge+Trident + 1646 M1646 Northbridge+Trident + 1647 M1647 Northbridge [MAGiK 1 / MobileMAGiK 1] + 1651 M1651/M1651T Northbridge [Aladdin-Pro 5/5M,Aladdin-Pro 5T/5TM] + 1671 M1671 Super P4 Northbridge [AGP4X,PCI and SDR/DDR] + 1681 M1681 P4 Northbridge [AGP8X,HyperTransport and SDR/DDR] + 1687 M1687 K8 Northbridge [AGP8X and HyperTransport] + 3141 M3141 + 3143 M3143 + 3145 M3145 + 3147 M3147 + 3149 M3149 + 3151 M3151 + 3307 M3307 + 3309 M3309 + 5212 M4803 + 5215 MS4803 + 5217 M5217H + 5219 M5219 + 5225 M5225 + 5229 M5229 IDE + 1043 8053 A7A266 Motherboard IDE + 5235 M5225 + 5237 USB 1.1 Controller + 5239 USB 2.0 Controller + 5243 M1541 PCI to AGP Controller + 5247 PCI to AGP Controller + 5249 M5249 HTT to PCI Bridge + 5251 M5251 P1394 OHCI 1.0 Controller + 5253 M5253 P1394 OHCI 1.1 Controller + 5261 M5261 Ethernet Controller + 5451 M5451 PCI AC-Link Controller Audio Device + 1014 0506 ThinkPad R30 + 5453 M5453 PCI AC-Link Controller Modem Device + 5455 M5455 PCI AC-Link Controller Audio Device + 5457 Intel 537 [M5457 AC-Link Modem] +# Same but more usefull for driver's lookup + 5459 SmartLink SmartPCI561 56K Modem +# SmartLink PCI SoftModem + 545a SmartLink SmartPCI563 56K Modem + 5471 M5471 Memory Stick Controller + 5473 M5473 SD-MMC Controller + 7101 M7101 PMU + 10b9 7101 ALI M7101 Power Management Controller +10ba Mitsubishi Electric Corp. + 0301 AccelGraphics AccelECLIPSE +10bb Dapha Electronics Corporation +10bc Advanced Logic Research +10bd Surecom Technology + 0e34 NE-34 +10be Tseng Labs International Co. +10bf Most Inc +10c0 Boca Research Inc. +10c1 ICM Co., Ltd. +10c2 Auspex Systems Inc. +10c3 Samsung Semiconductors, Inc. + 1100 Smartether100 SC1100 LAN Adapter (i82557B) +10c4 Award Software International Inc. +10c5 Xerox Corporation +10c6 Rambus Inc. +10c7 Media Vision +10c8 Neomagic Corporation + 0001 NM2070 [MagicGraph 128] + 0002 NM2090 [MagicGraph 128V] + 0003 NM2093 [MagicGraph 128ZV] + 0004 NM2160 [MagicGraph 128XD] + 1014 00ba MagicGraph 128XD + 1025 1007 MagicGraph 128XD + 1028 0074 MagicGraph 128XD + 1028 0075 MagicGraph 128XD + 1028 007d MagicGraph 128XD + 1028 007e MagicGraph 128XD + 1033 802f MagicGraph 128XD + 104d 801b MagicGraph 128XD + 104d 802f MagicGraph 128XD + 104d 830b MagicGraph 128XD + 10ba 0e00 MagicGraph 128XD + 10c8 0004 MagicGraph 128XD + 10cf 1029 MagicGraph 128XD + 10f7 8308 MagicGraph 128XD + 10f7 8309 MagicGraph 128XD + 10f7 830b MagicGraph 128XD + 10f7 830d MagicGraph 128XD + 10f7 8312 MagicGraph 128XD + 0005 NM2200 [MagicGraph 256AV] + 1014 00dd ThinkPad 570 + 0006 NM2360 [MagicMedia 256ZX] + 0016 NM2380 [MagicMedia 256XL+] + 10c8 0016 MagicMedia 256XL+ + 0025 NM2230 [MagicGraph 256AV+] + 0083 NM2093 [MagicGraph 128ZV+] + 8005 NM2200 [MagicMedia 256AV Audio] + 0e11 b0d1 MagicMedia 256AV Audio Device on Discovery + 0e11 b126 MagicMedia 256AV Audio Device on Durango + 1014 00dd MagicMedia 256AV Audio Device on BlackTip Thinkpad + 1025 1003 MagicMedia 256AV Audio Device on TravelMate 720 + 1028 008f MagicMedia 256AV Audio Device on Colorado Inspiron + 103c 0007 MagicMedia 256AV Audio Device on Voyager II + 103c 0008 MagicMedia 256AV Audio Device on Voyager III + 103c 000d MagicMedia 256AV Audio Device on Omnibook 900 + 10c8 8005 MagicMedia 256AV Audio Device on FireAnt + 110a 8005 MagicMedia 256AV Audio Device + 14c0 0004 MagicMedia 256AV Audio Device + 8006 NM2360 [MagicMedia 256ZX Audio] + 8016 NM2380 [MagicMedia 256XL+ Audio] +10c9 Dataexpert Corporation +10ca Fujitsu Microelectr., Inc. +10cb Omron Corporation +10cc Mentor ARC Inc +10cd Advanced System Products, Inc + 1100 ASC1100 + 1200 ASC1200 [(abp940) Fast SCSI-II] + 1300 ABP940-U / ABP960-U + 10cd 1310 ASC1300 SCSI Adapter + 2300 ABP940-UW + 2500 ABP940-U2W +10ce Radius +10cf Citicorp TTI + 2001 mb86605 +10d0 Fujitsu Limited +10d1 FuturePlus Systems Corp. +10d2 Molex Incorporated +10d3 Jabil Circuit Inc +10d4 Hualon Microelectronics +10d5 Autologic Inc. +10d6 Cetia +10d7 BCM Advanced Research +10d8 Advanced Peripherals Labs +10d9 Macronix, Inc. [MXIC] + 0512 MX98713 + 0531 MX987x5 + 1186 1200 DFE-540TX ProFAST 10/100 Adapter + 8625 MX86250 + 8888 MX86200 +10da Compaq IPG-Austin + 0508 TC4048 Token Ring 4/16 + 3390 Tl3c3x9 +10db Rohm LSI Systems, Inc. +10dc CERN/ECP/EDU + 0001 STAR/RD24 SCI-PCI (PMC) + 0002 TAR/RD24 SCI-PCI (PMC) + 0021 HIPPI destination + 0022 HIPPI source + 10dc ATT2C15-3 FPGA +10dd Evans & Sutherland +10de nVidia Corporation + 0008 NV1 [EDGE 3D] + 0009 NV1 [EDGE 3D] + 0010 NV2 [Mutara V08] + 0020 NV4 [RIVA TNT] + 1043 0200 V3400 TNT + 1048 0c18 Erazor II SGRAM + 1048 0c1b Erazor II + 1092 0550 Viper V550 + 1092 0552 Viper V550 + 1092 4804 Viper V550 + 1092 4808 Viper V550 + 1092 4810 Viper V550 + 1092 4812 Viper V550 + 1092 4815 Viper V550 + 1092 4820 Viper V550 with TV out + 1092 4822 Viper V550 + 1092 4904 Viper V550 + 1092 4914 Viper V550 + 1092 8225 Viper V550 + 10b4 273d Velocity 4400 + 10b4 273e Velocity 4400 + 10b4 2740 Velocity 4400 + 10de 0020 Riva TNT + 1102 1015 Graphics Blaster CT6710 + 1102 1016 Graphics Blaster RIVA TNT + 0028 NV5 [RIVA TNT2/TNT2 Pro] + 1043 0200 AGP-V3800 SGRAM + 1043 0201 AGP-V3800 SDRAM + 1043 0205 PCI-V3800 + 1043 4000 AGP-V3800PRO + 1092 4804 Viper V770 + 1092 4a00 Viper V770 + 1092 4a02 Viper V770 Ultra + 1092 5a00 RIVA TNT2/TNT2 Pro + 1092 6a02 Viper V770 Ultra + 1092 7a02 Viper V770 Ultra + 10de 0005 RIVA TNT2 Pro + 10de 000f Compaq NVIDIA TNT2 Pro + 1102 1020 3D Blaster RIVA TNT2 + 1102 1026 3D Blaster RIVA TNT2 Digital + 14af 5810 Maxi Gamer Xentor + 0029 NV5 [RIVA TNT2 Ultra] + 1043 0200 AGP-V3800 Deluxe + 1043 0201 AGP-V3800 Ultra SDRAM + 1043 0205 PCI-V3800 Ultra + 1102 1021 3D Blaster RIVA TNT2 Ultra + 1102 1029 3D Blaster RIVA TNT2 Ultra + 1102 102f 3D Blaster RIVA TNT2 Ultra + 14af 5820 Maxi Gamer Xentor 32 + 002a NV5 [Riva TnT2] + 002b NV5 [Riva TnT2] + 002c NV6 [Vanta/Vanta LT] + 1043 0200 AGP-V3800 Combat SDRAM + 1043 0201 AGP-V3800 Combat + 1092 6820 Viper V730 + 1102 1031 CT6938 VANTA 8MB + 1102 1034 CT6894 VANTA 16MB + 14af 5008 Maxi Gamer Phoenix 2 + 002d NV5M64 [RIVA TNT2 Model 64/Model 64 Pro] + 1043 0200 AGP-V3800M + 1043 0201 AGP-V3800M + 1048 0c3a Erazor III LT + 10de 001e M64 AGP4x + 1102 1023 CT6892 RIVA TNT2 Value + 1102 1024 CT6932 RIVA TNT2 Value 32Mb + 1102 102c CT6931 RIVA TNT2 Value [Jumper] + 1462 8808 MSI-8808 + 1554 1041 PixelView RIVA TNT2 M64 32MB + 002e NV6 [Vanta] + 002f NV6 [Vanta] + 0060 nForce2 ISA Bridge + 1043 80ad A7N8X Mainboard + 0064 nForce2 SMBus (MCP) + 0065 nForce2 IDE + 0066 nForce2 Ethernet Controller + 0067 nForce2 USB Controller + 1043 0c11 A7N8X Mainboard + 0068 nForce2 USB Controller + 1043 0c11 A7N8X Mainboard + 006a nForce2 AC97 Audio Controler (MCP) + 006b nForce MultiMedia audio [Via VT82C686B] + 006e nForce2 FireWire (IEEE 1394) Controller + 00a0 NV5 [Aladdin TNT2] + 14af 5810 Maxi Gamer Xentor + 0100 NV10 [GeForce 256 SDR] + 1043 0200 AGP-V6600 SGRAM + 1043 0201 AGP-V6600 SDRAM + 1043 4008 AGP-V6600 SGRAM + 1043 4009 AGP-V6600 SDRAM + 1102 102d CT6941 GeForce 256 + 14af 5022 3D Prophet SE + 0101 NV10DDR [GeForce 256 DDR] + 1043 0202 AGP-V6800 DDR + 1043 400a AGP-V6800 DDR SGRAM + 1043 400b AGP-V6800 DDR SDRAM + 1102 102e CT6971 GeForce 256 DDR + 14af 5021 3D Prophet DDR-DVI + 0103 NV10GL [Quadro] + 0110 NV11 [GeForce2 MX/MX 400] + 1043 4015 AGP-V7100 Pro + 1043 4031 V7100 Pro with TV output + 1462 8817 MSI GeForce2 MX400 Pro32S [MS-8817] + 14af 7102 3D Prophet II MX + 14af 7103 3D Prophet II MX Dual-Display + 0111 NV11DDR [GeForce2 MX 100 DDR/200 DDR] + 0112 NV11 [GeForce2 Go] + 0113 NV11GL [Quadro2 MXR/EX] + 0150 NV15 [GeForce2 GTS/Pro] + 1043 4016 V7700 AGP Video Card + 107d 2840 WinFast GeForce2 GTS with TV output + 1462 8831 Creative GeForce2 Pro + 0151 NV15DDR [GeForce2 Ti] + 1043 405f V7700Ti + 0152 NV15BR [GeForce2 Ultra, Bladerunner] + 1048 0c56 GLADIAC Ultra + 0153 NV15GL [Quadro2 Pro] + 0170 NV17 [GeForce4 MX 460] + 0171 NV17 [GeForce4 MX 440] + 1462 8661 G4MX440-VTP + 1462 8730 MX440SES-T (MS-8873) + 147b 8f00 Abit Siluro GeForce4MX440 + 0172 NV17 [GeForce4 MX 420] + 0173 NV17 [GeForce4 MX 440-SE] + 0174 NV17 [GeForce4 440 Go] + 0175 NV17 [GeForce4 420 Go] + 0176 NV17 [GeForce4 420 Go 32M] + 0178 NV17GL [Quadro4 550 XGL] + 0179 NV17 [GeForce4 440 Go 64M] + 017a NV17GL [Quadro4 200/400 NVS] + 017b NV17GL [Quadro4 550 XGL] + 017c NV17GL [Quadro4 550 GoGL] + 0181 NV18 [GeForce4 MX 440 AGP 8x] + 0182 NV18 [GeForce4 MX 440SE AGP 8x] + 0183 NV18 [GeForce4 MX 420 AGP 8x] + 0188 NV18GL [Quadro4 580 XGL] + 018a NV18GL [Quadro4 NVS] + 018b NV18GL [Quadro4 380 XGL] + 01a0 NV15 [GeForce2 - nForce GPU] + 01a4 nForce CPU bridge + 01ab nForce 420 Memory Controller (DDR) + 01ac nForce 220/420 Memory Controller + 01ad nForce 220/420 Memory Controller + 01b1 nForce Audio + 01b2 nForce ISA Bridge + 01b4 nForce PCI System Management + 01b7 nForce AGP to PCI Bridge + 01b8 nForce PCI-to-PCI bridge + 01bc nForce IDE + 01c1 Intel 537 [nForce MC97 Modem] + 01c2 nForce USB Controller + 01c3 nForce Ethernet Controller + 01e8 nForce2 AGP + 01f0 NV18 [GeForce4 MX - nForce GPU] + 0200 NV20 [GeForce3] + 1043 402f AGP-V8200 DDR + 0201 NV20 [GeForce3 Ti 200] + 0202 NV20 [GeForce3 Ti 500] + 1043 405b V8200 T5 + 1545 002f Xtasy 6964 + 0203 NV20DCC [Quadro DCC] + 0250 NV25 [GeForce4 Ti 4600] + 0251 NV25 [GeForce4 Ti 4400] + 0252 NV25 [GeForce4 Ti] + 0253 NV25 [GeForce4 Ti 4200] + 107d 2896 WinFast A250 LE TD (Dual VGA/TV-out/DVI) + 147b 8f09 Siluro (Dual VGA/TV-out/DVI) + 0258 NV25GL [Quadro4 900 XGL] + 0259 NV25GL [Quadro4 750 XGL] + 025b NV25GL [Quadro4 700 XGL] + 0280 NV28 [GeForce4 Ti 4800] + 0281 NV28 [GeForce4 Ti 4200 AGP 8x] + 0282 NV28 [GeForce4 Ti 4800 SE] + 0288 NV28GL [Quadro4 980 XGL] + 0289 NV28GL [Quadro4 780 XGL] + 0300 NV30 [GeForce FX] + 0301 NV30 [GeForce FX 5800 Ultra] + 0302 NV30 [GeForce FX 5800] + 0308 NV30GL [Quadro FX 2000] + 0309 NV30GL [Quadro FX 1000] +10df Emulex Corporation + 1ae5 LP6000 Fibre Channel Host Adapter + f085 LP850 Fibre Channel Adapter + f095 LP952 Fibre Channel Adapter + f098 LP982 Fibre Channel Adapter + f700 LP7000 Fibre Channel Host Adapter + f800 LP8000 Fibre Channel Host Adapter + f900 LP9000 Fibre Channel Host Adapter + f980 LP9802 Fibre Channel Adapter +10e0 Integrated Micro Solutions Inc. + 5026 IMS5026/27/28 + 5027 IMS5027 + 5028 IMS5028 + 8849 IMS8849 + 8853 IMS8853 + 9128 IMS9128 [Twin turbo 128] +10e1 Tekram Technology Co.,Ltd. + 0391 TRM-S1040 + 10e1 0391 DC-315U SCSI-3 Host Adapter + 690c DC-690c + dc29 DC-290 +10e2 Aptix Corporation +10e3 Tundra Semiconductor Corp. + 0000 CA91C042 [Universe] + 0860 CA91C860 [QSpan] + 0862 CA91C862A [QSpan-II] +10e4 Tandem Computers +10e5 Micro Industries Corporation +10e6 Gainbery Computer Products Inc. +10e7 Vadem +10e8 Applied Micro Circuits Corp. + 2011 Q-Motion Video Capture/Edit board + 4750 S5930 [Matchmaker] + 5920 S5920 + 8043 LANai4.x [Myrinet LANai interface chip] + 8062 S5933_PARASTATION + 807d S5933 [Matchmaker] + 8088 Kongsberg Spacetec Format Synchronizer + 8089 Kongsberg Spacetec Serial Output Board + 809c S5933_HEPC3 + 80d7 PCI-9112 + 80d9 PCI-9118 + 80da PCI-9812 + 811a PCI-IEEE1355-DS-DE Interface + 8170 S5933 [Matchmaker] (Chipset Development Tool) + 82db AJA HDNTV HD SDI Framestore +10e9 Alps Electric Co., Ltd. +10ea Intergraphics Systems + 1680 IGA-1680 + 1682 IGA-1682 + 1683 IGA-1683 + 2000 CyberPro 2000 + 2010 CyberPro 2000A + 5000 CyberPro 5000 + 5050 CyberPro 5050 + 5202 CyberPro 5202 +10eb Artists Graphics + 0101 3GA + 8111 Twist3 Frame Grabber +10ec Realtek Semiconductor Co., Ltd. + 8029 RTL-8029(AS) + 10b8 2011 EZ-Card (SMC1208) + 10ec 8029 RTL-8029(AS) + 1113 1208 EN1208 + 1186 0300 DE-528 + 1259 2400 AT-2400 + 8129 RTL-8129 + 10ec 8129 RT8129 Fast Ethernet Adapter + 8138 RT8139 (B/C) Cardbus Fast Ethernet Adapter + 10ec 8138 RT8139 (B/C) Fast Ethernet Adapter + 8139 RTL-8139/8139C/8139C+ + 1025 8920 ALN-325 + 1025 8921 ALN-325 + 10bd 0320 EP-320X-R + 10ec 8139 RT8139 + 1186 1300 DFE-538TX + 1186 1320 SN5200 + 1186 8139 DRN-32TX + 11f6 8139 FN22-3(A) LinxPRO Ethernet Adapter + 1259 2500 AT-2500TX + 1259 2503 AT-2500TX/ACPI + 1429 d010 ND010 + 1432 9130 EN-9130TX + 1436 8139 RT8139 + 146c 1439 FE-1439TX + 1489 6001 GF100TXRII + 1489 6002 GF100TXRA + 149c 139a LFE-8139ATX + 149c 8139 LFE-8139TX + 2646 0001 EtheRx + 8e2e 7000 KF-230TX + 8e2e 7100 KF-230TX/2 + a0a0 0007 ALN-325C + 8169 RTL-8169 + 1371 434e ProG-2000L + 8197 SmartLAN56 56K Modem +10ed Ascii Corporation + 7310 V7310 +10ee Xilinx Corporation + 3fc0 RME Digi96 + 3fc1 RME Digi96/8 + 3fc2 RME Digi96/8 Pro + 3fc3 RME Digi96/8 Pad + 3fc4 RME Digi9652 (Hammerfall) + 3fc5 RME Hammerfall DSP +10ef Racore Computer Products, Inc. + 8154 M815x Token Ring Adapter +10f0 Peritek Corporation +10f1 Tyan Computer +10f2 Achme Computer, Inc. +10f3 Alaris, Inc. +10f4 S-MOS Systems, Inc. +10f5 NKK Corporation + a001 NDR4000 [NR4600 Bridge] +10f6 Creative Electronic Systems SA +10f7 Matsushita Electric Industrial Co., Ltd. +10f8 Altos India Ltd +10f9 PC Direct +10fa Truevision + 000c TARGA 1000 +10fb Thesys Gesellschaft für Mikroelektronik mbH + 186f TH 6255 +10fc I-O Data Device, Inc. +# What's in the cardbus end of a Sony ACR-A01 card, comes with newer Vaio CD-RW drives + 0003 Cardbus IDE Controller + 0005 Cardbus SCSI CBSC II +10fd Soyo Computer, Inc +10fe Fast Multimedia AG +10ff NCube +1100 Jazz Multimedia +1101 Initio Corporation + 1060 INI-A100U2W + 9100 INI-9100/9100W + 9400 INI-940 + 9401 INI-950 + 9500 360P +1102 Creative Labs + 0002 SB Live! EMU10k1 + 1102 0020 CT4850 SBLive! Value + 1102 0021 CT4620 SBLive! + 1102 002f SBLive! mainboard implementation + 1102 4001 E-mu APS + 1102 8022 CT4780 SBLive! Value + 1102 8023 CT4790 SoundBlaster PCI512 + 1102 8024 CT4760 SBLive! + 1102 8025 SBLive! Mainboard Implementation + 1102 8026 CT4830 SBLive! Value + 1102 8027 CT4832 SBLive! Value + 1102 8028 CT4760 SBLive! OEM version + 1102 8031 CT4831 SBLive! Value + 1102 8040 CT4760 SBLive! + 1102 8051 CT4850 SBLive! Value + 1102 8061 SBLive! Player 5.1 + 0004 SB Audigy + 1102 0051 SB0090 Audigy Player + 1102 0053 SB0090 Audigy Player/OEM + 0006 [SB Live! Value] EMU10k1X + 4001 SB Audigy FireWire Port + 1102 0010 SB Audigy FireWire Port + 7002 SB Live! MIDI/Game Port + 1102 0020 Gameport Joystick + 7003 SB Audigy MIDI/Game port + 1102 0040 SB Audigy MIDI/Game Port + 7004 [SB Live! Value] Input device controller + 8064 SB0100 [SBLive! 5.1 OEM] + 8938 ES1371 +1103 Triones Technologies, Inc. + 0003 HPT343 +# Revisions: 01=HPT366, 03=HPT370, 04=HPT370A, 05=HPT372 + 0004 HPT366/368/370/370A/372 + 1103 0001 HPT370A + 1103 0005 HPT370 UDMA100 + 0005 HPT372A + 0006 HPT302 + 0007 HPT371 + 0008 HPT374 +1104 RasterOps Corp. +1105 Sigma Designs, Inc. + 1105 REALmagic Xcard MPEG 1/2/3/4 DVD Decoder + 8300 REALmagic Hollywood Plus DVD Decoder + 8400 EM840x REALmagic DVD/MPEG-2 Audio/Video Decoder +1106 VIA Technologies, Inc. + 0102 Embedded VIA Ethernet Controller + 0130 VT6305 1394.A Controller + 0305 VT8363/8365 [KT133/KM133] + 1043 8033 A7V Mainboard + 1043 803e A7V-E Mainboard + 1043 8042 A7V133/A7V133-C Mainboard + 147b a401 KT7/KT7-RAID/KT7A/KT7A-RAID Mainboard + 0391 VT8371 [KX133] + 0501 VT8501 [Apollo MVP4] + 0505 VT82C505 + 0561 VT82C561 + 0571 VT82C586/B/686A/B PIPC Bus Master IDE + 1043 8052 VT8233A Bus Master ATA100/66/33 IDE + 1106 0571 VT8235 Bus Master ATA133/100/66/33 IDE + 1179 0001 Magnia Z310 + 1458 5002 GA-7VAX Mainboard + 0576 VT82C576 3V [Apollo Master] + 0585 VT82C585VP [Apollo VP1/VPX] + 0586 VT82C586/A/B PCI-to-ISA [Apollo VP] + 1106 0000 MVP3 ISA Bridge + 0595 VT82C595 [Apollo VP2] + 0596 VT82C596 ISA [Mobile South] + 1106 0000 VT82C596/A/B PCI to ISA Bridge + 1458 0596 VT82C596/A/B PCI to ISA Bridge + 0597 VT82C597 [Apollo VP3] + 0598 VT82C598 [Apollo MVP3] + 0601 VT8601 [Apollo ProMedia] + 0605 VT8605 [ProSavage PM133] + 0680 VT82C680 [Apollo P6] + 0686 VT82C686 [Apollo Super South] + 1043 8033 A7V Mainboard + 1043 803e A7V-E Mainboard + 1043 8040 A7M266 Mainboard + 1043 8042 A7V133/A7V133-C Mainboard + 1106 0000 VT82C686/A PCI to ISA Bridge + 1106 0686 VT82C686/A PCI to ISA Bridge + 1179 0001 Magnia Z310 + 147b a702 KG7-Lite Mainboard + 0691 VT82C693A/694x [Apollo PRO133x] + 1179 0001 Magnia Z310 + 1458 0691 VT82C691 Apollo Pro System Controller + 0693 VT82C693 [Apollo Pro Plus] + 0698 VT82C693A [Apollo Pro133 AGP] + 0926 VT82C926 [Amazon] + 1000 VT82C570MV + 1106 VT82C570MV + 1571 VT82C416MV + 1595 VT82C595/97 [Apollo VP2/97] + 3038 USB + 0925 1234 USB Controller + 1179 0001 Magnia Z310 + 3040 VT82C586B ACPI + 3043 VT86C100A [Rhine] + 10bd 0000 VT86C100A Fast Ethernet Adapter + 1106 0100 VT86C100A Fast Ethernet Adapter + 1186 1400 DFE-530TX rev A + 3044 IEEE 1394 Host Controller + 3050 VT82C596 Power Management + 3051 VT82C596 Power Management + 3057 VT82C686 [Apollo Super ACPI] + 1043 8033 A7V Mainboard + 1043 803e A7V-E Mainboard + 1043 8040 A7M266 Mainboard + 1043 8042 A7V133/A7V133-C Mainboard + 1179 0001 Magnia Z310 + 3058 VT82C686 AC97 Audio Controller + 0e11 b194 Soundmax integrated digital audio + 1106 4511 Onboard Audio on EP7KXA + 1458 7600 Onboard Audio + 1462 3091 MS-6309 Onboard Audio + 15dd 7609 Onboard Audio + 3059 VT8233 AC97 Audio Controller + 1458 a002 GA-7VAX Onboard Audio (Realtek ALC650) + 3065 VT6102 [Rhine-II] + 1106 0102 VT6102 [Rhine II] Embeded Ethernet Controller on VT8235 + 1186 1400 DFE-530TX rev A + 1186 1401 DFE-530TX rev B + 3068 Intel 537 [AC97 Modem] + 3074 VT8233 PCI to ISA Bridge + 1043 8052 VT8233A + 3091 VT8633 [Apollo Pro266] + 3099 VT8366/A/7 [Apollo KT266/A/333] + 1043 8064 A7V266-E Mainboard + 1043 807f A7V333 Mainboard + 3101 VT8653 Host Bridge + 3102 VT8662 Host Bridge + 3103 VT8615 Host Bridge + 3104 USB 2.0 + 1458 5004 GA-7VAX Mainboard + 3106 VT6105 [Rhine-III] + 3109 VT8233C PCI to ISA Bridge + 3112 VT8361 [KLE133] Host Bridge + 3116 VT8375 [KM266] Host Bridge +# found on EPIA M6000/9000 mainboard + 3122 VT8623 [Apollo CLE266] integrated CastleRock graphics +# found on EPIA M6000/9000 mainboard + 3123 VT8623 [Apollo CLE266] + 3128 VT8753 [P4X266 AGP] + 3133 VT3133 Host Bridge + 3147 VT8233A ISA Bridge + 3148 P4M266 Host Bridge + 3156 P/KN266 Host Bridge + 3168 VT8374 P4X400 Host Controller/AGP Bridge + 3177 VT8235 ISA Bridge + 1458 5001 GA-7VAX Mainboard + 3189 VT8377 [KT400 AGP] Host Bridge + 1458 5000 GA-7VAX Mainboard + 5030 VT82C596 ACPI [Apollo PRO] + 6100 VT85C100A [Rhine II] + 8231 VT8231 [PCI-to-ISA Bridge] + 8235 VT8235 ACPI + 8305 VT8363/8365 [KT133/KM133 AGP] + 8391 VT8371 [KX133 AGP] + 8501 VT8501 [Apollo MVP4 AGP] + 8596 VT82C596 [Apollo PRO AGP] + 8597 VT82C597 [Apollo VP3 AGP] + 8598 VT82C598/694x [Apollo MVP3/Pro133x AGP] + 8601 VT8601 [Apollo ProMedia AGP] + 8605 VT8605 [PM133 AGP] + 8691 VT82C691 [Apollo Pro] + 8693 VT82C693 [Apollo Pro Plus] PCI Bridge + b091 VT8633 [Apollo Pro266 AGP] + b099 VT8366/A/7 [Apollo KT266/A/333 AGP] + b101 VT8653 AGP Bridge + b102 VT8362 AGP Bridge + b103 VT8615 AGP Bridge + b112 VT8361 [KLE133] AGP Bridge + b168 VT8235 PCI Bridge +1107 Stratus Computers + 0576 VIA VT82C570MV [Apollo] (Wrong vendor ID!) +1108 Proteon, Inc. + 0100 p1690plus_AA + 0101 p1690plus_AB + 0105 P1690Plus + 0108 P1690Plus + 0138 P1690Plus + 0139 P1690Plus + 013c P1690Plus + 013d P1690Plus +1109 Cogent Data Technologies, Inc. + 1400 EM110TX [EX110TX] +110a Siemens Nixdorf AG + 0002 Pirahna 2-port + 0005 Tulip controller, power management, switch extender + 2102 DSCC4 WAN adapter + 4942 FPGA I-Bus Tracer for MBD + 6120 SZB6120 +110b Chromatic Research Inc. + 0001 Mpact Media Processor + 0004 Mpact 2 +110c Mini-Max Technology, Inc. +110d Znyx Advanced Systems +110e CPU Technology +110f Ross Technology +1110 Powerhouse Systems + 6037 Firepower Powerized SMP I/O ASIC + 6073 Firepower Powerized SMP I/O ASIC +1111 Santa Cruz Operation +# Also claimed to be RNS or Rockwell International, current PCISIG records list Osicom +1112 Osicom Technologies Inc + 2200 FDDI Adapter + 2300 Fast Ethernet Adapter + 2340 4 Port Fast Ethernet Adapter + 2400 ATM Adapter +1113 Accton Technology Corporation + 1211 SMC2-1211TX + 103c 1207 EN-1207D Fast Ethernet Adapter + 1113 1211 EN-1207D Fast Ethernet Adapter + 1216 EN-1216 Ethernet Adapter + 111a 1020 SpeedStream 1020 PCI 10/100 Ethernet Adaptor [EN-1207F-TX ?] + 1217 EN-1217 Ethernet Adapter + 5105 10Mbps Network card + 9211 EN-1207D Fast Ethernet Adapter + 1113 9211 EN-1207D Fast Ethernet Adapter + 9511 Fast Ethernet Adapter +1114 Atmel Corporation +1115 3D Labs +1116 Data Translation + 0022 DT3001 + 0023 DT3002 + 0024 DT3003 + 0025 DT3004 + 0026 DT3005 + 0027 DT3001-PGL + 0028 DT3003-PGL +1117 Datacube, Inc + 9500 Max-1C SVGA card + 9501 Max-1C image processing +1118 Berg Electronics +1119 ICP Vortex Computersysteme GmbH + 0000 GDT 6000/6020/6050 + 0001 GDT 6000B/6010 + 0002 GDT 6110/6510 + 0003 GDT 6120/6520 + 0004 GDT 6530 + 0005 GDT 6550 + 0006 GDT 6x17 + 0007 GDT 6x27 + 0008 GDT 6537 + 0009 GDT 6557 + 000a GDT 6115/6515 + 000b GDT 6125/6525 + 000c GDT 6535 + 000d GDT 6555 + 0100 GDT 6117RP/6517RP + 0101 GDT 6127RP/6527RP + 0102 GDT 6537RP + 0103 GDT 6557RP + 0104 GDT 6111RP/6511RP + 0105 GDT 6121RP/6521RP + 0110 GDT 6117RD/6517RD + 0111 GDT 6127RD/6527RD + 0112 GDT 6537RD + 0113 GDT 6557RD + 0114 GDT 6111RD/6511RD + 0115 GDT 6121RD/6521RD + 0118 GDT 6118RD/6518RD/6618RD + 0119 GDT 6128RD/6528RD/6628RD + 011a GDT 6538RD/6638RD + 011b GDT 6558RD/6658RD + 0120 GDT 6117RP2/6517RP2 + 0121 GDT 6127RP2/6527RP2 + 0122 GDT 6537RP2 + 0123 GDT 6557RP2 + 0124 GDT 6111RP2/6511RP2 + 0125 GDT 6121RP2/6521RP2 + 0136 GDT 6113RS/6513RS + 0137 GDT 6123RS/6523RS + 0138 GDT 6118RS/6518RS/6618RS + 0139 GDT 6128RS/6528RS/6628RS + 013a GDT 6538RS/6638RS + 013b GDT 6558RS/6658RS + 013c GDT 6533RS/6633RS + 013d GDT 6543RS/6643RS + 013e GDT 6553RS/6653RS + 013f GDT 6563RS/6663RS + 0166 GDT 7113RN/7513RN/7613RN + 0167 GDT 7123RN/7523RN/7623RN + 0168 GDT 7118RN/7518RN/7518RN + 0169 GDT 7128RN/7528RN/7628RN + 016a GDT 7538RN/7638RN + 016b GDT 7558RN/7658RN + 016c GDT 7533RN/7633RN + 016d GDT 7543RN/7643RN + 016e GDT 7553RN/7653RN + 016f GDT 7563RN/7663RN + 01d6 GDT 4x13RZ + 01d7 GDT 4x23RZ + 01f6 GDT 8x13RZ + 01f7 GDT 8x23RZ + 01fc GDT 8x33RZ + 01fd GDT 8x43RZ + 01fe GDT 8x53RZ + 01ff GDT 8x63RZ + 0210 GDT 6519RD/6619RD + 0211 GDT 6529RD/6629RD + 0260 GDT 7519RN/7619RN + 0261 GDT 7529RN/7629RN + 0300 GDT Raid Controller +111a Efficient Networks, Inc + 0000 155P-MF1 (FPGA) + 0002 155P-MF1 (ASIC) + 0003 ENI-25P ATM + 111a 0000 ENI-25p Miniport ATM Adapter + 0005 SpeedStream (LANAI) + 111a 0001 ENI-3010 ATM + 111a 0009 ENI-3060 ADSL (VPI=0) + 111a 0101 ENI-3010 ATM + 111a 0109 ENI-3060CO ADSL (VPI=0) + 111a 0809 ENI-3060 ADSL (VPI=0 or 8) + 111a 0909 ENI-3060CO ADSL (VPI=0 or 8) + 111a 0a09 ENI-3060 ADSL (VPI=<0..15>) + 0007 SpeedStream ADSL + 111a 1001 ENI-3061 ADSL [ASIC] +111b Teledyne Electronic Systems +111c Tricord Systems Inc. + 0001 Powerbis Bridge +111d Integrated Device Tech + 0001 IDT77211 ATM Adapter + 0003 IDT77252 ATM network controller +111e Eldec +111f Precision Digital Images + 4a47 Precision MX Video engine interface + 5243 Frame capture bus interface +1120 EMC Corporation +1121 Zilog +1122 Multi-tech Systems, Inc. +1123 Excellent Design, Inc. +1124 Leutron Vision AG +1125 Eurocore +1126 Vigra +1127 FORE Systems Inc + 0200 ForeRunner PCA-200 ATM + 0210 PCA-200PC + 0250 ATM + 0300 ForeRunner PCA-200EPC ATM + 0310 ATM + 0400 ForeRunnerHE ATM Adapter + 1127 0400 ForeRunnerHE ATM +1129 Firmworks +112a Hermes Electronics Company, Ltd. +112b Linotype - Hell AG +112c Zenith Data Systems +112d Ravicad +112e Infomedia Microelectronics Inc. +112f Imaging Technology Inc + 0000 MVC IC-PCI + 0001 MVC IM-PCI Video frame grabber/processor +1130 Computervision +1131 Philips Semiconductors + 1561 USB 1.1 Host Controller + 1562 USB 2.0 Host Controller + 3400 SmartPCI56(UCB1500) 56K Modem + 7130 SAA7130 Video Broadcast Decoder + 7133 SAA7133 Audio+video broadcast decoder +# PCI audio and video broadcast decoder (http://www.semiconductors.philips.com/pip/saa7134hl) + 7134 SAA7134 + 7135 SAA7135 Audio+video broadcast decoder + 7145 SAA7145 + 7146 SAA7146 + 114b 2003 DVRaptor Video Edit/Capture Card + 11bd 0006 DV500 Overlay + 11bd 000a DV500 Overlay +1132 Mitel Corp. +1133 Eicon Technology Corporation + 7901 EiconCard S90 + 7902 EiconCard S90 + 7911 EiconCard S91 + 7912 EiconCard S91 + 7941 EiconCard S94 + 7942 EiconCard S94 + 7943 EiconCard S94 + 7944 EiconCard S94 + b921 EiconCard P92 + b922 EiconCard P92 + b923 EiconCard P92 + e001 DIVA 20PRO + 1133 e001 DIVA Pro 2.0 S/T + e002 DIVA 20 + 1133 e002 DIVA 2.0 S/T + e003 DIVA 20PRO_U + 1133 e003 DIVA Pro 2.0 U + e004 DIVA 20_U + 1133 e004 DIVA 2.0 U + e005 DIVA LOW + 1133 e005 DIVA 2.01 S/T + e00b DIVA 2.02 + e010 DIVA Server BRI-2M + 1133 e010 DIVA Server BRI-2M + e012 DIVA Server BRI-8M + 1133 e012 DIVA Server BRI-8M + e014 DIVA Server PRI-30M + 1133 e014 DIVA Server PRI-30M + e018 DIVA Server BRI-2M/-2F +1134 Mercury Computer Systems + 0001 Raceway Bridge +1135 Fuji Xerox Co Ltd + 0001 Printer controller +1136 Momentum Data Systems +1137 Cisco Systems Inc +1138 Ziatech Corporation + 8905 8905 [STD 32 Bridge] +1139 Dynamic Pictures, Inc + 0001 VGA Compatable 3D Graphics +113a FWB Inc +113b Network Computing Devices +113c Cyclone Microsystems, Inc. + 0000 PCI-9060 i960 Bridge + 0001 PCI-SDK [PCI i960 Evaluation Platform] + 0911 PCI-911 [i960Jx-based Intelligent I/O Controller] + 0912 PCI-912 [i960CF-based Intelligent I/O Controller] + 0913 PCI-913 + 0914 PCI-914 [I/O Controller w/ secondary PCI bus] +113d Leading Edge Products Inc +113e Sanyo Electric Co - Computer Engineering Dept +113f Equinox Systems, Inc. + 0808 SST-64P Adapter + 1010 SST-128P Adapter + 80c0 SST-16P DB Adapter + 80c4 SST-16P RJ Adapter + 80c8 SST-16P Adapter + 8888 SST-4P Adapter + 9090 SST-8P Adapter +1140 Intervoice Inc +1141 Crest Microsystem Inc +1142 Alliance Semiconductor Corporation + 3210 AP6410 + 6422 ProVideo 6422 + 6424 ProVideo 6424 + 6425 ProMotion AT25 + 643d ProMotion AT3D +1143 NetPower, Inc +1144 Cincinnati Milacron + 0001 Noservo controller +1145 Workbit Corporation + 8007 NinjaSCSI-32 Workbit + f007 NinjaSCSI-32 KME + f010 NinjaSCSI-32 Workbit + f012 NinjaSCSI-32 Logitec + f013 NinjaSCSI-32 Logitec + f015 NinjaSCSI-32 Melco +1146 Force Computers +1147 Interface Corp +1148 Syskonnect (Schneider & Koch) + 4000 FDDI Adapter + 0e11 b03b Netelligent 100 FDDI DAS Fibre SC + 0e11 b03c Netelligent 100 FDDI SAS Fibre SC + 0e11 b03d Netelligent 100 FDDI DAS UTP + 0e11 b03e Netelligent 100 FDDI SAS UTP + 0e11 b03f Netelligent 100 FDDI SAS Fibre MIC + 1148 5521 FDDI SK-5521 (SK-NET FDDI-UP) + 1148 5522 FDDI SK-5522 (SK-NET FDDI-UP DAS) + 1148 5541 FDDI SK-5541 (SK-NET FDDI-FP) + 1148 5543 FDDI SK-5543 (SK-NET FDDI-LP) + 1148 5544 FDDI SK-5544 (SK-NET FDDI-LP DAS) + 1148 5821 FDDI SK-5821 (SK-NET FDDI-UP64) + 1148 5822 FDDI SK-5822 (SK-NET FDDI-UP64 DAS) + 1148 5841 FDDI SK-5841 (SK-NET FDDI-FP64) + 1148 5843 FDDI SK-5843 (SK-NET FDDI-LP64) + 1148 5844 FDDI SK-5844 (SK-NET FDDI-LP64 DAS) + 4200 Token Ring adapter + 4300 Gigabit Ethernet + 1148 9821 SK-9821 (1000Base-T single link) + 1148 9822 SK-9822 (1000Base-T dual link) + 1148 9841 SK-9841 (1000Base-LX single link) + 1148 9842 SK-9842 (1000Base-LX dual link) + 1148 9843 SK-9843 (1000Base-SX single link) + 1148 9844 SK-9844 (1000Base-SX dual link) + 1148 9861 SK-9861 (1000Base-SX VF45 single link) + 1148 9862 SK-9862 (1000Base-SX VF45 dual link) +# Information got from SysKonnekt + 1148 9871 SK-9871 (1000Base-ZX single link) +# Information got from SysKonnekt + 1148 9872 SK-9872 (1000Base-ZX dual link) + 1259 2970 AT-2970SX [Allied Telesyn] + 1259 2972 AT-2970T [Allied Telesyn] + 1259 2975 AT-2970SX [Allied Telesyn] + 1259 2977 AT-2970T [Allied Telesyn] + 4320 SK-98xx Gigabit Ethernet Server Adapter + 1148 5021 SK-9821 V2.0 Gigabit Ethernet 10/100/1000Base-T Adapter + 1148 5041 SK-9841 V2.0 Gigabit Ethernet 1000Base-LX Adapter + 1148 5043 SK-9843 V2.0 Gigabit Ethernet 1000Base-SX Adapter + 1148 5051 SK-9851 V2.0 Gigabit Ethernet 1000Base-SX Adapter + 1148 5061 SK-9861 V2.0 Gigabit Ethernet 1000Base-SX Adapter + 1148 5071 SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter + 1148 9521 SK-9521 10/100/1000Base-T Adapter + 4400 Gigabit Ethernet +1149 Win System Corporation +114a VMIC + 5579 VMIPCI-5579 (Reflective Memory Card) + 5587 VMIPCI-5587 (Reflective Memory Card) + 6504 VMIC PCI 7755 FPGA + 7587 VMIVME-7587 +114b Canopus Co., Ltd +114c Annabooks +114d IC Corporation +114e Nikon Systems Inc +114f Digi International + 0002 AccelePort EPC + 0003 RightSwitch SE-6 + 0004 AccelePort Xem + 0005 AccelePort Xr + 0006 AccelePort Xr,C/X + 0009 AccelePort Xr/J + 000a AccelePort EPC/J + 000c DataFirePRIme T1 (1-port) + 000d SyncPort 2-Port (x.25/FR) + 0011 AccelePort 8r EIA-232 (IBM) + 0012 AccelePort 8r EIA-422 + 0013 AccelePort Xr + 0014 AccelePort 8r EIA-422 + 0015 AccelePort Xem + 0016 AccelePort EPC/X + 0017 AccelePort C/X + 001a DataFirePRIme E1 (1-port) + 001b AccelePort C/X (IBM) + 001d DataFire RAS T1/E1/PRI + 114f 0050 DataFire RAS E1 Adapter + 114f 0051 DataFire RAS Dual E1 Adapter + 114f 0052 DataFire RAS T1 Adapter + 114f 0053 DataFire RAS Dual T1 Adapter + 0023 AccelePort RAS + 0024 DataFire RAS B4 ST/U + 114f 0030 DataFire RAS BRI U Adapter + 114f 0031 DataFire RAS BRI S/T Adapter + 0026 AccelePort 4r 920 + 0027 AccelePort Xr 920 + 0034 AccelePort 2r 920 + 0035 DataFire DSP T1/E1/PRI cPCI + 0040 AccelePort Xp + 0042 AccelePort 2p PCI + 0070 Datafire Micro V IOM2 (Europe) + 0071 Datafire Micro V (Europe) + 0072 Datafire Micro V IOM2 (North America) + 0073 Datafire Micro V (North America) + 6001 Avanstar +1150 Thinking Machines Corp +1151 JAE Electronics Inc. +1152 Megatek +1153 Land Win Electronic Corp +1154 Melco Inc +1155 Pine Technology Ltd +1156 Periscope Engineering +1157 Avsys Corporation +1158 Voarx R & D Inc + 3011 Tokenet/vg 1001/10m anylan + 9050 Lanfleet/Truevalue + 9051 Lanfleet/Truevalue +1159 Mutech Corp + 0001 MV-1000 +115a Harlequin Ltd +115b Parallax Graphics +115c Photron Ltd. +115d Xircom + 0003 Cardbus Ethernet 10/100 + 1014 0181 10/100 EtherJet Cardbus Adapter + 1014 1181 10/100 EtherJet Cardbus Adapter + 1014 8181 10/100 EtherJet Cardbus Adapter + 1014 9181 10/100 EtherJet Cardbus Adapter + 115d 0181 Cardbus Ethernet 10/100 + 115d 1181 Cardbus Ethernet 10/100 + 1179 0181 Cardbus Ethernet 10/100 + 8086 8181 EtherExpress PRO/100 Mobile CardBus 32 Adapter + 8086 9181 EtherExpress PRO/100 Mobile CardBus 32 Adapter + 0005 Cardbus Ethernet 10/100 + 1014 0182 10/100 EtherJet Cardbus Adapter + 1014 1182 10/100 EtherJet Cardbus Adapter + 115d 0182 Cardbus Ethernet 10/100 + 115d 1182 Cardbus Ethernet 10/100 + 0007 Cardbus Ethernet 10/100 + 1014 0182 10/100 EtherJet Cardbus Adapter + 1014 1182 10/100 EtherJet Cardbus Adapter + 115d 0182 Cardbus Ethernet 10/100 + 115d 1182 Cardbus Ethernet 10/100 + 000b Cardbus Ethernet 10/100 + 1014 0183 10/100 EtherJet Cardbus Adapter + 115d 0183 Cardbus Ethernet 10/100 + 000c Mini-PCI V.90 56k Modem + 000f Cardbus Ethernet 10/100 + 1014 0183 10/100 EtherJet Cardbus Adapter + 115d 0183 Cardbus Ethernet 10/100 + 0101 Cardbus 56k modem + 115d 1081 Cardbus 56k Modem + 0103 Cardbus Ethernet + 56k Modem + 1014 9181 Cardbus 56k Modem + 1115 1181 Cardbus Ethernet 100 + 56k Modem + 115d 1181 CBEM56G-100 Ethernet + 56k Modem + 8086 9181 PRO/100 LAN + Modem56 CardBus +115e Peer Protocols Inc +115f Maxtor Corporation +1160 Megasoft Inc +1161 PFU Limited +1162 OA Laboratory Co Ltd +1163 Rendition + 0001 Verite 1000 + 2000 Verite V2000/V2100/V2200 + 1092 2000 Stealth II S220 +1164 Advanced Peripherals Technologies +1165 Imagraph Corporation + 0001 Motion TPEG Recorder/Player with audio +1166 ServerWorks + 0005 CNB20-LE Host Bridge + 0007 CNB20-LE Host Bridge + 0008 CNB20HE Host Bridge + 0009 CNB20LE Host Bridge + 0010 CIOB30 + 0011 CMIC-HE + 0012 CMIC-LE + 0013 CNB20-HE Host Bridge + 0014 CNB20-HE Host Bridge + 0015 CMIC-GC Host Bridge + 0016 CMIC-GC Host Bridge + 0017 GCNB-LE Host Bridge + 0200 OSB4 South Bridge + 0201 CSB5 South Bridge + 0203 CSB6 South Bridge + 0211 OSB4 IDE Controller + 0212 CSB5 IDE Controller + 0213 CSB6 RAID/IDE Controller + 0220 OSB4/CSB5 OHCI USB Controller + 0221 CSB6 OHCI USB Controller + 0225 GCLE Host Bridge + 0227 GCLE-2 Host Bridge +1167 Mutoh Industries Inc +1168 Thine Electronics Inc +1169 Centre for Development of Advanced Computing +116a Polaris Communications + 6100 Bus/Tag Channel + 6800 Escon Channel + 7100 Bus/Tag Channel + 7800 Escon Channel +116b Connectware Inc +116c Intelligent Resources Integrated Systems +116d Martin-Marietta +116e Electronics for Imaging +116f Workstation Technology +1170 Inventec Corporation +1171 Loughborough Sound Images Plc +1172 Altera Corporation +1173 Adobe Systems, Inc +1174 Bridgeport Machines +1175 Mitron Computer Inc. +1176 SBE Incorporated +1177 Silicon Engineering +1178 Alfa, Inc. + afa1 Fast Ethernet Adapter +1179 Toshiba America Info Systems + 0103 EX-IDE Type-B + 0404 DVD Decoder card + 0406 Tecra Video Capture device + 0407 DVD Decoder card (Version 2) + 0601 601 + 0603 ToPIC95 PCI to CardBus Bridge for Notebooks + 060a ToPIC95 + 060f ToPIC97 + 0617 ToPIC95 PCI to Cardbus Bridge with ZV Support + 0618 CPU to PCI and PCI to ISA bridge +# Claimed to be Lucent DSP1645 [Mars], but that's apparently incorrect. Does anyone know the correct ID? + 0701 FIR Port + 0804 TC6371AF SmartMedia Controller + 0805 SD TypA Controller + 0d01 FIR Port Type-DO + 1179 0001 FIR Port Type-DO +117a A-Trend Technology +117b L G Electronics, Inc. +117c Atto Technology +117d Becton & Dickinson +117e T/R Systems +117f Integrated Circuit Systems +1180 Ricoh Co Ltd + 0465 RL5c465 + 0466 RL5c466 + 0475 RL5c475 + 144d c006 vpr Matrix 170B4 CardBus bridge + 0476 RL5c476 II + 1014 0185 ThinkPad A/T/X Series + 104d 80df Vaio PCG-FX403 + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 0477 RL5c477 + 0478 RL5c478 + 1014 0184 ThinkPad A30p (2653-64G) + 0522 R5C522 IEEE 1394 Controller + 1014 01cf ThinkPad A30p (2653-64G) + 0551 R5C551 IEEE 1394 Controller + 144d c006 vpr Matrix 170B4 + 0552 R5C552 IEEE 1394 Controller + 1014 0511 ThinkPad A/T/X Series +1181 Telmatics International +1183 Fujikura Ltd +1184 Forks Inc +1185 Dataworld International Ltd +1186 D-Link System Inc + 0100 DC21041 + 1002 DL10050 Sundance Ethernet + 1186 1002 DFE-550TX + 1186 1012 DFE-580TX + 1300 RTL8139 Ethernet + 1186 1300 DFE-538TX 10/100 Ethernet Adapter + 1186 1301 DFE-530TX+ 10/100 Ethernet Adapter + 1340 DFE-690TXD CardBus PC Card + 1561 DRP-32TXD Cardbus PC Card + 4000 DL2K Ethernet +1187 Advanced Technology Laboratories, Inc. +1188 Shima Seiki Manufacturing Ltd. +1189 Matsushita Electronics Co Ltd +118a Hilevel Technology +118b Hypertec Pty Limited +118c Corollary, Inc + 0014 PCIB [C-bus II to PCI bus host bridge chip] + 1117 Intel 8-way XEON Profusion Chipset [Cache Coherency Filter] +118d BitFlow Inc + 0001 Raptor-PCI framegrabber + 0012 Model 12 Road Runner Frame Grabber + 0014 Model 14 Road Runner Frame Grabber + 0024 Model 24 Road Runner Frame Grabber + 0044 Model 44 Road Runner Frame Grabber + 0112 Model 12 Road Runner Frame Grabber + 0114 Model 14 Road Runner Frame Grabber + 0124 Model 24 Road Runner Frame Grabber + 0144 Model 44 Road Runner Frame Grabber + 0212 Model 12 Road Runner Frame Grabber + 0214 Model 14 Road Runner Frame Grabber + 0224 Model 24 Road Runner Frame Grabber + 0244 Model 44 Road Runner Frame Grabber + 0312 Model 12 Road Runner Frame Grabber + 0314 Model 14 Road Runner Frame Grabber + 0324 Model 24 Road Runner Frame Grabber + 0344 Model 44 Road Runner Frame Grabber +118e Hermstedt GmbH +118f Green Logic +1190 Tripace + c731 TP-910/920/940 PCI Ultra(Wide) SCSI Adapter +1191 Artop Electronic Corp + 0003 SCSI Cache Host Adapter + 0004 ATP8400 + 0005 ATP850UF + 0006 ATP860 NO-BIOS + 0007 ATP860 + 0008 ATP865 NO-ROM + 0009 ATP865 + 8002 AEC6710 SCSI-2 Host Adapter + 8010 AEC6712UW SCSI + 8020 AEC6712U SCSI + 8030 AEC6712S SCSI + 8040 AEC6712D SCSI + 8050 AEC6712SUW SCSI +1192 Densan Company Ltd +1193 Zeitnet Inc. + 0001 1221 + 0002 1225 +1194 Toucan Technology +1195 Ratoc System Inc +1196 Hytec Electronics Ltd +1197 Gage Applied Sciences, Inc. +1198 Lambda Systems Inc +1199 Attachmate Corporation +119a Mind Share, Inc. +119b Omega Micro Inc. + 1221 82C092G +119c Information Technology Inst. +119d Bug, Inc. Sapporo Japan +119e Fujitsu Microelectronics Ltd. + 0001 FireStream 155 + 0003 FireStream 50 +119f Bull HN Information Systems +11a0 Convex Computer Corporation +11a1 Hamamatsu Photonics K.K. +11a2 Sierra Research and Technology +11a3 Deuretzbacher GmbH & Co. Eng. KG +11a4 Barco Graphics NV +11a5 Microunity Systems Eng. Inc +11a6 Pure Data Ltd. +11a7 Power Computing Corp. +11a8 Systech Corp. +11a9 InnoSys Inc. + 4240 AMCC S933Q Intelligent Serial Card +11aa Actel +11ab Galileo Technology Ltd. + 0146 GT-64010/64010A System Controller + 4611 GT-64115 System Controller + 4620 GT-64120/64120A/64121A System Controller + 4801 GT-48001 + f003 GT-64010 Primary Image Piranha Image Generator +11ac Canon Information Systems Research Aust. +11ad Lite-On Communications Inc + 0002 LNE100TX + 11ad 0002 LNE100TX + 11ad 0003 LNE100TX + 11ad f003 LNE100TX + 11ad ffff LNE100TX + 1385 f004 FA310TX + c115 LNE100TX [Linksys EtherFast 10/100] + 11ad c001 LNE100TX [ver 2.0] +11ae Aztech System Ltd +11af Avid Technology Inc. +11b0 V3 Semiconductor Inc. + 0002 V300PSC + 0292 V292PBC [Am29030/40 Bridge] + 0960 V96xPBC + c960 V96DPC +11b1 Apricot Computers +11b2 Eastman Kodak +11b3 Barr Systems Inc. +11b4 Leitch Technology International +11b5 Radstone Technology Plc +11b6 United Video Corp +11b7 Motorola +11b8 XPoint Technologies, Inc + 0001 Quad PeerMaster +11b9 Pathlight Technology Inc. + c0ed SSA Controller +11ba Videotron Corp +11bb Pyramid Technology +11bc Network Peripherals Inc + 0001 NP-PCI +11bd Pinnacle Systems Inc. +11be International Microcircuits Inc +11bf Astrodesign, Inc. +11c0 Hewlett Packard +11c1 Lucent Microelectronics + 0440 56k WinModem + 1033 8015 LT WinModem 56k Data+Fax+Voice+Dsvd + 1033 8047 LT WinModem 56k Data+Fax+Voice+Dsvd + 1033 804f LT WinModem 56k Data+Fax+Voice+Dsvd + 10cf 102c LB LT Modem V.90 56k + 10cf 104a BIBLO LT Modem 56k + 10cf 105f LB2 LT Modem V.90 56k + 1179 0001 Internal V.90 Modem + 11c1 0440 LT WinModem 56k Data+Fax+Voice+Dsvd + 122d 4101 MDP7800-U Modem + 122d 4102 MDP7800SP-U Modem + 13e0 0040 LT WinModem 56k Data+Fax+Voice+Dsvd + 13e0 0440 LT WinModem 56k Data+Fax+Voice+Dsvd + 13e0 0441 LT WinModem 56k Data+Fax+Voice+Dsvd + 13e0 0450 LT WinModem 56k Data+Fax+Voice+Dsvd + 13e0 f100 LT WinModem 56k Data+Fax+Voice+Dsvd + 13e0 f101 LT WinModem 56k Data+Fax+Voice+Dsvd + 144d 2101 LT56PV Modem + 149f 0440 LT WinModem 56k Data+Fax+Voice+Dsvd + 0441 56k WinModem + 1033 804d LT WinModem 56k Data+Fax + 1033 8065 LT WinModem 56k Data+Fax + 1092 0440 Supra 56i + 1179 0001 Internal V.90 Modem + 11c1 0440 LT WinModem 56k Data+Fax + 11c1 0441 LT WinModem 56k Data+Fax + 122d 4100 MDP7800-U Modem + 13e0 0040 LT WinModem 56k Data+Fax + 13e0 0100 LT WinModem 56k Data+Fax + 13e0 0410 LT WinModem 56k Data+Fax + 13e0 0420 TelePath Internet 56k WinModem + 13e0 0440 LT WinModem 56k Data+Fax + 13e0 0443 LT WinModem 56k Data+Fax + 13e0 f102 LT WinModem 56k Data+Fax + 1416 9804 CommWave 56k Modem + 141d 0440 LT WinModem 56k Data+Fax + 144f 0441 Lucent 56k V.90 DF Modem + 144f 0449 Lucent 56k V.90 DF Modem + 144f 110d Lucent Win Modem + 1468 0441 Presario 56k V.90 DF Modem + 1668 0440 Lucent Win Modem + 0442 56k WinModem + 11c1 0440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 11c1 0442 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 13e0 0412 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 13e0 0442 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 13fc 2471 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 144d 2104 LT56PT Modem + 144f 1104 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 149f 0440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 1668 0440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 0443 LT WinModem + 0444 LT WinModem + 0445 LT WinModem + 0446 LT WinModem + 0447 LT WinModem + 0448 WinModem 56k + 1014 0131 Lucent Win Modem + 1033 8066 LT WinModem 56k Data+Fax+Voice+Dsvd + 13e0 0030 56k Voice Modem + 13e0 0040 LT WinModem 56k Data+Fax+Voice+Dsvd +# Actiontech eth+modem card as used by Dell &c. + 1668 2400 LT WinModem 56k (MiniPCI Ethernet+Modem) + 0449 WinModem 56k + 0e11 b14d 56k V.90 Modem + 13e0 0020 LT WinModem 56k Data+Fax + 13e0 0041 TelePath Internet 56k WinModem + 1436 0440 Lucent Win Modem + 144f 0449 Lucent 56k V.90 DFi Modem + 1468 0410 IBM ThinkPad T23 (2647-4MG) + 1468 0440 Lucent Win Modem + 1468 0449 Presario 56k V.90 DFi Modem + 044a F-1156IV WinModem (V90, 56KFlex) + 10cf 1072 LB Global LT Modem + 13e0 0012 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 13e0 0042 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 144f 1005 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd + 044b LT WinModem + 044c LT WinModem + 044d LT WinModem + 044e LT WinModem + 044f V90 WildWire Modem + 0450 LT WinModem + 144f 4005 Magnia SG20 + 0451 LT WinModem + 0452 LT WinModem + 0453 LT WinModem + 0454 LT WinModem + 0455 LT WinModem + 0456 LT WinModem + 0457 LT WinModem + 0458 LT WinModem + 0459 LT WinModem + 045a LT WinModem + 045c LT WinModem + 0461 V90 WildWire Modem + 0462 V90 WildWire Modem + 0480 Venus Modem (V90, 56KFlex) + 5801 USB + 5802 USS-312 USB Controller +# 4 port PCI USB Controller made by Agere (formely Lucent) + 5803 USS-344S USB Controller + 5811 FW323 + dead 0800 FireWire Host Bus Adapter +11c2 Sand Microelectronics +11c3 NEC Corporation +11c4 Document Technologies, Inc +11c5 Shiva Corporation +11c6 Dainippon Screen Mfg. Co. Ltd +11c7 D.C.M. Data Systems +11c8 Dolphin Interconnect Solutions AS + 0658 PSB32 SCI-Adapter D31x + d665 PSB64 SCI-Adapter D32x + d667 PSB66 SCI-Adapter D33x +11c9 Magma + 0010 16-line serial port w/- DMA + 0011 4-line serial port w/- DMA +11ca LSI Systems, Inc +11cb Specialix Research Ltd. + 2000 PCI_9050 + 11cb 0200 SX + 11cb b008 I/O8+ + 4000 SUPI_1 + 8000 T225 +11cc Michels & Kleberhoff Computer GmbH +11cd HAL Computer Systems, Inc. +11ce Netaccess +11cf Pioneer Electronic Corporation +11d0 Lockheed Martin Federal Systems-Manassas +11d1 Auravision + 01f7 VxP524 +11d2 Intercom Inc. +11d3 Trancell Systems Inc +11d4 Analog Devices + 1805 SM56 PCI modem + 1889 AD1889 sound chip +11d5 Ikon Corporation + 0115 10115 + 0117 10117 +11d6 Tekelec Telecom +11d7 Trenton Technology, Inc. +11d8 Image Technologies Development +11d9 TEC Corporation +11da Novell +11db Sega Enterprises Ltd +11dc Questra Corporation +11dd Crosfield Electronics Limited +11de Zoran Corporation + 6057 ZR36057PQC Video cutting chipset + 1031 7efe DC10 Plus + 1031 fc00 MiroVIDEO DC50, Motion JPEG Capture/CODEC Board + 13ca 4231 JPEG/TV Card + 6120 ZR36120 + 1328 f001 Cinemaster C DVD Decoder +11df New Wave PDG +11e0 Cray Communications A/S +11e1 GEC Plessey Semi Inc. +11e2 Samsung Information Systems America +11e3 Quicklogic Corporation + 5030 PC Watchdog +11e4 Second Wave Inc +11e5 IIX Consulting +11e6 Mitsui-Zosen System Research +11e7 Toshiba America, Elec. Company +11e8 Digital Processing Systems Inc. +11e9 Highwater Designs Ltd. +11ea Elsag Bailey +11eb Formation Inc. +11ec Coreco Inc +11ed Mediamatics +11ee Dome Imaging Systems Inc +11ef Nicolet Technologies B.V. +11f0 Compu-Shack + 4231 FDDI + 4232 FASTline UTP Quattro + 4233 FASTline FO + 4234 FASTline UTP + 4235 FASTline-II UTP + 4236 FASTline-II FO + 4731 GIGAline +11f1 Symbios Logic Inc +11f2 Picture Tel Japan K.K. +11f3 Keithley Metrabyte +11f4 Kinetic Systems Corporation + 2915 CAMAC controller +11f5 Computing Devices International +11f6 Compex + 0112 ENet100VG4 + 0113 FreedomLine 100 + 1401 ReadyLink 2000 + 2011 RL100-ATX 10/100 + 11f6 2011 RL100-ATX + 2201 ReadyLink 100TX (Winbond W89C840) + 11f6 2011 ReadyLink 100TX + 9881 RL100TX +11f7 Scientific Atlanta +11f8 PMC-Sierra Inc. + 7375 PM7375 [LASAR-155 ATM SAR] +11f9 I-Cube Inc +11fa Kasan Electronics Company, Ltd. +11fb Datel Inc +11fc Silicon Magic +11fd High Street Consultants +11fe Comtrol Corporation + 0001 RocketPort 8 Oct + 0002 RocketPort 8 Intf + 0003 RocketPort 16 Intf + 0004 RocketPort 32 Intf + 0005 RocketPort Octacable + 0006 RocketPort 8J + 0007 RocketPort 4-port + 0008 RocketPort 8-port + 0009 RocketPort 16-port + 000a RocketPort Plus Quadcable + 000b RocketPort Plus Octacable + 000c RocketPort 8-port Modem + 8015 RocketPort 4-port UART 16954 +11ff Scion Corporation +1200 CSS Corporation +1201 Vista Controls Corp +1202 Network General Corp. + 4300 Gigabit Ethernet Adapter + 1202 9841 SK-9841 LX + 1202 9842 SK-9841 LX dual link + 1202 9843 SK-9843 SX + 1202 9844 SK-9843 SX dual link +1203 Bayer Corporation, Agfa Division +1204 Lattice Semiconductor Corporation +1205 Array Corporation +1206 Amdahl Corporation +1208 Parsytec GmbH + 4853 HS-Link Device +1209 SCI Systems Inc +120a Synaptel +120b Adaptive Solutions +120c Technical Corp. +120d Compression Labs, Inc. +120e Cyclades Corporation + 0100 Cyclom-Y below first megabyte + 0101 Cyclom-Y above first megabyte + 0102 Cyclom-4Y below first megabyte + 0103 Cyclom-4Y above first megabyte + 0104 Cyclom-8Y below first megabyte + 0105 Cyclom-8Y above first megabyte + 0200 Cyclades-Z below first megabyte + 0201 Cyclades-Z above first megabyte + 0300 PC300/RSV or /X21 (2 ports) + 0301 PC300/RSV or /X21 (1 port) + 0310 PC300/TE (2 ports) + 0311 PC300/TE (1 port) + 0320 PC300/TE-M (2 ports) + 0321 PC300/TE-M (1 port) + 0400 PC400 +120f Essential Communications + 0001 Roadrunner serial HIPPI +1210 Hyperparallel Technologies +1211 Braintech Inc +1212 Kingston Technology Corp. +1213 Applied Intelligent Systems, Inc. +1214 Performance Technologies, Inc. +1215 Interware Co., Ltd +1216 Purup Prepress A/S +1217 O2 Micro, Inc. + 6729 OZ6729 + 673a OZ6730 + 6832 OZ6832/6833 Cardbus Controller + 6836 OZ6836/6860 Cardbus Controller + 6872 OZ6812 Cardbus Controller + 6925 OZ6922 Cardbus Controller + 6933 OZ6933 Cardbus Controller + 1025 1016 Travelmate 612 TX + 6972 OZ6912 Cardbus Controller + 1179 0001 Magnia Z310 +1218 Hybricon Corp. +1219 First Virtual Corporation +121a 3Dfx Interactive, Inc. + 0001 Voodoo + 0002 Voodoo 2 + 0003 Voodoo Banshee + 1092 0003 Monster Fusion + 1092 4000 Monster Fusion + 1092 4002 Monster Fusion + 1092 4801 Monster Fusion AGP + 1092 4803 Monster Fusion AGP + 1092 8030 Monster Fusion + 1092 8035 Monster Fusion AGP + 10b0 0001 Dragon 4000 + 1102 1018 3D Blaster Banshee VE + 121a 0001 Voodoo Banshee AGP + 121a 0003 Voodoo Banshee AGP SGRAM + 121a 0004 Voodoo Banshee + 139c 0016 Raven + 139c 0017 Raven + 14af 0002 Maxi Gamer Phoenix + 0004 Voodoo Banshee [Velocity 100] + 0005 Voodoo 3 + 121a 0004 Voodoo3 AGP + 121a 0030 Voodoo3 AGP + 121a 0031 Voodoo3 AGP + 121a 0034 Voodoo3 AGP + 121a 0036 Voodoo3 + 121a 0037 Voodoo3 AGP + 121a 0038 Voodoo3 AGP + 121a 003a Voodoo3 AGP + 121a 0044 Voodoo3 + 121a 004b Velocity 100 + 121a 004c Velocity 200 + 121a 004d Voodoo3 AGP + 121a 004e Voodoo3 AGP + 121a 0051 Voodoo3 AGP + 121a 0052 Voodoo3 AGP + 121a 0060 Voodoo3 3500 TV (NTSC) + 121a 0061 Voodoo3 3500 TV (PAL) + 121a 0062 Voodoo3 3500 TV (SECAM) + 0009 Voodoo 4 / Voodoo 5 + 121a 0009 Voodoo5 AGP 5500/6000 + 0057 Voodoo 3/3000 [Avenger] +121b Advanced Telecommunications Modules +121c Nippon Texaco., Ltd +121d Lippert Automationstechnik GmbH +121e CSPI +121f Arcus Technology, Inc. +1220 Ariel Corporation + 1220 AMCC 5933 TMS320C80 DSP/Imaging board +1221 Contec Co., Ltd +1222 Ancor Communications, Inc. +1223 Artesyn Communication Products + 0003 PM/Link + 0004 PM/T1 + 0005 PM/E1 + 0008 PM/SLS + 0009 BajaSpan Resource Target + 000a BajaSpan Section 0 + 000b BajaSpan Section 1 + 000c BajaSpan Section 2 + 000d BajaSpan Section 3 + 000e PM/PPC +1224 Interactive Images +1225 Power I/O, Inc. +1227 Tech-Source +1228 Norsk Elektro Optikk A/S +1229 Data Kinesis Inc. +122a Integrated Telecom +122b LG Industrial Systems Co., Ltd +122c Sican GmbH +122d Aztech System Ltd + 1206 368DSP + 50dc 3328 Audio + 122d 0001 3328 Audio + 80da 3328 Audio + 122d 0001 3328 Audio +122e Xyratex +122f Andrew Corporation +1230 Fishcamp Engineering +1231 Woodward McCoach, Inc. +1232 GPT Limited +1233 Bus-Tech, Inc. +1234 Technical Corp. +1235 Risq Modular Systems, Inc. +1236 Sigma Designs Corporation + 0000 RealMagic64/GX + 6401 REALmagic 64/GX (SD 6425) +1237 Alta Technology Corporation +1238 Adtran +1239 3DO Company +123a Visicom Laboratories, Inc. +123b Seeq Technology, Inc. +123c Century Systems, Inc. +123d Engineering Design Team, Inc. + 0000 EasyConnect 8/32 + 0002 EasyConnect 8/64 + 0003 EasyIO +123e Simutech, Inc. +123f C-Cube Microsystems + 00e4 MPEG + 8120 E4? + 11bd 0006 DV500 E4 + 11bd 000a DV500 E4 + 8888 Cinemaster C 3.0 DVD Decoder + 1002 0001 Cinemaster C 3.0 DVD Decoder + 1002 0002 Cinemaster C 3.0 DVD Decoder + 1328 0001 Cinemaster C 3.0 DVD Decoder +1240 Marathon Technologies Corp. +1241 DSC Communications +# Formerly Jaycor Networks, Inc. +1242 JNI Corporation + 1560 JNIC-1560 PCI-X Fibre Channel Controller + 1242 6562 FCX2-6562 Dual Channel PCI-X Fibre Channel Adapter + 1242 656a FCX-6562 PCI-X Fibre Channel Adapter + 4643 FCI-1063 Fibre Channel Adapter +1243 Delphax +1244 AVM Audiovisuelles MKTG & Computer System GmbH + 0700 B1 ISDN + 0800 C4 ISDN + 0a00 A1 ISDN [Fritz] + 1244 0a00 FRITZ!Card ISDN Controller + 0e00 Fritz!PCI v2.0 ISDN + 1100 C2 ISDN + 1200 T1 ISDN +1245 A.P.D., S.A. +1246 Dipix Technologies, Inc. +1247 Xylon Research, Inc. +1248 Central Data Corporation +1249 Samsung Electronics Co., Ltd. +124a AEG Electrocom GmbH +124b SBS/Greenspring Modular I/O + 0040 PCI-40A or cPCI-200 Quad IndustryPack carrier + 124b 9080 PCI9080 Bridge +124c Solitron Technologies, Inc. +124d Stallion Technologies, Inc. + 0000 EasyConnection 8/32 + 0002 EasyConnection 8/64 + 0003 EasyIO + 0004 EasyConnection/RA +124e Cylink +124f Infotrend Technology, Inc. + 0041 IFT-2000 Series RAID Controller +1250 Hitachi Microcomputer System Ltd +1251 VLSI Solutions Oy +1253 Guzik Technical Enterprises +1254 Linear Systems Ltd. +1255 Optibase Ltd + 1110 MPEG Forge + 1210 MPEG Fusion + 2110 VideoPlex + 2120 VideoPlex CC + 2130 VideoQuest +1256 Perceptive Solutions, Inc. + 4201 PCI-2220I + 4401 PCI-2240I + 5201 PCI-2000 +1257 Vertex Networks, Inc. +1258 Gilbarco, Inc. +1259 Allied Telesyn International + 2560 AT-2560 Fast Ethernet Adapter (i82557B) +125a ABB Power Systems +125b Asix Electronics Corporation + 1400 ALFA GFC2204 +125c Aurora Technologies, Inc. + 0640 Aries 16000P +125d ESS Technology + 0000 ES336H Fax Modem (Early Model) + 1948 Solo? + 1968 ES1968 Maestro 2 + 1028 0085 ES1968 Maestro-2 PCI + 1033 8051 ES1968 Maestro-2 Audiodrive + 1969 ES1969 Solo-1 Audiodrive + 1014 0166 ES1969 SOLO-1 AudioDrive on IBM Aptiva Mainboard + 125d 8888 Solo-1 Audio Adapter + 1978 ES1978 Maestro 2E + 0e11 b112 Armada M700 + 1033 803c ES1978 Maestro-2E Audiodrive + 1033 8058 ES1978 Maestro-2E Audiodrive + 1092 4000 Monster Sound MX400 + 1179 0001 ES1978 Maestro-2E Audiodrive + 1988 ES1988 Allegro-1 + 1092 4100 Sonic Impact S100 + 125d 1988 ESS Allegro-1 Audiodrive + 1989 ESS Modem + 125d 1989 ESS Modem + 1998 ES1983S Maestro-3i PCI Audio Accelerator + 1028 00e6 ES1983S Maestro-3i (Dell Inspiron 8100) + 1999 ES1983S Maestro-3i PCI Modem Accelerator + 199a ES1983S Maestro-3i PCI Audio Accelerator + 199b ES1983S Maestro-3i PCI Modem Accelerator + 2808 ES336H Fax Modem (Later Model) + 2838 ES2838/2839 SuperLink Modem + 2898 ES2898 Modem + 125d 0424 ES56-PI Data Fax Modem + 125d 0425 ES56T-PI Data Fax Modem + 125d 0426 ES56V-PI Data Fax Modem + 125d 0427 VW-PI Data Fax Modem + 125d 0428 ES56ST-PI Data Fax Modem + 125d 0429 ES56SV-PI Data Fax Modem + 147a c001 ES56-PI Data Fax Modem + 14fe 0428 ES56-PI Data Fax Modem + 14fe 0429 ES56-PI Data Fax Modem +125e Specialvideo Engineering SRL +125f Concurrent Technologies, Inc. +1260 Harris Semiconductor + 3873 Prism 2.5 Wavelan chipset + 1186 3501 DWL-520 Wireless PCI Adapter + 1668 0414 HWP01170-01 802.11b PCI Wireless Adapter + 1737 3874 WMP11 Wireless 802.11b PCI Adapter + 8086 2513 Wireless 802.11b MiniPCI Adapter + 8130 HMP8130 NTSC/PAL Video Decoder + 8131 HMP8131 NTSC/PAL Video Decoder +1261 Matsushita-Kotobuki Electronics Industries, Ltd. +1262 ES Computer Company, Ltd. +1263 Sonic Solutions +1264 Aval Nagasaki Corporation +1265 Casio Computer Co., Ltd. +1266 Microdyne Corporation + 0001 NE10/100 Adapter (i82557B) + 1910 NE2000Plus (RT8029) Ethernet Adapter + 1266 1910 NE2000Plus Ethernet Adapter +1267 S. A. Telecommunications + 5352 PCR2101 + 5a4b Telsat Turbo +1268 Tektronix +1269 Thomson-CSF/TTM +126a Lexmark International, Inc. +126b Adax, Inc. +126c Northern Telecom +126d Splash Technology, Inc. +126e Sumitomo Metal Industries, Ltd. +126f Silicon Motion, Inc. + 0710 SM710 LynxEM + 0712 SM712 LynxEM+ + 0720 SM720 Lynx3DM + 0810 SM810 LynxE + 0811 SM811 LynxE + 0820 SM820 Lynx3D + 0910 SM910 +1270 Olympus Optical Co., Ltd. +1271 GW Instruments +1272 Telematics International +1273 Hughes Network Systems + 0002 DirecPC +1274 Ensoniq + 1371 ES1371 [AudioPCI-97] + 0e11 0024 AudioPCI on Motherboard Compaq Deskpro + 0e11 b1a7 ES1371, ES1373 AudioPCI + 1033 80ac ES1371, ES1373 AudioPCI + 1042 1854 Tazer + 107b 8054 Tabor2 + 1274 1371 Creative Sound Blaster AudioPCI64V, AudioPCI128 + 1462 6470 ES1371, ES1373 AudioPCI On Motherboard MS-6147 1.1A + 1462 6560 ES1371, ES1373 AudioPCI On Motherboard MS-6156 1.10 + 1462 6630 ES1371, ES1373 AudioPCI On Motherboard MS-6163BX 1.0A + 1462 6631 ES1371, ES1373 AudioPCI On Motherboard MS-6163VIA 1.0A + 1462 6632 ES1371, ES1373 AudioPCI On Motherboard MS-6163BX 2.0A + 1462 6633 ES1371, ES1373 AudioPCI On Motherboard MS-6163VIA 2.0A + 1462 6820 ES1371, ES1373 AudioPCI On Motherboard MS-6182 1.00 + 1462 6822 ES1371, ES1373 AudioPCI On Motherboard MS-6182 1.00A + 1462 6830 ES1371, ES1373 AudioPCI On Motherboard MS-6183 1.00 + 1462 6880 ES1371, ES1373 AudioPCI On Motherboard MS-6188 1.00 + 1462 6900 ES1371, ES1373 AudioPCI On Motherboard MS-6190 1.00 + 1462 6910 ES1371, ES1373 AudioPCI On Motherboard MS-6191 + 1462 6930 ES1371, ES1373 AudioPCI On Motherboard MS-6193 + 1462 6990 ES1371, ES1373 AudioPCI On Motherboard MS-6199BX 2.0A + 1462 6991 ES1371, ES1373 AudioPCI On Motherboard MS-6199VIA 2.0A + 14a4 2077 ES1371, ES1373 AudioPCI On Motherboard KR639 + 14a4 2105 ES1371, ES1373 AudioPCI On Motherboard MR800 + 14a4 2107 ES1371, ES1373 AudioPCI On Motherboard MR801 + 14a4 2172 ES1371, ES1373 AudioPCI On Motherboard DR739 + 1509 9902 ES1371, ES1373 AudioPCI On Motherboard KW11 + 1509 9903 ES1371, ES1373 AudioPCI On Motherboard KW31 + 1509 9904 ES1371, ES1373 AudioPCI On Motherboard KA11 + 1509 9905 ES1371, ES1373 AudioPCI On Motherboard KC13 + 152d 8801 ES1371, ES1373 AudioPCI On Motherboard CP810E + 152d 8802 ES1371, ES1373 AudioPCI On Motherboard CP810 + 152d 8803 ES1371, ES1373 AudioPCI On Motherboard P3810E + 152d 8804 ES1371, ES1373 AudioPCI On Motherboard P3810-S + 152d 8805 ES1371, ES1373 AudioPCI On Motherboard P3820-S + 270f 2001 ES1371, ES1373 AudioPCI On Motherboard 6CTR + 270f 2200 ES1371, ES1373 AudioPCI On Motherboard 6WTX + 270f 3000 ES1371, ES1373 AudioPCI On Motherboard 6WSV + 270f 3100 ES1371, ES1373 AudioPCI On Motherboard 6WIV2 + 270f 3102 ES1371, ES1373 AudioPCI On Motherboard 6WIV + 270f 7060 ES1371, ES1373 AudioPCI On Motherboard 6ASA2 + 8086 4249 ES1371, ES1373 AudioPCI On Motherboard BI440ZX + 8086 424c ES1371, ES1373 AudioPCI On Motherboard BL440ZX + 8086 425a ES1371, ES1373 AudioPCI On Motherboard BZ440ZX + 8086 4341 ES1371, ES1373 AudioPCI On Motherboard Cayman + 8086 4343 ES1371, ES1373 AudioPCI On Motherboard Cape Cod + 8086 4649 ES1371, ES1373 AudioPCI On Motherboard Fire Island + 8086 464a ES1371, ES1373 AudioPCI On Motherboard FJ440ZX + 8086 4d4f ES1371, ES1373 AudioPCI On Motherboard Montreal + 8086 4f43 ES1371, ES1373 AudioPCI On Motherboard OC440LX + 8086 5243 ES1371, ES1373 AudioPCI On Motherboard RC440BX + 8086 5352 ES1371, ES1373 AudioPCI On Motherboard SunRiver + 8086 5643 ES1371, ES1373 AudioPCI On Motherboard Vancouver + 8086 5753 ES1371, ES1373 AudioPCI On Motherboard WS440BX + 5000 ES1370 [AudioPCI] + 5880 5880 AudioPCI + 1274 2000 Creative Sound Blaster AudioPCI128 + 1274 2003 Creative SoundBlaster AudioPCI 128 + 1274 5880 Creative Sound Blaster AudioPCI128 + 1458 a000 5880 AudioPCI On Motherboard 6OXET + 1462 6880 5880 AudioPCI On Motherboard MS-6188 1.00 + 270f 2001 5880 AudioPCI On Motherboard 6CTR + 270f 2200 5880 AudioPCI On Motherboard 6WTX + 270f 7040 5880 AudioPCI On Motherboard 6ATA4 +1275 Network Appliance Corporation +1276 Switched Network Technologies, Inc. +1277 Comstream +1278 Transtech Parallel Systems Ltd. + 0701 TPE3/TM3 PowerPC Node +1279 Transmeta Corporation + 0295 Northbridge + 0395 LongRun Northbridge + 0396 SDRAM controller + 0397 BIOS scratchpad +127a Rockwell International + 1002 HCF 56k Data/Fax Modem + 1092 094c SupraExpress 56i PRO [Diamond SUP2380] + 122d 4002 HPG / MDP3858-U + 122d 4005 MDP3858-E + 122d 4007 MDP3858-A/-NZ + 122d 4012 MDP3858-SA + 122d 4017 MDP3858-W + 122d 4018 MDP3858-W + 127a 1002 Rockwell 56K D/F HCF Modem + 1003 HCF 56k Data/Fax Modem + 0e11 b0bc 229-DF Zephyr + 0e11 b114 229-DF Cheetah + 1033 802b 229-DF + 13df 1003 PCI56RX Modem + 13e0 0117 IBM + 13e0 0147 IBM F-1156IV+/R3 Spain V.90 Modem + 13e0 0197 IBM + 13e0 01c7 IBM F-1156IV+/R3 WW V.90 Modem + 13e0 01f7 IBM + 1436 1003 IBM + 1436 1103 IBM 5614PM3G V.90 Modem + 1436 1602 Compaq 229-DF Ducati + 1004 HCF 56k Data/Fax/Voice Modem + 1048 1500 MicroLink 56k Modem + 10cf 1059 Fujitsu 229-DFRT + 1005 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 1033 8029 229-DFSV + 1033 8054 Modem + 10cf 103c Fujitsu + 10cf 1055 Fujitsu 229-DFSV + 10cf 1056 Fujitsu 229-DFSV + 122d 4003 MDP3858SP-U + 122d 4006 Packard Bell MDP3858V-E + 122d 4008 MDP3858SP-A/SP-NZ + 122d 4009 MDP3858SP-E + 122d 4010 MDP3858V-U + 122d 4011 MDP3858SP-SA + 122d 4013 MDP3858V-A/V-NZ + 122d 4015 MDP3858SP-W + 122d 4016 MDP3858V-W + 122d 4019 MDP3858V-SA + 13df 1005 PCI56RVP Modem + 13e0 0187 IBM + 13e0 01a7 IBM + 13e0 01b7 IBM DF-1156IV+/R3 Spain V.90 Modem + 13e0 01d7 IBM DF-1156IV+/R3 WW V.90 Modem + 1436 1005 IBM + 1436 1105 IBM + 1437 1105 IBM 5614PS3G V.90 Modem + 1022 HCF 56k Modem + 1436 1303 M3-5614PM3G V.90 Modem + 1023 HCF 56k Data/Fax Modem + 122d 4020 Packard Bell MDP3858-WE + 122d 4023 MDP3858-UE + 13e0 0247 IBM F-1156IV+/R6 Spain V.90 Modem + 13e0 0297 IBM + 13e0 02c7 IBM F-1156IV+/R6 WW V.90 Modem + 1436 1203 IBM + 1436 1303 IBM + 1024 HCF 56k Data/Fax/Voice Modem + 1025 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 10cf 106a Fujitsu 235-DFSV + 122d 4021 Packard Bell MDP3858V-WE + 122d 4022 MDP3858SP-WE + 122d 4024 MDP3858V-UE + 122d 4025 MDP3858SP-UE + 1026 HCF 56k PCI Speakerphone Modem + 1032 HCF 56k Modem + 1033 HCF 56k Modem + 1034 HCF 56k Modem + 1035 HCF 56k PCI Speakerphone Modem + 1036 HCF 56k Modem + 1085 HCF 56k Volcano PCI Modem + 2005 HCF 56k Data/Fax Modem + 104d 8044 229-DFSV + 104d 8045 229-DFSV + 104d 8055 PBE/Aztech 235W-DFSV + 104d 8056 235-DFSV + 104d 805a Modem + 104d 805f Modem + 104d 8074 Modem + 2013 HSF 56k Data/Fax Modem + 1179 0001 Modem + 1179 ff00 Modem + 2014 HSF 56k Data/Fax/Voice Modem + 10cf 1057 Fujitsu Citicorp III + 122d 4050 MSP3880-U + 122d 4055 MSP3880-W + 2015 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 10cf 1063 Fujitsu + 10cf 1064 Fujitsu + 1468 2015 Fujitsu + 2016 HSF 56k Data/Fax/Voice/Spkp Modem + 122d 4051 MSP3880V-W + 122d 4052 MSP3880SP-W + 122d 4054 MSP3880V-U + 122d 4056 MSP3880SP-U + 122d 4057 MSP3880SP-A + 4311 Riptide HSF 56k PCI Modem + 127a 4311 Ring Modular? Riptide HSF RT HP Dom + 13e0 0210 HP-GVC + 4320 Riptide PCI Audio Controller + 1235 4320 Riptide PCI Audio Controller + 4321 Riptide HCF 56k PCI Modem + 1235 4321 Hewlett Packard DF + 1235 4324 Hewlett Packard DF + 13e0 0210 Hewlett Packard DF + 144d 2321 Riptide + 4322 Riptide PCI Game Controller + 1235 4322 Riptide PCI Game Controller + 8234 RapidFire 616X ATM155 Adapter + 108d 0022 RapidFire 616X ATM155 Adapter + 108d 0027 RapidFire 616X ATM155 Adapter +127b Pixera Corporation +127c Crosspoint Solutions, Inc. +127d Vela Research +127e Winnov, L.P. +127f Fujifilm +1280 Photoscript Group Ltd. +1281 Yokogawa Electric Corporation +1282 Davicom Semiconductor, Inc. + 9009 Ethernet 100/10 MBit + 9100 Ethernet 100/10 MBit + 9102 Ethernet 100/10 MBit + 9132 Ethernet 100/10 MBit +1283 Integrated Technology Express, Inc. + 673a IT8330G + 8330 IT8330G + 8888 IT8888F PCI to ISA Bridge with SMB + 8889 IT8889F PCI to ISA Bridge + e886 IT8330G +1284 Sahara Networks, Inc. +1285 Platform Technologies, Inc. + 0100 AGOGO sound chip (aka ESS Maestro 1) +1286 Mazet GmbH +1287 M-Pact, Inc. + 001e LS220D DVD Decoder + 001f LS220C DVD Decoder +1288 Timestep Corporation +1289 AVC Technology, Inc. +128a Asante Technologies, Inc. +128b Transwitch Corporation +128c Retix Corporation +128d G2 Networks, Inc. + 0021 ATM155 Adapter +128e Hoontech Corporation/Samho Multi Tech Ltd. + 0008 ST128 WSS/SB + 0009 ST128 SAM9407 + 000a ST128 Game Port + 000b ST128 MPU Port + 000c ST128 Ctrl Port +128f Tateno Dennou, Inc. +1290 Sord Computer Corporation +1291 NCS Computer Italia +1292 Tritech Microelectronics Inc +1293 Media Reality Technology +1294 Rhetorex, Inc. +1295 Imagenation Corporation +1296 Kofax Image Products +1297 Holco Enterprise Co, Ltd/Shuttle Computer +1298 Spellcaster Telecommunications Inc. +1299 Knowledge Technology Lab. +129a VMetro, inc. + 0615 PBT-615 PCI-X Bus Analyzer +129b Image Access +129c Jaycor +129d Compcore Multimedia, Inc. +129e Victor Company of Japan, Ltd. +129f OEC Medical Systems, Inc. +12a0 Allen-Bradley Company +12a1 Simpact Associates, Inc. +12a2 Newgen Systems Corporation +12a3 Lucent Technologies +12a4 NTT Electronics Technology Company +12a5 Vision Dynamics Ltd. +12a6 Scalable Networks, Inc. +12a7 AMO GmbH +12a8 News Datacom +12a9 Xiotech Corporation +12aa SDL Communications, Inc. +12ab Yuan Yuan Enterprise Co., Ltd. + 3000 MPG-200C PCI DVD Decoder Card +12ac Measurex Corporation +12ad Multidata GmbH +12ae Alteon Networks Inc. + 0001 AceNIC Gigabit Ethernet + 12ae 0001 Gigabit Ethernet-SX (Universal) + 1410 0104 Gigabit Ethernet-SX PCI Adapter + 0002 AceNIC Gigabit Ethernet (Copper) + 12ae 0002 Gigabit Ethernet-T (3C986-T) +12af TDK USA Corp +12b0 Jorge Scientific Corp +12b1 GammaLink +12b2 General Signal Networks +12b3 Inter-Face Co Ltd +12b4 FutureTel Inc +12b5 Granite Systems Inc. +12b6 Natural Microsystems +12b7 Cognex Modular Vision Systems Div. - Acumen Inc. +12b8 Korg +12b9 US Robotics/3Com + 1006 WinModem + 12b9 005c USR 56k Internal Voice WinModem (Model 3472) + 12b9 005e USR 56k Internal WinModem (Models 662975) + 12b9 0062 USR 56k Internal Voice WinModem (Model 662978) + 12b9 0068 USR 56k Internal Voice WinModem (Model 5690) + 12b9 007a USR 56k Internal Voice WinModem (Model 662974) + 12b9 007f USR 56k Internal WinModem (Models 5698, 5699) + 12b9 0080 USR 56k Internal WinModem (Models 2975, 3528) + 12b9 0081 USR 56k Internal Voice WinModem (Models 2974, 3529) + 12b9 0091 USR 56k Internal Voice WinModem (Model 2978) + 1007 USR 56k Internal WinModem + 12b9 00a3 USR 56k Internal WinModem (Model 3595) + 1008 56K FaxModem Model 5610 + 12b9 00a2 USR 56k Internal FAX Modem (Model 2977) + 12b9 00aa USR 56k Internal Voice Modem (Model 2976) + 12b9 00ab USR 56k Internal Voice Modem (Model 5609) + 12b9 00ac USR 56k Internal Voice Modem (Model 3298) + 12b9 00ad USR 56k Internal FAX Modem (Model 5610) +12ba BittWare, Inc. +12bb Nippon Unisoft Corporation +12bc Array Microsystems +12bd Computerm Corp. +12be Anchor Chips Inc. + 3041 AN3041Q CO-MEM + 3042 AN3042Q CO-MEM Lite + 12be 3042 Anchor Chips Lite Evaluation Board +12bf Fujifilm Microdevices +12c0 Infimed +12c1 GMM Research Corp +12c2 Mentec Limited +12c3 Holtek Microelectronics Inc + 0058 PCI NE2K Ethernet + 5598 PCI NE2K Ethernet +12c4 Connect Tech Inc +12c5 Picture Elements Incorporated + 007e Imaging/Scanning Subsystem Engine + 007f Imaging/Scanning Subsystem Engine + 0081 PCIVST [Grayscale Thresholding Engine] + 0085 Video Simulator/Sender + 0086 THR2 Multi-scale Thresholder +12c6 Mitani Corporation +12c7 Dialogic Corp +12c8 G Force Co, Ltd +12c9 Gigi Operations +12ca Integrated Computing Engines +12cb Antex Electronics Corporation +12cc Pluto Technologies International +12cd Aims Lab +12ce Netspeed Inc. +12cf Prophet Systems, Inc. +12d0 GDE Systems, Inc. +12d1 PSITech +12d2 NVidia / SGS Thomson (Joint Venture) + 0008 NV1 + 0009 DAC64 + 0018 Riva128 + 1048 0c10 VICTORY Erazor + 107b 8030 STB Velocity 128 + 1092 0350 Viper V330 + 1092 1092 Viper V330 + 10b4 1b1b STB Velocity 128 + 10b4 1b1d STB Velocity 128 + 10b4 1b1e STB Velocity 128, PAL TV-Out + 10b4 1b20 STB Velocity 128 Sapphire + 10b4 1b21 STB Velocity 128 + 10b4 1b22 STB Velocity 128 AGP, NTSC TV-Out + 10b4 1b23 STB Velocity 128 AGP, PAL TV-Out + 10b4 1b27 STB Velocity 128 DVD + 10b4 1b88 MVP Pro 128 + 10b4 222a STB Velocity 128 AGP + 10b4 2230 STB Velocity 128 + 10b4 2232 STB Velocity 128 + 10b4 2235 STB Velocity 128 AGP + 2a15 54a3 3DVision-SAGP / 3DexPlorer 3000 + 0019 Riva128ZX + 0020 TNT + 0028 TNT2 + 0029 UTNT2 + 002c VTNT2 + 00a0 ITNT2 +12d3 Vingmed Sound A/S +12d4 Ulticom (Formerly DGM&S) +12d5 Equator Technologies +12d6 Analogic Corp +12d7 Biotronic SRL +12d8 Pericom Semiconductor +12d9 Aculab PLC +12da True Time Inc. +12db Annapolis Micro Systems, Inc +12dc Symicron Computer Communication Ltd. +12dd Management Graphics +12de Rainbow Technologies +12df SBS Technologies Inc +12e0 Chase Research + 0010 ST16C654 Quad UART + 0020 ST16C654 Quad UART + 0030 ST16C654 Quad UART +12e1 Nintendo Co, Ltd +12e2 Datum Inc. Bancomm-Timing Division +12e3 Imation Corp - Medical Imaging Systems +12e4 Brooktrout Technology Inc +12e5 Apex Semiconductor Inc +12e6 Cirel Systems +12e7 Sunsgroup Corporation +12e8 Crisc Corp +12e9 GE Spacenet +12ea Zuken +12eb Aureal Semiconductor + 0001 Vortex 1 + 104d 8036 AU8820 Vortex Digital Audio Processor + 1092 2000 Sonic Impact A3D + 1092 2100 Sonic Impact A3D + 1092 2110 Sonic Impact A3D + 1092 2200 Sonic Impact A3D + 122d 1002 AU8820 Vortex Digital Audio Processor + 12eb 0001 AU8820 Vortex Digital Audio Processor + 5053 3355 Montego + 0002 Vortex 2 + 104d 8049 AU8830 Vortex 3D Digital Audio Processor + 104d 807b AU8830 Vortex 3D Digital Audio Processor + 1092 3000 Monster Sound II + 1092 3001 Monster Sound II + 1092 3002 Monster Sound II + 1092 3003 Monster Sound II + 1092 3004 Monster Sound II + 12eb 0001 AU8830 Vortex 3D Digital Audio Processor + 12eb 0002 AU8830 Vortex 3D Digital Audio Processor + 12eb 0088 AU8830 Vortex 3D Digital Audio Processor + 144d 3510 AU8830 Vortex 3D Digital Audio Processor + 5053 3356 Montego II + 0003 AU8810 Vortex Digital Audio Processor + 104d 8049 AU8810 Vortex Digital Audio Processor + 104d 8077 AU8810 Vortex Digital Audio Processor + 109f 1000 AU8810 Vortex Digital Audio Processor + 12eb 0003 AU8810 Vortex Digital Audio Processor + 1462 6780 AU8810 Vortex Digital Audio Processor + 14a4 2073 AU8810 Vortex Digital Audio Processor + 14a4 2091 AU8810 Vortex Digital Audio Processor + 14a4 2104 AU8810 Vortex Digital Audio Processor + 14a4 2106 AU8810 Vortex Digital Audio Processor + 8803 Vortex 56k Software Modem + 12eb 8803 Vortex 56k Software Modem +12ec 3A International, Inc. +12ed Optivision Inc. +12ee Orange Micro +12ef Vienna Systems +12f0 Pentek +12f1 Sorenson Vision Inc +12f2 Gammagraphx, Inc. +12f3 Radstone Technology +12f4 Megatel +12f5 Forks +12f6 Dawson France +12f7 Cognex +12f8 Electronic Design GmbH + 0002 VideoMaker +12f9 Four Fold Ltd +12fb Spectrum Signal Processing +12fc Capital Equipment Corp +12fd I2S +12fe ESD Electronic System Design GmbH +12ff Lexicon +1300 Harman International Industries Inc +1302 Computer Sciences Corp +1303 Innovative Integration +1304 Juniper Networks +1305 Netphone, Inc +1306 Duet Technologies +1307 Computer Boards + 0001 PCI-DAS1602/16 + 000b PCI-DIO48H + 000c PCI-PDISO8 + 000d PCI-PDISO16 + 000f PCI-DAS1200 + 0010 PCI-DAS1602/12 + 0014 PCI-DIO24H + 0015 PCI-DIO24H/CTR3 + 0016 PCI-DIO48H/CTR15 + 0017 PCI-DIO96H + 0018 PCI-CTR05 + 0019 PCI-DAS1200/JR + 001a PCI-DAS1001 + 001b PCI-DAS1002 + 001c PCI-DAS1602JR/16 + 001d PCI-DAS6402/16 + 001e PCI-DAS6402/12 + 001f PCI-DAS16/M1 + 0020 PCI-DDA02/12 + 0021 PCI-DDA04/12 + 0022 PCI-DDA08/12 + 0023 PCI-DDA02/16 + 0024 PCI-DDA04/16 + 0025 PCI-DDA08/16 + 0026 PCI-DAC04/12-HS + 0027 PCI-DAC04/16-HS + 0028 PCI-DIO24 + 0029 PCI-DAS08 + 002c PCI-INT32 + 0033 PCI-DUAL-AC5 + 0034 PCI-DAS-TC + 0035 PCI-DAS64/M1/16 + 0036 PCI-DAS64/M2/16 + 0037 PCI-DAS64/M3/16 + 004c PCI-DAS1000 +1308 Jato Technologies Inc. + 0001 NetCelerator Adapter + 1308 0001 NetCelerator Adapter +1309 AB Semiconductor Ltd +130a Mitsubishi Electric Microcomputer +130b Colorgraphic Communications Corp +130c Ambex Technologies, Inc +130d Accelerix Inc +130e Yamatake-Honeywell Co. Ltd +130f Advanet Inc +1310 Gespac +1311 Videoserver, Inc +1312 Acuity Imaging, Inc +1313 Yaskawa Electric Co. +1316 Teradyne Inc +1317 Linksys + 0981 Fast Ethernet 10/100 + 0985 Network Everywhere Fast Ethernet 10/100 model NC100 + 1985 Fast Ethernet 10/100 +1318 Packet Engines Inc. + 0911 PCI Ethernet Adapter +1319 Fortemedia, Inc + 0801 Xwave QS3000A [FM801] + 0802 Xwave QS3000A [FM801 game port] + 1000 FM801 PCI Audio + 1001 FM801 PCI Joystick +131a Finisar Corp. +131c Nippon Electro-Sensory Devices Corp +131d Sysmic, Inc. +131e Xinex Networks Inc +131f Siig Inc + 1000 CyberSerial (1-port) 16550 + 1001 CyberSerial (1-port) 16650 + 1002 CyberSerial (1-port) 16850 + 1010 Duet 1S(16550)+1P + 1011 Duet 1S(16650)+1P + 1012 Duet 1S(16850)+1P + 1020 CyberParallel (1-port) + 1021 CyberParallel (2-port) + 1030 CyberSerial (2-port) 16550 + 1031 CyberSerial (2-port) 16650 + 1032 CyberSerial (2-port) 16850 + 1034 Trio 2S(16550)+1P + 1035 Trio 2S(16650)+1P + 1036 Trio 2S(16850)+1P + 1050 CyberSerial (4-port) 16550 + 1051 CyberSerial (4-port) 16650 + 1052 CyberSerial (4-port) 16850 + 2000 CyberSerial (1-port) 16550 + 2001 CyberSerial (1-port) 16650 + 2002 CyberSerial (1-port) 16850 + 2010 Duet 1S(16550)+1P + 2011 Duet 1S(16650)+1P + 2012 Duet 1S(16850)+1P + 2020 CyberParallel (1-port) + 2021 CyberParallel (2-port) + 2030 CyberSerial (2-port) 16550 + 131f 2030 PCI Serial Card + 2031 CyberSerial (2-port) 16650 + 2032 CyberSerial (2-port) 16850 + 2040 Trio 1S(16550)+2P + 2041 Trio 1S(16650)+2P + 2042 Trio 1S(16850)+2P + 2050 CyberSerial (4-port) 16550 + 2051 CyberSerial (4-port) 16650 + 2052 CyberSerial (4-port) 16850 + 2060 Trio 2S(16550)+1P + 2061 Trio 2S(16650)+1P + 2062 Trio 2S(16850)+1P +1320 Crypto AG +1321 Arcobel Graphics BV +1322 MTT Co., Ltd +1323 Dome Inc +1324 Sphere Communications +1325 Salix Technologies, Inc +1326 Seachange international +1327 Voss scientific +1328 quadrant international +1329 Productivity Enhancement +132a Microcom Inc. +132b Broadband Technologies +132c Micrel Inc +132d Integrated Silicon Solution, Inc. +1330 MMC Networks +1331 Radisys Corp. +1332 Micro Memory + 5415 MM-5415CN PCI Memory Module with Battery Backup +1334 Redcreek Communications, Inc +1335 Videomail, Inc +1337 Third Planet Publishing +1338 BT Electronics +133a Vtel Corp +133b Softcom Microsystems +133c Holontech Corp +133d SS Technologies +133e Virtual Computer Corp +133f SCM Microsystems +1340 Atalla Corp +1341 Kyoto Microcomputer Co +1342 Promax Systems Inc +1343 Phylon Communications Inc +1344 Crucial Technology +1345 Arescom Inc +1347 Odetics +1349 Sumitomo Electric Industries, Ltd. +134a DTC Technology Corp. + 0001 Domex 536 + 0002 Domex DMX3194UP SCSI Adapter +134b ARK Research Corp. +134c Chori Joho System Co. Ltd +134d PCTel Inc + 7890 HSP MicroModem 56 + 7891 HSP MicroModem 56 + 134d 0001 HSP MicroModem 56 + 7892 HSP MicroModem 56 + 7893 HSP MicroModem 56 + 7894 HSP MicroModem 56 + 7895 HSP MicroModem 56 + 7896 HSP MicroModem 56 + 7897 HSP MicroModem 56 +134e CSTI +134f Algo System Co Ltd +1350 Systec Co. Ltd +1351 Sonix Inc +1353 Thales Idatys + 0002 Proserver + 0003 PCI-FUT + 0004 PCI-S0 + 0005 PCI-FUT-S0 +1354 Dwave System Inc +1355 Kratos Analytical Ltd +1356 The Logical Co +1359 Prisa Networks +135a Brain Boxes +135b Giganet Inc +135c Quatech Inc + 0010 QSC-100 + 0020 DSC-100 + 0030 DSC-200/300 + 0040 QSC-200/300 + 0050 ESC-100D + 0060 ESC-100M + 00f0 MPAC-100 Syncronous Serial Card (Zilog 85230) + 0170 QSCLP-100 + 0180 DSCLP-100 + 0190 SSCLP-100 + 01a0 QSCLP-200/300 + 01b0 DSCLP-200/300 + 01c0 SSCLP-200/300 +135d ABB Network Partner AB +135e Sealevel Systems Inc + 7101 Single Port RS-232/422/485/530 + 7201 Dual Port RS-232/422/485 Interface + 7202 Dual Port RS-232 Interface + 7401 Four Port RS-232 Interface + 7402 Four Port RS-422/485 Interface + 7801 Eight Port RS-232 Interface + 8001 8001 Digital I/O Adapter +135f I-Data International A-S +1360 Meinberg Funkuhren +1361 Soliton Systems K.K. +1362 Fujifacom Corporation +1363 Phoenix Technology Ltd +1364 ATM Communications Inc +1365 Hypercope GmbH +1366 Teijin Seiki Co. Ltd +1367 Hitachi Zosen Corporation +1368 Skyware Corporation +1369 Digigram +136a High Soft Tech +136b Kawasaki Steel Corporation +136c Adtek System Science Co Ltd +136d Gigalabs Inc +136f Applied Magic Inc +1370 ATL Products +1371 CNet Technology Inc +1373 Silicon Vision Inc +1374 Silicom Ltd +1375 Argosystems Inc +1376 LMC +1377 Electronic Equipment Production & Distribution GmbH +1378 Telemann Co. Ltd +1379 Asahi Kasei Microsystems Co Ltd +137a Mark of the Unicorn Inc +137b PPT Vision +137c Iwatsu Electric Co Ltd +137d Dynachip Corporation +137e Patriot Scientific Corporation +137f Japan Satellite Systems Inc +1380 Sanritz Automation Co Ltd +1381 Brains Co. Ltd +1382 Marian - Electronic & Software +1383 Controlnet Inc +1384 Reality Simulation Systems Inc +1385 Netgear + 4100 802.11b Wireless Adapter (MA301) + 620a GA620 + 622a GA622 + 630a GA630 + f311 FA311 +1386 Video Domain Technologies +1387 Systran Corp +1388 Hitachi Information Technology Co Ltd +1389 Applicom International + 0001 PCI1500PFB [Intelligent fieldbus adaptor] +138a Fusion Micromedia Corp +138b Tokimec Inc +138c Silicon Reality +138d Future Techno Designs pte Ltd +138e Basler GmbH +138f Patapsco Designs Inc +1390 Concept Development Inc +1391 Development Concepts Inc +1392 Medialight Inc +1393 Moxa Technologies Co Ltd + 1040 Smartio C104H/PCI + 1680 Smartio C168H/PCI + 2040 Intellio CP-204J + 2180 Intellio C218 Turbo PCI + 3200 Intellio C320 Turbo PCI +1394 Level One Communications + 0001 LXT1001 Gigabit Ethernet + 1394 0001 NetCelerator Adapter +1395 Ambicom Inc +1396 Cipher Systems Inc +1397 Cologne Chip Designs GmbH + 2bd0 ISDN network controller [HFC-PCI] + 1397 2bd0 ISDN Board + e4bf 1000 CI1-1-Harp +1398 Clarion co. Ltd +1399 Rios systems Co Ltd +139a Alacritech Inc + 0001 Quad Port 10/100 Server Accelerator + 0003 Single Port 10/100 Server Accelerator + 0005 Single Port Gigabit Server Accelerator +139b Mediasonic Multimedia Systems Ltd +139c Quantum 3d Inc +139d EPL limited +139e Media4 +139f Aethra s.r.l. +13a0 Crystal Group Inc +13a1 Kawasaki Heavy Industries Ltd +13a2 Ositech Communications Inc +13a3 Hifn Inc. + 0005 7751 Security Processor + 0006 6500 Public Key Processor + 0007 7811 Security Processor + 0012 7951 Security Processor + 0014 78XX Security Processor + 0016 8065 Security Processor + 0017 8165 Security Processor + 0018 8154 Security Processor +13a4 Rascom Inc +13a5 Audio Digital Imaging Inc +13a6 Videonics Inc +13a7 Teles AG +13a8 Exar Corp. + 0158 XR17C158 Octal UART +13a9 Siemens Medical Systems, Ultrasound Group +13aa Broadband Networks Inc +13ab Arcom Control Systems Ltd +13ac Motion Media Technology Ltd +13ad Nexus Inc +13ae ALD Technology Ltd +13af T.Sqware +13b0 Maxspeed Corp +13b1 Tamura corporation +13b2 Techno Chips Co. Ltd +13b3 Lanart Corporation +13b4 Wellbean Co Inc +13b5 ARM +13b6 Dlog GmbH +13b7 Logic Devices Inc +13b8 Nokia Telecommunications oy +13b9 Elecom Co Ltd +13ba Oxford Instruments +13bb Sanyo Technosound Co Ltd +13bc Bitran Corporation +13bd Sharp corporation +13be Miroku Jyoho Service Co. Ltd +13bf Sharewave Inc +13c0 Microgate Corporation + 0010 SyncLink WAN Adapter +13c1 3ware Inc + 1000 3ware ATA-RAID + 1001 3ware 7000-series ATA-RAID + 1002 3ware ATA-RAID +13c2 Technotrend Systemtechnik GmbH +13c3 Janz Computer AG +13c4 Phase Metrics +13c5 Alphi Technology Corp +13c6 Condor Engineering Inc +13c7 Blue Chip Technology Ltd +13c8 Apptech Inc +13c9 Eaton Corporation +13ca Iomega Corporation +13cb Yano Electric Co Ltd +13cc Metheus Corporation +13cd Compatible Systems Corporation +13ce Cocom A/S +13cf Studio Audio & Video Ltd +13d0 Techsan Electronics Co Ltd +# http://www.b2c2inc.com/products/pc-specs.html + 2103 B2C2 Sky2PC PCI [SkyStar2] +13d1 Abocom Systems Inc + ab02 ADMtek Centaur-C rev 17 [D-Link DFE-680TX] CardBus Fast Ethernet Adapter + ab06 RTL8139 [FE2000VX] CardBus Fast Ethernet Attached Port Adapter +13d2 Shark Multimedia Inc +13d3 IMC Networks +13d4 Graphics Microsystems Inc +13d5 Media 100 Inc +13d6 K.I. Technology Co Ltd +13d7 Toshiba Engineering Corporation +13d8 Phobos corporation +13d9 Apex PC Solutions Inc +13da Intresource Systems pte Ltd +13db Janich & Klass Computertechnik GmbH +13dc Netboost Corporation +13dd Multimedia Bundle Inc +13de ABB Robotics Products AB +13df E-Tech Inc + 0001 PCI56RVP Modem + 13df 0001 PCI56RVP Modem +13e0 GVC Corporation +13e1 Silicom Multimedia Systems Inc +13e2 Dynamics Research Corporation +13e3 Nest Inc +13e4 Calculex Inc +13e5 Telesoft Design Ltd +13e6 Argosy research Inc +13e7 NAC Incorporated +13e8 Chip Express Corporation +13e9 Chip Express Corporation +13ea Dallas Semiconductor +13eb Hauppauge Computer Works Inc +13ec Zydacron Inc +13ed Raytheion E-Systems +13ee Hayes Microcomputer Products Inc +13ef Coppercom Inc +13f0 Sundance Technology Inc + 0201 ST201 Sundance Ethernet +13f1 Oce' - Technologies B.V. +13f2 Ford Microelectronics Inc +13f3 Mcdata Corporation +13f4 Troika Networks, Inc. + 1401 Zentai Fibre Channel Adapter +13f5 Kansai Electric Co. Ltd +13f6 C-Media Electronics Inc + 0100 CM8338A + 13f6 ffff CMI8338/C3DX PCI Audio Device + 0101 CM8338B + 13f6 0101 CMI8338-031 PCI Audio Device + 0111 CM8738 + 1019 0970 P6STP-FL motherboard + 1043 8077 CMI8738 6-channel audio controller + 1043 80e2 CMI8738 6ch-MX + 13f6 0111 CMI8738/C3DX PCI Audio Device + 0211 CM8738 +13f7 Wildfire Communications +13f8 Ad Lib Multimedia Inc +13f9 NTT Advanced Technology Corp. +13fa Pentland Systems Ltd +13fb Aydin Corp +13fc Computer Peripherals International +13fd Micro Science Inc +13fe Advantech Co. Ltd + 1756 PCI-1756 +13ff Silicon Spice Inc +1400 Artx Inc + 1401 9432 TX +1401 CR-Systems A/S +1402 Meilhaus Electronic GmbH +1403 Ascor Inc +1404 Fundamental Software Inc +1405 Excalibur Systems Inc +1406 Oce' Printing Systems GmbH +1407 Lava Computer mfg Inc + 0100 Lava Dual Serial + 0101 Lava Quatro A + 0102 Lava Quatro B + 0200 Lava Port Plus + 0201 Lava Quad A + 0202 Lava Quad B + 0500 Lava Single Serial + 0600 Lava Port 650 + 8000 Lava Parallel + 8001 Dual parallel port controller A + 8002 Lava Dual Parallel port A + 8003 Lava Dual Parallel port B + 8800 BOCA Research IOPPAR +1408 Aloka Co. Ltd +1409 Timedia Technology Co Ltd + 7168 PCI2S550 (Dual 16550 UART) +140a DSP Research Inc +140b Ramix Inc +140c Elmic Systems Inc +140d Matsushita Electric Works Ltd +140e Goepel Electronic GmbH +140f Salient Systems Corp +1410 Midas lab Inc +1411 Ikos Systems Inc +1412 IC Ensemble Inc + 1712 ICE1712 [Envy24] + 1724 ICE1724 [Envy24HT] +1413 Addonics +1414 Microsoft Corporation +1415 Oxford Semiconductor Ltd + 8403 VScom 011H-EP1 1 port parallel adaptor + 9501 OX16PCI954 (Quad 16950 UART) function 0 + 15ed 2000 MCCR Serial p0-3 of 8 + 15ed 2001 MCCR Serial p0-3 of 16 + 950a EXSYS EX-41092 Dual 16950 Serial adapter + 950b OXCB950 Cardbus 16950 UART + 9511 OX16PCI954 (Quad 16950 UART) function 1 + 15ed 2000 MCCR Serial p4-7 of 8 + 15ed 2001 MCCR Serial p4-15 of 16 + 9521 OX16PCI952 (Dual 16950 UART) +1416 Multiwave Innovation pte Ltd +1417 Convergenet Technologies Inc +1418 Kyushu electronics systems Inc +1419 Excel Switching Corp +141a Apache Micro Peripherals Inc +141b Zoom Telephonics Inc +141d Digitan Systems Inc +141e Fanuc Ltd +141f Visiontech Ltd +1420 Psion Dacom plc +1421 Ads Technologies Inc +1422 Ygrec Systems Co Ltd +1423 Custom Technology Corp. +1424 Videoserver Connections +1425 ASIC Designers Inc +1426 Storage Technology Corp. +1427 Better On-Line Solutions +1428 Edec Co Ltd +1429 Unex Technology Corp. +142a Kingmax Technology Inc +142b Radiolan +142c Minton Optic Industry Co Ltd +142d Pix stream Inc +142e Vitec Multimedia +142f Radicom Research Inc +1430 ITT Aerospace/Communications Division +1431 Gilat Satellite Networks +1432 Edimax Computer Co. +1433 Eltec Elektronik GmbH +1435 Real Time Devices US Inc. +1436 CIS Technology Inc +1437 Nissin Inc Co +1438 Atmel-dream +1439 Outsource Engineering & Mfg. Inc +143a Stargate Solutions Inc +143b Canon Research Center, America +143c Amlogic Inc +143d Tamarack Microelectronics Inc +143e Jones Futurex Inc +143f Lightwell Co Ltd - Zax Division +1440 ALGOL Corp. +1441 AGIE Ltd +1442 Phoenix Contact GmbH & Co. +1443 Unibrain S.A. +1444 TRW +1445 Logical DO Ltd +1446 Graphin Co Ltd +1447 AIM GmBH +1448 Alesis Studio Electronics +1449 TUT Systems Inc +144a Adlink Technology + 7296 PCI-7296 + 7432 PCI-7432 + 7433 PCI-7433 + 7434 PCI-7434 + 7841 PCI-7841 + 8133 PCI-8133 + 8554 PCI-8554 + 9111 PCI-9111 + 9113 PCI-9113 + 9114 PCI-9114 +144b Loronix Information Systems Inc +144c Catalina Research Inc +144d Samsung Electronics Co Ltd +144e OLITEC +144f Askey Computer Corp. +1450 Octave Communications Ind. +1451 SP3D Chip Design GmBH +1453 MYCOM Inc +1454 Altiga Networks +1455 Logic Plus Plus Inc +1456 Advanced Hardware Architectures +1457 Nuera Communications Inc +1458 Giga-byte Technology +1459 DOOIN Electronics +145a Escalate Networks Inc +145b PRAIM SRL +145c Cryptek +145d Gallant Computer Inc +145e Aashima Technology B.V. +145f Baldor Electric Company + 0001 NextMove PCI +1460 DYNARC INC +1461 Avermedia Technologies Inc +1462 Micro-Star International Co., Ltd. +1463 Fast Corporation +1464 Interactive Circuits & Systems Ltd +1465 GN NETTEST Telecom DIV. +1466 Designpro Inc. +1467 DIGICOM SPA +1468 AMBIT Microsystem Corp. +1469 Cleveland Motion Controls +146a IFR +146b Parascan Technologies Ltd +146c Ruby Tech Corp. +146d Tachyon, INC. +146e Williams Electronics Games, Inc. +146f Multi Dimensional Consulting Inc +1470 Bay Networks +1471 Integrated Telecom Express Inc +1472 DAIKIN Industries, Ltd +1473 ZAPEX Technologies Inc +1474 Doug Carson & Associates +1475 PICAZO Communications +1476 MORTARA Instrument Inc +1477 Net Insight +1478 DIATREND Corporation +1479 TORAY Industries Inc +147a FORMOSA Industrial Computing +147b ABIT Computer Corp. +147c AWARE, Inc. +147d Interworks Computer Products +147e Matsushita Graphic Communication Systems, Inc. +147f NIHON UNISYS, Ltd. +1480 SCII Telecom +1481 BIOPAC Systems Inc +1482 ISYTEC - Integrierte Systemtechnik GmBH +1483 LABWAY Corporation +1484 Logic Corporation +1485 ERMA - Electronic GmBH +1486 L3 Communications Telemetry & Instrumentation +1487 MARQUETTE Medical Systems +1488 KONTRON Electronik GmBH +1489 KYE Systems Corporation +148a OPTO +148b INNOMEDIALOGIC Inc. +148c C.P. Technology Co. Ltd +148d DIGICOM Systems, Inc. + 1003 HCF 56k Data/Fax Modem +148e OSI Plus Corporation +148f Plant Equipment, Inc. +1490 Stone Microsystems PTY Ltd. +1491 ZEAL Corporation +1492 Time Logic Corporation +1493 MAKER Communications +1494 WINTOP Technology, Inc. +1495 TOKAI Communications Industry Co. Ltd +1496 JOYTECH Computer Co., Ltd. +1497 SMA Regelsysteme GmBH +1498 TEWS Datentechnik GmBH +1499 EMTEC CO., Ltd +149a ANDOR Technology Ltd +149b SEIKO Instruments Inc +149c OVISLINK Corp. +149d NEWTEK Inc +149e Mapletree Networks Inc. +149f LECTRON Co Ltd +14a0 SOFTING GmBH +14a1 Systembase Co Ltd +14a2 Millennium Engineering Inc +14a3 Maverick Networks +14a4 GVC/BCM Advanced Research +14a5 XIONICS Document Technologies Inc +14a6 INOVA Computers GmBH & Co KG +14a7 MYTHOS Systems Inc +14a8 FEATRON Technologies Corporation +14a9 HIVERTEC Inc +14aa Advanced MOS Technology Inc +14ab Mentor Graphics Corp. +14ac Novaweb Technologies Inc +14ad Time Space Radio AB +14ae CTI, Inc +14af Guillemot Corporation + 7102 3D Prophet II MX +14b0 BST Communication Technology Ltd +14b1 Nextcom K.K. +14b2 ENNOVATE Networks Inc +14b3 XPEED Inc + 0000 DSL NIC +14b4 PHILIPS Business Electronics B.V. +14b5 Creamware GmBH + 0200 Scope + 0300 Pulsar + 0400 Pulsar2 + 0600 Pulsar2 + 0800 DSP-Board + 0900 DSP-Board + 0a00 DSP-Board + 0b00 DSP-Board +14b6 Quantum Data Corp. +14b7 PROXIM Inc + 0001 Symphony 4110 +14b8 Techsoft Technology Co Ltd +14b9 AIRONET Wireless Communications + 0001 PC4800 + 0340 PC4800 + 0350 PC4800 + 4500 PC4500 + 4800 PC4800 + a504 Cisco Aironet Wireless 802.11b +14ba INTERNIX Inc. +14bb SEMTECH Corporation +14bc Globespan Semiconductor Inc. +14bd CARDIO Control N.V. +14be L3 Communications +14bf SPIDER Communications Inc. +14c0 COMPAL Electronics Inc +14c1 MYRICOM Inc. +14c2 DTK Computer +14c3 MEDIATEK Corp. +14c4 IWASAKI Information Systems Co Ltd +14c5 Automation Products AB +14c6 Data Race Inc +14c7 Modular Technology Holdings Ltd +14c8 Turbocomm Tech. Inc. +14c9 ODIN Telesystems Inc +14ca PE Logic Corp. +14cb Billionton Systems Inc +14cc NAKAYO Telecommunications Inc +14cd Universal Scientific Ind. +14ce Whistle Communications +14cf TEK Microsystems Inc. +14d0 Ericsson Axe R & D +14d1 Computer Hi-Tech Co Ltd +14d2 Titan Electronics Inc + 8001 VScom 010L 1 port parallel adaptor + 8002 VScom 020L 2 port parallel adaptor + 8010 VScom 100L 1 port serial adaptor + 8011 VScom 110L 1 port serial and 1 port parallel adaptor + 8020 VScom 200L 1 port serial adaptor + 8021 VScom 210L 2 port serial and 1 port parallel adaptor + 8040 VScom 400L 4 port serial adaptor + 8080 VScom 800L 8 port serial adaptor + a000 VScom 010H 1 port parallel adaptor + a001 VScom 100H 1 port serial adaptor + a003 VScom 400H 4 port serial adaptor + a004 VScom 400HF1 4 port serial adaptor + a005 VScom 200H 2 port serial adaptor + e001 VScom 010HV2 1 port parallel adaptor + e010 VScom 100HV2 1 port serial adaptor + e020 VScom 200HV2 2 port serial adaptor +14d3 CIRTECH (UK) Ltd +14d4 Panacom Technology Corp +14d5 Nitsuko Corporation +14d6 Accusys Inc +14d7 Hirakawa Hewtech Corp +14d8 HOPF Elektronik GmBH +14d9 Alpha Processor Inc +14da National Aerospace Laboratories +14db AFAVLAB Technology Inc + 2120 TK9902 +14dc Amplicon Liveline Ltd + 0000 PCI230 + 0001 PCI242 + 0002 PCI244 + 0003 PCI247 + 0004 PCI248 + 0005 PCI249 + 0006 PCI260 + 0007 PCI224 + 0008 PCI234 + 0009 PCI236 + 000a PCI272 + 000b PCI215 +14dd Boulder Design Labs Inc +14de Applied Integration Corporation +14df ASIC Communications Corp +14e1 INVERTEX +14e2 INFOLIBRIA +14e3 AMTELCO +14e4 Broadcom Corporation + 1644 NetXtreme BCM5700 Gigabit Ethernet + 1014 0277 Broadcom Vigil B5700 1000Base-T + 1028 00d1 Broadcom BCM5700 + 1028 0106 Broadcom BCM5700 + 1028 0109 Broadcom BCM5700 1000Base-T + 1028 010a Broadcom BCM5700 1000BaseTX + 10b7 1000 3C996-T 1000Base-T + 10b7 1001 3C996B-T 1000Base-T + 10b7 1002 3C996C-T 1000Base-T + 10b7 1003 3C997-T 1000Base-T Dual Port + 10b7 1004 3C996-SX 1000Base-SX + 10b7 1005 3C997-SX 1000Base-SX Dual Port + 10b7 1008 3C942 Gigabit LOM (31X31) + 14e4 0002 NetXtreme 1000Base-SX + 14e4 0003 NetXtreme 1000Base-SX + 14e4 0004 NetXtreme 1000Base-T + 14e4 1028 NetXtreme 1000BaseTX + 14e4 1644 BCM5700 1000Base-T + 1645 NetXtreme BCM5701 Gigabit Ethernet + 0e11 007c NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T) + 0e11 007d NC6770 Gigabit Server Adapter (PCI-X, 1000-SX) + 0e11 0085 NC7780 Gigabit Server Adapter (embedded, WOL) + 0e11 0099 NC7780 Gigabit Server Adapter (embedded, WOL) + 0e11 009a NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T) + 0e11 00c1 NC6770 Gigabit Server Adapter (PCI-X, 1000-SX) + 1028 0121 Broadcom BCM5701 1000Base-T + 10b7 1004 3C996-SX 1000Base-SX + 10b7 1006 3C996B-T 1000Base-T + 10b7 1007 3C1000-T 1000Base-T + 10b7 1008 3C940-BR01 1000Base-T + 14e4 0001 BCM5701 1000Base-T + 14e4 0005 BCM5701 1000Base-T + 14e4 0006 BCM5701 1000Base-T + 14e4 0007 BCM5701 1000Base-SX + 14e4 0008 BCM5701 1000Base-T + 14e4 8008 BCM5701 1000Base-T + 1646 NetXtreme BCM5702 Gigabit Ethernet + 0e11 00bb NC7760 1000BaseTX + 1028 0126 Broadcom BCM5702 1000BaseTX + 14e4 8009 BCM5702 1000BaseTX + 1647 NetXtreme BCM5703 Gigabit Ethernet + 0e11 0099 NC7780 1000BaseTX + 0e11 009a NC7770 1000BaseTX + 14e4 0009 BCM5703 1000BaseTX + 14e4 000a BCM5703 1000BaseSX + 14e4 000b BCM5703 1000BaseTX + 14e4 8009 BCM5703 1000BaseTX + 14e4 800a BCM5703 1000BaseTX + 1648 NetXtreme BCM5704 Gigabit Ethernet + 0e11 00cf NC7772 Gigabit Server Adapter (PCI-X, 10,100,1000-T) + 0e11 00d0 NC7782 Gigabit Server Adapter (PCI-X, 10,100,1000-T) + 0e11 00d1 NC7783 Gigabit Server Adapter (PCI-X, 10,100,1000-T) + 10b7 2000 3C998-T Dual Port 10/100/1000 PCI-X + 10b7 3000 3C999-T Quad Port 10/100/1000 PCI-X + 1166 1648 NetXtreme CIOB-E 1000Base-T + 164d NetXtreme BCM5702FE Gigabit Ethernet + 1653 NetXtreme BCM5705 Gigabit Ethernet + 165d NetXtreme BCM5705M Gigabit Ethernet + 1696 NetXtreme BCM5782 Gigabit Ethernet + 14e4 000d NetXtreme BCM5782 1000Base-T + 16a6 NetXtreme BCM5702 Gigabit Ethernet + 0e11 00bb NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T) + 1028 0126 BCM5702 1000Base-T + 14e4 000c BCM5702 1000Base-T + 14e4 8009 BCM5702 1000Base-T + 16a7 NetXtreme BCM5703 Gigabit Ethernet + 0e11 00ca NC7771 Gigabit Server Adapter (PCI-X, 10,100,1000-T) + 0e11 00cb NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T) + 14e4 0009 NetXtreme BCM5703 1000Base-T + 14e4 000a NetXtreme BCM5703 1000Base-SX + 14e4 000b NetXtreme BCM5703 1000Base-T + 14e4 800a NetXtreme BCM5703 1000Base-T + 16a8 NetXtreme BCM5704S Gigabit Ethernet + 10b7 2001 3C998-SX Dual Port 1000-SX PCI-X + 16c6 NetXtreme BCM5702 Gigabit Ethernet + 10b7 1100 3C1000B-T 10/100/1000 PCI + 14e4 000c BCM5702 1000Base-T + 14e4 8009 BCM5702 1000Base-T + 16c7 NetXtreme BCM5703 Gigabit Ethernet + 14e4 0009 NetXtreme BCM5703 1000Base-T + 14e4 000a NetXtreme BCM5703 1000Base-SX + 4210 BCM4210 iLine10 HomePNA 2.0 + 4211 BCM4211 iLine10 HomePNA 2.0 + V.90 56k modem + 4212 BCM4212 v.90 56k modem + 4301 BCM4301 802.11b + 4401 BCM4401 100Base-T + 4402 BCM4402 Integrated 10/100BaseT + 4410 BCM4413 iLine32 HomePNA 2.0 + 4411 BCM4413 V.90 56k modem + 4412 BCM4413 10/100BaseT + 5820 BCM5820 Crypto Accelerator + 5821 BCM5821 Crypto Accelerator +14e5 Pixelfusion Ltd +14e6 SHINING Technology Inc +14e7 3CX +14e8 RAYCER Inc +14e9 GARNETS System CO Ltd +14ea Planex Communications, Inc + ab06 FNW-3603-TX CardBus Fast Ethernet +14eb SEIKO EPSON Corp +14ec ACQIRIS +14ed DATAKINETICS Ltd +14ee MASPRO KENKOH Corp +14ef CARRY Computer ENG. CO Ltd +14f0 CANON RESEACH CENTRE FRANCE +14f1 Conexant + 1002 HCF 56k Modem + 1003 HCF 56k Modem + 1004 HCF 56k Modem + 1005 HCF 56k Modem + 1006 HCF 56k Modem + 1022 HCF 56k Modem + 1023 HCF 56k Modem + 1024 HCF 56k Modem + 1025 HCF 56k Modem + 1026 HCF 56k Modem + 1032 HCF 56k Modem + 1033 HCF 56k Data/Fax Modem + 1033 8077 NEC + 122d 4027 Dell Zeus - MDP3880-W(B) Data Fax Modem + 122d 4030 Dell Mercury - MDP3880-U(B) Data Fax Modem + 122d 4034 Dell Thor - MDP3880-W(U) Data Fax Modem + 13e0 020d Dell Copper + 13e0 020e Dell Silver + 13e0 0261 IBM + 13e0 0290 Compaq Goldwing + 13e0 02a0 IBM + 13e0 02b0 IBM + 13e0 02c0 Compaq Scooter + 13e0 02d0 IBM + 144f 1500 IBM P85-DF (1) + 144f 1501 IBM P85-DF (2) + 144f 150a IBM P85-DF (3) + 144f 150b IBM P85-DF Low Profile (1) + 144f 1510 IBM P85-DF Low Profile (2) + 1034 HCF 56k Data/Fax/Voice Modem + 1035 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 10cf 1098 Fujitsu P85-DFSV + 1036 HCF 56k Data/Fax/Voice/Spkp Modem + 104d 8067 HCF 56k Modem + 122d 4029 MDP3880SP-W + 122d 4031 MDP3880SP-U + 13e0 0209 Dell Titanium + 13e0 020a Dell Graphite + 13e0 0260 Gateway Red Owl + 13e0 0270 Gateway White Horse + 1052 HCF 56k Data/Fax Modem (Worldwide) + 1053 HCF 56k Data/Fax Modem (Worldwide) + 1054 HCF 56k Data/Fax/Voice Modem (Worldwide) + 1055 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (Worldwide) + 1056 HCF 56k Data/Fax/Voice/Spkp Modem (Worldwide) + 1057 HCF 56k Data/Fax/Voice/Spkp Modem (Worldwide) + 1059 HCF 56k Data/Fax/Voice Modem (Worldwide) + 1063 HCF 56k Data/Fax Modem + 1064 HCF 56k Data/Fax/Voice Modem + 1065 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 1066 HCF 56k Data/Fax/Voice/Spkp Modem + 122d 4033 Dell Athena - MDP3900V-U + 1433 HCF 56k Data/Fax Modem + 1434 HCF 56k Data/Fax/Voice Modem + 1435 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 1436 HCF 56k Data/Fax Modem + 1453 HCF 56k Data/Fax Modem + 13e0 0240 IBM + 13e0 0250 IBM + 144f 1502 IBM P95-DF (1) + 144f 1503 IBM P95-DF (2) + 1454 HCF 56k Data/Fax/Voice Modem + 1455 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 1456 HCF 56k Data/Fax/Voice/Spkp Modem + 122d 4035 Dell Europa - MDP3900V-W + 122d 4302 Dell MP3930V-W(C) MiniPCI + 1610 ADSL AccessRunner PCI Arbitration Device + 1611 AccessRunner PCI ADSL Interface Device + 1803 HCF 56k Modem + 0e11 0023 623-LAN Grizzly + 0e11 0043 623-LAN Yogi + 1815 HCF 56k Modem + 0e11 0022 Grizzly + 0e11 0042 Yogi + 2003 HSF 56k Data/Fax Modem + 2004 HSF 56k Data/Fax/Voice Modem + 2005 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 2006 HSF 56k Data/Fax/Voice/Spkp Modem + 2013 HSF 56k Data/Fax Modem + 0e11 b195 Bear + 0e11 b196 Seminole 1 + 0e11 b1be Seminole 2 + 1025 8013 Acer + 1033 809d NEC + 1033 80bc NEC + 155d 6793 HP + 155d 8850 E Machines + 2014 HSF 56k Data/Fax/Voice Modem + 2015 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem + 2016 HSF 56k Data/Fax/Voice/Spkp Modem + 2043 HSF 56k Data/Fax Modem (WorldW SmartDAA) + 2044 HSF 56k Data/Fax/Voice Modem (WorldW SmartDAA) + 2045 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (WorldW SmartDAA) + 2046 HSF 56k Data/Fax/Voice/Spkp Modem (WorldW SmartDAA) + 2063 HSF 56k Data/Fax Modem (SmartDAA) + 2064 HSF 56k Data/Fax/Voice Modem (SmartDAA) + 2065 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (SmartDAA) + 2066 HSF 56k Data/Fax/Voice/Spkp Modem (SmartDAA) + 2093 HSF 56k Modem + 155d 2f07 Legend + 2143 HSF 56k Data/Fax/Cell Modem (Mob WorldW SmartDAA) + 2144 HSF 56k Data/Fax/Voice/Cell Modem (Mob WorldW SmartDAA) + 2145 HSF 56k Data/Fax/Voice/Spkp (w/HS)/Cell Modem (Mob WorldW SmartDAA) + 2146 HSF 56k Data/Fax/Voice/Spkp/Cell Modem (Mob WorldW SmartDAA) + 2163 HSF 56k Data/Fax/Cell Modem (Mob SmartDAA) + 2164 HSF 56k Data/Fax/Voice/Cell Modem (Mob SmartDAA) + 2165 HSF 56k Data/Fax/Voice/Spkp (w/HS)/Cell Modem (Mob SmartDAA) + 2166 HSF 56k Data/Fax/Voice/Spkp/Cell Modem (Mob SmartDAA) + 2343 HSF 56k Data/Fax CardBus Modem (Mob WorldW SmartDAA) + 2344 HSF 56k Data/Fax/Voice CardBus Modem (Mob WorldW SmartDAA) + 2345 HSF 56k Data/Fax/Voice/Spkp (w/HS) CardBus Modem (Mob WorldW SmartDAA) + 2346 HSF 56k Data/Fax/Voice/Spkp CardBus Modem (Mob WorldW SmartDAA) + 2363 HSF 56k Data/Fax CardBus Modem (Mob SmartDAA) + 2364 HSF 56k Data/Fax/Voice CardBus Modem (Mob SmartDAA) + 2365 HSF 56k Data/Fax/Voice/Spkp (w/HS) CardBus Modem (Mob SmartDAA) + 2366 HSF 56k Data/Fax/Voice/Spkp CardBus Modem (Mob SmartDAA) + 2443 HSF 56k Data/Fax Modem (Mob WorldW SmartDAA) + 104d 8075 Modem + 104d 8083 Modem + 104d 8097 Modem + 2444 HSF 56k Data/Fax/Voice Modem (Mob WorldW SmartDAA) + 2445 HSF 56k Data/Fax/Voice/Spkp (w/HS) Modem (Mob WorldW SmartDAA) + 2446 HSF 56k Data/Fax/Voice/Spkp Modem (Mob WorldW SmartDAA) + 2463 HSF 56k Data/Fax Modem (Mob SmartDAA) + 2464 HSF 56k Data/Fax/Voice Modem (Mob SmartDAA) + 2465 HSF 56k Data/Fax/Voice/Spkp (w/HS) Modem (Mob SmartDAA) + 2466 HSF 56k Data/Fax/Voice/Spkp Modem (Mob SmartDAA) + 2f00 HSF 56k HSFi Modem + 13e0 8d84 IBM HSFi V.90 + 13e0 8d85 Compaq Stinger + 14f1 2004 Dynalink 56PMi + 8234 RS8234 ATM SAR Controller [ServiceSAR Plus] +14f2 MOBILITY Electronics +14f3 BROADLOGIC +14f4 TOKYO Electronic Industry CO Ltd +14f5 SOPAC Ltd +14f6 COYOTE Technologies LLC +14f7 WOLF Technology Inc +14f8 AUDIOCODES Inc +14f9 AG COMMUNICATIONS +14fa WANDEL & GOCHERMANN +14fb TRANSAS MARINE (UK) Ltd +14fc QUADRICS Supercomputers World +14fd JAPAN Computer Industry Inc +14fe ARCHTEK TELECOM Corp +14ff TWINHEAD INTERNATIONAL Corp +1500 DELTA Electronics, Inc +1501 BANKSOFT CANADA Ltd +1502 MITSUBISHI ELECTRIC LOGISTICS SUPPORT Co Ltd +1503 KAWASAKI LSI USA Inc +1504 KAISER Electronics +1505 ITA INGENIEURBURO FUR TESTAUFGABEN GmbH +1506 CHAMELEON Systems Inc +# Should be HTEC Ltd, but there are no known HTEC chips and 1507 is already used by mistake by Motorola (see vendor ID 1057). +1507 Motorola ?? / HTEC + 0001 MPC105 [Eagle] + 0002 MPC106 [Grackle] + 0003 MPC8240 [Kahlua] + 0100 MC145575 [HFC-PCI] + 0431 KTI829c 100VG + 4801 Raven + 4802 Falcon + 4803 Hawk + 4806 CPX8216 +1508 HONDA CONNECTORS/MHOTRONICS Inc +1509 FIRST INTERNATIONAL Computer Inc +150a FORVUS RESEARCH Inc +150b YAMASHITA Systems Corp +150c KYOPAL CO Ltd +150d WARPSPPED Inc +150e C-PORT Corp +150f INTEC GmbH +1510 BEHAVIOR TECH Computer Corp +1511 CENTILLIUM Technology Corp +1512 ROSUN Technologies Inc +1513 Raychem +1514 TFL LAN Inc +1515 Advent design +1516 MYSON Technology Inc + 0803 SURECOM EP-320X-S 100/10M Ethernet PCI Adapter + 1320 10bd SURECOM EP-320X-S 100/10M Ethernet PCI Adapter +1517 ECHOTEK Corp +1518 PEP MODULAR Computers GmbH +1519 TELEFON AKTIEBOLAGET LM Ericsson +151a Globetek + 1002 PCI-1002 + 1004 PCI-1004 + 1008 PCI-1008 +151b COMBOX Ltd +151c DIGITAL AUDIO LABS Inc +151d Fujitsu Computer Products Of America +151e MATRIX Corp +151f TOPIC SEMICONDUCTOR Corp + 0000 TP560 Data/Fax/Voice 56k modem +1520 CHAPLET System Inc +1521 BELL Corp +1522 MainPine Ltd + 0100 PCI <-> IOBus Bridge + 1522 0200 RockForceDUO 2 Port V.92/V.44 Data/Fax/Voice Modem + 1522 0300 RockForceQUATRO 4 Port V.92/V.44 Data/Fax/Voice Modem + 1522 0400 RockForceDUO+ 2 Port V.92/V.44 Data/Fax/Voice Modem + 1522 0500 RockForceQUATRO+ 4 Port V.92/V.44 Data/Fax/Voice Modem + 1522 0600 RockForce+ 2 Port V.90 Data/Fax/Voice Modem + 1522 0700 RockForce+ 4 Port V.90 Data/Fax/Voice Modem + 1522 0800 RockForceOCTO+ 8 Port V.92/V.44 Data/Fax/Voice Modem +1523 MUSIC Semiconductors +1524 ENE Technology Inc + 1211 CB1211 Cardbus Controller + 1225 CB1225 Cardbus Controller + 1410 CB1410 Cardbus Controller + 1420 CB1420 Cardbus Controller +1525 IMPACT Technologies +1526 ISS, Inc +1527 SOLECTRON +1528 ACKSYS +1529 AMERICAN MICROSystems Inc +152a QUICKTURN DESIGN Systems +152b FLYTECH Technology CO Ltd +152c MACRAIGOR Systems LLC +152d QUANTA Computer Inc +152e MELEC Inc +152f PHILIPS - CRYPTO +1530 ACQIS Technology Inc +1531 CHRYON Corp +1532 ECHELON Corp +1533 BALTIMORE +1534 ROAD Corp +1535 EVERGREEN Technologies Inc +1537 DATALEX COMMUNCATIONS +1538 ARALION Inc +1539 ATELIER INFORMATIQUES et ELECTRONIQUE ETUDES S.A. +153a ONO SOKKI +153b TERRATEC Electronic GmbH +153c ANTAL Electronic +153d FILANET Corp +153e TECHWELL Inc +153f MIPS DENMARK +1540 PROVIDEO MULTIMEDIA Co Ltd +1541 MACHONE Communications +1542 VIVID Technology Inc +1543 SILICON Laboratories + 3052 Intel 537 [Winmodem] + 4c22 Si3036 MC'97 DAA +1544 DCM DATA Systems +1545 VISIONTEK +1546 IOI Technology Corp +1547 MITUTOYO Corp +1548 JET PROPULSION Laboratory +1549 INTERCONNECT Systems Solutions +154a MAX Technologies Inc +154b COMPUTEX Co Ltd +154c VISUAL Technology Inc +154d PAN INTERNATIONAL Industrial Corp +154e SERVOTEST Ltd +154f STRATABEAM Technology +1550 OPEN NETWORK Co Ltd +1551 SMART Electronic DEVELOPMENT GmBH +1552 RACAL AIRTECH Ltd +1553 CHICONY Electronics Co Ltd +1554 PROLINK Microsystems Corp +1555 GESYTEC GmBH +1556 PLD APPLICATIONS +1557 MEDIASTAR Co Ltd +1558 CLEVO/KAPOK Computer +1559 SI LOGIC Ltd +155a INNOMEDIA Inc +155b PROTAC INTERNATIONAL Corp +155c Cemax-Icon Inc +155d Mac System Co Ltd +155e LP Elektronik GmbH +155f Perle Systems Ltd +1560 Terayon Communications Systems +1561 Viewgraphics Inc +1562 Symbol Technologies +1563 A-Trend Technology Co Ltd +1564 Yamakatsu Electronics Industry Co Ltd +1565 Biostar Microtech Int'l Corp +1566 Ardent Technologies Inc +1567 Jungsoft +1568 DDK Electronics Inc +1569 Palit Microsystems Inc. +156a Avtec Systems +156b 2wire Inc +156c Vidac Electronics GmbH +156d Alpha-Top Corp +156e Alfa Inc +156f M-Systems Flash Disk Pioneers Ltd +1570 Lecroy Corp +1571 Contemporary Controls + a001 CCSI PCI20-485 ARCnet + a002 CCSI PCI20-485D ARCnet + a003 CCSI PCI20-485X ARCnet + a004 CCSI PCI20-CXB ARCnet + a005 CCSI PCI20-CXS ARCnet + a006 CCSI PCI20-FOG-SMA ARCnet + a007 CCSI PCI20-FOG-ST ARCnet + a008 CCSI PCI20-TB5 ARCnet + a009 CCSI PCI20-5-485 5Mbit ARCnet + a00a CCSI PCI20-5-485D 5Mbit ARCnet + a00b CCSI PCI20-5-485X 5Mbit ARCnet + a00c CCSI PCI20-5-FOG-ST 5Mbit ARCnet + a00d CCSI PCI20-5-FOG-SMA 5Mbit ARCnet + a201 CCSI PCI22-485 10Mbit ARCnet + a202 CCSI PCI22-485D 10Mbit ARCnet + a203 CCSI PCI22-485X 10Mbit ARCnet + a204 CCSI PCI22-CHB 10Mbit ARCnet + a205 CCSI PCI22-FOG_ST 10Mbit ARCnet + a206 CCSI PCI22-THB 10Mbit ARCnet +1572 Otis Elevator Company +1573 Lattice - Vantis +1574 Fairchild Semiconductor +1575 Voltaire Advanced Data Security Ltd +1576 Viewcast COM +1578 HITT +1579 Dual Technology Corp +157a Japan Elecronics Ind Inc +157b Star Multimedia Corp +157c Eurosoft (UK) + 8001 Fix2000 PCI Y2K Compliance Card +157d Gemflex Networks +157e Transition Networks +157f PX Instruments Technology Ltd +1580 Primex Aerospace Co +1581 SEH Computertechnik GmbH +1582 Cytec Corp +1583 Inet Technologies Inc +1584 Uniwill Computer Corp +1585 Logitron +1586 Lancast Inc +1587 Konica Corp +1588 Solidum Systems Corp +1589 Atlantek Microsystems Pty Ltd +158a Digalog Systems Inc +158b Allied Data Technologies +158c Hitachi Semiconductor & Devices Sales Co Ltd +158d Point Multimedia Systems +158e Lara Technology Inc +158f Ditect Coop +1590 3pardata Inc +1591 ARN +1592 Syba Tech Ltd + 0781 Multi-IO Card + 0782 Parallel Port Card 2xEPP + 0783 Multi-IO Card + 0785 Multi-IO Card + 0786 Multi-IO Card + 0787 Multi-IO Card + 0788 Multi-IO Card + 078a Multi-IO Card +1593 Bops Inc +1594 Netgame Ltd +1595 Diva Systems Corp +1596 Folsom Research Inc +1597 Memec Design Services +1598 Granite Microsystems +1599 Delta Electronics Inc +159a General Instrument +159b Faraday Technology Corp +159c Stratus Computer Systems +159d Ningbo Harrison Electronics Co Ltd +159e A-Max Technology Co Ltd +159f Galea Network Security +15a0 Compumaster SRL +15a1 Geocast Network Systems +15a2 Catalyst Enterprises Inc + 0001 TA700 PCI Bus Analyzer/Exerciser +15a3 Italtel +15a4 X-Net OY +15a5 Toyota Macs Inc +15a6 Sunlight Ultrasound Technologies Ltd +15a7 SSE Telecom Inc +15a8 Shanghai Communications Technologies Center +15aa Moreton Bay +15ab Bluesteel Networks Inc +15ac North Atlantic Instruments +15ad VMWare Inc + 0710 Virtual SVGA +15ae Amersham Pharmacia Biotech +15b0 Zoltrix International Ltd +15b1 Source Technology Inc +15b2 Mosaid Technologies Inc +15b3 Mellanox Technology + 5274 MT21108 InfiniBridge +15b4 CCI/TRIAD +15b5 Cimetrics Inc +15b6 Texas Memory Systems Inc +15b7 Sandisk Corp +15b8 ADDI-DATA GmbH +15b9 Maestro Digital Communications +15ba Impacct Technology Corp +15bb Portwell Inc +15bc Agilent Technologies + 2929 E2929A PCI/PCI-X Bus Analyzer +15bd DFI Inc +15be Sola Electronics +15bf High Tech Computer Corp (HTC) +15c0 BVM Ltd +15c1 Quantel +15c2 Newer Technology Inc +15c3 Taiwan Mycomp Co Ltd +15c4 EVSX Inc +15c5 Procomp Informatics Ltd +15c6 Technical University of Budapest +15c7 Tateyama System Laboratory Co Ltd + 0349 Tateyama C-PCI PLC/NC card Rev.01A +15c8 Penta Media Co Ltd +15c9 Serome Technology Inc +15ca Bitboys OY +15cb AG Electronics Ltd +15cc Hotrail Inc +15cd Dreamtech Co Ltd +15ce Genrad Inc +15cf Hilscher GmbH +15d1 Infineon Technologies AG +15d2 FIC (First International Computer Inc) +15d3 NDS Technologies Israel Ltd +15d4 Iwill Corp +15d5 Tatung Co +15d6 Entridia Corp +15d7 Rockwell-Collins Inc +15d8 Cybernetics Technology Co Ltd +15d9 Super Micro Computer Inc +15da Cyberfirm Inc +15db Applied Computing Systems Inc +15dc Litronic Inc + 0001 Argus 300 PCI Cryptography Module +15dd Sigmatel Inc +15de Malleable Technologies Inc +15df Infinilink Corp +15e0 Cacheflow Inc +15e1 Voice Technologies Group Inc +15e2 Quicknet Technologies Inc +15e3 Networth Technologies Inc +15e4 VSN Systemen BV +15e5 Valley technologies Inc +15e6 Agere Inc +15e7 Get Engineering Corp +15e8 National Datacomm Corp + 0130 Wireless PCI Card +15e9 Pacific Digital Corp +15ea Tokyo Denshi Sekei K.K. +15eb Drsearch GmbH +15ec Beckhoff GmbH +15ed Macrolink Inc +15ee In Win Development Inc +15ef Intelligent Paradigm Inc +15f0 B-Tree Systems Inc +15f1 Times N Systems Inc +15f2 Diagnostic Instruments Inc +15f3 Digitmedia Corp +15f4 Valuesoft +15f5 Power Micro Research +15f6 Extreme Packet Device Inc +15f7 Banctec +15f8 Koga Electronics Co +15f9 Zenith Electronics Corp +15fa J.P. Axzam Corp +15fb Zilog Inc +15fc Techsan Electronics Co Ltd +15fd N-CUBED.NET +15fe Kinpo Electronics Inc +15ff Fastpoint Technologies Inc +1600 Northrop Grumman - Canada Ltd +1601 Tenta Technology +1602 Prosys-tec Inc +1603 Nokia Wireless Communications +1604 Central System Research Co Ltd +1605 Pairgain Technologies +1606 Europop AG +1607 Lava Semiconductor Manufacturing Inc +1608 Automated Wagering International +1609 Scimetric Instruments Inc +1612 Telesynergy Research Inc. +1619 FarSite Communications Ltd + 0400 FarSync T2P (2 port X.21/V.35/V.24) + 0440 FarSync T4P (4 port X.21/V.35/V.24) +1629 Kongsberg Spacetec AS + 1003 Format synchronizer v3.0 + 2002 Fast Universal Data Output +1638 Standard Microsystems Corp [SMC] + 1100 SMC2602W EZConnect / Addtron AWA-100 +163c Smart Link Ltd. + 5449 SmartPCI561 Modem +1657 Brocade Communications Systems, Inc. +165a Epix Inc + c100 PIXCI(R) CL1 Camera Link Video Capture Board [custom QL5232] + d200 PIXCI(R) D2X Digital Video Capture Board [custom QL5232] + d300 PIXCI(R) D3X Digital Video Capture Board [custom QL5232] +165d Hsing Tech. Enterprise Co., Ltd. +1661 Worldspace Corp. +1668 Actiontec Electronics Inc +1681 Hercules +16ab Global Sun Technology Inc + 1102 PCMCIA-to-PCI Wireless Network Bridge +16be Creatix Polymedia GmbH +16ec U.S. Robotics + 3685 Wireless Access PCI Adapter Model 022415 +16f6 VideoTele.com, Inc. +1705 Digital First, Inc. +170b NetOctave Inc +170c YottaYotta Inc. +172a Accelerated Encryption +1737 Linksys +173b Altima (nee Broadcom) + 03e8 AC1000 Gigabit Ethernet + 03ea AC9100 Gigabit Ethernet + 173b 0001 AC1002 +1743 Peppercon AG + 8139 ROL/F-100 Fast Ethernet Adapter with ROL +174b PC Partner Limited +175e Sanera Systems, Inc. +1787 Hightech Information System Ltd. +# also used by Struck Innovative Systeme for joint developments +1796 Research Centre Juelich + 0001 SIS1100 [Gigabit link] + 0002 HOTlink + 0003 Counter Timer + 0004 CAMAC Controller + 0005 PROFIBUS + 0006 AMCC HOTlink +1799 Belkin +17af Hightech Information System Ltd. +17cc NetChip Technology, Inc + 2280 USB 2.0 +1813 Ambient Technologies Inc + 4000 HaM controllerless modem + 16be 0001 V9x HAM Data Fax Modem + 4100 HaM plus Data Fax Modem + 16be 0002 V9x HAM 1394 +1851 Microtune, Inc. +1852 Anritsu Corp. +1888 Varisys Ltd + 0301 VMFX1 FPGA PMC module + 0601 VSM2 dual PMC carrier + 0710 VS14x series PowerPC PCI board + 0720 VS24x series PowerPC PCI board +1a08 Sierra semiconductor + 0000 SC15064 +1b13 Jaton Corp +1c1c Symphony + 0001 82C101 +1d44 DPT + a400 PM2x24/PM3224 +1de1 Tekram Technology Co.,Ltd. + 0391 TRM-S1040 + 2020 DC-390 + 690c 690c + dc29 DC290 +2000 Smart Link Ltd. +2001 Temporal Research Ltd +2003 Smart Link Ltd. +2004 Smart Link Ltd. +21c3 21st Century Computer Corp. +2348 Racore + 2010 8142 100VG/AnyLAN +2646 Kingston Technologies +270b Xantel Corporation +270f Chaintech Computer Co. Ltd +2711 AVID Technology Inc. +2a15 3D Vision(???) +3000 Hansol Electronics Inc. +3142 Post Impression Systems. +3388 Hint Corp + 0013 HiNT HC4 PCI to ISDN bridge, Multimedia audio controller + 0014 HiNT HC4 PCI to ISDN bridge, Network controller + 0021 HB1-SE33 PCI-PCI Bridge + 8011 VXPro II Chipset + 3388 8011 VXPro II Chipset CPU to PCI Bridge + 8012 VXPro II Chipset + 3388 8012 VXPro II Chipset PCI to ISA Bridge + 8013 VXPro II IDE + 3388 8013 VXPro II Chipset EIDE Controller +3411 Quantum Designs (H.K.) Inc +3513 ARCOM Control Systems Ltd +38ef 4Links +3d3d 3DLabs + 0001 GLINT 300SX + 0002 GLINT 500TX + 0003 GLINT Delta + 0004 Permedia + 0005 Permedia + 0006 GLINT MX + 0007 3D Extreme + 0008 GLINT Gamma G1 + 0009 Permedia II 2D+3D + 1040 0011 AccelStar II + 3d3d 0100 AccelStar II 3D Accelerator + 3d3d 0111 Permedia 3:16 + 3d3d 0114 Santa Ana + 3d3d 0116 Oxygen GVX1 + 3d3d 0119 Scirocco + 3d3d 0120 Santa Ana PCL + 3d3d 0125 Oxygen VX1 + 3d3d 0127 Permedia3 Create! + 000a GLINT R3 + 3d3d 0121 Oxygen VX1 + 000c GLINT R3 [Oxygen VX1] + 3d3d 0144 Oxygen VX1-4X AGP [Permedia 4] + 0100 Permedia II 2D+3D + 1004 Permedia + 3d04 Permedia + ffff Glint VGA +4005 Avance Logic Inc. + 0300 ALS300 PCI Audio Device + 0308 ALS300+ PCI Audio Device + 0309 PCI Input Controller + 1064 ALG-2064 + 2064 ALG-2064i + 2128 ALG-2364A GUI Accelerator + 2301 ALG-2301 + 2302 ALG-2302 + 2303 AVG-2302 GUI Accelerator + 2364 ALG-2364A + 2464 ALG-2464 + 2501 ALG-2564A/25128A + 4000 ALS4000 Audio Chipset + 4005 4000 ALS4000 Audio Chipset + 4710 ALC200/200P +4033 Addtron Technology Co, Inc. + 1360 RTL8139 Ethernet +4143 Digital Equipment Corp +416c Aladdin Knowledge Systems + 0100 AladdinCARD + 0200 CPC +4444 Internext Compression Inc + 0803 iTVC15 MPEG-2 Encoder +4468 Bridgeport machines +4594 Cogetec Informatique Inc +45fb Baldor Electric Company +4680 Umax Computer Corp +4843 Hercules Computer Technology Inc +4916 RedCreek Communications Inc + 1960 RedCreek PCI adapter +4943 Growth Networks +4978 Axil Computer Inc +4a14 NetVin + 5000 NV5000SC + 4a14 5000 RT8029-Based Ethernet Adapter +4b10 Buslogic Inc. +4c48 LUNG HWA Electronics +4c53 SBS Technologies +4ca1 Seanix Technology Inc +4d51 MediaQ Inc. + 0200 MQ-200 +4d54 Microtechnica Co Ltd +4ddc ILC Data Device Corp + 0100 DD-42924I5-300 (ARINC 429 Data Bus) + 0801 BU-65570I1 MIL-STD-1553 Test and Simulation + 0802 BU-65570I2 MIL-STD-1553 Test and Simulation + 0811 BU-65572I1 MIL-STD-1553 Test and Simulation + 0812 BU-65572I2 MIL-STD-1553 Test and Simulation + 0881 BU-65570T1 MIL-STD-1553 Test and Simulation + 0882 BU-65570T2 MIL-STD-1553 Test and Simulation + 0891 BU-65572T1 MIL-STD-1553 Test and Simulation + 0892 BU-65572T2 MIL-STD-1553 Test and Simulation + 0901 BU-65565C1 MIL-STD-1553 Data Bus + 0902 BU-65565C2 MIL-STD-1553 Data Bus + 0903 BU-65565C3 MIL-STD-1553 Data Bus + 0904 BU-65565C4 MIL-STD-1553 Data Bus + 0b01 BU-65569I1 MIL-STD-1553 Data Bus + 0b02 BU-65569I2 MIL-STD-1553 Data Bus + 0b03 BU-65569I3 MIL-STD-1553 Data Bus + 0b04 BU-65569I4 MIL-STD-1553 Data Bus +5046 GemTek Technology Corporation + 1001 PCI Radio +5053 Voyetra Technologies + 2010 Daytona Audio Adapter +5136 S S Technologies +5143 Qualcomm Inc +5145 Ensoniq (Old) + 3031 Concert AudioPCI +5168 Animation Technologies Inc. +5301 Alliance Semiconductor Corp. + 0001 ProMotion aT3D +5333 S3 Inc. + 0551 Plato/PX (system) + 5631 86c325 [ViRGE] + 8800 86c866 [Vision 866] + 8801 86c964 [Vision 964] + 8810 86c764_0 [Trio 32 vers 0] + 8811 86c764/765 [Trio32/64/64V+] + 8812 86cM65 [Aurora64V+] + 8813 86c764_3 [Trio 32/64 vers 3] + 8814 86c767 [Trio 64UV+] + 8815 86cM65 [Aurora 128] + 883d 86c988 [ViRGE/VX] + 8870 FireGL + 8880 86c868 [Vision 868 VRAM] vers 0 + 8881 86c868 [Vision 868 VRAM] vers 1 + 8882 86c868 [Vision 868 VRAM] vers 2 + 8883 86c868 [Vision 868 VRAM] vers 3 + 88b0 86c928 [Vision 928 VRAM] vers 0 + 88b1 86c928 [Vision 928 VRAM] vers 1 + 88b2 86c928 [Vision 928 VRAM] vers 2 + 88b3 86c928 [Vision 928 VRAM] vers 3 + 88c0 86c864 [Vision 864 DRAM] vers 0 + 88c1 86c864 [Vision 864 DRAM] vers 1 + 88c2 86c864 [Vision 864-P DRAM] vers 2 + 88c3 86c864 [Vision 864-P DRAM] vers 3 + 88d0 86c964 [Vision 964 VRAM] vers 0 + 88d1 86c964 [Vision 964 VRAM] vers 1 + 88d2 86c964 [Vision 964-P VRAM] vers 2 + 88d3 86c964 [Vision 964-P VRAM] vers 3 + 88f0 86c968 [Vision 968 VRAM] rev 0 + 88f1 86c968 [Vision 968 VRAM] rev 1 + 88f2 86c968 [Vision 968 VRAM] rev 2 + 88f3 86c968 [Vision 968 VRAM] rev 3 + 8900 86c755 [Trio 64V2/DX] + 5333 8900 86C775 Trio64V2/DX + 8901 86c775/86c785 [Trio 64V2/DX or /GX] + 5333 8901 86C775 Trio64V2/DX, 86C785 Trio64V2/GX + 8902 Plato/PX + 8903 Trio 3D business multimedia + 8904 Trio 64 3D + 1014 00db Integrated Trio3D + 5333 8904 86C365 Trio3D AGP + 8905 Trio 64V+ family + 8906 Trio 64V+ family + 8907 Trio 64V+ family + 8908 Trio 64V+ family + 8909 Trio 64V+ family + 890a Trio 64V+ family + 890b Trio 64V+ family + 890c Trio 64V+ family + 890d Trio 64V+ family + 890e Trio 64V+ family + 890f Trio 64V+ family + 8a01 ViRGE/DX or /GX + 0e11 b032 ViRGE/GX + 10b4 1617 Nitro 3D + 10b4 1717 Nitro 3D + 5333 8a01 ViRGE/DX + 8a10 ViRGE/GX2 + 1092 8a10 Stealth 3D 4000 + 8a13 86c368 [Trio 3D/2X] + 5333 8a13 Trio3D/2X + 8a20 86c794 [Savage 3D] + 5333 8a20 86C391 Savage3D + 8a21 86c390 [Savage 3D/MV] + 5333 8a21 86C390 Savage3D/MV + 8a22 Savage 4 + 1033 8068 Savage 4 + 1033 8069 Savage 4 + 105d 0018 SR9 8Mb SDRAM + 105d 002a SR9 Pro 16Mb SDRAM + 105d 003a SR9 Pro 32Mb SDRAM + 105d 092f SR9 Pro+ 16Mb SGRAM + 1092 4207 Stealth III S540 + 1092 4800 Stealth III S540 + 1092 4807 SpeedStar A90 + 1092 4808 Stealth III S540 + 1092 4809 Stealth III S540 + 1092 480e Stealth III S540 + 1092 4904 Stealth III S520 + 1092 4905 SpeedStar A200 + 1092 4a09 Stealth III S540 + 1092 4a0b Stealth III S540 Xtreme + 1092 4a0f Stealth III S540 + 1092 4e01 Stealth III S540 + 1102 101d 3d Blaster Savage 4 + 1102 101e 3d Blaster Savage 4 + 5333 8100 86C394-397 Savage4 SDRAM 100 + 5333 8110 86C394-397 Savage4 SDRAM 110 + 5333 8125 86C394-397 Savage4 SDRAM 125 + 5333 8143 86C394-397 Savage4 SDRAM 143 + 5333 8a22 86C394-397 Savage4 + 5333 8a2e 86C394-397 Savage4 32bit + 5333 9125 86C394-397 Savage4 SGRAM 125 + 5333 9143 86C394-397 Savage4 SGRAM 143 + 8a23 Savage 4 + 8a25 ProSavage PM133 + 8a26 ProSavage KM133 + 8c00 ViRGE/M3 + 8c01 ViRGE/MX + 1179 0001 ViRGE/MX + 8c02 ViRGE/MX+ + 8c03 ViRGE/MX+MV + 8c10 86C270-294 Savage/MX-MV + 8c11 82C270-294 Savage/MX + 8c12 86C270-294 Savage/IX-MV + 1014 017f ThinkPad T20 + 8c13 86C270-294 Savage/IX + 1179 0001 Magnia Z310 + 8c22 SuperSavage MX/128 + 8c24 SuperSavage MX/64 + 8c26 SuperSavage MX/64C + 8c2a SuperSavage IX/128 SDR + 8c2b SuperSavage IX/128 DDR + 8c2c SuperSavage IX/64 SDR + 8c2d SuperSavage IX/64 DDR + 8c2e SuperSavage IX/C SDR + 1014 01fc ThinkPad T23 (2647-4MG) + 8c2f SuperSavage IX/C DDR + 8d01 86C380 [ProSavageDDR K4M266] + 8d02 VT8636A [ProSavage KN133] AGP4X VGA Controller (TwisterK) + 8d03 VT8751 [ProSavageDDR P4M266] + 8d04 [ProSavageDDR K4M266] + 9102 86C410 Savage 2000 + 1092 5932 Viper II Z200 + 1092 5934 Viper II Z200 + 1092 5952 Viper II Z200 + 1092 5954 Viper II Z200 + 1092 5a35 Viper II Z200 + 1092 5a37 Viper II Z200 + 1092 5a55 Viper II Z200 + 1092 5a57 Viper II Z200 + ca00 SonicVibes +544c Teralogic Inc +5455 Technische University Berlin + 4458 S5933 +5519 Cnet Technologies, Inc. +5544 Dunord Technologies + 0001 I-30xx Scanner Interface +5555 Genroco, Inc + 0003 TURBOstor HFP-832 [HiPPI NIC] +5654 VoiceTronix Pty Ltd +5700 Netpower +6356 UltraStor +6374 c't Magazin für Computertechnik + 6773 GPPCI +6409 Logitec Corp. +6666 Decision Computer International Co. + 0001 PCCOM4 + 0002 PCCOM8 +7604 O.N. Electronic Co Ltd. +7bde MIDAC Corporation +7fed PowerTV +8008 Quancom Electronic GmbH + 0010 WDOG1 [PCI-Watchdog 1] + 0011 PWDOG2 [PCI-Watchdog 2] +8086 Intel Corp. + 0007 82379AB + 0008 Extended Express System Support Controller + 0039 21145 + 0122 82437FX + 0482 82375EB + 0483 82424ZX [Saturn] + 0484 82378IB [SIO ISA Bridge] + 0486 82430ZX [Aries] + 04a3 82434LX [Mercury/Neptune] + 04d0 82437FX [Triton FX] + 0600 RAID Controller + 0960 80960RP [i960 RP Microprocessor/Bridge] + 0962 80960RM [i960RM Bridge] + 0964 80960RP [i960 RP Microprocessor/Bridge] + 1000 82542 Gigabit Ethernet Controller + 0e11 b0df NC1632 Gigabit Ethernet Adapter (1000-SX) + 0e11 b0e0 NC1633 Gigabit Ethernet Adapter (1000-LX) + 0e11 b123 NC1634 Gigabit Ethernet Adapter (1000-SX) + 1014 0119 Netfinity Gigabit Ethernet SX Adapter + 8086 1000 PRO/1000 Gigabit Server Adapter + 1001 82543GC Gigabit Ethernet Controller (Fiber) + 0e11 004a NC6136 Gigabit Server Adapter + 1014 01ea Netfinity Gigabit Ethernet SX Adapter + 8086 1003 PRO/1000 F Server Adapter + 1002 Pro 100 LAN+Modem 56 Cardbus II + 8086 200e Pro 100 LAN+Modem 56 Cardbus II + 8086 2013 Pro 100 SR Mobile Combo Adapter + 8086 2017 Pro 100 S Combo Mobile Adapter + 1004 82543GC Gigabit Ethernet Controller (Copper) + 0e11 0049 NC7132 Gigabit Upgrade Module + 0e11 b1a4 NC7131 Gigabit Server Adapter + 1014 10f2 Gigabit Ethernet Server Adapter + 8086 1004 PRO/1000 T Server Adapter + 8086 2004 PRO/1000 T Server Adapter + 1008 82544EI Gigabit Ethernet Controller (Copper) + 8086 1107 PRO/1000 XT Server Adapter + 8086 2107 PRO/1000 XT Server Adapter + 8086 2110 PRO/1000 XT Server Adapter + 1009 82544EI Gigabit Ethernet Controller (Fiber) + 8086 1109 PRO/1000 XF Server Adapter + 8086 2109 PRO/1000 XF Server Adapter + 100c 82544GC Gigabit Ethernet Controller (Copper) + 8086 1112 PRO/1000 T Desktop Adapter + 8086 2112 PRO/1000 T Desktop Adapter + 100d 82544GC Gigabit Ethernet Controller (LOM) + 100e 82540EM Gigabit Ethernet Controller + 8086 001e PRO/1000 MT Desktop Adapter + 8086 002e PRO/1000 MT Desktop Adapter + 100f 82545EM Gigabit Ethernet Controller (Copper) + 8086 1001 PRO/1000 MT Server Adapter + 1010 82546EB Gigabit Ethernet Controller (Copper) + 8086 1011 PRO/1000 MT Dual Port Server Adapter + 1011 82545EM Gigabit Ethernet Controller (Fiber) + 8086 1002 PRO/1000 MF Server Adapter + 1012 82546EB Gigabit Ethernet Controller (Fiber) + 8086 1012 PRO/1000 MF Dual Port Server Adapter + 1015 82540EM Gigabit Ethernet Controller (LOM) + 1029 82559 Ethernet Controller + 1030 82559 InBusiness 10/100 + 1031 82801CAM (ICH3) PRO/100 VE (LOM) Ethernet Controller + 1014 0209 ThinkPad A/T/X Series + 104d 80e7 Vaio PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 107b 5350 EtherExpress PRO/100 VE + 1179 0001 EtherExpress PRO/100 VE + 144d c000 EtherExpress PRO/100 VE + 144d c001 EtherExpress PRO/100 VE + 144d c003 EtherExpress PRO/100 VE + 144d c006 vpr Matrix 170B4 + 1032 82801CAM (ICH3) PRO/100 VE Ethernet Controller + 1033 82801CAM (ICH3) PRO/100 VM (LOM) Ethernet Controller + 1034 82801CAM (ICH3) PRO/100 VM Ethernet Controller + 1035 82801CAM (ICH3)/82562EH (LOM) Ethernet Controller + 1036 82801CAM (ICH3) 82562EH Ethernet Controller + 1037 82801CAM (ICH3) Chipset Ethernet Controller + 1038 82801CAM (ICH3) PRO/100 VM (KM) Ethernet Controller + 1039 82801BD PRO/100 VE (LOM) Ethernet Controller + 103a 82801BD PRO/100 VE (CNR) Ethernet Controller + 103b 82801BD PRO/100 VM (LOM) Ethernet Controller + 103c 82801BD PRO/100 VM (CNR) Ethernet Controller + 103d 82801BD PRO/100 VE (MOB) Ethernet Controller + 103e 82801BD PRO/100 VM (MOB) Ethernet Controller + 1040 536EP Data Fax Modem + 16be 1040 V.9X DSP Data Fax Modem + 1059 82551QM Ethernet Controller + 1130 82815 815 Chipset Host Bridge and Memory Controller Hub + 1025 1016 Travelmate 612 TX + 1043 8027 TUSL2-C Mainboard + 104d 80df Vaio PCG-FX403 + 1131 82815 815 Chipset AGP Bridge + 1132 82815 CGC [Chipset Graphics Controller] + 1025 1016 Travelmate 612 TX + 104d 80df Vaio PCG-FX403 + 1161 82806AA PCI64 Hub Advanced Programmable Interrupt Controller + 8086 1161 82806AA PCI64 Hub APIC + 1162 Xscale 80200 Big Endian Companion Chip + 1200 Intel IXP1200 Network Processor + 172a 0000 AEP SSL Accelerator + 1209 82559ER + 1221 82092AA_0 + 1222 82092AA_1 + 1223 SAA7116 + 1225 82452KX/GX [Orion] + 1226 82596 PRO/10 PCI + 1227 82865 EtherExpress PRO/100A + 1228 82556 EtherExpress PRO/100 Smart +# the revision field differentiates between them (1-3 is 82557, 4-5 is 82558, 6-8 is 82559, 9 is 82559ER) + 1229 82557/8/9 [Ethernet Pro 100] + 0e11 3001 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 3002 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 3003 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 3004 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 3005 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 3006 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 3007 82559 Fast Ethernet LOM with Alert on LAN* + 0e11 b01e NC3120 Fast Ethernet NIC + 0e11 b01f NC3122 Fast Ethernet NIC (dual port) + 0e11 b02f NC1120 Ethernet NIC + 0e11 b04a Netelligent 10/100TX NIC with Wake on LAN + 0e11 b0c6 NC3161 Fast Ethernet NIC (embedded, WOL) + 0e11 b0c7 NC3160 Fast Ethernet NIC (embedded) + 0e11 b0d7 NC3121 Fast Ethernet NIC (WOL) + 0e11 b0dd NC3131 Fast Ethernet NIC (dual port) + 0e11 b0de NC3132 Fast Ethernet Module (dual port) + 0e11 b0e1 NC3133 Fast Ethernet Module (100-FX) + 0e11 b134 NC3163 Fast Ethernet NIC (embedded, WOL) + 0e11 b13c NC3162 Fast Ethernet NIC (embedded) + 0e11 b144 NC3123 Fast Ethernet NIC (WOL) + 0e11 b163 NC3134 Fast Ethernet NIC (dual port) + 0e11 b164 NC3135 Fast Ethernet Upgrade Module (dual port) + 0e11 b1a4 NC7131 Gigabit Server Adapter + 1014 005c 82558B Ethernet Pro 10/100 + 1014 01bc 82559 Fast Ethernet LAN On Motherboard + 1014 01f1 10/100 Ethernet Server Adapter + 1014 01f2 10/100 Ethernet Server Adapter + 1014 0207 Ethernet Pro/100 S + 1014 0232 10/100 Dual Port Server Adapter + 1014 023a ThinkPad R30 + 1014 105c Netfinity 10/100 + 1014 2205 ThinkPad A22p + 1014 305c 10/100 EtherJet Management Adapter + 1014 405c 10/100 EtherJet Adapter with Alert on LAN + 1014 505c 10/100 EtherJet Secure Management Adapter + 1014 605c 10/100 EtherJet Secure Management Adapter + 1014 705c 10/100 Netfinity 10/100 Ethernet Security Adapter + 1014 805c 10/100 Netfinity 10/100 Ethernet Security Adapter + 1028 009b PowerEdge 2550 + 1033 8000 PC-9821X-B06 + 1033 8016 PK-UG-X006 + 1033 801f PK-UG-X006 + 1033 8026 PK-UG-X006 + 1033 8063 82559-based Fast Ethernet Adapter + 1033 8064 82559-based Fast Ethernet Adapter + 103c 10c0 NetServer 10/100TX + 103c 10c3 NetServer 10/100TX + 103c 10ca NetServer 10/100TX + 103c 10cb NetServer 10/100TX + 103c 10e3 NetServer 10/100TX + 103c 10e4 NetServer 10/100TX + 103c 1200 NetServer 10/100TX + 10c3 1100 SmartEther100 SC1100 + 10cf 1115 8255x-based Ethernet Adapter (10/100) + 10cf 1143 8255x-based Ethernet Adapter (10/100) + 1179 0001 8255x-based Ethernet Adapter (10/100) + 1179 0002 PCI FastEther LAN on Docker + 1179 0003 8255x-based Fast Ethernet + 1259 2560 AT-2560 100 + 1259 2561 AT-2560 100 FX Ethernet Adapter + 1266 0001 NE10/100 Adapter + 144d 2501 SEM-2000 MiniPCI LAN Adapter + 144d 2502 SEM-2100IL MiniPCI LAN Adapter + 1668 1100 EtherExpress PRO/100B (TX) (MiniPCI Ethernet+Modem) + 8086 0001 EtherExpress PRO/100B (TX) + 8086 0002 EtherExpress PRO/100B (T4) + 8086 0003 EtherExpress PRO/10+ + 8086 0004 EtherExpress PRO/100 WfM + 8086 0005 82557 10/100 + 8086 0006 82557 10/100 with Wake on LAN + 8086 0007 82558 10/100 Adapter + 8086 0008 82558 10/100 with Wake on LAN + 8086 0009 EtherExpress PRO/100+ + 8086 000a EtherExpress PRO/100+ Management Adapter + 8086 000b EtherExpress PRO/100+ + 8086 000c EtherExpress PRO/100+ Management Adapter + 8086 000d EtherExpress PRO/100+ Alert On LAN II* Adapter + 8086 000e EtherExpress PRO/100+ Management Adapter with Alert On LAN* + 8086 000f EtherExpress PRO/100 Desktop Adapter + 8086 0010 EtherExpress PRO/100 S Management Adapter + 8086 0011 EtherExpress PRO/100 S Management Adapter + 8086 0012 EtherExpress PRO/100 S Advanced Management Adapter (D) + 8086 0013 EtherExpress PRO/100 S Advanced Management Adapter (E) + 8086 0030 EtherExpress PRO/100 Management Adapter with Alert On LAN* GC + 8086 0031 EtherExpress PRO/100 Desktop Adapter + 8086 0040 EtherExpress PRO/100 S Desktop Adapter + 8086 0041 EtherExpress PRO/100 S Desktop Adapter + 8086 0042 EtherExpress PRO/100 Desktop Adapter + 8086 0050 EtherExpress PRO/100 S Desktop Adapter + 8086 1009 EtherExpress PRO/100+ Server Adapter + 8086 100c EtherExpress PRO/100+ Server Adapter (PILA8470B) + 8086 1012 EtherExpress PRO/100 S Server Adapter (D) + 8086 1013 EtherExpress PRO/100 S Server Adapter (E) + 8086 1015 EtherExpress PRO/100 S Dual Port Server Adapter + 8086 1017 EtherExpress PRO/100+ Dual Port Server Adapter + 8086 1030 EtherExpress PRO/100+ Management Adapter with Alert On LAN* G Server + 8086 1040 EtherExpress PRO/100 S Server Adapter + 8086 1041 EtherExpress PRO/100 S Server Adapter + 8086 1042 EtherExpress PRO/100 Server Adapter + 8086 1050 EtherExpress PRO/100 S Server Adapter + 8086 1051 EtherExpress PRO/100 Server Adapter + 8086 1052 EtherExpress PRO/100 Server Adapter + 8086 10f0 EtherExpress PRO/100+ Dual Port Adapter + 8086 2009 EtherExpress PRO/100 S Mobile Adapter + 8086 200d EtherExpress PRO/100 Cardbus + 8086 200e EtherExpress PRO/100 LAN+V90 Cardbus Modem + 8086 200f EtherExpress PRO/100 SR Mobile Adapter + 8086 2010 EtherExpress PRO/100 S Mobile Combo Adapter + 8086 2013 EtherExpress PRO/100 SR Mobile Combo Adapter + 8086 2016 EtherExpress PRO/100 S Mobile Adapter + 8086 2017 EtherExpress PRO/100 S Combo Mobile Adapter + 8086 2018 EtherExpress PRO/100 SR Mobile Adapter + 8086 2019 EtherExpress PRO/100 SR Combo Mobile Adapter + 8086 2101 EtherExpress PRO/100 P Mobile Adapter + 8086 2102 EtherExpress PRO/100 SP Mobile Adapter + 8086 2103 EtherExpress PRO/100 SP Mobile Adapter + 8086 2104 EtherExpress PRO/100 SP Mobile Adapter + 8086 2105 EtherExpress PRO/100 SP Mobile Adapter + 8086 2106 EtherExpress PRO/100 P Mobile Adapter + 8086 2107 EtherExpress PRO/100 Network Connection + 8086 2108 EtherExpress PRO/100 Network Connection + 8086 2200 EtherExpress PRO/100 P Mobile Combo Adapter + 8086 2201 EtherExpress PRO/100 P Mobile Combo Adapter + 8086 2202 EtherExpress PRO/100 SP Mobile Combo Adapter + 8086 2203 EtherExpress PRO/100+ MiniPCI + 8086 2204 EtherExpress PRO/100+ MiniPCI + 8086 2205 EtherExpress PRO/100 SP Mobile Combo Adapter + 8086 2206 EtherExpress PRO/100 SP Mobile Combo Adapter + 8086 2207 EtherExpress PRO/100 SP Mobile Combo Adapter + 8086 2208 EtherExpress PRO/100 P Mobile Combo Adapter + 8086 2402 EtherExpress PRO/100+ MiniPCI + 8086 2407 EtherExpress PRO/100+ MiniPCI + 8086 2408 EtherExpress PRO/100+ MiniPCI + 8086 2409 EtherExpress PRO/100+ MiniPCI + 8086 240f EtherExpress PRO/100+ MiniPCI + 8086 2410 EtherExpress PRO/100+ MiniPCI + 8086 2411 EtherExpress PRO/100+ MiniPCI + 8086 2412 EtherExpress PRO/100+ MiniPCI + 8086 2413 EtherExpress PRO/100+ MiniPCI + 8086 3000 82559 Fast Ethernet LAN on Motherboard + 8086 3001 82559 Fast Ethernet LOM with Basic Alert on LAN* + 8086 3002 82559 Fast Ethernet LOM with Alert on LAN II* + 8086 3006 EtherExpress PRO/100 S Network Connection + 8086 3007 EtherExpress PRO/100 S Network Connection + 8086 3008 EtherExpress PRO/100 Network Connection + 8086 3010 EtherExpress PRO/100 S Network Connection + 8086 3011 EtherExpress PRO/100 S Network Connection + 8086 3012 EtherExpress PRO/100 Network Connection + 122d 430FX - 82437FX TSC [Triton I] + 122e 82371FB PIIX ISA [Triton I] + 1230 82371FB PIIX IDE [Triton I] + 1231 DSVD Modem + 1234 430MX - 82371MX Mobile PCI I/O IDE Xcelerator (MPIIX) + 1235 430MX - 82437MX Mob. System Ctrlr (MTSC) & 82438MX Data Path (MTDP) + 1237 440FX - 82441FX PMC [Natoma] + 1239 82371FB + 123b 82380PB + 123c 82380AB + 123d 683053 Programmable Interrupt Device + 123f 82466GX Integrated Hot-Plug Controller (IHPC) + 1240 752 AGP + 124b 82380FB + 1250 430HX - 82439HX TXC [Triton II] + 1360 82806AA PCI64 Hub PCI Bridge + 1361 82806AA PCI64 Hub Controller (HRes) + 8086 1361 82806AA PCI64 Hub Controller (HRes) + 8086 8000 82806AA PCI64 Hub Controller (HRes) + 1460 82870P2 P64H2 Hub PCI Bridge + 1461 82870P2 P64H2 I/OxAPIC + 15d9 3480 P4DP6 + 1462 82870P2 P64H2 Hot Plug Controller + 1960 80960RP [i960RP Microprocessor] + 101e 0431 MegaRAID 431 RAID Controller + 101e 0438 MegaRAID 438 Ultra2 LVD RAID Controller + 101e 0466 MegaRAID 466 Express Plus RAID Controller + 101e 0467 MegaRAID 467 Enterprise 1500 RAID Controller + 101e 0490 MegaRAID 490 Express 300 RAID Controller + 101e 0762 MegaRAID 762 Express RAID Controller + 101e 09a0 PowerEdge Expandable RAID Controller 2/SC + 1028 0467 PowerEdge Expandable RAID Controller 2/DC + 1028 1111 PowerEdge Expandable RAID Controller 2/SC + 103c 03a2 MegaRAID + 103c 10c6 MegaRAID 438, HP NetRAID-3Si + 103c 10c7 MegaRAID T5, Integrated HP NetRAID + 103c 10cc MegaRAID, Integrated HP NetRAID + 103c 10cd HP NetRAID-1Si + 105a 0000 SuperTrak + 105a 2168 SuperTrak Pro + 105a 5168 SuperTrak66/100 + 1111 1111 MegaRAID 466, PowerEdge Expandable RAID Controller 2/SC + 1111 1112 PowerEdge Expandable RAID Controller 2/SC + 113c 03a2 MegaRAID + 1962 80960RM [i960RM Microprocessor] + 105a 0000 SuperTrak SX6000 I2O CPU + 1a21 82840 840 (Carmel) Chipset Host Bridge (Hub A) + 1a23 82840 840 (Carmel) Chipset AGP Bridge + 1a24 82840 840 (Carmel) Chipset PCI Bridge (Hub B) + 1a30 82845 845 (Brookdale) Chipset Host Bridge + 1a31 82845 845 (Brookdale) Chipset AGP Bridge + 2410 82801AA ISA Bridge (LPC) + 2411 82801AA IDE + 2412 82801AA USB + 2413 82801AA SMBus + 2415 82801AA AC'97 Audio + 1028 0095 Precision Workstation 220 Integrated Digital Audio + 11d4 0040 SoundMAX Integrated Digital Audio + 11d4 0048 SoundMAX Integrated Digital Audio + 11d4 5340 SoundMAX Integrated Digital Audio + 2416 82801AA AC'97 Modem + 2418 82801AA PCI Bridge + 2420 82801AB ISA Bridge (LPC) + 2421 82801AB IDE + 2422 82801AB USB + 2423 82801AB SMBus + 2425 82801AB AC'97 Audio + 11d4 0040 SoundMAX Integrated Digital Audio + 11d4 0048 SoundMAX Integrated Digital Audio + 2426 82801AB AC'97 Modem + 2428 82801AB PCI Bridge + 2440 82801BA ISA Bridge (LPC) + 2442 82801BA/BAM USB (Hub #1) + 1014 01c6 Netvista A40/A40p + 1025 1016 Travelmate 612 TX + 104d 80df Vaio PCG-FX403 + 147b 0507 TH7II-RAID + 2443 82801BA/BAM SMBus + 1014 01c6 Netvista A40/A40p + 1025 1016 Travelmate 612 TX + 1043 8027 TUSL2-C Mainboard + 104d 80df Vaio PCG-FX403 + 147b 0507 TH7II-RAID + 2444 82801BA/BAM USB (Hub #2) + 1025 1016 Travelmate 612 TX + 104d 80df Vaio PCG-FX403 + 147b 0507 TH7II-RAID + 2445 82801BA/BAM AC'97 Audio + 1014 01c6 Netvista A40/A40p + 1025 1016 Travelmate 612 TX + 104d 80df Vaio PCG-FX403 + 1462 3370 STAC9721 AC + 147b 0507 TH7II-RAID + 2446 Intel 537 [82801BA/BAM AC'97 Modem] + 1025 1016 Travelmate 612 TX + 104d 80df Vaio PCG-FX403 + 2448 82801BAM/CAM PCI Bridge + 2449 82801BA/BAM/CA/CAM Ethernet Controller + 0e11 0012 EtherExpress PRO/100 VM + 0e11 0091 EtherExpress PRO/100 VE + 1014 01ce EtherExpress PRO/100 VE + 1014 01dc EtherExpress PRO/100 VE + 1014 01eb EtherExpress PRO/100 VE + 1014 01ec EtherExpress PRO/100 VE + 1014 0202 EtherExpress PRO/100 VE + 1014 0205 EtherExpress PRO/100 VE + 1014 0217 EtherExpress PRO/100 VE + 1014 0234 EtherExpress PRO/100 VE + 1014 023d EtherExpress PRO/100 VE + 1014 0244 EtherExpress PRO/100 VE + 1014 0245 EtherExpress PRO/100 VE + 109f 315d EtherExpress PRO/100 VE + 109f 3181 EtherExpress PRO/100 VE + 1186 7801 EtherExpress PRO/100 VE + 144d 2602 HomePNA 1M CNR + 8086 3010 EtherExpress PRO/100 VE + 8086 3011 EtherExpress PRO/100 VM + 8086 3012 82562EH based Phoneline + 8086 3013 EtherExpress PRO/100 VE + 8086 3014 EtherExpress PRO/100 VM + 8086 3015 82562EH based Phoneline + 8086 3016 EtherExpress PRO/100 P Mobile Combo + 8086 3017 EtherExpress PRO/100 P Mobile + 8086 3018 EtherExpress PRO/100 + 244a 82801BAM IDE U100 + 1025 1016 Travelmate 612TX + 104d 80df Vaio PCG-FX403 + 244b 82801BA IDE U100 + 1014 01c6 Netvista A40/A40p + 1043 8027 TUSL2-C Mainboard + 147b 0507 TH7II-RAID + 244c 82801BAM ISA Bridge (LPC) + 244e 82801BA/CA/DB PCI Bridge + 2450 82801E ISA Bridge (LPC) + 2452 82801E USB + 2453 82801E SMBus + 2459 82801E Ethernet Controller 0 + 245b 82801E IDE U100 + 245d 82801E Ethernet Controller 1 + 245e 82801E PCI Bridge + 2480 82801CA ISA Bridge (LPC) + 2482 82801CA/CAM USB (Hub #1) + 1014 0220 ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 15d9 3480 P4DP6 + 8086 1958 vpr Matrix 170B4 + 2483 82801CA/CAM SMBus + 1014 0220 ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 15d9 3480 P4DP6 + 8086 1958 vpr Matrix 170B4 + 2484 82801CA/CAM USB (Hub #2) + 1014 0220 ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 15d9 3480 P4DP6 + 8086 1958 vpr Matrix 170B4 + 2485 82801CA/CAM AC'97 Audio + 1014 0222 ThinkPad T23 (2647-4MG) or A30p (2653-64G) + 1014 0508 ThinkPad T30 + 1014 051c ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 144d c006 vpr Matrix 170B4 + 2486 82801CA/CAM AC'97 Modem + 1014 0223 ThinkPad A/T/X Series + 1014 0503 ThinkPad R31 2656BBG + 1014 051a ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 1179 0001 Toshiba Satellite 1110 Z15 internal Modem + 134d 4c21 Dell Inspiron 2100 internal modem + 144d 2115 vpr Matrix 170B4 internal modem + 14f1 5421 MD56ORD V.92 MDC Modem + 2487 82801CA/CAM USB (Hub #3) + 1014 0220 ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 15d9 3480 P4DP6 + 8086 1958 vpr Matrix 170B4 + 248a 82801CAM IDE U100 + 1014 0220 ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 8086 1958 vpr Matrix 170B4 + 248b 82801CA IDE U100 + 15d9 3480 P4DP6 + 248c 82801CAM ISA Bridge (LPC) + 24c0 82801DB ISA Bridge (LPC) + 1462 5800 845PE Max (MS-6580) + 24c2 82801DB USB (Hub #1) + 1462 5800 845PE Max (MS-6580) + 24c3 82801DB SMBus + 1462 5800 845PE Max (MS-6580) + 24c4 82801DB USB (Hub #2) + 1462 5800 845PE Max (MS-6580) + 24c5 82801DB AC'97 Audio + 1462 5800 845PE Max (MS-6580) + 24c6 82801DB AC'97 Modem + 24c7 82801DB USB (Hub #3) + 1462 5800 845PE Max (MS-6580) + 24cb 82801DB ICH4 IDE + 1462 5800 845PE Max (MS-6580) + 24cd 82801DB USB EHCI Controller + 1462 3981 845PE Max (MS-6580) Onboard USB EHCI Controller + 2500 82820 820 (Camino) Chipset Host Bridge (MCH) + 1028 0095 Precision Workstation 220 Chipset + 1043 801c P3C-2000 system chipset + 2501 82820 820 (Camino) Chipset Host Bridge (MCH) + 1043 801c P3C-2000 system chipset + 250b 82820 820 (Camino) Chipset Host Bridge + 250f 82820 820 (Camino) Chipset AGP Bridge + 2520 82805AA MTH Memory Translator Hub + 2521 82804AA MRH-S Memory Repeater Hub for SDRAM + 2530 82850 850 (Tehama) Chipset Host Bridge (MCH) + 147b 0507 TH7II-RAID + 2531 82860 860 (Wombat) Chipset Host Bridge (MCH) + 2532 82850 850 (Tehama) Chipset AGP Bridge + 2533 82860 860 (Wombat) Chipset AGP Bridge + 2534 82860 860 (Wombat) Chipset PCI Bridge + 2540 e7500 [Plumas] DRAM Controller + 15d9 3480 P4DP6 + 2541 e7500 [Plumas] DRAM Controller Error Reporting + 15d9 3480 P4DP6 + 2543 e7500 [Plumas] HI_B Virtual PCI Bridge (F0) + 2544 e7500 [Plumas] HI_B Virtual PCI Bridge (F1) + 2545 e7500 [Plumas] HI_C Virtual PCI Bridge (F0) + 2546 e7500 [Plumas] HI_C Virtual PCI Bridge (F1) + 2547 e7500 [Plumas] HI_D Virtual PCI Bridge (F0) + 2548 e7500 [Plumas] HI_D Virtual PCI Bridge (F1) + 2560 82845G/GL [Brookdale-G] Chipset Host Bridge + 1462 5800 845PE Max (MS-6580) + 2561 82845G/GL [Brookdale-G] Chipset AGP Bridge + 2562 82845G/GL [Brookdale-G] Chipset Integrated Graphics Device + 3092 Integrated RAID + 3575 82830 830 Chipset Host Bridge + 1014 021d ThinkPad A/T/X Series + 104d 80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP + 3576 82830 830 Chipset AGP Bridge + 3577 82830 CGC [Chipset Graphics Controller] + 1014 0513 ThinkPad A/T/X Series + 3578 82830 830 Chipset Host Bridge + 5200 EtherExpress PRO/100 Intelligent Server + 5201 EtherExpress PRO/100 Intelligent Server + 8086 0001 EtherExpress PRO/100 Server Ethernet Adapter + 530d 80310 IOP [IO Processor] + 7000 82371SB PIIX3 ISA [Natoma/Triton II] + 7010 82371SB PIIX3 IDE [Natoma/Triton II] + 7020 82371SB PIIX3 USB [Natoma/Triton II] + 7030 430VX - 82437VX TVX [Triton VX] + 7100 430TX - 82439TX MTXC + 7110 82371AB/EB/MB PIIX4 ISA + 7111 82371AB/EB/MB PIIX4 IDE + 7112 82371AB/EB/MB PIIX4 USB + 7113 82371AB/EB/MB PIIX4 ACPI + 7120 82810 GMCH [Graphics Memory Controller Hub] + 7121 82810 CGC [Chipset Graphics Controller] + 7122 82810 DC-100 GMCH [Graphics Memory Controller Hub] + 7123 82810 DC-100 CGC [Chipset Graphics Controller] + 7124 82810E DC-133 GMCH [Graphics Memory Controller Hub] + 7125 82810E DC-133 CGC [Chipset Graphics Controller] + 7126 82810 DC-133 System and Graphics Controller + 7128 82810-M DC-100 System and Graphics Controller + 712a 82810-M DC-133 System and Graphics Controller + 7180 440LX/EX - 82443LX/EX Host bridge + 7181 440LX/EX - 82443LX/EX AGP bridge + 7190 440BX/ZX/DX - 82443BX/ZX/DX Host bridge + 0e11 0500 Armada 1750 Laptop System Chipset + 0e11 b110 Armada M700 + 1179 0001 Toshiba Tecra 8100 Laptop System Chipset + 7191 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge + 7192 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) + 0e11 0460 Armada 1700 Laptop System Chipset + 7194 82440MX Host Bridge + 7195 82440MX AC'97 Audio Controller + 10cf 1099 QSound_SigmaTel Stac97 PCI Audio + 11d4 0040 SoundMAX Integrated Digital Audio + 11d4 0048 SoundMAX Integrated Digital Audio + 7196 82440MX AC'97 Modem Controller + 7198 82440MX ISA Bridge + 7199 82440MX EIDE Controller + 719a 82440MX USB Universal Host Controller + 719b 82440MX Power Management Controller + 71a0 440GX - 82443GX Host bridge + 71a1 440GX - 82443GX AGP bridge + 71a2 440GX - 82443GX Host bridge (AGP disabled) + 7600 82372FB PIIX5 ISA + 7601 82372FB PIIX5 IDE + 7602 82372FB PIIX5 USB + 7603 82372FB PIIX5 SMBus + 7800 i740 + 003d 0008 Starfighter AGP + 003d 000b Starfighter AGP + 1092 0100 Stealth II G460 + 10b4 201a Lightspeed 740 + 10b4 202f Lightspeed 740 + 8086 0000 Terminator 2x/i + 8086 0100 Intel740 Graphics Accelerator + 84c4 450KX/GX [Orion] - 82454KX/GX PCI bridge + 84c5 450KX/GX [Orion] - 82453KX/GX Memory controller + 84ca 450NX - 82451NX Memory & I/O Controller + 84cb 450NX - 82454NX/84460GX PCI Expander Bridge + 84e0 460GX - 84460GX System Address Controller (SAC) + 84e1 460GX - 84460GX System Data Controller (SDC) + 84e2 460GX - 84460GX AGP Bridge (GXB function 2) + 84e3 460GX - 84460GX Memory Address Controller (MAC) + 84e4 460GX - 84460GX Memory Data Controller (MDC) + 84e6 460GX - 82466GX Wide and fast PCI eXpander Bridge (WXB) + 84ea 460GX - 84460GX AGP Bridge (GXB function 1) + 9621 Integrated RAID + 9622 Integrated RAID + 9641 Integrated RAID + 96a1 Integrated RAID + b152 21152 PCI-to-PCI Bridge +# observed, and documented in Intel revision note; new mask of 1011:0026 + b154 21154 PCI-to-PCI Bridge + b555 21555 Non transparent PCI-to-PCI Bridge + e4bf 1000 CC8-1-BLUES + ffff 450NX/GX [Orion] - 82453KX/GX Memory controller [BUG] +8800 Trigem Computer Inc. + 2008 Video assistent component +8866 T-Square Design Inc. +8888 Silicon Magic +8e0e Computone Corporation +8e2e KTI + 3000 ET32P2 +9004 Adaptec + 1078 AIC-7810 + 1160 AIC-1160 [Family Fibre Channel Adapter] + 2178 AIC-7821 + 3860 AHA-2930CU + 3b78 AHA-4844W/4844UW + 5075 AIC-755x + 5078 AHA-7850 + 9004 7850 AHA-2904/Integrated AIC-7850 + 5175 AIC-755x + 5178 AIC-7851 + 5275 AIC-755x + 5278 AIC-7852 + 5375 AIC-755x + 5378 AIC-7850 + 5475 AIC-755x + 5478 AIC-7850 + 5575 AVA-2930 + 5578 AIC-7855 + 5647 ANA-7711 TCP Offload Engine + 9004 7710 ANA-7711F TCP Offload Engine - Optical + 9004 7711 ANA-7711LP TCP Offload Engine - Copper + 5675 AIC-755x + 5678 AIC-7856 + 5775 AIC-755x + 5778 AIC-7850 + 5800 AIC-5800 + 5900 ANA-5910/5930/5940 ATM155 & 25 LAN Adapter + 5905 ANA-5910A/5930A/5940A ATM Adapter + 6038 AIC-3860 + 6075 AIC-1480 / APA-1480 + 9004 7560 AIC-1480 / APA-1480 Cardbus + 6078 AIC-7860 + 6178 AIC-7861 + 9004 7861 AHA-2940AU Single + 6278 AIC-7860 + 6378 AIC-7860 + 6478 AIC-786x + 6578 AIC-786x + 6678 AIC-786x + 6778 AIC-786x + 6915 ANA620xx/ANA69011A + 9004 0008 ANA69011A/TX 10/100 + 9004 0009 ANA69011A/TX 10/100 + 9004 0010 ANA62022 2-port 10/100 + 9004 0018 ANA62044 4-port 10/100 + 9004 0019 ANA62044 4-port 10/100 + 9004 0020 ANA62022 2-port 10/100 + 9004 0028 ANA69011A/TX 10/100 + 9004 8008 ANA69011A/TX 64 bit 10/100 + 9004 8009 ANA69011A/TX 64 bit 10/100 + 9004 8010 ANA62022 2-port 64 bit 10/100 + 9004 8018 ANA62044 4-port 64 bit 10/100 + 9004 8019 ANA62044 4-port 64 bit 10/100 + 9004 8020 ANA62022 2-port 64 bit 10/100 + 9004 8028 ANA69011A/TX 64 bit 10/100 + 7078 AHA-294x / AIC-7870 + 7178 AHA-2940/2940W / AIC-7871 + 7278 AHA-3940/3940W / AIC-7872 + 7378 AHA-3985 / AIC-7873 + 7478 AHA-2944/2944W / AIC-7874 + 7578 AHA-3944/3944W / AIC-7875 + 7678 AHA-4944W/UW / AIC-7876 + 7778 AIC-787x + 7810 AIC-7810 + 7815 AIC-7815 RAID+Memory Controller IC + 9004 7815 ARO-1130U2 RAID Controller + 9004 7840 AIC-7815 RAID+Memory Controller IC + 7850 AIC-7850 + 7855 AHA-2930 + 7860 AIC-7860 + 7870 AIC-7870 + 7871 AHA-2940 + 7872 AHA-3940 + 7873 AHA-3980 + 7874 AHA-2944 + 7880 AIC-7880P + 7890 AIC-7890 + 7891 AIC-789x + 7892 AIC-789x + 7893 AIC-789x + 7894 AIC-789x + 7895 AHA-2940U/UW / AHA-39xx / AIC-7895 + 9004 7890 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B + 9004 7891 AHA-2940U/2940UW Dual + 9004 7892 AHA-3940AU/AUW/AUWD/UWD + 9004 7894 AHA-3944AUWD + 9004 7895 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B + 9004 7896 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B + 9004 7897 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B + 7896 AIC-789x + 7897 AIC-789x + 8078 AIC-7880U + 9004 7880 AIC-7880P Ultra/Ultra Wide SCSI Chipset + 8178 AHA-2940U/UW/D / AIC-7881U + 9004 7881 AHA-2940UW SCSI Host Adapter + 8278 AHA-3940U/UW/UWD / AIC-7882U + 8378 AHA-3940U/UW / AIC-7883U + 8478 AHA-2944UW / AIC-7884U + 8578 AHA-3944U/UWD / AIC-7885 + 8678 AHA-4944UW / AIC-7886 + 8778 AHA-2940UW Pro / AIC-788x + 9004 7887 2940UW Pro Ultra-Wide SCSI Controller + 8878 AHA-2930UW / AIC-7888 + 9004 7888 AHA-2930UW SCSI Controller + 8b78 ABA-1030 + ec78 AHA-4944W/UW +9005 Adaptec + 0010 AHA-2940U2/U2W + 9005 2180 AHA-2940U2 SCSI Controller + 9005 8100 AHA-2940U2B SCSI Controller + 9005 a180 AHA-2940U2W SCSI Controller + 9005 e100 AHA-2950U2B SCSI Controller + 0011 AHA-2930U2 + 0013 78902 + 9005 0003 AAA-131U2 Array1000 1 Channel RAID Controller + 001f AHA-2940U2/U2W / 7890/7891 + 9005 000f 2940U2W SCSI Controller + 9005 a180 2940U2W SCSI Controller + 0020 AIC-7890 + 002f AIC-7890 + 0030 AIC-7890 + 003f AIC-7890 + 0050 AHA-3940U2x/395U2x + 9005 f500 AHA-3950U2B + 0051 AHA-3950U2D + 9005 b500 AHA-3950U2D + 0053 AIC-7896 SCSI Controller + 9005 ffff AIC-7896 SCSI Controller mainboard implementation + 005f AIC-7896U2/7897U2 + 0080 AIC-7892A U160/m + 0e11 e2a0 Compaq 64-Bit/66MHz Wide Ultra3 SCSI Adapter + 9005 62a0 29160N Ultra160 SCSI Controller + 9005 e220 29160LP Low Profile Ultra160 SCSI Controller + 9005 e2a0 29160 Ultra160 SCSI Controller + 0081 AIC-7892B U160/m + 9005 62a1 19160 Ultra160 SCSI Controller + 0083 AIC-7892D U160/m + 008f AIC-7892P U160/m + 1179 0001 Magnia Z310 + 15d9 9005 Onboard SCSI Host Adapter + 00c0 AHA-3960D / AIC-7899A U160/m + 0e11 f620 Compaq 64-Bit/66MHz Dual Channel Wide Ultra3 SCSI Adapter + 9005 f620 AHA-3960D U160/m + 00c1 AIC-7899B U160/m + 00c3 AIC-7899D U160/m + 00c5 RAID subsystem HBA + 1028 00c5 PowerEdge 2550 + 00cf AIC-7899P U160/m + 1028 00d1 PowerEdge 2550 + 10f1 2462 Thunder K7 S2462 + 15d9 9005 Onboard SCSI Host Adapter + 0250 ServeRAID Controller + 1014 0279 ServeRAID-xx + 1014 028c ServeRAID-xx + 0285 AAC-RAID + 1028 0287 PowerEdge Expandable RAID Controller 320/DC + 8000 ASC-29320A U320 + 800f AIC-7901 U320 + 8010 ASC-39320 U320 + 8011 ASC-32320D U320 + 0e11 00ac U320 + 9005 0041 ASC-39320D U320 + 8012 ASC-29320 U320 + 8013 ASC-29320B U320 + 8014 ASC-29320LP U320 + 801e AIC-7901A U320 + 801f AIC-7902 U320 + 8090 ASC-39320 U320 w/HostRAID + 8091 ASC-39320D U320 w/HostRAID + 8092 ASC-29320 U320 w/HostRAID + 8093 ASC-29320B U320 w/HostRAID + 8094 ASC-29320LP U320 w/HostRAID + 809e AIC-7901A U320 w/HostRAID + 809f AIC-7902 U320 w/HostRAID +907f Atronics + 2015 IDE-2015PL +919a Gigapixel Corp +9412 Holtek + 6565 6565 +9699 Omni Media Technology Inc + 6565 6565 +9710 NetMos Technology + 9815 VScom 021H-EP2 2 port parallel adaptor + 9835 222N-2 I/O Card (2S+1P) +a0a0 AOPEN Inc. +a0f1 UNISYS Corporation +a200 NEC Corporation +a259 Hewlett Packard +a25b Hewlett Packard GmbH PL24-MKT +a304 Sony +a727 3Com Corporation +aa42 Scitex Digital Video +ac1e Digital Receiver Technology Inc +b1b3 Shiva Europe Limited +# Pinnacle should be 11bd, but they got it wrong several times --mj +bd11 Pinnacle Systems, Inc. (Wrong ID) +c001 TSI Telsys +c0a9 Micron/Crucial Technology +c0de Motorola +c0fe Motion Engineering, Inc. +ca50 Varian Australia Pty Ltd +cafe Chrysalis-ITS +cccc Catapult Communications +cddd Tyzx, Inc. + 0101 DeepSea 1 High Speed Stereo Vision Frame Grabber + 0200 DeepSea 2 High Speed Stereo Vision Frame Grabber +d4d4 Dy4 Systems Inc + 0601 PCI Mezzanine Card +d531 I+ME ACTIA GmbH +d84d Exsys +dead Indigita Corporation +e000 Winbond + e000 W89C940 +e159 Tiger Jet Network Inc. + 0001 Intel 537 + 0059 0001 128k ISDN-S/T Adapter + 0059 0003 128k ISDN-U Adapter + 0002 Tiger100APC ISDN chipset +e4bf EKF Elektronik GmbH +ea01 Eagle Technology +# The main chip of all these devices is by Xilinx -> It could also be a Xilinx ID. +ea60 RME + 9896 Digi32 + 9897 Digi32 Pro + 9898 Digi32/8 +eabb Aashima Technology B.V. +eace Endace Measurement Systems, Ltd + 3100 DAG 3.10 OC-3/OC-12 + 3200 DAG 3.2x OC-3/OC-12 + 320e DAG 3.2E Fast Ethernet + 340e DAG 3.4E Fast Ethernet + 341e DAG 3.41E Fast Ethernet + 3500 DAG 3.5 OC-3/OC-12 + 351c DAG 3.5ECM Fast Ethernet + 4100 DAG 4.10 OC-48 + 4110 DAG 4.11 OC-48 + 4220 DAG 4.2 OC-48 + 422e DAG 4.2E Dual Gigabit Ethernet +ec80 Belkin Corporation + ec00 F5D6000 +ecc0 Echo Digital Audio Corporation + 0050 Gina24_301 + 0051 Gina24_361 + 0060 Layla24 + 0070 Mona_301_80 + 0071 Mona_301_66 + 0072 Mona_361 + 0080 Mia +edd8 ARK Logic Inc + a091 1000PV [Stingray] + a099 2000PV [Stingray] + a0a1 2000MT + a0a9 2000MI +f1d0 AJA Video +# All boards I have seen have this ID not efac, though all docs say efac... + cafe KONA SD SMPTE 259M I/O + efac KONA SD SMPTE 259M I/O + facd KONA HD SMPTE 292M I/O +fa57 Fast Search & Transfer ASA +febd Ultraview Corp. +feda Broadcom Inc (nee Epigram) + a0fa BCM4210 iLine10 HomePNA 2.0 + a10e BCM4230 iLine10 HomePNA 2.0 +fffe VMWare Inc + 0710 Virtual SVGA +ffff Illegal Vendor ID + + +# List of known device classes, subclasses and programming interfaces + +# Syntax: +# C class class_name +# subclass subclass_name <-- single tab +# prog-if prog-if_name <-- two tabs + +C 00 Unclassified device + 00 Non-VGA unclassified device + 01 VGA compatible unclassified device +C 01 Mass storage controller + 00 SCSI storage controller + 01 IDE interface + 02 Floppy disk controller + 03 IPI bus controller + 04 RAID bus controller + 80 Unknown mass storage controller +C 02 Network controller + 00 Ethernet controller + 01 Token ring network controller + 02 FDDI network controller + 03 ATM network controller + 04 ISDN controller + 80 Network controller +C 03 Display controller + 00 VGA compatible controller + 00 VGA + 01 8514 + 01 XGA compatible controller + 02 3D controller + 80 Display controller +C 04 Multimedia controller + 00 Multimedia video controller + 01 Multimedia audio controller + 02 Computer telephony device + 80 Multimedia controller +C 05 Memory controller + 00 RAM memory + 01 FLASH memory + 80 Memory controller +C 06 Bridge + 00 Host bridge + 01 ISA bridge + 02 EISA bridge + 03 MicroChannel bridge + 04 PCI bridge + 00 Normal decode + 01 Subtractive decode + 05 PCMCIA bridge + 06 NuBus bridge + 07 CardBus bridge + 08 RACEway bridge + 00 Transparent mode + 01 Endpoint mode + 09 Semi-transparent PCI-to-PCI bridge + 40 Primary bus towards host CPU + 80 Secondary bus towards host CPU + 0a InfiniBand to PCI host bridge + 80 Bridge +C 07 Communication controller + 00 Serial controller + 00 8250 + 01 16450 + 02 16550 + 03 16650 + 04 16750 + 05 16850 + 06 16950 + 01 Parallel controller + 00 SPP + 01 BiDir + 02 ECP + 03 IEEE1284 + fe IEEE1284 Target + 02 Multiport serial controller + 03 Modem + 00 Generic + 01 Hayes/16450 + 02 Hayes/16550 + 03 Hayes/16650 + 04 Hayes/16750 + 80 Communication controller +C 08 Generic system peripheral + 00 PIC + 00 8259 + 01 ISA PIC + 02 EISA PIC + 10 IO-APIC + 20 IO(X)-APIC + 01 DMA controller + 00 8237 + 01 ISA DMA + 02 EISA DMA + 02 Timer + 00 8254 + 01 ISA Timer + 02 EISA Timers + 03 RTC + 00 Generic + 01 ISA RTC + 04 PCI Hot-plug controller + 80 System peripheral +C 09 Input device controller + 00 Keyboard controller + 01 Digitizer Pen + 02 Mouse controller + 03 Scanner controller + 04 Gameport controller + 00 Generic + 10 Extended + 80 Input device controller +C 0a Docking station + 00 Generic Docking Station + 80 Docking Station +C 0b Processor + 00 386 + 01 486 + 02 Pentium + 10 Alpha + 20 Power PC + 30 MIPS + 40 Co-processor +C 0c Serial bus controller + 00 FireWire (IEEE 1394) + 00 Generic + 10 OHCI + 01 ACCESS Bus + 02 SSA + 03 USB Controller + 00 UHCI + 10 OHCI + 20 EHCI + 80 Unspecified + fe USB Device + 04 Fibre Channel + 05 SMBus + 06 InfiniBand +C 0d Wireless controller + 00 IRDA controller + 01 Consumer IR controller + 10 RF controller + 80 Wireless controller +C 0e Intelligent controller + 00 I2O +C 0f Satellite communications controller + 00 Satellite TV controller + 01 Satellite audio communication controller + 03 Satellite voice communication controller + 04 Satellite data communication controller +C 10 Encryption controller + 00 Network and computing encryption device + 10 Entertainment encryption device + 80 Encryption controller +C 11 Signal processing controller + 00 DPIO module + 01 Performance counters + 10 Communication synchronizer + 80 Signal processing controller Index: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c diff -u xc/programs/Xserver/hw/xfree86/etc/pcitweak.c:1.15 xc/programs/Xserver/hw/xfree86/etc/pcitweak.c:1.16 --- xc/programs/Xserver/hw/xfree86/etc/pcitweak.c:1.15 Sat Jan 6 15:19:12 2001 +++ xc/programs/Xserver/hw/xfree86/etc/pcitweak.c Fri Dec 13 23:41:13 2002 @@ -5,7 +5,7 @@ * * Author: David Dawes <dawes@xfree86.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.15 2001/01/06 20:19:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.16 2002/12/14 04:41:13 dawes Exp $ */ #include "X.h" #include "os.h" @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) { - char c; + int c; PCITAG tag; int bus, device, func; Bool list = FALSE, rd = FALSE, wr = FALSE; Index: xc/programs/Xserver/hw/xfree86/etc/scanpci.c diff -u xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.83 xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.92 --- xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.83 Fri Jan 4 17:28:06 2002 +++ xc/programs/Xserver/hw/xfree86/etc/scanpci.c Thu Feb 13 07:17:14 2003 @@ -1,5 +1,7 @@ -/* Copyright 2000 by Egbert Eich +/* + * Copyright 2000 by Egbert Eich * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org> + * Copyright 2002 by David Dawes * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.83 2002/01/04 22:28:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.92 2003/02/13 12:17:14 tsi Exp $ */ #include "X.h" #include "os.h" @@ -29,8 +31,8 @@ #include "xf86Priv.h" #include "xf86_OSproc.h" #include "xf86Pci.h" -#include "xf86ScanPci.h" #include "xf86PciInfo.h" +#include "xf86ScanPci.h" #include "dummylib.h" #include <stdarg.h> @@ -56,9 +58,14 @@ static void print_bridge_pci_class(pciConfigPtr pcr); static void print_mach64(pciConfigPtr pcr); static void print_i128(pciConfigPtr pcr); -static void print_pcibridge(pciConfigPtr pcr); -static void print_apb(pciConfigPtr pcr); +static void print_dc21050(pciConfigPtr pcr); +static void print_simba(pciConfigPtr pcr); +static void print_460gx_sac(pciConfigPtr pcr); +static void print_460gx_pxb(pciConfigPtr pcr); +static void print_460gx_gxb(pciConfigPtr pcr); +#define MAX_DEV_PER_VENDOR 40 + typedef struct { unsigned int Vendor; struct { @@ -105,7 +112,7 @@ { PCI_CHIP_MACH64VV, print_mach64 }, { 0x0000, NULL } } }, { PCI_VENDOR_DIGITAL, { - { PCI_CHIP_DC21050, print_pcibridge}, + { PCI_CHIP_DC21050, print_dc21050}, { 0x0000, NULL } } }, { PCI_VENDOR_NUMNINE, { { PCI_CHIP_I128, print_i128 }, @@ -114,7 +121,13 @@ { PCI_CHIP_I128_T2R4, print_i128 }, { 0x0000, NULL } } }, { PCI_VENDOR_SUN, { - { PCI_CHIP_SIMBA, print_apb }, + { PCI_CHIP_SIMBA, print_simba }, + { 0x0000, NULL } } }, + { PCI_VENDOR_INTEL, { + { PCI_CHIP_460GX_SAC, print_460gx_sac }, + { PCI_CHIP_460GX_PXB, print_460gx_pxb }, + { PCI_CHIP_460GX_GXB_1, print_460gx_gxb }, + { PCI_CHIP_460GX_WXB, print_460gx_pxb }, /* Uncertain */ { 0x0000, NULL } } }, { 0x0000, { { 0x0000, NULL } } } @@ -127,7 +140,7 @@ printf(" -v print config space\n"); printf(" -1 config type 1\n"); printf(" -2 config type 2\n"); - printf(" -O use OS config support\n"); + printf(" -O use OS config support\n"); printf(" -f force config type\n"); printf(" -V set message verbosity level\n"); } @@ -139,11 +152,11 @@ int Verbose = 0; int i = 0; int force = 0; - char c; - + int c; + xf86Info.pciFlags = PCIProbe1; - while ((c = getopt(argc, argv, "?v12OfV:")) != -1) + while ((c = getopt(argc, argv, "?v12OfV:")) != -1) switch(c) { case 'v': Verbose = 1; @@ -181,58 +194,52 @@ default: break; } - + xf86EnableIO(); - pcrpp = xf86scanpci(0); - xf86DisableIO(); + pcrpp = xf86scanpci(0); if (!pcrpp) { printf("No PCI devices found\n"); + xf86DisableIO(); exit (1); } - + while (pcrpp[i]) identify_card(pcrpp[i++],Verbose); + xf86DisableIO(); exit(0); } static void identify_card(pciConfigPtr pcr, int verbose) { - - int i, j; + int i, j; int foundit = 0; int foundvendor = 0; + const char *vname, *dname, *svname, *sname; - SymTabRec *pvnd; - pciVendorDeviceInfo *pvd; pciVendorDevFuncInfo *vdf = vendorDeviceFuncInfo; - pciVendorCardInfo *pvc; - - xf86SetupScanPci(&pvnd,&pvd,&pvc); - + + if (!ScanPciSetupPciIds()) { + fprintf(stderr, "xf86SetupPciIds() failed\n"); + exit(1); + } + printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:" " vendor 0x%04x device 0x%04x\n", pcr->busnum, pcr->devnum, pcr->funcnum, pcr->pci_vendor, pcr->pci_device); - - for (i = 0; pvnd[i].name; i++) { - if (pvnd[i].token == pcr->pci_vendor) { - printf(" %s ", pvnd[i].name); - break; - } - } - for (i = 0; pvd[i].VendorID && pvd[i].VendorID != pcr->pci_vendor; i++) - ; - if (pvd[i].VendorID) { - for (j = 0; pvd[i].Device[j].DeviceName; j++) { - if (pvd[i].Device[j].DeviceID == pcr->pci_device) { - printf("%s", pvd[i].Device[j].DeviceName); - foundit = 1; - break; - } + ScanPciFindPciNamesByDevice(pcr->pci_vendor, pcr->pci_device, + pcr->pci_subsys_vendor, pcr->pci_subsys_card, + &vname, &dname, &svname, &sname); + + if (vname) { + printf(" %s ", vname); + if (dname) { + printf("%s", dname); + foundit = 1; } } @@ -256,33 +263,23 @@ } if (verbose && !(pcr->pci_header_type & 0x7f) && - (pcr->pci_subsys_vendor != 0 || pcr->pci_subsys_card != 0)) { - foundit = 0; - foundvendor = 0; + (pcr->pci_subsys_vendor != 0 || pcr->pci_subsys_card != 0) && + (pcr->pci_vendor != pcr->pci_subsys_vendor || + pcr->pci_device != pcr->pci_subsys_card)) { + foundit = 0; + foundvendor = 0; printf(" CardVendor 0x%04x card 0x%04x", pcr->pci_subsys_vendor, pcr->pci_subsys_card); - for (i = 0; pvnd[i].name; i++) { - if (pvnd[i].token == pcr->pci_subsys_vendor) { - printf(" (%s", pvnd[i].name); - foundvendor = 1; - break; + if (svname) { + printf(" (%s", svname); + foundvendor = 1; + if (sname) { + printf(" %s)", sname); + foundit = 1; } - } + } - for (i = 0; - pvc[i].VendorID && pvc[i].VendorID != pcr->pci_subsys_vendor; - i++) - ; - if (pvc[i].VendorID) { - for (j = 0; pvc[i].Device[j].CardName; j++) { - if (pvc[i].Device[j].SubsystemID == pcr->pci_subsys_card) { - printf(" %s)", pvc[i].Device[j].CardName); - foundit = 1; - break; - } - } - } - if (!foundit) { + if (!foundit) { if (!foundvendor) printf(" ("); else @@ -293,13 +290,11 @@ } if (verbose) { - if (pcr->pci_status_command) - printf(" STATUS 0x%04x COMMAND 0x%04x\n", - pcr->pci_status, pcr->pci_command); - if (pcr->pci_class_revision) - printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, - pcr->pci_rev_id); + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); if ((pcr->pci_base_class == PCI_CLASS_BRIDGE) && (pcr->pci_sub_class == PCI_SUBCLASS_BRIDGE_PCI)) print_bridge_pci_class(pcr); @@ -311,72 +306,116 @@ static void print_default_class(pciConfigPtr pcr) { - if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x" - " LATENCY 0x%02x CACHE 0x%02x\n", - pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, - pcr->pci_cache_line_size); - if (pcr->pci_base0) - printf(" BASE0 0x%08x addr 0x%08x %s%s%s\n", - (int)pcr->pci_base0,(int)(pcr->pci_base0 - & (pcr->pci_base0 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0)), - pcr->pci_base0 & 0x1 ? "I/O" : "MEM", - ((pcr->pci_base0 & 0x9) == 0x8) ? " PREFETCHABLE" :"", - ((pcr->pci_base0 & 0x7) == 0x4) ? " 64BIT" : ""); - if (pcr->pci_base1) - printf(" BASE1 0x%08x addr 0x%08x %s%s%s\n", - (int)pcr->pci_base1, (int)(pcr->pci_base1 - & (pcr->pci_base1 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0)), - pcr->pci_base1 & 0x1 ? "I/O" : "MEM", - ((pcr->pci_base1 & 0x9) == 0x8) ? " PREFETCHABLE" :"", - ((pcr->pci_base1 & 0x7) == 0x4) ? " 64BIT" : ""); - if (pcr->pci_base2) - printf(" BASE2 0x%08x addr 0x%08x %s%s%s\n", - (int)pcr->pci_base2, (int)(pcr->pci_base2 - & (pcr->pci_base2 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0)), - pcr->pci_base2 & 0x1 ? "I/O" : "MEM", - ((pcr->pci_base2 & 0x9) == 0x8) ? " PREFETCHABLE" :"", - ((pcr->pci_base2 & 0x7) == 0x4) ? " 64BIT" : ""); - if (pcr->pci_base3) - printf(" BASE3 0x%08x addr 0x%08x %s%s%s\n", - (int)pcr->pci_base3, (int)(pcr->pci_base3 - & (pcr->pci_base3 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0)), - pcr->pci_base3 & 0x1 ? "I/O" : "MEM", - ((pcr->pci_base3 & 0x9) == 0x8) ? " PREFETCHABLE" :"", - ((pcr->pci_base3 & 0x7) == 0x4) ? " 64BIT" : ""); - if (pcr->pci_base4) - printf(" BASE4 0x%08x addr 0x%08x %s%s%s\n", - (int)pcr->pci_base4, (int)(pcr->pci_base4 - & (pcr->pci_base4 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0)), - pcr->pci_base4 & 0x1 ? "I/O" : "MEM", - ((pcr->pci_base4 & 0x9) == 0x8) ? " PREFETCHABLE" :"", - ((pcr->pci_base4 & 0x7) == 0x4) ? " 64BIT" : ""); - if (pcr->pci_base5) + printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, + pcr->pci_cache_line_size); + if (pcr->pci_base0) { + if ((pcr->pci_base0 & 0x7) == 0x4) { + printf(" BASE0 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n", + (int)pcr->pci_base1, (int)pcr->pci_base0, + (int)pcr->pci_base1, + (int)(pcr->pci_base0 & + (pcr->pci_base0 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base0 & 0x8) ? " PREFETCHABLE" :""); + } else { + printf(" BASE0 0x%08x addr 0x%08x %s%s\n", + (int)pcr->pci_base0, + (int)(pcr->pci_base0 & + (pcr->pci_base0 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base0 & 0x1) ? "I/O" : "MEM", + ((pcr->pci_base0 & 0x9) == 0x8) ? " PREFETCHABLE" :""); + } + } + if ((pcr->pci_base1) && ((pcr->pci_base0 & 0x7) != 0x4)) { + if ((pcr->pci_base1 & 0x7) == 0x4) { + printf(" BASE1 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n", + (int)pcr->pci_base2, (int)pcr->pci_base1, + (int)pcr->pci_base2, + (int)(pcr->pci_base1 & + (pcr->pci_base1 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base1 & 0x8) ? " PREFETCHABLE" :""); + } else { + printf(" BASE1 0x%08x addr 0x%08x %s%s\n", + (int)pcr->pci_base1, + (int)(pcr->pci_base1 & + (pcr->pci_base1 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base1 & 0x1) ? "I/O" : "MEM", + ((pcr->pci_base1 & 0x9) == 0x8) ? " PREFETCHABLE" :""); + } + } + if ((pcr->pci_base2) && ((pcr->pci_base1 & 0x7) != 0x4)) { + if ((pcr->pci_base2 & 0x7) == 0x4) { + printf(" BASE2 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n", + (int)pcr->pci_base3, (int)pcr->pci_base2, + (int)pcr->pci_base3, + (int)(pcr->pci_base2 & + (pcr->pci_base2 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base2 & 0x8) ? " PREFETCHABLE" :""); + } else { + printf(" BASE2 0x%08x addr 0x%08x %s%s\n", + (int)pcr->pci_base2, + (int)(pcr->pci_base2 & + (pcr->pci_base2 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base2 & 0x1) ? "I/O" : "MEM", + ((pcr->pci_base2 & 0x9) == 0x8) ? " PREFETCHABLE" :""); + } + } + if ((pcr->pci_base3) && ((pcr->pci_base2 & 0x7) != 0x4)) { + if ((pcr->pci_base3 & 0x7) == 0x4) { + printf(" BASE3 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n", + (int)pcr->pci_base4, (int)pcr->pci_base3, + (int)pcr->pci_base4, + (int)(pcr->pci_base3 & + (pcr->pci_base3 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base3 & 0x8) ? " PREFETCHABLE" :""); + } else { + printf(" BASE3 0x%08x addr 0x%08x %s%s\n", + (int)pcr->pci_base3, + (int)(pcr->pci_base3 & + (pcr->pci_base3 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base3 & 0x1) ? "I/O" : "MEM", + ((pcr->pci_base3 & 0x9) == 0x8) ? " PREFETCHABLE" :""); + } + } + if ((pcr->pci_base4) && ((pcr->pci_base3 & 0x7) != 0x4)) { + if ((pcr->pci_base4 & 0x7) == 0x4) { + printf(" BASE4 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n", + (int)pcr->pci_base5, (int)pcr->pci_base4, + (int)pcr->pci_base5, + (int)(pcr->pci_base4 & + (pcr->pci_base4 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base4 & 0x8) ? " PREFETCHABLE" :""); + } else { + printf(" BASE4 0x%08x addr 0x%08x %s%s\n", + (int)pcr->pci_base4, + (int)(pcr->pci_base4 & + (pcr->pci_base4 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base4 & 0x1) ? "I/O" : "MEM", + ((pcr->pci_base4 & 0x9) == 0x8) ? " PREFETCHABLE" :""); + } + } + if ((pcr->pci_base5) && ((pcr->pci_base4 & 0x7) != 0x4)) { printf(" BASE5 0x%08x addr 0x%08x %s%s%s\n", - (int)pcr->pci_base5, (int)(pcr->pci_base5 - & (pcr->pci_base5 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0)), - pcr->pci_base5 & 0x1 ? "I/O" : "MEM", + (int)pcr->pci_base5, + (int)(pcr->pci_base5 & + (pcr->pci_base5 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)), + (pcr->pci_base5 & 0x1) ? "I/O" : "MEM", ((pcr->pci_base5 & 0x9) == 0x8) ? " PREFETCHABLE" :"", ((pcr->pci_base5 & 0x7) == 0x4) ? " 64BIT" : ""); + } if (pcr->pci_baserom) printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n", (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" - " INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, pcr->pci_int_pin, pcr->pci_int_line); if (pcr->pci_user_config) printf(" BYTE_0 0x%02x BYTE_1 0x%02x" - " BYTE_2 0x%02x BYTE_3 0x%02x\n", - (int)pcr->pci_user_config_0, (int)pcr->pci_user_config_1, + " BYTE_2 0x%02x BYTE_3 0x%02x\n", + (int)pcr->pci_user_config_0, (int)pcr->pci_user_config_1, (int)pcr->pci_user_config_2, (int)pcr->pci_user_config_3); } @@ -391,20 +430,50 @@ static void print_bridge_pci_class(pciConfigPtr pcr) { - if (pcr->pci_bist_header_latency_cache) - printf(" HEADER 0x%02x LATENCY 0x%02x\n", - pcr->pci_header_type, pcr->pci_latency_timer); - printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n", - pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, - pcr->pci_subordinate_bus_number, pcr->pci_secondary_latency_timer); - printf(" IOBASE 0x%02x IOLIM 0x%02x SECSTATUS 0x%04x\n", - pcr->pci_io_base << 8, (pcr->pci_io_limit << 8) | 0xfff, - pcr->pci_secondary_status); - printf(" NOPREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n", - pcr->pci_mem_base << 16, (pcr->pci_mem_limit << 16) | 0xfffff); - printf(" PREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n", - pcr->pci_prefetch_mem_base << 16, - (pcr->pci_prefetch_mem_limit << 16) | 0xfffff); + printf(" HEADER 0x%02x LATENCY 0x%02x\n", + pcr->pci_header_type, pcr->pci_latency_timer); + printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x\n", + pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, + pcr->pci_subordinate_bus_number); + printf(" SECLT 0x%02x SECSTATUS 0x%04x\n", + pcr->pci_secondary_latency_timer, pcr->pci_secondary_status); + + if (pcr->pci_io_base || pcr->pci_io_limit || + pcr->pci_upper_io_base || pcr->pci_upper_io_limit) { + if (((pcr->pci_io_base & 0x0f) == 0x01) || + ((pcr->pci_io_limit & 0x0f) == 0x01)) { + printf(" IOBASE 0x%04x%04x IOLIM 0x%04x%04x\n", + pcr->pci_upper_io_base, (pcr->pci_io_base & 0x00f0) << 8, + pcr->pci_upper_io_limit, (pcr->pci_io_limit << 8) | 0x0fff); + } else { + printf(" IOBASE 0x%04x IOLIM 0x%04x\n", + (pcr->pci_io_base & 0x00f0) << 8, + (pcr->pci_io_limit << 8) | 0x0fff); + } + } + + if (pcr->pci_mem_base || pcr->pci_mem_limit) + printf(" NOPREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n", + (pcr->pci_mem_base & 0x00fff0) << 16, + (pcr->pci_mem_limit << 16) | 0x0fffff); + + if (pcr->pci_prefetch_mem_base || pcr->pci_prefetch_mem_limit || + pcr->pci_prefetch_upper_mem_base || + pcr->pci_prefetch_upper_mem_limit) { + if (((pcr->pci_prefetch_mem_base & 0x0f) == 0x01) || + ((pcr->pci_prefetch_mem_limit & 0x0f) == 0x01)) { + printf(" PREFETCH_MEMBASE 0x%08x%08x MEMLIM 0x%08x%08x\n", + (int)pcr->pci_prefetch_upper_mem_base, + (pcr->pci_prefetch_mem_base & 0x00fff0) << 16, + (int)pcr->pci_prefetch_upper_mem_limit, + (pcr->pci_prefetch_mem_limit << 16) | 0x0fffff); + } else { + printf(" PREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n", + (pcr->pci_prefetch_mem_base & 0x00fff0) << 16, + (pcr->pci_prefetch_mem_limit << 16) | 0x0fffff); + } + } + printf(" %sFAST_B2B %sSEC_BUS_RST %sM_ABRT %sVGA_EN %sISA_EN" " %sSERR_EN %sPERR_EN\n", (pcr->pci_bridge_control & PCI_B_FAST_B_B) ? "" : "NO_", @@ -422,43 +491,36 @@ CARD32 sparse_io = 0; printf(" CardVendor 0x%04x card 0x%04x\n", - pcr->pci_subsys_vendor, pcr->pci_subsys_card); - if (pcr->pci_status_command) - printf(" STATUS 0x%04x COMMAND 0x%04x\n", - pcr->pci_status, pcr->pci_command); - if (pcr->pci_class_revision) - printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, - pcr->pci_prog_if, pcr->pci_rev_id); - if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x" - " LATENCY 0x%02x CACHE 0x%02x\n", - pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, - pcr->pci_cache_line_size); + pcr->pci_subsys_vendor, pcr->pci_subsys_card); + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, + pcr->pci_prog_if, pcr->pci_rev_id); + printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, + pcr->pci_cache_line_size); if (pcr->pci_base0) - printf(" APBASE 0x%08x addr 0x%08x\n", - (int)pcr->pci_base0, (int)(pcr->pci_base0 - & (pcr->pci_base0 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0))); + printf(" APBASE 0x%08x addr 0x%08x\n", + (int)pcr->pci_base0, (int)(pcr->pci_base0 & + (pcr->pci_base0 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0))); if (pcr->pci_base1) - printf(" BLOCKIO 0x%08x addr 0x%08x\n", - (int)pcr->pci_base1, (int)(pcr->pci_base1 - & (pcr->pci_base1 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0))); + printf(" BLOCKIO 0x%08x addr 0x%08x\n", + (int)pcr->pci_base1, (int)(pcr->pci_base1 & + (pcr->pci_base1 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0))); if (pcr->pci_base2) - printf(" REGBASE 0x%08x addr 0x%08x\n", - (int)pcr->pci_base2, (int)(pcr->pci_base2 - & (pcr->pci_base2 & 0x1 ? - 0xFFFFFFFC : 0xFFFFFFF0))); + printf(" REGBASE 0x%08x addr 0x%08x\n", + (int)pcr->pci_base2, (int)(pcr->pci_base2 & + (pcr->pci_base2 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0))); if (pcr->pci_baserom) - printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n", + printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n", (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), - pcr->pci_baserom & 0x1 ? "" : "not-"); + pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" - " INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, - pcr->pci_int_pin, pcr->pci_int_line); + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, + pcr->pci_int_pin, pcr->pci_int_line); switch (pcr->pci_user_config_0 & 0x03) { case 0: sparse_io = 0x2ec; @@ -471,68 +533,60 @@ break; } printf(" SPARSEIO 0x%03x %s IO enabled %sable 0x46E8\n", - (int)sparse_io, pcr->pci_user_config_0 & 0x04 ? "Block" : "Sparse", - pcr->pci_user_config_0 & 0x08 ? "Dis" : "En"); + (int)sparse_io, pcr->pci_user_config_0 & 0x04 ? "Block" : "Sparse", + pcr->pci_user_config_0 & 0x08 ? "Dis" : "En"); } static void print_i128(pciConfigPtr pcr) { printf(" CardVendor 0x%04x card 0x%04x\n", - pcr->pci_subsys_vendor, pcr->pci_subsys_card); - if (pcr->pci_status_command) - printf(" STATUS 0x%04x COMMAND 0x%04x\n", - pcr->pci_status, pcr->pci_command); - if (pcr->pci_class_revision) - printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, - pcr->pci_rev_id); - if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x" - " LATENCY 0x%02x CACHE 0x%02x\n", - pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, - pcr->pci_cache_line_size); + pcr->pci_subsys_vendor, pcr->pci_subsys_card); + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); + printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, + pcr->pci_cache_line_size); printf(" MW0_AD 0x%08x addr 0x%08x %spre-fetchable\n", - (int)pcr->pci_base0, (int)(pcr->pci_base0 & 0xFFC00000), - pcr->pci_base0 & 0x8 ? "" : "not-"); + (int)pcr->pci_base0, (int)(pcr->pci_base0 & 0xFFC00000), + pcr->pci_base0 & 0x8 ? "" : "not-"); printf(" MW1_AD 0x%08x addr 0x%08x %spre-fetchable\n", - (int)pcr->pci_base1, (int)(pcr->pci_base1 & 0xFFC00000), - pcr->pci_base1 & 0x8 ? "" : "not-"); + (int)pcr->pci_base1, (int)(pcr->pci_base1 & 0xFFC00000), + pcr->pci_base1 & 0x8 ? "" : "not-"); printf(" XYW_AD(A) 0x%08x addr 0x%08x\n", - (int)pcr->pci_base2, (int)(pcr->pci_base2 & 0xFFC00000)); + (int)pcr->pci_base2, (int)(pcr->pci_base2 & 0xFFC00000)); printf(" XYW_AD(B) 0x%08x addr 0x%08x\n", - (int)pcr->pci_base3, (int)(pcr->pci_base3 & 0xFFC00000)); + (int)pcr->pci_base3, (int)(pcr->pci_base3 & 0xFFC00000)); printf(" RBASE_G 0x%08x addr 0x%08x\n", - (int)pcr->pci_base4, (int)(pcr->pci_base4 & 0xFFFF0000)); + (int)pcr->pci_base4, (int)(pcr->pci_base4 & 0xFFFF0000)); printf(" IO 0x%08x addr 0x%08x\n", - (int)pcr->pci_base5, (int)(pcr->pci_base5 & 0xFFFFFF00)); + (int)pcr->pci_base5, (int)(pcr->pci_base5 & 0xFFFFFF00)); printf(" RBASE_E 0x%08x addr 0x%08x %sdecode-enabled\n", - (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), - pcr->pci_baserom & 0x1 ? "" : "not-"); + (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), + pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" - " INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, - pcr->pci_int_pin, pcr->pci_int_line); + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, + pcr->pci_int_pin, pcr->pci_int_line); } static void -print_pcibridge(pciConfigPtr pcr) -{ - if (pcr->pci_status_command) - printf(" STATUS 0x%04x COMMAND 0x%04x\n", - pcr->pci_status, pcr->pci_command); - if (pcr->pci_class_revision) - printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, - pcr->pci_rev_id); - if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x" - " LATENCY 0x%02x CACHE 0x%02x\n", - pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, - pcr->pci_cache_line_size); +print_dc21050(pciConfigPtr pcr) +{ + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); + printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, + pcr->pci_cache_line_size); printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n", - pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, + pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, pcr->pci_subordinate_bus_number, pcr->pci_secondary_latency_timer); printf(" IOBASE 0x%02x IOLIM 0x%02x SECSTATUS 0x%04x\n", pcr->pci_io_base << 8, (pcr->pci_io_limit << 8) | 0xfff, @@ -543,17 +597,17 @@ pcr->pci_prefetch_mem_base << 16, (pcr->pci_prefetch_mem_limit << 16) | 0xfffff); printf(" RBASE_E 0x%08x addr 0x%08x %sdecode-enabled\n", - (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), - pcr->pci_baserom & 0x1 ? "" : "not-"); + (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), + pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" - " INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, - pcr->pci_int_pin, pcr->pci_int_line); + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, + pcr->pci_int_pin, pcr->pci_int_line); } static void -print_apb(pciConfigPtr pcr) +print_simba(pciConfigPtr pcr) { int i; CARD8 io, mem; @@ -567,7 +621,7 @@ pcr->pci_header_type, pcr->pci_latency_timer, pcr->pci_cache_line_size); printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n", - pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, + pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, pcr->pci_subordinate_bus_number, pcr->pci_secondary_latency_timer); printf(" SECSTATUS 0x%04x\n", pcr->pci_secondary_status); @@ -590,7 +644,7 @@ pciReadByte(pcr->tag, 0x00d9), pciReadByte(pcr->tag, 0x00db)); printf(" DMA AFSR 0x%08lx%08lx AFAR 0x%08lx%08lx\n", (long)pciReadLong(pcr->tag, 0x00cc), - (long) pciReadLong(pcr->tag, 0x00c8), + (long)pciReadLong(pcr->tag, 0x00c8), (long)pciReadLong(pcr->tag, 0x00d4), (long)pciReadLong(pcr->tag, 0x00d0)); printf(" PIO AFSR 0x%08lx%08lx AFAR 0x%08lx%08lx\n", @@ -612,6 +666,114 @@ for (i = 0; i < 8; i++) if (mem & (1 << i)) printf(" BUS MEM 0x%08x-0x%08x\n", i << 29, ((i + 1) << 29) - 1); +} + +static int cbn_460gx = -1; + +static void +print_460gx_sac(pciConfigPtr pcr) +{ + CARD32 tmp; + + /* Print generalities */ + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); + + tmp = pcr->pci_user_config; + pcr->pci_user_config = 0; + print_default_class(pcr); + pcr->pci_user_config = tmp; + + /* Only print what XFree86 might be interested in */ + if (pcr->busnum == 0) { + if ((pcr->devnum != 0x10) || (pcr->funcnum != 0)) + return; + + /* Get Chipset Bus Number */ + cbn_460gx = (unsigned int)pciReadByte(pcr->tag, 0x0040); + printf(" CBN 0x%02x CBUSES 0x%02x\n", + cbn_460gx, pciReadByte(pcr->tag, 0x0044)); + + return; + } + + if ((pcr->busnum != cbn_460gx) || (pcr->funcnum != 0)) + return; + + switch (pcr->devnum) { + case 0: + printf(" F16NUM 0x%02x F16CPL 0x%02x DEVNPRES 0x%08lx\n", + pciReadByte(pcr->tag, 0x0060), pciReadByte(pcr->tag, 0x0078), + (long)pciReadLong(pcr->tag, 0x0070)); + + return; + + case 0x10: + printf(" TOM 0x%04x IORD 0x%04x\n", + pciReadWord(pcr->tag, 0x0050), pciReadWord(pcr->tag, 0x008E)); + /* Fall through */ + + case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + printf(" BUSNO 0x%02x SUBNO 0x%02x\n", + pciReadByte(pcr->tag, 0x0048), pciReadByte(pcr->tag, 0x0049)); + printf(" VGASE 0x%02x PCIS 0x%02x IOR 0x%02x\n", + pciReadByte(pcr->tag, 0x0080), pciReadByte(pcr->tag, 0x0084), + pciReadByte(pcr->tag, 0x008C)); + /* Fall through */ + + default: + return; + } +} + +static void +print_460gx_pxb(pciConfigPtr pcr) +{ + CARD32 tmp; + + /* Print generalities */ + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); + + tmp = pcr->pci_user_config; + pcr->pci_user_config = 0; + print_default_class(pcr); + pcr->pci_user_config = tmp; + + /* Only print what XFree86 might be interested in */ + printf(" ERRCMD 0x%02x GAPEN 0x%02x\n", + pciReadByte(pcr->tag, 0x0046), pciReadByte(pcr->tag, 0x0060)); +} + +static void +print_460gx_gxb(pciConfigPtr pcr) +{ + CARD32 tmp; + + /* Print generalities */ + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); + + tmp = pcr->pci_user_config; + pcr->pci_user_config = 0; + print_default_class(pcr); + pcr->pci_user_config = tmp; + + /* Only print what XFree86 might be interested in */ + printf(" BAPBASE 0x%08lx%08lx AGPSIZ 0x%02x VGAGE 0x%02x\n", + (long)pciReadLong(pcr->tag, 0x009C), + (long)pciReadLong(pcr->tag, 0x0098), + pciReadByte(pcr->tag, 0x00A2), pciReadByte(pcr->tag, 0x0060)); } #include "xf86getpagesize.c" Index: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.5 xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.5 Thu May 31 14:39:06 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist Sat Feb 8 18:11:49 2003 @@ -1,6 +1,6 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist,v 1.5 2001/05/31 18:39:06 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist,v 1.6 2003/02/08 23:11:49 dawes Exp $ # Usage() @@ -102,6 +102,9 @@ GenList exit 0; fi + +# Make sure all directories in $FROMDIR have permissions 755 +find $FROMDIR -type d | xargs chmod 755 for d in $SUBDIRS; do if [ ! -d $TODIR/$d ]; then Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list:1.1 Mon Jul 2 05:37:18 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list Sat Dec 21 20:49:32 2002 @@ -2,6 +2,8 @@ bin lib/libdps.a lib/libdpstk.a +lib/libexpat.a +lib/libfontconfig.a lib/libfntstubs.a lib/libfreetype.a lib/libFS.a @@ -15,6 +17,7 @@ lib/libX11.a lib/libXau.a lib/libXaw.a +lib/libXcursor.a lib/libXdmcp.a lib/libXext.a lib/libXfont.a Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir:1.1 Mon Jul 2 05:37:18 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir Sat Dec 21 20:49:32 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list:1.1 Mon Jul 2 05:37:18 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list Sat Dec 21 20:49:32 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.6 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.9 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.6 Tue Jan 15 16:34:32 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list Tue Feb 25 16:57:53 2003 @@ -9,6 +9,9 @@ lib/libICE.6.3.dylib lib/libICE.6.dylib lib/libICE.dylib +lib/libOSMesa.4.0.dylib +lib/libOSMesa.4.dylib +lib/libOSMesa.dylib lib/libSM.6.0.dylib lib/libSM.6.dylib lib/libSM.dylib @@ -20,6 +23,9 @@ lib/libXaw.7.0.dylib lib/libXaw.7.dylib lib/libXaw.dylib +lib/libXcursor.1.0.dylib +lib/libXcursor.1.dylib +lib/libXcursor.dylib lib/libXext.6.4.dylib lib/libXext.6.dylib lib/libXext.dylib @@ -28,6 +34,8 @@ lib/libXfont.dylib lib/libXft.1.1.dylib lib/libXft.1.dylib +lib/libXft.2.1.dylib +lib/libXft.2.dylib lib/libXft.dylib lib/libXi.6.0.dylib lib/libXi.6.dylib @@ -44,10 +52,10 @@ lib/libXpm.4.11.dylib lib/libXpm.4.dylib lib/libXpm.dylib -lib/libXrandr.1.0.dylib -lib/libXrandr.1.dylib +lib/libXrandr.2.0.dylib +lib/libXrandr.2.dylib lib/libXrandr.dylib -lib/libXrender.1.1.dylib +lib/libXrender.1.2.dylib lib/libXrender.1.dylib lib/libXrender.dylib lib/libXt.6.0.dylib @@ -59,13 +67,22 @@ lib/libXTrap.6.4.dylib lib/libXTrap.6.dylib lib/libXTrap.dylib +lib/libXv.1.0.dylib +lib/libXv.1.dylib +lib/libXv.dylib lib/libdps.1.0.dylib lib/libdps.1.dylib lib/libdps.dylib lib/libdpstk.1.0.dylib lib/libdpstk.1.dylib lib/libdpstk.dylib -lib/libfreetype.6.2.dylib +lib/libexpat.1.0.dylib +lib/libexpat.1.dylib +lib/libexpat.dylib +lib/libfontconfig.1.0.dylib +lib/libfontconfig.1.dylib +lib/libfontconfig.dylib +lib/libfreetype.6.3.dylib lib/libfreetype.6.dylib lib/libfreetype.dylib lib/liboldX.6.0.dylib Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir:1.1 Sun May 27 13:55:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir Sat Dec 21 20:49:33 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list:1.1 Sun May 27 13:55:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list Sat Dec 21 20:49:33 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.6 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.9 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.6 Tue Jan 15 16:34:35 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list Tue Feb 25 16:57:53 2003 @@ -9,6 +9,9 @@ lib/libICE.6.3.dylib lib/libICE.6.dylib lib/libICE.dylib +lib/libOSMesa.4.0.dylib +lib/libOSMesa.4.dylib +lib/libOSMesa.dylib lib/libSM.6.0.dylib lib/libSM.6.dylib lib/libSM.dylib @@ -20,6 +23,9 @@ lib/libXaw.7.0.dylib lib/libXaw.7.dylib lib/libXaw.dylib +lib/libXcursor.1.0.dylib +lib/libXcursor.1.dylib +lib/libXcursor.dylib lib/libXext.6.4.dylib lib/libXext.6.dylib lib/libXext.dylib @@ -28,6 +34,8 @@ lib/libXfont.dylib lib/libXft.1.1.dylib lib/libXft.1.dylib +lib/libXft.2.1.dylib +lib/libXft.2.dylib lib/libXft.dylib lib/libXi.6.0.dylib lib/libXi.6.dylib @@ -44,10 +52,10 @@ lib/libXpm.4.11.dylib lib/libXpm.4.dylib lib/libXpm.dylib -lib/libXrandr.1.0.dylib -lib/libXrandr.1.dylib +lib/libXrandr.2.0.dylib +lib/libXrandr.2.dylib lib/libXrandr.dylib -lib/libXrender.1.1.dylib +lib/libXrender.1.2.dylib lib/libXrender.1.dylib lib/libXrender.dylib lib/libXt.6.0.dylib @@ -59,13 +67,22 @@ lib/libXTrap.6.4.dylib lib/libXTrap.6.dylib lib/libXTrap.dylib +lib/libXv.1.0.dylib +lib/libXv.1.dylib +lib/libXv.dylib lib/libdps.1.0.dylib lib/libdps.1.dylib lib/libdps.dylib lib/libdpstk.1.0.dylib lib/libdpstk.1.dylib lib/libdpstk.dylib -lib/libfreetype.6.2.dylib +lib/libexpat.1.0.dylib +lib/libexpat.1.dylib +lib/libexpat.dylib +lib/libfontconfig.1.0.dylib +lib/libfontconfig.1.dylib +lib/libfontconfig.dylib +lib/libfreetype.6.3.dylib lib/libfreetype.6.dylib lib/libfreetype.dylib lib/liboldX.6.0.dylib Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir:1.1 Sun May 27 13:55:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir Sat Dec 21 20:49:33 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list:1.1 Sun May 27 13:55:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list Sat Dec 21 20:49:33 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list:1.1 Sun May 27 13:55:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list Thu Feb 6 18:24:33 2003 @@ -1,4 +1,8 @@ bin/X bin/XDarwinStartup bin/XDarwinQuartz +lib/libfreetype.6.3.dylib +lib/libfreetype.6.dylib +lib/libfreetype.a +lib/libfreetype.dylib ../../Applications/XDarwin.app Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.13 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.14 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.13 Tue Jan 15 16:34:35 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list Sat Dec 21 20:49:33 2002 @@ -7,7 +7,7 @@ lib/libGLU.so lib/libICE.so.6 lib/libICE.so -lib/libOSMesa.so.3 +lib/libOSMesa.so.4 lib/libOSMesa.so lib/libSM.so.6 lib/libSM.so @@ -20,11 +20,14 @@ lib/libXaw.so.7 lib/libXaw.so.6 lib/libXaw.so +lib/libXcursor.so.1 +lib/libXcursor.so lib/libXext.so.6 lib/libXext.so lib/libXfont.so.1 lib/libXfont.so lib/libXft.so.1 +lib/libXft.so.2 lib/libXft.so lib/libXi.so.6 lib/libXi.so @@ -36,7 +39,7 @@ lib/libXp.so lib/libXpm.so.4 lib/libXpm.so -lib/libXrandr.so.1 +lib/libXrandr.so.2 lib/libXrandr.so lib/libXrender.so.1 lib/libXrender.so @@ -44,11 +47,17 @@ lib/libXt.so lib/libXtst.so.6 lib/libXtst.so +lib/libXv.so.1 +lib/libXv.so lib/libdps.so.1 lib/libdps.so lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.8 +lib/libexpat.so.1 +lib/libexpat.so +lib/libfontconfig.so.1 +lib/libfontconfig.so +lib/libfreetype.so.9 lib/libfreetype.so lib/liboldX.so.6 lib/liboldX.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-dir:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-dir:1.3 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-dir:1.2 Thu Feb 24 13:45:46 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-dir Sat Dec 21 20:49:33 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-list:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-list:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-list:1.3 Thu Feb 24 13:45:46 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/etc-list Sat Dec 21 20:49:33 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.4 Thu May 31 14:47:07 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def Tue Dec 24 11:14:41 2002 @@ -1,9 +1,12 @@ /* * Host.def for building FreeBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def,v 1.4 2001/05/31 18:47:07 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def,v 1.5 2002/12/24 16:14:41 dawes Exp $ */ #define InstallEmptyHostDef #define BuildBindist + +#define HasLibpng YES +#define LibpngDir /usr/local Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/prog-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/prog-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/prog-excl:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/prog-excl:1.1 Tue May 27 00:00:27 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/prog-excl Mon Feb 17 22:09:06 2003 @@ -1,5 +1,6 @@ lib/Server lib/X11 +lib/aout lib/lib*.so* lib/modules include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.11 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.13 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.11 Tue Jan 15 16:34:35 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list Tue Feb 25 16:57:53 2003 @@ -9,21 +9,26 @@ lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXaw.so.7.0 +lib/libXcursor.so.1.0 lib/libXext.so.6.4 lib/libXfont.so.1.4 lib/libXft.so.1.1 +lib/libXft.so.2.1 lib/libXi.so.6.0 lib/libXmu.so.6.2 lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXpm.so.4.11 -lib/libXrandr.so.1.0 -lib/libXrender.so.1.1 +lib/libXrandr.so.2.0 +lib/libXrender.so.1.2 lib/libXt.so.6.0 lib/libXtst.so.6.1 +lib/libXv.so.1.0 lib/libdps.so.1.0 lib/libdpstk.so.1.0 -lib/libfreetype.so.8.0 +lib/libexpat.so.1.0 +lib/libfontconfig.so.1.0 +lib/libfreetype.so.9.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 lib/libxrx.so.6.3 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-dir:1.1 Sat Feb 26 19:24:30 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-dir Sat Dec 21 20:49:33 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-list:1.1 Sat Feb 26 19:24:30 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/etc-list Sat Dec 21 20:49:33 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.4 Thu May 31 14:47:07 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def Tue Dec 24 11:14:42 2002 @@ -1,9 +1,12 @@ /* * Host.def for building FreeBSD/a.out bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def,v 1.4 2001/05/31 18:47:07 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def,v 1.5 2002/12/24 16:14:42 dawes Exp $ */ #define InstallEmptyHostDef #define BuildBindist + +#define HasLibpng YES +#define LibpngDir /usr/local Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-dir:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-dir:1.3 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-dir:1.2 Sat Feb 26 20:18:24 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-dir Sat Dec 21 20:49:33 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-list:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-list:1.3 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-list:1.2 Sat Feb 26 20:18:24 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/etc-list Sat Dec 21 20:49:33 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.12 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.14 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.12 Tue Jan 15 16:34:36 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list Tue Feb 25 16:57:53 2003 @@ -9,8 +9,8 @@ lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so -lib/libOSMesa.so.3.3 -lib/libOSMesa.so.3 +lib/libOSMesa.so.4.0 +lib/libOSMesa.so.4 lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so.6 @@ -26,6 +26,9 @@ lib/libXaw.so.7.0 lib/libXaw.so.7 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so.1 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so @@ -34,6 +37,8 @@ lib/libXfont.so lib/libXft.so.1.1 lib/libXft.so.1 +lib/libXft.so.2.1 +lib/libXft.so.2 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so.6 @@ -50,10 +55,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrandr.so.1.0 -lib/libXrandr.so.1 +lib/libXrandr.so.2.0 +lib/libXrandr.so.2 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -62,13 +67,22 @@ lib/libXtst.so.6.1 lib/libXtst.so.6 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so.1 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so.1 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so.1 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so.1 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-dir:1.1 Sat Feb 26 19:57:37 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-dir Sat Dec 21 20:49:34 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-list:1.1 Sat Feb 26 19:57:38 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/etc-list Sat Dec 21 20:49:34 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.12 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.14 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.12 Tue Jan 15 16:34:36 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list Tue Feb 25 16:57:53 2003 @@ -9,8 +9,8 @@ lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so -lib/libOSMesa.so.3.3 -lib/libOSMesa.so.3 +lib/libOSMesa.so.4.0 +lib/libOSMesa.so.4 lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so.6 @@ -26,6 +26,9 @@ lib/libXaw.so.7.0 lib/libXaw.so.7 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so.1 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so @@ -34,6 +37,8 @@ lib/libXfont.so lib/libXft.so.1.1 lib/libXft.so.1 +lib/libXft.so.2.1 +lib/libXft.so.2 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so.6 @@ -50,10 +55,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrandr.so.1.0 -lib/libXrandr.so.1 +lib/libXrandr.so.2.0 +lib/libXrandr.so.2 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -62,13 +67,22 @@ lib/libXtst.so.6.1 lib/libXtst.so.6 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so.1 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so.1 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so.1 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so.1 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-dir:1.1 Sat Feb 26 20:08:29 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-dir Sat Dec 21 20:49:34 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-list:1.1 Sat Feb 26 20:08:29 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/etc-list Sat Dec 21 20:49:34 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.11 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.13 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.11 Tue Jan 15 16:34:37 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list Tue Feb 25 16:57:54 2003 @@ -9,8 +9,8 @@ lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so -lib/libOSMesa.so.3.3 -lib/libOSMesa.so.3 +lib/libOSMesa.so.4.0 +lib/libOSMesa.so.4 lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so.6 @@ -26,6 +26,9 @@ lib/libXaw.so.7.0 lib/libXaw.so.7 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so.1 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so @@ -34,6 +37,8 @@ lib/libXfont.so lib/libXft.so.1.1 lib/libXft.so.1 +lib/libXft.so.2.1 +lib/libXft.so.2 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so.6 @@ -50,10 +55,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrandr.so.1.0 -lib/libXrandr.so.1 +lib/libXrandr.so.2.0 +lib/libXrandr.so.2 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -62,13 +67,22 @@ lib/libXtst.so.6.1 lib/libXtst.so.6 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so.1 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so.1 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so.1 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so.1 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-dir:1.1 Sat Feb 26 20:11:47 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-dir Sat Dec 21 20:49:34 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-list:1.1 Sat Feb 26 20:11:47 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/etc-list Sat Dec 21 20:49:34 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.10 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.8 Tue Jan 15 16:34:37 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list Tue Feb 25 16:57:54 2003 @@ -9,8 +9,8 @@ lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so -lib/libOSMesa.so.3.3 -lib/libOSMesa.so.3 +lib/libOSMesa.so.4.0 +lib/libOSMesa.so.4 lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so.6 @@ -26,6 +26,9 @@ lib/libXaw.so.7.0 lib/libXaw.so.7 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so.1 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so @@ -34,6 +37,8 @@ lib/libXfont.so lib/libXft.so.1.1 lib/libXft.so.1 +lib/libXft.so.2.1 +lib/libXft.so.2 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so.6 @@ -50,10 +55,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrandr.so.1.0 -lib/libXrandr.so.1 +lib/libXrandr.so.2.0 +lib/libXrandr.so.2 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -62,13 +67,22 @@ lib/libXtst.so.6.1 lib/libXtst.so.6 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so.1 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so.1 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so.1 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so.1 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-dir:1.1 Fri Jun 23 18:42:03 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-dir Sat Dec 21 20:49:34 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-list:1.1 Fri Jun 23 18:42:03 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/etc-list Sat Dec 21 20:49:34 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.10 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.8 Tue Jan 15 16:34:38 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list Tue Feb 25 16:57:54 2003 @@ -9,8 +9,8 @@ lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so -lib/libOSMesa.so.3.3 -lib/libOSMesa.so.3 +lib/libOSMesa.so.4.0 +lib/libOSMesa.so.4 lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so.6 @@ -26,6 +26,9 @@ lib/libXaw.so.7.0 lib/libXaw.so.7 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so.1 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so @@ -34,6 +37,8 @@ lib/libXfont.so lib/libXft.so.1.1 lib/libXft.so.1 +lib/libXft.so.2.1 +lib/libXft.so.2 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so.6 @@ -50,10 +55,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrandr.so.1.0 -lib/libXrandr.so.1 +lib/libXrandr.so.2.0 +lib/libXrandr.so.2 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -62,13 +67,22 @@ lib/libXtst.so.6.1 lib/libXtst.so.6 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so.1 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so.1 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so.1 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so.1 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-dir:1.1 Sat Feb 26 20:15:11 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-dir Sat Dec 21 20:49:34 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-list:1.1 Sat Feb 26 20:15:11 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/etc-list Sat Dec 21 20:49:35 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-dir:1.1 Sat Feb 26 20:24:24 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-dir Sat Dec 21 20:49:35 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-list:1.1 Sat Feb 26 20:24:25 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/etc-list Sat Dec 21 20:49:35 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.10 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.8 Tue Jan 15 16:34:38 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list Tue Feb 25 16:57:54 2003 @@ -3,25 +3,31 @@ lib/libGL.so.1.2 lib/libGLU.so.1.3 lib/libICE.so.6.3 +lib/libOSMesa.so.4.0 lib/libSM.so.6.0 lib/libX11.so.6.2 lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXaw.so.7.0 +lib/libXcursor.so.1.0 lib/libXext.so.6.4 lib/libXfont.so.1.4 lib/libXft.so.1.1 +lib/libXft.so.2.1 lib/libXi.so.6.0 lib/libXmu.so.6.2 lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXpm.so.4.11 -lib/libXrandr.so.1.0 -lib/libXrender.so.1.1 +lib/libXrandr.so.2.0 +lib/libXrender.so.1.2 lib/libXt.so.6.0 lib/libXtst.so.6.1 +lib/libXv.so.1.0 lib/libdps.so.1.0 lib/libdpstk.so.1.0 -lib/libfreetype.so.8.0 +lib/libexpat.so.1.0 +lib/libfontconfig.so.1.0 +lib/libfreetype.so.9.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-dir:1.1 Sat Dec 9 16:46:26 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-dir Sat Dec 21 20:49:35 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-list:1.3 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-list:1.1 Sat Dec 9 16:46:26 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/etc-list Sun Feb 16 12:15:26 2003 @@ -1 +1 @@ -. +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.3 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.2 Thu May 31 14:47:09 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def Tue Dec 24 11:14:42 2002 @@ -1,9 +1,12 @@ /* * Host.def for building NetBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def,v 1.2 2001/05/31 18:47:09 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def,v 1.3 2002/12/24 16:14:42 dawes Exp $ */ #define InstallEmptyHostDef #define BuildBindist + +#define HasLibpng YES +#define LibpngDir /usr/pkg Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.13 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.15 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.13 Tue Jan 15 16:34:38 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list Tue Feb 25 16:57:54 2003 @@ -9,6 +9,9 @@ lib/libICE.so lib/libICE.so.6 lib/libICE.so.6.3 +lib/libOSMesa.so +lib/libOSMesa.so.4 +lib/libOSMesa.so.4.0 lib/libSM.so lib/libSM.so.6 lib/libSM.so.6.0 @@ -23,6 +26,9 @@ lib/libXaw.so.6.1 lib/libXaw.so.7 lib/libXaw.so.7.0 +lib/libXcursor.so +lib/libXcursor.so.1 +lib/libXcursor.so.1.0 lib/libXext.so lib/libXext.so.6 lib/libXext.so.6.4 @@ -32,6 +38,8 @@ lib/libXft.so lib/libXft.so.1 lib/libXft.so.1.1 +lib/libXft.so.2 +lib/libXft.so.2.1 lib/libXi.so lib/libXi.so.6 lib/libXi.so.6.0 @@ -48,26 +56,35 @@ lib/libXpm.so.4 lib/libXpm.so.4.11 lib/libXrandr.so -lib/libXrandr.so.1 -lib/libXrandr.so.1.0 +lib/libXrandr.so.2 +lib/libXrandr.so.2.0 lib/libXrender.so lib/libXrender.so.1 -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXt.so lib/libXt.so.6 lib/libXt.so.6.0 lib/libXtst.so lib/libXtst.so.6 lib/libXtst.so.6.1 +lib/libXv.so +lib/libXv.so.1 +lib/libXv.so.1.0 lib/libdps.so lib/libdps.so.1 lib/libdps.so.1.0 lib/libdpstk.so lib/libdpstk.so.1 lib/libdpstk.so.1.0 +lib/libexpat.so +lib/libexpat.so.1 +lib/libexpat.so.1.0 +lib/libfontconfig.so +lib/libfontconfig.so.1 +lib/libfontconfig.so.1.0 lib/libfreetype.so -lib/libfreetype.so.8 -lib/libfreetype.so.8.0 +lib/libfreetype.so.9 +lib/libfreetype.so.9.0 lib/liboldX.so lib/liboldX.so.6 lib/liboldX.so.6.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-dir:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-dir:1.1 Sat Feb 26 20:26:49 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-dir Sun Feb 16 12:14:53 2003 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-list:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-list:1.1 Sat Feb 26 20:26:49 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/etc-list Sun Feb 16 12:14:53 2003 @@ -1 +1 @@ -. +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.4 Thu May 31 14:47:09 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def Sun Jan 12 09:15:31 2003 @@ -1,9 +1,16 @@ /* * Host.def for building NetBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def,v 1.4 2001/05/31 18:47:09 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def,v 1.6 2003/01/12 14:15:31 herrb Exp $ */ #define InstallEmptyHostDef #define BuildBindist +/* + * These defines assume libpng is installed from the packages system + */ +#define HasLibpng YES +#define LibpngDir /usr/pkg + +#define SystemBuildLibPath /usr/lib:/usr/pkg/lib Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/lib-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/lib-excl:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/lib-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/lib-excl:1.2 Sat Feb 26 20:26:50 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/lib-excl Thu Feb 27 12:31:58 2003 @@ -1,14 +0,0 @@ -lib/X11/XF86Setup -lib/X11/app-defaults -lib/X11/config -lib/X11/doc -lib/X11/fonts -lib/X11/fs -lib/X11/lbxproxy -lib/X11/proxymngr -lib/X11/rstart -lib/X11/twm -lib/X11/xdm -lib/X11/xinit -lib/X11/xsm -lib/X11/xserver Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-dir:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-dir:1.1 Sat Feb 26 20:26:50 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-dir Thu Feb 27 12:31:58 2003 @@ -1 +0,0 @@ -var Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-list:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-list:1.2 Wed Dec 20 09:41:08 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/var-list Thu Feb 27 12:31:58 2003 @@ -1,2 +0,0 @@ -db/xdm -db/xkb Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.16 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.18 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.16 Tue Jan 15 19:02:16 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list Tue Feb 25 16:57:54 2003 @@ -3,26 +3,32 @@ lib/libGL.so.1.2 lib/libGLU.so.1.3 lib/libICE.so.6.3 +lib/libOSMesa.so.4.0 lib/libSM.so.6.0 lib/libX11.so.6.2 lib/libXThrStub.so.6.1 lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXaw.so.7.0 +lib/libXcursor.so.1.0 lib/libXext.so.6.4 lib/libXfont.so.1.4 lib/libXft.so.1.1 +lib/libXft.so.2.1 lib/libXi.so.6.0 lib/libXmu.so.6.2 lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXpm.so.4.11 -lib/libXrandr.so.1.0 -lib/libXrender.so.1.1 +lib/libXrandr.so.2.0 +lib/libXrender.so.1.2 lib/libXt.so.6.0 lib/libXtst.so.6.1 +lib/libXv.so.1.0 lib/libdps.so.1.0 lib/libdpstk.so.1.0 -lib/libfreetype.so.8.0 +lib/libexpat.so.1.0 +lib/libfontconfig.so.1.0 +lib/libfreetype.so.9.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-dir:1.1 Sat Feb 26 20:29:02 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-dir Sat Dec 21 20:49:36 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-list:1.1 Sat Feb 26 20:29:02 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/etc-list Sat Dec 21 20:49:36 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.7 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.4 Thu May 31 14:47:10 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def Mon Dec 30 11:35:10 2002 @@ -1,7 +1,7 @@ /* * Host.def for building OpenBSD/ix86 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def,v 1.4 2001/05/31 18:47:10 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def,v 1.7 2002/12/30 16:35:10 herrb Exp $ */ #define InstallEmptyHostDef @@ -9,8 +9,13 @@ #define ForceNormalLib YES -#define HasTcl YES -#define HasTk YES -#define TkLibName tk41 -#define TclLibName tcl75 - +/* + * These defines assume libpng is installed from the ports tree + */ +#define HasLibpng YES +#define LibpngDir /usr/local +#define LibpngDirStandard NO +#define LibpngIncDir /usr/local/include/libpng +#define LibpngIncDirStandard NO +#define LibpngLibDir /usr/local/lib +#define LibpngLibDirStandard NO Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Mono-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Mono-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Mono-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Mono-list:1.1 Sat Oct 25 09:50:38 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Mono-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -bin/XsunMono Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Sun24-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Sun24-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Sun24-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Sun24-list:1.1 Sat Oct 25 09:50:39 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/Sun24-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -bin/Xsun24 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-excl:1.1 Sat Oct 25 09:50:39 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-excl Thu Feb 27 12:31:59 2003 @@ -1,8 +0,0 @@ -bin/Xsun -bin/Xsun24 -bin/XsunMono -bin/Xnest -bin/Xprt -bin/Xvfb -bin/X -bin/xfs Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.6 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.6 Fri Dec 28 18:36:35 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list Thu Feb 27 12:31:59 2003 @@ -1,17 +0,0 @@ -.XFree86_Version -bin -lib/libICE.so.6.3 -lib/libSM.so.6.0 -lib/libX11.so.6.1 -lib/libXTrap.so.6.4 -lib/libXaw.so.6.1 -lib/libXext.so.6.3 -lib/libXi.so.6.0 -lib/libXmu.so.6.0 -lib/libXmuu.so.1.0 -lib/libXp.so.6.2 -lib/libXt.so.6.0 -lib/libXtst.so.6.1 -lib/liboldX.so.6.0 -lib/modules -lib/X11/app-defaults Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/dir:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/dir:1.1 Sat Oct 25 09:50:39 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/dir Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -usr/X11R6 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/fsrv-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/fsrv-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/fsrv-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/fsrv-list:1.1 Sat Oct 25 09:50:39 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/fsrv-list Thu Feb 27 12:31:59 2003 @@ -1,3 +0,0 @@ -bin/xfs -lib/X11/fs -man/cat1/xfs.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.3 Thu May 31 14:47:10 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def Thu Feb 27 12:31:59 2003 @@ -1,15 +0,0 @@ -/* - * Host.def for building OpenBSD/sparc bindists - * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def,v 1.3 2001/05/31 18:47:10 dawes Exp $ - */ - -#define InstallEmptyHostDef -#define BuildBindist - -#define ForceNormalLib YES - -#define HasTcl YES -#define HasTk YES -#define TkLibName tk41 -#define TclLibName tcl75 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-excl:1.1 Sat Oct 25 09:50:40 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-excl Thu Feb 27 12:31:59 2003 @@ -1,12 +0,0 @@ -lib/X11/XF86Setup -lib/X11/app-defaults -lib/X11/config -lib/X11/fonts -lib/X11/fs -lib/X11/xdm/GiveConsole -lib/X11/xdm/TakeConsole -lib/X11/xdm/X* -lib/X11/xdm/xdm-* -lib/X11/xinit -lib/X11/doc -lib/X11/XF86Setup Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-list:1.1 Sat Oct 25 09:50:40 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/lib-list Thu Feb 27 12:31:59 2003 @@ -1,2 +0,0 @@ -lib/X11 -include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-excl:1.1 Sat Oct 25 09:50:40 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-excl Thu Feb 27 12:31:59 2003 @@ -1,3 +0,0 @@ -man/cat1/XF86Setup.0 -man/cat1/xfs.0 -man/cat1/xmseconfig.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-list:1.1 Sat Oct 25 09:50:41 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/man-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -man Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/nest-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/nest-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/nest-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/nest-list:1.1 Sat Oct 25 09:50:41 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/nest-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -bin/Xnest Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-excl:1.1 Sat Oct 25 09:50:41 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-excl Thu Feb 27 12:31:59 2003 @@ -1,5 +0,0 @@ -lib/Server -lib/X11 -lib/lib*.so* -lib/modules -include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-list:1.1 Sat Oct 25 09:50:41 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prog-list Thu Feb 27 12:31:59 2003 @@ -1,3 +0,0 @@ -lib -include -lib/X11/config Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prt-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prt-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prt-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prt-list:1.1 Sat Oct 25 09:50:41 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/prt-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -bin/Xprt Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/sun-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/sun-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/sun-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/sun-list:1.1 Sat Oct 25 09:50:42 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/sun-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -bin/Xsun Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/xserv-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/xserv-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/xserv-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/xserv-list:1.1 Fri Dec 31 10:04:03 1999 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/xserv-list Thu Feb 27 12:31:59 2003 @@ -1 +0,0 @@ -bin/XFree86 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.12 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.14 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.12 Tue Jan 15 16:34:39 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list Tue Feb 25 16:57:55 2003 @@ -15,11 +15,14 @@ lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so lib/libXfont.so.1.4 lib/libXfont.so lib/libXft.so.1.1 +lib/libXft.so.2.1 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so @@ -31,19 +34,25 @@ lib/libXp.so lib/libXpm.so.4.11 lib/libXpm.so -lib/libXrandr.so.1.0 +lib/libXrandr.so.2.0 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so lib/libXt.so.6.0 lib/libXt.so lib/libXtst.so.6.1 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-dir:1.1 Sat Feb 26 20:34:12 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-dir Sat Dec 21 20:49:36 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-list:1.1 Sat Feb 26 20:34:12 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/etc-list Sat Dec 21 20:49:36 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.5 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.5 Thu May 31 14:47:10 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def Tue Dec 24 11:14:45 2002 @@ -1,11 +1,14 @@ /* * Host.def for building SVR4.0 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.5 2001/05/31 18:47:10 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.6 2002/12/24 16:14:45 dawes Exp $ */ #define InstallEmptyHostDef #define BuildBindist #define ForceNormalLib YES + +#define HasLibpng YES +#define LibpngDir /usr/local Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.12 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.14 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.12 Tue Jan 15 16:34:39 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list Tue Feb 25 16:57:55 2003 @@ -6,6 +6,8 @@ lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so +lib/libOSMesa.so.4.0 +lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so lib/libX11.so.6.2 @@ -15,11 +17,14 @@ lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so lib/libXfont.so.1.4 lib/libXfont.so lib/libXft.so.1.1 +lib/libXft.so.2.1 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so @@ -31,19 +36,25 @@ lib/libXp.so lib/libXpm.so.4.11 lib/libXpm.so -lib/libXrandr.so.1.0 +lib/libXrandr.so.2.0 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so lib/libXt.so.6.0 lib/libXt.so lib/libXtst.so.6.1 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-dir:1.1 Sat Feb 26 20:36:39 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-dir Sat Dec 21 20:49:36 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-list:1.1 Sat Feb 26 20:36:39 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/etc-list Sat Dec 21 20:49:36 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.5 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.5 Thu May 31 14:47:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def Tue Dec 24 11:14:45 2002 @@ -1,11 +1,14 @@ /* * Host.def for building Solaris bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.5 2001/05/31 18:47:11 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.6 2002/12/24 16:14:45 dawes Exp $ */ #define InstallEmptyHostDef #define BuildBindist #define ForceNormalLib YES + +#define HasLibpng YES +#define LibpngDir /usr/local Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.12 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.14 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.12 Tue Jan 15 16:34:40 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list Tue Feb 25 16:57:55 2003 @@ -6,6 +6,8 @@ lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so +lib/libOSMesa.so.4.0 +lib/libOSMesa.so lib/libSM.so.6.0 lib/libSM.so lib/libX11.so.6.2 @@ -15,11 +17,14 @@ lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXaw.so +lib/libXcursor.so.1.0 +lib/libXcursor.so lib/libXext.so.6.4 lib/libXext.so lib/libXfont.so.1.4 lib/libXfont.so lib/libXft.so.1.1 +lib/libXft.so.2.1 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so @@ -31,19 +36,25 @@ lib/libXp.so lib/libXpm.so.4.11 lib/libXpm.so -lib/libXrandr.so.1.0 +lib/libXrandr.so.2.0 lib/libXrandr.so -lib/libXrender.so.1.1 +lib/libXrender.so.1.2 lib/libXrender.so lib/libXt.so.6.0 lib/libXt.so lib/libXtst.so.6.1 lib/libXtst.so +lib/libXv.so.1.0 +lib/libXv.so lib/libdps.so.1.0 lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so -lib/libfreetype.so.6.2 +lib/libexpat.so.1.0 +lib/libexpat.so +lib/libfontconfig.so.1.0 +lib/libfontconfig.so +lib/libfreetype.so.6.3 lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-dir:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-dir:1.1 Sat Feb 26 20:38:35 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-dir Sat Dec 21 20:49:36 2002 @@ -1 +1 @@ -etc/X11 +etc Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-list:1.1 Sat Feb 26 20:38:35 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/etc-list Sat Dec 21 20:49:36 2002 @@ -1 +1,2 @@ -. +X11 +fonts Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.5 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.5 Thu May 31 14:47:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def Tue Dec 24 11:14:45 2002 @@ -1,11 +1,14 @@ /* * Host.def for building UnixWare bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.5 2001/05/31 18:47:11 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.6 2002/12/24 16:14:45 dawes Exp $ */ #define InstallEmptyHostDef #define BuildBindist #define ForceNormalLib YES + +#define HasLibpng YES +#define LibpngDir /usr/local Index: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile:1.12 --- xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile:1.10 Tue Jan 23 19:06:34 2001 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile Fri Nov 22 17:56:03 2002 @@ -1,9 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile,v 1.10 2001/01/24 00:06:34 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile,v 1.12 2002/11/22 22:56:03 tsi Exp $ #define IHaveModules #include <Server.tmpl> -#if LinuxFBDevSupport +#if defined(LinuxArchitecture) && LinuxFBDevSupport SRCS = fbdevhw.c OBJS = fbdevhw.o #else @@ -28,10 +28,7 @@ #endif InstallModuleManPage(fbdevhw) -#ifndef OS2Architecture DependTarget() -#endif - InstallDriverSDKLibraryModule(fbdevhw,$(DRIVERSDKMODULEDIR),linux) Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.27 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.30 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.27 Wed Oct 31 17:50:29 2001 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c Mon Nov 25 09:05:00 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.27 2001/10/31 22:50:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.30 2002/11/25 14:05:00 eich Exp $ */ /* all driver need this */ #include "xf86.h" @@ -267,6 +267,8 @@ for (i = 0; i < 8; i++) { sprintf(filename,"/dev/fb%d",i); if (-1 == (fd = open(filename,O_RDWR,0))) { + xf86DrvMsg(-1, X_WARNING, + "open %s: %s\n", filename, strerror(errno)); continue; } if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) { @@ -300,30 +302,39 @@ } static int -fbdev_open(char *dev, char** namep) +fbdev_open(int scrnIndex, char *dev, char** namep) { struct fb_fix_screeninfo fix; int fd; /* try argument (from XF86Config) first */ - if ((NULL == dev) || ((fd = open(dev,O_RDWR,0)) == -1)) { + if (dev) { + fd = open(dev,O_RDWR,0); + } else { /* second: environment variable */ dev = getenv("FRAMEBUFFER"); if ((NULL == dev) || ((fd = open(dev,O_RDWR,0)) == -1)) { /* last try: default device */ - if (-1 == (fd = open("/dev/fb0",O_RDWR,0))) - return -1; + dev = "/dev/fb0"; + fd = open(dev,O_RDWR,0); } } + + if (fd == -1) { + xf86DrvMsg(scrnIndex, X_ERROR, + "open %s: %s\n", dev, strerror(errno)); + return -1; + } + if (namep) { if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)(&fix))) { *namep = NULL; + xf86DrvMsg(scrnIndex, X_ERROR, + "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return -1; } else { - if (namep) { - *namep = xnfalloc(16); - strncpy(*namep,fix.id,16); - } + *namep = xnfalloc(16); + strncpy(*namep,fix.id,16); } } return fd; @@ -339,7 +350,7 @@ if (pPci) fd = fbdev_open_pci(pPci,namep); else - fd = fbdev_open(device,namep); + fd = fbdev_open(-1,device,namep); if (-1 == fd) return FALSE; @@ -361,9 +372,15 @@ if (pPci) fPtr->fd = fbdev_open_pci(pPci,NULL); else - fPtr->fd = fbdev_open(device,NULL); - if (-1 == fPtr->fd) + fPtr->fd = fbdev_open(pScrn->scrnIndex,device,NULL); + if (-1 == fPtr->fd) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to open framebuffer device, consult warnings" + " and/or errors above for possible reasons\n" + "\t(you may have to look at the server log to see" + " warnings)\n"); return FALSE; + } /* get current fb device settings */ if (-1 == ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) { @@ -545,7 +562,8 @@ fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fPtr->fd, 0); if (-1 == (long)fPtr->fbmem) { - perror("mmap fbmem"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "mmap fbmem: %s\n", strerror(errno)); fPtr->fbmem = NULL; } else { /* Perhaps we'd better add fboff to fbmem and return 0 in @@ -576,7 +594,8 @@ TRACE_ENTER("UnmapVidmem"); if (NULL != fPtr->fbmem) { if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len)) - perror("munmap fbmem"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "munmap fbmem: %s\n", strerror(errno)); fPtr->fbmem = NULL; } return TRUE; @@ -594,7 +613,8 @@ /* tell the kernel not to use accels to speed up console scrolling */ fPtr->var.accel_flags = 0; if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - perror("FBIOPUT_VSCREENINFO"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK; @@ -605,7 +625,8 @@ fPtr->mmio = mmap(NULL, fPtr->mmio_len, PROT_READ | PROT_WRITE, MAP_SHARED, fPtr->fd, fPtr->fbmem_len); if (-1 == (long)fPtr->mmio) { - perror("mmap mmio"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "mmap mmio: %s\n", strerror(errno)); fPtr->mmio = NULL; } else fPtr->mmio += mmio_off; @@ -621,7 +642,8 @@ TRACE_ENTER("UnmapMMIO"); if (NULL != fPtr->mmio) { if (-1 == munmap((void *)((unsigned long)fPtr->mmio & PAGE_MASK), fPtr->mmio_len)) - perror("munmap mmio"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "munmap mmio: %s\n", strerror(errno)); fPtr->mmio = NULL; /* FIXME: restore var.accel_flags [geert] */ } @@ -646,16 +668,19 @@ /* set */ if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - perror("FBIOPUT_VSCREENINFO"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } /* read back */ if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) { - perror("FBIOGET_FSCREENINFO"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) { - perror("FBIOGET_VSCREENINFO"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } return TRUE; @@ -672,7 +697,8 @@ TRACE_ENTER("Save"); if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->saved_var))) - perror("FBIOGET_VSCREENINFO"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); } void @@ -682,7 +708,8 @@ TRACE_ENTER("Restore"); if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->saved_var))) - perror("FBIOPUT_VSCREENINFO"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); } /* -------------------------------------------------------------------- */ @@ -712,7 +739,8 @@ blue = (colors[indices[i]].blue << 8) | colors[indices[i]].blue; if (-1 == ioctl(fPtr->fd,FBIOPUTCMAP,(void*)&cmap)) - perror("ioctl FBIOPUTCMAP"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOPUTCMAP: %s\n", strerror(errno)); } } @@ -731,7 +759,8 @@ xfree2fbdev_timing(mode, &var); var.activate = FB_ACTIVATE_TEST; if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - perror("FBIOPUT_VSCREENINFO"); + xf86DrvMsg(scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return MODE_BAD; } return MODE_OK; @@ -746,7 +775,8 @@ TRACE_ENTER("SwitchMode"); xfree2fbdev_timing(mode, &fPtr->var); if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { - perror("FBIOPUT_VSCREENINFO"); + xf86DrvMsg(scrnIndex, X_ERROR, + "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } return TRUE; @@ -762,7 +792,8 @@ fPtr->var.xoffset = x; fPtr->var.yoffset = y; if (-1 == ioctl(fPtr->fd,FBIOPAN_DISPLAY,(void*)&fPtr->var)) - perror("ioctl FBIOPAN_DISPLAY"); + xf86DrvMsgVerb(scrnIndex,5, X_WARNING, + "FBIOPAN_DISPLAY: %s\n", strerror(errno)); } Bool @@ -813,7 +844,8 @@ } if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode)) - perror("ioctl FBIOBLANK"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOBLANK: %s\n", strerror(errno)); } Bool @@ -828,8 +860,11 @@ unblank = xf86IsUnblank(mode); - if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) + if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FBIOBLANK: %s\n", strerror(errno)); return FALSE; + } return TRUE; } Index: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c diff -u xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.10 xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.13 --- xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.10 Thu Dec 20 16:35:40 2001 +++ xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c Mon Sep 16 14:06:07 2002 @@ -6,7 +6,7 @@ * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.10 2001/12/20 21:35:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.13 2002/09/16 18:06:07 eich Exp $ */ #if 1 #include "misc.h" @@ -155,21 +155,8 @@ static Bool I2CStart(I2CBusPtr b, int timeout) { - int i, scl, sda; - - b->I2CPutBits(b, 1, 1); - b->I2CUDelay(b, b->RiseFallTime); - - for (i = timeout; i > 0; i -= b->RiseFallTime) { - b->I2CGetBits(b, &scl, &sda); - if (scl) break; - b->I2CUDelay(b, b->RiseFallTime); - } - - if (i <= 0) { - I2C_TIMEOUT(ErrorF("\ni2c: <[I2CStart(<%s>, %d) timeout]", b->BusName, timeout)); + if (!I2CRaiseSCL(b, 1, timeout)) return FALSE; - } b->I2CPutBits(b, 1, 0); b->I2CUDelay(b, b->HoldTime); @@ -660,13 +647,9 @@ break; } - if (d->pI2CBus->scrnIndex >= 0) - xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO, - "I2C device \"%s:%s\" removed.\n", - d->pI2CBus->BusName, d->DevName); - else - xf86Msg(X_INFO, "I2C device \"%s:%s\" removed.\n", - d->pI2CBus->BusName, d->DevName); + xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO, + "I2C device \"%s:%s\" removed.\n", + d->pI2CBus->BusName, d->DevName); if (unalloc) xfree(d); } @@ -704,12 +687,9 @@ d->NextDev = b->FirstDev; b->FirstDev = d; - if(b->scrnIndex >= 0) - xf86DrvMsg(b->scrnIndex, X_INFO, "I2C device \"%s:%s\" registered.\n", - b->BusName, d->DevName); - else - xf86Msg(X_INFO, "I2C device \"%s:%s\" registered.\n", - b->BusName, d->DevName); + xf86DrvMsg(b->scrnIndex, X_INFO, + "I2C device \"%s:%s\" registered at address 0x%02X.\n", + b->BusName, d->DevName, d->SlaveAddr); return TRUE; } @@ -796,11 +776,8 @@ } } - if (b->scrnIndex >= 0) - xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n", - b->BusName); - else - xf86Msg(X_INFO, "I2C bus \"%s\" removed.\n", b->BusName); + xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n", + b->BusName); if (unalloc) xfree(b); } @@ -865,11 +842,8 @@ b->NextBus = I2CBusList; I2CBusList = b; - if (b->scrnIndex >= 0) - xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n", - b->BusName); - else - xf86Msg(X_INFO, "I2C bus \"%s\" initialized.\n", b->BusName); + xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n", + b->BusName); return TRUE; } @@ -881,9 +855,9 @@ if (name != NULL) for (p = I2CBusList; p != NULL; p = p->NextBus) - if (scrnIndex < 0 || p->scrnIndex == scrnIndex) + if (scrnIndex < 0 || p->scrnIndex == scrnIndex) if (!strcmp(p->BusName, name)) return p; - + return NULL; } Index: xc/programs/Xserver/hw/xfree86/input/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/Imakefile:1.14 xc/programs/Xserver/hw/xfree86/input/Imakefile:1.16 --- xc/programs/Xserver/hw/xfree86/input/Imakefile:1.14 Sun Mar 5 14:26:46 2000 +++ xc/programs/Xserver/hw/xfree86/input/Imakefile Thu Oct 10 21:40:32 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/Imakefile,v 1.14 2000/03/05 19:26:46 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/Imakefile,v 1.16 2002/10/11 01:40:32 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -8,20 +8,10 @@ JOYSTICKDIR = joystick #endif -/* - * The keyboard directory only has a man page so far! The driver is - * still built in to the common layer. - */ -KBDDIR = keyboard - -SUBDIRS = XInputDrivers $(JOYSTICKDIR) $(KBDDIR) +SUBDIRS = XInputDrivers $(JOYSTICKDIR) DRIVERS = XInputDrivers -#ifndef OS2Architecture OBJS = `cat idriver.list` -#else -OBJS = ?? -#endif #if DoLoadableServer MakeSubdirs($(SUBDIRS)) Index: xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile:1.1 Sun Aug 12 18:48:43 2001 +++ xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile Tue Oct 15 21:47:01 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile,v 1.1 2001/08/12 22:48:43 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile,v 1.2 2002/10/16 01:47:01 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -8,7 +8,7 @@ DRIVER = calcomp -INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c diff -u xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c:1.5 xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c:1.8 --- xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c:1.5 Mon Nov 26 11:25:52 2001 +++ xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c Tue Jan 14 22:43:58 2003 @@ -31,7 +31,7 @@ * authorization from Martin Kroeker or Daveg GmbH. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c,v 1.5 2001/11/26 16:25:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c,v 1.8 2003/01/15 03:43:58 dawes Exp $ */ #define _CALCOMP_C_ /***************************************************************************** @@ -55,7 +55,7 @@ /***************************************************************************** * Variables without includable headers ****************************************************************************/ - #define DEBUG 1 +#define DEBUG 1 /***************************************************************************** * Local Variables ****************************************************************************/ @@ -631,6 +631,7 @@ if ((!local) || (!priv)) goto SetupProc_fail; + local->conf_idev = dev; xf86CollectInputOptions(local, default_options, NULL); @@ -723,6 +724,7 @@ local->dev = NULL; local->private = priv; local->private_flags = 0; + local->conf_idev = dev; local->history_size = xf86SetIntOption( local->options, "HistorySize", 0 ); local->flags |= XI86_CONFIGURED; Index: xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile:1.1 Fri Aug 17 09:27:55 2001 +++ xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile Tue Oct 15 21:47:02 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile,v 1.1 2001/08/17 13:27:55 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile,v 1.2 2002/10/16 01:47:02 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -8,7 +8,7 @@ DRIVER = dmc -INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile:1.4 Tue Jan 23 19:06:35 2001 +++ xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile Tue Oct 15 21:47:02 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile,v 1.4 2001/01/24 00:06:35 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile,v 1.5 2002/10/16 01:47:02 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -8,7 +8,7 @@ DRIVER = dynapro -INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/input/fpit/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/fpit/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/fpit/Imakefile Thu Nov 21 22:35:11 2002 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/fpit/Imakefile,v 1.1 2002/11/22 03:35:11 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86Fpit.c +OBJS = xf86Fpit.o + +DRIVER = fpit + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/fpit/fpit.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/fpit/fpit.man:1.1 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/fpit/fpit.man Thu Nov 21 22:35:12 2002 @@ -0,0 +1,124 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/fpit/fpit.man,v 1.1 2002/11/22 03:35:12 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH FPIT __drivermansuffix__ __vendorversion__ +.SH NAME +fpit \- Fujitsu Stylistic input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qfpit\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B fpit +is an XFree86 input driver for Fujitsu Stylistic Tablet PCs. +.PP +The +.B fpit +driver functions as a pointer input device, and may be used as the +X server's core pointer. +.SH SUPPORTED HARDWARE +This driver supports the touchscreen of the Stylistic LT and (with +special options) of the Stylistic 500, 1000 and 2300. + +Under Linux the Fujitsus serial port is not, by default, detected. +Therefore the following must be added to one of your start-up scripts. +(Either one of the X scripts, or to rc.local or similar). + +.TP 4 +.B setserial /dev/ttyS3 autoconfig +.TP 4 +.B setserial /dev/ttyS3 IRQ 15 baud_base 115200 port 0xfce8 + +.SH CONFIGURATION DETAILS +Please refer to XF86Config(5x) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The device supports the following options: +.RS 8 +.TP 4 +.B Option \fI"MaximumXPosition"\fP \fI"number"\fP +Sets the maximum X position, use this to callibrate your touchscreen's +right hand edge. +.TP 4 +.B Option \fI"MinimumXPosition"\fP \fI"number"\fP +Sets the minimum X position, use this to callibrate your touchscreen's +left hand edge. +.TP 4 +.B Option \fI"MaximumYPosition"\fP \fI"number"\fP +.TP 4 +.B Option \fI"MinimumYPosition"\fP \fI"number"\fP +Same as for X axis, but for Y axis. +.TP 4 +.B Option \fI"InvertX"\fP +.TP 4 +.B Option \fI"InvertY"\fP +Invert the specified axis. +.TP 4 +.B Option \fI"SwapXY"\fP +Swap the X and Y axis. +.TP 4 +.B Option \fI"Rotate"\fP \fI"CW"\fP +.B Option \fI"Rotate"\fP \fI"CWW"\fP +Manipulate the invert and swap options to match screen +rotations. +.TP 4 +.B Option \fI"DeviceName"\fP \fI"name"\fP +.B Option \fI"DeviceName"\fP \fI"name"\fP +sets the name of the X device. +.TP 4 +.B Option \fI"AlwaysCore"\fP \fI"on"\fP +enables the sharing of the core pointer. When this feature is enabled, the +device will take control of the core pointer (and thus will emit core events) +and at the same time will be able, when asked so, to report extended events. +You can use the last available integer feedback to control this feature. When +the value of the feedback is zero, the feature is disabled. The feature is +enabled for any other value. +.TP 4 +.B Option \fI"DebugLevel"\fP \fInumber \fP +sets the level of debugging info reported. +.TP 4 +.B Option \fI"BaudRate"\fP \fI"38400"\fP, \fI"19200"\fP or \fI"9600"\fP (default) +changes the serial link speed. +.RE + +Example, for Stylistic LT setup is: +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" mouse0 \*q +.B " Driver \*qfpit\*q" +.BI " Option \*qDevice\*q \*q"/dev/ttyS3 \*q +.B EndSection +.fi + +And for other Stylistic devices try: +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" mouse0 \*q +.B " Driver \*qfpit\*q" +.BI " Option \*qDevice\*q \*q"/dev/ttyS3 \*q +.BI " Option \*qBaudRate\*q \*q"19200 \*q +.BI " Option \*qMaximumXPosition\*q \*q"6250 \*q +.BI " Option \*qMaximumYPosition\*q \*q"4950 \*q +.BI " Option \*qMinimumXPosition\*q \*q"130 \*q +.BI " Option \*qMinimumYPosition\*q \*q"0 \*q +.BI " Option \*qInvertY\*q" +.B EndSection +.fi + + +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Original FPIT port: +Rob Tsuk <rob@tsuk.com> and John Apfelbaum <johnapf@linuxslate.com> + +X4 Port: Richard Miller-Smith <richard.miller-smith@philips.com>, +based on Elographics code from: Patrick Lecoanet + +X4.2 Cleanup: Alan Cox Index: xc/programs/Xserver/hw/xfree86/input/fpit/readme.txt diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/fpit/readme.txt:1.2 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/fpit/readme.txt Thu Nov 21 22:37:37 2002 @@ -0,0 +1,141 @@ +xf86Fpit.c +(and associated files). + +Documentation updated by John Apfelbaum, linuxslate.com Oct 2001 + +*** P L E A S E N O T E *** +* Due to a Hardrive failure, the version of this driver that was previously +* on the linuxslate.com website was lost. This is a version came from a +* directory on my development system that was marked "Works", and I belive it +* to be the latest version I worked on (about a year ago), but I have not had +* time to build from this source and verify this driver. +*** + +Supported Hardware: + + + Fujitsu Stylistic LT (Reported to work, but I have reason to belive that it does NOT.) + Fujistu Stylistic 500 (Should Work) + Fujistu Stylistic 1000 (Should Work) + Fujistu Stylistic 1200 (Should Work) + Fujistu Stylistic 2300 (Should Work) + +History and Contributors: + +- Steven Lang <tiger@tyger.org> wrote a Xinput extension for the AceCad Drawing Tablet. +- This was modified originaly by Rob Tsuk and John Apfelbaum (http://linuxslate.org/) to + produce a working version for the Stylistic 500 and 1000 using XFree86 3.3.6. + (This can be obtained from http://linuxslate.com) +- Richard Miller-Smith <Richard.Miller-Smith@philips.com> Merged the code from the above + project into the XFree86 4.0.2 Elographics driver by Patrick Lecoanet. +- John Apfelbaum continuted the work to produce a working XFree86 4.0.x driver for the + Stylistic 1200. + + +Please visit http://linuxslate.com for the latest information. + +License: + +Please visit http://XFree86.org for license information. + + * Copyright 1995, 1999 by Patrick Lecoanet, France. <lecoanet@cena.dgac.fr> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Patrick Lecoanet not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. Patrick Lecoanet makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + +Installation: + +THIS RELEASE IS FOR XFree86 Version 4.0.2. Hopefully it will also work +with other Version 4 systems. The source is written so that hopefully +it can be compiled under 3.3.6 - THIS HAS NOT BEEN TESTED (yet). + +Copied from original xf86fpit.c readme: + +1. Install and configure Linux w/o consideration of the digitizer tablet. +2. Get X working the way you want it. +3. Add or Change your appropriate startup scripts to include: + +setserial /dev/ttyS3 autoconfig +setserial /dev/ttyS3 IRQ 15 baud_base 115200 +(Some models may also have to specify: port 0xfce8) + + +New/Different for Ver 4.0.2 + +4. Copy fpit_drv.o to /usr/X11R6/lib/modules/input + +5. Add the following to your XF86Config(-4) file: + +Section "InputDevice" + Identifier "mouse0" + Driver "fpit" + Option "Device" "/dev/ttyS3" + Option "BaudRate" "19200" + Option "MaximumXPosition" "6250" + Option "MaximumYPosition" "4950" + Option "MinimumXPosition" "130" + Option "MinimumYPosition" "0" + Option "InvertY" +EndSection + +6. Remember to add this Input Device to the server description (Near the end of the file.) + +7. Start or restart X. + +8. If required adjust the Min/Max X/Y positions so that the pointer + tracks the pen correctly. + + +Hints if you are having problems (Thanks to Aron Hsiao): + +Problem 1: Side switch being reported as wild button numbers + (like 249 instead of 3): + +Solution: Add the following to your xinitrc: + + xsetpointer TOUCHSCREEN + xmodmap -e 'pointer = 1 2 3' + +This should be re-stating the defaults, but Aron Hsiao agrees that it appears +to be an XFree86 4.x bug. + +Problem 2: X Server crash during GUI startup (Particularly Gnome). + +Solution: You must have a regular mouse defined as the default pointer + even if no mouse is used. During startup, Gnome attempts to + set mouse acceleration for the default pointer. Since the + pendrivers are absolute pointers, and acceleration is meaningless, + they do not take well to attempts to set it :-) + +Problem 3: Jittery cursor and undesired mouse clicks (both buttons), + particuarly on the Stylistic 1200, and particuarly after the + system has warmed up. + +Solution: (Not really a solution) This is a hardware problem. Some + people have reported good results by modifying the CPU heatsink + on the Stylistic 1200. Putting the system to sleep when not + actively using it extends battery life, and keeps the system from + getting too hot. + +Bugs and Needed Work: + +(See above) + +X rotation (Portrait mode is not supported). -- I plan to add this soon. + +Adjusting the constants in the XF86Config(-4) is teedious and requires +multiple restarts of the X Window system. -- Somebody PLEASE write a +calibration program ! + + + + + +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/fpit/readme.txt,v 1.2 2002/11/22 03:37:37 dawes Exp $ */ Index: xc/programs/Xserver/hw/xfree86/input/fpit/xf86Fpit.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/fpit/xf86Fpit.c:1.2 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/fpit/xf86Fpit.c Thu Nov 21 22:37:37 2002 @@ -0,0 +1,580 @@ +/* + * Copyright 1995, 1999 by Patrick Lecoanet, France. <lecoanet@cena.dgac.fr> + * Copyright 2002, Red Hat <alan@redhat.com> + * + * This driver is a merge of the Elographics driver (from Patrick Lecoanet) and + * the driver for Fujitsu Pen Computers from Rob Tsuk and John Apfelbaum. + * + * Stylistic 500, 1000, 1200, 2300 Support fixed by John Apfelbaum + * June 2001 <johnapf@linuxlsate.com> + * + * Richard Miller-Smith <Richard.Miller-Smith@philips.com> + * + * Fixed up for XFree86 4.2, cleaned up the junk, cured crash on pointer + * setting. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Patrick Lecoanet not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The Authors make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * PATRICK LECOANET DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL PATRICK LECOANET BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/fpit/xf86Fpit.c,v 1.2 2002/11/22 03:37:37 dawes Exp $ */ + +#include <xf86Version.h> + +# ifndef XFree86LOADER +# include <unistd.h> +# include <errno.h> +# endif + +# include <misc.h> +# include <xf86.h> +# if !defined(DGUX) +# include <xf86_ansic.h> +# endif +# include <xf86_OSproc.h> +# include <xf86Xinput.h> +# include <exevents.h> + +# ifdef XFree86LOADER +# include <xf86Module.h> +# endif + + + +/* + *************************************************************************** + * + * Default constants. + * + *************************************************************************** + */ +#define FPIT_LINK_SPEED B19200 /* 19200 Baud */ +#define FPIT_PORT "/dev/ttyS3" + +#define FPIT_MAX_X 4100 +#define FPIT_MIN_X 0 +#define FPIT_MAX_Y 4100 +#define FPIT_MIN_Y 0 + +#define PHASING_BIT 0x80 +#define PROXIMITY_BIT 0x40 +/*#define TABID_BIT 0x20 */ +#define XSIGN_BIT 0x10 +#define YSIGN_BIT 0x08 +#define BUTTON_BITS 0x07 +#define COORD_BITS 0x7f + +/* + *************************************************************************** + * + * Protocol constants. + * + *************************************************************************** + */ +#define FPIT_PACKET_SIZE 5 +#define BUFFER_SIZE (FPIT_PACKET_SIZE*20) + +/* + *************************************************************************** + * + * Device private records. + * + *************************************************************************** + */ +typedef struct { + char *fpitDev; /* device file name */ + int screen_width; + int screen_height; + int screen_no; + int fpitInc; /* increment between transmits */ + int fpitButTrans; /* button translation flags */ + int fpitOldX; /* previous X position */ + int fpitOldY; /* previous Y position */ + int fpitOldProximity; /* previous proximity */ + int fpitOldButtons; /* previous buttons state */ + int fpitMinX; /* min X value */ + int fpitMinY; /* min Y value */ + int fpitMaxX; /* max X value */ + int fpitMaxY; /* max Y value */ + int fpitInvX; /* Invert X axis */ + int fpitInvY; /* Invert Y axis */ + int fpitRes; /* resolution in lines per inch */ + int flags; /* various flags */ + int fpitIndex; /* number of bytes read */ + int fpitBaud; /* Baud rate of device */ + unsigned char fpitData[BUFFER_SIZE]; /* data read on the device */ + int fpitSwapXY; /* swap X and Y values */ +} FpitPrivateRec, *FpitPrivatePtr; + + + + +/* + *************************************************************************** + * + * xf86FpitConvert -- + * Convert extended valuators to x and y suitable for core motion + * events. Return True if ok and False if the requested conversion + * can't be done for the specified valuators. + * + *************************************************************************** + */ +static Bool xf86FpitConvert(LocalDevicePtr local, int first, int num, int v0, int v1, int v2, int v3, int v4, int v5, int *x, int *y) +{ + FpitPrivatePtr priv = (FpitPrivatePtr) local->private; + if (first != 0 || num != 2) { + return FALSE; + } + + if (priv->fpitSwapXY != 0) { + *x = xf86ScaleAxis(v1, 0, priv->screen_width, priv->fpitMinY, priv->fpitMaxY); + *y = xf86ScaleAxis(v0, 0, priv->screen_height, priv->fpitMinX, priv->fpitMaxX); + } else { + *x = xf86ScaleAxis(v0, 0, priv->screen_width, priv->fpitMinX, priv->fpitMaxX); + *y = xf86ScaleAxis(v1, 0, priv->screen_height, priv->fpitMinY, priv->fpitMaxY); + } + /* + * Need to check if still on the correct screen. + * This call is here so that this work can be done after + * calib and before posting the event. + */ + xf86XInputSetScreen(local, priv->screen_no, *x, *y); + return TRUE; +} + +/* +** xf86FpitReadInput +** Reads from the Fpit and posts any new events to the server. +*/ +static void xf86FpitReadInput(LocalDevicePtr local) +{ + FpitPrivatePtr priv = (FpitPrivatePtr) local->private; + int len, loop, found; + int is_core_pointer, is_absolute; + int x, y, buttons, prox; + DeviceIntPtr device; + /* Read data into buffer */ + len = xf86ReadSerial(local->fd, priv->fpitData, BUFFER_SIZE); + if (len <= 0) { + Error("error reading FPIT device"); + priv->fpitIndex = 0; + return; + } + + + /* Since the Fujitsu only delivers data in an absolute mode, we + can look through the data backwards to find the last full and valid + position. (This may make cursor movement a bit faster) */ + + priv->fpitIndex += len; + found = 0; + for (loop = priv->fpitIndex - 5; loop >= 0; loop--) { + if (priv->fpitData[loop] & 0x80) { + found = 1; + break; + } + } + + if (!found) { + /* Wait for our next call when we should have some more data */ + + /* Check to see if the buffer is filling up - if so do something + about it */ + /* if (priv->fpitIndex > BUFFER_SIZE - 5) { + memmove(priv->fpitData, priv->fpitData+priv->fpitIndex-5, 5) ; + priv->fpitIndex = 5 ; + } + */ + return; + } + + +/* Format of 5 bytes data packet for Fpit Tablets + Byte 1 + bit 7 Phasing bit always 1 + bit 6 Switch status change + bit 5 Proximity + bit 4 Always 0 + bit 3 Test data + bit 2 Sw3 (2nd side sw) + bit 1 Sw2 (1st side sw) + bit 0 Sw1 (Pen tip sw) + + Byte 2 + bit 7 Always 0 + bits 6-0 = X6 - X0 + + Byte 3 + bit 7 Always 0 + bits 6-0 = X13 - X7 + + Byte 4 + bit 7 Always 0 + bits 6-0 = Y6 - Y0 + + Byte 5 + bit 7 Always 0 + bits 6-0 = Y13 - Y7 +*/ + + x = (int) (priv->fpitData[loop + 1] & 0x7f) + ((int) (priv->fpitData[loop + 2] & 0x7f) << 7); + y = (int) (priv->fpitData[loop + 3] & 0x7f) + ((int) (priv->fpitData[loop + 4] & 0x7f) << 7); + /* Add in any offsets */ + if (priv->fpitInvX) + x = priv->fpitMaxX - x + priv->fpitMinX; + if (priv->fpitInvY) + y = priv->fpitMaxY - y + priv->fpitMinY; + prox = (priv->fpitData[loop] & PROXIMITY_BIT) ? 0 : 1; + buttons = (priv->fpitData[loop] & BUTTON_BITS); + priv->fpitIndex = 0; + device = local->dev; + is_absolute = 1; + is_core_pointer = xf86IsCorePointer(device); + /* coordonates are ready we can send events */ + if (prox) { + if (!(priv->fpitOldProximity)) + if (!is_core_pointer) + xf86PostProximityEvent(device, 1, 0, 2, x, y); + if ((priv->fpitOldX != x) || (priv->fpitOldY != y)) { + if (priv->fpitOldProximity) { + xf86PostMotionEvent(device, 1, 0, 2, x, y); + } + } + + if (priv->fpitOldButtons != buttons) { + int delta; + delta = buttons - priv->fpitOldButtons; + while (delta) { + int id; + id = ffs(delta); + delta &= ~(1 << (id - 1)); + xf86PostButtonEvent(device, 1, id, (buttons & (1 << (id - 1))), 0, 2, x, y); + } + } + + priv->fpitOldButtons = buttons; + priv->fpitOldX = x; + priv->fpitOldY = y; + priv->fpitOldProximity = prox; + } else { /* !PROXIMITY */ + /* Any changes in buttons are ignored when !proximity */ + if (!is_core_pointer) + if (priv->fpitOldProximity) + xf86PostProximityEvent(device, 0, 0, 2, x, y); + priv->fpitOldProximity = 0; + } + +} + +static void xf86FpitPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl) +{ + /* I have no clue what this does, except that registering it stops the + X server segfaulting in ProcGetPointerMapping() + Ho Hum. + */ +} + + +/* + *************************************************************************** + * + * xf86FpitControl -- + * + *************************************************************************** + */ +static Bool xf86FpitControl(DeviceIntPtr dev, int mode) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + FpitPrivatePtr priv = (FpitPrivatePtr) (local->private); + unsigned char map[] = { + 0, 1 + }; + + + switch (mode) { + case DEVICE_INIT: + { + + if (priv->screen_no >= screenInfo.numScreens || priv->screen_no < 0) { + priv->screen_no = 0; + } + priv->screen_width = screenInfo.screens[priv->screen_no]->width; + priv->screen_height = screenInfo.screens[priv->screen_no]->height; + /* + * Device reports button press for up to 1 button. + */ + if (InitButtonClassDeviceStruct(dev, 1, map) == FALSE) { + ErrorF("Unable to allocate Fpit touchscreen ButtonClassDeviceStruct\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct(dev) == FALSE) { + ErrorF("Unable to allocate Fpit touchscreen FocusClassDeviceStruct\n"); + return !Success; + } + + if(InitPtrFeedbackClassDeviceStruct(dev, xf86FpitPtrCtrl) == FALSE) { + ErrorF("Unable to allocate PtrFeedBackClassDeviceStruct\n"); + } + + /* + * Device reports motions on 2 axes in absolute coordinates. + * Axes min and max values are reported in raw coordinates. + * Resolution is computed roughly by the difference between + * max and min values scaled from the approximate size of the + * screen to fit one meter. + */ + if (InitValuatorClassDeviceStruct(dev, 2, xf86GetMotionEvents, local->history_size, Absolute) == FALSE) { + ErrorF("Unable to allocate Elographics touchscreen ValuatorClassDeviceStruct\n"); + return !Success; + } else { + InitValuatorAxisStruct(dev, 0, priv->fpitMinX, priv->fpitMaxX, 9500, 0 /* min_res */ , + 9500 /* max_res */ ); + InitValuatorAxisStruct(dev, 1, priv->fpitMinY, priv->fpitMaxY, 10500, 0 /* min_res */ , + 10500 /* max_res */ ); + } + + if (InitFocusClassDeviceStruct(dev) == FALSE) { + ErrorF("Unable to allocate Fpit touchscreen FocusClassDeviceStruct\n"); + } + /* + * Allocate the motion events buffer. + */ + xf86MotionHistoryAllocate(local); + /* + * This once has caused the server to crash after doing an xalloc & strcpy ?? + */ + return Success; + } + + case DEVICE_ON: + if (local->fd < 0) { + local->fd = xf86OpenSerial(local->options); + if (local->fd < 0) { + Error("Unable to open Fpit touchscreen device"); + return !Success; + } + + xf86AddEnabledDevice(local); + dev->public.on = TRUE; + } + return Success; + + /* + * Deactivate the device. After this, the device will not emit + * events until a subsequent DEVICE_ON. Thus, we can momentarily + * close the port. + */ + case DEVICE_OFF: + dev->public.on = FALSE; + if (local->fd >= 0) { + xf86RemoveEnabledDevice(local); + } + xf86CloseSerial(local->fd); + local->fd = -1; + return Success; + /* + * Final close before server exit. This is used during server shutdown. + * Close the port and free all the resources. + */ + case DEVICE_CLOSE: + dev->public.on = FALSE; + if (local->fd >= 0) { + RemoveEnabledDevice(local->fd); + } + xf86CloseSerial(local->fd); + local->fd = -1; + return Success; + default: + ErrorF("unsupported mode=%d\n", mode); + return !Success; + } +} + +/* + *************************************************************************** + * + * xf86FpitAllocate -- + * + *************************************************************************** + */ +static LocalDevicePtr xf86FpitAllocate(InputDriverPtr drv) +{ + LocalDevicePtr local; + FpitPrivatePtr priv; + priv = xalloc(sizeof(FpitPrivateRec)); + if (!priv) + return NULL; + local = xf86AllocateInput(drv, 0); + if (!local) { + xfree(priv); + return NULL; + } + + priv->fpitDev = strdup(FPIT_PORT); + priv->screen_no = 0; + priv->screen_width = -1; + priv->screen_height = -1; + priv->fpitMinX = FPIT_MIN_X; + priv->fpitMaxX = FPIT_MAX_X; + priv->fpitMinY = FPIT_MIN_Y; + priv->fpitMaxY = FPIT_MAX_Y; + priv->fpitOldX = priv->fpitOldY = -1; + priv->fpitOldButtons = 0; + priv->fpitOldProximity = 0; + priv->fpitIndex = 0; + priv->fpitSwapXY = 0; + local->name = XI_TOUCHSCREEN; + local->flags = 0 /* XI86_NO_OPEN_ON_INIT */ ; + local->device_control = xf86FpitControl; + local->read_input = xf86FpitReadInput; + local->control_proc = NULL; + local->close_proc = NULL; + local->switch_mode = NULL; + local->conversion_proc = xf86FpitConvert; + local->reverse_conversion_proc = NULL; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->type_name = "Fujitsu Stylistic"; + local->history_size = 0; + return local; +} + +static void xf86FpitUninit(InputDriverPtr drv, LocalDevicePtr local, int flags) +{ + FpitPrivatePtr priv = (FpitPrivatePtr) local->private; + xf86FpitControl(local->dev, DEVICE_OFF); + xfree(priv->fpitDev); + xfree(priv); + xfree(local->name); + xfree(local); + xf86DeleteInput(local, 0); +} + +static const char *default_options[] = { + "BaudRate", "19200", "StopBits", "0", "DataBits", "8", "Parity", "None", "Vmin", "10", "Vtime", "1", "FlowControl", "None", NULL +}; + +static InputInfoPtr xf86FpitInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + LocalDevicePtr local = NULL; + FpitPrivatePtr priv = NULL; + char *str; + + local = xf86FpitAllocate(drv); + if (!local) + return NULL; + + priv = local->private; + local->conf_idev = dev; + xf86CollectInputOptions(local, default_options, NULL); + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + str = xf86FindOptionValue(local->options, "Device"); + if (!str) { + xf86Msg(X_ERROR, "%s: No Device specified in FPIT module config.\n", dev->identifier); + if (priv) { + if (priv->fpitDev) { + xfree(priv->fpitDev); + } + xfree(priv); + } + return local; + } + priv->fpitDev = strdup(str); + local->name = xf86SetStrOption(local->options, "DeviceName", XI_TOUCHSCREEN); + xf86Msg(X_CONFIG, "FPIT device name: %s\n", local->name); + priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", 0); + xf86Msg(X_CONFIG, "Fpit associated screen: %d\n", priv->screen_no); + priv->fpitMaxX = xf86SetIntOption(local->options, "MaximumXPosition", 4100); + xf86Msg(X_CONFIG, "FPIT maximum x position: %d\n", priv->fpitMaxX); + priv->fpitMinX = xf86SetIntOption(local->options, "MinimumXPosition", 0); + xf86Msg(X_CONFIG, "FPIT minimum x position: %d\n", priv->fpitMinX); + priv->fpitMaxY = xf86SetIntOption(local->options, "MaximumYPosition", 4100); + xf86Msg(X_CONFIG, "FPIT maximum y position: %d\n", priv->fpitMaxY); + priv->fpitMinY = xf86SetIntOption(local->options, "MinimumYPosition", 0); + xf86Msg(X_CONFIG, "FPIT minimum y position: %d\n", priv->fpitMinY); + priv->fpitInvX = xf86SetBoolOption(local->options, "InvertX", 0); + priv->fpitInvY = xf86SetBoolOption(local->options, "InvertY", 0); + priv->fpitSwapXY = xf86SetBoolOption(local->options, "SwapXY", 0); + str = xf86SetStrOption(local->options, "Rotate", 0); + if (!xf86NameCmp(str, "CW")) { + priv->fpitInvX = 1; + priv->fpitInvY = 1; + priv->fpitSwapXY = 1; + } else if (!xf86NameCmp(str, "CCW")) { + priv->fpitInvX = 0; + priv->fpitInvY = 0; + priv->fpitSwapXY = 1; + } + xf86Msg(X_CONFIG, "FPIT invert X axis: %s\n", priv->fpitInvX ? "Yes" : "No"); + xf86Msg(X_CONFIG, "FPIT invert Y axis: %s\n", priv->fpitInvY ? "Yes" : "No"); + xf86Msg(X_CONFIG, "FPIT swap X and Y axis: %s\n", priv->fpitSwapXY ? "Yes" : "No"); + /* mark the device configured */ + local->flags |= XI86_CONFIGURED; + return local; +} + +#ifdef XFree86LOADER +static +#endif +InputDriverRec FPIT = { + 1, /* driver version */ + "fpit", /* driver name */ + NULL, /* identify */ + xf86FpitInit, /* pre-init */ + xf86FpitUninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + +#ifdef XFree86LOADER +static pointer Plug(pointer module, pointer options, int *errmaj, int *errmin) +{ + xf86AddInputDriver(&FPIT, module, 0); + return module; +} + +static void Unplug(pointer p) +{ +} + +static XF86ModuleVersionInfo version_rec = { + "fpit", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XF86_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_XINPUT, ABI_XINPUT_VERSION, MOD_CLASS_XINPUT, + {0, 0, 0, 0} +}; + +/* + * This is the entry point in the module. The name + * is setup after the pattern <module_name>ModuleData. + * Do not change it. + */ +XF86ModuleData fpitModuleData = { + &version_rec, Plug, Unplug +}; +#endif Index: xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c diff -u xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c:1.5 xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c:1.6 --- xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c:1.5 Wed Dec 26 16:51:58 2001 +++ xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c Mon Feb 25 15:17:23 2002 @@ -35,7 +35,7 @@ * TORTIOUS ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c,v 1.5 2001/12/26 21:51:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c,v 1.6 2002/02/25 20:17:23 dawes Exp $ */ #include <xf86Version.h> @@ -1779,7 +1779,7 @@ /* a tool */ }; -XF86ModuleData HyperPenModuleData = {&xf86HypVersionRec, +XF86ModuleData hyperpenModuleData = {&xf86HypVersionRec, xf86HypPlug, xf86HypUnplug}; Index: xc/programs/Xserver/hw/xfree86/input/jamstudio/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/jamstudio/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/jamstudio/Imakefile Sun Nov 10 20:18:08 2002 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/jamstudio/Imakefile,v 1.1 2002/11/11 01:18:08 alanh Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = js_x.c +OBJS = js_x.o + +DRIVER = js_x + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.c:1.2 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.c Fri Nov 15 11:05:25 2002 @@ -0,0 +1,362 @@ +/* + * Copyright 2002 by Brian Goines (bgoines78@comcast.net) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Brian Goines not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Brian Goines makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * BRIAN GOINES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.c,v 1.2 2002/11/15 16:05:25 tsi Exp $ */ + +#include <sys/types.h> +#include "xf86Version.h" +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) +#define XFREE86_V4 1 +#endif +#include "misc.h" +#include "xf86.h" +#include "xf86_ansic.h" +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" /* Needed for InitValuator/Proximity stuff */ +#include "mipointer.h" + +#ifdef XFree86LOADER +#include "xf86Module.h" +#endif + +#define JSX_XCOORD 65584 +#define JSX_YCOORD 65585 +#define JSX_PRESS 852016 +#define JSX_BTN 852034 + +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + +#ifdef XFREE86_V4 + +struct hiddev_event +{ + unsigned hid; + signed int value; +}; + +typedef struct +{ + int jsxFd; + int jsxTimeout; + char *jsxDevice; + int jsxOldX; + int jsxOldY; + int jsxOldPress; + int jsxOldBtn; + int jsxOldNotify; + int jsxMaxX; + int jsxMaxY; + int jsxMinX; + int jsxMinY; + int jsxPressMax; + int jsxPressMin; + int jsxPressDiv; +} +JS_XDevRec, *JS_XDevPtr; + +static void +xf86JS_XReadInput(LocalDevicePtr local) +{ + JS_XDevPtr priv = local->private; + struct hiddev_event event; + int x = priv->jsxOldX, y = priv->jsxOldY, press = priv->jsxOldPress; + int btn = priv->jsxOldBtn, len = 0; + int btn_notify = priv->jsxOldNotify; + +#if 0 + SYSCALL(len = read(local->fd, &event, sizeof(struct hiddev_event))); + if (len < sizeof(struct hiddev_event)) + return; +#endif + while ((len = read(local->fd, &event, sizeof(struct hiddev_event))) + == sizeof(struct hiddev_event)) { + switch (event.hid) { + case JSX_XCOORD: + x = event.value; + break; + case JSX_YCOORD: + y = event.value; + break; + case JSX_PRESS: + press = event.value / priv->jsxPressDiv; + break; + case JSX_BTN: + priv->jsxOldBtn = btn = event.value; + break; + } + } + x = x > 0 ? x : 0; + x = x < priv->jsxMaxX ? x : priv->jsxMaxX; + y = y > 0 ? y : 0; + y = y < priv->jsxMaxY ? y : priv->jsxMaxY; + press = press > 0 ? press : 0; + press = press < priv->jsxPressMax ? press : priv->jsxPressMax; + + if ((press > priv->jsxPressMin) && (btn == 1)) + btn_notify = 1; + else + btn_notify = 0; + + if ((x != priv->jsxOldX) || (y != priv->jsxOldY) + || (press != priv->jsxOldPress)) { + xf86PostMotionEvent(local->dev, 1, 0, 3, x, y, press); + priv->jsxOldX = x; + priv->jsxOldY = y; + priv->jsxOldPress = press; + } + if (btn_notify != priv->jsxOldNotify) { + xf86PostButtonEvent(local->dev, 0, 1, btn_notify, 0, 3, x, y, press); + priv->jsxOldNotify = btn_notify; + } +} + +static int +xf86JS_XConnect(DeviceIntPtr pJS_X) +{ + LocalDevicePtr local = (LocalDevicePtr) pJS_X->public.devicePrivate; + JS_XDevPtr priv = local->private; + + local->fd = xf86OpenSerial(local->options); + InitValuatorAxisStruct(pJS_X, 0, priv->jsxMinX, priv->jsxMaxX, + priv->jsxMaxX / 7.5, 0, priv->jsxMaxX / 7.5); + InitValuatorAxisStruct(pJS_X, 1, priv->jsxMinY, priv->jsxMaxY, + priv->jsxMaxY / 5.5, 0, priv->jsxMaxY / 5.5); + InitValuatorAxisStruct(pJS_X, 2, priv->jsxPressMin, priv->jsxPressMax, + 128, 0, 128); + return (local->fd > 0); +} + +static Bool +xf86JS_XConvert(LocalDevicePtr local, int first, int num, int v0, int v1, + int v2, int v3, int v4, int v5, int *x, int *y) +{ + JS_XDevPtr priv = local->private; + int width, height; + int deltaX, deltaY; + + width = miPointerCurrentScreen()->width; + height = miPointerCurrentScreen()->height; +/* +deltaX=(float)width/priv->jsxMaxX; deltaY=(float)height/priv->jsxMaxY; +*/ + deltaX = priv->jsxMaxX / width; + deltaY = priv->jsxMaxY / height; + *x = v0 / deltaX; + *y = v1 / deltaY; + xf86XInputSetScreen(local, 0, *x, *y); + return TRUE; +} + +static void +xf86JS_XControlProc(DeviceIntPtr device, PtrCtrl * ctrl) +{ + return; +} + +static int +xf86JS_XProc(DeviceIntPtr pJS_X, int operation) +{ + LocalDevicePtr local = (LocalDevicePtr) pJS_X->public.devicePrivate; + int nbaxes = 3; /* X Y Pressure */ + int nbuttons = 1; /* This this is necessary for most apps to work. */ + CARD8 map[2] = { 0, 1 }; + + switch (operation) { + case DEVICE_INIT: + if (InitButtonClassDeviceStruct(pJS_X, nbuttons, map) == FALSE) + return !Success; + if (InitFocusClassDeviceStruct(pJS_X) == FALSE) + return !Success; + if (InitPtrFeedbackClassDeviceStruct(pJS_X, xf86JS_XControlProc) == + FALSE) + return !Success; + if (InitProximityClassDeviceStruct(pJS_X) == FALSE) + return !Success; + if (InitValuatorClassDeviceStruct(pJS_X, nbaxes, xf86GetMotionEvents, + local->history_size, + Absolute | OutOfProximity) == FALSE) + return !Success; + else + xf86MotionHistoryAllocate(local); + xf86JS_XConnect(pJS_X); + break; + case DEVICE_ON: + if (local->fd == -1) + xf86JS_XConnect(pJS_X); + xf86AddEnabledDevice(local); + pJS_X->public.on = TRUE; + break; + case DEVICE_OFF: + if (local->fd > 0) + xf86RemoveEnabledDevice(local); + case DEVICE_CLOSE: + if (local->fd > 0) { + SYSCALL(close(local->fd)); + local->fd = -1; + } + break; + default: + xf86Msg(X_ERROR, "JamStudio: Unhandled operation number %d.\n", + operation); + break; + } + return Success; +} + +static int +xf86JS_XChangeControl(LocalDevicePtr local, xDeviceCtl * control) +{ + return Success; +} + +static int +xf86JS_XSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ + return Success; +} + +static LocalDevicePtr +xf86JS_XAllocate(InputDriverPtr drv) +{ + LocalDevicePtr local = xf86AllocateInput(drv, 0); + JS_XDevPtr priv = xalloc(sizeof(JS_XDevRec)); + + memset(priv, 0, sizeof(JS_XDevRec)); + local->name = "JAMSTUDIO"; + local->flags = 0; + local->device_control = xf86JS_XProc; + local->read_input = xf86JS_XReadInput; + local->close_proc = NULL; + local->control_proc = xf86JS_XChangeControl; + local->switch_mode = xf86JS_XSwitchMode; + local->conversion_proc = xf86JS_XConvert; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->type_name = "JamStudio"; + local->history_size = 0; + local->old_x = local->old_y = -1; + + priv->jsxFd = -1; + priv->jsxTimeout = 0; + priv->jsxDevice = NULL; + priv->jsxOldX = -1; + priv->jsxOldY = -1; + priv->jsxOldPress = priv->jsxOldBtn = priv->jsxOldNotify = -1; + priv->jsxMaxX = 8000; + priv->jsxMaxY = 6000; + priv->jsxMinX = 0; + priv->jsxMinY = 0; + priv->jsxPressMin = 5; + priv->jsxPressMax = 127; + priv->jsxPressDiv = 2; + + return local; +} + +static void +xf86JS_XUnInit(InputDriverPtr drv, LocalDevicePtr local, int flags) +{ + JS_XDevPtr priv = local->private; + + xf86JS_XProc(local->dev, DEVICE_CLOSE); + xfree(priv); + xf86DeleteInput(local, 0); +} + +static InputInfoPtr +xf86JS_XInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + LocalDevicePtr local = NULL; + JS_XDevPtr priv = NULL; + pointer options; + + if ((local = xf86JS_XAllocate(drv)) == NULL) { + xf86Msg(X_ERROR, "Could not allocate local device.\n"); + return NULL; + } + if (local->private == NULL) { + xf86Msg(X_ERROR, "Could not allocate private structure.\n"); + xfree(local); + return NULL; + } + local->conf_idev = dev; + xf86CollectInputOptions(local, NULL, NULL); + options = local->options; + local->name = dev->identifier; + priv = (JS_XDevPtr) local->private; + priv->jsxDevice = xf86FindOptionValue(options, "Device"); + xf86ProcessCommonOptions(local, local->options); + if (!priv->jsxDevice) { + xf86Msg(X_ERROR, "JamStudio: No Device specified.\n"); + return NULL; + } + priv->jsxMaxX = xf86SetIntOption(options, "MaxX", 8000); + priv->jsxMaxY = xf86SetIntOption(options, "MaxY", 6000); + priv->jsxMinX = xf86SetIntOption(options, "MinX", 0); + priv->jsxMinY = xf86SetIntOption(options, "MinY", 0); + priv->jsxPressMax = xf86SetIntOption(options, "PressMax", 127); + priv->jsxPressMin = xf86SetIntOption(options, "PressMin", 5); + priv->jsxPressDiv = xf86SetIntOption(options, "PressDiv", 2); + local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED; + return (local); +} + +InputDriverRec JAMSTUDIO = + { 1, "js_x", NULL, xf86JS_XInit, xf86JS_XUnInit, NULL, 0 }; + +#ifdef XFree86LOADER + +static void +xf86JS_XUnplug(pointer p) +{ + return; +} + +static pointer +xf86JS_XPlug(pointer module, pointer options, int *errmaj, int *errmin) +{ + xf86AddInputDriver(&JAMSTUDIO, module, 0); + return module; +} + +static XF86ModuleVersionInfo xf86JS_XVersionRec = { + "js_x", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ +}; + +XF86ModuleData js_xModuleData = { &xf86JS_XVersionRec, + xf86JS_XPlug, + xf86JS_XUnplug +}; +#endif +#endif Index: xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.man:1.2 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.man Sun Feb 23 22:24:15 2003 @@ -0,0 +1,67 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/jamstudio/js_x.man,v 1.2 2003/02/24 03:24:15 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH JS_X __drivermansuffix__ __vendorversion__ +.SH NAME +js_x \- JamStudio input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qjs_x\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +.BI " Option \*qMaxX\*q \*q" int \*q +.BI " Option \*qMaxY\*q \*q" int \*q +.BI " Option \*qMinX\*q \*q" int \*q +.BI " Option \*qMinY\*q \*q" int \*q +.BI " Option \*qPressMax\*q \*q" int \*q +.BI " Option \*qPressMin\*q \*q" int \*q +.BI " Option \*qPressDiv\*q \*q" int \*q +.B EndSection +.fi +.SH DESCRIPTION +.B js_x +is an XFree86 input driver for JamStudio devices. +.PP +The +.B js_x +driver functions as a pointer input device, and may be used as the +X server's core pointer. +.SH SUPPORTED HARDWARE +This driver supports the KB-Gear JamStudio pentablet. +This X-Input driver should work on any OS supporting the hiddev raw USB HID driver. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.RS 8 +.TP 4 +.B Option \fI"Device"\fP \fI"path"\fP +sets the path to the raw HID device to which the tablet was assigned. +This option is mandatory. +.TP +.B Option \fI"MinX"\fP \fI"int"\fP +.TP +.B Option \fI"MaxX"\fP \fI"int"\fP +.TP +.B Option \fI"MinY"\fP \fI"int"\fP +.TP +.B Option \fI"MaxY"\fP \fI"int"\fP +sets the minimum and maximum values returned for the absolute X,Y axis of the pen tablet. These values default to 0-8000 for X and 0-6000 for Y. It should generally be safe to leave these values untouched. +.TP +.B Option \fI"PressMin\fP \fI"int"\fP +.TP +.B Option \fI"PressMax\fP \fI"int"\fP +sets the minimum and maximum values returned for the pressure sensitive tip. These values default to 0-127. It should generally be safe to leave these values untouched. +.TP 4 +.B Option \fI"PressDiv"\fP \fI"int"\fP +sets the divider for the returned pressure value. This option will allow you to return a smaller set of values for the pressure sensitive tip allowing for finer control. The returned value is computed as follows: +.RS +.TP +\fIX / PressDiv = returned value\fP +where X equals the value read from the tablet. +.RE +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Brian Goines <bgoines78@comcast.net> Index: xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile:1.2 Tue Jan 23 19:06:36 2001 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile Thu Oct 10 21:40:32 2002 @@ -1,11 +1,32 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile,v 1.2 2001/01/24 00:06:36 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile,v 1.3 2002/10/11 01:40:32 dawes Exp $ #define IHaveModules #include <Server.tmpl> -DRIVER = keyboard +SRCS = kbd.c +OBJS = kbd.o +DRIVER = kbd + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + #if !defined(XF86DriverSDK) InstallModuleManPage($(DRIVER)) +InstallModuleManPage(keyboard) #endif +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.c:1.7 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.c Mon Feb 17 11:08:29 2003 @@ -0,0 +1,770 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.c,v 1.7 2003/02/17 16:08:29 dawes Exp $ */ + +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * Author: Ivan Pascal. + * + * Based on the code from + * xf86Config.c which is + * Copyright 1991-2002 by The XFree86 Project, Inc. + * Copyright 1997 by Metro Link, Inc. + * xf86Events.c and xf86Io.c which are + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + */ + +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" + +#include "xf86.h" +#include "atKeynames.h" +#include "xf86Privstr.h" + +#ifdef XINPUT +#include "XI.h" +#include "XIproto.h" +#include "extnsionst.h" +#include "extinit.h" +#else +#include "inputstr.h" +#endif + +#include "xf86Xinput.h" +#include "xf86_OSproc.h" +#include "xf86OSKbd.h" +#include "xf86_ansic.h" +#include "compiler.h" + +#ifdef XKB +#include <X11/extensions/XKB.h> +#include <X11/extensions/XKBstr.h> +#include <X11/extensions/XKBsrv.h> +#endif + +#define CAPSFLAG 1 +#define NUMFLAG 2 +#define SCROLLFLAG 4 +#define MODEFLAG 8 +#define COMPOSEFLAG 16 + +static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); +static int KbdProc(DeviceIntPtr device, int what); +static int KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); +static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused); +static void PostKbdEvent(InputInfoPtr pInfo, unsigned int key, Bool down); + +static void InitKBD(InputInfoPtr pInfo, Bool init); +static void SetXkbOption(InputInfoPtr pInfo, char *name, char **option); +static void UpdateLeds(InputInfoPtr pInfo); + +#undef KEYBOARD +InputDriverRec KEYBOARD = { + 1, + "kbd", + NULL, + KbdPreInit, + NULL, + NULL, + 0 +}; + +typedef enum { + OPTION_ALWAYS_CORE, + OPTION_SEND_CORE_EVENTS, + OPTION_CORE_KEYBOARD, + OPTION_DEVICE, + OPTION_PROTOCOL, + OPTION_AUTOREPEAT, + OPTION_XLEDS, + OPTION_XKB_DISABLE, + OPTION_XKB_KEYMAP, + OPTION_XKB_KEYCODES, + OPTION_XKB_TYPES, + OPTION_XKB_COMPAT, + OPTION_XKB_SYMBOLS, + OPTION_XKB_GEOMETRY, + OPTION_XKB_RULES, + OPTION_XKB_MODEL, + OPTION_XKB_LAYOUT, + OPTION_XKB_VARIANT, + OPTION_XKB_OPTIONS, + OPTION_PANIX106, + OPTION_CUSTOM_KEYCODES +} KeyboardOpts; + +static const OptionInfoRec KeyboardOptions[] = { + { OPTION_ALWAYS_CORE, "AlwaysCore", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SEND_CORE_EVENTS, "SendCoreEvents", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CORE_KEYBOARD, "CoreKeyboard", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DEVICE, "Device", OPTV_STRING, {0}, FALSE }, + { OPTION_PROTOCOL, "Protocol", OPTV_STRING, {0}, FALSE }, + { OPTION_AUTOREPEAT, "AutoRepeat", OPTV_STRING, {0}, FALSE }, + { OPTION_XLEDS, "XLeds", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_DISABLE, "XkbDisable", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_XKB_KEYMAP, "XkbKeymap", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_KEYCODES, "XkbKeycodes", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_TYPES, "XkbTypes", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_COMPAT, "XkbCompat", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_SYMBOLS, "XkbSymbols", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_GEOMETRY, "XkbGeometry", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_RULES, "XkbRules", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_MODEL, "XkbModel", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_LAYOUT, "XkbLayout", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_VARIANT, "XkbVariant", OPTV_STRING, {0}, FALSE }, + { OPTION_XKB_OPTIONS, "XkbOptions", OPTV_STRING, {0}, FALSE }, + { OPTION_PANIX106, "Panix106", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CUSTOM_KEYCODES, "CustomKeycodes", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +static const char *kbdDefaults[] = { + "Protocol", "standard", + "AutoRepeat", "500 30", + "XkbRules", "xfree86", + "XkbModel", "pc101", + "XkbLayout", "us", + "Panix106", "off", + "CustomKeycodes", "off", + NULL +}; + +static const char *kbd98Defaults[] = { + "Protocol", "standard", + "AutoRepeat", "500 30", + "XkbRules", "xfree98", + "XkbModel", "pc98", + "XkbLayout", "nec/jp", + "Panix106", "off", + "CustomKeycodes", "off", + NULL +}; + +#ifdef XKB +static char *xkb_rules; +static char *xkb_model; +static char *xkb_layout; +static char *xkb_variant; +static char *xkb_options; + +static XkbComponentNamesRec xkbnames; +#endif /* XKB */ + +#ifdef XFree86LOADER +/*ARGSUSED*/ +static const OptionInfoRec * +KeyboardAvailableOptions(void *unused) +{ + return (KeyboardOptions); +} +#endif + +static void +SetXkbOption(InputInfoPtr pInfo, char *name, char **option) +{ + char *s; + + if ((s = xf86SetStrOption(pInfo->options, name, NULL))) { + if (!s[0]) { + xfree(s); + *option = NULL; + } else { + *option = s; + xf86Msg(X_CONFIG, "%s: %s: \"%s\"\n", pInfo->name, name, s); + } + } +} + +static InputInfoPtr +KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr pInfo; + KbdDevPtr pKbd; + MessageType from = X_DEFAULT; + char *s; + + if (!(pInfo = xf86AllocateInput(drv, 0))) + return NULL; + + /* Initialise the InputInfoRec. */ + pInfo->name = dev->identifier; + pInfo->type_name = XI_KEYBOARD; + pInfo->flags = XI86_KEYBOARD_CAPABLE; + pInfo->device_control = KbdProc; + pInfo->read_input = NULL; + pInfo->motion_history_proc = NULL; + pInfo->history_size = 0; + pInfo->control_proc = NULL; + pInfo->close_proc = NULL; + pInfo->switch_mode = NULL; + pInfo->conversion_proc = NULL; + pInfo->reverse_conversion_proc = NULL; + pInfo->fd = -1; + pInfo->dev = NULL; + pInfo->private_flags = 0; + pInfo->always_core_feedback = 0; + pInfo->conf_idev = dev; + + if (!xf86IsPc98()) + xf86CollectInputOptions(pInfo, kbdDefaults, NULL); + else + xf86CollectInputOptions(pInfo, kbd98Defaults, NULL); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + if (!(pKbd = xcalloc(sizeof(KbdDevRec), 1))) + return pInfo; + + pInfo->private = pKbd; + pKbd->PostEvent = PostKbdEvent; + + if (!xf86OSKbdPreInit(pInfo)) + return pInfo; + + if (!pKbd->OpenKeyboard(pInfo)) { + return pInfo; + } + + if ((s = xf86SetStrOption(pInfo->options, "AutoRepeat", NULL))) { + int delay, rate; + if (sscanf(s, "%d %d", &delay, &rate) != 2) { + xf86Msg(X_ERROR, "\"%s\" is not a valid AutoRepeat value", s); + } else { + pKbd->delay = delay; + pKbd->rate = rate; + } + xfree(s); + } + + if ((s = xf86SetStrOption(pInfo->options, "XLeds", NULL))) { + char *l, *end; + unsigned int i; + l = strtok(s, " \t\n"); + while (l) { + i = strtoul(l, &end, 0); + if (*end == '\0') + pKbd->xledsMask |= 1L << (i - 1); + else { + xf86Msg(X_ERROR, "\"%s\" is not a valid XLeds value", l); + } + l = strtok(NULL, " \t\n"); + } + xfree(s); + } + +#ifdef XKB + +/* XkbDisable must be a server flag but for compatibility we check it here */ + + if (xf86FindOption(pInfo->options, "XkbDisable")) + xf86Msg(X_WARNING, + "%s: XKB can't be disabled here. Use \"ServerFlags\" section.\n", + pInfo->name); + + pKbd->noXkb = noXkbExtension; + if (pKbd->noXkb) { + xf86Msg(X_CONFIG, "XKB: disabled\n"); + } else { + SetXkbOption(pInfo, "XkbKeymap", &xkbnames.keymap); + if (xkbnames.keymap) { + xf86Msg(X_CONFIG, "%s: XkbKeymap overrides all other XKB settings\n", + pInfo->name); + } else { + SetXkbOption(pInfo, "XkbRules", &xkb_rules); + SetXkbOption(pInfo, "XkbModel", &xkb_model); + SetXkbOption(pInfo, "XkbLayout", &xkb_layout); + SetXkbOption(pInfo, "XkbVariant", &xkb_variant); + SetXkbOption(pInfo, "XkbOptions", &xkb_options); + + SetXkbOption(pInfo, "XkbKeycodes", &xkbnames.keycodes); + SetXkbOption(pInfo, "XkbTypes", &xkbnames.types); + SetXkbOption(pInfo, "XkbCompat", &xkbnames.compat); + SetXkbOption(pInfo, "XkbSymbols", &xkbnames.symbols); + SetXkbOption(pInfo, "XkbGeometry", &xkbnames.geometry); + } + } + + if ((xkb_model && !strcmp(xkb_model, "sun")) || + (xkb_rules && !strcmp(xkb_rules, "sun"))) + pKbd->sunKbd = TRUE; +#endif + +#if defined(SVR4) && defined(i386) + if ((pKbd->Panix106 = + xf86SetBoolOption(pInfo->options, "Panix106", FALSE))) { + xf86Msg(X_CONFIG, "%s: PANIX106: enabled\n", pInfo->name); + } +#endif + + pKbd->CustomKeycodes = FALSE; + from = X_DEFAULT; + if (xf86FindOption(pInfo->options, "CustomKeycodes")) { + pKbd->CustomKeycodes = xf86SetBoolOption(pInfo->options, "CustomKeycodes", + pKbd->CustomKeycodes); + from = X_CONFIG; + } + + xf86Msg(from, "%s: CustomKeycodes %s\n", + pInfo->name, pKbd->CustomKeycodes ? "enabled" : "disabled"); + + pInfo->flags |= XI86_CONFIGURED; + + return pInfo; +} + +static void +KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused) +{ + InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + pKbd->Bell(pInfo, percent, ((KeybdCtrl*) ctrl)->bell_pitch, + ((KeybdCtrl*) ctrl)->bell_duration); +} + +static void +UpdateLeds(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int leds = 0; + + if (pKbd->keyLeds & CAPSFLAG) leds |= XLED1; + if (pKbd->keyLeds & NUMFLAG) leds |= XLED2; + if (pKbd->keyLeds & SCROLLFLAG || + pKbd->keyLeds & MODEFLAG) leds |= XLED3; + if (pKbd->keyLeds & COMPOSEFLAG) leds |= XLED4; + + pKbd->leds = (pKbd->leds & pKbd->xledsMask) | (leds & ~pKbd->xledsMask); + pKbd->SetLeds(pInfo, pKbd->leds); +} + +static int +KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) +{ + int leds; + InputInfoPtr pInfo = (InputInfoPtr) device->public.devicePrivate; + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + + if ( ctrl->leds & XCOMP ) { + pKbd->keyLeds |= COMPOSEFLAG; + } else { + pKbd->keyLeds &= ~COMPOSEFLAG; + } + leds = ctrl->leds & ~(XCAPS | XNUM | XSCR); /* ??? */ +#ifdef XKB + if (pKbd->noXkb) { +#endif + pKbd->leds = (leds & pKbd->xledsMask) | (pKbd->leds & ~pKbd->xledsMask); +#ifdef XKB + } else { + pKbd->leds = leds; + } +#endif + pKbd->SetLeds(pInfo, pKbd->leds); + + return (Success); +} + +static void +InitKBD(InputInfoPtr pInfo, Bool init) +{ + char rad; + unsigned int i; + xEvent kevent; + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + DeviceIntPtr pKeyboard = pInfo->dev; + KeyClassRec *keyc = pKeyboard->key; + KeySym *map = keyc->curKeySyms.map; + + kevent.u.keyButtonPointer.time = GetTimeInMillis(); + kevent.u.keyButtonPointer.rootX = 0; + kevent.u.keyButtonPointer.rootY = 0; + + /* + * Hmm... here is the biggest hack of every time ! + * It may be possible that a switch-vt procedure has finished BEFORE + * you released all keys neccessary to do this. That peculiar behavior + * can fool the X-server pretty much, cause it assumes that some keys + * were not released. TWM may stuck alsmost completly.... + * OK, what we are doing here is after returning from the vt-switch + * exeplicitely unrelease all keyboard keys before the input-devices + * are reenabled. + */ + for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map; + i < keyc->curKeySyms.maxKeyCode; + i++, map += keyc->curKeySyms.mapWidth) + if (KeyPressed(i)) + { + switch (*map) { + /* Don't release the lock keys */ + case XK_Caps_Lock: + case XK_Shift_Lock: + case XK_Num_Lock: + case XK_Scroll_Lock: + case XK_Kana_Lock: + break; + default: + kevent.u.u.detail = i; + kevent.u.u.type = KeyRelease; + (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1); + } + } + pKbd->scanPrefix = 0; + + if (init) { + pKbd->keyLeds = 0; + + UpdateLeds(pInfo); + + if( pKbd->delay <= 375) rad = 0x00; + else if (pKbd->delay <= 625) rad = 0x20; + else if (pKbd->delay <= 875) rad = 0x40; + else rad = 0x60; + if (pKbd->rate <= 2) rad |= 0x1F; + else if (pKbd->rate >= 30) rad |= 0x00; + else rad |= ((58 / pKbd->rate) - 2); + pKbd->SetKbdRepeat(pInfo, rad); + } +} + +static int +KbdProc(DeviceIntPtr device, int what) +{ + + InputInfoPtr pInfo = device->public.devicePrivate; + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + int ret; + + switch (what) { + case DEVICE_INIT: + ret = pKbd->KbdInit(pInfo, what); + if (ret != Success) + return ret; + + pKbd->KbdGetMapping(pInfo, &keySyms, modMap); + + device->public.on = FALSE; +#ifdef XKB + if (pKbd->noXkb) { +#endif + InitKeyboardDeviceStruct((DevicePtr) device, + &keySyms, + modMap, + KbdBell, + (KbdCtrlProcPtr)KbdCtrl); +#ifdef XKB + } else { + if (xkbnames.keymap) + xkb_rules = NULL; + XkbSetRulesDflts(xkb_rules, xkb_model, xkb_layout, + xkb_variant, xkb_options); + XkbInitKeyboardDeviceStruct(device, + &xkbnames, + &keySyms, + modMap, + KbdBell, + (KbdCtrlProcPtr)KbdCtrl); + } +#endif + InitKBD(pInfo, TRUE); + break; + case DEVICE_ON: + if (device->public.on) + break; + /* + * Set the keyboard into "direct" mode and turn on + * event translation. + */ + if ((ret = pKbd->KbdOn(pInfo, what)) != Success) + return ret; + /* + * Discard any pending input after a VT switch to prevent the server + * passing on parts of the VT switch sequence. + */ + if (pInfo->fd >= 0) { + sleep(1); + xf86FlushInput(pInfo->fd); + AddEnabledDevice(pInfo->fd); + } + + device->public.on = TRUE; + InitKBD(pInfo, FALSE); + break; + + case DEVICE_CLOSE: + case DEVICE_OFF: + + /* + * Restore original keyboard directness and translation. + */ + if (pInfo->fd != -1) + RemoveEnabledDevice(pInfo->fd); + pKbd->KbdOff(pInfo, what); + device->public.on = FALSE; + break; + } + return (Success); +} + +static void +PostKbdEvent(InputInfoPtr pInfo, unsigned int scanCode, Bool down) +{ + + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + DeviceIntPtr device = pInfo->dev; + KeyClassRec *keyc = device->key; + KbdFeedbackClassRec *kbdfeed = device->kbdfeed; + int specialkey = 0; + + Bool UsePrefix = FALSE; + KeySym *keysym; + int keycode; + unsigned long changeLock = 0; + static int lockkeys = 0; + + /* Disable any keyboard processing while in suspend */ + if (xf86inSuspend) + return; + + /* + * First do some special scancode remapping ... + */ + if (pKbd->RemapScanCode != NULL) { + if (pKbd->RemapScanCode(pInfo, (int*) &scanCode)) + return; + } else { + if (pKbd->scancodeMap != NULL) { + TransMapPtr map = pKbd->scancodeMap; + if (scanCode >= map->begin && scanCode < map->end) + scanCode = map->map[scanCode - map->begin]; + } + } + + /* + * and now get some special keysequences + */ + + specialkey = scanCode; + + if (pKbd->GetSpecialKey != NULL) { + specialkey = pKbd->GetSpecialKey(pInfo, scanCode); + } else { + if (pKbd->specialMap != NULL) { + TransMapPtr map = pKbd->specialMap; + if (scanCode >= map->begin && scanCode < map->end) + specialkey = map->map[scanCode - map->begin]; + } + } + +#ifndef TERMINATE_FALLBACK +#define TERMINATE_FALLBACK 1 +#endif +#ifdef XKB + if (noXkbExtension +#if TERMINATE_FALLBACK + || specialkey == KEY_BackSpace +#endif + ) +#endif + { + if (xf86CommonSpecialKey(specialkey, down, keyc->state)) + return; + if (pKbd->SpecialKey != NULL) + if (pKbd->SpecialKey(pInfo, specialkey, down, keyc->state)) + return; + } + + /* + * Now map the scancodes to real X-keycodes ... + */ + keycode = scanCode + MIN_KEYCODE; + keysym = (keyc->curKeySyms.map + + keyc->curKeySyms.mapWidth * + (keycode - keyc->curKeySyms.minKeyCode)); + +#ifdef XKB + if (pKbd->noXkb) { +#endif + /* + * Filter autorepeated caps/num/scroll lock keycodes. + */ + if( down ) { + switch( keysym[0] ) { + case XK_Caps_Lock : + if (lockkeys & CAPSFLAG) + return; + else + lockkeys |= CAPSFLAG; + break; + + case XK_Num_Lock : + if (lockkeys & NUMFLAG) + return; + else + lockkeys |= NUMFLAG; + break; + + case XK_Scroll_Lock : + if (lockkeys & SCROLLFLAG) + return; + else + lockkeys |= SCROLLFLAG; + break; + } + if (keysym[1] == XF86XK_ModeLock) + { + if (lockkeys & MODEFLAG) + return; + else + lockkeys |= MODEFLAG; + } + } + else { + switch( keysym[0] ) { + case XK_Caps_Lock : + lockkeys &= ~CAPSFLAG; + break; + + case XK_Num_Lock : + lockkeys &= ~NUMFLAG; + break; + + case XK_Scroll_Lock : + lockkeys &= ~SCROLLFLAG; + break; + } + if (keysym[1] == XF86XK_ModeLock) + lockkeys &= ~MODEFLAG; + } + + /* + * LockKey special handling: + * ignore releases, toggle on & off on presses. + * Don't deal with the Caps_Lock keysym directly, but check the lock modifier + */ + + if (keyc->modifierMap[keycode] & LockMask) + changeLock = CAPSFLAG; + if (keysym[0] == XK_Num_Lock) + changeLock = NUMFLAG; + if (keysym[0] == XK_Scroll_Lock) + changeLock = SCROLLFLAG; + if (keysym[1] == XF86XK_ModeLock) + changeLock = MODEFLAG; + + if (changeLock) { + if (!down) + return; + + pKbd->keyLeds &= ~changeLock; + + if (KeyPressed(keycode)) { + down = !down; + } else { + pKbd->keyLeds |= changeLock; + } + UpdateLeds(pInfo); + } + + if (!pKbd->CustomKeycodes) { + /* + * normal, non-keypad keys + */ + if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { +#if !defined(CSRG_BASED) && \ + !defined(__GNU__) && \ + defined(KB_84) + /* + * magic ALT_L key on AT84 keyboards for multilingual support + */ + if (pKbd->kbdType == KB_84 && + ModifierDown(AltMask) && + keysym[2] != NoSymbol) + { + UsePrefix = TRUE; + } +#endif /* !CSRG_BASED && ... */ + } + } +#ifdef XKB + } +#endif + + /* + * check for an autorepeat-event + */ + if (down) { + int num = keycode >> 3; + int bit = 1 << (keycode & 7); + if ((keyc->down[num] & bit) && + ((kbdfeed->ctrl.autoRepeat != AutoRepeatModeOn) || + keyc->modifierMap[keycode] || + !(kbdfeed->ctrl.autoRepeats[num] & bit))) + return; + } + + if (UsePrefix) { + xf86PostKeyboardEvent(device, + keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], TRUE); + xf86PostKeyboardEvent(device, keycode, down); + xf86PostKeyboardEvent(device, + keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], FALSE); + } else { + xf86PostKeyboardEvent(device, keycode, down); + } +} + +#ifdef XFree86LOADER +ModuleInfoRec KeyboardInfo = { + 1, + "KBD", + NULL, + 0, + KeyboardAvailableOptions, +}; + +static void +xf86KbdUnplug(pointer p) +{ +} + +static pointer +xf86KbdPlug(pointer module, + pointer options, + int *errmaj, + int *errmin) +{ + static Bool Initialised = FALSE; + + if (!Initialised) { + Initialised = TRUE; +#ifndef REMOVE_LOADER_CHECK_MODULE_INFO + if (xf86LoaderCheckSymbol("xf86AddModuleInfo")) +#endif + xf86AddModuleInfo(&KeyboardInfo, module); + } + + xf86AddInputDriver(&KEYBOARD, module, 0); + + return module; +} + +static XF86ModuleVersionInfo xf86KeyboardVersionRec = +{ + "kbd", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by */ + /* a tool */ +}; + +XF86ModuleData kbdModuleData = {&xf86KeyboardVersionRec, + xf86KbdPlug, + xf86KbdUnplug}; + +#endif /* XFree86LOADER */ Index: xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.man:1.1 --- /dev/null Thu Feb 27 12:32:05 2003 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.man Thu Oct 10 21:40:33 2002 @@ -0,0 +1,99 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/kbd.man,v 1.1 2002/10/11 01:40:33 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH KBD __drivermansuffix__ __vendorversion__ +.SH NAME +kbd \- Keyboard input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qkbd\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B kbd +is an XFree86 input driver for keyboards. The driver supports the standard +OS-provided keyboard interface, but these are currently only available to +this driver module for Linux and BSD. This driver is experimental, but +will soon replace the built-in +.B keyboard +driver. +.PP +The +.B kbd +driver functions as a keyboard input device, and may be used as the +X server's core keyboard. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The following driver +.B Options +are supported: +.TP 7 +.BI "Option \*qDevice\*q \*q" string \*q +Specify the keyboard device. Default: the OS's default console keyboard +input source. +.TP 7 +.BI "Option \*qProtocol\*q \*q" string \*q +Specify the keyboard protocol. Valid protocol types include: +.PP +.RS 12 +Standard, Xqueue. +.RE +.PP +.RS 7 +Not all protocols are supported on all platforms. Default: "Standard". +.RE +.TP 7 +.BI "Option \*qAutoRepeat\*q \*q" "delay rate" \*q +sets the auto repeat behaviour for the keyboard. This is not implemented +on all platforms. +.I delay +is the time in milliseconds before a key starts repeating. +.I rate +is the number of times a key repeats per second. Default: "500 30". +.TP 7 +.BI "Option \*qXLeds\*q \*q" ledlist \*q +makes the keyboard LEDs specified in +.I ledlist +available for client use instead of their traditional function +(Scroll Lock, Caps Lock and Num Lock). The numbers in the list are +in the range 1 to 3. Default: empty list. +.TP 7 +.BI "Option \*qXkbRules\*q \*q" rules \*q +specifies which XKB rules file to use for interpreting the +.BR XkbModel , +.BR XkbLayout , +.BR XkbVariant , +and +.B XkbOptions +settings. Default: "xfree86" for most platforms, but "xfree98" for the +Japanese PC-98 platforms. +.TP 7 +.BI "Option \*qXkbModel\*q \*q" modelname \*q +specifies the XKB keyboard model name. Default: "pc101" for most platforms, +but "pc98" for the Japanese PC-98 platforms, and "pc101_sol8x86" for +Solaris 8 on x86. +.TP 7 +.BI "Option \*qXkbLayout\*q \*q" layoutname \*q +specifies the XKB keyboard layout name. This is usually the country or +language type of the keyboard. Default: "us" for most platforms, but +"nec/jp" for the Japanese PC-98 platforms. +.TP 7 +.BI "Option \*qXkbVariant\*q \*q" variants \*q +specifies the XKB keyboard variant components. These can be used to +enhance the keyboard layout details. Default: not set. +.TP 7 +.BI "Option \*qXkbOptions\*q \*q" options \*q +specifies the XKB keyboard option components. These can be used to +enhance the keyboard behaviour. Default: not set. +.PP +Some other XKB-related options are available, but they are incompatible +with the ones listed above and are not recommended, so they are not +documented here. +.SH "SEE ALSO" +keyboard(__drivermansuffix__), XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). Index: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man diff -u xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man:1.2 xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man:1.3 --- xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man:1.2 Sat Jan 27 13:20:57 2001 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man Thu Oct 10 21:40:33 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man,v 1.2 2001/01/27 18:20:57 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man,v 1.3 2002/10/11 01:40:33 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH KEYBOARD __drivermansuffix__ __vendorversion__ @@ -33,7 +33,7 @@ are supported: .TP 7 .BI "Option \*qProtocol\*q \*q" string \*q -Specify the mouse protocol. Valid protocol types include: +Specify the keyboard protocol. Valid protocol types include: .PP .RS 12 Standard, Xqueue. @@ -61,6 +61,12 @@ .BI "Option \*qXkbDisable\*q \*q" boolean \*q disable/enable the XKEYBOARD extension. The \-kb command line option overrides this config file option. Default: XKB is enabled. +.PP +.RS 7 +NOTE: This option should be specified in the +.B ServerFlags +section rather than here. It's use here is deprecated. +.RE .TP 7 .BI "Option \*qXkbRules\*q \*q" rules \*q specifies which XKB rules file to use for interpreting the @@ -94,4 +100,4 @@ with the ones listed above and are not recommended, so they are not documented here. .SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +kbd(__drivermansuffix__), XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). Index: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c diff -u xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c:1.10 xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c:1.11 --- xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c:1.10 Mon Nov 26 11:25:53 2001 +++ xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c Fri Jun 7 17:03:27 2002 @@ -24,8 +24,16 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c,v 1.10 2001/11/26 16:25:53 dawes Exp $ */ +/* + * port to XFree4.2.0 Copyright (c) 2002 Christoph Koulen + * chris@real-aix.de + * + * port based on pre-XFree4.2.0 driver code v1.10 and XFree4.2.0 SpaceOrb driver code + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c,v 1.11 2002/06/07 21:03:27 alanh Exp $ */ + #define _MAGELLAN_C_ /***************************************************************************** * Standard Headers @@ -52,6 +60,19 @@ /***************************************************************************** * Local Variables ****************************************************************************/ + +InputDriverRec MAGELLAN = { + 1, + "magellan", + NULL, + MagellanPreInit, + NULL, + NULL, + 0 +}; + +#ifdef XFree86LOADER + static XF86ModuleVersionInfo VersionRec = { "magellan", @@ -67,27 +88,63 @@ * a tool */ }; -/* - * Be sure to set vmin appropriately for your device's protocol. You want to - * read a full packet before returning +/* The following list of symbols that has been taken without modification from the + SpaceOrb driver code. + This has resulted in a working magellan driver. + You may be able to strip this list for the magellan device; */ -static const char *default_options[] = -{ - "BaudRate", "9600", - "StopBits", "2", - "DataBits", "8", - "Parity", "None", - "Vmin", "26", - "Vtime", "1", - "FlowControl", "None" +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL }; - -XF86ModuleData magellanModuleData = { &VersionRec, SetupProc, TearDownProc }; -/***************************************************************************** - * Function Definitions - ****************************************************************************/ - +static pointer +MAGELLANSetupProc(pointer module, + pointer options, + int *errmaj, + int *errmin ) { + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&MAGELLAN, module, 0); + return (pointer) 1; +} /* * The TearDownProc may have to be tailored to your device @@ -95,101 +152,137 @@ static void TearDownProc( pointer p ) { - LocalDevicePtr local = (LocalDevicePtr) p; - MagellanPrivatePtr priv = (MagellanPrivatePtr) local->private; + if (!xf86ServerIsOnlyDetecting()) { + + InputInfoPtr pInfo = (InputInfoPtr) p; + MAGELLANPrivatePtr priv = (MAGELLANPrivatePtr) pInfo->private; - DeviceOff (local->dev); + DeviceOff (pInfo->dev); - xf86CloseSerial (local->fd); + xf86CloseSerial (pInfo->fd); XisbFree (priv->buffer); xfree (priv); - xfree (local->name); - xfree (local); + xfree (pInfo->name); + xfree (pInfo); + } } -static pointer -SetupProc( pointer module, - pointer options, - int *errmaj, - int *errmin ) -{ - LocalDevicePtr local = xcalloc (1, sizeof (LocalDeviceRec)); - MagellanPrivatePtr priv = xcalloc (1, sizeof (MagellanPrivateRec)); - pointer defaults, - merged; - - if ((!local) || (!priv)) - goto SetupProc_fail; - - defaults = xf86OptionListCreate (default_options, - (sizeof (default_options) / sizeof (default_options[0])), 0); - merged = xf86OptionListMerge( defaults, options ); - - xf86OptionListReport( merged ); +XF86ModuleData magellanModuleData = { &VersionRec, MAGELLANSetupProc, TearDownProc }; - local->fd = xf86OpenSerial (merged); - if (local->fd == -1) - { - ErrorF ("Magellan driver unable to open device\n"); - *errmaj = LDR_NOPORTOPEN; - *errmin = xf86GetErrno (); - goto SetupProc_fail; - } +#endif /* XFreeLOADER */ +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning; + * + * These settings have been found to work for a device which identifies itself as follows: + * + * MAGELLAN Version 5.49 by LOGITECH INC. 10/22/96 + * + * newer devices may require different settings. + */ +static const char *default_options[] = +{ + "BaudRate", "9600", + "StopBits", "2", + "DataBits", "8", + "Parity", "None", + "Vmin", "26", + "Vtime", "1", + "FlowControl", "Xoff", + NULL, +}; - priv->buffer = XisbNew (local->fd, 200); - DBG (9, XisbTrace (priv->buffer, 1)); +/***************************************************************************** + * Function Definitions + ****************************************************************************/ - /* - * Verify that hardware is attached and fuctional - */ - if (QueryHardware (priv, errmaj, errmin) != Success) - { - ErrorF ("Unable to query/initialize Magellan hardware.\n"); - goto SetupProc_fail; +static InputInfoPtr +MagellanPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr pInfo; + MAGELLANPrivatePtr priv = xcalloc (1, sizeof (MAGELLANPrivateRec)); + + if (!priv) + return NULL; + + if (!(pInfo = xf86AllocateInput(drv, 0))) { + xfree(priv); + return NULL; } + + priv->lex_mode = magellan_normal; + priv->packeti = 0; + priv->old_buttons=0; + priv->buffer= NULL; + + pInfo->type_name = XI_SPACEBALL; + pInfo->device_control = DeviceControl; + pInfo->read_input = ReadInput; + pInfo->control_proc = ControlProc; + pInfo->close_proc = CloseProc; + pInfo->switch_mode = SwitchMode; + pInfo->conversion_proc = ConvertProc; + pInfo->dev = NULL; + pInfo->private = priv; + pInfo->private_flags = 0; + pInfo->flags = 0; + pInfo->conf_idev = dev; + + xf86CollectInputOptions(pInfo, default_options, NULL); + + xf86OptionListReport( pInfo->options ); + + pInfo->fd = xf86OpenSerial (pInfo->options); + if (pInfo->fd == -1) + { + ErrorF ("MAGELLAN driver unable to open device\n"); + goto SetupProc_fail; + } + + priv->buffer = XisbNew (pInfo->fd, 200); + DBG (9, XisbTrace (priv->buffer, 1)); - /* this results in an xstrdup that must be freed later */ - local->name = xf86SetStrOption( merged, "DeviceName", "Magellan Space Mouse" ); - - local->type_name = XI_SPACEBALL; /* - * Standard setup for the local device record + * Verify the hardware is attached and functional */ - local->device_control = DeviceControl; - local->read_input = ReadInput; - local->control_proc = ControlProc; - local->close_proc = CloseProc; - local->switch_mode = SwitchMode; - local->conversion_proc = ConvertProc; - local->dev = NULL; - local->private = priv; - local->private_flags = 0; - local->history_size = xf86SetIntOption( merged, "HistorySize", 0); - - xf86AddLocalDevice (local, merged); - - /* return the LocalDevice */ - return (local); + if (QueryHardware (priv) != Success) + { + ErrorF ("Unable to query/initialize MAGELLAN hardware.\n"); + goto SetupProc_fail; + } + + /* this results in an xstrdup that must be freed later */ + /* the last string "spaceball" is the one to make glut 3.7 believe + a "spaceball" device ist present. + This decision is based on string comparison! + */ + pInfo->name = xf86SetStrOption( pInfo->options, "DeviceName", "spaceball"); + pInfo->history_size = xf86SetIntOption( pInfo->options, "HistorySize", 0 ); + + xf86ProcessCommonOptions(pInfo, pInfo->options); + + pInfo->flags |= XI86_CONFIGURED; + return (pInfo); /* * If something went wrong, cleanup and return NULL */ SetupProc_fail: - if ((local) && (local->fd)) - xf86CloseSerial (local->fd); - if ((local) && (local->name)) - xfree (local->name); - if (local) - xfree (local); + if ((pInfo) && (pInfo->fd)) + xf86CloseSerial (pInfo->fd); + if ((pInfo) && (pInfo->name)) + xfree (pInfo->name); - if ((priv) && (priv->buffer)) - XisbFree (priv->buffer); + if ((priv) && (priv->buffer)) + XisbFree (priv->buffer); if (priv) - xfree (priv); - return (NULL); + xfree (priv); + return (pInfo); } + + static Bool DeviceControl (DeviceIntPtr dev, int mode) { @@ -220,9 +313,9 @@ static Bool DeviceOn (DeviceIntPtr dev) { - LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + InputInfoPtr pInfo = dev->public.devicePrivate; - AddEnabledDevice (local->fd); + AddEnabledDevice (pInfo->fd); dev->public.on = TRUE; return (Success); } @@ -230,9 +323,9 @@ static Bool DeviceOff (DeviceIntPtr dev) { - LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + InputInfoPtr pInfo = dev->public.devicePrivate; - RemoveEnabledDevice (local->fd); + RemoveEnabledDevice (pInfo->fd); dev->public.on = FALSE; return (Success); } @@ -246,159 +339,164 @@ static Bool DeviceInit (DeviceIntPtr dev) { - LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; - unsigned char map[] = - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - int i; - - if (InitButtonClassDeviceStruct (dev, 9, map) == FALSE) - { - ErrorF ("Unable to allocate Magellan ButtonClassDeviceStruct\n"); - return !Success; - } + InputInfoPtr pInfo = dev->public.devicePrivate; + unsigned char map[] = + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + int i; + + if (InitButtonClassDeviceStruct (dev, 9, map) == FALSE) + { + ErrorF ("Unable to allocate MAGELLAN ButtonClassDeviceStruct\n"); + return !Success; + } - if (InitFocusClassDeviceStruct (dev) == FALSE) - { - ErrorF("Unable to allocate Magellan FocusClassDeviceStruct\n"); - return !Success; + if (InitFocusClassDeviceStruct (dev) == FALSE) + { + ErrorF("Unable to allocate MAGELLAN FocusClassDeviceStruct\n"); + return !Success; } - if (InitValuatorClassDeviceStruct (dev, 6, xf86GetMotionEvents, - local->history_size, Absolute) == FALSE) - { - ErrorF ("Unable to allocate Magellan ValuatorClassDeviceStruct\n"); - return !Success; - } - else + if (InitValuatorClassDeviceStruct (dev, 6, xf86GetMotionEvents, + pInfo->history_size, Absolute) == FALSE) + { + ErrorF ("Unable to allocate MAGELLAN ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + for (i = 0; i <= 6; i++) { - for (i = 0; i <= 6; i++) - { - InitValuatorAxisStruct(dev, i, MAGELLAN_MIN, MAGELLAN_MAX, - MAGELLAN_RES, 0, MAGELLAN_RES); - } + InitValuatorAxisStruct(dev, i, MAGELLAN_MIN, MAGELLAN_MAX, MAGELLAN_RES, 0, MAGELLAN_RES); } + } #ifdef BELL_FEEDBACK_SUPPORT - /* - The InitBellFeedbackClassDeviceStruct function is not exported in the - 4.3.0 or 4.3.1 Xmetro loader. We'll leave this out to stay compatible - */ - - if (InitBellFeedbackClassDeviceStruct (dev, MagellanBellSound, - MagellanBellCtrl) == FALSE) - { - ErrorF ("Unable to allocate Magellan BellFeedbackClassDeviceStruct\n"); - return !Success; - } + /* + The InitBellFeedbackClassDeviceStruct function is not exported in the + 4.3.0 or 4.3.1 Xmetro loader. We'll leave this out to stay compatible + */ + /* + unsure, whether this still is true for the XFree4.2.0 port. + Didn't bother to find out. + Christoph Koulen + */ + + if (InitBellFeedbackClassDeviceStruct (dev, MagellanBellSound, + MagellanBellCtrl) == FALSE) + { + ErrorF ("Unable to allocate Magellan BellFeedbackClassDeviceStruct\n"); + return !Success; + } #endif - /* - * Allocate the motion events buffer. - */ - xf86MotionHistoryAllocate (local); - return (Success); + /* + * Allocate the motion events buffer. + */ + xf86MotionHistoryAllocate (pInfo); + return (Success); } static void ReadInput (LocalDevicePtr local) { - int x, y, z; - int a, b, c; - int i, buttons; - MagellanPrivatePtr priv = (MagellanPrivatePtr) (local->private); - - /* - * set blocking to -1 on the first call because we know there is data to - * read. Xisb automatically clears it after one successful read so that - * succeeding reads are preceeded buy a select with a 0 timeout to prevent - * read from blocking indefinately. - */ - XisbBlockDuration (priv->buffer, -1); - while (MagellanGetPacket (priv) == Success) - { - /* - * Examine priv->packet and call these functions as appropriate: - * - xf86PostMotionEvent - xf86PostButtonEvent - */ - - switch (priv->packet[0]) - { - case 'd': /* motion packet */ - if (strlen (priv->packet) == 26) - { - x = - MagellanNibble( priv->packet[1] ) * 4096 + - MagellanNibble( priv->packet[2] ) * 256 + - MagellanNibble( priv->packet[3] ) * 16 + - MagellanNibble( priv->packet[4] ) - 32768; - y = - MagellanNibble( priv->packet[5] ) * 4096 + - MagellanNibble( priv->packet[6] ) * 256 + - MagellanNibble( priv->packet[7] ) * 16 + - MagellanNibble( priv->packet[8] ) - 32768; - z = - MagellanNibble( priv->packet[9] ) * 4096 + - MagellanNibble( priv->packet[10] ) * 256 + - MagellanNibble( priv->packet[11] ) * 16 + - MagellanNibble( priv->packet[12] ) - 32768; - - a = - MagellanNibble( priv->packet[13] ) * 4096 + - MagellanNibble( priv->packet[14] ) * 256 + - MagellanNibble( priv->packet[15] ) * 16 + - MagellanNibble( priv->packet[16] ) - 32768; - b = - MagellanNibble( priv->packet[17] ) * 4096 + - MagellanNibble( priv->packet[18] ) * 256 + - MagellanNibble( priv->packet[19] ) * 16 + - MagellanNibble( priv->packet[20] ) - 32768; - c = - MagellanNibble( priv->packet[21] ) * 4096 + - MagellanNibble( priv->packet[22] ) * 256 + - MagellanNibble( priv->packet[23] ) * 16 + - MagellanNibble( priv->packet[24] ) - 32768; - - xf86ErrorFVerb( 5, "Magellan motion %d %d %d -- %d %d %d\n", - x, y, z, a, b, c ); - xf86PostMotionEvent(local->dev, TRUE, 0, 6, - x, y, z, a, b, c); - } - else - ErrorF ("Magellan recieved a short \'d\'packet\n"); - break; - - case 'k': /* button packet */ - if (strlen (priv->packet) == 5) - { - buttons = MagellanNibble( priv->packet[1] ) * 1 + - MagellanNibble( priv->packet[2] ) * 16 + - MagellanNibble( priv->packet[3] ) * 256; - if (priv->old_buttons != buttons) - for (i = 0; i < 9; i++) - { - if ((priv->old_buttons&(1<<i)) != (buttons&(1<<i))) - { - xf86PostButtonEvent(local->dev, FALSE, i+1, - (buttons&(1<<i)), 0, 0); - xf86ErrorFVerb( 5, "Magellan setting button %d to %d\n", + int x, y, z; + int a, b, c; + int i, buttons; + MAGELLANPrivatePtr priv = (MAGELLANPrivatePtr) (local->private); + + /* + * set blocking to -1 on the first call because we know there is data to + * read. Xisb automatically clears it after one successful read so that + * succeeding reads are preceeded by a select with a 0 timeout to prevent + * read from blocking indefinitely. + */ + XisbBlockDuration (priv->buffer, -1); + while (MAGELLANGetPacket (priv) == Success) + { + /* + * Examine priv->packet and call these functions as appropriate: + * + xf86PostMotionEvent + xf86PostButtonEvent + */ + + switch (priv->packet[0]) + { + case 'd': /* motion packet */ + if (strlen (priv->packet) == 26) + { + x = + MagellanNibble( priv->packet[1] ) * 4096 + + MagellanNibble( priv->packet[2] ) * 256 + + MagellanNibble( priv->packet[3] ) * 16 + + MagellanNibble( priv->packet[4] ) - 32768; + y = + MagellanNibble( priv->packet[5] ) * 4096 + + MagellanNibble( priv->packet[6] ) * 256 + + MagellanNibble( priv->packet[7] ) * 16 + + MagellanNibble( priv->packet[8] ) - 32768; + z = + MagellanNibble( priv->packet[9] ) * 4096 + + MagellanNibble( priv->packet[10] ) * 256 + + MagellanNibble( priv->packet[11] ) * 16 + + MagellanNibble( priv->packet[12] ) - 32768; + + a = + MagellanNibble( priv->packet[13] ) * 4096 + + MagellanNibble( priv->packet[14] ) * 256 + + MagellanNibble( priv->packet[15] ) * 16 + + MagellanNibble( priv->packet[16] ) - 32768; + b = + MagellanNibble( priv->packet[17] ) * 4096 + + MagellanNibble( priv->packet[18] ) * 256 + + MagellanNibble( priv->packet[19] ) * 16 + + MagellanNibble( priv->packet[20] ) - 32768; + c = + MagellanNibble( priv->packet[21] ) * 4096 + + MagellanNibble( priv->packet[22] ) * 256 + + MagellanNibble( priv->packet[23] ) * 16 + + MagellanNibble( priv->packet[24] ) - 32768; + + xf86ErrorFVerb( 5, "Magellan motion %d %d %d -- %d %d %d\n", + x, y, z, a, b, c ); + xf86PostMotionEvent(local->dev, TRUE, 0, 6, + x, y, z, a, b, c); + } + else + ErrorF ("Magellan received a short \'d\'packet\n"); + break; + + case 'k': /* button packet */ + if (strlen (priv->packet) == 5) + { + buttons = MagellanNibble( priv->packet[1] ) * 1 + + MagellanNibble( priv->packet[2] ) * 16 + + MagellanNibble( priv->packet[3] ) * 256; + if (priv->old_buttons != buttons) + for (i = 0; i < 9; i++) + { + if ((priv->old_buttons&(1<<i)) != (buttons&(1<<i))) + { + xf86PostButtonEvent(local->dev, FALSE, i+1, + (buttons&(1<<i)), 0, 0); + xf86ErrorFVerb( 5, "Magellan setting button %d to %d\n", i+1, (buttons&(1<<i)) ); - } - } - priv->old_buttons = buttons; - } - else - ErrorF ("Magellan recieved a short \'k\'packet\n"); - break; - } + } + } + priv->old_buttons = buttons; + } + else + ErrorF ("Magellan received a short \'k\'packet\n"); + break; } + } } static int ControlProc (LocalDevicePtr local, xDeviceCtl * control) { - return (Success); + return (Success); } #ifdef BELL_FEEDBACK_SUPPORT @@ -426,7 +524,7 @@ static int SwitchMode (ClientPtr client, DeviceIntPtr dev, int mode) { - return (Success); + return (Success); } /* @@ -436,106 +534,136 @@ */ static Bool ConvertProc (LocalDevicePtr local, - int first, - int num, - int v0, - int v1, - int v2, - int v3, - int v4, - int v5, - int *x, - int *y) + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int *x, + int *y) { - *x = v3; - *y = v4; - return (Success); + *x = v3; + *y = v4; + return (Success); } #define WriteString(str)\ XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str)); \ XisbBlockDuration (priv->buffer, 1000000); \ - if ((MagellanGetPacket (priv) != Success) || \ + if ((MAGELLANGetPacket (priv) != Success) || \ (strcmp (priv->packet, (str)) != 0)) \ return (!Success); static Bool -QueryHardware (MagellanPrivatePtr priv, int *errmaj, int *errmin) +QueryHardware (MAGELLANPrivatePtr priv) { - *errmaj = LDR_NOHARDWARE; + /* the device resets when the port is opened. Give it time to finish */ + milisleep (1000); - /* the device resets when the port is opened. Give it time to finish */ - milisleep (1000); - - XisbWrite (priv->buffer, (unsigned char *)MagellanAttention, strlen(MagellanAttention)); - WriteString (MagellanInitString); - WriteString (MagellanInitString); - WriteString (MagellanSensitivity); - WriteString (MagellanPeriod); - WriteString (MagellanMode); - WriteString (MagellanNullRadius); - - XisbWrite (priv->buffer, (unsigned char *)MagellanVersion, strlen(MagellanVersion)); - /* block for up to 1 second while trying to read the response */ - XisbBlockDuration (priv->buffer, 1000000); - NewPacket (priv); + XisbWrite (priv->buffer, (unsigned char *)MagellanModeOff, strlen(MagellanModeOff)); + XisbBlockDuration (priv->buffer, 200000); + MAGELLANGetPacket(priv); + + XisbWrite (priv->buffer, (unsigned char *)MagellanInitString, strlen(MagellanInitString)); + XisbBlockDuration (priv->buffer, 200000); + MAGELLANGetPacket(priv); + XisbWrite (priv->buffer, (unsigned char *)MagellanInitString, strlen(MagellanInitString)); + XisbBlockDuration (priv->buffer, 200000); + MAGELLANGetPacket(priv); + + WriteString (MagellanSensitivity); + WriteString (MagellanPeriod); + WriteString (MagellanNullRadius); + WriteString (MagellanMode); + XisbWrite (priv->buffer, (unsigned char *)MagellanVersion, strlen(MagellanVersion)); + + + /* block for up to 1 second while trying to read the response */ + XisbBlockDuration (priv->buffer, 1000000); + NewPacket (priv); - if ((MagellanGetPacket (priv) == Success) && (priv->packet[0] == 'v')) - { - priv->packet[strlen(priv->packet) - 1] = '\0'; - xf86MsgVerb( X_PROBED, 3, " initialized: %s\n", &(priv->packet[3]) ); - } - else - return (!Success); + if ((MAGELLANGetPacket (priv) == Success) && (priv->packet[0] == 'v')) + { + priv->packet[strlen(priv->packet) - 1] = '\0'; + xf86MsgVerb( X_PROBED, 3, " initialized: %s\n", &(priv->packet[3]) ); + } + else + return (!Success); - return (Success); + return (Success); } static void -NewPacket (MagellanPrivatePtr priv) +NewPacket (MAGELLANPrivatePtr priv) { - priv->lex_mode = magellan_normal; - priv->packeti = 0; + priv->lex_mode = magellan_normal; + priv->packeti = 0; } static Bool -MagellanGetPacket (MagellanPrivatePtr priv) +MAGELLANGetPacket (MAGELLANPrivatePtr priv) { - int count = 0; - int c; + int count = 0; + int c; - while ((c = XisbRead (priv->buffer)) >= 0) + while ((c = XisbRead (priv->buffer)) >= 0) + { + /* + * fail after 500 bytes so the server doesn't hang forever if a + * device sends bad data. + */ + if (count++ > 500) { - /* - * fail after 500 bytes so the server doesn't hang forever if a - * device sends bad data. - */ - if (count++ > 500) - { - NewPacket (priv); - return (!Success); - } + NewPacket (priv); + return (!Success); + } - switch (priv->lex_mode) - { - case magellan_normal: - if (priv->packeti > MAGELLAN_PACKET_SIZE) - { - NewPacket (priv); - return (!Success); - } - priv->packet[priv->packeti] = c; - priv->packeti++; - if (c == '\r') - { - priv->packet[priv->packeti] = '\0'; - NewPacket (priv); - return (Success); - } - break; - } + switch (priv->lex_mode) + { + case magellan_normal: + if (priv->packeti > MAGELLAN_PACKET_SIZE) + { + NewPacket (priv); + return (!Success); + } + priv->packet[priv->packeti] = c; + priv->packeti++; + + /* BEWARE: SpaceMouse echoes back most everything you send her. + * be sure NOT to send command strings that contain "\r" somewhere in the middle! + * "Success" of this function will be reported upon the first "\r" received". + * You might end up with the rest of a SpaceMouse echo still waiting in the + * buffer, which would make the comparison between command sent and the answer + * returned by SpaceMouse fail for the next command! + */ + if (c == '\r') + { + priv->packet[priv->packeti] = '\0'; + NewPacket (priv); + return (Success); + } + break; } - return (!Success); + } + return (!Success); } + + + + + + + + + + + + + + + Index: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h diff -u xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h:1.3 xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h:1.4 --- xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h:1.3 Sat May 15 08:10:30 1999 +++ xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h Fri Jun 7 17:03:27 2002 @@ -24,7 +24,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h,v 1.3 1999/05/15 12:10:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.h,v 1.4 2002/06/07 21:03:27 alanh Exp $ */ #ifndef _MAGELLAN_H_ #define _MAGELLAN_H_ @@ -42,28 +42,29 @@ extension expects these to be constant for a given device. Hence, I've picked values that are slightly higher than any reported by my test device in default (no multiplier) mode. The documentation says the range is roughly +/- 400 but -I have seen numbers close to 500. Some programs (GLUT) get upset if the device -reports a value greater than XInput reported it could. +I have seen numbers close to 1800 using the "sensitivity" setting as set below. +Some programs (GLUT) may get upset if the device reports a value greater than +XInput reported it could. */ -#define MAGELLAN_MIN -500 -#define MAGELLAN_MAX +500 +#define MAGELLAN_MIN -1800 +#define MAGELLAN_MAX +1800 #define MagellanAttention "\r\r" /* get device's attention */ #define MagellanInitString "z\r" /* switch in 3D mode */ #define MagellanShortBeep "b9\r" /* a short beep */ -#define MagellanMode "m3\r" /* translation and rotation data ON */ +#define MagellanMode "m3\r" /* translation and rotation data ON */ #define MagellanPeriod "pAA\r" /* transmit every 60 ms data */ #define MagellanNullRadius "nH\r" /* null radius to value 8 */ -#define MagellanZero "z\r" /* detect zero position */ +#define MagellanZero "z\r" /* detect zero position */ #define MagellanSensitivity "q00\r" /* no extra sensitivity */ #define MagellanVersion "vQ\r" /* get version string */ +#define MagellanModeOff "\r\rm0\r" - typedef enum { magellan_normal } -MagellanState; +MAGELLANState; #define MagellanNibble(Value) (Value&0x0F) @@ -75,16 +76,19 @@ unsigned char packet_type; char packet[MAGELLAN_PACKET_SIZE]; /* packet being/just read */ int packeti; /* index into packet */ + int expected_len; + MAGELLANState lex_mode; int old_buttons; - MagellanState lex_mode; } -MagellanPrivateRec, *MagellanPrivatePtr; +MAGELLANPrivateRec, *MAGELLANPrivatePtr; /****************************************************************************** * Declarations *****************************************************************************/ -static MODULESETUPPROTO( SetupProc ); -static void TearDownProc (void *); +#ifdef XFreeLOADER +static MODULESETUPPROTO( MAGELLANSetupProc ); +static void TearDownProc (pointer p); +#endif static Bool DeviceControl (DeviceIntPtr, int); static Bool DeviceOn (DeviceIntPtr); static Bool DeviceOff (DeviceIntPtr); @@ -95,9 +99,13 @@ static void CloseProc (LocalDevicePtr); static int SwitchMode (ClientPtr, DeviceIntPtr, int); static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *); -static Bool QueryHardware (MagellanPrivatePtr, int *, int *); -static void NewPacket (MagellanPrivatePtr priv); -static Bool MagellanGetPacket (MagellanPrivatePtr priv); +static Bool QueryHardware (MAGELLANPrivatePtr); +static void NewPacket (MAGELLANPrivatePtr priv); +static Bool MAGELLANGetPacket (MAGELLANPrivatePtr priv); + +static InputInfoPtr +MagellanPreInit(InputDriverPtr drv, IDevPtr dev, int flags); + #ifdef BELL_FEEDBACK_SUPPORT static void MagellanBellCtrl( DeviceIntPtr, BellCtrl *); static void MagellanBellSound(int percent, DeviceIntPtr dev, pointer ctrl, int @@ -107,3 +115,5 @@ * DO NOT PUT ANYTHING AFTER THIS ENDIF */ #endif + + Index: xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c diff -u xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c:1.2 xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c:1.3 --- xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c:1.2 Wed Jul 4 09:38:09 2001 +++ xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c Sat Jan 11 22:55:50 2003 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c,v 1.2 2001/07/04 13:38:09 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c,v 1.3 2003/01/12 03:55:50 tsi Exp $ */ #include <xf86Version.h> @@ -601,9 +601,9 @@ */ xf86MotionHistoryAllocate(local); - #ifndef XFREE86_V4 +#ifndef XFREE86_V4 AssignTypeAndName(dev, local->atom, local->name); - #endif /* XFREE86_V4 */ +#endif /* XFREE86_V4 */ DBG(2, ErrorF("MagicTouch INIT OK\n") ); @@ -612,20 +612,20 @@ case DEVICE_ON: DBG(2, ErrorF("MagicTouch ON\n") ); if (local->fd<0) { - #ifndef XFREE86_V4 +#ifndef XFREE86_V4 struct termios termios_tty; int i,result; - #endif +#endif DBG(2, ErrorF("Opening device...\n") ); - #ifdef XFREE86_V4 +#ifdef XFREE86_V4 local->fd = xf86OpenSerial(local->options); if (local->fd<0) { ErrorF("Impossibile aprire MagicTouch\n"); return !Success; } - #else +#else SYSCALL( local->fd = open(priv->input_dev, O_RDWR | O_NDELAY, 0) ); if (local->fd<0) { Error("Impossibile aprire MagicTouch\n"); @@ -646,7 +646,7 @@ /* * Attivo l'RTS per abilitare il touch controller */ - #if 0 +#if 0 SYSCALL( result = ioctl(local->fd, TIOCMGET, &status_line) ); if (result<0) { @@ -662,7 +662,7 @@ close(local->fd); return !Success; } - #endif +#endif SYSCALL( result = tcsetattr(local->fd, TCSANOW, &termios_tty) ); if (result<0) @@ -671,7 +671,7 @@ close(local->fd); return !Success; } - #endif +#endif /* Controlla se e' presente il touch controller.*/ @@ -987,11 +987,11 @@ xf86MagicAllocate(InputDriverPtr drv) #endif { - #ifndef XFREE86_V4 +#ifndef XFREE86_V4 LocalDevicePtr local = (LocalDevicePtr) xalloc( sizeof(LocalDeviceRec) ); - #else +#else LocalDevicePtr local = xf86AllocateInput(drv, 0); - #endif +#endif MagicPrivatePtr priv = (MagicPrivatePtr) xalloc( sizeof(MagicPrivateRec) ); @@ -1011,12 +1011,12 @@ } /* I buffers sono allocati correttamente */ - #ifdef XFREE86_V4 +#ifdef XFREE86_V4 priv->input_dev = strdup(MAGIC_PORT); - #else +#else priv->input_dev = MAGIC_PORT; priv->link_speed = MAGIC_LINK_SPEED; - #endif +#endif priv->min_x = 60; priv->max_x = 960; @@ -1042,11 +1042,11 @@ local->name = XI_TOUCHSCREEN; local->flags = 0; - #ifndef XFREE86_V4 - #if !defined(sun) || defined(i386) +#ifndef XFREE86_V4 +#if !defined(sun) || defined(i386) local->device_config = xf86MagicConfig; - #endif /* !defined(sun) || defined(i386) */ - #endif /* XFREE86_V4*/ +#endif /* !defined(sun) || defined(i386) */ +#endif /* XFREE86_V4*/ local->device_control = xf86MagicControl; local->read_input = xf86MagicReadInput; Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.50 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.69 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.50 Wed Dec 19 11:05:22 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c Mon Feb 10 22:33:06 2003 @@ -1,9 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.50 2001/12/19 16:05:22 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.69 2003/02/11 03:33:06 dawes Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * Copyright 1993 by David Dawes <dawes@xfree86.org> - * Copyright 1994-2001 by The XFree86 Project, Inc. + * Copyright 2002 by SuSE Linux AG, Author: Egbert Eich + * Copyright 1994-2002 by The XFree86 Project, Inc. + * Copyright 2002 by Paul Elliott * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -36,6 +38,12 @@ * [TVO-97/03/05] Added microsoft IntelliMouse support */ +/* + * [PME-02/08/11] Added suport for drag lock buttons + * for use with 4 button trackballs for convenience + * and to help limited dexterity persons + */ + #define NEED_EVENTS #include "X.h" #include "Xproto.h" @@ -63,7 +71,52 @@ #include "mousePriv.h" #include "mipointer.h" +enum { + /* number of bits in mapped nibble */ + NIB_BITS=4, + /* size of map of nibbles to bitmask */ + NIB_SIZE= (1 << NIB_BITS), + /* mask for map */ + NIB_MASK= (NIB_SIZE -1), + /* number of maps to map all the buttons */ + NIB_COUNT = ((MSE_MAXBUTTONS+NIB_BITS-1)/NIB_BITS) +}; + +/*data to be used in implementing trackball drag locks.*/ +typedef struct _DragLockRec { + + /* Fields used to implement trackball drag locks. */ + /* mask for those buttons that are ordinary drag lock buttons */ + int lockButtonsM; + + /* mask for the master drag lock button if any */ + int masterLockM; + + /* button state up/down from last time adjusted for drag locks */ + int lockLastButtons; + + /* + * true if master lock state i.e. master drag lock + * button has just been pressed + */ + int masterTS; + + /* simulate these buttons being down although they are not */ + int simulatedDown; + + /* + * data to map bits for drag lock buttons to corresponding + * bits for the target buttons + */ + int nib_table[NIB_COUNT][NIB_SIZE]; + +} DragLockRec, *DragLockPtr; + + + +#ifdef XFree86LOADER static const OptionInfoRec *MouseAvailableOptions(void *unused); +#endif static InputInfoPtr MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags); #if 0 static void MouseUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags); @@ -78,9 +131,28 @@ static void MousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw); static void MouseReadInput(InputInfoPtr pInfo); -static void initPs2(InputInfoPtr pInfo, Bool reinsert); -static Bool ps2mouseReset(InputInfoPtr pInfo, unsigned char val); +static void MouseBlockHandler(pointer data, struct timeval **waitTime, + pointer LastSelectMask); +static void MouseWakeupHandler(pointer data, int i, pointer LastSelectMask); +static void FlushButtons(MouseDevPtr pMse); + +static Bool SetupMouse(InputInfoPtr pInfo); +static Bool initMouseHW(InputInfoPtr pInfo); +#ifdef SUPPORT_MOUSE_RESET +static Bool mouseReset(InputInfoPtr pInfo, unsigned char val); +static void ps2WakeupHandler(pointer data, int i, pointer LastSelectMask); +static void ps2BlockHandler(pointer data, struct timeval **waitTime, + pointer LastSelectMask); +#endif +/* mouse autoprobe stuff */ +static const char *autoOSProtocol(InputInfoPtr pInfo, int *protoPara); +static void autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync); +static void checkForErraticMovements(InputInfoPtr pInfo, int dx, int dy); +static Bool collectData(MouseDevPtr pMse, unsigned char u); +static void SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID); +static Bool autoGood(MouseDevPtr pMse); + #undef MOUSE InputDriverRec MOUSE = { 1, @@ -107,9 +179,16 @@ OPTION_FLIP_XY, OPTION_INV_X, OPTION_INV_Y, + OPTION_ANGLE_OFFSET, OPTION_Z_AXIS_MAPPING, OPTION_SAMPLE_RATE, OPTION_RESOLUTION, + OPTION_EMULATE_WHEEL, + OPTION_EMU_WHEEL_BUTTON, + OPTION_EMU_WHEEL_INERTIA, + OPTION_X_AXIS_MAPPING, + OPTION_Y_AXIS_MAPPING, + OPTION_AUTO_SOFT, OPTION_CLEAR_DTR, OPTION_CLEAR_RTS, OPTION_BAUD_RATE, @@ -119,11 +198,7 @@ OPTION_FLOW_CONTROL, OPTION_VTIME, OPTION_VMIN, - OPTION_EMULATE_WHEEL, - OPTION_EMU_WHEEL_BUTTON, - OPTION_EMU_WHEEL_INERTIA, - OPTION_X_AXIS_MAPPING, - OPTION_Y_AXIS_MAPPING + OPTION_DRAGLOCKBUTTONS } MouseOpts; static const OptionInfoRec mouseOptions[] = { @@ -141,9 +216,17 @@ { OPTION_FLIP_XY, "FlipXY", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_INV_X, "InvX", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_INV_Y, "InvY", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ANGLE_OFFSET, "AngleOffset", OPTV_INTEGER, {0}, FALSE }, { OPTION_Z_AXIS_MAPPING, "ZAxisMapping", OPTV_STRING, {0}, FALSE }, { OPTION_SAMPLE_RATE, "SampleRate", OPTV_INTEGER, {0}, FALSE }, { OPTION_RESOLUTION, "Resolution", OPTV_INTEGER, {0}, FALSE }, + { OPTION_EMULATE_WHEEL, "EmulateWheel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_EMU_WHEEL_BUTTON, "EmulateWheelButton", OPTV_INTEGER, {0}, FALSE }, + { OPTION_EMU_WHEEL_INERTIA, "EmulateWheelInertia", OPTV_INTEGER, {0}, FALSE }, + { OPTION_X_AXIS_MAPPING, "XAxisMapping", OPTV_STRING, {0}, FALSE }, + { OPTION_Y_AXIS_MAPPING, "YAxisMapping", OPTV_STRING, {0}, FALSE }, + { OPTION_AUTO_SOFT, "AutoSoft", OPTV_BOOLEAN, {0}, FALSE }, + /* serial options */ { OPTION_CLEAR_DTR, "ClearDTR", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CLEAR_RTS, "ClearRTS", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_BAUD_RATE, "BaudRate", OPTV_INTEGER, {0}, FALSE }, @@ -153,11 +236,8 @@ { OPTION_FLOW_CONTROL, "FlowControl", OPTV_STRING, {0}, FALSE }, { OPTION_VTIME, "VTime", OPTV_INTEGER, {0}, FALSE }, { OPTION_VMIN, "VMin", OPTV_INTEGER, {0}, FALSE }, - { OPTION_EMULATE_WHEEL, "EmulateWheel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_EMU_WHEEL_BUTTON, "EmulateWheelButton", OPTV_INTEGER, {0}, FALSE }, - { OPTION_EMU_WHEEL_INERTIA, "EmulateWheelInertia", OPTV_INTEGER, {0}, FALSE }, - { OPTION_X_AXIS_MAPPING, "XAxisMapping", OPTV_STRING, {0}, FALSE }, - { OPTION_Y_AXIS_MAPPING, "YAxisMapping", OPTV_STRING, {0}, FALSE }, + { OPTION_DRAGLOCKBUTTONS, "DragLockButtons",OPTV_STRING, {0}, FALSE }, + /* end serial options */ { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -176,7 +256,7 @@ NULL }; /* MouseSystems */ -static const char *mscDefaults[] = { +static const char *mlDefaults[] = { "BaudRate", "1200", "DataBits", "8", "StopBits", "2", @@ -197,7 +277,8 @@ "VMin", "1", NULL }; -/* Logitech series 9 */ +#if 0 +/* Logitech series 9 *//* same as msc: now mlDefaults */ static const char *logiDefaults[] = { "BaudRate", "1200", "DataBits", "8", @@ -208,6 +289,7 @@ "VMin", "1", NULL }; +#endif /* Hitachi Tablet */ static const char *mmhitDefaults[] = { "BaudRate", "1200", @@ -235,9 +317,9 @@ /* Serial protocols */ { "Microsoft", MSE_SERIAL, msDefaults, PROT_MS }, - { "MouseSystems", MSE_SERIAL, mscDefaults, PROT_MSC }, + { "MouseSystems", MSE_SERIAL, mlDefaults, PROT_MSC }, { "MMSeries", MSE_SERIAL, mmDefaults, PROT_MM }, - { "Logitech", MSE_SERIAL, logiDefaults, PROT_LOGI }, + { "Logitech", MSE_SERIAL, mlDefaults, PROT_LOGI }, { "MouseMan", MSE_SERIAL, msDefaults, PROT_LOGIMAN }, { "MMHitTab", MSE_SERIAL, mmhitDefaults, PROT_MMHIT }, { "GlidePoint", MSE_SERIAL, msDefaults, PROT_GLIDE }, @@ -247,6 +329,7 @@ /* Standard PS/2 */ { "PS/2", MSE_PS2, NULL, PROT_PS2 }, + { "GenericPS/2", MSE_PS2, NULL, PROT_GENPS2 }, /* Extended PS/2 */ { "ImPS/2", MSE_XPS2, NULL, PROT_IMPS2 }, @@ -264,147 +347,20 @@ { "Auto", MSE_AUTO, NULL, PROT_AUTO }, /* Misc (usually OS-specific) */ - { "SysMouse", MSE_MISC, mscDefaults, PROT_SYSMOUSE }, + { "SysMouse", MSE_MISC, mlDefaults, PROT_SYSMOUSE }, /* end of list */ { NULL, MSE_NONE, NULL, PROT_UNKNOWN } }; +#ifdef XFree86LOADER /*ARGSUSED*/ static const OptionInfoRec * MouseAvailableOptions(void *unused) { return (mouseOptions); -} - -static MouseProtocolID -ProtocolNameToID(const char *name) -{ - int i; - - for (i = 0; mouseProtocols[i].name; i++) - if (xf86NameCmp(name, mouseProtocols[i].name) == 0) - return mouseProtocols[i].id; - return PROT_UNKNOWN; -} - -static const char * -ProtocolIDToName(MouseProtocolID id) -{ - int i; - - switch (id) { - case PROT_UNKNOWN: - return "Unknown"; - break; - case PROT_UNSUP: - return "Unsupported"; - break; - default: - for (i = 0; mouseProtocols[i].name; i++) - if (id == mouseProtocols[i].id) - return mouseProtocols[i].name; - return "Invalid"; - } -} - -const char * -xf86MouseProtocolIDToName(MouseProtocolID id) -{ - return ProtocolIDToName(id); -} - -MouseProtocolID -xf86MouseProtocolNameToID(const char *name) -{ - return ProtocolNameToID(name); -} - -static int -ProtocolIDToClass(MouseProtocolID id) -{ - int i; - - switch (id) { - case PROT_UNKNOWN: - case PROT_UNSUP: - return MSE_NONE; - break; - default: - for (i = 0; mouseProtocols[i].name; i++) - if (id == mouseProtocols[i].id) - return mouseProtocols[i].class; - return MSE_NONE; - } -} - -static MouseProtocolPtr -GetProtocol(MouseProtocolID id) { - int i; - - switch (id) { - case PROT_UNKNOWN: - case PROT_UNSUP: - return NULL; - break; - default: - for (i = 0; mouseProtocols[i].name; i++) - if (id == mouseProtocols[i].id) - return &mouseProtocols[i]; - return NULL; - } -} - -static OSMouseInfoPtr osInfo = NULL; - -static Bool -InitProtocols(void) -{ - int classes; - int i; - const char *osname = NULL; - - if (osInfo) - return TRUE; - - osInfo = xf86OSMouseInit(0); - if (!osInfo) - return FALSE; - if (!osInfo->SupportedInterfaces) - return FALSE; - - classes = osInfo->SupportedInterfaces(); - if (!classes) - return FALSE; - - /* Mark unsupported interface classes. */ - for (i = 0; mouseProtocols[i].name; i++) - if (!(mouseProtocols[i].class & classes)) - mouseProtocols[i].id = PROT_UNSUP; - - for (i = 0; mouseProtocols[i].name; i++) - if (mouseProtocols[i].class & MSE_MISC) - if (!osInfo->CheckProtocol || - !osInfo->CheckProtocol(mouseProtocols[i].name)) - mouseProtocols[i].id = PROT_UNSUP; - - /* NetBSD uses PROT_BM for "PS/2". */ - xf86GetOS(&osname, NULL, NULL, NULL); - if (osname && xf86NameCmp(osname, "netbsd") == 0) - for (i = 0; mouseProtocols[i].name; i++) - if (mouseProtocols[i].id == PROT_PS2) - mouseProtocols[i].id = PROT_BM; - - return TRUE; } - -static void MouseBlockHandler(pointer data, - struct timeval **waitTime, - pointer LastSelectMask); - -static void MouseWakeupHandler(pointer data, - int i, - pointer LastSelectMask); +#endif /* Process options common to all mouse types. */ static void @@ -427,9 +383,12 @@ pMse->emulate3Buttons = xf86SetBoolOption(pInfo->options, "Emulate3Buttons", FALSE); - pMse->emulate3Timeout = xf86SetIntOption(pInfo->options, "Emulate3Timeout", - 50); - if (pMse->emulate3Buttons) { + if (!xf86FindOptionValue(pInfo->options,"Emulate3Buttons")) + pMse->emulate3ButtonsSoft = TRUE; + + pMse->emulate3Timeout = xf86SetIntOption(pInfo->options, + "Emulate3Timeout", 50); + if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) { xf86Msg(X_CONFIG, "%s: Emulate3Buttons, Emulate3Timeout: %d\n", pInfo->name, pMse->emulate3Timeout); } @@ -450,7 +409,116 @@ xf86Msg(X_CONFIG, "%s: InvY\n", pInfo->name); } else pMse->invY = 1; + pMse->angleOffset = xf86SetIntOption(pInfo->options, "AngleOffset", 0); + + if (pMse->pDragLock) + xfree(pMse->pDragLock); + pMse->pDragLock = NULL; + + s = xf86SetStrOption(pInfo->options, "DragLockButtons", NULL); + + if (s) { + int lock; /* lock button */ + int target; /* target button */ + int lockM,targetM; /* bitmasks for drag lock, target */ + int i, j; /* indexes */ + char *s1; /* parse input string */ + DragLockPtr pLock; + + pLock = pMse->pDragLock = xcalloc(1, sizeof(DragLockRec)); + /* init code */ + + /* initial string to be taken apart */ + s1 = s; + + /* keep getting numbers which are buttons */ + while ((s1 != NULL) && (lock = strtol(s1, &s1, 10)) != 0) { + + /* check sanity for a button */ + if ((lock < 0) || (lock > MSE_MAXBUTTONS)) { + xf86Msg(X_WARNING, "DragLock: Invalid button number = %d\n", + lock); + break; + }; + /* turn into a button mask */ + lockM = 1 << (lock - 1); + + /* try to get drag lock button */ + if ((s1 == NULL) || ((target=strtol(s1, &s1, 10)) == 0)) { + /*if no target, must be a master drag lock button */ + /* save master drag lock mask */ + pLock->masterLockM = lockM; + xf86Msg(X_CONFIG, + "DragLock button %d is master drag lock", + lock); + } else { + /* have target button number*/ + /* check target button number for sanity */ + if ((target < 0) || (target > MSE_MAXBUTTONS)) { + xf86Msg(X_WARNING, + "DragLock: Invalid button number for target=%d\n", + target); + break; + } + + /* target button mask */ + targetM = 1 << (target - 1); + + xf86Msg(X_CONFIG, + "DragLock: button %d is drag lock for button %d\n", + lock,target); + lock--; + + /* initialize table that maps drag lock mask to target mask */ + pLock->nib_table[lock / NIB_SIZE][1 << (lock % NIB_BITS)] = + targetM; + + /* add new drag lock to mask of drag locks */ + pLock->lockButtonsM |= lockM; + } + + } + + /* + * fill out rest of map that maps sets of drag lock buttons + * to sets of target buttons, in the form of masks + */ + + /* for each nibble */ + for (i = 0; i < NIB_COUNT; i++) { + /* for each possible set of bits for that nibble */ + for (j = 0; j < NIB_SIZE; j++) { + int ff, fM, otherbits; + + /* get first bit set in j*/ + ff = ffs(j) - 1; + /* if 0 bits set nothing to do */ + if (ff >= 0) { + /* form mask for fist bit set */ + fM = 1 << ff; + /* mask off first bit set to get remaining bits set*/ + otherbits = j & ~fM; + /* + * if otherbits =0 then only 1 bit set + * so j=fM + * nib_table[i][fM] already calculated if fM has + * only 1 bit set. + * nib_table[i][j] has already been filled in + * by previous loop. otherwise + * otherbits < j so nibtable[i][otherbits] + * has already been calculated. + */ + if (otherbits) + pLock->nib_table[i][j] = + pLock->nib_table[i][fM] | + pLock->nib_table[i][otherbits]; + + } + } + } + } + s = xf86SetStrOption(pInfo->options, "ZAxisMapping", NULL); if (s) { int b1 = 0, b2 = 0, b3 = 0, b4 = 0; @@ -590,99 +658,329 @@ xf86Msg(from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); } +/* + * map bits corresponding to lock buttons. + * for each bit for a lock button, + * turn on bit corresponding to button button that the lock + * button services. + */ -static InputInfoPtr -MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) +static int +lock2targetMap(DragLockPtr pLock, int lockMask) { - InputInfoPtr pInfo; - MouseDevPtr pMse; - MessageType from = X_DEFAULT; - const char *protocol; - MouseProtocolID protocolID; - MouseProtocolPtr pProto; - - if (!InitProtocols()) - return NULL; - - if (!(pInfo = xf86AllocateInput(drv, 0))) - return NULL; - - /* Initialise the InputInfoRec. */ - pInfo->name = dev->identifier; - pInfo->type_name = XI_MOUSE; - pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; - pInfo->device_control = MouseProc; - pInfo->read_input = MouseReadInput; - pInfo->motion_history_proc = xf86GetMotionEvents; - pInfo->history_size = 0; - pInfo->control_proc = NULL; - pInfo->close_proc = NULL; - pInfo->switch_mode = NULL; - pInfo->conversion_proc = MouseConvert; - pInfo->reverse_conversion_proc = NULL; - pInfo->fd = -1; - pInfo->dev = NULL; - pInfo->private_flags = 0; - pInfo->always_core_feedback = 0; - pInfo->conf_idev = dev; + int result,i; + result = 0; - /* Allocate the MouseDevRec and initialise it. */ /* - * XXX This should be done by a function in the core server since the - * MouseDevRec is defined in the os-support layer. + * for each nibble group of bits, use + * map for that group to get corresponding + * bits, turn them on. + * if 4 or less buttons only first map will + * need to be used. */ - if (!(pMse = xcalloc(sizeof(MouseDevRec), 1))) - return pInfo; - pInfo->private = pMse; - pMse->Ctrl = MouseCtrl; - pMse->PostEvent = MousePostEvent; - pMse->CommonOptions = MouseCommonOptions; + for (i = 0; (i < NIB_COUNT) && lockMask; i++) { + result |= pLock->nib_table[i][lockMask& NIB_MASK]; - /* Find the protocol type. */ - protocol = xf86SetStrOption(dev->commonOptions, "Protocol", NULL); - if (protocol) { - from = X_CONFIG; - } else if (osInfo->DefaultProtocol) { - protocol = osInfo->DefaultProtocol(); - from = X_DEFAULT; + lockMask &= ~NIB_MASK; + lockMask >>= NIB_BITS; } - if (!protocol) { - xf86Msg(X_ERROR, "%s: No Protocol specified\n", pInfo->name); - return pInfo; + return result; +} + +static void +MouseHWOptions(InputInfoPtr pInfo) +{ + MouseDevPtr pMse = pInfo->private; + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; + + if (mPriv == NULL) + return; + + if ((mPriv->soft + = xf86SetBoolOption(pInfo->options, "AutoSoft", FALSE))) { + xf86Msg(X_CONFIG, "Don't initialize mouse when auto-probing\n"); } - protocolID = ProtocolNameToID(protocol); - switch (protocolID) { - case PROT_UNKNOWN: - /* Check for a builtin OS-specific protocol, and call its PreInit. */ - if (osInfo->CheckProtocol && osInfo->CheckProtocol(protocol)) { - if (osInfo->PreInit) { - osInfo->PreInit(pInfo, protocol, 0); - } - return pInfo; + pMse->sampleRate = xf86SetIntOption(pInfo->options, "SampleRate", 0); + if (pMse->sampleRate) { + xf86Msg(X_CONFIG, "%s: SampleRate: %d\n", pInfo->name, + pMse->sampleRate); + } + pMse->resolution = xf86SetIntOption(pInfo->options, "Resolution", 0); + if (pMse->resolution) { + xf86Msg(X_CONFIG, "%s: Resolution: %d\n", pInfo->name, + pMse->resolution); + } +} + +static void +MouseSerialOptions(InputInfoPtr pInfo) +{ + MouseDevPtr pMse = pInfo->private; + Bool clearDTR, clearRTS; + + + pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0); + if (pMse->baudRate) { + xf86Msg(X_CONFIG, "%s: BaudRate: %d\n", pInfo->name, + pMse->baudRate); + } + + if ((clearDTR = xf86SetBoolOption(pInfo->options, "ClearDTR",FALSE))) + pMse->mouseFlags |= MF_CLEAR_DTR; + + + if ((clearRTS = xf86SetBoolOption(pInfo->options, "ClearRTS",FALSE))) + pMse->mouseFlags |= MF_CLEAR_RTS; + + if (clearDTR || clearRTS) { + xf86Msg(X_CONFIG, "%s: ", pInfo->name); + if (clearDTR) { + xf86ErrorF("ClearDTR"); + if (clearRTS) + xf86ErrorF(", "); } - xf86Msg(X_ERROR, "%s: Unknown protocol \"%s\"\n", pInfo->name, - protocol); - return pInfo; + if (clearRTS) { + xf86ErrorF("ClearRTS"); + } + xf86ErrorF("\n"); + } +} + +static MouseProtocolID +ProtocolNameToID(const char *name) +{ + int i; + + for (i = 0; mouseProtocols[i].name; i++) + if (xf86NameCmp(name, mouseProtocols[i].name) == 0) + return mouseProtocols[i].id; + return PROT_UNKNOWN; +} + +static const char * +ProtocolIDToName(MouseProtocolID id) +{ + int i; + + switch (id) { + case PROT_UNKNOWN: + return "Unknown"; break; case PROT_UNSUP: - xf86Msg(X_ERROR, - "%s: Protocol \"%s\" is not supported on this platform\n", - pInfo->name, protocol); - return pInfo; + return "Unsupported"; + break; + default: + for (i = 0; mouseProtocols[i].name; i++) + if (id == mouseProtocols[i].id) + return mouseProtocols[i].name; + return "Invalid"; + } +} + +const char * +xf86MouseProtocolIDToName(MouseProtocolID id) +{ + return ProtocolIDToName(id); +} + +MouseProtocolID +xf86MouseProtocolNameToID(const char *name) +{ + return ProtocolNameToID(name); +} + +static int +ProtocolIDToClass(MouseProtocolID id) +{ + int i; + + switch (id) { + case PROT_UNKNOWN: + case PROT_UNSUP: + return MSE_NONE; + break; + default: + for (i = 0; mouseProtocols[i].name; i++) + if (id == mouseProtocols[i].id) + return mouseProtocols[i].class; + return MSE_NONE; + } +} + +static MouseProtocolPtr +GetProtocol(MouseProtocolID id) { + int i; + + switch (id) { + case PROT_UNKNOWN: + case PROT_UNSUP: + return NULL; break; default: - xf86Msg(from, "%s: Protocol: \"%s\"\n", pInfo->name, protocol); + for (i = 0; mouseProtocols[i].name; i++) + if (id == mouseProtocols[i].id) { + return &mouseProtocols[i]; + } + return NULL; + } +} + +static OSMouseInfoPtr osInfo = NULL; + +static Bool +InitProtocols(void) +{ + int classes; + int i; + const char *osname = NULL; + + if (osInfo) + return TRUE; + + osInfo = xf86OSMouseInit(0); + if (!osInfo) + return FALSE; + if (!osInfo->SupportedInterfaces) + return FALSE; + + classes = osInfo->SupportedInterfaces(); + if (!classes) + return FALSE; + + /* Mark unsupported interface classes. */ + for (i = 0; mouseProtocols[i].name; i++) + if (!(mouseProtocols[i].class & classes)) + mouseProtocols[i].id = PROT_UNSUP; + + for (i = 0; mouseProtocols[i].name; i++) + if (mouseProtocols[i].class & MSE_MISC) + if (!osInfo->CheckProtocol || + !osInfo->CheckProtocol(mouseProtocols[i].name)) + mouseProtocols[i].id = PROT_UNSUP; + + /* NetBSD uses PROT_BM for "PS/2". */ + xf86GetOS(&osname, NULL, NULL, NULL); + if (osname && xf86NameCmp(osname, "netbsd") == 0) + for (i = 0; mouseProtocols[i].name; i++) + if (mouseProtocols[i].id == PROT_PS2) + mouseProtocols[i].id = PROT_BM; + + return TRUE; +} + +static InputInfoPtr +MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr pInfo; + MouseDevPtr pMse; + mousePrivPtr mPriv; + MessageType from = X_DEFAULT; + const char *protocol, *osProt = NULL; + MouseProtocolID protocolID; + MouseProtocolPtr pProto; + Bool detected; + + if (!InitProtocols()) + return NULL; + + if (!(pInfo = xf86AllocateInput(drv, 0))) + return NULL; + + /* Initialise the InputInfoRec. */ + pInfo->name = dev->identifier; + pInfo->type_name = XI_MOUSE; + pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; + pInfo->device_control = MouseProc; + pInfo->read_input = MouseReadInput; + pInfo->motion_history_proc = xf86GetMotionEvents; + pInfo->history_size = 0; + pInfo->control_proc = NULL; + pInfo->close_proc = NULL; + pInfo->switch_mode = NULL; + pInfo->conversion_proc = MouseConvert; + pInfo->reverse_conversion_proc = NULL; + pInfo->fd = -1; + pInfo->dev = NULL; + pInfo->private_flags = 0; + pInfo->always_core_feedback = 0; + pInfo->conf_idev = dev; + + /* Allocate the MouseDevRec and initialise it. */ + /* + * XXX This should be done by a function in the core server since the + * MouseDevRec is defined in the os-support layer. + */ + if (!(pMse = xcalloc(sizeof(MouseDevRec), 1))) + return pInfo; + pInfo->private = pMse; + pMse->Ctrl = MouseCtrl; + pMse->PostEvent = MousePostEvent; + pMse->CommonOptions = MouseCommonOptions; + + /* Find the protocol type. */ + protocol = xf86SetStrOption(dev->commonOptions, "Protocol", NULL); + if (protocol) { + from = X_CONFIG; + } else if (osInfo->DefaultProtocol) { + protocol = osInfo->DefaultProtocol(); + from = X_DEFAULT; + } + if (!protocol) { + xf86Msg(X_ERROR, "%s: No Protocol specified\n", pInfo->name); + return pInfo; } + protocolID = ProtocolNameToID(protocol); + do { + detected = TRUE; + switch (protocolID) { + case PROT_AUTO: + if (osInfo->SetupAuto) { + if ((osProt = osInfo->SetupAuto(pInfo,NULL))) { + int id = ProtocolNameToID(osProt); + if (id == PROT_UNKNOWN || id == PROT_UNSUP) { + protocolID = id; + protocol = osProt; + detected = FALSE; + } + } + } + break; + case PROT_UNKNOWN: + /* Check for a builtin OS-specific protocol, + * and call its PreInit. */ + if (osInfo->CheckProtocol + && osInfo->CheckProtocol(protocol)) { + if (osInfo->PreInit) { + osInfo->PreInit(pInfo, protocol, 0); + } + return pInfo; + } + xf86Msg(X_ERROR, "%s: Unknown protocol \"%s\"\n", + pInfo->name, protocol); + return pInfo; + break; + case PROT_UNSUP: + xf86Msg(X_ERROR, + "%s: Protocol \"%s\" is not supported on this " + "platform\n", pInfo->name, protocol); + return pInfo; + break; + default: + break; + + } + } while (!detected); + + + xf86Msg(from, "%s: Protocol: \"%s\"\n", pInfo->name, protocol); if (!(pProto = GetProtocol(protocolID))) return pInfo; - pMse->protocol = protocol; pMse->protocolID = protocolID; pMse->oldProtocolID = protocolID; /* hack */ - pMse->origProtocolID = protocolID; - pMse->origProtocol = protocol; - pMse->class = ProtocolIDToClass(protocolID); + + pMse->autoProbe = FALSE; /* Collect the options, and process the common options. */ xf86CollectInputOptions(pInfo, pProto->defaults, NULL); @@ -710,401 +1008,23 @@ #endif pInfo->fd = -1; + if (!(mPriv = (pointer) xcalloc(sizeof(mousePrivRec), 1))) + return pInfo; + pMse->mousePriv = mPriv; pMse->CommonOptions(pInfo); + pMse->checkMovements = checkForErraticMovements; + pMse->autoProbeMouse = autoProbeMouse; + pMse->collectData = collectData; + pMse->dataGood = autoGood; + + MouseHWOptions(pInfo); + MouseSerialOptions(pInfo); + + pInfo->flags |= XI86_CONFIGURED; + return pInfo; +} - pMse->sampleRate = xf86SetIntOption(pInfo->options, "SampleRate", 0); - if (pMse->sampleRate) { - xf86Msg(X_CONFIG, "%s: SampleRate: %d\n", pInfo->name, - pMse->sampleRate); - } - pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0); - if (pMse->baudRate) { - xf86Msg(X_CONFIG, "%s: BaudRate: %d\n", pInfo->name, - pMse->baudRate); - } - pMse->resolution = xf86SetIntOption(pInfo->options, "Resolution", 0); - if (pMse->resolution) { - xf86Msg(X_CONFIG, "%s: Resolution: %d\n", pInfo->name, - pMse->resolution); - } - - pMse->clearDTR = xf86SetBoolOption(pInfo->options, "ClearDTR", FALSE); - pMse->clearRTS = xf86SetBoolOption(pInfo->options, "ClearRTS", FALSE); - if (pMse->clearDTR || pMse->clearRTS) { - xf86Msg(X_CONFIG, "%s: ", pInfo->name); - if (pMse->clearDTR) { - xf86ErrorF("ClearDTR"); - if (pMse->clearRTS) - xf86ErrorF(", "); - } - if (pMse->clearRTS) { - xf86ErrorF("ClearRTS"); - } - xf86ErrorF("\n"); - } - - pInfo->flags |= XI86_CONFIGURED; - return pInfo; -} - -/* - * This array is indexed by the MouseProtocolID values, so the order of the entries - * must match that of the MouseProtocolID enum in mouse.h. - */ -static unsigned char proto[PROT_NUMPROTOS][8] = { - /* --header-- ---data--- packet -4th-byte- mouse */ - /* mask id mask id bytes mask id flags */ - /* Serial mice */ - { 0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00, MPF_NONE }, /* MicroSoft */ - { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_SAFE }, /* MouseSystems */ - { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* MMSeries */ - { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* Logitech */ - { 0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00, MPF_NONE }, /* MouseMan */ - { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* MM_HitTablet */ - { 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, MPF_NONE }, /* GlidePoint */ - { 0x40, 0x40, 0x40, 0x00, 3, ~0x3f, 0x00, MPF_NONE }, /* IntelliMouse */ - { 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, MPF_NONE }, /* ThinkingMouse */ - { 0x80, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* ACECAD */ - /* PS/2 variants */ - { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* PS/2 mouse */ - { 0x08, 0x08, 0x00, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* IntelliMouse */ - { 0x08, 0x08, 0x00, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* Explorer */ - { 0x80, 0x80, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* ThinkingMouse */ - { 0x08, 0x08, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* MouseMan+ */ - { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* GlidePoint */ - { 0x08, 0x08, 0x00, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* NetMouse */ - { 0xc0, 0x00, 0x00, 0x00, 6, 0x00, 0xff, MPF_NONE }, /* NetScroll */ - /* Bus Mouse */ - { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* BusMouse */ - { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* Auto (dummy) */ - { 0xf8, 0x80, 0x00, 0x00, 8, 0x00, 0xff, MPF_NONE }, /* SysMouse */ -}; - -/* - * SetupMouse -- - * Sets up the mouse parameters - */ -static Bool -SetupMouse(InputInfoPtr pInfo) -{ - /* - ** The following lines take care of the Logitech MouseMan protocols. - ** The "Logitech" protocol is for the old "series 9" Logitech products. - ** All products since then use the "MouseMan" protocol. Some models - ** were programmable, but most (all?) of the current models are not. - ** - ** NOTE: There are different versions of both MouseMan and TrackMan! - ** Hence I add another protocol PROT_LOGIMAN, which the user can - ** specify as MouseMan in his XF86Config file. This entry was - ** formerly handled as a special case of PROT_MS. However, people - ** who don't have the middle button problem, can still specify - ** Microsoft and use PROT_MS. - ** - ** By default, these mice should use a 3 byte Microsoft protocol - ** plus a 4th byte for the middle button. However, the mouse might - ** have switched to a different protocol before we use it, so I send - ** the proper sequence just in case. - ** - ** NOTE: - all commands to (at least the European) MouseMan have to - ** be sent at 1200 Baud. - ** - each command starts with a '*'. - ** - whenever the MouseMan receives a '*', it will switch back - ** to 1200 Baud. Hence I have to select the desired protocol - ** first, then select the baud rate. - ** - ** The protocols supported by the (European) MouseMan are: - ** - 5 byte packed binary protocol, as with the Mouse Systems - ** mouse. Selected by sequence "*U". - ** - 2 button 3 byte MicroSoft compatible protocol. Selected - ** by sequence "*V". - ** - 3 button 3+1 byte MicroSoft compatible protocol (default). - ** Selected by sequence "*X". - ** - ** The following baud rates are supported: - ** - 1200 Baud (default). Selected by sequence "*n". - ** - 9600 Baud. Selected by sequence "*q". - ** - ** Selecting a sample rate is no longer supported with the MouseMan! - ** [CHRIS-211092] - */ - - MouseDevPtr pMse; - int i; - int speed; - int protoPara[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; - const char *name = NULL; - const char *s; - Bool automatic = FALSE; - unsigned char c; - pointer options; - - pMse = pInfo->private; - /* Handle the "Auto" protocol. */ - if (pMse->origProtocolID == PROT_AUTO) { - MouseProtocolID protocolID = PROT_UNKNOWN; - - automatic = TRUE; - - /* Check if the OS has a detection mechanism. */ - if (osInfo->SetupAuto) { - name = osInfo->SetupAuto(pInfo, protoPara); - if (name) { - protocolID = ProtocolNameToID(name); - switch (protocolID) { - case PROT_UNKNOWN: - /* Check for a builtin OS-specific protocol. */ - if (osInfo->CheckProtocol && osInfo->CheckProtocol(name)) { - /* XXX need to handle auto-detected builtin protocols */ - } else - name = NULL; - break; - case PROT_UNSUP: - name = NULL; - break; - default: - break; - } - } - } -#ifdef PNP_MOUSE - if (!name) { - /* A PnP serial mouse? */ - protocolID = MouseGetPnpProtocol(pInfo); - if (protocolID >= 0 && protocolID < PROT_NUMPROTOS) { - name = ProtocolIDToName(protocolID); - xf86Msg(X_PROBED, "%s: PnP-detected protocol: \"%s\"\n", - pInfo->name, name); - } - } -#endif - if (name) { - pMse->protocol = name; - pMse->protocolID = protocolID; - } - } - memcpy(pMse->protoPara, proto[pMse->protocolID], sizeof(pMse->protoPara)); - if (automatic) { - - if (name) { - /* Possible protoPara overrides from SetupAuto. */ - for (i = 0; i < sizeof(pMse->protoPara); i++) - if (protoPara[i] != -1) - pMse->protoPara[i] = protoPara[i]; - } else { - xf86Msg(X_ERROR, "%s: cannot determine the mouse protocol\n", - pInfo->name); - return FALSE; - } - } - /* - * If protocol has changed fetch the default options - * for the new protocol. - */ - if (pMse->oldProtocolID != pMse->protocolID) { - pointer tmp = NULL; - if (mouseProtocols[pMse->protocolID].defaults) - tmp = xf86OptionListCreate( - mouseProtocols[pMse->protocolID].defaults, -1, 0); - pInfo->options = xf86OptionListMerge(pInfo->options, tmp); - /* baudrate is not explicitely set: fetch the default one */ - if (!pMse->baudRate) - pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0); - pMse->oldProtocolID = pMse->protocolID; /* hack */ - } - /* - * Write the baudrate back th the option list so that the serial - * interface code can access the new value. - */ - if (pMse->baudRate) - xf86ReplaceIntOption(pInfo->options, "BaudRate", pMse->baudRate); - - /* Set the port parameters. */ - if (!automatic) - xf86SetSerial(pInfo->fd, pInfo->options); - - switch (pMse->protocolID) { - case PROT_LOGI: /* Logitech Mice */ - /* - * The baud rate selection command must be sent at the current - * baud rate; try all likely settings. - */ - speed = pMse->baudRate; - switch (speed) { - case 9600: - s = "*q"; - break; - case 4800: - s = "*p"; - break; - case 2400: - s = "*o"; - break; - case 1200: - s = "*n"; - break; - default: - /* Fallback value */ - speed = 1200; - s = "*n"; - } - xf86SetSerialSpeed(pInfo->fd, 9600); - xf86WriteSerial(pInfo->fd, s, 2); - usleep(100000); - xf86SetSerialSpeed(pInfo->fd, 4800); - xf86WriteSerial(pInfo->fd, s, 2); - usleep(100000); - xf86SetSerialSpeed(pInfo->fd, 2400); - xf86WriteSerial(pInfo->fd, s, 2); - usleep(100000); - xf86SetSerialSpeed(pInfo->fd, 1200); - xf86WriteSerial(pInfo->fd, s, 2); - usleep(100000); - xf86SetSerialSpeed(pInfo->fd, speed); - - /* Select MM series data format. */ - xf86WriteSerial(pInfo->fd, "S", 1); - usleep(100000); - /* Set the parameters up for the MM series protocol. */ - options = pInfo->options; - xf86CollectInputOptions(pInfo, mmDefaults, NULL); - xf86SetSerial(pInfo->fd, pInfo->options); - pInfo->options = options; - - /* Select report rate/frequency. */ - if (pMse->sampleRate <= 0) c = 'O'; /* 100 */ - else if (pMse->sampleRate <= 15) c = 'J'; /* 10 */ - else if (pMse->sampleRate <= 27) c = 'K'; /* 20 */ - else if (pMse->sampleRate <= 42) c = 'L'; /* 35 */ - else if (pMse->sampleRate <= 60) c = 'R'; /* 50 */ - else if (pMse->sampleRate <= 85) c = 'M'; /* 67 */ - else if (pMse->sampleRate <= 125) c = 'Q'; /* 100 */ - else c = 'N'; /* 150 */ - xf86WriteSerial(pInfo->fd, &c, 1); - break; - - case PROT_LOGIMAN: - speed = pMse->baudRate; - switch (speed) { - case 9600: - s = "*q"; - break; - case 1200: - s = "*n"; - break; - default: - /* Fallback value */ - speed = 1200; - s = "*n"; - } - xf86SetSerialSpeed(pInfo->fd, 1200); - xf86WriteSerial(pInfo->fd, "*n", 2); - xf86WriteSerial(pInfo->fd, "*X", 2); - xf86WriteSerial(pInfo->fd, s, 2); - usleep(100000); - xf86SetSerialSpeed(pInfo->fd, speed); - break; - - case PROT_MMHIT: /* MM_HitTablet */ - /* - * Initialize Hitachi PUMA Plus - Model 1212E to desired settings. - * The tablet must be configured to be in MM mode, NO parity, - * Binary Format. pMse->sampleRate controls the sensitivity - * of the tablet. We only use this tablet for it's 4-button puck - * so we don't run in "Absolute Mode". - */ - xf86WriteSerial(pInfo->fd, "z8", 2); /* Set Parity = "NONE" */ - usleep(50000); - xf86WriteSerial(pInfo->fd, "zb", 2); /* Set Format = "Binary" */ - usleep(50000); - xf86WriteSerial(pInfo->fd, "@", 1); /* Set Report Mode = "Stream" */ - usleep(50000); - xf86WriteSerial(pInfo->fd, "R", 1); /* Set Output Rate = "45 rps" */ - usleep(50000); - xf86WriteSerial(pInfo->fd, "I\x20", 2); /* Set Incrememtal Mode "20" */ - usleep(50000); - xf86WriteSerial(pInfo->fd, "E", 1); /* Set Data Type = "Relative */ - usleep(50000); - /* - * These sample rates translate to 'lines per inch' on the Hitachi - * tablet. - */ - if (pMse->sampleRate <= 40) c = 'g'; - else if (pMse->sampleRate <= 100) c = 'd'; - else if (pMse->sampleRate <= 200) c = 'e'; - else if (pMse->sampleRate <= 500) c = 'h'; - else if (pMse->sampleRate <= 1000) c = 'j'; - else c = 'd'; - xf86WriteSerial(pInfo->fd, &c, 1); - usleep(50000); - xf86WriteSerial(pInfo->fd, "\021", 1); /* Resume DATA output */ - break; - - case PROT_THINKING: /* ThinkingMouse */ - /* This mouse may send a PnP ID string, ignore it. */ - usleep(200000); - xf86FlushInput(pInfo->fd); - /* Send the command to initialize the beast. */ - for (s = "E5E5"; *s; ++s) { - xf86WriteSerial(pInfo->fd, s, 1); - if ((xf86WaitForInput(pInfo->fd, 1000000) <= 0)) - break; - xf86ReadSerial(pInfo->fd, &c, 1); - if (c != *s) - break; - } - break; - - case PROT_MSC: /* MouseSystems Corp */ - usleep(100000); - xf86FlushInput(pInfo->fd); - break; - - case PROT_ACECAD: - /* initialize */ - /* A nul character resets. */ - xf86WriteSerial(pInfo->fd, "", 1); - usleep(50000); - /* Stream out relative mode high resolution increments of 1. */ - xf86WriteSerial(pInfo->fd, "@EeI!", 5); - break; - - case PROT_BM: /* bus/InPort mouse */ - if (osInfo->SetBMRes) - osInfo->SetBMRes(pInfo, pMse->protocol, pMse->sampleRate, - pMse->resolution); - break; - - case PROT_PS2: - case PROT_IMPS2: /* IntelliMouse */ - case PROT_EXPPS2: /* IntelliMouse Explorer */ - case PROT_THINKPS2: /* ThinkingMouse */ - case PROT_MMPS2: /* MouseMan+, FirstMouse+ */ - case PROT_GLIDEPS2: - case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */ - case PROT_NETSCPS2: /* NetScroll */ - if ((pMse->mousePriv = - (pointer) xcalloc(sizeof(ps2PrivRec), 1)) == 0) - return FALSE; - initPs2(pInfo,TRUE); - break; - case PROT_SYSMOUSE: - if (osInfo->SetMiscRes) - osInfo->SetMiscRes(pInfo, pMse->protocol, pMse->sampleRate, - pMse->resolution); - break; - - default: - /* Nothing to do. */ - break; - } - - pMse->protoBufTail = 0; - pMse->inSync = 0; - - return TRUE; -} - static void MouseReadInput(InputInfoPtr pInfo) { @@ -1114,6 +1034,7 @@ int c; unsigned char *pBuf, u; + pMse = pInfo->private; pBufP = pMse->protoBufTail; pBuf = pMse->protoBuf; @@ -1128,14 +1049,18 @@ while ((c = XisbRead(pMse->buffer)) >= 0) { u = (unsigned char)c; - - if (pMse->class & (MSE_PS2 | MSE_XPS2)) { - if (ps2mouseReset(pInfo,u)) { - pBufP = 0; +#if 1 + /* if we do autoprobing collect the data */ + if (pMse->collectData && pMse->autoProbe) + if (pMse->collectData(pMse,u)) continue; - } +#endif +#ifdef SUPPORT_MOUSE_RESET + if (mouseReset(pInfo,u)) { + pBufP = 0; + continue; } - +#endif if (pBufP >= pMse->protoPara[4]) { /* * Buffer contains a full packet, which has already been processed: @@ -1143,7 +1068,6 @@ * processed directly, without being put into the buffer first. */ pBufP = 0; - if ((u & pMse->protoPara[0]) != pMse->protoPara[1] && (u & pMse->protoPara[5]) == pMse->protoPara[6]) { /* @@ -1180,9 +1104,8 @@ * mistakingly received a byte even if we didn't see anything * preceeding the byte. */ - #ifdef EXTMOUSEDEBUG - ErrorF("mouse 4th byte %02x",u); + ErrorF("mouse 4th byte %02x\n",u); #endif dx = dy = dz = dw = 0; buttons = 0; @@ -1308,18 +1231,27 @@ /* Accept or reject the packet ? */ if ((pBuf[0] & pMse->protoPara[0]) != pMse->protoPara[1] || baddata) { + if (pMse->inSync) { #ifdef EXTMOUSEDEBUG - if (pMse->inSync) ErrorF("mouse driver lost sync\n"); +#endif + } +#ifdef EXTMOUSEDEBUG ErrorF("skipping byte %02x\n",*pBuf); #endif + /* Tell auto probe that we are out of sync */ + if (pMse->autoProbeMouse && pMse->autoProbe) + pMse->autoProbeMouse(pInfo, FALSE, pMse->inSync); pMse->protoBufTail = --pBufP; for (j = 0; j < pBufP; j++) pBuf[j] = pBuf[j+1]; pMse->inSync = 0; continue; } - + /* Tell auto probe that we were successful */ + if (pMse->autoProbeMouse && pMse->autoProbe) + pMse->autoProbeMouse(pInfo, TRUE, FALSE); + if (!pMse->inSync) { #ifdef EXTMOUSEDEBUG ErrorF("mouse driver back in sync\n"); @@ -1327,10 +1259,13 @@ pMse->inSync = 1; } + if (!pMse->dataGood(pMse)) + continue; + /* * Packet complete and verified, now process it ... */ - + REDO_INTERPRET: dz = dw = 0; switch (pMse->protocolID) { case PROT_LOGIMAN: /* MouseMan / TrackMan [CHRIS-211092] */ @@ -1393,6 +1328,7 @@ break; case PROT_PS2: /* PS/2 mouse */ + case PROT_GENPS2: /* generic PS/2 mouse */ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */ (pBuf[0] & 0x02) >> 1 | /* Right */ (pBuf[0] & 0x01) << 2; /* Left */ @@ -1411,11 +1347,26 @@ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1]; dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2]; dz = (char)pBuf[3]; - if ((dz >= 7) || (dz <= -7)) - dz = 0; + if ((dz >= 7) || (dz <= -8)) { + if (pMse->autoProbe && !(pBuf[3] & 0xC0)) { + SetMouseProto(pMse, PROT_EXPPS2); + xf86Msg(X_INFO, + "Mouse autoprobe: Changing protocol to %s\n", + pMse->protocol); + + goto REDO_INTERPRET; + } else + dz = 0; + } break; case PROT_EXPPS2: /* IntelliMouse Explorer PS/2 */ + if (pMse->autoProbe && (pBuf[3] & 0xC0)) { + SetMouseProto(pMse, PROT_IMPS2); + xf86Msg(X_INFO,"Mouse autoprobe: Changing protocol to %s\n", + pMse->protocol); + goto REDO_INTERPRET; + } buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */ (pBuf[0] & 0x02) >> 1 | /* Right */ (pBuf[0] & 0x01) << 2 | /* Left */ @@ -1505,8 +1456,9 @@ dy = - ((char)(pBuf[2]) + (char)(pBuf[4])); /* FreeBSD sysmouse sends additional data bytes */ if (pMse->protoPara[4] >= 8) { - dz = ((char)(pBuf[5] << 1) + (char)(pBuf[6] << 1)) / 2; - buttons |= (int)(~pBuf[7] & 0x07) << 3; + dz = ((signed char)(pBuf[5] << 1) + + (signed char)(pBuf[6] << 1)) >> 1; + buttons |= (int)(~pBuf[7] & 0x7f) << 3; } break; @@ -1516,14 +1468,20 @@ #endif continue; } - #ifdef EXTMOUSEDEBUG ErrorF("packet"); for ( j=0; j < pBufP; j++) ErrorF(" %02x",pBuf[j]); + ErrorF("\n"); #endif post_event: +#ifdef EXTMOUSEDEBUG + ErrorF("dx=%i dy=%i dz=%i dw=%i buttons=%x\n",dx,dy,dz,dw,buttons); +#endif + /* When auto-probing check if data makes sense */ + if (pMse->checkMovements && pMse->autoProbe) + pMse->checkMovements(pInfo,dx,dy); /* post an event */ pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); @@ -1566,18 +1524,21 @@ * *************************************************************************** */ + static int MouseProc(DeviceIntPtr device, int what) { InputInfoPtr pInfo; MouseDevPtr pMse; + mousePrivPtr mPriv; unsigned char map[MSE_MAXBUTTONS + 1]; - int i, blocked; - + int i; + pInfo = device->public.devicePrivate; pMse = pInfo->private; pMse->device = device; - + mPriv = (mousePrivPtr)pMse->mousePriv; + switch (what) { case DEVICE_INIT: @@ -1624,9 +1585,22 @@ XisbFree(pMse->buffer); pMse->buffer = NULL; } else { + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; + if (mPriv != NULL) { + if ( pMse->protocolID != PROT_AUTO) { + pMse->inSync = TRUE; /* @@@ */ + if (mPriv->soft) + mPriv->autoState = AUTOPROBE_GOOD; + else + mPriv->autoState = AUTOPROBE_H_GOOD; + } else { + if (mPriv->soft) + mPriv->autoState = AUTOPROBE_NOPROTO; + else + mPriv->autoState = AUTOPROBE_H_NOPROTO; + } + } xf86FlushInput(pInfo->fd); - if (pMse->protocolID == PROT_PS2) - xf86WriteSerial(pInfo->fd, "\364", 1); xf86AddEnabledDevice(pInfo); } } @@ -1635,15 +1609,8 @@ pMse->emulateState = 0; pMse->emulate3Pending = FALSE; device->public.on = TRUE; - /* - * send button up events for sanity. If no button down is pending - * xf86PostButtonEvent() will discard them. So we are on the safe side. - */ - blocked = xf86BlockSIGIO (); - for (i = 1; i <= 5; i++) - xf86PostButtonEvent(device,0,i,0,0,0); - xf86UnblockSIGIO (blocked); - if (pMse->emulate3Buttons) + FlushButtons(pMse); + if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) { RegisterBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler, (pointer) pInfo); @@ -1658,12 +1625,9 @@ XisbFree(pMse->buffer); pMse->buffer = NULL; } - if (pMse->mousePriv) - xfree(pMse->mousePriv); - pMse->mousePriv = NULL; xf86CloseSerial(pInfo->fd); pInfo->fd = -1; - if (pMse->emulate3Buttons) + if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) { RemoveBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler, (pointer) pInfo); @@ -1697,6 +1661,36 @@ return TRUE; } +/********************************************************************** + * + * FlushButtons -- send button up events for sanity. + * + **********************************************************************/ + +static void +FlushButtons(MouseDevPtr pMse) +{ + + /* If no button down is pending xf86PostButtonEvent() + * will discard them. So we are on the safe side. */ + + int i, blocked; + + pMse->lastButtons = 0; + + blocked = xf86BlockSIGIO (); + for (i = 1; i <= 5; i++) + xf86PostButtonEvent(pMse->device,0,i,0,0,0); + xf86UnblockSIGIO (blocked); +} + +/********************************************************************** + * + * Emulate3Button support code + * + **********************************************************************/ + + /* * Lets create a simple finite-state machine for 3 button emulation: * @@ -1880,6 +1874,24 @@ return 0; } +static Bool +Emulate3ButtonsSoft(InputInfoPtr pInfo) +{ + MouseDevPtr pMse = pInfo->private; + + if (!pMse->emulate3ButtonsSoft) + return TRUE; + + pMse->emulate3Buttons = FALSE; + + if (pMse->emulate3Pending) + buttonTimer(pInfo); + + xf86Msg(X_INFO,"3rd Button detected: disabling emulate3Button\n"); + + return FALSE; +} + static void MouseBlockHandler(pointer data, struct timeval **waitTime, pointer LastSelectMask) @@ -1913,6 +1925,12 @@ } } +/******************************************************************* + * + * Post mouse events + * + *******************************************************************/ + static void MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) { @@ -1998,264 +2016,1450 @@ change = buttons ^ reverseBits(hitachMap, pMse->lastButtons); else change = buttons ^ reverseBits(reverseMap, pMse->lastButtons); + + /* + * adjust buttons state for drag locks! + * if there is drag locks + */ + if (pMse->pDragLock) { + DragLockPtr pLock; + int tarOfGoingDown, tarOfDown; + int realbuttons; + + /* get drag lock block */ + pLock = pMse->pDragLock; + /* save real buttons */ + realbuttons = buttons; + + /* if drag lock used */ + + /* state of drag lock buttons not seen always up */ + + buttons &= ~pLock->lockButtonsM; + + /* + * if lock buttons being depressed changes state of + * targets simulatedDown. + */ + tarOfGoingDown = lock2targetMap(pLock, + realbuttons & change & pLock->lockButtonsM); + pLock->simulatedDown ^= tarOfGoingDown; + + /* targets of drag locks down */ + tarOfDown = lock2targetMap(pLock, + realbuttons & pLock->lockButtonsM); + + /* + * when simulatedDown set and target pressed, + * simulatedDown goes false + */ + pLock->simulatedDown &= ~(realbuttons & change); + + /* + * if master drag lock released + * then master drag lock state on + */ + pLock->masterTS |= (~realbuttons & change) & pLock->masterLockM; + + /* if master state, buttons going down are simulatedDown */ + if (pLock->masterTS) + pLock->simulatedDown |= (realbuttons & change); + + /* if any button pressed, no longer in master drag lock state */ + if (realbuttons & change) + pLock->masterTS = 0; + + /* if simulatedDown or drag lock down, simulate down */ + buttons |= (pLock->simulatedDown | tarOfDown); + + /* master button not seen */ + buttons &= ~(pLock->masterLockM); + + /* buttons changed since last time */ + change = buttons ^ pLock->lockLastButtons; + + /* save this time for next last time. */ + pLock->lockLastButtons = buttons; + } - if (pMse->emulate3Buttons) { + if (pMse->emulate3Buttons + && (!(buttons & 0x02) || Emulate3ButtonsSoft(pInfo))) { /* handle all but buttons 1 & 3 normally */ change &= ~05; /* emulate the third button by the other two */ + + emulateButtons = (buttons & 01) | ((buttons &04) >> 1); + + if ((id = stateTab[pMse->emulateState][emulateButtons][0]) != 0) + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + if ((id = stateTab[pMse->emulateState][emulateButtons][1]) != 0) + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + + pMse->emulateState = + stateTab[pMse->emulateState][emulateButtons][2]; + + if (stateTab[pMse->emulateState][4][0] != 0) { + pMse->emulate3Expires = GetTimeInMillis () + pMse->emulate3Timeout; + pMse->emulate3Pending = TRUE; + } else { + pMse->emulate3Pending = FALSE; + } + } + + while (change) { + id = ffs(change); + change &= ~(1 << (id - 1)); + xf86PostButtonEvent(pInfo->dev, 0, id, + (buttons & (1 << (id - 1))), 0, 0); + } + + pMse->lastButtons = truebuttons; + } +} + +static void +MousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw) +{ + MouseDevPtr pMse; + int zbutton = 0; + + pMse = pInfo->private; + + /* Map the Z axis movement. */ + /* XXX Could this go in the conversion_proc? */ + switch (pMse->negativeZ) { + case MSE_NOZMAP: /* do nothing */ + break; + case MSE_MAPTOX: + if (dz != 0) { + dx = dz; + dz = 0; + } + break; + case MSE_MAPTOY: + if (dz != 0) { + dy = dz; + dz = 0; + } + break; + default: /* buttons */ + buttons &= ~(pMse->negativeZ | pMse->positiveZ + | pMse->negativeW | pMse->positiveW); + if (dw < 0 || dz < -1) + zbutton = pMse->negativeW; + else if (dz < 0) + zbutton = pMse->negativeZ; + else if (dw > 0 || dz > 1) + zbutton = pMse->positiveW; + else if (dz > 0) + zbutton = pMse->positiveZ; + buttons |= zbutton; + dz = 0; + break; + } + + /* Apply angle offset */ + if (pMse->angleOffset != 0) { + double rad = 3.141592653 * pMse->angleOffset / 180.0; + int ndx = dx; + dx = (int)((dx * cos(rad)) + (dy * sin(rad)) + 0.5); + dy = (int)((dy * cos(rad)) - (ndx * sin(rad)) + 0.5); + } + + dx = pMse->invX * dx; + dy = pMse->invY * dy; + if (pMse->flipXY) { + int tmp = dx; + dx = dy; + dy = tmp; + } + MouseDoPostEvent(pInfo, buttons, dx, dy); + + /* + * If dz has been mapped to a button `down' event, we need to cook up + * a corresponding button `up' event. + */ + if (zbutton) { + buttons &= ~zbutton; + MouseDoPostEvent(pInfo, buttons, 0, 0); + } +} +/****************************************************************** + * + * Mouse Setup Code + * + ******************************************************************/ +/* + * This array is indexed by the MouseProtocolID values, so the order of the entries + * must match that of the MouseProtocolID enum in mouse.h. + */ +static unsigned char proto[PROT_NUMPROTOS][8] = { + /* --header-- ---data--- packet -4th-byte- mouse */ + /* mask id mask id bytes mask id flags */ + /* Serial mice */ + { 0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00, MPF_NONE }, /* MicroSoft */ + { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_SAFE }, /* MouseSystems */ + { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* MMSeries */ + { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* Logitech */ + { 0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00, MPF_NONE }, /* MouseMan */ + { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* MM_HitTablet */ + { 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, MPF_NONE }, /* GlidePoint */ + { 0x40, 0x40, 0x40, 0x00, 3, ~0x3f, 0x00, MPF_NONE }, /* IntelliMouse */ + { 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, MPF_NONE }, /* ThinkingMouse */ + { 0x80, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* ACECAD */ + /* PS/2 variants */ + { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* PS/2 mouse */ + { 0xc8, 0x08, 0x00, 0x00, 3, 0x00, 0x00, MPF_NONE }, /* genericPS/2 mouse*/ + { 0x08, 0x08, 0x00, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* IntelliMouse */ + { 0x08, 0x08, 0x00, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* Explorer */ + { 0x80, 0x80, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* ThinkingMouse */ + { 0x08, 0x08, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* MouseMan+ */ + { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* GlidePoint */ + { 0x08, 0x08, 0x00, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* NetMouse */ + { 0xc0, 0x00, 0x00, 0x00, 6, 0x00, 0xff, MPF_NONE }, /* NetScroll */ + /* Bus Mouse */ + { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* BusMouse */ + { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* Auto (dummy) */ + { 0xf8, 0x80, 0x00, 0x00, 8, 0x00, 0xff, MPF_NONE }, /* SysMouse */ +}; + + +/* + * SetupMouse -- + * Sets up the mouse parameters + */ +static Bool +SetupMouse(InputInfoPtr pInfo) +{ + MouseDevPtr pMse; + mousePrivPtr mPriv; + int i; + int protoPara[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; + const char *name = NULL; + Bool automatic = FALSE; + + pMse = pInfo->private; + mPriv = (mousePrivPtr)pMse->mousePriv; + + /* Handle the "Auto" protocol. */ + if (pMse->protocolID == PROT_AUTO) { + /* + * We come here when user specifies protocol "auto" in + * the configuration file or thru the xf86misc extensions. + * So we initialize autoprobing here. + * Probe for PnP/OS mouse first. If unsuccessful + * try to guess protocol from incoming data. + */ + automatic = TRUE; + pMse->autoProbe = TRUE; + name = autoOSProtocol(pInfo,protoPara); + if (name) { +#ifdef EXTMOUSEDEBUG + ErrorF("PnP/OS Mouse detected: %s\n",name); +#endif + } + } + + SetMouseProto(pMse, pMse->protocolID); + + if (automatic) { + if (name) { + /* Possible protoPara overrides from SetupAuto. */ + for (i = 0; i < sizeof(pMse->protoPara); i++) + if (protoPara[i] != -1) + pMse->protoPara[i] = protoPara[i]; + /* if we come here PnP/OS mouse probing was successful */ + } else { +#if 1 + /* PnP/OS mouse probing wasn't successful; we look at data */ +#else + xf86Msg(X_ERROR, "%s: cannot determine the mouse protocol\n", + pInfo->name); + return FALSE; +#endif + } + } + + /* + * If protocol has changed fetch the default options + * for the new protocol. + */ + if (pMse->oldProtocolID != pMse->protocolID) { + pointer tmp = NULL; + if ((pMse->protocolID >= 0) + && (pMse->protocolID < PROT_NUMPROTOS) + && mouseProtocols[pMse->protocolID].defaults) + tmp = xf86OptionListCreate( + mouseProtocols[pMse->protocolID].defaults, -1, 0); + pInfo->options = xf86OptionListMerge(pInfo->options, tmp); + /* + * If baudrate is set write it back to the option + * list so that the serial interface code can access + * the new value. Not set means default. + */ + if (pMse->baudRate) + xf86ReplaceIntOption(pInfo->options, "BaudRate", pMse->baudRate); + pMse->oldProtocolID = pMse->protocolID; /* hack */ + } + + + /* Set the port parameters. */ + if (!automatic) + xf86SetSerial(pInfo->fd, pInfo->options); + + if (!initMouseHW(pInfo)) + return FALSE; + + pMse->protoBufTail = 0; + pMse->inSync = 0; + + return TRUE; +} + +/******************************************************************** + * + * Mouse HW setup code + * + ********************************************************************/ + +/* +** The following lines take care of the Logitech MouseMan protocols. +** The "Logitech" protocol is for the old "series 9" Logitech products. +** All products since then use the "MouseMan" protocol. Some models +** were programmable, but most (all?) of the current models are not. +** +** NOTE: There are different versions of both MouseMan and TrackMan! +** Hence I add another protocol PROT_LOGIMAN, which the user can +** specify as MouseMan in his XF86Config file. This entry was +** formerly handled as a special case of PROT_MS. However, people +** who don't have the middle button problem, can still specify +** Microsoft and use PROT_MS. +** +** By default, these mice should use a 3 byte Microsoft protocol +** plus a 4th byte for the middle button. However, the mouse might +** have switched to a different protocol before we use it, so I send +** the proper sequence just in case. +** +** NOTE: - all commands to (at least the European) MouseMan have to +** be sent at 1200 Baud. +** - each command starts with a '*'. +** - whenever the MouseMan receives a '*', it will switch back +** to 1200 Baud. Hence I have to select the desired protocol +** first, then select the baud rate. +** +** The protocols supported by the (European) MouseMan are: +** - 5 byte packed binary protocol, as with the Mouse Systems +** mouse. Selected by sequence "*U". +** - 2 button 3 byte MicroSoft compatible protocol. Selected +** by sequence "*V". +** - 3 button 3+1 byte MicroSoft compatible protocol (default). +** Selected by sequence "*X". +** +** The following baud rates are supported: +** - 1200 Baud (default). Selected by sequence "*n". +** - 9600 Baud. Selected by sequence "*q". +** +** Selecting a sample rate is no longer supported with the MouseMan! +** [CHRIS-211092] +*/ + +/* + * Do a reset wrap mode before reset. + */ +#define do_ps2Reset(x) { \ + int i = 10;\ + while (i-- > 0) { \ + xf86FlushInput(x->fd); \ + if (ps2Reset(x)) break; \ + } \ + } + + +static Bool +initMouseHW(InputInfoPtr pInfo) +{ + MouseDevPtr pMse = pInfo->private; + const char *s; + unsigned char c; + int speed; + pointer options; + unsigned char *param = NULL; + int paramlen = 0; + int count = 10; + Bool ps2Init = TRUE; + + switch (pMse->protocolID) { + case PROT_LOGI: /* Logitech Mice */ + /* + * The baud rate selection command must be sent at the current + * baud rate; try all likely settings. + */ + speed = pMse->baudRate; + switch (speed) { + case 9600: + s = "*q"; + break; + case 4800: + s = "*p"; + break; + case 2400: + s = "*o"; + break; + case 1200: + s = "*n"; + break; + default: + /* Fallback value */ + speed = 1200; + s = "*n"; + } + xf86SetSerialSpeed(pInfo->fd, 9600); + xf86WriteSerial(pInfo->fd, s, 2); + usleep(100000); + xf86SetSerialSpeed(pInfo->fd, 4800); + xf86WriteSerial(pInfo->fd, s, 2); + usleep(100000); + xf86SetSerialSpeed(pInfo->fd, 2400); + xf86WriteSerial(pInfo->fd, s, 2); + usleep(100000); + xf86SetSerialSpeed(pInfo->fd, 1200); + xf86WriteSerial(pInfo->fd, s, 2); + usleep(100000); + xf86SetSerialSpeed(pInfo->fd, speed); + + /* Select MM series data format. */ + xf86WriteSerial(pInfo->fd, "S", 1); + usleep(100000); + /* Set the parameters up for the MM series protocol. */ + options = pInfo->options; + xf86CollectInputOptions(pInfo, mmDefaults, NULL); + xf86SetSerial(pInfo->fd, pInfo->options); + pInfo->options = options; + + /* Select report rate/frequency. */ + if (pMse->sampleRate <= 0) c = 'O'; /* 100 */ + else if (pMse->sampleRate <= 15) c = 'J'; /* 10 */ + else if (pMse->sampleRate <= 27) c = 'K'; /* 20 */ + else if (pMse->sampleRate <= 42) c = 'L'; /* 35 */ + else if (pMse->sampleRate <= 60) c = 'R'; /* 50 */ + else if (pMse->sampleRate <= 85) c = 'M'; /* 67 */ + else if (pMse->sampleRate <= 125) c = 'Q'; /* 100 */ + else c = 'N'; /* 150 */ + xf86WriteSerial(pInfo->fd, &c, 1); + break; + + case PROT_LOGIMAN: + speed = pMse->baudRate; + switch (speed) { + case 9600: + s = "*q"; + break; + case 1200: + s = "*n"; + break; + default: + /* Fallback value */ + speed = 1200; + s = "*n"; + } + xf86SetSerialSpeed(pInfo->fd, 1200); + xf86WriteSerial(pInfo->fd, "*n", 2); + xf86WriteSerial(pInfo->fd, "*X", 2); + xf86WriteSerial(pInfo->fd, s, 2); + usleep(100000); + xf86SetSerialSpeed(pInfo->fd, speed); + break; + + case PROT_MMHIT: /* MM_HitTablet */ + /* + * Initialize Hitachi PUMA Plus - Model 1212E to desired settings. + * The tablet must be configured to be in MM mode, NO parity, + * Binary Format. pMse->sampleRate controls the sensitivity + * of the tablet. We only use this tablet for it's 4-button puck + * so we don't run in "Absolute Mode". + */ + xf86WriteSerial(pInfo->fd, "z8", 2); /* Set Parity = "NONE" */ + usleep(50000); + xf86WriteSerial(pInfo->fd, "zb", 2); /* Set Format = "Binary" */ + usleep(50000); + xf86WriteSerial(pInfo->fd, "@", 1); /* Set Report Mode = "Stream" */ + usleep(50000); + xf86WriteSerial(pInfo->fd, "R", 1); /* Set Output Rate = "45 rps" */ + usleep(50000); + xf86WriteSerial(pInfo->fd, "I\x20", 2); /* Set Incrememtal Mode "20" */ + usleep(50000); + xf86WriteSerial(pInfo->fd, "E", 1); /* Set Data Type = "Relative */ + usleep(50000); + /* + * These sample rates translate to 'lines per inch' on the Hitachi + * tablet. + */ + if (pMse->sampleRate <= 40) c = 'g'; + else if (pMse->sampleRate <= 100) c = 'd'; + else if (pMse->sampleRate <= 200) c = 'e'; + else if (pMse->sampleRate <= 500) c = 'h'; + else if (pMse->sampleRate <= 1000) c = 'j'; + else c = 'd'; + xf86WriteSerial(pInfo->fd, &c, 1); + usleep(50000); + xf86WriteSerial(pInfo->fd, "\021", 1); /* Resume DATA output */ + break; + + case PROT_THINKING: /* ThinkingMouse */ + /* This mouse may send a PnP ID string, ignore it. */ + usleep(200000); + xf86FlushInput(pInfo->fd); + /* Send the command to initialize the beast. */ + for (s = "E5E5"; *s; ++s) { + xf86WriteSerial(pInfo->fd, s, 1); + if ((xf86WaitForInput(pInfo->fd, 1000000) <= 0)) + break; + xf86ReadSerial(pInfo->fd, &c, 1); + if (c != *s) + break; + } + break; + + case PROT_MSC: /* MouseSystems Corp */ + usleep(100000); + xf86FlushInput(pInfo->fd); + break; + + case PROT_ACECAD: + /* initialize */ + /* A nul character resets. */ + xf86WriteSerial(pInfo->fd, "", 1); + usleep(50000); + /* Stream out relative mode high resolution increments of 1. */ + xf86WriteSerial(pInfo->fd, "@EeI!", 5); + break; + + case PROT_BM: /* bus/InPort mouse */ + if (osInfo->SetBMRes) + osInfo->SetBMRes(pInfo, pMse->protocol, pMse->sampleRate, + pMse->resolution); + break; + + case PROT_GENPS2: + ps2Init = FALSE; + break; + + case PROT_PS2: + case PROT_GLIDEPS2: + break; + + case PROT_IMPS2: /* IntelliMouse */ + { + static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, 242 }; + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_EXPPS2: /* IntelliMouse Explorer */ + { + static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, + 243, 200, 243, 200, 243, 80, 242 }; + + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */ + case PROT_NETSCPS2: /* NetScroll */ + { + static unsigned char seq[] = { 232, 3, 230, 230, 230, }; + + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_MMPS2: /* MouseMan+, FirstMouse+ */ + { + static unsigned char seq[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1, + 230, 232, 3, 232, 1, 232, 2, 232, 3, }; + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_THINKPS2: /* ThinkingMouse */ + { + static unsigned char seq[] = { 243, 10, 232, 0, 243, 20, 243, 60, + 243, 40, 243, 20, 243, 20, 243, 60, + 243, 40, 243, 20, 243, 20, }; + param = seq; + paramlen = sizeof(seq); + } + break; + case PROT_SYSMOUSE: + if (osInfo->SetMiscRes) + osInfo->SetMiscRes(pInfo, pMse->protocol, pMse->sampleRate, + pMse->resolution); + break; + + default: + /* Nothing to do. */ + break; + } + + if (pMse->class & (MSE_PS2 | MSE_XPS2)) { + /* + * If one part of the PS/2 mouse initialization fails + * redo complete initialization. There are mice which + * have occasional problems with initialization and + * are in an unknown state. + */ + if (ps2Init) { + REDO: + do_ps2Reset(pInfo); + if (paramlen > 0) { + if (!ps2SendPacket(pInfo,param,paramlen)) { + usleep(30000); + xf86FlushInput(pInfo->fd); + if (!count--) + return TRUE; + goto REDO; + } + usleep(30000); + xf86FlushInput(pInfo->fd); + } + + if (osInfo->SetPS2Res) { + osInfo->SetPS2Res(pInfo, pMse->protocol, pMse->sampleRate, + pMse->resolution); + } else { + unsigned char c2[2]; + + c = 0xE6; /*230*/ /* 1:1 scaling */ + if (!ps2SendPacket(pInfo,&c,1)) { + if (!count--) + return TRUE; + goto REDO; + } + c2[0] = 0xF3; /*243*/ /* set sampling rate */ + if (pMse->sampleRate > 0) { + if (pMse->sampleRate >= 200) + c2[1] = 200; + else if (pMse->sampleRate >= 100) + c2[1] = 100; + else if (pMse->sampleRate >= 80) + c2[1] = 80; + else if (pMse->sampleRate >= 60) + c2[1] = 60; + else if (pMse->sampleRate >= 40) + c2[1] = 40; + else + c2[1] = 20; + } else { + c2[1] = 100; + } + if (!ps2SendPacket(pInfo,c2,2)) { + if (!count--) + return TRUE; + goto REDO; + } + c2[0] = 0xE8; /*232*/ /* set device resolution */ + if (pMse->resolution > 0) { + if (pMse->resolution >= 200) + c2[1] = 3; + else if (pMse->resolution >= 100) + c2[1] = 2; + else if (pMse->resolution >= 50) + c2[1] = 1; + else + c2[1] = 0; + } else { + c2[1] = 2; + } + if (!ps2SendPacket(pInfo,c2,2)) { + if (!count--) + return TRUE; + goto REDO; + } + usleep(30000); + xf86FlushInput(pInfo->fd); + if (!ps2EnableDataReporting(pInfo)) { + xf86Msg(X_INFO, "%s: ps2EnableDataReporting: failed\n", + pInfo->name); + xf86FlushInput(pInfo->fd); + if (!count--) + return TRUE; + goto REDO; + } else { + xf86Msg(X_INFO, "%s: ps2EnableDataReporting: succeeded\n", + pInfo->name); + } + } + /* + * The PS/2 reset handling needs to be rechecked. + * We need to wait until after the 4.3 release. + */ + } + } else { + if (paramlen > 0) { + if (xf86WriteSerial(pInfo->fd, param, paramlen) != paramlen) + xf86Msg(X_ERROR, "%s: Mouse initialization failed\n", + pInfo->name); + usleep(30000); + xf86FlushInput(pInfo->fd); + } + } + + return TRUE; +} + +#ifdef SUPPORT_MOUSE_RESET +static Bool +mouseReset(InputInfoPtr pInfo, unsigned char val) +{ + MouseDevPtr pMse = pInfo->private; + mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv; + CARD32 prevEvent = mousepriv->lastEvent; + Bool expectReset = FALSE; + Bool ret = FALSE; + + mousepriv->lastEvent = GetTimeInMillis(); + +#ifdef EXTMOUSEDEBUG + ErrorF("byte: 0x%x time: %li\n",val,mousepriv->lastEvent); +#endif + /* + * We believe that the following is true: + * When the mouse is replugged it will send a reset package + * It takes several seconds to replug a mouse: We don't see + * events for several seconds before we see the replug event package. + * There is no significant delay between consecutive bytes + * of a replug event package. + * There are no bytes sent after the replug event package until + * the mouse is reset. + */ + + if (mousepriv->current == 0 + && (mousepriv->lastEvent - prevEvent) < 4000) + return FALSE; + + if (mousepriv->current > 0 + && (mousepriv->lastEvent - prevEvent) >= 1000) { + mousepriv->inReset = FALSE; + mousepriv->current = 0; + return FALSE; + } + + if (mousepriv->inReset) + mousepriv->inReset = FALSE; + +#ifdef EXTMOUSEDEBUG + ErrorF("Mouse Current: %i 0x%x\n",mousepriv->current, val); +#endif + + /* here we put the mouse specific reset detction */ + /* They need to do three things: */ + /* Check if byte may be a reset byte */ + /* If so: Set expectReset TRUE */ + /* If convinced: Set inReset TRUE */ + /* Register BlockAndWakeupHandler */ + + /* PS/2 */ + { + unsigned char seq[] = { 0xaa, 0x00 }; + int len = sizeof(seq); + + if (seq[mousepriv->current] == val) + expectReset = TRUE; + + if (len == mousepriv->current + 1) { + mousepriv->inReset = TRUE; + mousepriv->expires = GetTimeInMillis() + 1000; + +#ifdef EXTMOUSEDEBUG + ErrorF("Found PS/2 Reset string\n"); +#endif + RegisterBlockAndWakeupHandlers (ps2BlockHandler, + ps2WakeupHandler, (pointer) pInfo); + ret = TRUE; + } + } + + if (!expectReset) + mousepriv->current = 0; + else + mousepriv->current++; + return ret; +} + +static void +ps2BlockHandler(pointer data, struct timeval **waitTime, + pointer LastSelectMask) +{ + InputInfoPtr pInfo = (InputInfoPtr) data; + MouseDevPtr pMse = (MouseDevPtr) pInfo->private; + mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv; + int ms; + + if (mousepriv->inReset) { + ms = mousepriv->expires - GetTimeInMillis (); + if (ms <= 0) + ms = 0; + AdjustWaitForDelay (waitTime, ms); + } else + RemoveBlockAndWakeupHandlers (ps2BlockHandler, ps2WakeupHandler, + (pointer) pInfo); +} + +static void +ps2WakeupHandler(pointer data, int i, pointer LastSelectMask) +{ + InputInfoPtr pInfo = (InputInfoPtr) data; + MouseDevPtr pMse = (MouseDevPtr) pInfo->private; + mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv; + int ms; + + if (mousepriv->inReset) { + unsigned char val; + int blocked; + + ms = mousepriv->expires - GetTimeInMillis(); + if (ms > 0) + return; + + blocked = xf86BlockSIGIO (); + + xf86MsgVerb(X_INFO,3, + "Got reinsert event: reinitializing PS/2 mouse\n"); + val = 0xf4; + if (xf86WriteSerial(pInfo->fd, &val, 1) != 1) + xf86Msg(X_ERROR, "%s: Write to mouse failed\n", + pInfo->name); + xf86UnblockSIGIO(blocked); + } + RemoveBlockAndWakeupHandlers (ps2BlockHandler, ps2WakeupHandler, + (pointer) pInfo); +} +#endif /* SUPPORT_MOUSE_RESET */ - emulateButtons = (buttons & 01) | ((buttons &04) >> 1); +/************************************************************ + * + * Autoprobe stuff + * + ************************************************************/ +#ifdef EXTMOUSEDEBUG +# define AP_DBG(x) { ErrorF("Autoprobe: "); ErrorF x; } +# define AP_DBGC(x) ErrorF x ; +# else +# define AP_DBG(x) +# define AP_DBGC(x) +#endif - if ((id = stateTab[pMse->emulateState][emulateButtons][0]) != 0) - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); - if ((id = stateTab[pMse->emulateState][emulateButtons][1]) != 0) - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); +MouseProtocolID hardProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI, + PROT_LOGIMAN, PROT_MMHIT, + PROT_GLIDE, PROT_IMSERIAL, + PROT_THINKING, PROT_ACECAD, + PROT_THINKPS2, PROT_MMPS2, + PROT_GLIDEPS2, + PROT_NETSCPS2, PROT_EXPPS2,PROT_IMPS2, + PROT_GENPS2, PROT_NETPS2, + PROT_MS, + PROT_UNKNOWN +}; - pMse->emulateState = - stateTab[pMse->emulateState][emulateButtons][2]; +MouseProtocolID softProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI, + PROT_LOGIMAN, PROT_MMHIT, + PROT_GLIDE, PROT_IMSERIAL, + PROT_THINKING, PROT_ACECAD, + PROT_THINKPS2, PROT_MMPS2, + PROT_GLIDEPS2, + PROT_NETSCPS2 ,PROT_IMPS2, + PROT_GENPS2, + PROT_MS, + PROT_UNKNOWN +}; - if (stateTab[pMse->emulateState][4][0] != 0) { - pMse->emulate3Expires = GetTimeInMillis () + pMse->emulate3Timeout; - pMse->emulate3Pending = TRUE; - } else { - pMse->emulate3Pending = FALSE; - } - } +static const char * +autoOSProtocol(InputInfoPtr pInfo, int *protoPara) +{ + MouseDevPtr pMse = pInfo->private; + const char *name = NULL; + MouseProtocolID protocolID = PROT_UNKNOWN; - while (change) { - id = ffs(change); - change &= ~(1 << (id - 1)); - xf86PostButtonEvent(pInfo->dev, 0, id, - (buttons & (1 << (id - 1))), 0, 0); + /* Check if the OS has a detection mechanism. */ + if (osInfo->SetupAuto) { + name = osInfo->SetupAuto(pInfo, protoPara); + if (name) { + protocolID = ProtocolNameToID(name); + switch (protocolID) { + case PROT_UNKNOWN: + /* Check for a builtin OS-specific protocol. */ + if (osInfo->CheckProtocol && osInfo->CheckProtocol(name)) { + /* We can only come here if the protocol has been + * changed to auto thru the xf86misc extension + * and we have detected an OS specific builtin + * protocol. Currently we cannot handle this */ + name = NULL; + } else + name = NULL; + break; + case PROT_UNSUP: + name = NULL; + break; + default: + break; + } } - - pMse->lastButtons = truebuttons; } +#ifdef PNP_MOUSE + if (!name) { + /* A PnP serial mouse? */ + protocolID = MouseGetPnpProtocol(pInfo); + if (protocolID >= 0 && protocolID < PROT_NUMPROTOS) { + name = ProtocolIDToName(protocolID); + xf86Msg(X_PROBED, "%s: PnP-detected protocol: \"%s\"\n", + pInfo->name, name); + } + } +#endif + if (name) { + pMse->protocolID = protocolID; + } + + return name; } +/* + * createProtocolList() -- create a list of protocols which may + * match on the incoming data stream. + */ static void -MousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw) +createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList) { - MouseDevPtr pMse; - int zbutton = 0; + int i, j, k = 0; + MouseProtocolID prot; + unsigned char *para; + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; + MouseProtocolID *tmplist = NULL; + int blocked; + + AP_DBGC(("Autoprobe: ")); + for (i = 0; i < mPriv->count; i++) + AP_DBGC(("%2.2x ", (unsigned char) mPriv->data[i])); + AP_DBGC(("\n")); + + blocked = xf86BlockSIGIO (); + + /* create a private copy first so we can write in the old list */ + if ((tmplist = xalloc(sizeof(MouseProtocolID) * NUM_AUTOPROBE_PROTOS))){ + for (i = 0; protoList[i] != PROT_UNKNOWN; i++) { + tmplist[i] = protoList[i]; + } + tmplist[i] = PROT_UNKNOWN; + protoList = tmplist; + } else + return; + for (i = 0; ((prot = protoList[i]) != PROT_UNKNOWN + && (k < NUM_AUTOPROBE_PROTOS - 1)) ; i++) { + Bool bad = TRUE; + unsigned char byte = 0; + int count = 0; + int next_header_candidate = 0; + int header_count = 0; + + if (!GetProtocol(prot)) + continue; + para = proto[prot]; - pMse = pInfo->private; + AP_DBG(("Protocol: %s ", ProtocolIDToName(prot))); - /* Map the Z axis movement. */ - /* XXX Could this go in the conversion_proc? */ - switch (pMse->negativeZ) { - case MSE_NOZMAP: /* do nothing */ - break; - case MSE_MAPTOX: - if (dz != 0) { - dx = dz; - dz = 0; - } - break; - case MSE_MAPTOY: - if (dz != 0) { - dy = dz; - dz = 0; +#ifdef EXTMOUSEDEBUG + for (j = 0; j < 7; j++) + AP_DBGC(("%2.2x ", (unsigned char) para[j])); + AP_DBGC(("\n")); +#endif + j = 0; + while (1) { + /* look for header */ + while (j < mPriv->count) { + if (((byte = mPriv->data[j++]) & para[0]) == para[1]){ + AP_DBG(("found header %2.2x\n",byte)); + next_header_candidate = j; + count = 1; + break; + } else { + /* + * Bail ot if number of bytes per package have + * been tested for header. + * Take bytes per package of leading garbage into + * account. + */ + if (j > para[4] && ++header_count > para[4]) { + j = mPriv->count; + break; + } + } + } + /* check if remaining data matches protocol */ + while (j < mPriv->count) { + byte = mPriv->data[j++]; + if (count == para[4]) { + count = 0; + /* check and eat excess byte */ + if (((byte & para[0]) != para[1]) + && ((byte & para[5]) == para[6])) { + AP_DBG(("excess byte found\n")); + continue; + } + } + if (count == 0) { + /* validate next header */ + bad = FALSE; + AP_DBG(("Complete set found\n")); + if ((byte & para[0]) != para[1]) { + AP_DBG(("Autoprobe: header bad\n")); + bad = TRUE; + break; + } else { + count++; + continue; + } + } + /* validate data */ + else if (((byte & para[2]) != para[3]) + || ((para[7] & MPF_SAFE) + && ((byte & para[0]) == para[1]))) { + AP_DBG(("data bad\n")); + bad = TRUE; + break; + } else { + count ++; + continue; + } + } + if (!bad) { + /* this is a matching protocol */ + mPriv->protoList[k++] = prot; + AP_DBG(("Autoprobe: Adding protocol %s to list (entry %i)\n", + ProtocolIDToName(prot),k-1)); + break; + } + j = next_header_candidate; + next_header_candidate = 0; + /* we have tested number of bytes per package for header */ + if (j > para[4] && ++header_count > para[4]) + break; + /* we have not found anything that looks like a header */ + if (!next_header_candidate) + break; + AP_DBG(("Looking for new header\n")); } - break; - default: /* buttons */ - buttons &= ~(pMse->negativeZ | pMse->positiveZ - | pMse->negativeW | pMse->positiveW); - if (dw < 0 || dz < -1) - zbutton = pMse->negativeW; - else if (dz < 0) - zbutton = pMse->negativeZ; - else if (dw > 0 || dz > 1) - zbutton = pMse->positiveW; - else if (dz > 0) - zbutton = pMse->positiveZ; - buttons |= zbutton; - dz = 0; - break; - } - dx = pMse->invX * dx; - dy = pMse->invY * dy; - if (pMse->flipXY) { - int tmp = dx; - dx = dy; - dy = tmp; } - MouseDoPostEvent(pInfo, buttons, dx, dy); - /* - * If dz has been mapped to a button `down' event, we need to cook up - * a corresponding button `up' event. - */ - if (zbutton) { - buttons &= ~zbutton; - MouseDoPostEvent(pInfo, buttons, 0, 0); - } + xf86UnblockSIGIO(blocked); + + mPriv->protoList[k] = PROT_UNKNOWN; + + xfree(tmplist); } + +/* This only needs to be done once */ +void **serialDefaultsList = NULL; + +/* + * createSerialDefaultsLists() - create a list of the different default + * settings for the serial interface of the known protocols. + */ static void -initPs2(InputInfoPtr pInfo, Bool reinsert) +createSerialDefaultsList(void) { - MouseDevPtr pMse = pInfo->private; - unsigned char *param = NULL; - int paramlen = 0; - unsigned char c; + int i = 0, j, k; - if (reinsert) { - unsigned char init = 0xF4; - if (xf86WriteSerial(pInfo->fd, &init, 1) != 1) - xf86Msg(X_ERROR, "%s: Write to mouse failed\n", pInfo->name); - usleep(30000); - xf86FlushInput(pInfo->fd); + serialDefaultsList = (void **)xnfalloc(sizeof(void*)); + serialDefaultsList[0] = NULL; + + for (j = 0; mouseProtocols[j].name; j++) { + if (!mouseProtocols[j].defaults) + continue; + for (k = 0; k < i; k++) + if (mouseProtocols[j].defaults == serialDefaultsList[k]) + continue; + i++; + serialDefaultsList = (void**)xnfrealloc(serialDefaultsList, + sizeof(void*)*(i+1)); + serialDefaultsList[i-1] = mouseProtocols[j].defaults; + serialDefaultsList[i] = NULL; } +} - switch (pMse->protocolID) { - case PROT_IMPS2: /* IntelliMouse */ - { - static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, 242 }; +typedef enum { + STATE_INVALID, + STATE_UNCERTAIN, + STATE_VALID +} validState; + +/* Probing threshold values */ +#define PROBE_UNCERTAINTY 50 +#define BAD_CERTAINTY 6 +#define BAD_INC_CERTAINTY 1 +#define BAD_INC_CERTAINTY_WHEN_SYNC_LOST 2 + +static validState +validCount(mousePrivPtr mPriv, Bool inSync, Bool lostSync) +{ + if (inSync) { + if (!--mPriv->goodCount) { + /* we are sure to have found the correct protocol */ + mPriv->badCount = 0; + return STATE_VALID; + } + AP_DBG(("%i successful rounds to go\n", + mPriv->goodCount)); + return STATE_UNCERTAIN; + } - param = seq; - paramlen = sizeof(seq); - } - break; - case PROT_EXPPS2: /* IntelliMouse Explorer */ - { - static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, - 243, 200, 243, 200, 243, 80, 242 }; + /* We are out of sync again */ + mPriv->goodCount = PROBE_UNCERTAINTY; + /* We increase uncertainty of having the correct protocol */ + mPriv->badCount+= lostSync ? BAD_INC_CERTAINTY_WHEN_SYNC_LOST + : BAD_INC_CERTAINTY; + + if (mPriv->badCount < BAD_CERTAINTY) { + /* We are not convinced yet to have the wrong protocol */ + AP_DBG(("Changing protocol after: %i rounds\n", + BAD_CERTAINTY - mPriv->badCount)); + return STATE_UNCERTAIN; + } + return STATE_INVALID; +} + +#define RESET_VALIDATION mPriv->goodCount = PROBE_UNCERTAINTY;\ + mPriv->badCount = 0;\ + mPriv->prevDx = 0;\ + mPriv->prevDy = 0;\ + mPriv->accDx = 0;\ + mPriv->accDy = 0;\ + mPriv->acc = 0; - param = seq; - paramlen = sizeof(seq); - } - break; +static void +autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync) +{ + MouseDevPtr pMse = pInfo->private; + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; - case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */ - case PROT_NETSCPS2: /* NetScroll */ + MouseProtocolID *protocolList = NULL; + + while (1) { + switch (mPriv->autoState) { + case AUTOPROBE_GOOD: + if (inSync) + return; + AP_DBG(("State GOOD\n")); + RESET_VALIDATION; + mPriv->autoState = AUTOPROBE_VALIDATE1; + return; + case AUTOPROBE_H_GOOD: + if (inSync) + return; + AP_DBG(("State H_GOOD\n")); + RESET_VALIDATION; + mPriv->autoState = AUTOPROBE_H_VALIDATE2; + return; + case AUTOPROBE_H_NOPROTO: + AP_DBG(("State H_NOPROTO\n")); + mPriv->protocolID = 0; + mPriv->autoState = AUTOPROBE_H_SETPROTO; + break; + case AUTOPROBE_H_SETPROTO: + AP_DBG(("State H_SETPROTO\n")); + if ((pMse->protocolID = hardProtocolList[mPriv->protocolID++]) + == PROT_UNKNOWN) { + mPriv->protocolID = 0; + break; + } else if (GetProtocol(pMse->protocolID) && SetupMouse(pInfo)) { + FlushButtons(pMse); + RESET_VALIDATION; + AP_DBG(("Autoprobe: Trying Protocol: %s\n", + ProtocolIDToName(pMse->protocolID))); + mPriv->autoState = AUTOPROBE_H_VALIDATE1; + return; + } + break; + case AUTOPROBE_H_VALIDATE1: + AP_DBG(("State H_VALIDATE1\n")); + switch (validCount(mPriv,inSync,lostSync)) { + case STATE_INVALID: + mPriv->autoState = AUTOPROBE_H_SETPROTO; + break; + case STATE_VALID: + xf86Msg(X_INFO,"Mouse autoprobe: selecting %s protocol\n", + ProtocolIDToName(pMse->protocolID)); + mPriv->autoState = AUTOPROBE_H_GOOD; + return; + case STATE_UNCERTAIN: + return; + default: + break; + } + break; + case AUTOPROBE_H_VALIDATE2: + AP_DBG(("State H_VALIDATE2\n")); + switch (validCount(mPriv,inSync,lostSync)) { + case STATE_INVALID: + mPriv->autoState = AUTOPROBE_H_AUTODETECT; + break; + case STATE_VALID: + xf86Msg(X_INFO,"Mouse autoprobe: selecting %s protocol\n", + ProtocolIDToName(pMse->protocolID)); + mPriv->autoState = AUTOPROBE_H_GOOD; + return; + case STATE_UNCERTAIN: + return; + } + break; + case AUTOPROBE_H_AUTODETECT: + AP_DBG(("State H_AUTODETECT\n")); + pMse->protocolID = PROT_AUTO; + AP_DBG(("Looking for PnP/OS mouse\n")); + mPriv->count = 0; + SetupMouse(pInfo); + if (pMse->protocolID != PROT_AUTO) + mPriv->autoState = AUTOPROBE_H_GOOD; + else + mPriv->autoState = AUTOPROBE_H_NOPROTO; + break; + case AUTOPROBE_NOPROTO: + AP_DBG(("State NOPROTO\n")); + mPriv->count = 0; + mPriv->serialDefaultsNum = -1; + mPriv->autoState = AUTOPROBE_COLLECT; + break; + case AUTOPROBE_COLLECT: + AP_DBG(("State COLLECT\n")); + if (mPriv->count <= NUM_MSE_AUTOPROBE_BYTES) + return; + protocolList = softProtocolList; + mPriv->autoState = AUTOPROBE_CREATE_PROTOLIST; + break; + case AUTOPROBE_CREATE_PROTOLIST: + AP_DBG(("State CREATE_PROTOLIST\n")); + createProtoList(pMse, protocolList); + mPriv->protocolID = 0; + mPriv->autoState = AUTOPROBE_SWITCH_PROTOCOL; + break; + case AUTOPROBE_AUTODETECT: + AP_DBG(("State AUTODETECT\n")); + pMse->protocolID = PROT_AUTO; + AP_DBG(("Looking for PnP/OS mouse\n")); + mPriv->count = 0; + SetupMouse(pInfo); + if (pMse->protocolID != PROT_AUTO) + mPriv->autoState = AUTOPROBE_GOOD; + else + mPriv->autoState = AUTOPROBE_NOPROTO; + break; + case AUTOPROBE_VALIDATE1: + AP_DBG(("State VALIDATE1\n")); + switch (validCount(mPriv,inSync,lostSync)) { + case STATE_INVALID: + mPriv->autoState = AUTOPROBE_AUTODETECT; + break; + case STATE_VALID: + xf86Msg(X_INFO,"Mouse autoprobe: selecting %s protocol\n", + ProtocolIDToName(pMse->protocolID)); + mPriv->autoState = AUTOPROBE_GOOD; + break; + case STATE_UNCERTAIN: + return; + } + break; + case AUTOPROBE_VALIDATE2: + AP_DBG(("State VALIDATE2\n")); + switch (validCount(mPriv,inSync,lostSync)) { + case STATE_INVALID: + protocolList = &mPriv->protoList[mPriv->protocolID]; + mPriv->autoState = AUTOPROBE_CREATE_PROTOLIST; + break; + case STATE_VALID: + xf86Msg(X_INFO,"Mouse autoprobe: selecting %s protocol\n", + ProtocolIDToName(pMse->protocolID)); + mPriv->autoState = AUTOPROBE_GOOD; + break; + case STATE_UNCERTAIN: + return; + } + break; + case AUTOPROBE_SWITCHSERIAL: { - static unsigned char seq[] = { 232, 3, 230, 230, 230, }; - - param = seq; - paramlen = sizeof(seq); + pointer serialDefaults; + AP_DBG(("State SWITCHSERIAL\n")); + + if (!serialDefaultsList) + createSerialDefaultsList(); + + AP_DBG(("Switching serial params\n")); + if ((serialDefaults = + serialDefaultsList[++mPriv->serialDefaultsNum]) == NULL) { + mPriv->serialDefaultsNum = 0; + } else { + pointer tmp = xf86OptionListCreate(serialDefaults, -1, 0); + xf86SetSerial(pInfo->fd, tmp); + xf86OptionListFree(tmp); + mPriv->count = 0; + mPriv->autoState = AUTOPROBE_COLLECT; + } + break; } - break; - - case PROT_MMPS2: /* MouseMan+, FirstMouse+ */ + case AUTOPROBE_SWITCH_PROTOCOL: { - static unsigned char seq[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1, - 230, 232, 3, 232, 1, 232, 2, 232, 3, }; - param = seq; - paramlen = sizeof(seq); + MouseProtocolID proto; + void *defaults; + AP_DBG(("State SWITCH_PROTOCOL\n")); + proto = mPriv->protoList[mPriv->protocolID++]; + if (proto == PROT_UNKNOWN) + mPriv->autoState = AUTOPROBE_SWITCHSERIAL; + else if (!(defaults = GetProtocol(proto)->defaults) + || (mPriv->serialDefaultsNum == -1 + && (defaults == msDefaults)) + || (mPriv->serialDefaultsNum != -1 + && serialDefaultsList[mPriv->serialDefaultsNum] + == defaults)) { + AP_DBG(("Changing Protocol to %s\n", + ProtocolIDToName(proto))); + SetMouseProto(pMse,proto); + FlushButtons(pMse); + RESET_VALIDATION; + mPriv->autoState = AUTOPROBE_VALIDATE2; + return; + } + break; } - break; - - case PROT_THINKPS2: /* ThinkingMouse */ - { - static unsigned char seq[] = { 243, 10, 232, 0, 243, 20, 243, 60, - 243, 40, 243, 20, 243, 20, 243, 60, - 243, 40, 243, 20, 243, 20, }; - param = seq; - paramlen = sizeof(seq); } } +} - if (paramlen > 0) { -#ifdef EXTMOUSEDEBUG - for (i = 0; i < paramlen; ++i) { - if (xf86WriteSerial(pInfo->fd, ¶m[i], 1) != 1) - ErrorF("SetupMouse: Write to mouse failed (%s)\n", - strerror(errno)); - usleep(30000); - xf86ReadSerial(pInfo->fd, &c, 1); - ErrorF("SetupMouse: got %02x\n", c); - } -#else - if (xf86WriteSerial(pInfo->fd, param, paramlen) != paramlen) - xf86Msg(X_ERROR, "%s: Write to mouse failed\n", pInfo->name); -#endif - usleep(30000); - xf86FlushInput(pInfo->fd); +static Bool +autoGood(MouseDevPtr pMse) +{ + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; + + if (!pMse->autoProbe) + return TRUE; + + switch (mPriv->autoState) { + case AUTOPROBE_GOOD: + case AUTOPROBE_H_GOOD: + return TRUE; + case AUTOPROBE_VALIDATE1: /* @@@ */ + case AUTOPROBE_H_VALIDATE1: /* @@@ */ + case AUTOPROBE_VALIDATE2: + case AUTOPROBE_H_VALIDATE2: + if (mPriv->goodCount < PROBE_UNCERTAINTY/2) + return TRUE; + default: + return FALSE; } +} - ((ps2PrivPtr)(pMse->mousePriv))->state = 0; - if (osInfo->SetPS2Res) { - osInfo->SetPS2Res(pInfo, pMse->protocol, pMse->sampleRate, - pMse->resolution); - } else { - unsigned char c2[2]; - - c = 230; /* 1:1 scaling */ - xf86WriteSerial(pInfo->fd, &c, 1); - c = 244; /* enable mouse */ - xf86WriteSerial(pInfo->fd, &c, 1); - c2[0] = 243; /* set sampling rate */ - if (pMse->sampleRate > 0) { - if (pMse->sampleRate >= 200) - c2[1] = 200; - else if (pMse->sampleRate >= 100) - c2[1] = 100; - else if (pMse->sampleRate >= 80) - c2[1] = 80; - else if (pMse->sampleRate >= 60) - c2[1] = 60; - else if (pMse->sampleRate >= 40) - c2[1] = 40; + +#define TOT_THRESHOLD 3000 +#define VAL_THRESHOLD 40 + +/* + * checkForErraticMovements() -- check if mouse 'jumps around'. + */ +static void +checkForErraticMovements(InputInfoPtr pInfo, int dx, int dy) +{ + MouseDevPtr pMse = pInfo->private; + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; +#if 1 + if (!mPriv->goodCount) + return; +#endif +#if 0 + if (abs(dx - mPriv->prevDx) > 300 + || abs(dy - mPriv->prevDy) > 300) + AP_DBG(("erratic1 behaviour\n")); +#endif + if (abs(dx) > VAL_THRESHOLD) { + if (sign(dx) == sign(mPriv->prevDx)) { + mPriv->accDx += dx; + if (abs(mPriv->accDx) > mPriv->acc) { + mPriv->acc = abs(mPriv->accDx); + AP_DBG(("acc=%i\n",mPriv->acc)); + } else - c2[1] = 20; + AP_DBG(("accDx=%i\n",mPriv->accDx)); } else { - c2[1] = 100; + mPriv->accDx = 0; } - xf86WriteSerial(pInfo->fd, c2, 2); - c2[0] = 232; /* set device resolution */ - if (pMse->resolution > 0) { - if (pMse->resolution >= 200) - c2[1] = 3; - else if (pMse->resolution >= 100) - c2[1] = 2; - else if (pMse->resolution >= 50) - c2[1] = 1; - else - c2[1] = 0; + } + + if (abs(dy) > VAL_THRESHOLD) { + if (sign(dy) == sign(mPriv->prevDy)) { + mPriv->accDy += dy; + if (abs(mPriv->accDy) > mPriv->acc) { + mPriv->acc = abs(mPriv->accDy); + AP_DBG(("acc: %i\n",mPriv->acc)); + } else + AP_DBG(("accDy=%i\n",mPriv->accDy)); } else { - c2[1] = 2; + mPriv->accDy = 0; } - xf86WriteSerial(pInfo->fd, c2, 2); - usleep(30000); - xf86FlushInput(pInfo->fd); } + mPriv->prevDx = dx; + mPriv->prevDy = dy; + if (mPriv->acc > TOT_THRESHOLD) { + mPriv->goodCount = PROBE_UNCERTAINTY; + mPriv->prevDx = 0; + mPriv->prevDy = 0; + mPriv->accDx = 0; + mPriv->accDy = 0; + mPriv->acc = 0; + AP_DBG(("erratic2 behaviour\n")); + autoProbeMouse(pInfo, FALSE,TRUE); + } +} + +static void +SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID) +{ + pMse->protocolID = protocolID; + pMse->protocol = ProtocolIDToName(pMse->protocolID); + pMse->class = ProtocolIDToClass(pMse->protocolID); + if ((pMse->protocolID >= 0) && (pMse->protocolID < PROT_NUMPROTOS)) + memcpy(pMse->protoPara, proto[pMse->protocolID], + sizeof(pMse->protoPara)); + + if (pMse->emulate3ButtonsSoft) + pMse->emulate3Buttons = TRUE; } +/* + * collectData() -- collect data bytes sent by mouse. + */ static Bool -ps2mouseReset(InputInfoPtr pInfo, unsigned char val) +collectData(MouseDevPtr pMse, unsigned char u) { - MouseDevPtr pMse = pInfo->private; - ps2PrivPtr ps2priv = (ps2PrivPtr)pMse->mousePriv; -#ifdef EXTMOUSEDEBUG - ErrorF("Ps/2 Mouse State: %i, 0x%x\n",ps2priv->state,val); -#endif - switch (ps2priv->state) { - case 0: - if (val == 0xaa) - ps2priv->state = 1; - else - ps2priv->state = 0; - return FALSE; - case 1: - ps2priv->state = 0; - if (val == 0x00) { - xf86MsgVerb(X_INFO,3, - "Got reinsert event: reinitializing PS/2 mouse\n"); - initPs2(pInfo, TRUE); + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; + if (mPriv->count < NUM_MSE_AUTOPROBE_TOTAL) { + mPriv->data[mPriv->count++] = u; + if (mPriv->count <= NUM_MSE_AUTOPROBE_BYTES) { return TRUE; - } else - return FALSE; - default: - return FALSE; + } } + return FALSE; } +/**************** end of autoprobe stuff *****************/ + + + #ifdef XFree86LOADER ModuleInfoRec MouseInfo = { 1, @@ -2309,4 +3513,9 @@ xf86MousePlug, xf86MouseUnplug}; +/* + Look at hitachi device stuff. +*/ #endif /* XFree86LOADER */ + + Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h:1.10 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h:1.11 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h:1.10 Wed Apr 19 11:48:35 2000 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h Mon Sep 16 14:06:07 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h,v 1.10 2000/04/19 15:48:35 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h,v 1.11 2002/09/16 18:06:07 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -22,6 +22,7 @@ PROT_THINKING, PROT_ACECAD, PROT_PS2, + PROT_GENPS2, PROT_IMPS2, PROT_EXPPS2, PROT_THINKPS2, Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.3 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.5 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.3 Mon Aug 6 17:13:19 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man Tue Dec 17 15:55:21 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.3 2001/08/06 21:13:19 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.5 2002/12/17 20:55:21 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH MOUSE __drivermansuffix__ __vendorversion__ @@ -156,8 +156,29 @@ Default: no mapping. .TP 7 .BI "Option \*qFlipXY\*q \*q" boolean \*q -Enable/disable swapping the X and Y axes. Default: off. +Enable/disable swapping the X and Y axes. This transformation is applied +after the +.BR InvX , +.B InvY +and +.BR AngleOffset +transformations. Default: off. +.TP 7 +.BI "Option \*qInvX\*q \*q" boolean \*q +Invert the X axis. Default: off. +.TP 7 +.BI "Option \*qInvY\*q \*q" boolean \*q +Invert the Y axis. Default: off. .TP 7 +.BI "Option \*qAngleOffset\*q \*q" integer \*q +Specify a clockwise angular offset (in degrees) to apply to the pointer +motion. This transformation is applied before the +.BR FlipXY , +.B InvX +and +.B InvY +transformations. Default: 0. +.TP 7 .BI "Option \*qSampleRate\*q \*q" integer \*q Sets the number of motion/button events the mouse sends per second. Setting this is only supported for some mice, including some Logitech mice and @@ -168,6 +189,18 @@ Sets the resolution of the device in counts per inch. Setting this is only supported for some mice, including some PS/2 mice on some platforms. Default: whatever the mouse is already set to. +.TP 7 +.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q +Sets \*qdrag lock buttons\*q that simulate holding a button down, so +that low dexterity people do not have to hold a buttton down at the +same time they move a mouse cursor. Button numbers occur in pairs, +with the lock button number occurring first, followed by the button +number that is the target of the lock button. +.TP 7 +.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q +Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q +indicating that the next button pressed is to be +\*qdrag locked\*q. .TP 7 .BI "Option \*qClearDTR\*q \*q" boolean \*q Enable/disable clearing the DTR line on the serial port used by the mouse. Index: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h:1.6 xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h:1.8 --- xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h:1.6 Fri Nov 30 07:12:03 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h Mon Sep 16 14:06:08 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h,v 1.6 2001/11/30 12:12:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h,v 1.8 2002/09/16 18:06:08 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -10,6 +10,24 @@ #include "xf86Xinput.h" /* Private interface for the mouse driver. */ +typedef enum { + AUTOPROBE_H_NOPROTO, + AUTOPROBE_H_GOOD, + AUTOPROBE_H_AUTODETECT, + AUTOPROBE_H_VALIDATE1, + AUTOPROBE_H_VALIDATE2, + AUTOPROBE_H_SETPROTO, + AUTOPROBE_NOPROTO, + AUTOPROBE_COLLECT, + AUTOPROBE_CREATE_PROTOLIST, + AUTOPROBE_GOOD, + AUTOPROBE_AUTODETECT, + AUTOPROBE_VALIDATE1, + AUTOPROBE_VALIDATE2, + AUTOPROBE_SWITCHSERIAL, + AUTOPROBE_SWITCH_PROTOCOL +} mseAutoProbeStates; + typedef struct { const char * name; int class; @@ -17,9 +35,31 @@ MouseProtocolID id; } MouseProtocolRec, *MouseProtocolPtr; +#define NUM_MSE_AUTOPROBE_BYTES 24 /* multiple of 3,4 and 6 byte packages */ +#define NUM_MSE_AUTOPROBE_TOTAL 64 +#define NUM_AUTOPROBE_PROTOS 17 + + typedef struct { - int state; -} ps2PrivRec, *ps2PrivPtr; + int current; + Bool inReset; + CARD32 lastEvent; + CARD32 expires; + Bool soft; + int goodCount; + int badCount; + int protocolID; + int count; + char data[NUM_MSE_AUTOPROBE_TOTAL]; + mseAutoProbeStates autoState; + int protoList[NUM_AUTOPROBE_PROTOS]; + int serialDefaultsNum; + int prevDx, prevDy; + int accDx, accDy; + int acc; + CARD32 pnpLast; + Bool disablePnPauto; +} mousePrivRec, *mousePrivPtr; /* mouse proto flags */ #define MPF_NONE 0x00 @@ -27,5 +67,8 @@ /* pnp.c */ int MouseGetPnpProtocol(InputInfoPtr pInfo); +Bool ps2Reset(InputInfoPtr pInfo); +Bool ps2EnableDataReporting(InputInfoPtr pInfo); +Bool ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len); #endif /* _X_MOUSE_H */ Index: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c diff -u xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c:1.11 xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c:1.16 --- xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c:1.11 Mon Aug 6 16:51:10 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c Tue Feb 4 10:21:18 2003 @@ -1,5 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c,v 1.11 2001/08/06 20:51:10 dawes Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c,v 1.16 2003/02/04 15:21:18 eich Exp $ */ /* * Copyright 1998 by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> * @@ -27,7 +26,6 @@ #include "Xproto.h" #include "inputstr.h" #include "scrnintstr.h" - #include "xf86.h" #include "xf86Priv.h" #include "xf86Xinput.h" @@ -134,29 +132,82 @@ NULL }; -static int pnpgets(InputInfoPtr, char *); +static int pnpgets(InputInfoPtr, char *, Bool *prePNP); static int pnpparse(InputInfoPtr, pnpid_t *, char *, int); +static int prepnpparse(InputInfoPtr pInfo, char *buf); static symtab_t *pnpproto(pnpid_t *); static symtab_t *gettoken(symtab_t *, char *, int); +static MouseProtocolID getPs2ProtocolPnP(InputInfoPtr pInfo); +static MouseProtocolID probePs2ProtocolPnP(InputInfoPtr pInfo); -int -MouseGetPnpProtocol(InputInfoPtr pInfo) +static int +MouseGetSerialPnpProtocol(InputInfoPtr pInfo) { char buf[256]; /* PnP ID string may be up to 256 bytes long */ pnpid_t pnpid; symtab_t *t; int len; + Bool prePNP; - if (((len = pnpgets(pInfo, buf)) <= 0) || - !pnpparse(pInfo, &pnpid, buf, len)) - return PROT_UNKNOWN; - if ((t = pnpproto(&pnpid)) == NULL) - return PROT_UNKNOWN; - xf86MsgVerb(X_INFO, 2, "%s: PnP-detected protocol ID: %d\n", - pInfo->name, t->val); - return (t->val); + if ((len = pnpgets(pInfo, buf, &prePNP)) > 0) + { + if (!prePNP) { + if (pnpparse(pInfo, &pnpid, buf, len) && + (t = pnpproto(&pnpid)) != NULL) { + xf86MsgVerb(X_INFO, 2, "%s: PnP-detected protocol ID: %d\n", + pInfo->name, t->val); + return (t->val); + } + } else + return prepnpparse(pInfo,buf); + } + return PROT_UNKNOWN; } +int +MouseGetPnpProtocol(InputInfoPtr pInfo) +{ + MouseDevPtr pMse = pInfo->private; + mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv; + int val; + CARD32 last; + + if ((val = MouseGetSerialPnpProtocol(pInfo)) != PROT_UNKNOWN) { + if (val == MouseGetSerialPnpProtocol(pInfo)) + return val; + } + +#if 1 + last = mPriv->pnpLast; + mPriv->pnpLast = currentTime.milliseconds; + + if (last) { + if (last - currentTime.milliseconds < 100 + || (mPriv->disablePnPauto + && (last - currentTime.milliseconds < 10000))) { +#ifdef EXTMOUSEDEBUG + xf86ErrorF("Mouse: Disabling PnP\n"); +#endif + mPriv->disablePnPauto = TRUE; + return PROT_UNKNOWN; + } + } + +#ifdef EXTMOUSEDEBUG + if (mPriv->disablePnPauto) + xf86ErrorF("Mouse: Enabling PnP\n"); +#endif + mPriv->disablePnPauto = FALSE; + + if (mPriv->soft) + return getPs2ProtocolPnP(pInfo); + else + return probePs2ProtocolPnP(pInfo); +#else + return PROT_UNKNOWN; +#endif +} + /* * Try to elicit a PnP ID as described in * Microsoft, Hayes: "Plug and Play External COM Device Specification, @@ -174,12 +225,12 @@ * procedure is used. XXX */ static int -pnpgets(InputInfoPtr pInfo, char *buf) +pnpgets(InputInfoPtr pInfo, char *buf, Bool *prePNP) { int i; char c; pointer pnpOpts; - + #if 0 /* * This is the procedure described in rev 1.0 of PnP COM device spec. @@ -259,13 +310,23 @@ /* collect PnP COM device ID (2.1.7) */ i = 0; + *prePNP = FALSE; + usleep(200000); /* the mouse must send `Begin ID' within 200msec */ while (xf86ReadSerial(pInfo->fd, &c, 1) == 1) { /* we may see "M", or "M3..." before `Begin ID' */ + if (c == 'M') + *prePNP = TRUE; + if ((c == 0x08) || (c == 0x28)) { /* Begin ID */ - buf[i++] = c; + *prePNP = FALSE; + buf[0] = c; + i = 1; break; } + if (*prePNP) + buf[i++] = c; + if (xf86WaitForInput(pInfo->fd, 200000) <= 0) break; } @@ -273,7 +334,9 @@ /* we haven't seen `Begin ID' in time... */ goto connect_idle; } - + if (*prePNP) + return i; + ++c; /* make it `End ID' */ for (;;) { if (xf86WaitForInput(pInfo->fd, 200000) <= 0) @@ -427,6 +490,16 @@ return TRUE; } +/* We can only identify MS at the moment */ +static int +prepnpparse(InputInfoPtr pInfo, char *buf) +{ + if (buf[0] == 'M' && buf[1] == '3') + return PROT_MS; + return PROT_UNKNOWN; +} + + static symtab_t * pnpproto(pnpid_t *id) { @@ -480,3 +553,226 @@ } return &tab[i]; } + +/******************* PS/2 PnP probing ****************/ + +static int +readMouse(InputInfoPtr pInfo, unsigned char *u) +{ + + if (xf86WaitForInput(pInfo->fd, 200000) <= 0) + return FALSE; + + xf86ReadSerial(pInfo->fd, u, 1); + return TRUE; +} + +static void +ps2DisableWrapMode(InputInfoPtr pInfo) +{ + unsigned char reset_wrap_mode[] = { 0xEC }; + ps2SendPacket(pInfo, reset_wrap_mode, sizeof(reset_wrap_mode)); +} + +Bool +ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len) +{ + unsigned char c; + int i,j; + +#ifdef DEBUG + xf86ErrorF("Ps/2 data package:"); + for (i = 0; i < len; i++) + xf86ErrorF(" %x", *(bytes + i)); + xf86ErrorF("\n"); +#endif + + for (i = 0; i < len; i++) { + for (j = 0; j < 10; j++) { + xf86WriteSerial(pInfo->fd, bytes + i, 1); + usleep(10000); + if (!readMouse(pInfo,&c)) { +#ifdef DEBUG + xf86ErrorF("sending 0x%x to PS/2 unsuccessful\n",*(bytes + i)); +#endif + return FALSE; + } +#ifdef DEBUG + xf86ErrorF("Recieved: 0x%x\n",c); +#endif + if (c == 0xFA) /* ACK */ + break; + + if (c == 0xFE) /* resend */ + continue; + + + if (c == 0xFC) /* error */ + return FALSE; + + /* Some mice accidently enter wrap mode during init */ + if (c == *(bytes + i) /* wrap mode */ + && (*(bytes + i) != 0xEC)) /* avoid recursion */ + ps2DisableWrapMode(pInfo); + + return FALSE; + } + if (j == 10) + return FALSE; + } + + return TRUE; +} + +static Bool +ps2DisableDataReporting(InputInfoPtr pInfo) +{ + unsigned char packet[] = { 0xF5 }; + return ps2SendPacket(pInfo, packet, sizeof(packet)); +} + +Bool +ps2EnableDataReporting(InputInfoPtr pInfo) +{ + unsigned char packet[] = { 0xF4 }; + return ps2SendPacket(pInfo, packet, sizeof(packet)); +} + +static int +ps2GetDeviceID(InputInfoPtr pInfo) +{ + unsigned char u; + unsigned char packet[] = { 0xf2 }; + if (!ps2SendPacket(pInfo, packet, sizeof(packet))) + return -1; + while (1) { + if (!readMouse(pInfo,&u)) + return -1; + if (u != 0xFA) + break; + } +#ifdef DEBUG + xf86ErrorF("Obtained Mouse Type: %x\n",u); +#endif + return (int) u; +} + +Bool +ps2Reset(InputInfoPtr pInfo) +{ + unsigned char u; + unsigned char packet[] = { 0xff }; + unsigned char reply[] = { 0xaa, 0x00 }; + int i; +#ifdef DEBUG + xf86ErrorF("PS/2 Mouse reset\n"); +#endif + if (!ps2SendPacket(pInfo, packet, sizeof(packet))) + return FALSE; + /* we need a little delay here */ + xf86WaitForInput(pInfo->fd, 500000); + for (i = 0; i < sizeof(reply) ; i++) { + if (!readMouse(pInfo,&u)) { + goto EXIT; + } + if (u != reply[i]) + goto EXIT; + } + return TRUE; + + EXIT: + xf86FlushInput(pInfo->fd); + return FALSE; +} + +static MouseProtocolID +probePs2ProtocolPnP(InputInfoPtr pInfo) +{ + unsigned char u; + MouseProtocolID ret = PROT_UNKNOWN; + + xf86FlushInput(pInfo->fd); + + ps2DisableDataReporting(pInfo); + + if (ps2Reset(pInfo)) { /* Reset PS2 device */ + unsigned char seq[] = { 243, 200, 243, 100, 243, 80, 242 }; + /* Try to identify Intelli Mouse */ + if (ps2SendPacket(pInfo, seq, sizeof(seq))) { + readMouse(pInfo,&u); + if (u == 0x03) { + /* found IntelliMouse now try IntelliExplorer */ + unsigned char seq[] = { 243, 200, 243, 200, 243, 80, 242 }; + if (ps2SendPacket(pInfo,seq,sizeof(seq))) { + readMouse(pInfo,&u); + if (u == 0x05) + ret = PROT_EXPPS2; + else + ret = PROT_IMPS2; + } + } else if (ps2Reset(pInfo)) /* reset again to find sane state */ + ret = PROT_PS2; + } + + if (ret != PROT_UNKNOWN) + ps2EnableDataReporting(pInfo); + } + return ret; +} + +static struct ps2protos { + int Id; + MouseProtocolID protoID; +} ps2 [] = { + { 0x0, PROT_PS2 }, + { 0x3, PROT_IMPS2 }, + { 0x5, PROT_EXPPS2 }, + { -1 , PROT_UNKNOWN } +}; + + +static MouseProtocolID +getPs2ProtocolPnP(InputInfoPtr pInfo) +{ + int Id; + int i; + MouseProtocolID proto; + int count = 4; + + xf86FlushInput(pInfo->fd); + + while (--count) + if (ps2DisableDataReporting(pInfo)) + break; + + if (!count) { + proto = PROT_UNKNOWN; + goto EXIT; + } + + if ((Id = ps2GetDeviceID(pInfo)) == -1) { + proto = PROT_UNKNOWN; + goto EXIT; + } + + if (-1 == ps2EnableDataReporting(pInfo)) { + proto = PROT_UNKNOWN; + goto EXIT; + } + + for (i = 0; ps2[i].protoID != PROT_UNKNOWN; i++) { + if (ps2[i].Id == Id) { + xf86MsgVerb(X_PROBED,2,"Found PS/2 proto ID %x\n",Id); + proto = ps2[i].protoID; + goto EXIT; + } + } + + proto = PROT_UNKNOWN; + xf86Msg(X_ERROR,"Found unknown PS/2 proto ID %x\n",Id); + + EXIT: + xf86FlushInput(pInfo->fd); + return proto; +} + Index: xc/programs/Xserver/hw/xfree86/input/palmax/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/palmax/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:07 2003 +++ xc/programs/Xserver/hw/xfree86/input/palmax/Imakefile Thu Nov 21 22:40:22 2002 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/palmax/Imakefile,v 1.1 2002/11/22 03:40:22 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86Palmax.c +OBJS = xf86Palmax.o + +DRIVER = palmax + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/palmax/palmax.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/palmax/palmax.man:1.1 --- /dev/null Thu Feb 27 12:32:07 2003 +++ xc/programs/Xserver/hw/xfree86/input/palmax/palmax.man Thu Nov 21 22:40:22 2002 @@ -0,0 +1,88 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/palmax/palmax.man,v 1.1 2002/11/22 03:40:22 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH PALMAX __drivermansuffix__ __vendorversion__ +.SH NAME +palmax \- Palmax (TR88L803) touchscreen driver +.SH SYNOPSIS +.B "Section \*qInputDevice\*q" +.br +.BI " Identifier \*q" idevname \*q +.br +.B " Driver \*qpalmax\*q" +.br +.BI " Option \*qDevice\*q \*q" devpath \*q +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B palmax +is an XFree86 input driver for the Palmax PD1000/PD1100 +.PP +The +.B palmax +driver functions as a pointer input device, and is normally used as the +X server's core pointer. It supports positioning and mouse buttons using +the touchscreen display and lid buttons on the Palmax machines. +.SH SUPPORTED HARDWARE +Palmax PD1000, Palmax PD1100. In theory also any other system using a +TR88L803 wired to a serial port. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The following driver +.B options +are supported +.TP +.BI "Option \*qMinX\*q \*q" integer \*q +Set the left hand X value from the touchscreen, for calibration. +.TP +.BI "Option \*qMaxX\*q \*q" integer \*q +Set the right hand X value from the touchscreen, for calibration. +.TP +.BI "Option \*qMinY\*q \*q" integer \*q +Set the top Y value from the touchscreen, for calibration. +.TP +.BI "Option \*qMaxY\*q \*q" integer \*q +Set the bottom Y value from the touchscreen, for calibration. +.TP +.BI "Option \*qScreen\*q \*q" integer \*q +The screen to attach to the touchscreen when running with multiple screens. +The default is screen 0. +.TP +.BI "Option \*qDevice\*q \*q" string \*q +The serial port that is attached to the touchscreen interface. On the Palmax +PD1000 and PD1100 this is ttyS0. +.TP +.BI "Option \*qDeviceName\*q \*q" string \*q +Set the X11 device name for the touchscreen. This defaults to TOUCHSCREEN. +.TP +.BI "Option \*qPortraitMode\*q \*q" string \*q +Set the display orientation. The default is "landscape" but you can rotate +the screen clockwise ("portrait") or anticlockwise ("portraitCCW"). +.TP +.BI "Option \*qSwapXY\*q \*q" boolean \*q +Swap the X and Y values on the display. The default is false. +.TP +.BI "Option \*qTapButton\*q \*q" boolean \*q +Set the touchscreen tap to act as mouse button 1. This allows single handed +operation except when using the menu buttons. The default is false. +.SH "BUGS" +The driver has been tested on the Palmax systems, the defaults reflect the +Palmax hardware and should work out of the box. No testing has been done on +other systems using the same digitizer. +.PP +Support for a double-tap menu button option would be nice. +.PP +The smoothing algorithm would benefit from real mathematics. +.PP +XFree86 needs a nice calibration tool. +.PP +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... + Alan Cox Index: xc/programs/Xserver/hw/xfree86/input/palmax/xf86Palmax.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/palmax/xf86Palmax.c:1.1 --- /dev/null Thu Feb 27 12:32:07 2003 +++ xc/programs/Xserver/hw/xfree86/input/palmax/xf86Palmax.c Thu Nov 21 22:40:22 2002 @@ -0,0 +1,822 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/palmax/xf86Palmax.c,v 1.1 2002/11/22 03:40:22 dawes Exp $ */ + +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" +#include "os.h" + +#ifdef XFree86LOADER +#include "xf86Module.h" +#endif + +/* + *************************************************************************** + * + * Default constants. + * + *************************************************************************** + */ + +#define DEFAULT_MAX_X 63104 +#define DEFAULT_MIN_X 8786 +#define DEFAULT_MAX_Y 61592 +#define DEFAULT_MIN_Y 7608 + +#define XI_STYLUS "TOUCHSCREEH" /* X device name for the stylus device */ + + +/* + *************************************************************************** + * + * Protocol constants. + * + *************************************************************************** + */ + +#define PMX_REPORT_SIZE 3 /* Size of a report packet. */ +#define PMX_BUFFER_SIZE 256 /* Size of input buffer. */ +#define PMX_PACKET_SIZE 5 /* Maximum size of a command/reply *including* */ + +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL +}; + + /* the leading and trailing bytes. */ + +/* + *************************************************************************** + * + * Device private records. + * + *************************************************************************** + */ + +typedef struct _PMXPrivateRec { + char *input_dev; /* The touchscreen input tty */ + OsTimerPtr uptimer; /* Timeout on stream */ + OsTimerPtr polltimer; /* Button poll timer */ + int min_x; /* Minimum x reported by calibration */ + int max_x; /* Maximum x */ + int min_y; /* Minimum y reported by calibration */ + int max_y; /* Maximum y */ + int cur_x; /* Current x */ + int cur_y; /* Current y */ + int button1; /* True if finger button 1 is down */ + int button2; /* True if finger button 2 is down */ + int button3; /* 1 if button3 down, 2 on wait for up */ + int screen_no; /* Screen associated with the device */ + int screen_width; /* Width of the associated X screen */ + int screen_height; /* Height of the screen */ + Bool inited; /* The controller has already been configured ? */ + char state; /* Current state of report flags. */ + int num_old_bytes; /* Number of bytes left in receive buffer. */ + LocalDevicePtr stylus; /* Stylus device ptr associated with the hw. */ + int swap_axes; /* Swap X an Y axes if != 0 */ + int tap_button; /* Tapping is button 0 */ + unsigned char rec_buf[PMX_BUFFER_SIZE]; /* Receive buffer. */ +} PMXPrivateRec, *PMXPrivatePtr; + + +/* + *************************************************************************** + * + * xf86PmxConvert -- + * Convert extended valuators to x and y suitable for core motion + * events. Return True if ok and False if the requested conversion + * can't be done for the specified valuators. + * + *************************************************************************** + */ +static Bool xf86PmxConvert(LocalDevicePtr local, int first, int num, + int v0,int v1,int v2,int v3, int v4, int v5, int *x, int *y) +{ + PMXPrivatePtr priv = (PMXPrivatePtr) local->private; + int width = priv->max_x - priv->min_x; + int height = priv->max_y - priv->min_y; + int input_x, input_y; + int tmp; + + input_x = v0; + input_y = v1; + + if (priv->swap_axes) { + tmp = input_x; + input_x = input_y; + input_y = tmp; + } + *x = (priv->screen_width * (input_x - priv->min_x)) / width; + *y = (priv->screen_height * (input_y - priv->min_y)) / height; + /* + * Need to check if still on the correct screen. + * This call is here so that this work can be done after + * calib and before posting the event. + */ + xf86XInputSetScreen(local, priv->screen_no, *x, *y); + return TRUE; +} + + +/* + * Unpack a two byte code from the Palmax touchscreen + */ + +static int unpack(unsigned int v1, unsigned int v2) +{ + /* Actually v1 lower 6 bits are not used */ + return (v2 << 8) | (v1); +} + +static CARD32 PalmaxUpTimeout(OsTimerPtr timer, CARD32 now, pointer arg) +{ + PMXPrivatePtr priv = arg; + if(priv->state) + { + int sigstate = xf86BlockSIGIO (); + /* Post a button up event */ + xf86PostButtonEvent(priv->stylus->dev, TRUE, 1, 0, + 0, 2, priv->cur_x >> 4, priv->cur_y >> 4); + priv->state = 0; + xf86UnblockSIGIO (sigstate); + } + return 0; +} + +/* + * Poll the Palmax finger buttons ten times a second + */ + +static CARD32 PalmaxPollTimeout(OsTimerPtr timer, CARD32 now, pointer arg) +{ + LocalDevicePtr local = (LocalDevicePtr) arg; + PMXPrivatePtr priv = (PMXPrivatePtr)(local->private); + int modembits; + int button1 = 0, button2 = 0; + int sigstate = xf86BlockSIGIO (); + + modembits = xf86GetSerialModemState(local->fd); + + if (modembits & XF86_M_CTS) + button1 = 1; + + if (modembits & XF86_M_DSR) + button2 = 1; + + /* + * Check for chording for "middle" button + */ + if(button1 == 1 && button2 == 1 && priv->button1 == 0 && priv->button2 == 0) + { + if(!priv->button3) + { + /* Middle button emulation - down */ + xf86PostButtonEvent(priv->stylus->dev, TRUE, 3, 1, + 0, 2, priv->cur_x >> 4, priv->cur_y >> 4); + priv->button3 = 1; + } + } + + /* + * Check if we are chording and haven't yet released + * both buttons + */ + if(priv->button3 && (button1 == 0 || button2 == 0)) + { + if(priv->button3 != 2) + { + /* Middle button emulation - up */ + xf86PostButtonEvent(priv->stylus->dev, TRUE, 3, 0, + 0, 2, priv->cur_x >> 4, priv->cur_y >> 4); + priv->button3 = 2; + } + /* + * Wait for both buttons to go up + */ + if(button1 || button2) + goto out; + priv->button3 = 0; + } + if(button1 != priv->button1) + { + xf86PostButtonEvent(priv->stylus->dev, TRUE, 1, button1, + 0, 2, priv->cur_x >> 4, priv->cur_y >> 4); + priv->button1 = button1; + } + if(button2 != priv->button2) + { + xf86PostButtonEvent(priv->stylus->dev, TRUE, 2, button2, + 0, 2, priv->cur_x >> 4, priv->cur_y >> 4); + priv->button2 = button2; + } + +out: + xf86UnblockSIGIO (sigstate); + return 100; +} + +/* + *************************************************************************** + * + * xf86PmxReadInput -- + * Read a buffer full of input from the touchscreen and enqueue + * all report packets found in it. + * The routine can work with any of the two X device structs associated + * with the touchscreen. It is always possible to find the relevant + * informations and to emit the events for both devices if provided + * with one of the two structs. This point is relevant only if the + * two devices are actives at the same time. + * + + *************************************************************************** + */ +static void xf86PmxReadInput(LocalDevicePtr local) +{ + PMXPrivatePtr priv = (PMXPrivatePtr)(local->private); + int cur_x, cur_y; + int state; + int num_bytes; + int bytes_in_packet; + unsigned char *ptr, *start_ptr; + int report_size = 3; + + /* + * Try to get a buffer full of report packets. + */ + + num_bytes = xf86ReadSerial(local->fd, (char *) (priv->rec_buf + priv->num_old_bytes), + PMX_BUFFER_SIZE - priv->num_old_bytes); + if (num_bytes < 0) { + Error("System error while reading from Palmax touchscreen."); + return; + } + + num_bytes += priv->num_old_bytes; + ptr = priv->rec_buf; + bytes_in_packet = 0; + start_ptr = ptr; + + while (num_bytes >= report_size) + { + /* + * Skip bytes until we hit a header (FE/FF) + */ + + switch(bytes_in_packet) + { + case 0: + if(ptr[0] != 0xFF) + start_ptr++; + else + bytes_in_packet++; + break; + case 1: + if(ptr[0] == 0xFE) + report_size = 3; + else + report_size = 5; + bytes_in_packet++; + break; + default: + bytes_in_packet++; + break; + } + num_bytes--; + ptr++; + + if (bytes_in_packet == report_size) + { + /* + * First stick together the various pieces. + */ + + if(priv->uptimer) + { + TimerFree(priv->uptimer); + priv->uptimer = NULL; + } + + state = 1; + if(start_ptr[1] == 0xFE) + state = 0; + else + { + int new_x = unpack(start_ptr[1], start_ptr[2]); + int new_y = unpack(start_ptr[3], start_ptr[4]); + int shift = abs(new_x - (priv->cur_x >> 4)); + shift += abs(new_y - (priv->cur_y >> 4)); + + if(shift < 1400) + { + /* We work to a base of 16 times the pointer, and do smoothing */ + cur_y = ((priv->cur_y * 15) >> 4) + new_y; + cur_x = ((priv->cur_x * 15) >> 4) + new_x; + } + else if(shift < 3000) + { + /* We work to a base of 16 times the pointer, and do smoothing */ + cur_y = ((priv->cur_y * 7) >> 3) + (new_y << 1); + cur_x = ((priv->cur_x * 7) >> 3) + (new_x << 1); + } + else if(shift < 6000) + { + /* We work to a base of 16 times the pointer, and do smoothing */ + cur_y = ((priv->cur_y * 3) >> 2) + (new_y << 2); + cur_x = ((priv->cur_x * 3) >> 2) + (new_x << 2); + /* Supress button change until the jitter filter has kicked in */ + state = priv->state; + } + else + { + cur_y = new_y << 4; + cur_x = new_x << 4; + /* Supress button change until the jitter filter has kicked in */ + state = priv->state; + } + xf86PostMotionEvent(priv->stylus->dev, TRUE, 0, 2, cur_x >> 4, cur_y >> 4); + priv->cur_x = cur_x; + priv->cur_y = cur_y; + } + + start_ptr = ptr; + bytes_in_packet = 0; + + /* + * Emit a button press or release. + */ + if (state != priv->state && priv->tap_button) + { + /* Post the event, or in the first button since both may + impact the value */ + xf86PostButtonEvent(priv->stylus->dev, TRUE, 1, state|priv->button1, + 0, 2, priv->cur_x >> 4, priv->cur_y >> 4); + priv->state = state; + if(state == 1) + priv->uptimer = TimerSet(priv->uptimer, 0, 100, PalmaxUpTimeout, priv); + } + } + } + + /* + * If some bytes are left in the buffer, pack them at the + * beginning for the next turn. + */ + if (num_bytes != 0) { + memcpy(priv->rec_buf, ptr, num_bytes); + priv->num_old_bytes = num_bytes; + } + else + { + priv->num_old_bytes = 0; + } +} + + +static void PMXPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl) +{ + /* I have no clue what this does, except that registering it stops the + X server segfaulting in ProcGetPointerMapping() + Ho Hum. + */ +} + +/* + *************************************************************************** + * + * xf86PmxControl -- + * + *************************************************************************** + */ +static Bool +xf86PmxControl(DeviceIntPtr dev, + int mode) +{ + static unsigned char map[] = { 0, 1, 3, 2}; + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + PMXPrivatePtr priv = (PMXPrivatePtr)(local->private); + + switch(mode) + { + + case DEVICE_INIT: + if (priv->screen_no >= screenInfo.numScreens || priv->screen_no < 0) { + priv->screen_no = 0; + } + priv->screen_width = screenInfo.screens[priv->screen_no]->width; + priv->screen_height = screenInfo.screens[priv->screen_no]->height; + + /* + * Device reports button press for up to 3 buttons. + */ + if (InitButtonClassDeviceStruct(dev, 3, map) == FALSE) { + ErrorF("Unable to allocate ButtonClassDeviceStruct\n"); + return !Success; + } + + /* + * Device reports motions on 2 axes in absolute coordinates. + * Axes min and max values are reported in raw coordinates. + * Resolution is computed roughly by the difference between + * max and min values scaled from the approximate size of the + * screen to fit one meter. + */ + + if (InitValuatorClassDeviceStruct(dev, 2, xf86GetMotionEvents, + local->history_size, Absolute) == FALSE) { + ErrorF("Unable to allocate ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + InitValuatorAxisStruct(dev, 0, priv->min_x, priv->max_x, + 65535, + 0 /* min_res */, + 65535 /* max_res */); + InitValuatorAxisStruct(dev, 1, priv->min_y, priv->max_y, + 65535, /* resolution */ + 0 /* min_res */, + 65535 /* max_res */); + } + + if (InitFocusClassDeviceStruct(dev) == FALSE) { + ErrorF("Unable to allocate FocusClassDeviceStruct\n"); + } + + if(InitPtrFeedbackClassDeviceStruct(dev, PMXPtrCtrl) == FALSE) { + ErrorF("Unable to allocate PtrFeedBackClassDeviceStruct\n"); + } + + /* + * Allocate the motion events buffer. + */ + + xf86MotionHistoryAllocate(local); + + return Success; + + case DEVICE_ON: + if (local->fd < 0) { + local->fd = xf86OpenSerial(local->options); + if (local->fd < 0) { + Error("Unable to open Palmax touchscreen device"); + return !Success; + } + AddEnabledDevice(local->fd); + } + priv->polltimer = TimerSet(priv->polltimer, 0, 100, PalmaxPollTimeout, local); + + dev->public.on = TRUE; + return Success; + + case DEVICE_OFF: + if(priv->polltimer) + { + TimerFree(priv->polltimer); + priv->polltimer = NULL; + } + dev->public.on = FALSE; + return Success; + + case DEVICE_CLOSE: + dev->public.on = FALSE; + if(priv->uptimer) + { + TimerFree(priv->uptimer); + priv->uptimer = NULL; + } + if (local->fd >= 0) { + xf86RemoveEnabledDevice(local); + xf86CloseSerial(local->fd); + local->fd = -1; + } + return Success; + default: + ErrorF("unsupported mode=%d\n", mode); + return !Success; + } +} + +/* + *************************************************************************** + * + * xf86PmxControlProc -- + * + *************************************************************************** + */ + +static int xf86PmxControlProc (InputInfoPtr pInfo, xDeviceCtl * control) +{ +#if 0 + xDeviceTSCalibrationCtl *c = (xDeviceTSCalibrationCtl *) control; + PMXPrivatePtr priv = (PMXPrivatePtr) (pInfo->private); + priv->min_x = c->min_x; + priv->max_x = c->max_x; + priv->min_y = c->min_y; + priv->max_y = c->max_y; +#endif + return (Success); +} + +/* + *************************************************************************** + * + * xf86PmxAllocate -- + * + *************************************************************************** + */ +static LocalDevicePtr xf86PmxAllocate(InputDriverPtr drv, char *name, char *type_name, int flag) +{ + LocalDevicePtr local = xf86AllocateInput(drv, 0); + PMXPrivatePtr priv = (PMXPrivatePtr) xalloc(sizeof(PMXPrivateRec)); + + if (!local || !priv) + { + if(priv) + xfree(priv); + if(local) + xfree(local); + return NULL; + } + + priv->input_dev = strdup("/dev/ttyS0"); + priv->min_x = 0; + priv->max_x = 0; + priv->min_y = 0; + priv->max_y = 0; + priv->screen_no = 0; + priv->screen_width = -1; + priv->screen_height = -1; + priv->inited = 0; + priv->state = 0; + priv->num_old_bytes = 0; + priv->swap_axes = 0; + priv->tap_button = 0; + priv->uptimer = NULL; + priv->polltimer = NULL; + priv->button1 = 0; + priv->button2 = 0; + + local->name = name; + local->flags = 0 /* XI86_NO_OPEN_ON_INIT */; + local->device_control = xf86PmxControl; + local->read_input = xf86PmxReadInput; + local->control_proc = xf86PmxControlProc; + local->close_proc = NULL; + local->switch_mode = NULL; + local->conversion_proc = xf86PmxConvert; + local->reverse_conversion_proc = NULL; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->private_flags = flag; + local->type_name = type_name; + local->history_size = 0; + + return local; +} + + +/* + *************************************************************************** + * + * xf86PmxAllocateStylus -- + * + *************************************************************************** + */ +static LocalDevicePtr xf86PmxAllocateStylus(InputDriverPtr drv) +{ + LocalDevicePtr local = xf86PmxAllocate(drv, XI_STYLUS, "Palmax Stylus", 1); + if (local) + ((PMXPrivatePtr) local->private)->stylus = local; + return local; +} + + +static void xf86PmxUninit(InputDriverPtr drv, LocalDevicePtr local, int flags) +{ + PMXPrivatePtr priv = (PMXPrivatePtr) local->private; + + xf86PmxControl(local->dev, DEVICE_OFF); + + if (priv) { + priv->stylus->private = NULL; + xfree(priv->input_dev); + xfree(priv); + } + xfree(local->name); + xfree(local); + + xf86DeleteInput(local, 0); +} + +static const char *default_options[] = { + "BaudRate", "19200", + "StopBits", "1", + "DataBits", "8", + "Parity", "None", + "Vmin", "1", + "Vtime", "1", + "FlowControl", "None", + NULL +}; + +static InputInfoPtr xf86PmxInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + LocalDevicePtr local=NULL, fake_local=NULL; + PMXPrivatePtr priv=NULL; + char *str; + int portrait=0; + + fake_local = (LocalDevicePtr) xcalloc(1, sizeof(LocalDeviceRec)); + if (!fake_local) { + goto init_err; + } + fake_local->conf_idev = dev; + + xf86CollectInputOptions(fake_local, default_options, NULL); + + local = xf86PmxAllocateStylus(drv); + priv = local->private; + local->options = fake_local->options; + local->conf_idev = fake_local->conf_idev; + xfree(fake_local); + fake_local = NULL; + + str = xf86FindOptionValue(local->options, "Device"); + if (!str) { + xf86Msg(X_ERROR, "%s: No Device specified in Palmax module config.\n", dev->identifier); + goto init_err; + } + priv->input_dev = strdup(str); + priv->stylus = local; + + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + + str = xf86FindOptionValue(local->options, "DeviceName"); + if (str) { + local->name = strdup(str); + } + xf86Msg(X_CONFIG, "Palmax X device name: %s\n", local->name); + priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", 0); + xf86Msg(X_CONFIG, "Palmax associated screen: %d\n", priv->screen_no); + priv->max_x = xf86SetIntOption(local->options, "MaxX", DEFAULT_MAX_X); + xf86Msg(X_CONFIG, "Palmax maximum x position: %d\n", priv->max_x); + priv->min_x = xf86SetIntOption(local->options, "MinX", DEFAULT_MIN_X); + xf86Msg(X_CONFIG, "Palmax minimum x position: %d\n", priv->min_x); + priv->max_y = xf86SetIntOption(local->options, "MaxY", DEFAULT_MAX_Y); + xf86Msg(X_CONFIG, "Palmax maximum y position: %d\n", priv->max_y); + priv->min_y = xf86SetIntOption(local->options, "MinY", DEFAULT_MIN_Y); + xf86Msg(X_CONFIG, "Palmax minimum y position: %d\n", priv->min_y); + priv->tap_button = xf86SetBoolOption(local->options, "TapButton", 0); + if(priv->tap_button) + xf86Msg(X_CONFIG, "Palmax touchpad acts as button\n"); + priv->swap_axes = xf86SetBoolOption(local->options, "SwapXY", 0); + if (priv->swap_axes) { + xf86Msg(X_CONFIG, "Palmax %s device will work with X and Y axes swapped\n", + local->name); + } + str = xf86SetStrOption(local->options, "PortraitMode", "Landscape"); + if (strcmp(str, "Portrait") == 0) { + portrait = 1; + } + else if (strcmp(str, "PortraitCCW") == 0) { + portrait = -1; + } + else if (strcmp(str, "Landscape") != 0) { + xf86Msg(X_ERROR, "Palmax portrait mode should be: Portrait, Landscape or PortraitCCW"); + str = "Landscape"; + } + xf86Msg(X_CONFIG, "Palmax device will work in %s mode\n", str); + + if (priv->max_x - priv->min_x <= 0) { + xf86Msg(X_INFO, "Palmax: reverse x mode (minimum x position >= maximum x position)\n"); + } + if (priv->max_y - priv->min_y <= 0) { + xf86Msg(X_INFO, "Palmax: reverse y mode (minimum y position >= maximum y position)\n"); + } + + if (portrait == 1) { + /* + * Portrait Clockwise: reverse Y axis and exchange X and Y. + */ + int tmp; + tmp = priv->min_y; + priv->min_y = priv->max_y; + priv->max_y = tmp; + priv->swap_axes = (priv->swap_axes==0) ? 1 : 0; + } + else if (portrait == -1) { + /* + * Portrait Counter Clockwise: reverse X axis and exchange X and Y. + */ + int tmp; + tmp = priv->min_x; + priv->min_x = priv->max_x; + priv->max_x = tmp; + priv->swap_axes = (priv->swap_axes==0) ? 1 : 0; + } + + /* mark the device configured */ + local->flags |= XI86_CONFIGURED; + return local; + +init_err: + if (fake_local) + xfree(fake_local); + if (priv) { + if (priv->input_dev) + xfree(priv->input_dev); + xfree(priv); + } + if (local) + xfree(local); + return NULL; +} + +#ifdef XFree86LOADER +static +#endif +InputDriverRec PALMAX = { + 1, /* driver version */ + "palmax", /* driver name */ + NULL, /* identify */ + xf86PmxInit, /* pre-init */ + xf86PmxUninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + +#ifdef XFree86LOADER +static pointer Plug(pointer module, pointer options, int *errmaj,int *errmin) +{ + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&PALMAX, module, 0); + return module; +} + +static void Unplug(pointer p) +{ +} + +static XF86ModuleVersionInfo version_rec = { + "palmax", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + { 0, 0, 0, 0 } +}; + +/* + * This is the entry point in the module. The name + * is setup after the pattern <module_name>ModuleData. + * Do not change it. + */ +XF86ModuleData palmaxModuleData = { &version_rec, Plug, Unplug }; +#endif + Index: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile:1.2 Tue Jan 23 19:06:38 2001 +++ xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile Tue Oct 15 21:47:02 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile,v 1.2 2001/01/24 00:06:38 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile,v 1.3 2002/10/16 01:47:02 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -8,7 +8,7 @@ DRIVER = penmount -INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/input/sample/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/sample/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/input/sample/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/input/sample/Imakefile:1.5 Tue Jan 15 10:32:45 2002 +++ xc/programs/Xserver/hw/xfree86/input/sample/Imakefile Tue Oct 15 21:47:02 2002 @@ -3,7 +3,7 @@ * WHEN WRITING A NEW INPUT DRIVER. */ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/Imakefile,v 1.5 2002/01/15 15:32:45 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/Imakefile,v 1.6 2002/10/16 01:47:02 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,7 +13,7 @@ DRIVER = sample -INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c diff -u xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.11 xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.13 --- xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.11 Wed Dec 26 16:49:42 2001 +++ xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c Sat Jan 11 22:55:50 2003 @@ -24,7 +24,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.11 2001/12/26 21:49:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.13 2003/01/12 03:55:50 tsi Exp $ */ static const char identification[] = "$Identification: 18 $"; @@ -1208,11 +1208,11 @@ * enagae signal handlers yet. -huver@amgraf.com mar/12/2001. */ #if 0 - #ifdef XFREE86_V4 +# ifdef XFREE86_V4 xf86AddEnabledDevice(local); - #else +# else AddEnabledDevice(local->fd); - #endif +# endif #else AddEnabledDevice(local->fd); #endif @@ -1225,11 +1225,11 @@ if (! pSum->public.on) break; /* already off */ if (local->fd >= 0) #if 0 - #ifdef XFREE86_V4 +# ifdef XFREE86_V4 xf86RemoveEnabledDevice(local); - #else +# else RemoveEnabledDevice(local->fd); - #endif +# endif #else RemoveEnabledDevice(local->fd); #endif @@ -1485,6 +1485,11 @@ debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); if (debug_level > 0) { xf86Msg(X_CONFIG, "Summa: debug level set to %d\n", debug_level); + } + + priv->sumInc = xf86SetIntOption(local->options, "Increment", -1); + if (priv->sumInc >= 0) { + xf86Msg(X_CONFIG, "%s: increment set to %d\n", local->name, priv->sumInc); } s = xf86FindOptionValue(local->options, "Resolution"); Index: xc/programs/Xserver/hw/xfree86/input/tek4957/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/tek4957/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:08 2003 +++ xc/programs/Xserver/hw/xfree86/input/tek4957/Imakefile Sun Nov 10 20:18:08 2002 @@ -0,0 +1,30 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/tek4957/Imakefile,v 1.1 2002/11/11 01:18:08 alanh Exp $ */ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86Tek4957.c +OBJS = xf86Tek4957.o + +DRIVER = tek4957 + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/tek4957/tek4957.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/tek4957/tek4957.man:1.1 --- /dev/null Thu Feb 27 12:32:08 2003 +++ xc/programs/Xserver/hw/xfree86/input/tek4957/tek4957.man Sun Nov 10 20:18:08 2002 @@ -0,0 +1,85 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/tek4957/tek4957.man,v 1.1 2002/11/11 01:18:08 alanh Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH TEK4957 __drivermansuffix__ __vendorversion__ +.SH NAME +tek4957 \- Tektronix 4957 input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qtek4957\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B tek4957 +is an XFree86 input driver for the Tektronix 4957 tablet. +.PP +The +.B tek4957 +driver functions as a pointer input device, and may be used as the +X server's core pointer. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.RS 8 +.TP 4 +.B Option \fI"Device"\fP \fI"devpath"\fP +sets the path to the special file which represents serial line where +the tablet is plugged, for example /dev/ttyS0. +.B This option is mandatory. +.TP 4 +.B Option \fI"DeviceName"\fP \fI"name"\fP +sets the name of the X device. +.TP 4 +.B Option \fI"Speed"\fP \fI"number"\fP +sets the sampling rate, from 1 to 6. +Default is 6, maximum speed. +.TP 4 +.B Option \fI"Resolution"\fP \fI"number"\fP +sets the resolution. +.RS 8 +.br +0 : 2340 dots : 1/200 inch +.br +1 : 2972 dots : 1/10 mm +.br +2 : 11700 dots : 1/1000 inch +.br +3 : 11887 dots : 1/40 mm +.br +4 : 5850 dots : 1/500 inch +.br +5 : 5944 dots : 1/20 mm : +.B default +.br +6 : 4680 dots : 1/400 inch +.br +7 : 1170 dots : 1/100 inch +.br +8 : 12 dots : 1 inch +.br +9 : 24 dots : 1/2 inch +.RE +.TP 4 +.B Option \fI"TopX"\fP \fI"number"\fP +X coordinate of the top corner of the active zone. ( Default = 0 ) +.TP 4 +.B Option \fI"TopY"\fP \fI"number"\fP +Y coordinate of the top corner of the active zone. ( Default = 0 ) +.TP 4 +.B Option \fI"BottomX"\fP \fI"Inumber"\fP +X coordinate of the bottom corner of the active zone. ( Default = full scale ) +.TP 4 +.B Option \fI"BottomY"\fP \fI"number"\fP +Y coordinate of the bottom corner of the active zone. ( Default = full scale ) +.RE +.SH "BUGS / LIMITATIONS" +Currently, only "Absolute" mode is supported ( Sorry ) +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Olivier DANET <odanet@caramail.com> Index: xc/programs/Xserver/hw/xfree86/input/tek4957/xf86Tek4957.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/tek4957/xf86Tek4957.c:1.1 --- /dev/null Thu Feb 27 12:32:08 2003 +++ xc/programs/Xserver/hw/xfree86/input/tek4957/xf86Tek4957.c Sun Nov 10 20:18:08 2002 @@ -0,0 +1,777 @@ +/* + * Copyright 2002 by Olivier DANET <odanet@caramail.com> + * + * Designed for XFree86 version >= 4.0 + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of O. DANET may not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. O.DANET makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * O. DANET DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL O. DANET BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/tek4957/xf86Tek4957.c,v 1.1 2002/11/11 01:18:08 alanh Exp $ */ + +#ifndef XFree86LOADER +#include <unistd.h> +#include <errno.h> +#endif + +#include "misc.h" +#include "xf86.h" +#define NEED_XF86_TYPES +#if !defined(DGUX) +#include "xf86_ansic.h" +#include "xisb.h" +#endif +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" +#include "keysym.h" +#include "mipointer.h" + +#ifdef XFree86LOADER +#include "xf86Module.h" +#endif + +/* + * Debug Macros + */ + +#ifdef DBG +#undef DBG +#endif +#ifdef DEBUG +#undef DEBUG +#endif + +/*#define DEBUG 1*/ /* Remove comment to enable debug message */ +#ifdef DEBUG +static int debug_level = 0; +#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} +#else +#define DBG(lvl, f) +#endif + +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + + +static InputDriverPtr tekDrv; + +static const char *default_options[] = +{ + "Device", "/dev/ttyS2", + "BaudRate", "9600", + "DataBits", "7", + "StopBits", "1", + "Parity", "Odd", + "FlowControl", "None", + "VTime", "10", + "VMin", "1", + NULL +}; + +/* + * List of available resolutions + */ + +static const int resol[] = +{ + 2340, /* 0: 1/200 inch */ + 2972, /* 1: 1/10 mm */ + 11700, /* 2: 1/1000 inch */ + 11887, /* 3: 1/40 mm */ + 5850, /* 4: 1/500 inch */ + 5944, /* 5: 1/20 mm : default */ + 4680, /* 6: 1/400 inch */ + 1170, /* 7: 1/100 inch */ + 12, /* 8: 1 inch */ + 24 /* 9: 1/2 inch */ +}; + +typedef struct +{ + char *Device; /* device file name */ + int LastX; /* last X position */ + int LastY; /* last Y position */ + int LastProximity; /* last proximity */ + int LastButtons; /* last buttons state */ + + int XMax; /* max X value */ + int YMax; /* max Y value */ + int XSize; /* active area X size */ + int XOffset; /* active area X offset */ + int YSize; /* active area Y size */ + int YOffset; /* active area Y offset */ + + int Resmode; /* Resolution mode */ + int Speed; /* Speed */ + int Init; /* Initialized ? */ + + int Index; /* number of bytes read */ + unsigned char Data[9]; /* data read from the device */ +} TekDeviceRec, *TekDevicePtr; + + +/* + * TekConvert + * Convert device valuator values to screen X and Y. + */ +static Bool +TekConvert(LocalDevicePtr local, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int* x, + int* y) +{ + TekDevicePtr priv = (TekDevicePtr) local->private; + int W,H; + ScreenPtr SP; + + DBG(6,xf86Msg(X_INFO,"Tek4957:TekConvert (%d,%d)\n",v0,v1)); + + /* Gets current screen size. It can change dynamically in the case of + a multi-head configuration with different screen sizes ... */ + SP=miPointerCurrentScreen(); + W=SP->width; + H=SP->height; + + if (first != 0 || num == 1) return (FALSE); + + *x = ((long)v0 * (long)W) / (long)priv->XSize; + *y = ((long)v1 * (long)H) / (long)priv->YSize; + + DBG(7,xf86Msg(X_INFO,"Tek4957:TekConvert ->(%d,%d)\n",*x,*y)); + + return (TRUE); +} + +/* + * TekReadInput + * Reads data and posts any new events to the server. + */ +static void +TekReadInput(LocalDevicePtr local) +{ + TekDevicePtr priv = (TekDevicePtr) local->private; + int len, loop; + int x, y, buttons, prox; + DeviceIntPtr device; + unsigned char buffer[10]; + + SYSCALL(len = xf86ReadSerial(local->fd, buffer, sizeof(buffer))); + + if (len <= 0) { + xf86Msg(X_ERROR,"Tek4957:Error while reading data stream\n"); + return; + } + + for(loop=0; loop<len; loop++) { + /* Tek4957 binary format : 8 characters + Byte 0 : + bit 0 : Proximity : 0=Near 1=Away + bit 6 : 1 : Synchro + Byte 1 : + bit 0 : Button 0 + bit 1 : Button 1 + bit 2 : Button 2 + bit 6 : 0 + Byte 2 : + bits 5-0 : X coord. [5:0] + bit 6 : 0 + Byte 3 : + bits 5-0 : X coord. [11:6] + bit 6 : 0 + Byte 4 : + bits 5-0 : X coord. [17:12] + bit 6 : 0 + Byte 5 : + bits 5-0 : Y coord. [5:0] + bit 6 : 0 + Byte 6 : + bits 5-0 : Y coord. [11:6] + bit 6 : 0 + Byte 7 : + bits 5-0 : Y coord. [17:12] + bit 6 : 0 + */ + + if ((priv->Index == 0) && !(buffer[loop] & 0x40)) /* Check synchro bit */ + continue; + + priv->Data[priv->Index++] = buffer[loop]; + + if (priv->Index == 8) { + priv->Index = 0; + prox = (priv->Data[0] & 1)? 0: 1; + buttons = (priv->Data[1] & 7); + x = (priv->Data[2]&0x3F)|((priv->Data[3]&0x3F)<<6) | ((priv->Data[4]&0x3F)<<12); + y = (priv->Data[5]&0x3F)|((priv->Data[6]&0x3F)<<6) | ((priv->Data[7]&0x3F)<<12); + + x -= priv->XOffset; + y -= priv->YOffset; + + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x > priv->XSize) x = priv->XSize; + if (y > priv->YSize) y = priv->YSize; + + device = local->dev; + if (prox) { + DBG(10,xf86Msg(X_INFO,"Tek4957:TekReadInput Proximity in X=%d Y=%d Buttons=%d\n",x,y,buttons)); + if (!(priv->LastProximity)) + xf86PostProximityEvent(device, 1, 0, 2, x, y); + if ( (priv->LastX != x) || (priv->LastY != y) ) + xf86PostMotionEvent(device,1, 0, 2, x, y); + if (priv->LastButtons != buttons) { + if ((priv->LastButtons&1)!=(buttons&1)) + xf86PostButtonEvent(device, 1,1,((buttons&1)>0), 0, 2, x, y); + if ((priv->LastButtons&2)!=(buttons&2)) + xf86PostButtonEvent(device, 1,2,((buttons&2)>0), 0, 2, x, y); + if ((priv->LastButtons&4)!=(buttons&4)) + xf86PostButtonEvent(device, 1,3,((buttons&4)>0), 0, 2, x, y); + } + priv->LastButtons = buttons; + priv->LastX = x; + priv->LastY = y; + priv->LastProximity = prox; + } else { /* Pointer away */ + DBG(10,xf86Msg(X_INFO,"Tek4957:TekReadInput Proximity out\n")); + if (priv->LastProximity) + xf86PostProximityEvent(device, 0, 0, 2, x, y); + priv->LastProximity = 0; + } + } + } + +} + +/* +** TekControlProc ( ??? ) +*/ +static void +TekControlProc(DeviceIntPtr device, PtrCtrl *ctrl) +{ +} + +/* + * TekOpen + * Open and initialize the tablet + */ +static Bool +TekOpen(LocalDevicePtr local) +{ + char Buffer[10]; + int err,i; + TekDevicePtr priv = (TekDevicePtr)local->private; + + DBG(4,xf86Msg(X_INFO,"Tek4957:TekOpen\n")); + + /* Write ESC Z : RESET */ + SYSCALL(err = xf86WriteSerial(local->fd,"\x1B" "Z" , 2)); + if (err == -1) { + xf86Msg(X_ERROR,"Tek4957:Write error\n"); + return !Success; + } + + /* Wait for 100 ms */ + err = xf86WaitForInput(-1, 100000); + + /* Clear garbage, if any */ + xf86FlushInput(local->fd); + + /* Write ESC x : Ask for status */ + SYSCALL(err = xf86WriteSerial(local->fd,"\x1B" "x" , 2)); + if (err == -1) { + xf86Msg(X_ERROR,"Tek4957:Write error\n"); + return !Success; + } + + /* Check read data */ + i=0; + while (i < 6) { + err = xf86WaitForInput(local->fd, 300000); + if (err == -1) { + xf86Msg(X_ERROR,"Tek4957:WaitForInput\n"); + return !Success; + } + if (!err) { + xf86Msg(X_ERROR,"Tek4957:Timeout while reading tablet. No tablet connected ???\n"); + return !Success; + } + SYSCALL(err = xf86ReadSerial(local->fd,&Buffer[i++], 1)); + if (err == -1) { + xf86Msg(X_ERROR,"Tek4957:Read error\n"); + return !Success; + } + if (!err) break; + } + + Buffer[i]=0; + + if ((Buffer[0] != '.') || (Buffer[1] != '#' )) { + xf86Msg(X_ERROR,"Tek4957:Tablet detection error %d [%s]\n",i,Buffer); + return !Success; + } + + /* Write ESC C [resolution] + ESC R [speed] */ + Buffer[0]='\x1B'; + Buffer[1]='C'; + Buffer[2]='0'+priv->Resmode; + Buffer[3]='\x1B'; + Buffer[4]='R'; + Buffer[5]='0'+priv->Speed; + SYSCALL(err = xf86WriteSerial(local->fd,Buffer, 6)); + if (err == -1) { + xf86Msg(X_ERROR,"Tek4957:Write error\n"); + return !Success; + } + + /* Write ESC F 3 : Up-Left origin + ESC I 0 0 1 : Emit data when movment + ESC M 0 : Emit when delta + */ + SYSCALL(err = xf86WriteSerial(local->fd,"\x1B""F3""\x1B""I001""\x1B""M0" , 11)); + if (err == -1) { + xf86Msg(X_ERROR,"Tek4957:Write error\n"); + return !Success; + } + + /* Flush garbage, if any */ + xf86FlushInput(local->fd); + + return Success; +} + +/* + * TekOpenDevice + */ +static Bool +TekOpenDevice(DeviceIntPtr pDev) +{ + LocalDevicePtr local = (LocalDevicePtr)pDev->public.devicePrivate; + TekDevicePtr priv = (TekDevicePtr)local->private; + + local->fd = xf86OpenSerial(local->options); + if (local->fd == -1) { + return !Success; + } + xf86Msg(X_INFO,"Tek4957:%s opened as fd %d\n", priv->Device, local->fd); + if (TekOpen(local) != Success) { + xf86Msg(X_ERROR,"Tek4957:Initialisation error\n"); + if (local->fd >= 0) { + SYSCALL(xf86CloseSerial(local->fd)); + } + local->fd = -1; + } else { + InitValuatorAxisStruct(pDev, + 0, + 0, /* min val */ + priv->XSize, /* max val in use */ + 20000, /* resolution dots per meter */ + 0, /* min_res */ + 20000); /* max_res */ + InitValuatorAxisStruct(pDev, + 1, + 0, /* min val */ + priv->YSize, /* max val in use */ + 20000, /* resolution, dots per meter */ + 0, /* min_res */ + 20000); /* max_res */ + xf86Msg(X_PROBED,"Tek4957:Initialisation completed\n"); + } + return (local->fd != -1); +} + + +/* +** TekProc +** Handle requests to do stuff to the driver. +*/ +static int +TekProc(DeviceIntPtr pDev, int what) +{ + CARD8 map[4]; + int loop; + LocalDevicePtr local = (LocalDevicePtr)pDev->public.devicePrivate; + TekDevicePtr priv = (TekDevicePtr)local->private; + + DBG(5,xf86Msg(X_INFO,"Tek4957:TekProc pDev=0x%x priv=0x%x what=%d\n", pDev, priv, what)); + + switch (what) { + case DEVICE_INIT: + DBG(2,xf86Msg(X_INFO,"Tek4957:TekProc pDev=0x%x priv=0x%x what=INIT\n", pDev, priv)); + if (priv->Init==1) break; /* already done */ + + for(loop=1; loop<=3; loop++) map[loop] = loop; + + if (InitButtonClassDeviceStruct(pDev,3,map) == FALSE) { + xf86Msg(X_ERROR,"Tek4957:Unable to allocate Button class device\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct(pDev) == FALSE) { + xf86Msg(X_ERROR,"Tek4957:Unable to init Focus class device\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(pDev,TekControlProc) == FALSE) { + xf86Msg(X_ERROR,"Tek4957:Unable to init ptr feedback\n"); + return !Success; + } + + if (InitProximityClassDeviceStruct(pDev) == FALSE) { + xf86Msg(X_ERROR,"Tek4957:Unable to init proximity class device\n"); + return !Success; + } + + if (InitValuatorClassDeviceStruct(pDev,2,xf86GetMotionEvents, + local->history_size,Absolute)== FALSE) { + xf86Msg(X_ERROR,"Tek4957:Unable to allocate Valuator class device\n"); + return !Success; + } + /* allocate the motion history buffer if needed */ + /* xf86MotionHistoryAllocate(local); */ + /* open the device to gather informations */ + TekOpenDevice(pDev); + priv->Init=1; + break; + + case DEVICE_ON: + DBG(2,xf86Msg(X_INFO,"Tek4957:TekProc pDev=0x%x priv=0x%x what=ON\n", pDev, priv)); + if (pDev->public.on) break; /* already on */ + + if ((local->fd < 0) && (!TekOpenDevice(pDev))) { + return !Success; + } + pDev->public.on = TRUE; + xf86AddEnabledDevice(local); + break; + + case DEVICE_OFF: + DBG(2,xf86Msg(X_INFO,"Tek4957:TekProc pDev=0x%x priv=0x%x what=OFF\n", pDev, priv)); + if (! pDev->public.on) break; /* already off */ + xf86RemoveEnabledDevice(local); + if (local->fd >= 0) + pDev->public.on = FALSE; + break; + + case DEVICE_CLOSE: + DBG(2,xf86Msg(X_INFO,"Tek4957:TekProc pDev=0x%x priv=0x%x what=CLOSE\n", pDev, priv)); + if (local->fd != -1) { + SYSCALL(xf86CloseSerial(local->fd)); + local->fd = -1; + } + break; + + default: + DBG(2,xf86Msg(X_INFO,"Tek4957:TekProc Unsupported mode=%d\n",what)); + return !Success; + break; + } + return Success; +} + +/* + * TekClose + */ +static void +TekClose(LocalDevicePtr local) +{ + DBG(2,xf86Msg(X_INFO,"Tek4957:TekClose local = %lx, ->fd = %d\n", local, local->fd)); + if (local->fd >= 0) { + xf86CloseSerial(local->fd); + } + local->fd = -1; +} + +/* +** TekChangeControl +*/ +static int +TekChangeControl(LocalDevicePtr local, xDeviceCtl* control) +{ + return(Success); +} + +/* +** TekSwitchMode +** Switches the mode. For now just absolute or relative, hopefully +** more on the way. +*/ +static int +TekSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ + return !Success; +} + +/* + * TekUninit -- + * + * called when the driver is unloaded. + */ +static void +TekUninit(InputDriverPtr drv, + LocalDevicePtr local, + int flags) +{ + TekDevicePtr priv = (TekDevicePtr) local->private; + + ErrorF("TekUninit\n"); + + TekProc(local->dev, DEVICE_OFF); + + xfree (priv); + xf86DeleteInput(local, 0); +} + +/* + * TekInit -- + * + * called when the module subsection is found in XF86Config + */ +static InputInfoPtr +TekInit(InputDriverPtr drv, + IDevPtr dev, + int flags) +{ + LocalDevicePtr local = NULL; + TekDevicePtr priv = NULL; + int min,max; + + tekDrv = drv; + + xf86Msg(X_INFO,"Tek4957:Allocating device...\n"); + + priv = xalloc(sizeof(TekDeviceRec)); + if (!priv) return NULL; + + local = xf86AllocateInput(tekDrv, 0); + if (!local) { + xfree(priv); + return NULL; + } + + local->name = "TEK4957"; + local->type_name = XI_TABLET; + local->flags = 0; + local->device_control = TekProc; + local->read_input = TekReadInput; + local->control_proc = TekChangeControl; + local->close_proc = TekClose; + local->switch_mode = TekSwitchMode; + local->conversion_proc = TekConvert; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->private_flags = 0; + local->history_size = 0; + local->old_x = -1; + local->old_y = -1; + +#if defined (sun) && !defined(i386) + char *dev_name; +#endif + +#if defined(sun) && !defined(i386) + if ((dev_name = getenv("TEK4957_DEV"))) { + priv->Device = xalloc(strlen(dev_name) + 1); + strcpy(priv->Device, dev_name); + xf86Msg(X_INFO,"Tek4957:Port selected : %s\n", priv->Device); + } else { + priv->Device = ""; + } +#else + priv->Device = ""; /* device file name */ +#endif + + local->conf_idev = dev; + + xf86CollectInputOptions(local, default_options, NULL); + xf86OptionListReport( local->options ); + + priv = (TekDevicePtr) local->private; + + local->name = dev->identifier; + + + /* Debug level */ +#ifdef DEBUG + debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); + if (debug_level > 0) { + xf86Msg(X_CONFIG, "Tek4957:Debug level set to %d\n", debug_level); + } +#endif + + /* Serial Device name is mandatory */ + priv->Device = xf86FindOptionValue(local->options, "Device"); + + if (!priv->Device) { + xf86Msg (X_ERROR, "Tek4957: %s: No Device specified.\n", dev->identifier); + goto SetupProc_fail; + } + + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + + /* Optional configuration */ + + xf86Msg(X_CONFIG, "Tek4957: %s: serial device is %s\n", dev->identifier, + priv->Device); + + /* Resolution */ + priv->Resmode = xf86SetIntOption (local->options,"Resolution",5); + priv->XMax=resol[priv->Resmode]; + priv->YMax=resol[priv->Resmode]; + if ((priv->Resmode<0)||(priv->Resmode>9)) { + xf86Msg(X_ERROR,"Tek4957: Invalid resolution specified. Using default\n"); + priv->Resmode=5; + priv->XMax=resol[priv->Resmode]; + priv->YMax=resol[priv->Resmode]; + } else { + xf86Msg(X_CONFIG,"Tek4957: Resolution [%d] = %d positions\n",priv->Resmode,priv->XMax); + } + + /* Speed */ + priv->Speed = xf86SetIntOption (local->options, "Speed", 6 ); + if ((priv->Speed<0)||(priv->Speed>6)) { + xf86Msg(X_ERROR,"Tek4957: Invalid speed specified. Using default\n"); + priv->Speed=5; + } else { + xf86Msg(X_CONFIG,"Tek4957: Speed = %d\n",priv->Speed); + } + + /* X bounds */ + min = xf86SetIntOption( local->options, "TopX", 0 ); + max = xf86SetIntOption( local->options, "BottomX",priv->XMax ); + if (((max-min)<=0)||(max>priv->XMax)||(min<0)) { + xf86Msg(X_ERROR,"Tek4957:Invalid X interval specified : TopX=%d, BottomX=%d\n",min,max); + min=0; max=priv->XMax; + } else { + xf86Msg(X_CONFIG,"Tek4957:X interval :TopX=%d, BottomX=%d\n",min,max); + } + + priv->XSize=max-min; + priv->XOffset=min; + + /* Y bounds */ + min = xf86SetIntOption( local->options, "TopY", 0 ); + max = xf86SetIntOption( local->options, "BottomY",priv->YMax ); + if (((max-min)<=0)||(max>priv->YMax)||(min<0)) { + xf86Msg(X_ERROR,"Tek4957:Invalid Y interval specified : TopY=%d, BottomY=%d\n",min,max); + min=0; max=priv->XMax; + } else { + xf86Msg(X_CONFIG,"Tek4957:Y interval :TopY=%d, BottomY=%d\n",min,max); + } + + priv->YSize=max-min; + priv->YOffset=min; + + priv->Index = 0; /* number of bytes read */ + priv->Init = 0; + priv->LastX = -1; /* previous X position */ + priv->LastY = -1; /* previous Y position */ + priv->LastProximity = 0; /* previous proximity */ + priv->LastButtons = 0; /* previous buttons state */ + + /* return the LocalDevice */ + local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED; + + return local; + + SetupProc_fail: + if (priv) + xfree(priv); + return local; +} + +#ifdef XFree86LOADER +static +#endif +InputDriverRec TEK4957 = { + 1, /* driver version */ + "tek4957", /* driver name */ + NULL, /* identify */ + TekInit, /* pre-init */ + TekUninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + + +/* + *************************************************************************** + * + * Dynamic loading functions + * + *************************************************************************** + */ +#ifdef XFree86LOADER +/* + * TekUnplug -- + * + * called when the module subsection is found in XF86Config + */ +static void +TekUnplug(pointer p) +{ +} + +/* + * TekPlug -- + * + * called when the module subsection is found in XF86Config + */ +static pointer +TekPlug(pointer module, + pointer options, + int *errmaj, + int *errmin) +{ + xf86AddInputDriver(&TEK4957, module, 0); + + return module; +} + +static XF86ModuleVersionInfo TekVersionRec = +{ + "tek4957", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by */ + /* a tool */ +}; + +XF86ModuleData tek4957ModuleData = {&TekVersionRec, + TekPlug, + TekUnplug}; + +#endif /* XFree86LOADER */ + +/* end of xf86Tek4957.c */ + Index: xc/programs/Xserver/hw/xfree86/input/ur98/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/ur98/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:09 2003 +++ xc/programs/Xserver/hw/xfree86/input/ur98/Imakefile Thu Nov 21 22:49:15 2002 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/ur98/Imakefile,v 1.1 2002/11/22 03:49:15 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86Ur-98.c +OBJS = xf86Ur-98.o + +DRIVER = ur98 + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input/linux) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input/linux) Index: xc/programs/Xserver/hw/xfree86/input/ur98/ur98.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/ur98/ur98.man:1.1 --- /dev/null Thu Feb 27 12:32:09 2003 +++ xc/programs/Xserver/hw/xfree86/input/ur98/ur98.man Thu Nov 21 22:49:15 2002 @@ -0,0 +1,131 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/ur98/ur98.man,v 1.1 2002/11/22 03:49:15 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH UR98 __drivermansuffix__ __vendorversion__ +.SH NAME +UR-98 \- UR98 (TR88L803) head tracker driver +.SH SYNOPSIS +.B "Section \*qInputDevice\*q" +.br +.BI " Identifier \*q" idevname \*q +.br +.B " Driver \*qUR-98\*q" +.br +.BI " Option \*qDevice\*q \*q" devpath \*q +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B UR-98 +is an XFree86 input driver for the Union Reality UR-F98 headtracker. +.PP +The +.B UR-98 +driver functions as a pointer input device, and can be used either as an +additional input device or as the X server's core pointer. The driver +provides support for the three axes, throttle and four buttons of the +controller. If mapped as the core pointer the headtracker provides +headtracking to try and place the mouse cursor where you look. As a +secondary input device the unit can be used for gaming, for example to +provide the look up/down and the turn in quake, and with the Z axis bound +to ack/forward to provide movement control. +.PP +The default mapping maps left-right movement to X, up-down movement to Y and +near/far movement to the Z axis. The throttle is mapped as the fourth axis +by default but can also be mapped as button 5. +.PP +For use in "head only" mode the Z axis can be mapped as a button. This +allows the user to select objects with head/neck movement alone but takes some +practice to use well. +.PP +.SH SUPPORTED HARDWARE +Union Reality UR-98. While this is a joystick driver the behaviour is +absolute so this driver is not useful for true joystick interfaces. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The following driver +.B options +are supported +.TP +.BI "Option \*qMinX\*q \*q" integer \*q +Set the left hand X value from the headgear, for calibration. +.TP +.BI "Option \*qMaxX\*q \*q" integer \*q +Set the right hand X value from the headgear, for calibration. +.TP +.BI "Option \*qMinY\*q \*q" integer \*q +Set the top Y value from the headgear, for calibration. +.TP +.BI "Option \*qMaxY\*q \*q" integer \*q +Set the bottom Y value from the headgear, for calibration. +.TP +.BI "Option \*qMinZ\*q \*q" integer \*q +Set the nearest Z value from the headgear, for calibration. +.TP +.BI "Option \*qMaxZ\*q \*q" integer \*q +Set the furthest Z value from the headgear, for calibration. +.TP +.BI "Option \*qMinT\*q \*q" integer \*q +Set the low throttle value from the headgear, for calibration. +.TP +.BI "Option \*qMaxT\*q \*q" integer \*q +Set the high throttle value from the headgear, for calibration. +.TP +.BI "Option \*qScreen\*q \*q" integer \*q +The screen to attach to the headgear when running with multiple screens. +The default is screen 0. +.TP +.BI "Option \*qDevice\*q \*q" string \*q +The joystick port that is attached to the headgear interface. This is +usually /dev/input/js0. The digital port is not supported due to lack of +documentation. +.TP +.BI "Option \*qDeviceName\*q \*q" string \*q +Set the X11 device name for the headgear. This defaults to HEAD. +.TP +.BI "Option \*qPortraitMode\*q \*q" string \*q +Set the display orientation. The default is "landscape" but you can rotate +the screen clockwise ("portrait") or anticlockwise ("portraitCCW"). +.TP +.BI "Option \*qSwapXY\*q \*q" boolean \*q +Swap the X and Y values on the display. The default is false. +.TP +.BI "Option \*qButton5\*q \*q" boolean \*q +Map the throttle as a button instead of axis 4. For some gaming applications +this can be more useful. The default is to map the throttle as axis 4. +.TP +.BI "Option \*qHeadButton\*q \*q" boolean \*q +Map the Z axis as button 1. This defaults to false. +.TP +.BI "Option \*qHeadThresh\*q \*q" boolean \*q +Set the distance that is held to be mouse down. +.TP +.BI "Option \*qHeadLock\*q \*q" boolean \*q +Set the range of depth around the mouse down point where mouse x and y +movement is locked out. Set to zero to disable. +.SH "BUGS" +The "HeadButton" option is currently not implemented. +.PP +The hardware or kernel driver has some idiosyncracies. Notably on +kernel initialization the interface occasionally gets into a state where the +readings rapidly cycle left-right-left-right or top-bottom-top-bottom. +In those cases it seems to be neccessary to unload the driver, unplug, +replug and reload the joystick drivers. Once it initializes sanely it +remains sane. +.PP +If the device refuses to work check the gray/black cables are plugged into +the right ports on the unit. Be careful about this as crossing the cables +can lead to the device failing with a nasty burning electronics smell. The +author writes from direct experience. +.PP +This driver is currently Linux specific. +.PP +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... + Alan Cox Index: xc/programs/Xserver/hw/xfree86/input/ur98/xf86Ur-98.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/ur98/xf86Ur-98.c:1.1 --- /dev/null Thu Feb 27 12:32:09 2003 +++ xc/programs/Xserver/hw/xfree86/input/ur98/xf86Ur-98.c Thu Nov 21 22:49:15 2002 @@ -0,0 +1,721 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/ur98/xf86Ur-98.c,v 1.1 2002/11/22 03:49:15 dawes Exp $ */ + +#include <sys/types.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#define inline __inline__ +#include <linux/joystick.h> + +#undef BUS_ISA +#undef BUS_PCI + +#include <fcntl.h> +#include <sys/ioctl.h> +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" +#include "os.h" + +#ifdef XFree86LOADER +#include "xf86Module.h" +#endif + +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL +}; + + + +/* + *************************************************************************** + * + * Default constants. + * + *************************************************************************** + */ + +#define DEFAULT_MAX_X 32768 +#define DEFAULT_MIN_X 0 +#define DEFAULT_MAX_Y 65535 +#define DEFAULT_MIN_Y 0 +#define DEFAULT_MAX_Z 65535 +#define DEFAULT_MIN_Z 0 +#define DEFAULT_MAX_T 65535 +#define DEFAULT_MIN_T 0 + +#define DEFAULT_HEAD_THRESH 38000 +#define DEFAULT_HEAD_LOCK 450 + +#define XI_STYLUS "HEAD" /* X device name for the head tracking device */ + + +/* + *************************************************************************** + * + * Device private records. + * + *************************************************************************** + */ + +typedef struct _UR98PrivateRec { + char *input_dev; /* The head screen input device */ + int min_x; /* Minimum x reported by calibration */ + int max_x; /* Maximum x */ + int min_y; /* Minimum y reported by calibration */ + int max_y; /* Maximum y */ + int min_z; /* Minimum z */ + int max_z; /* Maximum z */ + int min_t; /* Minimum t */ + int max_t; /* Maximum t */ + int cur_x; /* Current x */ + int cur_y; /* Current y */ + int cur_z; /* Current z */ + int cur_t; /* Current t */ + int axes; /* Number of axes */ + int button_5; /* True if axis 4 is remapped as button5 */ + int buttons[5]; /* Button status */ + int screen_no; /* Screen associated with the device */ + int screen_width; /* Width of the associated X screen */ + int screen_height; /* Height of the screen */ + Bool inited; /* The controller has already been configured ? */ + char state; /* Current state of report flags. */ + LocalDevicePtr head; /* Device ptr associated with the hw. */ + int swap_axes; /* Swap X an Y axes if != 0 */ + int head_button; /* Z is button 0, cur_z is holds true cur_t */ + int head_lock; /* Lock for x/y in head_button mode */ + int head_thresh; /* Threshhold for Z as button down */ +} UR98PrivateRec, *UR98PrivatePtr; + + +/* + *************************************************************************** + * + * xf86UR98Convert -- + * Convert extended valuators to x and y suitable for core motion + * events. Return True if ok and False if the requested conversion + * can't be done for the specified valuators. + * + *************************************************************************** + */ +static Bool xf86UR98Convert(LocalDevicePtr local, int first, int num, + int v0,int v1,int v2,int v3, int v4, int v5, int *x, int *y) +{ + UR98PrivatePtr priv = (UR98PrivatePtr) local->private; + int width = priv->max_x - priv->min_x; + int height = priv->max_y - priv->min_y; + int input_x, input_y; + int tmp; + + input_x = v0; + input_y = v1; + + if (priv->swap_axes) { + tmp = input_x; + input_x = input_y; + input_y = tmp; + } + *x = (priv->screen_width * (input_x - priv->min_x)) / width; + *y = (priv->screen_height * (input_y - priv->min_y)) / height; + /* + * Need to check if still on the correct screen. + * This call is here so that this work can be done after + * calib and before posting the event. + */ + xf86XInputSetScreen(local, priv->screen_no, *x, *y); + return TRUE; +} + +static void UR98PtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl) +{ + /* I have no clue what this does, except that registering it stops the + X server segfaulting in ProcGetPointerMapping() + Ho Hum. + */ +} + +static void xf86UR98ReadInput(LocalDevicePtr local) +{ + UR98PrivatePtr priv = (UR98PrivatePtr)(local->private); + struct js_event event; + int one=1; + + ioctl(local->fd, FIONBIO, &one); + + while(read(local->fd, &event, sizeof(event))==sizeof(event)) + { + if(event.type & JS_EVENT_BUTTON) + { + /* Shift the buttons if Z is button 1 */ + event.number += priv->head_button; + if(priv->buttons[event.number] != event.value) + { + priv->buttons[event.number] = event.value; + xf86PostButtonEvent(priv->head->dev, TRUE, event.number + 1, event.value, + 0, priv->axes, priv->cur_x, priv->cur_y, priv->cur_z, priv->cur_t); + } + } + if(event.type & JS_EVENT_AXIS) + { + int lock = 0; + + if(priv->head_lock) + { + lock = priv->cur_t - priv->head_thresh; + ErrorF("Lock %d\n", lock); + if(lock < -priv->head_lock || lock > priv->head_lock) + lock = 0; + else + lock = priv->head_button; + } + + switch(event.number) + { + case 0: + if(!lock) + priv->cur_x = event.value+32768; + break; + case 1: + if(!lock) + priv->cur_y = event.value+32768; + break; + case 2: + if(priv->button_5 == 0) + { + /* We use cur_z to hold cur_t in + head button mode. Hackish but saves + a lot of conditional code elsewhere */ + if(priv->head_button) + priv->cur_z = event.value + 32768; + else + priv->cur_t = event.value +32768; + } + else + { + if(event.value > 0) + event.value = 1; + else + event.value = 0; + if(priv->buttons[4] != event.value) + { + priv->buttons[4] = event.value; + xf86PostButtonEvent(priv->head->dev, TRUE, 4, event.value, + 0, priv->axes, priv->cur_x, priv->cur_y, priv->cur_z, priv->cur_t); + } + } + case 3: + if(priv->head_button == 0) + priv->cur_z = event.value+32768; + else + { + ErrorF("Head at %d\n", event.value + 32768); + priv->cur_t = event.value+32768; + /* Low is near... */ + if(priv->cur_t < priv->head_thresh) + event.value = 1; + else + event.value = 0; + if(priv->buttons[0] != event.value) + { + priv->buttons[0] = event.value; + xf86PostButtonEvent(priv->head->dev, TRUE, 1, event.value, + 0, priv->axes, priv->cur_x, priv->cur_y, priv->cur_z, priv->cur_t); + } + } + break; + } + xf86PostMotionEvent(priv->head->dev, TRUE, 0, priv->axes, priv->cur_x, priv->cur_y, priv->cur_z, priv->cur_t); + } + } +} + + +/* + *************************************************************************** + * + * xf86UR98Control -- + * + *************************************************************************** + */ +static Bool +xf86UR98Control(DeviceIntPtr dev, + int mode) +{ + static unsigned char map[] = { 0, 1, 2, 3, 4, 5}; + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + UR98PrivatePtr priv = (UR98PrivatePtr)(local->private); + + switch(mode) + { + + case DEVICE_INIT: + if (priv->screen_no >= screenInfo.numScreens || priv->screen_no < 0) { + priv->screen_no = 0; + } + priv->screen_width = screenInfo.screens[priv->screen_no]->width; + priv->screen_height = screenInfo.screens[priv->screen_no]->height; + + /* + * Device reports button press for up to 5 buttons. + */ + if (InitButtonClassDeviceStruct(dev, 4 + priv->button_5, map) == FALSE) { + ErrorF("Unable to allocate ButtonClassDeviceStruct\n"); + return !Success; + } + + /* + * Device reports motions on 3 axes in absolute coordinates. + * Axes min and max values are reported in raw coordinates. + * Resolution is computed roughly by the difference between + * max and min values scaled from the approximate size of the + * screen to fit one meter. + */ + + if (InitValuatorClassDeviceStruct(dev, priv->axes, xf86GetMotionEvents, + local->history_size, Absolute) == FALSE) { + ErrorF("Unable to allocate ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + InitValuatorAxisStruct(dev, 0, priv->min_x, priv->max_x, + 65535, + 0 /* min_res */, + 65535 /* max_res */); + InitValuatorAxisStruct(dev, 1, priv->min_y, priv->max_y, + 65535, /* resolution */ + 0 /* min_res */, + 65535 /* max_res */); + if(priv->axes > 2) + { + if(priv->head_button) + { + /* In head button mode we skip the Z axis */ + InitValuatorAxisStruct(dev, 2, priv->min_t, priv->max_t, + 65535, /* resolution */ + 0 /* min_res */, + 65535 /* max_res */); + } + else + { + InitValuatorAxisStruct(dev, 2, priv->min_z, priv->max_z, + 65535, /* resolution */ + 0 /* min_res */, + 65535 /* max_res */); + } + } + if(priv->axes > 3) + InitValuatorAxisStruct(dev, 3, priv->min_t, priv->max_t, + 65535, /* resolution */ + 0 /* min_res */, + 65535 /* max_res */); + } + + if (InitFocusClassDeviceStruct(dev) == FALSE) { + ErrorF("Unable to allocate FocusClassDeviceStruct\n"); + } + + if(InitPtrFeedbackClassDeviceStruct(dev, UR98PtrCtrl) == FALSE) { + ErrorF("Unable to allocate PtrFeedBackClassDeviceStruct\n"); + } + + /* + * Allocate the motion events buffer. + */ + + xf86MotionHistoryAllocate(local); + + return Success; + + case DEVICE_ON: + if (local->fd < 0) { + char c; + int ver; + + local->fd = open(priv->input_dev, O_RDONLY|O_NDELAY); + if (local->fd < 0) { + ErrorF("Unable to open UR98 headtracker device\n"); + return !Success; + } + if(ioctl(local->fd, JSIOCGVERSION, &ver)==-1) + { + ErrorF("Unable to query headtracker interface version\n"); + return !Success; + } + if(ioctl(local->fd, JSIOCGAXES, &c)==-1) + { + ErrorF("Unable to query headtracker parameters\n"); + return !Success; + } + if(c!=4) + { + ErrorF("Device is not a UR-98\n"); + return !Success; + } + if(ioctl(local->fd, JSIOCGBUTTONS, &c)==-1) + { + ErrorF("Unable to query headtracker parameters\n"); + return !Success; + } + if(c!=4) + { + ErrorF("Device is not a UR-98\n"); + return !Success; + } + AddEnabledDevice(local->fd); + } + dev->public.on = TRUE; + return Success; + + case DEVICE_OFF: + dev->public.on = FALSE; + return Success; + + case DEVICE_CLOSE: + dev->public.on = FALSE; + if (local->fd >= 0) { + xf86RemoveEnabledDevice(local); + close(local->fd); + local->fd = -1; + } + return Success; + default: + ErrorF("unsupported mode=%d\n", mode); + return !Success; + } +} + +/* + *************************************************************************** + * + * xf86UR98ControlProc -- + * + *************************************************************************** + */ + +static int xf86UR98ControlProc (InputInfoPtr pInfo, xDeviceCtl * control) +{ + return (Success); +} + +/* + *************************************************************************** + * + * xf86UR98Allocate -- + * + *************************************************************************** + */ +static LocalDevicePtr xf86UR98Allocate(InputDriverPtr drv, char *name, char *type_name, int flag) +{ + LocalDevicePtr local = xf86AllocateInput(drv, 0); + UR98PrivatePtr priv = (UR98PrivatePtr) xalloc(sizeof(UR98PrivateRec)); + int i; + + if (!local || !priv) + { + if(priv) + xfree(priv); + if(local) + xfree(local); + return NULL; + } + + priv->input_dev = strdup("/dev/js0"); + priv->min_x = 0; + priv->max_x = 0; + priv->min_y = 0; + priv->max_y = 0; + priv->min_z = 0; + priv->max_z = 0; + priv->min_t = 0; + priv->max_t = 0; + priv->button_5 = 0; + priv->axes = 4; + priv->screen_no = 0; + priv->screen_width = -1; + priv->screen_height = -1; + priv->inited = 0; + priv->state = 0; + priv->swap_axes = 0; + for(i = 0; i < 5; i++) + priv->buttons[i] = 0; + priv->head_button = 0; + priv->head_thresh = 0; + priv->head_lock = 0; + + local->name = name; + local->flags = 0 /* XI86_NO_OPEN_ON_INIT */; + local->device_control = xf86UR98Control; + local->read_input = xf86UR98ReadInput; + local->control_proc = xf86UR98ControlProc; + local->close_proc = NULL; + local->switch_mode = NULL; + local->conversion_proc = xf86UR98Convert; + local->reverse_conversion_proc = NULL; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->private_flags = flag; + local->type_name = type_name; + local->history_size = 0; + + return local; +} + + +/* + *************************************************************************** + * + * xf86UR98AllocateHeadTracker -- + * + *************************************************************************** + */ +static LocalDevicePtr xf86UR98AllocateHeadTracker(InputDriverPtr drv) +{ + LocalDevicePtr local = xf86UR98Allocate(drv, XI_STYLUS, "UR98 HeadTracker", 1); + if (local) + ((UR98PrivatePtr) local->private)->head = local; + return local; +} + + +static void xf86UR98Uninit(InputDriverPtr drv, LocalDevicePtr local, int flags) +{ + UR98PrivatePtr priv = (UR98PrivatePtr) local->private; + + xf86UR98Control(local->dev, DEVICE_OFF); + + if (priv) { + priv->head->private = NULL; + xfree(priv->input_dev); + xfree(priv); + } + xfree(local->name); + xfree(local); + + xf86DeleteInput(local, 0); +} + +static InputInfoPtr xf86UR98Init(InputDriverPtr drv, IDevPtr dev, int flags) +{ + LocalDevicePtr local=NULL; + UR98PrivatePtr priv=NULL; + char *str; + int portrait=0; + + + local = xf86UR98AllocateHeadTracker(drv); + priv = local->private; + local->conf_idev = dev; + + xf86CollectInputOptions(local, NULL, NULL); + + str = xf86FindOptionValue(local->options, "Device"); + if (!str) { + xf86Msg(X_ERROR, "%s: No Device specified in UR98 module config.\n", dev->identifier); + goto init_err; + } + priv->input_dev = strdup(str); + priv->head = local; + + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + + str = xf86FindOptionValue(local->options, "DeviceName"); + if (str) { + local->name = strdup(str); + } + xf86Msg(X_CONFIG, "UR98 X device name: %s\n", local->name); + priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", 0); + xf86Msg(X_CONFIG, "UR98 associated screen: %d\n", priv->screen_no); + priv->max_x = xf86SetIntOption(local->options, "MaxX", DEFAULT_MAX_X); + xf86Msg(X_CONFIG, "UR98 maximum x position: %d\n", priv->max_x); + priv->min_x = xf86SetIntOption(local->options, "MinX", DEFAULT_MIN_X); + xf86Msg(X_CONFIG, "UR98 minimum x position: %d\n", priv->min_x); + priv->max_y = xf86SetIntOption(local->options, "MaxY", DEFAULT_MAX_Y); + xf86Msg(X_CONFIG, "UR98 maximum y position: %d\n", priv->max_y); + priv->min_y = xf86SetIntOption(local->options, "MinY", DEFAULT_MIN_Y); + xf86Msg(X_CONFIG, "UR98 minimum y position: %d\n", priv->min_y); + priv->max_z = xf86SetIntOption(local->options, "MaxZ", DEFAULT_MAX_Z); + xf86Msg(X_CONFIG, "UR98 maximum z position: %d\n", priv->max_z); + priv->min_z = xf86SetIntOption(local->options, "MinZ", DEFAULT_MIN_Z); + xf86Msg(X_CONFIG, "UR98 minimum z position: %d\n", priv->min_z); + priv->max_t = xf86SetIntOption(local->options, "MaxT", DEFAULT_MAX_T); + xf86Msg(X_CONFIG, "UR98 maximum z position: %d\n", priv->max_t); + priv->min_t = xf86SetIntOption(local->options, "MinT", DEFAULT_MIN_T); + xf86Msg(X_CONFIG, "UR98 minimum z position: %d\n", priv->min_t); + priv->head_button = xf86SetBoolOption(local->options, "HeadButton", 0); + if(priv->head_button) + xf86Msg(X_CONFIG, "UR98 head proximity acts as button 1\n"); + priv->head_thresh = xf86SetIntOption(local->options, "HeadButton", DEFAULT_HEAD_THRESH); + if(priv->head_button) + xf86Msg(X_CONFIG, "UR98 proximity threshhold %d\n", priv->head_thresh); + if(priv->head_button) + { + priv->head_lock = xf86SetIntOption(local->options, "HeadLock", DEFAULT_HEAD_LOCK); + xf86Msg(X_CONFIG, "UR98 proximity lock range %d\n", priv->head_thresh); + } + priv->button_5 = xf86SetBoolOption(local->options, "Button5", 0); + if(priv->button_5) + xf86Msg(X_CONFIG, "UR98 throttle mapped as button 5\n"); + priv->swap_axes = xf86SetBoolOption(local->options, "SwapXY", 0); + if (priv->swap_axes) { + xf86Msg(X_CONFIG, "UR98 %s device will work with X and Y axes swapped\n", + local->name); + } + str = xf86SetStrOption(local->options, "PortraitMode", "Landscape"); + if (strcmp(str, "Portrait") == 0) { + portrait = 1; + } + else if (strcmp(str, "PortraitCCW") == 0) { + portrait = -1; + } + else if (strcmp(str, "Landscape") != 0) { + xf86Msg(X_ERROR, "UR98 portrait mode should be: Portrait, Landscape or PortraitCCW"); + str = "Landscape"; + } + xf86Msg(X_CONFIG, "UR98 device will work in %s mode\n", str); + + if (priv->max_x - priv->min_x <= 0) { + xf86Msg(X_INFO, "UR98: reverse x mode (minimum x position >= maximum x position)\n"); + } + if (priv->max_y - priv->min_y <= 0) { + xf86Msg(X_INFO, "UR98: reverse y mode (minimum y position >= maximum y position)\n"); + } + + if (portrait == 1) { + /* + * Portrait Clockwise: reverse Y axis and exchange X and Y. + */ + int tmp; + tmp = priv->min_y; + priv->min_y = priv->max_y; + priv->max_y = tmp; + priv->swap_axes = (priv->swap_axes==0) ? 1 : 0; + } + else if (portrait == -1) { + /* + * Portrait Counter Clockwise: reverse X axis and exchange X and Y. + */ + int tmp; + tmp = priv->min_x; + priv->min_x = priv->max_x; + priv->max_x = tmp; + priv->swap_axes = (priv->swap_axes==0) ? 1 : 0; + } + + /* If we have button_5 set then we lose the 't' axis */ + if(priv->button_5) + priv->axes = 3; + else + priv->axes = 4; + + /* If we have head_button set then we lose the 'z' axis */ + if(priv->head_button) + priv->axes--; + + xf86ProcessCommonOptions(local, local->options); + + /* mark the device configured */ + local->flags |= XI86_CONFIGURED; + return local; + +init_err: + if (priv) { + if (priv->input_dev) + xfree(priv->input_dev); + xfree(priv); + } + if (local) + xfree(local); + return NULL; +} + +#ifdef XFree86LOADER +static +#endif +InputDriverRec UR98 = { + 1, /* driver version */ + "ur98", /* driver name */ + NULL, /* identify */ + xf86UR98Init, /* pre-init */ + xf86UR98Uninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + +#ifdef XFree86LOADER +static pointer Plug(pointer module, pointer options, int *errmaj,int *errmin) +{ + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&UR98, module, 0); + return module; +} + +static void Unplug(pointer p) +{ +} + +static XF86ModuleVersionInfo version_rec = { + "ur98", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + { 0, 0, 0, 0 } +}; + +/* + * This is the entry point in the module. The name + * is setup after the pattern <module_name>ModuleData. + * Do not change it. + */ +XF86ModuleData ur98ModuleData = { &version_rec, Plug, Unplug }; +#endif + Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c diff -u xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.30 xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.32 --- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.30 Wed Dec 26 16:51:59 2001 +++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c Tue Jan 14 22:48:36 2003 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.30 2001/12/26 21:51:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.32 2003/01/15 03:48:36 dawes Exp $ */ /* * This driver is only able to handle the Wacom IV and Wacom V protocols. @@ -90,7 +90,7 @@ #include "xf86Module.h" #endif -#define wait_for_fd(fd) xf86WaitForInput((fd), 1000) +#define wait_for_fd(fd) xf86WaitForInput((fd), 1000000) #define tcflush(fd, n) xf86FlushInput((fd)) #undef read #define read(a,b,c) xf86ReadSerial((a),(b),(c)) @@ -1994,7 +1994,7 @@ /* Extract version numbers */ sscanf(buffer+loop+1, "%f", &version); - if (buffer[2] == 'G' && buffer[3] == 'D') { + if ((buffer[2] == 'G' || buffer[2] == 'X') && buffer[3] == 'D') { DBG(2, ErrorF("detected an Intuos model\n")); common->wcmProtocolLevel = 5; common->wcmMaxZ = 1023; /* max Z value */ Index: xc/programs/Xserver/hw/xfree86/int10/Imakefile diff -u xc/programs/Xserver/hw/xfree86/int10/Imakefile:1.14 xc/programs/Xserver/hw/xfree86/int10/Imakefile:1.16 --- xc/programs/Xserver/hw/xfree86/int10/Imakefile:1.14 Sat Oct 27 23:33:59 2001 +++ xc/programs/Xserver/hw/xfree86/int10/Imakefile Mon Sep 16 14:06:08 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.14 2001/10/28 03:33:59 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.16 2002/09/16 18:06:08 eich Exp $ /* An OS-independent INT10 module/library */ @@ -35,10 +35,11 @@ X86EMUDEFINES = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG -# if defined(i386Architecture) +XCOMM Check the x86_64Architecture +# if defined(i386Architecture) || defined(x86_64Architecture) ARCHDEFINES = -D_PC # elif defined(ia64Architecture) -ARCHDEFINES = -D_PC_IO -D_PC_PCI +/* ARCHDEFINES = -D_PC_IO -D_PC_PCI */ # elif defined(SparcArchitecture) || defined(PpcArchitecture) ARCHDEFINES = -D__BIG_ENDIAN__ # endif Index: xc/programs/Xserver/hw/xfree86/int10/generic.c diff -u xc/programs/Xserver/hw/xfree86/int10/generic.c:1.23 xc/programs/Xserver/hw/xfree86/int10/generic.c:1.25 --- xc/programs/Xserver/hw/xfree86/int10/generic.c:1.23 Mon May 28 10:21:56 2001 +++ xc/programs/Xserver/hw/xfree86/int10/generic.c Thu Apr 4 09:05:51 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.23 2001/05/28 14:21:56 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.25 2002/04/04 14:05:51 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -7,7 +7,6 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" -#include "xf86Pci.h" #include "compiler.h" #define _INT10_PRIVATE #include "xf86int10.h" @@ -32,6 +31,7 @@ int entries; void* base; void* vRam; + int highMemory; void* sysMem; char* alloc; } genericInt10Priv; @@ -49,24 +49,36 @@ static void MapVRam(xf86Int10InfoPtr pInt); static void UnmapVRam(xf86Int10InfoPtr pInt); +#ifdef _PC +#define GET_HIGH_BASE(x) (((V_BIOS + size + getpagesize() - 1)/getpagesize()) \ + * getpagesize()) +#endif static void *sysMem = NULL; - xf86Int10InfoPtr xf86InitInt10(int entityIndex) { + return xf86ExtendedInitInt10(entityIndex, 0); +} + +xf86Int10InfoPtr +xf86ExtendedInitInt10(int entityIndex, int Flags) +{ xf86Int10InfoPtr pInt; - int screen; void* base = 0; void* vbiosMem = 0; void* options = NULL; + pciVideoPtr pvp; + int screen; legacyVGARec vga; xf86int10BiosLocation bios; #ifdef _PC + int size; CARD32 cs; #endif + screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; options = xf86HandleInt10Options(xf86Screens[screen],entityIndex); @@ -86,6 +98,9 @@ pInt->scrnIndex = screen; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); + pvp = xf86GetPciInfoForEntity(entityIndex); + if (pvp) pInt->Tag = ((pciConfigPtr)(pvp->thisCard))->tag; + /* * we need to map video RAM MMIO as some chipsets map mmio * registers into this range. @@ -93,7 +108,8 @@ MapVRam(pInt); #ifdef _PC if (!sysMem) - sysMem = xf86MapVidMem(screen, VIDMEM_FRAMEBUFFER, SYS_BIOS, BIOS_SIZE); + sysMem = xf86MapVidMem(screen, VIDMEM_FRAMEBUFFER, V_BIOS, + BIOS_SIZE + SYS_BIOS - V_BIOS); INTPriv(pInt)->sysMem = sysMem; if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) { @@ -107,23 +123,33 @@ * 64kB at a time. */ (void)memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS); +#if 0 for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) if (xf86ReadBIOS(cs, 0, (unsigned char *)base + cs, V_BIOS_SIZE) < V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x%06X.\n", cs); - + "Unable to retrieve all of segment 0x%06X.\n", cs); +#endif + INTPriv(pInt)->highMemory = V_BIOS; + xf86int10ParseBiosLocation(options,&bios); if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) { - + if (bios.bus == BUS_ISA && bios.location.legacy) { xf86DrvMsg(screen, X_CONFIG, "Overriding BIOS location: 0x%lx\n", bios.location.legacy); cs = bios.location.legacy >> 4; - vbiosMem = (unsigned char *)base + (cs << 4); +#define CHECK_V_SEGMENT_RANGE(x) \ + if ((x << 4) < V_BIOS) {\ + xf86DrvMsg(screen, X_ERROR, \ + "V_BIOS address 0x%x out of range\n",x << 4); \ + goto error1; \ + } + CHECK_V_SEGMENT_RANGE(cs); + vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4); if (!int10_check_bios(screen, cs, vbiosMem)) { xf86DrvMsg(screen, X_ERROR, "No V_BIOS at specified address 0x%x\n",cs << 4); @@ -139,14 +165,15 @@ } cs = MEM_RW(pInt,((0x10<<2)+2)); - - vbiosMem = (unsigned char *)base + (cs << 4); + CHECK_V_SEGMENT_RANGE(cs); + vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4); if (!int10_check_bios(screen, cs, vbiosMem)) { cs = MEM_RW(pInt, (0x42 << 2) + 2); - vbiosMem = (unsigned char *)base + (cs << 4); + CHECK_V_SEGMENT_RANGE(cs); + vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4); if (!int10_check_bios(screen, cs, vbiosMem)) { cs = V_BIOS >> 4; - vbiosMem = (unsigned char *)base + (cs << 4); + vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4); if (!int10_check_bios(screen, cs, vbiosMem)) { xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n"); goto error1; @@ -159,6 +186,12 @@ set_return_trap(pInt); pInt->BIOSseg = cs; + + pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); + if (! (pInt->Flags & SET_BIOS_SCRATCH)) + pInt->Flags &= ~RESTORE_BIOS_SCRATCH; + xf86Int10SaveRestoreBIOSVars(pInt, TRUE); + } else { BusType location_type; int bios_location = V_BIOS; @@ -190,22 +223,23 @@ } else location_type = pEnt->location.type; - vbiosMem = (unsigned char *)base + bios_location; - switch (location_type) { case BUS_PCI: + vbiosMem = (unsigned char *)base + bios_location; if (bios.bus == BUS_PCI) pci_entity = xf86GetPciEntity(bios.location.pci.bus, bios.location.pci.dev, bios.location.pci.func); else pci_entity = pInt->entityIndex; - if (!mapPciRom(pci_entity,(unsigned char *)(vbiosMem))) { + if (!(size = mapPciRom(pci_entity,(unsigned char *)(vbiosMem)))) { xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); goto error1; } + INTPriv(pInt)->highMemory = GET_HIGH_BASE(size); break; case BUS_ISA: + vbiosMem = (unsigned char *)sysMem + bios_location; #if 0 (void)memset(vbiosMem, 0, V_BIOS_SIZE); if (xf86ReadBIOS(bios_location, 0, vbiosMem, V_BIOS_SIZE) @@ -223,9 +257,9 @@ xfree(pEnt); pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); + LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); + UnlockLegacyVGA(pInt, &vga); } #else if (!sysMem) { @@ -243,12 +277,15 @@ */ vbiosMem = (char *)base + V_BIOS; (void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE); - if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE) + if (xf86ReadDomainMemory(pInt->Tag, V_BIOS, V_BIOS_SIZE, vbiosMem) < + V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x0C0000.\n"); - else if (((unsigned char *)vbiosMem)[2] > 0x80) - if (xf86ReadBIOS(V_BIOS + V_BIOS_SIZE, 0, - (unsigned char *)vbiosMem + V_BIOS_SIZE, V_BIOS_SIZE) < V_BIOS_SIZE) + else if ((((unsigned char *)vbiosMem)[0] == 0x55) && + (((unsigned char *)vbiosMem)[1] == 0xAA) && + (((unsigned char *)vbiosMem)[2] > 0x80)) + if (xf86ReadDomainMemory(pInt->Tag, V_BIOS + V_BIOS_SIZE, V_BIOS_SIZE, + (unsigned char *)vbiosMem + V_BIOS_SIZE) < V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x0D0000.\n"); @@ -302,9 +339,9 @@ pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); + LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); + UnlockLegacyVGA(pInt, &vga); #endif xfree(options); return pInt; @@ -324,11 +361,13 @@ static void MapVRam(xf86Int10InfoPtr pInt) { - int screen = pInt->scrnIndex; int pagesize = getpagesize(); - int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; + int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize; + + INTPriv(pInt)->vRam = xf86MapDomainMemory(pInt->scrnIndex, VIDMEM_MMIO, + pInt->Tag, V_RAM, size); - INTPriv(pInt)->vRam = xf86MapVidMem(screen, VIDMEM_MMIO, V_RAM, size); + pInt->ioBase = xf86Screens[pInt->scrnIndex]->domainIOBase; } static void @@ -353,6 +392,9 @@ { if (!pInt) return; +#if defined (_PC) + xf86Int10SaveRestoreBIOSVars(pInt, FALSE); +#endif if (Int10Current == pInt) Int10Current = NULL; xfree(INTPriv(pInt)->base); @@ -402,10 +444,15 @@ } #define OFF(addr) ((addr) & 0xffff) -#define SYS(addr) ((addr) >= SYS_BIOS) +#if defined _PC +# define HIGH_OFFSET (INTPriv(pInt)->highMemory) +#else +# define HIGH_OFFSET SYS_BIOS +#endif +# define SYS(addr) ((addr) >= HIGH_OFFSET) #define V_ADDR(addr) \ - (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \ - : ((char*)(INTPriv(pInt)->base) + addr)) + (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_OFFSET) \ + : (((char*)(INTPriv(pInt)->base) + addr))) #define VRAM_ADDR(addr) (addr - V_RAM) #define VRAM_BASE (INTPriv(pInt)->vRam) Index: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c diff -u xc/programs/Xserver/hw/xfree86/int10/helper_exec.c:1.16 xc/programs/Xserver/hw/xfree86/int10/helper_exec.c:1.24 --- xc/programs/Xserver/hw/xfree86/int10/helper_exec.c:1.16 Mon Apr 30 10:34:57 2001 +++ xc/programs/Xserver/hw/xfree86/int10/helper_exec.c Mon Nov 25 16:05:49 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.16 2001/04/30 14:34:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.24 2002/11/25 21:05:49 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -14,11 +14,11 @@ * in xf86EnableIO(). Otherwise we won't trap * on PIO. */ + #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "compiler.h" -#include "xf86Pci.h" #define _INT10_PRIVATE #include "int10Defines.h" #include "xf86int10.h" @@ -27,6 +27,9 @@ static int pciCfg1in(CARD16 addr, CARD32 *val); static int pciCfg1out(CARD16 addr, CARD32 val); #endif +#if defined (_PC) +static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set); +#endif #define REG pInt @@ -52,7 +55,10 @@ X86_FS = 0; X86_GS = 0; X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK; - +#if defined (_PC) + if (pInt->flags & SET_BIOS_SCRATCH) + SetResetBIOSVars(pInt, TRUE); +#endif return xf86BlockSIGIO(); } @@ -60,15 +66,19 @@ finish_int(xf86Int10InfoPtr pInt, int sig) { xf86UnblockSIGIO(sig); - pInt->ax = (CARD16) X86_EAX; - pInt->bx = (CARD16) X86_EBX; - pInt->cx = (CARD16) X86_ECX; - pInt->dx = (CARD16) X86_EDX; - pInt->si = (CARD16) X86_ESI; - pInt->di = (CARD16) X86_EDI; + pInt->ax = (CARD32) X86_EAX; + pInt->bx = (CARD32) X86_EBX; + pInt->cx = (CARD32) X86_ECX; + pInt->dx = (CARD32) X86_EDX; + pInt->si = (CARD32) X86_ESI; + pInt->di = (CARD32) X86_EDI; pInt->es = (CARD16) X86_ES; - pInt->bp = (CARD16) X86_EBP; - pInt->flags = (CARD16) X86_FLAGS; + pInt->bp = (CARD32) X86_EBP; + pInt->flags = (CARD32) X86_FLAGS; +#if defined (_PC) + if (pInt->flags & RESTORE_BIOS_SCRATCH) + SetResetBIOSVars(pInt, FALSE); +#endif } /* general software interrupt handler */ @@ -92,8 +102,23 @@ #ifndef _PC /* check if bios vector is initialized */ if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/ - ErrorF("Card BIOS on non-PC like platform not loaded\n"); - return 0; + + if (num == 21 && X86_AH == 0x4e) { + xf86DrvMsg(pInt->scrnIndex, X_NOTICE, + "Failing Find-Matching-File on non-PC" + " (int 21, func 4e)\n"); + X86_AX = 2; + SET_FLAG(F_CF); + return 1; + } else { + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "Ignoring int 0x%02x call\n", num); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + return 1; + } } #endif #ifdef PRINT_INT @@ -293,7 +318,7 @@ } #endif /* __NOT_YET__ */ } else { - val = inb(port); + val = inb(Int10Current->ioBase + port); #ifdef PRINT_PORT ErrorF(" inb(%#x) = %2.2x\n", port, val); #endif @@ -315,7 +340,7 @@ (void)getsecs(&sec, &usec); val = (CARD16)(usec / 3); } else { - val = inw(port); + val = inw(Int10Current->ioBase + port); } #ifdef PRINT_PORT ErrorF(" inw(%#x) = %4.4x\n", port, val); @@ -352,7 +377,7 @@ #ifdef PRINT_PORT ErrorF(" outb(%#x, %2.2x)\n", port, val); #endif - outb(port, val); + outb(Int10Current->ioBase + port, val); } } @@ -363,7 +388,7 @@ ErrorF(" outw(%#x, %4.4x)\n", port, val); #endif - outw(port, val); + outw(Int10Current->ioBase + port, val); } CARD32 @@ -374,7 +399,7 @@ #if !defined(_PC) && !defined(_PC_PCI) if (!pciCfg1in(port, &val)) #endif - val = inl(port); + val = inl(Int10Current->ioBase + port); #ifdef PRINT_PORT ErrorF(" inl(%#x) = %8.8x\n", port, val); @@ -392,41 +417,41 @@ #if !defined(_PC) && !defined(_PC_PCI) if (!pciCfg1out(port, val)) #endif - outl(port, val); + outl(Int10Current->ioBase + port, val); } CARD8 -Mem_rb(int addr) +Mem_rb(CARD32 addr) { return (*Int10Current->mem->rb)(Int10Current, addr); } CARD16 -Mem_rw(int addr) +Mem_rw(CARD32 addr) { return (*Int10Current->mem->rw)(Int10Current, addr); } CARD32 -Mem_rl(int addr) +Mem_rl(CARD32 addr) { return (*Int10Current->mem->rl)(Int10Current, addr); } void -Mem_wb(int addr, CARD8 val) +Mem_wb(CARD32 addr, CARD8 val) { (*Int10Current->mem->wb)(Int10Current, addr, val); } void -Mem_ww(int addr, CARD16 val) +Mem_ww(CARD32 addr, CARD16 val) { (*Int10Current->mem->ww)(Int10Current, addr, val); } void -Mem_wl(int addr, CARD32 val) +Mem_wl(CARD32 addr, CARD32 val) { (*Int10Current->mem->wl)(Int10Current, addr, val); } @@ -495,27 +520,84 @@ * doing int10. */ void -LockLegacyVGA(int screenIndex,legacyVGAPtr vga) +LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) +{ + xf86SetCurrentAccess(FALSE, xf86Screens[pInt->scrnIndex]); + vga->save_msr = inb(pInt->ioBase + 0x03CC); + vga->save_vse = inb(pInt->ioBase + 0x03C3); +#ifndef __ia64__ + vga->save_46e8 = inb(pInt->ioBase + 0x46E8); +#endif + vga->save_pos102 = inb(pInt->ioBase + 0x0102); + outb(pInt->ioBase + 0x03C2, ~(CARD8)0x03 & vga->save_msr); + outb(pInt->ioBase + 0x03C3, ~(CARD8)0x01 & vga->save_vse); +#ifndef __ia64__ + outb(pInt->ioBase + 0x46E8, ~(CARD8)0x08 & vga->save_46e8); +#endif + outb(pInt->ioBase + 0x0102, ~(CARD8)0x01 & vga->save_pos102); + xf86SetCurrentAccess(TRUE, xf86Screens[pInt->scrnIndex]); +} + +void +UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) +{ + xf86SetCurrentAccess(FALSE, xf86Screens[pInt->scrnIndex]); + outb(pInt->ioBase + 0x0102, vga->save_pos102); +#ifndef __ia64__ + outb(pInt->ioBase + 0x46E8, vga->save_46e8); +#endif + outb(pInt->ioBase + 0x03C3, vga->save_vse); + outb(pInt->ioBase + 0x03C2, vga->save_msr); + xf86SetCurrentAccess(TRUE, xf86Screens[pInt->scrnIndex]); +} + +#if defined (_PC) +static void +SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set) { - xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]); - vga->save_msr = inb(0x3CC); - vga->save_vse = inb(0x3C3); - vga->save_46e8 = inb(0x46e8); - vga->save_pos102 = inb(0x102); - outb(0x3C2, ~(CARD8)0x03 & vga->save_msr); - outb(0x3C3, ~(CARD8)0x01 & vga->save_vse); - outb(0x46e8, ~(CARD8)0x08 & vga->save_46e8); - outb(0x102, ~(CARD8)0x01 & vga->save_pos102); - xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]); + int pagesize = getpagesize(); + unsigned char* base = xf86MapVidMem(pInt->scrnIndex, + VIDMEM_MMIO, 0, pagesize); + int i; + + if (set) { + for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++) + MEM_WW(pInt, i, *(base + i)); + } else { + for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++) + *(base + i) = MEM_RW(pInt, i); + } + + xf86UnMapVidMem(pInt->scrnIndex,base,pagesize); } void -UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga) -{ - xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]); - outb(0x102, vga->save_pos102); - outb(0x46e8, vga->save_46e8); - outb(0x3C3, vga->save_vse); - outb(0x3C2, vga->save_msr); - xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]); +xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save) +{ + int pagesize = getpagesize(); + unsigned char* base; + int i; + + if (!xf86IsEntityPrimary(pInt->entityIndex) + || (!save && !pInt->BIOSScratch)) + return; + + base = xf86MapVidMem(pInt->scrnIndex, VIDMEM_MMIO, 0, pagesize); + base += BIOS_SCRATCH_OFF; + if (save) { + if ((pInt->BIOSScratch + = xnfalloc(BIOS_SCRATCH_LEN))) + for (i = 0; i < BIOS_SCRATCH_LEN; i++) + *(((char*)pInt->BIOSScratch + i)) = *(base + i); + } else { + if (pInt->BIOSScratch) { + for (i = 0; i < BIOS_SCRATCH_LEN; i++) + *(base + i) = *(pInt->BIOSScratch + i); + xfree(pInt->BIOSScratch); + pInt->BIOSScratch = NULL; + } + } + + xf86UnMapVidMem(pInt->scrnIndex,base - BIOS_SCRATCH_OFF ,pagesize); } +#endif Index: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c diff -u xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.21 xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.26 --- xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.21 Tue May 22 12:24:37 2001 +++ xc/programs/Xserver/hw/xfree86/int10/helper_mem.c Mon Nov 25 09:05:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.21 2001/05/22 16:24:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.26 2002/11/25 14:05:01 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -10,7 +10,9 @@ #include "compiler.h" #include "xf86Pci.h" #define _INT10_PRIVATE +#if 0 #include "int10Defines.h" +#endif #include "xf86int10.h" #define REG pInt @@ -197,8 +199,8 @@ /* Check if xf86CollectOptions() has already been called */ if (((pEnt->index < 0) || - !xf86Screens[pEnt->index] || - !(configOptions = xf86Screens[pEnt->index]->options)) && + !pScrn || + !(configOptions = pScrn->options)) && pEnt->device) configOptions = pEnt->device->options; @@ -264,6 +266,14 @@ return initPrimary; } +/* + * xf86int10ParseBiosLocation(): allows to set the location of the + * BIOS. One may select a BIOS of another card for posting or the + * legacy V_BIOS range located at 0xc0000 or an alternative address + * (BUS_ISA). + * This is only useful under very special circumstances and should + * be used with extreme care. + */ void xf86int10ParseBiosLocation(void* options, xf86int10BiosLocationPtr bios) @@ -281,9 +291,9 @@ s = xstrdup(str); p = strtok(s,":"); - if (xf86NameCmp(p,"pci")) bios->bus = BUS_PCI; + if (xf86NameCmp(p,"pci") == 0) bios->bus = BUS_PCI; else - if (xf86NameCmp(p,"primary")) bios->bus = BUS_ISA; + if (xf86NameCmp(p,"primary") == 0) bios->bus = BUS_ISA; xfree(s); Index: xc/programs/Xserver/hw/xfree86/int10/pci.c diff -u xc/programs/Xserver/hw/xfree86/int10/pci.c:1.11 xc/programs/Xserver/hw/xfree86/int10/pci.c:1.12 --- xc/programs/Xserver/hw/xfree86/int10/pci.c:1.11 Mon Oct 1 09:44:13 2001 +++ xc/programs/Xserver/hw/xfree86/int10/pci.c Thu Apr 4 09:05:51 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.11 2001/10/01 13:44:13 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.12 2002/04/04 14:05:51 eich Exp $ */ /* * XFree86 int10 module @@ -33,7 +33,6 @@ /* Read in entire PCI ROM */ mem = ptr = xnfcalloc(length, 1); length = xf86ReadPciBIOS(0, tag, -1, ptr, length); - if (length > 0) memcpy(address, ptr, length); /* unmap/close/disable PCI bios mem */ Index: xc/programs/Xserver/hw/xfree86/int10/stub.c diff -u xc/programs/Xserver/hw/xfree86/int10/stub.c:1.3 xc/programs/Xserver/hw/xfree86/int10/stub.c:1.4 --- xc/programs/Xserver/hw/xfree86/int10/stub.c:1.3 Mon Apr 30 10:34:57 2001 +++ xc/programs/Xserver/hw/xfree86/int10/stub.c Thu Apr 4 09:05:51 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/stub.c,v 1.3 2001/04/30 14:34:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/stub.c,v 1.4 2002/04/04 14:05:51 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -12,6 +12,12 @@ xf86Int10InfoPtr xf86InitInt10(int entityIndex) +{ + return xf86ExtendedInitInt10(entityIndex, 0); +} + +xf86Int10InfoPtr +xf86ExtendedInitInt10(int entityIndex, int Flags) { return NULL; } Index: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c diff -u xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.8 xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.10 --- xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.8 Mon Oct 1 09:44:13 2001 +++ xc/programs/Xserver/hw/xfree86/int10/xf86int10.c Mon Nov 25 09:05:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.8 2001/10/01 13:44:13 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.10 2002/11/25 14:05:01 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -8,7 +8,6 @@ #include "xf86.h" #include "xf86_ansic.h" #include "compiler.h" -#include "xf86Pci.h" #define _INT10_PRIVATE #include "xf86int10.h" #include "int10Defines.h" @@ -22,7 +21,7 @@ static int int42_handler(xf86Int10InfoPtr pInt); #endif static int intE6_handler(xf86Int10InfoPtr pInt); -static PCITAG findPci(unsigned short bx); +static PCITAG findPci(xf86Int10InfoPtr pInt, unsigned short bx); static CARD32 pciSlotBX(pciVideoPtr pvp); int @@ -82,8 +81,9 @@ /* Leave: Nothing */ /* Implemented (except for clearing the screen) */ { /* Localise */ + IOADDRESS ioport; int i; - CARD16 ioport, int1d, regvals, tmp; + CARD16 int1d, regvals, tmp; CARD8 mode, cgamode, cgacolour; /* @@ -169,6 +169,9 @@ /* Rows */ MEM_WB(pInt, 0x0484, (25 - 1)); + /* Remap I/O port number into its domain */ + ioport += pInt->ioBase; + /* Programme the mode */ outb(ioport + 4, cgamode & 0x37); /* Turn off screen */ for (i = 0; i < 0x10; i++) { @@ -188,7 +191,7 @@ /* Leave: Nothing */ /* Implemented */ { /* Localise */ - CARD16 ioport = MEM_RW(pInt, 0x0463); + IOADDRESS ioport = MEM_RW(pInt, 0x0463) + pInt->ioBase; MEM_WB(pInt, 0x0460, X86_CL); MEM_WB(pInt, 0x0461, X86_CH); @@ -208,7 +211,8 @@ /* Leave: Nothing */ /* Implemented */ { /* Localise */ - CARD16 offset, ioport; + IOADDRESS ioport; + CARD16 offset; MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL); MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH); @@ -219,7 +223,7 @@ offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL; offset += MEM_RW(pInt, 0x044E) << 1; - ioport = MEM_RW(pInt, 0x0463); + ioport = MEM_RW(pInt, 0x0463) + pInt->ioBase; outb(ioport, 0x0E); outb(ioport + 1, offset >> 8); outb(ioport, 0x0F); @@ -269,7 +273,8 @@ /* Leave: Nothing */ /* Implemented */ { /* Localise */ - CARD16 start, ioport = MEM_RW(pInt, 0x0463); + IOADDRESS ioport = MEM_RW(pInt, 0x0463) + pInt->ioBase; + CARD16 start; CARD8 x, y; /* Calculate new start address */ @@ -418,7 +423,7 @@ /* Leave: Nothing */ /* Implemented */ { /* Localise */ - CARD16 ioport = MEM_RW(pInt, 0x0463) + 5; + IOADDRESS ioport = MEM_RW(pInt, 0x0463) + 5 + pInt->ioBase; CARD8 cgacolour = MEM_RB(pInt, 0x0466); if (X86_BH) { @@ -659,7 +664,7 @@ #endif return 1; case 0xb108: - if ((tag = findPci(X86_EBX))) { + if ((tag = findPci(pInt, X86_EBX))) { X86_CL = pciReadByte(tag, X86_EDI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ @@ -672,7 +677,7 @@ #endif return 1; case 0xb109: - if ((tag = findPci(X86_EBX))) { + if ((tag = findPci(pInt, X86_EBX))) { X86_CX = pciReadWord(tag, X86_EDI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ @@ -685,7 +690,7 @@ #endif return 1; case 0xb10a: - if ((tag = findPci(X86_EBX))) { + if ((tag = findPci(pInt, X86_EBX))) { X86_ECX = pciReadLong(tag, X86_EDI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ @@ -698,7 +703,7 @@ #endif return 1; case 0xb10b: - if ((tag = findPci(X86_EBX))) { + if ((tag = findPci(pInt, X86_EBX))) { pciWriteByte(tag, X86_EDI, X86_CL); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ @@ -711,7 +716,7 @@ #endif return 1; case 0xb10c: - if ((tag = findPci(X86_EBX))) { + if ((tag = findPci(pInt, X86_EBX))) { pciWriteWord(tag, X86_EDI, X86_CX); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ @@ -724,7 +729,7 @@ #endif return 1; case 0xb10d: - if ((tag = findPci(X86_EBX))) { + if ((tag = findPci(pInt, X86_EBX))) { pciWriteLong(tag, X86_EDI, X86_ECX); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ @@ -747,9 +752,9 @@ } static PCITAG -findPci(unsigned short bx) +findPci(xf86Int10InfoPtr pInt, unsigned short bx) { - int bus = (bx >> 8) & 0xFF; + int bus = ((pInt->Tag >> 16) & ~0x00FF) | ((bx >> 8) & 0x00FF); int dev = (bx >> 3) & 0x1F; int func = bx & 0x7; if (xf86IsPciDevPresent(bus, dev, func)) @@ -760,7 +765,7 @@ static CARD32 pciSlotBX(pciVideoPtr pvp) { - return (pvp->bus << 8) | (pvp->device << 3) | (pvp->func); + return ((pvp->bus << 8) & 0x00FF00) | (pvp->device << 3) | (pvp->func); } /* Index: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h diff -u xc/programs/Xserver/hw/xfree86/int10/xf86int10.h:1.21 xc/programs/Xserver/hw/xfree86/int10/xf86int10.h:1.24 --- xc/programs/Xserver/hw/xfree86/int10/xf86int10.h:1.21 Tue May 15 06:19:41 2001 +++ xc/programs/Xserver/hw/xfree86/int10/xf86int10.h Tue Jul 23 10:22:46 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.21 2001/05/15 10:19:41 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.24 2002/07/23 14:22:46 tsi Exp $ */ /* * XFree86 int10 module @@ -11,10 +11,14 @@ #include "Xmd.h" #include "Xdefs.h" +#include "xf86Pci.h" #define SEG_ADDR(x) (((x) >> 4) & 0x00F000) #define SEG_OFF(x) ((x) & 0x0FFFF) +#define SET_BIOS_SCRATCH 0x1 +#define RESTORE_BIOS_SCRATCH 0x2 + /* int10 info structure */ typedef struct { int entityIndex; @@ -22,6 +26,8 @@ pointer cpuRegs; CARD16 BIOSseg; CARD16 inb40time; + char * BIOSScratch; + int Flags; pointer private; struct _int10Mem* mem; int num; @@ -35,6 +41,8 @@ int bp; int flags; int stackseg; + PCITAG Tag; + IOADDRESS ioBase; } xf86Int10InfoRec, *xf86Int10InfoPtr; typedef struct _int10Mem { @@ -67,6 +75,7 @@ /* OS dependent functions */ xf86Int10InfoPtr xf86InitInt10(int entityIndex); +xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags); void xf86FreeInt10(xf86Int10InfoPtr pInt); void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off); void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num); @@ -90,6 +99,9 @@ #define VRAM_SIZE 0x20000 #define V_BIOS_SIZE 0x10000 #define V_BIOS 0xC0000 +#define BIOS_SCRATCH_OFF 0x449 +#define BIOS_SCRATCH_END 0x466 +#define BIOS_SCRATCH_LEN (BIOS_SCRATCH_END - BIOS_SCRATCH_OFF + 1) #define HIGH_MEM V_BIOS #define HIGH_MEM_SIZE (SYS_BIOS - HIGH_MEM) #define SEG_ADR(type, seg, reg) type((seg << 4) + (X86_##reg)) @@ -132,8 +144,11 @@ void stack_trace(xf86Int10InfoPtr pInt); xf86Int10InfoPtr getInt10Rec(int entityIndex); CARD8 bios_checksum(CARD8 *start, int size); -void LockLegacyVGA(int screenIndex, legacyVGAPtr vga); -void UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga); +void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga); +void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga); +#if defined (_PC) +void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save); +#endif int port_rep_inb(xf86Int10InfoPtr pInt, CARD16 port, CARD32 base, int d_f, CARD32 count); int port_rep_inw(xf86Int10InfoPtr pInt, @@ -154,12 +169,12 @@ CARD32 x_inl(CARD16 port); void x_outl(CARD16 port, CARD32 val); -CARD8 Mem_rb(int addr); -CARD16 Mem_rw(int addr); -CARD32 Mem_rl(int addr); -void Mem_wb(int addr, CARD8 val); -void Mem_ww(int addr, CARD16 val); -void Mem_wl(int addr, CARD32 val); +CARD8 Mem_rb(CARD32 addr); +CARD16 Mem_rw(CARD32 addr); +CARD32 Mem_rl(CARD32 addr); +void Mem_wb(CARD32 addr, CARD8 val); +void Mem_ww(CARD32 addr, CARD16 val); +void Mem_wl(CARD32 addr, CARD32 val); /* helper_mem.c */ void setup_int_vect(xf86Int10InfoPtr pInt); Index: xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c diff -u xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c:1.1 xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c:1.2 --- xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c:1.1 Sat Jan 22 23:44:35 2000 +++ xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c Mon Sep 16 14:06:09 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c,v 1.1 2000/01/23 04:44:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10module.c,v 1.2 2002/09/16 18:06:09 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -12,11 +12,22 @@ #ifdef XFree86LOADER -static MODULESETUPPROTO(int10Setup); -static XF86ModuleVersionInfo int10VersRec = +#ifndef MOD_NAME +# define MOD_NAME int10 +#endif + +#define stringify(x) #x +#define STRING(x) stringify(x) +#define concat(x,y) x ## y +#define combine(a,b) concat(a,b) +#define NAME(x) combine(MOD_NAME,x) + +static MODULESETUPPROTO(NAME(Setup)); + +static XF86ModuleVersionInfo NAME(VersRec) = { - "int10", + STRING(NAME( )), MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, @@ -28,10 +39,10 @@ {0,0,0,0} }; -XF86ModuleData int10ModuleData = { &int10VersRec, int10Setup, NULL }; +XF86ModuleData NAME(ModuleData) = { &NAME(VersRec), NAME(Setup), NULL }; static pointer -int10Setup(pointer module, pointer opts, int *errmaj, int *errmin) +NAME(Setup)(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; @@ -50,4 +61,3 @@ } #endif - Index: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c diff -u xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c:1.11 xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c:1.13 --- xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c:1.11 Mon Apr 30 10:34:58 2001 +++ xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c Mon Sep 16 14:06:09 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.11 2001/04/30 14:34:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.13 2002/09/16 18:06:09 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -48,21 +48,21 @@ int i; X86EMU_intrFuncs intFuncs[256]; X86EMU_pioFuncs pioFuncs = { - (u8(*)(u16))x_inb, - (u16(*)(u16))x_inw, - (u32(*)(u16))x_inl, - (void(*)(u16, u8))x_outb, - (void(*)(u16, u16))x_outw, - (void(*)(u16, u32))x_outl + (&x_inb), + (&x_inw), + (&x_inl), + (&x_outb), + (&x_outw), + (&x_outl) }; X86EMU_memFuncs memFuncs = { - (u8(*)(u32))Mem_rb, - (u16(*)(u32))Mem_rw, - (u32(*)(u32))Mem_rl, - (void(*)(u32, u8))Mem_wb, - (void(*)(u32, u16))Mem_ww, - (void(*)(u32, u32))Mem_wl + (&Mem_rb), + (&Mem_rw), + (&Mem_rl), + (&Mem_wb), + (&Mem_ww), + (&Mem_wl) }; X86EMU_setupMemFuncs(&memFuncs); Index: xc/programs/Xserver/hw/xfree86/loader/Imakefile diff -u xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.29 xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.35 --- xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.29 Fri Nov 16 11:47:55 2001 +++ xc/programs/Xserver/hw/xfree86/loader/Imakefile Wed Feb 26 18:32:12 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.29 2001/11/16 16:47:55 dawes Exp $ */ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.35 2003/02/26 23:32:12 dawes Exp $ */ @@ -30,12 +30,20 @@ SHM_DEFINES = -DHAS_SHM #endif +#if HasGlibc21Sigsetjmp + SETJMPDEFINES = -DHAS_GLIBC_SIGSETJMP=1 +#endif + +#if defined (x86_64Architecture) +ARCHDEFINES = -DDoMMAPedMerge -DMmapPageAlign +#endif + DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OS_DEFINES) $(COMPAT_DEFINES) \ - $(SHM_DEFINES) + $(SHM_DEFINES) $(ARCHDEFINES) MODULEDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" - INCLUDES = -I. -I.. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86OSSRC)/vbe \ + INCLUDES = -I. -I.. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86SRC)/vbe \ -I$(SERVERSRC)/dbe -I$(SERVERSRC)/Xext -I$(XF86SRC)/int10 \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ -I$(SERVERSRC)/os -I$(XINCLUDESRC) -I$(FONTINCSRC) \ @@ -69,7 +77,7 @@ NormalLibraryTarget(xloader,$(XOBJS) ) SpecialCObjectRule(loadmod,NullParameter,$(MODULEDEFINES) $(EXT_DEFINES)) -SpecialCObjectRule(xf86sym,NullParameter,$(EXT_DEFINES)) +SpecialCObjectRule(xf86sym,NullParameter,$(EXT_DEFINES) $(SETJMPDEFINES)) SpecialCObjectRule(dixsym,NullParameter,$(EXT_DEFINES)) #ifdef SparcArchitecture Index: xc/programs/Xserver/hw/xfree86/loader/README diff -u xc/programs/Xserver/hw/xfree86/loader/README:1.4 xc/programs/Xserver/hw/xfree86/loader/README:removed --- xc/programs/Xserver/hw/xfree86/loader/README:1.4 Tue Apr 8 10:54:33 1997 +++ xc/programs/Xserver/hw/xfree86/loader/README Thu Feb 27 12:32:10 2003 @@ -1,107 +0,0 @@ - -This README file describes the design and idea behind the loadable module -code for XFree86. This code is based of code that was developed by Metro Link -and donated to The XFree86 Project. - -<at this point we should include the design document as written by Stuart> - -Debugging this code is somewhat dificult as gdb will not be able to step -through loaded modules in source mode. The functions - -LoaderPrintSymbol( address ) -LoaderPrintAddress( symbol ) - -are provided to allow easy orientation in the loaded module. Most problems -stem from global functions and variables that are not exported from other -modules or the main server executable, but are referenced in a module. -All global variables should be put in ScreenPrivates or other container -objects, that are driver specific. This will solve the biggest problem -cleanly and at the same time provide an important step towards multi headed -servers. - -More documentation on the design and implementation should be added here. - -Specific comments to some design ideas and the state of the code - -- Init Function - -every module has its init function, which has the name ModuleInit. -When loading the module this function is repeatedly called with two pointers -(one to a magic value, one to a data element) until it returns a magic value -indicating that it is done. Currently the magic values support several -actions: - -magic data points to - -MAGIC_ADD_VIDEO_CHIP_REC the videoChipRec to be added to the list - of drivers - -MAGIC_LOAD the name of the module to load - -MAGIC_CCD_DO_BITBLT the do_bitblt function for the current - color depth - -MAGIC_CCD_SCREEN_PRIV_IDX the ScreenPrivIdx for the current color depth - -MAGIC_CCD_XAA_SCREEN_INIT the XaaScreenInit function for the current - color depth - -MAGIC_PEX_INIT -MAGIC_XIE_INIT init functions of extensions - -MAGIC_DONT_CHECK_UNRESOLVED checking for unresolved symbols will be delayed - for one step until LoaderCheckUnresolved() - is called with LD_RESOLV_NOW the same number of - times than MAGIC_DONT_CHECK_UNRESOLVED - has been passed before. - -MAGIC_DONE nothing; side effect is to stop looping - -- mixed color depths - -the current code has various cross dependencies on cfb8, libvga256, and all -higher depths cfbs as well as all the xaa modules. These need to be -straightened out (this has been started but is far from done). -We basically need a redesigned server to solve these issues cleanly. - -- unresolved functions - -the current code has one 'minor' flaw. When checking unresolved symbols -we reference quite a few things from the cfb libraries that we did not -pull in. Since these functions are never called, this doesn't really -matter, but it is uggly, obviously. - -Changing all this to use function pointers and initializing all of -them sounds like the clean solution, but I'm wondering if it wasn't -better to define a default function that is bound to all unresolved -symbols and prints out that there was a problem with resolving symbols -and makes the server exit gracefully. This would be a reasonable -default behaviour and would allow to keep dangling references to -functions that are known not to be called. - -This "elegant hack" has been implemented for the Elf loader, but better -solutions are welcome. - -- OS support - -Currently this has been tested on Linux, it should work on SVR4. This -code needs to be ported to the other operating systems XFree86 supports. - -- finding modules - -ModulePath can contain several entries of directories that contain modules. -Modules can be implicitly or explicitly loaded. To load a module explicitly -you have to include it in the Module Section. Load "name" tries to find -name, name.o, name_drv.o, or name.a in any of the directories given in the -ModulePath or in the subdirectories drivers, extensions, internal under these -directories. Normally the chipset drivers should be implemented in a way that -they implicitly load all other core modules needed by this driver. - ----------------------------------------------------------------------- - -Last updated Feb 25, 1997, Dirk H. Hohndel <hohndel@XFree86.Org> - - - - -$XFree86: xc/programs/Xserver/hw/xfree86/loader/README,v 1.4 1997/04/08 14:54:33 hohndel Exp $ Index: xc/programs/Xserver/hw/xfree86/loader/aout.h diff -u xc/programs/Xserver/hw/xfree86/loader/aout.h:1.6 xc/programs/Xserver/hw/xfree86/loader/aout.h:1.7 --- xc/programs/Xserver/hw/xfree86/loader/aout.h:1.6 Thu Apr 29 05:13:47 1999 +++ xc/programs/Xserver/hw/xfree86/loader/aout.h Fri May 31 14:46:00 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/aout.h,v 1.6 1999/04/29 09:13:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/aout.h,v 1.7 2002/05/31 18:46:00 dawes Exp $ */ /* * Borrowed from NetBSD's exec_aout.h @@ -41,7 +41,7 @@ #include <ctype.h> /* OS/2 EMX has ntohl in this file */ -#ifdef __EMX__ +#ifdef __UNIXOS2__ #include <sys/param.h> #endif Index: xc/programs/Xserver/hw/xfree86/loader/coffloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.17 xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.18 --- xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.17 Mon Dec 17 15:00:44 2001 +++ xc/programs/Xserver/hw/xfree86/loader/coffloader.c Mon Sep 16 14:06:10 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.17 2001/12/17 20:00:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.18 2002/09/16 18:06:10 eich Exp $ */ /* * @@ -1139,7 +1139,7 @@ ".stab.", strlen(".stab.") ) == 0 ) { continue; } - ErrorF("Not loading %s\n", cofffile->sections[i].s_name ); + ErrorF("COFF: Not loading %s\n", cofffile->sections[i].s_name ); } } Index: xc/programs/Xserver/hw/xfree86/loader/dixsym.c diff -u xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.45 xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.53 --- xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.45 Sat Nov 17 11:05:59 2001 +++ xc/programs/Xserver/hw/xfree86/loader/dixsym.c Sun Jan 26 11:40:42 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.45 2001/11/17 16:05:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.53 2003/01/26 16:40:42 eich Exp $ */ /* @@ -56,6 +56,13 @@ #ifdef RENDER #include "mipict.h" #endif +#include "selection.h" +#ifdef XKB +#include <X11/extensions/XKBsrv.h> +#endif + +extern Selection *CurrentSelections; +extern int NumCurrentSelections; /* DIX things */ @@ -85,6 +92,8 @@ SYMFUNC(InitPtrFeedbackClassDeviceStruct) SYMFUNC(InitValuatorClassDeviceStruct) SYMFUNC(InitKeyClassDeviceStruct) + SYMFUNC(InitKeyboardDeviceStruct) + SYMFUNC(SendMappingNotify) /* dispatch.c */ SYMFUNC(SetInputCheck) SYMFUNC(SendErrorToClient) @@ -95,6 +104,8 @@ SYMVAR(isItTimeToYield) SYMVAR(ClientStateCallback) SYMVAR(ServerGrabCallback) + SYMVAR(CurrentSelections) + SYMVAR(NumCurrentSelections) /* dixfonts.c */ SYMFUNC(CloseFont) SYMFUNC(FontToXError) @@ -115,8 +126,10 @@ SYMFUNC(QueueWorkProc) SYMFUNC(RegisterBlockAndWakeupHandlers) SYMFUNC(RemoveBlockAndWakeupHandlers) +#ifdef XCSECURITY SYMFUNC(SecurityLookupDrawable) SYMFUNC(SecurityLookupWindow) +#endif /* events.c */ SYMFUNC(CheckCursorConfinement) SYMFUNC(DeliverEvents) @@ -128,6 +141,9 @@ SYMVAR(EventCallback) SYMVAR(inputInfo) SYMVAR(SetCriticalEvent) +#ifdef PANORAMIX + SYMVAR(XineramaGetCursorScreen) +#endif /* property.c */ SYMFUNC(ChangeWindowProperty) /* extension.c */ @@ -210,8 +226,18 @@ SYMFUNC(LookupIDByType) SYMFUNC(LookupIDByClass) SYMFUNC(LegalNewID) +#ifdef XCSECURITY SYMFUNC(SecurityLookupIDByClass) SYMFUNC(SecurityLookupIDByType) +#endif + SYMFUNC(FindClientResourcesByType) + SYMFUNC(FindAllClientResources) + SYMVAR(lastResourceType) + SYMVAR(TypeMask) +#ifdef RES + SYMFUNC(RegisterResourceName) + SYMVAR(ResourceNames) +#endif /* swaprep.c */ SYMFUNC(CopySwap32Write) SYMFUNC(Swap32Write) @@ -259,6 +285,7 @@ SYMFUNC(ErrorF) SYMFUNC(FatalError) SYMFUNC(Xstrdup) + SYMFUNC(XNFstrdup) SYMVAR(Must_have_memory) /* xalloc.c */ SYMFUNC(XNFalloc) @@ -296,6 +323,14 @@ SYMFUNC(InitPointerDeviceStruct) SYMFUNC(LookupKeyboardDevice) SYMFUNC(LookupPointerDevice) + +#ifdef XKB + /* xkb/xkbInit.c */ + SYMFUNC(XkbInitKeyboardDeviceStruct) + SYMFUNC(XkbSetRulesDflts) + SYMVAR(noXkbExtension) +#endif + #ifdef XINPUT /* Xi */ /* exevents.c */ @@ -317,7 +352,15 @@ SYMFUNC(miGlyphs) SYMFUNC(miCompositeRects) SYMVAR(PictureScreenPrivateIndex) + SYMFUNC(PictureTransformPoint) + SYMFUNC(PictureAddFilter) + SYMFUNC(PictureSetFilterAlias) + SYMFUNC(PictureGetSubpixelOrder) + SYMFUNC(PictureSetSubpixelOrder) #endif + + /* os/utils.c */ + SYMFUNC(GiveUp) { 0, 0 }, Index: xc/programs/Xserver/hw/xfree86/loader/elf.h diff -u xc/programs/Xserver/hw/xfree86/loader/elf.h:1.12 xc/programs/Xserver/hw/xfree86/loader/elf.h:1.15 --- xc/programs/Xserver/hw/xfree86/loader/elf.h:1.12 Mon Jan 14 13:16:52 2002 +++ xc/programs/Xserver/hw/xfree86/loader/elf.h Wed Oct 30 12:50:19 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.12 2002/01/14 18:16:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.15 2002/10/30 17:50:19 alanh Exp $ */ typedef unsigned int Elf32_Addr; @@ -141,6 +141,26 @@ #define R_386_GOTPC 10 #define R_386_NUM 11 +/* x86_64 Relocation Types */ +#define R_X86_64_NONE 0 +#define R_X86_64_64 1 +#define R_X86_64_PC32 2 +#define R_X86_64_GOT32 3 +#define R_X86_64_PLT32 4 +#define R_X86_64_COPY 5 +#define R_X86_64_GLOB_DAT 6 +#define R_X86_64_JUMP_SLOT 7 +#define R_X86_64_RELATIVE 8 +#define R_X86_64_GOTPCREL 9 +#define R_X86_64_32 10 +#define R_X86_64_32S 11 +#define R_X86_64_16 12 +#define R_X86_64_PC16 13 +#define R_X86_64_8 14 +#define R_X86_64_PC8 15 +#define R_X86_64_GNU_VTINHERIT 250 +#define R_X86_64_GNU_VTENTRY 251 + /* sparc Relocation Types */ #define R_SPARC_NONE 0 #define R_SPARC_8 1 @@ -245,7 +265,7 @@ #define R_ALPHA_GPVALUE 16 #define R_ALPHA_GPRELHIGH 17 #define R_ALPHA_GPRELLOW 18 -#define R_ALPHA_IMMED_GP_16 19 +#define R_ALPHA_GPREL16 19 #define R_ALPHA_IMMED_GP_HI32 20 #define R_ALPHA_IMMED_SCN_HI32 21 #define R_ALPHA_IMMED_BR_HI32 22 @@ -597,6 +617,8 @@ #define SHT_HIPROC 0x7fffffff #define SHT_LOUSER 0x80000000 #define SHT_HIUSER 0xffffffff + +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ /* sh_flags */ #define SHF_WRITE 0x1 Index: xc/programs/Xserver/hw/xfree86/loader/elfloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.40 xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.49 --- xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.40 Mon Jan 14 13:16:52 2002 +++ xc/programs/Xserver/hw/xfree86/loader/elfloader.c Fri Jan 24 12:26:35 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.40 2002/01/14 18:16:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.49 2003/01/24 17:26:35 tsi Exp $ */ /* * @@ -23,20 +23,24 @@ * PERFORMANCE OF THIS SOFTWARE. */ #include <sys/types.h> +#include <sys/mman.h> #include <unistd.h> #include <stdlib.h> #ifdef __QNX__ -#include <fcntl.h> +# include <fcntl.h> #else -#include <sys/fcntl.h> +# include <sys/fcntl.h> #endif #include <sys/stat.h> +#if defined(linux) && defined (__ia64__) +#include <sys/mman.h> +#endif #ifdef DBMALLOC -#include <debug/malloc.h> -#define Xalloc(size) malloc(size) -#define Xcalloc(size) calloc(1,(size)) -#define Xfree(size) free(size) +# include <debug/malloc.h> +# define Xalloc(size) malloc(size) +# define Xcalloc(size) calloc(1,(size)) +# define Xfree(size) free(size) #endif #include "Xos.h" @@ -48,20 +52,46 @@ #include "compiler.h" +#undef LDTEST + /* #ifndef LDTEST -#define ELFDEBUG ErrorF +# define ELFDEBUG ErrorF #endif */ #ifndef UseMMAP -#if defined (__ia64__) || defined (__sparc__) -#define MergeSectionAlloc +# if defined (__ia64__) || defined (__sparc__) +# define MergeSectionAlloc +# endif +#endif + +#if defined (DoMMAPedMerge) +# include <sys/mman.h> +# define MergeSectionAlloc +# define MMAP_PROT (PROT_READ | PROT_WRITE | PROT_EXEC) +# if !defined(linux) +# error No MAP_ANON? +# endif +# if !defined (__x86_64__) +# define MMAP_FLAGS (MAP_PRIVATE | MAP_ANON) +# else +# define MMAP_FLAGS (MAP_PRIVATE | MAP_ANON | MAP_32BIT) +# endif +# if defined (MmapPageAlign) +# define MMAP_ALIGN(size) do { \ + int pagesize = getpagesize(); \ + size = ( size + pagesize - 1) / pagesize; \ + size *= pagesize; \ + } while (0); +# else +# define MMAP_ALIGN(size) +# endif #endif -#endif #if defined (__alpha__) || \ defined (__ia64__) || \ + defined (__x86_64__) || \ (defined (__sparc__) && \ (defined (__arch64__) || \ defined (__sparcv9))) @@ -80,7 +110,7 @@ #define ELF_R_SYM ELF64_R_SYM #define ELF_R_TYPE ELF64_R_TYPE -#if defined (__alpha__) || defined (__ia64__) +# if defined (__alpha__) || defined (__ia64__) /* * The GOT is allocated dynamically. We need to keep a list of entries that * have already been added to the GOT. @@ -100,12 +130,12 @@ unsigned char section[1]; } ELFGotRec, *ELFGotPtr; -#ifdef MergeSectionAlloc +# ifdef MergeSectionAlloc static ELFGotPtr ELFSharedGOTs; -#endif -#endif +# endif +# endif -#if defined (__ia64__) +# if defined (__ia64__) /* * The PLT is allocated dynamically. We need to keep a list of entries that * have already been added to the PLT. @@ -127,7 +157,7 @@ int offset; struct _elf_OPD *next; } ELFOpdRec, *ELFOpdPtr; -#endif +# endif #else typedef Elf32_Ehdr Elf_Ehdr; @@ -150,12 +180,24 @@ defined(__mc68000__) || \ defined(__alpha__) || \ defined(__sparc__) || \ - defined(__ia64__) + defined(__ia64__) || \ + defined(__x86_64__) typedef Elf_Rela Elf_Rel_t; #else typedef Elf_Rel Elf_Rel_t; #endif +typedef struct { + void *saddr; + char *name; + int ndx; + int size; + int flags; +} LoadSection; + +#define RELOC_SECTION 0x1 +#define LOADED_SECTION 0x2 + /* * This structure contains all of the information about a module * that has been loaded. @@ -174,69 +216,34 @@ unsigned char *shstraddr; /* Start address of the section header string table */ int shstrndx; /* index of the section header string table */ int shstrsize; /* size of the section header string table */ - unsigned char *straddr; /* Start address of the string table */ - int strndx; /* index of the string table */ - int strsize; /* size of the string table */ - unsigned char *text; /* Start address of the .text section */ - int txtndx; /* index of the .text section */ - int txtsize; /* size of the .text section */ - unsigned char *data; /* Start address of the .data section */ - int datndx; /* index of the .data section */ - int datsize; /* size of the .data section */ - unsigned char *data1; /* Start address of the .data1 section */ - int dat1ndx; /* index of the .data1 section */ - int dat1size; /* size of the .data1 section */ - unsigned char *sdata; /* Start address of the .sdata section */ - int sdatndx; /* index of the .sdata section */ - int sdatsize; /* size of the .sdata section */ - unsigned char *bss; /* Start address of the .bss section */ - int bssndx; /* index of the .bss section */ - int bsssize; /* size of the .bss section */ - unsigned char *sbss; /* Start address of the .sbss section */ - int sbssndx; /* index of the .sbss section */ - int sbsssize; /* size of the .sbss section */ - unsigned char *rodata; /* Start address of the .rodata section */ - int rodatndx; /* index of the .rodata section */ - int rodatsize; /* size of the .rodata section */ - unsigned char *rodata1; /* Start address of the .rodata section */ - int rodat1ndx; /* index of the .rodata section */ - int rodat1size; /* size of the .rodata section */ #if defined(__alpha__) || defined(__ia64__) unsigned char *got; /* Start address of the .got section */ ELFGotEntryPtr got_entries; /* List of entries in the .got section */ int gotndx; /* index of the .got section */ int gotsize; /* actual size of the .got section */ ELFGotPtr shared_got; /* Pointer to ELFGotRec if shared */ -#endif +#endif /*(__alpha__) || (__ia64__)*/ #if defined(__ia64__) ELFOpdPtr opd_entries; /* List of entries in the .opd section */ unsigned char *plt; /* Start address of the .plt section */ ELFPltEntryPtr plt_entries; /* List of entries in the .plt section */ int pltndx; /* index of the .plt section */ int pltsize; /* size of the .plt section */ -#endif +#endif /*__ia64__*/ Elf_Sym *symtab; /* Start address of the .symtab section */ int symndx; /* index of the .symtab section */ - int symsize; /* size of the .symtab section */ - unsigned char *reltext; /* Start address of the .rel.text section */ - int reltxtndx; /* index of the .rel.text section */ - int reltxtsize; /* size of the .rel.text section */ - unsigned char *reldata; /* Start address of the .rel.data section */ - int reldatndx; /* index of the .rel.data section */ - int reldatsize; /* size of the .rel.data section */ - unsigned char *relsdata;/* Start address of the .rel.sdata section */ - int relsdatndx; /* index of the .rel.sdata section */ - int relsdatsize; /* size of the .rel.sdata section */ - unsigned char *relrodata;/* Start address of the .rel.rodata section */ - int relrodatndx; /* index of the .rel.rodata section */ - int relrodatsize; /* size of the .rel.rodata section */ unsigned char *common; /* Start address of the SHN_COMMON space */ int comsize; /* size of the SHN_COMMON space */ unsigned char *base; /* Alloced address of section block */ unsigned long baseptr; /* Pointer to next free space in base */ int basesize; /* Size of that allocation */ - } ELFModuleRec, *ELFModulePtr; + unsigned char *straddr; /* Start address of the string table */ + int strndx; /* index of the string table */ + int strsize; /* size of the string table */ + LoadSection *lsection; + int lsectidx; +} ELFModuleRec, *ELFModulePtr; /* * If a relocation is unable to be satisfied, then put it on a list @@ -292,7 +299,7 @@ IA64_OPND_TGT25C }; static void IA64InstallReloc(unsigned long *, int, enum ia64_operand, long); -#endif +#endif /*__ia64__*/ #ifdef MergeSectionAlloc static void * @@ -321,13 +328,15 @@ elffile->baseptr = (elffile->baseptr + align - 1) & ~(align - 1); ret = (void *)elffile->baseptr; elffile->baseptr += size; - memset(ret, 0, size); +#ifndef DoMMAPedMerge + memset(ret, 0, size); /* mmap() does this for us */ +#endif return ret; } -#else -#define ELFLoaderSectToMem(elffile,align,offset,size,label) \ +#else /* MergeSectionAlloc */ +# define ELFLoaderSectToMem(elffile,align,offset,size,label) \ _LoaderFileToMem((elffile)->fd,offset,size,label) -#define ELFLoaderSectCalloc(elffile,align,size) xf86loadercalloc(1,size) +# define ELFLoaderSectCalloc(elffile,align,size) xf86loadercalloc(1,size) #endif /* @@ -367,13 +376,14 @@ ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %d," " r_offset 0x%lx, r_info 0x%x", reloc, elffile, secn, rel->r_offset, rel->r_info); -#if defined(__powerpc__) || \ +# if defined(__powerpc__) || \ defined(__mc68000__) || \ defined(__alpha__) || \ defined(__sparc__) || \ - defined(__ia64__) + defined(__ia64__) || \ + defined(__x86_64__) ELFDEBUG(", r_addend 0x%lx", rel->r_addend); -#endif +# endif ELFDEBUG("\n"); #endif return reloc; @@ -407,6 +417,7 @@ size+=common->sym->st_size; #if defined(__alpha__) || \ defined(__ia64__) || \ + defined(__x86_64__) || \ (defined(__sparc__) && \ (defined(__arch64__) || \ defined(__sparcv9))) @@ -432,6 +443,7 @@ size+=common->sym->st_size; #if defined(__alpha__) || \ defined(__ia64__) || \ + defined(__x86_64__) || \ (defined(__sparc__) && \ (defined(__arch64__) || \ defined(__sparcv9))) @@ -489,6 +501,7 @@ offset+=common->sym->st_size; #if defined(__alpha__) || \ defined(__ia64__) || \ + defined(__x86_64__) || \ (defined(__sparc__) && \ (defined(__arch64__) || \ defined(__sparcv9))) @@ -722,11 +735,11 @@ ELF_ST_BIND(syms[index].st_info) ); break; } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ElfGetPlt: symbol=%lx\t", symbol ); ELFDEBUG( "newval=%lx\t", symval ); ELFDEBUG( "name=\"%s\"\n", symname ? symname : "NULL"); -#endif +# endif break; case STT_SECTION: case STT_FILE: @@ -754,7 +767,7 @@ { ELFGotEntryPtr gotent; -#ifdef ELFDEBUG +# ifdef ELFDEBUG { Elf_Sym *sym; @@ -767,7 +780,7 @@ ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n", ElfGetSectionName(elffile,elffile->sections[sym->st_shndx].sh_name)); } -#endif +# endif for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { if ( ELF_R_SYM(gotent->rel->r_info) == ELF_R_SYM(rel->r_info) && @@ -776,9 +789,9 @@ } if( gotent ) { -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("Entry already present in GOT\n"); -#endif +# endif return; } @@ -787,9 +800,9 @@ return; } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("Entry added with offset %x\n",elffile->gotsize); -#endif +# endif gotent->rel=rel; gotent->offset=elffile->gotsize; gotent->next=elffile->got_entries; @@ -803,15 +816,15 @@ ELFModulePtr elffile; int maxalign; { -#ifdef MergeSectionAlloc +# ifdef MergeSectionAlloc ELFGotPtr gots; -#endif +# endif int gotsize; /* * XXX: Is it REALLY needed to ensure GOT's are non-null? */ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ELFCreateGOT: %x entries in the GOT\n", elffile->gotsize/8 ); /* @@ -821,18 +834,18 @@ if( elffile->gotsize == 0 ) ELFDEBUG( "Module %s doesn't have any GOT entries!\n", _LoaderModuleToName(elffile->module) ); -#endif +# endif if( elffile->gotsize == 0 ) elffile->gotsize=8; elffile->sections[elffile->gotndx].sh_size=elffile->gotsize; gotsize = elffile->gotsize; -#ifdef MergeSectionAlloc -#ifdef __alpha__ -#define GOTDistance 0x100000 -#endif -#ifdef __ia64__ -#define GOTDistance 0x200000 -#endif +# ifdef MergeSectionAlloc +# ifdef __alpha__ +# define GOTDistance 0x100000 +# endif +# ifdef __ia64__ +# define GOTDistance 0x200000 +# endif for (gots = ELFSharedGOTs; gots; gots = gots->next) { if (gots->freeptr + elffile->gotsize > gots->section + gots->size) continue; @@ -847,22 +860,22 @@ elffile->shared_got = gots; gots->freeptr = gots->freeptr + elffile->gotsize; gots->nuses++; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n", elffile->got, gots->nuses ); -#endif +# endif return TRUE; } gotsize += 16383 + sizeof(ELFGotRec); -#endif +# endif /*MergeSectionAlloc*/ if ((elffile->got = xf86loadermalloc(gotsize)) == NULL) { ErrorF( "ELFCreateGOT() Unable to allocate memory!!!!\n" ); return FALSE; } -#ifdef MergeSectionAlloc +# ifdef MergeSectionAlloc if (elffile->got > elffile->base) { if (elffile->got + elffile->gotsize - elffile->base >= GOTDistance) gotsize = 0; @@ -873,12 +886,37 @@ if (!gotsize) { xf86loaderfree(elffile->got); +# if !defined(DoMMAPedMerge) elffile->basesize += 8 + elffile->gotsize; elffile->base = xf86loaderrealloc(elffile->base, elffile->basesize); if (elffile->base == NULL) { ErrorF( "ELFCreateGOT() Unable to reallocate memory!!!!\n" ); return FALSE; } +# if defined(linux) && defined(__ia64__) || defined(__OpenBSD__) + { + unsigned long page_size = getpagesize(); + unsigned long round; + + round = (unsigned long)elffile->base & (page_size-1); + mprotect(elffile->base - round, (elffile->basesize+round+page_size-1) & ~(page_size-1), + PROT_READ|PROT_WRITE|PROT_EXEC); + } +# endif +# else + { + int oldbasesize = elffile->basesize; + elffile->basesize += 8 + elffile->gotsize; + MMAP_ALIGN(elffile->basesize); + elffile->base = mremap(elffile->base,oldbasesize, + elffile->basesize,MREMAP_MAYMOVE); + if (elffile->base == NULL) { + ErrorF( "ELFCreateGOT() Unable to remap memory!!!!\n" ); + return FALSE; + } + } +# endif + elffile->baseptr = ((long)elffile->base + (maxalign - 1)) & ~(maxalign - 1); elffile->got = (unsigned char *)((long)(elffile->base + elffile->basesize - elffile->gotsize) & ~7); } else { @@ -890,19 +928,19 @@ gots->next = ELFSharedGOTs; ELFSharedGOTs = gots; elffile->shared_got = gots; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ELFCreateGOT: Created a shareable GOT with size %d\n", gots->size); -#endif +# endif } -#endif +# endif/*MergeSectionAlloc*/ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ELFCreateGOT: GOT address %lx\n", elffile->got ); -#endif +# endif return TRUE; } -#endif +#endif /* defined(__alpha__) || defined(__ia64__)*/ #if defined(__ia64__) /* @@ -927,9 +965,9 @@ return; } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("OPD Entry %d added with offset %x\n",index,elffile->gotsize); -#endif +# endif opdent->l=l; opdent->index=index; opdent->offset=elffile->gotsize; @@ -967,7 +1005,7 @@ { ELFPltEntryPtr pltent; -#ifdef ELFDEBUG +# ifdef ELFDEBUG { Elf_Sym *sym; @@ -979,7 +1017,7 @@ else ErrorF("ElfAddPLT: Add PLT entry for section??\n"); } -#endif +# endif if (rel->r_addend) ErrorF("ElfAddPLT: Add PLT entry with non-zero addend??\n"); @@ -990,9 +1028,9 @@ } if( pltent ) { -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("Entry already present in PLT\n"); -#endif +# endif return; } @@ -1001,9 +1039,9 @@ return; } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("Entry added with offset %x\n",elffile->pltsize); -#endif +# endif pltent->rel=rel; pltent->offset=elffile->pltsize; pltent->gotoffset=elffile->gotsize; @@ -1018,9 +1056,9 @@ ELFCreatePLT(elffile) ELFModulePtr elffile; { -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ELFCreatePLT: %x entries in the PLT\n", elffile->pltsize/8 ); -#endif +# endif if( elffile->pltsize == 0 ) return; @@ -1029,9 +1067,9 @@ return; } elffile->sections[elffile->pltndx].sh_size=elffile->pltsize; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "ELFCreatePLT: PLT address %lx\n", elffile->plt ); -#endif +# endif return; } @@ -1045,10 +1083,10 @@ { unsigned long data = 0; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "\nIA64InstallReloc %p %d %d %016lx\n", data128, slot, opnd, value); ELFDEBUG( "Before [%016lx%016lx]\n", data128[1], data128[0]); -#endif +# endif switch (slot) { case 0: data = *data128; break; case 1: memcpy(&data, (char *)data128 + 5, 8); break; @@ -1082,12 +1120,12 @@ default: FatalError("Unexpected slot in IA64InstallReloc()\n"); } ia64_flush_cache(data128); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "After [%016lx%016lx]\n", data128[1], data128[0]); -#endif +# endif } -#endif +#endif /*__ia64__*/ /* * Fix all of the relocations for the given section. @@ -1095,6 +1133,7 @@ * made even if the symbol can't be found (by substituting * LoaderDefaultFunc) otherwise, the relocation will be deferred. */ + static ELFRelocPtr Elf_RelocateEntry(elffile, secn, rel, force) ELFModulePtr elffile; @@ -1103,16 +1142,23 @@ int force; { unsigned char *secp = elffile->saddr[secn]; +#if !defined(__ia64__) unsigned int *dest32; /* address of the 32 bit place being modified */ +#endif #if defined(__powerpc__) || defined(__sparc__) unsigned short *dest16; /* address of the 16 bit place being modified */ #endif #if defined(__sparc__) unsigned char *dest8; /* address of the 8 bit place being modified */ #endif -#if defined(__alpha__) +#if defined(__alpha__) unsigned int *dest32h; /* address of the high 32 bit place being modified */ unsigned long *dest64; + unsigned short *dest16; +#endif +#if defined(__x86_64__) + unsigned long *dest64; + int *dest32s; #endif #if defined(__ia64__) unsigned long *dest64; @@ -1123,20 +1169,22 @@ #ifdef ELFDEBUG ELFDEBUG( "%lx %d %d\n", rel->r_offset, ELF_R_SYM(rel->r_info), ELF_R_TYPE(rel->r_info) ); -#if defined(__powerpc__) || \ +# if defined(__powerpc__) || \ defined(__mc68000__) || \ defined(__alpha__) || \ defined(__sparc__) || \ - defined(__ia64__) + defined(__ia64__) || \ + defined(__x86_64__) ELFDEBUG( "%lx", rel->r_addend ); -#endif +# endif ELFDEBUG("\n"); -#endif +#endif /*ELFDEBUG*/ #if defined(__alpha__) - if (ELF_R_SYM(rel->r_info) && ELF_R_TYPE(rel->r_info) != R_ALPHA_GPDISP) { + if (ELF_R_SYM(rel->r_info) && ELF_R_TYPE(rel->r_info) != R_ALPHA_GPDISP) #else - if (ELF_R_SYM(rel->r_info)) { + if (ELF_R_SYM(rel->r_info)) #endif + { symval = ElfGetSymbolValue(elffile, ELF_R_SYM(rel->r_info)); if (symval == 0) { if (force) { @@ -1156,35 +1204,93 @@ #if defined(i386) case R_386_32: dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_386_32\t"); ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); -#endif +# endif *dest32=symval+(*dest32); /* S + A */ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); -#endif +# endif break; case R_386_PC32: dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_386_PC32 %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); -#endif +# endif *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); -#endif +# endif break; #endif /* i386 */ +#if defined(__x86_64__) + case R_X86_64_32: + dest32=(unsigned int *)(secp+rel->r_offset ); +# ifdef ELFDEBUG + ELFDEBUG( "R_X86_32\t"); + ELFDEBUG( "dest32=%x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); + ELFDEBUG( "r_addend=%lx\t", rel->r_addend); +# endif + *dest32=symval + rel->r_addend + (*dest32); /* S + A */ +# ifdef ELFDEBUG + ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); +# endif + break; + case R_X86_64_32S: + dest32s=(int *)(secp+rel->r_offset); +# ifdef ELFDEBUG + ELFDEBUG( "R_X86_64_32\t"); + ELFDEBUG( "dest32s=%x\t", dest32s ); + ELFDEBUG( "*dest32s=%8.8lx\t", *dest32s ); + ELFDEBUG( "r_addend=%lx\t", rel->r_addend); +# endif + *dest32s=symval + rel->r_addend + (*dest32s); /* S + A */ +# ifdef ELFDEBUG + ELFDEBUG( "*dest32s=%8.8lx\n", *dest32s ); +# endif + break; + case R_X86_64_PC32: + dest32=(unsigned int *)(secp+rel->r_offset); +# ifdef ELFDEBUG + ELFDEBUG( "R_X86_64_PC32 %s\t", + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); + ELFDEBUG( "secp=%x\t", secp ); + ELFDEBUG( "symval=%lx\t", symval ); + ELFDEBUG( "dest32=%x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); + ELFDEBUG( "r_addend=%lx\t", rel->r_addend); +# endif + *dest32 = symval + rel->r_addend + (*dest32)-(Elf_Addr)dest32; /* S + A - P */ + +# ifdef ELFDEBUG + ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); +# endif + break; + case R_X86_64_64: + dest64=(unsigned long *)(secp+rel->r_offset); +# ifdef ELFDEBUG + ELFDEBUG( "R_x86_64_64\t"); + ELFDEBUG( "dest64=%x\t", dest64 ); + ELFDEBUG( "*dest64=%8.8lx\t", *dest64 ); + ELFDEBUG( "r_addend=%lx\t", rel->r_addend); +# endif + *dest64=symval + rel->r_addend + (*dest64); /* S + A */ +# ifdef ELFDEBUG + ELFDEBUG( "*dest64=%8.8lx\n", *dest64 ); +# endif + break; +#endif /* __x86_64__ */ #if defined(__alpha__) case R_ALPHA_NONE: case R_ALPHA_LITUSE: @@ -1194,15 +1300,15 @@ dest64=(unsigned long *)(secp+rel->r_offset); symval=ElfGetSymbolValue(elffile, ELF_R_SYM(rel->r_info)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_ALPHA_REFQUAD\t"); ELFDEBUG( "dest64=%lx\t", dest64 ); ELFDEBUG( "*dest64=%8.8lx\t", *dest64 ); -#endif +# endif *dest64=symval+rel->r_addend+(*dest64); /* S + A + P */ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest64=%8.8lx\n", *dest64 ); -#endif +# endif break; case R_ALPHA_GPREL32: @@ -1210,19 +1316,19 @@ dest64=(unsigned long *)(secp+rel->r_offset); dest32=(unsigned int *)dest64; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_ALPHA_GPREL32 %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); -#endif +# endif symval += rel->r_addend; symval = ((unsigned char *)symval)-((unsigned char *)elffile->got); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "symval=%lx\t", symval ); -#endif +# endif if( (symval&0xffffffff00000000) != 0x0000000000000000 && (symval&0xffffffff00000000) != 0xffffffff00000000 ) { FatalError("R_ALPHA_GPREL32 symval-got is too large for %s\n", @@ -1230,23 +1336,53 @@ } *dest32=symval; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%x\n", *dest32 ); -#endif +# endif + break; + } + + case R_ALPHA_GPRELLOW: + { + dest64=(unsigned long *)(secp+rel->r_offset); + dest16=(unsigned short *)dest64; + + symval += rel->r_addend; + symval = ((unsigned char *)symval)-((unsigned char *)elffile->got); + + *dest16=symval; + break; + } + + case R_ALPHA_GPRELHIGH: + { + dest64=(unsigned long *)(secp+rel->r_offset); + dest16=(unsigned short *)dest64; + + symval += rel->r_addend; + symval = ((unsigned char *)symval)-((unsigned char *)elffile->got); + symval = ((long)symval >> 16) + ((symval >> 15) & 1); + if( (long)symval > 0x7fff || (long)symval < -(long)0x8000 ) { + FatalError("R_ALPHA_GPRELHIGH symval-got is too large for %s:%lx\n", + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)),symval); + } + + *dest16=symval; break; } + case R_ALPHA_LITERAL: { ELFGotEntryPtr gotent; dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_ALPHA_LITERAL %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); -#endif +# endif for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { if ( ELF_R_SYM(gotent->rel->r_info) == ELF_R_SYM(rel->r_info) && @@ -1258,10 +1394,10 @@ if( gotent ) { *(unsigned long *)(elffile->got+gotent->offset) = symval+rel->r_addend; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("Setting gotent[%x]=%lx\t", gotent->offset, symval+rel->r_addend); -#endif +# endif if ((gotent->offset & 0xffff0000) != 0) FatalError("\nR_ALPHA_LITERAL offset %x too large\n", gotent->offset); @@ -1272,9 +1408,9 @@ /* S + A - P >> 2 */ val=((symval+(rel->r_addend)-(Elf_Addr)dest32)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A-P=%x\t",val); -#endif +# endif if( (val & 0xffff0000) != 0xffff0000 && (val & 0xffff0000) != 0x00000000 ) { ErrorF("\nR_ALPHA_LITERAL offset %x too large\n", val); @@ -1283,9 +1419,9 @@ val &= 0x0000ffff; (*dest32)|=(val); /* The address part is always 0 */ } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; } @@ -1297,17 +1433,16 @@ dest32h=(unsigned int *)(secp+rel->r_offset); dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_ALPHA_GPDISP %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "got=%lx\t", elffile->got ); - ELFDEBUG( "gp=%lx\t", gp ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); ELFDEBUG( "dest32h=%lx\t", dest32h ); ELFDEBUG( "*dest32h=%8.8x\t", *dest32h ); -#endif +# endif if ((*dest32h >> 26) != 9 || (*dest32 >> 26) != 8) { ErrorF( "***Bad instructions in relocating %s\n", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); @@ -1317,148 +1452,165 @@ symval = (symval ^ 0x80008000) - 0x80008000; offset = ((unsigned char *)elffile->got - (unsigned char *)dest32h); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "got-dest32=%lx\t", offset ); -#endif +# endif if( (offset >= 0x7fff8000L) || (offset < -0x80000000L) ) { FatalError( "Offset overflow for R_ALPHA_GPDISP\n"); } symval += (unsigned long)offset; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "symval=%lx\t", symval ); -#endif +# endif *dest32=(*dest32&0xffff0000) | (symval&0xffff); *dest32h=(*dest32h&0xffff0000)| (((symval>>16)+((symval>>15)&1))&0xffff); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); ELFDEBUG( "*dest32h=%8.8x\n", *dest32h ); -#endif +# endif break; } case R_ALPHA_HINT: dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_ALPHA_HINT %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); -#endif +# endif -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "symval=%lx\t", symval ); -#endif +# endif symval -= (Elf_Addr)(((unsigned char *)dest32)+4); if (symval % 4 ) { ErrorF( "R_ALPHA_HINT bad alignment of offset\n"); } symval=symval>>2; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "symval=%lx\t", symval ); -#endif +# endif if( symval & 0xffff8000 ) { -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("R_ALPHA_HINT symval too large\n" ); -#endif +# endif } *dest32 = (*dest32&~0x3fff) | (symval&0x3fff); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; + + case R_ALPHA_GPREL16: + { + dest64=(unsigned long *)(secp+rel->r_offset); + dest16=(unsigned short *)dest64; + + symval += rel->r_addend; + symval = ((unsigned char *)symval)-((unsigned char *)elffile->got); + if( (long)symval > 0x7fff || + (long)symval < -(long)0x8000 ) { + FatalError("R_ALPHA_GPREL16 symval-got is too large for %s:%lx\n", + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)),symval); + } + + *dest16=symval; + break; + } #endif /* alpha */ #if defined(__mc68000__) case R_68K_32: dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_68K_32\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned long val; /* S + A */ val=symval+(rel->r_addend); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A=%x\t",val); -#endif +# endif *dest32=val; /* S + A */ } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_68K_PC32: dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_68K_PC32\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned long val; /* S + A - P */ val=symval+(rel->r_addend); val-=*dest32; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A=%x\t",val); ELFDEBUG("S+A-P=%x\t",val+(*dest32)-(Elf_Addr)dest32); -#endif +# endif *dest32=val+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; #endif /* __mc68000__ */ #if defined(__powerpc__) -#if defined(PowerMAX_OS) +# if defined(PowerMAX_OS) case R_PPC_DISP24: /* 11 */ dest32=(unsigned long *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_DISP24 %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); -#endif +# endif { unsigned long val; /* S + A - P >> 2 */ val=((symval+(rel->r_addend)-(Elf_Addr)dest32)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A-P=%x\t",val); -#endif +# endif val = val>>2; if( (val & 0x3f000000) != 0x3f000000 && (val & 0x3f000000) != 0x00000000 ) { -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("R_PPC_DISP24 offset %x too large\n", val<<2); -#endif +# endif symval = ElfGetPltAddr(elffile,ELF_R_SYM(rel->r_info)); val=((symval+(rel->r_addend)-(Elf_Addr)dest32)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("PLT offset is %x\n", val); -#endif +# endif val=val>>2; if( (val & 0x3f000000) != 0x3f000000 && (val & 0x3f000000) != 0x00000000 ) @@ -1468,17 +1620,17 @@ (*dest32)|=(val<<2); /* The address part is always 0 */ ppc_flush_icache(dest32); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_16HU: /* 31 */ dest16=(unsigned short *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG dest32=(unsigned long *)(dest16-1); -#endif -#ifdef ELFDEBUG +# endif +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_16HU\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); @@ -1487,80 +1639,80 @@ ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned short val; /* S + A */ val=((symval+(rel->r_addend))&0xffff0000)>>16; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("uhi16(S+A)=%x\t",val); -#endif +# endif *dest16=val; /* S + A */ ppc_flush_icache(dest16); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_32: /* 32 */ dest32=(unsigned long *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_32\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned long val; /* S + A */ val=symval+(rel->r_addend); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A=%x\t",val); -#endif +# endif *dest32=val; /* S + A */ ppc_flush_icache(dest32); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_32UA: /* 33 */ dest32=(unsigned long *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_32UA\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned long val; unsigned char *dest8 = (unsigned char *)dest32; /* S + A */ val=symval+(rel->r_addend); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A=%x\t",val); -#endif +# endif *dest8++=(val&0xff000000)>>24; *dest8++=(val&0x00ff0000)>>16; *dest8++=(val&0x0000ff00)>> 8; *dest8++=(val&0x000000ff); ppc_flush_icache(dest32); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_16H: /* 34 */ dest16=(unsigned short *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG dest32=(unsigned long *)(dest16-1); -#endif -#ifdef ELFDEBUG +# endif +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_16H\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symbol=%s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); @@ -1570,7 +1722,7 @@ ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned short val; unsigned short loval; @@ -1586,23 +1738,23 @@ */ val++; } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("hi16(S+A)=%x\t",val); -#endif +# endif *dest16=val; /* S + A */ ppc_flush_icache(dest16); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_16L: /* 35 */ dest16=(unsigned short *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG dest32=(unsigned long *)(dest16-1); -#endif -#ifdef ELFDEBUG +# endif +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_16L\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); @@ -1611,90 +1763,90 @@ ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned short val; /* S + A */ val=(symval+(rel->r_addend))&0xffff; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("lo16(S+A)=%x\t",val); -#endif +# endif *dest16=val; /* S + A */ ppc_flush_icache(dest16); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; -#else +# else /* PowerMAX_OS */ /* Linux PPC */ case R_PPC_ADDR32: /* 1 */ dest32=(unsigned int *)(secp+rel->r_offset); symval=ElfGetSymbolValue(elffile,ELF_R_SYM(rel->r_info)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_ADDR32\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned long val; /* S + A */ val=symval+(rel->r_addend); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A=%x\t",val); -#endif +# endif *dest32=val; /* S + A */ ppc_flush_icache(dest32); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_ADDR16_LO: /* 4 */ dest16=(unsigned short *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG dest32=(unsigned long *)(dest16-1); -#endif -#ifdef ELFDEBUG +# endif +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_ADDR16_LO\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest16=%x\t", dest16 ); ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); -#endif +# endif { unsigned short val; /* S + A */ val=(symval+(rel->r_addend))&0xffff; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("lo16(S+A)=%x\t",val); -#endif +# endif *dest16=val; /* S + A */ ppc_flush_icache(dest16); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_ADDR16_HA: /* 6 */ dest16=(unsigned short *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG dest32=(unsigned long *)(dest16-1); -#endif -#ifdef ELFDEBUG +# endif +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_ADDR16_HA\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest16=%x\t", dest16 ); ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); -#endif +# endif { unsigned short val; unsigned short loval; @@ -1710,46 +1862,46 @@ */ val++; } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("hi16(S+A)=%x\t",val); -#endif +# endif *dest16=val; /* S + A */ ppc_flush_icache(dest16); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest16=%8.8x\t", *dest16 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_REL24: /* 10 */ dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_REL24 %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); -#endif +# endif { unsigned long val; /* S + A - P >> 2 */ val=((symval+(rel->r_addend)-(Elf_Addr)dest32)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A-P=%x\t",val); -#endif +# endif val = val>>2; if( (val & 0x3f000000) != 0x3f000000 && (val & 0x3f000000) != 0x00000000 ) { -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("R_PPC_REL24 offset %x too large\n", val<<2); -#endif +# endif symval = ElfGetPltAddr(elffile,ELF_R_SYM(rel->r_info)); val=((symval+(rel->r_addend)-(Elf_Addr)dest32)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("PLT offset is %x\n", val); -#endif +# endif val=val>>2; if( (val & 0x3f000000) != 0x3f000000 && (val & 0x3f000000) != 0x00000000 ) @@ -1759,37 +1911,37 @@ (*dest32)|=(val<<2); /* The address part is always 0 */ ppc_flush_icache(dest32); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; case R_PPC_REL32: /* 26 */ dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_PPC_REL32\t" ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%x\t", symval ); ELFDEBUG( "r_addend=%x\t", rel->r_addend ); ELFDEBUG( "dest32=%8.8x\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif { unsigned long val; /* S + A - P */ val=symval+(rel->r_addend); val-=*dest32; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("S+A=%x\t",val); ELFDEBUG("S+A-P=%x\t",val+(*dest32)-(Elf_Addr)dest32); -#endif +# endif *dest32=val+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ ppc_flush_icache(dest32); } -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); -#endif +# endif break; -#endif /* PowerMAX_OS */ +# endif /* PowerMAX_OS */ #endif /* __powerpc__ */ #ifdef __sparc__ case R_SPARC_NONE: /* 0 */ @@ -1889,7 +2041,7 @@ dest32 = (unsigned int *)(secp + rel->r_offset); *dest32 += (unsigned int)secp + rel->r_addend; break; -#endif +#endif /*__sparc__*/ #ifdef __ia64__ case R_IA64_NONE: break; @@ -1897,16 +2049,16 @@ case R_IA64_LTOFF_FPTR22: if (rel->r_addend) FatalError("\nAddend for R_IA64_LTOFF_FPTR22 not supported\n"); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] ); -#endif +# endif /* FALLTHROUGH */ case R_IA64_LTOFF22: { ELFGotEntryPtr gotent; dest128=(unsigned long *)(secp+(rel->r_offset&~3)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "%s %s\t", ELF_R_TYPE(rel->r_info) == R_IA64_LTOFF22 ? "R_IA64_LTOFF22" : "R_IA64_LTOFF_FPTR22", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); @@ -1915,7 +2067,7 @@ ELFDEBUG( "dest128=%lx\t", dest128 ); ELFDEBUG( "slot=%d\n", rel->r_offset & 3); ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); -#endif +# endif for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { if ( ELF_R_SYM(gotent->rel->r_info) == ELF_R_SYM(rel->r_info) && @@ -1927,10 +2079,10 @@ if( gotent ) { *(unsigned long *)(elffile->got+gotent->offset) = symval+rel->r_addend; -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG("Setting gotent[%x]=%lx\n", gotent->offset, symval+rel->r_addend); -#endif +# endif if ((gotent->offset & 0xffe00000) != 0) FatalError("\nR_IA64_LTOFF22 offset %x too large\n", gotent->offset); @@ -1945,7 +2097,7 @@ { ELFPltEntryPtr pltent; dest128=(unsigned long *)(secp+(rel->r_offset&~3)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_IA64_PCREL21B %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); @@ -1954,7 +2106,7 @@ ELFDEBUG( "dest128=%lx\t", dest128 ); ELFDEBUG( "slot=%d\n", rel->r_offset & 3); ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); -#endif +# endif if (rel->r_addend) FatalError("\nAddend for PCREL21B not supported\n"); if (((long *)symval)[1] == (long)elffile->got @@ -2000,14 +2152,14 @@ case R_IA64_FPTR64LSB: dest64=(unsigned long *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_IA64_FPTR64LSB %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest64=%lx\t", dest64 ); ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] ); -#endif +# endif if (rel->r_addend) FatalError("\nAddend not supported for R_IA64_FPTR64LSB\n"); @@ -2017,20 +2169,32 @@ case R_IA64_DIR64LSB: dest64=(unsigned long *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_IA64_DIR64LSB %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest64=%lx\n", dest64 ); -#endif +# endif *dest64 = symval + rel->r_addend; ia64_flush_cache(dest64); break; + case R_IA64_PCREL64LSB: + dest64=(unsigned long *)(secp+rel->r_offset); +#ifdef ELFDEBUG + ELFDEBUG( "R_IA64_PCREL64LSB %s\t", + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); + ELFDEBUG( "secp=%lx\t", secp ); + ELFDEBUG( "symval=%lx\t", symval ); + ELFDEBUG( "dest64=%lx\n", dest64 ); +#endif + *dest64 = symval + rel->r_addend - (unsigned long)dest64; + break; + case R_IA64_GPREL22: dest128=(unsigned long *)(secp+(rel->r_offset&~3)); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_IA64_GPREL22 %s\t", ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); @@ -2038,30 +2202,30 @@ ELFDEBUG( "dest128=%lx\t", dest128 ); ELFDEBUG( "slot=%d\n", rel->r_offset & 3); ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); -#endif +# endif IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22, symval + rel->r_addend - (long)elffile->got); break; -#endif +#endif /*__ia64__*/ #if defined(__arm__) case R_ARM_ABS32: dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "R_ARM_ABS32\t"); ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); -#endif +# endif *dest32=symval+(*dest32); /* S + A */ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); -#endif +# endif break; case R_ARM_REL32: dest32=(unsigned int *)(secp+rel->r_offset); -#ifdef ELFDEBUG +# ifdef ELFDEBUG { char *namestr; ELFDEBUG( "R_ARM_REL32 %s\t", @@ -2072,13 +2236,13 @@ ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); } -#endif +# endif *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ -#ifdef ELFDEBUG +# ifdef ELFDEBUG ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); -#endif +# endif break; @@ -2090,7 +2254,9 @@ val = symval - (unsigned long)dest32 + val; val >>= 2; *dest32 = (*dest32 & 0xff000000) | (val & 0x00ffffff); +#ifdef NOTYET arm_flush_cache(dest32); +#endif } break; @@ -2280,6 +2446,9 @@ #define SecOffset(index) elffile->sections[index].sh_offset #define SecSize(index) elffile->sections[index].sh_size #define SecAlign(index) elffile->sections[index].sh_addralign +#define SecType(index) elffile->sections[index].sh_type +#define SecFlags(index) elffile->sections[index].sh_flags +#define SecInfo(index) elffile->sections[index].sh_info #define AdjustSize(i) \ if (!pass) { \ @@ -2304,412 +2473,109 @@ int *maxalign; { int i; - + int j; /* * Find and identify all of the Sections */ - -#ifdef ELFDEBUG - ELFDEBUG("%d sections\n", elffile->numsh ); -#endif - + j = elffile->lsectidx; for( i=1; i<elffile->numsh; i++) { -#ifdef ELFDEBUG - ELFDEBUG("%d %s\n", i, ElfGetSectionName(elffile, elffile->sections[i].sh_name) ); -#endif - /* .text */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".text" ) == 0 ) { - AdjustSize(i); - elffile->text=ELFLoaderSectToMem(elffile,SecAlign(i), - SecOffset(i),SecSize(i), - ".text"); - elffile->saddr[i]=elffile->text; - elffile->txtndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".text starts at %lx\n", elffile->text ); -#endif - elffile->txtsize=SecSize(i); - continue; - } - /* .data */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".data" ) == 0 ) { - AdjustSize(i); - elffile->data=ELFLoaderSectToMem(elffile,SecAlign(i), - SecOffset(i),SecSize(i), - ".data"); - elffile->saddr[i]=elffile->data; - elffile->datndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".data starts at %lx\n", elffile->data ); -#endif - elffile->datsize=SecSize(i); - continue; - } - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".data1" ) == 0 ) { - AdjustSize(i); - elffile->data1=ELFLoaderSectToMem(elffile,SecAlign(i), - SecOffset(i),SecSize(i), - ".data1"); - elffile->saddr[i]=elffile->data1; - elffile->dat1ndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".data1 starts at %lx\n", elffile->data1 ); -#endif - elffile->dat1size=SecSize(i); - continue; - } - /* .sdata */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".sdata" ) == 0 ) { - AdjustSize(i); - elffile->sdata=ELFLoaderSectToMem(elffile,SecAlign(i), - SecOffset(i),SecSize(i), - ".sdata"); - elffile->saddr[i]=elffile->sdata; - elffile->sdatndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".sdata starts at %lx\n", elffile->sdata ); -#endif - elffile->sdatsize=SecSize(i); - AdjustSize(i); - continue; - } - /* .bss */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".bss" ) == 0 ) { - AdjustSize(i); - if( SecSize(i) ) - elffile->bss = ELFLoaderSectCalloc(elffile,SecAlign(i), - SecSize(i)); - else - elffile->bss=NULL; - elffile->saddr[i]=elffile->bss; - elffile->bssndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".bss starts at %lx\n", elffile->bss ); -#endif - elffile->bsssize=SecSize(i); - continue; - } - /* .sbss */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".sbss" ) == 0 ) { - AdjustSize(i); - if( SecSize(i) ) - elffile->sbss = ELFLoaderSectCalloc(elffile,SecAlign(i), - SecSize(i)); - else - elffile->sbss=NULL; - elffile->saddr[i]=elffile->sbss; - elffile->sbssndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".sbss starts at %lx\n", elffile->sbss ); -#endif - elffile->sbsssize=SecSize(i); - continue; - } - /* .rodata */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rodata" ) == 0 ) { - AdjustSize(i); - elffile->rodata=ELFLoaderSectToMem(elffile,SecAlign(i), - SecOffset(i),SecSize(i), - ".rodata"); - elffile->saddr[i]=elffile->rodata; - elffile->rodatndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".rodata starts at %lx\n", elffile->rodata ); -#endif - elffile->rodatsize=SecSize(i); - continue; - } - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rodata1" ) == 0 ) { - AdjustSize(i); - elffile->rodata1=ELFLoaderSectToMem(elffile,SecAlign(i), - SecOffset(i),SecSize(i), - ".rodata1"); - elffile->saddr[i]=elffile->rodata1; - elffile->rodat1ndx=i; -#ifdef ELFDEBUG - ELFDEBUG(".rodata1 starts at %lx\n", elffile->rodata1 ); -#endif - elffile->rodat1size=SecSize(i); - continue; - } - /* .symtab */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".symtab" ) == 0 ) { - if (pass) continue; - elffile->symtab=(Elf_Sym *)_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".symtab"); - elffile->saddr[i]=(unsigned char *)elffile->symtab; - elffile->symndx=i; - elffile->symsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".symtab starts at %lx\n", elffile->symtab ); -#endif - continue; - } - /* .strtab */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".strtab" ) == 0 ) { - if (pass) continue; - elffile->straddr=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".strtab"); - elffile->saddr[i]=(unsigned char *)elffile->straddr; - elffile->strndx=i; - elffile->strsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".strtab starts at %lx\n", elffile->straddr ); -#endif + int flags = 0; + char *name = ElfGetSectionName(elffile, elffile->sections[i].sh_name); + +#if defined(__alpha__) || defined(__ia64__) + if (!strcmp(name,".got") /*Isn't there a more generic way to do this?*/ +# if defined(__ia64__) + || !strcmp(name,".plt") || !strcmp(name, ".IA_64.unwind_info") +# endif + ) continue; +#endif + switch (SecType(i)) { + case SHT_STRTAB: + if (!strcmp(name,".shstrtab")) /* already loaded */ continue; - } -#if defined(i386) || defined(__alpha__) || defined(__ia64__) || defined(__arm__) - /* .rel.text */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rel.text" ) == 0 ) { - if (pass) continue; - elffile->reltext=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rel.text"); - elffile->saddr[i]=(unsigned char *)elffile->reltext; - elffile->reltxtndx=i; - elffile->reltxtsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".rel.text starts at %lx\n", elffile->reltext ); -#endif - continue; - } - /* .rel.data */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rel.data" ) == 0 ) { - if (pass) continue; - elffile->reldata=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rel.data"); - elffile->saddr[i]=(unsigned char *)elffile->reldata; - elffile->reldatndx=i; - elffile->reldatsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".rel.data starts at %lx\n", elffile->reldata ); -#endif - continue; - } - /* .rel.rodata */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rel.rodata" ) == 0 ) { - if (pass) continue; - elffile->relrodata=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rel.rodata"); - elffile->saddr[i]=(unsigned char *)elffile->relrodata; - elffile->relrodatndx=i; - elffile->relrodatsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".rel.rodata starts at %lx\n", elffile->relrodata ); -#endif - continue; - } -#endif /* i386/alpha */ -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) - /* .rela.text */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.text" ) == 0 ) { - if (pass) continue; - elffile->reltext=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rela.text"); - elffile->saddr[i]=(unsigned char *)elffile->reltext; - elffile->reltxtndx=i; - elffile->reltxtsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".rela.text starts at %lx\n", elffile->reltext ); -#endif - continue; - } - /* .rela.data */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.data" ) == 0 ) { - if (pass) continue; - elffile->reldata=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rela.data"); - elffile->saddr[i]=(unsigned char *)elffile->reldata; - elffile->reldatndx=i; - elffile->reldatsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".rela.data starts at %lx\n", elffile->reldata ); -#endif - continue; - } - /* .rela.sdata */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.sdata" ) == 0 ) { + if (!strcmp(name,".stabstr")) /* ignore debug info */ + continue; + case SHT_SYMTAB: if (pass) continue; - elffile->relsdata=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rela.sdata"); - elffile->saddr[i]=(unsigned char *)elffile->relsdata; - elffile->relsdatndx=i; - elffile->relsdatsize=SecSize(i); -#ifdef ELFDEBUG - ELFDEBUG(".rela.sdata starts at %lx\n", elffile->relsdata ); + flags = LOADED_SECTION; + flags |= RELOC_SECTION; + break; + case SHT_REL: + case SHT_RELA: + if (pass) continue; + if (! (SecFlags(SecInfo(i)) & SHF_ALLOC)) + continue; +#ifdef __ia64__ + if (SecType(SecInfo(i)) == SHT_IA_64_UNWIND) + continue; #endif - continue; - } - /* .rela.rodata */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.rodata" ) == 0 ) { - if (pass) continue; - elffile->relrodata=_LoaderFileToMem(elffile->fd,SecOffset(i), - SecSize(i),".rela.rodata"); - elffile->saddr[i]=(unsigned char *)elffile->relrodata; - elffile->relrodatndx=i; - elffile->relrodatsize=SecSize(i); + flags = LOADED_SECTION; + flags |= RELOC_SECTION; + break; + case SHT_PROGBITS: + flags |= LOADED_SECTION; + case SHT_NOBITS: + if (! (elffile->sections[i].sh_flags & SHF_ALLOC)) + continue; + AdjustSize(i); + break; + default: #ifdef ELFDEBUG - ELFDEBUG(".rela.rodata starts at %lx\n", elffile->relrodata ); -#endif - continue; - } -#endif /* __powerpc__ || __mc68000__ */ - /* .shstrtab */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".shstrtab" ) == 0 ) { - continue; - } - /* .comment */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".comment" ) == 0 ) { - continue; - } - /* .debug */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug" ) == 0 ) { - continue; - } - /* .line */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".line" ) == 0 ) { - continue; - } - /* .note */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".note" ) == 0 ) { - continue; - } - /* .rel.debug */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rel.debug" ) == 0 ) { - continue; - } - /* .rel.line */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rel.line" ) == 0 ) { - continue; - } - /* .stab */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".stab" ) == 0 ) { - continue; - } - /* .rel.stab */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rel.stab" ) == 0 ) { - continue; - } - /* .rela.stab */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.stab" ) == 0 ) { - continue; - } - /* .stabstr */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".stabstr" ) == 0 ) { - continue; - } - /* .stab.* */ - if( strncmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".stab.", strlen(".stab.") ) == 0 ) { - continue; - } -#if defined(__powerpc__) || defined(__mc68000__) - /* .rela.tdesc */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.tdesc" ) == 0 ) { - continue; - } - /* .rela.debug_line */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.debug_line" ) == 0 ) { - continue; - } - /* .tdesc */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".tdesc" ) == 0 ) { - continue; - } - /* .debug_line */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug_line" ) == 0 ) { - continue; - } - /* $0001300 */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - "$0001300" ) == 0 ) { - continue; - } -#endif -#if defined(__alpha__) || defined(__ia64__) - /* .got */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".got" ) == 0 ) { - continue; - } -#endif -#if defined(__alpha__) - /* .mdebug */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".mdebug" ) == 0 ) { - continue; - } + if (pass) + ELFDEBUG("ELF: Not loading %s\n",name); #endif -#if defined(__ia64__) - /* .plt */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".plt" ) == 0 ) { continue; } - /* .IA_64.unwind, .IA_64.unwind_info and .rela.IA_64.unwind */ - /* FIXME I believe we don't need these */ - if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".IA_64.unwind" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.IA_64.unwind" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".IA_64.unwind_info" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug_abbrev" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug_info" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.debug_info" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug_line" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.debug_line" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug_pubnames" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.debug_pubnames" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".debug_aranges" ) == 0 - || strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), - ".rela.debug_aranges" ) == 0 - ) { - continue; + + elffile->lsection = xf86loaderrealloc(elffile->lsection, + (j + 1) * sizeof (LoadSection)); + if (!(flags & RELOC_SECTION)) { + if (flags & LOADED_SECTION) { + elffile->lsection[j].saddr /* sect. contains data */ + = ELFLoaderSectToMem(elffile,SecAlign(i),SecOffset(i), + SecSize(i), name); + } else { + if( SecSize(i) ) + elffile->lsection[j].saddr + = ELFLoaderSectCalloc(elffile,SecAlign(i), + SecSize(i)); + else + elffile->lsection[j].saddr = NULL; + } + } else { + elffile->lsection[j].saddr = + (Elf_Sym *)_LoaderFileToMem(elffile->fd,SecOffset(i), + SecSize(i),name); + } + elffile->saddr[i]=elffile->lsection[j].saddr; +#ifdef ELFDEBUG + ELFDEBUG("%s starts at %lx size: %lx\n", + name, elffile->saddr[i], SecSize(i)); +#endif + elffile->lsection[j].name= name; + elffile->lsection[j].ndx = i; + elffile->lsection[j].size=SecSize(i); + elffile->lsection[j].flags=flags; + switch (SecType(i)) { +#ifdef __OpenBSD__ + case SHT_PROGBITS: + mprotect(elffile->lsection[j].saddr, SecSize(i), + PROT_READ|PROT_WRITE|PROT_EXEC); + break; +#endif + case SHT_SYMTAB: + elffile->symtab = (Elf_Sym *)elffile->saddr[i]; + elffile->symndx = i; + break; + case SHT_STRTAB: + elffile->straddr = elffile->saddr[i]; + elffile->strsize = elffile->lsection[j].size; + elffile->strndx = i; + break; + default: + break; } -#endif - if (pass) - ErrorF("Not loading %s\n", - ElfGetSectionName(elffile, elffile->sections[i].sh_name) ); + elffile->lsectidx = ++j; } } @@ -2730,10 +2596,13 @@ int totalsize, maxalign, i; unsigned short *secttable; LOOKUP *pLookup; - + ldrCommons = 0; nCommons = 0; +#ifdef ELFDEBUG + ELFDEBUG("Loading %s %s\n", modrec->name, modrec->cname); +#endif if ((elffile = xf86loadercalloc(1, sizeof(ELFModuleRec))) == NULL) { ErrorF( "Unable to allocate ELFModuleRec\n" ); return NULL; @@ -2755,7 +2624,7 @@ * Get the section table */ elffile->numsh=header->e_shnum; - elffile->secsize=(header->e_shentsize*header->e_shnum); + elffile->secsize=(header->e_shentsize * header->e_shnum); elffile->sections= (Elf_Shdr *)_LoaderFileToMem(elffd, header->e_shoff, elffile->secsize, "sections"); @@ -2766,14 +2635,14 @@ */ elffile->gotndx=header->e_shnum; header->e_shnum++; -#if defined(__ia64__) +# if defined(__ia64__) elffile->pltndx=header->e_shnum; header->e_shnum++; -#endif +# endif elffile->numsh=header->e_shnum; elffile->secsize=(header->e_shentsize*header->e_shnum); elffile->sections=xf86loaderrealloc(elffile->sections,elffile->secsize); -#endif +#endif /*defined(__alpha__) || defined(__ia64__)*/ elffile->saddr=xf86loadercalloc(elffile->numsh, sizeof(unsigned char *)); #if defined(__alpha__) || defined(__ia64__) @@ -2832,13 +2701,13 @@ totalsize = 0; maxalign = 0; ELFCollectSections(elffile, 0, &totalsize, &maxalign); - if( elffile->straddr == NULL || elffile->strsize == 0 ) { +#if 0 ErrorF("No symbols found in this module\n"); +#endif ELFUnloadModule(elffile); - return NULL; + return (void *) -1L; } - /* * add symbols */ @@ -2847,35 +2716,15 @@ /* * Do relocations */ - if (elffile->reltxtndx) { - elf_reloc = ELFCollectRelocations(elffile,elffile->reltxtndx); - if (elf_reloc) { - for (tail = elf_reloc; tail->next; tail = tail->next) - ; - tail->next = _LoaderGetRelocations(v)->elf_reloc; - _LoaderGetRelocations(v)->elf_reloc = elf_reloc; - } - } - if (elffile->reldatndx) { - elf_reloc = ELFCollectRelocations(elffile,elffile->reldatndx); - if (elf_reloc) { - for (tail = elf_reloc; tail->next; tail = tail->next) - ; - tail->next = _LoaderGetRelocations(v)->elf_reloc; - _LoaderGetRelocations(v)->elf_reloc = elf_reloc; - } - } - if (elffile->relrodatndx) { - elf_reloc = ELFCollectRelocations(elffile,elffile->relrodatndx); - if (elf_reloc) { - for (tail = elf_reloc; tail->next; tail = tail->next) - ; - tail->next = _LoaderGetRelocations(v)->elf_reloc; - _LoaderGetRelocations(v)->elf_reloc = elf_reloc; + for (i = 0; i < elffile->lsectidx; i++) { + switch (SecType(elffile->lsection[i].ndx)) { + case SHT_REL: + case SHT_RELA: + break; + default: + continue; } - } - if (elffile->relsdatndx) { - elf_reloc = ELFCollectRelocations(elffile,elffile->relsdatndx); + elf_reloc = ELFCollectRelocations(elffile,elffile->lsection[i].ndx); if (elf_reloc) { for (tail = elf_reloc; tail->next; tail = tail->next) ; @@ -2898,11 +2747,32 @@ #ifdef MergeSectionAlloc elffile->basesize = totalsize + maxalign; + +# if !defined(DoMMAPedMerge) elffile->base = xf86loadermalloc(elffile->basesize); if (elffile->base == NULL) { ErrorF( "Unable to allocate ELF sections\n" ); return NULL; } +# if defined(linux) && defined(__ia64__) || defined(__OpenBSD__) + { + unsigned long page_size = getpagesize(); + unsigned long round; + + round = (unsigned long)elffile->base & (page_size-1); + mprotect(elffile->base - round, (elffile->basesize+round+page_size-1) & ~(page_size-1), + PROT_READ|PROT_WRITE|PROT_EXEC); + } +# endif +# else + MMAP_ALIGN(elffile->basesize); + elffile->base = mmap( 0,elffile->basesize,MMAP_PROT,MMAP_FLAGS,-1, + (off_t)0); + if (elffile->base == NULL) { + ErrorF( "Unable to mmap ELF sections\n" ); + return NULL; + } +# endif elffile->baseptr = ((long)elffile->base + (maxalign - 1)) & ~(maxalign - 1); #endif @@ -2939,10 +2809,17 @@ elfmod->name = strdup(modrec->name); elfmod->namelen = strlen(modrec->name); elfmod->version = 1; - elfmod->text = elffile->text; - elfmod->data = elffile->data; - elfmod->rodata = elffile->rodata; - elfmod->bss = elffile->bss; + for (i=0; i < elffile->lsectidx;i++) { + char *name = elffile->lsection[i].name; + if (!strcmp(name,".text")) + elfmod->text = elffile->lsection[i].saddr; + else if (!strcmp(name,".data")) + elfmod->data = elffile->lsection[i].saddr; + else if (!strcmp(name,".rodata")) + elfmod->rodata = elffile->lsection[i].saddr; + else if (!strcmp(name,".bss")) + elfmod->bss = elffile->lsection[i].saddr; + } elfmod->next = ModList; elfmod->commons = ldrCommons; elfmod->commonslen = nCommons; @@ -3011,7 +2888,8 @@ { ELFModulePtr elffile = (ELFModulePtr)modptr; ELFRelocPtr relptr, reltptr, *brelptr; - + int i; + /* * Delete any unresolved relocations */ @@ -3041,14 +2919,16 @@ /* * Free the sections that were allocated. */ -#define CheckandFree(ptr,size) if(ptr) xf86loaderfree(ptr) +#if !defined (DoMMAPedMerge) +# define CheckandFree(ptr,size) if(ptr) xf86loaderfree(ptr) +#else +# define CheckandFree(ptr,size) if (ptr) munmap(ptr,size) +#endif #define CheckandFreeFile(ptr,size) if(ptr) _LoaderFreeFileMem((ptr),(size)) - CheckandFreeFile(elffile->straddr,elffile->strsize); - CheckandFreeFile(elffile->symtab,elffile->symsize); #ifdef MergeSectionAlloc CheckandFree(elffile->base,elffile->basesize); -#if defined(__alpha__) || defined(__ia64__) +# if defined(__alpha__) || defined(__ia64__) if (elffile->shared_got) { elffile->shared_got->nuses--; if (!elffile->shared_got->nuses) { @@ -3060,23 +2940,15 @@ xf86loaderfree(elffile->shared_got); } } -#endif -#else - CheckandFreeFile(elffile->text,elffile->txtsize); - CheckandFreeFile(elffile->data,elffile->datsize); - CheckandFreeFile(elffile->data1,elffile->dat1size); - CheckandFreeFile(elffile->sdata,elffile->sdatsize); - CheckandFree(elffile->bss,elffile->bsssize); - CheckandFree(elffile->sbss,elffile->sbsssize); - CheckandFreeFile(elffile->rodata,elffile->rodatsize); - CheckandFreeFile(elffile->rodata1,elffile->rodat1size); +# endif +#else /*MergeSectionAlloc*/ CheckandFree(elffile->common,elffile->comsize); -#if defined(__alpha__) || defined(__ia64__) +# if defined(__alpha__) || defined(__ia64__) CheckandFree(elffile->got,elffile->gotsize); -#endif -#if defined(__ia64__) +# endif +# if defined(__ia64__) CheckandFree(elffile->plt,elffile->pltsize); -#endif +# endif #endif #if defined(__alpha__) || defined(__ia64__) { @@ -3102,11 +2974,23 @@ xf86loaderfree(opdent); } } +#endif + + for (i = 0; i < elffile->lsectidx; i++) { +#ifdef MergeSectionAlloc + if (!(elffile->lsection[i].flags & RELOC_SECTION)) + continue; #endif - CheckandFreeFile(elffile->reltext,elffile->reltxtsize); - CheckandFreeFile(elffile->reldata,elffile->reldatsize); - CheckandFreeFile(elffile->relrodata,elffile->relrodatsize); - CheckandFreeFile(elffile->relsdata,elffile->relsdatsize); + if (elffile->lsection[i].flags & LOADED_SECTION) { + CheckandFreeFile(elffile->lsection[i].saddr, + elffile->lsection[i].size); + } else { + CheckandFree(elffile->lsection[i].saddr, + elffile->lsection[i].size); + } + } + xf86loaderfree(elffile->lsection); + /* * Free the section table, section pointer array, and section names */ @@ -3114,7 +2998,8 @@ xf86loaderfree(elffile->saddr); _LoaderFreeFileMem(elffile->header,sizeof(Elf_Ehdr)); _LoaderFreeFileMem(elffile->shstraddr,elffile->shstrsize); - + + /* * Free the ELFModuleRec */ Index: xc/programs/Xserver/hw/xfree86/loader/fontsym.c diff -u xc/programs/Xserver/hw/xfree86/loader/fontsym.c:1.9 xc/programs/Xserver/hw/xfree86/loader/fontsym.c:1.11 --- xc/programs/Xserver/hw/xfree86/loader/fontsym.c:1.9 Sat Nov 17 11:05:59 2001 +++ xc/programs/Xserver/hw/xfree86/loader/fontsym.c Mon Dec 9 12:30:12 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/fontsym.c,v 1.9 2001/11/17 16:05:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/fontsym.c,v 1.11 2002/12/09 17:30:12 dawes Exp $ */ #include "font.h" #include "sym.h" @@ -11,6 +11,7 @@ #include "fntfil.h" #include "fontutil.h" #include "fontxlfd.h" +#define _FONTCACHE_SERVER_ #include "fontcache.h" LOOKUP fontLookupTab[] = { @@ -22,6 +23,7 @@ SYMFUNC(BufFileWrite) SYMFUNC(CheckFSFormat) SYMFUNC(FontFileOpen) + SYMFUNC(FontFilePriorityRegisterRenderer) SYMFUNC(FontFileRegisterRenderer) SYMFUNC(FontParseXLFDName) SYMFUNC(FontFileCloseFont) Index: xc/programs/Xserver/hw/xfree86/loader/loader.c diff -u xc/programs/Xserver/hw/xfree86/loader/loader.c:1.55 xc/programs/Xserver/hw/xfree86/loader/loader.c:1.63 --- xc/programs/Xserver/hw/xfree86/loader/loader.c:1.55 Sat Oct 27 23:33:59 2001 +++ xc/programs/Xserver/hw/xfree86/loader/loader.c Mon Nov 25 09:05:03 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.55 2001/10/28 03:33:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.63 2002/11/25 14:05:03 eich Exp $ */ /* * @@ -34,7 +34,8 @@ #include <fcntl.h> #include <string.h> #if defined(linux) && \ - (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__)) + (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \ + || defined(__x86_64__)) #include <malloc.h> #endif #include <stdarg.h> @@ -71,7 +72,7 @@ #define strerror(err) "strerror unsupported" #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ void * os2ldcalloc(size_t,size_t); #endif @@ -89,10 +90,16 @@ #if defined(__sparc__) && defined(__GNUC__) # define SYMFUNCDOT(func) { "." #func, (funcptr)&__sparc_dot_ ## func }, +# if !defined(__OpenBSD__) # define SYMFUNCDOT89(func) { "." #func, (funcptr)&func ## _sparcv89 }, # define DEFFUNCDOT(func) \ extern void __sparc_dot_ ## func (void) __asm__ ("." #func); \ extern void func ## _sparcv89 (void); +# else +# define SYMFUNCDOT(func) { "." #func, (funcptr)&__sparc_dot_ ## func }, +# define DEFFUNCDOT(func) \ +extern void __sparc_dot_ ## func (void) __asm__ ("." #func); +#endif DEFFUNCDOT(rem) DEFFUNCDOT(urem) DEFFUNCDOT(mul) @@ -322,7 +329,8 @@ xf86MsgVerb(X_INFO, 2, "Loader running on %s\n", osname); #if defined(linux) && \ - (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__)) + (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \ + || ( defined __x86_64__ && ! defined UseMMAP && ! defined DoMMAPedMerge)) /* * The glibc malloc uses mmap for large allocations anyway. This breaks * some relocation types because the offset overflow. See loader.h for more @@ -420,41 +428,67 @@ { #ifdef UseMMAP unsigned long ret; -#define MMAP_PROT (PROT_READ|PROT_WRITE|PROT_EXEC) +# ifdef MmapPageAlign + unsigned long pagesize; + unsigned long new_size; + unsigned long new_off; + unsigned long new_off_bias; +# endif +# define MMAP_PROT (PROT_READ|PROT_WRITE|PROT_EXEC) -#ifdef DEBUGMEM +# ifdef DEBUGMEM ErrorF("_LoaderFileToMem(%d,%u(%u),%d,%s)",fd,offset,offsetbias,size,label); -#endif - - ret = (unsigned long) mmap(0,size,MMAP_PROT,MAP_PRIVATE, - fd,offset+offsetbias); - +# endif +# ifdef MmapPageAlign + pagesize = getpagesize(); + new_size = (size + pagesize - 1) / pagesize; + new_size *= pagesize; + new_off = (offset + offsetbias) / pagesize; + new_off *= pagesize; + new_off_bias = (offset + offsetbias) - new_off; + if ((new_off_bias + size) > new_size) new_size += pagesize; + ret = (unsigned long) mmap(0,new_size,MMAP_PROT,MAP_PRIVATE +# ifdef __x86_64__ + | MAP_32BIT +# endif + , + fd,new_off); if(ret == -1) FatalError("mmap() failed: %s\n", strerror(errno) ); - + return (void *)(ret + new_off_bias); +# else + ret = (unsigned long) mmap(0,size,MMAP_PROT,MAP_PRIVATE +# ifdef __x86_64__ + | MAP_32BIT +# endif + , + fd,offset + offsetbias); + if(ret == -1) + FatalError("mmap() failed: %s\n", strerror(errno) ); return (void *)ret; +# endif #else char *ptr; -#ifdef DEBUGMEM +# ifdef DEBUGMEM ErrorF("_LoaderFileToMem(%d,%u(%u),%d,%s)",fd,offset,offsetbias,size,label); -#endif +# endif if(size == 0){ -#ifdef DEBUGMEM +# ifdef DEBUGMEM ErrorF("=NULL\n",ptr); -#endif +# endif return NULL; } -#ifndef __EMX__ +# ifndef __UNIXOS2__ if( (ptr=xf86loadercalloc(size,1)) == NULL ) FatalError("_LoaderFileToMem() malloc failed\n" ); -#else +# else if( (ptr=os2ldcalloc(size,1)) == NULL ) FatalError("_LoaderFileToMem() malloc failed\n" ); -#endif -#if defined(linux) && defined(__ia64__) +# endif +# if defined(linux) && defined(__ia64__) { unsigned long page_size = getpagesize(); unsigned long round; @@ -463,7 +497,7 @@ mprotect(ptr - round, (size+round+page_size-1) & ~(page_size-1), PROT_READ|PROT_WRITE|PROT_EXEC); } -#endif +# endif if(lseek(fd,offset+offsetbias,SEEK_SET)<0) FatalError("\n_LoaderFileToMem() lseek() failed: %s\n",strerror(errno)); @@ -471,7 +505,8 @@ if(read(fd,ptr,size)!=size) FatalError("\n_LoaderFileToMem() read() failed: %s\n",strerror(errno)); -#if defined(linux) && defined(__powerpc__) +# if (defined(linux) || defined(__NetBSD__) || defined(__OpenBSD__)) \ + && defined(__powerpc__) /* * Keep the instruction cache in sync with changes in the * main memory. @@ -482,11 +517,11 @@ ppc_flush_icache(ptr+i); ppc_flush_icache(ptr+size-1); } -#endif +# endif -#ifdef DEBUGMEM +# ifdef DEBUGMEM ErrorF("=%lx\n",ptr); -#endif +# endif return (void *)ptr; #endif @@ -498,11 +533,25 @@ void _LoaderFreeFileMem(void *addr, int size) { +#if defined (UseMMAP) && defined (MmapPageAlign) + unsigned long pagesize = getpagesize(); + memType i_addr = (memType)addr; + unsigned long new_size; +#endif #ifdef DEBUGMEM ErrorF("_LoaderFreeFileMem(%x,%d)\n",addr,size); #endif #ifdef UseMMAP - munmap(addr,size); +# if defined (MmapPageAlign) + i_addr /= pagesize; + i_addr *= pagesize; + new_size = (size + pagesize - 1) / pagesize; + new_size *= pagesize; + if (((memType)addr - i_addr + size) > new_size) new_size += pagesize; + munmap((void *)i_addr,new_size); +# else + munmap((void *)addr,size); +# endif #else if(size == 0) return; @@ -838,6 +887,7 @@ ARCHIVELoadModule(loaderPtr modrec, int arfd, LOOKUP **ppLookup) { loaderPtr tmp = NULL; + void *ret = NULL; unsigned char magic[SARMAG]; struct ar_hdr hdr; #if defined(__powerpc__) && defined(Lynx) @@ -1047,6 +1097,13 @@ if( offset&0x1 ) /* odd value */ lseek(arfd,1,SEEK_CUR); /* make it an even boundary */ + if (tmp->private == (void *) -1L) { + ErrorF("Skipping \"%s\": No symbols found\n", tmp->name); + continue; + } + else + ret = tmp->private; + /* Add the lookup table returned from funcs.LoadModule to the * one we're going to return. */ @@ -1071,10 +1128,7 @@ if (nametable) xf86loaderfree(nametable); - if (tmp) - return tmp->private; - else - return 0; + return ret; } /* @@ -1150,6 +1204,7 @@ if ( new_handle == MAX_HANDLE ) { xf86Msg(X_ERROR, "Out of loader space\n" ) ; /* XXX */ if(errmaj) *errmaj = LDR_NOSPACE; + if(errmin) *errmin = LDR_NOSPACE; return -1 ; } @@ -1168,6 +1223,7 @@ xf86Msg(X_ERROR, "%s is an unrecognized module type\n", module ) ; freeHandles[new_handle] = HANDLE_FREE ; if(errmaj) *errmaj = LDR_UNKTYPE; + if(errmin) *errmin = LDR_UNKTYPE; return -1; } @@ -1185,11 +1241,14 @@ _LoaderListPop(new_handle); freeHandles[new_handle] = HANDLE_FREE ; if(errmaj) *errmaj = LDR_NOLOAD; + if(errmin) *errmin = LDR_NOLOAD; return -1; } - LoaderAddSymbols(new_handle, tmp->module, pLookup); - xf86loaderfree(pLookup); + if (tmp->private != (void *) -1L) { + LoaderAddSymbols(new_handle, tmp->module, pLookup); + xf86loaderfree(pLookup); + } close(fd); Index: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h diff -u xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h:1.18 xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h:1.19 --- xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h:1.18 Wed Jun 13 19:10:43 2001 +++ xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h Tue Jul 30 14:36:18 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h,v 1.18 2001/06/13 23:10:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h,v 1.19 2002/07/30 18:36:18 dawes Exp $ */ /* * @@ -45,6 +45,7 @@ ModuleTearDownProc TearDownProc; void *TearDownData; /* returned from SetupProc */ const char *path; + const XF86ModuleVersionInfo *VersionInfo; } ModuleDesc, *ModuleDescPtr; @@ -82,6 +83,7 @@ void LoaderShowStack(void); void *LoaderSymbolHandle(const char *, int); int LoaderUnload(int); +unsigned long LoaderGetModuleVersion(ModuleDescPtr mod); void LoaderResetOptions(void); void LoaderSetOptions(unsigned long); Index: xc/programs/Xserver/hw/xfree86/loader/loadmod.c diff -u xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.66 xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.68 --- xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.66 Mon Dec 17 15:00:45 2001 +++ xc/programs/Xserver/hw/xfree86/loader/loadmod.c Tue Jul 30 14:36:18 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.66 2001/12/17 20:00:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.68 2002/07/30 18:36:18 dawes Exp $ */ /* * @@ -120,7 +120,7 @@ elem = strtok(fullpath, ","); while (elem) { /* Only allow fully specified paths */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (*elem == '/') #else if (*elem == '/' || (strlen(elem) > 2 && isalpha(elem[0]) && @@ -723,7 +723,7 @@ xf86MsgVerb(X_INFO, 3, "Loading sub module \"%s\"\n", module); /* Absolute module paths are not allowed here */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (module[0] == '/') #else if (isalpha (module[0]) && module[1] == ':' && module[2] == '/') @@ -775,6 +775,7 @@ ret->child = DuplicateModule(mod->child, ret); ret->sib = DuplicateModule(mod->sib, parent); ret->parent = parent; + ret->VersionInfo = mod->VersionInfo; return ret; } @@ -884,7 +885,7 @@ * if the module name is not a full pathname, we need to * check the elements in the path */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (module[0] == '/') found = xstrdup(module); #else @@ -977,6 +978,7 @@ if (teardown) ret->TearDownProc = teardown; ret->path = path; + ret->VersionInfo = vers; } else { @@ -1277,4 +1279,18 @@ /* If there is no match, return the whole name minus the leading path */ return xstrdup(s); +} + +/* + * Return the module version information. + */ +unsigned long +LoaderGetModuleVersion (ModuleDescPtr mod) +{ + if (!mod || !mod->VersionInfo) + return 0; + + return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion, + mod->VersionInfo->minorversion, + mod->VersionInfo->patchlevel); } Index: xc/programs/Xserver/hw/xfree86/loader/misym.c diff -u xc/programs/Xserver/hw/xfree86/loader/misym.c:1.33 xc/programs/Xserver/hw/xfree86/loader/misym.c:1.35 --- xc/programs/Xserver/hw/xfree86/loader/misym.c:1.33 Mon Aug 6 18:45:52 2001 +++ xc/programs/Xserver/hw/xfree86/loader/misym.c Mon Sep 16 14:06:11 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/misym.c,v 1.33 2001/08/06 22:45:52 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/misym.c,v 1.35 2002/09/16 18:06:11 eich Exp $ */ /* * @@ -40,6 +40,9 @@ #include "resource.h" #include "panoramiX.h" #endif +#ifdef RENDER +#include "mipict.h" +#endif /* mi things */ @@ -154,6 +157,7 @@ SYMFUNC(miSegregateChildren) SYMFUNC(miClipNotify) SYMFUNC(miHookInitVisuals) + SYMFUNC(miPointerAbsoluteCursor) SYMFUNC(miPointerGetMotionEvents) SYMFUNC(miPointerGetMotionBufferSize) SYMFUNC(miOverlayCopyUnderlay) @@ -168,7 +172,9 @@ SYMVAR(miPointerScreenIndex) SYMVAR(miInstalledMaps) SYMVAR(miInitVisualsProc) - +#ifdef RENDER + SYMVAR(miGlyphExtents) +#endif { 0, 0 }, }; Index: xc/programs/Xserver/hw/xfree86/loader/os.c diff -u xc/programs/Xserver/hw/xfree86/loader/os.c:1.1 xc/programs/Xserver/hw/xfree86/loader/os.c:1.2 --- xc/programs/Xserver/hw/xfree86/loader/os.c:1.1 Sat Mar 6 08:12:43 1999 +++ xc/programs/Xserver/hw/xfree86/loader/os.c Fri May 31 14:46:00 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/os.c,v 1.1 1999/03/06 13:12:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/os.c,v 1.2 2002/05/31 18:46:00 dawes Exp $ */ #include "loaderProcs.h" @@ -29,7 +29,7 @@ #define OSNAME "solaris" #elif defined(SVR4) #define OSNAME "svr4" -#elif defined(__EMX__) +#elif defined(__UNIXOS2__) #define OSNAME "os2" #else #define OSNAME "unknown" Index: xc/programs/Xserver/hw/xfree86/loader/os2funcs.c diff -u xc/programs/Xserver/hw/xfree86/loader/os2funcs.c:1.5 xc/programs/Xserver/hw/xfree86/loader/os2funcs.c:1.6 --- xc/programs/Xserver/hw/xfree86/loader/os2funcs.c:1.5 Wed Apr 5 14:13:50 2000 +++ xc/programs/Xserver/hw/xfree86/loader/os2funcs.c Fri May 31 14:46:00 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/os2funcs.c,v 1.5 2000/04/05 18:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/os2funcs.c,v 1.6 2002/05/31 18:46:00 dawes Exp $ */ /* * (c) Copyright 1997 by Sebastien Marineau * <marineau@genie.uottawa.ca> @@ -34,6 +34,7 @@ * the requests. We create a heap of 2 megs, hopefully enough for now. */ +#define I_NEED_OS2_H #define INCL_DOSMEMMGR #include <os2.h> #include <sys/types.h> Index: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c diff -u xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.202 xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.227 --- xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.202 Mon Jan 14 13:16:52 2002 +++ xc/programs/Xserver/hw/xfree86/loader/xf86sym.c Wed Feb 26 15:08:02 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.202 2002/01/14 18:16:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.227 2003/02/26 20:08:02 dawes Exp $ */ /* * @@ -22,8 +22,11 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -#define COMPILER_H_EXTRAS + +#define INCLUDE_DEPRECATED 1 + #include <fcntl.h> +#include <setjmp.h> #include "sym.h" #include "misc.h" #include "mi.h" @@ -34,14 +37,13 @@ #include "xf86.h" #include "xf86Resources.h" #include "xf86_OSproc.h" -#define DECLARE_CARD_DATASTRUCTURES -#include "xf86PciInfo.h" #include "xf86Parser.h" #include "xf86Config.h" #ifdef XINPUT # include "xf86Xinput.h" #endif #include "xf86OSmouse.h" +#include "xf86OSKbd.h" #include "xf86xv.h" #include "xf86xvmc.h" #include "xf86cmap.h" @@ -55,9 +57,18 @@ #include "xf86_ansic.h" #include "xisb.h" #include "vbe.h" +#ifndef __OpenBSD__ #include "xf86sbusBus.h" +#endif #include "compiler.h" +#ifndef HAS_GLIBC_SIGSETJMP +#if defined(setjmp) && \ + defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 +#define HAS_GLIBC_SIGSETJMP 1 +#endif +#endif + #ifdef __FreeBSD__ /* XXX used in drmOpen(). This should change to use a less os-specific * method. */ @@ -95,26 +106,45 @@ extern void* __remqu(long, long); #endif -#if defined(__ia64__) +#if defined(__GNUC__) +extern long __div64(long, long); extern long __divdf3(long, long); extern long __divdi3(long, long); extern long __divsf3(long, long); +extern long __divsi3(long, long); extern long __moddi3(long, long); +extern long __modsi3(long, long); +extern long __mul64(long, long); +extern long __muldf3(long, long); +extern long __muldi3(long, long); +extern long __mulsf3(long, long); +extern long __mulsi3(long, long); extern long __udivdi3(long, long); +extern long __udivsi3(long, long); extern long __umoddi3(long, long); +extern long __umodsi3(long, long); +#pragma weak __div64 +#pragma weak __divdf3 +#pragma weak __divdi3 +#pragma weak __divsf3 +#pragma weak __divsi3 +#pragma weak __moddi3 +#pragma weak __modsi3 +#pragma weak __mul64 +#pragma weak __muldf3 +#pragma weak __muldi3 +#pragma weak __mulsf3 +#pragma weak __mulsi3 +#pragma weak __udivdi3 +#pragma weak __udivsi3 +#pragma weak __umoddi3 +#pragma weak __umodsi3 #endif -#if defined(__arm__) -#if defined(__linux__) +#if defined(__arm__) && defined(__linux__) #include <sys/io.h> #endif -extern long __divsi3(long, long); -extern long __modsi3(long, long); -extern long __udivsi3(long, long); -extern long __umodsi3(long, long); -#endif - #if defined(__powerpc__) && (defined(Lynx) || defined(linux)) void _restf14(); void _restf17(); @@ -150,23 +180,18 @@ extern volatile unsigned char *ioBase; /* XXX Should get all of these from elsewhere */ - -extern void outb(unsigned short, unsigned char); -extern void outw(unsigned short, unsigned short); -extern void outl(unsigned short, unsigned int); -extern unsigned int inb(unsigned short); -extern unsigned int inw(unsigned short); -extern unsigned int inl(unsigned short); +#ifndef linux +extern void outb(IOADDRESS, unsigned char); +extern void outw(IOADDRESS, unsigned short); +extern void outl(IOADDRESS, unsigned int); +extern unsigned int inb(IOADDRESS); +extern unsigned int inw(IOADDRESS); +extern unsigned int inl(IOADDRESS); +#endif extern void stl_brx(unsigned long, volatile unsigned char *, int); extern void stw_brx(unsigned short, volatile unsigned char *, int); extern unsigned long ldl_brx(volatile unsigned char *, int); extern unsigned short ldw_brx(volatile unsigned char *, int); -extern unsigned char rdinx(unsigned short, unsigned char); -extern void wrinx(unsigned short, unsigned char, unsigned char); -extern void modinx(unsigned short, unsigned char, unsigned char, unsigned char); -extern int testrg(unsigned short, unsigned char); -extern int testinx2(unsigned short, unsigned char, unsigned char); -extern int testinx(unsigned short, unsigned char); #endif /* XFree86 things */ @@ -184,6 +209,10 @@ SYMFUNC(xf86MapVidMem) SYMFUNC(xf86UnMapVidMem) SYMFUNC(xf86MapReadSideEffects) + SYMFUNC(xf86GetPciDomain) + SYMFUNC(xf86MapDomainMemory) + SYMFUNC(xf86MapDomainIO) + SYMFUNC(xf86ReadDomainMemory) SYMFUNC(xf86UDelay) SYMFUNC(xf86IODelay) SYMFUNC(xf86SlowBcopy) @@ -209,6 +238,7 @@ SYMFUNC(xf86SerialModemClearBits) SYMFUNC(xf86LoadKernelModule) SYMFUNC(xf86OSMouseInit) + SYMFUNC(xf86OSKbdPreInit) SYMFUNC(xf86AgpGARTSupported) SYMFUNC(xf86GetAGPInfo) SYMFUNC(xf86AcquireGART) @@ -238,8 +268,10 @@ SYMFUNC(xf86SetPciVideo) SYMFUNC(xf86ClaimIsaSlot) SYMFUNC(xf86ClaimFbSlot) + SYMFUNC(xf86ClaimNoSlot) SYMFUNC(xf86ParsePciBusString) SYMFUNC(xf86ComparePciBusString) + SYMFUNC(xf86FormatPciBusNumber) SYMFUNC(xf86ParseIsaBusString) SYMFUNC(xf86EnableAccess) SYMFUNC(xf86SetCurrentAccess) @@ -276,7 +308,9 @@ SYMFUNC(xf86FindScreenForEntity) SYMFUNC(xf86FindPciDeviceVendor) SYMFUNC(xf86FindPciClass) +#ifdef INCLUDE_DEPRECATED SYMFUNC(xf86EnablePciBusMaster) +#endif SYMFUNC(xf86RegisterStateChangeNotificationCallback) SYMFUNC(xf86DeregisterStateChangeNotificationCallback) SYMFUNC(xf86NoSharedResources) @@ -299,11 +333,7 @@ /* xf86Configure.c */ SYMFUNC(xf86AddDeviceToConfigure) - /* xf86Cursor.c XXX not all of these should be exported */ - SYMFUNC(xf86LockZoom) - SYMFUNC(xf86SetViewport) - SYMFUNC(xf86ZoomLocked) - SYMFUNC(xf86ZoomViewport) + /* xf86Cursor.c */ SYMFUNC(xf86GetPointerScreenFuncs) /* xf86DGA.c */ @@ -394,7 +424,11 @@ SYMFUNC(xf86GetModInDevAllowNonLocal) SYMFUNC(xf86GetModInDevEnabled) SYMFUNC(xf86GetAllowMouseOpenFail) + SYMFUNC(xf86CommonSpecialKey) SYMFUNC(xf86IsPc98) + SYMFUNC(xf86DisableRandR) + SYMFUNC(xf86GetVersion) + SYMFUNC(xf86GetModuleVersion) SYMFUNC(xf86GetClocks) SYMFUNC(xf86SetPriority) SYMFUNC(xf86LoadDrvSubModule) @@ -424,7 +458,7 @@ SYMFUNC(xf86AddModuleInfo) SYMFUNC(xf86DeleteModuleInfo) -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) /* xf86sbusBus.c */ SYMFUNC(xf86MatchSbusInstances) SYMFUNC(xf86GetSbusInfoForEntity) @@ -576,6 +610,7 @@ SYMFUNC(MiscExtGetMouseSettings) SYMFUNC(MiscExtGetMouseValue) SYMFUNC(MiscExtSetMouseValue) + SYMFUNC(MiscExtSetMouseDevice) SYMFUNC(MiscExtGetKbdSettings) SYMFUNC(MiscExtGetKbdValue) SYMFUNC(MiscExtSetKbdValue) @@ -583,6 +618,7 @@ SYMFUNC(MiscExtCreateStruct) SYMFUNC(MiscExtDestroyStruct) SYMFUNC(MiscExtApply) + SYMFUNC(MiscExtGetFilePaths) #endif /* Misc */ @@ -596,9 +632,11 @@ SYMFUNC(xf86PostProximityEvent) SYMFUNC(xf86PostButtonEvent) SYMFUNC(xf86PostKeyEvent) + SYMFUNC(xf86PostKeyboardEvent) SYMFUNC(xf86GetMotionEvents) SYMFUNC(xf86MotionHistoryAllocate) SYMFUNC(xf86FirstLocalDevice) + SYMFUNC(xf86eqEnqueue) /* The following segment merged from Metrolink tree */ SYMFUNC(xf86XInputSetScreen) SYMFUNC(xf86ScaleAxis) @@ -804,8 +842,9 @@ SYMFUNC(xf86strcspn) SYMFUNC(xf86strerror) SYMFUNC(xf86strlen) - SYMFUNC(xf86strncmp) SYMFUNC(xf86strncasecmp) + SYMFUNC(xf86strncat) + SYMFUNC(xf86strncmp) SYMFUNC(xf86strncpy) SYMFUNC(xf86strpbrk) SYMFUNC(xf86strchr) @@ -856,8 +895,17 @@ SYMFUNC(xf86shmat) SYMFUNC(xf86shmdt) SYMFUNC(xf86shmctl) +#ifdef HAS_GLIBC_SIGSETJMP SYMFUNC(xf86setjmp) - SYMFUNC(xf86longjmp) + SYMFUNCALIAS("xf86setjmp1",__sigsetjmp) +#else + SYMFUNCALIAS("xf86setjmp",setjmp) + SYMFUNC(xf86setjmp1) +#endif + SYMFUNCALIAS("xf86longjmp",longjmp) + SYMFUNC(xf86getjmptype) + SYMFUNC(xf86setjmp1_arg2) + SYMFUNC(xf86setjmperror) #ifdef XF86DRI /* These may have more general uses, but for now, they are only used by the DRI. @@ -890,6 +938,12 @@ SYMFUNC(_inb) SYMFUNC(_inw) SYMFUNC(_inl) + SYMFUNC(_alpha_outw) + SYMFUNC(_alpha_outb) + SYMFUNC(_alpha_outl) + SYMFUNC(_alpha_inb) + SYMFUNC(_alpha_inw) + SYMFUNC(_alpha_inl) # else SYMFUNC(outw) SYMFUNC(outb) @@ -938,12 +992,6 @@ SYMFUNC(stw_u) SYMFUNC(write_mem_barrier) # endif - SYMFUNC(rdinx) - SYMFUNC(wrinx) - SYMFUNC(modinx) - SYMFUNC(testrg) - SYMFUNC(testinx2) - SYMFUNC(testinx) # if defined(Lynx) SYMFUNC(_restf14) SYMFUNC(_restf17) @@ -981,13 +1029,25 @@ SYMFUNC(debug_outl) # endif #endif -#if defined(__ia64__) +#if defined(__GNUC__) + SYMFUNC(__div64) SYMFUNC(__divdf3) SYMFUNC(__divdi3) SYMFUNC(__divsf3) + SYMFUNC(__divsi3) SYMFUNC(__moddi3) + SYMFUNC(__modsi3) + SYMFUNC(__mul64) + SYMFUNC(__muldf3) + SYMFUNC(__muldi3) + SYMFUNC(__mulsf3) + SYMFUNC(__mulsi3) SYMFUNC(__udivdi3) + SYMFUNC(__udivsi3) SYMFUNC(__umoddi3) + SYMFUNC(__umodsi3) +#endif +#if defined(__ia64__) SYMFUNC(_outw) SYMFUNC(_outb) SYMFUNC(_outl) @@ -996,10 +1056,6 @@ SYMFUNC(_inl) #endif #if defined(__arm__) - SYMFUNC(__divsi3) - SYMFUNC(__udivsi3) - SYMFUNC(__modsi3) - SYMFUNC(__umodsi3) SYMFUNC(outw) SYMFUNC(outb) SYMFUNC(outl) @@ -1027,6 +1083,7 @@ SYMVAR(xf86PixmapIndex) SYMVAR(xf86Screens) SYMVAR(byte_reversed) + SYMVAR(xf86inSuspend) /* debugging variables */ #ifdef BUILDDEBUG SYMVAR(xf86p8bit) @@ -1035,10 +1092,6 @@ SYMVAR(xf86DummyVar3) #endif - /* variables for PCI devices and cards from xf86Bus.c */ - SYMVAR(xf86PCICardInfo) - SYMVAR(xf86PCIVendorInfo) - SYMVAR(xf86PCIVendorNameInfo) #ifdef async SYMVAR(xf86CurrentScreen) #endif Index: xc/programs/Xserver/hw/xfree86/os-support/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.52 xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.56 --- xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.52 Thu Dec 27 15:07:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/Imakefile Mon Feb 17 12:06:45 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.52 2001/12/27 20:07:05 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.56 2003/02/17 17:06:45 dawes Exp $ @@ -13,9 +13,12 @@ #if defined(i386Architecture) || defined(ia64Architecture) || \ (defined(SunArchitecture) && defined(SparcArchitecture)) || \ (defined(FreeBSDArchitecture) && defined(AlphaArchitecture)) || \ - (defined(OpenBSDArchitecture) && defined(PpcArchitecture)) || \ + (defined(NetBSDArchitecture) && defined(AlphaArchitecture)) || \ + (defined(NetBSDArchitecture) && defined(PpcArchitecture)) || \ + (defined(NetBSDArchitecture) && defined(SparcArchitecture)) || \ + defined(OpenBSDArchitecture) || \ (defined(LynxOSArchitecture) && defined(PpcArchitecture)) || \ - defined(LinuxArchitecture) + defined(x86_64Architecture) || defined(LinuxArchitecture) BUS_SUBDIR = bus #endif @@ -84,18 +87,14 @@ DRM_DONES = $(OS_SUBDIR)/drm/DONE #endif -VBE_SRC = vbe/?*.c -VBE_OBJ = vbe/?*.o -VBE_DONES = vbe/DONE - #endif -SUBDIRS = $(OS_SUBDIR) $(BUS_SUBDIR) misc vbe +SUBDIRS = $(OS_SUBDIR) $(BUS_SUBDIR) misc -SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c $(VBE_SRC) $(DRM_SRC) -OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o $(VBE_OBJ) $(DRM_OBJ) +SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c $(DRM_SRC) +OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o $(DRM_OBJ) -DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE $(VBE_DONES) $(DRM_DONES) +DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE $(DRM_DONES) #if HasParallelMake MakeMutex($(SUBDIRS) $(OBJS) $(DONES)) Index: xc/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h:1.3 --- /dev/null Thu Feb 27 12:32:18 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h Mon Feb 17 10:11:55 2003 @@ -0,0 +1,92 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h,v 1.3 2003/02/17 15:11:55 dawes Exp $ */ + +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * Author: Ivan Pascal. + */ + +#include "xf86Xinput.h" + +Bool ATScancode(InputInfoPtr pInfo, int *scanCode); + +/* Public interface to OS-specific keyboard support. */ + +typedef int (*KbdInitProc)(InputInfoPtr pInfo, int what); +typedef int (*KbdOnProc)(InputInfoPtr pInfo, int what); +typedef int (*KbdOffProc)(InputInfoPtr pInfo, int what); +typedef void (*BellProc)(InputInfoPtr pInfo, + int loudness, int pitch, int duration); +typedef void (*SetLedsProc)(InputInfoPtr pInfo, int leds); +typedef int (*GetLedsProc)(InputInfoPtr pInfo); +typedef void (*SetKbdRepeatProc)(InputInfoPtr pInfo, char rad); +typedef void (*KbdGetMappingProc)(InputInfoPtr pInfo, + KeySymsPtr pKeySyms, CARD8* pModMap); +typedef int (*GetSpecialKeyProc)(InputInfoPtr pInfo, int scanCode); +typedef Bool (*SpecialKeyProc)(InputInfoPtr pInfo, + int key, Bool down, int modifiers); +typedef int (*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode); +typedef Bool (*OpenKeyboardProc)(InputInfoPtr pInfo); +typedef void (*PostEventProc)(InputInfoPtr pInfo, + unsigned int key, Bool down); +typedef struct { + int begin; + int end; + unsigned char *map; +} TransMapRec, *TransMapPtr; + +typedef struct { + KbdInitProc KbdInit; + KbdOnProc KbdOn; + KbdOffProc KbdOff; + BellProc Bell; + SetLedsProc SetLeds; + GetLedsProc GetLeds; + SetKbdRepeatProc SetKbdRepeat; + KbdGetMappingProc KbdGetMapping; + RemapScanCodeProc RemapScanCode; + GetSpecialKeyProc GetSpecialKey; + SpecialKeyProc SpecialKey; + + OpenKeyboardProc OpenKeyboard; + PostEventProc PostEvent; + + int rate; + int delay; + int bell_pitch; + int bell_duration; + Bool autoRepeat; + unsigned long leds; + unsigned long xledsMask; + unsigned long keyLeds; + int scanPrefix; + Bool vtSwitchSupported; + Bool CustomKeycodes; + Bool noXkb; + Bool isConsole; + TransMapPtr scancodeMap; + TransMapPtr specialMap; + + /* os specific */ + pointer private; + int kbdType; + int consType; + int wsKbdType; + Bool sunKbd; + Bool Panix106; + +} KbdDevRec, *KbdDevPtr; + +typedef enum { + PROT_STD, + PROT_XQUEUE, + PROT_WSCONS, + PROT_USB, + PROT_UNKNOWN +} KbdProtocolId; + +typedef struct { + const char *name; + KbdProtocolId id; +} KbdProtocolRec; + +Bool xf86OSKbdPreInit(InputInfoPtr pInfo); Index: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.16 xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.20 --- xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.16 Mon Aug 6 16:51:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h Tue Dec 17 15:55:23 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.16 2001/08/06 20:51:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.20 2002/12/17 20:55:23 dawes Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -22,6 +22,8 @@ * specific protocol names that are * supported for this class. */ +struct _MouseDevRec; + typedef int (*GetInterfaceTypesProc)(void); typedef const char **(*BuiltinNamesProc)(void); typedef Bool (*CheckProtocolProc)(const char *protocol); @@ -31,6 +33,10 @@ typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara); typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate, int res); +typedef void (*checkMovementsProc)(InputInfoPtr,int, int); +typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool); +typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char); +typedef Bool (*dataGoodProc)(struct _MouseDevRec *); /* * OSMouseInfoRec is used to pass information from the OSMouse layer to the @@ -114,10 +120,9 @@ int buttons; /* # of buttons */ int emulateState; /* automata state for 2 button mode */ Bool emulate3Buttons; + Bool emulate3ButtonsSoft; int emulate3Timeout;/* Timeout for 3 button emulation */ Bool chordMiddle; - Bool clearDTR; - Bool clearRTS; Bool flipXY; int invX; int invY; @@ -151,6 +156,13 @@ int positiveY; int wheelYDistance; int wheelXDistance; + Bool autoProbe; + checkMovementsProc checkMovements; + autoProbeProc autoProbeMouse; + collectDataProc collectData; + dataGoodProc dataGood; + int angleOffset; + pointer pDragLock; /* drag lock area */ } MouseDevRec, *MouseDevPtr; /* Z axis mapping */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.89 xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.90 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.89 Mon Dec 24 18:21:25 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h Fri May 31 14:46:00 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.89 2001/12/24 23:21:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.90 2002/05/31 18:46:00 dawes Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@XFree86.org> @@ -551,8 +551,8 @@ /**************************************************************************/ /* OS/2 */ /**************************************************************************/ -/* currently OS/2 with EMX/GCC compiler only */ -#if defined(__EMX__) +/* currently OS/2 with a modified EMX/GCC compiler only */ +#if defined(__UNIXOS2__) # include <signal.h> # include <errno.h> # include <sys/stat.h> Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.54 xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.55 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.54 Thu Nov 8 16:49:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h Fri Jan 25 16:56:17 2002 @@ -64,7 +64,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.54 2001/11/08 21:49:43 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.55 2002/01/25 21:56:17 tsi Exp $ */ #ifndef _XF86_OSPROC_H #define _XF86_OSPROC_H @@ -248,7 +248,9 @@ /* available to the common layer */ resPtr xf86BusAccWindowsFromOS(void); resPtr xf86PciBusAccWindowsFromOS(void); +#ifdef INCLUDE_UNUSED resPtr xf86IsaBusAccWindowsFromOS(void); +#endif resPtr xf86AccResFromOS(resPtr ret); #endif /* NEED_OS_RAC_PROTOS */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.48 xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.49 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.48 Mon Dec 31 13:13:37 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h Sat Feb 22 01:00:39 2003 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.48 2001/12/31 18:13:37 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.49 2003/02/22 06:00:39 dawes Exp $ */ #ifndef _XF86_ANSIC_H #define _XF86_ANSIC_H @@ -305,8 +305,17 @@ extern char * xf86shmat(int id, char *addr, int xf86shmflg); extern int xf86shmdt(char *addr); extern int xf86shmctl(int id, int xf86cmd, pointer buf); + extern int xf86setjmp(xf86jmp_buf env); +extern int xf86setjmp1(xf86jmp_buf env, int); +extern int xf86setjmp1_arg2(void); +extern int xf86setjmperror(xf86jmp_buf env); +extern int xf86getjmptype(void); extern void xf86longjmp(xf86jmp_buf env, int val); +#define xf86setjmp_macro(env) \ + (xf86getjmptype() == 0 ? xf86setjmp((env)) : \ + (xf86getjmptype() == 1 ? xf86setjmp1((env), xf86setjmp1_arg2()) : \ + xf86setjmperror((env)))) #else /* XFree86LOADER || NEED_XF86_PROTOTYPES */ #include <unistd.h> Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.51 xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.56 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.51 Mon Dec 31 13:13:37 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h Sat Feb 22 01:00:39 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.51 2001/12/31 18:13:37 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.56 2003/02/22 06:00:39 dawes Exp $ */ @@ -71,7 +71,7 @@ typedef int xf86key_t; /* setjmp/longjmp */ -typedef int xf86jmp_buf[20]; +typedef int xf86jmp_buf[1024]; /* for setvbuf */ #define XF86_IONBF 1 @@ -92,6 +92,7 @@ #define XF86_MAP_FIXED 0x0001 #define XF86_MAP_SHARED 0x0002 #define XF86_MAP_PRIVATE 0x0004 +#define XF86_MAP_32BIT 0x0040 #define XF86_MAP_FAILED ((void *)-1) /* for fseek */ @@ -399,6 +400,7 @@ #undef hypot #define hypot(x,y) xf86hypot(x,y) +#undef qsort #define qsort(b, n, s, f) xf86qsort(b, n, s, f) /* non-ANSI C functions */ @@ -438,12 +440,14 @@ #define mkdir(a,b) xf86mkdir(a,b) #undef getpagesize #define getpagesize xf86getpagesize +#undef shmget #define shmget(a,b,c) xf86shmget(a,b,c) +#undef shmat #define shmat(a,b,c) xf86shmat(a,b,c) +#undef shmdt #define shmdt(a) xf86shmdt(a) +#undef shmctl #define shmctl(a,b,c) xf86shmctl(a,b,c) -#define setjmp(a) xf86setjmp(a) -#define longjmp(a,b) xf86longjmp(a,b) #undef S_ISUID #define S_ISUID XF86_S_ISUID @@ -499,10 +503,12 @@ #define uid_t xf86uid_t #undef gid_t #define gid_t xf86gid_t -#undef jmp_buf -#define jmp_buf xf86jmp_buf +#undef stat_t #define stat_t struct xf86stat +#undef ulong +#define ulong unsigned long + /* * There should be no need to #undef any of these. If they are already * defined it is because some illegal header has been included. @@ -569,10 +575,8 @@ #define X_OK XF86_X_OK #undef F_OK #define F_OK XF86_F_OK -#ifndef __EMX__ #undef errno #define errno xf86errno -#endif #undef putchar #define putchar(i) xf86fputc(i, xf86stdout) #undef puts @@ -653,6 +657,16 @@ #undef FILENAME_MAX #define FILENAME_MAX 1024 -#endif /* XFree86LOADER */ +#endif /* XFree86LOADER && !DONT_DEFINE_WRAPPERS */ + +#if defined(XFree86LOADER) && \ + (!defined(DONT_DEFINE_WRAPPERS) || defined(DEFINE_SETJMP_WRAPPERS)) +#undef setjmp +#define setjmp(a) xf86setjmp_macro(a) +#undef longjmp +#define longjmp(a,b) xf86longjmp(a,b) +#undef jmp_buf +#define jmp_buf xf86jmp_buf +#endif #endif /* XF86_LIBC_H */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.15 xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.21 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.15 Thu May 31 22:10:06 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h Tue Dec 24 12:42:59 2002 @@ -26,7 +26,7 @@ * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.15 2001/06/01 02:10:06 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.21 2002/12/24 17:42:59 tsi Exp $ * */ @@ -36,7 +36,9 @@ /* Defaults, if nothing set in xf86config */ #define DRM_DEV_UID 0 #define DRM_DEV_GID 0 -#define DRM_DEV_DIRMODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP) +/* Default /dev/dri directory permissions 0755 */ +#define DRM_DEV_DIRMODE \ + (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) #define DRM_DIR_NAME "/dev/dri" @@ -218,13 +220,48 @@ unsigned int age; } drmTextureRegion, *drmTextureRegionPtr; + +typedef struct _drmClipRect { + unsigned short x1; /* Upper left: inclusive */ + unsigned short y1; + unsigned short x2; /* Lower right: exclusive */ + unsigned short y2; +} drmClipRect, *drmClipRectPtr; + + +typedef enum { + DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */ + DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */ + DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */ +} drmVBlankSeqType; + +typedef struct _drmVBlankReq { + drmVBlankSeqType type; + unsigned int sequence; + unsigned long signal; +} drmVBlankReq, *drmVBlankReqPtr; + +typedef struct _drmVBlankReply { + drmVBlankSeqType type; + unsigned int sequence; + long tval_sec; + long tval_usec; +} drmVBlankReply, *drmVBlankReplyPtr; + +typedef union _drmVBlank { + drmVBlankReq request; + drmVBlankReply reply; +} drmVBlank, *drmVBlankPtr; + + + #define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) #define DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */ #define DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */ -#if __GNUC__ >= 2 -# if defined(__i386) +#if defined(__GNUC__) && (__GNUC__ >= 2) +# if defined(__i386) || defined(__x86_64__) /* Reflect changes here to drmP.h */ #define DRM_CAS(lock,old,new,__ret) \ do { \ @@ -422,6 +459,7 @@ extern int drmOpen(const char *name, const char *busid); extern int drmClose(int fd); extern drmVersionPtr drmGetVersion(int fd); +extern drmVersionPtr drmGetLibVersion(int fd); extern void drmFreeVersion(drmVersionPtr); extern int drmGetMagic(int fd, drmMagicPtr magic); extern char *drmGetBusid(int fd); @@ -435,8 +473,14 @@ int *uid, unsigned long *magic, unsigned long *iocs); extern int drmGetStats(int fd, drmStatsT *stats); +extern int drmCommandNone(int fd, unsigned long drmCommandIndex); +extern int drmCommandRead(int fd, unsigned long drmCommandIndex, + void *data, unsigned long size); +extern int drmCommandWrite(int fd, unsigned long drmCommandIndex, + void *data, unsigned long size); +extern int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, + void *data, unsigned long size); - /* General user-level programmer's API: X server (root) only */ extern void drmFreeBusid(const char *busid); extern int drmSetBusid(int fd, const char *busid); @@ -523,6 +567,8 @@ extern int drmScatterGatherAlloc(int fd, unsigned long size, unsigned long *handle); extern int drmScatterGatherFree(int fd, unsigned long handle); + +extern int drmWaitVBlank(int fd, drmVBlankPtr vbl); /* Support routines */ extern int drmError(int err, const char *label); Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmCompat.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/xf86drmCompat.h:1.1 --- /dev/null Thu Feb 27 12:32:18 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmCompat.h Wed Oct 30 07:52:23 2002 @@ -0,0 +1,255 @@ +/* xf86drmCompat.h -- OS-independent header for old device specific DRM user-level + * library interface + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * + * Backwards compatability modules broken out by: + * Jens Owen <jens@tungstengraphics.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmCompat.h,v 1.1 2002/10/30 12:52:23 alanh Exp $ + * + */ + +#ifndef _XF86DRI_COMPAT_H_ +#define _XF86DRI_COMPAT_H_ + +/* WARNING: Do not change, or add, anything to this file. It is only provided + * for binary backwards compatability with the old driver specific DRM + * extensions used before XFree86 4.3. + */ + +/* I810 */ + +typedef struct { + unsigned int start; + unsigned int end; + unsigned int size; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_off; + + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int overlay_offset; + unsigned int overlay_physical; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; +} drmCompatI810Init; + +extern Bool drmI810CleanupDma(int driSubFD); +extern Bool drmI810InitDma(int driSubFD, drmCompatI810Init *info ); + +/* Mga */ + +typedef struct { + unsigned long sarea_priv_offset; + int chipset; + int sgram; + unsigned int maccess; + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + unsigned int texture_offset[2]; + unsigned int texture_size[2]; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long status_offset; + unsigned long warp_offset; + unsigned long primary_offset; + unsigned long buffers_offset; +} drmCompatMGAInit; + +extern int drmMGAInitDMA( int fd, drmCompatMGAInit *info ); +extern int drmMGACleanupDMA( int fd ); +extern int drmMGAFlushDMA( int fd, drmLockFlags flags ); +extern int drmMGAEngineReset( int fd ); +extern int drmMGAFullScreen( int fd, int enable ); +extern int drmMGASwapBuffers( int fd ); +extern int drmMGAClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); +extern int drmMGAFlushVertexBuffer( int fd, int indx, int used, int discard ); +extern int drmMGAFlushIndices( int fd, int indx, + int start, int end, int discard ); +extern int drmMGATextureLoad( int fd, int indx, + unsigned int dstorg, unsigned int length ); +extern int drmMGAAgpBlit( int fd, unsigned int planemask, + unsigned int src, int src_pitch, + unsigned int dst, int dst_pitch, + int delta_sx, int delta_sy, + int delta_dx, int delta_dy, + int height, int ydir ); + +/* R128 */ + +typedef struct { + unsigned long sarea_priv_offset; + int is_pci; + int cce_mode; + int cce_secure; + int ring_size; + int usec_timeout; + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drmCompatR128Init; + +extern int drmR128InitCCE( int fd, drmCompatR128Init *info ); +extern int drmR128CleanupCCE( int fd ); +extern int drmR128StartCCE( int fd ); +extern int drmR128StopCCE( int fd ); +extern int drmR128ResetCCE( int fd ); +extern int drmR128WaitForIdleCCE( int fd ); +extern int drmR128EngineReset( int fd ); +extern int drmR128FullScreen( int fd, int enable ); +extern int drmR128SwapBuffers( int fd ); +extern int drmR128Clear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); +extern int drmR128FlushVertexBuffer( int fd, int prim, int indx, + int count, int discard ); +extern int drmR128FlushIndices( int fd, int prim, int indx, + int start, int end, int discard ); +extern int drmR128TextureBlit( int fd, int indx, + int offset, int pitch, int format, + int x, int y, int width, int height ); +extern int drmR128WriteDepthSpan( int fd, int n, int x, int y, + const unsigned int depth[], + const unsigned char mask[] ); +extern int drmR128WriteDepthPixels( int fd, int n, + const int x[], const int y[], + const unsigned int depth[], + const unsigned char mask[] ); +extern int drmR128ReadDepthSpan( int fd, int n, int x, int y ); +extern int drmR128ReadDepthPixels( int fd, int n, + const int x[], const int y[] ); +extern int drmR128PolygonStipple( int fd, unsigned int *mask ); +extern int drmR128FlushIndirectBuffer( int fd, int indx, + int start, int end, int discard ); + +/* Radeon */ + +typedef struct { + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int agp_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drmCompatRadeonInit; + +typedef struct { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + void *data; +} drmCompatRadeonTexImage; + +extern int drmRadeonInitCP( int fd, drmCompatRadeonInit *info ); +extern int drmRadeonCleanupCP( int fd ); +extern int drmRadeonStartCP( int fd ); +extern int drmRadeonStopCP( int fd ); +extern int drmRadeonResetCP( int fd ); +extern int drmRadeonWaitForIdleCP( int fd ); +extern int drmRadeonEngineReset( int fd ); +extern int drmRadeonFullScreen( int fd, int enable ); +extern int drmRadeonSwapBuffers( int fd ); +extern int drmRadeonClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int stencil, + void *boxes, int nbox ); +extern int drmRadeonFlushVertexBuffer( int fd, int prim, int indx, + int count, int discard ); +extern int drmRadeonFlushIndices( int fd, int prim, int indx, + int start, int end, int discard ); +extern int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, + int width, int height, + drmCompatRadeonTexImage *image ); +extern int drmRadeonPolygonStipple( int fd, unsigned int *mask ); +extern int drmRadeonFlushIndirectBuffer( int fd, int indx, + int start, int end, int discard ); + +/* SiS */ +extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); + +/* I830 */ +typedef struct { + unsigned int start; + unsigned int end; + unsigned int size; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_off; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int cpp; +} drmCompatI830Init; + +extern Bool drmI830CleanupDma(int driSubFD); +extern Bool drmI830InitDma(int driSubFD, drmCompatI830Init *info ); + +#endif + +/* WARNING: Do not change, or add, anything to this file. It is only provided + * for binary backwards compatability with the old driver specific DRM + * extensions used before XFree86 4.3. + */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.4 xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.4 Thu Sep 27 04:25:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h Thu Feb 27 12:32:18 2003 @@ -1,49 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h,v 3.4 2001/09/27 08:25:04 alanh Exp $ */ - -/* WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (i810_drm.h) - */ - -#ifndef _XF86DRI_I810_H_ -#define _XF86DRI_I810_H_ - -#ifndef _I810_DEFINES_ -#define _I810_DEFINES_ -#define I810_USE_BATCH 1 - -#define I810_DMA_BUF_ORDER 12 -#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) -#define I810_DMA_BUF_NR 256 - -#define I810_NR_SAREA_CLIPRECTS 8 - -/* Each region is a minimum of 64k, and there are at most 64 of them. - */ -#define I810_NR_TEX_REGIONS 64 -#define I810_LOG_MIN_TEX_REGION_SIZE 16 -#endif - -typedef struct _drmI810Init { - unsigned int start; - unsigned int end; - unsigned int size; - unsigned int mmio_offset; - unsigned int buffers_offset; - int sarea_off; - - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int overlay_offset; - unsigned int overlay_physical; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; -} drmI810Init; - - -Bool drmI810CleanupDma(int driSubFD); -Bool drmI810InitDma(int driSubFD, drmI810Init *info ); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h:1.2 Thu Oct 4 14:32:29 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h Thu Feb 27 12:32:18 2003 @@ -1,186 +0,0 @@ -/************************************************************************** - -Copyright 2001 VA Linux Systems Inc., Fremont, California. - -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - - -**************************************************************************/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h,v 1.2 2001/10/04 18:32:29 alanh Exp $ */ - -/* Author: Jeff Hartmann <jhartmann@valinux.com> - */ - -#ifndef _I830_XF86DRM_H_ -#define _I830_XF86DRM_H_ - -/* WARNING: These defines must be the same as what the Xserver uses. - * if you change them, you must change the defines in the Xserver. - */ - -#ifndef _I830_DEFINES_ -#define _I830_DEFINES_ - -#define I830_DMA_BUF_ORDER 12 -#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) -#define I830_DMA_BUF_NR 256 -#define I830_NR_SAREA_CLIPRECTS 8 - -/* Each region is a minimum of 64k, and there are at most 64 of them. - */ -#define I830_NR_TEX_REGIONS 64 -#define I830_LOG_MIN_TEX_REGION_SIZE 16 - -/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ -#if !defined(I830_ENABLE_4_TEXTURES) -#define I830_TEXTURE_COUNT 2 -#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ -#else /* defined(I830_ENABLE_4_TEXTURES) */ -#define I830_TEXTURE_COUNT 4 -#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ -#endif /* I830_ENABLE_4_TEXTURES */ - -#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ - -#define I830_UPLOAD_CTX 0x1 -#define I830_UPLOAD_BUFFERS 0x2 -#define I830_UPLOAD_CLIPRECTS 0x4 -#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ -#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ -#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ -#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ -#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ -#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ -#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ -#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ -#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) -#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) -#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 -#define I830_UPLOAD_TEX0 0x10000 -#define I830_UPLOAD_TEX1 0x20000 -#define I830_UPLOAD_TEX2 0x40000 -#define I830_UPLOAD_TEX3 0x80000 -#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) -#define I830_UPLOAD_TEX_MASK 0xf0000 -#define I830_UPLOAD_TEXBLEND0 0x100000 -#define I830_UPLOAD_TEXBLEND1 0x200000 -#define I830_UPLOAD_TEXBLEND2 0x400000 -#define I830_UPLOAD_TEXBLEND3 0x800000 -#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) -#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 -#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) -#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 - -/* Indices into buf.Setup where various bits of state are mirrored per - * context and per buffer. These can be fired at the card as a unit, - * or in a piecewise fashion as required. - */ - -/* Destbuffer state - * - backbuffer linear offset and pitch -- invarient in the current dri - * - zbuffer linear offset and pitch -- also invarient - * - drawing origin in back and depth buffers. - * - * Keep the depth/back buffer state here to acommodate private buffers - * in the future. - */ - -#define I830_DESTREG_CBUFADDR 0 -/* Invarient */ -#define I830_DESTREG_DBUFADDR 1 -#define I830_DESTREG_DV0 2 -#define I830_DESTREG_DV1 3 -#define I830_DESTREG_SENABLE 4 -#define I830_DESTREG_SR0 5 -#define I830_DESTREG_SR1 6 -#define I830_DESTREG_SR2 7 -#define I830_DESTREG_DR0 8 -#define I830_DESTREG_DR1 9 -#define I830_DESTREG_DR2 10 -#define I830_DESTREG_DR3 11 -#define I830_DESTREG_DR4 12 -#define I830_DEST_SETUP_SIZE 13 - -/* Context state - */ -#define I830_CTXREG_STATE1 0 -#define I830_CTXREG_STATE2 1 -#define I830_CTXREG_STATE3 2 -#define I830_CTXREG_STATE4 3 -#define I830_CTXREG_STATE5 4 -#define I830_CTXREG_IALPHAB 5 -#define I830_CTXREG_STENCILTST 6 -#define I830_CTXREG_ENABLES_1 7 -#define I830_CTXREG_ENABLES_2 8 -#define I830_CTXREG_AA 9 -#define I830_CTXREG_FOGCOLOR 10 -#define I830_CTXREG_BLENDCOLR0 11 -#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ -#define I830_CTXREG_VF 13 -#define I830_CTXREG_VF2 14 -#define I830_CTXREG_MCSB0 15 -#define I830_CTXREG_MCSB1 16 -#define I830_CTX_SETUP_SIZE 17 - -/* Texture state (per tex unit) - */ - -#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ -#define I830_TEXREG_MI1 1 -#define I830_TEXREG_MI2 2 -#define I830_TEXREG_MI3 3 -#define I830_TEXREG_MI4 4 -#define I830_TEXREG_MI5 5 -#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ -#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ -#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ -#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ -#define I830_TEX_SETUP_SIZE 10 - - -#define I830_FRONT 0x1 -#define I830_BACK 0x2 -#define I830_DEPTH 0x4 -#endif /* _I830_DEFINES_ */ - -typedef struct _drmI830Init { - unsigned int start; - unsigned int end; - unsigned int size; - unsigned int mmio_offset; - unsigned int buffers_offset; - int sarea_off; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; - unsigned int cpp; -} drmI830Init; - -Bool drmI830CleanupDma(int driSubFD); -Bool drmI830InitDma(int driSubFD, drmI830Init *info ); - -#endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h:3.6 xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h:3.6 Mon Apr 16 11:02:13 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h Thu Feb 27 12:32:18 2003 @@ -1,71 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.6 2001/04/16 15:02:13 tsi Exp $ */ - -#ifndef __XF86DRI_MGA_H__ -#define __XF86DRI_MGA_H__ - -/* - * WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (mga_drm.h) - */ - -typedef struct { - int installed; - unsigned long phys_addr; - int size; -} drmMGAWarpIndex; - -typedef struct { - unsigned long sarea_priv_offset; - - int chipset; - int sgram; - - unsigned int maccess; - - unsigned int fb_cpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - - unsigned int depth_cpp; - unsigned int depth_offset, depth_pitch; - - unsigned int texture_offset[2]; - unsigned int texture_size[2]; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long status_offset; - unsigned long warp_offset; - unsigned long primary_offset; - unsigned long buffers_offset; -} drmMGAInit; - -extern int drmMGAInitDMA( int fd, drmMGAInit *info ); -extern int drmMGACleanupDMA( int fd ); - -extern int drmMGAFlushDMA( int fd, drmLockFlags flags ); - -extern int drmMGAEngineReset( int fd ); - -extern int drmMGAFullScreen( int fd, int enable ); - -extern int drmMGASwapBuffers( int fd ); -extern int drmMGAClear( int fd, unsigned int flags, - unsigned int clear_color, unsigned int clear_depth, - unsigned int color_mask, unsigned int depth_mask ); - -extern int drmMGAFlushVertexBuffer( int fd, int indx, int used, int discard ); -extern int drmMGAFlushIndices( int fd, int indx, - int start, int end, int discard ); - -extern int drmMGATextureLoad( int fd, int indx, - unsigned int dstorg, unsigned int length ); - -extern int drmMGAAgpBlit( int fd, unsigned int planemask, - unsigned int src, int src_pitch, - unsigned int dst, int dst_pitch, - int delta_sx, int delta_sy, - int delta_dx, int delta_dy, - int height, int ydir ); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h:3.11 xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h:3.11 Mon Apr 16 11:02:13 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h Thu Feb 27 12:32:18 2003 @@ -1,113 +0,0 @@ -/* xf86drm.h -- OS-independent header for DRM user-level library interface - * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.11 2001/04/16 15:02:13 tsi Exp $ - * - */ - -#ifndef _XF86DRI_R128_H_ -#define _XF86DRI_R128_H_ - -#include "X11/Xmd.h" - -/* - * WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (r128_drm.h) - */ - -#define DRM_R128_FRONT 0x1 -#define DRM_R128_BACK 0x2 -#define DRM_R128_DEPTH 0x4 - -typedef struct { - unsigned long sarea_priv_offset; - int is_pci; - int cce_mode; - int cce_secure; /* FIXME: Deprecated, we should remove this */ - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - unsigned int span_offset; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -} drmR128Init; - -extern int drmR128InitCCE( int fd, drmR128Init *info ); -extern int drmR128CleanupCCE( int fd ); - -extern int drmR128StartCCE( int fd ); -extern int drmR128StopCCE( int fd ); -extern int drmR128ResetCCE( int fd ); -extern int drmR128WaitForIdleCCE( int fd ); - -extern int drmR128EngineReset( int fd ); - -extern int drmR128FullScreen( int fd, int enable ); - -extern int drmR128SwapBuffers( int fd ); -extern int drmR128Clear( int fd, unsigned int flags, - unsigned int clear_color, unsigned int clear_depth, - unsigned int color_mask, unsigned int depth_mask ); - -extern int drmR128FlushVertexBuffer( int fd, int prim, int indx, - int count, int discard ); -extern int drmR128FlushIndices( int fd, int prim, int indx, - int start, int end, int discard ); - -extern int drmR128TextureBlit( int fd, int indx, - int offset, int pitch, int format, - int x, int y, int width, int height ); - -extern int drmR128WriteDepthSpan( int fd, int n, int x, int y, - const unsigned int depth[], - const unsigned char mask[] ); -extern int drmR128WriteDepthPixels( int fd, int n, - const int x[], const int y[], - const unsigned int depth[], - const unsigned char mask[] ); -extern int drmR128ReadDepthSpan( int fd, int n, int x, int y ); -extern int drmR128ReadDepthPixels( int fd, int n, - const int x[], const int y[] ); - -extern int drmR128PolygonStipple( int fd, unsigned int *mask ); - -extern int drmR128FlushIndirectBuffer( int fd, int indx, - int start, int end, int discard ); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h:1.6 xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h:1.6 Mon Apr 16 11:02:13 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h Thu Feb 27 12:32:18 2003 @@ -1,107 +0,0 @@ -/* xf86drmRadeon.h -- OS-independent header for Radeon DRM user-level - * library interface - * - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.6 2001/04/16 15:02:13 tsi Exp $ - * - */ - -#ifndef _XF86DRI_RADEON_H_ -#define _XF86DRI_RADEON_H_ - -/* WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (radeon_drm.h) - */ - -#define DRM_RADEON_FRONT 0x1 -#define DRM_RADEON_BACK 0x2 -#define DRM_RADEON_DEPTH 0x4 - -typedef struct { - unsigned long sarea_priv_offset; - int is_pci; - int cp_mode; - int agp_size; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -} drmRadeonInit; - -typedef struct { - unsigned int x; - unsigned int y; - unsigned int width; - unsigned int height; - void *data; -} drmRadeonTexImage; - -extern int drmRadeonInitCP( int fd, drmRadeonInit *info ); -extern int drmRadeonCleanupCP( int fd ); - -extern int drmRadeonStartCP( int fd ); -extern int drmRadeonStopCP( int fd ); -extern int drmRadeonResetCP( int fd ); -extern int drmRadeonWaitForIdleCP( int fd ); - -extern int drmRadeonEngineReset( int fd ); - -extern int drmRadeonFullScreen( int fd, int enable ); - -extern int drmRadeonSwapBuffers( int fd ); -extern int drmRadeonClear( int fd, unsigned int flags, - unsigned int clear_color, unsigned int clear_depth, - unsigned int color_mask, unsigned int depth_mask, - void *boxes, int nbox ); - -extern int drmRadeonFlushVertexBuffer( int fd, int prim, int indx, - int count, int discard ); -extern int drmRadeonFlushIndices( int fd, int prim, int indx, - int start, int end, int discard ); - -extern int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, - int width, int height, - drmRadeonTexImage *image ); - -extern int drmRadeonPolygonStipple( int fd, unsigned int *mask ); - -extern int drmRadeonFlushIndirectBuffer( int fd, int indx, - int start, int end, int discard ); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h:1.1 Fri Dec 14 19:59:12 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h Thu Feb 27 12:32:18 2003 @@ -1,8 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h,v 1.1 2001/12/15 00:59:12 dawes Exp $ */ - -#ifndef __XF86DRI_SIS_H__ -#define __XF86DRI_SIS_H__ - -extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.50 xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.57 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.50 Mon Dec 31 13:18:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile Mon Feb 17 11:37:19 2003 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.50 2001/12/31 18:18:49 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.57 2003/02/17 16:37:19 dawes Exp $ #include <Server.tmpl> @@ -23,26 +23,36 @@ #endif #endif -#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \ +#if defined(NetBSDArchitecture) \ && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2) -# if defined(ArcArchitecture) - IOPERMDEFINES = -DUSE_ARC_MMAP +# if defined(AlphaArchitecture) + IOPERMDEFINES = -DUSE_ALPHA_PIO +# elif defined(ArcArchitecture) + IOPERMDEFINES = -DUSE_ARC_MMAP # elif defined(Arm32Architecture) - IOPERMDEFINES = -DUSE_ARM32_MMAP -# elif defined(PpcArchitecture) + IOPERMDEFINES = -DUSE_ARM32_MMAP +# elif defined(PpcArchitecture) || \ + defined(Sparc64Architecture) IOPERM_SRC = ioperm_noop.c IOPERM_OBJ = ioperm_noop.o # else - IOPERMDEFINES = -DUSE_I386_IOPL + IOPERMDEFINES = -DUSE_I386_IOPL # endif +#elif defined(OpenBSDArchitecture) +# if defined(i386Architecture) + IOPERMDEFINES = -DUSE_I386_IOPL +# elif defined(PpcArchitecture) || defined(Sparc64Architecture) + IOPERM_SRC = ioperm_noop.c + IOPERM_OBJ = ioperm_noop.o +# endif #elif defined(FreeBSDArchitecture) && !defined(AlphaBsdArchitecture) - IOPERMDEFINES = -DUSE_DEV_IO + IOPERMDEFINES = -DUSE_DEV_IO #else # if defined(AlphaBsdArchitecture) - IOPERMDEFINES = -DUSE_ALPHA_PORTS + IOPERMDEFINES = -DUSE_ALPHA_PORTS # else -IOPERM_SRC = ioperm_noop.c -IOPERM_OBJ = ioperm_noop.o + IOPERM_SRC = ioperm_noop.c + IOPERM_OBJ = ioperm_noop.o # endif #endif @@ -54,6 +64,9 @@ MOUSESRC = bsd_mouse.c MOUSEOBJ = bsd_mouse.o +KBDSRC = bsd_kbd.c bsd_KbdMap.c at_scancode.c +KBDOBJ = bsd_kbd.o bsd_KbdMap.o at_scancode.o + #if HasMTRRSupport MTRRDEFINES = -DHAS_MTRR_SUPPORT #endif @@ -62,6 +75,10 @@ MTRRDEFINES = -DHAS_MTRR_BUILTIN #endif +#if defined(FreeBSDArchitecture) +SYSVIPCDEFINES = -DHAVE_SYSV_IPC +#endif + #if UsbMouseSupport USBMOUSEDEFINES1 = -DUSBMOUSE_SUPPORT #if !HasLibUsb @@ -117,16 +134,35 @@ AGP_SRC=agp_noop.c AGP_OBJ=agp_noop.o #endif + +#if defined(i386Architecture) +VIDEO_SRC = i386_video.c +VIDEO_OBJ = i386_video.o +#elif defined(AlphaArchitecture) +VIDEO_SRC = alpha_video.c +VIDEO_OBJ = alpha_video.o +#elif defined(PpcArchitecture) +VIDEO_SRC = ppc_video.c +VIDEO_OBJ = ppc_video.o +#elif defined(Arm32Architecture) +VIDEO_SRC = arm_video.c +VIDEO_OBJ = arm_video.o +#elif defined(Sparc64Architecture) +VIDEO_SRC = sparc64_video.c +VIDEO_OBJ = sparc64_video.o +#else +#error Unknown architecture ! +#endif -SRCS = bsd_init.c bsd_video.c bsd_io.c bsd_VTsw.c \ +SRCS = bsd_init.c $(VIDEO_SRC) bsd_io.c bsd_VTsw.c \ libc_wrapper.c $(IOPERM_SRC) std_kbdEv.c posix_tty.c $(MOUSESRC) \ $(RES_SRC) stdPci.c vidmem.c $(JOYSTICK_SRC) sigio.c $(APMSRC) \ - $(AXP_SRC) $(KMODSRC) $(AGP_SRC) + $(AXP_SRC) $(KMODSRC) $(AGP_SRC) $(KBDSRC) -OBJS = bsd_init.o bsd_video.o bsd_io.o bsd_VTsw.o \ +OBJS = bsd_init.o $(VIDEO_OBJ) bsd_io.o bsd_VTsw.o \ libc_wrapper.o $(IOPERM_OBJ) std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ $(RES_OBJ) stdPci.o vidmem.o $(JOYSTICK_OBJ) sigio.o $(APMOBJ) \ - $(AXP_OBJ) $(KMODOBJ) $(AGP_OBJ) + $(AXP_OBJ) $(KMODOBJ) $(AGP_OBJ) $(KBDOBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi $(APINCLUDES) \ @@ -135,14 +171,12 @@ CONSDEFINES = XFree86ConsoleDefines RESDEFINES = -DUSESTDRES -#if HasNetBSDApertureDriver -APDIR = NetBSDApertureDir +#if defined(HasNetBSDApertureDriver) && HasNetBSDApertureDriver APDEFINES = -DHAS_APERTURE_DRV -APINCLUDES = -I$(APDIR)/include #endif DEFINES = $(CONSDEFINES) $(APDEFINES) $(IOPERMDEFINES) $(RESDEFINES) \ - $(MTRRDEFINES) $(USBMOUSEDEFINES) + $(MTRRDEFINES) $(USBMOUSEDEFINES) $(SYSVIPCDEFINES) #if defined(AlphaArchitecture) SpecialObjectRule(bsd_ev56.o, bsd_ev56.c, -mcpu=ev56) @@ -176,6 +210,7 @@ #endif LinkSourceFile(ioperm_noop.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) +LinkSourceFile(at_scancode.c,../shared) LinkSourceFile(posix_tty.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c:1.2 --- /dev/null Thu Feb 27 12:32:19 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c Tue Oct 29 18:19:13 2002 @@ -0,0 +1,702 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.2 2002/10/29 23:19:13 herrb Exp $ */ +/* + * Copyright 1992 by Rich Murphey <Rich@Rice.edu> + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" + +#include <sys/param.h> +#ifndef __NetBSD__ +# include <sys/sysctl.h> +# else +# include <machine/sysarch.h> +#endif +#include "xf86Axp.h" + +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +#if defined(__NetBSD__) && !defined(MAP_FILE) +#define MAP_FLAGS MAP_SHARED +#else +#define MAP_FLAGS (MAP_FILE | MAP_SHARED) +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((caddr_t)-1) +#endif + +#ifndef __NetBSD__ +extern unsigned long dense_base(void); + +static int axpSystem = -1; +static unsigned long hae_thresh; +static unsigned long hae_mask; +static unsigned long bus_base; +static unsigned long sparse_size; + +static unsigned long +memory_base(void) +{ + static unsigned long base = 0; + + if (base == 0) { + size_t len = sizeof(base); + int error; +#ifdef __OpenBSD__ + int mib[3]; + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_CHIPSET; + mib[2] = CPU_CHIPSET_MEM; + + if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0) +#else + if ((error = sysctlbyname("hw.chipset.memory", &base, &len, + 0, 0)) < 0) +#endif + FatalError("xf86MapVidMem: can't find memory\n"); + } + + return base; +} + +static int +has_bwx(void) +{ + static int bwx = 0; + size_t len = sizeof(bwx); + int error; +#ifdef __OpenBSD__ + int mib[3]; + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_CHIPSET; + mib[2] = CPU_CHIPSET_BWX; + + if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0) + return FALSE; + else + return bwx; +#else + if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0) + return FALSE; + else + return bwx; +#endif +} +#else /* __NetBSD__ */ +static struct alpha_bus_window *abw; +static int abw_count = -1; + +static void +init_abw() +{ + if (abw_count < 0) { + abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw); + if (abw_count <= 0) + FatalError("init_abw: alpha_bus_getwindows failed\n"); + } +} + +static int +has_bwx(void) +{ + if (abw_count < 0) + init_abw(); + + xf86Msg(X_INFO, "has_bwx = %d\n", + abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */ + return abw[0].abw_abst.abst_flags & ABST_BWX; +} + +static unsigned long +dense_base() +{ + if (abw_count < 0) + init_abw(); + + /* XXX check abst_flags for ABST_DENSE just to be safe? */ + xf86Msg(X_INFO, "dense base = %#lx\n", + abw[0].abw_abst.abst_sys_start); /* XXXX */ + return abw[0].abw_abst.abst_sys_start; +} + +static unsigned long +memory_base() +{ + if (abw_count < 0) + init_abw(); + + if (abw_count > 0) { + xf86Msg(X_INFO, "memory base = %#lx\n", + abw[1].abw_abst.abst_sys_start); /* XXXX */ + return abw[1].abw_abst.abst_sys_start; + } else { + xf86Msg(X_INFO, "no memory base\n"); /* XXXX */ + return 0; + } +} +#endif /* __NetBSD__ */ + +#define BUS_BASE dense_base() +#define BUS_BASE_BWX memory_base() + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +#ifdef __OpenBSD__ +#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details" +#endif + +static Bool useDevMem = FALSE; +static int devMemFd = -1; + +#ifdef HAS_APERTURE_DRV +#define DEV_APERTURE "/dev/xf86" +#endif +#define DEV_MEM "/dev/mem" + +static pointer mapVidMem(int, unsigned long, unsigned long, int); +static void unmapVidMem(int, pointer, unsigned long); +static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); +static void unmapVidMemSparse(int, pointer, unsigned long); + +/* + * Check if /dev/mem can be mmap'd. If it can't print a warning when + * "warn" is TRUE. + */ +static void +checkDevMem(Bool warn) +{ + static Bool devMemChecked = FALSE; + int fd; + pointer base; + + if (devMemChecked) + return; + devMemChecked = TRUE; + +#ifdef HAS_APERTURE_DRV + /* Try the aperture driver first */ + if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { + /* Try to map a page at the VGA address */ + base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + + if (base != MAP_FAILED) { + munmap((caddr_t)base, 4096); + devMemFd = fd; + useDevMem = TRUE; + xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", + DEV_APERTURE); + return; + } else { + if (warn) { + xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", + DEV_APERTURE, strerror(errno)); + } + } + } +#endif + if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { + /* Try to map a page at the VGA address */ + base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + + if (base != MAP_FAILED) { + munmap((caddr_t)base, 4096); + devMemFd = fd; + useDevMem = TRUE; + return; + } else { + if (warn) { + xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", + DEV_MEM, strerror(errno)); + } + } + } + if (warn) { +#ifndef HAS_APERTURE_DRV + xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n", + DEV_MEM, strerror(errno)); + xf86ErrorF("\tlinear framebuffer access unavailable\n"); +#else +#ifndef __OpenBSD__ + xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" + "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); +#else /* __OpenBSD__ */ + xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" + "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), + SYSCTL_MSG); +#endif /* __OpenBSD__ */ + + xf86ErrorF("\tlinear framebuffer access unavailable\n"); + } + useDevMem = FALSE; + return; +#endif +} + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + checkDevMem(TRUE); + pVidMem->linearSupported = useDevMem; + + if (has_bwx()) { + xf86Msg(X_PROBED,"Machine type has 8/16 bit access\n"); + pVidMem->mapMem = mapVidMem; + pVidMem->unmapMem = unmapVidMem; + } else { + xf86Msg(X_PROBED,"Machine needs sparse mapping\n"); + pVidMem->mapMem = mapVidMemSparse; + pVidMem->unmapMem = unmapVidMemSparse; + if (axpSystem == -1) + axpSystem = bsdGetAXP(); + hae_thresh = xf86AXPParams[axpSystem].hae_thresh; + hae_mask = xf86AXPParams[axpSystem].hae_mask; + sparse_size = xf86AXPParams[axpSystem].size; + } + pVidMem->initialised = TRUE; +} + +static pointer +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + pointer base; + + checkDevMem(FALSE); + Base = Base & ((1L<<32) - 1); + + if (useDevMem) + { + if (devMemFd < 0) + { + FatalError("xf86MapVidMem: failed to open %s (%s)\n", + DEV_MEM, strerror(errno)); + } + base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, + MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); + if (base == MAP_FAILED) + { + FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", DEV_MEM, Size, Base, + strerror(errno)); + } + return(base); + } + + /* else, mmap /dev/vga */ + if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) + { + FatalError("%s: Address 0x%x outside allowable range\n", + "xf86MapVidMem", Base); + } + base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS, + xf86Info.screenFd, + (unsigned long)Base + BUS_BASE); + if (base == MAP_FAILED) + { + FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", + strerror(errno)); + } + return(base); +} + +static void +unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap((caddr_t)Base, Size); +} + +/* + * Read BIOS via mmap()ing DEV_MEM + */ + +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + unsigned char *ptr; + int psize; + int mlen; + + checkDevMem(TRUE); + if (devMemFd == -1) { + return(-1); + } + + psize = xf86getpagesize(); + Offset += Base & (psize - 1); + Base &= ~(psize - 1); + mlen = (Offset + Len + psize - 1) & ~(psize - 1); + ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, + MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); + if ((long)ptr == -1) + { + xf86Msg(X_WARNING, + "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n", + DEV_MEM, Len, Base, Offset, strerror(errno)); + return(-1); + } +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", + Base, ptr[0] | (ptr[1] << 8)); +#endif + (void)memcpy(Buf, (void *)(ptr + Offset), Len); + (void)munmap((caddr_t)ptr, mlen); +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" + "-> %02x %02x %02x %02x...\n", + Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); +#endif + return(Len); +} + + +#if defined(__FreeBSD__) || defined(__OpenBSD__) + +extern int ioperm(unsigned long from, unsigned long num, int on); + +void +xf86EnableIO() +{ + ioperm(0, 65536, TRUE); + return; +} + +void +xf86DisableIO() +{ + return; +} + +#endif /* __FreeBSD__ || __OpenBSD__ */ + +#ifdef USE_ALPHA_PIO + +void +xf86EnableIO() +{ + alpha_pci_io_enable(1); +} + +void +xf86DisableIO() +{ + alpha_pci_io_enable(0); +} + +#endif /* USE_ALPHA_PIO */ + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool +xf86DisableInterrupts() +{ + + return(TRUE); +} + +void +xf86EnableInterrupts() +{ + return; +} + + +#define vuip volatile unsigned int * + +static unsigned long msb_set = 0; +static pointer memSBase = 0; +static pointer memBase = 0; + +extern int readDense8(pointer Base, register unsigned long Offset); +extern int readDense16(pointer Base, register unsigned long Offset); +extern int readDense32(pointer Base, register unsigned long Offset); +extern void +writeDenseNB8(int Value, pointer Base, register unsigned long Offset); +extern void +writeDenseNB16(int Value, pointer Base, register unsigned long Offset); +extern void +writeDenseNB32(int Value, pointer Base, register unsigned long Offset); +extern void +writeDense8(int Value, pointer Base, register unsigned long Offset); +extern void +writeDense16(int Value, pointer Base, register unsigned long Offset); +extern void +writeDense32(int Value, pointer Base, register unsigned long Offset); + +static int readSparse8(pointer Base, register unsigned long Offset); +static int readSparse16(pointer Base, register unsigned long Offset); +static int readSparse32(pointer Base, register unsigned long Offset); +static void +writeSparseNB8(int Value, pointer Base, register unsigned long Offset); +static void +writeSparseNB16(int Value, pointer Base, register unsigned long Offset); +static void +writeSparseNB32(int Value, pointer Base, register unsigned long Offset); +static void +writeSparse8(int Value, pointer Base, register unsigned long Offset); +static void +writeSparse16(int Value, pointer Base, register unsigned long Offset); +static void +writeSparse32(int Value, pointer Base, register unsigned long Offset); + +#ifdef __FreeBSD__ +extern int sysarch(int, char *); +#endif + +struct parms { + u_int64_t hae; +}; + +static int +sethae(u_int64_t hae) +{ +#ifdef __FreeBSD__ + struct parms p; + p.hae = hae; + return (sysarch(ALPHA_SETHAE, (char *)&p)); +#endif +#ifdef __OpenBSD__ + return -1; +#endif +} + +static pointer +mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + static Bool was_here = FALSE; + + if (!was_here) { + was_here = TRUE; + + checkDevMem(FALSE); + + xf86WriteMmio8 = writeSparse8; + xf86WriteMmio16 = writeSparse16; + xf86WriteMmio32 = writeSparse32; + xf86WriteMmioNB8 = writeSparseNB8; + xf86WriteMmioNB16 = writeSparseNB16; + xf86WriteMmioNB32 = writeSparseNB32; + xf86ReadMmio8 = readSparse8; + xf86ReadMmio16 = readSparse16; + xf86ReadMmio32 = readSparse32; + + memBase = mmap((caddr_t)0, 0x100000000, + PROT_READ | PROT_WRITE, + MAP_SHARED, devMemFd, + (off_t) BUS_BASE); + memSBase = mmap((caddr_t)0, 0x100000000, + PROT_READ | PROT_WRITE, + MAP_SHARED, devMemFd, + (off_t) BUS_BASE_BWX); + + if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { + FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", + strerror(errno)); + } + } + return (pointer)((unsigned long)memBase + Base); +} + +static void +unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) +{ +} + +static int +readSparse8(pointer Base, register unsigned long Offset) +{ + register unsigned long result, shift; + register unsigned long msb; + + mem_barrier(); + Offset += (unsigned long)Base - (unsigned long)memBase; + shift = (Offset & 0x3) << 3; + if (Offset >= (hae_thresh)) { + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } + } + + result = *(vuip) ((unsigned long)memSBase + (Offset << 5)); + result >>= shift; + return 0xffUL & result; +} + +static int +readSparse16(pointer Base, register unsigned long Offset) +{ + register unsigned long result, shift; + register unsigned long msb; + + mem_barrier(); + Offset += (unsigned long)Base - (unsigned long)memBase; + shift = (Offset & 0x2) << 3; + if (Offset >= (hae_thresh)) { + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } + } + result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))); + result >>= shift; + return 0xffffUL & result; +} + +static int +readSparse32(pointer Base, register unsigned long Offset) +{ + mem_barrier(); + return *(vuip)((unsigned long)Base+(Offset)); +} + +static void +writeSparse8(int Value, pointer Base, register unsigned long Offset) +{ + register unsigned long msb; + register unsigned int b = Value & 0xffU; + + write_mem_barrier(); + Offset += (unsigned long)Base - (unsigned long)memBase; + if (Offset >= (hae_thresh)) { + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } + } + *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; +} + +static void +writeSparse16(int Value, pointer Base, register unsigned long Offset) +{ + register unsigned long msb; + register unsigned int w = Value & 0xffffU; + + write_mem_barrier(); + Offset += (unsigned long)Base - (unsigned long)memBase; + if (Offset >= (hae_thresh)) { + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } + } + *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = + w * 0x00010001; + +} + +static void +writeSparse32(int Value, pointer Base, register unsigned long Offset) +{ + write_mem_barrier(); + *(vuip)((unsigned long)Base + (Offset)) = Value; + return; +} + +static void +writeSparseNB8(int Value, pointer Base, register unsigned long Offset) +{ + register unsigned long msb; + register unsigned int b = Value & 0xffU; + + Offset += (unsigned long)Base - (unsigned long)memBase; + if (Offset >= (hae_thresh)) { + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } + } + *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; +} + +static void +writeSparseNB16(int Value, pointer Base, register unsigned long Offset) +{ + register unsigned long msb; + register unsigned int w = Value & 0xffffU; + + Offset += (unsigned long)Base - (unsigned long)memBase; + if (Offset >= (hae_thresh)) { + msb = Offset & hae_mask ; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } + } + *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = + w * 0x00010001; +} + +static void +writeSparseNB32(int Value, pointer Base, register unsigned long Offset) +{ + *(vuip)((unsigned long)Base + (Offset)) = Value; + return; +} + +void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset) + = writeDense8; +void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset) + = writeDense16; +void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset) + = writeDense32; +void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset) + = writeDenseNB8; +void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset) + = writeDenseNB16; +void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset) + = writeDenseNB32; +int (*xf86ReadMmio8)(pointer Base, unsigned long Offset) + = readDense8; +int (*xf86ReadMmio16)(pointer Base, unsigned long Offset) + = readDense16; +int (*xf86ReadMmio32)(pointer Base, unsigned long Offset) + = readDense32; + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c:1.1 --- /dev/null Thu Feb 27 12:32:19 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c Tue Aug 6 09:08:38 2002 @@ -0,0 +1,677 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v 1.1 2002/08/06 13:08:38 herrb Exp $ */ +/* + * Copyright 1992 by Rich Murphey <Rich@Rice.edu> + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* + * The ARM32 code here carries the following copyright: + * + * Copyright 1997 + * Digital Equipment Corporation. All rights reserved. + * This software is furnished under license and may be used and copied only in + * accordance with the following terms and conditions. Subject to these + * conditions, you may download, copy, install, use, modify and distribute + * this software in source and/or binary form. No title or ownership is + * transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce and retain + * this copyright notice and list of conditions as they appear in the + * source file. + * + * 2) No right is granted to use any trade name, trademark, or logo of Digital + * Equipment Corporation. Neither the "Digital Equipment Corporation" + * name nor any trademark or logo of Digital Equipment Corporation may be + * used to endorse or promote products derived from this software without + * the prior written permission of Digital Equipment Corporation. + * + * 3) This software is provided "AS-IS" and any express or implied warranties, + * including but not limited to, any implied warranties of merchantability, + * fitness for a particular purpose, or non-infringement are disclaimed. + * In no event shall DIGITAL be liable for any damages whatsoever, and in + * particular, DIGITAL shall not be liable for special, indirect, + * consequential, or incidental damages or damages for lost profits, loss + * of revenue or loss of use, whether such damages arise in contract, + * negligence, tort, under statute, in equity, at law or otherwise, even + * if advised of the possibility of such damage. + * + */ + +/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +#ifdef __arm32__ +#include "machine/devmap.h" +struct memAccess +{ + int ioctl; + struct map_info memInfo; + pointer regionVirtBase; + Bool Checked; + Bool OK; +}; + +static pointer xf86MapInfoMap(); +static void xf86MapInfoUnmap(); +static struct memAccess *checkMapInfo(); +extern int vgaPhysLinearBase; + +/* A memAccess structure is needed for each possible region */ +struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL, + FALSE, FALSE }; +struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL, + FALSE, FALSE }; +struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL, + FALSE, FALSE }; +#endif /* __arm32__ */ + +#if defined(__NetBSD__) && !defined(MAP_FILE) +#define MAP_FLAGS MAP_SHARED +#else +#define MAP_FLAGS (MAP_FILE | MAP_SHARED) +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((caddr_t)-1) +#endif + + +#define BUS_BASE 0L +#define BUS_BASE_BWX 0L + + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +static Bool useDevMem = FALSE; +static int devMemFd = -1; + +#define DEV_MEM "/dev/mem" + +static pointer mapVidMem(int, unsigned long, unsigned long, int); +static void unmapVidMem(int, pointer, unsigned long); + +/* + * Check if /dev/mem can be mmap'd. If it can't print a warning when + * "warn" is TRUE. + */ +static void +checkDevMem(Bool warn) +{ + static Bool devMemChecked = FALSE; + int fd; + pointer base; + + if (devMemChecked) + return; + devMemChecked = TRUE; + + if ((fd = open(DEV_MEM, O_RDWR)) >= 0) + { + /* Try to map a page at the VGA address */ + base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + + if (base != MAP_FAILED) + { + munmap((caddr_t)base, 4096); + devMemFd = fd; + useDevMem = TRUE; + return; + } else { + /* This should not happen */ + if (warn) + { + xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", + DEV_MEM, strerror(errno)); + } + useDevMem = FALSE; + return; + } + } + if (warn) + { + xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", + DEV_MEM, strerror(errno)); + } + useDevMem = FALSE; + return; +} + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + + checkDevMem(TRUE); + pVidMem->linearSupported = useDevMem; + pVidMem->mapMem = armMapVidMem; + pVidMem->unmapVidMem = armUnmapVidMem; + + pVidMem->initialised = TRUE; +} + +static pointer +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + pointer base; + + checkDevMem(FALSE); + + if (useDevMem) + { + if (devMemFd < 0) + { + FatalError("xf86MapVidMem: failed to open %s (%s)\n", + DEV_MEM, strerror(errno)); + } + base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, + MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); + if (base == MAP_FAILED) + { + FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", DEV_MEM, Size, Base, + strerror(errno)); + } + return(base); + } + + /* else, mmap /dev/vga */ + if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) + { + FatalError("%s: Address 0x%x outside allowable range\n", + "xf86MapVidMem", Base); + } + base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS, + xf86Info.screenFd, + (unsigned long)Base - 0xA0000); + if (base == MAP_FAILED) + { + FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", + strerror(errno)); + } + return(base); +} + +static void +unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap((caddr_t)Base, Size); +} + +/* + * Read BIOS via mmap()ing DEV_MEM + */ + +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + unsigned char *ptr; + int psize; + int mlen; + + checkDevMem(TRUE); + if (devMemFd == -1) { + return(-1); + } + + psize = xf86getpagesize(); + Offset += Base & (psize - 1); + Base &= ~(psize - 1); + mlen = (Offset + Len + psize - 1) & ~(psize - 1); + ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, + MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); + if ((long)ptr == -1) + { + xf86Msg(X_WARNING, + "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n", + DEV_MEM, Len, Base, Offset, strerror(errno)); + return(-1); + } +#ifdef DEBUG + ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", + Base, ptr[0] | (ptr[1] << 8)); +#endif + (void)memcpy(Buf, (void *)(ptr + Offset), Len); + (void)munmap((caddr_t)ptr, mlen); +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" + "-> %02x %02x %02x %02x...\n", + Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); +#endif + return(Len); +} + + +/* XXX This needs to be updated for the ND */ + +/* +** Find out whether the console driver provides memory mapping information +** for the specified region and return the map_info pointer. Print a warning if required. +*/ +static struct memAccess * +checkMapInfo(Bool warn, int Region) +{ + struct memAccess *memAccP; + + switch (Region) + { + case VGA_REGION: + memAccP = &vgaMemInfo; + break; + + case LINEAR_REGION: + memAccP = &linearMemInfo; + break; + + case MMIO_REGION: + memAccP = &ioMemInfo; + break; + + default: + return NULL; + break; + } + + if(!memAccP->Checked) + { + if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1) + { + if(warn) + { + xf86Msg(X_WARNING, + "checkMapInfo: failed to get map info for region %d\n\t(%s)\n", + Region, strerror(errno)); + } + } + else + { + if(memAccP->memInfo.u.map_info_mmap.map_offset + != MAP_INFO_UNKNOWN) + memAccP->OK = TRUE; + } + memAccP->Checked = TRUE; + } + if (memAccP->OK) + { + return memAccP; + } + else + { + return NULL; + } +} + +static pointer +xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size) +{ + struct map_info *mapInfoP = &(memInfoP->memInfo); + + if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) + { + Size = (unsigned long)Base + Size; + } + else + { + Size = mapInfoP->u.map_info_mmap.map_size; + } + + switch(mapInfoP->method) + { + case MAP_MMAP: + /* Need to remap if size is unknown because we may not have + mapped the whole region initially */ + if(memInfoP->regionVirtBase == NULL || + mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) + { + if((memInfoP->regionVirtBase = + mmap((caddr_t)0, + Size, + PROT_READ|PROT_WRITE, + MAP_SHARED, + xf86Info.screenFd, + (unsigned long)mapInfoP->u.map_info_mmap.map_offset)) + == (pointer)-1) + { + FatalError("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n", + mapInfoP->u.map_info_mmap.map_offset, strerror(errno)); + } + if(mapInfoP->u.map_info_mmap.internal_offset > 0) + memInfoP->regionVirtBase += + mapInfoP->u.map_info_mmap.internal_offset; + } + break; + + default: + FatalError("xf86MapInfoMap: Unsuported mapping method\n"); + break; + } + + return (pointer)((int)memInfoP->regionVirtBase + (int)Base); +} + +static void +xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size) +{ + struct map_info *mapInfoP = &(memInfoP->memInfo); + + switch(mapInfoP->method) + { + case MAP_MMAP: + if(memInfoP->regionVirtBase != NULL) + { + if(mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN) + Size = mapInfoP->u.map_info_mmap.map_size; + munmap((caddr_t)memInfoP->regionVirtBase, Size); + memInfoP->regionVirtBase = NULL; + } + break; + default: + FatalError("xf86MapInfoMap: Unsuported mapping method\n"); + break; + } +} + +static pointer +armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + struct memAccess *memInfoP; + + if((memInfoP = checkMapInfo(FALSE, Region)) != NULL) + { + /* + ** xf86 passes in a physical address offset from the start + ** of physical memory, but xf86MapInfoMap expects an + ** offset from the start of the specified region - it gets + ** the physical address of the region from the display driver. + */ + switch(Region) + { + case LINEAR_REGION: + if (vgaPhysLinearBase) + { + Base -= vgaPhysLinearBase; + } + break; + case VGA_REGION: + Base -= 0xA0000; + break; + } + + base = xf86MapInfoMap(memInfoP, Base, Size); + return (base); + } + return mapVidMem(ScreenNum, Base, Size, flags); +} + +static void +armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + struct memAccess *memInfoP; + + if((memInfoP = checkMapInfo(FALSE, Region)) != NULL) + { + xf86MapInfoUnmap(memInfoP, Base, Size); + } + unmapVidMem(ScreenNum, Base, Size); +} + +#ifdef USE_DEV_IO +static int IoFd = -1; + +void +xf86EnableIO() +{ + if (IoFd >= 0) + return; + + if ((IoFd = open("/dev/io", O_RDWR)) == -1) + { + FatalError("xf86EnableIO: " + "Failed to open /dev/io for extended I/O\n"); + } + return; +} + +void +xf86DisableIO() +{ + if (IoFd < 0) + return; + + close(IoFd); + IoFd = -1; + return; +} + +#endif + +#if defined(USE_ARC_MMAP) || defined(__arm32__) + +void +xf86EnableIO() +{ + int fd; + pointer base; + + if (ExtendedEnabled) + return; + + if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { + /* Try to map a page at the pccons I/O space */ + base = (pointer)mmap((caddr_t)0, 65536, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0x0000); + + if (base != (pointer)-1) { + IOPortBase = base; + } + else { + FatalError("EnableIO: failed to mmap %s (%s)\n", + "/dev/ttyC0", strerror(errno)); + } + } + else { + FatalError("EnableIO: failed to open %s (%s)\n", + "/dev/ttyC0", strerror(errno)); + } + + ExtendedEnabled = TRUE; + + return; +} + +void +xf86DisableIO() +{ + return; +} + +#endif /* USE_ARC_MMAP */ + + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool +xf86DisableInterrupts() +{ + + return(TRUE); +} + +void +xf86EnableInterrupts() +{ + + return; +} + + + +#if 0 +/* + * XXX This is here for reference. It needs to be handled differently for the + * ND. + */ +#if defined(USE_ARC_MMAP) || defined(__arm32__) + +#ifdef USE_ARM32_MMAP +#define DEV_MEM_IOBASE 0x43000000 +#endif + +static Bool ScreenEnabled[MAXSCREENS]; +static Bool ExtendedEnabled = FALSE; +static Bool InitDone = FALSE; + +void +xf86EnableIOPorts(ScreenNum) +int ScreenNum; +{ + int i; + int fd; + pointer base; + +#ifdef __arm32__ + struct memAccess *memInfoP; + int *Size; +#endif + + ScreenEnabled[ScreenNum] = TRUE; + + if (ExtendedEnabled) + return; + +#ifdef USE_ARC_MMAP + if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { + /* Try to map a page at the pccons I/O space */ + base = (pointer)mmap((caddr_t)0, 65536, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0x0000); + + if (base != (pointer)-1) { + IOPortBase = base; + } + else { + xf86Msg(X_ERROR, + "EnableIOPorts: failed to mmap %s (%s)\n", + "/dev/ttyC0", strerror(errno)); + } + } + else { + xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n", + "/dev/ttyC0", strerror(errno)); + } +#endif + +#ifdef __arm32__ + IOPortBase = (unsigned int)-1; + + if((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL) + { + /* + * xf86MapInfoMap maps an offset from the start of video IO + * space (e.g. 0x3B0), but IOPortBase is expected to map to + * physical address 0x000, so subtract the start of video I/O + * space from the result. This is safe for now becase we + * actually mmap the start of the page, then the start of video + * I/O space is added as an internal offset. + */ + IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP, + (caddr_t)0x0, 0L) + - memInfoP->memInfo.u.map_info_mmap.internal_offset; + ExtendedEnabled = TRUE; + return; + } +#ifdef USE_ARM32_MMAP + checkDevMem(TRUE); + + if (devMemFd >= 0 && useDevMem) + { + base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ|PROT_WRITE, + MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE); + + if (base != (pointer)-1) + IOPortBase = (unsigned int)base; + } + + if (IOPortBase == (unsigned int)-1) + { + FatalError("xf86EnableIOPorts: failed to open mem device or map IO base. \n\ +Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n"); + } +#else + /* We don't have the IOBASE, so we can't map the address */ + FatalError("xf86EnableIOPorts: failed to open mem device or map IO base. \n\ +Try building the server with USE_ARM32_MMAP defined\n"); +#endif +#endif + + ExtendedEnabled = TRUE; + + return; +} + +void +xf86DisableIOPorts(ScreenNum) +int ScreenNum; +{ + int i; +#ifdef __arm32__ + struct memAccess *memInfoP; +#endif + + ScreenEnabled[ScreenNum] = FALSE; + +#ifdef __arm32__ + if((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL) + { + xf86MapInfoUnmap(memInfoP, 0); + } +#endif + +#ifdef USE_ARM32_MMAP + if (!ExtendedEnabled) + return; + + for (i = 0; i < MAXSCREENS; i++) + if (ScreenEnabled[i]) + return; + + munmap((caddr_t)IOPortBase, 0x400); + IOPortBase = (unsigned int)-1; + ExtendedEnabled = FALSE; +#endif + + return; +} + +#endif /* USE_ARC_MMAP || USE_ARM32_MMAP */ +#endif + + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c:1.6 Fri Feb 16 09:45:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c Wed May 22 17:38:29 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.6 2001/02/16 14:45:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.8 2002/05/22 21:38:29 herrb Exp $ */ /* Resource information code */ @@ -11,12 +11,15 @@ #define NEED_OS_RAC_PROTOS #include "xf86_OSlib.h" -#ifdef __alpha__ +/* Avoid Imakefile changes */ +#include "bus/Pci.h" -#include <sys/sysctl.h> - resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; +#ifdef INCLUDE_XF86_NO_DOMAIN + +#if defined(__alpha__) || defined(__sparc64__) + resPtr xf86BusAccWindowsFromOS(void) { @@ -52,6 +55,8 @@ return ret; } +#ifdef INCLUDE_UNUSED + resPtr xf86IsaBusAccWindowsFromOS(void) { @@ -66,6 +71,8 @@ return ret; } +#endif /* INCLUDE_UNUSED */ + resPtr xf86AccResFromOS(resPtr ret) { @@ -107,8 +114,6 @@ #elif defined(__powerpc__) -resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; - resPtr xf86BusAccWindowsFromOS(void) { @@ -137,6 +142,8 @@ return ret; } +#ifdef INCLUDE_UNUSED + resPtr xf86IsaBusAccWindowsFromOS(void) { @@ -151,6 +158,8 @@ return ret; } +#endif /* INCLUDE_UNUSED */ + resPtr xf86AccResFromOS(resPtr ret) { @@ -177,3 +186,5 @@ #error : Put your platform dependent code here!! #endif + +#endif /* INCLUDE_XF86_NO_DOMAIN */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c:1.1 --- /dev/null Thu Feb 27 12:32:19 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c Thu Oct 10 21:40:34 2002 @@ -0,0 +1,1075 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c,v 1.1 2002/10/11 01:40:34 dawes Exp $ */ + +/* + * Slightly modified xf86KbdBSD.c which is + * + * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) + * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * and from xf86KbdCODrv.c by Holger Veit + */ + +#include "X.h" +#include "Xmd.h" +#include "input.h" +#include "scrnintstr.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" +#include "xf86Xinput.h" +#include "xf86OSKbd.h" +#include "atKeynames.h" +#include "xf86Keymap.h" +#include "bsd_kbd.h" + +#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP) +#define KD_GET_ENTRY(i,n) \ + eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] + +static unsigned char remap[NUM_KEYCODES] = { + 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ + 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ + 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ + 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ +}; + +/* This table assumes the ibm code page 437 coding for characters + * > 0x80. They are returned in this form by PCVT */ +static KeySym eascii_to_x[512] = { + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, + NoSymbol, XK_Return, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, XK_Escape, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_space, XK_exclam, XK_quotedbl, XK_numbersign, + XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, + XK_parenleft, XK_parenright, XK_asterisk, XK_plus, + XK_comma, XK_minus, XK_period, XK_slash, + XK_0, XK_1, XK_2, XK_3, + XK_4, XK_5, XK_6, XK_7, + XK_8, XK_9, XK_colon, XK_semicolon, + XK_less, XK_equal, XK_greater, XK_question, + XK_at, XK_A, XK_B, XK_C, + XK_D, XK_E, XK_F, XK_G, + XK_H, XK_I, XK_J, XK_K, + XK_L, XK_M, XK_N, XK_O, + XK_P, XK_Q, XK_R, XK_S, + XK_T, XK_U, XK_V, XK_W, + XK_X, XK_Y, XK_Z, XK_bracketleft, + XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, + XK_grave, XK_a, XK_b, XK_c, + XK_d, XK_e, XK_f, XK_g, + XK_h, XK_i, XK_j, XK_k, + XK_l, XK_m, XK_n, XK_o, + XK_p, XK_q, XK_r, XK_s, + XK_t, XK_u, XK_v, XK_w, + XK_x, XK_y, XK_z, XK_braceleft, + XK_bar, XK_braceright, XK_asciitilde, XK_Delete, + XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, + XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, + XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, + XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, + XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, + XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, + XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, + XK_sterling, XK_yen, XK_paragraph, XK_section, + XK_aacute, XK_iacute, XK_oacute, XK_uacute, + XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, + XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, + XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, + XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, + XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, + XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, + XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, + XK_topintegral, XK_botintegral, XK_division, XK_similarequal, + XK_degree, NoSymbol, NoSymbol, XK_radical, + XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, + + /* + * special marked entries (256 + x) + */ + + /* This has been checked against what syscons actually does */ + NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, + XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, + XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, XK_F1, + XK_F2, XK_F3, XK_F4, XK_F5, + XK_F6, XK_F7, XK_F8, XK_F9, + XK_F10, XK_F11, XK_F12, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol +}; + +#ifdef __OpenBSD__ +/* don't mark AltR and CtrlR for remapping, since they + * cannot be remapped by pccons */ +static unsigned char pccons_remap[128] = { + 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ + 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ + 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ +}; + +/* This table assumes an iso8859_1 encoding for the characters + * > 80, as returned by pccons */ +static KeySym latin1_to_x[256] = { + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, + NoSymbol, XK_Return, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, XK_Escape, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_space, XK_exclam, XK_quotedbl, XK_numbersign, + XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, + XK_parenleft, XK_parenright, XK_asterisk, XK_plus, + XK_comma, XK_minus, XK_period, XK_slash, + XK_0, XK_1, XK_2, XK_3, + XK_4, XK_5, XK_6, XK_7, + XK_8, XK_9, XK_colon, XK_semicolon, + XK_less, XK_equal, XK_greater, XK_question, + XK_at, XK_A, XK_B, XK_C, + XK_D, XK_E, XK_F, XK_G, + XK_H, XK_I, XK_J, XK_K, + XK_L, XK_M, XK_N, XK_O, + XK_P, XK_Q, XK_R, XK_S, + XK_T, XK_U, XK_V, XK_W, + XK_X, XK_Y, XK_Z, XK_bracketleft, + XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, + XK_grave, XK_a, XK_b, XK_c, + XK_d, XK_e, XK_f, XK_g, + XK_h, XK_i, XK_j, XK_k, + XK_l, XK_m, XK_n, XK_o, + XK_p, XK_q, XK_r, XK_s, + XK_t, XK_u, XK_v, XK_w, + XK_x, XK_y, XK_z, XK_braceleft, + XK_bar, XK_braceright, XK_asciitilde, XK_Delete, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, + XK_currency, XK_yen, XK_brokenbar, XK_section, + XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, + XK_notsign, XK_hyphen, XK_registered, XK_macron, + XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, + XK_acute, XK_mu, XK_paragraph, XK_periodcentered, + XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, + XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, + XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, + XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, + XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, + XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, + XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, + XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, + XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, + XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, + XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, + XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, + XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, + XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, + XK_eth, XK_ntilde, XK_ograve, XK_oacute, + XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, + XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, + XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis + }; +#endif + +#ifdef SYSCONS_SUPPORT +static +unsigned char sysconsCODEMap[] = { + KEY_KP_Enter, KEY_RCtrl, KEY_KP_Divide, KEY_Print, + KEY_AltLang, KEY_KP_7, KEY_KP_8, KEY_KP_9, + KEY_KP_4, KEY_KP_6, KEY_KP_1, KEY_KP_2, + KEY_KP_3, KEY_KP_0, KEY_KP_Decimal, KEY_Pause, + KEY_LMeta, KEY_RMeta, KEY_Menu, KEY_Break +}; +static +TransMapRec sysconsCODE = { + 0x59, + 0x6d, + sysconsCODEMap +}; +#endif +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ + +#ifdef WSCONS_SUPPORT + +static CARD8 wsUsbMap[] = { + /* 0 */ KEY_NOTUSED, + /* 1 */ KEY_NOTUSED, + /* 2 */ KEY_NOTUSED, + /* 3 */ KEY_NOTUSED, + /* 4 */ KEY_A, + /* 5 */ KEY_B, + /* 6 */ KEY_C, + /* 7 */ KEY_D, + /* 8 */ KEY_E, + /* 9 */ KEY_F, + /* 10 */ KEY_G, + /* 11 */ KEY_H, + /* 12 */ KEY_I, + /* 13 */ KEY_J, + /* 14 */ KEY_K, + /* 15 */ KEY_L, + /* 16 */ KEY_M, + /* 17 */ KEY_N, + /* 18 */ KEY_O, + /* 19 */ KEY_P, + /* 20 */ KEY_Q, + /* 21 */ KEY_R, + /* 22 */ KEY_S, + /* 23 */ KEY_T, + /* 24 */ KEY_U, + /* 25 */ KEY_V, + /* 26 */ KEY_W, + /* 27 */ KEY_X, + /* 28 */ KEY_Y, + /* 29 */ KEY_Z, + /* 30 */ KEY_1, /* 1 !*/ + /* 31 */ KEY_2, /* 2 @ */ + /* 32 */ KEY_3, /* 3 # */ + /* 33 */ KEY_4, /* 4 $ */ + /* 34 */ KEY_5, /* 5 % */ + /* 35 */ KEY_6, /* 6 ^ */ + /* 36 */ KEY_7, /* 7 & */ + /* 37 */ KEY_8, /* 8 * */ + /* 38 */ KEY_9, /* 9 ( */ + /* 39 */ KEY_0, /* 0 ) */ + /* 40 */ KEY_Enter, /* Return */ + /* 41 */ KEY_Escape, /* Escape */ + /* 42 */ KEY_BackSpace, /* Backspace Delete */ + /* 43 */ KEY_Tab, /* Tab */ + /* 44 */ KEY_Space, /* Space */ + /* 45 */ KEY_Minus, /* - _ */ + /* 46 */ KEY_Equal, /* = + */ + /* 47 */ KEY_LBrace, /* [ { */ + /* 48 */ KEY_RBrace, /* ] } */ + /* 49 */ KEY_BSlash, /* \ | */ + /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */ + /* 51 */ KEY_SemiColon, /* ; : */ + /* 52 */ KEY_Quote, /* ' " */ + /* 53 */ KEY_Tilde, /* ` ~ */ + /* 54 */ KEY_Comma, /* , < */ + /* 55 */ KEY_Period, /* . > */ + /* 56 */ KEY_Slash, /* / ? */ + /* 57 */ KEY_CapsLock, /* Caps Lock */ + /* 58 */ KEY_F1, /* F1 */ + /* 59 */ KEY_F2, /* F2 */ + /* 60 */ KEY_F3, /* F3 */ + /* 61 */ KEY_F4, /* F4 */ + /* 62 */ KEY_F5, /* F5 */ + /* 63 */ KEY_F6, /* F6 */ + /* 64 */ KEY_F7, /* F7 */ + /* 65 */ KEY_F8, /* F8 */ + /* 66 */ KEY_F9, /* F9 */ + /* 67 */ KEY_F10, /* F10 */ + /* 68 */ KEY_F11, /* F11 */ + /* 69 */ KEY_F12, /* F12 */ + /* 70 */ KEY_Print, /* PrintScrn SysReq */ + /* 71 */ KEY_ScrollLock, /* Scroll Lock */ + /* 72 */ KEY_Pause, /* Pause Break */ + /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ + /* 74 */ KEY_Home, /* Home */ + /* 75 */ KEY_PgUp, /* Page Up */ + /* 76 */ KEY_Delete, /* Delete */ + /* 77 */ KEY_End, /* End */ + /* 78 */ KEY_PgDown, /* Page Down */ + /* 79 */ KEY_Right, /* Right Arrow */ + /* 80 */ KEY_Left, /* Left Arrow */ + /* 81 */ KEY_Down, /* Down Arrow */ + /* 82 */ KEY_Up, /* Up Arrow */ + /* 83 */ KEY_NumLock, /* Num Lock */ + /* 84 */ KEY_KP_Divide, /* Keypad / */ + /* 85 */ KEY_KP_Multiply, /* Keypad * */ + /* 86 */ KEY_KP_Minus, /* Keypad - */ + /* 87 */ KEY_KP_Plus, /* Keypad + */ + /* 88 */ KEY_KP_Enter, /* Keypad Enter */ + /* 89 */ KEY_KP_1, /* Keypad 1 End */ + /* 90 */ KEY_KP_2, /* Keypad 2 Down */ + /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ + /* 92 */ KEY_KP_4, /* Keypad 4 Left */ + /* 93 */ KEY_KP_5, /* Keypad 5 */ + /* 94 */ KEY_KP_6, /* Keypad 6 */ + /* 95 */ KEY_KP_7, /* Keypad 7 Home */ + /* 96 */ KEY_KP_8, /* Keypad 8 Up */ + /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ + /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ + /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ + /* 100 */ KEY_Less, /* < > on some keyboards */ + /* 101 */ KEY_Menu, /* Menu */ + /* 102 */ KEY_NOTUSED, + /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ + /* 104 */ KEY_NOTUSED, + /* 105 */ KEY_NOTUSED, + /* 106 */ KEY_NOTUSED, + /* 107 */ KEY_NOTUSED, + /* 108 */ KEY_NOTUSED, + /* 109 */ KEY_NOTUSED, + /* 110 */ KEY_NOTUSED, + /* 111 */ KEY_NOTUSED, + /* 112 */ KEY_NOTUSED, + /* 113 */ KEY_NOTUSED, + /* 114 */ KEY_NOTUSED, + /* 115 */ KEY_NOTUSED, + /* 116 */ KEY_NOTUSED, + /* 117 */ KEY_NOTUSED, + /* 118 */ KEY_NOTUSED, + /* 119 */ KEY_NOTUSED, + /* 120 */ KEY_NOTUSED, + /* 121 */ KEY_NOTUSED, + /* 122 */ KEY_NOTUSED, + /* 123 */ KEY_NOTUSED, + /* 124 */ KEY_NOTUSED, + /* 125 */ KEY_NOTUSED, + /* 126 */ KEY_NOTUSED, + /* 127 */ KEY_NOTUSED, + /* 128 */ KEY_NOTUSED, + /* 129 */ KEY_NOTUSED, + /* 130 */ KEY_NOTUSED, + /* 131 */ KEY_NOTUSED, + /* 132 */ KEY_NOTUSED, + /* 133 */ KEY_NOTUSED, + /* 134 */ KEY_NOTUSED, + /* 135 */ KEY_NOTUSED, + /* 136 */ KEY_NOTUSED, + /* 137 */ KEY_NOTUSED, + /* 138 */ KEY_NOTUSED, + /* 139 */ KEY_NOTUSED, + /* 140 */ KEY_NOTUSED, + /* 141 */ KEY_NOTUSED, + /* 142 */ KEY_NOTUSED, + /* 143 */ KEY_NOTUSED, + /* 144 */ KEY_NOTUSED, + /* 145 */ KEY_NOTUSED, + /* 146 */ KEY_NOTUSED, + /* 147 */ KEY_NOTUSED, + /* 148 */ KEY_NOTUSED, + /* 149 */ KEY_NOTUSED, + /* 150 */ KEY_NOTUSED, + /* 151 */ KEY_NOTUSED, + /* 152 */ KEY_NOTUSED, + /* 153 */ KEY_NOTUSED, + /* 154 */ KEY_NOTUSED, + /* 155 */ KEY_NOTUSED, + /* 156 */ KEY_NOTUSED, + /* 157 */ KEY_NOTUSED, + /* 158 */ KEY_NOTUSED, + /* 159 */ KEY_NOTUSED, + /* 160 */ KEY_NOTUSED, + /* 161 */ KEY_NOTUSED, + /* 162 */ KEY_NOTUSED, + /* 163 */ KEY_NOTUSED, + /* 164 */ KEY_NOTUSED, + /* 165 */ KEY_NOTUSED, + /* 166 */ KEY_NOTUSED, + /* 167 */ KEY_NOTUSED, + /* 168 */ KEY_NOTUSED, + /* 169 */ KEY_NOTUSED, + /* 170 */ KEY_NOTUSED, + /* 171 */ KEY_NOTUSED, + /* 172 */ KEY_NOTUSED, + /* 173 */ KEY_NOTUSED, + /* 174 */ KEY_NOTUSED, + /* 175 */ KEY_NOTUSED, + /* 176 */ KEY_NOTUSED, + /* 177 */ KEY_NOTUSED, + /* 178 */ KEY_NOTUSED, + /* 179 */ KEY_NOTUSED, + /* 180 */ KEY_NOTUSED, + /* 181 */ KEY_NOTUSED, + /* 182 */ KEY_NOTUSED, + /* 183 */ KEY_NOTUSED, + /* 184 */ KEY_NOTUSED, + /* 185 */ KEY_NOTUSED, + /* 186 */ KEY_NOTUSED, + /* 187 */ KEY_NOTUSED, + /* 188 */ KEY_NOTUSED, + /* 189 */ KEY_NOTUSED, + /* 190 */ KEY_NOTUSED, + /* 191 */ KEY_NOTUSED, + /* 192 */ KEY_NOTUSED, + /* 193 */ KEY_NOTUSED, + /* 194 */ KEY_NOTUSED, + /* 195 */ KEY_NOTUSED, + /* 196 */ KEY_NOTUSED, + /* 197 */ KEY_NOTUSED, + /* 198 */ KEY_NOTUSED, + /* 199 */ KEY_NOTUSED, + /* 200 */ KEY_NOTUSED, + /* 201 */ KEY_NOTUSED, + /* 202 */ KEY_NOTUSED, + /* 203 */ KEY_NOTUSED, + /* 204 */ KEY_NOTUSED, + /* 205 */ KEY_NOTUSED, + /* 206 */ KEY_NOTUSED, + /* 207 */ KEY_NOTUSED, + /* 208 */ KEY_NOTUSED, + /* 209 */ KEY_NOTUSED, + /* 210 */ KEY_NOTUSED, + /* 211 */ KEY_NOTUSED, + /* 212 */ KEY_NOTUSED, + /* 213 */ KEY_NOTUSED, + /* 214 */ KEY_NOTUSED, + /* 215 */ KEY_NOTUSED, + /* 216 */ KEY_NOTUSED, + /* 217 */ KEY_NOTUSED, + /* 218 */ KEY_NOTUSED, + /* 219 */ KEY_NOTUSED, + /* 220 */ KEY_NOTUSED, + /* 221 */ KEY_NOTUSED, + /* 222 */ KEY_NOTUSED, + /* 223 */ KEY_NOTUSED, + /* 224 */ KEY_LCtrl, /* Left Control */ + /* 225 */ KEY_ShiftL, /* Left Shift */ + /* 226 */ KEY_Alt, /* Left Alt */ + /* 227 */ KEY_LMeta, /* Left Meta */ + /* 228 */ KEY_RCtrl, /* Right Control */ + /* 229 */ KEY_ShiftR, /* Right Shift */ + /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ + /* 231 */ KEY_LMeta, /* Right Meta XXX */ +}; +#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char)) + +static +TransMapRec wsUsb = { + 0, + WS_USB_MAP_SIZE, + wsUsbMap +}; + +/* Map for adb keyboards */ +static CARD8 wsAdbMap[] = { + /* 0 */ KEY_A, + /* 1 */ KEY_S, + /* 2 */ KEY_D, + /* 3 */ KEY_F, + /* 4 */ KEY_H, + /* 5 */ KEY_G, + /* 6 */ KEY_Z, + /* 7 */ KEY_X, + /* 8 */ KEY_C, + /* 9 */ KEY_V, + /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */ + /* 11 */ KEY_B, + /* 12 */ KEY_Q, + /* 13 */ KEY_W, + /* 14 */ KEY_E, + /* 15 */ KEY_R, + /* 16 */ KEY_Y, + /* 17 */ KEY_T, + /* 18 */ KEY_1, + /* 19 */ KEY_2, + /* 20 */ KEY_3, + /* 21 */ KEY_4, + /* 22 */ KEY_6, + /* 23 */ KEY_5, + /* 24 */ KEY_Equal, + /* 25 */ KEY_9, + /* 26 */ KEY_7, + /* 27 */ KEY_Minus, + /* 28 */ KEY_8, + /* 29 */ KEY_0, + /* 30 */ KEY_RBrace, + /* 31 */ KEY_O, + /* 32 */ KEY_U, + /* 33 */ KEY_LBrace, + /* 34 */ KEY_I, + /* 35 */ KEY_P, + /* 36 */ KEY_Enter, + /* 37 */ KEY_L, + /* 38 */ KEY_J, + /* 39 */ KEY_Quote, + /* 40 */ KEY_K, + /* 41 */ KEY_SemiColon, + /* 42 */ KEY_BSlash, + /* 43 */ KEY_Comma, + /* 44 */ KEY_Slash, + /* 45 */ KEY_N, + /* 46 */ KEY_M, + /* 47 */ KEY_Period, + /* 48 */ KEY_Tab, + /* 49 */ KEY_Space, + /* 50 */ KEY_Tilde, + /* 51 */ KEY_Delete, + /* 52 */ KEY_AltLang, + /* 53 */ KEY_Escape, + /* 54 */ KEY_LCtrl, + /* 55 */ KEY_Alt, + /* 56 */ KEY_ShiftL, + /* 57 */ KEY_CapsLock, + /* 58 */ KEY_LMeta, + /* 59 */ KEY_Left, + /* 60 */ KEY_Right, + /* 61 */ KEY_Down, + /* 62 */ KEY_Up, + /* 63 */ KEY_UNKNOWN, /* Fn */ + /* 64 */ KEY_NOTUSED, + /* 65 */ KEY_KP_Decimal, + /* 66 */ KEY_NOTUSED, + /* 67 */ KEY_KP_Multiply, + /* 68 */ KEY_NOTUSED, + /* 69 */ KEY_KP_Plus, + /* 70 */ KEY_NOTUSED, + /* 71 */ KEY_UNKNOWN, /* Clear */ + /* 72 */ KEY_NOTUSED, + /* 73 */ KEY_NOTUSED, + /* 74 */ KEY_NOTUSED, + /* 75 */ KEY_KP_Divide, + /* 76 */ KEY_KP_Enter, + /* 77 */ KEY_NOTUSED, + /* 78 */ KEY_KP_Minus, + /* 79 */ KEY_NOTUSED, + /* 80 */ KEY_NOTUSED, + /* 81 */ KEY_KP_Equal, /* Keypad = */ + /* 82 */ KEY_KP_0, + /* 83 */ KEY_KP_1, + /* 84 */ KEY_KP_2, + /* 85 */ KEY_KP_3, + /* 86 */ KEY_KP_4, + /* 87 */ KEY_KP_5, + /* 88 */ KEY_KP_6, + /* 89 */ KEY_KP_7, + /* 90 */ KEY_NOTUSED, + /* 91 */ KEY_KP_8, + /* 92 */ KEY_KP_9, + /* 93 */ KEY_NOTUSED, + /* 94 */ KEY_NOTUSED, + /* 95 */ KEY_UNKNOWN, /* Keypad , */ + /* 96 */ KEY_F5, + /* 97 */ KEY_F6, + /* 98 */ KEY_F7, + /* 99 */ KEY_F3, + /* 100 */ KEY_F8, + /* 101 */ KEY_F9, + /* 102 */ KEY_NOTUSED, + /* 103 */ KEY_F11, + /* 104 */ KEY_NOTUSED, + /* 105 */ KEY_NOTUSED, + /* 106 */ KEY_KP_Enter, + /* 107 */ KEY_NOTUSED, + /* 108 */ KEY_NOTUSED, + /* 109 */ KEY_F10, + /* 110 */ KEY_NOTUSED, + /* 111 */ KEY_F12, + /* 112 */ KEY_NOTUSED, + /* 113 */ KEY_NOTUSED, + /* 114 */ KEY_NOTUSED, + /* 115 */ KEY_Home, + /* 116 */ KEY_PgUp, + /* 117 */ KEY_NOTUSED, + /* 118 */ KEY_F4, + /* 119 */ KEY_End, + /* 120 */ KEY_F2, + /* 121 */ KEY_PgDown, + /* 122 */ KEY_F1 +}; +#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) + +static +TransMapRec wsAdb = { + 0, + WS_ADB_MAP_SIZE, + wsAdbMap +}; + +static CARD8 wsSunMap[] = { + /* 0x00 */ KEY_NOTUSED, + /* 0x01 */ KEY_NOTUSED, /* stop */ + /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */ + /* 0x03 */ KEY_NOTUSED, /* again */ + /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */ + /* 0x05 */ KEY_F1, + /* 0x06 */ KEY_F2, + /* 0x07 */ KEY_F10, + /* 0x08 */ KEY_F3, + /* 0x09 */ KEY_F11, + /* 0x0a */ KEY_F4, + /* 0x0b */ KEY_F12, + /* 0x0c */ KEY_F5, + /* 0x0d */ KEY_AltLang, + /* 0x0e */ KEY_F6, + /* 0x0f */ KEY_NOTUSED, + /* 0x10 */ KEY_F7, + /* 0x11 */ KEY_F8, + /* 0x12 */ KEY_F9, + /* 0x13 */ KEY_Alt, + /* 0x14 */ KEY_Up, + /* 0x15 */ KEY_Pause, + /* 0x16 */ KEY_Print, + /* 0x17 */ KEY_NOTUSED, /* props */ + /* 0x18 */ KEY_Left, + /* 0x19 */ KEY_ScrollLock, + /* 0x1a */ KEY_NOTUSED, /* undo */ + /* 0x1b */ KEY_Down, + /* 0x1c */ KEY_Right, + /* 0x1d */ KEY_Escape, + /* 0x1e */ KEY_1, + /* 0x1f */ KEY_2, + /* 0x20 */ KEY_3, + /* 0x21 */ KEY_4, + /* 0x22 */ KEY_5, + /* 0x23 */ KEY_6, + /* 0x24 */ KEY_7, + /* 0x25 */ KEY_8, + /* 0x26 */ KEY_9, + /* 0x27 */ KEY_0, + /* 0x28 */ KEY_Minus, + /* 0x29 */ KEY_Equal, + /* 0x2a */ KEY_Tilde, + /* 0x2b */ KEY_BackSpace, + /* 0x2c */ KEY_Insert, + /* 0x2d */ KEY_KP_Equal, + /* 0x2e */ KEY_KP_Divide, + /* 0x2f */ KEY_KP_Multiply, + /* 0x30 */ KEY_NOTUSED, + /* 0x31 */ KEY_NOTUSED, /* front */ + /* 0x32 */ KEY_KP_Decimal, + /* 0x33 */ KEY_NOTUSED, /* copy */ + /* 0x34 */ KEY_Home, + /* 0x35 */ KEY_Tab, + /* 0x36 */ KEY_Q, + /* 0x37 */ KEY_W, + /* 0x38 */ KEY_E, + /* 0x39 */ KEY_R, + /* 0x3a */ KEY_T, + /* 0x3b */ KEY_Y, + /* 0x3c */ KEY_U, + /* 0x3d */ KEY_I, + /* 0x3e */ KEY_O, + /* 0x3f */ KEY_P, + /* 0x40 */ KEY_LBrace, + /* 0x41 */ KEY_RBrace, + /* 0x42 */ KEY_Delete, + /* 0x43 */ KEY_NOTUSED, /* compose */ + /* 0x44 */ KEY_KP_7, + /* 0x45 */ KEY_KP_8, + /* 0x46 */ KEY_KP_9, + /* 0x47 */ KEY_KP_Minus, + /* 0x48 */ KEY_NOTUSED, /* open */ + /* 0x49 */ KEY_NOTUSED, /* paste */ + /* 0x4a */ KEY_End, + /* 0x4b */ KEY_NOTUSED, + /* 0x4c */ KEY_LCtrl, + /* 0x4d */ KEY_A, + /* 0x4e */ KEY_S, + /* 0x4f */ KEY_D, + /* 0x50 */ KEY_F, + /* 0x51 */ KEY_G, + /* 0x52 */ KEY_H, + /* 0x53 */ KEY_J, + /* 0x54 */ KEY_K, + /* 0x55 */ KEY_L, + /* 0x56 */ KEY_SemiColon, + /* 0x57 */ KEY_Quote, + /* 0x58 */ KEY_BSlash, + /* 0x59 */ KEY_Enter, + /* 0x5a */ KEY_KP_Enter, + /* 0x5b */ KEY_KP_4, + /* 0x5c */ KEY_KP_5, + /* 0x5d */ KEY_KP_6, + /* 0x5e */ KEY_KP_0, + /* 0x5f */ KEY_NOTUSED, /* find */ + /* 0x60 */ KEY_PgUp, + /* 0x61 */ KEY_NOTUSED, /* cut */ + /* 0x62 */ KEY_NumLock, + /* 0x63 */ KEY_ShiftL, + /* 0x64 */ KEY_Z, + /* 0x65 */ KEY_X, + /* 0x66 */ KEY_C, + /* 0x67 */ KEY_V, + /* 0x68 */ KEY_B, + /* 0x69 */ KEY_N, + /* 0x6a */ KEY_M, + /* 0x6b */ KEY_Comma, + /* 0x6c */ KEY_Period, + /* 0x6d */ KEY_Slash, + /* 0x6e */ KEY_ShiftR, + /* 0x6f */ KEY_NOTUSED, /* linefeed */ + /* 0x70 */ KEY_KP_1, + /* 0x71 */ KEY_KP_2, + /* 0x72 */ KEY_KP_3, + /* 0x73 */ KEY_NOTUSED, + /* 0x74 */ KEY_NOTUSED, + /* 0x75 */ KEY_NOTUSED, + /* 0x76 */ KEY_NOTUSED, /* help */ + /* 0x77 */ KEY_CapsLock, + /* 0x78 */ KEY_LMeta, + /* 0x79 */ KEY_Space, + /* 0x7a */ KEY_RMeta, + /* 0x7b */ KEY_PgDown, + /* 0x7c */ KEY_NOTUSED, + /* 0x7d */ KEY_KP_Plus, + /* 0x7e */ KEY_NOTUSED, + /* 0x7f */ KEY_NOTUSED +}; +#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) + +static +TransMapRec wsSun = { + 0, + WS_SUN_MAP_SIZE, + wsSunMap +}; + +#endif /* WSCONS_SUPPORT */ + +/*ARGSUSED*/ + +/* + * KbdGetMapping -- + * Get the national keyboard mapping. The keyboard type is set, a new map + * and the modifiermap is computed. + */ + +void +KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + KeySym *k; + int i; + +#ifndef __bsdi__ + switch (pKbd->consType) { + +#ifdef PCCONS_SUPPORT + case PCCONS: +#if defined(__OpenBSD__) + /* + * on OpenBSD, the pccons keymap is programmable, too + */ + { + pccons_keymap_t keymap[KB_NUM_KEYS]; + if (ioctl(pInfo->fd, CONSOLE_GET_KEYMAP, &keymap) != -1) { + for (i = 0; i < KB_NUM_KEYS; i++) + if (pccons_remap[i]) { + k = map + (pccons_remap[i] << 2); + switch (keymap[i].type) { + case KB_ASCII: + /* For ASCII keys, there is only one char in the keymap */ + k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]]; + k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]]; + k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]]; + k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]]; + break; + case KB_SCROLL: + k[0] = XK_Scroll_Lock; + goto special; + case KB_NUM: + k[0] = XK_Num_Lock; + goto special; + case KB_CAPS: + k[0] = XK_Caps_Lock; + goto special; + case KB_SHIFT: + switch (keymap[i].unshift[0]) { + case 1: + /* left shift */ + k[0] = XK_Shift_L; + break; + case 2: + /* right shift */ + k[0] = XK_Shift_R; + break; + default: + k[0] = NoSymbol; + } + goto special; + case KB_CTL: + k[0] = XK_Control_L; + goto special; + case KB_ALT: + k[0] = XK_Alt_L; + goto special; + case KB_FUNC: + switch (keymap[i].unshift[2]) { + case 'M': + k[0] = XK_F1; + break; + case 'N': + k[0] = XK_F2; + break; + case 'O': + k[0] = XK_F3; + break; + case 'P': + k[0] = XK_F4; + break; + case 'Q': + k[0] = XK_F5; + break; + case 'R': + k[0] = XK_F6; + break; + case 'S': + k[0] = XK_F7; + break; + case 'T': + k[0] = XK_F8; + break; + case 'U': + k[0] = XK_F9; + break; + case 'V': + k[0] = XK_F10; + break; + case 'W': + k[0] = XK_F11; + break; + case 'X': + k[0] = XK_F12; + break; + default: + k[0] = NoSymbol; + break; + } + goto special; + default: + k[0] = NoSymbol; + special: + k[1] = k[2] = k[3] = NoSymbol; + } + } + } else { + ErrorF("Can't read pccons keymap\n"); + } + } +#endif /* __OpenBSD__ */ + break; +#endif + +/* + * XXX wscons has no GIO_KEYMAP + */ +#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP) + case SYSCONS: + case PCVT: + { + keymap_t keymap; + + if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) { + for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) + if (remap[i]) { + k = map + (remap[i] << 2); + k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ + k[1] = KD_GET_ENTRY(i,1); /* shifted */ + k[2] = KD_GET_ENTRY(i,4); /* alt */ + k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ + if (k[3] == k[2]) k[3] = NoSymbol; + if (k[2] == k[1]) k[2] = NoSymbol; + if (k[1] == k[0]) k[1] = NoSymbol; + if (k[0] == k[2] && k[1] == k[3]) + k[2] = k[3] = NoSymbol; + } + } + } + break; +#endif /* SYSCONS || PCVT */ + + } +#endif /* !bsdi */ + + /* + * compute the modifier map + */ + for (i = 0; i < MAP_LENGTH; i++) + pModMap[i] = NoSymbol; /* make sure it is restored */ + + for (k = map, i = MIN_KEYCODE; + i < (NUM_KEYCODES + MIN_KEYCODE); + i++, k += 4) + + switch(*k) { + + case XK_Shift_L: + case XK_Shift_R: + pModMap[i] = ShiftMask; + break; + + case XK_Control_L: + case XK_Control_R: + pModMap[i] = ControlMask; + break; + + case XK_Caps_Lock: + pModMap[i] = LockMask; + break; + + case XK_Alt_L: + case XK_Alt_R: + pModMap[i] = AltMask; + break; + + case XK_Num_Lock: + pModMap[i] = NumLockMask; + break; + + case XK_Scroll_Lock: + pModMap[i] = ScrollLockMask; + break; + + /* kana support */ + case XK_Kana_Lock: + case XK_Kana_Shift: + pModMap[i] = KanaMask; + break; + + /* alternate toggle for multinational support */ + case XK_Mode_switch: + pModMap[i] = AltLangMask; + break; + + } + + pKbd->kbdType = 0; + + pKeySyms->map = map; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + pKeySyms->minKeyCode = MIN_KEYCODE; + pKeySyms->maxKeyCode = MAX_KEYCODE; + + switch(pKbd->consType) { +#ifdef SYSCONS_SUPPORT + case SYSCONS: + if (pKbd->CustomKeycodes) + pKbd->scancodeMap = &sysconsCODE; + else + pKbd->RemapScanCode = ATScancode; + break; +#endif +#if defined(PCCONS_SUPPORT) || defined (PCVT_SUPPORT) + case PCCONS: + case PCVT: + pKbd->RemapScanCode = ATScancode; +#endif +#ifdef WSCONS_SUPPORT + case WSCONS: + switch (pKbd->wsKbdType) { + case WSKBD_TYPE_PC_XT: + case WSKBD_TYPE_PC_AT: + pKbd->RemapScanCode = ATScancode; + break; + case WSKBD_TYPE_USB: + pKbd->scancodeMap = &wsUsb; + break; +#ifdef WSKBD_TYPE_ADB + case WSKBD_TYPE_ADB: + pKbd->scancodeMap = &wsAdb; + break; +#endif +#ifdef WSKBD_TYPE_SUN + case WSKBD_TYPE_SUN: + pKbd->scancodeMap = &wsSun; + break; +#endif + default: + ErrorF("Unknown wskbd type %d\n", pKbd->wsKbdType); + } + break; +#endif + } + return; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c:1.1 Thu Feb 15 14:34:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c Tue Oct 29 18:19:13 2002 @@ -1,10 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c,v 1.1 2001/02/15 19:34:18 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c,v 1.2 2002/10/29 23:19:13 herrb Exp $ */ #include "X.h" #include "os.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86Axp.h" +#include <sys/param.h> #include "xf86_OSlib.h" #include <stdio.h> #include <sys/sysctl.h> @@ -42,8 +43,19 @@ char sysname[64]; size_t len = sizeof(sysname); +#ifdef __OpenBSD__ + int mib[3]; + int error; + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_CHIPSET; + mib[2] = CPU_CHIPSET_TYPE; + + if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0) +#else if ((sysctlbyname("hw.chipset.type", &sysname, &len, 0, 0)) < 0) +#endif FatalError("bsdGetAXP: can't find machine type\n"); #ifdef DEBUG xf86Msg(X_INFO,"AXP is a: %s\n",sysname); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.18 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.19 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.18 Thu Nov 8 17:33:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c Sun May 5 14:54:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.18 2001/11/08 22:33:50 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.19 2002/05/05 18:54:02 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -570,8 +570,15 @@ FatalError("xf86OpenPcvt: VT_GETMODE failed\n"); } xf86Info.consType = PCVT; +#ifdef WSCONS_SUPPORT + xf86Msg(X_PROBED, + "Using wscons driver in pcvt compatibility mode " + "(version %d.%d)\n", + pcvt_version.rmajor, pcvt_version.rminor); +#else xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n", - pcvt_version.rmajor, pcvt_version.rminor); + pcvt_version.rmajor, pcvt_version.rminor); +#endif } else { Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c:3.19 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c:3.23 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c:3.19 Thu Nov 8 16:49:44 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c Mon Oct 21 16:38:04 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.19 2001/11/08 21:49:44 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.23 2002/10/21 20:38:04 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -34,9 +34,17 @@ #include "xf86Priv.h" #include "xf86_OSlib.h" +#ifdef WSCONS_SUPPORT +#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd) +#endif + void xf86SoundKbdBell(int loudness, int pitch, int duration) { +#ifdef WSCONS_SUPPORT + struct wskbd_bell_data wsb; +#endif + if (loudness && pitch) { #ifdef PCCONS_SUPPORT @@ -60,6 +68,16 @@ (((unsigned long)duration*loudness/50)<<16)); break; #endif +#if defined (WSCONS_SUPPORT) + case WSCONS: + wsb.which = WSKBD_BELL_DOALL; + wsb.pitch = pitch; + wsb.period = duration; + wsb.volume = loudness; + ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL, + &wsb); + break; +#endif } } } @@ -77,6 +95,11 @@ ioctl(xf86Info.consoleFd, KDSETLED, leds); break; #endif +#if defined(WSCONS_SUPPORT) + case WSCONS: + ioctl(KBD_FD(xf86Info), WSKBDIO_SETLEDS, &leds); + break; +#endif } } @@ -95,6 +118,11 @@ ioctl(xf86Info.consoleFd, KDGETLED, &leds); break; #endif +#if defined(WSCONS_SUPPORT) + case WSCONS: + ioctl(KBD_FD(xf86Info), WSKBDIO_GETLEDS, &leds); + break; +#endif } return(leds); } @@ -115,7 +143,9 @@ } } +#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) static struct termio kbdtty; +#endif void xf86KbdInit() @@ -131,7 +161,10 @@ #endif #if defined WSCONS_SUPPORT case WSCONS: - xf86FlushInput(xf86Info.kbdFd); + if (xf86Info.kbdFd != -1) + xf86FlushInput(xf86Info.kbdFd); + else + tcgetattr(xf86Info.consoleFd, &kbdtty); break; #endif } @@ -141,7 +174,11 @@ xf86KbdOn() { struct termios nTty; +#ifdef WSCONS_SUPPORT + int option; +#endif + switch (xf86Info.consType) { #if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) @@ -166,7 +203,29 @@ #endif #ifdef WSCONS_SUPPORT case WSCONS: - return xf86Info.kbdFd; + if (xf86Info.kbdFd == -1) { + nTty = kbdtty; + nTty.c_iflag = IGNPAR | IGNBRK; + nTty.c_oflag = 0; + nTty.c_cflag = CREAD | CS8; + nTty.c_lflag = 0; + nTty.c_cc[VTIME] = 0; + nTty.c_cc[VMIN] = 1; + cfsetispeed(&nTty, 9600); + cfsetospeed(&nTty, 9600); + tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); + option = WSKBD_RAW; + if (ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, + &option) == -1) + FatalError("can't switch keyboard to raw mode. " + "Enable support for it in the kernel\n" + "or use for example:\n\n" + "Option \"Protocol\" \"wskbd\"\n" + "Option \"Device\" \"/dev/wskbd0\"\n" + "\nin your XF86Config(5) file\n"); + } else { + return xf86Info.kbdFd; + } #endif } return(xf86Info.consoleFd); @@ -175,6 +234,10 @@ int xf86KbdOff() { +#ifdef WSCONS_SUPPORT + int option; +#endif + switch (xf86Info.consType) { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) @@ -188,7 +251,18 @@ tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); break; #endif - } +#ifdef WSCONS_SUPPORT + case WSCONS: + if (xf86Info.kbdFd != -1) { + return xf86Info.kbdFd; + } else { + option = WSKBD_TRANSLATED; + ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option); + tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); + } + break; +#endif + } return(xf86Info.consoleFd); } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c:3.7 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c:3.8 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c:3.7 Sat Jul 25 12:56:34 1998 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c Tue Aug 6 09:20:47 2002 @@ -23,7 +23,7 @@ /* Modified for FreeBSD by David Dawes <dawes@XFree86.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.7 1998/07/25 16:56:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.8 2002/08/06 13:20:47 herrb Exp $ */ #include <sys/types.h> #include <unistd.h> @@ -96,7 +96,6 @@ if (*centerY < 0) { *centerY = js.y; xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY); - } } return status; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c:1.5 --- /dev/null Thu Feb 27 12:32:19 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c Mon Feb 17 10:11:56 2003 @@ -0,0 +1,536 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.5 2003/02/17 15:11:56 dawes Exp $ */ + +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * Author: Ivan Pascal. + * + * Based on the code from bsd_io.c which is + * Copyright 1992 by Rich Murphey <Rich@Rice.edu> + * Copyright 1993 by David Dawes <dawes@xfree86.org> + */ + +#define NEED_EVENTS +#include "X.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#include "xf86Xinput.h" +#include "xf86OSKbd.h" +#include "atKeynames.h" +#include "bsd_kbd.h" + +extern Bool VTSwitchEnabled; +#ifdef USE_VT_SYSREQ +extern Bool VTSysreqToggle; +#endif + +static KbdProtocolRec protocols[] = { + {"standard", PROT_STD }, +#ifdef WSCONS_SUPPORT + {"wskbd", PROT_WSCONS }, +#endif + { NULL, PROT_UNKNOWN } +}; + +typedef struct { + struct termio kbdtty; +} BsdKbdPrivRec, *BsdKbdPrivPtr; + +static +int KbdInit(InputInfoPtr pInfo, int what) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private; + + if (pKbd->isConsole) { + switch (pKbd->consType) { +#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT) + case PCCONS: + case SYSCONS: + case PCVT: +#if defined WSCONS_SUPPORT + case WSCONS: +#endif + tcgetattr(pInfo->fd, &(priv->kbdtty)); +#endif + break; + } + } + + return Success; +} + +static void +SetKbdLeds(InputInfoPtr pInfo, int leds) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int real_leds = 0; + + if (leds & XLED1) real_leds |= LED_CAP; + if (leds & XLED2) real_leds |= LED_NUM; + if (leds & XLED3) real_leds |= LED_SCR; + if (leds & XLED4) real_leds |= LED_SCR; + + switch (pKbd->consType) { + + case PCCONS: + break; +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + case SYSCONS: + case PCVT: + ioctl(pInfo->fd, KDSETLED, real_leds); + break; +#endif +#if defined(WSCONS_SUPPORT) + case WSCONS: + ioctl(pInfo->fd, WSKBDIO_SETLEDS, &real_leds); + break; +#endif + } +} + +static int +GetKbdLeds(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int leds = 0, real_leds = 0; + + switch (pKbd->consType) { + case PCCONS: + break; +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + case SYSCONS: + case PCVT: + ioctl(pInfo->fd, KDGETLED, &real_leds); + break; +#endif +#if defined(WSCONS_SUPPORT) + case WSCONS: + ioctl(pInfo->fd, WSKBDIO_GETLEDS, &real_leds); + break; +#endif + } + + if (real_leds & LED_CAP) leds |= XLED1; + if (real_leds & LED_NUM) leds |= XLED2; + if (real_leds & LED_SCR) leds |= XLED3; + + return(leds); +} + +static void +SetKbdRepeat(InputInfoPtr pInfo, char rad) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + switch (pKbd->consType) { + + case PCCONS: + break; +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + case SYSCONS: + case PCVT: + ioctl(pInfo->fd, KDSETRAD, rad); + break; +#endif + } +} + +static int +KbdOn(InputInfoPtr pInfo, int what) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private; + struct termios nTty; +#ifdef WSCONS_SUPPORT + int option; +#endif + + if (pKbd->isConsole) { + switch (pKbd->consType) { + +#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) + case SYSCONS: + case PCCONS: + case PCVT: +#ifdef WSCONS_SUPPORT + case WSCONS: +#endif + nTty = priv->kbdtty; + nTty.c_iflag = IGNPAR | IGNBRK; + nTty.c_oflag = 0; + nTty.c_cflag = CREAD | CS8; + nTty.c_lflag = 0; + nTty.c_cc[VTIME] = 0; + nTty.c_cc[VMIN] = 1; + cfsetispeed(&nTty, 9600); + cfsetospeed(&nTty, 9600); + tcsetattr(pInfo->fd, TCSANOW, &nTty); + break; +#endif + } +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT) + switch (pKbd->consType) { + case SYSCONS: + case PCVT: +#ifdef K_CODE + if (pKbd->CustomKeycodes) + ioctl(pInfo->fd, KDSKBMODE, K_CODE); + else + ioctl(pInfo->fd, KDSKBMODE, K_RAW); +#else + ioctl(pInfo->fd, KDSKBMODE, K_RAW); +#endif + break; +#endif +#ifdef WSCONS_SUPPORT + case WSCONS: + option = WSKBD_RAW; + if (ioctl(pInfo->fd, WSKBDIO_SETMODE, &option) == -1) { + FatalError("can't switch keyboard to raw mode. " + "Enable support for it in the kernel\n" + "or use for example:\n\n" + "Option \"Protocol\" \"wskbd\"\n" + "Option \"Device\" \"/dev/wskbd0\"\n" + "\nin your XF86Config(5) file\n"); + } + break; +#endif + } + } + return Success; +} + +static int +KbdOff(InputInfoPtr pInfo, int what) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private; +#ifdef WSCONS_SUPPORT + int option; +#endif + + if (pKbd->isConsole) { + switch (pKbd->consType) { +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + case SYSCONS: + case PCVT: + ioctl(pInfo->fd, KDSKBMODE, K_XLATE); + /* FALL THROUGH */ +#endif +#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) + case PCCONS: + tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty)); + break; +#endif +#ifdef WSCONS_SUPPORT + case WSCONS: + option = WSKBD_TRANSLATED; + ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option); + tcsetattr(xf86Info.consoleFd, TCSANOW, &(priv->kbdtty)); + break; +#endif + } + } + return Success; +} + +static void +SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; +#ifdef WSCONS_SUPPORT + struct wskbd_bell_data wsb; +#endif + + if (loudness && pitch) { + switch (pKbd->consType) { +#ifdef PCCONS_SUPPORT + case PCCONS: + { int data[2]; + data[0] = pitch; + data[1] = (duration * loudness) / 50; + ioctl(pInfo->fd, CONSOLE_X_BELL, data); + break; + } +#endif +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + case SYSCONS: + case PCVT: + ioctl(pInfo->fd, KDMKTONE, + ((1193190 / pitch) & 0xffff) | + (((unsigned long)duration*loudness/50)<<16)); + break; +#endif +#if defined (WSCONS_SUPPORT) + case WSCONS: + wsb.which = WSKBD_BELL_DOALL; + wsb.pitch = pitch; + wsb.period = duration; + wsb.volume = loudness; + ioctl(pInfo->fd, WSKBDIO_COMPLEXBELL, &wsb); + break; +#endif + } + } +} + +#define ModifierSet(k) ((modifiers & (k)) == (k)) + +static +Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + + if(!pKbd->vtSwitchSupported) + return FALSE; + + if ((ModifierSet(ControlMask | AltMask)) || + (ModifierSet(ControlMask | AltLangMask))) { + if (VTSwitchEnabled && !xf86Info.vtSysreq) { + switch (key) { + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + case KEY_F5: + case KEY_F6: + case KEY_F7: + case KEY_F8: + case KEY_F9: + case KEY_F10: + if (down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); + return TRUE; + } + case KEY_F11: + case KEY_F12: + if (down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); + return TRUE; + } + } + } + } +#ifdef USE_VT_SYSREQ + if (VTSwitchEnabled && xf86Info.vtSysreq) { + switch (key) { + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + case KEY_F5: + case KEY_F6: + case KEY_F7: + case KEY_F8: + case KEY_F9: + case KEY_F10: + if (VTSysreqToggle && down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); + VTSysreqToggle = FALSE; + return TRUE; + } + break; + case KEY_F11: + case KEY_F12: + if (VTSysreqToggle && down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); + VTSysreqToggle = FALSE; + return TRUE; + } + break; + /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ + case KEY_Alt: + case KEY_AltLang: + break; + case KEY_SysReqest: + if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down) + VTSysreqToggle = TRUE; + break; + default: + /* + * We only land here when Alt-SysReq is followed by a + * non-switching key. + */ + if (VTSysreqToggle) + VTSysreqToggle = FALSE; + } + } +#endif /* USE_VT_SYSREQ */ + + return FALSE; +} + +static void +stdReadInput(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + unsigned char rBuf[64]; + int nBytes, i; + if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) { + for (i = 0; i < nBytes; i++) + pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, + rBuf[i] & 0x80 ? FALSE : TRUE); + } +} + +#ifdef WSCONS_SUPPORT +static void +WSReadInput(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + struct wscons_event events[64]; + int n, i; + if ((n = read( pInfo->fd, events, sizeof(events))) > 0) { + n /= sizeof(struct wscons_event); + for (i = 0; i < n; i++) + pKbd->PostEvent(pInfo, events[i].value, + events[i].type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); + } +} +#endif + +#ifdef WSCONS_SUPPORT +static void +printWsType(char *type, char *devname) +{ + xf86Msg(X_PROBED, "%s: Keyboard type: %s\n", type, devname); +} +#endif + +static Bool +OpenKeyboard(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int i; + KbdProtocolId prot = PROT_UNKNOWN; + char *s; + + s = xf86SetStrOption(pInfo->options, "Protocol", NULL); + for (i = 0; protocols[i].name; i++) { + if (xf86NameCmp(s, protocols[i].name) == 0) { + prot = protocols[i].id; + break; + } + } + + switch (prot) { + case PROT_STD: + pInfo->read_input = stdReadInput; + break; +#ifdef WSCONS_SUPPORT + case PROT_WSCONS: + pInfo->read_input = WSReadInput; + break; +#endif + default: + xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s); + xfree(s); + return FALSE; + } + xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s); + xfree(s); + + s = xf86SetStrOption(pInfo->options, "Device", NULL); + if (s == NULL) { + if (prot == PROT_WSCONS) { + xf86Msg(X_ERROR,"A \"device\" option is required with" + " the \"wskbd\" keyboard protocol\n"); + return FALSE; + } else { + pInfo->fd = xf86Info.consoleFd; + pKbd->isConsole = TRUE; + pKbd->consType = xf86Info.consType; + } + } else { + pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); + if (pInfo->fd == -1) { + xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s); + xfree(s); + return FALSE; + } + pKbd->isConsole = FALSE; + /* XXX What is consType here? */ + pKbd->consType = SYSCONS; + xfree(s); + } + +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + if (pKbd->isConsole && + ((pKbd->consType == SYSCONS) || (pKbd->consType == PCVT))) + pKbd->vtSwitchSupported = TRUE; +#endif + +#ifdef WSCONS_SUPPORT + if( prot == PROT_WSCONS) { + pKbd->consType = WSCONS; + /* Find out keyboard type */ + if (ioctl(pInfo->fd, WSKBDIO_GTYPE, &(pKbd->wsKbdType)) == -1) { + xf86Msg(X_ERROR, "%s: cannot get keyboard type", pInfo->name); + close(pInfo->fd); + return FALSE; + } + switch (pKbd->wsKbdType) { + case WSKBD_TYPE_PC_XT: + printWsType("XT", pInfo->name); + break; + case WSKBD_TYPE_PC_AT: + printWsType("AT", pInfo->name); + break; + case WSKBD_TYPE_USB: + printWsType("USB", pInfo->name); + break; +#ifdef WSKBD_TYPE_ADB + case WSKBD_TYPE_ADB: + printWsType("ADB", pInfo->name); + break; +#endif +#ifdef WSKBD_TYPE_SUN + case WSKBD_TYPE_SUN: + printWsType("Sun", pInfo->name); + break; +#endif + default: + xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"", + pKbd->wsKbdType, pInfo->name); + close(pInfo->fd); + return FALSE; + } + } +#endif + return TRUE; +} + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = pInfo->private; + + pKbd->KbdInit = KbdInit; + pKbd->KbdOn = KbdOn; + pKbd->KbdOff = KbdOff; + pKbd->Bell = SoundBell; + pKbd->SetLeds = SetKbdLeds; + pKbd->GetLeds = GetKbdLeds; + pKbd->SetKbdRepeat = SetKbdRepeat; + pKbd->KbdGetMapping = KbdGetMapping; + pKbd->SpecialKey = SpecialKey; + + pKbd->RemapScanCode = NULL; + pKbd->GetSpecialKey = NULL; + + pKbd->OpenKeyboard = OpenKeyboard; + pKbd->vtSwitchSupported = FALSE; + pKbd->CustomKeycodes = FALSE; + + pKbd->private = xcalloc(sizeof(BsdKbdPrivRec), 1); + if (pKbd->private == NULL) { + xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n"); + return FALSE; + } + return TRUE; +} + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h:1.1 --- /dev/null Thu Feb 27 12:32:19 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h Thu Oct 10 21:40:34 2002 @@ -0,0 +1,5 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h,v 1.1 2002/10/11 01:40:34 dawes Exp $ */ + +extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, + CARD8 *pModMap); + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c:3.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c:3.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c:3.1 Fri Jun 16 20:03:27 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c Fri Nov 29 12:47:24 2002 @@ -1,3 +1,5 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c,v 3.2 2002/11/29 17:47:24 tsi Exp $ */ + #include <errno.h> #include <fcntl.h> #include <unistd.h> @@ -18,7 +20,7 @@ */ int xf86LoadKernelModule(const char *modName) { - if (kldload(modName)) + if (kldload(modName) != -1) return 1; else return 0; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c:1.3 Sun Sep 30 12:31:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c Tue Jul 30 19:24:32 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c,v 1.3 2001/09/30 16:31:49 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c,v 1.5 2002/07/30 23:24:32 herrb Exp $ */ /* * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. * @@ -26,7 +26,7 @@ * or other dealings in this Software without prior written authorization * from the XFree86 Project. */ -/* $OpenBSD: bsd_kqueue_apm.c,v 1.2 2001/08/20 22:17:19 matthieu Exp $ */ +/* $OpenBSD: bsd_kqueue_apm.c,v 1.5 2002/07/30 23:07:42 matthieu Exp $ */ #include "X.h" #include "os.h" @@ -95,7 +95,7 @@ for (i = 0; i < num; i++) { result = kevent(kq, NULL, 0, &ev, 1, &ts); - if (result == 0) { + if (result == 0 || APM_EVENT_TYPE(ev.data) == APM_NOEVENT) { /* no event */ break; } else if (result < 0) { @@ -188,8 +188,11 @@ if (APMihPtr) { kq = xf86RemoveInputHandler(APMihPtr); close(devFd); + devFd = -1; + close(kq); if (ctlFd >= 0) { close(ctlFd); + ctlFd = -1; } APMihPtr = NULL; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.20 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.24 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.20 Mon Jan 14 10:34:23 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c Sat Feb 15 00:37:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.20 2002/01/14 15:34:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.24 2003/02/15 05:37:59 paulo Exp $ */ /* * Copyright 1999 by The XFree86 Project, Inc. @@ -22,6 +22,11 @@ #include "usb.h" #endif +#include <dev/usb/usb.h> +#ifdef USB_GET_REPORT_ID +#define USB_NEW_HID +#endif + #define HUP_GENERIC_DESKTOP 0x0001 #define HUP_BUTTON 0x0009 @@ -36,9 +41,6 @@ #define UMS_BUT(i) ((i) == 0 ? 2 : (i) == 1 ? 0 : (i) == 2 ? 1 : (i)) #endif /* USBMOUSE_SUPPORT */ -#ifdef WSCONS_SUPPORT -static void wsconsSigioReadInput (int fd, void *closure); -#endif #ifdef USBMOUSE_SUPPORT static void usbSigioReadInput (int fd, void *closure); #endif @@ -177,7 +179,8 @@ mode.resolution = res > 0 ? res : -1; mode.accelfactor = -1; #if defined(__FreeBSD__) - if (xf86NameCmp(pMse->origProtocol, "Auto") == 0) { + if (pMse->autoProbe || + (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { /* * As the FreeBSD sysmouse driver defaults to protocol level 0 * everytime it is opened we enforce protocol level 1 again at @@ -196,82 +199,6 @@ #if defined(WSCONS_SUPPORT) #define NUMEVENTS 64 -static int -wsconsMouseProc(DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - unsigned char map[MSE_MAXBUTTONS + 1]; - int nbuttons; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) - map[nbuttons + 1] = nbuttons + 1; - - InitPointerDeviceStruct((DevicePtr)pPointer, - map, - min(pMse->buttons, MSE_MAXBUTTONS), - miPointerGetMotionEvents, - pMse->Ctrl, - miPointerGetMotionBufferSize()); - - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - xf86MotionHistoryAllocate(pInfo); - break; - - case DEVICE_ON: - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - pMse->buffer = XisbNew(pInfo->fd, - NUMEVENTS * sizeof(struct wscons_event)); - if (!pMse->buffer) { - xfree(pMse); - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } else { - xf86FlushInput(pInfo->fd); - if (!xf86InstallSIGIOHandler (pInfo->fd, wsconsSigioReadInput, pInfo)) - AddEnabledDevice(pInfo->fd); - } - } - pMse->lastButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - if (pInfo->fd != -1) { - RemoveEnabledDevice(pInfo->fd); - if (pMse->buffer) { - XisbFree(pMse->buffer); - pMse->buffer = NULL; - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } - pPointer->public.on = FALSE; - usleep(300000); - break; - } - return Success; -} - - static void wsconsReadInput(InputInfoPtr pInfo) { @@ -328,12 +255,6 @@ return; } -static void -wsconsSigioReadInput (int fd, void *closure) -{ - wsconsReadInput ((InputInfoPtr) closure); -} - /* This function is called when the protocol is "wsmouse". */ static Bool @@ -365,8 +286,7 @@ /* Process common mouse options (like Emulate3Buttons, etc). */ pMse->CommonOptions(pInfo); - /* Setup the local procs. */ - pInfo->device_control = wsconsMouseProc; + /* Setup the local input proc. */ pInfo->read_input = wsconsReadInput; pInfo->flags |= XI86_CONFIGURED; @@ -554,8 +474,18 @@ /* Get USB informations */ reportDesc = hid_get_report_desc(pInfo->fd); /* Get packet size & iid */ +#ifdef USB_NEW_HID + if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) { + xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n", + pInfo->name, strerror(errno)); + return FALSE; + } + pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, + pUsbMse->iid); +#else pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, &pUsbMse->iid); +#endif /* Allocate buffer */ if (pUsbMse->packetSize <= 8) { pUsbMse->buffer = pMse->protoBuf; @@ -569,6 +499,19 @@ xf86CloseSerial(pInfo->fd); return FALSE; } +#ifdef USB_NEW_HID + if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), + hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) { + xf86Msg(X_WARNING, "%s: no x locator\n"); + } + if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), + hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) { + xf86Msg(X_WARNING, "%s: no y locator\n"); + } + if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), + hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) { + } +#else if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), hid_input, &pUsbMse->loc_x) < 0) { xf86Msg(X_WARNING, "%s: no x locator\n"); @@ -580,10 +523,15 @@ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), hid_input, &pUsbMse->loc_z) < 0) { } +#endif /* Probe for number of buttons */ for (i = 1; i <= MSE_MAXBUTTONS; i++) { if (!hid_locate(reportDesc, HID_USAGE2(HUP_BUTTON, i), - hid_input, &pUsbMse->loc_btn[i-1])) + hid_input, &pUsbMse->loc_btn[i-1] +#ifdef USB_NEW_HID + , pUsbMse->iid +#endif + )) break; } pMse->buttons = i-1; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.45 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.45 Sat Oct 27 23:34:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c Thu Feb 27 12:32:20 2003 @@ -1,1742 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.45 2001/10/28 03:34:00 tsi Exp $ */ -/* - * Copyright 1992 by Rich Murphey <Rich@Rice.edu> - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * The ARM32 code here carries the following copyright: - * - * Copyright 1997 - * Digital Equipment Corporation. All rights reserved. - * This software is furnished under license and may be used and copied only in - * accordance with the following terms and conditions. Subject to these - * conditions, you may download, copy, install, use, modify and distribute - * this software in source and/or binary form. No title or ownership is - * transferred hereby. - * - * 1) Any source code used, modified or distributed must reproduce and retain - * this copyright notice and list of conditions as they appear in the - * source file. - * - * 2) No right is granted to use any trade name, trademark, or logo of Digital - * Equipment Corporation. Neither the "Digital Equipment Corporation" - * name nor any trademark or logo of Digital Equipment Corporation may be - * used to endorse or promote products derived from this software without - * the prior written permission of Digital Equipment Corporation. - * - * 3) This software is provided "AS-IS" and any express or implied warranties, - * including but not limited to, any implied warranties of merchantability, - * fitness for a particular purpose, or non-infringement are disclaimed. - * In no event shall DIGITAL be liable for any damages whatsoever, and in - * particular, DIGITAL shall not be liable for special, indirect, - * consequential, or incidental damages or damages for lost profits, loss - * of revenue or loss of use, whether such damages arise in contract, - * negligence, tort, under statute, in equity, at law or otherwise, even - * if advised of the possibility of such damage. - * - */ - -/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ - -#include "X.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#ifdef HAS_MTRR_SUPPORT -#ifndef __NetBSD__ -#include <sys/memrange.h> -#else -#include "memrange.h" -#endif -#define X_MTRR_ID "XFree86" -#endif - -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -#include <machine/mtrr.h> -#include <machine/sysarch.h> -#include <sys/queue.h> -#endif - - -#ifdef __alpha__ -#include <sys/sysctl.h> -#include "xf86Axp.h" -#endif - -#ifdef __arm32__ -#include "machine/devmap.h" -struct memAccess -{ - int ioctl; - struct map_info memInfo; - pointer regionVirtBase; - Bool Checked; - Bool OK; -}; - -static pointer xf86MapInfoMap(); -static void xf86MapInfoUnmap(); -static struct memAccess *checkMapInfo(); -extern int vgaPhysLinearBase; - -/* A memAccess structure is needed for each possible region */ -struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL, - FALSE, FALSE }; -struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL, - FALSE, FALSE }; -struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL, - FALSE, FALSE }; -#endif /* __arm32__ */ - -#if defined(__NetBSD__) && !defined(MAP_FILE) -#define MAP_FLAGS MAP_SHARED -#else -#define MAP_FLAGS (MAP_FILE | MAP_SHARED) -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - -#ifdef __OpenBSD__ -#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details\n" -#define SYSCTL_MSG2 \ - "Check that you have set 'machdep.allowaperture=2'\n" \ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details\n" -#endif - -#ifdef __alpha__ - -extern unsigned long dense_base(void); - -static int axpSystem = -1; -static unsigned long hae_thresh; -static unsigned long hae_mask; -static unsigned long bus_base; -static unsigned long sparse_size; - -static unsigned long -memory_base(void) -{ - static unsigned long base = 0; - - if (base == 0) { - size_t len = sizeof(base); - int error; - if ((error = sysctlbyname("hw.chipset.memory", &base, &len, - 0, 0)) < 0) - FatalError("xf86MapVidMem: can't find memory\n"); - } - - return base; -} - -static int -has_bwx(void) -{ - static int bwx = 0; - size_t len = sizeof(bwx); - int error; - if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0) - return FALSE; - else - return bwx; -} - -#define BUS_BASE dense_base() -#define BUS_BASE_BWX memory_base() - -#else - -#define BUS_BASE 0L -#define BUS_BASE_BWX 0L - -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -static Bool useDevMem = FALSE; -static int devMemFd = -1; - -#ifdef HAS_APERTURE_DRV -#define DEV_APERTURE "/dev/xf86" -#endif -#define DEV_MEM "/dev/mem" - -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); -#ifdef __alpha__ -static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); -static void unmapVidMemSparse(int, pointer, unsigned long); -#endif -#ifdef __powerpc__ -static pointer ppcMapVidMem(int, unsigned long, unsigned long); -static void ppcUnmapVidMem(int, pointer, unsigned long); -#endif -#ifdef HAS_MTRR_SUPPORT -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -static void undoWC(int, pointer); -static Bool cleanMTRR(void); -#endif -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool, - MessageType); -static void NetBSDundoWC(int, pointer); -#endif - - -#if !defined(__powerpc__) -/* - * Check if /dev/mem can be mmap'd. If it can't print a warning when - * "warn" is TRUE. - */ -static void -checkDevMem(Bool warn) -{ - static Bool devMemChecked = FALSE; - int fd; - pointer base; - - if (devMemChecked) - return; - devMemChecked = TRUE; - - if ((fd = open(DEV_MEM, O_RDWR)) >= 0) - { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); - - if (base != MAP_FAILED) - { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - return; - } else { - /* This should not happen */ - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_MEM, strerror(errno)); - } - useDevMem = FALSE; - return; - } - } -#ifndef HAS_APERTURE_DRV - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - xf86ErrorF("\tlinear framebuffer access unavailable\n"); - } - useDevMem = FALSE; - return; -#else - /* Failed to open /dev/mem, try the aperture driver */ - if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) - { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000); - - if (base != MAP_FAILED) - { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", - DEV_APERTURE); - return; - } else { - - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_APERTURE, strerror(errno)); - } - } - } else { - if (warn) - { -#ifndef __OpenBSD__ - xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno)); -#else /* __OpenBSD__ */ - xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno), - SYSCTL_MSG); -#endif /* __OpenBSD__ */ - } - } - - if (warn) - { - xf86ErrorF("\tlinear framebuffer access unavailable\n"); - } - useDevMem = FALSE; - return; - -#endif -} -#endif /* !__powerpc__ */ - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ -#if defined(__powerpc__) - pVidMem->linearSupported = TRUE; -#else - checkDevMem(TRUE); - pVidMem->linearSupported = useDevMem; -#endif -#if defined(__alpha__) - if (has_bwx()) { - xf86Msg(X_INFO,"Machine type has 8/16 bit access\n"); - pVidMem->mapMem = mapVidMem; - pVidMem->unmapMem = unmapVidMem; - } else { - xf86Msg(X_INFO,"Machine needs sparse mapping\n"); - pVidMem->mapMem = mapVidMemSparse; - pVidMem->unmapMem = unmapVidMemSparse; - if (axpSystem == -1) - axpSystem = bsdGetAXP(); - hae_thresh = xf86AXPParams[axpSystem].hae_thresh; - hae_mask = xf86AXPParams[axpSystem].hae_mask; - sparse_size = xf86AXPParams[axpSystem].size; - } -#elif defined(__arm32__) - pVidMem->mapMem = armMapVidMem; - pVidMem->unmapVidMem = armUnmapVidMem; -#elif defined(__powerpc__) - pVidMem->mapMem = ppcMapVidMem; - pVidMem->unmapMem = ppcUnmapVidMem; -#else - pVidMem->mapMem = mapVidMem; - pVidMem->unmapMem = unmapVidMem; -#endif - -#ifdef HAS_MTRR_SUPPORT - if (useDevMem) { - if (cleanMTRR()) { - pVidMem->setWC = setWC; - pVidMem->undoWC = undoWC; - } - } -#endif -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) - pVidMem->setWC = NetBSDsetWC; - pVidMem->undoWC = NetBSDundoWC; -#endif - pVidMem->initialised = TRUE; -} - -#if !defined(__powerpc__) -static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - - checkDevMem(FALSE); - -#ifdef __alpha__ - Base = Base & ((1L<<32) - 1); -#endif - - if (useDevMem) - { - if (devMemFd < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); - if (base == MAP_FAILED) - { - FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", DEV_MEM, Size, Base, - strerror(errno)); - } - return(base); - } - - /* else, mmap /dev/vga */ - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) - { - FatalError("%s: Address 0x%x outside allowable range\n", - "xf86MapVidMem", Base); - } - base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS, - xf86Info.screenFd, -#if defined(__alpha__) - (unsigned long)Base + BUS_BASE -#elif defined(__mips__) - (unsigned long)Base -#else - (unsigned long)Base - 0xA0000 -#endif - ); - if (base == MAP_FAILED) - { - FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", - strerror(errno)); - } - return(base); -} - -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap((caddr_t)Base, Size); -} - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - unsigned char *ptr; - int psize; - int mlen; - - checkDevMem(TRUE); - if (devMemFd == -1) { - return(-1); - } - - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); - if ((long)ptr == -1) - { - xf86Msg(X_WARNING, - "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n", - DEV_MEM, Len, Base, Offset, strerror(errno)); -#ifdef __OpenBSD__ - if (Base < 0xa0000) { - xf86Msg(X_WARNING, SYSCTL_MSG2); - } -#endif - return(-1); - } -#ifdef DEBUG - ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); -#endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" - "-> %02x %02x %02x %02x...\n", - Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); -#endif - return(Len); -} - -#endif /* !__powerpc__ */ - -#ifdef __arm32__ - -/* XXX This needs to be updated for the ND */ - -/* -** Find out whether the console driver provides memory mapping information -** for the specified region and return the map_info pointer. Print a warning if required. -*/ -static struct memAccess * -checkMapInfo(Bool warn, int Region) -{ - struct memAccess *memAccP; - - switch (Region) - { - case VGA_REGION: - memAccP = &vgaMemInfo; - break; - - case LINEAR_REGION: - memAccP = &linearMemInfo; - break; - - case MMIO_REGION: - memAccP = &ioMemInfo; - break; - - default: - return NULL; - break; - } - - if(!memAccP->Checked) - { - if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1) - { - if(warn) - { - xf86Msg(X_WARNING, - "checkMapInfo: failed to get map info for region %d\n\t(%s)\n", - Region, strerror(errno)); - } - } - else - { - if(memAccP->memInfo.u.map_info_mmap.map_offset - != MAP_INFO_UNKNOWN) - memAccP->OK = TRUE; - } - memAccP->Checked = TRUE; - } - if (memAccP->OK) - { - return memAccP; - } - else - { - return NULL; - } -} - -static pointer -xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size) -{ - struct map_info *mapInfoP = &(memInfoP->memInfo); - - if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) - { - Size = (unsigned long)Base + Size; - } - else - { - Size = mapInfoP->u.map_info_mmap.map_size; - } - - switch(mapInfoP->method) - { - case MAP_MMAP: - /* Need to remap if size is unknown because we may not have - mapped the whole region initially */ - if(memInfoP->regionVirtBase == NULL || - mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) - { - if((memInfoP->regionVirtBase = - mmap((caddr_t)0, - Size, - PROT_READ|PROT_WRITE, - MAP_SHARED, - xf86Info.screenFd, - (unsigned long)mapInfoP->u.map_info_mmap.map_offset)) - == (pointer)-1) - { - FatalError("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n", - mapInfoP->u.map_info_mmap.map_offset, strerror(errno)); - } - if(mapInfoP->u.map_info_mmap.internal_offset > 0) - memInfoP->regionVirtBase += - mapInfoP->u.map_info_mmap.internal_offset; - } - break; - - default: - FatalError("xf86MapInfoMap: Unsuported mapping method\n"); - break; - } - - return (pointer)((int)memInfoP->regionVirtBase + (int)Base); -} - -static void -xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size) -{ - struct map_info *mapInfoP = &(memInfoP->memInfo); - - switch(mapInfoP->method) - { - case MAP_MMAP: - if(memInfoP->regionVirtBase != NULL) - { - if(mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN) - Size = mapInfoP->u.map_info_mmap.map_size; - munmap((caddr_t)memInfoP->regionVirtBase, Size); - memInfoP->regionVirtBase = NULL; - } - break; - default: - FatalError("xf86MapInfoMap: Unsuported mapping method\n"); - break; - } -} - -static pointer -armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - struct memAccess *memInfoP; - - if((memInfoP = checkMapInfo(FALSE, Region)) != NULL) - { - /* - ** xf86 passes in a physical address offset from the start - ** of physical memory, but xf86MapInfoMap expects an - ** offset from the start of the specified region - it gets - ** the physical address of the region from the display driver. - */ - switch(Region) - { - case LINEAR_REGION: - if (vgaPhysLinearBase) - { - Base -= vgaPhysLinearBase; - } - break; - case VGA_REGION: - Base -= 0xA0000; - break; - } - - base = xf86MapInfoMap(memInfoP, Base, Size); - return (base); - } - return mapVidMem(ScreenNum, Base, Size, flags); -} - -static void -armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - struct memAccess *memInfoP; - - if((memInfoP = checkMapInfo(FALSE, Region)) != NULL) - { - xf86MapInfoUnmap(memInfoP, Base, Size); - } - unmapVidMem(ScreenNum, Base, Size); -} -#endif /* __arm32__ */ - -#if defined(__powerpc__) - -volatile unsigned char *ioBase = MAP_FAILED; - -static pointer -ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) -{ - int fd = xf86Info.screenFd; - pointer base; - - fprintf(stderr, "mapVidMem %lx, %lx, fd = %d\n", Base, Size, fd); - - base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base); - if (base == MAP_FAILED) - FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - - return base; -} - -static void -ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int rv; - int kmem; - - kmem = open("/dev/kmem", 2); - if (kmem == -1) { - FatalError("xf86ReadBIOS: open /dev/kmem\n"); - } - -#ifdef DEBUG - fprintf(stderr, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); -#endif - - if (Base < 0x80000000) { - fprintf(stderr, "No VGA\n"); - return 0; - } - - - lseek(kmem, Base + Offset, 0); - rv = read(kmem, Buf, Len); - close(kmem); - - return rv; -} - - -#endif /* __powerpc__ */ - -#ifdef USE_I386_IOPL -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -void -xf86EnableIO() -{ - if (ExtendedEnabled) - return; - - if (i386_iopl(TRUE) < 0) - { -#ifndef __OpenBSD__ - FatalError("%s: Failed to set IOPL for extended I/O\n", - "xf86EnableIO"); -#else - FatalError("%s: Failed to set IOPL for extended I/O\n%s", - "xf86EnableIO", SYSCTL_MSG); -#endif - } - ExtendedEnabled = TRUE; - - return; -} - -void -xf86DisableIO() -{ - if (!ExtendedEnabled) - return; - - i386_iopl(FALSE); - ExtendedEnabled = FALSE; - - return; -} - -#endif /* USE_I386_IOPL */ - -#ifdef USE_DEV_IO -static int IoFd = -1; - -void -xf86EnableIO() -{ - if (IoFd >= 0) - return; - - if ((IoFd = open("/dev/io", O_RDWR)) == -1) - { - FatalError("xf86EnableIO: " - "Failed to open /dev/io for extended I/O\n"); - } - return; -} - -void -xf86DisableIO() -{ - if (IoFd < 0) - return; - - close(IoFd); - IoFd = -1; - return; -} - -#endif - -#if defined(USE_ARC_MMAP) || defined(__arm32__) - -void -xf86EnableIO() -{ - int fd; - pointer base; - - if (ExtendedEnabled) - return; - - if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { - /* Try to map a page at the pccons I/O space */ - base = (pointer)mmap((caddr_t)0, 65536, PROT_READ|PROT_WRITE, - MAP_FLAGS, fd, (off_t)0x0000); - - if (base != (pointer)-1) { - IOPortBase = base; - } - else { - FatalError("EnableIO: failed to mmap %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - } - } - else { - FatalError("EnableIO: failed to open %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - } - - ExtendedEnabled = TRUE; - - return; -} - -void -xf86DisableIO() -{ - return; -} - -#endif /* USE_ARC_MMAP */ - -#if defined(__FreeBSD__) && defined(__alpha__) - -extern int ioperm(unsigned long from, unsigned long num, int on); - -void -xf86EnableIO() -{ - ioperm(0, 65536, TRUE); - return; -} - -void -xf86DisableIO() -{ - return; -} - -#endif /* __FreeBSD__ && __alpha__ */ - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - -#if !defined(__mips__) && !defined(__arm32__) && !defined(__alpha__) && \ - !defined(__powerpc__) -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ -#endif /* __mips__ */ - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - -#if !defined(__mips__) && !defined(__arm32__) && !defined(__alpha__) && \ - !defined(__powerpc__) -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ -#endif /* __mips__ */ - - return; -} - - -#ifdef __NetBSD__ -/***************************************************************************/ -/* Set TV output mode */ -/***************************************************************************/ -void -xf86SetTVOut(int mode) -{ - switch (xf86Info.consType) - { -#ifdef PCCONS_SUPPORT - case PCCONS:{ - - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) - { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to TV output, %s\n", - strerror(errno)); - } - } - break; -#endif /* PCCONS_SUPPORT */ - - default: - FatalError("Xf86SetTVOut: Unsupported console\n"); - break; - } - return; -} - -void -xf86SetRGBOut() -{ - switch (xf86Info.consType) - { -#ifdef PCCONS_SUPPORT - case PCCONS:{ - - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) - { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to RGB output, %s\n", - strerror(errno)); - } - } - break; -#endif /* PCCONS_SUPPORT */ - - default: - FatalError("Xf86SetTVOut: Unsupported console\n"); - break; - } - return; -} -#endif - - -#if 0 -/* - * XXX This is here for reference. It needs to be handled differently for the - * ND. - */ -#if defined(USE_ARC_MMAP) || defined(__arm32__) - -#ifdef USE_ARM32_MMAP -#define DEV_MEM_IOBASE 0x43000000 -#endif - -static Bool ScreenEnabled[MAXSCREENS]; -static Bool ExtendedEnabled = FALSE; -static Bool InitDone = FALSE; - -void -xf86EnableIOPorts(ScreenNum) -int ScreenNum; -{ - int i; - int fd; - pointer base; - -#ifdef __arm32__ - struct memAccess *memInfoP; - int *Size; -#endif - - ScreenEnabled[ScreenNum] = TRUE; - - if (ExtendedEnabled) - return; - -#ifdef USE_ARC_MMAP - if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { - /* Try to map a page at the pccons I/O space */ - base = (pointer)mmap((caddr_t)0, 65536, PROT_READ|PROT_WRITE, - MAP_FLAGS, fd, (off_t)0x0000); - - if (base != (pointer)-1) { - IOPortBase = base; - } - else { - xf86Msg(X_ERROR, - "EnableIOPorts: failed to mmap %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - } - } - else { - xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - } -#endif - -#ifdef __arm32__ - IOPortBase = (unsigned int)-1; - - if((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL) - { - /* - * xf86MapInfoMap maps an offset from the start of video IO - * space (e.g. 0x3B0), but IOPortBase is expected to map to - * physical address 0x000, so subtract the start of video I/O - * space from the result. This is safe for now becase we - * actually mmap the start of the page, then the start of video - * I/O space is added as an internal offset. - */ - IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP, - (caddr_t)0x0, 0L) - - memInfoP->memInfo.u.map_info_mmap.internal_offset; - ExtendedEnabled = TRUE; - return; - } -#ifdef USE_ARM32_MMAP - checkDevMem(TRUE); - - if (devMemFd >= 0 && useDevMem) - { - base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ|PROT_WRITE, - MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE); - - if (base != (pointer)-1) - IOPortBase = (unsigned int)base; - } - - if (IOPortBase == (unsigned int)-1) - { - FatalError("xf86EnableIOPorts: failed to open mem device or map IO base. \n\ -Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n"); - } -#else - /* We don't have the IOBASE, so we can't map the address */ - FatalError("xf86EnableIOPorts: failed to open mem device or map IO base. \n\ -Try building the server with USE_ARM32_MMAP defined\n"); -#endif -#endif - - ExtendedEnabled = TRUE; - - return; -} - -void -xf86DisableIOPorts(ScreenNum) -int ScreenNum; -{ - int i; -#ifdef __arm32__ - struct memAccess *memInfoP; -#endif - - ScreenEnabled[ScreenNum] = FALSE; - -#ifdef __arm32__ - if((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL) - { - xf86MapInfoUnmap(memInfoP, 0); - } -#endif - -#ifdef USE_ARM32_MMAP - if (!ExtendedEnabled) - return; - - for (i = 0; i < MAXSCREENS; i++) - if (ScreenEnabled[i]) - return; - - munmap((caddr_t)IOPortBase, 0x400); - IOPortBase = (unsigned int)-1; - ExtendedEnabled = FALSE; -#endif - - return; -} - -#endif /* USE_ARC_MMAP || USE_ARM32_MMAP */ -#endif - - -#ifdef HAS_MTRR_SUPPORT -/* memory range (MTRR) support for FreeBSD */ - -/* - * This code is experimental. Some parts may be overkill, and other parts - * may be incomplete. - */ - -/* - * getAllRanges returns the full list of memory ranges with attributes set. - */ - -static struct mem_range_desc * -getAllRanges(int *nmr) -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - - /* - * Find how many ranges there are. If this fails, then the kernel - * probably doesn't have MTRR support. - */ - mro.mo_arg[0] = 0; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) - return NULL; - *nmr = mro.mo_arg[0]; - mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc)); - mro.mo_arg[0] = *nmr; - mro.mo_desc = mrd; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) { - xfree(mrd); - return NULL; - } - return mrd; -} - -/* - * cleanMTRR removes any memory attribute that may be left by a previous - * X server. Normally there won't be any, but this takes care of the - * case where a server crashed without being able finish cleaning up. - */ - -static Bool -cleanMTRR() -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - int nmr, i; - - /* This shouldn't happen */ - if (devMemFd < 0) - return FALSE; - - if (!(mrd = getAllRanges(&nmr))) - return FALSE; - - for (i = 0; i < nmr; i++) { - if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 && - (mrd[i].mr_flags & MDF_ACTIVE)) { -#ifdef DEBUG - ErrorF("Clean for (0x%lx,0x%lx)\n", - (unsigned long)mrd[i].mr_base, - (unsigned long)rd[i].mr_len); -#endif - if (mrd[i].mr_flags & MDF_FIXACTIVE) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - mrd[i].mr_flags = MDF_UNCACHEABLE; - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = mrd + i; - ioctl(devMemFd, MEMRANGE_SET, &mro); - } - } -#ifdef DEBUG - sleep(10); -#endif - xfree(mrd); - return TRUE; -} - -typedef struct x_RangeRec { - struct mem_range_desc mrd; - Bool wasWC; - struct x_RangeRec * next; -} RangeRec, *RangePtr; - -static void -freeRangeList(RangePtr range) -{ - RangePtr rp; - - while (range) { - rp = range; - range = rp->next; - xfree(rp); - } -} - -static RangePtr -dupRangeList(RangePtr list) -{ - RangePtr new = NULL, rp, p; - - rp = list; - while (rp) { - p = xnfalloc(sizeof(RangeRec)); - *p = *rp; - p->next = new; - new = p; - rp = rp->next; - } - return new; -} - -static RangePtr -sortRangeList(RangePtr list) -{ - RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev; - unsigned long minBase; - - /* Sort by base address */ - rp1 = copy = dupRangeList(list); - while (rp1) { - minBase = rp1->mrd.mr_base; - minp = rp1; - minprev = NULL; - prev = rp1; - rp2 = rp1->next; - while (rp2) { - if (rp2->mrd.mr_base < minBase) { - minBase = rp2->mrd.mr_base; - minp = rp2; - minprev = prev; - } - prev = rp2; - rp2 = rp2->next; - } - if (minprev) { - minprev->next = minp->next; - rp1 = copy; - } else { - rp1 = minp->next; - } - minp->next = sorted; - sorted = minp; - } - return sorted; -} - -/* - * findRanges returns a list of ranges that overlap the specified range. - */ - -static void -findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) -{ - struct mem_range_desc *mrd; - int nmr, i; - RangePtr rp, *p; - - if (!(mrd = getAllRanges(&nmr))) - return; - - for (i = 0; i < nmr; i++) { - if ((mrd[i].mr_flags & MDF_ACTIVE) && - mrd[i].mr_base < base + size && - mrd[i].mr_base + mrd[i].mr_len > base) { - if (mrd[i].mr_flags & MDF_WRITECOMBINE) - p = wcp; - else if (mrd[i].mr_flags & MDF_UNCACHEABLE) - p = ucp; - else - continue; - rp = xnfalloc(sizeof(RangeRec)); - rp->mrd = mrd[i]; - rp->next = *p; - *p = rp; - } - } - xfree(mrd); -} - -/* - * This checks if the existing overlapping ranges fully cover the requested - * range. Is this overkill? - */ - -static Bool -fullCoverage(unsigned long base, unsigned long size, RangePtr overlap) -{ - RangePtr rp1, sorted = NULL; - unsigned long end; - - sorted = sortRangeList(overlap); - /* Look for gaps */ - rp1 = sorted; - end = base + size; - while (rp1) { - if (rp1->mrd.mr_base > base) { - freeRangeList(sorted); - return FALSE; - } else { - base = rp1->mrd.mr_base + rp1->mrd.mr_len; - } - if (base >= end) { - freeRangeList(sorted); - return TRUE; - } - rp1 = rp1->next; - } - freeRangeList(sorted); - return FALSE; -} - -static pointer -addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* See of the full range is already WC */ - if (!uc && fullCoverage(base, size, wc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already set\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_WRITECOMBINE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to set write-combining range " - "(0x%lx,0x%lx)\n", base, size); - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx)\n", base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = FALSE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* - * See of the full range is already not WC, or if there is full - * coverage from UC ranges. - */ - if (!wc || fullCoverage(base, size, uc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already clear\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_UNCACHEABLE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to remove write-combining range " - "(0x%lx,0x%lx)\n", base, size); - /* XXX Should then remove all of the overlapping WC ranges */ - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Removed Write-combining range (0x%lx,0x%lx)\n", - base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = TRUE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - if (enable) - return addWC(screenNum, base, size, from); - else - return delWC(screenNum, base, size, from); -} - -static void -undoWC(int screenNum, pointer list) -{ - RangePtr rp; - struct mem_range_op mro; - Bool failed; - - rp = list; - while (rp) { -#ifdef DEBUG - ErrorF("Undo for (0x%lx,0x%lx), %d\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len, rp->wasWC); -#endif - failed = FALSE; - if (rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_WRITECOMBINE; - strcpy(rp->mrd.mr_owner, "unknown"); - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = &rp->mrd; - - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - if (!rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_UNCACHEABLE; - strcpy(rp->mrd.mr_owner, "unknown"); - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) - failed = TRUE; - } else - failed = TRUE; - } - if (failed) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to restore MTRR range (0x%lx,0x%lx)\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len); - } - rp = rp->next; - } -} - -#endif /* HAS_MTRR_SUPPORT */ - -#if defined(__FreeBSD__) && defined(__alpha__) - -#define vuip volatile unsigned int * - -static unsigned long msb_set = 0; -static pointer memSBase = 0; -static pointer memBase = 0; - -extern int readDense8(pointer Base, register unsigned long Offset); -extern int readDense16(pointer Base, register unsigned long Offset); -extern int readDense32(pointer Base, register unsigned long Offset); -extern void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); -extern void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); -extern void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense8(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense16(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense32(int Value, pointer Base, register unsigned long Offset); - -static int readSparse8(pointer Base, register unsigned long Offset); -static int readSparse16(pointer Base, register unsigned long Offset); -static int readSparse32(pointer Base, register unsigned long Offset); -static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse32(int Value, pointer Base, register unsigned long Offset); - -#include <machine/sysarch.h> - -extern int sysarch(int, char *); - -struct parms { - u_int64_t hae; -}; - -static int -sethae(u_int64_t hae) -{ - struct parms p; - p.hae = hae; - return (sysarch(ALPHA_SETHAE, (char *)&p)); -} - -static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - static Bool was_here = FALSE; - - if (!was_here) { - was_here = TRUE; - - checkDevMem(FALSE); - - xf86WriteMmio8 = writeSparse8; - xf86WriteMmio16 = writeSparse16; - xf86WriteMmio32 = writeSparse32; - xf86WriteMmioNB8 = writeSparseNB8; - xf86WriteMmioNB16 = writeSparseNB16; - xf86WriteMmioNB32 = writeSparseNB32; - xf86ReadMmio8 = readSparse8; - xf86ReadMmio16 = readSparse16; - xf86ReadMmio32 = readSparse32; - - memBase = mmap((caddr_t)0, 0x100000000, - PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) dense_base()); - memSBase = mmap((caddr_t)0, 0x100000000, - PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) memory_base()); - - if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { - FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", - strerror(errno)); - } - } - return (pointer)((unsigned long)memBase + Base); -} - -static void -unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) -{ -} - -static int -readSparse8(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - register unsigned long msb; - - mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - shift = (Offset & 0x3) << 3; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - - result = *(vuip) ((unsigned long)memSBase + (Offset << 5)); - result >>= shift; - return 0xffUL & result; -} - -static int -readSparse16(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - register unsigned long msb; - - mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - shift = (Offset & 0x2) << 3; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))); - result >>= shift; - return 0xffffUL & result; -} - -static int -readSparse32(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(vuip)((unsigned long)Base+(Offset)); -} - -static void -writeSparse8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int b = Value & 0xffU; - - write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; -} - -static void -writeSparse16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int w = Value & 0xffffU; - - write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = - w * 0x00010001; - -} - -static void -writeSparse32(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(vuip)((unsigned long)Base + (Offset)) = Value; - return; -} - -static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int b = Value & 0xffU; - - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; -} - -static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int w = Value & 0xffffU; - - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask ; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = - w * 0x00010001; -} - -static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset) -{ - *(vuip)((unsigned long)Base + (Offset)) = Value; - return; -} - -void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset) - = writeDense8; -void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset) - = writeDense16; -void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset) - = writeDense32; -void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB8; -void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB16; -void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB32; -int (*xf86ReadMmio8)(pointer Base, unsigned long Offset) - = readDense8; -int (*xf86ReadMmio16)(pointer Base, unsigned long Offset) - = readDense16; -int (*xf86ReadMmio32)(pointer Base, unsigned long Offset) - = readDense32; - -#endif /* __FreeBSD__ && __alpha__ */ - -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -static pointer -NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - struct mtrr *mtrrp; - int n; - - xf86DrvMsg(screenNum, X_WARNING, - "%s MTRR %lx - %lx\n", enable ? "set" : "remove", - base, (base + size)); - - mtrrp = xnfalloc(sizeof (struct mtrr)); - mtrrp->base = base; - mtrrp->len = size; - mtrrp->type = MTRR_TYPE_WC; - - /* - * MTRR_PRIVATE will make this MTRR get reset automatically - * if this process exits, so we have no need for an explicit - * cleanup operation when starting a new server. - */ - - if (enable) - mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; - else - mtrrp->flags = 0; - n = 1; - - if (i386_set_mtrr(mtrrp, &n) < 0) { - xfree(mtrrp); - return NULL; - } - return mtrrp; -} - -static void -NetBSDundoWC(int screenNum, pointer list) -{ - struct mtrr *mtrrp = (struct mtrr *)list; - int n; - - if (mtrrp == NULL) - return; - n = 1; - mtrrp->flags &= ~MTRR_VALID; - i386_set_mtrr(mtrrp, &n); - xfree(mtrrp); -} -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c:1.2 --- /dev/null Thu Feb 27 12:32:20 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c Tue Sep 10 11:53:31 2002 @@ -0,0 +1,877 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c,v 1.2 2002/09/10 15:53:31 dawes Exp $ */ +/* + * Copyright 1992 by Rich Murphey <Rich@Rice.edu> + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" + +#ifdef HAS_MTRR_SUPPORT +#ifndef __NetBSD__ +#include <sys/types.h> +#include <sys/memrange.h> +#else +#include "memrange.h" +#endif +#define X_MTRR_ID "XFree86" +#endif + +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) +#include <machine/mtrr.h> +#include <machine/sysarch.h> +#include <sys/queue.h> +#endif + +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +#if defined(__NetBSD__) && !defined(MAP_FILE) +#define MAP_FLAGS MAP_SHARED +#else +#define MAP_FLAGS (MAP_FILE | MAP_SHARED) +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((caddr_t)-1) +#endif + +#ifdef __OpenBSD__ +#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" +#define SYSCTL_MSG2 \ + "Check that you have set 'machdep.allowaperture=2'\n" \ + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" +#endif + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +static Bool useDevMem = FALSE; +static int devMemFd = -1; + +#ifdef HAS_APERTURE_DRV +#define DEV_APERTURE "/dev/xf86" +#endif +#define DEV_MEM "/dev/mem" + +static pointer mapVidMem(int, unsigned long, unsigned long, int); +static void unmapVidMem(int, pointer, unsigned long); + +#ifdef HAS_MTRR_SUPPORT +static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); +static void undoWC(int, pointer); +static Bool cleanMTRR(void); +#endif +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) +static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool, + MessageType); +static void NetBSDundoWC(int, pointer); +#endif + + +/* + * Check if /dev/mem can be mmap'd. If it can't print a warning when + * "warn" is TRUE. + */ +static void +checkDevMem(Bool warn) +{ + static Bool devMemChecked = FALSE; + int fd; + pointer base; + + if (devMemChecked) + return; + devMemChecked = TRUE; + + if ((fd = open(DEV_MEM, O_RDWR)) >= 0) + { + /* Try to map a page at the VGA address */ + base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0xA0000); + + if (base != MAP_FAILED) + { + munmap((caddr_t)base, 4096); + devMemFd = fd; + useDevMem = TRUE; + return; + } else { + /* This should not happen */ + if (warn) + { + xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", + DEV_MEM, strerror(errno)); + } + useDevMem = FALSE; + return; + } + } +#ifndef HAS_APERTURE_DRV + if (warn) + { + xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", + DEV_MEM, strerror(errno)); + } + useDevMem = FALSE; + return; +#else + /* Failed to open /dev/mem, try the aperture driver */ + if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) + { + /* Try to map a page at the VGA address */ + base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + MAP_FLAGS, fd, (off_t)0xA0000); + + if (base != MAP_FAILED) + { + munmap((caddr_t)base, 4096); + devMemFd = fd; + useDevMem = TRUE; + xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", + DEV_APERTURE); + return; + } else { + + if (warn) + { + xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", + DEV_APERTURE, strerror(errno)); + } + } + } else { + if (warn) + { +#ifndef __OpenBSD__ + xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" + "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno)); +#else /* __OpenBSD__ */ + xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" + "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno), + SYSCTL_MSG); +#endif /* __OpenBSD__ */ + } + } + + useDevMem = FALSE; + return; + +#endif +} + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + checkDevMem(TRUE); + pVidMem->linearSupported = useDevMem; + pVidMem->mapMem = mapVidMem; + pVidMem->unmapMem = unmapVidMem; + +#ifdef HAS_MTRR_SUPPORT + if (useDevMem) { + if (cleanMTRR()) { + pVidMem->setWC = setWC; + pVidMem->undoWC = undoWC; + } + } +#endif +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) + pVidMem->setWC = NetBSDsetWC; + pVidMem->undoWC = NetBSDundoWC; +#endif + pVidMem->initialised = TRUE; +} + +static pointer +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + pointer base; + + checkDevMem(FALSE); + + if (useDevMem) + { + if (devMemFd < 0) + { + FatalError("xf86MapVidMem: failed to open %s (%s)\n", + DEV_MEM, strerror(errno)); + } + base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, + MAP_FLAGS, devMemFd, (off_t)Base); + if (base == MAP_FAILED) + { + FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", DEV_MEM, Size, Base, + strerror(errno)); + } + return(base); + } + + /* else, mmap /dev/vga */ + if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) + { + FatalError("%s: Address 0x%x outside allowable range\n", + "xf86MapVidMem", Base); + } + base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS, + xf86Info.screenFd, + (unsigned long)Base - 0xA0000 + ); + if (base == MAP_FAILED) + { + FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", + strerror(errno)); + } + return(base); +} + +static void +unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap((caddr_t)Base, Size); +} + +/* + * Read BIOS via mmap()ing DEV_MEM + */ + +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + unsigned char *ptr; + int psize; + int mlen; + + checkDevMem(TRUE); + if (devMemFd == -1) { + return(-1); + } + + psize = xf86getpagesize(); + Offset += Base & (psize - 1); + Base &= ~(psize - 1); + mlen = (Offset + Len + psize - 1) & ~(psize - 1); + ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, + MAP_SHARED, devMemFd, (off_t)Base); + if ((long)ptr == -1) + { + xf86Msg(X_WARNING, + "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n", + DEV_MEM, Len, Base, Offset, strerror(errno)); +#ifdef __OpenBSD__ + if (Base < 0xa0000) { + xf86Msg(X_WARNING, SYSCTL_MSG2); + } +#endif + return(-1); + } +#ifdef DEBUG + ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", + Base, ptr[0] | (ptr[1] << 8)); +#endif + (void)memcpy(Buf, (void *)(ptr + Offset), Len); + (void)munmap((caddr_t)ptr, mlen); +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" + "-> %02x %02x %02x %02x...\n", + Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); +#endif + return(Len); +} + + +#ifdef USE_I386_IOPL +/***************************************************************************/ +/* I/O Permissions section */ +/***************************************************************************/ + +static Bool ExtendedEnabled = FALSE; + +void +xf86EnableIO() +{ + if (ExtendedEnabled) + return; + + if (i386_iopl(TRUE) < 0) + { +#ifndef __OpenBSD__ + FatalError("%s: Failed to set IOPL for extended I/O\n", + "xf86EnableIO"); +#else + FatalError("%s: Failed to set IOPL for extended I/O\n%s", + "xf86EnableIO", SYSCTL_MSG); +#endif + } + ExtendedEnabled = TRUE; + + return; +} + +void +xf86DisableIO() +{ + if (!ExtendedEnabled) + return; + + i386_iopl(FALSE); + ExtendedEnabled = FALSE; + + return; +} + +#endif /* USE_I386_IOPL */ + +#ifdef USE_DEV_IO +static int IoFd = -1; + +void +xf86EnableIO() +{ + if (IoFd >= 0) + return; + + if ((IoFd = open("/dev/io", O_RDWR)) == -1) + { + FatalError("xf86EnableIO: " + "Failed to open /dev/io for extended I/O\n"); + } + return; +} + +void +xf86DisableIO() +{ + if (IoFd < 0) + return; + + close(IoFd); + IoFd = -1; + return; +} + +#endif + + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool +xf86DisableInterrupts() +{ + +#ifdef __GNUC__ + __asm__ __volatile__("cli"); +#else + asm("cli"); +#endif /* __GNUC__ */ + + return(TRUE); +} + +void +xf86EnableInterrupts() +{ + +#ifdef __GNUC__ + __asm__ __volatile__("sti"); +#else + asm("sti"); +#endif /* __GNUC__ */ + + return; +} + + +#ifdef __NetBSD__ +/***************************************************************************/ +/* Set TV output mode */ +/***************************************************************************/ +void +xf86SetTVOut(int mode) +{ + switch (xf86Info.consType) + { +#ifdef PCCONS_SUPPORT + case PCCONS:{ + + if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) + { + xf86Msg(X_WARNING, + "xf86SetTVOut: Could not set console to TV output, %s\n", + strerror(errno)); + } + } + break; +#endif /* PCCONS_SUPPORT */ + + default: + FatalError("Xf86SetTVOut: Unsupported console\n"); + break; + } + return; +} + +void +xf86SetRGBOut() +{ + switch (xf86Info.consType) + { +#ifdef PCCONS_SUPPORT + case PCCONS:{ + + if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) + { + xf86Msg(X_WARNING, + "xf86SetTVOut: Could not set console to RGB output, %s\n", + strerror(errno)); + } + } + break; +#endif /* PCCONS_SUPPORT */ + + default: + FatalError("Xf86SetTVOut: Unsupported console\n"); + break; + } + return; +} +#endif + + +#ifdef HAS_MTRR_SUPPORT +/* memory range (MTRR) support for FreeBSD */ + +/* + * This code is experimental. Some parts may be overkill, and other parts + * may be incomplete. + */ + +/* + * getAllRanges returns the full list of memory ranges with attributes set. + */ + +static struct mem_range_desc * +getAllRanges(int *nmr) +{ + struct mem_range_desc *mrd; + struct mem_range_op mro; + + /* + * Find how many ranges there are. If this fails, then the kernel + * probably doesn't have MTRR support. + */ + mro.mo_arg[0] = 0; + if (ioctl(devMemFd, MEMRANGE_GET, &mro)) + return NULL; + *nmr = mro.mo_arg[0]; + mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc)); + mro.mo_arg[0] = *nmr; + mro.mo_desc = mrd; + if (ioctl(devMemFd, MEMRANGE_GET, &mro)) { + xfree(mrd); + return NULL; + } + return mrd; +} + +/* + * cleanMTRR removes any memory attribute that may be left by a previous + * X server. Normally there won't be any, but this takes care of the + * case where a server crashed without being able finish cleaning up. + */ + +static Bool +cleanMTRR() +{ + struct mem_range_desc *mrd; + struct mem_range_op mro; + int nmr, i; + + /* This shouldn't happen */ + if (devMemFd < 0) + return FALSE; + + if (!(mrd = getAllRanges(&nmr))) + return FALSE; + + for (i = 0; i < nmr; i++) { + if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 && + (mrd[i].mr_flags & MDF_ACTIVE)) { +#ifdef DEBUG + ErrorF("Clean for (0x%lx,0x%lx)\n", + (unsigned long)mrd[i].mr_base, + (unsigned long)rd[i].mr_len); +#endif + if (mrd[i].mr_flags & MDF_FIXACTIVE) { + mro.mo_arg[0] = MEMRANGE_SET_UPDATE; + mrd[i].mr_flags = MDF_UNCACHEABLE; + } else { + mro.mo_arg[0] = MEMRANGE_SET_REMOVE; + } + mro.mo_desc = mrd + i; + ioctl(devMemFd, MEMRANGE_SET, &mro); + } + } +#ifdef DEBUG + sleep(10); +#endif + xfree(mrd); + return TRUE; +} + +typedef struct x_RangeRec { + struct mem_range_desc mrd; + Bool wasWC; + struct x_RangeRec * next; +} RangeRec, *RangePtr; + +static void +freeRangeList(RangePtr range) +{ + RangePtr rp; + + while (range) { + rp = range; + range = rp->next; + xfree(rp); + } +} + +static RangePtr +dupRangeList(RangePtr list) +{ + RangePtr new = NULL, rp, p; + + rp = list; + while (rp) { + p = xnfalloc(sizeof(RangeRec)); + *p = *rp; + p->next = new; + new = p; + rp = rp->next; + } + return new; +} + +static RangePtr +sortRangeList(RangePtr list) +{ + RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev; + unsigned long minBase; + + /* Sort by base address */ + rp1 = copy = dupRangeList(list); + while (rp1) { + minBase = rp1->mrd.mr_base; + minp = rp1; + minprev = NULL; + prev = rp1; + rp2 = rp1->next; + while (rp2) { + if (rp2->mrd.mr_base < minBase) { + minBase = rp2->mrd.mr_base; + minp = rp2; + minprev = prev; + } + prev = rp2; + rp2 = rp2->next; + } + if (minprev) { + minprev->next = minp->next; + rp1 = copy; + } else { + rp1 = minp->next; + } + minp->next = sorted; + sorted = minp; + } + return sorted; +} + +/* + * findRanges returns a list of ranges that overlap the specified range. + */ + +static void +findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) +{ + struct mem_range_desc *mrd; + int nmr, i; + RangePtr rp, *p; + + if (!(mrd = getAllRanges(&nmr))) + return; + + for (i = 0; i < nmr; i++) { + if ((mrd[i].mr_flags & MDF_ACTIVE) && + mrd[i].mr_base < base + size && + mrd[i].mr_base + mrd[i].mr_len > base) { + if (mrd[i].mr_flags & MDF_WRITECOMBINE) + p = wcp; + else if (mrd[i].mr_flags & MDF_UNCACHEABLE) + p = ucp; + else + continue; + rp = xnfalloc(sizeof(RangeRec)); + rp->mrd = mrd[i]; + rp->next = *p; + *p = rp; + } + } + xfree(mrd); +} + +/* + * This checks if the existing overlapping ranges fully cover the requested + * range. Is this overkill? + */ + +static Bool +fullCoverage(unsigned long base, unsigned long size, RangePtr overlap) +{ + RangePtr rp1, sorted = NULL; + unsigned long end; + + sorted = sortRangeList(overlap); + /* Look for gaps */ + rp1 = sorted; + end = base + size; + while (rp1) { + if (rp1->mrd.mr_base > base) { + freeRangeList(sorted); + return FALSE; + } else { + base = rp1->mrd.mr_base + rp1->mrd.mr_len; + } + if (base >= end) { + freeRangeList(sorted); + return TRUE; + } + rp1 = rp1->next; + } + freeRangeList(sorted); + return FALSE; +} + +static pointer +addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) +{ + RangePtr uc = NULL, wc = NULL, retlist = NULL; + struct mem_range_desc mrd; + struct mem_range_op mro; + + findRanges(base, size, &uc, &wc); + + /* See of the full range is already WC */ + if (!uc && fullCoverage(base, size, wc)) { + xf86DrvMsg(screenNum, from, + "Write-combining range (0x%lx,0x%lx) was already set\n", + base, size); + return NULL; + } + + /* Otherwise, try to add the new range */ + mrd.mr_base = base; + mrd.mr_len = size; + strcpy(mrd.mr_owner, X_MTRR_ID); + mrd.mr_flags = MDF_WRITECOMBINE; + mro.mo_desc = &mrd; + mro.mo_arg[0] = MEMRANGE_SET_UPDATE; + if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { + xf86DrvMsg(screenNum, X_WARNING, + "Failed to set write-combining range " + "(0x%lx,0x%lx)\n", base, size); + return NULL; + } else { + xf86DrvMsg(screenNum, from, + "Write-combining range (0x%lx,0x%lx)\n", base, size); + retlist = xnfalloc(sizeof(RangeRec)); + retlist->mrd = mrd; + retlist->wasWC = FALSE; + retlist->next = NULL; + return retlist; + } +} + +static pointer +delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) +{ + RangePtr uc = NULL, wc = NULL, retlist = NULL; + struct mem_range_desc mrd; + struct mem_range_op mro; + + findRanges(base, size, &uc, &wc); + + /* + * See of the full range is already not WC, or if there is full + * coverage from UC ranges. + */ + if (!wc || fullCoverage(base, size, uc)) { + xf86DrvMsg(screenNum, from, + "Write-combining range (0x%lx,0x%lx) was already clear\n", + base, size); + return NULL; + } + + /* Otherwise, try to add the new range */ + mrd.mr_base = base; + mrd.mr_len = size; + strcpy(mrd.mr_owner, X_MTRR_ID); + mrd.mr_flags = MDF_UNCACHEABLE; + mro.mo_desc = &mrd; + mro.mo_arg[0] = MEMRANGE_SET_UPDATE; + if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { + xf86DrvMsg(screenNum, X_WARNING, + "Failed to remove write-combining range " + "(0x%lx,0x%lx)\n", base, size); + /* XXX Should then remove all of the overlapping WC ranges */ + return NULL; + } else { + xf86DrvMsg(screenNum, from, + "Removed Write-combining range (0x%lx,0x%lx)\n", + base, size); + retlist = xnfalloc(sizeof(RangeRec)); + retlist->mrd = mrd; + retlist->wasWC = TRUE; + retlist->next = NULL; + return retlist; + } +} + +static pointer +setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, + MessageType from) +{ + if (enable) + return addWC(screenNum, base, size, from); + else + return delWC(screenNum, base, size, from); +} + +static void +undoWC(int screenNum, pointer list) +{ + RangePtr rp; + struct mem_range_op mro; + Bool failed; + + rp = list; + while (rp) { +#ifdef DEBUG + ErrorF("Undo for (0x%lx,0x%lx), %d\n", + (unsigned long)rp->mrd.mr_base, + (unsigned long)rp->mrd.mr_len, rp->wasWC); +#endif + failed = FALSE; + if (rp->wasWC) { + mro.mo_arg[0] = MEMRANGE_SET_UPDATE; + rp->mrd.mr_flags = MDF_WRITECOMBINE; + strcpy(rp->mrd.mr_owner, "unknown"); + } else { + mro.mo_arg[0] = MEMRANGE_SET_REMOVE; + } + mro.mo_desc = &rp->mrd; + + if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { + if (!rp->wasWC) { + mro.mo_arg[0] = MEMRANGE_SET_UPDATE; + rp->mrd.mr_flags = MDF_UNCACHEABLE; + strcpy(rp->mrd.mr_owner, "unknown"); + if (ioctl(devMemFd, MEMRANGE_SET, &mro)) + failed = TRUE; + } else + failed = TRUE; + } + if (failed) { + xf86DrvMsg(screenNum, X_WARNING, + "Failed to restore MTRR range (0x%lx,0x%lx)\n", + (unsigned long)rp->mrd.mr_base, + (unsigned long)rp->mrd.mr_len); + } + rp = rp->next; + } +} + +#endif /* HAS_MTRR_SUPPORT */ + + +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) +static pointer +NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, + MessageType from) +{ + struct mtrr *mtrrp; + int n; + + xf86DrvMsg(screenNum, X_WARNING, + "%s MTRR %lx - %lx\n", enable ? "set" : "remove", + base, (base + size)); + + mtrrp = xnfalloc(sizeof (struct mtrr)); + mtrrp->base = base; + mtrrp->len = size; + mtrrp->type = MTRR_TYPE_WC; + + /* + * MTRR_PRIVATE will make this MTRR get reset automatically + * if this process exits, so we have no need for an explicit + * cleanup operation when starting a new server. + */ + + if (enable) + mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; + else + mtrrp->flags = 0; + n = 1; + + if (i386_set_mtrr(mtrrp, &n) < 0) { + xfree(mtrrp); + return NULL; + } + return mtrrp; +} + +static void +NetBSDundoWC(int screenNum, pointer list) +{ + struct mtrr *mtrrp = (struct mtrr *)list; + int n; + + if (mtrrp == NULL) + return; + n = 1; + mtrrp->flags &= ~MTRR_VALID; + i386_set_mtrr(mtrrp, &n); + xfree(mtrrp); +} +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h:1.1 --- /dev/null Thu Feb 27 12:32:20 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h Tue Aug 6 09:25:36 2002 @@ -0,0 +1,68 @@ +/* + * Memory range attribute operations, peformed on /dev/mem + * + * $FreeBSD: src/sys/sys/memrange.h,v 1.4 1999/12/29 04:24:44 peter Exp $ + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h,v 1.1 2002/08/06 13:25:36 herrb Exp $ */ + +#ifndef _MEMRANGE_H +#define _MEMRANGE_H + +/* Memory range attributes */ +#define MDF_UNCACHEABLE (1<<0) /* region not cached */ +#define MDF_WRITECOMBINE (1<<1) /* region supports "write combine" + * action */ +#define MDF_WRITETHROUGH (1<<2) /* write-through cached */ +#define MDF_WRITEBACK (1<<3) /* write-back cached */ +#define MDF_WRITEPROTECT (1<<4) /* read-only region */ +#define MDF_ATTRMASK (0x00ffffff) + +#define MDF_FIXBASE (1<<24) /* fixed base */ +#define MDF_FIXLEN (1<<25) /* fixed length */ +#define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */ +#define MDF_ACTIVE (1<<27) /* currently active */ +#define MDF_BOGUS (1<<28) /* we don't like it */ +#define MDF_FIXACTIVE (1<<29) /* can't be turned off */ +#define MDF_BUSY (1<<30) /* range is in use */ + +struct mem_range_desc { + u_int64_t mr_base; + u_int64_t mr_len; + int mr_flags; + char mr_owner[8]; +}; + +struct mem_range_op { + struct mem_range_desc *mo_desc; + int mo_arg[2]; +#define MEMRANGE_SET_UPDATE 0 +#define MEMRANGE_SET_REMOVE 1 + /* XXX want a flag that says "set and undo when I exit" */ +}; +#define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op) +#define MEMRANGE_SET _IOW('m', 51, struct mem_range_op) + +#ifdef _KERNEL + +struct mem_range_softc; +struct mem_range_ops { + void (*init) __P((struct mem_range_softc * sc)); + int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg)); + void (*initAP) __P((struct mem_range_softc * sc)); +}; + +struct mem_range_softc { + struct mem_range_ops *mr_op; + int mr_cap; + int mr_ndesc; + struct mem_range_desc *mr_desc; +}; + +extern struct mem_range_softc mem_range_softc; + +extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg)); +extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg)); +extern void mem_range_AP_init __P((void)); +#endif + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c:1.3 --- /dev/null Thu Feb 27 12:32:20 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c Sat Nov 9 12:28:08 2002 @@ -0,0 +1,130 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c,v 1.3 2002/11/09 17:28:08 herrb Exp $ */ +/* + * Copyright 1992 by Rich Murphey <Rich@Rice.edu> + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" + +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +#include "bus/Pci.h" + +#ifndef MAP_FAILED +#define MAP_FAILED ((caddr_t)-1) +#endif + + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +#define DEV_MEM "/dev/mem" + +static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags); +static void ppcUnmapVidMem(int, pointer, unsigned long); + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + pVidMem->linearSupported = TRUE; + pVidMem->mapMem = ppcMapVidMem; + pVidMem->unmapMem = ppcUnmapVidMem; + pVidMem->initialised = TRUE; +} + + +volatile unsigned char *ioBase = MAP_FAILED; + +static pointer +ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + int fd = xf86Info.screenFd; + pointer base; +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", + Base, Size, fd); +#endif + + base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base); + if (base == MAP_FAILED) + FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", Size, Base, strerror(errno)); + + return base; +} + +static void +ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap(Base, Size); +} + +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + int rv; + static int kmem = -1; + + if (kmem == -1) { + kmem = open("/dev/xf86", 2); + if (kmem == -1) { + FatalError("xf86ReadBIOS: open /dev/xf86\n"); + } + } + +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", + Base, Offset, Len); +#endif + + + lseek(kmem, Base + Offset, 0); + rv = read(kmem, Buf, Len); + + return rv; +} + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool +xf86DisableInterrupts() +{ + + return(TRUE); +} + +void +xf86EnableInterrupts() +{ + + return; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c:1.1 --- /dev/null Thu Feb 27 12:32:20 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c Tue Aug 6 09:08:39 2002 @@ -0,0 +1,106 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c,v 1.1 2002/08/06 13:08:39 herrb Exp $ */ +/* + * Copyright 1992 by Rich Murphey <Rich@Rice.edu> + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + +/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" + +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +#ifndef MAP_FAILED +#define MAP_FAILED ((caddr_t)-1) +#endif + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +static pointer sparc64MapVidMem(int, unsigned long, unsigned long, int); +static void sparc64UnmapVidMem(int, pointer, unsigned long); + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + pVidMem->linearSupported = TRUE; + pVidMem->mapMem = sparc64MapVidMem; + pVidMem->unmapMem = sparc64UnmapVidMem; + pVidMem->initialised = TRUE; +} + +static pointer +sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, + int flags) +{ + int fd = xf86Info.screenFd; + pointer base; + +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", + Base, Size, fd); +#endif + + base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base); + if (base == MAP_FAILED) + FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", Size, Base, strerror(errno)); + return base; +} + +static void +sparc64UnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap(Base, Size); +} + +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + + return (0); +} + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool +xf86DisableInterrupts() +{ + + return(TRUE); +} + +void +xf86EnableInterrupts() +{ + + return; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.9 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.9 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile Wed Oct 30 07:52:24 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.9 2001/12/16 19:45:01 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.12 2002/10/30 12:52:24 alanh Exp $ XCOMM $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.7 1999/09/14 19:55:15 faith Exp $ #define IHaveModules @@ -18,24 +18,14 @@ xf86drmHash.c \ xf86drmRandom.c \ xf86drmSL.c \ - xf86drmI810.c \ - xf86drmI830.c \ - xf86drmMga.c \ - xf86drmR128.c \ - xf86drmRadeon.c \ - xf86drmSiS.c \ + xf86drmCompat.c \ $(MSRC) OBJS = xf86drm.o \ xf86drmHash.o \ xf86drmRandom.o \ xf86drmSL.o \ - xf86drmI810.o \ - xf86drmI830.o \ - xf86drmMga.o \ - xf86drmR128.o \ - xf86drmRadeon.o \ - xf86drmSiS.o \ + xf86drmCompat.o \ $(MOBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ @@ -56,19 +46,16 @@ DependSubdirs($(SUBDIRS)) #endif +DependTarget() + #if DoLoadableServer LinkSourceFile(drmmodule.c,$(XF86OSSRC)/linux/drm) #endif LinkSourceFile(xf86drm.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/linux/drm) -LinkSourceFile(xf86drmI810.c,$(XF86OSSRC)/linux/drm) -LinkSourceFile(xf86drmI830.c,$(XF86OSSRC)/linux/drm) -LinkSourceFile(xf86drmMga.c,$(XF86OSSRC)/linux/drm) -LinkSourceFile(xf86drmR128.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmRandom.c,$(XF86OSSRC)/linux/drm) -LinkSourceFile(xf86drmRadeon.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmSL.c,$(XF86OSSRC)/linux/drm) -LinkSourceFile(xf86drmSiS.c,$(XF86OSSRC)/linux/drm) +LinkSourceFile(xf86drmCompat.c,$(XF86OSSRC)/linux/drm) InstallDriverSDKLibraryModule(drm,$(DRIVERSDKMODULEDIR),freebsd) Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.8 Wed Dec 12 19:24:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile Mon Dec 16 11:19:20 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.8 2001/12/13 00:24:45 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.11 2002/12/16 16:19:20 dawes Exp $ XCOMM This is a kludge until we determine how best to build the XCOMM kernel-specific device driver. This allows us to continue @@ -18,3 +18,26 @@ clean:: $(MAKE) -f Makefile.bsd clean + +LinkSourceFile(drm_sarea.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_dma.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_drm.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_drv.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_irq.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_state.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_ucode.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_warp.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_cce.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_drm.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_drv.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_irq.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_state.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_cp.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_drm.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_drv.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_irq.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_mem.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_state.c,$(XF86OSSRC)/shared/drm/kernel) Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.6 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.6 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd Sat Feb 8 16:26:59 2003 @@ -1,6 +1,6 @@ # $FreeBSD$ # i810, i830 & sis are not complete -SUBDIR = tdfx mga r128 radeon gamma # i810 sis i830 +SUBDIR = mga r128 radeon tdfx # gamma i810 i830 sis .include <bsd.subdir.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h:1.1 Wed Dec 12 19:24:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h Wed Oct 30 07:52:24 2002 @@ -27,7 +27,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" #if PAGE_SIZE == 8192 @@ -46,40 +45,20 @@ static unsigned long DRM(ati_alloc_pcigart_table)( void ) { unsigned long address; - struct page *page; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - address = __get_free_pages( GFP_KERNEL, ATI_PCIGART_TABLE_ORDER ); - if ( address == 0UL ) { - return 0; - } + DRM_DEBUG( "\n" ); - page = virt_to_page( address ); - - for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { - atomic_inc( &page->count ); - SetPageReserved( page ); - } + address = (unsigned long) malloc( (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM), M_WAITOK ); - DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); + DRM_DEBUG( "returning 0x%08lx\n", address ); return address; } static void DRM(ati_free_pcigart_table)( unsigned long address ) { - struct page *page; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - page = virt_to_page( address ); - - for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { - atomic_dec( &page->count ); - ClearPageReserved( page ); - } + DRM_DEBUG( "\n" ); - free_pages( address, ATI_PCIGART_TABLE_ORDER ); + free( (void *)address, DRM(M_DRM)); } int DRM(ati_pcigart_init)( drm_device_t *dev, @@ -89,7 +68,7 @@ drm_sg_mem_t *entry = dev->sg; unsigned long address = 0; unsigned long pages; - u32 *pci_gart, page_base, bus_address = 0; + u32 *pci_gart=0, page_base, bus_address = 0; int i, j, ret = 0; if ( !entry ) { @@ -102,42 +81,37 @@ DRM_ERROR( "cannot allocate PCI GART page!\n" ); goto done; } - - if ( !dev->pdev ) { - DRM_ERROR( "PCI device unknown!\n" ); - goto done; - } - bus_address = pci_map_single(dev->pdev, (void *)address, + /* FIXME non-vtophys==bustophys-arches */ + bus_address = vtophys( address ); + /*pci_map_single(dev->pdev, (void *)address, ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, - PCI_DMA_TODEVICE); - if (bus_address == 0) { + PCI_DMA_TODEVICE);*/ +/* if (bus_address == 0) { DRM_ERROR( "unable to map PCIGART pages!\n" ); - DRM(ati_free_pcigart_table)( address ); + DRM(ati_free_pcigart_table)( (unsigned long)address ); address = 0; goto done; - } + }*/ pci_gart = (u32 *)address; pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) ? entry->pages : ATI_MAX_PCIGART_PAGES; - memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); + bzero( pci_gart, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); for ( i = 0 ; i < pages ; i++ ) { /* we need to support large memory configurations */ - entry->busaddr[i] = pci_map_single(dev->pdev, - page_address( entry->pagelist[i] ), - PAGE_SIZE, - PCI_DMA_TODEVICE); - if (entry->busaddr[i] == 0) { + /* FIXME non-vtophys==vtobus-arches */ + entry->busaddr[i] = vtophys( entry->handle + (i*PAGE_SIZE) ); +/* if (entry->busaddr[i] == 0) { DRM_ERROR( "unable to map PCIGART pages!\n" ); - DRM(ati_pcigart_cleanup)( dev, address, bus_address ); + DRM(ati_pcigart_cleanup)( dev, (unsigned long)address, bus_address ); address = 0; bus_address = 0; goto done; - } + }*/ page_base = (u32) entry->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { @@ -148,11 +122,7 @@ ret = 1; -#if defined(__i386__) || defined(__x86_64__) - asm volatile ( "wbinvd" ::: "memory" ); -#else - mb(); -#endif + DRM_READMEMORYBARRIER(); done: *addr = address; @@ -165,28 +135,11 @@ dma_addr_t bus_addr) { drm_sg_mem_t *entry = dev->sg; - unsigned long pages; - int i; /* we need to support large memory configurations */ if ( !entry ) { DRM_ERROR( "no scatter/gather memory!\n" ); return 0; - } - - if ( bus_addr ) { - pci_unmap_single(dev->pdev, bus_addr, - ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, - PCI_DMA_TODEVICE); - - pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) - ? entry->pages : ATI_MAX_PCIGART_PAGES; - - for ( i = 0 ; i < pages ; i++ ) { - if ( !entry->busaddr[i] ) break; - pci_unmap_single(dev->pdev, entry->busaddr[i], - PAGE_SIZE, PCI_DMA_TODEVICE); - } } if ( addr ) { Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h:1.4 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h Tue Jan 14 22:36:27 2003 @@ -35,8 +35,31 @@ #ifndef _DRM_H_ #define _DRM_H_ +#if defined(__linux__) +#include <linux/config.h> +#include <asm/ioctl.h> /* For _IO* macros */ +#define DRM_IOCTL_NR(n) _IOC_NR(n) +#define DRM_IOC_VOID _IOC_NONE +#define DRM_IOC_READ _IOC_READ +#define DRM_IOC_WRITE _IOC_WRITE +#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE +#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) +#elif defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) && defined(XFree86Server) +/* Prevent name collision when including sys/ioccom.h */ +#undef ioctl #include <sys/ioccom.h> -#define DRM_IOCTL_NR(n) ((n) & 0xff) +#define ioctl(a,b,c) xf86ioctl(a,b,c) +#else +#include <sys/ioccom.h> +#endif /* __FreeBSD__ && xf86ioctl */ +#define DRM_IOCTL_NR(n) ((n) & 0xff) +#define DRM_IOC_VOID IOC_VOID +#define DRM_IOC_READ IOC_OUT +#define DRM_IOC_WRITE IOC_IN +#define DRM_IOC_READWRITE IOC_INOUT +#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) +#endif #define XFREE86_VERSION(major,minor,patch,snap) \ ((major << 16) | (minor << 8) | patch) @@ -62,7 +85,7 @@ #define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */ -#define DRM_RAM_PERCENT 50 /* How much system ram can we lock? */ +#define DRM_RAM_PERCENT 10 /* How much system ram can we lock? */ #define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */ #define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */ @@ -78,6 +101,10 @@ /* Warning: If you change this structure, make sure you change * XF86DRIClipRectRec in the server as well */ +/* KW: Actually it's illegal to change either for + * backwards-compatibility reasons. + */ + typedef struct drm_clip_rect { unsigned short x1; unsigned short y1; @@ -93,14 +120,6 @@ unsigned int age; } drm_tex_region_t; -/* Seperate include files for the driver specific structures */ -#include "mga_drm.h" -#include "i810_drm.h" -#include "i830_drm.h" -#include "r128_drm.h" -#include "radeon_drm.h" -#include "sis_drm.h" - typedef struct drm_version { int version_major; /* Major version */ int version_minor; /* Minor version */ @@ -326,6 +345,32 @@ int funcnum; } drm_irq_busid_t; +typedef enum { + _DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */ + _DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */ + _DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */ +} drm_vblank_seq_type_t; + +#define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL + +struct drm_wait_vblank_request { + drm_vblank_seq_type_t type; + unsigned int sequence; + unsigned long signal; +}; + +struct drm_wait_vblank_reply { + drm_vblank_seq_type_t type; + unsigned int sequence; + long tval_sec; + long tval_usec; +}; + +typedef union drm_wait_vblank { + struct drm_wait_vblank_request request; + struct drm_wait_vblank_reply reply; +} drm_wait_vblank_t; + typedef struct drm_agp_mode { unsigned long mode; } drm_agp_mode_t; @@ -365,11 +410,10 @@ #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) -#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size) -#define DRM_IOW(nr,size) _IOW(DRM_IOCTL_BASE,nr,size) -#define DRM_IOWR(nr,size) _IOWR(DRM_IOCTL_BASE,nr,size) +#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) +#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) +#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) - #define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) @@ -420,82 +464,11 @@ #define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) + +#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) -/* MGA specific ioctls */ -#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) -#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) -#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) -#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) -#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) -#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) -#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) - -/* i810 specific ioctls */ -#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) -#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) -#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) -#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) -#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) -#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) -#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) -#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) -#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) - -/* Rage 128 specific ioctls */ -#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) -#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) -#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) -#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) -#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) -#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) -#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) -#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) -#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) -#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) -#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) -#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) -#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) - -/* Radeon specific ioctls */ -#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) -#define DRM_IOCTL_RADEON_CP_START DRM_IO( 0x41) -#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( 0x42, drm_radeon_cp_stop_t) -#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( 0x43) -#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_RADEON_RESET DRM_IO( 0x45) -#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t) -#define DRM_IOCTL_RADEON_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) -#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) -#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) -#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) -#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) -#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) - -/* SiS specific ioctls */ - -#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) -#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) -#define SIS_IOCTL_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) -#define SIS_IOCTL_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) -#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) -#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) -#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) -#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) - -/* I830 specific ioctls */ -#define DRM_IOCTL_I830_INIT DRM_IOW( 0x40, drm_i830_init_t) -#define DRM_IOCTL_I830_VERTEX DRM_IOW( 0x41, drm_i830_vertex_t) -#define DRM_IOCTL_I830_CLEAR DRM_IOW( 0x42, drm_i830_clear_t) -#define DRM_IOCTL_I830_FLUSH DRM_IO ( 0x43) -#define DRM_IOCTL_I830_GETAGE DRM_IO ( 0x44) -#define DRM_IOCTL_I830_GETBUF DRM_IOWR(0x45, drm_i830_dma_t) -#define DRM_IOCTL_I830_SWAP DRM_IO ( 0x46) -#define DRM_IOCTL_I830_COPY DRM_IOW( 0x47, drm_i830_copy_t) -#define DRM_IOCTL_I830_DOCOPY DRM_IO ( 0x48) +/* Device specfic ioctls should only be in their respective headers + * The device specific ioctl range is 0x40 to 0x79. */ +#define DRM_COMMAND_BASE 0x40 #endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.4 Wed Dec 12 19:24:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h Sat Feb 8 16:26:59 2003 @@ -69,7 +69,11 @@ /* There's undoubtably more of this file to go into these OS dependent ones. */ +#ifdef __FreeBSD__ #include "drm_os_freebsd.h" +#elif defined __NetBSD__ +#include "drm_os_netbsd.h" +#endif #include "drm.h" @@ -119,6 +123,9 @@ #define DRM_IOREMAP(map) \ (map)->handle = DRM(ioremap)( (map)->offset, (map)->size ) +#define DRM_IOREMAP_NOCACHE(map) \ + (map)->handle = DRM(ioremap_nocache)((map)->offset, (map)->size) + #define DRM_IOREMAPFREE(map) \ do { \ if ( (map)->handle && (map)->size ) \ @@ -236,8 +243,8 @@ drm_buf_t **rp; /* Read pointer */ drm_buf_t **wp; /* Write pointer */ drm_buf_t **end; /* End pointer */ - DRM_OS_SPINTYPE read_lock; - DRM_OS_SPINTYPE write_lock; + DRM_SPINTYPE read_lock; + DRM_SPINTYPE write_lock; } drm_waitlist_t; typedef struct drm_freelist { @@ -249,7 +256,7 @@ int low_mark; /* Low water mark */ int high_mark; /* High water mark */ atomic_t wfh; /* If waiting for high mark */ - DRM_OS_SPINTYPE lock; + DRM_SPINTYPE lock; } drm_freelist_t; typedef struct drm_buf_entry { @@ -371,6 +378,7 @@ void *virtual; int pages; struct page **pagelist; + dma_addr_t *busaddr; } drm_sg_mem_t; typedef struct drm_sigdata { @@ -385,20 +393,24 @@ } drm_map_list_entry_t; struct drm_device { +#ifdef __NetBSD__ + struct device device; /* NetBSD's softc is an extension of struct device */ +#endif const char *name; /* Simple driver name */ char *unique; /* Unique identifier: e.g., busid */ int unique_len; /* Length of unique field */ +#ifdef __FreeBSD__ device_t device; /* Device instance from newbus */ +#endif dev_t devnode; /* Device number for mknod */ char *devname; /* For /proc/interrupts */ int blocked; /* Blocked due to VC switch? */ int flags; /* Flags to open(2) */ int writable; /* Opened with FWRITE */ - struct proc_dir_entry *root; /* Root for this device's entries */ /* Locks */ - DRM_OS_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ + DRM_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ struct lock dev_lock; /* For others */ /* Usage Counters */ int open_count; /* Outstanding files open */ @@ -434,12 +446,18 @@ drm_device_dma_t *dma; /* Optional pointer for DMA support */ /* Context support */ +#ifdef __FreeBSD__ int irq; /* Interrupt used by board */ + int irqrid; /* Interrupt used by board */ struct resource *irqr; /* Resource for interrupt used by board */ +#elif defined(__NetBSD__) + struct pci_attach_args pa; + pci_intr_handle_t ih; +#endif void *irqh; /* Handle from bus_setup_intr */ - __volatile__ long context_flag; /* Context swapping flag */ - __volatile__ long interrupt_flag; /* Interruption handler flag */ - __volatile__ long dma_flag; /* DMA dispatch flag */ + atomic_t context_flag; /* Context swapping flag */ + atomic_t interrupt_flag; /* Interruption handler flag */ + atomic_t dma_flag; /* DMA dispatch flag */ struct callout timer; /* Timer for delaying ctx switch */ wait_queue_head_t context_wait; /* Processes waiting on ctx switch */ int last_checked; /* Last context checked for DMA */ @@ -448,6 +466,10 @@ #if __FreeBSD_version >= 400005 struct task task; #endif +#if __HAVE_VBL_IRQ + wait_queue_head_t vbl_queue; /* vbl wait channel */ + atomic_t vbl_received; +#endif cycles_t ctx_start; cycles_t lck_start; #if __HAVE_DMA_HISTOGRAM @@ -460,7 +482,11 @@ char *buf_rp; /* Read pointer */ char *buf_wp; /* Write pointer */ char *buf_end; /* End pointer */ +#ifdef __FreeBSD__ struct sigio *buf_sigio; /* Processes waiting for SIGIO */ +#elif defined(__NetBSD__) + pid_t buf_pgid; +#endif struct selinfo buf_sel; /* Workspace for select/poll */ int buf_selecting;/* True if poll sleeper */ wait_queue_head_t buf_readers; /* Processes waiting to read */ @@ -472,16 +498,8 @@ #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif - struct pci_dev *pdev; -#ifdef __alpha__ -#if LINUX_VERSION_CODE < 0x020403 - struct pci_controler *hose; -#else - struct pci_controller *hose; -#endif -#endif drm_sg_mem_t *sg; /* Scatter gather memory */ - unsigned long *ctx_bitmap; + atomic_t *ctx_bitmap; void *dev_private; drm_sigdata_t sigdata; /* For block_all_signals */ sigset_t sigmask; @@ -497,21 +515,20 @@ extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); /* Driver support (drm_drv.h) */ -extern int DRM(version)( DRM_OS_IOCTL ); +extern int DRM(version)( DRM_IOCTL_ARGS ); extern int DRM(write_string)(drm_device_t *dev, const char *s); /* Memory management support (drm_memory.h) */ extern void DRM(mem_init)(void); +extern void DRM(mem_uninit)(void); extern void *DRM(alloc)(size_t size, int area); extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area); extern char *DRM(strdup)(const char *s, int area); extern void DRM(strfree)(char *s, int area); extern void DRM(free)(void *pt, size_t size, int area); -extern unsigned long DRM(alloc_pages)(int order, int area); -extern void DRM(free_pages)(unsigned long address, int order, - int area); extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size); extern void DRM(ioremapfree)(void *pt, unsigned long size); #if __REALLY_HAVE_AGP @@ -567,9 +584,12 @@ #if __HAVE_DMA_IRQ extern int DRM(irq_install)( drm_device_t *dev, int irq ); extern int DRM(irq_uninstall)( drm_device_t *dev ); -extern void DRM(dma_service)( DRM_OS_IRQ_ARGS ); +extern void DRM(dma_service)( DRM_IRQ_ARGS ); +extern void DRM(driver_irq_preinstall)( drm_device_t *dev ); +extern void DRM(driver_irq_postinstall)( drm_device_t *dev ); +extern void DRM(driver_irq_uninstall)( drm_device_t *dev ); #if __HAVE_DMA_IRQ_BH -extern void DRM(dma_immediate_bh)( DRM_OS_TASKQUEUE_ARGS ); +extern void DRM(dma_immediate_bh)( DRM_TASKQUEUE_ARGS ); #endif #endif #if DRM_DMA_HISTOGRAM @@ -592,6 +612,10 @@ extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); #endif #endif /* __HAVE_DMA */ +#if __HAVE_VBL_IRQ +extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); +extern void DRM(vbl_send_signals)( drm_device_t *dev ); +#endif #if __REALLY_HAVE_AGP /* AGP/GART support (drm_agpsupport.h) */ @@ -604,15 +628,6 @@ extern int DRM(agp_unbind_memory)(agp_memory *handle); #endif - /* Proc support (drm_proc.h) */ -extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, - int minor, - struct proc_dir_entry *root, - struct proc_dir_entry **dev_root); -extern int DRM(proc_cleanup)(int minor, - struct proc_dir_entry *root, - struct proc_dir_entry *dev_root); - #if __HAVE_SG /* Scatter Gather Support (drm_scatter.h) */ extern void DRM(sg_cleanup)(drm_sg_mem_t *entry); @@ -629,4 +644,4 @@ #endif #endif /* __KERNEL__ */ -#endif +#endif /* _DRM_P_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h:1.1 Wed Dec 12 19:24:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h Wed Oct 30 07:52:24 2002 @@ -31,15 +31,9 @@ #include "drmP.h" -#include <vm/vm.h> -#include <vm/pmap.h> -#if __REALLY_HAVE_AGP -#include <sys/agpio.h> -#endif - -int DRM(agp_info)(DRM_OS_IOCTL) +int DRM(agp_info)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; struct agp_info *kern; drm_agp_info_t info; @@ -61,9 +55,9 @@ return 0; } -int DRM(agp_acquire)(DRM_OS_IOCTL) +int DRM(agp_acquire)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; int retcode; if (!dev->agp || dev->agp->acquired) return EINVAL; @@ -73,9 +67,9 @@ return 0; } -int DRM(agp_release)(DRM_OS_IOCTL) +int DRM(agp_release)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; if (!dev->agp || !dev->agp->acquired) return EINVAL; @@ -89,14 +83,14 @@ { device_t agpdev; - agpdev = agp_find_device(); + agpdev = DRM_AGP_FIND_DEVICE(); if (agpdev) agp_release(agpdev); } -int DRM(agp_enable)(DRM_OS_IOCTL) +int DRM(agp_enable)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_agp_mode_t mode; if (!dev->agp || !dev->agp->acquired) return EINVAL; @@ -110,9 +104,9 @@ return 0; } -int DRM(agp_alloc)(DRM_OS_IOCTL) +int DRM(agp_alloc)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_agp_buffer_t request; drm_agp_mem_t *entry; void *handle; @@ -165,9 +159,9 @@ return NULL; } -int DRM(agp_unbind)(DRM_OS_IOCTL) +int DRM(agp_unbind)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_agp_binding_t request; drm_agp_mem_t *entry; int retcode; @@ -187,9 +181,9 @@ return retcode; } -int DRM(agp_bind)(DRM_OS_IOCTL) +int DRM(agp_bind)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_agp_binding_t request; drm_agp_mem_t *entry; int retcode; @@ -209,9 +203,9 @@ return 0; } -int DRM(agp_free)(DRM_OS_IOCTL) +int DRM(agp_free)(DRM_IOCTL_ARGS) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_agp_buffer_t request; drm_agp_mem_t *entry; @@ -235,7 +229,7 @@ drm_agp_head_t *head = NULL; int agp_available = 1; - agpdev = agp_find_device(); + agpdev = DRM_AGP_FIND_DEVICE(); if (!agpdev) agp_available = 0; @@ -267,9 +261,9 @@ default: } #endif - DRM_INFO("AGP at 0x%08x %dMB\n", - head->info.ai_aperture_base, - head->info.ai_aperture_size >> 20); + DRM_INFO("AGP at 0x%08lx %dMB\n", + (long)head->info.ai_aperture_base, + (int)(head->info.ai_aperture_size >> 20)); } return head; } @@ -284,7 +278,7 @@ { device_t agpdev; - agpdev = agp_find_device(); + agpdev = DRM_AGP_FIND_DEVICE(); if (!agpdev) return NULL; @@ -295,7 +289,7 @@ { device_t agpdev; - agpdev = agp_find_device(); + agpdev = DRM_AGP_FIND_DEVICE(); if (!agpdev || !handle) return 0; @@ -307,7 +301,7 @@ { device_t agpdev; - agpdev = agp_find_device(); + agpdev = DRM_AGP_FIND_DEVICE(); if (!agpdev || !handle) return EINVAL; @@ -318,7 +312,7 @@ { device_t agpdev; - agpdev = agp_find_device(); + agpdev = DRM_AGP_FIND_DEVICE(); if (!agpdev || !handle) return EINVAL; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h Sat Feb 8 16:26:59 2003 @@ -29,7 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" static int DRM(hash_magic)(drm_magic_t magic) @@ -43,14 +42,14 @@ drm_magic_entry_t *pt; int hash = DRM(hash_magic)(magic); - DRM_OS_LOCK; + DRM_LOCK; for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { if (pt->magic == magic) { retval = pt->priv; break; } } - DRM_OS_UNLOCK; + DRM_UNLOCK; return retval; } @@ -63,12 +62,13 @@ hash = DRM(hash_magic)(magic); entry = (drm_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); - if (!entry) DRM_OS_RETURN(ENOMEM); + if (!entry) return DRM_ERR(ENOMEM); + memset(entry, 0, sizeof(*entry)); entry->magic = magic; entry->priv = priv; entry->next = NULL; - DRM_OS_LOCK; + DRM_LOCK; if (dev->magiclist[hash].tail) { dev->magiclist[hash].tail->next = entry; dev->magiclist[hash].tail = entry; @@ -76,7 +76,7 @@ dev->magiclist[hash].head = entry; dev->magiclist[hash].tail = entry; } - DRM_OS_UNLOCK; + DRM_UNLOCK; return 0; } @@ -90,7 +90,7 @@ DRM_DEBUG("%d\n", magic); hash = DRM(hash_magic)(magic); - DRM_OS_LOCK; + DRM_LOCK; for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { if (pt->magic == magic) { if (dev->magiclist[hash].head == pt) { @@ -102,40 +102,34 @@ if (prev) { prev->next = pt->next; } - DRM_OS_UNLOCK; - DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); + DRM_UNLOCK; return 0; } } - DRM_OS_UNLOCK; + DRM_UNLOCK; DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } -int DRM(getmagic)(DRM_OS_IOCTL) +int DRM(getmagic)(DRM_IOCTL_ARGS) { static drm_magic_t sequence = 0; drm_auth_t auth; - static DRM_OS_SPINTYPE lock; - static int first = 1; - DRM_OS_DEVICE; - DRM_OS_PRIV; - - if (first) { - DRM_OS_SPININIT(lock, "drm getmagic"); - first = 0; - } + DRM_DEVICE; + DRM_PRIV; /* Find unique magic */ if (priv->magic) { auth.magic = priv->magic; } else { do { - DRM_OS_SPINLOCK(&lock); - if (!sequence) ++sequence; /* reserve 0 */ - auth.magic = sequence++; - DRM_OS_SPINUNLOCK(&lock); + int old = sequence; + + auth.magic = old+1; + + if (!atomic_cmpset_int(&sequence, old, auth.magic)) + continue; } while (DRM(find_file)(dev, auth.magic)); priv->magic = auth.magic; DRM(add_magic)(dev, priv, auth.magic); @@ -143,18 +137,18 @@ DRM_DEBUG("%u\n", auth.magic); - DRM_OS_KRNTOUSR((drm_auth_t *)data, auth, sizeof(auth)); + DRM_COPY_TO_USER_IOCTL((drm_auth_t *)data, auth, sizeof(auth)); return 0; } -int DRM(authmagic)(DRM_OS_IOCTL) +int DRM(authmagic)(DRM_IOCTL_ARGS) { drm_auth_t auth; drm_file_t *file; - DRM_OS_DEVICE; + DRM_DEVICE; - DRM_OS_KRNFROMUSR(auth, (drm_auth_t *)data, sizeof(auth)); + DRM_COPY_FROM_USER_IOCTL(auth, (drm_auth_t *)data, sizeof(auth)); DRM_DEBUG("%u\n", auth.magic); if ((file = DRM(find_file)(dev, auth.magic))) { @@ -162,5 +156,5 @@ DRM(remove_magic)(dev, auth.magic); return 0; } - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h Wed Oct 30 07:52:25 2002 @@ -29,14 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ -#include <machine/param.h> -#include <sys/mman.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> -#include <vm/vm_map.h> -#include <vm/vm_param.h> #include "drmP.h" #ifndef __HAVE_PCI_DMA @@ -74,18 +66,18 @@ return order; } -int DRM(addmap)( DRM_OS_IOCTL ) +int DRM(addmap)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_map_t *map; drm_map_list_entry_t *list; - + if (!(dev->flags & (FREAD|FWRITE))) - DRM_OS_RETURN(EACCES); /* Require read/write */ + return DRM_ERR(EACCES); /* Require read/write */ map = (drm_map_t *) DRM(alloc)( sizeof(*map), DRM_MEM_MAPS ); if ( !map ) - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); *map = *(drm_map_t *)data; @@ -95,30 +87,17 @@ */ if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) { DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n", map->offset, map->size, map->type ); if ( (map->offset & PAGE_MASK) || (map->size & PAGE_MASK) ) { DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } map->mtrr = -1; map->handle = 0; - TAILQ_FOREACH(list, dev->maplist, link) { - drm_map_t *entry = list->map; - if ( (entry->offset >= map->offset - && (entry->offset) < (map->offset + map->size) ) - || ((entry->offset + entry->size) >= map->offset - && (entry->offset + entry->size) < (map->offset + map->size) ) - || ((entry->offset < map->offset) - && (entry->offset + entry->size) >= (map->offset + map->size) ) ) - DRM_DEBUG("map collission: add(0x%lx-0x%lx), current(0x%lx-0x%lx)\n", - entry->offset, entry->offset + entry->size - 1, - map->offset, map->offset + map->size - 1); - } - switch ( map->type ) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: @@ -126,7 +105,7 @@ if ( map->offset + map->size < map->offset ) { DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } #endif #ifdef __alpha__ @@ -135,23 +114,39 @@ #if __REALLY_HAVE_MTRR if ( map->type == _DRM_FRAME_BUFFER || (map->flags & _DRM_WRITE_COMBINING) ) { - map->mtrr = mtrr_add( map->offset, map->size, - MTRR_TYPE_WRCOMB, 1 ); - } +#ifdef __FreeBSD__ + int retcode = 0, act; + struct mem_range_desc mrdesc; + mrdesc.mr_base = map->offset; + mrdesc.mr_len = map->size; + mrdesc.mr_flags = MDF_WRITECOMBINE; + act = MEMRANGE_SET_UPDATE; + bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME)); + retcode = mem_range_attr_set(&mrdesc, &act); + map->mtrr=1; +#elif defined __NetBSD__ + struct mtrr mtrrmap; + int one = 1; + mtrrmap.base = map->offset; + mtrrmap.len = map->size; + mtrrmap.type = MTRR_TYPE_WC; + mtrrmap.flags = MTRR_PRIVATE | MTRR_VALID; + mtrrmap.owner = p->p_pid; + /* USER? KERNEL? XXX */ + map->mtrr = mtrr_get( &mtrrmap, &one, p, MTRR_GETSET_KERNEL ); #endif + } +#endif /* __REALLY_HAVE_MTRR */ map->handle = DRM(ioremap)( map->offset, map->size ); break; case _DRM_SHM: - DRM_INFO( "%ld %d %d\n", - map->size, DRM(order)( map->size ), PAGE_SHIFT); - map->handle = (void *)DRM(alloc_pages) - (DRM(order)(map->size) - PAGE_SHIFT, DRM_MEM_SAREA); + map->handle = (void *)DRM(alloc)(map->size, DRM_MEM_SAREA); DRM_DEBUG( "%ld %d %p\n", map->size, DRM(order)( map->size ), map->handle ); if ( !map->handle ) { DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } map->offset = (unsigned long)map->handle; if ( map->flags & _DRM_CONTAINS_LOCK ) { @@ -170,27 +165,27 @@ case _DRM_SCATTER_GATHER: if (!dev->sg) { DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } map->offset = map->offset + dev->sg->handle; break; default: DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS); if(!list) { DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } memset(list, 0, sizeof(*list)); list->map = map; - DRM_OS_LOCK; + DRM_LOCK; TAILQ_INSERT_TAIL(dev->maplist, list, link); - DRM_OS_UNLOCK; + DRM_UNLOCK; *(drm_map_t *)data = *map; @@ -205,17 +200,17 @@ * isn't in use. */ -int DRM(rmmap)( DRM_OS_IOCTL ) +int DRM(rmmap)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_map_list_entry_t *list; drm_map_t *map; drm_map_t request; int found_maps = 0; - DRM_OS_KRNFROMUSR( request, (drm_map_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_map_t *)data, sizeof(request) ); - DRM_OS_LOCK; + DRM_LOCK; TAILQ_FOREACH(list, dev->maplist, link) { map = list->map; if(map->handle == request.handle && @@ -226,8 +221,8 @@ * find anything. */ if(list == NULL) { - DRM_OS_UNLOCK; - DRM_OS_RETURN(EINVAL); + DRM_UNLOCK; + return DRM_ERR(EINVAL); } TAILQ_REMOVE(dev->maplist, list, link); DRM(free)(list, sizeof(*list), DRM_MEM_MAPS); @@ -240,16 +235,32 @@ #if __REALLY_HAVE_MTRR if (map->mtrr >= 0) { int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); +#ifdef __FreeBSD__ + int act; + struct mem_range_desc mrdesc; + mrdesc.mr_base = map->offset; + mrdesc.mr_len = map->size; + mrdesc.mr_flags = MDF_WRITECOMBINE; + act = MEMRANGE_SET_REMOVE; + bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME)); + retcode = mem_range_attr_set(&mrdesc, &act); +#elif defined __NetBSD__ + struct mtrr mtrrmap; + int one = 1; + mtrrmap.base = map->offset; + mtrrmap.len = map->size; + mtrrmap.type = 0; + mtrrmap.flags = 0; + mtrrmap.owner = p->p_pid; + retcode = mtrr_set( &mtrrmap, &one, p, MTRR_GETSET_KERNEL); DRM_DEBUG("mtrr_del = %d\n", retcode); +#endif } #endif DRM(ioremapfree)(map->handle, map->size); break; case _DRM_SHM: - DRM(free_pages)( (unsigned long)map->handle, DRM(order)(map->size), DRM_MEM_SAREA ); + DRM(free)( map->handle, map->size, DRM_MEM_SAREA ); break; case _DRM_AGP: case _DRM_SCATTER_GATHER: @@ -257,7 +268,7 @@ } DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); } - DRM_OS_UNLOCK; + DRM_UNLOCK; return 0; } @@ -270,8 +281,8 @@ if (entry->seg_count) { for (i = 0; i < entry->seg_count; i++) { - DRM(free_pages)(entry->seglist[i], - entry->page_order, + DRM(free)((void *)entry->seglist[i], + entry->buf_size, DRM_MEM_DMA); } DRM(free)(entry->seglist, @@ -304,9 +315,9 @@ } #if __REALLY_HAVE_AGP -int DRM(addbufs_agp)( DRM_OS_IOCTL ) +int DRM(addbufs_agp)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; drm_buf_desc_t request; drm_buf_entry_t *entry; @@ -323,9 +334,9 @@ int i; drm_buf_t **temp_buflist; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_desc_t *)data, sizeof(request) ); count = request.count; order = DRM(order)( request.size ); @@ -348,38 +359,38 @@ DRM_DEBUG( "total: %d\n", total ); if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); if ( dev->queue_count ) - DRM_OS_RETURN(EBUSY); /* Not while in use */ + return DRM_ERR(EBUSY); /* Not while in use */ - DRM_OS_SPINLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); if ( dev->buf_use ) { - DRM_OS_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(EBUSY); + DRM_SPINUNLOCK( &dev->count_lock ); + return DRM_ERR(EBUSY); } atomic_inc( &dev->buf_alloc ); - DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_SPINUNLOCK( &dev->count_lock ); - DRM_OS_LOCK; + DRM_LOCK; entry = &dma->bufs[order]; if ( entry->buf_count ) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); /* May only call once for each order */ + return DRM_ERR(ENOMEM); /* May only call once for each order */ } if (count < 0 || count > 4096) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), DRM_MEM_BUFS ); if ( !entry->buflist ) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); @@ -436,9 +447,9 @@ if(!temp_buflist) { /* Free the entry because it isn't valid */ DRM(cleanup_buf_error)(entry); - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } dma->buflist = temp_buflist; @@ -458,12 +469,12 @@ DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); } #endif - DRM_OS_UNLOCK; + DRM_UNLOCK; request.count = entry->buf_count; request.size = size; - DRM_OS_KRNTOUSR( (drm_buf_desc_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_buf_desc_t *)data, request, sizeof(request) ); dma->flags = _DRM_DMA_USE_AGP; @@ -473,9 +484,9 @@ #endif /* __REALLY_HAVE_AGP */ #if __HAVE_PCI_DMA -int DRM(addbufs_pci)( DRM_OS_IOCTL ) +int DRM(addbufs_pci)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; drm_buf_desc_t request; int count; @@ -494,9 +505,9 @@ unsigned long *temp_pagelist; drm_buf_t **temp_buflist; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_desc_t *)data, sizeof(request) ); count = request.count; order = DRM(order)( request.size ); @@ -507,43 +518,43 @@ order, dev->queue_count ); if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); if ( dev->queue_count ) - DRM_OS_RETURN(EBUSY); /* Not while in use */ + return DRM_ERR(EBUSY); /* Not while in use */ alignment = (request.flags & _DRM_PAGE_ALIGN) ? round_page(size) : size; page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; total = PAGE_SIZE << page_order; - DRM_OS_SPINLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); if ( dev->buf_use ) { - DRM_OS_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(EBUSY); + DRM_SPINUNLOCK( &dev->count_lock ); + return DRM_ERR(EBUSY); } atomic_inc( &dev->buf_alloc ); - DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_SPINUNLOCK( &dev->count_lock ); - DRM_OS_LOCK; + DRM_LOCK; entry = &dma->bufs[order]; if ( entry->buf_count ) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); /* May only call once for each order */ + return DRM_ERR(ENOMEM); /* May only call once for each order */ } if (count < 0 || count > 4096) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), DRM_MEM_BUFS ); if ( !entry->buflist ) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); @@ -553,9 +564,9 @@ DRM(free)( entry->buflist, count * sizeof(*entry->buflist), DRM_MEM_BUFS ); - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); @@ -571,9 +582,9 @@ DRM(free)( entry->seglist, count * sizeof(*entry->seglist), DRM_MEM_SEGS ); - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } dma->pagelist = temp_pagelist; @@ -586,7 +597,7 @@ page_count = 0; while ( entry->buf_count < count ) { - page = DRM(alloc_pages)( page_order, DRM_MEM_DMA ); + page = (unsigned long)DRM(alloc)( size, DRM_MEM_DMA ); if ( !page ) break; entry->seglist[entry->seg_count++] = page; for ( i = 0 ; i < (1 << page_order) ; i++ ) { @@ -631,9 +642,9 @@ if(!temp_buflist) { /* Free the entry because it isn't valid */ DRM(cleanup_buf_error)(entry); - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } dma->buflist = temp_buflist; @@ -652,12 +663,12 @@ DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); } #endif - DRM_OS_UNLOCK; + DRM_UNLOCK; request.count = entry->buf_count; request.size = size; - DRM_OS_KRNTOUSR( (drm_buf_desc_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_buf_desc_t *)data, request, sizeof(request) ); atomic_dec( &dev->buf_alloc ); return 0; @@ -666,9 +677,9 @@ #endif /* __HAVE_PCI_DMA */ #if __REALLY_HAVE_SG -int DRM(addbufs_sg)( DRM_OS_IOCTL ) +int DRM(addbufs_sg)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; drm_buf_desc_t request; drm_buf_entry_t *entry; @@ -685,9 +696,9 @@ int i; drm_buf_t **temp_buflist; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_desc_t *)data, sizeof(request) ); count = request.count; order = DRM(order)( request.size ); @@ -710,37 +721,37 @@ DRM_DEBUG( "total: %d\n", total ); if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) - DRM_OS_RETURN(EINVAL); - if ( dev->queue_count ) DRM_OS_RETURN(EBUSY); /* Not while in use */ + return DRM_ERR(EINVAL); + if ( dev->queue_count ) return DRM_ERR(EBUSY); /* Not while in use */ - DRM_OS_SPINLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); if ( dev->buf_use ) { - DRM_OS_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(EBUSY); + DRM_SPINUNLOCK( &dev->count_lock ); + return DRM_ERR(EBUSY); } atomic_inc( &dev->buf_alloc ); - DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_SPINUNLOCK( &dev->count_lock ); - DRM_OS_LOCK; + DRM_LOCK; entry = &dma->bufs[order]; if ( entry->buf_count ) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); /* May only call once for each order */ + return DRM_ERR(ENOMEM); /* May only call once for each order */ } if (count < 0 || count > 4096) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), DRM_MEM_BUFS ); if ( !entry->buflist ) { - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); @@ -772,9 +783,9 @@ /* Set count correctly so we free the proper amount. */ entry->buf_count = count; DRM(cleanup_buf_error)(entry); - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } memset( buf->dev_private, 0, buf->dev_priv_size ); @@ -803,9 +814,9 @@ if(!temp_buflist) { /* Free the entry because it isn't valid */ DRM(cleanup_buf_error)(entry); - DRM_OS_UNLOCK; + DRM_UNLOCK; atomic_dec( &dev->buf_alloc ); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } dma->buflist = temp_buflist; @@ -825,12 +836,12 @@ DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); } #endif - DRM_OS_UNLOCK; + DRM_UNLOCK; request.count = entry->buf_count; request.size = size; - DRM_OS_KRNTOUSR( (drm_buf_desc_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_buf_desc_t *)data, request, sizeof(request) ); dma->flags = _DRM_DMA_USE_SG; @@ -839,11 +850,11 @@ } #endif /* __REALLY_HAVE_SG */ -int DRM(addbufs)( DRM_OS_IOCTL ) +int DRM(addbufs)( DRM_IOCTL_ARGS ) { drm_buf_desc_t request; - DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_desc_t *)data, sizeof(request) ); #if __REALLY_HAVE_AGP if ( request.flags & _DRM_AGP_BUFFER ) @@ -858,29 +869,29 @@ #if __HAVE_PCI_DMA return DRM(addbufs_pci)( kdev, cmd, data, flags, p ); #else - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); #endif } -int DRM(infobufs)( DRM_OS_IOCTL ) +int DRM(infobufs)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; drm_buf_info_t request; int i; int count; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_SPINLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); if ( atomic_read( &dev->buf_alloc ) ) { - DRM_OS_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(EBUSY); + DRM_SPINUNLOCK( &dev->count_lock ); + return DRM_ERR(EBUSY); } ++dev->buf_use; /* Can't allocate more after this call */ - DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_SPINUNLOCK( &dev->count_lock ); - DRM_OS_KRNFROMUSR( request, (drm_buf_info_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_info_t *)data, sizeof(request) ); for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { if ( dma->bufs[i].buf_count ) ++count; @@ -894,19 +905,19 @@ drm_buf_desc_t *to = &request.list[count]; drm_buf_entry_t *from = &dma->bufs[i]; drm_freelist_t *list = &dma->bufs[i].freelist; - if ( DRM_OS_COPYTOUSR( &to->count, + if ( DRM_COPY_TO_USER( &to->count, &from->buf_count, sizeof(from->buf_count) ) || - DRM_OS_COPYTOUSR( &to->size, + DRM_COPY_TO_USER( &to->size, &from->buf_size, sizeof(from->buf_size) ) || - DRM_OS_COPYTOUSR( &to->low_mark, + DRM_COPY_TO_USER( &to->low_mark, &list->low_mark, sizeof(list->low_mark) ) || - DRM_OS_COPYTOUSR( &to->high_mark, + DRM_COPY_TO_USER( &to->high_mark, &list->high_mark, sizeof(list->high_mark) ) ) - DRM_OS_RETURN(EFAULT); + return DRM_ERR(EFAULT); DRM_DEBUG( "%d %d %d %d %d\n", i, @@ -920,34 +931,34 @@ } request.count = count; - DRM_OS_KRNTOUSR( (drm_buf_info_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_buf_info_t *)data, request, sizeof(request) ); return 0; } -int DRM(markbufs)( DRM_OS_IOCTL ) +int DRM(markbufs)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; drm_buf_desc_t request; int order; drm_buf_entry_t *entry; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_desc_t *)data, sizeof(request) ); DRM_DEBUG( "%d, %d, %d\n", request.size, request.low_mark, request.high_mark ); order = DRM(order)( request.size ); if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); entry = &dma->bufs[order]; if ( request.low_mark < 0 || request.low_mark > entry->buf_count ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); if ( request.high_mark < 0 || request.high_mark > entry->buf_count ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); entry->freelist.low_mark = request.low_mark; entry->freelist.high_mark = request.high_mark; @@ -955,35 +966,35 @@ return 0; } -int DRM(freebufs)( DRM_OS_IOCTL ) +int DRM(freebufs)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; drm_buf_free_t request; int i; int idx; drm_buf_t *buf; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_KRNFROMUSR( request, (drm_buf_free_t *)data, sizeof(request) ); + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_free_t *)data, sizeof(request) ); DRM_DEBUG( "%d\n", request.count ); for ( i = 0 ; i < request.count ; i++ ) { - if ( DRM_OS_COPYFROMUSR( &idx, + if ( DRM_COPY_FROM_USER( &idx, &request.list[i], sizeof(idx) ) ) - DRM_OS_RETURN(EFAULT); + return DRM_ERR(EFAULT); if ( idx < 0 || idx >= dma->buf_count ) { DRM_ERROR( "Index %d (of %d max)\n", idx, dma->buf_count - 1 ); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } buf = dma->buflist[idx]; - if ( buf->pid != DRM_OS_CURRENTPID ) { + if ( buf->pid != DRM_CURRENTPID ) { DRM_ERROR( "Process %d freeing buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN(EINVAL); + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); } DRM(free_buffer)( dev, buf ); } @@ -991,32 +1002,43 @@ return 0; } -int DRM(mapbufs)( DRM_OS_IOCTL ) +int DRM(mapbufs)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; int retcode = 0; const int zero = 0; vm_offset_t virtual, address; +#ifdef __FreeBSD__ #if __FreeBSD_version >= 500000 struct vmspace *vms = p->td_proc->p_vmspace; #else struct vmspace *vms = p->p_vmspace; #endif +#endif /* __FreeBSD__ */ +#ifdef __NetBSD__ + struct vnode *vn; +#endif /* __NetBSD__ */ + drm_buf_map_t request; int i; - if ( !dma ) DRM_OS_RETURN(EINVAL); + if ( !dma ) return DRM_ERR(EINVAL); - DRM_OS_SPINLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); if ( atomic_read( &dev->buf_alloc ) ) { - DRM_OS_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(EBUSY); + DRM_SPINUNLOCK( &dev->count_lock ); + return DRM_ERR(EBUSY); } dev->buf_use++; /* Can't allocate more after this call */ - DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_SPINUNLOCK( &dev->count_lock ); + + DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_map_t *)data, sizeof(request) ); - DRM_OS_KRNFROMUSR( request, (drm_buf_map_t *)data, sizeof(request) ); +#ifdef __NetBSD__ + if(!vfinddev(kdev, VCHR, &vn)) + return 0; /* FIXME: Shouldn't this be EINVAL or something? */ +#endif /* __NetBSD__ */ if ( request.count >= dma->buf_count ) { if ( (__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) || @@ -1028,6 +1050,7 @@ goto done; } +#ifdef __FreeBSD__ virtual = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ); retcode = vm_mmap(&vms->vm_map, &virtual, @@ -1036,7 +1059,18 @@ MAP_SHARED, SLIST_FIRST(&kdev->si_hlist), (unsigned long)map->offset ); +#elif defined(__NetBSD__) + virtual = round_page((vaddr_t)vms->vm_daddr + MAXDSIZ); + retcode = uvm_mmap(&vms->vm_map, + (vaddr_t *)&virtual, + round_page(map->size), + UVM_PROT_READ | UVM_PROT_WRITE, + UVM_PROT_ALL, MAP_SHARED, + &vn->v_uobj, map->offset, + p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur); +#endif /* __NetBSD__ */ } else { +#ifdef __FreeBSD__ virtual = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ); retcode = vm_mmap(&vms->vm_map, &virtual, @@ -1045,32 +1079,42 @@ MAP_SHARED, SLIST_FIRST(&kdev->si_hlist), 0); +#elif defined(__NetBSD__) + virtual = round_page((vaddr_t)vms->vm_daddr + MAXDSIZ); + retcode = uvm_mmap(&vms->vm_map, + (vaddr_t *)&virtual, + round_page(dma->byte_count), + UVM_PROT_READ | UVM_PROT_WRITE, + UVM_PROT_ALL, MAP_SHARED, + &vn->v_uobj, 0, + p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur); +#endif /* __NetBSD__ */ } if (retcode) goto done; request.virtual = (void *)virtual; for ( i = 0 ; i < dma->buf_count ; i++ ) { - if ( DRM_OS_COPYTOUSR( &request.list[i].idx, + if ( DRM_COPY_TO_USER( &request.list[i].idx, &dma->buflist[i]->idx, sizeof(request.list[0].idx) ) ) { retcode = EFAULT; goto done; } - if ( DRM_OS_COPYTOUSR( &request.list[i].total, + if ( DRM_COPY_TO_USER( &request.list[i].total, &dma->buflist[i]->total, sizeof(request.list[0].total) ) ) { retcode = EFAULT; goto done; } - if ( DRM_OS_COPYTOUSR( &request.list[i].used, + if ( DRM_COPY_TO_USER( &request.list[i].used, &zero, sizeof(zero) ) ) { retcode = EFAULT; goto done; } address = virtual + dma->buflist[i]->offset; /* *** */ - if ( DRM_OS_COPYTOUSR( &request.list[i].address, + if ( DRM_COPY_TO_USER( &request.list[i].address, &address, sizeof(address) ) ) { retcode = EFAULT; @@ -1083,9 +1127,9 @@ DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode ); - DRM_OS_KRNTOUSR( (drm_buf_map_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_buf_map_t *)data, request, sizeof(request) ); - DRM_OS_RETURN(retcode); + return DRM_ERR(retcode); } #endif /* __HAVE_DMA */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h Wed Oct 30 07:52:25 2002 @@ -29,7 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" #if __HAVE_CTX_BITMAP @@ -44,10 +43,10 @@ if ( !dev->ctx_bitmap ) goto failed; if ( ctx_handle < DRM_MAX_CTXBITMAP ) { - DRM_OS_LOCK; + DRM_LOCK; clear_bit( ctx_handle, dev->ctx_bitmap ); dev->context_sareas[ctx_handle] = NULL; - DRM_OS_UNLOCK; + DRM_UNLOCK; return; } failed: @@ -62,7 +61,7 @@ if(!dev->ctx_bitmap) return -1; - DRM_OS_LOCK; + DRM_LOCK; bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); if ( bit < DRM_MAX_CTXBITMAP ) { set_bit( bit, dev->ctx_bitmap ); @@ -80,7 +79,7 @@ DRM_MEM_MAPS); if(!ctx_sareas) { clear_bit(bit, dev->ctx_bitmap); - DRM_OS_UNLOCK; + DRM_UNLOCK; return -1; } dev->context_sareas = ctx_sareas; @@ -93,16 +92,16 @@ DRM_MEM_MAPS); if(!dev->context_sareas) { clear_bit(bit, dev->ctx_bitmap); - DRM_OS_UNLOCK; + DRM_UNLOCK; return -1; } dev->context_sareas[bit] = NULL; } } - DRM_OS_UNLOCK; + DRM_UNLOCK; return bit; } - DRM_OS_UNLOCK; + DRM_UNLOCK; return -1; } @@ -111,17 +110,17 @@ int i; int temp; - DRM_OS_LOCK; - dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE, + DRM_LOCK; + dev->ctx_bitmap = (atomic_t *) DRM(alloc)( PAGE_SIZE, DRM_MEM_CTXBITMAP ); if ( dev->ctx_bitmap == NULL ) { - DRM_OS_UNLOCK; - DRM_OS_RETURN(ENOMEM); + DRM_UNLOCK; + return DRM_ERR(ENOMEM); } memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); dev->context_sareas = NULL; dev->max_context = -1; - DRM_OS_UNLOCK; + DRM_UNLOCK; for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { temp = DRM(ctxbitmap_next)( dev ); @@ -133,55 +132,55 @@ void DRM(ctxbitmap_cleanup)( drm_device_t *dev ) { - DRM_OS_LOCK; + DRM_LOCK; if( dev->context_sareas ) DRM(free)( dev->context_sareas, sizeof(*dev->context_sareas) * dev->max_context, DRM_MEM_MAPS ); DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP ); - DRM_OS_UNLOCK; + DRM_UNLOCK; } /* ================================================================ * Per Context SAREA Support */ -int DRM(getsareactx)( DRM_OS_IOCTL ) +int DRM(getsareactx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_priv_map_t request; drm_map_t *map; - DRM_OS_KRNFROMUSR( request, (drm_ctx_priv_map_t *)data, + DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data, sizeof(request) ); - DRM_OS_LOCK; + DRM_LOCK; if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { - DRM_OS_UNLOCK; - DRM_OS_RETURN(EINVAL); + DRM_UNLOCK; + return DRM_ERR(EINVAL); } map = dev->context_sareas[request.ctx_id]; - DRM_OS_UNLOCK; + DRM_UNLOCK; request.handle = map->handle; - DRM_OS_KRNTOUSR( (drm_ctx_priv_map_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_priv_map_t *)data, request, sizeof(request) ); return 0; } -int DRM(setsareactx)( DRM_OS_IOCTL ) +int DRM(setsareactx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_priv_map_t request; drm_map_t *map = NULL; drm_map_list_entry_t *list; - DRM_OS_KRNFROMUSR( request, (drm_ctx_priv_map_t *)data, + DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data, sizeof(request) ); - DRM_OS_LOCK; + DRM_LOCK; TAILQ_FOREACH(list, dev->maplist, link) { map=list->map; if(map->handle == request.handle) @@ -189,8 +188,8 @@ } bad: - DRM_OS_UNLOCK; - return -EINVAL; + DRM_UNLOCK; + return DRM_ERR(EINVAL); found: map = list->map; @@ -200,7 +199,7 @@ if (request.ctx_id >= (unsigned) dev->max_context) goto bad; dev->context_sareas[request.ctx_id] = map; - DRM_OS_UNLOCK; + DRM_UNLOCK; return 0; } @@ -214,7 +213,7 @@ if ( test_and_set_bit( 0, &dev->context_flag ) ) { DRM_ERROR( "Reentering -- FIXME\n" ); - DRM_OS_RETURN(EBUSY); + return DRM_ERR(EBUSY); } #if __HAVE_DMA_HISTOGRAM @@ -256,41 +255,41 @@ #endif clear_bit( 0, &dev->context_flag ); - DRM_OS_WAKEUP( &dev->context_wait ); + DRM_WAKEUP( (void *)&dev->context_wait ); return 0; } -int DRM(resctx)( DRM_OS_IOCTL ) +int DRM(resctx)( DRM_IOCTL_ARGS ) { drm_ctx_res_t res; drm_ctx_t ctx; int i; - DRM_OS_KRNFROMUSR( res, (drm_ctx_res_t *)data, sizeof(res) ); + DRM_COPY_FROM_USER_IOCTL( res, (drm_ctx_res_t *)data, sizeof(res) ); if ( res.count >= DRM_RESERVED_CONTEXTS ) { memset( &ctx, 0, sizeof(ctx) ); for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { ctx.handle = i; - if ( DRM_OS_COPYTOUSR( &res.contexts[i], + if ( DRM_COPY_TO_USER( &res.contexts[i], &i, sizeof(i) ) ) - DRM_OS_RETURN(EFAULT); + return DRM_ERR(EFAULT); } } res.count = DRM_RESERVED_CONTEXTS; - DRM_OS_KRNTOUSR( (drm_ctx_res_t *)data, res, sizeof(res) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_res_t *)data, res, sizeof(res) ); return 0; } -int DRM(addctx)( DRM_OS_IOCTL ) +int DRM(addctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); ctx.handle = DRM(ctxbitmap_next)( dev ); if ( ctx.handle == DRM_KERNEL_CONTEXT ) { @@ -301,51 +300,51 @@ if ( ctx.handle == -1 ) { DRM_DEBUG( "Not enough free contexts.\n" ); /* Should this return -EBUSY instead? */ - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(modctx)( DRM_OS_IOCTL ) +int DRM(modctx)( DRM_IOCTL_ARGS ) { /* This does nothing */ return 0; } -int DRM(getctx)( DRM_OS_IOCTL ) +int DRM(getctx)( DRM_IOCTL_ARGS ) { drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); /* This is 0, because we don't handle any context flags */ ctx.flags = 0; - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(switchctx)( DRM_OS_IOCTL ) +int DRM(switchctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG( "%d\n", ctx.handle ); return DRM(context_switch)( dev, dev->last_context, ctx.handle ); } -int DRM(newctx)( DRM_OS_IOCTL ) +int DRM(newctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG( "%d\n", ctx.handle ); DRM(context_switch_complete)( dev, ctx.handle ); @@ -353,12 +352,12 @@ return 0; } -int DRM(rmctx)( DRM_OS_IOCTL ) +int DRM(rmctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG( "%d\n", ctx.handle ); if ( ctx.handle != DRM_KERNEL_CONTEXT ) { @@ -387,7 +386,7 @@ if (test_and_set_bit(0, &dev->context_flag)) { DRM_ERROR("Reentering -- FIXME\n"); - DRM_OS_RETURN(EBUSY); + return DRM_ERR(EBUSY); } #if __HAVE_DMA_HISTOGRAM @@ -398,7 +397,7 @@ if (new >= dev->queue_count) { clear_bit(0, &dev->context_flag); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (new == dev->last_context) { @@ -411,7 +410,7 @@ if (atomic_read(&q->use_count) == 1) { atomic_dec(&q->use_count); clear_bit(0, &dev->context_flag); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (DRM(flags) & DRM_FLAG_NOCTX) { @@ -450,7 +449,7 @@ #endif clear_bit(0, &dev->context_flag); - DRM_OS_WAKEUP_INT(&dev->context_wait); + DRM_WAKEUP_INT(&dev->context_wait); return 0; } @@ -514,7 +513,7 @@ atomic_dec(&dev->queuelist[i]->use_count); } /* Allocate a new queue */ - DRM_OS_LOCK; + DRM_LOCK; queue = gamma_alloc(sizeof(*queue), DRM_MEM_QUEUES); memset(queue, 0, sizeof(*queue)); @@ -532,19 +531,19 @@ newslots, DRM_MEM_QUEUES); if (!dev->queuelist) { - DRM_OS_UNLOCK; + DRM_UNLOCK; DRM_DEBUG("out of memory\n"); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } } dev->queuelist[dev->queue_count-1] = queue; - DRM_OS_UNLOCK; + DRM_UNLOCK; DRM_DEBUG("%d (new)\n", dev->queue_count - 1); return dev->queue_count - 1; } -int DRM(resctx)( DRM_OS_IOCTL ) +int DRM(resctx)( DRM_IOCTL_ARGS ) { drm_ctx_res_t res; drm_ctx_t ctx; @@ -552,31 +551,31 @@ DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - DRM_OS_KRNFROMUSR( res, (drm_ctx_res_t *)data, sizeof(res) ); + DRM_COPY_FROM_USER_IOCTL( res, (drm_ctx_res_t *)data, sizeof(res) ); if (res.count >= DRM_RESERVED_CONTEXTS) { memset(&ctx, 0, sizeof(ctx)); for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { ctx.handle = i; - if (DRM_OS_COPYTOUSR(&res.contexts[i], + if (DRM_COPY_TO_USER(&res.contexts[i], &i, sizeof(i))) - DRM_OS_RETURN(EFAULT); + return DRM_ERR(EFAULT); } } res.count = DRM_RESERVED_CONTEXTS; - DRM_OS_KRNTOUSR( (drm_ctx_res_t *)data, res, sizeof(res) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_res_t *)data, res, sizeof(res) ); return 0; } -int DRM(addctx)( DRM_OS_IOCTL ) +int DRM(addctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); if ((ctx.handle = DRM(alloc_queue)(dev)) == DRM_KERNEL_CONTEXT) { /* Init kernel's context and get a new one. */ @@ -586,35 +585,35 @@ DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx); DRM_DEBUG("%d\n", ctx.handle); - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(modctx)( DRM_OS_IOCTL ) +int DRM(modctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; drm_queue_t *q; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); if (ctx.handle < 0 || ctx.handle >= dev->queue_count) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); q = dev->queuelist[ctx.handle]; atomic_inc(&q->use_count); if (atomic_read(&q->use_count) == 1) { /* No longer in use */ atomic_dec(&q->use_count); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (DRM_BUFCOUNT(&q->waitlist)) { atomic_dec(&q->use_count); - DRM_OS_RETURN(EBUSY); + return DRM_ERR(EBUSY); } q->flags = ctx.flags; @@ -623,52 +622,52 @@ return 0; } -int DRM(getctx)( DRM_OS_IOCTL ) +int DRM(getctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; drm_queue_t *q; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); if (ctx.handle >= dev->queue_count) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); q = dev->queuelist[ctx.handle]; atomic_inc(&q->use_count); if (atomic_read(&q->use_count) == 1) { /* No longer in use */ atomic_dec(&q->use_count); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } ctx.flags = q->flags; atomic_dec(&q->use_count); - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(switchctx)( DRM_OS_IOCTL ) +int DRM(switchctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); return DRM(context_switch)(dev, dev->last_context, ctx.handle); } -int DRM(newctx)( DRM_OS_IOCTL ) +int DRM(newctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); DRM(context_switch_complete)(dev, ctx.handle); @@ -676,25 +675,25 @@ return 0; } -int DRM(rmctx)( DRM_OS_IOCTL ) +int DRM(rmctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; drm_queue_t *q; drm_buf_t *buf; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); - if (ctx.handle >= dev->queue_count) DRM_OS_RETURN(EINVAL); + if (ctx.handle >= dev->queue_count) return DRM_ERR(EINVAL); q = dev->queuelist[ctx.handle]; atomic_inc(&q->use_count); if (atomic_read(&q->use_count) == 1) { /* No longer in use */ atomic_dec(&q->use_count); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } atomic_inc(&q->finalization); /* Mark queue in finalization state */ @@ -717,7 +716,7 @@ /* Wakeup blocked processes */ wakeup( &q->block_read ); wakeup( &q->block_write ); - DRM_OS_WAKEUP_INT( &q->flush_queue ); + DRM_WAKEUP_INT( &q->flush_queue ); /* Finalization over. Queue is made available when both use_count and finalization become 0, which won't Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h Sat Feb 8 16:27:00 2003 @@ -29,10 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - #include "drmP.h" #ifndef __HAVE_DMA_WAITQUEUE @@ -45,12 +41,6 @@ #define __HAVE_SHARED_IRQ 0 #endif -#if __HAVE_SHARED_IRQ -#define DRM_IRQ_TYPE SA_SHIRQ -#else -#define DRM_IRQ_TYPE 0 -#endif - #if __HAVE_DMA int DRM(dma_setup)( drm_device_t *dev ) @@ -59,7 +49,7 @@ dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER ); if ( !dev->dma ) - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); memset( dev->dma, 0, sizeof(*dev->dma) ); @@ -85,8 +75,8 @@ dma->bufs[i].buf_count, dma->bufs[i].seg_count); for (j = 0; j < dma->bufs[i].seg_count; j++) { - DRM(free_pages)(dma->bufs[i].seglist[j], - dma->bufs[i].page_order, + DRM(free)((void *)dma->bufs[i].seglist[j], + dma->bufs[i].buf_size, DRM_MEM_DMA); } DRM(free)(dma->bufs[i].seglist, @@ -197,7 +187,7 @@ #endif if ( buf->dma_wait ) { - wakeup( &buf->dma_wait ); + wakeup( (void *)&buf->dma_wait ); buf->dma_wait = 0; } #if __HAVE_DMA_FREELIST @@ -248,7 +238,7 @@ dma->next_buffer = NULL; if (dma->next_queue && !DRM_BUFCOUNT(&dma->next_queue->waitlist)) { - DRM_OS_WAKEUP_INT(&dma->next_queue->flush_queue); + DRM_WAKEUP_INT(&dma->next_queue->flush_queue); } dma->next_queue = NULL; } @@ -340,7 +330,7 @@ if (!_DRM_LOCK_IS_HELD(context)) { DRM_ERROR("No lock held during \"while locked\"" " request\n"); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (d->context != _DRM_LOCKING_CONTEXT(context) && _DRM_LOCKING_CONTEXT(context) != DRM_KERNEL_CONTEXT) { @@ -348,7 +338,7 @@ " \"while locked\" request\n", _DRM_LOCKING_CONTEXT(context), d->context); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } q = dev->queuelist[DRM_KERNEL_CONTEXT]; while_locked = 1; @@ -378,19 +368,19 @@ atomic_dec(&q->use_count); DRM_ERROR("Index %d (of %d max)\n", d->send_indices[i], dma->buf_count - 1); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } buf = dma->buflist[ idx ]; - if (buf->pid != DRM_OS_CURRENTPID) { + if (buf->pid != DRM_CURRENTPID) { atomic_dec(&q->use_count); DRM_ERROR("Process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid); - DRM_OS_RETURN(EINVAL); + DRM_CURRENTPID, buf->pid); + return DRM_ERR(EINVAL); } if (buf->list != DRM_LIST_NONE) { atomic_dec(&q->use_count); DRM_ERROR("Process %d using buffer %d on list %d\n", - DRM_OS_CURRENTPID, buf->idx, buf->list); + DRM_CURRENTPID, buf->idx, buf->list); } buf->used = d->send_sizes[i]; buf->while_locked = while_locked; @@ -403,14 +393,14 @@ DRM_ERROR("Queueing pending buffer:" " buffer %d, offset %d\n", d->send_indices[i], i); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (buf->waiting) { atomic_dec(&q->use_count); DRM_ERROR("Queueing waiting buffer:" " buffer %d, offset %d\n", d->send_indices[i], i); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } buf->waiting = 1; if (atomic_read(&q->use_count) == 1 @@ -444,16 +434,16 @@ buf->waiting, buf->pending); } - buf->pid = DRM_OS_CURRENTPID; - if (DRM_OS_COPYTOUSR(&d->request_indices[i], + buf->pid = DRM_CURRENTPID; + if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, sizeof(buf->idx))) - DRM_OS_RETURN(EFAULT); + return DRM_ERR(EFAULT); - if (DRM_OS_COPYTOUSR(&d->request_sizes[i], + if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, sizeof(buf->total))) - DRM_OS_RETURN(EFAULT); + return DRM_ERR(EFAULT); ++d->granted_count; } @@ -507,19 +497,18 @@ int DRM(irq_install)( drm_device_t *dev, int irq ) { - int rid; int retcode; if ( !irq ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); - DRM_OS_LOCK; + DRM_LOCK; if ( dev->irq ) { - DRM_OS_UNLOCK; - DRM_OS_RETURN(EBUSY); + DRM_UNLOCK; + return DRM_ERR(EBUSY); } dev->irq = irq; - DRM_OS_UNLOCK; + DRM_UNLOCK; DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); @@ -536,27 +525,33 @@ #endif /* Before installing handler */ - DRIVER_PREINSTALL(); + DRM(driver_irq_preinstall)( dev ); /* Install handler */ - rid = 0; - dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid, + dev->irqrid = 0; + dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid, 0, ~0, 1, RF_SHAREABLE); - if (!dev->irqr) + if (!dev->irqr) { + DRM_LOCK; + dev->irq = 0; + dev->irqrid = 0; + DRM_UNLOCK; return ENOENT; + } retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY, DRM(dma_service), dev, &dev->irqh); if ( retcode ) { - DRM_OS_LOCK; - bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr); + DRM_LOCK; + bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr); dev->irq = 0; - DRM_OS_UNLOCK; + dev->irqrid = 0; + DRM_UNLOCK; return retcode; } /* After installing handler */ - DRIVER_POSTINSTALL(); + DRM(driver_irq_postinstall)( dev ); return 0; } @@ -564,42 +559,111 @@ int DRM(irq_uninstall)( drm_device_t *dev ) { int irq; - - DRM_OS_LOCK; + int irqrid; + + DRM_LOCK; irq = dev->irq; + irqrid = dev->irqrid; dev->irq = 0; - DRM_OS_UNLOCK; + dev->irqrid = 0; + DRM_UNLOCK; if ( !irq ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); - DRIVER_UNINSTALL(); + DRM(driver_irq_uninstall)( dev ); bus_teardown_intr(dev->device, dev->irqr, dev->irqh); - bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr); + bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr); return 0; } -int DRM(control)( DRM_OS_IOCTL ) +int DRM(control)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_control_t ctl; - DRM_OS_KRNFROMUSR( ctl, (drm_control_t *) data, sizeof(ctl) ); + DRM_COPY_FROM_USER_IOCTL( ctl, (drm_control_t *) data, sizeof(ctl) ); switch ( ctl.func ) { case DRM_INST_HANDLER: return DRM(irq_install)( dev, ctl.irq ); case DRM_UNINST_HANDLER: return DRM(irq_uninstall)( dev ); + default: + return DRM_ERR(EINVAL); + } +} + +#if __HAVE_VBL_IRQ +int DRM(wait_vblank)( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_wait_vblank_t vblwait; + struct timeval now; + int ret; + + if (!dev->irq) + return DRM_ERR(EINVAL); + + DRM_COPY_FROM_USER_IOCTL( vblwait, (drm_wait_vblank_t *)data, + sizeof(vblwait) ); + + switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) { + case _DRM_VBLANK_RELATIVE: + vblwait.request.sequence += atomic_read( &dev->vbl_received ); + case _DRM_VBLANK_ABSOLUTE: + break; + default: + return EINVAL; + } + + if ( flags & _DRM_VBLANK_SIGNAL ) { + /* Signals from vblank not supported on BSD yet */ + return EINVAL; + } + + flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; + + ret = DRM(vblank_wait)(dev, &vblwait.request.sequence); + + microtime(&now); + vblwait.reply.tval_sec = now.tv_sec; + vblwait.reply.tval_usec = now.tv_usec; + + DRM_COPY_TO_USER_IOCTL( (drm_wait_vblank_t *)data, vblwait, + sizeof(vblwait) ); + + return ret; +} + +void DRM(vbl_send_signals)( drm_device_t *dev ) { + /* Signals from vblank not supported on BSD yet */ +} + +#endif /* __HAVE_VBL_IRQ */ + +#else + +int DRM(control)( DRM_IOCTL_ARGS ) +{ + drm_control_t ctl; + + DRM_COPY_FROM_USER_IOCTL( ctl, (drm_control_t *) data, sizeof(ctl) ); + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + case DRM_UNINST_HANDLER: + return 0; default: - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } } #endif /* __HAVE_DMA_IRQ */ #endif /* __HAVE_DMA */ + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h Wed Oct 30 07:52:25 2002 @@ -29,22 +29,21 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" -int DRM(adddraw)( DRM_OS_IOCTL ) +int DRM(adddraw)( DRM_IOCTL_ARGS ) { drm_draw_t draw; draw.handle = 0; /* NOOP */ DRM_DEBUG("%d\n", draw.handle); - DRM_OS_KRNTOUSR( (drm_draw_t *)data, draw, sizeof(draw) ); + DRM_COPY_TO_USER_IOCTL( (drm_draw_t *)data, draw, sizeof(draw) ); return 0; } -int DRM(rmdraw)( DRM_OS_IOCTL ) +int DRM(rmdraw)( DRM_IOCTL_ARGS ) { return 0; /* NOOP */ } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h Sat Feb 8 16:27:00 2003 @@ -116,16 +116,8 @@ #define DRIVER_IOCTLS #endif #ifndef DRIVER_FOPS -#if DRM_LINUX -#include <sys/file.h> -#include <sys/proc.h> -#include <machine/../linux/linux.h> -#include <machine/../linux/linux_proto.h> -#include "drm_linux.h" -#endif #endif - /* * The default number of instances (minor numbers) to initialize. */ @@ -133,9 +125,15 @@ #define DRIVER_NUM_CARDS 1 #endif +#ifdef __FreeBSD__ static int DRM(init)(device_t nbdev); static void DRM(cleanup)(device_t nbdev); +#elif defined(__NetBSD__) +static int DRM(init)(drm_device_t *); +static void DRM(cleanup)(drm_device_t *); +#endif +#ifdef __FreeBSD__ #define CDEV_MAJOR 145 #define DRIVER_SOFTC(unit) \ ((drm_device_t *) devclass_get_softc(DRM(devclass), unit)) @@ -146,11 +144,13 @@ #if DRM_LINUX MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1); #endif - -static drm_device_t *DRM(device); -static int *DRM(minor); -static int DRM(numdevs) = 0; +#endif /* __FreeBSD__ */ +#ifdef __NetBSD__ +#define CDEV_MAJOR 90 +#define DRIVER_SOFTC(unit) \ + ((drm_device_t *) device_lookup(&DRM(_cd), unit)) +#endif /* __NetBSD__ */ static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, @@ -198,10 +198,8 @@ /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ -#if __HAVE_DMA_IRQ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, #endif -#endif #if __REALLY_HAVE_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, @@ -214,38 +212,32 @@ [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, #endif -#if __REALLY_HAVE_SG +#if __HAVE_SG [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = { DRM(sg_alloc), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { DRM(sg_free), 1, 1 }, #endif +#if __HAVE_VBL_IRQ + [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = { DRM(wait_vblank), 0, 0 }, +#endif + DRIVER_IOCTLS }; #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( DRM(ioctls) ) +const char *DRM(find_description)(int vendor, int device); +#ifdef __FreeBSD__ static int DRM(probe)(device_t dev) { - const char *s = 0; + const char *s = NULL; int pciid=pci_get_devid(dev); int vendor = (pciid & 0x0000ffff); int device = (pciid & 0xffff0000) >> 16; - int i=0, done=0; - DRM_INFO("Checking PCI vendor=%d, device=%d\n", vendor, device); - while ( !done && (DRM(devicelist)[i].vendor != 0 ) ) { - if ( (DRM(devicelist)[i].vendor == vendor) && - (DRM(devicelist)[i].device == device) ) { - done=1; - if ( DRM(devicelist)[i].supported ) - s = DRM(devicelist)[i].name; - else - DRM_INFO("%s not supported\n", DRM(devicelist)[i].name); - } - i++; - } + s = DRM(find_description)(vendor, device); if (s) { device_set_desc(dev, s); return 0; @@ -264,7 +256,6 @@ DRM(cleanup)(dev); return 0; } - static device_method_t DRM(methods)[] = { /* Device interface */ DEVMETHOD(device_probe, DRM( probe)), @@ -303,6 +294,78 @@ #endif }; +#elif defined(__NetBSD__) +int DRM(probe)(struct device *parent, struct cfdata *match, void *aux); +void DRM(attach)(struct device *parent, struct device *self, void *aux); +int DRM(detach)(struct device *self, int flags); +int DRM(activate)(struct device *self, enum devact act); + +struct cfattach DRM(_ca) = { + sizeof(drm_device_t), DRM(probe), + DRM(attach), DRM(detach), DRM(activate) }; + +int DRM(probe)(struct device *parent, struct cfdata *match, void *aux) +{ + struct pci_attach_args *pa = aux; + const char *desc; + + desc = DRM(find_description)(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id)); + if (desc != NULL) + return 10; + return 0; +} + +void DRM(attach)(struct device *parent, struct device *self, void *aux) +{ + struct pci_attach_args *pa = aux; + drm_device_t *dev = (drm_device_t *)self; + + memcpy(&dev->pa, aux, sizeof(dev->pa)); + + DRM_INFO("%s", DRM(find_description)(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id))); + DRM(init)(dev); +} + +int DRM(detach)(struct device *self, int flags) +{ + DRM(cleanup)((drm_device_t *)self); + return 0; +} + +int DRM(activate)(struct device *self, enum devact act) +{ + switch (act) { + case DVACT_ACTIVATE: + return (EOPNOTSUPP); + break; + + case DVACT_DEACTIVATE: + /* FIXME */ + break; + } + return (0); +} + +#endif + +const char *DRM(find_description)(int vendor, int device) { + const char *s = NULL; + int i=0, done=0; + + while ( !done && (DRM(devicelist)[i].vendor != 0 ) ) { + if ( (DRM(devicelist)[i].vendor == vendor) && + (DRM(devicelist)[i].device == device) ) { + done=1; + if ( DRM(devicelist)[i].supported ) + s = DRM(devicelist)[i].name; + else + DRM_INFO("%s not supported\n", DRM(devicelist)[i].name); + } + i++; + } + return s; +} + static int DRM(setup)( drm_device_t *dev ) { int i; @@ -367,7 +430,7 @@ dev->maplist = DRM(alloc)(sizeof(*dev->maplist), DRM_MEM_MAPS); - if(dev->maplist == NULL) DRM_OS_RETURN(ENOMEM); + if(dev->maplist == NULL) return DRM_ERR(ENOMEM); memset(dev->maplist, 0, sizeof(*dev->maplist)); TAILQ_INIT(dev->maplist); dev->map_count = 0; @@ -399,7 +462,11 @@ dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; +#ifdef __FreeBSD__ dev->buf_sigio = NULL; +#elif defined(__NetBSD__) + dev->buf_pgid = 0; +#endif dev->buf_readers = 0; dev->buf_writers = 0; dev->buf_selecting = 0; @@ -432,7 +499,7 @@ if ( dev->irq ) DRM(irq_uninstall)( dev ); #endif - DRM_OS_LOCK; + DRM_LOCK; callout_stop( &dev->timer ); if ( dev->devname ) { @@ -497,18 +564,36 @@ #if __REALLY_HAVE_MTRR if ( map->mtrr >= 0 ) { int retcode; - retcode = mtrr_del( map->mtrr, - map->offset, - map->size ); +#ifdef __FreeBSD__ + int act; + struct mem_range_desc mrdesc; + mrdesc.mr_base = map->offset; + mrdesc.mr_len = map->size; + mrdesc.mr_flags = MDF_WRITECOMBINE; + act = MEMRANGE_SET_UPDATE; + bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME)); + retcode = mem_range_attr_set(&mrdesc, &act); + map->mtrr=1; +#elif defined __NetBSD__ + struct mtrr mtrrmap; + int one = 1; + mtrrmap.base = map->offset; + mtrrmap.len = map->size; + mtrrmap.type = MTRR_TYPE_WC; + mtrrmap.flags = 0; + /*mtrrmap.owner = p->p_pid;*/ + /* XXX: Use curproc here? */ + retcode = mtrr_set( &mtrrmap, &one, + DRM_CURPROC, MTRR_GETSET_KERNEL); +#endif DRM_DEBUG( "mtrr_del=%d\n", retcode ); } #endif DRM(ioremapfree)( map->handle, map->size ); break; case _DRM_SHM: - DRM(free_pages)((unsigned long)map->handle, - DRM(order)(map->size) - - PAGE_SHIFT, + DRM(free)(map->handle, + map->size, DRM_MEM_SAREA); break; @@ -562,206 +647,192 @@ if ( dev->lock.hw_lock ) { dev->lock.hw_lock = NULL; /* SHM removed */ dev->lock.pid = 0; - DRM_OS_WAKEUP_INT(&dev->lock.lock_queue); + DRM_WAKEUP_INT((void *)&dev->lock.lock_queue); } - DRM_OS_UNLOCK; + DRM_UNLOCK; return 0; } - -/* - * Figure out how many instances to initialize. - */ -static int drm_count_cards(void) -{ - int num = 0; -#if defined(DRIVER_CARD_LIST) - int i; - drm_pci_list_t *l; - u16 device, vendor; - struct pci_dev *pdev = NULL; -#endif - - DRM_DEBUG( "\n" ); - -#if defined(DRIVER_COUNT_CARDS) - num = DRIVER_COUNT_CARDS(); -#elif defined(DRIVER_CARD_LIST) - for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) { - pdev = NULL; - vendor = l[i].vendor; - device = l[i].device; - if(device == 0xffff) device = PCI_ANY_ID; - if(vendor == 0xffff) vendor = PCI_ANY_ID; - while ((pdev = pci_find_device(vendor, device, pdev))) { - num++; /* FIXME: What about two cards of the same device id? */ - } - } -#else - num = DRIVER_NUM_CARDS; -#endif - DRM_DEBUG("numdevs = %d\n", num); - return num; -} -/* drm_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). +/* linux: drm_init is called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). + * bsd: drm_init is called via the attach function per device. */ +#ifdef __FreeBSD__ static int DRM(init)( device_t nbdev ) +#elif defined(__NetBSD__) +static int DRM(init)( drm_device_t *dev ) +#endif { - + int unit; +#ifdef __FreeBSD__ drm_device_t *dev; - int i; +#endif #if __HAVE_CTX_BITMAP int retcode; #endif DRM_DEBUG( "\n" ); - -#ifdef MODULE - DRM(parse_options)( drm_opts ); -#endif - - DRM(numdevs) = drm_count_cards(); - /* Force at least one instance. */ - if (DRM(numdevs) <= 0) - DRM(numdevs) = 1; - - DRM(device) = DRM_OS_MALLOC(sizeof(*DRM(device)) * DRM(numdevs)); - if (!DRM(device)) { - DRM_OS_RETURN(ENOMEM); - } - DRM(minor) = DRM_OS_MALLOC(sizeof(*(DRM(minor))) * DRM(numdevs)); - if (!DRM(minor)) { - DRM_OS_FREE(DRM(device)); - DRM_OS_RETURN(ENOMEM); - } - DRIVER_PREINIT(); - - for (i = 0; i < DRM(numdevs); i++) { - int unit = device_get_unit(nbdev); - /* FIXME??? - multihead !!! */ - dev = device_get_softc(nbdev); - memset( (void *)dev, 0, sizeof(*dev) ); - DRM(minor)[i]=unit; - DRM_OS_SPININIT(dev->count_lock, "drm device"); - lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); - dev->device = nbdev; - dev->devnode = make_dev( &DRM(cdevsw), - unit, - DRM_DEV_UID, - DRM_DEV_GID, - DRM_DEV_MODE, - "dri/card%d", unit ); - dev->name = DRIVER_NAME; - DRM(mem_init)(); - DRM(sysctl_init)(dev); - TAILQ_INIT(&dev->files); +#ifdef __FreeBSD__ + unit = device_get_unit(nbdev); + dev = device_get_softc(nbdev); + memset( (void *)dev, 0, sizeof(*dev) ); + dev->device = nbdev; + dev->devnode = make_dev( &DRM(cdevsw), + unit, + DRM_DEV_UID, + DRM_DEV_GID, + DRM_DEV_MODE, + "dri/card%d", unit ); +#elif defined(__NetBSD__) + unit = minor(dev->device.dv_unit); +#endif + DRM_SPININIT(dev->count_lock, "drm device"); + lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); + dev->name = DRIVER_NAME; + DRM(mem_init)(); + DRM(sysctl_init)(dev); + TAILQ_INIT(&dev->files); #if __REALLY_HAVE_AGP - dev->agp = DRM(agp_init)(); + dev->agp = DRM(agp_init)(); #if __MUST_HAVE_AGP - if ( dev->agp == NULL ) { - DRM_ERROR( "Cannot initialize the agpgart module.\n" ); - DRM(sysctl_cleanup)( dev ); - destroy_dev(dev->devnode); - DRM(takedown)( dev ); - DRM_OS_RETURN(ENOMEM); - } + if ( dev->agp == NULL ) { + DRM_ERROR( "Cannot initialize the agpgart module.\n" ); + DRM(sysctl_cleanup)( dev ); +#ifdef __FreeBSD__ + destroy_dev(dev->devnode); #endif + DRM(takedown)( dev ); + return DRM_ERR(ENOMEM); + } +#endif /* __MUST_HAVE_AGP */ #if __REALLY_HAVE_MTRR - if (dev->agp) - dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size*1024*1024, - MTRR_TYPE_WRCOMB, - 1 ); -#endif -#endif + if (dev->agp) { +#ifdef __FreeBSD__ + int retcode = 0, act; + struct mem_range_desc mrdesc; + mrdesc.mr_base = dev->agp->info.ai_aperture_base; + mrdesc.mr_len = dev->agp->info.ai_aperture_size; + mrdesc.mr_flags = MDF_WRITECOMBINE; + act = MEMRANGE_SET_UPDATE; + bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME)); + retcode = mem_range_attr_set(&mrdesc, &act); + dev->agp->agp_mtrr=1; +#elif defined __NetBSD__ + struct mtrr mtrrmap; + int one = 1; + mtrrmap.base = dev->agp->info.ai_aperture_base; + /* Might need a multiplier here XXX */ + mtrrmap.len = dev->agp->info.ai_aperture_size; + mtrrmap.type = MTRR_TYPE_WC; + mtrrmap.flags = MTRR_VALID; + dev->agp->agp_mtrr = mtrr_set( &mtrrmap, &one, NULL, MTRR_GETSET_KERNEL); +#endif /* __NetBSD__ */ + } +#endif /* __REALLY_HAVE_MTRR */ +#endif /* __REALLY_HAVE_AGP */ #if __HAVE_CTX_BITMAP - retcode = DRM(ctxbitmap_init)( dev ); - if( retcode ) { - DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); - DRM(sysctl_cleanup)( dev ); - destroy_dev(dev->devnode); - DRM(takedown)( dev ); - return retcode; - } + retcode = DRM(ctxbitmap_init)( dev ); + if( retcode ) { + DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); + DRM(sysctl_cleanup)( dev ); +#ifdef __FreeBSD__ + destroy_dev(dev->devnode); #endif - DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", - DRIVER_NAME, - DRIVER_MAJOR, - DRIVER_MINOR, - DRIVER_PATCHLEVEL, - DRIVER_DATE, - DRM(minor)[i] ); + DRM(takedown)( dev ); + return retcode; } +#endif + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + unit ); DRIVER_POSTINIT(); return 0; } -/* drm_cleanup is called via cleanup_module at module unload time. +/* linux: drm_cleanup is called via cleanup_module at module unload time. + * bsd: drm_cleanup is called per device at module unload time. + * FIXME: NetBSD */ +#ifdef __FreeBSD__ static void DRM(cleanup)(device_t nbdev) +#elif defined(__NetBSD__) +static void DRM(cleanup)(drm_device_t *dev) +#endif { +#ifdef __FreeBSD__ drm_device_t *dev; - int i; +#endif +#if __REALLY_HAVE_MTRR +#ifdef __NetBSD__ + struct mtrr mtrrmap; + int one = 1; +#endif /* __NetBSD__ */ +#endif /* __REALLY_HAVE_MTRR */ DRM_DEBUG( "\n" ); - for (i = DRM(numdevs) - 1; i >= 0; i--) { - /* FIXME??? - multihead */ - dev = device_get_softc(nbdev); - DRM(sysctl_cleanup)( dev ); - destroy_dev(dev->devnode); +#ifdef __FreeBSD__ + dev = device_get_softc(nbdev); +#endif + DRM(sysctl_cleanup)( dev ); +#ifdef __FreeBSD__ + destroy_dev(dev->devnode); +#endif #if __HAVE_CTX_BITMAP - DRM(ctxbitmap_cleanup)( dev ); + DRM(ctxbitmap_cleanup)( dev ); #endif #if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR - if ( dev->agp && dev->agp->agp_mtrr >= 0) { - int retval; - retval = mtrr_del( dev->agp->agp_mtrr, - dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size*1024*1024 ); - DRM_DEBUG( "mtrr_del=%d\n", retval ); - } + if ( dev->agp && dev->agp->agp_mtrr >= 0) { +#if defined(__NetBSD__) + mtrrmap.base = dev->agp->info.ai_aperture_base; + mtrrmap.len = dev->agp->info.ai_aperture_size; + mtrrmap.type = 0; + mtrrmap.flags = 0; + retval = mtrr_set( &mtrrmap, &one, NULL, MTRR_GETSET_KERNEL); #endif + } +#endif - DRM(takedown)( dev ); + DRM(takedown)( dev ); #if __REALLY_HAVE_AGP - if ( dev->agp ) { - DRM(agp_uninit)(); - DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); - dev->agp = NULL; - } -#endif + if ( dev->agp ) { + DRM(agp_uninit)(); + DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); + dev->agp = NULL; } +#endif DRIVER_POSTCLEANUP(); - DRM_OS_FREE(DRM(minor)); - DRM_OS_FREE(DRM(device)); - DRM(numdevs) = 0; + DRM(mem_uninit)(); + DRM_SPINUNINIT(dev->count_lock); } -int DRM(version)( DRM_OS_IOCTL ) +int DRM(version)( DRM_IOCTL_ARGS ) { drm_version_t version; int len; - DRM_OS_KRNFROMUSR( version, (drm_version_t *)data, sizeof(version) ); + DRM_COPY_FROM_USER_IOCTL( version, (drm_version_t *)data, sizeof(version) ); #define DRM_COPY( name, value ) \ len = strlen( value ); \ if ( len > name##_len ) len = name##_len; \ name##_len = strlen( value ); \ if ( len && name ) { \ - if ( DRM_OS_COPYTOUSR( name, value, len ) ) \ - DRM_OS_RETURN(EFAULT); \ + if ( DRM_COPY_TO_USER( name, value, len ) ) \ + return DRM_ERR(EFAULT); \ } version.version_major = DRIVER_MAJOR; @@ -772,48 +843,40 @@ DRM_COPY( version.date, DRIVER_DATE ); DRM_COPY( version.desc, DRIVER_DESC ); - DRM_OS_KRNTOUSR( (drm_version_t *)data, version, sizeof(version) ); + DRM_COPY_TO_USER_IOCTL( (drm_version_t *)data, version, sizeof(version) ); return 0; } -int DRM( open)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p) +int DRM(open)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p) { drm_device_t *dev = NULL; int retcode = 0; - int i; - for (i = 0; i < DRM(numdevs); i++) { - /* FIXME ??? - multihead */ - dev = DRIVER_SOFTC(minor(kdev)); - } - if (!dev) { - DRM_OS_RETURN(ENODEV); - } + dev = DRIVER_SOFTC(minor(kdev)); DRM_DEBUG( "open_count = %d\n", dev->open_count ); - device_busy(dev->device); retcode = DRM(open_helper)(kdev, flags, fmt, p, dev); if ( !retcode ) { atomic_inc( &dev->counts[_DRM_STAT_OPENS] ); - DRM_OS_SPINLOCK( &dev->count_lock ); - if ( !dev->open_count++ ) { - DRM_OS_SPINUNLOCK( &dev->count_lock ); - return DRM(setup)( dev ); - } - DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); +#ifdef __FreeBSD__ + device_busy(dev->device); +#endif + if ( !dev->open_count++ ) + retcode = DRM(setup)( dev ); + DRM_SPINUNLOCK( &dev->count_lock ); } - device_unbusy(dev->device); return retcode; } -int DRM( close)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p) +int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p) { drm_file_t *priv; - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; int retcode = 0; DRM_DEBUG( "open_count = %d\n", dev->open_count ); @@ -829,13 +892,18 @@ * Begin inline drm_release */ +#ifdef __FreeBSD__ + DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", + DRM_CURRENTPID, (long)dev->device, dev->open_count ); +#elif defined(__NetBSD__) DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", - DRM_OS_CURRENTPID, (long)dev->device, dev->open_count ); + DRM_CURRENTPID, (long)&dev->device, dev->open_count); +#endif if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == DRM_OS_CURRENTPID) { + && dev->lock.pid == DRM_CURRENTPID) { DRM_DEBUG("Process %d dead, freeing lock for context %d\n", - DRM_OS_CURRENTPID, + DRM_CURRENTPID, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); #if HAVE_DRIVER_RELEASE DRIVER_RELEASE(); @@ -855,7 +923,7 @@ for (;;) { if ( !dev->lock.hw_lock ) { /* Device has been unregistered */ - retcode = EINTR; + retcode = DRM_ERR(EINTR); break; } if ( DRM(lock_take)( &dev->lock.hw_lock->lock, @@ -886,61 +954,73 @@ DRM(reclaim_buffers)( dev, priv->pid ); #endif +#if defined (__FreeBSD__) && (__FreeBSD_version >= 500000) + funsetown(&dev->buf_sigio); +#elif defined(__FreeBSD__) funsetown(dev->buf_sigio); +#elif defined(__NetBSD__) + dev->buf_pgid = 0; +#endif /* __NetBSD__ */ - DRM_OS_LOCK; + DRM_LOCK; priv = DRM(find_file_by_proc)(dev, p); if (priv) { priv->refs--; if (!priv->refs) { TAILQ_REMOVE(&dev->files, priv, link); + DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES ); } } - DRM_OS_UNLOCK; + DRM_UNLOCK; - DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES ); /* ======================================================== * End inline drm_release */ atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); - DRM_OS_SPINLOCK( &dev->count_lock ); + DRM_SPINLOCK( &dev->count_lock ); +#ifdef __FreeBSD__ + device_unbusy(dev->device); +#endif if ( !--dev->open_count ) { if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) { DRM_ERROR( "Device busy: %ld %d\n", (unsigned long)atomic_read( &dev->ioctl_count ), dev->blocked ); - DRM_OS_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(EBUSY); + DRM_SPINUNLOCK( &dev->count_lock ); + return DRM_ERR(EBUSY); } - DRM_OS_SPINUNLOCK( &dev->count_lock ); - device_unbusy(dev->device); + DRM_SPINUNLOCK( &dev->count_lock ); return DRM(takedown)( dev ); } - DRM_OS_SPINUNLOCK( &dev->count_lock ); - + DRM_SPINUNLOCK( &dev->count_lock ); - DRM_OS_RETURN(retcode); + return retcode; } /* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm. */ -int DRM(ioctl)( DRM_OS_IOCTL ) +int DRM(ioctl)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; int retcode = 0; drm_ioctl_desc_t *ioctl; d_ioctl_t *func; int nr = DRM_IOCTL_NR(cmd); - DRM_OS_PRIV; + DRM_PRIV; atomic_inc( &dev->ioctl_count ); atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); ++priv->ioctl_count; +#ifdef __FreeBSD__ DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n", - DRM_OS_CURRENTPID, cmd, nr, (long)dev->device, priv->authenticated ); + DRM_CURRENTPID, cmd, nr, (long)dev->device, priv->authenticated ); +#elif defined(__NetBSD__) + DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n", + DRM_CURRENTPID, cmd, nr, (long)&dev->device, priv->authenticated ); +#endif switch (cmd) { case FIONBIO: @@ -952,16 +1032,33 @@ dev->flags |= FASYNC; return 0; +#ifdef __FreeBSD__ case FIOSETOWN: atomic_dec(&dev->ioctl_count); return fsetown(*(int *)data, &dev->buf_sigio); case FIOGETOWN: atomic_dec(&dev->ioctl_count); +#if (__FreeBSD_version >= 500000) + *(int *) data = fgetown(&dev->buf_sigio); +#else *(int *) data = fgetown(dev->buf_sigio); +#endif return 0; } +#endif /* __FreeBSD__ */ +#ifdef __NetBSD__ + case TIOCSPGRP: + atomic_dec(&dev->ioctl_count); + dev->buf_pgid = *(int *)data; + return 0; + case TIOCGPGRP: + atomic_dec(&dev->ioctl_count); + *(int *)data = dev->buf_pgid; + return 0; +#endif /* __NetBSD__ */ + if ( nr >= DRIVER_IOCTL_COUNT ) { retcode = EINVAL; } else { @@ -971,7 +1068,7 @@ if ( !func ) { DRM_DEBUG( "no function\n" ); retcode = EINVAL; - } else if ( ( ioctl->root_only && DRM_OS_CHECKSUSER ) + } else if ( ( ioctl->root_only && DRM_SUSER(p) ) || ( ioctl->auth_needed && !priv->authenticated ) ) { retcode = EACCES; } else { @@ -980,12 +1077,12 @@ } atomic_dec( &dev->ioctl_count ); - DRM_OS_RETURN(retcode); + return DRM_ERR(retcode); } -int DRM(lock)( DRM_OS_IOCTL ) +int DRM(lock)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_lock_t lock; int ret = 0; #if __HAVE_MULTIPLE_DMA_QUEUES @@ -997,24 +1094,24 @@ dev->lck_start = start = get_cycles(); #endif - DRM_OS_KRNFROMUSR( lock, (drm_lock_t *)data, sizeof(lock) ); + DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) ); if ( lock.context == DRM_KERNEL_CONTEXT ) { DRM_ERROR( "Process %d using kernel context %d\n", - DRM_OS_CURRENTPID, lock.context ); - DRM_OS_RETURN(EINVAL); + DRM_CURRENTPID, lock.context ); + return DRM_ERR(EINVAL); } DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, DRM_OS_CURRENTPID, + lock.context, DRM_CURRENTPID, dev->lock.hw_lock->lock, lock.flags ); #if __HAVE_DMA_QUEUE if ( lock.context < 0 ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); #elif __HAVE_MULTIPLE_DMA_QUEUES if ( lock.context < 0 || lock.context >= dev->queue_count ) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); q = dev->queuelist[lock.context]; #endif @@ -1030,14 +1127,14 @@ } if ( DRM(lock_take)( &dev->lock.hw_lock->lock, lock.context ) ) { - dev->lock.pid = DRM_OS_CURRENTPID; + dev->lock.pid = DRM_CURRENTPID; dev->lock.lock_time = jiffies; atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); break; /* Got lock */ } /* Contention */ - ret = tsleep(&dev->lock.lock_queue, + ret = tsleep((void *)&dev->lock.lock_queue, PZERO|PCATCH, "drmlk2", 0); @@ -1076,21 +1173,21 @@ atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]); #endif - DRM_OS_RETURN(ret); + return DRM_ERR(ret); } -int DRM(unlock)( DRM_OS_IOCTL ) +int DRM(unlock)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_lock_t lock; - DRM_OS_KRNFROMUSR( lock, (drm_lock_t *)data, sizeof(lock) ) ; + DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) ) ; if ( lock.context == DRM_KERNEL_CONTEXT ) { DRM_ERROR( "Process %d using kernel context %d\n", - DRM_OS_CURRENTPID, lock.context ); - DRM_OS_RETURN(EINVAL); + DRM_CURRENTPID, lock.context ); + return DRM_ERR(EINVAL); } atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); @@ -1120,7 +1217,7 @@ DRM(dma_schedule)( dev, 1 ); #endif - /* FIXME: Do we ever really need to check this??? + /* FIXME: Do we ever really need to check this? */ if ( 1 /* !dev->context_flag */ ) { if ( DRM(lock_free)( dev, &dev->lock.hw_lock->lock, @@ -1134,27 +1231,83 @@ } #if DRM_LINUX +#define LINUX_IOCTL_DRM_MIN 0x6400 +#define LINUX_IOCTL_DRM_MAX 0x64ff + static linux_ioctl_function_t DRM( linux_ioctl); static struct linux_ioctl_handler DRM( handler) = {DRM( linux_ioctl), LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX}; SYSINIT (DRM( register), SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_register_handler, &DRM( handler)); SYSUNINIT(DRM( unregister), SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_unregister_handler, &DRM( handler)); +#define LINUX_IOC_VOID IOC_VOID +#define LINUX_IOC_IN IOC_OUT /* Linux has the values the other way around */ +#define LINUX_IOC_OUT IOC_IN + /* * Linux emulation IOCTL */ static int -DRM(linux_ioctl)(DRM_OS_STRUCTPROC *p, struct linux_ioctl_args* args) +DRM(linux_ioctl)(DRM_STRUCTPROC *p, struct linux_ioctl_args* args) { + u_long cmd = args->cmd; +#define STK_PARAMS 128 + union { + char stkbuf[STK_PARAMS]; + long align; + } ubuf; + caddr_t data=NULL, memp=NULL; + u_int size = IOCPARM_LEN(cmd); + int error; +#if (__FreeBSD_version >= 500000) + struct file *fp; +#else + struct file *fp = p->p_fd->fd_ofiles[args->fd]; +#endif + if ( size > STK_PARAMS ) { + if ( size > IOCPARM_MAX ) + return EINVAL; + memp = malloc( (u_long)size, DRM(M_DRM), M_WAITOK ); + data = memp; + } else { + data = ubuf.stkbuf; + } + + if ( cmd & LINUX_IOC_IN ) { + if ( size ) { + error = copyin( (caddr_t)args->arg, data, (u_int)size ); + if (error) { + if ( memp ) + free( data, DRM(M_DRM) ); + return error; + } + } else { + data = (caddr_t)args->arg; + } + } else if ( (cmd & LINUX_IOC_OUT) && size ) { + /* + * Zero the buffer so the user always + * gets back something deterministic. + */ + bzero( data, size ); + } else if ( cmd & LINUX_IOC_VOID ) { + *(caddr_t *)data = (caddr_t)args->arg; + } + #if (__FreeBSD_version >= 500000) - struct file *fp = p->td_proc->p_fd->fd_ofiles[args->fd]; + if ( (error = fget( p, args->fd, &fp )) != 0 ) { + if ( memp ) + free( memp, DRM(M_DRM) ); + return (error); + } + error = fo_ioctl( fp, cmd, data, p->td_ucred, p ); + fdrop( fp, p ); #else - struct file *fp = p->p_fd->fd_ofiles[args->fd]; + error = fo_ioctl( fp, cmd, data, p ); #endif - u_long cmd = args->cmd; - caddr_t data = (caddr_t) args->arg; - /* - * Pass the ioctl off to our standard handler. - */ - return(fo_ioctl(fp, cmd, data, p)); + if ( error == 0 && (cmd & LINUX_IOC_OUT) && size ) + error = copyout( data, (caddr_t)args->arg, (u_int)size ); + if ( memp ) + free( memp, DRM(M_DRM) ); + return error; } #endif /* DRM_LINUX */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h Wed Oct 30 07:52:25 2002 @@ -30,14 +30,9 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" - -#include <sys/signalvar.h> -#include <sys/poll.h> - -drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_OS_STRUCTPROC *p) +drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p) { #if __FreeBSD_version >= 500021 uid_t uid = p->td_proc->p_ucred->cr_svuid; @@ -56,7 +51,7 @@ /* DRM(open) is called whenever a process opens /dev/drm. */ -int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p, +int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p, drm_device_t *dev) { int m = minor(kdev); @@ -66,9 +61,9 @@ return EBUSY; /* No exclusive opens */ dev->flags = flags; if (!DRM(cpu_valid)()) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); - DRM_DEBUG("pid = %d, minor = %d\n", DRM_OS_CURRENTPID, m); + DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m); /* FIXME: linux mallocs and bzeros here */ priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); @@ -89,15 +84,14 @@ priv->minor = m; priv->devXX = dev; priv->ioctl_count = 0; - priv->authenticated = !DRM_OS_CHECKSUSER; - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, p); + priv->authenticated = !DRM_SUSER(p); + DRM_LOCK; TAILQ_INSERT_TAIL(&dev->files, priv, link); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, p); + DRM_UNLOCK; } - +#ifdef __FreeBSD__ kdev->si_drv1 = dev; - - +#endif return 0; } @@ -108,7 +102,7 @@ ssize_t DRM(read)(dev_t kdev, struct uio *uio, int ioflag) { - DRM_OS_DEVICE; + DRM_DEVICE; int left; int avail; int send; @@ -156,6 +150,9 @@ int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; int send = strlen(s); int count; +#ifdef __NetBSD__ + struct proc *p; +#endif /* __NetBSD__ */ DRM_DEBUG("%d left, %d to send (%p, %p)\n", left, send, dev->buf_rp, dev->buf_wp); @@ -186,19 +183,33 @@ } DRM_DEBUG("dev->buf_sigio=%p\n", dev->buf_sigio); +#ifdef __FreeBSD__ if (dev->buf_sigio) { DRM_DEBUG("dev->buf_sigio->sio_pgid=%d\n", dev->buf_sigio->sio_pgid); +#if __FreeBSD_version >= 500000 + pgsigio(&dev->buf_sigio, SIGIO, 0); +#else pgsigio(dev->buf_sigio, SIGIO, 0); +#endif /* __FreeBSD_version */ } +#endif /* __FreeBSD__ */ +#ifdef __NetBSD__ + if (dev->buf_pgid) { + DRM_DEBUG("dev->buf_pgid=%d\n", dev->buf_pgid); + if(dev->buf_pgid > 0) + gsignal(dev->buf_pgid, SIGIO); + else if(dev->buf_pgid && (p = pfind(-dev->buf_pgid)) != NULL) + psignal(p, SIGIO); +#endif /* __NetBSD__ */ DRM_DEBUG("waking\n"); wakeup(&dev->buf_rp); return 0; } -int DRM(poll)(dev_t kdev, int events, DRM_OS_STRUCTPROC *p) +int DRM(poll)(dev_t kdev, int events, DRM_STRUCTPROC *p) { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; int s; int revents = 0; @@ -217,7 +228,15 @@ int DRM(write)(dev_t kdev, struct uio *uio, int ioflag) { - DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", - curproc->p_pid, ((drm_device_t *)kdev->si_drv1)->device, ((drm_device_t *)kdev->si_drv1)->open_count); - return 0; +#if DRM_DEBUG_CODE + DRM_DEVICE; +#endif +#ifdef __FreeBSD__ + DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", + curproc->p_pid, dev->device, dev->open_count); +#elif defined(__NetBSD__) + DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", + curproc->p_pid, &dev->device, dev->open_count); +#endif + return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h Wed Oct 30 07:52:25 2002 @@ -29,10 +29,9 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" -#if 0 && DRM_DEBUG_CODE +#if 1 && DRM_DEBUG_CODE int DRM(flags) = DRM_FLAG_DEBUG; #else int DRM(flags) = 0; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h Wed Oct 30 07:52:25 2002 @@ -29,20 +29,18 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" -#include <sys/bus.h> -#include <pci/pcivar.h> -int DRM(irq_busid)( DRM_OS_IOCTL ) +int DRM(irq_busid)( DRM_IOCTL_ARGS ) { +#ifdef __FreeBSD__ drm_irq_busid_t id; devclass_t pci; device_t bus, dev; device_t *kids; int error, i, num_kids; - DRM_OS_KRNFROMUSR( id, (drm_irq_busid_t *)data, sizeof(id) ); + DRM_COPY_FROM_USER_IOCTL( id, (drm_irq_busid_t *)data, sizeof(id) ); pci = devclass_find("pci"); if (!pci) @@ -71,49 +69,53 @@ DRM_DEBUG("%d:%d:%d => IRQ %d\n", id.busnum, id.devnum, id.funcnum, id.irq); - DRM_OS_KRNTOUSR( (drm_irq_busid_t *)data, id, sizeof(id) ); + DRM_COPY_TO_USER_IOCTL( (drm_irq_busid_t *)data, id, sizeof(id) ); return 0; +#else + /* don't support interrupt-driven drivers on Net yet */ + return ENOENT; +#endif } -int DRM(getunique)( DRM_OS_IOCTL ) +int DRM(getunique)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_unique_t u; - DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) ); + DRM_COPY_FROM_USER_IOCTL( u, (drm_unique_t *)data, sizeof(u) ); if (u.unique_len >= dev->unique_len) { - if (DRM_OS_COPYTOUSR(u.unique, dev->unique, dev->unique_len)) - DRM_OS_RETURN(EFAULT); + if (DRM_COPY_TO_USER(u.unique, dev->unique, dev->unique_len)) + return DRM_ERR(EFAULT); } u.unique_len = dev->unique_len; - DRM_OS_KRNTOUSR( (drm_unique_t *)data, u, sizeof(u) ); + DRM_COPY_TO_USER_IOCTL( (drm_unique_t *)data, u, sizeof(u) ); return 0; } -int DRM(setunique)( DRM_OS_IOCTL ) +int DRM(setunique)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_unique_t u; if (dev->unique_len || dev->unique) - DRM_OS_RETURN(EBUSY); + return DRM_ERR(EBUSY); - DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) ); + DRM_COPY_FROM_USER_IOCTL( u, (drm_unique_t *)data, sizeof(u) ); if (!u.unique_len || u.unique_len > 1024) - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); dev->unique_len = u.unique_len; dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER); - if(!dev->unique) DRM_OS_RETURN(ENOMEM); + if(!dev->unique) return DRM_ERR(ENOMEM); - if (DRM_OS_COPYFROMUSR(dev->unique, u.unique, dev->unique_len)) - DRM_OS_RETURN(EFAULT); + if (DRM_COPY_FROM_USER(dev->unique, u.unique, dev->unique_len)) + return DRM_ERR(EFAULT); dev->unique[dev->unique_len] = '\0'; @@ -121,7 +123,7 @@ DRM_MEM_DRIVER); if(!dev->devname) { DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER); - DRM_OS_RETURN(ENOMEM); + return DRM_ERR(ENOMEM); } sprintf(dev->devname, "%s@%s", dev->name, dev->unique); @@ -130,23 +132,23 @@ } -int DRM(getmap)( DRM_OS_IOCTL ) +int DRM(getmap)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_map_t map; drm_map_t *mapinlist; drm_map_list_entry_t *list; int idx; int i = 0; - DRM_OS_KRNFROMUSR( map, (drm_map_t *)data, sizeof(map) ); + DRM_COPY_FROM_USER_IOCTL( map, (drm_map_t *)data, sizeof(map) ); idx = map.offset; - DRM_OS_LOCK; + DRM_LOCK; if (idx < 0 || idx >= dev->map_count) { - DRM_OS_UNLOCK; - DRM_OS_RETURN(EINVAL); + DRM_UNLOCK; + return DRM_ERR(EINVAL); } TAILQ_FOREACH(list, dev->maplist, link) { @@ -163,28 +165,28 @@ i++; } - DRM_OS_UNLOCK; + DRM_UNLOCK; if (!list) return EINVAL; - DRM_OS_KRNTOUSR( (drm_map_t *)data, map, sizeof(map) ); + DRM_COPY_TO_USER_IOCTL( (drm_map_t *)data, map, sizeof(map) ); return 0; } -int DRM(getclient)( DRM_OS_IOCTL ) +int DRM(getclient)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_client_t client; drm_file_t *pt; int idx; int i = 0; - DRM_OS_KRNFROMUSR( client, (drm_client_t *)data, sizeof(client) ); + DRM_COPY_FROM_USER_IOCTL( client, (drm_client_t *)data, sizeof(client) ); idx = client.idx; - DRM_OS_LOCK; + DRM_LOCK; TAILQ_FOREACH(pt, &dev->files, link) { if (i==idx) { @@ -193,29 +195,29 @@ client.uid = pt->uid; client.magic = pt->magic; client.iocs = pt->ioctl_count; - DRM_OS_UNLOCK; + DRM_UNLOCK; *(drm_client_t *)data = client; return 0; } i++; } - DRM_OS_UNLOCK; + DRM_UNLOCK; - DRM_OS_KRNTOUSR( (drm_client_t *)data, client, sizeof(client) ); + DRM_COPY_TO_USER_IOCTL( (drm_client_t *)data, client, sizeof(client) ); return 0; } -int DRM(getstats)( DRM_OS_IOCTL ) +int DRM(getstats)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_stats_t stats; int i; memset(&stats, 0, sizeof(stats)); - DRM_OS_LOCK; + DRM_LOCK; for (i = 0; i < dev->counters; i++) { if (dev->types[i] == _DRM_STAT_LOCK) @@ -229,9 +231,9 @@ stats.count = dev->counters; - DRM_OS_UNLOCK; + DRM_UNLOCK; - DRM_OS_KRNTOUSR( (drm_stats_t *)data, stats, sizeof(stats) ); + DRM_COPY_TO_USER_IOCTL( (drm_stats_t *)data, stats, sizeof(stats) ); return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h:1.2 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h Thu Feb 27 12:32:22 2003 @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2000 by Coleman Kane <cokane@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Gardner Buchanan. - * 4. The name of Gardner Buchanan may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/sys/dev/tdfx/tdfx_linux.h,v 1.4 2000/08/22 05:57:55 marcel Exp $ - */ - -/* FIXME: There are IOCTLS to merge in here, see drm.h*/ - -/* Query IOCTLs */ -/* XFree86 4.1.x DRI support */ - -#define LINUX_DRM_IOCTL_VERSION 0x6400 -#define LINUX_DRM_IOCTL_GET_UNIQUE 0x6401 -#define LINUX_DRM_IOCTL_GET_MAGIC 0x6402 -#define LINUX_DRM_IOCTL_IRQ_BUSID 0x6403 -#define LINUX_DRM_IOCTL_GET_MAP 0x6404 -#define LINUX_DRM_IOCTL_GET_CLIENT 0x6405 -#define LINUX_DRM_IOCTL_GET_STATS 0x6406 - -#define LINUX_DRM_IOCTL_SET_UNIQUE 0x6410 -#define LINUX_DRM_IOCTL_AUTH_MAGIC 0x6411 -#define LINUX_DRM_IOCTL_BLOCK 0x6412 -#define LINUX_DRM_IOCTL_UNBLOCK 0x6413 -#define LINUX_DRM_IOCTL_CONTROL 0x6414 -#define LINUX_DRM_IOCTL_ADD_MAP 0x6415 -#define LINUX_DRM_IOCTL_ADD_BUFS 0x6416 -#define LINUX_DRM_IOCTL_MARK_BUFS 0x6417 -#define LINUX_DRM_IOCTL_INFO_BUFS 0x6418 -#define LINUX_DRM_IOCTL_MAP_BUFS 0x6419 -#define LINUX_DRM_IOCTL_FREE_BUFS 0x641a - -#define LINUX_DRM_IOCTL_RM_MAP 0x641b - -#define LINUX_DRM_IOCTL_SET_SAREA_CTX 0x641c -#define LINUX_DRM_IOCTL_GET_SAREA_CTX 0x641d - -#define LINUX_DRM_IOCTL_ADD_CTX 0x6420 -#define LINUX_DRM_IOCTL_RM_CTX 0x6421 -#define LINUX_DRM_IOCTL_MOD_CTX 0x6422 -#define LINUX_DRM_IOCTL_GET_CTX 0x6423 -#define LINUX_DRM_IOCTL_SWITCH_CTX 0x6424 -#define LINUX_DRM_IOCTL_NEW_CTX 0x6425 -#define LINUX_DRM_IOCTL_RES_CTX 0x6426 -#define LINUX_DRM_IOCTL_ADD_DRAW 0x6427 -#define LINUX_DRM_IOCTL_RM_DRAW 0x6428 -#define LINUX_DRM_IOCTL_DMA 0x6429 -#define LINUX_DRM_IOCTL_LOCK 0x642a -#define LINUX_DRM_IOCTL_UNLOCK 0x642b -#define LINUX_DRM_IOCTL_FINISH 0x642c - -#define LINUX_DRM_IOCTL_AGP_ACQUIRE 0x6430 -#define LINUX_DRM_IOCTL_AGP_RELEASE 0x6431 -#define LINUX_DRM_IOCTL_AGP_ENABLE 0x6432 -#define LINUX_DRM_IOCTL_AGP_INFO 0x6433 -#define LINUX_DRM_IOCTL_AGP_ALLOC 0x6434 -#define LINUX_DRM_IOCTL_AGP_FREE 0x6435 -#define LINUX_DRM_IOCTL_AGP_BIND 0x6436 -#define LINUX_DRM_IOCTL_AGP_UNBIND 0x6437 - -#define LINUX_DRM_IOCTL_SG_ALLOC 0x6438 -#define LINUX_DRM_IOCTL_SG_FREE 0x6439 - -/* MGA specific ioctls */ -#define LINUX_DRM_IOCTL_MGA_INIT 0x6440 -#define LINUX_DRM_IOCTL_MGA_FLUSH 0x6441 -#define LINUX_DRM_IOCTL_MGA_RESET 0x6442 -#define LINUX_DRM_IOCTL_MGA_SWAP 0x6443 -#define LINUX_DRM_IOCTL_MGA_CLEAR 0x6444 -#define LINUX_DRM_IOCTL_MGA_VERTEX 0x6445 -#define LINUX_DRM_IOCTL_MGA_INDICES 0x6446 -#define LINUX_DRM_IOCTL_MGA_ILOAD 0x6447 -#define LINUX_DRM_IOCTL_MGA_BLIT 0x6448 - -/* i810 specific ioctls */ -#define LINUX_DRM_IOCTL_I810_INIT 0x6440 -#define LINUX_DRM_IOCTL_I810_VERTEX 0x6441 -#define LINUX_DRM_IOCTL_I810_CLEAR 0x6442 -#define LINUX_DRM_IOCTL_I810_FLUSH 0x6443 -#define LINUX_DRM_IOCTL_I810_GETAGE 0x6444 -#define LINUX_DRM_IOCTL_I810_GETBUF 0x6445 -#define LINUX_DRM_IOCTL_I810_SWAP 0x6446 -#define LINUX_DRM_IOCTL_I810_COPY 0x6447 -#define LINUX_DRM_IOCTL_I810_DOCOPY 0x6448 - -/* I830 specific ioctls */ -#define LINUX_DRM_IOCTL_I830_INIT 0x6440 -#define LINUX_DRM_IOCTL_I830_VERTEX 0x6441 -#define LINUX_DRM_IOCTL_I830_CLEAR 0x6442 -#define LINUX_DRM_IOCTL_I830_FLUSH 0x6443 -#define LINUX_DRM_IOCTL_I830_GETAGE 0x6444 -#define LINUX_DRM_IOCTL_I830_GETBUF 0x6445 -#define LINUX_DRM_IOCTL_I830_SWAP 0x6446 -#define LINUX_DRM_IOCTL_I830_COPY 0x6447 -#define LINUX_DRM_IOCTL_I830_DOCOPY 0x6448 - -/* Rage 128 specific ioctls */ -#define LINUX_DRM_IOCTL_R128_INIT 0x6440 -#define LINUX_DRM_IOCTL_R128_CCE_START 0x6441 -#define LINUX_DRM_IOCTL_R128_CCE_STOP 0x6442 -#define LINUX_DRM_IOCTL_R128_CCE_RESET 0x6443 -#define LINUX_DRM_IOCTL_R128_CCE_IDLE 0x6444 -#define LINUX_DRM_IOCTL_R128_RESET 0x6446 -#define LINUX_DRM_IOCTL_R128_SWAP 0x6447 -#define LINUX_DRM_IOCTL_R128_CLEAR 0x6448 -#define LINUX_DRM_IOCTL_R128_VERTEX 0x6449 -#define LINUX_DRM_IOCTL_R128_INDICES 0x644a -#define LINUX_DRM_IOCTL_R128_BLIT 0x644b -#define LINUX_DRM_IOCTL_R128_DEPTH 0x644c -#define LINUX_DRM_IOCTL_R128_STIPPLE 0x644d -#define LINUX_DRM_IOCTL_R128_INDIRECT 0x644f -#define LINUX_DRM_IOCTL_R128_FULLSCREEN 0x6450 - -/* Radeon specific ioctls */ -#define LINUX_DRM_IOCTL_RADEON_CP_INIT 0x6440 -#define LINUX_DRM_IOCTL_RADEON_CP_START 0x6441 -#define LINUX_DRM_IOCTL_RADEON_CP_STOP 0x6442 -#define LINUX_DRM_IOCTL_RADEON_CP_RESET 0x6443 -#define LINUX_DRM_IOCTL_RADEON_CP_IDLE 0x6444 -#define LINUX_DRM_IOCTL_RADEON_RESET 0x6445 -#define LINUX_DRM_IOCTL_RADEON_FULLSCREEN 0x6446 -#define LINUX_DRM_IOCTL_RADEON_SWAP 0x6447 -#define LINUX_DRM_IOCTL_RADEON_CLEAR 0x6448 -#define LINUX_DRM_IOCTL_RADEON_VERTEX 0x6449 -#define LINUX_DRM_IOCTL_RADEON_INDICES 0x644a -#define LINUX_DRM_IOCTL_RADEON_STIPPLE 0x644c -#define LINUX_DRM_IOCTL_RADEON_INDIRECT 0x644d -#define LINUX_DRM_IOCTL_RADEON_TEXTURE 0x644e - -/* card specific ioctls may increase the DRM_MAX */ -#define LINUX_IOCTL_DRM_MIN LINUX_DRM_IOCTL_VERSION -#define LINUX_IOCTL_DRM_MAX LINUX_DRM_IOCTL_R128_FULLSCREEN Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h Sat Feb 8 16:27:00 2003 @@ -29,7 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" #if __HAVE_DMA_WAITLIST @@ -37,26 +36,28 @@ int DRM(waitlist_create)(drm_waitlist_t *bl, int count) { if (bl->count) - DRM_OS_RETURN( EINVAL ); + return DRM_ERR( EINVAL ); bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs), DRM_MEM_BUFLISTS); - if(!bl->bufs) DRM_OS_RETURN(ENOMEM); + if(!bl->bufs) return DRM_ERR(ENOMEM); + bzero(bl->bufs, sizeof(*bl->bufs)); + bl->count = count; bl->rp = bl->bufs; bl->wp = bl->bufs; bl->end = &bl->bufs[bl->count+1]; - DRM_OS_SPININIT( bl->write_lock, "writelock" ); - DRM_OS_SPININIT( bl->read_lock, "readlock" ); + DRM_SPININIT( bl->write_lock, "writelock" ); + DRM_SPININIT( bl->read_lock, "readlock" ); return 0; } int DRM(waitlist_destroy)(drm_waitlist_t *bl) { if (bl->rp != bl->wp) - DRM_OS_RETURN( EINVAL ); + return DRM_ERR( EINVAL ); if (bl->bufs) DRM(free)(bl->bufs, (bl->count + 2) * sizeof(*bl->bufs), DRM_MEM_BUFLISTS); @@ -65,6 +66,8 @@ bl->rp = NULL; bl->wp = NULL; bl->end = NULL; + DRM_SPINUNINIT( bl->write_lock ); + DRM_SPINUNINIT( bl->read_lock ); return 0; } @@ -76,19 +79,19 @@ if (!left) { DRM_ERROR("Overflow while adding buffer %d from pid %d\n", buf->idx, buf->pid); - DRM_OS_RETURN( EINVAL ); + return DRM_ERR( EINVAL ); } #if __HAVE_DMA_HISTOGRAM getnanotime(&buf->time_queued); #endif buf->list = DRM_LIST_WAIT; - DRM_OS_SPINLOCK(&bl->write_lock); + DRM_SPINLOCK(&bl->write_lock); s = spldrm(); *bl->wp = buf; if (++bl->wp >= bl->end) bl->wp = bl->bufs; splx(s); - DRM_OS_SPINUNLOCK(&bl->write_lock); + DRM_SPINUNLOCK(&bl->write_lock); return 0; } @@ -98,17 +101,17 @@ drm_buf_t *buf; int s; - DRM_OS_SPINLOCK(&bl->read_lock); + DRM_SPINLOCK(&bl->read_lock); s = spldrm(); buf = *bl->rp; if (bl->rp == bl->wp) { splx(s); - DRM_OS_SPINUNLOCK(&bl->read_lock); + DRM_SPINUNLOCK(&bl->read_lock); return NULL; } if (++bl->rp >= bl->end) bl->rp = bl->bufs; splx(s); - DRM_OS_SPINUNLOCK(&bl->read_lock); + DRM_SPINUNLOCK(&bl->read_lock); return buf; } @@ -127,7 +130,7 @@ bl->low_mark = 0; bl->high_mark = 0; atomic_set(&bl->wfh, 0); - DRM_OS_SPININIT( bl->lock, "freelistlock" ); + DRM_SPININIT( bl->lock, "freelistlock" ); ++bl->initialized; return 0; } @@ -136,6 +139,7 @@ { atomic_set(&bl->count, 0); bl->next = NULL; + DRM_SPINUNINIT( bl->lock ); return 0; } @@ -159,10 +163,10 @@ #endif buf->list = DRM_LIST_FREE; - DRM_OS_SPINLOCK( &bl->lock ); + DRM_SPINLOCK( &bl->lock ); buf->next = bl->next; bl->next = buf; - DRM_OS_SPINUNLOCK( &bl->lock ); + DRM_SPINUNLOCK( &bl->lock ); atomic_inc(&bl->count); if (atomic_read(&bl->count) > dma->buf_count) { @@ -174,7 +178,7 @@ /* Check for high water mark */ if (atomic_read(&bl->wfh) && atomic_read(&bl->count)>=bl->high_mark) { atomic_set(&bl->wfh, 0); - DRM_OS_WAKEUP_INT(&bl->waiting); + DRM_WAKEUP_INT(&bl->waiting); } return 0; } @@ -186,14 +190,14 @@ if (!bl) return NULL; /* Get buffer */ - DRM_OS_SPINLOCK(&bl->lock); + DRM_SPINLOCK(&bl->lock); if (!bl->next) { - DRM_OS_SPINUNLOCK(&bl->lock); + DRM_SPINUNLOCK(&bl->lock); return NULL; } buf = bl->next; bl->next = bl->next->next; - DRM_OS_SPINUNLOCK(&bl->lock); + DRM_SPINUNLOCK(&bl->lock); atomic_dec(&bl->count); buf->next = NULL; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h Wed Oct 30 07:52:25 2002 @@ -29,16 +29,15 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" -int DRM(block)( DRM_OS_IOCTL ) +int DRM(block)( DRM_IOCTL_ARGS ) { DRM_DEBUG("\n"); return 0; } -int DRM(unblock)( DRM_OS_IOCTL ) +int DRM(unblock)( DRM_IOCTL_ARGS ) { DRM_DEBUG("\n"); return 0; @@ -109,7 +108,7 @@ pid); return 1; } - DRM_OS_WAKEUP_INT(&dev->lock.lock_queue); + DRM_WAKEUP_INT((void *)&dev->lock.lock_queue); return 0; } @@ -125,7 +124,7 @@ if (atomic_read(&q->use_count) > 1) { atomic_inc(&q->block_write); atomic_inc(&q->block_count); - error = tsleep(&q->flush_queue, PZERO|PCATCH, "drmfq", 0); + error = tsleep((void *)&q->flush_queue, PZERO|PCATCH, "drmfq", 0); if (error) return error; atomic_dec(&q->block_count); @@ -147,7 +146,7 @@ if (atomic_read(&q->use_count) > 1) { if (atomic_read(&q->block_write)) { atomic_dec(&q->block_write); - DRM_OS_WAKEUP_INT(&q->write_queue); + DRM_WAKEUP_INT((void *)&q->write_queue); } } atomic_dec(&q->use_count); @@ -194,15 +193,15 @@ return ret; } -int DRM(finish)( DRM_OS_IOCTL ) +int DRM(finish)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; int ret = 0; drm_lock_t lock; DRM_DEBUG("\n"); - DRM_OS_KRNFROMUSR( lock, (drm_lock_t *)data, sizeof(lock) ); + DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) ); ret = DRM(flush_block_and_flush)(dev, lock.context, lock.flags); DRM(flush_unblock)(dev, lock.context, lock.flags); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h Sat Feb 8 16:27:00 2003 @@ -29,20 +29,16 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ #include "drmP.h" -#include <vm/vm.h> -#include <vm/pmap.h> -#if __REALLY_HAVE_AGP -#include <sys/agpio.h> -#endif +#ifdef __FreeBSD__ #define malloctype DRM(M_DRM) /* The macros confliced in the MALLOC_DEFINE */ MALLOC_DEFINE(malloctype, "drm", "DRM Data Structures"); #undef malloctype +#endif typedef struct drm_mem_stats { const char *name; @@ -53,7 +49,7 @@ unsigned long bytes_freed; } drm_mem_stats_t; -static DRM_OS_SPINTYPE DRM(mem_lock); +static DRM_SPINTYPE DRM(mem_lock); static unsigned long DRM(ram_available) = 0; /* In pages */ static unsigned long DRM(ram_used) = 0; static drm_mem_stats_t DRM(mem_stats)[] = { @@ -85,7 +81,7 @@ { drm_mem_stats_t *mem; - DRM_OS_SPININIT(DRM(mem_lock), "drm memory"); + DRM_SPININIT(DRM(mem_lock), "drm memory"); for (mem = DRM(mem_stats); mem->name; ++mem) { mem->succeed_count = 0; @@ -99,8 +95,13 @@ DRM(ram_used) = 0; } -/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ +void DRM(mem_uninit)(void) +{ + DRM_SPINUNINIT(DRM(mem_lock)); +} +#ifdef __FreeBSD__ +/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ static int DRM(_mem_info) DRM_SYSCTL_HANDLER_ARGS { drm_mem_stats_t *pt; @@ -137,11 +138,12 @@ { int ret; - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ret = DRM(_mem_info)(oidp, arg1, arg2, req); - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return ret; } +#endif void *DRM(alloc)(size_t size, int area) { @@ -152,16 +154,20 @@ return NULL; } +#ifdef __FreeBSD__ if (!(pt = malloc(size, DRM(M_DRM), M_NOWAIT))) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); +#elif defined(__NetBSD__) + if (!(pt = malloc(size, M_DEVBUF, M_NOWAIT))) { +#endif + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[area].fail_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return NULL; } - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[area].succeed_count; DRM(mem_stats)[area].bytes_allocated += size; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return pt; } @@ -203,71 +209,49 @@ int free_count; if (!pt) DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); - else free(pt, DRM(M_DRM)); - DRM_OS_SPINLOCK(&DRM(mem_lock)); + else +#ifdef __FreeBSD__ + free(pt, DRM(M_DRM)); +#elif defined(__NetBSD__) + free(pt, M_DEVBUF); +#endif + DRM_SPINLOCK(&DRM(mem_lock)); DRM(mem_stats)[area].bytes_freed += size; free_count = ++DRM(mem_stats)[area].free_count; alloc_count = DRM(mem_stats)[area].succeed_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); if (free_count > alloc_count) { DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", free_count, alloc_count); } } -unsigned long DRM(alloc_pages)(int order, int area) -{ - vm_offset_t address; - unsigned long bytes = PAGE_SIZE << order; - - - address = (vm_offset_t) contigmalloc(bytes, DRM(M_DRM), M_WAITOK, 0, ~0, 1, 0); - if (!address) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); - ++DRM(mem_stats)[area].fail_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - return 0; - } - DRM_OS_SPINLOCK(&DRM(mem_lock)); - ++DRM(mem_stats)[area].succeed_count; - DRM(mem_stats)[area].bytes_allocated += bytes; - DRM(ram_used) += bytes; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - - - /* Zero outside the lock */ - memset((void *)address, 0, bytes); - - - return address; -} - -void DRM(free_pages)(unsigned long address, int order, int area) +void *DRM(ioremap)(unsigned long offset, unsigned long size) { - unsigned long bytes = PAGE_SIZE << order; - int alloc_count; - int free_count; + void *pt; - if (!address) { - DRM_MEM_ERROR(area, "Attempt to free address 0\n"); - } else { - contigfree((void *) address, bytes, DRM(M_DRM)); + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; } - DRM_OS_SPINLOCK(&DRM(mem_lock)); - free_count = ++DRM(mem_stats)[area].free_count; - alloc_count = DRM(mem_stats)[area].succeed_count; - DRM(mem_stats)[area].bytes_freed += bytes; - DRM(ram_used) -= bytes; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - if (free_count > alloc_count) { - DRM_MEM_ERROR(area, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); + if (!(pt = pmap_mapdev(offset, size))) { + DRM_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + DRM_SPINUNLOCK(&DRM(mem_lock)); + return NULL; } + DRM_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + DRM_SPINUNLOCK(&DRM(mem_lock)); + return pt; } -void *DRM(ioremap)(unsigned long offset, unsigned long size) +/* unused so far */ +#if 0 +void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size) { void *pt; @@ -277,18 +261,20 @@ return NULL; } - if (!(pt = pmap_mapdev(offset, size))) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); + /* FIXME FOR BSD */ + if (!(pt = ioremap_nocache(offset, size))) { + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return NULL; } - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return pt; } +#endif void DRM(ioremapfree)(void *pt, unsigned long size) { @@ -301,11 +287,11 @@ else pmap_unmapdev((vm_offset_t) pt, size); - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_freed += size; free_count = ++DRM(mem_stats)[DRM_MEM_MAPPINGS].free_count; alloc_count = DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); if (free_count > alloc_count) { DRM_MEM_ERROR(DRM_MEM_MAPPINGS, "Excess frees: %d frees, %d allocs\n", @@ -324,16 +310,16 @@ } if ((handle = DRM(agp_allocate_memory)(pages, type))) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_allocated += pages << PAGE_SHIFT; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return handle; } - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[DRM_MEM_TOTALAGP].fail_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); return NULL; } @@ -345,16 +331,16 @@ if (!handle) { DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Attempt to free NULL AGP handle\n"); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (DRM(agp_free_memory)(handle)) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); free_count = ++DRM(mem_stats)[DRM_MEM_TOTALAGP].free_count; alloc_count = DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_freed += pages << PAGE_SHIFT; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); if (free_count > alloc_count) { DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Excess frees: %d frees, %d allocs\n", @@ -362,13 +348,13 @@ } return 0; } - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } int DRM(bind_agp)(agp_memory *handle, unsigned int start) { int retcode; - device_t dev = agp_find_device(); + device_t dev = DRM_AGP_FIND_DEVICE(); struct agp_memory_info info; if (!dev) @@ -377,22 +363,22 @@ if (!handle) { DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, "Attempt to bind NULL AGP handle\n"); - DRM_OS_RETURN(EINVAL); + return DRM_ERR(EINVAL); } if (!(retcode = DRM(agp_bind_memory)(handle, start))) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; agp_memory_info(dev, handle, &info); DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_allocated += info.ami_size; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - DRM_OS_RETURN(0); + DRM_SPINUNLOCK(&DRM(mem_lock)); + return DRM_ERR(0); } - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - DRM_OS_RETURN(retcode); + DRM_SPINUNLOCK(&DRM(mem_lock)); + return DRM_ERR(retcode); } int DRM(unbind_agp)(agp_memory *handle) @@ -400,7 +386,7 @@ int alloc_count; int free_count; int retcode = EINVAL; - device_t dev = agp_find_device(); + device_t dev = DRM_AGP_FIND_DEVICE(); struct agp_memory_info info; if (!dev) @@ -409,25 +395,25 @@ if (!handle) { DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, "Attempt to unbind NULL AGP handle\n"); - DRM_OS_RETURN(retcode); + return DRM_ERR(retcode); } agp_memory_info(dev, handle, &info); if ((retcode = DRM(agp_unbind_memory)(handle))) - DRM_OS_RETURN(retcode); + return DRM_ERR(retcode); - DRM_OS_SPINLOCK(&DRM(mem_lock)); + DRM_SPINLOCK(&DRM(mem_lock)); free_count = ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].free_count; alloc_count = DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_freed += info.ami_size; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_SPINUNLOCK(&DRM(mem_lock)); if (free_count > alloc_count) { DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, "Excess frees: %d frees, %d allocs\n", free_count, alloc_count); } - DRM_OS_RETURN(retcode); + return DRM_ERR(retcode); } #endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h Sat Feb 8 16:27:00 2003 @@ -12,12 +12,26 @@ #include <sys/uio.h> #include <sys/filio.h> #include <sys/sysctl.h> -#include <sys/select.h> +#include <sys/bus.h> +#include <sys/signalvar.h> +#include <sys/poll.h> #include <vm/vm.h> #include <vm/pmap.h> +#include <vm/vm_extern.h> +#include <vm/vm_map.h> +#include <vm/vm_param.h> +#include <machine/param.h> #include <machine/pmap.h> +#include <machine/bus.h> +#include <machine/resource.h> +#include <sys/mman.h> +#include <sys/rman.h> +#include <sys/memrange.h> +#include <pci/pcivar.h> #if __FreeBSD_version >= 500000 #include <sys/selinfo.h> +#else +#include <sys/select.h> #endif #include <sys/bus.h> #if __FreeBSD_version >= 400005 @@ -31,61 +45,80 @@ #define __REALLY_HAVE_AGP __HAVE_AGP #endif -#define __REALLY_HAVE_MTRR 0 -#define __REALLY_HAVE_SG 0 +#define __REALLY_HAVE_MTRR (__HAVE_MTRR) +#define __REALLY_HAVE_SG (__HAVE_SG) #if __REALLY_HAVE_AGP #include <pci/agpvar.h> +#include <sys/agpio.h> +#endif + +#include <opt_drm.h> +#if DRM_DEBUG +#undef DRM_DEBUG_CODE +#define DRM_DEBUG_CODE 2 #endif +#undef DRM_DEBUG +#if DRM_LINUX +#include <sys/file.h> +#include <sys/proc.h> +#include <machine/../linux/linux.h> +#include <machine/../linux/linux_proto.h> +#endif + #define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) #define DRM_DEV_UID 0 #define DRM_DEV_GID 0 - +#define CDEV_MAJOR 145 #if __FreeBSD_version >= 500000 -#define DRM_OS_SPINTYPE struct mtx -#define DRM_OS_SPININIT(l,name) mtx_init(&l, name, MTX_DEF) -#define DRM_OS_SPINLOCK(l) mtx_lock(l) -#define DRM_OS_SPINUNLOCK(u) mtx_unlock(u); -#define DRM_OS_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curthread) -#define DRM_OS_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, curthread) -#define DRM_OS_CURPROC curthread -#define DRM_OS_STRUCTPROC struct thread -#define DRM_OS_CURRENTPID curthread->td_proc->p_pid -#define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, struct thread *p -#define DRM_OS_CHECKSUSER suser(p->td_proc) +#define DRM_CURPROC curthread +#define DRM_STRUCTPROC struct thread +#define DRM_SPINTYPE struct mtx +#define DRM_SPININIT(l,name) mtx_init(&l, name, NULL, MTX_DEF) +#define DRM_SPINUNINIT(l) mtx_destroy(&l) +#define DRM_SPINLOCK(l) mtx_lock(l) +#define DRM_SPINUNLOCK(u) mtx_unlock(u); +#define DRM_CURRENTPID curthread->td_proc->p_pid #else -#define DRM_OS_CURPROC curproc -#define DRM_OS_STRUCTPROC struct proc -#define DRM_OS_SPINTYPE struct simplelock -#define DRM_OS_SPININIT(l,name) simple_lock_init(&l) -#define DRM_OS_SPINLOCK(l) simple_lock(l) -#define DRM_OS_SPINUNLOCK(u) simple_unlock(u); -#define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p -#define DRM_OS_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc) -#define DRM_OS_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc) -#define DRM_OS_CURRENTPID curproc->p_pid -#define DRM_OS_CHECKSUSER suser(p) -#endif - -#define DRM_OS_TASKQUEUE_ARGS void *dev, int pending -#define DRM_OS_IRQ_ARGS void *device -#define DRM_OS_DEVICE drm_device_t *dev = kdev->si_drv1 -#define DRM_OS_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT ) -#define DRM_OS_FREE(pt) free( pt, DRM(M_DRM) ) -#define DRM_OS_VTOPHYS(addr) vtophys(addr) +#define DRM_CURPROC curproc +#define DRM_STRUCTPROC struct proc +#define DRM_SPINTYPE struct simplelock +#define DRM_SPININIT(l,name) simple_lock_init(&l) +#define DRM_SPINUNINIT(l,name) +#define DRM_SPINLOCK(l) simple_lock(l) +#define DRM_SPINUNLOCK(u) simple_unlock(u); +#define DRM_CURRENTPID curproc->p_pid +#endif + +#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p +#define DRM_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, DRM_CURPROC) +#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, DRM_CURPROC) +#define DRM_SUSER(p) suser(p) +#define DRM_TASKQUEUE_ARGS void *arg, int pending +#define DRM_IRQ_ARGS void *arg +#define DRM_DEVICE drm_device_t *dev = kdev->si_drv1 +#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT ) +#define DRM_FREE(pt) free( pt, DRM(M_DRM) ) +#define DRM_VTOPHYS(addr) vtophys(addr) +#define DRM_READ8(addr) *((volatile char *)(addr)) +#define DRM_READ32(addr) *((volatile long *)(addr)) +#define DRM_WRITE8(addr, val) *((volatile char *)(addr)) = (val) +#define DRM_WRITE32(addr, val) *((volatile long *)(addr)) = (val) +#define DRM_AGP_FIND_DEVICE() agp_find_device() +#define DRM_ERR(v) v -#define DRM_OS_PRIV \ +#define DRM_PRIV \ drm_file_t *priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); \ if (!priv) { \ DRM_DEBUG("can't find authenticator\n"); \ return EINVAL; \ } -#define DRM_OS_DELAY( udelay ) \ +#define DRM_UDELAY( udelay ) \ do { \ struct timeval tv1, tv2; \ microtime(&tv1); \ @@ -94,35 +127,73 @@ } \ while (((tv2.tv_sec-tv1.tv_sec)*1000000 + tv2.tv_usec - tv1.tv_usec) < udelay ); \ } while (0) + +#define DRM_GETSAREA() \ +do { \ + drm_map_list_entry_t *listentry; \ + TAILQ_FOREACH(listentry, dev->maplist, link) { \ + drm_map_t *map = listentry->map; \ + if (map->type == _DRM_SHM && \ + map->flags & _DRM_CONTAINS_LOCK) { \ + dev_priv->sarea = map; \ + break; \ + } \ + } \ +} while (0) -#define DRM_OS_RETURN(v) return v; +#define DRM_HZ hz +#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ +while (!condition) { \ + ret = tsleep( &(queue), PZERO | PCATCH, "drmwtq", (timeout) ); \ + if ( ret ) \ + return ret; \ +} -#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \ - *arg1 = arg2 -#define DRM_OS_KRNFROMUSR(arg1, arg2, arg3) \ - arg1 = *arg2 -#define DRM_OS_COPYTOUSR(arg1, arg2, arg3) \ - copyout(arg2, arg1, arg3) -#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \ +#define DRM_WAKEUP( queue ) wakeup( queue ) +#define DRM_WAKEUP_INT( queue ) wakeup( queue ) +#define DRM_INIT_WAITQUEUE( queue ) do {} while (0) + +#define DRM_COPY_TO_USER_IOCTL(user, kern, size) \ + if ( IOCPARM_LEN(cmd) != size) \ + return EINVAL; \ + *user = kern; +#define DRM_COPY_FROM_USER_IOCTL(kern, user, size) \ + if ( IOCPARM_LEN(cmd) != size) \ + return EINVAL; \ + kern = *user; +#define DRM_COPY_TO_USER(user, kern, size) \ + copyout(kern, user, size) +#define DRM_COPY_FROM_USER(kern, user, size) \ + copyin(user, kern, size) +/* Macros for userspace access with checking readability once */ +/* FIXME: can't find equivalent functionality for nocheck yet. + * It's be slower than linux, but should be correct. + */ +#define DRM_VERIFYAREA_READ( uaddr, size ) \ + (!useracc((caddr_t)uaddr, size, VM_PROT_READ)) +#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \ copyin(arg2, arg1, arg3) +#define DRM_GET_USER_UNCHECKED(val, uaddr) \ + ((val) = fuword(uaddr), 0) + +/* From machine/bus_at386.h on i386 */ +#define DRM_READMEMORYBARRIER() \ +do { \ + __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); \ +} while (0) -#define DRM_OS_READMEMORYBARRIER \ -{ \ - int xchangeDummy; \ - DRM_DEBUG("%s\n", __FUNCTION__); \ - __asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); \ - __asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" \ - " movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" \ - " pop %%eax" : /* no outputs */ : /* no inputs */ ); \ -} while (0); +#define DRM_WRITEMEMORYBARRIER() \ +do { \ + __asm __volatile("" : : : "memory"); \ +} while (0) -#define DRM_OS_WRITEMEMORYBARRIER DRM_OS_READMEMORYBARRIER -#define DRM_OS_WAKEUP(w) wakeup(w) -#define DRM_OS_WAKEUP_INT(w) wakeup(w) +#define PAGE_ALIGN(addr) round_page(addr) -#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) +#ifndef M_WAITOK /* M_WAITOK (=0) name removed in -current */ +#define M_WAITOK 0 +#endif #define malloctype DRM(M_DRM) /* The macros confliced in the MALLOC_DEFINE */ @@ -137,7 +208,10 @@ char *name; } drm_chipinfo_t; -typedef unsigned long atomic_t; +#define cpu_to_le32(x) (x) + +typedef u_int32_t dma_addr_t; +typedef u_int32_t atomic_t; typedef u_int32_t cycles_t; typedef u_int32_t spinlock_t; typedef u_int32_t u32; @@ -145,50 +219,50 @@ typedef u_int8_t u8; #define atomic_set(p, v) (*(p) = (v)) #define atomic_read(p) (*(p)) -#define atomic_inc(p) atomic_add_long(p, 1) -#define atomic_dec(p) atomic_subtract_long(p, 1) -#define atomic_add(n, p) atomic_add_long(p, n) -#define atomic_sub(n, p) atomic_subtract_long(p, n) +#define atomic_inc(p) atomic_add_int(p, 1) +#define atomic_dec(p) atomic_subtract_int(p, 1) +#define atomic_add(n, p) atomic_add_int(p, n) +#define atomic_sub(n, p) atomic_subtract_int(p, n) /* Fake this */ -static __inline unsigned int -test_and_set_bit(int b, volatile unsigned long *p) +static __inline atomic_t +test_and_set_bit(int b, volatile void *p) { int s = splhigh(); unsigned int m = 1<<b; - unsigned int r = *p & m; - *p |= m; + unsigned int r = *(volatile int *)p & m; + *(volatile int *)p |= m; splx(s); return r; } static __inline void -clear_bit(int b, volatile unsigned long *p) +clear_bit(int b, volatile void *p) { - atomic_clear_long(p + (b >> 5), 1 << (b & 0x1f)); + atomic_clear_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f)); } static __inline void -set_bit(int b, volatile unsigned long *p) +set_bit(int b, volatile void *p) { - atomic_set_long(p + (b >> 5), 1 << (b & 0x1f)); + atomic_set_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f)); } static __inline int -test_bit(int b, volatile unsigned long *p) +test_bit(int b, volatile void *p) { - return p[b >> 5] & (1 << (b & 0x1f)); + return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f)); } static __inline int -find_first_zero_bit(volatile unsigned long *p, int max) +find_first_zero_bit(volatile void *p, int max) { int b; for (b = 0; b < max; b += 32) { - if (p[b >> 5] != ~0) { + if (((volatile int *)p)[b >> 5] != ~0) { for (;;) { - if ((p[b >> 5] & (1 << (b & 0x1f))) == 0) + if ((((volatile int *)p)[b >> 5] & (1 << (b & 0x1f))) == 0) return b; b++; } @@ -227,24 +301,23 @@ } while (0) /* Redefinitions to make templating easy */ -#define wait_queue_head_t long +#define wait_queue_head_t atomic_t #define agp_memory void #define jiffies ticks /* Macros to make printf easier */ #define DRM_ERROR(fmt, arg...) \ - printf("error: " "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) + printf("error: " "[" DRM_NAME ":%s] *ERROR* " fmt , __func__ , ## arg) #define DRM_MEM_ERROR(area, fmt, arg...) \ - printf("error: " "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ - DRM(mem_stats)[area].name , ##arg) -#define DRM_INFO(fmt, arg...) printf("info: " "[" DRM_NAME "] " fmt , ##arg) + printf("error: " "[" DRM_NAME ":%s:%s] *ERROR* " fmt , \ + __func__, DRM(mem_stats)[area].name , ##arg) +#define DRM_INFO(fmt, arg...) printf("info: " "[" DRM_NAME "] " fmt , ## arg) #if DRM_DEBUG_CODE #define DRM_DEBUG(fmt, arg...) \ do { \ - if (DRM(flags) & DRM_FLAG_DEBUG) \ - printf("[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ - ##arg); \ + if (DRM(flags) & DRM_FLAG_DEBUG) \ + printf("[" DRM_NAME ":%s] " fmt , __func__ , ## arg); \ } while (0) #else #define DRM_DEBUG(fmt, arg...) do { } while (0) @@ -294,9 +367,9 @@ extern d_poll_t DRM(poll); extern d_mmap_t DRM(mmap); extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, - DRM_OS_STRUCTPROC *p, drm_device_t *dev); + DRM_STRUCTPROC *p, drm_device_t *dev); extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, - DRM_OS_STRUCTPROC *p); + DRM_STRUCTPROC *p); /* Misc. IOCTL support (drm_ioctl.h) */ extern d_ioctl_t DRM(irq_busid); @@ -348,8 +421,11 @@ extern int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS; /* DMA support (drm_dma.h) */ -#if __HAVE_DMA_IRQ +#if __HAVE_DMA extern d_ioctl_t DRM(control); +#endif +#if __HAVE_VBL_IRQ +extern d_ioctl_t DRM(wait_vblank); #endif /* AGP/GART support (drm_agpsupport.h) */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_netbsd.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_netbsd.h:1.2 --- /dev/null Thu Feb 27 12:32:22 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_netbsd.h Sat Feb 8 16:27:00 2003 @@ -0,0 +1,379 @@ +#include <sys/param.h> +#include <sys/queue.h> +#include <sys/malloc.h> +#include <sys/kernel.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/stat.h> +#include <sys/proc.h> +#include <sys/lock.h> +#include <sys/fcntl.h> +#include <sys/uio.h> +#include <sys/filio.h> +#include <sys/sysctl.h> +#include <sys/select.h> +#include <sys/device.h> +#include <sys/mman.h> +#include <uvm/uvm.h> +#include <sys/vnode.h> +#include <sys/poll.h> +/* For TIOCSPGRP/TIOCGPGRP */ +#include <sys/ttycom.h> + +#include <uvm/uvm.h> + +#include <machine/pmap.h> +#include <machine/bus.h> +#include <sys/resourcevar.h> +#include <machine/sysarch.h> +#include <machine/mtrr.h> + +#include <dev/pci/pcireg.h> +#include <dev/pci/pcivar.h> + +#include "drmvar.h" + +#define __REALLY_HAVE_AGP __HAVE_AGP + +#define __REALLY_HAVE_MTRR 0 +#define __REALLY_HAVE_SG 0 + +#if __REALLY_HAVE_AGP +#include <dev/pci/agpvar.h> +#include <sys/agpio.h> +#endif + +#define device_t struct device * +extern struct cfdriver DRM(_cd); + +#if DRM_DEBUG +#undef DRM_DEBUG_CODE +#define DRM_DEBUG_CODE 2 +#endif +#undef DRM_DEBUG + +#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ + +#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) +#define DRM_DEV_UID 0 +#define DRM_DEV_GID 0 +#define CDEV_MAJOR 90 + +#define DRM_CURPROC curproc +#define DRM_STRUCTPROC struct proc +#define DRM_SPINTYPE struct simplelock +#define DRM_SPININIT(l,name) simple_lock_init(&l) +#define DRM_SPINUNINIT(l) +#define DRM_SPINLOCK(l) simple_lock(l) +#define DRM_SPINUNLOCK(u) simple_unlock(u); +#define DRM_CURRENTPID curproc->p_pid + +#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p +#define DRM_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, NULL) +#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, NULL) +#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag) +#define DRM_TASKQUEUE_ARGS void *dev, int pending +#define DRM_IRQ_ARGS void *device +#define DRM_DEVICE drm_device_t *dev = device_lookup(&DRM(_cd), minor(kdev)) +#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT ) +#define DRM_FREE(pt) free( pt, DRM(M_DRM) ) +#define DRM_VTOPHYS(addr) vtophys(addr) +#define DRM_READ8(addr) *((volatile char *)(addr)) +#define DRM_READ32(addr) *((volatile long *)(addr)) +#define DRM_WRITE8(addr, val) *((volatile char *)(addr)) = (val) +#define DRM_WRITE32(addr, val) *((volatile long *)(addr)) = (val) +#define DRM_AGP_FIND_DEVICE() + +#define DRM_PRIV \ + drm_file_t *priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); \ + if (!priv) { \ + DRM_DEBUG("can't find authenticator\n"); \ + return EINVAL; \ + } + +#define DRM_UDELAY( udelay ) \ +do { \ + struct timeval tv1, tv2; \ + microtime(&tv1); \ + do { \ + microtime(&tv2); \ + } \ + while (((tv2.tv_sec-tv1.tv_sec)*1000000 + tv2.tv_usec - tv1.tv_usec) < udelay ); \ +} while (0) + +#define DRM_GETSAREA() \ +do { \ + drm_map_list_entry_t *listentry; \ + TAILQ_FOREACH(listentry, dev->maplist, link) { \ + drm_map_t *map = listentry->map; \ + if (map->type == _DRM_SHM && \ + map->flags & _DRM_CONTAINS_LOCK) { \ + dev_priv->sarea = map; \ + break; \ + } \ + } \ +} while (0) + +#define return DRM_ERR(v) return v; +#define DRM_ERR(v) v + +#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \ + *arg1 = arg2 +#define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \ + arg1 = *arg2 +#define DRM_COPY_TO_USER(arg1, arg2, arg3) \ + copyout(arg2, arg1, arg3) +#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ + copyin(arg2, arg1, arg3) + +#define DRM_READMEMORYBARRIER \ +{ \ + int xchangeDummy; \ + DRM_DEBUG("%s\n", __FUNCTION__); \ + __asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); \ + __asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" \ + " movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" \ + " pop %%eax" : /* no outputs */ : /* no inputs */ ); \ +} while (0); + +#define DRM_WRITEMEMORYBARRIER DRM_READMEMORYBARRIER + +#define DRM_WAKEUP(w) wakeup(w) +#define DRM_WAKEUP_INT(w) wakeup(w) + +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) + +typedef struct drm_chipinfo +{ + int vendor; + int device; + int supported; + char *name; +} drm_chipinfo_t; + +typedef u_int32_t dma_addr_t; +typedef volatile u_int32_t atomic_t; +typedef u_int32_t cycles_t; +typedef u_int32_t spinlock_t; +typedef u_int32_t u32; +typedef u_int16_t u16; +typedef u_int8_t u8; +typedef dev_type_ioctl(d_ioctl_t); +typedef vaddr_t vm_offset_t; + +#define atomic_set(p, v) (*(p) = (v)) +#define atomic_read(p) (*(p)) +#define atomic_inc(p) atomic_add_int(p, 1) +#define atomic_dec(p) atomic_subtract_int(p, 1) +#define atomic_add(n, p) atomic_add_int(p, n) +#define atomic_sub(n, p) atomic_subtract_int(p, n) + +/* FIXME: Is NetBSD's kernel non-reentrant? */ +#define atomic_add_int(p, v) *(p) += v +#define atomic_subtract_int(p, v) *(p) -= v +#define atomic_set_int(p, bits) *(p) |= (bits) +#define atomic_clear_int(p, bits) *(p) &= ~(bits) + +/* Fake this */ +static __inline atomic_t +test_and_set_bit(int b, atomic_t *p) +{ + int s = splhigh(); + unsigned int m = 1<<b; + unsigned int r = *p & m; + *p |= m; + splx(s); + return r; +} + +static __inline void +clear_bit(int b, atomic_t *p) +{ + atomic_clear_int(p + (b >> 5), 1 << (b & 0x1f)); +} + +static __inline void +set_bit(int b, atomic_t *p) +{ + atomic_set_int(p + (b >> 5), 1 << (b & 0x1f)); +} + +static __inline int +test_bit(int b, atomic_t *p) +{ + return p[b >> 5] & (1 << (b & 0x1f)); +} + +static __inline int +find_first_zero_bit(atomic_t *p, int max) +{ + int b; + + for (b = 0; b < max; b += 32) { + if (p[b >> 5] != ~0) { + for (;;) { + if ((p[b >> 5] & (1 << (b & 0x1f))) == 0) + return b; + b++; + } + } + } + return max; +} + +#define spldrm() spltty() +#define jiffies hardclock_ticks + +#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) +#define _DRM_CAS(lock,old,new,__ret) \ + do { \ + int __dummy; /* Can't mark eax as clobbered */ \ + __asm__ __volatile__( \ + "lock ; cmpxchg %4,%1\n\t" \ + "setnz %0" \ + : "=d" (__ret), \ + "=m" (__drm_dummy_lock(lock)), \ + "=a" (__dummy) \ + : "2" (old), \ + "r" (new)); \ + } while (0) + +/* Redefinitions to make templating easy */ +#define wait_queue_head_t atomic_t +#define agp_memory void + + /* Macros to make printf easier */ +#define DRM_ERROR(fmt, arg...) \ +do { \ + printf("error: [" DRM_NAME ":%s] *ERROR* ", __func__ ); \ + printf( fmt,## arg ); \ +} while (0) + +#define DRM_MEM_ERROR(area, fmt, arg...) \ + printf("error: [" DRM_NAME ":%s:%s] *ERROR* " fmt , \ + __func__, DRM(mem_stats)[area].name ,## arg) +#define DRM_INFO(fmt, arg...) printf("info: " "[" DRM_NAME "] " fmt ,## arg) + +#if DRM_DEBUG_CODE +#define DRM_DEBUG(fmt, arg...) \ + do { \ + if (DRM(flags) & DRM_FLAG_DEBUG) \ + printf("[" DRM_NAME ":%s] " fmt , __FUNCTION__,## arg); \ + } while (0) +#else +#define DRM_DEBUG(fmt, arg...) do { } while (0) +#endif + +#define DRM_PROC_LIMIT (PAGE_SIZE-80) + +#define DRM_SYSCTL_PRINT(fmt, arg...) \ + snprintf(buf, sizeof(buf), fmt, ##arg); \ + error = SYSCTL_OUT(req, buf, strlen(buf)); \ + if (error) return error; + +#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \ + snprintf(buf, sizeof(buf), fmt, ##arg); \ + error = SYSCTL_OUT(req, buf, strlen(buf)); \ + if (error) { ret; return error; } + + +#define DRM_FIND_MAP(dest, o) \ + do { \ + drm_map_list_entry_t *listentry; \ + TAILQ_FOREACH(listentry, dev->maplist, link) { \ + if ( listentry->map->offset == o ) { \ + dest = listentry->map; \ + break; \ + } \ + } \ + } while (0) + +/* Internal functions */ + +/* drm_drv.h */ +extern dev_type_ioctl(DRM(ioctl)); +extern dev_type_ioctl(DRM(lock)); +extern dev_type_ioctl(DRM(unlock)); +extern dev_type_open(DRM(open)); +extern dev_type_close(DRM(close)); +extern dev_type_read(DRM(read)); +extern dev_type_write(DRM(write)); +extern dev_type_poll(DRM(poll)); +extern dev_type_mmap(DRM(mmap)); +extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, + DRM_STRUCTPROC *p, drm_device_t *dev); +extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, + DRM_STRUCTPROC *p); + +/* Misc. IOCTL support (drm_ioctl.h) */ +extern dev_type_ioctl(DRM(irq_busid)); +extern dev_type_ioctl(DRM(getunique)); +extern dev_type_ioctl(DRM(setunique)); +extern dev_type_ioctl(DRM(getmap)); +extern dev_type_ioctl(DRM(getclient)); +extern dev_type_ioctl(DRM(getstats)); + +/* Context IOCTL support (drm_context.h) */ +extern dev_type_ioctl(DRM(resctx)); +extern dev_type_ioctl(DRM(addctx)); +extern dev_type_ioctl(DRM(modctx)); +extern dev_type_ioctl(DRM(getctx)); +extern dev_type_ioctl(DRM(switchctx)); +extern dev_type_ioctl(DRM(newctx)); +extern dev_type_ioctl(DRM(rmctx)); +extern dev_type_ioctl(DRM(setsareactx)); +extern dev_type_ioctl(DRM(getsareactx)); + +/* Drawable IOCTL support (drm_drawable.h) */ +extern dev_type_ioctl(DRM(adddraw)); +extern dev_type_ioctl(DRM(rmdraw)); + +/* Authentication IOCTL support (drm_auth.h) */ +extern dev_type_ioctl(DRM(getmagic)); +extern dev_type_ioctl(DRM(authmagic)); + +/* Locking IOCTL support (drm_lock.h) */ +extern dev_type_ioctl(DRM(block)); +extern dev_type_ioctl(DRM(unblock)); +extern dev_type_ioctl(DRM(finish)); + +/* Buffer management support (drm_bufs.h) */ +extern dev_type_ioctl(DRM(addmap)); +extern dev_type_ioctl(DRM(rmmap)); +#if __HAVE_DMA +extern dev_type_ioctl(DRM(addbufs_agp)); +extern dev_type_ioctl(DRM(addbufs_pci)); +extern dev_type_ioctl(DRM(addbufs_sg)); +extern dev_type_ioctl(DRM(addbufs)); +extern dev_type_ioctl(DRM(infobufs)); +extern dev_type_ioctl(DRM(markbufs)); +extern dev_type_ioctl(DRM(freebufs)); +extern dev_type_ioctl(DRM(mapbufs)); +#endif + +/* DMA support (drm_dma.h) */ +#if __HAVE_DMA +extern dev_type_ioctl(DRM(control)); +#endif + +/* AGP/GART support (drm_agpsupport.h) */ +#if __REALLY_HAVE_AGP +extern dev_type_ioctl(DRM(agp_acquire)); +extern dev_type_ioctl(DRM(agp_release)); +extern dev_type_ioctl(DRM(agp_enable)); +extern dev_type_ioctl(DRM(agp_info)); +extern dev_type_ioctl(DRM(agp_alloc)); +extern dev_type_ioctl(DRM(agp_free)); +extern dev_type_ioctl(DRM(agp_unbind)); +extern dev_type_ioctl(DRM(agp_bind)); +#endif + +/* Scatter Gather Support (drm_scatter.h) */ +#if __HAVE_SG +extern dev_type_ioctl(DRM(sg_alloc)); +extern dev_type_ioctl(DRM(sg_free)); +#endif + +/* SysCtl Support (drm_sysctl.h) */ +extern int DRM(sysctl_init)(drm_device_t *dev); +extern int DRM(sysctl_cleanup)(drm_device_t *dev); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h Wed Oct 30 07:52:25 2002 @@ -27,26 +27,16 @@ * Gareth Hughes <gareth@valinux.com> */ -#define __NO_VERSION__ -#include <linux/config.h> -#include <linux/vmalloc.h> #include "drmP.h" #define DEBUG_SCATTER 0 +#if __REALLY_HAVE_SG + void DRM(sg_cleanup)( drm_sg_mem_t *entry ) { - struct page *page; - int i; - - for ( i = 0 ; i < entry->pages ; i++ ) { - page = entry->pagelist[i]; - if ( page ) - ClearPageReserved( page ); - } + free( entry->virtual, DRM(M_DRM) ); - vfree( entry->virtual ); - DRM(free)( entry->busaddr, entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); @@ -58,35 +48,28 @@ DRM_MEM_SGLISTS ); } -int DRM(sg_alloc)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) +int DRM(sg_alloc)( DRM_IOCTL_ARGS ) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; + DRM_DEVICE; drm_scatter_gather_t request; drm_sg_mem_t *entry; - unsigned long pages, i, j; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; + unsigned long pages; DRM_DEBUG( "%s\n", __FUNCTION__ ); if ( dev->sg ) - return -EINVAL; + return EINVAL; - if ( copy_from_user( &request, - (drm_scatter_gather_t *)arg, - sizeof(request) ) ) - return -EFAULT; + DRM_COPY_FROM_USER_IOCTL(request, (drm_scatter_gather_t *)data, + sizeof(request) ); entry = DRM(alloc)( sizeof(*entry), DRM_MEM_SGLISTS ); if ( !entry ) - return -ENOMEM; + return ENOMEM; - memset( entry, 0, sizeof(*entry) ); + bzero( entry, sizeof(*entry) ); - pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + pages = round_page(request.size) / PAGE_SIZE; DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages ); entry->pages = pages; @@ -94,9 +77,11 @@ DRM_MEM_PAGES ); if ( !entry->pagelist ) { DRM(free)( entry, sizeof(*entry), DRM_MEM_SGLISTS ); - return -ENOMEM; + return ENOMEM; } + bzero(entry->pagelist, pages * sizeof(*entry->pagelist)); + entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); if ( !entry->busaddr ) { @@ -106,11 +91,11 @@ DRM(free)( entry, sizeof(*entry), DRM_MEM_SGLISTS ); - return -ENOMEM; + return ENOMEM; } - memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); + bzero( (void *)entry->busaddr, pages * sizeof(*entry->busaddr) ); - entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); + entry->virtual = malloc( pages << PAGE_SHIFT, DRM(M_DRM), M_WAITOK ); if ( !entry->virtual ) { DRM(free)( entry->busaddr, entry->pages * sizeof(*entry->busaddr), @@ -121,45 +106,21 @@ DRM(free)( entry, sizeof(*entry), DRM_MEM_SGLISTS ); - return -ENOMEM; + return ENOMEM; } - /* This also forces the mapping of COW pages, so our page list - * will be valid. Please don't remove it... - */ - memset( entry->virtual, 0, pages << PAGE_SHIFT ); + bzero( entry->virtual, pages << PAGE_SHIFT ); entry->handle = (unsigned long)entry->virtual; DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle ); DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual ); - for ( i = entry->handle, j = 0 ; j < pages ; i += PAGE_SIZE, j++ ) { - pgd = pgd_offset_k( i ); - if ( !pgd_present( *pgd ) ) - goto failed; - - pmd = pmd_offset( pgd, i ); - if ( !pmd_present( *pmd ) ) - goto failed; - - pte = pte_offset( pmd, i ); - if ( !pte_present( *pte ) ) - goto failed; - - entry->pagelist[j] = pte_page( *pte ); - - SetPageReserved( entry->pagelist[j] ); - } - request.handle = entry->handle; - if ( copy_to_user( (drm_scatter_gather_t *)arg, - &request, - sizeof(request) ) ) { - DRM(sg_cleanup)( entry ); - return -EFAULT; - } + DRM_COPY_TO_USER_IOCTL( (drm_scatter_gather_t *)data, + request, + sizeof(request) ); dev->sg = entry; @@ -205,29 +166,24 @@ return 0; - failed: DRM(sg_cleanup)( entry ); - return -ENOMEM; + return ENOMEM; } -int DRM(sg_free)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) +int DRM(sg_free)( DRM_IOCTL_ARGS ) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; + DRM_DEVICE; drm_scatter_gather_t request; drm_sg_mem_t *entry; - if ( copy_from_user( &request, - (drm_scatter_gather_t *)arg, - sizeof(request) ) ) - return -EFAULT; + DRM_COPY_FROM_USER_IOCTL( request, (drm_scatter_gather_t *)data, + sizeof(request) ); entry = dev->sg; dev->sg = NULL; if ( !entry || entry->handle != request.handle ) - return -EINVAL; + return EINVAL; DRM_DEBUG( "sg free virtual = %p\n", entry->virtual ); @@ -235,3 +191,16 @@ return 0; } + +#else /* __REALLY_HAVE_SG */ + +int DRM(sg_alloc)( DRM_IOCTL_ARGS ) +{ + return DRM_ERR(EINVAL); +} +int DRM(sg_free)( DRM_IOCTL_ARGS ) +{ + return DRM_ERR(EINVAL); +} + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h Wed Oct 30 07:52:25 2002 @@ -1,5 +1,11 @@ -SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics"); +/* + * $FreeBSD: src/sys/dev/drm/drm_sysctl.h,v 1.1 2002/04/27 20:47:57 anholt Exp $ + */ +#ifdef __FreeBSD__ + +#include <sys/sysctl.h> + static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS; static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS; static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS; @@ -32,8 +38,7 @@ #define DRM_SYSCTL_ENTRIES (sizeof(DRM(sysctl_list))/sizeof(DRM(sysctl_list)[0])) struct drm_sysctl_info { - struct sysctl_oid oids[DRM_SYSCTL_ENTRIES + 1]; - struct sysctl_oid_list list; + struct sysctl_ctx_list ctx; char name[2]; }; @@ -41,65 +46,62 @@ { struct drm_sysctl_info *info; struct sysctl_oid *oid; - struct sysctl_oid *top; + struct sysctl_oid *top, *drioid; int i; - /* Find the next free slot under hw.graphics */ + info = DRM(alloc)(sizeof *info, DRM_MEM_DRIVER); + if ( !info ) + return 1; + bzero(info, sizeof *info); + dev->sysctl = info; + + /* Add the sysctl node for DRI if it doesn't already exist */ + drioid = SYSCTL_ADD_NODE( &info->ctx, &sysctl__hw_children, OID_AUTO, "dri", CTLFLAG_RW, NULL, "DRI Graphics"); + if (!drioid) + return 1; + + /* Find the next free slot under hw.dri */ i = 0; - SLIST_FOREACH(oid, &sysctl__hw_dri_children, oid_link) { + SLIST_FOREACH(oid, SYSCTL_CHILDREN(drioid), oid_link) { if (i <= oid->oid_arg2) i = oid->oid_arg2 + 1; } + if (i>9) + return 1; - info = DRM(alloc)(sizeof *info, DRM_MEM_DRIVER); - dev->sysctl = info; - - /* Construct the node under hw.graphics */ + /* Add the hw.dri.x for our device */ info->name[0] = '0' + i; info->name[1] = 0; - oid = &info->oids[DRM_SYSCTL_ENTRIES]; - bzero(oid, sizeof(*oid)); - oid->oid_parent = &sysctl__hw_dri_children; - oid->oid_number = OID_AUTO; - oid->oid_kind = CTLTYPE_NODE | CTLFLAG_RW; - oid->oid_arg1 = &info->list; - oid->oid_arg2 = i; - oid->oid_name = info->name; - oid->oid_handler = 0; - oid->oid_fmt = "N"; - SLIST_INIT(&info->list); - sysctl_register_oid(oid); - top = oid; - + top = SYSCTL_ADD_NODE( &info->ctx, SYSCTL_CHILDREN(drioid), OID_AUTO, info->name, CTLFLAG_RW, NULL, NULL); + if (!top) + return 1; + for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) { - oid = &info->oids[i]; - bzero(oid, sizeof(*oid)); - oid->oid_parent = top->oid_arg1; - oid->oid_number = OID_AUTO; - oid->oid_kind = CTLTYPE_INT | CTLFLAG_RD; - oid->oid_arg1 = dev; - oid->oid_arg2 = 0; - oid->oid_name = DRM(sysctl_list)[i].name; - oid->oid_handler = DRM(sysctl_list[)i].f; - oid->oid_fmt = "A"; - sysctl_register_oid(oid); + oid = sysctl_add_oid( &info->ctx, + SYSCTL_CHILDREN(top), + OID_AUTO, + DRM(sysctl_list)[i].name, + CTLTYPE_INT | CTLFLAG_RD, + dev, + 0, + DRM(sysctl_list)[i].f, + "A", + NULL); + if (!oid) + return 1; } - return 0; } int DRM(sysctl_cleanup)(drm_device_t *dev) { - int i; - - DRM_DEBUG("dev->sysctl=%p\n", dev->sysctl); - for (i = 0; i < DRM_SYSCTL_ENTRIES + 1; i++) - sysctl_unregister_oid(&dev->sysctl->oids[i]); + int error; + error = sysctl_ctx_free( &dev->sysctl->ctx ); DRM(free)(dev->sysctl, sizeof *dev->sysctl, DRM_MEM_DRIVER); dev->sysctl = NULL; - return 0; + return error; } static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS @@ -166,9 +168,9 @@ drm_device_t *dev = arg1; int ret; - DRM_OS_LOCK; + DRM_LOCK; ret = DRM(_vm_info)(oidp, arg1, arg2, req); - DRM_OS_UNLOCK; + DRM_UNLOCK; return ret; } @@ -189,8 +191,8 @@ q = dev->queuelist[i]; atomic_inc(&q->use_count); DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count), - "%5d/0x%03x %5ld %5ld" - " %5ld/%c%c/%c%c%c %5d %10ld %10ld %10ld\n", + "%5d/0x%03x %5d %5d" + " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n", i, q->flags, atomic_read(&q->use_count), @@ -217,9 +219,9 @@ drm_device_t *dev = arg1; int ret; - DRM_OS_LOCK; + DRM_LOCK; ret = DRM(_queues_info)(oidp, arg1, arg2, req); - DRM_OS_UNLOCK; + DRM_UNLOCK; return ret; } @@ -238,7 +240,7 @@ DRM_SYSCTL_PRINT(" o size count free segs pages kB\n\n"); for (i = 0; i <= DRM_MAX_ORDER; i++) { if (dma->bufs[i].buf_count) - DRM_SYSCTL_PRINT("%2d %8d %5d %5ld %5d %5d %5d\n", + DRM_SYSCTL_PRINT("%2d %8d %5d %5d %5d %5d %5d\n", i, dma->bufs[i].buf_size, dma->bufs[i].buf_count, @@ -267,9 +269,9 @@ drm_device_t *dev = arg1; int ret; - DRM_OS_LOCK; + DRM_LOCK; ret = DRM(_bufs_info)(oidp, arg1, arg2, req); - DRM_OS_UNLOCK; + DRM_UNLOCK; return ret; } @@ -301,9 +303,9 @@ drm_device_t *dev = arg1; int ret; - DRM_OS_LOCK; + DRM_LOCK; ret = DRM(_clients_info)(oidp, arg1, arg2, req); - DRM_OS_UNLOCK; + DRM_UNLOCK; return ret; } @@ -386,9 +388,9 @@ drm_device_t *dev = arg1; int ret; - DRM_OS_LOCK; + DRM_LOCK; ret = DRM(_vma_info)(oidp, arg1, arg2, req); - DRM_OS_UNLOCK; + DRM_UNLOCK; return ret; } #endif @@ -515,9 +517,22 @@ drm_device_t *dev = arg1; int ret; - DRM_OS_LOCK; + DRM_LOCK; ret = _drm_histo_info(oidp, arg1, arg2, req); - DRM_OS_UNLOCK; + DRM_UNLOCK; return ret; +} +#endif + +#elif defined(__NetBSD__) +/* stub it out for now, sysctl is only for debugging */ +int DRM(sysctl_init)(drm_device_t *dev) +{ + return 0; +} + +int DRM(sysctl_cleanup)(drm_device_t *dev) +{ + return 0; } #endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h:1.1 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h Wed Oct 30 07:52:25 2002 @@ -1,9 +1,11 @@ -#include <vm/vm.h> -#include <vm/pmap.h> +#ifdef __FreeBSD__ static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) +#elif defined(__NetBSD__) +static paddr_t DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) +#endif { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; unsigned long physical; unsigned long page; @@ -14,27 +16,30 @@ page = offset >> PAGE_SHIFT; physical = dma->pagelist[page]; - DRM_DEBUG("0x%08x (page %lu) => 0x%08lx\n", offset, page, physical); + DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", (long)offset, page, physical); return atop(physical); } +#ifdef __FreeBSD__ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) +#elif defined(__NetBSD__) +paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot) +#endif { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_map_t *map = NULL; drm_map_list_entry_t *listentry=NULL; - /*drm_file_t *priv;*/ + drm_file_t *priv; /* DRM_DEBUG("offset = 0x%x\n", offset);*/ - /*XXX Fixme */ - /*priv = DRM(find_file_by_proc)(dev, p); + priv = DRM(find_file_by_proc)(dev, DRM_CURPROC); if (!priv) { DRM_DEBUG("can't find authenticator\n"); return EINVAL; } - if (!priv->authenticated) DRM_OS_RETURN(EACCES);*/ + if (!priv->authenticated) return DRM_ERR(EACCES); if (dev->dma && offset >= 0 @@ -59,7 +64,7 @@ DRM_DEBUG("can't find map\n"); return -1; } - if (((map->flags&_DRM_RESTRICTED) && suser(curproc))) { + if (((map->flags&_DRM_RESTRICTED) && DRM_SUSER(DRM_CURPROC))) { DRM_DEBUG("restricted map\n"); return -1; } @@ -69,6 +74,7 @@ case _DRM_REGISTERS: case _DRM_AGP: return atop(offset); + case _DRM_SCATTER_GATHER: case _DRM_SHM: return atop(vtophys(offset)); default: Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h:1.3 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h Thu Feb 27 12:32:22 2003 @@ -1,201 +0,0 @@ -#ifndef _I810_DRM_H_ -#define _I810_DRM_H_ - -/* WARNING: These defines must be the same as what the Xserver uses. - * if you change them, you must change the defines in the Xserver. - */ - -#ifndef _I810_DEFINES_ -#define _I810_DEFINES_ - -#define I810_DMA_BUF_ORDER 12 -#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) -#define I810_DMA_BUF_NR 256 -#define I810_NR_SAREA_CLIPRECTS 8 - -/* Each region is a minimum of 64k, and there are at most 64 of them. - */ -#define I810_NR_TEX_REGIONS 64 -#define I810_LOG_MIN_TEX_REGION_SIZE 16 -#endif - -#define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ -#define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ -#define I810_UPLOAD_CTX 0x4 -#define I810_UPLOAD_BUFFERS 0x8 -#define I810_UPLOAD_TEX0 0x10 -#define I810_UPLOAD_TEX1 0x20 -#define I810_UPLOAD_CLIPRECTS 0x40 - - -/* Indices into buf.Setup where various bits of state are mirrored per - * context and per buffer. These can be fired at the card as a unit, - * or in a piecewise fashion as required. - */ - -/* Destbuffer state - * - backbuffer linear offset and pitch -- invarient in the current dri - * - zbuffer linear offset and pitch -- also invarient - * - drawing origin in back and depth buffers. - * - * Keep the depth/back buffer state here to acommodate private buffers - * in the future. - */ -#define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ -#define I810_DESTREG_DI1 1 -#define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ -#define I810_DESTREG_DV1 3 -#define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ -#define I810_DESTREG_DR1 5 -#define I810_DESTREG_DR2 6 -#define I810_DESTREG_DR3 7 -#define I810_DESTREG_DR4 8 -#define I810_DEST_SETUP_SIZE 10 - -/* Context state - */ -#define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ -#define I810_CTXREG_CF1 1 -#define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ -#define I810_CTXREG_ST1 3 -#define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ -#define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ -#define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ -#define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ -#define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ -#define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ -#define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ -#define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ -#define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ -#define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ -#define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ -#define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ -#define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ -#define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ -#define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ -#define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ -#define I810_CTX_SETUP_SIZE 20 - -/* Texture state (per tex unit) - */ -#define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ -#define I810_TEXREG_MI1 1 -#define I810_TEXREG_MI2 2 -#define I810_TEXREG_MI3 3 -#define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ -#define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ -#define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ -#define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ -#define I810_TEX_SETUP_SIZE 8 - -#define I810_FRONT 0x1 -#define I810_BACK 0x2 -#define I810_DEPTH 0x4 - - -typedef struct _drm_i810_init { - enum { - I810_INIT_DMA = 0x01, - I810_CLEANUP_DMA = 0x02 - } func; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int ring_map_idx; - int buffer_map_idx; -#else - unsigned int mmio_offset; - unsigned int buffers_offset; -#endif - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int overlay_offset; - unsigned int overlay_physical; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; -} drm_i810_init_t; - -/* Warning: If you change the SAREA structure you must change the Xserver - * structure as well */ - -typedef struct _drm_i810_tex_region { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ -} drm_i810_tex_region_t; - -typedef struct _drm_i810_sarea { - unsigned int ContextState[I810_CTX_SETUP_SIZE]; - unsigned int BufferState[I810_DEST_SETUP_SIZE]; - unsigned int TexState[2][I810_TEX_SETUP_SIZE]; - unsigned int dirty; - - unsigned int nbox; - drm_clip_rect_t boxes[I810_NR_SAREA_CLIPRECTS]; - - /* Maintain an LRU of contiguous regions of texture space. If - * you think you own a region of texture memory, and it has an - * age different to the one you set, then you are mistaken and - * it has been stolen by another client. If global texAge - * hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained - * texture information of other clients - by maintaining them - * in the same lru which is used to age their own textures, - * clients have an approximate lru for the whole of global - * texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to - * kick out your own texture or someone else's - simply eject - * them all in LRU order. - */ - - drm_i810_tex_region_t texList[I810_NR_TEX_REGIONS+1]; - /* Last elt is sentinal */ - int texAge; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - int ctxOwner; /* last context to upload state */ - - int vertex_prim; - -} drm_i810_sarea_t; - -typedef struct _drm_i810_clear { - int clear_color; - int clear_depth; - int flags; -} drm_i810_clear_t; - - - -/* These may be placeholders if we have more cliprects than - * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to - * false, indicating that the buffer will be dispatched again with a - * new set of cliprects. - */ -typedef struct _drm_i810_vertex { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - int discard; /* client is finished with the buffer? */ -} drm_i810_vertex_t; - -typedef struct _drm_i810_copy_t { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - void *address; /* Address to copy from */ -} drm_i810_copy_t; - -typedef struct drm_i810_dma { - void *virtual; - int request_idx; - int request_size; - int granted; -} drm_i810_dma_t; - -#endif /* _I810_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h:1.1 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h Thu Feb 27 12:32:22 2003 @@ -1,238 +0,0 @@ -#ifndef _I830_DRM_H_ -#define _I830_DRM_H_ - -/* WARNING: These defines must be the same as what the Xserver uses. - * if you change them, you must change the defines in the Xserver. - */ - -#ifndef _I830_DEFINES_ -#define _I830_DEFINES_ - -#define I830_DMA_BUF_ORDER 12 -#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) -#define I830_DMA_BUF_NR 256 -#define I830_NR_SAREA_CLIPRECTS 8 - -/* Each region is a minimum of 64k, and there are at most 64 of them. - */ -#define I830_NR_TEX_REGIONS 64 -#define I830_LOG_MIN_TEX_REGION_SIZE 16 - -/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ -#if !defined(I830_ENABLE_4_TEXTURES) -#define I830_TEXTURE_COUNT 2 -#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ -#else /* defined(I830_ENABLE_4_TEXTURES) */ -#define I830_TEXTURE_COUNT 4 -#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ -#endif /* I830_ENABLE_4_TEXTURES */ - -#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ - -#define I830_UPLOAD_CTX 0x1 -#define I830_UPLOAD_BUFFERS 0x2 -#define I830_UPLOAD_CLIPRECTS 0x4 -#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ -#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ -#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ -#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ -#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ -#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ -#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ -#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ -#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) -#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) -#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 -#define I830_UPLOAD_TEX0 0x10000 -#define I830_UPLOAD_TEX1 0x20000 -#define I830_UPLOAD_TEX2 0x40000 -#define I830_UPLOAD_TEX3 0x80000 -#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) -#define I830_UPLOAD_TEX_MASK 0xf0000 -#define I830_UPLOAD_TEXBLEND0 0x100000 -#define I830_UPLOAD_TEXBLEND1 0x200000 -#define I830_UPLOAD_TEXBLEND2 0x400000 -#define I830_UPLOAD_TEXBLEND3 0x800000 -#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) -#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 -#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) -#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 - -/* Indices into buf.Setup where various bits of state are mirrored per - * context and per buffer. These can be fired at the card as a unit, - * or in a piecewise fashion as required. - */ - -/* Destbuffer state - * - backbuffer linear offset and pitch -- invarient in the current dri - * - zbuffer linear offset and pitch -- also invarient - * - drawing origin in back and depth buffers. - * - * Keep the depth/back buffer state here to acommodate private buffers - * in the future. - */ - -#define I830_DESTREG_CBUFADDR 0 -/* Invarient */ -#define I830_DESTREG_DBUFADDR 1 -#define I830_DESTREG_DV0 2 -#define I830_DESTREG_DV1 3 -#define I830_DESTREG_SENABLE 4 -#define I830_DESTREG_SR0 5 -#define I830_DESTREG_SR1 6 -#define I830_DESTREG_SR2 7 -#define I830_DESTREG_DR0 8 -#define I830_DESTREG_DR1 9 -#define I830_DESTREG_DR2 10 -#define I830_DESTREG_DR3 11 -#define I830_DESTREG_DR4 12 -#define I830_DEST_SETUP_SIZE 13 - -/* Context state - */ -#define I830_CTXREG_STATE1 0 -#define I830_CTXREG_STATE2 1 -#define I830_CTXREG_STATE3 2 -#define I830_CTXREG_STATE4 3 -#define I830_CTXREG_STATE5 4 -#define I830_CTXREG_IALPHAB 5 -#define I830_CTXREG_STENCILTST 6 -#define I830_CTXREG_ENABLES_1 7 -#define I830_CTXREG_ENABLES_2 8 -#define I830_CTXREG_AA 9 -#define I830_CTXREG_FOGCOLOR 10 -#define I830_CTXREG_BLENDCOLR0 11 -#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ -#define I830_CTXREG_VF 13 -#define I830_CTXREG_VF2 14 -#define I830_CTXREG_MCSB0 15 -#define I830_CTXREG_MCSB1 16 -#define I830_CTX_SETUP_SIZE 17 - -/* Texture state (per tex unit) - */ - -#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ -#define I830_TEXREG_MI1 1 -#define I830_TEXREG_MI2 2 -#define I830_TEXREG_MI3 3 -#define I830_TEXREG_MI4 4 -#define I830_TEXREG_MI5 5 -#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ -#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ -#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ -#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ -#define I830_TEX_SETUP_SIZE 10 - -#define I830_FRONT 0x1 -#define I830_BACK 0x2 -#define I830_DEPTH 0x4 - -#endif /* _I830_DEFINES_ */ - -typedef struct _drm_i830_init { - enum { - I830_INIT_DMA = 0x01, - I830_CLEANUP_DMA = 0x02 - } func; - unsigned int mmio_offset; - unsigned int buffers_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; - unsigned int back_pitch; - unsigned int depth_pitch; - unsigned int cpp; -} drm_i830_init_t; - -/* Warning: If you change the SAREA structure you must change the Xserver - * structure as well */ - -typedef struct _drm_i830_tex_region { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ -} drm_i830_tex_region_t; - -typedef struct _drm_i830_sarea { - unsigned int ContextState[I830_CTX_SETUP_SIZE]; - unsigned int BufferState[I830_DEST_SETUP_SIZE]; - unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; - unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; - unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; - unsigned int Palette[2][256]; - unsigned int dirty; - - unsigned int nbox; - drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS]; - - /* Maintain an LRU of contiguous regions of texture space. If - * you think you own a region of texture memory, and it has an - * age different to the one you set, then you are mistaken and - * it has been stolen by another client. If global texAge - * hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained - * texture information of other clients - by maintaining them - * in the same lru which is used to age their own textures, - * clients have an approximate lru for the whole of global - * texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to - * kick out your own texture or someone else's - simply eject - * them all in LRU order. - */ - - drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS+1]; - /* Last elt is sentinal */ - int texAge; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - int ctxOwner; /* last context to upload state */ - - int vertex_prim; -} drm_i830_sarea_t; - -typedef struct _drm_i830_clear { - int clear_color; - int clear_depth; - int flags; - unsigned int clear_colormask; - unsigned int clear_depthmask; -} drm_i830_clear_t; - - - -/* These may be placeholders if we have more cliprects than - * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to - * false, indicating that the buffer will be dispatched again with a - * new set of cliprects. - */ -typedef struct _drm_i830_vertex { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - int discard; /* client is finished with the buffer? */ -} drm_i830_vertex_t; - -typedef struct _drm_i830_copy_t { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - void *address; /* Address to copy from */ -} drm_i830_copy_t; - -typedef struct drm_i830_dma { - void *virtual; - int request_idx; - int request_size; - int granted; -} drm_i830_dma_t; - -#endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h:1.3 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h Thu Feb 27 12:32:22 2003 @@ -1,310 +0,0 @@ -/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- - * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - * Rewritten by: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __MGA_DRM_H__ -#define __MGA_DRM_H__ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (mga_sarea.h) - */ -#ifndef __MGA_SAREA_DEFINES__ -#define __MGA_SAREA_DEFINES__ - -/* WARP pipe flags - */ -#define MGA_F 0x1 /* fog */ -#define MGA_A 0x2 /* alpha */ -#define MGA_S 0x4 /* specular */ -#define MGA_T2 0x8 /* multitexture */ - -#define MGA_WARP_TGZ 0 -#define MGA_WARP_TGZF (MGA_F) -#define MGA_WARP_TGZA (MGA_A) -#define MGA_WARP_TGZAF (MGA_F|MGA_A) -#define MGA_WARP_TGZS (MGA_S) -#define MGA_WARP_TGZSF (MGA_S|MGA_F) -#define MGA_WARP_TGZSA (MGA_S|MGA_A) -#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) -#define MGA_WARP_T2GZ (MGA_T2) -#define MGA_WARP_T2GZF (MGA_T2|MGA_F) -#define MGA_WARP_T2GZA (MGA_T2|MGA_A) -#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) -#define MGA_WARP_T2GZS (MGA_T2|MGA_S) -#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) -#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) -#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) - -#define MGA_MAX_G200_PIPES 8 /* no multitex */ -#define MGA_MAX_G400_PIPES 16 -#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES -#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ - -#define MGA_CARD_TYPE_G200 1 -#define MGA_CARD_TYPE_G400 2 - - -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - -/* What needs to be changed for the current vertex dma buffer? - */ -#define MGA_UPLOAD_CONTEXT 0x1 -#define MGA_UPLOAD_TEX0 0x2 -#define MGA_UPLOAD_TEX1 0x4 -#define MGA_UPLOAD_PIPE 0x8 -#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ -#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ -#define MGA_UPLOAD_2D 0x40 -#define MGA_WAIT_AGE 0x80 /* handled client-side */ -#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ -#if 0 -#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock - quiescent */ -#endif - -/* 32 buffers of 64k each, total 2 meg. - */ -#define MGA_BUFFER_SIZE (1 << 16) -#define MGA_NUM_BUFFERS 128 - -/* Keep these small for testing. - */ -#define MGA_NR_SAREA_CLIPRECTS 8 - -/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 - * regions, subject to a minimum region size of (1<<16) == 64k. - * - * Clients may subdivide regions internally, but when sharing between - * clients, the region size is the minimum granularity. - */ - -#define MGA_CARD_HEAP 0 -#define MGA_AGP_HEAP 1 -#define MGA_NR_TEX_HEAPS 2 -#define MGA_NR_TEX_REGIONS 16 -#define MGA_LOG_MIN_TEX_REGION_SIZE 16 - -#endif /* __MGA_SAREA_DEFINES__ */ - - -/* Setup registers for 3D context - */ -typedef struct { - unsigned int dstorg; - unsigned int maccess; - unsigned int plnwt; - unsigned int dwgctl; - unsigned int alphactrl; - unsigned int fogcolor; - unsigned int wflag; - unsigned int tdualstage0; - unsigned int tdualstage1; - unsigned int fcol; - unsigned int stencil; - unsigned int stencilctl; -} drm_mga_context_regs_t; - -/* Setup registers for 2D, X server - */ -typedef struct { - unsigned int pitch; -} drm_mga_server_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int texctl; - unsigned int texctl2; - unsigned int texfilter; - unsigned int texbordercol; - unsigned int texorg; - unsigned int texwidth; - unsigned int texheight; - unsigned int texorg1; - unsigned int texorg2; - unsigned int texorg3; - unsigned int texorg4; -} drm_mga_texture_regs_t; - -/* General aging mechanism - */ -typedef struct { - unsigned int head; /* Position of head pointer */ - unsigned int wrap; /* Primary DMA wrap count */ -} drm_mga_age_t; - -typedef struct _drm_mga_sarea { - /* The channel for communication of state information to the kernel - * on firing a vertex dma buffer. - */ - drm_mga_context_regs_t context_state; - drm_mga_server_regs_t server_state; - drm_mga_texture_regs_t tex_state[2]; - unsigned int warp_pipe; - unsigned int dirty; - unsigned int vertsize; - - /* The current cliprects, or a subset thereof. - */ - drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Information about the most recently used 3d drawable. The - * client fills in the req_* fields, the server fills in the - * exported_ fields and puts the cliprects into boxes, above. - * - * The client clears the exported_drawable field before - * clobbering the boxes data. - */ - unsigned int req_drawable; /* the X drawable id */ - unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ - - unsigned int exported_drawable; - unsigned int exported_index; - unsigned int exported_stamp; - unsigned int exported_buffers; - unsigned int exported_nfront; - unsigned int exported_nback; - int exported_back_x, exported_front_x, exported_w; - int exported_back_y, exported_front_y, exported_h; - drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS]; - - /* Counters for aging textures and for client-side throttling. - */ - unsigned int status[4]; - unsigned int last_wrap; - - drm_mga_age_t last_frame; - unsigned int last_enqueue; /* last time a buffer was enqueued */ - unsigned int last_dispatch; /* age of the most recently dispatched buffer */ - unsigned int last_quiescent; /* */ - - /* LRU lists for texture memory in agp space and on the card. - */ - drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; - unsigned int texAge[MGA_NR_TEX_HEAPS]; - - /* Mechanism to validate card state. - */ - int ctxOwner; -} drm_mga_sarea_t; - - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmMga.h) - */ -typedef struct _drm_mga_warp_index { - int installed; - unsigned long phys_addr; - int size; -} drm_mga_warp_index_t; - -typedef struct drm_mga_init { - enum { - MGA_INIT_DMA = 0x01, - MGA_CLEANUP_DMA = 0x02 - } func; - - unsigned long sarea_priv_offset; - - int chipset; - int sgram; - - unsigned int maccess; - - unsigned int fb_cpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - - unsigned int depth_cpp; - unsigned int depth_offset, depth_pitch; - - unsigned int texture_offset[MGA_NR_TEX_HEAPS]; - unsigned int texture_size[MGA_NR_TEX_HEAPS]; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long status_offset; - unsigned long warp_offset; - unsigned long primary_offset; - unsigned long buffers_offset; -} drm_mga_init_t; - -typedef struct drm_mga_fullscreen { - enum { - MGA_INIT_FULLSCREEN = 0x01, - MGA_CLEANUP_FULLSCREEN = 0x02 - } func; -} drm_mga_fullscreen_t; - -typedef struct drm_mga_clear { - unsigned int flags; - unsigned int clear_color; - unsigned int clear_depth; - unsigned int color_mask; - unsigned int depth_mask; -} drm_mga_clear_t; - -typedef struct drm_mga_vertex { - int idx; /* buffer to queue */ - int used; /* bytes in use */ - int discard; /* client finished with buffer? */ -} drm_mga_vertex_t; - -typedef struct drm_mga_indices { - int idx; /* buffer to queue */ - unsigned int start; - unsigned int end; - int discard; /* client finished with buffer? */ -} drm_mga_indices_t; - -typedef struct drm_mga_iload { - int idx; - unsigned int dstorg; - unsigned int length; -} drm_mga_iload_t; - -typedef struct _drm_mga_blit { - unsigned int planemask; - unsigned int srcorg; - unsigned int dstorg; - int src_pitch, dst_pitch; - int delta_sx, delta_sy; - int delta_dx, delta_dy; - int height, ydir; /* flip image vertically */ - int source_pitch, dest_pitch; -} drm_mga_blit_t; - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drv.c:1.1 --- /dev/null Thu Feb 27 12:32:22 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drv.c Wed Oct 30 07:52:26 2002 @@ -0,0 +1,66 @@ +/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*- + * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#include <sys/types.h> + +#include "mga.h" +#include "drmP.h" +#include "drm.h" +#include "mga_drm.h" +#include "mga_drv.h" + +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x102b, 0x0520, 0, "Matrox G200 (PCI)"}, + {0x102b, 0x0521, 1, "Matrox G200 (AGP)"}, + {0x102b, 0x0525, 1, "Matrox G400/G450 (AGP)"}, + {0x102b, 0x2527, 1, "Matrox G550 (AGP)"}, + {0, 0, 0, NULL} +}; + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_vm.h" +#include "drm_sysctl.h" + +DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h:1.3 Wed Dec 12 19:24:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h Thu Feb 27 12:32:22 2003 @@ -1,287 +0,0 @@ -/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- - * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - */ - -#ifndef __R128_DRM_H__ -#define __R128_DRM_H__ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the X server file (r128_sarea.h) - */ -#ifndef __R128_SAREA_DEFINES__ -#define __R128_SAREA_DEFINES__ - -/* What needs to be changed for the current vertex buffer? - */ -#define R128_UPLOAD_CONTEXT 0x001 -#define R128_UPLOAD_SETUP 0x002 -#define R128_UPLOAD_TEX0 0x004 -#define R128_UPLOAD_TEX1 0x008 -#define R128_UPLOAD_TEX0IMAGES 0x010 -#define R128_UPLOAD_TEX1IMAGES 0x020 -#define R128_UPLOAD_CORE 0x040 -#define R128_UPLOAD_MASKS 0x080 -#define R128_UPLOAD_WINDOW 0x100 -#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ -#define R128_REQUIRE_QUIESCENCE 0x400 -#define R128_UPLOAD_ALL 0x7ff - -#define R128_FRONT 0x1 -#define R128_BACK 0x2 -#define R128_DEPTH 0x4 - -/* Primitive types - */ -#define R128_POINTS 0x1 -#define R128_LINES 0x2 -#define R128_LINE_STRIP 0x3 -#define R128_TRIANGLES 0x4 -#define R128_TRIANGLE_FAN 0x5 -#define R128_TRIANGLE_STRIP 0x6 - -/* Vertex/indirect buffer size - */ -#define R128_BUFFER_SIZE 16384 - -/* Byte offsets for indirect buffer data - */ -#define R128_INDEX_PRIM_OFFSET 20 -#define R128_HOSTDATA_BLIT_OFFSET 32 - -/* Keep these small for testing. - */ -#define R128_NR_SAREA_CLIPRECTS 12 - -/* There are 2 heaps (local/AGP). Each region within a heap is a - * minimum of 64k, and there are at most 64 of them per heap. - */ -#define R128_LOCAL_TEX_HEAP 0 -#define R128_AGP_TEX_HEAP 1 -#define R128_NR_TEX_HEAPS 2 -#define R128_NR_TEX_REGIONS 64 -#define R128_LOG_TEX_GRANULARITY 16 - -#define R128_NR_CONTEXT_REGS 12 - -#define R128_MAX_TEXTURE_LEVELS 11 -#define R128_MAX_TEXTURE_UNITS 2 - -#endif /* __R128_SAREA_DEFINES__ */ - -typedef struct { - /* Context state - can be written in one large chunk */ - unsigned int dst_pitch_offset_c; - unsigned int dp_gui_master_cntl_c; - unsigned int sc_top_left_c; - unsigned int sc_bottom_right_c; - unsigned int z_offset_c; - unsigned int z_pitch_c; - unsigned int z_sten_cntl_c; - unsigned int tex_cntl_c; - unsigned int misc_3d_state_cntl_reg; - unsigned int texture_clr_cmp_clr_c; - unsigned int texture_clr_cmp_msk_c; - unsigned int fog_color_c; - - /* Texture state */ - unsigned int tex_size_pitch_c; - unsigned int constant_color_c; - - /* Setup state */ - unsigned int pm4_vc_fpu_setup; - unsigned int setup_cntl; - - /* Mask state */ - unsigned int dp_write_mask; - unsigned int sten_ref_mask_c; - unsigned int plane_3d_mask_c; - - /* Window state */ - unsigned int window_xy_offset; - - /* Core state */ - unsigned int scale_3d_cntl; -} drm_r128_context_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int tex_cntl; - unsigned int tex_combine_cntl; - unsigned int tex_size_pitch; - unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; - unsigned int tex_border_color; -} drm_r128_texture_regs_t; - - -typedef struct drm_r128_sarea { - /* The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ - drm_r128_context_regs_t context_state; - drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; - - /* The current cliprects, or a subset thereof. - */ - drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Counters for client-side throttling of rendering clients. - */ - unsigned int last_frame; - unsigned int last_dispatch; - - drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; - int tex_age[R128_NR_TEX_HEAPS]; - int ctx_owner; -} drm_r128_sarea_t; - - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmR128.h) - */ -typedef struct drm_r128_init { - enum { - R128_INIT_CCE = 0x01, - R128_CLEANUP_CCE = 0x02 - } func; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int sarea_priv_offset; -#else - unsigned long sarea_priv_offset; -#endif - int is_pci; - int cce_mode; - int cce_secure; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - unsigned int span_offset; - -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; -#else - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -#endif -} drm_r128_init_t; - -typedef struct drm_r128_cce_stop { - int flush; - int idle; -} drm_r128_cce_stop_t; - -typedef struct drm_r128_clear { - unsigned int flags; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int x, y, w, h; -#endif - unsigned int clear_color; - unsigned int clear_depth; -#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) - unsigned int color_mask; - unsigned int depth_mask; -#endif -} drm_r128_clear_t; - -typedef struct drm_r128_vertex { - int prim; - int idx; /* Index of vertex buffer */ - int count; /* Number of vertices in buffer */ - int discard; /* Client finished with buffer? */ -} drm_r128_vertex_t; - -typedef struct drm_r128_indices { - int prim; - int idx; - int start; - int end; - int discard; /* Client finished with buffer? */ -} drm_r128_indices_t; - -typedef struct drm_r128_blit { - int idx; - int pitch; - int offset; - int format; - unsigned short x, y; - unsigned short width, height; -} drm_r128_blit_t; - -typedef struct drm_r128_depth { - enum { - R128_WRITE_SPAN = 0x01, - R128_WRITE_PIXELS = 0x02, - R128_READ_SPAN = 0x03, - R128_READ_PIXELS = 0x04 - } func; - int n; - int *x; - int *y; - unsigned int *buffer; - unsigned char *mask; -} drm_r128_depth_t; - -typedef struct drm_r128_stipple { - unsigned int *mask; -} drm_r128_stipple_t; - -typedef struct drm_r128_indirect { - int idx; - int start; - int end; - int discard; -} drm_r128_indirect_t; - -typedef struct drm_r128_fullscreen { - enum { - R128_INIT_FULLSCREEN = 0x01, - R128_CLEANUP_FULLSCREEN = 0x02 - } func; -} drm_r128_fullscreen_t; - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drv.c:1.1 --- /dev/null Thu Feb 27 12:32:22 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drv.c Wed Oct 30 07:52:26 2002 @@ -0,0 +1,86 @@ +/* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- + * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + + +#include <sys/types.h> + +#include "r128.h" +#include "drmP.h" +#include "drm.h" +#include "r128_drm.h" +#include "r128_drv.h" +#if __REALLY_HAVE_SG +#include "ati_pcigart.h" +#endif + +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to eta@lclark.edu inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x1002, 0x4c45, __REALLY_HAVE_SG, "ATI Rage 128 Mobility LE (PCI)"}, + {0x1002, 0x4c46, 1, "ATI Rage 128 Mobility LF (AGP)"}, + {0x1002, 0x4d46, 1, "ATI Rage 128 Mobility MF (AGP)"}, + {0x1002, 0x4d4c, 1, "ATI Rage 128 Mobility ML (AGP)"}, + {0x1002, 0x5044, __REALLY_HAVE_SG, "ATI Rage 128 Pro PD (PCI)"}, + {0x1002, 0x5046, 1, "ATI Rage 128 Pro PF (AGP)"}, + {0x1002, 0x5050, __REALLY_HAVE_SG, "ATI Rage 128 Pro PP (PCI)"}, + {0x1002, 0x5052, __REALLY_HAVE_SG, "ATI Rage 128 Pro PR (PCI)"}, + {0x1002, 0x5245, __REALLY_HAVE_SG, "ATI Rage 128 RE (PCI)"}, + {0x1002, 0x5246, 1, "ATI Rage 128 RF (AGP)"}, + {0x1002, 0x5247, 1, "ATI Rage 128 RG (AGP)"}, + {0x1002, 0x524b, __REALLY_HAVE_SG, "ATI Rage 128 RK (PCI)"}, + {0x1002, 0x524c, 1, "ATI Rage 128 RL (AGP)"}, + {0x1002, 0x534d, 1, "ATI Rage 128 SM (AGP)"}, + {0x1002, 0x5446, 1, "ATI Rage 128 Pro Ultra TF (AGP)"}, + {0x1002, 0x544C, 1, "ATI Rage 128 Pro Ultra TL (AGP)"}, + {0x1002, 0x5452, 1, "ATI Rage 128 Pro Ultra TR (AGP)"}, + {0, 0, 0, NULL} +}; + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_sysctl.h" +#include "drm_vm.h" +#if __HAVE_SG +#include "drm_scatter.h" +#endif + +DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h:1.1 Wed Dec 12 19:24:47 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h Thu Feb 27 12:32:22 2003 @@ -1,333 +0,0 @@ -/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __RADEON_DRM_H__ -#define __RADEON_DRM_H__ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the X server file (radeon_sarea.h) - */ -#ifndef __RADEON_SAREA_DEFINES__ -#define __RADEON_SAREA_DEFINES__ - -/* What needs to be changed for the current vertex buffer? - */ -#define RADEON_UPLOAD_CONTEXT 0x00000001 -#define RADEON_UPLOAD_VERTFMT 0x00000002 -#define RADEON_UPLOAD_LINE 0x00000004 -#define RADEON_UPLOAD_BUMPMAP 0x00000008 -#define RADEON_UPLOAD_MASKS 0x00000010 -#define RADEON_UPLOAD_VIEWPORT 0x00000020 -#define RADEON_UPLOAD_SETUP 0x00000040 -#define RADEON_UPLOAD_TCL 0x00000080 -#define RADEON_UPLOAD_MISC 0x00000100 -#define RADEON_UPLOAD_TEX0 0x00000200 -#define RADEON_UPLOAD_TEX1 0x00000400 -#define RADEON_UPLOAD_TEX2 0x00000800 -#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 -#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 -#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 -#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ -#define RADEON_REQUIRE_QUIESCENCE 0x00010000 -#define RADEON_UPLOAD_ALL 0x0001ffff - -#define RADEON_FRONT 0x1 -#define RADEON_BACK 0x2 -#define RADEON_DEPTH 0x4 - -/* Primitive types - */ -#define RADEON_POINTS 0x1 -#define RADEON_LINES 0x2 -#define RADEON_LINE_STRIP 0x3 -#define RADEON_TRIANGLES 0x4 -#define RADEON_TRIANGLE_FAN 0x5 -#define RADEON_TRIANGLE_STRIP 0x6 - -/* Vertex/indirect buffer size - */ -#define RADEON_BUFFER_SIZE 65536 - -/* Byte offsets for indirect buffer data - */ -#define RADEON_INDEX_PRIM_OFFSET 20 -#define RADEON_HOSTDATA_BLIT_OFFSET 32 - -#define RADEON_SCRATCH_REG_OFFSET 32 - -/* Keep these small for testing - */ -#define RADEON_NR_SAREA_CLIPRECTS 12 - -/* There are 2 heaps (local/AGP). Each region within a heap is a - * minimum of 64k, and there are at most 64 of them per heap. - */ -#define RADEON_LOCAL_TEX_HEAP 0 -#define RADEON_AGP_TEX_HEAP 1 -#define RADEON_NR_TEX_HEAPS 2 -#define RADEON_NR_TEX_REGIONS 64 -#define RADEON_LOG_TEX_GRANULARITY 16 - -#define RADEON_MAX_TEXTURE_LEVELS 11 -#define RADEON_MAX_TEXTURE_UNITS 3 - -#endif /* __RADEON_SAREA_DEFINES__ */ - -typedef struct { - unsigned int red; - unsigned int green; - unsigned int blue; - unsigned int alpha; -} radeon_color_regs_t; - -typedef struct { - /* Context state */ - unsigned int pp_misc; /* 0x1c14 */ - unsigned int pp_fog_color; - unsigned int re_solid_color; - unsigned int rb3d_blendcntl; - unsigned int rb3d_depthoffset; - unsigned int rb3d_depthpitch; - unsigned int rb3d_zstencilcntl; - - unsigned int pp_cntl; /* 0x1c38 */ - unsigned int rb3d_cntl; - unsigned int rb3d_coloroffset; - unsigned int re_width_height; - unsigned int rb3d_colorpitch; - unsigned int se_cntl; - - /* Vertex format state */ - unsigned int se_coord_fmt; /* 0x1c50 */ - - /* Line state */ - unsigned int re_line_pattern; /* 0x1cd0 */ - unsigned int re_line_state; - - unsigned int se_line_width; /* 0x1db8 */ - - /* Bumpmap state */ - unsigned int pp_lum_matrix; /* 0x1d00 */ - - unsigned int pp_rot_matrix_0; /* 0x1d58 */ - unsigned int pp_rot_matrix_1; - - /* Mask state */ - unsigned int rb3d_stencilrefmask; /* 0x1d7c */ - unsigned int rb3d_ropcntl; - unsigned int rb3d_planemask; - - /* Viewport state */ - unsigned int se_vport_xscale; /* 0x1d98 */ - unsigned int se_vport_xoffset; - unsigned int se_vport_yscale; - unsigned int se_vport_yoffset; - unsigned int se_vport_zscale; - unsigned int se_vport_zoffset; - - /* Setup state */ - unsigned int se_cntl_status; /* 0x2140 */ - -#ifdef TCL_ENABLE - /* TCL state */ - radeon_color_regs_t se_tcl_material_emmissive; /* 0x2210 */ - radeon_color_regs_t se_tcl_material_ambient; - radeon_color_regs_t se_tcl_material_diffuse; - radeon_color_regs_t se_tcl_material_specular; - unsigned int se_tcl_shininess; - unsigned int se_tcl_output_vtx_fmt; - unsigned int se_tcl_output_vtx_sel; - unsigned int se_tcl_matrix_select_0; - unsigned int se_tcl_matrix_select_1; - unsigned int se_tcl_ucp_vert_blend_ctl; - unsigned int se_tcl_texture_proc_ctl; - unsigned int se_tcl_light_model_ctl; - unsigned int se_tcl_per_light_ctl[4]; -#endif - - /* Misc state */ - unsigned int re_top_left; /* 0x26c0 */ - unsigned int re_misc; -} drm_radeon_context_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int pp_txfilter; - unsigned int pp_txformat; - unsigned int pp_txoffset; - unsigned int pp_txcblend; - unsigned int pp_txablend; - unsigned int pp_tfactor; - - unsigned int pp_border_color; - -#ifdef CUBIC_ENABLE - unsigned int pp_cubic_faces; - unsigned int pp_cubic_offset[5]; -#endif -} drm_radeon_texture_regs_t; - -typedef struct { - unsigned char next, prev; - unsigned char in_use; - int age; -} drm_radeon_tex_region_t; - -typedef struct { - /* The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ - drm_radeon_context_regs_t context_state; - drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; - - /* The current cliprects, or a subset thereof. - */ - drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Counters for client-side throttling of rendering clients. - */ - unsigned int last_frame; - unsigned int last_dispatch; - unsigned int last_clear; - - drm_radeon_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1]; - int tex_age[RADEON_NR_TEX_HEAPS]; - int ctx_owner; -} drm_radeon_sarea_t; - - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmRadeon.h) - */ -typedef struct drm_radeon_init { - enum { - RADEON_INIT_CP = 0x01, - RADEON_CLEANUP_CP = 0x02 - } func; - unsigned long sarea_priv_offset; - int is_pci; - int cp_mode; - int agp_size; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -} drm_radeon_init_t; - -typedef struct drm_radeon_cp_stop { - int flush; - int idle; -} drm_radeon_cp_stop_t; - -typedef struct drm_radeon_fullscreen { - enum { - RADEON_INIT_FULLSCREEN = 0x01, - RADEON_CLEANUP_FULLSCREEN = 0x02 - } func; -} drm_radeon_fullscreen_t; - -#define CLEAR_X1 0 -#define CLEAR_Y1 1 -#define CLEAR_X2 2 -#define CLEAR_Y2 3 -#define CLEAR_DEPTH 4 - -typedef union drm_radeon_clear_rect { - float f[5]; - unsigned int ui[5]; -} drm_radeon_clear_rect_t; - -typedef struct drm_radeon_clear { - unsigned int flags; - unsigned int clear_color; - unsigned int clear_depth; - unsigned int color_mask; - unsigned int depth_mask; - drm_radeon_clear_rect_t *depth_boxes; -} drm_radeon_clear_t; - -typedef struct drm_radeon_vertex { - int prim; - int idx; /* Index of vertex buffer */ - int count; /* Number of vertices in buffer */ - int discard; /* Client finished with buffer? */ -} drm_radeon_vertex_t; - -typedef struct drm_radeon_indices { - int prim; - int idx; - int start; - int end; - int discard; /* Client finished with buffer? */ -} drm_radeon_indices_t; - -typedef struct drm_radeon_tex_image { - unsigned int x, y; /* Blit coordinates */ - unsigned int width, height; - const void *data; -} drm_radeon_tex_image_t; - -typedef struct drm_radeon_texture { - int offset; - int pitch; - int format; - int width; /* Texture image coordinates */ - int height; - drm_radeon_tex_image_t *image; -} drm_radeon_texture_t; - -typedef struct drm_radeon_stipple { - unsigned int *mask; -} drm_radeon_stipple_t; - -typedef struct drm_radeon_indirect { - int idx; - int start; - int end; - int discard; -} drm_radeon_indirect_t; - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drv.c:1.2 --- /dev/null Thu Feb 27 12:32:22 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drv.c Sat Feb 8 16:27:00 2003 @@ -0,0 +1,95 @@ +/* radeon_drv.c -- ATI Radeon driver -*- linux-c -*- + * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#include <sys/types.h> + +#include "radeon.h" +#include "drmP.h" +#include "drm.h" +#include "radeon_drm.h" +#include "radeon_drv.h" +#if __REALLY_HAVE_SG +#include "ati_pcigart.h" +#endif + +drm_chipinfo_t DRM(devicelist)[] = { + {0x1002, 0x4242, 1, "ATI Radeon BB AIW 8500DV (AGP)"}, + {0x1002, 0x4336, 1, "ATI Radeon Mobility"}, + {0x1002, 0x4964, 1, "ATI Radeon Id 9000"}, + {0x1002, 0x4965, 1, "ATI Radeon Ie 9000"}, + {0x1002, 0x4966, 1, "ATI Radeon If 9000"}, + {0x1002, 0x4967, 1, "ATI Radeon Ig 9000"}, + {0x1002, 0x496e, 1, "ATI Radeon Ig 9000"}, + {0x1002, 0x4C57, 1, "ATI Radeon LW Mobility 7 (AGP)"}, + {0x1002, 0x4C58, 1, "ATI Radeon LX Mobility 7 (AGP)"}, + {0x1002, 0x4C59, 1, "ATI Radeon LY Mobility 6 (AGP)"}, + {0x1002, 0x4C5A, 1, "ATI Radeon LZ Mobility 6 (AGP)"}, + {0x1002, 0x4C64, 1, "ATI Radeon Ld Mobility 9000 (AGP)"}, + {0x1002, 0x4C65, 1, "ATI Radeon Le Mobility 9000 (AGP)"}, + {0x1002, 0x4C66, 1, "ATI Radeon Lf Mobility 9000 (AGP)"}, + {0x1002, 0x4C67, 1, "ATI Radeon Lg Mobility 9000 (AGP)"}, + {0x1002, 0x5144, 1, "ATI Radeon QD R100 (AGP)"}, + {0x1002, 0x5145, 1, "ATI Radeon QE R100 (AGP)"}, + {0x1002, 0x5146, 1, "ATI Radeon QF R100 (AGP)"}, + {0x1002, 0x5147, 1, "ATI Radeon QG R100 (AGP)"}, + {0x1002, 0x5148, 1, "ATI Radeon QH FireGL 8x00 (AGP)"}, + {0x1002, 0x5149, 1, "ATI Radeon QI R200"}, + {0x1002, 0x514A, 1, "ATI Radeon QJ R200"}, + {0x1002, 0x514B, 1, "ATI Radeon QK R200"}, + {0x1002, 0x514C, 1, "ATI Radeon QL 8500 (AGP)"}, + {0x1002, 0x5157, 1, "ATI Radeon QW 7500 (AGP)"}, + {0x1002, 0x5158, 1, "ATI Radeon QX 7500 (AGP)"}, + {0x1002, 0x5159, 1, "ATI Radeon QY VE (AGP)"}, + {0x1002, 0x515A, 1, "ATI Radeon QZ VE (AGP)"}, + {0x1002, 0x5168, 1, "ATI Radeon Qh R200"}, + {0x1002, 0x5169, 1, "ATI Radeon Qi R200"}, + {0x1002, 0x516A, 1, "ATI Radeon Qj R200"}, + {0x1002, 0x516B, 1, "ATI Radeon Qk R200"}, + {0, 0, 0, NULL} +}; + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_vm.h" +#include "drm_sysctl.h" +#if __HAVE_SG +#include "drm_scatter.h" +#endif + +DRIVER_MODULE(DRIVER_NAME, pci, DRM(driver), DRM(devclass), 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h:1.1 Wed Dec 12 19:24:47 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h Thu Feb 27 12:32:22 2003 @@ -1,30 +0,0 @@ - -#ifndef _sis_drm_public_h_ -#define _sis_drm_public_h_ - -typedef struct { - int context; - unsigned int offset; - unsigned int size; - unsigned int free; -} drm_sis_mem_t; - -typedef struct { - unsigned int offset, size; -} drm_sis_agp_t; - -typedef struct { - unsigned int left, right; -} drm_sis_flip_t; - -#if defined(__KERNEL__) || defined(_KERNEL) - -int sis_fb_alloc(DRM_OS_IOCTL); -int sis_fb_free(DRM_OS_IOCTL); -int sisp_agp_init(DRM_OS_IOCTL); -int sisp_agp_alloc(DRM_OS_IOCTL); -int sisp_agp_free(DRM_OS_IOCTL); - -#endif - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx.h:1.1 --- /dev/null Thu Feb 27 12:32:23 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx.h Wed Oct 30 07:52:26 2002 @@ -0,0 +1,42 @@ +/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __TDFX_H__ +#define __TDFX_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) tdfx_##x + +/* General customization: + */ +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx_drv.c:1.1 --- /dev/null Thu Feb 27 12:32:23 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx_drv.c Wed Oct 30 07:52:26 2002 @@ -0,0 +1,99 @@ +/* tdfx_drv.c -- tdfx driver -*- linux-c -*- + * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Daryll Strauss <daryll@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + + +#include <sys/types.h> + +#include "tdfx.h" +#include "drmP.h" + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "tdfx" +#define DRIVER_DESC "3dfx Banshee/Voodoo3+" +#define DRIVER_DATE "20010216" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#ifndef PCI_VENDOR_ID_3DFX +#define PCI_VENDOR_ID_3DFX 0x121A +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO5 +#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO4 +#define PCI_DEVICE_ID_3DFX_VOODOO4 0x0007 +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_3000 /* Voodoo3 3000 */ +#define PCI_DEVICE_ID_3DFX_VOODOO3_3000 0x0005 +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_2000 /* Voodoo3 3000 */ +#define PCI_DEVICE_ID_3DFX_VOODOO3_2000 0x0004 +#endif +#ifndef PCI_DEVICE_ID_3DFX_BANSHEE +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 +#endif + +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x121a, 0x0003, 1, "3dfx Voodoo Banshee"}, + {0x121a, 0x0004, 1, "3dfx Voodoo3 2000"}, + {0x121a, 0x0005, 1, "3dfx Voodoo3 3000"}, + {0x121a, 0x0007, 1, "3dfx Voodoo4"}, + {0x121a, 0x0009, 1, "3dfx Voodoo5"}, + {0, 0, 0, NULL} +}; + + +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" + + +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_vm.h" +#include "drm_sysctl.h" + +#ifdef __FreeBSD__ +DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0); +#endif /* __FreeBSD__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.3 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile Thu Feb 27 12:32:23 2003 @@ -1,25 +0,0 @@ -# $FreeBSD$ - -KMOD = gamma -NOMAN= YES -SRCS = gamma_drv.c gamma_dma.c -SRCS += device_if.h bus_if.h pci_if.h opt_drm_linux.h -CFLAGS += ${DEBUG_FLAGS} -I. -I.. - -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine - -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#TDFX_OPTS= "\#define DRM_LINUX" 1 -.endif - -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(TDFX_OPTS) >> opt_drm_linux.h - -.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h Thu Feb 27 12:32:23 2003 @@ -1,93 +0,0 @@ -/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- - * Created: Mon Jan 4 08:58:31 1999 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __GAMMA_H__ -#define __GAMMA_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) gamma_##x - -/* General customization: - */ -#define __HAVE_MTRR 1 - -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_OLD_DMA 1 -#define __HAVE_PCI_DMA 1 - -#define __HAVE_MULTIPLE_DMA_QUEUES 1 -#define __HAVE_DMA_WAITQUEUE 1 - -#define __HAVE_DMA_WAITLIST 1 -#define __HAVE_DMA_FREELIST 1 - -#define __HAVE_DMA_FLUSH 1 -#define __HAVE_DMA_SCHEDULE 1 - -#define __HAVE_DMA_READY 1 -#define DRIVER_DMA_READY() do { \ - gamma_dma_ready(dev); \ -} while (0) - -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - /* FIXME ! */ \ - gamma_dma_quiescent_dual(dev); \ - return 0; \ -} while (0) - -#define __HAVE_DMA_IRQ 1 -#define __HAVE_DMA_IRQ_BH 1 -#define DRIVER_PREINSTALL() do { \ - drm_gamma_private_t *dev_priv = \ - (drm_gamma_private_t *)dev->dev_private;\ - GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000000 ); \ - GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 ); \ -} while (0) - -#define DRIVER_POSTINSTALL() do { \ - drm_gamma_private_t *dev_priv = \ - (drm_gamma_private_t *)dev->dev_private;\ - GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002001 ); \ - GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000008 ); \ - GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00039090 ); \ -} while (0) - -#define DRIVER_UNINSTALL() do { \ - drm_gamma_private_t *dev_priv = \ - (drm_gamma_private_t *)dev->dev_private;\ - GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00000000 ); \ - GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 ); \ - GAMMA_WRITE( GAMMA_GINTENABLE, 0x00000000 ); \ -} while (0) - -#endif /* __GAMMA_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c:1.2 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c Thu Feb 27 12:32:23 2003 @@ -1,566 +0,0 @@ -/* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*- - * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - - - -#include "gamma.h" -#include "drmP.h" -#include "gamma_drv.h" - - -static __inline__ void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, - unsigned long length) -{ - drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - GAMMA_WRITE(GAMMA_DMAADDRESS, DRM_OS_VTOPHYS((void *)address)); - while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4) - ; - GAMMA_WRITE(GAMMA_DMACOUNT, length / 4); -} - -void gamma_dma_quiescent_single(drm_device_t *dev) -{ - drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - while (GAMMA_READ(GAMMA_DMACOUNT)) - ; - while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) - ; - - GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); - GAMMA_WRITE(GAMMA_SYNC, 0); - - do { - while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) - ; - } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); -} - -void gamma_dma_quiescent_dual(drm_device_t *dev) -{ - drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - while (GAMMA_READ(GAMMA_DMACOUNT)) - ; - while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) - ; - - GAMMA_WRITE(GAMMA_BROADCASTMASK, 3); - - GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); - GAMMA_WRITE(GAMMA_SYNC, 0); - - /* Read from first MX */ - do { - while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) - ; - } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); - - /* Read from second MX */ - do { - while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000)) - ; - } while (GAMMA_READ(GAMMA_OUTPUTFIFO + 0x10000) != GAMMA_SYNC_TAG); -} - -void gamma_dma_ready(drm_device_t *dev) -{ - drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - while (GAMMA_READ(GAMMA_DMACOUNT)) - ; -} - -static __inline__ int gamma_dma_is_ready(drm_device_t *dev) -{ - drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - return !GAMMA_READ(GAMMA_DMACOUNT); -} - -void gamma_dma_service( DRM_OS_IRQ_ARGS) -{ - drm_device_t *dev = (drm_device_t *)device; - drm_device_dma_t *dma = dev->dma; - drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */ - GAMMA_WRITE(GAMMA_GDELAYTIMER, 0xc350/2); /* 0x05S */ - GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS, 8); - GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001); - if (gamma_dma_is_ready(dev)) { - /* Free previous buffer */ - if (test_and_set_bit(0, &dev->dma_flag)) return; - if (dma->this_buffer) { - gamma_free_buffer(dev, dma->this_buffer); - dma->this_buffer = NULL; - } - clear_bit(0, &dev->dma_flag); - - } -} - -/* Only called by gamma_dma_schedule. */ -static int gamma_do_dma(drm_device_t *dev, int locked) -{ - unsigned long address; - unsigned long length; - drm_buf_t *buf; - int retcode = 0; - drm_device_dma_t *dma = dev->dma; -#if DRM_DMA_HISTOGRAM - cycles_t dma_start, dma_stop; -#endif - - if (test_and_set_bit(0, &dev->dma_flag)) DRM_OS_RETURN( EBUSY ); - -#if DRM_DMA_HISTOGRAM - dma_start = get_cycles(); -#endif - - if (!dma->next_buffer) { - DRM_ERROR("No next_buffer\n"); - clear_bit(0, &dev->dma_flag); - DRM_OS_RETURN( EINVAL ); - } - - buf = dma->next_buffer; - address = (unsigned long)buf->address; - length = buf->used; - - DRM_DEBUG("context %d, buffer %d (%ld bytes)\n", - buf->context, buf->idx, length); - - if (buf->list == DRM_LIST_RECLAIM) { - gamma_clear_next_buffer(dev); - gamma_free_buffer(dev, buf); - clear_bit(0, &dev->dma_flag); - DRM_OS_RETURN( EINVAL ); - } - - if (!length) { - DRM_ERROR("0 length buffer\n"); - gamma_clear_next_buffer(dev); - gamma_free_buffer(dev, buf); - clear_bit(0, &dev->dma_flag); - return 0; - } - - if (!gamma_dma_is_ready(dev)) { - clear_bit(0, &dev->dma_flag); - DRM_OS_RETURN( EBUSY ); - } - - if (buf->while_locked) { - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Dispatching buffer %d from pid %d" - " \"while locked\", but no lock held\n", - buf->idx, buf->pid); - } - } else { - if (!locked && !gamma_lock_take(&dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - clear_bit(0, &dev->dma_flag); - DRM_OS_RETURN( EBUSY ); - } - } - - if (dev->last_context != buf->context - && !(dev->queuelist[buf->context]->flags - & _DRM_CONTEXT_PRESERVED)) { - /* PRE: dev->last_context != buf->context */ - if (DRM(context_switch)(dev, dev->last_context, - buf->context)) { - DRM(clear_next_buffer)(dev); - DRM(free_buffer)(dev, buf); - } - retcode = EBUSY; - goto cleanup; - - /* POST: we will wait for the context - switch and will dispatch on a later call - when dev->last_context == buf->context. - NOTE WE HOLD THE LOCK THROUGHOUT THIS - TIME! */ - } - - gamma_clear_next_buffer(dev); - buf->pending = 1; - buf->waiting = 0; - buf->list = DRM_LIST_PEND; -#if DRM_DMA_HISTOGRAM - buf->time_dispatched = get_cycles(); -#endif - - gamma_dma_dispatch(dev, address, length); - gamma_free_buffer(dev, dma->this_buffer); - dma->this_buffer = buf; - - atomic_inc(&dev->counts[7]); /* _DRM_STAT_DMA */ - atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ - - if (!buf->while_locked && !dev->context_flag && !locked) { - if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } -cleanup: - - clear_bit(0, &dev->dma_flag); - -#if DRM_DMA_HISTOGRAM - dma_stop = get_cycles(); - atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]); -#endif - - DRM_OS_RETURN( retcode ); -} - -static void gamma_dma_timer_bh(unsigned long dev) -{ - gamma_dma_schedule((drm_device_t *)dev, 0); -} - -void gamma_dma_immediate_bh(DRM_OS_TASKQUEUE_ARGS) -{ - gamma_dma_schedule(dev, 0); -} - -int gamma_dma_schedule(drm_device_t *dev, int locked) -{ - int next; - drm_queue_t *q; - drm_buf_t *buf; - int retcode = 0; - int processed = 0; - int missed; - int expire = 20; - drm_device_dma_t *dma = dev->dma; -#if DRM_DMA_HISTOGRAM - cycles_t schedule_start; -#endif - - if (test_and_set_bit(0, &dev->interrupt_flag)) { - /* Not reentrant */ - atomic_inc(&dev->counts[10]); /* _DRM_STAT_MISSED */ - DRM_OS_RETURN( EBUSY ); - } - missed = atomic_read(&dev->counts[10]); - -#if DRM_DMA_HISTOGRAM - schedule_start = get_cycles(); -#endif - -again: - if (dev->context_flag) { - clear_bit(0, &dev->interrupt_flag); - DRM_OS_RETURN( EBUSY ); - } - if (dma->next_buffer) { - /* Unsent buffer that was previously - selected, but that couldn't be sent - because the lock could not be obtained - or the DMA engine wasn't ready. Try - again. */ - if (!(retcode = gamma_do_dma(dev, locked))) ++processed; - } else { - do { - next = gamma_select_queue(dev, gamma_dma_timer_bh); - if (next >= 0) { - q = dev->queuelist[next]; - buf = gamma_waitlist_get(&q->waitlist); - dma->next_buffer = buf; - dma->next_queue = q; - if (buf && buf->list == DRM_LIST_RECLAIM) { - gamma_clear_next_buffer(dev); - gamma_free_buffer(dev, buf); - } - } - } while (next >= 0 && !dma->next_buffer); - if (dma->next_buffer) { - if (!(retcode = gamma_do_dma(dev, locked))) { - ++processed; - } - } - } - - if (--expire) { - if (missed != atomic_read(&dev->counts[10])) { - if (gamma_dma_is_ready(dev)) goto again; - } - if (processed && gamma_dma_is_ready(dev)) { - processed = 0; - goto again; - } - } - - clear_bit(0, &dev->interrupt_flag); - -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.schedule[gamma_histogram_slot(get_cycles() - - schedule_start)]); -#endif - return retcode; -} - -static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) -{ - unsigned long address; - unsigned long length; - int must_free = 0; - int retcode = 0; - int i; - int idx; - drm_buf_t *buf; - drm_buf_t *last_buf = NULL; - drm_device_dma_t *dma = dev->dma; - static int never; - - /* Turn off interrupt handling */ - while (test_and_set_bit(0, &dev->interrupt_flag)) { - retcode = tsleep(&never, PZERO|PCATCH, "gamp1", 1); - if (retcode) - return retcode; - } - if (!(d->flags & _DRM_DMA_WHILE_LOCKED)) { - while (!gamma_lock_take(&dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - retcode = tsleep(&never, PZERO|PCATCH, "gamp2", 1); - if (retcode) - return retcode; - } - ++must_free; - } - - for (i = 0; i < d->send_count; i++) { - idx = d->send_indices[i]; - if (idx < 0 || idx >= dma->buf_count) { - DRM_ERROR("Index %d (of %d max)\n", - d->send_indices[i], dma->buf_count - 1); - continue; - } - buf = dma->buflist[ idx ]; - if (buf->pid != DRM_OS_CURRENTPID) { - DRM_ERROR("Process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid); - retcode = EINVAL; - goto cleanup; - } - if (buf->list != DRM_LIST_NONE) { - DRM_ERROR("Process %d using %d's buffer on list %d\n", - DRM_OS_CURRENTPID, buf->pid, buf->list); - retcode = EINVAL; - goto cleanup; - } - /* This isn't a race condition on - buf->list, since our concern is the - buffer reclaim during the time the - process closes the /dev/drm? handle, so - it can't also be doing DMA. */ - buf->list = DRM_LIST_PRIO; - buf->used = d->send_sizes[i]; - buf->context = d->context; - buf->while_locked = d->flags & _DRM_DMA_WHILE_LOCKED; - address = (unsigned long)buf->address; - length = buf->used; - if (!length) { - DRM_ERROR("0 length buffer\n"); - } - if (buf->pending) { - DRM_ERROR("Sending pending buffer:" - " buffer %d, offset %d\n", - d->send_indices[i], i); - retcode = EINVAL; - goto cleanup; - } - if (buf->waiting) { - DRM_ERROR("Sending waiting buffer:" - " buffer %d, offset %d\n", - d->send_indices[i], i); - retcode = EINVAL; - goto cleanup; - } - buf->pending = 1; - - if (dev->last_context != buf->context - && !(dev->queuelist[buf->context]->flags - & _DRM_CONTEXT_PRESERVED)) { - /* PRE: dev->last_context != buf->context */ - DRM(context_switch)(dev, dev->last_context, - buf->context); - /* POST: we will wait for the context - switch and will dispatch on a later call - when dev->last_context == buf->context. - NOTE WE HOLD THE LOCK THROUGHOUT THIS - TIME! */ - retcode = tsleep(&dev->context_wait, PZERO|PCATCH, - "gamctx", 0); - if (retcode) - goto cleanup; - if (dev->last_context != buf->context) { - DRM_ERROR("Context mismatch: %d %d\n", - dev->last_context, - buf->context); - } - } - -#if DRM_DMA_HISTOGRAM - buf->time_queued = get_cycles(); - buf->time_dispatched = buf->time_queued; -#endif - gamma_dma_dispatch(dev, address, length); - atomic_inc(&dev->counts[9]); /* _DRM_STAT_SPECIAL */ - atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ - - if (last_buf) { - gamma_free_buffer(dev, last_buf); - } - last_buf = buf; - } - - -cleanup: - if (last_buf) { - gamma_dma_ready(dev); - gamma_free_buffer(dev, last_buf); - } - - if (must_free && !dev->context_flag) { - if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } - clear_bit(0, &dev->interrupt_flag); - DRM_OS_RETURN( retcode ); -} - -static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d) -{ - drm_buf_t *last_buf = NULL; - int retcode = 0; - drm_device_dma_t *dma = dev->dma; - - if (d->flags & _DRM_DMA_BLOCK) { - last_buf = dma->buflist[d->send_indices[d->send_count-1]]; - atomic_inc(&last_buf->dma_wait); - } - - if ((retcode = gamma_dma_enqueue(dev, d))) { - if (d->flags & _DRM_DMA_BLOCK) - atomic_dec(&last_buf->dma_wait); - return retcode; - } - - gamma_dma_schedule(dev, 0); - - if (d->flags & _DRM_DMA_BLOCK) { - DRM_DEBUG("%d waiting\n", DRM_OS_CURRENTPID); - for (;;) { - retcode = tsleep(&last_buf->dma_wait, PZERO|PCATCH, - "gamdw", 0); - if (!last_buf->waiting - && !last_buf->pending) - break; /* finished */ - if (retcode) - break; - } - atomic_dec(&last_buf->dma_wait); - DRM_DEBUG("%d running\n", DRM_OS_CURRENTPID); - if (!retcode - || (last_buf->list==DRM_LIST_PEND && !last_buf->pending)) { - if (!last_buf->dma_wait) { - gamma_free_buffer(dev, last_buf); - } - } - if (retcode) { - DRM_ERROR("ctx%d w%d p%d c%d i%d l%d %d/%d\n", - d->context, - last_buf->waiting, - last_buf->pending, - DRM_WAITCOUNT(dev, d->context), - last_buf->idx, - last_buf->list, - last_buf->pid, - DRM_OS_CURRENTPID); - } - } - DRM_OS_RETURN( retcode ); -} - -int gamma_dma( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - drm_dma_t d; - - DRM_OS_KRNFROMUSR(d, (drm_dma_t *) data, sizeof(d)); - - if (d.send_count < 0 || d.send_count > dma->buf_count) { - DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n", - DRM_OS_CURRENTPID, d.send_count, dma->buf_count); - DRM_OS_RETURN( EINVAL ); - } - - if (d.request_count < 0 || d.request_count > dma->buf_count) { - DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", - DRM_OS_CURRENTPID, d.request_count, dma->buf_count); - DRM_OS_RETURN( EINVAL ); - } - - if (d.send_count) { - if (d.flags & _DRM_DMA_PRIORITY) - retcode = gamma_dma_priority(dev, &d); - else - retcode = gamma_dma_send_buffers(dev, &d); - } - - d.granted_count = 0; - - if (!retcode && d.request_count) { - retcode = gamma_dma_get_buffers(dev, &d); - } - - DRM_DEBUG("%d returning, granted = %d\n", - DRM_OS_CURRENTPID, d.granted_count); - DRM_OS_KRNTOUSR((drm_dma_t *) data, d, sizeof(d)); - - return retcode; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c:1.2 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c Thu Feb 27 12:32:24 2003 @@ -1,87 +0,0 @@ -/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- - * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> -#include "gamma.h" -#include "drmP.h" -#include "gamma_drv.h" - -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "gamma" -#define DRIVER_DESC "3DLabs gamma" -#define DRIVER_DATE "20010216" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x3d3d, 0x0008, 1, "3DLabs Gamma"}, - {0, 0, 0, NULL} -}; - - -#define __HAVE_COUNTERS 5 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_DMA -#define __HAVE_COUNTER8 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL -#define __HAVE_COUNTER10 _DRM_STAT_MISSED - - -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lists.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_vm.h" -#include "drm_sysctl.h" - -DRIVER_MODULE(gamma, pci, gamma_driver, gamma_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h:1.2 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h Thu Feb 27 12:32:24 2003 @@ -1,104 +0,0 @@ -/* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#ifndef _GAMMA_DRV_H_ -#define _GAMMA_DRV_H_ - - -typedef struct drm_gamma_private { - drm_map_t *buffers; - drm_map_t *mmio0; - drm_map_t *mmio1; - drm_map_t *mmio2; - drm_map_t *mmio3; -} drm_gamma_private_t; - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != DRM_OS_CURRENTPID ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - DRM_OS_RETURN( EINVAL ); \ - } \ -} while (0) - - -extern void gamma_dma_ready(drm_device_t *dev); -extern void gamma_dma_quiescent_single(drm_device_t *dev); -extern void gamma_dma_quiescent_dual(drm_device_t *dev); - - /* gamma_dma.c */ -extern int gamma_dma_schedule(drm_device_t *dev, int locked); -extern int gamma_dma( DRM_OS_IOCTL ); -extern int gamma_find_devices(void); -extern int gamma_found(void); - - -#define GAMMA_OFF(reg) \ - ((reg < 0x1000) \ - ? reg \ - : ((reg < 0x10000) \ - ? (reg - 0x1000) \ - : ((reg < 0x11000) \ - ? (reg - 0x10000) \ - : (reg - 0x11000)))) - -#define GAMMA_BASE(reg) ((unsigned long) \ - ((reg < 0x1000) ? dev_priv->mmio0->handle : \ - ((reg < 0x10000) ? dev_priv->mmio1->handle : \ - ((reg < 0x11000) ? dev_priv->mmio2->handle : \ - dev_priv->mmio3->handle)))) - -#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) -#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) -#define GAMMA_READ(reg) GAMMA_DEREF(reg) -#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0) - -#define GAMMA_BROADCASTMASK 0x9378 -#define GAMMA_COMMANDINTENABLE 0x0c48 -#define GAMMA_DMAADDRESS 0x0028 -#define GAMMA_DMACOUNT 0x0030 -#define GAMMA_FILTERMODE 0x8c00 -#define GAMMA_GCOMMANDINTFLAGS 0x0c50 -#define GAMMA_GCOMMANDMODE 0x0c40 -#define GAMMA_GCOMMANDSTATUS 0x0c60 -#define GAMMA_GDELAYTIMER 0x0c38 -#define GAMMA_GDMACONTROL 0x0060 -#define GAMMA_GINTENABLE 0x0808 -#define GAMMA_GINTFLAGS 0x0810 -#define GAMMA_INFIFOSPACE 0x0018 -#define GAMMA_OUTFIFOWORDS 0x0020 -#define GAMMA_OUTPUTFIFO 0x2000 -#define GAMMA_SYNC 0x8c40 -#define GAMMA_SYNC_TAG 0x0188 - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile Thu Feb 27 12:32:24 2003 @@ -1,25 +0,0 @@ -# $FreeBSD$ - -KMOD= i810 -NOMAN= YES -SRCS= i810_drv.c i810_dma.c -SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h -CFLAGS+= ${DEBUG_FLAGS} -I. -I.. - -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine - -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#I810_OPTS= "\#define DRM_LINUX" 1 -.endif - -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(I810_OPTS) >> opt_drm_linux.h - -.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h Thu Feb 27 12:32:24 2003 @@ -1,116 +0,0 @@ -/* i810.h -- Intel i810/i815 DRM template customization -*- linux-c -*- - * Created: Thu Feb 15 00:01:12 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __I810_H__ -#define __I810_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) i810_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -/* Driver customization: - */ -#define __HAVE_RELEASE 1 -#define DRIVER_RELEASE() do { \ - i810_reclaim_buffers( dev, priv->pid ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_DMA_QUEUE 1 -#define __HAVE_DMA_WAITLIST 1 -#define __HAVE_DMA_RECLAIM 1 - -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - i810_dma_quiescent( dev ); \ -} while (0) - -#define __HAVE_DMA_IRQ 1 -#define __HAVE_DMA_IRQ_BH 1 -#define __HAVE_SHARED_IRQ 1 -#define DRIVER_PREINSTALL() do { \ - drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I810_READ16( I810REG_HWSTAM ); \ - tmp = tmp & 0x6000; \ - I810_WRITE16( I810REG_HWSTAM, tmp ); \ - \ - tmp = I810_READ16( I810REG_INT_MASK_R ); \ - tmp = tmp & 0x6000; /* Unmask interrupts */ \ - I810_WRITE16( I810REG_INT_MASK_R, tmp ); \ - tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ -} while (0) - -#define DRIVER_POSTINSTALL() do { \ - drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; \ - tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ - I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ -} while (0) - -#define DRIVER_UNINSTALL() do { \ - drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ - u16 tmp; \ - if ( dev_priv ) { \ - tmp = I810_READ16( I810REG_INT_IDENTITY_R ); \ - tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ - if ( tmp != 0 ) \ - I810_WRITE16( I810REG_INT_IDENTITY_R, tmp ); \ - \ - tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ - } \ -} while (0) - -/* Buffer customization: - */ - -#define DRIVER_BUF_PRIV_T drm_i810_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_i810_private_t *)((dev)->dev_private))->buffer_map - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c Thu Feb 27 12:32:24 2003 @@ -1,1220 +0,0 @@ -/* i810_dma.c -- DMA support for the i810 -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - */ - - -#include "i810.h" -#include "drmP.h" -#include "i810_drv.h" - -#define I810_BUF_FREE 2 -#define I810_BUF_CLIENT 1 -#define I810_BUF_HARDWARE 0 - -#define I810_BUF_UNMAPPED 0 -#define I810_BUF_MAPPED 1 - -#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; - -#define BEGIN_LP_RING(n) do { \ - if (I810_VERBOSE) \ - DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ - n, __FUNCTION__); \ - if (dev_priv->ring.space < n*4) \ - i810_wait_ring(dev, n*4); \ - dev_priv->ring.space -= n*4; \ - outring = dev_priv->ring.tail; \ - ringmask = dev_priv->ring.tail_mask; \ - virt = dev_priv->ring.virtual_start; \ -} while (0) - -#define ADVANCE_LP_RING() do { \ - if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ - dev_priv->ring.tail = outring; \ - I810_WRITE(LP_RING + RING_TAIL, outring); \ -} while(0) - -#define OUT_RING(n) do { \ - if (I810_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; \ - outring &= ringmask; \ -} while (0); - -static __inline__ void i810_print_status_page(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - drm_i810_private_t *dev_priv = dev->dev_private; - u32 *temp = (u32 *)dev_priv->hw_status_page; - int i; - - DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); - DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); - DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); - DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); - DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); - for(i = 6; i < dma->buf_count + 6; i++) { - DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 6, temp[i]); - } -} - -static drm_buf_t *i810_freelist_get(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - int i; - char failed; - - /* Linear search might not be the best solution */ - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - /* In use is already a pointer */ - _DRM_CAS(buf_priv->in_use, I810_BUF_FREE, I810_BUF_CLIENT, - failed); - if (!failed) - return buf; - } - return NULL; -} - -/* This should only be called if the buffer is not sent to the hardware - * yet, the hardware updates in use for us once its on the ring buffer. - */ - -static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf) -{ - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - char failed; - - /* In use is already a pointer */ - _DRM_CAS(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE, failed); - if(failed) { - DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); - DRM_OS_RETURN( EINVAL ); - } - - return 0; -} - - -int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) -{ - DRM_OS_DEVICE; - drm_i810_private_t *dev_priv; - drm_buf_t *buf; - drm_i810_buf_priv_t *buf_priv; - - lock_kernel(); - dev_priv = dev->dev_private; - buf = dev_priv->mmap_buffer; - buf_priv = buf->dev_private; - - vma->vm_flags |= (VM_IO | VM_DONTCOPY); - vma->vm_file = filp; - - buf_priv->currently_mapped = I810_BUF_MAPPED; - unlock_kernel(); - - if (remap_page_range(vma->vm_start, - VM_OFFSET(vma), - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) DRM_OS_RETURN(EAGAIN); - return 0; -} - -static int i810_map_buffer(drm_buf_t *buf, struct file *filp) -{ - DRM_OS_DEVICE; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - drm_i810_private_t *dev_priv = dev->dev_private; - struct file_operations *old_fops; - int retcode = 0; - - if(buf_priv->currently_mapped == I810_BUF_MAPPED) DRM_OS_RETURN(EINVAL); - - if(VM_DONTCOPY != 0) { -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - old_fops = filp->f_op; - filp->f_op = &i810_buffer_fops; - dev_priv->mmap_buffer = buf; - buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, - PROT_READ|PROT_WRITE, - MAP_SHARED, - buf->bus_address); - dev_priv->mmap_buffer = NULL; - filp->f_op = old_fops; - if ((unsigned long)buf_priv->virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed int)buf_priv->virtual; - buf_priv->virtual = 0; - } -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } else { - buf_priv->virtual = buf_priv->kernel_virtual; - buf_priv->currently_mapped = I810_BUF_MAPPED; - } - return retcode; -} - -static int i810_unmap_buffer(drm_buf_t *buf) -{ - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - int retcode = 0; - - if(VM_DONTCOPY != 0) { - if(buf_priv->currently_mapped != I810_BUF_MAPPED) - DRM_OS_RETURN(EINVAL); -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - retcode = do_munmap(current->mm, - (unsigned long)buf_priv->virtual, - (size_t) buf->total); -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } - buf_priv->currently_mapped = I810_BUF_UNMAPPED; - buf_priv->virtual = 0; - - return retcode; -} - -static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, - struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_buf_t *buf; - drm_i810_buf_priv_t *buf_priv; - int retcode = 0; - - buf = i810_freelist_get(dev); - if (!buf) { - retcode = -ENOMEM; - DRM_DEBUG("retcode=%d\n", retcode); - DRM_OS_RETURN(retcode); - } - - retcode = i810_map_buffer(buf, filp); - if(retcode) { - i810_freelist_put(dev, buf); - DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); - return retcode; - } - buf->pid = priv->pid; - buf_priv = buf->dev_private; - d->granted = 1; - d->request_idx = buf->idx; - d->request_size = buf->total; - d->virtual = buf_priv->virtual; - - return retcode; -} - -static unsigned long i810_alloc_page(drm_device_t *dev) -{ - unsigned long address; - - address = __get_free_page(GFP_KERNEL); - if(address == 0UL) - return 0; - - atomic_inc(&virt_to_page(address)->count); - set_bit(PG_locked, &virt_to_page(address)->flags); - - return address; -} - -static void i810_free_page(drm_device_t *dev, unsigned long page) -{ - if(page == 0UL) - return; - - atomic_dec(&virt_to_page(page)->count); - clear_bit(PG_locked, &virt_to_page(page)->flags); - DRM_OS_WAKEUP(&virt_to_page(page)->wait); - free_page(page); - return; -} - -static int i810_dma_cleanup(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - - if(dev->dev_private) { - int i; - drm_i810_private_t *dev_priv = - (drm_i810_private_t *) dev->dev_private; - - if(dev_priv->ring.virtual_start) { - DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, - dev_priv->ring.Size); - } - if(dev_priv->hw_status_page != 0UL) { - i810_free_page(dev, dev_priv->hw_status_page); - /* Need to rewrite hardware status page */ - I810_WRITE(0x02080, 0x1ffff000); - } - DRM(free)(dev->dev_private, sizeof(drm_i810_private_t), - DRM_MEM_DRIVER); - dev->dev_private = NULL; - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total); - } - } - return 0; -} - -static int i810_wait_ring(drm_device_t *dev, int n) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_ring_buffer_t *ring = &(dev_priv->ring); - int iters = 0; - unsigned long end; - unsigned int last_head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - - end = jiffies + (HZ*3); - while (ring->space < n) { - int i; - - ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->space = ring->head - (ring->tail+8); - if (ring->space < 0) ring->space += ring->Size; - - if (ring->head != last_head) - end = jiffies + (HZ*3); - - iters++; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("space: %d wanted %d\n", ring->space, n); - DRM_ERROR("lockup\n"); - goto out_wait_ring; - } - - for (i = 0 ; i < 2000 ; i++) ; - } - -out_wait_ring: - return iters; -} - -static void i810_kernel_lost_context(drm_device_t *dev) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_ring_buffer_t *ring = &(dev_priv->ring); - - ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->tail = I810_READ(LP_RING + RING_TAIL); - ring->space = ring->head - (ring->tail+8); - if (ring->space < 0) ring->space += ring->Size; -} - -static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv) -{ - drm_device_dma_t *dma = dev->dma; - int my_idx = 24; - u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); - int i; - - if(dma->buf_count > 1019) { - /* Not enough space in the status page for the freelist */ - DRM_OS_RETURN(EINVAL); - } - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - - buf_priv->in_use = hw_status++; - buf_priv->my_use_idx = my_idx; - my_idx += 4; - - *buf_priv->in_use = I810_BUF_FREE; - - buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, - buf->total); - } - return 0; -} - -static int i810_dma_initialize(drm_device_t *dev, - drm_i810_private_t *dev_priv, - drm_i810_init_t *init) -{ - drm_map_list_entry_t *listentry; - - memset(dev_priv, 0, sizeof(drm_i810_private_t)); - - TAILQ_FOREACH(listentry, dev->maplist, link) { - drm_map_t *map = listentry->map; - if (map->type == _DRM_SHM && - map->flags & _DRM_CONTAINS_LOCK) { - dev_priv->sarea = map; - break; - } - } - - if(!dev_priv->sarea_map) { - dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not find sarea!\n"); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); - if(!dev_priv->mmio_map) { - dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not find mmio map!\n"); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); - if(!dev_priv->buffer_map) { - dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not find dma buffer map!\n"); - DRM_OS_RETURN(EINVAL); - } - - dev_priv->sarea_priv = (drm_i810_sarea_t *) - ((u8 *)dev_priv->sarea_map->handle + - init->sarea_priv_offset); - - atomic_set(&dev_priv->flush_done, 0); - init_waitqueue_head(&dev_priv->flush_queue); - - dev_priv->ring.Start = init->ring_start; - dev_priv->ring.End = init->ring_end; - dev_priv->ring.Size = init->ring_size; - - dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + - init->ring_start, - init->ring_size); - - if (dev_priv->ring.virtual_start == NULL) { - dev->dev_private = (void *) dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not ioremap virtual address for" - " ring buffer\n"); - DRM_OS_RETURN(ENOMEM); - } - - dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; - - dev_priv->w = init->w; - dev_priv->h = init->h; - dev_priv->pitch = init->pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->depth_offset = init->depth_offset; - - dev_priv->front_di1 = init->front_offset | init->pitch_bits; - dev_priv->back_di1 = init->back_offset | init->pitch_bits; - dev_priv->zi1 = init->depth_offset | init->pitch_bits; - - /* Program Hardware Status Page */ - dev_priv->hw_status_page = i810_alloc_page(dev); - if(dev_priv->hw_status_page == 0UL) { - dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("Can not allocate hardware status page\n"); - DRM_OS_RETURN(ENOMEM); - } - memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); - DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); - - I810_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page)); - DRM_DEBUG("Enabled hardware status page\n"); - - /* Now we need to init our freelist */ - if(i810_freelist_init(dev, dev_priv) != 0) { - dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("Not enough space in the status page for" - " the freelist\n"); - DRM_OS_RETURN(ENOMEM); - } - dev->dev_private = (void *)dev_priv; - - return 0; -} - -int i810_dma_init( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_i810_private_t *dev_priv; - drm_i810_init_t init; - int retcode = 0; - - DRM_OS_KRNFROMUSR( init, (drm_i810_init_t *) data, sizeof(init) ); - - switch(init.func) { - case I810_INIT_DMA: - dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), - DRM_MEM_DRIVER); - if(dev_priv == NULL) DRM_OS_RETURN(ENOMEM); - retcode = i810_dma_initialize(dev, dev_priv, &init); - break; - case I810_CLEANUP_DMA: - retcode = i810_dma_cleanup(dev); - break; - default: - retcode = -EINVAL; - break; - } - - DRM_OS_RETURN(retcode); -} - - - -/* Most efficient way to verify state for the i810 is as it is - * emitted. Non-conformant state is silently dropped. - * - * Use 'volatile' & local var tmp to force the emitted values to be - * identical to the verified ones. - */ -static void i810EmitContextVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - int i, j = 0; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( I810_CTX_SETUP_SIZE ); - - OUT_RING( GFX_OP_COLOR_FACTOR ); - OUT_RING( code[I810_CTXREG_CF1] ); - - OUT_RING( GFX_OP_STIPPLE ); - OUT_RING( code[I810_CTXREG_ST1] ); - - for ( i = 4 ; i < I810_CTX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - - if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) - { - OUT_RING( tmp ); - j++; - } - } - - if (j & 1) - OUT_RING( 0 ); - - ADVANCE_LP_RING(); -} - -static void i810EmitTexVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - int i, j = 0; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( I810_TEX_SETUP_SIZE ); - - OUT_RING( GFX_OP_MAP_INFO ); - OUT_RING( code[I810_TEXREG_MI1] ); - OUT_RING( code[I810_TEXREG_MI2] ); - OUT_RING( code[I810_TEXREG_MI3] ); - - for ( i = 4 ; i < I810_TEX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - - if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) - { - OUT_RING( tmp ); - j++; - } - } - - if (j & 1) - OUT_RING( 0 ); - - ADVANCE_LP_RING(); -} - - -/* Need to do some additional checking when setting the dest buffer. - */ -static void i810EmitDestVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( I810_DEST_SETUP_SIZE + 2 ); - - tmp = code[I810_DESTREG_DI1]; - if (tmp == dev_priv->front_di1 || tmp == dev_priv->back_di1) { - OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( tmp ); - } else - DRM_DEBUG("bad di1 %x (allow %x or %x)\n", - tmp, dev_priv->front_di1, dev_priv->back_di1); - - /* invarient: - */ - OUT_RING( CMD_OP_Z_BUFFER_INFO ); - OUT_RING( dev_priv->zi1 ); - - OUT_RING( GFX_OP_DESTBUFFER_VARS ); - OUT_RING( code[I810_DESTREG_DV1] ); - - OUT_RING( GFX_OP_DRAWRECT_INFO ); - OUT_RING( code[I810_DESTREG_DR1] ); - OUT_RING( code[I810_DESTREG_DR2] ); - OUT_RING( code[I810_DESTREG_DR3] ); - OUT_RING( code[I810_DESTREG_DR4] ); - OUT_RING( 0 ); - - ADVANCE_LP_RING(); -} - - - -static void i810EmitState( drm_device_t *dev ) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - if (dirty & I810_UPLOAD_BUFFERS) { - i810EmitDestVerified( dev, sarea_priv->BufferState ); - sarea_priv->dirty &= ~I810_UPLOAD_BUFFERS; - } - - if (dirty & I810_UPLOAD_CTX) { - i810EmitContextVerified( dev, sarea_priv->ContextState ); - sarea_priv->dirty &= ~I810_UPLOAD_CTX; - } - - if (dirty & I810_UPLOAD_TEX0) { - i810EmitTexVerified( dev, sarea_priv->TexState[0] ); - sarea_priv->dirty &= ~I810_UPLOAD_TEX0; - } - - if (dirty & I810_UPLOAD_TEX1) { - i810EmitTexVerified( dev, sarea_priv->TexState[1] ); - sarea_priv->dirty &= ~I810_UPLOAD_TEX1; - } -} - - - -/* need to verify - */ -static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, - unsigned int clear_color, - unsigned int clear_zval ) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int pitch = dev_priv->pitch; - int cpp = 2; - int i; - RING_LOCALS; - - i810_kernel_lost_context(dev); - - if (nbox > I810_NR_SAREA_CLIPRECTS) - nbox = I810_NR_SAREA_CLIPRECTS; - - for (i = 0 ; i < nbox ; i++, pbox++) { - unsigned int x = pbox->x1; - unsigned int y = pbox->y1; - unsigned int width = (pbox->x2 - x) * cpp; - unsigned int height = pbox->y2 - y; - unsigned int start = y * pitch + x * cpp; - - if (pbox->x1 > pbox->x2 || - pbox->y1 > pbox->y2 || - pbox->x2 > dev_priv->w || - pbox->y2 > dev_priv->h) - continue; - - if ( flags & I810_FRONT ) { - DRM_DEBUG("clear front\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | - BR00_OP_COLOR_BLT | 0x3 ); - OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); - OUT_RING( (height << 16) | width ); - OUT_RING( start ); - OUT_RING( clear_color ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - } - - if ( flags & I810_BACK ) { - DRM_DEBUG("clear back\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | - BR00_OP_COLOR_BLT | 0x3 ); - OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); - OUT_RING( (height << 16) | width ); - OUT_RING( dev_priv->back_offset + start ); - OUT_RING( clear_color ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - } - - if ( flags & I810_DEPTH ) { - DRM_DEBUG("clear depth\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | - BR00_OP_COLOR_BLT | 0x3 ); - OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); - OUT_RING( (height << 16) | width ); - OUT_RING( dev_priv->depth_offset + start ); - OUT_RING( clear_zval ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - } - } -} - -static void i810_dma_dispatch_swap( drm_device_t *dev ) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int pitch = dev_priv->pitch; - int cpp = 2; - int ofs = dev_priv->back_offset; - int i; - RING_LOCALS; - - DRM_DEBUG("swapbuffers\n"); - - i810_kernel_lost_context(dev); - - if (nbox > I810_NR_SAREA_CLIPRECTS) - nbox = I810_NR_SAREA_CLIPRECTS; - - for (i = 0 ; i < nbox; i++, pbox++) - { - unsigned int w = pbox->x2 - pbox->x1; - unsigned int h = pbox->y2 - pbox->y1; - unsigned int dst = pbox->x1*cpp + pbox->y1*pitch; - unsigned int start = ofs + dst; - - if (pbox->x1 > pbox->x2 || - pbox->y1 > pbox->y2 || - pbox->x2 > dev_priv->w || - pbox->y2 > dev_priv->h) - continue; - - DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", - pbox[i].x1, pbox[i].y1, - pbox[i].x2, pbox[i].y2); - - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4 ); - OUT_RING( pitch | (0xCC << 16)); - OUT_RING( (h << 16) | (w * cpp)); - OUT_RING( dst ); - OUT_RING( pitch ); - OUT_RING( start ); - ADVANCE_LP_RING(); - } -} - - -static void i810_dma_dispatch_vertex(drm_device_t *dev, - drm_buf_t *buf, - int discard, - int used) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_clip_rect_t *box = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - unsigned long address = (unsigned long)buf->bus_address; - unsigned long start = address - dev->agp->base; - int i = 0; - char failed; - RING_LOCALS; - - i810_kernel_lost_context(dev); - - if (nbox > I810_NR_SAREA_CLIPRECTS) - nbox = I810_NR_SAREA_CLIPRECTS; - - if (discard) { - _DRM_CAS(buf_priv->in_use, I810_BUF_CLIENT, - I810_BUF_HARDWARE, failed); - if (failed) - DRM_DEBUG("xxxx 2\n"); - } - - if (used > 4*1024) - used = 0; - - if (sarea_priv->dirty) - i810EmitState( dev ); - - DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", - address, used, nbox); - - dev_priv->counter++; - DRM_DEBUG( "dispatch counter : %ld\n", dev_priv->counter); - DRM_DEBUG( "i810_dma_dispatch\n"); - DRM_DEBUG( "start : %lx\n", start); - DRM_DEBUG( "used : %d\n", used); - DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); - - if (buf_priv->currently_mapped == I810_BUF_MAPPED) { - *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | - sarea_priv->vertex_prim | - ((used/4)-2)); - - if (used & 4) { - *(u32 *)((u32)buf_priv->virtual + used) = 0; - used += 4; - } - - i810_unmap_buffer(buf); - } - - if (used) { - do { - if (i < nbox) { - BEGIN_LP_RING(4); - OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR | - SC_ENABLE ); - OUT_RING( GFX_OP_SCISSOR_INFO ); - OUT_RING( box[i].x1 | (box[i].y1<<16) ); - OUT_RING( (box[i].x2-1) | ((box[i].y2-1)<<16) ); - ADVANCE_LP_RING(); - } - - BEGIN_LP_RING(4); - OUT_RING( CMD_OP_BATCH_BUFFER ); - OUT_RING( start | BB1_PROTECTED ); - OUT_RING( start + used - 4 ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - - } while (++i < nbox); - } - - BEGIN_LP_RING(10); - OUT_RING( CMD_STORE_DWORD_IDX ); - OUT_RING( 20 ); - OUT_RING( dev_priv->counter ); - OUT_RING( 0 ); - - if (discard) { - OUT_RING( CMD_STORE_DWORD_IDX ); - OUT_RING( buf_priv->my_use_idx ); - OUT_RING( I810_BUF_FREE ); - OUT_RING( 0 ); - } - - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); -} - - -/* Interrupts are only for flushing */ -void i810_dma_service(int irq, void *device, struct pt_regs *regs) -{ - drm_device_t *dev = (drm_device_t *)device; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u16 temp; - - atomic_inc(&dev->counts[_DRM_STAT_IRQ]); - temp = I810_READ16(I810REG_INT_IDENTITY_R); - temp = temp & ~(0x6000); - if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, - temp); /* Clear all interrupts */ - else - return; - - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -void i810_dma_immediate_bh(void *device) -{ - drm_device_t *dev = (drm_device_t *) device; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - - atomic_set(&dev_priv->flush_done, 1); - DRM_OS_WAKEUP_INT(&dev_priv->flush_queue); -} - -static inline void i810_dma_emit_flush(drm_device_t *dev) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - - i810_kernel_lost_context(dev); - - BEGIN_LP_RING(2); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( GFX_OP_USER_INTERRUPT ); - ADVANCE_LP_RING(); - -/* i810_wait_ring( dev, dev_priv->ring.Size - 8 ); */ -/* atomic_set(&dev_priv->flush_done, 1); */ -/* DRM_OS_WAKEUP_INT(&dev_priv->flush_queue); */ -} - -static inline void i810_dma_quiescent_emit(drm_device_t *dev) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - - i810_kernel_lost_context(dev); - - BEGIN_LP_RING(4); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - OUT_RING( GFX_OP_USER_INTERRUPT ); - ADVANCE_LP_RING(); - -/* i810_wait_ring( dev, dev_priv->ring.Size - 8 ); */ -/* atomic_set(&dev_priv->flush_done, 1); */ -/* DRM_OS_WAKEUP_INT(&dev_priv->flush_queue); */ -} - -void i810_dma_quiescent(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - unsigned long end; - - if(dev_priv == NULL) { - return; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i810_dma_quiescent_emit(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - break; - } - } - - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - - return; -} - -static int i810_flush_queue(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; - unsigned long end; - int i, ret = 0; - - if(dev_priv == NULL) { - return 0; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i810_dma_emit_flush(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - break; - } - } - - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - - char failed; - _DRM_CAS(buf_priv->in_use, I810_BUF_HARDWARE, - I810_BUF_FREE, failed); - - if (!failed) - DRM_DEBUG("reclaimed from HARDWARE\n"); - if (used == I810_BUF_CLIENT) - DRM_DEBUG("still on client HARDWARE\n"); - } - - return ret; -} - -/* Must be called with the lock held */ -void i810_reclaim_buffers(drm_device_t *dev, pid_t pid) -{ - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma) return; - if (!dev->dev_private) return; - if (!dma->buflist) return; - - i810_flush_queue(dev); - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - - if (buf->pid == pid && buf_priv) { - char failed; - _DRM_CAS(buf_priv->in_use, I810_BUF_CLIENT, - I810_BUF_FREE, failed); - - if (!failed) - - DRM_DEBUG("reclaimed from client\n"); - if(buf_priv->currently_mapped == I810_BUF_MAPPED) - buf_priv->currently_mapped = I810_BUF_UNMAPPED; - } - } -} - -int i810_flush_ioctl( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - - DRM_DEBUG("i810_flush_ioctl\n"); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_flush_ioctl called without lock held\n"); - DRM_OS_RETURN( EINVAL ); - } - - i810_flush_queue(dev); - return 0; -} - - -int i810_dma_vertex( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; - drm_i810_vertex_t vertex; - - DRM_OS_KRNFROMUSR( vertex, (drm_i810_vertex_t *) data, sizeof(vertex) ); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma_vertex called without lock held\n"); - DRM_OS_RETURN( EINVAL ); - } - - DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", - vertex.idx, vertex.used, vertex.discard); - - if(vertex.idx < 0 || vertex.idx > dma->buf_count) DRM_OS_RETURN(EINVAL); - - i810_dma_dispatch_vertex( dev, - dma->buflist[ vertex.idx ], - vertex.discard, vertex.used ); - - atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]); - atomic_inc(&dev->counts[_DRM_STAT_DMA]); - sarea_priv->last_enqueue = dev_priv->counter-1; - sarea_priv->last_dispatch = (int) hw_status[5]; - - return 0; -} - - - -int i810_clear_bufs( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_i810_clear_t clear; - - DRM_OS_KRNFROMUSR( clear, (drm_i810_clear_t *) data, sizeof(clear) ); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_clear_bufs called without lock held\n"); - DRM_OS_RETURN( EINVAL ); - } - - /* GH: Someone's doing nasty things... */ - if (!dev->dev_private) { - DRM_OS_RETURN(EINVAL); - } - - i810_dma_dispatch_clear( dev, clear.flags, - clear.clear_color, - clear.clear_depth ); - return 0; -} - -int i810_swap_bufs( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - - DRM_DEBUG("i810_swap_bufs\n"); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_swap_buf called without lock held\n"); - DRM_OS_RETURN( EINVAL ); - } - - i810_dma_dispatch_swap( dev ); - return 0; -} - -int i810_getage( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; - - sarea_priv->last_dispatch = (int) hw_status[5]; - return 0; -} - -int i810_getbuf( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - int retcode = 0; - drm_i810_dma_t d; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; - - DRM_DEBUG("getbuf\n"); - DRM_OS_KRNFROMUSR( d, (drm_i810_dma_t *) data, sizeof(d) ); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma called without lock held\n"); - DRM_OS_RETURN( EINVAL ); - } - - d.granted = 0; - - retcode = i810_dma_get_buffer(dev, &d, filp); - - DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", - DRM_OS_CURRENTPID, retcode, d.granted); - - DRM_OS_KRNTOUSR( (drm_dma_t *) data, d, sizeof(d) ); - sarea_priv->last_dispatch = (int) hw_status[5]; - - DRM_OS_RETURN(retcode); -} - -int i810_copybuf( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_i810_copy_t d; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; - drm_buf_t *buf; - drm_i810_buf_priv_t *buf_priv; - drm_device_dma_t *dma = dev->dma; - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma called without lock held\n"); - DRM_OS_RETURN( EINVAL ); - } - - DRM_OS_KRNFROMUSR( d, (drm_i810_copy_t *) data, sizeof(d) ); - - if(d.idx < 0 || d.idx > dma->buf_count) DRM_OS_RETURN(EINVAL); - buf = dma->buflist[ d.idx ]; - buf_priv = buf->dev_private; - if (buf_priv->currently_mapped != I810_BUF_MAPPED) DRM_OS_RETURN(EPERM); - if(d.used < 0 || d.used > buf->total) DRM_OS_RETURN(EINVAL); - - if (DRM_OS_COPYFROMUSR(buf_priv->virtual, d.address, d.used)) - DRM_OS_RETURN( EFAULT ); - - sarea_priv->last_dispatch = (int) hw_status[5]; - - return 0; -} - -int i810_docopy( DRM_OS_IOCTL ) -{ - if(VM_DONTCOPY == 0) return 1; - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c:1.2 Thu Dec 27 21:27:37 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c Thu Feb 27 12:32:24 2003 @@ -1,95 +0,0 @@ -/* i810_drv.c -- I810 driver -*- linux-c -*- - * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> - -#include "i810.h" -#include "drmP.h" -#include "i810_drv.h" - -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "i810" -#define DRIVER_DESC "Intel i810" -#define DRIVER_DATE "20010616" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 - -/* Device IDs unknown. Can someone help? anholt@teleport.com */ -drm_chipinfo_t DRM(devicelist)[] = { - {0, 0, 0, NULL} -}; - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, - - -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - - -#include "drm_agpsupport.h" -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_lists.h" -#include "drm_memory.h" -#include "drm_vm.h" -#include "drm_sysctl.h" - -DRIVER_MODULE(i810, pci, i810_driver, i810_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h Thu Feb 27 12:32:24 2003 @@ -1,179 +0,0 @@ -/* i810_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#ifndef _I810_DRV_H_ -#define _I810_DRV_H_ - -typedef struct drm_i810_buf_priv { - u32 *in_use; - int my_use_idx; - int currently_mapped; - void *virtual; - void *kernel_virtual; - int map_count; - struct vm_area_struct *vma; -} drm_i810_buf_priv_t; - -typedef struct _drm_i810_ring_buffer{ - int tail_mask; - unsigned long Start; - unsigned long End; - unsigned long Size; - u8 *virtual_start; - int head; - int tail; - int space; -} drm_i810_ring_buffer_t; - -typedef struct drm_i810_private { - drm_map_t *sarea_map; - drm_map_t *buffer_map; - drm_map_t *mmio_map; - - drm_i810_sarea_t *sarea_priv; - drm_i810_ring_buffer_t ring; - - unsigned long hw_status_page; - unsigned long counter; - - atomic_t flush_done; - wait_queue_head_t flush_queue; /* Processes waiting until flush */ - drm_buf_t *mmap_buffer; - - - u32 front_di1, back_di1, zi1; - - int back_offset; - int depth_offset; - int w, h; - int pitch; -} drm_i810_private_t; - - /* i810_dma.c */ -extern int i810_dma_schedule(drm_device_t *dev, int locked); -extern int i810_getbuf( DRM_OS_IOCTL ); -extern int i810_dma_init( DRM_OS_IOCTL ); -extern int i810_flush_ioctl( DRM_OS_IOCTL ); -extern int i810_getage( DRM_OS_IOCTL ); -extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); -extern int i810_copybuf( DRM_OS_IOCTL ); -extern int i810_docopy( DRM_OS_IOCTL ); - -extern void i810_dma_quiescent(drm_device_t *dev); - -#define I810_VERBOSE 0 - - -int i810_dma_vertex( DRM_OS_IOCTL ); -int i810_swap_bufs( DRM_OS_IOCTL ); -int i810_clear_bufs( DRM_OS_IOCTL ); - -#define I810_BASE(reg) ((unsigned long) \ - dev_priv->mmio_map->handle) -#define I810_ADDR(reg) (I810_BASE(reg) + reg) -#define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) -#define I810_READ(reg) I810_DEREF(reg) -#define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) -#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) -#define I810_READ16(reg) I810_DEREF16(reg) -#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) - - -#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) -#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) -#define CMD_REPORT_HEAD (7<<23) -#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1) -#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1) - -#define INST_PARSER_CLIENT 0x00000000 -#define INST_OP_FLUSH 0x02000000 -#define INST_FLUSH_MAP_CACHE 0x00000001 - - -#define BB1_START_ADDR_MASK (~0x7) -#define BB1_PROTECTED (1<<0) -#define BB1_UNPROTECTED (0<<0) -#define BB2_END_ADDR_MASK (~0x7) - -#define I810REG_HWSTAM 0x02098 -#define I810REG_INT_IDENTITY_R 0x020a4 -#define I810REG_INT_MASK_R 0x020a8 -#define I810REG_INT_ENABLE_R 0x020a0 - -#define LP_RING 0x2030 -#define HP_RING 0x2040 -#define RING_TAIL 0x00 -#define TAIL_ADDR 0x000FFFF8 -#define RING_HEAD 0x04 -#define HEAD_WRAP_COUNT 0xFFE00000 -#define HEAD_WRAP_ONE 0x00200000 -#define HEAD_ADDR 0x001FFFFC -#define RING_START 0x08 -#define START_ADDR 0x00FFFFF8 -#define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 -#define RING_REPORT_MASK 0x00000006 -#define RING_REPORT_64K 0x00000002 -#define RING_REPORT_128K 0x00000004 -#define RING_NO_REPORT 0x00000000 -#define RING_VALID_MASK 0x00000001 -#define RING_VALID 0x00000001 -#define RING_INVALID 0x00000000 - -#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19)) -#define SC_UPDATE_SCISSOR (0x1<<1) -#define SC_ENABLE_MASK (0x1<<0) -#define SC_ENABLE (0x1<<0) - -#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1)) -#define SCI_YMIN_MASK (0xffff<<16) -#define SCI_XMIN_MASK (0xffff<<0) -#define SCI_YMAX_MASK (0xffff<<16) -#define SCI_XMAX_MASK (0xffff<<0) - -#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0) -#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) -#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x2) -#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0) -#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) -#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24)) - -#define CMD_OP_Z_BUFFER_INFO ((0x0<<29)|(0x16<<23)) -#define CMD_OP_DESTBUFFER_INFO ((0x0<<29)|(0x15<<23)) - -#define BR00_BITBLT_CLIENT 0x40000000 -#define BR00_OP_COLOR_BLT 0x10000000 -#define BR00_OP_SRC_COPY_BLT 0x10C00000 -#define BR13_SOLID_PATTERN 0x80000000 - - - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile:1.1 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile Thu Feb 27 12:32:24 2003 @@ -1,25 +0,0 @@ -# $FreeBSD$ - -KMOD= i830 -NOMAN= YES -SRCS= i830_drv.c i830_dma.c -SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h -CFLAGS+= ${DEBUG_FLAGS} -I. -I.. - -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine - -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#I830_OPTS= "\#define DRM_LINUX" 1 -.endif - -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(I830_OPTS) >> opt_drm_linux.h - -.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h:1.1 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h Thu Feb 27 12:32:24 2003 @@ -1,116 +0,0 @@ -/* i830.h -- Intel I830 DRM template customization -*- linux-c -*- - * Created: Thu Feb 15 00:01:12 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __I830_H__ -#define __I830_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) i830_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -/* Driver customization: - */ -#define __HAVE_RELEASE 1 -#define DRIVER_RELEASE() do { \ - i830_reclaim_buffers( dev, priv->pid ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_DMA_QUEUE 1 -#define __HAVE_DMA_WAITLIST 1 -#define __HAVE_DMA_RECLAIM 1 - -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - i830_dma_quiescent( dev ); \ -} while (0) - -#define __HAVE_DMA_IRQ 1 -#define __HAVE_DMA_IRQ_BH 1 -#define __HAVE_SHARED_IRQ 1 -#define DRIVER_PREINSTALL() do { \ - drm_i830_private_t *dev_priv = \ - (drm_i830_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I830_READ16( I830REG_HWSTAM ); \ - tmp = tmp & 0x6000; \ - I830_WRITE16( I830REG_HWSTAM, tmp ); \ - \ - tmp = I830_READ16( I830REG_INT_MASK_R ); \ - tmp = tmp & 0x6000; /* Unmask interrupts */ \ - I830_WRITE16( I830REG_INT_MASK_R, tmp ); \ - tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ -} while (0) - -#define DRIVER_POSTINSTALL() do { \ - drm_i830_private_t *dev_priv = \ - (drm_i830_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; \ - tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ - I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ -} while (0) - -#define DRIVER_UNINSTALL() do { \ - drm_i830_private_t *dev_priv = \ - (drm_i830_private_t *)dev->dev_private; \ - u16 tmp; \ - if ( dev_priv ) { \ - tmp = I830_READ16( I830REG_INT_IDENTITY_R ); \ - tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ - if ( tmp != 0 ) \ - I830_WRITE16( I830REG_INT_IDENTITY_R, tmp ); \ - \ - tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ - } \ -} while (0) - -/* Buffer customization: - */ - -#define DRIVER_BUF_PRIV_T drm_i830_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_i830_private_t *)((dev)->dev_private))->buffer_map - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c:1.1 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c Thu Feb 27 12:32:24 2003 @@ -1,1418 +0,0 @@ -/* i830_dma.c -- DMA support for the I830 -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * Abraham vd Merwe <abraham@2d3d.co.za> - * - */ - -#define __NO_VERSION__ -#include "i830.h" -#include "drmP.h" -#include "i830_drv.h" -#include <linux/interrupt.h> /* For task queue support */ - -/* in case we don't have a 2.3.99-pre6 kernel or later: */ -#ifndef VM_DONTCOPY -#define VM_DONTCOPY 0 -#endif - -#define I830_BUF_FREE 2 -#define I830_BUF_CLIENT 1 -#define I830_BUF_HARDWARE 0 - -#define I830_BUF_UNMAPPED 0 -#define I830_BUF_MAPPED 1 - -#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; - - -#define DO_IDLE_WORKAROUND() \ -do { \ - int _head; \ - int _tail; \ - int _i; \ - do { \ - _head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; \ - _tail = I830_READ(LP_RING + RING_TAIL) & TAIL_ADDR; \ - for(_i = 0; _i < 65535; _i++); \ - } while(_head != _tail); \ -} while(0) - -#define I830_SYNC_WORKAROUND 0 - -#define BEGIN_LP_RING(n) do { \ - if (I830_VERBOSE) \ - DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ - n, __FUNCTION__); \ - if (I830_SYNC_WORKAROUND) \ - DO_IDLE_WORKAROUND(); \ - if (dev_priv->ring.space < n*4) \ - i830_wait_ring(dev, n*4); \ - dev_priv->ring.space -= n*4; \ - outring = dev_priv->ring.tail; \ - ringmask = dev_priv->ring.tail_mask; \ - virt = dev_priv->ring.virtual_start; \ -} while (0) - -#define ADVANCE_LP_RING() do { \ - if (I830_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ - dev_priv->ring.tail = outring; \ - I830_WRITE(LP_RING + RING_TAIL, outring); \ -} while(0) - -#define OUT_RING(n) do { \ - if (I830_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; \ - outring &= ringmask; \ -} while (0); - -static inline void i830_print_status_page(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - drm_i830_private_t *dev_priv = dev->dev_private; - u32 *temp = (u32 *)dev_priv->hw_status_page; - int i; - - DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); - DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); - DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); - DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); - DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); - for(i = 9; i < dma->buf_count + 9; i++) { - DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 9, temp[i]); - } -} - -static drm_buf_t *i830_freelist_get(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - int i; - int used; - - /* Linear search might not be the best solution */ - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - /* In use is already a pointer */ - used = cmpxchg(buf_priv->in_use, I830_BUF_FREE, - I830_BUF_CLIENT); - if(used == I830_BUF_FREE) { - return buf; - } - } - return NULL; -} - -/* This should only be called if the buffer is not sent to the hardware - * yet, the hardware updates in use for us once its on the ring buffer. - */ - -static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf) -{ - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - int used; - - /* In use is already a pointer */ - used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, I830_BUF_FREE); - if(used != I830_BUF_CLIENT) { - DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); - return -EINVAL; - } - - return 0; -} - -static struct file_operations i830_buffer_fops = { - open: DRM(open), - flush: DRM(flush), - release: DRM(release), - ioctl: DRM(ioctl), - mmap: i830_mmap_buffers, - read: DRM(read), - fasync: DRM(fasync), - poll: DRM(poll), -}; - -int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - drm_i830_private_t *dev_priv; - drm_buf_t *buf; - drm_i830_buf_priv_t *buf_priv; - - lock_kernel(); - dev = priv->dev; - dev_priv = dev->dev_private; - buf = dev_priv->mmap_buffer; - buf_priv = buf->dev_private; - - vma->vm_flags |= (VM_IO | VM_DONTCOPY); - vma->vm_file = filp; - - buf_priv->currently_mapped = I830_BUF_MAPPED; - unlock_kernel(); - - if (remap_page_range(vma->vm_start, - VM_OFFSET(vma), - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) return -EAGAIN; - return 0; -} - -static int i830_map_buffer(drm_buf_t *buf, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - drm_i830_private_t *dev_priv = dev->dev_private; - struct file_operations *old_fops; - int retcode = 0; - - if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL; - - if(VM_DONTCOPY != 0) { -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - old_fops = filp->f_op; - filp->f_op = &i830_buffer_fops; - dev_priv->mmap_buffer = buf; - buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, - PROT_READ|PROT_WRITE, - MAP_SHARED, - buf->bus_address); - dev_priv->mmap_buffer = NULL; - filp->f_op = old_fops; - if ((unsigned long)buf_priv->virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed int)buf_priv->virtual; - buf_priv->virtual = 0; - } -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } else { - buf_priv->virtual = buf_priv->kernel_virtual; - buf_priv->currently_mapped = I830_BUF_MAPPED; - } - return retcode; -} - -static int i830_unmap_buffer(drm_buf_t *buf) -{ - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - int retcode = 0; - - if(VM_DONTCOPY != 0) { - if(buf_priv->currently_mapped != I830_BUF_MAPPED) - return -EINVAL; -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif -#if LINUX_VERSION_CODE < 0x020399 - retcode = do_munmap((unsigned long)buf_priv->virtual, - (size_t) buf->total); -#else - retcode = do_munmap(current->mm, - (unsigned long)buf_priv->virtual, - (size_t) buf->total); -#endif -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } - buf_priv->currently_mapped = I830_BUF_UNMAPPED; - buf_priv->virtual = 0; - - return retcode; -} - -static int i830_dma_get_buffer(drm_device_t *dev, drm_i830_dma_t *d, - struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_buf_t *buf; - drm_i830_buf_priv_t *buf_priv; - int retcode = 0; - - buf = i830_freelist_get(dev); - if (!buf) { - retcode = -ENOMEM; - DRM_DEBUG("retcode=%d\n", retcode); - return retcode; - } - - retcode = i830_map_buffer(buf, filp); - if(retcode) { - i830_freelist_put(dev, buf); - DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); - return retcode; - } - buf->pid = priv->pid; - buf_priv = buf->dev_private; - d->granted = 1; - d->request_idx = buf->idx; - d->request_size = buf->total; - d->virtual = buf_priv->virtual; - - return retcode; -} - -static unsigned long i830_alloc_page(drm_device_t *dev) -{ - unsigned long address; - - address = __get_free_page(GFP_KERNEL); - if(address == 0UL) - return 0; - - atomic_inc(&virt_to_page(address)->count); - set_bit(PG_locked, &virt_to_page(address)->flags); - - return address; -} - -static void i830_free_page(drm_device_t *dev, unsigned long page) -{ - if(page == 0UL) - return; - - atomic_dec(&virt_to_page(page)->count); - clear_bit(PG_locked, &virt_to_page(page)->flags); - wake_up(&virt_to_page(page)->wait); - free_page(page); - return; -} - -static int i830_dma_cleanup(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - - if(dev->dev_private) { - int i; - drm_i830_private_t *dev_priv = - (drm_i830_private_t *) dev->dev_private; - - if(dev_priv->ring.virtual_start) { - DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, - dev_priv->ring.Size); - } - if(dev_priv->hw_status_page != 0UL) { - i830_free_page(dev, dev_priv->hw_status_page); - /* Need to rewrite hardware status page */ - I830_WRITE(0x02080, 0x1ffff000); - } - DRM(free)(dev->dev_private, sizeof(drm_i830_private_t), - DRM_MEM_DRIVER); - dev->dev_private = NULL; - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total); - } - } - return 0; -} - -static int i830_wait_ring(drm_device_t *dev, int n) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - drm_i830_ring_buffer_t *ring = &(dev_priv->ring); - int iters = 0; - unsigned long end; - unsigned int last_head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - - end = jiffies + (HZ*3); - while (ring->space < n) { - int i; - - ring->head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->space = ring->head - (ring->tail+8); - if (ring->space < 0) ring->space += ring->Size; - - if (ring->head != last_head) { - end = jiffies + (HZ*3); - last_head = ring->head; - } - - iters++; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("space: %d wanted %d\n", ring->space, n); - DRM_ERROR("lockup\n"); - goto out_wait_ring; - } - - for (i = 0 ; i < 2000 ; i++) ; - } - -out_wait_ring: - return iters; -} - -static void i830_kernel_lost_context(drm_device_t *dev) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - drm_i830_ring_buffer_t *ring = &(dev_priv->ring); - - ring->head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->tail = I830_READ(LP_RING + RING_TAIL); - ring->space = ring->head - (ring->tail+8); - if (ring->space < 0) ring->space += ring->Size; -} - -static int i830_freelist_init(drm_device_t *dev, drm_i830_private_t *dev_priv) -{ - drm_device_dma_t *dma = dev->dma; - int my_idx = 36; - u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); - int i; - - if(dma->buf_count > 1019) { - /* Not enough space in the status page for the freelist */ - return -EINVAL; - } - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - - buf_priv->in_use = hw_status++; - buf_priv->my_use_idx = my_idx; - my_idx += 4; - - *buf_priv->in_use = I830_BUF_FREE; - - buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, - buf->total); - } - return 0; -} - -static int i830_dma_initialize(drm_device_t *dev, - drm_i830_private_t *dev_priv, - drm_i830_init_t *init) -{ - struct list_head *list; - - memset(dev_priv, 0, sizeof(drm_i830_private_t)); - - list_for_each(list, &dev->maplist->head) { - drm_map_list_t *r_list = (drm_map_list_t *)list; - if( r_list->map && - r_list->map->type == _DRM_SHM && - r_list->map->flags & _DRM_CONTAINS_LOCK ) { - dev_priv->sarea_map = r_list->map; - break; - } - } - - if(!dev_priv->sarea_map) { - dev->dev_private = (void *)dev_priv; - i830_dma_cleanup(dev); - DRM_ERROR("can not find sarea!\n"); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); - if(!dev_priv->mmio_map) { - dev->dev_private = (void *)dev_priv; - i830_dma_cleanup(dev); - DRM_ERROR("can not find mmio map!\n"); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); - if(!dev_priv->buffer_map) { - dev->dev_private = (void *)dev_priv; - i830_dma_cleanup(dev); - DRM_ERROR("can not find dma buffer map!\n"); - return -EINVAL; - } - - dev_priv->sarea_priv = (drm_i830_sarea_t *) - ((u8 *)dev_priv->sarea_map->handle + - init->sarea_priv_offset); - - atomic_set(&dev_priv->flush_done, 0); - init_waitqueue_head(&dev_priv->flush_queue); - - dev_priv->ring.Start = init->ring_start; - dev_priv->ring.End = init->ring_end; - dev_priv->ring.Size = init->ring_size; - - dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + - init->ring_start, - init->ring_size); - - if (dev_priv->ring.virtual_start == NULL) { - dev->dev_private = (void *) dev_priv; - i830_dma_cleanup(dev); - DRM_ERROR("can not ioremap virtual address for" - " ring buffer\n"); - return -ENOMEM; - } - - dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; - - dev_priv->w = init->w; - dev_priv->h = init->h; - dev_priv->pitch = init->pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->depth_offset = init->depth_offset; - - dev_priv->front_di1 = init->front_offset | init->pitch_bits; - dev_priv->back_di1 = init->back_offset | init->pitch_bits; - dev_priv->zi1 = init->depth_offset | init->pitch_bits; - - dev_priv->cpp = init->cpp; - /* We are using seperate values as placeholders for mechanisms for - * private backbuffer/depthbuffer usage. - */ - - dev_priv->back_pitch = init->back_pitch; - dev_priv->depth_pitch = init->depth_pitch; - - /* Program Hardware Status Page */ - dev_priv->hw_status_page = i830_alloc_page(dev); - if(dev_priv->hw_status_page == 0UL) { - dev->dev_private = (void *)dev_priv; - i830_dma_cleanup(dev); - DRM_ERROR("Can not allocate hardware status page\n"); - return -ENOMEM; - } - memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); - DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); - - I830_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page)); - DRM_DEBUG("Enabled hardware status page\n"); - - /* Now we need to init our freelist */ - if(i830_freelist_init(dev, dev_priv) != 0) { - dev->dev_private = (void *)dev_priv; - i830_dma_cleanup(dev); - DRM_ERROR("Not enough space in the status page for" - " the freelist\n"); - return -ENOMEM; - } - dev->dev_private = (void *)dev_priv; - - return 0; -} - -int i830_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i830_private_t *dev_priv; - drm_i830_init_t init; - int retcode = 0; - - if (copy_from_user(&init, (drm_i830_init_t *)arg, sizeof(init))) - return -EFAULT; - - switch(init.func) { - case I830_INIT_DMA: - dev_priv = DRM(alloc)(sizeof(drm_i830_private_t), - DRM_MEM_DRIVER); - if(dev_priv == NULL) return -ENOMEM; - retcode = i830_dma_initialize(dev, dev_priv, &init); - break; - case I830_CLEANUP_DMA: - retcode = i830_dma_cleanup(dev); - break; - default: - retcode = -EINVAL; - break; - } - - return retcode; -} - -/* Most efficient way to verify state for the i830 is as it is - * emitted. Non-conformant state is silently dropped. - * - * Use 'volatile' & local var tmp to force the emitted values to be - * identical to the verified ones. - */ -static void i830EmitContextVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - int i, j = 0; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( I830_CTX_SETUP_SIZE ); - for ( i = 0 ; i < I830_CTX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - -#if 0 - if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); - j++; - } else { - printk("Skipping %d\n", i); - } -#else - OUT_RING( tmp ); - j++; -#endif - } - - if (j & 1) - OUT_RING( 0 ); - - ADVANCE_LP_RING(); -} - -static void i830EmitTexVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - int i, j = 0; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( I830_TEX_SETUP_SIZE ); - - OUT_RING( GFX_OP_MAP_INFO ); - OUT_RING( code[I830_TEXREG_MI1] ); - OUT_RING( code[I830_TEXREG_MI2] ); - OUT_RING( code[I830_TEXREG_MI3] ); - OUT_RING( code[I830_TEXREG_MI4] ); - OUT_RING( code[I830_TEXREG_MI5] ); - - for ( i = 6 ; i < I830_TEX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - OUT_RING( tmp ); - j++; - } - - if (j & 1) - OUT_RING( 0 ); - - ADVANCE_LP_RING(); -} - -static void i830EmitTexBlendVerified( drm_device_t *dev, - volatile unsigned int *code, - volatile unsigned int num) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - int i, j = 0; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( num ); - - for ( i = 0 ; i < num ; i++ ) { - tmp = code[i]; - OUT_RING( tmp ); - j++; - } - - if (j & 1) - OUT_RING( 0 ); - - ADVANCE_LP_RING(); -} - -static void i830EmitTexPalette( drm_device_t *dev, - unsigned int *palette, - int number, - int is_shared ) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - int i; - RING_LOCALS; - - BEGIN_LP_RING( 258 ); - - if(is_shared == 1) { - OUT_RING(CMD_OP_MAP_PALETTE_LOAD | - MAP_PALETTE_NUM(0) | - MAP_PALETTE_BOTH); - } else { - OUT_RING(CMD_OP_MAP_PALETTE_LOAD | MAP_PALETTE_NUM(number)); - } - for(i = 0; i < 256; i++) { - OUT_RING(palette[i]); - } - OUT_RING(0); -} - -/* Need to do some additional checking when setting the dest buffer. - */ -static void i830EmitDestVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - unsigned int tmp; - RING_LOCALS; - - BEGIN_LP_RING( I830_DEST_SETUP_SIZE + 6 ); - - tmp = code[I830_DESTREG_CBUFADDR]; - if (tmp == dev_priv->front_di1) { - /* Don't use fence when front buffer rendering */ - OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( BUF_3D_ID_COLOR_BACK | - BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) ); - OUT_RING( tmp ); - - OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( BUF_3D_ID_DEPTH | - BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); - OUT_RING( dev_priv->zi1 ); - } else if(tmp == dev_priv->back_di1) { - OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( BUF_3D_ID_COLOR_BACK | - BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) | - BUF_3D_USE_FENCE); - OUT_RING( tmp ); - - OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( BUF_3D_ID_DEPTH | BUF_3D_USE_FENCE | - BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); - OUT_RING( dev_priv->zi1 ); - } else { - DRM_DEBUG("bad di1 %x (allow %x or %x)\n", - tmp, dev_priv->front_di1, dev_priv->back_di1); - } - - /* invarient: - */ - - - OUT_RING( GFX_OP_DESTBUFFER_VARS ); - OUT_RING( code[I830_DESTREG_DV1] ); - - OUT_RING( GFX_OP_DRAWRECT_INFO ); - OUT_RING( code[I830_DESTREG_DR1] ); - OUT_RING( code[I830_DESTREG_DR2] ); - OUT_RING( code[I830_DESTREG_DR3] ); - OUT_RING( code[I830_DESTREG_DR4] ); - - /* Need to verify this */ - tmp = code[I830_DESTREG_SENABLE]; - if((tmp & ~0x3) == GFX_OP_SCISSOR_ENABLE) { - OUT_RING( tmp ); - } else { - DRM_DEBUG("bad scissor enable\n"); - OUT_RING( 0 ); - } - - OUT_RING( code[I830_DESTREG_SENABLE] ); - - OUT_RING( GFX_OP_SCISSOR_RECT ); - OUT_RING( code[I830_DESTREG_SR1] ); - OUT_RING( code[I830_DESTREG_SR2] ); - - ADVANCE_LP_RING(); -} - -static void i830EmitState( drm_device_t *dev ) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - if (dirty & I830_UPLOAD_BUFFERS) { - i830EmitDestVerified( dev, sarea_priv->BufferState ); - sarea_priv->dirty &= ~I830_UPLOAD_BUFFERS; - } - - if (dirty & I830_UPLOAD_CTX) { - i830EmitContextVerified( dev, sarea_priv->ContextState ); - sarea_priv->dirty &= ~I830_UPLOAD_CTX; - } - - if (dirty & I830_UPLOAD_TEX0) { - i830EmitTexVerified( dev, sarea_priv->TexState[0] ); - sarea_priv->dirty &= ~I830_UPLOAD_TEX0; - } - - if (dirty & I830_UPLOAD_TEX1) { - i830EmitTexVerified( dev, sarea_priv->TexState[1] ); - sarea_priv->dirty &= ~I830_UPLOAD_TEX1; - } - - if (dirty & I830_UPLOAD_TEXBLEND0) { - i830EmitTexBlendVerified( dev, sarea_priv->TexBlendState[0], - sarea_priv->TexBlendStateWordsUsed[0]); - sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND0; - } - - if (dirty & I830_UPLOAD_TEXBLEND1) { - i830EmitTexBlendVerified( dev, sarea_priv->TexBlendState[1], - sarea_priv->TexBlendStateWordsUsed[1]); - sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND1; - } - - if (dirty & I830_UPLOAD_TEX_PALETTE_SHARED) { - i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 1); - } else { - if (dirty & I830_UPLOAD_TEX_PALETTE_N(0)) { - i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 0); - sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(0); - } - if (dirty & I830_UPLOAD_TEX_PALETTE_N(1)) { - i830EmitTexPalette(dev, sarea_priv->Palette[1], 1, 0); - sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(1); - } - } -} - -static void i830_dma_dispatch_clear( drm_device_t *dev, int flags, - unsigned int clear_color, - unsigned int clear_zval, - unsigned int clear_depthmask) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int pitch = dev_priv->pitch; - int cpp = dev_priv->cpp; - int i; - unsigned int BR13, CMD, D_CMD; - RING_LOCALS; - - i830_kernel_lost_context(dev); - - switch(cpp) { - case 2: - BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24); - D_CMD = CMD = XY_COLOR_BLT_CMD; - break; - case 4: - BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24) | (1<<25); - CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | - XY_COLOR_BLT_WRITE_RGB); - D_CMD = XY_COLOR_BLT_CMD; - if(clear_depthmask & 0x00ffffff) - D_CMD |= XY_COLOR_BLT_WRITE_RGB; - if(clear_depthmask & 0xff000000) - D_CMD |= XY_COLOR_BLT_WRITE_ALPHA; - break; - default: - BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24); - D_CMD = CMD = XY_COLOR_BLT_CMD; - break; - } - - if (nbox > I830_NR_SAREA_CLIPRECTS) - nbox = I830_NR_SAREA_CLIPRECTS; - - for (i = 0 ; i < nbox ; i++, pbox++) { - if (pbox->x1 > pbox->x2 || - pbox->y1 > pbox->y2 || - pbox->x2 > dev_priv->w || - pbox->y2 > dev_priv->h) - continue; - - if ( flags & I830_FRONT ) { - DRM_DEBUG("clear front\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( CMD ); - OUT_RING( BR13 ); - OUT_RING( (pbox->y1 << 16) | pbox->x1 ); - OUT_RING( (pbox->y2 << 16) | pbox->x2 ); - OUT_RING( 0 ); - OUT_RING( clear_color ); - ADVANCE_LP_RING(); - } - - if ( flags & I830_BACK ) { - DRM_DEBUG("clear back\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( CMD ); - OUT_RING( BR13 ); - OUT_RING( (pbox->y1 << 16) | pbox->x1 ); - OUT_RING( (pbox->y2 << 16) | pbox->x2 ); - OUT_RING( dev_priv->back_offset ); - OUT_RING( clear_color ); - ADVANCE_LP_RING(); - } - - if ( flags & I830_DEPTH ) { - DRM_DEBUG("clear depth\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( D_CMD ); - OUT_RING( BR13 ); - OUT_RING( (pbox->y1 << 16) | pbox->x1 ); - OUT_RING( (pbox->y2 << 16) | pbox->x2 ); - OUT_RING( dev_priv->depth_offset ); - OUT_RING( clear_zval ); - ADVANCE_LP_RING(); - } - } -} - -static void i830_dma_dispatch_swap( drm_device_t *dev ) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int pitch = dev_priv->pitch; - int cpp = dev_priv->cpp; - int ofs = dev_priv->back_offset; - int i; - unsigned int CMD, BR13; - RING_LOCALS; - - DRM_DEBUG("swapbuffers\n"); - - switch(cpp) { - case 2: - BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); - CMD = XY_SRC_COPY_BLT_CMD; - break; - case 4: - BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24) | (1<<25); - CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); - break; - default: - BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); - CMD = XY_SRC_COPY_BLT_CMD; - break; - } - - i830_kernel_lost_context(dev); - - if (nbox > I830_NR_SAREA_CLIPRECTS) - nbox = I830_NR_SAREA_CLIPRECTS; - - for (i = 0 ; i < nbox; i++, pbox++) - { - if (pbox->x1 > pbox->x2 || - pbox->y1 > pbox->y2 || - pbox->x2 > dev_priv->w || - pbox->y2 > dev_priv->h) - continue; - - DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", - pbox->x1, pbox->y1, - pbox->x2, pbox->y2); - - BEGIN_LP_RING( 8 ); - OUT_RING( CMD ); - OUT_RING( BR13 ); - - OUT_RING( (pbox->y1 << 16) | - pbox->x1 ); - OUT_RING( (pbox->y2 << 16) | - pbox->x2 ); - - OUT_RING( 0 /* front ofs always zero */ ); - OUT_RING( (pbox->y1 << 16) | - pbox->x1 ); - - OUT_RING( BR13 & 0xffff ); - OUT_RING( ofs ); - - ADVANCE_LP_RING(); - } -} - - -static void i830_dma_dispatch_vertex(drm_device_t *dev, - drm_buf_t *buf, - int discard, - int used) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_clip_rect_t *box = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - unsigned long address = (unsigned long)buf->bus_address; - unsigned long start = address - dev->agp->base; - int i = 0, u; - RING_LOCALS; - - i830_kernel_lost_context(dev); - - if (nbox > I830_NR_SAREA_CLIPRECTS) - nbox = I830_NR_SAREA_CLIPRECTS; - - if (discard) { - u = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, - I830_BUF_HARDWARE); - if(u != I830_BUF_CLIENT) { - DRM_DEBUG("xxxx 2\n"); - } - } - - if (used > 4*1024) - used = 0; - - if (sarea_priv->dirty) - i830EmitState( dev ); - - DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", - address, used, nbox); - - dev_priv->counter++; - DRM_DEBUG( "dispatch counter : %ld\n", dev_priv->counter); - DRM_DEBUG( "i830_dma_dispatch\n"); - DRM_DEBUG( "start : %lx\n", start); - DRM_DEBUG( "used : %d\n", used); - DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); - - if (buf_priv->currently_mapped == I830_BUF_MAPPED) { - *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | - sarea_priv->vertex_prim | - ((used/4)-2)); - - if (used & 4) { - *(u32 *)((u32)buf_priv->virtual + used) = 0; - used += 4; - } - - i830_unmap_buffer(buf); - } - - if (used) { - do { - if (i < nbox) { - BEGIN_LP_RING(6); - OUT_RING( GFX_OP_DRAWRECT_INFO ); - OUT_RING( sarea_priv->BufferState[I830_DESTREG_DR1] ); - OUT_RING( box[i].x1 | (box[i].y1<<16) ); - OUT_RING( box[i].x2 | (box[i].y2<<16) ); - OUT_RING( sarea_priv->BufferState[I830_DESTREG_DR4] ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - } - - BEGIN_LP_RING(4); - - OUT_RING( MI_BATCH_BUFFER ); - OUT_RING( start | MI_BATCH_NON_SECURE ); - OUT_RING( start + used - 4 ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - - } while (++i < nbox); - } - - BEGIN_LP_RING(10); - OUT_RING( CMD_STORE_DWORD_IDX ); - OUT_RING( 20 ); - OUT_RING( dev_priv->counter ); - OUT_RING( 0 ); - - if (discard) { - OUT_RING( CMD_STORE_DWORD_IDX ); - OUT_RING( buf_priv->my_use_idx ); - OUT_RING( I830_BUF_FREE ); - OUT_RING( 0 ); - } - - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); -} - -/* Interrupts are only for flushing */ -void i830_dma_service(int irq, void *device, struct pt_regs *regs) -{ - drm_device_t *dev = (drm_device_t *)device; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u16 temp; - - temp = I830_READ16(I830REG_INT_IDENTITY_R); - temp = temp & ~(0x6000); - if(temp != 0) I830_WRITE16(I830REG_INT_IDENTITY_R, - temp); /* Clear all interrupts */ - else - return; - - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -void DRM(dma_immediate_bh)(void *device) -{ - drm_device_t *dev = (drm_device_t *) device; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); -} - -static inline void i830_dma_emit_flush(drm_device_t *dev) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - - i830_kernel_lost_context(dev); - - BEGIN_LP_RING(2); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( GFX_OP_USER_INTERRUPT ); - ADVANCE_LP_RING(); - - i830_wait_ring( dev, dev_priv->ring.Size - 8 ); - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); -} - -static inline void i830_dma_quiescent_emit(drm_device_t *dev) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - - i830_kernel_lost_context(dev); - - BEGIN_LP_RING(4); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - OUT_RING( GFX_OP_USER_INTERRUPT ); - ADVANCE_LP_RING(); - - i830_wait_ring( dev, dev_priv->ring.Size - 8 ); - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); -} - -void i830_dma_quiescent(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - unsigned long end; - - if(dev_priv == NULL) { - return; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i830_dma_quiescent_emit(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - break; - } - } - - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - - return; -} - -static int i830_flush_queue(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; - unsigned long end; - int i, ret = 0; - - if(dev_priv == NULL) { - return 0; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i830_dma_emit_flush(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - break; - } - } - - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - - int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE, - I830_BUF_FREE); - - if (used == I830_BUF_HARDWARE) - DRM_DEBUG("reclaimed from HARDWARE\n"); - if (used == I830_BUF_CLIENT) - DRM_DEBUG("still on client HARDWARE\n"); - } - - return ret; -} - -/* Must be called with the lock held */ -void i830_reclaim_buffers(drm_device_t *dev, pid_t pid) -{ - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma) return; - if (!dev->dev_private) return; - if (!dma->buflist) return; - - i830_flush_queue(dev); - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i830_buf_priv_t *buf_priv = buf->dev_private; - - if (buf->pid == pid && buf_priv) { - int used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, - I830_BUF_FREE); - - if (used == I830_BUF_CLIENT) - DRM_DEBUG("reclaimed from client\n"); - if(buf_priv->currently_mapped == I830_BUF_MAPPED) - buf_priv->currently_mapped = I830_BUF_UNMAPPED; - } - } -} - -int i830_flush_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - DRM_DEBUG("i830_flush_ioctl\n"); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_flush_ioctl called without lock held\n"); - return -EINVAL; - } - - i830_flush_queue(dev); - return 0; -} - -int i830_dma_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) - dev_priv->sarea_priv; - drm_i830_vertex_t vertex; - - if (copy_from_user(&vertex, (drm_i830_vertex_t *)arg, sizeof(vertex))) - return -EFAULT; - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_dma_vertex called without lock held\n"); - return -EINVAL; - } - - DRM_DEBUG("i830 dma vertex, idx %d used %d discard %d\n", - vertex.idx, vertex.used, vertex.discard); - - if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; - - i830_dma_dispatch_vertex( dev, - dma->buflist[ vertex.idx ], - vertex.discard, vertex.used ); - - sarea_priv->last_enqueue = dev_priv->counter-1; - sarea_priv->last_dispatch = (int) hw_status[5]; - - return 0; -} - -int i830_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i830_clear_t clear; - - if (copy_from_user(&clear, (drm_i830_clear_t *)arg, sizeof(clear))) - return -EFAULT; - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_clear_bufs called without lock held\n"); - return -EINVAL; - } - - /* GH: Someone's doing nasty things... */ - if (!dev->dev_private) { - return -EINVAL; - } - - i830_dma_dispatch_clear( dev, clear.flags, - clear.clear_color, - clear.clear_depth, - clear.clear_depthmask); - return 0; -} - -int i830_swap_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - DRM_DEBUG("i830_swap_bufs\n"); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_swap_buf called without lock held\n"); - return -EINVAL; - } - - i830_dma_dispatch_swap( dev ); - return 0; -} - -int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) - dev_priv->sarea_priv; - - sarea_priv->last_dispatch = (int) hw_status[5]; - return 0; -} - -int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_i830_dma_t d; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) - dev_priv->sarea_priv; - - DRM_DEBUG("getbuf\n"); - if (copy_from_user(&d, (drm_i830_dma_t *)arg, sizeof(d))) - return -EFAULT; - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_dma called without lock held\n"); - return -EINVAL; - } - - d.granted = 0; - - retcode = i830_dma_get_buffer(dev, &d, filp); - - DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", - current->pid, retcode, d.granted); - - if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d))) - return -EFAULT; - sarea_priv->last_dispatch = (int) hw_status[5]; - - return retcode; -} - -int i830_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i830_copy_t d; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) - dev_priv->sarea_priv; - drm_buf_t *buf; - drm_i830_buf_priv_t *buf_priv; - drm_device_dma_t *dma = dev->dma; - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_dma called without lock held\n"); - return -EINVAL; - } - - if (copy_from_user(&d, (drm_i830_copy_t *)arg, sizeof(d))) - return -EFAULT; - - if(d.idx < 0 || d.idx > dma->buf_count) return -EINVAL; - buf = dma->buflist[ d.idx ]; - buf_priv = buf->dev_private; - if (buf_priv->currently_mapped != I830_BUF_MAPPED) return -EPERM; - - if(d.used < 0 || d.used > buf->total) return -EINVAL; - - if (copy_from_user(buf_priv->virtual, d.address, d.used)) - return -EFAULT; - - sarea_priv->last_dispatch = (int) hw_status[5]; - - return 0; -} - -int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - if(VM_DONTCOPY == 0) return 1; - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c:1.1 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c Thu Feb 27 12:32:24 2003 @@ -1,102 +0,0 @@ -/* i830_drv.c -- I810 driver -*- linux-c -*- - * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * Abraham vd Merwe <abraham@2d3d.co.za> - */ - -#include <linux/config.h> -#include "i830.h" -#include "drmP.h" -#include "i830_drv.h" - -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "i830" -#define DRIVER_DESC "Intel 830M" -#define DRIVER_DATE "20011004" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_INIT)] = { i830_dma_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_VERTEX)] = { i830_dma_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_CLEAR)] = { i830_clear_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_FLUSH)] = { i830_flush_ioctl, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_GETAGE)] = { i830_getage, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_GETBUF)] = { i830_getbuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_SWAP)] = { i830_swap_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_COPY)] = { i830_copybuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_DOCOPY)] = { i830_docopy, 1, 0 }, - -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - - -#include "drm_agpsupport.h" -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init i830_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", i830_options ); -#endif - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_lists.h" -#include "drm_memory.h" -#include "drm_proc.h" -#include "drm_vm.h" -#include "drm_stub.h" Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h:1.1 Sun Dec 16 14:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h Thu Feb 27 12:32:24 2003 @@ -1,213 +0,0 @@ -/* i830_drv.h -- Private header for the I830 driver -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#ifndef _I830_DRV_H_ -#define _I830_DRV_H_ - -typedef struct drm_i830_buf_priv { - u32 *in_use; - int my_use_idx; - int currently_mapped; - void *virtual; - void *kernel_virtual; - int map_count; - struct vm_area_struct *vma; -} drm_i830_buf_priv_t; - -typedef struct _drm_i830_ring_buffer{ - int tail_mask; - unsigned long Start; - unsigned long End; - unsigned long Size; - u8 *virtual_start; - int head; - int tail; - int space; -} drm_i830_ring_buffer_t; - -typedef struct drm_i830_private { - drm_map_t *sarea_map; - drm_map_t *buffer_map; - drm_map_t *mmio_map; - - drm_i830_sarea_t *sarea_priv; - drm_i830_ring_buffer_t ring; - - unsigned long hw_status_page; - unsigned long counter; - - atomic_t flush_done; - wait_queue_head_t flush_queue; /* Processes waiting until flush */ - drm_buf_t *mmap_buffer; - - u32 front_di1, back_di1, zi1; - - int back_offset; - int depth_offset; - int w, h; - int pitch; - int back_pitch; - int depth_pitch; - unsigned int cpp; -} drm_i830_private_t; - - /* i830_dma.c */ -extern int i830_dma_schedule(drm_device_t *dev, int locked); -extern int i830_getbuf(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i830_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i830_flush_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern void i830_reclaim_buffers(drm_device_t *dev, pid_t pid); -extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); -extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma); -extern int i830_copybuf(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i830_docopy(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern void i830_dma_quiescent(drm_device_t *dev); - -extern int i830_dma_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int i830_swap_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int i830_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -#define I830_VERBOSE 0 - -#define I830_BASE(reg) ((unsigned long) \ - dev_priv->mmio_map->handle) -#define I830_ADDR(reg) (I830_BASE(reg) + reg) -#define I830_DEREF(reg) *(__volatile__ int *)I830_ADDR(reg) -#define I830_READ(reg) I830_DEREF(reg) -#define I830_WRITE(reg,val) do { I830_DEREF(reg) = val; } while (0) -#define I830_DEREF16(reg) *(__volatile__ u16 *)I830_ADDR(reg) -#define I830_READ16(reg) I830_DEREF16(reg) -#define I830_WRITE16(reg,val) do { I830_DEREF16(reg) = val; } while (0) - -#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) -#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) -#define CMD_REPORT_HEAD (7<<23) -#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1) -#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1) - -#define INST_PARSER_CLIENT 0x00000000 -#define INST_OP_FLUSH 0x02000000 -#define INST_FLUSH_MAP_CACHE 0x00000001 - - -#define BB1_START_ADDR_MASK (~0x7) -#define BB1_PROTECTED (1<<0) -#define BB1_UNPROTECTED (0<<0) -#define BB2_END_ADDR_MASK (~0x7) - -#define I830REG_HWSTAM 0x02098 -#define I830REG_INT_IDENTITY_R 0x020a4 -#define I830REG_INT_MASK_R 0x020a8 -#define I830REG_INT_ENABLE_R 0x020a0 - -#define LP_RING 0x2030 -#define HP_RING 0x2040 -#define RING_TAIL 0x00 -#define TAIL_ADDR 0x000FFFF8 -#define RING_HEAD 0x04 -#define HEAD_WRAP_COUNT 0xFFE00000 -#define HEAD_WRAP_ONE 0x00200000 -#define HEAD_ADDR 0x001FFFFC -#define RING_START 0x08 -#define START_ADDR 0x00FFFFF8 -#define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 -#define RING_REPORT_MASK 0x00000006 -#define RING_REPORT_64K 0x00000002 -#define RING_REPORT_128K 0x00000004 -#define RING_NO_REPORT 0x00000000 -#define RING_VALID_MASK 0x00000001 -#define RING_VALID 0x00000001 -#define RING_INVALID 0x00000000 - -#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19)) -#define SC_UPDATE_SCISSOR (0x1<<1) -#define SC_ENABLE_MASK (0x1<<0) -#define SC_ENABLE (0x1<<0) - -#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1)) -#define SCI_YMIN_MASK (0xffff<<16) -#define SCI_XMIN_MASK (0xffff<<0) -#define SCI_YMAX_MASK (0xffff<<16) -#define SCI_XMAX_MASK (0xffff<<0) - -#define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19)) -#define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1) -#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0) -#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) -#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4) -#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0) -#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) -#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24)) - -#define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) - - -#define BR00_BITBLT_CLIENT 0x40000000 -#define BR00_OP_COLOR_BLT 0x10000000 -#define BR00_OP_SRC_COPY_BLT 0x10C00000 -#define BR13_SOLID_PATTERN 0x80000000 - -#define BUF_3D_ID_COLOR_BACK (0x3<<24) -#define BUF_3D_ID_DEPTH (0x7<<24) -#define BUF_3D_USE_FENCE (1<<23) -#define BUF_3D_PITCH(x) (((x)/4)<<2) - -#define CMD_OP_MAP_PALETTE_LOAD ((3<<29)|(0x1d<<24)|(0x82<<16)|255) -#define MAP_PALETTE_NUM(x) ((x<<8) & (1<<8)) -#define MAP_PALETTE_BOTH (1<<11) - -#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) -#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) -#define XY_COLOR_BLT_WRITE_RGB (1<<20) - -#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) -#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) -#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) - -#define MI_BATCH_BUFFER ((0x30<<23)|1) -#define MI_BATCH_NON_SECURE (1) - - -#endif - Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile:1.2 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile Mon Dec 16 11:19:22 2002 @@ -1,25 +1,23 @@ # $FreeBSD$ +.PATH: ${.CURDIR}/.. KMOD= mga NOMAN= YES -SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c -SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c mga_irq.c +SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h CFLAGS+= ${DEBUG_FLAGS} -I. -I.. -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine +.if defined(DRM_DEBUG) +DRM_DEBUG_OPT= "\#define DRM_DEBUG 1" +.endif -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#MGA_OPTS= "\#define DRM_LINUX" 1 +.if !defined(DRM_NOLINUX) +DRM_LINUX_OPT= "\#define DRM_LINUX 1" .endif -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(MGA_OPTS) >> opt_drm_linux.h +opt_drm.h: + touch opt_drm.h + echo $(DRM_DEBUG_OPT) >> opt_drm.h + echo $(DRM_LINUX_OPT) >> opt_drm.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h Thu Feb 27 12:32:25 2003 @@ -1,67 +0,0 @@ -/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*- - * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __MGA_H__ -#define __MGA_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) mga_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -/* Driver customization: - */ -#define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 - -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - drm_mga_private_t *dev_priv = dev->dev_private; \ - return mga_do_wait_for_idle( dev_priv ); \ -} while (0) - -/* Buffer customization: - */ -#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_mga_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:1.3 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c Thu Feb 27 12:32:25 2003 @@ -1,819 +0,0 @@ -/* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - * Rewritten by: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" - - -#define MGA_DEFAULT_USEC_TIMEOUT 10000 -#define MGA_FREELIST_DEBUG 0 - - -/* ================================================================ - * Engine control - */ - -int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) -{ - u32 status = 0; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; - if ( status == MGA_ENDPRDMASTS ) { - MGA_WRITE8( MGA_CRTC_INDEX, 0 ); - return 0; - } - DRM_OS_DELAY( 1 ); - } - -#if MGA_DMA_DEBUG - DRM_ERROR( "failed!\n" ); - DRM_INFO( " status=0x%08x\n", status ); -#endif - DRM_OS_RETURN(EBUSY); -} - -int mga_do_dma_idle( drm_mga_private_t *dev_priv ) -{ - u32 status = 0; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK; - if ( status == MGA_ENDPRDMASTS ) return 0; - DRM_OS_DELAY( 1 ); - } - -#if MGA_DMA_DEBUG - DRM_ERROR( "failed! status=0x%08x\n", status ); -#endif - DRM_OS_RETURN(EBUSY); -} - -int mga_do_dma_reset( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* The primary DMA stream should look like new right about now. - */ - primary->tail = 0; - primary->space = primary->size; - primary->last_flush = 0; - - sarea_priv->last_wrap = 0; - - /* FIXME: Reset counters, buffer ages etc... - */ - - /* FIXME: What else do we need to reinitialize? WARP stuff? - */ - - return 0; -} - -int mga_do_engine_reset( drm_mga_private_t *dev_priv ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* Okay, so we've completely screwed up and locked the engine. - * How about we clean up after ourselves? - */ - MGA_WRITE( MGA_RST, MGA_SOFTRESET ); - DRM_OS_DELAY( 15 ); /* Wait at least 10 usecs */ - MGA_WRITE( MGA_RST, 0 ); - - /* Initialize the registers that get clobbered by the soft - * reset. Many of the core register values survive a reset, - * but the drawing registers are basically all gone. - * - * 3D clients should probably die after calling this. The X - * server should reset the engine state to known values. - */ -#if 0 - MGA_WRITE( MGA_PRIMPTR, - virt_to_bus((void *)dev_priv->prim.status_page) | - MGA_PRIMPTREN0 | - MGA_PRIMPTREN1 ); -#endif - - MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); - MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); - - /* The primary DMA stream should look like new right about now. - */ - mga_do_dma_reset( dev_priv ); - - /* This bad boy will never fail. - */ - return 0; -} - - -/* ================================================================ - * Primary DMA stream - */ - -void mga_do_dma_flush( drm_mga_private_t *dev_priv ) -{ - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - u32 head, tail; - DMA_LOCALS; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - if ( primary->tail == primary->last_flush ) { - DRM_DEBUG( " bailing out...\n" ); - return; - } - - tail = primary->tail + dev_priv->primary->offset; - - /* We need to pad the stream between flushes, as the card - * actually (partially?) reads the first of these commands. - * See page 4-16 in the G400 manual, middle of the page or so. - */ - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); - - primary->last_flush = primary->tail; - - head = MGA_READ( MGA_PRIMADDRESS ); - - if ( head <= tail ) { - primary->space = primary->size - primary->tail; - } else { - primary->space = head - tail; - } - - DRM_DEBUG( " head = 0x%06lx\n", head - dev_priv->primary->offset ); - DRM_DEBUG( " tail = 0x%06lx\n", tail - dev_priv->primary->offset ); - DRM_DEBUG( " space = 0x%06x\n", primary->space ); - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); - - DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); -} - -void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) -{ - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - u32 head, tail; - DMA_LOCALS; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - BEGIN_DMA_WRAP(); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); - - tail = primary->tail + dev_priv->primary->offset; - - primary->tail = 0; - primary->last_flush = 0; - primary->last_wrap++; - - head = MGA_READ( MGA_PRIMADDRESS ); - - if ( head == dev_priv->primary->offset ) { - primary->space = primary->size; - } else { - primary->space = head - dev_priv->primary->offset; - } - - DRM_DEBUG( " head = 0x%06lx\n", - head - dev_priv->primary->offset ); - DRM_DEBUG( " tail = 0x%06x\n", primary->tail ); - DRM_DEBUG( " wrap = %d\n", primary->last_wrap ); - DRM_DEBUG( " space = 0x%06x\n", primary->space ); - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); - - set_bit( 0, &primary->wrapped ); - DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); -} - -void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) -{ - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - u32 head = dev_priv->primary->offset; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - sarea_priv->last_wrap++; - DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); - - clear_bit( 0, &primary->wrapped ); - DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); -} - - -/* ================================================================ - * Freelist management - */ - -#define MGA_BUFFER_USED ~0 -#define MGA_BUFFER_FREE 0 - -#if MGA_FREELIST_DEBUG -static void mga_freelist_print( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_freelist_t *entry; - - DRM_INFO( "\n" ); - DRM_INFO( "current dispatch: last=0x%x done=0x%x\n", - dev_priv->sarea_priv->last_dispatch, - (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) - - dev_priv->primary->offset) ); - DRM_INFO( "current freelist:\n" ); - - for ( entry = dev_priv->head->next ; entry ; entry = entry->next ) { - DRM_INFO( " %p idx=%2d age=0x%x 0x%06lx\n", - entry, entry->buf->idx, entry->age.head, - entry->age.head - dev_priv->primary->offset ); - } - DRM_INFO( "\n" ); -} -#endif - -static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv ) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_freelist_t *entry; - int i; - DRM_DEBUG( "%s: count=%d\n", - __FUNCTION__, dma->buf_count ); - - dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER ); - if ( dev_priv->head == NULL ) - DRM_OS_RETURN(ENOMEM); - - memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) ); - SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 ); - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - - entry = DRM(alloc)( sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER ); - if ( entry == NULL ) - DRM_OS_RETURN(ENOMEM); - - memset( entry, 0, sizeof(drm_mga_freelist_t) ); - - entry->next = dev_priv->head->next; - entry->prev = dev_priv->head; - SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); - entry->buf = buf; - - if ( dev_priv->head->next != NULL ) - dev_priv->head->next->prev = entry; - if ( entry->next == NULL ) - dev_priv->tail = entry; - - buf_priv->list_entry = entry; - buf_priv->discard = 0; - buf_priv->dispatched = 0; - - dev_priv->head->next = entry; - } - - return 0; -} - -static void mga_freelist_cleanup( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_freelist_t *entry; - drm_mga_freelist_t *next; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - entry = dev_priv->head; - while ( entry ) { - next = entry->next; - DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); - entry = next; - } - - dev_priv->head = dev_priv->tail = NULL; -} - -#if 0 -/* FIXME: Still needed? - */ -static void mga_freelist_reset( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - int i; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - SET_AGE( &buf_priv->list_entry->age, - MGA_BUFFER_FREE, 0 ); - } -} -#endif - -static drm_buf_t *mga_freelist_get( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_freelist_t *next; - drm_mga_freelist_t *prev; - drm_mga_freelist_t *tail = dev_priv->tail; - u32 head, wrap; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - head = MGA_READ( MGA_PRIMADDRESS ); - wrap = dev_priv->sarea_priv->last_wrap; - - DRM_DEBUG( " tail=0x%06lx %d\n", - tail->age.head ? - tail->age.head - dev_priv->primary->offset : 0, - tail->age.wrap ); - DRM_DEBUG( " head=0x%06lx %d\n", - head - dev_priv->primary->offset, wrap ); - - if ( TEST_AGE( &tail->age, head, wrap ) ) { - prev = dev_priv->tail->prev; - next = dev_priv->tail; - prev->next = NULL; - next->prev = next->next = NULL; - dev_priv->tail = prev; - SET_AGE( &next->age, MGA_BUFFER_USED, 0 ); - return next->buf; - } - - DRM_DEBUG( "returning NULL!\n" ); - return NULL; -} - -int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_freelist_t *head, *entry, *prev; - - DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n", - __FUNCTION__, - buf_priv->list_entry->age.head - - dev_priv->primary->offset, - buf_priv->list_entry->age.wrap ); - - entry = buf_priv->list_entry; - head = dev_priv->head; - - if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { - SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); - prev = dev_priv->tail; - prev->next = entry; - entry->prev = prev; - entry->next = NULL; - } else { - prev = head->next; - head->next = entry; - prev->prev = entry; - entry->prev = head; - entry->next = prev; - } - - return 0; -} - - -/* ================================================================ - * DMA initialization, cleanup - */ - -static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) -{ - drm_mga_private_t *dev_priv; - drm_map_list_entry_t *listentry; - int ret; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); - if ( !dev_priv ) - DRM_OS_RETURN(ENOMEM); - - memset( dev_priv, 0, sizeof(drm_mga_private_t) ); - - dev_priv->chipset = init->chipset; - - dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; - - if ( init->sgram ) { - dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK; - } else { - dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR; - } - dev_priv->maccess = init->maccess; - - dev_priv->fb_cpp = init->fb_cpp; - dev_priv->front_offset = init->front_offset; - dev_priv->front_pitch = init->front_pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->back_pitch = init->back_pitch; - - dev_priv->depth_cpp = init->depth_cpp; - dev_priv->depth_offset = init->depth_offset; - dev_priv->depth_pitch = init->depth_pitch; - - /* FIXME: Need to support AGP textures... - */ - dev_priv->texture_offset = init->texture_offset[0]; - dev_priv->texture_size = init->texture_size[0]; - - TAILQ_FOREACH(listentry, dev->maplist, link) { - drm_map_t *map = listentry->map; - if (map->type == _DRM_SHM && - map->flags & _DRM_CONTAINS_LOCK) { - dev_priv->sarea = map; - break; - } - } - - if(!dev_priv->sarea) { - DRM_ERROR( "failed to find sarea!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - - - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR( "failed to find framebuffer!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - if(!dev_priv->mmio) { - DRM_ERROR( "failed to find mmio region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->status, init->status_offset ); - if(!dev_priv->status) { - DRM_ERROR( "failed to find status page!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); - if(!dev_priv->warp) { - DRM_ERROR( "failed to find warp microcode region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); - if(!dev_priv->primary) { - DRM_ERROR( "failed to find primary dma region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); - if(!dev_priv->buffers) { - DRM_ERROR( "failed to find dma buffer region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(EINVAL); - } - - dev_priv->sarea_priv = - (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle + - init->sarea_priv_offset); - - DRM_IOREMAP( dev_priv->warp ); - DRM_IOREMAP( dev_priv->primary ); - DRM_IOREMAP( dev_priv->buffers ); - - if(!dev_priv->warp->handle || - !dev_priv->primary->handle || - !dev_priv->buffers->handle ) { - DRM_ERROR( "failed to ioremap agp regions!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(ENOMEM); - } - - ret = mga_warp_install_microcode( dev_priv ); - if ( ret < 0 ) { - DRM_ERROR( "failed to install WARP ucode!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(ret); - } - - ret = mga_warp_init( dev_priv ); - if ( ret < 0 ) { - DRM_ERROR( "failed to init WARP engine!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(ret); - } - - dev_priv->prim.status = (u32 *)dev_priv->status->handle; - - mga_do_wait_for_idle( dev_priv ); - - /* Init the primary DMA registers. - */ - MGA_WRITE( MGA_PRIMADDRESS, - dev_priv->primary->offset | MGA_DMA_GENERAL ); -#if 0 - MGA_WRITE( MGA_PRIMPTR, - virt_to_bus((void *)dev_priv->prim.status) | - MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */ - MGA_PRIMPTREN1 ); /* DWGSYNC */ -#endif - - dev_priv->prim.start = (u8 *)dev_priv->primary->handle; - dev_priv->prim.end = ((u8 *)dev_priv->primary->handle - + dev_priv->primary->size); - dev_priv->prim.size = dev_priv->primary->size; - - dev_priv->prim.tail = 0; - dev_priv->prim.space = dev_priv->prim.size; - dev_priv->prim.wrapped = 0; - - dev_priv->prim.last_flush = 0; - dev_priv->prim.last_wrap = 0; - - dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE; - - - dev_priv->prim.status[0] = dev_priv->primary->offset; - dev_priv->prim.status[1] = 0; - - dev_priv->sarea_priv->last_wrap = 0; - dev_priv->sarea_priv->last_frame.head = 0; - dev_priv->sarea_priv->last_frame.wrap = 0; - - if ( mga_freelist_init( dev, dev_priv ) < 0 ) { - DRM_ERROR( "could not initialize freelist\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - DRM_OS_RETURN(ENOMEM); - } - - /* Make dev_private visable to others. */ - dev->dev_private = (void *)dev_priv; - return 0; -} - -int mga_do_cleanup_dma( drm_device_t *dev ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev->dev_private ) { - drm_mga_private_t *dev_priv = dev->dev_private; - - DRM_IOREMAPFREE( dev_priv->warp ); - DRM_IOREMAPFREE( dev_priv->primary ); - DRM_IOREMAPFREE( dev_priv->buffers ); - - if ( dev_priv->head != NULL ) { - mga_freelist_cleanup( dev ); - } - - DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), - DRM_MEM_DRIVER ); - dev->dev_private = NULL; - } - - return 0; -} - -int mga_dma_init( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_init_t init; - - DRM_OS_KRNFROMUSR( init, (drm_mga_init_t *) data, sizeof(init) ); - - switch ( init.func ) { - case MGA_INIT_DMA: - return mga_do_init_dma( dev, &init ); - case MGA_CLEANUP_DMA: - return mga_do_cleanup_dma( dev ); - } - - DRM_OS_RETURN( EINVAL ); -} - - -/* ================================================================ - * Primary DMA stream management - */ - -int mga_dma_flush( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_lock_t lock; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( lock, (drm_lock_t *) data, sizeof(lock) ); - - DRM_DEBUG( "%s: %s%s%s\n", - __FUNCTION__, - (lock.flags & _DRM_LOCK_FLUSH) ? "flush, " : "", - (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", - (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); - - WRAP_WAIT_WITH_RETURN( dev_priv ); - - if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { - mga_do_dma_flush( dev_priv ); - } - - if ( lock.flags & _DRM_LOCK_QUIESCENT ) { -#if MGA_DMA_DEBUG - int ret = mga_do_wait_for_idle( dev_priv ); - if ( ret ) - DRM_INFO( __FUNCTION__": -EBUSY\n" ); - return ret; -#else - return mga_do_wait_for_idle( dev_priv ); -#endif - } else { - return 0; - } -} - -int mga_dma_reset( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - - LOCK_TEST_WITH_RETURN( dev ); - - return mga_do_dma_reset( dev_priv ); -} - - -/* ================================================================ - * DMA buffer management - */ - -#if 0 -static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d ) -{ - drm_buf_t *buf; - int i; - - for ( i = d->granted_count ; i < d->request_count ; i++ ) { - buf = mga_freelist_get( dev ); - if ( !buf ) - DRM_OS_RETURN( EAGAIN ); - - buf->pid = current->pid; - - if ( DRM_OS_COPYTOUSR( &d->request_indices[i], - &buf->idx, sizeof(buf->idx) ) ) - DRM_OS_RETURN( EFAULT ); - if ( DRM_OS_COPYTOUSR( &d->request_sizes[i], - &buf->total, sizeof(buf->total) ) ) - DRM_OS_RETURN( EFAULT ); - - d->granted_count++; - } - return 0; -} -#endif /* 0 */ - -int mga_dma_buffers( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_dma_t d; - drm_buf_t *buf; - int i; - int ret = 0; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) ); - - /* Please don't send us buffers. - */ - if ( d.send_count != 0 ) { - DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", - DRM_OS_CURRENTPID, d.send_count ); - DRM_OS_RETURN( EINVAL ); - } - - /* We'll send you buffers. - */ - if ( d.request_count < 0 || d.request_count > dma->buf_count ) { - DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", - DRM_OS_CURRENTPID, d.request_count, dma->buf_count ); - DRM_OS_RETURN( EINVAL ); - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - d.granted_count = 0; - - if ( d.request_count ) { - for ( i = d.granted_count ; i < d.request_count ; i++ ) { - buf = mga_freelist_get( dev ); - if ( !buf ) - DRM_OS_RETURN( EAGAIN ); - - buf->pid = DRM_OS_CURRENTPID; - - if ( DRM_OS_COPYTOUSR( &d.request_indices[i], - &buf->idx, sizeof(buf->idx) ) ) - DRM_OS_RETURN( EFAULT ); - if ( DRM_OS_COPYTOUSR( &d.request_sizes[i], - &buf->total, sizeof(buf->total) ) ) - DRM_OS_RETURN( EFAULT ); - - d.granted_count++; - } - ret = 0; - } - - DRM_OS_KRNTOUSR( (drm_dma_t *) data, d, sizeof(d) ); - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.3 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c Thu Feb 27 12:32:25 2003 @@ -1,98 +0,0 @@ -/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*- - * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> - -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" - -#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - -#define DRIVER_NAME "mga" -#define DRIVER_DESC "Matrox G200/G400" -#define DRIVER_DATE "20010321" - -#define DRIVER_MAJOR 3 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 2 - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x102b, 0x0520, 0, "Matrox G200 (PCI)"}, - {0x102b, 0x0521, 1, "Matrox G200 (AGP)"}, - {0x102b, 0x0525, 1, "Matrox G400 (AGP)"}, - {0, 0, 0, NULL} -}; - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, - - -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY - - -#include "drm_agpsupport.h" -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_vm.h" -#include "drm_sysctl.h" - -DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.3 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h Thu Feb 27 12:32:25 2003 @@ -1,638 +0,0 @@ -/* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __MGA_DRV_H__ -#define __MGA_DRV_H__ - -#ifndef u8 -#define u8 u_int8_t -#define u16 u_int16_t -#define u32 u_int32_t -#endif - -typedef struct drm_mga_primary_buffer { - u8 *start; - u8 *end; - int size; - - u32 tail; - int space; - volatile long wrapped; - - volatile u32 *status; - - u32 last_flush; - u32 last_wrap; - - u32 high_mark; - - spinlock_t list_lock; -} drm_mga_primary_buffer_t; - -typedef struct drm_mga_freelist { - struct drm_mga_freelist *next; - struct drm_mga_freelist *prev; - drm_mga_age_t age; - drm_buf_t *buf; -} drm_mga_freelist_t; - -typedef struct { - drm_mga_freelist_t *list_entry; - int discard; - int dispatched; -} drm_mga_buf_priv_t; - -typedef struct drm_mga_private { - drm_mga_primary_buffer_t prim; - drm_mga_sarea_t *sarea_priv; - - drm_mga_freelist_t *head; - drm_mga_freelist_t *tail; - - unsigned int warp_pipe; - unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES]; - - int chipset; - int usec_timeout; - - u32 clear_cmd; - u32 maccess; - - unsigned int fb_cpp; - unsigned int front_offset; - unsigned int front_pitch; - unsigned int back_offset; - unsigned int back_pitch; - - unsigned int depth_cpp; - unsigned int depth_offset; - unsigned int depth_pitch; - - unsigned int texture_offset; - unsigned int texture_size; - - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *mmio; - drm_map_t *status; - drm_map_t *warp; - drm_map_t *primary; - drm_map_t *buffers; - drm_map_t *agp_textures; -} drm_mga_private_t; - - /* mga_dma.c */ -extern int mga_dma_init( DRM_OS_IOCTL ); -extern int mga_dma_flush( DRM_OS_IOCTL ); -extern int mga_dma_reset( DRM_OS_IOCTL ); -extern int mga_dma_buffers( DRM_OS_IOCTL ); - -extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); -extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); -extern int mga_do_dma_reset( drm_mga_private_t *dev_priv ); -extern int mga_do_engine_reset( drm_mga_private_t *dev_priv ); -extern int mga_do_cleanup_dma( drm_device_t *dev ); - -extern void mga_do_dma_flush( drm_mga_private_t *dev_priv ); -extern void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ); -extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ); - -extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); - - /* mga_state.c */ -extern int mga_dma_clear( DRM_OS_IOCTL ); -extern int mga_dma_swap( DRM_OS_IOCTL ); -extern int mga_dma_vertex( DRM_OS_IOCTL ); -extern int mga_dma_indices( DRM_OS_IOCTL ); -extern int mga_dma_iload( DRM_OS_IOCTL ); -extern int mga_dma_blit( DRM_OS_IOCTL ); - - /* mga_warp.c */ -extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); -extern int mga_warp_init( drm_mga_private_t *dev_priv ); - -#define mga_flush_write_combine() DRM_OS_READMEMORYBARRIER - -#define MGA_BASE( reg ) ((unsigned long)(dev_priv->mmio->handle)) -#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) - -#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) -#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) - -#ifdef __alpha__ -#define MGA_READ( reg ) (_MGA_READ((u32 *)MGA_ADDR(reg))) -#define MGA_WRITE( reg, val ) do { wmb(); MGA_DEREF( reg ) = val; } while (0) -#define MGA_WRITE8( reg, val ) do { wmb(); MGA_DEREF8( reg ) = val; } while (0) - -static inline u32 _MGA_READ(u32 *addr) -{ - mb(); - return *(volatile u32 *)addr; -} - -#else -#define MGA_READ( reg ) MGA_DEREF( reg ) -#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) -#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0) -#endif - -#define DWGREG0 0x1c00 -#define DWGREG0_END 0x1dff -#define DWGREG1 0x2c00 -#define DWGREG1_END 0x2dff - -#define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) -#define DMAREG0(r) (u8)((r - DWGREG0) >> 2) -#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) -#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r)) - - - -/* ================================================================ - * Helper macross... - */ - -#define MGA_EMIT_STATE( dev_priv, dirty ) \ -do { \ - if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ - if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \ - mga_g400_emit_state( dev_priv ); \ - } else { \ - mga_g200_emit_state( dev_priv ); \ - } \ - } \ -} while (0) - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != DRM_OS_CURRENTPID ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - DRM_OS_RETURN( EINVAL ); \ - } \ -} while (0) - -#define WRAP_TEST_WITH_RETURN( dev_priv ) \ -do { \ - if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ - if ( mga_is_idle( dev_priv ) ) { \ - mga_do_dma_wrap_end( dev_priv ); \ - } else if ( dev_priv->prim.space < \ - dev_priv->prim.high_mark ) { \ - if ( MGA_DMA_DEBUG ) \ - DRM_INFO( __FUNCTION__": wrap...\n" ); \ - DRM_OS_RETURN( EBUSY); \ - } \ - } \ -} while (0) - -#define WRAP_WAIT_WITH_RETURN( dev_priv ) \ -do { \ - if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ - if ( mga_do_wait_for_idle( dev_priv ) ) { \ - if ( MGA_DMA_DEBUG ) \ - DRM_INFO( __FUNCTION__": wrap...\n" ); \ - DRM_OS_RETURN( EBUSY); \ - } \ - mga_do_dma_wrap_end( dev_priv ); \ - } \ -} while (0) - - -/* ================================================================ - * Primary DMA command stream - */ - -#define MGA_VERBOSE 0 - -#define DMA_LOCALS unsigned int write; volatile u8 *prim; - -#define DMA_BLOCK_SIZE (5 * sizeof(u32)) - -#define BEGIN_DMA( n ) \ -do { \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \ - (n), __FUNCTION__ ); \ - DRM_INFO( " space=0x%x req=0x%x\n", \ - dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ - } \ - prim = dev_priv->prim.start; \ - write = dev_priv->prim.tail; \ -} while (0) - -#define BEGIN_DMA_WRAP() \ -do { \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \ - DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \ - } \ - prim = dev_priv->prim.start; \ - write = dev_priv->prim.tail; \ -} while (0) - -#define ADVANCE_DMA() \ -do { \ - dev_priv->prim.tail = write; \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \ - write, dev_priv->prim.space ); \ - } \ -} while (0) - -#define FLUSH_DMA() \ -do { \ - if ( 0 ) { \ - DRM_INFO( __FUNCTION__ ":\n" ); \ - DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ - dev_priv->prim.tail, \ - MGA_READ( MGA_PRIMADDRESS ) - \ - dev_priv->primary->offset ); \ - } \ - if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \ - if ( dev_priv->prim.space < \ - dev_priv->prim.high_mark ) { \ - mga_do_dma_wrap_start( dev_priv ); \ - } else { \ - mga_do_dma_flush( dev_priv ); \ - } \ - } \ -} while (0) - -/* Never use this, always use DMA_BLOCK(...) for primary DMA output. - */ -#define DMA_WRITE( offset, val ) \ -do { \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \ - (u32)(val), write + (offset) * sizeof(u32) ); \ - } \ - *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ -} while (0) - -#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 ) \ -do { \ - DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) | \ - (DMAREG( reg1 ) << 8) | \ - (DMAREG( reg2 ) << 16) | \ - (DMAREG( reg3 ) << 24)) ); \ - DMA_WRITE( 1, val0 ); \ - DMA_WRITE( 2, val1 ); \ - DMA_WRITE( 3, val2 ); \ - DMA_WRITE( 4, val3 ); \ - write += DMA_BLOCK_SIZE; \ -} while (0) - - -/* Buffer aging via primary DMA stream head pointer. - */ - -#define SET_AGE( age, h, w ) \ -do { \ - (age)->head = h; \ - (age)->wrap = w; \ -} while (0) - -#define TEST_AGE( age, h, w ) ( (age)->wrap < w || \ - ( (age)->wrap == w && \ - (age)->head < h ) ) - -#define AGE_BUFFER( buf_priv ) \ -do { \ - drm_mga_freelist_t *entry = (buf_priv)->list_entry; \ - if ( (buf_priv)->dispatched ) { \ - entry->age.head = (dev_priv->prim.tail + \ - dev_priv->primary->offset); \ - entry->age.wrap = dev_priv->sarea_priv->last_wrap; \ - } else { \ - entry->age.head = 0; \ - entry->age.wrap = 0; \ - } \ -} while (0) - - -#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \ - MGA_DWGENGSTS | \ - MGA_ENDPRDMASTS) -#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \ - MGA_ENDPRDMASTS) - -#define MGA_DMA_DEBUG 0 - - - -/* A reduced set of the mga registers. - */ -#define MGA_CRTC_INDEX 0x1fd4 - -#define MGA_ALPHACTRL 0x2c7c -#define MGA_AR0 0x1c60 -#define MGA_AR1 0x1c64 -#define MGA_AR2 0x1c68 -#define MGA_AR3 0x1c6c -#define MGA_AR4 0x1c70 -#define MGA_AR5 0x1c74 -#define MGA_AR6 0x1c78 - -#define MGA_CXBNDRY 0x1c80 -#define MGA_CXLEFT 0x1ca0 -#define MGA_CXRIGHT 0x1ca4 - -#define MGA_DMAPAD 0x1c54 -#define MGA_DSTORG 0x2cb8 -#define MGA_DWGCTL 0x1c00 -# define MGA_OPCOD_MASK (15 << 0) -# define MGA_OPCOD_TRAP (4 << 0) -# define MGA_OPCOD_TEXTURE_TRAP (6 << 0) -# define MGA_OPCOD_BITBLT (8 << 0) -# define MGA_OPCOD_ILOAD (9 << 0) -# define MGA_ATYPE_MASK (7 << 4) -# define MGA_ATYPE_RPL (0 << 4) -# define MGA_ATYPE_RSTR (1 << 4) -# define MGA_ATYPE_ZI (3 << 4) -# define MGA_ATYPE_BLK (4 << 4) -# define MGA_ATYPE_I (7 << 4) -# define MGA_LINEAR (1 << 7) -# define MGA_ZMODE_MASK (7 << 8) -# define MGA_ZMODE_NOZCMP (0 << 8) -# define MGA_ZMODE_ZE (2 << 8) -# define MGA_ZMODE_ZNE (3 << 8) -# define MGA_ZMODE_ZLT (4 << 8) -# define MGA_ZMODE_ZLTE (5 << 8) -# define MGA_ZMODE_ZGT (6 << 8) -# define MGA_ZMODE_ZGTE (7 << 8) -# define MGA_SOLID (1 << 11) -# define MGA_ARZERO (1 << 12) -# define MGA_SGNZERO (1 << 13) -# define MGA_SHIFTZERO (1 << 14) -# define MGA_BOP_MASK (15 << 16) -# define MGA_BOP_ZERO (0 << 16) -# define MGA_BOP_DST (10 << 16) -# define MGA_BOP_SRC (12 << 16) -# define MGA_BOP_ONE (15 << 16) -# define MGA_TRANS_SHIFT 20 -# define MGA_TRANS_MASK (15 << 20) -# define MGA_BLTMOD_MASK (15 << 25) -# define MGA_BLTMOD_BMONOLEF (0 << 25) -# define MGA_BLTMOD_BMONOWF (4 << 25) -# define MGA_BLTMOD_PLAN (1 << 25) -# define MGA_BLTMOD_BFCOL (2 << 25) -# define MGA_BLTMOD_BU32BGR (3 << 25) -# define MGA_BLTMOD_BU32RGB (7 << 25) -# define MGA_BLTMOD_BU24BGR (11 << 25) -# define MGA_BLTMOD_BU24RGB (15 << 25) -# define MGA_PATTERN (1 << 29) -# define MGA_TRANSC (1 << 30) -# define MGA_CLIPDIS (1 << 31) -#define MGA_DWGSYNC 0x2c4c - -#define MGA_FCOL 0x1c24 -#define MGA_FIFOSTATUS 0x1e10 -#define MGA_FOGCOL 0x1cf4 -#define MGA_FXBNDRY 0x1c84 -#define MGA_FXLEFT 0x1ca8 -#define MGA_FXRIGHT 0x1cac - -#define MGA_ICLEAR 0x1e18 -# define MGA_SOFTRAPICLR (1 << 0) -#define MGA_IEN 0x1e1c -# define MGA_SOFTRAPIEN (1 << 0) - -#define MGA_LEN 0x1c5c - -#define MGA_MACCESS 0x1c04 - -#define MGA_PITCH 0x1c8c -#define MGA_PLNWT 0x1c1c -#define MGA_PRIMADDRESS 0x1e58 -# define MGA_DMA_GENERAL (0 << 0) -# define MGA_DMA_BLIT (1 << 0) -# define MGA_DMA_VECTOR (2 << 0) -# define MGA_DMA_VERTEX (3 << 0) -#define MGA_PRIMEND 0x1e5c -# define MGA_PRIMNOSTART (1 << 0) -# define MGA_PAGPXFER (1 << 1) -#define MGA_PRIMPTR 0x1e50 -# define MGA_PRIMPTREN0 (1 << 0) -# define MGA_PRIMPTREN1 (1 << 1) - -#define MGA_RST 0x1e40 -# define MGA_SOFTRESET (1 << 0) -# define MGA_SOFTEXTRST (1 << 1) - -#define MGA_SECADDRESS 0x2c40 -#define MGA_SECEND 0x2c44 -#define MGA_SETUPADDRESS 0x2cd0 -#define MGA_SETUPEND 0x2cd4 -#define MGA_SGN 0x1c58 -#define MGA_SOFTRAP 0x2c48 -#define MGA_SRCORG 0x2cb4 -# define MGA_SRMMAP_MASK (1 << 0) -# define MGA_SRCMAP_FB (0 << 0) -# define MGA_SRCMAP_SYSMEM (1 << 0) -# define MGA_SRCACC_MASK (1 << 1) -# define MGA_SRCACC_PCI (0 << 1) -# define MGA_SRCACC_AGP (1 << 1) -#define MGA_STATUS 0x1e14 -# define MGA_SOFTRAPEN (1 << 0) -# define MGA_DWGENGSTS (1 << 16) -# define MGA_ENDPRDMASTS (1 << 17) -#define MGA_STENCIL 0x2cc8 -#define MGA_STENCILCTL 0x2ccc - -#define MGA_TDUALSTAGE0 0x2cf8 -#define MGA_TDUALSTAGE1 0x2cfc -#define MGA_TEXBORDERCOL 0x2c5c -#define MGA_TEXCTL 0x2c30 -#define MGA_TEXCTL2 0x2c3c -# define MGA_DUALTEX (1 << 7) -# define MGA_G400_TC2_MAGIC (1 << 15) -# define MGA_MAP1_ENABLE (1 << 31) -#define MGA_TEXFILTER 0x2c58 -#define MGA_TEXHEIGHT 0x2c2c -#define MGA_TEXORG 0x2c24 -# define MGA_TEXORGMAP_MASK (1 << 0) -# define MGA_TEXORGMAP_FB (0 << 0) -# define MGA_TEXORGMAP_SYSMEM (1 << 0) -# define MGA_TEXORGACC_MASK (1 << 1) -# define MGA_TEXORGACC_PCI (0 << 1) -# define MGA_TEXORGACC_AGP (1 << 1) -#define MGA_TEXORG1 0x2ca4 -#define MGA_TEXORG2 0x2ca8 -#define MGA_TEXORG3 0x2cac -#define MGA_TEXORG4 0x2cb0 -#define MGA_TEXTRANS 0x2c34 -#define MGA_TEXTRANSHIGH 0x2c38 -#define MGA_TEXWIDTH 0x2c28 - -#define MGA_WACCEPTSEQ 0x1dd4 -#define MGA_WCODEADDR 0x1e6c -#define MGA_WFLAG 0x1dc4 -#define MGA_WFLAG1 0x1de0 -#define MGA_WFLAGNB 0x1e64 -#define MGA_WFLAGNB1 0x1e08 -#define MGA_WGETMSB 0x1dc8 -#define MGA_WIADDR 0x1dc0 -#define MGA_WIADDR2 0x1dd8 -# define MGA_WMODE_SUSPEND (0 << 0) -# define MGA_WMODE_RESUME (1 << 0) -# define MGA_WMODE_JUMP (2 << 0) -# define MGA_WMODE_START (3 << 0) -# define MGA_WAGP_ENABLE (1 << 2) -#define MGA_WMISC 0x1e70 -# define MGA_WUCODECACHE_ENABLE (1 << 0) -# define MGA_WMASTER_ENABLE (1 << 1) -# define MGA_WCACHEFLUSH_ENABLE (1 << 3) -#define MGA_WVRTXSZ 0x1dcc - -#define MGA_YBOT 0x1c9c -#define MGA_YDST 0x1c90 -#define MGA_YDSTLEN 0x1c88 -#define MGA_YDSTORG 0x1c94 -#define MGA_YTOP 0x1c98 - -#define MGA_ZORG 0x1c0c - -/* This finishes the current batch of commands - */ -#define MGA_EXEC 0x0100 - -/* Warp registers - */ -#define MGA_WR0 0x2d00 -#define MGA_WR1 0x2d04 -#define MGA_WR2 0x2d08 -#define MGA_WR3 0x2d0c -#define MGA_WR4 0x2d10 -#define MGA_WR5 0x2d14 -#define MGA_WR6 0x2d18 -#define MGA_WR7 0x2d1c -#define MGA_WR8 0x2d20 -#define MGA_WR9 0x2d24 -#define MGA_WR10 0x2d28 -#define MGA_WR11 0x2d2c -#define MGA_WR12 0x2d30 -#define MGA_WR13 0x2d34 -#define MGA_WR14 0x2d38 -#define MGA_WR15 0x2d3c -#define MGA_WR16 0x2d40 -#define MGA_WR17 0x2d44 -#define MGA_WR18 0x2d48 -#define MGA_WR19 0x2d4c -#define MGA_WR20 0x2d50 -#define MGA_WR21 0x2d54 -#define MGA_WR22 0x2d58 -#define MGA_WR23 0x2d5c -#define MGA_WR24 0x2d60 -#define MGA_WR25 0x2d64 -#define MGA_WR26 0x2d68 -#define MGA_WR27 0x2d6c -#define MGA_WR28 0x2d70 -#define MGA_WR29 0x2d74 -#define MGA_WR30 0x2d78 -#define MGA_WR31 0x2d7c -#define MGA_WR32 0x2d80 -#define MGA_WR33 0x2d84 -#define MGA_WR34 0x2d88 -#define MGA_WR35 0x2d8c -#define MGA_WR36 0x2d90 -#define MGA_WR37 0x2d94 -#define MGA_WR38 0x2d98 -#define MGA_WR39 0x2d9c -#define MGA_WR40 0x2da0 -#define MGA_WR41 0x2da4 -#define MGA_WR42 0x2da8 -#define MGA_WR43 0x2dac -#define MGA_WR44 0x2db0 -#define MGA_WR45 0x2db4 -#define MGA_WR46 0x2db8 -#define MGA_WR47 0x2dbc -#define MGA_WR48 0x2dc0 -#define MGA_WR49 0x2dc4 -#define MGA_WR50 0x2dc8 -#define MGA_WR51 0x2dcc -#define MGA_WR52 0x2dd0 -#define MGA_WR53 0x2dd4 -#define MGA_WR54 0x2dd8 -#define MGA_WR55 0x2ddc -#define MGA_WR56 0x2de0 -#define MGA_WR57 0x2de4 -#define MGA_WR58 0x2de8 -#define MGA_WR59 0x2dec -#define MGA_WR60 0x2df0 -#define MGA_WR61 0x2df4 -#define MGA_WR62 0x2df8 -#define MGA_WR63 0x2dfc -# define MGA_G400_WR_MAGIC (1 << 6) -# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */ - - -#define MGA_ILOAD_ALIGN 64 -#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1) - -#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \ - MGA_ATYPE_I | \ - MGA_ZMODE_NOZCMP | \ - MGA_ARZERO | \ - MGA_SGNZERO | \ - MGA_BOP_SRC | \ - (15 << MGA_TRANS_SHIFT)) - -#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \ - MGA_ZMODE_NOZCMP | \ - MGA_SOLID | \ - MGA_ARZERO | \ - MGA_SGNZERO | \ - MGA_SHIFTZERO | \ - MGA_BOP_SRC | \ - (0 << MGA_TRANS_SHIFT) | \ - MGA_BLTMOD_BMONOLEF | \ - MGA_TRANSC | \ - MGA_CLIPDIS) - -#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \ - MGA_ATYPE_RPL | \ - MGA_SGNZERO | \ - MGA_SHIFTZERO | \ - MGA_BOP_SRC | \ - (0 << MGA_TRANS_SHIFT) | \ - MGA_BLTMOD_BFCOL | \ - MGA_CLIPDIS) - -/* Simple idle test. - */ -static __inline__ int mga_is_idle( drm_mga_private_t *dev_priv ) -{ - u32 status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; - return ( status == MGA_ENDPRDMASTS ); -} - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:1.3 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c Thu Feb 27 12:32:25 2003 @@ -1,1066 +0,0 @@ -/* mga_state.c -- State support for MGA G200/G400 -*- linux-c -*- - * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - * Rewritten by: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" -#include "drm.h" - - -/* ================================================================ - * DMA hardware state programming functions - */ - -static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, - drm_clip_rect_t *box ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - unsigned int pitch = dev_priv->front_pitch; - DMA_LOCALS; - - BEGIN_DMA( 2 ); - - /* Force reset of DWGCTL on G400 (eliminates clip disable bit). - */ - if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { - DMA_BLOCK( MGA_DWGCTL, ctx->dwgctl, - MGA_LEN + MGA_EXEC, 0x80000000, - MGA_DWGCTL, ctx->dwgctl, - MGA_LEN + MGA_EXEC, 0x80000000 ); - } - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_CXBNDRY, (box->x2 << 16) | box->x1, - MGA_YTOP, box->y1 * pitch, - MGA_YBOT, box->y2 * pitch ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g200_emit_context( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - DMA_LOCALS; - - BEGIN_DMA( 3 ); - - DMA_BLOCK( MGA_DSTORG, ctx->dstorg, - MGA_MACCESS, ctx->maccess, - MGA_PLNWT, ctx->plnwt, - MGA_DWGCTL, ctx->dwgctl ); - - DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, - MGA_FOGCOL, ctx->fogcolor, - MGA_WFLAG, ctx->wflag, - MGA_ZORG, dev_priv->depth_offset ); - - DMA_BLOCK( MGA_FCOL, ctx->fcol, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g400_emit_context( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - DMA_LOCALS; - - BEGIN_DMA( 4 ); - - DMA_BLOCK( MGA_DSTORG, ctx->dstorg, - MGA_MACCESS, ctx->maccess, - MGA_PLNWT, ctx->plnwt, - MGA_DWGCTL, ctx->dwgctl ); - - DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, - MGA_FOGCOL, ctx->fogcolor, - MGA_WFLAG, ctx->wflag, - MGA_ZORG, dev_priv->depth_offset ); - - DMA_BLOCK( MGA_WFLAG1, ctx->wflag, - MGA_TDUALSTAGE0, ctx->tdualstage0, - MGA_TDUALSTAGE1, ctx->tdualstage1, - MGA_FCOL, ctx->fcol ); - - DMA_BLOCK( MGA_STENCIL, ctx->stencil, - MGA_STENCILCTL, ctx->stencilctl, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g200_emit_tex0( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; - DMA_LOCALS; - - BEGIN_DMA( 4 ); - - DMA_BLOCK( MGA_TEXCTL2, tex->texctl2, - MGA_TEXCTL, tex->texctl, - MGA_TEXFILTER, tex->texfilter, - MGA_TEXBORDERCOL, tex->texbordercol ); - - DMA_BLOCK( MGA_TEXORG, tex->texorg, - MGA_TEXORG1, tex->texorg1, - MGA_TEXORG2, tex->texorg2, - MGA_TEXORG3, tex->texorg3 ); - - DMA_BLOCK( MGA_TEXORG4, tex->texorg4, - MGA_TEXWIDTH, tex->texwidth, - MGA_TEXHEIGHT, tex->texheight, - MGA_WR24, tex->texwidth ); - - DMA_BLOCK( MGA_WR34, tex->texheight, - MGA_TEXTRANS, 0x0000ffff, - MGA_TEXTRANSHIGH, 0x0000ffff, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g400_emit_tex0( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; - DMA_LOCALS; - - BEGIN_DMA( 6 ); - - DMA_BLOCK( MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC, - MGA_TEXCTL, tex->texctl, - MGA_TEXFILTER, tex->texfilter, - MGA_TEXBORDERCOL, tex->texbordercol ); - - DMA_BLOCK( MGA_TEXORG, tex->texorg, - MGA_TEXORG1, tex->texorg1, - MGA_TEXORG2, tex->texorg2, - MGA_TEXORG3, tex->texorg3 ); - - DMA_BLOCK( MGA_TEXORG4, tex->texorg4, - MGA_TEXWIDTH, tex->texwidth, - MGA_TEXHEIGHT, tex->texheight, - MGA_WR49, 0x00000000 ); - - DMA_BLOCK( MGA_WR57, 0x00000000, - MGA_WR53, 0x00000000, - MGA_WR61, 0x00000000, - MGA_WR52, MGA_G400_WR_MAGIC ); - - DMA_BLOCK( MGA_WR60, MGA_G400_WR_MAGIC, - MGA_WR54, tex->texwidth | MGA_G400_WR_MAGIC, - MGA_WR62, tex->texheight | MGA_G400_WR_MAGIC, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_TEXTRANS, 0x0000ffff, - MGA_TEXTRANSHIGH, 0x0000ffff ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g400_emit_tex1( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1]; - DMA_LOCALS; - - BEGIN_DMA( 5 ); - - DMA_BLOCK( MGA_TEXCTL2, (tex->texctl2 | - MGA_MAP1_ENABLE | - MGA_G400_TC2_MAGIC), - MGA_TEXCTL, tex->texctl, - MGA_TEXFILTER, tex->texfilter, - MGA_TEXBORDERCOL, tex->texbordercol ); - - DMA_BLOCK( MGA_TEXORG, tex->texorg, - MGA_TEXORG1, tex->texorg1, - MGA_TEXORG2, tex->texorg2, - MGA_TEXORG3, tex->texorg3 ); - - DMA_BLOCK( MGA_TEXORG4, tex->texorg4, - MGA_TEXWIDTH, tex->texwidth, - MGA_TEXHEIGHT, tex->texheight, - MGA_WR49, 0x00000000 ); - - DMA_BLOCK( MGA_WR57, 0x00000000, - MGA_WR53, 0x00000000, - MGA_WR61, 0x00000000, - MGA_WR52, tex->texwidth | MGA_G400_WR_MAGIC ); - - DMA_BLOCK( MGA_WR60, tex->texheight | MGA_G400_WR_MAGIC, - MGA_TEXTRANS, 0x0000ffff, - MGA_TEXTRANSHIGH, 0x0000ffff, - MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g200_emit_pipe( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->warp_pipe; - DMA_LOCALS; - - BEGIN_DMA( 3 ); - - DMA_BLOCK( MGA_WIADDR, MGA_WMODE_SUSPEND, - MGA_WVRTXSZ, 0x00000007, - MGA_WFLAG, 0x00000000, - MGA_WR24, 0x00000000 ); - - DMA_BLOCK( MGA_WR25, 0x00000100, - MGA_WR34, 0x00000000, - MGA_WR42, 0x0000ffff, - MGA_WR60, 0x0000ffff ); - - /* Padding required to to hardware bug. - */ - DMA_BLOCK( MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_WIADDR, (dev_priv->warp_pipe_phys[pipe] | - MGA_WMODE_START | - MGA_WAGP_ENABLE) ); - - ADVANCE_DMA(); -} - -static __inline__ void mga_g400_emit_pipe( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->warp_pipe; - DMA_LOCALS; - - BEGIN_DMA( 10 ); - - DMA_BLOCK( MGA_WIADDR2, MGA_WMODE_SUSPEND, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - if ( pipe & MGA_T2 ) { - DMA_BLOCK( MGA_WVRTXSZ, 0x00001e09, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x1e000000 ); - } else { - if ( dev_priv->warp_pipe & MGA_T2 ) { - /* Flush the WARP pipe */ - DMA_BLOCK( MGA_YDST, 0x00000000, - MGA_FXLEFT, 0x00000000, - MGA_FXRIGHT, 0x00000001, - MGA_DWGCTL, MGA_DWGCTL_FLUSH ); - - DMA_BLOCK( MGA_LEN + MGA_EXEC, 0x00000001, - MGA_DWGSYNC, 0x00007000, - MGA_TEXCTL2, MGA_G400_TC2_MAGIC, - MGA_LEN + MGA_EXEC, 0x00000000 ); - - DMA_BLOCK( MGA_TEXCTL2, (MGA_DUALTEX | - MGA_G400_TC2_MAGIC), - MGA_LEN + MGA_EXEC, 0x00000000, - MGA_TEXCTL2, MGA_G400_TC2_MAGIC, - MGA_DMAPAD, 0x00000000 ); - } - - DMA_BLOCK( MGA_WVRTXSZ, 0x00001807, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x18000000 ); - } - - DMA_BLOCK( MGA_WFLAG, 0x00000000, - MGA_WFLAG1, 0x00000000, - MGA_WR56, MGA_G400_WR56_MAGIC, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_WR49, 0x00000000, /* tex0 */ - MGA_WR57, 0x00000000, /* tex0 */ - MGA_WR53, 0x00000000, /* tex1 */ - MGA_WR61, 0x00000000 ); /* tex1 */ - - DMA_BLOCK( MGA_WR54, MGA_G400_WR_MAGIC, /* tex0 width */ - MGA_WR62, MGA_G400_WR_MAGIC, /* tex0 height */ - MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */ - MGA_WR60, MGA_G400_WR_MAGIC ); /* tex1 height */ - - /* Padding required to to hardware bug */ - DMA_BLOCK( MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_WIADDR2, (dev_priv->warp_pipe_phys[pipe] | - MGA_WMODE_START | - MGA_WAGP_ENABLE) ); - - ADVANCE_DMA(); -} - -static void mga_g200_emit_state( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { - mga_g200_emit_pipe( dev_priv ); - dev_priv->warp_pipe = sarea_priv->warp_pipe; - } - - if ( dirty & MGA_UPLOAD_CONTEXT ) { - mga_g200_emit_context( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; - } - - if ( dirty & MGA_UPLOAD_TEX0 ) { - mga_g200_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } -} - -static void mga_g400_emit_state( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - int multitex = sarea_priv->warp_pipe & MGA_T2; - - if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { - mga_g400_emit_pipe( dev_priv ); - dev_priv->warp_pipe = sarea_priv->warp_pipe; - } - - if ( dirty & MGA_UPLOAD_CONTEXT ) { - mga_g400_emit_context( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; - } - - if ( dirty & MGA_UPLOAD_TEX0 ) { - mga_g400_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } - - if ( (dirty & MGA_UPLOAD_TEX1) && multitex ) { - mga_g400_emit_tex1( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; - } -} - - -/* ================================================================ - * SAREA state verification - */ - -/* Disallow all write destinations except the front and backbuffer. - */ -static int mga_verify_context( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - - if ( ctx->dstorg != dev_priv->front_offset && - ctx->dstorg != dev_priv->back_offset ) { - DRM_ERROR( "*** bad DSTORG: %x (front %x, back %x)\n\n", - ctx->dstorg, dev_priv->front_offset, - dev_priv->back_offset ); - ctx->dstorg = 0; - DRM_OS_RETURN( EINVAL ); - } - - return 0; -} - -/* Disallow texture reads from PCI space. - */ -static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit]; - unsigned int org; - - org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); - - if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { - DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n", - tex->texorg, unit ); - tex->texorg = 0; - DRM_OS_RETURN( EINVAL ); - } - - return 0; -} - -static int mga_verify_state( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - int ret = 0; - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - if ( dirty & MGA_UPLOAD_CONTEXT ) - ret |= mga_verify_context( dev_priv ); - - if ( dirty & MGA_UPLOAD_TEX0 ) - ret |= mga_verify_tex( dev_priv, 0 ); - - if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { - if ( dirty & MGA_UPLOAD_TEX1 ) - ret |= mga_verify_tex( dev_priv, 1 ); - - if ( dirty & MGA_UPLOAD_PIPE ) - ret |= ( sarea_priv->warp_pipe > MGA_MAX_G400_PIPES ); - } else { - if ( dirty & MGA_UPLOAD_PIPE ) - ret |= ( sarea_priv->warp_pipe > MGA_MAX_G200_PIPES ); - } - - return ( ret == 0 ); -} - -static int mga_verify_iload( drm_mga_private_t *dev_priv, - unsigned int dstorg, unsigned int length ) -{ - if ( dstorg < dev_priv->texture_offset || - dstorg + length > (dev_priv->texture_offset + - dev_priv->texture_size) ) { - DRM_ERROR( "*** bad iload DSTORG: 0x%x\n", dstorg ); - DRM_OS_RETURN( EINVAL ); - } - - if ( length & MGA_ILOAD_MASK ) { - DRM_ERROR( "*** bad iload length: 0x%x\n", - length & MGA_ILOAD_MASK ); - DRM_OS_RETURN( EINVAL ); - } - - return 0; -} - -static int mga_verify_blit( drm_mga_private_t *dev_priv, - unsigned int srcorg, unsigned int dstorg ) -{ - if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || - (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) { - DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n", - srcorg, dstorg ); - DRM_OS_RETURN( EINVAL ); - } - return 0; -} - - -/* ================================================================ - * - */ - -static void mga_dma_dispatch_clear( drm_device_t *dev, - drm_mga_clear_t *clear ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - int i; - DMA_LOCALS; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - ADVANCE_DMA(); - - for ( i = 0 ; i < nbox ; i++ ) { - drm_clip_rect_t *box = &pbox[i]; - u32 height = box->y2 - box->y1; - - DRM_DEBUG( " from=%d,%d to=%d,%d\n", - box->x1, box->y1, box->x2, box->y2 ); - - if ( clear->flags & MGA_FRONT ) { - BEGIN_DMA( 2 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, clear->color_mask, - MGA_YDSTLEN, (box->y1 << 16) | height, - MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_FCOL, clear->clear_color, - MGA_DSTORG, dev_priv->front_offset, - MGA_DWGCTL + MGA_EXEC, - dev_priv->clear_cmd ); - - ADVANCE_DMA(); - } - - - if ( clear->flags & MGA_BACK ) { - BEGIN_DMA( 2 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, clear->color_mask, - MGA_YDSTLEN, (box->y1 << 16) | height, - MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_FCOL, clear->clear_color, - MGA_DSTORG, dev_priv->back_offset, - MGA_DWGCTL + MGA_EXEC, - dev_priv->clear_cmd ); - - ADVANCE_DMA(); - } - - if ( clear->flags & MGA_DEPTH ) { - BEGIN_DMA( 2 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, clear->depth_mask, - MGA_YDSTLEN, (box->y1 << 16) | height, - MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_FCOL, clear->clear_depth, - MGA_DSTORG, dev_priv->depth_offset, - MGA_DWGCTL + MGA_EXEC, - dev_priv->clear_cmd ); - - ADVANCE_DMA(); - } - - } - - BEGIN_DMA( 1 ); - - /* Force reset of DWGCTL */ - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_PLNWT, ctx->plnwt, - MGA_DWGCTL, ctx->dwgctl ); - - ADVANCE_DMA(); - - FLUSH_DMA(); -} - -static void mga_dma_dispatch_swap( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - int i; - DMA_LOCALS; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - sarea_priv->last_frame.head = dev_priv->prim.tail; - sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; - - BEGIN_DMA( 4 + nbox ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, - MGA_MACCESS, dev_priv->maccess, - MGA_SRCORG, dev_priv->back_offset, - MGA_AR5, dev_priv->front_pitch ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_PLNWT, 0xffffffff, - MGA_DWGCTL, MGA_DWGCTL_COPY ); - - for ( i = 0 ; i < nbox ; i++ ) { - drm_clip_rect_t *box = &pbox[i]; - u32 height = box->y2 - box->y1; - u32 start = box->y1 * dev_priv->front_pitch; - - DRM_DEBUG( " from=%d,%d to=%d,%d\n", - box->x1, box->y1, box->x2, box->y2 ); - - DMA_BLOCK( MGA_AR0, start + box->x2 - 1, - MGA_AR3, start + box->x1, - MGA_FXBNDRY, ((box->x2 - 1) << 16) | box->x1, - MGA_YDSTLEN + MGA_EXEC, - (box->y1 << 16) | height ); - } - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, ctx->plnwt, - MGA_SRCORG, dev_priv->front_offset, - MGA_DWGCTL, ctx->dwgctl ); - - ADVANCE_DMA(); - - FLUSH_DMA(); - - DRM_DEBUG( "%s... done.\n", __FUNCTION__ ); -} - -static void mga_dma_dispatch_vertex( drm_device_t *dev, drm_buf_t *buf ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - u32 address = (u32) buf->bus_address; - u32 length = (u32) buf->used; - int i = 0; - DMA_LOCALS; - DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used ); - - if ( buf->used ) { - buf_priv->dispatched = 1; - - MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); - - do { - if ( i < sarea_priv->nbox ) { - mga_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_SECADDRESS, (address | - MGA_DMA_VERTEX), - MGA_SECEND, ((address + length) | - MGA_PAGPXFER) ); - - ADVANCE_DMA(); - } while ( ++i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - AGE_BUFFER( buf_priv ); - buf->pending = 0; - buf->used = 0; - buf_priv->dispatched = 0; - - mga_freelist_put( dev, buf ); - } - - FLUSH_DMA(); -} - -static void mga_dma_dispatch_indices( drm_device_t *dev, drm_buf_t *buf, - unsigned int start, unsigned int end ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - u32 address = (u32) buf->bus_address; - int i = 0; - DMA_LOCALS; - DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end ); - - if ( start != end ) { - buf_priv->dispatched = 1; - - MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); - - do { - if ( i < sarea_priv->nbox ) { - mga_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_SETUPADDRESS, address + start, - MGA_SETUPEND, ((address + end) | - MGA_PAGPXFER) ); - - ADVANCE_DMA(); - } while ( ++i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - AGE_BUFFER( buf_priv ); - buf->pending = 0; - buf->used = 0; - buf_priv->dispatched = 0; - - mga_freelist_put( dev, buf ); - } - - FLUSH_DMA(); -} - -/* This copies a 64 byte aligned agp region to the frambuffer with a - * standard blit, the ioctl needs to do checking. - */ -static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, - unsigned int dstorg, unsigned int length ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state; - u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM; - u32 y2; - DMA_LOCALS; - DRM_DEBUG( "%s: buf=%d used=%d\n", - __FUNCTION__, buf->idx, buf->used ); - - y2 = length / 64; - - BEGIN_DMA( 5 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - DMA_BLOCK( MGA_DSTORG, dstorg, - MGA_MACCESS, 0x00000000, - MGA_SRCORG, srcorg, - MGA_AR5, 64 ); - - DMA_BLOCK( MGA_PITCH, 64, - MGA_PLNWT, 0xffffffff, - MGA_DMAPAD, 0x00000000, - MGA_DWGCTL, MGA_DWGCTL_COPY ); - - DMA_BLOCK( MGA_AR0, 63, - MGA_AR3, 0, - MGA_FXBNDRY, (63 << 16) | 0, - MGA_YDSTLEN + MGA_EXEC, y2 ); - - DMA_BLOCK( MGA_PLNWT, ctx->plnwt, - MGA_SRCORG, dev_priv->front_offset, - MGA_PITCH, dev_priv->front_pitch, - MGA_DWGSYNC, 0x00007000 ); - - ADVANCE_DMA(); - - AGE_BUFFER( buf_priv ); - - buf->pending = 0; - buf->used = 0; - buf_priv->dispatched = 0; - - mga_freelist_put( dev, buf ); - - FLUSH_DMA(); -} - -static void mga_dma_dispatch_blit( drm_device_t *dev, - drm_mga_blit_t *blit ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - u32 scandir = 0, i; - DMA_LOCALS; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - BEGIN_DMA( 4 + nbox ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - DMA_BLOCK( MGA_DWGCTL, MGA_DWGCTL_COPY, - MGA_PLNWT, blit->planemask, - MGA_SRCORG, blit->srcorg, - MGA_DSTORG, blit->dstorg ); - - DMA_BLOCK( MGA_SGN, scandir, - MGA_MACCESS, dev_priv->maccess, - MGA_AR5, blit->ydir * blit->src_pitch, - MGA_PITCH, blit->dst_pitch ); - - for ( i = 0 ; i < nbox ; i++ ) { - int srcx = pbox[i].x1 + blit->delta_sx; - int srcy = pbox[i].y1 + blit->delta_sy; - int dstx = pbox[i].x1 + blit->delta_dx; - int dsty = pbox[i].y1 + blit->delta_dy; - int h = pbox[i].y2 - pbox[i].y1; - int w = pbox[i].x2 - pbox[i].x1 - 1; - int start; - - if ( blit->ydir == -1 ) { - srcy = blit->height - srcy - 1; - } - - start = srcy * blit->src_pitch + srcx; - - DMA_BLOCK( MGA_AR0, start + w, - MGA_AR3, start, - MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff), - MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h ); - } - - /* Do something to flush AGP? - */ - - /* Force reset of DWGCTL */ - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, ctx->plnwt, - MGA_PITCH, dev_priv->front_pitch, - MGA_DWGCTL, ctx->dwgctl ); - - ADVANCE_DMA(); -} - - -/* ================================================================ - * - */ - -int mga_dma_clear( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_clear_t clear; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( clear, (drm_mga_clear_t *) data, sizeof(clear) ); - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_clear( dev, &clear ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} - -int mga_dma_swap( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_swap( dev ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} - -int mga_dma_vertex( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_vertex_t vertex; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( vertex, (drm_mga_vertex_t *) data, sizeof(vertex) ); - - if(vertex.idx < 0 || vertex.idx > dma->buf_count) DRM_OS_RETURN( EINVAL ); - buf = dma->buflist[vertex.idx]; - buf_priv = buf->dev_private; - - buf->used = vertex.used; - buf_priv->discard = vertex.discard; - - if ( !mga_verify_state( dev_priv ) ) { - if ( vertex.discard ) { - if ( buf_priv->dispatched == 1 ) - AGE_BUFFER( buf_priv ); - buf_priv->dispatched = 0; - mga_freelist_put( dev, buf ); - } - DRM_OS_RETURN( EINVAL ); - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_vertex( dev, buf ); - - return 0; -} - -int mga_dma_indices( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_indices_t indices; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( indices, (drm_mga_indices_t *) data, sizeof(indices) ); - - if(indices.idx < 0 || indices.idx > dma->buf_count) DRM_OS_RETURN( EINVAL ); - - buf = dma->buflist[indices.idx]; - buf_priv = buf->dev_private; - - buf_priv->discard = indices.discard; - - if ( !mga_verify_state( dev_priv ) ) { - if ( indices.discard ) { - if ( buf_priv->dispatched == 1 ) - AGE_BUFFER( buf_priv ); - buf_priv->dispatched = 0; - mga_freelist_put( dev, buf ); - } - DRM_OS_RETURN( EINVAL ); - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_indices( dev, buf, indices.start, indices.end ); - - return 0; -} - -int mga_dma_iload( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_iload_t iload; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( iload, (drm_mga_iload_t *) data, sizeof(iload) ); - -#if 0 - if ( mga_do_wait_for_idle( dev_priv ) ) { - if ( MGA_DMA_DEBUG ) - DRM_INFO( __FUNCTION__": -EBUSY\n" ); - DRM_OS_RETURN( EBUSY ); - } -#endif - if(iload.idx < 0 || iload.idx > dma->buf_count) DRM_OS_RETURN( EINVAL ); - - buf = dma->buflist[iload.idx]; - buf_priv = buf->dev_private; - - if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { - mga_freelist_put( dev, buf ); - DRM_OS_RETURN( EINVAL ); - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} - -int mga_dma_blit( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_blit_t blit; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( blit, (drm_mga_blit_t *) data, sizeof(blit) ); - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) ) - DRM_OS_RETURN( EINVAL ); - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_blit( dev, &blit ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h:1.1 Wed Dec 12 19:24:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h Thu Feb 27 12:32:25 2003 @@ -1,11645 +0,0 @@ -/* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*- - * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com - * - * Copyright 1999 Matrox Graphics Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * MATROX GRAPHICS INC., OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Kernel-based WARP engine management: - * Gareth Hughes <gareth@valinux.com> - */ - -/* - * WARP pipes are named according to the functions they perform, where: - * - * - T stands for computation of texture stage 0 - * - T2 stands for computation of both texture stage 0 and texture stage 1 - * - G stands for computation of triangle intensity (Gouraud interpolation) - * - Z stands for computation of Z buffer interpolation - * - S stands for computation of specular highlight - * - A stands for computation of the alpha channel - * - F stands for computation of vertex fog interpolation - */ - -static unsigned char warp_g200_tgz[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x72, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x60, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x03, 0x80, 0x0A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x57, 0x39, 0x20, 0xE9, -0x28, 0x19, 0x60, 0xEC, - -0x2B, 0x32, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0xB3, 0x05, -0x00, 0xE0, -0x16, 0x28, 0x20, 0xE9, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x2B, 0x20, 0xE9, - -0x1C, 0x80, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x85, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x84, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x82, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x7F, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgza[] = { - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x7D, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x6B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x44, 0x4C, 0xB6, -0x25, 0x44, 0x54, 0xB6, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x07, 0xC0, 0x44, 0xC6, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x1F, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x3F, 0x3D, 0x5D, 0x9F, -0x00, 0xE0, -0x07, 0x20, - -0x00, 0x80, 0x00, 0xE8, -0x28, 0x19, 0x60, 0xEC, - -0xB3, 0x05, -0x00, 0xE0, -0x00, 0x80, 0x00, 0xE8, - -0x23, 0x3B, 0x33, 0xAD, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0x26, 0x1F, 0xDF, -0x9D, 0x1F, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x9E, 0x3F, 0x4F, 0xE9, - -0x07, 0x07, 0x1F, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x9C, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x7A, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x79, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x77, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x74, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzaf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x83, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x6F, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x2D, 0x44, 0x4C, 0xB6, -0x25, 0x44, 0x54, 0xB6, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x00, 0xE0, -0x25, 0x20, -0x07, 0xC0, 0x44, 0xC6, - -0x17, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x2D, 0x20, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x1F, 0x62, 0x57, 0x9F, -0x00, 0xE0, -0x07, 0x20, - -0x3F, 0x3D, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x28, 0x19, 0x60, 0xEC, - -0xB3, 0x05, -0x00, 0xE0, -0x17, 0x26, 0x17, 0xDF, - -0x23, 0x3B, 0x33, 0xAD, -0x35, 0x17, 0x4F, 0xE9, - -0x1F, 0x26, 0x1F, 0xDF, -0x9D, 0x1F, 0x4F, 0xE9, - -0x9E, 0x3F, 0x4F, 0xE9, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x07, 0x07, 0x1F, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x31, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x9C, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x74, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x73, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x71, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x6E, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x7F, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x6B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x17, 0x50, 0x56, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x00, 0x80, 0x00, 0xE8, -0x28, 0x19, 0x60, 0xEC, - -0xB3, 0x05, -0x00, 0xE0, -0x00, 0x80, 0x00, 0xE8, - -0x23, 0x3B, 0x33, 0xAD, -0x00, 0x80, 0x00, 0xE8, - -0x17, 0x26, 0x17, 0xDF, -0x35, 0x17, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x31, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x78, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x77, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x75, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x72, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzs[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x8B, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x77, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x8F, 0x20, - -0xA5, 0x37, 0x4F, 0xE9, -0x0F, 0x17, 0x0F, 0xAF, - -0x06, 0xC0, 0x21, 0xC4, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0xA3, 0x80, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0xA1, 0x1F, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x06, 0x06, 0x1F, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x6C, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x6B, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x69, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzsa[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x8F, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x7B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x0D, 0x44, 0x4C, 0xB6, -0x05, 0x44, 0x54, 0xB6, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x0D, 0x20, -0x05, 0x20, -0x00, 0x80, 0x00, 0xE8, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x0F, 0x20, - -0x17, 0x50, 0x56, 0x9F, -0xA5, 0x37, 0x4F, 0xE9, - -0x06, 0xC0, 0x21, 0xC4, -0x0F, 0x17, 0x0F, 0xAF, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2F, 0xC0, 0x44, 0xC6, -0xA3, 0x80, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0x17, 0x26, 0x17, 0xDF, -0x9D, 0x17, 0x4F, 0xE9, - -0xA1, 0x1F, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x06, 0x06, 0x1F, 0xAF, -0x00, 0xE0, -0xAF, 0x20, - -0x9E, 0x37, 0x4F, 0xE9, -0x2F, 0x17, 0x2F, 0xAF, - -0xA0, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x9C, 0x80, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x68, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x67, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x65, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x62, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzsaf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x94, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x80, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0x2D, 0x44, 0x4C, 0xB6, -0x25, 0x44, 0x54, 0xB6, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x0F, 0x20, - -0x2D, 0x20, -0x25, 0x20, -0x07, 0xC0, 0x44, 0xC6, - -0x17, 0x50, 0x56, 0x9F, -0xA5, 0x37, 0x4F, 0xE9, - -0x06, 0xC0, 0x21, 0xC4, -0x0F, 0x17, 0x0F, 0xAF, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x3E, 0x3D, 0x5D, 0x9F, -0x00, 0xE0, -0x07, 0x20, - -0x2F, 0x20, -0x00, 0xE0, -0xA3, 0x0F, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0x17, 0x26, 0x17, 0xDF, -0xA1, 0x1F, 0x4F, 0xE9, - -0x1E, 0x26, 0x1E, 0xDF, -0x9D, 0x1E, 0x4F, 0xE9, - -0x35, 0x17, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x06, 0x06, 0x1F, 0xAF, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x07, 0x07, 0x1E, 0xAF, - -0xA0, 0x80, 0x4F, 0xE9, -0x9E, 0x3E, 0x4F, 0xE9, - -0x31, 0x80, 0x4F, 0xE9, -0x9C, 0x80, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x63, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x62, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x60, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x5D, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzsf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x8F, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x7B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x0F, 0x20, - -0x17, 0x50, 0x56, 0x9F, -0xA5, 0x37, 0x4F, 0xE9, - -0x06, 0xC0, 0x21, 0xC4, -0x0F, 0x17, 0x0F, 0xAF, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2F, 0x20, -0x00, 0xE0, -0xA3, 0x80, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0x17, 0x26, 0x17, 0xDF, -0x35, 0x17, 0x4F, 0xE9, - -0xA1, 0x1F, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x06, 0x06, 0x1F, 0xAF, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x31, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x68, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x67, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x65, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x62, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g400_t2gz[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x78, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x69, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x25, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x9F, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xBE, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x7D, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gza[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x7C, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x6D, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x29, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x74, 0xC6, -0x3D, 0xCF, 0x74, 0xC2, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB4, -0x02, 0x44, 0x64, 0xB4, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x9B, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xBA, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x79, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzaf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x81, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x72, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x37, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x2E, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x0F, 0xCF, 0x74, 0xC6, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB4, -0x02, 0x44, 0x64, 0xB4, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x75, 0xC6, -0x00, 0x80, 0x00, 0xE8, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x45, 0x55, 0xB6, -0x02, 0x45, 0x65, 0xB6, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x96, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xB5, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x74, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x7D, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x6E, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x39, 0xE5, 0x2C, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x88, 0x73, 0x5E, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0F, 0xCF, 0x75, 0xC6, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x28, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x0F, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB4, -0x02, 0x44, 0x64, 0xB4, - -0x2A, 0x45, 0x55, 0xB6, -0x1A, 0x45, 0x65, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x9A, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xBB, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x78, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzs[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x85, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x76, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x31, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x20, -0x1A, 0x20, -0x0A, 0x20, -0x02, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0xA7, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x92, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xB2, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x70, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzsa[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x8A, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x7B, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x36, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x0F, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x8D, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xAD, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x6B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzsaf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x8E, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x7F, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x3A, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x0F, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x0A, 0x45, 0x55, 0xB6, -0x02, 0x45, 0x65, 0xB6, - -0x3D, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x89, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xA9, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x67, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzsf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x8A, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x7B, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x36, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x0F, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB6, -0x1A, 0x45, 0x65, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x8D, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xAD, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x6B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgz[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x58, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x4A, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x1D, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xAF, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xD6, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x9D, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgza[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x5C, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x4E, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x27, 0xCF, 0x74, 0xC6, -0x3D, 0xCF, 0x74, 0xC2, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x20, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB4, -0x02, 0x44, 0x54, 0xB4, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xAB, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xD3, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x99, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzaf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x61, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x53, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x37, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x26, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x27, 0xCF, 0x74, 0xC6, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB4, -0x02, 0x44, 0x54, 0xB4, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x75, 0xC6, -0x00, 0x80, 0x00, 0xE8, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x45, 0x4D, 0xB6, -0x02, 0x45, 0x55, 0xB6, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xA6, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xCD, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x94, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x5D, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x4F, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x39, 0xE5, 0x2C, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x88, 0x73, 0x5E, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x27, 0xCF, 0x75, 0xC6, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x20, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x27, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB4, -0x02, 0x44, 0x54, 0xB4, - -0x2A, 0x45, 0x4D, 0xB6, -0x1A, 0x45, 0x55, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xAA, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xD3, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x98, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzs[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x65, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x57, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x29, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0xA7, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xA2, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xCA, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x90, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzsa[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x6A, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x5C, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x2E, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x27, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0x9D, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xC5, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x8B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzsaf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x6E, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x60, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x32, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x27, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x0A, 0x45, 0x4D, 0xB6, -0x02, 0x45, 0x55, 0xB6, - -0x3D, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0x99, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xC1, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x87, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzsf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x6A, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x5C, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x2E, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x27, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB6, -0x1A, 0x45, 0x55, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0x9D, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xC5, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x8B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c:1.1 Wed Dec 12 19:24:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c Thu Feb 27 12:32:25 2003 @@ -1,210 +0,0 @@ -/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*- - * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" -#include "mga_ucode.h" - - -#define MGA_WARP_CODE_ALIGN 256 /* in bytes */ - -#define WARP_UCODE_SIZE( which ) \ - ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN) - -#define WARP_UCODE_INSTALL( which, where ) \ -do { \ - DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\ - dev_priv->warp_pipe_phys[where] = pcbase; \ - memcpy( vcbase, which, sizeof(which) ); \ - pcbase += WARP_UCODE_SIZE( which ); \ - vcbase += WARP_UCODE_SIZE( which ); \ -} while (0) - - -static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv ) -{ - unsigned int size; - - size = ( WARP_UCODE_SIZE( warp_g400_tgz ) + - WARP_UCODE_SIZE( warp_g400_tgza ) + - WARP_UCODE_SIZE( warp_g400_tgzaf ) + - WARP_UCODE_SIZE( warp_g400_tgzf ) + - WARP_UCODE_SIZE( warp_g400_tgzs ) + - WARP_UCODE_SIZE( warp_g400_tgzsa ) + - WARP_UCODE_SIZE( warp_g400_tgzsaf ) + - WARP_UCODE_SIZE( warp_g400_tgzsf ) + - WARP_UCODE_SIZE( warp_g400_t2gz ) + - WARP_UCODE_SIZE( warp_g400_t2gza ) + - WARP_UCODE_SIZE( warp_g400_t2gzaf ) + - WARP_UCODE_SIZE( warp_g400_t2gzf ) + - WARP_UCODE_SIZE( warp_g400_t2gzs ) + - WARP_UCODE_SIZE( warp_g400_t2gzsa ) + - WARP_UCODE_SIZE( warp_g400_t2gzsaf ) + - WARP_UCODE_SIZE( warp_g400_t2gzsf ) ); - - size = PAGE_ALIGN( size ); - - DRM_DEBUG( "G400 ucode size = %d bytes\n", size ); - return size; -} - -static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv ) -{ - unsigned int size; - - size = ( WARP_UCODE_SIZE( warp_g200_tgz ) + - WARP_UCODE_SIZE( warp_g200_tgza ) + - WARP_UCODE_SIZE( warp_g200_tgzaf ) + - WARP_UCODE_SIZE( warp_g200_tgzf ) + - WARP_UCODE_SIZE( warp_g200_tgzs ) + - WARP_UCODE_SIZE( warp_g200_tgzsa ) + - WARP_UCODE_SIZE( warp_g200_tgzsaf ) + - WARP_UCODE_SIZE( warp_g200_tgzsf ) ); - - size = PAGE_ALIGN( size ); - - DRM_DEBUG( "G200 ucode size = %d bytes\n", size ); - return size; -} - -static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv ) -{ - unsigned char *vcbase = dev_priv->warp->handle; - unsigned long pcbase = dev_priv->warp->offset; - unsigned int size; - - size = mga_warp_g400_microcode_size( dev_priv ); - if ( size > dev_priv->warp->size ) { - DRM_ERROR( "microcode too large! (%u > %lu)\n", - size, dev_priv->warp->size ); - DRM_OS_RETURN(ENOMEM); - } - - memset( dev_priv->warp_pipe_phys, 0, - sizeof(dev_priv->warp_pipe_phys) ); - - WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ ); - WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF ); - WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA ); - WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF ); - WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS ); - WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF ); - WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA ); - WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF ); - - WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ ); - WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF ); - WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA ); - WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF ); - WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS ); - WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF ); - WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA ); - WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF ); - - return 0; -} - -static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv ) -{ - unsigned char *vcbase = dev_priv->warp->handle; - unsigned long pcbase = dev_priv->warp->offset; - unsigned int size; - - size = mga_warp_g200_microcode_size( dev_priv ); - if ( size > dev_priv->warp->size ) { - DRM_ERROR( "microcode too large! (%u > %lu)\n", - size, dev_priv->warp->size ); - DRM_OS_RETURN(ENOMEM); - } - - memset( dev_priv->warp_pipe_phys, 0, - sizeof(dev_priv->warp_pipe_phys) ); - - WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ ); - WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF ); - WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA ); - WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF ); - WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS ); - WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF ); - WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA ); - WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF ); - - return 0; -} - -int mga_warp_install_microcode( drm_mga_private_t *dev_priv ) -{ - switch ( dev_priv->chipset ) { - case MGA_CARD_TYPE_G400: - return mga_warp_install_g400_microcode( dev_priv ); - case MGA_CARD_TYPE_G200: - return mga_warp_install_g200_microcode( dev_priv ); - default: - DRM_OS_RETURN(EINVAL); - } -} - -#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) - -int mga_warp_init( drm_mga_private_t *dev_priv ) -{ - u32 wmisc; - - /* FIXME: Get rid of these damned magic numbers... - */ - switch ( dev_priv->chipset ) { - case MGA_CARD_TYPE_G400: - MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND ); - MGA_WRITE( MGA_WGETMSB, 0x00000E00 ); - MGA_WRITE( MGA_WVRTXSZ, 0x00001807 ); - MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 ); - break; - case MGA_CARD_TYPE_G200: - MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND ); - MGA_WRITE( MGA_WGETMSB, 0x1606 ); - MGA_WRITE( MGA_WVRTXSZ, 7 ); - break; - default: - DRM_OS_RETURN(EINVAL); - } - - MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE | - MGA_WMASTER_ENABLE | - MGA_WCACHEFLUSH_ENABLE) ); - wmisc = MGA_READ( MGA_WMISC ); - if ( wmisc != WMISC_EXPECTED ) { - DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n", - wmisc, WMISC_EXPECTED ); - DRM_OS_RETURN(EINVAL); - } - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile:1.1 Wed Dec 12 19:24:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile Mon Dec 16 11:19:24 2002 @@ -1,25 +1,23 @@ # $FreeBSD$ +.PATH: ${.CURDIR}/.. KMOD = r128 NOMAN= YES -SRCS = r128_cce.c r128_drv.c r128_state.c -SRCS += device_if.h bus_if.h pci_if.h opt_drm_linux.h +SRCS = r128_cce.c r128_drv.c r128_state.c r128_irq.c +SRCS += device_if.h bus_if.h pci_if.h opt_drm.h CFLAGS += ${DEBUG_FLAGS} -I. -I.. -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine +.if defined(DRM_DEBUG) +DRM_DEBUG_OPT= "\#define DRM_DEBUG 1" +.endif -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#R128_OPTS= "\#define DRM_LINUX" 1 +.if !defined(DRM_NOLINUX) +DRM_LINUX_OPT= "\#define DRM_LINUX 1" .endif -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(R128_OPTS) >> opt_drm_linux.h +opt_drm.h: + touch opt_drm.h + echo $(DRM_DEBUG_OPT) >> opt_drm.h + echo $(DRM_LINUX_OPT) >> opt_drm.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h:1.1 Wed Dec 12 19:24:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h Thu Feb 27 12:32:25 2003 @@ -1,81 +0,0 @@ -/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __R128_H__ -#define __R128_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) r128_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_SG 1 -#define __HAVE_PCI_DMA 1 - -/* Driver customization: - */ -#define DRIVER_PRERELEASE() do { \ - if ( dev->dev_private ) { \ - drm_r128_private_t *dev_priv = dev->dev_private; \ - if ( dev_priv->page_flipping ) { \ - r128_do_cleanup_pageflip( dev ); \ - } \ - } \ -} while (0) - -#define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 - -#if 0 -/* GH: Remove this for now... */ -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - drm_r128_private_t *dev_priv = dev->dev_private; \ - return r128_do_cce_idle( dev_priv ); \ -} while (0) -#endif - -/* Buffer customization: - */ -#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_r128_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c:1.1 Wed Dec 12 19:24:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c Thu Feb 27 12:32:26 2003 @@ -1,1022 +0,0 @@ -/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- - * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "r128.h" -#include "drmP.h" -#include "r128_drv.h" - - -#define R128_FIFO_DEBUG 0 - -int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ); - -/* CCE microcode (from ATI) */ -static u32 r128_cce_microcode[] = { - 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, - 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, - 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1, - 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11, - 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28, - 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, - 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, - 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, - 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071, - 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2, - 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1, - 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, - 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, - 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, - 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1, - 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82, - 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729, - 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008, - 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, - 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, - 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, - 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0, - 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370, - 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1, - 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793, - 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, - 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, - 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1, - 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1, - 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894, - 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14, - 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1, - 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, - 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, - 409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -int R128_READ_PLL(drm_device_t *dev, int addr) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - - R128_WRITE8(R128_CLOCK_CNTL_INDEX, addr & 0x1f); - return R128_READ(R128_CLOCK_CNTL_DATA); -} - -#if R128_FIFO_DEBUG -static void r128_status( drm_r128_private_t *dev_priv ) -{ - printk( "GUI_STAT = 0x%08x\n", - (unsigned int)R128_READ( R128_GUI_STAT ) ); - printk( "PM4_STAT = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_STAT ) ); - printk( "PM4_BUFFER_DL_WPTR = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_BUFFER_DL_WPTR ) ); - printk( "PM4_BUFFER_DL_RPTR = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_BUFFER_DL_RPTR ) ); - printk( "PM4_MICRO_CNTL = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_MICRO_CNTL ) ); - printk( "PM4_BUFFER_CNTL = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_BUFFER_CNTL ) ); -} -#endif - - -/* ================================================================ - * Engine, FIFO control - */ - -static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) -{ - u32 tmp; - int i; - - tmp = R128_READ( R128_PC_NGUI_CTLSTAT ) | R128_PC_FLUSH_ALL; - R128_WRITE( R128_PC_NGUI_CTLSTAT, tmp ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(R128_READ( R128_PC_NGUI_CTLSTAT ) & R128_PC_BUSY) ) { - return 0; - } - DRM_OS_DELAY( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "%s failed!\n", __FUNCTION__ ); -#endif - DRM_OS_RETURN( EBUSY ); -} - -static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) -{ - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - int slots = R128_READ( R128_GUI_STAT ) & R128_GUI_FIFOCNT_MASK; - if ( slots >= entries ) return 0; - DRM_OS_DELAY( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "%s failed!\n", __FUNCTION__ ); -#endif - DRM_OS_RETURN( EBUSY ); -} - -int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) -{ - int i, ret; - - ret = r128_do_wait_for_fifo( dev_priv, 64 ); - if ( ret ) return ret; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { - r128_do_pixcache_flush( dev_priv ); - return 0; - } - DRM_OS_DELAY( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "%s failed!\n", __FUNCTION__ ); -#endif - DRM_OS_RETURN( EBUSY ); -} - - -/* ================================================================ - * CCE control, initialization - */ - -/* Load the microcode for the CCE */ -static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) -{ - int i; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - r128_do_wait_for_idle( dev_priv ); - - R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); - for ( i = 0 ; i < 256 ; i++ ) { - R128_WRITE( R128_PM4_MICROCODE_DATAH, - r128_cce_microcode[i * 2] ); - R128_WRITE( R128_PM4_MICROCODE_DATAL, - r128_cce_microcode[i * 2 + 1] ); - } -} - -/* Flush any pending commands to the CCE. This should only be used just - * prior to a wait for idle, as it informs the engine that the command - * stream is ending. - */ -static void r128_do_cce_flush( drm_r128_private_t *dev_priv ) -{ - u32 tmp; - - tmp = R128_READ( R128_PM4_BUFFER_DL_WPTR ) | R128_PM4_BUFFER_DL_DONE; - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, tmp ); -} - -/* Wait for the CCE to go idle. - */ -int r128_do_cce_idle( drm_r128_private_t *dev_priv ) -{ - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( GET_RING_HEAD( &dev_priv->ring ) == dev_priv->ring.tail ) { - int pm4stat = R128_READ( R128_PM4_STAT ); - if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= - dev_priv->cce_fifo_size ) && - !(pm4stat & (R128_PM4_BUSY | - R128_PM4_GUI_ACTIVE)) ) { - return r128_do_pixcache_flush( dev_priv ); - } - } - DRM_OS_DELAY( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - r128_status( dev_priv ); -#endif - DRM_OS_RETURN( EBUSY ); -} - -/* Start the Concurrent Command Engine. - */ -static void r128_do_cce_start( drm_r128_private_t *dev_priv ) -{ - r128_do_wait_for_idle( dev_priv ); - - R128_WRITE( R128_PM4_BUFFER_CNTL, - dev_priv->cce_mode | dev_priv->ring.size_l2qw ); - R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ - R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); - - dev_priv->cce_running = 1; -} - -/* Reset the Concurrent Command Engine. This will not flush any pending - * commands, so you must wait for the CCE command stream to complete - * before calling this routine. - */ -static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) -{ - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); - R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - SET_RING_HEAD( &dev_priv->ring, 0 ); - dev_priv->ring.tail = 0; -} - -/* Stop the Concurrent Command Engine. This will not flush any pending - * commands, so you must flush the command stream and wait for the CCE - * to go idle before calling this routine. - */ -static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) -{ - R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); - R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 ); - - dev_priv->cce_running = 0; -} - -/* Reset the engine. This will stop the CCE if it is running. - */ -static int r128_do_engine_reset( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; - - r128_do_pixcache_flush( dev_priv ); - - clock_cntl_index = R128_READ( R128_CLOCK_CNTL_INDEX ); - mclk_cntl = R128_READ_PLL( dev, R128_MCLK_CNTL ); - - R128_WRITE_PLL( R128_MCLK_CNTL, - mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP ); - - gen_reset_cntl = R128_READ( R128_GEN_RESET_CNTL ); - - /* Taken from the sample code - do not change */ - R128_WRITE( R128_GEN_RESET_CNTL, - gen_reset_cntl | R128_SOFT_RESET_GUI ); - R128_READ( R128_GEN_RESET_CNTL ); - R128_WRITE( R128_GEN_RESET_CNTL, - gen_reset_cntl & ~R128_SOFT_RESET_GUI ); - R128_READ( R128_GEN_RESET_CNTL ); - - R128_WRITE_PLL( R128_MCLK_CNTL, mclk_cntl ); - R128_WRITE( R128_CLOCK_CNTL_INDEX, clock_cntl_index ); - R128_WRITE( R128_GEN_RESET_CNTL, gen_reset_cntl ); - - /* Reset the CCE ring */ - r128_do_cce_reset( dev_priv ); - - /* The CCE is no longer running after an engine reset */ - dev_priv->cce_running = 0; - - /* Reset any pending vertex, indirect buffers */ - r128_freelist_reset( dev ); - - return 0; -} - -static void r128_cce_init_ring_buffer( drm_device_t *dev, - drm_r128_private_t *dev_priv ) -{ - u32 ring_start; - u32 tmp; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* The manual (p. 2) says this address is in "VM space". This - * means it's an offset from the start of AGP space. - */ -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - ring_start = dev_priv->cce_ring->offset - dev->agp->base; - else -#endif - ring_start = dev_priv->cce_ring->offset - dev->sg->handle; - - R128_WRITE( R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET ); - - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); - R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - - /* DL_RPTR_ADDR is a physical address in AGP space. */ - SET_RING_HEAD( &dev_priv->ring, 0 ); - -#if __REALLY_HAVE_SG - if ( !dev_priv->is_pci ) { -#endif - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - dev_priv->ring_rptr->offset ); -#if __REALLY_HAVE_SG - } else { - drm_sg_mem_t *entry = dev->sg; - unsigned long tmp_ofs, page_ofs; - - tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; - page_ofs = tmp_ofs >> PAGE_SHIFT; - - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - entry->busaddr[page_ofs]); - DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", - entry->busaddr[page_ofs], - entry->handle + tmp_ofs ); - } -#endif - - /* Set watermark control */ - R128_WRITE( R128_PM4_BUFFER_WM_CNTL, - ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) - | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) - | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) - | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT) ); - - /* Force read. Why? Because it's in the examples... */ - R128_READ( R128_PM4_BUFFER_ADDR ); - - /* Turn on bus mastering */ - tmp = R128_READ( R128_BUS_CNTL ) & ~R128_BUS_MASTER_DIS; - R128_WRITE( R128_BUS_CNTL, tmp ); -} - -static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) -{ - drm_r128_private_t *dev_priv; - drm_map_list_entry_t *listentry; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); - if ( dev_priv == NULL ) - DRM_OS_RETURN( ENOMEM ); - - memset( dev_priv, 0, sizeof(drm_r128_private_t) ); - - dev_priv->is_pci = init->is_pci; - - if ( dev_priv->is_pci && !dev->sg ) { - DRM_ERROR( "PCI GART memory not allocated!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN( EINVAL ); - } - - dev_priv->usec_timeout = init->usec_timeout; - if ( dev_priv->usec_timeout < 1 || - dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { - DRM_DEBUG( "TIMEOUT problem!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN( EINVAL ); - } - - dev_priv->cce_mode = init->cce_mode; - - /* GH: Simple idle check. - */ - atomic_set( &dev_priv->idle_count, 0 ); - - /* We don't support anything other than bus-mastering ring mode, - * but the ring can be in either AGP or PCI space for the ring - * read pointer. - */ - if ( ( init->cce_mode != R128_PM4_192BM ) && - ( init->cce_mode != R128_PM4_128BM_64INDBM ) && - ( init->cce_mode != R128_PM4_64BM_128INDBM ) && - ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { - DRM_DEBUG( "Bad cce_mode!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN( EINVAL ); - } - - switch ( init->cce_mode ) { - case R128_PM4_NONPM4: - dev_priv->cce_fifo_size = 0; - break; - case R128_PM4_192PIO: - case R128_PM4_192BM: - dev_priv->cce_fifo_size = 192; - break; - case R128_PM4_128PIO_64INDBM: - case R128_PM4_128BM_64INDBM: - dev_priv->cce_fifo_size = 128; - break; - case R128_PM4_64PIO_128INDBM: - case R128_PM4_64BM_128INDBM: - case R128_PM4_64PIO_64VCBM_64INDBM: - case R128_PM4_64BM_64VCBM_64INDBM: - case R128_PM4_64PIO_64VCPIO_64INDPIO: - dev_priv->cce_fifo_size = 64; - break; - } - - switch ( init->fb_bpp ) { - case 16: - dev_priv->color_fmt = R128_DATATYPE_RGB565; - break; - case 32: - default: - dev_priv->color_fmt = R128_DATATYPE_ARGB8888; - break; - } - dev_priv->front_offset = init->front_offset; - dev_priv->front_pitch = init->front_pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->back_pitch = init->back_pitch; - - switch ( init->depth_bpp ) { - case 16: - dev_priv->depth_fmt = R128_DATATYPE_RGB565; - break; - case 24: - case 32: - default: - dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; - break; - } - dev_priv->depth_offset = init->depth_offset; - dev_priv->depth_pitch = init->depth_pitch; - dev_priv->span_offset = init->span_offset; - - dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch/8) << 21) | - (dev_priv->front_offset >> 5)); - dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch/8) << 21) | - (dev_priv->back_offset >> 5)); - dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | - (dev_priv->depth_offset >> 5) | - R128_DST_TILE); - dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | - (dev_priv->span_offset >> 5)); - - TAILQ_FOREACH(listentry, dev->maplist, link) { - drm_map_t *map = listentry->map; - if (map->type == _DRM_SHM && - map->flags & _DRM_CONTAINS_LOCK) { - dev_priv->sarea = map; - break; - } - } - - if(!dev_priv->sarea) { - DRM_ERROR("could not find sarea!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR("could not find framebuffer!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - if(!dev_priv->mmio) { - DRM_ERROR("could not find mmio region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); - if(!dev_priv->cce_ring) { - DRM_ERROR("could not find cce ring region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - if(!dev_priv->ring_rptr) { - DRM_ERROR("could not find ring read pointer!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); - if(!dev_priv->buffers) { - DRM_ERROR("could not find dma buffer region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - - if ( !dev_priv->is_pci ) { - DRM_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); - if(!dev_priv->agp_textures) { - DRM_ERROR("could not find agp texture region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(EINVAL); - } - } - - dev_priv->sarea_priv = - (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + - init->sarea_priv_offset); - - if ( !dev_priv->is_pci ) { - DRM_IOREMAP( dev_priv->cce_ring ); - DRM_IOREMAP( dev_priv->ring_rptr ); - DRM_IOREMAP( dev_priv->buffers ); - if(!dev_priv->cce_ring->handle || - !dev_priv->ring_rptr->handle || - !dev_priv->buffers->handle) { - DRM_ERROR("Could not ioremap agp regions!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(ENOMEM); - } - } else { - dev_priv->cce_ring->handle = - (void *)dev_priv->cce_ring->offset; - dev_priv->ring_rptr->handle = - (void *)dev_priv->ring_rptr->offset; - dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; - } - -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - dev_priv->cce_buffers_offset = dev->agp->base; - else -#endif - dev_priv->cce_buffers_offset = dev->sg->handle; - - dev_priv->ring.head = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle); - - dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; - dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle - + init->ring_size / sizeof(u32)); - dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); - - dev_priv->ring.tail_mask = - (dev_priv->ring.size / sizeof(u32)) - 1; - - dev_priv->ring.high_mark = 128; - - dev_priv->sarea_priv->last_frame = 0; - R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); - - dev_priv->sarea_priv->last_dispatch = 0; - R128_WRITE( R128_LAST_DISPATCH_REG, - dev_priv->sarea_priv->last_dispatch ); - -#if __REALLY_HAVE_SG - if ( dev_priv->is_pci ) { - if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, - &dev_priv->bus_pci_gart) ) { - DRM_ERROR( "failed to init PCI GART!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - DRM_OS_RETURN(ENOMEM); - } - R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); - } -#endif - - r128_cce_init_ring_buffer( dev, dev_priv ); - r128_cce_load_microcode( dev_priv ); - - dev->dev_private = (void *)dev_priv; - - r128_do_engine_reset( dev ); - - return 0; -} - -int r128_do_cleanup_cce( drm_device_t *dev ) -{ - if ( dev->dev_private ) { - drm_r128_private_t *dev_priv = dev->dev_private; - -#if __REALLY_HAVE_SG - if ( !dev_priv->is_pci ) { -#endif - DRM_IOREMAPFREE( dev_priv->cce_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); -#if __REALLY_HAVE_SG - } else { - if (!DRM(ati_pcigart_cleanup)( dev, - dev_priv->phys_pci_gart, - dev_priv->bus_pci_gart )) - DRM_ERROR( "failed to cleanup PCI GART!\n" ); - } -#endif - - DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), - DRM_MEM_DRIVER ); - dev->dev_private = NULL; - } - - return 0; -} - -int r128_cce_init( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_init_t init; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - DRM_OS_KRNFROMUSR( init, (drm_r128_init_t *)data, sizeof(init) ); - - switch ( init.func ) { - case R128_INIT_CCE: - return r128_do_init_cce( dev, &init ); - case R128_CLEANUP_CCE: - return r128_do_cleanup_cce( dev ); - } - - DRM_OS_RETURN( EINVAL ); -} - -int r128_cce_start( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { - DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); - return 0; - } - - r128_do_cce_start( dev_priv ); - - return 0; -} - -/* Stop the CCE. The engine must have been idled before calling this - * routine. - */ -int r128_cce_stop( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_cce_stop_t stop; - int ret; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR(stop, (drm_r128_cce_stop_t *)data, sizeof(stop) ); - - /* Flush any pending CCE commands. This ensures any outstanding - * commands are exectuted by the engine before we turn it off. - */ - if ( stop.flush ) { - r128_do_cce_flush( dev_priv ); - } - - /* If we fail to make the engine go idle, we return an error - * code so that the DRM ioctl wrapper can try again. - */ - if ( stop.idle ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret ) return ret; - } - - /* Finally, we can turn off the CCE. If the engine isn't idle, - * we will get some dropped triangles as they won't be fully - * rendered before the CCE is shut down. - */ - r128_do_cce_stop( dev_priv ); - - /* Reset the engine */ - r128_do_engine_reset( dev ); - - return 0; -} - -/* Just reset the CCE ring. Called as part of an X Server engine reset. - */ -int r128_cce_reset( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - r128_do_cce_reset( dev_priv ); - - /* The CCE is no longer running after an engine reset */ - dev_priv->cce_running = 0; - - return 0; -} - -int r128_cce_idle( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( dev_priv->cce_running ) { - r128_do_cce_flush( dev_priv ); - } - - return r128_do_cce_idle( dev_priv ); -} - -int r128_engine_reset( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - return r128_do_engine_reset( dev ); -} - - -/* ================================================================ - * Fullscreen mode - */ - -static int r128_do_init_pageflip( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv->crtc_offset = R128_READ( R128_CRTC_OFFSET ); - dev_priv->crtc_offset_cntl = R128_READ( R128_CRTC_OFFSET_CNTL ); - - R128_WRITE( R128_CRTC_OFFSET, dev_priv->front_offset ); - R128_WRITE( R128_CRTC_OFFSET_CNTL, - dev_priv->crtc_offset_cntl | R128_CRTC_OFFSET_FLIP_CNTL ); - - dev_priv->page_flipping = 1; - dev_priv->current_page = 0; - - return 0; -} - -int r128_do_cleanup_pageflip( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - R128_WRITE( R128_CRTC_OFFSET, dev_priv->crtc_offset ); - R128_WRITE( R128_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); - - dev_priv->page_flipping = 0; - dev_priv->current_page = 0; - - return 0; -} - -int r128_fullscreen( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_fullscreen_t fs; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( fs, (drm_r128_fullscreen_t *)data, sizeof(fs) ); - - switch ( fs.func ) { - case R128_INIT_FULLSCREEN: - return r128_do_init_pageflip( dev ); - case R128_CLEANUP_FULLSCREEN: - return r128_do_cleanup_pageflip( dev ); - } - - DRM_OS_RETURN( EINVAL ); -} - - -/* ================================================================ - * Freelist management - */ -#define R128_BUFFER_USED 0xffffffff -#define R128_BUFFER_FREE 0 - -#if 0 -static int r128_freelist_init( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_freelist_t *entry; - int i; - - dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); - if ( dev_priv->head == NULL ) - DRM_OS_RETURN( ENOMEM ); - - memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) ); - dev_priv->head->age = R128_BUFFER_USED; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - - entry = DRM(alloc)( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); - if ( !entry ) DRM_OS_RETURN( ENOMEM ); - - entry->age = R128_BUFFER_FREE; - entry->buf = buf; - entry->prev = dev_priv->head; - entry->next = dev_priv->head->next; - if ( !entry->next ) - dev_priv->tail = entry; - - buf_priv->discard = 0; - buf_priv->dispatched = 0; - buf_priv->list_entry = entry; - - dev_priv->head->next = entry; - - if ( dev_priv->head->next ) - dev_priv->head->next->prev = entry; - } - - return 0; - -} -#endif - -drm_buf_t *r128_freelist_get( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv; - drm_buf_t *buf; - int i, t; - - /* FIXME: Optimize -- use freelist code */ - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pid == 0 ) - return buf; - } - - for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { - u32 done_age = R128_READ( R128_LAST_DISPATCH_REG ); - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pending && buf_priv->age <= done_age ) { - /* The buffer has been processed, so it - * can now be used. - */ - buf->pending = 0; - return buf; - } - } - DRM_OS_DELAY( 1 ); - } - - DRM_ERROR( "returning NULL!\n" ); - return NULL; -} - -void r128_freelist_reset( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - int i; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - drm_buf_t *buf = dma->buflist[i]; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - buf_priv->age = 0; - } -} - - -/* ================================================================ - * CCE command submission - */ - -int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) -{ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - r128_update_ring_snapshot( ring ); - if ( ring->space >= n ) - return 0; - DRM_OS_DELAY( 1 ); - } - - /* FIXME: This is being ignored... */ - DRM_ERROR( "failed!\n" ); - DRM_OS_RETURN( EBUSY ); -} - -static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d) -{ - int i; - drm_buf_t *buf; - - for ( i = d->granted_count ; i < d->request_count ; i++ ) { - buf = r128_freelist_get( dev ); - if ( !buf ) DRM_OS_RETURN( EAGAIN ); - - buf->pid = DRM_OS_CURRENTPID; - - if ( DRM_OS_COPYTOUSR( &d->request_indices[i], &buf->idx, - sizeof(buf->idx) ) ) - DRM_OS_RETURN( EFAULT ); - if ( DRM_OS_COPYTOUSR( &d->request_sizes[i], &buf->total, - sizeof(buf->total) ) ) - DRM_OS_RETURN( EFAULT ); - d->granted_count++; - } - return 0; -} - -int r128_cce_buffers( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - int ret = 0; - drm_dma_t d; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) ); - - /* Please don't send us buffers. - */ - if ( d.send_count != 0 ) { - DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", - DRM_OS_CURRENTPID, d.send_count ); - DRM_OS_RETURN( EINVAL ); - } - - /* We'll send you buffers. - */ - if ( d.request_count < 0 || d.request_count > dma->buf_count ) { - DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", - DRM_OS_CURRENTPID, d.request_count, dma->buf_count ); - DRM_OS_RETURN( EINVAL ); - } - - d.granted_count = 0; - - if ( d.request_count ) { - ret = r128_cce_get_buffers( dev, &d ); - } - - DRM_OS_KRNTOUSR((drm_dma_t *) data, d, sizeof(d) ); - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c:1.2 Thu Dec 27 21:27:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c Thu Feb 27 12:32:26 2003 @@ -1,151 +0,0 @@ -/* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- - * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> - -#include "r128.h" -#include "drmP.h" -#include "r128_drv.h" -#if __REALLY_HAVE_SG -#include "ati_pcigart.h" -#endif - -#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - -#define DRIVER_NAME "r128" -#define DRIVER_DESC "ATI Rage 128" -#define DRIVER_DATE "20010405" - -#define DRIVER_MAJOR 2 -#define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x1002, 0x4c45, 1, "ATI Rage 128 Mobility LE"}, - {0x1002, 0x4c46, 1, "ATI Rage 128 Mobility LF"}, - {0x1002, 0x4d46, 1, "ATI Rage 128 Mobility MF (AGP 4x)"}, - {0x1002, 0x4d4c, 1, "ATI Rage 128 Mobility ML"}, - {0x1002, 0x5041, 0, "ATI Rage 128 Pro PA (PCI)"}, - {0x1002, 0x5042, 1, "ATI Rage 128 Pro PB (AGP 2x)"}, - {0x1002, 0x5043, 1, "ATI Rage 128 Pro PC (AGP 4x)"}, - {0x1002, 0x5044, 0, "ATI Rage 128 Pro PD (PCI)"}, - {0x1002, 0x5045, 1, "ATI Rage 128 Pro PE (AGP 2x)"}, - {0x1002, 0x5046, 1, "ATI Rage 128 Pro PF (AGP 4x)"}, - {0x1002, 0x5047, 0, "ATI Rage 128 Pro PG (PCI)"}, - {0x1002, 0x5048, 1, "ATI Rage 128 Pro PH (AGP)"}, - {0x1002, 0x5049, 1, "ATI Rage 128 Pro PI (AGP)"}, - {0x1002, 0x504a, 0, "ATI Rage 128 Pro PJ (PCI)"}, - {0x1002, 0x504b, 1, "ATI Rage 128 Pro PK (AGP)"}, - {0x1002, 0x504c, 1, "ATI Rage 128 Pro PL (AGP)"}, - {0x1002, 0x504d, 0, "ATI Rage 128 Pro PM (PCI)"}, - {0x1002, 0x504e, 1, "ATI Rage 128 Pro PN (AGP)"}, - {0x1002, 0x505f, 1, "ATI Rage 128 Pro PO (AGP)"}, - {0x1002, 0x5050, 0, "ATI Rage 128 Pro PP (PCI)"}, - {0x1002, 0x5051, 1, "ATI Rage 128 Pro PQ (AGP)"}, - {0x1002, 0x5052, 1, "ATI Rage 128 Pro PR (AGP)"}, - {0x1002, 0x5053, 0, "ATI Rage 128 Pro PS (PCI)"}, - {0x1002, 0x5054, 1, "ATI Rage 128 Pro PT (AGP)"}, - {0x1002, 0x5055, 1, "ATI Rage 128 Pro PU (AGP)"}, - {0x1002, 0x5056, 0, "ATI Rage 128 Pro PV (PCI)"}, - {0x1002, 0x5057, 1, "ATI Rage 128 Pro PW (AGP)"}, - {0x1002, 0x5058, 1, "ATI Rage 128 Pro PX (AGP)"}, - {0x1002, 0x5245, 0, "ATI Rage 128 GL (PCI)"}, - {0x1002, 0x5246, 1, "ATI Rage 128 GL (AGP 2x)"}, - {0x1002, 0x524b, 0, "ATI Rage 128 VR (PCI)"}, - {0x1002, 0x524c, 1, "ATI Rage 128 VR (AGP 2x)"}, - {0x1002, 0x5345, 0, "ATI Rage 128 SE (PCI)"}, - {0x1002, 0x5346, 1, "ATI Rage 128 SF (AGP 2x)"}, - {0x1002, 0x5347, 1, "ATI Rage 128 SG (AGP 4x)"}, - {0x1002, 0x5348, 0, "ATI Rage 128 SH (unknown)"}, - {0x1002, 0x534b, 0, "ATI Rage 128 SK (PCI)"}, - {0x1002, 0x534c, 1, "ATI Rage 128 SL (AGP 2x)"}, - {0x1002, 0x534d, 1, "ATI Rage 128 SM (AGP 4x)"}, - {0x1002, 0x534e, 1, "ATI Rage 128 (AGP 4x?)"}, - {0, 0, 0, NULL} -}; - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, - - -#if 0 -/* GH: Count data sent to card via ring or vertex/indirect buffers. - */ -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#endif - - -#include "drm_agpsupport.h" -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_sysctl.h" -#include "drm_vm.h" -#if __REALLY_HAVE_SG -#include "drm_scatter.h" -#endif - -DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h:1.1 Wed Dec 12 19:24:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h Thu Feb 27 12:32:26 2003 @@ -1,544 +0,0 @@ -/* r128_drv.h -- Private header for r128 driver -*- linux-c -*- - * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * Michel Dänzer <daenzerm@student.ethz.ch> - */ - -#include <machine/endian.h> -#if BYTE_ORDER==LITTLE_ENDIAN -#define le32_to_cpu(x) x -#define cpu_to_le32(x) x -#else -#define le32_to_cpu(x) ntohl(x) -#define cpu_to_le32(x) htonl(x) -#endif - -#ifndef __R128_DRV_H__ -#define __R128_DRV_H__ - -#define GET_RING_HEAD( ring ) le32_to_cpu( *(ring)->head ) -#define SET_RING_HEAD( ring, val ) *(ring)->head = cpu_to_le32( val ) - -typedef struct drm_r128_freelist { - unsigned int age; - drm_buf_t *buf; - struct drm_r128_freelist *next; - struct drm_r128_freelist *prev; -} drm_r128_freelist_t; - -typedef struct drm_r128_ring_buffer { - u32 *start; - u32 *end; - int size; - int size_l2qw; - - volatile u32 *head; - u32 tail; - u32 tail_mask; - int space; - - int high_mark; -} drm_r128_ring_buffer_t; - -typedef struct drm_r128_private { - drm_r128_ring_buffer_t ring; - drm_r128_sarea_t *sarea_priv; - - int cce_mode; - int cce_fifo_size; - int cce_running; - - drm_r128_freelist_t *head; - drm_r128_freelist_t *tail; - - int usec_timeout; - int is_pci; - unsigned long phys_pci_gart; -#if __REALLY_HAVE_SG - dma_addr_t bus_pci_gart; -#endif - unsigned long cce_buffers_offset; - - atomic_t idle_count; - - int page_flipping; - int current_page; - u32 crtc_offset; - u32 crtc_offset_cntl; - - u32 color_fmt; - unsigned int front_offset; - unsigned int front_pitch; - unsigned int back_offset; - unsigned int back_pitch; - - u32 depth_fmt; - unsigned int depth_offset; - unsigned int depth_pitch; - unsigned int span_offset; - - u32 front_pitch_offset_c; - u32 back_pitch_offset_c; - u32 depth_pitch_offset_c; - u32 span_pitch_offset_c; - - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *mmio; - drm_map_t *cce_ring; - drm_map_t *ring_rptr; - drm_map_t *buffers; - drm_map_t *agp_textures; -} drm_r128_private_t; - -typedef struct drm_r128_buf_priv { - u32 age; - int prim; - int discard; - int dispatched; - drm_r128_freelist_t *list_entry; -} drm_r128_buf_priv_t; - - /* r128_cce.c */ -extern int r128_cce_init( DRM_OS_IOCTL ); -extern int r128_cce_start( DRM_OS_IOCTL ); -extern int r128_cce_stop( DRM_OS_IOCTL ); -extern int r128_cce_reset( DRM_OS_IOCTL ); -extern int r128_cce_idle( DRM_OS_IOCTL ); -extern int r128_engine_reset( DRM_OS_IOCTL ); -extern int r128_fullscreen( DRM_OS_IOCTL ); -extern int r128_cce_buffers( DRM_OS_IOCTL ); - -extern void r128_freelist_reset( drm_device_t *dev ); -extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); - -extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); - -static __inline__ void -r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) -{ - ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - -extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); -extern int r128_do_cleanup_cce( drm_device_t *dev ); -extern int r128_do_cleanup_pageflip( drm_device_t *dev ); - - /* r128_state.c */ -extern int r128_cce_clear( DRM_OS_IOCTL ); -extern int r128_cce_swap( DRM_OS_IOCTL ); -extern int r128_cce_vertex( DRM_OS_IOCTL ); -extern int r128_cce_indices( DRM_OS_IOCTL ); -extern int r128_cce_blit( DRM_OS_IOCTL ); -extern int r128_cce_depth( DRM_OS_IOCTL ); -extern int r128_cce_stipple( DRM_OS_IOCTL ); -extern int r128_cce_indirect( DRM_OS_IOCTL ); - - -/* Register definitions, register access macros and drmAddMap constants - * for Rage 128 kernel driver. - */ - -#define R128_AUX_SC_CNTL 0x1660 -# define R128_AUX1_SC_EN (1 << 0) -# define R128_AUX1_SC_MODE_OR (0 << 1) -# define R128_AUX1_SC_MODE_NAND (1 << 1) -# define R128_AUX2_SC_EN (1 << 2) -# define R128_AUX2_SC_MODE_OR (0 << 3) -# define R128_AUX2_SC_MODE_NAND (1 << 3) -# define R128_AUX3_SC_EN (1 << 4) -# define R128_AUX3_SC_MODE_OR (0 << 5) -# define R128_AUX3_SC_MODE_NAND (1 << 5) -#define R128_AUX1_SC_LEFT 0x1664 -#define R128_AUX1_SC_RIGHT 0x1668 -#define R128_AUX1_SC_TOP 0x166c -#define R128_AUX1_SC_BOTTOM 0x1670 -#define R128_AUX2_SC_LEFT 0x1674 -#define R128_AUX2_SC_RIGHT 0x1678 -#define R128_AUX2_SC_TOP 0x167c -#define R128_AUX2_SC_BOTTOM 0x1680 -#define R128_AUX3_SC_LEFT 0x1684 -#define R128_AUX3_SC_RIGHT 0x1688 -#define R128_AUX3_SC_TOP 0x168c -#define R128_AUX3_SC_BOTTOM 0x1690 - -#define R128_BRUSH_DATA0 0x1480 -#define R128_BUS_CNTL 0x0030 -# define R128_BUS_MASTER_DIS (1 << 6) - -#define R128_CLOCK_CNTL_INDEX 0x0008 -#define R128_CLOCK_CNTL_DATA 0x000c -# define R128_PLL_WR_EN (1 << 7) -#define R128_CONSTANT_COLOR_C 0x1d34 -#define R128_CRTC_OFFSET 0x0224 -#define R128_CRTC_OFFSET_CNTL 0x0228 -# define R128_CRTC_OFFSET_FLIP_CNTL (1 << 16) - -#define R128_DP_GUI_MASTER_CNTL 0x146c -# define R128_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define R128_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define R128_GMC_BRUSH_NONE (15 << 4) -# define R128_GMC_DST_16BPP (4 << 8) -# define R128_GMC_DST_24BPP (5 << 8) -# define R128_GMC_DST_32BPP (6 << 8) -# define R128_GMC_DST_DATATYPE_SHIFT 8 -# define R128_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define R128_DP_SRC_SOURCE_MEMORY (2 << 24) -# define R128_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define R128_GMC_AUX_CLIP_DIS (1 << 29) -# define R128_GMC_WR_MSK_DIS (1 << 30) -# define R128_ROP3_S 0x00cc0000 -# define R128_ROP3_P 0x00f00000 -#define R128_DP_WRITE_MASK 0x16cc -#define R128_DST_PITCH_OFFSET_C 0x1c80 -# define R128_DST_TILE (1 << 31) - -#define R128_GEN_RESET_CNTL 0x00f0 -# define R128_SOFT_RESET_GUI (1 << 0) - -#define R128_GUI_SCRATCH_REG0 0x15e0 -#define R128_GUI_SCRATCH_REG1 0x15e4 -#define R128_GUI_SCRATCH_REG2 0x15e8 -#define R128_GUI_SCRATCH_REG3 0x15ec -#define R128_GUI_SCRATCH_REG4 0x15f0 -#define R128_GUI_SCRATCH_REG5 0x15f4 - -#define R128_GUI_STAT 0x1740 -# define R128_GUI_FIFOCNT_MASK 0x0fff -# define R128_GUI_ACTIVE (1 << 31) - -#define R128_MCLK_CNTL 0x000f -# define R128_FORCE_GCP (1 << 16) -# define R128_FORCE_PIPE3D_CP (1 << 17) -# define R128_FORCE_RCP (1 << 18) - -#define R128_PC_GUI_CTLSTAT 0x1748 -#define R128_PC_NGUI_CTLSTAT 0x0184 -# define R128_PC_FLUSH_GUI (3 << 0) -# define R128_PC_RI_GUI (1 << 2) -# define R128_PC_FLUSH_ALL 0x00ff -# define R128_PC_BUSY (1 << 31) - -#define R128_PCI_GART_PAGE 0x017c -#define R128_PRIM_TEX_CNTL_C 0x1cb0 - -#define R128_SCALE_3D_CNTL 0x1a00 -#define R128_SEC_TEX_CNTL_C 0x1d00 -#define R128_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c -#define R128_SETUP_CNTL 0x1bc4 -#define R128_STEN_REF_MASK_C 0x1d40 - -#define R128_TEX_CNTL_C 0x1c9c -# define R128_TEX_CACHE_FLUSH (1 << 23) - -#define R128_WAIT_UNTIL 0x1720 -# define R128_EVENT_CRTC_OFFSET (1 << 0) -#define R128_WINDOW_XY_OFFSET 0x1bcc - - -/* CCE registers - */ -#define R128_PM4_BUFFER_OFFSET 0x0700 -#define R128_PM4_BUFFER_CNTL 0x0704 -# define R128_PM4_MASK (15 << 28) -# define R128_PM4_NONPM4 (0 << 28) -# define R128_PM4_192PIO (1 << 28) -# define R128_PM4_192BM (2 << 28) -# define R128_PM4_128PIO_64INDBM (3 << 28) -# define R128_PM4_128BM_64INDBM (4 << 28) -# define R128_PM4_64PIO_128INDBM (5 << 28) -# define R128_PM4_64BM_128INDBM (6 << 28) -# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) - -#define R128_PM4_BUFFER_WM_CNTL 0x0708 -# define R128_WMA_SHIFT 0 -# define R128_WMB_SHIFT 8 -# define R128_WMC_SHIFT 16 -# define R128_WB_WM_SHIFT 24 - -#define R128_PM4_BUFFER_DL_RPTR_ADDR 0x070c -#define R128_PM4_BUFFER_DL_RPTR 0x0710 -#define R128_PM4_BUFFER_DL_WPTR 0x0714 -# define R128_PM4_BUFFER_DL_DONE (1 << 31) - -#define R128_PM4_VC_FPU_SETUP 0x071c - -#define R128_PM4_IW_INDOFF 0x0738 -#define R128_PM4_IW_INDSIZE 0x073c - -#define R128_PM4_STAT 0x07b8 -# define R128_PM4_FIFOCNT_MASK 0x0fff -# define R128_PM4_BUSY (1 << 16) -# define R128_PM4_GUI_ACTIVE (1 << 31) - -#define R128_PM4_MICROCODE_ADDR 0x07d4 -#define R128_PM4_MICROCODE_RADDR 0x07d8 -#define R128_PM4_MICROCODE_DATAH 0x07dc -#define R128_PM4_MICROCODE_DATAL 0x07e0 - -#define R128_PM4_BUFFER_ADDR 0x07f0 -#define R128_PM4_MICRO_CNTL 0x07fc -# define R128_PM4_MICRO_FREERUN (1 << 30) - -#define R128_PM4_FIFO_DATA_EVEN 0x1000 -#define R128_PM4_FIFO_DATA_ODD 0x1004 - - -/* CCE command packets - */ -#define R128_CCE_PACKET0 0x00000000 -#define R128_CCE_PACKET1 0x40000000 -#define R128_CCE_PACKET2 0x80000000 -#define R128_CCE_PACKET3 0xC0000000 -# define R128_CNTL_HOSTDATA_BLT 0x00009400 -# define R128_CNTL_PAINT_MULTI 0x00009A00 -# define R128_CNTL_BITBLT_MULTI 0x00009B00 -# define R128_3D_RNDR_GEN_INDX_PRIM 0x00002300 - -#define R128_CCE_PACKET_MASK 0xC0000000 -#define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 -#define R128_CCE_PACKET0_REG_MASK 0x000007ff -#define R128_CCE_PACKET1_REG0_MASK 0x000007ff -#define R128_CCE_PACKET1_REG1_MASK 0x003ff800 - -#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 -#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 -#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 -#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 -#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 -#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 -#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 -#define R128_CCE_VC_CNTL_NUM_SHIFT 16 - -#define R128_DATATYPE_CI8 2 -#define R128_DATATYPE_ARGB1555 3 -#define R128_DATATYPE_RGB565 4 -#define R128_DATATYPE_RGB888 5 -#define R128_DATATYPE_ARGB8888 6 -#define R128_DATATYPE_RGB332 7 -#define R128_DATATYPE_RGB8 9 -#define R128_DATATYPE_ARGB4444 15 - -/* Constants */ -#define R128_AGP_OFFSET 0x02000000 - -#define R128_WATERMARK_L 16 -#define R128_WATERMARK_M 8 -#define R128_WATERMARK_N 8 -#define R128_WATERMARK_K 128 - -#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ - -#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 -#define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 -#define R128_MAX_VB_AGE 0x7fffffff -#define R128_MAX_VB_VERTS (0xffff) - -#define R128_RING_HIGH_MARK 128 - -#define R128_PERFORMANCE_BOXES 0 - - -#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) -#define R128_ADDR(reg) (R128_BASE( reg ) + reg) - -#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) -#ifdef __alpha__ -#define R128_READ(reg) (_R128_READ((u32 *)R128_ADDR(reg))) -static inline u32 _R128_READ(u32 *addr) -{ - DRM_OS_READMEMORYBARRIER; - return *(volatile u32 *)addr; -} -#define R128_WRITE(reg,val) \ -do { \ - DRM_OS_WRITEMEMORYBARRIER; \ - R128_DEREF(reg) = val; \ -} while (0) -#else -#define R128_READ(reg) le32_to_cpu( R128_DEREF( reg ) ) -#define R128_WRITE(reg,val) \ -do { \ - R128_DEREF( reg ) = cpu_to_le32( val ); \ -} while (0) -#endif - -#define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg ) -#ifdef __alpha__ -#define R128_READ8(reg) _R128_READ8((u8 *)R128_ADDR(reg)) -static inline u8 _R128_READ8(u8 *addr) -{ - DRM_OS_READMEMORYBARRIER; - return *(volatile u8 *)addr; -} -#define R128_WRITE8(reg,val) \ -do { \ - DRM_OS_WRITEMEMORYBARRIER; \ - R128_DEREF8(reg) = val; \ -} while (0) -#else -#define R128_READ8(reg) R128_DEREF8( reg ) -#define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0) -#endif - -#define R128_WRITE_PLL(addr,val) \ -do { \ - R128_WRITE8(R128_CLOCK_CNTL_INDEX, \ - ((addr) & 0x1f) | R128_PLL_WR_EN); \ - R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \ -} while (0) - -extern int R128_READ_PLL(drm_device_t *dev, int addr); - - -#define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \ - ((n) << 16) | ((reg) >> 2)) -#define CCE_PACKET1( reg0, reg1 ) (R128_CCE_PACKET1 | \ - (((reg1) >> 2) << 11) | ((reg0) >> 2)) -#define CCE_PACKET2() (R128_CCE_PACKET2) -#define CCE_PACKET3( pkt, n ) (R128_CCE_PACKET3 | \ - (pkt) | ((n) << 16)) - - -/* ================================================================ - * Misc helper macros - */ - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != DRM_OS_CURRENTPID ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - DRM_OS_RETURN( EINVAL ); \ - } \ -} while (0) - -#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ - if ( ring->space < ring->high_mark ) { \ - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - r128_update_ring_snapshot( ring ); \ - if ( ring->space >= ring->high_mark ) \ - goto __ring_space_done; \ - DRM_OS_DELAY( 1 ); \ - } \ - DRM_ERROR( "ring space check failed!\n" ); \ - DRM_OS_RETURN( EBUSY ); \ - } \ - __ring_space_done: \ -} while (0) - -#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \ - if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \ - int __ret = r128_do_cce_idle( dev_priv ); \ - if ( __ret < 0 ) return __ret; \ - sarea_priv->last_dispatch = 0; \ - r128_freelist_reset( dev ); \ - } \ -} while (0) - -#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \ - OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \ - OUT_RING( R128_EVENT_CRTC_OFFSET ); \ -} while (0) - - -/* ================================================================ - * Ring control - */ - -#define r128_flush_write_combine() DRM_OS_READMEMORYBARRIER - - -#define R128_VERBOSE 0 - -#define RING_LOCALS \ - int write; unsigned int tail_mask; volatile u32 *ring; - -#define BEGIN_RING( n ) do { \ - if ( R128_VERBOSE ) { \ - DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ - (n), __FUNCTION__ ); \ - } \ - if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ - r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ - } \ - dev_priv->ring.space -= (n) * sizeof(u32); \ - ring = dev_priv->ring.start; \ - write = dev_priv->ring.tail; \ - tail_mask = dev_priv->ring.tail_mask; \ -} while (0) - -/* You can set this to zero if you want. If the card locks up, you'll - * need to keep this set. It works around a bug in early revs of the - * Rage 128 chipset, where the CCE would read 32 dwords past the end of - * the ring buffer before wrapping around. - */ -#define R128_BROKEN_CCE 1 - -#define ADVANCE_RING() do { \ - if ( R128_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ - write, dev_priv->ring.tail ); \ - } \ - if ( R128_BROKEN_CCE && write < 32 ) { \ - memcpy( dev_priv->ring.end, \ - dev_priv->ring.start, \ - write * sizeof(u32) ); \ - } \ - r128_flush_write_combine(); \ - dev_priv->ring.tail = write; \ - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ -} while (0) - -#define OUT_RING( x ) do { \ - if ( R128_VERBOSE ) { \ - DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ - (unsigned int)(x), write ); \ - } \ - ring[write++] = cpu_to_le32( x ); \ - write &= tail_mask; \ -} while (0) - -#endif /* __R128_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c:1.1 Wed Dec 12 19:24:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c Thu Feb 27 12:32:26 2003 @@ -1,1570 +0,0 @@ -/* r128_state.c -- State support for r128 -*- linux-c -*- - * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - - -#include "r128.h" -#include "drmP.h" -#include "r128_drv.h" -#include "drm.h" - - - -/* ================================================================ - * CCE hardware state programming functions - */ - -static void r128_emit_clip_rects( drm_r128_private_t *dev_priv, - drm_clip_rect_t *boxes, int count ) -{ - u32 aux_sc_cntl = 0x00000000; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 17 ); - - if ( count >= 1 ) { - OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) ); - OUT_RING( boxes[0].x1 ); - OUT_RING( boxes[0].x2 - 1 ); - OUT_RING( boxes[0].y1 ); - OUT_RING( boxes[0].y2 - 1 ); - - aux_sc_cntl |= (R128_AUX1_SC_EN | R128_AUX1_SC_MODE_OR); - } - if ( count >= 2 ) { - OUT_RING( CCE_PACKET0( R128_AUX2_SC_LEFT, 3 ) ); - OUT_RING( boxes[1].x1 ); - OUT_RING( boxes[1].x2 - 1 ); - OUT_RING( boxes[1].y1 ); - OUT_RING( boxes[1].y2 - 1 ); - - aux_sc_cntl |= (R128_AUX2_SC_EN | R128_AUX2_SC_MODE_OR); - } - if ( count >= 3 ) { - OUT_RING( CCE_PACKET0( R128_AUX3_SC_LEFT, 3 ) ); - OUT_RING( boxes[2].x1 ); - OUT_RING( boxes[2].x2 - 1 ); - OUT_RING( boxes[2].y1 ); - OUT_RING( boxes[2].y2 - 1 ); - - aux_sc_cntl |= (R128_AUX3_SC_EN | R128_AUX3_SC_MODE_OR); - } - - OUT_RING( CCE_PACKET0( R128_AUX_SC_CNTL, 0 ) ); - OUT_RING( aux_sc_cntl ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_core( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_SCALE_3D_CNTL, 0 ) ); - OUT_RING( ctx->scale_3d_cntl ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_context( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 13 ); - - OUT_RING( CCE_PACKET0( R128_DST_PITCH_OFFSET_C, 11 ) ); - OUT_RING( ctx->dst_pitch_offset_c ); - OUT_RING( ctx->dp_gui_master_cntl_c ); - OUT_RING( ctx->sc_top_left_c ); - OUT_RING( ctx->sc_bottom_right_c ); - OUT_RING( ctx->z_offset_c ); - OUT_RING( ctx->z_pitch_c ); - OUT_RING( ctx->z_sten_cntl_c ); - OUT_RING( ctx->tex_cntl_c ); - OUT_RING( ctx->misc_3d_state_cntl_reg ); - OUT_RING( ctx->texture_clr_cmp_clr_c ); - OUT_RING( ctx->texture_clr_cmp_msk_c ); - OUT_RING( ctx->fog_color_c ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_setup( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 3 ); - - OUT_RING( CCE_PACKET1( R128_SETUP_CNTL, R128_PM4_VC_FPU_SETUP ) ); - OUT_RING( ctx->setup_cntl ); - OUT_RING( ctx->pm4_vc_fpu_setup ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_masks( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 ); - - OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); - OUT_RING( ctx->dp_write_mask ); - - OUT_RING( CCE_PACKET0( R128_STEN_REF_MASK_C, 1 ) ); - OUT_RING( ctx->sten_ref_mask_c ); - OUT_RING( ctx->plane_3d_mask_c ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_window( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_WINDOW_XY_OFFSET, 0 ) ); - OUT_RING( ctx->window_xy_offset ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_tex0( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0]; - int i; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 7 + R128_MAX_TEXTURE_LEVELS ); - - OUT_RING( CCE_PACKET0( R128_PRIM_TEX_CNTL_C, - 2 + R128_MAX_TEXTURE_LEVELS ) ); - OUT_RING( tex->tex_cntl ); - OUT_RING( tex->tex_combine_cntl ); - OUT_RING( ctx->tex_size_pitch_c ); - for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { - OUT_RING( tex->tex_offset[i] ); - } - - OUT_RING( CCE_PACKET0( R128_CONSTANT_COLOR_C, 1 ) ); - OUT_RING( ctx->constant_color_c ); - OUT_RING( tex->tex_border_color ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_tex1( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; - int i; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 + R128_MAX_TEXTURE_LEVELS ); - - OUT_RING( CCE_PACKET0( R128_SEC_TEX_CNTL_C, - 1 + R128_MAX_TEXTURE_LEVELS ) ); - OUT_RING( tex->tex_cntl ); - OUT_RING( tex->tex_combine_cntl ); - for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { - OUT_RING( tex->tex_offset[i] ); - } - - OUT_RING( CCE_PACKET0( R128_SEC_TEXTURE_BORDER_COLOR_C, 0 ) ); - OUT_RING( tex->tex_border_color ); - - ADVANCE_RING(); -} - -static __inline__ void r128_emit_state( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); - - if ( dirty & R128_UPLOAD_CORE ) { - r128_emit_core( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_CORE; - } - - if ( dirty & R128_UPLOAD_CONTEXT ) { - r128_emit_context( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_CONTEXT; - } - - if ( dirty & R128_UPLOAD_SETUP ) { - r128_emit_setup( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_SETUP; - } - - if ( dirty & R128_UPLOAD_MASKS ) { - r128_emit_masks( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_MASKS; - } - - if ( dirty & R128_UPLOAD_WINDOW ) { - r128_emit_window( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_WINDOW; - } - - if ( dirty & R128_UPLOAD_TEX0 ) { - r128_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_TEX0; - } - - if ( dirty & R128_UPLOAD_TEX1 ) { - r128_emit_tex1( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_TEX1; - } - - /* Turn off the texture cache flushing */ - sarea_priv->context_state.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; - - sarea_priv->dirty &= ~R128_REQUIRE_QUIESCENCE; -} - - -#if R128_PERFORMANCE_BOXES -/* ================================================================ - * Performance monitoring functions - */ - -static void r128_clear_box( drm_r128_private_t *dev_priv, - int x, int y, int w, int h, - int r, int g, int b ) -{ - u32 pitch, offset; - u32 fb_bpp, color; - RING_LOCALS; - - switch ( dev_priv->fb_bpp ) { - case 16: - fb_bpp = R128_GMC_DST_16BPP; - color = (((r & 0xf8) << 8) | - ((g & 0xfc) << 3) | - ((b & 0xf8) >> 3)); - break; - case 24: - fb_bpp = R128_GMC_DST_24BPP; - color = ((r << 16) | (g << 8) | b); - break; - case 32: - fb_bpp = R128_GMC_DST_32BPP; - color = (((0xff) << 24) | (r << 16) | (g << 8) | b); - break; - default: - return; - } - - offset = dev_priv->back_offset; - pitch = dev_priv->back_pitch >> 3; - - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - fb_bpp | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS ); - - OUT_RING( (pitch << 21) | (offset >> 5) ); - OUT_RING( color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); -} - -static void r128_cce_performance_boxes( drm_r128_private_t *dev_priv ) -{ - if ( atomic_read( &dev_priv->idle_count ) == 0 ) { - r128_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); - } else { - atomic_set( &dev_priv->idle_count, 0 ); - } -} - -#endif - - -/* ================================================================ - * CCE command dispatch functions - */ - -static void r128_print_dirty( const char *msg, unsigned int flags ) -{ - DRM_INFO( "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", - msg, - flags, - (flags & R128_UPLOAD_CORE) ? "core, " : "", - (flags & R128_UPLOAD_CONTEXT) ? "context, " : "", - (flags & R128_UPLOAD_SETUP) ? "setup, " : "", - (flags & R128_UPLOAD_TEX0) ? "tex0, " : "", - (flags & R128_UPLOAD_TEX1) ? "tex1, " : "", - (flags & R128_UPLOAD_MASKS) ? "masks, " : "", - (flags & R128_UPLOAD_WINDOW) ? "window, " : "", - (flags & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "", - (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); -} - -static void r128_cce_dispatch_clear( drm_device_t *dev, - drm_r128_clear_t *clear ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int flags = clear->flags; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { - unsigned int tmp = flags; - - flags &= ~(R128_FRONT | R128_BACK); - if ( tmp & R128_FRONT ) flags |= R128_BACK; - if ( tmp & R128_BACK ) flags |= R128_FRONT; - } - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", - pbox[i].x1, pbox[i].y1, pbox[i].x2, - pbox[i].y2, flags ); - - if ( flags & (R128_FRONT | R128_BACK) ) { - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); - OUT_RING( clear->color_mask ); - - ADVANCE_RING(); - } - - if ( flags & R128_FRONT ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS ); - - OUT_RING( dev_priv->front_pitch_offset_c ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - if ( flags & R128_BACK ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS ); - - OUT_RING( dev_priv->back_pitch_offset_c ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - if ( flags & R128_DEPTH ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( clear->clear_depth ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - } -} - -static void r128_cce_dispatch_swap( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - -#if R128_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - r128_cce_performance_boxes( dev_priv ); -#endif - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - BEGIN_RING( 7 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (dev_priv->color_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->back_pitch_offset_c ); - OUT_RING( dev_priv->front_pitch_offset_c ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); - OUT_RING( dev_priv->sarea_priv->last_frame ); - - ADVANCE_RING(); -} - -static void r128_cce_dispatch_flip( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - -#if R128_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - r128_cce_performance_boxes( dev_priv ); -#endif - - BEGIN_RING( 4 ); - - R128_WAIT_UNTIL_PAGE_FLIPPED(); - OUT_RING( CCE_PACKET0( R128_CRTC_OFFSET, 0 ) ); - - if ( dev_priv->current_page == 0 ) { - OUT_RING( dev_priv->back_offset ); - dev_priv->current_page = 1; - } else { - OUT_RING( dev_priv->front_offset ); - dev_priv->current_page = 0; - } - - ADVANCE_RING(); - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); - OUT_RING( dev_priv->sarea_priv->last_frame ); - - ADVANCE_RING(); -} - -static void r128_cce_dispatch_vertex( drm_device_t *dev, - drm_buf_t *buf ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = buf->bus_address; - int size = buf->used; - int prim = buf_priv->prim; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "%s: buf=%d nbox=%d\n", - __FUNCTION__, buf->idx, sarea_priv->nbox ); - - if ( 0 ) - r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); - - if ( buf->used ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { - r128_emit_state( dev_priv ); - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - r128_emit_clip_rects( dev_priv, - &sarea_priv->boxes[i], - sarea_priv->nbox - i ); - } - - /* Emit the vertex buffer rendering commands */ - BEGIN_RING( 5 ); - - OUT_RING( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, 3 ) ); - OUT_RING( offset ); - OUT_RING( size ); - OUT_RING( format ); - OUT_RING( prim | R128_CCE_VC_CNTL_PRIM_WALK_LIST | - (size << R128_CCE_VC_CNTL_NUM_SHIFT) ); - - ADVANCE_RING(); - - i += 3; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); - OUT_RING( buf_priv->age ); - - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - -static void r128_cce_dispatch_indirect( drm_device_t *dev, - drm_buf_t *buf, - int start, int end ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - RING_LOCALS; - DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", - buf->idx, start, end ); - - if ( start != end ) { - int offset = buf->bus_address + start; - int dwords = (end - start + 3) / sizeof(u32); - - /* Indirect buffer data must be an even number of - * dwords, so if we've been given an odd number we must - * pad the data with a Type-2 CCE packet. - */ - if ( dwords & 1 ) { - u32 *data = (u32 *) - ((char *)dev_priv->buffers->handle - + buf->offset + start); - data[dwords++] = cpu_to_le32( R128_CCE_PACKET2 ); - } - - buf_priv->dispatched = 1; - - /* Fire off the indirect buffer */ - BEGIN_RING( 3 ); - - OUT_RING( CCE_PACKET0( R128_PM4_IW_INDOFF, 1 ) ); - OUT_RING( offset ); - OUT_RING( dwords ); - - ADVANCE_RING(); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the indirect buffer age */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); - OUT_RING( buf_priv->age ); - - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; -} - -static void r128_cce_dispatch_indices( drm_device_t *dev, - drm_buf_t *buf, - int start, int end, - int count ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = dev_priv->buffers->offset - dev_priv->cce_buffers_offset; - int prim = buf_priv->prim; - u32 *data; - int dwords; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - - if ( 0 ) - r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); - - if ( start != end ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { - r128_emit_state( dev_priv ); - } - - dwords = (end - start + 3) / sizeof(u32); - - data = (u32 *)((char *)dev_priv->buffers->handle - + buf->offset + start); - - data[0] = cpu_to_le32( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, - dwords-2 ) ); - - data[1] = cpu_to_le32( offset ); - data[2] = cpu_to_le32( R128_MAX_VB_VERTS ); - data[3] = cpu_to_le32( format ); - data[4] = cpu_to_le32( (prim | R128_CCE_VC_CNTL_PRIM_WALK_IND | - (count << 16)) ); - - if ( count & 0x1 ) { -#if BYTE_ORDER==LITTLE_ENDIAN - data[dwords-1] &= 0x0000ffff; -#else - data[dwords-1] &= 0xffff0000; -#endif - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - r128_emit_clip_rects( dev_priv, - &sarea_priv->boxes[i], - sarea_priv->nbox - i ); - } - - r128_cce_dispatch_indirect( dev, buf, start, end ); - - i += 3; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); - OUT_RING( buf_priv->age ); - - ADVANCE_RING(); - - buf->pending = 1; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - -static int r128_cce_dispatch_blit( drm_device_t *dev, - drm_r128_blit_t *blit, int pid ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - u32 *data; - int dword_shift, dwords; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* The compiler won't optimize away a division by a variable, - * even if the only legal values are powers of two. Thus, we'll - * use a shift instead. - */ - switch ( blit->format ) { - case R128_DATATYPE_ARGB8888: - dword_shift = 0; - break; - case R128_DATATYPE_ARGB1555: - case R128_DATATYPE_RGB565: - case R128_DATATYPE_ARGB4444: - dword_shift = 1; - break; - case R128_DATATYPE_CI8: - case R128_DATATYPE_RGB8: - dword_shift = 2; - break; - default: - DRM_ERROR( "invalid blit format %d\n", blit->format ); - DRM_OS_RETURN( EINVAL ); - } - - /* Flush the pixel cache, and mark the contents as Read Invalid. - * This ensures no pixel data gets mixed up with the texture - * data from the host data blit, otherwise part of the texture - * image may be corrupted. - */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); - OUT_RING( R128_PC_RI_GUI | R128_PC_FLUSH_GUI ); - - ADVANCE_RING(); - - /* Dispatch the indirect buffer. - */ - buf = dma->buflist[blit->idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - pid, buf->pid ); - DRM_OS_RETURN( EINVAL ); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", blit->idx ); - DRM_OS_RETURN( EINVAL ); - } - - buf_priv->discard = 1; - - dwords = (blit->width * blit->height) >> dword_shift; - - data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); - - data[0] = cpu_to_le32( CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 ) ); - data[1] = cpu_to_le32( (R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (blit->format << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_HOST_DATA | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS) ); - - data[2] = cpu_to_le32( (blit->pitch << 21) | (blit->offset >> 5) ); - data[3] = cpu_to_le32( 0xffffffff ); - data[4] = cpu_to_le32( 0xffffffff ); - data[5] = cpu_to_le32( (blit->y << 16) | blit->x ); - data[6] = cpu_to_le32( (blit->height << 16) | blit->width ); - data[7] = cpu_to_le32( dwords ); - - buf->used = (dwords + 8) * sizeof(u32); - - r128_cce_dispatch_indirect( dev, buf, 0, buf->used ); - - /* Flush the pixel cache after the blit completes. This ensures - * the texture data is written out to memory before rendering - * continues. - */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); - OUT_RING( R128_PC_FLUSH_GUI ); - - ADVANCE_RING(); - - return 0; -} - - -/* ================================================================ - * Tiled depth buffer management - * - * FIXME: These should all set the destination write mask for when we - * have hardware stencil support. - */ - -static int r128_cce_dispatch_write_span( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, x, y; - u32 *buffer; - u8 *mask; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - if ( DRM_OS_COPYFROMUSR( &x, depth->x, sizeof(x) ) ) { - DRM_OS_RETURN( EFAULT ); - } - if ( DRM_OS_COPYFROMUSR( &y, depth->y, sizeof(y) ) ) { - DRM_OS_RETURN( EFAULT ); - } - - buffer = DRM_OS_MALLOC( depth->n * sizeof(u32) ); - if ( buffer == NULL ) - DRM_OS_RETURN( ENOMEM ); - if ( DRM_OS_COPYFROMUSR( buffer, depth->buffer, - depth->n * sizeof(u32) ) ) { - DRM_OS_FREE( buffer ); - DRM_OS_RETURN( EFAULT ); - } - - if ( depth->mask ) { - mask = DRM_OS_MALLOC( depth->n * sizeof(u8) ); - if ( mask == NULL ) { - DRM_OS_FREE( buffer ); - DRM_OS_RETURN( ENOMEM ); - } - if ( DRM_OS_COPYFROMUSR( mask, depth->mask, - depth->n * sizeof(u8) ) ) { - DRM_OS_FREE( buffer ); - DRM_OS_FREE( mask ); - DRM_OS_RETURN( EFAULT ); - } - - for ( i = 0 ; i < count ; i++, x++ ) { - if ( mask[i] ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - DRM_OS_FREE( mask ); - } else { - for ( i = 0 ; i < count ; i++, x++ ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - DRM_OS_FREE( buffer ); - - return 0; -} - -static int r128_cce_dispatch_write_pixels( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, *x, *y; - u32 *buffer; - u8 *mask; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - - x = DRM_OS_MALLOC( count * sizeof(*x) ); - if ( x == NULL ) { - DRM_OS_RETURN( ENOMEM ); - } - y = DRM_OS_MALLOC( count * sizeof(*y) ); - if ( y == NULL ) { - DRM_OS_FREE( x ); - DRM_OS_RETURN( ENOMEM ); - } - if ( DRM_OS_COPYFROMUSR( x, depth->x, count * sizeof(int) ) ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_RETURN( EFAULT ); - } - if ( DRM_OS_COPYFROMUSR( y, depth->y, count * sizeof(int) ) ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_RETURN( EFAULT ); - } - - buffer = DRM_OS_MALLOC( depth->n * sizeof(u32) ); - if ( buffer == NULL ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_RETURN( ENOMEM ); - } - if ( DRM_OS_COPYFROMUSR( buffer, depth->buffer, - depth->n * sizeof(u32) ) ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_FREE( buffer ); - DRM_OS_RETURN( EFAULT ); - } - - if ( depth->mask ) { - mask = DRM_OS_MALLOC( depth->n * sizeof(u8) ); - if ( mask == NULL ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_FREE( buffer ); - DRM_OS_RETURN( ENOMEM ); - } - if ( DRM_OS_COPYFROMUSR( mask, depth->mask, - depth->n * sizeof(u8) ) ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_FREE( buffer ); - DRM_OS_FREE( mask ); - DRM_OS_RETURN( EFAULT ); - } - - for ( i = 0 ; i < count ; i++ ) { - if ( mask[i] ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x[i] << 16) | y[i] ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - DRM_OS_FREE( mask ); - } else { - for ( i = 0 ; i < count ; i++ ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x[i] << 16) | y[i] ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_FREE( buffer ); - - return 0; -} - -static int r128_cce_dispatch_read_span( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, x, y; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - if ( DRM_OS_COPYFROMUSR( &x, depth->x, sizeof(x) ) ) { - DRM_OS_RETURN( EFAULT ); - } - if ( DRM_OS_COPYFROMUSR( &y, depth->y, sizeof(y) ) ) { - DRM_OS_RETURN( EFAULT ); - } - - BEGIN_RING( 7 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( dev_priv->span_pitch_offset_c ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (0 << 16) | 0 ); - OUT_RING( (count << 16) | 1 ); - - ADVANCE_RING(); - - return 0; -} - -static int r128_cce_dispatch_read_pixels( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, *x, *y; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - if ( count > dev_priv->depth_pitch ) { - count = dev_priv->depth_pitch; - } - - x = DRM_OS_MALLOC( count * sizeof(*x) ); - if ( x == NULL ) { - DRM_OS_RETURN( ENOMEM ); - } - y = DRM_OS_MALLOC( count * sizeof(*y) ); - if ( y == NULL ) { - DRM_OS_FREE( x ); - DRM_OS_RETURN( ENOMEM ); - } - if ( DRM_OS_COPYFROMUSR( x, depth->x, count * sizeof(int) ) ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_RETURN( EFAULT ); - } - if ( DRM_OS_COPYFROMUSR( y, depth->y, count * sizeof(int) ) ) { - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - DRM_OS_RETURN( EFAULT ); - } - - for ( i = 0 ; i < count ; i++ ) { - BEGIN_RING( 7 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( dev_priv->span_pitch_offset_c ); - - OUT_RING( (x[i] << 16) | y[i] ); - OUT_RING( (i << 16) | 0 ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - - DRM_OS_FREE( x ); - DRM_OS_FREE( y ); - - return 0; -} - - -/* ================================================================ - * Polygon stipple - */ - -static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - BEGIN_RING( 33 ); - - OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); - for ( i = 0 ; i < 32 ; i++ ) { - OUT_RING( stipple[i] ); - } - - ADVANCE_RING(); -} - - -/* ================================================================ - * IOCTL functions - */ - -int r128_cce_clear( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_clear_t clear; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( clear, (drm_r128_clear_t *) data, - sizeof(clear) ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - - r128_cce_dispatch_clear( dev, &clear ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; - - return 0; -} - -int r128_cce_swap( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - - if ( !dev_priv->page_flipping ) { - r128_cce_dispatch_swap( dev ); - dev_priv->sarea_priv->dirty |= (R128_UPLOAD_CONTEXT | - R128_UPLOAD_MASKS); - } else { - r128_cce_dispatch_flip( dev ); - } - - return 0; -} - -int r128_cce_vertex( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_vertex_t vertex; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - DRM_OS_KRNFROMUSR( vertex, (drm_r128_vertex_t *) data, - sizeof(vertex) ); - - DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", - __FUNCTION__, DRM_OS_CURRENTPID, - vertex.idx, vertex.count, vertex.discard ); - - if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - vertex.idx, dma->buf_count - 1 ); - DRM_OS_RETURN( EINVAL ); - } - if ( vertex.prim < 0 || - vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { - DRM_ERROR( "buffer prim %d\n", vertex.prim ); - DRM_OS_RETURN( EINVAL ); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[vertex.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != DRM_OS_CURRENTPID ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN( EINVAL ); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); - DRM_OS_RETURN( EINVAL ); - } - - buf->used = vertex.count; - buf_priv->prim = vertex.prim; - buf_priv->discard = vertex.discard; - - r128_cce_dispatch_vertex( dev, buf ); - - return 0; -} - -int r128_cce_indices( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_indices_t elts; - int count; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - DRM_OS_KRNFROMUSR( elts, (drm_r128_indices_t *) data, - sizeof(elts) ); - - DRM_DEBUG( "%s: pid=%d buf=%d s=%d e=%d d=%d\n", - __FUNCTION__, DRM_OS_CURRENTPID, - elts.idx, elts.start, elts.end, elts.discard ); - - if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - elts.idx, dma->buf_count - 1 ); - DRM_OS_RETURN( EINVAL ); - } - if ( elts.prim < 0 || - elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { - DRM_ERROR( "buffer prim %d\n", elts.prim ); - DRM_OS_RETURN( EINVAL ); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[elts.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != DRM_OS_CURRENTPID ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN( EINVAL ); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", elts.idx ); - DRM_OS_RETURN( EINVAL ); - } - - count = (elts.end - elts.start) / sizeof(u16); - elts.start -= R128_INDEX_PRIM_OFFSET; - - if ( elts.start & 0x7 ) { - DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); - DRM_OS_RETURN( EINVAL ); - } - if ( elts.start < buf->used ) { - DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); - DRM_OS_RETURN( EINVAL ); - } - - buf->used = elts.end; - buf_priv->prim = elts.prim; - buf_priv->discard = elts.discard; - - r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count ); - - return 0; -} - -int r128_cce_blit( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_blit_t blit; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( blit, (drm_r128_blit_t *) data, - sizeof(blit) ); - - DRM_DEBUG( "%s: pid=%d index=%d\n", - __FUNCTION__, DRM_OS_CURRENTPID, blit.idx ); - - if ( blit.idx < 0 || blit.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - blit.idx, dma->buf_count - 1 ); - DRM_OS_RETURN( EINVAL ); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - return r128_cce_dispatch_blit( dev, &blit, DRM_OS_CURRENTPID ); -} - -int r128_cce_depth( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_depth_t depth; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( depth, (drm_r128_depth_t *) data, - sizeof(depth) ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - switch ( depth.func ) { - case R128_WRITE_SPAN: - return r128_cce_dispatch_write_span( dev, &depth ); - case R128_WRITE_PIXELS: - return r128_cce_dispatch_write_pixels( dev, &depth ); - case R128_READ_SPAN: - return r128_cce_dispatch_read_span( dev, &depth ); - case R128_READ_PIXELS: - return r128_cce_dispatch_read_pixels( dev, &depth ); - } - - DRM_OS_RETURN( EINVAL ); -} - -int r128_cce_stipple( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_stipple_t stipple; - u32 mask[32]; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( stipple, (drm_r128_stipple_t *) data, - sizeof(stipple) ); - - if ( DRM_OS_COPYFROMUSR( &mask, stipple.mask, - 32 * sizeof(u32) ) ) - DRM_OS_RETURN( EFAULT ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - r128_cce_dispatch_stipple( dev, mask ); - - return 0; -} - -int r128_cce_indirect( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_indirect_t indirect; -#if 0 - RING_LOCALS; -#endif - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - DRM_OS_RETURN(EINVAL); - } - - DRM_OS_KRNFROMUSR( indirect, (drm_r128_indirect_t *) data, - sizeof(indirect) ); - - DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", - indirect.idx, indirect.start, - indirect.end, indirect.discard ); - - if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - indirect.idx, dma->buf_count - 1 ); - DRM_OS_RETURN(EINVAL); - } - - buf = dma->buflist[indirect.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != DRM_OS_CURRENTPID ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN(EINVAL); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); - DRM_OS_RETURN(EINVAL); - } - - if ( indirect.start < buf->used ) { - DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", - indirect.start, buf->used ); - DRM_OS_RETURN(EINVAL); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf->used = indirect.end; - buf_priv->discard = indirect.discard; - -#if 0 - /* Wait for the 3D stream to idle before the indirect buffer - * containing 2D acceleration commands is processed. - */ - BEGIN_RING( 2 ); - RADEON_WAIT_UNTIL_3D_IDLE(); - ADVANCE_RING(); -#endif - - /* Dispatch the indirect buffer full of commands from the - * X server. This is insecure and is thus only available to - * privileged clients. - */ - r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end ); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile Wed Oct 30 07:52:31 2002 @@ -1,25 +1,23 @@ # $FreeBSD$ +.PATH: ${.CURDIR}/.. KMOD = radeon NOMAN= YES -SRCS = radeon_cp.c radeon_drv.c radeon_state.c -SRCS += device_if.h bus_if.h pci_if.h opt_drm_linux.h +SRCS = radeon_cp.c radeon_drv.c radeon_state.c radeon_irq.c radeon_mem.c +SRCS += device_if.h bus_if.h pci_if.h opt_drm.h CFLAGS += ${DEBUG_FLAGS} -I. -I.. -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine +.if defined(DRM_DEBUG) +DRM_DEBUG_OPT= "\#define DRM_DEBUG 1" +.endif -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#RADEON_OPTS= "\#define DRM_LINUX" 1 +.if !defined(DRM_NOLINUX) +DRM_LINUX_OPT= "\#define DRM_LINUX 1" .endif -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(RADEON_OPTS) >> opt_drm_linux.h +opt_drm.h: + touch opt_drm.h + echo $(DRM_DEBUG_OPT) >> opt_drm.h + echo $(DRM_LINUX_OPT) >> opt_drm.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h Thu Feb 27 12:32:26 2003 @@ -1,81 +0,0 @@ -/* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __RADEON_H__ -#define __RADEON_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) radeon_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_SG 1 -#define __HAVE_PCI_DMA 1 - -/* Driver customization: - */ -#define DRIVER_PRERELEASE() do { \ - if ( dev->dev_private ) { \ - drm_radeon_private_t *dev_priv = dev->dev_private; \ - if ( dev_priv->page_flipping ) { \ - radeon_do_cleanup_pageflip( dev ); \ - } \ - } \ -} while (0) - -#define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) radeon_do_cleanup_cp( dev ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 - -#if 0 -/* GH: Remove this for now... */ -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - drm_radeon_private_t *dev_priv = dev->dev_private; \ - return radeon_do_cp_idle( dev_priv ); \ -} while (0) -#endif - -/* Buffer customization: - */ -#define DRIVER_BUF_PRIV_T drm_radeon_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_radeon_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c Thu Feb 27 12:32:26 2003 @@ -1,1421 +0,0 @@ -/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#include "radeon.h" -#include "drmP.h" -#include "radeon_drv.h" - -#include <vm/vm.h> -#include <vm/pmap.h> - -#define RADEON_FIFO_DEBUG 0 - -#if defined(__alpha__) -# define PCIGART_ENABLED -#else -# undef PCIGART_ENABLED -#endif - - -/* CP microcode (from ATI) */ -static u32 radeon_cp_microcode[][2] = { - { 0x21007000, 0000000000 }, - { 0x20007000, 0000000000 }, - { 0x000000b4, 0x00000004 }, - { 0x000000b8, 0x00000004 }, - { 0x6f5b4d4c, 0000000000 }, - { 0x4c4c427f, 0000000000 }, - { 0x5b568a92, 0000000000 }, - { 0x4ca09c6d, 0000000000 }, - { 0xad4c4c4c, 0000000000 }, - { 0x4ce1af3d, 0000000000 }, - { 0xd8afafaf, 0000000000 }, - { 0xd64c4cdc, 0000000000 }, - { 0x4cd10d10, 0000000000 }, - { 0x000f0000, 0x00000016 }, - { 0x362f242d, 0000000000 }, - { 0x00000012, 0x00000004 }, - { 0x000f0000, 0x00000016 }, - { 0x362f282d, 0000000000 }, - { 0x000380e7, 0x00000002 }, - { 0x04002c97, 0x00000002 }, - { 0x000f0001, 0x00000016 }, - { 0x333a3730, 0000000000 }, - { 0x000077ef, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00000017, 0x00000004 }, - { 0x0003802b, 0x00000002 }, - { 0x040067e0, 0x00000002 }, - { 0x00000017, 0x00000004 }, - { 0x000077e0, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x000037e1, 0x00000002 }, - { 0x040067e1, 0x00000006 }, - { 0x000077e0, 0x00000002 }, - { 0x000077e1, 0x00000002 }, - { 0x000077e1, 0x00000006 }, - { 0xffffffff, 0000000000 }, - { 0x10000000, 0000000000 }, - { 0x0003802b, 0x00000002 }, - { 0x040067e0, 0x00000006 }, - { 0x00007675, 0x00000002 }, - { 0x00007676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0003802c, 0x00000002 }, - { 0x04002676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0000002f, 0x00000018 }, - { 0x0000002f, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x00000030, 0x00000018 }, - { 0x00000030, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x01605000, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00098000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x64c0603e, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00080000, 0x00000016 }, - { 0000000000, 0000000000 }, - { 0x0400251d, 0x00000002 }, - { 0x00007580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x04002580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x00000049, 0x00000004 }, - { 0x00005000, 0000000000 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x00019000, 0x00000002 }, - { 0x00011055, 0x00000014 }, - { 0x00000055, 0x00000012 }, - { 0x0400250f, 0x00000002 }, - { 0x0000504f, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007565, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x00000058, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x01e655b4, 0x00000002 }, - { 0x4401b0e4, 0x00000002 }, - { 0x01c110e4, 0x00000002 }, - { 0x26667066, 0x00000018 }, - { 0x040c2565, 0x00000002 }, - { 0x00000066, 0x00000018 }, - { 0x04002564, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x0000005d, 0x00000004 }, - { 0x00401069, 0x00000008 }, - { 0x00101000, 0x00000002 }, - { 0x000d80ff, 0x00000002 }, - { 0x0080006c, 0x00000008 }, - { 0x000f9000, 0x00000002 }, - { 0x000e00ff, 0x00000002 }, - { 0000000000, 0x00000006 }, - { 0x0000008f, 0x00000018 }, - { 0x0000005b, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007576, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00009000, 0x00000002 }, - { 0x00041000, 0x00000002 }, - { 0x0c00350e, 0x00000002 }, - { 0x00049000, 0x00000002 }, - { 0x00051000, 0x00000002 }, - { 0x01e785f8, 0x00000002 }, - { 0x00200000, 0x00000002 }, - { 0x0060007e, 0x0000000c }, - { 0x00007563, 0x00000002 }, - { 0x006075f0, 0x00000021 }, - { 0x20007073, 0x00000004 }, - { 0x00005073, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007576, 0x00000002 }, - { 0x00007577, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x0000750f, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00600083, 0x0000000c }, - { 0x006075f0, 0x00000021 }, - { 0x000075f8, 0x00000002 }, - { 0x00000083, 0x00000004 }, - { 0x000a750e, 0x00000002 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x0020750f, 0x00000002 }, - { 0x00600086, 0x00000004 }, - { 0x00007570, 0x00000002 }, - { 0x00007571, 0x00000002 }, - { 0x00007572, 0x00000006 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00005000, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00007568, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000095, 0x0000000c }, - { 0x00058000, 0x00000002 }, - { 0x0c607562, 0x00000002 }, - { 0x00000097, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00600096, 0x00000004 }, - { 0x400070e5, 0000000000 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x000380e5, 0x00000002 }, - { 0x000000a8, 0x0000001c }, - { 0x000650aa, 0x00000018 }, - { 0x040025bb, 0x00000002 }, - { 0x000610ab, 0x00000018 }, - { 0x040075bc, 0000000000 }, - { 0x000075bb, 0x00000002 }, - { 0x000075bc, 0000000000 }, - { 0x00090000, 0x00000006 }, - { 0x00090000, 0x00000002 }, - { 0x000d8002, 0x00000006 }, - { 0x00007832, 0x00000002 }, - { 0x00005000, 0x00000002 }, - { 0x000380e7, 0x00000002 }, - { 0x04002c97, 0x00000002 }, - { 0x00007820, 0x00000002 }, - { 0x00007821, 0x00000002 }, - { 0x00007800, 0000000000 }, - { 0x01200000, 0x00000002 }, - { 0x20077000, 0x00000002 }, - { 0x01200000, 0x00000002 }, - { 0x20007000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x0120751b, 0x00000002 }, - { 0x8040750a, 0x00000002 }, - { 0x8040750b, 0x00000002 }, - { 0x00110000, 0x00000002 }, - { 0x000380e5, 0x00000002 }, - { 0x000000c6, 0x0000001c }, - { 0x000610ab, 0x00000018 }, - { 0x844075bd, 0x00000002 }, - { 0x000610aa, 0x00000018 }, - { 0x840075bb, 0x00000002 }, - { 0x000610ab, 0x00000018 }, - { 0x844075bc, 0x00000002 }, - { 0x000000c9, 0x00000004 }, - { 0x804075bd, 0x00000002 }, - { 0x800075bb, 0x00000002 }, - { 0x804075bc, 0x00000002 }, - { 0x00108000, 0x00000002 }, - { 0x01400000, 0x00000002 }, - { 0x006000cd, 0x0000000c }, - { 0x20c07000, 0x00000020 }, - { 0x000000cf, 0x00000012 }, - { 0x00800000, 0x00000006 }, - { 0x0080751d, 0x00000006 }, - { 0000000000, 0000000000 }, - { 0x0000775c, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00661000, 0x00000002 }, - { 0x0460275d, 0x00000020 }, - { 0x00004000, 0000000000 }, - { 0x01e00830, 0x00000002 }, - { 0x21007000, 0000000000 }, - { 0x6464614d, 0000000000 }, - { 0x69687420, 0000000000 }, - { 0x00000073, 0000000000 }, - { 0000000000, 0000000000 }, - { 0x00005000, 0x00000002 }, - { 0x000380d0, 0x00000002 }, - { 0x040025e0, 0x00000002 }, - { 0x000075e1, 0000000000 }, - { 0x00000001, 0000000000 }, - { 0x000380e0, 0x00000002 }, - { 0x04002394, 0x00000002 }, - { 0x00005000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0x00000008, 0000000000 }, - { 0x00000004, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, -}; - - -int RADEON_READ_PLL(drm_device_t *dev, int addr) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - - RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f); - return RADEON_READ(RADEON_CLOCK_CNTL_DATA); -} - -#if RADEON_FIFO_DEBUG -static void radeon_status( drm_radeon_private_t *dev_priv ) -{ - printk( "%s:\n", __FUNCTION__ ); - printk( "RBBM_STATUS = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_RBBM_STATUS ) ); - printk( "CP_RB_RTPR = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_CP_RB_RPTR ) ); - printk( "CP_RB_WTPR = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_CP_RB_WPTR ) ); - printk( "AIC_CNTL = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_CNTL ) ); - printk( "AIC_STAT = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_STAT ) ); - printk( "AIC_PT_BASE = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_PT_BASE ) ); - printk( "TLB_ADDR = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_TLB_ADDR ) ); - printk( "TLB_DATA = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_TLB_DATA ) ); -} -#endif - - -/* ================================================================ - * Engine, FIFO control - */ - -static int radeon_do_pixcache_flush( drm_radeon_private_t *dev_priv ) -{ - u32 tmp; - int i; - - tmp = RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ); - tmp |= RADEON_RB2D_DC_FLUSH_ALL; - RADEON_WRITE( RADEON_RB2D_DSTCACHE_CTLSTAT, tmp ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ) - & RADEON_RB2D_DC_BUSY) ) { - return 0; - } - DRM_OS_DELAY( 1 ); - } - -#if RADEON_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - radeon_status( dev_priv ); -#endif - DRM_OS_RETURN( EBUSY ); -} - -static int radeon_do_wait_for_fifo( drm_radeon_private_t *dev_priv, - int entries ) -{ - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - int slots = ( RADEON_READ( RADEON_RBBM_STATUS ) - & RADEON_RBBM_FIFOCNT_MASK ); - if ( slots >= entries ) return 0; - DRM_OS_DELAY( 1 ); - } - -#if RADEON_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - radeon_status( dev_priv ); -#endif - DRM_OS_RETURN( EBUSY ); -} - -static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) -{ - int i, ret; - - ret = radeon_do_wait_for_fifo( dev_priv, 64 ); - if ( ret ) return ret; - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(RADEON_READ( RADEON_RBBM_STATUS ) - & RADEON_RBBM_ACTIVE) ) { - radeon_do_pixcache_flush( dev_priv ); - return 0; - } - DRM_OS_DELAY( 1 ); - } - -#if RADEON_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - radeon_status( dev_priv ); -#endif - DRM_OS_RETURN( EBUSY ); -} - - -/* ================================================================ - * CP control, initialization - */ - -/* Load the microcode for the CP */ -static void radeon_cp_load_microcode( drm_radeon_private_t *dev_priv ) -{ - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - radeon_do_wait_for_idle( dev_priv ); - - RADEON_WRITE( RADEON_CP_ME_RAM_ADDR, 0 ); - for ( i = 0 ; i < 256 ; i++ ) { - RADEON_WRITE( RADEON_CP_ME_RAM_DATAH, - radeon_cp_microcode[i][1] ); - RADEON_WRITE( RADEON_CP_ME_RAM_DATAL, - radeon_cp_microcode[i][0] ); - } -} - -/* Flush any pending commands to the CP. This should only be used just - * prior to a wait for idle, as it informs the engine that the command - * stream is ending. - */ -static void radeon_do_cp_flush( drm_radeon_private_t *dev_priv ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); -#if 0 - u32 tmp; - - tmp = RADEON_READ( RADEON_CP_RB_WPTR ) | (1 << 31); - RADEON_WRITE( RADEON_CP_RB_WPTR, tmp ); -#endif -} - -/* Wait for the CP to go idle. - */ -int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ) -{ - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - BEGIN_RING( 6 ); - - RADEON_PURGE_CACHE(); - RADEON_PURGE_ZCACHE(); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); - - return radeon_do_wait_for_idle( dev_priv ); -} - -/* Start the Command Processor. - */ -static void radeon_do_cp_start( drm_radeon_private_t *dev_priv ) -{ - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - radeon_do_wait_for_idle( dev_priv ); - - RADEON_WRITE( RADEON_CP_CSQ_CNTL, dev_priv->cp_mode ); - - dev_priv->cp_running = 1; - - BEGIN_RING( 6 ); - - RADEON_PURGE_CACHE(); - RADEON_PURGE_ZCACHE(); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); -} - -/* Reset the Command Processor. This will not flush any pending - * commands, so you must wait for the CP command stream to complete - * before calling this routine. - */ -static void radeon_do_cp_reset( drm_radeon_private_t *dev_priv ) -{ - u32 cur_read_ptr; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); - RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); - *dev_priv->ring.head = cur_read_ptr; - dev_priv->ring.tail = cur_read_ptr; -} - -/* Stop the Command Processor. This will not flush any pending - * commands, so you must flush the command stream and wait for the CP - * to go idle before calling this routine. - */ -static void radeon_do_cp_stop( drm_radeon_private_t *dev_priv ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - RADEON_WRITE( RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIDIS_INDDIS ); - - dev_priv->cp_running = 0; -} - -/* Reset the engine. This will stop the CP if it is running. - */ -static int radeon_do_engine_reset( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - radeon_do_pixcache_flush( dev_priv ); - - clock_cntl_index = RADEON_READ( RADEON_CLOCK_CNTL_INDEX ); - mclk_cntl = RADEON_READ_PLL( dev, RADEON_MCLK_CNTL ); - - RADEON_WRITE_PLL( RADEON_MCLK_CNTL, ( mclk_cntl | - RADEON_FORCEON_MCLKA | - RADEON_FORCEON_MCLKB | - RADEON_FORCEON_YCLKA | - RADEON_FORCEON_YCLKB | - RADEON_FORCEON_MC | - RADEON_FORCEON_AIC ) ); - - rbbm_soft_reset = RADEON_READ( RADEON_RBBM_SOFT_RESET ); - - RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset | - RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB ) ); - RADEON_READ( RADEON_RBBM_SOFT_RESET ); - RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset & - ~( RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB ) ) ); - RADEON_READ( RADEON_RBBM_SOFT_RESET ); - - - RADEON_WRITE_PLL( RADEON_MCLK_CNTL, mclk_cntl ); - RADEON_WRITE( RADEON_CLOCK_CNTL_INDEX, clock_cntl_index ); - RADEON_WRITE( RADEON_RBBM_SOFT_RESET, rbbm_soft_reset ); - - /* Reset the CP ring */ - radeon_do_cp_reset( dev_priv ); - - /* The CP is no longer running after an engine reset */ - dev_priv->cp_running = 0; - - /* Reset any pending vertex, indirect buffers */ - radeon_freelist_reset( dev ); - - return 0; -} - -static void radeon_cp_init_ring_buffer( drm_device_t *dev, - drm_radeon_private_t *dev_priv ) -{ - u32 ring_start, cur_read_ptr; - u32 tmp; - - /* Initialize the memory controller */ - RADEON_WRITE( RADEON_MC_FB_LOCATION, - (dev_priv->agp_vm_start - 1) & 0xffff0000 ); - - if ( !dev_priv->is_pci ) { - RADEON_WRITE( RADEON_MC_AGP_LOCATION, - (((dev_priv->agp_vm_start - 1 + - dev_priv->agp_size) & 0xffff0000) | - (dev_priv->agp_vm_start >> 16)) ); - } - -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - ring_start = (dev_priv->cp_ring->offset - - dev->agp->base - + dev_priv->agp_vm_start); - else -#endif - ring_start = (dev_priv->cp_ring->offset - - dev->sg->handle - + dev_priv->agp_vm_start); - - RADEON_WRITE( RADEON_CP_RB_BASE, ring_start ); - - /* Set the write pointer delay */ - RADEON_WRITE( RADEON_CP_RB_WPTR_DELAY, 0 ); - - /* Initialize the ring buffer's read and write pointers */ - cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); - RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); - *dev_priv->ring.head = cur_read_ptr; - dev_priv->ring.tail = cur_read_ptr; - -#if __REALLY_HAVE_SG - if ( !dev_priv->is_pci ) { -#endif - RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, - dev_priv->ring_rptr->offset ); -#if __REALLY_HAVE_SG - } else { - drm_sg_mem_t *entry = dev->sg; - unsigned long tmp_ofs, page_ofs; - - tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; - page_ofs = tmp_ofs >> PAGE_SHIFT; - - RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, - entry->busaddr[page_ofs]); - DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", - entry->busaddr[page_ofs], - entry->handle + tmp_ofs ); - } -#endif - - /* Set ring buffer size */ - RADEON_WRITE( RADEON_CP_RB_CNTL, dev_priv->ring.size_l2qw ); - - radeon_do_wait_for_idle( dev_priv ); - - /* Turn on bus mastering */ - tmp = RADEON_READ( RADEON_BUS_CNTL ) & ~RADEON_BUS_MASTER_DIS; - RADEON_WRITE( RADEON_BUS_CNTL, tmp ); - - /* Sync everything up */ - RADEON_WRITE( RADEON_ISYNC_CNTL, - (RADEON_ISYNC_ANY2D_IDLE3D | - RADEON_ISYNC_ANY3D_IDLE2D | - RADEON_ISYNC_WAIT_IDLEGUI | - RADEON_ISYNC_CPSCRATCH_IDLEGUI) ); -} - -static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) -{ - drm_radeon_private_t *dev_priv; - drm_map_list_entry_t *listentry; - u32 tmp; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); - if ( dev_priv == NULL ) - DRM_OS_RETURN( ENOMEM ); - - memset( dev_priv, 0, sizeof(drm_radeon_private_t) ); - - dev_priv->is_pci = init->is_pci; - -#if !defined(PCIGART_ENABLED) - /* PCI support is not 100% working, so we disable it here. - */ - if ( dev_priv->is_pci ) { - DRM_ERROR( "PCI GART not yet supported for Radeon!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN( EINVAL ); - } -#endif - - if ( dev_priv->is_pci && !dev->sg ) { - DRM_ERROR( "PCI GART memory not allocated!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN( EINVAL ); - } - - dev_priv->usec_timeout = init->usec_timeout; - if ( dev_priv->usec_timeout < 1 || - dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) { - DRM_DEBUG( "TIMEOUT problem!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN( EINVAL ); - } - - dev_priv->cp_mode = init->cp_mode; - - /* Simple idle check. - */ - atomic_set( &dev_priv->idle_count, 0 ); - - /* We don't support anything other than bus-mastering ring mode, - * but the ring can be in either AGP or PCI space for the ring - * read pointer. - */ - if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) && - ( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) { - DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN( EINVAL ); - } - - switch ( init->fb_bpp ) { - case 16: - dev_priv->color_fmt = RADEON_COLOR_FORMAT_RGB565; - break; - case 32: - default: - dev_priv->color_fmt = RADEON_COLOR_FORMAT_ARGB8888; - break; - } - dev_priv->front_offset = init->front_offset; - dev_priv->front_pitch = init->front_pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->back_pitch = init->back_pitch; - - switch ( init->depth_bpp ) { - case 16: - dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; - break; - case 32: - default: - dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; - break; - } - dev_priv->depth_offset = init->depth_offset; - dev_priv->depth_pitch = init->depth_pitch; - - dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) | - (dev_priv->front_offset >> 10)); - dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) | - (dev_priv->back_offset >> 10)); - dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) | - (dev_priv->depth_offset >> 10)); - - /* Hardware state for depth clears. Remove this if/when we no - * longer clear the depth buffer with a 3D rectangle. Hard-code - * all values to prevent unwanted 3D state from slipping through - * and screwing with the clear operation. - */ - dev_priv->depth_clear.rb3d_cntl = (RADEON_PLANE_MASK_ENABLE | - RADEON_Z_ENABLE | - (dev_priv->color_fmt << 10) | - RADEON_ZBLOCK16); - - dev_priv->depth_clear.rb3d_zstencilcntl = (dev_priv->depth_fmt | - RADEON_Z_TEST_ALWAYS | - RADEON_STENCIL_TEST_ALWAYS | - RADEON_STENCIL_S_FAIL_KEEP | - RADEON_STENCIL_ZPASS_KEEP | - RADEON_STENCIL_ZFAIL_KEEP | - RADEON_Z_WRITE_ENABLE); - - dev_priv->depth_clear.se_cntl = (RADEON_FFACE_CULL_CW | - RADEON_BFACE_SOLID | - RADEON_FFACE_SOLID | - RADEON_FLAT_SHADE_VTX_LAST | - RADEON_DIFFUSE_SHADE_FLAT | - RADEON_ALPHA_SHADE_FLAT | - RADEON_SPECULAR_SHADE_FLAT | - RADEON_FOG_SHADE_FLAT | - RADEON_VTX_PIX_CENTER_OGL | - RADEON_ROUND_MODE_TRUNC | - RADEON_ROUND_PREC_8TH_PIX); - - TAILQ_FOREACH(listentry, dev->maplist, link) { - drm_map_t *map = listentry->map; - if (map->type == _DRM_SHM && - map->flags & _DRM_CONTAINS_LOCK) { - dev_priv->sarea = map; - break; - } - } - - if(!dev_priv->sarea) { - DRM_ERROR("could not find sarea!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR("could not find framebuffer!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - if(!dev_priv->mmio) { - DRM_ERROR("could not find mmio region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); - if(!dev_priv->cp_ring) { - DRM_ERROR("could not find cp ring region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - if(!dev_priv->ring_rptr) { - DRM_ERROR("could not find ring read pointer!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); - if(!dev_priv->buffers) { - DRM_ERROR("could not find dma buffer region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - - if ( !dev_priv->is_pci ) { - DRM_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); - if(!dev_priv->agp_textures) { - DRM_ERROR("could not find agp texture region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - } - - dev_priv->sarea_priv = - (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + - init->sarea_priv_offset); - - if ( !dev_priv->is_pci ) { - DRM_IOREMAP( dev_priv->cp_ring ); - DRM_IOREMAP( dev_priv->ring_rptr ); - DRM_IOREMAP( dev_priv->buffers ); - if(!dev_priv->cp_ring->handle || - !dev_priv->ring_rptr->handle || - !dev_priv->buffers->handle) { - DRM_ERROR("could not find ioremap agp regions!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(EINVAL); - } - } else { - dev_priv->cp_ring->handle = - (void *)dev_priv->cp_ring->offset; - dev_priv->ring_rptr->handle = - (void *)dev_priv->ring_rptr->offset; - dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; - - DRM_DEBUG( "dev_priv->cp_ring->handle %p\n", - dev_priv->cp_ring->handle ); - DRM_DEBUG( "dev_priv->ring_rptr->handle %p\n", - dev_priv->ring_rptr->handle ); - DRM_DEBUG( "dev_priv->buffers->handle %p\n", - dev_priv->buffers->handle ); - } - - - dev_priv->agp_size = init->agp_size; - dev_priv->agp_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ); -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - dev_priv->agp_buffers_offset = (dev_priv->buffers->offset - - dev->agp->base - + dev_priv->agp_vm_start); - else -#endif - dev_priv->agp_buffers_offset = (dev_priv->buffers->offset - - dev->sg->handle - + dev_priv->agp_vm_start); - - DRM_DEBUG( "dev_priv->agp_size %d\n", - dev_priv->agp_size ); - DRM_DEBUG( "dev_priv->agp_vm_start 0x%x\n", - dev_priv->agp_vm_start ); - DRM_DEBUG( "dev_priv->agp_buffers_offset 0x%lx\n", - dev_priv->agp_buffers_offset ); - - dev_priv->ring.head = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle); - - dev_priv->ring.start = (u32 *)dev_priv->cp_ring->handle; - dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle - + init->ring_size / sizeof(u32)); - dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); - - dev_priv->ring.tail_mask = - (dev_priv->ring.size / sizeof(u32)) - 1; - - dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; - -#if 0 - /* Initialize the scratch register pointer. This will cause - * the scratch register values to be written out to memory - * whenever they are updated. - * FIXME: This doesn't quite work yet, so we're disabling it - * for the release. - */ - RADEON_WRITE( RADEON_SCRATCH_ADDR, (dev_priv->ring_rptr->offset + - RADEON_SCRATCH_REG_OFFSET) ); - RADEON_WRITE( RADEON_SCRATCH_UMSK, 0x7 ); -#endif - - dev_priv->scratch = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle + - (RADEON_SCRATCH_REG_OFFSET / sizeof(u32))); - - dev_priv->sarea_priv->last_frame = 0; - RADEON_WRITE( RADEON_LAST_FRAME_REG, - dev_priv->sarea_priv->last_frame ); - - dev_priv->sarea_priv->last_dispatch = 0; - RADEON_WRITE( RADEON_LAST_DISPATCH_REG, - dev_priv->sarea_priv->last_dispatch ); - - dev_priv->sarea_priv->last_clear = 0; - RADEON_WRITE( RADEON_LAST_CLEAR_REG, - dev_priv->sarea_priv->last_clear ); - -#if __REALLY_HAVE_SG - if ( dev_priv->is_pci ) { - if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, - &dev_priv->bus_pci_gart)) { - DRM_ERROR( "failed to init PCI GART!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - DRM_OS_RETURN(ENOMEM); - } - /* Turn on PCI GART - */ - tmp = RADEON_READ( RADEON_AIC_CNTL ) - | RADEON_PCIGART_TRANSLATE_EN; - RADEON_WRITE( RADEON_AIC_CNTL, tmp ); - - /* set PCI GART page-table base address - */ - RADEON_WRITE( RADEON_AIC_PT_BASE, dev_priv->bus_pci_gart ); - - /* set address range for PCI address translate - */ - RADEON_WRITE( RADEON_AIC_LO_ADDR, dev_priv->agp_vm_start ); - RADEON_WRITE( RADEON_AIC_HI_ADDR, dev_priv->agp_vm_start - + dev_priv->agp_size - 1); - - /* Turn off AGP aperture -- is this required for PCIGART? - */ - RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0xffffffc0 ); /* ?? */ - RADEON_WRITE( RADEON_AGP_COMMAND, 0 ); /* clear AGP_COMMAND */ - } else { -#endif - /* Turn off PCI GART - */ - tmp = RADEON_READ( RADEON_AIC_CNTL ) - & ~RADEON_PCIGART_TRANSLATE_EN; - RADEON_WRITE( RADEON_AIC_CNTL, tmp ); -#if __REALLY_HAVE_SG - } -#endif - - radeon_cp_load_microcode( dev_priv ); - radeon_cp_init_ring_buffer( dev, dev_priv ); - -#if ROTATE_BUFS - dev_priv->last_buf = 0; -#endif - - dev->dev_private = (void *)dev_priv; - - radeon_do_engine_reset( dev ); - - return 0; -} - -int radeon_do_cleanup_cp( drm_device_t *dev ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev->dev_private ) { - drm_radeon_private_t *dev_priv = dev->dev_private; - -#if __REALLY_HAVE_SG - if ( !dev_priv->is_pci ) { -#endif - DRM_IOREMAPFREE( dev_priv->cp_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); -#if __REALLY_HAVE_SG - } else { - if (!DRM(ati_pcigart_cleanup)( dev, - dev_priv->phys_pci_gart, - dev_priv->bus_pci_gart )) - DRM_ERROR( "failed to cleanup PCI GART!\n" ); - } -#endif - - DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), - DRM_MEM_DRIVER ); - dev->dev_private = NULL; - } - - return 0; -} - -int radeon_cp_init( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_init_t init; - - DRM_OS_KRNFROMUSR( init, (drm_radeon_init_t *) data, sizeof(init) ); - - switch ( init.func ) { - case RADEON_INIT_CP: - return radeon_do_init_cp( dev, &init ); - case RADEON_CLEANUP_CP: - return radeon_do_cleanup_cp( dev ); - } - - DRM_OS_RETURN( EINVAL ); -} - -int radeon_cp_start( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( dev_priv->cp_running ) { - DRM_DEBUG( "%s while CP running\n", __FUNCTION__ ); - return 0; - } - if ( dev_priv->cp_mode == RADEON_CSQ_PRIDIS_INDDIS ) { - DRM_DEBUG( "%s called with bogus CP mode (%d)\n", - __FUNCTION__, dev_priv->cp_mode ); - return 0; - } - - radeon_do_cp_start( dev_priv ); - - return 0; -} - -/* Stop the CP. The engine must have been idled before calling this - * routine. - */ -int radeon_cp_stop( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_cp_stop_t stop; - int ret; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( stop, (drm_radeon_cp_stop_t *) data, sizeof(stop) ); - - /* Flush any pending CP commands. This ensures any outstanding - * commands are exectuted by the engine before we turn it off. - */ - if ( stop.flush ) { - radeon_do_cp_flush( dev_priv ); - } - - /* If we fail to make the engine go idle, we return an error - * code so that the DRM ioctl wrapper can try again. - */ - if ( stop.idle ) { - ret = radeon_do_cp_idle( dev_priv ); - if ( ret ) return ret; - } - - /* Finally, we can turn off the CP. If the engine isn't idle, - * we will get some dropped triangles as they won't be fully - * rendered before the CP is shut down. - */ - radeon_do_cp_stop( dev_priv ); - - /* Reset the engine */ - radeon_do_engine_reset( dev ); - - return 0; -} - -/* Just reset the CP ring. Called as part of an X Server engine reset. - */ -int radeon_cp_reset( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - radeon_do_cp_reset( dev_priv ); - - /* The CP is no longer running after an engine reset */ - dev_priv->cp_running = 0; - - return 0; -} - -int radeon_cp_idle( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - return radeon_do_cp_idle( dev_priv ); -} - -int radeon_engine_reset( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - return radeon_do_engine_reset( dev ); -} - - -/* ================================================================ - * Fullscreen mode - */ - -static int radeon_do_init_pageflip( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv->crtc_offset = RADEON_READ( RADEON_CRTC_OFFSET ); - dev_priv->crtc_offset_cntl = RADEON_READ( RADEON_CRTC_OFFSET_CNTL ); - - RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->front_offset ); - RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, - dev_priv->crtc_offset_cntl | - RADEON_CRTC_OFFSET_FLIP_CNTL ); - - dev_priv->page_flipping = 1; - dev_priv->current_page = 0; - - return 0; -} - -int radeon_do_cleanup_pageflip( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->crtc_offset ); - RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); - - dev_priv->page_flipping = 0; - dev_priv->current_page = 0; - - return 0; -} - -int radeon_fullscreen( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_fullscreen_t fs; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( fs, (drm_radeon_fullscreen_t *) data, - sizeof(fs) ); - - switch ( fs.func ) { - case RADEON_INIT_FULLSCREEN: - return radeon_do_init_pageflip( dev ); - case RADEON_CLEANUP_FULLSCREEN: - return radeon_do_cleanup_pageflip( dev ); - } - - DRM_OS_RETURN( EINVAL ); -} - - -/* ================================================================ - * Freelist management - */ -#define RADEON_BUFFER_USED 0xffffffff -#define RADEON_BUFFER_FREE 0 - -#if 0 -static int radeon_freelist_init( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_freelist_t *entry; - int i; - - dev_priv->head = DRM(alloc)( sizeof(drm_radeon_freelist_t), - DRM_MEM_DRIVER ); - if ( dev_priv->head == NULL ) - DRM_OS_RETURN( ENOMEM ); - - memset( dev_priv->head, 0, sizeof(drm_radeon_freelist_t) ); - dev_priv->head->age = RADEON_BUFFER_USED; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - - entry = DRM(alloc)( sizeof(drm_radeon_freelist_t), - DRM_MEM_DRIVER ); - if ( !entry ) DRM_OS_RETURN( ENOMEM ); - - entry->age = RADEON_BUFFER_FREE; - entry->buf = buf; - entry->prev = dev_priv->head; - entry->next = dev_priv->head->next; - if ( !entry->next ) - dev_priv->tail = entry; - - buf_priv->discard = 0; - buf_priv->dispatched = 0; - buf_priv->list_entry = entry; - - dev_priv->head->next = entry; - - if ( dev_priv->head->next ) - dev_priv->head->next->prev = entry; - } - - return 0; - -} -#endif - -drm_buf_t *radeon_freelist_get( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv; - drm_buf_t *buf; - int i, t; -#if ROTATE_BUFS - int start; -#endif - - /* FIXME: Optimize -- use freelist code */ - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pid == 0 ) { - DRM_DEBUG( " ret buf=%d last=%d pid=0\n", - buf->idx, dev_priv->last_buf ); - return buf; - } - DRM_DEBUG( " skipping buf=%d pid=%d\n", - buf->idx, buf->pid ); - } - -#if ROTATE_BUFS - if ( ++dev_priv->last_buf >= dma->buf_count ) - dev_priv->last_buf = 0; - start = dev_priv->last_buf; -#endif - for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { -#if 0 - /* FIXME: Disable this for now */ - u32 done_age = dev_priv->scratch[RADEON_LAST_DISPATCH]; -#else - u32 done_age = RADEON_READ( RADEON_LAST_DISPATCH_REG ); -#endif -#if ROTATE_BUFS - for ( i = start ; i < dma->buf_count ; i++ ) { -#else - for ( i = 0 ; i < dma->buf_count ; i++ ) { -#endif - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pending && buf_priv->age <= done_age ) { - /* The buffer has been processed, so it - * can now be used. - */ - buf->pending = 0; - DRM_DEBUG( " ret buf=%d last=%d age=%d done=%d\n", buf->idx, dev_priv->last_buf, buf_priv->age, done_age ); - return buf; - } - DRM_DEBUG( " skipping buf=%d age=%d done=%d\n", - buf->idx, buf_priv->age, - done_age ); -#if ROTATE_BUFS - start = 0; -#endif - } - DRM_OS_DELAY( 1 ); - } - - DRM_ERROR( "returning NULL!\n" ); - return NULL; -} - -void radeon_freelist_reset( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; -#if ROTATE_BUFS - drm_radeon_private_t *dev_priv = dev->dev_private; -#endif - int i; - -#if ROTATE_BUFS - dev_priv->last_buf = 0; -#endif - for ( i = 0 ; i < dma->buf_count ; i++ ) { - drm_buf_t *buf = dma->buflist[i]; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - buf_priv->age = 0; - } -} - - -/* ================================================================ - * CP command submission - */ - -int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) -{ - drm_radeon_ring_buffer_t *ring = &dev_priv->ring; - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - radeon_update_ring_snapshot( ring ); - if ( ring->space > n ) - return 0; - DRM_OS_DELAY( 1 ); - } - - /* FIXME: This return value is ignored in the BEGIN_RING macro! */ -#if RADEON_FIFO_DEBUG - radeon_status( dev_priv ); - DRM_ERROR( "failed!\n" ); -#endif - DRM_OS_RETURN( EBUSY ); -} - -static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d ) -{ - int i; - drm_buf_t *buf; - - for ( i = d->granted_count ; i < d->request_count ; i++ ) { - buf = radeon_freelist_get( dev ); - if ( !buf ) DRM_OS_RETURN( EAGAIN ); - - buf->pid = DRM_OS_CURRENTPID; - - if (DRM_OS_COPYTOUSR( &d->request_indices[i], &buf->idx, - sizeof(buf->idx) ) ) - DRM_OS_RETURN( EFAULT ); - if (DRM_OS_COPYTOUSR( &d->request_sizes[i], &buf->total, - sizeof(buf->total) ) ) - DRM_OS_RETURN( EFAULT ); - - d->granted_count++; - } - return 0; -} - -int radeon_cp_buffers( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_device_dma_t *dma = dev->dma; - int ret = 0; - drm_dma_t d; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) ); - - /* Please don't send us buffers. - */ - if ( d.send_count != 0 ) { - DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", - DRM_OS_CURRENTPID, d.send_count ); - DRM_OS_RETURN( EINVAL ); - } - - /* We'll send you buffers. - */ - if ( d.request_count < 0 || d.request_count > dma->buf_count ) { - DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", - DRM_OS_CURRENTPID, d.request_count, dma->buf_count ); - DRM_OS_RETURN( EINVAL ); - } - - d.granted_count = 0; - - if ( d.request_count ) { - ret = radeon_cp_get_buffers( dev, &d ); - } - - DRM_OS_KRNTOUSR( (drm_dma_t *) data, d, sizeof(d) ); - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c Thu Feb 27 12:32:26 2003 @@ -1,114 +0,0 @@ -/* radeon_drv.c -- ATI Radeon driver -*- linux-c -*- - * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - - - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> - -#include "radeon.h" -#include "drmP.h" -#include "radeon_drv.h" -#if __REALLY_HAVE_SG -#include "ati_pcigart.h" -#endif - -#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - -#define DRIVER_NAME "radeon" -#define DRIVER_DESC "ATI Radeon" -#define DRIVER_DATE "20010405" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 1 -#define DRIVER_PATCHLEVEL 1 - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x1002, 0x5144, 1, "ATI Radeon QD"}, - {0x1002, 0x5145, 1, "ATI Radeon QE"}, - {0x1002, 0x5146, 1, "ATI Radeon QF"}, - {0x1002, 0x5147, 1, "ATI Radeon QG"}, - {0x1002, 0x5159, 1, "ATI Radeon VE"}, - {0, 0, 0, NULL} -}; - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 }, - - -#if 0 -/* GH: Count data sent to card via ring or vertex/indirect buffers. - */ -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#endif - - -#include "drm_agpsupport.h" -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_vm.h" -#include "drm_sysctl.h" -#if __REALLY_HAVE_SG -#include "drm_scatter.h" -#endif - -DRIVER_MODULE(radeon, pci, radeon_driver, radeon_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h Thu Feb 27 12:32:26 2003 @@ -1,725 +0,0 @@ -/* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __RADEON_DRV_H__ -#define __RADEON_DRV_H__ - -typedef struct drm_radeon_freelist { - unsigned int age; - drm_buf_t *buf; - struct drm_radeon_freelist *next; - struct drm_radeon_freelist *prev; -} drm_radeon_freelist_t; - -typedef struct drm_radeon_ring_buffer { - u32 *start; - u32 *end; - int size; - int size_l2qw; - - volatile u32 *head; - u32 tail; - u32 tail_mask; - int space; - - int high_mark; -} drm_radeon_ring_buffer_t; - -typedef struct drm_radeon_depth_clear_t { - u32 rb3d_cntl; - u32 rb3d_zstencilcntl; - u32 se_cntl; -} drm_radeon_depth_clear_t; - -typedef struct drm_radeon_private { - drm_radeon_ring_buffer_t ring; - drm_radeon_sarea_t *sarea_priv; - - int agp_size; - u32 agp_vm_start; - unsigned long agp_buffers_offset; - - int cp_mode; - int cp_running; - - drm_radeon_freelist_t *head; - drm_radeon_freelist_t *tail; -/* FIXME: ROTATE_BUFS is a hask to cycle through bufs until freelist - code is used. Note this hides a problem with the scratch register - (used to keep track of last buffer completed) being written to before - the last buffer has actually completed rendering. */ -#define ROTATE_BUFS 1 -#if ROTATE_BUFS - int last_buf; -#endif - volatile u32 *scratch; - - int usec_timeout; - int is_pci; - unsigned long phys_pci_gart; -#if __REALLY_HAVE_SG - dma_addr_t bus_pci_gart; -#endif - - atomic_t idle_count; - - int page_flipping; - int current_page; - u32 crtc_offset; - u32 crtc_offset_cntl; - - u32 color_fmt; - unsigned int front_offset; - unsigned int front_pitch; - unsigned int back_offset; - unsigned int back_pitch; - - u32 depth_fmt; - unsigned int depth_offset; - unsigned int depth_pitch; - - u32 front_pitch_offset; - u32 back_pitch_offset; - u32 depth_pitch_offset; - - drm_radeon_depth_clear_t depth_clear; - - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *mmio; - drm_map_t *cp_ring; - drm_map_t *ring_rptr; - drm_map_t *buffers; - drm_map_t *agp_textures; -} drm_radeon_private_t; - -typedef struct drm_radeon_buf_priv { - u32 age; - int prim; - int discard; - int dispatched; - drm_radeon_freelist_t *list_entry; -} drm_radeon_buf_priv_t; - - /* radeon_cp.c */ -extern int radeon_cp_init( DRM_OS_IOCTL ); -extern int radeon_cp_start( DRM_OS_IOCTL ); -extern int radeon_cp_stop( DRM_OS_IOCTL ); -extern int radeon_cp_reset( DRM_OS_IOCTL ); -extern int radeon_cp_idle( DRM_OS_IOCTL ); -extern int radeon_engine_reset( DRM_OS_IOCTL ); -extern int radeon_fullscreen( DRM_OS_IOCTL ); -extern int radeon_cp_buffers( DRM_OS_IOCTL ); - -extern void radeon_freelist_reset( drm_device_t *dev ); -extern drm_buf_t *radeon_freelist_get( drm_device_t *dev ); - -extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ); - -static __inline__ void -radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring ) -{ - ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - -extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ); -extern int radeon_do_cleanup_cp( drm_device_t *dev ); -extern int radeon_do_cleanup_pageflip( drm_device_t *dev ); - - /* radeon_state.c */ -extern int radeon_cp_clear( DRM_OS_IOCTL ); -extern int radeon_cp_swap( DRM_OS_IOCTL ); -extern int radeon_cp_vertex( DRM_OS_IOCTL ); -extern int radeon_cp_indices( DRM_OS_IOCTL ); -extern int radeon_cp_texture( DRM_OS_IOCTL ); -extern int radeon_cp_stipple( DRM_OS_IOCTL ); -extern int radeon_cp_indirect( DRM_OS_IOCTL ); - -/* Register definitions, register access macros and drmAddMap constants - * for Radeon kernel driver. - */ - -#define RADEON_AGP_COMMAND 0x0f60 -#define RADEON_AUX_SCISSOR_CNTL 0x26f0 -# define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) -# define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) -# define RADEON_EXCLUSIVE_SCISSOR_2 (1 << 26) -# define RADEON_SCISSOR_0_ENABLE (1 << 28) -# define RADEON_SCISSOR_1_ENABLE (1 << 29) -# define RADEON_SCISSOR_2_ENABLE (1 << 30) - -#define RADEON_BUS_CNTL 0x0030 -# define RADEON_BUS_MASTER_DIS (1 << 6) - -#define RADEON_CLOCK_CNTL_DATA 0x000c -# define RADEON_PLL_WR_EN (1 << 7) -#define RADEON_CLOCK_CNTL_INDEX 0x0008 -#define RADEON_CONFIG_APER_SIZE 0x0108 -#define RADEON_CRTC_OFFSET 0x0224 -#define RADEON_CRTC_OFFSET_CNTL 0x0228 -# define RADEON_CRTC_TILE_EN (1 << 15) -# define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) - -#define RADEON_RB3D_COLORPITCH 0x1c48 -#define RADEON_RB3D_DEPTHCLEARVALUE 0x1c30 -#define RADEON_RB3D_DEPTHXY_OFFSET 0x1c60 - -#define RADEON_DP_GUI_MASTER_CNTL 0x146c -# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define RADEON_GMC_BRUSH_NONE (15 << 4) -# define RADEON_GMC_DST_16BPP (4 << 8) -# define RADEON_GMC_DST_24BPP (5 << 8) -# define RADEON_GMC_DST_32BPP (6 << 8) -# define RADEON_GMC_DST_DATATYPE_SHIFT 8 -# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) -# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define RADEON_GMC_WR_MSK_DIS (1 << 30) -# define RADEON_ROP3_S 0x00cc0000 -# define RADEON_ROP3_P 0x00f00000 -#define RADEON_DP_WRITE_MASK 0x16cc -#define RADEON_DST_PITCH_OFFSET 0x142c -#define RADEON_DST_PITCH_OFFSET_C 0x1c80 -# define RADEON_DST_TILE_LINEAR (0 << 30) -# define RADEON_DST_TILE_MACRO (1 << 30) -# define RADEON_DST_TILE_MICRO (2 << 30) -# define RADEON_DST_TILE_BOTH (3 << 30) - -#define RADEON_SCRATCH_REG0 0x15e0 -#define RADEON_SCRATCH_REG1 0x15e4 -#define RADEON_SCRATCH_REG2 0x15e8 -#define RADEON_SCRATCH_REG3 0x15ec -#define RADEON_SCRATCH_REG4 0x15f0 -#define RADEON_SCRATCH_REG5 0x15f4 -#define RADEON_SCRATCH_UMSK 0x0770 -#define RADEON_SCRATCH_ADDR 0x0774 - -#define RADEON_HOST_PATH_CNTL 0x0130 -# define RADEON_HDP_SOFT_RESET (1 << 26) -# define RADEON_HDP_WC_TIMEOUT_MASK (7 << 28) -# define RADEON_HDP_WC_TIMEOUT_28BCLK (7 << 28) - -#define RADEON_ISYNC_CNTL 0x1724 -# define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0) -# define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1) -# define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2) -# define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3) -# define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4) -# define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5) - -#define RADEON_MC_AGP_LOCATION 0x014c -#define RADEON_MC_FB_LOCATION 0x0148 -#define RADEON_MCLK_CNTL 0x0012 -# define RADEON_FORCEON_MCLKA (1 << 16) -# define RADEON_FORCEON_MCLKB (1 << 17) -# define RADEON_FORCEON_YCLKA (1 << 18) -# define RADEON_FORCEON_YCLKB (1 << 19) -# define RADEON_FORCEON_MC (1 << 20) -# define RADEON_FORCEON_AIC (1 << 21) - -#define RADEON_PP_BORDER_COLOR_0 0x1d40 -#define RADEON_PP_BORDER_COLOR_1 0x1d44 -#define RADEON_PP_BORDER_COLOR_2 0x1d48 -#define RADEON_PP_CNTL 0x1c38 -# define RADEON_SCISSOR_ENABLE (1 << 1) -#define RADEON_PP_LUM_MATRIX 0x1d00 -#define RADEON_PP_MISC 0x1c14 -#define RADEON_PP_ROT_MATRIX_0 0x1d58 -#define RADEON_PP_TXFILTER_0 0x1c54 -#define RADEON_PP_TXFILTER_1 0x1c6c -#define RADEON_PP_TXFILTER_2 0x1c84 - -#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c -# define RADEON_RB2D_DC_FLUSH (3 << 0) -# define RADEON_RB2D_DC_FREE (3 << 2) -# define RADEON_RB2D_DC_FLUSH_ALL 0xf -# define RADEON_RB2D_DC_BUSY (1 << 31) -#define RADEON_RB3D_CNTL 0x1c3c -# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) -# define RADEON_PLANE_MASK_ENABLE (1 << 1) -# define RADEON_DITHER_ENABLE (1 << 2) -# define RADEON_ROUND_ENABLE (1 << 3) -# define RADEON_SCALE_DITHER_ENABLE (1 << 4) -# define RADEON_DITHER_INIT (1 << 5) -# define RADEON_ROP_ENABLE (1 << 6) -# define RADEON_STENCIL_ENABLE (1 << 7) -# define RADEON_Z_ENABLE (1 << 8) -# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9) -# define RADEON_ZBLOCK8 (0 << 15) -# define RADEON_ZBLOCK16 (1 << 15) -#define RADEON_RB3D_DEPTHOFFSET 0x1c24 -#define RADEON_RB3D_PLANEMASK 0x1d84 -#define RADEON_RB3D_STENCILREFMASK 0x1d7c -#define RADEON_RB3D_ZCACHE_MODE 0x3250 -#define RADEON_RB3D_ZCACHE_CTLSTAT 0x3254 -# define RADEON_RB3D_ZC_FLUSH (1 << 0) -# define RADEON_RB3D_ZC_FREE (1 << 2) -# define RADEON_RB3D_ZC_FLUSH_ALL 0x5 -# define RADEON_RB3D_ZC_BUSY (1 << 31) -#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c -# define RADEON_Z_TEST_MASK (7 << 4) -# define RADEON_Z_TEST_ALWAYS (7 << 4) -# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) -# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16) -# define RADEON_STENCIL_ZPASS_KEEP (0 << 20) -# define RADEON_STENCIL_ZFAIL_KEEP (0 << 20) -# define RADEON_Z_WRITE_ENABLE (1 << 30) -#define RADEON_RBBM_SOFT_RESET 0x00f0 -# define RADEON_SOFT_RESET_CP (1 << 0) -# define RADEON_SOFT_RESET_HI (1 << 1) -# define RADEON_SOFT_RESET_SE (1 << 2) -# define RADEON_SOFT_RESET_RE (1 << 3) -# define RADEON_SOFT_RESET_PP (1 << 4) -# define RADEON_SOFT_RESET_E2 (1 << 5) -# define RADEON_SOFT_RESET_RB (1 << 6) -# define RADEON_SOFT_RESET_HDP (1 << 7) -#define RADEON_RBBM_STATUS 0x0e40 -# define RADEON_RBBM_FIFOCNT_MASK 0x007f -# define RADEON_RBBM_ACTIVE (1 << 31) -#define RADEON_RE_LINE_PATTERN 0x1cd0 -#define RADEON_RE_MISC 0x26c4 -#define RADEON_RE_TOP_LEFT 0x26c0 -#define RADEON_RE_WIDTH_HEIGHT 0x1c44 -#define RADEON_RE_STIPPLE_ADDR 0x1cc8 -#define RADEON_RE_STIPPLE_DATA 0x1ccc - -#define RADEON_SCISSOR_TL_0 0x1cd8 -#define RADEON_SCISSOR_BR_0 0x1cdc -#define RADEON_SCISSOR_TL_1 0x1ce0 -#define RADEON_SCISSOR_BR_1 0x1ce4 -#define RADEON_SCISSOR_TL_2 0x1ce8 -#define RADEON_SCISSOR_BR_2 0x1cec -#define RADEON_SE_COORD_FMT 0x1c50 -#define RADEON_SE_CNTL 0x1c4c -# define RADEON_FFACE_CULL_CW (0 << 0) -# define RADEON_BFACE_SOLID (3 << 1) -# define RADEON_FFACE_SOLID (3 << 3) -# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) -# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) -# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) -# define RADEON_ALPHA_SHADE_FLAT (1 << 10) -# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) -# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) -# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) -# define RADEON_FOG_SHADE_FLAT (1 << 14) -# define RADEON_FOG_SHADE_GOURAUD (2 << 14) -# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) -# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) -# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) -# define RADEON_ROUND_MODE_TRUNC (0 << 28) -# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) -#define RADEON_SE_CNTL_STATUS 0x2140 -#define RADEON_SE_LINE_WIDTH 0x1db8 -#define RADEON_SE_VPORT_XSCALE 0x1d98 -#define RADEON_SURFACE_ACCESS_FLAGS 0x0bf8 -#define RADEON_SURFACE_ACCESS_CLR 0x0bfc -#define RADEON_SURFACE_CNTL 0x0b00 -# define RADEON_SURF_TRANSLATION_DIS (1 << 8) -# define RADEON_NONSURF_AP0_SWP_MASK (3 << 20) -# define RADEON_NONSURF_AP0_SWP_LITTLE (0 << 20) -# define RADEON_NONSURF_AP0_SWP_BIG16 (1 << 20) -# define RADEON_NONSURF_AP0_SWP_BIG32 (2 << 20) -# define RADEON_NONSURF_AP1_SWP_MASK (3 << 22) -# define RADEON_NONSURF_AP1_SWP_LITTLE (0 << 22) -# define RADEON_NONSURF_AP1_SWP_BIG16 (1 << 22) -# define RADEON_NONSURF_AP1_SWP_BIG32 (2 << 22) -#define RADEON_SURFACE0_INFO 0x0b0c -# define RADEON_SURF_PITCHSEL_MASK (0x1ff << 0) -# define RADEON_SURF_TILE_MODE_MASK (3 << 16) -# define RADEON_SURF_TILE_MODE_MACRO (0 << 16) -# define RADEON_SURF_TILE_MODE_MICRO (1 << 16) -# define RADEON_SURF_TILE_MODE_32BIT_Z (2 << 16) -# define RADEON_SURF_TILE_MODE_16BIT_Z (3 << 16) -#define RADEON_SURFACE0_LOWER_BOUND 0x0b04 -#define RADEON_SURFACE0_UPPER_BOUND 0x0b08 -#define RADEON_SURFACE1_INFO 0x0b1c -#define RADEON_SURFACE1_LOWER_BOUND 0x0b14 -#define RADEON_SURFACE1_UPPER_BOUND 0x0b18 -#define RADEON_SURFACE2_INFO 0x0b2c -#define RADEON_SURFACE2_LOWER_BOUND 0x0b24 -#define RADEON_SURFACE2_UPPER_BOUND 0x0b28 -#define RADEON_SURFACE3_INFO 0x0b3c -#define RADEON_SURFACE3_LOWER_BOUND 0x0b34 -#define RADEON_SURFACE3_UPPER_BOUND 0x0b38 -#define RADEON_SURFACE4_INFO 0x0b4c -#define RADEON_SURFACE4_LOWER_BOUND 0x0b44 -#define RADEON_SURFACE4_UPPER_BOUND 0x0b48 -#define RADEON_SURFACE5_INFO 0x0b5c -#define RADEON_SURFACE5_LOWER_BOUND 0x0b54 -#define RADEON_SURFACE5_UPPER_BOUND 0x0b58 -#define RADEON_SURFACE6_INFO 0x0b6c -#define RADEON_SURFACE6_LOWER_BOUND 0x0b64 -#define RADEON_SURFACE6_UPPER_BOUND 0x0b68 -#define RADEON_SURFACE7_INFO 0x0b7c -#define RADEON_SURFACE7_LOWER_BOUND 0x0b74 -#define RADEON_SURFACE7_UPPER_BOUND 0x0b78 -#define RADEON_SW_SEMAPHORE 0x013c - -#define RADEON_WAIT_UNTIL 0x1720 -# define RADEON_WAIT_CRTC_PFLIP (1 << 0) -# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) -# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) -# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) - -#define RADEON_RB3D_ZMASKOFFSET 0x1c34 -#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c -# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) -# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) - - -/* CP registers */ -#define RADEON_CP_ME_RAM_ADDR 0x07d4 -#define RADEON_CP_ME_RAM_RADDR 0x07d8 -#define RADEON_CP_ME_RAM_DATAH 0x07dc -#define RADEON_CP_ME_RAM_DATAL 0x07e0 - -#define RADEON_CP_RB_BASE 0x0700 -#define RADEON_CP_RB_CNTL 0x0704 -#define RADEON_CP_RB_RPTR_ADDR 0x070c -#define RADEON_CP_RB_RPTR 0x0710 -#define RADEON_CP_RB_WPTR 0x0714 - -#define RADEON_CP_RB_WPTR_DELAY 0x0718 -# define RADEON_PRE_WRITE_TIMER_SHIFT 0 -# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 - -#define RADEON_CP_IB_BASE 0x0738 - -#define RADEON_CP_CSQ_CNTL 0x0740 -# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) -# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) -# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) -# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) -# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) -# define RADEON_CSQ_PRIBM_INDBM (4 << 28) -# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) - -#define RADEON_AIC_CNTL 0x01d0 -# define RADEON_PCIGART_TRANSLATE_EN (1 << 0) -#define RADEON_AIC_STAT 0x01d4 -#define RADEON_AIC_PT_BASE 0x01d8 -#define RADEON_AIC_LO_ADDR 0x01dc -#define RADEON_AIC_HI_ADDR 0x01e0 -#define RADEON_AIC_TLB_ADDR 0x01e4 -#define RADEON_AIC_TLB_DATA 0x01e8 - -/* CP command packets */ -#define RADEON_CP_PACKET0 0x00000000 -# define RADEON_ONE_REG_WR (1 << 15) -#define RADEON_CP_PACKET1 0x40000000 -#define RADEON_CP_PACKET2 0x80000000 -#define RADEON_CP_PACKET3 0xC0000000 -# define RADEON_3D_RNDR_GEN_INDX_PRIM 0x00002300 -# define RADEON_WAIT_FOR_IDLE 0x00002600 -# define RADEON_3D_DRAW_IMMD 0x00002900 -# define RADEON_3D_CLEAR_ZMASK 0x00003200 -# define RADEON_CNTL_HOSTDATA_BLT 0x00009400 -# define RADEON_CNTL_PAINT_MULTI 0x00009A00 -# define RADEON_CNTL_BITBLT_MULTI 0x00009B00 - -#define RADEON_CP_PACKET_MASK 0xC0000000 -#define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 -#define RADEON_CP_PACKET0_REG_MASK 0x000007ff -#define RADEON_CP_PACKET1_REG0_MASK 0x000007ff -#define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 - -#define RADEON_VTX_Z_PRESENT (1 << 31) - -#define RADEON_PRIM_TYPE_NONE (0 << 0) -#define RADEON_PRIM_TYPE_POINT (1 << 0) -#define RADEON_PRIM_TYPE_LINE (2 << 0) -#define RADEON_PRIM_TYPE_LINE_STRIP (3 << 0) -#define RADEON_PRIM_TYPE_TRI_LIST (4 << 0) -#define RADEON_PRIM_TYPE_TRI_FAN (5 << 0) -#define RADEON_PRIM_TYPE_TRI_STRIP (6 << 0) -#define RADEON_PRIM_TYPE_TRI_TYPE2 (7 << 0) -#define RADEON_PRIM_TYPE_RECT_LIST (8 << 0) -#define RADEON_PRIM_TYPE_3VRT_POINT_LIST (9 << 0) -#define RADEON_PRIM_TYPE_3VRT_LINE_LIST (10 << 0) -#define RADEON_PRIM_WALK_IND (1 << 4) -#define RADEON_PRIM_WALK_LIST (2 << 4) -#define RADEON_PRIM_WALK_RING (3 << 4) -#define RADEON_COLOR_ORDER_BGRA (0 << 6) -#define RADEON_COLOR_ORDER_RGBA (1 << 6) -#define RADEON_MAOS_ENABLE (1 << 7) -#define RADEON_VTX_FMT_R128_MODE (0 << 8) -#define RADEON_VTX_FMT_RADEON_MODE (1 << 8) -#define RADEON_NUM_VERTICES_SHIFT 16 - -#define RADEON_COLOR_FORMAT_CI8 2 -#define RADEON_COLOR_FORMAT_ARGB1555 3 -#define RADEON_COLOR_FORMAT_RGB565 4 -#define RADEON_COLOR_FORMAT_ARGB8888 6 -#define RADEON_COLOR_FORMAT_RGB332 7 -#define RADEON_COLOR_FORMAT_RGB8 9 -#define RADEON_COLOR_FORMAT_ARGB4444 15 - -#define RADEON_TXFORMAT_I8 0 -#define RADEON_TXFORMAT_AI88 1 -#define RADEON_TXFORMAT_RGB332 2 -#define RADEON_TXFORMAT_ARGB1555 3 -#define RADEON_TXFORMAT_RGB565 4 -#define RADEON_TXFORMAT_ARGB4444 5 -#define RADEON_TXFORMAT_ARGB8888 6 -#define RADEON_TXFORMAT_RGBA8888 7 - -/* Constants */ -#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ - -#define RADEON_LAST_FRAME_REG RADEON_SCRATCH_REG0 -#define RADEON_LAST_DISPATCH_REG RADEON_SCRATCH_REG1 -#define RADEON_LAST_CLEAR_REG RADEON_SCRATCH_REG2 -#define RADEON_LAST_DISPATCH 1 - -#define RADEON_MAX_VB_AGE 0x7fffffff -#define RADEON_MAX_VB_VERTS (0xffff) - -#define RADEON_RING_HIGH_MARK 128 - - -#define RADEON_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) -#define RADEON_ADDR(reg) (RADEON_BASE( reg ) + reg) - -#define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg ) -#ifdef __alpha__ -#define RADEON_READ(reg) (_RADEON_READ((u32 *)RADEON_ADDR( reg ))) -static inline u32 _RADEON_READ(u32 *addr) -{ - DRM_OS_READMEMORYBARRIER; - return *(volatile u32 *)addr; -} -#define RADEON_WRITE(reg,val) \ -do { \ - DRM_OS_WRITEMEMORYBARRIER; \ - RADEON_DEREF(reg) = val; \ -} while (0) -#else -#define RADEON_READ(reg) RADEON_DEREF( reg ) -#define RADEON_WRITE(reg, val) do { RADEON_DEREF( reg ) = val; } while (0) -#endif - -#define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg ) -#ifdef __alpha__ -#define RADEON_READ8(reg) _RADEON_READ8((u8 *)RADEON_ADDR( reg )) -static inline u8 _RADEON_READ8(u8 *addr) -{ - DRM_OS_READMEMORYBARRIER; - return *(volatile u8 *)addr; -} -#define RADEON_WRITE8(reg,val) \ -do { \ - DRM_OS_WRITEMEMORYBARRIER; \ - RADEON_DEREF8( reg ) = val; \ -} while (0) -#else -#define RADEON_READ8(reg) RADEON_DEREF8( reg ) -#define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0) -#endif - -#define RADEON_WRITE_PLL( addr, val ) \ -do { \ - RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ - ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ - RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ -} while (0) - -extern int RADEON_READ_PLL( drm_device_t *dev, int addr ); - - -#define CP_PACKET0( reg, n ) \ - (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) -#define CP_PACKET0_TABLE( reg, n ) \ - (RADEON_CP_PACKET0 | RADEON_ONE_REG_WR | ((n) << 16) | ((reg) >> 2)) -#define CP_PACKET1( reg0, reg1 ) \ - (RADEON_CP_PACKET1 | (((reg1) >> 2) << 15) | ((reg0) >> 2)) -#define CP_PACKET2() \ - (RADEON_CP_PACKET2) -#define CP_PACKET3( pkt, n ) \ - (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) - - -/* ================================================================ - * Engine control helper macros - */ - -#define RADEON_WAIT_UNTIL_2D_IDLE() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ -} while (0) - -#define RADEON_WAIT_UNTIL_3D_IDLE() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ -} while (0) - -#define RADEON_WAIT_UNTIL_IDLE() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ - RADEON_WAIT_3D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ -} while (0) - -#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \ -} while (0) - -#define RADEON_FLUSH_CACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB2D_DC_FLUSH ); \ -} while (0) - -#define RADEON_PURGE_CACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ -} while (0) - -#define RADEON_FLUSH_ZCACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB3D_ZC_FLUSH ); \ -} while (0) - -#define RADEON_PURGE_ZCACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \ -} while (0) - - -/* ================================================================ - * Misc helper macros - */ - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != DRM_OS_CURRENTPID ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - DRM_OS_RETURN( EINVAL ); \ - } \ -} while (0) - -#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \ - if ( ring->space < ring->high_mark ) { \ - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - radeon_update_ring_snapshot( ring ); \ - if ( ring->space >= ring->high_mark ) \ - goto __ring_space_done; \ - DRM_OS_DELAY( 1 ); \ - } \ - DRM_ERROR( "ring space check failed!\n" ); \ - DRM_OS_RETURN( EBUSY ); \ - } \ - __ring_space_done: \ -} while (0) - -#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \ - if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ - int __ret = radeon_do_cp_idle( dev_priv ); \ - if ( __ret ) return __ret; \ - sarea_priv->last_dispatch = 0; \ - radeon_freelist_reset( dev ); \ - } \ -} while (0) - -#define RADEON_DISPATCH_AGE( age ) do { \ - OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \ - OUT_RING( age ); \ -} while (0) - -#define RADEON_FRAME_AGE( age ) do { \ - OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \ - OUT_RING( age ); \ -} while (0) - -#define RADEON_CLEAR_AGE( age ) do { \ - OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \ - OUT_RING( age ); \ -} while (0) - - -/* ================================================================ - * Ring control - */ - -#define radeon_flush_write_combine() DRM_OS_READMEMORYBARRIER - - -#define RADEON_VERBOSE 0 - -#define RING_LOCALS int write; unsigned int mask; volatile u32 *ring; - -#define BEGIN_RING( n ) do { \ - if ( RADEON_VERBOSE ) { \ - DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ - n, __FUNCTION__ ); \ - } \ - if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ - radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \ - } \ - dev_priv->ring.space -= (n) * sizeof(u32); \ - ring = dev_priv->ring.start; \ - write = dev_priv->ring.tail; \ - mask = dev_priv->ring.tail_mask; \ -} while (0) - -#define ADVANCE_RING() do { \ - if ( RADEON_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ - write, dev_priv->ring.tail ); \ - } \ - radeon_flush_write_combine(); \ - dev_priv->ring.tail = write; \ - RADEON_WRITE( RADEON_CP_RB_WPTR, write ); \ -} while (0) - -#define OUT_RING( x ) do { \ - if ( RADEON_VERBOSE ) { \ - DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ - (unsigned int)(x), write ); \ - } \ - ring[write++] = (x); \ - write &= mask; \ -} while (0) - -#define RADEON_PERFORMANCE_BOXES 0 - -#endif /* __RADEON_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c Thu Feb 27 12:32:26 2003 @@ -1,1461 +0,0 @@ -/* radeon_state.c -- State support for Radeon -*- linux-c -*- - * - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - */ - -#include "radeon.h" -#include "drmP.h" -#include "radeon_drv.h" -#include "drm.h" - - -/* ================================================================ - * CP hardware state programming functions - */ - -static __inline__ void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv, - drm_clip_rect_t *box ) -{ - RING_LOCALS; - - DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n", - box->x1, box->y1, box->x2, box->y2 ); - - BEGIN_RING( 4 ); - - OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) ); - OUT_RING( (box->y1 << 16) | box->x1 ); - - OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) ); - OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_context( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 14 ); - - OUT_RING( CP_PACKET0( RADEON_PP_MISC, 6 ) ); - OUT_RING( ctx->pp_misc ); - OUT_RING( ctx->pp_fog_color ); - OUT_RING( ctx->re_solid_color ); - OUT_RING( ctx->rb3d_blendcntl ); - OUT_RING( ctx->rb3d_depthoffset ); - OUT_RING( ctx->rb3d_depthpitch ); - OUT_RING( ctx->rb3d_zstencilcntl ); - - OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 2 ) ); - OUT_RING( ctx->pp_cntl ); - OUT_RING( ctx->rb3d_cntl ); - OUT_RING( ctx->rb3d_coloroffset ); - - OUT_RING( CP_PACKET0( RADEON_RB3D_COLORPITCH, 0 ) ); - OUT_RING( ctx->rb3d_colorpitch ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_vertfmt( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CP_PACKET0( RADEON_SE_COORD_FMT, 0 ) ); - OUT_RING( ctx->se_coord_fmt ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_line( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 ); - - OUT_RING( CP_PACKET0( RADEON_RE_LINE_PATTERN, 1 ) ); - OUT_RING( ctx->re_line_pattern ); - OUT_RING( ctx->re_line_state ); - - OUT_RING( CP_PACKET0( RADEON_SE_LINE_WIDTH, 0 ) ); - OUT_RING( ctx->se_line_width ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_bumpmap( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 ); - - OUT_RING( CP_PACKET0( RADEON_PP_LUM_MATRIX, 0 ) ); - OUT_RING( ctx->pp_lum_matrix ); - - OUT_RING( CP_PACKET0( RADEON_PP_ROT_MATRIX_0, 1 ) ); - OUT_RING( ctx->pp_rot_matrix_0 ); - OUT_RING( ctx->pp_rot_matrix_1 ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_masks( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 4 ); - - OUT_RING( CP_PACKET0( RADEON_RB3D_STENCILREFMASK, 2 ) ); - OUT_RING( ctx->rb3d_stencilrefmask ); - OUT_RING( ctx->rb3d_ropcntl ); - OUT_RING( ctx->rb3d_planemask ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_viewport( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 7 ); - - OUT_RING( CP_PACKET0( RADEON_SE_VPORT_XSCALE, 5 ) ); - OUT_RING( ctx->se_vport_xscale ); - OUT_RING( ctx->se_vport_xoffset ); - OUT_RING( ctx->se_vport_yscale ); - OUT_RING( ctx->se_vport_yoffset ); - OUT_RING( ctx->se_vport_zscale ); - OUT_RING( ctx->se_vport_zoffset ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_setup( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 4 ); - - OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); - OUT_RING( ctx->se_cntl ); - OUT_RING( CP_PACKET0( RADEON_SE_CNTL_STATUS, 0 ) ); - OUT_RING( ctx->se_cntl_status ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_tcl( drm_radeon_private_t *dev_priv ) -{ -#ifdef TCL_ENABLE - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 29 ); - - OUT_RING( CP_PACKET0( RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED, 27 ) ); - OUT_RING( ctx->se_tcl_material_emmissive.red ); - OUT_RING( ctx->se_tcl_material_emmissive.green ); - OUT_RING( ctx->se_tcl_material_emmissive.blue ); - OUT_RING( ctx->se_tcl_material_emmissive.alpha ); - OUT_RING( ctx->se_tcl_material_ambient.red ); - OUT_RING( ctx->se_tcl_material_ambient.green ); - OUT_RING( ctx->se_tcl_material_ambient.blue ); - OUT_RING( ctx->se_tcl_material_ambient.alpha ); - OUT_RING( ctx->se_tcl_material_diffuse.red ); - OUT_RING( ctx->se_tcl_material_diffuse.green ); - OUT_RING( ctx->se_tcl_material_diffuse.blue ); - OUT_RING( ctx->se_tcl_material_diffuse.alpha ); - OUT_RING( ctx->se_tcl_material_specular.red ); - OUT_RING( ctx->se_tcl_material_specular.green ); - OUT_RING( ctx->se_tcl_material_specular.blue ); - OUT_RING( ctx->se_tcl_material_specular.alpha ); - OUT_RING( ctx->se_tcl_shininess ); - OUT_RING( ctx->se_tcl_output_vtx_fmt ); - OUT_RING( ctx->se_tcl_output_vtx_sel ); - OUT_RING( ctx->se_tcl_matrix_select_0 ); - OUT_RING( ctx->se_tcl_matrix_select_1 ); - OUT_RING( ctx->se_tcl_ucp_vert_blend_ctl ); - OUT_RING( ctx->se_tcl_texture_proc_ctl ); - OUT_RING( ctx->se_tcl_light_model_ctl ); - for ( i = 0 ; i < 4 ; i++ ) { - OUT_RING( ctx->se_tcl_per_light_ctl[i] ); - } - - ADVANCE_RING(); -#else - DRM_ERROR( "TCL not enabled!\n" ); -#endif -} - -static __inline__ void radeon_emit_misc( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CP_PACKET0( RADEON_RE_MISC, 0 ) ); - OUT_RING( ctx->re_misc ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_tex0( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[0]; - RING_LOCALS; - DRM_DEBUG( " %s: offset=0x%x\n", __FUNCTION__, tex->pp_txoffset ); - - BEGIN_RING( 9 ); - - OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) ); - OUT_RING( tex->pp_txfilter ); - OUT_RING( tex->pp_txformat ); - OUT_RING( tex->pp_txoffset ); - OUT_RING( tex->pp_txcblend ); - OUT_RING( tex->pp_txablend ); - OUT_RING( tex->pp_tfactor ); - - OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_0, 0 ) ); - OUT_RING( tex->pp_border_color ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_tex1( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[1]; - RING_LOCALS; - DRM_DEBUG( " %s: offset=0x%x\n", __FUNCTION__, tex->pp_txoffset ); - - BEGIN_RING( 9 ); - - OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) ); - OUT_RING( tex->pp_txfilter ); - OUT_RING( tex->pp_txformat ); - OUT_RING( tex->pp_txoffset ); - OUT_RING( tex->pp_txcblend ); - OUT_RING( tex->pp_txablend ); - OUT_RING( tex->pp_tfactor ); - - OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_1, 0 ) ); - OUT_RING( tex->pp_border_color ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_tex2( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[2]; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 9 ); - - OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) ); - OUT_RING( tex->pp_txfilter ); - OUT_RING( tex->pp_txformat ); - OUT_RING( tex->pp_txoffset ); - OUT_RING( tex->pp_txcblend ); - OUT_RING( tex->pp_txablend ); - OUT_RING( tex->pp_tfactor ); - - OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_2, 0 ) ); - OUT_RING( tex->pp_border_color ); - - ADVANCE_RING(); -} - -static __inline__ void radeon_emit_state( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); - - if ( dirty & RADEON_UPLOAD_CONTEXT ) { - radeon_emit_context( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_CONTEXT; - } - - if ( dirty & RADEON_UPLOAD_VERTFMT ) { - radeon_emit_vertfmt( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_VERTFMT; - } - - if ( dirty & RADEON_UPLOAD_LINE ) { - radeon_emit_line( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_LINE; - } - - if ( dirty & RADEON_UPLOAD_BUMPMAP ) { - radeon_emit_bumpmap( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_BUMPMAP; - } - - if ( dirty & RADEON_UPLOAD_MASKS ) { - radeon_emit_masks( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_MASKS; - } - - if ( dirty & RADEON_UPLOAD_VIEWPORT ) { - radeon_emit_viewport( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_VIEWPORT; - } - - if ( dirty & RADEON_UPLOAD_SETUP ) { - radeon_emit_setup( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_SETUP; - } - - if ( dirty & RADEON_UPLOAD_TCL ) { -#ifdef TCL_ENABLE - radeon_emit_tcl( dev_priv ); -#endif - sarea_priv->dirty &= ~RADEON_UPLOAD_TCL; - } - - if ( dirty & RADEON_UPLOAD_MISC ) { - radeon_emit_misc( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_MISC; - } - - if ( dirty & RADEON_UPLOAD_TEX0 ) { - radeon_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_TEX0; - } - - if ( dirty & RADEON_UPLOAD_TEX1 ) { - radeon_emit_tex1( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_TEX1; - } - - if ( dirty & RADEON_UPLOAD_TEX2 ) { -#if 0 - radeon_emit_tex2( dev_priv ); -#endif - sarea_priv->dirty &= ~RADEON_UPLOAD_TEX2; - } - - sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | - RADEON_UPLOAD_TEX1IMAGES | - RADEON_UPLOAD_TEX2IMAGES | - RADEON_REQUIRE_QUIESCENCE); -} - - -#if RADEON_PERFORMANCE_BOXES -/* ================================================================ - * Performance monitoring functions - */ - -static void radeon_clear_box( drm_radeon_private_t *dev_priv, - int x, int y, int w, int h, - int r, int g, int b ) -{ - u32 pitch, offset; - u32 color; - RING_LOCALS; - - switch ( dev_priv->color_fmt ) { - case RADEON_COLOR_FORMAT_RGB565: - color = (((r & 0xf8) << 8) | - ((g & 0xfc) << 3) | - ((b & 0xf8) >> 3)); - break; - case RADEON_COLOR_FORMAT_ARGB8888: - default: - color = (((0xff) << 24) | (r << 16) | (g << 8) | b); - break; - } - - offset = dev_priv->back_offset; - pitch = dev_priv->back_pitch >> 3; - - BEGIN_RING( 6 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_P | - RADEON_GMC_CLR_CMP_CNTL_DIS ); - - OUT_RING( (pitch << 22) | (offset >> 5) ); - OUT_RING( color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); -} - -static void radeon_cp_performance_boxes( drm_radeon_private_t *dev_priv ) -{ - if ( atomic_read( &dev_priv->idle_count ) == 0 ) { - radeon_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); - } else { - atomic_set( &dev_priv->idle_count, 0 ); - } -} - -#endif - - -/* ================================================================ - * CP command dispatch functions - */ - -static void radeon_print_dirty( const char *msg, unsigned int flags ) -{ - DRM_DEBUG( "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", - msg, - flags, - (flags & RADEON_UPLOAD_CONTEXT) ? "context, " : "", - (flags & RADEON_UPLOAD_VERTFMT) ? "vertfmt, " : "", - (flags & RADEON_UPLOAD_LINE) ? "line, " : "", - (flags & RADEON_UPLOAD_BUMPMAP) ? "bumpmap, " : "", - (flags & RADEON_UPLOAD_MASKS) ? "masks, " : "", - (flags & RADEON_UPLOAD_VIEWPORT) ? "viewport, " : "", - (flags & RADEON_UPLOAD_SETUP) ? "setup, " : "", - (flags & RADEON_UPLOAD_TCL) ? "tcl, " : "", - (flags & RADEON_UPLOAD_MISC) ? "misc, " : "", - (flags & RADEON_UPLOAD_TEX0) ? "tex0, " : "", - (flags & RADEON_UPLOAD_TEX1) ? "tex1, " : "", - (flags & RADEON_UPLOAD_TEX2) ? "tex2, " : "", - (flags & RADEON_UPLOAD_CLIPRECTS) ? "cliprects, " : "", - (flags & RADEON_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); -} - -static void radeon_cp_dispatch_clear( drm_device_t *dev, - drm_radeon_clear_t *clear, - drm_radeon_clear_rect_t *depth_boxes ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int flags = clear->flags; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { - unsigned int tmp = flags; - - flags &= ~(RADEON_FRONT | RADEON_BACK); - if ( tmp & RADEON_FRONT ) flags |= RADEON_BACK; - if ( tmp & RADEON_BACK ) flags |= RADEON_FRONT; - } - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", - x, y, w, h, flags ); - - if ( flags & (RADEON_FRONT | RADEON_BACK) ) { - BEGIN_RING( 4 ); - - /* Ensure the 3D stream is idle before doing a - * 2D fill to clear the front or back buffer. - */ - RADEON_WAIT_UNTIL_3D_IDLE(); - - OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) ); - OUT_RING( clear->color_mask ); - - ADVANCE_RING(); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_MASKS); - } - - if ( flags & RADEON_FRONT ) { - BEGIN_RING( 6 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_P | - RADEON_GMC_CLR_CMP_CNTL_DIS ); - - OUT_RING( dev_priv->front_pitch_offset ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - if ( flags & RADEON_BACK ) { - BEGIN_RING( 6 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_P | - RADEON_GMC_CLR_CMP_CNTL_DIS ); - - OUT_RING( dev_priv->back_pitch_offset ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - - } - - if ( flags & RADEON_DEPTH ) { - drm_radeon_depth_clear_t *depth_clear = - &dev_priv->depth_clear; - - if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv ); - } - - /* FIXME: Render a rectangle to clear the depth - * buffer. So much for those "fast Z clears"... - */ - BEGIN_RING( 23 ); - - RADEON_WAIT_UNTIL_2D_IDLE(); - - OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 1 ) ); - OUT_RING( 0x00000000 ); - OUT_RING( depth_clear->rb3d_cntl ); - OUT_RING( CP_PACKET0( RADEON_RB3D_ZSTENCILCNTL, 0 ) ); - OUT_RING( depth_clear->rb3d_zstencilcntl ); - OUT_RING( CP_PACKET0( RADEON_RB3D_PLANEMASK, 0 ) ); - OUT_RING( 0x00000000 ); - OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); - OUT_RING( depth_clear->se_cntl ); - - OUT_RING( CP_PACKET3( RADEON_3D_DRAW_IMMD, 10 ) ); - OUT_RING( RADEON_VTX_Z_PRESENT ); - OUT_RING( (RADEON_PRIM_TYPE_RECT_LIST | - RADEON_PRIM_WALK_RING | - RADEON_MAOS_ENABLE | - RADEON_VTX_FMT_RADEON_MODE | - (3 << RADEON_NUM_VERTICES_SHIFT)) ); - - OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); - OUT_RING( depth_boxes[i].ui[CLEAR_Y1] ); - OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - - OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); - OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); - OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - - OUT_RING( depth_boxes[i].ui[CLEAR_X2] ); - OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); - OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - - ADVANCE_RING(); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_SETUP | - RADEON_UPLOAD_MASKS); - } - } - - /* Increment the clear counter. The client-side 3D driver must - * wait on this value before performing the clear ioctl. We - * need this because the card's so damned fast... - */ - dev_priv->sarea_priv->last_clear++; - - BEGIN_RING( 4 ); - - RADEON_CLEAR_AGE( dev_priv->sarea_priv->last_clear ); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); -} - -static void radeon_cp_dispatch_swap( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - -#if RADEON_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - radeon_cp_performance_boxes( dev_priv ); -#endif - - /* Wait for the 3D stream to idle before dispatching the bitblt. - * This will prevent data corruption between the two streams. - */ - BEGIN_RING( 2 ); - - RADEON_WAIT_UNTIL_3D_IDLE(); - - ADVANCE_RING(); - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - DRM_DEBUG( "dispatch swap %d,%d-%d,%d\n", - x, y, w, h ); - - BEGIN_RING( 7 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( RADEON_GMC_SRC_PITCH_OFFSET_CNTL | - RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_NONE | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_S | - RADEON_DP_SRC_SOURCE_MEMORY | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->back_pitch_offset ); - OUT_RING( dev_priv->front_pitch_offset ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 4 ); - - RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); - RADEON_WAIT_UNTIL_2D_IDLE(); - - ADVANCE_RING(); -} - -static void radeon_cp_dispatch_flip( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - -#if RADEON_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - radeon_cp_performance_boxes( dev_priv ); -#endif - - BEGIN_RING( 6 ); - - RADEON_WAIT_UNTIL_3D_IDLE(); - RADEON_WAIT_UNTIL_PAGE_FLIPPED(); - - OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET, 0 ) ); - - if ( dev_priv->current_page == 0 ) { - OUT_RING( dev_priv->back_offset ); - dev_priv->current_page = 1; - } else { - OUT_RING( dev_priv->front_offset ); - dev_priv->current_page = 0; - } - - ADVANCE_RING(); - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 2 ); - - RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); - - ADVANCE_RING(); -} - -static void radeon_cp_dispatch_vertex( drm_device_t *dev, - drm_buf_t *buf ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = dev_priv->agp_buffers_offset + buf->offset; - int size = buf->used; - int prim = buf_priv->prim; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox ); - - if ( 0 ) - radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty ); - - if ( buf->used ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv ); - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - radeon_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - /* Emit the vertex buffer rendering commands */ - BEGIN_RING( 5 ); - - OUT_RING( CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, 3 ) ); - OUT_RING( offset ); - OUT_RING( size ); - OUT_RING( format ); - OUT_RING( prim | RADEON_PRIM_WALK_LIST | - RADEON_COLOR_ORDER_RGBA | - RADEON_VTX_FMT_RADEON_MODE | - (size << RADEON_NUM_VERTICES_SHIFT) ); - - ADVANCE_RING(); - - i++; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - RADEON_DISPATCH_AGE( buf_priv->age ); - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~RADEON_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - - -static void radeon_cp_dispatch_indirect( drm_device_t *dev, - drm_buf_t *buf, - int start, int end ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - RING_LOCALS; - DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", - buf->idx, start, end ); - - if ( start != end ) { - int offset = (dev_priv->agp_buffers_offset - + buf->offset + start); - int dwords = (end - start + 3) / sizeof(u32); - - /* Indirect buffer data must be an even number of - * dwords, so if we've been given an odd number we must - * pad the data with a Type-2 CP packet. - */ - if ( dwords & 1 ) { - u32 *data = (u32 *) - ((char *)dev_priv->buffers->handle - + buf->offset + start); - data[dwords++] = RADEON_CP_PACKET2; - } - - buf_priv->dispatched = 1; - - /* Fire off the indirect buffer */ - BEGIN_RING( 3 ); - - OUT_RING( CP_PACKET0( RADEON_CP_IB_BASE, 1 ) ); - OUT_RING( offset ); - OUT_RING( dwords ); - - ADVANCE_RING(); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the indirect buffer age */ - BEGIN_RING( 2 ); - RADEON_DISPATCH_AGE( buf_priv->age ); - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; -} - -static void radeon_cp_dispatch_indices( drm_device_t *dev, - drm_buf_t *buf, - int start, int end, - int count ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = dev_priv->agp_buffers_offset; - int prim = buf_priv->prim; - u32 *data; - int dwords; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - - if ( 0 ) - radeon_print_dirty( "dispatch_indices", sarea_priv->dirty ); - - if ( start != end ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv ); - } - - dwords = (end - start + 3) / sizeof(u32); - - data = (u32 *)((char *)dev_priv->buffers->handle - + buf->offset + start); - - data[0] = CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, dwords-2 ); - - data[1] = offset; - data[2] = RADEON_MAX_VB_VERTS; - data[3] = format; - data[4] = (prim | RADEON_PRIM_WALK_IND | - RADEON_COLOR_ORDER_RGBA | - RADEON_VTX_FMT_RADEON_MODE | - (count << RADEON_NUM_VERTICES_SHIFT) ); - - if ( count & 0x1 ) { - data[dwords-1] &= 0x0000ffff; - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - radeon_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - radeon_cp_dispatch_indirect( dev, buf, start, end ); - - i++; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - RADEON_DISPATCH_AGE( buf_priv->age ); - ADVANCE_RING(); - - buf->pending = 1; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~RADEON_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - -#define RADEON_MAX_TEXTURE_SIZE (RADEON_BUFFER_SIZE - 8 * sizeof(u32)) - -static int radeon_cp_dispatch_texture( drm_device_t *dev, - drm_radeon_texture_t *tex, - drm_radeon_tex_image_t *image, int pid ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - u32 format; - u32 *buffer; - const u8 *data; - int size, dwords, tex_width, blit_width; - u32 y, height; - int ret = 0, i; - RING_LOCALS; - - /* FIXME: Be smarter about this... - */ - buf = radeon_freelist_get( dev ); - if ( !buf ) DRM_OS_RETURN( EAGAIN ); - - DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", - tex->offset >> 10, tex->pitch, tex->format, - image->x, image->y, image->width, image->height ); - - buf_priv = buf->dev_private; - - /* The compiler won't optimize away a division by a variable, - * even if the only legal values are powers of two. Thus, we'll - * use a shift instead. - */ - switch ( tex->format ) { - case RADEON_TXFORMAT_ARGB8888: - case RADEON_TXFORMAT_RGBA8888: - format = RADEON_COLOR_FORMAT_ARGB8888; - tex_width = tex->width * 4; - blit_width = image->width * 4; - break; - case RADEON_TXFORMAT_AI88: - case RADEON_TXFORMAT_ARGB1555: - case RADEON_TXFORMAT_RGB565: - case RADEON_TXFORMAT_ARGB4444: - format = RADEON_COLOR_FORMAT_RGB565; - tex_width = tex->width * 2; - blit_width = image->width * 2; - break; - case RADEON_TXFORMAT_I8: - case RADEON_TXFORMAT_RGB332: - format = RADEON_COLOR_FORMAT_CI8; - tex_width = tex->width * 1; - blit_width = image->width * 1; - break; - default: - DRM_ERROR( "invalid texture format %d\n", tex->format ); - DRM_OS_RETURN( EINVAL ); - } - - DRM_DEBUG( " tex=%dx%d blit=%d\n", - tex_width, tex->height, blit_width ); - - /* Flush the pixel cache. This ensures no pixel data gets mixed - * up with the texture data from the host data blit, otherwise - * part of the texture image may be corrupted. - */ - BEGIN_RING( 4 ); - - RADEON_FLUSH_CACHE(); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); - - /* Make a copy of the parameters in case we have to update them - * for a multi-pass texture blit. - */ - y = image->y; - height = image->height; - data = image->data; - - size = height * blit_width; - - if ( size > RADEON_MAX_TEXTURE_SIZE ) { - /* Texture image is too large, do a multipass upload */ - ret = EAGAIN; - - /* Adjust the blit size to fit the indirect buffer */ - height = RADEON_MAX_TEXTURE_SIZE / blit_width; - size = height * blit_width; - - /* Update the input parameters for next time */ - image->y += height; - image->height -= height; - image->data = (const char *)image->data + size; - - if ( DRM_OS_COPYTOUSR( tex->image, image, sizeof(*image) ) ) { - DRM_ERROR( "EFAULT on tex->image\n" ); - DRM_OS_RETURN( EFAULT ); - } - } else if ( size < 4 ) { - size = 4; - } - - dwords = size / 4; - - /* Dispatch the indirect buffer. - */ - buffer = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); - - buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 ); - buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_NONE | - (format << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_S | - RADEON_DP_SRC_SOURCE_HOST_DATA | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_WR_MSK_DIS); - - buffer[2] = (tex->pitch << 22) | (tex->offset >> 10); - buffer[3] = 0xffffffff; - buffer[4] = 0xffffffff; - buffer[5] = (y << 16) | image->x; - buffer[6] = (height << 16) | image->width; - buffer[7] = dwords; - - buffer += 8; - - if ( tex_width >= 32 ) { - /* Texture image width is larger than the minimum, so we - * can upload it directly. - */ - if ( DRM_OS_COPYFROMUSR( buffer, data, dwords * sizeof(u32) ) ) { - DRM_ERROR( "EFAULT on data, %d dwords\n", dwords ); - DRM_OS_RETURN( EFAULT ); - } - } else { - /* Texture image width is less than the minimum, so we - * need to pad out each image scanline to the minimum - * width. - */ - for ( i = 0 ; i < tex->height ; i++ ) { - if ( DRM_OS_COPYFROMUSR( buffer, data, tex_width ) ) { - DRM_ERROR( "EFAULT on pad, %d bytes\n", - tex_width ); - DRM_OS_RETURN( EFAULT ); - } - buffer += 8; - data += tex_width; - } - } - - buf->pid = pid; - buf->used = (dwords + 8) * sizeof(u32); - buf_priv->discard = 1; - - radeon_cp_dispatch_indirect( dev, buf, 0, buf->used ); - - /* Flush the pixel cache after the blit completes. This ensures - * the texture data is written out to memory before rendering - * continues. - */ - BEGIN_RING( 4 ); - - RADEON_FLUSH_CACHE(); - RADEON_WAIT_UNTIL_2D_IDLE(); - - ADVANCE_RING(); - - DRM_OS_RETURN( ret ); -} - -static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - BEGIN_RING( 35 ); - - OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) ); - OUT_RING( 0x00000000 ); - - OUT_RING( CP_PACKET0_TABLE( RADEON_RE_STIPPLE_DATA, 31 ) ); - for ( i = 0 ; i < 32 ; i++ ) { - OUT_RING( stipple[i] ); - } - - ADVANCE_RING(); -} - - -/* ================================================================ - * IOCTL functions - */ - -int radeon_cp_clear( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_clear_t clear; - drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( clear, (drm_radeon_clear_t *) data, - sizeof(clear) ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; - - if ( DRM_OS_COPYFROMUSR( &depth_boxes, clear.depth_boxes, - sarea_priv->nbox * sizeof(depth_boxes[0]) ) ) - DRM_OS_RETURN( EFAULT ); - - radeon_cp_dispatch_clear( dev, &clear, depth_boxes ); - - return 0; -} - -int radeon_cp_swap( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; - - if ( !dev_priv->page_flipping ) { - radeon_cp_dispatch_swap( dev ); - dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_MASKS); - } else { - radeon_cp_dispatch_flip( dev ); - } - - return 0; -} - -int radeon_cp_vertex( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_vertex_t vertex; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - DRM_OS_KRNFROMUSR( vertex, (drm_radeon_vertex_t *) data, - sizeof(vertex) ); - - DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", - __FUNCTION__, DRM_OS_CURRENTPID, - vertex.idx, vertex.count, vertex.discard ); - - if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - vertex.idx, dma->buf_count - 1 ); - DRM_OS_RETURN( EINVAL ); - } - if ( vertex.prim < 0 || - vertex.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { - DRM_ERROR( "buffer prim %d\n", vertex.prim ); - DRM_OS_RETURN( EINVAL ); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[vertex.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != DRM_OS_CURRENTPID ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN( EINVAL ); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); - DRM_OS_RETURN( EINVAL ); - } - - buf->used = vertex.count; - buf_priv->prim = vertex.prim; - buf_priv->discard = vertex.discard; - - radeon_cp_dispatch_vertex( dev, buf ); - - return 0; -} - -int radeon_cp_indices( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_indices_t elts; - int count; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - DRM_OS_KRNFROMUSR( elts, (drm_radeon_indices_t *) data, - sizeof(elts) ); - - DRM_DEBUG( "%s: pid=%d index=%d start=%d end=%d discard=%d\n", - __FUNCTION__, DRM_OS_CURRENTPID, - elts.idx, elts.start, elts.end, elts.discard ); - - if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - elts.idx, dma->buf_count - 1 ); - DRM_OS_RETURN( EINVAL ); - } - if ( elts.prim < 0 || - elts.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { - DRM_ERROR( "buffer prim %d\n", elts.prim ); - DRM_OS_RETURN( EINVAL ); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[elts.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != DRM_OS_CURRENTPID ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN( EINVAL ); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", elts.idx ); - DRM_OS_RETURN( EINVAL ); - } - - count = (elts.end - elts.start) / sizeof(u16); - elts.start -= RADEON_INDEX_PRIM_OFFSET; - - if ( elts.start & 0x7 ) { - DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); - DRM_OS_RETURN( EINVAL ); - } - if ( elts.start < buf->used ) { - DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); - DRM_OS_RETURN( EINVAL ); - } - - buf->used = elts.end; - buf_priv->prim = elts.prim; - buf_priv->discard = elts.discard; - - radeon_cp_dispatch_indices( dev, buf, elts.start, elts.end, count ); - - return 0; -} - -int radeon_cp_texture( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_texture_t tex; - drm_radeon_tex_image_t image; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( tex, (drm_radeon_texture_t *) data, sizeof(tex) ); - - if ( tex.image == NULL ) { - DRM_ERROR( "null texture image!\n" ); - DRM_OS_RETURN( EINVAL ); - } - - if ( DRM_OS_COPYFROMUSR( &image, - (drm_radeon_tex_image_t *)tex.image, - sizeof(image) ) ) - DRM_OS_RETURN( EFAULT ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - return radeon_cp_dispatch_texture( dev, &tex, &image, DRM_OS_CURRENTPID ); -} - -int radeon_cp_stipple( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_stipple_t stipple; - u32 mask[32]; - - LOCK_TEST_WITH_RETURN( dev ); - - DRM_OS_KRNFROMUSR( stipple, (drm_radeon_stipple_t *) data, - sizeof(stipple) ); - - if ( DRM_OS_COPYFROMUSR( &mask, stipple.mask, 32 * sizeof(u32) ) ) - DRM_OS_RETURN( EFAULT ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - radeon_cp_dispatch_stipple( dev, mask ); - - return 0; -} - -int radeon_cp_indirect( DRM_OS_IOCTL ) -{ - DRM_OS_DEVICE; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_indirect_t indirect; - RING_LOCALS; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - DRM_OS_RETURN( EINVAL ); - } - - DRM_OS_KRNFROMUSR( indirect, (drm_radeon_indirect_t *) data, - sizeof(indirect) ); - - DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", - indirect.idx, indirect.start, - indirect.end, indirect.discard ); - - if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - indirect.idx, dma->buf_count - 1 ); - DRM_OS_RETURN( EINVAL ); - } - - buf = dma->buflist[indirect.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != DRM_OS_CURRENTPID ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - DRM_OS_CURRENTPID, buf->pid ); - DRM_OS_RETURN( EINVAL ); - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); - DRM_OS_RETURN( EINVAL ); - } - - if ( indirect.start < buf->used ) { - DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", - indirect.start, buf->used ); - DRM_OS_RETURN( EINVAL ); - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf->used = indirect.end; - buf_priv->discard = indirect.discard; - - /* Wait for the 3D stream to idle before the indirect buffer - * containing 2D acceleration commands is processed. - */ - BEGIN_RING( 2 ); - - RADEON_WAIT_UNTIL_3D_IDLE(); - - ADVANCE_RING(); - - /* Dispatch the indirect buffer full of commands from the - * X server. This is insecure and is thus only available to - * privileged clients. - */ - radeon_cp_dispatch_indirect( dev, buf, indirect.start, indirect.end ); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile Thu Feb 27 12:32:26 2003 @@ -1,25 +0,0 @@ -# $FreeBSD$ - -KMOD= sis -NOMAN= YES -SRCS= sis_drv.c sis_ds.c sis_mm.c -SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h -CFLAGS+= ${DEBUG_FLAGS} -I. -I.. - -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine - -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#SIS_OPTS= "\#define DRM_LINUX" 1 -.endif - -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(SIS_OPTS) >> opt_drm_linux.h - -.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h Thu Feb 27 12:32:26 2003 @@ -1,45 +0,0 @@ -/* sis_drv.h -- Private header for sis driver -*- linux-c -*- - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h,v 1.1 2001/12/13 00:24:51 alanh Exp $ */ - -#ifndef __SIS_H__ -#define __SIS_H__ - - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -/* Buffer customization: - */ -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_sis_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h:1.1 Wed Dec 12 19:24:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h Thu Feb 27 12:32:27 2003 @@ -1,30 +0,0 @@ - -#ifndef _sis_drm_public_h_ -#define _sis_drm_public_h_ - -typedef struct { - int context; - unsigned int offset; - unsigned int size; - unsigned int free; -} drm_sis_mem_t; - -typedef struct { - unsigned int offset, size; -} drm_sis_agp_t; - -typedef struct { - unsigned int left, right; -} drm_sis_flip_t; - -#if defined(__KERNEL__) || defined(_KERNEL) - -int sis_fb_alloc(DRM_OS_IOCTL); -int sis_fb_free(DRM_OS_IOCTL); -int sisp_agp_init(DRM_OS_IOCTL); -int sisp_agp_alloc(DRM_OS_IOCTL); -int sisp_agp_free(DRM_OS_IOCTL); - -#endif - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c:1.1 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c Thu Feb 27 12:32:27 2003 @@ -1,90 +0,0 @@ -/* sis.c -- sis driver -*- linux-c -*- - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> - -#include "sis.h" -#include "drmP.h" -#include "sis_drm.h" -#include "sis_drv.h" - -#define DRIVER_AUTHOR "SIS" -#define DRIVER_NAME "sis" -#define DRIVER_DESC "SIS 300/630/540" -#define DRIVER_DATE "20010503" -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x1039, 0x0300, 1, "SIS 300"}, - {0x1039, 0x0540, 1, "SIS 540"}, - {0x1039, 0x0630, 1, "SIS 630"}, - {0, 0, 0, NULL} -}; - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 1 }, \ - [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 1 }, \ - /* AGP Memory Management */ \ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sisp_agp_init, 1, 1 }, \ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sisp_agp_alloc, 1, 1 }, \ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sisp_agp_free, 1, 1 } -#if 0 /* these don't appear to be defined */ - /* SIS Stereo */ - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 } -#endif - -#define __HAVE_COUNTERS 5 - -#include "drm_auth.h" -#include "drm_agpsupport.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lists.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_vm.h" -#include "drm_sysctl.h" - -DRIVER_MODULE(sis, pci, sis_driver, sis_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h:1.1 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h Thu Feb 27 12:32:27 2003 @@ -1,42 +0,0 @@ -/* sis_drv.h -- Private header for sis driver -*- linux-c -*- - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef _SIS_DRV_H_ -#define _SIS_DRV_H_ - -typedef struct drm_sis_private { - drm_map_t *buffers; -} drm_sis_private_t; - -/* Stereo ? - this was never committed */ - -int sis_flip( DRM_OS_IOCTL ); -int sis_flip_init( DRM_OS_IOCTL ); -int sis_flip_final( DRM_OS_IOCTL ); -void flip_final(void); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c:1.1 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c Thu Feb 27 12:32:27 2003 @@ -1,398 +0,0 @@ -/* sis_ds.c -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw - * - * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Sung-Ching Lin <sclin@sis.com.tw> - * - */ - - -#include "sis.h" -#include "drmP.h" -#include "sis_ds.h" - -/* Set Data Structure, not check repeated value - * temporarily used - */ - -set_t *setInit(void) -{ - int i; - set_t *set; - - set = (set_t *)SD_MALLOC(sizeof(set_t)); - for(i = 0; i < SET_SIZE; i++){ - set->list[i].free_next = i+1; - set->list[i].alloc_next = -1; - } - set->list[SET_SIZE-1].free_next = -1; - set->free = 0; - set->alloc = -1; - set->trace = -1; - - return set; -} - -int setAdd(set_t *set, ITEM_TYPE item) -{ - int free = set->free; - - if(free != -1){ - set->list[free].val = item; - set->free = set->list[free].free_next; - } - else{ - return 0; - } - - set->list[free].alloc_next = set->alloc; - set->alloc = free; - set->list[free].free_next = -1; - - return 1; -} - -int setDel(set_t *set, ITEM_TYPE item) -{ - int alloc = set->alloc; - int prev = -1; - - while(alloc != -1){ - if(set->list[alloc].val == item){ - if(prev != -1) - set->list[prev].alloc_next = set->list[alloc].alloc_next; - else - set->alloc = set->list[alloc].alloc_next; - break; - } - prev = alloc; - alloc = set->list[alloc].alloc_next; - } - - if(alloc == -1) - return 0; - - set->list[alloc].free_next = set->free; - set->free = alloc; - set->list[alloc].alloc_next = -1; - - return 1; -} - -/* setFirst -> setAdd -> setNext is wrong */ - -int setFirst(set_t *set, ITEM_TYPE *item) -{ - if(set->alloc == -1) - return 0; - - *item = set->list[set->alloc].val; - set->trace = set->list[set->alloc].alloc_next; - - return 1; -} - -int setNext(set_t *set, ITEM_TYPE *item) -{ - if(set->trace == -1) - return 0; - - *item = set->list[set->trace].val; - set->trace = set->list[set->trace].alloc_next; - - return 1; -} - -int setDestroy(set_t *set) -{ - SD_FREE(set); - - return 1; -} - -/* - * GLX Hardware Device Driver common code - * Copyright (C) 1999 Keith Whitwell - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#define ISFREE(bptr) ((bptr)->free) - -#define PRINTF(fmt, arg...) do{}while(0) -#define fprintf(fmt, arg...) do{}while(0) - -static void *calloc(size_t nmemb, size_t size) -{ - void *addr; - addr = SD_MALLOC(nmemb*size); - memset(addr, 0, nmemb*size); - return addr; -} - -void mmDumpMemInfo( memHeap_t *heap ) -{ - TMemBlock *p; - - PRINTF ("Memory heap %p:\n", heap); - if (heap == 0) { - PRINTF (" heap == 0\n"); - } else { - p = (TMemBlock *)heap; - while (p) { - PRINTF (" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size, - p->free ? '.':'U', - p->reserved ? 'R':'.'); - p = p->next; - } - } - PRINTF ("End of memory blocks\n"); -} - -memHeap_t *mmInit(int ofs, - int size) -{ - PMemBlock blocks; - - if (size <= 0) { - return 0; - } - blocks = (TMemBlock *) calloc(1,sizeof(TMemBlock)); - if (blocks) { - blocks->ofs = ofs; - blocks->size = size; - blocks->free = 1; - return (memHeap_t *)blocks; - } else - return 0; -} - -/* Kludgey workaround for existing i810 server. Remove soon. - */ -memHeap_t *mmAddRange( memHeap_t *heap, - int ofs, - int size ) -{ - PMemBlock blocks; - blocks = (TMemBlock *) calloc(2,sizeof(TMemBlock)); - if (blocks) { - blocks[0].size = size; - blocks[0].free = 1; - blocks[0].ofs = ofs; - blocks[0].next = &blocks[1]; - - /* Discontinuity - stops JoinBlock from trying to join non-adjacent - * ranges. - */ - blocks[1].size = 0; - blocks[1].free = 0; - blocks[1].ofs = ofs+size; - blocks[1].next = (PMemBlock) heap; - return (memHeap_t *)blocks; - } - else - return heap; -} - -static TMemBlock* SliceBlock(TMemBlock *p, - int startofs, int size, - int reserved, int alignment) -{ - TMemBlock *newblock; - - /* break left */ - if (startofs > p->ofs) { - newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock)); - newblock->ofs = startofs; - newblock->size = p->size - (startofs - p->ofs); - newblock->free = 1; - newblock->next = p->next; - p->size -= newblock->size; - p->next = newblock; - p = newblock; - } - - /* break right */ - if (size < p->size) { - newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock)); - newblock->ofs = startofs + size; - newblock->size = p->size - size; - newblock->free = 1; - newblock->next = p->next; - p->size = size; - p->next = newblock; - } - - /* p = middle block */ - p->align = alignment; - p->free = 0; - p->reserved = reserved; - return p; -} - -PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch) -{ - int mask,startofs,endofs; - TMemBlock *p; - - if (!heap || align2 < 0 || size <= 0) - return NULL; - mask = (1 << align2)-1; - startofs = 0; - p = (TMemBlock *)heap; - while (p) { - if (ISFREE(p)) { - startofs = (p->ofs + mask) & ~mask; - if ( startofs < startSearch ) { - startofs = startSearch; - } - endofs = startofs+size; - if (endofs <= (p->ofs+p->size)) - break; - } - p = p->next; - } - if (!p) - return NULL; - p = SliceBlock(p,startofs,size,0,mask+1); - p->heap = heap; - return p; -} - -static __inline__ int Join2Blocks(TMemBlock *p) -{ - if (p->free && p->next && p->next->free) { - TMemBlock *q = p->next; - p->size += q->size; - p->next = q->next; - SD_FREE(q); - return 1; - } - return 0; -} - -int mmFreeMem(PMemBlock b) -{ - TMemBlock *p,*prev; - - if (!b) - return 0; - if (!b->heap) { - fprintf(stderr, "no heap\n"); - return -1; - } - p = b->heap; - prev = NULL; - while (p && p != b) { - prev = p; - p = p->next; - } - if (!p || p->free || p->reserved) { - if (!p) - fprintf(stderr, "block not found in heap\n"); - else if (p->free) - fprintf(stderr, "block already free\n"); - else - fprintf(stderr, "block is reserved\n"); - return -1; - } - p->free = 1; - Join2Blocks(p); - if (prev) - Join2Blocks(prev); - return 0; -} - -int mmReserveMem(memHeap_t *heap, int offset,int size) -{ - int endofs; - TMemBlock *p; - - if (!heap || size <= 0) - return -1; - endofs = offset+size; - p = (TMemBlock *)heap; - while (p && p->ofs <= offset) { - if (ISFREE(p) && endofs <= (p->ofs+p->size)) { - SliceBlock(p,offset,size,1,1); - return 0; - } - p = p->next; - } - return -1; -} - -int mmFreeReserved(memHeap_t *heap, int offset) -{ - TMemBlock *p,*prev; - - if (!heap) - return -1; - p = (TMemBlock *)heap; - prev = NULL; - while (p && p->ofs != offset) { - prev = p; - p = p->next; - } - if (!p || !p->reserved) - return -1; - p->free = 1; - p->reserved = 0; - Join2Blocks(p); - if (prev) - Join2Blocks(prev); - return 0; -} - -void mmDestroy(memHeap_t *heap) -{ - TMemBlock *p,*q; - - if (!heap) - return; - p = (TMemBlock *)heap; - while (p) { - q = p->next; - SD_FREE(p); - p = q; - } -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h:1.1 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h Thu Feb 27 12:32:27 2003 @@ -1,163 +0,0 @@ -/* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw - * - * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Sung-Ching Lin <sclin@sis.com.tw> - * - */ - -#ifndef _sis_ds_h_ -#define _sis_ds_h_ - -/* Set Data Structure */ - -#define SET_SIZE 5000 -#define SD_MALLOC(s) malloc( s, DRM(M_DRM), M_NOWAIT ) -#define SD_FREE(s) free( s, DRM(M_DRM) ) - -typedef unsigned int ITEM_TYPE; - -typedef struct { - ITEM_TYPE val; - int alloc_next, free_next; -} list_item_t; - -typedef struct { - int alloc; - int free; - int trace; - list_item_t list[SET_SIZE]; -} set_t; - -set_t *setInit(void); -int setAdd(set_t *set, ITEM_TYPE item); -int setDel(set_t *set, ITEM_TYPE item); -int setFirst(set_t *set, ITEM_TYPE *item); -int setNext(set_t *set, ITEM_TYPE *item); -int setDestroy(set_t *set); - -#endif - -/* - * GLX Hardware Device Driver common code - * Copyright (C) 1999 Keith Whitwell - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef MM_INC -#define MM_INC - -struct mem_block_t { - struct mem_block_t *next; - struct mem_block_t *heap; - int ofs,size; - int align; - int free:1; - int reserved:1; -}; -typedef struct mem_block_t TMemBlock; -typedef struct mem_block_t *PMemBlock; - -/* a heap is just the first block in a chain */ -typedef struct mem_block_t memHeap_t; - -static __inline__ int mmBlockSize(PMemBlock b) -{ return b->size; } - -static __inline__ int mmOffset(PMemBlock b) -{ return b->ofs; } - -static __inline__ void mmMarkReserved(PMemBlock b) -{ b->reserved = 1; } - -/* - * input: total size in bytes - * return: a heap pointer if OK, NULL if error - */ -memHeap_t *mmInit( int ofs, int size ); - - - -memHeap_t *mmAddRange( memHeap_t *heap, - int ofs, - int size ); - - -/* - * Allocate 'size' bytes with 2^align2 bytes alignment, - * restrict the search to free memory after 'startSearch' - * depth and back buffers should be in different 4mb banks - * to get better page hits if possible - * input: size = size of block - * align2 = 2^align2 bytes alignment - * startSearch = linear offset from start of heap to begin search - * return: pointer to the allocated block, 0 if error - */ -PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch ); - -/* - * Free block starts at offset - * input: pointer to a block - * return: 0 if OK, -1 if error - */ -int mmFreeMem( PMemBlock b ); - -/* - * Reserve 'size' bytes block start at offset - * This is used to prevent allocation of memory already used - * by the X server for the front buffer, pixmaps, and cursor - * input: size, offset - * output: 0 if OK, -1 if error - */ -int mmReserveMem( memHeap_t *heap, int offset,int size ); -int mmFreeReserved( memHeap_t *heap, int offset ); - -/* - * destroy MM - */ -void mmDestroy( memHeap_t *mmInit ); - -/* For debuging purpose. */ -void mmDumpMemInfo( memHeap_t *mmInit ); - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c:1.1 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c Thu Feb 27 12:32:27 2003 @@ -1,300 +0,0 @@ -/* sis_mm.c -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw - * - * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Sung-Ching Lin <sclin@sis.com.tw> - * - */ - -#ifdef __linux -#define __NO_VERSION__ -#include <linux/sisfb.h> -#endif - -#include "sis.h" -#include "drmP.h" -#include "sis_drm.h" -#include "sis_drv.h" -#include "sis_ds.h" - -#define MAX_CONTEXT 100 -#define VIDEO_TYPE 0 -#define AGP_TYPE 1 - -typedef struct { - int used; - int context; - set_t *sets[2]; /* 0 for video, 1 for AGP */ -} sis_context_t; - -static sis_context_t global_ppriv[MAX_CONTEXT]; - -static int add_alloc_set(int context, int type, unsigned int val) -{ - int i, retval = 0; - - for(i = 0; i < MAX_CONTEXT; i++) - if(global_ppriv[i].used && global_ppriv[i].context == context){ - retval = setAdd(global_ppriv[i].sets[type], val); - break; - } - return retval; -} - -static int del_alloc_set(int context, int type, unsigned int val) -{ - int i, retval = 0; - for(i = 0; i < MAX_CONTEXT; i++) - if(global_ppriv[i].used && global_ppriv[i].context == context){ - retval = setDel(global_ppriv[i].sets[type], val); - break; - } - return retval; -} - -/* fb management via fb device */ -#if 1 -int sis_fb_alloc( DRM_OS_IOCTL ) -{ - drm_sis_mem_t fb; - struct sis_memreq req; - int retval = 0; - - DRM_OS_KRNFROMUSR( fb, (drm_sis_mem_t *) data, sizeof(fb) ); - - req.size = fb.size; - sis_malloc(&req); - if(req.offset){ - /* TODO */ - fb.offset = req.offset; - fb.free = req.offset; - if(!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)){ - DRM_DEBUG("adding to allocation set fails"); - sis_free(req.offset); - retval = -1; - } - } - else{ - fb.offset = 0; - fb.size = 0; - fb.free = 0; - } - - DRM_OS_KRNTOUSR( (drm_sis_mem_t *) data, fb, sizeof(fb) ); - - DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset); - - return retval; -} - -int sis_fb_free( DRM_OS_IOCTL ) -{ - drm_sis_mem_t fb; - int retval = 0; - - DRM_OS_KRNFROMUSR( fb, (drm_sis_mem_t *) data, sizeof(fb) ); - - if(!fb.free){ - return -1; - } - - sis_free(fb.free); - if(!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) - retval = -1; - - DRM_DEBUG("free fb, offset = %d\n", fb.free); - - return retval; -} - -#else - -int sis_fb_alloc( DRM_OS_IOCTL ) -{ - return -1; -} - -int sis_fb_free( DRM_OS_IOCTL ) -{ - return 0; -} - -#endif - -/* agp memory management */ -#if 1 - -static memHeap_t *AgpHeap = NULL; - -int sisp_agp_init( DRM_OS_IOCTL ) -{ - drm_sis_agp_t agp; - - DRM_OS_KRNFROMUSR( agp, (drm_sis_agp_t *) data, sizeof(agp) ); - - AgpHeap = mmInit(agp.offset, agp.size); - - DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size); - - return 0; -} - -int sisp_agp_alloc( DRM_OS_IOCTL ) -{ - drm_sis_mem_t agp; - PMemBlock block; - int retval = 0; - - if(!AgpHeap) - return -1; - - DRM_OS_KRNFROMUSR( agp, (drm_sis_mem_t *) data, sizeof(agp)); - - block = mmAllocMem(AgpHeap, agp.size, 0, 0); - if(block){ - /* TODO */ - agp.offset = block->ofs; - agp.free = (unsigned int)block; - if(!add_alloc_set(agp.context, AGP_TYPE, agp.free)){ - DRM_DEBUG("adding to allocation set fails"); - mmFreeMem((PMemBlock)agp.free); - retval = -1; - } - } - else{ - agp.offset = 0; - agp.size = 0; - agp.free = 0; - } - - DRM_OS_KRNTOUSR( (drm_sis_mem_t *) data, agp, sizeof(agp) ); - - DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset); - - return retval; -} - -int sisp_agp_free( DRM_OS_IOCTL ) -{ - drm_sis_mem_t agp; - int retval = 0; - - if(!AgpHeap) - return -1; - - DRM_OS_KRNFROMUSR( agp, (drm_sis_mem_t *) data, sizeof(agp)); - - if(!agp.free){ - return -1; - } - - mmFreeMem((PMemBlock)agp.free); - if(!del_alloc_set(agp.context, AGP_TYPE, agp.free)) - retval = -1; - - DRM_DEBUG("free agp, free = %d\n", agp.free); - - return retval; -} - -#endif - -int sis_init_context(int context) -{ - int i; - - for(i = 0; i < MAX_CONTEXT ; i++) - if(global_ppriv[i].used && (global_ppriv[i].context == context)) - break; - - if(i >= MAX_CONTEXT){ - for(i = 0; i < MAX_CONTEXT ; i++){ - if(!global_ppriv[i].used){ - global_ppriv[i].context = context; - global_ppriv[i].used = 1; - global_ppriv[i].sets[0] = setInit(); - global_ppriv[i].sets[1] = setInit(); - DRM_DEBUG("init allocation set, socket=%d, context = %d\n", - i, context); - break; - } - } - if((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) || - (global_ppriv[i].sets[1] == NULL)){ - return 0; - } - } - - return 1; -} - -int sis_final_context(int context) -{ - int i; - - for(i=0; i<MAX_CONTEXT; i++) - if(global_ppriv[i].used && (global_ppriv[i].context == context)) - break; - - if(i < MAX_CONTEXT){ - set_t *set; - unsigned int item; - int retval; - - DRM_DEBUG("find socket %d, context = %d\n", i, context); - - /* Video Memory */ - set = global_ppriv[i].sets[0]; - retval = setFirst(set, &item); - while(retval){ - DRM_DEBUG("free video memory 0x%x\n", item); -#if 0 - sis_free(item); -#endif - retval = setNext(set, &item); - } - setDestroy(set); - - /* AGP Memory */ - set = global_ppriv[i].sets[1]; - retval = setFirst(set, &item); - while(retval){ - DRM_DEBUG("free agp memory 0x%x\n", item); - mmFreeMem((PMemBlock)item); - retval = setNext(set, &item); - } - setDestroy(set); - - global_ppriv[i].used = 0; - } - - /* turn-off auto-flip */ - /* TODO */ -#if defined(SIS_STEREO) - flip_final(); -#endif - - return 1; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.3 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile Wed Oct 30 07:52:32 2002 @@ -1,25 +1,23 @@ # $FreeBSD$ +.PATH: ${.CURDIR}/.. KMOD= tdfx NOMAN= YES SRCS= tdfx_drv.c -SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h CFLAGS+= ${DEBUG_FLAGS} -I. -I.. -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine +.if defined(DRM_DEBUG) +DRM_DEBUG_OPT= "\#define DRM_DEBUG 1" +.endif -.if ${MACHINE_ARCH} == "i386" -# This line enables linux ioctl handling -# If you want support for this uncomment this line -#TDFX_OPTS= "\#define DRM_LINUX" 1 +.if !defined(DRM_NOLINUX) +DRM_LINUX_OPT= "\#define DRM_LINUX 1" .endif -opt_drm_linux.h: - touch opt_drm_linux.h - echo $(TDFX_OPTS) >> opt_drm_linux.h +opt_drm.h: + touch opt_drm.h + echo $(DRM_DEBUG_OPT) >> opt_drm.h + echo $(DRM_LINUX_OPT) >> opt_drm.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h:1.1 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h Thu Feb 27 12:32:27 2003 @@ -1,42 +0,0 @@ -/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __TDFX_H__ -#define __TDFX_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) tdfx_##x - -/* General customization: - */ -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.4 Wed Dec 12 19:24:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c Thu Feb 27 12:32:27 2003 @@ -1,100 +0,0 @@ -/* tdfx_drv.c -- tdfx driver -*- linux-c -*- - * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Daryll Strauss <daryll@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - - -#include <sys/types.h> -#include <sys/bus.h> -#include <pci/pcivar.h> -#include <opt_drm_linux.h> - -#include "tdfx.h" -#include "drmP.h" - -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "tdfx" -#define DRIVER_DESC "3dfx Banshee/Voodoo3+" -#define DRIVER_DATE "20010216" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#ifndef PCI_VENDOR_ID_3DFX -#define PCI_VENDOR_ID_3DFX 0x121A -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO5 -#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO4 -#define PCI_DEVICE_ID_3DFX_VOODOO4 0x0007 -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_3000 /* Voodoo3 3000 */ -#define PCI_DEVICE_ID_3DFX_VOODOO3_3000 0x0005 -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_2000 /* Voodoo3 3000 */ -#define PCI_DEVICE_ID_3DFX_VOODOO3_2000 0x0004 -#endif -#ifndef PCI_DEVICE_ID_3DFX_BANSHEE -#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 -#endif - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x121a, 0x0003, 1, "3dfx Voodoo Banshee"}, - {0x121a, 0x0004, 1, "3dfx Voodoo3 2000"}, - {0x121a, 0x0005, 1, "3dfx Voodoo3 3000"}, - {0x121a, 0x0007, 1, "3dfx Voodoo4"}, - {0x121a, 0x0009, 1, "3dfx Voodoo5"}, - {0, 0, 0, NULL} -}; - - -#include "drm_auth.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_drawable.h" -#include "drm_drv.h" - - -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_vm.h" -#include "drm_sysctl.h" - -DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile:3.13 xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile:3.15 --- xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile:3.13 Tue Aug 15 12:05:37 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile Wed Oct 16 22:22:45 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile,v 3.13 2000/08/15 16:05:37 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile,v 3.15 2002/10/17 02:22:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c:3.12 xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c:3.14 --- xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c:3.12 Sat Sep 4 09:04:43 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c Mon Feb 17 10:11:56 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c,v 3.12 1999/09/04 13:04:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c,v 3.14 2003/02/17 15:11:56 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -97,3 +97,10 @@ return(xf86Info.consoleFd); } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c:1.2 --- /dev/null Thu Feb 27 12:32:28 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c Fri Jan 10 17:05:45 2003 @@ -0,0 +1,451 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c,v 1.2 2003/01/10 22:05:45 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +/* + * This file contains the glue necessary for support of Intel's 460GX chipset. + */ + +#include "460gxPCI.h" +#include "xf86.h" +#include "Pci.h" + +/* 460GX register definitions */ +/* SAC at 0:10:0 */ +#define CBN 0x0040 +/* SAC at CBN:0:0 */ +#define DEVNPRES 0x0070 +/* SAC at CBN:1[0-7]:0 */ +#define BUSNO 0x0048 +#define SUBNO 0x0049 +#define VGASE 0x0080 +#define PCIS 0x0084 +#define IOR 0x008C +#define IORD 0x008E /* CBN:10:0 only */ +/* PXB at CBN:1[0-7]:1 */ +#define ERRCMD 0x0046 + +static int cbn_460gx = -1; +static CARD32 cbdevs_460gx = 0; +static CARD16 iord_460gx; +static int busno_460gx[8], subno_460gx[8]; +static CARD8 pcis_460gx[8], ior_460gx[8]; +static CARD8 has_err_460gx[8], err_460gx[8]; +static CARD8 iomap_460gx[16]; /* One for each 4k */ +static pciBusFuncs_t BusFuncs_460gx; + +static pciConfigPtr +Verify460GXBus(int bus) +{ + pciConfigPtr pPCI; + + if ((bus < 0) || (bus >= pciNumBuses) || + !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || + (pPCI->busnum != cbn_460gx) || (pPCI->funcnum != 0) || + (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17)) + return NULL; + + return pPCI; +} + +/* + * This function is called to emulate the various settings in a P2P or CardBus + * bridge's control register using one of a 460GX's SAC host bridges. + */ +static CARD16 +Control460GXBridge(int bus, CARD16 mask, CARD16 value) +{ + pciConfigPtr pPCI; + PCITAG tag; + CARD16 current = 0; + CARD8 tmp; + + if ((pPCI = Verify460GXBus(bus))) { + /* Start with VGA enablement */ + tmp = pciReadByte(pPCI->tag, VGASE); + if (tmp & 0x01) { + current |= PCI_PCI_BRIDGE_VGA_EN; + if ((mask & PCI_PCI_BRIDGE_VGA_EN) && + !(value & PCI_PCI_BRIDGE_VGA_EN)) + pciWriteByte(pPCI->tag, VGASE, tmp & ~0x01); + } else { + if (mask & value & PCI_PCI_BRIDGE_VGA_EN) + pciWriteByte(pPCI->tag, VGASE, tmp | 0x01); + } + + /* Move on to master abort failure enablement */ + if (has_err_460gx[pPCI->devnum - 0x10]) { + tag = PCI_MAKE_TAG(pPCI->busnum, pPCI->devnum, pPCI->funcnum + 1); + tmp = pciReadByte(tag, ERRCMD); + if (tmp & 0x01) { + current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN; + if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && + !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) + pciWriteByte(tag, ERRCMD, tmp & ~0x01); + } else { + if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) + pciWriteByte(tag, ERRCMD, tmp | 0x01); + } + } + + /* Put emulation of any other P2P bridge control here */ + } + + return (current & ~mask) | (value & mask); +} + +/* + * Retrieve various bus numbers representing the connections provided by 460GX + * host bridges. + */ +static void +Get460GXBridgeBusses(int bus, int *primary, int *secondary, int *subordinate) +{ + pciConfigPtr pPCI = Verify460GXBus(bus); + int i; + + /* The returned bus numbers are initialised by the caller */ + + if (!pPCI) + return; + + i = pPCI->devnum - 0x10; + + /* These are not modified, so no need to re-read them */ + if (primary) + *primary = pPCI->busnum; + if (secondary) + *secondary = busno_460gx[i]; + if (subordinate) + *subordinate = subno_460gx[i]; +} + +/* Retrieves a list of the resources routed to a host bridge's secondary bus */ +static void +Get460GXBridgeResources(int bus, + pointer *ppIoRes, + pointer *ppMemRes, + pointer *ppPmemRes) +{ + pciConfigPtr pPCI = Verify460GXBus(bus); + resRange range; + unsigned int i, j; + + if (ppIoRes) { + xf86FreeResList(*ppIoRes); + *ppIoRes = NULL; + + if (pPCI) { + for (i = 0; i <= 0x0F; i++) { + if (iomap_460gx[i] != pPCI->devnum) + continue; + + RANGE(range, i << 12, ((i + 1) << 12) - 1, + RANGE_TYPE(ResExcIoBlock, 0)); + *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); + } + } + } + + if (ppMemRes) { + xf86FreeResList(*ppMemRes); + *ppMemRes = NULL; + + if (pPCI) { + if (!(i = (pPCI->devnum - 0x10))) + j = 127; /* (4GB - 32M) / 32M */ + else + j = pcis_460gx[i - 1] & 0x7F; + + i = pcis_460gx[i] & 0x7F; + if (i < j) { + RANGE(range, i << 25, (j << 25) - 1, + RANGE_TYPE(ResExcMemBlock, 0)); + *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); + } + } + } + + if (ppPmemRes) { + xf86FreeResList(*ppPmemRes); + *ppPmemRes = NULL; + } +} + +/* + * This checks for, and validates, the presence of the 460GX chipset, and sets + * cbn_460gx to a positive value accordingly. This function returns TRUE if + * the chipset scan is to be stopped, or FALSE if the scan is to move on to the + * next chipset. + */ +Bool +xf86PreScan460GX(void) +{ + pciBusInfo_t *pBusInfo; + PCITAG tag; + CARD32 tmp; + int i, devno; + + /* Bus zero should already be set up */ + if (!(pBusInfo = pciBusInfo[0])) { + cbn_460gx = -1; + return FALSE; + } + + /* First look for a 460GX's primary host bridge */ + tag = PCI_MAKE_TAG(0, 0x10, 0); + if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 460GX_SAC)) { + cbn_460gx = -1; + return FALSE; + } + + /* Get CBN (Chipset bus number) */ + if (!(cbn_460gx = (unsigned int)pciReadByte(tag, CBN))) { + /* Sanity check failed */ + cbn_460gx = -1; + return TRUE; + } + + if (pciNumBuses <= cbn_460gx) + pciNumBuses = cbn_460gx + 1; + + /* Set up bus CBN */ + if (!pciBusInfo[cbn_460gx]) { + pciBusInfo[cbn_460gx] = xnfalloc(sizeof(pciBusInfo_t)); + *pciBusInfo[cbn_460gx] = *pBusInfo; + } + + tag = PCI_MAKE_TAG(cbn_460gx, 0, 0); + if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 460GX_SAC)) { + /* Sanity check failed */ + cbn_460gx = -1; + return TRUE; + } + + /* + * Find out which CBN devices the firmware thinks are present. Of these, + * we are only interested in devices 0x10 through 0x17. + */ + cbdevs_460gx = pciReadLong(tag, DEVNPRES); + + for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { + tag = PCI_MAKE_TAG(cbn_460gx, devno, 0); + if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 460GX_SAC)) { + /* Sanity check failed */ + cbn_460gx = -1; + return TRUE; + } + + if (devno == 0x10) + iord_460gx = pciReadWord(tag, IORD); + + busno_460gx[i] = (unsigned int)pciReadByte(tag, BUSNO); + subno_460gx[i] = (unsigned int)pciReadByte(tag, SUBNO); + pcis_460gx[i] = pciReadByte(tag, PCIS); + ior_460gx[i] = pciReadByte(tag, IOR); + + has_err_460gx[i] = err_460gx[i] = 0; /* Insurance */ + + tag = PCI_MAKE_TAG(cbn_460gx, devno, 1); + tmp = pciReadLong(tag, PCI_ID_REG); + switch (tmp) { + case DEVID(INTEL, 460GX_PXB): + case DEVID(INTEL, 460GX_WXB): + if (cbdevs_460gx & (1 << devno)) { + /* Sanity check failed */ + cbn_460gx = -1; + return TRUE; + } + + /* + * XXX I don't have WXB docs, but PCI register dumps indicate that + * the registers we are interested in are consistent with those of + * the PXB. + */ + err_460gx[i] = pciReadByte(tag, ERRCMD); + has_err_460gx[i] = 1; + break; + + case DEVID(INTEL, 460GX_GXB_1): + if (cbdevs_460gx & (1 << devno)) { + /* Sanity check failed */ + cbn_460gx = -1; + return TRUE; + } + + /* + * XXX GXB isn't documented to have an ERRCMD register, nor any + * other means of failing master aborts. For now, assume master + * aborts are always allowed to complete normally. + */ + break; + + default: + if (((CARD16)(tmp + 1U) <= (CARD16)1U) && + (cbdevs_460gx & (1U << devno))) + break; + /* Sanity check failed */ + cbn_460gx = -1; + return TRUE; + } + } + + /* Allow master aborts to complete normally */ + for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { + if (!(err_460gx[i] & 0x01)) + continue; + + pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1), + ERRCMD, err_460gx[i] & ~0x01); + } + + /* + * The 460GX spec says that any access to busses higher than CBN will be + * master-aborted. It seems possible however that this is not the case in + * all 460GX implementations. For now, limit the bus scan to CBN, unless + * we have already found a higher bus number. + */ + for (i = 0; subno_460gx[i] < cbn_460gx; ) { + if (++i < 8) + continue; + + pciMaxBusNum = cbn_460gx + 1; + break; + } + + return TRUE; +} + +/* This does some 460GX-related processing after the PCI bus scan */ +void +xf86PostScan460GX(void) +{ + pciConfigPtr pPCI, *ppPCI; + pciBusInfo_t *pBusInfo; + int i, j, devno; + + if (cbn_460gx <= 0) + return; + + /* Set up our extra bus functions */ + BusFuncs_460gx = *(pciBusInfo[0]->funcs); + BusFuncs_460gx.pciControlBridge = Control460GXBridge; + BusFuncs_460gx.pciGetBridgeBusses = Get460GXBridgeBusses; + BusFuncs_460gx.pciGetBridgeResources = Get460GXBridgeResources; + + /* + * Mark all host bridges so that they are ignored by the upper-level + * xf86GetPciBridgeInfo() function. This marking is later clobbered by the + * tail end of xf86scanpci() for those bridges that actually have bus + * segments associated with them. + */ + ppPCI = xf86scanpci(0); /* Recursion is only apparent */ + while ((pPCI = *ppPCI++)) { + if ((pPCI->pci_base_class == PCI_CLASS_BRIDGE) && + (pPCI->pci_sub_class == PCI_SUBCLASS_BRIDGE_HOST)) + pPCI->businfo = HOST_NO_BUS; + } + + ppPCI = xf86scanpci(0); /* Recursion is only apparent */ + j = 0; + + /* + * Fix up CBN bus linkage. This is somewhat arbitrary. The bridge chosen + * for this must be a CBN device so that bus CBN can be recognised as the + * root segment. It also cannot be any of the bus expanders (devices + * CBN:0x10:0 through CBN:0x17:0 nor any of their functions). For now, we + * chose the SAC host bridge at CBN:0:0. + */ + pBusInfo = pciBusInfo[cbn_460gx]; + pBusInfo->bridge = pciBusInfo[0]->bridge; /* Just in case */ + while ((pPCI = *ppPCI++)) { + if (pPCI->busnum < cbn_460gx) + continue; + if (pPCI->busnum > cbn_460gx) + break; + if (pPCI->devnum < 0) + continue; + if (pPCI->devnum > 0) + break; + if (pPCI->funcnum < 0) + continue; + if (pPCI->funcnum > 0) + break; + + pBusInfo->bridge = pPCI; + pBusInfo->secondary = FALSE; + pBusInfo->primary_bus = cbn_460gx; + break; + } + + for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { + /* Restore ERRCMD registers */ + if (err_460gx[i] & 0x01) + pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1), + ERRCMD, err_460gx[i]); + + if (!(cbdevs_460gx & (1 << devno))) { + while ((pPCI = *ppPCI++)) { + if (pPCI->busnum < cbn_460gx) + continue; + if (pPCI->busnum > cbn_460gx) + break; + if (pPCI->devnum < devno) + continue; + if (pPCI->devnum > devno) + break; + if (pPCI->funcnum < 0) + continue; + if (pPCI->funcnum > 0) + break; + + if ((pBusInfo = pciBusInfo[busno_460gx[i]])) + break; + + /* Fix bus linkage */ + pBusInfo->bridge = pPCI; + pBusInfo->secondary = TRUE; + pBusInfo->primary_bus = cbn_460gx; + + /* Plug in chipset routines */ + pBusInfo->funcs = &BusFuncs_460gx; + break; + } + } + + /* Decode IOR registers */ + for(; j <= (ior_460gx[i] & 0x0F); j++) + iomap_460gx[j] = devno; + } + + /* The bottom 4k of I/O space is always routed to PCI0a */ + iomap_460gx[0] = 0x10; + + /* Decode IORD register */ + for (j = 1; j <= 0x0F; j++) + if (iord_460gx & (1 << j)) + iomap_460gx[j] = 0x10; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h:1.1 --- /dev/null Thu Feb 27 12:32:28 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h Thu Jan 2 13:12:48 2003 @@ -0,0 +1,36 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h,v 1.1 2003/01/02 18:12:48 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +#ifndef PCI_460GX_H +#define PCI_460GX_H 1 + +#include <X11/Xdefs.h> + +Bool xf86PreScan460GX(void); +void xf86PostScan460GX(void); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.18 xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.30 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.18 Thu Nov 1 18:35:33 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile Sun Feb 23 15:26:49 2003 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.18 2001/11/01 23:35:33 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.30 2003/02/23 20:26:49 tsi Exp $ #include <Server.tmpl> @@ -14,11 +14,19 @@ PCIDRVRSRC = axpPci.c PCIDRVROBJ = axpPci.o -#elif (defined(LinuxArchitecture) || defined(SunArchitecture)) && \ - defined(SparcArchitecture) +#elif defined(LinuxArchitecture) && defined(SparcArchitecture) -XCOMM Sparc PCI driver +XCOMM Sparc SBUS driver and generic Linux PCI driver +PCIDRVRSRC = linuxPci.c +PCIDRVROBJ = linuxPci.o +SBUSDRVSRC = Sbus.c +SBUSDRVOBJ = Sbus.o + +#elif defined(SunArchitecture) && defined(SparcArchitecture) + +XCOMM Sparc SBUS & PCI drivers + PCIDRVRSRC = sparcPci.c PCIDRVROBJ = sparcPci.o SBUSDRVSRC = Sbus.c @@ -40,13 +48,23 @@ PCIDRVRSRC = linuxPci.c PCIDRVROBJ = linuxPci.o -#elif defined(OpenBSDArchitecture) && defined(PpcArchitecture) +#elif defined(OpenBSDArchitecture) && \ + (defined(PpcArchitecture) || \ + defined(AlphaArchitecture) || \ + defined(Sparc64Architecture)) -XCOMM OpenBSD/powerpc +XCOMM OpenBSD/alpha, OpenBSD/powerpc and OpenBSD/sparc64 PCIDRVRSRC = freebsdPci.c PCIDRVROBJ = freebsdPci.o +#elif defined(NetBSDArchitecture) && defined(PpcArchitecture) + +XCOMM NetBSD/powerpc + +PCIDRVRSRC = netbsdPci.c +PCIDRVROBJ = netbsdPci.o + #elif defined(PpcArchitecture) XCOMM PowerPC PCI drivers @@ -54,7 +72,8 @@ PCIDRVRSRC = ppcPci.c PCIDRVROBJ = ppcPci.o -#elif defined(LinuxArchitecture) && (defined(i386Architecture)) +#elif defined(LinuxArchitecture) && \ + (defined(i386Architecture) || defined(x86_64Architecture)) XCOMM ix86 PCI driver with OS fallback for Linux @@ -69,8 +88,17 @@ PCIDRVRSRC = freebsdPci.c PCIDRVROBJ = freebsdPci.o -#elif defined(i386Architecture) || defined(ia64Architecture) +#elif defined(NetBSDArchitecture) && defined(AlphaArchitecture) +XCOMM Alpha (NetBSD) PCI driver + +PCIDRVRSRC = netbsdPci.c +PCIDRVROBJ = netbsdPci.o + +#elif defined(i386Architecture) || \ + defined(ia64Architecture) || \ + defined(x86_64Architecture) + XCOMM ix86 PCI driver PCIDRVRSRC = ix86Pci.c @@ -82,8 +110,18 @@ XCOMM no PCI driver -- shouldn't get here #endif -SRCS = Pci.c $(PCIDRVRSRC) $(SBUSDRVSRC) -OBJS = Pci.o $(PCIDRVROBJ) $(SBUSDRVOBJ) +#if defined(SparcArchitecture) +# if !defined(SunArchitecture) +PCIARCHSRC = sparcPci.c +PCIARCHOBJ = sparcPci.o +# endif +#elif defined(ia64Architecture) +PCIARCHSRC = ia64Pci.c 460gxPCI.c e8870PCI.c zx1PCI.c +PCIARCHOBJ = ia64Pci.o 460gxPCI.o e8870PCI.o zx1PCI.o +#endif + +SRCS = Pci.c $(PCIDRVRSRC) $(SBUSDRVSRC) $(PCIARCHSRC) +OBJS = Pci.o $(PCIDRVROBJ) $(SBUSDRVOBJ) $(PCIARCHOBJ) INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) @@ -99,5 +137,12 @@ SpecialCObjectRule(Pci,NullParameter,-O0) #endif -DependTarget() +#if defined(SunArchitecture) && defined(SparcArchitecture) +LFS_DEFINES = `getconf LFS_CFLAGS` + +SpecialCObjectRule(sparcPci,NullParameter,$(LFS_DEFINES)) + +#endif + +DependTarget() Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.51 xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.71 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.51 Sat Oct 27 23:34:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c Thu Jan 23 11:22:13 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.51 2001/10/28 03:34:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.71 2003/01/23 16:22:13 tsi Exp $ */ /* * Pci.c - New server PCI access functions * @@ -8,33 +8,43 @@ * * All of the public PCI access functions exported to the other parts of * the server are declared in Pci.h and defined herein. These include: - * pciInit() - Initialize PCI access functions - * pciFindFirst() - Find a PCI device by dev/vend id - * pciFindNext() - Find another PCI device by dev/vend id - * pciReadLong() - Read a 32 bit value from a PCI devices cfg space - * pciReadWord() - Read a 16 bit value from a PCI devices cfg space - * pciReadByte() - Read an 8 bit value from a PCI devices cfg space - * pciWriteLong() - Write a 32 bit value to a PCI devices cfg space - * pciWriteWord() - Write a 16 bit value to a PCI devices cfg space - * pciWriteByte() - Write an 8 bit value to a PCI devices cfg space - * pciSetBitsLong() - Write a 32 bit value against a mask - * pciSetBitsByte() - Write an 8 bit value against a mask - * pciLongFunc() - Return pointer to the requested low level function - * pciTag() - Return tag for a given PCI bus, device, & function - * pciBusAddrToHostAddr() - Convert a PCI address to a host address - * pciHostAddrToBusAddr() - Convert a host address to a PCI address - * pciGetBaseSize - Returns the number of bits in a PCI base addr mapping - * xf86MapPciMem() - Like xf86MapVidMem() except function expects - * a PCI address and PCITAG (identifies PCI domain) - * xf86ReadPciBIOS() - Like xf86ReadBIOS, except that it handles PCI/host - * address translation and BIOS decode enabling. - * xf86scanpci() - Return info about all PCI devices - * + * pciInit() - Initialize PCI access functions + * pciFindFirst() - Find a PCI device by dev/vend id + * pciFindNext() - Find another PCI device by dev/vend id + * pciReadLong() - Read a 32 bit value from a device's cfg space + * pciReadWord() - Read a 16 bit value from a device's cfg space + * pciReadByte() - Read an 8 bit value from a device's cfg space + * pciWriteLong() - Write a 32 bit value to a device's cfg space + * pciWriteWord() - Write a 16 bit value to a device's cfg space + * pciWriteByte() - Write an 8 bit value to a device's cfg space + * pciSetBitsLong() - Write a 32 bit value against a mask + * pciSetBitsByte() - Write an 8 bit value against a mask + * pciLongFunc() - Return pointer to the requested low level + * function + * pciTag() - Return tag for a given PCI bus, device, & + * function + * pciBusAddrToHostAddr() - Convert a PCI address to a host address + * pciHostAddrToBusAddr() - Convert a host address to a PCI address + * pciGetBaseSize() - Returns the number of bits in a PCI base + * addr mapping + * xf86MapPciMem() - Like xf86MapVidMem() except function expects + * a PCI address and a PCITAG that identifies + * a PCI device + * xf86ReadPciBIOS() - Like xf86ReadBIOS() but can handle PCI/host + * address translation and BIOS decode enabling + * xf86scanpci() - Return info about all PCI devices + * xf86GetPciDomain() - Return domain number from a PCITAG + * xf86MapDomainMemory() - Like xf86MapPciMem() but can handle + * domain/host address translation + * xf86MapDomainIO() - Maps PCI I/O spaces + * xf86ReadDomainMemory() - Like xf86ReadPciBIOS() but can handle + * domain/host address translation + * * The actual PCI backend driver is selected by the pciInit() function * (see below) using either compile time definitions, run-time checks, * or both. * - * Certain generic functions are provided that make the implementation + * Certain generic functions are provided that make the implementation * of certain well behaved platforms (e.g. those supporting PCI config * mechanism 1 or some thing close to it) very easy. * @@ -44,11 +54,10 @@ * pciInit() below under the correct compile time definition or run-time * conditional. * - * * The fooPciInit() procedure must do three things: - * 1) Initialize the pciBusTable[] for all primary PCI buses including + * 1) Initialize the pciBusTable[] for all primary PCI buses including * the per domain PCI access functions (readLong, writeLong, - * addrBusToHost, and addrHostToBus). + * addrBusToHost, and addrHostToBus). * * 2) Add entries to pciBusTable[] for configured secondary buses. This * step may be skipped if a platform is using the generic findFirst/ @@ -56,9 +65,9 @@ * discover and add secondary buses dynamically. * * 3) Overide default settings for global PCI access functions if - * required. These include pciFindFirstFP, pciFindNextFP, - * Of course, if you choose not to use one of the generic - * functions, you will need to provide a platform specifc replacement. + * required. These include pciFindFirstFP, pciFindNextFP, + * Of course, if you choose not to use one of the generic + * functions, you will need to provide a platform specifc replacement. * * Gary Barton * Concurrent Computer Corporation @@ -79,7 +88,7 @@ * permission. Concurrent Computer Corporation makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. - * + * * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE @@ -88,7 +97,7 @@ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. - * + * * Copyright 1998 by Metro Link Incorporated * * Permission to use, copy, modify, distribute, and sell this software @@ -101,7 +110,7 @@ * permission. Metro Link Incorporated makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. - * + * * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE @@ -110,7 +119,7 @@ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. - * + * * This software is derived from the original XFree86 PCI code * which includes the following copyright notices as well: * @@ -121,18 +130,18 @@ * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * copyright holder(s) make(s) no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * This code is also based heavily on the code in FreeBSD-current, which was @@ -186,25 +195,18 @@ */ static int pciInitialized = 0; -CARD32 pciDevid; /* Requested device/vendor ID (after mask) */ +CARD32 pciDevid; /* Requested device/vendor ID (after mask) */ CARD32 pciDevidMask; /* Bit mask applied (AND) before comparison */ - /* of real devid's with requested */ + /* of real devid's with requested */ int pciBusNum; /* Bus Number of current device */ int pciDevNum; /* Device number of current device */ int pciFuncNum; /* Function number of current device */ PCITAG pciDeviceTag; /* Tag for current device */ -pciBusFuncs_t pciNOOPFuncs = { - pciReadLongNULL, - pciWriteLongNULL, - pciSetBitsLongNULL, - pciAddrNOOP, - pciAddrNOOP -}; - pciBusInfo_t *pciBusInfo[MAX_PCI_BUSES] = { NULL, }; int pciNumBuses = 0; /* Actual number of PCI buses */ +int pciMaxBusNum = MAX_PCI_BUSES; static Bool inProbe = FALSE; static pciConfigPtr pci_devp[MAX_PCI_DEVICES + 1] = {NULL, }; @@ -236,15 +238,12 @@ #endif ARCH_PCI_INIT(); - if (!pciNumBuses) #if defined(ARCH_PCI_OS_INIT) + if (pciNumBuses <= 0) ARCH_PCI_OS_INIT(); -#else - xf86Msg(X_ERROR,"No OS PCI support available\n"); #endif } - PCITAG pciFindFirst(CARD32 id, CARD32 mask) { @@ -266,7 +265,7 @@ ErrorF("pciFindNext(), pciInit = %d\n", pciInitialized); #endif pciInit(); - + return((*pciFindNextFP)()); } @@ -280,9 +279,9 @@ #endif pciInit(); - if ((bus < pciNumBuses || inProbe) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs.pciReadLong) { - CARD32 rv = (*pciBusInfo[bus]->funcs.pciReadLong)(tag, offset); + if ((bus >= 0) && ((bus < pciNumBuses) || inProbe) && pciBusInfo[bus] && + pciBusInfo[bus]->funcs->pciReadLong) { + CARD32 rv = (*pciBusInfo[bus]->funcs->pciReadLong)(tag, offset); PCITRACE(1, ("pciReadLong: tag=0x%x [b=%d,d=%d,f=%d] returns 0x%08x\n", tag, bus, PCI_DEV_FROM_TAG(tag), PCI_FUNC_FROM_TAG(tag), rv)); @@ -298,13 +297,13 @@ CARD32 tmp; int shift = (offset & 3) * 8; int aligned_offset = offset & ~3; - + if (shift != 0 && shift != 16) FatalError("pciReadWord: Alignment error: Cannot read 16 bits " "at offset %d\n", offset); - + tmp = pciReadLong(tag, aligned_offset); - + return((CARD16)((tmp >> shift) & 0xffff)); } @@ -314,9 +313,9 @@ CARD32 tmp; int shift = (offset & 3) * 8; int aligned_offset = offset & ~3; - + tmp = pciReadLong(tag, aligned_offset); - + return((CARD8)((tmp >> shift) & 0xff)); } @@ -324,17 +323,17 @@ pciWriteLong(PCITAG tag, int offset, CARD32 val) { int bus = PCI_BUS_FROM_TAG(tag); - + pciInit(); - - if (bus < pciNumBuses && pciBusInfo[bus] && - pciBusInfo[bus]->funcs.pciWriteLong) - (*pciBusInfo[bus]->funcs.pciWriteLong)(tag, offset, val); + + if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && + pciBusInfo[bus]->funcs->pciWriteLong) + (*pciBusInfo[bus]->funcs->pciWriteLong)(tag, offset, val); } - + void pciWriteWord(PCITAG tag, int offset, CARD16 val) -{ +{ CARD32 tmp; int aligned_offset = offset & ~3; int shift = (offset & 3) * 8; @@ -342,30 +341,30 @@ if (shift != 0 && shift != 16) FatalError("pciWriteWord: Alignment Error: Cannot read 16 bits " "from offset %d\n", offset); - + tmp = pciReadLong(tag, aligned_offset); - + tmp &= ~(0xffffL << shift); tmp |= (((CARD32)val) << shift); - + pciWriteLong(tag, aligned_offset, tmp); } void pciWriteByte(PCITAG tag, int offset, CARD8 val) -{ +{ CARD32 tmp; int aligned_offset = offset & ~3; int shift = (offset & 3) *8 ; - + tmp = pciReadLong(tag, aligned_offset); - + tmp &= ~(0xffL << shift); tmp |= (((CARD32)val) << shift); - + pciWriteLong(tag, aligned_offset, tmp); -} - +} + void pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val) { @@ -376,20 +375,19 @@ #endif pciInit(); - if (bus < pciNumBuses && pciBusInfo[bus] && - pciBusInfo[bus]->funcs.pciReadLong) { - (*pciBusInfo[bus]->funcs.pciSetBitsLong)(tag, offset, mask, val); + if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && + pciBusInfo[bus]->funcs->pciReadLong) { + (*pciBusInfo[bus]->funcs->pciSetBitsLong)(tag, offset, mask, val); } } void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val) -{ +{ CARD32 tmp_mask, tmp_val; int aligned_offset = offset & ~3; int shift = (offset & 3) *8 ; - tmp_mask = mask << shift; tmp_val = val << shift; pciSetBitsLong(tag, aligned_offset, tmp_mask, tmp_val); @@ -401,17 +399,17 @@ int bus = PCI_BUS_FROM_TAG(tag); pciInit(); + + if ((bus < 0) || (bus > pciNumBuses) || !pciBusInfo[bus] || + !pciBusInfo[bus]->funcs->pciReadLong) return NULL; - if (bus > pciNumBuses || !pciBusInfo[bus] || - !pciBusInfo[bus]->funcs.pciReadLong) return NULL; - switch (func) { case WRITE: - return (void *)pciBusInfo[bus]->funcs.pciWriteLong; + return (void *)pciBusInfo[bus]->funcs->pciWriteLong; case READ: - return (void *)pciBusInfo[bus]->funcs.pciReadLong; + return (void *)pciBusInfo[bus]->funcs->pciReadLong; case SET_BITS: - return (void *)pciBusInfo[bus]->funcs.pciSetBitsLong; + return (void *)pciBusInfo[bus]->funcs->pciSetBitsLong; } return NULL; } @@ -420,12 +418,12 @@ pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { int bus = PCI_BUS_FROM_TAG(tag); - + pciInit(); - - if (bus < pciNumBuses && pciBusInfo[bus] && - pciBusInfo[bus]->funcs.pciAddrBusToHost) - return (*pciBusInfo[bus]->funcs.pciAddrBusToHost)(tag, type, addr); + + if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && + pciBusInfo[bus]->funcs->pciAddrBusToHost) + return (*pciBusInfo[bus]->funcs->pciAddrBusToHost)(tag, type, addr); else return(addr); } @@ -434,17 +432,16 @@ pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { int bus = PCI_BUS_FROM_TAG(tag); - + pciInit(); - - if (bus < pciNumBuses && pciBusInfo[bus] && - pciBusInfo[bus]->funcs.pciAddrHostToBus) - return (*pciBusInfo[bus]->funcs.pciAddrHostToBus)(tag, type, addr); + + if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && + pciBusInfo[bus]->funcs->pciAddrHostToBus) + return (*pciBusInfo[bus]->funcs->pciAddrHostToBus)(tag, type, addr); else return(addr); } - /* * pciGetBaseSize() returns the size of a PCI base address mapping in bits. * The index identifies the base register: 0-5 are the six standard registers, @@ -466,7 +463,7 @@ CARD32 mask1; CARD32 mask2; int bits = 0; - + /* * Eventually a function for this should be added to pciBusFuncs_t, but for * now we'll just use a simple method based on the alignment of the already @@ -487,12 +484,12 @@ *min = TRUE; return bits; } - + if (min) *min = destructive; /* Get the PCI offset */ - if (index == 6) + if (index == 6) offset = PCI_MAP_ROM_REG; else offset = PCI_MAP_REG_START + (index << 2); @@ -577,17 +574,17 @@ { PCITAG tag0, tag1; unsigned long id0, id1; - + /* Detect a multi-function device that complies to the PCI 2.0 spec */ - + tag0 = PCI_MAKE_TAG(busnum, devnum, 0); id0 = pciReadLong(tag0, PCI_ID_REG); if (id0 == 0xffffffff) - return FALSE; + return FALSE; if (pciReadLong(tag0, PCI_HEADER_MISC) & PCI_HEADER_MULTIFUNCTION) - return TRUE; - + return TRUE; + /* * Now, to find non-compliant devices... * If there is a valid ID for function 1 and the ID for func 0 and 1 @@ -598,11 +595,11 @@ id1 = pciReadLong(tag1, PCI_ID_REG); if (id1 == 0xffffffff || id1 == 0x00000000) return FALSE; - - if ((id0 != id1) || - (pciReadLong(tag0, PCI_MAP_REG_START) != + + if ((id0 != id1) || + (pciReadLong(tag0, PCI_MAP_REG_START) != pciReadLong(tag1, PCI_MAP_REG_START))) - return TRUE; + return TRUE; return FALSE; } @@ -613,12 +610,12 @@ PCITAG pciGenFindNext(void) { - unsigned long devid, tmp; - unsigned int sec_bus, pri_bus; + CARD32 devid, tmp; + int sec_bus, pri_bus; static int previousBus = 0; Bool speculativeProbe = FALSE; unsigned char base_class, sub_class; - + #ifdef DEBUGPCI ErrorF("pciGenFindNext\n"); #endif @@ -632,13 +629,14 @@ /* * Start at top of the order */ - if (pciNumBuses == 0) + if (pciNumBuses <= 0) return(PCI_NOT_FOUND); /* Skip ahead to the first bus defined by pciInit() */ for (pciBusNum = 0; !pciBusInfo[pciBusNum]; ++pciBusNum); pciFuncNum = 0; pciDevNum = 0; + previousBus = pciBusNum; /* make sure previousBus exists */ } else { #ifdef PCI_MFDEV_SUPPORT #ifdef DEBUGPCI @@ -681,17 +679,17 @@ if (speculativeProbe) { xfree(pciBusInfo[pciBusNum]); pciBusInfo[pciBusNum] = NULL; + speculativeProbe = FALSE; } - - - if (++pciBusNum >= MAX_PCI_BUSES) { + + if (++pciBusNum >= pciMaxBusNum) { #ifdef DEBUGPCI ErrorF("pciGenFindNext: out of buses\n"); #endif /* No more buses. All done for now */ return(PCI_NOT_FOUND); } - + pciDevNum = 0; } } @@ -702,10 +700,10 @@ if (!pciBusInfo[pciBusNum]) { pciBusInfo[pciBusNum] = xnfalloc(sizeof(pciBusInfo_t)); *pciBusInfo[pciBusNum] = *pciBusInfo[previousBus]; - + speculativeProbe = TRUE; } - + /* * At this point, pciBusNum, pciDevNum, and pciFuncNum have been * advanced to the next device. Compute the tag, and read the @@ -721,42 +719,55 @@ #ifdef DEBUGPCI ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid); #endif - if ((devid == 0xffffffff) || (devid == 0x00000000) || - (devid == 0xffff0000) || (devid == 0x0000ffff)) + if ((CARD16)(devid + 1U) <= (CARD16)1UL) continue; /* Nobody home. Next device please */ if (pciNumBuses <= pciBusNum) pciNumBuses = pciBusNum + 1; - + speculativeProbe = FALSE; previousBus = pciBusNum; - + /* * Before checking for a specific devid, look for enabled * PCI to PCI bridge devices. If one is found, create and * initialize a bus info record (if one does not already exist). */ -#ifdef PCI_BRIDGE_SUPPORT +#ifdef PCI_BRIDGE_SUPPORT tmp = pciReadLong(pciDeviceTag, PCI_CLASS_REG); base_class = PCI_CLASS_EXTRACT(tmp); - sub_class = PCI_SUBCLASS_EXTRACT(tmp); + sub_class = PCI_SUBCLASS_EXTRACT(tmp); if ((base_class == PCI_CLASS_BRIDGE) && - (sub_class == PCI_SUBCLASS_BRIDGE_PCI)) { + ((sub_class == PCI_SUBCLASS_BRIDGE_PCI) || + (sub_class == PCI_SUBCLASS_BRIDGE_CARDBUS))) { tmp = pciReadLong(pciDeviceTag, PCI_PCI_BRIDGE_BUS_REG); - sec_bus = PCI_SECONDARY_BUS_EXTRACT(tmp); - pri_bus = PCI_PRIMARY_BUS_EXTRACT(tmp); + sec_bus = PCI_SECONDARY_BUS_EXTRACT(tmp, pciDeviceTag); + pri_bus = PCI_PRIMARY_BUS_EXTRACT(tmp, pciDeviceTag); #ifdef DEBUGPCI - ErrorF("pciGenFindNext: pri_bus %d sec_bus %d\n", pri_bus, sec_bus); + ErrorF("pciGenFindNext: pri_bus %d sec_bus %d\n", + pri_bus, sec_bus); #endif - if (sec_bus > 0 && sec_bus < MAX_PCI_BUSES && pciBusInfo[pri_bus]) { + if (pciBusNum != pri_bus) { + /* Some bridges do not implement the primary bus register */ + if ((PCI_BUS_NO_DOMAIN(pri_bus) != 0) || + (sub_class != PCI_SUBCLASS_BRIDGE_CARDBUS)) + xf86Msg(X_WARNING, + "pciGenFindNext: primary bus mismatch on PCI" + " bridge 0x%08x (0x%02x, 0x%02x)\n", + pciDeviceTag, pciBusNum, pri_bus); + pri_bus = pciBusNum; + } + if ((pri_bus < sec_bus) && (sec_bus < pciMaxBusNum) && + pciBusInfo[pri_bus]) { /* * Found a secondary PCI bus */ - if (!pciBusInfo[sec_bus]) + if (!pciBusInfo[sec_bus]) { pciBusInfo[sec_bus] = xnfalloc(sizeof(pciBusInfo_t)); - /* Copy parents settings... */ - *pciBusInfo[sec_bus] = *pciBusInfo[pri_bus]; + /* Copy parents settings... */ + *pciBusInfo[sec_bus] = *pciBusInfo[pri_bus]; + } /* ...but not everything same as parent */ pciBusInfo[sec_bus]->primary_bus = pri_bus; @@ -764,11 +775,11 @@ pciBusInfo[sec_bus]->numDevices = 32; if (pciNumBuses <= sec_bus) - pciNumBuses = sec_bus+1; + pciNumBuses = sec_bus + 1; } } #endif - + /* * Does this device match the requested devid after * applying mask? @@ -787,16 +798,16 @@ PCITAG pciGenFindFirst(void) { - /* Reset PCI bus number to start from top */ + /* Reset PCI bus number to start from top */ pciBusNum = -1; - + return pciGenFindNext(); } #if defined (__powerpc__) static int buserr_detected; -static +static void buserr(int sig) { buserr_detected = 1; @@ -807,6 +818,9 @@ pciCfgMech1Read(PCITAG tag, int offset) { unsigned long rv = 0xffffffff; +#ifdef DEBUGPCI + ErrorF("pciCfgMech1Read(tag=%08x,offset=%08x)\n", tag, offset); +#endif #if defined(__powerpc__) signal(SIGBUS, buserr); @@ -819,7 +833,12 @@ #if defined(__powerpc__) signal(SIGBUS, SIG_DFL); if (buserr_detected) + { +#ifdef DEBUGPCI + ErrorF("pciCfgMech1Read() BUS ERROR\n"); +#endif return(0xffffffff); + } else #endif return(rv); @@ -828,13 +847,18 @@ void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val) { +#ifdef DEBUGPCI + ErrorF("pciCfgMech1Write(tag=%08x,offset=%08x,val=%08x)\n", + tag, offset,val); +#endif + #if defined(__powerpc__) signal(SIGBUS, SIG_IGN); #endif outl(0xCF8, PCI_EN | tag | (offset & 0xfc)); #if defined(Lynx) && defined(__powerpc__) - outb(0x80, 0x00); /* wo this the next access fails + outb(0x80, 0x00); /* without this the next access fails * on my Powerstack system when we use * assembler inlines for outl */ #endif @@ -874,7 +898,7 @@ __inst_stwbrx(u, &tmp, 0); return(tmp); - + # else /* !PowerMAX_OS */ return lswapl(u); @@ -882,29 +906,10 @@ # endif /* !PowerMAX_OS */ #else /* !BIG_ENDIAN */ - - return(u); - -#endif -} - -/* - * Dummy functions to noop the PCI services - */ -CARD32 -pciReadLongNULL(PCITAG tag, int offset) -{ - return(0xffffffff); -} -void -pciWriteLongNULL(PCITAG tag, int offset, CARD32 val) -{ -} + return(u); -void -pciSetBitsLongNULL(PCITAG tag, int offset, CARD32 mask, CARD32 val) -{ +#endif } ADDRESS @@ -917,7 +922,8 @@ xf86scanpci(int flags) { pciConfigPtr devp; - int idx = 0; + pciBusInfo_t *busp; + int idx = 0, i; PCITAG tag; if (pci_devp[0]) @@ -925,10 +931,18 @@ pciInit(); +#ifdef XF86SCANPCI_WRAPPER + XF86SCANPCI_WRAPPER(SCANPCI_INIT); +#endif + tag = pciFindFirst(0,0); /* 0 mask means match any valid device */ /* Check if no devices, return now */ - if (tag == PCI_NOT_FOUND) + if (tag == PCI_NOT_FOUND) { +#ifdef XF86SCANPCI_WRAPPER + XF86SCANPCI_WRAPPER(SCANPCI_TERM); +#endif return NULL; + } #ifdef DEBUGPCI ErrorF("xf86scanpci: tag = 0x%lx\n", tag); @@ -938,9 +952,7 @@ #endif while (idx < MAX_PCI_DEVICES && tag != PCI_NOT_FOUND) { - int i; - - devp = xalloc(sizeof(pciDevice)); + devp = xcalloc(1, sizeof(pciDevice)); if (!devp) { xf86Msg(X_ERROR, "xf86scanpci: Out of memory after %d devices!!\n", idx); @@ -966,6 +978,7 @@ break; case 1: + case 2: /* Allow master aborts to complete normally on secondary buses */ if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) break; @@ -977,8 +990,6 @@ break; } - devp->listed_class = 0; - #ifdef OLD_FORMAT xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", @@ -1002,17 +1013,39 @@ #ifdef DEBUGPCI ErrorF("xf86scanpci: tag = pciFindNext = 0x%lx\n", tag); #endif - } - /* Restore modified data (in reverse order) */ + /* Restore modified data (in reverse order), and link buses */ while (--idx >= 0) { devp = pci_devp[idx]; switch (devp->pci_header_type & 0x7f) { case 0: + if ((devp->pci_base_class != PCI_CLASS_BRIDGE) || + (devp->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) + break; + pciBusInfo[devp->busnum]->bridge = devp; + pciBusInfo[devp->busnum]->primary_bus = devp->busnum; +#ifdef ARCH_PCI_HOST_BRIDGE + ARCH_PCI_HOST_BRIDGE(devp); +#endif break; case 1: + case 2: + i = PCI_SECONDARY_BUS_EXTRACT(devp->pci_pp_bus_register, devp->tag); + if (i > devp->busnum) { + if (pciBusInfo[i]) { + pciBusInfo[i]->bridge = devp; + /* + * The back link needs to be set here, and is unlikely to + * change. + */ + devp->businfo = pciBusInfo[i]; + } +#ifdef ARCH_PCI_PCI_BRIDGE + ARCH_PCI_PCI_BRIDGE(devp); +#endif + } if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) break; pciWriteByte(devp->tag, PCI_PCI_BRIDGE_CONTROL_REG, @@ -1024,10 +1057,24 @@ } } +#ifdef XF86SCANPCI_WRAPPER + XF86SCANPCI_WRAPPER(SCANPCI_TERM); +#endif + + /* + * Lastly, link bridges to their secondary bus, after the architecture has + * had a chance to modify these assignments. + */ + for (idx = 0; idx < pciNumBuses; idx++) { + if (!(busp = pciBusInfo[idx]) || !(devp = busp->bridge)) + continue; + devp->businfo = busp; + } + #ifndef OLD_FORMAT xf86MsgVerb(X_INFO, 2, "PCI: End of PCI scan\n"); #endif - + return pci_devp; } @@ -1057,7 +1104,7 @@ pciWriteLong(Tag, PCI_CMD_STAT_REG, save & ~PCI_CMD_MEM_ENABLE); } - base = xf86MapVidMem(ScreenNum, Flags, hostbase, Size); + base = xf86MapDomainMemory(ScreenNum, Flags, Tag, hostbase, Size); if (!base) { FatalError("xf86MapPciMem: Could not mmap PCI memory " "[base=0x%x,hostbase=0x%x,size=%x] (%s)\n", @@ -1075,7 +1122,9 @@ } static int -handlePciBIOS(PCITAG Tag, int basereg, int (*func)(CARD8*,ADDRESS,pointer), pointer args) +handlePciBIOS(PCITAG Tag, int basereg, + int (*func)(PCITAG, CARD8*, ADDRESS, pointer), + pointer args) { CARD32 romsave = 0; int i; @@ -1087,14 +1136,14 @@ romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); for (i = ROM_BASE_PRESET; i <= ROM_BASE_FIND; i++) { - memType savebase = 0, newbase, romaddr; + memType savebase = 0, newbase, romaddr; - if (i == ROM_BASE_PRESET) { + if (i == ROM_BASE_PRESET) { /* Does the driver have a preference? */ if (basereg > ROM_BASE_PRESET && basereg <= ROM_BASE_FIND) - b_reg = basereg; - else - b_reg = ++i; + b_reg = basereg; + else + b_reg = ++i; } else b_reg = i; @@ -1114,15 +1163,14 @@ (CARD32)~0); } /* Set ROM base address and enable ROM address decoding */ - pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr + pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr | PCI_MAP_ROM_DECODE_ENABLE); hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM, PCIGETROM(romaddr)); - - if ((xf86ReadBIOS(hostbase, 0, tmp, sizeof(tmp)) != sizeof(tmp)) - || (tmp[0] != 0x55) - || (tmp[1] != 0xaa) - || !tmp[2] ) { + + if ((xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) != + sizeof(tmp)) || + (tmp[0] != 0x55) || (tmp[1] != 0xaa) || !tmp[2] ) { /* Restore the base register if it was changed. */ if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), (CARD32) savebase); @@ -1131,7 +1179,7 @@ continue; } - ret = func(tmp,hostbase,args); + ret = (*func)(Tag, tmp, hostbase, args); /* Restore the base register if it was changed. */ if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), @@ -1140,7 +1188,6 @@ pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); return ret; - } /* Restore ROM address decoding */ pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); @@ -1155,13 +1202,11 @@ } readBios, *readBiosPtr; static int -readPciBios(CARD8* tmp, ADDRESS hostbase, pointer args) -{ - CARD8 *image; +readPciBios(PCITAG Tag, CARD8* tmp, ADDRESS hostbase, pointer args) +{ unsigned int image_length = 0; readBiosPtr rd = args; - unsigned long offset; - int ret, length, len, rlength; + int ret; /* We found a PCI BIOS Image. Now we look for the correct type */ while ((tmp[0] == 0x55) && (tmp[1] == 0xAA)) { @@ -1169,7 +1214,7 @@ unsigned char data[0x18]; unsigned char type; - if ((xf86ReadBIOS(hostbase + data_off, 0, data, sizeof(data)) + if ((xf86ReadDomainMemory(Tag, hostbase + data_off, sizeof(data), data) != sizeof(data)) || (data[0] != 'P') || (data[1] != 'C') || @@ -1191,13 +1236,13 @@ image_length, indicator); #endif hostbase += i_length; - if (xf86ReadBIOS(hostbase, 0, tmp, sizeof(tmp)) - != sizeof(tmp)) + if (xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) + != sizeof(tmp)) break; continue; } /* OK, we have a PCI BIOS Image of the correct type */ - + if (rd->BiosType == PCI_BIOS_PC) image_length = tmp[2] << 9; else @@ -1207,11 +1252,11 @@ #endif break; } - + ret = 0; if (image_length) { - - /* + + /* * if no length is given return the full lenght, * Offset 0. Beware: Area pointed to by Buf must * be large enough! @@ -1229,31 +1274,16 @@ xf86MsgVerb(X_INFO,3,"Truncating PCI BIOS Length to %i\n",rd->Len); } } - - /* Read BIOS in 64kB chunks */ - offset = rd->Offset; - image = rd->Buf; - len = rd->Len; - while ((length = len) > 0) { - if (length > 0x10000) length = 0x10000; - rlength = xf86ReadBIOS(hostbase, offset, image, length); - if (rlength < 0) { - ret = rlength; - break; - } - ret += rlength; - if (rlength < length) break; - offset += length; - image += length; - len -= length; - } + + /* Read BIOS */ + ret = xf86ReadDomainMemory(Tag, hostbase + rd->Offset, rd->Len, rd->Buf); } return ret; } static int -getPciBIOSTypes(CARD8* tmp, ADDRESS hostbase, pointer arg) +getPciBIOSTypes(PCITAG Tag, CARD8* tmp, ADDRESS hostbase, pointer arg) { int n = 0; PciBiosType *Buf = arg; @@ -1263,20 +1293,20 @@ unsigned short data_off = tmp[0x18] | (tmp[0x19] << 8); unsigned char data[16]; unsigned int i_length; - - if ((xf86ReadBIOS(hostbase + data_off, 0, data, sizeof(data)) + + if ((xf86ReadDomainMemory(Tag, hostbase + data_off, sizeof(data), data) != sizeof(data)) || (data[0] != 'P') || (data[1] != 'C') || (data[2] != 'I') || (data[3] != 'R')) break; - + if (data[0x14] >= PCI_BIOS_OTHER) - *Buf++ = PCI_BIOS_OTHER; + *Buf++ = PCI_BIOS_OTHER; else - *Buf++ = data[0x14]; - + *Buf++ = data[0x14]; + n++; if (data[0x15] & 0x80) /* last image */ break; @@ -1289,8 +1319,8 @@ image_length, indicator); #endif hostbase += i_length; - if (xf86ReadBIOS(hostbase, 0, tmp, sizeof(tmp)) - != sizeof(tmp)) + if (xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) + != sizeof(tmp)) break; continue; } while ((tmp[0] == 0x55) && (tmp[1] == 0xAA)); @@ -1300,8 +1330,10 @@ typedef CARD32 (*ReadProcPtr)(PCITAG, int); typedef void (*WriteProcPtr)(PCITAG, int, CARD32); -static int -HandlePciBios(PCITAG Tag, int basereg, int (*func)(CARD8*,ADDRESS,pointer), pointer ptr) +static int +HandlePciBios(PCITAG Tag, int basereg, + int (*func)(PCITAG, CARD8*, ADDRESS, pointer), + pointer ptr) { int n, num; CARD32 Acc1, Acc2; @@ -1311,18 +1343,18 @@ n = handlePciBIOS(Tag,basereg,func,ptr); if (n) return n; - + num = pciTestMultiDeviceCard(PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), PCI_FUNC_FROM_TAG(Tag),&pTag); - + if (!num) return 0; #define PCI_ENA (PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE) Acc1 = ((ReadProcPtr)(pciLongFunc(Tag,READ)))(Tag,PCI_CMD_STAT_REG); ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag, PCI_CMD_STAT_REG,(Acc1 & ~PCI_ENA)); - + for (i = 0; i < num; i++) { Acc2 = ((ReadProcPtr)(pciLongFunc(pTag[i],READ)))(pTag[i],PCI_CMD_STAT_REG); ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i], @@ -1336,7 +1368,7 @@ } ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,PCI_CMD_STAT_REG,Acc1); return n; -} +} int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, @@ -1355,11 +1387,11 @@ rb.Len = Len; rb.Buf = Buf; rb.BiosType = Type; - + return HandlePciBios(Tag, basereg, readPciBios, &rb); } -int +int xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, PciBiosType *Buf) { return HandlePciBios(Tag, basereg, getPciBIOSTypes, (pointer) Buf); @@ -1367,3 +1399,50 @@ #endif /* INCLUDE_XF86_MAP_PCI_MEM */ +#ifdef INCLUDE_XF86_NO_DOMAIN + +int +xf86GetPciDomain(PCITAG Tag) +{ + return 0; +} + +pointer +xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, + ADDRESS Base, unsigned long Size) +{ + return xf86MapVidMem(ScreenNum, Flags, Base, Size); +} + +IOADDRESS +xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, + IOADDRESS Base, unsigned long Size) +{ + return Base; +} + +int +xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) +{ + int ret, length, rlength; + + /* Read in 64kB chunks */ + ret = 0; + while ((length = Len) > 0) { + if (length > 0x010000) length = 0x010000; + rlength = xf86ReadBIOS(Base, 0, Buf, length); + if (rlength < 0) { + ret = rlength; + break; + } + ret += rlength; + if (rlength < length) break; + Base += rlength; + Buf += rlength; + Len -= rlength; + } + + return ret; +} + +#endif /* INCLUDE_XF86_NO_DOMAIN */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.21 xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.36 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.21 Thu Nov 1 18:35:33 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h Mon Dec 23 10:37:26 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.21 2001/11/01 23:35:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.36 2002/12/23 15:37:26 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -54,18 +54,18 @@ * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * copyright holder(s) make(s) no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ @@ -76,36 +76,98 @@ */ #ifndef _PCI_H #define _PCI_H 1 + #include "Xarch.h" #include "Xfuncproto.h" #include "xf86Pci.h" +#include "xf86PciInfo.h" /* * Global Definitions */ #define MAX_PCI_DEVICES 64 /* Max number of devices accomodated */ /* by xf86scanpci */ -#if defined(i386) || defined(__i386__) || defined(__i386) -/* Q&D stopgap to deal with mainboards whose PCI space is smaller */ -#define MAX_PCI_BUSES 128 /* Max number of PCI buses */ +#if defined(sun) && defined(SVR4) && defined(sparc) +# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */ +#elif defined(__alpha__) && defined (linux) +# define MAX_PCI_DOMAINS 512 +# define PCI_DOM_MASK 0x01fful +# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */ #else -#define MAX_PCI_BUSES 256 /* Max number of PCI buses */ +# define MAX_PCI_BUSES 256 /* Max number of PCI buses */ #endif #define PCI_NOT_FOUND 0xffffffff +#define DEVID(vendor, device) \ + ((CARD32)((PCI_CHIP_##device << 16) | PCI_VENDOR_##vendor)) + +#ifndef PCI_DOM_MASK +# define PCI_DOM_MASK 0x0ffu +#endif +#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu) + /* - * + * "b" contains an optional domain number. */ -#define PCI_MAKE_TAG(b,d,f) ((((b) & 0xff) << 16) | \ - (((d) & 0x1f) << 11) | \ - (((f) & 0x7) << 8)) +#define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \ + (((d) & 0x00001fu) << 11) | \ + (((f) & 0x000007u) << 8)) + +#define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu)) + +#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK)) +#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK)) +#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11) +#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8) + +#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00u) >> 8) +#define PCI_BDEV_FROM_TAG(tag) ((tag) & 0x00fff800u) + +#define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK)) +#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu) +#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u) -#define PCI_BUS_FROM_TAG(tag) (((tag) & 0x00ff0000) >> 16) -#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800) >> 11) -#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700) >> 8) - -#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00) >> 8) +/* + * Macros for bus numbers found in P2P headers. + */ +#define PCI_PRIMARY_BUS_EXTRACT(x, tag) \ + ((((x) & PCI_PRIMARY_BUS_MASK ) >> 0) | (PCI_DOM_FROM_TAG(tag) << 8)) +#define PCI_SECONDARY_BUS_EXTRACT(x, tag) \ + ((((x) & PCI_SECONDARY_BUS_MASK ) >> 8) | (PCI_DOM_FROM_TAG(tag) << 8)) +#define PCI_SUBORDINATE_BUS_EXTRACT(x, tag) \ + ((((x) & PCI_SUBORDINATE_BUS_MASK) >> 16) | (PCI_DOM_FROM_TAG(tag) << 8)) + +#define PCI_PRIMARY_BUS_INSERT(x, y) \ + (((x) & ~PCI_PRIMARY_BUS_MASK ) | (((y) & 0xffu) << 0)) +#define PCI_SECONDARY_BUS_INSERT(x, y) \ + (((x) & ~PCI_SECONDARY_BUS_MASK ) | (((y) & 0xffu) << 8)) +#define PCI_SUBORDINATE_BUS_INSERT(x, y) \ + (((x) & ~PCI_SUBORDINATE_BUS_MASK) | (((y) & 0xffu) << 16)) + +/* Ditto for CardBus bridges */ +#define PCI_CB_PRIMARY_BUS_EXTRACT(x, tag) \ + PCI_PRIMARY_BUS_EXTRACT(x, tag) +#define PCI_CB_CARDBUS_BUS_EXTRACT(x, tag) \ + PCI_SECONDARY_BUS_EXTRACT(x, tag) +#define PCI_CB_SUBORDINATE_BUS_EXTRACT(x, tag) \ + PCI_SUBORDINATE_BUS_EXTRACT(x, tag) + +#define PCI_CB_PRIMARY_BUS_INSERT(x, tag) \ + PCI_PRIMARY_BUS_INSERT(x, tag) +#define PCI_CB_CARDBUS_BUS_INSERT(x, tag) \ + PCI_SECONDARY_BUS_INSERT(x, tag) +#define PCI_CB_SUBORDINATE_BUS_INSERT(x, tag) \ + PCI_SUBORDINATE_BUS_INSERT(x, tag) + +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define PCI_CPU(val) (((val >> 24) & 0x000000ff) | \ + ((val >> 8) & 0x0000ff00) | \ + ((val << 8) & 0x00ff0000) | \ + ((val << 24) & 0xff000000)) +#else +#define PCI_CPU(val) (val) +#endif /* * Debug Macros/Definitions @@ -135,48 +197,140 @@ #define PCI_CFGMECH1_MAXDEV 32 -#define PCI_CFGMECH1_TYPE1_CFGADDR(b,d,f,o) (PCI_EN | PCI_MAKE_TAG(b,d,f) | ((o) & 0xff) | 1) -#define PCI_CFGMECH1_TYPE0_CFGADDR(d,f,o) (PCI_EN | PCI_MAKE_TAG(0,d,f) | ((o) & 0xff)) - /* * Select architecture specific PCI init function */ -#if (defined(__powerpc__) || defined(__mips__) || defined(__sh__) || defined(__mc68000__) || defined(__arm__) || defined(__s390__) || defined(__hppa__)) && defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -#elif defined(__powerpc__) && defined(__OpenBSD__) -# define ARCH_PCI_INIT freebsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -#elif defined(__powerpc__) -# define ARCH_PCI_INIT ppcPciInit -# if !defined(PowerMAX_OS) +#if defined(__alpha__) +# if defined(linux) +# define ARCH_PCI_INIT axpPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# elif defined(__FreeBSD__) || defined(__OpenBSD__) +# define ARCH_PCI_INIT freebsdPciInit # define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# elif defined(__NetBSD__) +# define ARCH_PCI_INIT netbsdPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN # endif -#elif defined(__sparc__) && (defined(linux) || defined(sun)) -# define ARCH_PCI_INIT sparcPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -#elif defined(__alpha__) && defined(linux) -# define ARCH_PCI_INIT axpPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -#elif defined(__i386__) && defined(linux) +#elif defined(__arm__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__hppa__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__ia64__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper +#elif defined(__i386__) # define ARCH_PCI_INIT ix86PciInit -# define ARCH_PCI_OS_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -#elif defined(__ia64__) && defined(linux) -# define ARCH_PCI_INIT linuxPciInit +# define ARCH_PCI_HOST_BRIDGE ix86PciHostBridge # define INCLUDE_XF86_MAP_PCI_MEM -#elif defined(__alpha__) && defined(__FreeBSD__) -# define ARCH_PCI_INIT freebsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -#else +# define INCLUDE_XF86_NO_DOMAIN +# if defined(linux) +# define ARCH_PCI_OS_INIT linuxPciInit +# endif +#elif defined(__mc68000__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__mips__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__powerpc__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN /* Needs kernel work to remove */ +# elif defined(__OpenBSD__) +# define ARCH_PCI_INIT freebsdPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# elif defined(__NetBSD__) +# define ARCH_PCI_INIT netbsdPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# elif defined(PowerMAX_OS) /* This port is broken */ +# define ARCH_PCI_INIT ppcPciInit +# else +# define ARCH_PCI_INIT ppcPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__s390__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__sh__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#elif defined(__sparc__) +# if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# elif defined(sun) +# define ARCH_PCI_INIT sparcPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# elif defined(__OpenBSD__) && defined(__sparc64__) +# define ARCH_PCI_INIT freebsdPciInit +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge +#elif defined(__x86_64__) # define ARCH_PCI_INIT ix86PciInit # define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# if defined(linux) +# define ARCH_PCI_OS_INIT linuxPciInit +# endif +#endif + +#ifndef ARCH_PCI_INIT +#error No PCI support available for this architecture/OS combination #endif + extern void ARCH_PCI_INIT(void); #if defined(ARCH_PCI_OS_INIT) extern void ARCH_PCI_OS_INIT(void); #endif +#if defined(ARCH_PCI_HOST_BRIDGE) +extern void ARCH_PCI_HOST_BRIDGE(pciConfigPtr pPCI); +#endif + +#if defined(ARCH_PCI_PCI_BRIDGE) +extern void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI); +#endif + +#if defined(XF86SCANPCI_WRAPPER) +typedef enum { + SCANPCI_INIT, + SCANPCI_TERM +} scanpciWrapperOpt; +extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags); +#endif + /* * Table of functions used to access a specific PCI bus domain * (e.g. a primary PCI bus and all of its secondaries) @@ -184,25 +338,38 @@ typedef struct pci_bus_funcs { CARD32 (*pciReadLong)(PCITAG, int); void (*pciWriteLong)(PCITAG, int, CARD32); - void (*pciSetBitsLong)(PCITAG, int, CARD32, CARD32); + void (*pciSetBitsLong)(PCITAG, int, CARD32, CARD32); ADDRESS (*pciAddrHostToBus)(PCITAG, PciAddrType, ADDRESS); ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS); -} pciBusFuncs_t; + /* + * The next three are optional. If NULL, the corresponding function is + * to be performed generically. + */ + CARD16 (*pciControlBridge)(int, CARD16, CARD16); + void (*pciGetBridgeBusses)(int, int *, int *, int *); + /* Use pointer's to avoid #include recursion */ + void (*pciGetBridgeResources)(int, pointer *, pointer *, pointer *); +} pciBusFuncs_t, *pciBusFuncs_p; /* - * pciBusInfo_t - One structure per defined PCI bus + * pciBusInfo_t - One structure per defined PCI bus */ typedef struct pci_bus_info { unsigned char configMech; /* PCI config type to use */ unsigned char numDevices; /* Range of valid devnums */ unsigned char secondary; /* Boolean: bus is a secondary */ - unsigned char primary_bus; /* Top level (primary) parent */ + int primary_bus; /* Parent bus */ +#ifdef PowerMAX_OS unsigned long ppc_io_base; /* PowerPC I/O spc membase */ unsigned long ppc_io_size; /* PowerPC I/O spc size */ - pciBusFuncs_t funcs; /* PCI access functions */ +#endif + pciBusFuncs_p funcs; /* PCI access functions */ void *pciBusPriv; /* Implementation private data */ + pciConfigPtr bridge; /* bridge that opens this bus */ } pciBusInfo_t; +#define HOST_NO_BUS ((pciBusInfo_t *)(-1)) + /* configMech values */ #define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */ #define PCI_CFG_MECH_1 1 /* Most machines */ @@ -218,25 +385,21 @@ CARD32 val); CARD32 pciByteSwap(CARD32); Bool pciMfDev(int, int); -CARD32 pciReadLongNULL(PCITAG tag, int offset); -void pciWriteLongNULL(PCITAG tag, int offset, CARD32 val); -void pciSetBitsLongNULL(PCITAG tag, int offset, CARD32 mask, - CARD32 val); ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); extern PCITAG (*pciFindFirstFP)(void); extern PCITAG (*pciFindNextFP)(void); -extern CARD32 pciDevid; +extern CARD32 pciDevid; extern CARD32 pciDevidMask; +extern int pciMaxBusNum; + extern int pciBusNum; extern int pciDevNum; extern int pciFuncNum; extern PCITAG pciDeviceTag; extern pciBusInfo_t *pciBusInfo[]; - -extern pciBusFuncs_t pciNOOPFuncs; #endif /* _PCI_H */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c:1.9 xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c:1.9 Mon Aug 28 12:04:51 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c Wed Dec 11 23:12:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c,v 1.9 2000/08/28 16:04:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c,v 1.15 2002/12/12 04:12:02 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -53,109 +53,422 @@ #include "Pci.h" #include <asm/unistd.h> +#include "../linux/lnx.h" /* for _iobase */ /* - * Alpha platform specific PCI access functions + * Alpha/Linux platform specific PCI access functions */ -CARD32 axpPciCfgRead(PCITAG tag, int off); -void axpPciCfgWrite(PCITAG, int off, CARD32 val); -void axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); +static CARD32 axpPciCfgRead(PCITAG tag, int off); +static void axpPciCfgWrite(PCITAG, int off, CARD32 val); +static void axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); + +static pciBusFuncs_t axpFuncs0 = { +/* pciReadLong */ axpPciCfgRead, +/* pciWriteLong */ axpPciCfgWrite, +/* pciSetBitsLong */ axpPciCfgSetBits, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP +}; + +typedef struct _axpDomainRec { + int domain, hose; + int root_bus; + unsigned long dense_io, sparse_io; + unsigned long dense_mem, sparse_mem; + IOADDRESS mapped_io; +} axpDomainRec, *axpDomainPtr; + +#define MAX_DOMAINS (MAX_PCI_BUSES / 256) +static axpDomainPtr xf86DomainInfo[MAX_DOMAINS] = { NULL, }; +static int pciNumDomains = 0; +/* + * For debug, domain assignment can start downward from a fixed base + * (instead of up from 0) by defining FORCE_HIGH_DOMAINS. This allows + * debug of large domain numbers and sparse domain numbering on systems + * which don't have as many hoses. + */ #if 0 -pciBusInfo_t axpPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -/* funcs */ { - axpPciCfgRead, - axpPciCfgWrite, - axpPciCfgSetBits, - pciAddrNOOP, - pciAddrNOOP - }, -/* pciBusPriv */ NULL -}; -#else -pciBusInfo_t axpPci[MAX_PCI_BUSES]; +# define FORCE_HIGH_DOMAINS MAX_DOMAINS /* assign domains downward from here */ #endif -void -axpPciInit() +/* + * If FORCE_HIGH_DOMAINS is set, make sure it's not larger than the + * max domain + */ +#if defined(FORCE_HIGH_DOMAINS) && (FORCE_HIGH_DOMAINS > MAX_DOMAINS) +# undef FORCE_HIGH_DOMAINS +# define FORCE_HIGH_DOMAINS MAX_DOMAINS +#endif + +static int +axpSetupDomains(void) { -#if 0 - pciNumBuses = 1; - pciBusInfo[0] = &axpPci0; -#else - int i; - - pciNumBuses = MAX_PCI_BUSES; - memset(&axpPci, 0, sizeof(axpPci)); - for (i = 0; i < MAX_PCI_BUSES; ++i) { - axpPci[i].configMech = PCI_CFG_MECH_OTHER; - axpPci[i].numDevices = 32; - axpPci[i].funcs.pciReadLong = axpPciCfgRead; - axpPci[i].funcs.pciWriteLong = axpPciCfgWrite; - axpPci[i].funcs.pciSetBitsLong = axpPciCfgSetBits; - axpPci[i].funcs.pciAddrHostToBus = pciAddrNOOP; - axpPci[i].funcs.pciAddrBusToHost = pciAddrNOOP; - pciBusInfo[i] = axpPci + i; - } + axpDomainRec axpDomain; + int numDomains = 0; + int hose; + +#ifndef INCLUDE_XF86_NO_DOMAIN + +#ifdef FORCE_HIGH_DOMAINS + xf86Msg(X_WARNING, + "DEBUG OPTION FORCE_HIGH_DOMAINS in use - DRI will *NOT* work\n"); + numDomains = FORCE_HIGH_DOMAINS; #endif - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; + + /* + * Since each hose has a different address space, hoses are a perfect + * overlay for domains, so set up one domain for each hose present + * in the system. We have to loop through all possible hoses because + * some systems allow sparse I/O controllers. + */ + for(hose = 0; hose < MAX_DOMAINS; hose++) { + axpDomain.root_bus = _iobase(IOBASE_ROOT_BUS, hose, -1, -1); + if (axpDomain.root_bus < 0) continue; + + axpDomain.hose = hose; + +#ifndef FORCE_HIGH_DOMAINS + + axpDomain.domain = axpDomain.hose = hose; + numDomains = axpDomain.domain + 1; + +#else /* FORCE_HIGH_DOMAINS */ + + axpDomain.domain = numDomains - hose - 1; + + xf86Msg(X_WARNING, + "FORCE_HIGH_DOMAINS - assigned hose %d to domain %d\n", + axpDomain.hose, axpDomain.domain); + +#endif /* FORCE_HIGH_DOMAINS */ + + axpDomain.dense_io = _iobase(IOBASE_DENSE_IO, hose, -1, -1); + axpDomain.sparse_io = _iobase(IOBASE_SPARSE_IO, hose, -1, -1); + axpDomain.mapped_io = 0; + axpDomain.dense_mem = _iobase(IOBASE_DENSE_MEM, hose, -1, -1); + axpDomain.sparse_mem = _iobase(IOBASE_SPARSE_MEM, hose, -1, -1); + + xf86DomainInfo[axpDomain.domain] = xnfalloc(sizeof(axpDomainRec)); + *(xf86DomainInfo[axpDomain.domain]) = axpDomain; + + /* + * For now, only allow a single domain (hose) on sparse i/o systems. + * + * Allowing multiple domains on sparse systems would require: + * 1) either + * a) revamping the sparse video mapping code to allow + * for multiple unrelated address regions + * -- OR -- + * b) implementing sparse mapping directly in + * xf86MapDomainMemory + * 2) revaming read/write sparse routines to correctly handle + * the solution to 1) + * 3) implementing a sparse I/O system (mapping, inX/outX) + * independent of glibc, since the glibc version only + * supports hose 0 + */ + if (axpDomain.sparse_io) { + if (_iobase(IOBASE_ROOT_BUS, hose + 1, -1, -1) >= 0) { + /* + * It's a sparse i/o system with (at least) one more hose, + * show a message indicating that video is constrained to + * hose 0 + */ + xf86Msg(X_INFO, + "Sparse I/O system - constraining video to hose 0\n"); + } + break; + } + } + +#else /* INCLUDE_XF86_NO_DOMAIN */ + + /* + * domain support is not included, so just set up a single domain (0) + * to represent the first hose so that axpPciInit will still have + * be able to set up the root bus + */ + xf86DomainInfo[0] = xnfalloc(sizeof(axpDomainRec)); + *(xf86DomainInfo[0]) = axpDomain; + numDomains = 1; + +#endif /* INCLUDE_XF86_NO_DOMAIN */ + + return numDomains; } +void +axpPciInit() +{ + axpDomainPtr pDomain; + int domain, bus; -#if defined(linux) + pciNumDomains = axpSetupDomains(); + + for(domain = 0; domain < pciNumDomains; domain++) { + if (!(pDomain = xf86DomainInfo[domain])) continue; + + /* + * Since any bridged buses will be behind a probed pci-pci bridge, + * only set up the root bus for each domain (hose) and the bridged + * buses will be set up as they are found. + */ + bus = PCI_MAKE_BUS(domain, 0); + pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); + (void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t)); + + pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER; + pciBusInfo[bus]->numDevices = 32; + pciBusInfo[bus]->funcs = &axpFuncs0; + pciBusInfo[bus]->pciBusPriv = pDomain; + + pciNumBuses = bus + 1; + } + + pciFindFirstFP = pciGenFindFirst; + pciFindNextFP = pciGenFindNext; +} + /* - * These funtions will work for Linux, but other OS's - * are likely have a different mechanism for getting at - * PCI configuration space + * Alpha/Linux PCI configuration space access routines */ -CARD32 +static int +axpPciBusFromTag(PCITAG tag) +{ + pciBusInfo_t *pBusInfo; + axpDomainPtr pDomain; + int bus, dfn; + + bus = PCI_BUS_FROM_TAG(tag); + if ((bus >= pciNumBuses) + || !(pBusInfo = pciBusInfo[bus]) + || !(pDomain = pBusInfo->pciBusPriv) + || (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1; + + bus = PCI_BUS_NO_DOMAIN(bus) + pDomain->root_bus; + dfn = PCI_DFN_FROM_TAG(tag); + if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1; + + return bus; +} + +static CARD32 axpPciCfgRead(PCITAG tag, int off) { - int bus, dfn; - CARD32 val = 0xffffffff; + int bus, dfn; + CARD32 val = 0xffffffff; - bus = PCI_BUS_FROM_TAG(tag); - /* - * Workaround for kernel bug - * triggered when probing for PCI devices - */ - if (bus >= pciNumBuses) - return (val); + if ((bus = axpPciBusFromTag(tag)) >= 0) { dfn = PCI_DFN_FROM_TAG(tag); syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - return(val); + } + return(val); } -void +static void axpPciCfgWrite(PCITAG tag, int off, CARD32 val) { - int bus, dfn; + int bus, dfn; - bus = PCI_BUS_FROM_TAG(tag); + if ((bus = axpPciBusFromTag(tag)) >= 0) { dfn = PCI_DFN_FROM_TAG(tag); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); + } } -void +static void axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) { int bus, dfn; CARD32 val = 0xffffffff; - bus = PCI_BUS_FROM_TAG(tag); - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - val = (val & ~mask) | (bits & mask); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); + if ((bus = axpPciBusFromTag(tag)) >= 0) { + dfn = PCI_DFN_FROM_TAG(tag); + + syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); + val = (val & ~mask) | (bits & mask); + syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); + } +} + +#ifndef INCLUDE_XF86_NO_DOMAIN + +/* + * Alpha/Linux addressing domain support + */ + +int +xf86GetPciDomain(PCITAG Tag) +{ + return PCI_DOM_FROM_TAG(Tag); +} + +pointer +xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, + ADDRESS Base, unsigned long Size) +{ + axpDomainPtr pDomain; + int domain = PCI_DOM_FROM_TAG(Tag); + + if ((domain < 0) || (domain >= pciNumDomains) || + !(pDomain = xf86DomainInfo[domain])) + FatalError("%s called with invalid parameters\n", __FUNCTION__); + + /* + * xf86MapVidMem already does what we need, but remember to subtract + * _bus_base() (the physical dense memory root of hose 0) since + * xf86MapVidMem is expecting an offset relative to _bus_base() rather + * than an actual physical address. + */ + return xf86MapVidMem(ScreenNum, Flags, + pDomain->dense_mem + Base - _bus_base(), Size); +} + +IOADDRESS +xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, + IOADDRESS Base, unsigned long Size) +{ + axpDomainPtr pDomain; + int domain = PCI_DOM_FROM_TAG(Tag); + + if ((domain < 0) || (domain >= pciNumDomains) || + !(pDomain = xf86DomainInfo[domain])) + FatalError("%s called with invalid parameters\n", __FUNCTION__); + + /* + * Use glibc inx/outx routines for sparse I/O, so just return the + * base [this is ok since we also constrain sparse I/O systems to + * a single domain in axpSetupDomains()] + */ + if (pDomain->sparse_io) return Base; + + /* + * I/O addresses on Alpha are really just different physical memory + * addresses that the system corelogic turns into I/O commands on the + * bus, so just use xf86MapVidMem to map I/O as well, but remember + * to subtract _bus_base() (the physical dense memory root of hose 0) + * since xf86MapVidMem is expecting an offset relative to _bus_base() + * rather than an actual physical address. + * + * Map the entire I/O space (64kB) at once and only once. + */ + if (!pDomain->mapped_io) + pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(ScreenNum, Flags, + pDomain->dense_io - _bus_base(), + 0x10000); + + return pDomain->mapped_io + Base; +} + +int +xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) +{ + static unsigned long pagemask = 0; + unsigned char *MappedAddr; + unsigned long MapSize; + ADDRESS MapBase; + int i; + + if (!pagemask) pagemask = xf86getpagesize() - 1; + + /* Ensure page boundaries */ + MapBase = Base & ~pagemask; + MapSize = ((Base + Len + pagemask) & ~pagemask) - MapBase; + + /* + * VIDMEM_MMIO in order to get sparse mapping on sparse memory systems + * so we can use mmio functions to read (that way we can really get byte + * at a time reads on dense memory systems with byte/word instructions. + */ + MappedAddr = xf86MapDomainMemory(-1, VIDMEM_READONLY | VIDMEM_MMIO, + Tag, MapBase, MapSize); + + for (i = 0; i < Len; i++) { + *Buf++ = xf86ReadMmio8(MappedAddr, Base - MapBase + i); + } + + xf86UnMapVidMem(-1, MappedAddr, MapSize); + return Len; } -#endif /* Linux */ + +resPtr +xf86PciBusAccWindowsFromOS(void) +{ + resPtr pRes = NULL; + resRange range; + int domain; + + for(domain = 0; domain < pciNumDomains; domain++) { + if (!xf86DomainInfo[domain]) continue; + + RANGE(range, 0, 0xffffffffUL, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, 0, 0x0000ffffUL, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + } + + return pRes; +} + +resPtr +xf86BusAccWindowsFromOS(void) +{ + return xf86PciBusAccWindowsFromOS(); +} + +resPtr +xf86AccResFromOS(resPtr pRes) +{ + resRange range; + int domain; + + for(domain = 0; domain < pciNumDomains; domain++) { + if (!xf86DomainInfo[domain]) continue; + + /* + * Fallback is to claim the following areas: + * + * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS + */ + + RANGE(range, 0x000c0000, 0x000effff, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + /* + * Fallback would be to claim well known ports in the 0x0 - 0x3ff + * range along with their sparse I/O aliases, but that's too + * imprecise. Instead claim a bare minimum here. + */ + RANGE(range, 0x00000000, 0x000000ff, + RANGE_TYPE(ResExcIoBlock, domain)); /* For mainboard */ + pRes = xf86AddResToList(pRes, &range, -1); + + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ + RANGE(range, 0x00000000, 0x00000000, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, 0xffffffff, 0xffffffff, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); +/* RANGE(range, 0x00000000, 0x00000000, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); */ + RANGE(range, 0xffffffff, 0xffffffff, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + } + + return pRes; +} + +#endif /* !INCLUDE_XF86_NO_DOMAIN */ + Index: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c:1.1 --- /dev/null Thu Feb 27 12:32:28 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c Sun Feb 23 15:26:49 2003 @@ -0,0 +1,54 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c,v 1.1 2003/02/23 20:26:49 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +/* + * This file contains the glue necessary for support of Intel's E8870 chipset. + */ + +#include "e8870PCI.h" +#include "xf86.h" +#include "Pci.h" + +Bool +xf86PreScanE8870(void) +{ + PCITAG tag; + + /* Look for an E8870's Hub interface */ + tag = PCI_MAKE_TAG(0, 0x1E, 0); + if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 82801_P2P)) + return FALSE; + + /* XXX Fill me in... */ + return TRUE; +} + +void +xf86PostScanE8870(void) +{ + /* XXX Fill me in... */ +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h:1.1 --- /dev/null Thu Feb 27 12:32:28 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h Sun Feb 23 15:26:49 2003 @@ -0,0 +1,36 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h,v 1.1 2003/02/23 20:26:49 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +#ifndef PCI_E8870_H +#define PCI_E8870_H 1 + +#include <X11/Xdefs.h> + +Bool xf86PreScanE8870(void); +void xf86PostScanE8870(void); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c:1.2 Mon Nov 6 14:24:09 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c Tue Aug 27 18:07:07 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.2 2000/11/06 19:24:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.5 2002/08/27 22:07:07 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -58,27 +58,32 @@ * freebsd platform specific PCI access functions -- using /dev/pci * needs kernel version 2.2.x */ -CARD32 freebsdPciCfgRead(PCITAG tag, int off); -void freebsdPciCfgWrite(PCITAG, int off, CARD32 val); -void freebsdPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); - -pciBusInfo_t freebsdPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -/* funcs */ { - freebsdPciCfgRead, - freebsdPciCfgWrite, - freebsdPciCfgSetBits, - pciAddrNOOP, - pciAddrNOOP - }, -/* pciBusPriv */ NULL +static CARD32 freebsdPciCfgRead(PCITAG tag, int off); +static void freebsdPciCfgWrite(PCITAG, int off, CARD32 val); +static void freebsdPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); + +static pciBusFuncs_t freebsdFuncs0 = { +/* pciReadLong */ freebsdPciCfgRead, +/* pciWriteLong */ freebsdPciCfgWrite, +/* pciSetBitsLong */ freebsdPciCfgSetBits, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP }; +static pciBusInfo_t freebsdPci0 = { +/* configMech */ PCI_CFG_MECH_OTHER, +/* numDevices */ 32, +/* secondary */ FALSE, +/* primary_bus */ 0, +#ifdef PowerMAX_OS +/* ppc_io_base */ 0, +/* ppc_io_size */ 0, +#endif +/* funcs */ &freebsdFuncs0, +/* pciBusPriv */ NULL, +/* bridge */ NULL +}; + #if !defined(__OpenBSD__) #if X_BYTE_ORDER == X_BIG_ENDIAN #ifdef __sparc__ @@ -100,7 +105,7 @@ #define PCI_CPU(val) (val) #endif #else /* ! OpenBSD */ -/* OpenBSD has already the bytes in the right order +/* OpenBSD has already the bytes in the right order for all architectures */ #define PCI_CPU(val) (val) #endif @@ -111,7 +116,7 @@ static int pciFd = -1; -void +void freebsdPciInit() { pciFd = open("/dev/pci", O_RDWR); @@ -124,7 +129,7 @@ pciFindNextFP = pciGenFindNext; } -CARD32 +static CARD32 freebsdPciCfgRead(PCITAG tag, int off) { struct pci_io io; @@ -140,7 +145,7 @@ return PCI_CPU(io.pi_data); } -void +static void freebsdPciCfgWrite(PCITAG tag, int off, CARD32 val) { struct pci_io io; @@ -153,7 +158,7 @@ ioctl(pciFd, PCIOCWRITE, &io); } -void +static void freebsdPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) { CARD32 val = freebsdPciCfgRead(tag, off); Index: xc/programs/Xserver/hw/xfree86/os-support/bus/ia64Pci.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/ia64Pci.c:1.3 --- /dev/null Thu Feb 27 12:32:28 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/ia64Pci.c Sun Feb 23 15:26:49 2003 @@ -0,0 +1,59 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ia64Pci.c,v 1.3 2003/02/23 20:26:49 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +/* + * This file contains the glue needed to support various IA-64 chipsets. + */ + +#include "460gxPCI.h" +#include "e8870PCI.h" +#include "zx1PCI.h" +#include "Pci.h" + +void +ia64ScanPCIWrapper(scanpciWrapperOpt flags) +{ + + if (flags == SCANPCI_INIT) { + + /* PCI configuration space probes should be done first */ + if (xf86PreScan460GX()) + return; + if (xf86PreScanE8870()) + return; + if (xf86PreScanZX1()) + return; + + } else /* if (flags == SCANPCI_TERM) */ { + + xf86PostScan460GX(); + xf86PostScanE8870(); + xf86PostScanZX1(); + + } + +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c:1.18 --- xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c:1.8 Fri Jun 9 03:53:25 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c Sun Jan 26 19:01:44 2003 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.8 2000/06/09 07:53:25 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.18 2003/01/27 00:01:44 tsi Exp $ */ /* * ix86Pci.c - x86 PCI driver * - * The Xfree server PCI access functions have been reimplemented as a + * The XFree86 server PCI access functions have been reimplemented as a * framework that allows each supported platform/OS to have their own * platform/OS specific PCI driver. * @@ -70,18 +70,18 @@ * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * copyright holder(s) make(s) no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * This code is also based heavily on the code in FreeBSD-current, which was @@ -140,46 +140,90 @@ /* * Intel x86 platform specific PCI access functions */ -CARD32 ix86PciReadLongSetup(PCITAG tag, int off); -void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val); -void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val); -CARD32 ix86PciReadLongCFG1(PCITAG tag, int off); -void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val); -void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val); -CARD32 ix86PciReadLongCFG2(PCITAG tag, int off); -void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val); -void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val); - -pciBusInfo_t ix86Pci0 = { -/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */ -/* numDevices */ 0, /* Set by ix86PciInit() */ -/* secondary */ FALSE, -/* primary_bus */ 0, -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -/* funcs */ { - ix86PciReadLongSetup, - ix86PciWriteLongSetup, - ix86PciSetBitsLongSetup, - pciAddrNOOP, - pciAddrNOOP - }, -/* pciBusPriv */ NULL +static CARD32 ix86PciReadLongSetup(PCITAG tag, int off); +static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val); +static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val); +static CARD32 ix86PciReadLongCFG1(PCITAG tag, int off); +static void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val); +static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val); +static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off); +static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val); +static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val); + +static pciBusFuncs_t ix86Funcs0 = { +/* pciReadLong */ ix86PciReadLongSetup, +/* pciWriteLong */ ix86PciWriteLongSetup, +/* pciSetBitsLong */ ix86PciSetBitsLongSetup, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP +}; + +static pciBusFuncs_t ix86Funcs1 = { +/* pciReadLong */ ix86PciReadLongCFG1, +/* pciWriteLong */ ix86PciWriteLongCFG1, +/* pciSetBitsLong */ ix86PciSetBitsLongCFG1, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP +}; + +static pciBusFuncs_t ix86Funcs2 = { +/* pciReadLong */ ix86PciReadLongCFG2, +/* pciWriteLong */ ix86PciWriteLongCFG2, +/* pciSetBitsLong */ ix86PciSetBitsLongCFG2, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP }; +static pciBusInfo_t ix86Pci0 = { +/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */ +/* numDevices */ 0, /* Set by ix86PciInit() */ +/* secondary */ FALSE, +/* primary_bus */ 0, +#ifdef PowerMAX_OS +/* ppc_io_base */ 0, +/* ppc_io_size */ 0, +#endif +/* funcs */ &ix86Funcs0, /* Set by ix86PciInit() */ +/* pciBusPriv */ NULL, +/* bridge */ NULL +}; + static Bool ix86PciBusCheck(void) { + PCITAG tag; + CARD32 id, class; CARD8 device; for (device = 0; device < ix86Pci0.numDevices; device++) { - CARD32 id; - id = (*ix86Pci0.funcs.pciReadLong)(PCI_MAKE_TAG(0, device, 0), 0); - if (id && id != 0xffffffff) { + tag = PCI_MAKE_TAG(0, device, 0); + id = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_ID_REG); + + if ((CARD16)(id + 1U) <= (CARD16)1UL) + continue; + + /* The rest of this is inspired by the Linux kernel */ + class = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_CLASS_REG); + + /* Ignore revision id and programming interface */ + switch (class >> 16) { + case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_MISC: + /* Check for vendors of known buggy chipsets */ + id &= 0x0000ffff; + if ((id == PCI_VENDOR_INTEL) || (id == PCI_VENDOR_COMPAQ)) + return TRUE; + continue; + + case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_VGA: + case (PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA: + case (PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_HOST: return TRUE; + + default: + break; } } - return 0; + return FALSE; } static @@ -231,10 +275,8 @@ ix86Pci0.configMech = PCI_CFG_MECH_1; ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs.pciReadLong = ix86PciReadLongCFG1; - ix86Pci0.funcs.pciWriteLong = ix86PciWriteLongCFG1; - ix86Pci0.funcs.pciSetBitsLong = ix86PciSetBitsLongCFG1; - + ix86Pci0.funcs = &ix86Funcs1; + outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); #if 0 @@ -344,20 +386,18 @@ } } - + xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n"); xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08x,\n" "\tmode1Res1 = 0x%08x, mode1Res2 = 0x%08x\n", stages, oldVal1, mode1Res1, mode1Res2); - + /* Try config type 2 */ oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG); if ((oldVal2 & 0xf0) == 0) { ix86Pci0.configMech = PCI_CFG_MECH_2; ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs.pciReadLong = ix86PciReadLongCFG2; - ix86Pci0.funcs.pciWriteLong = ix86PciWriteLongCFG2; - ix86Pci0.funcs.pciSetBitsLong = ix86PciSetBitsLongCFG2; + ix86Pci0.funcs = &ix86Funcs2; outb(PCI_CFGMECH2_ENABLE_REG, 0x0e); mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); @@ -387,9 +427,7 @@ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); ix86Pci0.configMech = PCI_CFG_MECH_2; ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs.pciReadLong = ix86PciReadLongCFG2; - ix86Pci0.funcs.pciWriteLong = ix86PciWriteLongCFG2; - ix86Pci0.funcs.pciSetBitsLong = ix86PciSetBitsLongCFG2; + ix86Pci0.funcs = &ix86Funcs2; return; } @@ -401,9 +439,7 @@ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); ix86Pci0.configMech = PCI_CFG_MECH_1; ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs.pciReadLong = ix86PciReadLongCFG1; - ix86Pci0.funcs.pciWriteLong = ix86PciWriteLongCFG1; - ix86Pci0.funcs.pciSetBitsLong = ix86PciSetBitsLongCFG1; + ix86Pci0.funcs = &ix86Funcs1; return; } break; /* } */ @@ -414,9 +450,7 @@ ix86Pci0.configMech = PCI_CFG_MECH_1; ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs.pciReadLong = ix86PciReadLongCFG1; - ix86Pci0.funcs.pciWriteLong = ix86PciWriteLongCFG1; - ix86Pci0.funcs.pciSetBitsLong = ix86PciSetBitsLongCFG1; + ix86Pci0.funcs = &ix86Funcs1; return; case PCIForceConfig2: @@ -425,17 +459,19 @@ ix86Pci0.configMech = PCI_CFG_MECH_2; ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs.pciReadLong = ix86PciReadLongCFG2; - ix86Pci0.funcs.pciWriteLong = ix86PciWriteLongCFG2; - ix86Pci0.funcs.pciSetBitsLong = ix86PciSetBitsLongCFG2; + ix86Pci0.funcs = &ix86Funcs2; return; case PCIOsConfig: return; + + case PCIForceNone: + break; } /* No PCI found */ - xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found\n"); + ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN; + xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found or probed for\n"); } #if 0 @@ -455,31 +491,32 @@ ((CARD32)cardnum << 11) | ((CARD32)func << 8); break; - + case PCI_CFG_MECH_2: tag.cfg2.port = 0xc000 | ((CARD16)cardnum << 8); tag.cfg2.enable = 0xf0 | (func << 1); tag.cfg2.forward = bus; break; } - + return tag; } #endif -CARD32 + +static CARD32 ix86PciReadLongSetup(PCITAG Tag, int reg) { ix86PciSelectCfgmech(); - return (*ix86Pci0.funcs.pciReadLong)(Tag,reg); + return (*ix86Pci0.funcs->pciReadLong)(Tag,reg); } - -CARD32 + +static CARD32 ix86PciReadLongCFG1(PCITAG Tag, int reg) { CARD32 addr, data = 0; #ifdef DEBUGPCI -ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); + ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); #endif addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); @@ -488,20 +525,22 @@ outl(PCI_CFGMECH1_ADDRESS_REG, 0); #ifdef DEBUGPCI -ErrorF("ix86PciReadLong 0x%lx\n", data); + ErrorF("ix86PciReadLong 0x%lx\n", data); #endif return data; } -CARD32 +static CARD32 ix86PciReadLongCFG2(PCITAG Tag, int reg) { CARD32 addr, data = 0; CARD8 forward, enable; + #ifdef DEBUGPCI -ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); + ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); #endif + forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); @@ -513,20 +552,20 @@ outb(PCI_CFGMECH2_FORWARD_REG, 0); #ifdef DEBUGPCI -ErrorF("ix86PciReadLong 0x%lx\n", data); + ErrorF("ix86PciReadLong 0x%lx\n", data); #endif return data; } -void +static void ix86PciWriteLongSetup(PCITAG Tag, int reg, CARD32 data) { ix86PciSelectCfgmech(); - (*ix86Pci0.funcs.pciWriteLong)(Tag,reg,data); + (*ix86Pci0.funcs->pciWriteLong)(Tag,reg,data); } -void +static void ix86PciWriteLongCFG1(PCITAG Tag, int reg, CARD32 data) { CARD32 addr; @@ -537,16 +576,16 @@ outl(PCI_CFGMECH1_ADDRESS_REG, 0); } -void +static void ix86PciWriteLongCFG2(PCITAG Tag, int reg, CARD32 data) { CARD32 addr; CARD8 forward, enable; - + forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - + outb(PCI_CFGMECH2_ENABLE_REG, enable); outb(PCI_CFGMECH2_FORWARD_REG, forward); outl((CARD16)addr, data); @@ -554,14 +593,14 @@ outb(PCI_CFGMECH2_FORWARD_REG, 0); } -void +static void ix86PciSetBitsLongSetup(PCITAG Tag, int reg, CARD32 mask, CARD32 val) { ix86PciSelectCfgmech(); - (*ix86Pci0.funcs.pciSetBitsLong)(Tag,reg,mask,val); + (*ix86Pci0.funcs->pciSetBitsLong)(Tag,reg,mask,val); } -void +static void ix86PciSetBitsLongCFG1(PCITAG Tag, int reg, CARD32 mask, CARD32 val) { CARD32 addr, data = 0; @@ -578,7 +617,7 @@ outl(PCI_CFGMECH1_ADDRESS_REG, 0); } -void +static void ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val) { CARD32 addr, data = 0; @@ -617,3 +656,35 @@ pciBusInfo[0] = NULL; } } + +#ifdef ARCH_PCI_HOST_BRIDGE + +/* + * A small table of host bridges that limit the number of PCI buses to less + * than the maximum of 256. + */ +static struct { + CARD32 devid; + int maxpcibus; +} host_bridges[] = { + { DEVID(ALI_2, M1541), 128}, + { DEVID(VIA, APOLLOVP1), 64}, + { DEVID(VIA, APOLLOPRO133X), 64}, + { DEVID(INTEL, 430HX_BRIDGE), 16}, + { DEVID(INTEL, 440BX_BRIDGE), 32}, +}; +#define NUM_BRIDGES (sizeof(host_bridges) / sizeof(host_bridges[0])) + +void ARCH_PCI_HOST_BRIDGE(pciConfigPtr pPCI) +{ + int i; + + for (i = 0; i < NUM_BRIDGES; i++) { + if (pPCI->pci_device_vendor == host_bridges[i].devid) { + pciMaxBusNum = host_bridges[i].maxpcibus; + break; + } + } +} + +#endif /* ARCH_PCI_HOST_BRIDGE */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.4 Mon May 28 14:20:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c Sun Nov 17 13:42:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.4 2001/05/28 18:20:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.10 2002/11/17 18:42:01 alanh Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -52,49 +52,44 @@ #include "xf86_OSlib.h" #include "Pci.h" -#include <asm/unistd.h> - /* * linux platform specific PCI access functions -- using /proc/bus/pci * needs kernel version 2.2.x */ -CARD32 linuxPciCfgRead(PCITAG tag, int off); -void linuxPciCfgWrite(PCITAG, int off, CARD32 val); -void linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); - -pciBusInfo_t linuxPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -/* funcs */ { - linuxPciCfgRead, - linuxPciCfgWrite, - linuxPciCfgSetBits, - pciAddrNOOP, - pciAddrNOOP - }, -/* pciBusPriv */ NULL +static CARD32 linuxPciCfgRead(PCITAG tag, int off); +static void linuxPciCfgWrite(PCITAG, int off, CARD32 val); +static void linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); + +static pciBusFuncs_t linuxFuncs0 = { +/* pciReadLong */ linuxPciCfgRead, +/* pciWriteLong */ linuxPciCfgWrite, +/* pciSetBitsLong */ linuxPciCfgSetBits, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP }; -#if X_BYTE_ORDER == X_BIG_ENDIAN -#define PCI_CPU(val) (((val >> 24) & 0x000000ff) | \ - ((val >> 8) & 0x0000ff00) | \ - ((val << 8) & 0x00ff0000) | \ - ((val << 24) & 0xff000000)) -#else -#define PCI_CPU(val) (val) +static pciBusInfo_t linuxPci0 = { +/* configMech */ PCI_CFG_MECH_OTHER, +/* numDevices */ 32, +/* secondary */ FALSE, +/* primary_bus */ 0, +#ifdef PowerMAX_OS +/* ppc_io_base */ 0, +/* ppc_io_size */ 0, #endif +/* funcs */ &linuxFuncs0, +/* pciBusPriv */ NULL, +/* bridge */ NULL +}; -void +void linuxPciInit() { struct stat st; - if (-1 == stat("/proc/bus/pci",&st)) { + if ((xf86Info.pciFlags == PCIForceNone) || + (-1 == stat("/proc/bus/pci", &st))) { /* when using this as default for all linux architectures, - we'll need a fallback for 2.0 kernels here */ + we'll need a fallback for 2.0 kernels here */ return; } pciNumBuses = 1; @@ -109,14 +104,19 @@ static int lbus,ldev,lfunc,fd = -1; int bus, dev, func; char file[32]; - + bus = PCI_BUS_FROM_TAG(tag); dev = PCI_DEV_FROM_TAG(tag); func = PCI_FUNC_FROM_TAG(tag); if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) { if (fd != -1) close(fd); - sprintf(file,"/proc/bus/pci/%02x/%02x.%1x",bus,dev,func); + if (bus < 256) + sprintf(file, "/proc/bus/pci/%02x/%02x.%1x", + bus, dev, func); + else + sprintf(file, "/proc/bus/pci/%04x/%02x.%1x", + bus, dev, func); fd = open(file,O_RDWR); lbus = bus; ldev = dev; @@ -125,7 +125,7 @@ return fd; } -CARD32 +static CARD32 linuxPciCfgRead(PCITAG tag, int off) { int fd; @@ -138,7 +138,7 @@ return PCI_CPU(val); } -void +static void linuxPciCfgWrite(PCITAG tag, int off, CARD32 val) { int fd; @@ -150,13 +150,12 @@ } } -void +static void linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) { int fd; CARD32 val = 0xffffffff; - return; if (-1 != (fd = linuxPciOpenFile(tag))) { lseek(fd,off,SEEK_SET); read(fd,&val,4); @@ -167,3 +166,419 @@ write(fd,&val,4); } } + +#ifndef INCLUDE_XF86_NO_DOMAIN + +/* + * Compiling the following simply requires the presence of <linux/pci.c>. + * Actually running this is another matter altogether... + * + * This scheme requires that the kernel allow mmap()'ing of a host bridge's I/O + * and memory spaces through its /proc/bus/pci/BUS/DFN entry. Which one is + * determined by a prior ioctl(). + * + * For the sparc64 port, this means 2.4.12 or later. For ppc, this + * functionality is almost, but not quite there yet. Alpha and other kernel + * ports to multi-domain architectures still need to implement this. + * + * This scheme is also predicated on the use of an IOADDRESS compatible type to + * designate I/O addresses. Although IOADDRESS is defined as an unsigned + * integral type, it is actually the virtual address of, i.e. a pointer to, the + * I/O port to access. And so, the inX/outX macros in "compiler.h" need to be + * #define'd appropriately (as is done on SPARC's). + * + * Another requirement to port this scheme to another multi-domain architecture + * is to add the appropriate entries in the pciControllerSizes array below. + * + * TO DO: Address the deleterious reaction some host bridges have to master + * aborts. This is already done for secondary PCI buses, but not yet + * for accesses to primary buses (except for the SPARC port, where + * master aborts are avoided during PCI scans). + */ + +#include <linux/pci.h> + +#ifndef PCIIOC_BASE /* Ioctls for /proc/bus/pci/X/Y nodes. */ +#define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8) + +/* Get controller for PCI device. */ +#define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) +/* Set mmap state to I/O space. */ +#define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) +/* Set mmap state to MEM space. */ +#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) +/* Enable/disable write-combining. */ +#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) + +#endif + +/* This probably shouldn't be Linux-specific */ +static pciConfigPtr +xf86GetPciHostConfigFromTag(PCITAG Tag) +{ + int bus = PCI_BUS_FROM_TAG(Tag); + pciBusInfo_t *pBusInfo; + + while ((bus < pciNumBuses) && (pBusInfo = pciBusInfo[bus])) { + if (bus == pBusInfo->primary_bus) + return pBusInfo->bridge; + bus = pBusInfo->primary_bus; + } + + return NULL; /* Bad data */ +} + +/* + * This is ugly, but until I can extract this information from the kernel, + * it'll have to do. The default I/O space size is 64K, and 4G for memory. + * Anything else needs to go in this table. (PowerPC folk take note.) + * + * Note that Linux/SPARC userland is 32-bit, so 4G overflows to zero here. + * + * Please keep this table in ascending vendor/device order. + */ +static struct pciSizes { + unsigned short vendor, device; + unsigned long io_size, mem_size; +} pciControllerSizes[] = { + { + PCI_VENDOR_SUN, PCI_CHIP_PSYCHO, + 1U << 16, 1U << 31 + }, + { + PCI_VENDOR_SUN, PCI_CHIP_SCHIZO, + 1U << 24, 1U << 31 /* ??? */ + }, + { + PCI_VENDOR_SUN, PCI_CHIP_SABRE, + 1U << 24, (unsigned long)(1ULL << 32) + }, + { + PCI_VENDOR_SUN, PCI_CHIP_HUMMINGBIRD, + 1U << 24, (unsigned long)(1ULL << 32) + } +}; +#define NUM_SIZES (sizeof(pciControllerSizes) / sizeof(pciControllerSizes[0])) + +static unsigned long +linuxGetIOSize(PCITAG Tag) +{ + pciConfigPtr pPCI; + int i; + + /* Find host bridge */ + if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) { + /* Look up vendor/device */ + for (i = 0; i < NUM_SIZES; i++) { + if (pPCI->pci_vendor > pciControllerSizes[i].vendor) + continue; + if (pPCI->pci_vendor < pciControllerSizes[i].vendor) + break; + if (pPCI->pci_device > pciControllerSizes[i].device) + continue; + if (pPCI->pci_device < pciControllerSizes[i].device) + break; + return pciControllerSizes[i].io_size; + } + } + + return 1U << 16; /* Default to 64K */ +} + +static void +linuxGetSizes(PCITAG Tag, unsigned long *io_size, unsigned long *mem_size) +{ + pciConfigPtr pPCI; + int i; + + *io_size = (1U << 16); /* Default to 64K */ + *mem_size = (unsigned long)(1ULL << 32); /* Default to 4G */ + + /* Find host bridge */ + if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) { + /* Look up vendor/device */ + for (i = 0; i < NUM_SIZES; i++) { + if (pPCI->pci_vendor > pciControllerSizes[i].vendor) + continue; + if (pPCI->pci_vendor < pciControllerSizes[i].vendor) + break; + if (pPCI->pci_device > pciControllerSizes[i].device) + continue; + if (pPCI->pci_device < pciControllerSizes[i].device) + break; + *io_size = pciControllerSizes[i].io_size; + *mem_size = pciControllerSizes[i].mem_size; + break; + } + } +} + +int +xf86GetPciDomain(PCITAG Tag) +{ + pciConfigPtr pPCI; + int fd, result; + + pPCI = xf86GetPciHostConfigFromTag(Tag); + + if (pPCI && (result = PCI_DOM_FROM_BUS(pPCI->busnum))) + return result; + + if ((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0)) < 0) + return 0; + + if ((result = ioctl(fd, PCIIOC_CONTROLLER, 0)) < 0) + return 0; + + return result + 1; /* Domain 0 is reserved */ +} + +static pointer +linuxMapPci(int ScreenNum, int Flags, PCITAG Tag, + ADDRESS Base, unsigned long Size, int mmap_ioctl) +{ + do { + pciConfigPtr pPCI; + unsigned char *result; + ADDRESS realBase, Offset; + int fd, mmapflags, prot; + + xf86InitVidMem(); + + pPCI = xf86GetPciHostConfigFromTag(Tag); + + if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0)) < 0) || + (ioctl(fd, mmap_ioctl, 0) < 0)) + break; + +/* Note: IA-64 doesn't compile this and doesn't need to */ +#ifdef __ia64__ + +# ifndef MAP_WRITECOMBINED +# define MAP_WRITECOMBINED 0x00010000 +# endif +# ifndef MAP_NONCACHED +# define MAP_NONCACHED 0x00020000 +# endif + + if (Flags & VIDMEM_FRAMEBUFFER) + mmapflags = MAP_SHARED | MAP_WRITECOMBINED; + else + mmapflags = MAP_SHARED | MAP_NONCACHED + +#else /* !__ia64__ */ + + mmapflags = (Flags & VIDMEM_FRAMEBUFFER) / VIDMEM_FRAMEBUFFER; + + if (ioctl(fd, PCIIOC_WRITE_COMBINE, mmapflags) < 0) + break; + + mmapflags = MAP_SHARED; + +#endif /* ?__ia64__ */ + + /* Align to page boundary */ + realBase = Base & ~(getpagesize() - 1); + Offset = Base - realBase; + + if (Flags & VIDMEM_READONLY) + prot = PROT_READ; + else + prot = PROT_READ | PROT_WRITE; + + result = mmap(NULL, Size + Offset, prot, mmapflags, fd, realBase); + + if (!result || ((pointer)result == MAP_FAILED)) + FatalError("linuxMapPci() mmap failure: %s\n", strerror(errno)); + + xf86MakeNewMapping(ScreenNum, Flags, realBase, Size + Offset, result); + + return result + Offset; + } while (0); + + if (mmap_ioctl == PCIIOC_MMAP_IS_MEM) + return xf86MapVidMem(ScreenNum, Flags, Base, Size); + + return NULL; +} + +pointer +xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, + ADDRESS Base, unsigned long Size) +{ + return linuxMapPci(ScreenNum, Flags, Tag, Base, Size, PCIIOC_MMAP_IS_MEM); +} + +#define MAX_DOMAINS 257 +static pointer DomainMmappedIO[MAX_DOMAINS]; + +/* This has no means of returning failure, so all errors are fatal */ +IOADDRESS +xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, + IOADDRESS Base, unsigned long Size) +{ + int domain = xf86GetPciDomain(Tag); + + if ((domain <= 0) || (domain >= MAX_DOMAINS)) + FatalError("xf86MapDomainIO(): domain out of range\n"); + + /* Permanently map all of I/O space */ + if (!DomainMmappedIO[domain]) { + DomainMmappedIO[domain] = linuxMapPci(ScreenNum, Flags, Tag, + 0, linuxGetIOSize(Tag), + PCIIOC_MMAP_IS_IO); + if (!DomainMmappedIO[domain]) + FatalError("xf86MapDomainIO(): mmap() failure\n"); + } + + return (IOADDRESS)DomainMmappedIO[domain] + Base; +} + +int +xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) +{ + unsigned char *ptr, *src; + ADDRESS offset; + unsigned long size; + int len, pagemask = getpagesize() - 1; + + /* Ensure page boundaries */ + offset = Base & ~pagemask; + size = ((Base + Len + pagemask) & ~pagemask) - offset; + + ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, Tag, offset, size); + + if (!ptr) + return -1; + + /* Using memcpy() here can hang the system */ + src = ptr + (Base - offset); + for (len = Len; len-- > 0;) + *Buf++ = *src++; + + xf86UnMapVidMem(-1, ptr, size); + + return Len; +} + +resPtr +xf86BusAccWindowsFromOS(void) +{ + pciConfigPtr *ppPCI, pPCI; + resPtr pRes = NULL; + resRange range; + unsigned long io_size, mem_size; + int domain; + + if ((ppPCI = xf86scanpci(0))) { + for (; (pPCI = *ppPCI); ppPCI++) { + if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || + (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) + continue; + + domain = xf86GetPciDomain(pPCI->tag); + linuxGetSizes(pPCI->tag, &io_size, &mem_size); + + RANGE(range, 0, (ADDRESS)(mem_size - 1), + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, 0, (IOADDRESS)(io_size - 1), + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + if (domain <= 0) + break; + } + } + + return pRes; +} + +resPtr +xf86PciBusAccWindowsFromOS(void) +{ + pciConfigPtr *ppPCI, pPCI; + resPtr pRes = NULL; + resRange range; + unsigned long io_size, mem_size; + int domain; + + if ((ppPCI = xf86scanpci(0))) { + for (; (pPCI = *ppPCI); ppPCI++) { + if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || + (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) + continue; + + domain = xf86GetPciDomain(pPCI->tag); + linuxGetSizes(pPCI->tag, &io_size, &mem_size); + + RANGE(range, 0, (ADDRESS)(mem_size - 1), + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, 0, (IOADDRESS)(io_size - 1), + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + if (domain <= 0) + break; + } + } + + return pRes; +} + + +resPtr +xf86AccResFromOS(resPtr pRes) +{ + pciConfigPtr *ppPCI, pPCI; + resRange range; + unsigned long io_size, mem_size; + int domain; + + if ((ppPCI = xf86scanpci(0))) { + for (; (pPCI = *ppPCI); ppPCI++) { + if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || + (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) + continue; + + domain = xf86GetPciDomain(pPCI->tag); + linuxGetSizes(pPCI->tag, &io_size, &mem_size); + + /* + * At minimum, the top and bottom resources must be claimed, so + * that resources that are (or appear to be) unallocated can be + * relocated. + */ + RANGE(range, 0x00000000u, 0x0009ffffu, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, 0x000c0000u, 0x000effffu, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, 0x000f0000u, 0x000fffffu, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, (ADDRESS)(mem_size - 1), (ADDRESS)(mem_size - 1), + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, 0x00000000u, 0x00000000u, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, (IOADDRESS)(io_size - 1), (IOADDRESS)(io_size - 1), + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + if (domain <= 0) + break; + } + } + + return pRes; +} + +#endif /* !INCLUDE_XF86_NO_DOMAIN */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c:1.2 --- /dev/null Thu Feb 27 12:32:29 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c Tue Aug 27 18:07:07 2002 @@ -0,0 +1,127 @@ +/* + * Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE + * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project + * shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written + * authorization from the XFree86 Project. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c,v 1.2 2002/08/27 22:07:07 tsi Exp $ */ + +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> +#include <dev/pci/pciio.h> + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86OSpriv.h" + +#include "Pci.h" + +static CARD32 netbsdPciConfRead(PCITAG, int); +static void netbsdPciConfWrite(PCITAG, int, CARD32); +static void netbsdPciSetBits(PCITAG, int, CARD32, CARD32); + +static int devpci = -1; + +static pciBusFuncs_t netbsdFuncs0 = { +/* pciReadLong */ netbsdPciConfRead, +/* pciWriteLong */ netbsdPciConfWrite, +/* pciSetBitsLong */ netbsdPciSetBits, +/* pciAddrHostToBus */ pciAddrNOOP, +/* pciAddrBusToHost */ pciAddrNOOP +}; + +static pciBusInfo_t netbsdPci0 = { +/* configMech */ PCI_CFG_MECH_OTHER, +/* numDevices */ 32, +/* secondary */ FALSE, +/* primary_bus */ 0, +#ifdef PowerMAX_OS +/* io_base */ 0, +/* io_size */ 0, +#endif +/* funcs */ &netbsdFuncs0, +/* pciBusPriv */ NULL, +/* bridge */ NULL +}; + +void +netbsdPciInit() +{ + + devpci = open("/dev/pci0", O_RDWR); + if (devpci == -1) + FatalError("netbsdPciInit: can't open /dev/pci0\n"); + + pciNumBuses = 1; + pciBusInfo[0] = &netbsdPci0; + pciFindFirstFP = pciGenFindFirst; + pciFindNextFP = pciGenFindNext; +} + +static CARD32 +netbsdPciConfRead(PCITAG tag, int reg) +{ + struct pciio_bdf_cfgreg bdfr; + + bdfr.bus = PCI_BUS_FROM_TAG(tag); + bdfr.device = PCI_DEV_FROM_TAG(tag); + bdfr.function = PCI_FUNC_FROM_TAG(tag); + bdfr.cfgreg.reg = reg; + + if (ioctl(devpci, PCI_IOC_BDF_CFGREAD, &bdfr) == -1) + FatalError("netbsdPciConfRead: failed on %d/%d/%d\n", + bdfr.bus, bdfr.device, bdfr.function); + + return (bdfr.cfgreg.val); +} + +static void +netbsdPciConfWrite(PCITAG tag, int reg, CARD32 val) +{ + struct pciio_bdf_cfgreg bdfr; + + bdfr.bus = PCI_BUS_FROM_TAG(tag); + bdfr.device = PCI_DEV_FROM_TAG(tag); + bdfr.function = PCI_FUNC_FROM_TAG(tag); + bdfr.cfgreg.reg = reg; + bdfr.cfgreg.val = val; + + if (ioctl(devpci, PCI_IOC_BDF_CFGWRITE, &bdfr) == -1) + FatalError("netbsdPciConfWrite: failed on %d/%d/%d\n", + bdfr.bus, bdfr.device, bdfr.function); +} + +static void +netbsdPciSetBits(PCITAG tag, int reg, CARD32 mask, CARD32 bits) +{ + CARD32 val; + + val = netbsdPciConfRead(tag, reg); + val = (val & ~mask) | (bits & mask); + netbsdPciConfWrite(tag, reg, val); +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c:1.6 Fri May 11 04:16:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c Tue Aug 27 18:07:07 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.6 2001/05/11 08:16:55 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.9 2002/08/27 22:07:07 tsi Exp $ */ /* * ppcPci.c - PowerPC PCI access functions * @@ -69,21 +69,21 @@ #define MAP_FAILED (pointer)(-1) #endif -void +void ppcPciInit() { #if defined(PowerMAX_OS) extern void pmaxPciInit(void); pmaxPciInit(); - + #else - + extern void motoppcPciInit(void); motoppcPciInit(); - -#endif + +#endif } /* @@ -93,30 +93,35 @@ * as well as the various PowerStack and RiscPC models. All of these * machines support PCI config mechanism #1 and use the std config * address and data regs locations: - * cfg address reg = 0xcf8 (PCI I/O) - * cfg data reg = 0xcfc (PCI I/O) + * cfg address reg = 0xcf8 (PCI I/O) + * cfg data reg = 0xcfc (PCI I/O) * * The moto machines do have different address maps on either side * of the PCI-host bridge though. */ -ADDRESS motoppcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS); -ADDRESS motoppcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS); +static ADDRESS motoppcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS); +static ADDRESS motoppcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS); + +static pciBusFuncs_t motoppcFuncs0 = { +/* pciReadLong */ pciCfgMech1Read, +/* pciWriteLong */ pciCfgMech1Write, +/* pciSetBitsLong */ pciCfgMech1SetBits, +/* pciAddrHostToBus */ motoppcHostAddrToBusAddr, +/* pciAddrBusToHost */ motoppcBusAddrToHostAddr +}; -pciBusInfo_t motoppcPci0 = { -/* configMech */ PCI_CFG_MECH_1, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* ppc_io_base */ 0x80000000, -/* ppc_io_size */ 64 * 1024, -/* funcs */ { - pciCfgMech1Read, - pciCfgMech1Write, - pciCfgMech1SetBits, /* XXX not implemented yet */ - motoppcHostAddrToBusAddr, - motoppcBusAddrToHostAddr - }, -/* pciBusPriv */ NULL +static pciBusInfo_t motoppcPci0 = { +/* configMech */ PCI_CFG_MECH_1, +/* numDevices */ 32, +/* secondary */ FALSE, +/* primary_bus */ 0, +#ifdef PowerMAX_OS +/* ppc_io_base */ 0x80000000, +/* ppc_io_size */ 64 * 1024, +#endif +/* funcs */ &motoppcFuncs0, +/* pciBusPriv */ NULL, +/* bridge */ NULL }; extern volatile unsigned char *ioBase; @@ -149,7 +154,7 @@ extern unsigned long motoPciMemBaseCPU = 0xc0000000; -ADDRESS +static ADDRESS motoppcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { unsigned long addr_l = (unsigned long)addr; @@ -161,7 +166,7 @@ * are seen at [0xc0000000,0xfeffffff] on moto host */ return((ADDRESS)((motoPciMemBaseCPU - motoPciMemBase) + addr_l)); - + else if (addr_l >= 0x80000000) /* * Moto host memory [0,0x7fffffff] is seen at @@ -173,11 +178,11 @@ addr_l); } else return addr; - + /*NOTREACHED*/ } - -ADDRESS + +static ADDRESS motoppcHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { unsigned long addr_l = (unsigned long)addr; @@ -189,19 +194,19 @@ * [0x80000000,0xffffffff] on PCI bus */ return((ADDRESS)(0x80000000 | addr_l)); - + else if (addr_l >= motoPciMemBaseCPU && addr_l < motoPciMemBaseCPU + motoPciMemLen) /* * PCI memory space addresses [0-0x3effffff] are * are seen at [0xc0000000,0xfeffffff] on moto host */ return((ADDRESS)(addr_l - (motoPciMemBaseCPU - motoPciMemBase))); - + else FatalError("motoppcHostAddrToBusAddr: Host addr 0x%x is not accessible to PCI!!!\n", addr_l); } else return addr; - + /*NOTREACHED*/ } Index: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.5 Sun May 27 22:42:30 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c Thu Jan 2 13:11:32 2003 @@ -1,165 +1,1048 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.5 2001/05/28 02:42:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.12 2003/01/02 18:11:32 tsi Exp $ */ /* - * Copyright 1998 by Concurrent Computer Corporation + * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. */ #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "Pci.h" +#include "xf86sbusBus.h" -#if defined(linux) -#include <asm/unistd.h> -#ifndef __NR_pciconfig_read -#define __NR_pciconfig_read 148 -#define __NR_pciconfig_write 149 -#endif -#endif - -/* - * UltraSPARC platform specific PCI access functions - */ -static CARD32 sparcPciCfgRead(PCITAG tag, int off); -static void sparcPciCfgWrite(PCITAG, int off, CARD32 val); -static void sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); - -pciBusInfo_t sparcPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -/* funcs */ { - sparcPciCfgRead, - sparcPciCfgWrite, - sparcPciCfgSetBits, - pciAddrNOOP, - pciAddrNOOP - }, -/* pciBusPriv */ NULL -}; +#if defined(sun) + +extern char *apertureDevName; +static int apertureFd = -1; -void -sparcPciInit() +/* + * A version of xf86MapVidMem() that allows for 64-bit displacements (but not + * sizes). Areas thus mapped can be unmapped by xf86UnMapVidMem(). + */ +static pointer +sparcMapAperture(int iScreen, int Flags, + unsigned long long Base, unsigned long Size) { - pciNumBuses = 1; - pciBusInfo[0] = &sparcPci0; - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; + pointer result; + static int lastFlags = 0; + + /* Assume both Base & Size are multiples of the page size */ + + if ((apertureFd < 0) || (Flags != lastFlags)) { + if (apertureFd >= 0) + close(apertureFd); + lastFlags = Flags; + apertureFd = open(apertureDevName, + (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); + if (apertureFd < 0) + FatalError("sparcMapAperture: open failure: %s\n", + strerror(errno)); + } + + result = mmap(NULL, Size, + (Flags & VIDMEM_READONLY) ? + PROT_READ : (PROT_READ | PROT_WRITE), + MAP_SHARED, apertureFd, (off_t)Base); + + if (result == MAP_FAILED) + FatalError("sparcMapAperture: mmap failure: %s\n", strerror(errno)); + + return result; } +/* + * Platform-specific bus privates. + */ +typedef struct _sparcDomainRec { + unsigned long long io_addr, io_size; + unsigned long long mem_addr, mem_size; + pointer pci, io; + int bus_min, bus_max; + unsigned char dfn_mask[256 / 8]; +} sparcDomainRec, *sparcDomainPtr; + +#define SetBitInMap(bit, map) \ + do { \ + int _bit = (bit); \ + (map)[_bit >> 3] |= 1 << (_bit & 7); \ + } while (0) -#if defined(linux) +#define IsBitSetInMap(bit, map) \ + ((map)[(bit) >> 3] & (1 << ((bit) & 7))) /* - * These funtions will work for Linux, but other OS's - * are likely have a different mechanism for getting at - * PCI configuration space + * Domain 0 is reserved for the one that represents the system as a whole, i.e. + * the one without any resource relocations. */ +#define MAX_DOMAINS (MAX_PCI_BUSES / 256) +static sparcDomainPtr xf86DomainInfo[MAX_DOMAINS]; +static int pciNumDomains = 1; + +/* Variables that are assigned this must be declared volatile */ +#define PciReg(base, tag, off, type) \ + *(volatile type *)(pointer)((char *)(base) + \ + (PCI_TAG_NO_DOMAIN(tag) | (off))) + +/* Generic SPARC PCI access functions */ static CARD32 -sparcPciCfgRead(PCITAG tag, int off) +sparcPciCfgRead32(PCITAG tag, int off) { - int bus, dfn; - CARD32 val = 0xffffffff; + pciBusInfo_t *pBusInfo; + sparcDomainPtr pDomain; + volatile CARD32 result = (CARD32)(-1); /* Must be volatile */ + int bus; + + if ((off >= 0) && (off <= 252) && !(off & 3) && + ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) && + (pBusInfo = pciBusInfo[bus]) && (pDomain = pBusInfo->pciBusPriv) && + (bus >= pDomain->bus_min) && (bus < pDomain->bus_max) && + ((bus > pDomain->bus_min) || + IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) { + result = PciReg(pDomain->pci, tag, off, CARD32); - bus = PCI_BUS_FROM_TAG(tag); - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - return(val); + result = PCI_CPU(result); + } + + return result; } static void -sparcPciCfgWrite(PCITAG tag, int off, CARD32 val) +sparcPciCfgWrite32(PCITAG tag, int off, CARD32 val) { - int bus, dfn; + pciBusInfo_t *pBusInfo; + sparcDomainPtr pDomain; + int bus; + + if ((off < 0) || (off > 252) || (off & 3) || + ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) || + !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) || + (bus < pDomain->bus_min) || (bus >= pDomain->bus_max) || + ((bus == pDomain->bus_min) && + !IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) + return; - bus = PCI_BUS_FROM_TAG(tag); - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); + val = PCI_CPU(val); + PciReg(pDomain->pci, tag, off, CARD32) = val; } static void -sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) +sparcPciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits) { - int bus, dfn; - CARD32 val = 0xffffffff; + CARD32 PciVal; - bus = PCI_BUS_FROM_TAG(tag); - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - val = (val & ~mask) | (bits & mask); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); + PciVal = sparcPciCfgRead32(tag, off); + PciVal &= ~mask; + PciVal |= bits; + sparcPciCfgWrite32(tag, off, PciVal); } -#elif defined(sun) +static pciBusFuncs_t sparcPCIFunctions = +{ + sparcPciCfgRead32, + sparcPciCfgWrite32, + sparcPciCfgSetBits32, + pciAddrNOOP, + pciAddrNOOP +}; /* - * Obviously, these need to be fleshed out, probably using openpromio. + * Sabre-specific versions of the above because of its peculiar access size + * requirements. */ static CARD32 -sparcPciCfgRead(PCITAG tag, int off) +sabrePciCfgRead32(PCITAG tag, int off) +{ + pciBusInfo_t *pBusInfo; + sparcDomainPtr pDomain; + volatile CARD32 result; /* Must be volatile */ + int bus; + + if (PCI_BDEV_FROM_TAG(tag)) + return sparcPciCfgRead32(tag, off); + + if (PCI_FUNC_FROM_TAG(tag) || (off < 0) || (off > 252) || (off & 3) || + ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) || + !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) || + (bus != pDomain->bus_min)) + return (CARD32)(-1); + + if (off < 8) { + result = (PciReg(pDomain->pci, tag, off, CARD16) << 16) | + PciReg(pDomain->pci, tag, off + 2, CARD16); + return PCI_CPU(result); + } + + result = (PciReg(pDomain->pci, tag, off + 3, CARD8) << 24) | + (PciReg(pDomain->pci, tag, off + 2, CARD8) << 16) | + (PciReg(pDomain->pci, tag, off + 1, CARD8) << 8) | + (PciReg(pDomain->pci, tag, off , CARD8) ); + return result; +} + +static void +sabrePciCfgWrite32(PCITAG tag, int off, CARD32 val) +{ + pciBusInfo_t *pBusInfo; + sparcDomainPtr pDomain; + int bus; + + if (PCI_BDEV_FROM_TAG(tag)) + sparcPciCfgWrite32(tag, off, val); + else if (!PCI_FUNC_FROM_TAG(tag) && + (off >= 0) && (off <= 252) && !(off & 3) && + ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) && + (pBusInfo = pciBusInfo[bus]) && + (pDomain = pBusInfo->pciBusPriv) && + (bus == pDomain->bus_min)) { + if (off < 8) { + val = PCI_CPU(val); + PciReg(pDomain->pci, tag, off , CARD16) = val >> 16; + PciReg(pDomain->pci, tag, off + 2, CARD16) = val; + } else { + PciReg(pDomain->pci, tag, off , CARD8) = val; + PciReg(pDomain->pci, tag, off + 1, CARD8) = val >> 8; + PciReg(pDomain->pci, tag, off + 2, CARD8) = val >> 16; + PciReg(pDomain->pci, tag, off + 3, CARD8) = val >> 24; + } + } +} + +static void +sabrePciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits) +{ + CARD32 PciVal; + + PciVal = sabrePciCfgRead32(tag, off); + PciVal &= ~mask; + PciVal |= bits; + sabrePciCfgWrite32(tag, off, PciVal); +} + +static pciBusFuncs_t sabrePCIFunctions = +{ + sabrePciCfgRead32, + sabrePciCfgWrite32, + sabrePciCfgSetBits32, + pciAddrNOOP, + pciAddrNOOP +}; + +static int pagemask; + +/* Scan PROM for all PCI host bridges in the system */ +void +sparcPciInit(void) +{ + int node, node2; + + if (!xf86LinearVidMem()) + return; + + apertureFd = open(apertureDevName, O_RDWR); + if (apertureFd < 0) { + xf86Msg(X_ERROR, + "sparcPciInit: open failure: %s\n", strerror(errno)); + return; + } + + sparcPromInit(); + pagemask = xf86getpagesize() - 1; + + for (node = promGetChild(promRootNode); + node; + node = promGetSibling(node)) { + unsigned long long pci_addr; + sparcDomainRec domain; + sparcDomainPtr pDomain; + pciBusFuncs_p pFunctions; + char *prop_val; + int prop_len, bus; + + prop_val = promGetProperty("name", &prop_len); + /* Some PROMs include the trailing null; some don't */ + if (!prop_val || (prop_len < 3) || (prop_len > 4) || + strcmp(prop_val, "pci")) + continue; + + prop_val = promGetProperty("model", &prop_len); + if (!prop_val || (prop_len <= 0)) { + prop_val = promGetProperty("compatible", &prop_len); + if (!prop_val || (prop_len <= 0)) + continue; + } + + pFunctions = &sparcPCIFunctions; + (void)memset(&domain, 0, sizeof(domain)); + + if (!strncmp("SUNW,sabre", prop_val, prop_len) || + !strncmp("pci108e,a000", prop_val, prop_len) || + !strncmp("pci108e,a001", prop_val, prop_len)) { + /* + * There can only be one "Sabre" bridge in a system. It provides + * PCI configuration space, a 24-bit I/O space and a 32-bit memory + * space, all three of which are at fixed physical CPU addresses. + */ + static Bool sabre_seen = FALSE; + + xf86Msg(X_INFO, + "Sabre or Hummingbird PCI host bridge found (\"%s\")\n", + prop_val); + + /* There can only be one Sabre */ + if (sabre_seen) + continue; + sabre_seen = TRUE; + + /* Get "bus-range" property */ + prop_val = promGetProperty("bus-range", &prop_len); + if (!prop_val || (prop_len != 8) || + (((unsigned int *)prop_val)[0]) || + (((unsigned int *)prop_val)[1] >= 256)) + continue; + + pci_addr = 0x01fe01000000ull; + domain.io_addr = 0x01fe02000000ull; + domain.io_size = 0x000001000000ull; + domain.mem_addr = 0x01ff00000000ull; + domain.mem_size = 0x000100000000ull; + domain.bus_min = 0; /* Always */ + domain.bus_max = ((int *)prop_val)[1]; + + pFunctions = &sabrePCIFunctions; + } else + if (!strncmp("SUNW,psycho", prop_val, prop_len) || + !strncmp("pci108e,8000", prop_val, prop_len)) { + /* + * A "Psycho" host bridge provides two PCI interfaces, each with + * its own 16-bit I/O and 31-bit memory spaces. Both share the + * same PCI configuration space. Here, they are assigned separate + * domain numbers to prevent unintentional I/O and/or memory + * resource conflicts. + */ + xf86Msg(X_INFO, + "Psycho PCI host bridge found (\"%s\")\n", prop_val); + + /* Get "bus-range" property */ + prop_val = promGetProperty("bus-range", &prop_len); + if (!prop_val || (prop_len != 8) || + (((unsigned int *)prop_val)[1] >= 256) || + (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1])) + continue; + + domain.bus_min = ((int *)prop_val)[0]; + domain.bus_max = ((int *)prop_val)[1]; + + /* Get "ranges" property */ + prop_val = promGetProperty("ranges", &prop_len); + if (!prop_val || (prop_len != 112) || + prop_val[0] || (prop_val[28] != 0x01u) || + (prop_val[56] != 0x02u) || (prop_val[84] != 0x03u) || + (((unsigned int *)prop_val)[4] != 0x01000000u) || + ((unsigned int *)prop_val)[5] || + ((unsigned int *)prop_val)[12] || + (((unsigned int *)prop_val)[13] != 0x00010000u) || + ((unsigned int *)prop_val)[19] || + (((unsigned int *)prop_val)[20] != 0x80000000u) || + ((((unsigned int *)prop_val)[11] & ~0x00010000u) != + 0x02000000u) || + (((unsigned int *)prop_val)[18] & ~0x80000000u) || + (((unsigned int *)prop_val)[3] != + ((unsigned int *)prop_val)[10]) || + (((unsigned int *)prop_val)[17] != + ((unsigned int *)prop_val)[24]) || + (((unsigned int *)prop_val)[18] != + ((unsigned int *)prop_val)[25]) || + (((unsigned int *)prop_val)[19] != + ((unsigned int *)prop_val)[26]) || + (((unsigned int *)prop_val)[20] != + ((unsigned int *)prop_val)[27])) + continue; + + /* Use memcpy() to avoid alignment issues */ + (void)memcpy(&pci_addr, prop_val + 12, + sizeof(pci_addr)); + (void)memcpy(&domain.io_addr, prop_val + 40, + sizeof(domain.io_addr)); + (void)memcpy(&domain.mem_addr, prop_val + 68, + sizeof(domain.mem_addr)); + + domain.io_size = 0x000000010000ull; + domain.mem_size = 0x000080000000ull; + } else + if (!strncmp("SUNW,schizo", prop_val, prop_len) || + !strncmp("pci108e,8001", prop_val, prop_len)) { + /* + * I have no docs on the "Schizo", but judging from the Linux + * kernel, it also provides two PCI domains. Each PCI + * configuration space is the usual 16M in size, followed by a + * variable-length I/O space. Each domain also provides a + * variable-length memory space. The kernel seems to think the I/O + * spaces are 16M long, and the memory spaces, 2G, but these + * assumptions are actually only present in source code comments. + * Sun has, however, confirmed to me the validity of these + * assumptions. + */ + volatile unsigned long long mem_match, mem_mask, io_match, io_mask; + unsigned long Offset; + pointer pSchizo; + + xf86Msg(X_INFO, + "Schizo PCI host bridge found (\"%s\")\n", prop_val); + + /* Get "bus-range" property */ + prop_val = promGetProperty("bus-range", &prop_len); + if (!prop_val || (prop_len != 8) || + (((unsigned int *)prop_val)[1] >= 256) || + (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1])) + continue; + + domain.bus_min = ((int *)prop_val)[0]; + domain.bus_max = ((int *)prop_val)[1]; + + /* Get "reg" property */ + prop_val = promGetProperty("reg", &prop_len); + if (!prop_val || (prop_len != 48)) + continue; + + /* Temporarily map some of Schizo's registers */ + pSchizo = sparcMapAperture(-1, VIDMEM_MMIO, + ((unsigned long long *)prop_val)[2] - 0x000000010000ull, + 0x00010000ul); + + /* Determine where PCI config, I/O and memory spaces reside */ + if ((((unsigned long long *)prop_val)[0] & 0x000000700000ull) == + 0x000000600000ull) + Offset = 0x0040; + else + Offset = 0x0060; + + mem_match = PciReg(pSchizo, 0, Offset, unsigned long long); + mem_mask = PciReg(pSchizo, 0, Offset + 8, unsigned long long); + io_match = PciReg(pSchizo, 0, Offset + 16, unsigned long long); + io_mask = PciReg(pSchizo, 0, Offset + 24, unsigned long long); + + /* Unmap Schizo registers */ + xf86UnMapVidMem(-1, pSchizo, 0x00010000ul); + + /* Calculate sizes */ + mem_mask = (((mem_mask - 1) ^ mem_mask) >> 1) + 1; + io_mask = (((io_mask - 1) ^ io_mask ) >> 1) + 1; + + if (io_mask <= 0x000001000000ull) /* Nothing left for I/O */ + continue; + + domain.mem_addr = mem_match & ~0x8000000000000000ull; + domain.mem_size = mem_mask; + pci_addr = io_match & ~0x8000000000000000ull; + domain.io_addr = pci_addr + 0x0000000001000000ull; + domain.io_size = io_mask - 0x0000000001000000ull; + } else { + xf86Msg(X_WARNING, "Unknown PCI host bridge: \"%s\"\n", prop_val); + continue; + } + + /* Only map as much PCI configuration as we need */ + domain.pci = (char *)sparcMapAperture(-1, VIDMEM_MMIO, + pci_addr + PCI_MAKE_TAG(domain.bus_min, 0, 0), + PCI_MAKE_TAG(domain.bus_max - domain.bus_min + 1, 0, 0)) - + PCI_MAKE_TAG(domain.bus_min, 0, 0); + + /* Allocate a domain record */ + pDomain = xnfalloc(sizeof(sparcDomainRec)); + *pDomain = domain; + + /* + * Allocate and prime pciBusInfo records. These are allocated one at a + * time because those for empty buses are eventually released. + */ + bus = pDomain->bus_min = + PCI_MAKE_BUS(pciNumDomains, domain.bus_min); + pciNumBuses = pDomain->bus_max = + PCI_MAKE_BUS(pciNumDomains, domain.bus_max) + 1; + + pciBusInfo[bus] = xnfcalloc(1, sizeof(pciBusInfo_t)); + pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER; + pciBusInfo[bus]->numDevices = 32; + pciBusInfo[bus]->funcs = pFunctions; + pciBusInfo[bus]->pciBusPriv = pDomain; + while (++bus < pciNumBuses) { + pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); + *(pciBusInfo[bus]) = *(pciBusInfo[bus - 1]); + pciBusInfo[bus]->funcs = &sparcPCIFunctions; + } + + /* Next domain, please... */ + xf86DomainInfo[pciNumDomains++] = pDomain; + + /* + * OK, enough of the straight-forward stuff. Time to deal with some + * brokenness... + * + * The PCI specs require that when a bus transaction remains unclaimed + * for too long, the master entity on that bus is to cancel the + * transaction it issued or passed on with a master abort. Two + * outcomes are possible: + * + * - the master abort can be treated as an error that is propogated + * back through the bus tree to the entity that ultimately originated + * the transaction; or + * - the transaction can be allowed to complete normally, which means + * that writes are ignored and reads return all ones. + * + * In the first case, if the CPU happens to be at the tail end of the + * tree path through one of its host bridges, it will be told there is + * a hardware mal-function, despite being generated by software. + * + * For a software function (be it firmware, OS or userland application) + * to determine how a PCI bus tree is populated, it must be able to + * detect when master aborts occur. Obviously, PCI discovery is much + * simpler when master aborts are allowed to complete normally. + * + * Unfortunately, a number of non-Intel PCI implementations have chosen + * to treat master aborts as severe errors. The net effect is to + * cripple PCI discovery algorithms in userland. + * + * On SPARCs, master aborts cause a number of different behaviours, + * including delivering a signal to the userland application, rebooting + * the system, "dropping down" to firmware, or, worst of all, bus + * lockouts. Even in the first case, the SIGBUS signal that is + * eventually generated isn't delivered in a timely enough fashion to + * allow an application to reliably detect the master abort that + * ultimately caused it. + * + * This can be somewhat mitigated. On all architectures, master aborts + * that occur on secondary buses can be forced to complete normally + * because the PCI-to-PCI bridges that serve them are governed by an + * industry-wide specification. (This is just another way of saying + * that whatever justification there might be for erroring out master + * aborts is deemed by the industry as insufficient to generate more + * PCI non-compliance than there already is...) + * + * This leaves us with master aborts that occur on primary buses. + * There is no specification for host-to-PCI bridges. Bridges used in + * SPARCs can be told to ignore all PCI errors, but not specifically + * master aborts. Not only is this too coarse-grained, but + * master-aborted read transactions on the primary bus end up returning + * garbage rather than all ones. + * + * I have elected to work around this the only way I can think of doing + * so right now. The following scans an additional PROM level and + * builds a device/function map for the primary bus. I can only hope + * this PROM information represents all devices on the primary bus, + * rather than only a subset of them. + * + * Master aborts are useful in other ways too, that are not addressed + * here. These include determining whether or not a domain provides + * VGA, or if a PCI device actually implements PCI disablement. + * + * --- TSI @ UQV 2001.09.19 + */ + for (node2 = promGetChild(node); + node2; + node2 = promGetSibling(node2)) { + /* Get "reg" property */ + prop_val = promGetProperty("reg", &prop_len); + if (!prop_val || (prop_len % 20)) + continue; + + /* + * It's unnecessary to scan the entire "reg" property, but I'll do + * so anyway. + */ + prop_len /= 20; + for (; prop_len--; prop_val += 20) + SetBitInMap(PCI_DFN_FROM_TAG(*(PCITAG *)prop_val), + pDomain->dfn_mask); + } + + /* Assume the host bridge is device 0, function 0 on its bus */ + SetBitInMap(0, pDomain->dfn_mask); + } + + sparcPromClose(); + + close(apertureFd); + apertureFd = -1; +} + +#ifndef INCLUDE_XF86_NO_DOMAIN + +int +xf86GetPciDomain(PCITAG Tag) +{ + return PCI_DOM_FROM_TAG(Tag); +} + +pointer +xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, + ADDRESS Base, unsigned long Size) +{ + sparcDomainPtr pDomain; + pointer result; + int domain = PCI_DOM_FROM_TAG(Tag); + + if ((domain <= 0) || (domain >= pciNumDomains) || + !(pDomain = xf86DomainInfo[domain]) || + (((unsigned long long)Base + (unsigned long long)Size) > + pDomain->mem_size)) + FatalError("xf86MapDomainMemory() called with invalid parameters.\n"); + + result = sparcMapAperture(ScreenNum, Flags, pDomain->mem_addr + Base, Size); + + if (apertureFd >= 0) { + close(apertureFd); + apertureFd = -1; + } + + return result; +} + +IOADDRESS +xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, + IOADDRESS Base, unsigned long Size) +{ + sparcDomainPtr pDomain; + int domain = PCI_DOM_FROM_TAG(Tag); + + if ((domain <= 0) || (domain >= pciNumDomains) || + !(pDomain = xf86DomainInfo[domain]) || + (((unsigned long long)Base + (unsigned long long)Size) > + pDomain->io_size)) + FatalError("xf86MapDomainIO() called with invalid parameters.\n"); + + /* Permanently map all of I/O space */ + if (!pDomain->io) { + pDomain->io = sparcMapAperture(ScreenNum, Flags, + pDomain->io_addr, pDomain->io_size); + + if (apertureFd >= 0) { + close(apertureFd); + apertureFd = -1; + } + } + + return (IOADDRESS)pDomain->io + Base; +} + +int +xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) +{ + unsigned char *ptr, *src; + ADDRESS offset; + unsigned long size; + int len; + + /* Ensure page boundaries */ + offset = Base & ~pagemask; + size = ((Base + Len + pagemask) & ~pagemask) - offset; + + ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, Tag, offset, size); + + /* Using memcpy() here hangs the system */ + src = ptr + (Base - offset); + for (len = Len; len-- > 0;) + *Buf++ = *src++; + + xf86UnMapVidMem(-1, ptr, size); + + return Len; +} + +resPtr +xf86BusAccWindowsFromOS(void) +{ + sparcDomainPtr pDomain; + resPtr pRes = NULL; + resRange range; + int domain; + + for (domain = 1; domain < pciNumDomains; domain++) { + if (!(pDomain = xf86DomainInfo[domain])) + continue; + + RANGE(range, 0, pDomain->mem_size - 1, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, 0, pDomain->io_size - 1, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + } + + return pRes; +} + +resPtr +xf86PciBusAccWindowsFromOS(void) { - FatalError("sparcPciCfgRead() called\n"); + sparcDomainPtr pDomain; + resPtr pRes = NULL; + resRange range; + int domain; + + for (domain = 1; domain < pciNumDomains; domain++) { + if (!(pDomain = xf86DomainInfo[domain])) + continue; + + RANGE(range, 0, pDomain->mem_size - 1, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); - return 0; /* Gd'ole gcc... */ + RANGE(range, 0, pDomain->io_size - 1, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + } + + return pRes; } +resPtr +xf86AccResFromOS(resPtr pRes) +{ + sparcDomainPtr pDomain; + resRange range; + int domain; + + for (domain = 1; domain < pciNumDomains; domain++) { + if (!(pDomain = xf86DomainInfo[domain])) + continue; + + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ + RANGE(range, 0x00000000u, 0x0009ffffu, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, 0x000c0000u, 0x000effffu, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, 0x000f0000u, 0x000fffffu, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, pDomain->mem_size - 1, pDomain->mem_size - 1, + RANGE_TYPE(ResExcMemBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + + RANGE(range, 0x00000000u, 0x00000000u, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + RANGE(range, pDomain->io_size - 1, pDomain->io_size - 1, + RANGE_TYPE(ResExcIoBlock, domain)); + pRes = xf86AddResToList(pRes, &range, -1); + } + + return pRes; +} + +#endif /* !INCLUDE_XF86_NO_DOMAIN */ + +#endif /* defined(sun) */ + +#if defined(ARCH_PCI_PCI_BRIDGE) + +/* Definitions specific to Sun's APB P2P bridge (a.k.a. Simba) */ +#define APB_IO_ADDRESS_MAP 0xDE +#define APB_MEM_ADDRESS_MAP 0xDF + +/* + * Simba's can only occur on bus 0. Furthermore, Simba's must have a non-zero + * device/function number because the Sabre interface they must connect to + * occupies the 0:0:0 slot. Also, there can be only one Sabre interface in the + * system, and therefore, only one Simba function can route any particular + * resource. Thus, it is appropriate to use a single set of static variables + * to hold the tag of the Simba function routing a VGA resource range at any + * one time, and to test these variables for non-zero to determine whether or + * not the Sabre would master-abort a VGA access (and kill the system). + * + * The trick is to determine when it is safe to re-route VGA, because doing so + * re-routes much more. + */ +static PCITAG simbavgaIOTag = 0, simbavgaMemTag = 0; +static Bool simbavgaRoutingAllow = TRUE; + +/* + * Scan the bus subtree rooted at 'bus' for a non-display device that might be + * decoding the bottom 2 MB of I/O space and/or the bottom 512 MB of memory + * space. Reset simbavgaRoutingAllow if such a device is found. + * + * XXX For now, this is very conservative and should be made less so as the + * need arises. + */ static void -sparcPciCfgWrite(PCITAG tag, int off, CARD32 val) +simbaCheckBus(CARD16 pcicommand, int bus) { - FatalError("sparcPciCfbWrite() called\n"); + pciConfigPtr pPCI, *ppPCI = xf86scanpci(0); + + while ((pPCI = *ppPCI++)) { + if (pPCI->busnum < bus) + continue; + if (pPCI->busnum > bus) + break; + + /* XXX Assume all devices respect PCI disablement */ + if (!(pcicommand & pPCI->pci_command)) + continue; + + /* XXX This doesn't deal with mis-advertised classes */ + switch (pPCI->pci_base_class) { + case PCI_CLASS_PREHISTORIC: + if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) + continue; /* Ignore VGA */ + break; + + case PCI_CLASS_DISPLAY: + continue; + + case PCI_CLASS_BRIDGE: + switch (pPCI->pci_sub_class) { + case PCI_SUBCLASS_BRIDGE_PCI: + case PCI_SUBCLASS_BRIDGE_CARDBUS: + /* Scan secondary bus */ + /* XXX First check bridge routing? */ + simbaCheckBus(pcicommand & pPCI->pci_command, + PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, + pPCI->tag)); + if (!simbavgaRoutingAllow) + return; + + default: + break; + } + + default: + break; + } + + /* + * XXX We could check the device's bases here, but PCI doesn't limit + * the device's decoding to them. + */ + + simbavgaRoutingAllow = FALSE; + break; + } } +static pciConfigPtr +simbaVerifyBus(int bus) +{ + pciConfigPtr pPCI; + if ((bus < 0) || (bus >= pciNumBuses) || + !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || + (pPCI->pci_device_vendor != DEVID(SUN, SIMBA))) + return NULL; + + return pPCI; +} + +static CARD16 +simbaControlBridge(int bus, CARD16 mask, CARD16 value) +{ + pciConfigPtr pPCI; + CARD16 current = 0, tmp; + CARD8 iomap, memmap; + + if ((pPCI = simbaVerifyBus(bus))) { + /* + * The Simba does not implement VGA enablement as described in the P2P + * spec. It does however route I/O and memory in large enough chunks + * so that we can determine were VGA resources would be routed + * (including ISA VGA I/O aliases). We can allow changes to that + * routing only under certain circumstances. + */ + iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP); + memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP); + if (iomap & memmap & 0x01) { + current |= PCI_PCI_BRIDGE_VGA_EN; + if ((mask & PCI_PCI_BRIDGE_VGA_EN) && + !(value & PCI_PCI_BRIDGE_VGA_EN)) { + if (!simbavgaRoutingAllow) { + xf86MsgVerb(X_WARNING, 3, "Attempt to disable VGA routing" + " through Simba at %x:%x:%x disallowed.\n", + pPCI->busnum, pPCI->devnum, pPCI->funcnum); + value |= PCI_PCI_BRIDGE_VGA_EN; + } else { + pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP, + iomap & ~0x01); + pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP, + memmap & ~0x01); + simbavgaIOTag = simbavgaMemTag = 0; + } + } + } else { + if (mask & value & PCI_PCI_BRIDGE_VGA_EN) { + if (!simbavgaRoutingAllow) { + xf86MsgVerb(X_WARNING, 3, "Attempt to enable VGA routing" + " through Simba at %x:%x:%x disallowed.\n", + pPCI->busnum, pPCI->devnum, pPCI->funcnum); + value &= ~PCI_PCI_BRIDGE_VGA_EN; + } else { + if (pPCI->tag != simbavgaIOTag) { + if (simbavgaIOTag) { + tmp = pciReadByte(simbavgaIOTag, + APB_IO_ADDRESS_MAP); + pciWriteByte(simbavgaIOTag, APB_IO_ADDRESS_MAP, + tmp & ~0x01); + } + + pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP, + iomap | 0x01); + simbavgaIOTag = pPCI->tag; + } + + if (pPCI->tag != simbavgaMemTag) { + if (simbavgaMemTag) { + tmp = pciReadByte(simbavgaMemTag, + APB_MEM_ADDRESS_MAP); + pciWriteByte(simbavgaMemTag, APB_MEM_ADDRESS_MAP, + tmp & ~0x01); + } + + pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP, + memmap | 0x01); + simbavgaMemTag = pPCI->tag; + } + } + } + } + + /* Move on to master abort failure enablement (as per P2P spec) */ + tmp = pciReadWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG); + current |= tmp; + if (tmp & PCI_PCI_BRIDGE_MASTER_ABORT_EN) { + if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && + !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) + pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG, + tmp & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); + } else { + if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) + pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG, + tmp | PCI_PCI_BRIDGE_MASTER_ABORT_EN); + } + + /* Insert emulation of other P2P controls here */ + } + + return (current & ~mask) | (value & mask); +} + static void -sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) +simbaGetBridgeResources(int bus, + pointer *ppIoRes, + pointer *ppMemRes, + pointer *ppPmemRes) +{ + pciConfigPtr pPCI = simbaVerifyBus(bus); + resRange range; + int i; + + if (!pPCI) + return; + + if (ppIoRes) { + xf86FreeResList(*ppIoRes); + *ppIoRes = NULL; + + if (pPCI->pci_command & PCI_CMD_IO_ENABLE) { + unsigned char iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP); + if (simbavgaRoutingAllow) + iomap |= 0x01; + for (i = 0; i < 8; i++) { + if (iomap & (1 << i)) { + RANGE(range, i << 21, ((i + 1) << 21) - 1, + RANGE_TYPE(ResExcIoBlock, + xf86GetPciDomain(pPCI->tag))); + *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); + } + } + } + } + + if (ppMemRes) { + xf86FreeResList(*ppMemRes); + *ppMemRes = NULL; + + if (pPCI->pci_command & PCI_CMD_MEM_ENABLE) { + unsigned char memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP); + if (simbavgaRoutingAllow) + memmap |= 0x01; + for (i = 0; i < 8; i++) { + if (memmap & (1 << i)) { + RANGE(range, i << 29, ((i + 1) << 29) - 1, + RANGE_TYPE(ResExcMemBlock, + xf86GetPciDomain(pPCI->tag))); + *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); + } + } + } + } + + if (ppPmemRes) { + xf86FreeResList(*ppPmemRes); + *ppPmemRes = NULL; + } +} + +void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI) { - FatalError("sparcPciCfgSetBits() called\n"); + static pciBusFuncs_t simbaBusFuncs; + pciBusInfo_t *pBusInfo; + CARD16 pcicommand; + + if (pPCI->pci_device_vendor != DEVID(SUN, SIMBA)) + return; + + pBusInfo = pPCI->businfo; + + simbaBusFuncs = *(pBusInfo->funcs); + simbaBusFuncs.pciControlBridge = simbaControlBridge; + simbaBusFuncs.pciGetBridgeResources = simbaGetBridgeResources; + + pBusInfo->funcs = &simbaBusFuncs; + + if (!simbavgaRoutingAllow) + return; + + pcicommand = 0; + + if (pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP) & 0x01) { + pcicommand |= PCI_CMD_IO_ENABLE; + simbavgaIOTag = pPCI->tag; + } + + if (pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP) & 0x01) { + pcicommand |= PCI_CMD_MEM_ENABLE; + simbavgaMemTag = pPCI->tag; + } + + if (!pcicommand) + return; + + simbaCheckBus(pcicommand, + PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, pPCI->tag)); } -#endif +#endif /* defined(ARCH_PCI_PCI_BRIDGE) */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.30 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.36 --- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.30 Sat Oct 27 23:34:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h Tue Feb 18 10:42:12 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.30 2001/10/28 03:34:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.36 2003/02/18 15:42:12 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -54,18 +54,18 @@ * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * copyright holder(s) make(s) no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ @@ -82,33 +82,35 @@ #include "misc.h" /* - * PCI cfg space definitions (e.g. stuff right out of the PCI spec + * PCI cfg space definitions (e.g. stuff right out of the PCI spec) */ + /* Device identification register */ #define PCI_ID_REG 0x00 /* Command and status register */ -#define PCI_CMD_STAT_REG 0x04 -#define PCI_CMD_BASE_REG 0x10 -#define PCI_CMD_BIOS_REG 0x30 -#define PCI_CMD_MASK 0xffff -#define PCI_CMD_IO_ENABLE 0x01 -#define PCI_CMD_MEM_ENABLE 0x02 -#define PCI_CMD_MASTER_ENABLE 0x04 +#define PCI_CMD_STAT_REG 0x04 +#define PCI_CMD_BASE_REG 0x10 +#define PCI_CMD_BIOS_REG 0x30 +#define PCI_CMD_MASK 0xffff +#define PCI_CMD_IO_ENABLE 0x01 +#define PCI_CMD_MEM_ENABLE 0x02 +#define PCI_CMD_MASTER_ENABLE 0x04 #define PCI_CMD_SPECIAL_ENABLE 0x08 -#define PCI_CMD_INVALIDATE_ENABLE 0x10 -#define PCI_CMD_PALETTE_ENABLE 0x20 -#define PCI_CMD_PARITY_ENABLE 0x40 -#define PCI_CMD_STEPPING_ENABLE 0x80 -#define PCI_CMD_SERR_ENABLE 0x100 -#define PCI_CMD_BACKTOBACK_ENABLE 0x200 -#define PCI_CMD_BIOS_ENABLE 0x01 +#define PCI_CMD_INVALIDATE_ENABLE 0x10 +#define PCI_CMD_PALETTE_ENABLE 0x20 +#define PCI_CMD_PARITY_ENABLE 0x40 +#define PCI_CMD_STEPPING_ENABLE 0x80 +#define PCI_CMD_SERR_ENABLE 0x100 +#define PCI_CMD_BACKTOBACK_ENABLE 0x200 +#define PCI_CMD_BIOS_ENABLE 0x01 /* base class */ -#define PCI_CLASS_REG 0x08 -#define PCI_CLASS_MASK 0xff000000 -#define PCI_CLASS_SHIFT 24 -#define PCI_CLASS_EXTRACT(x) (((x) & PCI_CLASS_MASK) >> PCI_CLASS_SHIFT) +#define PCI_CLASS_REG 0x08 +#define PCI_CLASS_MASK 0xff000000 +#define PCI_CLASS_SHIFT 24 +#define PCI_CLASS_EXTRACT(x) \ + (((x) & PCI_CLASS_MASK) >> PCI_CLASS_SHIFT) /* base class values */ #define PCI_CLASS_PREHISTORIC 0x00 @@ -134,7 +136,8 @@ /* sub class */ #define PCI_SUBCLASS_MASK 0x00ff0000 #define PCI_SUBCLASS_SHIFT 16 -#define PCI_SUBCLASS_EXTRACT(x) (((x) & PCI_SUBCLASS_MASK) >> PCI_SUBCLASS_SHIFT) +#define PCI_SUBCLASS_EXTRACT(x) \ + (((x) & PCI_SUBCLASS_MASK) >> PCI_SUBCLASS_SHIFT) /* Sub class values */ /* 0x00 prehistoric subclasses */ @@ -180,7 +183,7 @@ #define PCI_SUBCLASS_BRIDGE_CARDBUS 0x07 #define PCI_SUBCLASS_BRIDGE_RACEWAY 0x08 #define PCI_SUBCLASS_BRIDGE_MISC 0x80 -#define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01 +#define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01 /* 0x07 communications controller subclasses */ #define PCI_SUBCLASS_COMMUNICATIONS_SERIAL 0x00 @@ -257,105 +260,126 @@ /* Interrupt configration register */ #define PCI_INTERRUPT_REG 0x3c -#define PCI_INTERRUPT_PIN_MASK 0x0000ff00 -#define PCI_INTERRUPT_PIN_EXTRACT(x) ((((x) & PCI_INTERRUPT_PIN_MASK) >> 8) & 0xff) -#define PCI_INTERRUPT_PIN_NONE 0x00 -#define PCI_INTERRUPT_PIN_A 0x01 -#define PCI_INTERRUPT_PIN_B 0x02 -#define PCI_INTERRUPT_PIN_C 0x03 -#define PCI_INTERRUPT_PIN_D 0x04 - -#define PCI_INTERRUPT_LINE_MASK 0x000000ff -#define PCI_INTERRUPT_LINE_EXTRACT(x) ((((x) & PCI_INTERRUPT_LINE_MASK) >> 0) & 0xff) -#define PCI_INTERRUPT_LINE_INSERT(x,v) (((x) & ~PCI_INTERRUPT_LINE_MASK) | ((v) << 0)) +#define PCI_INTERRUPT_PIN_MASK 0x0000ff00 +#define PCI_INTERRUPT_PIN_EXTRACT(x) \ + ((((x) & PCI_INTERRUPT_PIN_MASK) >> 8) & 0xff) +#define PCI_INTERRUPT_PIN_NONE 0x00 +#define PCI_INTERRUPT_PIN_A 0x01 +#define PCI_INTERRUPT_PIN_B 0x02 +#define PCI_INTERRUPT_PIN_C 0x03 +#define PCI_INTERRUPT_PIN_D 0x04 + +#define PCI_INTERRUPT_LINE_MASK 0x000000ff +#define PCI_INTERRUPT_LINE_EXTRACT(x) \ + ((((x) & PCI_INTERRUPT_LINE_MASK) >> 0) & 0xff) +#define PCI_INTERRUPT_LINE_INSERT(x,v) \ + (((x) & ~PCI_INTERRUPT_LINE_MASK) | ((v) << 0)) /* Base registers */ -#define PCI_MAP_REG_START 0x10 -#define PCI_MAP_REG_END 0x28 +#define PCI_MAP_REG_START 0x10 +#define PCI_MAP_REG_END 0x28 #define PCI_MAP_ROM_REG 0x30 -#define PCI_MAP_MEMORY 0x00000000 -#define PCI_MAP_IO 0x00000001 +#define PCI_MAP_MEMORY 0x00000000 +#define PCI_MAP_IO 0x00000001 -#define PCI_MAP_MEMORY_TYPE 0x00000007 -#define PCI_MAP_IO_TYPE 0x00000003 +#define PCI_MAP_MEMORY_TYPE 0x00000007 +#define PCI_MAP_IO_TYPE 0x00000003 -#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000 -#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002 -#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004 -#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006 -#define PCI_MAP_MEMORY_CACHABLE 0x00000008 +#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000 +#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002 +#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004 +#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006 +#define PCI_MAP_MEMORY_CACHABLE 0x00000008 #define PCI_MAP_MEMORY_ATTR_MASK 0x0000000e -#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0 +#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0 #define PCI_MAP_IO_ATTR_MASK 0x00000003 -#define PCI_MAP_IS_IO(b) ((b) & PCI_MAP_IO) -#define PCI_MAP_IS_MEM(b) (!PCI_MAP_IS_IO(b)) +#define PCI_MAP_IS_IO(b) ((b) & PCI_MAP_IO) +#define PCI_MAP_IS_MEM(b) (!PCI_MAP_IS_IO(b)) -#define PCI_MAP_IS64BITMEM(b) \ +#define PCI_MAP_IS64BITMEM(b) \ (((b) & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_64BIT) -#define PCIGETMEMORY(b) ((b) & PCI_MAP_MEMORY_ADDRESS_MASK) -#define PCIGETMEMORY64HIGH(b) (*((CARD32*)&b + 1)) -#define PCIGETMEMORY64(b) (PCIGETMEMORY(b) | ((CARD64)PCIGETMEMORY64HIGH(b) << 32)) +#define PCIGETMEMORY(b) ((b) & PCI_MAP_MEMORY_ADDRESS_MASK) +#define PCIGETMEMORY64HIGH(b) (*((CARD32*)&b + 1)) +#define PCIGETMEMORY64(b) \ + (PCIGETMEMORY(b) | ((CARD64)PCIGETMEMORY64HIGH(b) << 32)) -#define PCI_MAP_IO_ADDRESS_MASK 0xfffffffc +#define PCI_MAP_IO_ADDRESS_MASK 0xfffffffc -#define PCIGETIO(b) ((b) & PCI_MAP_IO_ADDRESS_MASK) +#define PCIGETIO(b) ((b) & PCI_MAP_IO_ADDRESS_MASK) #define PCI_MAP_ROM_DECODE_ENABLE 0x00000001 #define PCI_MAP_ROM_ADDRESS_MASK 0xfffff800 -#define PCIGETROM(b) ((b) & PCI_MAP_ROM_ADDRESS_MASK) +#define PCIGETROM(b) ((b) & PCI_MAP_ROM_ADDRESS_MASK) /* PCI-PCI bridge mapping registers */ -#define PCI_PCI_BRIDGE_BUS_REG 0x18 -#define PCI_SUBORDINATE_BUS_MASK 0x00ff0000 -#define PCI_SECONDARY_BUS_MASK 0x0000ff00 -#define PCI_PRIMARY_BUS_MASK 0x000000ff - -#define PCI_SUBORDINATE_BUS_EXTRACT(x) (((x) >> 16) & 0xff) -#define PCI_SECONDARY_BUS_EXTRACT(x) (((x) >> 8) & 0xff) -#define PCI_PRIMARY_BUS_EXTRACT(x) (((x) ) & 0xff) - -#define PCI_PRIMARY_BUS_INSERT(x, y) (((x) & ~PCI_PRIMARY_BUS_MASK) | ((y) << 0)) -#define PCI_SECONDARY_BUS_INSERT(x, y) (((x) & ~PCI_SECONDARY_BUS_MASK) | ((y) << 8)) -#define PCI_SUBORDINATE_BUS_INSERT(x, y) (((x) & ~PCI_SUBORDINATE_BUS_MASK) | (( y) << 16)) - -#define PCI_PCI_BRIDGE_IO_REG 0x1c -#define PCI_PCI_BRIDGE_MEM_REG 0x20 -#define PCI_PCI_BRIDGE_PMEM_REG 0x24 - -#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xFF00) -#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xFF00) - -#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFFF0000) -#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) - -#define PCI_PCI_BRIDGE_CONTROL_REG 0x3E -#define PCI_PCI_BRIDGE_PARITY_EN 0x01 -#define PCI_PCI_BRIDGE_SERR_EN 0x02 -#define PCI_PCI_BRIDGE_ISA_EN 0x04 -#define PCI_PCI_BRIDGE_VGA_EN 0x08 -#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 -#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 -#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 +#define PCI_PCI_BRIDGE_BUS_REG 0x18 +#define PCI_SUBORDINATE_BUS_MASK 0x00ff0000 +#define PCI_SECONDARY_BUS_MASK 0x0000ff00 +#define PCI_PRIMARY_BUS_MASK 0x000000ff + +#define PCI_PCI_BRIDGE_IO_REG 0x1c +#define PCI_PCI_BRIDGE_MEM_REG 0x20 +#define PCI_PCI_BRIDGE_PMEM_REG 0x24 + +#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xFF00) +#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xFF00) + +#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFFF0000) +#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) + +#define PCI_PCI_BRIDGE_CONTROL_REG 0x3E +#define PCI_PCI_BRIDGE_PARITY_EN 0x01 +#define PCI_PCI_BRIDGE_SERR_EN 0x02 +#define PCI_PCI_BRIDGE_ISA_EN 0x04 +#define PCI_PCI_BRIDGE_VGA_EN 0x08 +#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 +#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 +#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 +/* header type 2 extensions */ +#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ +#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 +#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 + +#define PCI_CB_SEC_STATUS_REG 0x16 /* Secondary status */ +#define PCI_CB_PRIMARY_BUS_REG 0x18 /* PCI bus number */ +#define PCI_CB_CARD_BUS_REG 0x19 /* CardBus bus number */ +#define PCI_CB_SUBORDINATE_BUS_REG 0x1a /* Subordinate bus number */ +#define PCI_CB_LATENCY_TIMER_REG 0x1b /* CardBus latency timer */ +#define PCI_CB_MEM_BASE_0_REG 0x1c +#define PCI_CB_MEM_LIMIT_0_REG 0x20 +#define PCI_CB_MEM_BASE_1_REG 0x24 +#define PCI_CB_MEM_LIMIT_1_REG 0x28 +#define PCI_CB_IO_BASE_0_REG 0x2c +#define PCI_CB_IO_LIMIT_0_REG 0x30 +#define PCI_CB_IO_BASE_1_REG 0x34 +#define PCI_CB_IO_LIMIT_1_REG 0x38 +#define PCI_CB_BRIDGE_CONTROL_REG 0x3E + +#define PCI_CB_IO_RANGE_MASK ~0x03 +#define PCI_CB_IOBASE(x) (x & PCI_CB_IO_RANGE_MASK) +#define PCI_CB_IOLIMIT(x) ((x & PCI_CB_IO_RANGE_MASK) + 3) /* Subsystem identification register */ #define PCI_SUBSYSTEM_ID_REG 0x2c /* User defined cfg space regs */ -#define PCI_REG_USERCONFIG 0x40 -#define PCI_OPTION_REG 0x40 +#define PCI_REG_USERCONFIG 0x40 +#define PCI_OPTION_REG 0x40 /* * Typedefs, etc... */ /* Primitive Types */ -typedef unsigned long ADDRESS; /* Memory/PCI address */ -typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */ +typedef unsigned long ADDRESS; /* Memory/PCI address */ +typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */ typedef unsigned long PCITAG; /* @@ -363,36 +387,36 @@ */ typedef struct pci_cfg_regs { /* start of official PCI config space header */ - union { /* Offset 0x0 - 0x3 */ + union { /* Offset 0x0 - 0x3 */ CARD32 device_vendor; struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN +#if X_BYTE_ORDER == X_BIG_ENDIAN CARD16 device; CARD16 vendor; -#else +#else CARD16 vendor; CARD16 device; -#endif +#endif } dv; } dv_id; - - union { /* Offset 0x4 - 0x8 */ - CARD32 status_command; + + union { /* Offset 0x4 - 0x8 */ + CARD32 status_command; struct { #if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 status; - CARD16 command; + CARD16 status; + CARD16 command; #else - CARD16 command; - CARD16 status; -#endif + CARD16 command; + CARD16 status; +#endif } sc; } stat_cmd; - - union { /* Offset 0x8 - 0xb */ - CARD32 class_revision; + + union { /* Offset 0x8 - 0xb */ + CARD32 class_revision; struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN +#if X_BYTE_ORDER == X_BIG_ENDIAN CARD8 base_class; CARD8 sub_class; CARD8 prog_if; @@ -402,14 +426,14 @@ CARD8 prog_if; CARD8 sub_class; CARD8 base_class; -#endif +#endif } cr; } class_rev; - - union { /* Offset 0xc - 0xf */ - CARD32 bist_header_latency_cache; + + union { /* Offset 0xc - 0xf */ + CARD32 bist_header_latency_cache; struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN +#if X_BYTE_ORDER == X_BIG_ENDIAN CARD8 bist; CARD8 header_type; CARD8 latency_timer; @@ -419,92 +443,145 @@ CARD8 latency_timer; CARD8 header_type; CARD8 bist; -#endif +#endif } bhlc; } bhlc; - - union { /* Offset 0x10 - 0x27 */ - struct { /* header type 0 */ - CARD32 dv_base0; - CARD32 dv_base1; - CARD32 dv_base2; - CARD32 dv_base3; - CARD32 dv_base4; - CARD32 dv_base5; - } dv; - struct { /* header type 1 */ - CARD32 bg_rsrvd[2]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD8 secondary_latency_timer; - CARD8 subordinate_bus_number; - CARD8 secondary_bus_number; - CARD8 primary_bus_number; - - CARD16 secondary_status; - CARD8 io_limit; - CARD8 io_base; - - CARD16 mem_limit; - CARD16 mem_base; + union { /* Offset 0x10 - 0x3b */ + struct { /* header type 2 */ + CARD32 cg_rsrvd1; /* 0x10 */ +#if X_BYTE_ORDER == X_BIG_ENDIAN + CARD16 secondary_status; /* 0x16 */ + CARD16 cg_rsrvd2; /* 0x14 */ - CARD16 prefetch_mem_limit; - CARD16 prefetch_mem_base; + union { + CARD32 cg_bus_reg; + struct { + CARD8 latency_timer; /* 0x1b */ + CARD8 subordinate_bus_number; /* 0x1a */ + CARD8 cardbus_bus_number; /* 0x19 */ + CARD8 primary_bus_number; /* 0x18 */ + } cgbr; + } cgbr; #else - CARD8 primary_bus_number; - CARD8 secondary_bus_number; - CARD8 subordinate_bus_number; - CARD8 secondary_latency_timer; - - CARD8 io_base; - CARD8 io_limit; - CARD16 secondary_status; - - CARD16 mem_base; - CARD16 mem_limit; - - CARD16 prefetch_mem_base; - CARD16 prefetch_mem_limit; -#endif - } bg; - } bc; - union { /* Offset 0x28 - 0x2b */ - CARD32 rsvd1; - CARD32 pftch_umem_base; - CARD32 cardbus_cis_ptr; - } um_c_cis; - union { /* Offset 0x2c - 0x2f */ - CARD32 subsys_card_vendor; - CARD32 pftch_umem_limit; - CARD32 rsvd2; + CARD16 cg_rsrvd2; /* 0x14 */ + CARD16 secondary_status; /* 0x16 */ + + union { + CARD32 cg_bus_reg; + struct { + CARD8 primary_bus_number; /* 0x18 */ + CARD8 cardbus_bus_number; /* 0x19 */ + CARD8 subordinate_bus_number; /* 0x1a */ + CARD8 latency_timer; /* 0x1b */ + } cgbr; + } cgbr; +#endif + CARD32 mem_base0; /* 0x1c */ + CARD32 mem_limit0; /* 0x20 */ + CARD32 mem_base1; /* 0x24 */ + CARD32 mem_limit1; /* 0x28 */ + CARD32 io_base0; /* 0x2c */ + CARD32 io_limit0; /* 0x30 */ + CARD32 io_base1; /* 0x34 */ + CARD32 io_limit1; /* 0x38 */ + } cg; struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 subsys_card; - CARD16 subsys_vendor; -#else - CARD16 subsys_vendor; - CARD16 subsys_card; -#endif - } ssys; - } um_ssys_id; - union { /* Offset 0x30 - 0x33 */ - CARD32 baserom; - struct { + union { /* Offset 0x10 - 0x27 */ + struct { /* header type 0 */ + CARD32 dv_base0; + CARD32 dv_base1; + CARD32 dv_base2; + CARD32 dv_base3; + CARD32 dv_base4; + CARD32 dv_base5; + } dv; + struct { /* header type 1 */ + CARD32 bg_rsrvd[2]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + union { + CARD32 pp_bus_reg; + struct { + CARD8 secondary_latency_timer; + CARD8 subordinate_bus_number; + CARD8 secondary_bus_number; + CARD8 primary_bus_number; + } ppbr; + } ppbr; + + CARD16 secondary_status; + CARD8 io_limit; + CARD8 io_base; + + CARD16 mem_limit; + CARD16 mem_base; + + CARD16 prefetch_mem_limit; + CARD16 prefetch_mem_base; +#else + union { + CARD32 pp_bus_reg; + struct { + CARD8 primary_bus_number; + CARD8 secondary_bus_number; + CARD8 subordinate_bus_number; + CARD8 secondary_latency_timer; + } ppbr; + } ppbr; + + CARD8 io_base; + CARD8 io_limit; + CARD16 secondary_status; + + CARD16 mem_base; + CARD16 mem_limit; + + CARD16 prefetch_mem_base; + CARD16 prefetch_mem_limit; +#endif + } bg; + } bc; + union { /* Offset 0x28 - 0x2b */ + CARD32 rsvd1; + CARD32 pftch_umem_base; + CARD32 cardbus_cis_ptr; + } um_c_cis; + union { /* Offset 0x2c - 0x2f */ + CARD32 subsys_card_vendor; + CARD32 pftch_umem_limit; + CARD32 rsvd2; + struct { +#if X_BYTE_ORDER == X_BIG_ENDIAN + CARD16 subsys_card; + CARD16 subsys_vendor; +#else + CARD16 subsys_vendor; + CARD16 subsys_card; +#endif + } ssys; + } um_ssys_id; + union { /* Offset 0x30 - 0x33 */ + CARD32 baserom; + struct { #if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 io_ulimit; - CARD16 io_ubase; + CARD16 io_ulimit; + CARD16 io_ubase; #else - CARD16 io_ubase; - CARD16 io_ulimit; + CARD16 io_ubase; + CARD16 io_ulimit; #endif - } b_u_io; - } uio_rom; - CARD32 rsvd3; /* Offset 0x34 - 0x37 */ - CARD32 rsvd4; /* Offset 0x38 - 0x3b */ - union { /* Offset 0x3c - 0x3f */ - union { /* header type 0 */ - CARD32 max_min_ipin_iline; + } b_u_io; + } uio_rom; struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN + CARD32 rsvd3; /* Offset 0x34 - 0x37 */ + CARD32 rsvd4; /* Offset 0x38 - 0x3b */ + } rsvd; + } cd; + } cx; + union { /* Offset 0x3c - 0x3f */ + union { /* header type 0 */ + CARD32 max_min_ipin_iline; + struct { +#if X_BYTE_ORDER == X_BIG_ENDIAN CARD8 max_lat; CARD8 min_gnt; CARD8 int_pin; @@ -514,33 +591,31 @@ CARD8 int_pin; CARD8 min_gnt; CARD8 max_lat; -#endif +#endif } mmii; } mmii; - struct { /* header type 1 */ + struct { /* header type 1 */ #if X_BYTE_ORDER == X_BIG_ENDIAN - CARD8 rsvd4; - CARD8 bridge_control; - CARD8 rsvd2; - CARD8 rsvd1; + CARD16 bridge_control; /* upper 8 bits reserved */ + CARD8 rsvd2; + CARD8 rsvd1; #else - CARD8 rsvd1; - CARD8 rsvd2; - CARD8 bridge_control; - CARD8 rsvd4; + CARD8 rsvd1; + CARD8 rsvd2; + CARD16 bridge_control; /* upper 8 bits reserved */ #endif } bctrl; } bm; - union { /* Offset 0x40 - 0xff */ - CARD32 dwords[48]; - CARD32 bytes[192]; + union { /* Offset 0x40 - 0xff */ + CARD32 dwords[48]; + CARD8 bytes[192]; } devspf; } pciCfgRegs; typedef union pci_cfg_spc { - pciCfgRegs regs; - CARD32 dwords[256/sizeof(CARD32)]; - CARD8 bytes[256/sizeof(CARD8)]; + pciCfgRegs regs; + CARD32 dwords[256/sizeof(CARD32)]; + CARD8 bytes[256/sizeof(CARD8)]; } pciCfgSpc; /* @@ -549,13 +624,15 @@ */ typedef struct pci_device { PCITAG tag; - int busnum; - int devnum; - int funcnum; + int busnum; + int devnum; + int funcnum; pciCfgSpc cfgspc; - int basesize[7]; /* number of bits in base addr allocations */ + int basesize[7]; /* number of bits in base addr allocations */ Bool minBasesize; CARD32 listed_class; + pointer businfo; /* pointer to secondary's bus info structure */ + Bool fakeDevice; /* Device added by system chipset support */ } pciDevice, *pciConfigPtr; typedef enum { @@ -591,34 +668,49 @@ #define pci_latency_timer cfgspc.regs.bhlc.bhlc.latency_timer #define pci_header_type cfgspc.regs.bhlc.bhlc.header_type #define pci_bist cfgspc.regs.bhlc.bhlc.bist -#define pci_base0 cfgspc.regs.bc.dv.dv_base0 -#define pci_base1 cfgspc.regs.bc.dv.dv_base1 -#define pci_base2 cfgspc.regs.bc.dv.dv_base2 -#define pci_base3 cfgspc.regs.bc.dv.dv_base3 -#define pci_base4 cfgspc.regs.bc.dv.dv_base4 -#define pci_base5 cfgspc.regs.bc.dv.dv_base5 -#define pci_cardbus_cis_ptr cfgspc.regs.umem_c_cis.cardbus_cis_ptr -#define pci_subsys_card_vendor cfgspc.regs.um_ssys_id.subsys_card_vendor -#define pci_subsys_vendor cfgspc.regs.um_ssys_id.ssys.subsys_vendor -#define pci_subsys_card cfgspc.regs.um_ssys_id.ssys.subsys_card -#define pci_baserom cfgspc.regs.uio_rom.baserom -#define pci_primary_bus_number cfgspc.regs.bc.bg.primary_bus_number -#define pci_secondary_bus_number cfgspc.regs.bc.bg.secondary_bus_number -#define pci_subordinate_bus_number cfgspc.regs.bc.bg.subordinate_bus_number -#define pci_secondary_latency_timer cfgspc.regs.bc.bg.secondary_latency_timer -#define pci_io_base cfgspc.regs.bc.bg.io_base -#define pci_io_limit cfgspc.regs.bc.bg.io_limit -#define pci_secondary_status cfgspc.regs.bc.bg.secondary_status -#define pci_mem_base cfgspc.regs.bc.bg.mem_base -#define pci_mem_limit cfgspc.regs.bc.bg.mem_limit -#define pci_prefetch_mem_base cfgspc.regs.bc.bg.prefetch_mem_base -#define pci_prefetch_mem_limit cfgspc.regs.bc.bg.prefetch_mem_limit -#define pci_rsvd1 cfgspc.regs.um_c_cis.rsvd1 -#define pci_rsvd2 cfgspc.regs.um_ssys_id.rsvd2 -#define pci_prefetch_upper_mem_base cfgspc.regs.um_c_cis.pftch_umem_base -#define pci_prefetch_upper_mem_limit cfgspc.regs.um_ssys_id.pftch_umem_limit -#define pci_upper_io_base cfgspc.regs.uio_rom.b_u_io.io_ubase -#define pci_upper_io_limit cfgspc.regs.uio_rom.b_u_io.io_ulimit +#define pci_cb_secondary_status cfgspc.regs.cx.cg.secondary_status +#define pci_cb_bus_register cfgspc.regs.cx.cg.cgbr.cg_bus_reg +#define pci_cb_primary_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.primary_bus_number +#define pci_cb_cardbus_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.cardbus_bus_number +#define pci_cb_subordinate_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.subordinate_bus_number +#define pci_cb_latency_timer cfgspc.regs.cx.cg.cgbr.cgbr.latency_timer +#define pci_cb_membase0 cfgspc.regs.cx.cg.mem_base0 +#define pci_cb_memlimit0 cfgspc.regs.cx.cg.mem_limit0 +#define pci_cb_membase1 cfgspc.regs.cx.cg.mem_base1 +#define pci_cb_memlimit1 cfgspc.regs.cx.cg.mem_limit1 +#define pci_cb_iobase0 cfgspc.regs.cx.cg.io_base0 +#define pci_cb_iolimit0 cfgspc.regs.cx.cg.io_limit0 +#define pci_cb_iobase1 cfgspc.regs.cx.cg.io_base1 +#define pci_cb_iolimit1 cfgspc.regs.cx.cg.io_limit1 +#define pci_base0 cfgspc.regs.cx.cd.bc.dv.dv_base0 +#define pci_base1 cfgspc.regs.cx.cd.bc.dv.dv_base1 +#define pci_base2 cfgspc.regs.cx.cd.bc.dv.dv_base2 +#define pci_base3 cfgspc.regs.cx.cd.bc.dv.dv_base3 +#define pci_base4 cfgspc.regs.cx.cd.bc.dv.dv_base4 +#define pci_base5 cfgspc.regs.cx.cd.bc.dv.dv_base5 +#define pci_cardbus_cis_ptr cfgspc.regs.cx.cd.umem_c_cis.cardbus_cis_ptr +#define pci_subsys_card_vendor cfgspc.regs.cx.cd.um_ssys_id.subsys_card_vendor +#define pci_subsys_vendor cfgspc.regs.cx.cd.um_ssys_id.ssys.subsys_vendor +#define pci_subsys_card cfgspc.regs.cx.cd.um_ssys_id.ssys.subsys_card +#define pci_baserom cfgspc.regs.cx.cd.uio_rom.baserom +#define pci_pp_bus_register cfgspc.regs.cx.cd.bc.bg.ppbr.pp_bus_reg +#define pci_primary_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.primary_bus_number +#define pci_secondary_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.secondary_bus_number +#define pci_subordinate_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.subordinate_bus_number +#define pci_secondary_latency_timer cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.secondary_latency_timer +#define pci_io_base cfgspc.regs.cx.cd.bc.bg.io_base +#define pci_io_limit cfgspc.regs.cx.cd.bc.bg.io_limit +#define pci_secondary_status cfgspc.regs.cx.cd.bc.bg.secondary_status +#define pci_mem_base cfgspc.regs.cx.cd.bc.bg.mem_base +#define pci_mem_limit cfgspc.regs.cx.cd.bc.bg.mem_limit +#define pci_prefetch_mem_base cfgspc.regs.cx.cd.bc.bg.prefetch_mem_base +#define pci_prefetch_mem_limit cfgspc.regs.cx.cd.bc.bg.prefetch_mem_limit +#define pci_rsvd1 cfgspc.regs.cx.cd.um_c_cis.rsvd1 +#define pci_rsvd2 cfgspc.regs.cx.cd.um_ssys_id.rsvd2 +#define pci_prefetch_upper_mem_base cfgspc.regs.cx.cd.um_c_cis.pftch_umem_base +#define pci_prefetch_upper_mem_limit cfgspc.regs.cx.cd.um_ssys_id.pftch_umem_limit +#define pci_upper_io_base cfgspc.regs.cx.cd.uio_rom.b_u_io.io_ubase +#define pci_upper_io_limit cfgspc.regs.cx.cd.uio_rom.b_u_io.io_ulimit #define pci_int_line cfgspc.regs.bm.mmii.mmii.int_line #define pci_int_pin cfgspc.regs.bm.mmii.mmii.int_pin #define pci_min_gnt cfgspc.regs.bm.mmii.mmii.min_gnt @@ -639,35 +731,44 @@ } PciBiosType; /* Public PCI access functions */ -void pciInit(void); -PCITAG pciFindFirst(CARD32 id, CARD32 mask); -PCITAG pciFindNext(void); -CARD32 pciReadLong(PCITAG tag, int offset); -CARD16 pciReadWord(PCITAG tag, int offset); -CARD8 pciReadByte(PCITAG tag, int offset); -void pciWriteLong(PCITAG tag, int offset, CARD32 val); -void pciWriteWord(PCITAG tag, int offset, CARD16 val); -void pciWriteByte(PCITAG tag, int offset, CARD8 val); -void pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val); -void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val); -pointer pciLongFunc(PCITAG tag, pciFunc func); -ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr); -ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr); -PCITAG pciTag(int busnum, int devnum, int funcnum); -int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min); -CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg); -pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, +void pciInit(void); +PCITAG pciFindFirst(CARD32 id, CARD32 mask); +PCITAG pciFindNext(void); +CARD32 pciReadLong(PCITAG tag, int offset); +CARD16 pciReadWord(PCITAG tag, int offset); +CARD8 pciReadByte(PCITAG tag, int offset); +void pciWriteLong(PCITAG tag, int offset, CARD32 val); +void pciWriteWord(PCITAG tag, int offset, CARD16 val); +void pciWriteByte(PCITAG tag, int offset, CARD8 val); +void pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val); +void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val); +pointer pciLongFunc(PCITAG tag, pciFunc func); +ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr); +ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr); +PCITAG pciTag(int busnum, int devnum, int funcnum); +int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min); +CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg); +pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base, unsigned long Size); -int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, +int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, unsigned char *Buf, int Len); -int xf86ReadPciBIOSByType(unsigned long Offset, PCITAG Tag, - int basereg, unsigned char *Buf, +int xf86ReadPciBIOSByType(unsigned long Offset, PCITAG Tag, + int basereg, unsigned char *Buf, int Len, PciBiosType Type); -int xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, +int xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, PciBiosType *Buf); pciConfigPtr *xf86scanpci(int flags); extern int pciNumBuses; + +/* Domain access functions. Some of these probably shouldn't be public */ +int xf86GetPciDomain(PCITAG tag); +pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, + ADDRESS Base, unsigned long Size); +IOADDRESS xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, + IOADDRESS Base, unsigned long Size); +int xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, + unsigned char *Buf); typedef enum { ROM_BASE_PRESET = -2, Index: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.4 Sat Oct 27 23:34:01 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h Wed May 22 17:38:30 2002 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.4 2001/10/28 03:34:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.5 2002/05/22 21:38:30 herrb Exp $ */ #ifndef _XF86_SBUS_H #define _XF86_SBUS_H @@ -32,6 +32,8 @@ #elif defined(SVR4) #include <sys/fbio.h> #include <sys/openpromio.h> +#elif defined(__OpenBSD__) && defined(__sparc64__) +/* XXX */ #elif defined(CSRG_BASED) #include <machine/fbio.h> #else Index: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c:1.1 --- /dev/null Thu Feb 27 12:32:29 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c Sun Feb 23 15:26:49 2003 @@ -0,0 +1,1047 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c,v 1.1 2003/02/23 20:26:49 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +/* + * This file contains the glue necessary for support of HP's ZX1 chipset. + * Keep in mind that this chipset is used in both Itanium2 and PA-RISC + * architectures. + */ + +#include "zx1PCI.h" +#include "xf86.h" +#include "xf86_OSlib.h" +#include "Pci.h" + +#define MIO_BASE 0xFED00000UL /* mio register base */ +#define MIO_SIZE 0x00002000UL /* 8k, minimum */ + +/* ZX1 mio register definitions */ +#define MIO_FUNCTION0 0x0000U + +#define MODULE_INFO 0x0100U +#define STATUS_CONTROL 0x0108U +#define DILLON_PRESENT 0x02UL + +#define LMMIO_DIR_BASE0 0x0300U +#define LMMIO_DIR_MASK0 0x0308U +#define LMMIO_DIR_ROUTE0 0x0310U +#define LMMIO_DIR_BASE1 0x0318U +#define LMMIO_DIR_MASK1 0x0320U +#define LMMIO_DIR_ROUTE1 0x0328U +#define LMMIO_DIR_BASE2 0x0330U +#define LMMIO_DIR_MASK2 0x0338U +#define LMMIO_DIR_ROUTE2 0x0340U +#define LMMIO_DIR_BASE3 0x0348U +#define LMMIO_DIR_MASK3 0x0350U +#define LMMIO_DIR_ROUTE3 0x0358U +#define LMMIO_DIST_BASE 0x0360U +#define LMMIO_DIST_MASK 0x0368U +#define LMMIO_DIST_ROUTE 0x0370U +#define GMMIO_DIST_BASE 0x0378U +#define PORT_DISABLE 0x02UL +#define MAP_TO_LMMIO 0x04UL +#define GMMIO_DIST_MASK 0x0380U +#define GMMIO_DIST_ROUTE 0x0388U +#define IOS_DIST_BASE 0x0390U +#define IOS_DIST_MASK 0x0398U +#define IOS_DIST_ROUTE 0x03A0U +#define ROPE_CONFIG_BASE 0x03A8U +#define VGA_ROUTE 0x03B0U +#define VGA_ENABLE 0x8000000000000000UL +#define VGA_LIGHT 0x4000000000000000UL + +#define IOS_DIR_BASE 0x03C0U +#define IOS_DIR_MASK 0x03C8U +#define IOS_DIR_ROUTE 0x03D0U +#define IOS_BASE 0x03D8U + +#define MIO_FUNCTION1 0x1000U + +#define ROPE_CONFIG 0x1040U +#define ROPE_D0 0x0100UL +#define ROPE_D2 0x0200UL +#define ROPE_D4 0x0400UL +#define ROPE_D6 0x0800UL +#define ROPE_Q0 0x1000UL +#define ROPE_Q4 0x2000UL + +#define LBA_PORT0_CNTRL 0x1200U +#define LBA_PORT1_CNTRL 0x1208U +#define LBA_PORT2_CNTRL 0x1210U +#define LBA_PORT3_CNTRL 0x1218U +#define LBA_PORT4_CNTRL 0x1220U +#define LBA_PORT5_CNTRL 0x1228U +#define LBA_PORT6_CNTRL 0x1230U +#define LBA_PORT7_CNTRL 0x1238U +#define LBA_HARD_FAIL 0x40UL + +#define ROPE_PAGE_CONTROL 0x1418U + +/* + * Total ioa configuration space size is actually 128k, but we only need the + * first 64k. + */ +#define IOA_SIZE 0x00010000UL + +/* ZX1 ioa register definitions */ +#define IOA_CONFIG_ADDR 0x0040U +#define IOA_CONFIG_DATA 0x0048U + +#define IOA_SECONDARY_BUS 0x0058U +#define IOA_SUBORDINATE_BUS 0x0059U + +#define IOA_CONTROL 0x0108U +#define IOA_FORWARD_VGA 0x08UL +#define IOA_HARD_FAIL 0x40UL + +#define IOA_LMMIO_BASE 0x0200U +#define IOA_LMMIO_MASK 0x0208U +#define IOA_GMMIO_BASE 0x0210U +#define IOA_GMMIO_MASK 0x0218U +#define IOA_WLMMIO_BASE 0x0220U +#define IOA_WLMMIO_MASK 0x0228U +#define IOA_WGMMIO_BASE 0x0230U +#define IOA_WGMMIO_MASK 0x0238U +#define IOA_IOS_BASE 0x0240U +#define IOA_IOS_MASK 0x0248U +#define IOA_ELMMIO_BASE 0x0250U +#define IOA_ELMMIO_MASK 0x0258U +#define IOA_EIOS_BASE 0x0260U +#define IOA_EIOS_MASK 0x0268U + +#define IOA_SLAVE_CONTROL 0x0278U +#define IOA_VGA_PEER_ENABLE 0x2000UL +#define IOA_MSI_BASE 0x0280U +#define IOA_MSI_MASK 0x0288U + +#define RANGE_ENABLE 0x01UL /* In various base registers */ + +#define IO_MASK ((1UL << 16) - 1UL) +#define LMMIO_MASK ((1UL << 32) - 1UL) +#ifdef __ia64__ +#define GMMIO_MASK ((1UL << 44) - 1UL) +#else /* PA-RISC */ +#define GMMIO_MASK ((1UL << 40) - 1UL) +#endif + +#define PDH_START 0xFF000000UL +#define PDH_LAST 0xFFFFFFFFUL + +static CARD8 *pZX1mio = NULL, + *pZX1ioa = NULL; + +static INT8 zx1_ropemap[8]; /* One for each (potential) rope */ +static CARD64 zx1_lbacntl[8]; /* " " " " " */ +static int zx1_busno[8], zx1_subno[8]; + +static pciBusFuncs_t zx1BusFuncs; +static int zx1_fakebus = -1; +static Bool zx1_hasvga = FALSE; + +static pointer pZX1IoRes[8], pZX1MemRes[8]; /* Rope resources */ + +/* Non-PCI configuration space access macros */ +#define MIO_BYTE(offset) \ + (*(volatile CARD8 *)(pointer)(pZX1mio + (offset))) +#define MIO_WORD(offset) \ + (*(volatile CARD16 *)(pointer)(pZX1mio + (offset))) +#define MIO_LONG(offset) \ + (*(volatile CARD32 *)(pointer)(pZX1mio + (offset))) +#define MIO_QUAD(offset) \ + (*(volatile CARD64 *)(pointer)(pZX1mio + (offset))) +#define IOA_BYTE(ioa, offset) \ + (*(volatile CARD8 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) +#define IOA_WORD(ioa, offset) \ + (*(volatile CARD16 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) +#define IOA_LONG(ioa, offset) \ + (*(volatile CARD32 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) +#define IOA_QUAD(ioa, offset) \ + (*(volatile CARD64 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) + +/* Range definitions */ +#define MAX_RANGE 16 +static CARD64 bot[MAX_RANGE], top[MAX_RANGE], msk[MAX_RANGE], siz[MAX_RANGE]; +static INT8 *pDecode[MAX_RANGE]; +static int nRange = 0; + +/* Track a resource range and assign a granularity to it */ +static void +SetRange(CARD64 base, CARD64 last, CARD8 width) +{ + int i; + + bot[nRange] = base; + top[nRange] = last; + msk[nRange] = (CARD64)(-1L); + if (base) + msk[nRange] &= (base ^ (base - 1UL)) >> 1; + if (last + 1UL) + msk[nRange] &= (last ^ (last + 1UL)) >> 1; + if (width < 64) + msk[nRange] &= (1UL << width) - 1UL; + + /* Look for overlapping ranges */ + for (i = 0; i < nRange; i++) { + if ((bot[i] > top[i]) || + (top[nRange] < bot[i]) || + (top[i] < bot[nRange])) + continue; + + /* Merge in overlapping range */ + if (bot[nRange] > bot[i]) + bot[nRange] = bot[i]; + if (top[nRange] < top[i]) + top[nRange] = top[i]; + + /* Assign finer granularity */ + msk[nRange] &= msk[i]; + bot[i] = 1UL; + top[i] = 0; + } + + nRange++; +} + +/* Lookup granularity associated with the range containing 'base' */ +static int +GetRange(CARD64 base) +{ + int i; + + for (i = 0; i < nRange; i++) { + if ((bot[i] > top[i]) || + (base < bot[i]) || + (base > top[i])) + continue; + + if (pDecode[i]) + break; + + /* Allocate decoding array */ + msk[i]++; + siz[i] = ((top[i] - bot[i] + 1UL) / msk[i]) + 1UL; + pDecode[i] = xnfalloc(siz[i]); + (void)memset(pDecode[i], -1, siz[i]); + break; + } + + return i; +} + +/* + * Verify that 'bus' is a rope's secondary bus and return the pciConfigPtr of + * the associated fake PCI-to-PCI bridge. + */ +static pciConfigPtr +VerifyZX1Bus(int bus) +{ + pciConfigPtr pPCI; + + if ((bus < 0) || (bus >= pciNumBuses) || + !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || + (pPCI->busnum != zx1_fakebus) || (pPCI->funcnum != 0) || + (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17)) + return NULL; + + return pPCI; +} + +/* + * This function is called to emulate the various settings in a P2P or CardBus + * bridge's control register on a ZX1-based system. + */ +static CARD16 +ControlZX1Bridge(int bus, CARD16 mask, CARD16 value) +{ + pciConfigPtr pPCI; + CARD64 tmp1, tmp2, tmp3, ropenum; + CARD16 current = 0; + + if ((pPCI = VerifyZX1Bus(bus))) { + ropenum = pPCI->devnum & 0x07; + + /* + * Start with VGA enablement. This preserves the "VGA-lite" bit + * in mio's VGA_ROUTE register, and the VPE bit in each ioa's + * SLAVE_CONTROL register. + */ + tmp1 = MIO_QUAD(VGA_ROUTE); + tmp2 = IOA_QUAD(ropenum, IOA_CONTROL); + if ((tmp1 & VGA_ENABLE) && ((tmp1 & 0x07UL) == ropenum)) { + current |= PCI_PCI_BRIDGE_VGA_EN; + if ((mask & PCI_PCI_BRIDGE_VGA_EN) && + !(value & PCI_PCI_BRIDGE_VGA_EN)) { + MIO_QUAD(VGA_ROUTE) = tmp1 & ~VGA_ENABLE; + tmp2 &= ~IOA_FORWARD_VGA; + IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; + } + } else if (mask & value & PCI_PCI_BRIDGE_VGA_EN) { + if (!zx1_hasvga) { + xf86MsgVerb(X_WARNING, 3, + "HP ZX1: Attempt to enable VGA routing to bus %d" + " through rope %ld disallowed\n", bus, ropenum); + value &= ~PCI_PCI_BRIDGE_VGA_EN; + } else { + if (tmp1 & VGA_ENABLE) { + /* + * VGA is routed somewhere else. Disable it. + */ + MIO_QUAD(VGA_ROUTE) = 0UL; + tmp3 = IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL); + if (tmp3 & IOA_FORWARD_VGA) + IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL) = + tmp3 & ~IOA_FORWARD_VGA; + } + if (!(tmp2 & IOA_FORWARD_VGA)) { + tmp2 |= IOA_FORWARD_VGA; + IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; + } + tmp1 = (tmp1 & ~0x07UL) | ropenum | VGA_ENABLE; + MIO_QUAD(VGA_ROUTE) = tmp1; + } + } + + /* Move on to master abort failure enablement */ + tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL); + if ((tmp1 & LBA_HARD_FAIL) || (tmp2 & IOA_HARD_FAIL)) { + current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN; + if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && + !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) { + if (tmp1 & LBA_HARD_FAIL) + MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) = + tmp1 & ~LBA_HARD_FAIL; + if (tmp2 & IOA_HARD_FAIL) { + tmp2 &= ~IOA_HARD_FAIL; + IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; + } + } + } else { + if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) { + if (!(tmp1 & LBA_HARD_FAIL)) + MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) = + tmp1 | LBA_HARD_FAIL; + if (!(tmp2 & IOA_HARD_FAIL)) { + tmp2 |= IOA_HARD_FAIL; + IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; + } + } + } + + /* Put emulation of any other P2P bridge control here */ + } + + return (current & ~mask) | (value & mask); +} + +/* Retrieves a list of the resources routed to a rope's secondary bus */ +static void +GetZX1BridgeResources(int bus, + pointer *ppIoRes, + pointer *ppMemRes, + pointer *ppPmemRes) +{ + pciConfigPtr pPCI = VerifyZX1Bus(bus); + + if (ppIoRes) { + xf86FreeResList(*ppIoRes); + *ppIoRes = + pPCI ? xf86DupResList(pZX1IoRes[pPCI->devnum & 0x07]) : NULL; + } + + if (ppMemRes) { + xf86FreeResList(*ppMemRes); + *ppMemRes = + pPCI ? xf86DupResList(pZX1MemRes[pPCI->devnum & 0x07]) : NULL; + } + + if (ppPmemRes) { + xf86FreeResList(*ppPmemRes); + *ppPmemRes = NULL; + } +} + +/* The fake bus */ +static CARD32 +zx1FakeReadLong(PCITAG tag, int offset) +{ + FatalError("zx1FakeReadLong(0x%X, 0x%X) called\n", tag, offset); +} + +static void +zx1FakeWriteLong(PCITAG tag, int offset, CARD32 val) +{ + FatalError("zx1FakeWriteLong(0x%X, 0x%X, 0x%08X) called\n", + tag, offset, val); +} + +static void +zx1FakeSetBits(PCITAG tag, int offset, CARD32 mask, CARD32 bits) +{ + CARD32 val; + + val = zx1FakeReadLong(tag, offset); + val &= ~mask; + val |= bits; + zx1FakeWriteLong(tag, offset, val); +} + +static pciBusFuncs_t zx1FakeBusFuncs = { + zx1FakeReadLong, + zx1FakeWriteLong, + zx1FakeSetBits +}; + +static pciBusInfo_t zx1FakeBus = { + 0, /* configMech -- copied from bus 0 */ + 0, /* numDevices -- copied from bus 0 */ + FALSE, /* secondary */ + 0, /* primary_bus -- dynamically set */ +#ifdef PowerMAX_OS + 0, /* ppc_io_base -- ignored */ + 0, /* ppc_io_size -- ignored */ +#endif + &zx1FakeBusFuncs, /* funcs */ + NULL, /* pciBusPriv -- none */ + NULL, /* bridge -- dynamically set */ +}; + +/* + * This checks for, and validates, the presence of the ZX1 chipset, and sets + * pZX1mio to a non-NULL pointer accordingly. This function is called before + * the server's PCI bus scan and returns TRUE if the chipset scan is to be + * stopped, or FALSE if the scan is to move on to the next chipset. + */ +Bool +xf86PreScanZX1(void) +{ + resRange range; + unsigned long mapSize = xf86getpagesize(); + unsigned long tmp, base, ioaaddr; + unsigned long flagsd = 0, based = 0, lastd = 0, maskd = 0, routed = 0; + unsigned long flags0 = 0, base0 = 0, last0 = 0, mask0 = 0, route0 = 0; + unsigned long flags1 = 0, base1 = 0, last1 = 0, mask1 = 0, route1 = 0; + unsigned long flags2 = 0, base2 = 0, last2 = 0, mask2 = 0, route2 = 0; + unsigned long flags3 = 0, base3 = 0, last3 = 0, mask3 = 0, route3 = 0; + unsigned long flagsg = 0, baseg = 0, lastg = 0, maskg = 0, routeg = 0; + unsigned long flagsl = 0, basel = 0, lastl = 0; + int i, rope; + + /* Map mio registers (minimum 8k) */ + if (mapSize < MIO_SIZE) + mapSize = MIO_SIZE; + + if (!(pZX1mio = xf86MapVidMem(-1, VIDMEM_MMIO, MIO_BASE, mapSize))) + return FALSE; + + /* Look for ZX1's SBA and IOC */ + if ((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != DEVID(HP, ZX1_SBA)) || + (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) != DEVID(HP, ZX1_IOC))) { + xf86UnMapVidMem(-1, pZX1mio, mapSize); + pZX1mio = NULL; + return FALSE; + } + + /* Map rope configuration space */ + ioaaddr = MIO_QUAD(ROPE_CONFIG_BASE); + if (!(ioaaddr & RANGE_ENABLE) || /* No ropes */ + ((ioaaddr = ioaaddr & ~RANGE_ENABLE) & 0x01FFFFUL) || /* Not aligned */ + !(pZX1ioa = xf86MapVidMem(-1, VIDMEM_MMIO, ioaaddr, IOA_SIZE))) { + xf86UnMapVidMem(-1, pZX1mio, mapSize); + pZX1mio = NULL; + return TRUE; + } + + for (i = 0; i < 8; i++) { + zx1_ropemap[i] = i; + zx1_lbacntl[i] = 0; + xf86FreeResList(pZX1IoRes[i]); + xf86FreeResList(pZX1MemRes[i]); + pZX1IoRes[i] = pZX1MemRes[i] = NULL; + } + + /* + * Determine which of 8 possible ropes exist in the system. This is done + * by looking at their "coupling" to generate a list of candidates, + * whittling this list down by factoring in ROPE_PAGE_CONTROL register + * contents, then poking each candidate's configuration space to determine + * its existence. + */ + tmp = MIO_QUAD(ROPE_CONFIG); + if (tmp & ROPE_D0) + zx1_ropemap[1] = 0; + if (tmp & ROPE_D2) + zx1_ropemap[3] = 2; + if (tmp & ROPE_D4) + zx1_ropemap[5] = 4; + if (tmp & ROPE_D6) + zx1_ropemap[7] = 6; + if (tmp & ROPE_Q0) + zx1_ropemap[1] = zx1_ropemap[2] = zx1_ropemap[3] = 0; + if (tmp & ROPE_Q4) + zx1_ropemap[5] = zx1_ropemap[6] = zx1_ropemap[7] = 4; + + tmp = MIO_QUAD(ROPE_PAGE_CONTROL); + for (i = 0; i < 8; i++, tmp >>= 8) + if (!(CARD8)tmp) + zx1_ropemap[i] = -1; + + for (i = 0; i < 8; ) { + if (zx1_ropemap[i] == i) { + + /* Prevent hard-fails */ + zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL); + if (zx1_lbacntl[i] & LBA_HARD_FAIL) + MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = + zx1_lbacntl[i] & ~LBA_HARD_FAIL; + + /* Poke for an ioa */ + tmp = IOA_LONG(i, PCI_ID_REG); + switch ((CARD32)tmp) { + case DEVID(HP, ELROY): /* Expected vendor/device id's */ + case DEVID(HP, ZX1_LBA): + zx1_busno[i] = + (unsigned int)IOA_BYTE(i, IOA_SECONDARY_BUS); + zx1_subno[i] = + (unsigned int)IOA_BYTE(i, IOA_SUBORDINATE_BUS); + break; + + default: + if ((CARD16)(tmp + 1U) > (CARD16)1U) + xf86MsgVerb(X_NOTICE, 0, + "HP ZX1: Unexpected vendor/device id 0x%08X" + " on rope %d\n", (CARD32)tmp, i); + /* Nobody home, or not the "right" kind of rope guest */ + + /* + * Restore hard-fail setting. For "active" ropes, this is done + * later. + */ + if (zx1_lbacntl[i] & LBA_HARD_FAIL) { + MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i]; + zx1_lbacntl[i] = 0; + } + + /* Ignore this rope and its couplings */ + do { + zx1_ropemap[i++] = -1; + } while ((i < 8) && (zx1_ropemap[i] < i)); + continue; /* Avoid over-incrementing 'i' */ + } + } + i++; + } + + /* Determine if VGA is currently routed */ + tmp = MIO_QUAD(VGA_ROUTE); + if (tmp & VGA_ENABLE) + zx1_hasvga = TRUE; + + /* + * Decode mio resource "coarse" routing (i.e. ignoring VGA). Due to the + * rather unusual flexibility of this chipset, this is done in a number of + * stages. For each of I/O and memory, first decode the relevant registers + * to generate ranges with an associated granularity. Overlapping ranges + * are merged into a larger range with the finer granularity. Each + * original range is then more thoroughly decoded using the granularity + * associated with the merged range that contains it. The result is then + * converted into resource lists for the common layer. + * + * Note that this doesn't care whether or not read-only bits are actually + * set as documented, nor that mask bits are contiguous. This does, + * however, factor in upper limits on I/O, LMMIO anf GMMIO addresses, and + * thus assumes high-order address bits are ignored rather than decoded. + * For example, an I/O address of 0x76543210 will be treated as 0x3210 + * rather than considered out-of-range. In part, this handling is a + * consequence of the fact that high-order mask bits are zeroes instead of + * ones. + */ + + if ((tmp = MIO_QUAD(IOS_DIST_BASE)) & RANGE_ENABLE) { + flagsd = RANGE_ENABLE; + maskd = MIO_QUAD(IOS_DIST_MASK); + based = tmp & maskd & (~RANGE_ENABLE & IO_MASK); + lastd = based | (~maskd & IO_MASK); + routed = MIO_QUAD(IOS_DIST_ROUTE) >> 58; + SetRange(based, lastd, routed); + } + + if ((tmp = MIO_QUAD(IOS_DIR_BASE)) & RANGE_ENABLE) { + flags0 = RANGE_ENABLE; + mask0 = MIO_QUAD(IOS_DIR_MASK); + base0 = tmp & mask0 & (~RANGE_ENABLE & IO_MASK); + last0 = base0 | (~mask0 & IO_MASK); + route0 = MIO_QUAD(IOS_DIR_ROUTE) & 0x07U; + SetRange(base0, last0, 64); + } + + if (flagsd) { + i = GetRange(based); + for (tmp = based; tmp <= lastd; tmp += msk[i]) { + if ((tmp & maskd) == based) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U]; + } + } + + flagsd = 0; + } + + if (flags0) { + i = GetRange(base0); + for (tmp = base0; tmp <= last0; tmp += msk[i]) { + if ((tmp & mask0) == base0) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[route0]; + } + } + + flags0 = 0; + } + + for (i = 0; i < nRange; i++) { + if (!pDecode[i]) + continue; + + rope = pDecode[i][0]; + for (base = tmp = 0; ++tmp < siz[i]; ) { + if (rope == pDecode[i][tmp]) + continue; + + if (rope >= 0) { + RANGE(range, (base * msk[i]) + bot[i], + (tmp * msk[i]) + bot[i] - 1UL, + RANGE_TYPE(ResExcIoBlock, 0)); + pZX1IoRes[rope] = + xf86AddResToList(pZX1IoRes[rope], &range, -1); + } + + base = tmp; + rope = pDecode[i][base]; + } + + xfree(pDecode[i]); + pDecode[i] = NULL; + } + + nRange = 0; + + /* + * Move on to CPU memory access decoding. For now, don't tell the common + * layer about CPU memory ranges that are either relocated to 0 or + * translated into PCI I/O. + */ + + SetRange(MIO_BASE, MIO_BASE + MIO_SIZE - 1UL, 64); /* mio */ + SetRange(ioaaddr, ioaaddr + ((IOA_SIZE << 1) - 1UL), 64); /* ioa */ + SetRange(PDH_START, PDH_LAST, 64); /* PDH */ + + SetRange(MIO_BASE, LMMIO_MASK, 64); /* Completeness */ + + if ((tmp = MIO_QUAD(LMMIO_DIST_BASE)) & RANGE_ENABLE) { + flagsd = RANGE_ENABLE; + maskd = MIO_QUAD(LMMIO_DIST_MASK); + based = tmp & maskd & (~RANGE_ENABLE & LMMIO_MASK); + lastd = based | (~maskd & LMMIO_MASK); + routed = MIO_QUAD(LMMIO_DIST_ROUTE) >> 58; + SetRange(based, lastd, routed); + } + + if ((tmp = MIO_QUAD(LMMIO_DIR_BASE0)) & RANGE_ENABLE) { + flags0 = RANGE_ENABLE; + mask0 = MIO_QUAD(LMMIO_DIR_MASK0); + base0 = tmp & mask0 & (~RANGE_ENABLE & LMMIO_MASK); + last0 = base0 | (~mask0 & LMMIO_MASK); + route0 = MIO_QUAD(LMMIO_DIR_ROUTE0) & 0x07U; + SetRange(base0, last0, 64); + } + + if ((tmp = MIO_QUAD(LMMIO_DIR_BASE1)) & RANGE_ENABLE) { + flags1 = RANGE_ENABLE; + mask1 = MIO_QUAD(LMMIO_DIR_MASK1); + base1 = tmp & mask1 & (~RANGE_ENABLE & LMMIO_MASK); + last1 = base1 | (~mask1 & LMMIO_MASK); + route1 = MIO_QUAD(LMMIO_DIR_ROUTE1) & 0x07U; + SetRange(base1, last1, 64); + } + + if ((tmp = MIO_QUAD(LMMIO_DIR_BASE2)) & RANGE_ENABLE) { + flags2 = RANGE_ENABLE; + mask2 = MIO_QUAD(LMMIO_DIR_MASK2); + base2 = tmp & mask2 & (~RANGE_ENABLE & LMMIO_MASK); + last2 = base2 | (~mask2 & LMMIO_MASK); + route2 = MIO_QUAD(LMMIO_DIR_ROUTE2) & 0x07U; + SetRange(base2, last2, 64); + } + + if ((tmp = MIO_QUAD(LMMIO_DIR_BASE3)) & RANGE_ENABLE) { + flags3 = RANGE_ENABLE; + mask3 = MIO_QUAD(LMMIO_DIR_MASK3); + base3 = tmp & mask3 & (~RANGE_ENABLE & LMMIO_MASK); + last3 = base3 | (~mask3 & LMMIO_MASK); + route3 = MIO_QUAD(LMMIO_DIR_ROUTE3) & 0x07U; + SetRange(base3, last3, 64); + } + + if ((tmp = MIO_QUAD(GMMIO_DIST_BASE)) & RANGE_ENABLE) { + flagsg = tmp & (RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO); + maskg = MIO_QUAD(GMMIO_DIST_MASK); + baseg = tmp & maskg & + (~(RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO) & GMMIO_MASK); + lastg = baseg | (~maskg & GMMIO_MASK); + tmp = routeg = MIO_QUAD(GMMIO_DIST_ROUTE) >> 58; + if (!(flagsg & (PORT_DISABLE & MAP_TO_LMMIO)) && (tmp > 26)) + tmp = 26; + SetRange(baseg, lastg, tmp); + } + + if ((tmp = MIO_QUAD(IOS_BASE)) & RANGE_ENABLE) { + flagsl = RANGE_ENABLE; + basel = tmp & (~RANGE_ENABLE & GMMIO_MASK); + lastl = basel | 0x001FFFFFUL; + SetRange(basel, lastl, 64); + } + + if (flagsd) { + i = GetRange(based); + for (tmp = based; tmp <= lastd; tmp += msk[i]) { + if ((tmp & maskd) == based) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U]; + } + } + + flagsd = 0; + } + + /* LMMIO distributed range does not address anything beyond 0xFED00000 */ + i = GetRange(MIO_BASE); + for (tmp = MIO_BASE; tmp <= LMMIO_MASK; tmp += msk[i]) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = -1; + } + + /* Dillon space can sometimes be redirected to rope 0 */ + tmp = MIO_QUAD(STATUS_CONTROL); + if (!(tmp & DILLON_PRESENT)) { + i = GetRange(PDH_START); + for (tmp = PDH_START; tmp <= PDH_LAST; tmp += msk[i]) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[0]; + } + } + + if (flagsg) { + unsigned long mask = (0x07UL << routeg) | maskg; + + i = GetRange(baseg); + for (tmp = baseg; tmp <= lastg; tmp += msk[i]) { + if ((tmp & maskg) == baseg) { + base = (tmp - bot[i]) / msk[i]; + + if ((flagsg & MAP_TO_LMMIO) || + (!(flagsg & PORT_DISABLE) && + (tmp <= ((tmp & mask) | 0x03FFFFFFUL)))) { + pDecode[i][base] = -1; + } else { + pDecode[i][base] = zx1_ropemap[(tmp >> routeg) & 0x07U]; + } + } + } + + flagsg = 0; + } + + if (flagsl) { + i = GetRange(basel); + for (tmp = basel; tmp <= lastl; tmp += msk[i]) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = -1; + } + + flagsl = 0; + } + + /* For now, assume directed LMMIO ranges don't overlap with each other */ + if (flags0) { + i = GetRange(base0); + for (tmp = base0; tmp <= last0; tmp += msk[i]) { + if ((tmp & mask0) == base0) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[route0]; + } + } + + flags0 = 0; + } + + if (flags1) { + i = GetRange(base1); + for (tmp = base1; tmp <= last1; tmp += msk[i]) { + if ((tmp & mask1) == base1) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[route1]; + } + } + + flags1 = 0; + } + + if (flags2) { + i = GetRange(base2); + for (tmp = base2; tmp <= last2; tmp += msk[i]) { + if ((tmp & mask2) == base2) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[route2]; + } + } + + flags2 = 0; + } + + if (flags3) { + i = GetRange(base3); + for (tmp = base3; tmp <= last3; tmp += msk[i]) { + if ((tmp & mask3) == base3) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = zx1_ropemap[route3]; + } + } + + flags3 = 0; + } + + /* Claim iao config area */ + i = GetRange(ioaaddr); + for (tmp = ioaaddr; tmp < ioaaddr + (IOA_SIZE << 1); tmp += msk[i]) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = -1; + } + + /* Claim mio config area */ + i = GetRange(MIO_BASE); + for (tmp = MIO_BASE; tmp < (MIO_BASE + MIO_SIZE); tmp += msk[i]) { + base = (tmp - bot[i]) / msk[i]; + pDecode[i][base] = -1; + } + + for (i = 0; i < nRange; i++) { + if (!pDecode[i]) + continue; + + rope = pDecode[i][0]; + for (base = tmp = 0; ++tmp < siz[i]; ) { + if (rope == pDecode[i][tmp]) + continue; + + if (rope >= 0) { + RANGE(range, (base * msk[i]) + bot[i], + (tmp * msk[i]) + bot[i] - 1UL, + RANGE_TYPE(ResExcMemBlock, 0)); + pZX1MemRes[rope] = + xf86AddResToList(pZX1MemRes[rope], &range, -1); + } + + base = tmp; + rope = pDecode[i][base]; + } + + xfree(pDecode[i]); + pDecode[i] = NULL; + } + + nRange = 0; + + return TRUE; +} + +/* This is called to finalise the results of a PCI bus scan */ +void +xf86PostScanZX1(void) +{ + pciConfigPtr pPCI, *ppPCI, *ppPCI2; + pciBusInfo_t *pBusInfo; + int i, idx; + + if (!pZX1mio) + return; + + /* + * Certain 2.4 & 2.5 Linux kernels add fake PCI devices. Remove them to + * prevent any possible interference with our PCI validation. + * + * Also, if VGA isn't routed on server entry, determine if VGA routing + * needs to be enabled while the server is running. + */ + idx = 0; + ppPCI = ppPCI2 = xf86scanpci(0); /* Recursion is only apparent */ + while ((pPCI = *ppPCI2++)) { + switch (pPCI->pci_device_vendor) { + case DEVID(HP, ZX1_SBA): + case DEVID(HP, ZX1_IOC): + case DEVID(HP, ZX1_LBA): + xfree(pPCI); /* Remove it */ + continue; + + default: + *ppPCI++ = pPCI; + idx++; + + if (zx1_hasvga) + continue; + + switch (pPCI->pci_base_class) { + case PCI_CLASS_PREHISTORIC: + if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) + break; + continue; + + case PCI_CLASS_DISPLAY: + if (pPCI->pci_sub_class == PCI_SUBCLASS_DISPLAY_VGA) + break; + continue; + + default: + continue; + } + + zx1_hasvga = TRUE; + continue; + } + } + + /* + * Restore hard-fail settings and figure out the actual subordinate bus + * numbers. + */ + for (i = 0; i < 8; i++) { + if (zx1_ropemap[i] != i) + continue; + + if (zx1_lbacntl[i] & LBA_HARD_FAIL) + MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i]; + + while ((zx1_busno[i] < zx1_subno[i]) && !pciBusInfo[zx1_subno[i]]) + zx1_subno[i]--; + + if (zx1_fakebus <= zx1_subno[i]) + zx1_fakebus = zx1_subno[i] + 1; + } + + if (zx1_fakebus >= pciNumBuses) { + if (zx1_fakebus >= pciMaxBusNum) + FatalError("HP ZX1: No room for fake PCI bus\n"); + pciNumBuses = zx1_fakebus + 1; + } + + /* Set up our extra bus functions */ + zx1BusFuncs = *(pciBusInfo[0]->funcs); + zx1BusFuncs.pciControlBridge = ControlZX1Bridge; + zx1BusFuncs.pciGetBridgeResources = GetZX1BridgeResources; + + /* Set up our own fake bus to act as the root segment */ + zx1FakeBus.configMech = pciBusInfo[0]->configMech; + zx1FakeBus.numDevices = pciBusInfo[0]->numDevices; + zx1FakeBus.primary_bus = zx1_fakebus; + pciBusInfo[zx1_fakebus] = &zx1FakeBus; + + /* Add the fake bus' host bridge */ + if (++idx >= MAX_PCI_DEVICES) + FatalError("HP ZX1: No room for fake Host-to-PCI bridge\n"); + *ppPCI++ = zx1FakeBus.bridge = pPCI = xnfcalloc(1, sizeof(pciDevice)); + pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, 0, 0); + pPCI->busnum = zx1_fakebus; + /* pPCI->devnum = pPCI->funcnum = 0; */ + pPCI->pci_device_vendor = DEVID(HP, ZX1_SBA); + pPCI->pci_base_class = PCI_CLASS_BRIDGE; + /* pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_HOST; */ + pPCI->fakeDevice = TRUE; + +#ifdef OLD_FORMAT + xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " + "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", + pPCI->busnum, pPCI->devnum, pPCI->funcnum, + pPCI->pci_vendor, pPCI->pci_device, pPCI->pci_rev_id, + pPCI->pci_base_class, pPCI->pci_sub_class); +#else + xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" + " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", + pPCI->busnum, pPCI->devnum, pPCI->funcnum, + pPCI->pci_vendor, pPCI->pci_device, + pPCI->pci_subsys_vendor, pPCI->pci_subsys_card, + pPCI->pci_rev_id, pPCI->pci_base_class, + pPCI->pci_sub_class, pPCI->pci_prog_if, + pPCI->pci_header_type); +#endif + + /* Add a fake PCI-to-PCI bridge to represent each active rope */ + for (i = 0; i < 8; i++) { + if ((zx1_ropemap[i] != i) || !(pBusInfo = pciBusInfo[zx1_busno[i]])) + continue; + + if (++idx >= MAX_PCI_DEVICES) + FatalError("HP ZX1: No room for fake PCI-to-PCI bridge\n"); + *ppPCI++ = pPCI = xnfcalloc(1, sizeof(pciDevice)); + pPCI->busnum = zx1_fakebus; + pPCI->devnum = i | 0x10; + /* pPCI->funcnum = 0; */ + pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, pPCI->devnum, 0); + pPCI->pci_device_vendor = DEVID(HP, ZX1_LBA); + pPCI->pci_base_class = PCI_CLASS_BRIDGE; + pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_PCI; + pPCI->pci_header_type = 1; + pPCI->pci_primary_bus_number = zx1_fakebus; + pPCI->pci_secondary_bus_number = zx1_busno[i]; + pPCI->pci_subordinate_bus_number = zx1_subno[i]; + pPCI->fakeDevice = TRUE; + + pBusInfo->bridge = pPCI; + pBusInfo->secondary = TRUE; + pBusInfo->primary_bus = zx1_fakebus; + + /* Plug in chipset routines */ + pBusInfo->funcs = &zx1BusFuncs; + +#ifdef OLD_FORMAT + xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " + "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", + pPCI->busnum, pPCI->devnum, pPCI->funcnum, + pPCI->pci_vendor, pPCI->pci_device, pPCI->pci_rev_id, + pPCI->pci_base_class, pPCI->pci_sub_class); +#else + xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" + " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", + pPCI->busnum, pPCI->devnum, pPCI->funcnum, + pPCI->pci_vendor, pPCI->pci_device, + pPCI->pci_subsys_vendor, pPCI->pci_subsys_card, + pPCI->pci_rev_id, pPCI->pci_base_class, + pPCI->pci_sub_class, pPCI->pci_prog_if, + pPCI->pci_header_type); +#endif + } + + *ppPCI = NULL; /* Terminate array */ +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h:1.1 --- /dev/null Thu Feb 27 12:32:29 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h Sun Feb 23 15:26:49 2003 @@ -0,0 +1,36 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h,v 1.1 2003/02/23 20:26:49 tsi Exp $ */ +/* + * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +#ifndef PCI_ZX1_H +#define PCI_ZX1_H 1 + +#include <X11/Xdefs.h> + +Bool xf86PreScanZX1(void); +void xf86PostScanZX1(void); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile:1.7 xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile:1.7 Tue Aug 15 12:05:37 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile Wed Oct 16 22:22:45 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile,v 1.7 2000/08/15 16:05:37 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile,v 1.9 2002/10/17 02:22:45 dawes Exp $ #include <Server.tmpl> BIOS_MOD = bios_DGmmap Index: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c:1.2 Tue Jan 26 05:40:38 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c Mon Feb 17 10:11:56 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c,v 1.2 1999/01/26 10:40:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c,v 1.4 2003/02/17 15:11:56 dawes Exp $ */ /* * INTEL DG/UX RELEASE 4.20 MU03 * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK @@ -81,4 +81,12 @@ /* Flush any pending input */ ioctl(mouse->mseFd, TCFLSH, 0); return(mouse->mseFd); +} + +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; } Index: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile:1.13 xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile:1.13 Tue Nov 14 13:20:37 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile Wed Oct 16 22:22:46 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.13 2000/11/14 18:20:37 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.15 2002/10/17 02:22:46 dawes Exp $ #include <Server.tmpl> Index: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c:1.7 Tue Nov 14 13:20:37 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c Mon Feb 17 10:11:57 2003 @@ -20,7 +20,7 @@ * PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c,v 1.7 2000/11/14 18:20:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c,v 1.9 2003/02/17 15:11:57 dawes Exp $ */ #define NEED_EVENTS #include "X.h" @@ -124,4 +124,12 @@ kd_event ke; while( read(xf86Info.consoleFd, &ke, sizeof(ke)) == sizeof(ke) ) xf86PostKbdEvent(ke.value.sc); +} + +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile:3.43 xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile:3.46 --- xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile:3.43 Thu Nov 16 14:45:03 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile Thu Oct 10 21:40:35 2002 @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/10/19 18:06:19 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.43 2000/11/16 19:45:03 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.46 2002/10/11 01:40:35 dawes Exp $ #include <Server.tmpl> @@ -26,7 +26,10 @@ MOUSESRC = lnx_mouse.c MOUSEOBJ = lnx_mouse.o -#if defined(i386Architecture) || defined(ia64Architecture) +KBDSRC = lnx_kbd.c lnx_KbdMap.c at_scancode.c +KBDOBJ = lnx_kbd.o lnx_KbdMap.o at_scancode.o + +#if defined(i386Architecture) || defined(ia64Architecture) || defined(x86_64Architecture) RES_SRCS=stdResource.c RES_OBJS=stdResource.o #else @@ -42,12 +45,12 @@ SRCS = lnx_init.c lnx_video.c lnx_io.c libc_wrapper.c bios_mmap.c \ VTsw_usl.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ lnx_pci.c vidmem.c lnx_apm.c $(JOYSTICK_SRC) $(DRI_SRC) $(RES_SRCS) \ - $(AXP_SRC) lnx_kmod.c lnx_agp.c + $(AXP_SRC) lnx_kmod.c lnx_agp.c $(KBDSRC) /*wcHelper.c*/ OBJS = lnx_init.o lnx_video.o lnx_io.o libc_wrapper.o bios_mmap.o \ VTsw_usl.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ lnx_pci.o vidmem.o lnx_apm.o $(JOYSTICK_OBJ) $(DRI_OBJ) $(RES_OBJS) \ - $(AXP_OBJ) lnx_kmod.o lnx_agp.o + $(AXP_OBJ) lnx_kmod.o lnx_agp.o $(KBDOBJ) /*wcHelper.o*/ INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC)/shared @@ -95,6 +98,7 @@ LinkSourceFile(bios_mmap.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) +LinkSourceFile(at_scancode.c,../shared) LinkSourceFile(posix_tty.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(vidmem.c,../shared) @@ -103,7 +107,7 @@ LinkSourceFile($(DRI_SRC),../shared) -#if defined(i386Architecture) || defined(ia64Architecture) +#if defined(i386Architecture) || defined(ia64Architecture) || defined (x86_64Architecture) LinkSourceFile(stdResource.c,../shared) #endif #if defined(AlphaArchitecture) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h:3.2 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h:3.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h:3.2 Mon Feb 14 21:00:14 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h Mon Nov 25 09:05:04 2002 @@ -1,11 +1,43 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h,v 3.2 2000/02/15 02:00:14 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h,v 3.3 2002/11/25 14:05:04 eich Exp $ */ #ifndef LNX_H_ -#ifdef __alpha__ +# ifdef __alpha__ extern unsigned long _bus_base __P ((void)) __attribute__ ((const)); extern unsigned long _bus_base_sparse __P ((void)) __attribute__ ((const)); extern int iopl __P ((int __level)); -#endif + +/* new pciconfig_iobase syscall added in 2.2.15 and 2.3.99 */ +# include <linux/unistd.h> +# include <asm/pci.h> +extern long (*_iobase)(unsigned, int, int, int); + +/* + * _iobase deals with the case the __NR_pciconfig_iobase is either undefined + * or unsupported by the kernel, but we need to make sure that the `which' + * argument symbols are defined. + */ +# ifndef IOBASE_HOSE +# define IOBASE_HOSE 0 +# endif +# ifndef IOBASE_SPARSE_MEM +# define IOBASE_SPARSE_MEM 1 +# endif +# ifndef IOBASE_DENSE_MEM +# define IOBASE_DENSE_MEM 2 +# endif +# ifndef IOBASE_SPARSE_IO +# define IOBASE_SPARSE_IO 3 +# endif +# ifndef IOBASE_DENSE_IO +# define IOBASE_DENSE_IO 4 +# endif +# ifndef IOBASE_ROOT_BUS +# define IOBASE_ROOT_BUS 5 +# endif +# ifndef IOBASE_FROM_HOSE +# define IOBASE_FROM_HOSE 0x10000 +# endif +# endif /* __alpha__ */ #define LNX_H_ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.17 xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.18 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.17 Thu Nov 1 18:35:33 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c Fri Jan 25 16:56:19 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.17 2001/11/01 23:35:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.18 2002/01/25 21:56:19 tsi Exp $ */ /* Resource information code */ @@ -12,8 +12,20 @@ #include "xf86_OSlib.h" #include "lnx.h" +/* Avoid Imakefile changes */ +#include "bus/Pci.h" + +resRange PciAvoid[] = +{ +#if !defined(__sparc__) || !defined(INCLUDE_XF86_NO_DOMAIN) + _PCI_AVOID_PC_STYLE, +#endif + _END +}; + +#ifdef INCLUDE_XF86_NO_DOMAIN + #ifdef __alpha__ -resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; resPtr xf86BusAccWindowsFromOS(void) @@ -112,6 +124,8 @@ return ret; } +#ifdef INCLUDE_UNUSED + resPtr xf86IsaBusAccWindowsFromOS(void) { @@ -126,6 +140,8 @@ return ret; } +#endif /* INCLUDE_UNUSED */ + resPtr xf86AccResFromOS(resPtr ret) { @@ -165,18 +181,19 @@ return ret; } -#elif defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__sh__) || defined(__mc68000__) || defined(__arm__) || defined(__s390__) || defined(__hppa__) +#elif defined(__powerpc__) || \ + defined(__sparc__) || \ + defined(__mips__) || \ + defined(__sh__) || \ + defined(__mc68000__) || \ + defined(__arm__) || \ + defined(__s390__) || \ + defined(__hppa__) /* XXX this isn't exactly correct but it will get the server working * for now until we get something better. */ -#ifdef __sparc__ -resRange PciAvoid[] = {_END}; -#else -resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; -#endif - resPtr xf86BusAccWindowsFromOS(void) { @@ -213,6 +230,8 @@ return ret; } +#ifdef INCLUDE_UNUSED */ + resPtr xf86IsaBusAccWindowsFromOS(void) { @@ -231,6 +250,8 @@ return ret; } +#endif /* INCLUDE_UNUSED */ + resPtr xf86AccResFromOS(resPtr ret) { @@ -261,3 +282,5 @@ #error : Put your platform dependent code here!! #endif + +#endif /* INCLUDE_XF86_NO_DOMAIN */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c:1.1 --- /dev/null Thu Feb 27 12:32:32 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c Thu Oct 10 21:40:35 2002 @@ -0,0 +1,603 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c,v 1.1 2002/10/11 01:40:35 dawes Exp $ */ + +/* + * Slightly modified xf86KbdLnx.c which is + * + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + */ + +#include "X.h" +#include "Xmd.h" +#include "input.h" +#include "scrnintstr.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" +#include "xf86Xinput.h" +#include "xf86OSKbd.h" +#include "atKeynames.h" + +#include "xf86Keymap.h" +#include "DECkeysym.h" + +#include "lnx_kbd.h" + +/*ARGSUSED*/ + +/* + * KbdGetMapping -- + * Get the national keyboard mapping. The keyboard type is set, a new map + * and the modifiermap is computed. + */ + +static void readKernelMapping(InputInfoPtr pInfo, + KeySymsPtr pKeySyms, CARD8 *pModMap); +void +KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + KeySym *k; + char type; + int i; + + readKernelMapping(pInfo, pKeySyms, pModMap); + + /* + * compute the modifier map + */ + for (i = 0; i < MAP_LENGTH; i++) + pModMap[i] = NoSymbol; /* make sure it is restored */ + + for (k = map, i = MIN_KEYCODE; + i < (NUM_KEYCODES + MIN_KEYCODE); + i++, k += 4) + + switch(*k) { + + case XK_Shift_L: + case XK_Shift_R: + pModMap[i] = ShiftMask; + break; + + case XK_Control_L: + case XK_Control_R: + pModMap[i] = ControlMask; + break; + + case XK_Caps_Lock: + pModMap[i] = LockMask; + break; + + case XK_Alt_L: + case XK_Alt_R: + pModMap[i] = AltMask; + break; + + case XK_Num_Lock: + pModMap[i] = NumLockMask; + break; + + case XK_Scroll_Lock: + pModMap[i] = ScrollLockMask; + break; + + /* kana support */ + case XK_Kana_Lock: + case XK_Kana_Shift: + pModMap[i] = KanaMask; + break; + + /* alternate toggle for multinational support */ + case XK_Mode_switch: + pModMap[i] = AltLangMask; + break; + + } + + pKbd->kbdType = ioctl(pInfo->fd, KDGKBTYPE, &type) != -1 ? type : KB_101; + + pKeySyms->map = map; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + pKeySyms->minKeyCode = MIN_KEYCODE; + pKeySyms->maxKeyCode = MAX_KEYCODE; +} + +#include <linux/keyboard.h> + +static KeySym linux_to_x[256] = { + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, XK_Escape, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_space, XK_exclam, XK_quotedbl, XK_numbersign, + XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, + XK_parenleft, XK_parenright, XK_asterisk, XK_plus, + XK_comma, XK_minus, XK_period, XK_slash, + XK_0, XK_1, XK_2, XK_3, + XK_4, XK_5, XK_6, XK_7, + XK_8, XK_9, XK_colon, XK_semicolon, + XK_less, XK_equal, XK_greater, XK_question, + XK_at, XK_A, XK_B, XK_C, + XK_D, XK_E, XK_F, XK_G, + XK_H, XK_I, XK_J, XK_K, + XK_L, XK_M, XK_N, XK_O, + XK_P, XK_Q, XK_R, XK_S, + XK_T, XK_U, XK_V, XK_W, + XK_X, XK_Y, XK_Z, XK_bracketleft, + XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, + XK_grave, XK_a, XK_b, XK_c, + XK_d, XK_e, XK_f, XK_g, + XK_h, XK_i, XK_j, XK_k, + XK_l, XK_m, XK_n, XK_o, + XK_p, XK_q, XK_r, XK_s, + XK_t, XK_u, XK_v, XK_w, + XK_x, XK_y, XK_z, XK_braceleft, + XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, + XK_currency, XK_yen, XK_brokenbar, XK_section, + XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, + XK_notsign, XK_hyphen, XK_registered, XK_macron, + XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, + XK_acute, XK_mu, XK_paragraph, XK_periodcentered, + XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, + XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, + XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, + XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, + XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, + XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, + XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, + XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, + XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, + XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, + XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, + XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, + XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, + XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, + XK_eth, XK_ntilde, XK_ograve, XK_oacute, + XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, + XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, + XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis +}; + +/* + * Maps the AT keycodes to Linux keycodes + */ +static unsigned char at2lnx[NUM_KEYCODES] = +{ + 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */ + 0x03, /* KEY_2 */ 0x04, /* KEY_3 */ + 0x05, /* KEY_4 */ 0x06, /* KEY_5 */ + 0x07, /* KEY_6 */ 0x08, /* KEY_7 */ + 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */ + 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */ + 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */ + 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */ + 0x11, /* KEY_W */ 0x12, /* KEY_E */ + 0x13, /* KEY_R */ 0x14, /* KEY_T */ + 0x15, /* KEY_Y */ 0x16, /* KEY_U */ + 0x17, /* KEY_I */ 0x18, /* KEY_O */ + 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */ + 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */ + 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */ + 0x1f, /* KEY_S */ 0x20, /* KEY_D */ + 0x21, /* KEY_F */ 0x22, /* KEY_G */ + 0x23, /* KEY_H */ 0x24, /* KEY_J */ + 0x25, /* KEY_K */ 0x26, /* KEY_L */ + 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */ + 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */ + 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */ + 0x2d, /* KEY_X */ 0x2e, /* KEY_C */ + 0x2f, /* KEY_V */ 0x30, /* KEY_B */ + 0x31, /* KEY_N */ 0x32, /* KEY_M */ + 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */ + 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */ + 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */ + 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */ + 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */ + 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */ + 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */ + 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */ + 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */ + 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */ + 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */ + 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */ + 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */ + 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */ + 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */ + 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */ + 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */ + 0x00, /* 0x55 */ 0x56, /* KEY_Less */ + 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */ + 0x66, /* KEY_Home */ 0x67, /* KEY_Up */ + 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */ + 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */ + 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */ + 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */ + 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */ + 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */ + 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */ + 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */ + 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */ + 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */ + 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */ + 0x00, /* 0x71 */ 0x00, /* 0x72 */ + 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */ + 0x00, /* 0x75 */ 0x00, /* 0x76 */ + 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */ + 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */ + 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */ + 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */ + 0x00, /* 0x7f */ +}; +#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) + +#define NUM_CUSTOMKEYS NR_KEYS + +static void +readKernelMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + KeySym *k; + int i; + int maxkey; + static unsigned char tbl[GLYPHS_PER_KEY] = + { + 0, /* unshifted */ + 1, /* shifted */ + 0, /* modeswitch unshifted */ + 0 /* modeswitch shifted */ + }; + + /* + * Read the mapping from the kernel. + * Since we're still using the XFree86 scancode->AT keycode mapping + * routines, we need to convert the AT keycodes to Linux keycodes, + * then translate the Linux keysyms into X keysyms. + * + * First, figure out which tables to use for the modeswitch columns + * above, from the XF86Config fields. + */ + tbl[2] = 8; /* alt */ + tbl[3] = tbl[2] | 1; + + if (pKbd->CustomKeycodes) { + k = map; + maxkey = NUM_CUSTOMKEYS; + } + else { + k = map+GLYPHS_PER_KEY; + maxkey = NUM_AT2LNX; + } + + for (i = 0; i < maxkey; ++i) + { + struct kbentry kbe; + int j; + + if (pKbd->CustomKeycodes) + kbe.kb_index = i; + else + kbe.kb_index = at2lnx[i]; + + for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) + { + unsigned short kval; + + *k = NoSymbol; + + kbe.kb_table = tbl[j]; + if ( + (!pKbd->CustomKeycodes && kbe.kb_index == 0) || + ioctl(pInfo->fd, KDGKBENT, &kbe)) + continue; + + kval = KVAL(kbe.kb_value); + switch (KTYP(kbe.kb_value)) + { + case KT_LATIN: + case KT_LETTER: + *k = linux_to_x[kval]; + break; + + case KT_FN: + if (kval <= 19) + *k = XK_F1 + kval; + else switch (kbe.kb_value) + { + case K_FIND: + *k = XK_Home; /* or XK_Find */ + break; + case K_INSERT: + *k = XK_Insert; + break; + case K_REMOVE: + *k = XK_Delete; + break; + case K_SELECT: + *k = XK_End; /* or XK_Select */ + break; + case K_PGUP: + *k = XK_Prior; + break; + case K_PGDN: + *k = XK_Next; + break; + case K_HELP: + *k = XK_Help; + break; + case K_DO: + *k = XK_Execute; + break; + case K_PAUSE: + *k = XK_Pause; + break; + case K_MACRO: + *k = XK_Menu; + break; + default: + break; + } + break; + + case KT_SPEC: + switch (kbe.kb_value) + { + case K_ENTER: + *k = XK_Return; + break; + case K_BREAK: + *k = XK_Break; + break; + case K_CAPS: + *k = XK_Caps_Lock; + break; + case K_NUM: + *k = XK_Num_Lock; + break; + case K_HOLD: + *k = XK_Scroll_Lock; + break; + case K_COMPOSE: + *k = XK_Multi_key; + break; + default: + break; + } + break; + + case KT_PAD: + switch (kbe.kb_value) + { + case K_PPLUS: + *k = XK_KP_Add; + break; + case K_PMINUS: + *k = XK_KP_Subtract; + break; + case K_PSTAR: + *k = XK_KP_Multiply; + break; + case K_PSLASH: + *k = XK_KP_Divide; + break; + case K_PENTER: + *k = XK_KP_Enter; + break; + case K_PCOMMA: + *k = XK_KP_Separator; + break; + case K_PDOT: + *k = XK_KP_Decimal; + break; + case K_PPLUSMINUS: + *k = XK_KP_Subtract; + break; + default: + if (kval <= 9) + *k = XK_KP_0 + kval; + break; + } + break; + + /* + * KT_DEAD keys are for accelerated diacritical creation. + */ + case KT_DEAD: + switch (kbe.kb_value) + { + case K_DGRAVE: + *k = XK_dead_grave; + break; + case K_DACUTE: + *k = XK_dead_acute; + break; + case K_DCIRCM: + *k = XK_dead_circumflex; + break; + case K_DTILDE: + *k = XK_dead_tilde; + break; + case K_DDIERE: + *k = XK_dead_diaeresis; + break; + } + break; + + case KT_CUR: + switch (kbe.kb_value) + { + case K_DOWN: + *k = XK_Down; + break; + case K_LEFT: + *k = XK_Left; + break; + case K_RIGHT: + *k = XK_Right; + break; + case K_UP: + *k = XK_Up; + break; + } + break; + + case KT_SHIFT: + switch (kbe.kb_value) + { + case K_ALTGR: + *k = XK_Alt_R; + break; + case K_ALT: + *k = (kbe.kb_index == 0x64 ? + XK_Alt_R : XK_Alt_L); + break; + case K_CTRL: + *k = (kbe.kb_index == 0x61 ? + XK_Control_R : XK_Control_L); + break; + case K_CTRLL: + *k = XK_Control_L; + break; + case K_CTRLR: + *k = XK_Control_R; + break; + case K_SHIFT: + *k = (kbe.kb_index == 0x36 ? + XK_Shift_R : XK_Shift_L); + break; + case K_SHIFTL: + *k = XK_Shift_L; + break; + case K_SHIFTR: + *k = XK_Shift_R; + break; + default: + break; + } + break; + + /* + * KT_ASCII keys accumulate a 3 digit decimal number that gets + * emitted when the shift state changes. We can't emulate that. + */ + case KT_ASCII: + break; + + case KT_LOCK: + if (kbe.kb_value == K_SHIFTLOCK) + *k = XK_Shift_Lock; + break; + + default: + break; + } + } + + if (k[-1] == k[-2]) k[-1] = NoSymbol; + if (k[-2] == k[-3]) k[-2] = NoSymbol; + if (k[-3] == k[-4]) k[-3] = NoSymbol; + if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol; + if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol; + } + + if (!pKbd->CustomKeycodes) + return; + + /* + * Find the Mapping for the special server functions + */ + pKbd->specialMap = (TransMapPtr) xcalloc(NUM_CUSTOMKEYS, 1); + if (pKbd->specialMap != NULL) { + pKbd->specialMap->end = NUM_CUSTOMKEYS; + pKbd->specialMap->map = (unsigned char*) xcalloc(NUM_CUSTOMKEYS, 1); + if (pKbd->specialMap == NULL) { + xfree(pKbd->specialMap); + pKbd->specialMap = NULL; + } + } + if (pKbd->specialMap == NULL) { + xf86Msg(X_ERROR, "%s can't allocate \"special map\"\n", pInfo->name); + return; + } + + for (i = 0; i < NUM_CUSTOMKEYS; ++i) { + struct kbentry kbe; + int special = 0; + + kbe.kb_index = i; + kbe.kb_table = 0; /* Plain map */ + if (!ioctl(pInfo->fd, KDGKBENT, &kbe)) + switch (kbe.kb_value) { + case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */ + special = KEY_BackSpace; + break; + case K_PMINUS: + special = KEY_KP_Minus; + break; + case K_PPLUS: + special = KEY_KP_Plus; + break; + case K_F1: + special = KEY_F1; + break; + case K_F2: + special = KEY_F2; + break; + case K_F3: + special = KEY_F3; + break; + case K_F4: + special = KEY_F4; + break; + case K_F5: + special = KEY_F5; + break; + case K_F6: + special = KEY_F6; + break; + case K_F7: + special = KEY_F7; + break; + case K_F8: + special = KEY_F8; + break; + case K_F9: + special = KEY_F9; + break; + case K_F10: + special = KEY_F10; + break; + case K_F11: + special = KEY_F11; + break; + case K_F12: + special = KEY_F12; + break; + case K_ALT: + special = KEY_Alt; + break; + case K_ALTGR: + special = KEY_AltLang; + break; + case K_CONS: + special = KEY_SysReqest; + break; + } + pKbd->specialMap->map[i] = special; + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.8 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.8 Mon Nov 26 14:02:02 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c Thu Dec 12 13:29:11 2002 @@ -7,7 +7,7 @@ * Copyright © 2001 The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.8 2001/11/26 19:02:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.10 2002/12/12 18:29:11 eich Exp $ */ #include "X.h" #include "xf86.h" @@ -89,9 +89,16 @@ xf86ReleaseGART(-1); #if defined(linux) - /* Should this look for version >= rather than version == ? */ - if (agpinf.version.major != AGPGART_MAJOR_VERSION && - agpinf.version.minor != AGPGART_MINOR_VERSION) { + /* Per Dave Jones, every effort will be made to keep the + * agpgart interface backwards compatible, so allow all + * future versions. + */ + if ( +#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */ + agpinf.version.major < AGPGART_MAJOR_VERSION || +#endif + (agpinf.version.major == AGPGART_MAJOR_VERSION && + agpinf.version.minor < AGPGART_MINOR_VERSION)) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: Kernel agpgart driver version is not current" " (%d.%d vs %d.%d)\n", @@ -262,6 +269,10 @@ } pageOffset = offset / AGP_PAGE_SIZE; + xf86DrvMsgVerb(screenNum, X_INFO, 3, + "xf86BindGARTMemory: bind key %d at 0x%08x " + "(pgoffset %d)\n", key, offset, pageOffset); + bind.pg_start = pageOffset; bind.key = key; @@ -301,6 +312,9 @@ "failed (%s)\n", key, strerror(errno)); return FALSE; } + + xf86DrvMsgVerb(screenNum, X_INFO, 3, + "xf86UnbindGARTMemory: unbind key %d\n", key); return TRUE; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c:3.12 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c:3.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c:3.12 Mon Dec 24 17:54:31 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c Tue Oct 15 21:24:28 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.12 2001/12/24 22:54:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.13 2002/10/16 01:24:28 dawes Exp $ */ #include "X.h" #include "os.h" @@ -97,8 +97,12 @@ case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: - if (ioctl( fd, APM_IOC_SUSPEND, NULL )) - return PM_FAILED; + if (ioctl( fd, APM_IOC_SUSPEND, NULL )) { + if (errno == EBUSY) + return PM_CONTINUE; + else + return PM_FAILED; + } return PM_CONTINUE; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c:1.4 Thu Feb 15 14:46:03 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c Mon Nov 25 09:05:04 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.4 2001/02/15 19:46:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.5 2002/11/25 14:05:04 eich Exp $ */ #include <stdio.h> #include "X.h" @@ -104,5 +104,93 @@ } count++; } while (1); +} + +/* + * pciconfig_iobase wrappers and dynamic i/o selection + */ +#include <linux/unistd.h> +#include <asm/pci.h> +#include <errno.h> + +/* glibc versions (single hose only) */ +extern void _outb(char val, unsigned long port); +extern void _outw(short val, unsigned long port); +extern void _outl(int val, unsigned long port); +extern unsigned int _inb(unsigned long port); +extern unsigned int _inw(unsigned long port); +extern unsigned int _inl(unsigned long port); + +extern void _dense_outb(char, unsigned long); +extern void _dense_outw(short, unsigned long); +extern void _dense_outl(int, unsigned long); +extern unsigned int _dense_inb(unsigned long); +extern unsigned int _dense_inw(unsigned long); +extern unsigned int _dense_inl(unsigned long); + +void (*_alpha_outb)(char, unsigned long) = _outb; +void (*_alpha_outw)(short, unsigned long) = _outw; +void (*_alpha_outl)(int, unsigned long) = _outl; +unsigned int (*_alpha_inb)(unsigned long) = _inb; +unsigned int (*_alpha_inw)(unsigned long) = _inw; +unsigned int (*_alpha_inl)(unsigned long) = _inl; + +static long _alpha_iobase_query(unsigned, int, int, int); +long (*_iobase)(unsigned, int, int, int) = _alpha_iobase_query; + +static long +_alpha_iobase(unsigned flags, int hose, int bus, int devfn) +{ +#ifdef __NR_pciconfig_iobase + if (bus < 0) { + bus = hose; + flags |= IOBASE_FROM_HOSE; + } + + return syscall(__NR_pciconfig_iobase, flags, bus, devfn); +#else + return -ENOSYS +#endif +} + +static long +_alpha_iobase_legacy(unsigned flags, int hose, int bus, int devfn) +{ + if (hose > 0) return -ENODEV; + if (flags & IOBASE_DENSE_MEM) return _bus_base(); + if (flags & IOBASE_SPARSE_MEM) return _bus_base_sparse(); + return 0; +} + +static long +_alpha_iobase_query(unsigned flags, int hose, int bus, int devfn) +{ + /* + * Only use iobase if the syscall is supported *and* it's + * a dense io system + */ + if (_alpha_iobase(IOBASE_DENSE_IO, 0, 0, 0) > 0) { + /* + * The syscall worked and it's a dense io system - take over the + * io subsystem + */ + _iobase = _alpha_iobase; + +#ifndef INCLUDE_XF86_NO_DOMAIN + /* + * Only take over the inx/outx functions if this is a dense I/O + * system *and* addressing domains are being used. The dense I/O + * routines expect I/O to be mapped (as done in xf86MapDomainIO) + */ + _alpha_outb = _dense_outb; + _alpha_outw = _dense_outw; + _alpha_outl = _dense_outl; + _alpha_inb = _dense_inb; + _alpha_inw = _dense_inw; + _alpha_inl = _dense_inl; +#endif /* !INCLUDE_XF86_NO_DOMAIN */ + } else _iobase = _alpha_iobase_legacy; + + return _iobase(flags, hose, bus, devfn); } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c:3.6 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c:3.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c:3.6 Thu Feb 15 06:03:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c Mon Nov 25 09:05:04 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.6 2001/02/15 11:03:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.7 2002/11/25 14:05:04 eich Exp $ */ #include "X.h" #include "input.h" @@ -85,3 +85,63 @@ write_mem_barrier(); *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; } + + +#ifndef INCLUDE_XF86_NO_DOMAIN + +void +_dense_outb(char val, unsigned long port) +{ + if ((port & ~0xffff) == 0) return _outb(val, port); + + write_mem_barrier(); + *(volatile CARD8 *)port = val; +} + +void +_dense_outw(short val, unsigned long port) +{ + if ((port & ~0xffff) == 0) return _outw(val, port); + + write_mem_barrier(); + *(volatile CARD16 *)port = val; +} + +void +_dense_outl(int val, unsigned long port) +{ + if ((port & ~0xffff) == 0) return _outl(val, port); + + write_mem_barrier(); + *(volatile CARD32 *)port = val; +} + +unsigned int +_dense_inb(unsigned long port) +{ + if ((port & ~0xffff) == 0) return _inb(port); + + mem_barrier(); + return *(volatile CARD8 *)port; +} + +unsigned int +_dense_inw(unsigned long port) +{ + if ((port & ~0xffff) == 0) return _inw(port); + + mem_barrier(); + return *(volatile CARD16 *)port; +} + +unsigned int +_dense_inl(unsigned long port) +{ + if ((port & ~0xffff) == 0) return _inl(port); + + mem_barrier(); + return *(volatile CARD32 *)port; +} + +#endif /* !INCLUDE_XF86_NO_DOMAIN */ + Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.22 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.24 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.22 Wed Nov 7 23:00:14 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c Sun Oct 20 17:45:27 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.22 2001/11/08 04:00:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.24 2002/10/20 21:45:27 tsi Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -51,15 +51,15 @@ void xf86SetKbdLeds(int leds) { - ioctl(xf86Info.consoleFd, KDSETLED, leds); + ioctl(xf86Info.consoleFd, KDSETLED, leds); } int xf86GetKbdLeds() { - int leds; + int leds = 0; - ioctl(xf86Info.consoleFd, KDGETLED, &leds); + ioctl(xf86Info.consoleFd, KDGETLED, &leds); return(leds); } @@ -72,6 +72,13 @@ #include <asm/kbio.h> #endif +/* Deal with spurious kernel header change */ +#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) +# define rate period +# endif +#endif + static int KDKBDREP_ioctl_ok(int rate, int delay) { #if defined(KDKBDREP) && !defined(__sparc__) @@ -133,6 +140,7 @@ #endif /* KIOCSRATE */ } +#undef rate #if NeedFunctionPrototypes void xf86SetKbdRepeat(char rad) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c:1.2 --- /dev/null Thu Feb 27 12:32:32 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c Mon Feb 17 10:11:57 2003 @@ -0,0 +1,523 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.2 2003/02/17 15:11:57 dawes Exp $ */ + +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * Author: Ivan Pascal. + * + * Based on the code from lnx_io.c which is + * Copyright 1992 by Orest Zborowski <obz@Kodak.com> + * Copyright 1993 by David Dawes <dawes@xfree86.org> + */ + +#define NEED_EVENTS +#include "X.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#include "xf86Xinput.h" +#include "xf86OSKbd.h" +#include "atKeynames.h" +#include "lnx_kbd.h" + +#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ + +static KbdProtocolRec protocols[] = { + {"standard", PROT_STD }, + { NULL, PROT_UNKNOWN } +}; + +extern Bool VTSwitchEnabled; +#ifdef USE_VT_SYSREQ +extern Bool VTSysreqToggle; +#endif + +static void +SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration) +{ + if (loudness && pitch) + { + ioctl(pInfo->fd, KDMKTONE, + ((1193190 / pitch) & 0xffff) | + (((unsigned long)duration * + loudness / 50) << 16)); + } +} + +static void +SetKbdLeds(InputInfoPtr pInfo, int leds) +{ + int real_leds = 0; + +#if defined (__sparc__) + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + if (pKbd->sunKbd) { + if (leds & 0x08) real_leds |= XLED1; + if (leds & 0x04) real_leds |= XLED3; + if (leds & 0x02) real_leds |= XLED4; + if (leds & 0x01) real_leds |= XLED2; + leds = real_leds; + real_leds = 0; + } +#endif /* defined (__sparc__) */ +#ifdef LED_CAP + if (leds & XLED1) real_leds |= LED_CAP; + if (leds & XLED2) real_leds |= LED_NUM; + if (leds & XLED3) real_leds |= LED_SCR; +#ifdef LED_COMP + if (leds & XLED4) real_leds |= LED_COMP; +#else + if (leds & XLED4) real_leds |= LED_SCR; +#endif +#endif + ioctl(pInfo->fd, KDSETLED, real_leds); +} + +static int +GetKbdLeds(InputInfoPtr pInfo) +{ + int real_leds, leds = 0; + + ioctl(pInfo->fd, KDGETLED, &real_leds); + + if (real_leds & LED_CAP) leds |= XLED1; + if (real_leds & LED_NUM) leds |= XLED2; + if (real_leds & LED_SCR) leds |= XLED3; + + return(leds); +} + +/* kbd rate stuff based on kbdrate.c from Rik Faith <faith@cs.unc.edu> et.al. + * from util-linux-2.9t package */ + + +#ifdef __sparc__ +#include <asm/param.h> +#include <asm/kbio.h> +#endif + +static int +KDKBDREP_ioctl_ok(int rate, int delay) { +#if defined(KDKBDREP) && !defined(__sparc__) + /* This ioctl is defined in <linux/kd.h> but is not + implemented anywhere - must be in some m68k patches. */ + struct kbd_repeat kbdrep_s; + + /* don't change, just test */ + kbdrep_s.rate = -1; + kbdrep_s.delay = -1; + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { + return 0; + } + + /* do the change */ + if (rate == 0) /* switch repeat off */ + kbdrep_s.rate = 0; + else + kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ + if (kbdrep_s.rate < 1) + kbdrep_s.rate = 1; + kbdrep_s.delay = delay; + if (kbdrep_s.delay < 1) + kbdrep_s.delay = 1; + + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { + return 0; + } + + return 1; /* success! */ +#else /* no KDKBDREP */ + return 0; +#endif /* KDKBDREP */ +} + +static int +KIOCSRATE_ioctl_ok(int rate, int delay) { +#ifdef KIOCSRATE + struct kbd_rate kbdrate_s; + int fd; + + fd = open("/dev/kbd", O_RDONLY); + if (fd == -1) + return 0; + + kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */ + kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ + if (kbdrate_s.rate > 50) + kbdrate_s.rate = 50; + + if (ioctl( fd, KIOCSRATE, &kbdrate_s )) + return 0; + + close( fd ); + + return 1; +#else /* no KIOCSRATE */ + return 0; +#endif /* KIOCSRATE */ +} + +static void +SetKbdRepeat(InputInfoPtr pInfo, char rad) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int i; + int timeout; + int value = 0x7f; /* Maximum delay with slowest rate */ + +#ifdef __sparc__ + int rate = 500; /* Default rate */ + int delay = 200; /* Default delay */ +#else + int rate = 300; /* Default rate */ + int delay = 250; /* Default delay */ +#endif + + static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150, + 133, 120, 109, 100, 92, 86, 80, 75, 67, + 60, 55, 50, 46, 43, 40, 37, 33, 30, 27, + 25, 23, 21, 20 }; +#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int )) + + static int valid_delays[] = { 250, 500, 750, 1000 }; +#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int )) + + if (pKbd->rate >= 0) + rate = pKbd->rate * 10; + if (pKbd->delay >= 0) + delay = pKbd->delay; + + if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */ + return; + + if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */ + return; + + if (xf86IsPc98()) + return; + +#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) + + /* The ioport way */ + + for (i = 0; i < RATE_COUNT; i++) + if (rate >= valid_rates[i]) { + value &= 0x60; + value |= i; + break; + } + + for (i = 0; i < DELAY_COUNT; i++) + if (delay <= valid_delays[i]) { + value &= 0x1f; + value |= i << 5; + break; + } + + timeout = KBC_TIMEOUT; + while (((inb(0x64) & 2) == 2) && --timeout) + usleep(1000); /* wait */ + + if (timeout == 0) + return; + + outb(0x60, 0xf3); /* set typematic rate */ + while (((inb(0x64) & 2) == 2) && --timeout) + usleep(1000); /* wait */ + + usleep(10000); + outb(0x60, value); + +#endif /* __alpha__ || __i386__ || __ia64__ */ +} + +typedef struct { + int kbdtrans; + struct termios kbdtty; +} LnxKbdPrivRec, *LnxKbdPrivPtr; + +static int +KbdInit(InputInfoPtr pInfo, int what) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private; + + if (pKbd->isConsole) { + ioctl (pInfo->fd, KDGKBMODE, &(priv->kbdtrans)); + tcgetattr (pInfo->fd, &(priv->kbdtty)); + } + if (!pKbd->CustomKeycodes) { + pKbd->RemapScanCode = ATScancode; + } + + return Success; +} + +static int +KbdOn(InputInfoPtr pInfo, int what) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private; + struct termios nTty; + + if (pKbd->isConsole) { + if (pKbd->CustomKeycodes) + ioctl(pInfo->fd, KDSKBMODE, K_MEDIUMRAW); + else + ioctl(pInfo->fd, KDSKBMODE, K_RAW); + + nTty = priv->kbdtty; + nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); + nTty.c_oflag = 0; + nTty.c_cflag = CREAD | CS8; + nTty.c_lflag = 0; + nTty.c_cc[VTIME]=0; + nTty.c_cc[VMIN]=1; + cfsetispeed(&nTty, 9600); + cfsetospeed(&nTty, 9600); + tcsetattr(pInfo->fd, TCSANOW, &nTty); + } + return Success; +} + +static int +KbdOff(InputInfoPtr pInfo, int what) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private; + + if (pKbd->isConsole) { + ioctl(pInfo->fd, KDSKBMODE, priv->kbdtrans); + tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty)); + } + return Success; +} + +static int +GetSpecialKey(InputInfoPtr pInfo, int scanCode) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int specialkey = scanCode; + +#if defined (__sparc__) + if (pKbd->sunKbd) { + switch (scanCode) { + case 0x2b: specialkey = KEY_BackSpace; break; + case 0x47: specialkey = KEY_KP_Minus; break; + case 0x7d: specialkey = KEY_KP_Plus; break; + /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ + case 0x05: specialkey = KEY_F1; break; + case 0x06: specialkey = KEY_F2; break; + case 0x08: specialkey = KEY_F3; break; + case 0x0a: specialkey = KEY_F4; break; + case 0x0c: specialkey = KEY_F5; break; + case 0x0e: specialkey = KEY_F6; break; + case 0x10: specialkey = KEY_F7; break; + case 0x11: specialkey = KEY_F8; break; + case 0x12: specialkey = KEY_F9; break; + case 0x07: specialkey = KEY_F10; break; + case 0x09: specialkey = KEY_F11; break; + case 0x0b: specialkey = KEY_F12; break; + default: specialkey = 0; break; + } + return specialkey; + } +#endif + + if (pKbd->CustomKeycodes) { + specialkey = pKbd->specialMap->map[scanCode]; + } + return specialkey; +} + +#define ModifierSet(k) ((modifiers & (k)) == (k)) + +static +Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + + if(!pKbd->vtSwitchSupported) + return FALSE; + + if ((ModifierSet(ControlMask | AltMask)) || + (ModifierSet(ControlMask | AltLangMask))) { + if (VTSwitchEnabled && !xf86Info.vtSysreq) { + switch (key) { + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + case KEY_F5: + case KEY_F6: + case KEY_F7: + case KEY_F8: + case KEY_F9: + case KEY_F10: + if (down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); + return TRUE; + } + case KEY_F11: + case KEY_F12: + if (down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); + return TRUE; + } + } + } + } +#ifdef USE_VT_SYSREQ + if (VTSwitchEnabled && xf86Info.vtSysreq) { + switch (key) { + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + case KEY_F5: + case KEY_F6: + case KEY_F7: + case KEY_F8: + case KEY_F9: + case KEY_F10: + if (VTSysreqToggle && down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); + VTSysreqToggle = FALSE; + return TRUE; + } + break; + case KEY_F11: + case KEY_F12: + if (VTSysreqToggle && down) { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); + VTSysreqToggle = FALSE; + return TRUE; + } + break; + /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ + case KEY_Alt: + case KEY_AltLang: + break; + case KEY_SysReqest: + if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down) + VTSysreqToggle = TRUE; + break; + default: + /* + * We only land here when Alt-SysReq is followed by a + * non-switching key. + */ + if (VTSysreqToggle) + VTSysreqToggle = FALSE; + } + } +#endif /* USE_VT_SYSREQ */ + return FALSE; +} + +static void +stdReadInput(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + unsigned char rBuf[64]; + int nBytes, i; + if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) { + for (i = 0; i < nBytes; i++) + pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, + rBuf[i] & 0x80 ? FALSE : TRUE); + } +} + +static Bool +OpenKeyboard(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + int i; + KbdProtocolId prot = PROT_UNKNOWN; + char *s; + + s = xf86SetStrOption(pInfo->options, "Protocol", NULL); + for (i = 0; protocols[i].name; i++) { + if (xf86NameCmp(s, protocols[i].name) == 0) { + prot = protocols[i].id; + break; + } + } + + switch (prot) { + case PROT_STD: + pInfo->read_input = stdReadInput; + break; + default: + xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s); + xfree(s); + return FALSE; + } + + xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s); + xfree(s); + + s = xf86SetStrOption(pInfo->options, "Device", NULL); + if (s == NULL) { + pInfo->fd = xf86Info.consoleFd; + pKbd->isConsole = TRUE; + } else { + pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); + if (pInfo->fd == -1) { + xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s); + xfree(s); + return FALSE; + } + pKbd->isConsole = FALSE; + xfree(s); + } + + if (pKbd->isConsole) + pKbd->vtSwitchSupported = TRUE; + + return TRUE; +} + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + KbdDevPtr pKbd = pInfo->private; + + pKbd->KbdInit = KbdInit; + pKbd->KbdOn = KbdOn; + pKbd->KbdOff = KbdOff; + pKbd->Bell = SoundBell; + pKbd->SetLeds = SetKbdLeds; + pKbd->GetLeds = GetKbdLeds; + pKbd->SetKbdRepeat = SetKbdRepeat; + pKbd->KbdGetMapping = KbdGetMapping; + pKbd->SpecialKey = SpecialKey; + + pKbd->RemapScanCode = NULL; + pKbd->GetSpecialKey = GetSpecialKey; + + pKbd->OpenKeyboard = OpenKeyboard; + pKbd->vtSwitchSupported = FALSE; + + pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1); + if (pKbd->private == NULL) { + xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n"); + return FALSE; + } + +#if defined(__powerpc__) + { + FILE *f; + f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r"); + if (f) { + if (fgetc(f) == '0') + pKbd->CustomKeycodes = TRUE; + fclose(f); + } + } +#endif + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h:1.1 --- /dev/null Thu Feb 27 12:32:32 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h Thu Oct 10 21:40:35 2002 @@ -0,0 +1,5 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h,v 1.1 2002/10/11 01:40:35 dawes Exp $ */ + +extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, + CARD8 *pModMap); + Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.7 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.9 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.7 Fri Jun 1 16:03:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c Mon Feb 17 10:29:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.7 2001/06/01 20:03:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.9 2003/02/17 15:29:22 dawes Exp $ */ #include <stdio.h> #include "X.h" @@ -11,11 +11,11 @@ #ifdef __sparc__ #define PCIADDR_TYPE long long -#define PCIADDR_IGNORE_FMT "%*llx" +#define PCIADDR_IGNORE_FMT "%*x" #define PCIADDR_FMT "%llx" #else #define PCIADDR_TYPE long -#define PCIADDR_IGNORE_FMT "%*lx" +#define PCIADDR_IGNORE_FMT "%*x" #define PCIADDR_FMT "%lx" #endif @@ -25,7 +25,7 @@ FILE *file; char c[0x200]; char *res; - int bus, devfn, dev, fn; + unsigned int bus, devfn, dev, fn; unsigned PCIADDR_TYPE size[7]; unsigned int num; signed PCIADDR_TYPE Size; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.60 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.64 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.60 Thu Nov 1 18:35:33 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c Mon Feb 17 10:29:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.60 2001/11/01 23:35:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.64 2003/02/17 15:29:22 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -42,8 +42,6 @@ #include <asm/mtrr.h> #endif -extern int ioperm(unsigned long from, unsigned long num, int turn_on); - #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) #endif @@ -265,22 +263,14 @@ */ { - unsigned long last, lbase, d_size; + unsigned long lbase, d_size = 1; unsigned long n_size = size; unsigned long n_base = base; - - int i = 0; - last = n_base + n_size - 1; - for (lbase = n_base; !(lbase & 1) && (last & 1); - lbase = lbase >> 1, last = last >> 1, i++) - if (lbase != last) { - while((lbase & 1) == (last & 1)) { - i++; - lbase >>= 1; - last >>= 1; - } - } - d_size = 1 << i; + + for (lbase = n_base, d_size = 1; !(lbase & 1); + lbase = lbase >> 1, d_size <<= 1); + while (d_size > n_size) + d_size = d_size >> 1; #ifdef DEBUG ErrorF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1); #endif @@ -723,7 +713,7 @@ close(fd); - if (ret == (unsigned long)MAP_FAILED || ret != (DENSE_BASE + Base)) { + if (ret == (unsigned long)MAP_FAILED) { FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n", strerror(errno)); } @@ -750,7 +740,7 @@ Base, Size, ret); #endif - return (pointer)(DENSE_BASE + Base); + return (pointer) ret; } static void Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.10 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile Wed Oct 30 07:52:32 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.10 2001/10/04 18:28:22 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.13 2002/10/30 12:52:32 alanh Exp $ #define IHaveModules #include <Server.tmpl> @@ -17,24 +17,14 @@ xf86drmHash.c \ xf86drmRandom.c \ xf86drmSL.c \ - xf86drmI810.c \ - xf86drmMga.c \ - xf86drmR128.c \ - xf86drmRadeon.c \ - xf86drmSiS.c \ - xf86drmI830.c \ + xf86drmCompat.c \ $(MSRC) OBJS = xf86drm.o \ xf86drmHash.o \ xf86drmRandom.o \ xf86drmSL.o \ - xf86drmI810.o \ - xf86drmMga.o \ - xf86drmR128.o \ - xf86drmRadeon.o \ - xf86drmSiS.o \ - xf86drmI830.o \ + xf86drmCompat.o \ $(MOBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ @@ -62,6 +52,8 @@ #define IHaveSubdirs SUBDIRS = kernel + +DependTarget() MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.25 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.31 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.25 Mon Aug 27 13:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c Mon Feb 3 22:01:59 2003 @@ -27,13 +27,14 @@ * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.25 2001/08/27 17:40:59 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.31 2003/02/04 03:01:59 dawes Exp $ * */ #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" +# include "drm.h" # include "xf86_ansic.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree @@ -66,6 +67,7 @@ # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif +# include "drm.h" #endif /* No longer needed with CVS kernel modules on alpha @@ -81,7 +83,6 @@ #endif #include "xf86drm.h" -#include "drm.h" #ifndef DRM_MAJOR #define DRM_MAJOR 226 /* Linux */ @@ -197,7 +198,6 @@ stat_t st; char buf[64]; int fd; - mode_t dirmode = DRM_DEV_DIRMODE; mode_t devmode = DRM_DEV_MODE; int isroot = !geteuid(); #if defined(XFree86Server) @@ -209,27 +209,20 @@ #if defined(XFree86Server) devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; - dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0; - dirmode |= (devmode & S_IRGRP) ? S_IXGRP : 0; - dirmode |= (devmode & S_IROTH) ? S_IXOTH : 0; - dirmode |= devmode; devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID; #endif if (stat(DRM_DIR_NAME, &st)) { if (!isroot) return DRM_ERR_NOT_ROOT; - remove(DRM_DIR_NAME); - mkdir(DRM_DIR_NAME, dirmode); + mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE); + chown(DRM_DIR_NAME, 0, 0); /* root:root */ + chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE); } -#if defined(XFree86Server) - chown(DRM_DIR_NAME, user, group); - chmod(DRM_DIR_NAME, dirmode); -#endif sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); drmMsg("drmOpenDevice: node name is %s\n", buf); - if (stat(buf, &st) || st.st_rdev != dev) { + if (stat(buf, &st)) { if (!isroot) return DRM_ERR_NOT_ROOT; remove(buf); mknod(buf, S_IFCHR | devmode, dev); @@ -243,6 +236,17 @@ drmMsg("drmOpenDevice: open result is %d, (%s)\n", fd, fd < 0 ? strerror(errno) : "OK"); if (fd >= 0) return fd; + + if (st.st_rdev != dev) { + if (!isroot) return DRM_ERR_NOT_ROOT; + remove(buf); + mknod(buf, S_IFCHR | devmode, dev); + } + fd = open(buf, O_RDWR, 0); + drmMsg("drmOpenDevice: open result is %d, (%s)\n", + fd, fd < 0 ? strerror(errno) : "OK"); + if (fd >= 0) return fd; + drmMsg("drmOpenDevice: Open failed\n"); remove(buf); return -errno; @@ -434,7 +438,7 @@ d->desc = drmStrdup(s->desc); } -/* drmVersion obtains the version information via an ioctl. Similar +/* drmGet Version obtains the driver version information via an ioctl. Similar * information is available via /proc/dri. */ drmVersionPtr drmGetVersion(int fd) @@ -483,6 +487,26 @@ return retval; } +/* drmGetLibVersion set version information for the drm user space library. + * this version number is driver indepedent */ + +drmVersionPtr drmGetLibVersion(int fd) +{ + drm_version_t *version = drmMalloc(sizeof(*version)); + + /* Version history: + * revision 1.0.x = original DRM interface with no drmGetLibVersion + * entry point and many drm<Device> extensions + * revision 1.1.x = added drmCommand entry points for device extensions + * added drmGetLibVersion to identify libdrm.a version + */ + version->version_major = 1; + version->version_minor = 1; + version->version_patchlevel = 0; + + return (drmVersionPtr)version; +} + void drmFreeBusid(const char *busid) { drmFree((void *)busid); @@ -1075,6 +1099,18 @@ return 0; } +int drmWaitVBlank(int fd, drmVBlankPtr vbl) +{ + int ret; + + do { + ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); + vbl->request.type &= ~DRM_VBLANK_RELATIVE; + } while (ret && errno == EINTR); + + return ret; +} + int drmError(int err, const char *label) { switch (err) { @@ -1339,6 +1375,61 @@ SET_COUNT; break; } + } + return 0; +} + +int drmCommandNone(int fd, unsigned long drmCommandIndex) +{ + void *data = NULL; /* dummy */ + unsigned long request; + + request = DRM_IO( DRM_COMMAND_BASE + drmCommandIndex); + + if (ioctl(fd, request, data)) { + return -errno; + } + return 0; +} + +int drmCommandRead(int fd, unsigned long drmCommandIndex, + void *data, unsigned long size ) +{ + unsigned long request; + + request = DRM_IOC( DRM_IOC_READ, DRM_IOCTL_BASE, + DRM_COMMAND_BASE + drmCommandIndex, size); + + if (ioctl(fd, request, data)) { + return -errno; + } + return 0; +} + +int drmCommandWrite(int fd, unsigned long drmCommandIndex, + void *data, unsigned long size ) +{ + unsigned long request; + + request = DRM_IOC( DRM_IOC_WRITE, DRM_IOCTL_BASE, + DRM_COMMAND_BASE + drmCommandIndex, size); + + if (ioctl(fd, request, data)) { + return -errno; + } + return 0; +} + +int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, + void *data, unsigned long size ) +{ + unsigned long request; + + request = DRM_IOC( DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE, + DRM_COMMAND_BASE + drmCommandIndex, size); + + if (ioctl(fd, request, data)) { + return -errno; } return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmCompat.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmCompat.c:1.1 --- /dev/null Thu Feb 27 12:32:33 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmCompat.c Wed Oct 30 07:52:33 2002 @@ -0,0 +1,1078 @@ +/* xf86drmCompat.c -- User-level interface to old DRM device drivers + * + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Backwards compatability modules broken out by: + * Jens Owen <jens@tungstengraphics.com> + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmCompat.c,v 1.1 2002/10/30 12:52:33 alanh Exp $ */ + +#ifdef XFree86Server +# include "xf86.h" +# include "xf86_OSproc.h" +# include "xf86_ansic.h" +# define _DRM_MALLOC xalloc +# define _DRM_FREE xfree +# ifndef XFree86LOADER +# include <sys/mman.h> +# endif +#else +# include <stdio.h> +# include <stdlib.h> +# include <unistd.h> +# include <string.h> +# include <ctype.h> +# include <fcntl.h> +# include <errno.h> +# include <signal.h> +# include <sys/types.h> +# include <sys/ioctl.h> +# include <sys/mman.h> +# include <sys/time.h> +# ifdef DRM_USE_MALLOC +# define _DRM_MALLOC malloc +# define _DRM_FREE free +extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); +extern int xf86RemoveSIGIOHandler(int fd); +# else +# include <X11/Xlibint.h> +# define _DRM_MALLOC Xmalloc +# define _DRM_FREE Xfree +# endif +#endif + +/* Not all systems have MAP_FAILED defined */ +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +#ifdef __linux__ +#include <sys/sysmacros.h> /* for makedev() */ +#endif +#include "xf86drm.h" +#include "xf86drmCompat.h" +#include "drm.h" +#include "mga_drm.h" +#include "r128_drm.h" +#include "radeon_drm.h" +#ifndef __FreeBSD__ +#include "sis_drm.h" +#include "i810_drm.h" +#include "i830_drm.h" +#endif + +/* WARNING: Do not change, or add, anything to this file. It is only provided + * for binary backwards compatability with the old driver specific DRM + * extensions used before XFree86 4.3. + */ + +#ifndef __FreeBSD__ +/* I810 */ + +Bool drmI810CleanupDma(int driSubFD) +{ + drm_i810_init_t init; + + memset(&init, 0, sizeof(drm_i810_init_t)); + init.func = I810_CLEANUP_DMA; + + if(ioctl(driSubFD, DRM_IOCTL_I810_INIT, &init)) { + return 0; /* FALSE */ + } + + return 1; /* TRUE */ +} + +Bool drmI810InitDma(int driSubFD, drmCompatI810Init *info) +{ + drm_i810_init_t init; + + memset(&init, 0, sizeof(drm_i810_init_t)); + + init.func = I810_INIT_DMA; + init.mmio_offset = info->mmio_offset; + init.buffers_offset = info->buffers_offset; + init.ring_start = info->start; + init.ring_end = info->end; + init.ring_size = info->size; + init.sarea_priv_offset = info->sarea_off; + init.front_offset = info->front_offset; + init.back_offset = info->back_offset; + init.depth_offset = info->depth_offset; + init.overlay_offset = info->overlay_offset; + init.overlay_physical = info->overlay_physical; + init.w = info->w; + init.h = info->h; + init.pitch = info->pitch; + init.pitch_bits = info->pitch_bits; + + if(ioctl(driSubFD, DRM_IOCTL_I810_INIT, &init)) { + return 0; /* FALSE */ + } + return 1; /* TRUE */ +} +#endif /* __FreeBSD__ */ + +/* Mga */ + +#define MGA_IDLE_RETRY 2048 + +int drmMGAInitDMA( int fd, drmCompatMGAInit *info ) +{ + drm_mga_init_t init; + + memset( &init, 0, sizeof(drm_mga_init_t) ); + + init.func = MGA_INIT_DMA; + + init.sarea_priv_offset = info->sarea_priv_offset; + init.sgram = info->sgram; + init.chipset = info->chipset; + init.maccess = info->maccess; + + init.fb_cpp = info->fb_cpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_cpp = info->depth_cpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + + init.texture_offset[0] = info->texture_offset[0]; + init.texture_size[0] = info->texture_size[0]; + init.texture_offset[1] = info->texture_offset[1]; + init.texture_size[1] = info->texture_size[1]; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.status_offset = info->status_offset; + init.warp_offset = info->warp_offset; + init.primary_offset = info->primary_offset; + init.buffers_offset = info->buffers_offset; + + if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGACleanupDMA( int fd ) +{ + drm_mga_init_t init; + + memset( &init, 0, sizeof(drm_mga_init_t) ); + + init.func = MGA_CLEANUP_DMA; + + if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGAFlushDMA( int fd, drmLockFlags flags ) +{ + drm_lock_t lock; + int ret, i = 0; + + memset( &lock, 0, sizeof(drm_lock_t) ); + + if ( flags & DRM_LOCK_QUIESCENT ) lock.flags |= _DRM_LOCK_QUIESCENT; + if ( flags & DRM_LOCK_FLUSH ) lock.flags |= _DRM_LOCK_FLUSH; + if ( flags & DRM_LOCK_FLUSH_ALL ) lock.flags |= _DRM_LOCK_FLUSH_ALL; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) + return 0; + if ( errno != EBUSY ) + return -errno; + + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { + /* Only keep trying if we need quiescence. + */ + lock.flags &= ~(_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL); + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + } + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAEngineReset( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_MGA_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGAFullScreen( int fd, int enable ) +{ + return -EINVAL; +} + +int drmMGASwapBuffers( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_SWAP, NULL ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) +{ + drm_mga_clear_t clear; + int ret, i = 0; + + clear.flags = flags; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_CLEAR, &clear ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard ) +{ + drm_mga_vertex_t vertex; + + vertex.idx = index; + vertex.used = used; + vertex.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_MGA_VERTEX, &vertex ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGAFlushIndices( int fd, int index, int start, int end, int discard ) +{ + drm_mga_indices_t indices; + + indices.idx = index; + indices.start = start; + indices.end = end; + indices.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_MGA_INDICES, &indices ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGATextureLoad( int fd, int index, + unsigned int dstorg, unsigned int length ) +{ + drm_mga_iload_t iload; + int ret, i = 0; + + iload.idx = index; + iload.dstorg = dstorg; + iload.length = length; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_ILOAD, &iload ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAAgpBlit( int fd, unsigned int planemask, + unsigned int src_offset, int src_pitch, + unsigned int dst_offset, int dst_pitch, + int delta_sx, int delta_sy, + int delta_dx, int delta_dy, + int height, int ydir ) +{ + drm_mga_blit_t blit; + int ret, i = 0; + + blit.planemask = planemask; + blit.srcorg = src_offset; + blit.dstorg = dst_offset; + blit.src_pitch = src_pitch; + blit.dst_pitch = dst_pitch; + blit.delta_sx = delta_sx; + blit.delta_sy = delta_sy; + blit.delta_dx = delta_dx; + blit.delta_dx = delta_dx; + blit.height = height; + blit.ydir = ydir; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_BLIT, &blit ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +/* R128 */ + +#define R128_BUFFER_RETRY 32 +#define R128_IDLE_RETRY 32 + +int drmR128InitCCE( int fd, drmCompatR128Init *info ) +{ + drm_r128_init_t init; + + memset( &init, 0, sizeof(drm_r128_init_t) ); + + init.func = R128_INIT_CCE; + init.sarea_priv_offset = info->sarea_priv_offset; + init.is_pci = info->is_pci; + init.cce_mode = info->cce_mode; + init.cce_secure = info->cce_secure; + init.ring_size = info->ring_size; + init.usec_timeout = info->usec_timeout; + + init.fb_bpp = info->fb_bpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_bpp = info->depth_bpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + init.span_offset = info->span_offset; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.ring_offset = info->ring_offset; + init.ring_rptr_offset = info->ring_rptr_offset; + init.buffers_offset = info->buffers_offset; + init.agp_textures_offset = info->agp_textures_offset; + + if ( ioctl( fd, DRM_IOCTL_R128_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128CleanupCCE( int fd ) +{ + drm_r128_init_t init; + + memset( &init, 0, sizeof(drm_r128_init_t) ); + + init.func = R128_CLEANUP_CCE; + + if ( ioctl( fd, DRM_IOCTL_R128_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128StartCCE( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_R128_CCE_START, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128StopCCE( int fd ) +{ + drm_r128_cce_stop_t stop; + int ret, i = 0; + + stop.flush = 1; + stop.idle = 1; + + ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.flush = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); + } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.idle = 0; + + if ( ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128ResetCCE( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_R128_CCE_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128WaitForIdleCCE( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_R128_CCE_IDLE, NULL ); + } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmR128EngineReset( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_R128_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128FullScreen( int fd, int enable ) +{ + drm_r128_fullscreen_t fs; + + if ( enable ) { + fs.func = R128_INIT_FULLSCREEN; + } else { + fs.func = R128_CLEANUP_FULLSCREEN; + } + + if ( ioctl( fd, DRM_IOCTL_R128_FULLSCREEN, &fs ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128SwapBuffers( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_R128_SWAP, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmR128Clear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) +{ + drm_r128_clear_t clear; + + clear.flags = flags; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + + if ( ioctl( fd, DRM_IOCTL_R128_CLEAR, &clear ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128FlushVertexBuffer( int fd, int prim, int index, + int count, int discard ) +{ + drm_r128_vertex_t v; + + v.prim = prim; + v.idx = index; + v.count = count; + v.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_R128_VERTEX, &v ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128FlushIndices( int fd, int prim, int index, + int start, int end, int discard ) +{ + drm_r128_indices_t elts; + + elts.prim = prim; + elts.idx = index; + elts.start = start; + elts.end = end; + elts.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_R128_INDICES, &elts ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128TextureBlit( int fd, int index, + int offset, int pitch, int format, + int x, int y, int width, int height ) +{ + drm_r128_blit_t blit; + + blit.idx = index; + blit.offset = offset; + blit.pitch = pitch; + blit.format = format; + blit.x = x; + blit.y = y; + blit.width = width; + blit.height = height; + + if ( ioctl( fd, DRM_IOCTL_R128_BLIT, &blit ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128WriteDepthSpan( int fd, int n, int x, int y, + const unsigned int depth[], + const unsigned char mask[] ) +{ + drm_r128_depth_t d; + + d.func = R128_WRITE_SPAN; + d.n = n; + d.x = &x; + d.y = &y; + d.buffer = (unsigned int *)depth; + d.mask = (unsigned char *)mask; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128WriteDepthPixels( int fd, int n, + const int x[], const int y[], + const unsigned int depth[], + const unsigned char mask[] ) +{ + drm_r128_depth_t d; + + d.func = R128_WRITE_PIXELS; + d.n = n; + d.x = (int *)x; + d.y = (int *)y; + d.buffer = (unsigned int *)depth; + d.mask = (unsigned char *)mask; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128ReadDepthSpan( int fd, int n, int x, int y ) +{ + drm_r128_depth_t d; + + d.func = R128_READ_SPAN; + d.n = n; + d.x = &x; + d.y = &y; + d.buffer = NULL; + d.mask = NULL; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128ReadDepthPixels( int fd, int n, + const int x[], const int y[] ) +{ + drm_r128_depth_t d; + + d.func = R128_READ_PIXELS; + d.n = n; + d.x = (int *)x; + d.y = (int *)y; + d.buffer = NULL; + d.mask = NULL; + + if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128PolygonStipple( int fd, unsigned int *mask ) +{ + drm_r128_stipple_t stipple; + + stipple.mask = mask; + + if ( ioctl( fd, DRM_IOCTL_R128_STIPPLE, &stipple ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmR128FlushIndirectBuffer( int fd, int index, + int start, int end, int discard ) +{ + drm_r128_indirect_t ind; + + ind.idx = index; + ind.start = start; + ind.end = end; + ind.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_R128_INDIRECT, &ind ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +/* Radeon */ + +#define RADEON_BUFFER_RETRY 32 +#define RADEON_IDLE_RETRY 16 + +int drmRadeonInitCP( int fd, drmCompatRadeonInit *info ) +{ + drm_radeon_init_t init; + + memset( &init, 0, sizeof(drm_radeon_init_t) ); + + init.func = RADEON_INIT_CP; + init.sarea_priv_offset = info->sarea_priv_offset; + init.is_pci = info->is_pci; + init.cp_mode = info->cp_mode; + init.agp_size = info->agp_size; + init.ring_size = info->ring_size; + init.usec_timeout = info->usec_timeout; + + init.fb_bpp = info->fb_bpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_bpp = info->depth_bpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.ring_offset = info->ring_offset; + init.ring_rptr_offset = info->ring_rptr_offset; + init.buffers_offset = info->buffers_offset; + init.agp_textures_offset = info->agp_textures_offset; + + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonCleanupCP( int fd ) +{ + drm_radeon_init_t init; + + memset( &init, 0, sizeof(drm_radeon_init_t) ); + + init.func = RADEON_CLEANUP_CP; + + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonStartCP( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_START, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonStopCP( int fd ) +{ + drm_radeon_cp_stop_t stop; + int ret, i = 0; + + stop.flush = 1; + stop.idle = 1; + + ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.flush = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); + } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.idle = 0; + + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonResetCP( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonWaitForIdleCP( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_CP_IDLE, NULL ); + } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmRadeonEngineReset( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFullScreen( int fd, int enable ) +{ + drm_radeon_fullscreen_t fs; + + if ( enable ) { + fs.func = RADEON_INIT_FULLSCREEN; + } else { + fs.func = RADEON_CLEANUP_FULLSCREEN; + } + + if ( ioctl( fd, DRM_IOCTL_RADEON_FULLSCREEN, &fs ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonSwapBuffers( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_SWAP, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int stencil, + void *b, int nbox ) +{ + drm_radeon_clear_t clear; + drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; + drm_clip_rect_t *boxes = (drm_clip_rect_t *)b; + int i; + + clear.flags = flags; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = stencil; /* misnamed field in ioctl */ + clear.depth_boxes = depth_boxes; + + /* We can remove this when we do real depth clears, instead of + * rendering a rectangle into the depth buffer. This prevents + * floating point calculations being done in the kernel. + */ + for ( i = 0 ; i < nbox ; i++ ) { + depth_boxes[i].f[CLEAR_X1] = (float)boxes[i].x1; + depth_boxes[i].f[CLEAR_Y1] = (float)boxes[i].y1; + depth_boxes[i].f[CLEAR_X2] = (float)boxes[i].x2; + depth_boxes[i].f[CLEAR_Y2] = (float)boxes[i].y2; + depth_boxes[i].f[CLEAR_DEPTH] = (float)clear_depth; + } + + if ( ioctl( fd, DRM_IOCTL_RADEON_CLEAR, &clear ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFlushVertexBuffer( int fd, int prim, int index, + int count, int discard ) +{ + drm_radeon_vertex_t v; + + v.prim = prim; + v.idx = index; + v.count = count; + v.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_RADEON_VERTEX, &v ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFlushIndices( int fd, int prim, int index, + int start, int end, int discard ) +{ + drm_radeon_indices_t elts; + + elts.prim = prim; + elts.idx = index; + elts.start = start; + elts.end = end; + elts.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_RADEON_INDICES, &elts ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, int width, + int height, drmCompatRadeonTexImage *image ) +{ + drm_radeon_texture_t tex; + drm_radeon_tex_image_t tmp; + int ret; + + tex.offset = offset; + tex.pitch = pitch; + tex.format = format; + tex.width = width; + tex.height = height; + tex.image = &tmp; + + /* This gets updated by the kernel when a multipass blit is needed. + */ + memcpy( &tmp, image, sizeof(drm_radeon_tex_image_t) ); + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_TEXTURE, &tex ); + } while ( ret && errno == EAGAIN ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmRadeonPolygonStipple( int fd, unsigned int *mask ) +{ + drm_radeon_stipple_t stipple; + + stipple.mask = mask; + + if ( ioctl( fd, DRM_IOCTL_RADEON_STIPPLE, &stipple ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFlushIndirectBuffer( int fd, int index, + int start, int end, int discard ) +{ + drm_radeon_indirect_t ind; + + ind.idx = index; + ind.start = start; + ind.end = end; + ind.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_RADEON_INDIRECT, &ind ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +#ifndef __FreeBSD__ +/* SiS */ + +Bool drmSiSAgpInit(int driSubFD, int offset, int size) +{ + drm_sis_agp_t agp; + + agp.offset = offset; + agp.size = size; + ioctl(driSubFD, SIS_IOCTL_AGP_INIT, &agp); + + return 1; /* TRUE */ +} + +/* I830 */ + +Bool drmI830CleanupDma(int driSubFD) +{ + drm_i830_init_t init; + + memset(&init, 0, sizeof(drm_i830_init_t)); + init.func = I810_CLEANUP_DMA; + + if(ioctl(driSubFD, DRM_IOCTL_I830_INIT, &init)) { + return 0; /* FALSE */ + } + + return 1; /* TRUE */ +} + +Bool drmI830InitDma(int driSubFD, drmCompatI830Init *info) +{ + drm_i830_init_t init; + + memset(&init, 0, sizeof(drm_i830_init_t)); + + init.func = I810_INIT_DMA; + init.mmio_offset = info->mmio_offset; + init.buffers_offset = info->buffers_offset; + init.ring_start = info->start; + init.ring_end = info->end; + init.ring_size = info->size; + init.sarea_priv_offset = info->sarea_off; + init.front_offset = info->front_offset; + init.back_offset = info->back_offset; + init.depth_offset = info->depth_offset; + init.w = info->w; + init.h = info->h; + init.pitch = info->pitch; + init.pitch_bits = info->pitch_bits; + init.back_pitch = info->pitch; + init.depth_pitch = info->pitch; + init.cpp = info->cpp; + + if(ioctl(driSubFD, DRM_IOCTL_I830_INIT, &init)) { + return 0; /* FALSE */ + } + return 1; /* TRUE */ +} +#endif /* __FreeBSD__ */ + +/* WARNING: Do not change, or add, anything to this file. It is only provided + * for binary backwards compatability with the old driver specific DRM + * extensions used before XFree86 4.3. + */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.7 Thu Sep 27 04:25:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c Thu Feb 27 12:32:33 2003 @@ -1,90 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.7 2001/09/27 08:25:04 alanh Exp $ */ - -#ifdef XFree86Server -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86_ansic.h" -# define _DRM_MALLOC xalloc -# define _DRM_FREE xfree -# ifndef XFree86LOADER -# include <sys/mman.h> -# endif -#else -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/ioctl.h> -# include <sys/mman.h> -# include <sys/time.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <X11/Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#ifdef __linux__ -#include <sys/sysmacros.h> /* for makedev() */ -#endif -#include "xf86drm.h" -#include "xf86drmI810.h" -#include "drm.h" - -Bool drmI810CleanupDma(int driSubFD) -{ - drm_i810_init_t init; - - memset(&init, 0, sizeof(drm_i810_init_t)); - init.func = I810_CLEANUP_DMA; - - if(ioctl(driSubFD, DRM_IOCTL_I810_INIT, &init)) { - return FALSE; - } - - return TRUE; -} - -Bool drmI810InitDma(int driSubFD, drmI810Init *info) -{ - drm_i810_init_t init; - - memset(&init, 0, sizeof(drm_i810_init_t)); - - init.func = I810_INIT_DMA; - init.mmio_offset = info->mmio_offset; - init.buffers_offset = info->buffers_offset; - init.ring_start = info->start; - init.ring_end = info->end; - init.ring_size = info->size; - init.sarea_priv_offset = info->sarea_off; - init.front_offset = info->front_offset; - init.back_offset = info->back_offset; - init.depth_offset = info->depth_offset; - init.overlay_offset = info->overlay_offset; - init.overlay_physical = info->overlay_physical; - init.w = info->w; - init.h = info->h; - init.pitch = info->pitch; - init.pitch_bits = info->pitch_bits; - - if(ioctl(driSubFD, DRM_IOCTL_I810_INIT, &init)) { - return FALSE; - } - return TRUE; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c:1.1 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c Thu Feb 27 12:32:33 2003 @@ -1,95 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c,v 1.1 2001/10/04 18:28:22 alanh Exp $ */ - -#ifdef XFree86Server -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86_ansic.h" -# include "xf86Priv.h" -# define _DRM_MALLOC xalloc -# define _DRM_FREE xfree -# ifndef XFree86LOADER -# include <sys/stat.h> -# include <sys/mman.h> -# endif -#else -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/stat.h> -# include <sys/ioctl.h> -# include <sys/mman.h> -# include <sys/time.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#ifdef __linux__ -#include <sys/sysmacros.h> /* for makedev() */ -#endif - -#include "xf86drm.h" -#include "drm.h" -#include "xf86drmI830.h" - -Bool drmI830CleanupDma(int driSubFD) -{ - drm_i830_init_t init; - - memset(&init, 0, sizeof(drm_i830_init_t)); - init.func = I810_CLEANUP_DMA; - - if(ioctl(driSubFD, DRM_IOCTL_I830_INIT, &init)) { - return FALSE; - } - - return TRUE; -} - -Bool drmI830InitDma(int driSubFD, drmI830Init *info) -{ - drm_i830_init_t init; - - memset(&init, 0, sizeof(drm_i830_init_t)); - - init.func = I810_INIT_DMA; - init.mmio_offset = info->mmio_offset; - init.buffers_offset = info->buffers_offset; - init.ring_start = info->start; - init.ring_end = info->end; - init.ring_size = info->size; - init.sarea_priv_offset = info->sarea_off; - init.front_offset = info->front_offset; - init.back_offset = info->back_offset; - init.depth_offset = info->depth_offset; - init.w = info->w; - init.h = info->h; - init.pitch = info->pitch; - init.pitch_bits = info->pitch_bits; - init.back_pitch = info->pitch; - init.depth_pitch = info->pitch; - init.cpp = info->cpp; - - if(ioctl(driSubFD, DRM_IOCTL_I830_INIT, &init)) { - return FALSE; - } - return TRUE; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.6 Mon Aug 27 13:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c Thu Feb 27 12:32:33 2003 @@ -1,311 +0,0 @@ -/* xf86drmMga.c -- User-level interface to MGA DRM device - * Created: Sun Apr 9 18:13:54 2000 by gareth@valinux.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: - * Gareth Hughes <gareth@valinux.com> - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.6 2001/08/27 17:40:59 dawes Exp $ */ - -#ifdef XFree86Server -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86_ansic.h" -# define _DRM_MALLOC xalloc -# define _DRM_FREE xfree -# ifndef XFree86LOADER -# include <sys/mman.h> -# endif -#else -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/ioctl.h> -# include <sys/mman.h> -# include <sys/time.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <X11/Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#ifdef __linux__ -#include <sys/sysmacros.h> /* for makedev() */ -#endif -#include "xf86drm.h" -#include "xf86drmMga.h" -#include "drm.h" - -#define MGA_IDLE_RETRY 2048 - - -int drmMGAInitDMA( int fd, drmMGAInit *info ) -{ - drm_mga_init_t init; - - memset( &init, 0, sizeof(drm_mga_init_t) ); - - init.func = MGA_INIT_DMA; - - init.sarea_priv_offset = info->sarea_priv_offset; - init.sgram = info->sgram; - init.chipset = info->chipset; - init.maccess = info->maccess; - - init.fb_cpp = info->fb_cpp; - init.front_offset = info->front_offset; - init.front_pitch = info->front_pitch; - init.back_offset = info->back_offset; - init.back_pitch = info->back_pitch; - - init.depth_cpp = info->depth_cpp; - init.depth_offset = info->depth_offset; - init.depth_pitch = info->depth_pitch; - - init.texture_offset[0] = info->texture_offset[0]; - init.texture_size[0] = info->texture_size[0]; - init.texture_offset[1] = info->texture_offset[1]; - init.texture_size[1] = info->texture_size[1]; - - init.fb_offset = info->fb_offset; - init.mmio_offset = info->mmio_offset; - init.status_offset = info->status_offset; - init.warp_offset = info->warp_offset; - init.primary_offset = info->primary_offset; - init.buffers_offset = info->buffers_offset; - - if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { - return -errno; - } else { - return 0; - } -} - -int drmMGACleanupDMA( int fd ) -{ - drm_mga_init_t init; - - memset( &init, 0, sizeof(drm_mga_init_t) ); - - init.func = MGA_CLEANUP_DMA; - - if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { - return -errno; - } else { - return 0; - } -} - -int drmMGAFlushDMA( int fd, drmLockFlags flags ) -{ - drm_lock_t lock; - int ret, i = 0; - - memset( &lock, 0, sizeof(drm_lock_t) ); - - if ( flags & DRM_LOCK_QUIESCENT ) lock.flags |= _DRM_LOCK_QUIESCENT; - if ( flags & DRM_LOCK_FLUSH ) lock.flags |= _DRM_LOCK_FLUSH; - if ( flags & DRM_LOCK_FLUSH_ALL ) lock.flags |= _DRM_LOCK_FLUSH_ALL; - - do { - ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); - } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); - - if ( ret == 0 ) - return 0; - if ( errno != EBUSY ) - return -errno; - - if ( lock.flags & _DRM_LOCK_QUIESCENT ) { - /* Only keep trying if we need quiescence. - */ - lock.flags &= ~(_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL); - - do { - ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); - } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); - } - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmMGAEngineReset( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_MGA_RESET, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmMGAFullScreen( int fd, int enable ) -{ - return -EINVAL; -} - -int drmMGASwapBuffers( int fd ) -{ - int ret, i = 0; - - do { - ret = ioctl( fd, DRM_IOCTL_MGA_SWAP, NULL ); - } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmMGAClear( int fd, unsigned int flags, - unsigned int clear_color, unsigned int clear_depth, - unsigned int color_mask, unsigned int depth_mask ) -{ - drm_mga_clear_t clear; - int ret, i = 0; - - clear.flags = flags; - clear.clear_color = clear_color; - clear.clear_depth = clear_depth; - clear.color_mask = color_mask; - clear.depth_mask = depth_mask; - - do { - ret = ioctl( fd, DRM_IOCTL_MGA_CLEAR, &clear ); - } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard ) -{ - drm_mga_vertex_t vertex; - - vertex.idx = index; - vertex.used = used; - vertex.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_MGA_VERTEX, &vertex ) ) { - return -errno; - } else { - return 0; - } -} - -int drmMGAFlushIndices( int fd, int index, int start, int end, int discard ) -{ - drm_mga_indices_t indices; - - indices.idx = index; - indices.start = start; - indices.end = end; - indices.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_MGA_INDICES, &indices ) ) { - return -errno; - } else { - return 0; - } -} - -int drmMGATextureLoad( int fd, int index, - unsigned int dstorg, unsigned int length ) -{ - drm_mga_iload_t iload; - int ret, i = 0; - - iload.idx = index; - iload.dstorg = dstorg; - iload.length = length; - - do { - ret = ioctl( fd, DRM_IOCTL_MGA_ILOAD, &iload ); - } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmMGAAgpBlit( int fd, unsigned int planemask, - unsigned int src_offset, int src_pitch, - unsigned int dst_offset, int dst_pitch, - int delta_sx, int delta_sy, - int delta_dx, int delta_dy, - int height, int ydir ) -{ - drm_mga_blit_t blit; - int ret, i = 0; - - blit.planemask = planemask; - blit.srcorg = src_offset; - blit.dstorg = dst_offset; - blit.src_pitch = src_pitch; - blit.dst_pitch = dst_pitch; - blit.delta_sx = delta_sx; - blit.delta_sy = delta_sy; - blit.delta_dx = delta_dx; - blit.delta_dx = delta_dx; - blit.height = height; - blit.ydir = ydir; - - do { - ret = ioctl( fd, DRM_IOCTL_MGA_BLIT, &blit ); - } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.11 Mon Aug 27 13:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c Thu Feb 27 12:32:33 2003 @@ -1,422 +0,0 @@ -/* xf86drmR128.c -- User-level interface to Rage 128 DRM device - * Created: Sun Apr 9 18:13:54 2000 by kevin@precisioninsight.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Kevin E. Martin <martin@valinux.com> - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.11 2001/08/27 17:40:59 dawes Exp $ */ - -#ifdef XFree86Server -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86_ansic.h" -# define _DRM_MALLOC xalloc -# define _DRM_FREE xfree -# ifndef XFree86LOADER -# include <sys/mman.h> -# endif -#else -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/ioctl.h> -# include <sys/mman.h> -# include <sys/time.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <X11/Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#ifdef __linux__ -#include <sys/sysmacros.h> /* for makedev() */ -#endif -#include "xf86drm.h" -#include "xf86drmR128.h" -#include "drm.h" - -#define R128_BUFFER_RETRY 32 -#define R128_IDLE_RETRY 32 - - -int drmR128InitCCE( int fd, drmR128Init *info ) -{ - drm_r128_init_t init; - - memset( &init, 0, sizeof(drm_r128_init_t) ); - - init.func = R128_INIT_CCE; - init.sarea_priv_offset = info->sarea_priv_offset; - init.is_pci = info->is_pci; - init.cce_mode = info->cce_mode; - init.cce_secure = info->cce_secure; - init.ring_size = info->ring_size; - init.usec_timeout = info->usec_timeout; - - init.fb_bpp = info->fb_bpp; - init.front_offset = info->front_offset; - init.front_pitch = info->front_pitch; - init.back_offset = info->back_offset; - init.back_pitch = info->back_pitch; - - init.depth_bpp = info->depth_bpp; - init.depth_offset = info->depth_offset; - init.depth_pitch = info->depth_pitch; - init.span_offset = info->span_offset; - - init.fb_offset = info->fb_offset; - init.mmio_offset = info->mmio_offset; - init.ring_offset = info->ring_offset; - init.ring_rptr_offset = info->ring_rptr_offset; - init.buffers_offset = info->buffers_offset; - init.agp_textures_offset = info->agp_textures_offset; - - if ( ioctl( fd, DRM_IOCTL_R128_INIT, &init ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128CleanupCCE( int fd ) -{ - drm_r128_init_t init; - - memset( &init, 0, sizeof(drm_r128_init_t) ); - - init.func = R128_CLEANUP_CCE; - - if ( ioctl( fd, DRM_IOCTL_R128_INIT, &init ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128StartCCE( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_R128_CCE_START, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128StopCCE( int fd ) -{ - drm_r128_cce_stop_t stop; - int ret, i = 0; - - stop.flush = 1; - stop.idle = 1; - - ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); - - if ( ret == 0 ) { - return 0; - } else if ( errno != EBUSY ) { - return -errno; - } - - stop.flush = 0; - - do { - ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); - } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else if ( errno != EBUSY ) { - return -errno; - } - - stop.idle = 0; - - if ( ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128ResetCCE( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_R128_CCE_RESET, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128WaitForIdleCCE( int fd ) -{ - int ret, i = 0; - - do { - ret = ioctl( fd, DRM_IOCTL_R128_CCE_IDLE, NULL ); - } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmR128EngineReset( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_R128_RESET, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128FullScreen( int fd, int enable ) -{ - drm_r128_fullscreen_t fs; - - if ( enable ) { - fs.func = R128_INIT_FULLSCREEN; - } else { - fs.func = R128_CLEANUP_FULLSCREEN; - } - - if ( ioctl( fd, DRM_IOCTL_R128_FULLSCREEN, &fs ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128SwapBuffers( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_R128_SWAP, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmR128Clear( int fd, unsigned int flags, - unsigned int clear_color, unsigned int clear_depth, - unsigned int color_mask, unsigned int depth_mask ) -{ - drm_r128_clear_t clear; - - clear.flags = flags; - clear.clear_color = clear_color; - clear.clear_depth = clear_depth; - clear.color_mask = color_mask; - clear.depth_mask = depth_mask; - - if ( ioctl( fd, DRM_IOCTL_R128_CLEAR, &clear ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128FlushVertexBuffer( int fd, int prim, int index, - int count, int discard ) -{ - drm_r128_vertex_t v; - - v.prim = prim; - v.idx = index; - v.count = count; - v.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_R128_VERTEX, &v ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128FlushIndices( int fd, int prim, int index, - int start, int end, int discard ) -{ - drm_r128_indices_t elts; - - elts.prim = prim; - elts.idx = index; - elts.start = start; - elts.end = end; - elts.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_R128_INDICES, &elts ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128TextureBlit( int fd, int index, - int offset, int pitch, int format, - int x, int y, int width, int height ) -{ - drm_r128_blit_t blit; - - blit.idx = index; - blit.offset = offset; - blit.pitch = pitch; - blit.format = format; - blit.x = x; - blit.y = y; - blit.width = width; - blit.height = height; - - if ( ioctl( fd, DRM_IOCTL_R128_BLIT, &blit ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128WriteDepthSpan( int fd, int n, int x, int y, - const unsigned int depth[], - const unsigned char mask[] ) -{ - drm_r128_depth_t d; - - d.func = R128_WRITE_SPAN; - d.n = n; - d.x = &x; - d.y = &y; - d.buffer = (unsigned int *)depth; - d.mask = (unsigned char *)mask; - - if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128WriteDepthPixels( int fd, int n, - const int x[], const int y[], - const unsigned int depth[], - const unsigned char mask[] ) -{ - drm_r128_depth_t d; - - d.func = R128_WRITE_PIXELS; - d.n = n; - d.x = (int *)x; - d.y = (int *)y; - d.buffer = (unsigned int *)depth; - d.mask = (unsigned char *)mask; - - if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128ReadDepthSpan( int fd, int n, int x, int y ) -{ - drm_r128_depth_t d; - - d.func = R128_READ_SPAN; - d.n = n; - d.x = &x; - d.y = &y; - d.buffer = NULL; - d.mask = NULL; - - if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128ReadDepthPixels( int fd, int n, - const int x[], const int y[] ) -{ - drm_r128_depth_t d; - - d.func = R128_READ_PIXELS; - d.n = n; - d.x = (int *)x; - d.y = (int *)y; - d.buffer = NULL; - d.mask = NULL; - - if ( ioctl( fd, DRM_IOCTL_R128_DEPTH, &d ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128PolygonStipple( int fd, unsigned int *mask ) -{ - drm_r128_stipple_t stipple; - - stipple.mask = mask; - - if ( ioctl( fd, DRM_IOCTL_R128_STIPPLE, &stipple ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmR128FlushIndirectBuffer( int fd, int index, - int start, int end, int discard ) -{ - drm_r128_indirect_t ind; - - ind.idx = index; - ind.start = start; - ind.end = end; - ind.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_R128_INDIRECT, &ind ) < 0 ) { - return -errno; - } else { - return 0; - } -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:1.4 Mon Aug 27 13:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c Thu Feb 27 12:32:33 2003 @@ -1,368 +0,0 @@ -/* xf86drmRadeon.c -- User-level interface to Radeon DRM device - * - * Copyright 2000 VA Linx Systems, Inc., Fremont, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.4 2001/08/27 17:40:59 dawes Exp $ */ - -#ifdef XFree86Server -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86_ansic.h" -# define _DRM_MALLOC xalloc -# define _DRM_FREE xfree -# ifndef XFree86LOADER -# include <sys/mman.h> -# endif -#else -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/ioctl.h> -# include <sys/mman.h> -# include <sys/time.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <X11/Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#ifdef __linux__ -#include <sys/sysmacros.h> /* for makedev() */ -#endif -#include "xf86drm.h" -#include "xf86drmRadeon.h" -#include "drm.h" - -#define RADEON_BUFFER_RETRY 32 -#define RADEON_IDLE_RETRY 16 - - -int drmRadeonInitCP( int fd, drmRadeonInit *info ) -{ - drm_radeon_init_t init; - - memset( &init, 0, sizeof(drm_radeon_init_t) ); - - init.func = RADEON_INIT_CP; - init.sarea_priv_offset = info->sarea_priv_offset; - init.is_pci = info->is_pci; - init.cp_mode = info->cp_mode; - init.agp_size = info->agp_size; - init.ring_size = info->ring_size; - init.usec_timeout = info->usec_timeout; - - init.fb_bpp = info->fb_bpp; - init.front_offset = info->front_offset; - init.front_pitch = info->front_pitch; - init.back_offset = info->back_offset; - init.back_pitch = info->back_pitch; - - init.depth_bpp = info->depth_bpp; - init.depth_offset = info->depth_offset; - init.depth_pitch = info->depth_pitch; - - init.fb_offset = info->fb_offset; - init.mmio_offset = info->mmio_offset; - init.ring_offset = info->ring_offset; - init.ring_rptr_offset = info->ring_rptr_offset; - init.buffers_offset = info->buffers_offset; - init.agp_textures_offset = info->agp_textures_offset; - - if ( ioctl( fd, DRM_IOCTL_RADEON_CP_INIT, &init ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonCleanupCP( int fd ) -{ - drm_radeon_init_t init; - - memset( &init, 0, sizeof(drm_radeon_init_t) ); - - init.func = RADEON_CLEANUP_CP; - - if ( ioctl( fd, DRM_IOCTL_RADEON_CP_INIT, &init ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonStartCP( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_RADEON_CP_START, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonStopCP( int fd ) -{ - drm_radeon_cp_stop_t stop; - int ret, i = 0; - - stop.flush = 1; - stop.idle = 1; - - ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); - - if ( ret == 0 ) { - return 0; - } else if ( errno != EBUSY ) { - return -errno; - } - - stop.flush = 0; - - do { - ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); - } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else if ( errno != EBUSY ) { - return -errno; - } - - stop.idle = 0; - - if ( ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonResetCP( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_RADEON_CP_RESET, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonWaitForIdleCP( int fd ) -{ - int ret, i = 0; - - do { - ret = ioctl( fd, DRM_IOCTL_RADEON_CP_IDLE, NULL ); - } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmRadeonEngineReset( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_RADEON_RESET, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonFullScreen( int fd, int enable ) -{ - drm_radeon_fullscreen_t fs; - - if ( enable ) { - fs.func = RADEON_INIT_FULLSCREEN; - } else { - fs.func = RADEON_CLEANUP_FULLSCREEN; - } - - if ( ioctl( fd, DRM_IOCTL_RADEON_FULLSCREEN, &fs ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonSwapBuffers( int fd ) -{ - if ( ioctl( fd, DRM_IOCTL_RADEON_SWAP, NULL ) ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonClear( int fd, unsigned int flags, - unsigned int clear_color, unsigned int clear_depth, - unsigned int color_mask, unsigned int depth_mask, - void *b, int nbox ) -{ - drm_radeon_clear_t clear; - drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; - drm_clip_rect_t *boxes = (drm_clip_rect_t *)b; - int i; - - clear.flags = flags; - clear.clear_color = clear_color; - clear.clear_depth = clear_depth; - clear.color_mask = color_mask; - clear.depth_mask = depth_mask; - clear.depth_boxes = depth_boxes; - - /* We can remove this when we do real depth clears, instead of - * rendering a rectangle into the depth buffer. This prevents - * floating point calculations being done in the kernel. - */ - for ( i = 0 ; i < nbox ; i++ ) { - depth_boxes[i].f[CLEAR_X1] = (float)boxes[i].x1; - depth_boxes[i].f[CLEAR_Y1] = (float)boxes[i].y1; - depth_boxes[i].f[CLEAR_X2] = (float)boxes[i].x2; - depth_boxes[i].f[CLEAR_Y2] = (float)boxes[i].y2; - depth_boxes[i].f[CLEAR_DEPTH] = (float)clear_depth; - } - - if ( ioctl( fd, DRM_IOCTL_RADEON_CLEAR, &clear ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonFlushVertexBuffer( int fd, int prim, int index, - int count, int discard ) -{ - drm_radeon_vertex_t v; - - v.prim = prim; - v.idx = index; - v.count = count; - v.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_RADEON_VERTEX, &v ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonFlushIndices( int fd, int prim, int index, - int start, int end, int discard ) -{ - drm_radeon_indices_t elts; - - elts.prim = prim; - elts.idx = index; - elts.start = start; - elts.end = end; - elts.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_RADEON_INDICES, &elts ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, - int width, int height, drmRadeonTexImage *image ) -{ - drm_radeon_texture_t tex; - drm_radeon_tex_image_t tmp; - int ret; - - tex.offset = offset; - tex.pitch = pitch; - tex.format = format; - tex.width = width; - tex.height = height; - tex.image = &tmp; - - /* This gets updated by the kernel when a multipass blit is needed. - */ - memcpy( &tmp, image, sizeof(drm_radeon_tex_image_t) ); - - do { - ret = ioctl( fd, DRM_IOCTL_RADEON_TEXTURE, &tex ); - } while ( ret && errno == EAGAIN ); - - if ( ret == 0 ) { - return 0; - } else { - return -errno; - } -} - -int drmRadeonPolygonStipple( int fd, unsigned int *mask ) -{ - drm_radeon_stipple_t stipple; - - stipple.mask = mask; - - if ( ioctl( fd, DRM_IOCTL_RADEON_STIPPLE, &stipple ) < 0 ) { - return -errno; - } else { - return 0; - } -} - -int drmRadeonFlushIndirectBuffer( int fd, int index, - int start, int end, int discard ) -{ - drm_radeon_indirect_t ind; - - ind.idx = index; - ind.start = start; - ind.end = end; - ind.discard = discard; - - if ( ioctl( fd, DRM_IOCTL_RADEON_INDIRECT, &ind ) < 0 ) { - return -errno; - } else { - return 0; - } -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.10 Fri Dec 14 19:59:12 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c Thu Feb 27 12:32:33 2003 @@ -1,60 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.10 2001/12/15 00:59:12 dawes Exp $ */ - -#ifdef XFree86Server -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86_ansic.h" -# define _DRM_MALLOC xalloc -# define _DRM_FREE xfree -# ifndef XFree86LOADER -# include <sys/mman.h> -# endif -#else -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# include <errno.h> -# include <signal.h> -# include <sys/types.h> -# include <sys/ioctl.h> -# include <sys/mman.h> -# include <sys/time.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <X11/Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#ifdef __linux__ -#include <sys/sysmacros.h> /* for makedev() */ -#endif -#include "xf86drm.h" -#include "xf86drmSiS.h" -#define CONFIG_DRM_SIS -#include "drm.h" -#undef CONFIG_DRM_SIS - -Bool drmSiSAgpInit(int driSubFD, int offset, int size) -{ - drm_sis_agp_t agp; - - agp.offset = offset; - agp.size = size; - ioctl(driSubFD, SIS_IOCTL_AGP_INIT, &agp); - - return TRUE; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile:1.4 Wed Apr 18 10:52:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile Mon Dec 16 11:19:27 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile,v 1.4 2001/04/18 14:52:43 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile,v 1.7 2002/12/16 16:19:27 dawes Exp $ #include <Server.tmpl> @@ -17,3 +17,26 @@ clean:: $(MAKE) -f Makefile.linux clean + +LinkSourceFile(drm_sarea.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_dma.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_drm.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_drv.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_irq.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_state.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_ucode.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(mga_warp.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_cce.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_drm.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_drv.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_irq.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(r128_state.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_cp.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_drm.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_drv.h,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_state.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_mem.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(radeon_irq.c,$(XF86OSSRC)/shared/drm/kernel) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.14 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.14 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel Mon Dec 9 20:27:08 2002 @@ -10,7 +10,7 @@ r128-objs := r128_drv.o r128_cce.o r128_state.o mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o i810-objs := i810_drv.o i810_dma.o -i830-objs := i830_drv.o i830_dma.o +i830-objs := i830_drv.o i830_dma.o i830_irq.o radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o ffb-objs := ffb_drv.o ffb_context.o Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.25 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.32 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.25 Wed Jan 16 10:36:43 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux Tue Feb 4 19:23:13 2003 @@ -32,6 +32,8 @@ # make TREE=/usr/my-kernel-tree/include # +SHELL=/bin/sh + .SUFFIXES: # *** Setup @@ -44,7 +46,8 @@ DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \ drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_lists.h \ drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h -DRMHEADERS = drm.h drmP.h +DRMSHARED = drm_sarea.h +DRMHEADERS = drm.h drmP.h $(DRMSHARED) GAMMAOBJS = gamma_drv.o gamma_dma.o GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES) @@ -52,12 +55,16 @@ TDFXOBJS = tdfx_drv.o TDFXHEADERS = tdfx.h $(DRMHEADERS) $(DRMTEMPLATES) -R128OBJS = r128_drv.o r128_cce.o r128_state.o +R128OBJS = r128_drv.o r128_cce.o r128_state.o r128_irq.o R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES) +R128SHARED = r128.h r128_drv.h r128_drm.h r128_cce.c r128_state.c r128_irq.c -RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o +RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ + radeon_irq.o RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \ $(DRMTEMPLATES) +RADEONSHARED = radeon.h radeon_drv.h radeon_drm.h radeon_cp.c radeon_irq.c \ + radeon_mem.c radeon_state.c INC = /usr/include @@ -66,7 +73,7 @@ -Wstrict-prototypes -Wnested-externs \ -Wpointer-arith # -Wshadow -Winline -- make output too noisy -MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer +MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer -fno-strict-aliasing PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ -I../../../../../../include -I../../../../../../../../include \ @@ -81,6 +88,9 @@ # This may not be correct, but it is the best assumption we can make. VERSION := $(shell uname -r) +# For Red Hat... +RHVERS := $(shell uname -r)custom + A := /lib/modules/$(VERSION)/build/include B := /usr/src/linux-$(VERSION)/include C := /usr/src/linux/include @@ -91,26 +101,34 @@ ifeq ($(V),"$(VERSION)") TREE := $A else +ifeq ($(V),"$(RHVERS)") + TREE := $A +else V := $(shell gcc -E -nostdinc -I$B picker.c 2>/dev/null \ | grep -s 'RELEASE = ' | cut -d' ' -f3) ifeq ($(V),"$(VERSION)") - TREE := $B + TREE := $B else - V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \ +ifeq ($(V),"$(RHVERS)") + TREE := $B +else + V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \ | grep -s 'RELEASE = ' | cut -d' ' -f3) ifeq ($(V),"$(VERSION)") - TREE := $C + TREE := $C else - V := $(shell gcc -E -nostdinc -I$D picker.c 2>/dev/null \ + V := $(shell gcc -E -nostdinc -I$D picker.c 2>/dev/null \ | grep -s 'RELEASE = ' | cut -d' ' -f3) ifeq ($(V),"$(VERSION)") - TREE := $D + TREE := $D else - TREE := 0 + TREE := 0 +endif endif endif endif endif +endif ifeq ($(TREE),0) all:; @echo Error: Could not locate kernel tree in $A $B $C $D @@ -124,11 +142,16 @@ AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ | grep -s 'AGP = ' | cut -d' ' -f3) MACHINE := $(shell echo `uname -m`) +# Red Hat's kernels have 4 args to do_munmap() +DOMUNMAP := $(shell grep do_munmap $(TREE)/linux/mm.h | grep -c acct) ifeq ($(AGP),0) AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ | grep -s 'AGP_MODULE = ' | cut -d' ' -f3) endif +ifeq ($(DOMUNMAP),1) +MODCFLAGS += -DDO_MUNMAP_4_ARGS +endif ifeq ($(AGP),1) MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE DRMTEMPLATES += drm_agpsupport.h @@ -142,13 +165,15 @@ MODS += i830.o endif -MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o +MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o MGAHEADERS = mga.h mga_drv.h mga_drm.h $(DRMHEADERS) $(DRMTEMPLATES) +MGASHARED = mga.h mga_dma.c mga_drm.h mga_drv.h mga_state.c \ + mga_ucode.h mga_warp.c I810OBJS = i810_drv.o i810_dma.o I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) -I830OBJS = i830_drv.o i830_dma.o +I830OBJS = i830_drv.o i830_dma.o i830_irq.o I830HEADERS = i830.h i830_drv.h i830_drm.h $(DRMHEADERS) $(DRMTEMPLATES) endif @@ -156,6 +181,10 @@ ifeq ($(MACHINE),alpha) MODCFLAGS+= -ffixed-8 -mno-fp-regs -mcpu=ev56 -Wa,-mev6 endif +ifeq ($(MACHINE),x86_64) +MODCFLAGS+= -mcmodel=kernel +endif + MODS += sis.o @@ -192,6 +221,15 @@ # **** End of configuration +# Link in shared headers if needed + +SHAREDSRC = $(DRMSHARED) $(MGASHARED) $(R128SHARED) $(RADEONSHARED) +SHAREDDIR = ../../../shared/drm/kernel + +$(SHAREDSRC): + @if [ ! -r $@ ]; then (rm -f $@; set -x; ln -s $(SHAREDDIR)/$@ .); fi + + dristat: dristat.c $(CC) $(PRGCFLAGS) $< -o $@ @@ -254,13 +292,17 @@ $(GAMMAOBJS): $(GAMMAHEADERS) $(TDFXOBJS): $(TDFXHEADERS) +$(R128OBJS): $(R128HEADERS) +$(RADEONOBJS): $(RADEONHEADERS) ifeq ($(AGP),1) $(MGAOBJS): $(MGAHEADERS) $(I810OBJS): $(I810HEADERS) $(I830OBJS): $(I830HEADERS) -$(R128OBJS): $(R128HEADERS) -$(RADEONOBJS): $(RADEONHEADERS) endif clean cleandir:: rm -f *.o *.a *~ core + @for i in $(SHAREDSRC); do \ + if [ -L $$i ]; then (set -x; rm -f $$i); fi; \ + done + Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.4 Mon Dec 10 18:28:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h Wed Oct 30 07:52:33 2002 @@ -30,14 +30,20 @@ #define __NO_VERSION__ #include "drmP.h" -#if PAGE_SIZE == 8192 +#if PAGE_SIZE == 65536 +# define ATI_PCIGART_TABLE_ORDER 0 +# define ATI_PCIGART_TABLE_PAGES (1 << 0) +#elif PAGE_SIZE == 16384 +# define ATI_PCIGART_TABLE_ORDER 1 +# define ATI_PCIGART_TABLE_PAGES (1 << 1) +#elif PAGE_SIZE == 8192 # define ATI_PCIGART_TABLE_ORDER 2 # define ATI_PCIGART_TABLE_PAGES (1 << 2) #elif PAGE_SIZE == 4096 # define ATI_PCIGART_TABLE_ORDER 3 # define ATI_PCIGART_TABLE_PAGES (1 << 3) #else -# error - PAGE_SIZE not 8K or 4K +# error - PAGE_SIZE not 64K, 16K, 8K or 4K #endif # define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.24 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.28 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.24 Wed Jan 16 10:36:43 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h Thu Dec 12 17:17:36 2002 @@ -38,10 +38,27 @@ #if defined(__linux__) #include <linux/config.h> #include <asm/ioctl.h> /* For _IO* macros */ -#define DRM_IOCTL_NR(n) _IOC_NR(n) -#elif defined(__FreeBSD__) +#define DRM_IOCTL_NR(n) _IOC_NR(n) +#define DRM_IOC_VOID _IOC_NONE +#define DRM_IOC_READ _IOC_READ +#define DRM_IOC_WRITE _IOC_WRITE +#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE +#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) +#elif defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) && defined(XFree86Server) +/* Prevent name collision when including sys/ioccom.h */ +#undef ioctl #include <sys/ioccom.h> -#define DRM_IOCTL_NR(n) ((n) & 0xff) +#define ioctl(a,b,c) xf86ioctl(a,b,c) +#else +#include <sys/ioccom.h> +#endif /* __FreeBSD__ && xf86ioctl */ +#define DRM_IOCTL_NR(n) ((n) & 0xff) +#define DRM_IOC_VOID IOC_VOID +#define DRM_IOC_READ IOC_OUT +#define DRM_IOC_WRITE IOC_IN +#define DRM_IOC_READWRITE IOC_INOUT +#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) #endif #define XFREE86_VERSION(major,minor,patch,snap) \ @@ -84,6 +101,10 @@ /* Warning: If you change this structure, make sure you change * XF86DRIClipRectRec in the server as well */ +/* KW: Actually it's illegal to change either for + * backwards-compatibility reasons. + */ + typedef struct drm_clip_rect { unsigned short x1; unsigned short y1; @@ -99,14 +120,6 @@ unsigned int age; } drm_tex_region_t; -/* Seperate include files for the i810/mga/r128 specific structures */ -#include "mga_drm.h" -#include "i810_drm.h" -#include "r128_drm.h" -#include "radeon_drm.h" -#include "sis_drm.h" -#include "i830_drm.h" - typedef struct drm_version { int version_major; /* Major version */ int version_minor; /* Minor version */ @@ -332,6 +345,32 @@ int funcnum; } drm_irq_busid_t; +typedef enum { + _DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */ + _DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */ + _DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */ +} drm_vblank_seq_type_t; + +#define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL + +struct drm_wait_vblank_request { + drm_vblank_seq_type_t type; + unsigned int sequence; + unsigned long signal; +}; + +struct drm_wait_vblank_reply { + drm_vblank_seq_type_t type; + unsigned int sequence; + long tval_sec; + long tval_usec; +}; + +typedef union drm_wait_vblank { + struct drm_wait_vblank_request request; + struct drm_wait_vblank_reply reply; +} drm_wait_vblank_t; + typedef struct drm_agp_mode { unsigned long mode; } drm_agp_mode_t; @@ -371,10 +410,9 @@ #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) -#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size) -#define DRM_IOW(nr,size) _IOW(DRM_IOCTL_BASE,nr,size) -#define DRM_IOWR(nr,size) _IOWR(DRM_IOCTL_BASE,nr,size) - +#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) +#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) +#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) #define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) @@ -426,87 +464,11 @@ #define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) + +#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) -/* MGA specific ioctls */ -#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) -#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) -#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) -#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) -#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) -#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) -#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) - -/* i810 specific ioctls */ -#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) -#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) -#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) -#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) -#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) -#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) -#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) -#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) -#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) -#define DRM_IOCTL_I810_OV0INFO DRM_IOR( 0x49, drm_i810_overlay_t) -#define DRM_IOCTL_I810_FSTATUS DRM_IO ( 0x4a) -#define DRM_IOCTL_I810_OV0FLIP DRM_IO ( 0x4b) -#define DRM_IOCTL_I810_MC DRM_IOW( 0x4c, drm_i810_mc_t) -#define DRM_IOCTL_I810_RSTATUS DRM_IO ( 0x4d ) - - -/* Rage 128 specific ioctls */ -#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) -#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) -#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) -#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) -#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) -#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) -#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) -#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) -#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) -#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) -#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) -#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) -#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) - -/* Radeon specific ioctls */ -#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) -#define DRM_IOCTL_RADEON_CP_START DRM_IO( 0x41) -#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( 0x42, drm_radeon_cp_stop_t) -#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( 0x43) -#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_RADEON_RESET DRM_IO( 0x45) -#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t) -#define DRM_IOCTL_RADEON_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) -#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) -#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) -#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) -#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) -#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) - -/* SiS specific ioctls */ -#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) -#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) -#define SIS_IOCTL_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) -#define SIS_IOCTL_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) -#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) -#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) -#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) -#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) - -/* I830 specific ioctls */ -#define DRM_IOCTL_I830_INIT DRM_IOW( 0x40, drm_i830_init_t) -#define DRM_IOCTL_I830_VERTEX DRM_IOW( 0x41, drm_i830_vertex_t) -#define DRM_IOCTL_I830_CLEAR DRM_IOW( 0x42, drm_i830_clear_t) -#define DRM_IOCTL_I830_FLUSH DRM_IO ( 0x43) -#define DRM_IOCTL_I830_GETAGE DRM_IO ( 0x44) -#define DRM_IOCTL_I830_GETBUF DRM_IOWR(0x45, drm_i830_dma_t) -#define DRM_IOCTL_I830_SWAP DRM_IO ( 0x46) -#define DRM_IOCTL_I830_COPY DRM_IOW( 0x47, drm_i830_copy_t) -#define DRM_IOCTL_I830_DOCOPY DRM_IO ( 0x48) +/* Device specfic ioctls should only be in their respective headers + * The device specific ioctl range is 0x40 to 0x79. */ +#define DRM_COMMAND_BASE 0x40 #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.19 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.27 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.19 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h Wed Jan 29 18:00:43 2003 @@ -53,6 +53,7 @@ #include <linux/sched.h> #include <linux/smp_lock.h> /* For (un)lock_kernel */ #include <linux/mm.h> +#include <linux/pagemap.h> #if defined(__alpha__) || defined(__powerpc__) #include <asm/pgtable.h> /* For pte_wrprotect */ #endif @@ -71,10 +72,7 @@ #include <asm/pgalloc.h> #include "drm.h" -/* page_to_bus for earlier kernels, not optimal in all cases */ -#ifndef page_to_bus -#define page_to_bus(page) ((unsigned int)(virt_to_bus(page_address(page)))) -#endif +#include "drm_os_linux.h" /* DRM template customization defaults */ @@ -106,7 +104,7 @@ #define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ defined(CONFIG_AGP_MODULE))) #define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR)) - +#define __REALLY_HAVE_SG (__HAVE_SG) /* Begin the DRM... */ @@ -149,13 +147,70 @@ #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) + /* Backward compatibility section */ +#ifndef minor +#define minor(x) MINOR((x)) +#endif + +#ifndef MODULE_LICENSE +#define MODULE_LICENSE(x) +#endif + +#ifndef preempt_disable +#define preempt_disable() +#define preempt_enable() +#endif + +#ifndef pte_offset_map +#define pte_offset_map pte_offset +#define pte_unmap(pte) +#endif + +#ifndef list_for_each_safe +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) +static inline struct page * vmalloc_to_page(void * vmalloc_addr) +{ + unsigned long addr = (unsigned long) vmalloc_addr; + struct page *page = NULL; + pgd_t *pgd = pgd_offset_k(addr); + pmd_t *pmd; + pte_t *ptep, pte; + + if (!pgd_none(*pgd)) { + pmd = pmd_offset(pgd, addr); + if (!pmd_none(*pmd)) { + preempt_disable(); + ptep = pte_offset_map(pmd, addr); + pte = *ptep; + if (pte_present(pte)) + page = pte_page(pte); + pte_unmap(ptep); + preempt_enable(); + } + } + return page; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define DRM_RPR_ARG(vma) +#else +#define DRM_RPR_ARG(vma) vma, +#endif + + #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) /* Macros to make printk easier */ #define DRM_ERROR(fmt, arg...) \ - printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) + printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __FUNCTION__ , ##arg) #define DRM_MEM_ERROR(area, fmt, arg...) \ - printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ + printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __FUNCTION__, \ DRM(mem_stats)[area].name , ##arg) #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg) @@ -164,8 +219,8 @@ do { \ if ( DRM(flags) & DRM_FLAG_DEBUG ) \ printk(KERN_DEBUG \ - "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ - ##arg); \ + "[" DRM_NAME ":%s] " fmt , \ + __FUNCTION__ , ##arg); \ } while (0) #else #define DRM_DEBUG(fmt, arg...) do { } while (0) @@ -185,6 +240,9 @@ #define DRM_IOREMAP(map) \ (map)->handle = DRM(ioremap)( (map)->offset, (map)->size ) +#define DRM_IOREMAP_NOCACHE(map) \ + (map)->handle = DRM(ioremap_nocache)((map)->offset, (map)->size) + #define DRM_IOREMAPFREE(map) \ do { \ if ( (map)->handle && (map)->size ) \ @@ -436,7 +494,6 @@ typedef struct drm_agp_head { agp_kern_info agp_info; - const char *chipset; drm_agp_mem_t *memory; unsigned long mode; int enabled; @@ -466,6 +523,17 @@ drm_map_t *map; } drm_map_list_t; +#if __HAVE_VBL_IRQ + +typedef struct drm_vbl_sig { + struct list_head head; + unsigned int sequence; + struct siginfo info; + struct task_struct *task; +} drm_vbl_sig_t; + +#endif + typedef struct drm_device { const char *name; /* Simple driver name */ char *unique; /* Unique identifier: e.g., busid */ @@ -525,6 +593,13 @@ int last_context; /* Last current context */ unsigned long last_switch; /* jiffies at last context switch */ struct tq_struct tq; +#if __HAVE_VBL_IRQ + wait_queue_head_t vbl_queue; + atomic_t vbl_received; + spinlock_t vbl_lock; + drm_vbl_sig_t vbl_sigs; + unsigned int vbl_pending; +#endif cycles_t ctx_start; cycles_t lck_start; #if __HAVE_DMA_HISTOGRAM @@ -546,7 +621,7 @@ #endif struct pci_dev *pdev; #ifdef __alpha__ -#if LINUX_VERSION_CODE < 0x020403 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) struct pci_controler *hose; #else struct pci_controller *hose; @@ -627,6 +702,7 @@ extern void DRM(free_pages)(unsigned long address, int order, int area); extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size); extern void DRM(ioremapfree)(void *pt, unsigned long size); #if __REALLY_HAVE_AGP @@ -756,6 +832,15 @@ extern int DRM(irq_uninstall)( drm_device_t *dev ); extern void DRM(dma_service)( int irq, void *device, struct pt_regs *regs ); +extern void DRM(driver_irq_preinstall)( drm_device_t *dev ); +extern void DRM(driver_irq_postinstall)( drm_device_t *dev ); +extern void DRM(driver_irq_uninstall)( drm_device_t *dev ); +#if __HAVE_VBL_IRQ +extern int DRM(wait_vblank)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); +extern void DRM(vbl_send_signals)( drm_device_t *dev ); +#endif #if __HAVE_DMA_IRQ_BH extern void DRM(dma_immediate_bh)( void *dev ); #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.5 Mon Dec 10 18:28:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h Mon Dec 16 11:19:28 2002 @@ -260,60 +260,6 @@ return NULL; } head->memory = NULL; - switch (head->agp_info.chipset) { - case INTEL_GENERIC: head->chipset = "Intel"; break; - case INTEL_LX: head->chipset = "Intel 440LX"; break; - case INTEL_BX: head->chipset = "Intel 440BX"; break; - case INTEL_GX: head->chipset = "Intel 440GX"; break; - case INTEL_I810: head->chipset = "Intel i810"; break; - - case INTEL_I815: head->chipset = "Intel i815"; break; -#if LINUX_VERSION_CODE >= 0x020415 - case INTEL_I820: head->chipset = "Intel i820"; break; -#endif - case INTEL_I840: head->chipset = "Intel i840"; break; -#if LINUX_VERSION_CODE >= 0x020415 - case INTEL_I845: head->chipset = "Intel i845"; break; -#endif - case INTEL_I850: head->chipset = "Intel i850"; break; - - case VIA_GENERIC: head->chipset = "VIA"; break; - case VIA_VP3: head->chipset = "VIA VP3"; break; - case VIA_MVP3: head->chipset = "VIA MVP3"; break; - case VIA_MVP4: head->chipset = "VIA MVP4"; break; - case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133"; - break; - case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133"; - break; - - case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; - break; - case SIS_GENERIC: head->chipset = "SiS"; break; - case AMD_GENERIC: head->chipset = "AMD"; break; - case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; - case ALI_GENERIC: head->chipset = "ALi"; break; - case ALI_M1541: head->chipset = "ALi M1541"; break; - -#if LINUX_VERSION_CODE >= 0x020402 - case ALI_M1621: head->chipset = "ALi M1621"; break; - case ALI_M1631: head->chipset = "ALi M1631"; break; - case ALI_M1632: head->chipset = "ALi M1632"; break; - case ALI_M1641: head->chipset = "ALi M1641"; break; - case ALI_M1647: head->chipset = "ALi M1647"; break; - case ALI_M1651: head->chipset = "ALi M1651"; break; -#endif - -#if LINUX_VERSION_CODE >= 0x020406 - case SVWRKS_HE: head->chipset = "Serverworks HE"; - break; - case SVWRKS_LE: head->chipset = "Serverworks LE"; - break; - case SVWRKS_GENERIC: head->chipset = "Serverworks Generic"; - break; -#endif - - default: head->chipset = "Unknown"; break; - } #if LINUX_VERSION_CODE <= 0x020408 head->cant_use_aperture = 0; head->page_mask = ~(0xfff); @@ -322,10 +268,9 @@ head->page_mask = head->agp_info.page_mask; #endif - DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", + DRM_INFO("AGP %d.%d aperture @ 0x%08lx %ZuMB\n", head->agp_info.version.major, head->agp_info.version.minor, - head->chipset, head->agp_info.aper_base, head->agp_info.aper_size); } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h Fri Feb 22 16:45:17 2002 @@ -64,6 +64,7 @@ hash = DRM(hash_magic)(magic); entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); if (!entry) return -ENOMEM; + memset(entry, 0, sizeof(*entry)); entry->magic = magic; entry->priv = priv; entry->next = NULL; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.4 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h Wed Oct 30 07:52:34 2002 @@ -137,6 +137,7 @@ } map->offset = (unsigned long)map->handle; if ( map->flags & _DRM_CONTAINS_LOCK ) { + dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */ } break; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.4 Wed Dec 19 16:25:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h Wed Oct 30 07:52:34 2002 @@ -555,7 +555,7 @@ /* Allocate a new queue */ down(&dev->struct_sem); - queue = gamma_alloc(sizeof(*queue), DRM_MEM_QUEUES); + queue = DRM(alloc)(sizeof(*queue), DRM_MEM_QUEUES); memset(queue, 0, sizeof(*queue)); atomic_set(&queue->use_count, 1); Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.2 Fri Aug 17 22:51:16 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h Mon Feb 3 22:02:00 2003 @@ -538,8 +538,18 @@ dev->tq.data = dev; #endif +#if __HAVE_VBL_IRQ + init_waitqueue_head(&dev->vbl_queue); + + spin_lock_init( &dev->vbl_lock ); + + INIT_LIST_HEAD( &dev->vbl_sigs.head ); + + dev->vbl_pending = 0; +#endif + /* Before installing handler */ - DRIVER_PREINSTALL(); + DRM(driver_irq_preinstall)(dev); /* Install handler */ ret = request_irq( dev->irq, DRM(dma_service), @@ -552,7 +562,7 @@ } /* After installing handler */ - DRIVER_POSTINSTALL(); + DRM(driver_irq_postinstall)(dev); return 0; } @@ -571,7 +581,7 @@ DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); - DRIVER_UNINSTALL(); + DRM(driver_irq_uninstall)( dev ); free_irq( irq, dev ); @@ -593,6 +603,142 @@ return DRM(irq_install)( dev, ctl.irq ); case DRM_UNINST_HANDLER: return DRM(irq_uninstall)( dev ); + default: + return -EINVAL; + } +} + +#if __HAVE_VBL_IRQ + +int DRM(wait_vblank)( DRM_IOCTL_ARGS ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_wait_vblank_t vblwait; + struct timeval now; + int ret = 0; + unsigned int flags; + + if (!dev->irq) + return -EINVAL; + + DRM_COPY_FROM_USER_IOCTL( vblwait, (drm_wait_vblank_t *)data, + sizeof(vblwait) ); + + switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) { + case _DRM_VBLANK_RELATIVE: + vblwait.request.sequence += atomic_read( &dev->vbl_received ); + vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; + case _DRM_VBLANK_ABSOLUTE: + break; + default: + return -EINVAL; + } + + flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; + + if ( flags & _DRM_VBLANK_SIGNAL ) { + unsigned long irqflags; + drm_vbl_sig_t *vbl_sig; + + vblwait.reply.sequence = atomic_read( &dev->vbl_received ); + + spin_lock_irqsave( &dev->vbl_lock, irqflags ); + + /* Check if this task has already scheduled the same signal + * for the same vblank sequence number; nothing to be done in + * that case + */ + list_for_each( ( (struct list_head *) vbl_sig ), &dev->vbl_sigs.head ) { + if (vbl_sig->sequence == vblwait.request.sequence + && vbl_sig->info.si_signo == vblwait.request.signal + && vbl_sig->task == current) + { + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + goto done; + } + } + + if ( dev->vbl_pending >= 100 ) { + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + return -EBUSY; + } + + dev->vbl_pending++; + + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + + if ( !( vbl_sig = DRM_MALLOC( sizeof( drm_vbl_sig_t ) ) ) ) { + return -ENOMEM; + } + + memset( (void *)vbl_sig, 0, sizeof(*vbl_sig) ); + + vbl_sig->sequence = vblwait.request.sequence; + vbl_sig->info.si_signo = vblwait.request.signal; + vbl_sig->task = current; + + spin_lock_irqsave( &dev->vbl_lock, irqflags ); + + list_add_tail( (struct list_head *) vbl_sig, &dev->vbl_sigs.head ); + + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + } else { + ret = DRM(vblank_wait)( dev, &vblwait.request.sequence ); + + do_gettimeofday( &now ); + vblwait.reply.tval_sec = now.tv_sec; + vblwait.reply.tval_usec = now.tv_usec; + } + +done: + DRM_COPY_TO_USER_IOCTL( (drm_wait_vblank_t *)data, vblwait, + sizeof(vblwait) ); + + return ret; +} + +void DRM(vbl_send_signals)( drm_device_t *dev ) +{ + struct list_head *tmp; + drm_vbl_sig_t *vbl_sig; + unsigned int vbl_seq = atomic_read( &dev->vbl_received ); + unsigned long flags; + + spin_lock_irqsave( &dev->vbl_lock, flags ); + + list_for_each_safe( ( (struct list_head *) vbl_sig ), tmp, &dev->vbl_sigs.head ) { + if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) { + vbl_sig->info.si_code = vbl_seq; + send_sig_info( vbl_sig->info.si_signo, &vbl_sig->info, vbl_sig->task ); + + list_del( (struct list_head *) vbl_sig ); + + DRM_FREE( vbl_sig ); + + dev->vbl_pending--; + } + } + + spin_unlock_irqrestore( &dev->vbl_lock, flags ); +} + +#endif /* __HAVE_VBL_IRQ */ + +#else + +int DRM(control)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_control_t ctl; + + if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) ) + return -EFAULT; + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + case DRM_UNINST_HANDLER: + return 0; default: return -EINVAL; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.6 Fri Nov 2 12:41:54 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h Mon Nov 25 09:05:04 2002 @@ -115,19 +115,35 @@ #ifndef DRIVER_FOPS #define DRIVER_FOPS \ static struct file_operations DRM(fops) = { \ - owner: THIS_MODULE, \ - open: DRM(open), \ - flush: DRM(flush), \ - release: DRM(release), \ - ioctl: DRM(ioctl), \ - mmap: DRM(mmap), \ - read: DRM(read), \ - fasync: DRM(fasync), \ - poll: DRM(poll), \ + .owner = THIS_MODULE, \ + .open = DRM(open), \ + .flush = DRM(flush), \ + .release = DRM(release), \ + .ioctl = DRM(ioctl), \ + .mmap = DRM(mmap), \ + .read = DRM(read), \ + .fasync = DRM(fasync), \ + .poll = DRM(poll), \ } #endif +#ifndef MODULE +/* DRM(options) is called by the kernel to parse command-line options + * passed via the boot-loader (e.g., LILO). It calls the insmod option + * routine, drm_parse_drm. + */ +/* Use an additional macro to avoid preprocessor troubles */ +#define DRM_OPTIONS_FUNC DRM(options) +static int __init DRM(options)( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} +__setup( DRIVER_NAME "=", DRM_OPTIONS_FUNC ); +#undef DRM_OPTIONS_FUNC +#endif + /* * The default number of instances (minor numbers) to initialize. */ @@ -187,10 +203,8 @@ /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ -#if __HAVE_DMA_IRQ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, #endif -#endif #if __REALLY_HAVE_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, @@ -208,6 +222,10 @@ [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { DRM(sg_free), 1, 1 }, #endif +#if __HAVE_VBL_IRQ + [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = { DRM(wait_vblank), 0, 0 }, +#endif + DRIVER_IOCTLS }; @@ -220,9 +238,7 @@ MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_PARM( drm_opts, "s" ); -#ifdef MODULE_LICENSE MODULE_LICENSE("GPL and additional rights"); -#endif static int DRM(setup)( drm_device_t *dev ) { @@ -294,7 +310,7 @@ dev->map_count = 0; dev->vmalist = NULL; - dev->lock.hw_lock = NULL; + dev->sigdata.lock = dev->lock.hw_lock = NULL; init_waitqueue_head( &dev->lock.lock_queue ); dev->queue_count = 0; dev->queue_reserved = 0; @@ -479,7 +495,7 @@ DRM(dma_takedown)( dev ); #endif if ( dev->lock.hw_lock ) { - dev->lock.hw_lock = NULL; /* SHM removed */ + dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ dev->lock.pid = 0; wake_up_interruptible( &dev->lock.lock_queue ); } @@ -707,7 +723,7 @@ int i; for (i = 0; i < DRM(numdevs); i++) { - if (MINOR(inode->i_rdev) == DRM(minor)[i]) { + if (minor(inode->i_rdev) == DRM(minor)[i]) { dev = &(DRM(device)[i]); break; } @@ -749,8 +765,8 @@ * Begin inline drm_release */ - DRM_DEBUG( "pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count ); + DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", + current->pid, (long)dev->device, dev->open_count ); if ( dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && @@ -875,8 +891,9 @@ atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); ++priv->ioctl_count; - DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%x, auth=%d\n", - current->pid, cmd, nr, dev->device, priv->authenticated ); + DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", + current->pid, cmd, nr, (long)dev->device, + priv->authenticated ); if ( nr >= DRIVER_IOCTL_COUNT ) { retcode = -EINVAL; @@ -1029,6 +1046,25 @@ atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); +#if __HAVE_KERNEL_CTX_SWITCH + /* We no longer really hold it, but if we are the next + * agent to request it then we should just be able to + * take it immediately and not eat the ioctl. + */ + dev->lock.pid = 0; + { + __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock; + unsigned int old, new, prev, ctx; + + ctx = lock.context; + do { + old = *plock; + new = ctx; + prev = cmpxchg(plock, old, new); + } while (prev != old); + } + wake_up_interruptible(&dev->lock.lock_queue); +#else DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT ); #if __HAVE_DMA_SCHEDULE @@ -1043,6 +1079,7 @@ DRM_ERROR( "\n" ); } } +#endif /* !__HAVE_KERNEL_CTX_SWITCH */ unblock_all_signals(); return 0; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.5 Mon Jan 14 13:11:44 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h Mon Nov 25 09:05:04 2002 @@ -38,7 +38,7 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev) { - kdev_t minor = MINOR(inode->i_rdev); + int minor = minor(inode->i_rdev); drm_file_t *priv; if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ @@ -95,8 +95,8 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); + DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", + current->pid, (long)dev->device, dev->open_count); return 0; } @@ -106,7 +106,7 @@ drm_device_t *dev = priv->dev; int retcode; - DRM_DEBUG("fd = %d, device = 0x%x\n", fd, dev->device); + DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)dev->device); retcode = fasync_helper(fd, filp, on, &dev->buf_async); if (retcode < 0) return retcode; return 0; @@ -125,31 +125,21 @@ int avail; int send; int cur; - DECLARE_WAITQUEUE(wait, current); DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); - add_wait_queue(&dev->buf_readers, &wait); - set_current_state(TASK_INTERRUPTIBLE); while (dev->buf_rp == dev->buf_wp) { DRM_DEBUG(" sleeping\n"); if (filp->f_flags & O_NONBLOCK) { - remove_wait_queue(&dev->buf_readers, &wait); - set_current_state(TASK_RUNNING); return -EAGAIN; } - schedule(); /* wait for dev->buf_readers */ + interruptible_sleep_on(&dev->buf_readers); if (signal_pending(current)) { DRM_DEBUG(" interrupted\n"); - remove_wait_queue(&dev->buf_readers, &wait); - set_current_state(TASK_RUNNING); return -ERESTARTSYS; } DRM_DEBUG(" awake\n"); - set_current_state(TASK_INTERRUPTIBLE); } - remove_wait_queue(&dev->buf_readers, &wait); - set_current_state(TASK_RUNNING); left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; avail = DRM_BSZ - left; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.4 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h Mon Feb 3 20:46:47 2003 @@ -32,6 +32,7 @@ #define __NO_VERSION__ #include "drmP.h" + int DRM(irq_busid)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -40,9 +41,43 @@ if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p))) return -EFAULT; +#ifdef __alpha__ + { + int domain = p.busnum >> 8; + p.busnum &= 0xff; + + /* + * Find the hose the device is on (the domain number is the + * hose index) and offset the bus by the root bus of that + * hose. + */ + for(dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL); + dev; + dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,dev)) { + struct pci_controller *hose = dev->sysdata; + + if (hose->index == domain) { + p.busnum += hose->bus->number; + break; + } + } + } +#endif dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum)); - if (dev) p.irq = dev->irq; - else p.irq = 0; + if (!dev) { + DRM_ERROR("pci_find_slot failed for %d:%d:%d\n", + p.busnum, p.devnum, p.funcnum); + p.irq = 0; + goto out; + } + if (pci_enable_device(dev) != 0) { + DRM_ERROR("pci_enable_device failed for %d:%d:%d\n", + p.busnum, p.devnum, p.funcnum); + p.irq = 0; + goto out; + } + p.irq = dev->irq; + out: DRM_DEBUG("%d:%d:%d => IRQ %d\n", p.busnum, p.devnum, p.funcnum, p.irq); if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p))) @@ -100,7 +135,7 @@ do { struct pci_dev *pci_dev; - int b, d, f; + int domain, b, d, f; char *p; for(p = dev->unique; p && *p && *p != ':'; p++); @@ -112,6 +147,27 @@ f = (int)simple_strtoul(p+1, &p, 10); if (*p) break; + domain = b >> 8; + b &= 0xff; + +#ifdef __alpha__ + /* + * Find the hose the device is on (the domain number is the + * hose index) and offset the bus by the root bus of that + * hose. + */ + for(pci_dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL); + pci_dev; + pci_dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,pci_dev)) { + struct pci_controller *hose = pci_dev->sysdata; + + if (hose->index == domain) { + b += hose->bus->number; + break; + } + } +#endif + pci_dev = pci_find_slot(b, PCI_DEVFN(d,f)); if (pci_dev) { dev->pdev = pci_dev; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.2 Fri Aug 17 22:51:16 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h Fri Feb 22 16:45:17 2002 @@ -42,7 +42,7 @@ DRM_MEM_BUFLISTS); if(!bl->bufs) return -ENOMEM; - + memset(bl->bufs, 0, sizeof(*bl->bufs)); bl->count = count; bl->rp = bl->bufs; bl->wp = bl->bufs; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h Wed Oct 30 07:52:35 2002 @@ -237,7 +237,7 @@ /* Allow signal delivery if lock isn't held */ - if (!_DRM_LOCK_IS_HELD(s->lock->lock) + if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock) || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; /* Otherwise, set flag to force call to Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.3 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h Fri Feb 22 16:45:17 2002 @@ -314,6 +314,29 @@ return pt; } +void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; + } + + if (!(pt = ioremap_nocache(offset, size))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + void DRM(ioremapfree)(void *pt, unsigned long size) { int alloc_count; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_os_linux.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_os_linux.h:1.1 --- /dev/null Thu Feb 27 12:32:36 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_os_linux.h Wed Oct 30 07:52:35 2002 @@ -0,0 +1,90 @@ +#define __NO_VERSION__ + +#include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> + +#define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data +#define DRM_ERR(d) -(d) +#define DRM_CURRENTPID current->pid +#define DRM_UDELAY(d) udelay(d) +#define DRM_READ8(addr) readb(addr) +#define DRM_READ32(addr) readl(addr) +#define DRM_WRITE8(addr, val) writeb(val, addr) +#define DRM_WRITE32(addr, val) writel(val, addr) +#define DRM_READMEMORYBARRIER() mb() +#define DRM_WRITEMEMORYBARRIER() wmb() +#define DRM_DEVICE drm_file_t *priv = filp->private_data; \ + drm_device_t *dev = priv->dev + +#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs +#define DRM_TASKQUEUE_ARGS void *arg + +/* For data going from/to the kernel through the ioctl argument */ +#define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \ + if ( copy_from_user(&arg1, arg2, arg3) ) \ + return -EFAULT +#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \ + if ( copy_to_user(arg1, &arg2, arg3) ) \ + return -EFAULT +/* Other copying of data from/to kernel space */ +#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ + copy_from_user(arg1, arg2, arg3) +#define DRM_COPY_TO_USER(arg1, arg2, arg3) \ + copy_to_user(arg1, arg2, arg3) +/* Macros for copyfrom user, but checking readability only once */ +#define DRM_VERIFYAREA_READ( uaddr, size ) \ + verify_area( VERIFY_READ, uaddr, size ) +#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \ + __copy_from_user(arg1, arg2, arg3) +#define DRM_GET_USER_UNCHECKED(val, uaddr) \ + __get_user(val, uaddr) + + +/* malloc/free without the overhead of DRM(alloc) */ +#define DRM_MALLOC(x) kmalloc(x, GFP_KERNEL) +#define DRM_FREE(x) kfree(x) + +#define DRM_GETSAREA() \ +do { \ + struct list_head *list; \ + list_for_each( list, &dev->maplist->head ) { \ + drm_map_list_t *entry = (drm_map_list_t *)list; \ + if ( entry->map && \ + entry->map->type == _DRM_SHM && \ + (entry->map->flags & _DRM_CONTAINS_LOCK) ) { \ + dev_priv->sarea = entry->map; \ + break; \ + } \ + } \ +} while (0) + +#define DRM_HZ HZ + +#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ +do { \ + DECLARE_WAITQUEUE(entry, current); \ + unsigned long end = jiffies + (timeout); \ + add_wait_queue(&(queue), &entry); \ + \ + for (;;) { \ + current->state = TASK_INTERRUPTIBLE; \ + if (condition) \ + break; \ + if((signed)(end - jiffies) <= 0) { \ + ret = -EBUSY; \ + break; \ + } \ + schedule_timeout((HZ/100 > 1) ? HZ/100 : 1); \ + if (signal_pending(current)) { \ + ret = -EINTR; \ + break; \ + } \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&(queue), &entry); \ +} while (0) + + +#define DRM_WAKEUP( queue ) wake_up_interruptible( queue ) +#define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) + Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.2 Mon Oct 8 08:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h Mon Dec 16 11:19:28 2002 @@ -148,10 +148,10 @@ *eof = 0; if (dev->unique) { - DRM_PROC_PRINT("%s 0x%x %s\n", - dev->name, dev->device, dev->unique); + DRM_PROC_PRINT("%s 0x%lx %s\n", + dev->name, (long)dev->device, dev->unique); } else { - DRM_PROC_PRINT("%s 0x%x\n", dev->name, dev->device); + DRM_PROC_PRINT("%s 0x%lx\n", dev->name, (long)dev->device); } if (len > request + offset) return request; @@ -449,7 +449,8 @@ for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) { pgd = pgd_offset(vma->vm_mm, i); pmd = pmd_offset(pgd, i); - pte = pte_offset(pmd, i); + preempt_disable(); + pte = pte_offset_map(pmd, i); if (pte_present(*pte)) { address = __pa(pte_page(*pte)) + (i & (PAGE_SIZE-1)); @@ -465,6 +466,8 @@ } else { DRM_PROC_PRINT(" 0x%08lx\n", i); } + pte_unmap(pte); + preempt_enable(); } #endif } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.3 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h Wed Oct 30 07:52:35 2002 @@ -66,9 +66,6 @@ drm_scatter_gather_t request; drm_sg_mem_t *entry; unsigned long pages, i, j; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; DRM_DEBUG( "%s\n", __FUNCTION__ ); @@ -97,6 +94,8 @@ return -ENOMEM; } + memset(entry->pagelist, 0, pages * sizeof(*entry->pagelist)); + entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); if ( !entry->busaddr ) { @@ -135,21 +134,10 @@ DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual ); for ( i = entry->handle, j = 0 ; j < pages ; i += PAGE_SIZE, j++ ) { - pgd = pgd_offset_k( i ); - if ( !pgd_present( *pgd ) ) - goto failed; - - pmd = pmd_offset( pgd, i ); - if ( !pmd_present( *pmd ) ) + entry->pagelist[j] = vmalloc_to_page((void *)i); + if (!entry->pagelist[j]) goto failed; - - pte = pte_offset( pmd, i ); - if ( !pte_present( *pte ) ) - goto failed; - - entry->pagelist[j] = pte_page( *pte ); - - SetPageReserved( entry->pagelist[j] ); + SetPageReserved(entry->pagelist[j]); } request.handle = entry->handle; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.3 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h Wed Oct 30 07:52:35 2002 @@ -49,7 +49,7 @@ static int DRM(stub_open)(struct inode *inode, struct file *filp) { - int minor = MINOR(inode->i_rdev); + int minor = minor(inode->i_rdev); int err = -ENODEV; struct file_operations *old_fops; @@ -66,8 +66,8 @@ } static struct file_operations DRM(stub_fops) = { - owner: THIS_MODULE, - open: DRM(stub_open) + .owner = THIS_MODULE, + .open = DRM(stub_open) }; static int DRM(stub_getminor)(const char *name, struct file_operations *fops, Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.6 Mon Dec 10 18:28:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h Wed Oct 30 07:52:35 2002 @@ -33,27 +33,27 @@ #include "drmP.h" struct vm_operations_struct DRM(vm_ops) = { - nopage: DRM(vm_nopage), - open: DRM(vm_open), - close: DRM(vm_close), + .nopage = DRM(vm_nopage), + .open = DRM(vm_open), + .close = DRM(vm_close), }; struct vm_operations_struct DRM(vm_shm_ops) = { - nopage: DRM(vm_shm_nopage), - open: DRM(vm_open), - close: DRM(vm_shm_close), + .nopage = DRM(vm_shm_nopage), + .open = DRM(vm_open), + .close = DRM(vm_shm_close), }; struct vm_operations_struct DRM(vm_dma_ops) = { - nopage: DRM(vm_dma_nopage), - open: DRM(vm_open), - close: DRM(vm_close), + .nopage = DRM(vm_dma_nopage), + .open = DRM(vm_open), + .close = DRM(vm_close), }; struct vm_operations_struct DRM(vm_sg_ops) = { - nopage: DRM(vm_sg_nopage), - open: DRM(vm_open), - close: DRM(vm_close), + .nopage = DRM(vm_sg_nopage), + .open = DRM(vm_open), + .close = DRM(vm_close), }; struct page *DRM(vm_nopage)(struct vm_area_struct *vma, @@ -71,7 +71,7 @@ * Find the right map */ - if(!dev->agp->cant_use_aperture) goto vm_nopage_error; + if(!dev->agp || !dev->agp->cant_use_aperture) goto vm_nopage_error; list_for_each(list, &dev->maplist->head) { r_list = (drm_map_list_t *)list; @@ -130,9 +130,6 @@ drm_map_t *map = (drm_map_t *)vma->vm_private_data; unsigned long offset; unsigned long i; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; struct page *page; if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ @@ -140,20 +137,12 @@ offset = address - vma->vm_start; i = (unsigned long)map->handle + offset; - /* We have to walk page tables here because we need large SAREA's, and - * they need to be virtually contiguous in kernel space. - */ - pgd = pgd_offset_k( i ); - if( !pgd_present( *pgd ) ) return NOPAGE_OOM; - pmd = pmd_offset( pgd, i ); - if( !pmd_present( *pmd ) ) return NOPAGE_OOM; - pte = pte_offset( pmd, i ); - if( !pte_present( *pte ) ) return NOPAGE_OOM; - - page = pte_page(*pte); + page = vmalloc_to_page((void *)i); + if (!page) + return NOPAGE_OOM; get_page(page); - DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page)); + DRM_DEBUG("shm_nopage 0x%lx\n", address); return page; } @@ -255,8 +244,7 @@ get_page(page); - DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr, - page_to_bus(page)); + DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr); return page; } @@ -355,7 +343,7 @@ vma->vm_ops = &DRM(vm_dma_ops); -#if LINUX_VERSION_CODE <= 0x020414 +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ #else vma->vm_flags |= VM_RESERVED; /* Don't swap */ @@ -420,7 +408,7 @@ if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { vma->vm_flags &= VM_MAYWRITE; -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; #else /* Ye gads this is ugly. With more thought @@ -447,7 +435,7 @@ case _DRM_FRAME_BUFFER: case _DRM_REGISTERS: if (VM_OFFSET(vma) >= __pa(high_memory)) { -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) { pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; @@ -462,10 +450,17 @@ vma->vm_flags |= VM_IO; /* not in core dump */ } offset = DRIVER_GET_REG_OFS(); - if (remap_page_range(vma->vm_start, +#ifdef __sparc__ + if (io_remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, + VM_OFFSET(vma) + offset, + vma->vm_end - vma->vm_start, + vma->vm_page_prot, 0)) +#else + if (remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, VM_OFFSET(vma) + offset, vma->vm_end - vma->vm_start, vma->vm_page_prot)) +#endif return -EAGAIN; DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," " offset = 0x%lx\n", @@ -478,7 +473,7 @@ vma->vm_private_data = (void *)map; /* Don't let this area swap. Change when DRM_KERNEL advisory is supported. */ -#if LINUX_VERSION_CODE <= 0x020414 +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ vma->vm_flags |= VM_LOCKED; #else vma->vm_flags |= VM_RESERVED; @@ -487,7 +482,7 @@ case _DRM_SCATTER_GATHER: vma->vm_ops = &DRM(vm_sg_ops); vma->vm_private_data = (void *)map; -#if LINUX_VERSION_CODE <= 0x020414 +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ vma->vm_flags |= VM_LOCKED; #else vma->vm_flags |= VM_RESERVED; @@ -496,7 +491,7 @@ default: return -EINVAL; /* This should never happen. */ } -#if LINUX_VERSION_CODE <= 0x020414 +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ #else vma->vm_flags |= VM_RESERVED; /* Don't swap */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h Wed Oct 30 07:52:35 2002 @@ -38,9 +38,36 @@ */ #define __HAVE_MTRR 1 +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "gamma" +#define DRIVER_DESC "3DLabs gamma" +#define DRIVER_DATE "20010624" + +#define DRIVER_MAJOR 2 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_GAMMA_INIT)] = { gamma_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_GAMMA_COPY)] = { gamma_dma_copy, 1, 1 } + +#define IOCTL_TABLE_NAME DRM(ioctls) +#define IOCTL_FUNC_NAME DRM(ioctl) + +#define __HAVE_COUNTERS 5 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_DMA +#define __HAVE_COUNTER8 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL +#define __HAVE_COUNTER10 _DRM_STAT_MISSED + /* DMA customization: */ #define __HAVE_DMA 1 +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 #define __HAVE_OLD_DMA 1 #define __HAVE_PCI_DMA 1 @@ -61,33 +88,61 @@ #define __HAVE_DMA_QUIESCENT 1 #define DRIVER_DMA_QUIESCENT() do { \ /* FIXME ! */ \ - gamma_dma_quiescent_dual(dev); \ + gamma_dma_quiescent_single(dev); \ return 0; \ } while (0) #define __HAVE_DMA_IRQ 1 #define __HAVE_DMA_IRQ_BH 1 + +#if 1 #define DRIVER_PREINSTALL() do { \ drm_gamma_private_t *dev_priv = \ (drm_gamma_private_t *)dev->dev_private;\ - GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000000 ); \ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000004 ); \ GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 ); \ } while (0) - #define DRIVER_POSTINSTALL() do { \ drm_gamma_private_t *dev_priv = \ (drm_gamma_private_t *)dev->dev_private;\ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 3); \ GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002001 ); \ GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000008 ); \ GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00039090 ); \ } while (0) +#else +#define DRIVER_POSTINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002000 ); \ + GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000004 ); \ +} while (0) +#define DRIVER_PREINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + GAMMA_WRITE( GAMMA_GCOMMANDMODE, GAMMA_QUEUED_DMA_MODE );\ + GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 );\ +} while (0) +#endif + #define DRIVER_UNINSTALL() do { \ drm_gamma_private_t *dev_priv = \ (drm_gamma_private_t *)dev->dev_private;\ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2); \ + while(GAMMA_READ(GAMMA_INFIFOSPACE) < 3); \ GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00000000 ); \ GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 ); \ GAMMA_WRITE( GAMMA_GINTENABLE, 0x00000000 ); \ } while (0) + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_gamma_private_t *)((dev)->dev_private))->buffers #endif /* __GAMMA_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c:1.11 Fri May 18 20:26:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c Mon Nov 25 09:05:04 2002 @@ -32,33 +32,32 @@ #define __NO_VERSION__ #include "gamma.h" #include "drmP.h" +#include "drm.h" +#include "gamma_drm.h" #include "gamma_drv.h" #include <linux/interrupt.h> /* For task queue support */ #include <linux/delay.h> - static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, unsigned long length) { drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - GAMMA_WRITE(GAMMA_DMAADDRESS, virt_to_phys((void *)address)); - while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4) - ; + (drm_gamma_private_t *)dev->dev_private; + mb(); + while ( GAMMA_READ(GAMMA_INFIFOSPACE) < 2); + GAMMA_WRITE(GAMMA_DMAADDRESS, address); + while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4); GAMMA_WRITE(GAMMA_DMACOUNT, length / 4); } void gamma_dma_quiescent_single(drm_device_t *dev) { drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)); - while (GAMMA_READ(GAMMA_DMACOUNT)) - ; - while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) - ; + while (GAMMA_READ(GAMMA_INFIFOSPACE) < 2); GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); @@ -72,56 +71,50 @@ void gamma_dma_quiescent_dual(drm_device_t *dev) { drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)); - while (GAMMA_READ(GAMMA_DMACOUNT)) - ; - while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) - ; + while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3); GAMMA_WRITE(GAMMA_BROADCASTMASK, 3); - GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); - /* Read from first MX */ + /* Read from first MX */ do { - while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) - ; + while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)); } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); - /* Read from second MX */ + /* Read from second MX */ do { - while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000)) - ; + while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000)); } while (GAMMA_READ(GAMMA_OUTPUTFIFO + 0x10000) != GAMMA_SYNC_TAG); } void gamma_dma_ready(drm_device_t *dev) { drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - while (GAMMA_READ(GAMMA_DMACOUNT)) - ; + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)); } static inline int gamma_dma_is_ready(drm_device_t *dev) { drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; - - return !GAMMA_READ(GAMMA_DMACOUNT); + (drm_gamma_private_t *)dev->dev_private; + return(!GAMMA_READ(GAMMA_DMACOUNT)); } void gamma_dma_service(int irq, void *device, struct pt_regs *regs) { - drm_device_t *dev = (drm_device_t *)device; - drm_device_dma_t *dma = dev->dma; + drm_device_t *dev = (drm_device_t *)device; + drm_device_dma_t *dma = dev->dma; drm_gamma_private_t *dev_priv = - (drm_gamma_private_t *)dev->dev_private; + (drm_gamma_private_t *)dev->dev_private; atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */ + + while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3); GAMMA_WRITE(GAMMA_GDELAYTIMER, 0xc350/2); /* 0x05S */ GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS, 8); GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001); @@ -165,7 +158,9 @@ } buf = dma->next_buffer; - address = (unsigned long)buf->address; + /* WE NOW ARE ON LOGICAL PAGES!! - using page table setup in dma_init */ + /* So we pass the buffer index value into the physical page offset */ + address = buf->idx << 12; length = buf->used; DRM_DEBUG("context %d, buffer %d (%ld bytes)\n", @@ -232,6 +227,9 @@ buf->time_dispatched = get_cycles(); #endif + /* WE NOW ARE ON LOGICAL PAGES!!! - overriding address */ + address = buf->idx << 12; + gamma_dma_dispatch(dev, address, length); gamma_free_buffer(dev, dma->this_buffer); dma->this_buffer = buf; @@ -524,11 +522,11 @@ } } if (retcode) { - DRM_ERROR("ctx%d w%d p%d c%d i%d l%d %d/%d\n", + DRM_ERROR("ctx%d w%d p%d c%ld i%d l%d %d/%d\n", d->context, last_buf->waiting, last_buf->pending, - DRM_WAITCOUNT(dev, d->context), + (long)DRM_WAITCOUNT(dev, d->context), last_buf->idx, last_buf->list, last_buf->pid, @@ -581,4 +579,256 @@ return -EFAULT; return retcode; +} + +/* ============================================================= + * DMA initialization, cleanup + */ + +static int gamma_do_init_dma( drm_device_t *dev, drm_gamma_init_t *init ) +{ + drm_gamma_private_t *dev_priv; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + int i; + struct list_head *list; + unsigned long *pgt; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + dev_priv = DRM(alloc)( sizeof(drm_gamma_private_t), + DRM_MEM_DRIVER ); + if ( !dev_priv ) + return -ENOMEM; + + dev->dev_private = (void *)dev_priv; + + memset( dev_priv, 0, sizeof(drm_gamma_private_t) ); + + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->mmio0, init->mmio0 ); + DRM_FIND_MAP( dev_priv->mmio1, init->mmio1 ); + DRM_FIND_MAP( dev_priv->mmio2, init->mmio2 ); + DRM_FIND_MAP( dev_priv->mmio3, init->mmio3 ); + + dev_priv->sarea_priv = (drm_gamma_sarea_t *) + ((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + if (init->pcimode) { + buf = dma->buflist[GLINT_DRI_BUF_COUNT]; + pgt = buf->address; + + for (i = 0; i < GLINT_DRI_BUF_COUNT; i++) { + buf = dma->buflist[i]; + *pgt = virt_to_phys((void*)buf->address) | 0x07; + pgt++; + } + + buf = dma->buflist[GLINT_DRI_BUF_COUNT]; + } else { + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + + DRM_IOREMAP( dev_priv->buffers ); + + buf = dma->buflist[GLINT_DRI_BUF_COUNT]; + pgt = buf->address; + + for (i = 0; i < GLINT_DRI_BUF_COUNT; i++) { + buf = dma->buflist[i]; + *pgt = (unsigned long)buf->address + 0x07; + pgt++; + } + + buf = dma->buflist[GLINT_DRI_BUF_COUNT]; + + while (GAMMA_READ(GAMMA_INFIFOSPACE) < 1); + GAMMA_WRITE( GAMMA_GDMACONTROL, 0xe); + } + while (GAMMA_READ(GAMMA_INFIFOSPACE) < 2); + GAMMA_WRITE( GAMMA_PAGETABLEADDR, virt_to_phys((void*)buf->address) ); + GAMMA_WRITE( GAMMA_PAGETABLELENGTH, 2 ); + + return 0; +} + +int gamma_do_cleanup_dma( drm_device_t *dev ) +{ + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( dev->dev_private ) { + drm_gamma_private_t *dev_priv = dev->dev_private; + + DRM_IOREMAPFREE( dev_priv->buffers ); + + DRM(free)( dev->dev_private, sizeof(drm_gamma_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int gamma_dma_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_gamma_init_t init; + + if ( copy_from_user( &init, (drm_gamma_init_t *)arg, sizeof(init) ) ) + return -EFAULT; + + switch ( init.func ) { + case GAMMA_INIT_DMA: + return gamma_do_init_dma( dev, &init ); + case GAMMA_CLEANUP_DMA: + return gamma_do_cleanup_dma( dev ); + } + + return -EINVAL; +} + +static int gamma_do_copy_dma( drm_device_t *dev, drm_gamma_copy_t *copy ) +{ + drm_device_dma_t *dma = dev->dma; + unsigned int *screenbuf; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + /* We've DRM_RESTRICTED this DMA buffer */ + + screenbuf = dma->buflist[ GLINT_DRI_BUF_COUNT + 1 ]->address; + +#if 0 + *buffer++ = 0x180; /* Tag (FilterMode) */ + *buffer++ = 0x200; /* Allow FBColor through */ + *buffer++ = 0x53B; /* Tag */ + *buffer++ = copy->Pitch; + *buffer++ = 0x53A; /* Tag */ + *buffer++ = copy->SrcAddress; + *buffer++ = 0x539; /* Tag */ + *buffer++ = copy->WidthHeight; /* Initiates transfer */ + *buffer++ = 0x53C; /* Tag - DMAOutputAddress */ + *buffer++ = virt_to_phys((void*)screenbuf); + *buffer++ = 0x53D; /* Tag - DMAOutputCount */ + *buffer++ = copy->Count; /* Reads HostOutFifo BLOCKS until ..*/ + + /* Data now sitting in dma->buflist[ GLINT_DRI_BUF_COUNT + 1 ] */ + /* Now put it back to the screen */ + + *buffer++ = 0x180; /* Tag (FilterMode) */ + *buffer++ = 0x400; /* Allow Sync through */ + *buffer++ = 0x538; /* Tag - DMARectangleReadTarget */ + *buffer++ = 0x155; /* FBSourceData | count */ + *buffer++ = 0x537; /* Tag */ + *buffer++ = copy->Pitch; + *buffer++ = 0x536; /* Tag */ + *buffer++ = copy->DstAddress; + *buffer++ = 0x535; /* Tag */ + *buffer++ = copy->WidthHeight; /* Initiates transfer */ + *buffer++ = 0x530; /* Tag - DMAAddr */ + *buffer++ = virt_to_phys((void*)screenbuf); + *buffer++ = 0x531; + *buffer++ = copy->Count; /* initiates DMA transfer of color data */ +#endif + + /* need to dispatch it now */ + + return 0; +} + +int gamma_dma_copy( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_gamma_copy_t copy; + + if ( copy_from_user( ©, (drm_gamma_copy_t *)arg, sizeof(copy) ) ) + return -EFAULT; + + return gamma_do_copy_dma( dev, © ); +} + +/* ============================================================= + * Per Context SAREA Support + */ + +int gamma_getsareactx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_priv_map_t request; + drm_map_t *map; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + if ((int)request.ctx_id >= dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + + map = dev->context_sareas[request.ctx_id]; + up(&dev->struct_sem); + + request.handle = map->handle; + if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request))) + return -EFAULT; + return 0; +} + +int gamma_setsareactx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_priv_map_t request; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + struct list_head *list; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + r_list = NULL; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + if(r_list->map && + r_list->map->handle == request.handle) break; + } + if (list == &(dev->maplist->head)) { + up(&dev->struct_sem); + return -EINVAL; + } + map = r_list->map; + up(&dev->struct_sem); + + if (!map) return -EINVAL; + + down(&dev->struct_sem); + if ((int)request.ctx_id >= dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + dev->context_sareas[request.ctx_id] = map; + up(&dev->struct_sem); + return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drm.h:1.2 --- /dev/null Thu Feb 27 12:32:36 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drm.h Wed Oct 30 07:52:35 2002 @@ -0,0 +1,89 @@ +#ifndef _GAMMA_DRM_H_ +#define _GAMMA_DRM_H_ + +typedef struct _drm_gamma_tex_region { + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ +} drm_gamma_tex_region_t; + +typedef struct { + unsigned int GDeltaMode; + unsigned int GDepthMode; + unsigned int GGeometryMode; + unsigned int GTransformMode; +} drm_gamma_context_regs_t; + +typedef struct _drm_gamma_sarea { + drm_gamma_context_regs_t context_state; + + unsigned int dirty; + + + /* Maintain an LRU of contiguous regions of texture space. If + * you think you own a region of texture memory, and it has an + * age different to the one you set, then you are mistaken and + * it has been stolen by another client. If global texAge + * hasn't changed, there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained + * texture information of other clients - by maintaining them + * in the same lru which is used to age their own textures, + * clients have an approximate lru for the whole of global + * texture space, and can make informed decisions as to which + * areas to kick out. There is no need to choose whether to + * kick out your own texture or someone else's - simply eject + * them all in LRU order. + */ + +#define GAMMA_NR_TEX_REGIONS 64 + drm_gamma_tex_region_t texList[GAMMA_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; +} drm_gamma_sarea_t; + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmGamma.h) + */ + +/* Gamma specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_IOCTL_GAMMA_INIT DRM_IOW( 0x40, drm_gamma_init_t) +#define DRM_IOCTL_GAMMA_COPY DRM_IOW( 0x41, drm_gamma_copy_t) + +typedef struct drm_gamma_copy { + unsigned int DMAOutputAddress; + unsigned int DMAOutputCount; + unsigned int DMAReadGLINTSource; + unsigned int DMARectangleWriteAddress; + unsigned int DMARectangleWriteLinePitch; + unsigned int DMARectangleWrite; + unsigned int DMARectangleReadAddress; + unsigned int DMARectangleReadLinePitch; + unsigned int DMARectangleRead; + unsigned int DMARectangleReadTarget; +} drm_gamma_copy_t; + +typedef struct drm_gamma_init { + enum { + GAMMA_INIT_DMA = 0x01, + GAMMA_CLEANUP_DMA = 0x02 + } func; + + int sarea_priv_offset; + int pcimode; + unsigned int mmio0; + unsigned int mmio1; + unsigned int mmio2; + unsigned int mmio3; + unsigned int buffers_offset; +} drm_gamma_init_t; + +#endif /* _GAMMA_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.13 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.13 Fri Aug 17 22:51:16 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c Wed Oct 30 07:52:35 2002 @@ -32,56 +32,17 @@ #include <linux/config.h> #include "gamma.h" #include "drmP.h" +#include "drm.h" +#include "gamma_drm.h" #include "gamma_drv.h" -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "gamma" -#define DRIVER_DESC "3DLabs gamma" -#define DRIVER_DATE "20010216" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } - - -#define __HAVE_COUNTERS 5 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_DMA -#define __HAVE_COUNTER8 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL -#define __HAVE_COUNTER10 _DRM_STAT_MISSED - - #include "drm_auth.h" +#include "drm_agpsupport.h" #include "drm_bufs.h" #include "drm_context.h" #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init gamma_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", gamma_options ); -#endif - #include "drm_fops.h" #include "drm_init.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h:1.8 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h Fri Feb 22 16:45:17 2002 @@ -32,8 +32,9 @@ #ifndef _GAMMA_DRV_H_ #define _GAMMA_DRV_H_ - typedef struct drm_gamma_private { + drm_gamma_sarea_t *sarea_priv; + drm_map_t *sarea; drm_map_t *buffers; drm_map_t *mmio0; drm_map_t *mmio1; @@ -51,6 +52,11 @@ } \ } while (0) + /* gamma_dma.c */ +extern int gamma_dma_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int gamma_dma_copy( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); extern void gamma_dma_ready(drm_device_t *dev); extern void gamma_dma_quiescent_single(drm_device_t *dev); @@ -63,6 +69,7 @@ extern int gamma_find_devices(void); extern int gamma_found(void); +#define GLINT_DRI_BUF_COUNT 256 #define GAMMA_OFF(reg) \ ((reg < 0x1000) \ @@ -78,7 +85,6 @@ ((reg < 0x10000) ? dev_priv->mmio1->handle : \ ((reg < 0x11000) ? dev_priv->mmio2->handle : \ dev_priv->mmio3->handle)))) - #define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) #define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) #define GAMMA_READ(reg) GAMMA_DEREF(reg) @@ -91,9 +97,11 @@ #define GAMMA_FILTERMODE 0x8c00 #define GAMMA_GCOMMANDINTFLAGS 0x0c50 #define GAMMA_GCOMMANDMODE 0x0c40 +#define GAMMA_QUEUED_DMA_MODE 1<<1 #define GAMMA_GCOMMANDSTATUS 0x0c60 #define GAMMA_GDELAYTIMER 0x0c38 #define GAMMA_GDMACONTROL 0x0060 +#define GAMMA_USE_AGP 1<<1 #define GAMMA_GINTENABLE 0x0808 #define GAMMA_GINTFLAGS 0x0810 #define GAMMA_INFIFOSPACE 0x0018 @@ -101,5 +109,12 @@ #define GAMMA_OUTPUTFIFO 0x2000 #define GAMMA_SYNC 0x8c40 #define GAMMA_SYNC_TAG 0x0188 +#define GAMMA_PAGETABLEADDR 0x0C00 +#define GAMMA_PAGETABLELENGTH 0x0C08 + +#define GAMMA_PASSTHROUGH 0x1FE +#define GAMMA_DMAADDRTAG 0x530 +#define GAMMA_DMACOUNTTAG 0x531 +#define GAMMA_COMMANDINTTAG 0x532 #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.2 Fri Aug 17 22:51:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h Wed Oct 30 07:52:35 2002 @@ -41,6 +41,47 @@ #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 1 +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i810" +#define DRIVER_DESC "Intel i810" +#define DRIVER_DATE "20020211" + +/* Interface history + * + * 1.1 - XFree86 4.1 + * 1.2 - XvMC interfaces + * - XFree86 4.2 + * 1.2.1 - Disable copying code (leave stub ioctls for backwards compatibility) + * - Remove requirement for interrupt (leave stubs again) + */ +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 2 +#define DRIVER_PATCHLEVEL 1 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_OV0INFO)] = { i810_ov0_info, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_FSTATUS)] = { i810_fstatus, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_OV0FLIP)] = { i810_ov0_flip, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_MC)] = { i810_dma_mc, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus, 1, 0 } + + +#define __HAVE_COUNTERS 4 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#define __HAVE_COUNTER9 _DRM_STAT_DMA + /* Driver customization: */ #define __HAVE_RELEASE 1 @@ -60,50 +101,10 @@ i810_dma_quiescent( dev ); \ } while (0) -#define __HAVE_DMA_IRQ 1 -#define __HAVE_DMA_IRQ_BH 1 -#define __HAVE_SHARED_IRQ 1 -#define DRIVER_PREINSTALL() do { \ - drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I810_READ16( I810REG_HWSTAM ); \ - tmp = tmp & 0x6000; \ - I810_WRITE16( I810REG_HWSTAM, tmp ); \ - \ - tmp = I810_READ16( I810REG_INT_MASK_R ); \ - tmp = tmp & 0x6000; /* Unmask interrupts */ \ - I810_WRITE16( I810REG_INT_MASK_R, tmp ); \ - tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ -} while (0) - -#define DRIVER_POSTINSTALL() do { \ - drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; \ - tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ - I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ -} while (0) - -#define DRIVER_UNINSTALL() do { \ - drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ - u16 tmp; \ - if ( dev_priv ) { \ - tmp = I810_READ16( I810REG_INT_IDENTITY_R ); \ - tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ - if ( tmp != 0 ) \ - I810_WRITE16( I810REG_INT_IDENTITY_R, tmp ); \ - \ - tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ - } \ -} while (0) +/* Don't need an irq any more. The template code will make sure that + * a noop stub is generated for compatibility. + */ +#define __HAVE_DMA_IRQ 0 /* Buffer customization: */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.15 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.20 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.15 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c Mon Dec 16 22:49:02 2002 @@ -26,19 +26,24 @@ * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> * */ #define __NO_VERSION__ #include "i810.h" #include "drmP.h" +#include "drm.h" +#include "i810_drm.h" #include "i810_drv.h" #include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> +#include <linux/pagemap.h> -/* in case we don't have a 2.3.99-pre6 kernel or later: */ -#ifndef VM_DONTCOPY -#define VM_DONTCOPY 0 +#ifdef DO_MUNMAP_4_ARGS +#define DO_MUNMAP(m, a, l) do_munmap(m, a, l, 1) +#else +#define DO_MUNMAP(m, a, l) do_munmap(m, a, l) #endif #define I810_BUF_FREE 2 @@ -47,33 +52,11 @@ #define I810_BUF_UNMAPPED 0 #define I810_BUF_MAPPED 1 - -#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; -#define BEGIN_LP_RING(n) do { \ - if (I810_VERBOSE) \ - DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ - n, __FUNCTION__); \ - if (dev_priv->ring.space < n*4) \ - i810_wait_ring(dev, n*4); \ - dev_priv->ring.space -= n*4; \ - outring = dev_priv->ring.tail; \ - ringmask = dev_priv->ring.tail_mask; \ - virt = dev_priv->ring.virtual_start; \ -} while (0) - -#define ADVANCE_LP_RING() do { \ - if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ - dev_priv->ring.tail = outring; \ - I810_WRITE(LP_RING + RING_TAIL, outring); \ -} while(0) - -#define OUT_RING(n) do { \ - if (I810_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; \ - outring &= ringmask; \ -} while (0); +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2) +#define down_write down +#define up_write up +#endif static inline void i810_print_status_page(drm_device_t *dev) { @@ -134,14 +117,14 @@ } static struct file_operations i810_buffer_fops = { - open: DRM(open), - flush: DRM(flush), - release: DRM(release), - ioctl: DRM(ioctl), - mmap: i810_mmap_buffers, - read: DRM(read), - fasync: DRM(fasync), - poll: DRM(poll), + .open = DRM(open), + .flush = DRM(flush), + .release = DRM(release), + .ioctl = DRM(ioctl), + .mmap = i810_mmap_buffers, + .read = DRM(read), + .fasync = DRM(fasync), + .poll = DRM(poll), }; int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) @@ -164,7 +147,7 @@ buf_priv->currently_mapped = I810_BUF_MAPPED; unlock_kernel(); - if (remap_page_range(vma->vm_start, + if (remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, VM_OFFSET(vma), vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; @@ -182,36 +165,24 @@ if(buf_priv->currently_mapped == I810_BUF_MAPPED) return -EINVAL; - if(VM_DONTCOPY != 0) { -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - old_fops = filp->f_op; - filp->f_op = &i810_buffer_fops; - dev_priv->mmap_buffer = buf; - buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, - PROT_READ|PROT_WRITE, - MAP_SHARED, - buf->bus_address); - dev_priv->mmap_buffer = NULL; - filp->f_op = old_fops; - if ((unsigned long)buf_priv->virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed int)buf_priv->virtual; - buf_priv->virtual = 0; - } -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } else { - buf_priv->virtual = buf_priv->kernel_virtual; - buf_priv->currently_mapped = I810_BUF_MAPPED; + down_write( ¤t->mm->mmap_sem ); + old_fops = filp->f_op; + filp->f_op = &i810_buffer_fops; + dev_priv->mmap_buffer = buf; + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, + PROT_READ|PROT_WRITE, + MAP_SHARED, + buf->bus_address); + dev_priv->mmap_buffer = NULL; + filp->f_op = old_fops; + if ((unsigned long)buf_priv->virtual > -1024UL) { + /* Real error */ + DRM_ERROR("mmap error\n"); + retcode = (signed int)buf_priv->virtual; + buf_priv->virtual = 0; } + up_write( ¤t->mm->mmap_sem ); + return retcode; } @@ -220,23 +191,15 @@ drm_i810_buf_priv_t *buf_priv = buf->dev_private; int retcode = 0; - if(VM_DONTCOPY != 0) { - if(buf_priv->currently_mapped != I810_BUF_MAPPED) - return -EINVAL; -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - retcode = do_munmap(current->mm, - (unsigned long)buf_priv->virtual, - (size_t) buf->total); -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } + if(buf_priv->currently_mapped != I810_BUF_MAPPED) + return -EINVAL; + + down_write(¤t->mm->mmap_sem); + retcode = DO_MUNMAP(current->mm, + (unsigned long)buf_priv->virtual, + (size_t) buf->total); + up_write(¤t->mm->mmap_sem); + buf_priv->currently_mapped = I810_BUF_UNMAPPED; buf_priv->virtual = 0; @@ -261,7 +224,7 @@ retcode = i810_map_buffer(buf, filp); if(retcode) { i810_freelist_put(dev, buf); - DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); + DRM_ERROR("mapbuf failed, retcode %d\n", retcode); return retcode; } buf->pid = priv->pid; @@ -274,32 +237,6 @@ return retcode; } -static unsigned long i810_alloc_page(drm_device_t *dev) -{ - unsigned long address; - - address = __get_free_page(GFP_KERNEL); - if(address == 0UL) - return 0; - - atomic_inc(&virt_to_page(address)->count); - set_bit(PG_locked, &virt_to_page(address)->flags); - - return address; -} - -static void i810_free_page(drm_device_t *dev, unsigned long page) -{ - if(page == 0UL) - return; - - atomic_dec(&virt_to_page(page)->count); - clear_bit(PG_locked, &virt_to_page(page)->flags); - wake_up(&virt_to_page(page)->wait); - free_page(page); - return; -} - static int i810_dma_cleanup(drm_device_t *dev) { drm_device_dma_t *dma = dev->dma; @@ -314,7 +251,9 @@ dev_priv->ring.Size); } if(dev_priv->hw_status_page != 0UL) { - i810_free_page(dev, dev_priv->hw_status_page); + pci_free_consistent(dev->pdev, PAGE_SIZE, + (void *)dev_priv->hw_status_page, + dev_priv->dma_status_page); /* Need to rewrite hardware status page */ I810_WRITE(0x02080, 0x1ffff000); } @@ -341,8 +280,6 @@ end = jiffies + (HZ*3); while (ring->space < n) { - int i; - ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; ring->space = ring->head - (ring->tail+8); if (ring->space < 0) ring->space += ring->Size; @@ -351,13 +288,12 @@ end = jiffies + (HZ*3); iters++; - if((signed)(end - jiffies) <= 0) { + if(time_before(end, jiffies)) { DRM_ERROR("space: %d wanted %d\n", ring->space, n); DRM_ERROR("lockup\n"); goto out_wait_ring; } - - for (i = 0 ; i < 2000 ; i++) ; + udelay(1); } out_wait_ring: @@ -445,9 +381,6 @@ ((u8 *)dev_priv->sarea_map->handle + init->sarea_priv_offset); - atomic_set(&dev_priv->flush_done, 0); - init_waitqueue_head(&dev_priv->flush_queue); - dev_priv->ring.Start = init->ring_start; dev_priv->ring.End = init->ring_end; dev_priv->ring.Size = init->ring_size; @@ -480,7 +413,9 @@ dev_priv->zi1 = init->depth_offset | init->pitch_bits; /* Program Hardware Status Page */ - dev_priv->hw_status_page = i810_alloc_page(dev); + dev_priv->hw_status_page = + (unsigned long) pci_alloc_consistent(dev->pdev, PAGE_SIZE, + &dev_priv->dma_status_page); if(dev_priv->hw_status_page == 0UL) { dev->dev_private = (void *)dev_priv; i810_dma_cleanup(dev); @@ -490,7 +425,7 @@ memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); - I810_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page)); + I810_WRITE(0x02080, dev_priv->dma_status_page); DRM_DEBUG("Enabled hardware status page\n"); /* Now we need to init our freelist */ @@ -540,16 +475,12 @@ /* Most efficient way to verify state for the i810 is as it is * emitted. Non-conformant state is silently dropped. - * - * Use 'volatile' & local var tmp to force the emitted values to be - * identical to the verified ones. */ static void i810EmitContextVerified( drm_device_t *dev, - volatile unsigned int *code ) + unsigned int *code ) { drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; - unsigned int tmp; RING_LOCALS; BEGIN_LP_RING( I810_CTX_SETUP_SIZE ); @@ -561,14 +492,13 @@ OUT_RING( code[I810_CTXREG_ST1] ); for ( i = 4 ; i < I810_CTX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - - if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) + if ((code[i] & (7<<29)) == (3<<29) && + (code[i] & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); + OUT_RING( code[i] ); j++; } + else printk("constext state dropped!!!\n"); } if (j & 1) @@ -582,7 +512,6 @@ { drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; - unsigned int tmp; RING_LOCALS; BEGIN_LP_RING( I810_TEX_SETUP_SIZE ); @@ -593,14 +522,14 @@ OUT_RING( code[I810_TEXREG_MI3] ); for ( i = 4 ; i < I810_TEX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) + if ((code[i] & (7<<29)) == (3<<29) && + (code[i] & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); + OUT_RING( code[i] ); j++; } + else printk("texture state dropped!!!\n"); } if (j & 1) @@ -625,9 +554,9 @@ if (tmp == dev_priv->front_di1 || tmp == dev_priv->back_di1) { OUT_RING( CMD_OP_DESTBUFFER_INFO ); OUT_RING( tmp ); - } else - DRM_DEBUG("bad di1 %x (allow %x or %x)\n", - tmp, dev_priv->front_di1, dev_priv->back_di1); + } + else + printk("buffer state dropped\n"); /* invarient: */ @@ -712,7 +641,6 @@ continue; if ( flags & I810_FRONT ) { - DRM_DEBUG("clear front\n"); BEGIN_LP_RING( 6 ); OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); @@ -725,7 +653,6 @@ } if ( flags & I810_BACK ) { - DRM_DEBUG("clear back\n"); BEGIN_LP_RING( 6 ); OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); @@ -738,7 +665,6 @@ } if ( flags & I810_DEPTH ) { - DRM_DEBUG("clear depth\n"); BEGIN_LP_RING( 6 ); OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); @@ -764,8 +690,6 @@ int i; RING_LOCALS; - DRM_DEBUG("swapbuffers\n"); - i810_kernel_lost_context(dev); if (nbox > I810_NR_SAREA_CLIPRECTS) @@ -784,10 +708,6 @@ pbox->y2 > dev_priv->h) continue; - DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", - pbox[i].x1, pbox[i].y1, - pbox[i].x2, pbox[i].y2); - BEGIN_LP_RING( 6 ); OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4 ); OUT_RING( pitch | (0xCC << 16)); @@ -812,7 +732,7 @@ int nbox = sarea_priv->nbox; unsigned long address = (unsigned long)buf->bus_address; unsigned long start = address - dev->agp->base; - int i = 0, u; + int i = 0; RING_LOCALS; i810_kernel_lost_context(dev); @@ -820,33 +740,16 @@ if (nbox > I810_NR_SAREA_CLIPRECTS) nbox = I810_NR_SAREA_CLIPRECTS; - if (discard) { - u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, - I810_BUF_HARDWARE); - if(u != I810_BUF_CLIENT) { - DRM_DEBUG("xxxx 2\n"); - } - } - if (used > 4*1024) used = 0; if (sarea_priv->dirty) i810EmitState( dev ); - DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", - address, used, nbox); - - dev_priv->counter++; - DRM_DEBUG( "dispatch counter : %ld\n", dev_priv->counter); - DRM_DEBUG( "i810_dma_dispatch\n"); - DRM_DEBUG( "start : %lx\n", start); - DRM_DEBUG( "used : %d\n", used); - DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); - if (buf_priv->currently_mapped == I810_BUF_MAPPED) { - *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | - sarea_priv->vertex_prim | + unsigned int prim = (sarea_priv->vertex_prim & PR_MASK); + + *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | prim | ((used/4)-2)); if (used & 4) { @@ -879,154 +782,62 @@ } while (++i < nbox); } - BEGIN_LP_RING(10); - OUT_RING( CMD_STORE_DWORD_IDX ); - OUT_RING( 20 ); - OUT_RING( dev_priv->counter ); - OUT_RING( 0 ); - if (discard) { + dev_priv->counter++; + + (void) cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, + I810_BUF_HARDWARE); + + BEGIN_LP_RING(8); + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( 20 ); + OUT_RING( dev_priv->counter ); OUT_RING( CMD_STORE_DWORD_IDX ); OUT_RING( buf_priv->my_use_idx ); OUT_RING( I810_BUF_FREE ); + OUT_RING( CMD_REPORT_HEAD ); OUT_RING( 0 ); + ADVANCE_LP_RING(); } - - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); -} - - -/* Interrupts are only for flushing */ -void i810_dma_service(int irq, void *device, struct pt_regs *regs) -{ - drm_device_t *dev = (drm_device_t *)device; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u16 temp; - - atomic_inc(&dev->counts[_DRM_STAT_IRQ]); - temp = I810_READ16(I810REG_INT_IDENTITY_R); - temp = temp & ~(0x6000); - if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, - temp); /* Clear all interrupts */ - else - return; - - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -void i810_dma_immediate_bh(void *device) -{ - drm_device_t *dev = (drm_device_t *) device; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); } -static inline void i810_dma_emit_flush(drm_device_t *dev) -{ - drm_i810_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - - i810_kernel_lost_context(dev); - - BEGIN_LP_RING(2); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( GFX_OP_USER_INTERRUPT ); - ADVANCE_LP_RING(); - -/* i810_wait_ring( dev, dev_priv->ring.Size - 8 ); */ -/* atomic_set(&dev_priv->flush_done, 1); */ -/* wake_up_interruptible(&dev_priv->flush_queue); */ -} -static inline void i810_dma_quiescent_emit(drm_device_t *dev) +void i810_dma_quiescent(drm_device_t *dev) { drm_i810_private_t *dev_priv = dev->dev_private; RING_LOCALS; +/* printk("%s\n", __FUNCTION__); */ + i810_kernel_lost_context(dev); BEGIN_LP_RING(4); OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); OUT_RING( CMD_REPORT_HEAD ); OUT_RING( 0 ); - OUT_RING( GFX_OP_USER_INTERRUPT ); + OUT_RING( 0 ); ADVANCE_LP_RING(); - -/* i810_wait_ring( dev, dev_priv->ring.Size - 8 ); */ -/* atomic_set(&dev_priv->flush_done, 1); */ -/* wake_up_interruptible(&dev_priv->flush_queue); */ -} - -void i810_dma_quiescent(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - unsigned long end; - - if(dev_priv == NULL) { - return; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i810_dma_quiescent_emit(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - - return; + i810_wait_ring( dev, dev_priv->ring.Size - 8 ); } static int i810_flush_queue(drm_device_t *dev) { - DECLARE_WAITQUEUE(entry, current); - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; - unsigned long end; int i, ret = 0; + RING_LOCALS; + +/* printk("%s\n", __FUNCTION__); */ - if(dev_priv == NULL) { - return 0; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i810_dma_emit_flush(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - break; - } - } + i810_kernel_lost_context(dev); - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); + BEGIN_LP_RING(2); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + i810_wait_ring( dev, dev_priv->ring.Size - 8 ); for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; @@ -1038,7 +849,7 @@ if (used == I810_BUF_HARDWARE) DRM_DEBUG("reclaimed from HARDWARE\n"); if (used == I810_BUF_CLIENT) - DRM_DEBUG("still on client HARDWARE\n"); + DRM_DEBUG("still on client\n"); } return ret; @@ -1078,7 +889,6 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - DRM_DEBUG("i810_flush_ioctl\n"); if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_flush_ioctl called without lock held\n"); return -EINVAL; @@ -1109,9 +919,6 @@ return -EINVAL; } - DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", - vertex.idx, vertex.used, vertex.discard); - if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; i810_dma_dispatch_vertex( dev, @@ -1160,8 +967,6 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - DRM_DEBUG("i810_swap_bufs\n"); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_swap_buf called without lock held\n"); return -EINVAL; @@ -1197,7 +1002,6 @@ drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) dev_priv->sarea_priv; - DRM_DEBUG("getbuf\n"); if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d))) return -EFAULT; @@ -1210,9 +1014,6 @@ retcode = i810_dma_get_buffer(dev, &d, filp); - DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", - current->pid, retcode, d.granted); - if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d))) return -EFAULT; sarea_priv->last_dispatch = (int) hw_status[5]; @@ -1220,47 +1021,19 @@ return retcode; } -int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int i810_copybuf(struct inode *inode, + struct file *filp, + unsigned int cmd, + unsigned long arg) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i810_copy_t d; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; - drm_buf_t *buf; - drm_i810_buf_priv_t *buf_priv; - drm_device_dma_t *dma = dev->dma; - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma called without lock held\n"); - return -EINVAL; - } - - if (copy_from_user(&d, (drm_i810_copy_t *)arg, sizeof(d))) - return -EFAULT; - - if(d.idx < 0 || d.idx > dma->buf_count) return -EINVAL; - buf = dma->buflist[ d.idx ]; - buf_priv = buf->dev_private; - if (buf_priv->currently_mapped != I810_BUF_MAPPED) return -EPERM; - - if(d.used < 0 || d.used > buf->total) return -EINVAL; - - if (copy_from_user(buf_priv->virtual, d.address, d.used)) - return -EFAULT; - - sarea_priv->last_dispatch = (int) hw_status[5]; - + /* Never copy - 2.4.x doesn't need it */ return 0; } int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - if(VM_DONTCOPY == 0) return 1; + /* Never copy - 2.4.x doesn't need it */ return 0; } @@ -1379,7 +1152,8 @@ data.offset = dev_priv->overlay_offset; data.physical = dev_priv->overlay_physical; - copy_to_user((drm_i810_overlay_t *)arg,&data,sizeof(data)); + if (copy_to_user((drm_i810_overlay_t *)arg,&data,sizeof(data))) + return -EFAULT; return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.5 Thu Sep 27 04:25:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h Wed Oct 30 07:52:36 2002 @@ -88,6 +88,8 @@ #define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ #define I810_TEX_SETUP_SIZE 8 +/* Flags for clear ioctl + */ #define I810_FRONT 0x1 #define I810_BACK 0x2 #define I810_DEPTH 0x4 @@ -166,14 +168,34 @@ } drm_i810_sarea_t; +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmMga.h) + */ + +/* i810 specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) +#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) +#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) +#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) +#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) +#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) +#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) +#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) +#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) +#define DRM_IOCTL_I810_OV0INFO DRM_IOR( 0x49, drm_i810_overlay_t) +#define DRM_IOCTL_I810_FSTATUS DRM_IO ( 0x4a) +#define DRM_IOCTL_I810_OV0FLIP DRM_IO ( 0x4b) +#define DRM_IOCTL_I810_MC DRM_IOW( 0x4c, drm_i810_mc_t) +#define DRM_IOCTL_I810_RSTATUS DRM_IO ( 0x4d ) + typedef struct _drm_i810_clear { int clear_color; int clear_depth; int flags; } drm_i810_clear_t; - - /* These may be placeholders if we have more cliprects than * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to * false, indicating that the buffer will be dispatched again with a @@ -190,6 +212,17 @@ int used; /* nr bytes in use */ void *address; /* Address to copy from */ } drm_i810_copy_t; + +#define PR_TRIANGLES (0x0<<18) +#define PR_TRISTRIP_0 (0x1<<18) +#define PR_TRISTRIP_1 (0x2<<18) +#define PR_TRIFAN (0x3<<18) +#define PR_POLYGON (0x4<<18) +#define PR_LINES (0x5<<18) +#define PR_LINESTRIP (0x6<<18) +#define PR_RECTS (0x7<<18) +#define PR_MASK (0x7<<18) + typedef struct drm_i810_dma { void *virtual; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.12 Thu Sep 27 04:25:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c Wed Oct 30 07:52:36 2002 @@ -33,42 +33,10 @@ #include <linux/config.h> #include "i810.h" #include "drmP.h" +#include "drm.h" +#include "i810_drm.h" #include "i810_drv.h" -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "i810" -#define DRIVER_DESC "Intel i810" -#define DRIVER_DATE "20010920" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_OV0INFO)] = { i810_ov0_info, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_FSTATUS)] = { i810_fstatus, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_OV0FLIP)] = { i810_ov0_flip, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_MC)] = { i810_dma_mc, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus, 1, 0 } - - -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" @@ -76,25 +44,6 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init i810_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", i810_options ); -#endif #include "drm_fops.h" #include "drm_init.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.8 Thu Sep 27 04:25:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h Mon Dec 16 22:49:02 2002 @@ -64,8 +64,8 @@ unsigned long hw_status_page; unsigned long counter; - atomic_t flush_done; - wait_queue_head_t flush_queue; /* Processes waiting until flush */ + dma_addr_t dma_status_page; + drm_buf_t *mmap_buffer; @@ -77,6 +77,7 @@ int overlay_physical; int w, h; int pitch; + } drm_i810_private_t; /* i810_dma.c */ @@ -91,8 +92,13 @@ extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); + +/* Obsolete: + */ extern int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +/* Obsolete: + */ extern int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); @@ -110,9 +116,6 @@ extern void i810_dma_quiescent(drm_device_t *dev); -#define I810_VERBOSE 0 - - int i810_dma_vertex(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); @@ -133,6 +136,33 @@ #define I810_READ16(reg) I810_DEREF16(reg) #define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) +#define I810_VERBOSE 0 +#define RING_LOCALS unsigned int outring, ringmask; \ + volatile char *virt; + +#define BEGIN_LP_RING(n) do { \ + if (I810_VERBOSE) \ + DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", n, __FUNCTION__); \ + if (dev_priv->ring.space < n*4) \ + i810_wait_ring(dev, n*4); \ + dev_priv->ring.space -= n*4; \ + outring = dev_priv->ring.tail; \ + ringmask = dev_priv->ring.tail_mask; \ + virt = dev_priv->ring.virtual_start; \ +} while (0) + +#define ADVANCE_LP_RING() do { \ + if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ + dev_priv->ring.tail = outring; \ + I810_WRITE(LP_RING + RING_TAIL, outring); \ +} while(0) + +#define OUT_RING(n) do { \ + if (I810_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; \ + outring &= ringmask; \ +} while (0) #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) @@ -195,6 +225,7 @@ #define CMD_OP_Z_BUFFER_INFO ((0x0<<29)|(0x16<<23)) #define CMD_OP_DESTBUFFER_INFO ((0x0<<29)|(0x15<<23)) +#define CMD_OP_FRONTBUFFER_INFO ((0x0<<29)|(0x14<<23)) #define BR00_BITBLT_CLIENT 0x40000000 #define BR00_OP_COLOR_BLT 0x10000000 Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h:1.1 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h Mon Dec 9 20:27:08 2002 @@ -41,6 +41,48 @@ #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 1 +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i830" +#define DRIVER_DESC "Intel 830M" +#define DRIVER_DATE "20021108" + +/* Interface history: + * + * 1.1: Original. + * 1.2: ? + * 1.3: New irq emit/wait ioctls. + * New pageflip ioctl. + * New getparam ioctl. + * State for texunits 3&4 in sarea. + * New (alternative) layout for texture state. + */ +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 3 +#define DRIVER_PATCHLEVEL 2 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_INIT)] = { i830_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_VERTEX)] = { i830_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_CLEAR)] = { i830_clear_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_FLUSH)] = { i830_flush_ioctl, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETAGE)] = { i830_getage, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETBUF)] = { i830_getbuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_SWAP)] = { i830_swap_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_COPY)] = { i830_copybuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_DOCOPY)] = { i830_docopy, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_FLIP)] = { i830_flip_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_IRQ_EMIT)] = { i830_irq_emit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_IRQ_WAIT)] = { i830_irq_wait, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETPARAM)] = { i830_getparam, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_SETPARAM)] = { i830_setparam, 1, 0 } + +#define __HAVE_COUNTERS 4 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#define __HAVE_COUNTER9 _DRM_STAT_DMA + /* Driver customization: */ #define __HAVE_RELEASE 1 @@ -60,50 +102,49 @@ i830_dma_quiescent( dev ); \ } while (0) + +/* Driver will work either way: IRQ's save cpu time when waiting for + * the card, but are subject to subtle interactions between bios, + * hardware and the driver. + */ +#define USE_IRQS 0 + + +#if USE_IRQS #define __HAVE_DMA_IRQ 1 -#define __HAVE_DMA_IRQ_BH 1 -#define __HAVE_SHARED_IRQ 1 -#define DRIVER_PREINSTALL() do { \ - drm_i830_private_t *dev_priv = \ - (drm_i830_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I830_READ16( I830REG_HWSTAM ); \ - tmp = tmp & 0x6000; \ - I830_WRITE16( I830REG_HWSTAM, tmp ); \ - \ - tmp = I830_READ16( I830REG_INT_MASK_R ); \ - tmp = tmp & 0x6000; /* Unmask interrupts */ \ - I830_WRITE16( I830REG_INT_MASK_R, tmp ); \ - tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ -} while (0) +#define __HAVE_SHARED_IRQ 1 -#define DRIVER_POSTINSTALL() do { \ - drm_i830_private_t *dev_priv = \ +#define DRIVER_PREINSTALL() do { \ + drm_i830_private_t *dev_priv = \ (drm_i830_private_t *)dev->dev_private; \ - u16 tmp; \ - tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; \ - tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ - I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ + \ + I830_WRITE16( I830REG_HWSTAM, 0xffff ); \ + I830_WRITE16( I830REG_INT_MASK_R, 0x0 ); \ + I830_WRITE16( I830REG_INT_ENABLE_R, 0x0 ); \ } while (0) + -#define DRIVER_UNINSTALL() do { \ - drm_i830_private_t *dev_priv = \ - (drm_i830_private_t *)dev->dev_private; \ - u16 tmp; \ - if ( dev_priv ) { \ - tmp = I830_READ16( I830REG_INT_IDENTITY_R ); \ - tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ - if ( tmp != 0 ) \ - I830_WRITE16( I830REG_INT_IDENTITY_R, tmp ); \ - \ - tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ - tmp = tmp & 0x6000; /* Disable all interrupts */ \ - I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ - } \ +#define DRIVER_POSTINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + I830_WRITE16( I830REG_INT_ENABLE_R, 0x2 ); \ + atomic_set(&dev_priv->irq_received, 0); \ + atomic_set(&dev_priv->irq_emitted, 0); \ + init_waitqueue_head(&dev_priv->irq_queue); \ } while (0) + + +/* This gets called too late to be useful: dev_priv has already been + * freed. + */ +#define DRIVER_UNINSTALL() do { \ +} while (0) + +#else +#define __HAVE_DMA_IRQ 0 +#endif + + /* Buffer customization: */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c:1.1 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c Mon Dec 9 20:27:08 2002 @@ -26,20 +26,25 @@ * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * Abraham vd Merwe <abraham@2d3d.co.za> + * Keith Whitwell <keith@tungstengraphics.com> + * Abraham vd Merwe <abraham@2d3d.co.za> * */ #define __NO_VERSION__ #include "i830.h" #include "drmP.h" +#include "drm.h" +#include "i830_drm.h" #include "i830_drv.h" #include <linux/interrupt.h> /* For task queue support */ +#include <linux/pagemap.h> /* For FASTCALL on unlock_page() */ +#include <linux/delay.h> -/* in case we don't have a 2.3.99-pre6 kernel or later: */ -#ifndef VM_DONTCOPY -#define VM_DONTCOPY 0 +#ifdef DO_MUNMAP_4_ARGS +#define DO_MUNMAP(m, a, l) do_munmap(m, a, l, 1) +#else +#define DO_MUNMAP(m, a, l) do_munmap(m, a, l) #endif #define I830_BUF_FREE 2 @@ -49,49 +54,18 @@ #define I830_BUF_UNMAPPED 0 #define I830_BUF_MAPPED 1 -#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2) +#define down_write down +#define up_write up +#endif +#ifndef LockPage +#define LockPage(page) set_bit(PG_locked, &(page)->flags) +#endif +#ifndef UnlockPage +#define UnlockPage(page) unlock_page(page) +#endif -#define DO_IDLE_WORKAROUND() \ -do { \ - int _head; \ - int _tail; \ - int _i; \ - do { \ - _head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; \ - _tail = I830_READ(LP_RING + RING_TAIL) & TAIL_ADDR; \ - for(_i = 0; _i < 65535; _i++); \ - } while(_head != _tail); \ -} while(0) - -#define I830_SYNC_WORKAROUND 0 - -#define BEGIN_LP_RING(n) do { \ - if (I830_VERBOSE) \ - DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ - n, __FUNCTION__); \ - if (I830_SYNC_WORKAROUND) \ - DO_IDLE_WORKAROUND(); \ - if (dev_priv->ring.space < n*4) \ - i830_wait_ring(dev, n*4); \ - dev_priv->ring.space -= n*4; \ - outring = dev_priv->ring.tail; \ - ringmask = dev_priv->ring.tail_mask; \ - virt = dev_priv->ring.virtual_start; \ -} while (0) - -#define ADVANCE_LP_RING() do { \ - if (I830_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ - dev_priv->ring.tail = outring; \ - I830_WRITE(LP_RING + RING_TAIL, outring); \ -} while(0) - -#define OUT_RING(n) do { \ - if (I830_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; \ - outring &= ringmask; \ -} while (0); static inline void i830_print_status_page(drm_device_t *dev) { @@ -151,14 +125,14 @@ } static struct file_operations i830_buffer_fops = { - open: DRM(open), - flush: DRM(flush), - release: DRM(release), - ioctl: DRM(ioctl), - mmap: i830_mmap_buffers, - read: DRM(read), - fasync: DRM(fasync), - poll: DRM(poll), + .open = DRM(open), + .flush = DRM(flush), + .release = DRM(release), + .ioctl = DRM(ioctl), + .mmap = i830_mmap_buffers, + .read = DRM(read), + .fasync = DRM(fasync), + .poll = DRM(poll), }; int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) @@ -181,7 +155,7 @@ buf_priv->currently_mapped = I830_BUF_MAPPED; unlock_kernel(); - if (remap_page_range(vma->vm_start, + if (remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, VM_OFFSET(vma), vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; @@ -199,36 +173,24 @@ if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL; - if(VM_DONTCOPY != 0) { -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - old_fops = filp->f_op; - filp->f_op = &i830_buffer_fops; - dev_priv->mmap_buffer = buf; - buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, - PROT_READ|PROT_WRITE, - MAP_SHARED, - buf->bus_address); - dev_priv->mmap_buffer = NULL; - filp->f_op = old_fops; - if ((unsigned long)buf_priv->virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed int)buf_priv->virtual; - buf_priv->virtual = 0; - } -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } else { - buf_priv->virtual = buf_priv->kernel_virtual; - buf_priv->currently_mapped = I830_BUF_MAPPED; + down_write( ¤t->mm->mmap_sem ); + old_fops = filp->f_op; + filp->f_op = &i830_buffer_fops; + dev_priv->mmap_buffer = buf; + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, + PROT_READ|PROT_WRITE, + MAP_SHARED, + buf->bus_address); + dev_priv->mmap_buffer = NULL; + filp->f_op = old_fops; + if ((unsigned long)buf_priv->virtual > -1024UL) { + /* Real error */ + DRM_ERROR("mmap error\n"); + retcode = (signed int)buf_priv->virtual; + buf_priv->virtual = 0; } + up_write( ¤t->mm->mmap_sem ); + return retcode; } @@ -237,28 +199,15 @@ drm_i830_buf_priv_t *buf_priv = buf->dev_private; int retcode = 0; - if(VM_DONTCOPY != 0) { - if(buf_priv->currently_mapped != I830_BUF_MAPPED) - return -EINVAL; -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif -#if LINUX_VERSION_CODE < 0x020399 - retcode = do_munmap((unsigned long)buf_priv->virtual, - (size_t) buf->total); -#else - retcode = do_munmap(current->mm, - (unsigned long)buf_priv->virtual, - (size_t) buf->total); -#endif -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } + if(buf_priv->currently_mapped != I830_BUF_MAPPED) + return -EINVAL; + + down_write(¤t->mm->mmap_sem); + retcode = DO_MUNMAP(current->mm, + (unsigned long)buf_priv->virtual, + (size_t) buf->total); + up_write(¤t->mm->mmap_sem); + buf_priv->currently_mapped = I830_BUF_UNMAPPED; buf_priv->virtual = 0; @@ -283,7 +232,7 @@ retcode = i830_map_buffer(buf, filp); if(retcode) { i830_freelist_put(dev, buf); - DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); + DRM_ERROR("mapbuf failed, retcode %d\n", retcode); return retcode; } buf->pid = priv->pid; @@ -296,32 +245,6 @@ return retcode; } -static unsigned long i830_alloc_page(drm_device_t *dev) -{ - unsigned long address; - - address = __get_free_page(GFP_KERNEL); - if(address == 0UL) - return 0; - - atomic_inc(&virt_to_page(address)->count); - set_bit(PG_locked, &virt_to_page(address)->flags); - - return address; -} - -static void i830_free_page(drm_device_t *dev, unsigned long page) -{ - if(page == 0UL) - return; - - atomic_dec(&virt_to_page(page)->count); - clear_bit(PG_locked, &virt_to_page(page)->flags); - wake_up(&virt_to_page(page)->wait); - free_page(page); - return; -} - static int i830_dma_cleanup(drm_device_t *dev) { drm_device_dma_t *dma = dev->dma; @@ -336,10 +259,21 @@ dev_priv->ring.Size); } if(dev_priv->hw_status_page != 0UL) { - i830_free_page(dev, dev_priv->hw_status_page); + pci_free_consistent(dev->pdev, PAGE_SIZE, + (void *)dev_priv->hw_status_page, + dev_priv->dma_status_page); /* Need to rewrite hardware status page */ I830_WRITE(0x02080, 0x1ffff000); } + + /* Disable interrupts here because after dev_private + * is freed, it's too late. + */ + if (dev->irq) { + I830_WRITE16( I830REG_INT_MASK_R, 0xffff ); + I830_WRITE16( I830REG_INT_ENABLE_R, 0x0 ); + } + DRM(free)(dev->dev_private, sizeof(drm_i830_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; @@ -353,7 +287,7 @@ return 0; } -static int i830_wait_ring(drm_device_t *dev, int n) +int i830_wait_ring(drm_device_t *dev, int n, const char *caller) { drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_ring_buffer_t *ring = &(dev_priv->ring); @@ -362,9 +296,7 @@ unsigned int last_head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; end = jiffies + (HZ*3); - while (ring->space < n) { - int i; - + while (ring->space < n) { ring->head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; ring->space = ring->head - (ring->tail+8); if (ring->space < 0) ring->space += ring->Size; @@ -375,13 +307,13 @@ } iters++; - if((signed)(end - jiffies) <= 0) { + if(time_before(end, jiffies)) { DRM_ERROR("space: %d wanted %d\n", ring->space, n); DRM_ERROR("lockup\n"); goto out_wait_ring; } - - for (i = 0 ; i < 2000 ; i++) ; + udelay(1); + dev_priv->sarea_priv->perf_boxes |= I830_BOX_WAIT; } out_wait_ring: @@ -394,9 +326,12 @@ drm_i830_ring_buffer_t *ring = &(dev_priv->ring); ring->head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->tail = I830_READ(LP_RING + RING_TAIL); + ring->tail = I830_READ(LP_RING + RING_TAIL) & TAIL_ADDR; ring->space = ring->head - (ring->tail+8); if (ring->space < 0) ring->space += ring->Size; + + if (ring->head == ring->tail) + dev_priv->sarea_priv->perf_boxes |= I830_BOX_RING_EMPTY; } static int i830_freelist_init(drm_device_t *dev, drm_i830_private_t *dev_priv) @@ -470,9 +405,6 @@ ((u8 *)dev_priv->sarea_map->handle + init->sarea_priv_offset); - atomic_set(&dev_priv->flush_done, 0); - init_waitqueue_head(&dev_priv->flush_queue); - dev_priv->ring.Start = init->ring_start; dev_priv->ring.End = init->ring_end; dev_priv->ring.Size = init->ring_size; @@ -496,11 +428,17 @@ dev_priv->pitch = init->pitch; dev_priv->back_offset = init->back_offset; dev_priv->depth_offset = init->depth_offset; + dev_priv->front_offset = init->front_offset; dev_priv->front_di1 = init->front_offset | init->pitch_bits; dev_priv->back_di1 = init->back_offset | init->pitch_bits; dev_priv->zi1 = init->depth_offset | init->pitch_bits; + DRM_DEBUG("front_di1 %x\n", dev_priv->front_di1); + DRM_DEBUG("back_offset %x\n", dev_priv->back_offset); + DRM_DEBUG("back_di1 %x\n", dev_priv->back_di1); + DRM_DEBUG("pitch_bits %x\n", init->pitch_bits); + dev_priv->cpp = init->cpp; /* We are using seperate values as placeholders for mechanisms for * private backbuffer/depthbuffer usage. @@ -508,9 +446,13 @@ dev_priv->back_pitch = init->back_pitch; dev_priv->depth_pitch = init->depth_pitch; + dev_priv->do_boxes = 0; + dev_priv->use_mi_batchbuffer_start = 0; /* Program Hardware Status Page */ - dev_priv->hw_status_page = i830_alloc_page(dev); + dev_priv->hw_status_page = + (unsigned long) pci_alloc_consistent(dev->pdev, PAGE_SIZE, + &dev_priv->dma_status_page); if(dev_priv->hw_status_page == 0UL) { dev->dev_private = (void *)dev_priv; i830_dma_cleanup(dev); @@ -566,83 +508,107 @@ return retcode; } +#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) +#define ST1_ENABLE (1<<16) +#define ST1_MASK (0xffff) + /* Most efficient way to verify state for the i830 is as it is * emitted. Non-conformant state is silently dropped. - * - * Use 'volatile' & local var tmp to force the emitted values to be - * identical to the verified ones. */ -static void i830EmitContextVerified( drm_device_t *dev, - volatile unsigned int *code ) +static void i830EmitContextVerified( drm_device_t *dev, + unsigned int *code ) { drm_i830_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; RING_LOCALS; - BEGIN_LP_RING( I830_CTX_SETUP_SIZE ); - for ( i = 0 ; i < I830_CTX_SETUP_SIZE ; i++ ) { + BEGIN_LP_RING( I830_CTX_SETUP_SIZE + 4 ); + + for ( i = 0 ; i < I830_CTXREG_BLENDCOLR0 ; i++ ) { tmp = code[i]; + if ((tmp & (7<<29)) == CMD_3D && + (tmp & (0x1f<<24)) < (0x1d<<24)) { + OUT_RING( tmp ); + j++; + } else { + DRM_ERROR("Skipping %d\n", i); + } + } -#if 0 - if ((tmp & (7<<29)) == (3<<29) && + OUT_RING( STATE3D_CONST_BLEND_COLOR_CMD ); + OUT_RING( code[I830_CTXREG_BLENDCOLR] ); + j += 2; + + for ( i = I830_CTXREG_VF ; i < I830_CTXREG_MCSB0 ; i++ ) { + tmp = code[i]; + if ((tmp & (7<<29)) == CMD_3D && (tmp & (0x1f<<24)) < (0x1d<<24)) { OUT_RING( tmp ); j++; } else { - printk("Skipping %d\n", i); + DRM_ERROR("Skipping %d\n", i); } -#else - OUT_RING( tmp ); - j++; -#endif } + OUT_RING( STATE3D_MAP_COORD_SETBIND_CMD ); + OUT_RING( code[I830_CTXREG_MCSB1] ); + j += 2; + if (j & 1) OUT_RING( 0 ); ADVANCE_LP_RING(); } -static void i830EmitTexVerified( drm_device_t *dev, - volatile unsigned int *code ) +static void i830EmitTexVerified( drm_device_t *dev, unsigned int *code ) { drm_i830_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; RING_LOCALS; - - BEGIN_LP_RING( I830_TEX_SETUP_SIZE ); - OUT_RING( GFX_OP_MAP_INFO ); - OUT_RING( code[I830_TEXREG_MI1] ); - OUT_RING( code[I830_TEXREG_MI2] ); - OUT_RING( code[I830_TEXREG_MI3] ); - OUT_RING( code[I830_TEXREG_MI4] ); - OUT_RING( code[I830_TEXREG_MI5] ); - - for ( i = 6 ; i < I830_TEX_SETUP_SIZE ; i++ ) { - tmp = code[i]; - OUT_RING( tmp ); - j++; - } + if (code[I830_TEXREG_MI0] == GFX_OP_MAP_INFO || + (code[I830_TEXREG_MI0] & ~(0xf*LOAD_TEXTURE_MAP0)) == + (STATE3D_LOAD_STATE_IMMEDIATE_2|4)) { + + BEGIN_LP_RING( I830_TEX_SETUP_SIZE ); + + OUT_RING( code[I830_TEXREG_MI0] ); /* TM0LI */ + OUT_RING( code[I830_TEXREG_MI1] ); /* TM0S0 */ + OUT_RING( code[I830_TEXREG_MI2] ); /* TM0S1 */ + OUT_RING( code[I830_TEXREG_MI3] ); /* TM0S2 */ + OUT_RING( code[I830_TEXREG_MI4] ); /* TM0S3 */ + OUT_RING( code[I830_TEXREG_MI5] ); /* TM0S4 */ + + for ( i = 6 ; i < I830_TEX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + OUT_RING( tmp ); + j++; + } - if (j & 1) - OUT_RING( 0 ); + if (j & 1) + OUT_RING( 0 ); - ADVANCE_LP_RING(); + ADVANCE_LP_RING(); + } + else + printk("rejected packet %x\n", code[0]); } static void i830EmitTexBlendVerified( drm_device_t *dev, - volatile unsigned int *code, - volatile unsigned int num) + unsigned int *code, + unsigned int num) { drm_i830_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; RING_LOCALS; - BEGIN_LP_RING( num ); + if (!num) + return; + + BEGIN_LP_RING( num + 1 ); for ( i = 0 ; i < num ; i++ ) { tmp = code[i]; @@ -665,6 +631,8 @@ int i; RING_LOCALS; + return; + BEGIN_LP_RING( 258 ); if(is_shared == 1) { @@ -678,44 +646,43 @@ OUT_RING(palette[i]); } OUT_RING(0); + /* KW: WHERE IS THE ADVANCE_LP_RING? This is effectively a noop! + */ } /* Need to do some additional checking when setting the dest buffer. */ static void i830EmitDestVerified( drm_device_t *dev, - volatile unsigned int *code ) + unsigned int *code ) { drm_i830_private_t *dev_priv = dev->dev_private; unsigned int tmp; RING_LOCALS; - BEGIN_LP_RING( I830_DEST_SETUP_SIZE + 6 ); + BEGIN_LP_RING( I830_DEST_SETUP_SIZE + 10 ); + tmp = code[I830_DESTREG_CBUFADDR]; - if (tmp == dev_priv->front_di1) { - /* Don't use fence when front buffer rendering */ - OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( BUF_3D_ID_COLOR_BACK | - BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) ); - OUT_RING( tmp ); + if (tmp == dev_priv->front_di1 || tmp == dev_priv->back_di1) { + if (((int)outring) & 8) { + OUT_RING(0); + OUT_RING(0); + } OUT_RING( CMD_OP_DESTBUFFER_INFO ); - OUT_RING( BUF_3D_ID_DEPTH | - BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); - OUT_RING( dev_priv->zi1 ); - } else if(tmp == dev_priv->back_di1) { - OUT_RING( CMD_OP_DESTBUFFER_INFO ); OUT_RING( BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) | BUF_3D_USE_FENCE); OUT_RING( tmp ); + OUT_RING( 0 ); OUT_RING( CMD_OP_DESTBUFFER_INFO ); OUT_RING( BUF_3D_ID_DEPTH | BUF_3D_USE_FENCE | BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); OUT_RING( dev_priv->zi1 ); + OUT_RING( 0 ); } else { - DRM_DEBUG("bad di1 %x (allow %x or %x)\n", + DRM_ERROR("bad di1 %x (allow %x or %x)\n", tmp, dev_priv->front_di1, dev_priv->back_di1); } @@ -737,25 +704,39 @@ if((tmp & ~0x3) == GFX_OP_SCISSOR_ENABLE) { OUT_RING( tmp ); } else { - DRM_DEBUG("bad scissor enable\n"); + DRM_ERROR("bad scissor enable\n"); OUT_RING( 0 ); } - OUT_RING( code[I830_DESTREG_SENABLE] ); - OUT_RING( GFX_OP_SCISSOR_RECT ); OUT_RING( code[I830_DESTREG_SR1] ); OUT_RING( code[I830_DESTREG_SR2] ); + OUT_RING( 0 ); ADVANCE_LP_RING(); } +static void i830EmitStippleVerified( drm_device_t *dev, + unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + BEGIN_LP_RING( 2 ); + OUT_RING( GFX_OP_STIPPLE ); + OUT_RING( code[1] ); + ADVANCE_LP_RING(); +} + + static void i830EmitState( drm_device_t *dev ) { drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; + DRM_DEBUG("%s %x\n", __FUNCTION__, dirty); + if (dirty & I830_UPLOAD_BUFFERS) { i830EmitDestVerified( dev, sarea_priv->BufferState ); sarea_priv->dirty &= ~I830_UPLOAD_BUFFERS; @@ -789,19 +770,156 @@ } if (dirty & I830_UPLOAD_TEX_PALETTE_SHARED) { - i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 1); + i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 1); } else { - if (dirty & I830_UPLOAD_TEX_PALETTE_N(0)) { - i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 0); - sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(0); - } - if (dirty & I830_UPLOAD_TEX_PALETTE_N(1)) { - i830EmitTexPalette(dev, sarea_priv->Palette[1], 1, 0); - sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(1); - } + if (dirty & I830_UPLOAD_TEX_PALETTE_N(0)) { + i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(0); + } + if (dirty & I830_UPLOAD_TEX_PALETTE_N(1)) { + i830EmitTexPalette(dev, sarea_priv->Palette[1], 1, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(1); + } + + /* 1.3: + */ +#if 0 + if (dirty & I830_UPLOAD_TEX_PALETTE_N(2)) { + i830EmitTexPalette(dev, sarea_priv->Palette2[0], 0, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(2); + } + if (dirty & I830_UPLOAD_TEX_PALETTE_N(3)) { + i830EmitTexPalette(dev, sarea_priv->Palette2[1], 1, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(2); + } +#endif + } + + /* 1.3: + */ + if (dirty & I830_UPLOAD_STIPPLE) { + i830EmitStippleVerified( dev, + sarea_priv->StippleState); + sarea_priv->dirty &= ~I830_UPLOAD_STIPPLE; + } + + if (dirty & I830_UPLOAD_TEX2) { + i830EmitTexVerified( dev, sarea_priv->TexState2 ); + sarea_priv->dirty &= ~I830_UPLOAD_TEX2; + } + + if (dirty & I830_UPLOAD_TEX3) { + i830EmitTexVerified( dev, sarea_priv->TexState3 ); + sarea_priv->dirty &= ~I830_UPLOAD_TEX3; + } + + + if (dirty & I830_UPLOAD_TEXBLEND2) { + i830EmitTexBlendVerified( + dev, + sarea_priv->TexBlendState2, + sarea_priv->TexBlendStateWordsUsed2); + + sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND2; + } + + if (dirty & I830_UPLOAD_TEXBLEND3) { + i830EmitTexBlendVerified( + dev, + sarea_priv->TexBlendState3, + sarea_priv->TexBlendStateWordsUsed3); + sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND3; } } +/* ================================================================ + * Performance monitoring functions + */ + +static void i830_fill_box( drm_device_t *dev, + int x, int y, int w, int h, + int r, int g, int b ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + u32 color; + unsigned int BR13, CMD; + RING_LOCALS; + + BR13 = (0xF0 << 16) | (dev_priv->pitch * dev_priv->cpp) | (1<<24); + CMD = XY_COLOR_BLT_CMD; + x += dev_priv->sarea_priv->boxes[0].x1; + y += dev_priv->sarea_priv->boxes[0].y1; + + if (dev_priv->cpp == 4) { + BR13 |= (1<<25); + CMD |= (XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB); + color = (((0xff) << 24) | (r << 16) | (g << 8) | b); + } else { + color = (((r & 0xf8) << 8) | + ((g & 0xfc) << 3) | + ((b & 0xf8) >> 3)); + } + + BEGIN_LP_RING( 6 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + OUT_RING( (y << 16) | x ); + OUT_RING( ((y+h) << 16) | (x+w) ); + + if ( dev_priv->current_page == 1 ) { + OUT_RING( dev_priv->front_offset ); + } else { + OUT_RING( dev_priv->back_offset ); + } + + OUT_RING( color ); + ADVANCE_LP_RING(); +} + +static void i830_cp_performance_boxes( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + + /* Purple box for page flipping + */ + if ( dev_priv->sarea_priv->perf_boxes & I830_BOX_FLIP ) + i830_fill_box( dev, 4, 4, 8, 8, 255, 0, 255 ); + + /* Red box if we have to wait for idle at any point + */ + if ( dev_priv->sarea_priv->perf_boxes & I830_BOX_WAIT ) + i830_fill_box( dev, 16, 4, 8, 8, 255, 0, 0 ); + + /* Blue box: lost context? + */ + if ( dev_priv->sarea_priv->perf_boxes & I830_BOX_LOST_CONTEXT ) + i830_fill_box( dev, 28, 4, 8, 8, 0, 0, 255 ); + + /* Yellow box for texture swaps + */ + if ( dev_priv->sarea_priv->perf_boxes & I830_BOX_TEXTURE_LOAD ) + i830_fill_box( dev, 40, 4, 8, 8, 255, 255, 0 ); + + /* Green box if hardware never idles (as far as we can tell) + */ + if ( !(dev_priv->sarea_priv->perf_boxes & I830_BOX_RING_EMPTY) ) + i830_fill_box( dev, 64, 4, 8, 8, 0, 255, 0 ); + + + /* Draw bars indicating number of buffers allocated + * (not a great measure, easily confused) + */ + if (dev_priv->dma_used) { + int bar = dev_priv->dma_used / 10240; + if (bar > 100) bar = 100; + if (bar < 1) bar = 1; + i830_fill_box( dev, 4, 16, bar, 4, 196, 128, 128 ); + dev_priv->dma_used = 0; + } + + dev_priv->sarea_priv->perf_boxes = 0; +} + static void i830_dma_dispatch_clear( drm_device_t *dev, int flags, unsigned int clear_color, unsigned int clear_zval, @@ -817,6 +935,15 @@ unsigned int BR13, CMD, D_CMD; RING_LOCALS; + + if ( dev_priv->current_page == 1 ) { + unsigned int tmp = flags; + + flags &= ~(I830_FRONT | I830_BACK); + if ( tmp & I830_FRONT ) flags |= I830_BACK; + if ( tmp & I830_BACK ) flags |= I830_FRONT; + } + i830_kernel_lost_context(dev); switch(cpp) { @@ -857,7 +984,7 @@ OUT_RING( BR13 ); OUT_RING( (pbox->y1 << 16) | pbox->x1 ); OUT_RING( (pbox->y2 << 16) | pbox->x2 ); - OUT_RING( 0 ); + OUT_RING( dev_priv->front_offset ); OUT_RING( clear_color ); ADVANCE_LP_RING(); } @@ -896,13 +1023,17 @@ drm_clip_rect_t *pbox = sarea_priv->boxes; int pitch = dev_priv->pitch; int cpp = dev_priv->cpp; - int ofs = dev_priv->back_offset; int i; unsigned int CMD, BR13; RING_LOCALS; DRM_DEBUG("swapbuffers\n"); + i830_kernel_lost_context(dev); + + if (dev_priv->do_boxes) + i830_cp_performance_boxes( dev ); + switch(cpp) { case 2: BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); @@ -919,7 +1050,6 @@ break; } - i830_kernel_lost_context(dev); if (nbox > I830_NR_SAREA_CLIPRECTS) nbox = I830_NR_SAREA_CLIPRECTS; @@ -939,24 +1069,73 @@ BEGIN_LP_RING( 8 ); OUT_RING( CMD ); OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); - OUT_RING( (pbox->y1 << 16) | - pbox->x1 ); - OUT_RING( (pbox->y2 << 16) | - pbox->x2 ); - - OUT_RING( 0 /* front ofs always zero */ ); - OUT_RING( (pbox->y1 << 16) | - pbox->x1 ); + if (dev_priv->current_page == 0) + OUT_RING( dev_priv->front_offset ); + else + OUT_RING( dev_priv->back_offset ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); OUT_RING( BR13 & 0xffff ); - OUT_RING( ofs ); + if (dev_priv->current_page == 0) + OUT_RING( dev_priv->back_offset ); + else + OUT_RING( dev_priv->front_offset ); + ADVANCE_LP_RING(); } } +static void i830_dma_dispatch_flip( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + DRM_DEBUG( "%s: page=%d pfCurrentPage=%d\n", + __FUNCTION__, + dev_priv->current_page, + dev_priv->sarea_priv->pf_current_page); + + i830_kernel_lost_context(dev); + + if (dev_priv->do_boxes) { + dev_priv->sarea_priv->perf_boxes |= I830_BOX_FLIP; + i830_cp_performance_boxes( dev ); + } + + + BEGIN_LP_RING( 2 ); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + + BEGIN_LP_RING( 6 ); + OUT_RING( CMD_OP_DISPLAYBUFFER_INFO | ASYNC_FLIP ); + OUT_RING( 0 ); + if ( dev_priv->current_page == 0 ) { + OUT_RING( dev_priv->back_offset ); + dev_priv->current_page = 1; + } else { + OUT_RING( dev_priv->front_offset ); + dev_priv->current_page = 0; + } + OUT_RING(0); + ADVANCE_LP_RING(); + + + BEGIN_LP_RING( 2 ); + OUT_RING( MI_WAIT_FOR_EVENT | + MI_WAIT_FOR_PLANE_A_FLIP ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + + + dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; +} + static void i830_dma_dispatch_vertex(drm_device_t *dev, drm_buf_t *buf, int discard, @@ -985,7 +1164,7 @@ } } - if (used > 4*1024) + if (used > 4*1023) used = 0; if (sarea_priv->dirty) @@ -1002,12 +1181,19 @@ DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); if (buf_priv->currently_mapped == I830_BUF_MAPPED) { - *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | - sarea_priv->vertex_prim | - ((used/4)-2)); + u32 *vp = buf_priv->virtual; + + vp[0] = (GFX_OP_PRIMITIVE | + sarea_priv->vertex_prim | + ((used/4)-2)); + + if (dev_priv->use_mi_batchbuffer_start) { + vp[used/4] = MI_BATCH_BUFFER_END; + used += 4; + } if (used & 4) { - *(u32 *)((u32)buf_priv->virtual + used) = 0; + vp[used/4] = 0; used += 4; } @@ -1027,80 +1213,45 @@ ADVANCE_LP_RING(); } - BEGIN_LP_RING(4); + if (dev_priv->use_mi_batchbuffer_start) { + BEGIN_LP_RING(2); + OUT_RING( MI_BATCH_BUFFER_START | (2<<6) ); + OUT_RING( start | MI_BATCH_NON_SECURE ); + ADVANCE_LP_RING(); + } + else { + BEGIN_LP_RING(4); + OUT_RING( MI_BATCH_BUFFER ); + OUT_RING( start | MI_BATCH_NON_SECURE ); + OUT_RING( start + used - 4 ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + } - OUT_RING( MI_BATCH_BUFFER ); - OUT_RING( start | MI_BATCH_NON_SECURE ); - OUT_RING( start + used - 4 ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); - } while (++i < nbox); } - BEGIN_LP_RING(10); - OUT_RING( CMD_STORE_DWORD_IDX ); - OUT_RING( 20 ); - OUT_RING( dev_priv->counter ); - OUT_RING( 0 ); - if (discard) { + dev_priv->counter++; + + (void) cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, + I830_BUF_HARDWARE); + + BEGIN_LP_RING(8); + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( 20 ); + OUT_RING( dev_priv->counter ); OUT_RING( CMD_STORE_DWORD_IDX ); OUT_RING( buf_priv->my_use_idx ); OUT_RING( I830_BUF_FREE ); + OUT_RING( CMD_REPORT_HEAD ); OUT_RING( 0 ); + ADVANCE_LP_RING(); } - - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); } -/* Interrupts are only for flushing */ -void i830_dma_service(int irq, void *device, struct pt_regs *regs) -{ - drm_device_t *dev = (drm_device_t *)device; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u16 temp; - - temp = I830_READ16(I830REG_INT_IDENTITY_R); - temp = temp & ~(0x6000); - if(temp != 0) I830_WRITE16(I830REG_INT_IDENTITY_R, - temp); /* Clear all interrupts */ - else - return; - - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -void DRM(dma_immediate_bh)(void *device) -{ - drm_device_t *dev = (drm_device_t *) device; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); -} - -static inline void i830_dma_emit_flush(drm_device_t *dev) -{ - drm_i830_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - i830_kernel_lost_context(dev); - - BEGIN_LP_RING(2); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( GFX_OP_USER_INTERRUPT ); - ADVANCE_LP_RING(); - - i830_wait_ring( dev, dev_priv->ring.Size - 8 ); - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); -} - -static inline void i830_dma_quiescent_emit(drm_device_t *dev) +void i830_dma_quiescent(drm_device_t *dev) { drm_i830_private_t *dev_priv = dev->dev_private; RING_LOCALS; @@ -1110,80 +1261,28 @@ BEGIN_LP_RING(4); OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); OUT_RING( 0 ); - OUT_RING( GFX_OP_USER_INTERRUPT ); ADVANCE_LP_RING(); - i830_wait_ring( dev, dev_priv->ring.Size - 8 ); - atomic_set(&dev_priv->flush_done, 1); - wake_up_interruptible(&dev_priv->flush_queue); + i830_wait_ring( dev, dev_priv->ring.Size - 8, __FUNCTION__ ); } -void i830_dma_quiescent(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - unsigned long end; - - if(dev_priv == NULL) { - return; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i830_dma_quiescent_emit(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - break; - } - } - - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - - return; -} - static int i830_flush_queue(drm_device_t *dev) { - DECLARE_WAITQUEUE(entry, current); - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + drm_i830_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; - unsigned long end; - int i, ret = 0; + int i, ret = 0; + RING_LOCALS; + + i830_kernel_lost_context(dev); - if(dev_priv == NULL) { - return 0; - } - atomic_set(&dev_priv->flush_done, 0); - add_wait_queue(&dev_priv->flush_queue, &entry); - end = jiffies + (HZ*3); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - i830_dma_emit_flush(dev); - if (atomic_read(&dev_priv->flush_done) == 1) break; - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("lockup\n"); - break; - } - schedule_timeout(HZ*3); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - break; - } - } - - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); + BEGIN_LP_RING(2); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + i830_wait_ring( dev, dev_priv->ring.Size - 8, __FUNCTION__ ); for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; @@ -1195,7 +1294,7 @@ if (used == I830_BUF_HARDWARE) DRM_DEBUG("reclaimed from HARDWARE\n"); if (used == I830_BUF_CLIENT) - DRM_DEBUG("still on client HARDWARE\n"); + DRM_DEBUG("still on client\n"); } return ret; @@ -1234,8 +1333,7 @@ { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - - DRM_DEBUG("i830_flush_ioctl\n"); + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i830_flush_ioctl called without lock held\n"); return -EINVAL; @@ -1324,6 +1422,53 @@ return 0; } + + +/* Not sure why this isn't set all the time: + */ +static void i830_do_init_pageflip( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + + DRM_DEBUG("%s\n", __FUNCTION__); + dev_priv->page_flipping = 1; + dev_priv->current_page = 0; + dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; +} + +int i830_do_cleanup_pageflip( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + + DRM_DEBUG("%s\n", __FUNCTION__); + if (dev_priv->current_page != 0) + i830_dma_dispatch_flip( dev ); + + dev_priv->page_flipping = 0; + return 0; +} + +int i830_flip_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_private_t *dev_priv = dev->dev_private; + + DRM_DEBUG("%s\n", __FUNCTION__); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_flip_buf called without lock held\n"); + return -EINVAL; + } + + if (!dev_priv->page_flipping) + i830_do_init_pageflip( dev ); + + i830_dma_dispatch_flip( dev ); + return 0; +} + int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -1372,47 +1517,81 @@ return retcode; } + +int i830_copybuf(struct inode *inode, + struct file *filp, + unsigned int cmd, + unsigned long arg) +{ + /* Never copy - 2.4.x doesn't need it */ + return 0; +} -int i830_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, +int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { + return 0; +} + + + +int i830_getparam( struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg ) +{ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_i830_copy_t d; - drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; - u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) - dev_priv->sarea_priv; - drm_buf_t *buf; - drm_i830_buf_priv_t *buf_priv; - drm_device_dma_t *dma = dev->dma; + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_getparam_t param; + int value; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_dma called without lock held\n"); + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } - - if (copy_from_user(&d, (drm_i830_copy_t *)arg, sizeof(d))) - return -EFAULT; - - if(d.idx < 0 || d.idx > dma->buf_count) return -EINVAL; - buf = dma->buflist[ d.idx ]; - buf_priv = buf->dev_private; - if (buf_priv->currently_mapped != I830_BUF_MAPPED) return -EPERM; - - if(d.used < 0 || d.used > buf->total) return -EINVAL; - if (copy_from_user(buf_priv->virtual, d.address, d.used)) + if (copy_from_user(¶m, (drm_i830_getparam_t *)arg, sizeof(param) )) return -EFAULT; - sarea_priv->last_dispatch = (int) hw_status[5]; + switch( param.param ) { + case I830_PARAM_IRQ_ACTIVE: + value = dev->irq ? 1 : 0; + break; + default: + return -EINVAL; + } + if ( copy_to_user( param.value, &value, sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return -EFAULT; + } + return 0; } -int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) + +int i830_setparam( struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg ) { - if(VM_DONTCOPY == 0) return 1; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_setparam_t param; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if (copy_from_user(¶m, (drm_i830_setparam_t *)arg, sizeof(param) )) + return -EFAULT; + + switch( param.param ) { + case I830_SETPARAM_USE_MI_BATCHBUFFER_START: + dev_priv->use_mi_batchbuffer_start = param.value; + break; + default: + return -EINVAL; + } + return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h:1.1 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h Mon Dec 9 20:27:08 2002 @@ -3,6 +3,9 @@ /* WARNING: These defines must be the same as what the Xserver uses. * if you change them, you must change the defines in the Xserver. + * + * KW: Actually, you can't ever change them because doing so would + * break backwards compatibility. */ #ifndef _I830_DEFINES_ @@ -18,14 +21,12 @@ #define I830_NR_TEX_REGIONS 64 #define I830_LOG_MIN_TEX_REGION_SIZE 16 -/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ -#if !defined(I830_ENABLE_4_TEXTURES) +/* KW: These aren't correct but someone set them to two and then + * released the module. Now we can't change them as doing so would + * break backwards compatibility. + */ #define I830_TEXTURE_COUNT 2 -#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ -#else /* defined(I830_ENABLE_4_TEXTURES) */ -#define I830_TEXTURE_COUNT 4 -#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ -#endif /* I830_ENABLE_4_TEXTURES */ +#define I830_TEXBLEND_COUNT I830_TEXTURE_COUNT #define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ @@ -57,6 +58,7 @@ #define I830_UPLOAD_TEXBLEND_MASK 0xf00000 #define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) #define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 +#define I830_UPLOAD_STIPPLE 0x8000000 /* Indices into buf.Setup where various bits of state are mirrored per * context and per buffer. These can be fired at the card as a unit, @@ -73,7 +75,6 @@ */ #define I830_DESTREG_CBUFADDR 0 -/* Invarient */ #define I830_DESTREG_DBUFADDR 1 #define I830_DESTREG_DV0 2 #define I830_DESTREG_DV1 3 @@ -109,6 +110,13 @@ #define I830_CTXREG_MCSB1 16 #define I830_CTX_SETUP_SIZE 17 +/* 1.3: Stipple state + */ +#define I830_STPREG_ST0 0 +#define I830_STPREG_ST1 1 +#define I830_STP_SETUP_SIZE 2 + + /* Texture state (per tex unit) */ @@ -124,6 +132,18 @@ #define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ #define I830_TEX_SETUP_SIZE 10 +#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */ +#define I830_TEXREG_TM0S0 1 +#define I830_TEXREG_TM0S1 2 +#define I830_TEXREG_TM0S2 3 +#define I830_TEXREG_TM0S3 4 +#define I830_TEXREG_TM0S4 5 +#define I830_TEXREG_NOP0 6 /* noop */ +#define I830_TEXREG_NOP1 7 /* noop */ +#define I830_TEXREG_NOP2 8 /* noop */ +#define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */ +#define __I830_TEX_SETUP_SIZE 10 + #define I830_FRONT 0x1 #define I830_BACK 0x2 #define I830_DEPTH 0x4 @@ -199,8 +219,53 @@ int ctxOwner; /* last context to upload state */ int vertex_prim; + + int pf_enabled; /* is pageflipping allowed? */ + int pf_active; + int pf_current_page; /* which buffer is being displayed? */ + + int perf_boxes; /* performance boxes to be displayed */ + + /* Here's the state for texunits 2,3: + */ + unsigned int TexState2[I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState2[I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed2; + + unsigned int TexState3[I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState3[I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed3; + + unsigned int StippleState[I830_STP_SETUP_SIZE]; } drm_i830_sarea_t; +/* Flags for perf_boxes + */ +#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ +#define I830_BOX_FLIP 0x2 /* populated by kernel */ +#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ +#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ +#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ + + +/* I830 specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_IOCTL_I830_INIT DRM_IOW( 0x40, drm_i830_init_t) +#define DRM_IOCTL_I830_VERTEX DRM_IOW( 0x41, drm_i830_vertex_t) +#define DRM_IOCTL_I830_CLEAR DRM_IOW( 0x42, drm_i830_clear_t) +#define DRM_IOCTL_I830_FLUSH DRM_IO ( 0x43) +#define DRM_IOCTL_I830_GETAGE DRM_IO ( 0x44) +#define DRM_IOCTL_I830_GETBUF DRM_IOWR(0x45, drm_i830_dma_t) +#define DRM_IOCTL_I830_SWAP DRM_IO ( 0x46) +#define DRM_IOCTL_I830_COPY DRM_IOW( 0x47, drm_i830_copy_t) +#define DRM_IOCTL_I830_DOCOPY DRM_IO ( 0x48) +#define DRM_IOCTL_I830_FLIP DRM_IO ( 0x49) +#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(0x4a, drm_i830_irq_emit_t) +#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( 0x4b, drm_i830_irq_wait_t) +#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(0x4c, drm_i830_getparam_t) +#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(0x4d, drm_i830_setparam_t) + typedef struct _drm_i830_clear { int clear_color; int clear_depth; @@ -234,5 +299,37 @@ int request_size; int granted; } drm_i830_dma_t; + + +/* 1.3: Userspace can request & wait on irq's: + */ +typedef struct drm_i830_irq_emit { + int *irq_seq; +} drm_i830_irq_emit_t; + +typedef struct drm_i830_irq_wait { + int irq_seq; +} drm_i830_irq_wait_t; + + +/* 1.3: New ioctl to query kernel params: + */ +#define I830_PARAM_IRQ_ACTIVE 1 + +typedef struct drm_i830_getparam { + int param; + int *value; +} drm_i830_getparam_t; + + +/* 1.3: New ioctl to set kernel params: + */ +#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 + +typedef struct drm_i830_setparam { + int param; + int value; +} drm_i830_setparam_t; + #endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c:1.1 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c Tue Sep 10 20:29:34 2002 @@ -29,41 +29,16 @@ * Jeff Hartmann <jhartmann@valinux.com> * Gareth Hughes <gareth@valinux.com> * Abraham vd Merwe <abraham@2d3d.co.za> + * Keith Whitwell <keith@tungstengraphics.com> */ #include <linux/config.h> #include "i830.h" #include "drmP.h" +#include "drm.h" +#include "i830_drm.h" #include "i830_drv.h" -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "i830" -#define DRIVER_DESC "Intel 830M" -#define DRIVER_DATE "20011004" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_INIT)] = { i830_dma_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_VERTEX)] = { i830_dma_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_CLEAR)] = { i830_clear_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_FLUSH)] = { i830_flush_ioctl, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_GETAGE)] = { i830_getage, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_GETBUF)] = { i830_getbuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_SWAP)] = { i830_swap_bufs, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_COPY)] = { i830_copybuf, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_I830_DOCOPY)] = { i830_docopy, 1, 0 }, - -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" @@ -71,25 +46,6 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init i830_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", i830_options ); -#endif #include "drm_fops.h" #include "drm_init.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h:1.1 Thu Oct 4 14:28:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h Mon Dec 9 20:27:08 2002 @@ -64,19 +64,33 @@ unsigned long hw_status_page; unsigned long counter; - atomic_t flush_done; - wait_queue_head_t flush_queue; /* Processes waiting until flush */ + dma_addr_t dma_status_page; + drm_buf_t *mmap_buffer; u32 front_di1, back_di1, zi1; int back_offset; int depth_offset; + int front_offset; int w, h; int pitch; int back_pitch; int depth_pitch; unsigned int cpp; + + int do_boxes; + int dma_used; + + int current_page; + int page_flipping; + + wait_queue_head_t irq_queue; + atomic_t irq_received; + atomic_t irq_emitted; + + int use_mi_batchbuffer_start; + } drm_i830_private_t; /* i830_dma.c */ @@ -107,24 +121,81 @@ extern int i830_clear_bufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -#define I830_VERBOSE 0 +extern int i830_flip_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int i830_getparam( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern int i830_setparam( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +/* i830_irq.c */ +extern int i830_irq_emit( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int i830_irq_wait( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int i830_wait_irq(drm_device_t *dev, int irq_nr); +extern int i830_emit_irq(drm_device_t *dev); + + #define I830_BASE(reg) ((unsigned long) \ dev_priv->mmio_map->handle) #define I830_ADDR(reg) (I830_BASE(reg) + reg) -#define I830_DEREF(reg) *(__volatile__ int *)I830_ADDR(reg) -#define I830_READ(reg) I830_DEREF(reg) -#define I830_WRITE(reg,val) do { I830_DEREF(reg) = val; } while (0) +#define I830_DEREF(reg) *(__volatile__ unsigned int *)I830_ADDR(reg) +#define I830_READ(reg) readl((volatile u32 *)I830_ADDR(reg)) +#define I830_WRITE(reg,val) writel(val, (volatile u32 *)I830_ADDR(reg)) #define I830_DEREF16(reg) *(__volatile__ u16 *)I830_ADDR(reg) #define I830_READ16(reg) I830_DEREF16(reg) #define I830_WRITE16(reg,val) do { I830_DEREF16(reg) = val; } while (0) + + +#define I830_VERBOSE 0 + +#define RING_LOCALS unsigned int outring, ringmask, outcount; \ + volatile char *virt; + +#define BEGIN_LP_RING(n) do { \ + if (I830_VERBOSE) \ + printk("BEGIN_LP_RING(%d) in %s\n", \ + n, __FUNCTION__); \ + if (dev_priv->ring.space < n*4) \ + i830_wait_ring(dev, n*4, __FUNCTION__); \ + outcount = 0; \ + outring = dev_priv->ring.tail; \ + ringmask = dev_priv->ring.tail_mask; \ + virt = dev_priv->ring.virtual_start; \ +} while (0) + + +#define OUT_RING(n) do { \ + if (I830_VERBOSE) printk(" OUT_RING %x\n", (int)(n)); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outcount++; \ + outring += 4; \ + outring &= ringmask; \ +} while (0) + +#define ADVANCE_LP_RING() do { \ + if (I830_VERBOSE) printk("ADVANCE_LP_RING %x\n", outring); \ + dev_priv->ring.tail = outring; \ + dev_priv->ring.space -= outcount * 4; \ + I830_WRITE(LP_RING + RING_TAIL, outring); \ +} while(0) + +extern int i830_wait_ring(drm_device_t *dev, int n, const char *caller); + + #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) #define CMD_REPORT_HEAD (7<<23) #define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1) #define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1) +#define STATE3D_LOAD_STATE_IMMEDIATE_2 ((0x3<<29)|(0x1d<<24)|(0x03<<16)) +#define LOAD_TEXTURE_MAP0 (1<<11) + #define INST_PARSER_CLIENT 0x00000000 #define INST_OP_FLUSH 0x02000000 #define INST_FLUSH_MAP_CACHE 0x00000001 @@ -140,18 +211,21 @@ #define I830REG_INT_MASK_R 0x020a8 #define I830REG_INT_ENABLE_R 0x020a0 +#define I830_IRQ_RESERVED ((1<<13)|(3<<2)) + + #define LP_RING 0x2030 #define HP_RING 0x2040 #define RING_TAIL 0x00 -#define TAIL_ADDR 0x000FFFF8 +#define TAIL_ADDR 0x001FFFF8 #define RING_HEAD 0x04 #define HEAD_WRAP_COUNT 0xFFE00000 #define HEAD_WRAP_ONE 0x00200000 #define HEAD_ADDR 0x001FFFFC #define RING_START 0x08 -#define START_ADDR 0x00FFFFF8 +#define START_ADDR 0x0xFFFFF000 #define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 +#define RING_NR_PAGES 0x001FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 #define RING_REPORT_128K 0x00000004 @@ -182,6 +256,12 @@ #define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) +#define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) +#define ASYNC_FLIP (1<<22) + +#define CMD_3D (0x3<<29) +#define STATE3D_CONST_BLEND_COLOR_CMD (CMD_3D|(0x1d<<24)|(0x88<<16)) +#define STATE3D_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16)) #define BR00_BITBLT_CLIENT 0x40000000 #define BR00_OP_COLOR_BLT 0x10000000 @@ -206,8 +286,15 @@ #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) #define MI_BATCH_BUFFER ((0x30<<23)|1) +#define MI_BATCH_BUFFER_START (0x31<<23) +#define MI_BATCH_BUFFER_END (0xA<<23) #define MI_BATCH_NON_SECURE (1) +#define MI_WAIT_FOR_EVENT ((0x3<<23)) +#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) +#define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1) + +#define MI_LOAD_SCAN_LINES_INCL ((0x12<<23)) #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_irq.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_irq.c:1.1 --- /dev/null Thu Feb 27 12:32:37 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_irq.c Mon Dec 9 20:27:08 2002 @@ -0,0 +1,178 @@ +/* i830_dma.c -- DMA support for the I830 -*- linux-c -*- + * + * Copyright 2002 Tungsten Graphics, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Keith Whitwell <keith@tungstengraphics.com> + * + */ + +#define __NO_VERSION__ +#include "i830.h" +#include "drmP.h" +#include "drm.h" +#include "i830_drm.h" +#include "i830_drv.h" +#include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> + + +void DRM(dma_service)(int irq, void *device, struct pt_regs *regs) +{ + drm_device_t *dev = (drm_device_t *)device; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u16 temp; + + temp = I830_READ16(I830REG_INT_IDENTITY_R); + printk("%s: %x\n", __FUNCTION__, temp); + + if(temp == 0) + return; + + I830_WRITE16(I830REG_INT_IDENTITY_R, temp); + + if (temp & 2) { + atomic_inc(&dev_priv->irq_received); + wake_up_interruptible(&dev_priv->irq_queue); + } +} + + +int i830_emit_irq(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + DRM_DEBUG("%s\n", __FUNCTION__); + + atomic_inc(&dev_priv->irq_emitted); + + BEGIN_LP_RING(2); + OUT_RING( 0 ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + + return atomic_read(&dev_priv->irq_emitted); +} + + +int i830_wait_irq(drm_device_t *dev, int irq_nr) +{ + drm_i830_private_t *dev_priv = + (drm_i830_private_t *)dev->dev_private; + DECLARE_WAITQUEUE(entry, current); + unsigned long end = jiffies + HZ*3; + int ret = 0; + + DRM_DEBUG("%s\n", __FUNCTION__); + + if (atomic_read(&dev_priv->irq_received) >= irq_nr) + return 0; + + dev_priv->sarea_priv->perf_boxes |= I830_BOX_WAIT; + + add_wait_queue(&dev_priv->irq_queue, &entry); + + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (atomic_read(&dev_priv->irq_received) >= irq_nr) + break; + if((signed)(end - jiffies) <= 0) { + DRM_ERROR("timeout iir %x imr %x ier %x hwstam %x\n", + I830_READ16( I830REG_INT_IDENTITY_R ), + I830_READ16( I830REG_INT_MASK_R ), + I830_READ16( I830REG_INT_ENABLE_R ), + I830_READ16( I830REG_HWSTAM )); + + ret = -EBUSY; /* Lockup? Missed irq? */ + break; + } + schedule_timeout(HZ*3); + if (signal_pending(current)) { + ret = -EINTR; + break; + } + } + + current->state = TASK_RUNNING; + remove_wait_queue(&dev_priv->irq_queue, &entry); + return ret; +} + + +/* Needs the lock as it touches the ring. + */ +int i830_irq_emit( struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_irq_emit_t emit; + int result; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_irq_emit called without lock held\n"); + return -EINVAL; + } + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if (copy_from_user( &emit, (drm_i830_irq_emit_t *)arg, sizeof(emit) )) + return -EFAULT; + + result = i830_emit_irq( dev ); + + if ( copy_to_user( emit.irq_seq, &result, sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return -EFAULT; + } + + return 0; +} + + +/* Doesn't need the hardware lock. + */ +int i830_irq_wait( struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_irq_wait_t irqwait; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if (copy_from_user( &irqwait, (drm_i830_irq_wait_t *)arg, + sizeof(irqwait) )) + return -EFAULT; + + return i830_wait_irq( dev, irqwait.irq_seq ); +} + Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h Thu Feb 27 12:32:37 2003 @@ -1,67 +0,0 @@ -/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*- - * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __MGA_H__ -#define __MGA_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) mga_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -/* Driver customization: - */ -#define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 - -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - drm_mga_private_t *dev_priv = dev->dev_private; \ - return mga_do_wait_for_idle( dev_priv ); \ -} while (0) - -/* Buffer customization: - */ -#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_mga_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.12 Fri Aug 17 22:51:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c Thu Feb 27 12:32:37 2003 @@ -1,813 +0,0 @@ -/* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - * Rewritten by: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" - -#include <linux/interrupt.h> /* For task queue support */ -#include <linux/delay.h> - -#define MGA_DEFAULT_USEC_TIMEOUT 10000 -#define MGA_FREELIST_DEBUG 0 - - -/* ================================================================ - * Engine control - */ - -int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) -{ - u32 status = 0; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; - if ( status == MGA_ENDPRDMASTS ) { - MGA_WRITE8( MGA_CRTC_INDEX, 0 ); - return 0; - } - udelay( 1 ); - } - -#if MGA_DMA_DEBUG - DRM_ERROR( "failed!\n" ); - DRM_INFO( " status=0x%08x\n", status ); -#endif - return -EBUSY; -} - -int mga_do_dma_idle( drm_mga_private_t *dev_priv ) -{ - u32 status = 0; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK; - if ( status == MGA_ENDPRDMASTS ) return 0; - udelay( 1 ); - } - -#if MGA_DMA_DEBUG - DRM_ERROR( "failed! status=0x%08x\n", status ); -#endif - return -EBUSY; -} - -int mga_do_dma_reset( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* The primary DMA stream should look like new right about now. - */ - primary->tail = 0; - primary->space = primary->size; - primary->last_flush = 0; - - sarea_priv->last_wrap = 0; - - /* FIXME: Reset counters, buffer ages etc... - */ - - /* FIXME: What else do we need to reinitialize? WARP stuff? - */ - - return 0; -} - -int mga_do_engine_reset( drm_mga_private_t *dev_priv ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* Okay, so we've completely screwed up and locked the engine. - * How about we clean up after ourselves? - */ - MGA_WRITE( MGA_RST, MGA_SOFTRESET ); - udelay( 15 ); /* Wait at least 10 usecs */ - MGA_WRITE( MGA_RST, 0 ); - - /* Initialize the registers that get clobbered by the soft - * reset. Many of the core register values survive a reset, - * but the drawing registers are basically all gone. - * - * 3D clients should probably die after calling this. The X - * server should reset the engine state to known values. - */ -#if 0 - MGA_WRITE( MGA_PRIMPTR, - virt_to_bus((void *)dev_priv->prim.status_page) | - MGA_PRIMPTREN0 | - MGA_PRIMPTREN1 ); -#endif - - MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); - MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); - - /* The primary DMA stream should look like new right about now. - */ - mga_do_dma_reset( dev_priv ); - - /* This bad boy will never fail. - */ - return 0; -} - - -/* ================================================================ - * Primary DMA stream - */ - -void mga_do_dma_flush( drm_mga_private_t *dev_priv ) -{ - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - u32 head, tail; - DMA_LOCALS; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - if ( primary->tail == primary->last_flush ) { - DRM_DEBUG( " bailing out...\n" ); - return; - } - - tail = primary->tail + dev_priv->primary->offset; - - /* We need to pad the stream between flushes, as the card - * actually (partially?) reads the first of these commands. - * See page 4-16 in the G400 manual, middle of the page or so. - */ - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); - - primary->last_flush = primary->tail; - - head = MGA_READ( MGA_PRIMADDRESS ); - - if ( head <= tail ) { - primary->space = primary->size - primary->tail; - } else { - primary->space = head - tail; - } - - DRM_DEBUG( " head = 0x%06lx\n", head - dev_priv->primary->offset ); - DRM_DEBUG( " tail = 0x%06lx\n", tail - dev_priv->primary->offset ); - DRM_DEBUG( " space = 0x%06x\n", primary->space ); - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); - - DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); -} - -void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) -{ - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - u32 head, tail; - DMA_LOCALS; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - BEGIN_DMA_WRAP(); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); - - tail = primary->tail + dev_priv->primary->offset; - - primary->tail = 0; - primary->last_flush = 0; - primary->last_wrap++; - - head = MGA_READ( MGA_PRIMADDRESS ); - - if ( head == dev_priv->primary->offset ) { - primary->space = primary->size; - } else { - primary->space = head - dev_priv->primary->offset; - } - - DRM_DEBUG( " head = 0x%06lx\n", - head - dev_priv->primary->offset ); - DRM_DEBUG( " tail = 0x%06x\n", primary->tail ); - DRM_DEBUG( " wrap = %d\n", primary->last_wrap ); - DRM_DEBUG( " space = 0x%06x\n", primary->space ); - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); - - set_bit( 0, &primary->wrapped ); - DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); -} - -void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) -{ - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - u32 head = dev_priv->primary->offset; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - sarea_priv->last_wrap++; - DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); - - clear_bit( 0, &primary->wrapped ); - DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); -} - - -/* ================================================================ - * Freelist management - */ - -#define MGA_BUFFER_USED ~0 -#define MGA_BUFFER_FREE 0 - -#if MGA_FREELIST_DEBUG -static void mga_freelist_print( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_freelist_t *entry; - - DRM_INFO( "\n" ); - DRM_INFO( "current dispatch: last=0x%x done=0x%x\n", - dev_priv->sarea_priv->last_dispatch, - (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) - - dev_priv->primary->offset) ); - DRM_INFO( "current freelist:\n" ); - - for ( entry = dev_priv->head->next ; entry ; entry = entry->next ) { - DRM_INFO( " %p idx=%2d age=0x%x 0x%06lx\n", - entry, entry->buf->idx, entry->age.head, - entry->age.head - dev_priv->primary->offset ); - } - DRM_INFO( "\n" ); -} -#endif - -static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv ) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_freelist_t *entry; - int i; - DRM_DEBUG( "%s: count=%d\n", - __FUNCTION__, dma->buf_count ); - - dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER ); - if ( dev_priv->head == NULL ) - return -ENOMEM; - - memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) ); - SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 ); - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - - entry = DRM(alloc)( sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER ); - if ( entry == NULL ) - return -ENOMEM; - - memset( entry, 0, sizeof(drm_mga_freelist_t) ); - - entry->next = dev_priv->head->next; - entry->prev = dev_priv->head; - SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); - entry->buf = buf; - - if ( dev_priv->head->next != NULL ) - dev_priv->head->next->prev = entry; - if ( entry->next == NULL ) - dev_priv->tail = entry; - - buf_priv->list_entry = entry; - buf_priv->discard = 0; - buf_priv->dispatched = 0; - - dev_priv->head->next = entry; - } - - return 0; -} - -static void mga_freelist_cleanup( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_freelist_t *entry; - drm_mga_freelist_t *next; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - entry = dev_priv->head; - while ( entry ) { - next = entry->next; - DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); - entry = next; - } - - dev_priv->head = dev_priv->tail = NULL; -} - -#if 0 -/* FIXME: Still needed? - */ -static void mga_freelist_reset( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - int i; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - SET_AGE( &buf_priv->list_entry->age, - MGA_BUFFER_FREE, 0 ); - } -} -#endif - -static drm_buf_t *mga_freelist_get( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_freelist_t *next; - drm_mga_freelist_t *prev; - drm_mga_freelist_t *tail = dev_priv->tail; - u32 head, wrap; - DRM_DEBUG( "%s:\n", __FUNCTION__ ); - - head = MGA_READ( MGA_PRIMADDRESS ); - wrap = dev_priv->sarea_priv->last_wrap; - - DRM_DEBUG( " tail=0x%06lx %d\n", - tail->age.head ? - tail->age.head - dev_priv->primary->offset : 0, - tail->age.wrap ); - DRM_DEBUG( " head=0x%06lx %d\n", - head - dev_priv->primary->offset, wrap ); - - if ( TEST_AGE( &tail->age, head, wrap ) ) { - prev = dev_priv->tail->prev; - next = dev_priv->tail; - prev->next = NULL; - next->prev = next->next = NULL; - dev_priv->tail = prev; - SET_AGE( &next->age, MGA_BUFFER_USED, 0 ); - return next->buf; - } - - DRM_DEBUG( "returning NULL!\n" ); - return NULL; -} - -int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_freelist_t *head, *entry, *prev; - - DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n", - __FUNCTION__, - buf_priv->list_entry->age.head - - dev_priv->primary->offset, - buf_priv->list_entry->age.wrap ); - - entry = buf_priv->list_entry; - head = dev_priv->head; - - if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { - SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); - prev = dev_priv->tail; - prev->next = entry; - entry->prev = prev; - entry->next = NULL; - } else { - prev = head->next; - head->next = entry; - prev->prev = entry; - entry->prev = head; - entry->next = prev; - } - - return 0; -} - - -/* ================================================================ - * DMA initialization, cleanup - */ - -static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) -{ - drm_mga_private_t *dev_priv; - struct list_head *list; - int ret; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); - if ( !dev_priv ) - return -ENOMEM; - - memset( dev_priv, 0, sizeof(drm_mga_private_t) ); - - dev_priv->chipset = init->chipset; - - dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; - - if ( init->sgram ) { - dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK; - } else { - dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR; - } - dev_priv->maccess = init->maccess; - - dev_priv->fb_cpp = init->fb_cpp; - dev_priv->front_offset = init->front_offset; - dev_priv->front_pitch = init->front_pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->back_pitch = init->back_pitch; - - dev_priv->depth_cpp = init->depth_cpp; - dev_priv->depth_offset = init->depth_offset; - dev_priv->depth_pitch = init->depth_pitch; - - /* FIXME: Need to support AGP textures... - */ - dev_priv->texture_offset = init->texture_offset[0]; - dev_priv->texture_size = init->texture_size[0]; - - list_for_each( list, &dev->maplist->head ) { - drm_map_list_t *entry = (drm_map_list_t *)list; - if ( entry->map && - entry->map->type == _DRM_SHM && - (entry->map->flags & _DRM_CONTAINS_LOCK) ) { - dev_priv->sarea = entry->map; - break; - } - } - if(!dev_priv->sarea) { - DRM_ERROR( "failed to find sarea!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR( "failed to find framebuffer!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - if(!dev_priv->mmio) { - DRM_ERROR( "failed to find mmio region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->status, init->status_offset ); - if(!dev_priv->status) { - DRM_ERROR( "failed to find status page!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - - DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); - if(!dev_priv->warp) { - DRM_ERROR( "failed to find warp microcode region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); - if(!dev_priv->primary) { - DRM_ERROR( "failed to find primary dma region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); - if(!dev_priv->buffers) { - DRM_ERROR( "failed to find dma buffer region!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -EINVAL; - } - - dev_priv->sarea_priv = - (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle + - init->sarea_priv_offset); - - DRM_IOREMAP( dev_priv->warp ); - DRM_IOREMAP( dev_priv->primary ); - DRM_IOREMAP( dev_priv->buffers ); - - if(!dev_priv->warp->handle || - !dev_priv->primary->handle || - !dev_priv->buffers->handle ) { - DRM_ERROR( "failed to ioremap agp regions!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -ENOMEM; - } - - ret = mga_warp_install_microcode( dev_priv ); - if ( ret < 0 ) { - DRM_ERROR( "failed to install WARP ucode!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return ret; - } - - ret = mga_warp_init( dev_priv ); - if ( ret < 0 ) { - DRM_ERROR( "failed to init WARP engine!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return ret; - } - - dev_priv->prim.status = (u32 *)dev_priv->status->handle; - - mga_do_wait_for_idle( dev_priv ); - - /* Init the primary DMA registers. - */ - MGA_WRITE( MGA_PRIMADDRESS, - dev_priv->primary->offset | MGA_DMA_GENERAL ); -#if 0 - MGA_WRITE( MGA_PRIMPTR, - virt_to_bus((void *)dev_priv->prim.status) | - MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */ - MGA_PRIMPTREN1 ); /* DWGSYNC */ -#endif - - dev_priv->prim.start = (u8 *)dev_priv->primary->handle; - dev_priv->prim.end = ((u8 *)dev_priv->primary->handle - + dev_priv->primary->size); - dev_priv->prim.size = dev_priv->primary->size; - - dev_priv->prim.tail = 0; - dev_priv->prim.space = dev_priv->prim.size; - dev_priv->prim.wrapped = 0; - - dev_priv->prim.last_flush = 0; - dev_priv->prim.last_wrap = 0; - - dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE; - - spin_lock_init( &dev_priv->prim.list_lock ); - - dev_priv->prim.status[0] = dev_priv->primary->offset; - dev_priv->prim.status[1] = 0; - - dev_priv->sarea_priv->last_wrap = 0; - dev_priv->sarea_priv->last_frame.head = 0; - dev_priv->sarea_priv->last_frame.wrap = 0; - - if ( mga_freelist_init( dev, dev_priv ) < 0 ) { - DRM_ERROR( "could not initialize freelist\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return -ENOMEM; - } - - /* Make dev_private visable to others. */ - dev->dev_private = (void *)dev_priv; - return 0; -} - -int mga_do_cleanup_dma( drm_device_t *dev ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev->dev_private ) { - drm_mga_private_t *dev_priv = dev->dev_private; - - DRM_IOREMAPFREE( dev_priv->warp ); - DRM_IOREMAPFREE( dev_priv->primary ); - DRM_IOREMAPFREE( dev_priv->buffers ); - - if ( dev_priv->head != NULL ) { - mga_freelist_cleanup( dev ); - } - - DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), - DRM_MEM_DRIVER ); - dev->dev_private = NULL; - } - - return 0; -} - -int mga_dma_init( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_init_t init; - - if ( copy_from_user( &init, (drm_mga_init_t *)arg, sizeof(init) ) ) - return -EFAULT; - - switch ( init.func ) { - case MGA_INIT_DMA: - return mga_do_init_dma( dev, &init ); - case MGA_CLEANUP_DMA: - return mga_do_cleanup_dma( dev ); - } - - return -EINVAL; -} - - -/* ================================================================ - * Primary DMA stream management - */ - -int mga_dma_flush( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_lock_t lock; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) - return -EFAULT; - - DRM_DEBUG( "%s: %s%s%s\n", - __FUNCTION__, - (lock.flags & _DRM_LOCK_FLUSH) ? "flush, " : "", - (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", - (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); - - WRAP_WAIT_WITH_RETURN( dev_priv ); - - if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { - mga_do_dma_flush( dev_priv ); - } - - if ( lock.flags & _DRM_LOCK_QUIESCENT ) { -#if MGA_DMA_DEBUG - int ret = mga_do_wait_for_idle( dev_priv ); - if ( ret < 0 ) - DRM_INFO( __FUNCTION__": -EBUSY\n" ); - return ret; -#else - return mga_do_wait_for_idle( dev_priv ); -#endif - } else { - return 0; - } -} - -int mga_dma_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - - LOCK_TEST_WITH_RETURN( dev ); - - return mga_do_dma_reset( dev_priv ); -} - - -/* ================================================================ - * DMA buffer management - */ - -static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d ) -{ - drm_buf_t *buf; - int i; - - for ( i = d->granted_count ; i < d->request_count ; i++ ) { - buf = mga_freelist_get( dev ); - if ( !buf ) return -EAGAIN; - - buf->pid = current->pid; - - if ( copy_to_user( &d->request_indices[i], - &buf->idx, sizeof(buf->idx) ) ) - return -EFAULT; - if ( copy_to_user( &d->request_sizes[i], - &buf->total, sizeof(buf->total) ) ) - return -EFAULT; - - d->granted_count++; - } - return 0; -} - -int mga_dma_buffers( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_dma_t d; - int ret = 0; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) ) - return -EFAULT; - - /* Please don't send us buffers. - */ - if ( d.send_count != 0 ) { - DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", - current->pid, d.send_count ); - return -EINVAL; - } - - /* We'll send you buffers. - */ - if ( d.request_count < 0 || d.request_count > dma->buf_count ) { - DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", - current->pid, d.request_count, dma->buf_count ); - return -EINVAL; - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - d.granted_count = 0; - - if ( d.request_count ) { - ret = mga_dma_get_buffers( dev, &d ); - } - - if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) ) - return -EFAULT; - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h:1.7 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h Thu Feb 27 12:32:37 2003 @@ -1,310 +0,0 @@ -/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- - * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - * Rewritten by: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __MGA_DRM_H__ -#define __MGA_DRM_H__ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (mga_sarea.h) - */ -#ifndef __MGA_SAREA_DEFINES__ -#define __MGA_SAREA_DEFINES__ - -/* WARP pipe flags - */ -#define MGA_F 0x1 /* fog */ -#define MGA_A 0x2 /* alpha */ -#define MGA_S 0x4 /* specular */ -#define MGA_T2 0x8 /* multitexture */ - -#define MGA_WARP_TGZ 0 -#define MGA_WARP_TGZF (MGA_F) -#define MGA_WARP_TGZA (MGA_A) -#define MGA_WARP_TGZAF (MGA_F|MGA_A) -#define MGA_WARP_TGZS (MGA_S) -#define MGA_WARP_TGZSF (MGA_S|MGA_F) -#define MGA_WARP_TGZSA (MGA_S|MGA_A) -#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) -#define MGA_WARP_T2GZ (MGA_T2) -#define MGA_WARP_T2GZF (MGA_T2|MGA_F) -#define MGA_WARP_T2GZA (MGA_T2|MGA_A) -#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) -#define MGA_WARP_T2GZS (MGA_T2|MGA_S) -#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) -#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) -#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) - -#define MGA_MAX_G200_PIPES 8 /* no multitex */ -#define MGA_MAX_G400_PIPES 16 -#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES -#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ - -#define MGA_CARD_TYPE_G200 1 -#define MGA_CARD_TYPE_G400 2 - - -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - -/* What needs to be changed for the current vertex dma buffer? - */ -#define MGA_UPLOAD_CONTEXT 0x1 -#define MGA_UPLOAD_TEX0 0x2 -#define MGA_UPLOAD_TEX1 0x4 -#define MGA_UPLOAD_PIPE 0x8 -#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ -#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ -#define MGA_UPLOAD_2D 0x40 -#define MGA_WAIT_AGE 0x80 /* handled client-side */ -#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ -#if 0 -#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock - quiescent */ -#endif - -/* 32 buffers of 64k each, total 2 meg. - */ -#define MGA_BUFFER_SIZE (1 << 16) -#define MGA_NUM_BUFFERS 128 - -/* Keep these small for testing. - */ -#define MGA_NR_SAREA_CLIPRECTS 8 - -/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 - * regions, subject to a minimum region size of (1<<16) == 64k. - * - * Clients may subdivide regions internally, but when sharing between - * clients, the region size is the minimum granularity. - */ - -#define MGA_CARD_HEAP 0 -#define MGA_AGP_HEAP 1 -#define MGA_NR_TEX_HEAPS 2 -#define MGA_NR_TEX_REGIONS 16 -#define MGA_LOG_MIN_TEX_REGION_SIZE 16 - -#endif /* __MGA_SAREA_DEFINES__ */ - - -/* Setup registers for 3D context - */ -typedef struct { - unsigned int dstorg; - unsigned int maccess; - unsigned int plnwt; - unsigned int dwgctl; - unsigned int alphactrl; - unsigned int fogcolor; - unsigned int wflag; - unsigned int tdualstage0; - unsigned int tdualstage1; - unsigned int fcol; - unsigned int stencil; - unsigned int stencilctl; -} drm_mga_context_regs_t; - -/* Setup registers for 2D, X server - */ -typedef struct { - unsigned int pitch; -} drm_mga_server_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int texctl; - unsigned int texctl2; - unsigned int texfilter; - unsigned int texbordercol; - unsigned int texorg; - unsigned int texwidth; - unsigned int texheight; - unsigned int texorg1; - unsigned int texorg2; - unsigned int texorg3; - unsigned int texorg4; -} drm_mga_texture_regs_t; - -/* General aging mechanism - */ -typedef struct { - unsigned int head; /* Position of head pointer */ - unsigned int wrap; /* Primary DMA wrap count */ -} drm_mga_age_t; - -typedef struct _drm_mga_sarea { - /* The channel for communication of state information to the kernel - * on firing a vertex dma buffer. - */ - drm_mga_context_regs_t context_state; - drm_mga_server_regs_t server_state; - drm_mga_texture_regs_t tex_state[2]; - unsigned int warp_pipe; - unsigned int dirty; - unsigned int vertsize; - - /* The current cliprects, or a subset thereof. - */ - drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Information about the most recently used 3d drawable. The - * client fills in the req_* fields, the server fills in the - * exported_ fields and puts the cliprects into boxes, above. - * - * The client clears the exported_drawable field before - * clobbering the boxes data. - */ - unsigned int req_drawable; /* the X drawable id */ - unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ - - unsigned int exported_drawable; - unsigned int exported_index; - unsigned int exported_stamp; - unsigned int exported_buffers; - unsigned int exported_nfront; - unsigned int exported_nback; - int exported_back_x, exported_front_x, exported_w; - int exported_back_y, exported_front_y, exported_h; - drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS]; - - /* Counters for aging textures and for client-side throttling. - */ - unsigned int status[4]; - unsigned int last_wrap; - - drm_mga_age_t last_frame; - unsigned int last_enqueue; /* last time a buffer was enqueued */ - unsigned int last_dispatch; /* age of the most recently dispatched buffer */ - unsigned int last_quiescent; /* */ - - /* LRU lists for texture memory in agp space and on the card. - */ - drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; - unsigned int texAge[MGA_NR_TEX_HEAPS]; - - /* Mechanism to validate card state. - */ - int ctxOwner; -} drm_mga_sarea_t; - - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmMga.h) - */ -typedef struct _drm_mga_warp_index { - int installed; - unsigned long phys_addr; - int size; -} drm_mga_warp_index_t; - -typedef struct drm_mga_init { - enum { - MGA_INIT_DMA = 0x01, - MGA_CLEANUP_DMA = 0x02 - } func; - - unsigned long sarea_priv_offset; - - int chipset; - int sgram; - - unsigned int maccess; - - unsigned int fb_cpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - - unsigned int depth_cpp; - unsigned int depth_offset, depth_pitch; - - unsigned int texture_offset[MGA_NR_TEX_HEAPS]; - unsigned int texture_size[MGA_NR_TEX_HEAPS]; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long status_offset; - unsigned long warp_offset; - unsigned long primary_offset; - unsigned long buffers_offset; -} drm_mga_init_t; - -typedef struct drm_mga_fullscreen { - enum { - MGA_INIT_FULLSCREEN = 0x01, - MGA_CLEANUP_FULLSCREEN = 0x02 - } func; -} drm_mga_fullscreen_t; - -typedef struct drm_mga_clear { - unsigned int flags; - unsigned int clear_color; - unsigned int clear_depth; - unsigned int color_mask; - unsigned int depth_mask; -} drm_mga_clear_t; - -typedef struct drm_mga_vertex { - int idx; /* buffer to queue */ - int used; /* bytes in use */ - int discard; /* client finished with buffer? */ -} drm_mga_vertex_t; - -typedef struct drm_mga_indices { - int idx; /* buffer to queue */ - unsigned int start; - unsigned int end; - int discard; /* client finished with buffer? */ -} drm_mga_indices_t; - -typedef struct drm_mga_iload { - int idx; - unsigned int dstorg; - unsigned int length; -} drm_mga_iload_t; - -typedef struct _drm_mga_blit { - unsigned int planemask; - unsigned int srcorg; - unsigned int dstorg; - int src_pitch, dst_pitch; - int delta_sx, delta_sy; - int delta_dx, delta_dy; - int height, ydir; /* flip image vertically */ - int source_pitch, dest_pitch; -} drm_mga_blit_t; - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.12 Fri Aug 17 22:51:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c Wed Oct 30 07:52:36 2002 @@ -32,37 +32,9 @@ #include <linux/config.h> #include "mga.h" #include "drmP.h" +#include "drm.h" +#include "mga_drm.h" #include "mga_drv.h" - -#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - -#define DRIVER_NAME "mga" -#define DRIVER_DESC "Matrox G200/G400" -#define DRIVER_DATE "20010321" - -#define DRIVER_MAJOR 3 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 2 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, - - -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY - - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" @@ -70,27 +42,6 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init mga_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", mga_options ); -#endif - - #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.11 Fri Aug 17 22:51:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h Thu Feb 27 12:32:37 2003 @@ -1,643 +0,0 @@ -/* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __MGA_DRV_H__ -#define __MGA_DRV_H__ - -typedef struct drm_mga_primary_buffer { - u8 *start; - u8 *end; - int size; - - u32 tail; - int space; - volatile int wrapped; - - volatile u32 *status; - - u32 last_flush; - u32 last_wrap; - - u32 high_mark; - - spinlock_t list_lock; -} drm_mga_primary_buffer_t; - -typedef struct drm_mga_freelist { - struct drm_mga_freelist *next; - struct drm_mga_freelist *prev; - drm_mga_age_t age; - drm_buf_t *buf; -} drm_mga_freelist_t; - -typedef struct { - drm_mga_freelist_t *list_entry; - int discard; - int dispatched; -} drm_mga_buf_priv_t; - -typedef struct drm_mga_private { - drm_mga_primary_buffer_t prim; - drm_mga_sarea_t *sarea_priv; - - drm_mga_freelist_t *head; - drm_mga_freelist_t *tail; - - unsigned int warp_pipe; - unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES]; - - int chipset; - int usec_timeout; - - u32 clear_cmd; - u32 maccess; - - unsigned int fb_cpp; - unsigned int front_offset; - unsigned int front_pitch; - unsigned int back_offset; - unsigned int back_pitch; - - unsigned int depth_cpp; - unsigned int depth_offset; - unsigned int depth_pitch; - - unsigned int texture_offset; - unsigned int texture_size; - - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *mmio; - drm_map_t *status; - drm_map_t *warp; - drm_map_t *primary; - drm_map_t *buffers; - drm_map_t *agp_textures; -} drm_mga_private_t; - - /* mga_dma.c */ -extern int mga_dma_init( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_flush( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_buffers( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - -extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); -extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); -extern int mga_do_dma_reset( drm_mga_private_t *dev_priv ); -extern int mga_do_engine_reset( drm_mga_private_t *dev_priv ); -extern int mga_do_cleanup_dma( drm_device_t *dev ); - -extern void mga_do_dma_flush( drm_mga_private_t *dev_priv ); -extern void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ); -extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ); - -extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); - - /* mga_state.c */ -extern int mga_dma_clear( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_swap( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_vertex( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_indices( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_iload( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int mga_dma_blit( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - - /* mga_warp.c */ -extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); -extern int mga_warp_init( drm_mga_private_t *dev_priv ); - -#define mga_flush_write_combine() mb() - - -#define MGA_BASE( reg ) ((unsigned long)(dev_priv->mmio->handle)) -#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) - -#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) -#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) - -#ifdef __alpha__ -#define MGA_READ( reg ) (_MGA_READ((u32 *)MGA_ADDR(reg))) -#define MGA_WRITE( reg, val ) do { wmb(); MGA_DEREF( reg ) = val; } while (0) -#define MGA_WRITE8( reg, val ) do { wmb(); MGA_DEREF8( reg ) = val; } while (0) - -static inline u32 _MGA_READ(u32 *addr) -{ - mb(); - return *(volatile u32 *)addr; -} - -#else -#define MGA_READ( reg ) MGA_DEREF( reg ) -#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) -#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0) -#endif - -#define DWGREG0 0x1c00 -#define DWGREG0_END 0x1dff -#define DWGREG1 0x2c00 -#define DWGREG1_END 0x2dff - -#define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) -#define DMAREG0(r) (u8)((r - DWGREG0) >> 2) -#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) -#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r)) - - - -/* ================================================================ - * Helper macross... - */ - -#define MGA_EMIT_STATE( dev_priv, dirty ) \ -do { \ - if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ - if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \ - mga_g400_emit_state( dev_priv ); \ - } else { \ - mga_g200_emit_state( dev_priv ); \ - } \ - } \ -} while (0) - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != current->pid ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - return -EINVAL; \ - } \ -} while (0) - -#define WRAP_TEST_WITH_RETURN( dev_priv ) \ -do { \ - if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ - if ( mga_is_idle( dev_priv ) ) { \ - mga_do_dma_wrap_end( dev_priv ); \ - } else if ( dev_priv->prim.space < \ - dev_priv->prim.high_mark ) { \ - if ( MGA_DMA_DEBUG ) \ - DRM_INFO( __FUNCTION__": wrap...\n" ); \ - return -EBUSY; \ - } \ - } \ -} while (0) - -#define WRAP_WAIT_WITH_RETURN( dev_priv ) \ -do { \ - if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ - if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ - if ( MGA_DMA_DEBUG ) \ - DRM_INFO( __FUNCTION__": wrap...\n" ); \ - return -EBUSY; \ - } \ - mga_do_dma_wrap_end( dev_priv ); \ - } \ -} while (0) - - -/* ================================================================ - * Primary DMA command stream - */ - -#define MGA_VERBOSE 0 - -#define DMA_LOCALS unsigned int write; volatile u8 *prim; - -#define DMA_BLOCK_SIZE (5 * sizeof(u32)) - -#define BEGIN_DMA( n ) \ -do { \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \ - (n), __FUNCTION__ ); \ - DRM_INFO( " space=0x%x req=0x%x\n", \ - dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ - } \ - prim = dev_priv->prim.start; \ - write = dev_priv->prim.tail; \ -} while (0) - -#define BEGIN_DMA_WRAP() \ -do { \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \ - DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \ - } \ - prim = dev_priv->prim.start; \ - write = dev_priv->prim.tail; \ -} while (0) - -#define ADVANCE_DMA() \ -do { \ - dev_priv->prim.tail = write; \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \ - write, dev_priv->prim.space ); \ - } \ -} while (0) - -#define FLUSH_DMA() \ -do { \ - if ( 0 ) { \ - DRM_INFO( __FUNCTION__ ":\n" ); \ - DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ - dev_priv->prim.tail, \ - MGA_READ( MGA_PRIMADDRESS ) - \ - dev_priv->primary->offset ); \ - } \ - if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \ - if ( dev_priv->prim.space < \ - dev_priv->prim.high_mark ) { \ - mga_do_dma_wrap_start( dev_priv ); \ - } else { \ - mga_do_dma_flush( dev_priv ); \ - } \ - } \ -} while (0) - -/* Never use this, always use DMA_BLOCK(...) for primary DMA output. - */ -#define DMA_WRITE( offset, val ) \ -do { \ - if ( MGA_VERBOSE ) { \ - DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \ - (u32)(val), write + (offset) * sizeof(u32) ); \ - } \ - *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ -} while (0) - -#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 ) \ -do { \ - DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) | \ - (DMAREG( reg1 ) << 8) | \ - (DMAREG( reg2 ) << 16) | \ - (DMAREG( reg3 ) << 24)) ); \ - DMA_WRITE( 1, val0 ); \ - DMA_WRITE( 2, val1 ); \ - DMA_WRITE( 3, val2 ); \ - DMA_WRITE( 4, val3 ); \ - write += DMA_BLOCK_SIZE; \ -} while (0) - - -/* Buffer aging via primary DMA stream head pointer. - */ - -#define SET_AGE( age, h, w ) \ -do { \ - (age)->head = h; \ - (age)->wrap = w; \ -} while (0) - -#define TEST_AGE( age, h, w ) ( (age)->wrap < w || \ - ( (age)->wrap == w && \ - (age)->head < h ) ) - -#define AGE_BUFFER( buf_priv ) \ -do { \ - drm_mga_freelist_t *entry = (buf_priv)->list_entry; \ - if ( (buf_priv)->dispatched ) { \ - entry->age.head = (dev_priv->prim.tail + \ - dev_priv->primary->offset); \ - entry->age.wrap = dev_priv->sarea_priv->last_wrap; \ - } else { \ - entry->age.head = 0; \ - entry->age.wrap = 0; \ - } \ -} while (0) - - -#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \ - MGA_DWGENGSTS | \ - MGA_ENDPRDMASTS) -#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \ - MGA_ENDPRDMASTS) - -#define MGA_DMA_DEBUG 0 - - - -/* A reduced set of the mga registers. - */ -#define MGA_CRTC_INDEX 0x1fd4 - -#define MGA_ALPHACTRL 0x2c7c -#define MGA_AR0 0x1c60 -#define MGA_AR1 0x1c64 -#define MGA_AR2 0x1c68 -#define MGA_AR3 0x1c6c -#define MGA_AR4 0x1c70 -#define MGA_AR5 0x1c74 -#define MGA_AR6 0x1c78 - -#define MGA_CXBNDRY 0x1c80 -#define MGA_CXLEFT 0x1ca0 -#define MGA_CXRIGHT 0x1ca4 - -#define MGA_DMAPAD 0x1c54 -#define MGA_DSTORG 0x2cb8 -#define MGA_DWGCTL 0x1c00 -# define MGA_OPCOD_MASK (15 << 0) -# define MGA_OPCOD_TRAP (4 << 0) -# define MGA_OPCOD_TEXTURE_TRAP (6 << 0) -# define MGA_OPCOD_BITBLT (8 << 0) -# define MGA_OPCOD_ILOAD (9 << 0) -# define MGA_ATYPE_MASK (7 << 4) -# define MGA_ATYPE_RPL (0 << 4) -# define MGA_ATYPE_RSTR (1 << 4) -# define MGA_ATYPE_ZI (3 << 4) -# define MGA_ATYPE_BLK (4 << 4) -# define MGA_ATYPE_I (7 << 4) -# define MGA_LINEAR (1 << 7) -# define MGA_ZMODE_MASK (7 << 8) -# define MGA_ZMODE_NOZCMP (0 << 8) -# define MGA_ZMODE_ZE (2 << 8) -# define MGA_ZMODE_ZNE (3 << 8) -# define MGA_ZMODE_ZLT (4 << 8) -# define MGA_ZMODE_ZLTE (5 << 8) -# define MGA_ZMODE_ZGT (6 << 8) -# define MGA_ZMODE_ZGTE (7 << 8) -# define MGA_SOLID (1 << 11) -# define MGA_ARZERO (1 << 12) -# define MGA_SGNZERO (1 << 13) -# define MGA_SHIFTZERO (1 << 14) -# define MGA_BOP_MASK (15 << 16) -# define MGA_BOP_ZERO (0 << 16) -# define MGA_BOP_DST (10 << 16) -# define MGA_BOP_SRC (12 << 16) -# define MGA_BOP_ONE (15 << 16) -# define MGA_TRANS_SHIFT 20 -# define MGA_TRANS_MASK (15 << 20) -# define MGA_BLTMOD_MASK (15 << 25) -# define MGA_BLTMOD_BMONOLEF (0 << 25) -# define MGA_BLTMOD_BMONOWF (4 << 25) -# define MGA_BLTMOD_PLAN (1 << 25) -# define MGA_BLTMOD_BFCOL (2 << 25) -# define MGA_BLTMOD_BU32BGR (3 << 25) -# define MGA_BLTMOD_BU32RGB (7 << 25) -# define MGA_BLTMOD_BU24BGR (11 << 25) -# define MGA_BLTMOD_BU24RGB (15 << 25) -# define MGA_PATTERN (1 << 29) -# define MGA_TRANSC (1 << 30) -# define MGA_CLIPDIS (1 << 31) -#define MGA_DWGSYNC 0x2c4c - -#define MGA_FCOL 0x1c24 -#define MGA_FIFOSTATUS 0x1e10 -#define MGA_FOGCOL 0x1cf4 -#define MGA_FXBNDRY 0x1c84 -#define MGA_FXLEFT 0x1ca8 -#define MGA_FXRIGHT 0x1cac - -#define MGA_ICLEAR 0x1e18 -# define MGA_SOFTRAPICLR (1 << 0) -#define MGA_IEN 0x1e1c -# define MGA_SOFTRAPIEN (1 << 0) - -#define MGA_LEN 0x1c5c - -#define MGA_MACCESS 0x1c04 - -#define MGA_PITCH 0x1c8c -#define MGA_PLNWT 0x1c1c -#define MGA_PRIMADDRESS 0x1e58 -# define MGA_DMA_GENERAL (0 << 0) -# define MGA_DMA_BLIT (1 << 0) -# define MGA_DMA_VECTOR (2 << 0) -# define MGA_DMA_VERTEX (3 << 0) -#define MGA_PRIMEND 0x1e5c -# define MGA_PRIMNOSTART (1 << 0) -# define MGA_PAGPXFER (1 << 1) -#define MGA_PRIMPTR 0x1e50 -# define MGA_PRIMPTREN0 (1 << 0) -# define MGA_PRIMPTREN1 (1 << 1) - -#define MGA_RST 0x1e40 -# define MGA_SOFTRESET (1 << 0) -# define MGA_SOFTEXTRST (1 << 1) - -#define MGA_SECADDRESS 0x2c40 -#define MGA_SECEND 0x2c44 -#define MGA_SETUPADDRESS 0x2cd0 -#define MGA_SETUPEND 0x2cd4 -#define MGA_SGN 0x1c58 -#define MGA_SOFTRAP 0x2c48 -#define MGA_SRCORG 0x2cb4 -# define MGA_SRMMAP_MASK (1 << 0) -# define MGA_SRCMAP_FB (0 << 0) -# define MGA_SRCMAP_SYSMEM (1 << 0) -# define MGA_SRCACC_MASK (1 << 1) -# define MGA_SRCACC_PCI (0 << 1) -# define MGA_SRCACC_AGP (1 << 1) -#define MGA_STATUS 0x1e14 -# define MGA_SOFTRAPEN (1 << 0) -# define MGA_DWGENGSTS (1 << 16) -# define MGA_ENDPRDMASTS (1 << 17) -#define MGA_STENCIL 0x2cc8 -#define MGA_STENCILCTL 0x2ccc - -#define MGA_TDUALSTAGE0 0x2cf8 -#define MGA_TDUALSTAGE1 0x2cfc -#define MGA_TEXBORDERCOL 0x2c5c -#define MGA_TEXCTL 0x2c30 -#define MGA_TEXCTL2 0x2c3c -# define MGA_DUALTEX (1 << 7) -# define MGA_G400_TC2_MAGIC (1 << 15) -# define MGA_MAP1_ENABLE (1 << 31) -#define MGA_TEXFILTER 0x2c58 -#define MGA_TEXHEIGHT 0x2c2c -#define MGA_TEXORG 0x2c24 -# define MGA_TEXORGMAP_MASK (1 << 0) -# define MGA_TEXORGMAP_FB (0 << 0) -# define MGA_TEXORGMAP_SYSMEM (1 << 0) -# define MGA_TEXORGACC_MASK (1 << 1) -# define MGA_TEXORGACC_PCI (0 << 1) -# define MGA_TEXORGACC_AGP (1 << 1) -#define MGA_TEXORG1 0x2ca4 -#define MGA_TEXORG2 0x2ca8 -#define MGA_TEXORG3 0x2cac -#define MGA_TEXORG4 0x2cb0 -#define MGA_TEXTRANS 0x2c34 -#define MGA_TEXTRANSHIGH 0x2c38 -#define MGA_TEXWIDTH 0x2c28 - -#define MGA_WACCEPTSEQ 0x1dd4 -#define MGA_WCODEADDR 0x1e6c -#define MGA_WFLAG 0x1dc4 -#define MGA_WFLAG1 0x1de0 -#define MGA_WFLAGNB 0x1e64 -#define MGA_WFLAGNB1 0x1e08 -#define MGA_WGETMSB 0x1dc8 -#define MGA_WIADDR 0x1dc0 -#define MGA_WIADDR2 0x1dd8 -# define MGA_WMODE_SUSPEND (0 << 0) -# define MGA_WMODE_RESUME (1 << 0) -# define MGA_WMODE_JUMP (2 << 0) -# define MGA_WMODE_START (3 << 0) -# define MGA_WAGP_ENABLE (1 << 2) -#define MGA_WMISC 0x1e70 -# define MGA_WUCODECACHE_ENABLE (1 << 0) -# define MGA_WMASTER_ENABLE (1 << 1) -# define MGA_WCACHEFLUSH_ENABLE (1 << 3) -#define MGA_WVRTXSZ 0x1dcc - -#define MGA_YBOT 0x1c9c -#define MGA_YDST 0x1c90 -#define MGA_YDSTLEN 0x1c88 -#define MGA_YDSTORG 0x1c94 -#define MGA_YTOP 0x1c98 - -#define MGA_ZORG 0x1c0c - -/* This finishes the current batch of commands - */ -#define MGA_EXEC 0x0100 - -/* Warp registers - */ -#define MGA_WR0 0x2d00 -#define MGA_WR1 0x2d04 -#define MGA_WR2 0x2d08 -#define MGA_WR3 0x2d0c -#define MGA_WR4 0x2d10 -#define MGA_WR5 0x2d14 -#define MGA_WR6 0x2d18 -#define MGA_WR7 0x2d1c -#define MGA_WR8 0x2d20 -#define MGA_WR9 0x2d24 -#define MGA_WR10 0x2d28 -#define MGA_WR11 0x2d2c -#define MGA_WR12 0x2d30 -#define MGA_WR13 0x2d34 -#define MGA_WR14 0x2d38 -#define MGA_WR15 0x2d3c -#define MGA_WR16 0x2d40 -#define MGA_WR17 0x2d44 -#define MGA_WR18 0x2d48 -#define MGA_WR19 0x2d4c -#define MGA_WR20 0x2d50 -#define MGA_WR21 0x2d54 -#define MGA_WR22 0x2d58 -#define MGA_WR23 0x2d5c -#define MGA_WR24 0x2d60 -#define MGA_WR25 0x2d64 -#define MGA_WR26 0x2d68 -#define MGA_WR27 0x2d6c -#define MGA_WR28 0x2d70 -#define MGA_WR29 0x2d74 -#define MGA_WR30 0x2d78 -#define MGA_WR31 0x2d7c -#define MGA_WR32 0x2d80 -#define MGA_WR33 0x2d84 -#define MGA_WR34 0x2d88 -#define MGA_WR35 0x2d8c -#define MGA_WR36 0x2d90 -#define MGA_WR37 0x2d94 -#define MGA_WR38 0x2d98 -#define MGA_WR39 0x2d9c -#define MGA_WR40 0x2da0 -#define MGA_WR41 0x2da4 -#define MGA_WR42 0x2da8 -#define MGA_WR43 0x2dac -#define MGA_WR44 0x2db0 -#define MGA_WR45 0x2db4 -#define MGA_WR46 0x2db8 -#define MGA_WR47 0x2dbc -#define MGA_WR48 0x2dc0 -#define MGA_WR49 0x2dc4 -#define MGA_WR50 0x2dc8 -#define MGA_WR51 0x2dcc -#define MGA_WR52 0x2dd0 -#define MGA_WR53 0x2dd4 -#define MGA_WR54 0x2dd8 -#define MGA_WR55 0x2ddc -#define MGA_WR56 0x2de0 -#define MGA_WR57 0x2de4 -#define MGA_WR58 0x2de8 -#define MGA_WR59 0x2dec -#define MGA_WR60 0x2df0 -#define MGA_WR61 0x2df4 -#define MGA_WR62 0x2df8 -#define MGA_WR63 0x2dfc -# define MGA_G400_WR_MAGIC (1 << 6) -# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */ - - -#define MGA_ILOAD_ALIGN 64 -#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1) - -#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \ - MGA_ATYPE_I | \ - MGA_ZMODE_NOZCMP | \ - MGA_ARZERO | \ - MGA_SGNZERO | \ - MGA_BOP_SRC | \ - (15 << MGA_TRANS_SHIFT)) - -#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \ - MGA_ZMODE_NOZCMP | \ - MGA_SOLID | \ - MGA_ARZERO | \ - MGA_SGNZERO | \ - MGA_SHIFTZERO | \ - MGA_BOP_SRC | \ - (0 << MGA_TRANS_SHIFT) | \ - MGA_BLTMOD_BMONOLEF | \ - MGA_TRANSC | \ - MGA_CLIPDIS) - -#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \ - MGA_ATYPE_RPL | \ - MGA_SGNZERO | \ - MGA_SHIFTZERO | \ - MGA_BOP_SRC | \ - (0 << MGA_TRANS_SHIFT) | \ - MGA_BLTMOD_BFCOL | \ - MGA_CLIPDIS) - -/* Simple idle test. - */ -static inline int mga_is_idle( drm_mga_private_t *dev_priv ) -{ - u32 status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; - return ( status == MGA_ENDPRDMASTS ); -} - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.12 Fri Aug 17 22:51:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c Thu Feb 27 12:32:37 2003 @@ -1,1087 +0,0 @@ -/* mga_state.c -- State support for MGA G200/G400 -*- linux-c -*- - * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> - * - * Rewritten by: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" -#include "drm.h" - - -/* ================================================================ - * DMA hardware state programming functions - */ - -static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, - drm_clip_rect_t *box ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - unsigned int pitch = dev_priv->front_pitch; - DMA_LOCALS; - - BEGIN_DMA( 2 ); - - /* Force reset of DWGCTL on G400 (eliminates clip disable bit). - */ - if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { - DMA_BLOCK( MGA_DWGCTL, ctx->dwgctl, - MGA_LEN + MGA_EXEC, 0x80000000, - MGA_DWGCTL, ctx->dwgctl, - MGA_LEN + MGA_EXEC, 0x80000000 ); - } - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_CXBNDRY, (box->x2 << 16) | box->x1, - MGA_YTOP, box->y1 * pitch, - MGA_YBOT, box->y2 * pitch ); - - ADVANCE_DMA(); -} - -static inline void mga_g200_emit_context( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - DMA_LOCALS; - - BEGIN_DMA( 3 ); - - DMA_BLOCK( MGA_DSTORG, ctx->dstorg, - MGA_MACCESS, ctx->maccess, - MGA_PLNWT, ctx->plnwt, - MGA_DWGCTL, ctx->dwgctl ); - - DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, - MGA_FOGCOL, ctx->fogcolor, - MGA_WFLAG, ctx->wflag, - MGA_ZORG, dev_priv->depth_offset ); - - DMA_BLOCK( MGA_FCOL, ctx->fcol, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); -} - -static inline void mga_g400_emit_context( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - DMA_LOCALS; - - BEGIN_DMA( 4 ); - - DMA_BLOCK( MGA_DSTORG, ctx->dstorg, - MGA_MACCESS, ctx->maccess, - MGA_PLNWT, ctx->plnwt, - MGA_DWGCTL, ctx->dwgctl ); - - DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, - MGA_FOGCOL, ctx->fogcolor, - MGA_WFLAG, ctx->wflag, - MGA_ZORG, dev_priv->depth_offset ); - - DMA_BLOCK( MGA_WFLAG1, ctx->wflag, - MGA_TDUALSTAGE0, ctx->tdualstage0, - MGA_TDUALSTAGE1, ctx->tdualstage1, - MGA_FCOL, ctx->fcol ); - - DMA_BLOCK( MGA_STENCIL, ctx->stencil, - MGA_STENCILCTL, ctx->stencilctl, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); -} - -static inline void mga_g200_emit_tex0( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; - DMA_LOCALS; - - BEGIN_DMA( 4 ); - - DMA_BLOCK( MGA_TEXCTL2, tex->texctl2, - MGA_TEXCTL, tex->texctl, - MGA_TEXFILTER, tex->texfilter, - MGA_TEXBORDERCOL, tex->texbordercol ); - - DMA_BLOCK( MGA_TEXORG, tex->texorg, - MGA_TEXORG1, tex->texorg1, - MGA_TEXORG2, tex->texorg2, - MGA_TEXORG3, tex->texorg3 ); - - DMA_BLOCK( MGA_TEXORG4, tex->texorg4, - MGA_TEXWIDTH, tex->texwidth, - MGA_TEXHEIGHT, tex->texheight, - MGA_WR24, tex->texwidth ); - - DMA_BLOCK( MGA_WR34, tex->texheight, - MGA_TEXTRANS, 0x0000ffff, - MGA_TEXTRANSHIGH, 0x0000ffff, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); -} - -static inline void mga_g400_emit_tex0( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; - DMA_LOCALS; - - BEGIN_DMA( 6 ); - - DMA_BLOCK( MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC, - MGA_TEXCTL, tex->texctl, - MGA_TEXFILTER, tex->texfilter, - MGA_TEXBORDERCOL, tex->texbordercol ); - - DMA_BLOCK( MGA_TEXORG, tex->texorg, - MGA_TEXORG1, tex->texorg1, - MGA_TEXORG2, tex->texorg2, - MGA_TEXORG3, tex->texorg3 ); - - DMA_BLOCK( MGA_TEXORG4, tex->texorg4, - MGA_TEXWIDTH, tex->texwidth, - MGA_TEXHEIGHT, tex->texheight, - MGA_WR49, 0x00000000 ); - - DMA_BLOCK( MGA_WR57, 0x00000000, - MGA_WR53, 0x00000000, - MGA_WR61, 0x00000000, - MGA_WR52, MGA_G400_WR_MAGIC ); - - DMA_BLOCK( MGA_WR60, MGA_G400_WR_MAGIC, - MGA_WR54, tex->texwidth | MGA_G400_WR_MAGIC, - MGA_WR62, tex->texheight | MGA_G400_WR_MAGIC, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_TEXTRANS, 0x0000ffff, - MGA_TEXTRANSHIGH, 0x0000ffff ); - - ADVANCE_DMA(); -} - -static inline void mga_g400_emit_tex1( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1]; - DMA_LOCALS; - - BEGIN_DMA( 5 ); - - DMA_BLOCK( MGA_TEXCTL2, (tex->texctl2 | - MGA_MAP1_ENABLE | - MGA_G400_TC2_MAGIC), - MGA_TEXCTL, tex->texctl, - MGA_TEXFILTER, tex->texfilter, - MGA_TEXBORDERCOL, tex->texbordercol ); - - DMA_BLOCK( MGA_TEXORG, tex->texorg, - MGA_TEXORG1, tex->texorg1, - MGA_TEXORG2, tex->texorg2, - MGA_TEXORG3, tex->texorg3 ); - - DMA_BLOCK( MGA_TEXORG4, tex->texorg4, - MGA_TEXWIDTH, tex->texwidth, - MGA_TEXHEIGHT, tex->texheight, - MGA_WR49, 0x00000000 ); - - DMA_BLOCK( MGA_WR57, 0x00000000, - MGA_WR53, 0x00000000, - MGA_WR61, 0x00000000, - MGA_WR52, tex->texwidth | MGA_G400_WR_MAGIC ); - - DMA_BLOCK( MGA_WR60, tex->texheight | MGA_G400_WR_MAGIC, - MGA_TEXTRANS, 0x0000ffff, - MGA_TEXTRANSHIGH, 0x0000ffff, - MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC ); - - ADVANCE_DMA(); -} - -static inline void mga_g200_emit_pipe( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->warp_pipe; - DMA_LOCALS; - - BEGIN_DMA( 3 ); - - DMA_BLOCK( MGA_WIADDR, MGA_WMODE_SUSPEND, - MGA_WVRTXSZ, 0x00000007, - MGA_WFLAG, 0x00000000, - MGA_WR24, 0x00000000 ); - - DMA_BLOCK( MGA_WR25, 0x00000100, - MGA_WR34, 0x00000000, - MGA_WR42, 0x0000ffff, - MGA_WR60, 0x0000ffff ); - - /* Padding required to to hardware bug. - */ - DMA_BLOCK( MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_WIADDR, (dev_priv->warp_pipe_phys[pipe] | - MGA_WMODE_START | - MGA_WAGP_ENABLE) ); - - ADVANCE_DMA(); -} - -static inline void mga_g400_emit_pipe( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->warp_pipe; - DMA_LOCALS; - - BEGIN_DMA( 10 ); - - DMA_BLOCK( MGA_WIADDR2, MGA_WMODE_SUSPEND, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - if ( pipe & MGA_T2 ) { - DMA_BLOCK( MGA_WVRTXSZ, 0x00001e09, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x1e000000 ); - } else { - if ( dev_priv->warp_pipe & MGA_T2 ) { - /* Flush the WARP pipe */ - DMA_BLOCK( MGA_YDST, 0x00000000, - MGA_FXLEFT, 0x00000000, - MGA_FXRIGHT, 0x00000001, - MGA_DWGCTL, MGA_DWGCTL_FLUSH ); - - DMA_BLOCK( MGA_LEN + MGA_EXEC, 0x00000001, - MGA_DWGSYNC, 0x00007000, - MGA_TEXCTL2, MGA_G400_TC2_MAGIC, - MGA_LEN + MGA_EXEC, 0x00000000 ); - - DMA_BLOCK( MGA_TEXCTL2, (MGA_DUALTEX | - MGA_G400_TC2_MAGIC), - MGA_LEN + MGA_EXEC, 0x00000000, - MGA_TEXCTL2, MGA_G400_TC2_MAGIC, - MGA_DMAPAD, 0x00000000 ); - } - - DMA_BLOCK( MGA_WVRTXSZ, 0x00001807, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x00000000, - MGA_WACCEPTSEQ, 0x18000000 ); - } - - DMA_BLOCK( MGA_WFLAG, 0x00000000, - MGA_WFLAG1, 0x00000000, - MGA_WR56, MGA_G400_WR56_MAGIC, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_WR49, 0x00000000, /* tex0 */ - MGA_WR57, 0x00000000, /* tex0 */ - MGA_WR53, 0x00000000, /* tex1 */ - MGA_WR61, 0x00000000 ); /* tex1 */ - - DMA_BLOCK( MGA_WR54, MGA_G400_WR_MAGIC, /* tex0 width */ - MGA_WR62, MGA_G400_WR_MAGIC, /* tex0 height */ - MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */ - MGA_WR60, MGA_G400_WR_MAGIC ); /* tex1 height */ - - /* Padding required to to hardware bug */ - DMA_BLOCK( MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_DMAPAD, 0xffffffff, - MGA_WIADDR2, (dev_priv->warp_pipe_phys[pipe] | - MGA_WMODE_START | - MGA_WAGP_ENABLE) ); - - ADVANCE_DMA(); -} - -static void mga_g200_emit_state( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { - mga_g200_emit_pipe( dev_priv ); - dev_priv->warp_pipe = sarea_priv->warp_pipe; - } - - if ( dirty & MGA_UPLOAD_CONTEXT ) { - mga_g200_emit_context( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; - } - - if ( dirty & MGA_UPLOAD_TEX0 ) { - mga_g200_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } -} - -static void mga_g400_emit_state( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - int multitex = sarea_priv->warp_pipe & MGA_T2; - - if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { - mga_g400_emit_pipe( dev_priv ); - dev_priv->warp_pipe = sarea_priv->warp_pipe; - } - - if ( dirty & MGA_UPLOAD_CONTEXT ) { - mga_g400_emit_context( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; - } - - if ( dirty & MGA_UPLOAD_TEX0 ) { - mga_g400_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } - - if ( (dirty & MGA_UPLOAD_TEX1) && multitex ) { - mga_g400_emit_tex1( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; - } -} - - -/* ================================================================ - * SAREA state verification - */ - -/* Disallow all write destinations except the front and backbuffer. - */ -static int mga_verify_context( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - - if ( ctx->dstorg != dev_priv->front_offset && - ctx->dstorg != dev_priv->back_offset ) { - DRM_ERROR( "*** bad DSTORG: %x (front %x, back %x)\n\n", - ctx->dstorg, dev_priv->front_offset, - dev_priv->back_offset ); - ctx->dstorg = 0; - return -EINVAL; - } - - return 0; -} - -/* Disallow texture reads from PCI space. - */ -static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit]; - unsigned int org; - - org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); - - if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { - DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n", - tex->texorg, unit ); - tex->texorg = 0; - return -EINVAL; - } - - return 0; -} - -static int mga_verify_state( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - int ret = 0; - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - if ( dirty & MGA_UPLOAD_CONTEXT ) - ret |= mga_verify_context( dev_priv ); - - if ( dirty & MGA_UPLOAD_TEX0 ) - ret |= mga_verify_tex( dev_priv, 0 ); - - if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { - if ( dirty & MGA_UPLOAD_TEX1 ) - ret |= mga_verify_tex( dev_priv, 1 ); - - if ( dirty & MGA_UPLOAD_PIPE ) - ret |= ( sarea_priv->warp_pipe > MGA_MAX_G400_PIPES ); - } else { - if ( dirty & MGA_UPLOAD_PIPE ) - ret |= ( sarea_priv->warp_pipe > MGA_MAX_G200_PIPES ); - } - - return ( ret == 0 ); -} - -static int mga_verify_iload( drm_mga_private_t *dev_priv, - unsigned int dstorg, unsigned int length ) -{ - if ( dstorg < dev_priv->texture_offset || - dstorg + length > (dev_priv->texture_offset + - dev_priv->texture_size) ) { - DRM_ERROR( "*** bad iload DSTORG: 0x%x\n", dstorg ); - return -EINVAL; - } - - if ( length & MGA_ILOAD_MASK ) { - DRM_ERROR( "*** bad iload length: 0x%x\n", - length & MGA_ILOAD_MASK ); - return -EINVAL; - } - - return 0; -} - -static int mga_verify_blit( drm_mga_private_t *dev_priv, - unsigned int srcorg, unsigned int dstorg ) -{ - if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || - (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) { - DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n", - srcorg, dstorg ); - return -EINVAL; - } - return 0; -} - - -/* ================================================================ - * - */ - -static void mga_dma_dispatch_clear( drm_device_t *dev, - drm_mga_clear_t *clear ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - int i; - DMA_LOCALS; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - ADVANCE_DMA(); - - for ( i = 0 ; i < nbox ; i++ ) { - drm_clip_rect_t *box = &pbox[i]; - u32 height = box->y2 - box->y1; - - DRM_DEBUG( " from=%d,%d to=%d,%d\n", - box->x1, box->y1, box->x2, box->y2 ); - - if ( clear->flags & MGA_FRONT ) { - BEGIN_DMA( 2 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, clear->color_mask, - MGA_YDSTLEN, (box->y1 << 16) | height, - MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_FCOL, clear->clear_color, - MGA_DSTORG, dev_priv->front_offset, - MGA_DWGCTL + MGA_EXEC, - dev_priv->clear_cmd ); - - ADVANCE_DMA(); - } - - - if ( clear->flags & MGA_BACK ) { - BEGIN_DMA( 2 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, clear->color_mask, - MGA_YDSTLEN, (box->y1 << 16) | height, - MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_FCOL, clear->clear_color, - MGA_DSTORG, dev_priv->back_offset, - MGA_DWGCTL + MGA_EXEC, - dev_priv->clear_cmd ); - - ADVANCE_DMA(); - } - - if ( clear->flags & MGA_DEPTH ) { - BEGIN_DMA( 2 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, clear->depth_mask, - MGA_YDSTLEN, (box->y1 << 16) | height, - MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_FCOL, clear->clear_depth, - MGA_DSTORG, dev_priv->depth_offset, - MGA_DWGCTL + MGA_EXEC, - dev_priv->clear_cmd ); - - ADVANCE_DMA(); - } - - } - - BEGIN_DMA( 1 ); - - /* Force reset of DWGCTL */ - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_PLNWT, ctx->plnwt, - MGA_DWGCTL, ctx->dwgctl ); - - ADVANCE_DMA(); - - FLUSH_DMA(); -} - -static void mga_dma_dispatch_swap( drm_device_t *dev ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - int i; - DMA_LOCALS; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - sarea_priv->last_frame.head = dev_priv->prim.tail; - sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; - - BEGIN_DMA( 4 + nbox ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, - MGA_MACCESS, dev_priv->maccess, - MGA_SRCORG, dev_priv->back_offset, - MGA_AR5, dev_priv->front_pitch ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_PLNWT, 0xffffffff, - MGA_DWGCTL, MGA_DWGCTL_COPY ); - - for ( i = 0 ; i < nbox ; i++ ) { - drm_clip_rect_t *box = &pbox[i]; - u32 height = box->y2 - box->y1; - u32 start = box->y1 * dev_priv->front_pitch; - - DRM_DEBUG( " from=%d,%d to=%d,%d\n", - box->x1, box->y1, box->x2, box->y2 ); - - DMA_BLOCK( MGA_AR0, start + box->x2 - 1, - MGA_AR3, start + box->x1, - MGA_FXBNDRY, ((box->x2 - 1) << 16) | box->x1, - MGA_YDSTLEN + MGA_EXEC, - (box->y1 << 16) | height ); - } - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, ctx->plnwt, - MGA_SRCORG, dev_priv->front_offset, - MGA_DWGCTL, ctx->dwgctl ); - - ADVANCE_DMA(); - - FLUSH_DMA(); - - DRM_DEBUG( "%s... done.\n", __FUNCTION__ ); -} - -static void mga_dma_dispatch_vertex( drm_device_t *dev, drm_buf_t *buf ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - u32 address = (u32) buf->bus_address; - u32 length = (u32) buf->used; - int i = 0; - DMA_LOCALS; - DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used ); - - if ( buf->used ) { - buf_priv->dispatched = 1; - - MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); - - do { - if ( i < sarea_priv->nbox ) { - mga_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_SECADDRESS, (address | - MGA_DMA_VERTEX), - MGA_SECEND, ((address + length) | - MGA_PAGPXFER) ); - - ADVANCE_DMA(); - } while ( ++i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - AGE_BUFFER( buf_priv ); - buf->pending = 0; - buf->used = 0; - buf_priv->dispatched = 0; - - mga_freelist_put( dev, buf ); - } - - FLUSH_DMA(); -} - -static void mga_dma_dispatch_indices( drm_device_t *dev, drm_buf_t *buf, - unsigned int start, unsigned int end ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - u32 address = (u32) buf->bus_address; - int i = 0; - DMA_LOCALS; - DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end ); - - if ( start != end ) { - buf_priv->dispatched = 1; - - MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); - - do { - if ( i < sarea_priv->nbox ) { - mga_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - BEGIN_DMA( 1 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_SETUPADDRESS, address + start, - MGA_SETUPEND, ((address + end) | - MGA_PAGPXFER) ); - - ADVANCE_DMA(); - } while ( ++i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - AGE_BUFFER( buf_priv ); - buf->pending = 0; - buf->used = 0; - buf_priv->dispatched = 0; - - mga_freelist_put( dev, buf ); - } - - FLUSH_DMA(); -} - -/* This copies a 64 byte aligned agp region to the frambuffer with a - * standard blit, the ioctl needs to do checking. - */ -static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, - unsigned int dstorg, unsigned int length ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state; - u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM; - u32 y2; - DMA_LOCALS; - DRM_DEBUG( "%s: buf=%d used=%d\n", - __FUNCTION__, buf->idx, buf->used ); - - y2 = length / 64; - - BEGIN_DMA( 5 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - DMA_BLOCK( MGA_DSTORG, dstorg, - MGA_MACCESS, 0x00000000, - MGA_SRCORG, srcorg, - MGA_AR5, 64 ); - - DMA_BLOCK( MGA_PITCH, 64, - MGA_PLNWT, 0xffffffff, - MGA_DMAPAD, 0x00000000, - MGA_DWGCTL, MGA_DWGCTL_COPY ); - - DMA_BLOCK( MGA_AR0, 63, - MGA_AR3, 0, - MGA_FXBNDRY, (63 << 16) | 0, - MGA_YDSTLEN + MGA_EXEC, y2 ); - - DMA_BLOCK( MGA_PLNWT, ctx->plnwt, - MGA_SRCORG, dev_priv->front_offset, - MGA_PITCH, dev_priv->front_pitch, - MGA_DWGSYNC, 0x00007000 ); - - ADVANCE_DMA(); - - AGE_BUFFER( buf_priv ); - - buf->pending = 0; - buf->used = 0; - buf_priv->dispatched = 0; - - mga_freelist_put( dev, buf ); - - FLUSH_DMA(); -} - -static void mga_dma_dispatch_blit( drm_device_t *dev, - drm_mga_blit_t *blit ) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int nbox = sarea_priv->nbox; - u32 scandir = 0, i; - DMA_LOCALS; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - BEGIN_DMA( 4 + nbox ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); - - DMA_BLOCK( MGA_DWGCTL, MGA_DWGCTL_COPY, - MGA_PLNWT, blit->planemask, - MGA_SRCORG, blit->srcorg, - MGA_DSTORG, blit->dstorg ); - - DMA_BLOCK( MGA_SGN, scandir, - MGA_MACCESS, dev_priv->maccess, - MGA_AR5, blit->ydir * blit->src_pitch, - MGA_PITCH, blit->dst_pitch ); - - for ( i = 0 ; i < nbox ; i++ ) { - int srcx = pbox[i].x1 + blit->delta_sx; - int srcy = pbox[i].y1 + blit->delta_sy; - int dstx = pbox[i].x1 + blit->delta_dx; - int dsty = pbox[i].y1 + blit->delta_dy; - int h = pbox[i].y2 - pbox[i].y1; - int w = pbox[i].x2 - pbox[i].x1 - 1; - int start; - - if ( blit->ydir == -1 ) { - srcy = blit->height - srcy - 1; - } - - start = srcy * blit->src_pitch + srcx; - - DMA_BLOCK( MGA_AR0, start + w, - MGA_AR3, start, - MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff), - MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h ); - } - - /* Do something to flush AGP? - */ - - /* Force reset of DWGCTL */ - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_PLNWT, ctx->plnwt, - MGA_PITCH, dev_priv->front_pitch, - MGA_DWGCTL, ctx->dwgctl ); - - ADVANCE_DMA(); -} - - -/* ================================================================ - * - */ - -int mga_dma_clear( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_clear_t clear; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &clear, (drm_mga_clear_t *) arg, sizeof(clear) ) ) - return -EFAULT; - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_clear( dev, &clear ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} - -int mga_dma_swap( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_swap( dev ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} - -int mga_dma_vertex( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_vertex_t vertex; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &vertex, - (drm_mga_vertex_t *)arg, - sizeof(vertex) ) ) - return -EFAULT; - - if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; - buf = dma->buflist[vertex.idx]; - buf_priv = buf->dev_private; - - buf->used = vertex.used; - buf_priv->discard = vertex.discard; - - if ( !mga_verify_state( dev_priv ) ) { - if ( vertex.discard ) { - if ( buf_priv->dispatched == 1 ) - AGE_BUFFER( buf_priv ); - buf_priv->dispatched = 0; - mga_freelist_put( dev, buf ); - } - return -EINVAL; - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_vertex( dev, buf ); - - return 0; -} - -int mga_dma_indices( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_indices_t indices; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &indices, - (drm_mga_indices_t *)arg, - sizeof(indices) ) ) - return -EFAULT; - - if(indices.idx < 0 || indices.idx > dma->buf_count) return -EINVAL; - - buf = dma->buflist[indices.idx]; - buf_priv = buf->dev_private; - - buf_priv->discard = indices.discard; - - if ( !mga_verify_state( dev_priv ) ) { - if ( indices.discard ) { - if ( buf_priv->dispatched == 1 ) - AGE_BUFFER( buf_priv ); - buf_priv->dispatched = 0; - mga_freelist_put( dev, buf ); - } - return -EINVAL; - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_indices( dev, buf, indices.start, indices.end ); - - return 0; -} - -int mga_dma_iload( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_iload_t iload; - DRM_DEBUG( __FUNCTION__ ":\n" ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) ) - return -EFAULT; - -#if 0 - if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { - if ( MGA_DMA_DEBUG ) - DRM_INFO( __FUNCTION__": -EBUSY\n" ); - return -EBUSY; - } -#endif - if(iload.idx < 0 || iload.idx > dma->buf_count) return -EINVAL; - - buf = dma->buflist[iload.idx]; - buf_priv = buf->dev_private; - - if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { - mga_freelist_put( dev, buf ); - return -EINVAL; - } - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} - -int mga_dma_blit( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_blit_t blit; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &blit, (drm_mga_blit_t *)arg, sizeof(blit) ) ) - return -EFAULT; - - if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - - if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) ) - return -EINVAL; - - WRAP_TEST_WITH_RETURN( dev_priv ); - - mga_dma_dispatch_blit( dev, &blit ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h:1.1 Wed Mar 21 13:08:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h Thu Feb 27 12:32:38 2003 @@ -1,11645 +0,0 @@ -/* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*- - * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com - * - * Copyright 1999 Matrox Graphics Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * MATROX GRAPHICS INC., OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Kernel-based WARP engine management: - * Gareth Hughes <gareth@valinux.com> - */ - -/* - * WARP pipes are named according to the functions they perform, where: - * - * - T stands for computation of texture stage 0 - * - T2 stands for computation of both texture stage 0 and texture stage 1 - * - G stands for computation of triangle intensity (Gouraud interpolation) - * - Z stands for computation of Z buffer interpolation - * - S stands for computation of specular highlight - * - A stands for computation of the alpha channel - * - F stands for computation of vertex fog interpolation - */ - -static unsigned char warp_g200_tgz[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x72, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x60, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x03, 0x80, 0x0A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x57, 0x39, 0x20, 0xE9, -0x28, 0x19, 0x60, 0xEC, - -0x2B, 0x32, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0xB3, 0x05, -0x00, 0xE0, -0x16, 0x28, 0x20, 0xE9, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x2B, 0x20, 0xE9, - -0x1C, 0x80, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x85, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x84, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x82, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x7F, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgza[] = { - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x7D, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x6B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x44, 0x4C, 0xB6, -0x25, 0x44, 0x54, 0xB6, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x07, 0xC0, 0x44, 0xC6, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x1F, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x3F, 0x3D, 0x5D, 0x9F, -0x00, 0xE0, -0x07, 0x20, - -0x00, 0x80, 0x00, 0xE8, -0x28, 0x19, 0x60, 0xEC, - -0xB3, 0x05, -0x00, 0xE0, -0x00, 0x80, 0x00, 0xE8, - -0x23, 0x3B, 0x33, 0xAD, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0x26, 0x1F, 0xDF, -0x9D, 0x1F, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x9E, 0x3F, 0x4F, 0xE9, - -0x07, 0x07, 0x1F, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x9C, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x7A, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x79, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x77, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x74, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzaf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x83, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x6F, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x2D, 0x44, 0x4C, 0xB6, -0x25, 0x44, 0x54, 0xB6, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x00, 0xE0, -0x25, 0x20, -0x07, 0xC0, 0x44, 0xC6, - -0x17, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x2D, 0x20, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x1F, 0x62, 0x57, 0x9F, -0x00, 0xE0, -0x07, 0x20, - -0x3F, 0x3D, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x28, 0x19, 0x60, 0xEC, - -0xB3, 0x05, -0x00, 0xE0, -0x17, 0x26, 0x17, 0xDF, - -0x23, 0x3B, 0x33, 0xAD, -0x35, 0x17, 0x4F, 0xE9, - -0x1F, 0x26, 0x1F, 0xDF, -0x9D, 0x1F, 0x4F, 0xE9, - -0x9E, 0x3F, 0x4F, 0xE9, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x07, 0x07, 0x1F, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x31, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x9C, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x74, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x73, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x71, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x6E, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x7F, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x6B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x3C, 0x27, 0x4F, 0xE9, - -0x17, 0x50, 0x56, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x00, 0x80, 0x00, 0xE8, -0x28, 0x19, 0x60, 0xEC, - -0xB3, 0x05, -0x00, 0xE0, -0x00, 0x80, 0x00, 0xE8, - -0x23, 0x3B, 0x33, 0xAD, -0x00, 0x80, 0x00, 0xE8, - -0x17, 0x26, 0x17, 0xDF, -0x35, 0x17, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x31, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x78, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x77, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x75, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x72, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzs[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x8B, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x77, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x8F, 0x20, - -0xA5, 0x37, 0x4F, 0xE9, -0x0F, 0x17, 0x0F, 0xAF, - -0x06, 0xC0, 0x21, 0xC4, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0xA3, 0x80, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0xA1, 0x1F, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x06, 0x06, 0x1F, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x6C, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x6B, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x69, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzsa[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x8F, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x7B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x0D, 0x44, 0x4C, 0xB6, -0x05, 0x44, 0x54, 0xB6, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x0D, 0x20, -0x05, 0x20, -0x00, 0x80, 0x00, 0xE8, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x0F, 0x20, - -0x17, 0x50, 0x56, 0x9F, -0xA5, 0x37, 0x4F, 0xE9, - -0x06, 0xC0, 0x21, 0xC4, -0x0F, 0x17, 0x0F, 0xAF, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2F, 0xC0, 0x44, 0xC6, -0xA3, 0x80, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0x17, 0x26, 0x17, 0xDF, -0x9D, 0x17, 0x4F, 0xE9, - -0xA1, 0x1F, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x06, 0x06, 0x1F, 0xAF, -0x00, 0xE0, -0xAF, 0x20, - -0x9E, 0x37, 0x4F, 0xE9, -0x2F, 0x17, 0x2F, 0xAF, - -0xA0, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x9C, 0x80, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x68, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x67, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x65, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x62, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzsaf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x94, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x80, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0x2D, 0x44, 0x4C, 0xB6, -0x25, 0x44, 0x54, 0xB6, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x0F, 0x20, - -0x2D, 0x20, -0x25, 0x20, -0x07, 0xC0, 0x44, 0xC6, - -0x17, 0x50, 0x56, 0x9F, -0xA5, 0x37, 0x4F, 0xE9, - -0x06, 0xC0, 0x21, 0xC4, -0x0F, 0x17, 0x0F, 0xAF, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x3E, 0x3D, 0x5D, 0x9F, -0x00, 0xE0, -0x07, 0x20, - -0x2F, 0x20, -0x00, 0xE0, -0xA3, 0x0F, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0x17, 0x26, 0x17, 0xDF, -0xA1, 0x1F, 0x4F, 0xE9, - -0x1E, 0x26, 0x1E, 0xDF, -0x9D, 0x1E, 0x4F, 0xE9, - -0x35, 0x17, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x06, 0x06, 0x1F, 0xAF, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x07, 0x07, 0x1E, 0xAF, - -0xA0, 0x80, 0x4F, 0xE9, -0x9E, 0x3E, 0x4F, 0xE9, - -0x31, 0x80, 0x4F, 0xE9, -0x9C, 0x80, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x63, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x62, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x60, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x5D, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g200_tgzsf[] = { - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x98, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x81, 0x04, -0x89, 0x04, -0x01, 0x04, -0x09, 0x04, - -0xC9, 0x41, 0xC0, 0xEC, -0x11, 0x04, -0x00, 0xE0, - -0x41, 0xCC, 0x41, 0xCD, -0x49, 0xCC, 0x49, 0xCD, - -0xD1, 0x41, 0xC0, 0xEC, -0x51, 0xCC, 0x51, 0xCD, - -0x80, 0x04, -0x10, 0x04, -0x08, 0x04, -0x00, 0xE0, - -0x00, 0xCC, 0xC0, 0xCD, -0xD1, 0x49, 0xC0, 0xEC, - -0x8A, 0x1F, 0x20, 0xE9, -0x8B, 0x3F, 0x20, 0xE9, - -0x41, 0x3C, 0x41, 0xAD, -0x49, 0x3C, 0x49, 0xAD, - -0x10, 0xCC, 0x10, 0xCD, -0x08, 0xCC, 0x08, 0xCD, - -0xB9, 0x41, 0x49, 0xBB, -0x1F, 0xF0, 0x41, 0xCD, - -0x51, 0x3C, 0x51, 0xAD, -0x00, 0x98, 0x80, 0xE9, - -0x8F, 0x80, 0x07, 0xEA, -0x24, 0x1F, 0x20, 0xE9, - -0x21, 0x45, 0x80, 0xE8, -0x1A, 0x4D, 0x80, 0xE8, - -0x31, 0x55, 0x80, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0x41, 0x49, 0xBD, -0x1D, 0x41, 0x51, 0xBD, - -0x2E, 0x41, 0x2A, 0xB8, -0x34, 0x53, 0xA0, 0xE8, - -0x15, 0x30, -0x1D, 0x30, -0x58, 0xE3, -0x00, 0xE0, - -0xB5, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x24, 0x43, 0xA0, 0xE8, -0x2C, 0x4B, 0xA0, 0xE8, - -0x15, 0x72, -0x09, 0xE3, -0x00, 0xE0, -0x1D, 0x72, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0x97, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x6C, 0x64, 0xC8, 0xEC, -0x98, 0xE1, -0xB5, 0x05, - -0xBD, 0x05, -0x2E, 0x30, -0x32, 0xC0, 0xA0, 0xE8, - -0x33, 0xC0, 0xA0, 0xE8, -0x74, 0x64, 0xC8, 0xEC, - -0x40, 0x3C, 0x40, 0xAD, -0x32, 0x6A, -0x2A, 0x30, - -0x20, 0x73, -0x33, 0x6A, -0x00, 0xE0, -0x28, 0x73, - -0x1C, 0x72, -0x83, 0xE2, -0x7B, 0x80, 0x15, 0xEA, - -0xB8, 0x3D, 0x28, 0xDF, -0x30, 0x35, 0x20, 0xDF, - -0x40, 0x30, -0x00, 0xE0, -0xCC, 0xE2, -0x64, 0x72, - -0x25, 0x42, 0x52, 0xBF, -0x2D, 0x42, 0x4A, 0xBF, - -0x30, 0x2E, 0x30, 0xDF, -0x38, 0x2E, 0x38, 0xDF, - -0x18, 0x1D, 0x45, 0xE9, -0x1E, 0x15, 0x45, 0xE9, - -0x2B, 0x49, 0x51, 0xBD, -0x00, 0xE0, -0x1F, 0x73, - -0x38, 0x38, 0x40, 0xAF, -0x30, 0x30, 0x40, 0xAF, - -0x24, 0x1F, 0x24, 0xDF, -0x1D, 0x32, 0x20, 0xE9, - -0x2C, 0x1F, 0x2C, 0xDF, -0x1A, 0x33, 0x20, 0xE9, - -0xB0, 0x10, -0x08, 0xE3, -0x40, 0x10, -0xB8, 0x10, - -0x26, 0xF0, 0x30, 0xCD, -0x2F, 0xF0, 0x38, 0xCD, - -0x2B, 0x80, 0x20, 0xE9, -0x2A, 0x80, 0x20, 0xE9, - -0xA6, 0x20, -0x88, 0xE2, -0x00, 0xE0, -0xAF, 0x20, - -0x28, 0x2A, 0x26, 0xAF, -0x20, 0x2A, 0xC0, 0xAF, - -0x34, 0x1F, 0x34, 0xDF, -0x46, 0x24, 0x46, 0xDF, - -0x28, 0x30, 0x80, 0xBF, -0x20, 0x38, 0x80, 0xBF, - -0x47, 0x24, 0x47, 0xDF, -0x4E, 0x2C, 0x4E, 0xDF, - -0x4F, 0x2C, 0x4F, 0xDF, -0x56, 0x34, 0x56, 0xDF, - -0x28, 0x15, 0x28, 0xDF, -0x20, 0x1D, 0x20, 0xDF, - -0x57, 0x34, 0x57, 0xDF, -0x00, 0xE0, -0x1D, 0x05, - -0x04, 0x80, 0x10, 0xEA, -0x89, 0xE2, -0x2B, 0x30, - -0x3F, 0xC1, 0x1D, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x68, -0xBF, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x20, 0xC0, 0x20, 0xAF, -0x28, 0x05, -0x97, 0x74, - -0x00, 0xE0, -0x2A, 0x10, -0x16, 0xC0, 0x20, 0xE9, - -0x04, 0x80, 0x10, 0xEA, -0x8C, 0xE2, -0x95, 0x05, - -0x28, 0xC1, 0x28, 0xAD, -0x1F, 0xC1, 0x15, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xA8, 0x67, -0x9F, 0x6B, -0x00, 0x80, 0x00, 0xE8, - -0x28, 0xC0, 0x28, 0xAD, -0x1D, 0x25, -0x20, 0x05, - -0x28, 0x32, 0x80, 0xAD, -0x40, 0x2A, 0x40, 0xBD, - -0x1C, 0x80, 0x20, 0xE9, -0x20, 0x33, 0x20, 0xAD, - -0x20, 0x73, -0x00, 0xE0, -0xB6, 0x49, 0x51, 0xBB, - -0x26, 0x2F, 0xB0, 0xE8, -0x19, 0x20, 0x20, 0xE9, - -0x35, 0x20, 0x35, 0xDF, -0x3D, 0x20, 0x3D, 0xDF, - -0x15, 0x20, 0x15, 0xDF, -0x1D, 0x20, 0x1D, 0xDF, - -0x26, 0xD0, 0x26, 0xCD, -0x29, 0x49, 0x2A, 0xB8, - -0x26, 0x40, 0x80, 0xBD, -0x3B, 0x48, 0x50, 0xBD, - -0x3E, 0x54, 0x57, 0x9F, -0x00, 0xE0, -0x82, 0xE1, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x26, 0x30, -0x29, 0x30, -0x48, 0x3C, 0x48, 0xAD, - -0x2B, 0x72, -0xC2, 0xE1, -0x2C, 0xC0, 0x44, 0xC2, - -0x05, 0x24, 0x34, 0xBF, -0x0D, 0x24, 0x2C, 0xBF, - -0x2D, 0x46, 0x4E, 0xBF, -0x25, 0x46, 0x56, 0xBF, - -0x20, 0x1D, 0x6F, 0x8F, -0x32, 0x3E, 0x5F, 0xE9, - -0x3E, 0x50, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x30, - -0x1E, 0x8F, 0x51, 0x9F, -0x33, 0x1E, 0x5F, 0xE9, - -0x05, 0x44, 0x54, 0xB2, -0x0D, 0x44, 0x4C, 0xB2, - -0x19, 0xC0, 0xB0, 0xE8, -0x34, 0xC0, 0x44, 0xC4, - -0x33, 0x73, -0x00, 0xE0, -0x3E, 0x62, 0x57, 0x9F, - -0x1E, 0xAF, 0x59, 0x9F, -0x00, 0xE0, -0x0D, 0x20, - -0x84, 0x3E, 0x58, 0xE9, -0x28, 0x1D, 0x6F, 0x8F, - -0x05, 0x20, -0x00, 0xE0, -0x85, 0x1E, 0x58, 0xE9, - -0x9B, 0x3B, 0x33, 0xDF, -0x20, 0x20, 0x42, 0xAF, - -0x30, 0x42, 0x56, 0x9F, -0x80, 0x3E, 0x57, 0xE9, - -0x3F, 0x8F, 0x51, 0x9F, -0x30, 0x80, 0x5F, 0xE9, - -0x28, 0x28, 0x24, 0xAF, -0x81, 0x1E, 0x57, 0xE9, - -0x05, 0x47, 0x57, 0xBF, -0x0D, 0x47, 0x4F, 0xBF, - -0x88, 0x80, 0x58, 0xE9, -0x1B, 0x29, 0x1B, 0xDF, - -0x30, 0x1D, 0x6F, 0x8F, -0x3A, 0x30, 0x4F, 0xE9, - -0x1C, 0x30, 0x26, 0xDF, -0x09, 0xE3, -0x3B, 0x05, - -0x3E, 0x50, 0x56, 0x9F, -0x3B, 0x3F, 0x4F, 0xE9, - -0x1E, 0x8F, 0x51, 0x9F, -0x00, 0xE0, -0xAC, 0x20, - -0x2D, 0x44, 0x4C, 0xB4, -0x2C, 0x1C, 0xC0, 0xAF, - -0x25, 0x44, 0x54, 0xB4, -0x00, 0xE0, -0xC8, 0x30, - -0x30, 0x46, 0x30, 0xAF, -0x1B, 0x1B, 0x48, 0xAF, - -0x00, 0xE0, -0x25, 0x20, -0x38, 0x2C, 0x4F, 0xE9, - -0x86, 0x80, 0x57, 0xE9, -0x38, 0x1D, 0x6F, 0x8F, - -0x28, 0x74, -0x00, 0xE0, -0x0D, 0x44, 0x4C, 0xB0, - -0x05, 0x44, 0x54, 0xB0, -0x2D, 0x20, -0x9B, 0x10, - -0x82, 0x3E, 0x57, 0xE9, -0x32, 0xF0, 0x1B, 0xCD, - -0x1E, 0xBD, 0x59, 0x9F, -0x83, 0x1E, 0x57, 0xE9, - -0x38, 0x47, 0x38, 0xAF, -0x34, 0x20, -0x2A, 0x30, - -0x00, 0xE0, -0x0D, 0x20, -0x32, 0x20, -0x05, 0x20, - -0x87, 0x80, 0x57, 0xE9, -0x1F, 0x54, 0x57, 0x9F, - -0x17, 0x42, 0x56, 0x9F, -0x00, 0xE0, -0x3B, 0x6A, - -0x3F, 0x8F, 0x51, 0x9F, -0x37, 0x1E, 0x4F, 0xE9, - -0x37, 0x32, 0x2A, 0xAF, -0x00, 0xE0, -0x32, 0x00, - -0x00, 0x80, 0x00, 0xE8, -0x27, 0xC0, 0x44, 0xC0, - -0x36, 0x1F, 0x4F, 0xE9, -0x1F, 0x1F, 0x26, 0xDF, - -0x37, 0x1B, 0x37, 0xBF, -0x17, 0x26, 0x17, 0xDF, - -0x3E, 0x17, 0x4F, 0xE9, -0x3F, 0x3F, 0x4F, 0xE9, - -0x34, 0x1F, 0x34, 0xAF, -0x2B, 0x05, -0xA7, 0x20, - -0x33, 0x2B, 0x37, 0xDF, -0x27, 0x17, 0xC0, 0xAF, - -0x34, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x2D, 0x21, 0x1A, 0xB0, -0x25, 0x21, 0x31, 0xB0, - -0x0D, 0x21, 0x1A, 0xB2, -0x05, 0x21, 0x31, 0xB2, - -0x03, 0x80, 0x2A, 0xEA, -0x17, 0xC1, 0x2B, 0xBD, - -0x2D, 0x20, -0x25, 0x20, -0x05, 0x20, -0x0D, 0x20, - -0xB3, 0x68, -0x97, 0x25, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0xC0, 0x33, 0xAF, -0x2F, 0xC0, 0x21, 0xC0, - -0x16, 0x42, 0x56, 0x9F, -0x3C, 0x27, 0x4F, 0xE9, - -0x1E, 0x62, 0x57, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x21, 0x31, 0xB4, -0x2D, 0x21, 0x1A, 0xB4, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x33, 0x05, -0x00, 0xE0, -0x28, 0x19, 0x60, 0xEC, - -0x0D, 0x21, 0x1A, 0xB6, -0x05, 0x21, 0x31, 0xB6, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0xE0, -0x2F, 0x20, - -0x23, 0x3B, 0x33, 0xAD, -0x1E, 0x26, 0x1E, 0xDF, - -0xA7, 0x1E, 0x4F, 0xE9, -0x17, 0x26, 0x16, 0xDF, - -0x2D, 0x20, -0x00, 0xE0, -0xA8, 0x3F, 0x4F, 0xE9, - -0x2F, 0x2F, 0x1E, 0xAF, -0x25, 0x20, -0x00, 0xE0, - -0xA4, 0x16, 0x4F, 0xE9, -0x0F, 0xC0, 0x21, 0xC2, - -0xA6, 0x80, 0x4F, 0xE9, -0x1F, 0x62, 0x57, 0x9F, - -0x0D, 0x20, -0x05, 0x20, -0x2F, 0xC0, 0x21, 0xC6, - -0x3F, 0x2F, 0x5D, 0x9F, -0x00, 0xE0, -0x0F, 0x20, - -0x17, 0x50, 0x56, 0x9F, -0xA5, 0x37, 0x4F, 0xE9, - -0x06, 0xC0, 0x21, 0xC4, -0x0F, 0x17, 0x0F, 0xAF, - -0x37, 0x0F, 0x5C, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2F, 0x20, -0x00, 0xE0, -0xA3, 0x80, 0x4F, 0xE9, - -0x06, 0x20, -0x00, 0xE0, -0x1F, 0x26, 0x1F, 0xDF, - -0x17, 0x26, 0x17, 0xDF, -0x35, 0x17, 0x4F, 0xE9, - -0xA1, 0x1F, 0x4F, 0xE9, -0xA2, 0x3F, 0x4F, 0xE9, - -0x06, 0x06, 0x1F, 0xAF, -0x39, 0x37, 0x4F, 0xE9, - -0x2F, 0x2F, 0x17, 0xAF, -0x00, 0x80, 0x00, 0xE8, - -0xA0, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x31, 0x80, 0x4F, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x57, 0x39, 0x20, 0xE9, - -0x16, 0x28, 0x20, 0xE9, -0x1D, 0x3B, 0x20, 0xE9, - -0x1E, 0x2B, 0x20, 0xE9, -0x2B, 0x32, 0x20, 0xE9, - -0x1C, 0x23, 0x20, 0xE9, -0x57, 0x36, 0x20, 0xE9, - -0x00, 0x80, 0xA0, 0xE9, -0x40, 0x40, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x90, 0xE2, -0x00, 0xE0, - -0x68, 0xFF, 0x20, 0xEA, -0x19, 0xC8, 0xC1, 0xCD, - -0x1F, 0xD7, 0x18, 0xBD, -0x3F, 0xD7, 0x22, 0xBD, - -0x9F, 0x41, 0x49, 0xBD, -0x00, 0x80, 0x00, 0xE8, - -0x25, 0x41, 0x49, 0xBD, -0x2D, 0x41, 0x51, 0xBD, - -0x0D, 0x80, 0x07, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x35, 0x40, 0x48, 0xBD, -0x3D, 0x40, 0x50, 0xBD, - -0x00, 0x80, 0x00, 0xE8, -0x25, 0x30, -0x2D, 0x30, - -0x35, 0x30, -0xB5, 0x30, -0xBD, 0x30, -0x3D, 0x30, - -0x9C, 0xA7, 0x5B, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x67, 0xFF, 0x0A, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0xC9, 0x41, 0xC8, 0xEC, -0x42, 0xE1, -0x00, 0xE0, - -0x65, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0xC8, 0x40, 0xC0, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x62, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -}; - -static unsigned char warp_g400_t2gz[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x78, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x69, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x25, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x9F, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xBE, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x7D, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gza[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x7C, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x6D, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x29, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x74, 0xC6, -0x3D, 0xCF, 0x74, 0xC2, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB4, -0x02, 0x44, 0x64, 0xB4, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x9B, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xBA, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x79, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzaf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x81, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x72, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x37, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x2E, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x0F, 0xCF, 0x74, 0xC6, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB4, -0x02, 0x44, 0x64, 0xB4, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x75, 0xC6, -0x00, 0x80, 0x00, 0xE8, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x45, 0x55, 0xB6, -0x02, 0x45, 0x65, 0xB6, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x96, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xB5, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x74, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x7D, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x6E, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x39, 0xE5, 0x2C, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x88, 0x73, 0x5E, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0F, 0xCF, 0x75, 0xC6, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x28, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x0F, 0x20, 0xE9, - -0x0A, 0x44, 0x54, 0xB4, -0x02, 0x44, 0x64, 0xB4, - -0x2A, 0x45, 0x55, 0xB6, -0x1A, 0x45, 0x65, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x9A, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xBB, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x78, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzs[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x85, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x76, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x31, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x20, -0x1A, 0x20, -0x0A, 0x20, -0x02, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0xA7, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x92, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xB2, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x70, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzsa[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x8A, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x7B, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x36, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x0F, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x8D, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xAD, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x6B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzsaf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x8E, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x7F, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x3A, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x0F, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x54, 0xB6, -0x1A, 0x44, 0x64, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x0A, 0x45, 0x55, 0xB6, -0x02, 0x45, 0x65, 0xB6, - -0x3D, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x89, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xA9, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x67, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_t2gzsf[] = { - -0x00, 0x8A, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x0A, 0x40, 0x50, 0xBF, -0x2A, 0x40, 0x60, 0xBF, - -0x32, 0x41, 0x51, 0xBF, -0x3A, 0x41, 0x61, 0xBF, - -0xC3, 0x6B, -0xD3, 0x6B, -0x00, 0x8A, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x53, 0xA0, 0xE8, - -0xAD, 0xEE, 0x23, 0x9F, -0x00, 0xE0, -0x51, 0x04, - -0x90, 0xE2, -0x61, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x51, 0x41, 0xE0, 0xEC, -0x39, 0x67, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x63, 0xA0, 0xE8, - -0x61, 0x41, 0xE0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x8A, 0x80, 0x15, 0xEA, -0x10, 0x04, -0x20, 0x04, - -0x61, 0x51, 0xE0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x52, 0xBF, -0x0F, 0x52, 0xA0, 0xE8, - -0x1A, 0x42, 0x62, 0xBF, -0x1E, 0x51, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x0E, 0x61, 0x60, 0xEA, - -0x32, 0x40, 0x50, 0xBD, -0x22, 0x40, 0x60, 0xBD, - -0x12, 0x41, 0x51, 0xBD, -0x3A, 0x41, 0x61, 0xBD, - -0xBF, 0x2F, 0x0E, 0xBD, -0x97, 0xE2, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x35, 0x48, 0xB1, 0xE8, -0x3D, 0x59, 0xB1, 0xE8, - -0x46, 0x31, 0x46, 0xBF, -0x56, 0x31, 0x56, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x66, 0x31, 0x66, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x57, 0x39, 0x57, 0xBF, -0x67, 0x39, 0x67, 0xBF, - -0x7B, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x35, 0x00, -0x3D, 0x00, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0x8D, 0x2F, 0x1E, 0xBD, - -0x43, 0x75, 0xF8, 0xEC, -0x35, 0x20, -0x3D, 0x20, - -0x43, 0x43, 0x2D, 0xDF, -0x53, 0x53, 0x2D, 0xDF, - -0xAE, 0x1E, 0x0E, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x48, 0x35, 0x48, 0xBF, -0x58, 0x35, 0x58, 0xBF, - -0x68, 0x35, 0x68, 0xBF, -0x49, 0x3D, 0x49, 0xBF, - -0x59, 0x3D, 0x59, 0xBF, -0x69, 0x3D, 0x69, 0xBF, - -0x63, 0x63, 0x2D, 0xDF, -0x4D, 0x7D, 0xF8, 0xEC, - -0x59, 0xE3, -0x00, 0xE0, -0xB8, 0x38, 0x33, 0xBF, - -0x2D, 0x73, -0x30, 0x76, -0x18, 0x3A, 0x41, 0xE9, - -0x3F, 0x53, 0xA0, 0xE8, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x63, 0xA0, 0xE8, - -0x50, 0x70, 0xF8, 0xEC, -0x2B, 0x50, 0x3C, 0xE9, - -0x1F, 0x0F, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x59, 0x78, 0xF8, 0xEC, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x46, 0x37, 0x46, 0xDF, -0x56, 0x3F, 0x56, 0xDF, - -0x2B, 0x40, 0x3D, 0xE9, -0x66, 0x3D, 0x66, 0xDF, - -0x1D, 0x32, 0x41, 0xE9, -0x67, 0x3D, 0x67, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3F, 0x57, 0xDF, - -0x2A, 0x40, 0x20, 0xE9, -0x59, 0x3F, 0x59, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x69, 0x3D, 0x69, 0xDF, - -0x48, 0x37, 0x48, 0xDF, -0x58, 0x3F, 0x58, 0xDF, - -0x68, 0x3D, 0x68, 0xDF, -0x49, 0x37, 0x49, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x0F, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x54, 0xB0, -0x02, 0x44, 0x64, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB2, -0x1A, 0x44, 0x64, 0xB2, - -0x36, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x0F, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x54, 0xB4, -0x1A, 0x44, 0x64, 0xB4, - -0x0A, 0x45, 0x55, 0xB0, -0x02, 0x45, 0x65, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB2, -0x1A, 0x45, 0x65, 0xB2, - -0x0A, 0x45, 0x55, 0xB4, -0x02, 0x45, 0x65, 0xB4, - -0x0F, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x0F, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x45, 0x55, 0xB6, -0x1A, 0x45, 0x65, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x56, 0xBF, -0x1A, 0x46, 0x66, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x57, 0xBF, -0x02, 0x47, 0x67, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x53, 0xBF, -0x1A, 0x43, 0x63, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x0A, 0x48, 0x58, 0xBF, -0x02, 0x48, 0x68, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x2A, 0x49, 0x59, 0xBF, -0x1A, 0x49, 0x69, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x82, 0x30, 0x57, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x83, 0x38, 0x57, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x84, 0x31, 0x5E, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x85, 0x39, 0x5E, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8A, 0x36, 0x20, 0xE9, - -0x87, 0x77, 0x57, 0xE9, -0x8B, 0x3E, 0xBF, 0xEA, - -0x80, 0x30, 0x57, 0xE9, -0x81, 0x38, 0x57, 0xE9, - -0x82, 0x31, 0x57, 0xE9, -0x86, 0x78, 0x57, 0xE9, - -0x83, 0x39, 0x57, 0xE9, -0x87, 0x79, 0x57, 0xE9, - -0x30, 0x1F, 0x5F, 0xE9, -0x8A, 0x34, 0x20, 0xE9, - -0x8B, 0x3C, 0x20, 0xE9, -0x37, 0x50, 0x60, 0xBD, - -0x57, 0x0D, 0x20, 0xE9, -0x35, 0x51, 0x61, 0xBD, - -0x2B, 0x50, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x0E, 0x77, - -0x24, 0x51, 0x20, 0xE9, -0x8D, 0xFF, 0x20, 0xEA, - -0x16, 0x0E, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x0B, 0x46, 0xA0, 0xE8, -0x1B, 0x56, 0xA0, 0xE8, - -0x2B, 0x66, 0xA0, 0xE8, -0x0C, 0x47, 0xA0, 0xE8, - -0x1C, 0x57, 0xA0, 0xE8, -0x2C, 0x67, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x57, 0x80, 0x57, 0xCF, - -0x66, 0x33, 0x66, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x67, 0x3B, 0x67, 0xCF, - -0x0B, 0x48, 0xA0, 0xE8, -0x1B, 0x58, 0xA0, 0xE8, - -0x2B, 0x68, 0xA0, 0xE8, -0x0C, 0x49, 0xA0, 0xE8, - -0x1C, 0x59, 0xA0, 0xE8, -0x2C, 0x69, 0xA0, 0xE8, - -0x0B, 0x00, -0x1B, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x0C, 0x00, -0x1C, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x0B, 0x65, -0x1B, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x0C, 0x65, -0x1C, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x0B, 0x1B, 0x60, 0xEC, -0x34, 0xD7, 0x34, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x0C, 0x1C, 0x60, 0xEC, - -0x3C, 0xD7, 0x3C, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x0B, 0x2B, 0xDE, 0xE8, -0x1B, 0x80, 0xDE, 0xE8, - -0x34, 0x80, 0x34, 0xBD, -0x3C, 0x80, 0x3C, 0xBD, - -0x33, 0xD7, 0x0B, 0xBD, -0x3B, 0xD7, 0x1B, 0xBD, - -0x48, 0x80, 0x48, 0xCF, -0x59, 0x80, 0x59, 0xCF, - -0x68, 0x33, 0x68, 0xCF, -0x49, 0x3B, 0x49, 0xCF, - -0xAD, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x58, 0x33, 0x58, 0xCF, -0x69, 0x3B, 0x69, 0xCF, - -0x6B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgz[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x58, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x4A, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x1D, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xAF, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xD6, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x9D, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgza[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x5C, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x4E, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x27, 0xCF, 0x74, 0xC6, -0x3D, 0xCF, 0x74, 0xC2, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x20, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB4, -0x02, 0x44, 0x54, 0xB4, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xAB, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xD3, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x99, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzaf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x61, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x53, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x31, 0x53, 0x2F, 0x9F, -0x34, 0x37, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x26, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x27, 0xCF, 0x74, 0xC6, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB4, -0x02, 0x44, 0x54, 0xB4, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x3D, 0xCF, 0x75, 0xC6, -0x00, 0x80, 0x00, 0xE8, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x0A, 0x45, 0x4D, 0xB6, -0x02, 0x45, 0x55, 0xB6, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xA6, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xCD, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x94, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x5D, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x4F, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x3D, 0xCF, 0x74, 0xC0, -0x37, 0xCF, 0x74, 0xC4, - -0x39, 0xE5, 0x2C, 0x9F, -0x34, 0x80, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x88, 0x73, 0x5E, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x27, 0xCF, 0x75, 0xC6, -0x3C, 0x3D, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x20, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x3D, 0xCF, 0x74, 0xC2, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x27, 0x20, 0xE9, - -0x0A, 0x44, 0x4C, 0xB4, -0x02, 0x44, 0x54, 0xB4, - -0x2A, 0x45, 0x4D, 0xB6, -0x1A, 0x45, 0x55, 0xB6, - -0x39, 0xE5, 0x2C, 0x9F, -0x38, 0x3D, 0x20, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xAA, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xD3, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x98, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzs[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x65, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x57, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x29, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x0A, 0x20, -0x02, 0x20, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0xA7, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0xA2, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xCA, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x90, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzsa[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x6A, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x5C, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x2E, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x27, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0x9D, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xC5, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x8B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzsaf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x6E, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x60, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x32, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x27, 0xCF, 0x74, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x9C, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x44, 0x4C, 0xB6, -0x1A, 0x44, 0x54, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x0A, 0x45, 0x4D, 0xB6, -0x02, 0x45, 0x55, 0xB6, - -0x3D, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x31, 0x3D, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x9D, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x9E, 0x39, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x30, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x38, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0x99, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xC1, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x87, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; - -static unsigned char warp_g400_tgzsf[] = { - -0x00, 0x88, 0x98, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -0xFF, 0x80, 0xC0, 0xE9, -0x00, 0x80, 0x00, 0xE8, - -0x22, 0x40, 0x48, 0xBF, -0x2A, 0x40, 0x50, 0xBF, - -0x32, 0x41, 0x49, 0xBF, -0x3A, 0x41, 0x51, 0xBF, - -0xC3, 0x6B, -0xCB, 0x6B, -0x00, 0x88, 0x98, 0xE9, - -0x73, 0x7B, 0xC8, 0xEC, -0x96, 0xE2, -0x41, 0x04, - -0x7B, 0x43, 0xA0, 0xE8, -0x73, 0x4B, 0xA0, 0xE8, - -0xAD, 0xEE, 0x29, 0x9F, -0x00, 0xE0, -0x49, 0x04, - -0x90, 0xE2, -0x51, 0x04, -0x31, 0x46, 0xB1, 0xE8, - -0x49, 0x41, 0xC0, 0xEC, -0x39, 0x57, 0xB1, 0xE8, - -0x00, 0x04, -0x46, 0xE2, -0x73, 0x53, 0xA0, 0xE8, - -0x51, 0x41, 0xC0, 0xEC, -0x31, 0x00, -0x39, 0x00, - -0x6A, 0x80, 0x15, 0xEA, -0x08, 0x04, -0x10, 0x04, - -0x51, 0x49, 0xC0, 0xEC, -0x2F, 0x41, 0x60, 0xEA, - -0x31, 0x20, -0x39, 0x20, -0x1F, 0x42, 0xA0, 0xE8, - -0x2A, 0x42, 0x4A, 0xBF, -0x27, 0x4A, 0xA0, 0xE8, - -0x1A, 0x42, 0x52, 0xBF, -0x1E, 0x49, 0x60, 0xEA, - -0x73, 0x7B, 0xC8, 0xEC, -0x26, 0x51, 0x60, 0xEA, - -0x32, 0x40, 0x48, 0xBD, -0x22, 0x40, 0x50, 0xBD, - -0x12, 0x41, 0x49, 0xBD, -0x3A, 0x41, 0x51, 0xBD, - -0xBF, 0x2F, 0x26, 0xBD, -0x00, 0xE0, -0x7B, 0x72, - -0x32, 0x20, -0x22, 0x20, -0x12, 0x20, -0x3A, 0x20, - -0x46, 0x31, 0x46, 0xBF, -0x4E, 0x31, 0x4E, 0xBF, - -0xB3, 0xE2, 0x2D, 0x9F, -0x00, 0x80, 0x00, 0xE8, - -0x56, 0x31, 0x56, 0xBF, -0x47, 0x39, 0x47, 0xBF, - -0x4F, 0x39, 0x4F, 0xBF, -0x57, 0x39, 0x57, 0xBF, - -0x5C, 0x80, 0x07, 0xEA, -0x24, 0x41, 0x20, 0xE9, - -0x42, 0x73, 0xF8, 0xEC, -0x00, 0xE0, -0x2D, 0x73, - -0x33, 0x72, -0x0C, 0xE3, -0xA5, 0x2F, 0x1E, 0xBD, - -0x43, 0x43, 0x2D, 0xDF, -0x4B, 0x4B, 0x2D, 0xDF, - -0xAE, 0x1E, 0x26, 0xBD, -0x58, 0xE3, -0x33, 0x66, - -0x53, 0x53, 0x2D, 0xDF, -0x00, 0x80, 0x00, 0xE8, - -0xB8, 0x38, 0x33, 0xBF, -0x00, 0xE0, -0x59, 0xE3, - -0x1E, 0x12, 0x41, 0xE9, -0x1A, 0x22, 0x41, 0xE9, - -0x2B, 0x40, 0x3D, 0xE9, -0x3F, 0x4B, 0xA0, 0xE8, - -0x2D, 0x73, -0x30, 0x76, -0x05, 0x80, 0x3D, 0xEA, - -0x37, 0x43, 0xA0, 0xE8, -0x3D, 0x53, 0xA0, 0xE8, - -0x48, 0x70, 0xF8, 0xEC, -0x2B, 0x48, 0x3C, 0xE9, - -0x1F, 0x27, 0xBC, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x00, 0x80, 0x00, 0xE8, -0x00, 0x80, 0x00, 0xE8, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x15, 0xC0, 0x20, 0xE9, -0x15, 0xC0, 0x20, 0xE9, - -0x18, 0x3A, 0x41, 0xE9, -0x1D, 0x32, 0x41, 0xE9, - -0x2A, 0x40, 0x20, 0xE9, -0x56, 0x3D, 0x56, 0xDF, - -0x46, 0x37, 0x46, 0xDF, -0x4E, 0x3F, 0x4E, 0xDF, - -0x16, 0x30, 0x20, 0xE9, -0x4F, 0x3F, 0x4F, 0xDF, - -0x47, 0x37, 0x47, 0xDF, -0x57, 0x3D, 0x57, 0xDF, - -0x32, 0x32, 0x2D, 0xDF, -0x22, 0x22, 0x2D, 0xDF, - -0x12, 0x12, 0x2D, 0xDF, -0x3A, 0x3A, 0x2D, 0xDF, - -0x27, 0xCF, 0x74, 0xC2, -0x37, 0xCF, 0x74, 0xC4, - -0x0A, 0x44, 0x4C, 0xB0, -0x02, 0x44, 0x54, 0xB0, - -0x3D, 0xCF, 0x74, 0xC0, -0x34, 0x37, 0x20, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x38, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3C, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB2, -0x1A, 0x44, 0x54, 0xB2, - -0x2E, 0x80, 0x3A, 0xEA, -0x0A, 0x20, -0x02, 0x20, - -0x27, 0xCF, 0x75, 0xC0, -0x2A, 0x20, -0x1A, 0x20, - -0x30, 0x50, 0x2E, 0x9F, -0x32, 0x31, 0x5F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x33, 0x39, 0x5F, 0xE9, - -0x3D, 0xCF, 0x75, 0xC2, -0x37, 0xCF, 0x75, 0xC4, - -0x31, 0x53, 0x2F, 0x9F, -0xA6, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA3, 0x3D, 0x20, 0xE9, - -0x2A, 0x44, 0x4C, 0xB4, -0x1A, 0x44, 0x54, 0xB4, - -0x0A, 0x45, 0x4D, 0xB0, -0x02, 0x45, 0x55, 0xB0, - -0x88, 0x73, 0x5E, 0xE9, -0x2A, 0x20, -0x1A, 0x20, - -0xA0, 0x37, 0x20, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x3E, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x3F, 0x38, 0x4F, 0xE9, - -0x30, 0x50, 0x2E, 0x9F, -0x3A, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x3B, 0x39, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB2, -0x1A, 0x45, 0x55, 0xB2, - -0x0A, 0x45, 0x4D, 0xB4, -0x02, 0x45, 0x55, 0xB4, - -0x27, 0xCF, 0x75, 0xC6, -0x2A, 0x20, -0x1A, 0x20, - -0xA7, 0x30, 0x4F, 0xE9, -0x0A, 0x20, -0x02, 0x20, - -0x31, 0x53, 0x2F, 0x9F, -0x31, 0x27, 0x20, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA8, 0x38, 0x4F, 0xE9, - -0x2A, 0x45, 0x4D, 0xB6, -0x1A, 0x45, 0x55, 0xB6, - -0x30, 0x50, 0x2E, 0x9F, -0x36, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x37, 0x39, 0x4F, 0xE9, - -0x00, 0x80, 0x00, 0xE8, -0x2A, 0x20, -0x1A, 0x20, - -0x2A, 0x46, 0x4E, 0xBF, -0x1A, 0x46, 0x56, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA4, 0x31, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA5, 0x39, 0x4F, 0xE9, - -0x0A, 0x47, 0x4F, 0xBF, -0x02, 0x47, 0x57, 0xBF, - -0x31, 0x53, 0x2F, 0x9F, -0xA1, 0x30, 0x4F, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0xA2, 0x38, 0x4F, 0xE9, - -0x2A, 0x43, 0x4B, 0xBF, -0x1A, 0x43, 0x53, 0xBF, - -0x30, 0x50, 0x2E, 0x9F, -0x35, 0x31, 0x4F, 0xE9, - -0x38, 0x21, 0x2C, 0x9F, -0x39, 0x39, 0x4F, 0xE9, - -0x31, 0x53, 0x2F, 0x9F, -0x80, 0x31, 0x57, 0xE9, - -0x39, 0xE5, 0x2C, 0x9F, -0x81, 0x39, 0x57, 0xE9, - -0x37, 0x48, 0x50, 0xBD, -0x8A, 0x36, 0x20, 0xE9, - -0x86, 0x76, 0x57, 0xE9, -0x8B, 0x3E, 0x20, 0xE9, - -0x82, 0x30, 0x57, 0xE9, -0x87, 0x77, 0x57, 0xE9, - -0x83, 0x38, 0x57, 0xE9, -0x35, 0x49, 0x51, 0xBD, - -0x84, 0x31, 0x5E, 0xE9, -0x30, 0x1F, 0x5F, 0xE9, - -0x85, 0x39, 0x5E, 0xE9, -0x57, 0x25, 0x20, 0xE9, - -0x2B, 0x48, 0x20, 0xE9, -0x1D, 0x37, 0xE1, 0xEA, - -0x1E, 0x35, 0xE1, 0xEA, -0x00, 0xE0, -0x26, 0x77, - -0x24, 0x49, 0x20, 0xE9, -0x9D, 0xFF, 0x20, 0xEA, - -0x16, 0x26, 0x20, 0xE9, -0x57, 0x2E, 0xBF, 0xEA, - -0x1C, 0x46, 0xA0, 0xE8, -0x23, 0x4E, 0xA0, 0xE8, - -0x2B, 0x56, 0xA0, 0xE8, -0x1D, 0x47, 0xA0, 0xE8, - -0x24, 0x4F, 0xA0, 0xE8, -0x2C, 0x57, 0xA0, 0xE8, - -0x1C, 0x00, -0x23, 0x00, -0x2B, 0x00, -0x00, 0xE0, - -0x1D, 0x00, -0x24, 0x00, -0x2C, 0x00, -0x00, 0xE0, - -0x1C, 0x65, -0x23, 0x65, -0x2B, 0x65, -0x00, 0xE0, - -0x1D, 0x65, -0x24, 0x65, -0x2C, 0x65, -0x00, 0xE0, - -0x1C, 0x23, 0x60, 0xEC, -0x36, 0xD7, 0x36, 0xAD, - -0x2B, 0x80, 0x60, 0xEC, -0x1D, 0x24, 0x60, 0xEC, - -0x3E, 0xD7, 0x3E, 0xAD, -0x2C, 0x80, 0x60, 0xEC, - -0x1C, 0x2B, 0xDE, 0xE8, -0x23, 0x80, 0xDE, 0xE8, - -0x36, 0x80, 0x36, 0xBD, -0x3E, 0x80, 0x3E, 0xBD, - -0x33, 0xD7, 0x1C, 0xBD, -0x3B, 0xD7, 0x23, 0xBD, - -0x46, 0x80, 0x46, 0xCF, -0x4F, 0x80, 0x4F, 0xCF, - -0x56, 0x33, 0x56, 0xCF, -0x47, 0x3B, 0x47, 0xCF, - -0xC5, 0xFF, 0x20, 0xEA, -0x00, 0x80, 0x00, 0xE8, - -0x4E, 0x33, 0x4E, 0xCF, -0x57, 0x3B, 0x57, 0xCF, - -0x8B, 0xFF, 0x20, 0xEA, -0x57, 0xC0, 0xBF, 0xEA, - -0x00, 0x80, 0xA0, 0xE9, -0x00, 0x00, 0xD8, 0xEC, - -}; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:1.2 Fri Aug 17 22:51:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c Thu Feb 27 12:32:38 2003 @@ -1,210 +0,0 @@ -/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*- - * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "mga.h" -#include "drmP.h" -#include "mga_drv.h" -#include "mga_ucode.h" - - -#define MGA_WARP_CODE_ALIGN 256 /* in bytes */ - -#define WARP_UCODE_SIZE( which ) \ - ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN) - -#define WARP_UCODE_INSTALL( which, where ) \ -do { \ - DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\ - dev_priv->warp_pipe_phys[where] = pcbase; \ - memcpy( vcbase, which, sizeof(which) ); \ - pcbase += WARP_UCODE_SIZE( which ); \ - vcbase += WARP_UCODE_SIZE( which ); \ -} while (0) - - -static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv ) -{ - unsigned int size; - - size = ( WARP_UCODE_SIZE( warp_g400_tgz ) + - WARP_UCODE_SIZE( warp_g400_tgza ) + - WARP_UCODE_SIZE( warp_g400_tgzaf ) + - WARP_UCODE_SIZE( warp_g400_tgzf ) + - WARP_UCODE_SIZE( warp_g400_tgzs ) + - WARP_UCODE_SIZE( warp_g400_tgzsa ) + - WARP_UCODE_SIZE( warp_g400_tgzsaf ) + - WARP_UCODE_SIZE( warp_g400_tgzsf ) + - WARP_UCODE_SIZE( warp_g400_t2gz ) + - WARP_UCODE_SIZE( warp_g400_t2gza ) + - WARP_UCODE_SIZE( warp_g400_t2gzaf ) + - WARP_UCODE_SIZE( warp_g400_t2gzf ) + - WARP_UCODE_SIZE( warp_g400_t2gzs ) + - WARP_UCODE_SIZE( warp_g400_t2gzsa ) + - WARP_UCODE_SIZE( warp_g400_t2gzsaf ) + - WARP_UCODE_SIZE( warp_g400_t2gzsf ) ); - - size = PAGE_ALIGN( size ); - - DRM_DEBUG( "G400 ucode size = %d bytes\n", size ); - return size; -} - -static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv ) -{ - unsigned int size; - - size = ( WARP_UCODE_SIZE( warp_g200_tgz ) + - WARP_UCODE_SIZE( warp_g200_tgza ) + - WARP_UCODE_SIZE( warp_g200_tgzaf ) + - WARP_UCODE_SIZE( warp_g200_tgzf ) + - WARP_UCODE_SIZE( warp_g200_tgzs ) + - WARP_UCODE_SIZE( warp_g200_tgzsa ) + - WARP_UCODE_SIZE( warp_g200_tgzsaf ) + - WARP_UCODE_SIZE( warp_g200_tgzsf ) ); - - size = PAGE_ALIGN( size ); - - DRM_DEBUG( "G200 ucode size = %d bytes\n", size ); - return size; -} - -static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv ) -{ - unsigned char *vcbase = dev_priv->warp->handle; - unsigned long pcbase = dev_priv->warp->offset; - unsigned int size; - - size = mga_warp_g400_microcode_size( dev_priv ); - if ( size > dev_priv->warp->size ) { - DRM_ERROR( "microcode too large! (%u > %lu)\n", - size, dev_priv->warp->size ); - return -ENOMEM; - } - - memset( dev_priv->warp_pipe_phys, 0, - sizeof(dev_priv->warp_pipe_phys) ); - - WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ ); - WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF ); - WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA ); - WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF ); - WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS ); - WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF ); - WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA ); - WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF ); - - WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ ); - WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF ); - WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA ); - WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF ); - WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS ); - WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF ); - WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA ); - WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF ); - - return 0; -} - -static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv ) -{ - unsigned char *vcbase = dev_priv->warp->handle; - unsigned long pcbase = dev_priv->warp->offset; - unsigned int size; - - size = mga_warp_g200_microcode_size( dev_priv ); - if ( size > dev_priv->warp->size ) { - DRM_ERROR( "microcode too large! (%u > %lu)\n", - size, dev_priv->warp->size ); - return -ENOMEM; - } - - memset( dev_priv->warp_pipe_phys, 0, - sizeof(dev_priv->warp_pipe_phys) ); - - WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ ); - WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF ); - WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA ); - WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF ); - WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS ); - WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF ); - WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA ); - WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF ); - - return 0; -} - -int mga_warp_install_microcode( drm_mga_private_t *dev_priv ) -{ - switch ( dev_priv->chipset ) { - case MGA_CARD_TYPE_G400: - return mga_warp_install_g400_microcode( dev_priv ); - case MGA_CARD_TYPE_G200: - return mga_warp_install_g200_microcode( dev_priv ); - default: - return -EINVAL; - } -} - -#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) - -int mga_warp_init( drm_mga_private_t *dev_priv ) -{ - u32 wmisc; - - /* FIXME: Get rid of these damned magic numbers... - */ - switch ( dev_priv->chipset ) { - case MGA_CARD_TYPE_G400: - MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND ); - MGA_WRITE( MGA_WGETMSB, 0x00000E00 ); - MGA_WRITE( MGA_WVRTXSZ, 0x00001807 ); - MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 ); - break; - case MGA_CARD_TYPE_G200: - MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND ); - MGA_WRITE( MGA_WGETMSB, 0x1606 ); - MGA_WRITE( MGA_WVRTXSZ, 7 ); - break; - default: - return -EINVAL; - } - - MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE | - MGA_WMASTER_ENABLE | - MGA_WCACHEFLUSH_ENABLE) ); - wmisc = MGA_READ( MGA_WMISC ); - if ( wmisc != WMISC_EXPECTED ) { - DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n", - wmisc, WMISC_EXPECTED ); - return -EINVAL; - } - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h:1.2 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h Thu Feb 27 12:32:38 2003 @@ -1,81 +0,0 @@ -/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __R128_H__ -#define __R128_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) r128_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_SG 1 -#define __HAVE_PCI_DMA 1 - -/* Driver customization: - */ -#define DRIVER_PRERELEASE() do { \ - if ( dev->dev_private ) { \ - drm_r128_private_t *dev_priv = dev->dev_private; \ - if ( dev_priv->page_flipping ) { \ - r128_do_cleanup_pageflip( dev ); \ - } \ - } \ -} while (0) - -#define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 - -#if 0 -/* GH: Remove this for now... */ -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - drm_r128_private_t *dev_priv = dev->dev_private; \ - return r128_do_cce_idle( dev_priv ); \ -} while (0) -#endif - -/* Buffer customization: - */ -#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_r128_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.8 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c Thu Feb 27 12:32:38 2003 @@ -1,1035 +0,0 @@ -/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- - * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "r128.h" -#include "drmP.h" -#include "r128_drv.h" - -#include <linux/interrupt.h> /* For task queue support */ -#include <linux/delay.h> - -#define R128_FIFO_DEBUG 0 - - -/* CCE microcode (from ATI) */ -static u32 r128_cce_microcode[] = { - 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, - 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, - 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1, - 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11, - 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28, - 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, - 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, - 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, - 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071, - 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2, - 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1, - 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, - 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, - 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, - 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1, - 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82, - 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729, - 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008, - 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, - 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, - 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, - 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0, - 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370, - 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1, - 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793, - 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, - 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, - 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1, - 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1, - 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894, - 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14, - 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1, - 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, - 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, - 409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -int R128_READ_PLL(drm_device_t *dev, int addr) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - - R128_WRITE8(R128_CLOCK_CNTL_INDEX, addr & 0x1f); - return R128_READ(R128_CLOCK_CNTL_DATA); -} - -#if R128_FIFO_DEBUG -static void r128_status( drm_r128_private_t *dev_priv ) -{ - printk( "GUI_STAT = 0x%08x\n", - (unsigned int)R128_READ( R128_GUI_STAT ) ); - printk( "PM4_STAT = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_STAT ) ); - printk( "PM4_BUFFER_DL_WPTR = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_BUFFER_DL_WPTR ) ); - printk( "PM4_BUFFER_DL_RPTR = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_BUFFER_DL_RPTR ) ); - printk( "PM4_MICRO_CNTL = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_MICRO_CNTL ) ); - printk( "PM4_BUFFER_CNTL = 0x%08x\n", - (unsigned int)R128_READ( R128_PM4_BUFFER_CNTL ) ); -} -#endif - - -/* ================================================================ - * Engine, FIFO control - */ - -static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) -{ - u32 tmp; - int i; - - tmp = R128_READ( R128_PC_NGUI_CTLSTAT ) | R128_PC_FLUSH_ALL; - R128_WRITE( R128_PC_NGUI_CTLSTAT, tmp ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(R128_READ( R128_PC_NGUI_CTLSTAT ) & R128_PC_BUSY) ) { - return 0; - } - udelay( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "%s failed!\n", __FUNCTION__ ); -#endif - return -EBUSY; -} - -static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) -{ - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - int slots = R128_READ( R128_GUI_STAT ) & R128_GUI_FIFOCNT_MASK; - if ( slots >= entries ) return 0; - udelay( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "%s failed!\n", __FUNCTION__ ); -#endif - return -EBUSY; -} - -int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) -{ - int i, ret; - - ret = r128_do_wait_for_fifo( dev_priv, 64 ); - if ( ret < 0 ) return ret; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { - r128_do_pixcache_flush( dev_priv ); - return 0; - } - udelay( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "%s failed!\n", __FUNCTION__ ); -#endif - return -EBUSY; -} - - -/* ================================================================ - * CCE control, initialization - */ - -/* Load the microcode for the CCE */ -static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) -{ - int i; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - r128_do_wait_for_idle( dev_priv ); - - R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); - for ( i = 0 ; i < 256 ; i++ ) { - R128_WRITE( R128_PM4_MICROCODE_DATAH, - r128_cce_microcode[i * 2] ); - R128_WRITE( R128_PM4_MICROCODE_DATAL, - r128_cce_microcode[i * 2 + 1] ); - } -} - -/* Flush any pending commands to the CCE. This should only be used just - * prior to a wait for idle, as it informs the engine that the command - * stream is ending. - */ -static void r128_do_cce_flush( drm_r128_private_t *dev_priv ) -{ - u32 tmp; - - tmp = R128_READ( R128_PM4_BUFFER_DL_WPTR ) | R128_PM4_BUFFER_DL_DONE; - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, tmp ); -} - -/* Wait for the CCE to go idle. - */ -int r128_do_cce_idle( drm_r128_private_t *dev_priv ) -{ - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( GET_RING_HEAD( &dev_priv->ring ) == dev_priv->ring.tail ) { - int pm4stat = R128_READ( R128_PM4_STAT ); - if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= - dev_priv->cce_fifo_size ) && - !(pm4stat & (R128_PM4_BUSY | - R128_PM4_GUI_ACTIVE)) ) { - return r128_do_pixcache_flush( dev_priv ); - } - } - udelay( 1 ); - } - -#if R128_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - r128_status( dev_priv ); -#endif - return -EBUSY; -} - -/* Start the Concurrent Command Engine. - */ -static void r128_do_cce_start( drm_r128_private_t *dev_priv ) -{ - r128_do_wait_for_idle( dev_priv ); - - R128_WRITE( R128_PM4_BUFFER_CNTL, - dev_priv->cce_mode | dev_priv->ring.size_l2qw ); - R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ - R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); - - dev_priv->cce_running = 1; -} - -/* Reset the Concurrent Command Engine. This will not flush any pending - * commands, so you must wait for the CCE command stream to complete - * before calling this routine. - */ -static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) -{ - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); - R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - SET_RING_HEAD( &dev_priv->ring, 0 ); - dev_priv->ring.tail = 0; -} - -/* Stop the Concurrent Command Engine. This will not flush any pending - * commands, so you must flush the command stream and wait for the CCE - * to go idle before calling this routine. - */ -static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) -{ - R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); - R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 ); - - dev_priv->cce_running = 0; -} - -/* Reset the engine. This will stop the CCE if it is running. - */ -static int r128_do_engine_reset( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; - - r128_do_pixcache_flush( dev_priv ); - - clock_cntl_index = R128_READ( R128_CLOCK_CNTL_INDEX ); - mclk_cntl = R128_READ_PLL( dev, R128_MCLK_CNTL ); - - R128_WRITE_PLL( R128_MCLK_CNTL, - mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP ); - - gen_reset_cntl = R128_READ( R128_GEN_RESET_CNTL ); - - /* Taken from the sample code - do not change */ - R128_WRITE( R128_GEN_RESET_CNTL, - gen_reset_cntl | R128_SOFT_RESET_GUI ); - R128_READ( R128_GEN_RESET_CNTL ); - R128_WRITE( R128_GEN_RESET_CNTL, - gen_reset_cntl & ~R128_SOFT_RESET_GUI ); - R128_READ( R128_GEN_RESET_CNTL ); - - R128_WRITE_PLL( R128_MCLK_CNTL, mclk_cntl ); - R128_WRITE( R128_CLOCK_CNTL_INDEX, clock_cntl_index ); - R128_WRITE( R128_GEN_RESET_CNTL, gen_reset_cntl ); - - /* Reset the CCE ring */ - r128_do_cce_reset( dev_priv ); - - /* The CCE is no longer running after an engine reset */ - dev_priv->cce_running = 0; - - /* Reset any pending vertex, indirect buffers */ - r128_freelist_reset( dev ); - - return 0; -} - -static void r128_cce_init_ring_buffer( drm_device_t *dev, - drm_r128_private_t *dev_priv ) -{ - u32 ring_start; - u32 tmp; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* The manual (p. 2) says this address is in "VM space". This - * means it's an offset from the start of AGP space. - */ -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - ring_start = dev_priv->cce_ring->offset - dev->agp->base; - else -#endif - ring_start = dev_priv->cce_ring->offset - dev->sg->handle; - - R128_WRITE( R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET ); - - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); - R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - - /* DL_RPTR_ADDR is a physical address in AGP space. */ - SET_RING_HEAD( &dev_priv->ring, 0 ); - - if ( !dev_priv->is_pci ) { - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - dev_priv->ring_rptr->offset ); - } else { - drm_sg_mem_t *entry = dev->sg; - unsigned long tmp_ofs, page_ofs; - - tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; - page_ofs = tmp_ofs >> PAGE_SHIFT; - - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - entry->busaddr[page_ofs]); - DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", - entry->busaddr[page_ofs], - entry->handle + tmp_ofs ); - } - - /* Set watermark control */ - R128_WRITE( R128_PM4_BUFFER_WM_CNTL, - ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) - | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) - | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) - | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT) ); - - /* Force read. Why? Because it's in the examples... */ - R128_READ( R128_PM4_BUFFER_ADDR ); - - /* Turn on bus mastering */ - tmp = R128_READ( R128_BUS_CNTL ) & ~R128_BUS_MASTER_DIS; - R128_WRITE( R128_BUS_CNTL, tmp ); -} - -static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) -{ - drm_r128_private_t *dev_priv; - struct list_head *list; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); - if ( dev_priv == NULL ) - return -ENOMEM; - - memset( dev_priv, 0, sizeof(drm_r128_private_t) ); - - dev_priv->is_pci = init->is_pci; - - if ( dev_priv->is_pci && !dev->sg ) { - DRM_ERROR( "PCI GART memory not allocated!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - - dev_priv->usec_timeout = init->usec_timeout; - if ( dev_priv->usec_timeout < 1 || - dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { - DRM_DEBUG( "TIMEOUT problem!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - - dev_priv->cce_mode = init->cce_mode; - - /* GH: Simple idle check. - */ - atomic_set( &dev_priv->idle_count, 0 ); - - /* We don't support anything other than bus-mastering ring mode, - * but the ring can be in either AGP or PCI space for the ring - * read pointer. - */ - if ( ( init->cce_mode != R128_PM4_192BM ) && - ( init->cce_mode != R128_PM4_128BM_64INDBM ) && - ( init->cce_mode != R128_PM4_64BM_128INDBM ) && - ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { - DRM_DEBUG( "Bad cce_mode!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - - switch ( init->cce_mode ) { - case R128_PM4_NONPM4: - dev_priv->cce_fifo_size = 0; - break; - case R128_PM4_192PIO: - case R128_PM4_192BM: - dev_priv->cce_fifo_size = 192; - break; - case R128_PM4_128PIO_64INDBM: - case R128_PM4_128BM_64INDBM: - dev_priv->cce_fifo_size = 128; - break; - case R128_PM4_64PIO_128INDBM: - case R128_PM4_64BM_128INDBM: - case R128_PM4_64PIO_64VCBM_64INDBM: - case R128_PM4_64BM_64VCBM_64INDBM: - case R128_PM4_64PIO_64VCPIO_64INDPIO: - dev_priv->cce_fifo_size = 64; - break; - } - - switch ( init->fb_bpp ) { - case 16: - dev_priv->color_fmt = R128_DATATYPE_RGB565; - break; - case 32: - default: - dev_priv->color_fmt = R128_DATATYPE_ARGB8888; - break; - } - dev_priv->front_offset = init->front_offset; - dev_priv->front_pitch = init->front_pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->back_pitch = init->back_pitch; - - switch ( init->depth_bpp ) { - case 16: - dev_priv->depth_fmt = R128_DATATYPE_RGB565; - break; - case 24: - case 32: - default: - dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; - break; - } - dev_priv->depth_offset = init->depth_offset; - dev_priv->depth_pitch = init->depth_pitch; - dev_priv->span_offset = init->span_offset; - - dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch/8) << 21) | - (dev_priv->front_offset >> 5)); - dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch/8) << 21) | - (dev_priv->back_offset >> 5)); - dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | - (dev_priv->depth_offset >> 5) | - R128_DST_TILE); - dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | - (dev_priv->span_offset >> 5)); - - list_for_each(list, &dev->maplist->head) { - drm_map_list_t *r_list = (drm_map_list_t *)list; - if( r_list->map && - r_list->map->type == _DRM_SHM && - r_list->map->flags & _DRM_CONTAINS_LOCK ) { - dev_priv->sarea = r_list->map; - break; - } - } - if(!dev_priv->sarea) { - DRM_ERROR("could not find sarea!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR("could not find framebuffer!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - if(!dev_priv->mmio) { - DRM_ERROR("could not find mmio region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); - if(!dev_priv->cce_ring) { - DRM_ERROR("could not find cce ring region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - if(!dev_priv->ring_rptr) { - DRM_ERROR("could not find ring read pointer!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); - if(!dev_priv->buffers) { - DRM_ERROR("could not find dma buffer region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - - if ( !dev_priv->is_pci ) { - DRM_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); - if(!dev_priv->agp_textures) { - DRM_ERROR("could not find agp texture region!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -EINVAL; - } - } - - dev_priv->sarea_priv = - (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + - init->sarea_priv_offset); - - if ( !dev_priv->is_pci ) { - DRM_IOREMAP( dev_priv->cce_ring ); - DRM_IOREMAP( dev_priv->ring_rptr ); - DRM_IOREMAP( dev_priv->buffers ); - if(!dev_priv->cce_ring->handle || - !dev_priv->ring_rptr->handle || - !dev_priv->buffers->handle) { - DRM_ERROR("Could not ioremap agp regions!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -ENOMEM; - } - } else { - dev_priv->cce_ring->handle = - (void *)dev_priv->cce_ring->offset; - dev_priv->ring_rptr->handle = - (void *)dev_priv->ring_rptr->offset; - dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; - } - -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - dev_priv->cce_buffers_offset = dev->agp->base; - else -#endif - dev_priv->cce_buffers_offset = dev->sg->handle; - - dev_priv->ring.head = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle); - - dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; - dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle - + init->ring_size / sizeof(u32)); - dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); - - dev_priv->ring.tail_mask = - (dev_priv->ring.size / sizeof(u32)) - 1; - - dev_priv->ring.high_mark = 128; - - dev_priv->sarea_priv->last_frame = 0; - R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); - - dev_priv->sarea_priv->last_dispatch = 0; - R128_WRITE( R128_LAST_DISPATCH_REG, - dev_priv->sarea_priv->last_dispatch ); - - if ( dev_priv->is_pci ) { - if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, - &dev_priv->bus_pci_gart) ) { - DRM_ERROR( "failed to init PCI GART!\n" ); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return -ENOMEM; - } - R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); - } - - r128_cce_init_ring_buffer( dev, dev_priv ); - r128_cce_load_microcode( dev_priv ); - - dev->dev_private = (void *)dev_priv; - - r128_do_engine_reset( dev ); - - return 0; -} - -int r128_do_cleanup_cce( drm_device_t *dev ) -{ - if ( dev->dev_private ) { - drm_r128_private_t *dev_priv = dev->dev_private; - - if ( !dev_priv->is_pci ) { - DRM_IOREMAPFREE( dev_priv->cce_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); - } else { - if (!DRM(ati_pcigart_cleanup)( dev, - dev_priv->phys_pci_gart, - dev_priv->bus_pci_gart )) - DRM_ERROR( "failed to cleanup PCI GART!\n" ); - } - - DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), - DRM_MEM_DRIVER ); - dev->dev_private = NULL; - } - - return 0; -} - -int r128_cce_init( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_init_t init; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( copy_from_user( &init, (drm_r128_init_t *)arg, sizeof(init) ) ) - return -EFAULT; - - switch ( init.func ) { - case R128_INIT_CCE: - return r128_do_init_cce( dev, &init ); - case R128_CLEANUP_CCE: - return r128_do_cleanup_cce( dev ); - } - - return -EINVAL; -} - -int r128_cce_start( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { - DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); - return 0; - } - - r128_do_cce_start( dev_priv ); - - return 0; -} - -/* Stop the CCE. The engine must have been idled before calling this - * routine. - */ -int r128_cce_stop( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_cce_stop_t stop; - int ret; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &stop, (drm_r128_init_t *)arg, sizeof(stop) ) ) - return -EFAULT; - - /* Flush any pending CCE commands. This ensures any outstanding - * commands are exectuted by the engine before we turn it off. - */ - if ( stop.flush ) { - r128_do_cce_flush( dev_priv ); - } - - /* If we fail to make the engine go idle, we return an error - * code so that the DRM ioctl wrapper can try again. - */ - if ( stop.idle ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - } - - /* Finally, we can turn off the CCE. If the engine isn't idle, - * we will get some dropped triangles as they won't be fully - * rendered before the CCE is shut down. - */ - r128_do_cce_stop( dev_priv ); - - /* Reset the engine */ - r128_do_engine_reset( dev ); - - return 0; -} - -/* Just reset the CCE ring. Called as part of an X Server engine reset. - */ -int r128_cce_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); - return -EINVAL; - } - - r128_do_cce_reset( dev_priv ); - - /* The CCE is no longer running after an engine reset */ - dev_priv->cce_running = 0; - - return 0; -} - -int r128_cce_idle( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( dev_priv->cce_running ) { - r128_do_cce_flush( dev_priv ); - } - - return r128_do_cce_idle( dev_priv ); -} - -int r128_engine_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - return r128_do_engine_reset( dev ); -} - - -/* ================================================================ - * Fullscreen mode - */ - -static int r128_do_init_pageflip( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv->crtc_offset = R128_READ( R128_CRTC_OFFSET ); - dev_priv->crtc_offset_cntl = R128_READ( R128_CRTC_OFFSET_CNTL ); - - R128_WRITE( R128_CRTC_OFFSET, dev_priv->front_offset ); - R128_WRITE( R128_CRTC_OFFSET_CNTL, - dev_priv->crtc_offset_cntl | R128_CRTC_OFFSET_FLIP_CNTL ); - - dev_priv->page_flipping = 1; - dev_priv->current_page = 0; - - return 0; -} - -int r128_do_cleanup_pageflip( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - R128_WRITE( R128_CRTC_OFFSET, dev_priv->crtc_offset ); - R128_WRITE( R128_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); - - dev_priv->page_flipping = 0; - dev_priv->current_page = 0; - - return 0; -} - -int r128_fullscreen( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_fullscreen_t fs; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &fs, (drm_r128_fullscreen_t *)arg, sizeof(fs) ) ) - return -EFAULT; - - switch ( fs.func ) { - case R128_INIT_FULLSCREEN: - return r128_do_init_pageflip( dev ); - case R128_CLEANUP_FULLSCREEN: - return r128_do_cleanup_pageflip( dev ); - } - - return -EINVAL; -} - - -/* ================================================================ - * Freelist management - */ -#define R128_BUFFER_USED 0xffffffff -#define R128_BUFFER_FREE 0 - -#if 0 -static int r128_freelist_init( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_freelist_t *entry; - int i; - - dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); - if ( dev_priv->head == NULL ) - return -ENOMEM; - - memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) ); - dev_priv->head->age = R128_BUFFER_USED; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - - entry = DRM(alloc)( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); - if ( !entry ) return -ENOMEM; - - entry->age = R128_BUFFER_FREE; - entry->buf = buf; - entry->prev = dev_priv->head; - entry->next = dev_priv->head->next; - if ( !entry->next ) - dev_priv->tail = entry; - - buf_priv->discard = 0; - buf_priv->dispatched = 0; - buf_priv->list_entry = entry; - - dev_priv->head->next = entry; - - if ( dev_priv->head->next ) - dev_priv->head->next->prev = entry; - } - - return 0; - -} -#endif - -drm_buf_t *r128_freelist_get( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv; - drm_buf_t *buf; - int i, t; - - /* FIXME: Optimize -- use freelist code */ - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pid == 0 ) - return buf; - } - - for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { - u32 done_age = R128_READ( R128_LAST_DISPATCH_REG ); - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pending && buf_priv->age <= done_age ) { - /* The buffer has been processed, so it - * can now be used. - */ - buf->pending = 0; - return buf; - } - } - udelay( 1 ); - } - - DRM_ERROR( "returning NULL!\n" ); - return NULL; -} - -void r128_freelist_reset( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - int i; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - drm_buf_t *buf = dma->buflist[i]; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - buf_priv->age = 0; - } -} - - -/* ================================================================ - * CCE command submission - */ - -int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) -{ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - r128_update_ring_snapshot( ring ); - if ( ring->space >= n ) - return 0; - udelay( 1 ); - } - - /* FIXME: This is being ignored... */ - DRM_ERROR( "failed!\n" ); - return -EBUSY; -} - -static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d ) -{ - int i; - drm_buf_t *buf; - - for ( i = d->granted_count ; i < d->request_count ; i++ ) { - buf = r128_freelist_get( dev ); - if ( !buf ) return -EAGAIN; - - buf->pid = current->pid; - - if ( copy_to_user( &d->request_indices[i], &buf->idx, - sizeof(buf->idx) ) ) - return -EFAULT; - if ( copy_to_user( &d->request_sizes[i], &buf->total, - sizeof(buf->total) ) ) - return -EFAULT; - - d->granted_count++; - } - return 0; -} - -int r128_cce_buffers( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int ret = 0; - drm_dma_t d; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) ) - return -EFAULT; - - /* Please don't send us buffers. - */ - if ( d.send_count != 0 ) { - DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", - current->pid, d.send_count ); - return -EINVAL; - } - - /* We'll send you buffers. - */ - if ( d.request_count < 0 || d.request_count > dma->buf_count ) { - DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", - current->pid, d.request_count, dma->buf_count ); - return -EINVAL; - } - - d.granted_count = 0; - - if ( d.request_count ) { - ret = r128_cce_get_buffers( dev, &d ); - } - - if ( copy_to_user( (drm_dma_t *) arg, &d, sizeof(d) ) ) - return -EFAULT; - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h:1.10 Thu May 31 22:10:07 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h Thu Feb 27 12:32:38 2003 @@ -1,287 +0,0 @@ -/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- - * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - */ - -#ifndef __R128_DRM_H__ -#define __R128_DRM_H__ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the X server file (r128_sarea.h) - */ -#ifndef __R128_SAREA_DEFINES__ -#define __R128_SAREA_DEFINES__ - -/* What needs to be changed for the current vertex buffer? - */ -#define R128_UPLOAD_CONTEXT 0x001 -#define R128_UPLOAD_SETUP 0x002 -#define R128_UPLOAD_TEX0 0x004 -#define R128_UPLOAD_TEX1 0x008 -#define R128_UPLOAD_TEX0IMAGES 0x010 -#define R128_UPLOAD_TEX1IMAGES 0x020 -#define R128_UPLOAD_CORE 0x040 -#define R128_UPLOAD_MASKS 0x080 -#define R128_UPLOAD_WINDOW 0x100 -#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ -#define R128_REQUIRE_QUIESCENCE 0x400 -#define R128_UPLOAD_ALL 0x7ff - -#define R128_FRONT 0x1 -#define R128_BACK 0x2 -#define R128_DEPTH 0x4 - -/* Primitive types - */ -#define R128_POINTS 0x1 -#define R128_LINES 0x2 -#define R128_LINE_STRIP 0x3 -#define R128_TRIANGLES 0x4 -#define R128_TRIANGLE_FAN 0x5 -#define R128_TRIANGLE_STRIP 0x6 - -/* Vertex/indirect buffer size - */ -#define R128_BUFFER_SIZE 16384 - -/* Byte offsets for indirect buffer data - */ -#define R128_INDEX_PRIM_OFFSET 20 -#define R128_HOSTDATA_BLIT_OFFSET 32 - -/* Keep these small for testing. - */ -#define R128_NR_SAREA_CLIPRECTS 12 - -/* There are 2 heaps (local/AGP). Each region within a heap is a - * minimum of 64k, and there are at most 64 of them per heap. - */ -#define R128_LOCAL_TEX_HEAP 0 -#define R128_AGP_TEX_HEAP 1 -#define R128_NR_TEX_HEAPS 2 -#define R128_NR_TEX_REGIONS 64 -#define R128_LOG_TEX_GRANULARITY 16 - -#define R128_NR_CONTEXT_REGS 12 - -#define R128_MAX_TEXTURE_LEVELS 11 -#define R128_MAX_TEXTURE_UNITS 2 - -#endif /* __R128_SAREA_DEFINES__ */ - -typedef struct { - /* Context state - can be written in one large chunk */ - unsigned int dst_pitch_offset_c; - unsigned int dp_gui_master_cntl_c; - unsigned int sc_top_left_c; - unsigned int sc_bottom_right_c; - unsigned int z_offset_c; - unsigned int z_pitch_c; - unsigned int z_sten_cntl_c; - unsigned int tex_cntl_c; - unsigned int misc_3d_state_cntl_reg; - unsigned int texture_clr_cmp_clr_c; - unsigned int texture_clr_cmp_msk_c; - unsigned int fog_color_c; - - /* Texture state */ - unsigned int tex_size_pitch_c; - unsigned int constant_color_c; - - /* Setup state */ - unsigned int pm4_vc_fpu_setup; - unsigned int setup_cntl; - - /* Mask state */ - unsigned int dp_write_mask; - unsigned int sten_ref_mask_c; - unsigned int plane_3d_mask_c; - - /* Window state */ - unsigned int window_xy_offset; - - /* Core state */ - unsigned int scale_3d_cntl; -} drm_r128_context_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int tex_cntl; - unsigned int tex_combine_cntl; - unsigned int tex_size_pitch; - unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; - unsigned int tex_border_color; -} drm_r128_texture_regs_t; - - -typedef struct drm_r128_sarea { - /* The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ - drm_r128_context_regs_t context_state; - drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; - - /* The current cliprects, or a subset thereof. - */ - drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Counters for client-side throttling of rendering clients. - */ - unsigned int last_frame; - unsigned int last_dispatch; - - drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; - int tex_age[R128_NR_TEX_HEAPS]; - int ctx_owner; -} drm_r128_sarea_t; - - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmR128.h) - */ -typedef struct drm_r128_init { - enum { - R128_INIT_CCE = 0x01, - R128_CLEANUP_CCE = 0x02 - } func; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int sarea_priv_offset; -#else - unsigned long sarea_priv_offset; -#endif - int is_pci; - int cce_mode; - int cce_secure; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - unsigned int span_offset; - -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; -#else - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -#endif -} drm_r128_init_t; - -typedef struct drm_r128_cce_stop { - int flush; - int idle; -} drm_r128_cce_stop_t; - -typedef struct drm_r128_clear { - unsigned int flags; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int x, y, w, h; -#endif - unsigned int clear_color; - unsigned int clear_depth; -#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) - unsigned int color_mask; - unsigned int depth_mask; -#endif -} drm_r128_clear_t; - -typedef struct drm_r128_vertex { - int prim; - int idx; /* Index of vertex buffer */ - int count; /* Number of vertices in buffer */ - int discard; /* Client finished with buffer? */ -} drm_r128_vertex_t; - -typedef struct drm_r128_indices { - int prim; - int idx; - int start; - int end; - int discard; /* Client finished with buffer? */ -} drm_r128_indices_t; - -typedef struct drm_r128_blit { - int idx; - int pitch; - int offset; - int format; - unsigned short x, y; - unsigned short width, height; -} drm_r128_blit_t; - -typedef struct drm_r128_depth { - enum { - R128_WRITE_SPAN = 0x01, - R128_WRITE_PIXELS = 0x02, - R128_READ_SPAN = 0x03, - R128_READ_PIXELS = 0x04 - } func; - int n; - int *x; - int *y; - unsigned int *buffer; - unsigned char *mask; -} drm_r128_depth_t; - -typedef struct drm_r128_stipple { - unsigned int *mask; -} drm_r128_stipple_t; - -typedef struct drm_r128_indirect { - int idx; - int start; - int end; - int discard; -} drm_r128_indirect_t; - -typedef struct drm_r128_fullscreen { - enum { - R128_INIT_FULLSCREEN = 0x01, - R128_CLEANUP_FULLSCREEN = 0x02 - } func; -} drm_r128_fullscreen_t; - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.16 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.17 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.16 Mon Nov 26 16:46:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c Wed Oct 30 07:52:37 2002 @@ -32,48 +32,11 @@ #include <linux/config.h> #include "r128.h" #include "drmP.h" +#include "drm.h" +#include "r128_drm.h" #include "r128_drv.h" #include "ati_pcigart.h" -#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - -#define DRIVER_NAME "r128" -#define DRIVER_DESC "ATI Rage 128" -#define DRIVER_DATE "20010917" - -#define DRIVER_MAJOR 2 -#define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, - - -#if 0 -/* GH: Count data sent to card via ring or vertex/indirect buffers. - */ -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#endif - - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" @@ -81,26 +44,6 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init r128_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", r128_options ); -#endif - #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.12 Fri Aug 17 22:51:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h Thu Feb 27 12:32:38 2003 @@ -1,549 +0,0 @@ -/* r128_drv.h -- Private header for r128 driver -*- linux-c -*- - * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * Michel Dänzer <daenzerm@student.ethz.ch> - */ - -#ifndef __R128_DRV_H__ -#define __R128_DRV_H__ - -#define GET_RING_HEAD( ring ) le32_to_cpu( *(ring)->head ) -#define SET_RING_HEAD( ring, val ) *(ring)->head = cpu_to_le32( val ) - -typedef struct drm_r128_freelist { - unsigned int age; - drm_buf_t *buf; - struct drm_r128_freelist *next; - struct drm_r128_freelist *prev; -} drm_r128_freelist_t; - -typedef struct drm_r128_ring_buffer { - u32 *start; - u32 *end; - int size; - int size_l2qw; - - volatile u32 *head; - u32 tail; - u32 tail_mask; - int space; - - int high_mark; -} drm_r128_ring_buffer_t; - -typedef struct drm_r128_private { - drm_r128_ring_buffer_t ring; - drm_r128_sarea_t *sarea_priv; - - int cce_mode; - int cce_fifo_size; - int cce_running; - - drm_r128_freelist_t *head; - drm_r128_freelist_t *tail; - - int usec_timeout; - int is_pci; - unsigned long phys_pci_gart; - dma_addr_t bus_pci_gart; - unsigned long cce_buffers_offset; - - atomic_t idle_count; - - int page_flipping; - int current_page; - u32 crtc_offset; - u32 crtc_offset_cntl; - - u32 color_fmt; - unsigned int front_offset; - unsigned int front_pitch; - unsigned int back_offset; - unsigned int back_pitch; - - u32 depth_fmt; - unsigned int depth_offset; - unsigned int depth_pitch; - unsigned int span_offset; - - u32 front_pitch_offset_c; - u32 back_pitch_offset_c; - u32 depth_pitch_offset_c; - u32 span_pitch_offset_c; - - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *mmio; - drm_map_t *cce_ring; - drm_map_t *ring_rptr; - drm_map_t *buffers; - drm_map_t *agp_textures; -} drm_r128_private_t; - -typedef struct drm_r128_buf_priv { - u32 age; - int prim; - int discard; - int dispatched; - drm_r128_freelist_t *list_entry; -} drm_r128_buf_priv_t; - - /* r128_cce.c */ -extern int r128_cce_init( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_start( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_stop( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_idle( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_engine_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_fullscreen( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_buffers( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - -extern void r128_freelist_reset( drm_device_t *dev ); -extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); - -extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); - -static inline void -r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) -{ - ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - -extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); -extern int r128_do_cleanup_cce( drm_device_t *dev ); -extern int r128_do_cleanup_pageflip( drm_device_t *dev ); - - /* r128_state.c */ -extern int r128_cce_clear( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_swap( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_vertex( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_indices( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_blit( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_depth( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_stipple( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_cce_indirect( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - - -/* Register definitions, register access macros and drmAddMap constants - * for Rage 128 kernel driver. - */ - -#define R128_AUX_SC_CNTL 0x1660 -# define R128_AUX1_SC_EN (1 << 0) -# define R128_AUX1_SC_MODE_OR (0 << 1) -# define R128_AUX1_SC_MODE_NAND (1 << 1) -# define R128_AUX2_SC_EN (1 << 2) -# define R128_AUX2_SC_MODE_OR (0 << 3) -# define R128_AUX2_SC_MODE_NAND (1 << 3) -# define R128_AUX3_SC_EN (1 << 4) -# define R128_AUX3_SC_MODE_OR (0 << 5) -# define R128_AUX3_SC_MODE_NAND (1 << 5) -#define R128_AUX1_SC_LEFT 0x1664 -#define R128_AUX1_SC_RIGHT 0x1668 -#define R128_AUX1_SC_TOP 0x166c -#define R128_AUX1_SC_BOTTOM 0x1670 -#define R128_AUX2_SC_LEFT 0x1674 -#define R128_AUX2_SC_RIGHT 0x1678 -#define R128_AUX2_SC_TOP 0x167c -#define R128_AUX2_SC_BOTTOM 0x1680 -#define R128_AUX3_SC_LEFT 0x1684 -#define R128_AUX3_SC_RIGHT 0x1688 -#define R128_AUX3_SC_TOP 0x168c -#define R128_AUX3_SC_BOTTOM 0x1690 - -#define R128_BRUSH_DATA0 0x1480 -#define R128_BUS_CNTL 0x0030 -# define R128_BUS_MASTER_DIS (1 << 6) - -#define R128_CLOCK_CNTL_INDEX 0x0008 -#define R128_CLOCK_CNTL_DATA 0x000c -# define R128_PLL_WR_EN (1 << 7) -#define R128_CONSTANT_COLOR_C 0x1d34 -#define R128_CRTC_OFFSET 0x0224 -#define R128_CRTC_OFFSET_CNTL 0x0228 -# define R128_CRTC_OFFSET_FLIP_CNTL (1 << 16) - -#define R128_DP_GUI_MASTER_CNTL 0x146c -# define R128_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define R128_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define R128_GMC_BRUSH_NONE (15 << 4) -# define R128_GMC_DST_16BPP (4 << 8) -# define R128_GMC_DST_24BPP (5 << 8) -# define R128_GMC_DST_32BPP (6 << 8) -# define R128_GMC_DST_DATATYPE_SHIFT 8 -# define R128_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define R128_DP_SRC_SOURCE_MEMORY (2 << 24) -# define R128_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define R128_GMC_AUX_CLIP_DIS (1 << 29) -# define R128_GMC_WR_MSK_DIS (1 << 30) -# define R128_ROP3_S 0x00cc0000 -# define R128_ROP3_P 0x00f00000 -#define R128_DP_WRITE_MASK 0x16cc -#define R128_DST_PITCH_OFFSET_C 0x1c80 -# define R128_DST_TILE (1 << 31) - -#define R128_GEN_RESET_CNTL 0x00f0 -# define R128_SOFT_RESET_GUI (1 << 0) - -#define R128_GUI_SCRATCH_REG0 0x15e0 -#define R128_GUI_SCRATCH_REG1 0x15e4 -#define R128_GUI_SCRATCH_REG2 0x15e8 -#define R128_GUI_SCRATCH_REG3 0x15ec -#define R128_GUI_SCRATCH_REG4 0x15f0 -#define R128_GUI_SCRATCH_REG5 0x15f4 - -#define R128_GUI_STAT 0x1740 -# define R128_GUI_FIFOCNT_MASK 0x0fff -# define R128_GUI_ACTIVE (1 << 31) - -#define R128_MCLK_CNTL 0x000f -# define R128_FORCE_GCP (1 << 16) -# define R128_FORCE_PIPE3D_CP (1 << 17) -# define R128_FORCE_RCP (1 << 18) - -#define R128_PC_GUI_CTLSTAT 0x1748 -#define R128_PC_NGUI_CTLSTAT 0x0184 -# define R128_PC_FLUSH_GUI (3 << 0) -# define R128_PC_RI_GUI (1 << 2) -# define R128_PC_FLUSH_ALL 0x00ff -# define R128_PC_BUSY (1 << 31) - -#define R128_PCI_GART_PAGE 0x017c -#define R128_PRIM_TEX_CNTL_C 0x1cb0 - -#define R128_SCALE_3D_CNTL 0x1a00 -#define R128_SEC_TEX_CNTL_C 0x1d00 -#define R128_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c -#define R128_SETUP_CNTL 0x1bc4 -#define R128_STEN_REF_MASK_C 0x1d40 - -#define R128_TEX_CNTL_C 0x1c9c -# define R128_TEX_CACHE_FLUSH (1 << 23) - -#define R128_WAIT_UNTIL 0x1720 -# define R128_EVENT_CRTC_OFFSET (1 << 0) -#define R128_WINDOW_XY_OFFSET 0x1bcc - - -/* CCE registers - */ -#define R128_PM4_BUFFER_OFFSET 0x0700 -#define R128_PM4_BUFFER_CNTL 0x0704 -# define R128_PM4_MASK (15 << 28) -# define R128_PM4_NONPM4 (0 << 28) -# define R128_PM4_192PIO (1 << 28) -# define R128_PM4_192BM (2 << 28) -# define R128_PM4_128PIO_64INDBM (3 << 28) -# define R128_PM4_128BM_64INDBM (4 << 28) -# define R128_PM4_64PIO_128INDBM (5 << 28) -# define R128_PM4_64BM_128INDBM (6 << 28) -# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) - -#define R128_PM4_BUFFER_WM_CNTL 0x0708 -# define R128_WMA_SHIFT 0 -# define R128_WMB_SHIFT 8 -# define R128_WMC_SHIFT 16 -# define R128_WB_WM_SHIFT 24 - -#define R128_PM4_BUFFER_DL_RPTR_ADDR 0x070c -#define R128_PM4_BUFFER_DL_RPTR 0x0710 -#define R128_PM4_BUFFER_DL_WPTR 0x0714 -# define R128_PM4_BUFFER_DL_DONE (1 << 31) - -#define R128_PM4_VC_FPU_SETUP 0x071c - -#define R128_PM4_IW_INDOFF 0x0738 -#define R128_PM4_IW_INDSIZE 0x073c - -#define R128_PM4_STAT 0x07b8 -# define R128_PM4_FIFOCNT_MASK 0x0fff -# define R128_PM4_BUSY (1 << 16) -# define R128_PM4_GUI_ACTIVE (1 << 31) - -#define R128_PM4_MICROCODE_ADDR 0x07d4 -#define R128_PM4_MICROCODE_RADDR 0x07d8 -#define R128_PM4_MICROCODE_DATAH 0x07dc -#define R128_PM4_MICROCODE_DATAL 0x07e0 - -#define R128_PM4_BUFFER_ADDR 0x07f0 -#define R128_PM4_MICRO_CNTL 0x07fc -# define R128_PM4_MICRO_FREERUN (1 << 30) - -#define R128_PM4_FIFO_DATA_EVEN 0x1000 -#define R128_PM4_FIFO_DATA_ODD 0x1004 - - -/* CCE command packets - */ -#define R128_CCE_PACKET0 0x00000000 -#define R128_CCE_PACKET1 0x40000000 -#define R128_CCE_PACKET2 0x80000000 -#define R128_CCE_PACKET3 0xC0000000 -# define R128_CNTL_HOSTDATA_BLT 0x00009400 -# define R128_CNTL_PAINT_MULTI 0x00009A00 -# define R128_CNTL_BITBLT_MULTI 0x00009B00 -# define R128_3D_RNDR_GEN_INDX_PRIM 0x00002300 - -#define R128_CCE_PACKET_MASK 0xC0000000 -#define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 -#define R128_CCE_PACKET0_REG_MASK 0x000007ff -#define R128_CCE_PACKET1_REG0_MASK 0x000007ff -#define R128_CCE_PACKET1_REG1_MASK 0x003ff800 - -#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 -#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 -#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 -#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 -#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 -#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 -#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 -#define R128_CCE_VC_CNTL_NUM_SHIFT 16 - -#define R128_DATATYPE_CI8 2 -#define R128_DATATYPE_ARGB1555 3 -#define R128_DATATYPE_RGB565 4 -#define R128_DATATYPE_RGB888 5 -#define R128_DATATYPE_ARGB8888 6 -#define R128_DATATYPE_RGB332 7 -#define R128_DATATYPE_RGB8 9 -#define R128_DATATYPE_ARGB4444 15 - -/* Constants */ -#define R128_AGP_OFFSET 0x02000000 - -#define R128_WATERMARK_L 16 -#define R128_WATERMARK_M 8 -#define R128_WATERMARK_N 8 -#define R128_WATERMARK_K 128 - -#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ - -#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 -#define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 -#define R128_MAX_VB_AGE 0x7fffffff -#define R128_MAX_VB_VERTS (0xffff) - -#define R128_RING_HIGH_MARK 128 - -#define R128_PERFORMANCE_BOXES 0 - - -#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) -#define R128_ADDR(reg) (R128_BASE( reg ) + reg) - -#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) -#ifdef __alpha__ -#define R128_READ(reg) (_R128_READ((u32 *)R128_ADDR(reg))) -static inline u32 _R128_READ(u32 *addr) -{ - mb(); - return *(volatile u32 *)addr; -} -#define R128_WRITE(reg,val) \ -do { \ - wmb(); \ - R128_DEREF(reg) = val; \ -} while (0) -#else -#define R128_READ(reg) le32_to_cpu( R128_DEREF( reg ) ) -#define R128_WRITE(reg,val) \ -do { \ - R128_DEREF( reg ) = cpu_to_le32( val ); \ -} while (0) -#endif - -#define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg ) -#ifdef __alpha__ -#define R128_READ8(reg) _R128_READ8((u8 *)R128_ADDR(reg)) -static inline u8 _R128_READ8(u8 *addr) -{ - mb(); - return *(volatile u8 *)addr; -} -#define R128_WRITE8(reg,val) \ -do { \ - wmb(); \ - R128_DEREF8(reg) = val; \ -} while (0) -#else -#define R128_READ8(reg) R128_DEREF8( reg ) -#define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0) -#endif - -#define R128_WRITE_PLL(addr,val) \ -do { \ - R128_WRITE8(R128_CLOCK_CNTL_INDEX, \ - ((addr) & 0x1f) | R128_PLL_WR_EN); \ - R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \ -} while (0) - -extern int R128_READ_PLL(drm_device_t *dev, int addr); - - -#define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \ - ((n) << 16) | ((reg) >> 2)) -#define CCE_PACKET1( reg0, reg1 ) (R128_CCE_PACKET1 | \ - (((reg1) >> 2) << 11) | ((reg0) >> 2)) -#define CCE_PACKET2() (R128_CCE_PACKET2) -#define CCE_PACKET3( pkt, n ) (R128_CCE_PACKET3 | \ - (pkt) | ((n) << 16)) - - -/* ================================================================ - * Misc helper macros - */ - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != current->pid ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - return -EINVAL; \ - } \ -} while (0) - -#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ - if ( ring->space < ring->high_mark ) { \ - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - r128_update_ring_snapshot( ring ); \ - if ( ring->space >= ring->high_mark ) \ - goto __ring_space_done; \ - udelay( 1 ); \ - } \ - DRM_ERROR( "ring space check failed!\n" ); \ - return -EBUSY; \ - } \ - __ring_space_done: \ -} while (0) - -#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \ - if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \ - int __ret = r128_do_cce_idle( dev_priv ); \ - if ( __ret < 0 ) return __ret; \ - sarea_priv->last_dispatch = 0; \ - r128_freelist_reset( dev ); \ - } \ -} while (0) - -#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \ - OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \ - OUT_RING( R128_EVENT_CRTC_OFFSET ); \ -} while (0) - - -/* ================================================================ - * Ring control - */ - -#define r128_flush_write_combine() mb() - - -#define R128_VERBOSE 0 - -#define RING_LOCALS \ - int write; unsigned int tail_mask; volatile u32 *ring; - -#define BEGIN_RING( n ) do { \ - if ( R128_VERBOSE ) { \ - DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ - (n), __FUNCTION__ ); \ - } \ - if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ - r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ - } \ - dev_priv->ring.space -= (n) * sizeof(u32); \ - ring = dev_priv->ring.start; \ - write = dev_priv->ring.tail; \ - tail_mask = dev_priv->ring.tail_mask; \ -} while (0) - -/* You can set this to zero if you want. If the card locks up, you'll - * need to keep this set. It works around a bug in early revs of the - * Rage 128 chipset, where the CCE would read 32 dwords past the end of - * the ring buffer before wrapping around. - */ -#define R128_BROKEN_CCE 1 - -#define ADVANCE_RING() do { \ - if ( R128_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ - write, dev_priv->ring.tail ); \ - } \ - if ( R128_BROKEN_CCE && write < 32 ) { \ - memcpy( dev_priv->ring.end, \ - dev_priv->ring.start, \ - write * sizeof(u32) ); \ - } \ - r128_flush_write_combine(); \ - dev_priv->ring.tail = write; \ - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ -} while (0) - -#define OUT_RING( x ) do { \ - if ( R128_VERBOSE ) { \ - DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ - (unsigned int)(x), write ); \ - } \ - ring[write++] = cpu_to_le32( x ); \ - write &= tail_mask; \ -} while (0) - -#endif /* __R128_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.7 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c Thu Feb 27 12:32:38 2003 @@ -1,1593 +0,0 @@ -/* r128_state.c -- State support for r128 -*- linux-c -*- - * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "r128.h" -#include "drmP.h" -#include "r128_drv.h" -#include "drm.h" -#include <linux/delay.h> - - -/* ================================================================ - * CCE hardware state programming functions - */ - -static void r128_emit_clip_rects( drm_r128_private_t *dev_priv, - drm_clip_rect_t *boxes, int count ) -{ - u32 aux_sc_cntl = 0x00000000; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 17 ); - - if ( count >= 1 ) { - OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) ); - OUT_RING( boxes[0].x1 ); - OUT_RING( boxes[0].x2 - 1 ); - OUT_RING( boxes[0].y1 ); - OUT_RING( boxes[0].y2 - 1 ); - - aux_sc_cntl |= (R128_AUX1_SC_EN | R128_AUX1_SC_MODE_OR); - } - if ( count >= 2 ) { - OUT_RING( CCE_PACKET0( R128_AUX2_SC_LEFT, 3 ) ); - OUT_RING( boxes[1].x1 ); - OUT_RING( boxes[1].x2 - 1 ); - OUT_RING( boxes[1].y1 ); - OUT_RING( boxes[1].y2 - 1 ); - - aux_sc_cntl |= (R128_AUX2_SC_EN | R128_AUX2_SC_MODE_OR); - } - if ( count >= 3 ) { - OUT_RING( CCE_PACKET0( R128_AUX3_SC_LEFT, 3 ) ); - OUT_RING( boxes[2].x1 ); - OUT_RING( boxes[2].x2 - 1 ); - OUT_RING( boxes[2].y1 ); - OUT_RING( boxes[2].y2 - 1 ); - - aux_sc_cntl |= (R128_AUX3_SC_EN | R128_AUX3_SC_MODE_OR); - } - - OUT_RING( CCE_PACKET0( R128_AUX_SC_CNTL, 0 ) ); - OUT_RING( aux_sc_cntl ); - - ADVANCE_RING(); -} - -static inline void r128_emit_core( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_SCALE_3D_CNTL, 0 ) ); - OUT_RING( ctx->scale_3d_cntl ); - - ADVANCE_RING(); -} - -static inline void r128_emit_context( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 13 ); - - OUT_RING( CCE_PACKET0( R128_DST_PITCH_OFFSET_C, 11 ) ); - OUT_RING( ctx->dst_pitch_offset_c ); - OUT_RING( ctx->dp_gui_master_cntl_c ); - OUT_RING( ctx->sc_top_left_c ); - OUT_RING( ctx->sc_bottom_right_c ); - OUT_RING( ctx->z_offset_c ); - OUT_RING( ctx->z_pitch_c ); - OUT_RING( ctx->z_sten_cntl_c ); - OUT_RING( ctx->tex_cntl_c ); - OUT_RING( ctx->misc_3d_state_cntl_reg ); - OUT_RING( ctx->texture_clr_cmp_clr_c ); - OUT_RING( ctx->texture_clr_cmp_msk_c ); - OUT_RING( ctx->fog_color_c ); - - ADVANCE_RING(); -} - -static inline void r128_emit_setup( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 3 ); - - OUT_RING( CCE_PACKET1( R128_SETUP_CNTL, R128_PM4_VC_FPU_SETUP ) ); - OUT_RING( ctx->setup_cntl ); - OUT_RING( ctx->pm4_vc_fpu_setup ); - - ADVANCE_RING(); -} - -static inline void r128_emit_masks( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 ); - - OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); - OUT_RING( ctx->dp_write_mask ); - - OUT_RING( CCE_PACKET0( R128_STEN_REF_MASK_C, 1 ) ); - OUT_RING( ctx->sten_ref_mask_c ); - OUT_RING( ctx->plane_3d_mask_c ); - - ADVANCE_RING(); -} - -static inline void r128_emit_window( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_WINDOW_XY_OFFSET, 0 ) ); - OUT_RING( ctx->window_xy_offset ); - - ADVANCE_RING(); -} - -static inline void r128_emit_tex0( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_context_regs_t *ctx = &sarea_priv->context_state; - drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0]; - int i; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 7 + R128_MAX_TEXTURE_LEVELS ); - - OUT_RING( CCE_PACKET0( R128_PRIM_TEX_CNTL_C, - 2 + R128_MAX_TEXTURE_LEVELS ) ); - OUT_RING( tex->tex_cntl ); - OUT_RING( tex->tex_combine_cntl ); - OUT_RING( ctx->tex_size_pitch_c ); - for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { - OUT_RING( tex->tex_offset[i] ); - } - - OUT_RING( CCE_PACKET0( R128_CONSTANT_COLOR_C, 1 ) ); - OUT_RING( ctx->constant_color_c ); - OUT_RING( tex->tex_border_color ); - - ADVANCE_RING(); -} - -static inline void r128_emit_tex1( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; - int i; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 + R128_MAX_TEXTURE_LEVELS ); - - OUT_RING( CCE_PACKET0( R128_SEC_TEX_CNTL_C, - 1 + R128_MAX_TEXTURE_LEVELS ) ); - OUT_RING( tex->tex_cntl ); - OUT_RING( tex->tex_combine_cntl ); - for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { - OUT_RING( tex->tex_offset[i] ); - } - - OUT_RING( CCE_PACKET0( R128_SEC_TEXTURE_BORDER_COLOR_C, 0 ) ); - OUT_RING( tex->tex_border_color ); - - ADVANCE_RING(); -} - -static inline void r128_emit_state( drm_r128_private_t *dev_priv ) -{ - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); - - if ( dirty & R128_UPLOAD_CORE ) { - r128_emit_core( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_CORE; - } - - if ( dirty & R128_UPLOAD_CONTEXT ) { - r128_emit_context( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_CONTEXT; - } - - if ( dirty & R128_UPLOAD_SETUP ) { - r128_emit_setup( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_SETUP; - } - - if ( dirty & R128_UPLOAD_MASKS ) { - r128_emit_masks( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_MASKS; - } - - if ( dirty & R128_UPLOAD_WINDOW ) { - r128_emit_window( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_WINDOW; - } - - if ( dirty & R128_UPLOAD_TEX0 ) { - r128_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_TEX0; - } - - if ( dirty & R128_UPLOAD_TEX1 ) { - r128_emit_tex1( dev_priv ); - sarea_priv->dirty &= ~R128_UPLOAD_TEX1; - } - - /* Turn off the texture cache flushing */ - sarea_priv->context_state.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; - - sarea_priv->dirty &= ~R128_REQUIRE_QUIESCENCE; -} - - -#if R128_PERFORMANCE_BOXES -/* ================================================================ - * Performance monitoring functions - */ - -static void r128_clear_box( drm_r128_private_t *dev_priv, - int x, int y, int w, int h, - int r, int g, int b ) -{ - u32 pitch, offset; - u32 fb_bpp, color; - RING_LOCALS; - - switch ( dev_priv->fb_bpp ) { - case 16: - fb_bpp = R128_GMC_DST_16BPP; - color = (((r & 0xf8) << 8) | - ((g & 0xfc) << 3) | - ((b & 0xf8) >> 3)); - break; - case 24: - fb_bpp = R128_GMC_DST_24BPP; - color = ((r << 16) | (g << 8) | b); - break; - case 32: - fb_bpp = R128_GMC_DST_32BPP; - color = (((0xff) << 24) | (r << 16) | (g << 8) | b); - break; - default: - return; - } - - offset = dev_priv->back_offset; - pitch = dev_priv->back_pitch >> 3; - - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - fb_bpp | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS ); - - OUT_RING( (pitch << 21) | (offset >> 5) ); - OUT_RING( color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); -} - -static void r128_cce_performance_boxes( drm_r128_private_t *dev_priv ) -{ - if ( atomic_read( &dev_priv->idle_count ) == 0 ) { - r128_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); - } else { - atomic_set( &dev_priv->idle_count, 0 ); - } -} - -#endif - - -/* ================================================================ - * CCE command dispatch functions - */ - -static void r128_print_dirty( const char *msg, unsigned int flags ) -{ - DRM_INFO( "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", - msg, - flags, - (flags & R128_UPLOAD_CORE) ? "core, " : "", - (flags & R128_UPLOAD_CONTEXT) ? "context, " : "", - (flags & R128_UPLOAD_SETUP) ? "setup, " : "", - (flags & R128_UPLOAD_TEX0) ? "tex0, " : "", - (flags & R128_UPLOAD_TEX1) ? "tex1, " : "", - (flags & R128_UPLOAD_MASKS) ? "masks, " : "", - (flags & R128_UPLOAD_WINDOW) ? "window, " : "", - (flags & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "", - (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); -} - -static void r128_cce_dispatch_clear( drm_device_t *dev, - drm_r128_clear_t *clear ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int flags = clear->flags; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { - unsigned int tmp = flags; - - flags &= ~(R128_FRONT | R128_BACK); - if ( tmp & R128_FRONT ) flags |= R128_BACK; - if ( tmp & R128_BACK ) flags |= R128_FRONT; - } - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", - pbox[i].x1, pbox[i].y1, pbox[i].x2, - pbox[i].y2, flags ); - - if ( flags & (R128_FRONT | R128_BACK) ) { - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); - OUT_RING( clear->color_mask ); - - ADVANCE_RING(); - } - - if ( flags & R128_FRONT ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS ); - - OUT_RING( dev_priv->front_pitch_offset_c ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - if ( flags & R128_BACK ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS ); - - OUT_RING( dev_priv->back_pitch_offset_c ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - if ( flags & R128_DEPTH ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( clear->clear_depth ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - } -} - -static void r128_cce_dispatch_swap( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - -#if R128_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - r128_cce_performance_boxes( dev_priv ); -#endif - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - BEGIN_RING( 7 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (dev_priv->color_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->back_pitch_offset_c ); - OUT_RING( dev_priv->front_pitch_offset_c ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); - OUT_RING( dev_priv->sarea_priv->last_frame ); - - ADVANCE_RING(); -} - -static void r128_cce_dispatch_flip( drm_device_t *dev ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - -#if R128_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - r128_cce_performance_boxes( dev_priv ); -#endif - - BEGIN_RING( 4 ); - - R128_WAIT_UNTIL_PAGE_FLIPPED(); - OUT_RING( CCE_PACKET0( R128_CRTC_OFFSET, 0 ) ); - - if ( dev_priv->current_page == 0 ) { - OUT_RING( dev_priv->back_offset ); - dev_priv->current_page = 1; - } else { - OUT_RING( dev_priv->front_offset ); - dev_priv->current_page = 0; - } - - ADVANCE_RING(); - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); - OUT_RING( dev_priv->sarea_priv->last_frame ); - - ADVANCE_RING(); -} - -static void r128_cce_dispatch_vertex( drm_device_t *dev, - drm_buf_t *buf ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = buf->bus_address; - int size = buf->used; - int prim = buf_priv->prim; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "%s: buf=%d nbox=%d\n", - __FUNCTION__, buf->idx, sarea_priv->nbox ); - - if ( 0 ) - r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); - - if ( buf->used ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { - r128_emit_state( dev_priv ); - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - r128_emit_clip_rects( dev_priv, - &sarea_priv->boxes[i], - sarea_priv->nbox - i ); - } - - /* Emit the vertex buffer rendering commands */ - BEGIN_RING( 5 ); - - OUT_RING( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, 3 ) ); - OUT_RING( offset ); - OUT_RING( size ); - OUT_RING( format ); - OUT_RING( prim | R128_CCE_VC_CNTL_PRIM_WALK_LIST | - (size << R128_CCE_VC_CNTL_NUM_SHIFT) ); - - ADVANCE_RING(); - - i += 3; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); - OUT_RING( buf_priv->age ); - - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - -static void r128_cce_dispatch_indirect( drm_device_t *dev, - drm_buf_t *buf, - int start, int end ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - RING_LOCALS; - DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", - buf->idx, start, end ); - - if ( start != end ) { - int offset = buf->bus_address + start; - int dwords = (end - start + 3) / sizeof(u32); - - /* Indirect buffer data must be an even number of - * dwords, so if we've been given an odd number we must - * pad the data with a Type-2 CCE packet. - */ - if ( dwords & 1 ) { - u32 *data = (u32 *) - ((char *)dev_priv->buffers->handle - + buf->offset + start); - data[dwords++] = cpu_to_le32( R128_CCE_PACKET2 ); - } - - buf_priv->dispatched = 1; - - /* Fire off the indirect buffer */ - BEGIN_RING( 3 ); - - OUT_RING( CCE_PACKET0( R128_PM4_IW_INDOFF, 1 ) ); - OUT_RING( offset ); - OUT_RING( dwords ); - - ADVANCE_RING(); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the indirect buffer age */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); - OUT_RING( buf_priv->age ); - - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; -} - -static void r128_cce_dispatch_indices( drm_device_t *dev, - drm_buf_t *buf, - int start, int end, - int count ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv = buf->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = dev_priv->buffers->offset - dev_priv->cce_buffers_offset; - int prim = buf_priv->prim; - u32 *data; - int dwords; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - - if ( 0 ) - r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); - - if ( start != end ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { - r128_emit_state( dev_priv ); - } - - dwords = (end - start + 3) / sizeof(u32); - - data = (u32 *)((char *)dev_priv->buffers->handle - + buf->offset + start); - - data[0] = cpu_to_le32( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, - dwords-2 ) ); - - data[1] = cpu_to_le32( offset ); - data[2] = cpu_to_le32( R128_MAX_VB_VERTS ); - data[3] = cpu_to_le32( format ); - data[4] = cpu_to_le32( (prim | R128_CCE_VC_CNTL_PRIM_WALK_IND | - (count << 16)) ); - - if ( count & 0x1 ) { -#ifdef __LITTLE_ENDIAN - data[dwords-1] &= 0x0000ffff; -#else - data[dwords-1] &= 0xffff0000; -#endif - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - r128_emit_clip_rects( dev_priv, - &sarea_priv->boxes[i], - sarea_priv->nbox - i ); - } - - r128_cce_dispatch_indirect( dev, buf, start, end ); - - i += 3; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); - OUT_RING( buf_priv->age ); - - ADVANCE_RING(); - - buf->pending = 1; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - -static int r128_cce_dispatch_blit( drm_device_t *dev, - drm_r128_blit_t *blit ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - u32 *data; - int dword_shift, dwords; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - /* The compiler won't optimize away a division by a variable, - * even if the only legal values are powers of two. Thus, we'll - * use a shift instead. - */ - switch ( blit->format ) { - case R128_DATATYPE_ARGB8888: - dword_shift = 0; - break; - case R128_DATATYPE_ARGB1555: - case R128_DATATYPE_RGB565: - case R128_DATATYPE_ARGB4444: - dword_shift = 1; - break; - case R128_DATATYPE_CI8: - case R128_DATATYPE_RGB8: - dword_shift = 2; - break; - default: - DRM_ERROR( "invalid blit format %d\n", blit->format ); - return -EINVAL; - } - - /* Flush the pixel cache, and mark the contents as Read Invalid. - * This ensures no pixel data gets mixed up with the texture - * data from the host data blit, otherwise part of the texture - * image may be corrupted. - */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); - OUT_RING( R128_PC_RI_GUI | R128_PC_FLUSH_GUI ); - - ADVANCE_RING(); - - /* Dispatch the indirect buffer. - */ - buf = dma->buflist[blit->idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", blit->idx ); - return -EINVAL; - } - - buf_priv->discard = 1; - - dwords = (blit->width * blit->height) >> dword_shift; - - data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); - - data[0] = cpu_to_le32( CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 ) ); - data[1] = cpu_to_le32( (R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (blit->format << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_HOST_DATA | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS) ); - - data[2] = cpu_to_le32( (blit->pitch << 21) | (blit->offset >> 5) ); - data[3] = cpu_to_le32( 0xffffffff ); - data[4] = cpu_to_le32( 0xffffffff ); - data[5] = cpu_to_le32( (blit->y << 16) | blit->x ); - data[6] = cpu_to_le32( (blit->height << 16) | blit->width ); - data[7] = cpu_to_le32( dwords ); - - buf->used = (dwords + 8) * sizeof(u32); - - r128_cce_dispatch_indirect( dev, buf, 0, buf->used ); - - /* Flush the pixel cache after the blit completes. This ensures - * the texture data is written out to memory before rendering - * continues. - */ - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); - OUT_RING( R128_PC_FLUSH_GUI ); - - ADVANCE_RING(); - - return 0; -} - - -/* ================================================================ - * Tiled depth buffer management - * - * FIXME: These should all set the destination write mask for when we - * have hardware stencil support. - */ - -static int r128_cce_dispatch_write_span( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, x, y; - u32 *buffer; - u8 *mask; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { - return -EFAULT; - } - if ( copy_from_user( &y, depth->y, sizeof(y) ) ) { - return -EFAULT; - } - - buffer = kmalloc( depth->n * sizeof(u32), GFP_KERNEL ); - if ( buffer == NULL ) - return -ENOMEM; - if ( copy_from_user( buffer, depth->buffer, - depth->n * sizeof(u32) ) ) { - kfree( buffer ); - return -EFAULT; - } - - if ( depth->mask ) { - mask = kmalloc( depth->n * sizeof(u8), GFP_KERNEL ); - if ( mask == NULL ) { - kfree( buffer ); - return -ENOMEM; - } - if ( copy_from_user( mask, depth->mask, - depth->n * sizeof(u8) ) ) { - kfree( buffer ); - kfree( mask ); - return -EFAULT; - } - - for ( i = 0 ; i < count ; i++, x++ ) { - if ( mask[i] ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - kfree( mask ); - } else { - for ( i = 0 ; i < count ; i++, x++ ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - kfree( buffer ); - - return 0; -} - -static int r128_cce_dispatch_write_pixels( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, *x, *y; - u32 *buffer; - u8 *mask; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - - x = kmalloc( count * sizeof(*x), GFP_KERNEL ); - if ( x == NULL ) { - return -ENOMEM; - } - y = kmalloc( count * sizeof(*y), GFP_KERNEL ); - if ( y == NULL ) { - kfree( x ); - return -ENOMEM; - } - if ( copy_from_user( x, depth->x, count * sizeof(int) ) ) { - kfree( x ); - kfree( y ); - return -EFAULT; - } - if ( copy_from_user( y, depth->y, count * sizeof(int) ) ) { - kfree( x ); - kfree( y ); - return -EFAULT; - } - - buffer = kmalloc( depth->n * sizeof(u32), GFP_KERNEL ); - if ( buffer == NULL ) { - kfree( x ); - kfree( y ); - return -ENOMEM; - } - if ( copy_from_user( buffer, depth->buffer, - depth->n * sizeof(u32) ) ) { - kfree( x ); - kfree( y ); - kfree( buffer ); - return -EFAULT; - } - - if ( depth->mask ) { - mask = kmalloc( depth->n * sizeof(u8), GFP_KERNEL ); - if ( mask == NULL ) { - kfree( x ); - kfree( y ); - kfree( buffer ); - return -ENOMEM; - } - if ( copy_from_user( mask, depth->mask, - depth->n * sizeof(u8) ) ) { - kfree( x ); - kfree( y ); - kfree( buffer ); - kfree( mask ); - return -EFAULT; - } - - for ( i = 0 ; i < count ; i++ ) { - if ( mask[i] ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x[i] << 16) | y[i] ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - kfree( mask ); - } else { - for ( i = 0 ; i < count ; i++ ) { - BEGIN_RING( 6 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_SOLID_COLOR | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_P | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( buffer[i] ); - - OUT_RING( (x[i] << 16) | y[i] ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - } - - kfree( x ); - kfree( y ); - kfree( buffer ); - - return 0; -} - -static int r128_cce_dispatch_read_span( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, x, y; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { - return -EFAULT; - } - if ( copy_from_user( &y, depth->y, sizeof(y) ) ) { - return -EFAULT; - } - - BEGIN_RING( 7 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( dev_priv->span_pitch_offset_c ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (0 << 16) | 0 ); - OUT_RING( (count << 16) | 1 ); - - ADVANCE_RING(); - - return 0; -} - -static int r128_cce_dispatch_read_pixels( drm_device_t *dev, - drm_r128_depth_t *depth ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int count, *x, *y; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - count = depth->n; - if ( count > dev_priv->depth_pitch ) { - count = dev_priv->depth_pitch; - } - - x = kmalloc( count * sizeof(*x), GFP_KERNEL ); - if ( x == NULL ) { - return -ENOMEM; - } - y = kmalloc( count * sizeof(*y), GFP_KERNEL ); - if ( y == NULL ) { - kfree( x ); - return -ENOMEM; - } - if ( copy_from_user( x, depth->x, count * sizeof(int) ) ) { - kfree( x ); - kfree( y ); - return -EFAULT; - } - if ( copy_from_user( y, depth->y, count * sizeof(int) ) ) { - kfree( x ); - kfree( y ); - return -EFAULT; - } - - for ( i = 0 ; i < count ; i++ ) { - BEGIN_RING( 7 ); - - OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | - R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (dev_priv->depth_fmt << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_MEMORY | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( dev_priv->span_pitch_offset_c ); - - OUT_RING( (x[i] << 16) | y[i] ); - OUT_RING( (i << 16) | 0 ); - OUT_RING( (1 << 16) | 1 ); - - ADVANCE_RING(); - } - - kfree( x ); - kfree( y ); - - return 0; -} - - -/* ================================================================ - * Polygon stipple - */ - -static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) -{ - drm_r128_private_t *dev_priv = dev->dev_private; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - BEGIN_RING( 33 ); - - OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); - for ( i = 0 ; i < 32 ; i++ ) { - OUT_RING( stipple[i] ); - } - - ADVANCE_RING(); -} - - -/* ================================================================ - * IOCTL functions - */ - -int r128_cce_clear( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_r128_clear_t clear; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &clear, (drm_r128_clear_t *) arg, - sizeof(clear) ) ) - return -EFAULT; - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - - r128_cce_dispatch_clear( dev, &clear ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; - - return 0; -} - -int r128_cce_swap( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - - if ( !dev_priv->page_flipping ) { - r128_cce_dispatch_swap( dev ); - dev_priv->sarea_priv->dirty |= (R128_UPLOAD_CONTEXT | - R128_UPLOAD_MASKS); - } else { - r128_cce_dispatch_flip( dev ); - } - - return 0; -} - -int r128_cce_vertex( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_vertex_t vertex; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - if ( copy_from_user( &vertex, (drm_r128_vertex_t *)arg, - sizeof(vertex) ) ) - return -EFAULT; - - DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", - __FUNCTION__, current->pid, - vertex.idx, vertex.count, vertex.discard ); - - if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - vertex.idx, dma->buf_count - 1 ); - return -EINVAL; - } - if ( vertex.prim < 0 || - vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { - DRM_ERROR( "buffer prim %d\n", vertex.prim ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[vertex.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); - return -EINVAL; - } - - buf->used = vertex.count; - buf_priv->prim = vertex.prim; - buf_priv->discard = vertex.discard; - - r128_cce_dispatch_vertex( dev, buf ); - - return 0; -} - -int r128_cce_indices( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_indices_t elts; - int count; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - if ( copy_from_user( &elts, (drm_r128_indices_t *)arg, - sizeof(elts) ) ) - return -EFAULT; - - DRM_DEBUG( "%s: pid=%d buf=%d s=%d e=%d d=%d\n", - __FUNCTION__, current->pid, - elts.idx, elts.start, elts.end, elts.discard ); - - if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - elts.idx, dma->buf_count - 1 ); - return -EINVAL; - } - if ( elts.prim < 0 || - elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { - DRM_ERROR( "buffer prim %d\n", elts.prim ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[elts.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", elts.idx ); - return -EINVAL; - } - - count = (elts.end - elts.start) / sizeof(u16); - elts.start -= R128_INDEX_PRIM_OFFSET; - - if ( elts.start & 0x7 ) { - DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); - return -EINVAL; - } - if ( elts.start < buf->used ) { - DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); - return -EINVAL; - } - - buf->used = elts.end; - buf_priv->prim = elts.prim; - buf_priv->discard = elts.discard; - - r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count ); - - return 0; -} - -int r128_cce_blit( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_blit_t blit; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &blit, (drm_r128_blit_t *)arg, - sizeof(blit) ) ) - return -EFAULT; - - DRM_DEBUG( "%s: pid=%d index=%d\n", - __FUNCTION__, current->pid, blit.idx ); - - if ( blit.idx < 0 || blit.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - blit.idx, dma->buf_count - 1 ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - return r128_cce_dispatch_blit( dev, &blit ); -} - -int r128_cce_depth( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_depth_t depth; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &depth, (drm_r128_depth_t *)arg, - sizeof(depth) ) ) - return -EFAULT; - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - switch ( depth.func ) { - case R128_WRITE_SPAN: - return r128_cce_dispatch_write_span( dev, &depth ); - case R128_WRITE_PIXELS: - return r128_cce_dispatch_write_pixels( dev, &depth ); - case R128_READ_SPAN: - return r128_cce_dispatch_read_span( dev, &depth ); - case R128_READ_PIXELS: - return r128_cce_dispatch_read_pixels( dev, &depth ); - } - - return -EINVAL; -} - -int r128_cce_stipple( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_stipple_t stipple; - u32 mask[32]; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &stipple, (drm_r128_stipple_t *)arg, - sizeof(stipple) ) ) - return -EFAULT; - - if ( copy_from_user( &mask, stipple.mask, - 32 * sizeof(u32) ) ) - return -EFAULT; - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - r128_cce_dispatch_stipple( dev, mask ); - - return 0; -} - -int r128_cce_indirect( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_r128_buf_priv_t *buf_priv; - drm_r128_indirect_t indirect; -#if 0 - RING_LOCALS; -#endif - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - if ( copy_from_user( &indirect, (drm_r128_indirect_t *)arg, - sizeof(indirect) ) ) - return -EFAULT; - - DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", - indirect.idx, indirect.start, - indirect.end, indirect.discard ); - - if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - indirect.idx, dma->buf_count - 1 ); - return -EINVAL; - } - - buf = dma->buflist[indirect.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); - return -EINVAL; - } - - if ( indirect.start < buf->used ) { - DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", - indirect.start, buf->used ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf->used = indirect.end; - buf_priv->discard = indirect.discard; - -#if 0 - /* Wait for the 3D stream to idle before the indirect buffer - * containing 2D acceleration commands is processed. - */ - BEGIN_RING( 2 ); - RADEON_WAIT_UNTIL_3D_IDLE(); - ADVANCE_RING(); -#endif - - /* Dispatch the indirect buffer full of commands from the - * X server. This is insecure and is thus only available to - * privileged clients. - */ - r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end ); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h:1.2 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h Thu Feb 27 12:32:38 2003 @@ -1,81 +0,0 @@ -/* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __RADEON_H__ -#define __RADEON_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) radeon_##x - -/* General customization: - */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_SG 1 -#define __HAVE_PCI_DMA 1 - -/* Driver customization: - */ -#define DRIVER_PRERELEASE() do { \ - if ( dev->dev_private ) { \ - drm_radeon_private_t *dev_priv = dev->dev_private; \ - if ( dev_priv->page_flipping ) { \ - radeon_do_cleanup_pageflip( dev ); \ - } \ - } \ -} while (0) - -#define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) radeon_do_cleanup_cp( dev ); \ -} while (0) - -/* DMA customization: - */ -#define __HAVE_DMA 1 - -#if 0 -/* GH: Remove this for now... */ -#define __HAVE_DMA_QUIESCENT 1 -#define DRIVER_DMA_QUIESCENT() do { \ - drm_radeon_private_t *dev_priv = dev->dev_private; \ - return radeon_do_cp_idle( dev_priv ); \ -} while (0) -#endif - -/* Buffer customization: - */ -#define DRIVER_BUF_PRIV_T drm_radeon_buf_priv_t - -#define DRIVER_AGP_BUFFERS_MAP( dev ) \ - ((drm_radeon_private_t *)((dev)->dev_private))->buffers - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:1.7 Tue Oct 2 07:44:17 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c Thu Feb 27 12:32:39 2003 @@ -1,1432 +0,0 @@ -/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#define __NO_VERSION__ -#include "radeon.h" -#include "drmP.h" -#include "radeon_drv.h" - -#include <linux/interrupt.h> /* For task queue support */ -#include <linux/delay.h> - -#define RADEON_FIFO_DEBUG 0 - -#if defined(__alpha__) -# define PCIGART_ENABLED -#else -# undef PCIGART_ENABLED -#endif - - -/* CP microcode (from ATI) */ -static u32 radeon_cp_microcode[][2] = { - { 0x21007000, 0000000000 }, - { 0x20007000, 0000000000 }, - { 0x000000b4, 0x00000004 }, - { 0x000000b8, 0x00000004 }, - { 0x6f5b4d4c, 0000000000 }, - { 0x4c4c427f, 0000000000 }, - { 0x5b568a92, 0000000000 }, - { 0x4ca09c6d, 0000000000 }, - { 0xad4c4c4c, 0000000000 }, - { 0x4ce1af3d, 0000000000 }, - { 0xd8afafaf, 0000000000 }, - { 0xd64c4cdc, 0000000000 }, - { 0x4cd10d10, 0000000000 }, - { 0x000f0000, 0x00000016 }, - { 0x362f242d, 0000000000 }, - { 0x00000012, 0x00000004 }, - { 0x000f0000, 0x00000016 }, - { 0x362f282d, 0000000000 }, - { 0x000380e7, 0x00000002 }, - { 0x04002c97, 0x00000002 }, - { 0x000f0001, 0x00000016 }, - { 0x333a3730, 0000000000 }, - { 0x000077ef, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00000017, 0x00000004 }, - { 0x0003802b, 0x00000002 }, - { 0x040067e0, 0x00000002 }, - { 0x00000017, 0x00000004 }, - { 0x000077e0, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x000037e1, 0x00000002 }, - { 0x040067e1, 0x00000006 }, - { 0x000077e0, 0x00000002 }, - { 0x000077e1, 0x00000002 }, - { 0x000077e1, 0x00000006 }, - { 0xffffffff, 0000000000 }, - { 0x10000000, 0000000000 }, - { 0x0003802b, 0x00000002 }, - { 0x040067e0, 0x00000006 }, - { 0x00007675, 0x00000002 }, - { 0x00007676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0003802c, 0x00000002 }, - { 0x04002676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0000002f, 0x00000018 }, - { 0x0000002f, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x00000030, 0x00000018 }, - { 0x00000030, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x01605000, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00098000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x64c0603e, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00080000, 0x00000016 }, - { 0000000000, 0000000000 }, - { 0x0400251d, 0x00000002 }, - { 0x00007580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x04002580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x00000049, 0x00000004 }, - { 0x00005000, 0000000000 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x00019000, 0x00000002 }, - { 0x00011055, 0x00000014 }, - { 0x00000055, 0x00000012 }, - { 0x0400250f, 0x00000002 }, - { 0x0000504f, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007565, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x00000058, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x01e655b4, 0x00000002 }, - { 0x4401b0e4, 0x00000002 }, - { 0x01c110e4, 0x00000002 }, - { 0x26667066, 0x00000018 }, - { 0x040c2565, 0x00000002 }, - { 0x00000066, 0x00000018 }, - { 0x04002564, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x0000005d, 0x00000004 }, - { 0x00401069, 0x00000008 }, - { 0x00101000, 0x00000002 }, - { 0x000d80ff, 0x00000002 }, - { 0x0080006c, 0x00000008 }, - { 0x000f9000, 0x00000002 }, - { 0x000e00ff, 0x00000002 }, - { 0000000000, 0x00000006 }, - { 0x0000008f, 0x00000018 }, - { 0x0000005b, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007576, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00009000, 0x00000002 }, - { 0x00041000, 0x00000002 }, - { 0x0c00350e, 0x00000002 }, - { 0x00049000, 0x00000002 }, - { 0x00051000, 0x00000002 }, - { 0x01e785f8, 0x00000002 }, - { 0x00200000, 0x00000002 }, - { 0x0060007e, 0x0000000c }, - { 0x00007563, 0x00000002 }, - { 0x006075f0, 0x00000021 }, - { 0x20007073, 0x00000004 }, - { 0x00005073, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007576, 0x00000002 }, - { 0x00007577, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x0000750f, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00600083, 0x0000000c }, - { 0x006075f0, 0x00000021 }, - { 0x000075f8, 0x00000002 }, - { 0x00000083, 0x00000004 }, - { 0x000a750e, 0x00000002 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x0020750f, 0x00000002 }, - { 0x00600086, 0x00000004 }, - { 0x00007570, 0x00000002 }, - { 0x00007571, 0x00000002 }, - { 0x00007572, 0x00000006 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00005000, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00007568, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000095, 0x0000000c }, - { 0x00058000, 0x00000002 }, - { 0x0c607562, 0x00000002 }, - { 0x00000097, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00600096, 0x00000004 }, - { 0x400070e5, 0000000000 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x000380e5, 0x00000002 }, - { 0x000000a8, 0x0000001c }, - { 0x000650aa, 0x00000018 }, - { 0x040025bb, 0x00000002 }, - { 0x000610ab, 0x00000018 }, - { 0x040075bc, 0000000000 }, - { 0x000075bb, 0x00000002 }, - { 0x000075bc, 0000000000 }, - { 0x00090000, 0x00000006 }, - { 0x00090000, 0x00000002 }, - { 0x000d8002, 0x00000006 }, - { 0x00007832, 0x00000002 }, - { 0x00005000, 0x00000002 }, - { 0x000380e7, 0x00000002 }, - { 0x04002c97, 0x00000002 }, - { 0x00007820, 0x00000002 }, - { 0x00007821, 0x00000002 }, - { 0x00007800, 0000000000 }, - { 0x01200000, 0x00000002 }, - { 0x20077000, 0x00000002 }, - { 0x01200000, 0x00000002 }, - { 0x20007000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x0120751b, 0x00000002 }, - { 0x8040750a, 0x00000002 }, - { 0x8040750b, 0x00000002 }, - { 0x00110000, 0x00000002 }, - { 0x000380e5, 0x00000002 }, - { 0x000000c6, 0x0000001c }, - { 0x000610ab, 0x00000018 }, - { 0x844075bd, 0x00000002 }, - { 0x000610aa, 0x00000018 }, - { 0x840075bb, 0x00000002 }, - { 0x000610ab, 0x00000018 }, - { 0x844075bc, 0x00000002 }, - { 0x000000c9, 0x00000004 }, - { 0x804075bd, 0x00000002 }, - { 0x800075bb, 0x00000002 }, - { 0x804075bc, 0x00000002 }, - { 0x00108000, 0x00000002 }, - { 0x01400000, 0x00000002 }, - { 0x006000cd, 0x0000000c }, - { 0x20c07000, 0x00000020 }, - { 0x000000cf, 0x00000012 }, - { 0x00800000, 0x00000006 }, - { 0x0080751d, 0x00000006 }, - { 0000000000, 0000000000 }, - { 0x0000775c, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00661000, 0x00000002 }, - { 0x0460275d, 0x00000020 }, - { 0x00004000, 0000000000 }, - { 0x01e00830, 0x00000002 }, - { 0x21007000, 0000000000 }, - { 0x6464614d, 0000000000 }, - { 0x69687420, 0000000000 }, - { 0x00000073, 0000000000 }, - { 0000000000, 0000000000 }, - { 0x00005000, 0x00000002 }, - { 0x000380d0, 0x00000002 }, - { 0x040025e0, 0x00000002 }, - { 0x000075e1, 0000000000 }, - { 0x00000001, 0000000000 }, - { 0x000380e0, 0x00000002 }, - { 0x04002394, 0x00000002 }, - { 0x00005000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0x00000008, 0000000000 }, - { 0x00000004, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, -}; - - -int RADEON_READ_PLL(drm_device_t *dev, int addr) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - - RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f); - return RADEON_READ(RADEON_CLOCK_CNTL_DATA); -} - -#if RADEON_FIFO_DEBUG -static void radeon_status( drm_radeon_private_t *dev_priv ) -{ - printk( "%s:\n", __FUNCTION__ ); - printk( "RBBM_STATUS = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_RBBM_STATUS ) ); - printk( "CP_RB_RTPR = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_CP_RB_RPTR ) ); - printk( "CP_RB_WTPR = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_CP_RB_WPTR ) ); - printk( "AIC_CNTL = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_CNTL ) ); - printk( "AIC_STAT = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_STAT ) ); - printk( "AIC_PT_BASE = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_PT_BASE ) ); - printk( "TLB_ADDR = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_TLB_ADDR ) ); - printk( "TLB_DATA = 0x%08x\n", - (unsigned int)RADEON_READ( RADEON_AIC_TLB_DATA ) ); -} -#endif - - -/* ================================================================ - * Engine, FIFO control - */ - -static int radeon_do_pixcache_flush( drm_radeon_private_t *dev_priv ) -{ - u32 tmp; - int i; - - tmp = RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ); - tmp |= RADEON_RB2D_DC_FLUSH_ALL; - RADEON_WRITE( RADEON_RB2D_DSTCACHE_CTLSTAT, tmp ); - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ) - & RADEON_RB2D_DC_BUSY) ) { - return 0; - } - udelay( 1 ); - } - -#if RADEON_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - radeon_status( dev_priv ); -#endif - return -EBUSY; -} - -static int radeon_do_wait_for_fifo( drm_radeon_private_t *dev_priv, - int entries ) -{ - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - int slots = ( RADEON_READ( RADEON_RBBM_STATUS ) - & RADEON_RBBM_FIFOCNT_MASK ); - if ( slots >= entries ) return 0; - udelay( 1 ); - } - -#if RADEON_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - radeon_status( dev_priv ); -#endif - return -EBUSY; -} - -static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) -{ - int i, ret; - - ret = radeon_do_wait_for_fifo( dev_priv, 64 ); - if ( ret < 0 ) return ret; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( !(RADEON_READ( RADEON_RBBM_STATUS ) - & RADEON_RBBM_ACTIVE) ) { - radeon_do_pixcache_flush( dev_priv ); - return 0; - } - udelay( 1 ); - } - -#if RADEON_FIFO_DEBUG - DRM_ERROR( "failed!\n" ); - radeon_status( dev_priv ); -#endif - return -EBUSY; -} - - -/* ================================================================ - * CP control, initialization - */ - -/* Load the microcode for the CP */ -static void radeon_cp_load_microcode( drm_radeon_private_t *dev_priv ) -{ - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - radeon_do_wait_for_idle( dev_priv ); - - RADEON_WRITE( RADEON_CP_ME_RAM_ADDR, 0 ); - for ( i = 0 ; i < 256 ; i++ ) { - RADEON_WRITE( RADEON_CP_ME_RAM_DATAH, - radeon_cp_microcode[i][1] ); - RADEON_WRITE( RADEON_CP_ME_RAM_DATAL, - radeon_cp_microcode[i][0] ); - } -} - -/* Flush any pending commands to the CP. This should only be used just - * prior to a wait for idle, as it informs the engine that the command - * stream is ending. - */ -static void radeon_do_cp_flush( drm_radeon_private_t *dev_priv ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); -#if 0 - u32 tmp; - - tmp = RADEON_READ( RADEON_CP_RB_WPTR ) | (1 << 31); - RADEON_WRITE( RADEON_CP_RB_WPTR, tmp ); -#endif -} - -/* Wait for the CP to go idle. - */ -int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ) -{ - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - BEGIN_RING( 6 ); - - RADEON_PURGE_CACHE(); - RADEON_PURGE_ZCACHE(); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); - - return radeon_do_wait_for_idle( dev_priv ); -} - -/* Start the Command Processor. - */ -static void radeon_do_cp_start( drm_radeon_private_t *dev_priv ) -{ - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - radeon_do_wait_for_idle( dev_priv ); - - RADEON_WRITE( RADEON_CP_CSQ_CNTL, dev_priv->cp_mode ); - - dev_priv->cp_running = 1; - - BEGIN_RING( 6 ); - - RADEON_PURGE_CACHE(); - RADEON_PURGE_ZCACHE(); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); -} - -/* Reset the Command Processor. This will not flush any pending - * commands, so you must wait for the CP command stream to complete - * before calling this routine. - */ -static void radeon_do_cp_reset( drm_radeon_private_t *dev_priv ) -{ - u32 cur_read_ptr; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); - RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); - *dev_priv->ring.head = cur_read_ptr; - dev_priv->ring.tail = cur_read_ptr; -} - -/* Stop the Command Processor. This will not flush any pending - * commands, so you must flush the command stream and wait for the CP - * to go idle before calling this routine. - */ -static void radeon_do_cp_stop( drm_radeon_private_t *dev_priv ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - RADEON_WRITE( RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIDIS_INDDIS ); - - dev_priv->cp_running = 0; -} - -/* Reset the engine. This will stop the CP if it is running. - */ -static int radeon_do_engine_reset( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - radeon_do_pixcache_flush( dev_priv ); - - clock_cntl_index = RADEON_READ( RADEON_CLOCK_CNTL_INDEX ); - mclk_cntl = RADEON_READ_PLL( dev, RADEON_MCLK_CNTL ); - - RADEON_WRITE_PLL( RADEON_MCLK_CNTL, ( mclk_cntl | - RADEON_FORCEON_MCLKA | - RADEON_FORCEON_MCLKB | - RADEON_FORCEON_YCLKA | - RADEON_FORCEON_YCLKB | - RADEON_FORCEON_MC | - RADEON_FORCEON_AIC ) ); - - rbbm_soft_reset = RADEON_READ( RADEON_RBBM_SOFT_RESET ); - - RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset | - RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB ) ); - RADEON_READ( RADEON_RBBM_SOFT_RESET ); - RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset & - ~( RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB ) ) ); - RADEON_READ( RADEON_RBBM_SOFT_RESET ); - - - RADEON_WRITE_PLL( RADEON_MCLK_CNTL, mclk_cntl ); - RADEON_WRITE( RADEON_CLOCK_CNTL_INDEX, clock_cntl_index ); - RADEON_WRITE( RADEON_RBBM_SOFT_RESET, rbbm_soft_reset ); - - /* Reset the CP ring */ - radeon_do_cp_reset( dev_priv ); - - /* The CP is no longer running after an engine reset */ - dev_priv->cp_running = 0; - - /* Reset any pending vertex, indirect buffers */ - radeon_freelist_reset( dev ); - - return 0; -} - -static void radeon_cp_init_ring_buffer( drm_device_t *dev, - drm_radeon_private_t *dev_priv ) -{ - u32 ring_start, cur_read_ptr; - u32 tmp; - - /* Initialize the memory controller */ - RADEON_WRITE( RADEON_MC_FB_LOCATION, - (dev_priv->agp_vm_start - 1) & 0xffff0000 ); - - if ( !dev_priv->is_pci ) { - RADEON_WRITE( RADEON_MC_AGP_LOCATION, - (((dev_priv->agp_vm_start - 1 + - dev_priv->agp_size) & 0xffff0000) | - (dev_priv->agp_vm_start >> 16)) ); - } - -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - ring_start = (dev_priv->cp_ring->offset - - dev->agp->base - + dev_priv->agp_vm_start); - else -#endif - ring_start = (dev_priv->cp_ring->offset - - dev->sg->handle - + dev_priv->agp_vm_start); - - RADEON_WRITE( RADEON_CP_RB_BASE, ring_start ); - - /* Set the write pointer delay */ - RADEON_WRITE( RADEON_CP_RB_WPTR_DELAY, 0 ); - - /* Initialize the ring buffer's read and write pointers */ - cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); - RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); - *dev_priv->ring.head = cur_read_ptr; - dev_priv->ring.tail = cur_read_ptr; - - if ( !dev_priv->is_pci ) { - RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, - dev_priv->ring_rptr->offset ); - } else { - drm_sg_mem_t *entry = dev->sg; - unsigned long tmp_ofs, page_ofs; - - tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; - page_ofs = tmp_ofs >> PAGE_SHIFT; - - RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, - entry->busaddr[page_ofs]); - DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", - entry->busaddr[page_ofs], - entry->handle + tmp_ofs ); - } - - /* Set ring buffer size */ - RADEON_WRITE( RADEON_CP_RB_CNTL, dev_priv->ring.size_l2qw ); - - radeon_do_wait_for_idle( dev_priv ); - - /* Turn on bus mastering */ - tmp = RADEON_READ( RADEON_BUS_CNTL ) & ~RADEON_BUS_MASTER_DIS; - RADEON_WRITE( RADEON_BUS_CNTL, tmp ); - - /* Sync everything up */ - RADEON_WRITE( RADEON_ISYNC_CNTL, - (RADEON_ISYNC_ANY2D_IDLE3D | - RADEON_ISYNC_ANY3D_IDLE2D | - RADEON_ISYNC_WAIT_IDLEGUI | - RADEON_ISYNC_CPSCRATCH_IDLEGUI) ); -} - -static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) -{ - drm_radeon_private_t *dev_priv; - struct list_head *list; - u32 tmp; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); - if ( dev_priv == NULL ) - return -ENOMEM; - - memset( dev_priv, 0, sizeof(drm_radeon_private_t) ); - - dev_priv->is_pci = init->is_pci; - -#if !defined(PCIGART_ENABLED) - /* PCI support is not 100% working, so we disable it here. - */ - if ( dev_priv->is_pci ) { - DRM_ERROR( "PCI GART not yet supported for Radeon!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } -#endif - - if ( dev_priv->is_pci && !dev->sg ) { - DRM_ERROR( "PCI GART memory not allocated!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - - dev_priv->usec_timeout = init->usec_timeout; - if ( dev_priv->usec_timeout < 1 || - dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) { - DRM_DEBUG( "TIMEOUT problem!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - - dev_priv->cp_mode = init->cp_mode; - - /* Simple idle check. - */ - atomic_set( &dev_priv->idle_count, 0 ); - - /* We don't support anything other than bus-mastering ring mode, - * but the ring can be in either AGP or PCI space for the ring - * read pointer. - */ - if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) && - ( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) { - DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - - switch ( init->fb_bpp ) { - case 16: - dev_priv->color_fmt = RADEON_COLOR_FORMAT_RGB565; - break; - case 32: - default: - dev_priv->color_fmt = RADEON_COLOR_FORMAT_ARGB8888; - break; - } - dev_priv->front_offset = init->front_offset; - dev_priv->front_pitch = init->front_pitch; - dev_priv->back_offset = init->back_offset; - dev_priv->back_pitch = init->back_pitch; - - switch ( init->depth_bpp ) { - case 16: - dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; - break; - case 32: - default: - dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; - break; - } - dev_priv->depth_offset = init->depth_offset; - dev_priv->depth_pitch = init->depth_pitch; - - dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) | - (dev_priv->front_offset >> 10)); - dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) | - (dev_priv->back_offset >> 10)); - dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) | - (dev_priv->depth_offset >> 10)); - - /* Hardware state for depth clears. Remove this if/when we no - * longer clear the depth buffer with a 3D rectangle. Hard-code - * all values to prevent unwanted 3D state from slipping through - * and screwing with the clear operation. - */ - dev_priv->depth_clear.rb3d_cntl = (RADEON_PLANE_MASK_ENABLE | - RADEON_Z_ENABLE | - (dev_priv->color_fmt << 10) | - RADEON_ZBLOCK16); - - dev_priv->depth_clear.rb3d_zstencilcntl = (dev_priv->depth_fmt | - RADEON_Z_TEST_ALWAYS | - RADEON_STENCIL_TEST_ALWAYS | - RADEON_STENCIL_S_FAIL_KEEP | - RADEON_STENCIL_ZPASS_KEEP | - RADEON_STENCIL_ZFAIL_KEEP | - RADEON_Z_WRITE_ENABLE); - - dev_priv->depth_clear.se_cntl = (RADEON_FFACE_CULL_CW | - RADEON_BFACE_SOLID | - RADEON_FFACE_SOLID | - RADEON_FLAT_SHADE_VTX_LAST | - RADEON_DIFFUSE_SHADE_FLAT | - RADEON_ALPHA_SHADE_FLAT | - RADEON_SPECULAR_SHADE_FLAT | - RADEON_FOG_SHADE_FLAT | - RADEON_VTX_PIX_CENTER_OGL | - RADEON_ROUND_MODE_TRUNC | - RADEON_ROUND_PREC_8TH_PIX); - - list_for_each(list, &dev->maplist->head) { - drm_map_list_t *r_list = (drm_map_list_t *)list; - if( r_list->map && - r_list->map->type == _DRM_SHM && - r_list->map->flags & _DRM_CONTAINS_LOCK ) { - dev_priv->sarea = r_list->map; - break; - } - } - if(!dev_priv->sarea) { - DRM_ERROR("could not find sarea!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR("could not find framebuffer!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - if(!dev_priv->mmio) { - DRM_ERROR("could not find mmio region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); - if(!dev_priv->cp_ring) { - DRM_ERROR("could not find cp ring region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - if(!dev_priv->ring_rptr) { - DRM_ERROR("could not find ring read pointer!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); - if(!dev_priv->buffers) { - DRM_ERROR("could not find dma buffer region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - - if ( !dev_priv->is_pci ) { - DRM_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); - if(!dev_priv->agp_textures) { - DRM_ERROR("could not find agp texture region!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - } - - dev_priv->sarea_priv = - (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + - init->sarea_priv_offset); - - if ( !dev_priv->is_pci ) { - DRM_IOREMAP( dev_priv->cp_ring ); - DRM_IOREMAP( dev_priv->ring_rptr ); - DRM_IOREMAP( dev_priv->buffers ); - if(!dev_priv->cp_ring->handle || - !dev_priv->ring_rptr->handle || - !dev_priv->buffers->handle) { - DRM_ERROR("could not find ioremap agp regions!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -EINVAL; - } - } else { - dev_priv->cp_ring->handle = - (void *)dev_priv->cp_ring->offset; - dev_priv->ring_rptr->handle = - (void *)dev_priv->ring_rptr->offset; - dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; - - DRM_DEBUG( "dev_priv->cp_ring->handle %p\n", - dev_priv->cp_ring->handle ); - DRM_DEBUG( "dev_priv->ring_rptr->handle %p\n", - dev_priv->ring_rptr->handle ); - DRM_DEBUG( "dev_priv->buffers->handle %p\n", - dev_priv->buffers->handle ); - } - - - dev_priv->agp_size = init->agp_size; - dev_priv->agp_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ); -#if __REALLY_HAVE_AGP - if ( !dev_priv->is_pci ) - dev_priv->agp_buffers_offset = (dev_priv->buffers->offset - - dev->agp->base - + dev_priv->agp_vm_start); - else -#endif - dev_priv->agp_buffers_offset = (dev_priv->buffers->offset - - dev->sg->handle - + dev_priv->agp_vm_start); - - DRM_DEBUG( "dev_priv->agp_size %d\n", - dev_priv->agp_size ); - DRM_DEBUG( "dev_priv->agp_vm_start 0x%x\n", - dev_priv->agp_vm_start ); - DRM_DEBUG( "dev_priv->agp_buffers_offset 0x%lx\n", - dev_priv->agp_buffers_offset ); - - dev_priv->ring.head = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle); - - dev_priv->ring.start = (u32 *)dev_priv->cp_ring->handle; - dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle - + init->ring_size / sizeof(u32)); - dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); - - dev_priv->ring.tail_mask = - (dev_priv->ring.size / sizeof(u32)) - 1; - - dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; - -#if 0 - /* Initialize the scratch register pointer. This will cause - * the scratch register values to be written out to memory - * whenever they are updated. - * FIXME: This doesn't quite work yet, so we're disabling it - * for the release. - */ - RADEON_WRITE( RADEON_SCRATCH_ADDR, (dev_priv->ring_rptr->offset + - RADEON_SCRATCH_REG_OFFSET) ); - RADEON_WRITE( RADEON_SCRATCH_UMSK, 0x7 ); -#endif - - dev_priv->scratch = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle + - (RADEON_SCRATCH_REG_OFFSET / sizeof(u32))); - - dev_priv->sarea_priv->last_frame = 0; - RADEON_WRITE( RADEON_LAST_FRAME_REG, - dev_priv->sarea_priv->last_frame ); - - dev_priv->sarea_priv->last_dispatch = 0; - RADEON_WRITE( RADEON_LAST_DISPATCH_REG, - dev_priv->sarea_priv->last_dispatch ); - - dev_priv->sarea_priv->last_clear = 0; - RADEON_WRITE( RADEON_LAST_CLEAR_REG, - dev_priv->sarea_priv->last_clear ); - - if ( dev_priv->is_pci ) { - if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, - &dev_priv->bus_pci_gart)) { - DRM_ERROR( "failed to init PCI GART!\n" ); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return -ENOMEM; - } - /* Turn on PCI GART - */ - tmp = RADEON_READ( RADEON_AIC_CNTL ) - | RADEON_PCIGART_TRANSLATE_EN; - RADEON_WRITE( RADEON_AIC_CNTL, tmp ); - - /* set PCI GART page-table base address - */ - RADEON_WRITE( RADEON_AIC_PT_BASE, dev_priv->bus_pci_gart ); - - /* set address range for PCI address translate - */ - RADEON_WRITE( RADEON_AIC_LO_ADDR, dev_priv->agp_vm_start ); - RADEON_WRITE( RADEON_AIC_HI_ADDR, dev_priv->agp_vm_start - + dev_priv->agp_size - 1); - - /* Turn off AGP aperture -- is this required for PCIGART? - */ - RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0xffffffc0 ); /* ?? */ - RADEON_WRITE( RADEON_AGP_COMMAND, 0 ); /* clear AGP_COMMAND */ - } else { - /* Turn off PCI GART - */ - tmp = RADEON_READ( RADEON_AIC_CNTL ) - & ~RADEON_PCIGART_TRANSLATE_EN; - RADEON_WRITE( RADEON_AIC_CNTL, tmp ); - } - - radeon_cp_load_microcode( dev_priv ); - radeon_cp_init_ring_buffer( dev, dev_priv ); - -#if ROTATE_BUFS - dev_priv->last_buf = 0; -#endif - - dev->dev_private = (void *)dev_priv; - - radeon_do_engine_reset( dev ); - - return 0; -} - -int radeon_do_cleanup_cp( drm_device_t *dev ) -{ - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev->dev_private ) { - drm_radeon_private_t *dev_priv = dev->dev_private; - - if ( !dev_priv->is_pci ) { - DRM_IOREMAPFREE( dev_priv->cp_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); - } else { - if (!DRM(ati_pcigart_cleanup)( dev, - dev_priv->phys_pci_gart, - dev_priv->bus_pci_gart )) - DRM_ERROR( "failed to cleanup PCI GART!\n" ); - } - - DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), - DRM_MEM_DRIVER ); - dev->dev_private = NULL; - } - - return 0; -} - -int radeon_cp_init( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_init_t init; - - if ( copy_from_user( &init, (drm_radeon_init_t *)arg, sizeof(init) ) ) - return -EFAULT; - - switch ( init.func ) { - case RADEON_INIT_CP: - return radeon_do_init_cp( dev, &init ); - case RADEON_CLEANUP_CP: - return radeon_do_cleanup_cp( dev ); - } - - return -EINVAL; -} - -int radeon_cp_start( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( dev_priv->cp_running ) { - DRM_DEBUG( "%s while CP running\n", __FUNCTION__ ); - return 0; - } - if ( dev_priv->cp_mode == RADEON_CSQ_PRIDIS_INDDIS ) { - DRM_DEBUG( "%s called with bogus CP mode (%d)\n", - __FUNCTION__, dev_priv->cp_mode ); - return 0; - } - - radeon_do_cp_start( dev_priv ); - - return 0; -} - -/* Stop the CP. The engine must have been idled before calling this - * routine. - */ -int radeon_cp_stop( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_cp_stop_t stop; - int ret; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &stop, (drm_radeon_init_t *)arg, sizeof(stop) ) ) - return -EFAULT; - - /* Flush any pending CP commands. This ensures any outstanding - * commands are exectuted by the engine before we turn it off. - */ - if ( stop.flush ) { - radeon_do_cp_flush( dev_priv ); - } - - /* If we fail to make the engine go idle, we return an error - * code so that the DRM ioctl wrapper can try again. - */ - if ( stop.idle ) { - ret = radeon_do_cp_idle( dev_priv ); - if ( ret < 0 ) return ret; - } - - /* Finally, we can turn off the CP. If the engine isn't idle, - * we will get some dropped triangles as they won't be fully - * rendered before the CP is shut down. - */ - radeon_do_cp_stop( dev_priv ); - - /* Reset the engine */ - radeon_do_engine_reset( dev ); - - return 0; -} - -/* Just reset the CP ring. Called as part of an X Server engine reset. - */ -int radeon_cp_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); - return -EINVAL; - } - - radeon_do_cp_reset( dev_priv ); - - /* The CP is no longer running after an engine reset */ - dev_priv->cp_running = 0; - - return 0; -} - -int radeon_cp_idle( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - return radeon_do_cp_idle( dev_priv ); -} - -int radeon_engine_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - return radeon_do_engine_reset( dev ); -} - - -/* ================================================================ - * Fullscreen mode - */ - -static int radeon_do_init_pageflip( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - dev_priv->crtc_offset = RADEON_READ( RADEON_CRTC_OFFSET ); - dev_priv->crtc_offset_cntl = RADEON_READ( RADEON_CRTC_OFFSET_CNTL ); - - RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->front_offset ); - RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, - dev_priv->crtc_offset_cntl | - RADEON_CRTC_OFFSET_FLIP_CNTL ); - - dev_priv->page_flipping = 1; - dev_priv->current_page = 0; - - return 0; -} - -int radeon_do_cleanup_pageflip( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->crtc_offset ); - RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); - - dev_priv->page_flipping = 0; - dev_priv->current_page = 0; - - return 0; -} - -int radeon_fullscreen( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_fullscreen_t fs; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &fs, (drm_radeon_fullscreen_t *)arg, - sizeof(fs) ) ) - return -EFAULT; - - switch ( fs.func ) { - case RADEON_INIT_FULLSCREEN: - return radeon_do_init_pageflip( dev ); - case RADEON_CLEANUP_FULLSCREEN: - return radeon_do_cleanup_pageflip( dev ); - } - - return -EINVAL; -} - - -/* ================================================================ - * Freelist management - */ -#define RADEON_BUFFER_USED 0xffffffff -#define RADEON_BUFFER_FREE 0 - -#if 0 -static int radeon_freelist_init( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_freelist_t *entry; - int i; - - dev_priv->head = DRM(alloc)( sizeof(drm_radeon_freelist_t), - DRM_MEM_DRIVER ); - if ( dev_priv->head == NULL ) - return -ENOMEM; - - memset( dev_priv->head, 0, sizeof(drm_radeon_freelist_t) ); - dev_priv->head->age = RADEON_BUFFER_USED; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - - entry = DRM(alloc)( sizeof(drm_radeon_freelist_t), - DRM_MEM_DRIVER ); - if ( !entry ) return -ENOMEM; - - entry->age = RADEON_BUFFER_FREE; - entry->buf = buf; - entry->prev = dev_priv->head; - entry->next = dev_priv->head->next; - if ( !entry->next ) - dev_priv->tail = entry; - - buf_priv->discard = 0; - buf_priv->dispatched = 0; - buf_priv->list_entry = entry; - - dev_priv->head->next = entry; - - if ( dev_priv->head->next ) - dev_priv->head->next->prev = entry; - } - - return 0; - -} -#endif - -drm_buf_t *radeon_freelist_get( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv; - drm_buf_t *buf; - int i, t; -#if ROTATE_BUFS - int start; -#endif - - /* FIXME: Optimize -- use freelist code */ - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pid == 0 ) { - DRM_DEBUG( " ret buf=%d last=%d pid=0\n", - buf->idx, dev_priv->last_buf ); - return buf; - } - DRM_DEBUG( " skipping buf=%d pid=%d\n", - buf->idx, buf->pid ); - } - -#if ROTATE_BUFS - if ( ++dev_priv->last_buf >= dma->buf_count ) - dev_priv->last_buf = 0; - start = dev_priv->last_buf; -#endif - for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { -#if 0 - /* FIXME: Disable this for now */ - u32 done_age = dev_priv->scratch[RADEON_LAST_DISPATCH]; -#else - u32 done_age = RADEON_READ( RADEON_LAST_DISPATCH_REG ); -#endif -#if ROTATE_BUFS - for ( i = start ; i < dma->buf_count ; i++ ) { -#else - for ( i = 0 ; i < dma->buf_count ; i++ ) { -#endif - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if ( buf->pending && buf_priv->age <= done_age ) { - /* The buffer has been processed, so it - * can now be used. - */ - buf->pending = 0; - DRM_DEBUG( " ret buf=%d last=%d age=%d done=%d\n", buf->idx, dev_priv->last_buf, buf_priv->age, done_age ); - return buf; - } - DRM_DEBUG( " skipping buf=%d age=%d done=%d\n", - buf->idx, buf_priv->age, - done_age ); -#if ROTATE_BUFS - start = 0; -#endif - } - udelay( 1 ); - } - - DRM_ERROR( "returning NULL!\n" ); - return NULL; -} - -void radeon_freelist_reset( drm_device_t *dev ) -{ - drm_device_dma_t *dma = dev->dma; -#if ROTATE_BUFS - drm_radeon_private_t *dev_priv = dev->dev_private; -#endif - int i; - -#if ROTATE_BUFS - dev_priv->last_buf = 0; -#endif - for ( i = 0 ; i < dma->buf_count ; i++ ) { - drm_buf_t *buf = dma->buflist[i]; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - buf_priv->age = 0; - } -} - - -/* ================================================================ - * CP command submission - */ - -int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) -{ - drm_radeon_ring_buffer_t *ring = &dev_priv->ring; - int i; - - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - radeon_update_ring_snapshot( ring ); - if ( ring->space > n ) - return 0; - udelay( 1 ); - } - - /* FIXME: This return value is ignored in the BEGIN_RING macro! */ -#if RADEON_FIFO_DEBUG - radeon_status( dev_priv ); - DRM_ERROR( "failed!\n" ); -#endif - return -EBUSY; -} - -static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d ) -{ - int i; - drm_buf_t *buf; - - for ( i = d->granted_count ; i < d->request_count ; i++ ) { - buf = radeon_freelist_get( dev ); - if ( !buf ) return -EAGAIN; - - buf->pid = current->pid; - - if ( copy_to_user( &d->request_indices[i], &buf->idx, - sizeof(buf->idx) ) ) - return -EFAULT; - if ( copy_to_user( &d->request_sizes[i], &buf->total, - sizeof(buf->total) ) ) - return -EFAULT; - - d->granted_count++; - } - return 0; -} - -int radeon_cp_buffers( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int ret = 0; - drm_dma_t d; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) ) - return -EFAULT; - - /* Please don't send us buffers. - */ - if ( d.send_count != 0 ) { - DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", - current->pid, d.send_count ); - return -EINVAL; - } - - /* We'll send you buffers. - */ - if ( d.request_count < 0 || d.request_count > dma->buf_count ) { - DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", - current->pid, d.request_count, dma->buf_count ); - return -EINVAL; - } - - d.granted_count = 0; - - if ( d.request_count ) { - ret = radeon_cp_get_buffers( dev, &d ); - } - - if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) ) - return -EFAULT; - - return ret; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h:1.3 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h Thu Feb 27 12:32:39 2003 @@ -1,333 +0,0 @@ -/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __RADEON_DRM_H__ -#define __RADEON_DRM_H__ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the X server file (radeon_sarea.h) - */ -#ifndef __RADEON_SAREA_DEFINES__ -#define __RADEON_SAREA_DEFINES__ - -/* What needs to be changed for the current vertex buffer? - */ -#define RADEON_UPLOAD_CONTEXT 0x00000001 -#define RADEON_UPLOAD_VERTFMT 0x00000002 -#define RADEON_UPLOAD_LINE 0x00000004 -#define RADEON_UPLOAD_BUMPMAP 0x00000008 -#define RADEON_UPLOAD_MASKS 0x00000010 -#define RADEON_UPLOAD_VIEWPORT 0x00000020 -#define RADEON_UPLOAD_SETUP 0x00000040 -#define RADEON_UPLOAD_TCL 0x00000080 -#define RADEON_UPLOAD_MISC 0x00000100 -#define RADEON_UPLOAD_TEX0 0x00000200 -#define RADEON_UPLOAD_TEX1 0x00000400 -#define RADEON_UPLOAD_TEX2 0x00000800 -#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 -#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 -#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 -#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ -#define RADEON_REQUIRE_QUIESCENCE 0x00010000 -#define RADEON_UPLOAD_ALL 0x0001ffff - -#define RADEON_FRONT 0x1 -#define RADEON_BACK 0x2 -#define RADEON_DEPTH 0x4 - -/* Primitive types - */ -#define RADEON_POINTS 0x1 -#define RADEON_LINES 0x2 -#define RADEON_LINE_STRIP 0x3 -#define RADEON_TRIANGLES 0x4 -#define RADEON_TRIANGLE_FAN 0x5 -#define RADEON_TRIANGLE_STRIP 0x6 - -/* Vertex/indirect buffer size - */ -#define RADEON_BUFFER_SIZE 65536 - -/* Byte offsets for indirect buffer data - */ -#define RADEON_INDEX_PRIM_OFFSET 20 -#define RADEON_HOSTDATA_BLIT_OFFSET 32 - -#define RADEON_SCRATCH_REG_OFFSET 32 - -/* Keep these small for testing - */ -#define RADEON_NR_SAREA_CLIPRECTS 12 - -/* There are 2 heaps (local/AGP). Each region within a heap is a - * minimum of 64k, and there are at most 64 of them per heap. - */ -#define RADEON_LOCAL_TEX_HEAP 0 -#define RADEON_AGP_TEX_HEAP 1 -#define RADEON_NR_TEX_HEAPS 2 -#define RADEON_NR_TEX_REGIONS 64 -#define RADEON_LOG_TEX_GRANULARITY 16 - -#define RADEON_MAX_TEXTURE_LEVELS 11 -#define RADEON_MAX_TEXTURE_UNITS 3 - -#endif /* __RADEON_SAREA_DEFINES__ */ - -typedef struct { - unsigned int red; - unsigned int green; - unsigned int blue; - unsigned int alpha; -} radeon_color_regs_t; - -typedef struct { - /* Context state */ - unsigned int pp_misc; /* 0x1c14 */ - unsigned int pp_fog_color; - unsigned int re_solid_color; - unsigned int rb3d_blendcntl; - unsigned int rb3d_depthoffset; - unsigned int rb3d_depthpitch; - unsigned int rb3d_zstencilcntl; - - unsigned int pp_cntl; /* 0x1c38 */ - unsigned int rb3d_cntl; - unsigned int rb3d_coloroffset; - unsigned int re_width_height; - unsigned int rb3d_colorpitch; - unsigned int se_cntl; - - /* Vertex format state */ - unsigned int se_coord_fmt; /* 0x1c50 */ - - /* Line state */ - unsigned int re_line_pattern; /* 0x1cd0 */ - unsigned int re_line_state; - - unsigned int se_line_width; /* 0x1db8 */ - - /* Bumpmap state */ - unsigned int pp_lum_matrix; /* 0x1d00 */ - - unsigned int pp_rot_matrix_0; /* 0x1d58 */ - unsigned int pp_rot_matrix_1; - - /* Mask state */ - unsigned int rb3d_stencilrefmask; /* 0x1d7c */ - unsigned int rb3d_ropcntl; - unsigned int rb3d_planemask; - - /* Viewport state */ - unsigned int se_vport_xscale; /* 0x1d98 */ - unsigned int se_vport_xoffset; - unsigned int se_vport_yscale; - unsigned int se_vport_yoffset; - unsigned int se_vport_zscale; - unsigned int se_vport_zoffset; - - /* Setup state */ - unsigned int se_cntl_status; /* 0x2140 */ - -#ifdef TCL_ENABLE - /* TCL state */ - radeon_color_regs_t se_tcl_material_emmissive; /* 0x2210 */ - radeon_color_regs_t se_tcl_material_ambient; - radeon_color_regs_t se_tcl_material_diffuse; - radeon_color_regs_t se_tcl_material_specular; - unsigned int se_tcl_shininess; - unsigned int se_tcl_output_vtx_fmt; - unsigned int se_tcl_output_vtx_sel; - unsigned int se_tcl_matrix_select_0; - unsigned int se_tcl_matrix_select_1; - unsigned int se_tcl_ucp_vert_blend_ctl; - unsigned int se_tcl_texture_proc_ctl; - unsigned int se_tcl_light_model_ctl; - unsigned int se_tcl_per_light_ctl[4]; -#endif - - /* Misc state */ - unsigned int re_top_left; /* 0x26c0 */ - unsigned int re_misc; -} drm_radeon_context_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int pp_txfilter; - unsigned int pp_txformat; - unsigned int pp_txoffset; - unsigned int pp_txcblend; - unsigned int pp_txablend; - unsigned int pp_tfactor; - - unsigned int pp_border_color; - -#ifdef CUBIC_ENABLE - unsigned int pp_cubic_faces; - unsigned int pp_cubic_offset[5]; -#endif -} drm_radeon_texture_regs_t; - -typedef struct { - unsigned char next, prev; - unsigned char in_use; - int age; -} drm_radeon_tex_region_t; - -typedef struct { - /* The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ - drm_radeon_context_regs_t context_state; - drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; - - /* The current cliprects, or a subset thereof. - */ - drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Counters for client-side throttling of rendering clients. - */ - unsigned int last_frame; - unsigned int last_dispatch; - unsigned int last_clear; - - drm_radeon_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1]; - int tex_age[RADEON_NR_TEX_HEAPS]; - int ctx_owner; -} drm_radeon_sarea_t; - - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmRadeon.h) - */ -typedef struct drm_radeon_init { - enum { - RADEON_INIT_CP = 0x01, - RADEON_CLEANUP_CP = 0x02 - } func; - unsigned long sarea_priv_offset; - int is_pci; - int cp_mode; - int agp_size; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -} drm_radeon_init_t; - -typedef struct drm_radeon_cp_stop { - int flush; - int idle; -} drm_radeon_cp_stop_t; - -typedef struct drm_radeon_fullscreen { - enum { - RADEON_INIT_FULLSCREEN = 0x01, - RADEON_CLEANUP_FULLSCREEN = 0x02 - } func; -} drm_radeon_fullscreen_t; - -#define CLEAR_X1 0 -#define CLEAR_Y1 1 -#define CLEAR_X2 2 -#define CLEAR_Y2 3 -#define CLEAR_DEPTH 4 - -typedef union drm_radeon_clear_rect { - float f[5]; - unsigned int ui[5]; -} drm_radeon_clear_rect_t; - -typedef struct drm_radeon_clear { - unsigned int flags; - unsigned int clear_color; - unsigned int clear_depth; - unsigned int color_mask; - unsigned int depth_mask; - drm_radeon_clear_rect_t *depth_boxes; -} drm_radeon_clear_t; - -typedef struct drm_radeon_vertex { - int prim; - int idx; /* Index of vertex buffer */ - int count; /* Number of vertices in buffer */ - int discard; /* Client finished with buffer? */ -} drm_radeon_vertex_t; - -typedef struct drm_radeon_indices { - int prim; - int idx; - int start; - int end; - int discard; /* Client finished with buffer? */ -} drm_radeon_indices_t; - -typedef struct drm_radeon_tex_image { - unsigned int x, y; /* Blit coordinates */ - unsigned int width, height; - const void *data; -} drm_radeon_tex_image_t; - -typedef struct drm_radeon_texture { - int offset; - int pitch; - int format; - int width; /* Texture image coordinates */ - int height; - drm_radeon_tex_image_t *image; -} drm_radeon_texture_t; - -typedef struct drm_radeon_stipple { - unsigned int *mask; -} drm_radeon_stipple_t; - -typedef struct drm_radeon_indirect { - int idx; - int start; - int end; - int discard; -} drm_radeon_indirect_t; - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.4 Fri Aug 17 22:51:19 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c Wed Oct 30 07:52:38 2002 @@ -30,47 +30,11 @@ #include <linux/config.h> #include "radeon.h" #include "drmP.h" +#include "drm.h" +#include "radeon_drm.h" #include "radeon_drv.h" #include "ati_pcigart.h" -#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - -#define DRIVER_NAME "radeon" -#define DRIVER_DESC "ATI Radeon" -#define DRIVER_DATE "20010405" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 1 -#define DRIVER_PATCHLEVEL 1 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 }, - - -#if 0 -/* GH: Count data sent to card via ring or vertex/indirect buffers. - */ -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#endif - - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" @@ -78,26 +42,6 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init radeon_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", radeon_options ); -#endif - #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:1.5 Fri Aug 17 22:51:19 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h Thu Feb 27 12:32:39 2003 @@ -1,739 +0,0 @@ -/* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -#ifndef __RADEON_DRV_H__ -#define __RADEON_DRV_H__ - -typedef struct drm_radeon_freelist { - unsigned int age; - drm_buf_t *buf; - struct drm_radeon_freelist *next; - struct drm_radeon_freelist *prev; -} drm_radeon_freelist_t; - -typedef struct drm_radeon_ring_buffer { - u32 *start; - u32 *end; - int size; - int size_l2qw; - - volatile u32 *head; - u32 tail; - u32 tail_mask; - int space; - - int high_mark; -} drm_radeon_ring_buffer_t; - -typedef struct drm_radeon_depth_clear_t { - u32 rb3d_cntl; - u32 rb3d_zstencilcntl; - u32 se_cntl; -} drm_radeon_depth_clear_t; - -typedef struct drm_radeon_private { - drm_radeon_ring_buffer_t ring; - drm_radeon_sarea_t *sarea_priv; - - int agp_size; - u32 agp_vm_start; - unsigned long agp_buffers_offset; - - int cp_mode; - int cp_running; - - drm_radeon_freelist_t *head; - drm_radeon_freelist_t *tail; -/* FIXME: ROTATE_BUFS is a hask to cycle through bufs until freelist - code is used. Note this hides a problem with the scratch register - (used to keep track of last buffer completed) being written to before - the last buffer has actually completed rendering. */ -#define ROTATE_BUFS 1 -#if ROTATE_BUFS - int last_buf; -#endif - volatile u32 *scratch; - - int usec_timeout; - int is_pci; - unsigned long phys_pci_gart; - dma_addr_t bus_pci_gart; - - atomic_t idle_count; - - int page_flipping; - int current_page; - u32 crtc_offset; - u32 crtc_offset_cntl; - - u32 color_fmt; - unsigned int front_offset; - unsigned int front_pitch; - unsigned int back_offset; - unsigned int back_pitch; - - u32 depth_fmt; - unsigned int depth_offset; - unsigned int depth_pitch; - - u32 front_pitch_offset; - u32 back_pitch_offset; - u32 depth_pitch_offset; - - drm_radeon_depth_clear_t depth_clear; - - drm_map_t *sarea; - drm_map_t *fb; - drm_map_t *mmio; - drm_map_t *cp_ring; - drm_map_t *ring_rptr; - drm_map_t *buffers; - drm_map_t *agp_textures; -} drm_radeon_private_t; - -typedef struct drm_radeon_buf_priv { - u32 age; - int prim; - int discard; - int dispatched; - drm_radeon_freelist_t *list_entry; -} drm_radeon_buf_priv_t; - - /* radeon_cp.c */ -extern int radeon_cp_init( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_start( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_stop( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_idle( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_engine_reset( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_fullscreen( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_buffers( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - -extern void radeon_freelist_reset( drm_device_t *dev ); -extern drm_buf_t *radeon_freelist_get( drm_device_t *dev ); - -extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ); - -static inline void -radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring ) -{ - ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - -extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ); -extern int radeon_do_cleanup_cp( drm_device_t *dev ); -extern int radeon_do_cleanup_pageflip( drm_device_t *dev ); - - /* radeon_state.c */ -extern int radeon_cp_clear( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_swap( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_vertex( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_indices( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_texture( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_stipple( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_cp_indirect( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - - -/* Register definitions, register access macros and drmAddMap constants - * for Radeon kernel driver. - */ - -#define RADEON_AGP_COMMAND 0x0f60 -#define RADEON_AUX_SCISSOR_CNTL 0x26f0 -# define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) -# define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) -# define RADEON_EXCLUSIVE_SCISSOR_2 (1 << 26) -# define RADEON_SCISSOR_0_ENABLE (1 << 28) -# define RADEON_SCISSOR_1_ENABLE (1 << 29) -# define RADEON_SCISSOR_2_ENABLE (1 << 30) - -#define RADEON_BUS_CNTL 0x0030 -# define RADEON_BUS_MASTER_DIS (1 << 6) - -#define RADEON_CLOCK_CNTL_DATA 0x000c -# define RADEON_PLL_WR_EN (1 << 7) -#define RADEON_CLOCK_CNTL_INDEX 0x0008 -#define RADEON_CONFIG_APER_SIZE 0x0108 -#define RADEON_CRTC_OFFSET 0x0224 -#define RADEON_CRTC_OFFSET_CNTL 0x0228 -# define RADEON_CRTC_TILE_EN (1 << 15) -# define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) - -#define RADEON_RB3D_COLORPITCH 0x1c48 -#define RADEON_RB3D_DEPTHCLEARVALUE 0x1c30 -#define RADEON_RB3D_DEPTHXY_OFFSET 0x1c60 - -#define RADEON_DP_GUI_MASTER_CNTL 0x146c -# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define RADEON_GMC_BRUSH_NONE (15 << 4) -# define RADEON_GMC_DST_16BPP (4 << 8) -# define RADEON_GMC_DST_24BPP (5 << 8) -# define RADEON_GMC_DST_32BPP (6 << 8) -# define RADEON_GMC_DST_DATATYPE_SHIFT 8 -# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) -# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define RADEON_GMC_WR_MSK_DIS (1 << 30) -# define RADEON_ROP3_S 0x00cc0000 -# define RADEON_ROP3_P 0x00f00000 -#define RADEON_DP_WRITE_MASK 0x16cc -#define RADEON_DST_PITCH_OFFSET 0x142c -#define RADEON_DST_PITCH_OFFSET_C 0x1c80 -# define RADEON_DST_TILE_LINEAR (0 << 30) -# define RADEON_DST_TILE_MACRO (1 << 30) -# define RADEON_DST_TILE_MICRO (2 << 30) -# define RADEON_DST_TILE_BOTH (3 << 30) - -#define RADEON_SCRATCH_REG0 0x15e0 -#define RADEON_SCRATCH_REG1 0x15e4 -#define RADEON_SCRATCH_REG2 0x15e8 -#define RADEON_SCRATCH_REG3 0x15ec -#define RADEON_SCRATCH_REG4 0x15f0 -#define RADEON_SCRATCH_REG5 0x15f4 -#define RADEON_SCRATCH_UMSK 0x0770 -#define RADEON_SCRATCH_ADDR 0x0774 - -#define RADEON_HOST_PATH_CNTL 0x0130 -# define RADEON_HDP_SOFT_RESET (1 << 26) -# define RADEON_HDP_WC_TIMEOUT_MASK (7 << 28) -# define RADEON_HDP_WC_TIMEOUT_28BCLK (7 << 28) - -#define RADEON_ISYNC_CNTL 0x1724 -# define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0) -# define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1) -# define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2) -# define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3) -# define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4) -# define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5) - -#define RADEON_MC_AGP_LOCATION 0x014c -#define RADEON_MC_FB_LOCATION 0x0148 -#define RADEON_MCLK_CNTL 0x0012 -# define RADEON_FORCEON_MCLKA (1 << 16) -# define RADEON_FORCEON_MCLKB (1 << 17) -# define RADEON_FORCEON_YCLKA (1 << 18) -# define RADEON_FORCEON_YCLKB (1 << 19) -# define RADEON_FORCEON_MC (1 << 20) -# define RADEON_FORCEON_AIC (1 << 21) - -#define RADEON_PP_BORDER_COLOR_0 0x1d40 -#define RADEON_PP_BORDER_COLOR_1 0x1d44 -#define RADEON_PP_BORDER_COLOR_2 0x1d48 -#define RADEON_PP_CNTL 0x1c38 -# define RADEON_SCISSOR_ENABLE (1 << 1) -#define RADEON_PP_LUM_MATRIX 0x1d00 -#define RADEON_PP_MISC 0x1c14 -#define RADEON_PP_ROT_MATRIX_0 0x1d58 -#define RADEON_PP_TXFILTER_0 0x1c54 -#define RADEON_PP_TXFILTER_1 0x1c6c -#define RADEON_PP_TXFILTER_2 0x1c84 - -#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c -# define RADEON_RB2D_DC_FLUSH (3 << 0) -# define RADEON_RB2D_DC_FREE (3 << 2) -# define RADEON_RB2D_DC_FLUSH_ALL 0xf -# define RADEON_RB2D_DC_BUSY (1 << 31) -#define RADEON_RB3D_CNTL 0x1c3c -# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) -# define RADEON_PLANE_MASK_ENABLE (1 << 1) -# define RADEON_DITHER_ENABLE (1 << 2) -# define RADEON_ROUND_ENABLE (1 << 3) -# define RADEON_SCALE_DITHER_ENABLE (1 << 4) -# define RADEON_DITHER_INIT (1 << 5) -# define RADEON_ROP_ENABLE (1 << 6) -# define RADEON_STENCIL_ENABLE (1 << 7) -# define RADEON_Z_ENABLE (1 << 8) -# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9) -# define RADEON_ZBLOCK8 (0 << 15) -# define RADEON_ZBLOCK16 (1 << 15) -#define RADEON_RB3D_DEPTHOFFSET 0x1c24 -#define RADEON_RB3D_PLANEMASK 0x1d84 -#define RADEON_RB3D_STENCILREFMASK 0x1d7c -#define RADEON_RB3D_ZCACHE_MODE 0x3250 -#define RADEON_RB3D_ZCACHE_CTLSTAT 0x3254 -# define RADEON_RB3D_ZC_FLUSH (1 << 0) -# define RADEON_RB3D_ZC_FREE (1 << 2) -# define RADEON_RB3D_ZC_FLUSH_ALL 0x5 -# define RADEON_RB3D_ZC_BUSY (1 << 31) -#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c -# define RADEON_Z_TEST_MASK (7 << 4) -# define RADEON_Z_TEST_ALWAYS (7 << 4) -# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) -# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16) -# define RADEON_STENCIL_ZPASS_KEEP (0 << 20) -# define RADEON_STENCIL_ZFAIL_KEEP (0 << 20) -# define RADEON_Z_WRITE_ENABLE (1 << 30) -#define RADEON_RBBM_SOFT_RESET 0x00f0 -# define RADEON_SOFT_RESET_CP (1 << 0) -# define RADEON_SOFT_RESET_HI (1 << 1) -# define RADEON_SOFT_RESET_SE (1 << 2) -# define RADEON_SOFT_RESET_RE (1 << 3) -# define RADEON_SOFT_RESET_PP (1 << 4) -# define RADEON_SOFT_RESET_E2 (1 << 5) -# define RADEON_SOFT_RESET_RB (1 << 6) -# define RADEON_SOFT_RESET_HDP (1 << 7) -#define RADEON_RBBM_STATUS 0x0e40 -# define RADEON_RBBM_FIFOCNT_MASK 0x007f -# define RADEON_RBBM_ACTIVE (1 << 31) -#define RADEON_RE_LINE_PATTERN 0x1cd0 -#define RADEON_RE_MISC 0x26c4 -#define RADEON_RE_TOP_LEFT 0x26c0 -#define RADEON_RE_WIDTH_HEIGHT 0x1c44 -#define RADEON_RE_STIPPLE_ADDR 0x1cc8 -#define RADEON_RE_STIPPLE_DATA 0x1ccc - -#define RADEON_SCISSOR_TL_0 0x1cd8 -#define RADEON_SCISSOR_BR_0 0x1cdc -#define RADEON_SCISSOR_TL_1 0x1ce0 -#define RADEON_SCISSOR_BR_1 0x1ce4 -#define RADEON_SCISSOR_TL_2 0x1ce8 -#define RADEON_SCISSOR_BR_2 0x1cec -#define RADEON_SE_COORD_FMT 0x1c50 -#define RADEON_SE_CNTL 0x1c4c -# define RADEON_FFACE_CULL_CW (0 << 0) -# define RADEON_BFACE_SOLID (3 << 1) -# define RADEON_FFACE_SOLID (3 << 3) -# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) -# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) -# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) -# define RADEON_ALPHA_SHADE_FLAT (1 << 10) -# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) -# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) -# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) -# define RADEON_FOG_SHADE_FLAT (1 << 14) -# define RADEON_FOG_SHADE_GOURAUD (2 << 14) -# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) -# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) -# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) -# define RADEON_ROUND_MODE_TRUNC (0 << 28) -# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) -#define RADEON_SE_CNTL_STATUS 0x2140 -#define RADEON_SE_LINE_WIDTH 0x1db8 -#define RADEON_SE_VPORT_XSCALE 0x1d98 -#define RADEON_SURFACE_ACCESS_FLAGS 0x0bf8 -#define RADEON_SURFACE_ACCESS_CLR 0x0bfc -#define RADEON_SURFACE_CNTL 0x0b00 -# define RADEON_SURF_TRANSLATION_DIS (1 << 8) -# define RADEON_NONSURF_AP0_SWP_MASK (3 << 20) -# define RADEON_NONSURF_AP0_SWP_LITTLE (0 << 20) -# define RADEON_NONSURF_AP0_SWP_BIG16 (1 << 20) -# define RADEON_NONSURF_AP0_SWP_BIG32 (2 << 20) -# define RADEON_NONSURF_AP1_SWP_MASK (3 << 22) -# define RADEON_NONSURF_AP1_SWP_LITTLE (0 << 22) -# define RADEON_NONSURF_AP1_SWP_BIG16 (1 << 22) -# define RADEON_NONSURF_AP1_SWP_BIG32 (2 << 22) -#define RADEON_SURFACE0_INFO 0x0b0c -# define RADEON_SURF_PITCHSEL_MASK (0x1ff << 0) -# define RADEON_SURF_TILE_MODE_MASK (3 << 16) -# define RADEON_SURF_TILE_MODE_MACRO (0 << 16) -# define RADEON_SURF_TILE_MODE_MICRO (1 << 16) -# define RADEON_SURF_TILE_MODE_32BIT_Z (2 << 16) -# define RADEON_SURF_TILE_MODE_16BIT_Z (3 << 16) -#define RADEON_SURFACE0_LOWER_BOUND 0x0b04 -#define RADEON_SURFACE0_UPPER_BOUND 0x0b08 -#define RADEON_SURFACE1_INFO 0x0b1c -#define RADEON_SURFACE1_LOWER_BOUND 0x0b14 -#define RADEON_SURFACE1_UPPER_BOUND 0x0b18 -#define RADEON_SURFACE2_INFO 0x0b2c -#define RADEON_SURFACE2_LOWER_BOUND 0x0b24 -#define RADEON_SURFACE2_UPPER_BOUND 0x0b28 -#define RADEON_SURFACE3_INFO 0x0b3c -#define RADEON_SURFACE3_LOWER_BOUND 0x0b34 -#define RADEON_SURFACE3_UPPER_BOUND 0x0b38 -#define RADEON_SURFACE4_INFO 0x0b4c -#define RADEON_SURFACE4_LOWER_BOUND 0x0b44 -#define RADEON_SURFACE4_UPPER_BOUND 0x0b48 -#define RADEON_SURFACE5_INFO 0x0b5c -#define RADEON_SURFACE5_LOWER_BOUND 0x0b54 -#define RADEON_SURFACE5_UPPER_BOUND 0x0b58 -#define RADEON_SURFACE6_INFO 0x0b6c -#define RADEON_SURFACE6_LOWER_BOUND 0x0b64 -#define RADEON_SURFACE6_UPPER_BOUND 0x0b68 -#define RADEON_SURFACE7_INFO 0x0b7c -#define RADEON_SURFACE7_LOWER_BOUND 0x0b74 -#define RADEON_SURFACE7_UPPER_BOUND 0x0b78 -#define RADEON_SW_SEMAPHORE 0x013c - -#define RADEON_WAIT_UNTIL 0x1720 -# define RADEON_WAIT_CRTC_PFLIP (1 << 0) -# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) -# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) -# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) - -#define RADEON_RB3D_ZMASKOFFSET 0x1c34 -#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c -# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) -# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) - - -/* CP registers */ -#define RADEON_CP_ME_RAM_ADDR 0x07d4 -#define RADEON_CP_ME_RAM_RADDR 0x07d8 -#define RADEON_CP_ME_RAM_DATAH 0x07dc -#define RADEON_CP_ME_RAM_DATAL 0x07e0 - -#define RADEON_CP_RB_BASE 0x0700 -#define RADEON_CP_RB_CNTL 0x0704 -#define RADEON_CP_RB_RPTR_ADDR 0x070c -#define RADEON_CP_RB_RPTR 0x0710 -#define RADEON_CP_RB_WPTR 0x0714 - -#define RADEON_CP_RB_WPTR_DELAY 0x0718 -# define RADEON_PRE_WRITE_TIMER_SHIFT 0 -# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 - -#define RADEON_CP_IB_BASE 0x0738 - -#define RADEON_CP_CSQ_CNTL 0x0740 -# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) -# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) -# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) -# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) -# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) -# define RADEON_CSQ_PRIBM_INDBM (4 << 28) -# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) - -#define RADEON_AIC_CNTL 0x01d0 -# define RADEON_PCIGART_TRANSLATE_EN (1 << 0) -#define RADEON_AIC_STAT 0x01d4 -#define RADEON_AIC_PT_BASE 0x01d8 -#define RADEON_AIC_LO_ADDR 0x01dc -#define RADEON_AIC_HI_ADDR 0x01e0 -#define RADEON_AIC_TLB_ADDR 0x01e4 -#define RADEON_AIC_TLB_DATA 0x01e8 - -/* CP command packets */ -#define RADEON_CP_PACKET0 0x00000000 -# define RADEON_ONE_REG_WR (1 << 15) -#define RADEON_CP_PACKET1 0x40000000 -#define RADEON_CP_PACKET2 0x80000000 -#define RADEON_CP_PACKET3 0xC0000000 -# define RADEON_3D_RNDR_GEN_INDX_PRIM 0x00002300 -# define RADEON_WAIT_FOR_IDLE 0x00002600 -# define RADEON_3D_DRAW_IMMD 0x00002900 -# define RADEON_3D_CLEAR_ZMASK 0x00003200 -# define RADEON_CNTL_HOSTDATA_BLT 0x00009400 -# define RADEON_CNTL_PAINT_MULTI 0x00009A00 -# define RADEON_CNTL_BITBLT_MULTI 0x00009B00 - -#define RADEON_CP_PACKET_MASK 0xC0000000 -#define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 -#define RADEON_CP_PACKET0_REG_MASK 0x000007ff -#define RADEON_CP_PACKET1_REG0_MASK 0x000007ff -#define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 - -#define RADEON_VTX_Z_PRESENT (1 << 31) - -#define RADEON_PRIM_TYPE_NONE (0 << 0) -#define RADEON_PRIM_TYPE_POINT (1 << 0) -#define RADEON_PRIM_TYPE_LINE (2 << 0) -#define RADEON_PRIM_TYPE_LINE_STRIP (3 << 0) -#define RADEON_PRIM_TYPE_TRI_LIST (4 << 0) -#define RADEON_PRIM_TYPE_TRI_FAN (5 << 0) -#define RADEON_PRIM_TYPE_TRI_STRIP (6 << 0) -#define RADEON_PRIM_TYPE_TRI_TYPE2 (7 << 0) -#define RADEON_PRIM_TYPE_RECT_LIST (8 << 0) -#define RADEON_PRIM_TYPE_3VRT_POINT_LIST (9 << 0) -#define RADEON_PRIM_TYPE_3VRT_LINE_LIST (10 << 0) -#define RADEON_PRIM_WALK_IND (1 << 4) -#define RADEON_PRIM_WALK_LIST (2 << 4) -#define RADEON_PRIM_WALK_RING (3 << 4) -#define RADEON_COLOR_ORDER_BGRA (0 << 6) -#define RADEON_COLOR_ORDER_RGBA (1 << 6) -#define RADEON_MAOS_ENABLE (1 << 7) -#define RADEON_VTX_FMT_R128_MODE (0 << 8) -#define RADEON_VTX_FMT_RADEON_MODE (1 << 8) -#define RADEON_NUM_VERTICES_SHIFT 16 - -#define RADEON_COLOR_FORMAT_CI8 2 -#define RADEON_COLOR_FORMAT_ARGB1555 3 -#define RADEON_COLOR_FORMAT_RGB565 4 -#define RADEON_COLOR_FORMAT_ARGB8888 6 -#define RADEON_COLOR_FORMAT_RGB332 7 -#define RADEON_COLOR_FORMAT_RGB8 9 -#define RADEON_COLOR_FORMAT_ARGB4444 15 - -#define RADEON_TXFORMAT_I8 0 -#define RADEON_TXFORMAT_AI88 1 -#define RADEON_TXFORMAT_RGB332 2 -#define RADEON_TXFORMAT_ARGB1555 3 -#define RADEON_TXFORMAT_RGB565 4 -#define RADEON_TXFORMAT_ARGB4444 5 -#define RADEON_TXFORMAT_ARGB8888 6 -#define RADEON_TXFORMAT_RGBA8888 7 - -/* Constants */ -#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ - -#define RADEON_LAST_FRAME_REG RADEON_SCRATCH_REG0 -#define RADEON_LAST_DISPATCH_REG RADEON_SCRATCH_REG1 -#define RADEON_LAST_CLEAR_REG RADEON_SCRATCH_REG2 -#define RADEON_LAST_DISPATCH 1 - -#define RADEON_MAX_VB_AGE 0x7fffffff -#define RADEON_MAX_VB_VERTS (0xffff) - -#define RADEON_RING_HIGH_MARK 128 - - -#define RADEON_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) -#define RADEON_ADDR(reg) (RADEON_BASE( reg ) + reg) - -#define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg ) -#ifdef __alpha__ -#define RADEON_READ(reg) (_RADEON_READ((u32 *)RADEON_ADDR( reg ))) -static inline u32 _RADEON_READ(u32 *addr) -{ - mb(); - return *(volatile u32 *)addr; -} -#define RADEON_WRITE(reg,val) \ -do { \ - wmb(); \ - RADEON_DEREF(reg) = val; \ -} while (0) -#else -#define RADEON_READ(reg) RADEON_DEREF( reg ) -#define RADEON_WRITE(reg, val) do { RADEON_DEREF( reg ) = val; } while (0) -#endif - -#define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg ) -#ifdef __alpha__ -#define RADEON_READ8(reg) _RADEON_READ8((u8 *)RADEON_ADDR( reg )) -static inline u8 _RADEON_READ8(u8 *addr) -{ - mb(); - return *(volatile u8 *)addr; -} -#define RADEON_WRITE8(reg,val) \ -do { \ - wmb(); \ - RADEON_DEREF8( reg ) = val; \ -} while (0) -#else -#define RADEON_READ8(reg) RADEON_DEREF8( reg ) -#define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0) -#endif - -#define RADEON_WRITE_PLL( addr, val ) \ -do { \ - RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ - ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ - RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ -} while (0) - -extern int RADEON_READ_PLL( drm_device_t *dev, int addr ); - - -#define CP_PACKET0( reg, n ) \ - (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) -#define CP_PACKET0_TABLE( reg, n ) \ - (RADEON_CP_PACKET0 | RADEON_ONE_REG_WR | ((n) << 16) | ((reg) >> 2)) -#define CP_PACKET1( reg0, reg1 ) \ - (RADEON_CP_PACKET1 | (((reg1) >> 2) << 15) | ((reg0) >> 2)) -#define CP_PACKET2() \ - (RADEON_CP_PACKET2) -#define CP_PACKET3( pkt, n ) \ - (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) - - -/* ================================================================ - * Engine control helper macros - */ - -#define RADEON_WAIT_UNTIL_2D_IDLE() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ -} while (0) - -#define RADEON_WAIT_UNTIL_3D_IDLE() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ -} while (0) - -#define RADEON_WAIT_UNTIL_IDLE() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ - RADEON_WAIT_3D_IDLECLEAN | \ - RADEON_WAIT_HOST_IDLECLEAN) ); \ -} while (0) - -#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \ - OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ - OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \ -} while (0) - -#define RADEON_FLUSH_CACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB2D_DC_FLUSH ); \ -} while (0) - -#define RADEON_PURGE_CACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ -} while (0) - -#define RADEON_FLUSH_ZCACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB3D_ZC_FLUSH ); \ -} while (0) - -#define RADEON_PURGE_ZCACHE() do { \ - OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ - OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \ -} while (0) - - -/* ================================================================ - * Misc helper macros - */ - -#define LOCK_TEST_WITH_RETURN( dev ) \ -do { \ - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ - dev->lock.pid != current->pid ) { \ - DRM_ERROR( "%s called without lock held\n", \ - __FUNCTION__ ); \ - return -EINVAL; \ - } \ -} while (0) - -#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \ - if ( ring->space < ring->high_mark ) { \ - for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - radeon_update_ring_snapshot( ring ); \ - if ( ring->space >= ring->high_mark ) \ - goto __ring_space_done; \ - udelay( 1 ); \ - } \ - DRM_ERROR( "ring space check failed!\n" ); \ - return -EBUSY; \ - } \ - __ring_space_done: \ -} while (0) - -#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ -do { \ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \ - if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ - int __ret = radeon_do_cp_idle( dev_priv ); \ - if ( __ret < 0 ) return __ret; \ - sarea_priv->last_dispatch = 0; \ - radeon_freelist_reset( dev ); \ - } \ -} while (0) - -#define RADEON_DISPATCH_AGE( age ) do { \ - OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \ - OUT_RING( age ); \ -} while (0) - -#define RADEON_FRAME_AGE( age ) do { \ - OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \ - OUT_RING( age ); \ -} while (0) - -#define RADEON_CLEAR_AGE( age ) do { \ - OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \ - OUT_RING( age ); \ -} while (0) - - -/* ================================================================ - * Ring control - */ - -#define radeon_flush_write_combine() mb() - - -#define RADEON_VERBOSE 0 - -#define RING_LOCALS int write; unsigned int mask; volatile u32 *ring; - -#define BEGIN_RING( n ) do { \ - if ( RADEON_VERBOSE ) { \ - DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ - n, __FUNCTION__ ); \ - } \ - if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ - radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \ - } \ - dev_priv->ring.space -= (n) * sizeof(u32); \ - ring = dev_priv->ring.start; \ - write = dev_priv->ring.tail; \ - mask = dev_priv->ring.tail_mask; \ -} while (0) - -#define ADVANCE_RING() do { \ - if ( RADEON_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ - write, dev_priv->ring.tail ); \ - } \ - radeon_flush_write_combine(); \ - dev_priv->ring.tail = write; \ - RADEON_WRITE( RADEON_CP_RB_WPTR, write ); \ -} while (0) - -#define OUT_RING( x ) do { \ - if ( RADEON_VERBOSE ) { \ - DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ - (unsigned int)(x), write ); \ - } \ - ring[write++] = (x); \ - write &= mask; \ -} while (0) - -#define RADEON_PERFORMANCE_BOXES 0 - -#endif /* __RADEON_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:1.4 Mon Jan 7 16:44:36 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c Thu Feb 27 12:32:39 2003 @@ -1,1483 +0,0 @@ -/* radeon_state.c -- State support for Radeon -*- linux-c -*- - * - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - */ - -#define __NO_VERSION__ -#include "radeon.h" -#include "drmP.h" -#include "radeon_drv.h" -#include "drm.h" -#include <linux/delay.h> - - -/* ================================================================ - * CP hardware state programming functions - */ - -static inline void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv, - drm_clip_rect_t *box ) -{ - RING_LOCALS; - - DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n", - box->x1, box->y1, box->x2, box->y2 ); - - BEGIN_RING( 4 ); - - OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) ); - OUT_RING( (box->y1 << 16) | box->x1 ); - - OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) ); - OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_context( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 14 ); - - OUT_RING( CP_PACKET0( RADEON_PP_MISC, 6 ) ); - OUT_RING( ctx->pp_misc ); - OUT_RING( ctx->pp_fog_color ); - OUT_RING( ctx->re_solid_color ); - OUT_RING( ctx->rb3d_blendcntl ); - OUT_RING( ctx->rb3d_depthoffset ); - OUT_RING( ctx->rb3d_depthpitch ); - OUT_RING( ctx->rb3d_zstencilcntl ); - - OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 2 ) ); - OUT_RING( ctx->pp_cntl ); - OUT_RING( ctx->rb3d_cntl ); - OUT_RING( ctx->rb3d_coloroffset ); - - OUT_RING( CP_PACKET0( RADEON_RB3D_COLORPITCH, 0 ) ); - OUT_RING( ctx->rb3d_colorpitch ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_vertfmt( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CP_PACKET0( RADEON_SE_COORD_FMT, 0 ) ); - OUT_RING( ctx->se_coord_fmt ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_line( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 ); - - OUT_RING( CP_PACKET0( RADEON_RE_LINE_PATTERN, 1 ) ); - OUT_RING( ctx->re_line_pattern ); - OUT_RING( ctx->re_line_state ); - - OUT_RING( CP_PACKET0( RADEON_SE_LINE_WIDTH, 0 ) ); - OUT_RING( ctx->se_line_width ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_bumpmap( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 5 ); - - OUT_RING( CP_PACKET0( RADEON_PP_LUM_MATRIX, 0 ) ); - OUT_RING( ctx->pp_lum_matrix ); - - OUT_RING( CP_PACKET0( RADEON_PP_ROT_MATRIX_0, 1 ) ); - OUT_RING( ctx->pp_rot_matrix_0 ); - OUT_RING( ctx->pp_rot_matrix_1 ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_masks( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 4 ); - - OUT_RING( CP_PACKET0( RADEON_RB3D_STENCILREFMASK, 2 ) ); - OUT_RING( ctx->rb3d_stencilrefmask ); - OUT_RING( ctx->rb3d_ropcntl ); - OUT_RING( ctx->rb3d_planemask ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_viewport( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 7 ); - - OUT_RING( CP_PACKET0( RADEON_SE_VPORT_XSCALE, 5 ) ); - OUT_RING( ctx->se_vport_xscale ); - OUT_RING( ctx->se_vport_xoffset ); - OUT_RING( ctx->se_vport_yscale ); - OUT_RING( ctx->se_vport_yoffset ); - OUT_RING( ctx->se_vport_zscale ); - OUT_RING( ctx->se_vport_zoffset ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_setup( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 4 ); - - OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); - OUT_RING( ctx->se_cntl ); - OUT_RING( CP_PACKET0( RADEON_SE_CNTL_STATUS, 0 ) ); - OUT_RING( ctx->se_cntl_status ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_tcl( drm_radeon_private_t *dev_priv ) -{ -#ifdef TCL_ENABLE - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 29 ); - - OUT_RING( CP_PACKET0( RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED, 27 ) ); - OUT_RING( ctx->se_tcl_material_emmissive.red ); - OUT_RING( ctx->se_tcl_material_emmissive.green ); - OUT_RING( ctx->se_tcl_material_emmissive.blue ); - OUT_RING( ctx->se_tcl_material_emmissive.alpha ); - OUT_RING( ctx->se_tcl_material_ambient.red ); - OUT_RING( ctx->se_tcl_material_ambient.green ); - OUT_RING( ctx->se_tcl_material_ambient.blue ); - OUT_RING( ctx->se_tcl_material_ambient.alpha ); - OUT_RING( ctx->se_tcl_material_diffuse.red ); - OUT_RING( ctx->se_tcl_material_diffuse.green ); - OUT_RING( ctx->se_tcl_material_diffuse.blue ); - OUT_RING( ctx->se_tcl_material_diffuse.alpha ); - OUT_RING( ctx->se_tcl_material_specular.red ); - OUT_RING( ctx->se_tcl_material_specular.green ); - OUT_RING( ctx->se_tcl_material_specular.blue ); - OUT_RING( ctx->se_tcl_material_specular.alpha ); - OUT_RING( ctx->se_tcl_shininess ); - OUT_RING( ctx->se_tcl_output_vtx_fmt ); - OUT_RING( ctx->se_tcl_output_vtx_sel ); - OUT_RING( ctx->se_tcl_matrix_select_0 ); - OUT_RING( ctx->se_tcl_matrix_select_1 ); - OUT_RING( ctx->se_tcl_ucp_vert_blend_ctl ); - OUT_RING( ctx->se_tcl_texture_proc_ctl ); - OUT_RING( ctx->se_tcl_light_model_ctl ); - for ( i = 0 ; i < 4 ; i++ ) { - OUT_RING( ctx->se_tcl_per_light_ctl[i] ); - } - - ADVANCE_RING(); -#else - DRM_ERROR( "TCL not enabled!\n" ); -#endif -} - -static inline void radeon_emit_misc( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 2 ); - - OUT_RING( CP_PACKET0( RADEON_RE_MISC, 0 ) ); - OUT_RING( ctx->re_misc ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_tex0( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[0]; - RING_LOCALS; - DRM_DEBUG( " %s: offset=0x%x\n", __FUNCTION__, tex->pp_txoffset ); - - BEGIN_RING( 9 ); - - OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) ); - OUT_RING( tex->pp_txfilter ); - OUT_RING( tex->pp_txformat ); - OUT_RING( tex->pp_txoffset ); - OUT_RING( tex->pp_txcblend ); - OUT_RING( tex->pp_txablend ); - OUT_RING( tex->pp_tfactor ); - - OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_0, 0 ) ); - OUT_RING( tex->pp_border_color ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_tex1( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[1]; - RING_LOCALS; - DRM_DEBUG( " %s: offset=0x%x\n", __FUNCTION__, tex->pp_txoffset ); - - BEGIN_RING( 9 ); - - OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) ); - OUT_RING( tex->pp_txfilter ); - OUT_RING( tex->pp_txformat ); - OUT_RING( tex->pp_txoffset ); - OUT_RING( tex->pp_txcblend ); - OUT_RING( tex->pp_txablend ); - OUT_RING( tex->pp_tfactor ); - - OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_1, 0 ) ); - OUT_RING( tex->pp_border_color ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_tex2( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[2]; - RING_LOCALS; - DRM_DEBUG( " %s\n", __FUNCTION__ ); - - BEGIN_RING( 9 ); - - OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) ); - OUT_RING( tex->pp_txfilter ); - OUT_RING( tex->pp_txformat ); - OUT_RING( tex->pp_txoffset ); - OUT_RING( tex->pp_txcblend ); - OUT_RING( tex->pp_txablend ); - OUT_RING( tex->pp_tfactor ); - - OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_2, 0 ) ); - OUT_RING( tex->pp_border_color ); - - ADVANCE_RING(); -} - -static inline void radeon_emit_state( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int dirty = sarea_priv->dirty; - - DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); - - if ( dirty & RADEON_UPLOAD_CONTEXT ) { - radeon_emit_context( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_CONTEXT; - } - - if ( dirty & RADEON_UPLOAD_VERTFMT ) { - radeon_emit_vertfmt( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_VERTFMT; - } - - if ( dirty & RADEON_UPLOAD_LINE ) { - radeon_emit_line( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_LINE; - } - - if ( dirty & RADEON_UPLOAD_BUMPMAP ) { - radeon_emit_bumpmap( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_BUMPMAP; - } - - if ( dirty & RADEON_UPLOAD_MASKS ) { - radeon_emit_masks( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_MASKS; - } - - if ( dirty & RADEON_UPLOAD_VIEWPORT ) { - radeon_emit_viewport( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_VIEWPORT; - } - - if ( dirty & RADEON_UPLOAD_SETUP ) { - radeon_emit_setup( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_SETUP; - } - - if ( dirty & RADEON_UPLOAD_TCL ) { -#ifdef TCL_ENABLE - radeon_emit_tcl( dev_priv ); -#endif - sarea_priv->dirty &= ~RADEON_UPLOAD_TCL; - } - - if ( dirty & RADEON_UPLOAD_MISC ) { - radeon_emit_misc( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_MISC; - } - - if ( dirty & RADEON_UPLOAD_TEX0 ) { - radeon_emit_tex0( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_TEX0; - } - - if ( dirty & RADEON_UPLOAD_TEX1 ) { - radeon_emit_tex1( dev_priv ); - sarea_priv->dirty &= ~RADEON_UPLOAD_TEX1; - } - - if ( dirty & RADEON_UPLOAD_TEX2 ) { -#if 0 - radeon_emit_tex2( dev_priv ); -#endif - sarea_priv->dirty &= ~RADEON_UPLOAD_TEX2; - } - - sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | - RADEON_UPLOAD_TEX1IMAGES | - RADEON_UPLOAD_TEX2IMAGES | - RADEON_REQUIRE_QUIESCENCE); -} - - -#if RADEON_PERFORMANCE_BOXES -/* ================================================================ - * Performance monitoring functions - */ - -static void radeon_clear_box( drm_radeon_private_t *dev_priv, - int x, int y, int w, int h, - int r, int g, int b ) -{ - u32 pitch, offset; - u32 color; - RING_LOCALS; - - switch ( dev_priv->color_fmt ) { - case RADEON_COLOR_FORMAT_RGB565: - color = (((r & 0xf8) << 8) | - ((g & 0xfc) << 3) | - ((b & 0xf8) >> 3)); - break; - case RADEON_COLOR_FORMAT_ARGB8888: - default: - color = (((0xff) << 24) | (r << 16) | (g << 8) | b); - break; - } - - offset = dev_priv->back_offset; - pitch = dev_priv->back_pitch >> 3; - - BEGIN_RING( 6 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_P | - RADEON_GMC_CLR_CMP_CNTL_DIS ); - - OUT_RING( (pitch << 22) | (offset >> 5) ); - OUT_RING( color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); -} - -static void radeon_cp_performance_boxes( drm_radeon_private_t *dev_priv ) -{ - if ( atomic_read( &dev_priv->idle_count ) == 0 ) { - radeon_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); - } else { - atomic_set( &dev_priv->idle_count, 0 ); - } -} - -#endif - - -/* ================================================================ - * CP command dispatch functions - */ - -static void radeon_print_dirty( const char *msg, unsigned int flags ) -{ - DRM_DEBUG( "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", - msg, - flags, - (flags & RADEON_UPLOAD_CONTEXT) ? "context, " : "", - (flags & RADEON_UPLOAD_VERTFMT) ? "vertfmt, " : "", - (flags & RADEON_UPLOAD_LINE) ? "line, " : "", - (flags & RADEON_UPLOAD_BUMPMAP) ? "bumpmap, " : "", - (flags & RADEON_UPLOAD_MASKS) ? "masks, " : "", - (flags & RADEON_UPLOAD_VIEWPORT) ? "viewport, " : "", - (flags & RADEON_UPLOAD_SETUP) ? "setup, " : "", - (flags & RADEON_UPLOAD_TCL) ? "tcl, " : "", - (flags & RADEON_UPLOAD_MISC) ? "misc, " : "", - (flags & RADEON_UPLOAD_TEX0) ? "tex0, " : "", - (flags & RADEON_UPLOAD_TEX1) ? "tex1, " : "", - (flags & RADEON_UPLOAD_TEX2) ? "tex2, " : "", - (flags & RADEON_UPLOAD_CLIPRECTS) ? "cliprects, " : "", - (flags & RADEON_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); -} - -static void radeon_cp_dispatch_clear( drm_device_t *dev, - drm_radeon_clear_t *clear, - drm_radeon_clear_rect_t *depth_boxes ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int flags = clear->flags; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { - unsigned int tmp = flags; - - flags &= ~(RADEON_FRONT | RADEON_BACK); - if ( tmp & RADEON_FRONT ) flags |= RADEON_BACK; - if ( tmp & RADEON_BACK ) flags |= RADEON_FRONT; - } - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", - x, y, w, h, flags ); - - if ( flags & (RADEON_FRONT | RADEON_BACK) ) { - BEGIN_RING( 4 ); - - /* Ensure the 3D stream is idle before doing a - * 2D fill to clear the front or back buffer. - */ - RADEON_WAIT_UNTIL_3D_IDLE(); - - OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) ); - OUT_RING( clear->color_mask ); - - ADVANCE_RING(); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_MASKS); - } - - if ( flags & RADEON_FRONT ) { - BEGIN_RING( 6 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_P | - RADEON_GMC_CLR_CMP_CNTL_DIS ); - - OUT_RING( dev_priv->front_pitch_offset ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - if ( flags & RADEON_BACK ) { - BEGIN_RING( 6 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_SOLID_COLOR | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_P | - RADEON_GMC_CLR_CMP_CNTL_DIS ); - - OUT_RING( dev_priv->back_pitch_offset ); - OUT_RING( clear->clear_color ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - - } - - if ( flags & RADEON_DEPTH ) { - drm_radeon_depth_clear_t *depth_clear = - &dev_priv->depth_clear; - - if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv ); - } - - /* FIXME: Render a rectangle to clear the depth - * buffer. So much for those "fast Z clears"... - */ - BEGIN_RING( 23 ); - - RADEON_WAIT_UNTIL_2D_IDLE(); - - OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 1 ) ); - OUT_RING( 0x00000000 ); - OUT_RING( depth_clear->rb3d_cntl ); - OUT_RING( CP_PACKET0( RADEON_RB3D_ZSTENCILCNTL, 0 ) ); - OUT_RING( depth_clear->rb3d_zstencilcntl ); - OUT_RING( CP_PACKET0( RADEON_RB3D_PLANEMASK, 0 ) ); - OUT_RING( 0x00000000 ); - OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); - OUT_RING( depth_clear->se_cntl ); - - OUT_RING( CP_PACKET3( RADEON_3D_DRAW_IMMD, 10 ) ); - OUT_RING( RADEON_VTX_Z_PRESENT ); - OUT_RING( (RADEON_PRIM_TYPE_RECT_LIST | - RADEON_PRIM_WALK_RING | - RADEON_MAOS_ENABLE | - RADEON_VTX_FMT_RADEON_MODE | - (3 << RADEON_NUM_VERTICES_SHIFT)) ); - - OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); - OUT_RING( depth_boxes[i].ui[CLEAR_Y1] ); - OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - - OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); - OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); - OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - - OUT_RING( depth_boxes[i].ui[CLEAR_X2] ); - OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); - OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - - ADVANCE_RING(); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_SETUP | - RADEON_UPLOAD_MASKS); - } - } - - /* Increment the clear counter. The client-side 3D driver must - * wait on this value before performing the clear ioctl. We - * need this because the card's so damned fast... - */ - dev_priv->sarea_priv->last_clear++; - - BEGIN_RING( 4 ); - - RADEON_CLEAR_AGE( dev_priv->sarea_priv->last_clear ); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); -} - -static void radeon_cp_dispatch_swap( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - -#if RADEON_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - radeon_cp_performance_boxes( dev_priv ); -#endif - - /* Wait for the 3D stream to idle before dispatching the bitblt. - * This will prevent data corruption between the two streams. - */ - BEGIN_RING( 2 ); - - RADEON_WAIT_UNTIL_3D_IDLE(); - - ADVANCE_RING(); - - for ( i = 0 ; i < nbox ; i++ ) { - int x = pbox[i].x1; - int y = pbox[i].y1; - int w = pbox[i].x2 - x; - int h = pbox[i].y2 - y; - - DRM_DEBUG( "dispatch swap %d,%d-%d,%d\n", - x, y, w, h ); - - BEGIN_RING( 7 ); - - OUT_RING( CP_PACKET3( RADEON_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( RADEON_GMC_SRC_PITCH_OFFSET_CNTL | - RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_NONE | - (dev_priv->color_fmt << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_S | - RADEON_DP_SRC_SOURCE_MEMORY | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_WR_MSK_DIS ); - - OUT_RING( dev_priv->back_pitch_offset ); - OUT_RING( dev_priv->front_pitch_offset ); - - OUT_RING( (x << 16) | y ); - OUT_RING( (x << 16) | y ); - OUT_RING( (w << 16) | h ); - - ADVANCE_RING(); - } - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 4 ); - - RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); - RADEON_WAIT_UNTIL_2D_IDLE(); - - ADVANCE_RING(); -} - -static void radeon_cp_dispatch_flip( drm_device_t *dev ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - RING_LOCALS; - DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - -#if RADEON_PERFORMANCE_BOXES - /* Do some trivial performance monitoring... - */ - radeon_cp_performance_boxes( dev_priv ); -#endif - - BEGIN_RING( 6 ); - - RADEON_WAIT_UNTIL_3D_IDLE(); - RADEON_WAIT_UNTIL_PAGE_FLIPPED(); - - OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET, 0 ) ); - - if ( dev_priv->current_page == 0 ) { - OUT_RING( dev_priv->back_offset ); - dev_priv->current_page = 1; - } else { - OUT_RING( dev_priv->front_offset ); - dev_priv->current_page = 0; - } - - ADVANCE_RING(); - - /* Increment the frame counter. The client-side 3D driver must - * throttle the framerate by waiting for this value before - * performing the swapbuffer ioctl. - */ - dev_priv->sarea_priv->last_frame++; - - BEGIN_RING( 2 ); - - RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); - - ADVANCE_RING(); -} - -static void radeon_cp_dispatch_vertex( drm_device_t *dev, - drm_buf_t *buf ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = dev_priv->agp_buffers_offset + buf->offset; - int size = buf->used; - int prim = buf_priv->prim; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox ); - - if ( 0 ) - radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty ); - - if ( buf->used ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv ); - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - radeon_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - /* Emit the vertex buffer rendering commands */ - BEGIN_RING( 5 ); - - OUT_RING( CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, 3 ) ); - OUT_RING( offset ); - OUT_RING( size ); - OUT_RING( format ); - OUT_RING( prim | RADEON_PRIM_WALK_LIST | - RADEON_COLOR_ORDER_RGBA | - RADEON_VTX_FMT_RADEON_MODE | - (size << RADEON_NUM_VERTICES_SHIFT) ); - - ADVANCE_RING(); - - i++; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - RADEON_DISPATCH_AGE( buf_priv->age ); - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~RADEON_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - - -static void radeon_cp_dispatch_indirect( drm_device_t *dev, - drm_buf_t *buf, - int start, int end ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - RING_LOCALS; - DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", - buf->idx, start, end ); - - if ( start != end ) { - int offset = (dev_priv->agp_buffers_offset - + buf->offset + start); - int dwords = (end - start + 3) / sizeof(u32); - - /* Indirect buffer data must be an even number of - * dwords, so if we've been given an odd number we must - * pad the data with a Type-2 CP packet. - */ - if ( dwords & 1 ) { - u32 *data = (u32 *) - ((char *)dev_priv->buffers->handle - + buf->offset + start); - data[dwords++] = RADEON_CP_PACKET2; - } - - buf_priv->dispatched = 1; - - /* Fire off the indirect buffer */ - BEGIN_RING( 3 ); - - OUT_RING( CP_PACKET0( RADEON_CP_IB_BASE, 1 ) ); - OUT_RING( offset ); - OUT_RING( dwords ); - - ADVANCE_RING(); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the indirect buffer age */ - BEGIN_RING( 2 ); - RADEON_DISPATCH_AGE( buf_priv->age ); - ADVANCE_RING(); - - buf->pending = 1; - buf->used = 0; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; -} - -static void radeon_cp_dispatch_indices( drm_device_t *dev, - drm_buf_t *buf, - int start, int end, - int count ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv = buf->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - int format = sarea_priv->vc_format; - int offset = dev_priv->agp_buffers_offset; - int prim = buf_priv->prim; - u32 *data; - int dwords; - int i = 0; - RING_LOCALS; - DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - - if ( 0 ) - radeon_print_dirty( "dispatch_indices", sarea_priv->dirty ); - - if ( start != end ) { - buf_priv->dispatched = 1; - - if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv ); - } - - dwords = (end - start + 3) / sizeof(u32); - - data = (u32 *)((char *)dev_priv->buffers->handle - + buf->offset + start); - - data[0] = CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, dwords-2 ); - - data[1] = offset; - data[2] = RADEON_MAX_VB_VERTS; - data[3] = format; - data[4] = (prim | RADEON_PRIM_WALK_IND | - RADEON_COLOR_ORDER_RGBA | - RADEON_VTX_FMT_RADEON_MODE | - (count << RADEON_NUM_VERTICES_SHIFT) ); - - if ( count & 0x1 ) { - data[dwords-1] &= 0x0000ffff; - } - - do { - /* Emit the next set of up to three cliprects */ - if ( i < sarea_priv->nbox ) { - radeon_emit_clip_rect( dev_priv, - &sarea_priv->boxes[i] ); - } - - radeon_cp_dispatch_indirect( dev, buf, start, end ); - - i++; - } while ( i < sarea_priv->nbox ); - } - - if ( buf_priv->discard ) { - buf_priv->age = dev_priv->sarea_priv->last_dispatch; - - /* Emit the vertex buffer age */ - BEGIN_RING( 2 ); - RADEON_DISPATCH_AGE( buf_priv->age ); - ADVANCE_RING(); - - buf->pending = 1; - /* FIXME: Check dispatched field */ - buf_priv->dispatched = 0; - } - - dev_priv->sarea_priv->last_dispatch++; - - sarea_priv->dirty &= ~RADEON_UPLOAD_CLIPRECTS; - sarea_priv->nbox = 0; -} - -#define RADEON_MAX_TEXTURE_SIZE (RADEON_BUFFER_SIZE - 8 * sizeof(u32)) - -static int radeon_cp_dispatch_texture( drm_device_t *dev, - drm_radeon_texture_t *tex, - drm_radeon_tex_image_t *image ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - u32 format; - u32 *buffer; - u8 *data; - int size, dwords, tex_width, blit_width; - u32 y, height; - int ret = 0, i; - RING_LOCALS; - - /* FIXME: Be smarter about this... - */ - buf = radeon_freelist_get( dev ); - if ( !buf ) return -EAGAIN; - - DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", - tex->offset >> 10, tex->pitch, tex->format, - image->x, image->y, image->width, image->height ); - - buf_priv = buf->dev_private; - - /* The compiler won't optimize away a division by a variable, - * even if the only legal values are powers of two. Thus, we'll - * use a shift instead. - */ - switch ( tex->format ) { - case RADEON_TXFORMAT_ARGB8888: - case RADEON_TXFORMAT_RGBA8888: - format = RADEON_COLOR_FORMAT_ARGB8888; - tex_width = tex->width * 4; - blit_width = image->width * 4; - break; - case RADEON_TXFORMAT_AI88: - case RADEON_TXFORMAT_ARGB1555: - case RADEON_TXFORMAT_RGB565: - case RADEON_TXFORMAT_ARGB4444: - format = RADEON_COLOR_FORMAT_RGB565; - tex_width = tex->width * 2; - blit_width = image->width * 2; - break; - case RADEON_TXFORMAT_I8: - case RADEON_TXFORMAT_RGB332: - format = RADEON_COLOR_FORMAT_CI8; - tex_width = tex->width * 1; - blit_width = image->width * 1; - break; - default: - DRM_ERROR( "invalid texture format %d\n", tex->format ); - return -EINVAL; - } - - DRM_DEBUG( " tex=%dx%d blit=%d\n", - tex_width, tex->height, blit_width ); - - /* Flush the pixel cache. This ensures no pixel data gets mixed - * up with the texture data from the host data blit, otherwise - * part of the texture image may be corrupted. - */ - BEGIN_RING( 4 ); - - RADEON_FLUSH_CACHE(); - RADEON_WAIT_UNTIL_IDLE(); - - ADVANCE_RING(); - - /* Make a copy of the parameters in case we have to update them - * for a multi-pass texture blit. - */ - y = image->y; - height = image->height; - data = (u8 *)image->data; - - size = height * blit_width; - - if ( size > RADEON_MAX_TEXTURE_SIZE ) { - /* Texture image is too large, do a multipass upload */ - ret = -EAGAIN; - - /* Adjust the blit size to fit the indirect buffer */ - height = RADEON_MAX_TEXTURE_SIZE / blit_width; - size = height * blit_width; - - /* Update the input parameters for next time */ - image->y += height; - image->height -= height; - image->data = (char *)image->data + size; - - if ( copy_to_user( tex->image, image, sizeof(*image) ) ) { - DRM_ERROR( "EFAULT on tex->image\n" ); - return -EFAULT; - } - } else if ( size < 4 && size > 0 ) { - size = 4; - } - - dwords = size / 4; - - /* Dispatch the indirect buffer. - */ - buffer = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); - - buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 ); - buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_NONE | - (format << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_S | - RADEON_DP_SRC_SOURCE_HOST_DATA | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_WR_MSK_DIS); - - buffer[2] = (tex->pitch << 22) | (tex->offset >> 10); - buffer[3] = 0xffffffff; - buffer[4] = 0xffffffff; - buffer[5] = (y << 16) | image->x; - buffer[6] = (height << 16) | image->width; - buffer[7] = dwords; - - buffer += 8; - - if ( tex_width >= 32 ) { - /* Texture image width is larger than the minimum, so we - * can upload it directly. - */ - if ( copy_from_user( buffer, data, dwords * sizeof(u32) ) ) { - DRM_ERROR( "EFAULT on data, %d dwords\n", dwords ); - return -EFAULT; - } - } else { - /* Texture image width is less than the minimum, so we - * need to pad out each image scanline to the minimum - * width. - */ - for ( i = 0 ; i < tex->height ; i++ ) { - if ( copy_from_user( buffer, data, tex_width ) ) { - DRM_ERROR( "EFAULT on pad, %d bytes\n", - tex_width ); - return -EFAULT; - } - buffer += 8; - data += tex_width; - } - } - - buf->pid = current->pid; - buf->used = (dwords + 8) * sizeof(u32); - buf_priv->discard = 1; - - radeon_cp_dispatch_indirect( dev, buf, 0, buf->used ); - - /* Flush the pixel cache after the blit completes. This ensures - * the texture data is written out to memory before rendering - * continues. - */ - BEGIN_RING( 4 ); - - RADEON_FLUSH_CACHE(); - RADEON_WAIT_UNTIL_2D_IDLE(); - - ADVANCE_RING(); - - return ret; -} - -static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) -{ - drm_radeon_private_t *dev_priv = dev->dev_private; - int i; - RING_LOCALS; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - BEGIN_RING( 35 ); - - OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) ); - OUT_RING( 0x00000000 ); - - OUT_RING( CP_PACKET0_TABLE( RADEON_RE_STIPPLE_DATA, 31 ) ); - for ( i = 0 ; i < 32 ; i++ ) { - OUT_RING( stipple[i] ); - } - - ADVANCE_RING(); -} - - -/* ================================================================ - * IOCTL functions - */ - -int radeon_cp_clear( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_radeon_clear_t clear; - drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &clear, (drm_radeon_clear_t *)arg, - sizeof(clear) ) ) - return -EFAULT; - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; - - if ( copy_from_user( &depth_boxes, clear.depth_boxes, - sarea_priv->nbox * sizeof(depth_boxes[0]) ) ) - return -EFAULT; - - radeon_cp_dispatch_clear( dev, &clear, depth_boxes ); - - return 0; -} - -int radeon_cp_swap( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - LOCK_TEST_WITH_RETURN( dev ); - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) - sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; - - if ( !dev_priv->page_flipping ) { - radeon_cp_dispatch_swap( dev ); - dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_MASKS); - } else { - radeon_cp_dispatch_flip( dev ); - } - - return 0; -} - -int radeon_cp_vertex( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_vertex_t vertex; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - if ( copy_from_user( &vertex, (drm_radeon_vertex_t *)arg, - sizeof(vertex) ) ) - return -EFAULT; - - DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", - __FUNCTION__, current->pid, - vertex.idx, vertex.count, vertex.discard ); - - if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - vertex.idx, dma->buf_count - 1 ); - return -EINVAL; - } - if ( vertex.prim < 0 || - vertex.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { - DRM_ERROR( "buffer prim %d\n", vertex.prim ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[vertex.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); - return -EINVAL; - } - - buf->used = vertex.count; - buf_priv->prim = vertex.prim; - buf_priv->discard = vertex.discard; - - radeon_cp_dispatch_vertex( dev, buf ); - - return 0; -} - -int radeon_cp_indices( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_indices_t elts; - int count; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - if ( copy_from_user( &elts, (drm_radeon_indices_t *)arg, - sizeof(elts) ) ) - return -EFAULT; - - DRM_DEBUG( "%s: pid=%d index=%d start=%d end=%d discard=%d\n", - __FUNCTION__, current->pid, - elts.idx, elts.start, elts.end, elts.discard ); - - if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - elts.idx, dma->buf_count - 1 ); - return -EINVAL; - } - if ( elts.prim < 0 || - elts.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { - DRM_ERROR( "buffer prim %d\n", elts.prim ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf = dma->buflist[elts.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", elts.idx ); - return -EINVAL; - } - - count = (elts.end - elts.start) / sizeof(u16); - elts.start -= RADEON_INDEX_PRIM_OFFSET; - - if ( elts.start & 0x7 ) { - DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); - return -EINVAL; - } - if ( elts.start < buf->used ) { - DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); - return -EINVAL; - } - - buf->used = elts.end; - buf_priv->prim = elts.prim; - buf_priv->discard = elts.discard; - - radeon_cp_dispatch_indices( dev, buf, elts.start, elts.end, count ); - - return 0; -} - -int radeon_cp_texture( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_texture_t tex; - drm_radeon_tex_image_t image; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &tex, (drm_radeon_texture_t *)arg, sizeof(tex) ) ) - return -EFAULT; - - if ( tex.image == NULL ) { - DRM_ERROR( "null texture image!\n" ); - return -EINVAL; - } - - if ( copy_from_user( &image, - (drm_radeon_tex_image_t *)tex.image, - sizeof(image) ) ) - return -EFAULT; - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - return radeon_cp_dispatch_texture( dev, &tex, &image ); -} - -int radeon_cp_stipple( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_stipple_t stipple; - u32 mask[32]; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( copy_from_user( &stipple, (drm_radeon_stipple_t *)arg, - sizeof(stipple) ) ) - return -EFAULT; - - if ( copy_from_user( &mask, stipple.mask, 32 * sizeof(u32) ) ) - return -EFAULT; - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - - radeon_cp_dispatch_stipple( dev, mask ); - - return 0; -} - -int radeon_cp_indirect( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_radeon_buf_priv_t *buf_priv; - drm_radeon_indirect_t indirect; - RING_LOCALS; - - LOCK_TEST_WITH_RETURN( dev ); - - if ( !dev_priv ) { - DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - if ( copy_from_user( &indirect, (drm_radeon_indirect_t *)arg, - sizeof(indirect) ) ) - return -EFAULT; - - DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", - indirect.idx, indirect.start, - indirect.end, indirect.discard ); - - if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { - DRM_ERROR( "buffer index %d (of %d max)\n", - indirect.idx, dma->buf_count - 1 ); - return -EINVAL; - } - - buf = dma->buflist[indirect.idx]; - buf_priv = buf->dev_private; - - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); - return -EINVAL; - } - - if ( indirect.start < buf->used ) { - DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", - indirect.start, buf->used ); - return -EINVAL; - } - - RING_SPACE_TEST_WITH_RETURN( dev_priv ); - VB_AGE_TEST_WITH_RETURN( dev_priv ); - - buf->used = indirect.end; - buf_priv->discard = indirect.discard; - - /* Wait for the 3D stream to idle before the indirect buffer - * containing 2D acceleration commands is processed. - */ - BEGIN_RING( 2 ); - - RADEON_WAIT_UNTIL_3D_IDLE(); - - ADVANCE_RING(); - - /* Dispatch the indirect buffer full of commands from the - * X server. This is insecure and is thus only available to - * privileged clients. - */ - radeon_cp_dispatch_indirect( dev, buf, indirect.start, indirect.end ); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.2 Wed Dec 19 16:25:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h Wed Oct 30 07:52:38 2002 @@ -24,7 +24,7 @@ * DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h,v 1.2 2001/12/19 21:25:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h,v 1.3 2002/10/30 12:52:38 alanh Exp $ */ #ifndef __SIS_H__ #define __SIS_H__ @@ -41,6 +41,31 @@ #define __MUST_HAVE_AGP 0 #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 1 + +#define DRIVER_AUTHOR "SIS" +#define DRIVER_NAME "sis" +#define DRIVER_DESC "SIS 300/630/540" +#define DRIVER_DATE "20010503" +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 0 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 0 }, \ + /* AGP Memory Management */ \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sisp_agp_init, 1, 0 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sisp_agp_alloc, 1, 0 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sisp_agp_free, 1, 0 } +#if 0 /* these don't appear to be defined */ + /* SIS Stereo */ + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 } +#endif + +#define __HAVE_COUNTERS 5 /* Buffer customization: */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h:1.8 Mon May 21 00:53:47 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h Wed Oct 30 07:52:38 2002 @@ -2,6 +2,16 @@ #ifndef _sis_drm_public_h_ #define _sis_drm_public_h_ +/* SiS specific ioctls */ +#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) +#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) +#define SIS_IOCTL_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) +#define SIS_IOCTL_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) +#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) +#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) +#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) +#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) + typedef struct { int context; unsigned int offset; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.12 Thu Jan 10 14:05:41 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c Wed Oct 30 07:52:38 2002 @@ -31,31 +31,6 @@ #include "sis_drm.h" #include "sis_drv.h" -#define DRIVER_AUTHOR "SIS" -#define DRIVER_NAME "sis" -#define DRIVER_DESC "SIS 300/630/540" -#define DRIVER_DATE "20010503" -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 0 }, \ - [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 0 }, \ - /* AGP Memory Management */ \ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sisp_agp_init, 1, 0 }, \ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sisp_agp_alloc, 1, 0 }, \ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sisp_agp_free, 1, 0 } -#if 0 /* these don't appear to be defined */ - /* SIS Stereo */ - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 } -#endif - -#define __HAVE_COUNTERS 5 - #include "drm_auth.h" #include "drm_agpsupport.h" #include "drm_bufs.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c:1.4 Wed Jan 16 10:36:43 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c Mon Dec 16 11:19:28 2002 @@ -50,15 +50,16 @@ set_t *set; set = (set_t *)MALLOC(sizeof(set_t)); - for(i = 0; i < SET_SIZE; i++){ - set->list[i].free_next = i+1; - set->list[i].alloc_next = -1; - } - set->list[SET_SIZE-1].free_next = -1; - set->free = 0; - set->alloc = -1; - set->trace = -1; - + if (set) { + for(i = 0; i < SET_SIZE; i++){ + set->list[i].free_next = i+1; + set->list[i].alloc_next = -1; + } + set->list[SET_SIZE-1].free_next = -1; + set->free = 0; + set->alloc = -1; + set->trace = -1; + } return set; } @@ -172,7 +173,8 @@ { void *addr; addr = kmalloc(nmemb*size, GFP_KERNEL); - memset(addr, 0, nmemb*size); + if (addr) + memset(addr, 0, nmemb*size); return addr; } #define free(n) kfree(n) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.11 Wed Dec 19 16:25:59 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c Mon Nov 25 09:05:04 2002 @@ -183,10 +183,10 @@ if(block){ /* TODO */ agp.offset = block->ofs; - agp.free = (unsigned int)block; + agp.free = (unsigned long)block; if(!add_alloc_set(agp.context, AGP_TYPE, agp.free)){ DRM_DEBUG("adding to allocation set fails\n"); - mmFreeMem((PMemBlock)agp.free); + mmFreeMem((PMemBlock)(unsigned long)agp.free); retval = -1; } } @@ -219,7 +219,7 @@ return -1; } - mmFreeMem((PMemBlock)agp.free); + mmFreeMem((PMemBlock)(unsigned long)agp.free); if(!del_alloc_set(agp.context, AGP_TYPE, agp.free)) retval = -1; @@ -289,7 +289,7 @@ retval = setFirst(set, &item); while(retval){ DRM_DEBUG("free agp memory 0x%x\n", item); - mmFreeMem((PMemBlock)item); + mmFreeMem((PMemBlock)(unsigned long)item); retval = setNext(set, &item); } setDestroy(set); Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.12 Fri Aug 17 22:51:19 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c Wed Oct 30 07:52:38 2002 @@ -82,25 +82,6 @@ #include "drm_drawable.h" #include "drm_drv.h" -#ifndef MODULE -/* DRM(options) is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -/* JH- We have to hand expand the string ourselves because of the cpp. If - * anyone can think of a way that we can fit into the __setup macro without - * changing it, then please send the solution my way. - */ -static int __init tdfx_options( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", tdfx_options ); -#endif - #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile:1.12 xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile:1.12 Sat Dec 2 10:31:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile Mon Sep 16 14:06:14 2002 @@ -1,98 +1,67 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.12 2000/12/02 15:31:01 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.14 2002/09/16 18:06:14 eich Exp $ #define IHaveModules #include <Server.tmpl> -SRCS1 = pci.c xf86int10module.c helper_exec.c helper_mem.c xf86int10.c -OBJS1 = pci.o xf86int10module.o helper_exec.o helper_mem.o xf86int10.o +#define IHaveSubdirs + +#if defined(XF86INT10_BUILD) && \ + ( !defined(DoLoadableServer) || !defined(Int10SubLibs)) +#define DoSingleLib +# if XF86INT10_BUILD == X86VM +EXPOBJS = vm86/helper_exec.o vm86/linux_vm86.o vm86/xf86int10.o +SUBDIRS = vm86 +# elif XF86INT10_BUILD == X86EMU_OS +EXPOBJS = x86emu/debug.o x86emu/fpu.o x86emu/ops.o \ + x86emu/prim_ops.o x86emu/xf86int10.o x86emu/decode.o \ + x86emu/helper_exec.o x86emu/ops2.o x86emu/sys.o x86emu/xf86x86emu.o +SUBDIRS = x86emu +# endif +#else +SUBDIRS = vm86 x86emu +LNXDEF = -DDoSubModules +#endif + + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + +SRCS = pci.c xf86int10module.c helper_mem.c linux.c +OBJS = pci.o xf86int10module.o helper_mem.o linux.o + + LinkSourceFile(helper_mem.c,$(XF86SRC)/int10) -LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) LinkSourceFile(pci.c,$(XF86SRC)/int10) LinkSourceFile(xf86int10module.c,$(XF86SRC)/int10) -LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10) -LinkSourceFile(generic.c,$(XF86SRC)/int10) + INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(X86EMUINCLUDES) -DEFINES=-DHAVE_SYSV_IPC +DEFINES=-DHAVE_SYSV_IPC $(X86EMUDEFINES) $(EXTRADEFINES) -#if 0 -/* debugging stuff */ -#DEFINES =-D_PC -#undef XF86INT10_BUILD -#define XF86INT10_BUILD X86EMU_GENERIC -#define X86EMU_LIBPATH /usr/local/lib +#if defined(i386Architecture) || defined (x86_64Architecture) +EXTRADEFINES=-D_PC #endif -#if defined(i386Architecture) || defined(ia64Architecture) -DEFINES =-D_PC -#endif - -/* XXX keep this temporarily for reference */ -#if 0 -#if (XF86INT10_BUILD == X86EMU_GENERIC) - -SRCS = $(SRCS1) xf86x86emu.c generic.c -OBJS = $(OBJS1) xf86x86emu.o generic.o x86emu.o -SpecialObjectRule(pci.o, pci.c, -D_X86EMU) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(generic.o, generic.c, -D_X86EMU) -SpecialObjectRule(xf86x86emu.o, xf86x86emu.c, -D_X86EMU) -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -#endif -#endif - -#if defined(XF86INT10_BUILD) && (XF86INT10_BUILD == X86VM) -SRCS = $(SRCS1) linux.c -OBJS = $(OBJS1) linux.o -SpecialObjectRule(pci.o, pci.c, -D_VM86_LINUX) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_VM86_LINUX -DHAVE_SYSV_IPC) - -#elif (XF86INT10_BUILD == X86EMU_OS) - -SpecialObjectRule(pci.o, pci.c, -D_X86EMU) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC) - -X86TOPDIR = $(TOP)/extras/x86emu -X86SRCDIR = $(X86TOPDIR)/src/x86emu -X86EMUINCLUDES = -I$(X86TOPDIR)/include -I$(X86SRCDIR) - -# if !defined(X86EMU_LIBPATH) -X86EMUSRCS = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c -X86EMUOBJS = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o - -LinkSourceFile(debug.c,$(X86SRCDIR)) -LinkSourceFile(decode.c,$(X86SRCDIR)) -LinkSourceFile(fpu.c,$(X86SRCDIR)) -LinkSourceFile(ops.c,$(X86SRCDIR)) -LinkSourceFile(ops2.c,$(X86SRCDIR)) -LinkSourceFile(prim_ops.c,$(X86SRCDIR)) -LinkSourceFile(sys.c,$(X86SRCDIR)) -# else -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -X86EMUOBJS = x86emu.o -# endif +SpecialObjectRule(linux.o, linux.c, -DHAVE_SYSV_IPC $(LNXDEF)) -SRCS = $(SRCS1) xf86x86emu.c linux.c $(X86EMUSRCS) -OBJS = $(OBJS1) xf86x86emu.o linux.o $(X86EMUOBJS) -#endif - #if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC ModuleObjectRule() -LibraryModuleTarget(int10, $(OBJS)) + +#if HasParallelMake && defined (DoSingleLib) +MakeMutex($(SUBDIRS) $(EXPOBJS) $(DONES)) +#endif + +LibraryModuleTarget(int10, $(OBJS) $(EXPOBJS)) InstallLibraryModule(int10,$(MODULEDIR),linux) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c:1.24 xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c:1.29 --- xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c:1.24 Tue May 15 06:19:42 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c Wed Oct 16 17:13:47 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.24 2001/05/15 10:19:42 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.29 2002/10/16 21:13:47 dawes Exp $ */ /* * linux specific part of the int10 module * Copyright 1999 Egbert Eich @@ -10,7 +10,6 @@ #include "compiler.h" #define _INT10_PRIVATE #include "xf86int10.h" -#include "int10Defines.h" #ifdef __sparc__ #define DEV_MEM "/dev/fb" #else @@ -23,10 +22,10 @@ #endif #endif #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) -#define REG pInt #define SHMERRORPTR (pointer)(-1) static int counter = 0; +static unsigned long int10Generation = 0; static CARD8 read_b(xf86Int10InfoPtr pInt, int addr); static CARD16 read_w(xf86Int10InfoPtr pInt, int addr); @@ -53,31 +52,70 @@ char* alloc; } linuxInt10Priv; +#if defined DoSubModules + +typedef enum { + INT10_NOT_LOADED, + INT10_LOADED_VM86, + INT10_LOADED_X86EMU, + INT10_LOAD_FAILED +} Int10LinuxSubModuleState; + +static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED; + +static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn); + +#endif /* DoSubModules */ + xf86Int10InfoPtr xf86InitInt10(int entityIndex) { + return xf86ExtendedInitInt10(entityIndex, 0); +} + +xf86Int10InfoPtr +xf86ExtendedInitInt10(int entityIndex, int Flags) +{ xf86Int10InfoPtr pInt = NULL; CARD8 *bios_base; int screen; int fd; static void* vidMem = NULL; static void* sysMem = NULL; + void* vMem = NULL; void *options = NULL; int low_mem; - int high_mem; + int high_mem = -1; char *base = SHMERRORPTR; char *base_high = SHMERRORPTR; - int pagesize, cs; + int pagesize; + memType cs; legacyVGARec vga; xf86int10BiosLocation bios; + Bool videoBiosMapped = FALSE; + if (int10Generation != serverGeneration) { + counter = 0; + int10Generation = serverGeneration; + } + screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; options = xf86HandleInt10Options(xf86Screens[screen],entityIndex); - if (int10skip(options)) + if (int10skip(options)) { + xfree(options); return NULL; + } + +#if defined DoSubModules + if (loadedSubModule == INT10_NOT_LOADED) + loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]); + if (loadedSubModule == INT10_LOAD_FAILED) + return NULL; +#endif + if ((!vidMem) || (!sysMem)) { if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { if (!sysMem) { @@ -125,17 +163,37 @@ ((linuxInt10Priv*)pInt->private)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize)); + if (!xf86IsEntityPrimary(entityIndex)) { #ifdef DEBUG - ErrorF("Mapping high memory area\n"); + ErrorF("Mapping high memory area\n"); #endif - if ((high_mem = shmget(counter++, HIGH_MEM_SIZE, + if ((high_mem = shmget(counter++, HIGH_MEM_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { - if (errno == ENOSYS) - xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure" - " your kernel to include System V IPC support\n"); - goto error1; + if (errno == ENOSYS) + xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure" + " your kernel to include System V IPC support\n"); + goto error1; + } + } else { +#ifdef DEBUG + ErrorF("Mapping Video BIOS\n"); +#endif + videoBiosMapped = TRUE; + if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { + if ((vMem = mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_SHARED | MAP_FIXED, fd, V_BIOS)) + == MAP_FAILED) { + xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n"); + close(fd); + goto error1; + } + close (fd); + } else + goto error1; } ((linuxInt10Priv*)pInt->private)->highMem = high_mem; + #ifdef DEBUG ErrorF("Mapping 640kB area\n"); #endif @@ -147,9 +205,12 @@ base = shmat(low_mem, 0, 0); if (base == SHMERRORPTR) goto error4; ((linuxInt10Priv *)pInt->private)->base = base; - base_high = shmat(high_mem, 0, 0); - if (base_high == SHMERRORPTR) goto error4; - ((linuxInt10Priv*)pInt->private)->base_high = base_high; + if (high_mem > -1) { + base_high = shmat(high_mem, 0, 0); + if (base_high == SHMERRORPTR) goto error4; + ((linuxInt10Priv*)pInt->private)->base_high = base_high; + } else + ((linuxInt10Priv*)pInt->private)->base_high = NULL; MapCurrentInt10(pInt); Int10Current = pInt; @@ -161,18 +222,28 @@ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); goto error3; } - +#ifdef DEBUG + ErrorF("done\n"); +#endif /* * Read in everything between V_BIOS and SYS_BIOS as some system BIOSes * have executable code there. Note that xf86ReadBIOS() can only bring in * 64K bytes at a time. */ - (void)memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS); - for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) - if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE) - xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x%06X.\n", cs); - + if (!videoBiosMapped) { + (void)memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS); +#ifdef DEBUG + ErrorF("Reading BIOS\n"); +#endif + for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) + if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE) + xf86DrvMsg(screen, X_WARNING, + "Unable to retrieve all of segment 0x%06X.\n", cs); +#ifdef DEBUG + ErrorF("done\n"); +#endif + } + xf86int10ParseBiosLocation(options,&bios); if (xf86IsEntityPrimary(entityIndex) @@ -196,7 +267,7 @@ xf86DrvMsg(screen, X_WARNING, "You must set Option InitPrimary also\n"); } - + cs = ((CARD16*)0)[(0x10<<1) + 1]; bios_base = (unsigned char *)(cs << 4); @@ -214,11 +285,17 @@ } } } - + xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs); pInt->BIOSseg = cs; set_return_trap(pInt); +#ifdef _PC + pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); + if (! (pInt->Flags & SET_BIOS_SCRATCH)) + pInt->Flags &= ~RESTORE_BIOS_SCRATCH; + xf86Int10SaveRestoreBIOSVars(pInt, TRUE); +#endif } else { EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); BusType location_type; @@ -255,7 +332,6 @@ bios.location.pci.func); else pci_entity = pInt->entityIndex; - if (!mapPciRom(pci_entity, (unsigned char *)(V_BIOS))) { xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n"); goto error3; @@ -299,31 +375,38 @@ pInt->num = 0xe6; reset_int_vect(pInt); set_return_trap(pInt); - LockLegacyVGA(screen, &vga); + LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); + UnlockLegacyVGA(pInt, &vga); } #ifdef DEBUG dprint(0xc0000, 0x20); #endif + xfree(options); return pInt; error4: xf86DrvMsg(screen, X_ERROR, "shmat() call retruned errno %d\n", errno); error3: - shmdt(base_high); + if (base_high) + shmdt(base_high); shmdt(base); shmdt(0); - shmdt((char*)HIGH_MEM); + if (base_high) + shmdt((char*)HIGH_MEM); shmctl(low_mem, IPC_RMID, NULL); Int10Current = NULL; error2: - shmctl(high_mem, IPC_RMID,NULL); + if (high_mem > -1) + shmctl(high_mem, IPC_RMID,NULL); error1: + if (vMem) + munmap(vMem, SYS_BIOS - V_BIOS); xfree(((linuxInt10Priv*)pInt->private)->alloc); xfree(pInt->private); error0: + xfree(options); xfree(pInt); return NULL; } @@ -332,21 +415,46 @@ MapCurrentInt10(xf86Int10InfoPtr pInt) { pointer addr; - + int fd = -1; + if (Int10Current) { shmdt(0); - shmdt((char*)HIGH_MEM); + if (((linuxInt10Priv*)Int10Current->private)->highMem >= 0) + shmdt((char*)HIGH_MEM); + else + munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS)); } addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND); if (addr == SHMERRORPTR) { xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); return FALSE; } - addr = shmat(((linuxInt10Priv*)pInt->private)->highMem, (char*)HIGH_MEM, 0); - if (addr == SHMERRORPTR) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() high memory\n"); - return FALSE; + + if (((linuxInt10Priv*)pInt->private)->highMem >= 0) { + addr = shmat(((linuxInt10Priv*)pInt->private)->highMem, + (char*)HIGH_MEM, 0); + if (addr == SHMERRORPTR) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "Cannot shmat() high memory\n"); + return FALSE; + } + } else { + if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { + if (mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_SHARED | MAP_FIXED, fd, V_BIOS) + == MAP_FAILED) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n"); + close (fd); + return FALSE; + } + } else { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n",DEV_MEM); + return FALSE; + } + close (fd); } + return TRUE; } @@ -355,18 +463,27 @@ { if (!pInt) return; + +#ifdef _PC + xf86Int10SaveRestoreBIOSVars(pInt, FALSE); +#endif if (Int10Current == pInt) { shmdt(0); - shmdt((char*)HIGH_MEM); + if (((linuxInt10Priv*)pInt->private)->highMem >= 0) + shmdt((char*)HIGH_MEM); + else + munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS)); Int10Current = NULL; } - shmdt(((linuxInt10Priv*)pInt->private)->base_high); + + if (((linuxInt10Priv*)pInt->private)->base_high) + shmdt(((linuxInt10Priv*)pInt->private)->base_high); shmdt(((linuxInt10Priv*)pInt->private)->base); shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL); - shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL); + if (((linuxInt10Priv*)pInt->private)->highMem >= 0) + shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL); xfree(((linuxInt10Priv*)pInt->private)->alloc); xfree(pInt->private); - xfree(pInt->cpuRegs); xfree(pInt); } @@ -415,37 +532,37 @@ static CARD8 read_b(xf86Int10InfoPtr pInt, int addr) { - return *((CARD8 *)addr); + return *((CARD8 *)(memType)addr); } static CARD16 read_w(xf86Int10InfoPtr pInt, int addr) { - return *((CARD16 *)addr); + return *((CARD16 *)(memType)addr); } static CARD32 read_l(xf86Int10InfoPtr pInt, int addr) { - return *((CARD32 *)addr); + return *((CARD32 *)(memType)addr); } static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) { - *((CARD8 *)addr) = val; + *((CARD8 *)(memType)addr) = val; } static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) { - *((CARD16 *)addr) = val; + *((CARD16 *)(memType)addr) = val; } static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) { - *((CARD32 *)addr) = val; + *((CARD32 *)(memType) addr) = val; } pointer @@ -454,266 +571,21 @@ if (addr < V_RAM) return ((linuxInt10Priv*)pInt->private)->base + addr; else if (addr < V_BIOS) - return (pointer)addr; - else if (addr < SYS_BIOS) - return (pointer)(((linuxInt10Priv*)pInt->private)->base_high - - V_BIOS + addr); - else - return (pointer)addr; -} - -#ifdef _VM86_LINUX - -static int vm86_rep(struct vm86_struct *ptr); - -Bool -xf86Int10ExecSetup(xf86Int10InfoPtr pInt) -{ -#define VM86S ((struct vm86_struct *)pInt->cpuRegs) - - pInt->cpuRegs = (pointer)xnfcalloc(1, sizeof(struct vm86_struct)); - VM86S->flags = 0; - VM86S->screen_bitmap = 0; - VM86S->cpu_type = CPU_586; - memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored)); - memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored)); - return TRUE; + return (pointer)(memType)addr; + else if (addr < SYS_BIOS) { + if (((linuxInt10Priv*)pInt->private)->base_high) + return (pointer)(((linuxInt10Priv*)pInt->private)->base_high + - V_BIOS + addr); + else + return (pointer) (memType)addr; + } else + return (pointer) (memType)addr; } -/* get the linear address */ -#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) -#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX) -#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} -#define DF (1 << 10) +#if defined DoSubModules -/* vm86 fault handling */ static Bool -vm86_GP_fault(xf86Int10InfoPtr pInt) -{ - unsigned char *csp, *lina; - CARD32 org_eip; - int pref_seg; - int done, is_rep, prefix66, prefix67; - - csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); - - is_rep = 0; - prefix66 = prefix67 = 0; - pref_seg = -1; - - /* eat up prefixes */ - done = 0; - do { - switch (MEM_RB(pInt, (int)csp++)) { - case 0x66: /* operand prefix */ prefix66=1; break; - case 0x67: /* address prefix */ prefix67=1; break; - case 0x2e: /* CS */ pref_seg=X86_CS; break; - case 0x3e: /* DS */ pref_seg=X86_DS; break; - case 0x26: /* ES */ pref_seg=X86_ES; break; - case 0x36: /* SS */ pref_seg=X86_SS; break; - case 0x65: /* GS */ pref_seg=X86_GS; break; - case 0x64: /* FS */ pref_seg=X86_FS; break; - case 0xf0: /* lock */ break; - case 0xf2: /* repnz */ - case 0xf3: /* rep */ is_rep=1; break; - default: done=1; - } - } while (!done); - csp--; /* oops one too many */ - org_eip = X86_EIP; - X86_IP += (csp - lina); - - switch (MEM_RB(pInt, (int)csp)) { - case 0x6c: /* insb */ - /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx - * but is anyone using extended regs in real mode? */ - /* WARNING: no test for DI wrapping! */ - X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI), - X86_FLAGS & DF, is_rep ? LWECX : 1); - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0x6d: /* (rep) insw / insd */ - /* NOTE: ES can't be overwritten */ - /* WARNING: no test for _DI wrapping! */ - if (prefix66) { - X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), - X86_EFLAGS & DF, is_rep ? LWECX : 1); - } - else { - X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), - X86_FLAGS & DF, is_rep ? LWECX : 1); - } - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0x6e: /* (rep) outsb */ - if (pref_seg < 0) pref_seg = X86_DS; - /* WARNING: no test for _SI wrapping! */ - X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI, - X86_FLAGS & DF, is_rep ? LWECX : 1); - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0x6f: /* (rep) outsw / outsd */ - if (pref_seg < 0) pref_seg = X86_DS; - /* WARNING: no test for _SI wrapping! */ - if (prefix66) { - X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI, - X86_EFLAGS & DF, is_rep ? LWECX : 1); - } - else { - X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI, - X86_FLAGS & DF, is_rep ? LWECX : 1); - } - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0xe5: /* inw xx, inl xx */ - if (prefix66) X86_EAX = x_inl(csp[1]); - else X86_AX = x_inw(csp[1]); - X86_IP += 2; - break; - - case 0xe4: /* inb xx */ - X86_AL = x_inb(csp[1]); - X86_IP += 2; - break; - - case 0xed: /* inw dx, inl dx */ - if (prefix66) X86_EAX = x_inl(X86_DX); - else X86_AX = x_inw(X86_DX); - X86_IP += 1; - break; - - case 0xec: /* inb dx */ - X86_AL = x_inb(X86_DX); - X86_IP += 1; - break; - - case 0xe7: /* outw xx */ - if (prefix66) x_outl(csp[1], X86_EAX); - else x_outw(csp[1], X86_AX); - X86_IP += 2; - break; - - case 0xe6: /* outb xx */ - x_outb(csp[1], X86_AL); - X86_IP += 2; - break; - - case 0xef: /* outw dx */ - if (prefix66) x_outl(X86_DX, X86_EAX); - else x_outw(X86_DX, X86_AX); - X86_IP += 1; - break; - - case 0xee: /* outb dx */ - x_outb(X86_DX, X86_AL); - X86_IP += 1; - break; - - case 0xf4: -#ifdef DEBUG - ErrorF("hlt at %p\n", lina); -#endif - return FALSE; - - case 0x0f: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, - "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP); - goto op0ferr; - - default: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n"); - - op0ferr: - dump_registers(pInt); - stack_trace(pInt); - dump_code(pInt); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n"); - return FALSE; - } /* end of switch() */ - return TRUE; -} - -static int -do_vm86(xf86Int10InfoPtr pInt) -{ - int retval, signo; - - xf86InterceptSignals(&signo); - retval = vm86_rep(VM86S); - xf86InterceptSignals(NULL); - - if (signo >= 0) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, - "vm86() syscall generated signal %d.\n", signo); - dump_registers(pInt); - dump_code(pInt); - stack_trace(pInt); - return 0; - } - - switch (VM86_TYPE(retval)) { - case VM86_UNKNOWN: - if (!vm86_GP_fault(pInt)) return 0; - break; - case VM86_STI: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n"); - dump_registers(pInt); - dump_code(pInt); - stack_trace(pInt); - return 0; - case VM86_INTx: - pInt->num = VM86_ARG(retval); - if (!int_handler(pInt)) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, - "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); - dump_registers(pInt); - dump_code(pInt); - stack_trace(pInt); - return 0; - } - /* I'm not sure yet what to do if we can handle ints */ - break; - case VM86_SIGNAL: - return 1; - /* - * we used to warn here and bail out - but now the sigio stuff - * always fires signals at us. So we just ignore them for now. - */ - xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n"); - return 0; - default: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", - VM86_ARG(retval), VM86_TYPE(retval)); - dump_registers(pInt); - dump_code(pInt); - stack_trace(pInt); - return 0; - } - - return 1; -} - -void -xf86ExecX86int10(xf86Int10InfoPtr pInt) -{ - int sig = setup_int(pInt); - - if (int_handler(pInt)) - while(do_vm86(pInt)) {}; - - finish_int(pInt, sig); -} - -static int -vm86_rep(struct vm86_struct *ptr) +vm86_tst(void) { int __res; @@ -726,19 +598,30 @@ "int $0x80\n\t" "popl %%ebx" :"=a" (__res) - :"n" ((int)113), "r" ((struct vm86_struct *)ptr)); + :"n" ((int)113), "r" (NULL)); #else __asm__ __volatile__("int $0x80\n\t" :"=a" (__res):"a" ((int)113), - "b" ((struct vm86_struct *)ptr)); + "b" ((struct vm86_struct *)NULL)); #endif - if (__res < 0) { - errno = -__res; - __res = -1; - } - else errno = 0; - return __res; + if (__res < 0 && __res == -ENOSYS) + return FALSE; + + return TRUE; } -#endif +static Int10LinuxSubModuleState +int10LinuxLoadSubModule(ScrnInfoPtr pScrn) +{ + if (vm86_tst()) { + if (xf86LoadSubModule(pScrn,"vm86")) + return INT10_LOADED_VM86; + } + if (xf86LoadSubModule(pScrn,"x86emu")) + return INT10_LOADED_X86EMU; + + return INT10_LOAD_FAILED; +} + +#endif /* DoSubModules */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:40 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile Wed Sep 18 04:54:55 2002 @@ -0,0 +1,55 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile,v 1.1 2002/09/18 08:54:55 eich Exp $ + +#define IHaveModules + +#include <Server.tmpl> + +SRCS1 = linux_vm86.c helper_exec.c xf86int10.c +OBJS1 = linux_vm86.o helper_exec.o xf86int10.o + +#if defined(DoLoadableServer) && defined(Int10SubLibs) +SUBMODSRCS = xf86vm86module.c +SUBMODOBJS = xf86vm86module.o +#endif + +OBJS = $(SUBMODOBJS) $(OBJS1) +SRCS = $(SUBMODSRCS) $(SRCS1) + +LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) +LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) +LinkFile(xf86vm86module.c,$(XF86SRC)/int10/xf86int10module.c) + + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ + -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(X86EMUINCLUDES) + +DEFINES=-DHAVE_SYSV_IPC $(X86EMUDEFINES) $(EXTRADEFINES) + +#if defined(i386Architecture) || defined (x86_64Architecture) +EXTRADEFINES=-D_PC +#endif + +SpecialObjectRule(xf86vm86module.o, xf86vm86module.c, -DMOD_NAME=vm86) +SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX) +SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES) +SpecialObjectRule(linux_vm86.o, linux_vm86.c, -D_VM86_LINUX) + +ModuleObjectRule() + +#if defined(DoLoadableServer) && defined(Int10SubLibs) +LibraryModuleTarget(vm86, $(OBJS)) +InstallLibraryModule(vm86,$(MODULEDIR),linux) + +all:: + (set -x; cd ../..; \ + RemoveFile(LibraryTargetName(vm86)); \ + $(LN) linux/int10/vm86/LibraryTargetName(vm86) . ) + +InstallDriverSDKLibraryModule(vm86,$(DRIVERSDKMODULEDIR),.) +#else +SubdirLibraryRule($(OBJS)) +#endif + +DependTarget() + Index: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c:1.1 --- /dev/null Thu Feb 27 12:32:40 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c Wed Sep 18 04:54:56 2002 @@ -0,0 +1,292 @@ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "compiler.h" +#define _INT10_PRIVATE +#include "xf86int10.h" + +#define REG pInt + +#ifdef _VM86_LINUX +#include "int10Defines.h" + +static int vm86_rep(struct vm86_struct *ptr); +static struct vm86_struct vm86_s; + +Bool +xf86Int10ExecSetup(xf86Int10InfoPtr pInt) +{ +#define VM86S ((struct vm86_struct *)pInt->cpuRegs) + + pInt->cpuRegs = &vm86_s; + VM86S->flags = 0; + VM86S->screen_bitmap = 0; + VM86S->cpu_type = CPU_586; + memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored)); + memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored)); + return TRUE; +} + +/* get the linear address */ +#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) +#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX) +#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} +#define DF (1 << 10) + +/* vm86 fault handling */ +static Bool +vm86_GP_fault(xf86Int10InfoPtr pInt) +{ + unsigned char *csp, *lina; + CARD32 org_eip; + int pref_seg; + int done, is_rep, prefix66, prefix67; + + csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); + + is_rep = 0; + prefix66 = prefix67 = 0; + pref_seg = -1; + + /* eat up prefixes */ + done = 0; + do { + switch (MEM_RB(pInt, (int)csp++)) { + case 0x66: /* operand prefix */ prefix66=1; break; + case 0x67: /* address prefix */ prefix67=1; break; + case 0x2e: /* CS */ pref_seg=X86_CS; break; + case 0x3e: /* DS */ pref_seg=X86_DS; break; + case 0x26: /* ES */ pref_seg=X86_ES; break; + case 0x36: /* SS */ pref_seg=X86_SS; break; + case 0x65: /* GS */ pref_seg=X86_GS; break; + case 0x64: /* FS */ pref_seg=X86_FS; break; + case 0xf0: /* lock */ break; + case 0xf2: /* repnz */ + case 0xf3: /* rep */ is_rep=1; break; + default: done=1; + } + } while (!done); + csp--; /* oops one too many */ + org_eip = X86_EIP; + X86_IP += (csp - lina); + + switch (MEM_RB(pInt, (int)csp)) { + case 0x6c: /* insb */ + /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx + * but is anyone using extended regs in real mode? */ + /* WARNING: no test for DI wrapping! */ + X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI), + X86_FLAGS & DF, is_rep ? LWECX : 1); + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0x6d: /* (rep) insw / insd */ + /* NOTE: ES can't be overwritten */ + /* WARNING: no test for _DI wrapping! */ + if (prefix66) { + X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), + X86_EFLAGS & DF, is_rep ? LWECX : 1); + } + else { + X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), + X86_FLAGS & DF, is_rep ? LWECX : 1); + } + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0x6e: /* (rep) outsb */ + if (pref_seg < 0) pref_seg = X86_DS; + /* WARNING: no test for _SI wrapping! */ + X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI, + X86_FLAGS & DF, is_rep ? LWECX : 1); + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0x6f: /* (rep) outsw / outsd */ + if (pref_seg < 0) pref_seg = X86_DS; + /* WARNING: no test for _SI wrapping! */ + if (prefix66) { + X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI, + X86_EFLAGS & DF, is_rep ? LWECX : 1); + } + else { + X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI, + X86_FLAGS & DF, is_rep ? LWECX : 1); + } + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0xe5: /* inw xx, inl xx */ + if (prefix66) X86_EAX = x_inl(csp[1]); + else X86_AX = x_inw(csp[1]); + X86_IP += 2; + break; + + case 0xe4: /* inb xx */ + X86_AL = x_inb(csp[1]); + X86_IP += 2; + break; + + case 0xed: /* inw dx, inl dx */ + if (prefix66) X86_EAX = x_inl(X86_DX); + else X86_AX = x_inw(X86_DX); + X86_IP += 1; + break; + + case 0xec: /* inb dx */ + X86_AL = x_inb(X86_DX); + X86_IP += 1; + break; + + case 0xe7: /* outw xx */ + if (prefix66) x_outl(csp[1], X86_EAX); + else x_outw(csp[1], X86_AX); + X86_IP += 2; + break; + + case 0xe6: /* outb xx */ + x_outb(csp[1], X86_AL); + X86_IP += 2; + break; + + case 0xef: /* outw dx */ + if (prefix66) x_outl(X86_DX, X86_EAX); + else x_outw(X86_DX, X86_AX); + X86_IP += 1; + break; + + case 0xee: /* outb dx */ + x_outb(X86_DX, X86_AL); + X86_IP += 1; + break; + + case 0xf4: +#ifdef DEBUG + ErrorF("hlt at %p\n", lina); +#endif + return FALSE; + + case 0x0f: + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP); + goto op0ferr; + + default: + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n"); + + op0ferr: + dump_registers(pInt); + stack_trace(pInt); + dump_code(pInt); + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n"); + return FALSE; + } /* end of switch() */ + return TRUE; +} + +static int +do_vm86(xf86Int10InfoPtr pInt) +{ + int retval, signo; + + xf86InterceptSignals(&signo); + retval = vm86_rep(VM86S); + xf86InterceptSignals(NULL); + + if (signo >= 0) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "vm86() syscall generated signal %d.\n", signo); + dump_registers(pInt); + dump_code(pInt); + stack_trace(pInt); + return 0; + } + + switch (VM86_TYPE(retval)) { + case VM86_UNKNOWN: + if (!vm86_GP_fault(pInt)) return 0; + break; + case VM86_STI: + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n"); + dump_registers(pInt); + dump_code(pInt); + stack_trace(pInt); + return 0; + case VM86_INTx: + pInt->num = VM86_ARG(retval); + if (!int_handler(pInt)) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); + dump_registers(pInt); + dump_code(pInt); + stack_trace(pInt); + return 0; + } + /* I'm not sure yet what to do if we can handle ints */ + break; + case VM86_SIGNAL: + return 1; + /* + * we used to warn here and bail out - but now the sigio stuff + * always fires signals at us. So we just ignore them for now. + */ + xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n"); + return 0; + default: + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", + VM86_ARG(retval), VM86_TYPE(retval)); + dump_registers(pInt); + dump_code(pInt); + stack_trace(pInt); + return 0; + } + + return 1; +} + +void +xf86ExecX86int10(xf86Int10InfoPtr pInt) +{ + int sig = setup_int(pInt); + + if (int_handler(pInt)) + while(do_vm86(pInt)) {}; + + finish_int(pInt, sig); +} + +static int +vm86_rep(struct vm86_struct *ptr) +{ + int __res; + +#ifdef __PIC__ + /* When compiling with -fPIC, we can't use asm constraint "b" because + %ebx is already taken by gcc. */ + __asm__ __volatile__("pushl %%ebx\n\t" + "movl %2,%%ebx\n\t" + "movl %1,%%eax\n\t" + "int $0x80\n\t" + "popl %%ebx" + :"=a" (__res) + :"n" ((int)113), "r" ((struct vm86_struct *)ptr)); +#else + __asm__ __volatile__("int $0x80\n\t" + :"=a" (__res):"a" ((int)113), + "b" ((struct vm86_struct *)ptr)); +#endif + + if (__res < 0) { + errno = -__res; + __res = -1; + } + else errno = 0; + return __res; +} + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile:1.1 --- /dev/null Thu Feb 27 12:32:40 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile Wed Sep 18 04:54:56 2002 @@ -0,0 +1,81 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile,v 1.1 2002/09/18 08:54:56 eich Exp $ + +#define IHaveModules + +#include <Server.tmpl> + +SRCS1 = xf86x86emu.c helper_exec.c xf86int10.c +OBJS1 = xf86x86emu.o helper_exec.o xf86int10.o + +#if defined(DoLoadableServer) && defined(Int10SubLibs) +SUBMODSRCS = xf86x86emumodule.c +SUBMODOBJS = xf86x86emumodule.o +#endif + +SRCS2 = $(SUBMODSRCS) $(SRCS1) +OBJS2 = $(SUBMODOBJS) $(OBJS1) + +LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) +LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) +LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10) +LinkFile(xf86x86emumodule.c,$(XF86SRC)/int10/xf86int10module.c) + + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ + -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(X86EMUINCLUDES) + +DEFINES=-DHAVE_SYSV_IPC $(X86EMUDEFINES) $(EXTRADEFINES) + +#if defined(i386Architecture) || defined (x86_64Architecture) +EXTRADEFINES=-D_PC +#endif + +SpecialObjectRule(xf86x86emumodule.o, xf86x86emumodule.c, -DMOD_NAME=x86emu) +SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) +SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) +SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC) + +X86TOPDIR = $(TOP)/extras/x86emu +X86SRCDIR = $(X86TOPDIR)/src/x86emu +X86EMUINCLUDES = $(X86TOPDIR)/include -I$(X86SRCDIR) +X86EMUDEFINES = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG + +#if !defined(X86EMU_LIBPATH) +X86EMUSRCS = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c +X86EMUOBJS = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o + +LinkSourceFile(debug.c,$(X86SRCDIR)) +LinkSourceFile(decode.c,$(X86SRCDIR)) +LinkSourceFile(fpu.c,$(X86SRCDIR)) +LinkSourceFile(ops.c,$(X86SRCDIR)) +LinkSourceFile(ops2.c,$(X86SRCDIR)) +LinkSourceFile(prim_ops.c,$(X86SRCDIR)) +LinkSourceFile(sys.c,$(X86SRCDIR)) +#else +BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) +X86EMUOBJS = x86emu.o +#endif + +SRCS = $(SRCS2) $(X86EMUSRCS) +OBJS = $(OBJS2) $(X86EMUOBJS) + +ModuleObjectRule() + +#if defined(DoLoadableServer) && defined(Int10SubLibs) +LibraryModuleTarget(x86emu, $(OBJS)) + +InstallLibraryModule(x86emu,$(MODULEDIR),linux) + +all:: + (set -x; cd ../..; \ + RemoveFile(LibraryTargetName(x86emu)); \ + $(LN) linux/int10/x86emu/LibraryTargetName(x86emu) . ) + +InstallDriverSDKLibraryModule(x86emu,$(DRIVERSDKMODULEDIR),.) +#else +SubdirLibraryRule($(OBJS)) +#endif + +DependTarget() + Index: xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile:3.21 xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile:3.24 --- xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile:3.21 Tue Aug 15 12:05:38 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile Fri Dec 13 23:41:14 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile,v 3.21 2000/08/15 16:05:38 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile,v 3.24 2002/12/14 04:41:14 dawes Exp $ #include <Server.tmpl> #if !defined(PpcArchitecture) @@ -10,7 +10,7 @@ #endif #if defined(PpcArchitecture) -PPC_SRCS=lynx_noinline.c lynx_ppc.S +PPC_SRCS=lynx_noinline.c lynx_ppc.c PPC_OBJS=lynx_noinline.o lynx_ppc.o #endif @@ -28,7 +28,8 @@ vidmem.o sigio.o pm_noop.o kmod_noop.o agp_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) + -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + -I$(ENV_PREFIX)/sys/lynx.os RESDEFINES = -DUSESTDRES Index: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c:3.8 xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c:3.10 --- xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c:3.8 Sat Sep 4 09:04:45 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c Mon Feb 17 10:11:57 2003 @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c,v 3.8 1999/09/04 13:04:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c,v 3.10 2003/02/17 15:11:57 dawes Exp $ */ #include "X.h" @@ -153,3 +153,10 @@ return(xf86Info.consoleFd); } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c diff -u xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c:3.5 xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c:3.6 --- xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c:3.5 Mon Jul 31 19:25:18 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c Fri Jan 25 16:56:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.5 2000/07/31 23:25:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.6 2002/01/25 21:56:20 tsi Exp $ */ /* * Copyright 1998 by Metro Link Incorporated * @@ -25,6 +25,8 @@ #if /* NO_INLINE && */ defined(__powerpc__) +#include "xf86Pci.h" + extern volatile unsigned char *ioBase; void @@ -67,25 +69,25 @@ } void -outb(unsigned short port, unsigned char value) +outb(IOADDRESS port, unsigned char value) { *((volatile unsigned char *)(ioBase + port)) = value; eieio(); } void -outw(unsigned short port, unsigned short value) +outw(IOADDRESS port, unsigned short value) { stw_brx(value, ioBase, port); eieio(); } void -outl(unsigned short port, unsigned int value) +outl(IOADDRESS port, unsigned int value) { stl_brx(value, ioBase, port); eieio(); } unsigned char -inb(unsigned short port) +inb(IOADDRESS port) { unsigned char val; @@ -94,7 +96,7 @@ } unsigned short -inw(unsigned short port) +inw(IOADDRESS port) { unsigned short val; @@ -103,7 +105,7 @@ } unsigned int -inl(unsigned short port) +inl(IOADDRESS port) { unsigned int val; @@ -167,89 +169,6 @@ write_mem_barrier(void) { __asm__ __volatile__("eieio"); -} - - -/* - * rdinx - read the indexed byte port 'port', index 'ind', and return its value - */ -unsigned char -rdinx(unsigned short int port, unsigned char ind) -{ - if (port == 0x3C0) /* reset attribute flip-flop */ - (void) inb(0x3DA); - outb(port, ind); - return(inb(port+1)); -} - -/* - * wrinx - write 'val' to port 'port', index 'ind' - */ -void -wrinx(unsigned short int port, unsigned char ind, unsigned char val) -{ - outb(port, ind); - outb(port+1, val); -} - -/* - * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new'; - * the other bits are unchanged. - */ -void -modinx(unsigned short int port, unsigned char ind, - unsigned char mask, unsigned char new) -{ - unsigned char tmp; - - tmp = (rdinx(port, ind) & ~mask) | (new & mask); - wrinx(port, ind, tmp); -} - -/* - * tstrg - returns true iff the bits in 'mask' of register 'port' are - * readable & writable. - */ -int -testrg(unsigned short int port, unsigned char mask) -{ - unsigned char old, new1, new2; - - old = inb(port); - outb(port, old & ~mask); - new1 = inb(port) & mask; - outb(port, old | mask); - new2 = inb(port) & mask; - outb(port, old); - return((new1 == 0) && (new2 == mask)); -} - -/* - * testinx2 - returns true iff the bits in 'mask' of register 'port', index - * 'ind' are readable & writable. - */ -int -testinx2(unsigned short int port, unsigned char ind, unsigned char mask) -{ - unsigned char old, new1, new2; - - old = rdinx(port, ind); - wrinx(port, ind, old & ~mask); - new1 = rdinx(port, ind) & mask; - wrinx(port, ind, old | mask); - new2 = rdinx(port, ind) & mask; - wrinx(port, ind, old); - return((new1 == 0) && (new2 == mask)); -} - -/* - * testinx - returns true iff all bits of register 'port', index 'ind' are - * readable & writable. - */ -int -testinx(unsigned short int port, unsigned char ind) -{ - return(testinx2(port, ind, 0xFF)); } #endif /* NO_INLINE && __powerpc__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S diff -u xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S:1.1 xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S:removed --- xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S:1.1 Sat Jul 10 03:24:49 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S Thu Feb 27 12:32:41 2003 @@ -1,70 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S,v 1.1 1999/07/10 07:24:49 dawes Exp $ */ -/* - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - - .file "ppc.s" -.toc - .csect .text[PR] - .balign 4 - .globl ppc_flush_icache - .globl .ppc_flush_icache -.csect ppc_flush_icache[DS] -ppc_flush_icache: - .long .ppc_flush_icache, TOC[tc0], 0 -.csect .text[PR] -.ppc_flush_icache: - mflr 0 - stw 31,-4(1) - stw 0,8(1) - stwu 1,-64(1) - mr 31,1 - stw 3,88(31) - li 6, 0 /* __inst_dcbf (addr, 0); */ - dcbf 3, 6 - li 5, 32 /* __inst_dcbf (addr, LINESIZE); */ - dcbf 3, 5 - sync /* __inst_sync (); */ - li 4,0 /* __inst_icbi (addr, 0); */ - icbi 3,4 - li 7,32 /* __inst_icbi (addr, LINESIZE); */ - icbi 3,7 - sync /* __inst_sync (); */ - isync /* __inst_isync (); */ -L..1: - lwz 1,0(1) - lwz 0,8(1) - mtlr 0 - lwz 31,-4(1) - blr -LT..ppc_flush_icache: - .long 0 - .byte 0,0,32,97,128,1,1,1 - .long 0 - .long LT..ppc_flush_icache-.ppc_flush_icache - .short 16 - .byte "ppc_flush_icache" - .byte 31 -_section_.text: - .csect .data[RW] - .long _section_.text Index: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c:1.1 --- /dev/null Thu Feb 27 12:32:41 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c Fri Dec 13 23:41:14 2002 @@ -0,0 +1,52 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c,v 1.1 2002/12/14 04:41:14 dawes Exp $ */ +/* + * Copyright 1998 by Metro Link Incorporated + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Metro Link + * Incorporated not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Metro Link Incorporated makes no representations + * about the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty. + * + * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +void ppc_flush_icache() +{ +__asm__ __volatile__ (" \ + mflr 0 ;\ + stw 31,-4(1) ;\ + stw 0,8(1) ;\ + stwu 1,-64(1) ;\ + mr 31,1 ;\ + stw 3,88(31) ;\ + li 6, 0 ;\ + dcbf 3, 6 ;\ + li 5, 32 ;\ + dcbf 3, 5 ;\ + sync ;\ + li 4,0 ;\ + icbi 3,4 ;\ + li 7,32 ;\ + icbi 3,7 ;\ + sync ;\ + isync ;\ + lwz 1,0(1) ;\ + lwz 0,8(1) ;\ + mtlr 0 ;\ + lwz 31,-4(1) ;\ + blr ;\ +"); +} Index: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c:3.17 xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c:3.18 --- xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c:3.17 Fri Oct 27 21:42:27 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c Fri Dec 13 23:41:14 2002 @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.17 2000/10/28 01:42:27 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.18 2002/12/14 04:41:14 dawes Exp $ */ #include "X.h" #include "input.h" @@ -33,11 +33,21 @@ #include "xf86OSpriv.h" #if defined(__powerpc__) -#include <machine/absolute.h> +# if defined(USE_MACHINE_ABSOLUTE) +# include <machine/absolute.h> +# else +# define __USER_SPACE_INCLUDE +# include <hw_absolute.h> +# endif + void ppcPciIoMap(int bus); #endif +#if 0 +#define DEBUG +#endif + #ifdef HAS_MTRR_SUPPORT #include <sys/memrange.h> #define X_MTRR_ID "XFree86" @@ -49,6 +59,53 @@ #define MTRR_DEVICE "/dev/mtrr" #endif + +#if !defined(NO_MMAP) +#include <sys/mman.h> + +int smem_remove(char *name) +{ + return(0); +} + +char *smem_create(char *name, char *arg_addr, long size, int mode) +{ + int fd; + void *addr = 0; + char *retval; + size_t len = size; + int prot = PROT_READ|PROT_WRITE|PROT_UNCACHE; + int flags = MAP_SHARED; + off_t off = (off_t)arg_addr; + + if ((fd = open("/dev/mem" , O_RDWR)) < 0) + { + retval = (char *)-1; + } + else + { + if (mode == SM_DETACH) + { + munmap(arg_addr, len); + retval = 0; + } + else + { + if ((retval = mmap (addr, len, prot, flags, fd, off) ) == MAP_FAILED) + { + retval = (char *)-1; + } + } + + close(fd); + } + + return(retval); +} + +#endif + + /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ @@ -245,12 +302,17 @@ { if (IOEnabled++ == 0) { ioBase = (unsigned char *) smem_create("IOBASE", - (char *)0x80000000, 64*1024, SM_READ|SM_WRITE); + (char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE); if (ioBase == MAP_FAILED) { --IOEnabled; FatalError("xf86EnableIO: Failed to map I/O\n"); - } else + } else { +#ifdef DEBUG + ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n", + ioBase); +#endif atexit(removeIOSmem); + } } return; } @@ -284,10 +346,6 @@ #ifdef HAS_MTRR_SUPPORT /* memory range (MTRR) support for LynxOS (taken from BSD MTRR support) */ - -#if 0 -#define DEBUG -#endif /* * This code is experimental. Some parts may be overkill, and other parts Index: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile:1.6 xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile:1.6 Fri Nov 16 11:47:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile Wed Oct 16 22:22:47 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile,v 1.6 2001/11/16 16:47:56 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile,v 1.8 2002/10/17 02:22:47 dawes Exp $ XCOMM #include <Server.tmpl> Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c:1.3 Fri Nov 16 11:47:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c Mon Feb 17 10:11:58 2003 @@ -24,7 +24,7 @@ * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Sebastien Marineau. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c,v 1.3 2001/11/16 16:47:56 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c,v 1.5 2003/02/17 15:11:58 dawes Exp $ */ /* This module contains the NTO-specific functions to access the keyboard @@ -105,3 +105,10 @@ return (-1); } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile:3.17 xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile:3.20 --- xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile:3.17 Tue Aug 15 12:05:38 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile Wed Oct 16 22:22:48 2002 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile,v 3.17 2000/08/15 16:05:38 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile,v 3.20 2002/10/17 02:22:48 dawes Exp $ #include <Server.tmpl> BIOS_MOD = os2_bios @@ -12,15 +12,15 @@ SRCS = os2_init.c os2_video.c os2_io.c $(BIOS_MOD).c \ os2_ioperm.c os2_VTsw.c os2_mouse.c os2_KbdEv.c os2_stubs.c \ os2_select.c os2_diag.c libc_wrapper.c stdResource.c stdPci.c \ - vidmem.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c + vidmem.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c os2_serial.c OBJS = os2_init.o os2_video.o os2_io.o $(BIOS_MOD).o \ os2_ioperm.o os2_VTsw.o os2_mouse.o os2_kbdEv.o os2_stubs.o \ os2_select.o os2_diag.o libc_wrapper.o stdResource.o stdPci.o \ - vidmem.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o + vidmem.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o os2_serial.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) + -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) RESDEFINES = -DUSESTDRES Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c:3.10 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c:3.11 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c:3.10 Wed Apr 5 14:13:51 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c Fri May 31 14:46:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c,v 3.10 2000/04/05 18:13:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c,v 3.11 2002/05/31 18:46:01 dawes Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * Modified 1996 by Sebastien Marineau <marineau@genie.uottawa.ca> @@ -24,12 +24,12 @@ */ /* $XConsortium: os2_VTsw.c /main/7 1996/05/13 16:37:55 kaleb $ */ +#define I_NEED_OS2_H #define NEED_EVENTS #include "X.h" #include "input.h" #include "scrnintstr.h" -#define I_NEED_OS2_H #define INCL_WINSWITCHLIST #define INCL_VIO #define INCL_KBD Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c:3.10 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c:3.11 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c:3.10 Wed Apr 5 14:13:52 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c Fri May 31 14:46:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c,v 3.10 2000/04/05 18:13:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c,v 3.11 2002/05/31 18:46:01 dawes Exp $ */ /* * (c) Copyright 1994 by Holger Veit * <Holger.Veit@gmd.de> @@ -29,11 +29,11 @@ */ /* $XConsortium: os2_bios.c /main/5 1996/10/27 11:48:45 kaleb $ */ +#define I_NEED_OS2_H #include "X.h" #include "input.h" #include "scrnintstr.h" -#define I_NEED_OS2_H #define INCL_32 #define INCL_DOS #define INCL_DOSFILEMGR Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c:3.7 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c:3.8 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c:3.7 Wed Apr 5 14:13:52 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c Fri May 31 14:46:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c,v 3.7 2000/04/05 18:13:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c,v 3.8 2002/05/31 18:46:01 dawes Exp $ */ /* * (c) Copyright 1997 by Holger Veit * <Holger.Veit@gmd.de> @@ -32,6 +32,7 @@ * to avoid the numerous questions why this or that does not work */ +#define I_NEED_OS2_H #include "X.h" #include "Xmd.h" #include "input.h" @@ -39,7 +40,6 @@ #include "compiler.h" -#define I_NEED_OS2_H #define INCL_DOSFILEMGR #define INCL_KBD #define INCL_VIO Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c:3.15 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c:3.16 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c:3.15 Thu Apr 29 05:13:48 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c Fri May 31 14:46:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c,v 3.15 1999/04/29 09:13:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c,v 3.16 2002/05/31 18:46:01 dawes Exp $ */ /* * (c) Copyright 1994 by Holger Veit * <Holger.Veit@gmd.de> @@ -29,13 +29,6 @@ */ /* $XConsortium: os2_init.c /main/9 1996/10/19 18:07:13 kaleb $ */ -#include "X.h" -#include "Xmd.h" -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - #define I_NEED_OS2_H #define INCL_DOSFILEMGR #define INCL_KBD @@ -45,6 +38,13 @@ #define INCL_DOSSEMAPHORES #define INCL_DOSMODULEMGR #define INCL_DOSFILEMGR +#include "X.h" +#include "Xmd.h" +#include "input.h" +#include "scrnintstr.h" + +#include "compiler.h" + #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c:3.14 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c:3.17 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c:3.14 Wed Apr 5 14:13:52 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c Mon Feb 17 10:11:58 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c,v 3.14 2000/04/05 18:13:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c,v 3.17 2003/02/17 15:11:58 dawes Exp $ */ /* * (c) Copyright 1994,1999 by Holger Veit * <Holger.Veit@gmd.de> @@ -29,12 +29,12 @@ */ /* $XConsortium: os2_io.c /main/9 1996/05/13 16:38:07 kaleb $ */ +#define I_NEED_OS2_H #include "X.h" #include "Xpoll.h" #include "compiler.h" #include <time.h> -#define I_NEED_OS2_H #define INCL_DOSPROCESS #define INCL_KBD #define INCL_MOU @@ -220,3 +220,11 @@ int xf86NumMouseTypes = sizeof(xf86SupportedMouseTypes) / sizeof(xf86SupportedMouseTypes[0]); #endif + +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c:3.15 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c:3.16 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c:3.15 Thu Apr 29 05:30:27 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c Fri May 31 14:46:01 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c,v 3.15 1999/04/29 09:30:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c,v 3.16 2002/05/31 18:46:01 dawes Exp $ */ /* * (c) Copyright 1994,1996,1999 by Holger Veit * <Holger.Veit@gmd.de> @@ -29,6 +29,7 @@ */ /* $XConsortium: os2_kbdEv.c /main/10 1996/10/27 11:48:48 kaleb $ */ +#define I_NEED_OS2_H #define NEED_EVENTS #include "X.h" #include "Xproto.h" @@ -36,7 +37,6 @@ #include "inputstr.h" #include "scrnintstr.h" -#define I_NEED_OS2_H #define INCL_KBD #define INCL_DOSMONITORS #define INCL_WINSWITCHLIST Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c:3.16 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c:3.17 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c:3.16 Wed Apr 5 14:13:53 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c Fri May 31 14:46:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c,v 3.16 2000/04/05 18:13:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c,v 3.17 2002/05/31 18:46:02 dawes Exp $ */ /* * (c) Copyright 1994,1999,2000 by Holger Veit * <Holger.Veit@gmd.de> @@ -29,6 +29,7 @@ */ /* $XConsortium: os2_mouse.c /main/10 1996/10/27 11:48:51 kaleb $ */ +#define I_NEED_OS2_H #define NEED_EVENTS #include "X.h" #include "Xproto.h" @@ -38,7 +39,6 @@ #include "compiler.h" -#define I_NEED_OS2_H #define INCL_DOSFILEMGR #define INCL_DOSQUEUES #define INCL_MOU Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c:1.3 Wed Apr 5 14:13:53 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c Fri May 31 14:46:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c,v 1.3 2000/04/05 18:13:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c,v 1.4 2002/05/31 18:46:02 dawes Exp $ */ /* * (c) Copyright 1999 by Holger Veit * <Holger.Veit@gmd.de> @@ -28,6 +28,7 @@ */ /* $XConsortium$ */ +#define I_NEED_OS2_H #include "X.h" #include "Xmd.h" #include "input.h" @@ -35,7 +36,6 @@ #include "compiler.h" -#define I_NEED_OS2_H #define INCL_DOSDEVIOCTL #include "xf86.h" #include "xf86Priv.h" Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c:3.3 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c:3.4 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c:3.3 Fri Dec 27 02:04:32 1996 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c Fri May 31 14:46:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c,v 3.3 1996/12/27 07:04:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c,v 3.4 2002/05/31 18:46:02 dawes Exp $ */ /* * (c) Copyright 1996 by Holger Veit * <Holger.Veit@gmd.de> @@ -28,6 +28,7 @@ */ /* $XConsortium: os2_stubs.c /main/3 1996/10/27 11:48:58 kaleb $ */ +#define I_NEED_OS2_H #include "X11/X.h" #include "X11/Xpoll.h" #include <stdio.h> @@ -35,56 +36,6 @@ #include <string.h> #include <sys/types.h> #include <sys/time.h> - -/* This code is duplicated from XLibInt.c, because the same problems with - * the drive letter as in clients also exist in the server - * Unfortunately the standalone servers don't link against libX11 - */ - -char *__XOS2RedirRoot(char *fname) -{ - /* This adds a further redirection by allowing the ProjectRoot - * to be prepended by the content of the envvar X11ROOT. - * This is for the purpose to move the whole X11 stuff to a different - * disk drive. - * The feature was added despite various environment variables - * because not all file opens respect them. - */ - static char redirname[300]; /* enough for long filenames */ - char *root; - - /* if name does not start with /, assume it is not root-based */ - if (fname==0 || !(fname[0]=='/' || fname[0]=='\\')) - return fname; - - root = (char*)getenv("X11ROOT"); - if (root==0 || - (fname[1]==':' && isalpha(fname[0]) || - (strlen(fname)+strlen(root)+2) > 300)) - return fname; - sprintf(redirname,"%s%s",root,fname); - return redirname; -} - -char *__XOS2RedirRoot1(char *format, char *arg1, char *arg2, char *arg3) -{ - /* this first constructs a name from a format and up to three - * components, then adds a path - */ - char buf[300]; - sprintf(buf,format,arg1,arg2,arg3); - return __XOS2RedirRoot(buf); -} - -/* - * This declares a missing function in the __EMX__ library, used in - * various places - */ -void usleep(delay) - unsigned long delay; -{ - DosSleep(delay ? (delay/1000) : 1l); -} /* This is there to resolve a symbol in Xvfb * this version is somewhat crippled compared to the one in os2_io.c Index: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c:3.14 xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c:3.15 --- xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c:3.14 Fri Oct 27 21:42:28 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c Fri May 31 14:46:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c,v 3.14 2000/10/28 01:42:28 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c,v 3.15 2002/05/31 18:46:02 dawes Exp $ */ /* * (c) Copyright 1994,1999 by Holger Veit * <Holger.Veit@gmd.de> @@ -29,11 +29,11 @@ */ /* $XConsortium: os2_video.c /main/8 1996/10/27 11:49:02 kaleb $ */ +#define I_NEED_OS2_H #include "X.h" #include "input.h" #include "scrnintstr.h" -#define I_NEED_OS2_H #define INCL_DOSFILEMGR #include "xf86.h" #include "xf86Priv.h" Index: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c:1.3 Mon Apr 30 10:34:58 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c Fri Jan 25 16:56:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.3 2001/04/30 14:34:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.4 2002/01/25 21:56:20 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -154,9 +154,9 @@ setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); + LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); + UnlockLegacyVGA(pInt, &vga); } #else if (!sysMem) { @@ -173,9 +173,9 @@ setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); + LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); + UnlockLegacyVGA(pInt, &vga); #endif return pInt; Index: xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile:1.10 Tue Aug 15 12:05:39 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile Wed Oct 16 22:22:48 2002 @@ -1,5 +1,5 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile,v 1.10 2000/08/15 16:05:39 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile,v 1.12 2002/10/17 02:22:48 dawes Exp $ #include <Server.tmpl> Index: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c:1.6 Sat Sep 4 09:04:46 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c Mon Feb 17 10:11:59 2003 @@ -69,7 +69,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c,v 1.6 1999/09/04 13:04:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c,v 1.8 2003/02/17 15:11:59 dawes Exp $ */ #include "X.h" @@ -113,3 +113,10 @@ ioctl(xf86Info.consoleFd, KDSETLED, leds); } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c:1.5 Mon Jul 31 19:24:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c Tue Aug 27 18:07:08 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c,v 1.5 2000/07/31 23:24:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c,v 1.7 2002/08/27 22:07:08 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -62,26 +62,26 @@ #undef NH640X_PCI_MFDEV_SUPPORT #undef NH640X_PCI_BRIDGE_SUPPORT -void nh640xPciInit(void); -PCITAG nh640xPciFindNext(void); -PCITAG nh640xPciFindFirst(void); -CARD32 nh6400PciReadLong(PCITAG tag, int offset); -void nh6400PciWriteLong(PCITAG tag, int offset, CARD32 val); -ADDRESS nh6400BusToHostAddr(PCITAG tag, ADDRESS addr); -ADDRESS nh6400HostToBusAddr(PCITAG tag, ADDRESS addr); -CARD32 nh6408PciReadLong(PCITAG tag, int offset); -void nh6408PciWriteLong(PCITAG tag, int offset, CARD32 val); -ADDRESS nh6408BusToHostAddr(PCITAG tag, ADDRESS addr); -ADDRESS nh6408HostToBusAddr(PCITAG tag, ADDRESS addr); +static void nh640xPciInit(void); +static PCITAG nh640xPciFindNext(void); +static PCITAG nh640xPciFindFirst(void); +static CARD32 nh6400PciReadLong(PCITAG tag, int offset); +static void nh6400PciWriteLong(PCITAG tag, int offset, CARD32 val); +static ADDRESS nh6400BusToHostAddr(PCITAG tag, ADDRESS addr); +static ADDRESS nh6400HostToBusAddr(PCITAG tag, ADDRESS addr); +static CARD32 nh6408PciReadLong(PCITAG tag, int offset); +static void nh6408PciWriteLong(PCITAG tag, int offset, CARD32 val); +static ADDRESS nh6408BusToHostAddr(PCITAG tag, ADDRESS addr); +static ADDRESS nh6408HostToBusAddr(PCITAG tag, ADDRESS addr); -pciBusFuncs_t nh6400_pci_funcs = { +static pciBusFuncs_t nh6400_pci_funcs = { nh6400PciReadLong, nh6400PciWriteLong, nh6400HostToBusAddr, nh6400BusToHostAddr }; -pciBusFuncs_t nh6408_pci_funcs = { +static pciBusFuncs_t nh6408_pci_funcs = { nh6408PciReadLong, nh6408PciWriteLong, nh6408HostToBusAddr, @@ -101,7 +101,7 @@ /* * Possible cfg addr values for NH640x GMEM PMC ports */ -unsigned long nh6400_pmc_cfgaddrs[] = { +static unsigned long nh6400_pmc_cfgaddrs[] = { PCI_CFGMECH1_TYPE0_CFGADDR(0,0,0) }; @@ -109,7 +109,7 @@ * Possible cfg addr values for devices on a secondary bus * (e.g. behind DEC 21152 PCI-to-PCI bridge) */ -unsigned long dec_cfgaddrs[] = { +static unsigned long dec_cfgaddrs[] = { PCI_CFGMECH1_TYPE1_CFGADDR(1,0,0,0), PCI_CFGMECH1_TYPE1_CFGADDR(1,1,0,0), PCI_CFGMECH1_TYPE1_CFGADDR(1,2,0,0), @@ -143,11 +143,12 @@ unsigned long ioSize; unsigned char *cfgAddrReg; /* After mapping */ }; -/*type*/ + +/* Type */ #define PRIMARY_PCI 0 #define SECONDARY_PCI 1 -struct nh640x_pci_info nh6400_pci_info[] = { +static struct nh640x_pci_info nh6400_pci_info[] = { /* pci4 */ { 4, PRIMARY_PCI, 1, nh6400_pmc_cfgaddrs, 0, 0xa0000000, 0xa1000000, 0, 0xa2000000 }, /* pci12 */ { 12, SECONDARY_PCI, 16, dec_cfgaddrs, 4 }, #if 0 @@ -158,7 +159,7 @@ #define NH6400_NUM_PCI_EXPANSION_BUSES (sizeof(nh6400_pci_info)/sizeof(struct nh640x_pci_info)) -struct nh640x_pci_info nh6408_pci_info[] = { +static struct nh640x_pci_info nh6408_pci_info[] = { /* pci8 */ { 8, PRIMARY_PCI, 1, nh6400_pmc_cfgaddrs, 0, 0x98040000, 0x9a800000, 65536, 0xa0000000 }, /* pci12 */ { 12, SECONDARY_PCI, 16, dec_cfgaddrs, 8, }, #if 0 @@ -245,12 +246,12 @@ } } -void +static void nh640xPciInit(void) { int i,n; struct nh640x_pci_info *infop; - pciBusFuncs_t *functions; + pciBusFuncs_p functions; switch (pmax_sys_type) { case MODEL_NH6400: @@ -291,7 +292,7 @@ busp->numDevices = infop->num_cfg_addrs; busp->secondary = (infop->type == SECONDARY_PCI ? TRUE : FALSE); busp->primary_bus = infop->primary_bus; - busp->funcs = *functions; /* Structure assignment */ + busp->funcs = functions; busp->pciBusPriv = infop; /* Initialize I/O base/size info */ @@ -320,7 +321,7 @@ pciFindNextFP = nh640xPciFindNext; } -PCITAG +static PCITAG nh640xPciFindNext(void) { unsigned long devid, tmp; @@ -444,14 +445,14 @@ /*NOTREACHED*/ } -PCITAG +static PCITAG nh640xPciFindFirst(void) { pciBusNum = -1; return(nh640xPciFindNext()); } -unsigned long +static unsigned long nh6400PciReadLong(PCITAG tag, int offset) { unsigned long tmp; @@ -557,7 +558,7 @@ return(pciByteSwap(tmp)); } -void +static void nh6400PciWriteLong(PCITAG tag, int offset, unsigned long val) { char *base; @@ -665,7 +666,7 @@ * we do do some bounds checking to make sure things are where they * should be. */ -ADDRESS +static ADDRESS nh6400BusToHostAddr(PCITAG tag, ADDRESS addr) { unsigned long addr_l = (unsigned long)addr; @@ -709,7 +710,7 @@ /*NOTREACHED*/ } -ADDRESS +static ADDRESS nh6400HostToBusAddr(PCITAG tag, ADDRESS addr) { unsigned long addr_l = (unsigned long) addr; @@ -757,7 +758,7 @@ /* * NH6408 platform support */ -unsigned long +static unsigned long nh6408PciReadLong(PCITAG tag, int offset) { unsigned long tmp; @@ -863,7 +864,7 @@ return(pciByteSwap(tmp)); } -void +static void nh6408PciWriteLong(PCITAG tag, int offset, unsigned long val) { char *base; @@ -965,7 +966,7 @@ } -ADDRESS +static ADDRESS nh6408BusToHostAddr(PCITAG tag, ADDRESS addr) { unsigned long addr_l = (unsigned long)addr; @@ -1011,7 +1012,7 @@ /*NOTREACHED*/ } -ADDRESS +static ADDRESS nh6408HostToBusAddr(PCITAG tag, ADDRESS addr) { unsigned long addr_l = (unsigned long)addr; @@ -1060,7 +1061,7 @@ /* * NH6800 (Turbo) support */ -void +static void nh6800tPciInit(void) { FatalError("nh6800tPciInit: NH6800TURBO not supported (yet)!!!\n"); Index: xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile:1.6 xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile:1.6 Tue Aug 15 12:05:39 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile Wed Oct 16 22:22:48 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile,v 1.6 2000/08/15 16:05:39 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile,v 1.8 2002/10/17 02:22:48 dawes Exp $ #include <Server.tmpl> Index: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c:1.1 Sun Dec 26 19:45:47 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c Mon Feb 17 10:11:59 2003 @@ -24,7 +24,7 @@ * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Sebastien Marineau. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c,v 1.1 1999/12/27 00:45:47 robin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c,v 1.3 2003/02/17 15:11:59 dawes Exp $ */ /* This module contains the qnx-specific functions to access the keyboard @@ -97,3 +97,10 @@ return; } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile:3.12 xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile:3.16 --- xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile:3.12 Sat Jun 30 18:41:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile Wed Nov 20 18:00:44 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.12 2001/06/30 22:41:49 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.16 2002/11/20 23:00:44 dawes Exp $ @@ -7,13 +7,13 @@ #include <Server.tmpl> -SRCS = sco_init.c sco_video.c sco_io.c sco_mouse.c VTsw_sco.c \ - std_kbdEv.c posix_tty.c bios_devmem.c vidmem.c \ - libc_wrapper.c stdResource.c stdPci.o sigiostubs.c pm_noop.c \ +SRCS = sco_init.c sco_video.c sco_io.c sco_iop.c sco_mouse.c VTsw_sco.c \ + std_kbdEv.c posix_tty.c bios_mmap.c vidmem.c \ + libc_wrapper.c stdResource.c stdPci.c sigiostubs.c pm_noop.c \ kmod_noop.c agp_noop.c -OBJS = sco_init.o sco_video.o sco_io.o sco_mouse.o VTsw_sco.o \ - std_kbdEv.o posix_tty.o bios_devmem.o vidmem.o \ +OBJS = sco_init.o sco_video.o sco_io.o sco_iop.o sco_mouse.o VTsw_sco.o \ + std_kbdEv.o posix_tty.o bios_mmap.o vidmem.o \ libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ kmod_noop.o agp_noop.o @@ -27,7 +27,7 @@ SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() -LinkSourceFile(bios_devmem.c,../shared) +LinkSourceFile(bios_mmap.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c:3.12 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c:3.14 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c:3.12 Sat Jun 30 18:41:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c Wed Nov 20 18:00:44 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.12 2001/06/30 22:41:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.14 2002/11/20 23:00:44 dawes Exp $ */ /* * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * @@ -38,7 +38,7 @@ static char *vtdevice = NULL; static int sco_console_mode = -1; -Bool mpxLock = TRUE; +extern Bool mpxLock; void xf86OpenConsole() @@ -228,6 +228,14 @@ struct vt_mode VT; struct sigaction sigvtsw; + /* Set text mode (possibly briefly) */ + ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0); + + /* Restore the original mode */ + if (sco_console_mode != -1) { + ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L); + } + ioctl(xf86Info.consoleFd, VT_RELDISP, 1); /* Release the display */ sigvtsw.sa_handler = SIG_DFL; @@ -242,14 +250,6 @@ VT.acqsig = SIGUSR1; VT.frsig = SIGINT; ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* Revert to auto handling */ - - /* Set text mode (possibly briefly) */ - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0); - - /* Restore the original mode */ - if (sco_console_mode != -1) { - ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L); - } close(xf86Info.consoleFd); /* We're done with the device */ } Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c:3.7 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c:3.10 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c:3.7 Sat Jun 30 18:41:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c Mon Feb 17 10:11:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.7 2001/06/30 22:41:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.10 2003/02/17 15:11:59 dawes Exp $ */ /* * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * @@ -28,8 +28,10 @@ #include "compiler.h" +#define _NEED_SYSI86 #include "xf86.h" #include "xf86Priv.h" +#include "xf86OSpriv.h" #include "xf86_OSlib.h" #include <sys/param.h> @@ -262,3 +264,10 @@ return(xf86Info.consoleFd); } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_iop.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sco/sco_iop.c:1.1 --- /dev/null Thu Feb 27 12:32:43 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_iop.c Mon Jun 3 17:22:10 2002 @@ -0,0 +1,124 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_iop.c,v 1.1 2002/06/03 21:22:10 dawes Exp $ */ +/* + * Copyright 2001 by J. Kean Johnston <jkj@caldera.com> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name J. Kean Johnston not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. J. Kean Johnston makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XConsortium$ */ + + +#include "X.h" + +#include "compiler.h" + +#define _NEED_SYSI86 +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86OSpriv.h" +#include "xf86_OSlib.h" + + +/***************************************************************************/ +/* I/O Permissions section */ +/***************************************************************************/ + +/* + * There is a right way and a wrong way of doing this. Unfortunately, we + * are forced to do it the wrong way. The right way is to be told the range + * or ranges of I/O ports the driver(s) need access to, in order to use the + * CONS_IOPERM ioctl() to grant access only to those ports we care about. + * This way we can guarantee some small level of stability because a driver + * does not have access to all ports (which would mean it could play with + * the PIT and thus affect scheduling times, or a whole slew of other + * nasty things). However, because XFree86 currently only enables or disables + * ALL port access, we need to run at IOPL 3, which basically means the + * X Server runs at the same level as the kernel. You can image why this is + * unsafe. Oh, and this is not a problem unique to OSR5, other OSes are + * affected by this as well. + * + * So, for the time being, we change our IOPL until such time as the XFree86 + * architecture is changed to allow for tighter control of I/O ports. If and + * when it is, then the CONS_ADDIOP/DELIOP ioctl() should be used to enable + * or disable access to the desired ports. + */ + +extern long sysi86 (int cmd, ...); + +static Bool IOEnabled = FALSE; + +void xf86EnableIO(void) +{ + if (IOEnabled) + return; + + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) + FatalError("Failed to set IOPL for extended I/O\n"); + IOEnabled = TRUE; +} + +void xf86DisableIO(void) +{ + if (!IOEnabled) + return; + + sysi86(SI86V86, V86SC_IOPL, 0); + IOEnabled = FALSE; +} + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool xf86DisableInterrupts() +{ + if (!IOEnabled) { + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) + return FALSE; + } + +#ifdef __GNUC__ + __asm__ __volatile__("cli"); +#else + asm("cli"); +#endif /* __GNUC__ */ + + if (!IOEnabled) { + sysi86(SI86V86, V86SC_IOPL, PS_IOPL); + } + + return(TRUE); +} + +void xf86EnableInterrupts() +{ + if (!IOEnabled) { + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) + return; + } + +#ifdef __GNUC__ + __asm__ __volatile__("sti"); +#else + asm("sti"); +#endif /* __GNUC__ */ + + if (!IOEnabled) { + sysi86(SI86V86, V86SC_IOPL, PS_IOPL); + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c:3.12 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c:3.13 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c:3.12 Sat Jun 30 18:41:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c Wed Nov 20 18:07:50 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.12 2001/06/30 22:41:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.13 2002/11/20 23:07:50 dawes Exp $ */ /* * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * @@ -92,7 +92,6 @@ MouseDevPtr pMse; unsigned char map[9]; dmask_t dmask; - struct devinfo *di; MessageType from = X_CONFIG; int evi; @@ -114,23 +113,10 @@ FatalError ("OsMouseProc: DEVICE_INIT failed (%s)\n", evtErrStr(pInfo->fd)); } - /* - * We need to loop here since we will accept either relative device - * types (mice) or absolute ones (bitpads / lightpens). - */ - di = (struct devinfo *)0; - di = ev_getdev(D_REL|D_BUTTON, di); - if (di == (struct devinfo *)0) { - FatalError ("OsMouseProc: Could not extract mouse device info\n"); - } pMse->buttons = xf86SetIntOption (pInfo->options, "Buttons", 0); if (pMse->buttons == 0) { - pMse->buttons = (int)di->buttons; - from = X_PROBED; - if (pMse->buttons <= 0) { - pMse->buttons = MSE_DFLTBUTTONS; - from = X_DEFAULT; - } + pMse->buttons = 8; + from = X_DEFAULT; } xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); @@ -194,7 +180,19 @@ pMse = pInfo->private; while ((evp = ev_read()) != (EVENT *)0) { - pMse->PostEvent (pInfo, EV_BUTTONS(*evp), EV_DX(*evp), -(EV_DY(*evp)),0,0); + int buttons = EV_BUTTONS(*evp); + int dx = EV_DX(*evp), dy = -(EV_DY(*evp)), dz = 0, dw = 0; + + if (EV_TAG(*evp) & T_WHEEL) { + dz = (dy & 0x08) ? (dy & 0x0f) - 16 : (dy & 0x0f); + dx = dy = 0; + pMse->PostEvent (pInfo, buttons, dx, dy, dz, dw); + /* Simulate button release */ + dz = 0; + buttons &= ~(WHEEL_FWD | WHEEL_BACK); + } + + pMse->PostEvent (pInfo, buttons, dx, dy, dz, dw); ev_pop(); } } Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c:3.7 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c:3.8 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c:3.7 Sat Jun 30 18:41:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c Mon Jun 3 17:22:10 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.7 2001/06/30 22:41:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.8 2002/06/03 21:22:10 dawes Exp $ */ /* * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * @@ -51,7 +51,7 @@ #define MPXNAME "/dev/atp1" #define BASECPU 1 -extern Bool mpxLock; +Bool mpxLock = TRUE; #define USE_VASMETHOD 1 @@ -289,91 +289,3 @@ } } -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -/* - * There is a right way and a wrong way of doing this. Unfortunately, we - * are forced to do it the wrong way. The right way is to be told the range - * or ranges of I/O ports the driver(s) need access to, in order to use the - * CONS_IOPERM ioctl() to grant access only to those ports we care about. - * This way we can guarantee some small level of stability because a driver - * does not have access to all ports (which would mean it could play with - * the PIT and thus affect scheduling times, or a whole slew of other - * nasty things). However, because XFree86 currently only enables or disables - * ALL port access, we need to run at IOPL 3, which basically means the - * X Server runs at the same level as the kernel. You can image why this is - * unsafe. Oh, and this is not a problem unique to OSR5, other OSes are - * affected by this as well. - * - * So, for the time being, we change our IOPL until such time as the XFree86 - * architecture is changed to allow for tighter control of I/O ports. If and - * when it is, then the CONS_ADDIOP/DELIOP ioctl() should be used to enable - * or disable access to the desired ports. - */ - -extern long sysi86 (int cmd, ...); - -static Bool IOEnabled = FALSE; - -void xf86EnableIO(void) -{ - if (IOEnabled) - return; - - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - FatalError("Failed to set IOPL for extended I/O\n"); - IOEnabled = TRUE; -} - -void xf86DisableIO(void) -{ - if (!IOEnabled) - return; - - sysi86(SI86V86, V86SC_IOPL, 0); - IOEnabled = FALSE; -} - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool xf86DisableInterrupts() -{ - if (!IOEnabled) { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - return FALSE; - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86V86, V86SC_IOPL, PS_IOPL); - } - - return(TRUE); -} - -void xf86EnableInterrupts() -{ - if (!IOEnabled) { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - return; - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86V86, V86SC_IOPL, PS_IOPL); - } -} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c:3.3 xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c:3.4 --- xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c:3.3 Fri Dec 3 14:17:45 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c Mon Sep 16 14:06:14 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c,v 3.3 1999/12/03 19:17:45 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c,v 3.4 2002/09/16 18:06:14 eich Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@XFree86.org> * @@ -49,7 +49,7 @@ Bool xf86VTSwitchPending() { - return(xf86Info.vtRequestsPending ? TRUE : FALSE); + return(xf86Info.vtRequestsPending ? TRUE : FALSE); } Bool Index: xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c:1.1 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c Thu Oct 10 21:40:37 2002 @@ -0,0 +1,74 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c,v 1.1 2002/10/11 01:40:37 dawes Exp $ */ + +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + */ + +#include "xf86.h" +#include "xf86Xinput.h" +#include "xf86OSKbd.h" +#include "atKeynames.h" + +Bool +ATScancode(InputInfoPtr pInfo, int *scanCode) +{ + KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; + + switch (pKbd->scanPrefix) { + case 0: + switch (*scanCode) { + case KEY_Prefix0: + case KEY_Prefix1: + pKbd->scanPrefix = *scanCode; /* special prefixes */ + return TRUE; + } + break; + case KEY_Prefix0: + pKbd->scanPrefix = 0; + switch (*scanCode) { + case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */ + case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */ + case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */ + case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */ + case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */ + case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */ + case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */ + case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */ + case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */ + case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */ + case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */ + case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */ + case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */ + case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */ + case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */ + case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */ + case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */ + case 0x5b: *scanCode = KEY_LMeta; break; + case 0x5c: *scanCode = KEY_RMeta; break; + case 0x5d: *scanCode = KEY_Menu; break; + case KEY_F3: *scanCode = KEY_F13; break; + case KEY_F4: *scanCode = KEY_F14; break; + case KEY_F5: *scanCode = KEY_F15; break; + case KEY_F6: *scanCode = KEY_F16; break; + case KEY_F7: *scanCode = KEY_F17; break; + case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break; + case 0x2A: + case 0x36: + return TRUE; + default: + xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n", + *scanCode); + *scanCode += 0x78; + } + break; + case KEY_Prefix1: + pKbd->scanPrefix = (*scanCode == KEY_LCtrl) ? KEY_LCtrl : 0; + return TRUE; + case KEY_LCtrl: + pKbd->scanPrefix = 0; + if (*scanCode != KEY_NumLock) + return TRUE; + *scanCode = KEY_Pause; /* pause */ + } + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c:1.2 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c Mon Feb 17 10:11:59 2003 @@ -0,0 +1,13 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c,v 1.2 2003/02/17 15:11:59 dawes Exp $ */ + +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + */ + +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.83 xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.88 --- xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.83 Mon Jan 14 13:34:34 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c Sat Feb 22 01:00:39 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.83 2002/01/14 18:34:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.88 2003/02/22 06:00:39 dawes Exp $ */ /* * Copyright 1997 by The XFree86 Project, Inc. * @@ -50,7 +50,7 @@ #include <errno.h> #include <stdio.h> #include <sys/ioctl.h> -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define NO_MMAP #include <sys/param.h> #endif @@ -117,7 +117,7 @@ #endif typedef struct dirent DIRENTRY; -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define _POSIX_SOURCE #endif #ifdef ISC202 @@ -165,6 +165,11 @@ #endif #include <setjmp.h> +#if defined(setjmp) && \ + defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 +#define HAS_GLIBC_SIGSETJMP 1 +#endif + #if 0 #define SETBUF_RETURNS_INT #endif @@ -475,6 +480,9 @@ if (flags & XF86_MAP_FIXED) f |= MAP_FIXED; if (flags & XF86_MAP_SHARED) f |= MAP_SHARED; if (flags & XF86_MAP_PRIVATE) f |= MAP_PRIVATE; +#ifdef __x86_64__ + if (flags & XF86_MAP_32BIT) f |= MAP_32BIT; +#endif if (prot & XF86_PROT_EXEC) p |= PROT_EXEC; if (prot & XF86_PROT_READ) p |= PROT_READ; if (prot & XF86_PROT_WRITE) p |= PROT_WRITE; @@ -889,7 +897,7 @@ mapnum (ENOTDIR); mapnum (EPIPE); mapnum (EROFS); -#ifndef __EMX__ +#ifndef __UNIXOS2__ mapnum (ETXTBSY); /* not POSIX 1 */ #endif mapnum (ENOTTY); @@ -1176,7 +1184,7 @@ int xf86execl(const char *pathname, const char *arg, ...) { -#ifndef __EMX__ +#ifndef __UNIXOS2__ int i; pid_t pid; int exit_status; @@ -1259,7 +1267,7 @@ } #else return(1); -#endif /* __EMX__ Disable this crazy business for now */ +#endif /* __UNIXOS2__ Disable this crazy business for now */ } void @@ -1365,7 +1373,7 @@ if (xfmode & XF86_S_ISUID) mode |= S_ISUID; if (xfmode & XF86_S_ISGID) mode |= S_ISGID; -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (xfmode & XF86_S_ISVTX) mode |= S_ISVTX; #endif if (xfmode & XF86_S_IRUSR) mode |= S_IRUSR; @@ -1394,7 +1402,7 @@ int xf86chown(const char *path, xf86uid_t owner, xf86gid_t group) { -#ifndef __EMX__ +#ifndef __UNIXOS2__ int rc = chown(path, owner, group); #else int rc = 0; @@ -1428,7 +1436,7 @@ if (xfmode & XF86_S_IFREG) mode |= S_IFREG; if (xfmode & XF86_S_IFCHR) mode |= S_IFCHR; -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (xfmode & XF86_S_IFBLK) mode |= S_IFBLK; #endif if (xfmode & XF86_S_IFIFO) mode |= S_IFIFO; @@ -1439,7 +1447,7 @@ int xf86mknod(const char *pathname, xf86mode_t xfmode, xf86dev_t dev) { mode_t mode = xfToOsMknodMode(xfmode); -#ifndef __EMX__ +#ifndef __UNIXOS2__ int rc = mknod(pathname, mode, dev); #else int rc = 0; @@ -1833,7 +1841,7 @@ mapnum (ENOTDIR); mapnum (EPIPE); mapnum (EROFS); -#ifndef __EMX__ +#ifndef __UNIXOS2__ mapnum (ETXTBSY); /* not POSIX 1 */ #endif mapnum (ENOTTY); @@ -1876,10 +1884,16 @@ xf86shmat(int id, char *addr, int xf86shmflg) { int shmflg = 0; - + +#ifdef SHM_RDONLY if (xf86shmflg & XF86SHM_RDONLY) shmflg |= SHM_RDONLY; - if (xf86shmflg & XF86SHM_RND) shmflg |= SHM_RND; - if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP; +#endif +#ifdef SHM_RND + if (xf86shmflg & XF86SHM_RND) shmflg |= SHM_RND; +#endif +#ifdef SHM_REMAP + if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP; +#endif return shmat(id,addr,shmflg); } @@ -1937,14 +1951,39 @@ #endif /* HAVE_SYSV_IPC */ int -xf86setjmp(xf86jmp_buf xf86env) +xf86getjmptype() { - return setjmp((void *)xf86env); +#ifdef HAS_GLIBC_SIGSETJMP + return 1; +#else + return 0; +#endif } -void -xf86longjmp(xf86jmp_buf xf86env, int val) +#ifdef HAS_GLIBC_SIGSETJMP +int +xf86setjmp(xf86jmp_buf env) +{ + FatalError("setjmp: type 0 called instead of type %d\n", xf86getjmptype()); +} +#else +int +xf86setjmp1(xf86jmp_buf env, int arg2) +{ + FatalError("setjmp: type 1 called instead of type %d\n", xf86getjmptype()); +} +#endif + +int +xf86setjmp1_arg2() +{ + return 0; +} + +int +xf86setjmperror(xf86jmp_buf env) { - longjmp((void *)xf86env, val); + FatalError("setjmp: don't know how to handle setjmp() type %d\n", + xf86getjmptype()); } Index: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c:3.26 xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c:3.28 --- xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c:3.26 Thu Feb 15 14:46:03 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c Mon Feb 17 10:11:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.26 2001/02/15 19:46:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.28 2003/02/17 15:11:59 dawes Exp $ */ /* * Copyright 1993-1999 by The XFree86 Project, Inc. * @@ -413,8 +413,17 @@ xf86ReadSerial (int fd, void *buf, int count) { int r; - +#ifdef DEBUG + int i; +#endif SYSCALL (r = read (fd, buf, count)); +#ifdef DEBUG + ErrorF("ReadingSerial: 0x%x", + (unsigned char)*(((unsigned char *)buf))); + for (i = 1; i < r; i++) + ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i)); + ErrorF("\n"); +#endif return (r); } @@ -422,7 +431,14 @@ xf86WriteSerial (int fd, const void *buf, int count) { int r; +#ifdef DEBUG + int i; + ErrorF("WritingSerial: 0x%x",(unsigned char)*(((unsigned char *)buf))); + for (i = 1; i < count; i++) + ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i)); + ErrorF("\n"); +#endif SYSCALL (r = write (fd, buf, count)); return (r); } @@ -458,8 +474,7 @@ else { SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to)); } - if (xf86Verbose >= 9) - ErrorF ("select returned %d\n", r); + xf86ErrorFVerb (9,"select returned %d\n", r); return (r); } @@ -480,6 +495,9 @@ struct timeval timeout; char c[4]; +#ifdef DEBUG + ErrorF("FlushingSerial\n"); +#endif if (tcflush(fd, TCIFLUSH) == 0) return 0; @@ -488,7 +506,8 @@ FD_ZERO(&fds); FD_SET(fd, &fds); while (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) { - read(fd, &c, sizeof(c)); + if (read(fd, &c, sizeof(c)) < 1) + return 0; FD_ZERO(&fds); FD_SET(fd, &fds); } Index: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c:1.13 xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c:1.13 Mon Dec 24 17:30:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c Sun May 5 15:18:14 2002 @@ -25,7 +25,7 @@ * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.13 2001/12/24 22:30:45 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.14 2002/05/05 19:18:14 herrb Exp $ * */ @@ -131,26 +131,26 @@ { if (xf86IsPipe (fd)) return 0; - if (fcntl(fd, F_SETOWN, getpid()) == -1) { + blocked = xf86BlockSIGIO(); + if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { #ifdef XFree86Server - xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", + xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", fd, strerror(errno)); #else - fprintf(stderr,"fcntl(%d, F_SETOWN): %s\n", + fprintf(stderr,"fcntl(%d, O_ASYNC): %s\n", fd, strerror(errno)); #endif + xf86UnblockSIGIO(blocked); return 0; } - blocked = xf86BlockSIGIO(); - if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { + if (fcntl(fd, F_SETOWN, getpid()) == -1) { #ifdef XFree86Server - xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", + xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", fd, strerror(errno)); #else - fprintf(stderr,"fcntl(%d, O_ASYNC): %s\n", + fprintf(stderr,"fcntl(%d, F_SETOWN): %s\n", fd, strerror(errno)); #endif - xf86UnblockSIGIO(blocked); return 0; } sigemptyset(&sa.sa_mask); Index: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c:1.19 xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c:1.20 --- xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c:1.19 Fri Feb 16 09:45:11 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c Fri Jan 25 16:56:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.19 2001/02/16 14:45:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.20 2002/01/25 21:56:20 tsi Exp $ */ /* Standard resource information code */ @@ -11,6 +11,9 @@ #include "xf86_OSlib.h" #include "xf86Resources.h" +/* Avoid Imakefile changes */ +#include "bus/Pci.h" + #ifdef USESTDRES #define xf86StdBusAccWindowsFromOS xf86BusAccWindowsFromOS #define xf86StdAccResFromOS xf86AccResFromOS @@ -20,6 +23,8 @@ resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; #endif +#ifdef INCLUDE_XF86_NO_DOMAIN + resPtr xf86StdBusAccWindowsFromOS(void) { @@ -52,6 +57,8 @@ return ret; } +#ifdef INCLUDE_UNUSED + resPtr xf86StdIsaBusAccWindowsFromOS(void) { @@ -68,6 +75,8 @@ return ret; } +#endif /* INCLUDE_UNUSED */ + resPtr xf86StdAccResFromOS(resPtr ret) { @@ -133,3 +142,5 @@ /* XXX add others */ return ret; } + +#endif /* INCLUDE_XF86_NO_DOMAIN */ Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm_sarea.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm_sarea.h:1.1 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm_sarea.h Wed Oct 30 07:52:40 2002 @@ -0,0 +1,57 @@ +/* sarea.h -- SAREA definitions -*- linux-c -*- + * + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Michel Dänzer <michel@daenzer.net> + */ + +#ifndef _DRM_SAREA_H_ +#define _DRM_SAREA_H_ + +#define SAREA_MAX_DRAWABLES 256 + +typedef struct _drm_sarea_drawable_t { + unsigned int stamp; + unsigned int flags; +} drm_sarea_drawable_t; + +typedef struct _dri_sarea_frame_t { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + unsigned int fullscreen; +} drm_sarea_frame_t; + +typedef struct _drm_sarea_t { + /* first thing is always the drm locking structure */ + drm_hw_lock_t lock; + /* NOT_DONE: Use readers/writer lock for drawable_lock */ + drm_hw_lock_t drawable_lock; + drm_sarea_drawable_t drawableTable[SAREA_MAX_DRAWABLES]; + drm_sarea_frame_t frame; + drm_context_t dummy_context; +} drm_sarea_t; + +#endif /* _DRM_SAREA_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga.h:1.2 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga.h Mon Dec 16 11:19:31 2002 @@ -0,0 +1,98 @@ +/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*- + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_H__ +#define __MGA_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) mga_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "mga" +#define DRIVER_DESC "Matrox G200/G400" +#define DRIVER_DATE "20021029" + +#define DRIVER_MAJOR 3 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_GETPARAM)]= { mga_getparam, 1, 0 }, + +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY + +/* Driver customization: + */ +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 +#define __HAVE_DMA_IRQ 1 +#define __HAVE_VBL_IRQ 1 +#define __HAVE_SHARED_IRQ 1 + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_mga_private_t *dev_priv = dev->dev_private; \ + return mga_do_wait_for_idle( dev_priv ); \ +} while (0) + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_mga_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_dma.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_dma.c:1.1 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_dma.c Wed Oct 30 07:52:40 2002 @@ -0,0 +1,795 @@ +/* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> + */ + +#include "mga.h" +#include "drmP.h" +#include "drm.h" +#include "mga_drm.h" +#include "mga_drv.h" + +#define MGA_DEFAULT_USEC_TIMEOUT 10000 +#define MGA_FREELIST_DEBUG 0 + + +/* ================================================================ + * Engine control + */ + +int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) +{ + u32 status = 0; + int i; + DRM_DEBUG( "\n" ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) { + MGA_WRITE8( MGA_CRTC_INDEX, 0 ); + return 0; + } + DRM_UDELAY( 1 ); + } + +#if MGA_DMA_DEBUG + DRM_ERROR( "failed!\n" ); + DRM_INFO( " status=0x%08x\n", status ); +#endif + return DRM_ERR(EBUSY); +} + +int mga_do_dma_idle( drm_mga_private_t *dev_priv ) +{ + u32 status = 0; + int i; + DRM_DEBUG( "\n" ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) return 0; + DRM_UDELAY( 1 ); + } + +#if MGA_DMA_DEBUG + DRM_ERROR( "failed! status=0x%08x\n", status ); +#endif + return DRM_ERR(EBUSY); +} + +int mga_do_dma_reset( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + + DRM_DEBUG( "\n" ); + + /* The primary DMA stream should look like new right about now. + */ + primary->tail = 0; + primary->space = primary->size; + primary->last_flush = 0; + + sarea_priv->last_wrap = 0; + + /* FIXME: Reset counters, buffer ages etc... + */ + + /* FIXME: What else do we need to reinitialize? WARP stuff? + */ + + return 0; +} + +int mga_do_engine_reset( drm_mga_private_t *dev_priv ) +{ + DRM_DEBUG( "\n" ); + + /* Okay, so we've completely screwed up and locked the engine. + * How about we clean up after ourselves? + */ + MGA_WRITE( MGA_RST, MGA_SOFTRESET ); + DRM_UDELAY( 15 ); /* Wait at least 10 usecs */ + MGA_WRITE( MGA_RST, 0 ); + + /* Initialize the registers that get clobbered by the soft + * reset. Many of the core register values survive a reset, + * but the drawing registers are basically all gone. + * + * 3D clients should probably die after calling this. The X + * server should reset the engine state to known values. + */ +#if 0 + MGA_WRITE( MGA_PRIMPTR, + virt_to_bus((void *)dev_priv->prim.status_page) | + MGA_PRIMPTREN0 | + MGA_PRIMPTREN1 ); +#endif + + MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); + MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); + + /* The primary DMA stream should look like new right about now. + */ + mga_do_dma_reset( dev_priv ); + + /* This bad boy will never fail. + */ + return 0; +} + + +/* ================================================================ + * Primary DMA stream + */ + +void mga_do_dma_flush( drm_mga_private_t *dev_priv ) +{ + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + u32 status = 0; + int i; + DMA_LOCALS; + DRM_DEBUG( "\n" ); + + /* We need to wait so that we can do an safe flush */ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) break; + DRM_UDELAY( 1 ); + } + + if ( primary->tail == primary->last_flush ) { + DRM_DEBUG( " bailing out...\n" ); + return; + } + + tail = primary->tail + dev_priv->primary->offset; + + /* We need to pad the stream between flushes, as the card + * actually (partially?) reads the first of these commands. + * See page 4-16 in the G400 manual, middle of the page or so. + */ + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); + + primary->last_flush = primary->tail; + + head = MGA_READ( MGA_PRIMADDRESS ); + + if ( head <= tail ) { + primary->space = primary->size - primary->tail; + } else { + primary->space = head - tail; + } + + DRM_DEBUG( " head = 0x%06lx\n", head - dev_priv->primary->offset ); + DRM_DEBUG( " tail = 0x%06lx\n", tail - dev_priv->primary->offset ); + DRM_DEBUG( " space = 0x%06x\n", primary->space ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + + DRM_DEBUG( "done.\n" ); +} + +void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) +{ + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "\n" ); + + BEGIN_DMA_WRAP(); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); + + tail = primary->tail + dev_priv->primary->offset; + + primary->tail = 0; + primary->last_flush = 0; + primary->last_wrap++; + + head = MGA_READ( MGA_PRIMADDRESS ); + + if ( head == dev_priv->primary->offset ) { + primary->space = primary->size; + } else { + primary->space = head - dev_priv->primary->offset; + } + + DRM_DEBUG( " head = 0x%06lx\n", + head - dev_priv->primary->offset ); + DRM_DEBUG( " tail = 0x%06x\n", primary->tail ); + DRM_DEBUG( " wrap = %d\n", primary->last_wrap ); + DRM_DEBUG( " space = 0x%06x\n", primary->space ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + + set_bit( 0, &primary->wrapped ); + DRM_DEBUG( "done.\n" ); +} + +void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) +{ + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + u32 head = dev_priv->primary->offset; + DRM_DEBUG( "\n" ); + + sarea_priv->last_wrap++; + DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); + + clear_bit( 0, &primary->wrapped ); + DRM_DEBUG( "done.\n" ); +} + + +/* ================================================================ + * Freelist management + */ + +#define MGA_BUFFER_USED ~0 +#define MGA_BUFFER_FREE 0 + +#if MGA_FREELIST_DEBUG +static void mga_freelist_print( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + + DRM_INFO( "\n" ); + DRM_INFO( "current dispatch: last=0x%x done=0x%x\n", + dev_priv->sarea_priv->last_dispatch, + (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) - + dev_priv->primary->offset) ); + DRM_INFO( "current freelist:\n" ); + + for ( entry = dev_priv->head->next ; entry ; entry = entry->next ) { + DRM_INFO( " %p idx=%2d age=0x%x 0x%06lx\n", + entry, entry->buf->idx, entry->age.head, + entry->age.head - dev_priv->primary->offset ); + } + DRM_INFO( "\n" ); +} +#endif + +static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv ) +{ + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_freelist_t *entry; + int i; + DRM_DEBUG( "count=%d\n", dma->buf_count ); + + dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + return DRM_ERR(ENOMEM); + + memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) ); + SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 ); + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + + entry = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( entry == NULL ) + return DRM_ERR(ENOMEM); + + memset( entry, 0, sizeof(drm_mga_freelist_t) ); + + entry->next = dev_priv->head->next; + entry->prev = dev_priv->head; + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + entry->buf = buf; + + if ( dev_priv->head->next != NULL ) + dev_priv->head->next->prev = entry; + if ( entry->next == NULL ) + dev_priv->tail = entry; + + buf_priv->list_entry = entry; + buf_priv->discard = 0; + buf_priv->dispatched = 0; + + dev_priv->head->next = entry; + } + + return 0; +} + +static void mga_freelist_cleanup( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + drm_mga_freelist_t *next; + DRM_DEBUG( "\n" ); + + entry = dev_priv->head; + while ( entry ) { + next = entry->next; + DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); + entry = next; + } + + dev_priv->head = dev_priv->tail = NULL; +} + +#if 0 +/* FIXME: Still needed? + */ +static void mga_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + int i; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + SET_AGE( &buf_priv->list_entry->age, + MGA_BUFFER_FREE, 0 ); + } +} +#endif + +static drm_buf_t *mga_freelist_get( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *next; + drm_mga_freelist_t *prev; + drm_mga_freelist_t *tail = dev_priv->tail; + u32 head, wrap; + DRM_DEBUG( "\n" ); + + head = MGA_READ( MGA_PRIMADDRESS ); + wrap = dev_priv->sarea_priv->last_wrap; + + DRM_DEBUG( " tail=0x%06lx %d\n", + tail->age.head ? + tail->age.head - dev_priv->primary->offset : 0, + tail->age.wrap ); + DRM_DEBUG( " head=0x%06lx %d\n", + head - dev_priv->primary->offset, wrap ); + + if ( TEST_AGE( &tail->age, head, wrap ) ) { + prev = dev_priv->tail->prev; + next = dev_priv->tail; + prev->next = NULL; + next->prev = next->next = NULL; + dev_priv->tail = prev; + SET_AGE( &next->age, MGA_BUFFER_USED, 0 ); + return next->buf; + } + + DRM_DEBUG( "returning NULL!\n" ); + return NULL; +} + +int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_freelist_t *head, *entry, *prev; + + DRM_DEBUG( "age=0x%06lx wrap=%d\n", + buf_priv->list_entry->age.head - + dev_priv->primary->offset, + buf_priv->list_entry->age.wrap ); + + entry = buf_priv->list_entry; + head = dev_priv->head; + + if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + prev = dev_priv->tail; + prev->next = entry; + entry->prev = prev; + entry->next = NULL; + } else { + prev = head->next; + head->next = entry; + prev->prev = entry; + entry->prev = head; + entry->next = prev; + } + + return 0; +} + + +/* ================================================================ + * DMA initialization, cleanup + */ + +static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) +{ + drm_mga_private_t *dev_priv; + int ret; + DRM_DEBUG( "\n" ); + + dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); + if ( !dev_priv ) + return DRM_ERR(ENOMEM); + + memset( dev_priv, 0, sizeof(drm_mga_private_t) ); + + dev_priv->chipset = init->chipset; + + dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; + + if ( init->sgram ) { + dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK; + } else { + dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR; + } + dev_priv->maccess = init->maccess; + + dev_priv->fb_cpp = init->fb_cpp; + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; + + dev_priv->depth_cpp = init->depth_cpp; + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; + + /* FIXME: Need to support AGP textures... + */ + dev_priv->texture_offset = init->texture_offset[0]; + dev_priv->texture_size = init->texture_size[0]; + + DRM_GETSAREA(); + + if(!dev_priv->sarea) { + DRM_ERROR( "failed to find sarea!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR( "failed to find framebuffer!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR( "failed to find mmio region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->status, init->status_offset ); + if(!dev_priv->status) { + DRM_ERROR( "failed to find status page!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + + DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); + if(!dev_priv->warp) { + DRM_ERROR( "failed to find warp microcode region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); + if(!dev_priv->primary) { + DRM_ERROR( "failed to find primary dma region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR( "failed to find dma buffer region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(EINVAL); + } + + dev_priv->sarea_priv = + (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + DRM_IOREMAP( dev_priv->warp ); + DRM_IOREMAP( dev_priv->primary ); + DRM_IOREMAP( dev_priv->buffers ); + + if(!dev_priv->warp->handle || + !dev_priv->primary->handle || + !dev_priv->buffers->handle ) { + DRM_ERROR( "failed to ioremap agp regions!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(ENOMEM); + } + + ret = mga_warp_install_microcode( dev_priv ); + if ( ret < 0 ) { + DRM_ERROR( "failed to install WARP ucode!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return ret; + } + + ret = mga_warp_init( dev_priv ); + if ( ret < 0 ) { + DRM_ERROR( "failed to init WARP engine!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return ret; + } + + dev_priv->prim.status = (u32 *)dev_priv->status->handle; + + mga_do_wait_for_idle( dev_priv ); + + /* Init the primary DMA registers. + */ + MGA_WRITE( MGA_PRIMADDRESS, + dev_priv->primary->offset | MGA_DMA_GENERAL ); +#if 0 + MGA_WRITE( MGA_PRIMPTR, + virt_to_bus((void *)dev_priv->prim.status) | + MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */ + MGA_PRIMPTREN1 ); /* DWGSYNC */ +#endif + + dev_priv->prim.start = (u8 *)dev_priv->primary->handle; + dev_priv->prim.end = ((u8 *)dev_priv->primary->handle + + dev_priv->primary->size); + dev_priv->prim.size = dev_priv->primary->size; + + dev_priv->prim.tail = 0; + dev_priv->prim.space = dev_priv->prim.size; + dev_priv->prim.wrapped = 0; + + dev_priv->prim.last_flush = 0; + dev_priv->prim.last_wrap = 0; + + dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE; + + dev_priv->prim.status[0] = dev_priv->primary->offset; + dev_priv->prim.status[1] = 0; + + dev_priv->sarea_priv->last_wrap = 0; + dev_priv->sarea_priv->last_frame.head = 0; + dev_priv->sarea_priv->last_frame.wrap = 0; + + if ( mga_freelist_init( dev, dev_priv ) < 0 ) { + DRM_ERROR( "could not initialize freelist\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return DRM_ERR(ENOMEM); + } + + /* Make dev_private visable to others. */ + dev->dev_private = (void *)dev_priv; + return 0; +} + +int mga_do_cleanup_dma( drm_device_t *dev ) +{ + DRM_DEBUG( "\n" ); + + if ( dev->dev_private ) { + drm_mga_private_t *dev_priv = dev->dev_private; + + DRM_IOREMAPFREE( dev_priv->warp ); + DRM_IOREMAPFREE( dev_priv->primary ); + DRM_IOREMAPFREE( dev_priv->buffers ); + + if ( dev_priv->head != NULL ) { + mga_freelist_cleanup( dev ); + } + + DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int mga_dma_init( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_init_t init; + + DRM_COPY_FROM_USER_IOCTL( init, (drm_mga_init_t *)data, sizeof(init) ); + + switch ( init.func ) { + case MGA_INIT_DMA: + return mga_do_init_dma( dev, &init ); + case MGA_CLEANUP_DMA: + return mga_do_cleanup_dma( dev ); + } + + return DRM_ERR(EINVAL); +} + + +/* ================================================================ + * Primary DMA stream management + */ + +int mga_dma_flush( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_lock_t lock; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) ); + + DRM_DEBUG( "%s%s%s\n", + (lock.flags & _DRM_LOCK_FLUSH) ? "flush, " : "", + (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", + (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); + + WRAP_WAIT_WITH_RETURN( dev_priv ); + + if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { + mga_do_dma_flush( dev_priv ); + } + + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { +#if MGA_DMA_DEBUG + int ret = mga_do_wait_for_idle( dev_priv ); + if ( ret < 0 ) + DRM_INFO( "%s: -EBUSY\n", __FUNCTION__ ); + return ret; +#else + return mga_do_wait_for_idle( dev_priv ); +#endif + } else { + return 0; + } +} + +int mga_dma_reset( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + + LOCK_TEST_WITH_RETURN( dev ); + + return mga_do_dma_reset( dev_priv ); +} + + +/* ================================================================ + * DMA buffer management + */ + +static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + drm_buf_t *buf; + int i; + + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = mga_freelist_get( dev ); + if ( !buf ) return DRM_ERR(EAGAIN); + + buf->pid = DRM_CURRENTPID; + + if ( DRM_COPY_TO_USER( &d->request_indices[i], + &buf->idx, sizeof(buf->idx) ) ) + return DRM_ERR(EFAULT); + if ( DRM_COPY_TO_USER( &d->request_sizes[i], + &buf->total, sizeof(buf->total) ) ) + return DRM_ERR(EFAULT); + + d->granted_count++; + } + return 0; +} + +int mga_dma_buffers( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_dma_t d; + int ret = 0; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( d, (drm_dma_t *)data, sizeof(d) ); + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + DRM_CURRENTPID, d.send_count ); + return DRM_ERR(EINVAL); + } + + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + DRM_CURRENTPID, d.request_count, dma->buf_count ); + return DRM_ERR(EINVAL); + } + + WRAP_TEST_WITH_RETURN( dev_priv ); + + d.granted_count = 0; + + if ( d.request_count ) { + ret = mga_dma_get_buffers( dev, &d ); + } + + DRM_COPY_TO_USER_IOCTL( (drm_dma_t *)data, d, sizeof(d) ); + + return ret; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_drm.h:1.2 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_drm.h Mon Dec 16 11:19:32 2002 @@ -0,0 +1,336 @@ +/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- + * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_DRM_H__ +#define __MGA_DRM_H__ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (mga_sarea.h) + */ + +#ifndef __MGA_SAREA_DEFINES__ +#define __MGA_SAREA_DEFINES__ + +/* WARP pipe flags + */ +#define MGA_F 0x1 /* fog */ +#define MGA_A 0x2 /* alpha */ +#define MGA_S 0x4 /* specular */ +#define MGA_T2 0x8 /* multitexture */ + +#define MGA_WARP_TGZ 0 +#define MGA_WARP_TGZF (MGA_F) +#define MGA_WARP_TGZA (MGA_A) +#define MGA_WARP_TGZAF (MGA_F|MGA_A) +#define MGA_WARP_TGZS (MGA_S) +#define MGA_WARP_TGZSF (MGA_S|MGA_F) +#define MGA_WARP_TGZSA (MGA_S|MGA_A) +#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) +#define MGA_WARP_T2GZ (MGA_T2) +#define MGA_WARP_T2GZF (MGA_T2|MGA_F) +#define MGA_WARP_T2GZA (MGA_T2|MGA_A) +#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) +#define MGA_WARP_T2GZS (MGA_T2|MGA_S) +#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) +#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) +#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) + +#define MGA_MAX_G200_PIPES 8 /* no multitex */ +#define MGA_MAX_G400_PIPES 16 +#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES +#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ + +#define MGA_CARD_TYPE_G200 1 +#define MGA_CARD_TYPE_G400 2 + + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 + +/* What needs to be changed for the current vertex dma buffer? + */ +#define MGA_UPLOAD_CONTEXT 0x1 +#define MGA_UPLOAD_TEX0 0x2 +#define MGA_UPLOAD_TEX1 0x4 +#define MGA_UPLOAD_PIPE 0x8 +#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ +#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ +#define MGA_UPLOAD_2D 0x40 +#define MGA_WAIT_AGE 0x80 /* handled client-side */ +#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ +#if 0 +#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock + quiescent */ +#endif + +/* 32 buffers of 64k each, total 2 meg. + */ +#define MGA_BUFFER_SIZE (1 << 16) +#define MGA_NUM_BUFFERS 128 + +/* Keep these small for testing. + */ +#define MGA_NR_SAREA_CLIPRECTS 8 + +/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 + * regions, subject to a minimum region size of (1<<16) == 64k. + * + * Clients may subdivide regions internally, but when sharing between + * clients, the region size is the minimum granularity. + */ + +#define MGA_CARD_HEAP 0 +#define MGA_AGP_HEAP 1 +#define MGA_NR_TEX_HEAPS 2 +#define MGA_NR_TEX_REGIONS 16 +#define MGA_LOG_MIN_TEX_REGION_SIZE 16 + +#endif /* __MGA_SAREA_DEFINES__ */ + + +/* Setup registers for 3D context + */ +typedef struct { + unsigned int dstorg; + unsigned int maccess; + unsigned int plnwt; + unsigned int dwgctl; + unsigned int alphactrl; + unsigned int fogcolor; + unsigned int wflag; + unsigned int tdualstage0; + unsigned int tdualstage1; + unsigned int fcol; + unsigned int stencil; + unsigned int stencilctl; +} drm_mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} drm_mga_server_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int texctl; + unsigned int texctl2; + unsigned int texfilter; + unsigned int texbordercol; + unsigned int texorg; + unsigned int texwidth; + unsigned int texheight; + unsigned int texorg1; + unsigned int texorg2; + unsigned int texorg3; + unsigned int texorg4; +} drm_mga_texture_regs_t; + +/* General aging mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} drm_mga_age_t; + +typedef struct _drm_mga_sarea { + /* The channel for communication of state information to the kernel + * on firing a vertex dma buffer. + */ + drm_mga_context_regs_t context_state; + drm_mga_server_regs_t server_state; + drm_mga_texture_regs_t tex_state[2]; + unsigned int warp_pipe; + unsigned int dirty; + unsigned int vertsize; + + /* The current cliprects, or a subset thereof. + */ + drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Information about the most recently used 3d drawable. The + * client fills in the req_* fields, the server fills in the + * exported_ fields and puts the cliprects into boxes, above. + * + * The client clears the exported_drawable field before + * clobbering the boxes data. + */ + unsigned int req_drawable; /* the X drawable id */ + unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ + + unsigned int exported_drawable; + unsigned int exported_index; + unsigned int exported_stamp; + unsigned int exported_buffers; + unsigned int exported_nfront; + unsigned int exported_nback; + int exported_back_x, exported_front_x, exported_w; + int exported_back_y, exported_front_y, exported_h; + drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS]; + + /* Counters for aging textures and for client-side throttling. + */ + unsigned int status[4]; + unsigned int last_wrap; + + drm_mga_age_t last_frame; + unsigned int last_enqueue; /* last time a buffer was enqueued */ + unsigned int last_dispatch; /* age of the most recently dispatched buffer */ + unsigned int last_quiescent; /* */ + + /* LRU lists for texture memory in agp space and on the card. + */ + drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; + unsigned int texAge[MGA_NR_TEX_HEAPS]; + + /* Mechanism to validate card state. + */ + int ctxOwner; +} drm_mga_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmMga.h) + */ + +/* MGA specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) +#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) +#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) +#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) +#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) +#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) +#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) +#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(0x49, drm_mga_getparam_t) + +typedef struct _drm_mga_warp_index { + int installed; + unsigned long phys_addr; + int size; +} drm_mga_warp_index_t; + +typedef struct drm_mga_init { + enum { + MGA_INIT_DMA = 0x01, + MGA_CLEANUP_DMA = 0x02 + } func; + + unsigned long sarea_priv_offset; + + int chipset; + int sgram; + + unsigned int maccess; + + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + + unsigned int texture_offset[MGA_NR_TEX_HEAPS]; + unsigned int texture_size[MGA_NR_TEX_HEAPS]; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long status_offset; + unsigned long warp_offset; + unsigned long primary_offset; + unsigned long buffers_offset; +} drm_mga_init_t; + +typedef struct drm_mga_fullscreen { + enum { + MGA_INIT_FULLSCREEN = 0x01, + MGA_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_mga_fullscreen_t; + +typedef struct drm_mga_clear { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drm_mga_clear_t; + +typedef struct drm_mga_vertex { + int idx; /* buffer to queue */ + int used; /* bytes in use */ + int discard; /* client finished with buffer? */ +} drm_mga_vertex_t; + +typedef struct drm_mga_indices { + int idx; /* buffer to queue */ + unsigned int start; + unsigned int end; + int discard; /* client finished with buffer? */ +} drm_mga_indices_t; + +typedef struct drm_mga_iload { + int idx; + unsigned int dstorg; + unsigned int length; +} drm_mga_iload_t; + +typedef struct _drm_mga_blit { + unsigned int planemask; + unsigned int srcorg; + unsigned int dstorg; + int src_pitch, dst_pitch; + int delta_sx, delta_sy; + int delta_dx, delta_dy; + int height, ydir; /* flip image vertically */ + int source_pitch, dest_pitch; +} drm_mga_blit_t; + +/* 3.1: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define MGA_PARAM_IRQ_NR 1 + +typedef struct drm_mga_getparam { + int param; + int *value; +} drm_mga_getparam_t; + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_drv.h:1.3 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_drv.h Mon Dec 16 11:19:32 2002 @@ -0,0 +1,643 @@ +/* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_DRV_H__ +#define __MGA_DRV_H__ + +typedef struct drm_mga_primary_buffer { + u8 *start; + u8 *end; + int size; + + u32 tail; + int space; + volatile long wrapped; + + volatile u32 *status; + + u32 last_flush; + u32 last_wrap; + + u32 high_mark; +} drm_mga_primary_buffer_t; + +typedef struct drm_mga_freelist { + struct drm_mga_freelist *next; + struct drm_mga_freelist *prev; + drm_mga_age_t age; + drm_buf_t *buf; +} drm_mga_freelist_t; + +typedef struct { + drm_mga_freelist_t *list_entry; + int discard; + int dispatched; +} drm_mga_buf_priv_t; + +typedef struct drm_mga_private { + drm_mga_primary_buffer_t prim; + drm_mga_sarea_t *sarea_priv; + + drm_mga_freelist_t *head; + drm_mga_freelist_t *tail; + + unsigned int warp_pipe; + unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES]; + + int chipset; + int usec_timeout; + + u32 clear_cmd; + u32 maccess; + + unsigned int fb_cpp; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset; + unsigned int depth_pitch; + + unsigned int texture_offset; + unsigned int texture_size; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *status; + drm_map_t *warp; + drm_map_t *primary; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_mga_private_t; + + /* mga_dma.c */ +extern int mga_dma_init( DRM_IOCTL_ARGS ); +extern int mga_dma_flush( DRM_IOCTL_ARGS ); +extern int mga_dma_reset( DRM_IOCTL_ARGS ); +extern int mga_dma_buffers( DRM_IOCTL_ARGS ); + +extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); +extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); +extern int mga_do_dma_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_engine_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_cleanup_dma( drm_device_t *dev ); + +extern void mga_do_dma_flush( drm_mga_private_t *dev_priv ); +extern void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ); +extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ); + +extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); + + /* mga_state.c */ +extern int mga_dma_clear( DRM_IOCTL_ARGS ); +extern int mga_dma_swap( DRM_IOCTL_ARGS ); +extern int mga_dma_vertex( DRM_IOCTL_ARGS ); +extern int mga_dma_indices( DRM_IOCTL_ARGS ); +extern int mga_dma_iload( DRM_IOCTL_ARGS ); +extern int mga_dma_blit( DRM_IOCTL_ARGS ); +extern int mga_getparam( DRM_IOCTL_ARGS ); + + /* mga_warp.c */ +extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); +extern int mga_warp_init( drm_mga_private_t *dev_priv ); + +#define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() + + +#define MGA_BASE( reg ) ((unsigned long)(dev_priv->mmio->handle)) +#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) + +#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) +#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) + +#ifdef __alpha__ +#define MGA_READ( reg ) (_MGA_READ((u32 *)MGA_ADDR(reg))) +#define MGA_READ8( reg ) (_MGA_READ((u8 *)MGA_ADDR(reg))) +#define MGA_WRITE( reg, val ) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF( reg ) = val; } while (0) +#define MGA_WRITE8( reg, val ) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF8( reg ) = val; } while (0) + +static inline u32 _MGA_READ(u32 *addr) +{ + DRM_READMEMORYBARRIER(); + return *(volatile u32 *)addr; +} + +#else +#define MGA_READ( reg ) MGA_DEREF( reg ) +#define MGA_READ8( reg ) MGA_DEREF8( reg ) +#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) +#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0) +#endif + +#define DWGREG0 0x1c00 +#define DWGREG0_END 0x1dff +#define DWGREG1 0x2c00 +#define DWGREG1_END 0x2dff + +#define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) +#define DMAREG0(r) (u8)((r - DWGREG0) >> 2) +#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) +#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r)) + + + +/* ================================================================ + * Helper macross... + */ + +#define MGA_EMIT_STATE( dev_priv, dirty ) \ +do { \ + if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \ + mga_g400_emit_state( dev_priv ); \ + } else { \ + mga_g200_emit_state( dev_priv ); \ + } \ + } \ +} while (0) + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != DRM_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return DRM_ERR(EINVAL); \ + } \ +} while (0) + +#define WRAP_TEST_WITH_RETURN( dev_priv ) \ +do { \ + if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ + if ( mga_is_idle( dev_priv ) ) { \ + mga_do_dma_wrap_end( dev_priv ); \ + } else if ( dev_priv->prim.space < \ + dev_priv->prim.high_mark ) { \ + if ( MGA_DMA_DEBUG ) \ + DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ + return DRM_ERR(EBUSY); \ + } \ + } \ +} while (0) + +#define WRAP_WAIT_WITH_RETURN( dev_priv ) \ +do { \ + if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ + if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ + if ( MGA_DMA_DEBUG ) \ + DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ + return DRM_ERR(EBUSY); \ + } \ + mga_do_dma_wrap_end( dev_priv ); \ + } \ +} while (0) + + +/* ================================================================ + * Primary DMA command stream + */ + +#define MGA_VERBOSE 0 + +#define DMA_LOCALS unsigned int write; volatile u8 *prim; + +#define DMA_BLOCK_SIZE (5 * sizeof(u32)) + +#define BEGIN_DMA( n ) \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \ + (n), __FUNCTION__ ); \ + DRM_INFO( " space=0x%x req=0x%x\n", \ + dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ + } \ + prim = dev_priv->prim.start; \ + write = dev_priv->prim.tail; \ +} while (0) + +#define BEGIN_DMA_WRAP() \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \ + DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \ + } \ + prim = dev_priv->prim.start; \ + write = dev_priv->prim.tail; \ +} while (0) + +#define ADVANCE_DMA() \ +do { \ + dev_priv->prim.tail = write; \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \ + write, dev_priv->prim.space ); \ + } \ +} while (0) + +#define FLUSH_DMA() \ +do { \ + if ( 0 ) { \ + DRM_INFO( "%s:\n", __FUNCTION__ ); \ + DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ + dev_priv->prim.tail, \ + MGA_READ( MGA_PRIMADDRESS ) - \ + dev_priv->primary->offset ); \ + } \ + if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \ + if ( dev_priv->prim.space < \ + dev_priv->prim.high_mark ) { \ + mga_do_dma_wrap_start( dev_priv ); \ + } else { \ + mga_do_dma_flush( dev_priv ); \ + } \ + } \ +} while (0) + +/* Never use this, always use DMA_BLOCK(...) for primary DMA output. + */ +#define DMA_WRITE( offset, val ) \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \ + (u32)(val), write + (offset) * sizeof(u32) ); \ + } \ + *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ +} while (0) + +#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 ) \ +do { \ + DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) | \ + (DMAREG( reg1 ) << 8) | \ + (DMAREG( reg2 ) << 16) | \ + (DMAREG( reg3 ) << 24)) ); \ + DMA_WRITE( 1, val0 ); \ + DMA_WRITE( 2, val1 ); \ + DMA_WRITE( 3, val2 ); \ + DMA_WRITE( 4, val3 ); \ + write += DMA_BLOCK_SIZE; \ +} while (0) + + +/* Buffer aging via primary DMA stream head pointer. + */ + +#define SET_AGE( age, h, w ) \ +do { \ + (age)->head = h; \ + (age)->wrap = w; \ +} while (0) + +#define TEST_AGE( age, h, w ) ( (age)->wrap < w || \ + ( (age)->wrap == w && \ + (age)->head < h ) ) + +#define AGE_BUFFER( buf_priv ) \ +do { \ + drm_mga_freelist_t *entry = (buf_priv)->list_entry; \ + if ( (buf_priv)->dispatched ) { \ + entry->age.head = (dev_priv->prim.tail + \ + dev_priv->primary->offset); \ + entry->age.wrap = dev_priv->sarea_priv->last_wrap; \ + } else { \ + entry->age.head = 0; \ + entry->age.wrap = 0; \ + } \ +} while (0) + + +#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \ + MGA_DWGENGSTS | \ + MGA_ENDPRDMASTS) +#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \ + MGA_ENDPRDMASTS) + +#define MGA_DMA_DEBUG 0 + + + +/* A reduced set of the mga registers. + */ +#define MGA_CRTC_INDEX 0x1fd4 +#define MGA_CRTC_DATA 0x1fd5 + +/* CRTC11 */ +#define MGA_VINTCLR (1 << 4) +#define MGA_VINTEN (1 << 5) + +#define MGA_ALPHACTRL 0x2c7c +#define MGA_AR0 0x1c60 +#define MGA_AR1 0x1c64 +#define MGA_AR2 0x1c68 +#define MGA_AR3 0x1c6c +#define MGA_AR4 0x1c70 +#define MGA_AR5 0x1c74 +#define MGA_AR6 0x1c78 + +#define MGA_CXBNDRY 0x1c80 +#define MGA_CXLEFT 0x1ca0 +#define MGA_CXRIGHT 0x1ca4 + +#define MGA_DMAPAD 0x1c54 +#define MGA_DSTORG 0x2cb8 +#define MGA_DWGCTL 0x1c00 +# define MGA_OPCOD_MASK (15 << 0) +# define MGA_OPCOD_TRAP (4 << 0) +# define MGA_OPCOD_TEXTURE_TRAP (6 << 0) +# define MGA_OPCOD_BITBLT (8 << 0) +# define MGA_OPCOD_ILOAD (9 << 0) +# define MGA_ATYPE_MASK (7 << 4) +# define MGA_ATYPE_RPL (0 << 4) +# define MGA_ATYPE_RSTR (1 << 4) +# define MGA_ATYPE_ZI (3 << 4) +# define MGA_ATYPE_BLK (4 << 4) +# define MGA_ATYPE_I (7 << 4) +# define MGA_LINEAR (1 << 7) +# define MGA_ZMODE_MASK (7 << 8) +# define MGA_ZMODE_NOZCMP (0 << 8) +# define MGA_ZMODE_ZE (2 << 8) +# define MGA_ZMODE_ZNE (3 << 8) +# define MGA_ZMODE_ZLT (4 << 8) +# define MGA_ZMODE_ZLTE (5 << 8) +# define MGA_ZMODE_ZGT (6 << 8) +# define MGA_ZMODE_ZGTE (7 << 8) +# define MGA_SOLID (1 << 11) +# define MGA_ARZERO (1 << 12) +# define MGA_SGNZERO (1 << 13) +# define MGA_SHIFTZERO (1 << 14) +# define MGA_BOP_MASK (15 << 16) +# define MGA_BOP_ZERO (0 << 16) +# define MGA_BOP_DST (10 << 16) +# define MGA_BOP_SRC (12 << 16) +# define MGA_BOP_ONE (15 << 16) +# define MGA_TRANS_SHIFT 20 +# define MGA_TRANS_MASK (15 << 20) +# define MGA_BLTMOD_MASK (15 << 25) +# define MGA_BLTMOD_BMONOLEF (0 << 25) +# define MGA_BLTMOD_BMONOWF (4 << 25) +# define MGA_BLTMOD_PLAN (1 << 25) +# define MGA_BLTMOD_BFCOL (2 << 25) +# define MGA_BLTMOD_BU32BGR (3 << 25) +# define MGA_BLTMOD_BU32RGB (7 << 25) +# define MGA_BLTMOD_BU24BGR (11 << 25) +# define MGA_BLTMOD_BU24RGB (15 << 25) +# define MGA_PATTERN (1 << 29) +# define MGA_TRANSC (1 << 30) +# define MGA_CLIPDIS (1 << 31) +#define MGA_DWGSYNC 0x2c4c + +#define MGA_FCOL 0x1c24 +#define MGA_FIFOSTATUS 0x1e10 +#define MGA_FOGCOL 0x1cf4 +#define MGA_FXBNDRY 0x1c84 +#define MGA_FXLEFT 0x1ca8 +#define MGA_FXRIGHT 0x1cac + +#define MGA_ICLEAR 0x1e18 +# define MGA_SOFTRAPICLR (1 << 0) +# define MGA_VLINEICLR (1 << 5) +#define MGA_IEN 0x1e1c +# define MGA_SOFTRAPIEN (1 << 0) +# define MGA_VLINEIEN (1 << 5) + +#define MGA_LEN 0x1c5c + +#define MGA_MACCESS 0x1c04 + +#define MGA_PITCH 0x1c8c +#define MGA_PLNWT 0x1c1c +#define MGA_PRIMADDRESS 0x1e58 +# define MGA_DMA_GENERAL (0 << 0) +# define MGA_DMA_BLIT (1 << 0) +# define MGA_DMA_VECTOR (2 << 0) +# define MGA_DMA_VERTEX (3 << 0) +#define MGA_PRIMEND 0x1e5c +# define MGA_PRIMNOSTART (1 << 0) +# define MGA_PAGPXFER (1 << 1) +#define MGA_PRIMPTR 0x1e50 +# define MGA_PRIMPTREN0 (1 << 0) +# define MGA_PRIMPTREN1 (1 << 1) + +#define MGA_RST 0x1e40 +# define MGA_SOFTRESET (1 << 0) +# define MGA_SOFTEXTRST (1 << 1) + +#define MGA_SECADDRESS 0x2c40 +#define MGA_SECEND 0x2c44 +#define MGA_SETUPADDRESS 0x2cd0 +#define MGA_SETUPEND 0x2cd4 +#define MGA_SGN 0x1c58 +#define MGA_SOFTRAP 0x2c48 +#define MGA_SRCORG 0x2cb4 +# define MGA_SRMMAP_MASK (1 << 0) +# define MGA_SRCMAP_FB (0 << 0) +# define MGA_SRCMAP_SYSMEM (1 << 0) +# define MGA_SRCACC_MASK (1 << 1) +# define MGA_SRCACC_PCI (0 << 1) +# define MGA_SRCACC_AGP (1 << 1) +#define MGA_STATUS 0x1e14 +# define MGA_SOFTRAPEN (1 << 0) +# define MGA_VSYNCPEN (1 << 4) +# define MGA_VLINEPEN (1 << 5) +# define MGA_DWGENGSTS (1 << 16) +# define MGA_ENDPRDMASTS (1 << 17) +#define MGA_STENCIL 0x2cc8 +#define MGA_STENCILCTL 0x2ccc + +#define MGA_TDUALSTAGE0 0x2cf8 +#define MGA_TDUALSTAGE1 0x2cfc +#define MGA_TEXBORDERCOL 0x2c5c +#define MGA_TEXCTL 0x2c30 +#define MGA_TEXCTL2 0x2c3c +# define MGA_DUALTEX (1 << 7) +# define MGA_G400_TC2_MAGIC (1 << 15) +# define MGA_MAP1_ENABLE (1 << 31) +#define MGA_TEXFILTER 0x2c58 +#define MGA_TEXHEIGHT 0x2c2c +#define MGA_TEXORG 0x2c24 +# define MGA_TEXORGMAP_MASK (1 << 0) +# define MGA_TEXORGMAP_FB (0 << 0) +# define MGA_TEXORGMAP_SYSMEM (1 << 0) +# define MGA_TEXORGACC_MASK (1 << 1) +# define MGA_TEXORGACC_PCI (0 << 1) +# define MGA_TEXORGACC_AGP (1 << 1) +#define MGA_TEXORG1 0x2ca4 +#define MGA_TEXORG2 0x2ca8 +#define MGA_TEXORG3 0x2cac +#define MGA_TEXORG4 0x2cb0 +#define MGA_TEXTRANS 0x2c34 +#define MGA_TEXTRANSHIGH 0x2c38 +#define MGA_TEXWIDTH 0x2c28 + +#define MGA_WACCEPTSEQ 0x1dd4 +#define MGA_WCODEADDR 0x1e6c +#define MGA_WFLAG 0x1dc4 +#define MGA_WFLAG1 0x1de0 +#define MGA_WFLAGNB 0x1e64 +#define MGA_WFLAGNB1 0x1e08 +#define MGA_WGETMSB 0x1dc8 +#define MGA_WIADDR 0x1dc0 +#define MGA_WIADDR2 0x1dd8 +# define MGA_WMODE_SUSPEND (0 << 0) +# define MGA_WMODE_RESUME (1 << 0) +# define MGA_WMODE_JUMP (2 << 0) +# define MGA_WMODE_START (3 << 0) +# define MGA_WAGP_ENABLE (1 << 2) +#define MGA_WMISC 0x1e70 +# define MGA_WUCODECACHE_ENABLE (1 << 0) +# define MGA_WMASTER_ENABLE (1 << 1) +# define MGA_WCACHEFLUSH_ENABLE (1 << 3) +#define MGA_WVRTXSZ 0x1dcc + +#define MGA_YBOT 0x1c9c +#define MGA_YDST 0x1c90 +#define MGA_YDSTLEN 0x1c88 +#define MGA_YDSTORG 0x1c94 +#define MGA_YTOP 0x1c98 + +#define MGA_ZORG 0x1c0c + +/* This finishes the current batch of commands + */ +#define MGA_EXEC 0x0100 + +/* Warp registers + */ +#define MGA_WR0 0x2d00 +#define MGA_WR1 0x2d04 +#define MGA_WR2 0x2d08 +#define MGA_WR3 0x2d0c +#define MGA_WR4 0x2d10 +#define MGA_WR5 0x2d14 +#define MGA_WR6 0x2d18 +#define MGA_WR7 0x2d1c +#define MGA_WR8 0x2d20 +#define MGA_WR9 0x2d24 +#define MGA_WR10 0x2d28 +#define MGA_WR11 0x2d2c +#define MGA_WR12 0x2d30 +#define MGA_WR13 0x2d34 +#define MGA_WR14 0x2d38 +#define MGA_WR15 0x2d3c +#define MGA_WR16 0x2d40 +#define MGA_WR17 0x2d44 +#define MGA_WR18 0x2d48 +#define MGA_WR19 0x2d4c +#define MGA_WR20 0x2d50 +#define MGA_WR21 0x2d54 +#define MGA_WR22 0x2d58 +#define MGA_WR23 0x2d5c +#define MGA_WR24 0x2d60 +#define MGA_WR25 0x2d64 +#define MGA_WR26 0x2d68 +#define MGA_WR27 0x2d6c +#define MGA_WR28 0x2d70 +#define MGA_WR29 0x2d74 +#define MGA_WR30 0x2d78 +#define MGA_WR31 0x2d7c +#define MGA_WR32 0x2d80 +#define MGA_WR33 0x2d84 +#define MGA_WR34 0x2d88 +#define MGA_WR35 0x2d8c +#define MGA_WR36 0x2d90 +#define MGA_WR37 0x2d94 +#define MGA_WR38 0x2d98 +#define MGA_WR39 0x2d9c +#define MGA_WR40 0x2da0 +#define MGA_WR41 0x2da4 +#define MGA_WR42 0x2da8 +#define MGA_WR43 0x2dac +#define MGA_WR44 0x2db0 +#define MGA_WR45 0x2db4 +#define MGA_WR46 0x2db8 +#define MGA_WR47 0x2dbc +#define MGA_WR48 0x2dc0 +#define MGA_WR49 0x2dc4 +#define MGA_WR50 0x2dc8 +#define MGA_WR51 0x2dcc +#define MGA_WR52 0x2dd0 +#define MGA_WR53 0x2dd4 +#define MGA_WR54 0x2dd8 +#define MGA_WR55 0x2ddc +#define MGA_WR56 0x2de0 +#define MGA_WR57 0x2de4 +#define MGA_WR58 0x2de8 +#define MGA_WR59 0x2dec +#define MGA_WR60 0x2df0 +#define MGA_WR61 0x2df4 +#define MGA_WR62 0x2df8 +#define MGA_WR63 0x2dfc +# define MGA_G400_WR_MAGIC (1 << 6) +# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */ + + +#define MGA_ILOAD_ALIGN 64 +#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1) + +#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \ + MGA_ATYPE_I | \ + MGA_ZMODE_NOZCMP | \ + MGA_ARZERO | \ + MGA_SGNZERO | \ + MGA_BOP_SRC | \ + (15 << MGA_TRANS_SHIFT)) + +#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \ + MGA_ZMODE_NOZCMP | \ + MGA_SOLID | \ + MGA_ARZERO | \ + MGA_SGNZERO | \ + MGA_SHIFTZERO | \ + MGA_BOP_SRC | \ + (0 << MGA_TRANS_SHIFT) | \ + MGA_BLTMOD_BMONOLEF | \ + MGA_TRANSC | \ + MGA_CLIPDIS) + +#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \ + MGA_ATYPE_RPL | \ + MGA_SGNZERO | \ + MGA_SHIFTZERO | \ + MGA_BOP_SRC | \ + (0 << MGA_TRANS_SHIFT) | \ + MGA_BLTMOD_BFCOL | \ + MGA_CLIPDIS) + +/* Simple idle test. + */ +static __inline__ int mga_is_idle( drm_mga_private_t *dev_priv ) +{ + u32 status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; + return ( status == MGA_ENDPRDMASTS ); +} + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_irq.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_irq.c:1.1 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_irq.c Mon Dec 16 11:19:32 2002 @@ -0,0 +1,100 @@ +/* mga_irq.c -- IRQ handling for radeon -*- linux-c -*- + * + * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. + * + * The Weather Channel (TM) funded Tungsten Graphics to develop the + * initial release of the Radeon 8500 driver under the XFree86 license. + * This notice must be preserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * Eric Anholt <anholt@FreeBSD.org> + */ + +#include "mga.h" +#include "drmP.h" +#include "drm.h" +#include "mga_drm.h" +#include "mga_drv.h" + +void mga_dma_service( DRM_IRQ_ARGS ) +{ + drm_device_t *dev = (drm_device_t *) arg; + drm_mga_private_t *dev_priv = + (drm_mga_private_t *)dev->dev_private; + int status; + + status = MGA_READ( MGA_STATUS ); + + /* VBLANK interrupt */ + if ( status & MGA_VLINEPEN ) { + MGA_WRITE( MGA_ICLEAR, MGA_VLINEICLR ); + atomic_inc(&dev->vbl_received); + DRM_WAKEUP(&dev->vbl_queue); + DRM(vbl_send_signals)( dev ); + } +} + +int mga_vblank_wait(drm_device_t *dev, unsigned int *sequence) +{ + unsigned int cur_vblank; + int ret = 0; + + /* Assume that the user has missed the current sequence number + * by about a day rather than she wants to wait for years + * using vertical blanks... + */ + DRM_WAIT_ON( ret, dev->vbl_queue, 3*DRM_HZ, + ( ( ( cur_vblank = atomic_read(&dev->vbl_received ) ) + - *sequence ) <= (1<<23) ) ); + + *sequence = cur_vblank; + + return ret; +} + +void mga_driver_irq_preinstall( drm_device_t *dev ) { + drm_mga_private_t *dev_priv = + (drm_mga_private_t *)dev->dev_private; + + /* Disable *all* interrupts */ + MGA_WRITE( MGA_IEN, 0 ); + /* Clear bits if they're already high */ + MGA_WRITE( MGA_ICLEAR, ~0 ); +} + +void mga_driver_irq_postinstall( drm_device_t *dev ) { + drm_mga_private_t *dev_priv = + (drm_mga_private_t *)dev->dev_private; + + /* Turn on VBL interrupt */ + MGA_WRITE( MGA_IEN, MGA_VLINEIEN ); +} + +void mga_driver_irq_uninstall( drm_device_t *dev ) { + drm_mga_private_t *dev_priv = + (drm_mga_private_t *)dev->dev_private; + if ( dev_priv ) { + /* Disable *all* interrupts */ + MGA_WRITE( MGA_IEN, 0 ); + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_state.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_state.c:1.2 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_state.c Mon Dec 16 11:19:32 2002 @@ -0,0 +1,1110 @@ +/* mga_state.c -- State support for MGA G200/G400 -*- linux-c -*- + * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> + */ + +#include "mga.h" +#include "drmP.h" +#include "drm.h" +#include "mga_drm.h" +#include "mga_drv.h" + + +/* ================================================================ + * DMA hardware state programming functions + */ + +static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, + drm_clip_rect_t *box ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + unsigned int pitch = dev_priv->front_pitch; + DMA_LOCALS; + + BEGIN_DMA( 2 ); + + /* Force reset of DWGCTL on G400 (eliminates clip disable bit). + */ + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { + DMA_BLOCK( MGA_DWGCTL, ctx->dwgctl, + MGA_LEN + MGA_EXEC, 0x80000000, + MGA_DWGCTL, ctx->dwgctl, + MGA_LEN + MGA_EXEC, 0x80000000 ); + } + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_CXBNDRY, (box->x2 << 16) | box->x1, + MGA_YTOP, box->y1 * pitch, + MGA_YBOT, box->y2 * pitch ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g200_emit_context( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; + + BEGIN_DMA( 3 ); + + DMA_BLOCK( MGA_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); + + DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); + + DMA_BLOCK( MGA_FCOL, ctx->fcol, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g400_emit_context( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; + + BEGIN_DMA( 4 ); + + DMA_BLOCK( MGA_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); + + DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); + + DMA_BLOCK( MGA_WFLAG1, ctx->wflag, + MGA_TDUALSTAGE0, ctx->tdualstage0, + MGA_TDUALSTAGE1, ctx->tdualstage1, + MGA_FCOL, ctx->fcol ); + + DMA_BLOCK( MGA_STENCIL, ctx->stencil, + MGA_STENCILCTL, ctx->stencilctl, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g200_emit_tex0( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; + + BEGIN_DMA( 4 ); + + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); + + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); + + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR24, tex->texwidth ); + + DMA_BLOCK( MGA_WR34, tex->texheight, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g400_emit_tex0( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; + +/* printk("mga_g400_emit_tex0 %x %x %x\n", tex->texorg, */ +/* tex->texctl, tex->texctl2); */ + + BEGIN_DMA( 6 ); + + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); + + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); + + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); + + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, MGA_G400_WR_MAGIC ); + + DMA_BLOCK( MGA_WR60, MGA_G400_WR_MAGIC, + MGA_WR54, tex->texwidth | MGA_G400_WR_MAGIC, + MGA_WR62, tex->texheight | MGA_G400_WR_MAGIC, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g400_emit_tex1( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1]; + DMA_LOCALS; + +/* printk("mga_g400_emit_tex1 %x %x %x\n", tex->texorg, */ +/* tex->texctl, tex->texctl2); */ + + BEGIN_DMA( 5 ); + + DMA_BLOCK( MGA_TEXCTL2, (tex->texctl2 | + MGA_MAP1_ENABLE | + MGA_G400_TC2_MAGIC), + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); + + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); + + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); + + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, tex->texwidth | MGA_G400_WR_MAGIC ); + + DMA_BLOCK( MGA_WR60, tex->texheight | MGA_G400_WR_MAGIC, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g200_emit_pipe( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; + + BEGIN_DMA( 3 ); + + DMA_BLOCK( MGA_WIADDR, MGA_WMODE_SUSPEND, + MGA_WVRTXSZ, 0x00000007, + MGA_WFLAG, 0x00000000, + MGA_WR24, 0x00000000 ); + + DMA_BLOCK( MGA_WR25, 0x00000100, + MGA_WR34, 0x00000000, + MGA_WR42, 0x0000ffff, + MGA_WR60, 0x0000ffff ); + + /* Padding required to to hardware bug. + */ + DMA_BLOCK( MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_WIADDR, (dev_priv->warp_pipe_phys[pipe] | + MGA_WMODE_START | + MGA_WAGP_ENABLE) ); + + ADVANCE_DMA(); +} + +static __inline__ void mga_g400_emit_pipe( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; + +/* printk("mga_g400_emit_pipe %x\n", pipe); */ + + BEGIN_DMA( 10 ); + + DMA_BLOCK( MGA_WIADDR2, MGA_WMODE_SUSPEND, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + if ( pipe & MGA_T2 ) { + DMA_BLOCK( MGA_WVRTXSZ, 0x00001e09, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x1e000000 ); + } else { + if ( dev_priv->warp_pipe & MGA_T2 ) { + /* Flush the WARP pipe */ + DMA_BLOCK( MGA_YDST, 0x00000000, + MGA_FXLEFT, 0x00000000, + MGA_FXRIGHT, 0x00000001, + MGA_DWGCTL, MGA_DWGCTL_FLUSH ); + + DMA_BLOCK( MGA_LEN + MGA_EXEC, 0x00000001, + MGA_DWGSYNC, 0x00007000, + MGA_TEXCTL2, MGA_G400_TC2_MAGIC, + MGA_LEN + MGA_EXEC, 0x00000000 ); + + DMA_BLOCK( MGA_TEXCTL2, (MGA_DUALTEX | + MGA_G400_TC2_MAGIC), + MGA_LEN + MGA_EXEC, 0x00000000, + MGA_TEXCTL2, MGA_G400_TC2_MAGIC, + MGA_DMAPAD, 0x00000000 ); + } + + DMA_BLOCK( MGA_WVRTXSZ, 0x00001807, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x18000000 ); + } + + DMA_BLOCK( MGA_WFLAG, 0x00000000, + MGA_WFLAG1, 0x00000000, + MGA_WR56, MGA_G400_WR56_MAGIC, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WR49, 0x00000000, /* tex0 */ + MGA_WR57, 0x00000000, /* tex0 */ + MGA_WR53, 0x00000000, /* tex1 */ + MGA_WR61, 0x00000000 ); /* tex1 */ + + DMA_BLOCK( MGA_WR54, MGA_G400_WR_MAGIC, /* tex0 width */ + MGA_WR62, MGA_G400_WR_MAGIC, /* tex0 height */ + MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */ + MGA_WR60, MGA_G400_WR_MAGIC ); /* tex1 height */ + + /* Padding required to to hardware bug */ + DMA_BLOCK( MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_WIADDR2, (dev_priv->warp_pipe_phys[pipe] | + MGA_WMODE_START | + MGA_WAGP_ENABLE) ); + + ADVANCE_DMA(); +} + +static void mga_g200_emit_state( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { + mga_g200_emit_pipe( dev_priv ); + dev_priv->warp_pipe = sarea_priv->warp_pipe; + } + + if ( dirty & MGA_UPLOAD_CONTEXT ) { + mga_g200_emit_context( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; + } + + if ( dirty & MGA_UPLOAD_TEX0 ) { + mga_g200_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + } +} + +static void mga_g400_emit_state( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + int multitex = sarea_priv->warp_pipe & MGA_T2; + + if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { + mga_g400_emit_pipe( dev_priv ); + dev_priv->warp_pipe = sarea_priv->warp_pipe; + } + + if ( dirty & MGA_UPLOAD_CONTEXT ) { + mga_g400_emit_context( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; + } + + if ( dirty & MGA_UPLOAD_TEX0 ) { + mga_g400_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + } + + if ( (dirty & MGA_UPLOAD_TEX1) && multitex ) { + mga_g400_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; + } +} + + +/* ================================================================ + * SAREA state verification + */ + +/* Disallow all write destinations except the front and backbuffer. + */ +static int mga_verify_context( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + + if ( ctx->dstorg != dev_priv->front_offset && + ctx->dstorg != dev_priv->back_offset ) { + DRM_ERROR( "*** bad DSTORG: %x (front %x, back %x)\n\n", + ctx->dstorg, dev_priv->front_offset, + dev_priv->back_offset ); + ctx->dstorg = 0; + return DRM_ERR(EINVAL); + } + + return 0; +} + +/* Disallow texture reads from PCI space. + */ +static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit]; + unsigned int org; + + org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); + + if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { + DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n", + tex->texorg, unit ); + tex->texorg = 0; + return DRM_ERR(EINVAL); + } + + return 0; +} + +static int mga_verify_state( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + int ret = 0; + + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + + if ( dirty & MGA_UPLOAD_CONTEXT ) + ret |= mga_verify_context( dev_priv ); + + if ( dirty & MGA_UPLOAD_TEX0 ) + ret |= mga_verify_tex( dev_priv, 0 ); + + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { + if ( dirty & MGA_UPLOAD_TEX1 ) + ret |= mga_verify_tex( dev_priv, 1 ); + + if ( dirty & MGA_UPLOAD_PIPE ) + ret |= ( sarea_priv->warp_pipe > MGA_MAX_G400_PIPES ); + } else { + if ( dirty & MGA_UPLOAD_PIPE ) + ret |= ( sarea_priv->warp_pipe > MGA_MAX_G200_PIPES ); + } + + return ( ret == 0 ); +} + +static int mga_verify_iload( drm_mga_private_t *dev_priv, + unsigned int dstorg, unsigned int length ) +{ + if ( dstorg < dev_priv->texture_offset || + dstorg + length > (dev_priv->texture_offset + + dev_priv->texture_size) ) { + DRM_ERROR( "*** bad iload DSTORG: 0x%x\n", dstorg ); + return DRM_ERR(EINVAL); + } + + if ( length & MGA_ILOAD_MASK ) { + DRM_ERROR( "*** bad iload length: 0x%x\n", + length & MGA_ILOAD_MASK ); + return DRM_ERR(EINVAL); + } + + return 0; +} + +static int mga_verify_blit( drm_mga_private_t *dev_priv, + unsigned int srcorg, unsigned int dstorg ) +{ + if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || + (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) { + DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n", + srcorg, dstorg ); + return DRM_ERR(EINVAL); + } + return 0; +} + + +/* ================================================================ + * + */ + +static void mga_dma_dispatch_clear( drm_device_t *dev, + drm_mga_clear_t *clear ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + int i; + DMA_LOCALS; + DRM_DEBUG( "\n" ); + + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + ADVANCE_DMA(); + + for ( i = 0 ; i < nbox ; i++ ) { + drm_clip_rect_t *box = &pbox[i]; + u32 height = box->y2 - box->y1; + + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + if ( clear->flags & MGA_FRONT ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_color, + MGA_DSTORG, dev_priv->front_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + + if ( clear->flags & MGA_BACK ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_color, + MGA_DSTORG, dev_priv->back_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + if ( clear->flags & MGA_DEPTH ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->depth_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_depth, + MGA_DSTORG, dev_priv->depth_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + } + + BEGIN_DMA( 1 ); + + /* Force reset of DWGCTL */ + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); + + FLUSH_DMA(); +} + +static void mga_dma_dispatch_swap( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + int i; + DMA_LOCALS; + DRM_DEBUG( "\n" ); + + sarea_priv->last_frame.head = dev_priv->prim.tail; + sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; + + BEGIN_DMA( 4 + nbox ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, + MGA_MACCESS, dev_priv->maccess, + MGA_SRCORG, dev_priv->back_offset, + MGA_AR5, dev_priv->front_pitch ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, 0xffffffff, + MGA_DWGCTL, MGA_DWGCTL_COPY ); + + for ( i = 0 ; i < nbox ; i++ ) { + drm_clip_rect_t *box = &pbox[i]; + u32 height = box->y2 - box->y1; + u32 start = box->y1 * dev_priv->front_pitch; + + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + DMA_BLOCK( MGA_AR0, start + box->x2 - 1, + MGA_AR3, start + box->x1, + MGA_FXBNDRY, ((box->x2 - 1) << 16) | box->x1, + MGA_YDSTLEN + MGA_EXEC, + (box->y1 << 16) | height ); + } + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_SRCORG, dev_priv->front_offset, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); + + FLUSH_DMA(); + + DRM_DEBUG( "%s... done.\n", __FUNCTION__ ); +} + +static void mga_dma_dispatch_vertex( drm_device_t *dev, drm_buf_t *buf ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + u32 address = (u32) buf->bus_address; + u32 length = (u32) buf->used; + int i = 0; + DMA_LOCALS; + DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used ); + + if ( buf->used ) { + buf_priv->dispatched = 1; + + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); + + do { + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + } + + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_SECADDRESS, (address | + MGA_DMA_VERTEX), + MGA_SECEND, ((address + length) | + MGA_PAGPXFER) ); + + ADVANCE_DMA(); + } while ( ++i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + AGE_BUFFER( buf_priv ); + buf->pending = 0; + buf->used = 0; + buf_priv->dispatched = 0; + + mga_freelist_put( dev, buf ); + } + + FLUSH_DMA(); +} + +static void mga_dma_dispatch_indices( drm_device_t *dev, drm_buf_t *buf, + unsigned int start, unsigned int end ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + u32 address = (u32) buf->bus_address; + int i = 0; + DMA_LOCALS; + DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end ); + + if ( start != end ) { + buf_priv->dispatched = 1; + + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); + + do { + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + } + + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_SETUPADDRESS, address + start, + MGA_SETUPEND, ((address + end) | + MGA_PAGPXFER) ); + + ADVANCE_DMA(); + } while ( ++i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + AGE_BUFFER( buf_priv ); + buf->pending = 0; + buf->used = 0; + buf_priv->dispatched = 0; + + mga_freelist_put( dev, buf ); + } + + FLUSH_DMA(); +} + +/* This copies a 64 byte aligned agp region to the frambuffer with a + * standard blit, the ioctl needs to do checking. + */ +static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, + unsigned int dstorg, unsigned int length ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state; + u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM; + u32 y2; + DMA_LOCALS; + DRM_DEBUG( "buf=%d used=%d\n", buf->idx, buf->used ); + + y2 = length / 64; + + BEGIN_DMA( 5 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DSTORG, dstorg, + MGA_MACCESS, 0x00000000, + MGA_SRCORG, srcorg, + MGA_AR5, 64 ); + + DMA_BLOCK( MGA_PITCH, 64, + MGA_PLNWT, 0xffffffff, + MGA_DMAPAD, 0x00000000, + MGA_DWGCTL, MGA_DWGCTL_COPY ); + + DMA_BLOCK( MGA_AR0, 63, + MGA_AR3, 0, + MGA_FXBNDRY, (63 << 16) | 0, + MGA_YDSTLEN + MGA_EXEC, y2 ); + + DMA_BLOCK( MGA_PLNWT, ctx->plnwt, + MGA_SRCORG, dev_priv->front_offset, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGSYNC, 0x00007000 ); + + ADVANCE_DMA(); + + AGE_BUFFER( buf_priv ); + + buf->pending = 0; + buf->used = 0; + buf_priv->dispatched = 0; + + mga_freelist_put( dev, buf ); + + FLUSH_DMA(); +} + +static void mga_dma_dispatch_blit( drm_device_t *dev, + drm_mga_blit_t *blit ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + u32 scandir = 0, i; + DMA_LOCALS; + DRM_DEBUG( "\n" ); + + BEGIN_DMA( 4 + nbox ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DWGCTL, MGA_DWGCTL_COPY, + MGA_PLNWT, blit->planemask, + MGA_SRCORG, blit->srcorg, + MGA_DSTORG, blit->dstorg ); + + DMA_BLOCK( MGA_SGN, scandir, + MGA_MACCESS, dev_priv->maccess, + MGA_AR5, blit->ydir * blit->src_pitch, + MGA_PITCH, blit->dst_pitch ); + + for ( i = 0 ; i < nbox ; i++ ) { + int srcx = pbox[i].x1 + blit->delta_sx; + int srcy = pbox[i].y1 + blit->delta_sy; + int dstx = pbox[i].x1 + blit->delta_dx; + int dsty = pbox[i].y1 + blit->delta_dy; + int h = pbox[i].y2 - pbox[i].y1; + int w = pbox[i].x2 - pbox[i].x1 - 1; + int start; + + if ( blit->ydir == -1 ) { + srcy = blit->height - srcy - 1; + } + + start = srcy * blit->src_pitch + srcx; + + DMA_BLOCK( MGA_AR0, start + w, + MGA_AR3, start, + MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff), + MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h ); + } + + /* Do something to flush AGP? + */ + + /* Force reset of DWGCTL */ + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); +} + + +/* ================================================================ + * + */ + +int mga_dma_clear( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_clear_t clear; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( clear, (drm_mga_clear_t *)data, sizeof(clear) ); + + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_clear( dev, &clear ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + + return 0; +} + +int mga_dma_swap( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_swap( dev ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + + return 0; +} + +int mga_dma_vertex( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_vertex_t vertex; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( vertex, + (drm_mga_vertex_t *)data, + sizeof(vertex) ); + + if(vertex.idx < 0 || vertex.idx > dma->buf_count) return DRM_ERR(EINVAL); + buf = dma->buflist[vertex.idx]; + buf_priv = buf->dev_private; + + buf->used = vertex.used; + buf_priv->discard = vertex.discard; + + if ( !mga_verify_state( dev_priv ) ) { + if ( vertex.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); + buf_priv->dispatched = 0; + mga_freelist_put( dev, buf ); + } + return DRM_ERR(EINVAL); + } + + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_vertex( dev, buf ); + + return 0; +} + +int mga_dma_indices( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_indices_t indices; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( indices, + (drm_mga_indices_t *)data, + sizeof(indices) ); + + if(indices.idx < 0 || indices.idx > dma->buf_count) return DRM_ERR(EINVAL); + + buf = dma->buflist[indices.idx]; + buf_priv = buf->dev_private; + + buf_priv->discard = indices.discard; + + if ( !mga_verify_state( dev_priv ) ) { + if ( indices.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); + buf_priv->dispatched = 0; + mga_freelist_put( dev, buf ); + } + return DRM_ERR(EINVAL); + } + + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_indices( dev, buf, indices.start, indices.end ); + + return 0; +} + +int mga_dma_iload( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_iload_t iload; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( iload, (drm_mga_iload_t *)data, sizeof(iload) ); + +#if 0 + if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { + if ( MGA_DMA_DEBUG ) + DRM_INFO( "%s: -EBUSY\n", __FUNCTION__ ); + return DRM_ERR(EBUSY); + } +#endif + if(iload.idx < 0 || iload.idx > dma->buf_count) return DRM_ERR(EINVAL); + + buf = dma->buflist[iload.idx]; + buf_priv = buf->dev_private; + + if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { + mga_freelist_put( dev, buf ); + return DRM_ERR(EINVAL); + } + + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + + return 0; +} + +int mga_dma_blit( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_blit_t blit; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( blit, (drm_mga_blit_t *)data, sizeof(blit) ); + + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + + if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) ) + return DRM_ERR(EINVAL); + + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_blit( dev, &blit ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + + return 0; +} + +int mga_getparam( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_getparam_t param; + int value; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( param, (drm_mga_getparam_t *)data, + sizeof(param) ); + + DRM_DEBUG( "pid=%d\n", DRM_CURRENTPID ); + + switch( param.param ) { + case MGA_PARAM_IRQ_NR: + value = dev->irq; + break; + default: + return DRM_ERR(EINVAL); + } + + if ( DRM_COPY_TO_USER( param.value, &value, sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return DRM_ERR(EFAULT); + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_ucode.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_ucode.h:1.1 --- /dev/null Thu Feb 27 12:32:44 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_ucode.h Wed Oct 30 07:52:40 2002 @@ -0,0 +1,11645 @@ +/* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*- + * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com + * + * Copyright 1999 Matrox Graphics Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * MATROX GRAPHICS INC., OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Kernel-based WARP engine management: + * Gareth Hughes <gareth@valinux.com> + */ + +/* + * WARP pipes are named according to the functions they perform, where: + * + * - T stands for computation of texture stage 0 + * - T2 stands for computation of both texture stage 0 and texture stage 1 + * - G stands for computation of triangle intensity (Gouraud interpolation) + * - Z stands for computation of Z buffer interpolation + * - S stands for computation of specular highlight + * - A stands for computation of the alpha channel + * - F stands for computation of vertex fog interpolation + */ + +static unsigned char warp_g200_tgz[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x72, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x60, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x03, 0x80, 0x0A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x57, 0x39, 0x20, 0xE9, +0x28, 0x19, 0x60, 0xEC, + +0x2B, 0x32, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0xB3, 0x05, +0x00, 0xE0, +0x16, 0x28, 0x20, 0xE9, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x2B, 0x20, 0xE9, + +0x1C, 0x80, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x85, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x84, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x82, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x7F, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgza[] = { + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x7D, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x1F, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x3F, 0x3D, 0x5D, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x00, 0x80, 0x00, 0xE8, + +0x23, 0x3B, 0x33, 0xAD, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0x26, 0x1F, 0xDF, +0x9D, 0x1F, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x9E, 0x3F, 0x4F, 0xE9, + +0x07, 0x07, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x9C, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x7A, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x79, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x77, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x74, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzaf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x83, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6F, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x00, 0xE0, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0x17, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x2D, 0x20, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x1F, 0x62, 0x57, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x3F, 0x3D, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x17, 0x26, 0x17, 0xDF, + +0x23, 0x3B, 0x33, 0xAD, +0x35, 0x17, 0x4F, 0xE9, + +0x1F, 0x26, 0x1F, 0xDF, +0x9D, 0x1F, 0x4F, 0xE9, + +0x9E, 0x3F, 0x4F, 0xE9, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x07, 0x07, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x9C, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x74, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x73, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x71, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x6E, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x7F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x17, 0x50, 0x56, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x00, 0x80, 0x00, 0xE8, + +0x23, 0x3B, 0x33, 0xAD, +0x00, 0x80, 0x00, 0xE8, + +0x17, 0x26, 0x17, 0xDF, +0x35, 0x17, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x78, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x77, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x75, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x72, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzs[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8B, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x77, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x8F, 0x20, + +0xA5, 0x37, 0x4F, 0xE9, +0x0F, 0x17, 0x0F, 0xAF, + +0x06, 0xC0, 0x21, 0xC4, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x06, 0x06, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x6C, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x6B, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x69, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsa[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x7B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x44, 0x4C, 0xB6, +0x05, 0x44, 0x54, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x00, 0x80, 0x00, 0xE8, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2F, 0xC0, 0x44, 0xC6, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0x9D, 0x17, 0x4F, 0xE9, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x00, 0xE0, +0xAF, 0x20, + +0x9E, 0x37, 0x4F, 0xE9, +0x2F, 0x17, 0x2F, 0xAF, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x9C, 0x80, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x68, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x67, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x65, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsaf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x94, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x80, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x2D, 0x20, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x3E, 0x3D, 0x5D, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x2F, 0x20, +0x00, 0xE0, +0xA3, 0x0F, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0xA1, 0x1F, 0x4F, 0xE9, + +0x1E, 0x26, 0x1E, 0xDF, +0x9D, 0x1E, 0x4F, 0xE9, + +0x35, 0x17, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x07, 0x07, 0x1E, 0xAF, + +0xA0, 0x80, 0x4F, 0xE9, +0x9E, 0x3E, 0x4F, 0xE9, + +0x31, 0x80, 0x4F, 0xE9, +0x9C, 0x80, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x63, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x60, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x5D, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x7B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2F, 0x20, +0x00, 0xE0, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0x35, 0x17, 0x4F, 0xE9, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x68, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x67, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x65, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g400_t2gz[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x78, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x69, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x25, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9F, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBE, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x7D, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gza[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x7C, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x6D, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x29, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x74, 0xC6, +0x3D, 0xCF, 0x74, 0xC2, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9B, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBA, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x79, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzaf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x81, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x72, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x37, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x0F, 0xCF, 0x74, 0xC6, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x75, 0xC6, +0x00, 0x80, 0x00, 0xE8, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x45, 0x55, 0xB6, +0x02, 0x45, 0x65, 0xB6, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x96, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xB5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x74, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x7D, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x6E, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x39, 0xE5, 0x2C, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x88, 0x73, 0x5E, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0F, 0xCF, 0x75, 0xC6, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x28, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x45, 0x55, 0xB6, +0x1A, 0x45, 0x65, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9A, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBB, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x78, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzs[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x85, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x76, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x31, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x20, +0x1A, 0x20, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0xA7, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x92, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xB2, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x70, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsa[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8A, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7B, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x36, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x8D, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xAD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x6B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsaf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8E, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7F, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x3A, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x45, 0x55, 0xB6, +0x02, 0x45, 0x65, 0xB6, + +0x3D, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x89, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xA9, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x67, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8A, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7B, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x36, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB6, +0x1A, 0x45, 0x65, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x8D, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xAD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x6B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgz[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x58, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4A, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x1D, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAF, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD6, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x9D, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgza[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x5C, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4E, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x27, 0xCF, 0x74, 0xC6, +0x3D, 0xCF, 0x74, 0xC2, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x20, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAB, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD3, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x99, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzaf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x61, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x53, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x37, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x26, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x27, 0xCF, 0x74, 0xC6, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x75, 0xC6, +0x00, 0x80, 0x00, 0xE8, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x45, 0x4D, 0xB6, +0x02, 0x45, 0x55, 0xB6, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xA6, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xCD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x94, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x5D, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4F, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x39, 0xE5, 0x2C, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x88, 0x73, 0x5E, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x27, 0xCF, 0x75, 0xC6, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x20, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x45, 0x4D, 0xB6, +0x1A, 0x45, 0x55, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAA, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD3, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x98, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzs[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x65, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x57, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x29, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0xA7, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xA2, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xCA, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x90, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsa[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6A, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x5C, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x9D, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x8B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsaf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6E, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x60, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x32, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x45, 0x4D, 0xB6, +0x02, 0x45, 0x55, 0xB6, + +0x3D, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x99, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC1, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x87, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6A, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x5C, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB6, +0x1A, 0x45, 0x55, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x9D, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x8B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_warp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_warp.c:1.1 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/mga_warp.c Wed Oct 30 07:52:41 2002 @@ -0,0 +1,212 @@ +/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*- + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "mga.h" +#include "drmP.h" +#include "drm.h" +#include "mga_drm.h" +#include "mga_drv.h" +#include "mga_ucode.h" + + +#define MGA_WARP_CODE_ALIGN 256 /* in bytes */ + +#define WARP_UCODE_SIZE( which ) \ + ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN) + +#define WARP_UCODE_INSTALL( which, where ) \ +do { \ + DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\ + dev_priv->warp_pipe_phys[where] = pcbase; \ + memcpy( vcbase, which, sizeof(which) ); \ + pcbase += WARP_UCODE_SIZE( which ); \ + vcbase += WARP_UCODE_SIZE( which ); \ +} while (0) + + +static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv ) +{ + unsigned int size; + + size = ( WARP_UCODE_SIZE( warp_g400_tgz ) + + WARP_UCODE_SIZE( warp_g400_tgza ) + + WARP_UCODE_SIZE( warp_g400_tgzaf ) + + WARP_UCODE_SIZE( warp_g400_tgzf ) + + WARP_UCODE_SIZE( warp_g400_tgzs ) + + WARP_UCODE_SIZE( warp_g400_tgzsa ) + + WARP_UCODE_SIZE( warp_g400_tgzsaf ) + + WARP_UCODE_SIZE( warp_g400_tgzsf ) + + WARP_UCODE_SIZE( warp_g400_t2gz ) + + WARP_UCODE_SIZE( warp_g400_t2gza ) + + WARP_UCODE_SIZE( warp_g400_t2gzaf ) + + WARP_UCODE_SIZE( warp_g400_t2gzf ) + + WARP_UCODE_SIZE( warp_g400_t2gzs ) + + WARP_UCODE_SIZE( warp_g400_t2gzsa ) + + WARP_UCODE_SIZE( warp_g400_t2gzsaf ) + + WARP_UCODE_SIZE( warp_g400_t2gzsf ) ); + + size = PAGE_ALIGN( size ); + + DRM_DEBUG( "G400 ucode size = %d bytes\n", size ); + return size; +} + +static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv ) +{ + unsigned int size; + + size = ( WARP_UCODE_SIZE( warp_g200_tgz ) + + WARP_UCODE_SIZE( warp_g200_tgza ) + + WARP_UCODE_SIZE( warp_g200_tgzaf ) + + WARP_UCODE_SIZE( warp_g200_tgzf ) + + WARP_UCODE_SIZE( warp_g200_tgzs ) + + WARP_UCODE_SIZE( warp_g200_tgzsa ) + + WARP_UCODE_SIZE( warp_g200_tgzsaf ) + + WARP_UCODE_SIZE( warp_g200_tgzsf ) ); + + size = PAGE_ALIGN( size ); + + DRM_DEBUG( "G200 ucode size = %d bytes\n", size ); + return size; +} + +static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv ) +{ + unsigned char *vcbase = dev_priv->warp->handle; + unsigned long pcbase = dev_priv->warp->offset; + unsigned int size; + + size = mga_warp_g400_microcode_size( dev_priv ); + if ( size > dev_priv->warp->size ) { + DRM_ERROR( "microcode too large! (%u > %lu)\n", + size, dev_priv->warp->size ); + return DRM_ERR(ENOMEM); + } + + memset( dev_priv->warp_pipe_phys, 0, + sizeof(dev_priv->warp_pipe_phys) ); + + WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ ); + WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF ); + WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA ); + WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF ); + WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS ); + WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF ); + WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA ); + WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF ); + + WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ ); + WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF ); + WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA ); + WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF ); + WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS ); + WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF ); + WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA ); + WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF ); + + return 0; +} + +static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv ) +{ + unsigned char *vcbase = dev_priv->warp->handle; + unsigned long pcbase = dev_priv->warp->offset; + unsigned int size; + + size = mga_warp_g200_microcode_size( dev_priv ); + if ( size > dev_priv->warp->size ) { + DRM_ERROR( "microcode too large! (%u > %lu)\n", + size, dev_priv->warp->size ); + return DRM_ERR(ENOMEM); + } + + memset( dev_priv->warp_pipe_phys, 0, + sizeof(dev_priv->warp_pipe_phys) ); + + WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ ); + WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF ); + WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA ); + WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF ); + WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS ); + WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF ); + WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA ); + WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF ); + + return 0; +} + +int mga_warp_install_microcode( drm_mga_private_t *dev_priv ) +{ + switch ( dev_priv->chipset ) { + case MGA_CARD_TYPE_G400: + return mga_warp_install_g400_microcode( dev_priv ); + case MGA_CARD_TYPE_G200: + return mga_warp_install_g200_microcode( dev_priv ); + default: + return DRM_ERR(EINVAL); + } +} + +#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) + +int mga_warp_init( drm_mga_private_t *dev_priv ) +{ + u32 wmisc; + + /* FIXME: Get rid of these damned magic numbers... + */ + switch ( dev_priv->chipset ) { + case MGA_CARD_TYPE_G400: + MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND ); + MGA_WRITE( MGA_WGETMSB, 0x00000E00 ); + MGA_WRITE( MGA_WVRTXSZ, 0x00001807 ); + MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 ); + break; + case MGA_CARD_TYPE_G200: + MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND ); + MGA_WRITE( MGA_WGETMSB, 0x1606 ); + MGA_WRITE( MGA_WVRTXSZ, 7 ); + break; + default: + return DRM_ERR(EINVAL); + } + + MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE | + MGA_WMASTER_ENABLE | + MGA_WCACHEFLUSH_ENABLE) ); + wmisc = MGA_READ( MGA_WMISC ); + if ( wmisc != WMISC_EXPECTED ) { + DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n", + wmisc, WMISC_EXPECTED ); + return DRM_ERR(EINVAL); + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128.h:1.2 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128.h Mon Dec 16 11:19:32 2002 @@ -0,0 +1,114 @@ +/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __R128_H__ +#define __R128_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) r128_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 +#define __HAVE_SG 1 +#define __HAVE_PCI_DMA 1 + +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "r128" +#define DRIVER_DESC "ATI Rage 128" +#define DRIVER_DATE "20021029" + +#define DRIVER_MAJOR 2 +#define DRIVER_MINOR 3 +#define DRIVER_PATCHLEVEL 0 + + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_GETPARAM)] = { r128_getparam, 1, 0 }, + +/* Driver customization: + */ +#define DRIVER_PRERELEASE() do { \ + if ( dev->dev_private ) { \ + drm_r128_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv->page_flipping ) { \ + r128_do_cleanup_pageflip( dev ); \ + } \ + } \ +} while (0) + +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 +#define __HAVE_DMA_IRQ 1 +#define __HAVE_VBL_IRQ 1 +#define __HAVE_SHARED_IRQ 1 + +#if 0 +/* GH: Remove this for now... */ +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_r128_private_t *dev_priv = dev->dev_private; \ + return r128_do_cce_idle( dev_priv ); \ +} while (0) +#endif + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_r128_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_cce.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_cce.c:1.3 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_cce.c Mon Dec 16 11:19:32 2002 @@ -0,0 +1,1010 @@ +/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- + * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#include "r128.h" +#include "drmP.h" +#include "drm.h" +#include "r128_drm.h" +#include "r128_drv.h" + +#define R128_FIFO_DEBUG 0 + +/* CCE microcode (from ATI) */ +static u32 r128_cce_microcode[] = { + 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, + 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, + 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1, + 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11, + 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28, + 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, + 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, + 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, + 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071, + 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2, + 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1, + 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, + 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, + 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, + 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1, + 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82, + 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729, + 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008, + 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, + 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, + 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, + 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0, + 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370, + 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1, + 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793, + 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, + 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, + 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1, + 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1, + 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894, + 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14, + 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1, + 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, + 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, + 409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ); + +int R128_READ_PLL(drm_device_t *dev, int addr) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + + R128_WRITE8(R128_CLOCK_CNTL_INDEX, addr & 0x1f); + return R128_READ(R128_CLOCK_CNTL_DATA); +} + +#if R128_FIFO_DEBUG +static void r128_status( drm_r128_private_t *dev_priv ) +{ + printk( "GUI_STAT = 0x%08x\n", + (unsigned int)R128_READ( R128_GUI_STAT ) ); + printk( "PM4_STAT = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_STAT ) ); + printk( "PM4_BUFFER_DL_WPTR = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_DL_WPTR ) ); + printk( "PM4_BUFFER_DL_RPTR = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_DL_RPTR ) ); + printk( "PM4_MICRO_CNTL = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_MICRO_CNTL ) ); + printk( "PM4_BUFFER_CNTL = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_CNTL ) ); +} +#endif + + +/* ================================================================ + * Engine, FIFO control + */ + +static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) +{ + u32 tmp; + int i; + + tmp = R128_READ( R128_PC_NGUI_CTLSTAT ) | R128_PC_FLUSH_ALL; + R128_WRITE( R128_PC_NGUI_CTLSTAT, tmp ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(R128_READ( R128_PC_NGUI_CTLSTAT ) & R128_PC_BUSY) ) { + return 0; + } + DRM_UDELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); +#endif + return DRM_ERR(EBUSY); +} + +static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + int slots = R128_READ( R128_GUI_STAT ) & R128_GUI_FIFOCNT_MASK; + if ( slots >= entries ) return 0; + DRM_UDELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); +#endif + return DRM_ERR(EBUSY); +} + +int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) +{ + int i, ret; + + ret = r128_do_wait_for_fifo( dev_priv, 64 ); + if ( ret ) return ret; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { + r128_do_pixcache_flush( dev_priv ); + return 0; + } + DRM_UDELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); +#endif + return DRM_ERR(EBUSY); +} + + +/* ================================================================ + * CCE control, initialization + */ + +/* Load the microcode for the CCE */ +static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) +{ + int i; + + DRM_DEBUG( "\n" ); + + r128_do_wait_for_idle( dev_priv ); + + R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); + for ( i = 0 ; i < 256 ; i++ ) { + R128_WRITE( R128_PM4_MICROCODE_DATAH, + r128_cce_microcode[i * 2] ); + R128_WRITE( R128_PM4_MICROCODE_DATAL, + r128_cce_microcode[i * 2 + 1] ); + } +} + +/* Flush any pending commands to the CCE. This should only be used just + * prior to a wait for idle, as it informs the engine that the command + * stream is ending. + */ +static void r128_do_cce_flush( drm_r128_private_t *dev_priv ) +{ + u32 tmp; + + tmp = R128_READ( R128_PM4_BUFFER_DL_WPTR ) | R128_PM4_BUFFER_DL_DONE; + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, tmp ); +} + +/* Wait for the CCE to go idle. + */ +int r128_do_cce_idle( drm_r128_private_t *dev_priv ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( GET_RING_HEAD( &dev_priv->ring ) == dev_priv->ring.tail ) { + int pm4stat = R128_READ( R128_PM4_STAT ); + if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= + dev_priv->cce_fifo_size ) && + !(pm4stat & (R128_PM4_BUSY | + R128_PM4_GUI_ACTIVE)) ) { + return r128_do_pixcache_flush( dev_priv ); + } + } + DRM_UDELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + r128_status( dev_priv ); +#endif + return DRM_ERR(EBUSY); +} + +/* Start the Concurrent Command Engine. + */ +static void r128_do_cce_start( drm_r128_private_t *dev_priv ) +{ + r128_do_wait_for_idle( dev_priv ); + + R128_WRITE( R128_PM4_BUFFER_CNTL, + dev_priv->cce_mode | dev_priv->ring.size_l2qw ); + R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ + R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); + + dev_priv->cce_running = 1; +} + +/* Reset the Concurrent Command Engine. This will not flush any pending + * commands, so you must wait for the CCE command stream to complete + * before calling this routine. + */ +static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) +{ + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); + R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); + SET_RING_HEAD( &dev_priv->ring, 0 ); + dev_priv->ring.tail = 0; +} + +/* Stop the Concurrent Command Engine. This will not flush any pending + * commands, so you must flush the command stream and wait for the CCE + * to go idle before calling this routine. + */ +static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) +{ + R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); + R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 ); + + dev_priv->cce_running = 0; +} + +/* Reset the engine. This will stop the CCE if it is running. + */ +static int r128_do_engine_reset( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; + + r128_do_pixcache_flush( dev_priv ); + + clock_cntl_index = R128_READ( R128_CLOCK_CNTL_INDEX ); + mclk_cntl = R128_READ_PLL( dev, R128_MCLK_CNTL ); + + R128_WRITE_PLL( R128_MCLK_CNTL, + mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP ); + + gen_reset_cntl = R128_READ( R128_GEN_RESET_CNTL ); + + /* Taken from the sample code - do not change */ + R128_WRITE( R128_GEN_RESET_CNTL, + gen_reset_cntl | R128_SOFT_RESET_GUI ); + R128_READ( R128_GEN_RESET_CNTL ); + R128_WRITE( R128_GEN_RESET_CNTL, + gen_reset_cntl & ~R128_SOFT_RESET_GUI ); + R128_READ( R128_GEN_RESET_CNTL ); + + R128_WRITE_PLL( R128_MCLK_CNTL, mclk_cntl ); + R128_WRITE( R128_CLOCK_CNTL_INDEX, clock_cntl_index ); + R128_WRITE( R128_GEN_RESET_CNTL, gen_reset_cntl ); + + /* Reset the CCE ring */ + r128_do_cce_reset( dev_priv ); + + /* The CCE is no longer running after an engine reset */ + dev_priv->cce_running = 0; + + /* Reset any pending vertex, indirect buffers */ + r128_freelist_reset( dev ); + + return 0; +} + +static void r128_cce_init_ring_buffer( drm_device_t *dev, + drm_r128_private_t *dev_priv ) +{ + u32 ring_start; + u32 tmp; + + DRM_DEBUG( "\n" ); + + /* The manual (p. 2) says this address is in "VM space". This + * means it's an offset from the start of AGP space. + */ +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + ring_start = dev_priv->cce_ring->offset - dev->agp->base; + else +#endif + ring_start = dev_priv->cce_ring->offset - dev->sg->handle; + + R128_WRITE( R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET ); + + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); + R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); + + /* DL_RPTR_ADDR is a physical address in AGP space. */ + SET_RING_HEAD( &dev_priv->ring, 0 ); + + if ( !dev_priv->is_pci ) { + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + } else { + drm_sg_mem_t *entry = dev->sg; + unsigned long tmp_ofs, page_ofs; + + tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; + page_ofs = tmp_ofs >> PAGE_SHIFT; + + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + entry->busaddr[page_ofs]); + DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", + entry->busaddr[page_ofs], + entry->handle + tmp_ofs ); + } + + /* Set watermark control */ + R128_WRITE( R128_PM4_BUFFER_WM_CNTL, + ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) + | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) + | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) + | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT) ); + + /* Force read. Why? Because it's in the examples... */ + R128_READ( R128_PM4_BUFFER_ADDR ); + + /* Turn on bus mastering */ + tmp = R128_READ( R128_BUS_CNTL ) & ~R128_BUS_MASTER_DIS; + R128_WRITE( R128_BUS_CNTL, tmp ); +} + +static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) +{ + drm_r128_private_t *dev_priv; + + DRM_DEBUG( "\n" ); + + dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); + if ( dev_priv == NULL ) + return DRM_ERR(ENOMEM); + + memset( dev_priv, 0, sizeof(drm_r128_private_t) ); + + dev_priv->is_pci = init->is_pci; + + if ( dev_priv->is_pci && !dev->sg ) { + DRM_ERROR( "PCI GART memory not allocated!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + + dev_priv->usec_timeout = init->usec_timeout; + if ( dev_priv->usec_timeout < 1 || + dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { + DRM_DEBUG( "TIMEOUT problem!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + + dev_priv->cce_mode = init->cce_mode; + + /* GH: Simple idle check. + */ + atomic_set( &dev_priv->idle_count, 0 ); + + /* We don't support anything other than bus-mastering ring mode, + * but the ring can be in either AGP or PCI space for the ring + * read pointer. + */ + if ( ( init->cce_mode != R128_PM4_192BM ) && + ( init->cce_mode != R128_PM4_128BM_64INDBM ) && + ( init->cce_mode != R128_PM4_64BM_128INDBM ) && + ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { + DRM_DEBUG( "Bad cce_mode!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + + switch ( init->cce_mode ) { + case R128_PM4_NONPM4: + dev_priv->cce_fifo_size = 0; + break; + case R128_PM4_192PIO: + case R128_PM4_192BM: + dev_priv->cce_fifo_size = 192; + break; + case R128_PM4_128PIO_64INDBM: + case R128_PM4_128BM_64INDBM: + dev_priv->cce_fifo_size = 128; + break; + case R128_PM4_64PIO_128INDBM: + case R128_PM4_64BM_128INDBM: + case R128_PM4_64PIO_64VCBM_64INDBM: + case R128_PM4_64BM_64VCBM_64INDBM: + case R128_PM4_64PIO_64VCPIO_64INDPIO: + dev_priv->cce_fifo_size = 64; + break; + } + + switch ( init->fb_bpp ) { + case 16: + dev_priv->color_fmt = R128_DATATYPE_RGB565; + break; + case 32: + default: + dev_priv->color_fmt = R128_DATATYPE_ARGB8888; + break; + } + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; + + switch ( init->depth_bpp ) { + case 16: + dev_priv->depth_fmt = R128_DATATYPE_RGB565; + break; + case 24: + case 32: + default: + dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; + break; + } + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; + dev_priv->span_offset = init->span_offset; + + dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch/8) << 21) | + (dev_priv->front_offset >> 5)); + dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch/8) << 21) | + (dev_priv->back_offset >> 5)); + dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | + (dev_priv->depth_offset >> 5) | + R128_DST_TILE); + dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | + (dev_priv->span_offset >> 5)); + + DRM_GETSAREA(); + + if(!dev_priv->sarea) { + DRM_ERROR("could not find sarea!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR("could not find framebuffer!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR("could not find mmio region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); + if(!dev_priv->cce_ring) { + DRM_ERROR("could not find cce ring region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + if(!dev_priv->ring_rptr) { + DRM_ERROR("could not find ring read pointer!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR("could not find dma buffer region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + + if ( !dev_priv->is_pci ) { + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); + if(!dev_priv->agp_textures) { + DRM_ERROR("could not find agp texture region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(EINVAL); + } + } + + dev_priv->sarea_priv = + (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + if ( !dev_priv->is_pci ) { + DRM_IOREMAP( dev_priv->cce_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); + if(!dev_priv->cce_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { + DRM_ERROR("Could not ioremap agp regions!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(ENOMEM); + } + } else { + dev_priv->cce_ring->handle = + (void *)dev_priv->cce_ring->offset; + dev_priv->ring_rptr->handle = + (void *)dev_priv->ring_rptr->offset; + dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; + } + +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + dev_priv->cce_buffers_offset = dev->agp->base; + else +#endif + dev_priv->cce_buffers_offset = dev->sg->handle; + + dev_priv->ring.head = ((__volatile__ u32 *) + dev_priv->ring_rptr->handle); + + dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; + dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle + + init->ring_size / sizeof(u32)); + dev_priv->ring.size = init->ring_size; + dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); + + dev_priv->ring.tail_mask = + (dev_priv->ring.size / sizeof(u32)) - 1; + + dev_priv->ring.high_mark = 128; + + dev_priv->sarea_priv->last_frame = 0; + R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); + + dev_priv->sarea_priv->last_dispatch = 0; + R128_WRITE( R128_LAST_DISPATCH_REG, + dev_priv->sarea_priv->last_dispatch ); + +#if __REALLY_HAVE_SG + if ( dev_priv->is_pci ) { + if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + &dev_priv->bus_pci_gart) ) { + DRM_ERROR( "failed to init PCI GART!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return DRM_ERR(ENOMEM); + } + R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); + } +#endif + + r128_cce_init_ring_buffer( dev, dev_priv ); + r128_cce_load_microcode( dev_priv ); + + dev->dev_private = (void *)dev_priv; + + r128_do_engine_reset( dev ); + + return 0; +} + +int r128_do_cleanup_cce( drm_device_t *dev ) +{ + if ( dev->dev_private ) { + drm_r128_private_t *dev_priv = dev->dev_private; + +#if __REALLY_HAVE_SG + if ( !dev_priv->is_pci ) { +#endif + DRM_IOREMAPFREE( dev_priv->cce_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); +#if __REALLY_HAVE_SG + } else { + if (!DRM(ati_pcigart_cleanup)( dev, + dev_priv->phys_pci_gart, + dev_priv->bus_pci_gart )) + DRM_ERROR( "failed to cleanup PCI GART!\n" ); + } +#endif + + DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int r128_cce_init( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_init_t init; + + DRM_DEBUG( "\n" ); + + DRM_COPY_FROM_USER_IOCTL( init, (drm_r128_init_t *)data, sizeof(init) ); + + switch ( init.func ) { + case R128_INIT_CCE: + return r128_do_init_cce( dev, &init ); + case R128_CLEANUP_CCE: + return r128_do_cleanup_cce( dev ); + } + + return DRM_ERR(EINVAL); +} + +int r128_cce_start( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { + DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); + return 0; + } + + r128_do_cce_start( dev_priv ); + + return 0; +} + +/* Stop the CCE. The engine must have been idled before calling this + * routine. + */ +int r128_cce_stop( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_cce_stop_t stop; + int ret; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t *)data, sizeof(stop) ); + + /* Flush any pending CCE commands. This ensures any outstanding + * commands are exectuted by the engine before we turn it off. + */ + if ( stop.flush ) { + r128_do_cce_flush( dev_priv ); + } + + /* If we fail to make the engine go idle, we return an error + * code so that the DRM ioctl wrapper can try again. + */ + if ( stop.idle ) { + ret = r128_do_cce_idle( dev_priv ); + if ( ret ) return ret; + } + + /* Finally, we can turn off the CCE. If the engine isn't idle, + * we will get some dropped triangles as they won't be fully + * rendered before the CCE is shut down. + */ + r128_do_cce_stop( dev_priv ); + + /* Reset the engine */ + r128_do_engine_reset( dev ); + + return 0; +} + +/* Just reset the CCE ring. Called as part of an X Server engine reset. + */ +int r128_cce_reset( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + r128_do_cce_reset( dev_priv ); + + /* The CCE is no longer running after an engine reset */ + dev_priv->cce_running = 0; + + return 0; +} + +int r128_cce_idle( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( dev_priv->cce_running ) { + r128_do_cce_flush( dev_priv ); + } + + return r128_do_cce_idle( dev_priv ); +} + +int r128_engine_reset( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + return r128_do_engine_reset( dev ); +} + + +/* ================================================================ + * Fullscreen mode + */ + +static int r128_do_init_pageflip( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + dev_priv->crtc_offset = R128_READ( R128_CRTC_OFFSET ); + dev_priv->crtc_offset_cntl = R128_READ( R128_CRTC_OFFSET_CNTL ); + + R128_WRITE( R128_CRTC_OFFSET, dev_priv->front_offset ); + R128_WRITE( R128_CRTC_OFFSET_CNTL, + dev_priv->crtc_offset_cntl | R128_CRTC_OFFSET_FLIP_CNTL ); + + dev_priv->page_flipping = 1; + dev_priv->current_page = 0; + + return 0; +} + +int r128_do_cleanup_pageflip( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + R128_WRITE( R128_CRTC_OFFSET, dev_priv->crtc_offset ); + R128_WRITE( R128_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); + + dev_priv->page_flipping = 0; + dev_priv->current_page = 0; + + return 0; +} + +int r128_fullscreen( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_fullscreen_t fs; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( fs, (drm_r128_fullscreen_t *)data, sizeof(fs) ); + + switch ( fs.func ) { + case R128_INIT_FULLSCREEN: + return r128_do_init_pageflip( dev ); + case R128_CLEANUP_FULLSCREEN: + return r128_do_cleanup_pageflip( dev ); + } + + return DRM_ERR(EINVAL); +} + + +/* ================================================================ + * Freelist management + */ +#define R128_BUFFER_USED 0xffffffff +#define R128_BUFFER_FREE 0 + +#if 0 +static int r128_freelist_init( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_freelist_t *entry; + int i; + + dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + return DRM_ERR(ENOMEM); + + memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) ); + dev_priv->head->age = R128_BUFFER_USED; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + + entry = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); + if ( !entry ) return DRM_ERR(ENOMEM); + + entry->age = R128_BUFFER_FREE; + entry->buf = buf; + entry->prev = dev_priv->head; + entry->next = dev_priv->head->next; + if ( !entry->next ) + dev_priv->tail = entry; + + buf_priv->discard = 0; + buf_priv->dispatched = 0; + buf_priv->list_entry = entry; + + dev_priv->head->next = entry; + + if ( dev_priv->head->next ) + dev_priv->head->next->prev = entry; + } + + return 0; + +} +#endif + +drm_buf_t *r128_freelist_get( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv; + drm_buf_t *buf; + int i, t; + + /* FIXME: Optimize -- use freelist code */ + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pid == 0 ) + return buf; + } + + for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { + u32 done_age = R128_READ( R128_LAST_DISPATCH_REG ); + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pending && buf_priv->age <= done_age ) { + /* The buffer has been processed, so it + * can now be used. + */ + buf->pending = 0; + return buf; + } + } + DRM_UDELAY( 1 ); + } + + DRM_ERROR( "returning NULL!\n" ); + return NULL; +} + +void r128_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + drm_buf_t *buf = dma->buflist[i]; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + buf_priv->age = 0; + } +} + + +/* ================================================================ + * CCE command submission + */ + +int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) +{ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + r128_update_ring_snapshot( ring ); + if ( ring->space >= n ) + return 0; + DRM_UDELAY( 1 ); + } + + /* FIXME: This is being ignored... */ + DRM_ERROR( "failed!\n" ); + return DRM_ERR(EBUSY); +} + +static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + int i; + drm_buf_t *buf; + + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = r128_freelist_get( dev ); + if ( !buf ) return DRM_ERR(EAGAIN); + + buf->pid = DRM_CURRENTPID; + + if ( DRM_COPY_TO_USER( &d->request_indices[i], &buf->idx, + sizeof(buf->idx) ) ) + return DRM_ERR(EFAULT); + if ( DRM_COPY_TO_USER( &d->request_sizes[i], &buf->total, + sizeof(buf->total) ) ) + return DRM_ERR(EFAULT); + + d->granted_count++; + } + return 0; +} + +int r128_cce_buffers( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_device_dma_t *dma = dev->dma; + int ret = 0; + drm_dma_t d; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( d, (drm_dma_t *) data, sizeof(d) ); + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + DRM_CURRENTPID, d.send_count ); + return DRM_ERR(EINVAL); + } + + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + DRM_CURRENTPID, d.request_count, dma->buf_count ); + return DRM_ERR(EINVAL); + } + + d.granted_count = 0; + + if ( d.request_count ) { + ret = r128_cce_get_buffers( dev, &d ); + } + + DRM_COPY_TO_USER_IOCTL((drm_dma_t *) data, d, sizeof(d) ); + + return ret; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_drm.h:1.2 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_drm.h Mon Dec 16 11:19:32 2002 @@ -0,0 +1,319 @@ +/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- + * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + */ + +#ifndef __R128_DRM_H__ +#define __R128_DRM_H__ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the X server file (r128_sarea.h) + */ +#ifndef __R128_SAREA_DEFINES__ +#define __R128_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define R128_UPLOAD_CONTEXT 0x001 +#define R128_UPLOAD_SETUP 0x002 +#define R128_UPLOAD_TEX0 0x004 +#define R128_UPLOAD_TEX1 0x008 +#define R128_UPLOAD_TEX0IMAGES 0x010 +#define R128_UPLOAD_TEX1IMAGES 0x020 +#define R128_UPLOAD_CORE 0x040 +#define R128_UPLOAD_MASKS 0x080 +#define R128_UPLOAD_WINDOW 0x100 +#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ +#define R128_REQUIRE_QUIESCENCE 0x400 +#define R128_UPLOAD_ALL 0x7ff + +#define R128_FRONT 0x1 +#define R128_BACK 0x2 +#define R128_DEPTH 0x4 + +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define R128_BUFFER_SIZE 16384 + +/* Byte offsets for indirect buffer data + */ +#define R128_INDEX_PRIM_OFFSET 20 +#define R128_HOSTDATA_BLIT_OFFSET 32 + +/* Keep these small for testing. + */ +#define R128_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define R128_LOCAL_TEX_HEAP 0 +#define R128_AGP_TEX_HEAP 1 +#define R128_NR_TEX_HEAPS 2 +#define R128_NR_TEX_REGIONS 64 +#define R128_LOG_TEX_GRANULARITY 16 + +#define R128_NR_CONTEXT_REGS 12 + +#define R128_MAX_TEXTURE_LEVELS 11 +#define R128_MAX_TEXTURE_UNITS 2 + +#endif /* __R128_SAREA_DEFINES__ */ + +typedef struct { + /* Context state - can be written in one large chunk */ + unsigned int dst_pitch_offset_c; + unsigned int dp_gui_master_cntl_c; + unsigned int sc_top_left_c; + unsigned int sc_bottom_right_c; + unsigned int z_offset_c; + unsigned int z_pitch_c; + unsigned int z_sten_cntl_c; + unsigned int tex_cntl_c; + unsigned int misc_3d_state_cntl_reg; + unsigned int texture_clr_cmp_clr_c; + unsigned int texture_clr_cmp_msk_c; + unsigned int fog_color_c; + + /* Texture state */ + unsigned int tex_size_pitch_c; + unsigned int constant_color_c; + + /* Setup state */ + unsigned int pm4_vc_fpu_setup; + unsigned int setup_cntl; + + /* Mask state */ + unsigned int dp_write_mask; + unsigned int sten_ref_mask_c; + unsigned int plane_3d_mask_c; + + /* Window state */ + unsigned int window_xy_offset; + + /* Core state */ + unsigned int scale_3d_cntl; +} drm_r128_context_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int tex_cntl; + unsigned int tex_combine_cntl; + unsigned int tex_size_pitch; + unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; + unsigned int tex_border_color; +} drm_r128_texture_regs_t; + + +typedef struct drm_r128_sarea { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + drm_r128_context_regs_t context_state; + drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + + drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; + int tex_age[R128_NR_TEX_HEAPS]; + int ctx_owner; +} drm_r128_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmR128.h) + */ + +/* Rage 128 specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) +#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) +#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) +#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) +#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) +#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) +#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) +#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) +#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) +#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) +#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) +#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) +#define DRM_IOCTL_R128_CLEAR2 DRM_IOW( 0x51, drm_r128_clear2_t) +#define DRM_IOCTL_R128_GETPARAM DRM_IOW( 0x52, drm_r128_getparam_t) + +typedef struct drm_r128_init { + enum { + R128_INIT_CCE = 0x01, + R128_CLEANUP_CCE = 0x02 + } func; +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) + int sarea_priv_offset; +#else + unsigned long sarea_priv_offset; +#endif + int is_pci; + int cce_mode; + int cce_secure; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) + unsigned int fb_offset; + unsigned int mmio_offset; + unsigned int ring_offset; + unsigned int ring_rptr_offset; + unsigned int buffers_offset; + unsigned int agp_textures_offset; +#else + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +#endif +} drm_r128_init_t; + +typedef struct drm_r128_cce_stop { + int flush; + int idle; +} drm_r128_cce_stop_t; + +typedef struct drm_r128_clear { + unsigned int flags; +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) + int x, y, w, h; +#endif + unsigned int clear_color; + unsigned int clear_depth; +#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) + unsigned int color_mask; + unsigned int depth_mask; +#endif +} drm_r128_clear_t; + +typedef struct drm_r128_vertex { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drm_r128_vertex_t; + +typedef struct drm_r128_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_r128_indices_t; + +typedef struct drm_r128_blit { + int idx; + int pitch; + int offset; + int format; + unsigned short x, y; + unsigned short width, height; +} drm_r128_blit_t; + +typedef struct drm_r128_depth { + enum { + R128_WRITE_SPAN = 0x01, + R128_WRITE_PIXELS = 0x02, + R128_READ_SPAN = 0x03, + R128_READ_PIXELS = 0x04 + } func; + int n; + int *x; + int *y; + unsigned int *buffer; + unsigned char *mask; +} drm_r128_depth_t; + +typedef struct drm_r128_stipple { + unsigned int *mask; +} drm_r128_stipple_t; + +typedef struct drm_r128_indirect { + int idx; + int start; + int end; + int discard; +} drm_r128_indirect_t; + +typedef struct drm_r128_fullscreen { + enum { + R128_INIT_FULLSCREEN = 0x01, + R128_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_r128_fullscreen_t; + +/* 2.3: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define R128_PARAM_IRQ_NR 1 + +typedef struct drm_r128_getparam { + int param; + int *value; +} drm_r128_getparam_t; + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_drv.h:1.3 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_drv.h Mon Dec 16 11:19:33 2002 @@ -0,0 +1,510 @@ +/* r128_drv.h -- Private header for r128 driver -*- linux-c -*- + * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Michel Dänzer <daenzerm@student.ethz.ch> + */ + +#ifndef __R128_DRV_H__ +#define __R128_DRV_H__ + +#define GET_RING_HEAD(ring) DRM_READ32( (volatile u32 *) (ring)->head ) +#define SET_RING_HEAD(ring,val) DRM_WRITE32( (volatile u32 *) (ring)->head, (val) ) + +typedef struct drm_r128_freelist { + unsigned int age; + drm_buf_t *buf; + struct drm_r128_freelist *next; + struct drm_r128_freelist *prev; +} drm_r128_freelist_t; + +typedef struct drm_r128_ring_buffer { + u32 *start; + u32 *end; + int size; + int size_l2qw; + + volatile u32 *head; + u32 tail; + u32 tail_mask; + int space; + + int high_mark; +} drm_r128_ring_buffer_t; + +typedef struct drm_r128_private { + drm_r128_ring_buffer_t ring; + drm_r128_sarea_t *sarea_priv; + + int cce_mode; + int cce_fifo_size; + int cce_running; + + drm_r128_freelist_t *head; + drm_r128_freelist_t *tail; + + int usec_timeout; + int is_pci; + unsigned long phys_pci_gart; + dma_addr_t bus_pci_gart; + unsigned long cce_buffers_offset; + + atomic_t idle_count; + + int page_flipping; + int current_page; + u32 crtc_offset; + u32 crtc_offset_cntl; + + u32 color_fmt; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + u32 depth_fmt; + unsigned int depth_offset; + unsigned int depth_pitch; + unsigned int span_offset; + + u32 front_pitch_offset_c; + u32 back_pitch_offset_c; + u32 depth_pitch_offset_c; + u32 span_pitch_offset_c; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *cce_ring; + drm_map_t *ring_rptr; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_r128_private_t; + +typedef struct drm_r128_buf_priv { + u32 age; + int prim; + int discard; + int dispatched; + drm_r128_freelist_t *list_entry; +} drm_r128_buf_priv_t; + + /* r128_cce.c */ +extern int r128_cce_init( DRM_IOCTL_ARGS ); +extern int r128_cce_start( DRM_IOCTL_ARGS ); +extern int r128_cce_stop( DRM_IOCTL_ARGS ); +extern int r128_cce_reset( DRM_IOCTL_ARGS ); +extern int r128_cce_idle( DRM_IOCTL_ARGS ); +extern int r128_engine_reset( DRM_IOCTL_ARGS ); +extern int r128_fullscreen( DRM_IOCTL_ARGS ); +extern int r128_cce_buffers( DRM_IOCTL_ARGS ); +extern int r128_getparam( DRM_IOCTL_ARGS ); + +extern void r128_freelist_reset( drm_device_t *dev ); +extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); + +extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); + +static __inline__ void +r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) +{ + ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} + +extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); +extern int r128_do_cleanup_cce( drm_device_t *dev ); +extern int r128_do_cleanup_pageflip( drm_device_t *dev ); + + /* r128_state.c */ +extern int r128_cce_clear( DRM_IOCTL_ARGS ); +extern int r128_cce_swap( DRM_IOCTL_ARGS ); +extern int r128_cce_vertex( DRM_IOCTL_ARGS ); +extern int r128_cce_indices( DRM_IOCTL_ARGS ); +extern int r128_cce_blit( DRM_IOCTL_ARGS ); +extern int r128_cce_depth( DRM_IOCTL_ARGS ); +extern int r128_cce_stipple( DRM_IOCTL_ARGS ); +extern int r128_cce_indirect( DRM_IOCTL_ARGS ); + + +/* Register definitions, register access macros and drmAddMap constants + * for Rage 128 kernel driver. + */ + +#define R128_AUX_SC_CNTL 0x1660 +# define R128_AUX1_SC_EN (1 << 0) +# define R128_AUX1_SC_MODE_OR (0 << 1) +# define R128_AUX1_SC_MODE_NAND (1 << 1) +# define R128_AUX2_SC_EN (1 << 2) +# define R128_AUX2_SC_MODE_OR (0 << 3) +# define R128_AUX2_SC_MODE_NAND (1 << 3) +# define R128_AUX3_SC_EN (1 << 4) +# define R128_AUX3_SC_MODE_OR (0 << 5) +# define R128_AUX3_SC_MODE_NAND (1 << 5) +#define R128_AUX1_SC_LEFT 0x1664 +#define R128_AUX1_SC_RIGHT 0x1668 +#define R128_AUX1_SC_TOP 0x166c +#define R128_AUX1_SC_BOTTOM 0x1670 +#define R128_AUX2_SC_LEFT 0x1674 +#define R128_AUX2_SC_RIGHT 0x1678 +#define R128_AUX2_SC_TOP 0x167c +#define R128_AUX2_SC_BOTTOM 0x1680 +#define R128_AUX3_SC_LEFT 0x1684 +#define R128_AUX3_SC_RIGHT 0x1688 +#define R128_AUX3_SC_TOP 0x168c +#define R128_AUX3_SC_BOTTOM 0x1690 + +#define R128_BRUSH_DATA0 0x1480 +#define R128_BUS_CNTL 0x0030 +# define R128_BUS_MASTER_DIS (1 << 6) + +#define R128_CLOCK_CNTL_INDEX 0x0008 +#define R128_CLOCK_CNTL_DATA 0x000c +# define R128_PLL_WR_EN (1 << 7) +#define R128_CONSTANT_COLOR_C 0x1d34 +#define R128_CRTC_OFFSET 0x0224 +#define R128_CRTC_OFFSET_CNTL 0x0228 +# define R128_CRTC_OFFSET_FLIP_CNTL (1 << 16) + +#define R128_DP_GUI_MASTER_CNTL 0x146c +# define R128_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define R128_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define R128_GMC_BRUSH_NONE (15 << 4) +# define R128_GMC_DST_16BPP (4 << 8) +# define R128_GMC_DST_24BPP (5 << 8) +# define R128_GMC_DST_32BPP (6 << 8) +# define R128_GMC_DST_DATATYPE_SHIFT 8 +# define R128_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define R128_DP_SRC_SOURCE_MEMORY (2 << 24) +# define R128_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define R128_GMC_AUX_CLIP_DIS (1 << 29) +# define R128_GMC_WR_MSK_DIS (1 << 30) +# define R128_ROP3_S 0x00cc0000 +# define R128_ROP3_P 0x00f00000 +#define R128_DP_WRITE_MASK 0x16cc +#define R128_DST_PITCH_OFFSET_C 0x1c80 +# define R128_DST_TILE (1 << 31) + +#define R128_GEN_INT_CNTL 0x0040 +# define R128_CRTC_VBLANK_INT_EN (1 << 0) +#define R128_GEN_INT_STATUS 0x0044 +# define R128_CRTC_VBLANK_INT (1 << 0) +# define R128_CRTC_VBLANK_INT_AK (1 << 0) +#define R128_GEN_RESET_CNTL 0x00f0 +# define R128_SOFT_RESET_GUI (1 << 0) + +#define R128_GUI_SCRATCH_REG0 0x15e0 +#define R128_GUI_SCRATCH_REG1 0x15e4 +#define R128_GUI_SCRATCH_REG2 0x15e8 +#define R128_GUI_SCRATCH_REG3 0x15ec +#define R128_GUI_SCRATCH_REG4 0x15f0 +#define R128_GUI_SCRATCH_REG5 0x15f4 + +#define R128_GUI_STAT 0x1740 +# define R128_GUI_FIFOCNT_MASK 0x0fff +# define R128_GUI_ACTIVE (1 << 31) + +#define R128_MCLK_CNTL 0x000f +# define R128_FORCE_GCP (1 << 16) +# define R128_FORCE_PIPE3D_CP (1 << 17) +# define R128_FORCE_RCP (1 << 18) + +#define R128_PC_GUI_CTLSTAT 0x1748 +#define R128_PC_NGUI_CTLSTAT 0x0184 +# define R128_PC_FLUSH_GUI (3 << 0) +# define R128_PC_RI_GUI (1 << 2) +# define R128_PC_FLUSH_ALL 0x00ff +# define R128_PC_BUSY (1 << 31) + +#define R128_PCI_GART_PAGE 0x017c +#define R128_PRIM_TEX_CNTL_C 0x1cb0 + +#define R128_SCALE_3D_CNTL 0x1a00 +#define R128_SEC_TEX_CNTL_C 0x1d00 +#define R128_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c +#define R128_SETUP_CNTL 0x1bc4 +#define R128_STEN_REF_MASK_C 0x1d40 + +#define R128_TEX_CNTL_C 0x1c9c +# define R128_TEX_CACHE_FLUSH (1 << 23) + +#define R128_WAIT_UNTIL 0x1720 +# define R128_EVENT_CRTC_OFFSET (1 << 0) +#define R128_WINDOW_XY_OFFSET 0x1bcc + + +/* CCE registers + */ +#define R128_PM4_BUFFER_OFFSET 0x0700 +#define R128_PM4_BUFFER_CNTL 0x0704 +# define R128_PM4_MASK (15 << 28) +# define R128_PM4_NONPM4 (0 << 28) +# define R128_PM4_192PIO (1 << 28) +# define R128_PM4_192BM (2 << 28) +# define R128_PM4_128PIO_64INDBM (3 << 28) +# define R128_PM4_128BM_64INDBM (4 << 28) +# define R128_PM4_64PIO_128INDBM (5 << 28) +# define R128_PM4_64BM_128INDBM (6 << 28) +# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) + +#define R128_PM4_BUFFER_WM_CNTL 0x0708 +# define R128_WMA_SHIFT 0 +# define R128_WMB_SHIFT 8 +# define R128_WMC_SHIFT 16 +# define R128_WB_WM_SHIFT 24 + +#define R128_PM4_BUFFER_DL_RPTR_ADDR 0x070c +#define R128_PM4_BUFFER_DL_RPTR 0x0710 +#define R128_PM4_BUFFER_DL_WPTR 0x0714 +# define R128_PM4_BUFFER_DL_DONE (1 << 31) + +#define R128_PM4_VC_FPU_SETUP 0x071c + +#define R128_PM4_IW_INDOFF 0x0738 +#define R128_PM4_IW_INDSIZE 0x073c + +#define R128_PM4_STAT 0x07b8 +# define R128_PM4_FIFOCNT_MASK 0x0fff +# define R128_PM4_BUSY (1 << 16) +# define R128_PM4_GUI_ACTIVE (1 << 31) + +#define R128_PM4_MICROCODE_ADDR 0x07d4 +#define R128_PM4_MICROCODE_RADDR 0x07d8 +#define R128_PM4_MICROCODE_DATAH 0x07dc +#define R128_PM4_MICROCODE_DATAL 0x07e0 + +#define R128_PM4_BUFFER_ADDR 0x07f0 +#define R128_PM4_MICRO_CNTL 0x07fc +# define R128_PM4_MICRO_FREERUN (1 << 30) + +#define R128_PM4_FIFO_DATA_EVEN 0x1000 +#define R128_PM4_FIFO_DATA_ODD 0x1004 + + +/* CCE command packets + */ +#define R128_CCE_PACKET0 0x00000000 +#define R128_CCE_PACKET1 0x40000000 +#define R128_CCE_PACKET2 0x80000000 +#define R128_CCE_PACKET3 0xC0000000 +# define R128_CNTL_HOSTDATA_BLT 0x00009400 +# define R128_CNTL_PAINT_MULTI 0x00009A00 +# define R128_CNTL_BITBLT_MULTI 0x00009B00 +# define R128_3D_RNDR_GEN_INDX_PRIM 0x00002300 + +#define R128_CCE_PACKET_MASK 0xC0000000 +#define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 +#define R128_CCE_PACKET0_REG_MASK 0x000007ff +#define R128_CCE_PACKET1_REG0_MASK 0x000007ff +#define R128_CCE_PACKET1_REG1_MASK 0x003ff800 + +#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 +#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 +#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 +#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 +#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 +#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 +#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 +#define R128_CCE_VC_CNTL_NUM_SHIFT 16 + +#define R128_DATATYPE_CI8 2 +#define R128_DATATYPE_ARGB1555 3 +#define R128_DATATYPE_RGB565 4 +#define R128_DATATYPE_RGB888 5 +#define R128_DATATYPE_ARGB8888 6 +#define R128_DATATYPE_RGB332 7 +#define R128_DATATYPE_RGB8 9 +#define R128_DATATYPE_ARGB4444 15 + +/* Constants */ +#define R128_AGP_OFFSET 0x02000000 + +#define R128_WATERMARK_L 16 +#define R128_WATERMARK_M 8 +#define R128_WATERMARK_N 8 +#define R128_WATERMARK_K 128 + +#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ + +#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 +#define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 +#define R128_MAX_VB_AGE 0x7fffffff +#define R128_MAX_VB_VERTS (0xffff) + +#define R128_RING_HIGH_MARK 128 + +#define R128_PERFORMANCE_BOXES 0 + + +#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) +#define R128_ADDR(reg) (R128_BASE( reg ) + reg) + +#define R128_READ(reg) DRM_READ32( (volatile u32 *) R128_ADDR(reg) ) +#define R128_WRITE(reg,val) DRM_WRITE32( (volatile u32 *) R128_ADDR(reg), (val) ) + +#define R128_READ8(reg) DRM_READ8( (volatile u8 *) R128_ADDR(reg) ) +#define R128_WRITE8(reg,val) DRM_WRITE8( (volatile u8 *) R128_ADDR(reg), (val) ) + +#define R128_WRITE_PLL(addr,val) \ +do { \ + R128_WRITE8(R128_CLOCK_CNTL_INDEX, \ + ((addr) & 0x1f) | R128_PLL_WR_EN); \ + R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \ +} while (0) + +extern int R128_READ_PLL(drm_device_t *dev, int addr); + + +#define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \ + ((n) << 16) | ((reg) >> 2)) +#define CCE_PACKET1( reg0, reg1 ) (R128_CCE_PACKET1 | \ + (((reg1) >> 2) << 11) | ((reg0) >> 2)) +#define CCE_PACKET2() (R128_CCE_PACKET2) +#define CCE_PACKET3( pkt, n ) (R128_CCE_PACKET3 | \ + (pkt) | ((n) << 16)) + + +/* ================================================================ + * Misc helper macros + */ + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != DRM_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); \ + return DRM_ERR(EINVAL); \ + } \ +} while (0) + +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ + if ( ring->space < ring->high_mark ) { \ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ + r128_update_ring_snapshot( ring ); \ + if ( ring->space >= ring->high_mark ) \ + goto __ring_space_done; \ + DRM_UDELAY(1); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + return DRM_ERR(EBUSY); \ + } \ + __ring_space_done: \ + ; \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \ + if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \ + int __ret = r128_do_cce_idle( dev_priv ); \ + if ( __ret ) return __ret; \ + sarea_priv->last_dispatch = 0; \ + r128_freelist_reset( dev ); \ + } \ +} while (0) + +#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \ + OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \ + OUT_RING( R128_EVENT_CRTC_OFFSET ); \ +} while (0) + + +/* ================================================================ + * Ring control + */ + +#if defined(__powerpc__) +#define r128_flush_write_combine() (void) GET_RING_HEAD( &dev_priv->ring ) +#else +#define r128_flush_write_combine() DRM_WRITEMEMORYBARRIER() +#endif + + +#define R128_VERBOSE 0 + +#define RING_LOCALS \ + int write; unsigned int tail_mask; volatile u32 *ring; + +#define BEGIN_RING( n ) do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ + (n), __FUNCTION__ ); \ + } \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ + r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ + } \ + dev_priv->ring.space -= (n) * sizeof(u32); \ + ring = dev_priv->ring.start; \ + write = dev_priv->ring.tail; \ + tail_mask = dev_priv->ring.tail_mask; \ +} while (0) + +/* You can set this to zero if you want. If the card locks up, you'll + * need to keep this set. It works around a bug in early revs of the + * Rage 128 chipset, where the CCE would read 32 dwords past the end of + * the ring buffer before wrapping around. + */ +#define R128_BROKEN_CCE 1 + +#define ADVANCE_RING() do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ + write, dev_priv->ring.tail ); \ + } \ + if ( R128_BROKEN_CCE && write < 32 ) { \ + memcpy( dev_priv->ring.end, \ + dev_priv->ring.start, \ + write * sizeof(u32) ); \ + } \ + r128_flush_write_combine(); \ + dev_priv->ring.tail = write; \ + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ +} while (0) + +#define OUT_RING( x ) do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ + (unsigned int)(x), write ); \ + } \ + ring[write++] = cpu_to_le32( x ); \ + write &= tail_mask; \ +} while (0) + +#endif /* __R128_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_irq.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_irq.c:1.1 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_irq.c Mon Dec 16 11:19:33 2002 @@ -0,0 +1,100 @@ +/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- + * + * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. + * + * The Weather Channel (TM) funded Tungsten Graphics to develop the + * initial release of the Radeon 8500 driver under the XFree86 license. + * This notice must be preserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * Eric Anholt <anholt@FreeBSD.org> + */ + +#include "r128.h" +#include "drmP.h" +#include "drm.h" +#include "r128_drm.h" +#include "r128_drv.h" + +void r128_dma_service( DRM_IRQ_ARGS ) +{ + drm_device_t *dev = (drm_device_t *) arg; + drm_r128_private_t *dev_priv = + (drm_r128_private_t *)dev->dev_private; + int status; + + status = R128_READ( R128_GEN_INT_STATUS ); + + /* VBLANK interrupt */ + if ( status & R128_CRTC_VBLANK_INT ) { + R128_WRITE( R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK ); + atomic_inc(&dev->vbl_received); + DRM_WAKEUP(&dev->vbl_queue); + DRM(vbl_send_signals)( dev ); + } +} + +int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence) +{ + unsigned int cur_vblank; + int ret = 0; + + /* Assume that the user has missed the current sequence number + * by about a day rather than she wants to wait for years + * using vertical blanks... + */ + DRM_WAIT_ON( ret, dev->vbl_queue, 3*DRM_HZ, + ( ( ( cur_vblank = atomic_read(&dev->vbl_received ) ) + - *sequence ) <= (1<<23) ) ); + + *sequence = cur_vblank; + + return ret; +} + +void r128_driver_irq_preinstall( drm_device_t *dev ) { + drm_r128_private_t *dev_priv = + (drm_r128_private_t *)dev->dev_private; + + /* Disable *all* interrupts */ + R128_WRITE( R128_GEN_INT_CNTL, 0 ); + /* Clear vblank bit if it's already high */ + R128_WRITE( R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK ); +} + +void r128_driver_irq_postinstall( drm_device_t *dev ) { + drm_r128_private_t *dev_priv = + (drm_r128_private_t *)dev->dev_private; + + /* Turn on VBL interrupt */ + R128_WRITE( R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN ); +} + +void r128_driver_irq_uninstall( drm_device_t *dev ) { + drm_r128_private_t *dev_priv = + (drm_r128_private_t *)dev->dev_private; + if ( dev_priv ) { + /* Disable *all* interrupts */ + R128_WRITE( R128_GEN_INT_CNTL, 0 ); + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_state.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_state.c:1.2 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/r128_state.c Mon Dec 16 11:19:33 2002 @@ -0,0 +1,1599 @@ +/* r128_state.c -- State support for r128 -*- linux-c -*- + * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#include "r128.h" +#include "drmP.h" +#include "drm.h" +#include "r128_drm.h" +#include "r128_drv.h" + + +/* ================================================================ + * CCE hardware state programming functions + */ + +static void r128_emit_clip_rects( drm_r128_private_t *dev_priv, + drm_clip_rect_t *boxes, int count ) +{ + u32 aux_sc_cntl = 0x00000000; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 17 ); + + if ( count >= 1 ) { + OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) ); + OUT_RING( boxes[0].x1 ); + OUT_RING( boxes[0].x2 - 1 ); + OUT_RING( boxes[0].y1 ); + OUT_RING( boxes[0].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX1_SC_EN | R128_AUX1_SC_MODE_OR); + } + if ( count >= 2 ) { + OUT_RING( CCE_PACKET0( R128_AUX2_SC_LEFT, 3 ) ); + OUT_RING( boxes[1].x1 ); + OUT_RING( boxes[1].x2 - 1 ); + OUT_RING( boxes[1].y1 ); + OUT_RING( boxes[1].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX2_SC_EN | R128_AUX2_SC_MODE_OR); + } + if ( count >= 3 ) { + OUT_RING( CCE_PACKET0( R128_AUX3_SC_LEFT, 3 ) ); + OUT_RING( boxes[2].x1 ); + OUT_RING( boxes[2].x2 - 1 ); + OUT_RING( boxes[2].y1 ); + OUT_RING( boxes[2].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX3_SC_EN | R128_AUX3_SC_MODE_OR); + } + + OUT_RING( CCE_PACKET0( R128_AUX_SC_CNTL, 0 ) ); + OUT_RING( aux_sc_cntl ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_core( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_SCALE_3D_CNTL, 0 ) ); + OUT_RING( ctx->scale_3d_cntl ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_context( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 13 ); + + OUT_RING( CCE_PACKET0( R128_DST_PITCH_OFFSET_C, 11 ) ); + OUT_RING( ctx->dst_pitch_offset_c ); + OUT_RING( ctx->dp_gui_master_cntl_c ); + OUT_RING( ctx->sc_top_left_c ); + OUT_RING( ctx->sc_bottom_right_c ); + OUT_RING( ctx->z_offset_c ); + OUT_RING( ctx->z_pitch_c ); + OUT_RING( ctx->z_sten_cntl_c ); + OUT_RING( ctx->tex_cntl_c ); + OUT_RING( ctx->misc_3d_state_cntl_reg ); + OUT_RING( ctx->texture_clr_cmp_clr_c ); + OUT_RING( ctx->texture_clr_cmp_msk_c ); + OUT_RING( ctx->fog_color_c ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_setup( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 3 ); + + OUT_RING( CCE_PACKET1( R128_SETUP_CNTL, R128_PM4_VC_FPU_SETUP ) ); + OUT_RING( ctx->setup_cntl ); + OUT_RING( ctx->pm4_vc_fpu_setup ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_masks( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( ctx->dp_write_mask ); + + OUT_RING( CCE_PACKET0( R128_STEN_REF_MASK_C, 1 ) ); + OUT_RING( ctx->sten_ref_mask_c ); + OUT_RING( ctx->plane_3d_mask_c ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_window( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_WINDOW_XY_OFFSET, 0 ) ); + OUT_RING( ctx->window_xy_offset ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_tex0( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0]; + int i; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 7 + R128_MAX_TEXTURE_LEVELS ); + + OUT_RING( CCE_PACKET0( R128_PRIM_TEX_CNTL_C, + 2 + R128_MAX_TEXTURE_LEVELS ) ); + OUT_RING( tex->tex_cntl ); + OUT_RING( tex->tex_combine_cntl ); + OUT_RING( ctx->tex_size_pitch_c ); + for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { + OUT_RING( tex->tex_offset[i] ); + } + + OUT_RING( CCE_PACKET0( R128_CONSTANT_COLOR_C, 1 ) ); + OUT_RING( ctx->constant_color_c ); + OUT_RING( tex->tex_border_color ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_tex1( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; + int i; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 + R128_MAX_TEXTURE_LEVELS ); + + OUT_RING( CCE_PACKET0( R128_SEC_TEX_CNTL_C, + 1 + R128_MAX_TEXTURE_LEVELS ) ); + OUT_RING( tex->tex_cntl ); + OUT_RING( tex->tex_combine_cntl ); + for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { + OUT_RING( tex->tex_offset[i] ); + } + + OUT_RING( CCE_PACKET0( R128_SEC_TEXTURE_BORDER_COLOR_C, 0 ) ); + OUT_RING( tex->tex_border_color ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_state( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); + + if ( dirty & R128_UPLOAD_CORE ) { + r128_emit_core( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_CORE; + } + + if ( dirty & R128_UPLOAD_CONTEXT ) { + r128_emit_context( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_CONTEXT; + } + + if ( dirty & R128_UPLOAD_SETUP ) { + r128_emit_setup( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_SETUP; + } + + if ( dirty & R128_UPLOAD_MASKS ) { + r128_emit_masks( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_MASKS; + } + + if ( dirty & R128_UPLOAD_WINDOW ) { + r128_emit_window( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_WINDOW; + } + + if ( dirty & R128_UPLOAD_TEX0 ) { + r128_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_TEX0; + } + + if ( dirty & R128_UPLOAD_TEX1 ) { + r128_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_TEX1; + } + + /* Turn off the texture cache flushing */ + sarea_priv->context_state.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; + + sarea_priv->dirty &= ~R128_REQUIRE_QUIESCENCE; +} + + +#if R128_PERFORMANCE_BOXES +/* ================================================================ + * Performance monitoring functions + */ + +static void r128_clear_box( drm_r128_private_t *dev_priv, + int x, int y, int w, int h, + int r, int g, int b ) +{ + u32 pitch, offset; + u32 fb_bpp, color; + RING_LOCALS; + + switch ( dev_priv->fb_bpp ) { + case 16: + fb_bpp = R128_GMC_DST_16BPP; + color = (((r & 0xf8) << 8) | + ((g & 0xfc) << 3) | + ((b & 0xf8) >> 3)); + break; + case 24: + fb_bpp = R128_GMC_DST_24BPP; + color = ((r << 16) | (g << 8) | b); + break; + case 32: + fb_bpp = R128_GMC_DST_32BPP; + color = (((0xff) << 24) | (r << 16) | (g << 8) | b); + break; + default: + return; + } + + offset = dev_priv->back_offset; + pitch = dev_priv->back_pitch >> 3; + + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + fb_bpp | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( (pitch << 21) | (offset >> 5) ); + OUT_RING( color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); +} + +static void r128_cce_performance_boxes( drm_r128_private_t *dev_priv ) +{ + if ( atomic_read( &dev_priv->idle_count ) == 0 ) { + r128_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); + } else { + atomic_set( &dev_priv->idle_count, 0 ); + } +} + +#endif + + +/* ================================================================ + * CCE command dispatch functions + */ + +static void r128_print_dirty( const char *msg, unsigned int flags ) +{ + DRM_INFO( "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & R128_UPLOAD_CORE) ? "core, " : "", + (flags & R128_UPLOAD_CONTEXT) ? "context, " : "", + (flags & R128_UPLOAD_SETUP) ? "setup, " : "", + (flags & R128_UPLOAD_TEX0) ? "tex0, " : "", + (flags & R128_UPLOAD_TEX1) ? "tex1, " : "", + (flags & R128_UPLOAD_MASKS) ? "masks, " : "", + (flags & R128_UPLOAD_WINDOW) ? "window, " : "", + (flags & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "", + (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); +} + +static void r128_cce_dispatch_clear( drm_device_t *dev, + drm_r128_clear_t *clear ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + unsigned int flags = clear->flags; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { + unsigned int tmp = flags; + + flags &= ~(R128_FRONT | R128_BACK); + if ( tmp & R128_FRONT ) flags |= R128_BACK; + if ( tmp & R128_BACK ) flags |= R128_FRONT; + } + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", + pbox[i].x1, pbox[i].y1, pbox[i].x2, + pbox[i].y2, flags ); + + if ( flags & (R128_FRONT | R128_BACK) ) { + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( clear->color_mask ); + + ADVANCE_RING(); + } + + if ( flags & R128_FRONT ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( dev_priv->front_pitch_offset_c ); + OUT_RING( clear->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & R128_BACK ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS ); + + OUT_RING( dev_priv->back_pitch_offset_c ); + OUT_RING( clear->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & R128_DEPTH ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( clear->clear_depth ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + } +} + +static void r128_cce_dispatch_swap( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + +#if R128_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + r128_cce_performance_boxes( dev_priv ); +#endif + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + BEGIN_RING( 7 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | + R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (dev_priv->color_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->back_pitch_offset_c ); + OUT_RING( dev_priv->front_pitch_offset_c ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); + OUT_RING( dev_priv->sarea_priv->last_frame ); + + ADVANCE_RING(); +} + +static void r128_cce_dispatch_flip( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + DRM_DEBUG( "page=%d\n", dev_priv->current_page ); + +#if R128_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + r128_cce_performance_boxes( dev_priv ); +#endif + + BEGIN_RING( 4 ); + + R128_WAIT_UNTIL_PAGE_FLIPPED(); + OUT_RING( CCE_PACKET0( R128_CRTC_OFFSET, 0 ) ); + + if ( dev_priv->current_page == 0 ) { + OUT_RING( dev_priv->back_offset ); + dev_priv->current_page = 1; + } else { + OUT_RING( dev_priv->front_offset ); + dev_priv->current_page = 0; + } + + ADVANCE_RING(); + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); + OUT_RING( dev_priv->sarea_priv->last_frame ); + + ADVANCE_RING(); +} + +static void r128_cce_dispatch_vertex( drm_device_t *dev, + drm_buf_t *buf ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int format = sarea_priv->vc_format; + int offset = buf->bus_address; + int size = buf->used; + int prim = buf_priv->prim; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "buf=%d nbox=%d\n", buf->idx, sarea_priv->nbox ); + + if ( 0 ) + r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); + + if ( buf->used ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128_emit_state( dev_priv ); + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + r128_emit_clip_rects( dev_priv, + &sarea_priv->boxes[i], + sarea_priv->nbox - i ); + } + + /* Emit the vertex buffer rendering commands */ + BEGIN_RING( 5 ); + + OUT_RING( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, 3 ) ); + OUT_RING( offset ); + OUT_RING( size ); + OUT_RING( format ); + OUT_RING( prim | R128_CCE_VC_CNTL_PRIM_WALK_LIST | + (size << R128_CCE_VC_CNTL_NUM_SHIFT) ); + + ADVANCE_RING(); + + i += 3; + } while ( i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( buf_priv->age ); + + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + + sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + +static void r128_cce_dispatch_indirect( drm_device_t *dev, + drm_buf_t *buf, + int start, int end ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + RING_LOCALS; + DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", + buf->idx, start, end ); + + if ( start != end ) { + int offset = buf->bus_address + start; + int dwords = (end - start + 3) / sizeof(u32); + + /* Indirect buffer data must be an even number of + * dwords, so if we've been given an odd number we must + * pad the data with a Type-2 CCE packet. + */ + if ( dwords & 1 ) { + u32 *data = (u32 *) + ((char *)dev_priv->buffers->handle + + buf->offset + start); + data[dwords++] = cpu_to_le32( R128_CCE_PACKET2 ); + } + + buf_priv->dispatched = 1; + + /* Fire off the indirect buffer */ + BEGIN_RING( 3 ); + + OUT_RING( CCE_PACKET0( R128_PM4_IW_INDOFF, 1 ) ); + OUT_RING( offset ); + OUT_RING( dwords ); + + ADVANCE_RING(); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the indirect buffer age */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( buf_priv->age ); + + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; +} + +static void r128_cce_dispatch_indices( drm_device_t *dev, + drm_buf_t *buf, + int start, int end, + int count ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + int format = sarea_priv->vc_format; + int offset = dev_priv->buffers->offset - dev_priv->cce_buffers_offset; + int prim = buf_priv->prim; + u32 *data; + int dwords; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); + + if ( 0 ) + r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); + + if ( start != end ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128_emit_state( dev_priv ); + } + + dwords = (end - start + 3) / sizeof(u32); + + data = (u32 *)((char *)dev_priv->buffers->handle + + buf->offset + start); + + data[0] = cpu_to_le32( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, + dwords-2 ) ); + + data[1] = cpu_to_le32( offset ); + data[2] = cpu_to_le32( R128_MAX_VB_VERTS ); + data[3] = cpu_to_le32( format ); + data[4] = cpu_to_le32( (prim | R128_CCE_VC_CNTL_PRIM_WALK_IND | + (count << 16)) ); + + if ( count & 0x1 ) { +#ifdef __LITTLE_ENDIAN + data[dwords-1] &= 0x0000ffff; +#else + data[dwords-1] &= 0xffff0000; +#endif + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + r128_emit_clip_rects( dev_priv, + &sarea_priv->boxes[i], + sarea_priv->nbox - i ); + } + + r128_cce_dispatch_indirect( dev, buf, start, end ); + + i += 3; + } while ( i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( buf_priv->age ); + + ADVANCE_RING(); + + buf->pending = 1; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + + sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + +static int r128_cce_dispatch_blit( drm_device_t *dev, + drm_r128_blit_t *blit ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + u32 *data; + int dword_shift, dwords; + RING_LOCALS; + DRM_DEBUG( "\n" ); + + /* The compiler won't optimize away a division by a variable, + * even if the only legal values are powers of two. Thus, we'll + * use a shift instead. + */ + switch ( blit->format ) { + case R128_DATATYPE_ARGB8888: + dword_shift = 0; + break; + case R128_DATATYPE_ARGB1555: + case R128_DATATYPE_RGB565: + case R128_DATATYPE_ARGB4444: + dword_shift = 1; + break; + case R128_DATATYPE_CI8: + case R128_DATATYPE_RGB8: + dword_shift = 2; + break; + default: + DRM_ERROR( "invalid blit format %d\n", blit->format ); + return DRM_ERR(EINVAL); + } + + /* Flush the pixel cache, and mark the contents as Read Invalid. + * This ensures no pixel data gets mixed up with the texture + * data from the host data blit, otherwise part of the texture + * image may be corrupted. + */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); + OUT_RING( R128_PC_RI_GUI | R128_PC_FLUSH_GUI ); + + ADVANCE_RING(); + + /* Dispatch the indirect buffer. + */ + buf = dma->buflist[blit->idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", blit->idx ); + return DRM_ERR(EINVAL); + } + + buf_priv->discard = 1; + + dwords = (blit->width * blit->height) >> dword_shift; + + data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); + + data[0] = cpu_to_le32( CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 ) ); + data[1] = cpu_to_le32( (R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (blit->format << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_HOST_DATA | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS) ); + + data[2] = cpu_to_le32( (blit->pitch << 21) | (blit->offset >> 5) ); + data[3] = cpu_to_le32( 0xffffffff ); + data[4] = cpu_to_le32( 0xffffffff ); + data[5] = cpu_to_le32( (blit->y << 16) | blit->x ); + data[6] = cpu_to_le32( (blit->height << 16) | blit->width ); + data[7] = cpu_to_le32( dwords ); + + buf->used = (dwords + 8) * sizeof(u32); + + r128_cce_dispatch_indirect( dev, buf, 0, buf->used ); + + /* Flush the pixel cache after the blit completes. This ensures + * the texture data is written out to memory before rendering + * continues. + */ + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); + OUT_RING( R128_PC_FLUSH_GUI ); + + ADVANCE_RING(); + + return 0; +} + + +/* ================================================================ + * Tiled depth buffer management + * + * FIXME: These should all set the destination write mask for when we + * have hardware stencil support. + */ + +static int r128_cce_dispatch_write_span( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, x, y; + u32 *buffer; + u8 *mask; + int i; + RING_LOCALS; + DRM_DEBUG( "\n" ); + + count = depth->n; + if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { + return DRM_ERR(EFAULT); + } + if ( DRM_COPY_FROM_USER( &y, depth->y, sizeof(y) ) ) { + return DRM_ERR(EFAULT); + } + + buffer = DRM_MALLOC( depth->n * sizeof(u32) ); + if ( buffer == NULL ) + return DRM_ERR(ENOMEM); + if ( DRM_COPY_FROM_USER( buffer, depth->buffer, + depth->n * sizeof(u32) ) ) { + DRM_FREE( buffer ); + return DRM_ERR(EFAULT); + } + + if ( depth->mask ) { + mask = DRM_MALLOC( depth->n * sizeof(u8) ); + if ( mask == NULL ) { + DRM_FREE( buffer ); + return DRM_ERR(ENOMEM); + } + if ( DRM_COPY_FROM_USER( mask, depth->mask, + depth->n * sizeof(u8) ) ) { + DRM_FREE( buffer ); + DRM_FREE( mask ); + return DRM_ERR(EFAULT); + } + + for ( i = 0 ; i < count ; i++, x++ ) { + if ( mask[i] ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_FREE( mask ); + } else { + for ( i = 0 ; i < count ; i++, x++ ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_FREE( buffer ); + + return 0; +} + +static int r128_cce_dispatch_write_pixels( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, *x, *y; + u32 *buffer; + u8 *mask; + int i; + RING_LOCALS; + DRM_DEBUG( "\n" ); + + count = depth->n; + + x = DRM_MALLOC( count * sizeof(*x) ); + if ( x == NULL ) { + return DRM_ERR(ENOMEM); + } + y = DRM_MALLOC( count * sizeof(*y) ); + if ( y == NULL ) { + DRM_FREE( x ); + return DRM_ERR(ENOMEM); + } + if ( DRM_COPY_FROM_USER( x, depth->x, count * sizeof(int) ) ) { + DRM_FREE( x ); + DRM_FREE( y ); + return DRM_ERR(EFAULT); + } + if ( DRM_COPY_FROM_USER( y, depth->y, count * sizeof(int) ) ) { + DRM_FREE( x ); + DRM_FREE( y ); + return DRM_ERR(EFAULT); + } + + buffer = DRM_MALLOC( depth->n * sizeof(u32) ); + if ( buffer == NULL ) { + DRM_FREE( x ); + DRM_FREE( y ); + return DRM_ERR(ENOMEM); + } + if ( DRM_COPY_FROM_USER( buffer, depth->buffer, + depth->n * sizeof(u32) ) ) { + DRM_FREE( x ); + DRM_FREE( y ); + DRM_FREE( buffer ); + return DRM_ERR(EFAULT); + } + + if ( depth->mask ) { + mask = DRM_MALLOC( depth->n * sizeof(u8) ); + if ( mask == NULL ) { + DRM_FREE( x ); + DRM_FREE( y ); + DRM_FREE( buffer ); + return DRM_ERR(ENOMEM); + } + if ( DRM_COPY_FROM_USER( mask, depth->mask, + depth->n * sizeof(u8) ) ) { + DRM_FREE( x ); + DRM_FREE( y ); + DRM_FREE( buffer ); + DRM_FREE( mask ); + return DRM_ERR(EFAULT); + } + + for ( i = 0 ; i < count ; i++ ) { + if ( mask[i] ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_FREE( mask ); + } else { + for ( i = 0 ; i < count ; i++ ) { + BEGIN_RING( 6 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( buffer[i] ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_FREE( x ); + DRM_FREE( y ); + DRM_FREE( buffer ); + + return 0; +} + +static int r128_cce_dispatch_read_span( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, x, y; + RING_LOCALS; + DRM_DEBUG( "\n" ); + + count = depth->n; + if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { + return DRM_ERR(EFAULT); + } + if ( DRM_COPY_FROM_USER( &y, depth->y, sizeof(y) ) ) { + return DRM_ERR(EFAULT); + } + + BEGIN_RING( 7 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | + R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( dev_priv->span_pitch_offset_c ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (0 << 16) | 0 ); + OUT_RING( (count << 16) | 1 ); + + ADVANCE_RING(); + + return 0; +} + +static int r128_cce_dispatch_read_pixels( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, *x, *y; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + count = depth->n; + if ( count > dev_priv->depth_pitch ) { + count = dev_priv->depth_pitch; + } + + x = DRM_MALLOC( count * sizeof(*x) ); + if ( x == NULL ) { + return DRM_ERR(ENOMEM); + } + y = DRM_MALLOC( count * sizeof(*y) ); + if ( y == NULL ) { + DRM_FREE( x ); + return DRM_ERR(ENOMEM); + } + if ( DRM_COPY_FROM_USER( x, depth->x, count * sizeof(int) ) ) { + DRM_FREE( x ); + DRM_FREE( y ); + return DRM_ERR(EFAULT); + } + if ( DRM_COPY_FROM_USER( y, depth->y, count * sizeof(int) ) ) { + DRM_FREE( x ); + DRM_FREE( y ); + return DRM_ERR(EFAULT); + } + + for ( i = 0 ; i < count ; i++ ) { + BEGIN_RING( 7 ); + + OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | + R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->depth_pitch_offset_c ); + OUT_RING( dev_priv->span_pitch_offset_c ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (i << 16) | 0 ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + + DRM_FREE( x ); + DRM_FREE( y ); + + return 0; +} + + +/* ================================================================ + * Polygon stipple + */ + +static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + BEGIN_RING( 33 ); + + OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); + for ( i = 0 ; i < 32 ; i++ ) { + OUT_RING( stipple[i] ); + } + + ADVANCE_RING(); +} + + +/* ================================================================ + * IOCTL functions + */ + +int r128_cce_clear( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_clear_t clear; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( clear, (drm_r128_clear_t *) data, + sizeof(clear) ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; + + r128_cce_dispatch_clear( dev, &clear ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + + return 0; +} + +int r128_cce_swap( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; + + if ( !dev_priv->page_flipping ) { + r128_cce_dispatch_swap( dev ); + dev_priv->sarea_priv->dirty |= (R128_UPLOAD_CONTEXT | + R128_UPLOAD_MASKS); + } else { + r128_cce_dispatch_flip( dev ); + } + + return 0; +} + +int r128_cce_vertex( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_vertex_t vertex; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( vertex, (drm_r128_vertex_t *) data, + sizeof(vertex) ); + + DRM_DEBUG( "pid=%d index=%d count=%d discard=%d\n", + DRM_CURRENTPID, + vertex.idx, vertex.count, vertex.discard ); + + if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + vertex.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + if ( vertex.prim < 0 || + vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[vertex.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + return DRM_ERR(EINVAL); + } + + buf->used = vertex.count; + buf_priv->prim = vertex.prim; + buf_priv->discard = vertex.discard; + + r128_cce_dispatch_vertex( dev, buf ); + + return 0; +} + +int r128_cce_indices( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_indices_t elts; + int count; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( elts, (drm_r128_indices_t *) data, + sizeof(elts) ); + + DRM_DEBUG( "pid=%d buf=%d s=%d e=%d d=%d\n", DRM_CURRENTPID, + elts.idx, elts.start, elts.end, elts.discard ); + + if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + elts.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + if ( elts.prim < 0 || + elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", elts.prim ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[elts.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", elts.idx ); + return DRM_ERR(EINVAL); + } + + count = (elts.end - elts.start) / sizeof(u16); + elts.start -= R128_INDEX_PRIM_OFFSET; + + if ( elts.start & 0x7 ) { + DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); + return DRM_ERR(EINVAL); + } + if ( elts.start < buf->used ) { + DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); + return DRM_ERR(EINVAL); + } + + buf->used = elts.end; + buf_priv->prim = elts.prim; + buf_priv->discard = elts.discard; + + r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count ); + + return 0; +} + +int r128_cce_blit( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_blit_t blit; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( blit, (drm_r128_blit_t *) data, + sizeof(blit) ); + + DRM_DEBUG( "pid=%d index=%d\n", DRM_CURRENTPID, blit.idx ); + + if ( blit.idx < 0 || blit.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + blit.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + return r128_cce_dispatch_blit( dev, &blit ); +} + +int r128_cce_depth( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_depth_t depth; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( depth, (drm_r128_depth_t *) data, + sizeof(depth) ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + switch ( depth.func ) { + case R128_WRITE_SPAN: + return r128_cce_dispatch_write_span( dev, &depth ); + case R128_WRITE_PIXELS: + return r128_cce_dispatch_write_pixels( dev, &depth ); + case R128_READ_SPAN: + return r128_cce_dispatch_read_span( dev, &depth ); + case R128_READ_PIXELS: + return r128_cce_dispatch_read_pixels( dev, &depth ); + } + + return DRM_ERR(EINVAL); +} + +int r128_cce_stipple( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_stipple_t stipple; + u32 mask[32]; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( stipple, (drm_r128_stipple_t *) data, + sizeof(stipple) ); + + if ( DRM_COPY_FROM_USER( &mask, stipple.mask, + 32 * sizeof(u32) ) ) + return DRM_ERR( EFAULT ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + r128_cce_dispatch_stipple( dev, mask ); + + return 0; +} + +int r128_cce_indirect( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_indirect_t indirect; +#if 0 + RING_LOCALS; +#endif + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( indirect, (drm_r128_indirect_t *) data, + sizeof(indirect) ); + + DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", + indirect.idx, indirect.start, + indirect.end, indirect.discard ); + + if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + indirect.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + + buf = dma->buflist[indirect.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); + return DRM_ERR(EINVAL); + } + + if ( indirect.start < buf->used ) { + DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", + indirect.start, buf->used ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf->used = indirect.end; + buf_priv->discard = indirect.discard; + +#if 0 + /* Wait for the 3D stream to idle before the indirect buffer + * containing 2D acceleration commands is processed. + */ + BEGIN_RING( 2 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + ADVANCE_RING(); +#endif + + /* Dispatch the indirect buffer full of commands from the + * X server. This is insecure and is thus only available to + * privileged clients. + */ + r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end ); + + return 0; +} + +int r128_getparam( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_getparam_t param; + int value; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( param, (drm_r128_getparam_t *)data, + sizeof(param) ); + + DRM_DEBUG( "pid=%d\n", DRM_CURRENTPID ); + + switch( param.param ) { + case R128_PARAM_IRQ_NR: + value = dev->irq; + break; + default: + return DRM_ERR(EINVAL); + } + + if ( DRM_COPY_TO_USER( param.value, &value, sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return DRM_ERR(EFAULT); + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon.h:1.1 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon.h Wed Oct 30 07:52:41 2002 @@ -0,0 +1,158 @@ +/* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + */ + +#ifndef __RADEON_H__ +#define __RADEON_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) radeon_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 +#define __HAVE_SG 1 +#define __HAVE_PCI_DMA 1 + +#define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others." + +#define DRIVER_NAME "radeon" +#define DRIVER_DESC "ATI Radeon" +#define DRIVER_DATE "20020828" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 7 +#define DRIVER_PATCHLEVEL 0 + +/* Interface history: + * + * 1.1 - ?? + * 1.2 - Add vertex2 ioctl (keith) + * - Add stencil capability to clear ioctl (gareth, keith) + * - Increase MAX_TEXTURE_LEVELS (brian) + * 1.3 - Add cmdbuf ioctl (keith) + * - Add support for new radeon packets (keith) + * - Add getparam ioctl (keith) + * - Add flip-buffers ioctl, deprecate fullscreen foo (keith). + * 1.4 - Add scratch registers to get_param ioctl. + * 1.5 - Add r200 packets to cmdbuf ioctl + * - Add r200 function to init ioctl + * - Add 'scalar2' instruction to cmdbuf + * 1.6 - Add static agp memory manager + * Add irq handler (won't be turned on unless X server knows to) + * Add irq ioctls and irq_active getparam. + * Add wait command for cmdbuf ioctl + * Add agp offset query for getparam + * 1.7 - Add support for cube map registers: R200_PP_CUBIC_FACES_[0..5] + * and R200_PP_CUBIC_OFFSET_F1_[0..5]. + * Added packets R200_EMIT_PP_CUBIC_FACES_[0..5] and + * R200_EMIT_PP_CUBIC_OFFSETS_[0..5]. (brian) + */ +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX2)] = { radeon_cp_vertex2, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CMDBUF)] = { radeon_cp_cmdbuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_GETPARAM)] = { radeon_cp_getparam, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FLIP)] = { radeon_cp_flip, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_ALLOC)] = { radeon_mem_alloc, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FREE)] = { radeon_mem_free, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INIT_HEAP)] = { radeon_mem_init_heap, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_EMIT)] = { radeon_irq_emit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_WAIT)] = { radeon_irq_wait, 1, 0 }, + + +#define USE_IRQS 1 +#if USE_IRQS +#define __HAVE_DMA_IRQ 1 +#define __HAVE_VBL_IRQ 1 +#define __HAVE_SHARED_IRQ 1 + +/* When a client dies: + * - Check for and clean up flipped page state + * - Free any alloced agp memory. + * + * DRM infrastructure takes care of reclaiming dma buffers. + */ +#define DRIVER_PRERELEASE() do { \ + if ( dev->dev_private ) { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv->page_flipping ) { \ + radeon_do_cleanup_pageflip( dev ); \ + } \ + radeon_mem_release( dev_priv->agp_heap ); \ + } \ +} while (0) + +/* On unloading the module: + * - Free memory heap structure + * - Remove mappings made at startup and free dev_private. + */ +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + radeon_mem_takedown( &(dev_priv->agp_heap) ); \ + radeon_do_cleanup_cp( dev ); \ + } \ +} while (0) + +#else +#define __HAVE_DMA_IRQ 0 +#endif + +/* DMA customization: + */ +#define __HAVE_DMA 1 + + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_radeon_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_radeon_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_cp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_cp.c:1.5 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_cp.c Mon Feb 3 20:48:38 2003 @@ -0,0 +1,1633 @@ +/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#include "radeon.h" +#include "drmP.h" +#include "drm.h" +#include "radeon_drm.h" +#include "radeon_drv.h" + +#define RADEON_FIFO_DEBUG 0 + + + +/* CP microcode (from ATI) */ +static u32 R200_cp_microcode[][2] = { + { 0x21007000, 0000000000 }, + { 0x20007000, 0000000000 }, + { 0x000000ab, 0x00000004 }, + { 0x000000af, 0x00000004 }, + { 0x66544a49, 0000000000 }, + { 0x49494174, 0000000000 }, + { 0x54517d83, 0000000000 }, + { 0x498d8b64, 0000000000 }, + { 0x49494949, 0000000000 }, + { 0x49da493c, 0000000000 }, + { 0x49989898, 0000000000 }, + { 0xd34949d5, 0000000000 }, + { 0x9dc90e11, 0000000000 }, + { 0xce9b9b9b, 0000000000 }, + { 0x000f0000, 0x00000016 }, + { 0x352e232c, 0000000000 }, + { 0x00000013, 0x00000004 }, + { 0x000f0000, 0x00000016 }, + { 0x352e272c, 0000000000 }, + { 0x000f0001, 0x00000016 }, + { 0x3239362f, 0000000000 }, + { 0x000077ef, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x00000020, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00061000, 0x00000002 }, + { 0x00000020, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00061000, 0x00000002 }, + { 0x00000020, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00000016, 0x00000004 }, + { 0x0003802a, 0x00000002 }, + { 0x040067e0, 0x00000002 }, + { 0x00000016, 0x00000004 }, + { 0x000077e0, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x000037e1, 0x00000002 }, + { 0x040067e1, 0x00000006 }, + { 0x000077e0, 0x00000002 }, + { 0x000077e1, 0x00000002 }, + { 0x000077e1, 0x00000006 }, + { 0xffffffff, 0000000000 }, + { 0x10000000, 0000000000 }, + { 0x0003802a, 0x00000002 }, + { 0x040067e0, 0x00000006 }, + { 0x00007675, 0x00000002 }, + { 0x00007676, 0x00000002 }, + { 0x00007677, 0x00000002 }, + { 0x00007678, 0x00000006 }, + { 0x0003802b, 0x00000002 }, + { 0x04002676, 0x00000002 }, + { 0x00007677, 0x00000002 }, + { 0x00007678, 0x00000006 }, + { 0x0000002e, 0x00000018 }, + { 0x0000002e, 0x00000018 }, + { 0000000000, 0x00000006 }, + { 0x0000002f, 0x00000018 }, + { 0x0000002f, 0x00000018 }, + { 0000000000, 0x00000006 }, + { 0x01605000, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x00098000, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x64c0603d, 0x00000004 }, + { 0x00080000, 0x00000016 }, + { 0000000000, 0000000000 }, + { 0x0400251d, 0x00000002 }, + { 0x00007580, 0x00000002 }, + { 0x00067581, 0x00000002 }, + { 0x04002580, 0x00000002 }, + { 0x00067581, 0x00000002 }, + { 0x00000046, 0x00000004 }, + { 0x00005000, 0000000000 }, + { 0x00061000, 0x00000002 }, + { 0x0000750e, 0x00000002 }, + { 0x00019000, 0x00000002 }, + { 0x00011055, 0x00000014 }, + { 0x00000055, 0x00000012 }, + { 0x0400250f, 0x00000002 }, + { 0x0000504a, 0x00000004 }, + { 0x00007565, 0x00000002 }, + { 0x00007566, 0x00000002 }, + { 0x00000051, 0x00000004 }, + { 0x01e655b4, 0x00000002 }, + { 0x4401b0dc, 0x00000002 }, + { 0x01c110dc, 0x00000002 }, + { 0x2666705d, 0x00000018 }, + { 0x040c2565, 0x00000002 }, + { 0x0000005d, 0x00000018 }, + { 0x04002564, 0x00000002 }, + { 0x00007566, 0x00000002 }, + { 0x00000054, 0x00000004 }, + { 0x00401060, 0x00000008 }, + { 0x00101000, 0x00000002 }, + { 0x000d80ff, 0x00000002 }, + { 0x00800063, 0x00000008 }, + { 0x000f9000, 0x00000002 }, + { 0x000e00ff, 0x00000002 }, + { 0000000000, 0x00000006 }, + { 0x00000080, 0x00000018 }, + { 0x00000054, 0x00000004 }, + { 0x00007576, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x00009000, 0x00000002 }, + { 0x00041000, 0x00000002 }, + { 0x0c00350e, 0x00000002 }, + { 0x00049000, 0x00000002 }, + { 0x00051000, 0x00000002 }, + { 0x01e785f8, 0x00000002 }, + { 0x00200000, 0x00000002 }, + { 0x00600073, 0x0000000c }, + { 0x00007563, 0x00000002 }, + { 0x006075f0, 0x00000021 }, + { 0x20007068, 0x00000004 }, + { 0x00005068, 0x00000004 }, + { 0x00007576, 0x00000002 }, + { 0x00007577, 0x00000002 }, + { 0x0000750e, 0x00000002 }, + { 0x0000750f, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00600076, 0x0000000c }, + { 0x006075f0, 0x00000021 }, + { 0x000075f8, 0x00000002 }, + { 0x00000076, 0x00000004 }, + { 0x000a750e, 0x00000002 }, + { 0x0020750f, 0x00000002 }, + { 0x00600079, 0x00000004 }, + { 0x00007570, 0x00000002 }, + { 0x00007571, 0x00000002 }, + { 0x00007572, 0x00000006 }, + { 0x00005000, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00007568, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x00000084, 0x0000000c }, + { 0x00058000, 0x00000002 }, + { 0x0c607562, 0x00000002 }, + { 0x00000086, 0x00000004 }, + { 0x00600085, 0x00000004 }, + { 0x400070dd, 0000000000 }, + { 0x000380dd, 0x00000002 }, + { 0x00000093, 0x0000001c }, + { 0x00065095, 0x00000018 }, + { 0x040025bb, 0x00000002 }, + { 0x00061096, 0x00000018 }, + { 0x040075bc, 0000000000 }, + { 0x000075bb, 0x00000002 }, + { 0x000075bc, 0000000000 }, + { 0x00090000, 0x00000006 }, + { 0x00090000, 0x00000002 }, + { 0x000d8002, 0x00000006 }, + { 0x00005000, 0x00000002 }, + { 0x00007821, 0x00000002 }, + { 0x00007800, 0000000000 }, + { 0x00007821, 0x00000002 }, + { 0x00007800, 0000000000 }, + { 0x01665000, 0x00000002 }, + { 0x000a0000, 0x00000002 }, + { 0x000671cc, 0x00000002 }, + { 0x0286f1cd, 0x00000002 }, + { 0x000000a3, 0x00000010 }, + { 0x21007000, 0000000000 }, + { 0x000000aa, 0x0000001c }, + { 0x00065000, 0x00000002 }, + { 0x000a0000, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x000b0000, 0x00000002 }, + { 0x38067000, 0x00000002 }, + { 0x000a00a6, 0x00000004 }, + { 0x20007000, 0000000000 }, + { 0x01200000, 0x00000002 }, + { 0x20077000, 0x00000002 }, + { 0x01200000, 0x00000002 }, + { 0x20007000, 0000000000 }, + { 0x00061000, 0x00000002 }, + { 0x0120751b, 0x00000002 }, + { 0x8040750a, 0x00000002 }, + { 0x8040750b, 0x00000002 }, + { 0x00110000, 0x00000002 }, + { 0x000380dd, 0x00000002 }, + { 0x000000bd, 0x0000001c }, + { 0x00061096, 0x00000018 }, + { 0x844075bd, 0x00000002 }, + { 0x00061095, 0x00000018 }, + { 0x840075bb, 0x00000002 }, + { 0x00061096, 0x00000018 }, + { 0x844075bc, 0x00000002 }, + { 0x000000c0, 0x00000004 }, + { 0x804075bd, 0x00000002 }, + { 0x800075bb, 0x00000002 }, + { 0x804075bc, 0x00000002 }, + { 0x00108000, 0x00000002 }, + { 0x01400000, 0x00000002 }, + { 0x006000c4, 0x0000000c }, + { 0x20c07000, 0x00000020 }, + { 0x000000c6, 0x00000012 }, + { 0x00800000, 0x00000006 }, + { 0x0080751d, 0x00000006 }, + { 0x000025bb, 0x00000002 }, + { 0x000040c0, 0x00000004 }, + { 0x0000775c, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00661000, 0x00000002 }, + { 0x0460275d, 0x00000020 }, + { 0x00004000, 0000000000 }, + { 0x00007999, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00661000, 0x00000002 }, + { 0x0460299b, 0x00000020 }, + { 0x00004000, 0000000000 }, + { 0x01e00830, 0x00000002 }, + { 0x21007000, 0000000000 }, + { 0x00005000, 0x00000002 }, + { 0x00038042, 0x00000002 }, + { 0x040025e0, 0x00000002 }, + { 0x000075e1, 0000000000 }, + { 0x00000001, 0000000000 }, + { 0x000380d9, 0x00000002 }, + { 0x04007394, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, +}; + + +static u32 radeon_cp_microcode[][2] = { + { 0x21007000, 0000000000 }, + { 0x20007000, 0000000000 }, + { 0x000000b4, 0x00000004 }, + { 0x000000b8, 0x00000004 }, + { 0x6f5b4d4c, 0000000000 }, + { 0x4c4c427f, 0000000000 }, + { 0x5b568a92, 0000000000 }, + { 0x4ca09c6d, 0000000000 }, + { 0xad4c4c4c, 0000000000 }, + { 0x4ce1af3d, 0000000000 }, + { 0xd8afafaf, 0000000000 }, + { 0xd64c4cdc, 0000000000 }, + { 0x4cd10d10, 0000000000 }, + { 0x000f0000, 0x00000016 }, + { 0x362f242d, 0000000000 }, + { 0x00000012, 0x00000004 }, + { 0x000f0000, 0x00000016 }, + { 0x362f282d, 0000000000 }, + { 0x000380e7, 0x00000002 }, + { 0x04002c97, 0x00000002 }, + { 0x000f0001, 0x00000016 }, + { 0x333a3730, 0000000000 }, + { 0x000077ef, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x00000021, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00061000, 0x00000002 }, + { 0x00000021, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00061000, 0x00000002 }, + { 0x00000021, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00000017, 0x00000004 }, + { 0x0003802b, 0x00000002 }, + { 0x040067e0, 0x00000002 }, + { 0x00000017, 0x00000004 }, + { 0x000077e0, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x000037e1, 0x00000002 }, + { 0x040067e1, 0x00000006 }, + { 0x000077e0, 0x00000002 }, + { 0x000077e1, 0x00000002 }, + { 0x000077e1, 0x00000006 }, + { 0xffffffff, 0000000000 }, + { 0x10000000, 0000000000 }, + { 0x0003802b, 0x00000002 }, + { 0x040067e0, 0x00000006 }, + { 0x00007675, 0x00000002 }, + { 0x00007676, 0x00000002 }, + { 0x00007677, 0x00000002 }, + { 0x00007678, 0x00000006 }, + { 0x0003802c, 0x00000002 }, + { 0x04002676, 0x00000002 }, + { 0x00007677, 0x00000002 }, + { 0x00007678, 0x00000006 }, + { 0x0000002f, 0x00000018 }, + { 0x0000002f, 0x00000018 }, + { 0000000000, 0x00000006 }, + { 0x00000030, 0x00000018 }, + { 0x00000030, 0x00000018 }, + { 0000000000, 0x00000006 }, + { 0x01605000, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x00098000, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x64c0603e, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00080000, 0x00000016 }, + { 0000000000, 0000000000 }, + { 0x0400251d, 0x00000002 }, + { 0x00007580, 0x00000002 }, + { 0x00067581, 0x00000002 }, + { 0x04002580, 0x00000002 }, + { 0x00067581, 0x00000002 }, + { 0x00000049, 0x00000004 }, + { 0x00005000, 0000000000 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x0000750e, 0x00000002 }, + { 0x00019000, 0x00000002 }, + { 0x00011055, 0x00000014 }, + { 0x00000055, 0x00000012 }, + { 0x0400250f, 0x00000002 }, + { 0x0000504f, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00007565, 0x00000002 }, + { 0x00007566, 0x00000002 }, + { 0x00000058, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x01e655b4, 0x00000002 }, + { 0x4401b0e4, 0x00000002 }, + { 0x01c110e4, 0x00000002 }, + { 0x26667066, 0x00000018 }, + { 0x040c2565, 0x00000002 }, + { 0x00000066, 0x00000018 }, + { 0x04002564, 0x00000002 }, + { 0x00007566, 0x00000002 }, + { 0x0000005d, 0x00000004 }, + { 0x00401069, 0x00000008 }, + { 0x00101000, 0x00000002 }, + { 0x000d80ff, 0x00000002 }, + { 0x0080006c, 0x00000008 }, + { 0x000f9000, 0x00000002 }, + { 0x000e00ff, 0x00000002 }, + { 0000000000, 0x00000006 }, + { 0x0000008f, 0x00000018 }, + { 0x0000005b, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00007576, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x00009000, 0x00000002 }, + { 0x00041000, 0x00000002 }, + { 0x0c00350e, 0x00000002 }, + { 0x00049000, 0x00000002 }, + { 0x00051000, 0x00000002 }, + { 0x01e785f8, 0x00000002 }, + { 0x00200000, 0x00000002 }, + { 0x0060007e, 0x0000000c }, + { 0x00007563, 0x00000002 }, + { 0x006075f0, 0x00000021 }, + { 0x20007073, 0x00000004 }, + { 0x00005073, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00007576, 0x00000002 }, + { 0x00007577, 0x00000002 }, + { 0x0000750e, 0x00000002 }, + { 0x0000750f, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00600083, 0x0000000c }, + { 0x006075f0, 0x00000021 }, + { 0x000075f8, 0x00000002 }, + { 0x00000083, 0x00000004 }, + { 0x000a750e, 0x00000002 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x0020750f, 0x00000002 }, + { 0x00600086, 0x00000004 }, + { 0x00007570, 0x00000002 }, + { 0x00007571, 0x00000002 }, + { 0x00007572, 0x00000006 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00005000, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00007568, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x00000095, 0x0000000c }, + { 0x00058000, 0x00000002 }, + { 0x0c607562, 0x00000002 }, + { 0x00000097, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00600096, 0x00000004 }, + { 0x400070e5, 0000000000 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x000380e5, 0x00000002 }, + { 0x000000a8, 0x0000001c }, + { 0x000650aa, 0x00000018 }, + { 0x040025bb, 0x00000002 }, + { 0x000610ab, 0x00000018 }, + { 0x040075bc, 0000000000 }, + { 0x000075bb, 0x00000002 }, + { 0x000075bc, 0000000000 }, + { 0x00090000, 0x00000006 }, + { 0x00090000, 0x00000002 }, + { 0x000d8002, 0x00000006 }, + { 0x00007832, 0x00000002 }, + { 0x00005000, 0x00000002 }, + { 0x000380e7, 0x00000002 }, + { 0x04002c97, 0x00000002 }, + { 0x00007820, 0x00000002 }, + { 0x00007821, 0x00000002 }, + { 0x00007800, 0000000000 }, + { 0x01200000, 0x00000002 }, + { 0x20077000, 0x00000002 }, + { 0x01200000, 0x00000002 }, + { 0x20007000, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x0120751b, 0x00000002 }, + { 0x8040750a, 0x00000002 }, + { 0x8040750b, 0x00000002 }, + { 0x00110000, 0x00000002 }, + { 0x000380e5, 0x00000002 }, + { 0x000000c6, 0x0000001c }, + { 0x000610ab, 0x00000018 }, + { 0x844075bd, 0x00000002 }, + { 0x000610aa, 0x00000018 }, + { 0x840075bb, 0x00000002 }, + { 0x000610ab, 0x00000018 }, + { 0x844075bc, 0x00000002 }, + { 0x000000c9, 0x00000004 }, + { 0x804075bd, 0x00000002 }, + { 0x800075bb, 0x00000002 }, + { 0x804075bc, 0x00000002 }, + { 0x00108000, 0x00000002 }, + { 0x01400000, 0x00000002 }, + { 0x006000cd, 0x0000000c }, + { 0x20c07000, 0x00000020 }, + { 0x000000cf, 0x00000012 }, + { 0x00800000, 0x00000006 }, + { 0x0080751d, 0x00000006 }, + { 0000000000, 0000000000 }, + { 0x0000775c, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00661000, 0x00000002 }, + { 0x0460275d, 0x00000020 }, + { 0x00004000, 0000000000 }, + { 0x01e00830, 0x00000002 }, + { 0x21007000, 0000000000 }, + { 0x6464614d, 0000000000 }, + { 0x69687420, 0000000000 }, + { 0x00000073, 0000000000 }, + { 0000000000, 0000000000 }, + { 0x00005000, 0x00000002 }, + { 0x000380d0, 0x00000002 }, + { 0x040025e0, 0x00000002 }, + { 0x000075e1, 0000000000 }, + { 0x00000001, 0000000000 }, + { 0x000380e0, 0x00000002 }, + { 0x04002394, 0x00000002 }, + { 0x00005000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0x00000008, 0000000000 }, + { 0x00000004, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, +}; + + +int RADEON_READ_PLL(drm_device_t *dev, int addr) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + + RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f); + return RADEON_READ(RADEON_CLOCK_CNTL_DATA); +} + +#if RADEON_FIFO_DEBUG +static void radeon_status( drm_radeon_private_t *dev_priv ) +{ + printk( "%s:\n", __FUNCTION__ ); + printk( "RBBM_STATUS = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_RBBM_STATUS ) ); + printk( "CP_RB_RTPR = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_CP_RB_RPTR ) ); + printk( "CP_RB_WTPR = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_CP_RB_WPTR ) ); + printk( "AIC_CNTL = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_CNTL ) ); + printk( "AIC_STAT = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_STAT ) ); + printk( "AIC_PT_BASE = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_PT_BASE ) ); + printk( "TLB_ADDR = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_TLB_ADDR ) ); + printk( "TLB_DATA = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_TLB_DATA ) ); +} +#endif + + +/* ================================================================ + * Engine, FIFO control + */ + +static int radeon_do_pixcache_flush( drm_radeon_private_t *dev_priv ) +{ + u32 tmp; + int i; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + tmp = RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ); + tmp |= RADEON_RB2D_DC_FLUSH_ALL; + RADEON_WRITE( RADEON_RB2D_DSTCACHE_CTLSTAT, tmp ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ) + & RADEON_RB2D_DC_BUSY) ) { + return 0; + } + DRM_UDELAY( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + return DRM_ERR(EBUSY); +} + +static int radeon_do_wait_for_fifo( drm_radeon_private_t *dev_priv, + int entries ) +{ + int i; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + int slots = ( RADEON_READ( RADEON_RBBM_STATUS ) + & RADEON_RBBM_FIFOCNT_MASK ); + if ( slots >= entries ) return 0; + DRM_UDELAY( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + return DRM_ERR(EBUSY); +} + +static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) +{ + int i, ret; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + ret = radeon_do_wait_for_fifo( dev_priv, 64 ); + if ( ret ) return ret; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(RADEON_READ( RADEON_RBBM_STATUS ) + & RADEON_RBBM_ACTIVE) ) { + radeon_do_pixcache_flush( dev_priv ); + return 0; + } + DRM_UDELAY( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + return DRM_ERR(EBUSY); +} + + +/* ================================================================ + * CP control, initialization + */ + +/* Load the microcode for the CP */ +static void radeon_cp_load_microcode( drm_radeon_private_t *dev_priv ) +{ + int i; + DRM_DEBUG( "\n" ); + + radeon_do_wait_for_idle( dev_priv ); + + RADEON_WRITE( RADEON_CP_ME_RAM_ADDR, 0 ); + + if (dev_priv->is_r200) + { + DRM_INFO("Loading R200 Microcode\n"); + for ( i = 0 ; i < 256 ; i++ ) + { + RADEON_WRITE( RADEON_CP_ME_RAM_DATAH, + R200_cp_microcode[i][1] ); + RADEON_WRITE( RADEON_CP_ME_RAM_DATAL, + R200_cp_microcode[i][0] ); + } + } + else + { + for ( i = 0 ; i < 256 ; i++ ) { + RADEON_WRITE( RADEON_CP_ME_RAM_DATAH, + radeon_cp_microcode[i][1] ); + RADEON_WRITE( RADEON_CP_ME_RAM_DATAL, + radeon_cp_microcode[i][0] ); + } + } +} + +/* Flush any pending commands to the CP. This should only be used just + * prior to a wait for idle, as it informs the engine that the command + * stream is ending. + */ +static void radeon_do_cp_flush( drm_radeon_private_t *dev_priv ) +{ + DRM_DEBUG( "\n" ); +#if 0 + u32 tmp; + + tmp = RADEON_READ( RADEON_CP_RB_WPTR ) | (1 << 31); + RADEON_WRITE( RADEON_CP_RB_WPTR, tmp ); +#endif +} + +/* Wait for the CP to go idle. + */ +int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ) +{ + RING_LOCALS; + DRM_DEBUG( "\n" ); + + BEGIN_RING( 6 ); + + RADEON_PURGE_CACHE(); + RADEON_PURGE_ZCACHE(); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); + COMMIT_RING(); + + return radeon_do_wait_for_idle( dev_priv ); +} + +/* Start the Command Processor. + */ +static void radeon_do_cp_start( drm_radeon_private_t *dev_priv ) +{ + RING_LOCALS; + DRM_DEBUG( "\n" ); + + radeon_do_wait_for_idle( dev_priv ); + + RADEON_WRITE( RADEON_CP_CSQ_CNTL, dev_priv->cp_mode ); + + dev_priv->cp_running = 1; + + BEGIN_RING( 6 ); + + RADEON_PURGE_CACHE(); + RADEON_PURGE_ZCACHE(); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); + COMMIT_RING(); +} + +/* Reset the Command Processor. This will not flush any pending + * commands, so you must wait for the CP command stream to complete + * before calling this routine. + */ +static void radeon_do_cp_reset( drm_radeon_private_t *dev_priv ) +{ + u32 cur_read_ptr; + DRM_DEBUG( "\n" ); + + cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); + RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); + *dev_priv->ring.head = cur_read_ptr; + dev_priv->ring.tail = cur_read_ptr; +} + +/* Stop the Command Processor. This will not flush any pending + * commands, so you must flush the command stream and wait for the CP + * to go idle before calling this routine. + */ +static void radeon_do_cp_stop( drm_radeon_private_t *dev_priv ) +{ + DRM_DEBUG( "\n" ); + + RADEON_WRITE( RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIDIS_INDDIS ); + + dev_priv->cp_running = 0; +} + +/* Reset the engine. This will stop the CP if it is running. + */ +static int radeon_do_engine_reset( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset; + DRM_DEBUG( "\n" ); + + radeon_do_pixcache_flush( dev_priv ); + + clock_cntl_index = RADEON_READ( RADEON_CLOCK_CNTL_INDEX ); + mclk_cntl = RADEON_READ_PLL( dev, RADEON_MCLK_CNTL ); + + RADEON_WRITE_PLL( RADEON_MCLK_CNTL, ( mclk_cntl | + RADEON_FORCEON_MCLKA | + RADEON_FORCEON_MCLKB | + RADEON_FORCEON_YCLKA | + RADEON_FORCEON_YCLKB | + RADEON_FORCEON_MC | + RADEON_FORCEON_AIC ) ); + + rbbm_soft_reset = RADEON_READ( RADEON_RBBM_SOFT_RESET ); + + RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset | + RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_SE | + RADEON_SOFT_RESET_RE | + RADEON_SOFT_RESET_PP | + RADEON_SOFT_RESET_E2 | + RADEON_SOFT_RESET_RB ) ); + RADEON_READ( RADEON_RBBM_SOFT_RESET ); + RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset & + ~( RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_SE | + RADEON_SOFT_RESET_RE | + RADEON_SOFT_RESET_PP | + RADEON_SOFT_RESET_E2 | + RADEON_SOFT_RESET_RB ) ) ); + RADEON_READ( RADEON_RBBM_SOFT_RESET ); + + + RADEON_WRITE_PLL( RADEON_MCLK_CNTL, mclk_cntl ); + RADEON_WRITE( RADEON_CLOCK_CNTL_INDEX, clock_cntl_index ); + RADEON_WRITE( RADEON_RBBM_SOFT_RESET, rbbm_soft_reset ); + + /* Reset the CP ring */ + radeon_do_cp_reset( dev_priv ); + + /* The CP is no longer running after an engine reset */ + dev_priv->cp_running = 0; + + /* Reset any pending vertex, indirect buffers */ + radeon_freelist_reset( dev ); + + return 0; +} + +static void radeon_cp_init_ring_buffer( drm_device_t *dev, + drm_radeon_private_t *dev_priv ) +{ + u32 ring_start, cur_read_ptr; + u32 tmp; + + /* Initialize the memory controller */ + RADEON_WRITE( RADEON_MC_FB_LOCATION, + (dev_priv->agp_vm_start - 1) & 0xffff0000 ); + + if ( !dev_priv->is_pci ) { + RADEON_WRITE( RADEON_MC_AGP_LOCATION, + (((dev_priv->agp_vm_start - 1 + + dev_priv->agp_size) & 0xffff0000) | + (dev_priv->agp_vm_start >> 16)) ); + } + +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + ring_start = (dev_priv->cp_ring->offset + - dev->agp->base + + dev_priv->agp_vm_start); + else +#endif + ring_start = (dev_priv->cp_ring->offset + - dev->sg->handle + + dev_priv->agp_vm_start); + + RADEON_WRITE( RADEON_CP_RB_BASE, ring_start ); + + /* Set the write pointer delay */ + RADEON_WRITE( RADEON_CP_RB_WPTR_DELAY, 0 ); + RADEON_READ( RADEON_CP_RB_WPTR_DELAY ); /* read back to propagate */ + + /* Initialize the ring buffer's read and write pointers */ + cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); + RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); + *dev_priv->ring.head = cur_read_ptr; + dev_priv->ring.tail = cur_read_ptr; + + if ( !dev_priv->is_pci ) { + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + } else { + drm_sg_mem_t *entry = dev->sg; + unsigned long tmp_ofs, page_ofs; + + tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; + page_ofs = tmp_ofs >> PAGE_SHIFT; + + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, + entry->busaddr[page_ofs]); + DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", + entry->busaddr[page_ofs], + entry->handle + tmp_ofs ); + } + + /* Initialize the scratch register pointer. This will cause + * the scratch register values to be written out to memory + * whenever they are updated. + * + * We simply put this behind the ring read pointer, this works + * with PCI GART as well as (whatever kind of) AGP GART + */ + RADEON_WRITE( RADEON_SCRATCH_ADDR, RADEON_READ( RADEON_CP_RB_RPTR_ADDR ) + + RADEON_SCRATCH_REG_OFFSET ); + + dev_priv->scratch = ((__volatile__ u32 *) + dev_priv->ring.head + + (RADEON_SCRATCH_REG_OFFSET / sizeof(u32))); + + RADEON_WRITE( RADEON_SCRATCH_UMSK, 0x7 ); + + /* Writeback doesn't seem to work everywhere, test it first */ + DRM_WRITE32( &dev_priv->scratch[1], 0 ); + RADEON_WRITE( RADEON_SCRATCH_REG1, 0xdeadbeef ); + + for ( tmp = 0 ; tmp < dev_priv->usec_timeout ; tmp++ ) { + if ( DRM_READ32( &dev_priv->scratch[1] ) == 0xdeadbeef ) + break; + DRM_UDELAY( 1 ); + } + + if ( tmp < dev_priv->usec_timeout ) { + dev_priv->writeback_works = 1; + DRM_DEBUG( "writeback test succeeded, tmp=%d\n", tmp ); + } else { + dev_priv->writeback_works = 0; + DRM_DEBUG( "writeback test failed\n" ); + } + + dev_priv->sarea_priv->last_frame = dev_priv->scratch[0] = 0; + RADEON_WRITE( RADEON_LAST_FRAME_REG, + dev_priv->sarea_priv->last_frame ); + + dev_priv->sarea_priv->last_dispatch = dev_priv->scratch[1] = 0; + RADEON_WRITE( RADEON_LAST_DISPATCH_REG, + dev_priv->sarea_priv->last_dispatch ); + + dev_priv->sarea_priv->last_clear = dev_priv->scratch[2] = 0; + RADEON_WRITE( RADEON_LAST_CLEAR_REG, + dev_priv->sarea_priv->last_clear ); + + /* Set ring buffer size */ +#ifdef __BIG_ENDIAN + RADEON_WRITE( RADEON_CP_RB_CNTL, dev_priv->ring.size_l2qw | RADEON_BUF_SWAP_32BIT ); +#else + RADEON_WRITE( RADEON_CP_RB_CNTL, dev_priv->ring.size_l2qw ); +#endif + + radeon_do_wait_for_idle( dev_priv ); + + /* Turn on bus mastering */ + tmp = RADEON_READ( RADEON_BUS_CNTL ) & ~RADEON_BUS_MASTER_DIS; + RADEON_WRITE( RADEON_BUS_CNTL, tmp ); + + /* Sync everything up */ + RADEON_WRITE( RADEON_ISYNC_CNTL, + (RADEON_ISYNC_ANY2D_IDLE3D | + RADEON_ISYNC_ANY3D_IDLE2D | + RADEON_ISYNC_WAIT_IDLEGUI | + RADEON_ISYNC_CPSCRATCH_IDLEGUI) ); +} + +static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) +{ + drm_radeon_private_t *dev_priv; + u32 tmp; + DRM_DEBUG( "\n" ); + + dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); + if ( dev_priv == NULL ) + return DRM_ERR(ENOMEM); + + memset( dev_priv, 0, sizeof(drm_radeon_private_t) ); + + dev_priv->is_pci = init->is_pci; + + if ( dev_priv->is_pci && !dev->sg ) { + DRM_ERROR( "PCI GART memory not allocated!\n" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + + dev_priv->usec_timeout = init->usec_timeout; + if ( dev_priv->usec_timeout < 1 || + dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) { + DRM_DEBUG( "TIMEOUT problem!\n" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + + dev_priv->is_r200 = (init->func == RADEON_INIT_R200_CP); + dev_priv->do_boxes = 0; + dev_priv->cp_mode = init->cp_mode; + + /* We don't support anything other than bus-mastering ring mode, + * but the ring can be in either AGP or PCI space for the ring + * read pointer. + */ + if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) && + ( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) { + DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + + switch ( init->fb_bpp ) { + case 16: + dev_priv->color_fmt = RADEON_COLOR_FORMAT_RGB565; + break; + case 32: + default: + dev_priv->color_fmt = RADEON_COLOR_FORMAT_ARGB8888; + break; + } + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; + + switch ( init->depth_bpp ) { + case 16: + dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; + break; + case 32: + default: + dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; + break; + } + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; + + dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) | + (dev_priv->front_offset >> 10)); + dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) | + (dev_priv->back_offset >> 10)); + dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) | + (dev_priv->depth_offset >> 10)); + + /* Hardware state for depth clears. Remove this if/when we no + * longer clear the depth buffer with a 3D rectangle. Hard-code + * all values to prevent unwanted 3D state from slipping through + * and screwing with the clear operation. + */ + dev_priv->depth_clear.rb3d_cntl = (RADEON_PLANE_MASK_ENABLE | + (dev_priv->color_fmt << 10) | + (1<<15)); + + dev_priv->depth_clear.rb3d_zstencilcntl = + (dev_priv->depth_fmt | + RADEON_Z_TEST_ALWAYS | + RADEON_STENCIL_TEST_ALWAYS | + RADEON_STENCIL_S_FAIL_REPLACE | + RADEON_STENCIL_ZPASS_REPLACE | + RADEON_STENCIL_ZFAIL_REPLACE | + RADEON_Z_WRITE_ENABLE); + + dev_priv->depth_clear.se_cntl = (RADEON_FFACE_CULL_CW | + RADEON_BFACE_SOLID | + RADEON_FFACE_SOLID | + RADEON_FLAT_SHADE_VTX_LAST | + RADEON_DIFFUSE_SHADE_FLAT | + RADEON_ALPHA_SHADE_FLAT | + RADEON_SPECULAR_SHADE_FLAT | + RADEON_FOG_SHADE_FLAT | + RADEON_VTX_PIX_CENTER_OGL | + RADEON_ROUND_MODE_TRUNC | + RADEON_ROUND_PREC_8TH_PIX); + + DRM_GETSAREA(); + + if(!dev_priv->sarea) { + DRM_ERROR("could not find sarea!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR("could not find framebuffer!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR("could not find mmio region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); + if(!dev_priv->cp_ring) { + DRM_ERROR("could not find cp ring region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + if(!dev_priv->ring_rptr) { + DRM_ERROR("could not find ring read pointer!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR("could not find dma buffer region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + + if ( !dev_priv->is_pci ) { + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); + if(!dev_priv->agp_textures) { + DRM_ERROR("could not find agp texture region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + } + + dev_priv->sarea_priv = + (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + if ( !dev_priv->is_pci ) { + DRM_IOREMAP( dev_priv->cp_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); + if(!dev_priv->cp_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { + DRM_ERROR("could not find ioremap agp regions!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(EINVAL); + } + } else { + dev_priv->cp_ring->handle = + (void *)dev_priv->cp_ring->offset; + dev_priv->ring_rptr->handle = + (void *)dev_priv->ring_rptr->offset; + dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; + + DRM_DEBUG( "dev_priv->cp_ring->handle %p\n", + dev_priv->cp_ring->handle ); + DRM_DEBUG( "dev_priv->ring_rptr->handle %p\n", + dev_priv->ring_rptr->handle ); + DRM_DEBUG( "dev_priv->buffers->handle %p\n", + dev_priv->buffers->handle ); + } + + + dev_priv->agp_size = init->agp_size; + dev_priv->agp_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ); +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + dev_priv->agp_buffers_offset = (dev_priv->buffers->offset + - dev->agp->base + + dev_priv->agp_vm_start); + else +#endif + dev_priv->agp_buffers_offset = (dev_priv->buffers->offset + - dev->sg->handle + + dev_priv->agp_vm_start); + + DRM_DEBUG( "dev_priv->agp_size %d\n", + dev_priv->agp_size ); + DRM_DEBUG( "dev_priv->agp_vm_start 0x%x\n", + dev_priv->agp_vm_start ); + DRM_DEBUG( "dev_priv->agp_buffers_offset 0x%lx\n", + dev_priv->agp_buffers_offset ); + + dev_priv->ring.head = ((__volatile__ u32 *) + dev_priv->ring_rptr->handle); + + dev_priv->ring.start = (u32 *)dev_priv->cp_ring->handle; + dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle + + init->ring_size / sizeof(u32)); + dev_priv->ring.size = init->ring_size; + dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); + + dev_priv->ring.tail_mask = + (dev_priv->ring.size / sizeof(u32)) - 1; + + dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; + +#if __REALLY_HAVE_SG + if ( dev_priv->is_pci ) { + if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + &dev_priv->bus_pci_gart)) { + DRM_ERROR( "failed to init PCI GART!\n" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return DRM_ERR(ENOMEM); + } + /* Turn on PCI GART + */ + tmp = RADEON_READ( RADEON_AIC_CNTL ) + | RADEON_PCIGART_TRANSLATE_EN; + RADEON_WRITE( RADEON_AIC_CNTL, tmp ); + + /* set PCI GART page-table base address + */ + RADEON_WRITE( RADEON_AIC_PT_BASE, dev_priv->bus_pci_gart ); + + /* set address range for PCI address translate + */ + RADEON_WRITE( RADEON_AIC_LO_ADDR, dev_priv->agp_vm_start ); + RADEON_WRITE( RADEON_AIC_HI_ADDR, dev_priv->agp_vm_start + + dev_priv->agp_size - 1); + + /* Turn off AGP aperture -- is this required for PCIGART? + */ + RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0xffffffc0 ); /* ?? */ + RADEON_WRITE( RADEON_AGP_COMMAND, 0 ); /* clear AGP_COMMAND */ + } else { +#endif /* __REALLY_HAVE_SG */ + /* Turn off PCI GART + */ + tmp = RADEON_READ( RADEON_AIC_CNTL ) + & ~RADEON_PCIGART_TRANSLATE_EN; + RADEON_WRITE( RADEON_AIC_CNTL, tmp ); +#if __REALLY_HAVE_SG + } +#endif /* __REALLY_HAVE_SG */ + + radeon_cp_load_microcode( dev_priv ); + radeon_cp_init_ring_buffer( dev, dev_priv ); + + dev_priv->last_buf = 0; + + dev->dev_private = (void *)dev_priv; + + radeon_do_engine_reset( dev ); + + return 0; +} + +int radeon_do_cleanup_cp( drm_device_t *dev ) +{ + DRM_DEBUG( "\n" ); + + if ( dev->dev_private ) { + drm_radeon_private_t *dev_priv = dev->dev_private; + + if ( !dev_priv->is_pci ) { + DRM_IOREMAPFREE( dev_priv->cp_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); + } else { +#if __REALLY_HAVE_SG + if (!DRM(ati_pcigart_cleanup)( dev, + dev_priv->phys_pci_gart, + dev_priv->bus_pci_gart )) + DRM_ERROR( "failed to cleanup PCI GART!\n" ); +#endif /* __REALLY_HAVE_SG */ + } + + DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int radeon_cp_init( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_init_t init; + + DRM_COPY_FROM_USER_IOCTL( init, (drm_radeon_init_t *)data, sizeof(init) ); + + switch ( init.func ) { + case RADEON_INIT_CP: + case RADEON_INIT_R200_CP: + return radeon_do_init_cp( dev, &init ); + case RADEON_CLEANUP_CP: + return radeon_do_cleanup_cp( dev ); + } + + return DRM_ERR(EINVAL); +} + +int radeon_cp_start( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( dev_priv->cp_running ) { + DRM_DEBUG( "%s while CP running\n", __FUNCTION__ ); + return 0; + } + if ( dev_priv->cp_mode == RADEON_CSQ_PRIDIS_INDDIS ) { + DRM_DEBUG( "%s called with bogus CP mode (%d)\n", + __FUNCTION__, dev_priv->cp_mode ); + return 0; + } + + radeon_do_cp_start( dev_priv ); + + return 0; +} + +/* Stop the CP. The engine must have been idled before calling this + * routine. + */ +int radeon_cp_stop( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_cp_stop_t stop; + int ret; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( stop, (drm_radeon_cp_stop_t *)data, sizeof(stop) ); + + /* Flush any pending CP commands. This ensures any outstanding + * commands are exectuted by the engine before we turn it off. + */ + if ( stop.flush ) { + radeon_do_cp_flush( dev_priv ); + } + + /* If we fail to make the engine go idle, we return an error + * code so that the DRM ioctl wrapper can try again. + */ + if ( stop.idle ) { + ret = radeon_do_cp_idle( dev_priv ); + if ( ret ) return ret; + } + + /* Finally, we can turn off the CP. If the engine isn't idle, + * we will get some dropped triangles as they won't be fully + * rendered before the CP is shut down. + */ + radeon_do_cp_stop( dev_priv ); + + /* Reset the engine */ + radeon_do_engine_reset( dev ); + + return 0; +} + +/* Just reset the CP ring. Called as part of an X Server engine reset. + */ +int radeon_cp_reset( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + radeon_do_cp_reset( dev_priv ); + + /* The CP is no longer running after an engine reset */ + dev_priv->cp_running = 0; + + return 0; +} + +int radeon_cp_idle( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + +/* if (dev->irq) */ +/* radeon_emit_and_wait_irq( dev ); */ + + return radeon_do_cp_idle( dev_priv ); +} + +int radeon_engine_reset( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + return radeon_do_engine_reset( dev ); +} + + +/* ================================================================ + * Fullscreen mode + */ + +/* KW: Deprecated to say the least: + */ +int radeon_fullscreen( DRM_IOCTL_ARGS ) +{ + return 0; +} + + +/* ================================================================ + * Freelist management + */ + +/* Original comment: FIXME: ROTATE_BUFS is a hack to cycle through + * bufs until freelist code is used. Note this hides a problem with + * the scratch register * (used to keep track of last buffer + * completed) being written to before * the last buffer has actually + * completed rendering. + * + * KW: It's also a good way to find free buffers quickly. + * + * KW: Ideally this loop wouldn't exist, and freelist_get wouldn't + * sleep. However, bugs in older versions of radeon_accel.c mean that + * we essentially have to do this, else old clients will break. + * + * However, it does leave open a potential deadlock where all the + * buffers are held by other clients, which can't release them because + * they can't get the lock. + */ + +drm_buf_t *radeon_freelist_get( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv; + drm_buf_t *buf; + int i, t; + int start; + + if ( ++dev_priv->last_buf >= dma->buf_count ) + dev_priv->last_buf = 0; + + start = dev_priv->last_buf; + + for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { + u32 done_age = GET_SCRATCH( 1 ); + DRM_DEBUG("done_age = %d\n",done_age); + for ( i = start ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pid == 0 || (buf->pending && + buf_priv->age <= done_age) ) { + dev_priv->stats.requested_bufs++; + buf->pending = 0; + return buf; + } + start = 0; + } + + if (t) { + DRM_UDELAY( 1 ); + dev_priv->stats.freelist_loops++; + } + } + + DRM_DEBUG( "returning NULL!\n" ); + return NULL; +} +#if 0 +drm_buf_t *radeon_freelist_get( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv; + drm_buf_t *buf; + int i, t; + int start; + u32 done_age = DRM_READ32(&dev_priv->scratch[1]); + + if ( ++dev_priv->last_buf >= dma->buf_count ) + dev_priv->last_buf = 0; + + start = dev_priv->last_buf; + dev_priv->stats.freelist_loops++; + + for ( t = 0 ; t < 2 ; t++ ) { + for ( i = start ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pid == 0 || (buf->pending && + buf_priv->age <= done_age) ) { + dev_priv->stats.requested_bufs++; + buf->pending = 0; + return buf; + } + } + start = 0; + } + + return NULL; +} +#endif + +void radeon_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_radeon_private_t *dev_priv = dev->dev_private; + int i; + + dev_priv->last_buf = 0; + for ( i = 0 ; i < dma->buf_count ; i++ ) { + drm_buf_t *buf = dma->buflist[i]; + drm_radeon_buf_priv_t *buf_priv = buf->dev_private; + buf_priv->age = 0; + } +} + + +/* ================================================================ + * CP command submission + */ + +int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) +{ + drm_radeon_ring_buffer_t *ring = &dev_priv->ring; + int i; + u32 last_head = GET_RING_HEAD(ring); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + u32 head = GET_RING_HEAD(ring); + + ring->space = (head - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; + if ( ring->space > n ) + return 0; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + if (head != last_head) + i = 0; + last_head = head; + + DRM_UDELAY( 1 ); + } + + /* FIXME: This return value is ignored in the BEGIN_RING macro! */ +#if RADEON_FIFO_DEBUG + radeon_status( dev_priv ); + DRM_ERROR( "failed!\n" ); +#endif + return DRM_ERR(EBUSY); +} + +static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + int i; + drm_buf_t *buf; + + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = radeon_freelist_get( dev ); + if ( !buf ) return DRM_ERR(EBUSY); /* NOTE: broken client */ + + buf->pid = DRM_CURRENTPID; + + if ( DRM_COPY_TO_USER( &d->request_indices[i], &buf->idx, + sizeof(buf->idx) ) ) + return DRM_ERR(EFAULT); + if ( DRM_COPY_TO_USER( &d->request_sizes[i], &buf->total, + sizeof(buf->total) ) ) + return DRM_ERR(EFAULT); + + d->granted_count++; + } + return 0; +} + +int radeon_cp_buffers( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_device_dma_t *dma = dev->dma; + int ret = 0; + drm_dma_t d; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( d, (drm_dma_t *)data, sizeof(d) ); + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + DRM_CURRENTPID, d.send_count ); + return DRM_ERR(EINVAL); + } + + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + DRM_CURRENTPID, d.request_count, dma->buf_count ); + return DRM_ERR(EINVAL); + } + + d.granted_count = 0; + + if ( d.request_count ) { + ret = radeon_cp_get_buffers( dev, &d ); + } + + DRM_COPY_TO_USER_IOCTL( (drm_dma_t *)data, d, sizeof(d) ); + + return ret; +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drm.h:1.3 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drm.h Mon Feb 17 10:29:23 2003 @@ -0,0 +1,576 @@ +/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + */ + +#ifndef __RADEON_DRM_H__ +#define __RADEON_DRM_H__ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the X server file (radeon_sarea.h) + */ +#ifndef __RADEON_SAREA_DEFINES__ +#define __RADEON_SAREA_DEFINES__ + +/* Old style state flags, required for sarea interface (1.1 and 1.2 + * clears) and 1.2 drm_vertex2 ioctl. + */ +#define RADEON_UPLOAD_CONTEXT 0x00000001 +#define RADEON_UPLOAD_VERTFMT 0x00000002 +#define RADEON_UPLOAD_LINE 0x00000004 +#define RADEON_UPLOAD_BUMPMAP 0x00000008 +#define RADEON_UPLOAD_MASKS 0x00000010 +#define RADEON_UPLOAD_VIEWPORT 0x00000020 +#define RADEON_UPLOAD_SETUP 0x00000040 +#define RADEON_UPLOAD_TCL 0x00000080 +#define RADEON_UPLOAD_MISC 0x00000100 +#define RADEON_UPLOAD_TEX0 0x00000200 +#define RADEON_UPLOAD_TEX1 0x00000400 +#define RADEON_UPLOAD_TEX2 0x00000800 +#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 +#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 +#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 +#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ +#define RADEON_REQUIRE_QUIESCENCE 0x00010000 +#define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */ +#define RADEON_UPLOAD_ALL 0x003effff +#define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff + + +/* New style per-packet identifiers for use in cmd_buffer ioctl with + * the RADEON_EMIT_PACKET command. Comments relate new packets to old + * state bits and the packet size: + */ +#define RADEON_EMIT_PP_MISC 0 /* context/7 */ +#define RADEON_EMIT_PP_CNTL 1 /* context/3 */ +#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ +#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ +#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ +#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ +#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ +#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ +#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ +#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ +#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ +#define RADEON_EMIT_RE_MISC 11 /* misc/1 */ +#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ +#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ +#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ +#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ +#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ +#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ +#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ +#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ +#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ +#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ +#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ +#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ +#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ +#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ +#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */ +#define R200_EMIT_TFACTOR_0 30 /* tf/7 */ +#define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */ +#define R200_EMIT_VAP_CTL 32 /* vap/1 */ +#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ +#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ +#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ +#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ +#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ +#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ +#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ +#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ +#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ +#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ +#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ +#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ +#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ +#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ +#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ +#define R200_EMIT_VTE_CNTL 48 /* vte/1 */ +#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ +#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ +#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ +#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ +#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ +#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ +#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ +#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ +#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ +#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ +#define R200_EMIT_PP_CUBIC_FACES_0 61 +#define R200_EMIT_PP_CUBIC_OFFSETS_0 62 +#define R200_EMIT_PP_CUBIC_FACES_1 63 +#define R200_EMIT_PP_CUBIC_OFFSETS_1 64 +#define R200_EMIT_PP_CUBIC_FACES_2 65 +#define R200_EMIT_PP_CUBIC_OFFSETS_2 66 +#define R200_EMIT_PP_CUBIC_FACES_3 67 +#define R200_EMIT_PP_CUBIC_OFFSETS_3 68 +#define R200_EMIT_PP_CUBIC_FACES_4 69 +#define R200_EMIT_PP_CUBIC_OFFSETS_4 70 +#define R200_EMIT_PP_CUBIC_FACES_5 71 +#define R200_EMIT_PP_CUBIC_OFFSETS_5 72 +#define RADEON_MAX_STATE_PACKETS 73 + + +/* Commands understood by cmd_buffer ioctl. More can be added but + * obviously these can't be removed or changed: + */ +#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ +#define RADEON_CMD_SCALARS 2 /* emit scalar data */ +#define RADEON_CMD_VECTORS 3 /* emit vector data */ +#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ +#define RADEON_CMD_PACKET3 5 /* emit hw packet */ +#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ +#define RADEON_CMD_SCALARS2 7 /* r200 stopgap */ +#define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: + * doesn't make the cpu wait, just + * the graphics hardware */ + + +typedef union { + int i; + struct { + unsigned char cmd_type, pad0, pad1, pad2; + } header; + struct { + unsigned char cmd_type, packet_id, pad0, pad1; + } packet; + struct { + unsigned char cmd_type, offset, stride, count; + } scalars; + struct { + unsigned char cmd_type, offset, stride, count; + } vectors; + struct { + unsigned char cmd_type, buf_idx, pad0, pad1; + } dma; + struct { + unsigned char cmd_type, flags, pad0, pad1; + } wait; +} drm_radeon_cmd_header_t; + +#define RADEON_WAIT_2D 0x1 +#define RADEON_WAIT_3D 0x2 + + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 +#define RADEON_STENCIL 0x8 + +/* Primitive types + */ +#define RADEON_POINTS 0x1 +#define RADEON_LINES 0x2 +#define RADEON_LINE_STRIP 0x3 +#define RADEON_TRIANGLES 0x4 +#define RADEON_TRIANGLE_FAN 0x5 +#define RADEON_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define RADEON_BUFFER_SIZE 65536 + +/* Byte offsets for indirect buffer data + */ +#define RADEON_INDEX_PRIM_OFFSET 20 + +#define RADEON_SCRATCH_REG_OFFSET 32 + +#define RADEON_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define RADEON_LOCAL_TEX_HEAP 0 +#define RADEON_AGP_TEX_HEAP 1 +#define RADEON_NR_TEX_HEAPS 2 +#define RADEON_NR_TEX_REGIONS 64 +#define RADEON_LOG_TEX_GRANULARITY 16 + +#define RADEON_MAX_TEXTURE_LEVELS 12 +#define RADEON_MAX_TEXTURE_UNITS 3 + +#endif /* __RADEON_SAREA_DEFINES__ */ + +typedef struct { + unsigned int red; + unsigned int green; + unsigned int blue; + unsigned int alpha; +} radeon_color_regs_t; + +typedef struct { + /* Context state */ + unsigned int pp_misc; /* 0x1c14 */ + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + + unsigned int pp_cntl; /* 0x1c38 */ + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + unsigned int se_cntl; + + /* Vertex format state */ + unsigned int se_coord_fmt; /* 0x1c50 */ + + /* Line state */ + unsigned int re_line_pattern; /* 0x1cd0 */ + unsigned int re_line_state; + + unsigned int se_line_width; /* 0x1db8 */ + + /* Bumpmap state */ + unsigned int pp_lum_matrix; /* 0x1d00 */ + + unsigned int pp_rot_matrix_0; /* 0x1d58 */ + unsigned int pp_rot_matrix_1; + + /* Mask state */ + unsigned int rb3d_stencilrefmask; /* 0x1d7c */ + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + + /* Viewport state */ + unsigned int se_vport_xscale; /* 0x1d98 */ + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + + /* Setup state */ + unsigned int se_cntl_status; /* 0x2140 */ + + /* Misc state */ + unsigned int re_top_left; /* 0x26c0 */ + unsigned int re_misc; +} drm_radeon_context_regs_t; + +typedef struct { + /* Zbias state */ + unsigned int se_zbias_factor; /* 0x1dac */ + unsigned int se_zbias_constant; +} drm_radeon_context2_regs_t; + + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + unsigned int pp_border_color; +} drm_radeon_texture_regs_t; + +typedef struct { + unsigned int start; + unsigned int finish; + unsigned int prim:8; + unsigned int stateidx:8; + unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ + unsigned int vc_format; /* vertex format */ +} drm_radeon_prim_t; + + +typedef struct { + drm_radeon_context_regs_t context; + drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS]; + drm_radeon_context2_regs_t context2; + unsigned int dirty; +} drm_radeon_state_t; + + +typedef struct { + unsigned char next, prev; + unsigned char in_use; + int age; +} drm_radeon_tex_region_t; + +typedef struct { + /* The channel for communication of state information to the + * kernel on firing a vertex buffer with either of the + * obsoleted vertex/index ioctls. + */ + drm_radeon_context_regs_t context_state; + drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + unsigned int last_clear; + + drm_radeon_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1]; + int tex_age[RADEON_NR_TEX_HEAPS]; + int ctx_owner; + int pfState; /* number of 3d windows (0,1,2ormore) */ + int pfCurrentPage; /* which buffer is being displayed? */ + int crtc2_base; /* CRTC2 frame offset */ +} drm_radeon_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmRadeon.h) + * + * KW: actually it's illegal to change any of this (backwards compatibility). + */ + +/* Radeon specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) +#define DRM_IOCTL_RADEON_CP_START DRM_IO( 0x41) +#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( 0x42, drm_radeon_cp_stop_t) +#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( 0x43) +#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_RADEON_RESET DRM_IO( 0x45) +#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t) +#define DRM_IOCTL_RADEON_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) +#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) +#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) +#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) +#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) +#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) +#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( 0x4f, drm_radeon_vertex2_t) +#define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( 0x50, drm_radeon_cmd_buffer_t) +#define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(0x51, drm_radeon_getparam_t) +#define DRM_IOCTL_RADEON_FLIP DRM_IO( 0x52) +#define DRM_IOCTL_RADEON_ALLOC DRM_IOWR( 0x53, drm_radeon_mem_alloc_t) +#define DRM_IOCTL_RADEON_FREE DRM_IOW( 0x54, drm_radeon_mem_free_t) +#define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( 0x55, drm_radeon_mem_init_heap_t) +#define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR( 0x56, drm_radeon_irq_emit_t) +#define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( 0x57, drm_radeon_irq_wait_t) + +typedef struct drm_radeon_init { + enum { + RADEON_INIT_CP = 0x01, + RADEON_CLEANUP_CP = 0x02, + RADEON_INIT_R200_CP = 0x03 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int agp_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drm_radeon_init_t; + +typedef struct drm_radeon_cp_stop { + int flush; + int idle; +} drm_radeon_cp_stop_t; + +typedef struct drm_radeon_fullscreen { + enum { + RADEON_INIT_FULLSCREEN = 0x01, + RADEON_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_radeon_fullscreen_t; + +#define CLEAR_X1 0 +#define CLEAR_Y1 1 +#define CLEAR_X2 2 +#define CLEAR_Y2 3 +#define CLEAR_DEPTH 4 + +typedef union drm_radeon_clear_rect { + float f[5]; + unsigned int ui[5]; +} drm_radeon_clear_rect_t; + +typedef struct drm_radeon_clear { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; /* misnamed field: should be stencil */ + drm_radeon_clear_rect_t *depth_boxes; +} drm_radeon_clear_t; + +typedef struct drm_radeon_vertex { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drm_radeon_vertex_t; + +typedef struct drm_radeon_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_radeon_indices_t; + +/* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices + * - allows multiple primitives and state changes in a single ioctl + * - supports driver change to emit native primitives + */ +typedef struct drm_radeon_vertex2 { + int idx; /* Index of vertex buffer */ + int discard; /* Client finished with buffer? */ + int nr_states; + drm_radeon_state_t *state; + int nr_prims; + drm_radeon_prim_t *prim; +} drm_radeon_vertex2_t; + +/* v1.3 - obsoletes drm_radeon_vertex2 + * - allows arbitarily large cliprect list + * - allows updating of tcl packet, vector and scalar state + * - allows memory-efficient description of state updates + * - allows state to be emitted without a primitive + * (for clears, ctx switches) + * - allows more than one dma buffer to be referenced per ioctl + * - supports tcl driver + * - may be extended in future versions with new cmd types, packets + */ +typedef struct drm_radeon_cmd_buffer { + int bufsz; + char *buf; + int nbox; + drm_clip_rect_t *boxes; +} drm_radeon_cmd_buffer_t; + +typedef struct drm_radeon_tex_image { + unsigned int x, y; /* Blit coordinates */ + unsigned int width, height; + const void *data; +} drm_radeon_tex_image_t; + +typedef struct drm_radeon_texture { + int offset; + int pitch; + int format; + int width; /* Texture image coordinates */ + int height; + drm_radeon_tex_image_t *image; +} drm_radeon_texture_t; + +typedef struct drm_radeon_stipple { + unsigned int *mask; +} drm_radeon_stipple_t; + +typedef struct drm_radeon_indirect { + int idx; + int start; + int end; + int discard; +} drm_radeon_indirect_t; + + +/* 1.3: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define RADEON_PARAM_AGP_BUFFER_OFFSET 1 /* card offset of 1st agp buffer */ +#define RADEON_PARAM_LAST_FRAME 2 +#define RADEON_PARAM_LAST_DISPATCH 3 +#define RADEON_PARAM_LAST_CLEAR 4 +#define RADEON_PARAM_IRQ_NR 5 +#define RADEON_PARAM_AGP_BASE 6 /* card offset of agp base */ + +typedef struct drm_radeon_getparam { + int param; + int *value; +} drm_radeon_getparam_t; + +/* 1.6: Set up a memory manager for regions of shared memory: + */ +#define RADEON_MEM_REGION_AGP 1 +#define RADEON_MEM_REGION_FB 2 + +typedef struct drm_radeon_mem_alloc { + int region; + int alignment; + int size; + int *region_offset; /* offset from start of fb or agp */ +} drm_radeon_mem_alloc_t; + +typedef struct drm_radeon_mem_free { + int region; + int region_offset; +} drm_radeon_mem_free_t; + +typedef struct drm_radeon_mem_init_heap { + int region; + int size; + int start; +} drm_radeon_mem_init_heap_t; + + +/* 1.6: Userspace can request & wait on irq's: + */ +typedef struct drm_radeon_irq_emit { + int *irq_seq; +} drm_radeon_irq_emit_t; + +typedef struct drm_radeon_irq_wait { + int irq_seq; +} drm_radeon_irq_wait_t; + + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drv.h:1.3 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drv.h Tue Feb 4 19:23:15 2003 @@ -0,0 +1,940 @@ +/* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __RADEON_DRV_H__ +#define __RADEON_DRV_H__ + +#define GET_RING_HEAD(ring) DRM_READ32( (volatile u32 *) (ring)->head ) +#define SET_RING_HEAD(ring,val) DRM_WRITE32( (volatile u32 *) (ring)->head , (val)) + +typedef struct drm_radeon_freelist { + unsigned int age; + drm_buf_t *buf; + struct drm_radeon_freelist *next; + struct drm_radeon_freelist *prev; +} drm_radeon_freelist_t; + +typedef struct drm_radeon_ring_buffer { + u32 *start; + u32 *end; + int size; + int size_l2qw; + + volatile u32 *head; + u32 tail; + u32 tail_mask; + int space; + + int high_mark; +} drm_radeon_ring_buffer_t; + +typedef struct drm_radeon_depth_clear_t { + u32 rb3d_cntl; + u32 rb3d_zstencilcntl; + u32 se_cntl; +} drm_radeon_depth_clear_t; + + +struct mem_block { + struct mem_block *next; + struct mem_block *prev; + int start; + int size; + int pid; /* 0: free, -1: heap, other: real pids */ +}; + +typedef struct drm_radeon_private { + drm_radeon_ring_buffer_t ring; + drm_radeon_sarea_t *sarea_priv; + + int agp_size; + u32 agp_vm_start; + unsigned long agp_buffers_offset; + + int cp_mode; + int cp_running; + + drm_radeon_freelist_t *head; + drm_radeon_freelist_t *tail; + int last_buf; + volatile u32 *scratch; + int writeback_works; + + int usec_timeout; + + int is_r200; + + int is_pci; + unsigned long phys_pci_gart; + dma_addr_t bus_pci_gart; + + struct { + u32 boxes; + int freelist_timeouts; + int freelist_loops; + int requested_bufs; + int last_frame_reads; + int last_clear_reads; + int clears; + int texture_uploads; + } stats; + + int do_boxes; + int page_flipping; + int current_page; + + u32 color_fmt; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + u32 depth_fmt; + unsigned int depth_offset; + unsigned int depth_pitch; + + u32 front_pitch_offset; + u32 back_pitch_offset; + u32 depth_pitch_offset; + + drm_radeon_depth_clear_t depth_clear; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *cp_ring; + drm_map_t *ring_rptr; + drm_map_t *buffers; + drm_map_t *agp_textures; + + struct mem_block *agp_heap; + struct mem_block *fb_heap; + + /* SW interrupt */ + wait_queue_head_t swi_queue; + atomic_t swi_emitted; + +} drm_radeon_private_t; + +typedef struct drm_radeon_buf_priv { + u32 age; +} drm_radeon_buf_priv_t; + + /* radeon_cp.c */ +extern int radeon_cp_init( DRM_IOCTL_ARGS ); +extern int radeon_cp_start( DRM_IOCTL_ARGS ); +extern int radeon_cp_stop( DRM_IOCTL_ARGS ); +extern int radeon_cp_reset( DRM_IOCTL_ARGS ); +extern int radeon_cp_idle( DRM_IOCTL_ARGS ); +extern int radeon_engine_reset( DRM_IOCTL_ARGS ); +extern int radeon_fullscreen( DRM_IOCTL_ARGS ); +extern int radeon_cp_buffers( DRM_IOCTL_ARGS ); + +extern void radeon_freelist_reset( drm_device_t *dev ); +extern drm_buf_t *radeon_freelist_get( drm_device_t *dev ); + +extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ); + +extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ); +extern int radeon_do_cleanup_cp( drm_device_t *dev ); +extern int radeon_do_cleanup_pageflip( drm_device_t *dev ); + + /* radeon_state.c */ +extern int radeon_cp_clear( DRM_IOCTL_ARGS ); +extern int radeon_cp_swap( DRM_IOCTL_ARGS ); +extern int radeon_cp_vertex( DRM_IOCTL_ARGS ); +extern int radeon_cp_indices( DRM_IOCTL_ARGS ); +extern int radeon_cp_texture( DRM_IOCTL_ARGS ); +extern int radeon_cp_stipple( DRM_IOCTL_ARGS ); +extern int radeon_cp_indirect( DRM_IOCTL_ARGS ); +extern int radeon_cp_vertex2( DRM_IOCTL_ARGS ); +extern int radeon_cp_cmdbuf( DRM_IOCTL_ARGS ); +extern int radeon_cp_getparam( DRM_IOCTL_ARGS ); +extern int radeon_cp_flip( DRM_IOCTL_ARGS ); + +extern int radeon_mem_alloc( DRM_IOCTL_ARGS ); +extern int radeon_mem_free( DRM_IOCTL_ARGS ); +extern int radeon_mem_init_heap( DRM_IOCTL_ARGS ); +extern void radeon_mem_takedown( struct mem_block **heap ); +extern void radeon_mem_release( struct mem_block *heap ); + + /* radeon_irq.c */ +extern int radeon_irq_emit( DRM_IOCTL_ARGS ); +extern int radeon_irq_wait( DRM_IOCTL_ARGS ); + +extern int radeon_emit_and_wait_irq(drm_device_t *dev); +extern int radeon_wait_irq(drm_device_t *dev, int swi_nr); +extern int radeon_emit_irq(drm_device_t *dev); + + +/* Flags for stats.boxes + */ +#define RADEON_BOX_DMA_IDLE 0x1 +#define RADEON_BOX_RING_FULL 0x2 +#define RADEON_BOX_FLIP 0x4 +#define RADEON_BOX_WAIT_IDLE 0x8 +#define RADEON_BOX_TEXTURE_LOAD 0x10 + + + +/* Register definitions, register access macros and drmAddMap constants + * for Radeon kernel driver. + */ + +#define RADEON_AGP_COMMAND 0x0f60 +#define RADEON_AUX_SCISSOR_CNTL 0x26f0 +# define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) +# define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) +# define RADEON_EXCLUSIVE_SCISSOR_2 (1 << 26) +# define RADEON_SCISSOR_0_ENABLE (1 << 28) +# define RADEON_SCISSOR_1_ENABLE (1 << 29) +# define RADEON_SCISSOR_2_ENABLE (1 << 30) + +#define RADEON_BUS_CNTL 0x0030 +# define RADEON_BUS_MASTER_DIS (1 << 6) + +#define RADEON_CLOCK_CNTL_DATA 0x000c +# define RADEON_PLL_WR_EN (1 << 7) +#define RADEON_CLOCK_CNTL_INDEX 0x0008 +#define RADEON_CONFIG_APER_SIZE 0x0108 +#define RADEON_CRTC_OFFSET 0x0224 +#define RADEON_CRTC_OFFSET_CNTL 0x0228 +# define RADEON_CRTC_TILE_EN (1 << 15) +# define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) +#define RADEON_CRTC2_OFFSET 0x0324 +#define RADEON_CRTC2_OFFSET_CNTL 0x0328 + +#define RADEON_RB3D_COLORPITCH 0x1c48 + +#define RADEON_DP_GUI_MASTER_CNTL 0x146c +# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define RADEON_GMC_BRUSH_NONE (15 << 4) +# define RADEON_GMC_DST_16BPP (4 << 8) +# define RADEON_GMC_DST_24BPP (5 << 8) +# define RADEON_GMC_DST_32BPP (6 << 8) +# define RADEON_GMC_DST_DATATYPE_SHIFT 8 +# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) +# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define RADEON_GMC_WR_MSK_DIS (1 << 30) +# define RADEON_ROP3_S 0x00cc0000 +# define RADEON_ROP3_P 0x00f00000 +#define RADEON_DP_WRITE_MASK 0x16cc +#define RADEON_DST_PITCH_OFFSET 0x142c +#define RADEON_DST_PITCH_OFFSET_C 0x1c80 +# define RADEON_DST_TILE_LINEAR (0 << 30) +# define RADEON_DST_TILE_MACRO (1 << 30) +# define RADEON_DST_TILE_MICRO (2 << 30) +# define RADEON_DST_TILE_BOTH (3 << 30) + +#define RADEON_SCRATCH_REG0 0x15e0 +#define RADEON_SCRATCH_REG1 0x15e4 +#define RADEON_SCRATCH_REG2 0x15e8 +#define RADEON_SCRATCH_REG3 0x15ec +#define RADEON_SCRATCH_REG4 0x15f0 +#define RADEON_SCRATCH_REG5 0x15f4 +#define RADEON_SCRATCH_UMSK 0x0770 +#define RADEON_SCRATCH_ADDR 0x0774 + +#define GET_SCRATCH( x ) (dev_priv->writeback_works \ + ? DRM_READ32( &dev_priv->scratch[(x)] ) \ + : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) ) + + +#define RADEON_GEN_INT_CNTL 0x0040 +# define RADEON_CRTC_VBLANK_MASK (1 << 0) +# define RADEON_GUI_IDLE_INT_ENABLE (1 << 19) +# define RADEON_SW_INT_ENABLE (1 << 25) + +#define RADEON_GEN_INT_STATUS 0x0044 +# define RADEON_CRTC_VBLANK_STAT (1 << 0) +# define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0) +# define RADEON_GUI_IDLE_INT_TEST_ACK (1 << 19) +# define RADEON_SW_INT_TEST (1 << 25) +# define RADEON_SW_INT_TEST_ACK (1 << 25) +# define RADEON_SW_INT_FIRE (1 << 26) + +#define RADEON_HOST_PATH_CNTL 0x0130 +# define RADEON_HDP_SOFT_RESET (1 << 26) +# define RADEON_HDP_WC_TIMEOUT_MASK (7 << 28) +# define RADEON_HDP_WC_TIMEOUT_28BCLK (7 << 28) + +#define RADEON_ISYNC_CNTL 0x1724 +# define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0) +# define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1) +# define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2) +# define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3) +# define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4) +# define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5) + +#define RADEON_RBBM_GUICNTL 0x172c +# define RADEON_HOST_DATA_SWAP_NONE (0 << 0) +# define RADEON_HOST_DATA_SWAP_16BIT (1 << 0) +# define RADEON_HOST_DATA_SWAP_32BIT (2 << 0) +# define RADEON_HOST_DATA_SWAP_HDW (3 << 0) + +#define RADEON_MC_AGP_LOCATION 0x014c +#define RADEON_MC_FB_LOCATION 0x0148 +#define RADEON_MCLK_CNTL 0x0012 +# define RADEON_FORCEON_MCLKA (1 << 16) +# define RADEON_FORCEON_MCLKB (1 << 17) +# define RADEON_FORCEON_YCLKA (1 << 18) +# define RADEON_FORCEON_YCLKB (1 << 19) +# define RADEON_FORCEON_MC (1 << 20) +# define RADEON_FORCEON_AIC (1 << 21) + +#define RADEON_PP_BORDER_COLOR_0 0x1d40 +#define RADEON_PP_BORDER_COLOR_1 0x1d44 +#define RADEON_PP_BORDER_COLOR_2 0x1d48 +#define RADEON_PP_CNTL 0x1c38 +# define RADEON_SCISSOR_ENABLE (1 << 1) +#define RADEON_PP_LUM_MATRIX 0x1d00 +#define RADEON_PP_MISC 0x1c14 +#define RADEON_PP_ROT_MATRIX_0 0x1d58 +#define RADEON_PP_TXFILTER_0 0x1c54 +#define RADEON_PP_TXFILTER_1 0x1c6c +#define RADEON_PP_TXFILTER_2 0x1c84 + +#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c +# define RADEON_RB2D_DC_FLUSH (3 << 0) +# define RADEON_RB2D_DC_FREE (3 << 2) +# define RADEON_RB2D_DC_FLUSH_ALL 0xf +# define RADEON_RB2D_DC_BUSY (1 << 31) +#define RADEON_RB3D_CNTL 0x1c3c +# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) +# define RADEON_PLANE_MASK_ENABLE (1 << 1) +# define RADEON_DITHER_ENABLE (1 << 2) +# define RADEON_ROUND_ENABLE (1 << 3) +# define RADEON_SCALE_DITHER_ENABLE (1 << 4) +# define RADEON_DITHER_INIT (1 << 5) +# define RADEON_ROP_ENABLE (1 << 6) +# define RADEON_STENCIL_ENABLE (1 << 7) +# define RADEON_Z_ENABLE (1 << 8) +#define RADEON_RB3D_DEPTHOFFSET 0x1c24 +#define RADEON_RB3D_DEPTHPITCH 0x1c28 +#define RADEON_RB3D_PLANEMASK 0x1d84 +#define RADEON_RB3D_STENCILREFMASK 0x1d7c +#define RADEON_RB3D_ZCACHE_MODE 0x3250 +#define RADEON_RB3D_ZCACHE_CTLSTAT 0x3254 +# define RADEON_RB3D_ZC_FLUSH (1 << 0) +# define RADEON_RB3D_ZC_FREE (1 << 2) +# define RADEON_RB3D_ZC_FLUSH_ALL 0x5 +# define RADEON_RB3D_ZC_BUSY (1 << 31) +#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c +# define RADEON_Z_TEST_MASK (7 << 4) +# define RADEON_Z_TEST_ALWAYS (7 << 4) +# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) +# define RADEON_STENCIL_S_FAIL_REPLACE (2 << 16) +# define RADEON_STENCIL_ZPASS_REPLACE (2 << 20) +# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24) +# define RADEON_Z_WRITE_ENABLE (1 << 30) +#define RADEON_RBBM_SOFT_RESET 0x00f0 +# define RADEON_SOFT_RESET_CP (1 << 0) +# define RADEON_SOFT_RESET_HI (1 << 1) +# define RADEON_SOFT_RESET_SE (1 << 2) +# define RADEON_SOFT_RESET_RE (1 << 3) +# define RADEON_SOFT_RESET_PP (1 << 4) +# define RADEON_SOFT_RESET_E2 (1 << 5) +# define RADEON_SOFT_RESET_RB (1 << 6) +# define RADEON_SOFT_RESET_HDP (1 << 7) +#define RADEON_RBBM_STATUS 0x0e40 +# define RADEON_RBBM_FIFOCNT_MASK 0x007f +# define RADEON_RBBM_ACTIVE (1 << 31) +#define RADEON_RE_LINE_PATTERN 0x1cd0 +#define RADEON_RE_MISC 0x26c4 +#define RADEON_RE_TOP_LEFT 0x26c0 +#define RADEON_RE_WIDTH_HEIGHT 0x1c44 +#define RADEON_RE_STIPPLE_ADDR 0x1cc8 +#define RADEON_RE_STIPPLE_DATA 0x1ccc + +#define RADEON_SCISSOR_TL_0 0x1cd8 +#define RADEON_SCISSOR_BR_0 0x1cdc +#define RADEON_SCISSOR_TL_1 0x1ce0 +#define RADEON_SCISSOR_BR_1 0x1ce4 +#define RADEON_SCISSOR_TL_2 0x1ce8 +#define RADEON_SCISSOR_BR_2 0x1cec +#define RADEON_SE_COORD_FMT 0x1c50 +#define RADEON_SE_CNTL 0x1c4c +# define RADEON_FFACE_CULL_CW (0 << 0) +# define RADEON_BFACE_SOLID (3 << 1) +# define RADEON_FFACE_SOLID (3 << 3) +# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) +# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) +# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) +# define RADEON_ALPHA_SHADE_FLAT (1 << 10) +# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) +# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) +# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) +# define RADEON_FOG_SHADE_FLAT (1 << 14) +# define RADEON_FOG_SHADE_GOURAUD (2 << 14) +# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) +# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) +# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) +# define RADEON_ROUND_MODE_TRUNC (0 << 28) +# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) +#define RADEON_SE_CNTL_STATUS 0x2140 +#define RADEON_SE_LINE_WIDTH 0x1db8 +#define RADEON_SE_VPORT_XSCALE 0x1d98 +#define RADEON_SE_ZBIAS_FACTOR 0x1db0 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED 0x2210 +#define RADEON_SE_TCL_OUTPUT_VTX_FMT 0x2254 +#define RADEON_SE_TCL_VECTOR_INDX_REG 0x2200 +# define RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT 16 +# define RADEON_VEC_INDX_DWORD_COUNT_SHIFT 28 +#define RADEON_SE_TCL_VECTOR_DATA_REG 0x2204 +#define RADEON_SE_TCL_SCALAR_INDX_REG 0x2208 +# define RADEON_SCAL_INDX_DWORD_STRIDE_SHIFT 16 +#define RADEON_SE_TCL_SCALAR_DATA_REG 0x220C +#define RADEON_SURFACE_ACCESS_FLAGS 0x0bf8 +#define RADEON_SURFACE_ACCESS_CLR 0x0bfc +#define RADEON_SURFACE_CNTL 0x0b00 +# define RADEON_SURF_TRANSLATION_DIS (1 << 8) +# define RADEON_NONSURF_AP0_SWP_MASK (3 << 20) +# define RADEON_NONSURF_AP0_SWP_LITTLE (0 << 20) +# define RADEON_NONSURF_AP0_SWP_BIG16 (1 << 20) +# define RADEON_NONSURF_AP0_SWP_BIG32 (2 << 20) +# define RADEON_NONSURF_AP1_SWP_MASK (3 << 22) +# define RADEON_NONSURF_AP1_SWP_LITTLE (0 << 22) +# define RADEON_NONSURF_AP1_SWP_BIG16 (1 << 22) +# define RADEON_NONSURF_AP1_SWP_BIG32 (2 << 22) +#define RADEON_SURFACE0_INFO 0x0b0c +# define RADEON_SURF_PITCHSEL_MASK (0x1ff << 0) +# define RADEON_SURF_TILE_MODE_MASK (3 << 16) +# define RADEON_SURF_TILE_MODE_MACRO (0 << 16) +# define RADEON_SURF_TILE_MODE_MICRO (1 << 16) +# define RADEON_SURF_TILE_MODE_32BIT_Z (2 << 16) +# define RADEON_SURF_TILE_MODE_16BIT_Z (3 << 16) +#define RADEON_SURFACE0_LOWER_BOUND 0x0b04 +#define RADEON_SURFACE0_UPPER_BOUND 0x0b08 +#define RADEON_SURFACE1_INFO 0x0b1c +#define RADEON_SURFACE1_LOWER_BOUND 0x0b14 +#define RADEON_SURFACE1_UPPER_BOUND 0x0b18 +#define RADEON_SURFACE2_INFO 0x0b2c +#define RADEON_SURFACE2_LOWER_BOUND 0x0b24 +#define RADEON_SURFACE2_UPPER_BOUND 0x0b28 +#define RADEON_SURFACE3_INFO 0x0b3c +#define RADEON_SURFACE3_LOWER_BOUND 0x0b34 +#define RADEON_SURFACE3_UPPER_BOUND 0x0b38 +#define RADEON_SURFACE4_INFO 0x0b4c +#define RADEON_SURFACE4_LOWER_BOUND 0x0b44 +#define RADEON_SURFACE4_UPPER_BOUND 0x0b48 +#define RADEON_SURFACE5_INFO 0x0b5c +#define RADEON_SURFACE5_LOWER_BOUND 0x0b54 +#define RADEON_SURFACE5_UPPER_BOUND 0x0b58 +#define RADEON_SURFACE6_INFO 0x0b6c +#define RADEON_SURFACE6_LOWER_BOUND 0x0b64 +#define RADEON_SURFACE6_UPPER_BOUND 0x0b68 +#define RADEON_SURFACE7_INFO 0x0b7c +#define RADEON_SURFACE7_LOWER_BOUND 0x0b74 +#define RADEON_SURFACE7_UPPER_BOUND 0x0b78 +#define RADEON_SW_SEMAPHORE 0x013c + +#define RADEON_WAIT_UNTIL 0x1720 +# define RADEON_WAIT_CRTC_PFLIP (1 << 0) +# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) +# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) +# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) + +#define RADEON_RB3D_ZMASKOFFSET 0x1c34 +#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c +# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) + + +/* CP registers */ +#define RADEON_CP_ME_RAM_ADDR 0x07d4 +#define RADEON_CP_ME_RAM_RADDR 0x07d8 +#define RADEON_CP_ME_RAM_DATAH 0x07dc +#define RADEON_CP_ME_RAM_DATAL 0x07e0 + +#define RADEON_CP_RB_BASE 0x0700 +#define RADEON_CP_RB_CNTL 0x0704 +# define RADEON_BUF_SWAP_32BIT (2 << 16) +#define RADEON_CP_RB_RPTR_ADDR 0x070c +#define RADEON_CP_RB_RPTR 0x0710 +#define RADEON_CP_RB_WPTR 0x0714 + +#define RADEON_CP_RB_WPTR_DELAY 0x0718 +# define RADEON_PRE_WRITE_TIMER_SHIFT 0 +# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 + +#define RADEON_CP_IB_BASE 0x0738 + +#define RADEON_CP_CSQ_CNTL 0x0740 +# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) +# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) +# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) +# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) +# define RADEON_CSQ_PRIBM_INDBM (4 << 28) +# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) + +#define RADEON_AIC_CNTL 0x01d0 +# define RADEON_PCIGART_TRANSLATE_EN (1 << 0) +#define RADEON_AIC_STAT 0x01d4 +#define RADEON_AIC_PT_BASE 0x01d8 +#define RADEON_AIC_LO_ADDR 0x01dc +#define RADEON_AIC_HI_ADDR 0x01e0 +#define RADEON_AIC_TLB_ADDR 0x01e4 +#define RADEON_AIC_TLB_DATA 0x01e8 + +/* CP command packets */ +#define RADEON_CP_PACKET0 0x00000000 +# define RADEON_ONE_REG_WR (1 << 15) +#define RADEON_CP_PACKET1 0x40000000 +#define RADEON_CP_PACKET2 0x80000000 +#define RADEON_CP_PACKET3 0xC0000000 +# define RADEON_3D_RNDR_GEN_INDX_PRIM 0x00002300 +# define RADEON_WAIT_FOR_IDLE 0x00002600 +# define RADEON_3D_DRAW_VBUF 0x00002800 +# define RADEON_3D_DRAW_IMMD 0x00002900 +# define RADEON_3D_DRAW_INDX 0x00002A00 +# define RADEON_3D_LOAD_VBPNTR 0x00002F00 +# define RADEON_CNTL_HOSTDATA_BLT 0x00009400 +# define RADEON_CNTL_PAINT_MULTI 0x00009A00 +# define RADEON_CNTL_BITBLT_MULTI 0x00009B00 +# define RADEON_CNTL_SET_SCISSORS 0xC0001E00 + +#define RADEON_CP_PACKET_MASK 0xC0000000 +#define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 +#define RADEON_CP_PACKET0_REG_MASK 0x000007ff +#define RADEON_CP_PACKET1_REG0_MASK 0x000007ff +#define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 + +#define RADEON_VTX_Z_PRESENT (1 << 31) +#define RADEON_VTX_PKCOLOR_PRESENT (1 << 3) + +#define RADEON_PRIM_TYPE_NONE (0 << 0) +#define RADEON_PRIM_TYPE_POINT (1 << 0) +#define RADEON_PRIM_TYPE_LINE (2 << 0) +#define RADEON_PRIM_TYPE_LINE_STRIP (3 << 0) +#define RADEON_PRIM_TYPE_TRI_LIST (4 << 0) +#define RADEON_PRIM_TYPE_TRI_FAN (5 << 0) +#define RADEON_PRIM_TYPE_TRI_STRIP (6 << 0) +#define RADEON_PRIM_TYPE_TRI_TYPE2 (7 << 0) +#define RADEON_PRIM_TYPE_RECT_LIST (8 << 0) +#define RADEON_PRIM_TYPE_3VRT_POINT_LIST (9 << 0) +#define RADEON_PRIM_TYPE_3VRT_LINE_LIST (10 << 0) +#define RADEON_PRIM_TYPE_MASK 0xf +#define RADEON_PRIM_WALK_IND (1 << 4) +#define RADEON_PRIM_WALK_LIST (2 << 4) +#define RADEON_PRIM_WALK_RING (3 << 4) +#define RADEON_COLOR_ORDER_BGRA (0 << 6) +#define RADEON_COLOR_ORDER_RGBA (1 << 6) +#define RADEON_MAOS_ENABLE (1 << 7) +#define RADEON_VTX_FMT_R128_MODE (0 << 8) +#define RADEON_VTX_FMT_RADEON_MODE (1 << 8) +#define RADEON_NUM_VERTICES_SHIFT 16 + +#define RADEON_COLOR_FORMAT_CI8 2 +#define RADEON_COLOR_FORMAT_ARGB1555 3 +#define RADEON_COLOR_FORMAT_RGB565 4 +#define RADEON_COLOR_FORMAT_ARGB8888 6 +#define RADEON_COLOR_FORMAT_RGB332 7 +#define RADEON_COLOR_FORMAT_RGB8 9 +#define RADEON_COLOR_FORMAT_ARGB4444 15 + +#define RADEON_TXFORMAT_I8 0 +#define RADEON_TXFORMAT_AI88 1 +#define RADEON_TXFORMAT_RGB332 2 +#define RADEON_TXFORMAT_ARGB1555 3 +#define RADEON_TXFORMAT_RGB565 4 +#define RADEON_TXFORMAT_ARGB4444 5 +#define RADEON_TXFORMAT_ARGB8888 6 +#define RADEON_TXFORMAT_RGBA8888 7 +#define RADEON_TXFORMAT_VYUY422 10 +#define RADEON_TXFORMAT_YVYU422 11 +#define RADEON_TXFORMAT_DXT1 12 +#define RADEON_TXFORMAT_DXT23 14 +#define RADEON_TXFORMAT_DXT45 15 + +#define R200_PP_TXCBLEND_0 0x2f00 +#define R200_PP_TXCBLEND_1 0x2f10 +#define R200_PP_TXCBLEND_2 0x2f20 +#define R200_PP_TXCBLEND_3 0x2f30 +#define R200_PP_TXCBLEND_4 0x2f40 +#define R200_PP_TXCBLEND_5 0x2f50 +#define R200_PP_TXCBLEND_6 0x2f60 +#define R200_PP_TXCBLEND_7 0x2f70 +#define R200_SE_TCL_LIGHT_MODEL_CTL_0 0x2268 +#define R200_PP_TFACTOR_0 0x2ee0 +#define R200_SE_VTX_FMT_0 0x2088 +#define R200_SE_VAP_CNTL 0x2080 +#define R200_SE_TCL_MATRIX_SEL_0 0x2230 +#define R200_SE_TCL_TEX_PROC_CTL_2 0x22a8 +#define R200_SE_TCL_UCP_VERT_BLEND_CTL 0x22c0 +#define R200_PP_TXFILTER_5 0x2ca0 +#define R200_PP_TXFILTER_4 0x2c80 +#define R200_PP_TXFILTER_3 0x2c60 +#define R200_PP_TXFILTER_2 0x2c40 +#define R200_PP_TXFILTER_1 0x2c20 +#define R200_PP_TXFILTER_0 0x2c00 +#define R200_PP_TXOFFSET_5 0x2d78 +#define R200_PP_TXOFFSET_4 0x2d60 +#define R200_PP_TXOFFSET_3 0x2d48 +#define R200_PP_TXOFFSET_2 0x2d30 +#define R200_PP_TXOFFSET_1 0x2d18 +#define R200_PP_TXOFFSET_0 0x2d00 + +#define R200_PP_CUBIC_FACES_0 0x2c18 +#define R200_PP_CUBIC_FACES_1 0x2c38 +#define R200_PP_CUBIC_FACES_2 0x2c58 +#define R200_PP_CUBIC_FACES_3 0x2c78 +#define R200_PP_CUBIC_FACES_4 0x2c98 +#define R200_PP_CUBIC_FACES_5 0x2cb8 +#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04 +#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08 +#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c +#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10 +#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14 +#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c +#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20 +#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24 +#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28 +#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c +#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34 +#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38 +#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c +#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40 +#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44 +#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c +#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50 +#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54 +#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58 +#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c +#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64 +#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68 +#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c +#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70 +#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74 +#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c +#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80 +#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84 +#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88 +#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c + +#define R200_RE_AUX_SCISSOR_CNTL 0x26f0 +#define R200_SE_VTE_CNTL 0x20b0 +#define R200_SE_TCL_OUTPUT_VTX_COMP_SEL 0x2250 +#define R200_PP_TAM_DEBUG3 0x2d9c +#define R200_PP_CNTL_X 0x2cc4 +#define R200_SE_VAP_CNTL_STATUS 0x2140 +#define R200_RE_SCISSOR_TL_0 0x1cd8 +#define R200_RE_SCISSOR_TL_1 0x1ce0 +#define R200_RE_SCISSOR_TL_2 0x1ce8 +#define R200_RB3D_DEPTHXY_OFFSET 0x1d60 +#define R200_RE_AUX_SCISSOR_CNTL 0x26f0 +#define R200_SE_VTX_STATE_CNTL 0x2180 +#define R200_RE_POINTSIZE 0x2648 +#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0 0x2254 + + +#define SE_VAP_CNTL__TCL_ENA_MASK 0x00000001 +#define SE_VAP_CNTL__FORCE_W_TO_ONE_MASK 0x00010000 +#define SE_VAP_CNTL__VF_MAX_VTX_NUM__SHIFT 0x00000012 +#define SE_VTE_CNTL__VTX_XY_FMT_MASK 0x00000100 +#define SE_VTE_CNTL__VTX_Z_FMT_MASK 0x00000200 +#define SE_VTX_FMT_0__VTX_Z0_PRESENT_MASK 0x00000001 +#define SE_VTX_FMT_0__VTX_W0_PRESENT_MASK 0x00000002 +#define SE_VTX_FMT_0__VTX_COLOR_0_FMT__SHIFT 0x0000000b +#define R200_3D_DRAW_IMMD_2 0xC0003500 +#define R200_SE_VTX_FMT_1 0x208c +#define R200_RE_CNTL 0x1c50 + + +/* Constants */ +#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ + +#define RADEON_LAST_FRAME_REG RADEON_SCRATCH_REG0 +#define RADEON_LAST_DISPATCH_REG RADEON_SCRATCH_REG1 +#define RADEON_LAST_CLEAR_REG RADEON_SCRATCH_REG2 +#define RADEON_LAST_SWI_REG RADEON_SCRATCH_REG3 +#define RADEON_LAST_DISPATCH 1 + +#define RADEON_MAX_VB_AGE 0x7fffffff +#define RADEON_MAX_VB_VERTS (0xffff) + +#define RADEON_RING_HIGH_MARK 128 + + +#define RADEON_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) +#define RADEON_ADDR(reg) (RADEON_BASE( reg ) + reg) + +#define RADEON_READ(reg) DRM_READ32( (volatile u32 *) RADEON_ADDR(reg) ) +#define RADEON_WRITE(reg,val) DRM_WRITE32( (volatile u32 *) RADEON_ADDR(reg), (val) ) + +#define RADEON_READ8(reg) DRM_READ8( (volatile u8 *) RADEON_ADDR(reg) ) +#define RADEON_WRITE8(reg,val) DRM_WRITE8( (volatile u8 *) RADEON_ADDR(reg), (val) ) + +#define RADEON_WRITE_PLL( addr, val ) \ +do { \ + RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ + ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ + RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ +} while (0) + +extern int RADEON_READ_PLL( drm_device_t *dev, int addr ); + + +#define CP_PACKET0( reg, n ) \ + (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) +#define CP_PACKET0_TABLE( reg, n ) \ + (RADEON_CP_PACKET0 | RADEON_ONE_REG_WR | ((n) << 16) | ((reg) >> 2)) +#define CP_PACKET1( reg0, reg1 ) \ + (RADEON_CP_PACKET1 | (((reg1) >> 2) << 15) | ((reg0) >> 2)) +#define CP_PACKET2() \ + (RADEON_CP_PACKET2) +#define CP_PACKET3( pkt, n ) \ + (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) + + +/* ================================================================ + * Engine control helper macros + */ + +#define RADEON_WAIT_UNTIL_2D_IDLE() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ +} while (0) + +#define RADEON_WAIT_UNTIL_3D_IDLE() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ +} while (0) + +#define RADEON_WAIT_UNTIL_IDLE() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ +} while (0) + +#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \ +} while (0) + +#define RADEON_FLUSH_CACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB2D_DC_FLUSH ); \ +} while (0) + +#define RADEON_PURGE_CACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ +} while (0) + +#define RADEON_FLUSH_ZCACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB3D_ZC_FLUSH ); \ +} while (0) + +#define RADEON_PURGE_ZCACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \ +} while (0) + + +/* ================================================================ + * Misc helper macros + */ + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != DRM_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); \ + return DRM_ERR(EINVAL); \ + } \ +} while (0) + + +/* Perfbox functionality only. + */ +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + if (!(dev_priv->stats.boxes & RADEON_BOX_DMA_IDLE)) { \ + u32 head = GET_RING_HEAD(&dev_priv->ring); \ + if (head == dev_priv->ring.tail) \ + dev_priv->stats.boxes |= RADEON_BOX_DMA_IDLE; \ + } \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \ + if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ + int __ret = radeon_do_cp_idle( dev_priv ); \ + if ( __ret ) return __ret; \ + sarea_priv->last_dispatch = 0; \ + radeon_freelist_reset( dev ); \ + } \ +} while (0) + +#define RADEON_DISPATCH_AGE( age ) do { \ + OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \ + OUT_RING( age ); \ +} while (0) + +#define RADEON_FRAME_AGE( age ) do { \ + OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \ + OUT_RING( age ); \ +} while (0) + +#define RADEON_CLEAR_AGE( age ) do { \ + OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \ + OUT_RING( age ); \ +} while (0) + + +/* ================================================================ + * Ring control + */ + +#define RADEON_VERBOSE 0 + +#define RING_LOCALS int write, _nr; unsigned int mask; u32 *ring; + +#if defined(__alpha__) +# define RADEON_PAD_RING 16 /* pad ring requests to 16 lw boundaries */ +#else +# define RADEON_PAD_RING 0 +#endif + +#if RADEON_PAD_RING +# define radeon_pad_size(n) \ + (((RADEON_PAD_RING) - ((n) % (RADEON_PAD_RING))) % (RADEON_PAD_RING)) +# define radeon_pad_ring() do { \ + if (RADEON_VERBOSE) { \ + DRM_INFO("Padding ring from %d (%x) with %d words\n", \ + write, write, radeon_pad_size(write)); \ + } \ + switch (radeon_pad_size(write)) { \ + case 0: /* aligned */ \ + break; \ + case 1: /* 1 word */ \ + OUT_RING(CP_PACKET2()); \ + break; \ + default: /* >= 2 words */ \ + OUT_RING(CP_PACKET3(0x1000, radeon_pad_size(write) - 1));\ + write = (write + radeon_pad_size(write)) & mask; \ + write &= mask; \ + break; \ + } \ +} while(0) +#else +# define radeon_pad_size(n) 0 +# define radeon_pad_ring() +#endif + +#define BEGIN_RING( req_n ) do { \ + int n = req_n + radeon_pad_size(req_n); \ + if ( RADEON_VERBOSE ) { \ + DRM_INFO( "BEGIN_RING( %d (%d) ) in %s\n", \ + n, req_n, __FUNCTION__ ); \ + } \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ + COMMIT_RING(); \ + radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \ + } \ + _nr = n; dev_priv->ring.space -= (n) * sizeof(u32); \ + ring = dev_priv->ring.start; \ + write = dev_priv->ring.tail; \ + mask = dev_priv->ring.tail_mask; \ +} while (0) + +#define ADVANCE_RING() do { \ + if ( RADEON_VERBOSE ) { \ + DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ + write, dev_priv->ring.tail ); \ + } \ + radeon_pad_ring(); \ + if (((dev_priv->ring.tail + _nr) & mask) != write) { \ + DRM_ERROR( \ + "ADVANCE_RING(): mismatch: nr: %x write: %x line: %d\n", \ + ((dev_priv->ring.tail + _nr) & mask), \ + write, __LINE__); \ + } else \ + dev_priv->ring.tail = write; \ +} while (0) + +#define COMMIT_RING() do { \ + /* Flush writes to ring */ \ + DRM_READMEMORYBARRIER(); \ + GET_RING_HEAD( &dev_priv->ring ); \ + RADEON_WRITE( RADEON_CP_RB_WPTR, dev_priv->ring.tail ); \ + /* read from PCI bus to ensure correct posting */ \ + RADEON_READ( RADEON_CP_RB_RPTR ); \ +} while (0) + +#define OUT_RING( x ) do { \ + if ( RADEON_VERBOSE ) { \ + DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ + (unsigned int)(x), write ); \ + } \ + ring[write++] = (x); \ + write &= mask; \ +} while (0) + +#define OUT_RING_REG( reg, val ) do { \ + OUT_RING( CP_PACKET0( reg, 0 ) ); \ + OUT_RING( val ); \ +} while (0) + + +#define OUT_RING_USER_TABLE( tab, sz ) do { \ + int _size = (sz); \ + int *_tab = (tab); \ + \ + if (write + _size > mask) { \ + int i = (mask+1) - write; \ + if (DRM_COPY_FROM_USER_UNCHECKED( (int *)(ring+write), \ + _tab, i*4 )) \ + return DRM_ERR(EFAULT); \ + write = 0; \ + _size -= i; \ + _tab += i; \ + } \ + \ + if (_size && DRM_COPY_FROM_USER_UNCHECKED( (int *)(ring+write), \ + _tab, _size*4 )) \ + return DRM_ERR(EFAULT); \ + \ + write += _size; \ + write &= mask; \ +} while (0) + + +#endif /* __RADEON_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_irq.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_irq.c:1.3 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_irq.c Tue Feb 4 19:23:15 2003 @@ -0,0 +1,256 @@ +/* radeon_irq.c -- IRQ handling for radeon -*- linux-c -*- + * + * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. + * + * The Weather Channel (TM) funded Tungsten Graphics to develop the + * initial release of the Radeon 8500 driver under the XFree86 license. + * This notice must be preserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * Michel Dänzer <michel@daenzer.net> + */ + +#include "radeon.h" +#include "drmP.h" +#include "drm.h" +#include "radeon_drm.h" +#include "radeon_drv.h" + +/* Interrupts - Used for device synchronization and flushing in the + * following circumstances: + * + * - Exclusive FB access with hw idle: + * - Wait for GUI Idle (?) interrupt, then do normal flush. + * + * - Frame throttling, NV_fence: + * - Drop marker irq's into command stream ahead of time. + * - Wait on irq's with lock *not held* + * - Check each for termination condition + * + * - Internally in cp_getbuffer, etc: + * - as above, but wait with lock held??? + * + * NOTE: These functions are misleadingly named -- the irq's aren't + * tied to dma at all, this is just a hangover from dri prehistory. + */ + +void DRM(dma_service)( DRM_IRQ_ARGS ) +{ + drm_device_t *dev = (drm_device_t *) arg; + drm_radeon_private_t *dev_priv = + (drm_radeon_private_t *)dev->dev_private; + u32 stat; + + /* Only consider the bits we're interested in - others could be used + * outside the DRM + */ + stat = RADEON_READ(RADEON_GEN_INT_STATUS) + & (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT); + if (!stat) + return; + + /* SW interrupt */ + if (stat & RADEON_SW_INT_TEST) { + DRM_WAKEUP( &dev_priv->swi_queue ); + } + + /* VBLANK interrupt */ + if (stat & RADEON_CRTC_VBLANK_STAT) { + atomic_inc(&dev->vbl_received); + DRM_WAKEUP(&dev->vbl_queue); + DRM(vbl_send_signals)( dev ); + } + + /* Acknowledge interrupts we handle */ + RADEON_WRITE(RADEON_GEN_INT_STATUS, stat); +} + +static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv) +{ + u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS ) + & (RADEON_SW_INT_TEST_ACK | RADEON_CRTC_VBLANK_STAT); + if (tmp) + RADEON_WRITE( RADEON_GEN_INT_STATUS, tmp ); +} + +int radeon_emit_irq(drm_device_t *dev) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + unsigned int ret; + RING_LOCALS; + + atomic_inc(&dev_priv->swi_emitted); + ret = atomic_read(&dev_priv->swi_emitted); + + BEGIN_RING( 4 ); + OUT_RING_REG( RADEON_LAST_SWI_REG, ret ); + OUT_RING_REG( RADEON_GEN_INT_STATUS, RADEON_SW_INT_FIRE ); + ADVANCE_RING(); + COMMIT_RING(); + + return ret; +} + + +int radeon_wait_irq(drm_device_t *dev, int swi_nr) +{ + drm_radeon_private_t *dev_priv = + (drm_radeon_private_t *)dev->dev_private; + int ret = 0; + + if (RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr) + return 0; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + /* This is a hack to work around mysterious freezes on certain + * systems: + */ + radeon_acknowledge_irqs( dev_priv ); + + DRM_WAIT_ON( ret, dev_priv->swi_queue, 3 * DRM_HZ, + RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr ); + + return ret; +} + +int radeon_emit_and_wait_irq(drm_device_t *dev) +{ + return radeon_wait_irq( dev, radeon_emit_irq(dev) ); +} + + +int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence) +{ + drm_radeon_private_t *dev_priv = + (drm_radeon_private_t *)dev->dev_private; + unsigned int cur_vblank; + int ret = 0; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + radeon_acknowledge_irqs( dev_priv ); + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + /* Assume that the user has missed the current sequence number + * by about a day rather than she wants to wait for years + * using vertical blanks... + */ + DRM_WAIT_ON( ret, dev->vbl_queue, 3*DRM_HZ, + ( ( ( cur_vblank = atomic_read(&dev->vbl_received ) ) + - *sequence ) <= (1<<23) ) ); + + *sequence = cur_vblank; + + return ret; +} + + +/* Needs the lock as it touches the ring. + */ +int radeon_irq_emit( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_irq_emit_t emit; + int result; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( emit, (drm_radeon_irq_emit_t *)data, + sizeof(emit) ); + + result = radeon_emit_irq( dev ); + + if ( DRM_COPY_TO_USER( emit.irq_seq, &result, sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return DRM_ERR(EFAULT); + } + + return 0; +} + + +/* Doesn't need the hardware lock. + */ +int radeon_irq_wait( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_irq_wait_t irqwait; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( irqwait, (drm_radeon_irq_wait_t *)data, + sizeof(irqwait) ); + + return radeon_wait_irq( dev, irqwait.irq_seq ); +} + + +/* drm_dma.h hooks +*/ +void DRM(driver_irq_preinstall)( drm_device_t *dev ) { + drm_radeon_private_t *dev_priv = + (drm_radeon_private_t *)dev->dev_private; + + /* Disable *all* interrupts */ + RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 ); + + /* Clear bits if they're already high */ + radeon_acknowledge_irqs( dev_priv ); +} + +void DRM(driver_irq_postinstall)( drm_device_t *dev ) { + drm_radeon_private_t *dev_priv = + (drm_radeon_private_t *)dev->dev_private; + + atomic_set(&dev_priv->swi_emitted, 0); + DRM_INIT_WAITQUEUE( &dev_priv->swi_queue ); + + /* Turn on SW and VBL ints */ + RADEON_WRITE( RADEON_GEN_INT_CNTL, + RADEON_CRTC_VBLANK_MASK | + RADEON_SW_INT_ENABLE ); +} + +void DRM(driver_irq_uninstall)( drm_device_t *dev ) { + drm_radeon_private_t *dev_priv = + (drm_radeon_private_t *)dev->dev_private; + if ( dev_priv ) { + /* Disable *all* interrupts */ + RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 ); + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_mem.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_mem.c:1.1 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_mem.c Wed Oct 30 07:52:41 2002 @@ -0,0 +1,334 @@ +/* radeon_mem.c -- Simple agp/fb memory manager for radeon -*- linux-c -*- + * + * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. + * + * The Weather Channel (TM) funded Tungsten Graphics to develop the + * initial release of the Radeon 8500 driver under the XFree86 license. + * This notice must be preserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + */ + +#include "radeon.h" +#include "drmP.h" +#include "drm.h" +#include "radeon_drm.h" +#include "radeon_drv.h" + +/* Very simple allocator for agp memory, working on a static range + * already mapped into each client's address space. + */ + +static struct mem_block *split_block(struct mem_block *p, int start, int size, + int pid ) +{ + /* Maybe cut off the start of an existing block */ + if (start > p->start) { + struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock)); + if (!newblock) + goto out; + newblock->start = start; + newblock->size = p->size - (start - p->start); + newblock->pid = 0; + newblock->next = p->next; + newblock->prev = p; + p->next->prev = newblock; + p->next = newblock; + p->size -= newblock->size; + p = newblock; + } + + /* Maybe cut off the end of an existing block */ + if (size < p->size) { + struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock)); + if (!newblock) + goto out; + newblock->start = start + size; + newblock->size = p->size - size; + newblock->pid = 0; + newblock->next = p->next; + newblock->prev = p; + p->next->prev = newblock; + p->next = newblock; + p->size = size; + } + + out: + /* Our block is in the middle */ + p->pid = pid; + return p; +} + +static struct mem_block *alloc_block( struct mem_block *heap, int size, + int align2, int pid ) +{ + struct mem_block *p; + int mask = (1 << align2)-1; + + for (p = heap->next ; p != heap ; p = p->next) { + int start = (p->start + mask) & ~mask; + if (p->pid == 0 && start + size <= p->start + p->size) + return split_block( p, start, size, pid ); + } + + return NULL; +} + +static struct mem_block *find_block( struct mem_block *heap, int start ) +{ + struct mem_block *p; + + for (p = heap->next ; p != heap ; p = p->next) + if (p->start == start) + return p; + + return NULL; +} + + +static void free_block( struct mem_block *p ) +{ + p->pid = 0; + + /* Assumes a single contiguous range. Needs a special pid in + * 'heap' to stop it being subsumed. + */ + if (p->next->pid == 0) { + struct mem_block *q = p->next; + p->size += q->size; + p->next = q->next; + p->next->prev = p; + DRM_FREE(q); + } + + if (p->prev->pid == 0) { + struct mem_block *q = p->prev; + q->size += p->size; + q->next = p->next; + q->next->prev = q; + DRM_FREE(p); + } +} + +static void print_heap( struct mem_block *heap ) +{ + struct mem_block *p; + + for (p = heap->next ; p != heap ; p = p->next) + DRM_DEBUG("0x%x..0x%x (0x%x) -- owner %d\n", + p->start, p->start + p->size, + p->size, p->pid); +} + +/* Initialize. How to check for an uninitialized heap? + */ +static int init_heap(struct mem_block **heap, int start, int size) +{ + struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks)); + + if (!blocks) + return -ENOMEM; + + *heap = DRM_MALLOC(sizeof(**heap)); + if (!*heap) { + DRM_FREE( blocks ); + return -ENOMEM; + } + + blocks->start = start; + blocks->size = size; + blocks->pid = 0; + blocks->next = blocks->prev = *heap; + + memset( *heap, 0, sizeof(**heap) ); + (*heap)->pid = -1; + (*heap)->next = (*heap)->prev = blocks; + return 0; +} + + +/* Free all blocks associated with the releasing pid. + */ +void radeon_mem_release( struct mem_block *heap ) +{ + int pid = DRM_CURRENTPID; + struct mem_block *p; + + if (!heap || !heap->next) + return; + + for (p = heap->next ; p != heap ; p = p->next) { + if (p->pid == pid) + p->pid = 0; + } + + /* Assumes a single contiguous range. Needs a special pid in + * 'heap' to stop it being subsumed. + */ + for (p = heap->next ; p != heap ; p = p->next) { + while (p->pid == 0 && p->next->pid == 0) { + struct mem_block *q = p->next; + p->size += q->size; + p->next = q->next; + p->next->prev = p; + DRM_FREE(q); + } + } +} + +/* Shutdown. + */ +void radeon_mem_takedown( struct mem_block **heap ) +{ + struct mem_block *p; + + if (!*heap) + return; + + for (p = (*heap)->next ; p != *heap ; ) { + struct mem_block *q = p; + p = p->next; + DRM_FREE(q); + } + + DRM_FREE( *heap ); + *heap = 0; +} + + + +/* IOCTL HANDLERS */ + +static struct mem_block **get_heap( drm_radeon_private_t *dev_priv, + int region ) +{ + switch( region ) { + case RADEON_MEM_REGION_AGP: + return &dev_priv->agp_heap; + case RADEON_MEM_REGION_FB: + return &dev_priv->fb_heap; + default: + return 0; + } +} + +int radeon_mem_alloc( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_mem_alloc_t alloc; + struct mem_block *block, **heap; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( alloc, (drm_radeon_mem_alloc_t *)data, + sizeof(alloc) ); + + heap = get_heap( dev_priv, alloc.region ); + if (!heap || !*heap) + return DRM_ERR(EFAULT); + + /* Make things easier on ourselves: all allocations at least + * 4k aligned. + */ + if (alloc.alignment < 12) + alloc.alignment = 12; + + block = alloc_block( *heap, alloc.size, alloc.alignment, + DRM_CURRENTPID ); + + if (!block) + return DRM_ERR(ENOMEM); + + if ( DRM_COPY_TO_USER( alloc.region_offset, &block->start, + sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return DRM_ERR(EFAULT); + } + + return 0; +} + + + +int radeon_mem_free( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_mem_free_t memfree; + struct mem_block *block, **heap; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( memfree, (drm_radeon_mem_free_t *)data, + sizeof(memfree) ); + + heap = get_heap( dev_priv, memfree.region ); + if (!heap || !*heap) + return DRM_ERR(EFAULT); + + block = find_block( *heap, memfree.region_offset ); + if (!block) + return DRM_ERR(EFAULT); + + if (block->pid != DRM_CURRENTPID) + return DRM_ERR(EPERM); + + free_block( block ); + return 0; +} + +int radeon_mem_init_heap( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_mem_init_heap_t initheap; + struct mem_block **heap; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( initheap, (drm_radeon_mem_init_heap_t *)data, + sizeof(initheap) ); + + heap = get_heap( dev_priv, initheap.region ); + if (!heap) + return DRM_ERR(EFAULT); + + if (*heap) { + DRM_ERROR("heap already initialized?"); + return DRM_ERR(EFAULT); + } + + return init_heap( heap, initheap.start, initheap.size ); +} + + Index: xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c:1.4 --- /dev/null Thu Feb 27 12:32:45 2003 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c Sat Feb 8 16:27:01 2003 @@ -0,0 +1,2202 @@ +/* radeon_state.c -- State support for Radeon -*- linux-c -*- + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + */ + +#include "radeon.h" +#include "drmP.h" +#include "drm.h" +#include "drm_sarea.h" +#include "radeon_drm.h" +#include "radeon_drv.h" + + +/* ================================================================ + * CP hardware state programming functions + */ + +static __inline__ void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv, + drm_clip_rect_t *box ) +{ + RING_LOCALS; + + DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + BEGIN_RING( 4 ); + OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) ); + OUT_RING( (box->y1 << 16) | box->x1 ); + OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) ); + OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) ); + ADVANCE_RING(); +} + +/* Emit 1.1 state + */ +static void radeon_emit_state( drm_radeon_private_t *dev_priv, + drm_radeon_context_regs_t *ctx, + drm_radeon_texture_regs_t *tex, + unsigned int dirty ) +{ + RING_LOCALS; + DRM_DEBUG( "dirty=0x%08x\n", dirty ); + + if ( dirty & RADEON_UPLOAD_CONTEXT ) { + BEGIN_RING( 14 ); + OUT_RING( CP_PACKET0( RADEON_PP_MISC, 6 ) ); + OUT_RING( ctx->pp_misc ); + OUT_RING( ctx->pp_fog_color ); + OUT_RING( ctx->re_solid_color ); + OUT_RING( ctx->rb3d_blendcntl ); + OUT_RING( ctx->rb3d_depthoffset ); + OUT_RING( ctx->rb3d_depthpitch ); + OUT_RING( ctx->rb3d_zstencilcntl ); + OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 2 ) ); + OUT_RING( ctx->pp_cntl ); + OUT_RING( ctx->rb3d_cntl ); + OUT_RING( ctx->rb3d_coloroffset ); + OUT_RING( CP_PACKET0( RADEON_RB3D_COLORPITCH, 0 ) ); + OUT_RING( ctx->rb3d_colorpitch ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_VERTFMT ) { + BEGIN_RING( 2 ); + OUT_RING( CP_PACKET0( RADEON_SE_COORD_FMT, 0 ) ); + OUT_RING( ctx->se_coord_fmt ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_LINE ) { + BEGIN_RING( 5 ); + OUT_RING( CP_PACKET0( RADEON_RE_LINE_PATTERN, 1 ) ); + OUT_RING( ctx->re_line_pattern ); + OUT_RING( ctx->re_line_state ); + OUT_RING( CP_PACKET0( RADEON_SE_LINE_WIDTH, 0 ) ); + OUT_RING( ctx->se_line_width ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_BUMPMAP ) { + BEGIN_RING( 5 ); + OUT_RING( CP_PACKET0( RADEON_PP_LUM_MATRIX, 0 ) ); + OUT_RING( ctx->pp_lum_matrix ); + OUT_RING( CP_PACKET0( RADEON_PP_ROT_MATRIX_0, 1 ) ); + OUT_RING( ctx->pp_rot_matrix_0 ); + OUT_RING( ctx->pp_rot_matrix_1 ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_MASKS ) { + BEGIN_RING( 4 ); + OUT_RING( CP_PACKET0( RADEON_RB3D_STENCILREFMASK, 2 ) ); + OUT_RING( ctx->rb3d_stencilrefmask ); + OUT_RING( ctx->rb3d_ropcntl ); + OUT_RING( ctx->rb3d_planemask ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_VIEWPORT ) { + BEGIN_RING( 7 ); + OUT_RING( CP_PACKET0( RADEON_SE_VPORT_XSCALE, 5 ) ); + OUT_RING( ctx->se_vport_xscale ); + OUT_RING( ctx->se_vport_xoffset ); + OUT_RING( ctx->se_vport_yscale ); + OUT_RING( ctx->se_vport_yoffset ); + OUT_RING( ctx->se_vport_zscale ); + OUT_RING( ctx->se_vport_zoffset ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_SETUP ) { + BEGIN_RING( 4 ); + OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); + OUT_RING( ctx->se_cntl ); + OUT_RING( CP_PACKET0( RADEON_SE_CNTL_STATUS, 0 ) ); + OUT_RING( ctx->se_cntl_status ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_MISC ) { + BEGIN_RING( 2 ); + OUT_RING( CP_PACKET0( RADEON_RE_MISC, 0 ) ); + OUT_RING( ctx->re_misc ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_TEX0 ) { + BEGIN_RING( 9 ); + OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) ); + OUT_RING( tex[0].pp_txfilter ); + OUT_RING( tex[0].pp_txformat ); + OUT_RING( tex[0].pp_txoffset ); + OUT_RING( tex[0].pp_txcblend ); + OUT_RING( tex[0].pp_txablend ); + OUT_RING( tex[0].pp_tfactor ); + OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_0, 0 ) ); + OUT_RING( tex[0].pp_border_color ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_TEX1 ) { + BEGIN_RING( 9 ); + OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) ); + OUT_RING( tex[1].pp_txfilter ); + OUT_RING( tex[1].pp_txformat ); + OUT_RING( tex[1].pp_txoffset ); + OUT_RING( tex[1].pp_txcblend ); + OUT_RING( tex[1].pp_txablend ); + OUT_RING( tex[1].pp_tfactor ); + OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_1, 0 ) ); + OUT_RING( tex[1].pp_border_color ); + ADVANCE_RING(); + } + + if ( dirty & RADEON_UPLOAD_TEX2 ) { + BEGIN_RING( 9 ); + OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) ); + OUT_RING( tex[2].pp_txfilter ); + OUT_RING( tex[2].pp_txformat ); + OUT_RING( tex[2].pp_txoffset ); + OUT_RING( tex[2].pp_txcblend ); + OUT_RING( tex[2].pp_txablend ); + OUT_RING( tex[2].pp_tfactor ); + OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_2, 0 ) ); + OUT_RING( tex[2].pp_border_color ); + ADVANCE_RING(); + } +} + +/* Emit 1.2 state + */ +static void radeon_emit_state2( drm_radeon_private_t *dev_priv, + drm_radeon_state_t *state ) +{ + RING_LOCALS; + + if (state->dirty & RADEON_UPLOAD_ZBIAS) { + BEGIN_RING( 3 ); + OUT_RING( CP_PACKET0( RADEON_SE_ZBIAS_FACTOR, 1 ) ); + OUT_RING( state->context2.se_zbias_factor ); + OUT_RING( state->context2.se_zbias_constant ); + ADVANCE_RING(); + } + + radeon_emit_state( dev_priv, &state->context, + state->tex, state->dirty ); +} + +/* New (1.3) state mechanism. 3 commands (packet, scalar, vector) in + * 1.3 cmdbuffers allow all previous state to be updated as well as + * the tcl scalar and vector areas. + */ +static struct { + int start; + int len; + const char *name; +} packet[RADEON_MAX_STATE_PACKETS] = { + { RADEON_PP_MISC,7,"RADEON_PP_MISC" }, + { RADEON_PP_CNTL,3,"RADEON_PP_CNTL" }, + { RADEON_RB3D_COLORPITCH,1,"RADEON_RB3D_COLORPITCH" }, + { RADEON_RE_LINE_PATTERN,2,"RADEON_RE_LINE_PATTERN" }, + { RADEON_SE_LINE_WIDTH,1,"RADEON_SE_LINE_WIDTH" }, + { RADEON_PP_LUM_MATRIX,1,"RADEON_PP_LUM_MATRIX" }, + { RADEON_PP_ROT_MATRIX_0,2,"RADEON_PP_ROT_MATRIX_0" }, + { RADEON_RB3D_STENCILREFMASK,3,"RADEON_RB3D_STENCILREFMASK" }, + { RADEON_SE_VPORT_XSCALE,6,"RADEON_SE_VPORT_XSCALE" }, + { RADEON_SE_CNTL,2,"RADEON_SE_CNTL" }, + { RADEON_SE_CNTL_STATUS,1,"RADEON_SE_CNTL_STATUS" }, + { RADEON_RE_MISC,1,"RADEON_RE_MISC" }, + { RADEON_PP_TXFILTER_0,6,"RADEON_PP_TXFILTER_0" }, + { RADEON_PP_BORDER_COLOR_0,1,"RADEON_PP_BORDER_COLOR_0" }, + { RADEON_PP_TXFILTER_1,6,"RADEON_PP_TXFILTER_1" }, + { RADEON_PP_BORDER_COLOR_1,1,"RADEON_PP_BORDER_COLOR_1" }, + { RADEON_PP_TXFILTER_2,6,"RADEON_PP_TXFILTER_2" }, + { RADEON_PP_BORDER_COLOR_2,1,"RADEON_PP_BORDER_COLOR_2" }, + { RADEON_SE_ZBIAS_FACTOR,2,"RADEON_SE_ZBIAS_FACTOR" }, + { RADEON_SE_TCL_OUTPUT_VTX_FMT,11,"RADEON_SE_TCL_OUTPUT_VTX_FMT" }, + { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED,17,"RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED" }, + { R200_PP_TXCBLEND_0, 4, "R200_PP_TXCBLEND_0" }, + { R200_PP_TXCBLEND_1, 4, "R200_PP_TXCBLEND_1" }, + { R200_PP_TXCBLEND_2, 4, "R200_PP_TXCBLEND_2" }, + { R200_PP_TXCBLEND_3, 4, "R200_PP_TXCBLEND_3" }, + { R200_PP_TXCBLEND_4, 4, "R200_PP_TXCBLEND_4" }, + { R200_PP_TXCBLEND_5, 4, "R200_PP_TXCBLEND_5" }, + { R200_PP_TXCBLEND_6, 4, "R200_PP_TXCBLEND_6" }, + { R200_PP_TXCBLEND_7, 4, "R200_PP_TXCBLEND_7" }, + { R200_SE_TCL_LIGHT_MODEL_CTL_0, 6, "R200_SE_TCL_LIGHT_MODEL_CTL_0" }, + { R200_PP_TFACTOR_0, 6, "R200_PP_TFACTOR_0" }, + { R200_SE_VTX_FMT_0, 4, "R200_SE_VTX_FMT_0" }, + { R200_SE_VAP_CNTL, 1, "R200_SE_VAP_CNTL" }, + { R200_SE_TCL_MATRIX_SEL_0, 5, "R200_SE_TCL_MATRIX_SEL_0" }, + { R200_SE_TCL_TEX_PROC_CTL_2, 5, "R200_SE_TCL_TEX_PROC_CTL_2" }, + { R200_SE_TCL_UCP_VERT_BLEND_CTL, 1, "R200_SE_TCL_UCP_VERT_BLEND_CTL" }, + { R200_PP_TXFILTER_0, 6, "R200_PP_TXFILTER_0" }, + { R200_PP_TXFILTER_1, 6, "R200_PP_TXFILTER_1" }, + { R200_PP_TXFILTER_2, 6, "R200_PP_TXFILTER_2" }, + { R200_PP_TXFILTER_3, 6, "R200_PP_TXFILTER_3" }, + { R200_PP_TXFILTER_4, 6, "R200_PP_TXFILTER_4" }, + { R200_PP_TXFILTER_5, 6, "R200_PP_TXFILTER_5" }, + { R200_PP_TXOFFSET_0, 1, "R200_PP_TXOFFSET_0" }, + { R200_PP_TXOFFSET_1, 1, "R200_PP_TXOFFSET_1" }, + { R200_PP_TXOFFSET_2, 1, "R200_PP_TXOFFSET_2" }, + { R200_PP_TXOFFSET_3, 1, "R200_PP_TXOFFSET_3" }, + { R200_PP_TXOFFSET_4, 1, "R200_PP_TXOFFSET_4" }, + { R200_PP_TXOFFSET_5, 1, "R200_PP_TXOFFSET_5" }, + { R200_SE_VTE_CNTL, 1, "R200_SE_VTE_CNTL" }, + { R200_SE_TCL_OUTPUT_VTX_COMP_SEL, 1, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" }, + { R200_PP_TAM_DEBUG3, 1, "R200_PP_TAM_DEBUG3" }, + { R200_PP_CNTL_X, 1, "R200_PP_CNTL_X" }, + { R200_RB3D_DEPTHXY_OFFSET, 1, "R200_RB3D_DEPTHXY_OFFSET" }, + { R200_RE_AUX_SCISSOR_CNTL, 1, "R200_RE_AUX_SCISSOR_CNTL" }, + { R200_RE_SCISSOR_TL_0, 2, "R200_RE_SCISSOR_TL_0" }, + { R200_RE_SCISSOR_TL_1, 2, "R200_RE_SCISSOR_TL_1" }, + { R200_RE_SCISSOR_TL_2, 2, "R200_RE_SCISSOR_TL_2" }, + { R200_SE_VAP_CNTL_STATUS, 1, "R200_SE_VAP_CNTL_STATUS" }, + { R200_SE_VTX_STATE_CNTL, 1, "R200_SE_VTX_STATE_CNTL" }, + { R200_RE_POINTSIZE, 1, "R200_RE_POINTSIZE" }, + { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, 4, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" }, + { R200_PP_CUBIC_FACES_0, 1, "R200_PP_CUBIC_FACES_0" }, /* 61 */ + { R200_PP_CUBIC_OFFSET_F1_0, 5, "R200_PP_CUBIC_OFFSET_F1_0" }, /* 62 */ + { R200_PP_CUBIC_FACES_1, 1, "R200_PP_CUBIC_FACES_1" }, + { R200_PP_CUBIC_OFFSET_F1_1, 5, "R200_PP_CUBIC_OFFSET_F1_1" }, + { R200_PP_CUBIC_FACES_2, 1, "R200_PP_CUBIC_FACES_2" }, + { R200_PP_CUBIC_OFFSET_F1_2, 5, "R200_PP_CUBIC_OFFSET_F1_2" }, + { R200_PP_CUBIC_FACES_3, 1, "R200_PP_CUBIC_FACES_3" }, + { R200_PP_CUBIC_OFFSET_F1_3, 5, "R200_PP_CUBIC_OFFSET_F1_3" }, + { R200_PP_CUBIC_FACES_4, 1, "R200_PP_CUBIC_FACES_4" }, + { R200_PP_CUBIC_OFFSET_F1_4, 5, "R200_PP_CUBIC_OFFSET_F1_4" }, + { R200_PP_CUBIC_FACES_5, 1, "R200_PP_CUBIC_FACES_5" }, + { R200_PP_CUBIC_OFFSET_F1_5, 5, "R200_PP_CUBIC_OFFSET_F1_5" }, +}; + + + +/* ================================================================ + * Performance monitoring functions + */ + +static void radeon_clear_box( drm_radeon_private_t *dev_priv, + int x, int y, int w, int h, + int r, int g, int b ) +{ + u32 color; + RING_LOCALS; + + x += dev_priv->sarea_priv->boxes[0].x1; + y += dev_priv->sarea_priv->boxes[0].y1; + + switch ( dev_priv->color_fmt ) { + case RADEON_COLOR_FORMAT_RGB565: + color = (((r & 0xf8) << 8) | + ((g & 0xfc) << 3) | + ((b & 0xf8) >> 3)); + break; + case RADEON_COLOR_FORMAT_ARGB8888: + default: + color = (((0xff) << 24) | (r << 16) | (g << 8) | b); + break; + } + + BEGIN_RING( 4 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) ); + OUT_RING( 0xffffffff ); + ADVANCE_RING(); + + BEGIN_RING( 6 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_P | + RADEON_GMC_CLR_CMP_CNTL_DIS ); + + if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { + OUT_RING( dev_priv->front_pitch_offset ); + } else { + OUT_RING( dev_priv->back_pitch_offset ); + } + + OUT_RING( color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); +} + +static void radeon_cp_performance_boxes( drm_radeon_private_t *dev_priv ) +{ + /* Collapse various things into a wait flag -- trying to + * guess if userspase slept -- better just to have them tell us. + */ + if (dev_priv->stats.last_frame_reads > 1 || + dev_priv->stats.last_clear_reads > dev_priv->stats.clears) { + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + } + + if (dev_priv->stats.freelist_loops) { + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + } + + /* Purple box for page flipping + */ + if ( dev_priv->stats.boxes & RADEON_BOX_FLIP ) + radeon_clear_box( dev_priv, 4, 4, 8, 8, 255, 0, 255 ); + + /* Red box if we have to wait for idle at any point + */ + if ( dev_priv->stats.boxes & RADEON_BOX_WAIT_IDLE ) + radeon_clear_box( dev_priv, 16, 4, 8, 8, 255, 0, 0 ); + + /* Blue box: lost context? + */ + + /* Yellow box for texture swaps + */ + if ( dev_priv->stats.boxes & RADEON_BOX_TEXTURE_LOAD ) + radeon_clear_box( dev_priv, 40, 4, 8, 8, 255, 255, 0 ); + + /* Green box if hardware never idles (as far as we can tell) + */ + if ( !(dev_priv->stats.boxes & RADEON_BOX_DMA_IDLE) ) + radeon_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); + + + /* Draw bars indicating number of buffers allocated + * (not a great measure, easily confused) + */ + if (dev_priv->stats.requested_bufs) { + if (dev_priv->stats.requested_bufs > 100) + dev_priv->stats.requested_bufs = 100; + + radeon_clear_box( dev_priv, 4, 16, + dev_priv->stats.requested_bufs, 4, + 196, 128, 128 ); + } + + memset( &dev_priv->stats, 0, sizeof(dev_priv->stats) ); + +} +/* ================================================================ + * CP command dispatch functions + */ + +static void radeon_cp_dispatch_clear( drm_device_t *dev, + drm_radeon_clear_t *clear, + drm_radeon_clear_rect_t *depth_boxes ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_depth_clear_t *depth_clear = &dev_priv->depth_clear; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + unsigned int flags = clear->flags; + u32 rb3d_cntl = 0, rb3d_stencilrefmask= 0; + int i; + RING_LOCALS; + DRM_DEBUG( "flags = 0x%x\n", flags ); + + dev_priv->stats.clears++; + + if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { + unsigned int tmp = flags; + + flags &= ~(RADEON_FRONT | RADEON_BACK); + if ( tmp & RADEON_FRONT ) flags |= RADEON_BACK; + if ( tmp & RADEON_BACK ) flags |= RADEON_FRONT; + } + + if ( flags & (RADEON_FRONT | RADEON_BACK) ) { + + BEGIN_RING( 4 ); + + /* Ensure the 3D stream is idle before doing a + * 2D fill to clear the front or back buffer. + */ + RADEON_WAIT_UNTIL_3D_IDLE(); + + OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) ); + OUT_RING( clear->color_mask ); + + ADVANCE_RING(); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->ctx_owner = 0; + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", + x, y, w, h, flags ); + + if ( flags & RADEON_FRONT ) { + BEGIN_RING( 6 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_P | + RADEON_GMC_CLR_CMP_CNTL_DIS ); + + OUT_RING( dev_priv->front_pitch_offset ); + OUT_RING( clear->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & RADEON_BACK ) { + BEGIN_RING( 6 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_P | + RADEON_GMC_CLR_CMP_CNTL_DIS ); + + OUT_RING( dev_priv->back_pitch_offset ); + OUT_RING( clear->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + } + } + + /* We have to clear the depth and/or stencil buffers by + * rendering a quad into just those buffers. Thus, we have to + * make sure the 3D engine is configured correctly. + */ + if ( dev_priv->is_r200 && + (flags & (RADEON_DEPTH | RADEON_STENCIL)) ) { + + int tempPP_CNTL; + int tempRE_CNTL; + int tempRB3D_CNTL; + int tempRB3D_ZSTENCILCNTL; + int tempRB3D_STENCILREFMASK; + int tempRB3D_PLANEMASK; + int tempSE_CNTL; + int tempSE_VTE_CNTL; + int tempSE_VTX_FMT_0; + int tempSE_VTX_FMT_1; + int tempSE_VAP_CNTL; + int tempRE_AUX_SCISSOR_CNTL; + + tempPP_CNTL = 0; + tempRE_CNTL = 0; + + tempRB3D_CNTL = depth_clear->rb3d_cntl; + tempRB3D_CNTL &= ~(1<<15); /* unset radeon magic flag */ + + tempRB3D_ZSTENCILCNTL = depth_clear->rb3d_zstencilcntl; + tempRB3D_STENCILREFMASK = 0x0; + + tempSE_CNTL = depth_clear->se_cntl; + + + + /* Disable TCL */ + + tempSE_VAP_CNTL = (/* SE_VAP_CNTL__FORCE_W_TO_ONE_MASK | */ + (0x9 << SE_VAP_CNTL__VF_MAX_VTX_NUM__SHIFT)); + + tempRB3D_PLANEMASK = 0x0; + + tempRE_AUX_SCISSOR_CNTL = 0x0; + + tempSE_VTE_CNTL = + SE_VTE_CNTL__VTX_XY_FMT_MASK | + SE_VTE_CNTL__VTX_Z_FMT_MASK; + + /* Vertex format (X, Y, Z, W)*/ + tempSE_VTX_FMT_0 = + SE_VTX_FMT_0__VTX_Z0_PRESENT_MASK | + SE_VTX_FMT_0__VTX_W0_PRESENT_MASK; + tempSE_VTX_FMT_1 = 0x0; + + + /* + * Depth buffer specific enables + */ + if (flags & RADEON_DEPTH) { + /* Enable depth buffer */ + tempRB3D_CNTL |= RADEON_Z_ENABLE; + } else { + /* Disable depth buffer */ + tempRB3D_CNTL &= ~RADEON_Z_ENABLE; + } + + /* + * Stencil buffer specific enables + */ + if ( flags & RADEON_STENCIL ) { + tempRB3D_CNTL |= RADEON_STENCIL_ENABLE; + tempRB3D_STENCILREFMASK = clear->depth_mask; + } else { + tempRB3D_CNTL &= ~RADEON_STENCIL_ENABLE; + tempRB3D_STENCILREFMASK = 0x00000000; + } + + BEGIN_RING( 26 ); + RADEON_WAIT_UNTIL_2D_IDLE(); + + OUT_RING_REG( RADEON_PP_CNTL, tempPP_CNTL ); + OUT_RING_REG( R200_RE_CNTL, tempRE_CNTL ); + OUT_RING_REG( RADEON_RB3D_CNTL, tempRB3D_CNTL ); + OUT_RING_REG( RADEON_RB3D_ZSTENCILCNTL, + tempRB3D_ZSTENCILCNTL ); + OUT_RING_REG( RADEON_RB3D_STENCILREFMASK, + tempRB3D_STENCILREFMASK ); + OUT_RING_REG( RADEON_RB3D_PLANEMASK, tempRB3D_PLANEMASK ); + OUT_RING_REG( RADEON_SE_CNTL, tempSE_CNTL ); + OUT_RING_REG( R200_SE_VTE_CNTL, tempSE_VTE_CNTL ); + OUT_RING_REG( R200_SE_VTX_FMT_0, tempSE_VTX_FMT_0 ); + OUT_RING_REG( R200_SE_VTX_FMT_1, tempSE_VTX_FMT_1 ); + OUT_RING_REG( R200_SE_VAP_CNTL, tempSE_VAP_CNTL ); + OUT_RING_REG( R200_RE_AUX_SCISSOR_CNTL, + tempRE_AUX_SCISSOR_CNTL ); + ADVANCE_RING(); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->ctx_owner = 0; + + for ( i = 0 ; i < nbox ; i++ ) { + + /* Funny that this should be required -- + * sets top-left? + */ + radeon_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + + BEGIN_RING( 14 ); + OUT_RING( CP_PACKET3( R200_3D_DRAW_IMMD_2, 12 ) ); + OUT_RING( (RADEON_PRIM_TYPE_RECT_LIST | + RADEON_PRIM_WALK_RING | + (3 << RADEON_NUM_VERTICES_SHIFT)) ); + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + OUT_RING( 0x3f800000 ); + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + OUT_RING( 0x3f800000 ); + OUT_RING( depth_boxes[i].ui[CLEAR_X2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + OUT_RING( 0x3f800000 ); + ADVANCE_RING(); + } + } + else if ( (flags & (RADEON_DEPTH | RADEON_STENCIL)) ) { + + rb3d_cntl = depth_clear->rb3d_cntl; + + if ( flags & RADEON_DEPTH ) { + rb3d_cntl |= RADEON_Z_ENABLE; + } else { + rb3d_cntl &= ~RADEON_Z_ENABLE; + } + + if ( flags & RADEON_STENCIL ) { + rb3d_cntl |= RADEON_STENCIL_ENABLE; + rb3d_stencilrefmask = clear->depth_mask; /* misnamed field */ + } else { + rb3d_cntl &= ~RADEON_STENCIL_ENABLE; + rb3d_stencilrefmask = 0x00000000; + } + + BEGIN_RING( 13 ); + RADEON_WAIT_UNTIL_2D_IDLE(); + + OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 1 ) ); + OUT_RING( 0x00000000 ); + OUT_RING( rb3d_cntl ); + + OUT_RING_REG( RADEON_RB3D_ZSTENCILCNTL, + depth_clear->rb3d_zstencilcntl ); + OUT_RING_REG( RADEON_RB3D_STENCILREFMASK, + rb3d_stencilrefmask ); + OUT_RING_REG( RADEON_RB3D_PLANEMASK, + 0x00000000 ); + OUT_RING_REG( RADEON_SE_CNTL, + depth_clear->se_cntl ); + ADVANCE_RING(); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->ctx_owner = 0; + + for ( i = 0 ; i < nbox ; i++ ) { + + /* Funny that this should be required -- + * sets top-left? + */ + radeon_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + + BEGIN_RING( 15 ); + + OUT_RING( CP_PACKET3( RADEON_3D_DRAW_IMMD, 13 ) ); + OUT_RING( RADEON_VTX_Z_PRESENT | + RADEON_VTX_PKCOLOR_PRESENT); + OUT_RING( (RADEON_PRIM_TYPE_RECT_LIST | + RADEON_PRIM_WALK_RING | + RADEON_MAOS_ENABLE | + RADEON_VTX_FMT_RADEON_MODE | + (3 << RADEON_NUM_VERTICES_SHIFT)) ); + + + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + OUT_RING( 0x0 ); + + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + OUT_RING( 0x0 ); + + OUT_RING( depth_boxes[i].ui[CLEAR_X2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + OUT_RING( 0x0 ); + + ADVANCE_RING(); + } + } + + /* Increment the clear counter. The client-side 3D driver must + * wait on this value before performing the clear ioctl. We + * need this because the card's so damned fast... + */ + dev_priv->sarea_priv->last_clear++; + + BEGIN_RING( 4 ); + + RADEON_CLEAR_AGE( dev_priv->sarea_priv->last_clear ); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); +} + +static void radeon_cp_dispatch_swap( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int i; + RING_LOCALS; + DRM_DEBUG( "\n" ); + + /* Do some trivial performance monitoring... + */ + if (dev_priv->do_boxes) + radeon_cp_performance_boxes( dev_priv ); + + + /* Wait for the 3D stream to idle before dispatching the bitblt. + * This will prevent data corruption between the two streams. + */ + BEGIN_RING( 2 ); + + RADEON_WAIT_UNTIL_3D_IDLE(); + + ADVANCE_RING(); + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + DRM_DEBUG( "dispatch swap %d,%d-%d,%d\n", + x, y, w, h ); + + BEGIN_RING( 7 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( RADEON_GMC_SRC_PITCH_OFFSET_CNTL | + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_NONE | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_S | + RADEON_DP_SRC_SOURCE_MEMORY | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_WR_MSK_DIS ); + + /* Make this work even if front & back are flipped: + */ + if (dev_priv->current_page == 0) { + OUT_RING( dev_priv->back_pitch_offset ); + OUT_RING( dev_priv->front_pitch_offset ); + } + else { + OUT_RING( dev_priv->front_pitch_offset ); + OUT_RING( dev_priv->back_pitch_offset ); + } + + OUT_RING( (x << 16) | y ); + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 4 ); + + RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); + RADEON_WAIT_UNTIL_2D_IDLE(); + + ADVANCE_RING(); +} + +static void radeon_cp_dispatch_flip( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_sarea_t *sarea = (drm_sarea_t *)dev_priv->sarea->handle; + int offset = (dev_priv->current_page == 1) + ? dev_priv->front_offset : dev_priv->back_offset; + RING_LOCALS; + DRM_DEBUG( "%s: page=%d pfCurrentPage=%d\n", + __FUNCTION__, + dev_priv->current_page, + dev_priv->sarea_priv->pfCurrentPage); + + /* Do some trivial performance monitoring... + */ + if (dev_priv->do_boxes) { + dev_priv->stats.boxes |= RADEON_BOX_FLIP; + radeon_cp_performance_boxes( dev_priv ); + } + + /* Update the frame offsets for both CRTCs + */ + BEGIN_RING( 6 ); + + RADEON_WAIT_UNTIL_3D_IDLE(); + OUT_RING_REG( RADEON_CRTC_OFFSET, ( ( sarea->frame.y * dev_priv->front_pitch + + sarea->frame.x + * ( dev_priv->color_fmt - 2 ) ) & ~7 ) + + offset ); + OUT_RING_REG( RADEON_CRTC2_OFFSET, dev_priv->sarea_priv->crtc2_base + + offset ); + + ADVANCE_RING(); + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + dev_priv->sarea_priv->pfCurrentPage = dev_priv->current_page = + 1 - dev_priv->current_page; + + BEGIN_RING( 2 ); + + RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); + + ADVANCE_RING(); +} + +static int bad_prim_vertex_nr( int primitive, int nr ) +{ + switch (primitive & RADEON_PRIM_TYPE_MASK) { + case RADEON_PRIM_TYPE_NONE: + case RADEON_PRIM_TYPE_POINT: + return nr < 1; + case RADEON_PRIM_TYPE_LINE: + return (nr & 1) || nr == 0; + case RADEON_PRIM_TYPE_LINE_STRIP: + return nr < 2; + case RADEON_PRIM_TYPE_TRI_LIST: + case RADEON_PRIM_TYPE_3VRT_POINT_LIST: + case RADEON_PRIM_TYPE_3VRT_LINE_LIST: + case RADEON_PRIM_TYPE_RECT_LIST: + return nr % 3 || nr == 0; + case RADEON_PRIM_TYPE_TRI_FAN: + case RADEON_PRIM_TYPE_TRI_STRIP: + return nr < 3; + default: + return 1; + } +} + + + +typedef struct { + unsigned int start; + unsigned int finish; + unsigned int prim; + unsigned int numverts; + unsigned int offset; + unsigned int vc_format; +} drm_radeon_tcl_prim_t; + +static void radeon_cp_dispatch_vertex( drm_device_t *dev, + drm_buf_t *buf, + drm_radeon_tcl_prim_t *prim, + drm_clip_rect_t *boxes, + int nbox ) + +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_clip_rect_t box; + int offset = dev_priv->agp_buffers_offset + buf->offset + prim->start; + int numverts = (int)prim->numverts; + int i = 0; + RING_LOCALS; + + DRM_DEBUG("hwprim 0x%x vfmt 0x%x %d..%d %d verts\n", + prim->prim, + prim->vc_format, + prim->start, + prim->finish, + prim->numverts); + + if (bad_prim_vertex_nr( prim->prim, prim->numverts )) { + DRM_ERROR( "bad prim %x numverts %d\n", + prim->prim, prim->numverts ); + return; + } + + do { + /* Emit the next cliprect */ + if ( i < nbox ) { + if (DRM_COPY_FROM_USER_UNCHECKED( &box, &boxes[i], sizeof(box) )) + return; + + radeon_emit_clip_rect( dev_priv, &box ); + } + + /* Emit the vertex buffer rendering commands */ + BEGIN_RING( 5 ); + + OUT_RING( CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, 3 ) ); + OUT_RING( offset ); + OUT_RING( numverts ); + OUT_RING( prim->vc_format ); + OUT_RING( prim->prim | RADEON_PRIM_WALK_LIST | + RADEON_COLOR_ORDER_RGBA | + RADEON_VTX_FMT_RADEON_MODE | + (numverts << RADEON_NUM_VERTICES_SHIFT) ); + + ADVANCE_RING(); + + i++; + } while ( i < nbox ); +} + + + +static void radeon_cp_discard_buffer( drm_device_t *dev, drm_buf_t *buf ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv = buf->dev_private; + RING_LOCALS; + + buf_priv->age = ++dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + RADEON_DISPATCH_AGE( buf_priv->age ); + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; +} + +static void radeon_cp_dispatch_indirect( drm_device_t *dev, + drm_buf_t *buf, + int start, int end ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", + buf->idx, start, end ); + + if ( start != end ) { + int offset = (dev_priv->agp_buffers_offset + + buf->offset + start); + int dwords = (end - start + 3) / sizeof(u32); + + /* Indirect buffer data must be an even number of + * dwords, so if we've been given an odd number we must + * pad the data with a Type-2 CP packet. + */ + if ( dwords & 1 ) { + u32 *data = (u32 *) + ((char *)dev_priv->buffers->handle + + buf->offset + start); + data[dwords++] = RADEON_CP_PACKET2; + } + + /* Fire off the indirect buffer */ + BEGIN_RING( 3 ); + + OUT_RING( CP_PACKET0( RADEON_CP_IB_BASE, 1 ) ); + OUT_RING( offset ); + OUT_RING( dwords ); + + ADVANCE_RING(); + } +} + + +static void radeon_cp_dispatch_indices( drm_device_t *dev, + drm_buf_t *elt_buf, + drm_radeon_tcl_prim_t *prim, + drm_clip_rect_t *boxes, + int nbox ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_clip_rect_t box; + int offset = dev_priv->agp_buffers_offset + prim->offset; + u32 *data; + int dwords; + int i = 0; + int start = prim->start + RADEON_INDEX_PRIM_OFFSET; + int count = (prim->finish - start) / sizeof(u16); + + DRM_DEBUG("hwprim 0x%x vfmt 0x%x %d..%d offset: %x nr %d\n", + prim->prim, + prim->vc_format, + prim->start, + prim->finish, + prim->offset, + prim->numverts); + + if (bad_prim_vertex_nr( prim->prim, count )) { + DRM_ERROR( "bad prim %x count %d\n", + prim->prim, count ); + return; + } + + + if ( start >= prim->finish || + (prim->start & 0x7) ) { + DRM_ERROR( "buffer prim %d\n", prim->prim ); + return; + } + + dwords = (prim->finish - prim->start + 3) / sizeof(u32); + + data = (u32 *)((char *)dev_priv->buffers->handle + + elt_buf->offset + prim->start); + + data[0] = CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, dwords-2 ); + data[1] = offset; + data[2] = prim->numverts; + data[3] = prim->vc_format; + data[4] = (prim->prim | + RADEON_PRIM_WALK_IND | + RADEON_COLOR_ORDER_RGBA | + RADEON_VTX_FMT_RADEON_MODE | + (count << RADEON_NUM_VERTICES_SHIFT) ); + + do { + if ( i < nbox ) { + if (DRM_COPY_FROM_USER_UNCHECKED( &box, &boxes[i], sizeof(box) )) + return; + + radeon_emit_clip_rect( dev_priv, &box ); + } + + radeon_cp_dispatch_indirect( dev, elt_buf, + prim->start, + prim->finish ); + + i++; + } while ( i < nbox ); + +} + +#define RADEON_MAX_TEXTURE_SIZE (RADEON_BUFFER_SIZE - 8 * sizeof(u32)) + +static int radeon_cp_dispatch_texture( drm_device_t *dev, + drm_radeon_texture_t *tex, + drm_radeon_tex_image_t *image ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + u32 format; + u32 *buffer; + const u8 *data; + int size, dwords, tex_width, blit_width; + u32 height; + int i; + RING_LOCALS; + + dev_priv->stats.boxes |= RADEON_BOX_TEXTURE_LOAD; + + /* Flush the pixel cache. This ensures no pixel data gets mixed + * up with the texture data from the host data blit, otherwise + * part of the texture image may be corrupted. + */ + BEGIN_RING( 4 ); + RADEON_FLUSH_CACHE(); + RADEON_WAIT_UNTIL_IDLE(); + ADVANCE_RING(); + +#ifdef __BIG_ENDIAN + /* The Mesa texture functions provide the data in little endian as the + * chip wants it, but we need to compensate for the fact that the CP + * ring gets byte-swapped + */ + BEGIN_RING( 2 ); + OUT_RING_REG( RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_32BIT ); + ADVANCE_RING(); +#endif + + + /* The compiler won't optimize away a division by a variable, + * even if the only legal values are powers of two. Thus, we'll + * use a shift instead. + */ + switch ( tex->format ) { + case RADEON_TXFORMAT_ARGB8888: + case RADEON_TXFORMAT_RGBA8888: + format = RADEON_COLOR_FORMAT_ARGB8888; + tex_width = tex->width * 4; + blit_width = image->width * 4; + break; + case RADEON_TXFORMAT_AI88: + case RADEON_TXFORMAT_ARGB1555: + case RADEON_TXFORMAT_RGB565: + case RADEON_TXFORMAT_ARGB4444: + case RADEON_TXFORMAT_VYUY422: + case RADEON_TXFORMAT_YVYU422: + format = RADEON_COLOR_FORMAT_RGB565; + tex_width = tex->width * 2; + blit_width = image->width * 2; + break; + case RADEON_TXFORMAT_I8: + case RADEON_TXFORMAT_RGB332: + format = RADEON_COLOR_FORMAT_CI8; + tex_width = tex->width * 1; + blit_width = image->width * 1; + break; + default: + DRM_ERROR( "invalid texture format %d\n", tex->format ); + return DRM_ERR(EINVAL); + } + + DRM_DEBUG("tex=%dx%d blit=%d\n", tex_width, tex->height, blit_width ); + + do { + DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", + tex->offset >> 10, tex->pitch, tex->format, + image->x, image->y, image->width, image->height ); + + /* Make a copy of some parameters in case we have to + * update them for a multi-pass texture blit. + */ + height = image->height; + data = (const u8 *)image->data; + + size = height * blit_width; + + if ( size > RADEON_MAX_TEXTURE_SIZE ) { + height = RADEON_MAX_TEXTURE_SIZE / blit_width; + size = height * blit_width; + } else if ( size < 4 && size > 0 ) { + size = 4; + } else if ( size == 0 ) { + return 0; + } + + buf = radeon_freelist_get( dev ); + if ( 0 && !buf ) { + radeon_do_cp_idle( dev_priv ); + buf = radeon_freelist_get( dev ); + } + if ( !buf ) { + DRM_DEBUG("radeon_cp_dispatch_texture: EAGAIN\n"); + DRM_COPY_TO_USER( tex->image, image, sizeof(*image) ); + return DRM_ERR(EAGAIN); + } + + + /* Dispatch the indirect buffer. + */ + buffer = (u32*)((char*)dev_priv->buffers->handle + buf->offset); + dwords = size / 4; + buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 ); + buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_NONE | + (format << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_S | + RADEON_DP_SRC_SOURCE_HOST_DATA | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_WR_MSK_DIS); + + buffer[2] = (tex->pitch << 22) | (tex->offset >> 10); + buffer[3] = 0xffffffff; + buffer[4] = 0xffffffff; + buffer[5] = (image->y << 16) | image->x; + buffer[6] = (height << 16) | image->width; + buffer[7] = dwords; + buffer += 8; + + if ( tex_width >= 32 ) { + /* Texture image width is larger than the minimum, so we + * can upload it directly. + */ + if ( DRM_COPY_FROM_USER( buffer, data, + dwords * sizeof(u32) ) ) { + DRM_ERROR( "EFAULT on data, %d dwords\n", + dwords ); + return DRM_ERR(EFAULT); + } + } else { + /* Texture image width is less than the minimum, so we + * need to pad out each image scanline to the minimum + * width. + */ + for ( i = 0 ; i < tex->height ; i++ ) { + if ( DRM_COPY_FROM_USER( buffer, data, + tex_width ) ) { + DRM_ERROR( "EFAULT on pad, %d bytes\n", + tex_width ); + return DRM_ERR(EFAULT); + } + buffer += 8; + data += tex_width; + } + } + + buf->pid = DRM_CURRENTPID; + buf->used = (dwords + 8) * sizeof(u32); + radeon_cp_dispatch_indirect( dev, buf, 0, buf->used ); + radeon_cp_discard_buffer( dev, buf ); + + /* Update the input parameters for next time */ + image->y += height; + image->height -= height; + (const u8 *)image->data += size; + } while (image->height > 0); + + /* Flush the pixel cache after the blit completes. This ensures + * the texture data is written out to memory before rendering + * continues. + */ + BEGIN_RING( 4 ); + RADEON_FLUSH_CACHE(); + RADEON_WAIT_UNTIL_2D_IDLE(); + ADVANCE_RING(); + return 0; +} + + +static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + DRM_DEBUG( "\n" ); + + BEGIN_RING( 35 ); + + OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) ); + OUT_RING( 0x00000000 ); + + OUT_RING( CP_PACKET0_TABLE( RADEON_RE_STIPPLE_DATA, 31 ) ); + for ( i = 0 ; i < 32 ; i++ ) { + OUT_RING( stipple[i] ); + } + + ADVANCE_RING(); +} + + +/* ================================================================ + * IOCTL functions + */ + +int radeon_cp_clear( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_clear_t clear; + drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( clear, (drm_radeon_clear_t *)data, + sizeof(clear) ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; + + if ( DRM_COPY_FROM_USER( &depth_boxes, clear.depth_boxes, + sarea_priv->nbox * sizeof(depth_boxes[0]) ) ) + return DRM_ERR(EFAULT); + + radeon_cp_dispatch_clear( dev, &clear, depth_boxes ); + + COMMIT_RING(); + return 0; +} + + +/* Not sure why this isn't set all the time: + */ +static int radeon_do_init_pageflip( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + DRM_DEBUG( "\n" ); + + BEGIN_RING( 6 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET_CNTL, 0 ) ); + OUT_RING( RADEON_READ( RADEON_CRTC_OFFSET_CNTL ) | RADEON_CRTC_OFFSET_FLIP_CNTL ); + OUT_RING( CP_PACKET0( RADEON_CRTC2_OFFSET_CNTL, 0 ) ); + OUT_RING( RADEON_READ( RADEON_CRTC2_OFFSET_CNTL ) | RADEON_CRTC_OFFSET_FLIP_CNTL ); + ADVANCE_RING(); + + dev_priv->page_flipping = 1; + dev_priv->current_page = 0; + dev_priv->sarea_priv->pfCurrentPage = dev_priv->current_page; + + return 0; +} + +/* Called whenever a client dies, from DRM(release). + * NOTE: Lock isn't necessarily held when this is called! + */ +int radeon_do_cleanup_pageflip( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + if (dev_priv->current_page != 0) + radeon_cp_dispatch_flip( dev ); + + dev_priv->page_flipping = 0; + return 0; +} + +/* Swapping and flipping are different operations, need different ioctls. + * They can & should be intermixed to support multiple 3d windows. + */ +int radeon_cp_flip( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if (!dev_priv->page_flipping) + radeon_do_init_pageflip( dev ); + + radeon_cp_dispatch_flip( dev ); + + COMMIT_RING(); + return 0; +} + +int radeon_cp_swap( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + DRM_DEBUG( "\n" ); + + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; + + radeon_cp_dispatch_swap( dev ); + dev_priv->sarea_priv->ctx_owner = 0; + + COMMIT_RING(); + return 0; +} + +int radeon_cp_vertex( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_vertex_t vertex; + drm_radeon_tcl_prim_t prim; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex_t *)data, + sizeof(vertex) ); + + DRM_DEBUG( "pid=%d index=%d count=%d discard=%d\n", + DRM_CURRENTPID, + vertex.idx, vertex.count, vertex.discard ); + + if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + vertex.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + if ( vertex.prim < 0 || + vertex.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[vertex.idx]; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + return DRM_ERR(EINVAL); + } + + /* Build up a prim_t record: + */ + if (vertex.count) { + buf->used = vertex.count; /* not used? */ + + if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { + radeon_emit_state( dev_priv, + &sarea_priv->context_state, + sarea_priv->tex_state, + sarea_priv->dirty ); + + sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | + RADEON_UPLOAD_TEX1IMAGES | + RADEON_UPLOAD_TEX2IMAGES | + RADEON_REQUIRE_QUIESCENCE); + } + + prim.start = 0; + prim.finish = vertex.count; /* unused */ + prim.prim = vertex.prim; + prim.numverts = vertex.count; + prim.vc_format = dev_priv->sarea_priv->vc_format; + + radeon_cp_dispatch_vertex( dev, buf, &prim, + dev_priv->sarea_priv->boxes, + dev_priv->sarea_priv->nbox ); + } + + if (vertex.discard) { + radeon_cp_discard_buffer( dev, buf ); + } + + COMMIT_RING(); + return 0; +} + +int radeon_cp_indices( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_indices_t elts; + drm_radeon_tcl_prim_t prim; + int count; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( elts, (drm_radeon_indices_t *)data, + sizeof(elts) ); + + DRM_DEBUG( "pid=%d index=%d start=%d end=%d discard=%d\n", + DRM_CURRENTPID, + elts.idx, elts.start, elts.end, elts.discard ); + + if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + elts.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + if ( elts.prim < 0 || + elts.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { + DRM_ERROR( "buffer prim %d\n", elts.prim ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[elts.idx]; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", elts.idx ); + return DRM_ERR(EINVAL); + } + + count = (elts.end - elts.start) / sizeof(u16); + elts.start -= RADEON_INDEX_PRIM_OFFSET; + + if ( elts.start & 0x7 ) { + DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); + return DRM_ERR(EINVAL); + } + if ( elts.start < buf->used ) { + DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); + return DRM_ERR(EINVAL); + } + + buf->used = elts.end; + + if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { + radeon_emit_state( dev_priv, + &sarea_priv->context_state, + sarea_priv->tex_state, + sarea_priv->dirty ); + + sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | + RADEON_UPLOAD_TEX1IMAGES | + RADEON_UPLOAD_TEX2IMAGES | + RADEON_REQUIRE_QUIESCENCE); + } + + + /* Build up a prim_t record: + */ + prim.start = elts.start; + prim.finish = elts.end; + prim.prim = elts.prim; + prim.offset = 0; /* offset from start of dma buffers */ + prim.numverts = RADEON_MAX_VB_VERTS; /* duh */ + prim.vc_format = dev_priv->sarea_priv->vc_format; + + radeon_cp_dispatch_indices( dev, buf, &prim, + dev_priv->sarea_priv->boxes, + dev_priv->sarea_priv->nbox ); + if (elts.discard) { + radeon_cp_discard_buffer( dev, buf ); + } + + COMMIT_RING(); + return 0; +} + +int radeon_cp_texture( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_texture_t tex; + drm_radeon_tex_image_t image; + int ret; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( tex, (drm_radeon_texture_t *)data, sizeof(tex) ); + + if ( tex.image == NULL ) { + DRM_ERROR( "null texture image!\n" ); + return DRM_ERR(EINVAL); + } + + if ( DRM_COPY_FROM_USER( &image, + (drm_radeon_tex_image_t *)tex.image, + sizeof(image) ) ) + return DRM_ERR(EFAULT); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + ret = radeon_cp_dispatch_texture( dev, &tex, &image ); + + COMMIT_RING(); + return ret; +} + +int radeon_cp_stipple( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_stipple_t stipple; + u32 mask[32]; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_COPY_FROM_USER_IOCTL( stipple, (drm_radeon_stipple_t *)data, + sizeof(stipple) ); + + if ( DRM_COPY_FROM_USER( &mask, stipple.mask, 32 * sizeof(u32) ) ) + return DRM_ERR(EFAULT); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + radeon_cp_dispatch_stipple( dev, mask ); + + COMMIT_RING(); + return 0; +} + +int radeon_cp_indirect( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_indirect_t indirect; + RING_LOCALS; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( indirect, (drm_radeon_indirect_t *)data, + sizeof(indirect) ); + + DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", + indirect.idx, indirect.start, + indirect.end, indirect.discard ); + + if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + indirect.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + + buf = dma->buflist[indirect.idx]; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); + return DRM_ERR(EINVAL); + } + + if ( indirect.start < buf->used ) { + DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", + indirect.start, buf->used ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf->used = indirect.end; + + /* Wait for the 3D stream to idle before the indirect buffer + * containing 2D acceleration commands is processed. + */ + BEGIN_RING( 2 ); + + RADEON_WAIT_UNTIL_3D_IDLE(); + + ADVANCE_RING(); + + /* Dispatch the indirect buffer full of commands from the + * X server. This is insecure and is thus only available to + * privileged clients. + */ + radeon_cp_dispatch_indirect( dev, buf, indirect.start, indirect.end ); + if (indirect.discard) { + radeon_cp_discard_buffer( dev, buf ); + } + + + COMMIT_RING(); + return 0; +} + +int radeon_cp_vertex2( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_vertex2_t vertex; + int i; + unsigned char laststate; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex2_t *)data, + sizeof(vertex) ); + + DRM_DEBUG( "pid=%d index=%d discard=%d\n", + DRM_CURRENTPID, + vertex.idx, vertex.discard ); + + if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + vertex.idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[vertex.idx]; + + if ( buf->pid != DRM_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_CURRENTPID, buf->pid ); + return DRM_ERR(EINVAL); + } + + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + return DRM_ERR(EINVAL); + } + + if (sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS) + return DRM_ERR(EINVAL); + + for (laststate = 0xff, i = 0 ; i < vertex.nr_prims ; i++) { + drm_radeon_prim_t prim; + drm_radeon_tcl_prim_t tclprim; + + if ( DRM_COPY_FROM_USER( &prim, &vertex.prim[i], sizeof(prim) ) ) + return DRM_ERR(EFAULT); + + if ( prim.stateidx != laststate ) { + drm_radeon_state_t state; + + if ( DRM_COPY_FROM_USER( &state, + &vertex.state[prim.stateidx], + sizeof(state) ) ) + return DRM_ERR(EFAULT); + + radeon_emit_state2( dev_priv, &state ); + + laststate = prim.stateidx; + } + + tclprim.start = prim.start; + tclprim.finish = prim.finish; + tclprim.prim = prim.prim; + tclprim.vc_format = prim.vc_format; + + if ( prim.prim & RADEON_PRIM_WALK_IND ) { + tclprim.offset = prim.numverts * 64; + tclprim.numverts = RADEON_MAX_VB_VERTS; /* duh */ + + radeon_cp_dispatch_indices( dev, buf, &tclprim, + sarea_priv->boxes, + sarea_priv->nbox); + } else { + tclprim.numverts = prim.numverts; + tclprim.offset = 0; /* not used */ + + radeon_cp_dispatch_vertex( dev, buf, &tclprim, + sarea_priv->boxes, + sarea_priv->nbox); + } + + if (sarea_priv->nbox == 1) + sarea_priv->nbox = 0; + } + + if ( vertex.discard ) { + radeon_cp_discard_buffer( dev, buf ); + } + + COMMIT_RING(); + return 0; +} + + +static int radeon_emit_packets( + drm_radeon_private_t *dev_priv, + drm_radeon_cmd_header_t header, + drm_radeon_cmd_buffer_t *cmdbuf ) +{ + int id = (int)header.packet.packet_id; + int sz, reg; + int *data = (int *)cmdbuf->buf; + RING_LOCALS; + + if (id >= RADEON_MAX_STATE_PACKETS) + return DRM_ERR(EINVAL); + + sz = packet[id].len; + reg = packet[id].start; + + if (sz * sizeof(int) > cmdbuf->bufsz) + return DRM_ERR(EINVAL); + + BEGIN_RING(sz+1); + OUT_RING( CP_PACKET0( reg, (sz-1) ) ); + OUT_RING_USER_TABLE( data, sz ); + ADVANCE_RING(); + + cmdbuf->buf += sz * sizeof(int); + cmdbuf->bufsz -= sz * sizeof(int); + return 0; +} + +static __inline__ int radeon_emit_scalars( + drm_radeon_private_t *dev_priv, + drm_radeon_cmd_header_t header, + drm_radeon_cmd_buffer_t *cmdbuf ) +{ + int sz = header.scalars.count; + int *data = (int *)cmdbuf->buf; + int start = header.scalars.offset; + int stride = header.scalars.stride; + RING_LOCALS; + + BEGIN_RING( 3+sz ); + OUT_RING( CP_PACKET0( RADEON_SE_TCL_SCALAR_INDX_REG, 0 ) ); + OUT_RING( start | (stride << RADEON_SCAL_INDX_DWORD_STRIDE_SHIFT)); + OUT_RING( CP_PACKET0_TABLE( RADEON_SE_TCL_SCALAR_DATA_REG, sz-1 ) ); + OUT_RING_USER_TABLE( data, sz ); + ADVANCE_RING(); + cmdbuf->buf += sz * sizeof(int); + cmdbuf->bufsz -= sz * sizeof(int); + return 0; +} + +/* God this is ugly + */ +static __inline__ int radeon_emit_scalars2( + drm_radeon_private_t *dev_priv, + drm_radeon_cmd_header_t header, + drm_radeon_cmd_buffer_t *cmdbuf ) +{ + int sz = header.scalars.count; + int *data = (int *)cmdbuf->buf; + int start = ((unsigned int)header.scalars.offset) + 0x100; + int stride = header.scalars.stride; + RING_LOCALS; + + BEGIN_RING( 3+sz ); + OUT_RING( CP_PACKET0( RADEON_SE_TCL_SCALAR_INDX_REG, 0 ) ); + OUT_RING( start | (stride << RADEON_SCAL_INDX_DWORD_STRIDE_SHIFT)); + OUT_RING( CP_PACKET0_TABLE( RADEON_SE_TCL_SCALAR_DATA_REG, sz-1 ) ); + OUT_RING_USER_TABLE( data, sz ); + ADVANCE_RING(); + cmdbuf->buf += sz * sizeof(int); + cmdbuf->bufsz -= sz * sizeof(int); + return 0; +} + +static __inline__ int radeon_emit_vectors( + drm_radeon_private_t *dev_priv, + drm_radeon_cmd_header_t header, + drm_radeon_cmd_buffer_t *cmdbuf ) +{ + int sz = header.vectors.count; + int *data = (int *)cmdbuf->buf; + int start = header.vectors.offset; + int stride = header.vectors.stride; + RING_LOCALS; + + BEGIN_RING( 3+sz ); + OUT_RING( CP_PACKET0( RADEON_SE_TCL_VECTOR_INDX_REG, 0 ) ); + OUT_RING( start | (stride << RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT)); + OUT_RING( CP_PACKET0_TABLE( RADEON_SE_TCL_VECTOR_DATA_REG, (sz-1) ) ); + OUT_RING_USER_TABLE( data, sz ); + ADVANCE_RING(); + + cmdbuf->buf += sz * sizeof(int); + cmdbuf->bufsz -= sz * sizeof(int); + return 0; +} + + +static int radeon_emit_packet3( drm_device_t *dev, + drm_radeon_cmd_buffer_t *cmdbuf ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + int cmdsz, tmp; + int *cmd = (int *)cmdbuf->buf; + RING_LOCALS; + + + DRM_DEBUG("\n"); + + if (DRM_GET_USER_UNCHECKED( tmp, &cmd[0])) + return DRM_ERR(EFAULT); + + cmdsz = 2 + ((tmp & RADEON_CP_PACKET_COUNT_MASK) >> 16); + + if ((tmp & 0xc0000000) != RADEON_CP_PACKET3 || + cmdsz * 4 > cmdbuf->bufsz) + return DRM_ERR(EINVAL); + + BEGIN_RING( cmdsz ); + OUT_RING_USER_TABLE( cmd, cmdsz ); + ADVANCE_RING(); + + cmdbuf->buf += cmdsz * 4; + cmdbuf->bufsz -= cmdsz * 4; + return 0; +} + + +static int radeon_emit_packet3_cliprect( drm_device_t *dev, + drm_radeon_cmd_buffer_t *cmdbuf, + int orig_nbox ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_clip_rect_t box; + int cmdsz, tmp; + int *cmd = (int *)cmdbuf->buf; + drm_clip_rect_t *boxes = cmdbuf->boxes; + int i = 0; + RING_LOCALS; + + DRM_DEBUG("\n"); + + if (DRM_GET_USER_UNCHECKED( tmp, &cmd[0])) + return DRM_ERR(EFAULT); + + cmdsz = 2 + ((tmp & RADEON_CP_PACKET_COUNT_MASK) >> 16); + + if ((tmp & 0xc0000000) != RADEON_CP_PACKET3 || + cmdsz * 4 > cmdbuf->bufsz) + return DRM_ERR(EINVAL); + + if (!orig_nbox) + goto out; + + do { + if ( i < cmdbuf->nbox ) { + if (DRM_COPY_FROM_USER_UNCHECKED( &box, &boxes[i], sizeof(box) )) + return DRM_ERR(EFAULT); + /* FIXME The second and subsequent times round + * this loop, send a WAIT_UNTIL_3D_IDLE before + * calling emit_clip_rect(). This fixes a + * lockup on fast machines when sending + * several cliprects with a cmdbuf, as when + * waving a 2D window over a 3D + * window. Something in the commands from user + * space seems to hang the card when they're + * sent several times in a row. That would be + * the correct place to fix it but this works + * around it until I can figure that out - Tim + * Smith */ + if ( i ) { + BEGIN_RING( 2 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + ADVANCE_RING(); + } + radeon_emit_clip_rect( dev_priv, &box ); + } + + BEGIN_RING( cmdsz ); + OUT_RING_USER_TABLE( cmd, cmdsz ); + ADVANCE_RING(); + + } while ( ++i < cmdbuf->nbox ); + if (cmdbuf->nbox == 1) + cmdbuf->nbox = 0; + + out: + cmdbuf->buf += cmdsz * 4; + cmdbuf->bufsz -= cmdsz * 4; + return 0; +} + + +static int radeon_emit_wait( drm_device_t *dev, int flags ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + DRM_DEBUG("%s: %x\n", __FUNCTION__, flags); + switch (flags) { + case RADEON_WAIT_2D: + BEGIN_RING( 2 ); + RADEON_WAIT_UNTIL_2D_IDLE(); + ADVANCE_RING(); + break; + case RADEON_WAIT_3D: + BEGIN_RING( 2 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + ADVANCE_RING(); + break; + case RADEON_WAIT_2D|RADEON_WAIT_3D: + BEGIN_RING( 2 ); + RADEON_WAIT_UNTIL_IDLE(); + ADVANCE_RING(); + break; + default: + return DRM_ERR(EINVAL); + } + + return 0; +} + +int radeon_cp_cmdbuf( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf = 0; + int idx; + drm_radeon_cmd_buffer_t cmdbuf; + drm_radeon_cmd_header_t header; + int orig_nbox; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( cmdbuf, (drm_radeon_cmd_buffer_t *)data, + sizeof(cmdbuf) ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + + if (DRM_VERIFYAREA_READ( cmdbuf.buf, cmdbuf.bufsz )) + return DRM_ERR(EFAULT); + + if (cmdbuf.nbox && + DRM_VERIFYAREA_READ(cmdbuf.boxes, + cmdbuf.nbox * sizeof(drm_clip_rect_t))) + return DRM_ERR(EFAULT); + + orig_nbox = cmdbuf.nbox; + + while ( cmdbuf.bufsz >= sizeof(header) ) { + + if (DRM_GET_USER_UNCHECKED( header.i, (int *)cmdbuf.buf )) { + DRM_ERROR("__get_user %p\n", cmdbuf.buf); + return DRM_ERR(EFAULT); + } + + cmdbuf.buf += sizeof(header); + cmdbuf.bufsz -= sizeof(header); + + switch (header.header.cmd_type) { + case RADEON_CMD_PACKET: + DRM_DEBUG("RADEON_CMD_PACKET\n"); + if (radeon_emit_packets( dev_priv, header, &cmdbuf )) { + DRM_ERROR("radeon_emit_packets failed\n"); + return DRM_ERR(EINVAL); + } + break; + + case RADEON_CMD_SCALARS: + DRM_DEBUG("RADEON_CMD_SCALARS\n"); + if (radeon_emit_scalars( dev_priv, header, &cmdbuf )) { + DRM_ERROR("radeon_emit_scalars failed\n"); + return DRM_ERR(EINVAL); + } + break; + + case RADEON_CMD_VECTORS: + DRM_DEBUG("RADEON_CMD_VECTORS\n"); + if (radeon_emit_vectors( dev_priv, header, &cmdbuf )) { + DRM_ERROR("radeon_emit_vectors failed\n"); + return DRM_ERR(EINVAL); + } + break; + + case RADEON_CMD_DMA_DISCARD: + DRM_DEBUG("RADEON_CMD_DMA_DISCARD\n"); + idx = header.dma.buf_idx; + if ( idx < 0 || idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + idx, dma->buf_count - 1 ); + return DRM_ERR(EINVAL); + } + + buf = dma->buflist[idx]; + if ( buf->pid != DRM_CURRENTPID || buf->pending ) { + DRM_ERROR( "bad buffer\n" ); + return DRM_ERR(EINVAL); + } + + radeon_cp_discard_buffer( dev, buf ); + break; + + case RADEON_CMD_PACKET3: + DRM_DEBUG("RADEON_CMD_PACKET3\n"); + if (radeon_emit_packet3( dev, &cmdbuf )) { + DRM_ERROR("radeon_emit_packet3 failed\n"); + return DRM_ERR(EINVAL); + } + break; + + case RADEON_CMD_PACKET3_CLIP: + DRM_DEBUG("RADEON_CMD_PACKET3_CLIP\n"); + if (radeon_emit_packet3_cliprect( dev, &cmdbuf, orig_nbox )) { + DRM_ERROR("radeon_emit_packet3_clip failed\n"); + return DRM_ERR(EINVAL); + } + break; + + case RADEON_CMD_SCALARS2: + DRM_DEBUG("RADEON_CMD_SCALARS2\n"); + if (radeon_emit_scalars2( dev_priv, header, &cmdbuf )) { + DRM_ERROR("radeon_emit_scalars2 failed\n"); + return DRM_ERR(EINVAL); + } + break; + + case RADEON_CMD_WAIT: + DRM_DEBUG("RADEON_CMD_WAIT\n"); + if (radeon_emit_wait( dev, header.wait.flags )) { + DRM_ERROR("radeon_emit_wait failed\n"); + return DRM_ERR(EINVAL); + } + break; + default: + DRM_ERROR("bad cmd_type %d at %p\n", + header.header.cmd_type, + cmdbuf.buf - sizeof(header)); + return DRM_ERR(EINVAL); + } + } + + + DRM_DEBUG("DONE\n"); + COMMIT_RING(); + return 0; +} + + + +int radeon_cp_getparam( DRM_IOCTL_ARGS ) +{ + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_getparam_t param; + int value; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR(EINVAL); + } + + DRM_COPY_FROM_USER_IOCTL( param, (drm_radeon_getparam_t *)data, + sizeof(param) ); + + DRM_DEBUG( "pid=%d\n", DRM_CURRENTPID ); + + switch( param.param ) { + case RADEON_PARAM_AGP_BUFFER_OFFSET: + value = dev_priv->agp_buffers_offset; + break; + case RADEON_PARAM_LAST_FRAME: + dev_priv->stats.last_frame_reads++; + value = GET_SCRATCH( 0 ); + break; + case RADEON_PARAM_LAST_DISPATCH: + value = GET_SCRATCH( 1 ); + break; + case RADEON_PARAM_LAST_CLEAR: + dev_priv->stats.last_clear_reads++; + value = GET_SCRATCH( 2 ); + break; + case RADEON_PARAM_IRQ_NR: + value = dev->irq; + break; + case RADEON_PARAM_AGP_BASE: + value = dev_priv->agp_vm_start; + break; + default: + return DRM_ERR(EINVAL); + } + + if ( DRM_COPY_TO_USER( param.value, &value, sizeof(int) ) ) { + DRM_ERROR( "copy_to_user\n" ); + return DRM_ERR(EFAULT); + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile:1.2 Fri Aug 17 18:08:15 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile Wed Oct 16 22:22:49 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile,v 1.2 2001/08/17 22:08:15 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile,v 1.4 2002/10/17 02:22:49 dawes Exp $ XCOMM XCOMM Copyright 2001 The XFree86 Project, Inc. All Rights Reserved. XCOMM Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c:1.5 Sun Nov 25 08:51:24 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c Thu Jun 6 09:49:34 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c,v 1.5 2001/11/25 13:51:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c,v 1.6 2002/06/06 13:49:34 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -116,7 +116,7 @@ if (ioctl(fd, VT_ACTIVATE, i) != 0) FreeVTslot = 1; - if (!FreeVTslot) || + if (!FreeVTslot || (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || (xf86Info.vtno == -1)) FatalError("xf86OpenConsole: Cannot find a free VT\n"); Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c:1.1 Sun May 27 22:42:31 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c Mon Feb 17 10:12:00 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c,v 1.1 2001/05/28 02:42:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c,v 1.3 2003/02/17 15:12:00 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -53,4 +53,12 @@ { if( ioctl(xf86Info.kbdFd, KIOCSLED, &leds) < 0 ) ErrorF("Failed to set Keyboard LED's\n"); +} + +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; } Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c:1.3 Sat Oct 27 23:34:03 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c Fri Jan 25 16:56:21 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c,v 1.3 2001/10/28 03:34:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c,v 1.4 2002/01/25 21:56:21 tsi Exp $ */ /* * Copyright 1999-2001 The XFree86 Project, Inc. All Rights Reserved. * @@ -281,6 +281,12 @@ return "VUID"; } +static const char * +SetupAuto(InputInfoPtr pInfo, int *protoPara) +{ + return DefaultProtocol(); +} + #else /* __SOL8__ || !i386 */ #undef MSE_MISC @@ -306,9 +312,10 @@ p->SupportedInterfaces = SupportedInterfaces; #if defined(__SOL8__) || !defined(i386) p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; p->CheckProtocol = CheckProtocol; p->PreInit = sunMousePreInit; + p->DefaultProtocol = DefaultProtocol; + p->SetupAuto = SetupAuto; #endif return p; } Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c:1.2 Sat Oct 27 23:34:03 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c Wed Oct 2 22:04:19 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c,v 1.2 2001/10/28 03:34:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c,v 1.3 2002/10/03 02:04:19 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -54,15 +54,14 @@ apertureDevName = "/dev/fbs/aperture"; if((mmapFd = open(apertureDevName, O_RDWR)) < 0) { - xf86Msg(X_WARNING, - "xf86LinearVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - xf86Msg(X_WARNING, "xf86LinearVidMem:" - " either /dev/fbs/aperture or" - " /dev/xsvc device driver" - " required\n"); - xf86Msg(X_WARNING, - "xf86LinearVidMem: linear memory access disabled\n"); + xf86MsgVerb(X_WARNING, 0, + "xf86LinearVidMem: failed to open %s (%s)\n", + apertureDevName, strerror(errno)); + xf86MsgVerb(X_WARNING, 0, + "xf86LinearVidMem: either /dev/fbs/aperture or /dev/xsvc" + " device driver required\n"); + xf86MsgVerb(X_WARNING, 0, + "xf86LinearVidMem: linear memory access disabled\n"); apertureDevName = NULL; return FALSE; } Index: xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile:3.23 xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile:3.25 --- xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile:3.23 Tue Aug 15 12:05:40 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile Wed Oct 16 22:22:50 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile,v 3.23 2000/08/15 16:05:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile,v 3.25 2002/10/17 02:22:50 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c:3.9 xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c:3.11 --- xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c:3.9 Sat Sep 4 09:04:49 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c Mon Feb 17 10:12:00 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c,v 3.9 1999/09/04 13:04:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c,v 3.11 2003/02/17 15:12:00 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -65,3 +65,10 @@ #endif } +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile:1.10 Fri Aug 17 18:08:15 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile Thu Feb 27 12:33:01 2003 @@ -1,37 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.10 2001/08/17 22:08:15 tsi Exp $ - -#define IHaveModules -#include <Server.tmpl> - -#if DoLoadableServer -MODSRC = vbe_module.c -MODOBJ = vbe_module.o -#endif - -SRCS = vbe.c $(MODSRC) -OBJS = vbe.o $(MODOBJ) - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \ - -I$(XF86SRC)/i2c - -ModuleObjectRule() - -#if DoLoadableServer - -LibraryModuleTarget(vbe, $(OBJS)) -InstallLibraryModule(vbe,$(MODULEDIR),.) - -#else - -SubdirLibraryRule($(OBJS)) - -#endif - -DependTarget() - -InstallDriverSDKLibraryModule(vbe,$(DRIVERSDKMODULEDIR),.) - -InstallDriverSDKNonExecFile(vbe.h,$(DRIVERSDKINCLUDEDIR)) - Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.19 xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.19 Fri Nov 16 14:17:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c Thu Feb 27 12:33:01 2003 @@ -1,900 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.19 2001/11/16 19:17:27 dawes Exp $ */ - -/* - * XFree86 vbe module - * Copyright 2000 Egbert Eich - * - * The mode query/save/set/restore functions from the vesa driver - * have been moved here. - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - */ - -#include "xf86.h" -#include "xf86_ansic.h" -#include "vbe.h" -#include "Xarch.h" - -#define VERSION(x) *((CARD8*)(&x) + 1),(CARD8)(x) - -#if X_BYTE_ORDER == X_LITTLE_ENDIAN -#define B_O16(x) (x) -#define B_O32(x) (x) -#else -#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) -#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ - | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) -#endif -#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) - -#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) - -static unsigned char * vbeReadEDID(vbeInfoPtr pVbe); -static Bool vbeProbeDDC(vbeInfoPtr pVbe); - -static const char *ddcSymbols[] = { - "xf86InterpretEDID", - NULL -}; - -vbeInfoPtr -VBEInit(xf86Int10InfoPtr pInt, int entityIndex) -{ - int RealOff; - pointer page = NULL; - ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex); - vbeControllerInfoPtr vbe = NULL; - char vbeVersionString[] = "VBE2"; - Bool init_int10 = FALSE; - vbeInfoPtr vip = NULL; - int screen = pScrn->scrnIndex; - - if (!pInt) { - if (!xf86LoadSubModule(pScrn, "int10")) - goto error; - - xf86DrvMsg(screen,X_INFO,"initializing int10\n"); - pInt = xf86InitInt10(entityIndex); - if (!pInt) - goto error; - init_int10 = TRUE; - } - - page = xf86Int10AllocPages(pInt,1,&RealOff); - if (!page) goto error; - vbe = (vbeControllerInfoPtr) page; - memcpy(vbe->VbeSignature,vbeVersionString,4); - - pInt->ax = 0x4F00; - pInt->es = SEG_ADDR(RealOff); - pInt->di = SEG_OFF(RealOff); - pInt->num = 0x10; - - xf86ExecX86int10(pInt); - - if ((pInt->ax & 0xff) != 0x4f) { - xf86DrvMsgVerb(screen,X_INFO,3,"VESA BIOS not detected\n"); - goto error; - } - - switch (pInt->ax & 0xff00) { - case 0: - xf86DrvMsg(screen,X_INFO,"VESA BIOS detected\n"); - break; - case 0x100: - xf86DrvMsg(screen,X_INFO,"VESA BIOS function failed\n"); - goto error; - case 0x200: - xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported\n"); - goto error; - case 0x300: - xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported in current mode\n"); - goto error; - default: - xf86DrvMsg(screen,X_INFO,"Invalid\n"); - goto error; - } - - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Version %i.%i\n", - VERSION(vbe->VbeVersion)); - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Total Mem: %i kB\n", - vbe->TotalMem * 64); - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM: %s\n", - (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemStringPtr))); - - if (B_O16(vbe->VbeVersion) >= 0x200) { - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Software Rev: %i.%i\n", - VERSION(vbe->OemSoftwareRev)); - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Vendor: %s\n", - (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemVendorNamePtr))); - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product: %s\n", - (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductNamePtr))); - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product Rev: %s\n", - (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductRevPtr))); - } - vip = (vbeInfoPtr)xnfalloc(sizeof(vbeInfoRec)); - vip->version = B_O16(vbe->VbeVersion); - vip->pInt10 = pInt; - vip->ddc = DDC_UNCHECKED; - vip->memory = page; - vip->real_mode_base = RealOff; - vip->num_pages = 1; - vip->init_int10 = init_int10; - - return vip; - - error: - if (page) - xf86Int10FreePages(pInt, page, 1); - if (init_int10) - xf86FreeInt10(pInt); - return NULL; -} - -void -vbeFree(vbeInfoPtr pVbe) -{ - if (!pVbe) - return; - - xf86Int10FreePages(pVbe->pInt10,pVbe->memory,pVbe->num_pages); - /* If we have initalized int10 we ought to free it, too */ - if (pVbe->init_int10) - xf86FreeInt10(pVbe->pInt10); - xfree(pVbe); - return; -} - -static Bool -vbeProbeDDC(vbeInfoPtr pVbe) -{ - char *ddc_level; - int screen = pVbe->pInt10->scrnIndex; - - if (!pVbe || (pVbe->ddc == DDC_NONE)) - return FALSE; - if (pVbe->ddc != DDC_UNCHECKED) - return TRUE; - - pVbe->pInt10->ax = 0x4F15; - pVbe->pInt10->bx = 0; - pVbe->pInt10->cx = 0; - pVbe->pInt10->es = 0; - pVbe->pInt10->di = 0; - pVbe->pInt10->num = 0x10; - - xf86ExecX86int10(pVbe->pInt10); - - if ((pVbe->pInt10->ax & 0xff) != 0x4f) { - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC not supported\n"); - pVbe->ddc = DDC_NONE; - return FALSE; - } - - switch ((pVbe->pInt10->ax >> 8) & 0xff) { - case 0: - xf86DrvMsg(screen,X_INFO,"VESA VBE DDC supported\n"); - switch (pVbe->pInt10->bx & 0x3) { - case 0: - ddc_level = " none"; - pVbe->ddc = DDC_NONE; - break; - case 1: - ddc_level = " 1"; - pVbe->ddc = DDC_1; - break; - case 2: - ddc_level = " 2"; - pVbe->ddc = DDC_2; - break; - case 3: - ddc_level = " 1 + 2"; - pVbe->ddc = DDC_1_2; - break; - default: - ddc_level = ""; - pVbe->ddc = DDC_NONE; - break; - } - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level%s\n",ddc_level); - if (pVbe->pInt10->bx & 0x4) { - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Screen blanked" - "for data transfer\n"); - pVbe->ddc_blank = TRUE; - } else - pVbe->ddc_blank = FALSE; - - xf86DrvMsgVerb(screen,X_INFO,3, - "VESA VBE DDC transfer in appr. %x sec.\n", - (pVbe->pInt10->bx >> 8) & 0xff); - } - - return TRUE; -} - -typedef enum { - VBEOPT_NOVBE, - VBEOPT_NODDC -} VBEOpts; - -static const OptionInfoRec VBEOptions[] = { - { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE }, - { VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE }, -}; - -static unsigned char * -vbeReadEDID(vbeInfoPtr pVbe) -{ - int RealOff = pVbe->real_mode_base; - pointer page = pVbe->memory; - unsigned char *tmp = NULL; - Bool novbe = FALSE; - Bool noddc = FALSE; - int screen = pVbe->pInt10->scrnIndex; - OptionInfoPtr options; - - if (!page) return NULL; - - options = xnfalloc(sizeof(VBEOptions)); - (void)memcpy(options, VBEOptions, sizeof(VBEOptions)); - xf86ProcessOptions(screen, xf86Screens[screen]->options, options); - xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); - xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); - xfree(options); - if (novbe || noddc) return NULL; - - if (!vbeProbeDDC(pVbe)) goto error; - - pVbe->pInt10->ax = 0x4F15; - pVbe->pInt10->bx = 0x01; - pVbe->pInt10->cx = 0; - pVbe->pInt10->es = SEG_ADDR(RealOff); - pVbe->pInt10->di = SEG_OFF(RealOff); - pVbe->pInt10->num = 0x10; - - xf86ExecX86int10(pVbe->pInt10); - - if ((pVbe->pInt10->ax & 0xff) != 0x4f) { - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC invalid\n"); - goto error; - } - switch (pVbe->pInt10->ax & 0xff00) { - case 0x0: - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read successfully\n"); - tmp = (unsigned char *)xnfalloc(128); - memcpy(tmp,page,128); - break; - case 0x100: - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read failed\n"); - break; - default: - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC unkown failure %i\n", - pVbe->pInt10->ax & 0xff00); - break; - } - - error: - return tmp; -} - -xf86MonPtr -vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) -{ - xf86MonPtr pMonitor; - pointer pModule; - unsigned char *DDC_data = NULL; - - if (!pVbe) return NULL; - if (pVbe->version < 0x200) - return NULL; - - if (!(pModule = pDDCModule)) { - pModule = - xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc"); - if (!pModule) - return NULL; - - xf86LoaderReqSymLists(ddcSymbols, NULL); - } - - DDC_data = vbeReadEDID(pVbe); - - if (!DDC_data) - return NULL; - - pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data); - - if (!pDDCModule) - xf86UnloadSubModule(pModule); - return pMonitor; -} - - -VbeInfoBlock * -VBEGetVBEInfo(vbeInfoPtr pVbe) -{ - VbeInfoBlock *block = NULL; - int i, pStr, pModes; - char *str; - CARD16 major, minor, *modes; - - bzero(pVbe->memory, sizeof(VbeInfoBlock)); - - /* - Input: - AH := 4Fh Super VGA support - AL := 00h Return Super VGA information - ES:DI := Pointer to buffer - - Output: - AX := status - (All other registers are preserved) - */ - - ((char*)pVbe->memory)[0] = 'V'; - ((char*)pVbe->memory)[1] = 'B'; - ((char*)pVbe->memory)[2] = 'E'; - ((char*)pVbe->memory)[3] = '2'; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f00; - pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); - pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (NULL); - - block = xcalloc(sizeof(VbeInfoBlock), 1); - block->VESASignature[0] = ((char*)pVbe->memory)[0]; - block->VESASignature[1] = ((char*)pVbe->memory)[1]; - block->VESASignature[2] = ((char*)pVbe->memory)[2]; - block->VESASignature[3] = ((char*)pVbe->memory)[3]; - - block->VESAVersion = *(CARD16*)(((char*)pVbe->memory) + 4); - major = (unsigned)block->VESAVersion >> 8; - minor = block->VESAVersion & 0xff; - - pStr = *(CARD32*)(((char*)pVbe->memory) + 6); - str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); - block->OEMStringPtr = strdup(str); - - block->Capabilities[0] = ((char*)pVbe->memory)[10]; - block->Capabilities[1] = ((char*)pVbe->memory)[11]; - block->Capabilities[2] = ((char*)pVbe->memory)[12]; - block->Capabilities[3] = ((char*)pVbe->memory)[13]; - - pModes = *(CARD32*)(((char*)pVbe->memory) + 14); - modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); - i = 0; - while (modes[i] != 0xffff) - i++; - block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1); - memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); - block->VideoModePtr[i] = 0xffff; - - block->TotalMemory = *(CARD16*)(((char*)pVbe->memory) + 18); - - if (major < 2) - memcpy(&block->OemSoftwareRev, ((char*)pVbe->memory) + 20, 236); - else { - block->OemSoftwareRev = *(CARD16*)(((char*)pVbe->memory) + 20); - pStr = *(CARD32*)(((char*)pVbe->memory) + 22); - str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); - block->OemVendorNamePtr = strdup(str); - pStr = *(CARD32*)(((char*)pVbe->memory) + 26); - str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); - block->OemProductNamePtr = strdup(str); - pStr = *(CARD32*)(((char*)pVbe->memory) + 30); - str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); - block->OemProductRevPtr = strdup(str); - memcpy(&block->Reserved, ((char*)pVbe->memory) + 34, 222); - memcpy(&block->OemData, ((char*)pVbe->memory) + 256, 256); - } - - return (block); -} - -void -VBEFreeVBEInfo(VbeInfoBlock *block) -{ - xfree(block->OEMStringPtr); - xfree(block->VideoModePtr); - if (((unsigned)block->VESAVersion >> 8) >= 2) { - xfree(block->OemVendorNamePtr); - xfree(block->OemProductNamePtr); - xfree(block->OemProductRevPtr); - } - xfree(block); -} - -Bool -VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block) -{ - /* - Input: - AH := 4Fh Super VGA support - AL := 02h Set Super VGA video mode - BX := Video mode - D0-D8 := Mode number - D9-D10 := Reserved (must be 0) - D11 := 0 Use current default refresh rate - := 1 Use user specified CRTC values for refresh rate - D12-13 Reserved for VBE/AF (must be 0) - D14 := 0 Use windowed frame buffer model - := 1 Use linear/flat frame buffer model - D15 := 0 Clear video memory - := 1 Don't clear video memory - ES:DI := Pointer to VbeCRTCInfoBlock structure - - Output: AX = Status - (All other registers are preserved) - */ - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f02; - pVbe->pInt10->bx = mode; - if (block) { - pVbe->pInt10->bx |= 1 << 11; - memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock)); - pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); - pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); - } - - xf86ExecX86int10(pVbe->pInt10); - - return (pVbe->pInt10->ax == 0x4f); -} - -Bool -VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) -{ - /* - Input: - AH := 4Fh Super VGA support - AL := 03h Return current video mode - - Output: - AX := Status - BX := Current video mode - (All other registers are preserved) - */ - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f03; - - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax == 0x4f) { - *mode = pVbe->pInt10->bx; - - return (TRUE); - } - - return (FALSE); -} - -VbeModeInfoBlock * -VBEGetModeInfo(vbeInfoPtr pVbe, int mode) -{ - VbeModeInfoBlock *block = NULL; - - bzero(pVbe->memory, sizeof(VbeModeInfoBlock)); - - /* - Input: - AH := 4Fh Super VGA support - AL := 01h Return Super VGA mode information - CX := Super VGA video mode - (mode number must be one of those returned by Function 0) - ES:DI := Pointer to buffer - - Output: - AX := status - (All other registers are preserved) - */ - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f01; - pVbe->pInt10->cx = mode; - pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); - pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); - xf86ExecX86int10(pVbe->pInt10); - if (pVbe->pInt10->ax != 0x4f) - return (NULL); - - block = xcalloc(sizeof(VbeModeInfoBlock), 1); - - block->ModeAttributes = *(CARD16*)pVbe->memory; - block->WinAAttributes = ((char*)pVbe->memory)[2]; - block->WinBAttributes = ((char*)pVbe->memory)[3]; - block->WinGranularity = *(CARD16*)(((char*)pVbe->memory) + 4); - block->WinSize = *(CARD16*)(((char*)pVbe->memory) + 6); - block->WinASegment = *(CARD16*)(((char*)pVbe->memory) + 8); - block->WinBSegment = *(CARD16*)(((char*)pVbe->memory) + 10); - block->WinFuncPtr = *(CARD32*)(((char*)pVbe->memory) + 12); - block->BytesPerScanline = *(CARD16*)(((char*)pVbe->memory) + 16); - - /* mandatory information for VBE 1.2 and above */ - block->XResolution = *(CARD16*)(((char*)pVbe->memory) + 18); - block->YResolution = *(CARD16*)(((char*)pVbe->memory) + 20); - block->XCharSize = ((char*)pVbe->memory)[22]; - block->YCharSize = ((char*)pVbe->memory)[23]; - block->NumberOfPlanes = ((char*)pVbe->memory)[24]; - block->BitsPerPixel = ((char*)pVbe->memory)[25]; - block->NumberOfBanks = ((char*)pVbe->memory)[26]; - block->MemoryModel = ((char*)pVbe->memory)[27]; - block->BankSize = ((char*)pVbe->memory)[28]; - block->NumberOfImages = ((char*)pVbe->memory)[29]; - block->Reserved = ((char*)pVbe->memory)[30]; - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - block->RedMaskSize = ((char*)pVbe->memory)[31]; - block->RedFieldPosition = ((char*)pVbe->memory)[32]; - block->GreenMaskSize = ((char*)pVbe->memory)[33]; - block->GreenFieldPosition = ((char*)pVbe->memory)[34]; - block->BlueMaskSize = ((char*)pVbe->memory)[35]; - block->BlueFieldPosition = ((char*)pVbe->memory)[36]; - block->RsvdMaskSize = ((char*)pVbe->memory)[37]; - block->RsvdFieldPosition = ((char*)pVbe->memory)[38]; - block->DirectColorModeInfo = ((char*)pVbe->memory)[39]; - - /* Mandatory information for VBE 2.0 and above */ - if (pVbe->version >= 0x200) { - block->PhysBasePtr = *(CARD32*)(((char*)pVbe->memory) + 40); - block->Reserved32 = *(CARD32*)(((char*)pVbe->memory) + 44); - block->Reserved16 = *(CARD16*)(((char*)pVbe->memory) + 48); - - /* Mandatory information for VBE 3.0 and above */ - if (pVbe->version >= 0x300) { - block->LinBytesPerScanLine = *(CARD16*)(((char*)pVbe->memory) + 50); - block->BnkNumberOfImagePages = ((char*)pVbe->memory)[52]; - block->LinNumberOfImagePages = ((char*)pVbe->memory)[53]; - block->LinRedMaskSize = ((char*)pVbe->memory)[54]; - block->LinRedFieldPosition = ((char*)pVbe->memory)[55]; - block->LinGreenMaskSize = ((char*)pVbe->memory)[56]; - block->LinGreenFieldPosition = ((char*)pVbe->memory)[57]; - block->LinBlueMaskSize = ((char*)pVbe->memory)[58]; - block->LinBlueFieldPosition = ((char*)pVbe->memory)[59]; - block->LinRsvdMaskSize = ((char*)pVbe->memory)[60]; - block->LinRsvdFieldPosition = ((char*)pVbe->memory)[61]; - block->MaxPixelClock = *(CARD32*)(((char*)pVbe->memory) + 62); - memcpy(&block->Reserved2, ((char*)pVbe->memory) + 66, 188); - } - else - memcpy(&block->LinBytesPerScanLine, ((char*)pVbe->memory) + 50, 206); - } - else - memcpy(&block->PhysBasePtr, ((char*)pVbe->memory) + 40, 216); - - return (block); -} - -void -VBEFreeModeInfo(VbeModeInfoBlock *block) -{ - xfree(block); -} - -Bool -VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, - pointer *memory, int *size, int *real_mode_pages) -{ - /* - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 00h Return save/restore state buffer size - CX := Requested states - D0 = Save/restore video hardware state - D1 = Save/restore video BIOS data state - D2 = Save/restore video DAC state - D3 = Save/restore Super VGA state - - Output: - AX = Status - BX = Number of 64-byte blocks to hold the state buffer - (All other registers are preserved) - - - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 01h Save Super VGA video state - CX := Requested states (see above) - ES:BX := Pointer to buffer - - Output: - AX := Status - (All other registers are preserved) - - - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 02h Restore Super VGA video state - CX := Requested states (see above) - ES:BX := Pointer to buffer - - Output: - AX := Status - (All other registers are preserved) - */ - - if ((pVbe->version & 0xff00) > 0x100) { - int screen = pVbe->pInt10->scrnIndex; - if (function == MODE_QUERY || - (function == MODE_SAVE && !*memory)) { - /* Query amount of memory to save state */ - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f04; - pVbe->pInt10->dx = 0; - pVbe->pInt10->cx = 0x000f; - xf86ExecX86int10(pVbe->pInt10); - if (pVbe->pInt10->ax != 0x4f) - return (FALSE); - - if (function == MODE_SAVE) { - int npages = (pVbe->pInt10->bx * 64) / 4096 + 1; - if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, - real_mode_pages)) == NULL) { - xf86DrvMsg(screen, X_ERROR, - "Cannot allocate memory to save SVGA state.\n"); - return (FALSE); - } - } - *size = pVbe->pInt10->bx * 64; - } - - /* Save/Restore Super VGA state */ - if (function != MODE_QUERY) { - - if (!*memory) return FALSE; - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f04; - switch (function) { - case MODE_SAVE: - pVbe->pInt10->dx = 1; - break; - case MODE_RESTORE: - pVbe->pInt10->dx = 2; - break; - case MODE_QUERY: - return FALSE; - } - pVbe->pInt10->cx = 0x000f; - - pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); - pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); - xf86ExecX86int10(pVbe->pInt10); - return (pVbe->pInt10->ax == 0x4f); - - } - } - return TRUE; -} - -Bool -VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) -{ - /* - Input: - AH := 4Fh Super VGA support - AL := 05h - - Output: - */ - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f05; - pVbe->pInt10->bx = window; - pVbe->pInt10->dx = iBank; - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (FALSE); - - return (TRUE); -} - -Bool -VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, - int width, int *pixels, int *bytes, int *max) -{ - if (command < SCANWID_SET || command > SCANWID_GET_MAX) - return (FALSE); - - /* - Input: - AX := 4F06h VBE Set/Get Logical Scan Line Length - BL := 00h Set Scan Line Length in Pixels - := 01h Get Scan Line Length - := 02h Set Scan Line Length in Bytes - := 03h Get Maximum Scan Line Length - CX := If BL=00h Desired Width in Pixels - If BL=02h Desired Width in Bytes - (Ignored for Get Functions) - - Output: - AX := VBE Return Status - BX := Bytes Per Scan Line - CX := Actual Pixels Per Scan Line - (truncated to nearest complete pixel) - DX := Maximum Number of Scan Lines - */ - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f06; - pVbe->pInt10->bx = command; - if (command == SCANWID_SET || command == SCANWID_SET_BYTES) - pVbe->pInt10->cx = width; - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (FALSE); - - if (command == SCANWID_GET || command == SCANWID_GET_MAX) { - if (pixels) - *pixels = pVbe->pInt10->cx; - if (bytes) - *bytes = pVbe->pInt10->bx; - if (max) - *max = pVbe->pInt10->dx; - } - - return (TRUE); -} - -Bool -VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) -{ - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f07; - pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00; - pVbe->pInt10->cx = x; - pVbe->pInt10->dx = y; - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (FALSE); - - return (TRUE); -} - -Bool -VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) -{ - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f07; - pVbe->pInt10->bx = 0x01; - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (FALSE); - - *x = pVbe->pInt10->cx; - *y = pVbe->pInt10->dx; - - return (TRUE); -} - -int -VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) -{ - /* - Input: - AX := 4F08h VBE Set/Get Palette Format - BL := 00h Set DAC Palette Format - := 01h Get DAC Palette Format - BH := Desired bits of color per primary - (Set DAC Palette Format only) - - Output: - AX := VBE Return Status - BH := Current number of bits of color per primary - */ - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f08; - if (!bits) - pVbe->pInt10->bx = 0x01; - else - pVbe->pInt10->bx = (bits & 0x00ff) << 8; - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (0); - - return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); -} - -CARD32 * -VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace) -{ - /* - Input: - (16-bit) - AX := 4F09h VBE Load/Unload Palette Data - BL := 00h Set Palette Data - := 01h Get Palette Data - := 02h Set Secondary Palette Data - := 03h Get Secondary Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:DI := Table of palette values (see below for format) - - Output: - AX := VBE Return Status - - - Input: - (32-bit) - BL := 00h Set Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:EDI := Table of palette values (see below for format) - DS := Selector for memory mapped registers - */ - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f09; - if (!secondary) - pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; - else - pVbe->pInt10->bx = set ? 2 : 3; - pVbe->pInt10->cx = num; - pVbe->pInt10->dx = first; - pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); - pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); - if (set) - memcpy(pVbe->memory, data, num * sizeof(CARD32)); - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (NULL); - - if (set) - return (data); - - data = xalloc(num * sizeof(CARD32)); - memcpy(data, pVbe->memory, num * sizeof(CARD32)); - - return (data); -} - -VBEpmi * -VBEGetVBEpmi(vbeInfoPtr pVbe) -{ - VBEpmi *pmi; - - /* - Input: - AH := 4Fh Super VGA support - AL := 0Ah Protected Mode Interface - BL := 00h Return Protected Mode Table - - Output: - AX := Status - ES := Real Mode Segment of Table - DI := Offset of Table - CX := Lenght of Table including protected mode code in bytes (for copying purposes) - (All other registers are preserved) - */ - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f0a; - pVbe->pInt10->bx = 0; - pVbe->pInt10->di = 0; - xf86ExecX86int10(pVbe->pInt10); - - if (pVbe->pInt10->ax != 0x4f) - return (NULL); - - pmi = xalloc(sizeof(VBEpmi)); - pmi->seg_tbl = pVbe->pInt10->es; - pmi->tbl_off = pVbe->pInt10->di; - pmi->tbl_len = pVbe->pInt10->cx; - - return (pmi); -} Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h:1.5 Thu Feb 15 15:00:09 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h Thu Feb 27 12:33:01 2003 @@ -1,293 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h,v 1.5 2001/02/15 20:00:09 eich Exp $ */ - -/* - * XFree86 vbe module - * Copyright 2000 Egbert Eich - * - * The mode query/save/set/restore functions from the vesa driver - * have been moved here. - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - */ - -#ifndef _VBE_H -#define _VBE_H -#include "xf86int10.h" -#include "xf86DDC.h" - -typedef enum { - DDC_UNCHECKED, - DDC_NONE, - DDC_1, - DDC_2, - DDC_1_2 -} -ddc_lvl; - -typedef struct { - xf86Int10InfoPtr pInt10; - int version; - pointer memory; - int real_mode_base; - int num_pages; - Bool init_int10; - ddc_lvl ddc; - Bool ddc_blank; -} vbeInfoRec, *vbeInfoPtr; - -vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex); -void vbeFree(vbeInfoPtr pVbe); -xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule); - -#pragma pack(1) - -typedef struct vbeControllerInfoBlock { - CARD8 VbeSignature[4]; - CARD16 VbeVersion; - CARD32 OemStringPtr; - CARD8 Capabilities[4]; - CARD32 VideoModePtr; - CARD16 TotalMem; - CARD16 OemSoftwareRev; - CARD32 OemVendorNamePtr; - CARD32 OemProductNamePtr; - CARD32 OemProductRevPtr; - CARD8 Scratch[222]; - CARD8 OemData[256]; -} vbeControllerInfoRec, *vbeControllerInfoPtr; - -#pragma pack() - -#ifndef __GNUC__ -#define __attribute__(a) -#endif - -typedef struct _VbeInfoBlock VbeInfoBlock; -typedef struct _VbeModeInfoBlock VbeModeInfoBlock; -typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; - -/* - * INT 0 - */ - -struct _VbeInfoBlock { - /* VESA 1.2 fields */ - CARD8 VESASignature[4]; /* VESA */ - CARD16 VESAVersion; /* Higher byte major, lower byte minor */ - /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ - CARD8 Capabilities[4]; /* Capabilities of the video environment */ - - /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ - - CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ - /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ - - /* VESA 2 fields */ - CARD16 OemSoftwareRev; /* VBE implementation Software revision */ - /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ - /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ - /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ - CARD8 Reserved[222]; /* Reserved for VBE implementation */ - CARD8 OemData[256]; /* Data Area for OEM Strings */ -} __attribute__((packed)); - -/* Return Super VGA Information */ -VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe); -void VBEFreeVBEInfo(VbeInfoBlock *block); - -/* - * INT 1 - */ - -struct _VbeModeInfoBlock { - CARD16 ModeAttributes; /* mode attributes */ - CARD8 WinAAttributes; /* window A attributes */ - CARD8 WinBAttributes; /* window B attributes */ - CARD16 WinGranularity; /* window granularity */ - CARD16 WinSize; /* window size */ - CARD16 WinASegment; /* window A start segment */ - CARD16 WinBSegment; /* window B start segment */ - CARD32 WinFuncPtr; /* real mode pointer to window function */ - CARD16 BytesPerScanline; /* bytes per scanline */ - - /* Mandatory information for VBE 1.2 and above */ - CARD16 XResolution; /* horizontal resolution in pixels or characters */ - CARD16 YResolution; /* vertical resolution in pixels or characters */ - CARD8 XCharSize; /* character cell width in pixels */ - CARD8 YCharSize; /* character cell height in pixels */ - CARD8 NumberOfPlanes; /* number of memory planes */ - CARD8 BitsPerPixel; /* bits per pixel */ - CARD8 NumberOfBanks; /* number of banks */ - CARD8 MemoryModel; /* memory model type */ - CARD8 BankSize; /* bank size in KB */ - CARD8 NumberOfImages; /* number of images */ - CARD8 Reserved; /* 1 */ /* reserved for page function */ - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - CARD8 RedMaskSize; /* size of direct color red mask in bits */ - CARD8 RedFieldPosition; /* bit position of lsb of red mask */ - CARD8 GreenMaskSize; /* size of direct color green mask in bits */ - CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ - CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ - CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ - CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ - CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ - CARD8 DirectColorModeInfo; /* direct color mode attributes */ - - /* Mandatory information for VBE 2.0 and above */ - CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ - CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ - CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ - - /* Mandatory information for VBE 3.0 and above */ - CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ - CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ - CARD8 LinNumberOfImagePages; /* number of images for linear modes */ - CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ - CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ - CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ - CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ - CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ - CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ - CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ - CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ - CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ - CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ -} __attribute__((packed)); - -/* Return VBE Mode Information */ -VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode); -void VBEFreeModeInfo(VbeModeInfoBlock *block); - -/* - * INT2 - */ - -#define CRTC_DBLSCAN (1<<0) -#define CRTC_INTERLACE (1<<1) -#define CRTC_NHSYNC (1<<2) -#define CRTC_NVSYNC (1<<3) - -struct _VbeCRTCInfoBlock { - CARD16 HorizontalTotal; /* Horizontal total in pixels */ - CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ - CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ - CARD16 VerticalTotal; /* Vertical total in lines */ - CARD16 VerticalSyncStart; /* Vertical sync start in lines */ - CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ - CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ - CARD32 PixelClock; /* Pixel clock in units of Hz */ - CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ - CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); -/* VbeCRTCInfoBlock is in the VESA 3.0 specs */ - -Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *crtc); - -/* - * INT 3 - */ - -Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode); - -/* - * INT 4 - */ - -/* Save/Restore Super VGA video state */ -/* function values are (values stored in VESAPtr): - * 0 := query & allocate amount of memory to save state - * 1 := save state - * 2 := restore state - * - * function 0 called automatically if function 1 called without - * a previous call to function 0. - */ - -typedef enum { - MODE_QUERY, - MODE_SAVE, - MODE_RESTORE -} vbeSaveRestoreFunction; - -Bool -VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, - pointer *memory, int *size, int *real_mode_pages); - -/* - * INT 5 - */ - -Bool -VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window); - -/* - * INT 6 - */ - -typedef enum { - SCANWID_SET, - SCANWID_GET, - SCANWID_SET_BYTES, - SCANWID_GET_MAX -} vbeScanwidthCommand; - -#define VBESetLogicalScanline(pVbe, width) \ - VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, \ - width, NULL, NULL, NULL) -#define VBESetLogicalScanlineBytes(pVbe, width) \ - VBESetGetLogicalScanlineLength(pVbe, width, SCANWID_SET_BYTES, \ - NULL, NULL, NULL) -#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \ - VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, NULL, \ - pixels, bytes, max) -#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \ - VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, \ - NULL, pixels, bytes, max) -Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, - vbeScanwidthCommand command, int width, - int *pixels, int *bytes, int *max); - -/* - * INT 7 - */ - -/* 16 bit code */ -Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace); -Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y); - -/* - * INT 8 - */ - -/* if bits is 0, then it is a GET */ -int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits); - -/* - * INT 9 - */ - -/* - * If getting a palette, the data argument is not used. It will return - * the data. - * If setting a palette, it will return the pointer received on success, - * NULL on failure. - */ -CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace); -#define VBEFreePaletteData(data) xfree(data) - -/* - * INT A - */ - -typedef struct _VBEpmi { - int seg_tbl; - int tbl_off; - int tbl_len; -} VBEpmi; - -VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe); -#define VESAFreeVBEpmi(pmi) xfree(pmi) - -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c:1.2 Sun Dec 5 22:57:06 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c Thu Feb 27 12:33:01 2003 @@ -1,48 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c,v 1.2 1999/12/06 03:57:06 robin Exp $ */ - -#include "xf86.h" -#include "xf86str.h" -#include "vbe.h" - - -#ifdef XFree86LOADER - -static MODULESETUPPROTO(vbeSetup); - -static XF86ModuleVersionInfo vbeVersRec = -{ - "vbe", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -XF86ModuleData vbeModuleData = { &vbeVersRec, vbeSetup, NULL }; - -static pointer -vbeSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - if (!setupDone) { - setupDone = TRUE; - /* - * Tell the loader about symbols from other modules that this module - * might refer to. - */ - } - /* - * The return value must be non-NULL on success even though there - * is no TearDownProc. - */ - return (pointer)1; -} - -#endif - Index: xc/programs/Xserver/hw/xfree86/parser/Configint.h diff -u xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.19 xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.20 --- xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.19 Mon Aug 6 16:51:12 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Configint.h Mon Mar 4 11:11:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.19 2001/08/06 20:51:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.20 2002/03/04 16:11:06 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -95,7 +95,9 @@ }\ } -#define Error(a,b) { xf86parseError (a, b); CLEANUP (ptr); return NULL; } +#define Error(a,b) do { \ + xf86parseError (a, b); CLEANUP (ptr); return NULL; \ + } while (0) /* * These are defines for error messages to promote consistency. Index: xc/programs/Xserver/hw/xfree86/parser/DRI.c diff -u xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.12 xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.14 --- xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.12 Mon Aug 6 16:51:12 2001 +++ xc/programs/Xserver/hw/xfree86/parser/DRI.c Sat Jan 4 15:20:22 2003 @@ -24,7 +24,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.12 2001/08/06 20:51:12 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.14 2003/01/04 20:20:22 paulo Exp $ * */ Index: xc/programs/Xserver/hw/xfree86/parser/Device.c diff -u xc/programs/Xserver/hw/xfree86/parser/Device.c:1.22 xc/programs/Xserver/hw/xfree86/parser/Device.c:1.26 --- xc/programs/Xserver/hw/xfree86/parser/Device.c:1.22 Mon Aug 6 16:51:12 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Device.c Sat Jan 4 15:20:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.22 2001/08/06 20:51:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.26 2003/01/04 20:20:22 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -184,7 +184,7 @@ case CLOCKS: token = xf86getSubToken(&(ptr->dev_comment)); for( i = ptr->dev_clocks; - token == NUMBER && i < CONF_MAXCLOCKS; i++ ) { + token == NUMBER && i < CONF_MAXCLOCKS; i++ ) { ptr->dev_clock[i] = (int)(val.realnum * 1000.0 + 0.5); token = xf86getSubToken(&(ptr->dev_comment)); } @@ -330,21 +330,21 @@ int xf86validateDevice (XF86ConfigPtr p) { - XF86ConfDevicePtr device = p->conf_device_lst; + XF86ConfDevicePtr device = p->conf_device_lst; - if (!device) { - xf86validationError ("At least one Device section is required."); - return (FALSE); - } - - while (device) { - if (!device->dev_driver) { - xf86validationError (UNDEFINED_DRIVER_MSG, device->dev_identifier); - return (FALSE); - } - device = device->list.next; - } - return (TRUE); + if (!device) { + xf86validationError ("At least one Device section is required."); + return (FALSE); + } + + while (device) { + if (!device->dev_driver) { + xf86validationError (UNDEFINED_DRIVER_MSG, device->dev_identifier); + return (FALSE); + } + device = device->list.next; + } + return (TRUE); } XF86ConfDevicePtr @@ -363,7 +363,9 @@ char * xf86configStrdup (const char *s) { - char *tmp = xf86confmalloc (sizeof (char) * (strlen (s) + 1)); + char *tmp; + if (!s) return NULL; + tmp = xf86confmalloc (sizeof (char) * (strlen (s) + 1)); if (tmp) strcpy (tmp, s); return (tmp); Index: xc/programs/Xserver/hw/xfree86/parser/Files.c diff -u xc/programs/Xserver/hw/xfree86/parser/Files.c:1.12 xc/programs/Xserver/hw/xfree86/parser/Files.c:1.15 --- xc/programs/Xserver/hw/xfree86/parser/Files.c:1.12 Mon Aug 6 16:51:13 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Files.c Sat Jan 4 15:20:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Files.c,v 1.12 2001/08/06 20:51:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Files.c,v 1.15 2003/01/04 20:20:22 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -42,6 +42,7 @@ {FONTPATH, "fontpath"}, {RGBPATH, "rgbpath"}, {MODULEPATH, "modulepath"}, + {INPUTDEVICES, "inputdevices"}, {LOGFILEPATH, "logfile"}, {-1, ""}, }; @@ -135,6 +136,33 @@ strcat (ptr->file_modulepath, str); xf86conffree (val.str); break; + case INPUTDEVICES: + if (xf86getSubToken (&(ptr->file_comment)) != STRING) + Error (QUOTE_MSG, "InputDevices"); + l = FALSE; + str = prependRoot (val.str); + if (ptr->file_inputdevs == NULL) + { + ptr->file_inputdevs = xf86confmalloc (1); + ptr->file_inputdevs[0] = '\0'; + k = strlen (str) + 1; + } + else + { + k = strlen (ptr->file_inputdevs) + strlen (str) + 1; + if (ptr->file_inputdevs[strlen (ptr->file_inputdevs) - 1] != ',') + { + k++; + l = TRUE; + } + } + ptr->file_inputdevs = xf86confrealloc (ptr->file_inputdevs, k); + if (l) + strcat (ptr->file_inputdevs, ","); + + strcat (ptr->file_inputdevs, str); + xf86conffree (val.str); + break; case LOGFILEPATH: if (xf86getSubToken (&(ptr->file_comment)) != STRING) Error (QUOTE_MSG, "LogFile"); @@ -187,6 +215,21 @@ } fprintf (cf, "\tModulePath \"%s\"\n", s); } + if (ptr->file_inputdevs) + { + s = ptr->file_inputdevs; + p = index (s, ','); + while (p) + { + *p = '\000'; + fprintf (cf, "\tInputDevices \"%s\"\n", s); + *p = ','; + s = p; + s++; + p = index (s, ','); + } + fprintf (cf, "\tInputdevs \"%s\"\n", s); + } if (ptr->file_fontpath) { s = ptr->file_fontpath; @@ -213,6 +256,7 @@ TestFree (p->file_logfile); TestFree (p->file_rgbpath); TestFree (p->file_modulepath); + TestFree (p->file_inputdevs); TestFree (p->file_fontpath); TestFree (p->file_comment); Index: xc/programs/Xserver/hw/xfree86/parser/Flags.c diff -u xc/programs/Xserver/hw/xfree86/parser/Flags.c:1.18 xc/programs/Xserver/hw/xfree86/parser/Flags.c:1.22 --- xc/programs/Xserver/hw/xfree86/parser/Flags.c:1.18 Wed Sep 5 17:36:57 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Flags.c Sat Jan 4 15:20:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Flags.c,v 1.18 2001/09/05 21:36:57 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Flags.c,v 1.22 2003/01/04 20:20:22 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -72,8 +72,8 @@ switch (token) { case COMMENT: - ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str); - break; + ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str); + break; /* * these old keywords are turned into standard generic options. * we fall through here on purpose @@ -108,15 +108,15 @@ { tokentype = xf86getSubToken(&(ptr->flg_comment)); if (strvalue) { - if (tokentype != STRING) - Error (QUOTE_MSG, tmp); - valstr = val.str; + if (tokentype != STRING) + Error (QUOTE_MSG, tmp); + valstr = val.str; } else { - if (tokentype != NUMBER) - Error (NUMBER_MSG, tmp); - valstr = xf86confmalloc(16); - if (valstr) - sprintf(valstr, "%d", val.num); + if (tokentype != NUMBER) + Error (NUMBER_MSG, tmp); + valstr = xf86confmalloc(16); + if (valstr) + sprintf(valstr, "%d", val.num); } } ptr->flg_option_lst = xf86addNewOption @@ -158,7 +158,7 @@ p = flags->flg_option_lst; fprintf (f, "Section \"ServerFlags\"\n"); if (flags->flg_comment) - fprintf (f, "%s", flags->flg_comment); + fprintf (f, "%s", flags->flg_comment); xf86printOptionList(f, p, 1); fprintf (f, "EndSection\n\n"); } @@ -166,24 +166,23 @@ static XF86OptionPtr addNewOption2 (XF86OptionPtr head, char *name, char *val, int used) { - XF86OptionPtr new, old = NULL; + XF86OptionPtr new, old = NULL; /* Don't allow duplicates */ if (head != NULL && (old = xf86findOption(head, name)) != NULL) - new = old; + new = old; else { - new = xf86confcalloc (1, sizeof (XF86OptionRec)); - new->list.next = NULL; + new = xf86confcalloc (1, sizeof (XF86OptionRec)); + new->list.next = NULL; } - new->opt_name = name; new->opt_val = val; new->opt_used = used; if (old == NULL) - return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new)); + return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new)); else - return head; + return head; } XF86OptionPtr @@ -209,7 +208,8 @@ while (opt) { - newopt = xf86addNewOption(newopt, opt->opt_name, opt->opt_val); + newopt = xf86addNewOption(newopt, xf86configStrdup(opt->opt_name), + xf86configStrdup(opt->opt_val)); newopt->opt_used = opt->opt_used; if (opt->opt_comment) newopt->opt_comment = xf86configStrdup(opt->opt_comment); @@ -237,42 +237,42 @@ char * xf86optionName(XF86OptionPtr opt) { - if (opt) - return opt->opt_name; - return 0; + if (opt) + return opt->opt_name; + return 0; } char * xf86optionValue(XF86OptionPtr opt) { - if (opt) - return opt->opt_val; - return 0; + if (opt) + return opt->opt_val; + return 0; } XF86OptionPtr xf86newOption(char *name, char *value) { - XF86OptionPtr opt; + XF86OptionPtr opt; + + opt = xf86confcalloc(1, sizeof (XF86OptionRec)); + if (!opt) + return NULL; - opt = xf86confcalloc(1, sizeof (XF86OptionRec)); - if (!opt) - return NULL; - - opt->opt_used = 0; - opt->list.next = 0; - opt->opt_name = name; - opt->opt_val = value; + opt->opt_used = 0; + opt->list.next = 0; + opt->opt_name = name; + opt->opt_val = value; - return opt; + return opt; } XF86OptionPtr xf86nextOption(XF86OptionPtr list) { - if (!list) - return NULL; - return list->list.next; + if (!list) + return NULL; + return list->list.next; } /* @@ -348,66 +348,52 @@ } /* the 2 given lists are merged. If an option with the same name is present in - * both, the option from the user list is used. The end result is a single - * valid list of options. Duplicates are freed, and the original lists are no - * longer guaranteed to be complete. + * both, the option from the user list - specified in the second argument - + * is used. The end result is a single valid list of options. Duplicates + * are freed, and the original lists are no longer guaranteed to be complete. */ XF86OptionPtr xf86optionListMerge (XF86OptionPtr head, XF86OptionPtr tail) { - XF86OptionPtr a, b, ap = NULL, bp = NULL, f = NULL; + XF86OptionPtr a, b, ap = NULL, bp = NULL; - a = head; - while (a) - { - bp = NULL; - b = tail; - while (b) - { - if (xf86nameCompare (a->opt_name, b->opt_name) == 0) - { - if ((a == head) && (b == tail)) - { - head = b; - tail = b->list.next; - b->list.next = a->list.next; - bp = tail; - } - else if (a == head) - { - head = b; - bp->list.next = b->list.next; - b->list.next = a->list.next; - } - else if (b == tail) - { - tail = b->list.next; - ap->list.next = b; - b->list.next = a->list.next; - bp = tail; - } - else - { - ap->list.next = b; - bp->list.next = b->list.next; - b->list.next = a->list.next; - } - a->list.next = f; - f = a; - a = b; - b = bp; - continue; + a = tail; + b = head; + while (tail && b) { + if (xf86nameCompare (a->opt_name, b->opt_name) == 0) { + if (b == head) + head = a; + else + bp->list.next = a; + if (a == tail) + tail = a->list.next; + else + ap->list.next = a->list.next; + a->list.next = b->list.next; + b->list.next = NULL; + xf86optionListFree (b); + b = a->list.next; + bp = a; + a = tail; + ap = NULL; + } else { + ap = a; + if (!(a = a->list.next)) { + a = tail; + bp = b; + b = b->list.next; + ap = NULL; } - bp = b; - b = b->list.next; } - ap = a; - a = a->list.next; } - ap->list.next = tail; + if (head) { + for (a = head; a->list.next; a = a->list.next) + ; + a->list.next = tail; + } else + head = tail; - xf86optionListFree (f); return (head); } @@ -415,7 +401,7 @@ xf86uLongToString(unsigned long i) { char *s; - int l; + int l; l = (int)(ceil(log10((double)i) + 2.5)); s = xf86confmalloc(l); @@ -428,10 +414,10 @@ void xf86debugListOptions(XF86OptionPtr Options) { - while (Options) { - ErrorF("Option: %s Value: %s\n",Options->opt_name,Options->opt_val); - Options = Options->list.next; - } + while (Options) { + ErrorF("Option: %s Value: %s\n",Options->opt_name,Options->opt_val); + Options = Options->list.next; + } } XF86OptionPtr @@ -466,7 +452,7 @@ xf86unGetToken(token); } - old = NULL; + old = NULL; /* Don't allow duplicates */ if (head != NULL && (old = xf86findOption(head, name)) != NULL) { Index: xc/programs/Xserver/hw/xfree86/parser/Imakefile diff -u xc/programs/Xserver/hw/xfree86/parser/Imakefile:1.12 xc/programs/Xserver/hw/xfree86/parser/Imakefile:1.13 --- xc/programs/Xserver/hw/xfree86/parser/Imakefile:1.12 Fri Jan 12 14:28:35 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Imakefile Fri May 31 14:46:02 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Imakefile,v 1.12 2001/01/12 19:28:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Imakefile,v 1.13 2002/05/31 18:46:02 dawes Exp $ */ @@ -16,11 +16,6 @@ DBMALLOCDEFINE=-DDBMALLOC #endif -#if defined(OS2Architecture) -LOCAL_LIBRARIES=-lxf86_os -#else -LOCAL_LIBRARIES= -#endif SYS_LIBRARIES = MathLibrary XCONFIGFILE = XConfigFile Index: xc/programs/Xserver/hw/xfree86/parser/Input.c diff -u xc/programs/Xserver/hw/xfree86/parser/Input.c:1.10 xc/programs/Xserver/hw/xfree86/parser/Input.c:1.13 --- xc/programs/Xserver/hw/xfree86/parser/Input.c:1.10 Mon Aug 6 16:51:13 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Input.c Sat Jan 4 15:20:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.10 2001/08/06 20:51:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.13 2003/01/04 20:20:22 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -137,23 +137,23 @@ int xf86validateInput (XF86ConfigPtr p) { - XF86ConfInputPtr input = p->conf_input_lst; + XF86ConfInputPtr input = p->conf_input_lst; #if 0 /* Enable this later */ - if (!input) { - xf86validationError ("At least one InputDevice section is required."); - return (FALSE); - } + if (!input) { + xf86validationError ("At least one InputDevice section is required."); + return (FALSE); + } #endif - while (input) { - if (!input->inp_driver) { - xf86validationError (UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier); - return (FALSE); - } - input = input->list.next; - } - return (TRUE); + while (input) { + if (!input->inp_driver) { + xf86validationError (UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier); + return (FALSE); + } + input = input->list.next; + } + return (TRUE); } XF86ConfInputPtr Index: xc/programs/Xserver/hw/xfree86/parser/Keyboard.c diff -u xc/programs/Xserver/hw/xfree86/parser/Keyboard.c:1.12 xc/programs/Xserver/hw/xfree86/parser/Keyboard.c:1.15 --- xc/programs/Xserver/hw/xfree86/parser/Keyboard.c:1.12 Mon Aug 6 16:51:13 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Keyboard.c Sat Jan 4 15:20:22 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Keyboard.c,v 1.12 2001/08/06 20:51:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Keyboard.c,v 1.15 2003/01/04 20:20:22 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -261,7 +261,7 @@ } } - ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_KEYBOARD); + ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_KEYBOARD); ptr->inp_driver = xf86configStrdup("keyboard"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("CoreKeyboard"), NULL); Index: xc/programs/Xserver/hw/xfree86/parser/Layout.c diff -u xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.18 xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.23 --- xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.18 Mon Aug 6 16:51:14 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Layout.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.18 2001/08/06 20:51:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.23 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -54,6 +54,7 @@ {ABOVE, "above"}, {BELOW, "below"}, {RELATIVE, "relative"}, + {ABSOLUTE, "absolute"}, {-1, ""}, }; @@ -97,6 +98,7 @@ case SCREEN: { XF86ConfAdjacencyPtr aptr; + int absKeyword = 0; aptr = xf86confcalloc (1, sizeof (XF86ConfAdjacencyRec)); aptr->list.next = NULL; @@ -132,6 +134,10 @@ case RELATIVE: aptr->adj_where = CONF_ADJ_RELATIVE; break; + case ABSOLUTE: + aptr->adj_where = CONF_ADJ_ABSOLUTE; + absKeyword = 1; + break; case EOF_TOKEN: Error (UNEXPECTED_EOF_MSG, NULL); break; @@ -146,6 +152,8 @@ switch (aptr->adj_where) { case CONF_ADJ_ABSOLUTE: + if (absKeyword) + token = xf86getSubToken(&(ptr->lay_comment)); if (token == NUMBER) { aptr->adj_x = val.num; @@ -153,8 +161,12 @@ if (token != NUMBER) Error(INVALID_SCR_MSG, NULL); aptr->adj_y = val.num; - } else - xf86unGetToken (token); + } else { + if (absKeyword) + Error(INVALID_SCR_MSG, NULL); + else + xf86unGetToken (token); + } break; case CONF_ADJ_RIGHTOF: case CONF_ADJ_LEFTOF: @@ -459,12 +471,12 @@ XF86ConfLayoutPtr xf86findLayout (const char *name, XF86ConfLayoutPtr list) { - while (list) - { - if (xf86nameCompare (list->lay_identifier, name) == 0) - return (list); - list = list->list.next; - } - return (NULL); + while (list) + { + if (xf86nameCompare (list->lay_identifier, name) == 0) + return (list); + list = list->list.next; + } + return (NULL); } Index: xc/programs/Xserver/hw/xfree86/parser/Module.c diff -u xc/programs/Xserver/hw/xfree86/parser/Module.c:1.9 xc/programs/Xserver/hw/xfree86/parser/Module.c:1.11 --- xc/programs/Xserver/hw/xfree86/parser/Module.c:1.9 Mon Aug 6 16:51:14 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Module.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Module.c,v 1.9 2001/08/06 20:51:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Module.c,v 1.11 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -78,7 +78,6 @@ xf86parseError (UNEXPECTED_EOF_MSG, NULL); xf86conffree(ptr); return NULL; - break; default: xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ()); xf86conffree(ptr); Index: xc/programs/Xserver/hw/xfree86/parser/Monitor.c diff -u xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.24 xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.27 --- xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.24 Mon Aug 6 16:51:14 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Monitor.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.24 2001/08/06 20:51:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.27 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -454,7 +454,7 @@ ptr->mon_n_hsync++; goto HorizDone; } - if (ptr->mon_n_hsync == CONF_MAX_HSYNC) + if (ptr->mon_n_hsync >= CONF_MAX_HSYNC) Error ("Sorry. Too many horizontal sync intervals.", NULL); ptr->mon_n_hsync++; } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER); @@ -491,7 +491,7 @@ ptr->mon_n_vrefresh++; goto VertDone; } - if (ptr->mon_n_vrefresh == CONF_MAX_VREFRESH) + if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH) Error ("Sorry. Too many vertical refresh intervals.", NULL); ptr->mon_n_vrefresh++; } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER); Index: xc/programs/Xserver/hw/xfree86/parser/Pointer.c diff -u xc/programs/Xserver/hw/xfree86/parser/Pointer.c:1.10 xc/programs/Xserver/hw/xfree86/parser/Pointer.c:1.12 --- xc/programs/Xserver/hw/xfree86/parser/Pointer.c:1.10 Mon Aug 6 16:51:14 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Pointer.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Pointer.c,v 1.10 2001/08/06 20:51:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Pointer.c,v 1.12 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated Index: xc/programs/Xserver/hw/xfree86/parser/Screen.c diff -u xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.21 xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.24 --- xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.21 Mon Aug 6 16:51:14 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Screen.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.21 2001/08/06 20:51:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.24 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -173,7 +173,7 @@ { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, - {OBSDRIVER, "driver"}, + {OBSDRIVER, "driver"}, {MDEVICE, "device"}, {MONITOR, "monitor"}, {VIDEOADAPTOR, "videoadaptor"}, @@ -192,7 +192,7 @@ xf86parseScreenSection (void) { int has_ident = FALSE; - int has_driver= FALSE; + int has_driver= FALSE; int token; parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec) @@ -208,17 +208,17 @@ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); ptr->scrn_identifier = val.str; - if (has_ident || has_driver) - Error (ONLY_ONE_MSG,"Identifier or Driver"); - has_ident = TRUE; + if (has_ident || has_driver) + Error (ONLY_ONE_MSG,"Identifier or Driver"); + has_ident = TRUE; break; - case OBSDRIVER: + case OBSDRIVER: if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "Driver"); ptr->scrn_obso_driver = val.str; - if (has_ident || has_driver) - Error (ONLY_ONE_MSG,"Identifier or Driver"); - has_driver = TRUE; + if (has_ident || has_driver) + Error (ONLY_ONE_MSG,"Identifier or Driver"); + has_driver = TRUE; break; case DEFAULTDEPTH: if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER) @@ -275,7 +275,7 @@ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "SubSection"); { - xf86conffree(val.str); + xf86conffree(val.str); HANDLE_LIST (scrn_display_lst, xf86parseDisplaySubSection, XF86ConfDisplayPtr); } @@ -475,10 +475,10 @@ while (screen) { - if (screen->scrn_obso_driver && !screen->scrn_identifier) - screen->scrn_identifier = screen->scrn_obso_driver; - - monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst); + if (screen->scrn_obso_driver && !screen->scrn_identifier) + screen->scrn_identifier = screen->scrn_obso_driver; + + monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst); if (!monitor) { xf86validationError (UNDEFINED_MONITOR_MSG, Index: xc/programs/Xserver/hw/xfree86/parser/Vendor.c diff -u xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.13 xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.16 --- xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.13 Mon Aug 6 16:51:15 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Vendor.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.13 2001/08/06 20:51:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.16 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -158,7 +158,7 @@ void xf86printVendorSection (FILE * cf, XF86ConfVendorPtr ptr) { - XF86ConfVendSubPtr pptr; + XF86ConfVendSubPtr pptr; while (ptr) { @@ -216,12 +216,12 @@ XF86ConfVendorPtr xf86findVendor (const char *name, XF86ConfVendorPtr list) { - while (list) - { - if (xf86nameCompare (list->vnd_identifier, name) == 0) - return (list); - list = list->list.next; - } - return (NULL); + while (list) + { + if (xf86nameCompare (list->vnd_identifier, name) == 0) + return (list); + list = list->list.next; + } + return (NULL); } Index: xc/programs/Xserver/hw/xfree86/parser/Video.c diff -u xc/programs/Xserver/hw/xfree86/parser/Video.c:1.10 xc/programs/Xserver/hw/xfree86/parser/Video.c:1.12 --- xc/programs/Xserver/hw/xfree86/parser/Video.c:1.10 Mon Aug 6 16:51:15 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Video.c Sat Jan 4 15:20:23 2003 @@ -25,7 +25,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.10 2001/08/06 20:51:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.12 2003/01/04 20:20:23 paulo Exp $ */ /* View/edit this file with tab stops set to 4 */ Index: xc/programs/Xserver/hw/xfree86/parser/cpconfig.c diff -u xc/programs/Xserver/hw/xfree86/parser/cpconfig.c:1.6 xc/programs/Xserver/hw/xfree86/parser/cpconfig.c:1.7 --- xc/programs/Xserver/hw/xfree86/parser/cpconfig.c:1.6 Fri Oct 20 10:59:03 2000 +++ xc/programs/Xserver/hw/xfree86/parser/cpconfig.c Mon Feb 17 11:08:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/cpconfig.c,v 1.6 2000/10/20 14:59:03 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/cpconfig.c,v 1.7 2003/02/17 16:08:29 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -34,6 +34,7 @@ #include <stdarg.h> #include <ctype.h> #include "xf86Parser.h" +#include "configProcs.h" #ifdef MALLOC_FUNCTIONS void Index: xc/programs/Xserver/hw/xfree86/parser/read.c diff -u xc/programs/Xserver/hw/xfree86/parser/read.c:1.20 xc/programs/Xserver/hw/xfree86/parser/read.c:1.23 --- xc/programs/Xserver/hw/xfree86/parser/read.c:1.20 Mon Jul 2 11:38:34 2001 +++ xc/programs/Xserver/hw/xfree86/parser/read.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.20 2001/07/02 15:38:34 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.23 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -72,102 +72,102 @@ xf86setSection (val.str); if (xf86nameCompare (val.str, "files") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_RETURN (conf_files, xf86parseFilesSection ()); } else if (xf86nameCompare (val.str, "serverflags") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_RETURN (conf_flags, xf86parseFlagsSection ()); } else if (xf86nameCompare (val.str, "keyboard") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_input_lst, xf86parseKeyboardSection, XF86ConfInputPtr); } else if (xf86nameCompare (val.str, "pointer") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_input_lst, xf86parsePointerSection, XF86ConfInputPtr); } else if (xf86nameCompare (val.str, "videoadaptor") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection, XF86ConfVideoAdaptorPtr); } else if (xf86nameCompare (val.str, "device") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_device_lst, xf86parseDeviceSection, XF86ConfDevicePtr); } else if (xf86nameCompare (val.str, "monitor") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection, XF86ConfMonitorPtr); } else if (xf86nameCompare (val.str, "modes") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_modes_lst, xf86parseModesSection, XF86ConfModesPtr); } else if (xf86nameCompare (val.str, "screen") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_screen_lst, xf86parseScreenSection, XF86ConfScreenPtr); } else if (xf86nameCompare(val.str, "inputdevice") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_input_lst, xf86parseInputSection, XF86ConfInputPtr); } else if (xf86nameCompare (val.str, "module") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_RETURN (conf_modules, xf86parseModuleSection ()); } else if (xf86nameCompare (val.str, "serverlayout") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection, XF86ConfLayoutPtr); } else if (xf86nameCompare (val.str, "vendor") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection, XF86ConfVendorPtr); } else if (xf86nameCompare (val.str, "dri") == 0) { - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; HANDLE_RETURN (conf_dri, xf86parseDRISection ()); } else { Error (INVALID_SECTION_MSG, xf86tokenString ()); - xf86conffree(val.str); + xf86conffree(val.str); val.str = NULL; } break; @@ -242,21 +242,21 @@ int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2) { - GenericListPtr p = list_1; - GenericListPtr last_1 = NULL, last_2 = NULL; + GenericListPtr p = list_1; + GenericListPtr last_1 = NULL, last_2 = NULL; - while (p) { - last_1 = p; - p = p->next; - } - - p = list_2; - while (p) { - last_2 = p; - p = p->next; - } - - return (!(last_1 == last_2)); + while (p) { + last_1 = p; + p = p->next; + } + + p = list_2; + while (p) { + last_2 = p; + p = p->next; + } + + return (!(last_1 == last_2)); } void Index: xc/programs/Xserver/hw/xfree86/parser/scan.c diff -u xc/programs/Xserver/hw/xfree86/parser/scan.c:1.19 xc/programs/Xserver/hw/xfree86/parser/scan.c:1.24 --- xc/programs/Xserver/hw/xfree86/parser/scan.c:1.19 Mon Jul 23 09:15:49 2001 +++ xc/programs/Xserver/hw/xfree86/parser/scan.c Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/scan.c,v 1.19 2001/07/23 13:15:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/scan.c,v 1.24 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -72,9 +72,10 @@ static char *configPath; /* path to config file */ static char *configSection = NULL; /* name of current section being parsed */ static int pushToken = LOCK_TOKEN; +static int eol_seen = 0; /* private state to handle comments */ LexRec val; -#ifdef __EMX__ +#ifdef __UNIXOS2__ extern char *__XOS2RedirRoot(char *path); #endif @@ -144,6 +145,10 @@ return (EOF_TOKEN); else if (pushToken == LOCK_TOKEN) { + /* + * eol_seen is only set for the first token after a newline. + */ + eol_seen = 0; c = configBuf[configPos]; @@ -161,6 +166,7 @@ } configLineNo++; configStart = configPos = 0; + eol_seen = 1; } i = 0; @@ -186,13 +192,8 @@ do { configRBuf[i++] = (c = configBuf[configPos++]); -#ifndef __EMX__ - } - while ((c != '\n') && (c != '\0')); -#else } while ((c != '\n') && (c != '\r') && (c != '\0')); -#endif configRBuf[i] = '\0'; /* XXX no private copy. * Use xf86addComment when setting a comment. @@ -253,13 +254,8 @@ do { configRBuf[++i] = (c = configBuf[configPos++]); -#ifndef __EMX__ } - while ((c != '\"') && (c != '\n') && (c != '\0')); -#else - } while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0')); -#endif configRBuf[i] = '\0'; val.str = xf86confmalloc (strlen (configRBuf) + 1); strcpy (val.str, configRBuf); /* private copy ! */ @@ -277,13 +273,9 @@ do { configRBuf[++i] = (c = configBuf[configPos++]);; -#ifndef __EMX__ } - while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\0')); -#else - } - while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0')); -#endif + while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0') && (c != '#')); + --configPos; configRBuf[i] = '\0'; i = 0; } @@ -373,7 +365,7 @@ { if (path && path[0] == '/') return 1; -#ifdef __EMX__ +#ifdef __UNIXOS2__ if (path && (path[0] == '\\' || (path[1] == ':'))) return 0; #endif @@ -421,7 +413,7 @@ * %P projroot * %M major version number * %% % - * %& EMX only: prepend X11ROOT env var + * %& UNIXOS2 only: prepend X11ROOT env var */ #ifndef XCONFIGFILE @@ -474,7 +466,7 @@ static const char *env = NULL, *home = NULL; static char *hostname = NULL; static char majorvers[3] = ""; -#ifdef __EMX__ +#ifdef __UNIXOS2__ static char *x11root = NULL; #endif @@ -593,7 +585,7 @@ result[l++] = '%'; CHECK_LENGTH; break; -#ifdef __EMX__ +#ifdef __UNIXOS2__ case '&': if (!x11root) x11root = getenv("X11ROOT"); @@ -764,7 +756,7 @@ /* * Check if XF86CONFIG is set. */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (getuid () == 0 && (xconfig = getenv ("XF86CONFIG")) != 0 && strchr (xconfig, '/')) @@ -782,7 +774,7 @@ return 0; } -#ifndef __EMX__ +#ifndef __UNIXOS2__ /* * ~/XF86Config ... */ @@ -823,13 +815,13 @@ MAXHOSTNAMELEN); if ((configFile = fopen (configPaths[pcount], "r")) != 0) break; -#endif /* !__EMX__ */ +#endif /* !__UNIXOS2__ */ /* * $(XCONFIGDIR)/XF86Config */ configPaths[++pcount] = xf86confmalloc (PATH_MAX); -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (getuid () == 0 && xwinhome) sprintf (configPaths[pcount], "%s/lib/X11/" XCONFIGFILE, xwinhome); else @@ -965,10 +957,10 @@ void xf86setSection (char *section) { - if (configSection) - xf86conffree(configSection); - configSection = xf86confmalloc(strlen (section) + 1); - strcpy (configSection, section); + if (configSection) + xf86conffree(configSection); + configSection = xf86confmalloc(strlen (section) + 1); + strcpy (configSection, section); } /* @@ -1046,6 +1038,7 @@ curlen = strlen(cur); if (curlen) hasnewline = cur[curlen - 1] == '\n'; + eol_seen = 0; } else curlen = 0; @@ -1061,14 +1054,14 @@ len = strlen(add); endnewline = add[len - 1] == '\n'; - len += 1 + iscomment + (!hasnewline) + (!endnewline); + len += 1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen; if ((str = xf86confrealloc(cur, len + curlen)) == NULL) return (cur); cur = str; - if (curlen && !hasnewline) + if (eol_seen || (curlen && !hasnewline)) cur[curlen++] = '\n'; if (!iscomment) cur[curlen++] = '#'; Index: xc/programs/Xserver/hw/xfree86/parser/write.c diff -u xc/programs/Xserver/hw/xfree86/parser/write.c:1.15 xc/programs/Xserver/hw/xfree86/parser/write.c:1.17 --- xc/programs/Xserver/hw/xfree86/parser/write.c:1.15 Wed Jul 25 11:05:08 2001 +++ xc/programs/Xserver/hw/xfree86/parser/write.c Tue Sep 17 14:54:16 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.15 2001/07/25 15:05:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.17 2002/09/17 18:54:16 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -44,14 +44,14 @@ extern char *sys_errlist[]; extern int sys_nerr; #define strerror(n) \ - (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") + (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") #endif #endif #if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED) #define HAS_SAVED_IDS_AND_SETEUID #endif -#if defined(__EMX__) || defined(WIN32) +#if defined(__UNIXOS2__) || defined(WIN32) #define HAS_NO_UIDS #endif Index: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h diff -u xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h:1.29 xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h:1.30 --- xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h:1.29 Mon Jul 2 11:38:34 2001 +++ xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h Mon Sep 16 14:06:16 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h,v 1.29 2001/07/02 15:38:34 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h,v 1.30 2002/09/16 18:06:16 eich Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -43,6 +43,7 @@ char *file_logfile; char *file_rgbpath; char *file_modulepath; + char *file_inputdevs; char *file_fontpath; char *file_comment; } Index: xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h diff -u xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h:1.15 xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h:1.19 --- xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h:1.15 Tue Oct 24 18:45:10 2000 +++ xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h Sat Jan 4 15:20:23 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h,v 1.15 2000/10/24 22:45:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86tokens.h,v 1.19 2003/01/04 20:20:23 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -69,6 +69,7 @@ FONTPATH, RGBPATH, MODULEPATH, + INPUTDEVICES, LOGFILEPATH, /* Server Flag tokens. These are deprecated in favour of generic Options */ @@ -235,6 +236,7 @@ ABOVE, BELOW, RELATIVE, + ABSOLUTE, /* Vendor Tokens */ VENDORNAME, Index: xc/programs/Xserver/hw/xfree86/rac/Imakefile diff -u xc/programs/Xserver/hw/xfree86/rac/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/rac/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/rac/Imakefile:1.5 Sat Aug 14 06:50:07 1999 +++ xc/programs/Xserver/hw/xfree86/rac/Imakefile Mon Sep 16 14:06:18 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/rac/Imakefile,v 1.5 1999/08/14 10:50:07 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/rac/Imakefile,v 1.6 2002/09/16 18:06:18 eich Exp $ #define IHaveModules #include <Server.tmpl> @@ -12,7 +12,8 @@ OBJS = xf86RAC.o $(MODOBJ) INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(SERVERSRC)/render \ + -I$(XINCLUDESRC) -I$(EXTINCSRC) ModuleObjectRule() Index: xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c diff -u xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c:1.6 xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c:1.7 --- xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c:1.6 Sat Sep 25 10:38:12 1999 +++ xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c Mon Sep 16 14:06:18 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c,v 1.6 1999/09/25 14:38:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c,v 1.7 2002/09/16 18:06:18 eich Exp $ */ #include "misc.h" #include "xf86.h" @@ -18,6 +18,9 @@ #include "xf86RAC.h" #include "mipointer.h" #include "mipointrst.h" +#ifdef RENDER +# include "picturestr.h" +#endif #ifdef DEBUG #define DPRINT_S(x,y) ErrorF(x ": %i\n",y); @@ -40,6 +43,18 @@ ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->x #define SCREEN_EPILOG(x,y) pScreen->x = y; +#define WRAP_PICT_COND(x,y,cond) if (ps)\ + {pScreenPriv->x = ps->x;\ + if (flag & (cond))\ + ps->x = y;} +#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;} + +#define PICTURE_PROLOGUE(field) \ + ps->field = \ + ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->field +#define PICTURE_EPILOGUE(field, wrap) \ + ps->field = wrap + #define WRAP_SCREEN_INFO(x,y) {pScreenPriv->x = pScrn->x;\ pScrn->x = y;} #define WRAP_SCREEN_INFO_COND(x,y,cond) \ @@ -103,6 +118,11 @@ void (*LeaveVT)(int, int); void (*FreeScreen)(int, int); miPointerSpriteFuncPtr miSprite; +#ifdef RENDER + CompositeProcPtr Composite; + GlyphsProcPtr Glyphs; + CompositeRectsProcPtr CompositeRects; +#endif } RACScreenRec, *RACScreenPtr; typedef struct _RACGC { @@ -208,6 +228,17 @@ static void RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur, int x, int y); static void RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y); +#ifdef RENDER +static void RACComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, + INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height); +static void RACGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, + int nlist, GlyphListPtr list, GlyphPtr *glyphs); +static void RACCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, + int nRect, xRectangle *rects); +#endif GCFuncs RACGCFuncs = { RACValidateGC, RACChangeGC, RACCopyGC, RACDestroyGC, @@ -242,6 +273,9 @@ ScrnInfoPtr pScrn; RACScreenPtr pScreenPriv; miPointerScreenPtr PointPriv; +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +#endif pScrn = xf86Screens[pScreen->myNum]; PointPriv = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; @@ -282,6 +316,11 @@ WRAP_SCREEN_COND(UnrealizeCursor, RACUnrealizeCursor, RAC_CURSOR); WRAP_SCREEN_COND(RecolorCursor, RACRecolorCursor, RAC_CURSOR); WRAP_SCREEN_COND(SetCursorPosition, RACSetCursorPosition, RAC_CURSOR); +#ifdef RENDER + WRAP_PICT_COND(Composite,RACComposite,RAC_FB); + WRAP_PICT_COND(Glyphs,RACGlyphs,RAC_FB); + WRAP_PICT_COND(CompositeRects,RACCompositeRects,RAC_FB); +#endif WRAP_SCREEN_INFO_COND(AdjustFrame, RACAdjustFrame, RAC_VIEWPORT); WRAP_SCREEN_INFO(SwitchMode, RACSwitchMode); WRAP_SCREEN_INFO(EnterVT, RACEnterVT); @@ -301,7 +340,10 @@ (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; miPointerScreenPtr PointPriv = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; - +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +#endif + DPRINT_S("RACCloseScreen",pScreen->myNum); UNWRAP_SCREEN(CreateGC); UNWRAP_SCREEN(CloseScreen); @@ -321,6 +363,11 @@ UNWRAP_SCREEN(UnrealizeCursor); UNWRAP_SCREEN(RecolorCursor); UNWRAP_SCREEN(SetCursorPosition); +#ifdef RENDER + UNWRAP_PICT(Composite); + UNWRAP_PICT(Glyphs); + UNWRAP_PICT(CompositeRects); +#endif UNWRAP_SCREEN_INFO(AdjustFrame); UNWRAP_SCREEN_INFO(SwitchMode); UNWRAP_SCREEN_INFO(EnterVT); @@ -1155,3 +1202,55 @@ PointPriv->spriteFuncs->MoveCursor(pScreen, x, y); SPRITE_EPILOG; } + +#ifdef RENDER +static void +RACComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, + INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, + CARD16 height) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + PICTURE_PROLOGUE(Composite); + + ENABLE; + (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, + yDst, width, height); + + PICTURE_EPILOGUE(Composite, RACComposite); +} + +static void +RACGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, + GlyphListPtr list, GlyphPtr *glyphs) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + PICTURE_PROLOGUE(Glyphs); + + ENABLE; + (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); + + PICTURE_EPILOGUE (Glyphs, RACGlyphs); +} + +static void +RACCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, + xRectangle *rects) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + PICTURE_PROLOGUE(CompositeRects); + + ENABLE; + (*ps->CompositeRects)(op, pDst, color, nRect, rects); + + PICTURE_EPILOGUE (CompositeRects, RACCompositeRects); +} +#endif + Index: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES diff -u xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES:1.4 xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES:1.5 --- xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES:1.4 Tue May 8 23:12:06 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES Thu Feb 13 15:28:41 2003 @@ -105,9 +105,12 @@ HARDWARE_CURSOR_SHOW_TRANSPARENT The HideCursor entry will normally be called instead of displaying a - completely transparent cursor. This flag prevents this behaviour, thus - causing the LoadCursorImage entry to be called with the transparent cursor - data. + completely transparent cursor, or when a switch to a software cursor + needs to occur. This flag prevents this behaviour, thus causing the + LoadCursorImage entry to be called with transparent cursor data. + NOTE: If you use this flag and provide your own RealizeCursor() entry, + ensure this entry returns transparent cursor data when called + with a NULL pCurs parameter. HARDWARE_CURSOR_UPDATE_UNHIDDEN @@ -185,4 +188,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4 2001/05/09 03:12:06 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.5 2003/02/13 20:28:41 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/ramdac/IBM.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/IBM.c:1.11 xc/programs/Xserver/hw/xfree86/ramdac/IBM.c:1.12 --- xc/programs/Xserver/hw/xfree86/ramdac/IBM.c:1.11 Sun Apr 8 20:04:12 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/IBM.c Mon Feb 17 11:08:29 2003 @@ -23,7 +23,7 @@ * * IBM RAMDAC routines. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/IBM.c,v 1.11 2001/04/09 00:04:12 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/IBM.c,v 1.12 2003/02/17 16:08:29 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -460,7 +460,7 @@ } } -void +static void IBMramdac526ShowCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -469,7 +469,7 @@ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs, 0x00, 0x07); } -void +static void IBMramdac640ShowCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -479,7 +479,7 @@ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CROSSHAIR_CONTROL, 0x00, 0x00); } -void +static void IBMramdac526HideCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -488,7 +488,7 @@ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs, 0x00, 0x24); } -void +static void IBMramdac640HideCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -497,7 +497,7 @@ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x08); } -void +static void IBMramdac526SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -513,7 +513,7 @@ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_yh, 0x00, (y>>8) & 0xf); } -void +static void IBMramdac640SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -529,7 +529,7 @@ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_Y_HIGH, 0x00, (y>>8) & 0xf); } -void +static void IBMramdac526SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -542,7 +542,7 @@ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_b, 0x00, fg); } -void +static void IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -562,7 +562,7 @@ (*ramdacPtr->WriteData)(pScrn, bg); } -void +static void IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -575,7 +575,7 @@ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_array + i, 0x00, (*src++)); } -void +static void IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); Index: xc/programs/Xserver/hw/xfree86/ramdac/Imakefile diff -u xc/programs/Xserver/hw/xfree86/ramdac/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/ramdac/Imakefile:1.11 --- xc/programs/Xserver/hw/xfree86/ramdac/Imakefile:1.10 Mon Apr 23 12:17:11 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/Imakefile Fri May 31 14:46:03 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/Imakefile,v 1.10 2001/04/23 16:17:11 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/Imakefile,v 1.11 2002/05/31 18:46:03 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -32,9 +32,7 @@ ObjectFromSpecialSource(xf86BitOrder, ../xaa/xaaBitOrder, -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE) -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKLibraryModule(ramdac,$(DRIVERSDKMODULEDIR),.) Index: xc/programs/Xserver/hw/xfree86/ramdac/TI.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/TI.c:1.5 xc/programs/Xserver/hw/xfree86/ramdac/TI.c:1.7 --- xc/programs/Xserver/hw/xfree86/ramdac/TI.c:1.5 Tue May 2 17:04:46 2000 +++ xc/programs/Xserver/hw/xfree86/ramdac/TI.c Mon Feb 17 11:08:29 2003 @@ -22,9 +22,9 @@ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> * * Modified from IBM.c to support TI RAMDAC routines - * by Jens Owen, <jens@precisioninsight.com>. + * by Jens Owen, <jens@tungstengraphics.com>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/TI.c,v 1.5 2000/05/02 21:04:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/TI.c,v 1.7 2003/02/17 16:08:29 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -585,7 +585,7 @@ } } -void +static void TIramdacShowCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -594,7 +594,7 @@ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x03); } -void +static void TIramdacHideCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -603,7 +603,7 @@ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x00); } -void +static void TIramdacSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -617,7 +617,7 @@ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_YHIGH, 0, (y >> 8) & 0x0f); } -void +static void TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -635,7 +635,7 @@ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, (fg&0x000000ff) ); } -void +static void TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); Index: xc/programs/Xserver/hw/xfree86/ramdac/TI.h diff -u xc/programs/Xserver/hw/xfree86/ramdac/TI.h:1.4 xc/programs/Xserver/hw/xfree86/ramdac/TI.h:1.5 --- xc/programs/Xserver/hw/xfree86/ramdac/TI.h:1.4 Tue May 2 17:04:46 2000 +++ xc/programs/Xserver/hw/xfree86/ramdac/TI.h Mon Feb 17 11:08:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/TI.h,v 1.4 2000/05/02 21:04:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/TI.h,v 1.5 2003/02/17 16:08:29 dawes Exp $ */ #include <xf86RamDac.h> @@ -16,6 +16,9 @@ unsigned long MaxClock, unsigned long *rM, unsigned long *rN, unsigned long *rP); void TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr); +void TIramdacLoadPalette( ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual); + #define TI3030_RAMDAC (VENDOR_TI << 16) | 0x00 #define TI3026_RAMDAC (VENDOR_TI << 16) | 0x01 Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.12 xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.20 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.12 Wed Nov 7 23:15:33 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c Mon Feb 24 15:43:54 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c,v 1.12 2001/11/08 04:15:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c,v 1.20 2003/02/24 20:43:54 tsi Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -98,6 +98,9 @@ ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->SetDGAMode = pScrn->SetDGAMode; + + ScreenPriv->ForceHWCursorCount = 0; + ScreenPriv->HWCursorForced = FALSE; if (pScrn->SwitchMode) pScrn->SwitchMode = xf86CursorSwitchMode; @@ -119,6 +122,9 @@ xf86CursorScreenPtr ScreenPriv = pScreen->devPrivates[xf86CursorScreenIndex].ptr; + if (ScreenPriv->isUp && pScrn->vtSema) + xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); + pScreen->CloseScreen = ScreenPriv->CloseScreen; pScreen->QueryBestSize = ScreenPriv->QueryBestSize; pScreen->RecolorCursor = ScreenPriv->RecolorCursor; @@ -133,6 +139,7 @@ pScrn->LeaveVT = ScreenPriv->LeaveVT; pScrn->SetDGAMode = ScreenPriv->SetDGAMode; + xfree(ScreenPriv->transparentData); xfree(ScreenPriv); return (*pScreen->CloseScreen)(i, pScreen); @@ -195,6 +202,8 @@ ScreenPtr pScreen = screenInfo.screens[index]; xf86CursorScreenPtr ScreenPriv = pScreen->devPrivates[xf86CursorScreenIndex].ptr; + miPointerScreenPtr PointPriv = + pScreen->devPrivates[miPointerScreenIndex].ptr; if (ScreenPriv->isUp) { xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); @@ -205,9 +214,11 @@ /* * Cannot restore cursor here because the new frame[XY][01] haven't been - * calculated yet. + * calculated yet. However, because the hardware cursor was removed above, + * ensure the cursor is repainted by miPointerWarpCursor(). */ ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor; + PointPriv->waitForUpdate = FALSE; /* Force cursor repaint */ return ret; } @@ -324,10 +335,16 @@ PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr; - if (infoPtr->pScrn->vtSema && + if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || (( +#ifdef ARGB_CURSOR + pCurs->bits->argb && infoPtr->UseHWCursorARGB && + (*infoPtr->UseHWCursorARGB) (pScreen, pCurs) ) || ( + pCurs->bits->argb == 0 && +#endif (pCurs->bits->height <= infoPtr->MaxHeight) && (pCurs->bits->width <= infoPtr->MaxWidth) && - (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))) { + (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs)))))) + { if (ScreenPriv->SWCursor) /* remove the SW cursor */ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y); @@ -335,15 +352,20 @@ xf86SetCursor(pScreen, pCurs, x, y); ScreenPriv->SWCursor = FALSE; ScreenPriv->isUp = TRUE; - PointPriv->waitForUpdate = FALSE; + PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse; return; } PointPriv->waitForUpdate = TRUE; - if (ScreenPriv->isUp) { /* remove the HW cursor */ - xf86SetCursor(pScreen, NullCursor, x, y); - ScreenPriv->isUp = FALSE; + if (ScreenPriv->isUp) { + /* Remove the HW cursor, or make it transparent */ + if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) { + xf86SetTransparentCursor(pScreen); + } else { + xf86SetCursor(pScreen, NullCursor, x, y); + ScreenPriv->isUp = FALSE; + } } ScreenPriv->SWCursor = TRUE; @@ -369,6 +391,37 @@ (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); else if (ScreenPriv->isUp) xf86MoveCursor(pScreen, x, y); +} + +void +xf86ForceHWCursor (ScreenPtr pScreen, Bool on) +{ + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; + + if (on) + { + if (ScreenPriv->ForceHWCursorCount++ == 0) + { + if (ScreenPriv->SWCursor && ScreenPriv->CurrentCursor) + { + ScreenPriv->HWCursorForced = TRUE; + xf86CursorSetCursor (pScreen, ScreenPriv->CurrentCursor, + ScreenPriv->x, ScreenPriv->y); + } + else + ScreenPriv->HWCursorForced = FALSE; + } + } + else + { + if (--ScreenPriv->ForceHWCursorCount == 0) + { + if (ScreenPriv->HWCursorForced && ScreenPriv->CurrentCursor) + xf86CursorSetCursor (pScreen, ScreenPriv->CurrentCursor, + ScreenPriv->x, ScreenPriv->y); + } + } } xf86CursorInfoPtr Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h:1.7 xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h:1.11 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h:1.7 Fri May 18 16:22:31 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h Fri Feb 14 22:14:47 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.7 2001/05/18 20:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.11 2003/02/15 03:14:47 tsi Exp $ */ #ifndef _XF86CURSOR_H #define _XF86CURSOR_H @@ -19,23 +19,17 @@ unsigned char* (*RealizeCursor)(struct _xf86CursorInfoRec *, CursorPtr); Bool (*UseHWCursor)(ScreenPtr, CursorPtr); -} xf86CursorInfoRec, *xf86CursorInfoPtr; +#ifdef ARGB_CURSOR + Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr); + void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr); +#endif -Bool xf86InitCursor( - ScreenPtr pScreen, - xf86CursorInfoPtr infoPtr -); +} xf86CursorInfoRec, *xf86CursorInfoPtr; +Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); xf86CursorInfoPtr xf86CreateCursorInfoRec(void); void xf86DestroyCursorInfoRec(xf86CursorInfoPtr); - - -void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); -void xf86MoveCursor(ScreenPtr pScreen, int x, int y); -void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); -Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); - -extern int xf86CursorScreenIndex; +void xf86ForceHWCursor (ScreenPtr pScreen, Bool on); #define HARDWARE_CURSOR_INVERT_MASK 0x00000001 #define HARDWARE_CURSOR_AND_SOURCE_WITH_MASK 0x00000002 Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h:1.2 xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h:1.5 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h:1.2 Fri May 18 16:22:31 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h Fri Feb 14 22:14:47 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h,v 1.2 2001/05/18 20:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h,v 1.5 2003/02/15 03:14:47 tsi Exp $ */ #ifndef _XF86CURSORPRIV_H #define _XF86CURSORPRIV_H @@ -27,8 +27,22 @@ Bool (*EnterVT)(int, int); void (*LeaveVT)(int, int); int (*SetDGAMode)(int, int, DGADevicePtr); + + /* Number of requests to force HW cursor */ + int ForceHWCursorCount; + Bool HWCursorForced; + + pointer transparentData; } xf86CursorScreenRec, *xf86CursorScreenPtr; +void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); +void xf86SetTransparentCursor(ScreenPtr pScreen); +void xf86MoveCursor(ScreenPtr pScreen, int x, int y); +void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); +Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); + CARD32 xf86ReverseBitOrder(CARD32 data); + +extern int xf86CursorScreenIndex; #endif /* _XF86CURSORPRIV_H */ Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c:1.10 xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c:1.12 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c:1.10 Fri May 18 16:22:31 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c Thu Feb 13 15:28:41 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c,v 1.10 2001/05/18 20:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c,v 1.12 2003/02/13 20:28:41 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -124,6 +124,9 @@ x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX; y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY; +#ifdef ARGB_CURSOR + if (!pCurs->bits->argb || !infoPtr->LoadCursorARGB) +#endif if (!bits) { bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs); pCurs->devPriv[pScreen->myNum] = bits; @@ -132,6 +135,11 @@ if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) (*infoPtr->HideCursor)(infoPtr->pScrn); +#ifdef ARGB_CURSOR + if (pCurs->bits->argb && infoPtr->LoadCursorARGB) + (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs); + else +#endif if (bits) (*infoPtr->LoadCursorImage)(infoPtr->pScrn, bits); @@ -143,6 +151,27 @@ } void +xf86SetTransparentCursor(ScreenPtr pScreen) +{ + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; + + if (!ScreenPriv->transparentData) + ScreenPriv->transparentData = + (*infoPtr->RealizeCursor)(infoPtr, NullCursor); + + if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) + (*infoPtr->HideCursor)(infoPtr->pScrn); + + if (ScreenPriv->transparentData) + (*infoPtr->LoadCursorImage)(infoPtr->pScrn, + ScreenPriv->transparentData); + + (*infoPtr->ShowCursor)(infoPtr->pScrn); +} + +void xf86MoveCursor(ScreenPtr pScreen, int x, int y) { xf86CursorScreenPtr ScreenPriv = @@ -209,6 +238,16 @@ if (!(mem = xcalloc(1, size))) return NULL; + + if (pCurs == NullCursor) { + if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) { + DstM = (SCANLINE*)mem; + if (!(infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)) + DstM += words; + (void)memset(DstM, -1, words * sizeof(SCANLINE)); + } + return mem; + } /* SrcPitch == the number of scanlines wide the cursor image is */ SrcPitch = (pCurs->bits->width + (BITMAP_SCANLINE_PAD - 1)) >> Index: xc/programs/Xserver/hw/xfree86/scanpci/Imakefile diff -u xc/programs/Xserver/hw/xfree86/scanpci/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/scanpci/Imakefile:1.11 --- xc/programs/Xserver/hw/xfree86/scanpci/Imakefile:1.8 Thu Apr 6 11:27:26 2000 +++ xc/programs/Xserver/hw/xfree86/scanpci/Imakefile Sun Dec 22 20:46:17 2002 @@ -1,5 +1,5 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/Imakefile,v 1.8 2000/04/06 15:27:26 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/Imakefile,v 1.11 2002/12/23 01:46:17 dawes Exp $ #if DoLoadableServer #define IHaveSubdirs @@ -23,6 +23,32 @@ NormalLibraryTarget(scanpci,xf86ScanPci.o) NormalLibraryTarget(pcidata,xf86PciData.o) + +#if HasPerl5 +PCIIDSRCS = ../etc/pci.ids ../etc/extrapci.ids +PCIIDS = pci.ids + +$(PCIIDS): $(PCIIDSRCS) + RemoveFile($@) + cat $(PCIIDSRCS) > $@ + +includes:: xf86PciIds.h + +xf86PciIds.h: $(PCIIDS) pciid2c.pl ../common/xf86PciInfo.h + RemoveFile($@) + RunPerlScript(pciid2c.pl, ../common/xf86PciInfo.h < $(PCIIDS) > $@) + +clean:: + RemoveFile($(PCIIDS)) + RemoveFile(xf86PciIds.h) + +#else +LinkFile(xf86PciIds.h,xf86PciStdIds.h) +#endif + +LinkFile(xf86PciData.c,xf86ScanPci.c) + +SpecialCObjectRule(xf86PciData,NullParameter,-DPCIDATA) #if DoLoadableServer MakeSubdirs($(SUBDIRS)) Index: xc/programs/Xserver/hw/xfree86/scanpci/pciid2c.pl diff -u /dev/null xc/programs/Xserver/hw/xfree86/scanpci/pciid2c.pl:1.2 --- /dev/null Thu Feb 27 12:33:03 2003 +++ xc/programs/Xserver/hw/xfree86/scanpci/pciid2c.pl Mon Dec 23 11:45:19 2002 @@ -0,0 +1,362 @@ +#!/usr/bin/perl + +# Automatically generate the data structures for PCI vendor/device lists +# from the pci.ids file. +# +# It should be run as: +# +# perl pciid2c.pl ../common/xf86PciInfo.h < pci.ids > xf86PciIds.h +# +# +# Copyright © 2002 by The XFree86 Project, Inc. +# +# Author: David Dawes +# +# $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/pciid2c.pl,v 1.2 2002/12/23 16:45:19 tsi Exp $ +# + +if (@ARGV[0]) { + $infofile = @ARGV[0]; +} + +# +# The basic pci.ids format is: +# - Vendor lines start with four (lower case) hex digits +# - Device lines start with one tab followed by four hex digits +# - Subsystem lines start with two tabs followed by two sets of four +# hex digits. +# - Class overrides for devices start with two tabs followed by a "C", +# followed by four hex digits with the class/subclass value. +# - Class lines start with a "C". +# - Comment lines start with a '#'. +# - Blank lines are ignored. +# +# We allow for extra lines to be appended to modify existing entries or +# add new ones. To add/modify Device entries without modifying the +# Vendor name, a special vendor name of '"' is used (mnemonic: "ditto"). +# Similarly for adding subsystem names without modifying (or adding) +# a corresponding device entry. To rename an existing entry, simply +# provide the new name. To remove an existing entry, use the special +# name '-'. +# + +while (<STDIN>) { + # Process data lines + if (/^([0-9a-f]{4})\s+(.*)/) { + $vendor = $1; + if ($2 eq '-') { + delete($vendors{$vendor}); + } elsif ($2 ne '"') { + $vendors{$vendor} = $2; + # Remove " characters + $vendors{$vendor} =~ s/"//g; + # Remove multiple "?" sequences to avoid trigraphs + $vendors{$vendor} =~ s/\?+/\?/g; + } + } elsif (/^\t([0-9a-f]{4})\s+(.*)/) { + $device = $1; + if ($2 eq '-') { + delete($devices{$vendor}{$device}); + } elsif ($2 ne '"') { + $devices{$vendor}{$device} = $2; + # Remove " characters + $devices{$vendor}{$device} =~ s/"//g; + # Remove multiple "?" sequences to avoid trigraphs + $devices{$vendor}{$device} =~ s/\?+/\?/g; + } + } elsif (/^\t\t([0-9a-f]{4})\s+([0-9a-f]{4})\s+(.*)/) { + $v = $1; + $s = $2; + if ($3 eq '-') { + delete($subsystems{$v}{$s}); + delete($devsubsystems{$vendor}{$device}{"$v-$s"}); + } elsif ($3 ne '"') { + if ($subsystems{$v}{$s}) { + #print STDERR "Duplicate subsytem: $v, $s, \"$subsystems{$v}{$s}\", \"$3\"\n"; + } + $subsystems{$v}{$s} = $3; + # Remove " characters + $subsystems{$v}{$s} =~ s/"//g; + # Remove multiple "?" sequences to avoid trigraphs + $subsystems{$v}{$s} =~ s/\?+/\?/g; + $devsubsystems{$vendor}{$device}{"$v-$s"} = $subsystems{$v}{$s}; + } + } elsif (/^\t\tC\s+([0-9a-f]{4})/) { + $classes{$vendor}{$device} = $1; + } + # Ignore all other lines. +} + +# Find which vendors are "video" vendors. +if ($infofile) { + open(INFO, "<$infofile") || die "Can't open $infofile"; + while (<INFO>) { + if (/^#define\s+PCI_VENDOR_.*0x([0-9a-fA-F]{4})/) { + $vendor = $1; + $vendor =~ tr/A-F/a-f/; + $video{$vendor} = 1; + } + } +} + +# +# This layout is quite different from that used in the old xf86PciInfo.h +# file. One main difference is that the list is initialised at runtime. +# It's currently a flat list. This could be improved. +# + +# Print out header information. + +$proj = "XFree86"; +print "/* \$$proj\$ */ + +/* + * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT + * + * It is generated by pciid2c.pl using data from the following files: + * + * ../etc/pci.ids + * ../etc/extrapci.ids + * ../common/xf86PciInfo.h + */ + +/* + * Copyright © 2002 by the XFree86 Project, Inc. + * + * The pci.ids file and the data it contains are from the Linux PCI ID's + * Project (http://pciids.sf.net/). It is maintained by Martin Mares + * <mj\@ucw.cz> and other volunteers. The pci.ids file contains no + * copyright notice. + */ + +#include \"xf86PciInfo.h\" +#ifndef NULL +#define NULL (void *)0 +#endif + +"; + +# The following #ifdefs are used: +# - INIT_SUBSYS_INFO -- initialise subsystem data +# - INIT_VENDOR_SUBSYS_INFO -- initialise a vendor<->subsystem table. +# - VENDOR_INCLUDE_NONVIDEO -- include data for non-video vendors. + +# Define static variables with all of the strings. + +foreach $vendor (sort keys %vendors) { + if ($infofile && !$video{$vendor}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + print "static const char pci_vendor_${vendor}[] = \"$vendors{$vendor}\";\n"; + foreach $device (sort keys %{$devices{$vendor}}) { + print "static const char pci_device_${vendor}_${device}[] = " . + "\"$devices{$vendor}{$device}\";\n"; + foreach $subsys (sort keys %{$devsubsystems{$vendor}{$device}}) { + $s = $subsys; + ($v) = split /-/, $s; + if ($infofile && !$video{$vendor} && $video{$v}) { + print "#endif\n"; + } + $s =~ s/-/_/; + print "#ifdef INIT_SUBSYS_INFO\n"; + print "static const char pci_subsys_${vendor}_${device}_${s}[] = " . + "\"$devsubsystems{$vendor}{$device}{$subsys}\";\n"; + print "#endif\n"; + if ($infofile && !$video{$vendor} && $video{$v}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + } + } + if ($infofile && !$video{$vendor}) { + print "#endif\n"; + } +} + + +# Pre-initialise the table structures (from the inner to the outer). + +# First, the subsys structures. + +print "#ifdef INIT_SUBSYS_INFO\n"; +foreach $vendor (sort keys %vendors) { + if ($infofile && !$video{$vendor}) { + $pre = "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } else { + undef($pre); + undef($post); + } + foreach $device (sort keys %{$devices{$vendor}}) { + foreach $subsys (sort keys %{$devsubsystems{$vendor}{$device}}) { + $s = $subsys; + $s =~ tr/-/_/; + ($vid, $sid) = split /_/, $s; + if ($pre) { + print $pre; + undef($pre); + $post = "#endif\n"; + } + if ($infofile && !$video{$vendor} && $video{$vid}) { + print "#endif\n"; + } + print "static const pciSubsystemInfo " . + "pci_ss_info_${vendor}_${device}_$s =\n"; + print "\t{0x$vid, 0x$sid, pci_subsys_${vendor}_${device}_$s, 0};\n"; + print "#undef pci_ss_info_$s\n"; + print "#define pci_ss_info_$s pci_ss_info_${vendor}_${device}_$s\n"; + if ($infofile && !$video{$vendor} && $video{$vid}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + } + } + if ($post) { + print $post; + undef($post); + } +} + +# Next, the list of per vendor+device subsystem arrays + +foreach $vendor (sort keys %vendors) { + if ($infofile && !$video{$vendor}) { + $pre = "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } else { + undef($pre); + undef($post); + } + foreach $device (sort keys %{$devices{$vendor}}) { + if (scalar(keys %{$devsubsystems{$vendor}{$device}}) > 0) { + if ($pre) { + print $pre; + undef($pre); + $post = "#endif\n"; + } + print "static const pciSubsystemInfo *pci_ss_list_${vendor}_${device}[] = {\n"; + foreach $sub (sort keys %{$devsubsystems{$vendor}{$device}}) { + $sub =~ s/-/_/; + print "\t&pci_ss_info_${vendor}_${device}_${sub},\n"; + } + print "\tNULL\n};\n"; + } else { + print "#define pci_ss_list_${vendor}_${device} NULL\n"; + } + } + if ($post) { + print $post; + undef($post); + } +} + +# Next, the list of per vendor subsystem arrays + +print "#ifdef INIT_VENDOR_SUBSYS_INFO\n"; +foreach $vendor (sort keys %vendors) { + if (scalar(keys %{$subsystems{$vendor}}) > 0) { + if ($infofile && !$video{$vendor}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + print "static const pciSubsystemInfo *pci_ss_list_${vendor}[] = {\n"; + foreach $sub (sort keys %{$subsystems{$vendor}}) { + print "\t&pci_ss_info_${vendor}_${sub},\n"; + } + print "\tNULL\n};\n"; + if ($infofile && !$video{$vendor}) { + print "#endif\n"; + } + } else { + print "#define pci_ss_list_${vendor} NULL\n"; + } +} +print "#endif /* INIT_VENDOR_SUBSYS_INFO */\n"; +print "#endif /* INIT_SUBSYS_INFO */\n"; + +# Next the device structures + +foreach $vendor (sort keys %vendors) { + if ($infofile && !$video{$vendor}) { + $pre = "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } else { + undef($pre); + undef($post); + } + foreach $device (sort keys %{$devices{$vendor}}) { + if ($pre) { + print $pre; + undef($pre); + $post = "#endif\n"; + } + if ($classes{$vendor}{$device}) { + $class = "0x$classes{$vendor}{$device}"; + } else { + $class = "0"; + } + print "static const pciDeviceInfo " . + "pci_dev_info_${vendor}_${device} = {\n"; + print "\t0x$device, pci_device_${vendor}_${device},\n"; + print "#ifdef INIT_SUBSYS_INFO\n"; + print "\tpci_ss_list_${vendor}_${device},\n"; + print "#else\n"; + print "\tNULL,\n"; + print "#endif\n"; + print "\t$class\n};\n"; + } + if ($post) { + print $post; + undef($post); + } +} + +# Next, the list of per vendor device arrays + +foreach $vendor (sort keys %vendors) { + if (scalar(keys %{$devices{$vendor}}) > 0) { + if ($infofile && !$video{$vendor}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + print "static const pciDeviceInfo *pci_dev_list_${vendor}[] = {\n"; + foreach $device (sort keys %{$devices{$vendor}}) { + print "\t&pci_dev_info_${vendor}_${device},\n"; + } + print "\tNULL\n};\n"; + if ($infofile && !$video{$vendor}) { + print "#endif\n"; + } + } else { + print "#define pci_dev_list_${vendor} NULL\n"; + } +} + +# Next, the main vendor list + +print " +static const pciVendorInfo pciVendorInfoList[] = { +"; + +foreach $vendor (sort keys %vendors) { + if ($infofile && !$video{$vendor}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + print "\t{0x$vendor, pci_vendor_$vendor, pci_dev_list_$vendor},\n"; + if ($infofile && !$video{$vendor}) { + print "#endif\n"; + } +} +print "\t{0x0000, NULL, NULL}\n};\n"; + +# Finally, the main vendor/subsystem list + +print " +#if defined(INIT_VENDOR_SUBSYS_INFO) && defined(INIT_SUBSYS_INFO) +static const pciVendorSubsysInfo pciVendorSubsysInfoList[] = { +"; + +foreach $vendor (sort keys %vendors) { + if ($infofile && !$video{$vendor}) { + print "#ifdef VENDOR_INCLUDE_NONVIDEO\n"; + } + print "\t{0x$vendor, pci_vendor_$vendor, pci_ss_list_$vendor},\n"; + if ($infofile && !$video{$vendor}) { + print "#endif\n"; + } +} +print "\t{0x0000, NULL, NULL}\n};\n"; +print "#endif\n"; Index: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.c diff -u xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.c:1.5 xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.c:removed --- xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.c:1.5 Wed Apr 5 14:13:58 2000 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.c Thu Feb 27 12:33:03 2003 @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.c,v 1.5 2000/04/05 18:13:58 dawes Exp $ */ -/* - * the PCI data structures - * - * this module only includes the data that is relevant for video boards - * the non-video data is included in the scanpci module - * - * Copyright 1995-2000 by The XFree86 Project, Inc. - * - */ - -/* XXX This is including a lot of stuff that modules should not include! */ - -#include "X.h" -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Pci.h" - -#ifndef IN_MODULE -#include <ctype.h> -#include <stdlib.h> -#else -#include <xf86_ansic.h> -#endif - -#define INIT_PCI_CARD_INFO TRUE -#define DECLARE_CARD_DATASTRUCTURES TRUE -#define INIT_PCI_VENDOR_INFO TRUE -#define INIT_PCI_VENDOR_NAME_INFO TRUE -#include "xf86PciInfo.h" -#include "xf86PciData.h" - -#ifdef XFree86LOADER - -#include "xf86Module.h" - -static XF86ModuleVersionInfo pciDataVersRec = { - "pcidata", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 0, 1, 0, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - NULL, - {0, 0, 0, 0} -}; - -XF86ModuleData pcidataModuleData = { &pciDataVersRec, NULL, NULL }; - -#endif /* XFree86LOADER */ - -void -xf86SetupPciData(SymTabPtr *NameInfo, - pciVendorDeviceInfo **DeviceInfo, - pciVendorCardInfo **CardInfo) -{ - *CardInfo = xf86PCICardInfoData; - *DeviceInfo = xf86PCIVendorInfoData; - *NameInfo = xf86PCIVendorNameInfoData; -} - Index: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h diff -u xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h:1.1 xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h:1.2 --- xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h:1.1 Tue Feb 8 08:13:33 2000 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h Mon Jul 15 16:46:02 2002 @@ -1,15 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h,v 1.1 2000/02/08 13:13:33 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h,v 1.2 2002/07/15 20:46:02 dawes Exp $ */ + + #ifndef PCI_DATA_H_ #define PCI_DATA_H_ + +#define NOVENDOR 0xFFFF +#define NODEVICE 0xFFFF +#define NOSUBSYS 0xFFFF + +typedef Bool (*ScanPciSetupProcPtr)(void); +typedef void (*ScanPciCloseProcPtr)(void); +typedef int (*ScanPciFindByDeviceProcPtr)( + unsigned short vendor, unsigned short device, + unsigned short svendor, unsigned short subsys, + const char **vname, const char **dname, + const char **svname, const char **sname); +typedef int (*ScanPciFindBySubsysProcPtr)( + unsigned short svendor, unsigned short subsys, + const char **svname, const char **sname); +typedef CARD32 (*ScanPciFindClassBySubsysProcPtr)( + unsigned short vendor, unsigned short subsystem); +typedef CARD32 (*ScanPciFindClassByDeviceProcPtr)( + unsigned short vendor, unsigned short device); + +/* + * Whoever loads this module needs to define these and initialise them + * after loading. + */ +extern ScanPciSetupProcPtr xf86SetupPciIds; +extern ScanPciCloseProcPtr xf86ClosePciIds; +extern ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice; +extern ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys; +extern ScanPciFindClassBySubsysProcPtr xf86FindPciClassBySubsys; +extern ScanPciFindClassByDeviceProcPtr xf86FindPciClassByDevice; + +Bool ScanPciSetupPciIds(void); +void ScanPciClosePciIds(void); +int ScanPciFindPciNamesByDevice(unsigned short vendor, unsigned short device, + unsigned short svendor, unsigned short subsys, + const char **vname, const char **dname, + const char **svname, const char **sname); +int ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys, + const char **svname, const char **sname); +CARD32 ScanPciFindPciClassBySubsys(unsigned short vendor, + unsigned short subsystem); +CARD32 ScanPciFindPciClassByDevice(unsigned short vendor, + unsigned short device); -#ifndef DECLARE_CARD_DATASTRUCTURES -#define DECLARE_CARD_DATASTRUCTURES -#endif -#include "xf86PciInfo.h" - -void -xf86SetupPciData(SymTabPtr *NameInfo, - pciVendorDeviceInfo **DeviceInfo, - pciVendorCardInfo **CardInfo); #endif Index: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStdIds.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStdIds.h:1.10 --- /dev/null Thu Feb 27 12:33:03 2003 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStdIds.h Wed Feb 26 11:33:03 2003 @@ -0,0 +1,80800 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStdIds.h,v 1.10 2003/02/26 16:33:03 dawes Exp $ */ + +/* + * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT + * + * It is generated by pciid2c.pl using data from the following files: + * + * ../etc/pci.ids + * ../etc/extrapci.ids + * ../common/xf86PciInfo.h + */ + +/* + * Copyright © 2002 by the XFree86 Project, Inc. + * + * The pci.ids file and the data it contains are from the Linux PCI ID's + * Project (http://pciids.sf.net/). It is maintained by Martin Mares + * <mj@ucw.cz> and other volunteers. The pci.ids file contains no + * copyright notice. + */ + +#include "xf86PciInfo.h" +#ifndef NULL +#define NULL (void *)0 +#endif + +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0000[] = "Gammagraphx, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_001a[] = "Ascend Communications, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0033[] = "Paradyne corp."; +#endif +static const char pci_vendor_003d[] = "Lockheed Martin-Marietta Corp"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0059[] = "Tiger Jet Network Inc. (Wrong ID)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0070[] = "Hauppauge computer works Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0100[] = "Ncipher Corp Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0675[] = "Dynalink"; +static const char pci_device_0675_1700[] = "IS64PH ISDN Adapter"; +static const char pci_device_0675_1702[] = "IS64PH ISDN Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0925[] = "VIA Technologies, Inc. (Wrong ID)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_09c1[] = "Arris"; +static const char pci_device_09c1_0704[] = "CM 200E Cable Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0a89[] = "BREA Technologies Inc"; +#endif +static const char pci_vendor_0e11[] = "Compaq Computer Corporation"; +static const char pci_device_0e11_0001[] = "PCI to EISA Bridge"; +static const char pci_device_0e11_0002[] = "PCI to ISA Bridge"; +static const char pci_device_0e11_0049[] = "NC7132 Gigabit Upgrade Module"; +static const char pci_device_0e11_004a[] = "NC6136 Gigabit Server Adapter"; +static const char pci_device_0e11_0508[] = "Netelligent 4/16 Token Ring"; +static const char pci_device_0e11_1000[] = "Triflex/Pentium Bridge, Model 1000"; +static const char pci_device_0e11_2000[] = "Triflex/Pentium Bridge, Model 2000"; +static const char pci_device_0e11_3032[] = "QVision 1280/p"; +static const char pci_device_0e11_3033[] = "QVision 1280/p"; +static const char pci_device_0e11_3034[] = "QVision 1280/p"; +static const char pci_device_0e11_4000[] = "4000 [Triflex]"; +static const char pci_device_0e11_6010[] = "HotPlug PCI Bridge 6010"; +static const char pci_device_0e11_7020[] = "USB Controller"; +static const char pci_device_0e11_a0ec[] = "Fibre Channel Host Controller"; +static const char pci_device_0e11_a0f0[] = "Advanced System Management Controller"; +static const char pci_device_0e11_a0f3[] = "Triflex PCI to ISA Bridge"; +static const char pci_device_0e11_a0f7[] = "PCI Hotplug Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_0e11_a0f7_8086_002a[] = "PCI Hotplug Controller A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_0e11_a0f7_8086_002b[] = "PCI Hotplug Controller B"; +#endif +static const char pci_device_0e11_a0f8[] = "ZFMicro Chipset USB"; +static const char pci_device_0e11_a0fc[] = "Fibre Channel Host Controller"; +static const char pci_device_0e11_ae10[] = "Smart-2/P RAID Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_0e11_ae10_0e11_4030[] = "Smart-2/P Array Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_0e11_ae10_0e11_4031[] = "Smart-2SL Array Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_0e11_ae10_0e11_4032[] = "Smart Array Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_0e11_ae10_0e11_4033[] = "Smart 3100ES Array Controller"; +#endif +static const char pci_device_0e11_ae29[] = "MIS-L"; +static const char pci_device_0e11_ae2a[] = "MPC"; +static const char pci_device_0e11_ae2b[] = "MIS-E"; +static const char pci_device_0e11_ae31[] = "System Management Controller"; +static const char pci_device_0e11_ae32[] = "Netelligent 10/100"; +static const char pci_device_0e11_ae33[] = "Triflex Dual EIDE Controller"; +static const char pci_device_0e11_ae34[] = "Netelligent 10"; +static const char pci_device_0e11_ae35[] = "Integrated NetFlex-3/P"; +static const char pci_device_0e11_ae40[] = "Netelligent 10/100 Dual"; +static const char pci_device_0e11_ae43[] = "ProLiant Integrated Netelligent 10/100"; +static const char pci_device_0e11_ae69[] = "CETUS-L"; +static const char pci_device_0e11_ae6c[] = "Northstar"; +static const char pci_device_0e11_ae6d[] = "NorthStar CPU to PCI Bridge"; +static const char pci_device_0e11_b011[] = "Integrated Netelligent 10/100"; +static const char pci_device_0e11_b012[] = "Netelligent 10 T/2"; +static const char pci_device_0e11_b01e[] = "NC3120 Fast Ethernet NIC"; +static const char pci_device_0e11_b01f[] = "NC3122 Fast Ethernet NIC"; +static const char pci_device_0e11_b02f[] = "NC1120 Ethernet NIC"; +static const char pci_device_0e11_b030[] = "Netelligent WS 5100"; +static const char pci_device_0e11_b04a[] = "10/100 TX PCI Intel WOL UTP Controller"; +static const char pci_device_0e11_b060[] = "Smart Array 5300 Controller"; +static const char pci_device_0e11_b0c6[] = "NC3161 Fast Ethernet NIC"; +static const char pci_device_0e11_b0c7[] = "NC3160 Fast Ethernet NIC"; +static const char pci_device_0e11_b0d7[] = "NC3121 Fast Ethernet NIC"; +static const char pci_device_0e11_b0dd[] = "NC3131 Fast Ethernet NIC"; +static const char pci_device_0e11_b0de[] = "NC3132 Fast Ethernet Module"; +static const char pci_device_0e11_b0df[] = "NC6132 Gigabit Module"; +static const char pci_device_0e11_b0e0[] = "NC6133 Gigabit Module"; +static const char pci_device_0e11_b0e1[] = "NC3133 Fast Ethernet Module"; +static const char pci_device_0e11_b123[] = "NC6134 Gigabit NIC"; +static const char pci_device_0e11_b134[] = "NC3163 Fast Ethernet NIC"; +static const char pci_device_0e11_b13c[] = "NC3162 Fast Ethernet NIC"; +static const char pci_device_0e11_b144[] = "NC3123 Fast Ethernet NIC"; +static const char pci_device_0e11_b163[] = "NC3134 Fast Ethernet NIC"; +static const char pci_device_0e11_b164[] = "NC3165 Fast Ethernet Upgrade Module"; +static const char pci_device_0e11_b178[] = "Smart Array 5i/532"; +static const char pci_device_0e11_b1a4[] = "NC7131 Gigabit Server Adapter"; +static const char pci_device_0e11_f130[] = "NetFlex-3/P ThunderLAN 1.0"; +static const char pci_device_0e11_f150[] = "NetFlex-3/P ThunderLAN 2.3"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_0e55[] = "HaSoTec GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1000[] = "LSI Logic / Symbios Logic"; +static const char pci_device_1000_0001[] = "53c810"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_0001_1000_1000[] = "8100S"; +#endif +static const char pci_device_1000_0002[] = "53c820"; +static const char pci_device_1000_0003[] = "53c825"; +static const char pci_device_1000_0004[] = "53c815"; +static const char pci_device_1000_0005[] = "53c810AP"; +static const char pci_device_1000_0006[] = "53c860"; +static const char pci_device_1000_000a[] = "53c1510"; +static const char pci_device_1000_000b[] = "53c896"; +static const char pci_device_1000_000c[] = "53c895"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_000c_1de1_3907[] = "DC-390U2W"; +#endif +static const char pci_device_1000_000d[] = "53c885"; +static const char pci_device_1000_000f[] = "53c875"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_000f_0e11_7004[] = "Embedded Ultra Wide SCSI Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_000f_1092_8760[] = "FirePort 40 Dual SCSI Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_000f_1de1_3904[] = "DC390F Ultra Wide SCSI Controller"; +#endif +static const char pci_device_1000_0010[] = "53c895"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_0010_0e11_4040[] = "Integrated Array Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_0010_0e11_4048[] = "Integrated Array Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1000_0012[] = "53c895a"; +static const char pci_device_1000_0013[] = "53c875a"; +static const char pci_device_1000_0020[] = "53c1010 Ultra3 SCSI Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_0020_1de1_1020[] = "DC-390U3W"; +#endif +static const char pci_device_1000_0021[] = "53c1010 66MHz Ultra3 SCSI Adapter"; +static const char pci_device_1000_0030[] = "53c1030"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_0030_1028_1010[] = "LSI U320 SCSI Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1000_0040[] = "53c1035"; +static const char pci_device_1000_008f[] = "53c875J"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_008f_1092_8000[] = "FirePort 40 SCSI Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_008f_1092_8760[] = "FirePort 40 Dual SCSI Host Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1000_0621[] = "FC909"; +static const char pci_device_1000_0622[] = "FC929"; +static const char pci_device_1000_0623[] = "FC929 LAN"; +static const char pci_device_1000_0624[] = "FC919"; +static const char pci_device_1000_0625[] = "FC919 LAN"; +static const char pci_device_1000_0626[] = "FC929X"; +static const char pci_device_1000_0627[] = "FC929X LAN"; +static const char pci_device_1000_0628[] = "FC919X"; +static const char pci_device_1000_0629[] = "FC919X LAN"; +static const char pci_device_1000_0701[] = "83C885 NT50 DigitalScape Fast Ethernet"; +static const char pci_device_1000_0702[] = "Yellowfin G-NIC gigabit ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_0702_1318_0000[] = "PEI100X"; +#endif +static const char pci_device_1000_0901[] = "61C102"; +static const char pci_device_1000_1000[] = "63C815"; +static const char pci_device_1000_1960[] = "PowerEdge Expandable RAID Controller 4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_1960_1028_0518[] = "PowerEdge Expandable RAID Controller 4/DC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_1960_1028_0520[] = "PowerEdge Expandable RAID Controller 4/SC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1000_1960_1028_0531[] = "PowerEdge Expandable RAID Controller 4/QC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1001[] = "Kolter Electronic"; +static const char pci_device_1001_0010[] = "PCI 1616 Measurement card with 32 digital I/O lines"; +static const char pci_device_1001_0011[] = "OPTO-PCI Opto-Isolated digital I/O board"; +static const char pci_device_1001_0012[] = "PCI-AD/DA Analogue I/O board"; +static const char pci_device_1001_0013[] = "PCI-OPTO-RELAIS Digital I/O board with relay outputs"; +static const char pci_device_1001_0014[] = "PCI-Counter/Timer Counter Timer board"; +static const char pci_device_1001_0015[] = "PCI-DAC416 Analogue output board"; +static const char pci_device_1001_0016[] = "PCI-MFB Analogue I/O board"; +static const char pci_device_1001_0017[] = "PROTO-3 PCI Prototyping board"; +static const char pci_device_1001_9100[] = "INI-9100/9100W SCSI Host"; +#endif +static const char pci_vendor_1002[] = "ATI Technologies Inc"; +static const char pci_device_1002_4144[] = "Radeon R300 AD [Radeon 9500 Pro]"; +static const char pci_device_1002_4145[] = "Radeon R300 AE [Radeon 9500 Pro]"; +static const char pci_device_1002_4146[] = "Radeon R300 AF [Radeon 9500 Pro]"; +static const char pci_device_1002_4147[] = "Radeon R300 AG [FireGL Z1/X1]"; +static const char pci_device_1002_4158[] = "68800AX [Mach32]"; +static const char pci_device_1002_4242[] = "Radeon R200 BB [Radeon All in Wonder 8500DV]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4242_1002_02aa[] = "Radeon 8500 AIW DV Edition"; +#endif +static const char pci_device_1002_4336[] = "Radeon Mobility U1"; +static const char pci_device_1002_4337[] = "Radeon IGP 340M"; +static const char pci_device_1002_4354[] = "215CT [Mach64 CT]"; +static const char pci_device_1002_4358[] = "210888CX [Mach64 CX]"; +static const char pci_device_1002_4554[] = "210888ET [Mach64 ET]"; +static const char pci_device_1002_4654[] = "Mach64 VT"; +static const char pci_device_1002_4742[] = "3D Rage Pro AGP 1X/2X"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0040[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0044[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0061[] = "Rage Pro AIW AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0062[] = "Rage Pro AIW AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0063[] = "Rage Pro AIW AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0080[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_0084[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_4742[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1002_8001[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1028_0082[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1028_4082[] = "Optiplex GX1 Onboard Display Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1028_8082[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_1028_c082[] = "Rage Pro Turbo AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_8086_4152[] = "Xpert 98D AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4742_8086_464a[] = "Rage Pro Turbo AGP 2X"; +#endif +static const char pci_device_1002_4744[] = "3D Rage Pro AGP 1X"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4744_1002_4744[] = "Rage Pro Turbo AGP"; +#endif +static const char pci_device_1002_4747[] = "3D Rage Pro"; +static const char pci_device_1002_4749[] = "3D Rage Pro"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4749_1002_0061[] = "Rage Pro AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4749_1002_0062[] = "Rage Pro AIW"; +#endif +static const char pci_device_1002_474c[] = "Rage XC"; +static const char pci_device_1002_474d[] = "Rage XL AGP 2X"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474d_1002_0004[] = "Xpert 98 RXL AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474d_1002_0008[] = "Xpert 98 RXL AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474d_1002_0080[] = "Rage XL AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474d_1002_0084[] = "Xpert 98 AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474d_1002_474d[] = "Rage XL AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474d_1033_806a[] = "Rage XL AGP"; +#endif +static const char pci_device_1002_474e[] = "Rage XC AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474e_1002_474e[] = "Rage XC AGP"; +#endif +static const char pci_device_1002_474f[] = "Rage XL"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474f_1002_0008[] = "Rage XL"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_474f_1002_474f[] = "Rage XL"; +#endif +static const char pci_device_1002_4750[] = "3D Rage Pro 215GP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4750_1002_0040[] = "Rage Pro Turbo"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4750_1002_0044[] = "Rage Pro Turbo"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4750_1002_0080[] = "Rage Pro Turbo"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4750_1002_0084[] = "Rage Pro Turbo"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4750_1002_4750[] = "Rage Pro Turbo"; +#endif +static const char pci_device_1002_4751[] = "3D Rage Pro 215GQ"; +static const char pci_device_1002_4752[] = "Rage XL"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4752_1002_0008[] = "Rage XL"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4752_1002_4752[] = "Rage XL"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4752_1002_8008[] = "Rage XL"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4752_1028_00d1[] = "PowerEdge 2550"; +#endif +static const char pci_device_1002_4753[] = "Rage XC"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4753_1002_4753[] = "Rage XC"; +#endif +static const char pci_device_1002_4754[] = "3D Rage I/II 215GT [Mach64 GT]"; +static const char pci_device_1002_4755[] = "3D Rage II+ 215GTB [Mach64 GTB]"; +static const char pci_device_1002_4756[] = "3D Rage IIC 215IIC [Mach64 GT IIC]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4756_1002_4756[] = "Rage IIC"; +#endif +static const char pci_device_1002_4757[] = "3D Rage IIC AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4757_1002_4757[] = "Rage IIC AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4757_1028_0089[] = "Rage 3D IIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4757_1028_4082[] = "Rage 3D IIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4757_1028_8082[] = "Rage 3D IIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4757_1028_c082[] = "Rage 3D IIC"; +#endif +static const char pci_device_1002_4758[] = "210888GX [Mach64 GX]"; +static const char pci_device_1002_4759[] = "3D Rage IIC"; +static const char pci_device_1002_475a[] = "3D Rage IIC AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_475a_1002_0087[] = "Rage 3D IIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_475a_1002_475a[] = "Rage IIC AGP"; +#endif +static const char pci_device_1002_4964[] = "Radeon R250 Id [Radeon 9000]"; +static const char pci_device_1002_4965[] = "Radeon R250 Ie [Radeon 9000]"; +static const char pci_device_1002_4966[] = "Radeon R250 If [Radeon 9000]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_10f1_0002[] = "R250 If [Tachyon G9000 PRO]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_148c_2039[] = "R250 If [Radeon 9000 Pro Evil Commando]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_1509_9a00[] = "R250 If [Radeon 9000 AT009]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_1681_0040[] = "R250 If [3D prophet 9000]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_174b_7176[] = "R250 If [Sapphire Radeon 9000 Pro]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_174b_7192[] = "R250 If [Radeon 9000 Atlantis]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_17af_2005[] = "R250 If [Excalibur Radeon 9000 Pro]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4966_17af_2006[] = "R250 If [Excalibur Radeon 9000]"; +#endif +static const char pci_device_1002_4967[] = "Radeon R250 Ig [Radeon 9000]"; +static const char pci_device_1002_496e[] = "Radeon R250 [Radeon 9000] (Secondary)"; +static const char pci_device_1002_4c42[] = "3D Rage LT Pro AGP-133"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_0e11_b0e8[] = "Rage 3D LT Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_0e11_b10e[] = "3D Rage LT Pro (Compaq Armada 1750)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_1002_0040[] = "Rage LT Pro AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_1002_0044[] = "Rage LT Pro AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_1002_4c42[] = "Rage LT Pro AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_1002_8001[] = "Rage LT Pro AGP 2X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c42_1028_0085[] = "Rage 3D LT Pro"; +#endif +static const char pci_device_1002_4c44[] = "3D Rage LT Pro AGP-66"; +static const char pci_device_1002_4c45[] = "Rage Mobility M3 AGP"; +static const char pci_device_1002_4c46[] = "Rage Mobility M3 AGP 2x"; +static const char pci_device_1002_4c47[] = "3D Rage LT-G 215LG"; +static const char pci_device_1002_4c49[] = "3D Rage LT Pro"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c49_1002_0004[] = "Rage LT Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c49_1002_0040[] = "Rage LT Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c49_1002_0044[] = "Rage LT Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c49_1002_4c49[] = "Rage LT Pro"; +#endif +static const char pci_device_1002_4c4d[] = "Rage Mobility P/M AGP 2x"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c4d_0e11_b111[] = "Armada M700"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c4d_1002_0084[] = "Xpert 98 AGP 2X (Mobility)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c4d_1014_0154[] = "ThinkPad A20m"; +#endif +static const char pci_device_1002_4c4e[] = "Rage Mobility L AGP 2x"; +static const char pci_device_1002_4c50[] = "3D Rage LT Pro"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c50_1002_4c50[] = "Rage LT Pro"; +#endif +static const char pci_device_1002_4c51[] = "3D Rage LT Pro"; +static const char pci_device_1002_4c52[] = "Rage Mobility P/M"; +static const char pci_device_1002_4c53[] = "Rage Mobility L"; +static const char pci_device_1002_4c54[] = "264LT [Mach64 LT]"; +static const char pci_device_1002_4c57[] = "Radeon Mobility M7 LW [Radeon Mobility 7500]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c57_1014_0517[] = "ThinkPad T30"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c57_1028_00e6[] = "Radeon Mobility M7 LW (Dell Inspiron 8100)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c57_144d_c006[] = "Radeon Mobility M7 LW in vpr Matrix 170B4"; +#endif +static const char pci_device_1002_4c58[] = "Radeon RV200 LX [Mobility FireGL 7800 M7]"; +static const char pci_device_1002_4c59[] = "Radeon Mobility M6 LY"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c59_1014_0235[] = "ThinkPad A30p (2653-64G)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c59_1014_0239[] = "ThinkPad X22/X23/X24"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_4c59_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +static const char pci_device_1002_4c5a[] = "Radeon Mobility M6 LZ"; +static const char pci_device_1002_4c64[] = "Radeon R250 Ld [Radeon Mobility 9000 M9]"; +static const char pci_device_1002_4c65[] = "Radeon R250 Le [Radeon Mobility 9000 M9]"; +static const char pci_device_1002_4c66[] = "Radeon R250 Lf [Radeon Mobility 9000 M9]"; +static const char pci_device_1002_4c67[] = "Radeon R250 Lg [Radeon Mobility 9000 M9]"; +static const char pci_device_1002_4d46[] = "Rage Mobility M4 AGP"; +static const char pci_device_1002_4d4c[] = "Rage Mobility M4 AGP"; +static const char pci_device_1002_4e44[] = "Radeon R300 ND [Radeon 9700]"; +static const char pci_device_1002_4e45[] = "Radeon R300 NE [Radeon 9700]"; +static const char pci_device_1002_4e46[] = "Radeon R300 NF [Radeon 9700]"; +static const char pci_device_1002_4e47[] = "Radeon R300 NG [FireGL X1]"; +static const char pci_device_1002_4e64[] = "Radeon R300 [Radeon 9700 Pro] (Secondary)"; +static const char pci_device_1002_4e65[] = "Radeon R300 [Radeon 9700] (Secondary)"; +static const char pci_device_1002_4e66[] = "Radeon R300 [Radeon 9700] (Secondary)"; +static const char pci_device_1002_4e67[] = "Radeon R300 [FireGL X1] (Secondary)"; +static const char pci_device_1002_5041[] = "Rage 128 PA/PRO"; +static const char pci_device_1002_5042[] = "Rage 128 PB/PRO AGP 2x"; +static const char pci_device_1002_5043[] = "Rage 128 PC/PRO AGP 4x"; +static const char pci_device_1002_5044[] = "Rage 128 PD/PRO TMDS"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5044_1002_0028[] = "Rage 128 AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5044_1002_0029[] = "Rage 128 AIW"; +#endif +static const char pci_device_1002_5045[] = "Rage 128 PE/PRO AGP 2x TMDS"; +static const char pci_device_1002_5046[] = "Rage 128 PF/PRO AGP 4x TMDS"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_0004[] = "Rage Fury Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_0008[] = "Rage Fury Pro/Xpert 2000 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_0014[] = "Rage Fury Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_0018[] = "Rage Fury Pro/Xpert 2000 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_0028[] = "Rage 128 Pro AIW AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_002a[] = "Rage 128 Pro AIW AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_0048[] = "Rage Fury Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_2000[] = "Rage Fury MAXX AGP 4x (TMDS) (VGA device)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5046_1002_2001[] = "Rage Fury MAXX AGP 4x (TMDS) (Extra device?!)"; +#endif +static const char pci_device_1002_5047[] = "Rage 128 PG/PRO"; +static const char pci_device_1002_5048[] = "Rage 128 PH/PRO AGP 2x"; +static const char pci_device_1002_5049[] = "Rage 128 PI/PRO AGP 4x"; +static const char pci_device_1002_504a[] = "Rage 128 PJ/PRO TMDS"; +static const char pci_device_1002_504b[] = "Rage 128 PK/PRO AGP 2x TMDS"; +static const char pci_device_1002_504c[] = "Rage 128 PL/PRO AGP 4x TMDS"; +static const char pci_device_1002_504d[] = "Rage 128 PM/PRO"; +static const char pci_device_1002_504e[] = "Rage 128 PN/PRO AGP 2x"; +static const char pci_device_1002_504f[] = "Rage 128 PO/PRO AGP 4x"; +static const char pci_device_1002_5050[] = "Rage 128 PP/PRO TMDS [Xpert 128]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5050_1002_0008[] = "Xpert 128"; +#endif +static const char pci_device_1002_5051[] = "Rage 128 PQ/PRO AGP 2x TMDS"; +static const char pci_device_1002_5052[] = "Rage 128 PR/PRO AGP 4x TMDS"; +static const char pci_device_1002_5053[] = "Rage 128 PS/PRO"; +static const char pci_device_1002_5054[] = "Rage 128 PT/PRO AGP 2x"; +static const char pci_device_1002_5055[] = "Rage 128 PU/PRO AGP 4x"; +static const char pci_device_1002_5056[] = "Rage 128 PV/PRO TMDS"; +static const char pci_device_1002_5057[] = "Rage 128 PW/PRO AGP 2x TMDS"; +static const char pci_device_1002_5058[] = "Rage 128 PX/PRO AGP 4x TMDS"; +static const char pci_device_1002_5144[] = "Radeon R100 QD [Radeon 7200]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_0008[] = "Radeon 7000/Radeon VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_0009[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_000a[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_001a[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_0029[] = "Radeon AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_0038[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_0039[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_008a[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_00ba[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_0139[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_028a[] = "Radeon 7000/Radeon"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_02aa[] = "Radeon AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5144_1002_053a[] = "Radeon 7000/Radeon"; +#endif +static const char pci_device_1002_5145[] = "Radeon R100 QE"; +static const char pci_device_1002_5146[] = "Radeon R100 QF"; +static const char pci_device_1002_5147[] = "Radeon R100 QG"; +static const char pci_device_1002_5148[] = "Radeon R200 QH [Radeon 8500]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5148_1002_010a[] = "FireGL 8800 64Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5148_1002_0152[] = "FireGL 8800 128Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5148_1002_0162[] = "FireGL 8700 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5148_1002_0172[] = "FireGL 8700 64Mb"; +#endif +static const char pci_device_1002_5149[] = "Radeon R200 QI"; +static const char pci_device_1002_514a[] = "Radeon R200 QJ"; +static const char pci_device_1002_514b[] = "Radeon R200 QK"; +static const char pci_device_1002_514c[] = "Radeon R200 QL [Radeon 8500 LE]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_514c_1002_003a[] = "Radeon R200 QL [Radeon 8500 LE]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_514c_1002_013a[] = "Radeon 8500"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_514c_148c_2026[] = "R200 QL [Radeon 8500 Evil Master II Multi Display Edition]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_514c_174b_7149[] = "Radeon R200 QL [Sapphire Radeon 8500 LE]"; +#endif +static const char pci_device_1002_514d[] = "Radeon R200 QM [Radeon 9100]"; +static const char pci_device_1002_514e[] = "Radeon R200 QN [Radeon 8500LE]"; +static const char pci_device_1002_514f[] = "Radeon R200 QO [Radeon 8500LE]"; +static const char pci_device_1002_5157[] = "Radeon RV200 QW [Radeon 7500]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_1002_013a[] = "Radeon 7500"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_1458_4000[] = "RV200 QW [RADEON 7500 PRO MAYA AR]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_148c_2024[] = "RV200 QW [Radeon 7500LE Dual Display]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_148c_2025[] = "RV200 QW [Radeon 7500 Evil Master Multi Display Edition]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_148c_2036[] = "RV200 QW [Radeon 7500 PCI Dual Display]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_174b_7147[] = "RV200 QW [Sapphire Radeon 7500LE]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_174b_7161[] = "Radeon RV200 QW [Radeon 7500 LE]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5157_17af_0202[] = "RV200 QW [Excalibur Radeon 7500LE]"; +#endif +static const char pci_device_1002_5158[] = "Radeon RV200 QX [Radeon 7500]"; +static const char pci_device_1002_5159[] = "Radeon RV100 QY [Radeon 7000/VE]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1002_000a[] = "Radeon 7000/Radeon VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1002_000b[] = "Radeon 7000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1002_0038[] = "Radeon 7000/Radeon VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1002_003a[] = "Radeon 7000/Radeon VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1002_00ba[] = "Radeon 7000/Radeon VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1002_013a[] = "Radeon 7000/Radeon VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1458_4002[] = "RV100 QY [RADEON 7000 PRO MAYA AV Series]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_148c_2003[] = "RV100 QY [Radeon 7000 Multi-Display Edition]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_148c_2023[] = "RV100 QY [Radeon 7000 Evil Master Multi-Display]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_174b_7112[] = "RV100 QY [Sapphire Radeon VE 7000]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5159_1787_0202[] = "RV100 QY [Excalibur Radeon 7000]"; +#endif +static const char pci_device_1002_515a[] = "Radeon RV100 QZ [Radeon 7000/VE]"; +static const char pci_device_1002_5168[] = "Radeon R200 Qh"; +static const char pci_device_1002_5169[] = "Radeon R200 Qi"; +static const char pci_device_1002_516a[] = "Radeon R200 Qj"; +static const char pci_device_1002_516b[] = "Radeon R200 Qk"; +static const char pci_device_1002_516c[] = "Radeon R200 Ql"; +static const char pci_device_1002_5245[] = "Rage 128 RE/SG"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5245_1002_0008[] = "Xpert 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5245_1002_0028[] = "Rage 128 AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5245_1002_0029[] = "Rage 128 AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5245_1002_0068[] = "Rage 128 AIW"; +#endif +static const char pci_device_1002_5246[] = "Rage 128 RF/SG AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5246_1002_0004[] = "Magnum/Xpert 128/Xpert 99"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5246_1002_0008[] = "Magnum/Xpert128/X99/Xpert2000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5246_1002_0028[] = "Rage 128 AIW AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5246_1002_0044[] = "Rage Fury/Xpert 128/Xpert 2000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5246_1002_0068[] = "Rage 128 AIW AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5246_1002_0448[] = "Rage Fury"; +#endif +static const char pci_device_1002_5247[] = "Rage 128 RG"; +static const char pci_device_1002_524b[] = "Rage 128 RK/VR"; +static const char pci_device_1002_524c[] = "Rage 128 RL/VR AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_524c_1002_0008[] = "Xpert 99/Xpert 2000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_524c_1002_0088[] = "Xpert 99"; +#endif +static const char pci_device_1002_5345[] = "Rage 128 SE/4x"; +static const char pci_device_1002_5346[] = "Rage 128 SF/4x AGP 2x"; +static const char pci_device_1002_5347[] = "Rage 128 SG/4x AGP 4x"; +static const char pci_device_1002_5348[] = "Rage 128 SH"; +static const char pci_device_1002_534b[] = "Rage 128 SK/4x"; +static const char pci_device_1002_534c[] = "Rage 128 SL/4x AGP 2x"; +static const char pci_device_1002_534d[] = "Rage 128 SM/4x AGP 4x"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_534d_1002_0008[] = "Xpert 99/Xpert 2000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_534d_1002_0018[] = "Xpert 2000"; +#endif +static const char pci_device_1002_534e[] = "Rage 128 4x"; +static const char pci_device_1002_5354[] = "Mach 64 VT"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5354_1002_5654[] = "Mach 64 reference"; +#endif +static const char pci_device_1002_5446[] = "Rage 128 Pro Ultra TF"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_0004[] = "Rage Fury Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_0008[] = "Rage Fury Pro/Xpert 2000 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_0018[] = "Rage Fury Pro/Xpert 2000 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_0028[] = "Rage 128 AIW Pro AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_0029[] = "Rage 128 AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_002a[] = "Rage 128 AIW Pro AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_002b[] = "Rage 128 AIW"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5446_1002_0048[] = "Xpert 2000 Pro"; +#endif +static const char pci_device_1002_544c[] = "Rage 128 Pro Ultra TL"; +static const char pci_device_1002_5452[] = "Rage 128 Pro Ultra TR"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5452_1002_001c[] = "Rage 128 Pro 4XL"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5452_103c_1279[] = "Rage 128 Pro 4XL"; +#endif +static const char pci_device_1002_5453[] = "Rage 128 Pro Ultra TS"; +static const char pci_device_1002_5454[] = "Rage 128 Pro Ultra TT"; +static const char pci_device_1002_5455[] = "Rage 128 Pro Ultra TU"; +static const char pci_device_1002_5654[] = "264VT [Mach64 VT]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1002_5654_1002_5654[] = "Mach64VT Reference"; +#endif +static const char pci_device_1002_5655[] = "264VT3 [Mach64 VT3]"; +static const char pci_device_1002_5656[] = "264VT4 [Mach64 VT4]"; +static const char pci_device_1002_700f[] = "U1/A3 AGP Bridge [IGP 320M]"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1003[] = "ULSI Systems"; +static const char pci_device_1003_0201[] = "US201"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1004[] = "VLSI Technology Inc"; +static const char pci_device_1004_0005[] = "82C592-FC1"; +static const char pci_device_1004_0006[] = "82C593-FC1"; +static const char pci_device_1004_0007[] = "82C594-AFC2"; +static const char pci_device_1004_0008[] = "82C596/7 [Wildcat]"; +static const char pci_device_1004_0009[] = "82C597-AFC2"; +static const char pci_device_1004_000c[] = "82C541 [Lynx]"; +static const char pci_device_1004_000d[] = "82C543 [Lynx]"; +static const char pci_device_1004_0101[] = "82C532"; +static const char pci_device_1004_0102[] = "82C534 [Eagle]"; +static const char pci_device_1004_0103[] = "82C538"; +static const char pci_device_1004_0104[] = "82C535"; +static const char pci_device_1004_0105[] = "82C147"; +static const char pci_device_1004_0200[] = "82C975"; +static const char pci_device_1004_0280[] = "82C925"; +static const char pci_device_1004_0304[] = "QSound ThunderBird PCI Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0304_1004_0304[] = "QSound ThunderBird PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0304_122d_1206[] = "DSP368 Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0304_1483_5020[] = "XWave Thunder 3D Audio"; +#endif +static const char pci_device_1004_0305[] = "QSound ThunderBird PCI Audio Gameport"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0305_1004_0305[] = "QSound ThunderBird PCI Audio Gameport"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0305_122d_1207[] = "DSP368 Audio Gameport"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0305_1483_5021[] = "XWave Thunder 3D Audio Gameport"; +#endif +static const char pci_device_1004_0306[] = "QSound ThunderBird PCI Audio Support Registers"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0306_1004_0306[] = "QSound ThunderBird PCI Audio Support Registers"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0306_122d_1208[] = "DSP368 Audio Support Registers"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1004_0306_1483_5022[] = "XWave Thunder 3D Audio Support Registers"; +#endif +static const char pci_device_1004_0307[] = "Thunderbird"; +static const char pci_device_1004_0308[] = "Thunderbird"; +static const char pci_device_1004_0702[] = "VAS96011 [Golden Gate II]"; +static const char pci_device_1004_0703[] = "Tollgate"; +#endif +static const char pci_vendor_1005[] = "Avance Logic Inc. [ALI]"; +static const char pci_device_1005_2064[] = "ALG2032/2064"; +static const char pci_device_1005_2128[] = "ALG2364A"; +static const char pci_device_1005_2301[] = "ALG2301"; +static const char pci_device_1005_2302[] = "ALG2302"; +static const char pci_device_1005_2364[] = "ALG2364"; +static const char pci_device_1005_2464[] = "ALG2364A"; +static const char pci_device_1005_2501[] = "ALG2564A/25128A"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1006[] = "Reply Group"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1007[] = "NetFrame Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1008[] = "Epson"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_100a[] = "Phoenix Technologies"; +#endif +static const char pci_vendor_100b[] = "National Semiconductor Corporation"; +static const char pci_device_100b_0001[] = "DP83810"; +static const char pci_device_100b_0002[] = "87415/87560 IDE"; +static const char pci_device_100b_000e[] = "87560 Legacy I/O"; +static const char pci_device_100b_000f[] = "FireWire Controller"; +static const char pci_device_100b_0011[] = "NS87560 National PCI System I/O"; +static const char pci_device_100b_0012[] = "USB Controller"; +static const char pci_device_100b_0020[] = "DP83815 (MacPhyter) Ethernet Controller"; +static const char pci_device_100b_0022[] = "DP83820 10/100/1000 Ethernet Controller"; +static const char pci_device_100b_0500[] = "SCx200 Bridge"; +static const char pci_device_100b_0501[] = "SCx200 SMI"; +static const char pci_device_100b_0502[] = "SCx200 IDE"; +static const char pci_device_100b_0503[] = "SCx200 Audio"; +static const char pci_device_100b_0504[] = "SCx200 Video"; +static const char pci_device_100b_0505[] = "SCx200 XBus"; +static const char pci_device_100b_d001[] = "87410 IDE"; +static const char pci_vendor_100c[] = "Tseng Labs Inc"; +static const char pci_device_100c_3202[] = "ET4000/W32p rev A"; +static const char pci_device_100c_3205[] = "ET4000/W32p rev B"; +static const char pci_device_100c_3206[] = "ET4000/W32p rev C"; +static const char pci_device_100c_3207[] = "ET4000/W32p rev D"; +static const char pci_device_100c_3208[] = "ET6000"; +static const char pci_device_100c_4702[] = "ET6300"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_100d[] = "AST Research Inc"; +#endif +static const char pci_vendor_100e[] = "Weitek"; +static const char pci_device_100e_9000[] = "P9000 Viper"; +static const char pci_device_100e_9001[] = "P9000 Viper"; +static const char pci_device_100e_9002[] = "P9000 Viper"; +static const char pci_device_100e_9100[] = "P9100 Viper Pro/SE"; +static const char pci_vendor_1010[] = "Video Logic, Ltd."; +static const char pci_vendor_1011[] = "Digital Equipment Corporation"; +static const char pci_device_1011_0001[] = "DECchip 21050"; +static const char pci_device_1011_0002[] = "DECchip 21040 [Tulip]"; +static const char pci_device_1011_0004[] = "DECchip 21030 [TGA]"; +static const char pci_device_1011_0007[] = "NVRAM [Zephyr NVRAM]"; +static const char pci_device_1011_0008[] = "KZPSA [KZPSA]"; +static const char pci_device_1011_0009[] = "DECchip 21140 [FasterNet]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1025_0310[] = "21140 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_10b8_2001[] = "SMC9332BDT EtherPower 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_10b8_2002[] = "SMC9332BVT EtherPower T4 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_10b8_2003[] = "SMC9334BDT EtherPower 10/100 (1-port)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1109_2400[] = "ANA-6944A/TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1112_2300[] = "RNS2300 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1112_2320[] = "RNS2320 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1112_2340[] = "RNS2340 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1113_1207[] = "EN-1207-TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1186_1100[] = "DFE-500TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1186_1112[] = "DFE-570TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1186_1140[] = "DFE-660 Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1186_1142[] = "DFE-660 Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_11f6_0503[] = "Freedomline Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1282_9100[] = "AEF-380TXD Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_1385_1100[] = "FA310TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0009_2646_0001[] = "KNE100TX Fast Ethernet"; +#endif +static const char pci_device_1011_000a[] = "21230 Video Codec"; +static const char pci_device_1011_000d[] = "PBXGB [TGA2]"; +static const char pci_device_1011_000f[] = "DEFPA"; +static const char pci_device_1011_0014[] = "DECchip 21041 [Tulip Pass 3]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0014_1186_0100[] = "DE-530+"; +#endif +static const char pci_device_1011_0016[] = "DGLPB [OPPO]"; +static const char pci_device_1011_0019[] = "DECchip 21142/43"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1011_500a[] = "DE500A Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1011_500b[] = "DE500B Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1014_0001[] = "10/100 EtherJet Cardbus"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1025_0315[] = "ALN315 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1033_800c[] = "PC-9821-CS01 100BASE-TX Interface Card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1033_800d[] = "PC-9821NR-B06 100BASE-TX Interface Card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_108d_0016[] = "Rapidfire 2327 10/100 Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_108d_0017[] = "GoCard 2250 Ethernet 10/100 Cardbus"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_10b8_2005[] = "SMC8032DT Extreme Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_10b8_8034[] = "SMC8034 Extreme Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_10ef_8169[] = "Cardbus Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1109_2a00[] = "ANA-6911A/TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1109_2b00[] = "ANA-6911A/TXC Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1109_3000[] = "ANA-6922/TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1113_1207[] = "Cheetah Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1113_2220[] = "Cardbus Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_115d_0002[] = "Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1179_0203[] = "Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1179_0204[] = "Cardbus Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1186_1100[] = "DFE-500TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1186_1101[] = "DFE-500TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1186_1102[] = "DFE-500TX Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1259_2800[] = "AT-2800Tx Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1266_0004[] = "Eagle Fast EtherMAX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_12af_0019[] = "NetFlyer Cardbus Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1374_0001[] = "Cardbus Ethernet Card 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1374_0002[] = "Cardbus Ethernet Card 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1374_0007[] = "Cardbus Ethernet Card 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1374_0008[] = "Cardbus Ethernet Card 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1385_2100[] = "FA510"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_1395_0001[] = "10/100 Ethernet CardBus PC Card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_13d1_ab01[] = "EtherFast 10/100 Cardbus (PCMPC200)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0019_8086_0001[] = "EtherExpress PRO/100 Mobile CardBus 32"; +#endif +static const char pci_device_1011_001a[] = "Farallon PN9000SX"; +static const char pci_device_1011_0021[] = "DECchip 21052"; +static const char pci_device_1011_0022[] = "DECchip 21150"; +static const char pci_device_1011_0023[] = "DECchip 21150"; +static const char pci_device_1011_0024[] = "DECchip 21152"; +static const char pci_device_1011_0025[] = "DECchip 21153"; +static const char pci_device_1011_0026[] = "DECchip 21154"; +static const char pci_device_1011_0034[] = "56k Modem Cardbus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0034_1374_0003[] = "56k Modem Cardbus"; +#endif +static const char pci_device_1011_0045[] = "DECchip 21553"; +static const char pci_device_1011_0046[] = "DECchip 21554"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_0e11_4050[] = "Integrated Smart Array"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_0e11_4051[] = "Integrated Smart Array"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_0e11_4058[] = "Integrated Smart Array"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_103c_10c2[] = "Hewlett-Packard NetRAID-4M"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_12d9_000a[] = "VoIP PCI Gateway"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_9005_0365[] = "Adaptec 5400S"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_9005_1364[] = "Dell PowerEdge RAID Controller 2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_9005_1365[] = "Dell PowerEdge RAID Controller 2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_0046_e4bf_1000[] = "CC8-1-BLUES"; +#endif +static const char pci_device_1011_1065[] = "StrongARM DC21285"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1011_1065_1069_0020[] = "DAC960P / DAC1164P"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1012[] = "Micronics Computers Inc"; +#endif +static const char pci_vendor_1013[] = "Cirrus Logic"; +static const char pci_device_1013_0038[] = "GD 7548"; +static const char pci_device_1013_0040[] = "GD 7555 Flat Panel GUI Accelerator"; +static const char pci_device_1013_004c[] = "GD 7556 Video/Graphics LCD/CRT Ctrlr"; +static const char pci_device_1013_00a0[] = "GD 5430/40 [Alpine]"; +static const char pci_device_1013_00a2[] = "GD 5432 [Alpine]"; +static const char pci_device_1013_00a4[] = "GD 5434-4 [Alpine]"; +static const char pci_device_1013_00a8[] = "GD 5434-8 [Alpine]"; +static const char pci_device_1013_00ac[] = "GD 5436 [Alpine]"; +static const char pci_device_1013_00b0[] = "GD 5440"; +static const char pci_device_1013_00b8[] = "GD 5446"; +static const char pci_device_1013_00bc[] = "GD 5480"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_00bc_1013_00bc[] = "CL-GD5480"; +#endif +static const char pci_device_1013_00d0[] = "GD 5462"; +static const char pci_device_1013_00d2[] = "GD 5462 [Laguna I]"; +static const char pci_device_1013_00d4[] = "GD 5464 [Laguna]"; +static const char pci_device_1013_00d5[] = "GD 5464 BD [Laguna]"; +static const char pci_device_1013_00d6[] = "GD 5465 [Laguna]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_00d6_13ce_8031[] = "Barco Metheus 2 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_00d6_13cf_8031[] = "Barco Metheus 2 Megapixel, Dual Head"; +#endif +static const char pci_device_1013_00e8[] = "GD 5436U"; +static const char pci_device_1013_1100[] = "CL 6729"; +static const char pci_device_1013_1110[] = "PD 6832 PCMCIA/CardBus Ctrlr"; +static const char pci_device_1013_1112[] = "PD 6834 PCMCIA/CardBus Ctrlr"; +static const char pci_device_1013_1113[] = "PD 6833 PCMCIA/CardBus Ctrlr"; +static const char pci_device_1013_1200[] = "GD 7542 [Nordic]"; +static const char pci_device_1013_1202[] = "GD 7543 [Viking]"; +static const char pci_device_1013_1204[] = "GD 7541 [Nordic Light]"; +static const char pci_device_1013_4400[] = "CD 4400"; +static const char pci_device_1013_6001[] = "CS 4610/11 [CrystalClear SoundFusion Audio Accelerator]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6001_1014_1010[] = "CS4610 SoundFusion Audio Accelerator"; +#endif +static const char pci_device_1013_6003[] = "CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6003_1013_4280[] = "Crystal SoundFusion PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6003_1681_0050[] = "Game Theater XP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6003_1681_a011[] = "Fortissimo III 7.1"; +#endif +static const char pci_device_1013_6004[] = "CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator]"; +static const char pci_device_1013_6005[] = "Crystal CS4281 PCI Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_1013_4281[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10a8[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10a9[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10aa[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10ab[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10ac[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10ad[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_10cf_10b4[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_1179_0001[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1013_6005_14c0_000c[] = "Crystal CS4281 PCI Audio"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1014[] = "IBM"; +static const char pci_device_1014_0002[] = "PCI to MCA Bridge"; +static const char pci_device_1014_0005[] = "Alta Lite"; +static const char pci_device_1014_0007[] = "Alta MP"; +static const char pci_device_1014_000a[] = "Fire Coral"; +static const char pci_device_1014_0017[] = "CPU to PCI Bridge"; +static const char pci_device_1014_0018[] = "TR Auto LANstreamer"; +static const char pci_device_1014_001b[] = "GXT-150P"; +static const char pci_device_1014_001c[] = "Carrera"; +static const char pci_device_1014_001d[] = "82G2675"; +static const char pci_device_1014_0020[] = "MCA"; +static const char pci_device_1014_0022[] = "IBM27-82351"; +static const char pci_device_1014_002d[] = "Python"; +static const char pci_device_1014_002e[] = "ServeRAID Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_002e_1014_002e[] = "ServeRAID-3x"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_002e_1014_022e[] = "ServeRAID-4H"; +#endif +static const char pci_device_1014_0036[] = "Miami"; +static const char pci_device_1014_003a[] = "CPU to PCI Bridge"; +static const char pci_device_1014_003e[] = "16/4 Token ring UTP/STP controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_003e[] = "Token-Ring Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_00cd[] = "Token-Ring Adapter + Wake-On-LAN"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_00ce[] = "16/4 Token-Ring Adapter 2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_00cf[] = "16/4 Token-Ring Adapter Special"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_00e4[] = "High-Speed 100/16/4 Token-Ring Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_00e5[] = "16/4 Token-Ring Adapter 2 + Wake-On-LAN"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_003e_1014_016d[] = "iSeries 2744 Card"; +#endif +static const char pci_device_1014_0045[] = "SSA Adapter"; +static const char pci_device_1014_0046[] = "MPIC interrupt controller"; +static const char pci_device_1014_0047[] = "PCI to PCI Bridge"; +static const char pci_device_1014_0048[] = "PCI to PCI Bridge"; +static const char pci_device_1014_0049[] = "Warhead SCSI Controller"; +static const char pci_device_1014_004e[] = "ATM Controller (14104e00)"; +static const char pci_device_1014_004f[] = "ATM Controller (14104f00)"; +static const char pci_device_1014_0050[] = "ATM Controller (14105000)"; +static const char pci_device_1014_0053[] = "25 MBit ATM Controller"; +static const char pci_device_1014_0057[] = "MPEG PCI Bridge"; +static const char pci_device_1014_005c[] = "i82557B 10/100"; +static const char pci_device_1014_007c[] = "ATM Controller (14107c00)"; +static const char pci_device_1014_007d[] = "3780IDSP [MWave]"; +static const char pci_device_1014_0090[] = "GXT 3000P"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_0090_1014_008e[] = "GXT-3000P"; +#endif +static const char pci_device_1014_0095[] = "20H2999 PCI Docking Bridge"; +static const char pci_device_1014_0096[] = "Chukar chipset SCSI controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_0096_1014_0097[] = "iSeries 2778 DASD IOA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_0096_1014_0098[] = "iSeries 2763 DASD IOA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_0096_1014_0099[] = "iSeries 2748 DASD IOA"; +#endif +static const char pci_device_1014_00a5[] = "ATM Controller (1410a500)"; +static const char pci_device_1014_00a6[] = "ATM 155MBPS MM Controller (1410a600)"; +static const char pci_device_1014_00b7[] = "256-bit Graphics Rasterizer [Fire GL1]"; +static const char pci_device_1014_00be[] = "ATM 622MBPS Controller (1410be00)"; +static const char pci_device_1014_00dc[] = "Advanced Systems Management Adapter (ASMA)"; +static const char pci_device_1014_00fc[] = "CPC710 Dual Bridge and Memory Controller (PCI-64)"; +static const char pci_device_1014_0105[] = "CPC710 Dual Bridge and Memory Controller (PCI-32)"; +static const char pci_device_1014_010f[] = "Remote Supervisor Adapter (RSA)"; +static const char pci_device_1014_0142[] = "Yotta Video Compositor Input"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_0142_1014_0143[] = "Yotta Input Controller (ytin)"; +#endif +static const char pci_device_1014_0144[] = "Yotta Video Compositor Output"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_0144_1014_0145[] = "Yotta Output Controller (ytout)"; +#endif +static const char pci_device_1014_0156[] = "405GP PLB to PCI Bridge"; +static const char pci_device_1014_01a7[] = "PCI-X to PCI-X Bridge"; +static const char pci_device_1014_01bd[] = "ServeRAID Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_01be[] = "ServeRAID-4M"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_01bf[] = "ServeRAID-4L"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_0208[] = "ServeRAID-4Mx"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_020e[] = "ServeRAID-4Lx"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_022e[] = "ServeRAID-4H"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_0258[] = "ServeRAID-5i"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1014_01bd_1014_0259[] = "ServeRAID-5i"; +#endif +static const char pci_device_1014_0302[] = "XA-32 chipset [Summit]"; +static const char pci_device_1014_ffff[] = "MPIC-2 interrupt controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1015[] = "LSI Logic Corp of Canada"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1016[] = "ICL Personal Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1017[] = "SPEA Software AG"; +static const char pci_device_1017_5343[] = "SPEA 3D Accelerator"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1018[] = "Unisys Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1019[] = "Elitegroup Computer Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_101a[] = "AT&T GIS (NCR)"; +static const char pci_device_101a_0005[] = "100VG ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_101b[] = "Vitesse Semiconductor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_101c[] = "Western Digital"; +static const char pci_device_101c_0193[] = "33C193A"; +static const char pci_device_101c_0196[] = "33C196A"; +static const char pci_device_101c_0197[] = "33C197A"; +static const char pci_device_101c_0296[] = "33C296A"; +static const char pci_device_101c_3193[] = "7193"; +static const char pci_device_101c_3197[] = "7197"; +static const char pci_device_101c_3296[] = "33C296A"; +static const char pci_device_101c_4296[] = "34C296"; +static const char pci_device_101c_9710[] = "Pipeline 9710"; +static const char pci_device_101c_9712[] = "Pipeline 9712"; +static const char pci_device_101c_c24a[] = "90C"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_101e[] = "American Megatrends Inc."; +static const char pci_device_101e_1960[] = "MegaRAID"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_101e_0471[] = "MegaRAID 471 Enterprise 1600 RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_101e_0475[] = "MegaRAID 475 Express 500 RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_101e_0493[] = "MegaRAID 493 Elite 1600 RAID Controller"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_1028_0471[] = "PowerEdge RAID Controller 3/QC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_1028_0475[] = "PowerEdge RAID Controller 3/SC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_1028_0493[] = "PowerEdge RAID Controller 3/DC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_1960_1028_0511[] = "PowerEdge Cost Effective RAID Controller ATA100/4Ch"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_101e_9010[] = "MegaRAID 428 Ultra RAID Controller"; +static const char pci_device_101e_9030[] = "EIDE Controller"; +static const char pci_device_101e_9031[] = "EIDE Controller"; +static const char pci_device_101e_9032[] = "EIDE & SCSI Controller"; +static const char pci_device_101e_9033[] = "SCSI Controller"; +static const char pci_device_101e_9040[] = "Multimedia card"; +static const char pci_device_101e_9060[] = "MegaRAID 434 Ultra GT RAID Controller"; +static const char pci_device_101e_9063[] = "MegaRAC"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_101e_9063_101e_0767[] = "Dell Remote Assistant Card 2"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_101f[] = "PictureTel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1020[] = "Hitachi Computer Products"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1021[] = "OKI Electric Industry Co. Ltd."; +#endif +static const char pci_vendor_1022[] = "Advanced Micro Devices [AMD]"; +static const char pci_device_1022_1100[] = "K8 NorthBridge"; +static const char pci_device_1022_1101[] = "K8 NorthBridge"; +static const char pci_device_1022_1102[] = "K8 NorthBridge"; +static const char pci_device_1022_1103[] = "K8 NorthBridge"; +static const char pci_device_1022_2000[] = "79c970 [PCnet32 LANCE]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_1014_2000[] = "NetFinity 10/100 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_103c_104c[] = "Ethernet with LAN remote power Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_103c_1064[] = "Ethernet with LAN remote power Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_103c_1065[] = "Ethernet with LAN remote power Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_103c_106c[] = "Ethernet with LAN remote power Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_103c_106e[] = "Ethernet with LAN remote power Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_103c_10ea[] = "Ethernet with LAN remote power Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_1113_1220[] = "EN1220 10/100 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_1259_2450[] = "AT-2450 10/100 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_1259_2454[] = "AT-2450v4 10Mb Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_1259_2700[] = "AT-2700TX 10/100 Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2000_1259_2701[] = "AT-2700FX 100Mb Ethernet"; +#endif +static const char pci_device_1022_2001[] = "79c978 [HomePNA]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2001_1092_0a78[] = "Multimedia Home Network Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_2001_1668_0299[] = "ActionLink Home Network Adapter"; +#endif +static const char pci_device_1022_2020[] = "53c974 [PCscsi]"; +static const char pci_device_1022_2040[] = "79c974"; +static const char pci_device_1022_3000[] = "ELanSC520 Microcontroller"; +static const char pci_device_1022_7006[] = "AMD-751 [Irongate] System Controller"; +static const char pci_device_1022_7007[] = "AMD-751 [Irongate] AGP Bridge"; +static const char pci_device_1022_700c[] = "AMD-760 MP [IGD4-2P] System Controller"; +static const char pci_device_1022_700d[] = "AMD-760 MP [IGD4-2P] AGP Bridge"; +static const char pci_device_1022_700e[] = "AMD-760 [IGD4-1P] System Controller"; +static const char pci_device_1022_700f[] = "AMD-760 [IGD4-1P] AGP Bridge"; +static const char pci_device_1022_7400[] = "AMD-755 [Cobra] ISA"; +static const char pci_device_1022_7401[] = "AMD-755 [Cobra] IDE"; +static const char pci_device_1022_7403[] = "AMD-755 [Cobra] ACPI"; +static const char pci_device_1022_7404[] = "AMD-755 [Cobra] USB"; +static const char pci_device_1022_7408[] = "AMD-756 [Viper] ISA"; +static const char pci_device_1022_7409[] = "AMD-756 [Viper] IDE"; +static const char pci_device_1022_740b[] = "AMD-756 [Viper] ACPI"; +static const char pci_device_1022_740c[] = "AMD-756 [Viper] USB"; +static const char pci_device_1022_7410[] = "AMD-766 [ViperPlus] ISA"; +static const char pci_device_1022_7411[] = "AMD-766 [ViperPlus] IDE"; +static const char pci_device_1022_7413[] = "AMD-766 [ViperPlus] ACPI"; +static const char pci_device_1022_7414[] = "AMD-766 [ViperPlus] USB"; +static const char pci_device_1022_7440[] = "AMD-768 [Opus] ISA"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_7440_1043_8044[] = "A7M-D Mainboard"; +#endif +static const char pci_device_1022_7441[] = "AMD-768 [Opus] IDE"; +static const char pci_device_1022_7443[] = "AMD-768 [Opus] ACPI"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1022_7443_1043_8044[] = "A7M-D Mainboard"; +#endif +static const char pci_device_1022_7445[] = "AMD-768 [Opus] Audio"; +static const char pci_device_1022_7446[] = "AMD-768 [Opus] MC97 Modem (Smart Link HAMR5600 compatible)"; +static const char pci_device_1022_7448[] = "AMD-768 [Opus] PCI"; +static const char pci_device_1022_7449[] = "AMD-768 [Opus] USB"; +static const char pci_device_1022_7450[] = "AMD-8131 PCI-X Bridge"; +static const char pci_device_1022_7451[] = "AMD-8131 PCI-X APIC"; +static const char pci_device_1022_7454[] = "AMD-8151 System Controller"; +static const char pci_device_1022_7455[] = "AMD-8151 AGP Bridge"; +static const char pci_device_1022_7460[] = "AMD-8111 PCI"; +static const char pci_device_1022_7461[] = "AMD-8111 USB"; +static const char pci_device_1022_7462[] = "AMD-8111 Ethernet"; +static const char pci_device_1022_7464[] = "AMD-8111 USB"; +static const char pci_device_1022_7468[] = "AMD-8111 LPC"; +static const char pci_device_1022_7469[] = "AMD-8111 IDE"; +static const char pci_device_1022_746a[] = "AMD-8111 SMBus 2.0"; +static const char pci_device_1022_746b[] = "AMD-8111 ACPI"; +static const char pci_device_1022_746d[] = "AMD-8111 AC97 Audio"; +static const char pci_device_1022_746e[] = "AMD-8111 MC97 Modem"; +static const char pci_vendor_1023[] = "Trident Microsystems"; +static const char pci_device_1023_0194[] = "82C194"; +static const char pci_device_1023_2000[] = "4DWave DX"; +static const char pci_device_1023_2001[] = "4DWave NX"; +static const char pci_device_1023_8400[] = "CyberBlade/i7"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_8400_1023_8400[] = "CyberBlade i7 AGP"; +#endif +static const char pci_device_1023_8420[] = "CyberBlade/i7d"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_8420_0e11_b15a[] = "CyberBlade i7 AGP"; +#endif +static const char pci_device_1023_8500[] = "CyberBlade/i1"; +static const char pci_device_1023_8520[] = "CyberBlade i1"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_8520_0e11_b16e[] = "CyberBlade i1 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_8520_1023_8520[] = "CyberBlade i1 AGP"; +#endif +static const char pci_device_1023_8620[] = "CyberBlade/i1"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_8620_1014_0502[] = "ThinkPad T30"; +#endif +static const char pci_device_1023_8820[] = "CyberBlade XPAi1"; +static const char pci_device_1023_9320[] = "TGUI 9320"; +static const char pci_device_1023_9350[] = "GUI Accelerator"; +static const char pci_device_1023_9360[] = "Flat panel GUI Accelerator"; +static const char pci_device_1023_9382[] = "Cyber 9382 [Reference design]"; +static const char pci_device_1023_9383[] = "Cyber 9383 [Reference design]"; +static const char pci_device_1023_9385[] = "Cyber 9385 [Reference design]"; +static const char pci_device_1023_9386[] = "Cyber 9386"; +static const char pci_device_1023_9388[] = "Cyber 9388"; +static const char pci_device_1023_9397[] = "Cyber 9397"; +static const char pci_device_1023_939a[] = "Cyber 9397DVD"; +static const char pci_device_1023_9420[] = "TGUI 9420"; +static const char pci_device_1023_9430[] = "TGUI 9430"; +static const char pci_device_1023_9440[] = "TGUI 9440"; +static const char pci_device_1023_9460[] = "TGUI 9460"; +static const char pci_device_1023_9470[] = "TGUI 9470"; +static const char pci_device_1023_9520[] = "Cyber 9520"; +static const char pci_device_1023_9525[] = "Cyber 9525"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_9525_10cf_1094[] = "Lifebook C6155"; +#endif +static const char pci_device_1023_9540[] = "Cyber 9540"; +static const char pci_device_1023_9660[] = "TGUI 9660/938x/968x"; +static const char pci_device_1023_9680[] = "TGUI 9680"; +static const char pci_device_1023_9682[] = "TGUI 9682"; +static const char pci_device_1023_9683[] = "TGUI 9683"; +static const char pci_device_1023_9685[] = "ProVIDIA 9685"; +static const char pci_device_1023_9750[] = "3DImage 9750"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_9750_1014_9750[] = "3DImage 9750"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_9750_1023_9750[] = "3DImage 9750"; +#endif +static const char pci_device_1023_9753[] = "TGUI 9753"; +static const char pci_device_1023_9754[] = "TGUI 9754"; +static const char pci_device_1023_9759[] = "TGUI 975"; +static const char pci_device_1023_9783[] = "TGUI 9783"; +static const char pci_device_1023_9785[] = "TGUI 9785"; +static const char pci_device_1023_9850[] = "3DImage 9850"; +static const char pci_device_1023_9880[] = "Blade 3D PCI/AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1023_9880_1023_9880[] = "Blade 3D"; +#endif +static const char pci_device_1023_9910[] = "CyberBlade/XP"; +static const char pci_device_1023_9930[] = "CyberBlade/XPm"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1024[] = "Zenith Data Systems"; +#endif +static const char pci_vendor_1025[] = "Acer Incorporated [ALI]"; +static const char pci_device_1025_1435[] = "M1435"; +static const char pci_device_1025_1445[] = "M1445"; +static const char pci_device_1025_1449[] = "M1449"; +static const char pci_device_1025_1451[] = "M1451"; +static const char pci_device_1025_1461[] = "M1461"; +static const char pci_device_1025_1489[] = "M1489"; +static const char pci_device_1025_1511[] = "M1511"; +static const char pci_device_1025_1512[] = "ALI M1512 Aladdin"; +static const char pci_device_1025_1513[] = "M1513"; +static const char pci_device_1025_1521[] = "ALI M1521 Aladdin III CPU Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1025_1521_10b9_1521[] = "ALI M1521 Aladdin III CPU Bridge"; +#endif +static const char pci_device_1025_1523[] = "ALI M1523 ISA Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1025_1523_10b9_1523[] = "ALI M1523 ISA Bridge"; +#endif +static const char pci_device_1025_1531[] = "M1531 Northbridge [Aladdin IV/IV+]"; +static const char pci_device_1025_1533[] = "M1533 PCI-to-ISA Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1025_1533_10b9_1533[] = "ALI M1533 Aladdin IV/V ISA South Bridge"; +#endif +static const char pci_device_1025_1535[] = "M1535 PCI Bridge + Super I/O + FIR"; +static const char pci_device_1025_1541[] = "M1541 Northbridge [Aladdin V]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1025_1541_10b9_1541[] = "ALI M1541 Aladdin V/V+ AGP+PCI North Bridge"; +#endif +static const char pci_device_1025_1542[] = "M1542 Northbridge [Aladdin V]"; +static const char pci_device_1025_1543[] = "M1543 PCI-to-ISA Bridge + Super I/O + FIR"; +static const char pci_device_1025_1561[] = "M1561 Northbridge [Aladdin 7]"; +static const char pci_device_1025_1621[] = "M1621 Northbridge [Aladdin-Pro II]"; +static const char pci_device_1025_1631[] = "M1631 Northbridge+3D Graphics [Aladdin TNT2]"; +static const char pci_device_1025_1641[] = "M1641 Northbridge [Aladdin-Pro IV]"; +static const char pci_device_1025_1647[] = "M1647 [MaGiK1] PCI North Bridge"; +static const char pci_device_1025_3141[] = "M3141"; +static const char pci_device_1025_3143[] = "M3143"; +static const char pci_device_1025_3145[] = "M3145"; +static const char pci_device_1025_3147[] = "M3147"; +static const char pci_device_1025_3149[] = "M3149"; +static const char pci_device_1025_3151[] = "M3151"; +static const char pci_device_1025_3307[] = "M3307 MPEG-I Video Controller"; +static const char pci_device_1025_3309[] = "M3309 MPEG-II Video w/ Software Audio Decoder"; +static const char pci_device_1025_3321[] = "M3321 MPEG-II Audio/Video Decoder"; +static const char pci_device_1025_5212[] = "M4803"; +static const char pci_device_1025_5215[] = "ALI PCI EIDE Controller"; +static const char pci_device_1025_5217[] = "M5217H"; +static const char pci_device_1025_5219[] = "M5219"; +static const char pci_device_1025_5225[] = "M5225"; +static const char pci_device_1025_5229[] = "M5229"; +static const char pci_device_1025_5235[] = "M5235"; +static const char pci_device_1025_5237[] = "M5237 PCI USB Host Controller"; +static const char pci_device_1025_5240[] = "EIDE Controller"; +static const char pci_device_1025_5241[] = "PCMCIA Bridge"; +static const char pci_device_1025_5242[] = "General Purpose Controller"; +static const char pci_device_1025_5243[] = "PCI to PCI Bridge Controller"; +static const char pci_device_1025_5244[] = "Floppy Disk Controller"; +static const char pci_device_1025_5247[] = "M1541 PCI to PCI Bridge"; +static const char pci_device_1025_5251[] = "M5251 P1394 Controller"; +static const char pci_device_1025_5427[] = "PCI to AGP Bridge"; +static const char pci_device_1025_5451[] = "M5451 PCI AC-Link Controller Audio Device"; +static const char pci_device_1025_5453[] = "M5453 PCI AC-Link Controller Modem Device"; +static const char pci_device_1025_7101[] = "M7101 PCI PMU Power Management Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1025_7101_10b9_7101[] = "M7101 PCI PMU Power Management Controller"; +#endif +static const char pci_vendor_1028[] = "Dell Computer Corporation"; +static const char pci_device_1028_0001[] = "PowerEdge Expandable RAID Controller 2/Si"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_0001_1028_0001[] = "PowerEdge Expandable RAID Controller 2/Si"; +#endif +static const char pci_device_1028_0002[] = "PowerEdge Expandable RAID Controller 3"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_0002_1028_0002[] = "PowerEdge Expandable RAID Controller 3/Di"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_0002_1028_00d1[] = "PowerEdge Expandable RAID Controller 3/Di"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_0002_1028_00d9[] = "PowerEdge Expandable RAID Controller 3/Di"; +#endif +static const char pci_device_1028_0003[] = "PowerEdge Expandable RAID Controller 3/Si"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_0003_1028_0003[] = "PowerEdge Expandable RAID Controller 3/Si"; +#endif +static const char pci_device_1028_0004[] = "PowerEdge Expandable RAID Controller 3/Si"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_0004_1028_00d0[] = "PowerEdge Expandable RAID Controller 3/Si"; +#endif +static const char pci_device_1028_0005[] = "PowerEdge Expandable RAID Controller 3/Di"; +static const char pci_device_1028_0006[] = "PowerEdge Expandable RAID Controller 3/Di"; +static const char pci_device_1028_0007[] = "Remote Assistant Card 3"; +static const char pci_device_1028_0008[] = "PowerEdge Expandable RAID Controller 3/Di"; +static const char pci_device_1028_000a[] = "PowerEdge Expandable RAID Controller 3"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_000a_1028_0106[] = "PowerEdge Expandable RAID Controller 3/Di"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_000a_1028_011b[] = "PowerEdge Expandable RAID Controller 3/Di"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1028_000a_1028_0121[] = "PowerEdge Expandable RAID Controller 3/Di"; +#endif +static const char pci_device_1028_000c[] = "Embedded Systems Management Device 4"; +static const char pci_device_1028_000e[] = "PowerEdge Expandable RAID Controller"; +static const char pci_device_1028_000f[] = "PowerEdge Expandable RAID Controller 4/Di"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1029[] = "Siemens Nixdorf IS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_102a[] = "LSI Logic"; +static const char pci_device_102a_0000[] = "HYDRA"; +static const char pci_device_102a_0010[] = "ASPEN"; +#endif +static const char pci_vendor_102b[] = "Matrox Graphics, Inc."; +static const char pci_device_102b_0010[] = "MGA-I [Impression?]"; +static const char pci_device_102b_0518[] = "MGA-II [Athena]"; +static const char pci_device_102b_0519[] = "MGA 2064W [Millennium]"; +static const char pci_device_102b_051a[] = "MGA 1064SG [Mystique]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051a_102b_0100[] = "MGA-1064SG Mystique"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051a_102b_1100[] = "MGA-1084SG Mystique"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051a_102b_1200[] = "MGA-1084SG Mystique"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051a_1100_102b[] = "MGA-1084SG Mystique"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051a_110a_0018[] = "Scenic Pro C5 (D1025)"; +#endif +static const char pci_device_102b_051b[] = "MGA 2164W [Millennium II]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051b_102b_051b[] = "MGA-2164W Millennium II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051b_102b_1100[] = "MGA-2164W Millennium II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_051b_102b_1200[] = "MGA-2164W Millennium II"; +#endif +static const char pci_device_102b_051e[] = "MGA 1064SG [Mystique] AGP"; +static const char pci_device_102b_051f[] = "MGA 2164W [Millennium II] AGP"; +static const char pci_device_102b_0520[] = "MGA G200"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0520_102b_dbc2[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0520_102b_dbc8[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0520_102b_dbe2[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0520_102b_dbe8[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0520_102b_ff03[] = "Millennium G200 SD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0520_102b_ff04[] = "Marvel G200"; +#endif +static const char pci_device_102b_0521[] = "MGA G200 AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_1014_ff03[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_48e9[] = "Mystique G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_48f8[] = "Millennium G200 SD AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_4a60[] = "Millennium G200 LE AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_4a64[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_c93c[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_c9b0[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_c9bc[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_ca60[] = "Millennium G250 LE AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_ca6c[] = "Millennium G250 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbbc[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbc2[] = "Millennium G200 MMS (Dual G200)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbc3[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbc8[] = "Millennium G200 MMS (Dual G200)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbd2[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbd3[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbd4[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbd5[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbd8[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbd9[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbe2[] = "Millennium G200 MMS (Quad G200)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbe3[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbe8[] = "Millennium G200 MMS (Quad G200)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbf2[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbf3[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbf4[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbf5[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbf8[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_dbf9[] = "G200 Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_f806[] = "Mystique G200 Video AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_ff00[] = "MGA-G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_ff02[] = "Mystique G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_ff03[] = "Millennium G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_102b_ff04[] = "Marvel G200 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0521_110a_0032[] = "MGA-G200 AGP"; +#endif +static const char pci_device_102b_0525[] = "MGA G400 AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_0e11_b16f[] = "MGA-G400 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0328[] = "Millennium G400 16Mb SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0338[] = "Millennium G400 16Mb SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0378[] = "Millennium G400 32Mb SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0541[] = "Millennium G450 Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0542[] = "Millennium G450 Dual Head LX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0543[] = "Millennium G450 Single Head LX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0641[] = "Millennium G450 32Mb SDRAM Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0642[] = "Millennium G450 32Mb SDRAM Dual Head LX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0643[] = "Millennium G450 32Mb SDRAM Single Head LX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_07c0[] = "Millennium G450 Dual Head LE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_07c1[] = "Millennium G450 SDR Dual Head LE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0d41[] = "Millennium G450 Dual Head PCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0d42[] = "Millennium G450 Dual Head LX PCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0e00[] = "Marvel G450 eTV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0e01[] = "Marvel G450 eTV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0e02[] = "Marvel G450 eTV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0e03[] = "Marvel G450 eTV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0f80[] = "Millennium G450 Low Profile"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0f81[] = "Millennium G450 Low Profile"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0f82[] = "Millennium G450 Low Profile DVI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_0f83[] = "Millennium G450 Low Profile DVI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_19d8[] = "Millennium G400 16Mb SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_19f8[] = "Millennium G400 32Mb SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_2159[] = "Millennium G400 Dual Head 16Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_2179[] = "Millennium G400 MAX/Dual Head 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_217d[] = "Millennium G400 Dual Head Max"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_23c0[] = "Millennium G450"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_23c1[] = "Millennium G450"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_23c2[] = "Millennium G450 DVI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_23c3[] = "Millennium G450 DVI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_2f58[] = "Millennium G400"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_2f78[] = "Millennium G400"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_3693[] = "Marvel G400 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_5dd0[] = "4Sight II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_5f50[] = "4Sight II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_5f51[] = "4Sight II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_5f52[] = "4Sight II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_102b_9010[] = "Millennium G400 Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_1458_0400[] = "GA-G400"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_1705_0001[] = "Millennium G450 32MB SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_1705_0002[] = "Millennium G450 16MB SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_1705_0003[] = "Millennium G450 32MB"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0525_1705_0004[] = "Millennium G450 16MB"; +#endif +static const char pci_device_102b_0527[] = "MGA Parhelia AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_0527_102b_0840[] = "Parhelia 128Mb"; +#endif +static const char pci_device_102b_0d10[] = "MGA Ultima/Impression"; +static const char pci_device_102b_1000[] = "MGA G100 [Productiva]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1000_102b_ff01[] = "Productiva G100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1000_102b_ff05[] = "Productiva G100 Multi-Monitor"; +#endif +static const char pci_device_102b_1001[] = "MGA G100 [Productiva] AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_102b_1001[] = "MGA-G100 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_102b_ff00[] = "MGA-G100 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_102b_ff01[] = "MGA-G100 Productiva AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_102b_ff03[] = "Millennium G100 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_102b_ff04[] = "MGA-G100 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_102b_ff05[] = "MGA-G100 Productiva AGP Multi-Monitor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_1001_110a_001e[] = "MGA-G100 AGP"; +#endif +static const char pci_device_102b_2007[] = "MGA Mistral"; +static const char pci_device_102b_2527[] = "MGA G550 AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_2527_102b_0f83[] = "Millennium G550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_2527_102b_0f84[] = "Millennium G550 Dual Head DDR 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102b_2527_102b_1e41[] = "Millennium G550"; +#endif +static const char pci_device_102b_4536[] = "VIA Framegrabber"; +static const char pci_device_102b_6573[] = "Shark 10/100 Multiport SwitchNIC"; +static const char pci_vendor_102c[] = "Chips and Technologies"; +static const char pci_device_102c_00b8[] = "F64310"; +static const char pci_device_102c_00c0[] = "F69000 HiQVideo"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102c_00c0_102c_00c0[] = "F69000 HiQVideo"; +#endif +static const char pci_device_102c_00d0[] = "F65545"; +static const char pci_device_102c_00d8[] = "F65545"; +static const char pci_device_102c_00dc[] = "F65548"; +static const char pci_device_102c_00e0[] = "F65550"; +static const char pci_device_102c_00e4[] = "F65554"; +static const char pci_device_102c_00e5[] = "F65555 HiQVPro"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102c_00e5_0e11_b049[] = "Armada 1700 Laptop Display Controller"; +#endif +static const char pci_device_102c_00f0[] = "F68554"; +static const char pci_device_102c_00f4[] = "F68554 HiQVision"; +static const char pci_device_102c_00f5[] = "F68555"; +static const char pci_device_102c_0c30[] = "F69030"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_102d[] = "Wyse Technology Inc."; +static const char pci_device_102d_50dc[] = "3328 Audio"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_102e[] = "Olivetti Advanced Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_102f[] = "Toshiba America"; +static const char pci_device_102f_0009[] = "r4x00"; +static const char pci_device_102f_0020[] = "ATM Meteor 155"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_102f_0020_102f_00f8[] = "ATM Meteor 155"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1030[] = "TMC Research"; +#endif +static const char pci_vendor_1031[] = "Miro Computer Products AG"; +static const char pci_device_1031_5601[] = "DC20 ASIC"; +static const char pci_device_1031_5607[] = "Video I/O & motion JPEG compressor"; +static const char pci_device_1031_5631[] = "Media 3D"; +static const char pci_device_1031_6057[] = "MiroVideo DC10/DC30+"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1032[] = "Compaq"; +#endif +static const char pci_vendor_1033[] = "NEC Corporation"; +static const char pci_device_1033_0001[] = "PCI to 486-like bus Bridge"; +static const char pci_device_1033_0002[] = "PCI to VL98 Bridge"; +static const char pci_device_1033_0003[] = "ATM Controller"; +static const char pci_device_1033_0004[] = "R4000 PCI Bridge"; +static const char pci_device_1033_0005[] = "PCI to 486-like bus Bridge"; +static const char pci_device_1033_0006[] = "PC-9800 Graphic Accelerator"; +static const char pci_device_1033_0007[] = "PCI to UX-Bus Bridge"; +static const char pci_device_1033_0008[] = "PC-9800 Graphic Accelerator"; +static const char pci_device_1033_0009[] = "PCI to PC9800 Core-Graph Bridge"; +static const char pci_device_1033_0016[] = "PCI to VL Bridge"; +static const char pci_device_1033_001a[] = "[Nile II]"; +static const char pci_device_1033_0021[] = "Vrc4373 [Nile I]"; +static const char pci_device_1033_0029[] = "PowerVR PCX1"; +static const char pci_device_1033_002a[] = "PowerVR 3D"; +static const char pci_device_1033_002c[] = "Star Alpha 2"; +static const char pci_device_1033_002d[] = "PCI to C-bus Bridge"; +static const char pci_device_1033_0035[] = "USB"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0035_1179_0001[] = "USB"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0035_12ee_7000[] = "Root Hub"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0035_1799_0001[] = "Root Hub"; +#endif +static const char pci_device_1033_003b[] = "PCI to C-bus Bridge"; +static const char pci_device_1033_003e[] = "NAPCCARD Cardbus Controller"; +static const char pci_device_1033_0046[] = "PowerVR PCX2 [midas]"; +static const char pci_device_1033_005a[] = "Vrc5074 [Nile 4]"; +static const char pci_device_1033_0063[] = "Firewarden"; +static const char pci_device_1033_0067[] = "PowerVR Neon 250 Chipset"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_0020[] = "PowerVR Neon 250 AGP 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_0080[] = "PowerVR Neon 250 AGP 16Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_0088[] = "PowerVR Neon 250 16Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_0090[] = "PowerVR Neon 250 AGP 16Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_0098[] = "PowerVR Neon 250 16Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_00a0[] = "PowerVR Neon 250 AGP 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_00a8[] = "PowerVR Neon 250 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0067_1010_0120[] = "PowerVR Neon 250 AGP 32Mb"; +#endif +static const char pci_device_1033_0074[] = "56k Voice Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_0074_1033_8014[] = "RCV56ACF 56k Voice Modem"; +#endif +static const char pci_device_1033_009b[] = "Vrc5476"; +static const char pci_device_1033_00a6[] = "VRC5477 AC97"; +static const char pci_device_1033_00cd[] = "IEEE 1394 [OrangeLink] Host Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_00cd_12ee_8011[] = "Root hub"; +#endif +static const char pci_device_1033_00e0[] = "USB 2.0"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_00e0_12ee_7001[] = "Root hub"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1033_00e0_1799_0002[] = "Root Hub"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1034[] = "Framatome Connectors USA Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1035[] = "Comp. & Comm. Research Lab"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1036[] = "Future Domain Corp."; +static const char pci_device_1036_0000[] = "TMC-18C30 [36C70]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1037[] = "Hitachi Micro Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1038[] = "AMP, Inc"; +#endif +static const char pci_vendor_1039[] = "Silicon Integrated Systems [SiS]"; +static const char pci_device_1039_0001[] = "SiS 530 Virtual PCI-to-PCI bridge (AGP)"; +static const char pci_device_1039_0002[] = "SG86C202"; +static const char pci_device_1039_0006[] = "85C501/2/3"; +static const char pci_device_1039_0008[] = "85C503/5513"; +static const char pci_device_1039_0009[] = "ACPI"; +static const char pci_device_1039_0018[] = "SiS85C503/5513 (LPC Bridge)"; +static const char pci_device_1039_0200[] = "5597/5598/6326 VGA"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_0200_1039_0000[] = "SiS5597 SVGA (Shared RAM)"; +#endif +static const char pci_device_1039_0204[] = "82C204"; +static const char pci_device_1039_0205[] = "SG86C205"; +static const char pci_device_1039_0300[] = "SiS300/305 PCI/AGP VGA Display Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_0300_107d_2720[] = "Leadtek WinFast VR300"; +#endif +static const char pci_device_1039_0310[] = "SiS315H PCI/AGP VGA Display Adapter"; +static const char pci_device_1039_0315[] = "SiS315 PCI/AGP VGA Display Adapter"; +static const char pci_device_1039_0325[] = "SiS315PRO PCI/AGP VGA Display Adapter"; +static const char pci_device_1039_0330[] = "SiS330 [Xabre] PCI/AGP VGA Display Adapter"; +static const char pci_device_1039_0406[] = "85C501/2"; +static const char pci_device_1039_0496[] = "85C496"; +static const char pci_device_1039_0530[] = "530 Host"; +static const char pci_device_1039_0540[] = "540 Host"; +static const char pci_device_1039_0597[] = "5513C"; +static const char pci_device_1039_0601[] = "85C601"; +static const char pci_device_1039_0620[] = "620 Host"; +static const char pci_device_1039_0630[] = "630 Host"; +static const char pci_device_1039_0633[] = "633 Host"; +static const char pci_device_1039_0635[] = "635 Host"; +static const char pci_device_1039_0645[] = "SiS645 Host & Memory & AGP Controller"; +static const char pci_device_1039_0646[] = "SiS645DX Host & Memory & AGP Controller"; +static const char pci_device_1039_0650[] = "650 Host"; +static const char pci_device_1039_0651[] = "SiS651 Host"; +static const char pci_device_1039_0730[] = "730 Host"; +static const char pci_device_1039_0733[] = "733 Host"; +static const char pci_device_1039_0735[] = "735 Host"; +static const char pci_device_1039_0740[] = "740 Host"; +static const char pci_device_1039_0745[] = "745 Host"; +static const char pci_device_1039_0900[] = "SiS900 10/100 Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_0900_1039_0900[] = "SiS900 10/100 Ethernet Adapter"; +#endif +static const char pci_device_1039_0961[] = "SiS961 [MuTIOL Media IO]"; +static const char pci_device_1039_0962[] = "SiS962 [MuTIOL Media IO]"; +static const char pci_device_1039_3602[] = "83C602"; +static const char pci_device_1039_5107[] = "5107"; +static const char pci_device_1039_5300[] = "SiS540 PCI Display Adapter"; +static const char pci_device_1039_5315[] = "SiS550 AGP/VGA VGA Display Adapter"; +static const char pci_device_1039_5401[] = "486 PCI Chipset"; +static const char pci_device_1039_5511[] = "5511/5512"; +static const char pci_device_1039_5513[] = "5513 [IDE]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_5513_1019_0970[] = "P6STP-FL motherboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_5513_1039_5513[] = "SiS5513 EIDE Controller (A,B step)"; +#endif +static const char pci_device_1039_5517[] = "5517"; +static const char pci_device_1039_5571[] = "5571"; +static const char pci_device_1039_5581[] = "5581 Pentium Chipset"; +static const char pci_device_1039_5582[] = "5582"; +static const char pci_device_1039_5591[] = "5591/5592 Host"; +static const char pci_device_1039_5596[] = "5596 Pentium Chipset"; +static const char pci_device_1039_5597[] = "5597 [SiS5582]"; +static const char pci_device_1039_5600[] = "5600 Host"; +static const char pci_device_1039_6204[] = "Video decoder & MPEG interface"; +static const char pci_device_1039_6205[] = "VGA Controller"; +static const char pci_device_1039_6236[] = "6236 3D-AGP"; +static const char pci_device_1039_6300[] = "SiS630 GUI Accelerator+3D"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6300_1019_0970[] = "P6STP-FL motherboard"; +#endif +static const char pci_device_1039_6306[] = "SiS530 3D PCI/AGP"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6306_1039_6306[] = "SiS530,620 GUI Accelerator+3D"; +#endif +static const char pci_device_1039_6325[] = "SiS650/651/M650/740 PCI/AGP VGA Display Adapter"; +static const char pci_device_1039_6326[] = "86C326 5598/6326"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6326_1039_6326[] = "SiS6326 GUI Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6326_1092_0a50[] = "SpeedStar A50"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6326_1092_0a70[] = "SpeedStar A70"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6326_1092_4910[] = "SpeedStar A70"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6326_1092_4920[] = "SpeedStar A70"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_6326_1569_6326[] = "SiS6326 GUI Accelerator"; +#endif +static const char pci_device_1039_7001[] = "SiS7001 USB Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7001_1039_7000[] = "Onboard USB Controller"; +#endif +static const char pci_device_1039_7002[] = "SiS7002 USB 2.0"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7002_1509_7002[] = "Onboard USB Controller"; +#endif +static const char pci_device_1039_7007[] = "FireWire Controller"; +static const char pci_device_1039_7012[] = "SiS7012 PCI Audio Accelerator"; +static const char pci_device_1039_7013[] = "Intel 537 [56k Winmodem]"; +static const char pci_device_1039_7016[] = "SiS7016 10/100 Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7016_1039_7016[] = "SiS7016 10/100 Ethernet Adapter"; +#endif +static const char pci_device_1039_7018[] = "SiS PCI Audio Accelerator"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1014_01b6[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1014_01b7[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1019_7018[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1025_000e[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1025_0018[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1039_7018[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1043_800b[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1054_7018[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_107d_5330[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_107d_5350[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1170_3209[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1462_400a[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_14a4_2089[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_14cd_2194[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_14ff_1100[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_152d_8808[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1558_1103[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1558_2200[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_1563_7018[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_15c5_0111[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_270f_a171[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1039_7018_a0a0_0022[] = "SiS PCI Audio Accelerator"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_103a[] = "Seiko Epson Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_103b[] = "Tatung Co. of America"; +#endif +static const char pci_vendor_103c[] = "Hewlett-Packard Company"; +static const char pci_device_103c_1005[] = "A4977A Visualize EG"; +static const char pci_device_103c_1006[] = "Visualize FX6"; +static const char pci_device_103c_1008[] = "Visualize FX4"; +static const char pci_device_103c_100a[] = "Visualize FX2"; +static const char pci_device_103c_1028[] = "Tach TL Fibre Channel Host Adapter"; +static const char pci_device_103c_1029[] = "Tach XL2 Fibre Channel Host Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1029_107e_000f[] = "Interphase 5560 Fibre Channel Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1029_9004_9210[] = "1Gb/2Gb Family Fibre Channel Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1029_9004_9211[] = "1Gb/2Gb Family Fibre Channel Controller"; +#endif +static const char pci_device_103c_102a[] = "Tach TS Fibre Channel Host Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_102a_107e_000e[] = "Interphase 5540/5541 Fibre Channel Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_102a_9004_9110[] = "1Gb/2Gb Family Fibre Channel Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_102a_9004_9111[] = "1Gb/2Gb Family Fibre Channel Controller"; +#endif +static const char pci_device_103c_1030[] = "J2585A DeskDirect 10/100VG NIC"; +static const char pci_device_103c_1031[] = "J2585B HP 10/100VG PCI LAN Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1031_103c_1040[] = "J2973A DeskDirect 10BaseT NIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1031_103c_1041[] = "J2585B DeskDirect 10/100VG NIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1031_103c_1042[] = "J2970A DeskDirect 10BaseT/2 NIC"; +#endif +static const char pci_device_103c_1040[] = "J2973A DeskDirect 10BaseT NIC"; +static const char pci_device_103c_1041[] = "J2585B DeskDirect 10/100 NIC"; +static const char pci_device_103c_1042[] = "J2970A DeskDirect 10BaseT/2 NIC"; +static const char pci_device_103c_1048[] = "Diva Serial [GSP] Multiport UART"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_1049[] = "Tosca Console"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_104a[] = "Tosca Secondary"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_104b[] = "Maestro SP2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_1223[] = "Halfdome Console"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_1226[] = "Keystone SP2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_1227[] = "Powerbar SP2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_103c_1048_103c_1282[] = "Everest SP2"; +#endif +static const char pci_device_103c_1064[] = "79C970 PCnet Ethernet Controller"; +static const char pci_device_103c_108b[] = "Visualize FXe"; +static const char pci_device_103c_10c1[] = "NetServer Smart IRQ Router"; +static const char pci_device_103c_10ed[] = "TopTools Remote Control"; +static const char pci_device_103c_1200[] = "82557B 10/100 NIC"; +static const char pci_device_103c_1219[] = "NetServer PCI Hot-Plug Controller"; +static const char pci_device_103c_121a[] = "NetServer SMIC Controller"; +static const char pci_device_103c_121b[] = "NetServer Legacy COM Port Decoder"; +static const char pci_device_103c_121c[] = "NetServer PCI COM Port Decoder"; +static const char pci_device_103c_1229[] = "zx1 System Bus Adapter"; +static const char pci_device_103c_122a[] = "zx1 I/O Controller"; +static const char pci_device_103c_122e[] = "zx1 Local Bus Adapter"; +static const char pci_device_103c_1290[] = "Auxiliary Diva Serial Port"; +static const char pci_device_103c_2910[] = "E2910A PCIBus Exerciser"; +static const char pci_device_103c_2925[] = "E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_103e[] = "Solliday Engineering"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_103f[] = "Synopsys/Logic Modeling Group"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1040[] = "Accelgraphics Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1041[] = "Computrend"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1042[] = "Micron"; +static const char pci_device_1042_1000[] = "FDC 37C665"; +static const char pci_device_1042_1001[] = "37C922"; +static const char pci_device_1042_3000[] = "Samurai_0"; +static const char pci_device_1042_3010[] = "Samurai_1"; +static const char pci_device_1042_3020[] = "Samurai_IDE"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1043[] = "Asustek Computer, Inc."; +static const char pci_device_1043_0675[] = "ISDNLink P-IN100-ST-D"; +static const char pci_device_1043_4021[] = "v7100 Combo Deluxe [GeForce2 MX + TV tuner]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1044[] = "Distributed Processing Technology"; +static const char pci_device_1044_1012[] = "Domino RAID Engine"; +static const char pci_device_1044_a400[] = "SmartCache/Raid I-IV Controller"; +static const char pci_device_1044_a500[] = "PCI Bridge"; +static const char pci_device_1044_a501[] = "SmartRAID V Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c001[] = "PM1554U2 Ultra2 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c002[] = "PM1654U2 Ultra2 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c003[] = "PM1564U3 Ultra3 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c004[] = "PM1564U3 Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c005[] = "PM1554U2 Ultra2 Single Channel (NON ACPI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c00a[] = "PM2554U2 Ultra2 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c00b[] = "PM2654U2 Ultra2 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c00c[] = "PM2664U3 Ultra3 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c00d[] = "PM2664U3 Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c00e[] = "PM2554U2 Ultra2 Single Channel (NON ACPI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c00f[] = "PM2654U2 Ultra2 Single Channel (NON ACPI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c014[] = "PM3754U2 Ultra2 Single Channel (NON ACPI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c015[] = "PM3755U2B Ultra2 Single Channel (NON ACPI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c016[] = "PM3755F Fibre Channel (NON ACPI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c01e[] = "PM3757U2 Ultra2 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c01f[] = "PM3757U2 Ultra2 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c020[] = "PM3767U3 Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c021[] = "PM3767U3 Ultra3 Quad Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c028[] = "PM2865U3 Ultra3 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c029[] = "PM2865U3 Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c02a[] = "PM2865F Fibre Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c03c[] = "2000S Ultra3 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c03d[] = "2000S Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c03e[] = "2000F Fibre Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c046[] = "3000S Ultra3 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c047[] = "3000S Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c048[] = "3000F Fibre Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c050[] = "5000S Ultra3 Single Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c051[] = "5000S Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c052[] = "5000F Fibre Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c05a[] = "2400A UDMA Four Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c05b[] = "2400A UDMA Four Channel DAC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c064[] = "3010S Ultra3 Dual Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c065[] = "3010S Ultra3 Four Channel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1044_a501_1044_c066[] = "3010S Fibre Channel"; +#endif +static const char pci_device_1044_a511[] = "SmartRAID V Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1045[] = "OPTi Inc."; +static const char pci_device_1045_a0f8[] = "82C750 [Vendetta] USB Controller"; +static const char pci_device_1045_c101[] = "92C264"; +static const char pci_device_1045_c178[] = "92C178"; +static const char pci_device_1045_c556[] = "82X556 [Viper]"; +static const char pci_device_1045_c557[] = "82C557 [Viper-M]"; +static const char pci_device_1045_c558[] = "82C558 [Viper-M ISA+IDE]"; +static const char pci_device_1045_c567[] = "82C750 [Vendetta], device 0"; +static const char pci_device_1045_c568[] = "82C750 [Vendetta], device 1"; +static const char pci_device_1045_c569[] = "82C579 [Viper XPress+ Chipset]"; +static const char pci_device_1045_c621[] = "82C621 [Viper-M/N+]"; +static const char pci_device_1045_c700[] = "82C700 [FireStar]"; +static const char pci_device_1045_c701[] = "82C701 [FireStar Plus]"; +static const char pci_device_1045_c814[] = "82C814 [Firebridge 1]"; +static const char pci_device_1045_c822[] = "82C822"; +static const char pci_device_1045_c824[] = "82C824"; +static const char pci_device_1045_c825[] = "82C825 [Firebridge 2]"; +static const char pci_device_1045_c832[] = "82C832"; +static const char pci_device_1045_c861[] = "82C861"; +static const char pci_device_1045_c895[] = "82C895"; +static const char pci_device_1045_c935[] = "EV1935 ECTIVA MachOne PCI Audio"; +static const char pci_device_1045_d568[] = "82C825 [Firebridge 2]"; +static const char pci_device_1045_d721[] = "IDE [FireStar]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1046[] = "IPC Corporation, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1047[] = "Genoa Systems Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1048[] = "Elsa AG"; +static const char pci_device_1048_0d22[] = "Quadro4 900XGL [ELSA GLoria4 900XGL]"; +static const char pci_device_1048_1000[] = "QuickStep 1000"; +static const char pci_device_1048_3000[] = "QuickStep 3000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1049[] = "Fountain Technologies, Inc."; +#endif +static const char pci_vendor_104a[] = "SGS Thomson Microelectronics"; +static const char pci_device_104a_0008[] = "STG 2000X"; +static const char pci_device_104a_0009[] = "STG 1764X"; +static const char pci_device_104a_0010[] = "STG4000 [3D Prophet Kyro Series]"; +static const char pci_device_104a_0210[] = "STPC Atlas ISA Bridge"; +static const char pci_device_104a_0981[] = "DEC-Tulip compatible 10/100 Ethernet"; +static const char pci_device_104a_1746[] = "STG 1764X"; +static const char pci_device_104a_2774[] = "DEC-Tulip compatible 10/100 Ethernet"; +static const char pci_device_104a_3520[] = "MPEG-II decoder card"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_104b[] = "BusLogic"; +static const char pci_device_104b_0140[] = "BT-946C (old) [multimaster 01]"; +static const char pci_device_104b_1040[] = "BT-946C (BA80C30) [MultiMaster 10]"; +static const char pci_device_104b_8130[] = "Flashpoint LT"; +#endif +static const char pci_vendor_104c[] = "Texas Instruments"; +static const char pci_device_104c_0500[] = "100 MBit LAN Controller"; +static const char pci_device_104c_0508[] = "TMS380C2X Compressor Interface"; +static const char pci_device_104c_1000[] = "Eagle i/f AS"; +static const char pci_device_104c_104c[] = "PCI1510 PC card Cardbus Controller"; +static const char pci_device_104c_3d04[] = "TVP4010 [Permedia]"; +static const char pci_device_104c_3d07[] = "TVP4020 [Permedia 2]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1011_4d10[] = "Comet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1040_000f[] = "AccelStar II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1040_0011[] = "AccelStar II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1048_0a31[] = "WINNER 2000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1048_0a32[] = "GLoria Synergy"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1048_0a35[] = "GLoria Synergy"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_107d_2633[] = "WinFast 3D L2300"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0127[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0136[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0141[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0146[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0148[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0149[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0152[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0154[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0155[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0156[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1092_0157[] = "FIRE GL 1000 PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1097_3d01[] = "Jeronimo Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_1102_100f[] = "Graphics Blaster Extreme"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_3d07_3d3d_0100[] = "Reference Permedia 2 3D"; +#endif +static const char pci_device_104c_8000[] = "PCILynx/PCILynx2 IEEE 1394 Link Layer Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8000_e4bf_1010[] = "CF1-1-SNARE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8000_e4bf_1020[] = "CF1-2-SNARE"; +#endif +static const char pci_device_104c_8009[] = "FireWire Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8009_104d_8032[] = "8032 OHCI i.LINK (IEEE 1394) Controller"; +#endif +static const char pci_device_104c_8017[] = "PCI4410 FireWire Controller"; +static const char pci_device_104c_8019[] = "TSB12LV23 IEEE-1394 Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8019_11bd_000a[] = "Studio DV500-1394"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8019_11bd_000e[] = "Studio DV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8019_e4bf_1010[] = "CF2-1-CYMBAL"; +#endif +static const char pci_device_104c_8020[] = "TSB12LV26 IEEE-1394 Controller (Link)"; +static const char pci_device_104c_8021[] = "TSB43AA22 IEEE-1394 Controller (PHY/Link Integrated)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8021_104d_80df[] = "Vaio PCG-FX403"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8021_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +static const char pci_device_104c_8022[] = "TSB43AB22 IEEE-1394a-2000 Controller (PHY/Link)"; +static const char pci_device_104c_8023[] = "TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)"; +static const char pci_device_104c_8024[] = "TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)"; +static const char pci_device_104c_8026[] = "TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link)"; +static const char pci_device_104c_8027[] = "PCI4451 IEEE-1394 Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_8027_1028_00e6[] = "PCI4451 IEEE-1394 Controller (Dell Inspiron 8100)"; +#endif +static const char pci_device_104c_8400[] = "ACX 100 22Mbps Wireless Interface"; +static const char pci_device_104c_a001[] = "TDC1570"; +static const char pci_device_104c_a100[] = "TDC1561"; +static const char pci_device_104c_a102[] = "TNETA1575 HyperSAR Plus w/PCI Host i/f & UTOPIA i/f"; +static const char pci_device_104c_a106[] = "TMS320C6205"; +static const char pci_device_104c_ac10[] = "PCI1050"; +static const char pci_device_104c_ac11[] = "PCI1053"; +static const char pci_device_104c_ac12[] = "PCI1130"; +static const char pci_device_104c_ac13[] = "PCI1031"; +static const char pci_device_104c_ac15[] = "PCI1131"; +static const char pci_device_104c_ac16[] = "PCI1250"; +static const char pci_device_104c_ac17[] = "PCI1220"; +static const char pci_device_104c_ac18[] = "PCI1260"; +static const char pci_device_104c_ac19[] = "PCI1221"; +static const char pci_device_104c_ac1a[] = "PCI1210"; +static const char pci_device_104c_ac1b[] = "PCI1450"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_ac1b_0e11_b113[] = "Armada M700"; +#endif +static const char pci_device_104c_ac1c[] = "PCI1225"; +static const char pci_device_104c_ac1d[] = "PCI1251A"; +static const char pci_device_104c_ac1e[] = "PCI1211"; +static const char pci_device_104c_ac1f[] = "PCI1251B"; +static const char pci_device_104c_ac20[] = "TI 2030"; +static const char pci_device_104c_ac21[] = "PCI2031"; +static const char pci_device_104c_ac22[] = "PCI2032 PCI Docking Bridge"; +static const char pci_device_104c_ac23[] = "PCI2250 PCI-to-PCI Bridge"; +static const char pci_device_104c_ac28[] = "PCI2050 PCI-to-PCI Bridge"; +static const char pci_device_104c_ac30[] = "PCI1260 PC card Cardbus Controller"; +static const char pci_device_104c_ac40[] = "PCI4450 PC card Cardbus Controller"; +static const char pci_device_104c_ac41[] = "PCI4410 PC card Cardbus Controller"; +static const char pci_device_104c_ac42[] = "PCI4451 PC card Cardbus Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_ac42_1028_00e6[] = "PCI4451 PC card CardBus Controller (Dell Inspiron 8100)"; +#endif +static const char pci_device_104c_ac50[] = "PCI1410 PC card Cardbus Controller"; +static const char pci_device_104c_ac51[] = "PCI1420"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_ac51_1014_023b[] = "ThinkPad T23 (2647-4MG)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_ac51_10cf_1095[] = "Lifebook C6155"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_ac51_e4bf_1000[] = "CP2-2-HIPHOP"; +#endif +static const char pci_device_104c_ac52[] = "PCI1451 PC card Cardbus Controller"; +static const char pci_device_104c_ac53[] = "PCI1421 PC card Cardbus Controller"; +static const char pci_device_104c_ac55[] = "PCI1250 PC card Cardbus Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_104c_ac55_1014_0512[] = "ThinkPad T30"; +#endif +static const char pci_device_104c_ac56[] = "PCI1510 PC card Cardbus Controller"; +static const char pci_device_104c_ac60[] = "PCI2040 PCI to DSP Bridge Controller"; +static const char pci_device_104c_fe00[] = "FireWire Host Controller"; +static const char pci_device_104c_fe03[] = "12C01A FireWire Host Controller"; +static const char pci_vendor_104d[] = "Sony Corporation"; +static const char pci_device_104d_8009[] = "CXD1947Q i.LINK Controller"; +static const char pci_device_104d_8039[] = "CXD3222 i.LINK Controller"; +static const char pci_device_104d_8056[] = "Rockwell HCF 56K modem"; +static const char pci_device_104d_808a[] = "Memory Stick Controller"; +static const char pci_vendor_104e[] = "Oak Technology, Inc"; +static const char pci_device_104e_0017[] = "OTI-64017"; +static const char pci_device_104e_0107[] = "OTI-107 [Spitfire]"; +static const char pci_device_104e_0109[] = "Video Adapter"; +static const char pci_device_104e_0111[] = "OTI-64111 [Spitfire]"; +static const char pci_device_104e_0217[] = "OTI-64217"; +static const char pci_device_104e_0317[] = "OTI-64317"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_104f[] = "Co-time Computer Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1050[] = "Winbond Electronics Corp"; +static const char pci_device_1050_0000[] = "NE2000"; +static const char pci_device_1050_0001[] = "W83769F"; +static const char pci_device_1050_0105[] = "W82C105"; +static const char pci_device_1050_0840[] = "W89C840"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1050_0840_1050_0001[] = "W89C840 Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1050_0840_1050_0840[] = "W89C840 Ethernet Adapter"; +#endif +static const char pci_device_1050_0940[] = "W89C940"; +static const char pci_device_1050_5a5a[] = "W89C940F"; +static const char pci_device_1050_6692[] = "W6692"; +static const char pci_device_1050_9970[] = "W9970CF"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1051[] = "Anigma, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1052[] = "?Young Micro Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1053[] = "Young Micro Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1054[] = "Hitachi, Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1055[] = "Efar Microsystems"; +static const char pci_device_1055_9130[] = "SLC90E66 [Victory66] IDE"; +static const char pci_device_1055_9460[] = "SLC90E66 [Victory66] ISA"; +static const char pci_device_1055_9462[] = "SLC90E66 [Victory66] USB"; +static const char pci_device_1055_9463[] = "SLC90E66 [Victory66] ACPI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1056[] = "ICL"; +#endif +static const char pci_vendor_1057[] = "Motorola"; +static const char pci_device_1057_0001[] = "MPC105 [Eagle]"; +static const char pci_device_1057_0002[] = "MPC106 [Grackle]"; +static const char pci_device_1057_0003[] = "MPC8240 [Kahlua]"; +static const char pci_device_1057_0004[] = "MPC107"; +static const char pci_device_1057_0006[] = "MPC8245 [Unity]"; +static const char pci_device_1057_0100[] = "MC145575 [HFC-PCI]"; +static const char pci_device_1057_0431[] = "KTI829c 100VG"; +static const char pci_device_1057_1801[] = "Audio I/O Controller (MIDI)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_1801_ecc0_0030[] = "Layla"; +#endif +static const char pci_device_1057_18c0[] = "MPC8265A/MPC8266"; +static const char pci_device_1057_4801[] = "Raven"; +static const char pci_device_1057_4802[] = "Falcon"; +static const char pci_device_1057_4803[] = "Hawk"; +static const char pci_device_1057_4806[] = "CPX8216"; +static const char pci_device_1057_4d68[] = "20268"; +static const char pci_device_1057_5600[] = "SM56 PCI Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1057_0300[] = "SM56 PCI Speakerphone Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1057_0301[] = "SM56 PCI Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1057_0302[] = "SM56 PCI Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1057_5600[] = "SM56 PCI Voice modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_13d2_0300[] = "SM56 PCI Speakerphone Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_13d2_0301[] = "SM56 PCI Voice modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_13d2_0302[] = "SM56 PCI Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1436_0300[] = "SM56 PCI Speakerphone Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1436_0301[] = "SM56 PCI Voice modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1436_0302[] = "SM56 PCI Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_144f_100c[] = "SM56 PCI Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1494_0300[] = "SM56 PCI Speakerphone Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1494_0301[] = "SM56 PCI Voice modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_14c8_0300[] = "SM56 PCI Speakerphone Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_14c8_0302[] = "SM56 PCI Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1668_0300[] = "SM56 PCI Speakerphone Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1057_5600_1668_0302[] = "SM56 PCI Fax Modem"; +#endif +static const char pci_device_1057_6400[] = "MPC190 Security Processor (S1 family, encryption)"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1058[] = "Electronics & Telecommunications RSH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1059[] = "Teknor Industrial Computers Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_105a[] = "Promise Technology, Inc."; +static const char pci_device_105a_0d30[] = "20265"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_0d30_105a_4d33[] = "Ultra100"; +#endif +static const char pci_device_105a_0d38[] = "20263"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_0d38_105a_4d39[] = "Fasttrak66"; +#endif +static const char pci_device_105a_1275[] = "20275"; +static const char pci_device_105a_3376[] = "PDC20376"; +static const char pci_device_105a_4d30[] = "20267"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d30_105a_4d33[] = "Ultra100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d30_105a_4d39[] = "Fasttrak100"; +#endif +static const char pci_device_105a_4d33[] = "20246"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d33_105a_4d33[] = "20246 IDE Controller"; +#endif +static const char pci_device_105a_4d38[] = "20262"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d38_105a_4d30[] = "Ultra Device on SuperTrak"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d38_105a_4d33[] = "Ultra66"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d38_105a_4d39[] = "Fasttrak66"; +#endif +static const char pci_device_105a_4d68[] = "20268"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_4d68_105a_4d68[] = "Ultra100TX2"; +#endif +static const char pci_device_105a_4d69[] = "20269"; +static const char pci_device_105a_5275[] = "PDC20276 IDE"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_5275_105a_0275[] = "SuperTrak SX6000 IDE"; +#endif +static const char pci_device_105a_5300[] = "DC5300"; +static const char pci_device_105a_6268[] = "20268R"; +static const char pci_device_105a_6269[] = "PDC20271"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105a_6269_105a_6269[] = "FastTrak TX2/TX2000"; +#endif +static const char pci_device_105a_6621[] = "PDC20621 [SX4000] 4 Channel IDE RAID Controller"; +static const char pci_device_105a_7275[] = "PDC20277"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_105b[] = "Foxconn International, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_105c[] = "Wipro Infotech Limited"; +#endif +static const char pci_vendor_105d[] = "Number 9 Computer Company"; +static const char pci_device_105d_2309[] = "Imagine 128"; +static const char pci_device_105d_2339[] = "Imagine 128-II"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0000[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0001[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0002[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0003[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0004[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0005[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0006[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0007[] = "Imagine 128 series 2 4Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0008[] = "Imagine 128 series 2e 4Mb DRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_0009[] = "Imagine 128 series 2e 4Mb DRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_000a[] = "Imagine 128 series 2 8Mb VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_105d_000b[] = "Imagine 128 series 2 8Mb H-VRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_11a4_000a[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_0000[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_0004[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_0005[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_0006[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_0008[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_0009[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_000a[] = "Barco Metheus 5 Megapixel"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_2339_13cc_000c[] = "Barco Metheus 5 Megapixel"; +#endif +static const char pci_device_105d_493d[] = "Imagine 128 T2R [Ticket to Ride]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_11a4_000a[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_11a4_000b[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_13cc_0002[] = "Barco Metheus 4 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_13cc_0003[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_13cc_0007[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_13cc_0008[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_13cc_0009[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_105d_493d_13cc_000a[] = "Barco Metheus 5 Megapixel, Dual Head"; +#endif +static const char pci_device_105d_5348[] = "Revolution 4"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_105e[] = "Vtech Computers Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_105f[] = "Infotronic America Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1060[] = "United Microelectronics [UMC]"; +static const char pci_device_1060_0001[] = "UM82C881"; +static const char pci_device_1060_0002[] = "UM82C886"; +static const char pci_device_1060_0101[] = "UM8673F"; +static const char pci_device_1060_0881[] = "UM8881"; +static const char pci_device_1060_0886[] = "UM8886F"; +static const char pci_device_1060_0891[] = "UM8891A"; +static const char pci_device_1060_1001[] = "UM886A"; +static const char pci_device_1060_673a[] = "UM8886BF"; +static const char pci_device_1060_673b[] = "EIDE Master/DMA"; +static const char pci_device_1060_8710[] = "UM8710"; +static const char pci_device_1060_886a[] = "UM8886A"; +static const char pci_device_1060_8881[] = "UM8881F"; +static const char pci_device_1060_8886[] = "UM8886F"; +static const char pci_device_1060_888a[] = "UM8886A"; +static const char pci_device_1060_8891[] = "UM8891A"; +static const char pci_device_1060_9017[] = "UM9017F"; +static const char pci_device_1060_9018[] = "UM9018"; +static const char pci_device_1060_9026[] = "UM9026"; +static const char pci_device_1060_e881[] = "UM8881N"; +static const char pci_device_1060_e886[] = "UM8886N"; +static const char pci_device_1060_e88a[] = "UM8886N"; +static const char pci_device_1060_e891[] = "UM8891N"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1061[] = "I.I.T."; +static const char pci_device_1061_0001[] = "AGX016"; +static const char pci_device_1061_0002[] = "IIT3204/3501"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1062[] = "Maspar Computer Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1063[] = "Ocean Office Automation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1064[] = "Alcatel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1065[] = "Texas Microsystems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1066[] = "PicoPower Technology"; +static const char pci_device_1066_0000[] = "PT80C826"; +static const char pci_device_1066_0001[] = "PT86C521 [Vesuvius v1] Host Bridge"; +static const char pci_device_1066_0002[] = "PT86C523 [Vesuvius v3] PCI-ISA Bridge Master"; +static const char pci_device_1066_0003[] = "PT86C524 [Nile] PCI-to-PCI Bridge"; +static const char pci_device_1066_0004[] = "PT86C525 [Nile-II] PCI-to-PCI Bridge"; +static const char pci_device_1066_0005[] = "National PC87550 System Controller"; +static const char pci_device_1066_8002[] = "PT86C523 [Vesuvius v3] PCI-ISA Bridge Slave"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1067[] = "Mitsubishi Electric"; +static const char pci_device_1067_1002[] = "VG500 [VolumePro Volume Rendering Accelerator]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1068[] = "Diversified Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1069[] = "Mylex Corporation"; +static const char pci_device_1069_0001[] = "DAC960P"; +static const char pci_device_1069_0002[] = "DAC960PD"; +static const char pci_device_1069_0010[] = "DAC960PX"; +static const char pci_device_1069_0050[] = "AcceleRAID 352/170/160 support Device"; +static const char pci_device_1069_ba55[] = "eXtremeRAID 1100 support Device"; +static const char pci_device_1069_ba56[] = "eXtremeRAID 2000/3000 support Device"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_106a[] = "Aten Research Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_106b[] = "Apple Computer Inc."; +static const char pci_device_106b_0001[] = "Bandit PowerPC host bridge"; +static const char pci_device_106b_0002[] = "Grand Central I/O"; +static const char pci_device_106b_0003[] = "Control Video"; +static const char pci_device_106b_0004[] = "PlanB Video-In"; +static const char pci_device_106b_0007[] = "O'Hare I/O"; +static const char pci_device_106b_000e[] = "Hydra Mac I/O"; +static const char pci_device_106b_0010[] = "Heathrow Mac I/O"; +static const char pci_device_106b_0017[] = "Paddington Mac I/O"; +static const char pci_device_106b_0018[] = "UniNorth FireWire"; +static const char pci_device_106b_0019[] = "KeyLargo USB"; +static const char pci_device_106b_001e[] = "UniNorth Internal PCI"; +static const char pci_device_106b_001f[] = "UniNorth PCI"; +static const char pci_device_106b_0020[] = "UniNorth AGP"; +static const char pci_device_106b_0021[] = "UniNorth GMAC (Sun GEM)"; +static const char pci_device_106b_0022[] = "KeyLargo Mac I/O"; +static const char pci_device_106b_0024[] = "UniNorth/Pangea GMAC (Sun GEM)"; +static const char pci_device_106b_0025[] = "KeyLargo/Pangea Mac I/O"; +static const char pci_device_106b_0026[] = "KeyLargo/Pangea USB"; +static const char pci_device_106b_0027[] = "UniNorth/Pangea AGP"; +static const char pci_device_106b_0028[] = "UniNorth/Pangea PCI"; +static const char pci_device_106b_0029[] = "UniNorth/Pangea Internal PCI"; +static const char pci_device_106b_002d[] = "UniNorth 1.5 AGP"; +static const char pci_device_106b_002e[] = "UniNorth 1.5 PCI"; +static const char pci_device_106b_002f[] = "UniNorth 1.5 Internal PCI"; +static const char pci_device_106b_0030[] = "UniNorth/Pangea FireWire"; +static const char pci_device_106b_0031[] = "UniNorth 2 FireWire"; +static const char pci_device_106b_0032[] = "UniNorth 2 GMAC (Sun GEM)"; +static const char pci_device_106b_0033[] = "UniNorth 2 ATA/100"; +static const char pci_device_106b_0034[] = "UniNorth 2 AGP"; +static const char pci_device_106b_1645[] = "Tigon3 Gigabit Ethernet NIC (BCM5701)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_106c[] = "Hyundai Electronics America"; +static const char pci_device_106c_8801[] = "Dual Pentium ISA/PCI Motherboard"; +static const char pci_device_106c_8802[] = "PowerPC ISA/PCI Motherboard"; +static const char pci_device_106c_8803[] = "Dual Window Graphics Accelerator"; +static const char pci_device_106c_8804[] = "LAN Controller"; +static const char pci_device_106c_8805[] = "100-BaseT LAN"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_106d[] = "Sequent Computer Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_106e[] = "DFI, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_106f[] = "City Gate Development Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1070[] = "Daewoo Telecom Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1071[] = "Mitac"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1072[] = "GIT Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1073[] = "Yamaha Corporation"; +static const char pci_device_1073_0001[] = "3D GUI Accelerator"; +static const char pci_device_1073_0002[] = "YGV615 [RPA3 3D-Graphics Controller]"; +static const char pci_device_1073_0003[] = "YMF-740"; +static const char pci_device_1073_0004[] = "YMF-724"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_0004_1073_0004[] = "YMF724-Based PCI Audio Adapter"; +#endif +static const char pci_device_1073_0005[] = "DS1 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_0005_1073_0005[] = "DS-XG PCI Audio CODEC"; +#endif +static const char pci_device_1073_0006[] = "DS1 Audio"; +static const char pci_device_1073_0008[] = "DS1 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_0008_1073_0008[] = "DS-XG PCI Audio CODEC"; +#endif +static const char pci_device_1073_000a[] = "DS1L Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_000a_1073_0004[] = "DS-XG PCI Audio CODEC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_000a_1073_000a[] = "DS-XG PCI Audio CODEC"; +#endif +static const char pci_device_1073_000c[] = "YMF-740C [DS-1L Audio Controller]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_000c_107a_000c[] = "DS-XG PCI Audio CODEC"; +#endif +static const char pci_device_1073_000d[] = "YMF-724F [DS-1 Audio Controller]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_000d_1073_000d[] = "DS-XG PCI Audio CODEC"; +#endif +static const char pci_device_1073_0010[] = "YMF-744B [DS-1S Audio Controller]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_0010_1073_0006[] = "DS-XG PCI Audio CODEC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_0010_1073_0010[] = "DS-XG PCI Audio CODEC"; +#endif +static const char pci_device_1073_0012[] = "YMF-754 [DS-1E Audio Controller]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_0012_1073_0012[] = "DS-XG PCI Audio Codec"; +#endif +static const char pci_device_1073_0020[] = "DS-1 Audio"; +static const char pci_device_1073_2000[] = "DS2416 Digital Mixing Card"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1073_2000_1073_2000[] = "DS2416 Digital Mixing Card"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1074[] = "NexGen Microsystems"; +static const char pci_device_1074_4e78[] = "82c500/1"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1075[] = "Advanced Integrations Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1076[] = "Chaintech Computer Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1077[] = "QLogic Corp."; +static const char pci_device_1077_1016[] = "ISP10160 Single Channel Ultra3 SCSI Processor"; +static const char pci_device_1077_1020[] = "ISP1020 Fast-wide SCSI"; +static const char pci_device_1077_1022[] = "ISP1022 Fast-wide SCSI"; +static const char pci_device_1077_1080[] = "ISP1080 SCSI Host Adapter"; +static const char pci_device_1077_1216[] = "ISP12160 Dual Channel Ultra3 SCSI Processor"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1077_1216_101e_8471[] = "QLA12160 on AMI MegaRAID"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1077_1216_101e_8493[] = "QLA12160 on AMI MegaRAID"; +#endif +static const char pci_device_1077_1240[] = "ISP1240 SCSI Host Adapter"; +static const char pci_device_1077_1280[] = "ISP1280"; +static const char pci_device_1077_2020[] = "ISP2020A Fast!SCSI Basic Adapter"; +static const char pci_device_1077_2100[] = "QLA2100 64-bit Fibre Channel Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1077_2100_1077_0001[] = "QLA2100 64-bit Fibre Channel Adapter"; +#endif +static const char pci_device_1077_2200[] = "QLA2200"; +static const char pci_device_1077_2300[] = "QLA2300 64-bit FC-AL Adapter"; +static const char pci_device_1077_2312[] = "QLA2312 Fibre Channel Adapter"; +#endif +static const char pci_vendor_1078[] = "Cyrix Corporation"; +static const char pci_device_1078_0000[] = "5510 [Grappa]"; +static const char pci_device_1078_0001[] = "PCI Master"; +static const char pci_device_1078_0002[] = "5520 [Cognac]"; +static const char pci_device_1078_0100[] = "5530 Legacy [Kahlua]"; +static const char pci_device_1078_0101[] = "5530 SMI [Kahlua]"; +static const char pci_device_1078_0102[] = "5530 IDE [Kahlua]"; +static const char pci_device_1078_0103[] = "5530 Audio [Kahlua]"; +static const char pci_device_1078_0104[] = "5530 Video [Kahlua]"; +static const char pci_device_1078_0400[] = "ZFMicro PCI Bridge"; +static const char pci_device_1078_0401[] = "ZFMicro Chipset SMI"; +static const char pci_device_1078_0402[] = "ZFMicro Chipset IDE"; +static const char pci_device_1078_0403[] = "ZFMicro Expansion Bus"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1079[] = "I-Bus"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_107a[] = "NetWorth"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_107b[] = "Gateway 2000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_107c[] = "LG Electronics [Lucky Goldstar Co. Ltd]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_107d[] = "LeadTek Research Inc."; +static const char pci_device_107d_0000[] = "P86C850"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_107e[] = "Interphase Corporation"; +static const char pci_device_107e_0001[] = "5515 ATM Adapter [Flipper]"; +static const char pci_device_107e_0002[] = "100 VG AnyLan Controller"; +static const char pci_device_107e_0004[] = "5526 Fibre Channel Host Adapter"; +static const char pci_device_107e_0005[] = "x526 Fibre Channel Host Adapter"; +static const char pci_device_107e_0008[] = "5525/5575 ATM Adapter (155 Mbit) [Atlantic]"; +static const char pci_device_107e_9003[] = "5535-4P-BRI-ST"; +static const char pci_device_107e_9007[] = "5535-4P-BRI-U"; +static const char pci_device_107e_9008[] = "5535-1P-SR"; +static const char pci_device_107e_900c[] = "5535-1P-SR-ST"; +static const char pci_device_107e_900e[] = "5535-1P-SR-U"; +static const char pci_device_107e_9011[] = "5535-1P-PRI"; +static const char pci_device_107e_9013[] = "5535-2P-PRI"; +static const char pci_device_107e_9023[] = "5536-4P-BRI-ST"; +static const char pci_device_107e_9027[] = "5536-4P-BRI-U"; +static const char pci_device_107e_9031[] = "5536-1P-PRI"; +static const char pci_device_107e_9033[] = "5536-2P-PRI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_107f[] = "Data Technology Corporation"; +static const char pci_device_107f_0802[] = "SL82C105"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1080[] = "Contaq Microsystems"; +static const char pci_device_1080_0600[] = "82C599"; +static const char pci_device_1080_c691[] = "Cypress CY82C691"; +static const char pci_device_1080_c693[] = "82c693"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1081[] = "Supermac Technology"; +static const char pci_device_1081_0d47[] = "Radius PCI to NuBUS Bridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1082[] = "EFA Corporation of America"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1083[] = "Forex Computer Corporation"; +static const char pci_device_1083_0001[] = "FR710"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1084[] = "Parador"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1085[] = "Tulip Computers Int.B.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1086[] = "J. Bond Computer Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1087[] = "Cache Computer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1088[] = "Microcomputer Systems (M) Son"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1089[] = "Data General Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_108a[] = "SBS Technologies"; +static const char pci_device_108a_0001[] = "VME Bridge Model 617"; +static const char pci_device_108a_0010[] = "VME Bridge Model 618"; +static const char pci_device_108a_0040[] = "dataBLIZZARD"; +static const char pci_device_108a_3000[] = "VME Bridge Model 2706"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_108c[] = "Oakleigh Systems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_108d[] = "Olicom"; +static const char pci_device_108d_0001[] = "Token-Ring 16/4 PCI Adapter (3136/3137)"; +static const char pci_device_108d_0002[] = "16/4 Token Ring"; +static const char pci_device_108d_0004[] = "RapidFire 3139 Token-Ring 16/4 PCI Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_108d_0004_108d_0004[] = "OC-3139/3140 RapidFire Token-Ring 16/4 Adapter"; +#endif +static const char pci_device_108d_0005[] = "GoCard 3250 Token-Ring 16/4 CardBus PC Card"; +static const char pci_device_108d_0006[] = "OC-3530 RapidFire Token-Ring 100"; +static const char pci_device_108d_0007[] = "RapidFire 3141 Token-Ring 16/4 PCI Fiber Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_108d_0007_108d_0007[] = "OC-3141 RapidFire Token-Ring 16/4 Adapter"; +#endif +static const char pci_device_108d_0008[] = "RapidFire 3540 HSTR 100/16/4 PCI Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_108d_0008_108d_0008[] = "OC-3540 RapidFire HSTR 100/16/4 Adapter"; +#endif +static const char pci_device_108d_0011[] = "OC-2315"; +static const char pci_device_108d_0012[] = "OC-2325"; +static const char pci_device_108d_0013[] = "OC-2183/2185"; +static const char pci_device_108d_0014[] = "OC-2326"; +static const char pci_device_108d_0019[] = "OC-2327/2250 10/100 Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_108d_0019_108d_0016[] = "OC-2327 Rapidfire 10/100 Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_108d_0019_108d_0017[] = "OC-2250 GoCard 10/100 Ethernet Adapter"; +#endif +static const char pci_device_108d_0021[] = "OC-6151/6152 [RapidFire ATM 155]"; +static const char pci_device_108d_0022[] = "ATM Adapter"; +#endif +static const char pci_vendor_108e[] = "Sun Microsystems Computer Corp."; +static const char pci_device_108e_0001[] = "EBUS"; +static const char pci_device_108e_1000[] = "EBUS"; +static const char pci_device_108e_1001[] = "Happy Meal"; +static const char pci_device_108e_1100[] = "RIO EBUS"; +static const char pci_device_108e_1101[] = "RIO GEM"; +static const char pci_device_108e_1102[] = "RIO 1394"; +static const char pci_device_108e_1103[] = "RIO USB"; +static const char pci_device_108e_2bad[] = "GEM"; +static const char pci_device_108e_5000[] = "Simba Advanced PCI Bridge"; +static const char pci_device_108e_5043[] = "SunPCI Co-processor"; +static const char pci_device_108e_8000[] = "Psycho PCI Bus Module"; +static const char pci_device_108e_8001[] = "Schizo PCI Bus Module"; +static const char pci_device_108e_a000[] = "Ultra IIi"; +static const char pci_device_108e_a001[] = "Ultra IIe"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_108f[] = "Systemsoft"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1090[] = "Encore Computer Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1091[] = "Intergraph Corporation"; +static const char pci_device_1091_0020[] = "3D graphics processor"; +static const char pci_device_1091_0021[] = "3D graphics processor w/Texturing"; +static const char pci_device_1091_0040[] = "3D graphics frame buffer"; +static const char pci_device_1091_0041[] = "3D graphics frame buffer"; +static const char pci_device_1091_0060[] = "Proprietary bus bridge"; +static const char pci_device_1091_00e4[] = "Powerstorm 4D50T"; +static const char pci_device_1091_0720[] = "Motion JPEG codec"; +#endif +static const char pci_vendor_1092[] = "Diamond Multimedia Systems"; +static const char pci_device_1092_00a0[] = "Speedstar Pro SE"; +static const char pci_device_1092_00a8[] = "Speedstar 64"; +static const char pci_device_1092_0550[] = "Viper V550"; +static const char pci_device_1092_08d4[] = "Supra 2260 Modem"; +static const char pci_device_1092_094c[] = "SupraExpress 56i Pro"; +static const char pci_device_1092_1092[] = "Viper V330"; +static const char pci_device_1092_6120[] = "Maximum DVD"; +static const char pci_device_1092_8810[] = "Stealth SE"; +static const char pci_device_1092_8811[] = "Stealth 64/SE"; +static const char pci_device_1092_8880[] = "Stealth"; +static const char pci_device_1092_8881[] = "Stealth"; +static const char pci_device_1092_88b0[] = "Stealth 64"; +static const char pci_device_1092_88b1[] = "Stealth 64"; +static const char pci_device_1092_88c0[] = "Stealth 64"; +static const char pci_device_1092_88c1[] = "Stealth 64"; +static const char pci_device_1092_88d0[] = "Stealth 64"; +static const char pci_device_1092_88d1[] = "Stealth 64"; +static const char pci_device_1092_88f0[] = "Stealth 64"; +static const char pci_device_1092_88f1[] = "Stealth 64"; +static const char pci_device_1092_9999[] = "DMD-I0928-1 Monster sound sound chip"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1093[] = "National Instruments"; +static const char pci_device_1093_0160[] = "PCI-DIO-96"; +static const char pci_device_1093_0162[] = "PCI-MIO-16XE-50"; +static const char pci_device_1093_1170[] = "PCI-MIO-16XE-10"; +static const char pci_device_1093_1180[] = "PCI-MIO-16E-1"; +static const char pci_device_1093_1190[] = "PCI-MIO-16E-4"; +static const char pci_device_1093_1330[] = "PCI-6031E"; +static const char pci_device_1093_1350[] = "PCI-6071E"; +static const char pci_device_1093_2a60[] = "PCI-6023E"; +static const char pci_device_1093_b001[] = "IMAQ-PCI-1408"; +static const char pci_device_1093_b011[] = "IMAQ-PXI-1408"; +static const char pci_device_1093_b021[] = "IMAQ-PCI-1424"; +static const char pci_device_1093_b031[] = "IMAQ-PCI-1413"; +static const char pci_device_1093_b041[] = "IMAQ-PCI-1407"; +static const char pci_device_1093_b051[] = "IMAQ-PXI-1407"; +static const char pci_device_1093_b061[] = "IMAQ-PCI-1411"; +static const char pci_device_1093_b071[] = "IMAQ-PCI-1422"; +static const char pci_device_1093_b081[] = "IMAQ-PXI-1422"; +static const char pci_device_1093_b091[] = "IMAQ-PXI-1411"; +static const char pci_device_1093_c801[] = "PCI-GPIB"; +static const char pci_device_1093_c831[] = "PCI-GPIB bridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1094[] = "First International Computers [FIC]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1095[] = "CMD Technology Inc"; +static const char pci_device_1095_0640[] = "PCI0640"; +static const char pci_device_1095_0643[] = "PCI0643"; +static const char pci_device_1095_0646[] = "PCI0646"; +static const char pci_device_1095_0647[] = "PCI0647"; +static const char pci_device_1095_0648[] = "PCI0648"; +static const char pci_device_1095_0649[] = "PCI0649"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1095_0649_0e11_005d[] = "Integrated Ultra ATA-100 Dual Channel Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1095_0649_0e11_007e[] = "Integrated Ultra ATA-100 IDE RAID Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1095_0649_101e_0649[] = "AMI MegaRAID IDE 100 Controller"; +#endif +static const char pci_device_1095_0650[] = "PBC0650A"; +static const char pci_device_1095_0670[] = "USB0670"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1095_0670_1095_0670[] = "USB0670"; +#endif +static const char pci_device_1095_0673[] = "USB0673"; +static const char pci_device_1095_0680[] = "PCI0680"; +static const char pci_device_1095_3112[] = "Silicon Image SiI 3112 SATARaid Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1096[] = "Alacron"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1097[] = "Appian Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1098[] = "Quantum Designs (H.K.) Ltd"; +static const char pci_device_1098_0001[] = "QD-8500"; +static const char pci_device_1098_0002[] = "QD-8580"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1099[] = "Samsung Electronics Co., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_109a[] = "Packard Bell"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_109b[] = "Gemlight Computer Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_109c[] = "Megachips Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_109d[] = "Zida Technologies Ltd."; +#endif +static const char pci_vendor_109e[] = "Brooktree Corporation"; +static const char pci_device_109e_0350[] = "Bt848 Video Capture"; +static const char pci_device_109e_0351[] = "Bt849A Video capture"; +static const char pci_device_109e_0369[] = "Bt878 Video Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0369_1002_0001[] = "TV-Wonder"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0369_1002_0003[] = "TV-Wonder/VE"; +#endif +static const char pci_device_109e_036c[] = "Bt879(?) Video Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036c_13e9_0070[] = "Win/TV (Video Section)"; +#endif +static const char pci_device_109e_036e[] = "Bt878 Video Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_0070_13eb[] = "WinTV Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_0070_ff01[] = "Viewcast Osprey 200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_107d_6606[] = "WinFast TV 2000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_11bd_0012[] = "PCTV pro (TV + FM stereo receiver)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_11bd_001c[] = "PCTV Sat (DBC receiver)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_127a_0001[] = "Bt878 Mediastream Controller NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_127a_0002[] = "Bt878 Mediastream Controller PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_127a_0003[] = "Bt878a Mediastream Controller PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_127a_0048[] = "Bt878/832 Mediastream Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_144f_3000[] = "MagicTView CPH060 - Video"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_1461_0004[] = "AVerTV WDM Video Capture"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_14f1_0001[] = "Bt878 Mediastream Controller NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_14f1_0002[] = "Bt878 Mediastream Controller PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_14f1_0003[] = "Bt878a Mediastream Controller PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_14f1_0048[] = "Bt878/832 Mediastream Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_1851_1850[] = "FlyVideo'98 - Video"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_1851_1851[] = "FlyVideo II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_1852_1852[] = "FlyVideo'98 - Video (with FM Tuner)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036e_bd11_1200[] = "PCTV pro (TV + FM stereo receiver)"; +#endif +static const char pci_device_109e_036f[] = "Bt879 Video Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0044[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0122[] = "Bt879 Video Capture PAL I"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0144[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0222[] = "Bt879 Video Capture PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0244[] = "Bt879a Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0322[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_0422[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_1122[] = "Bt879 Video Capture PAL I"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_1222[] = "Bt879 Video Capture PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_1322[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_1522[] = "Bt879a Video Capture PAL I"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_1622[] = "Bt879a Video Capture PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_127a_1722[] = "Bt879a Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0044[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0122[] = "Bt879 Video Capture PAL I"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0144[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0222[] = "Bt879 Video Capture PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0244[] = "Bt879a Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0322[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_0422[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_1122[] = "Bt879 Video Capture PAL I"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_1222[] = "Bt879 Video Capture PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_1322[] = "Bt879 Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_1522[] = "Bt879a Video Capture PAL I"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_1622[] = "Bt879a Video Capture PAL BG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_14f1_1722[] = "Bt879a Video Capture NTSC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_1851_1850[] = "FlyVideo'98 - Video"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_1851_1851[] = "FlyVideo II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_036f_1852_1852[] = "FlyVideo'98 - Video (with FM Tuner)"; +#endif +static const char pci_device_109e_0370[] = "Bt880 Video Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0370_1851_1850[] = "FlyVideo'98"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0370_1851_1851[] = "FlyVideo'98 EZ - video"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0370_1852_1852[] = "FlyVideo'98 (with FM Tuner)"; +#endif +static const char pci_device_109e_0878[] = "Bt878 Audio Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_0070_13eb[] = "WinTV Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_0070_ff01[] = "Viewcast Osprey 200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_1002_0001[] = "TV-Wonder"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_1002_0003[] = "TV-Wonder/VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_11bd_0012[] = "PCTV pro (TV + FM stereo receiver, audio section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_11bd_001c[] = "PCTV Sat (DBC receiver)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_127a_0001[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_127a_0002[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_127a_0003[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_127a_0048[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_13e9_0070[] = "Win/TV (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_144f_3000[] = "MagicTView CPH060 - Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_1461_0004[] = "AVerTV WDM Audio Capture"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_14f1_0001[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_14f1_0002[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_14f1_0003[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_14f1_0048[] = "Bt878 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0878_bd11_1200[] = "PCTV pro (TV + FM stereo receiver, audio section)"; +#endif +static const char pci_device_109e_0879[] = "Bt879 Audio Capture"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0044[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0122[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0144[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0222[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0244[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0322[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_0422[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_1122[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_1222[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_1322[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_1522[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_1622[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_127a_1722[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0044[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0122[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0144[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0222[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0244[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0322[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_0422[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_1122[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_1222[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_1322[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_1522[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_1622[] = "Bt879 Video Capture (Audio Section)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_109e_0879_14f1_1722[] = "Bt879 Video Capture (Audio Section)"; +#endif +static const char pci_device_109e_0880[] = "Bt880 Audio Capture"; +static const char pci_device_109e_2115[] = "BtV 2115 Mediastream controller"; +static const char pci_device_109e_2125[] = "BtV 2125 Mediastream controller"; +static const char pci_device_109e_2164[] = "BtV 2164"; +static const char pci_device_109e_2165[] = "BtV 2165"; +static const char pci_device_109e_8230[] = "Bt8230 ATM Segment/Reassembly Ctrlr (SRC)"; +static const char pci_device_109e_8472[] = "Bt8472"; +static const char pci_device_109e_8474[] = "Bt8474"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_109f[] = "Trigem Computer Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a0[] = "Meidensha Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a1[] = "Juko Electronics Ind. Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a2[] = "Quantum Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a3[] = "Everex Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a4[] = "Globe Manufacturing Sales"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a5[] = "Smart Link Ltd."; +static const char pci_device_10a5_5449[] = "SmartPCI561 modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a6[] = "Informtech Industrial Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a7[] = "Benchmarq Microelectronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a8[] = "Sierra Semiconductor"; +static const char pci_device_10a8_0000[] = "STB Horizon 64"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10a9[] = "Silicon Graphics, Inc."; +static const char pci_device_10a9_0001[] = "Crosstalk to PCI Bridge"; +static const char pci_device_10a9_0002[] = "Linc I/O controller"; +static const char pci_device_10a9_0003[] = "IOC3 I/O controller"; +static const char pci_device_10a9_0004[] = "O2 MACE"; +static const char pci_device_10a9_0005[] = "RAD Audio"; +static const char pci_device_10a9_0006[] = "HPCEX"; +static const char pci_device_10a9_0007[] = "RPCEX"; +static const char pci_device_10a9_0008[] = "DiVO VIP"; +static const char pci_device_10a9_0009[] = "Alteon Gigabit Ethernet"; +static const char pci_device_10a9_0010[] = "AMP Video I/O"; +static const char pci_device_10a9_0011[] = "GRIP"; +static const char pci_device_10a9_0012[] = "SGH PSHAC GSN"; +static const char pci_device_10a9_1001[] = "Magic Carpet"; +static const char pci_device_10a9_1002[] = "Lithium"; +static const char pci_device_10a9_1003[] = "Dual JPEG 1"; +static const char pci_device_10a9_1004[] = "Dual JPEG 2"; +static const char pci_device_10a9_1005[] = "Dual JPEG 3"; +static const char pci_device_10a9_1006[] = "Dual JPEG 4"; +static const char pci_device_10a9_1007[] = "Dual JPEG 5"; +static const char pci_device_10a9_1008[] = "Cesium"; +static const char pci_device_10a9_2001[] = "Fibre Channel"; +static const char pci_device_10a9_2002[] = "ASDE"; +static const char pci_device_10a9_8001[] = "O2 1394"; +static const char pci_device_10a9_8002[] = "G-net NT"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10aa[] = "ACC Microelectronics"; +static const char pci_device_10aa_0000[] = "ACCM 2188"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ab[] = "Digicom"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ac[] = "Honeywell IAC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ad[] = "Symphony Labs"; +static const char pci_device_10ad_0001[] = "W83769F"; +static const char pci_device_10ad_0003[] = "SL82C103"; +static const char pci_device_10ad_0005[] = "SL82C105"; +static const char pci_device_10ad_0103[] = "SL82c103"; +static const char pci_device_10ad_0105[] = "SL82c105"; +static const char pci_device_10ad_0565[] = "W83C553"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ae[] = "Cornerstone Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10af[] = "Micro Computer Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b0[] = "CardExpert Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b1[] = "Cabletron Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b2[] = "Raytheon Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b3[] = "Databook Inc"; +static const char pci_device_10b3_3106[] = "DB87144"; +static const char pci_device_10b3_b106[] = "DB87144"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b4[] = "STB Systems Inc"; +static const char pci_device_10b4_1b1d[] = "Velocity 128 3D"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b4_1b1d_10b4_237e[] = "Velocity 4400"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b5[] = "PLX Technology, Inc."; +static const char pci_device_10b5_0001[] = "i960 PCI bus interface"; +static const char pci_device_10b5_1076[] = "VScom 800 8 port serial adaptor"; +static const char pci_device_10b5_1077[] = "VScom 400 4 port serial adaptor"; +static const char pci_device_10b5_1078[] = "VScom 210 2 port serial and 1 port parallel adaptor"; +static const char pci_device_10b5_1103[] = "VScom 200 2 port serial adaptor"; +static const char pci_device_10b5_1146[] = "VScom 010 1 port parallel adaptor"; +static const char pci_device_10b5_1147[] = "VScom 020 2 port parallel adaptor"; +static const char pci_device_10b5_2724[] = "Thales PCSM Security Card"; +static const char pci_device_10b5_9030[] = "PCI <-> IOBus Bridge Hot Swap"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9030_15ed_1002[] = "MCCS 8-port Serial Hot Swap"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9030_15ed_1003[] = "MCCS 16-port Serial Hot Swap"; +#endif +static const char pci_device_10b5_9036[] = "9036"; +static const char pci_device_10b5_9050[] = "PCI <-> IOBus Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_10b5_2036[] = "SatPak GPS"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_10b5_2273[] = "SH-ARC SoHard ARCnet card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_10b5_9050[] = "MP9050"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_1522_0001[] = "RockForce 4 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_1522_0002[] = "RockForce 2 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_1522_0003[] = "RockForce 6 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_1522_0004[] = "RockForce 8 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_1522_0010[] = "RockForce2000 4 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_1522_0020[] = "RockForce2000 2 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_15ed_1000[] = "Macrolink MCCS 8-port Serial"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_15ed_1001[] = "Macrolink MCCS 16-port Serial"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_15ed_1002[] = "Macrolink MCCS 8-port Serial Hot Swap"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_15ed_1003[] = "Macrolink MCCS 16-port Serial Hot Swap"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_5654_5634[] = "OpenLine4 Telephony Card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d531_c002[] = "PCIntelliCAN 2xSJA1000 CAN bus"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4006[] = "EX-4006 1P"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4008[] = "EX-4008 1P EPP/ECP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4014[] = "EX-4014 2P"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4018[] = "EX-4018 3P EPP/ECP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4025[] = "EX-4025 1S(16C550) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4027[] = "EX-4027 1S(16C650) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4028[] = "EX-4028 1S(16C850) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4036[] = "EX-4036 2S(16C650) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4037[] = "EX-4037 2S(16C650) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4038[] = "EX-4038 2S(16C850) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4052[] = "EX-4052 1S(16C550) RS-422/485"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4053[] = "EX-4053 2S(16C550) RS-422/485"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4055[] = "EX-4055 4S(16C550) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4058[] = "EX-4055 4S(16C650) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4065[] = "EX-4065 8S(16C550) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4068[] = "EX-4068 8S(16C650) RS-232"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9050_d84d_4078[] = "EX-4078 2S(16C552) RS-232+1P"; +#endif +static const char pci_device_10b5_9054[] = "PCI <-> IOBus Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9054_10b5_2455[] = "Wessex Techology PHIL-PCI"; +#endif +static const char pci_device_10b5_9060[] = "9060"; +static const char pci_device_10b5_906d[] = "9060SD"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_906d_125c_0640[] = "Aries 16000P"; +#endif +static const char pci_device_10b5_906e[] = "9060ES"; +static const char pci_device_10b5_9080[] = "9080"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9080_10b5_9080[] = "9080 [real subsystem ID not set]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b5_9080_129d_0002[] = "Aculab PCI Prosidy card"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b6[] = "Madge Networks"; +static const char pci_device_10b6_0001[] = "Smart 16/4 PCI Ringnode"; +static const char pci_device_10b6_0002[] = "Smart 16/4 PCI Ringnode Mk2"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0002_10b6_0002[] = "Smart 16/4 PCI Ringnode Mk2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0002_10b6_0006[] = "16/4 CardBus Adapter"; +#endif +static const char pci_device_10b6_0003[] = "Smart 16/4 PCI Ringnode Mk3"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0003_0e11_b0fd[] = "Compaq NC4621 PCI, 4/16, WOL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0003_10b6_0003[] = "Smart 16/4 PCI Ringnode Mk3"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0003_10b6_0007[] = "Presto PCI Plus Adapter"; +#endif +static const char pci_device_10b6_0004[] = "Smart 16/4 PCI Ringnode Mk1"; +static const char pci_device_10b6_0006[] = "16/4 Cardbus Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0006_10b6_0006[] = "16/4 CardBus Adapter"; +#endif +static const char pci_device_10b6_0007[] = "Presto PCI Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0007_10b6_0007[] = "Presto PCI"; +#endif +static const char pci_device_10b6_0009[] = "Smart 100/16/4 PCI-HS Ringnode"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_0009_10b6_0009[] = "Smart 100/16/4 PCI-HS Ringnode"; +#endif +static const char pci_device_10b6_000a[] = "Smart 100/16/4 PCI Ringnode"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_000a_10b6_000a[] = "Smart 100/16/4 PCI Ringnode"; +#endif +static const char pci_device_10b6_000b[] = "16/4 CardBus Adapter Mk2"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_000b_10b6_0008[] = "16/4 CardBus Adapter Mk2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_000b_10b6_000b[] = "16/4 Cardbus Adapter Mk2"; +#endif +static const char pci_device_10b6_000c[] = "RapidFire 3140V2 16/4 TR Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b6_000c_10b6_000c[] = "RapidFire 3140V2 16/4 TR Adapter"; +#endif +static const char pci_device_10b6_1000[] = "Collage 25/155 ATM Client Adapter"; +static const char pci_device_10b6_1001[] = "Collage 155 ATM Server Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b7[] = "3Com Corporation"; +static const char pci_device_10b7_0001[] = "3c985 1000BaseSX (SX/TX)"; +static const char pci_device_10b7_1006[] = "MINI PCI type 3B Data Fax Modem"; +static const char pci_device_10b7_1007[] = "Mini PCI 56k Winmodem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_1007_10b7_615c[] = "Mini PCI 56K Modem"; +#endif +static const char pci_device_10b7_3390[] = "3c339 TokenLink Velocity"; +static const char pci_device_10b7_3590[] = "3c359 TokenLink Velocity XL"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_3590_10b7_3590[] = "TokenLink Velocity XL Adapter (3C359/359B)"; +#endif +static const char pci_device_10b7_4500[] = "3c450 Cyclone/unknown"; +static const char pci_device_10b7_5055[] = "3c555 Laptop Hurricane"; +static const char pci_device_10b7_5057[] = "3c575 [Megahertz] 10/100 LAN CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_5057_10b7_5a57[] = "3C575 Megahertz 10/100 LAN Cardbus PC Card"; +#endif +static const char pci_device_10b7_5157[] = "3c575 [Megahertz] 10/100 LAN CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_5157_10b7_5b57[] = "3C575 Megahertz 10/100 LAN Cardbus PC Card"; +#endif +static const char pci_device_10b7_5257[] = "3CCFE575CT Cyclone CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_5257_10b7_5c57[] = "FE575C-3Com 10/100 LAN CardBus-Fast Ethernet"; +#endif +static const char pci_device_10b7_5900[] = "3c590 10BaseT [Vortex]"; +static const char pci_device_10b7_5920[] = "3c592 EISA 10mbps Demon/Vortex"; +static const char pci_device_10b7_5950[] = "3c595 100BaseTX [Vortex]"; +static const char pci_device_10b7_5951[] = "3c595 100BaseT4 [Vortex]"; +static const char pci_device_10b7_5952[] = "3c595 100Base-MII [Vortex]"; +static const char pci_device_10b7_5970[] = "3c597 EISA Fast Demon/Vortex"; +static const char pci_device_10b7_5b57[] = "3c595 [Megahertz] 10/100 LAN CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_5b57_10b7_5b57[] = "3C575 Megahertz 10/100 LAN Cardbus PC Card"; +#endif +static const char pci_device_10b7_6055[] = "3c556 Hurricane CardBus"; +static const char pci_device_10b7_6056[] = "3c556B Hurricane CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_6056_10b7_6556[] = "10/100 Mini PCI Ethernet Adapter"; +#endif +static const char pci_device_10b7_6560[] = "3CCFE656 Cyclone CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_6560_10b7_656a[] = "3CCFEM656 10/100 LAN+56K Modem CardBus"; +#endif +static const char pci_device_10b7_6561[] = "3CCFEM656 10/100 LAN+56K Modem CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_6561_10b7_656b[] = "3CCFEM656 10/100 LAN+56K Modem CardBus"; +#endif +static const char pci_device_10b7_6562[] = "3CCFEM656 [id 6562] Cyclone CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_6562_10b7_656b[] = "3CCFEM656B 10/100 LAN+56K Modem CardBus"; +#endif +static const char pci_device_10b7_6563[] = "3CCFEM656B 10/100 LAN+56K Modem CardBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_6563_10b7_656b[] = "3CCFEM656 10/100 LAN+56K Modem CardBus"; +#endif +static const char pci_device_10b7_6564[] = "3CCFEM656 [id 6564] Cyclone CardBus"; +static const char pci_device_10b7_7646[] = "3cSOHO100-TX Hurricane"; +static const char pci_device_10b7_7940[] = "3c803 FDDILink UTP Controller"; +static const char pci_device_10b7_7980[] = "3c804 FDDILink SAS Controller"; +static const char pci_device_10b7_7990[] = "3c805 FDDILink DAS Controller"; +static const char pci_device_10b7_8811[] = "Token ring"; +static const char pci_device_10b7_9000[] = "3c900 10BaseT [Boomerang]"; +static const char pci_device_10b7_9001[] = "3c900 Combo [Boomerang]"; +static const char pci_device_10b7_9004[] = "3c900B-TPO [Etherlink XL TPO]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9004_10b7_9004[] = "3C900B-TPO Etherlink XL TPO 10Mb"; +#endif +static const char pci_device_10b7_9005[] = "3c900B-Combo [Etherlink XL Combo]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9005_10b7_9005[] = "3C900B-Combo Etherlink XL Combo"; +#endif +static const char pci_device_10b7_9006[] = "3c900B-TPC [Etherlink XL TPC]"; +static const char pci_device_10b7_900a[] = "3c900B-FL [Etherlink XL FL]"; +static const char pci_device_10b7_9050[] = "3c905 100BaseTX [Boomerang]"; +static const char pci_device_10b7_9051[] = "3c905 100BaseT4 [Boomerang]"; +static const char pci_device_10b7_9055[] = "3c905B 100BaseTX [Cyclone]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0080[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0081[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0082[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0083[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0084[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0085[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0086[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0087[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0088[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0089[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0090[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0091[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0092[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0093[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0094[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0095[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0096[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0097[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0098[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_1028_0099[] = "3C905B Fast Etherlink XL 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9055_10b7_9055[] = "3C905B Fast Etherlink XL 10/100"; +#endif +static const char pci_device_10b7_9056[] = "3c905B-T4 [Fast EtherLink XL 10/100]"; +static const char pci_device_10b7_9058[] = "3c905B-Combo [Deluxe Etherlink XL 10/100]"; +static const char pci_device_10b7_905a[] = "3c905B-FX [Fast Etherlink XL FX 10/100]"; +static const char pci_device_10b7_9200[] = "3c905C-TX/TX-M [Tornado]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9200_1028_0095[] = "Integrated 3C905C-TX Fast Etherlink for PC Management NIC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9200_10b7_1000[] = "3C905C-TX Fast Etherlink for PC Management NIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9200_10b7_7000[] = "10/100 Mini PCI Ethernet Adapter"; +#endif +static const char pci_device_10b7_9201[] = "3C920B-EMB Integrated Fast Ethernet Controller"; +static const char pci_device_10b7_9300[] = "3CSOHO100B-TX [910-A01]"; +static const char pci_device_10b7_9800[] = "3c980-TX [Fast Etherlink XL Server Adapter]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9800_10b7_9800[] = "3c980-TX Fast Etherlink XL Server Adapter"; +#endif +static const char pci_device_10b7_9805[] = "3c980-TX 10/100baseTX NIC [Python-T]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9805_10b7_1201[] = "3c982-TXM 10/100baseTX Dual Port A [Hydra]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9805_10b7_1202[] = "3c982-TXM 10/100baseTX Dual Port B [Hydra]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9805_10b7_9805[] = "3c980 10/100baseTX NIC [Python-T]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9805_10f1_2462[] = "Thunder K7 S2462"; +#endif +static const char pci_device_10b7_9900[] = "3C990-TX [Typhoon]"; +static const char pci_device_10b7_9902[] = "3CR990-TX-95 [Typhoon 56-bit]"; +static const char pci_device_10b7_9903[] = "3CR990-TX-97 [Typhoon 168-bit]"; +static const char pci_device_10b7_9904[] = "3C990B-TX-M/3C990BSVR [Typhoon2]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9904_10b7_1000[] = "3CR990B-TX-M [Typhoon2]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9904_10b7_2000[] = "3CR990BSVR [Typhoon2 Server]"; +#endif +static const char pci_device_10b7_9905[] = "3CR990-FX-95/97/95 [Typhon Fiber]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9905_10b7_1101[] = "3CR990-FX-95 [Typhoon Fiber 56-bit]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9905_10b7_1102[] = "3CR990-FX-97 [Typhoon Fiber 168-bit]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9905_10b7_2101[] = "3CR990-FX-95 Server [Typhoon Fiber 56-bit]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b7_9905_10b7_2102[] = "3CR990-FX-97 Server [Typhoon Fiber 168-bit]"; +#endif +static const char pci_device_10b7_9908[] = "3CR990SVR95 [Typhoon Server 56-bit]"; +static const char pci_device_10b7_9909[] = "3CR990SVR97 [Typhoon Server 168-bit]"; +static const char pci_device_10b7_990b[] = "3C990SVR [Typhoon Server]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10b8[] = "Standard Microsystems Corp [SMC]"; +static const char pci_device_10b8_0005[] = "83C170QF"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_1055_e000[] = "LANEPIC 10/100 [EVB171Q-PCI]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_1055_e002[] = "LANEPIC 10/100 [EVB171G-PCI]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_10b8_a011[] = "EtherPower II 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_10b8_a014[] = "EtherPower II 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_10b8_a015[] = "EtherPower II 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_10b8_a016[] = "EtherPower II 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0005_10b8_a017[] = "EtherPower II 10/100"; +#endif +static const char pci_device_10b8_0006[] = "LANEPIC"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_1055_e100[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_1055_e102[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_1055_e300[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_1055_e302[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_10b8_a012[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_13a2_8002[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b8_0006_13a2_8006[] = "LANEPIC Cardbus Fast Ethernet Adapter"; +#endif +static const char pci_device_10b8_1000[] = "FDC 37c665"; +static const char pci_device_10b8_1001[] = "FDC 37C922"; +static const char pci_device_10b8_a011[] = "83C170QF"; +static const char pci_device_10b8_b106[] = "SMC34C90"; +#endif +static const char pci_vendor_10b9[] = "ALi Corporation"; +static const char pci_device_10b9_0111[] = "C-Media CMI8738/C3DX Audio Device (OEM)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_0111_10b9_0111[] = "C-Media CMI8738/C3DX Audio Device (OEM)"; +#endif +static const char pci_device_10b9_1435[] = "M1435"; +static const char pci_device_10b9_1445[] = "M1445"; +static const char pci_device_10b9_1449[] = "M1449"; +static const char pci_device_10b9_1451[] = "M1451"; +static const char pci_device_10b9_1461[] = "M1461"; +static const char pci_device_10b9_1489[] = "M1489"; +static const char pci_device_10b9_1511[] = "M1511 [Aladdin]"; +static const char pci_device_10b9_1512[] = "M1512 [Aladdin]"; +static const char pci_device_10b9_1513[] = "M1513 [Aladdin]"; +static const char pci_device_10b9_1521[] = "M1521 [Aladdin III]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_1521_10b9_1521[] = "ALI M1521 Aladdin III CPU Bridge"; +#endif +static const char pci_device_10b9_1523[] = "M1523"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_1523_10b9_1523[] = "ALI M1523 ISA Bridge"; +#endif +static const char pci_device_10b9_1531[] = "M1531 [Aladdin IV]"; +static const char pci_device_10b9_1533[] = "M1533 PCI to ISA Bridge [Aladdin IV]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_1533_10b9_1533[] = "ALI M1533 Aladdin IV ISA Bridge"; +#endif +static const char pci_device_10b9_1541[] = "M1541"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_1541_10b9_1541[] = "ALI M1541 Aladdin V/V+ AGP System Controller"; +#endif +static const char pci_device_10b9_1543[] = "M1543"; +static const char pci_device_10b9_1563[] = "M1563 HyperTransport South Bridge"; +static const char pci_device_10b9_1621[] = "M1621"; +static const char pci_device_10b9_1631[] = "ALI M1631 PCI North Bridge Aladdin Pro III"; +static const char pci_device_10b9_1632[] = "M1632M Northbridge+Trident"; +static const char pci_device_10b9_1641[] = "ALI M1641 PCI North Bridge Aladdin Pro IV"; +static const char pci_device_10b9_1644[] = "M1644/M1644T Northbridge+Trident"; +static const char pci_device_10b9_1646[] = "M1646 Northbridge+Trident"; +static const char pci_device_10b9_1647[] = "M1647 Northbridge [MAGiK 1 / MobileMAGiK 1]"; +static const char pci_device_10b9_1651[] = "M1651/M1651T Northbridge [Aladdin-Pro 5/5M,Aladdin-Pro 5T/5TM]"; +static const char pci_device_10b9_1671[] = "M1671 Super P4 Northbridge [AGP4X,PCI and SDR/DDR]"; +static const char pci_device_10b9_1681[] = "M1681 P4 Northbridge [AGP8X,HyperTransport and SDR/DDR]"; +static const char pci_device_10b9_1687[] = "M1687 K8 Northbridge [AGP8X and HyperTransport]"; +static const char pci_device_10b9_3141[] = "M3141"; +static const char pci_device_10b9_3143[] = "M3143"; +static const char pci_device_10b9_3145[] = "M3145"; +static const char pci_device_10b9_3147[] = "M3147"; +static const char pci_device_10b9_3149[] = "M3149"; +static const char pci_device_10b9_3151[] = "M3151"; +static const char pci_device_10b9_3307[] = "M3307"; +static const char pci_device_10b9_3309[] = "M3309"; +static const char pci_device_10b9_5212[] = "M4803"; +static const char pci_device_10b9_5215[] = "MS4803"; +static const char pci_device_10b9_5217[] = "M5217H"; +static const char pci_device_10b9_5219[] = "M5219"; +static const char pci_device_10b9_5225[] = "M5225"; +static const char pci_device_10b9_5229[] = "M5229 IDE"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_5229_1043_8053[] = "A7A266 Motherboard IDE"; +#endif +static const char pci_device_10b9_5235[] = "M5225"; +static const char pci_device_10b9_5237[] = "USB 1.1 Controller"; +static const char pci_device_10b9_5239[] = "USB 2.0 Controller"; +static const char pci_device_10b9_5243[] = "M1541 PCI to AGP Controller"; +static const char pci_device_10b9_5247[] = "PCI to AGP Controller"; +static const char pci_device_10b9_5249[] = "M5249 HTT to PCI Bridge"; +static const char pci_device_10b9_5251[] = "M5251 P1394 OHCI 1.0 Controller"; +static const char pci_device_10b9_5253[] = "M5253 P1394 OHCI 1.1 Controller"; +static const char pci_device_10b9_5261[] = "M5261 Ethernet Controller"; +static const char pci_device_10b9_5451[] = "M5451 PCI AC-Link Controller Audio Device"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_5451_1014_0506[] = "ThinkPad R30"; +#endif +static const char pci_device_10b9_5453[] = "M5453 PCI AC-Link Controller Modem Device"; +static const char pci_device_10b9_5455[] = "M5455 PCI AC-Link Controller Audio Device"; +static const char pci_device_10b9_5457[] = "Intel 537 [M5457 AC-Link Modem]"; +static const char pci_device_10b9_5459[] = "SmartLink SmartPCI561 56K Modem"; +static const char pci_device_10b9_545a[] = "SmartLink SmartPCI563 56K Modem"; +static const char pci_device_10b9_5471[] = "M5471 Memory Stick Controller"; +static const char pci_device_10b9_5473[] = "M5473 SD-MMC Controller"; +static const char pci_device_10b9_7101[] = "M7101 PMU"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10b9_7101_10b9_7101[] = "ALI M7101 Power Management Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ba[] = "Mitsubishi Electric Corp."; +static const char pci_device_10ba_0301[] = "AccelGraphics AccelECLIPSE"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10bb[] = "Dapha Electronics Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10bc[] = "Advanced Logic Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10bd[] = "Surecom Technology"; +static const char pci_device_10bd_0e34[] = "NE-34"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10be[] = "Tseng Labs International Co."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10bf[] = "Most Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c0[] = "Boca Research Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c1[] = "ICM Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c2[] = "Auspex Systems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c3[] = "Samsung Semiconductors, Inc."; +static const char pci_device_10c3_1100[] = "Smartether100 SC1100 LAN Adapter (i82557B)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c4[] = "Award Software International Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c5[] = "Xerox Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c6[] = "Rambus Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c7[] = "Media Vision"; +#endif +static const char pci_vendor_10c8[] = "Neomagic Corporation"; +static const char pci_device_10c8_0001[] = "NM2070 [MagicGraph 128]"; +static const char pci_device_10c8_0002[] = "NM2090 [MagicGraph 128V]"; +static const char pci_device_10c8_0003[] = "NM2093 [MagicGraph 128ZV]"; +static const char pci_device_10c8_0004[] = "NM2160 [MagicGraph 128XD]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1014_00ba[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1025_1007[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1028_0074[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1028_0075[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1028_007d[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1028_007e[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_1033_802f[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_104d_801b[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_104d_802f[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_104d_830b[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10ba_0e00[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10c8_0004[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10cf_1029[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10f7_8308[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10f7_8309[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10f7_830b[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10f7_830d[] = "MagicGraph 128XD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0004_10f7_8312[] = "MagicGraph 128XD"; +#endif +static const char pci_device_10c8_0005[] = "NM2200 [MagicGraph 256AV]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0005_1014_00dd[] = "ThinkPad 570"; +#endif +static const char pci_device_10c8_0006[] = "NM2360 [MagicMedia 256ZX]"; +static const char pci_device_10c8_0016[] = "NM2380 [MagicMedia 256XL+]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_0016_10c8_0016[] = "MagicMedia 256XL+"; +#endif +static const char pci_device_10c8_0025[] = "NM2230 [MagicGraph 256AV+]"; +static const char pci_device_10c8_0083[] = "NM2093 [MagicGraph 128ZV+]"; +static const char pci_device_10c8_8005[] = "NM2200 [MagicMedia 256AV Audio]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_0e11_b0d1[] = "MagicMedia 256AV Audio Device on Discovery"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_0e11_b126[] = "MagicMedia 256AV Audio Device on Durango"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_1014_00dd[] = "MagicMedia 256AV Audio Device on BlackTip Thinkpad"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_1025_1003[] = "MagicMedia 256AV Audio Device on TravelMate 720"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_1028_008f[] = "MagicMedia 256AV Audio Device on Colorado Inspiron"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_103c_0007[] = "MagicMedia 256AV Audio Device on Voyager II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_103c_0008[] = "MagicMedia 256AV Audio Device on Voyager III"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_103c_000d[] = "MagicMedia 256AV Audio Device on Omnibook 900"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_10c8_8005[] = "MagicMedia 256AV Audio Device on FireAnt"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_110a_8005[] = "MagicMedia 256AV Audio Device"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10c8_8005_14c0_0004[] = "MagicMedia 256AV Audio Device"; +#endif +static const char pci_device_10c8_8006[] = "NM2360 [MagicMedia 256ZX Audio]"; +static const char pci_device_10c8_8016[] = "NM2380 [MagicMedia 256XL+ Audio]"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10c9[] = "Dataexpert Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ca[] = "Fujitsu Microelectr., Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10cb[] = "Omron Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10cc[] = "Mentor ARC Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10cd[] = "Advanced System Products, Inc"; +static const char pci_device_10cd_1100[] = "ASC1100"; +static const char pci_device_10cd_1200[] = "ASC1200 [(abp940) Fast SCSI-II]"; +static const char pci_device_10cd_1300[] = "ABP940-U / ABP960-U"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10cd_1300_10cd_1310[] = "ASC1300 SCSI Adapter"; +#endif +static const char pci_device_10cd_2300[] = "ABP940-UW"; +static const char pci_device_10cd_2500[] = "ABP940-U2W"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ce[] = "Radius"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10cf[] = "Citicorp TTI"; +static const char pci_device_10cf_2001[] = "mb86605"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d0[] = "Fujitsu Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d1[] = "FuturePlus Systems Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d2[] = "Molex Incorporated"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d3[] = "Jabil Circuit Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d4[] = "Hualon Microelectronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d5[] = "Autologic Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d6[] = "Cetia"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d7[] = "BCM Advanced Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d8[] = "Advanced Peripherals Labs"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10d9[] = "Macronix, Inc. [MXIC]"; +static const char pci_device_10d9_0512[] = "MX98713"; +static const char pci_device_10d9_0531[] = "MX987x5"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10d9_0531_1186_1200[] = "DFE-540TX ProFAST 10/100 Adapter"; +#endif +static const char pci_device_10d9_8625[] = "MX86250"; +static const char pci_device_10d9_8888[] = "MX86200"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10da[] = "Compaq IPG-Austin"; +static const char pci_device_10da_0508[] = "TC4048 Token Ring 4/16"; +static const char pci_device_10da_3390[] = "Tl3c3x9"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10db[] = "Rohm LSI Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10dc[] = "CERN/ECP/EDU"; +static const char pci_device_10dc_0001[] = "STAR/RD24 SCI-PCI (PMC)"; +static const char pci_device_10dc_0002[] = "TAR/RD24 SCI-PCI (PMC)"; +static const char pci_device_10dc_0021[] = "HIPPI destination"; +static const char pci_device_10dc_0022[] = "HIPPI source"; +static const char pci_device_10dc_10dc[] = "ATT2C15-3 FPGA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10dd[] = "Evans & Sutherland"; +#endif +static const char pci_vendor_10de[] = "nVidia Corporation"; +static const char pci_device_10de_0008[] = "NV1 [EDGE 3D]"; +static const char pci_device_10de_0009[] = "NV1 [EDGE 3D]"; +static const char pci_device_10de_0010[] = "NV2 [Mutara V08]"; +static const char pci_device_10de_0020[] = "NV4 [RIVA TNT]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1043_0200[] = "V3400 TNT"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1048_0c18[] = "Erazor II SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1048_0c1b[] = "Erazor II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_0550[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_0552[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4804[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4808[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4810[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4812[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4815[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4820[] = "Viper V550 with TV out"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4822[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4904[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_4914[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1092_8225[] = "Viper V550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_10b4_273d[] = "Velocity 4400"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_10b4_273e[] = "Velocity 4400"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_10b4_2740[] = "Velocity 4400"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_10de_0020[] = "Riva TNT"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1102_1015[] = "Graphics Blaster CT6710"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0020_1102_1016[] = "Graphics Blaster RIVA TNT"; +#endif +static const char pci_device_10de_0028[] = "NV5 [RIVA TNT2/TNT2 Pro]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1043_0200[] = "AGP-V3800 SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1043_0201[] = "AGP-V3800 SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1043_0205[] = "PCI-V3800"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1043_4000[] = "AGP-V3800PRO"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1092_4804[] = "Viper V770"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1092_4a00[] = "Viper V770"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1092_4a02[] = "Viper V770 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1092_5a00[] = "RIVA TNT2/TNT2 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1092_6a02[] = "Viper V770 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1092_7a02[] = "Viper V770 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_10de_0005[] = "RIVA TNT2 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_10de_000f[] = "Compaq NVIDIA TNT2 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1102_1020[] = "3D Blaster RIVA TNT2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_1102_1026[] = "3D Blaster RIVA TNT2 Digital"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0028_14af_5810[] = "Maxi Gamer Xentor"; +#endif +static const char pci_device_10de_0029[] = "NV5 [RIVA TNT2 Ultra]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_1043_0200[] = "AGP-V3800 Deluxe"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_1043_0201[] = "AGP-V3800 Ultra SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_1043_0205[] = "PCI-V3800 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_1102_1021[] = "3D Blaster RIVA TNT2 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_1102_1029[] = "3D Blaster RIVA TNT2 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_1102_102f[] = "3D Blaster RIVA TNT2 Ultra"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0029_14af_5820[] = "Maxi Gamer Xentor 32"; +#endif +static const char pci_device_10de_002a[] = "NV5 [Riva TnT2]"; +static const char pci_device_10de_002b[] = "NV5 [Riva TnT2]"; +static const char pci_device_10de_002c[] = "NV6 [Vanta/Vanta LT]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002c_1043_0200[] = "AGP-V3800 Combat SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002c_1043_0201[] = "AGP-V3800 Combat"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002c_1092_6820[] = "Viper V730"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002c_1102_1031[] = "CT6938 VANTA 8MB"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002c_1102_1034[] = "CT6894 VANTA 16MB"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002c_14af_5008[] = "Maxi Gamer Phoenix 2"; +#endif +static const char pci_device_10de_002d[] = "NV5M64 [RIVA TNT2 Model 64/Model 64 Pro]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1043_0200[] = "AGP-V3800M"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1043_0201[] = "AGP-V3800M"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1048_0c3a[] = "Erazor III LT"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_10de_001e[] = "M64 AGP4x"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1102_1023[] = "CT6892 RIVA TNT2 Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1102_1024[] = "CT6932 RIVA TNT2 Value 32Mb"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1102_102c[] = "CT6931 RIVA TNT2 Value [Jumper]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1462_8808[] = "MSI-8808"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_002d_1554_1041[] = "PixelView RIVA TNT2 M64 32MB"; +#endif +static const char pci_device_10de_002e[] = "NV6 [Vanta]"; +static const char pci_device_10de_002f[] = "NV6 [Vanta]"; +static const char pci_device_10de_0060[] = "nForce2 ISA Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0060_1043_80ad[] = "A7N8X Mainboard"; +#endif +static const char pci_device_10de_0064[] = "nForce2 SMBus (MCP)"; +static const char pci_device_10de_0065[] = "nForce2 IDE"; +static const char pci_device_10de_0066[] = "nForce2 Ethernet Controller"; +static const char pci_device_10de_0067[] = "nForce2 USB Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0067_1043_0c11[] = "A7N8X Mainboard"; +#endif +static const char pci_device_10de_0068[] = "nForce2 USB Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0068_1043_0c11[] = "A7N8X Mainboard"; +#endif +static const char pci_device_10de_006a[] = "nForce2 AC97 Audio Controler (MCP)"; +static const char pci_device_10de_006b[] = "nForce MultiMedia audio [Via VT82C686B]"; +static const char pci_device_10de_006e[] = "nForce2 FireWire (IEEE 1394) Controller"; +static const char pci_device_10de_00a0[] = "NV5 [Aladdin TNT2]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_00a0_14af_5810[] = "Maxi Gamer Xentor"; +#endif +static const char pci_device_10de_0100[] = "NV10 [GeForce 256 SDR]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0100_1043_0200[] = "AGP-V6600 SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0100_1043_0201[] = "AGP-V6600 SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0100_1043_4008[] = "AGP-V6600 SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0100_1043_4009[] = "AGP-V6600 SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0100_1102_102d[] = "CT6941 GeForce 256"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0100_14af_5022[] = "3D Prophet SE"; +#endif +static const char pci_device_10de_0101[] = "NV10DDR [GeForce 256 DDR]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0101_1043_0202[] = "AGP-V6800 DDR"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0101_1043_400a[] = "AGP-V6800 DDR SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0101_1043_400b[] = "AGP-V6800 DDR SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0101_1102_102e[] = "CT6971 GeForce 256 DDR"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0101_14af_5021[] = "3D Prophet DDR-DVI"; +#endif +static const char pci_device_10de_0103[] = "NV10GL [Quadro]"; +static const char pci_device_10de_0110[] = "NV11 [GeForce2 MX/MX 400]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0110_1043_4015[] = "AGP-V7100 Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0110_1043_4031[] = "V7100 Pro with TV output"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0110_1462_8817[] = "MSI GeForce2 MX400 Pro32S [MS-8817]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0110_14af_7102[] = "3D Prophet II MX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0110_14af_7103[] = "3D Prophet II MX Dual-Display"; +#endif +static const char pci_device_10de_0111[] = "NV11DDR [GeForce2 MX 100 DDR/200 DDR]"; +static const char pci_device_10de_0112[] = "NV11 [GeForce2 Go]"; +static const char pci_device_10de_0113[] = "NV11GL [Quadro2 MXR/EX]"; +static const char pci_device_10de_0150[] = "NV15 [GeForce2 GTS/Pro]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0150_1043_4016[] = "V7700 AGP Video Card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0150_107d_2840[] = "WinFast GeForce2 GTS with TV output"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0150_1462_8831[] = "Creative GeForce2 Pro"; +#endif +static const char pci_device_10de_0151[] = "NV15DDR [GeForce2 Ti]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0151_1043_405f[] = "V7700Ti"; +#endif +static const char pci_device_10de_0152[] = "NV15BR [GeForce2 Ultra, Bladerunner]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0152_1048_0c56[] = "GLADIAC Ultra"; +#endif +static const char pci_device_10de_0153[] = "NV15GL [Quadro2 Pro]"; +static const char pci_device_10de_0170[] = "NV17 [GeForce4 MX 460]"; +static const char pci_device_10de_0171[] = "NV17 [GeForce4 MX 440]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0171_1462_8661[] = "G4MX440-VTP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0171_1462_8730[] = "MX440SES-T (MS-8873)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0171_147b_8f00[] = "Abit Siluro GeForce4MX440"; +#endif +static const char pci_device_10de_0172[] = "NV17 [GeForce4 MX 420]"; +static const char pci_device_10de_0173[] = "NV17 [GeForce4 MX 440-SE]"; +static const char pci_device_10de_0174[] = "NV17 [GeForce4 440 Go]"; +static const char pci_device_10de_0175[] = "NV17 [GeForce4 420 Go]"; +static const char pci_device_10de_0176[] = "NV17 [GeForce4 420 Go 32M]"; +static const char pci_device_10de_0178[] = "NV17GL [Quadro4 550 XGL]"; +static const char pci_device_10de_0179[] = "NV17 [GeForce4 440 Go 64M]"; +static const char pci_device_10de_017a[] = "NV17GL [Quadro4 200/400 NVS]"; +static const char pci_device_10de_017b[] = "NV17GL [Quadro4 550 XGL]"; +static const char pci_device_10de_017c[] = "NV17GL [Quadro4 550 GoGL]"; +static const char pci_device_10de_0181[] = "NV18 [GeForce4 MX 440 AGP 8x]"; +static const char pci_device_10de_0182[] = "NV18 [GeForce4 MX 440SE AGP 8x]"; +static const char pci_device_10de_0183[] = "NV18 [GeForce4 MX 420 AGP 8x]"; +static const char pci_device_10de_0188[] = "NV18GL [Quadro4 580 XGL]"; +static const char pci_device_10de_018a[] = "NV18GL [Quadro4 NVS]"; +static const char pci_device_10de_018b[] = "NV18GL [Quadro4 380 XGL]"; +static const char pci_device_10de_01a0[] = "NV15 [GeForce2 - nForce GPU]"; +static const char pci_device_10de_01a4[] = "nForce CPU bridge"; +static const char pci_device_10de_01ab[] = "nForce 420 Memory Controller (DDR)"; +static const char pci_device_10de_01ac[] = "nForce 220/420 Memory Controller"; +static const char pci_device_10de_01ad[] = "nForce 220/420 Memory Controller"; +static const char pci_device_10de_01b1[] = "nForce Audio"; +static const char pci_device_10de_01b2[] = "nForce ISA Bridge"; +static const char pci_device_10de_01b4[] = "nForce PCI System Management"; +static const char pci_device_10de_01b7[] = "nForce AGP to PCI Bridge"; +static const char pci_device_10de_01b8[] = "nForce PCI-to-PCI bridge"; +static const char pci_device_10de_01bc[] = "nForce IDE"; +static const char pci_device_10de_01c1[] = "Intel 537 [nForce MC97 Modem]"; +static const char pci_device_10de_01c2[] = "nForce USB Controller"; +static const char pci_device_10de_01c3[] = "nForce Ethernet Controller"; +static const char pci_device_10de_01e8[] = "nForce2 AGP"; +static const char pci_device_10de_01f0[] = "NV18 [GeForce4 MX - nForce GPU]"; +static const char pci_device_10de_0200[] = "NV20 [GeForce3]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0200_1043_402f[] = "AGP-V8200 DDR"; +#endif +static const char pci_device_10de_0201[] = "NV20 [GeForce3 Ti 200]"; +static const char pci_device_10de_0202[] = "NV20 [GeForce3 Ti 500]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0202_1043_405b[] = "V8200 T5"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0202_1545_002f[] = "Xtasy 6964"; +#endif +static const char pci_device_10de_0203[] = "NV20DCC [Quadro DCC]"; +static const char pci_device_10de_0250[] = "NV25 [GeForce4 Ti 4600]"; +static const char pci_device_10de_0251[] = "NV25 [GeForce4 Ti 4400]"; +static const char pci_device_10de_0252[] = "NV25 [GeForce4 Ti]"; +static const char pci_device_10de_0253[] = "NV25 [GeForce4 Ti 4200]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0253_107d_2896[] = "WinFast A250 LE TD (Dual VGA/TV-out/DVI)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10de_0253_147b_8f09[] = "Siluro (Dual VGA/TV-out/DVI)"; +#endif +static const char pci_device_10de_0258[] = "NV25GL [Quadro4 900 XGL]"; +static const char pci_device_10de_0259[] = "NV25GL [Quadro4 750 XGL]"; +static const char pci_device_10de_025b[] = "NV25GL [Quadro4 700 XGL]"; +static const char pci_device_10de_0280[] = "NV28 [GeForce4 Ti 4800]"; +static const char pci_device_10de_0281[] = "NV28 [GeForce4 Ti 4200 AGP 8x]"; +static const char pci_device_10de_0282[] = "NV28 [GeForce4 Ti 4800 SE]"; +static const char pci_device_10de_0288[] = "NV28GL [Quadro4 980 XGL]"; +static const char pci_device_10de_0289[] = "NV28GL [Quadro4 780 XGL]"; +static const char pci_device_10de_0300[] = "NV30 [GeForce FX]"; +static const char pci_device_10de_0301[] = "NV30 [GeForce FX 5800 Ultra]"; +static const char pci_device_10de_0302[] = "NV30 [GeForce FX 5800]"; +static const char pci_device_10de_0308[] = "NV30GL [Quadro FX 2000]"; +static const char pci_device_10de_0309[] = "NV30GL [Quadro FX 1000]"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10df[] = "Emulex Corporation"; +static const char pci_device_10df_1ae5[] = "LP6000 Fibre Channel Host Adapter"; +static const char pci_device_10df_f085[] = "LP850 Fibre Channel Adapter"; +static const char pci_device_10df_f095[] = "LP952 Fibre Channel Adapter"; +static const char pci_device_10df_f098[] = "LP982 Fibre Channel Adapter"; +static const char pci_device_10df_f700[] = "LP7000 Fibre Channel Host Adapter"; +static const char pci_device_10df_f800[] = "LP8000 Fibre Channel Host Adapter"; +static const char pci_device_10df_f900[] = "LP9000 Fibre Channel Host Adapter"; +static const char pci_device_10df_f980[] = "LP9802 Fibre Channel Adapter"; +#endif +static const char pci_vendor_10e0[] = "Integrated Micro Solutions Inc."; +static const char pci_device_10e0_5026[] = "IMS5026/27/28"; +static const char pci_device_10e0_5027[] = "IMS5027"; +static const char pci_device_10e0_5028[] = "IMS5028"; +static const char pci_device_10e0_8849[] = "IMS8849"; +static const char pci_device_10e0_8853[] = "IMS8853"; +static const char pci_device_10e0_9128[] = "IMS9128 [Twin turbo 128]"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e1[] = "Tekram Technology Co.,Ltd."; +static const char pci_device_10e1_0391[] = "TRM-S1040"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10e1_0391_10e1_0391[] = "DC-315U SCSI-3 Host Adapter"; +#endif +static const char pci_device_10e1_690c[] = "DC-690c"; +static const char pci_device_10e1_dc29[] = "DC-290"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e2[] = "Aptix Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e3[] = "Tundra Semiconductor Corp."; +static const char pci_device_10e3_0000[] = "CA91C042 [Universe]"; +static const char pci_device_10e3_0860[] = "CA91C860 [QSpan]"; +static const char pci_device_10e3_0862[] = "CA91C862A [QSpan-II]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e4[] = "Tandem Computers"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e5[] = "Micro Industries Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e6[] = "Gainbery Computer Products Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e7[] = "Vadem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e8[] = "Applied Micro Circuits Corp."; +static const char pci_device_10e8_2011[] = "Q-Motion Video Capture/Edit board"; +static const char pci_device_10e8_4750[] = "S5930 [Matchmaker]"; +static const char pci_device_10e8_5920[] = "S5920"; +static const char pci_device_10e8_8043[] = "LANai4.x [Myrinet LANai interface chip]"; +static const char pci_device_10e8_8062[] = "S5933_PARASTATION"; +static const char pci_device_10e8_807d[] = "S5933 [Matchmaker]"; +static const char pci_device_10e8_8088[] = "Kongsberg Spacetec Format Synchronizer"; +static const char pci_device_10e8_8089[] = "Kongsberg Spacetec Serial Output Board"; +static const char pci_device_10e8_809c[] = "S5933_HEPC3"; +static const char pci_device_10e8_80d7[] = "PCI-9112"; +static const char pci_device_10e8_80d9[] = "PCI-9118"; +static const char pci_device_10e8_80da[] = "PCI-9812"; +static const char pci_device_10e8_811a[] = "PCI-IEEE1355-DS-DE Interface"; +static const char pci_device_10e8_8170[] = "S5933 [Matchmaker] (Chipset Development Tool)"; +static const char pci_device_10e8_82db[] = "AJA HDNTV HD SDI Framestore"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10e9[] = "Alps Electric Co., Ltd."; +#endif +static const char pci_vendor_10ea[] = "Intergraphics Systems"; +static const char pci_device_10ea_1680[] = "IGA-1680"; +static const char pci_device_10ea_1682[] = "IGA-1682"; +static const char pci_device_10ea_1683[] = "IGA-1683"; +static const char pci_device_10ea_2000[] = "CyberPro 2000"; +static const char pci_device_10ea_2010[] = "CyberPro 2000A"; +static const char pci_device_10ea_5000[] = "CyberPro 5000"; +static const char pci_device_10ea_5050[] = "CyberPro 5050"; +static const char pci_device_10ea_5202[] = "CyberPro 5202"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10eb[] = "Artists Graphics"; +static const char pci_device_10eb_0101[] = "3GA"; +static const char pci_device_10eb_8111[] = "Twist3 Frame Grabber"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ec[] = "Realtek Semiconductor Co., Ltd."; +static const char pci_device_10ec_8029[] = "RTL-8029(AS)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8029_10b8_2011[] = "EZ-Card (SMC1208)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8029_10ec_8029[] = "RTL-8029(AS)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8029_1113_1208[] = "EN1208"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8029_1186_0300[] = "DE-528"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8029_1259_2400[] = "AT-2400"; +#endif +static const char pci_device_10ec_8129[] = "RTL-8129"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8129_10ec_8129[] = "RT8129 Fast Ethernet Adapter"; +#endif +static const char pci_device_10ec_8138[] = "RT8139 (B/C) Cardbus Fast Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8138_10ec_8138[] = "RT8139 (B/C) Fast Ethernet Adapter"; +#endif +static const char pci_device_10ec_8139[] = "RTL-8139/8139C/8139C+"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1025_8920[] = "ALN-325"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1025_8921[] = "ALN-325"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_10bd_0320[] = "EP-320X-R"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_10ec_8139[] = "RT8139"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1186_1300[] = "DFE-538TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1186_1320[] = "SN5200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1186_8139[] = "DRN-32TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_11f6_8139[] = "FN22-3(A) LinxPRO Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1259_2500[] = "AT-2500TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1259_2503[] = "AT-2500TX/ACPI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1429_d010[] = "ND010"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1432_9130[] = "EN-9130TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1436_8139[] = "RT8139"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_146c_1439[] = "FE-1439TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1489_6001[] = "GF100TXRII"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_1489_6002[] = "GF100TXRA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_149c_139a[] = "LFE-8139ATX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_149c_8139[] = "LFE-8139TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_2646_0001[] = "EtheRx"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_8e2e_7000[] = "KF-230TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_8e2e_7100[] = "KF-230TX/2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8139_a0a0_0007[] = "ALN-325C"; +#endif +static const char pci_device_10ec_8169[] = "RTL-8169"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_10ec_8169_1371_434e[] = "ProG-2000L"; +#endif +static const char pci_device_10ec_8197[] = "SmartLAN56 56K Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ed[] = "Ascii Corporation"; +static const char pci_device_10ed_7310[] = "V7310"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ee[] = "Xilinx Corporation"; +static const char pci_device_10ee_3fc0[] = "RME Digi96"; +static const char pci_device_10ee_3fc1[] = "RME Digi96/8"; +static const char pci_device_10ee_3fc2[] = "RME Digi96/8 Pro"; +static const char pci_device_10ee_3fc3[] = "RME Digi96/8 Pad"; +static const char pci_device_10ee_3fc4[] = "RME Digi9652 (Hammerfall)"; +static const char pci_device_10ee_3fc5[] = "RME Hammerfall DSP"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ef[] = "Racore Computer Products, Inc."; +static const char pci_device_10ef_8154[] = "M815x Token Ring Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f0[] = "Peritek Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f1[] = "Tyan Computer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f2[] = "Achme Computer, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f3[] = "Alaris, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f4[] = "S-MOS Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f5[] = "NKK Corporation"; +static const char pci_device_10f5_a001[] = "NDR4000 [NR4600 Bridge]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f6[] = "Creative Electronic Systems SA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f7[] = "Matsushita Electric Industrial Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f8[] = "Altos India Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10f9[] = "PC Direct"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10fa[] = "Truevision"; +static const char pci_device_10fa_000c[] = "TARGA 1000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10fb[] = "Thesys Gesellschaft für Mikroelektronik mbH"; +static const char pci_device_10fb_186f[] = "TH 6255"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10fc[] = "I-O Data Device, Inc."; +static const char pci_device_10fc_0003[] = "Cardbus IDE Controller"; +static const char pci_device_10fc_0005[] = "Cardbus SCSI CBSC II"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10fd[] = "Soyo Computer, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10fe[] = "Fast Multimedia AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_10ff[] = "NCube"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1100[] = "Jazz Multimedia"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1101[] = "Initio Corporation"; +static const char pci_device_1101_1060[] = "INI-A100U2W"; +static const char pci_device_1101_9100[] = "INI-9100/9100W"; +static const char pci_device_1101_9400[] = "INI-940"; +static const char pci_device_1101_9401[] = "INI-950"; +static const char pci_device_1101_9500[] = "360P"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1102[] = "Creative Labs"; +static const char pci_device_1102_0002[] = "SB Live! EMU10k1"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_0020[] = "CT4850 SBLive! Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_0021[] = "CT4620 SBLive!"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_002f[] = "SBLive! mainboard implementation"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_4001[] = "E-mu APS"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8022[] = "CT4780 SBLive! Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8023[] = "CT4790 SoundBlaster PCI512"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8024[] = "CT4760 SBLive!"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8025[] = "SBLive! Mainboard Implementation"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8026[] = "CT4830 SBLive! Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8027[] = "CT4832 SBLive! Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8028[] = "CT4760 SBLive! OEM version"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8031[] = "CT4831 SBLive! Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8040[] = "CT4760 SBLive!"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8051[] = "CT4850 SBLive! Value"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0002_1102_8061[] = "SBLive! Player 5.1"; +#endif +static const char pci_device_1102_0004[] = "SB Audigy"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0004_1102_0051[] = "SB0090 Audigy Player"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_0004_1102_0053[] = "SB0090 Audigy Player/OEM"; +#endif +static const char pci_device_1102_0006[] = "[SB Live! Value] EMU10k1X"; +static const char pci_device_1102_4001[] = "SB Audigy FireWire Port"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_4001_1102_0010[] = "SB Audigy FireWire Port"; +#endif +static const char pci_device_1102_7002[] = "SB Live! MIDI/Game Port"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_7002_1102_0020[] = "Gameport Joystick"; +#endif +static const char pci_device_1102_7003[] = "SB Audigy MIDI/Game port"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1102_7003_1102_0040[] = "SB Audigy MIDI/Game Port"; +#endif +static const char pci_device_1102_7004[] = "[SB Live! Value] Input device controller"; +static const char pci_device_1102_8064[] = "SB0100 [SBLive! 5.1 OEM]"; +static const char pci_device_1102_8938[] = "ES1371"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1103[] = "Triones Technologies, Inc."; +static const char pci_device_1103_0003[] = "HPT343"; +static const char pci_device_1103_0004[] = "HPT366/368/370/370A/372"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1103_0004_1103_0001[] = "HPT370A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1103_0004_1103_0005[] = "HPT370 UDMA100"; +#endif +static const char pci_device_1103_0005[] = "HPT372A"; +static const char pci_device_1103_0006[] = "HPT302"; +static const char pci_device_1103_0007[] = "HPT371"; +static const char pci_device_1103_0008[] = "HPT374"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1104[] = "RasterOps Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1105[] = "Sigma Designs, Inc."; +static const char pci_device_1105_1105[] = "REALmagic Xcard MPEG 1/2/3/4 DVD Decoder"; +static const char pci_device_1105_8300[] = "REALmagic Hollywood Plus DVD Decoder"; +static const char pci_device_1105_8400[] = "EM840x REALmagic DVD/MPEG-2 Audio/Video Decoder"; +#endif +static const char pci_vendor_1106[] = "VIA Technologies, Inc."; +static const char pci_device_1106_0102[] = "Embedded VIA Ethernet Controller"; +static const char pci_device_1106_0130[] = "VT6305 1394.A Controller"; +static const char pci_device_1106_0305[] = "VT8363/8365 [KT133/KM133]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0305_1043_8033[] = "A7V Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0305_1043_803e[] = "A7V-E Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0305_1043_8042[] = "A7V133/A7V133-C Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0305_147b_a401[] = "KT7/KT7-RAID/KT7A/KT7A-RAID Mainboard"; +#endif +static const char pci_device_1106_0391[] = "VT8371 [KX133]"; +static const char pci_device_1106_0501[] = "VT8501 [Apollo MVP4]"; +static const char pci_device_1106_0505[] = "VT82C505"; +static const char pci_device_1106_0561[] = "VT82C561"; +static const char pci_device_1106_0571[] = "VT82C586/B/686A/B PIPC Bus Master IDE"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0571_1043_8052[] = "VT8233A Bus Master ATA100/66/33 IDE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0571_1106_0571[] = "VT8235 Bus Master ATA133/100/66/33 IDE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0571_1179_0001[] = "Magnia Z310"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0571_1458_5002[] = "GA-7VAX Mainboard"; +#endif +static const char pci_device_1106_0576[] = "VT82C576 3V [Apollo Master]"; +static const char pci_device_1106_0585[] = "VT82C585VP [Apollo VP1/VPX]"; +static const char pci_device_1106_0586[] = "VT82C586/A/B PCI-to-ISA [Apollo VP]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0586_1106_0000[] = "MVP3 ISA Bridge"; +#endif +static const char pci_device_1106_0595[] = "VT82C595 [Apollo VP2]"; +static const char pci_device_1106_0596[] = "VT82C596 ISA [Mobile South]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0596_1106_0000[] = "VT82C596/A/B PCI to ISA Bridge"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0596_1458_0596[] = "VT82C596/A/B PCI to ISA Bridge"; +#endif +static const char pci_device_1106_0597[] = "VT82C597 [Apollo VP3]"; +static const char pci_device_1106_0598[] = "VT82C598 [Apollo MVP3]"; +static const char pci_device_1106_0601[] = "VT8601 [Apollo ProMedia]"; +static const char pci_device_1106_0605[] = "VT8605 [ProSavage PM133]"; +static const char pci_device_1106_0680[] = "VT82C680 [Apollo P6]"; +static const char pci_device_1106_0686[] = "VT82C686 [Apollo Super South]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1043_8033[] = "A7V Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1043_803e[] = "A7V-E Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1043_8040[] = "A7M266 Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1043_8042[] = "A7V133/A7V133-C Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1106_0000[] = "VT82C686/A PCI to ISA Bridge"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1106_0686[] = "VT82C686/A PCI to ISA Bridge"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_1179_0001[] = "Magnia Z310"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0686_147b_a702[] = "KG7-Lite Mainboard"; +#endif +static const char pci_device_1106_0691[] = "VT82C693A/694x [Apollo PRO133x]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0691_1179_0001[] = "Magnia Z310"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_0691_1458_0691[] = "VT82C691 Apollo Pro System Controller"; +#endif +static const char pci_device_1106_0693[] = "VT82C693 [Apollo Pro Plus]"; +static const char pci_device_1106_0698[] = "VT82C693A [Apollo Pro133 AGP]"; +static const char pci_device_1106_0926[] = "VT82C926 [Amazon]"; +static const char pci_device_1106_1000[] = "VT82C570MV"; +static const char pci_device_1106_1106[] = "VT82C570MV"; +static const char pci_device_1106_1571[] = "VT82C416MV"; +static const char pci_device_1106_1595[] = "VT82C595/97 [Apollo VP2/97]"; +static const char pci_device_1106_3038[] = "USB"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3038_0925_1234[] = "USB Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3038_1179_0001[] = "Magnia Z310"; +#endif +static const char pci_device_1106_3040[] = "VT82C586B ACPI"; +static const char pci_device_1106_3043[] = "VT86C100A [Rhine]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3043_10bd_0000[] = "VT86C100A Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3043_1106_0100[] = "VT86C100A Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3043_1186_1400[] = "DFE-530TX rev A"; +#endif +static const char pci_device_1106_3044[] = "IEEE 1394 Host Controller"; +static const char pci_device_1106_3050[] = "VT82C596 Power Management"; +static const char pci_device_1106_3051[] = "VT82C596 Power Management"; +static const char pci_device_1106_3057[] = "VT82C686 [Apollo Super ACPI]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3057_1043_8033[] = "A7V Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3057_1043_803e[] = "A7V-E Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3057_1043_8040[] = "A7M266 Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3057_1043_8042[] = "A7V133/A7V133-C Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3057_1179_0001[] = "Magnia Z310"; +#endif +static const char pci_device_1106_3058[] = "VT82C686 AC97 Audio Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3058_0e11_b194[] = "Soundmax integrated digital audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3058_1106_4511[] = "Onboard Audio on EP7KXA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3058_1458_7600[] = "Onboard Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3058_1462_3091[] = "MS-6309 Onboard Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3058_15dd_7609[] = "Onboard Audio"; +#endif +static const char pci_device_1106_3059[] = "VT8233 AC97 Audio Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3059_1458_a002[] = "GA-7VAX Onboard Audio (Realtek ALC650)"; +#endif +static const char pci_device_1106_3065[] = "VT6102 [Rhine-II]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3065_1106_0102[] = "VT6102 [Rhine II] Embeded Ethernet Controller on VT8235"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3065_1186_1400[] = "DFE-530TX rev A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3065_1186_1401[] = "DFE-530TX rev B"; +#endif +static const char pci_device_1106_3068[] = "Intel 537 [AC97 Modem]"; +static const char pci_device_1106_3074[] = "VT8233 PCI to ISA Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3074_1043_8052[] = "VT8233A"; +#endif +static const char pci_device_1106_3091[] = "VT8633 [Apollo Pro266]"; +static const char pci_device_1106_3099[] = "VT8366/A/7 [Apollo KT266/A/333]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3099_1043_8064[] = "A7V266-E Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3099_1043_807f[] = "A7V333 Mainboard"; +#endif +static const char pci_device_1106_3101[] = "VT8653 Host Bridge"; +static const char pci_device_1106_3102[] = "VT8662 Host Bridge"; +static const char pci_device_1106_3103[] = "VT8615 Host Bridge"; +static const char pci_device_1106_3104[] = "USB 2.0"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3104_1458_5004[] = "GA-7VAX Mainboard"; +#endif +static const char pci_device_1106_3106[] = "VT6105 [Rhine-III]"; +static const char pci_device_1106_3109[] = "VT8233C PCI to ISA Bridge"; +static const char pci_device_1106_3112[] = "VT8361 [KLE133] Host Bridge"; +static const char pci_device_1106_3116[] = "VT8375 [KM266] Host Bridge"; +static const char pci_device_1106_3122[] = "VT8623 [Apollo CLE266] integrated CastleRock graphics"; +static const char pci_device_1106_3123[] = "VT8623 [Apollo CLE266]"; +static const char pci_device_1106_3128[] = "VT8753 [P4X266 AGP]"; +static const char pci_device_1106_3133[] = "VT3133 Host Bridge"; +static const char pci_device_1106_3147[] = "VT8233A ISA Bridge"; +static const char pci_device_1106_3148[] = "P4M266 Host Bridge"; +static const char pci_device_1106_3156[] = "P/KN266 Host Bridge"; +static const char pci_device_1106_3168[] = "VT8374 P4X400 Host Controller/AGP Bridge"; +static const char pci_device_1106_3177[] = "VT8235 ISA Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3177_1458_5001[] = "GA-7VAX Mainboard"; +#endif +static const char pci_device_1106_3189[] = "VT8377 [KT400 AGP] Host Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1106_3189_1458_5000[] = "GA-7VAX Mainboard"; +#endif +static const char pci_device_1106_5030[] = "VT82C596 ACPI [Apollo PRO]"; +static const char pci_device_1106_6100[] = "VT85C100A [Rhine II]"; +static const char pci_device_1106_8231[] = "VT8231 [PCI-to-ISA Bridge]"; +static const char pci_device_1106_8235[] = "VT8235 ACPI"; +static const char pci_device_1106_8305[] = "VT8363/8365 [KT133/KM133 AGP]"; +static const char pci_device_1106_8391[] = "VT8371 [KX133 AGP]"; +static const char pci_device_1106_8501[] = "VT8501 [Apollo MVP4 AGP]"; +static const char pci_device_1106_8596[] = "VT82C596 [Apollo PRO AGP]"; +static const char pci_device_1106_8597[] = "VT82C597 [Apollo VP3 AGP]"; +static const char pci_device_1106_8598[] = "VT82C598/694x [Apollo MVP3/Pro133x AGP]"; +static const char pci_device_1106_8601[] = "VT8601 [Apollo ProMedia AGP]"; +static const char pci_device_1106_8605[] = "VT8605 [PM133 AGP]"; +static const char pci_device_1106_8691[] = "VT82C691 [Apollo Pro]"; +static const char pci_device_1106_8693[] = "VT82C693 [Apollo Pro Plus] PCI Bridge"; +static const char pci_device_1106_b091[] = "VT8633 [Apollo Pro266 AGP]"; +static const char pci_device_1106_b099[] = "VT8366/A/7 [Apollo KT266/A/333 AGP]"; +static const char pci_device_1106_b101[] = "VT8653 AGP Bridge"; +static const char pci_device_1106_b102[] = "VT8362 AGP Bridge"; +static const char pci_device_1106_b103[] = "VT8615 AGP Bridge"; +static const char pci_device_1106_b112[] = "VT8361 [KLE133] AGP Bridge"; +static const char pci_device_1106_b168[] = "VT8235 PCI Bridge"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1107[] = "Stratus Computers"; +static const char pci_device_1107_0576[] = "VIA VT82C570MV [Apollo] (Wrong vendor ID!)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1108[] = "Proteon, Inc."; +static const char pci_device_1108_0100[] = "p1690plus_AA"; +static const char pci_device_1108_0101[] = "p1690plus_AB"; +static const char pci_device_1108_0105[] = "P1690Plus"; +static const char pci_device_1108_0108[] = "P1690Plus"; +static const char pci_device_1108_0138[] = "P1690Plus"; +static const char pci_device_1108_0139[] = "P1690Plus"; +static const char pci_device_1108_013c[] = "P1690Plus"; +static const char pci_device_1108_013d[] = "P1690Plus"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1109[] = "Cogent Data Technologies, Inc."; +static const char pci_device_1109_1400[] = "EM110TX [EX110TX]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_110a[] = "Siemens Nixdorf AG"; +static const char pci_device_110a_0002[] = "Pirahna 2-port"; +static const char pci_device_110a_0005[] = "Tulip controller, power management, switch extender"; +static const char pci_device_110a_2102[] = "DSCC4 WAN adapter"; +static const char pci_device_110a_4942[] = "FPGA I-Bus Tracer for MBD"; +static const char pci_device_110a_6120[] = "SZB6120"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_110b[] = "Chromatic Research Inc."; +static const char pci_device_110b_0001[] = "Mpact Media Processor"; +static const char pci_device_110b_0004[] = "Mpact 2"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_110c[] = "Mini-Max Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_110d[] = "Znyx Advanced Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_110e[] = "CPU Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_110f[] = "Ross Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1110[] = "Powerhouse Systems"; +static const char pci_device_1110_6037[] = "Firepower Powerized SMP I/O ASIC"; +static const char pci_device_1110_6073[] = "Firepower Powerized SMP I/O ASIC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1111[] = "Santa Cruz Operation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1112[] = "Osicom Technologies Inc"; +static const char pci_device_1112_2200[] = "FDDI Adapter"; +static const char pci_device_1112_2300[] = "Fast Ethernet Adapter"; +static const char pci_device_1112_2340[] = "4 Port Fast Ethernet Adapter"; +static const char pci_device_1112_2400[] = "ATM Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1113[] = "Accton Technology Corporation"; +static const char pci_device_1113_1211[] = "SMC2-1211TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1113_1211_103c_1207[] = "EN-1207D Fast Ethernet Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1113_1211_1113_1211[] = "EN-1207D Fast Ethernet Adapter"; +#endif +static const char pci_device_1113_1216[] = "EN-1216 Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1113_1216_111a_1020[] = "SpeedStream 1020 PCI 10/100 Ethernet Adaptor [EN-1207F-TX ?]"; +#endif +static const char pci_device_1113_1217[] = "EN-1217 Ethernet Adapter"; +static const char pci_device_1113_5105[] = "10Mbps Network card"; +static const char pci_device_1113_9211[] = "EN-1207D Fast Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1113_9211_1113_9211[] = "EN-1207D Fast Ethernet Adapter"; +#endif +static const char pci_device_1113_9511[] = "Fast Ethernet Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1114[] = "Atmel Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1115[] = "3D Labs"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1116[] = "Data Translation"; +static const char pci_device_1116_0022[] = "DT3001"; +static const char pci_device_1116_0023[] = "DT3002"; +static const char pci_device_1116_0024[] = "DT3003"; +static const char pci_device_1116_0025[] = "DT3004"; +static const char pci_device_1116_0026[] = "DT3005"; +static const char pci_device_1116_0027[] = "DT3001-PGL"; +static const char pci_device_1116_0028[] = "DT3003-PGL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1117[] = "Datacube, Inc"; +static const char pci_device_1117_9500[] = "Max-1C SVGA card"; +static const char pci_device_1117_9501[] = "Max-1C image processing"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1118[] = "Berg Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1119[] = "ICP Vortex Computersysteme GmbH"; +static const char pci_device_1119_0000[] = "GDT 6000/6020/6050"; +static const char pci_device_1119_0001[] = "GDT 6000B/6010"; +static const char pci_device_1119_0002[] = "GDT 6110/6510"; +static const char pci_device_1119_0003[] = "GDT 6120/6520"; +static const char pci_device_1119_0004[] = "GDT 6530"; +static const char pci_device_1119_0005[] = "GDT 6550"; +static const char pci_device_1119_0006[] = "GDT 6x17"; +static const char pci_device_1119_0007[] = "GDT 6x27"; +static const char pci_device_1119_0008[] = "GDT 6537"; +static const char pci_device_1119_0009[] = "GDT 6557"; +static const char pci_device_1119_000a[] = "GDT 6115/6515"; +static const char pci_device_1119_000b[] = "GDT 6125/6525"; +static const char pci_device_1119_000c[] = "GDT 6535"; +static const char pci_device_1119_000d[] = "GDT 6555"; +static const char pci_device_1119_0100[] = "GDT 6117RP/6517RP"; +static const char pci_device_1119_0101[] = "GDT 6127RP/6527RP"; +static const char pci_device_1119_0102[] = "GDT 6537RP"; +static const char pci_device_1119_0103[] = "GDT 6557RP"; +static const char pci_device_1119_0104[] = "GDT 6111RP/6511RP"; +static const char pci_device_1119_0105[] = "GDT 6121RP/6521RP"; +static const char pci_device_1119_0110[] = "GDT 6117RD/6517RD"; +static const char pci_device_1119_0111[] = "GDT 6127RD/6527RD"; +static const char pci_device_1119_0112[] = "GDT 6537RD"; +static const char pci_device_1119_0113[] = "GDT 6557RD"; +static const char pci_device_1119_0114[] = "GDT 6111RD/6511RD"; +static const char pci_device_1119_0115[] = "GDT 6121RD/6521RD"; +static const char pci_device_1119_0118[] = "GDT 6118RD/6518RD/6618RD"; +static const char pci_device_1119_0119[] = "GDT 6128RD/6528RD/6628RD"; +static const char pci_device_1119_011a[] = "GDT 6538RD/6638RD"; +static const char pci_device_1119_011b[] = "GDT 6558RD/6658RD"; +static const char pci_device_1119_0120[] = "GDT 6117RP2/6517RP2"; +static const char pci_device_1119_0121[] = "GDT 6127RP2/6527RP2"; +static const char pci_device_1119_0122[] = "GDT 6537RP2"; +static const char pci_device_1119_0123[] = "GDT 6557RP2"; +static const char pci_device_1119_0124[] = "GDT 6111RP2/6511RP2"; +static const char pci_device_1119_0125[] = "GDT 6121RP2/6521RP2"; +static const char pci_device_1119_0136[] = "GDT 6113RS/6513RS"; +static const char pci_device_1119_0137[] = "GDT 6123RS/6523RS"; +static const char pci_device_1119_0138[] = "GDT 6118RS/6518RS/6618RS"; +static const char pci_device_1119_0139[] = "GDT 6128RS/6528RS/6628RS"; +static const char pci_device_1119_013a[] = "GDT 6538RS/6638RS"; +static const char pci_device_1119_013b[] = "GDT 6558RS/6658RS"; +static const char pci_device_1119_013c[] = "GDT 6533RS/6633RS"; +static const char pci_device_1119_013d[] = "GDT 6543RS/6643RS"; +static const char pci_device_1119_013e[] = "GDT 6553RS/6653RS"; +static const char pci_device_1119_013f[] = "GDT 6563RS/6663RS"; +static const char pci_device_1119_0166[] = "GDT 7113RN/7513RN/7613RN"; +static const char pci_device_1119_0167[] = "GDT 7123RN/7523RN/7623RN"; +static const char pci_device_1119_0168[] = "GDT 7118RN/7518RN/7518RN"; +static const char pci_device_1119_0169[] = "GDT 7128RN/7528RN/7628RN"; +static const char pci_device_1119_016a[] = "GDT 7538RN/7638RN"; +static const char pci_device_1119_016b[] = "GDT 7558RN/7658RN"; +static const char pci_device_1119_016c[] = "GDT 7533RN/7633RN"; +static const char pci_device_1119_016d[] = "GDT 7543RN/7643RN"; +static const char pci_device_1119_016e[] = "GDT 7553RN/7653RN"; +static const char pci_device_1119_016f[] = "GDT 7563RN/7663RN"; +static const char pci_device_1119_01d6[] = "GDT 4x13RZ"; +static const char pci_device_1119_01d7[] = "GDT 4x23RZ"; +static const char pci_device_1119_01f6[] = "GDT 8x13RZ"; +static const char pci_device_1119_01f7[] = "GDT 8x23RZ"; +static const char pci_device_1119_01fc[] = "GDT 8x33RZ"; +static const char pci_device_1119_01fd[] = "GDT 8x43RZ"; +static const char pci_device_1119_01fe[] = "GDT 8x53RZ"; +static const char pci_device_1119_01ff[] = "GDT 8x63RZ"; +static const char pci_device_1119_0210[] = "GDT 6519RD/6619RD"; +static const char pci_device_1119_0211[] = "GDT 6529RD/6629RD"; +static const char pci_device_1119_0260[] = "GDT 7519RN/7619RN"; +static const char pci_device_1119_0261[] = "GDT 7529RN/7629RN"; +static const char pci_device_1119_0300[] = "GDT Raid Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_111a[] = "Efficient Networks, Inc"; +static const char pci_device_111a_0000[] = "155P-MF1 (FPGA)"; +static const char pci_device_111a_0002[] = "155P-MF1 (ASIC)"; +static const char pci_device_111a_0003[] = "ENI-25P ATM"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0003_111a_0000[] = "ENI-25p Miniport ATM Adapter"; +#endif +static const char pci_device_111a_0005[] = "SpeedStream (LANAI)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0001[] = "ENI-3010 ATM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0009[] = "ENI-3060 ADSL (VPI=0)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0101[] = "ENI-3010 ATM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0109[] = "ENI-3060CO ADSL (VPI=0)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0809[] = "ENI-3060 ADSL (VPI=0 or 8)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0909[] = "ENI-3060CO ADSL (VPI=0 or 8)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0005_111a_0a09[] = "ENI-3060 ADSL (VPI=<0..15>)"; +#endif +static const char pci_device_111a_0007[] = "SpeedStream ADSL"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_111a_0007_111a_1001[] = "ENI-3061 ADSL [ASIC]"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_111b[] = "Teledyne Electronic Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_111c[] = "Tricord Systems Inc."; +static const char pci_device_111c_0001[] = "Powerbis Bridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_111d[] = "Integrated Device Tech"; +static const char pci_device_111d_0001[] = "IDT77211 ATM Adapter"; +static const char pci_device_111d_0003[] = "IDT77252 ATM network controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_111e[] = "Eldec"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_111f[] = "Precision Digital Images"; +static const char pci_device_111f_4a47[] = "Precision MX Video engine interface"; +static const char pci_device_111f_5243[] = "Frame capture bus interface"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1120[] = "EMC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1121[] = "Zilog"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1122[] = "Multi-tech Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1123[] = "Excellent Design, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1124[] = "Leutron Vision AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1125[] = "Eurocore"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1126[] = "Vigra"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1127[] = "FORE Systems Inc"; +static const char pci_device_1127_0200[] = "ForeRunner PCA-200 ATM"; +static const char pci_device_1127_0210[] = "PCA-200PC"; +static const char pci_device_1127_0250[] = "ATM"; +static const char pci_device_1127_0300[] = "ForeRunner PCA-200EPC ATM"; +static const char pci_device_1127_0310[] = "ATM"; +static const char pci_device_1127_0400[] = "ForeRunnerHE ATM Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1127_0400_1127_0400[] = "ForeRunnerHE ATM"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1129[] = "Firmworks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_112a[] = "Hermes Electronics Company, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_112b[] = "Linotype - Hell AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_112c[] = "Zenith Data Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_112d[] = "Ravicad"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_112e[] = "Infomedia Microelectronics Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_112f[] = "Imaging Technology Inc"; +static const char pci_device_112f_0000[] = "MVC IC-PCI"; +static const char pci_device_112f_0001[] = "MVC IM-PCI Video frame grabber/processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1130[] = "Computervision"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1131[] = "Philips Semiconductors"; +static const char pci_device_1131_1561[] = "USB 1.1 Host Controller"; +static const char pci_device_1131_1562[] = "USB 2.0 Host Controller"; +static const char pci_device_1131_3400[] = "SmartPCI56(UCB1500) 56K Modem"; +static const char pci_device_1131_7130[] = "SAA7130 Video Broadcast Decoder"; +static const char pci_device_1131_7133[] = "SAA7133 Audio+video broadcast decoder"; +static const char pci_device_1131_7134[] = "SAA7134"; +static const char pci_device_1131_7135[] = "SAA7135 Audio+video broadcast decoder"; +static const char pci_device_1131_7145[] = "SAA7145"; +static const char pci_device_1131_7146[] = "SAA7146"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1131_7146_114b_2003[] = "DVRaptor Video Edit/Capture Card"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1131_7146_11bd_0006[] = "DV500 Overlay"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1131_7146_11bd_000a[] = "DV500 Overlay"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1132[] = "Mitel Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1133[] = "Eicon Technology Corporation"; +static const char pci_device_1133_7901[] = "EiconCard S90"; +static const char pci_device_1133_7902[] = "EiconCard S90"; +static const char pci_device_1133_7911[] = "EiconCard S91"; +static const char pci_device_1133_7912[] = "EiconCard S91"; +static const char pci_device_1133_7941[] = "EiconCard S94"; +static const char pci_device_1133_7942[] = "EiconCard S94"; +static const char pci_device_1133_7943[] = "EiconCard S94"; +static const char pci_device_1133_7944[] = "EiconCard S94"; +static const char pci_device_1133_b921[] = "EiconCard P92"; +static const char pci_device_1133_b922[] = "EiconCard P92"; +static const char pci_device_1133_b923[] = "EiconCard P92"; +static const char pci_device_1133_e001[] = "DIVA 20PRO"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e001_1133_e001[] = "DIVA Pro 2.0 S/T"; +#endif +static const char pci_device_1133_e002[] = "DIVA 20"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e002_1133_e002[] = "DIVA 2.0 S/T"; +#endif +static const char pci_device_1133_e003[] = "DIVA 20PRO_U"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e003_1133_e003[] = "DIVA Pro 2.0 U"; +#endif +static const char pci_device_1133_e004[] = "DIVA 20_U"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e004_1133_e004[] = "DIVA 2.0 U"; +#endif +static const char pci_device_1133_e005[] = "DIVA LOW"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e005_1133_e005[] = "DIVA 2.01 S/T"; +#endif +static const char pci_device_1133_e00b[] = "DIVA 2.02"; +static const char pci_device_1133_e010[] = "DIVA Server BRI-2M"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e010_1133_e010[] = "DIVA Server BRI-2M"; +#endif +static const char pci_device_1133_e012[] = "DIVA Server BRI-8M"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e012_1133_e012[] = "DIVA Server BRI-8M"; +#endif +static const char pci_device_1133_e014[] = "DIVA Server PRI-30M"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1133_e014_1133_e014[] = "DIVA Server PRI-30M"; +#endif +static const char pci_device_1133_e018[] = "DIVA Server BRI-2M/-2F"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1134[] = "Mercury Computer Systems"; +static const char pci_device_1134_0001[] = "Raceway Bridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1135[] = "Fuji Xerox Co Ltd"; +static const char pci_device_1135_0001[] = "Printer controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1136[] = "Momentum Data Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1137[] = "Cisco Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1138[] = "Ziatech Corporation"; +static const char pci_device_1138_8905[] = "8905 [STD 32 Bridge]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1139[] = "Dynamic Pictures, Inc"; +static const char pci_device_1139_0001[] = "VGA Compatable 3D Graphics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_113a[] = "FWB Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_113b[] = "Network Computing Devices"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_113c[] = "Cyclone Microsystems, Inc."; +static const char pci_device_113c_0000[] = "PCI-9060 i960 Bridge"; +static const char pci_device_113c_0001[] = "PCI-SDK [PCI i960 Evaluation Platform]"; +static const char pci_device_113c_0911[] = "PCI-911 [i960Jx-based Intelligent I/O Controller]"; +static const char pci_device_113c_0912[] = "PCI-912 [i960CF-based Intelligent I/O Controller]"; +static const char pci_device_113c_0913[] = "PCI-913"; +static const char pci_device_113c_0914[] = "PCI-914 [I/O Controller w/ secondary PCI bus]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_113d[] = "Leading Edge Products Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_113e[] = "Sanyo Electric Co - Computer Engineering Dept"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_113f[] = "Equinox Systems, Inc."; +static const char pci_device_113f_0808[] = "SST-64P Adapter"; +static const char pci_device_113f_1010[] = "SST-128P Adapter"; +static const char pci_device_113f_80c0[] = "SST-16P DB Adapter"; +static const char pci_device_113f_80c4[] = "SST-16P RJ Adapter"; +static const char pci_device_113f_80c8[] = "SST-16P Adapter"; +static const char pci_device_113f_8888[] = "SST-4P Adapter"; +static const char pci_device_113f_9090[] = "SST-8P Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1140[] = "Intervoice Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1141[] = "Crest Microsystem Inc"; +#endif +static const char pci_vendor_1142[] = "Alliance Semiconductor Corporation"; +static const char pci_device_1142_3210[] = "AP6410"; +static const char pci_device_1142_6422[] = "ProVideo 6422"; +static const char pci_device_1142_6424[] = "ProVideo 6424"; +static const char pci_device_1142_6425[] = "ProMotion AT25"; +static const char pci_device_1142_643d[] = "ProMotion AT3D"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1143[] = "NetPower, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1144[] = "Cincinnati Milacron"; +static const char pci_device_1144_0001[] = "Noservo controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1145[] = "Workbit Corporation"; +static const char pci_device_1145_8007[] = "NinjaSCSI-32 Workbit"; +static const char pci_device_1145_f007[] = "NinjaSCSI-32 KME"; +static const char pci_device_1145_f010[] = "NinjaSCSI-32 Workbit"; +static const char pci_device_1145_f012[] = "NinjaSCSI-32 Logitec"; +static const char pci_device_1145_f013[] = "NinjaSCSI-32 Logitec"; +static const char pci_device_1145_f015[] = "NinjaSCSI-32 Melco"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1146[] = "Force Computers"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1147[] = "Interface Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1148[] = "Syskonnect (Schneider & Koch)"; +static const char pci_device_1148_4000[] = "FDDI Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_0e11_b03b[] = "Netelligent 100 FDDI DAS Fibre SC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_0e11_b03c[] = "Netelligent 100 FDDI SAS Fibre SC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_0e11_b03d[] = "Netelligent 100 FDDI DAS UTP"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_0e11_b03e[] = "Netelligent 100 FDDI SAS UTP"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_0e11_b03f[] = "Netelligent 100 FDDI SAS Fibre MIC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5521[] = "FDDI SK-5521 (SK-NET FDDI-UP)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5522[] = "FDDI SK-5522 (SK-NET FDDI-UP DAS)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5541[] = "FDDI SK-5541 (SK-NET FDDI-FP)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5543[] = "FDDI SK-5543 (SK-NET FDDI-LP)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5544[] = "FDDI SK-5544 (SK-NET FDDI-LP DAS)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5821[] = "FDDI SK-5821 (SK-NET FDDI-UP64)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5822[] = "FDDI SK-5822 (SK-NET FDDI-UP64 DAS)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5841[] = "FDDI SK-5841 (SK-NET FDDI-FP64)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5843[] = "FDDI SK-5843 (SK-NET FDDI-LP64)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4000_1148_5844[] = "FDDI SK-5844 (SK-NET FDDI-LP64 DAS)"; +#endif +static const char pci_device_1148_4200[] = "Token Ring adapter"; +static const char pci_device_1148_4300[] = "Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9821[] = "SK-9821 (1000Base-T single link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9822[] = "SK-9822 (1000Base-T dual link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9841[] = "SK-9841 (1000Base-LX single link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9842[] = "SK-9842 (1000Base-LX dual link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9843[] = "SK-9843 (1000Base-SX single link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9844[] = "SK-9844 (1000Base-SX dual link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9861[] = "SK-9861 (1000Base-SX VF45 single link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9862[] = "SK-9862 (1000Base-SX VF45 dual link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9871[] = "SK-9871 (1000Base-ZX single link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1148_9872[] = "SK-9872 (1000Base-ZX dual link)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1259_2970[] = "AT-2970SX [Allied Telesyn]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1259_2972[] = "AT-2970T [Allied Telesyn]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1259_2975[] = "AT-2970SX [Allied Telesyn]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4300_1259_2977[] = "AT-2970T [Allied Telesyn]"; +#endif +static const char pci_device_1148_4320[] = "SK-98xx Gigabit Ethernet Server Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_5021[] = "SK-9821 V2.0 Gigabit Ethernet 10/100/1000Base-T Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_5041[] = "SK-9841 V2.0 Gigabit Ethernet 1000Base-LX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_5043[] = "SK-9843 V2.0 Gigabit Ethernet 1000Base-SX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_5051[] = "SK-9851 V2.0 Gigabit Ethernet 1000Base-SX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_5061[] = "SK-9861 V2.0 Gigabit Ethernet 1000Base-SX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_5071[] = "SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1148_4320_1148_9521[] = "SK-9521 10/100/1000Base-T Adapter"; +#endif +static const char pci_device_1148_4400[] = "Gigabit Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1149[] = "Win System Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_114a[] = "VMIC"; +static const char pci_device_114a_5579[] = "VMIPCI-5579 (Reflective Memory Card)"; +static const char pci_device_114a_5587[] = "VMIPCI-5587 (Reflective Memory Card)"; +static const char pci_device_114a_6504[] = "VMIC PCI 7755 FPGA"; +static const char pci_device_114a_7587[] = "VMIVME-7587"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_114b[] = "Canopus Co., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_114c[] = "Annabooks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_114d[] = "IC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_114e[] = "Nikon Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_114f[] = "Digi International"; +static const char pci_device_114f_0002[] = "AccelePort EPC"; +static const char pci_device_114f_0003[] = "RightSwitch SE-6"; +static const char pci_device_114f_0004[] = "AccelePort Xem"; +static const char pci_device_114f_0005[] = "AccelePort Xr"; +static const char pci_device_114f_0006[] = "AccelePort Xr,C/X"; +static const char pci_device_114f_0009[] = "AccelePort Xr/J"; +static const char pci_device_114f_000a[] = "AccelePort EPC/J"; +static const char pci_device_114f_000c[] = "DataFirePRIme T1 (1-port)"; +static const char pci_device_114f_000d[] = "SyncPort 2-Port (x.25/FR)"; +static const char pci_device_114f_0011[] = "AccelePort 8r EIA-232 (IBM)"; +static const char pci_device_114f_0012[] = "AccelePort 8r EIA-422"; +static const char pci_device_114f_0013[] = "AccelePort Xr"; +static const char pci_device_114f_0014[] = "AccelePort 8r EIA-422"; +static const char pci_device_114f_0015[] = "AccelePort Xem"; +static const char pci_device_114f_0016[] = "AccelePort EPC/X"; +static const char pci_device_114f_0017[] = "AccelePort C/X"; +static const char pci_device_114f_001a[] = "DataFirePRIme E1 (1-port)"; +static const char pci_device_114f_001b[] = "AccelePort C/X (IBM)"; +static const char pci_device_114f_001d[] = "DataFire RAS T1/E1/PRI"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_114f_001d_114f_0050[] = "DataFire RAS E1 Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_114f_001d_114f_0051[] = "DataFire RAS Dual E1 Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_114f_001d_114f_0052[] = "DataFire RAS T1 Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_114f_001d_114f_0053[] = "DataFire RAS Dual T1 Adapter"; +#endif +static const char pci_device_114f_0023[] = "AccelePort RAS"; +static const char pci_device_114f_0024[] = "DataFire RAS B4 ST/U"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_114f_0024_114f_0030[] = "DataFire RAS BRI U Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_114f_0024_114f_0031[] = "DataFire RAS BRI S/T Adapter"; +#endif +static const char pci_device_114f_0026[] = "AccelePort 4r 920"; +static const char pci_device_114f_0027[] = "AccelePort Xr 920"; +static const char pci_device_114f_0034[] = "AccelePort 2r 920"; +static const char pci_device_114f_0035[] = "DataFire DSP T1/E1/PRI cPCI"; +static const char pci_device_114f_0040[] = "AccelePort Xp"; +static const char pci_device_114f_0042[] = "AccelePort 2p PCI"; +static const char pci_device_114f_0070[] = "Datafire Micro V IOM2 (Europe)"; +static const char pci_device_114f_0071[] = "Datafire Micro V (Europe)"; +static const char pci_device_114f_0072[] = "Datafire Micro V IOM2 (North America)"; +static const char pci_device_114f_0073[] = "Datafire Micro V (North America)"; +static const char pci_device_114f_6001[] = "Avanstar"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1150[] = "Thinking Machines Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1151[] = "JAE Electronics Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1152[] = "Megatek"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1153[] = "Land Win Electronic Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1154[] = "Melco Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1155[] = "Pine Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1156[] = "Periscope Engineering"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1157[] = "Avsys Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1158[] = "Voarx R & D Inc"; +static const char pci_device_1158_3011[] = "Tokenet/vg 1001/10m anylan"; +static const char pci_device_1158_9050[] = "Lanfleet/Truevalue"; +static const char pci_device_1158_9051[] = "Lanfleet/Truevalue"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1159[] = "Mutech Corp"; +static const char pci_device_1159_0001[] = "MV-1000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_115a[] = "Harlequin Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_115b[] = "Parallax Graphics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_115c[] = "Photron Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_115d[] = "Xircom"; +static const char pci_device_115d_0003[] = "Cardbus Ethernet 10/100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_1014_0181[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_1014_1181[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_1014_8181[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_1014_9181[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_115d_0181[] = "Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_115d_1181[] = "Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_1179_0181[] = "Cardbus Ethernet 10/100"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_8086_8181[] = "EtherExpress PRO/100 Mobile CardBus 32 Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0003_8086_9181[] = "EtherExpress PRO/100 Mobile CardBus 32 Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_115d_0005[] = "Cardbus Ethernet 10/100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0005_1014_0182[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0005_1014_1182[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0005_115d_0182[] = "Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0005_115d_1182[] = "Cardbus Ethernet 10/100"; +#endif +static const char pci_device_115d_0007[] = "Cardbus Ethernet 10/100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0007_1014_0182[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0007_1014_1182[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0007_115d_0182[] = "Cardbus Ethernet 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0007_115d_1182[] = "Cardbus Ethernet 10/100"; +#endif +static const char pci_device_115d_000b[] = "Cardbus Ethernet 10/100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_000b_1014_0183[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_000b_115d_0183[] = "Cardbus Ethernet 10/100"; +#endif +static const char pci_device_115d_000c[] = "Mini-PCI V.90 56k Modem"; +static const char pci_device_115d_000f[] = "Cardbus Ethernet 10/100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_000f_1014_0183[] = "10/100 EtherJet Cardbus Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_000f_115d_0183[] = "Cardbus Ethernet 10/100"; +#endif +static const char pci_device_115d_0101[] = "Cardbus 56k modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0101_115d_1081[] = "Cardbus 56k Modem"; +#endif +static const char pci_device_115d_0103[] = "Cardbus Ethernet + 56k Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0103_1014_9181[] = "Cardbus 56k Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0103_1115_1181[] = "Cardbus Ethernet 100 + 56k Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0103_115d_1181[] = "CBEM56G-100 Ethernet + 56k Modem"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_115d_0103_8086_9181[] = "PRO/100 LAN + Modem56 CardBus"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_115e[] = "Peer Protocols Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_115f[] = "Maxtor Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1160[] = "Megasoft Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1161[] = "PFU Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1162[] = "OA Laboratory Co Ltd"; +#endif +static const char pci_vendor_1163[] = "Rendition"; +static const char pci_device_1163_0001[] = "Verite 1000"; +static const char pci_device_1163_2000[] = "Verite V2000/V2100/V2200"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1163_2000_1092_2000[] = "Stealth II S220"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1164[] = "Advanced Peripherals Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1165[] = "Imagraph Corporation"; +static const char pci_device_1165_0001[] = "Motion TPEG Recorder/Player with audio"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1166[] = "ServerWorks"; +static const char pci_device_1166_0005[] = "CNB20-LE Host Bridge"; +static const char pci_device_1166_0007[] = "CNB20-LE Host Bridge"; +static const char pci_device_1166_0008[] = "CNB20HE Host Bridge"; +static const char pci_device_1166_0009[] = "CNB20LE Host Bridge"; +static const char pci_device_1166_0010[] = "CIOB30"; +static const char pci_device_1166_0011[] = "CMIC-HE"; +static const char pci_device_1166_0012[] = "CMIC-LE"; +static const char pci_device_1166_0013[] = "CNB20-HE Host Bridge"; +static const char pci_device_1166_0014[] = "CNB20-HE Host Bridge"; +static const char pci_device_1166_0015[] = "CMIC-GC Host Bridge"; +static const char pci_device_1166_0016[] = "CMIC-GC Host Bridge"; +static const char pci_device_1166_0017[] = "GCNB-LE Host Bridge"; +static const char pci_device_1166_0200[] = "OSB4 South Bridge"; +static const char pci_device_1166_0201[] = "CSB5 South Bridge"; +static const char pci_device_1166_0203[] = "CSB6 South Bridge"; +static const char pci_device_1166_0211[] = "OSB4 IDE Controller"; +static const char pci_device_1166_0212[] = "CSB5 IDE Controller"; +static const char pci_device_1166_0213[] = "CSB6 RAID/IDE Controller"; +static const char pci_device_1166_0220[] = "OSB4/CSB5 OHCI USB Controller"; +static const char pci_device_1166_0221[] = "CSB6 OHCI USB Controller"; +static const char pci_device_1166_0225[] = "GCLE Host Bridge"; +static const char pci_device_1166_0227[] = "GCLE-2 Host Bridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1167[] = "Mutoh Industries Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1168[] = "Thine Electronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1169[] = "Centre for Development of Advanced Computing"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_116a[] = "Polaris Communications"; +static const char pci_device_116a_6100[] = "Bus/Tag Channel"; +static const char pci_device_116a_6800[] = "Escon Channel"; +static const char pci_device_116a_7100[] = "Bus/Tag Channel"; +static const char pci_device_116a_7800[] = "Escon Channel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_116b[] = "Connectware Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_116c[] = "Intelligent Resources Integrated Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_116d[] = "Martin-Marietta"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_116e[] = "Electronics for Imaging"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_116f[] = "Workstation Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1170[] = "Inventec Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1171[] = "Loughborough Sound Images Plc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1172[] = "Altera Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1173[] = "Adobe Systems, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1174[] = "Bridgeport Machines"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1175[] = "Mitron Computer Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1176[] = "SBE Incorporated"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1177[] = "Silicon Engineering"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1178[] = "Alfa, Inc."; +static const char pci_device_1178_afa1[] = "Fast Ethernet Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1179[] = "Toshiba America Info Systems"; +static const char pci_device_1179_0103[] = "EX-IDE Type-B"; +static const char pci_device_1179_0404[] = "DVD Decoder card"; +static const char pci_device_1179_0406[] = "Tecra Video Capture device"; +static const char pci_device_1179_0407[] = "DVD Decoder card (Version 2)"; +static const char pci_device_1179_0601[] = "601"; +static const char pci_device_1179_0603[] = "ToPIC95 PCI to CardBus Bridge for Notebooks"; +static const char pci_device_1179_060a[] = "ToPIC95"; +static const char pci_device_1179_060f[] = "ToPIC97"; +static const char pci_device_1179_0617[] = "ToPIC95 PCI to Cardbus Bridge with ZV Support"; +static const char pci_device_1179_0618[] = "CPU to PCI and PCI to ISA bridge"; +static const char pci_device_1179_0701[] = "FIR Port"; +static const char pci_device_1179_0804[] = "TC6371AF SmartMedia Controller"; +static const char pci_device_1179_0805[] = "SD TypA Controller"; +static const char pci_device_1179_0d01[] = "FIR Port Type-DO"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1179_0d01_1179_0001[] = "FIR Port Type-DO"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_117a[] = "A-Trend Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_117b[] = "L G Electronics, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_117c[] = "Atto Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_117d[] = "Becton & Dickinson"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_117e[] = "T/R Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_117f[] = "Integrated Circuit Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1180[] = "Ricoh Co Ltd"; +static const char pci_device_1180_0465[] = "RL5c465"; +static const char pci_device_1180_0466[] = "RL5c466"; +static const char pci_device_1180_0475[] = "RL5c475"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0475_144d_c006[] = "vpr Matrix 170B4 CardBus bridge"; +#endif +static const char pci_device_1180_0476[] = "RL5c476 II"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0476_1014_0185[] = "ThinkPad A/T/X Series"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0476_104d_80df[] = "Vaio PCG-FX403"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0476_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1180_0477[] = "RL5c477"; +static const char pci_device_1180_0478[] = "RL5c478"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0478_1014_0184[] = "ThinkPad A30p (2653-64G)"; +#endif +static const char pci_device_1180_0522[] = "R5C522 IEEE 1394 Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0522_1014_01cf[] = "ThinkPad A30p (2653-64G)"; +#endif +static const char pci_device_1180_0551[] = "R5C551 IEEE 1394 Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0551_144d_c006[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_1180_0552[] = "R5C552 IEEE 1394 Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1180_0552_1014_0511[] = "ThinkPad A/T/X Series"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1181[] = "Telmatics International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1183[] = "Fujikura Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1184[] = "Forks Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1185[] = "Dataworld International Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1186[] = "D-Link System Inc"; +static const char pci_device_1186_0100[] = "DC21041"; +static const char pci_device_1186_1002[] = "DL10050 Sundance Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1186_1002_1186_1002[] = "DFE-550TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1186_1002_1186_1012[] = "DFE-580TX"; +#endif +static const char pci_device_1186_1300[] = "RTL8139 Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1186_1300_1186_1300[] = "DFE-538TX 10/100 Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1186_1300_1186_1301[] = "DFE-530TX+ 10/100 Ethernet Adapter"; +#endif +static const char pci_device_1186_1340[] = "DFE-690TXD CardBus PC Card"; +static const char pci_device_1186_1561[] = "DRP-32TXD Cardbus PC Card"; +static const char pci_device_1186_4000[] = "DL2K Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1187[] = "Advanced Technology Laboratories, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1188[] = "Shima Seiki Manufacturing Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1189[] = "Matsushita Electronics Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_118a[] = "Hilevel Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_118b[] = "Hypertec Pty Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_118c[] = "Corollary, Inc"; +static const char pci_device_118c_0014[] = "PCIB [C-bus II to PCI bus host bridge chip]"; +static const char pci_device_118c_1117[] = "Intel 8-way XEON Profusion Chipset [Cache Coherency Filter]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_118d[] = "BitFlow Inc"; +static const char pci_device_118d_0001[] = "Raptor-PCI framegrabber"; +static const char pci_device_118d_0012[] = "Model 12 Road Runner Frame Grabber"; +static const char pci_device_118d_0014[] = "Model 14 Road Runner Frame Grabber"; +static const char pci_device_118d_0024[] = "Model 24 Road Runner Frame Grabber"; +static const char pci_device_118d_0044[] = "Model 44 Road Runner Frame Grabber"; +static const char pci_device_118d_0112[] = "Model 12 Road Runner Frame Grabber"; +static const char pci_device_118d_0114[] = "Model 14 Road Runner Frame Grabber"; +static const char pci_device_118d_0124[] = "Model 24 Road Runner Frame Grabber"; +static const char pci_device_118d_0144[] = "Model 44 Road Runner Frame Grabber"; +static const char pci_device_118d_0212[] = "Model 12 Road Runner Frame Grabber"; +static const char pci_device_118d_0214[] = "Model 14 Road Runner Frame Grabber"; +static const char pci_device_118d_0224[] = "Model 24 Road Runner Frame Grabber"; +static const char pci_device_118d_0244[] = "Model 44 Road Runner Frame Grabber"; +static const char pci_device_118d_0312[] = "Model 12 Road Runner Frame Grabber"; +static const char pci_device_118d_0314[] = "Model 14 Road Runner Frame Grabber"; +static const char pci_device_118d_0324[] = "Model 24 Road Runner Frame Grabber"; +static const char pci_device_118d_0344[] = "Model 44 Road Runner Frame Grabber"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_118e[] = "Hermstedt GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_118f[] = "Green Logic"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1190[] = "Tripace"; +static const char pci_device_1190_c731[] = "TP-910/920/940 PCI Ultra(Wide) SCSI Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1191[] = "Artop Electronic Corp"; +static const char pci_device_1191_0003[] = "SCSI Cache Host Adapter"; +static const char pci_device_1191_0004[] = "ATP8400"; +static const char pci_device_1191_0005[] = "ATP850UF"; +static const char pci_device_1191_0006[] = "ATP860 NO-BIOS"; +static const char pci_device_1191_0007[] = "ATP860"; +static const char pci_device_1191_0008[] = "ATP865 NO-ROM"; +static const char pci_device_1191_0009[] = "ATP865"; +static const char pci_device_1191_8002[] = "AEC6710 SCSI-2 Host Adapter"; +static const char pci_device_1191_8010[] = "AEC6712UW SCSI"; +static const char pci_device_1191_8020[] = "AEC6712U SCSI"; +static const char pci_device_1191_8030[] = "AEC6712S SCSI"; +static const char pci_device_1191_8040[] = "AEC6712D SCSI"; +static const char pci_device_1191_8050[] = "AEC6712SUW SCSI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1192[] = "Densan Company Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1193[] = "Zeitnet Inc."; +static const char pci_device_1193_0001[] = "1221"; +static const char pci_device_1193_0002[] = "1225"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1194[] = "Toucan Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1195[] = "Ratoc System Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1196[] = "Hytec Electronics Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1197[] = "Gage Applied Sciences, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1198[] = "Lambda Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1199[] = "Attachmate Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_119a[] = "Mind Share, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_119b[] = "Omega Micro Inc."; +static const char pci_device_119b_1221[] = "82C092G"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_119c[] = "Information Technology Inst."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_119d[] = "Bug, Inc. Sapporo Japan"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_119e[] = "Fujitsu Microelectronics Ltd."; +static const char pci_device_119e_0001[] = "FireStream 155"; +static const char pci_device_119e_0003[] = "FireStream 50"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_119f[] = "Bull HN Information Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a0[] = "Convex Computer Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a1[] = "Hamamatsu Photonics K.K."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a2[] = "Sierra Research and Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a3[] = "Deuretzbacher GmbH & Co. Eng. KG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a4[] = "Barco Graphics NV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a5[] = "Microunity Systems Eng. Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a6[] = "Pure Data Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a7[] = "Power Computing Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a8[] = "Systech Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11a9[] = "InnoSys Inc."; +static const char pci_device_11a9_4240[] = "AMCC S933Q Intelligent Serial Card"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11aa[] = "Actel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ab[] = "Galileo Technology Ltd."; +static const char pci_device_11ab_0146[] = "GT-64010/64010A System Controller"; +static const char pci_device_11ab_4611[] = "GT-64115 System Controller"; +static const char pci_device_11ab_4620[] = "GT-64120/64120A/64121A System Controller"; +static const char pci_device_11ab_4801[] = "GT-48001"; +static const char pci_device_11ab_f003[] = "GT-64010 Primary Image Piranha Image Generator"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ac[] = "Canon Information Systems Research Aust."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ad[] = "Lite-On Communications Inc"; +static const char pci_device_11ad_0002[] = "LNE100TX"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11ad_0002_11ad_0002[] = "LNE100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11ad_0002_11ad_0003[] = "LNE100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11ad_0002_11ad_f003[] = "LNE100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11ad_0002_11ad_ffff[] = "LNE100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11ad_0002_1385_f004[] = "FA310TX"; +#endif +static const char pci_device_11ad_c115[] = "LNE100TX [Linksys EtherFast 10/100]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11ad_c115_11ad_c001[] = "LNE100TX [ver 2.0]"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ae[] = "Aztech System Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11af[] = "Avid Technology Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b0[] = "V3 Semiconductor Inc."; +static const char pci_device_11b0_0002[] = "V300PSC"; +static const char pci_device_11b0_0292[] = "V292PBC [Am29030/40 Bridge]"; +static const char pci_device_11b0_0960[] = "V96xPBC"; +static const char pci_device_11b0_c960[] = "V96DPC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b1[] = "Apricot Computers"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b2[] = "Eastman Kodak"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b3[] = "Barr Systems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b4[] = "Leitch Technology International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b5[] = "Radstone Technology Plc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b6[] = "United Video Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b7[] = "Motorola"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b8[] = "XPoint Technologies, Inc"; +static const char pci_device_11b8_0001[] = "Quad PeerMaster"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11b9[] = "Pathlight Technology Inc."; +static const char pci_device_11b9_c0ed[] = "SSA Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ba[] = "Videotron Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11bb[] = "Pyramid Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11bc[] = "Network Peripherals Inc"; +static const char pci_device_11bc_0001[] = "NP-PCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11bd[] = "Pinnacle Systems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11be[] = "International Microcircuits Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11bf[] = "Astrodesign, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c0[] = "Hewlett Packard"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c1[] = "Lucent Microelectronics"; +static const char pci_device_11c1_0440[] = "56k WinModem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_1033_8015[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_1033_8047[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_1033_804f[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_10cf_102c[] = "LB LT Modem V.90 56k"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_10cf_104a[] = "BIBLO LT Modem 56k"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_10cf_105f[] = "LB2 LT Modem V.90 56k"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_1179_0001[] = "Internal V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_11c1_0440[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_122d_4101[] = "MDP7800-U Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_122d_4102[] = "MDP7800SP-U Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_13e0_0040[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_13e0_0440[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_13e0_0441[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_13e0_0450[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_13e0_f100[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_13e0_f101[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_144d_2101[] = "LT56PV Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0440_149f_0440[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +static const char pci_device_11c1_0441[] = "56k WinModem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1033_804d[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1033_8065[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1092_0440[] = "Supra 56i"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1179_0001[] = "Internal V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_11c1_0440[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_11c1_0441[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_122d_4100[] = "MDP7800-U Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_0040[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_0100[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_0410[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_0420[] = "TelePath Internet 56k WinModem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_0440[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_0443[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_13e0_f102[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1416_9804[] = "CommWave 56k Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_141d_0440[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_144f_0441[] = "Lucent 56k V.90 DF Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_144f_0449[] = "Lucent 56k V.90 DF Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_144f_110d[] = "Lucent Win Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1468_0441[] = "Presario 56k V.90 DF Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0441_1668_0440[] = "Lucent Win Modem"; +#endif +static const char pci_device_11c1_0442[] = "56k WinModem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_11c1_0440[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_11c1_0442[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_13e0_0412[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_13e0_0442[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_13fc_2471[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_144d_2104[] = "LT56PT Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_144f_1104[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_149f_0440[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0442_1668_0440[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +static const char pci_device_11c1_0443[] = "LT WinModem"; +static const char pci_device_11c1_0444[] = "LT WinModem"; +static const char pci_device_11c1_0445[] = "LT WinModem"; +static const char pci_device_11c1_0446[] = "LT WinModem"; +static const char pci_device_11c1_0447[] = "LT WinModem"; +static const char pci_device_11c1_0448[] = "WinModem 56k"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0448_1014_0131[] = "Lucent Win Modem"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0448_1033_8066[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0448_13e0_0030[] = "56k Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0448_13e0_0040[] = "LT WinModem 56k Data+Fax+Voice+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0448_1668_2400[] = "LT WinModem 56k (MiniPCI Ethernet+Modem)"; +#endif +static const char pci_device_11c1_0449[] = "WinModem 56k"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_0e11_b14d[] = "56k V.90 Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_13e0_0020[] = "LT WinModem 56k Data+Fax"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_13e0_0041[] = "TelePath Internet 56k WinModem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_1436_0440[] = "Lucent Win Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_144f_0449[] = "Lucent 56k V.90 DFi Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_1468_0410[] = "IBM ThinkPad T23 (2647-4MG)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_1468_0440[] = "Lucent Win Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0449_1468_0449[] = "Presario 56k V.90 DFi Modem"; +#endif +static const char pci_device_11c1_044a[] = "F-1156IV WinModem (V90, 56KFlex)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_044a_10cf_1072[] = "LB Global LT Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_044a_13e0_0012[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_044a_13e0_0042[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_044a_144f_1005[] = "LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd"; +#endif +static const char pci_device_11c1_044b[] = "LT WinModem"; +static const char pci_device_11c1_044c[] = "LT WinModem"; +static const char pci_device_11c1_044d[] = "LT WinModem"; +static const char pci_device_11c1_044e[] = "LT WinModem"; +static const char pci_device_11c1_044f[] = "V90 WildWire Modem"; +static const char pci_device_11c1_0450[] = "LT WinModem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_0450_144f_4005[] = "Magnia SG20"; +#endif +static const char pci_device_11c1_0451[] = "LT WinModem"; +static const char pci_device_11c1_0452[] = "LT WinModem"; +static const char pci_device_11c1_0453[] = "LT WinModem"; +static const char pci_device_11c1_0454[] = "LT WinModem"; +static const char pci_device_11c1_0455[] = "LT WinModem"; +static const char pci_device_11c1_0456[] = "LT WinModem"; +static const char pci_device_11c1_0457[] = "LT WinModem"; +static const char pci_device_11c1_0458[] = "LT WinModem"; +static const char pci_device_11c1_0459[] = "LT WinModem"; +static const char pci_device_11c1_045a[] = "LT WinModem"; +static const char pci_device_11c1_045c[] = "LT WinModem"; +static const char pci_device_11c1_0461[] = "V90 WildWire Modem"; +static const char pci_device_11c1_0462[] = "V90 WildWire Modem"; +static const char pci_device_11c1_0480[] = "Venus Modem (V90, 56KFlex)"; +static const char pci_device_11c1_5801[] = "USB"; +static const char pci_device_11c1_5802[] = "USS-312 USB Controller"; +static const char pci_device_11c1_5803[] = "USS-344S USB Controller"; +static const char pci_device_11c1_5811[] = "FW323"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11c1_5811_dead_0800[] = "FireWire Host Bus Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c2[] = "Sand Microelectronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c3[] = "NEC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c4[] = "Document Technologies, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c5[] = "Shiva Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c6[] = "Dainippon Screen Mfg. Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c7[] = "D.C.M. Data Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c8[] = "Dolphin Interconnect Solutions AS"; +static const char pci_device_11c8_0658[] = "PSB32 SCI-Adapter D31x"; +static const char pci_device_11c8_d665[] = "PSB64 SCI-Adapter D32x"; +static const char pci_device_11c8_d667[] = "PSB66 SCI-Adapter D33x"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11c9[] = "Magma"; +static const char pci_device_11c9_0010[] = "16-line serial port w/- DMA"; +static const char pci_device_11c9_0011[] = "4-line serial port w/- DMA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ca[] = "LSI Systems, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11cb[] = "Specialix Research Ltd."; +static const char pci_device_11cb_2000[] = "PCI_9050"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11cb_2000_11cb_0200[] = "SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11cb_2000_11cb_b008[] = "I/O8+"; +#endif +static const char pci_device_11cb_4000[] = "SUPI_1"; +static const char pci_device_11cb_8000[] = "T225"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11cc[] = "Michels & Kleberhoff Computer GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11cd[] = "HAL Computer Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ce[] = "Netaccess"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11cf[] = "Pioneer Electronic Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d0[] = "Lockheed Martin Federal Systems-Manassas"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d1[] = "Auravision"; +static const char pci_device_11d1_01f7[] = "VxP524"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d2[] = "Intercom Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d3[] = "Trancell Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d4[] = "Analog Devices"; +static const char pci_device_11d4_1805[] = "SM56 PCI modem"; +static const char pci_device_11d4_1889[] = "AD1889 sound chip"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d5[] = "Ikon Corporation"; +static const char pci_device_11d5_0115[] = "10115"; +static const char pci_device_11d5_0117[] = "10117"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d6[] = "Tekelec Telecom"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d7[] = "Trenton Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d8[] = "Image Technologies Development"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11d9[] = "TEC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11da[] = "Novell"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11db[] = "Sega Enterprises Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11dc[] = "Questra Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11dd[] = "Crosfield Electronics Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11de[] = "Zoran Corporation"; +static const char pci_device_11de_6057[] = "ZR36057PQC Video cutting chipset"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11de_6057_1031_7efe[] = "DC10 Plus"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11de_6057_1031_fc00[] = "MiroVIDEO DC50, Motion JPEG Capture/CODEC Board"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11de_6057_13ca_4231[] = "JPEG/TV Card"; +#endif +static const char pci_device_11de_6120[] = "ZR36120"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11de_6120_1328_f001[] = "Cinemaster C DVD Decoder"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11df[] = "New Wave PDG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e0[] = "Cray Communications A/S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e1[] = "GEC Plessey Semi Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e2[] = "Samsung Information Systems America"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e3[] = "Quicklogic Corporation"; +static const char pci_device_11e3_5030[] = "PC Watchdog"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e4[] = "Second Wave Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e5[] = "IIX Consulting"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e6[] = "Mitsui-Zosen System Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e7[] = "Toshiba America, Elec. Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e8[] = "Digital Processing Systems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11e9[] = "Highwater Designs Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ea[] = "Elsag Bailey"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11eb[] = "Formation Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ec[] = "Coreco Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ed[] = "Mediamatics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ee[] = "Dome Imaging Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ef[] = "Nicolet Technologies B.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f0[] = "Compu-Shack"; +static const char pci_device_11f0_4231[] = "FDDI"; +static const char pci_device_11f0_4232[] = "FASTline UTP Quattro"; +static const char pci_device_11f0_4233[] = "FASTline FO"; +static const char pci_device_11f0_4234[] = "FASTline UTP"; +static const char pci_device_11f0_4235[] = "FASTline-II UTP"; +static const char pci_device_11f0_4236[] = "FASTline-II FO"; +static const char pci_device_11f0_4731[] = "GIGAline"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f1[] = "Symbios Logic Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f2[] = "Picture Tel Japan K.K."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f3[] = "Keithley Metrabyte"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f4[] = "Kinetic Systems Corporation"; +static const char pci_device_11f4_2915[] = "CAMAC controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f5[] = "Computing Devices International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f6[] = "Compex"; +static const char pci_device_11f6_0112[] = "ENet100VG4"; +static const char pci_device_11f6_0113[] = "FreedomLine 100"; +static const char pci_device_11f6_1401[] = "ReadyLink 2000"; +static const char pci_device_11f6_2011[] = "RL100-ATX 10/100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11f6_2011_11f6_2011[] = "RL100-ATX"; +#endif +static const char pci_device_11f6_2201[] = "ReadyLink 100TX (Winbond W89C840)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_11f6_2201_11f6_2011[] = "ReadyLink 100TX"; +#endif +static const char pci_device_11f6_9881[] = "RL100TX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f7[] = "Scientific Atlanta"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f8[] = "PMC-Sierra Inc."; +static const char pci_device_11f8_7375[] = "PM7375 [LASAR-155 ATM SAR]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11f9[] = "I-Cube Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11fa[] = "Kasan Electronics Company, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11fb[] = "Datel Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11fc[] = "Silicon Magic"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11fd[] = "High Street Consultants"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11fe[] = "Comtrol Corporation"; +static const char pci_device_11fe_0001[] = "RocketPort 8 Oct"; +static const char pci_device_11fe_0002[] = "RocketPort 8 Intf"; +static const char pci_device_11fe_0003[] = "RocketPort 16 Intf"; +static const char pci_device_11fe_0004[] = "RocketPort 32 Intf"; +static const char pci_device_11fe_0005[] = "RocketPort Octacable"; +static const char pci_device_11fe_0006[] = "RocketPort 8J"; +static const char pci_device_11fe_0007[] = "RocketPort 4-port"; +static const char pci_device_11fe_0008[] = "RocketPort 8-port"; +static const char pci_device_11fe_0009[] = "RocketPort 16-port"; +static const char pci_device_11fe_000a[] = "RocketPort Plus Quadcable"; +static const char pci_device_11fe_000b[] = "RocketPort Plus Octacable"; +static const char pci_device_11fe_000c[] = "RocketPort 8-port Modem"; +static const char pci_device_11fe_8015[] = "RocketPort 4-port UART 16954"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_11ff[] = "Scion Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1200[] = "CSS Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1201[] = "Vista Controls Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1202[] = "Network General Corp."; +static const char pci_device_1202_4300[] = "Gigabit Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1202_4300_1202_9841[] = "SK-9841 LX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1202_4300_1202_9842[] = "SK-9841 LX dual link"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1202_4300_1202_9843[] = "SK-9843 SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1202_4300_1202_9844[] = "SK-9843 SX dual link"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1203[] = "Bayer Corporation, Agfa Division"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1204[] = "Lattice Semiconductor Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1205[] = "Array Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1206[] = "Amdahl Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1208[] = "Parsytec GmbH"; +static const char pci_device_1208_4853[] = "HS-Link Device"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1209[] = "SCI Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_120a[] = "Synaptel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_120b[] = "Adaptive Solutions"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_120c[] = "Technical Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_120d[] = "Compression Labs, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_120e[] = "Cyclades Corporation"; +static const char pci_device_120e_0100[] = "Cyclom-Y below first megabyte"; +static const char pci_device_120e_0101[] = "Cyclom-Y above first megabyte"; +static const char pci_device_120e_0102[] = "Cyclom-4Y below first megabyte"; +static const char pci_device_120e_0103[] = "Cyclom-4Y above first megabyte"; +static const char pci_device_120e_0104[] = "Cyclom-8Y below first megabyte"; +static const char pci_device_120e_0105[] = "Cyclom-8Y above first megabyte"; +static const char pci_device_120e_0200[] = "Cyclades-Z below first megabyte"; +static const char pci_device_120e_0201[] = "Cyclades-Z above first megabyte"; +static const char pci_device_120e_0300[] = "PC300/RSV or /X21 (2 ports)"; +static const char pci_device_120e_0301[] = "PC300/RSV or /X21 (1 port)"; +static const char pci_device_120e_0310[] = "PC300/TE (2 ports)"; +static const char pci_device_120e_0311[] = "PC300/TE (1 port)"; +static const char pci_device_120e_0320[] = "PC300/TE-M (2 ports)"; +static const char pci_device_120e_0321[] = "PC300/TE-M (1 port)"; +static const char pci_device_120e_0400[] = "PC400"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_120f[] = "Essential Communications"; +static const char pci_device_120f_0001[] = "Roadrunner serial HIPPI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1210[] = "Hyperparallel Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1211[] = "Braintech Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1212[] = "Kingston Technology Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1213[] = "Applied Intelligent Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1214[] = "Performance Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1215[] = "Interware Co., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1216[] = "Purup Prepress A/S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1217[] = "O2 Micro, Inc."; +static const char pci_device_1217_6729[] = "OZ6729"; +static const char pci_device_1217_673a[] = "OZ6730"; +static const char pci_device_1217_6832[] = "OZ6832/6833 Cardbus Controller"; +static const char pci_device_1217_6836[] = "OZ6836/6860 Cardbus Controller"; +static const char pci_device_1217_6872[] = "OZ6812 Cardbus Controller"; +static const char pci_device_1217_6925[] = "OZ6922 Cardbus Controller"; +static const char pci_device_1217_6933[] = "OZ6933 Cardbus Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1217_6933_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1217_6972[] = "OZ6912 Cardbus Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1217_6972_1179_0001[] = "Magnia Z310"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1218[] = "Hybricon Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1219[] = "First Virtual Corporation"; +#endif +static const char pci_vendor_121a[] = "3Dfx Interactive, Inc."; +static const char pci_device_121a_0001[] = "Voodoo"; +static const char pci_device_121a_0002[] = "Voodoo 2"; +static const char pci_device_121a_0003[] = "Voodoo Banshee"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_0003[] = "Monster Fusion"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_4000[] = "Monster Fusion"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_4002[] = "Monster Fusion"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_4801[] = "Monster Fusion AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_4803[] = "Monster Fusion AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_8030[] = "Monster Fusion"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1092_8035[] = "Monster Fusion AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_10b0_0001[] = "Dragon 4000"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_1102_1018[] = "3D Blaster Banshee VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_121a_0001[] = "Voodoo Banshee AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_121a_0003[] = "Voodoo Banshee AGP SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_121a_0004[] = "Voodoo Banshee"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_139c_0016[] = "Raven"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_139c_0017[] = "Raven"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0003_14af_0002[] = "Maxi Gamer Phoenix"; +#endif +static const char pci_device_121a_0004[] = "Voodoo Banshee [Velocity 100]"; +static const char pci_device_121a_0005[] = "Voodoo 3"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0004[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0030[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0031[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0034[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0036[] = "Voodoo3"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0037[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0038[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_003a[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0044[] = "Voodoo3"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_004b[] = "Velocity 100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_004c[] = "Velocity 200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_004d[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_004e[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0051[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0052[] = "Voodoo3 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0060[] = "Voodoo3 3500 TV (NTSC)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0061[] = "Voodoo3 3500 TV (PAL)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0005_121a_0062[] = "Voodoo3 3500 TV (SECAM)"; +#endif +static const char pci_device_121a_0009[] = "Voodoo 4 / Voodoo 5"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_121a_0009_121a_0009[] = "Voodoo5 AGP 5500/6000"; +#endif +static const char pci_device_121a_0057[] = "Voodoo 3/3000 [Avenger]"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_121b[] = "Advanced Telecommunications Modules"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_121c[] = "Nippon Texaco., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_121d[] = "Lippert Automationstechnik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_121e[] = "CSPI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_121f[] = "Arcus Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1220[] = "Ariel Corporation"; +static const char pci_device_1220_1220[] = "AMCC 5933 TMS320C80 DSP/Imaging board"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1221[] = "Contec Co., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1222[] = "Ancor Communications, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1223[] = "Artesyn Communication Products"; +static const char pci_device_1223_0003[] = "PM/Link"; +static const char pci_device_1223_0004[] = "PM/T1"; +static const char pci_device_1223_0005[] = "PM/E1"; +static const char pci_device_1223_0008[] = "PM/SLS"; +static const char pci_device_1223_0009[] = "BajaSpan Resource Target"; +static const char pci_device_1223_000a[] = "BajaSpan Section 0"; +static const char pci_device_1223_000b[] = "BajaSpan Section 1"; +static const char pci_device_1223_000c[] = "BajaSpan Section 2"; +static const char pci_device_1223_000d[] = "BajaSpan Section 3"; +static const char pci_device_1223_000e[] = "PM/PPC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1224[] = "Interactive Images"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1225[] = "Power I/O, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1227[] = "Tech-Source"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1228[] = "Norsk Elektro Optikk A/S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1229[] = "Data Kinesis Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_122a[] = "Integrated Telecom"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_122b[] = "LG Industrial Systems Co., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_122c[] = "Sican GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_122d[] = "Aztech System Ltd"; +static const char pci_device_122d_1206[] = "368DSP"; +static const char pci_device_122d_50dc[] = "3328 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_122d_50dc_122d_0001[] = "3328 Audio"; +#endif +static const char pci_device_122d_80da[] = "3328 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_122d_80da_122d_0001[] = "3328 Audio"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_122e[] = "Xyratex"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_122f[] = "Andrew Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1230[] = "Fishcamp Engineering"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1231[] = "Woodward McCoach, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1232[] = "GPT Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1233[] = "Bus-Tech, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1234[] = "Technical Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1235[] = "Risq Modular Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1236[] = "Sigma Designs Corporation"; +static const char pci_device_1236_0000[] = "RealMagic64/GX"; +static const char pci_device_1236_6401[] = "REALmagic 64/GX (SD 6425)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1237[] = "Alta Technology Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1238[] = "Adtran"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1239[] = "3DO Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_123a[] = "Visicom Laboratories, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_123b[] = "Seeq Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_123c[] = "Century Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_123d[] = "Engineering Design Team, Inc."; +static const char pci_device_123d_0000[] = "EasyConnect 8/32"; +static const char pci_device_123d_0002[] = "EasyConnect 8/64"; +static const char pci_device_123d_0003[] = "EasyIO"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_123e[] = "Simutech, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_123f[] = "C-Cube Microsystems"; +static const char pci_device_123f_00e4[] = "MPEG"; +static const char pci_device_123f_8120[] = "E4?"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_123f_8120_11bd_0006[] = "DV500 E4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_123f_8120_11bd_000a[] = "DV500 E4"; +#endif +static const char pci_device_123f_8888[] = "Cinemaster C 3.0 DVD Decoder"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_123f_8888_1002_0001[] = "Cinemaster C 3.0 DVD Decoder"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_123f_8888_1002_0002[] = "Cinemaster C 3.0 DVD Decoder"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_123f_8888_1328_0001[] = "Cinemaster C 3.0 DVD Decoder"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1240[] = "Marathon Technologies Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1241[] = "DSC Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1242[] = "JNI Corporation"; +static const char pci_device_1242_1560[] = "JNIC-1560 PCI-X Fibre Channel Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1242_1560_1242_6562[] = "FCX2-6562 Dual Channel PCI-X Fibre Channel Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1242_1560_1242_656a[] = "FCX-6562 PCI-X Fibre Channel Adapter"; +#endif +static const char pci_device_1242_4643[] = "FCI-1063 Fibre Channel Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1243[] = "Delphax"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1244[] = "AVM Audiovisuelles MKTG & Computer System GmbH"; +static const char pci_device_1244_0700[] = "B1 ISDN"; +static const char pci_device_1244_0800[] = "C4 ISDN"; +static const char pci_device_1244_0a00[] = "A1 ISDN [Fritz]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1244_0a00_1244_0a00[] = "FRITZ!Card ISDN Controller"; +#endif +static const char pci_device_1244_0e00[] = "Fritz!PCI v2.0 ISDN"; +static const char pci_device_1244_1100[] = "C2 ISDN"; +static const char pci_device_1244_1200[] = "T1 ISDN"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1245[] = "A.P.D., S.A."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1246[] = "Dipix Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1247[] = "Xylon Research, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1248[] = "Central Data Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1249[] = "Samsung Electronics Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_124a[] = "AEG Electrocom GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_124b[] = "SBS/Greenspring Modular I/O"; +static const char pci_device_124b_0040[] = "PCI-40A or cPCI-200 Quad IndustryPack carrier"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_124b_0040_124b_9080[] = "PCI9080 Bridge"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_124c[] = "Solitron Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_124d[] = "Stallion Technologies, Inc."; +static const char pci_device_124d_0000[] = "EasyConnection 8/32"; +static const char pci_device_124d_0002[] = "EasyConnection 8/64"; +static const char pci_device_124d_0003[] = "EasyIO"; +static const char pci_device_124d_0004[] = "EasyConnection/RA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_124e[] = "Cylink"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_124f[] = "Infotrend Technology, Inc."; +static const char pci_device_124f_0041[] = "IFT-2000 Series RAID Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1250[] = "Hitachi Microcomputer System Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1251[] = "VLSI Solutions Oy"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1253[] = "Guzik Technical Enterprises"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1254[] = "Linear Systems Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1255[] = "Optibase Ltd"; +static const char pci_device_1255_1110[] = "MPEG Forge"; +static const char pci_device_1255_1210[] = "MPEG Fusion"; +static const char pci_device_1255_2110[] = "VideoPlex"; +static const char pci_device_1255_2120[] = "VideoPlex CC"; +static const char pci_device_1255_2130[] = "VideoQuest"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1256[] = "Perceptive Solutions, Inc."; +static const char pci_device_1256_4201[] = "PCI-2220I"; +static const char pci_device_1256_4401[] = "PCI-2240I"; +static const char pci_device_1256_5201[] = "PCI-2000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1257[] = "Vertex Networks, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1258[] = "Gilbarco, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1259[] = "Allied Telesyn International"; +static const char pci_device_1259_2560[] = "AT-2560 Fast Ethernet Adapter (i82557B)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_125a[] = "ABB Power Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_125b[] = "Asix Electronics Corporation"; +static const char pci_device_125b_1400[] = "ALFA GFC2204"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_125c[] = "Aurora Technologies, Inc."; +static const char pci_device_125c_0640[] = "Aries 16000P"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_125d[] = "ESS Technology"; +static const char pci_device_125d_0000[] = "ES336H Fax Modem (Early Model)"; +static const char pci_device_125d_1948[] = "Solo?"; +static const char pci_device_125d_1968[] = "ES1968 Maestro 2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1968_1028_0085[] = "ES1968 Maestro-2 PCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1968_1033_8051[] = "ES1968 Maestro-2 Audiodrive"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_125d_1969[] = "ES1969 Solo-1 Audiodrive"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1969_1014_0166[] = "ES1969 SOLO-1 AudioDrive on IBM Aptiva Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1969_125d_8888[] = "Solo-1 Audio Adapter"; +#endif +static const char pci_device_125d_1978[] = "ES1978 Maestro 2E"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1978_0e11_b112[] = "Armada M700"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1978_1033_803c[] = "ES1978 Maestro-2E Audiodrive"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1978_1033_8058[] = "ES1978 Maestro-2E Audiodrive"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1978_1092_4000[] = "Monster Sound MX400"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1978_1179_0001[] = "ES1978 Maestro-2E Audiodrive"; +#endif +static const char pci_device_125d_1988[] = "ES1988 Allegro-1"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1988_1092_4100[] = "Sonic Impact S100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1988_125d_1988[] = "ESS Allegro-1 Audiodrive"; +#endif +static const char pci_device_125d_1989[] = "ESS Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1989_125d_1989[] = "ESS Modem"; +#endif +static const char pci_device_125d_1998[] = "ES1983S Maestro-3i PCI Audio Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_1998_1028_00e6[] = "ES1983S Maestro-3i (Dell Inspiron 8100)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_125d_1999[] = "ES1983S Maestro-3i PCI Modem Accelerator"; +static const char pci_device_125d_199a[] = "ES1983S Maestro-3i PCI Audio Accelerator"; +static const char pci_device_125d_199b[] = "ES1983S Maestro-3i PCI Modem Accelerator"; +static const char pci_device_125d_2808[] = "ES336H Fax Modem (Later Model)"; +static const char pci_device_125d_2838[] = "ES2838/2839 SuperLink Modem"; +static const char pci_device_125d_2898[] = "ES2898 Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_125d_0424[] = "ES56-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_125d_0425[] = "ES56T-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_125d_0426[] = "ES56V-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_125d_0427[] = "VW-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_125d_0428[] = "ES56ST-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_125d_0429[] = "ES56SV-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_147a_c001[] = "ES56-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_14fe_0428[] = "ES56-PI Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_125d_2898_14fe_0429[] = "ES56-PI Data Fax Modem"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_125e[] = "Specialvideo Engineering SRL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_125f[] = "Concurrent Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1260[] = "Harris Semiconductor"; +static const char pci_device_1260_3873[] = "Prism 2.5 Wavelan chipset"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1260_3873_1186_3501[] = "DWL-520 Wireless PCI Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1260_3873_1668_0414[] = "HWP01170-01 802.11b PCI Wireless Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1260_3873_1737_3874[] = "WMP11 Wireless 802.11b PCI Adapter"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1260_3873_8086_2513[] = "Wireless 802.11b MiniPCI Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1260_8130[] = "HMP8130 NTSC/PAL Video Decoder"; +static const char pci_device_1260_8131[] = "HMP8131 NTSC/PAL Video Decoder"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1261[] = "Matsushita-Kotobuki Electronics Industries, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1262[] = "ES Computer Company, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1263[] = "Sonic Solutions"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1264[] = "Aval Nagasaki Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1265[] = "Casio Computer Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1266[] = "Microdyne Corporation"; +static const char pci_device_1266_0001[] = "NE10/100 Adapter (i82557B)"; +static const char pci_device_1266_1910[] = "NE2000Plus (RT8029) Ethernet Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1266_1910_1266_1910[] = "NE2000Plus Ethernet Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1267[] = "S. A. Telecommunications"; +static const char pci_device_1267_5352[] = "PCR2101"; +static const char pci_device_1267_5a4b[] = "Telsat Turbo"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1268[] = "Tektronix"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1269[] = "Thomson-CSF/TTM"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_126a[] = "Lexmark International, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_126b[] = "Adax, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_126c[] = "Northern Telecom"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_126d[] = "Splash Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_126e[] = "Sumitomo Metal Industries, Ltd."; +#endif +static const char pci_vendor_126f[] = "Silicon Motion, Inc."; +static const char pci_device_126f_0710[] = "SM710 LynxEM"; +static const char pci_device_126f_0712[] = "SM712 LynxEM+"; +static const char pci_device_126f_0720[] = "SM720 Lynx3DM"; +static const char pci_device_126f_0810[] = "SM810 LynxE"; +static const char pci_device_126f_0811[] = "SM811 LynxE"; +static const char pci_device_126f_0820[] = "SM820 Lynx3D"; +static const char pci_device_126f_0910[] = "SM910"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1270[] = "Olympus Optical Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1271[] = "GW Instruments"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1272[] = "Telematics International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1273[] = "Hughes Network Systems"; +static const char pci_device_1273_0002[] = "DirecPC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1274[] = "Ensoniq"; +static const char pci_device_1274_1371[] = "ES1371 [AudioPCI-97]"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_0e11_0024[] = "AudioPCI on Motherboard Compaq Deskpro"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_0e11_b1a7[] = "ES1371, ES1373 AudioPCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1033_80ac[] = "ES1371, ES1373 AudioPCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1042_1854[] = "Tazer"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_107b_8054[] = "Tabor2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1274_1371[] = "Creative Sound Blaster AudioPCI64V, AudioPCI128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6470[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6147 1.1A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6560[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6156 1.10"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6630[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6163BX 1.0A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6631[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6163VIA 1.0A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6632[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6163BX 2.0A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6633[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6163VIA 2.0A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6820[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6182 1.00"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6822[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6182 1.00A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6830[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6183 1.00"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6880[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6188 1.00"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6900[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6190 1.00"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6910[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6191"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6930[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6193"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6990[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6199BX 2.0A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1462_6991[] = "ES1371, ES1373 AudioPCI On Motherboard MS-6199VIA 2.0A"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_14a4_2077[] = "ES1371, ES1373 AudioPCI On Motherboard KR639"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_14a4_2105[] = "ES1371, ES1373 AudioPCI On Motherboard MR800"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_14a4_2107[] = "ES1371, ES1373 AudioPCI On Motherboard MR801"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_14a4_2172[] = "ES1371, ES1373 AudioPCI On Motherboard DR739"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1509_9902[] = "ES1371, ES1373 AudioPCI On Motherboard KW11"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1509_9903[] = "ES1371, ES1373 AudioPCI On Motherboard KW31"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1509_9904[] = "ES1371, ES1373 AudioPCI On Motherboard KA11"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_1509_9905[] = "ES1371, ES1373 AudioPCI On Motherboard KC13"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_152d_8801[] = "ES1371, ES1373 AudioPCI On Motherboard CP810E"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_152d_8802[] = "ES1371, ES1373 AudioPCI On Motherboard CP810"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_152d_8803[] = "ES1371, ES1373 AudioPCI On Motherboard P3810E"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_152d_8804[] = "ES1371, ES1373 AudioPCI On Motherboard P3810-S"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_152d_8805[] = "ES1371, ES1373 AudioPCI On Motherboard P3820-S"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_270f_2001[] = "ES1371, ES1373 AudioPCI On Motherboard 6CTR"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_270f_2200[] = "ES1371, ES1373 AudioPCI On Motherboard 6WTX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_270f_3000[] = "ES1371, ES1373 AudioPCI On Motherboard 6WSV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_270f_3100[] = "ES1371, ES1373 AudioPCI On Motherboard 6WIV2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_270f_3102[] = "ES1371, ES1373 AudioPCI On Motherboard 6WIV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_270f_7060[] = "ES1371, ES1373 AudioPCI On Motherboard 6ASA2"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_4249[] = "ES1371, ES1373 AudioPCI On Motherboard BI440ZX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_424c[] = "ES1371, ES1373 AudioPCI On Motherboard BL440ZX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_425a[] = "ES1371, ES1373 AudioPCI On Motherboard BZ440ZX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_4341[] = "ES1371, ES1373 AudioPCI On Motherboard Cayman"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_4343[] = "ES1371, ES1373 AudioPCI On Motherboard Cape Cod"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_4649[] = "ES1371, ES1373 AudioPCI On Motherboard Fire Island"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_464a[] = "ES1371, ES1373 AudioPCI On Motherboard FJ440ZX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_4d4f[] = "ES1371, ES1373 AudioPCI On Motherboard Montreal"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_4f43[] = "ES1371, ES1373 AudioPCI On Motherboard OC440LX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_5243[] = "ES1371, ES1373 AudioPCI On Motherboard RC440BX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_5352[] = "ES1371, ES1373 AudioPCI On Motherboard SunRiver"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_5643[] = "ES1371, ES1373 AudioPCI On Motherboard Vancouver"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_1371_8086_5753[] = "ES1371, ES1373 AudioPCI On Motherboard WS440BX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_1274_5000[] = "ES1370 [AudioPCI]"; +static const char pci_device_1274_5880[] = "5880 AudioPCI"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_1274_2000[] = "Creative Sound Blaster AudioPCI128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_1274_2003[] = "Creative SoundBlaster AudioPCI 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_1274_5880[] = "Creative Sound Blaster AudioPCI128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_1458_a000[] = "5880 AudioPCI On Motherboard 6OXET"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_1462_6880[] = "5880 AudioPCI On Motherboard MS-6188 1.00"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_270f_2001[] = "5880 AudioPCI On Motherboard 6CTR"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_270f_2200[] = "5880 AudioPCI On Motherboard 6WTX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1274_5880_270f_7040[] = "5880 AudioPCI On Motherboard 6ATA4"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1275[] = "Network Appliance Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1276[] = "Switched Network Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1277[] = "Comstream"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1278[] = "Transtech Parallel Systems Ltd."; +static const char pci_device_1278_0701[] = "TPE3/TM3 PowerPC Node"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1279[] = "Transmeta Corporation"; +static const char pci_device_1279_0295[] = "Northbridge"; +static const char pci_device_1279_0395[] = "LongRun Northbridge"; +static const char pci_device_1279_0396[] = "SDRAM controller"; +static const char pci_device_1279_0397[] = "BIOS scratchpad"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_127a[] = "Rockwell International"; +static const char pci_device_127a_1002[] = "HCF 56k Data/Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_1092_094c[] = "SupraExpress 56i PRO [Diamond SUP2380]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_122d_4002[] = "HPG / MDP3858-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_122d_4005[] = "MDP3858-E"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_122d_4007[] = "MDP3858-A/-NZ"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_122d_4012[] = "MDP3858-SA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_122d_4017[] = "MDP3858-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_122d_4018[] = "MDP3858-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1002_127a_1002[] = "Rockwell 56K D/F HCF Modem"; +#endif +static const char pci_device_127a_1003[] = "HCF 56k Data/Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_0e11_b0bc[] = "229-DF Zephyr"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_0e11_b114[] = "229-DF Cheetah"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_1033_802b[] = "229-DF"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_13df_1003[] = "PCI56RX Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_13e0_0117[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_13e0_0147[] = "IBM F-1156IV+/R3 Spain V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_13e0_0197[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_13e0_01c7[] = "IBM F-1156IV+/R3 WW V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_13e0_01f7[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_1436_1003[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_1436_1103[] = "IBM 5614PM3G V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1003_1436_1602[] = "Compaq 229-DF Ducati"; +#endif +static const char pci_device_127a_1004[] = "HCF 56k Data/Fax/Voice Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1004_1048_1500[] = "MicroLink 56k Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1004_10cf_1059[] = "Fujitsu 229-DFRT"; +#endif +static const char pci_device_127a_1005[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_1033_8029[] = "229-DFSV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_1033_8054[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_10cf_103c[] = "Fujitsu"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_10cf_1055[] = "Fujitsu 229-DFSV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_10cf_1056[] = "Fujitsu 229-DFSV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4003[] = "MDP3858SP-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4006[] = "Packard Bell MDP3858V-E"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4008[] = "MDP3858SP-A/SP-NZ"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4009[] = "MDP3858SP-E"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4010[] = "MDP3858V-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4011[] = "MDP3858SP-SA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4013[] = "MDP3858V-A/V-NZ"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4015[] = "MDP3858SP-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4016[] = "MDP3858V-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_122d_4019[] = "MDP3858V-SA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_13df_1005[] = "PCI56RVP Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_13e0_0187[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_13e0_01a7[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_13e0_01b7[] = "IBM DF-1156IV+/R3 Spain V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_13e0_01d7[] = "IBM DF-1156IV+/R3 WW V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_1436_1005[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_1436_1105[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1005_1437_1105[] = "IBM 5614PS3G V.90 Modem"; +#endif +static const char pci_device_127a_1022[] = "HCF 56k Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1022_1436_1303[] = "M3-5614PM3G V.90 Modem"; +#endif +static const char pci_device_127a_1023[] = "HCF 56k Data/Fax Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_122d_4020[] = "Packard Bell MDP3858-WE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_122d_4023[] = "MDP3858-UE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_13e0_0247[] = "IBM F-1156IV+/R6 Spain V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_13e0_0297[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_13e0_02c7[] = "IBM F-1156IV+/R6 WW V.90 Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_1436_1203[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1023_1436_1303[] = "IBM"; +#endif +static const char pci_device_127a_1024[] = "HCF 56k Data/Fax/Voice Modem"; +static const char pci_device_127a_1025[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1025_10cf_106a[] = "Fujitsu 235-DFSV"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1025_122d_4021[] = "Packard Bell MDP3858V-WE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1025_122d_4022[] = "MDP3858SP-WE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1025_122d_4024[] = "MDP3858V-UE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_1025_122d_4025[] = "MDP3858SP-UE"; +#endif +static const char pci_device_127a_1026[] = "HCF 56k PCI Speakerphone Modem"; +static const char pci_device_127a_1032[] = "HCF 56k Modem"; +static const char pci_device_127a_1033[] = "HCF 56k Modem"; +static const char pci_device_127a_1034[] = "HCF 56k Modem"; +static const char pci_device_127a_1035[] = "HCF 56k PCI Speakerphone Modem"; +static const char pci_device_127a_1036[] = "HCF 56k Modem"; +static const char pci_device_127a_1085[] = "HCF 56k Volcano PCI Modem"; +static const char pci_device_127a_2005[] = "HCF 56k Data/Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_8044[] = "229-DFSV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_8045[] = "229-DFSV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_8055[] = "PBE/Aztech 235W-DFSV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_8056[] = "235-DFSV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_805a[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_805f[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2005_104d_8074[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_127a_2013[] = "HSF 56k Data/Fax Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2013_1179_0001[] = "Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2013_1179_ff00[] = "Modem"; +#endif +static const char pci_device_127a_2014[] = "HSF 56k Data/Fax/Voice Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2014_10cf_1057[] = "Fujitsu Citicorp III"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2014_122d_4050[] = "MSP3880-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2014_122d_4055[] = "MSP3880-W"; +#endif +static const char pci_device_127a_2015[] = "HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2015_10cf_1063[] = "Fujitsu"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2015_10cf_1064[] = "Fujitsu"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2015_1468_2015[] = "Fujitsu"; +#endif +static const char pci_device_127a_2016[] = "HSF 56k Data/Fax/Voice/Spkp Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2016_122d_4051[] = "MSP3880V-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2016_122d_4052[] = "MSP3880SP-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2016_122d_4054[] = "MSP3880V-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2016_122d_4056[] = "MSP3880SP-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_2016_122d_4057[] = "MSP3880SP-A"; +#endif +static const char pci_device_127a_4311[] = "Riptide HSF 56k PCI Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4311_127a_4311[] = "Ring Modular? Riptide HSF RT HP Dom"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4311_13e0_0210[] = "HP-GVC"; +#endif +static const char pci_device_127a_4320[] = "Riptide PCI Audio Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4320_1235_4320[] = "Riptide PCI Audio Controller"; +#endif +static const char pci_device_127a_4321[] = "Riptide HCF 56k PCI Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4321_1235_4321[] = "Hewlett Packard DF"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4321_1235_4324[] = "Hewlett Packard DF"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4321_13e0_0210[] = "Hewlett Packard DF"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4321_144d_2321[] = "Riptide"; +#endif +static const char pci_device_127a_4322[] = "Riptide PCI Game Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_4322_1235_4322[] = "Riptide PCI Game Controller"; +#endif +static const char pci_device_127a_8234[] = "RapidFire 616X ATM155 Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_8234_108d_0022[] = "RapidFire 616X ATM155 Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_127a_8234_108d_0027[] = "RapidFire 616X ATM155 Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_127b[] = "Pixera Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_127c[] = "Crosspoint Solutions, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_127d[] = "Vela Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_127e[] = "Winnov, L.P."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_127f[] = "Fujifilm"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1280[] = "Photoscript Group Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1281[] = "Yokogawa Electric Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1282[] = "Davicom Semiconductor, Inc."; +static const char pci_device_1282_9009[] = "Ethernet 100/10 MBit"; +static const char pci_device_1282_9100[] = "Ethernet 100/10 MBit"; +static const char pci_device_1282_9102[] = "Ethernet 100/10 MBit"; +static const char pci_device_1282_9132[] = "Ethernet 100/10 MBit"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1283[] = "Integrated Technology Express, Inc."; +static const char pci_device_1283_673a[] = "IT8330G"; +static const char pci_device_1283_8330[] = "IT8330G"; +static const char pci_device_1283_8888[] = "IT8888F PCI to ISA Bridge with SMB"; +static const char pci_device_1283_8889[] = "IT8889F PCI to ISA Bridge"; +static const char pci_device_1283_e886[] = "IT8330G"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1284[] = "Sahara Networks, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1285[] = "Platform Technologies, Inc."; +static const char pci_device_1285_0100[] = "AGOGO sound chip (aka ESS Maestro 1)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1286[] = "Mazet GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1287[] = "M-Pact, Inc."; +static const char pci_device_1287_001e[] = "LS220D DVD Decoder"; +static const char pci_device_1287_001f[] = "LS220C DVD Decoder"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1288[] = "Timestep Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1289[] = "AVC Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_128a[] = "Asante Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_128b[] = "Transwitch Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_128c[] = "Retix Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_128d[] = "G2 Networks, Inc."; +static const char pci_device_128d_0021[] = "ATM155 Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_128e[] = "Hoontech Corporation/Samho Multi Tech Ltd."; +static const char pci_device_128e_0008[] = "ST128 WSS/SB"; +static const char pci_device_128e_0009[] = "ST128 SAM9407"; +static const char pci_device_128e_000a[] = "ST128 Game Port"; +static const char pci_device_128e_000b[] = "ST128 MPU Port"; +static const char pci_device_128e_000c[] = "ST128 Ctrl Port"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_128f[] = "Tateno Dennou, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1290[] = "Sord Computer Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1291[] = "NCS Computer Italia"; +#endif +static const char pci_vendor_1292[] = "Tritech Microelectronics Inc"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1293[] = "Media Reality Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1294[] = "Rhetorex, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1295[] = "Imagenation Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1296[] = "Kofax Image Products"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1297[] = "Holco Enterprise Co, Ltd/Shuttle Computer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1298[] = "Spellcaster Telecommunications Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1299[] = "Knowledge Technology Lab."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_129a[] = "VMetro, inc."; +static const char pci_device_129a_0615[] = "PBT-615 PCI-X Bus Analyzer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_129b[] = "Image Access"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_129c[] = "Jaycor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_129d[] = "Compcore Multimedia, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_129e[] = "Victor Company of Japan, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_129f[] = "OEC Medical Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a0[] = "Allen-Bradley Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a1[] = "Simpact Associates, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a2[] = "Newgen Systems Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a3[] = "Lucent Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a4[] = "NTT Electronics Technology Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a5[] = "Vision Dynamics Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a6[] = "Scalable Networks, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a7[] = "AMO GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a8[] = "News Datacom"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12a9[] = "Xiotech Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12aa[] = "SDL Communications, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ab[] = "Yuan Yuan Enterprise Co., Ltd."; +static const char pci_device_12ab_3000[] = "MPG-200C PCI DVD Decoder Card"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ac[] = "Measurex Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ad[] = "Multidata GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ae[] = "Alteon Networks Inc."; +static const char pci_device_12ae_0001[] = "AceNIC Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12ae_0001_12ae_0001[] = "Gigabit Ethernet-SX (Universal)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12ae_0001_1410_0104[] = "Gigabit Ethernet-SX PCI Adapter"; +#endif +static const char pci_device_12ae_0002[] = "AceNIC Gigabit Ethernet (Copper)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12ae_0002_12ae_0002[] = "Gigabit Ethernet-T (3C986-T)"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12af[] = "TDK USA Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b0[] = "Jorge Scientific Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b1[] = "GammaLink"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b2[] = "General Signal Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b3[] = "Inter-Face Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b4[] = "FutureTel Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b5[] = "Granite Systems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b6[] = "Natural Microsystems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b7[] = "Cognex Modular Vision Systems Div. - Acumen Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b8[] = "Korg"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12b9[] = "US Robotics/3Com"; +static const char pci_device_12b9_1006[] = "WinModem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_005c[] = "USR 56k Internal Voice WinModem (Model 3472)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_005e[] = "USR 56k Internal WinModem (Models 662975)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_0062[] = "USR 56k Internal Voice WinModem (Model 662978)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_0068[] = "USR 56k Internal Voice WinModem (Model 5690)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_007a[] = "USR 56k Internal Voice WinModem (Model 662974)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_007f[] = "USR 56k Internal WinModem (Models 5698, 5699)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_0080[] = "USR 56k Internal WinModem (Models 2975, 3528)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_0081[] = "USR 56k Internal Voice WinModem (Models 2974, 3529)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1006_12b9_0091[] = "USR 56k Internal Voice WinModem (Model 2978)"; +#endif +static const char pci_device_12b9_1007[] = "USR 56k Internal WinModem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1007_12b9_00a3[] = "USR 56k Internal WinModem (Model 3595)"; +#endif +static const char pci_device_12b9_1008[] = "56K FaxModem Model 5610"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1008_12b9_00a2[] = "USR 56k Internal FAX Modem (Model 2977)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1008_12b9_00aa[] = "USR 56k Internal Voice Modem (Model 2976)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1008_12b9_00ab[] = "USR 56k Internal Voice Modem (Model 5609)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1008_12b9_00ac[] = "USR 56k Internal Voice Modem (Model 3298)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12b9_1008_12b9_00ad[] = "USR 56k Internal FAX Modem (Model 5610)"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ba[] = "BittWare, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12bb[] = "Nippon Unisoft Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12bc[] = "Array Microsystems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12bd[] = "Computerm Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12be[] = "Anchor Chips Inc."; +static const char pci_device_12be_3041[] = "AN3041Q CO-MEM"; +static const char pci_device_12be_3042[] = "AN3042Q CO-MEM Lite"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12be_3042_12be_3042[] = "Anchor Chips Lite Evaluation Board"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12bf[] = "Fujifilm Microdevices"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c0[] = "Infimed"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c1[] = "GMM Research Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c2[] = "Mentec Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c3[] = "Holtek Microelectronics Inc"; +static const char pci_device_12c3_0058[] = "PCI NE2K Ethernet"; +static const char pci_device_12c3_5598[] = "PCI NE2K Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c4[] = "Connect Tech Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c5[] = "Picture Elements Incorporated"; +static const char pci_device_12c5_007e[] = "Imaging/Scanning Subsystem Engine"; +static const char pci_device_12c5_007f[] = "Imaging/Scanning Subsystem Engine"; +static const char pci_device_12c5_0081[] = "PCIVST [Grayscale Thresholding Engine]"; +static const char pci_device_12c5_0085[] = "Video Simulator/Sender"; +static const char pci_device_12c5_0086[] = "THR2 Multi-scale Thresholder"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c6[] = "Mitani Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c7[] = "Dialogic Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c8[] = "G Force Co, Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12c9[] = "Gigi Operations"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ca[] = "Integrated Computing Engines"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12cb[] = "Antex Electronics Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12cc[] = "Pluto Technologies International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12cd[] = "Aims Lab"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ce[] = "Netspeed Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12cf[] = "Prophet Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d0[] = "GDE Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d1[] = "PSITech"; +#endif +static const char pci_vendor_12d2[] = "NVidia / SGS Thomson (Joint Venture)"; +static const char pci_device_12d2_0008[] = "NV1"; +static const char pci_device_12d2_0009[] = "DAC64"; +static const char pci_device_12d2_0018[] = "Riva128"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_1048_0c10[] = "VICTORY Erazor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_107b_8030[] = "STB Velocity 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_1092_0350[] = "Viper V330"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_1092_1092[] = "Viper V330"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b1b[] = "STB Velocity 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b1d[] = "STB Velocity 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b1e[] = "STB Velocity 128, PAL TV-Out"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b20[] = "STB Velocity 128 Sapphire"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b21[] = "STB Velocity 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b22[] = "STB Velocity 128 AGP, NTSC TV-Out"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b23[] = "STB Velocity 128 AGP, PAL TV-Out"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b27[] = "STB Velocity 128 DVD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_1b88[] = "MVP Pro 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_222a[] = "STB Velocity 128 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_2230[] = "STB Velocity 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_2232[] = "STB Velocity 128"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_10b4_2235[] = "STB Velocity 128 AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12d2_0018_2a15_54a3[] = "3DVision-SAGP / 3DexPlorer 3000"; +#endif +static const char pci_device_12d2_0019[] = "Riva128ZX"; +static const char pci_device_12d2_0020[] = "TNT"; +static const char pci_device_12d2_0028[] = "TNT2"; +static const char pci_device_12d2_0029[] = "UTNT2"; +static const char pci_device_12d2_002c[] = "VTNT2"; +static const char pci_device_12d2_00a0[] = "ITNT2"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d3[] = "Vingmed Sound A/S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d4[] = "Ulticom (Formerly DGM&S)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d5[] = "Equator Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d6[] = "Analogic Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d7[] = "Biotronic SRL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d8[] = "Pericom Semiconductor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12d9[] = "Aculab PLC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12da[] = "True Time Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12db[] = "Annapolis Micro Systems, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12dc[] = "Symicron Computer Communication Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12dd[] = "Management Graphics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12de[] = "Rainbow Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12df[] = "SBS Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e0[] = "Chase Research"; +static const char pci_device_12e0_0010[] = "ST16C654 Quad UART"; +static const char pci_device_12e0_0020[] = "ST16C654 Quad UART"; +static const char pci_device_12e0_0030[] = "ST16C654 Quad UART"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e1[] = "Nintendo Co, Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e2[] = "Datum Inc. Bancomm-Timing Division"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e3[] = "Imation Corp - Medical Imaging Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e4[] = "Brooktrout Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e5[] = "Apex Semiconductor Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e6[] = "Cirel Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e7[] = "Sunsgroup Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e8[] = "Crisc Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12e9[] = "GE Spacenet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ea[] = "Zuken"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12eb[] = "Aureal Semiconductor"; +static const char pci_device_12eb_0001[] = "Vortex 1"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_104d_8036[] = "AU8820 Vortex Digital Audio Processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_1092_2000[] = "Sonic Impact A3D"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_1092_2100[] = "Sonic Impact A3D"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_1092_2110[] = "Sonic Impact A3D"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_1092_2200[] = "Sonic Impact A3D"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_122d_1002[] = "AU8820 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_12eb_0001[] = "AU8820 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0001_5053_3355[] = "Montego"; +#endif +static const char pci_device_12eb_0002[] = "Vortex 2"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_104d_8049[] = "AU8830 Vortex 3D Digital Audio Processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_104d_807b[] = "AU8830 Vortex 3D Digital Audio Processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_1092_3000[] = "Monster Sound II"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_1092_3001[] = "Monster Sound II"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_1092_3002[] = "Monster Sound II"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_1092_3003[] = "Monster Sound II"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_1092_3004[] = "Monster Sound II"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_12eb_0001[] = "AU8830 Vortex 3D Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_12eb_0002[] = "AU8830 Vortex 3D Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_12eb_0088[] = "AU8830 Vortex 3D Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_144d_3510[] = "AU8830 Vortex 3D Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0002_5053_3356[] = "Montego II"; +#endif +static const char pci_device_12eb_0003[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_104d_8049[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_104d_8077[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_109f_1000[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_12eb_0003[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_1462_6780[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_14a4_2073[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_14a4_2091[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_14a4_2104[] = "AU8810 Vortex Digital Audio Processor"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_0003_14a4_2106[] = "AU8810 Vortex Digital Audio Processor"; +#endif +static const char pci_device_12eb_8803[] = "Vortex 56k Software Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_12eb_8803_12eb_8803[] = "Vortex 56k Software Modem"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ec[] = "3A International, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ed[] = "Optivision Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ee[] = "Orange Micro"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ef[] = "Vienna Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f0[] = "Pentek"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f1[] = "Sorenson Vision Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f2[] = "Gammagraphx, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f3[] = "Radstone Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f4[] = "Megatel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f5[] = "Forks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f6[] = "Dawson France"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f7[] = "Cognex"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f8[] = "Electronic Design GmbH"; +static const char pci_device_12f8_0002[] = "VideoMaker"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12f9[] = "Four Fold Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12fb[] = "Spectrum Signal Processing"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12fc[] = "Capital Equipment Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12fd[] = "I2S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12fe[] = "ESD Electronic System Design GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_12ff[] = "Lexicon"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1300[] = "Harman International Industries Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1302[] = "Computer Sciences Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1303[] = "Innovative Integration"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1304[] = "Juniper Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1305[] = "Netphone, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1306[] = "Duet Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1307[] = "Computer Boards"; +static const char pci_device_1307_0001[] = "PCI-DAS1602/16"; +static const char pci_device_1307_000b[] = "PCI-DIO48H"; +static const char pci_device_1307_000c[] = "PCI-PDISO8"; +static const char pci_device_1307_000d[] = "PCI-PDISO16"; +static const char pci_device_1307_000f[] = "PCI-DAS1200"; +static const char pci_device_1307_0010[] = "PCI-DAS1602/12"; +static const char pci_device_1307_0014[] = "PCI-DIO24H"; +static const char pci_device_1307_0015[] = "PCI-DIO24H/CTR3"; +static const char pci_device_1307_0016[] = "PCI-DIO48H/CTR15"; +static const char pci_device_1307_0017[] = "PCI-DIO96H"; +static const char pci_device_1307_0018[] = "PCI-CTR05"; +static const char pci_device_1307_0019[] = "PCI-DAS1200/JR"; +static const char pci_device_1307_001a[] = "PCI-DAS1001"; +static const char pci_device_1307_001b[] = "PCI-DAS1002"; +static const char pci_device_1307_001c[] = "PCI-DAS1602JR/16"; +static const char pci_device_1307_001d[] = "PCI-DAS6402/16"; +static const char pci_device_1307_001e[] = "PCI-DAS6402/12"; +static const char pci_device_1307_001f[] = "PCI-DAS16/M1"; +static const char pci_device_1307_0020[] = "PCI-DDA02/12"; +static const char pci_device_1307_0021[] = "PCI-DDA04/12"; +static const char pci_device_1307_0022[] = "PCI-DDA08/12"; +static const char pci_device_1307_0023[] = "PCI-DDA02/16"; +static const char pci_device_1307_0024[] = "PCI-DDA04/16"; +static const char pci_device_1307_0025[] = "PCI-DDA08/16"; +static const char pci_device_1307_0026[] = "PCI-DAC04/12-HS"; +static const char pci_device_1307_0027[] = "PCI-DAC04/16-HS"; +static const char pci_device_1307_0028[] = "PCI-DIO24"; +static const char pci_device_1307_0029[] = "PCI-DAS08"; +static const char pci_device_1307_002c[] = "PCI-INT32"; +static const char pci_device_1307_0033[] = "PCI-DUAL-AC5"; +static const char pci_device_1307_0034[] = "PCI-DAS-TC"; +static const char pci_device_1307_0035[] = "PCI-DAS64/M1/16"; +static const char pci_device_1307_0036[] = "PCI-DAS64/M2/16"; +static const char pci_device_1307_0037[] = "PCI-DAS64/M3/16"; +static const char pci_device_1307_004c[] = "PCI-DAS1000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1308[] = "Jato Technologies Inc."; +static const char pci_device_1308_0001[] = "NetCelerator Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1308_0001_1308_0001[] = "NetCelerator Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1309[] = "AB Semiconductor Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_130a[] = "Mitsubishi Electric Microcomputer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_130b[] = "Colorgraphic Communications Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_130c[] = "Ambex Technologies, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_130d[] = "Accelerix Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_130e[] = "Yamatake-Honeywell Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_130f[] = "Advanet Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1310[] = "Gespac"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1311[] = "Videoserver, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1312[] = "Acuity Imaging, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1313[] = "Yaskawa Electric Co."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1316[] = "Teradyne Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1317[] = "Linksys"; +static const char pci_device_1317_0981[] = "Fast Ethernet 10/100"; +static const char pci_device_1317_0985[] = "Network Everywhere Fast Ethernet 10/100 model NC100"; +static const char pci_device_1317_1985[] = "Fast Ethernet 10/100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1318[] = "Packet Engines Inc."; +static const char pci_device_1318_0911[] = "PCI Ethernet Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1319[] = "Fortemedia, Inc"; +static const char pci_device_1319_0801[] = "Xwave QS3000A [FM801]"; +static const char pci_device_1319_0802[] = "Xwave QS3000A [FM801 game port]"; +static const char pci_device_1319_1000[] = "FM801 PCI Audio"; +static const char pci_device_1319_1001[] = "FM801 PCI Joystick"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_131a[] = "Finisar Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_131c[] = "Nippon Electro-Sensory Devices Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_131d[] = "Sysmic, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_131e[] = "Xinex Networks Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_131f[] = "Siig Inc"; +static const char pci_device_131f_1000[] = "CyberSerial (1-port) 16550"; +static const char pci_device_131f_1001[] = "CyberSerial (1-port) 16650"; +static const char pci_device_131f_1002[] = "CyberSerial (1-port) 16850"; +static const char pci_device_131f_1010[] = "Duet 1S(16550)+1P"; +static const char pci_device_131f_1011[] = "Duet 1S(16650)+1P"; +static const char pci_device_131f_1012[] = "Duet 1S(16850)+1P"; +static const char pci_device_131f_1020[] = "CyberParallel (1-port)"; +static const char pci_device_131f_1021[] = "CyberParallel (2-port)"; +static const char pci_device_131f_1030[] = "CyberSerial (2-port) 16550"; +static const char pci_device_131f_1031[] = "CyberSerial (2-port) 16650"; +static const char pci_device_131f_1032[] = "CyberSerial (2-port) 16850"; +static const char pci_device_131f_1034[] = "Trio 2S(16550)+1P"; +static const char pci_device_131f_1035[] = "Trio 2S(16650)+1P"; +static const char pci_device_131f_1036[] = "Trio 2S(16850)+1P"; +static const char pci_device_131f_1050[] = "CyberSerial (4-port) 16550"; +static const char pci_device_131f_1051[] = "CyberSerial (4-port) 16650"; +static const char pci_device_131f_1052[] = "CyberSerial (4-port) 16850"; +static const char pci_device_131f_2000[] = "CyberSerial (1-port) 16550"; +static const char pci_device_131f_2001[] = "CyberSerial (1-port) 16650"; +static const char pci_device_131f_2002[] = "CyberSerial (1-port) 16850"; +static const char pci_device_131f_2010[] = "Duet 1S(16550)+1P"; +static const char pci_device_131f_2011[] = "Duet 1S(16650)+1P"; +static const char pci_device_131f_2012[] = "Duet 1S(16850)+1P"; +static const char pci_device_131f_2020[] = "CyberParallel (1-port)"; +static const char pci_device_131f_2021[] = "CyberParallel (2-port)"; +static const char pci_device_131f_2030[] = "CyberSerial (2-port) 16550"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_131f_2030_131f_2030[] = "PCI Serial Card"; +#endif +static const char pci_device_131f_2031[] = "CyberSerial (2-port) 16650"; +static const char pci_device_131f_2032[] = "CyberSerial (2-port) 16850"; +static const char pci_device_131f_2040[] = "Trio 1S(16550)+2P"; +static const char pci_device_131f_2041[] = "Trio 1S(16650)+2P"; +static const char pci_device_131f_2042[] = "Trio 1S(16850)+2P"; +static const char pci_device_131f_2050[] = "CyberSerial (4-port) 16550"; +static const char pci_device_131f_2051[] = "CyberSerial (4-port) 16650"; +static const char pci_device_131f_2052[] = "CyberSerial (4-port) 16850"; +static const char pci_device_131f_2060[] = "Trio 2S(16550)+1P"; +static const char pci_device_131f_2061[] = "Trio 2S(16650)+1P"; +static const char pci_device_131f_2062[] = "Trio 2S(16850)+1P"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1320[] = "Crypto AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1321[] = "Arcobel Graphics BV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1322[] = "MTT Co., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1323[] = "Dome Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1324[] = "Sphere Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1325[] = "Salix Technologies, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1326[] = "Seachange international"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1327[] = "Voss scientific"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1328[] = "quadrant international"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1329[] = "Productivity Enhancement"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_132a[] = "Microcom Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_132b[] = "Broadband Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_132c[] = "Micrel Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_132d[] = "Integrated Silicon Solution, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1330[] = "MMC Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1331[] = "Radisys Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1332[] = "Micro Memory"; +static const char pci_device_1332_5415[] = "MM-5415CN PCI Memory Module with Battery Backup"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1334[] = "Redcreek Communications, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1335[] = "Videomail, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1337[] = "Third Planet Publishing"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1338[] = "BT Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_133a[] = "Vtel Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_133b[] = "Softcom Microsystems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_133c[] = "Holontech Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_133d[] = "SS Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_133e[] = "Virtual Computer Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_133f[] = "SCM Microsystems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1340[] = "Atalla Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1341[] = "Kyoto Microcomputer Co"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1342[] = "Promax Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1343[] = "Phylon Communications Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1344[] = "Crucial Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1345[] = "Arescom Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1347[] = "Odetics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1349[] = "Sumitomo Electric Industries, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_134a[] = "DTC Technology Corp."; +static const char pci_device_134a_0001[] = "Domex 536"; +static const char pci_device_134a_0002[] = "Domex DMX3194UP SCSI Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_134b[] = "ARK Research Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_134c[] = "Chori Joho System Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_134d[] = "PCTel Inc"; +static const char pci_device_134d_7890[] = "HSP MicroModem 56"; +static const char pci_device_134d_7891[] = "HSP MicroModem 56"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_134d_7891_134d_0001[] = "HSP MicroModem 56"; +#endif +static const char pci_device_134d_7892[] = "HSP MicroModem 56"; +static const char pci_device_134d_7893[] = "HSP MicroModem 56"; +static const char pci_device_134d_7894[] = "HSP MicroModem 56"; +static const char pci_device_134d_7895[] = "HSP MicroModem 56"; +static const char pci_device_134d_7896[] = "HSP MicroModem 56"; +static const char pci_device_134d_7897[] = "HSP MicroModem 56"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_134e[] = "CSTI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_134f[] = "Algo System Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1350[] = "Systec Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1351[] = "Sonix Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1353[] = "Thales Idatys"; +static const char pci_device_1353_0002[] = "Proserver"; +static const char pci_device_1353_0003[] = "PCI-FUT"; +static const char pci_device_1353_0004[] = "PCI-S0"; +static const char pci_device_1353_0005[] = "PCI-FUT-S0"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1354[] = "Dwave System Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1355[] = "Kratos Analytical Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1356[] = "The Logical Co"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1359[] = "Prisa Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_135a[] = "Brain Boxes"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_135b[] = "Giganet Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_135c[] = "Quatech Inc"; +static const char pci_device_135c_0010[] = "QSC-100"; +static const char pci_device_135c_0020[] = "DSC-100"; +static const char pci_device_135c_0030[] = "DSC-200/300"; +static const char pci_device_135c_0040[] = "QSC-200/300"; +static const char pci_device_135c_0050[] = "ESC-100D"; +static const char pci_device_135c_0060[] = "ESC-100M"; +static const char pci_device_135c_00f0[] = "MPAC-100 Syncronous Serial Card (Zilog 85230)"; +static const char pci_device_135c_0170[] = "QSCLP-100"; +static const char pci_device_135c_0180[] = "DSCLP-100"; +static const char pci_device_135c_0190[] = "SSCLP-100"; +static const char pci_device_135c_01a0[] = "QSCLP-200/300"; +static const char pci_device_135c_01b0[] = "DSCLP-200/300"; +static const char pci_device_135c_01c0[] = "SSCLP-200/300"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_135d[] = "ABB Network Partner AB"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_135e[] = "Sealevel Systems Inc"; +static const char pci_device_135e_7101[] = "Single Port RS-232/422/485/530"; +static const char pci_device_135e_7201[] = "Dual Port RS-232/422/485 Interface"; +static const char pci_device_135e_7202[] = "Dual Port RS-232 Interface"; +static const char pci_device_135e_7401[] = "Four Port RS-232 Interface"; +static const char pci_device_135e_7402[] = "Four Port RS-422/485 Interface"; +static const char pci_device_135e_7801[] = "Eight Port RS-232 Interface"; +static const char pci_device_135e_8001[] = "8001 Digital I/O Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_135f[] = "I-Data International A-S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1360[] = "Meinberg Funkuhren"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1361[] = "Soliton Systems K.K."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1362[] = "Fujifacom Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1363[] = "Phoenix Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1364[] = "ATM Communications Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1365[] = "Hypercope GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1366[] = "Teijin Seiki Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1367[] = "Hitachi Zosen Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1368[] = "Skyware Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1369[] = "Digigram"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_136a[] = "High Soft Tech"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_136b[] = "Kawasaki Steel Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_136c[] = "Adtek System Science Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_136d[] = "Gigalabs Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_136f[] = "Applied Magic Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1370[] = "ATL Products"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1371[] = "CNet Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1373[] = "Silicon Vision Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1374[] = "Silicom Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1375[] = "Argosystems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1376[] = "LMC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1377[] = "Electronic Equipment Production & Distribution GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1378[] = "Telemann Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1379[] = "Asahi Kasei Microsystems Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_137a[] = "Mark of the Unicorn Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_137b[] = "PPT Vision"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_137c[] = "Iwatsu Electric Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_137d[] = "Dynachip Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_137e[] = "Patriot Scientific Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_137f[] = "Japan Satellite Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1380[] = "Sanritz Automation Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1381[] = "Brains Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1382[] = "Marian - Electronic & Software"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1383[] = "Controlnet Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1384[] = "Reality Simulation Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1385[] = "Netgear"; +static const char pci_device_1385_4100[] = "802.11b Wireless Adapter (MA301)"; +static const char pci_device_1385_620a[] = "GA620"; +static const char pci_device_1385_622a[] = "GA622"; +static const char pci_device_1385_630a[] = "GA630"; +static const char pci_device_1385_f311[] = "FA311"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1386[] = "Video Domain Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1387[] = "Systran Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1388[] = "Hitachi Information Technology Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1389[] = "Applicom International"; +static const char pci_device_1389_0001[] = "PCI1500PFB [Intelligent fieldbus adaptor]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_138a[] = "Fusion Micromedia Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_138b[] = "Tokimec Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_138c[] = "Silicon Reality"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_138d[] = "Future Techno Designs pte Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_138e[] = "Basler GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_138f[] = "Patapsco Designs Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1390[] = "Concept Development Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1391[] = "Development Concepts Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1392[] = "Medialight Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1393[] = "Moxa Technologies Co Ltd"; +static const char pci_device_1393_1040[] = "Smartio C104H/PCI"; +static const char pci_device_1393_1680[] = "Smartio C168H/PCI"; +static const char pci_device_1393_2040[] = "Intellio CP-204J"; +static const char pci_device_1393_2180[] = "Intellio C218 Turbo PCI"; +static const char pci_device_1393_3200[] = "Intellio C320 Turbo PCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1394[] = "Level One Communications"; +static const char pci_device_1394_0001[] = "LXT1001 Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1394_0001_1394_0001[] = "NetCelerator Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1395[] = "Ambicom Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1396[] = "Cipher Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1397[] = "Cologne Chip Designs GmbH"; +static const char pci_device_1397_2bd0[] = "ISDN network controller [HFC-PCI]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1397_2bd0_1397_2bd0[] = "ISDN Board"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1397_2bd0_e4bf_1000[] = "CI1-1-Harp"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1398[] = "Clarion co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1399[] = "Rios systems Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_139a[] = "Alacritech Inc"; +static const char pci_device_139a_0001[] = "Quad Port 10/100 Server Accelerator"; +static const char pci_device_139a_0003[] = "Single Port 10/100 Server Accelerator"; +static const char pci_device_139a_0005[] = "Single Port Gigabit Server Accelerator"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_139b[] = "Mediasonic Multimedia Systems Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_139c[] = "Quantum 3d Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_139d[] = "EPL limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_139e[] = "Media4"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_139f[] = "Aethra s.r.l."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a0[] = "Crystal Group Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a1[] = "Kawasaki Heavy Industries Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a2[] = "Ositech Communications Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a3[] = "Hifn Inc."; +static const char pci_device_13a3_0005[] = "7751 Security Processor"; +static const char pci_device_13a3_0006[] = "6500 Public Key Processor"; +static const char pci_device_13a3_0007[] = "7811 Security Processor"; +static const char pci_device_13a3_0012[] = "7951 Security Processor"; +static const char pci_device_13a3_0014[] = "78XX Security Processor"; +static const char pci_device_13a3_0016[] = "8065 Security Processor"; +static const char pci_device_13a3_0017[] = "8165 Security Processor"; +static const char pci_device_13a3_0018[] = "8154 Security Processor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a4[] = "Rascom Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a5[] = "Audio Digital Imaging Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a6[] = "Videonics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a7[] = "Teles AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a8[] = "Exar Corp."; +static const char pci_device_13a8_0158[] = "XR17C158 Octal UART"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13a9[] = "Siemens Medical Systems, Ultrasound Group"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13aa[] = "Broadband Networks Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ab[] = "Arcom Control Systems Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ac[] = "Motion Media Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ad[] = "Nexus Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ae[] = "ALD Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13af[] = "T.Sqware"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b0[] = "Maxspeed Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b1[] = "Tamura corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b2[] = "Techno Chips Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b3[] = "Lanart Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b4[] = "Wellbean Co Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b5[] = "ARM"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b6[] = "Dlog GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b7[] = "Logic Devices Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b8[] = "Nokia Telecommunications oy"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13b9[] = "Elecom Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ba[] = "Oxford Instruments"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13bb[] = "Sanyo Technosound Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13bc[] = "Bitran Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13bd[] = "Sharp corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13be[] = "Miroku Jyoho Service Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13bf[] = "Sharewave Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c0[] = "Microgate Corporation"; +static const char pci_device_13c0_0010[] = "SyncLink WAN Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c1[] = "3ware Inc"; +static const char pci_device_13c1_1000[] = "3ware ATA-RAID"; +static const char pci_device_13c1_1001[] = "3ware 7000-series ATA-RAID"; +static const char pci_device_13c1_1002[] = "3ware ATA-RAID"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c2[] = "Technotrend Systemtechnik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c3[] = "Janz Computer AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c4[] = "Phase Metrics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c5[] = "Alphi Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c6[] = "Condor Engineering Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c7[] = "Blue Chip Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c8[] = "Apptech Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13c9[] = "Eaton Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ca[] = "Iomega Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13cb[] = "Yano Electric Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13cc[] = "Metheus Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13cd[] = "Compatible Systems Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ce[] = "Cocom A/S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13cf[] = "Studio Audio & Video Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d0[] = "Techsan Electronics Co Ltd"; +static const char pci_device_13d0_2103[] = "B2C2 Sky2PC PCI [SkyStar2]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d1[] = "Abocom Systems Inc"; +static const char pci_device_13d1_ab02[] = "ADMtek Centaur-C rev 17 [D-Link DFE-680TX] CardBus Fast Ethernet Adapter"; +static const char pci_device_13d1_ab06[] = "RTL8139 [FE2000VX] CardBus Fast Ethernet Attached Port Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d2[] = "Shark Multimedia Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d3[] = "IMC Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d4[] = "Graphics Microsystems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d5[] = "Media 100 Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d6[] = "K.I. Technology Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d7[] = "Toshiba Engineering Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d8[] = "Phobos corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13d9[] = "Apex PC Solutions Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13da[] = "Intresource Systems pte Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13db[] = "Janich & Klass Computertechnik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13dc[] = "Netboost Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13dd[] = "Multimedia Bundle Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13de[] = "ABB Robotics Products AB"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13df[] = "E-Tech Inc"; +static const char pci_device_13df_0001[] = "PCI56RVP Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13df_0001_13df_0001[] = "PCI56RVP Modem"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e0[] = "GVC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e1[] = "Silicom Multimedia Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e2[] = "Dynamics Research Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e3[] = "Nest Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e4[] = "Calculex Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e5[] = "Telesoft Design Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e6[] = "Argosy research Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e7[] = "NAC Incorporated"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e8[] = "Chip Express Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13e9[] = "Chip Express Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ea[] = "Dallas Semiconductor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13eb[] = "Hauppauge Computer Works Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ec[] = "Zydacron Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ed[] = "Raytheion E-Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ee[] = "Hayes Microcomputer Products Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ef[] = "Coppercom Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f0[] = "Sundance Technology Inc"; +static const char pci_device_13f0_0201[] = "ST201 Sundance Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f1[] = "Oce' - Technologies B.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f2[] = "Ford Microelectronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f3[] = "Mcdata Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f4[] = "Troika Networks, Inc."; +static const char pci_device_13f4_1401[] = "Zentai Fibre Channel Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f5[] = "Kansai Electric Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f6[] = "C-Media Electronics Inc"; +static const char pci_device_13f6_0100[] = "CM8338A"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13f6_0100_13f6_ffff[] = "CMI8338/C3DX PCI Audio Device"; +#endif +static const char pci_device_13f6_0101[] = "CM8338B"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13f6_0101_13f6_0101[] = "CMI8338-031 PCI Audio Device"; +#endif +static const char pci_device_13f6_0111[] = "CM8738"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13f6_0111_1019_0970[] = "P6STP-FL motherboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13f6_0111_1043_8077[] = "CMI8738 6-channel audio controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13f6_0111_1043_80e2[] = "CMI8738 6ch-MX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_13f6_0111_13f6_0111[] = "CMI8738/C3DX PCI Audio Device"; +#endif +static const char pci_device_13f6_0211[] = "CM8738"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f7[] = "Wildfire Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f8[] = "Ad Lib Multimedia Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13f9[] = "NTT Advanced Technology Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13fa[] = "Pentland Systems Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13fb[] = "Aydin Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13fc[] = "Computer Peripherals International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13fd[] = "Micro Science Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13fe[] = "Advantech Co. Ltd"; +static const char pci_device_13fe_1756[] = "PCI-1756"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_13ff[] = "Silicon Spice Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1400[] = "Artx Inc"; +static const char pci_device_1400_1401[] = "9432 TX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1401[] = "CR-Systems A/S"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1402[] = "Meilhaus Electronic GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1403[] = "Ascor Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1404[] = "Fundamental Software Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1405[] = "Excalibur Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1406[] = "Oce' Printing Systems GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1407[] = "Lava Computer mfg Inc"; +static const char pci_device_1407_0100[] = "Lava Dual Serial"; +static const char pci_device_1407_0101[] = "Lava Quatro A"; +static const char pci_device_1407_0102[] = "Lava Quatro B"; +static const char pci_device_1407_0200[] = "Lava Port Plus"; +static const char pci_device_1407_0201[] = "Lava Quad A"; +static const char pci_device_1407_0202[] = "Lava Quad B"; +static const char pci_device_1407_0500[] = "Lava Single Serial"; +static const char pci_device_1407_0600[] = "Lava Port 650"; +static const char pci_device_1407_8000[] = "Lava Parallel"; +static const char pci_device_1407_8001[] = "Dual parallel port controller A"; +static const char pci_device_1407_8002[] = "Lava Dual Parallel port A"; +static const char pci_device_1407_8003[] = "Lava Dual Parallel port B"; +static const char pci_device_1407_8800[] = "BOCA Research IOPPAR"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1408[] = "Aloka Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1409[] = "Timedia Technology Co Ltd"; +static const char pci_device_1409_7168[] = "PCI2S550 (Dual 16550 UART)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_140a[] = "DSP Research Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_140b[] = "Ramix Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_140c[] = "Elmic Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_140d[] = "Matsushita Electric Works Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_140e[] = "Goepel Electronic GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_140f[] = "Salient Systems Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1410[] = "Midas lab Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1411[] = "Ikos Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1412[] = "IC Ensemble Inc"; +static const char pci_device_1412_1712[] = "ICE1712 [Envy24]"; +static const char pci_device_1412_1724[] = "ICE1724 [Envy24HT]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1413[] = "Addonics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1414[] = "Microsoft Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1415[] = "Oxford Semiconductor Ltd"; +static const char pci_device_1415_8403[] = "VScom 011H-EP1 1 port parallel adaptor"; +static const char pci_device_1415_9501[] = "OX16PCI954 (Quad 16950 UART) function 0"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1415_9501_15ed_2000[] = "MCCR Serial p0-3 of 8"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1415_9501_15ed_2001[] = "MCCR Serial p0-3 of 16"; +#endif +static const char pci_device_1415_950a[] = "EXSYS EX-41092 Dual 16950 Serial adapter"; +static const char pci_device_1415_950b[] = "OXCB950 Cardbus 16950 UART"; +static const char pci_device_1415_9511[] = "OX16PCI954 (Quad 16950 UART) function 1"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1415_9511_15ed_2000[] = "MCCR Serial p4-7 of 8"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1415_9511_15ed_2001[] = "MCCR Serial p4-15 of 16"; +#endif +static const char pci_device_1415_9521[] = "OX16PCI952 (Dual 16950 UART)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1416[] = "Multiwave Innovation pte Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1417[] = "Convergenet Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1418[] = "Kyushu electronics systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1419[] = "Excel Switching Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_141a[] = "Apache Micro Peripherals Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_141b[] = "Zoom Telephonics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_141d[] = "Digitan Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_141e[] = "Fanuc Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_141f[] = "Visiontech Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1420[] = "Psion Dacom plc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1421[] = "Ads Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1422[] = "Ygrec Systems Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1423[] = "Custom Technology Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1424[] = "Videoserver Connections"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1425[] = "ASIC Designers Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1426[] = "Storage Technology Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1427[] = "Better On-Line Solutions"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1428[] = "Edec Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1429[] = "Unex Technology Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_142a[] = "Kingmax Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_142b[] = "Radiolan"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_142c[] = "Minton Optic Industry Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_142d[] = "Pix stream Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_142e[] = "Vitec Multimedia"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_142f[] = "Radicom Research Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1430[] = "ITT Aerospace/Communications Division"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1431[] = "Gilat Satellite Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1432[] = "Edimax Computer Co."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1433[] = "Eltec Elektronik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1435[] = "Real Time Devices US Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1436[] = "CIS Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1437[] = "Nissin Inc Co"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1438[] = "Atmel-dream"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1439[] = "Outsource Engineering & Mfg. Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_143a[] = "Stargate Solutions Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_143b[] = "Canon Research Center, America"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_143c[] = "Amlogic Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_143d[] = "Tamarack Microelectronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_143e[] = "Jones Futurex Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_143f[] = "Lightwell Co Ltd - Zax Division"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1440[] = "ALGOL Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1441[] = "AGIE Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1442[] = "Phoenix Contact GmbH & Co."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1443[] = "Unibrain S.A."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1444[] = "TRW"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1445[] = "Logical DO Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1446[] = "Graphin Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1447[] = "AIM GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1448[] = "Alesis Studio Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1449[] = "TUT Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_144a[] = "Adlink Technology"; +static const char pci_device_144a_7296[] = "PCI-7296"; +static const char pci_device_144a_7432[] = "PCI-7432"; +static const char pci_device_144a_7433[] = "PCI-7433"; +static const char pci_device_144a_7434[] = "PCI-7434"; +static const char pci_device_144a_7841[] = "PCI-7841"; +static const char pci_device_144a_8133[] = "PCI-8133"; +static const char pci_device_144a_8554[] = "PCI-8554"; +static const char pci_device_144a_9111[] = "PCI-9111"; +static const char pci_device_144a_9113[] = "PCI-9113"; +static const char pci_device_144a_9114[] = "PCI-9114"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_144b[] = "Loronix Information Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_144c[] = "Catalina Research Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_144d[] = "Samsung Electronics Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_144e[] = "OLITEC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_144f[] = "Askey Computer Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1450[] = "Octave Communications Ind."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1451[] = "SP3D Chip Design GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1453[] = "MYCOM Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1454[] = "Altiga Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1455[] = "Logic Plus Plus Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1456[] = "Advanced Hardware Architectures"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1457[] = "Nuera Communications Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1458[] = "Giga-byte Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1459[] = "DOOIN Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_145a[] = "Escalate Networks Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_145b[] = "PRAIM SRL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_145c[] = "Cryptek"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_145d[] = "Gallant Computer Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_145e[] = "Aashima Technology B.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_145f[] = "Baldor Electric Company"; +static const char pci_device_145f_0001[] = "NextMove PCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1460[] = "DYNARC INC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1461[] = "Avermedia Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1462[] = "Micro-Star International Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1463[] = "Fast Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1464[] = "Interactive Circuits & Systems Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1465[] = "GN NETTEST Telecom DIV."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1466[] = "Designpro Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1467[] = "DIGICOM SPA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1468[] = "AMBIT Microsystem Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1469[] = "Cleveland Motion Controls"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_146a[] = "IFR"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_146b[] = "Parascan Technologies Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_146c[] = "Ruby Tech Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_146d[] = "Tachyon, INC."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_146e[] = "Williams Electronics Games, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_146f[] = "Multi Dimensional Consulting Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1470[] = "Bay Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1471[] = "Integrated Telecom Express Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1472[] = "DAIKIN Industries, Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1473[] = "ZAPEX Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1474[] = "Doug Carson & Associates"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1475[] = "PICAZO Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1476[] = "MORTARA Instrument Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1477[] = "Net Insight"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1478[] = "DIATREND Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1479[] = "TORAY Industries Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_147a[] = "FORMOSA Industrial Computing"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_147b[] = "ABIT Computer Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_147c[] = "AWARE, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_147d[] = "Interworks Computer Products"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_147e[] = "Matsushita Graphic Communication Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_147f[] = "NIHON UNISYS, Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1480[] = "SCII Telecom"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1481[] = "BIOPAC Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1482[] = "ISYTEC - Integrierte Systemtechnik GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1483[] = "LABWAY Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1484[] = "Logic Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1485[] = "ERMA - Electronic GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1486[] = "L3 Communications Telemetry & Instrumentation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1487[] = "MARQUETTE Medical Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1488[] = "KONTRON Electronik GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1489[] = "KYE Systems Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_148a[] = "OPTO"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_148b[] = "INNOMEDIALOGIC Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_148c[] = "C.P. Technology Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_148d[] = "DIGICOM Systems, Inc."; +static const char pci_device_148d_1003[] = "HCF 56k Data/Fax Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_148e[] = "OSI Plus Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_148f[] = "Plant Equipment, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1490[] = "Stone Microsystems PTY Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1491[] = "ZEAL Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1492[] = "Time Logic Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1493[] = "MAKER Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1494[] = "WINTOP Technology, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1495[] = "TOKAI Communications Industry Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1496[] = "JOYTECH Computer Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1497[] = "SMA Regelsysteme GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1498[] = "TEWS Datentechnik GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1499[] = "EMTEC CO., Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_149a[] = "ANDOR Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_149b[] = "SEIKO Instruments Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_149c[] = "OVISLINK Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_149d[] = "NEWTEK Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_149e[] = "Mapletree Networks Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_149f[] = "LECTRON Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a0[] = "SOFTING GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a1[] = "Systembase Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a2[] = "Millennium Engineering Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a3[] = "Maverick Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a4[] = "GVC/BCM Advanced Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a5[] = "XIONICS Document Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a6[] = "INOVA Computers GmBH & Co KG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a7[] = "MYTHOS Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a8[] = "FEATRON Technologies Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14a9[] = "HIVERTEC Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14aa[] = "Advanced MOS Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ab[] = "Mentor Graphics Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ac[] = "Novaweb Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ad[] = "Time Space Radio AB"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ae[] = "CTI, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14af[] = "Guillemot Corporation"; +static const char pci_device_14af_7102[] = "3D Prophet II MX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b0[] = "BST Communication Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b1[] = "Nextcom K.K."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b2[] = "ENNOVATE Networks Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b3[] = "XPEED Inc"; +static const char pci_device_14b3_0000[] = "DSL NIC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b4[] = "PHILIPS Business Electronics B.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b5[] = "Creamware GmBH"; +static const char pci_device_14b5_0200[] = "Scope"; +static const char pci_device_14b5_0300[] = "Pulsar"; +static const char pci_device_14b5_0400[] = "Pulsar2"; +static const char pci_device_14b5_0600[] = "Pulsar2"; +static const char pci_device_14b5_0800[] = "DSP-Board"; +static const char pci_device_14b5_0900[] = "DSP-Board"; +static const char pci_device_14b5_0a00[] = "DSP-Board"; +static const char pci_device_14b5_0b00[] = "DSP-Board"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b6[] = "Quantum Data Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b7[] = "PROXIM Inc"; +static const char pci_device_14b7_0001[] = "Symphony 4110"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b8[] = "Techsoft Technology Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14b9[] = "AIRONET Wireless Communications"; +static const char pci_device_14b9_0001[] = "PC4800"; +static const char pci_device_14b9_0340[] = "PC4800"; +static const char pci_device_14b9_0350[] = "PC4800"; +static const char pci_device_14b9_4500[] = "PC4500"; +static const char pci_device_14b9_4800[] = "PC4800"; +static const char pci_device_14b9_a504[] = "Cisco Aironet Wireless 802.11b"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ba[] = "INTERNIX Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14bb[] = "SEMTECH Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14bc[] = "Globespan Semiconductor Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14bd[] = "CARDIO Control N.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14be[] = "L3 Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14bf[] = "SPIDER Communications Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c0[] = "COMPAL Electronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c1[] = "MYRICOM Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c2[] = "DTK Computer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c3[] = "MEDIATEK Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c4[] = "IWASAKI Information Systems Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c5[] = "Automation Products AB"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c6[] = "Data Race Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c7[] = "Modular Technology Holdings Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c8[] = "Turbocomm Tech. Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14c9[] = "ODIN Telesystems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ca[] = "PE Logic Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14cb[] = "Billionton Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14cc[] = "NAKAYO Telecommunications Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14cd[] = "Universal Scientific Ind."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ce[] = "Whistle Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14cf[] = "TEK Microsystems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d0[] = "Ericsson Axe R & D"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d1[] = "Computer Hi-Tech Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d2[] = "Titan Electronics Inc"; +static const char pci_device_14d2_8001[] = "VScom 010L 1 port parallel adaptor"; +static const char pci_device_14d2_8002[] = "VScom 020L 2 port parallel adaptor"; +static const char pci_device_14d2_8010[] = "VScom 100L 1 port serial adaptor"; +static const char pci_device_14d2_8011[] = "VScom 110L 1 port serial and 1 port parallel adaptor"; +static const char pci_device_14d2_8020[] = "VScom 200L 1 port serial adaptor"; +static const char pci_device_14d2_8021[] = "VScom 210L 2 port serial and 1 port parallel adaptor"; +static const char pci_device_14d2_8040[] = "VScom 400L 4 port serial adaptor"; +static const char pci_device_14d2_8080[] = "VScom 800L 8 port serial adaptor"; +static const char pci_device_14d2_a000[] = "VScom 010H 1 port parallel adaptor"; +static const char pci_device_14d2_a001[] = "VScom 100H 1 port serial adaptor"; +static const char pci_device_14d2_a003[] = "VScom 400H 4 port serial adaptor"; +static const char pci_device_14d2_a004[] = "VScom 400HF1 4 port serial adaptor"; +static const char pci_device_14d2_a005[] = "VScom 200H 2 port serial adaptor"; +static const char pci_device_14d2_e001[] = "VScom 010HV2 1 port parallel adaptor"; +static const char pci_device_14d2_e010[] = "VScom 100HV2 1 port serial adaptor"; +static const char pci_device_14d2_e020[] = "VScom 200HV2 2 port serial adaptor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d3[] = "CIRTECH (UK) Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d4[] = "Panacom Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d5[] = "Nitsuko Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d6[] = "Accusys Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d7[] = "Hirakawa Hewtech Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d8[] = "HOPF Elektronik GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14d9[] = "Alpha Processor Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14da[] = "National Aerospace Laboratories"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14db[] = "AFAVLAB Technology Inc"; +static const char pci_device_14db_2120[] = "TK9902"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14dc[] = "Amplicon Liveline Ltd"; +static const char pci_device_14dc_0000[] = "PCI230"; +static const char pci_device_14dc_0001[] = "PCI242"; +static const char pci_device_14dc_0002[] = "PCI244"; +static const char pci_device_14dc_0003[] = "PCI247"; +static const char pci_device_14dc_0004[] = "PCI248"; +static const char pci_device_14dc_0005[] = "PCI249"; +static const char pci_device_14dc_0006[] = "PCI260"; +static const char pci_device_14dc_0007[] = "PCI224"; +static const char pci_device_14dc_0008[] = "PCI234"; +static const char pci_device_14dc_0009[] = "PCI236"; +static const char pci_device_14dc_000a[] = "PCI272"; +static const char pci_device_14dc_000b[] = "PCI215"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14dd[] = "Boulder Design Labs Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14de[] = "Applied Integration Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14df[] = "ASIC Communications Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e1[] = "INVERTEX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e2[] = "INFOLIBRIA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e3[] = "AMTELCO"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e4[] = "Broadcom Corporation"; +static const char pci_device_14e4_1644[] = "NetXtreme BCM5700 Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_1014_0277[] = "Broadcom Vigil B5700 1000Base-T"; +#endif +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_1028_00d1[] = "Broadcom BCM5700"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_1028_0106[] = "Broadcom BCM5700"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_1028_0109[] = "Broadcom BCM5700 1000Base-T"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_1028_010a[] = "Broadcom BCM5700 1000BaseTX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1000[] = "3C996-T 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1001[] = "3C996B-T 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1002[] = "3C996C-T 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1003[] = "3C997-T 1000Base-T Dual Port"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1004[] = "3C996-SX 1000Base-SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1005[] = "3C997-SX 1000Base-SX Dual Port"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_10b7_1008[] = "3C942 Gigabit LOM (31X31)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_14e4_0002[] = "NetXtreme 1000Base-SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_14e4_0003[] = "NetXtreme 1000Base-SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_14e4_0004[] = "NetXtreme 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_14e4_1028[] = "NetXtreme 1000BaseTX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1644_14e4_1644[] = "BCM5700 1000Base-T"; +#endif +static const char pci_device_14e4_1645[] = "NetXtreme BCM5701 Gigabit Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_0e11_007c[] = "NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_0e11_007d[] = "NC6770 Gigabit Server Adapter (PCI-X, 1000-SX)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_0e11_0085[] = "NC7780 Gigabit Server Adapter (embedded, WOL)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_0e11_0099[] = "NC7780 Gigabit Server Adapter (embedded, WOL)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_0e11_009a[] = "NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_0e11_00c1[] = "NC6770 Gigabit Server Adapter (PCI-X, 1000-SX)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_1028_0121[] = "Broadcom BCM5701 1000Base-T"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_10b7_1004[] = "3C996-SX 1000Base-SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_10b7_1006[] = "3C996B-T 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_10b7_1007[] = "3C1000-T 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_10b7_1008[] = "3C940-BR01 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_14e4_0001[] = "BCM5701 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_14e4_0005[] = "BCM5701 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_14e4_0006[] = "BCM5701 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_14e4_0007[] = "BCM5701 1000Base-SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_14e4_0008[] = "BCM5701 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1645_14e4_8008[] = "BCM5701 1000Base-T"; +#endif +static const char pci_device_14e4_1646[] = "NetXtreme BCM5702 Gigabit Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1646_0e11_00bb[] = "NC7760 1000BaseTX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1646_1028_0126[] = "Broadcom BCM5702 1000BaseTX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1646_14e4_8009[] = "BCM5702 1000BaseTX"; +#endif +static const char pci_device_14e4_1647[] = "NetXtreme BCM5703 Gigabit Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_0e11_0099[] = "NC7780 1000BaseTX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_0e11_009a[] = "NC7770 1000BaseTX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_14e4_0009[] = "BCM5703 1000BaseTX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_14e4_000a[] = "BCM5703 1000BaseSX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_14e4_000b[] = "BCM5703 1000BaseTX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_14e4_8009[] = "BCM5703 1000BaseTX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1647_14e4_800a[] = "BCM5703 1000BaseTX"; +#endif +static const char pci_device_14e4_1648[] = "NetXtreme BCM5704 Gigabit Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1648_0e11_00cf[] = "NC7772 Gigabit Server Adapter (PCI-X, 10,100,1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1648_0e11_00d0[] = "NC7782 Gigabit Server Adapter (PCI-X, 10,100,1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1648_0e11_00d1[] = "NC7783 Gigabit Server Adapter (PCI-X, 10,100,1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1648_10b7_2000[] = "3C998-T Dual Port 10/100/1000 PCI-X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1648_10b7_3000[] = "3C999-T Quad Port 10/100/1000 PCI-X"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1648_1166_1648[] = "NetXtreme CIOB-E 1000Base-T"; +#endif +static const char pci_device_14e4_164d[] = "NetXtreme BCM5702FE Gigabit Ethernet"; +static const char pci_device_14e4_1653[] = "NetXtreme BCM5705 Gigabit Ethernet"; +static const char pci_device_14e4_165d[] = "NetXtreme BCM5705M Gigabit Ethernet"; +static const char pci_device_14e4_1696[] = "NetXtreme BCM5782 Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_1696_14e4_000d[] = "NetXtreme BCM5782 1000Base-T"; +#endif +static const char pci_device_14e4_16a6[] = "NetXtreme BCM5702 Gigabit Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a6_0e11_00bb[] = "NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a6_1028_0126[] = "BCM5702 1000Base-T"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a6_14e4_000c[] = "BCM5702 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a6_14e4_8009[] = "BCM5702 1000Base-T"; +#endif +static const char pci_device_14e4_16a7[] = "NetXtreme BCM5703 Gigabit Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a7_0e11_00ca[] = "NC7771 Gigabit Server Adapter (PCI-X, 10,100,1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a7_0e11_00cb[] = "NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a7_14e4_0009[] = "NetXtreme BCM5703 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a7_14e4_000a[] = "NetXtreme BCM5703 1000Base-SX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a7_14e4_000b[] = "NetXtreme BCM5703 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a7_14e4_800a[] = "NetXtreme BCM5703 1000Base-T"; +#endif +static const char pci_device_14e4_16a8[] = "NetXtreme BCM5704S Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16a8_10b7_2001[] = "3C998-SX Dual Port 1000-SX PCI-X"; +#endif +static const char pci_device_14e4_16c6[] = "NetXtreme BCM5702 Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16c6_10b7_1100[] = "3C1000B-T 10/100/1000 PCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16c6_14e4_000c[] = "BCM5702 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16c6_14e4_8009[] = "BCM5702 1000Base-T"; +#endif +static const char pci_device_14e4_16c7[] = "NetXtreme BCM5703 Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16c7_14e4_0009[] = "NetXtreme BCM5703 1000Base-T"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14e4_16c7_14e4_000a[] = "NetXtreme BCM5703 1000Base-SX"; +#endif +static const char pci_device_14e4_4210[] = "BCM4210 iLine10 HomePNA 2.0"; +static const char pci_device_14e4_4211[] = "BCM4211 iLine10 HomePNA 2.0 + V.90 56k modem"; +static const char pci_device_14e4_4212[] = "BCM4212 v.90 56k modem"; +static const char pci_device_14e4_4301[] = "BCM4301 802.11b"; +static const char pci_device_14e4_4401[] = "BCM4401 100Base-T"; +static const char pci_device_14e4_4402[] = "BCM4402 Integrated 10/100BaseT"; +static const char pci_device_14e4_4410[] = "BCM4413 iLine32 HomePNA 2.0"; +static const char pci_device_14e4_4411[] = "BCM4413 V.90 56k modem"; +static const char pci_device_14e4_4412[] = "BCM4413 10/100BaseT"; +static const char pci_device_14e4_5820[] = "BCM5820 Crypto Accelerator"; +static const char pci_device_14e4_5821[] = "BCM5821 Crypto Accelerator"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e5[] = "Pixelfusion Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e6[] = "SHINING Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e7[] = "3CX"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e8[] = "RAYCER Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14e9[] = "GARNETS System CO Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ea[] = "Planex Communications, Inc"; +static const char pci_device_14ea_ab06[] = "FNW-3603-TX CardBus Fast Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14eb[] = "SEIKO EPSON Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ec[] = "ACQIRIS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ed[] = "DATAKINETICS Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ee[] = "MASPRO KENKOH Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ef[] = "CARRY Computer ENG. CO Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f0[] = "CANON RESEACH CENTRE FRANCE"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f1[] = "Conexant"; +static const char pci_device_14f1_1002[] = "HCF 56k Modem"; +static const char pci_device_14f1_1003[] = "HCF 56k Modem"; +static const char pci_device_14f1_1004[] = "HCF 56k Modem"; +static const char pci_device_14f1_1005[] = "HCF 56k Modem"; +static const char pci_device_14f1_1006[] = "HCF 56k Modem"; +static const char pci_device_14f1_1022[] = "HCF 56k Modem"; +static const char pci_device_14f1_1023[] = "HCF 56k Modem"; +static const char pci_device_14f1_1024[] = "HCF 56k Modem"; +static const char pci_device_14f1_1025[] = "HCF 56k Modem"; +static const char pci_device_14f1_1026[] = "HCF 56k Modem"; +static const char pci_device_14f1_1032[] = "HCF 56k Modem"; +static const char pci_device_14f1_1033[] = "HCF 56k Data/Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_1033_8077[] = "NEC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_122d_4027[] = "Dell Zeus - MDP3880-W(B) Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_122d_4030[] = "Dell Mercury - MDP3880-U(B) Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_122d_4034[] = "Dell Thor - MDP3880-W(U) Data Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_020d[] = "Dell Copper"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_020e[] = "Dell Silver"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_0261[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_0290[] = "Compaq Goldwing"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_02a0[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_02b0[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_02c0[] = "Compaq Scooter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_13e0_02d0[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_144f_1500[] = "IBM P85-DF (1)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_144f_1501[] = "IBM P85-DF (2)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_144f_150a[] = "IBM P85-DF (3)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_144f_150b[] = "IBM P85-DF Low Profile (1)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1033_144f_1510[] = "IBM P85-DF Low Profile (2)"; +#endif +static const char pci_device_14f1_1034[] = "HCF 56k Data/Fax/Voice Modem"; +static const char pci_device_14f1_1035[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1035_10cf_1098[] = "Fujitsu P85-DFSV"; +#endif +static const char pci_device_14f1_1036[] = "HCF 56k Data/Fax/Voice/Spkp Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_104d_8067[] = "HCF 56k Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_122d_4029[] = "MDP3880SP-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_122d_4031[] = "MDP3880SP-U"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_13e0_0209[] = "Dell Titanium"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_13e0_020a[] = "Dell Graphite"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_13e0_0260[] = "Gateway Red Owl"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1036_13e0_0270[] = "Gateway White Horse"; +#endif +static const char pci_device_14f1_1052[] = "HCF 56k Data/Fax Modem (Worldwide)"; +static const char pci_device_14f1_1053[] = "HCF 56k Data/Fax Modem (Worldwide)"; +static const char pci_device_14f1_1054[] = "HCF 56k Data/Fax/Voice Modem (Worldwide)"; +static const char pci_device_14f1_1055[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (Worldwide)"; +static const char pci_device_14f1_1056[] = "HCF 56k Data/Fax/Voice/Spkp Modem (Worldwide)"; +static const char pci_device_14f1_1057[] = "HCF 56k Data/Fax/Voice/Spkp Modem (Worldwide)"; +static const char pci_device_14f1_1059[] = "HCF 56k Data/Fax/Voice Modem (Worldwide)"; +static const char pci_device_14f1_1063[] = "HCF 56k Data/Fax Modem"; +static const char pci_device_14f1_1064[] = "HCF 56k Data/Fax/Voice Modem"; +static const char pci_device_14f1_1065[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +static const char pci_device_14f1_1066[] = "HCF 56k Data/Fax/Voice/Spkp Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1066_122d_4033[] = "Dell Athena - MDP3900V-U"; +#endif +static const char pci_device_14f1_1433[] = "HCF 56k Data/Fax Modem"; +static const char pci_device_14f1_1434[] = "HCF 56k Data/Fax/Voice Modem"; +static const char pci_device_14f1_1435[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +static const char pci_device_14f1_1436[] = "HCF 56k Data/Fax Modem"; +static const char pci_device_14f1_1453[] = "HCF 56k Data/Fax Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1453_13e0_0240[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1453_13e0_0250[] = "IBM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1453_144f_1502[] = "IBM P95-DF (1)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1453_144f_1503[] = "IBM P95-DF (2)"; +#endif +static const char pci_device_14f1_1454[] = "HCF 56k Data/Fax/Voice Modem"; +static const char pci_device_14f1_1455[] = "HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +static const char pci_device_14f1_1456[] = "HCF 56k Data/Fax/Voice/Spkp Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1456_122d_4035[] = "Dell Europa - MDP3900V-W"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1456_122d_4302[] = "Dell MP3930V-W(C) MiniPCI"; +#endif +static const char pci_device_14f1_1610[] = "ADSL AccessRunner PCI Arbitration Device"; +static const char pci_device_14f1_1611[] = "AccessRunner PCI ADSL Interface Device"; +static const char pci_device_14f1_1803[] = "HCF 56k Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1803_0e11_0023[] = "623-LAN Grizzly"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1803_0e11_0043[] = "623-LAN Yogi"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_14f1_1815[] = "HCF 56k Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1815_0e11_0022[] = "Grizzly"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_1815_0e11_0042[] = "Yogi"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_14f1_2003[] = "HSF 56k Data/Fax Modem"; +static const char pci_device_14f1_2004[] = "HSF 56k Data/Fax/Voice Modem"; +static const char pci_device_14f1_2005[] = "HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +static const char pci_device_14f1_2006[] = "HSF 56k Data/Fax/Voice/Spkp Modem"; +static const char pci_device_14f1_2013[] = "HSF 56k Data/Fax Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_0e11_b195[] = "Bear"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_0e11_b196[] = "Seminole 1"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_0e11_b1be[] = "Seminole 2"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_1025_8013[] = "Acer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_1033_809d[] = "NEC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_1033_80bc[] = "NEC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_155d_6793[] = "HP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2013_155d_8850[] = "E Machines"; +#endif +static const char pci_device_14f1_2014[] = "HSF 56k Data/Fax/Voice Modem"; +static const char pci_device_14f1_2015[] = "HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem"; +static const char pci_device_14f1_2016[] = "HSF 56k Data/Fax/Voice/Spkp Modem"; +static const char pci_device_14f1_2043[] = "HSF 56k Data/Fax Modem (WorldW SmartDAA)"; +static const char pci_device_14f1_2044[] = "HSF 56k Data/Fax/Voice Modem (WorldW SmartDAA)"; +static const char pci_device_14f1_2045[] = "HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (WorldW SmartDAA)"; +static const char pci_device_14f1_2046[] = "HSF 56k Data/Fax/Voice/Spkp Modem (WorldW SmartDAA)"; +static const char pci_device_14f1_2063[] = "HSF 56k Data/Fax Modem (SmartDAA)"; +static const char pci_device_14f1_2064[] = "HSF 56k Data/Fax/Voice Modem (SmartDAA)"; +static const char pci_device_14f1_2065[] = "HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (SmartDAA)"; +static const char pci_device_14f1_2066[] = "HSF 56k Data/Fax/Voice/Spkp Modem (SmartDAA)"; +static const char pci_device_14f1_2093[] = "HSF 56k Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2093_155d_2f07[] = "Legend"; +#endif +static const char pci_device_14f1_2143[] = "HSF 56k Data/Fax/Cell Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2144[] = "HSF 56k Data/Fax/Voice/Cell Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2145[] = "HSF 56k Data/Fax/Voice/Spkp (w/HS)/Cell Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2146[] = "HSF 56k Data/Fax/Voice/Spkp/Cell Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2163[] = "HSF 56k Data/Fax/Cell Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2164[] = "HSF 56k Data/Fax/Voice/Cell Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2165[] = "HSF 56k Data/Fax/Voice/Spkp (w/HS)/Cell Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2166[] = "HSF 56k Data/Fax/Voice/Spkp/Cell Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2343[] = "HSF 56k Data/Fax CardBus Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2344[] = "HSF 56k Data/Fax/Voice CardBus Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2345[] = "HSF 56k Data/Fax/Voice/Spkp (w/HS) CardBus Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2346[] = "HSF 56k Data/Fax/Voice/Spkp CardBus Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2363[] = "HSF 56k Data/Fax CardBus Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2364[] = "HSF 56k Data/Fax/Voice CardBus Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2365[] = "HSF 56k Data/Fax/Voice/Spkp (w/HS) CardBus Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2366[] = "HSF 56k Data/Fax/Voice/Spkp CardBus Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2443[] = "HSF 56k Data/Fax Modem (Mob WorldW SmartDAA)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2443_104d_8075[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2443_104d_8083[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2443_104d_8097[] = "Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_14f1_2444[] = "HSF 56k Data/Fax/Voice Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2445[] = "HSF 56k Data/Fax/Voice/Spkp (w/HS) Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2446[] = "HSF 56k Data/Fax/Voice/Spkp Modem (Mob WorldW SmartDAA)"; +static const char pci_device_14f1_2463[] = "HSF 56k Data/Fax Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2464[] = "HSF 56k Data/Fax/Voice Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2465[] = "HSF 56k Data/Fax/Voice/Spkp (w/HS) Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2466[] = "HSF 56k Data/Fax/Voice/Spkp Modem (Mob SmartDAA)"; +static const char pci_device_14f1_2f00[] = "HSF 56k HSFi Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2f00_13e0_8d84[] = "IBM HSFi V.90"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2f00_13e0_8d85[] = "Compaq Stinger"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_14f1_2f00_14f1_2004[] = "Dynalink 56PMi"; +#endif +static const char pci_device_14f1_8234[] = "RS8234 ATM SAR Controller [ServiceSAR Plus]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f2[] = "MOBILITY Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f3[] = "BROADLOGIC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f4[] = "TOKYO Electronic Industry CO Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f5[] = "SOPAC Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f6[] = "COYOTE Technologies LLC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f7[] = "WOLF Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f8[] = "AUDIOCODES Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14f9[] = "AG COMMUNICATIONS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14fa[] = "WANDEL & GOCHERMANN"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14fb[] = "TRANSAS MARINE (UK) Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14fc[] = "QUADRICS Supercomputers World"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14fd[] = "JAPAN Computer Industry Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14fe[] = "ARCHTEK TELECOM Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_14ff[] = "TWINHEAD INTERNATIONAL Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1500[] = "DELTA Electronics, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1501[] = "BANKSOFT CANADA Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1502[] = "MITSUBISHI ELECTRIC LOGISTICS SUPPORT Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1503[] = "KAWASAKI LSI USA Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1504[] = "KAISER Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1505[] = "ITA INGENIEURBURO FUR TESTAUFGABEN GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1506[] = "CHAMELEON Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1507[] = "Motorola ? / HTEC"; +static const char pci_device_1507_0001[] = "MPC105 [Eagle]"; +static const char pci_device_1507_0002[] = "MPC106 [Grackle]"; +static const char pci_device_1507_0003[] = "MPC8240 [Kahlua]"; +static const char pci_device_1507_0100[] = "MC145575 [HFC-PCI]"; +static const char pci_device_1507_0431[] = "KTI829c 100VG"; +static const char pci_device_1507_4801[] = "Raven"; +static const char pci_device_1507_4802[] = "Falcon"; +static const char pci_device_1507_4803[] = "Hawk"; +static const char pci_device_1507_4806[] = "CPX8216"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1508[] = "HONDA CONNECTORS/MHOTRONICS Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1509[] = "FIRST INTERNATIONAL Computer Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_150a[] = "FORVUS RESEARCH Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_150b[] = "YAMASHITA Systems Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_150c[] = "KYOPAL CO Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_150d[] = "WARPSPPED Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_150e[] = "C-PORT Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_150f[] = "INTEC GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1510[] = "BEHAVIOR TECH Computer Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1511[] = "CENTILLIUM Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1512[] = "ROSUN Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1513[] = "Raychem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1514[] = "TFL LAN Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1515[] = "Advent design"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1516[] = "MYSON Technology Inc"; +static const char pci_device_1516_0803[] = "SURECOM EP-320X-S 100/10M Ethernet PCI Adapter"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1516_0803_1320_10bd[] = "SURECOM EP-320X-S 100/10M Ethernet PCI Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1517[] = "ECHOTEK Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1518[] = "PEP MODULAR Computers GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1519[] = "TELEFON AKTIEBOLAGET LM Ericsson"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_151a[] = "Globetek"; +static const char pci_device_151a_1002[] = "PCI-1002"; +static const char pci_device_151a_1004[] = "PCI-1004"; +static const char pci_device_151a_1008[] = "PCI-1008"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_151b[] = "COMBOX Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_151c[] = "DIGITAL AUDIO LABS Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_151d[] = "Fujitsu Computer Products Of America"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_151e[] = "MATRIX Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_151f[] = "TOPIC SEMICONDUCTOR Corp"; +static const char pci_device_151f_0000[] = "TP560 Data/Fax/Voice 56k modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1520[] = "CHAPLET System Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1521[] = "BELL Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1522[] = "MainPine Ltd"; +static const char pci_device_1522_0100[] = "PCI <-> IOBus Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0200[] = "RockForceDUO 2 Port V.92/V.44 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0300[] = "RockForceQUATRO 4 Port V.92/V.44 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0400[] = "RockForceDUO+ 2 Port V.92/V.44 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0500[] = "RockForceQUATRO+ 4 Port V.92/V.44 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0600[] = "RockForce+ 2 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0700[] = "RockForce+ 4 Port V.90 Data/Fax/Voice Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1522_0100_1522_0800[] = "RockForceOCTO+ 8 Port V.92/V.44 Data/Fax/Voice Modem"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1523[] = "MUSIC Semiconductors"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1524[] = "ENE Technology Inc"; +static const char pci_device_1524_1211[] = "CB1211 Cardbus Controller"; +static const char pci_device_1524_1225[] = "CB1225 Cardbus Controller"; +static const char pci_device_1524_1410[] = "CB1410 Cardbus Controller"; +static const char pci_device_1524_1420[] = "CB1420 Cardbus Controller"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1525[] = "IMPACT Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1526[] = "ISS, Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1527[] = "SOLECTRON"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1528[] = "ACKSYS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1529[] = "AMERICAN MICROSystems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_152a[] = "QUICKTURN DESIGN Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_152b[] = "FLYTECH Technology CO Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_152c[] = "MACRAIGOR Systems LLC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_152d[] = "QUANTA Computer Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_152e[] = "MELEC Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_152f[] = "PHILIPS - CRYPTO"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1530[] = "ACQIS Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1531[] = "CHRYON Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1532[] = "ECHELON Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1533[] = "BALTIMORE"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1534[] = "ROAD Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1535[] = "EVERGREEN Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1537[] = "DATALEX COMMUNCATIONS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1538[] = "ARALION Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1539[] = "ATELIER INFORMATIQUES et ELECTRONIQUE ETUDES S.A."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_153a[] = "ONO SOKKI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_153b[] = "TERRATEC Electronic GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_153c[] = "ANTAL Electronic"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_153d[] = "FILANET Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_153e[] = "TECHWELL Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_153f[] = "MIPS DENMARK"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1540[] = "PROVIDEO MULTIMEDIA Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1541[] = "MACHONE Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1542[] = "VIVID Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1543[] = "SILICON Laboratories"; +static const char pci_device_1543_3052[] = "Intel 537 [Winmodem]"; +static const char pci_device_1543_4c22[] = "Si3036 MC'97 DAA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1544[] = "DCM DATA Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1545[] = "VISIONTEK"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1546[] = "IOI Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1547[] = "MITUTOYO Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1548[] = "JET PROPULSION Laboratory"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1549[] = "INTERCONNECT Systems Solutions"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_154a[] = "MAX Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_154b[] = "COMPUTEX Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_154c[] = "VISUAL Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_154d[] = "PAN INTERNATIONAL Industrial Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_154e[] = "SERVOTEST Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_154f[] = "STRATABEAM Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1550[] = "OPEN NETWORK Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1551[] = "SMART Electronic DEVELOPMENT GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1552[] = "RACAL AIRTECH Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1553[] = "CHICONY Electronics Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1554[] = "PROLINK Microsystems Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1555[] = "GESYTEC GmBH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1556[] = "PLD APPLICATIONS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1557[] = "MEDIASTAR Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1558[] = "CLEVO/KAPOK Computer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1559[] = "SI LOGIC Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_155a[] = "INNOMEDIA Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_155b[] = "PROTAC INTERNATIONAL Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_155c[] = "Cemax-Icon Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_155d[] = "Mac System Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_155e[] = "LP Elektronik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_155f[] = "Perle Systems Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1560[] = "Terayon Communications Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1561[] = "Viewgraphics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1562[] = "Symbol Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1563[] = "A-Trend Technology Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1564[] = "Yamakatsu Electronics Industry Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1565[] = "Biostar Microtech Int'l Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1566[] = "Ardent Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1567[] = "Jungsoft"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1568[] = "DDK Electronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1569[] = "Palit Microsystems Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_156a[] = "Avtec Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_156b[] = "2wire Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_156c[] = "Vidac Electronics GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_156d[] = "Alpha-Top Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_156e[] = "Alfa Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_156f[] = "M-Systems Flash Disk Pioneers Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1570[] = "Lecroy Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1571[] = "Contemporary Controls"; +static const char pci_device_1571_a001[] = "CCSI PCI20-485 ARCnet"; +static const char pci_device_1571_a002[] = "CCSI PCI20-485D ARCnet"; +static const char pci_device_1571_a003[] = "CCSI PCI20-485X ARCnet"; +static const char pci_device_1571_a004[] = "CCSI PCI20-CXB ARCnet"; +static const char pci_device_1571_a005[] = "CCSI PCI20-CXS ARCnet"; +static const char pci_device_1571_a006[] = "CCSI PCI20-FOG-SMA ARCnet"; +static const char pci_device_1571_a007[] = "CCSI PCI20-FOG-ST ARCnet"; +static const char pci_device_1571_a008[] = "CCSI PCI20-TB5 ARCnet"; +static const char pci_device_1571_a009[] = "CCSI PCI20-5-485 5Mbit ARCnet"; +static const char pci_device_1571_a00a[] = "CCSI PCI20-5-485D 5Mbit ARCnet"; +static const char pci_device_1571_a00b[] = "CCSI PCI20-5-485X 5Mbit ARCnet"; +static const char pci_device_1571_a00c[] = "CCSI PCI20-5-FOG-ST 5Mbit ARCnet"; +static const char pci_device_1571_a00d[] = "CCSI PCI20-5-FOG-SMA 5Mbit ARCnet"; +static const char pci_device_1571_a201[] = "CCSI PCI22-485 10Mbit ARCnet"; +static const char pci_device_1571_a202[] = "CCSI PCI22-485D 10Mbit ARCnet"; +static const char pci_device_1571_a203[] = "CCSI PCI22-485X 10Mbit ARCnet"; +static const char pci_device_1571_a204[] = "CCSI PCI22-CHB 10Mbit ARCnet"; +static const char pci_device_1571_a205[] = "CCSI PCI22-FOG_ST 10Mbit ARCnet"; +static const char pci_device_1571_a206[] = "CCSI PCI22-THB 10Mbit ARCnet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1572[] = "Otis Elevator Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1573[] = "Lattice - Vantis"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1574[] = "Fairchild Semiconductor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1575[] = "Voltaire Advanced Data Security Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1576[] = "Viewcast COM"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1578[] = "HITT"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1579[] = "Dual Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_157a[] = "Japan Elecronics Ind Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_157b[] = "Star Multimedia Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_157c[] = "Eurosoft (UK)"; +static const char pci_device_157c_8001[] = "Fix2000 PCI Y2K Compliance Card"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_157d[] = "Gemflex Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_157e[] = "Transition Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_157f[] = "PX Instruments Technology Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1580[] = "Primex Aerospace Co"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1581[] = "SEH Computertechnik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1582[] = "Cytec Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1583[] = "Inet Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1584[] = "Uniwill Computer Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1585[] = "Logitron"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1586[] = "Lancast Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1587[] = "Konica Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1588[] = "Solidum Systems Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1589[] = "Atlantek Microsystems Pty Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_158a[] = "Digalog Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_158b[] = "Allied Data Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_158c[] = "Hitachi Semiconductor & Devices Sales Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_158d[] = "Point Multimedia Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_158e[] = "Lara Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_158f[] = "Ditect Coop"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1590[] = "3pardata Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1591[] = "ARN"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1592[] = "Syba Tech Ltd"; +static const char pci_device_1592_0781[] = "Multi-IO Card"; +static const char pci_device_1592_0782[] = "Parallel Port Card 2xEPP"; +static const char pci_device_1592_0783[] = "Multi-IO Card"; +static const char pci_device_1592_0785[] = "Multi-IO Card"; +static const char pci_device_1592_0786[] = "Multi-IO Card"; +static const char pci_device_1592_0787[] = "Multi-IO Card"; +static const char pci_device_1592_0788[] = "Multi-IO Card"; +static const char pci_device_1592_078a[] = "Multi-IO Card"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1593[] = "Bops Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1594[] = "Netgame Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1595[] = "Diva Systems Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1596[] = "Folsom Research Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1597[] = "Memec Design Services"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1598[] = "Granite Microsystems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1599[] = "Delta Electronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_159a[] = "General Instrument"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_159b[] = "Faraday Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_159c[] = "Stratus Computer Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_159d[] = "Ningbo Harrison Electronics Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_159e[] = "A-Max Technology Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_159f[] = "Galea Network Security"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a0[] = "Compumaster SRL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a1[] = "Geocast Network Systems"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a2[] = "Catalyst Enterprises Inc"; +static const char pci_device_15a2_0001[] = "TA700 PCI Bus Analyzer/Exerciser"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a3[] = "Italtel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a4[] = "X-Net OY"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a5[] = "Toyota Macs Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a6[] = "Sunlight Ultrasound Technologies Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a7[] = "SSE Telecom Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15a8[] = "Shanghai Communications Technologies Center"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15aa[] = "Moreton Bay"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ab[] = "Bluesteel Networks Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ac[] = "North Atlantic Instruments"; +#endif +static const char pci_vendor_15ad[] = "VMWare Inc"; +static const char pci_device_15ad_0710[] = "Virtual SVGA"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ae[] = "Amersham Pharmacia Biotech"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b0[] = "Zoltrix International Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b1[] = "Source Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b2[] = "Mosaid Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b3[] = "Mellanox Technology"; +static const char pci_device_15b3_5274[] = "MT21108 InfiniBridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b4[] = "CCI/TRIAD"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b5[] = "Cimetrics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b6[] = "Texas Memory Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b7[] = "Sandisk Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b8[] = "ADDI-DATA GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15b9[] = "Maestro Digital Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ba[] = "Impacct Technology Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15bb[] = "Portwell Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15bc[] = "Agilent Technologies"; +static const char pci_device_15bc_2929[] = "E2929A PCI/PCI-X Bus Analyzer"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15bd[] = "DFI Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15be[] = "Sola Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15bf[] = "High Tech Computer Corp (HTC)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c0[] = "BVM Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c1[] = "Quantel"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c2[] = "Newer Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c3[] = "Taiwan Mycomp Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c4[] = "EVSX Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c5[] = "Procomp Informatics Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c6[] = "Technical University of Budapest"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c7[] = "Tateyama System Laboratory Co Ltd"; +static const char pci_device_15c7_0349[] = "Tateyama C-PCI PLC/NC card Rev.01A"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c8[] = "Penta Media Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15c9[] = "Serome Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ca[] = "Bitboys OY"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15cb[] = "AG Electronics Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15cc[] = "Hotrail Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15cd[] = "Dreamtech Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ce[] = "Genrad Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15cf[] = "Hilscher GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d1[] = "Infineon Technologies AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d2[] = "FIC (First International Computer Inc)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d3[] = "NDS Technologies Israel Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d4[] = "Iwill Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d5[] = "Tatung Co"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d6[] = "Entridia Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d7[] = "Rockwell-Collins Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d8[] = "Cybernetics Technology Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15d9[] = "Super Micro Computer Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15da[] = "Cyberfirm Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15db[] = "Applied Computing Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15dc[] = "Litronic Inc"; +static const char pci_device_15dc_0001[] = "Argus 300 PCI Cryptography Module"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15dd[] = "Sigmatel Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15de[] = "Malleable Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15df[] = "Infinilink Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e0[] = "Cacheflow Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e1[] = "Voice Technologies Group Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e2[] = "Quicknet Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e3[] = "Networth Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e4[] = "VSN Systemen BV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e5[] = "Valley technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e6[] = "Agere Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e7[] = "Get Engineering Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e8[] = "National Datacomm Corp"; +static const char pci_device_15e8_0130[] = "Wireless PCI Card"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15e9[] = "Pacific Digital Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ea[] = "Tokyo Denshi Sekei K.K."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15eb[] = "Drsearch GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ec[] = "Beckhoff GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ed[] = "Macrolink Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ee[] = "In Win Development Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ef[] = "Intelligent Paradigm Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f0[] = "B-Tree Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f1[] = "Times N Systems Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f2[] = "Diagnostic Instruments Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f3[] = "Digitmedia Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f4[] = "Valuesoft"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f5[] = "Power Micro Research"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f6[] = "Extreme Packet Device Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f7[] = "Banctec"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f8[] = "Koga Electronics Co"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15f9[] = "Zenith Electronics Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15fa[] = "J.P. Axzam Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15fb[] = "Zilog Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15fc[] = "Techsan Electronics Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15fd[] = "N-CUBED.NET"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15fe[] = "Kinpo Electronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_15ff[] = "Fastpoint Technologies Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1600[] = "Northrop Grumman - Canada Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1601[] = "Tenta Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1602[] = "Prosys-tec Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1603[] = "Nokia Wireless Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1604[] = "Central System Research Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1605[] = "Pairgain Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1606[] = "Europop AG"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1607[] = "Lava Semiconductor Manufacturing Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1608[] = "Automated Wagering International"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1609[] = "Scimetric Instruments Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1612[] = "Telesynergy Research Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1619[] = "FarSite Communications Ltd"; +static const char pci_device_1619_0400[] = "FarSync T2P (2 port X.21/V.35/V.24)"; +static const char pci_device_1619_0440[] = "FarSync T4P (4 port X.21/V.35/V.24)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1629[] = "Kongsberg Spacetec AS"; +static const char pci_device_1629_1003[] = "Format synchronizer v3.0"; +static const char pci_device_1629_2002[] = "Fast Universal Data Output"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1638[] = "Standard Microsystems Corp [SMC]"; +static const char pci_device_1638_1100[] = "SMC2602W EZConnect / Addtron AWA-100"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_163c[] = "Smart Link Ltd."; +static const char pci_device_163c_5449[] = "SmartPCI561 Modem"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1657[] = "Brocade Communications Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_165a[] = "Epix Inc"; +static const char pci_device_165a_c100[] = "PIXCI(R) CL1 Camera Link Video Capture Board [custom QL5232]"; +static const char pci_device_165a_d200[] = "PIXCI(R) D2X Digital Video Capture Board [custom QL5232]"; +static const char pci_device_165a_d300[] = "PIXCI(R) D3X Digital Video Capture Board [custom QL5232]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_165d[] = "Hsing Tech. Enterprise Co., Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1661[] = "Worldspace Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1668[] = "Actiontec Electronics Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1681[] = "Hercules"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_16ab[] = "Global Sun Technology Inc"; +static const char pci_device_16ab_1102[] = "PCMCIA-to-PCI Wireless Network Bridge"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_16be[] = "Creatix Polymedia GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_16ec[] = "U.S. Robotics"; +static const char pci_device_16ec_3685[] = "Wireless Access PCI Adapter Model 022415"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_16f6[] = "VideoTele.com, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1705[] = "Digital First, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_170b[] = "NetOctave Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_170c[] = "YottaYotta Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_172a[] = "Accelerated Encryption"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1737[] = "Linksys"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_173b[] = "Altima (nee Broadcom)"; +static const char pci_device_173b_03e8[] = "AC1000 Gigabit Ethernet"; +static const char pci_device_173b_03ea[] = "AC9100 Gigabit Ethernet"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_173b_03ea_173b_0001[] = "AC1002"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1743[] = "Peppercon AG"; +static const char pci_device_1743_8139[] = "ROL/F-100 Fast Ethernet Adapter with ROL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_174b[] = "PC Partner Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_175e[] = "Sanera Systems, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1787[] = "Hightech Information System Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1796[] = "Research Centre Juelich"; +static const char pci_device_1796_0001[] = "SIS1100 [Gigabit link]"; +static const char pci_device_1796_0002[] = "HOTlink"; +static const char pci_device_1796_0003[] = "Counter Timer"; +static const char pci_device_1796_0004[] = "CAMAC Controller"; +static const char pci_device_1796_0005[] = "PROFIBUS"; +static const char pci_device_1796_0006[] = "AMCC HOTlink"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1799[] = "Belkin"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_17af[] = "Hightech Information System Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_17cc[] = "NetChip Technology, Inc"; +static const char pci_device_17cc_2280[] = "USB 2.0"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1813[] = "Ambient Technologies Inc"; +static const char pci_device_1813_4000[] = "HaM controllerless modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1813_4000_16be_0001[] = "V9x HAM Data Fax Modem"; +#endif +static const char pci_device_1813_4100[] = "HaM plus Data Fax Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_1813_4100_16be_0002[] = "V9x HAM 1394"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1851[] = "Microtune, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1852[] = "Anritsu Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1888[] = "Varisys Ltd"; +static const char pci_device_1888_0301[] = "VMFX1 FPGA PMC module"; +static const char pci_device_1888_0601[] = "VSM2 dual PMC carrier"; +static const char pci_device_1888_0710[] = "VS14x series PowerPC PCI board"; +static const char pci_device_1888_0720[] = "VS24x series PowerPC PCI board"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1a08[] = "Sierra semiconductor"; +static const char pci_device_1a08_0000[] = "SC15064"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1b13[] = "Jaton Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1c1c[] = "Symphony"; +static const char pci_device_1c1c_0001[] = "82C101"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1d44[] = "DPT"; +static const char pci_device_1d44_a400[] = "PM2x24/PM3224"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_1de1[] = "Tekram Technology Co.,Ltd."; +static const char pci_device_1de1_0391[] = "TRM-S1040"; +static const char pci_device_1de1_2020[] = "DC-390"; +static const char pci_device_1de1_690c[] = "690c"; +static const char pci_device_1de1_dc29[] = "DC290"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2000[] = "Smart Link Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2001[] = "Temporal Research Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2003[] = "Smart Link Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2004[] = "Smart Link Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_21c3[] = "21st Century Computer Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2348[] = "Racore"; +static const char pci_device_2348_2010[] = "8142 100VG/AnyLAN"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2646[] = "Kingston Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_270b[] = "Xantel Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_270f[] = "Chaintech Computer Co. Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2711[] = "AVID Technology Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_2a15[] = "3D Vision(?)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_3000[] = "Hansol Electronics Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_3142[] = "Post Impression Systems."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_3388[] = "Hint Corp"; +static const char pci_device_3388_0013[] = "HiNT HC4 PCI to ISDN bridge, Multimedia audio controller"; +static const char pci_device_3388_0014[] = "HiNT HC4 PCI to ISDN bridge, Network controller"; +static const char pci_device_3388_0021[] = "HB1-SE33 PCI-PCI Bridge"; +static const char pci_device_3388_8011[] = "VXPro II Chipset"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3388_8011_3388_8011[] = "VXPro II Chipset CPU to PCI Bridge"; +#endif +static const char pci_device_3388_8012[] = "VXPro II Chipset"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3388_8012_3388_8012[] = "VXPro II Chipset PCI to ISA Bridge"; +#endif +static const char pci_device_3388_8013[] = "VXPro II IDE"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3388_8013_3388_8013[] = "VXPro II Chipset EIDE Controller"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_3411[] = "Quantum Designs (H.K.) Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_3513[] = "ARCOM Control Systems Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_38ef[] = "4Links"; +#endif +static const char pci_vendor_3d3d[] = "3DLabs"; +static const char pci_device_3d3d_0001[] = "GLINT 300SX"; +static const char pci_device_3d3d_0002[] = "GLINT 500TX"; +static const char pci_device_3d3d_0003[] = "GLINT Delta"; +static const char pci_device_3d3d_0004[] = "Permedia"; +static const char pci_device_3d3d_0005[] = "Permedia"; +static const char pci_device_3d3d_0006[] = "GLINT MX"; +static const char pci_device_3d3d_0007[] = "3D Extreme"; +static const char pci_device_3d3d_0008[] = "GLINT Gamma G1"; +static const char pci_device_3d3d_0009[] = "Permedia II 2D+3D"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_1040_0011[] = "AccelStar II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0100[] = "AccelStar II 3D Accelerator"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0111[] = "Permedia 3:16"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0114[] = "Santa Ana"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0116[] = "Oxygen GVX1"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0119[] = "Scirocco"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0120[] = "Santa Ana PCL"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0125[] = "Oxygen VX1"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_0009_3d3d_0127[] = "Permedia3 Create!"; +#endif +static const char pci_device_3d3d_000a[] = "GLINT R3"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_000a_3d3d_0121[] = "Oxygen VX1"; +#endif +static const char pci_device_3d3d_000c[] = "GLINT R3 [Oxygen VX1]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_3d3d_000c_3d3d_0144[] = "Oxygen VX1-4X AGP [Permedia 4]"; +#endif +static const char pci_device_3d3d_0100[] = "Permedia II 2D+3D"; +static const char pci_device_3d3d_1004[] = "Permedia"; +static const char pci_device_3d3d_3d04[] = "Permedia"; +static const char pci_device_3d3d_ffff[] = "Glint VGA"; +static const char pci_vendor_4005[] = "Avance Logic Inc."; +static const char pci_device_4005_0300[] = "ALS300 PCI Audio Device"; +static const char pci_device_4005_0308[] = "ALS300+ PCI Audio Device"; +static const char pci_device_4005_0309[] = "PCI Input Controller"; +static const char pci_device_4005_1064[] = "ALG-2064"; +static const char pci_device_4005_2064[] = "ALG-2064i"; +static const char pci_device_4005_2128[] = "ALG-2364A GUI Accelerator"; +static const char pci_device_4005_2301[] = "ALG-2301"; +static const char pci_device_4005_2302[] = "ALG-2302"; +static const char pci_device_4005_2303[] = "AVG-2302 GUI Accelerator"; +static const char pci_device_4005_2364[] = "ALG-2364A"; +static const char pci_device_4005_2464[] = "ALG-2464"; +static const char pci_device_4005_2501[] = "ALG-2564A/25128A"; +static const char pci_device_4005_4000[] = "ALS4000 Audio Chipset"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_4005_4000_4005_4000[] = "ALS4000 Audio Chipset"; +#endif +static const char pci_device_4005_4710[] = "ALC200/200P"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4033[] = "Addtron Technology Co, Inc."; +static const char pci_device_4033_1360[] = "RTL8139 Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4143[] = "Digital Equipment Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_416c[] = "Aladdin Knowledge Systems"; +static const char pci_device_416c_0100[] = "AladdinCARD"; +static const char pci_device_416c_0200[] = "CPC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4444[] = "Internext Compression Inc"; +static const char pci_device_4444_0803[] = "iTVC15 MPEG-2 Encoder"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4468[] = "Bridgeport machines"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4594[] = "Cogetec Informatique Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_45fb[] = "Baldor Electric Company"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4680[] = "Umax Computer Corp"; +#endif +static const char pci_vendor_4843[] = "Hercules Computer Technology Inc"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4916[] = "RedCreek Communications Inc"; +static const char pci_device_4916_1960[] = "RedCreek PCI adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4943[] = "Growth Networks"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4978[] = "Axil Computer Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4a14[] = "NetVin"; +static const char pci_device_4a14_5000[] = "NV5000SC"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_4a14_5000_4a14_5000[] = "RT8029-Based Ethernet Adapter"; +#endif +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4b10[] = "Buslogic Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4c48[] = "LUNG HWA Electronics"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4c53[] = "SBS Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4ca1[] = "Seanix Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4d51[] = "MediaQ Inc."; +static const char pci_device_4d51_0200[] = "MQ-200"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4d54[] = "Microtechnica Co Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_4ddc[] = "ILC Data Device Corp"; +static const char pci_device_4ddc_0100[] = "DD-42924I5-300 (ARINC 429 Data Bus)"; +static const char pci_device_4ddc_0801[] = "BU-65570I1 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0802[] = "BU-65570I2 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0811[] = "BU-65572I1 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0812[] = "BU-65572I2 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0881[] = "BU-65570T1 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0882[] = "BU-65570T2 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0891[] = "BU-65572T1 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0892[] = "BU-65572T2 MIL-STD-1553 Test and Simulation"; +static const char pci_device_4ddc_0901[] = "BU-65565C1 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0902[] = "BU-65565C2 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0903[] = "BU-65565C3 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0904[] = "BU-65565C4 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0b01[] = "BU-65569I1 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0b02[] = "BU-65569I2 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0b03[] = "BU-65569I3 MIL-STD-1553 Data Bus"; +static const char pci_device_4ddc_0b04[] = "BU-65569I4 MIL-STD-1553 Data Bus"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5046[] = "GemTek Technology Corporation"; +static const char pci_device_5046_1001[] = "PCI Radio"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5053[] = "Voyetra Technologies"; +static const char pci_device_5053_2010[] = "Daytona Audio Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5136[] = "S S Technologies"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5143[] = "Qualcomm Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5145[] = "Ensoniq (Old)"; +static const char pci_device_5145_3031[] = "Concert AudioPCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5168[] = "Animation Technologies Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5301[] = "Alliance Semiconductor Corp."; +static const char pci_device_5301_0001[] = "ProMotion aT3D"; +#endif +static const char pci_vendor_5333[] = "S3 Inc."; +static const char pci_device_5333_0551[] = "Plato/PX (system)"; +static const char pci_device_5333_5631[] = "86c325 [ViRGE]"; +static const char pci_device_5333_8800[] = "86c866 [Vision 866]"; +static const char pci_device_5333_8801[] = "86c964 [Vision 964]"; +static const char pci_device_5333_8810[] = "86c764_0 [Trio 32 vers 0]"; +static const char pci_device_5333_8811[] = "86c764/765 [Trio32/64/64V+]"; +static const char pci_device_5333_8812[] = "86cM65 [Aurora64V+]"; +static const char pci_device_5333_8813[] = "86c764_3 [Trio 32/64 vers 3]"; +static const char pci_device_5333_8814[] = "86c767 [Trio 64UV+]"; +static const char pci_device_5333_8815[] = "86cM65 [Aurora 128]"; +static const char pci_device_5333_883d[] = "86c988 [ViRGE/VX]"; +static const char pci_device_5333_8870[] = "FireGL"; +static const char pci_device_5333_8880[] = "86c868 [Vision 868 VRAM] vers 0"; +static const char pci_device_5333_8881[] = "86c868 [Vision 868 VRAM] vers 1"; +static const char pci_device_5333_8882[] = "86c868 [Vision 868 VRAM] vers 2"; +static const char pci_device_5333_8883[] = "86c868 [Vision 868 VRAM] vers 3"; +static const char pci_device_5333_88b0[] = "86c928 [Vision 928 VRAM] vers 0"; +static const char pci_device_5333_88b1[] = "86c928 [Vision 928 VRAM] vers 1"; +static const char pci_device_5333_88b2[] = "86c928 [Vision 928 VRAM] vers 2"; +static const char pci_device_5333_88b3[] = "86c928 [Vision 928 VRAM] vers 3"; +static const char pci_device_5333_88c0[] = "86c864 [Vision 864 DRAM] vers 0"; +static const char pci_device_5333_88c1[] = "86c864 [Vision 864 DRAM] vers 1"; +static const char pci_device_5333_88c2[] = "86c864 [Vision 864-P DRAM] vers 2"; +static const char pci_device_5333_88c3[] = "86c864 [Vision 864-P DRAM] vers 3"; +static const char pci_device_5333_88d0[] = "86c964 [Vision 964 VRAM] vers 0"; +static const char pci_device_5333_88d1[] = "86c964 [Vision 964 VRAM] vers 1"; +static const char pci_device_5333_88d2[] = "86c964 [Vision 964-P VRAM] vers 2"; +static const char pci_device_5333_88d3[] = "86c964 [Vision 964-P VRAM] vers 3"; +static const char pci_device_5333_88f0[] = "86c968 [Vision 968 VRAM] rev 0"; +static const char pci_device_5333_88f1[] = "86c968 [Vision 968 VRAM] rev 1"; +static const char pci_device_5333_88f2[] = "86c968 [Vision 968 VRAM] rev 2"; +static const char pci_device_5333_88f3[] = "86c968 [Vision 968 VRAM] rev 3"; +static const char pci_device_5333_8900[] = "86c755 [Trio 64V2/DX]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8900_5333_8900[] = "86C775 Trio64V2/DX"; +#endif +static const char pci_device_5333_8901[] = "86c775/86c785 [Trio 64V2/DX or /GX]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8901_5333_8901[] = "86C775 Trio64V2/DX, 86C785 Trio64V2/GX"; +#endif +static const char pci_device_5333_8902[] = "Plato/PX"; +static const char pci_device_5333_8903[] = "Trio 3D business multimedia"; +static const char pci_device_5333_8904[] = "Trio 64 3D"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8904_1014_00db[] = "Integrated Trio3D"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8904_5333_8904[] = "86C365 Trio3D AGP"; +#endif +static const char pci_device_5333_8905[] = "Trio 64V+ family"; +static const char pci_device_5333_8906[] = "Trio 64V+ family"; +static const char pci_device_5333_8907[] = "Trio 64V+ family"; +static const char pci_device_5333_8908[] = "Trio 64V+ family"; +static const char pci_device_5333_8909[] = "Trio 64V+ family"; +static const char pci_device_5333_890a[] = "Trio 64V+ family"; +static const char pci_device_5333_890b[] = "Trio 64V+ family"; +static const char pci_device_5333_890c[] = "Trio 64V+ family"; +static const char pci_device_5333_890d[] = "Trio 64V+ family"; +static const char pci_device_5333_890e[] = "Trio 64V+ family"; +static const char pci_device_5333_890f[] = "Trio 64V+ family"; +static const char pci_device_5333_8a01[] = "ViRGE/DX or /GX"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a01_0e11_b032[] = "ViRGE/GX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a01_10b4_1617[] = "Nitro 3D"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a01_10b4_1717[] = "Nitro 3D"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a01_5333_8a01[] = "ViRGE/DX"; +#endif +static const char pci_device_5333_8a10[] = "ViRGE/GX2"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a10_1092_8a10[] = "Stealth 3D 4000"; +#endif +static const char pci_device_5333_8a13[] = "86c368 [Trio 3D/2X]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a13_5333_8a13[] = "Trio3D/2X"; +#endif +static const char pci_device_5333_8a20[] = "86c794 [Savage 3D]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a20_5333_8a20[] = "86C391 Savage3D"; +#endif +static const char pci_device_5333_8a21[] = "86c390 [Savage 3D/MV]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a21_5333_8a21[] = "86C390 Savage3D/MV"; +#endif +static const char pci_device_5333_8a22[] = "Savage 4"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1033_8068[] = "Savage 4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1033_8069[] = "Savage 4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_105d_0018[] = "SR9 8Mb SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_105d_002a[] = "SR9 Pro 16Mb SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_105d_003a[] = "SR9 Pro 32Mb SDRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_105d_092f[] = "SR9 Pro+ 16Mb SGRAM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4207[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4800[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4807[] = "SpeedStar A90"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4808[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4809[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_480e[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4904[] = "Stealth III S520"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4905[] = "SpeedStar A200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4a09[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4a0b[] = "Stealth III S540 Xtreme"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4a0f[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1092_4e01[] = "Stealth III S540"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1102_101d[] = "3d Blaster Savage 4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_1102_101e[] = "3d Blaster Savage 4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_8100[] = "86C394-397 Savage4 SDRAM 100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_8110[] = "86C394-397 Savage4 SDRAM 110"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_8125[] = "86C394-397 Savage4 SDRAM 125"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_8143[] = "86C394-397 Savage4 SDRAM 143"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_8a22[] = "86C394-397 Savage4"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_8a2e[] = "86C394-397 Savage4 32bit"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_9125[] = "86C394-397 Savage4 SGRAM 125"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8a22_5333_9143[] = "86C394-397 Savage4 SGRAM 143"; +#endif +static const char pci_device_5333_8a23[] = "Savage 4"; +static const char pci_device_5333_8a25[] = "ProSavage PM133"; +static const char pci_device_5333_8a26[] = "ProSavage KM133"; +static const char pci_device_5333_8c00[] = "ViRGE/M3"; +static const char pci_device_5333_8c01[] = "ViRGE/MX"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8c01_1179_0001[] = "ViRGE/MX"; +#endif +static const char pci_device_5333_8c02[] = "ViRGE/MX+"; +static const char pci_device_5333_8c03[] = "ViRGE/MX+MV"; +static const char pci_device_5333_8c10[] = "86C270-294 Savage/MX-MV"; +static const char pci_device_5333_8c11[] = "82C270-294 Savage/MX"; +static const char pci_device_5333_8c12[] = "86C270-294 Savage/IX-MV"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8c12_1014_017f[] = "ThinkPad T20"; +#endif +static const char pci_device_5333_8c13[] = "86C270-294 Savage/IX"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8c13_1179_0001[] = "Magnia Z310"; +#endif +static const char pci_device_5333_8c22[] = "SuperSavage MX/128"; +static const char pci_device_5333_8c24[] = "SuperSavage MX/64"; +static const char pci_device_5333_8c26[] = "SuperSavage MX/64C"; +static const char pci_device_5333_8c2a[] = "SuperSavage IX/128 SDR"; +static const char pci_device_5333_8c2b[] = "SuperSavage IX/128 DDR"; +static const char pci_device_5333_8c2c[] = "SuperSavage IX/64 SDR"; +static const char pci_device_5333_8c2d[] = "SuperSavage IX/64 DDR"; +static const char pci_device_5333_8c2e[] = "SuperSavage IX/C SDR"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_8c2e_1014_01fc[] = "ThinkPad T23 (2647-4MG)"; +#endif +static const char pci_device_5333_8c2f[] = "SuperSavage IX/C DDR"; +static const char pci_device_5333_8d01[] = "86C380 [ProSavageDDR K4M266]"; +static const char pci_device_5333_8d02[] = "VT8636A [ProSavage KN133] AGP4X VGA Controller (TwisterK)"; +static const char pci_device_5333_8d03[] = "VT8751 [ProSavageDDR P4M266]"; +static const char pci_device_5333_8d04[] = "[ProSavageDDR K4M266]"; +static const char pci_device_5333_9102[] = "86C410 Savage 2000"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5932[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5934[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5952[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5954[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5a35[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5a37[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5a55[] = "Viper II Z200"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_5333_9102_1092_5a57[] = "Viper II Z200"; +#endif +static const char pci_device_5333_ca00[] = "SonicVibes"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_544c[] = "Teralogic Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5455[] = "Technische University Berlin"; +static const char pci_device_5455_4458[] = "S5933"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5519[] = "Cnet Technologies, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5544[] = "Dunord Technologies"; +static const char pci_device_5544_0001[] = "I-30xx Scanner Interface"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5555[] = "Genroco, Inc"; +static const char pci_device_5555_0003[] = "TURBOstor HFP-832 [HiPPI NIC]"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5654[] = "VoiceTronix Pty Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_5700[] = "Netpower"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_6356[] = "UltraStor"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_6374[] = "c't Magazin für Computertechnik"; +static const char pci_device_6374_6773[] = "GPPCI"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_6409[] = "Logitec Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_6666[] = "Decision Computer International Co."; +static const char pci_device_6666_0001[] = "PCCOM4"; +static const char pci_device_6666_0002[] = "PCCOM8"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_7604[] = "O.N. Electronic Co Ltd."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_7bde[] = "MIDAC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_7fed[] = "PowerTV"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_8008[] = "Quancom Electronic GmbH"; +static const char pci_device_8008_0010[] = "WDOG1 [PCI-Watchdog 1]"; +static const char pci_device_8008_0011[] = "PWDOG2 [PCI-Watchdog 2]"; +#endif +static const char pci_vendor_8086[] = "Intel Corp."; +static const char pci_device_8086_0007[] = "82379AB"; +static const char pci_device_8086_0008[] = "Extended Express System Support Controller"; +static const char pci_device_8086_0039[] = "21145"; +static const char pci_device_8086_0122[] = "82437FX"; +static const char pci_device_8086_0482[] = "82375EB"; +static const char pci_device_8086_0483[] = "82424ZX [Saturn]"; +static const char pci_device_8086_0484[] = "82378IB [SIO ISA Bridge]"; +static const char pci_device_8086_0486[] = "82430ZX [Aries]"; +static const char pci_device_8086_04a3[] = "82434LX [Mercury/Neptune]"; +static const char pci_device_8086_04d0[] = "82437FX [Triton FX]"; +static const char pci_device_8086_0600[] = "RAID Controller"; +static const char pci_device_8086_0960[] = "80960RP [i960 RP Microprocessor/Bridge]"; +static const char pci_device_8086_0962[] = "80960RM [i960RM Bridge]"; +static const char pci_device_8086_0964[] = "80960RP [i960 RP Microprocessor/Bridge]"; +static const char pci_device_8086_1000[] = "82542 Gigabit Ethernet Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1000_0e11_b0df[] = "NC1632 Gigabit Ethernet Adapter (1000-SX)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1000_0e11_b0e0[] = "NC1633 Gigabit Ethernet Adapter (1000-LX)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1000_0e11_b123[] = "NC1634 Gigabit Ethernet Adapter (1000-SX)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1000_1014_0119[] = "Netfinity Gigabit Ethernet SX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1000_8086_1000[] = "PRO/1000 Gigabit Server Adapter"; +#endif +static const char pci_device_8086_1001[] = "82543GC Gigabit Ethernet Controller (Fiber)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1001_0e11_004a[] = "NC6136 Gigabit Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1001_1014_01ea[] = "Netfinity Gigabit Ethernet SX Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1001_8086_1003[] = "PRO/1000 F Server Adapter"; +#endif +static const char pci_device_8086_1002[] = "Pro 100 LAN+Modem 56 Cardbus II"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1002_8086_200e[] = "Pro 100 LAN+Modem 56 Cardbus II"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1002_8086_2013[] = "Pro 100 SR Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1002_8086_2017[] = "Pro 100 S Combo Mobile Adapter"; +#endif +static const char pci_device_8086_1004[] = "82543GC Gigabit Ethernet Controller (Copper)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1004_0e11_0049[] = "NC7132 Gigabit Upgrade Module"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1004_0e11_b1a4[] = "NC7131 Gigabit Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1004_1014_10f2[] = "Gigabit Ethernet Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1004_8086_1004[] = "PRO/1000 T Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1004_8086_2004[] = "PRO/1000 T Server Adapter"; +#endif +static const char pci_device_8086_1008[] = "82544EI Gigabit Ethernet Controller (Copper)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1008_8086_1107[] = "PRO/1000 XT Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1008_8086_2107[] = "PRO/1000 XT Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1008_8086_2110[] = "PRO/1000 XT Server Adapter"; +#endif +static const char pci_device_8086_1009[] = "82544EI Gigabit Ethernet Controller (Fiber)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1009_8086_1109[] = "PRO/1000 XF Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1009_8086_2109[] = "PRO/1000 XF Server Adapter"; +#endif +static const char pci_device_8086_100c[] = "82544GC Gigabit Ethernet Controller (Copper)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_100c_8086_1112[] = "PRO/1000 T Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_100c_8086_2112[] = "PRO/1000 T Desktop Adapter"; +#endif +static const char pci_device_8086_100d[] = "82544GC Gigabit Ethernet Controller (LOM)"; +static const char pci_device_8086_100e[] = "82540EM Gigabit Ethernet Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_100e_8086_001e[] = "PRO/1000 MT Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_100e_8086_002e[] = "PRO/1000 MT Desktop Adapter"; +#endif +static const char pci_device_8086_100f[] = "82545EM Gigabit Ethernet Controller (Copper)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_100f_8086_1001[] = "PRO/1000 MT Server Adapter"; +#endif +static const char pci_device_8086_1010[] = "82546EB Gigabit Ethernet Controller (Copper)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1010_8086_1011[] = "PRO/1000 MT Dual Port Server Adapter"; +#endif +static const char pci_device_8086_1011[] = "82545EM Gigabit Ethernet Controller (Fiber)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1011_8086_1002[] = "PRO/1000 MF Server Adapter"; +#endif +static const char pci_device_8086_1012[] = "82546EB Gigabit Ethernet Controller (Fiber)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1012_8086_1012[] = "PRO/1000 MF Dual Port Server Adapter"; +#endif +static const char pci_device_8086_1015[] = "82540EM Gigabit Ethernet Controller (LOM)"; +static const char pci_device_8086_1029[] = "82559 Ethernet Controller"; +static const char pci_device_8086_1030[] = "82559 InBusiness 10/100"; +static const char pci_device_8086_1031[] = "82801CAM (ICH3) PRO/100 VE (LOM) Ethernet Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_1014_0209[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_104d_80e7[] = "Vaio PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_107b_5350[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_1179_0001[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_144d_c000[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_144d_c001[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_144d_c003[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1031_144d_c006[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_1032[] = "82801CAM (ICH3) PRO/100 VE Ethernet Controller"; +static const char pci_device_8086_1033[] = "82801CAM (ICH3) PRO/100 VM (LOM) Ethernet Controller"; +static const char pci_device_8086_1034[] = "82801CAM (ICH3) PRO/100 VM Ethernet Controller"; +static const char pci_device_8086_1035[] = "82801CAM (ICH3)/82562EH (LOM) Ethernet Controller"; +static const char pci_device_8086_1036[] = "82801CAM (ICH3) 82562EH Ethernet Controller"; +static const char pci_device_8086_1037[] = "82801CAM (ICH3) Chipset Ethernet Controller"; +static const char pci_device_8086_1038[] = "82801CAM (ICH3) PRO/100 VM (KM) Ethernet Controller"; +static const char pci_device_8086_1039[] = "82801BD PRO/100 VE (LOM) Ethernet Controller"; +static const char pci_device_8086_103a[] = "82801BD PRO/100 VE (CNR) Ethernet Controller"; +static const char pci_device_8086_103b[] = "82801BD PRO/100 VM (LOM) Ethernet Controller"; +static const char pci_device_8086_103c[] = "82801BD PRO/100 VM (CNR) Ethernet Controller"; +static const char pci_device_8086_103d[] = "82801BD PRO/100 VE (MOB) Ethernet Controller"; +static const char pci_device_8086_103e[] = "82801BD PRO/100 VM (MOB) Ethernet Controller"; +static const char pci_device_8086_1040[] = "536EP Data Fax Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1040_16be_1040[] = "V.9X DSP Data Fax Modem"; +#endif +static const char pci_device_8086_1059[] = "82551QM Ethernet Controller"; +static const char pci_device_8086_1130[] = "82815 815 Chipset Host Bridge and Memory Controller Hub"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1130_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1130_1043_8027[] = "TUSL2-C Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1130_104d_80df[] = "Vaio PCG-FX403"; +#endif +static const char pci_device_8086_1131[] = "82815 815 Chipset AGP Bridge"; +static const char pci_device_8086_1132[] = "82815 CGC [Chipset Graphics Controller]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1132_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1132_104d_80df[] = "Vaio PCG-FX403"; +#endif +static const char pci_device_8086_1161[] = "82806AA PCI64 Hub Advanced Programmable Interrupt Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1161_8086_1161[] = "82806AA PCI64 Hub APIC"; +#endif +static const char pci_device_8086_1162[] = "Xscale 80200 Big Endian Companion Chip"; +static const char pci_device_8086_1200[] = "Intel IXP1200 Network Processor"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1200_172a_0000[] = "AEP SSL Accelerator"; +#endif +static const char pci_device_8086_1209[] = "82559ER"; +static const char pci_device_8086_1221[] = "82092AA_0"; +static const char pci_device_8086_1222[] = "82092AA_1"; +static const char pci_device_8086_1223[] = "SAA7116"; +static const char pci_device_8086_1225[] = "82452KX/GX [Orion]"; +static const char pci_device_8086_1226[] = "82596 PRO/10 PCI"; +static const char pci_device_8086_1227[] = "82865 EtherExpress PRO/100A"; +static const char pci_device_8086_1228[] = "82556 EtherExpress PRO/100 Smart"; +static const char pci_device_8086_1229[] = "82557/8/9 [Ethernet Pro 100]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3001[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3002[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3003[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3004[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3005[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3006[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_3007[] = "82559 Fast Ethernet LOM with Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b01e[] = "NC3120 Fast Ethernet NIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b01f[] = "NC3122 Fast Ethernet NIC (dual port)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b02f[] = "NC1120 Ethernet NIC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b04a[] = "Netelligent 10/100TX NIC with Wake on LAN"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b0c6[] = "NC3161 Fast Ethernet NIC (embedded, WOL)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b0c7[] = "NC3160 Fast Ethernet NIC (embedded)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b0d7[] = "NC3121 Fast Ethernet NIC (WOL)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b0dd[] = "NC3131 Fast Ethernet NIC (dual port)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b0de[] = "NC3132 Fast Ethernet Module (dual port)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b0e1[] = "NC3133 Fast Ethernet Module (100-FX)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b134[] = "NC3163 Fast Ethernet NIC (embedded, WOL)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b13c[] = "NC3162 Fast Ethernet NIC (embedded)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b144[] = "NC3123 Fast Ethernet NIC (WOL)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b163[] = "NC3134 Fast Ethernet NIC (dual port)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b164[] = "NC3135 Fast Ethernet Upgrade Module (dual port)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_0e11_b1a4[] = "NC7131 Gigabit Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_005c[] = "82558B Ethernet Pro 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_01bc[] = "82559 Fast Ethernet LAN On Motherboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_01f1[] = "10/100 Ethernet Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_01f2[] = "10/100 Ethernet Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_0207[] = "Ethernet Pro/100 S"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_0232[] = "10/100 Dual Port Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_023a[] = "ThinkPad R30"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_105c[] = "Netfinity 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_2205[] = "ThinkPad A22p"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_305c[] = "10/100 EtherJet Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_405c[] = "10/100 EtherJet Adapter with Alert on LAN"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_505c[] = "10/100 EtherJet Secure Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_605c[] = "10/100 EtherJet Secure Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_705c[] = "10/100 Netfinity 10/100 Ethernet Security Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1014_805c[] = "10/100 Netfinity 10/100 Ethernet Security Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1028_009b[] = "PowerEdge 2550"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1033_8000[] = "PC-9821X-B06"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1033_8016[] = "PK-UG-X006"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1033_801f[] = "PK-UG-X006"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1033_8026[] = "PK-UG-X006"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1033_8063[] = "82559-based Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1033_8064[] = "82559-based Fast Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_10c0[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_10c3[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_10ca[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_10cb[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_10e3[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_10e4[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_103c_1200[] = "NetServer 10/100TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_10c3_1100[] = "SmartEther100 SC1100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_10cf_1115[] = "8255x-based Ethernet Adapter (10/100)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_10cf_1143[] = "8255x-based Ethernet Adapter (10/100)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1179_0001[] = "8255x-based Ethernet Adapter (10/100)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1179_0002[] = "PCI FastEther LAN on Docker"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1179_0003[] = "8255x-based Fast Ethernet"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1259_2560[] = "AT-2560 100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1259_2561[] = "AT-2560 100 FX Ethernet Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1266_0001[] = "NE10/100 Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_144d_2501[] = "SEM-2000 MiniPCI LAN Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_144d_2502[] = "SEM-2100IL MiniPCI LAN Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_1668_1100[] = "EtherExpress PRO/100B (TX) (MiniPCI Ethernet+Modem)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0001[] = "EtherExpress PRO/100B (TX)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0002[] = "EtherExpress PRO/100B (T4)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0003[] = "EtherExpress PRO/10+"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0004[] = "EtherExpress PRO/100 WfM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0005[] = "82557 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0006[] = "82557 10/100 with Wake on LAN"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0007[] = "82558 10/100 Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0008[] = "82558 10/100 with Wake on LAN"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0009[] = "EtherExpress PRO/100+"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_000a[] = "EtherExpress PRO/100+ Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_000b[] = "EtherExpress PRO/100+"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_000c[] = "EtherExpress PRO/100+ Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_000d[] = "EtherExpress PRO/100+ Alert On LAN II* Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_000e[] = "EtherExpress PRO/100+ Management Adapter with Alert On LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_000f[] = "EtherExpress PRO/100 Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0010[] = "EtherExpress PRO/100 S Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0011[] = "EtherExpress PRO/100 S Management Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0012[] = "EtherExpress PRO/100 S Advanced Management Adapter (D)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0013[] = "EtherExpress PRO/100 S Advanced Management Adapter (E)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0030[] = "EtherExpress PRO/100 Management Adapter with Alert On LAN* GC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0031[] = "EtherExpress PRO/100 Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0040[] = "EtherExpress PRO/100 S Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0041[] = "EtherExpress PRO/100 S Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0042[] = "EtherExpress PRO/100 Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_0050[] = "EtherExpress PRO/100 S Desktop Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1009[] = "EtherExpress PRO/100+ Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_100c[] = "EtherExpress PRO/100+ Server Adapter (PILA8470B)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1012[] = "EtherExpress PRO/100 S Server Adapter (D)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1013[] = "EtherExpress PRO/100 S Server Adapter (E)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1015[] = "EtherExpress PRO/100 S Dual Port Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1017[] = "EtherExpress PRO/100+ Dual Port Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1030[] = "EtherExpress PRO/100+ Management Adapter with Alert On LAN* G Server"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1040[] = "EtherExpress PRO/100 S Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1041[] = "EtherExpress PRO/100 S Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1042[] = "EtherExpress PRO/100 Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1050[] = "EtherExpress PRO/100 S Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1051[] = "EtherExpress PRO/100 Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_1052[] = "EtherExpress PRO/100 Server Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_10f0[] = "EtherExpress PRO/100+ Dual Port Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2009[] = "EtherExpress PRO/100 S Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_200d[] = "EtherExpress PRO/100 Cardbus"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_200e[] = "EtherExpress PRO/100 LAN+V90 Cardbus Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_200f[] = "EtherExpress PRO/100 SR Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2010[] = "EtherExpress PRO/100 S Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2013[] = "EtherExpress PRO/100 SR Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2016[] = "EtherExpress PRO/100 S Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2017[] = "EtherExpress PRO/100 S Combo Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2018[] = "EtherExpress PRO/100 SR Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2019[] = "EtherExpress PRO/100 SR Combo Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2101[] = "EtherExpress PRO/100 P Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2102[] = "EtherExpress PRO/100 SP Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2103[] = "EtherExpress PRO/100 SP Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2104[] = "EtherExpress PRO/100 SP Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2105[] = "EtherExpress PRO/100 SP Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2106[] = "EtherExpress PRO/100 P Mobile Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2107[] = "EtherExpress PRO/100 Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2108[] = "EtherExpress PRO/100 Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2200[] = "EtherExpress PRO/100 P Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2201[] = "EtherExpress PRO/100 P Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2202[] = "EtherExpress PRO/100 SP Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2203[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2204[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2205[] = "EtherExpress PRO/100 SP Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2206[] = "EtherExpress PRO/100 SP Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2207[] = "EtherExpress PRO/100 SP Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2208[] = "EtherExpress PRO/100 P Mobile Combo Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2402[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2407[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2408[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2409[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_240f[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2410[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2411[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2412[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_2413[] = "EtherExpress PRO/100+ MiniPCI"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3000[] = "82559 Fast Ethernet LAN on Motherboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3001[] = "82559 Fast Ethernet LOM with Basic Alert on LAN*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3002[] = "82559 Fast Ethernet LOM with Alert on LAN II*"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3006[] = "EtherExpress PRO/100 S Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3007[] = "EtherExpress PRO/100 S Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3008[] = "EtherExpress PRO/100 Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3010[] = "EtherExpress PRO/100 S Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3011[] = "EtherExpress PRO/100 S Network Connection"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1229_8086_3012[] = "EtherExpress PRO/100 Network Connection"; +#endif +static const char pci_device_8086_122d[] = "430FX - 82437FX TSC [Triton I]"; +static const char pci_device_8086_122e[] = "82371FB PIIX ISA [Triton I]"; +static const char pci_device_8086_1230[] = "82371FB PIIX IDE [Triton I]"; +static const char pci_device_8086_1231[] = "DSVD Modem"; +static const char pci_device_8086_1234[] = "430MX - 82371MX Mobile PCI I/O IDE Xcelerator (MPIIX)"; +static const char pci_device_8086_1235[] = "430MX - 82437MX Mob. System Ctrlr (MTSC) & 82438MX Data Path (MTDP)"; +static const char pci_device_8086_1237[] = "440FX - 82441FX PMC [Natoma]"; +static const char pci_device_8086_1239[] = "82371FB"; +static const char pci_device_8086_123b[] = "82380PB"; +static const char pci_device_8086_123c[] = "82380AB"; +static const char pci_device_8086_123d[] = "683053 Programmable Interrupt Device"; +static const char pci_device_8086_123f[] = "82466GX Integrated Hot-Plug Controller (IHPC)"; +static const char pci_device_8086_1240[] = "752 AGP"; +static const char pci_device_8086_124b[] = "82380FB"; +static const char pci_device_8086_1250[] = "430HX - 82439HX TXC [Triton II]"; +static const char pci_device_8086_1360[] = "82806AA PCI64 Hub PCI Bridge"; +static const char pci_device_8086_1361[] = "82806AA PCI64 Hub Controller (HRes)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1361_8086_1361[] = "82806AA PCI64 Hub Controller (HRes)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1361_8086_8000[] = "82806AA PCI64 Hub Controller (HRes)"; +#endif +static const char pci_device_8086_1460[] = "82870P2 P64H2 Hub PCI Bridge"; +static const char pci_device_8086_1461[] = "82870P2 P64H2 I/OxAPIC"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1461_15d9_3480[] = "P4DP6"; +#endif +static const char pci_device_8086_1462[] = "82870P2 P64H2 Hot Plug Controller"; +static const char pci_device_8086_1960[] = "80960RP [i960RP Microprocessor]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_0431[] = "MegaRAID 431 RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_0438[] = "MegaRAID 438 Ultra2 LVD RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_0466[] = "MegaRAID 466 Express Plus RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_0467[] = "MegaRAID 467 Enterprise 1500 RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_0490[] = "MegaRAID 490 Express 300 RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_0762[] = "MegaRAID 762 Express RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_101e_09a0[] = "PowerEdge Expandable RAID Controller 2/SC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_1028_0467[] = "PowerEdge Expandable RAID Controller 2/DC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_1028_1111[] = "PowerEdge Expandable RAID Controller 2/SC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_103c_03a2[] = "MegaRAID"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_103c_10c6[] = "MegaRAID 438, HP NetRAID-3Si"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_103c_10c7[] = "MegaRAID T5, Integrated HP NetRAID"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_103c_10cc[] = "MegaRAID, Integrated HP NetRAID"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_103c_10cd[] = "HP NetRAID-1Si"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_105a_0000[] = "SuperTrak"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_105a_2168[] = "SuperTrak Pro"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_105a_5168[] = "SuperTrak66/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_1111_1111[] = "MegaRAID 466, PowerEdge Expandable RAID Controller 2/SC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_1111_1112[] = "PowerEdge Expandable RAID Controller 2/SC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1960_113c_03a2[] = "MegaRAID"; +#endif +static const char pci_device_8086_1962[] = "80960RM [i960RM Microprocessor]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_1962_105a_0000[] = "SuperTrak SX6000 I2O CPU"; +#endif +static const char pci_device_8086_1a21[] = "82840 840 (Carmel) Chipset Host Bridge (Hub A)"; +static const char pci_device_8086_1a23[] = "82840 840 (Carmel) Chipset AGP Bridge"; +static const char pci_device_8086_1a24[] = "82840 840 (Carmel) Chipset PCI Bridge (Hub B)"; +static const char pci_device_8086_1a30[] = "82845 845 (Brookdale) Chipset Host Bridge"; +static const char pci_device_8086_1a31[] = "82845 845 (Brookdale) Chipset AGP Bridge"; +static const char pci_device_8086_2410[] = "82801AA ISA Bridge (LPC)"; +static const char pci_device_8086_2411[] = "82801AA IDE"; +static const char pci_device_8086_2412[] = "82801AA USB"; +static const char pci_device_8086_2413[] = "82801AA SMBus"; +static const char pci_device_8086_2415[] = "82801AA AC'97 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2415_1028_0095[] = "Precision Workstation 220 Integrated Digital Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2415_11d4_0040[] = "SoundMAX Integrated Digital Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2415_11d4_0048[] = "SoundMAX Integrated Digital Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2415_11d4_5340[] = "SoundMAX Integrated Digital Audio"; +#endif +static const char pci_device_8086_2416[] = "82801AA AC'97 Modem"; +static const char pci_device_8086_2418[] = "82801AA PCI Bridge"; +static const char pci_device_8086_2420[] = "82801AB ISA Bridge (LPC)"; +static const char pci_device_8086_2421[] = "82801AB IDE"; +static const char pci_device_8086_2422[] = "82801AB USB"; +static const char pci_device_8086_2423[] = "82801AB SMBus"; +static const char pci_device_8086_2425[] = "82801AB AC'97 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2425_11d4_0040[] = "SoundMAX Integrated Digital Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2425_11d4_0048[] = "SoundMAX Integrated Digital Audio"; +#endif +static const char pci_device_8086_2426[] = "82801AB AC'97 Modem"; +static const char pci_device_8086_2428[] = "82801AB PCI Bridge"; +static const char pci_device_8086_2440[] = "82801BA ISA Bridge (LPC)"; +static const char pci_device_8086_2442[] = "82801BA/BAM USB (Hub #1)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2442_1014_01c6[] = "Netvista A40/A40p"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2442_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2442_104d_80df[] = "Vaio PCG-FX403"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2442_147b_0507[] = "TH7II-RAID"; +#endif +static const char pci_device_8086_2443[] = "82801BA/BAM SMBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2443_1014_01c6[] = "Netvista A40/A40p"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2443_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2443_1043_8027[] = "TUSL2-C Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2443_104d_80df[] = "Vaio PCG-FX403"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2443_147b_0507[] = "TH7II-RAID"; +#endif +static const char pci_device_8086_2444[] = "82801BA/BAM USB (Hub #2)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2444_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2444_104d_80df[] = "Vaio PCG-FX403"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2444_147b_0507[] = "TH7II-RAID"; +#endif +static const char pci_device_8086_2445[] = "82801BA/BAM AC'97 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2445_1014_01c6[] = "Netvista A40/A40p"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2445_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2445_104d_80df[] = "Vaio PCG-FX403"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2445_1462_3370[] = "STAC9721 AC"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2445_147b_0507[] = "TH7II-RAID"; +#endif +static const char pci_device_8086_2446[] = "Intel 537 [82801BA/BAM AC'97 Modem]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2446_1025_1016[] = "Travelmate 612 TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2446_104d_80df[] = "Vaio PCG-FX403"; +#endif +static const char pci_device_8086_2448[] = "82801BAM/CAM PCI Bridge"; +static const char pci_device_8086_2449[] = "82801BA/BAM/CA/CAM Ethernet Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_0e11_0012[] = "EtherExpress PRO/100 VM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_0e11_0091[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_01ce[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_01dc[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_01eb[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_01ec[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_0202[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_0205[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_0217[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_0234[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_023d[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_0244[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1014_0245[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_109f_315d[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_109f_3181[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_1186_7801[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_144d_2602[] = "HomePNA 1M CNR"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3010[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3011[] = "EtherExpress PRO/100 VM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3012[] = "82562EH based Phoneline"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3013[] = "EtherExpress PRO/100 VE"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3014[] = "EtherExpress PRO/100 VM"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3015[] = "82562EH based Phoneline"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3016[] = "EtherExpress PRO/100 P Mobile Combo"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3017[] = "EtherExpress PRO/100 P Mobile"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2449_8086_3018[] = "EtherExpress PRO/100"; +#endif +static const char pci_device_8086_244a[] = "82801BAM IDE U100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_244a_1025_1016[] = "Travelmate 612TX"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_244a_104d_80df[] = "Vaio PCG-FX403"; +#endif +static const char pci_device_8086_244b[] = "82801BA IDE U100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_244b_1014_01c6[] = "Netvista A40/A40p"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_244b_1043_8027[] = "TUSL2-C Mainboard"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_244b_147b_0507[] = "TH7II-RAID"; +#endif +static const char pci_device_8086_244c[] = "82801BAM ISA Bridge (LPC)"; +static const char pci_device_8086_244e[] = "82801BA/CA/DB PCI Bridge"; +static const char pci_device_8086_2450[] = "82801E ISA Bridge (LPC)"; +static const char pci_device_8086_2452[] = "82801E USB"; +static const char pci_device_8086_2453[] = "82801E SMBus"; +static const char pci_device_8086_2459[] = "82801E Ethernet Controller 0"; +static const char pci_device_8086_245b[] = "82801E IDE U100"; +static const char pci_device_8086_245d[] = "82801E Ethernet Controller 1"; +static const char pci_device_8086_245e[] = "82801E PCI Bridge"; +static const char pci_device_8086_2480[] = "82801CA ISA Bridge (LPC)"; +static const char pci_device_8086_2482[] = "82801CA/CAM USB (Hub #1)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2482_1014_0220[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2482_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2482_15d9_3480[] = "P4DP6"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2482_8086_1958[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_2483[] = "82801CA/CAM SMBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2483_1014_0220[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2483_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2483_15d9_3480[] = "P4DP6"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2483_8086_1958[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_2484[] = "82801CA/CAM USB (Hub #2)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2484_1014_0220[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2484_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2484_15d9_3480[] = "P4DP6"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2484_8086_1958[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_2485[] = "82801CA/CAM AC'97 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2485_1014_0222[] = "ThinkPad T23 (2647-4MG) or A30p (2653-64G)"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2485_1014_0508[] = "ThinkPad T30"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2485_1014_051c[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2485_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2485_144d_c006[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_2486[] = "82801CA/CAM AC'97 Modem"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_1014_0223[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_1014_0503[] = "ThinkPad R31 2656BBG"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_1014_051a[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_1179_0001[] = "Toshiba Satellite 1110 Z15 internal Modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_134d_4c21[] = "Dell Inspiron 2100 internal modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_144d_2115[] = "vpr Matrix 170B4 internal modem"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2486_14f1_5421[] = "MD56ORD V.92 MDC Modem"; +#endif +static const char pci_device_8086_2487[] = "82801CA/CAM USB (Hub #3)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2487_1014_0220[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2487_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2487_15d9_3480[] = "P4DP6"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2487_8086_1958[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_248a[] = "82801CAM IDE U100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_248a_1014_0220[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_248a_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_248a_8086_1958[] = "vpr Matrix 170B4"; +#endif +static const char pci_device_8086_248b[] = "82801CA IDE U100"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_248b_15d9_3480[] = "P4DP6"; +#endif +static const char pci_device_8086_248c[] = "82801CAM ISA Bridge (LPC)"; +static const char pci_device_8086_24c0[] = "82801DB ISA Bridge (LPC)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24c0_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24c2[] = "82801DB USB (Hub #1)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24c2_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24c3[] = "82801DB SMBus"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24c3_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24c4[] = "82801DB USB (Hub #2)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24c4_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24c5[] = "82801DB AC'97 Audio"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24c5_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24c6[] = "82801DB AC'97 Modem"; +static const char pci_device_8086_24c7[] = "82801DB USB (Hub #3)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24c7_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24cb[] = "82801DB ICH4 IDE"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24cb_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_24cd[] = "82801DB USB EHCI Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_24cd_1462_3981[] = "845PE Max (MS-6580) Onboard USB EHCI Controller"; +#endif +static const char pci_device_8086_2500[] = "82820 820 (Camino) Chipset Host Bridge (MCH)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2500_1028_0095[] = "Precision Workstation 220 Chipset"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2500_1043_801c[] = "P3C-2000 system chipset"; +#endif +static const char pci_device_8086_2501[] = "82820 820 (Camino) Chipset Host Bridge (MCH)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2501_1043_801c[] = "P3C-2000 system chipset"; +#endif +static const char pci_device_8086_250b[] = "82820 820 (Camino) Chipset Host Bridge"; +static const char pci_device_8086_250f[] = "82820 820 (Camino) Chipset AGP Bridge"; +static const char pci_device_8086_2520[] = "82805AA MTH Memory Translator Hub"; +static const char pci_device_8086_2521[] = "82804AA MRH-S Memory Repeater Hub for SDRAM"; +static const char pci_device_8086_2530[] = "82850 850 (Tehama) Chipset Host Bridge (MCH)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2530_147b_0507[] = "TH7II-RAID"; +#endif +static const char pci_device_8086_2531[] = "82860 860 (Wombat) Chipset Host Bridge (MCH)"; +static const char pci_device_8086_2532[] = "82850 850 (Tehama) Chipset AGP Bridge"; +static const char pci_device_8086_2533[] = "82860 860 (Wombat) Chipset AGP Bridge"; +static const char pci_device_8086_2534[] = "82860 860 (Wombat) Chipset PCI Bridge"; +static const char pci_device_8086_2540[] = "e7500 [Plumas] DRAM Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2540_15d9_3480[] = "P4DP6"; +#endif +static const char pci_device_8086_2541[] = "e7500 [Plumas] DRAM Controller Error Reporting"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2541_15d9_3480[] = "P4DP6"; +#endif +static const char pci_device_8086_2543[] = "e7500 [Plumas] HI_B Virtual PCI Bridge (F0)"; +static const char pci_device_8086_2544[] = "e7500 [Plumas] HI_B Virtual PCI Bridge (F1)"; +static const char pci_device_8086_2545[] = "e7500 [Plumas] HI_C Virtual PCI Bridge (F0)"; +static const char pci_device_8086_2546[] = "e7500 [Plumas] HI_C Virtual PCI Bridge (F1)"; +static const char pci_device_8086_2547[] = "e7500 [Plumas] HI_D Virtual PCI Bridge (F0)"; +static const char pci_device_8086_2548[] = "e7500 [Plumas] HI_D Virtual PCI Bridge (F1)"; +static const char pci_device_8086_2560[] = "82845G/GL [Brookdale-G] Chipset Host Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_2560_1462_5800[] = "845PE Max (MS-6580)"; +#endif +static const char pci_device_8086_2561[] = "82845G/GL [Brookdale-G] Chipset AGP Bridge"; +static const char pci_device_8086_2562[] = "82845G/GL [Brookdale-G] Chipset Integrated Graphics Device"; +static const char pci_device_8086_2570[] = "865G Chipset Host-Hub Bridge"; +static const char pci_device_8086_2572[] = "865G Chipset Graphics Controller"; +static const char pci_device_8086_3092[] = "Integrated RAID"; +static const char pci_device_8086_3575[] = "82830 830 Chipset Host Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_3575_1014_021d[] = "ThinkPad A/T/X Series"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_3575_104d_80e7[] = "VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP"; +#endif +static const char pci_device_8086_3576[] = "82830 830 Chipset AGP Bridge"; +static const char pci_device_8086_3577[] = "82830 CGC [Chipset Graphics Controller]"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_3577_1014_0513[] = "ThinkPad A/T/X Series"; +#endif +static const char pci_device_8086_3578[] = "82830 830 Chipset Host Bridge"; +static const char pci_device_8086_3580[] = "852GM/852GME/855GM/855GME Chipset Host-Hub Bridge"; +static const char pci_device_8086_3582[] = "852GM/852GME/855GM/855GME Chipset Graphics Controller"; +static const char pci_device_8086_5200[] = "EtherExpress PRO/100 Intelligent Server"; +static const char pci_device_8086_5201[] = "EtherExpress PRO/100 Intelligent Server"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_5201_8086_0001[] = "EtherExpress PRO/100 Server Ethernet Adapter"; +#endif +static const char pci_device_8086_530d[] = "80310 IOP [IO Processor]"; +static const char pci_device_8086_7000[] = "82371SB PIIX3 ISA [Natoma/Triton II]"; +static const char pci_device_8086_7010[] = "82371SB PIIX3 IDE [Natoma/Triton II]"; +static const char pci_device_8086_7020[] = "82371SB PIIX3 USB [Natoma/Triton II]"; +static const char pci_device_8086_7030[] = "430VX - 82437VX TVX [Triton VX]"; +static const char pci_device_8086_7100[] = "430TX - 82439TX MTXC"; +static const char pci_device_8086_7110[] = "82371AB/EB/MB PIIX4 ISA"; +static const char pci_device_8086_7111[] = "82371AB/EB/MB PIIX4 IDE"; +static const char pci_device_8086_7112[] = "82371AB/EB/MB PIIX4 USB"; +static const char pci_device_8086_7113[] = "82371AB/EB/MB PIIX4 ACPI"; +static const char pci_device_8086_7120[] = "82810 GMCH [Graphics Memory Controller Hub]"; +static const char pci_device_8086_7121[] = "82810 CGC [Chipset Graphics Controller]"; +static const char pci_device_8086_7122[] = "82810 DC-100 GMCH [Graphics Memory Controller Hub]"; +static const char pci_device_8086_7123[] = "82810 DC-100 CGC [Chipset Graphics Controller]"; +static const char pci_device_8086_7124[] = "82810E DC-133 GMCH [Graphics Memory Controller Hub]"; +static const char pci_device_8086_7125[] = "82810E DC-133 CGC [Chipset Graphics Controller]"; +static const char pci_device_8086_7126[] = "82810 DC-133 System and Graphics Controller"; +static const char pci_device_8086_7128[] = "82810-M DC-100 System and Graphics Controller"; +static const char pci_device_8086_712a[] = "82810-M DC-133 System and Graphics Controller"; +static const char pci_device_8086_7180[] = "440LX/EX - 82443LX/EX Host bridge"; +static const char pci_device_8086_7181[] = "440LX/EX - 82443LX/EX AGP bridge"; +static const char pci_device_8086_7190[] = "440BX/ZX/DX - 82443BX/ZX/DX Host bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7190_0e11_0500[] = "Armada 1750 Laptop System Chipset"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7190_0e11_b110[] = "Armada M700"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7190_1179_0001[] = "Toshiba Tecra 8100 Laptop System Chipset"; +#endif +static const char pci_device_8086_7191[] = "440BX/ZX/DX - 82443BX/ZX/DX AGP bridge"; +static const char pci_device_8086_7192[] = "440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled)"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7192_0e11_0460[] = "Armada 1700 Laptop System Chipset"; +#endif +static const char pci_device_8086_7194[] = "82440MX Host Bridge"; +static const char pci_device_8086_7195[] = "82440MX AC'97 Audio Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7195_10cf_1099[] = "QSound_SigmaTel Stac97 PCI Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7195_11d4_0040[] = "SoundMAX Integrated Digital Audio"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7195_11d4_0048[] = "SoundMAX Integrated Digital Audio"; +#endif +static const char pci_device_8086_7196[] = "82440MX AC'97 Modem Controller"; +static const char pci_device_8086_7198[] = "82440MX ISA Bridge"; +static const char pci_device_8086_7199[] = "82440MX EIDE Controller"; +static const char pci_device_8086_719a[] = "82440MX USB Universal Host Controller"; +static const char pci_device_8086_719b[] = "82440MX Power Management Controller"; +static const char pci_device_8086_71a0[] = "440GX - 82443GX Host bridge"; +static const char pci_device_8086_71a1[] = "440GX - 82443GX AGP bridge"; +static const char pci_device_8086_71a2[] = "440GX - 82443GX Host bridge (AGP disabled)"; +static const char pci_device_8086_7600[] = "82372FB PIIX5 ISA"; +static const char pci_device_8086_7601[] = "82372FB PIIX5 IDE"; +static const char pci_device_8086_7602[] = "82372FB PIIX5 USB"; +static const char pci_device_8086_7603[] = "82372FB PIIX5 SMBus"; +static const char pci_device_8086_7800[] = "i740"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_003d_0008[] = "Starfighter AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_003d_000b[] = "Starfighter AGP"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_1092_0100[] = "Stealth II G460"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_10b4_201a[] = "Lightspeed 740"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_10b4_202f[] = "Lightspeed 740"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_8086_0000[] = "Terminator 2x/i"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_7800_8086_0100[] = "Intel740 Graphics Accelerator"; +#endif +static const char pci_device_8086_84c4[] = "450KX/GX [Orion] - 82454KX/GX PCI bridge"; +static const char pci_device_8086_84c5[] = "450KX/GX [Orion] - 82453KX/GX Memory controller"; +static const char pci_device_8086_84ca[] = "450NX - 82451NX Memory & I/O Controller"; +static const char pci_device_8086_84cb[] = "450NX - 82454NX/84460GX PCI Expander Bridge"; +static const char pci_device_8086_84e0[] = "460GX - 84460GX System Address Controller (SAC)"; +static const char pci_device_8086_84e1[] = "460GX - 84460GX System Data Controller (SDC)"; +static const char pci_device_8086_84e2[] = "460GX - 84460GX AGP Bridge (GXB function 2)"; +static const char pci_device_8086_84e3[] = "460GX - 84460GX Memory Address Controller (MAC)"; +static const char pci_device_8086_84e4[] = "460GX - 84460GX Memory Data Controller (MDC)"; +static const char pci_device_8086_84e6[] = "460GX - 82466GX Wide and fast PCI eXpander Bridge (WXB)"; +static const char pci_device_8086_84ea[] = "460GX - 84460GX AGP Bridge (GXB function 1)"; +static const char pci_device_8086_9621[] = "Integrated RAID"; +static const char pci_device_8086_9622[] = "Integrated RAID"; +static const char pci_device_8086_9641[] = "Integrated RAID"; +static const char pci_device_8086_96a1[] = "Integrated RAID"; +static const char pci_device_8086_b152[] = "21152 PCI-to-PCI Bridge"; +static const char pci_device_8086_b154[] = "21154 PCI-to-PCI Bridge"; +static const char pci_device_8086_b555[] = "21555 Non transparent PCI-to-PCI Bridge"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_8086_b555_e4bf_1000[] = "CC8-1-BLUES"; +#endif +static const char pci_device_8086_ffff[] = "450NX/GX [Orion] - 82453KX/GX Memory controller [BUG]"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_8800[] = "Trigem Computer Inc."; +static const char pci_device_8800_2008[] = "Video assistent component"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_8866[] = "T-Square Design Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_8888[] = "Silicon Magic"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_8e0e[] = "Computone Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_8e2e[] = "KTI"; +static const char pci_device_8e2e_3000[] = "ET32P2"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_9004[] = "Adaptec"; +static const char pci_device_9004_1078[] = "AIC-7810"; +static const char pci_device_9004_1160[] = "AIC-1160 [Family Fibre Channel Adapter]"; +static const char pci_device_9004_2178[] = "AIC-7821"; +static const char pci_device_9004_3860[] = "AHA-2930CU"; +static const char pci_device_9004_3b78[] = "AHA-4844W/4844UW"; +static const char pci_device_9004_5075[] = "AIC-755x"; +static const char pci_device_9004_5078[] = "AHA-7850"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_5078_9004_7850[] = "AHA-2904/Integrated AIC-7850"; +#endif +static const char pci_device_9004_5175[] = "AIC-755x"; +static const char pci_device_9004_5178[] = "AIC-7851"; +static const char pci_device_9004_5275[] = "AIC-755x"; +static const char pci_device_9004_5278[] = "AIC-7852"; +static const char pci_device_9004_5375[] = "AIC-755x"; +static const char pci_device_9004_5378[] = "AIC-7850"; +static const char pci_device_9004_5475[] = "AIC-755x"; +static const char pci_device_9004_5478[] = "AIC-7850"; +static const char pci_device_9004_5575[] = "AVA-2930"; +static const char pci_device_9004_5578[] = "AIC-7855"; +static const char pci_device_9004_5647[] = "ANA-7711 TCP Offload Engine"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_5647_9004_7710[] = "ANA-7711F TCP Offload Engine - Optical"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_5647_9004_7711[] = "ANA-7711LP TCP Offload Engine - Copper"; +#endif +static const char pci_device_9004_5675[] = "AIC-755x"; +static const char pci_device_9004_5678[] = "AIC-7856"; +static const char pci_device_9004_5775[] = "AIC-755x"; +static const char pci_device_9004_5778[] = "AIC-7850"; +static const char pci_device_9004_5800[] = "AIC-5800"; +static const char pci_device_9004_5900[] = "ANA-5910/5930/5940 ATM155 & 25 LAN Adapter"; +static const char pci_device_9004_5905[] = "ANA-5910A/5930A/5940A ATM Adapter"; +static const char pci_device_9004_6038[] = "AIC-3860"; +static const char pci_device_9004_6075[] = "AIC-1480 / APA-1480"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6075_9004_7560[] = "AIC-1480 / APA-1480 Cardbus"; +#endif +static const char pci_device_9004_6078[] = "AIC-7860"; +static const char pci_device_9004_6178[] = "AIC-7861"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6178_9004_7861[] = "AHA-2940AU Single"; +#endif +static const char pci_device_9004_6278[] = "AIC-7860"; +static const char pci_device_9004_6378[] = "AIC-7860"; +static const char pci_device_9004_6478[] = "AIC-786x"; +static const char pci_device_9004_6578[] = "AIC-786x"; +static const char pci_device_9004_6678[] = "AIC-786x"; +static const char pci_device_9004_6778[] = "AIC-786x"; +static const char pci_device_9004_6915[] = "ANA620xx/ANA69011A"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0008[] = "ANA69011A/TX 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0009[] = "ANA69011A/TX 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0010[] = "ANA62022 2-port 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0018[] = "ANA62044 4-port 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0019[] = "ANA62044 4-port 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0020[] = "ANA62022 2-port 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_0028[] = "ANA69011A/TX 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8008[] = "ANA69011A/TX 64 bit 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8009[] = "ANA69011A/TX 64 bit 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8010[] = "ANA62022 2-port 64 bit 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8018[] = "ANA62044 4-port 64 bit 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8019[] = "ANA62044 4-port 64 bit 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8020[] = "ANA62022 2-port 64 bit 10/100"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_6915_9004_8028[] = "ANA69011A/TX 64 bit 10/100"; +#endif +static const char pci_device_9004_7078[] = "AHA-294x / AIC-7870"; +static const char pci_device_9004_7178[] = "AHA-2940/2940W / AIC-7871"; +static const char pci_device_9004_7278[] = "AHA-3940/3940W / AIC-7872"; +static const char pci_device_9004_7378[] = "AHA-3985 / AIC-7873"; +static const char pci_device_9004_7478[] = "AHA-2944/2944W / AIC-7874"; +static const char pci_device_9004_7578[] = "AHA-3944/3944W / AIC-7875"; +static const char pci_device_9004_7678[] = "AHA-4944W/UW / AIC-7876"; +static const char pci_device_9004_7778[] = "AIC-787x"; +static const char pci_device_9004_7810[] = "AIC-7810"; +static const char pci_device_9004_7815[] = "AIC-7815 RAID+Memory Controller IC"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7815_9004_7815[] = "ARO-1130U2 RAID Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7815_9004_7840[] = "AIC-7815 RAID+Memory Controller IC"; +#endif +static const char pci_device_9004_7850[] = "AIC-7850"; +static const char pci_device_9004_7855[] = "AHA-2930"; +static const char pci_device_9004_7860[] = "AIC-7860"; +static const char pci_device_9004_7870[] = "AIC-7870"; +static const char pci_device_9004_7871[] = "AHA-2940"; +static const char pci_device_9004_7872[] = "AHA-3940"; +static const char pci_device_9004_7873[] = "AHA-3980"; +static const char pci_device_9004_7874[] = "AHA-2944"; +static const char pci_device_9004_7880[] = "AIC-7880P"; +static const char pci_device_9004_7890[] = "AIC-7890"; +static const char pci_device_9004_7891[] = "AIC-789x"; +static const char pci_device_9004_7892[] = "AIC-789x"; +static const char pci_device_9004_7893[] = "AIC-789x"; +static const char pci_device_9004_7894[] = "AIC-789x"; +static const char pci_device_9004_7895[] = "AHA-2940U/UW / AHA-39xx / AIC-7895"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7890[] = "AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7891[] = "AHA-2940U/2940UW Dual"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7892[] = "AHA-3940AU/AUW/AUWD/UWD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7894[] = "AHA-3944AUWD"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7895[] = "AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7896[] = "AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_7895_9004_7897[] = "AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B"; +#endif +static const char pci_device_9004_7896[] = "AIC-789x"; +static const char pci_device_9004_7897[] = "AIC-789x"; +static const char pci_device_9004_8078[] = "AIC-7880U"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_8078_9004_7880[] = "AIC-7880P Ultra/Ultra Wide SCSI Chipset"; +#endif +static const char pci_device_9004_8178[] = "AHA-2940U/UW/D / AIC-7881U"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_8178_9004_7881[] = "AHA-2940UW SCSI Host Adapter"; +#endif +static const char pci_device_9004_8278[] = "AHA-3940U/UW/UWD / AIC-7882U"; +static const char pci_device_9004_8378[] = "AHA-3940U/UW / AIC-7883U"; +static const char pci_device_9004_8478[] = "AHA-2944UW / AIC-7884U"; +static const char pci_device_9004_8578[] = "AHA-3944U/UWD / AIC-7885"; +static const char pci_device_9004_8678[] = "AHA-4944UW / AIC-7886"; +static const char pci_device_9004_8778[] = "AHA-2940UW Pro / AIC-788x"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_8778_9004_7887[] = "2940UW Pro Ultra-Wide SCSI Controller"; +#endif +static const char pci_device_9004_8878[] = "AHA-2930UW / AIC-7888"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9004_8878_9004_7888[] = "AHA-2930UW SCSI Controller"; +#endif +static const char pci_device_9004_8b78[] = "ABA-1030"; +static const char pci_device_9004_ec78[] = "AHA-4944W/UW"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_9005[] = "Adaptec"; +static const char pci_device_9005_0010[] = "AHA-2940U2/U2W"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0010_9005_2180[] = "AHA-2940U2 SCSI Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0010_9005_8100[] = "AHA-2940U2B SCSI Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0010_9005_a180[] = "AHA-2940U2W SCSI Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0010_9005_e100[] = "AHA-2950U2B SCSI Controller"; +#endif +static const char pci_device_9005_0011[] = "AHA-2930U2"; +static const char pci_device_9005_0013[] = "78902"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0013_9005_0003[] = "AAA-131U2 Array1000 1 Channel RAID Controller"; +#endif +static const char pci_device_9005_001f[] = "AHA-2940U2/U2W / 7890/7891"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_001f_9005_000f[] = "2940U2W SCSI Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_001f_9005_a180[] = "2940U2W SCSI Controller"; +#endif +static const char pci_device_9005_0020[] = "AIC-7890"; +static const char pci_device_9005_002f[] = "AIC-7890"; +static const char pci_device_9005_0030[] = "AIC-7890"; +static const char pci_device_9005_003f[] = "AIC-7890"; +static const char pci_device_9005_0050[] = "AHA-3940U2x/395U2x"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0050_9005_f500[] = "AHA-3950U2B"; +#endif +static const char pci_device_9005_0051[] = "AHA-3950U2D"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0051_9005_b500[] = "AHA-3950U2D"; +#endif +static const char pci_device_9005_0053[] = "AIC-7896 SCSI Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0053_9005_ffff[] = "AIC-7896 SCSI Controller mainboard implementation"; +#endif +static const char pci_device_9005_005f[] = "AIC-7896U2/7897U2"; +static const char pci_device_9005_0080[] = "AIC-7892A U160/m"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0080_0e11_e2a0[] = "Compaq 64-Bit/66MHz Wide Ultra3 SCSI Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0080_9005_62a0[] = "29160N Ultra160 SCSI Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0080_9005_e220[] = "29160LP Low Profile Ultra160 SCSI Controller"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0080_9005_e2a0[] = "29160 Ultra160 SCSI Controller"; +#endif +static const char pci_device_9005_0081[] = "AIC-7892B U160/m"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0081_9005_62a1[] = "19160 Ultra160 SCSI Controller"; +#endif +static const char pci_device_9005_0083[] = "AIC-7892D U160/m"; +static const char pci_device_9005_008f[] = "AIC-7892P U160/m"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_008f_1179_0001[] = "Magnia Z310"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_008f_15d9_9005[] = "Onboard SCSI Host Adapter"; +#endif +static const char pci_device_9005_00c0[] = "AHA-3960D / AIC-7899A U160/m"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_00c0_0e11_f620[] = "Compaq 64-Bit/66MHz Dual Channel Wide Ultra3 SCSI Adapter"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_00c0_9005_f620[] = "AHA-3960D U160/m"; +#endif +static const char pci_device_9005_00c1[] = "AIC-7899B U160/m"; +static const char pci_device_9005_00c3[] = "AIC-7899D U160/m"; +static const char pci_device_9005_00c5[] = "RAID subsystem HBA"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_00c5_1028_00c5[] = "PowerEdge 2550"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_9005_00cf[] = "AIC-7899P U160/m"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_00cf_1028_00d1[] = "PowerEdge 2550"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_00cf_10f1_2462[] = "Thunder K7 S2462"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_00cf_15d9_9005[] = "Onboard SCSI Host Adapter"; +#endif +static const char pci_device_9005_0250[] = "ServeRAID Controller"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0250_1014_0279[] = "ServeRAID-xx"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0250_1014_028c[] = "ServeRAID-xx"; +#endif +static const char pci_device_9005_0285[] = "AAC-RAID"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_0285_1028_0287[] = "PowerEdge Expandable RAID Controller 320/DC"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_device_9005_8000[] = "ASC-29320A U320"; +static const char pci_device_9005_800f[] = "AIC-7901 U320"; +static const char pci_device_9005_8010[] = "ASC-39320 U320"; +static const char pci_device_9005_8011[] = "ASC-32320D U320"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_8011_0e11_00ac[] = "U320"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_9005_8011_9005_0041[] = "ASC-39320D U320"; +#endif +static const char pci_device_9005_8012[] = "ASC-29320 U320"; +static const char pci_device_9005_8013[] = "ASC-29320B U320"; +static const char pci_device_9005_8014[] = "ASC-29320LP U320"; +static const char pci_device_9005_801e[] = "AIC-7901A U320"; +static const char pci_device_9005_801f[] = "AIC-7902 U320"; +static const char pci_device_9005_8090[] = "ASC-39320 U320 w/HostRAID"; +static const char pci_device_9005_8091[] = "ASC-39320D U320 w/HostRAID"; +static const char pci_device_9005_8092[] = "ASC-29320 U320 w/HostRAID"; +static const char pci_device_9005_8093[] = "ASC-29320B U320 w/HostRAID"; +static const char pci_device_9005_8094[] = "ASC-29320LP U320 w/HostRAID"; +static const char pci_device_9005_809e[] = "AIC-7901A U320 w/HostRAID"; +static const char pci_device_9005_809f[] = "AIC-7902 U320 w/HostRAID"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_907f[] = "Atronics"; +static const char pci_device_907f_2015[] = "IDE-2015PL"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_919a[] = "Gigapixel Corp"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_9412[] = "Holtek"; +static const char pci_device_9412_6565[] = "6565"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_9699[] = "Omni Media Technology Inc"; +static const char pci_device_9699_6565[] = "6565"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_9710[] = "NetMos Technology"; +static const char pci_device_9710_9815[] = "VScom 021H-EP2 2 port parallel adaptor"; +static const char pci_device_9710_9835[] = "222N-2 I/O Card (2S+1P)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a0a0[] = "AOPEN Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a0f1[] = "UNISYS Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a200[] = "NEC Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a259[] = "Hewlett Packard"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a25b[] = "Hewlett Packard GmbH PL24-MKT"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a304[] = "Sony"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_a727[] = "3Com Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_aa42[] = "Scitex Digital Video"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ac1e[] = "Digital Receiver Technology Inc"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_b1b3[] = "Shiva Europe Limited"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_bd11[] = "Pinnacle Systems, Inc. (Wrong ID)"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_c001[] = "TSI Telsys"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_c0a9[] = "Micron/Crucial Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_c0de[] = "Motorola"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_c0fe[] = "Motion Engineering, Inc."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ca50[] = "Varian Australia Pty Ltd"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_cafe[] = "Chrysalis-ITS"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_cccc[] = "Catapult Communications"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_cddd[] = "Tyzx, Inc."; +static const char pci_device_cddd_0101[] = "DeepSea 1 High Speed Stereo Vision Frame Grabber"; +static const char pci_device_cddd_0200[] = "DeepSea 2 High Speed Stereo Vision Frame Grabber"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_d4d4[] = "Dy4 Systems Inc"; +static const char pci_device_d4d4_0601[] = "PCI Mezzanine Card"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_d531[] = "I+ME ACTIA GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_d84d[] = "Exsys"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_dead[] = "Indigita Corporation"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_e000[] = "Winbond"; +static const char pci_device_e000_e000[] = "W89C940"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_e159[] = "Tiger Jet Network Inc."; +static const char pci_device_e159_0001[] = "Intel 537"; +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_e159_0001_0059_0001[] = "128k ISDN-S/T Adapter"; +#endif +#ifdef INIT_SUBSYS_INFO +static const char pci_subsys_e159_0001_0059_0003[] = "128k ISDN-U Adapter"; +#endif +static const char pci_device_e159_0002[] = "Tiger100APC ISDN chipset"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_e4bf[] = "EKF Elektronik GmbH"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ea01[] = "Eagle Technology"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ea60[] = "RME"; +static const char pci_device_ea60_9896[] = "Digi32"; +static const char pci_device_ea60_9897[] = "Digi32 Pro"; +static const char pci_device_ea60_9898[] = "Digi32/8"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_eabb[] = "Aashima Technology B.V."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_eace[] = "Endace Measurement Systems, Ltd"; +static const char pci_device_eace_3100[] = "DAG 3.10 OC-3/OC-12"; +static const char pci_device_eace_3200[] = "DAG 3.2x OC-3/OC-12"; +static const char pci_device_eace_320e[] = "DAG 3.2E Fast Ethernet"; +static const char pci_device_eace_340e[] = "DAG 3.4E Fast Ethernet"; +static const char pci_device_eace_341e[] = "DAG 3.41E Fast Ethernet"; +static const char pci_device_eace_3500[] = "DAG 3.5 OC-3/OC-12"; +static const char pci_device_eace_351c[] = "DAG 3.5ECM Fast Ethernet"; +static const char pci_device_eace_4100[] = "DAG 4.10 OC-48"; +static const char pci_device_eace_4110[] = "DAG 4.11 OC-48"; +static const char pci_device_eace_4220[] = "DAG 4.2 OC-48"; +static const char pci_device_eace_422e[] = "DAG 4.2E Dual Gigabit Ethernet"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ec80[] = "Belkin Corporation"; +static const char pci_device_ec80_ec00[] = "F5D6000"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ecc0[] = "Echo Digital Audio Corporation"; +static const char pci_device_ecc0_0050[] = "Gina24_301"; +static const char pci_device_ecc0_0051[] = "Gina24_361"; +static const char pci_device_ecc0_0060[] = "Layla24"; +static const char pci_device_ecc0_0070[] = "Mona_301_80"; +static const char pci_device_ecc0_0071[] = "Mona_301_66"; +static const char pci_device_ecc0_0072[] = "Mona_361"; +static const char pci_device_ecc0_0080[] = "Mia"; +#endif +static const char pci_vendor_edd8[] = "ARK Logic Inc"; +static const char pci_device_edd8_a091[] = "1000PV [Stingray]"; +static const char pci_device_edd8_a099[] = "2000PV [Stingray]"; +static const char pci_device_edd8_a0a1[] = "2000MT"; +static const char pci_device_edd8_a0a9[] = "2000MI"; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_f1d0[] = "AJA Video"; +static const char pci_device_f1d0_cafe[] = "KONA SD SMPTE 259M I/O"; +static const char pci_device_f1d0_efac[] = "KONA SD SMPTE 259M I/O"; +static const char pci_device_f1d0_facd[] = "KONA HD SMPTE 292M I/O"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_fa57[] = "Fast Search & Transfer ASA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_febd[] = "Ultraview Corp."; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_feda[] = "Broadcom Inc (nee Epigram)"; +static const char pci_device_feda_a0fa[] = "BCM4210 iLine10 HomePNA 2.0"; +static const char pci_device_feda_a10e[] = "BCM4230 iLine10 HomePNA 2.0"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_fffe[] = "VMWare Inc"; +static const char pci_device_fffe_0710[] = "Virtual SVGA"; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const char pci_vendor_ffff[] = "Illegal Vendor ID"; +#endif +#ifdef INIT_SUBSYS_INFO +static const pciSubsystemInfo pci_ss_info_0e11_a0f7_8086_002a = + {0x8086, 0x002a, pci_subsys_0e11_a0f7_8086_002a, 0}; +#undef pci_ss_info_8086_002a +#define pci_ss_info_8086_002a pci_ss_info_0e11_a0f7_8086_002a +static const pciSubsystemInfo pci_ss_info_0e11_a0f7_8086_002b = + {0x8086, 0x002b, pci_subsys_0e11_a0f7_8086_002b, 0}; +#undef pci_ss_info_8086_002b +#define pci_ss_info_8086_002b pci_ss_info_0e11_a0f7_8086_002b +static const pciSubsystemInfo pci_ss_info_0e11_ae10_0e11_4030 = + {0x0e11, 0x4030, pci_subsys_0e11_ae10_0e11_4030, 0}; +#undef pci_ss_info_0e11_4030 +#define pci_ss_info_0e11_4030 pci_ss_info_0e11_ae10_0e11_4030 +static const pciSubsystemInfo pci_ss_info_0e11_ae10_0e11_4031 = + {0x0e11, 0x4031, pci_subsys_0e11_ae10_0e11_4031, 0}; +#undef pci_ss_info_0e11_4031 +#define pci_ss_info_0e11_4031 pci_ss_info_0e11_ae10_0e11_4031 +static const pciSubsystemInfo pci_ss_info_0e11_ae10_0e11_4032 = + {0x0e11, 0x4032, pci_subsys_0e11_ae10_0e11_4032, 0}; +#undef pci_ss_info_0e11_4032 +#define pci_ss_info_0e11_4032 pci_ss_info_0e11_ae10_0e11_4032 +static const pciSubsystemInfo pci_ss_info_0e11_ae10_0e11_4033 = + {0x0e11, 0x4033, pci_subsys_0e11_ae10_0e11_4033, 0}; +#undef pci_ss_info_0e11_4033 +#define pci_ss_info_0e11_4033 pci_ss_info_0e11_ae10_0e11_4033 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1000_0001_1000_1000 = + {0x1000, 0x1000, pci_subsys_1000_0001_1000_1000, 0}; +#undef pci_ss_info_1000_1000 +#define pci_ss_info_1000_1000 pci_ss_info_1000_0001_1000_1000 +static const pciSubsystemInfo pci_ss_info_1000_000c_1de1_3907 = + {0x1de1, 0x3907, pci_subsys_1000_000c_1de1_3907, 0}; +#undef pci_ss_info_1de1_3907 +#define pci_ss_info_1de1_3907 pci_ss_info_1000_000c_1de1_3907 +#endif +static const pciSubsystemInfo pci_ss_info_1000_000f_0e11_7004 = + {0x0e11, 0x7004, pci_subsys_1000_000f_0e11_7004, 0}; +#undef pci_ss_info_0e11_7004 +#define pci_ss_info_0e11_7004 pci_ss_info_1000_000f_0e11_7004 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1000_000f_1092_8760 = + {0x1092, 0x8760, pci_subsys_1000_000f_1092_8760, 0}; +#undef pci_ss_info_1092_8760 +#define pci_ss_info_1092_8760 pci_ss_info_1000_000f_1092_8760 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1000_000f_1de1_3904 = + {0x1de1, 0x3904, pci_subsys_1000_000f_1de1_3904, 0}; +#undef pci_ss_info_1de1_3904 +#define pci_ss_info_1de1_3904 pci_ss_info_1000_000f_1de1_3904 +#endif +static const pciSubsystemInfo pci_ss_info_1000_0010_0e11_4040 = + {0x0e11, 0x4040, pci_subsys_1000_0010_0e11_4040, 0}; +#undef pci_ss_info_0e11_4040 +#define pci_ss_info_0e11_4040 pci_ss_info_1000_0010_0e11_4040 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1000_0010_0e11_4048 = + {0x0e11, 0x4048, pci_subsys_1000_0010_0e11_4048, 0}; +#undef pci_ss_info_0e11_4048 +#define pci_ss_info_0e11_4048 pci_ss_info_1000_0010_0e11_4048 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1000_0020_1de1_1020 = + {0x1de1, 0x1020, pci_subsys_1000_0020_1de1_1020, 0}; +#undef pci_ss_info_1de1_1020 +#define pci_ss_info_1de1_1020 pci_ss_info_1000_0020_1de1_1020 +#endif +static const pciSubsystemInfo pci_ss_info_1000_0030_1028_1010 = + {0x1028, 0x1010, pci_subsys_1000_0030_1028_1010, 0}; +#undef pci_ss_info_1028_1010 +#define pci_ss_info_1028_1010 pci_ss_info_1000_0030_1028_1010 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1000_008f_1092_8000 = + {0x1092, 0x8000, pci_subsys_1000_008f_1092_8000, 0}; +#undef pci_ss_info_1092_8000 +#define pci_ss_info_1092_8000 pci_ss_info_1000_008f_1092_8000 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1000_008f_1092_8760 = + {0x1092, 0x8760, pci_subsys_1000_008f_1092_8760, 0}; +#undef pci_ss_info_1092_8760 +#define pci_ss_info_1092_8760 pci_ss_info_1000_008f_1092_8760 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1000_0702_1318_0000 = + {0x1318, 0x0000, pci_subsys_1000_0702_1318_0000, 0}; +#undef pci_ss_info_1318_0000 +#define pci_ss_info_1318_0000 pci_ss_info_1000_0702_1318_0000 +#endif +static const pciSubsystemInfo pci_ss_info_1000_1960_1028_0518 = + {0x1028, 0x0518, pci_subsys_1000_1960_1028_0518, 0}; +#undef pci_ss_info_1028_0518 +#define pci_ss_info_1028_0518 pci_ss_info_1000_1960_1028_0518 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1000_1960_1028_0520 = + {0x1028, 0x0520, pci_subsys_1000_1960_1028_0520, 0}; +#undef pci_ss_info_1028_0520 +#define pci_ss_info_1028_0520 pci_ss_info_1000_1960_1028_0520 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1000_1960_1028_0531 = + {0x1028, 0x0531, pci_subsys_1000_1960_1028_0531, 0}; +#undef pci_ss_info_1028_0531 +#define pci_ss_info_1028_0531 pci_ss_info_1000_1960_1028_0531 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1002_4242_1002_02aa = + {0x1002, 0x02aa, pci_subsys_1002_4242_1002_02aa, 0}; +#undef pci_ss_info_1002_02aa +#define pci_ss_info_1002_02aa pci_ss_info_1002_4242_1002_02aa +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0040 = + {0x1002, 0x0040, pci_subsys_1002_4742_1002_0040, 0}; +#undef pci_ss_info_1002_0040 +#define pci_ss_info_1002_0040 pci_ss_info_1002_4742_1002_0040 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0044 = + {0x1002, 0x0044, pci_subsys_1002_4742_1002_0044, 0}; +#undef pci_ss_info_1002_0044 +#define pci_ss_info_1002_0044 pci_ss_info_1002_4742_1002_0044 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0061 = + {0x1002, 0x0061, pci_subsys_1002_4742_1002_0061, 0}; +#undef pci_ss_info_1002_0061 +#define pci_ss_info_1002_0061 pci_ss_info_1002_4742_1002_0061 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0062 = + {0x1002, 0x0062, pci_subsys_1002_4742_1002_0062, 0}; +#undef pci_ss_info_1002_0062 +#define pci_ss_info_1002_0062 pci_ss_info_1002_4742_1002_0062 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0063 = + {0x1002, 0x0063, pci_subsys_1002_4742_1002_0063, 0}; +#undef pci_ss_info_1002_0063 +#define pci_ss_info_1002_0063 pci_ss_info_1002_4742_1002_0063 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0080 = + {0x1002, 0x0080, pci_subsys_1002_4742_1002_0080, 0}; +#undef pci_ss_info_1002_0080 +#define pci_ss_info_1002_0080 pci_ss_info_1002_4742_1002_0080 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_0084 = + {0x1002, 0x0084, pci_subsys_1002_4742_1002_0084, 0}; +#undef pci_ss_info_1002_0084 +#define pci_ss_info_1002_0084 pci_ss_info_1002_4742_1002_0084 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_4742 = + {0x1002, 0x4742, pci_subsys_1002_4742_1002_4742, 0}; +#undef pci_ss_info_1002_4742 +#define pci_ss_info_1002_4742 pci_ss_info_1002_4742_1002_4742 +static const pciSubsystemInfo pci_ss_info_1002_4742_1002_8001 = + {0x1002, 0x8001, pci_subsys_1002_4742_1002_8001, 0}; +#undef pci_ss_info_1002_8001 +#define pci_ss_info_1002_8001 pci_ss_info_1002_4742_1002_8001 +static const pciSubsystemInfo pci_ss_info_1002_4742_1028_0082 = + {0x1028, 0x0082, pci_subsys_1002_4742_1028_0082, 0}; +#undef pci_ss_info_1028_0082 +#define pci_ss_info_1028_0082 pci_ss_info_1002_4742_1028_0082 +static const pciSubsystemInfo pci_ss_info_1002_4742_1028_4082 = + {0x1028, 0x4082, pci_subsys_1002_4742_1028_4082, 0}; +#undef pci_ss_info_1028_4082 +#define pci_ss_info_1028_4082 pci_ss_info_1002_4742_1028_4082 +static const pciSubsystemInfo pci_ss_info_1002_4742_1028_8082 = + {0x1028, 0x8082, pci_subsys_1002_4742_1028_8082, 0}; +#undef pci_ss_info_1028_8082 +#define pci_ss_info_1028_8082 pci_ss_info_1002_4742_1028_8082 +static const pciSubsystemInfo pci_ss_info_1002_4742_1028_c082 = + {0x1028, 0xc082, pci_subsys_1002_4742_1028_c082, 0}; +#undef pci_ss_info_1028_c082 +#define pci_ss_info_1028_c082 pci_ss_info_1002_4742_1028_c082 +static const pciSubsystemInfo pci_ss_info_1002_4742_8086_4152 = + {0x8086, 0x4152, pci_subsys_1002_4742_8086_4152, 0}; +#undef pci_ss_info_8086_4152 +#define pci_ss_info_8086_4152 pci_ss_info_1002_4742_8086_4152 +static const pciSubsystemInfo pci_ss_info_1002_4742_8086_464a = + {0x8086, 0x464a, pci_subsys_1002_4742_8086_464a, 0}; +#undef pci_ss_info_8086_464a +#define pci_ss_info_8086_464a pci_ss_info_1002_4742_8086_464a +static const pciSubsystemInfo pci_ss_info_1002_4744_1002_4744 = + {0x1002, 0x4744, pci_subsys_1002_4744_1002_4744, 0}; +#undef pci_ss_info_1002_4744 +#define pci_ss_info_1002_4744 pci_ss_info_1002_4744_1002_4744 +static const pciSubsystemInfo pci_ss_info_1002_4749_1002_0061 = + {0x1002, 0x0061, pci_subsys_1002_4749_1002_0061, 0}; +#undef pci_ss_info_1002_0061 +#define pci_ss_info_1002_0061 pci_ss_info_1002_4749_1002_0061 +static const pciSubsystemInfo pci_ss_info_1002_4749_1002_0062 = + {0x1002, 0x0062, pci_subsys_1002_4749_1002_0062, 0}; +#undef pci_ss_info_1002_0062 +#define pci_ss_info_1002_0062 pci_ss_info_1002_4749_1002_0062 +static const pciSubsystemInfo pci_ss_info_1002_474d_1002_0004 = + {0x1002, 0x0004, pci_subsys_1002_474d_1002_0004, 0}; +#undef pci_ss_info_1002_0004 +#define pci_ss_info_1002_0004 pci_ss_info_1002_474d_1002_0004 +static const pciSubsystemInfo pci_ss_info_1002_474d_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_474d_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_474d_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_474d_1002_0080 = + {0x1002, 0x0080, pci_subsys_1002_474d_1002_0080, 0}; +#undef pci_ss_info_1002_0080 +#define pci_ss_info_1002_0080 pci_ss_info_1002_474d_1002_0080 +static const pciSubsystemInfo pci_ss_info_1002_474d_1002_0084 = + {0x1002, 0x0084, pci_subsys_1002_474d_1002_0084, 0}; +#undef pci_ss_info_1002_0084 +#define pci_ss_info_1002_0084 pci_ss_info_1002_474d_1002_0084 +static const pciSubsystemInfo pci_ss_info_1002_474d_1002_474d = + {0x1002, 0x474d, pci_subsys_1002_474d_1002_474d, 0}; +#undef pci_ss_info_1002_474d +#define pci_ss_info_1002_474d pci_ss_info_1002_474d_1002_474d +static const pciSubsystemInfo pci_ss_info_1002_474d_1033_806a = + {0x1033, 0x806a, pci_subsys_1002_474d_1033_806a, 0}; +#undef pci_ss_info_1033_806a +#define pci_ss_info_1033_806a pci_ss_info_1002_474d_1033_806a +static const pciSubsystemInfo pci_ss_info_1002_474e_1002_474e = + {0x1002, 0x474e, pci_subsys_1002_474e_1002_474e, 0}; +#undef pci_ss_info_1002_474e +#define pci_ss_info_1002_474e pci_ss_info_1002_474e_1002_474e +static const pciSubsystemInfo pci_ss_info_1002_474f_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_474f_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_474f_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_474f_1002_474f = + {0x1002, 0x474f, pci_subsys_1002_474f_1002_474f, 0}; +#undef pci_ss_info_1002_474f +#define pci_ss_info_1002_474f pci_ss_info_1002_474f_1002_474f +static const pciSubsystemInfo pci_ss_info_1002_4750_1002_0040 = + {0x1002, 0x0040, pci_subsys_1002_4750_1002_0040, 0}; +#undef pci_ss_info_1002_0040 +#define pci_ss_info_1002_0040 pci_ss_info_1002_4750_1002_0040 +static const pciSubsystemInfo pci_ss_info_1002_4750_1002_0044 = + {0x1002, 0x0044, pci_subsys_1002_4750_1002_0044, 0}; +#undef pci_ss_info_1002_0044 +#define pci_ss_info_1002_0044 pci_ss_info_1002_4750_1002_0044 +static const pciSubsystemInfo pci_ss_info_1002_4750_1002_0080 = + {0x1002, 0x0080, pci_subsys_1002_4750_1002_0080, 0}; +#undef pci_ss_info_1002_0080 +#define pci_ss_info_1002_0080 pci_ss_info_1002_4750_1002_0080 +static const pciSubsystemInfo pci_ss_info_1002_4750_1002_0084 = + {0x1002, 0x0084, pci_subsys_1002_4750_1002_0084, 0}; +#undef pci_ss_info_1002_0084 +#define pci_ss_info_1002_0084 pci_ss_info_1002_4750_1002_0084 +static const pciSubsystemInfo pci_ss_info_1002_4750_1002_4750 = + {0x1002, 0x4750, pci_subsys_1002_4750_1002_4750, 0}; +#undef pci_ss_info_1002_4750 +#define pci_ss_info_1002_4750 pci_ss_info_1002_4750_1002_4750 +static const pciSubsystemInfo pci_ss_info_1002_4752_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_4752_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_4752_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_4752_1002_4752 = + {0x1002, 0x4752, pci_subsys_1002_4752_1002_4752, 0}; +#undef pci_ss_info_1002_4752 +#define pci_ss_info_1002_4752 pci_ss_info_1002_4752_1002_4752 +static const pciSubsystemInfo pci_ss_info_1002_4752_1002_8008 = + {0x1002, 0x8008, pci_subsys_1002_4752_1002_8008, 0}; +#undef pci_ss_info_1002_8008 +#define pci_ss_info_1002_8008 pci_ss_info_1002_4752_1002_8008 +static const pciSubsystemInfo pci_ss_info_1002_4752_1028_00d1 = + {0x1028, 0x00d1, pci_subsys_1002_4752_1028_00d1, 0}; +#undef pci_ss_info_1028_00d1 +#define pci_ss_info_1028_00d1 pci_ss_info_1002_4752_1028_00d1 +static const pciSubsystemInfo pci_ss_info_1002_4753_1002_4753 = + {0x1002, 0x4753, pci_subsys_1002_4753_1002_4753, 0}; +#undef pci_ss_info_1002_4753 +#define pci_ss_info_1002_4753 pci_ss_info_1002_4753_1002_4753 +static const pciSubsystemInfo pci_ss_info_1002_4756_1002_4756 = + {0x1002, 0x4756, pci_subsys_1002_4756_1002_4756, 0}; +#undef pci_ss_info_1002_4756 +#define pci_ss_info_1002_4756 pci_ss_info_1002_4756_1002_4756 +static const pciSubsystemInfo pci_ss_info_1002_4757_1002_4757 = + {0x1002, 0x4757, pci_subsys_1002_4757_1002_4757, 0}; +#undef pci_ss_info_1002_4757 +#define pci_ss_info_1002_4757 pci_ss_info_1002_4757_1002_4757 +static const pciSubsystemInfo pci_ss_info_1002_4757_1028_0089 = + {0x1028, 0x0089, pci_subsys_1002_4757_1028_0089, 0}; +#undef pci_ss_info_1028_0089 +#define pci_ss_info_1028_0089 pci_ss_info_1002_4757_1028_0089 +static const pciSubsystemInfo pci_ss_info_1002_4757_1028_4082 = + {0x1028, 0x4082, pci_subsys_1002_4757_1028_4082, 0}; +#undef pci_ss_info_1028_4082 +#define pci_ss_info_1028_4082 pci_ss_info_1002_4757_1028_4082 +static const pciSubsystemInfo pci_ss_info_1002_4757_1028_8082 = + {0x1028, 0x8082, pci_subsys_1002_4757_1028_8082, 0}; +#undef pci_ss_info_1028_8082 +#define pci_ss_info_1028_8082 pci_ss_info_1002_4757_1028_8082 +static const pciSubsystemInfo pci_ss_info_1002_4757_1028_c082 = + {0x1028, 0xc082, pci_subsys_1002_4757_1028_c082, 0}; +#undef pci_ss_info_1028_c082 +#define pci_ss_info_1028_c082 pci_ss_info_1002_4757_1028_c082 +static const pciSubsystemInfo pci_ss_info_1002_475a_1002_0087 = + {0x1002, 0x0087, pci_subsys_1002_475a_1002_0087, 0}; +#undef pci_ss_info_1002_0087 +#define pci_ss_info_1002_0087 pci_ss_info_1002_475a_1002_0087 +static const pciSubsystemInfo pci_ss_info_1002_475a_1002_475a = + {0x1002, 0x475a, pci_subsys_1002_475a_1002_475a, 0}; +#undef pci_ss_info_1002_475a +#define pci_ss_info_1002_475a pci_ss_info_1002_475a_1002_475a +static const pciSubsystemInfo pci_ss_info_1002_4966_10f1_0002 = + {0x10f1, 0x0002, pci_subsys_1002_4966_10f1_0002, 0}; +#undef pci_ss_info_10f1_0002 +#define pci_ss_info_10f1_0002 pci_ss_info_1002_4966_10f1_0002 +static const pciSubsystemInfo pci_ss_info_1002_4966_148c_2039 = + {0x148c, 0x2039, pci_subsys_1002_4966_148c_2039, 0}; +#undef pci_ss_info_148c_2039 +#define pci_ss_info_148c_2039 pci_ss_info_1002_4966_148c_2039 +static const pciSubsystemInfo pci_ss_info_1002_4966_1509_9a00 = + {0x1509, 0x9a00, pci_subsys_1002_4966_1509_9a00, 0}; +#undef pci_ss_info_1509_9a00 +#define pci_ss_info_1509_9a00 pci_ss_info_1002_4966_1509_9a00 +static const pciSubsystemInfo pci_ss_info_1002_4966_1681_0040 = + {0x1681, 0x0040, pci_subsys_1002_4966_1681_0040, 0}; +#undef pci_ss_info_1681_0040 +#define pci_ss_info_1681_0040 pci_ss_info_1002_4966_1681_0040 +static const pciSubsystemInfo pci_ss_info_1002_4966_174b_7176 = + {0x174b, 0x7176, pci_subsys_1002_4966_174b_7176, 0}; +#undef pci_ss_info_174b_7176 +#define pci_ss_info_174b_7176 pci_ss_info_1002_4966_174b_7176 +static const pciSubsystemInfo pci_ss_info_1002_4966_174b_7192 = + {0x174b, 0x7192, pci_subsys_1002_4966_174b_7192, 0}; +#undef pci_ss_info_174b_7192 +#define pci_ss_info_174b_7192 pci_ss_info_1002_4966_174b_7192 +static const pciSubsystemInfo pci_ss_info_1002_4966_17af_2005 = + {0x17af, 0x2005, pci_subsys_1002_4966_17af_2005, 0}; +#undef pci_ss_info_17af_2005 +#define pci_ss_info_17af_2005 pci_ss_info_1002_4966_17af_2005 +static const pciSubsystemInfo pci_ss_info_1002_4966_17af_2006 = + {0x17af, 0x2006, pci_subsys_1002_4966_17af_2006, 0}; +#undef pci_ss_info_17af_2006 +#define pci_ss_info_17af_2006 pci_ss_info_1002_4966_17af_2006 +static const pciSubsystemInfo pci_ss_info_1002_4c42_0e11_b0e8 = + {0x0e11, 0xb0e8, pci_subsys_1002_4c42_0e11_b0e8, 0}; +#undef pci_ss_info_0e11_b0e8 +#define pci_ss_info_0e11_b0e8 pci_ss_info_1002_4c42_0e11_b0e8 +static const pciSubsystemInfo pci_ss_info_1002_4c42_0e11_b10e = + {0x0e11, 0xb10e, pci_subsys_1002_4c42_0e11_b10e, 0}; +#undef pci_ss_info_0e11_b10e +#define pci_ss_info_0e11_b10e pci_ss_info_1002_4c42_0e11_b10e +static const pciSubsystemInfo pci_ss_info_1002_4c42_1002_0040 = + {0x1002, 0x0040, pci_subsys_1002_4c42_1002_0040, 0}; +#undef pci_ss_info_1002_0040 +#define pci_ss_info_1002_0040 pci_ss_info_1002_4c42_1002_0040 +static const pciSubsystemInfo pci_ss_info_1002_4c42_1002_0044 = + {0x1002, 0x0044, pci_subsys_1002_4c42_1002_0044, 0}; +#undef pci_ss_info_1002_0044 +#define pci_ss_info_1002_0044 pci_ss_info_1002_4c42_1002_0044 +static const pciSubsystemInfo pci_ss_info_1002_4c42_1002_4c42 = + {0x1002, 0x4c42, pci_subsys_1002_4c42_1002_4c42, 0}; +#undef pci_ss_info_1002_4c42 +#define pci_ss_info_1002_4c42 pci_ss_info_1002_4c42_1002_4c42 +static const pciSubsystemInfo pci_ss_info_1002_4c42_1002_8001 = + {0x1002, 0x8001, pci_subsys_1002_4c42_1002_8001, 0}; +#undef pci_ss_info_1002_8001 +#define pci_ss_info_1002_8001 pci_ss_info_1002_4c42_1002_8001 +static const pciSubsystemInfo pci_ss_info_1002_4c42_1028_0085 = + {0x1028, 0x0085, pci_subsys_1002_4c42_1028_0085, 0}; +#undef pci_ss_info_1028_0085 +#define pci_ss_info_1028_0085 pci_ss_info_1002_4c42_1028_0085 +static const pciSubsystemInfo pci_ss_info_1002_4c49_1002_0004 = + {0x1002, 0x0004, pci_subsys_1002_4c49_1002_0004, 0}; +#undef pci_ss_info_1002_0004 +#define pci_ss_info_1002_0004 pci_ss_info_1002_4c49_1002_0004 +static const pciSubsystemInfo pci_ss_info_1002_4c49_1002_0040 = + {0x1002, 0x0040, pci_subsys_1002_4c49_1002_0040, 0}; +#undef pci_ss_info_1002_0040 +#define pci_ss_info_1002_0040 pci_ss_info_1002_4c49_1002_0040 +static const pciSubsystemInfo pci_ss_info_1002_4c49_1002_0044 = + {0x1002, 0x0044, pci_subsys_1002_4c49_1002_0044, 0}; +#undef pci_ss_info_1002_0044 +#define pci_ss_info_1002_0044 pci_ss_info_1002_4c49_1002_0044 +static const pciSubsystemInfo pci_ss_info_1002_4c49_1002_4c49 = + {0x1002, 0x4c49, pci_subsys_1002_4c49_1002_4c49, 0}; +#undef pci_ss_info_1002_4c49 +#define pci_ss_info_1002_4c49 pci_ss_info_1002_4c49_1002_4c49 +static const pciSubsystemInfo pci_ss_info_1002_4c4d_0e11_b111 = + {0x0e11, 0xb111, pci_subsys_1002_4c4d_0e11_b111, 0}; +#undef pci_ss_info_0e11_b111 +#define pci_ss_info_0e11_b111 pci_ss_info_1002_4c4d_0e11_b111 +static const pciSubsystemInfo pci_ss_info_1002_4c4d_1002_0084 = + {0x1002, 0x0084, pci_subsys_1002_4c4d_1002_0084, 0}; +#undef pci_ss_info_1002_0084 +#define pci_ss_info_1002_0084 pci_ss_info_1002_4c4d_1002_0084 +static const pciSubsystemInfo pci_ss_info_1002_4c4d_1014_0154 = + {0x1014, 0x0154, pci_subsys_1002_4c4d_1014_0154, 0}; +#undef pci_ss_info_1014_0154 +#define pci_ss_info_1014_0154 pci_ss_info_1002_4c4d_1014_0154 +static const pciSubsystemInfo pci_ss_info_1002_4c50_1002_4c50 = + {0x1002, 0x4c50, pci_subsys_1002_4c50_1002_4c50, 0}; +#undef pci_ss_info_1002_4c50 +#define pci_ss_info_1002_4c50 pci_ss_info_1002_4c50_1002_4c50 +static const pciSubsystemInfo pci_ss_info_1002_4c57_1014_0517 = + {0x1014, 0x0517, pci_subsys_1002_4c57_1014_0517, 0}; +#undef pci_ss_info_1014_0517 +#define pci_ss_info_1014_0517 pci_ss_info_1002_4c57_1014_0517 +static const pciSubsystemInfo pci_ss_info_1002_4c57_1028_00e6 = + {0x1028, 0x00e6, pci_subsys_1002_4c57_1028_00e6, 0}; +#undef pci_ss_info_1028_00e6 +#define pci_ss_info_1028_00e6 pci_ss_info_1002_4c57_1028_00e6 +static const pciSubsystemInfo pci_ss_info_1002_4c57_144d_c006 = + {0x144d, 0xc006, pci_subsys_1002_4c57_144d_c006, 0}; +#undef pci_ss_info_144d_c006 +#define pci_ss_info_144d_c006 pci_ss_info_1002_4c57_144d_c006 +static const pciSubsystemInfo pci_ss_info_1002_4c59_1014_0235 = + {0x1014, 0x0235, pci_subsys_1002_4c59_1014_0235, 0}; +#undef pci_ss_info_1014_0235 +#define pci_ss_info_1014_0235 pci_ss_info_1002_4c59_1014_0235 +static const pciSubsystemInfo pci_ss_info_1002_4c59_1014_0239 = + {0x1014, 0x0239, pci_subsys_1002_4c59_1014_0239, 0}; +#undef pci_ss_info_1014_0239 +#define pci_ss_info_1014_0239 pci_ss_info_1002_4c59_1014_0239 +static const pciSubsystemInfo pci_ss_info_1002_4c59_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_1002_4c59_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_1002_4c59_104d_80e7 +static const pciSubsystemInfo pci_ss_info_1002_5044_1002_0028 = + {0x1002, 0x0028, pci_subsys_1002_5044_1002_0028, 0}; +#undef pci_ss_info_1002_0028 +#define pci_ss_info_1002_0028 pci_ss_info_1002_5044_1002_0028 +static const pciSubsystemInfo pci_ss_info_1002_5044_1002_0029 = + {0x1002, 0x0029, pci_subsys_1002_5044_1002_0029, 0}; +#undef pci_ss_info_1002_0029 +#define pci_ss_info_1002_0029 pci_ss_info_1002_5044_1002_0029 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_0004 = + {0x1002, 0x0004, pci_subsys_1002_5046_1002_0004, 0}; +#undef pci_ss_info_1002_0004 +#define pci_ss_info_1002_0004 pci_ss_info_1002_5046_1002_0004 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_5046_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_5046_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_0014 = + {0x1002, 0x0014, pci_subsys_1002_5046_1002_0014, 0}; +#undef pci_ss_info_1002_0014 +#define pci_ss_info_1002_0014 pci_ss_info_1002_5046_1002_0014 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_0018 = + {0x1002, 0x0018, pci_subsys_1002_5046_1002_0018, 0}; +#undef pci_ss_info_1002_0018 +#define pci_ss_info_1002_0018 pci_ss_info_1002_5046_1002_0018 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_0028 = + {0x1002, 0x0028, pci_subsys_1002_5046_1002_0028, 0}; +#undef pci_ss_info_1002_0028 +#define pci_ss_info_1002_0028 pci_ss_info_1002_5046_1002_0028 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_002a = + {0x1002, 0x002a, pci_subsys_1002_5046_1002_002a, 0}; +#undef pci_ss_info_1002_002a +#define pci_ss_info_1002_002a pci_ss_info_1002_5046_1002_002a +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_0048 = + {0x1002, 0x0048, pci_subsys_1002_5046_1002_0048, 0}; +#undef pci_ss_info_1002_0048 +#define pci_ss_info_1002_0048 pci_ss_info_1002_5046_1002_0048 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_2000 = + {0x1002, 0x2000, pci_subsys_1002_5046_1002_2000, 0}; +#undef pci_ss_info_1002_2000 +#define pci_ss_info_1002_2000 pci_ss_info_1002_5046_1002_2000 +static const pciSubsystemInfo pci_ss_info_1002_5046_1002_2001 = + {0x1002, 0x2001, pci_subsys_1002_5046_1002_2001, 0}; +#undef pci_ss_info_1002_2001 +#define pci_ss_info_1002_2001 pci_ss_info_1002_5046_1002_2001 +static const pciSubsystemInfo pci_ss_info_1002_5050_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_5050_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_5050_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_5144_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_5144_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_0009 = + {0x1002, 0x0009, pci_subsys_1002_5144_1002_0009, 0}; +#undef pci_ss_info_1002_0009 +#define pci_ss_info_1002_0009 pci_ss_info_1002_5144_1002_0009 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_000a = + {0x1002, 0x000a, pci_subsys_1002_5144_1002_000a, 0}; +#undef pci_ss_info_1002_000a +#define pci_ss_info_1002_000a pci_ss_info_1002_5144_1002_000a +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_001a = + {0x1002, 0x001a, pci_subsys_1002_5144_1002_001a, 0}; +#undef pci_ss_info_1002_001a +#define pci_ss_info_1002_001a pci_ss_info_1002_5144_1002_001a +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_0029 = + {0x1002, 0x0029, pci_subsys_1002_5144_1002_0029, 0}; +#undef pci_ss_info_1002_0029 +#define pci_ss_info_1002_0029 pci_ss_info_1002_5144_1002_0029 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_0038 = + {0x1002, 0x0038, pci_subsys_1002_5144_1002_0038, 0}; +#undef pci_ss_info_1002_0038 +#define pci_ss_info_1002_0038 pci_ss_info_1002_5144_1002_0038 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_0039 = + {0x1002, 0x0039, pci_subsys_1002_5144_1002_0039, 0}; +#undef pci_ss_info_1002_0039 +#define pci_ss_info_1002_0039 pci_ss_info_1002_5144_1002_0039 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_008a = + {0x1002, 0x008a, pci_subsys_1002_5144_1002_008a, 0}; +#undef pci_ss_info_1002_008a +#define pci_ss_info_1002_008a pci_ss_info_1002_5144_1002_008a +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_00ba = + {0x1002, 0x00ba, pci_subsys_1002_5144_1002_00ba, 0}; +#undef pci_ss_info_1002_00ba +#define pci_ss_info_1002_00ba pci_ss_info_1002_5144_1002_00ba +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_0139 = + {0x1002, 0x0139, pci_subsys_1002_5144_1002_0139, 0}; +#undef pci_ss_info_1002_0139 +#define pci_ss_info_1002_0139 pci_ss_info_1002_5144_1002_0139 +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_028a = + {0x1002, 0x028a, pci_subsys_1002_5144_1002_028a, 0}; +#undef pci_ss_info_1002_028a +#define pci_ss_info_1002_028a pci_ss_info_1002_5144_1002_028a +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_02aa = + {0x1002, 0x02aa, pci_subsys_1002_5144_1002_02aa, 0}; +#undef pci_ss_info_1002_02aa +#define pci_ss_info_1002_02aa pci_ss_info_1002_5144_1002_02aa +static const pciSubsystemInfo pci_ss_info_1002_5144_1002_053a = + {0x1002, 0x053a, pci_subsys_1002_5144_1002_053a, 0}; +#undef pci_ss_info_1002_053a +#define pci_ss_info_1002_053a pci_ss_info_1002_5144_1002_053a +static const pciSubsystemInfo pci_ss_info_1002_5148_1002_010a = + {0x1002, 0x010a, pci_subsys_1002_5148_1002_010a, 0}; +#undef pci_ss_info_1002_010a +#define pci_ss_info_1002_010a pci_ss_info_1002_5148_1002_010a +static const pciSubsystemInfo pci_ss_info_1002_5148_1002_0152 = + {0x1002, 0x0152, pci_subsys_1002_5148_1002_0152, 0}; +#undef pci_ss_info_1002_0152 +#define pci_ss_info_1002_0152 pci_ss_info_1002_5148_1002_0152 +static const pciSubsystemInfo pci_ss_info_1002_5148_1002_0162 = + {0x1002, 0x0162, pci_subsys_1002_5148_1002_0162, 0}; +#undef pci_ss_info_1002_0162 +#define pci_ss_info_1002_0162 pci_ss_info_1002_5148_1002_0162 +static const pciSubsystemInfo pci_ss_info_1002_5148_1002_0172 = + {0x1002, 0x0172, pci_subsys_1002_5148_1002_0172, 0}; +#undef pci_ss_info_1002_0172 +#define pci_ss_info_1002_0172 pci_ss_info_1002_5148_1002_0172 +static const pciSubsystemInfo pci_ss_info_1002_514c_1002_003a = + {0x1002, 0x003a, pci_subsys_1002_514c_1002_003a, 0}; +#undef pci_ss_info_1002_003a +#define pci_ss_info_1002_003a pci_ss_info_1002_514c_1002_003a +static const pciSubsystemInfo pci_ss_info_1002_514c_1002_013a = + {0x1002, 0x013a, pci_subsys_1002_514c_1002_013a, 0}; +#undef pci_ss_info_1002_013a +#define pci_ss_info_1002_013a pci_ss_info_1002_514c_1002_013a +static const pciSubsystemInfo pci_ss_info_1002_514c_148c_2026 = + {0x148c, 0x2026, pci_subsys_1002_514c_148c_2026, 0}; +#undef pci_ss_info_148c_2026 +#define pci_ss_info_148c_2026 pci_ss_info_1002_514c_148c_2026 +static const pciSubsystemInfo pci_ss_info_1002_514c_174b_7149 = + {0x174b, 0x7149, pci_subsys_1002_514c_174b_7149, 0}; +#undef pci_ss_info_174b_7149 +#define pci_ss_info_174b_7149 pci_ss_info_1002_514c_174b_7149 +static const pciSubsystemInfo pci_ss_info_1002_5157_1002_013a = + {0x1002, 0x013a, pci_subsys_1002_5157_1002_013a, 0}; +#undef pci_ss_info_1002_013a +#define pci_ss_info_1002_013a pci_ss_info_1002_5157_1002_013a +static const pciSubsystemInfo pci_ss_info_1002_5157_1458_4000 = + {0x1458, 0x4000, pci_subsys_1002_5157_1458_4000, 0}; +#undef pci_ss_info_1458_4000 +#define pci_ss_info_1458_4000 pci_ss_info_1002_5157_1458_4000 +static const pciSubsystemInfo pci_ss_info_1002_5157_148c_2024 = + {0x148c, 0x2024, pci_subsys_1002_5157_148c_2024, 0}; +#undef pci_ss_info_148c_2024 +#define pci_ss_info_148c_2024 pci_ss_info_1002_5157_148c_2024 +static const pciSubsystemInfo pci_ss_info_1002_5157_148c_2025 = + {0x148c, 0x2025, pci_subsys_1002_5157_148c_2025, 0}; +#undef pci_ss_info_148c_2025 +#define pci_ss_info_148c_2025 pci_ss_info_1002_5157_148c_2025 +static const pciSubsystemInfo pci_ss_info_1002_5157_148c_2036 = + {0x148c, 0x2036, pci_subsys_1002_5157_148c_2036, 0}; +#undef pci_ss_info_148c_2036 +#define pci_ss_info_148c_2036 pci_ss_info_1002_5157_148c_2036 +static const pciSubsystemInfo pci_ss_info_1002_5157_174b_7147 = + {0x174b, 0x7147, pci_subsys_1002_5157_174b_7147, 0}; +#undef pci_ss_info_174b_7147 +#define pci_ss_info_174b_7147 pci_ss_info_1002_5157_174b_7147 +static const pciSubsystemInfo pci_ss_info_1002_5157_174b_7161 = + {0x174b, 0x7161, pci_subsys_1002_5157_174b_7161, 0}; +#undef pci_ss_info_174b_7161 +#define pci_ss_info_174b_7161 pci_ss_info_1002_5157_174b_7161 +static const pciSubsystemInfo pci_ss_info_1002_5157_17af_0202 = + {0x17af, 0x0202, pci_subsys_1002_5157_17af_0202, 0}; +#undef pci_ss_info_17af_0202 +#define pci_ss_info_17af_0202 pci_ss_info_1002_5157_17af_0202 +static const pciSubsystemInfo pci_ss_info_1002_5159_1002_000a = + {0x1002, 0x000a, pci_subsys_1002_5159_1002_000a, 0}; +#undef pci_ss_info_1002_000a +#define pci_ss_info_1002_000a pci_ss_info_1002_5159_1002_000a +static const pciSubsystemInfo pci_ss_info_1002_5159_1002_000b = + {0x1002, 0x000b, pci_subsys_1002_5159_1002_000b, 0}; +#undef pci_ss_info_1002_000b +#define pci_ss_info_1002_000b pci_ss_info_1002_5159_1002_000b +static const pciSubsystemInfo pci_ss_info_1002_5159_1002_0038 = + {0x1002, 0x0038, pci_subsys_1002_5159_1002_0038, 0}; +#undef pci_ss_info_1002_0038 +#define pci_ss_info_1002_0038 pci_ss_info_1002_5159_1002_0038 +static const pciSubsystemInfo pci_ss_info_1002_5159_1002_003a = + {0x1002, 0x003a, pci_subsys_1002_5159_1002_003a, 0}; +#undef pci_ss_info_1002_003a +#define pci_ss_info_1002_003a pci_ss_info_1002_5159_1002_003a +static const pciSubsystemInfo pci_ss_info_1002_5159_1002_00ba = + {0x1002, 0x00ba, pci_subsys_1002_5159_1002_00ba, 0}; +#undef pci_ss_info_1002_00ba +#define pci_ss_info_1002_00ba pci_ss_info_1002_5159_1002_00ba +static const pciSubsystemInfo pci_ss_info_1002_5159_1002_013a = + {0x1002, 0x013a, pci_subsys_1002_5159_1002_013a, 0}; +#undef pci_ss_info_1002_013a +#define pci_ss_info_1002_013a pci_ss_info_1002_5159_1002_013a +static const pciSubsystemInfo pci_ss_info_1002_5159_1458_4002 = + {0x1458, 0x4002, pci_subsys_1002_5159_1458_4002, 0}; +#undef pci_ss_info_1458_4002 +#define pci_ss_info_1458_4002 pci_ss_info_1002_5159_1458_4002 +static const pciSubsystemInfo pci_ss_info_1002_5159_148c_2003 = + {0x148c, 0x2003, pci_subsys_1002_5159_148c_2003, 0}; +#undef pci_ss_info_148c_2003 +#define pci_ss_info_148c_2003 pci_ss_info_1002_5159_148c_2003 +static const pciSubsystemInfo pci_ss_info_1002_5159_148c_2023 = + {0x148c, 0x2023, pci_subsys_1002_5159_148c_2023, 0}; +#undef pci_ss_info_148c_2023 +#define pci_ss_info_148c_2023 pci_ss_info_1002_5159_148c_2023 +static const pciSubsystemInfo pci_ss_info_1002_5159_174b_7112 = + {0x174b, 0x7112, pci_subsys_1002_5159_174b_7112, 0}; +#undef pci_ss_info_174b_7112 +#define pci_ss_info_174b_7112 pci_ss_info_1002_5159_174b_7112 +static const pciSubsystemInfo pci_ss_info_1002_5159_1787_0202 = + {0x1787, 0x0202, pci_subsys_1002_5159_1787_0202, 0}; +#undef pci_ss_info_1787_0202 +#define pci_ss_info_1787_0202 pci_ss_info_1002_5159_1787_0202 +static const pciSubsystemInfo pci_ss_info_1002_5245_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_5245_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_5245_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_5245_1002_0028 = + {0x1002, 0x0028, pci_subsys_1002_5245_1002_0028, 0}; +#undef pci_ss_info_1002_0028 +#define pci_ss_info_1002_0028 pci_ss_info_1002_5245_1002_0028 +static const pciSubsystemInfo pci_ss_info_1002_5245_1002_0029 = + {0x1002, 0x0029, pci_subsys_1002_5245_1002_0029, 0}; +#undef pci_ss_info_1002_0029 +#define pci_ss_info_1002_0029 pci_ss_info_1002_5245_1002_0029 +static const pciSubsystemInfo pci_ss_info_1002_5245_1002_0068 = + {0x1002, 0x0068, pci_subsys_1002_5245_1002_0068, 0}; +#undef pci_ss_info_1002_0068 +#define pci_ss_info_1002_0068 pci_ss_info_1002_5245_1002_0068 +static const pciSubsystemInfo pci_ss_info_1002_5246_1002_0004 = + {0x1002, 0x0004, pci_subsys_1002_5246_1002_0004, 0}; +#undef pci_ss_info_1002_0004 +#define pci_ss_info_1002_0004 pci_ss_info_1002_5246_1002_0004 +static const pciSubsystemInfo pci_ss_info_1002_5246_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_5246_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_5246_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_5246_1002_0028 = + {0x1002, 0x0028, pci_subsys_1002_5246_1002_0028, 0}; +#undef pci_ss_info_1002_0028 +#define pci_ss_info_1002_0028 pci_ss_info_1002_5246_1002_0028 +static const pciSubsystemInfo pci_ss_info_1002_5246_1002_0044 = + {0x1002, 0x0044, pci_subsys_1002_5246_1002_0044, 0}; +#undef pci_ss_info_1002_0044 +#define pci_ss_info_1002_0044 pci_ss_info_1002_5246_1002_0044 +static const pciSubsystemInfo pci_ss_info_1002_5246_1002_0068 = + {0x1002, 0x0068, pci_subsys_1002_5246_1002_0068, 0}; +#undef pci_ss_info_1002_0068 +#define pci_ss_info_1002_0068 pci_ss_info_1002_5246_1002_0068 +static const pciSubsystemInfo pci_ss_info_1002_5246_1002_0448 = + {0x1002, 0x0448, pci_subsys_1002_5246_1002_0448, 0}; +#undef pci_ss_info_1002_0448 +#define pci_ss_info_1002_0448 pci_ss_info_1002_5246_1002_0448 +static const pciSubsystemInfo pci_ss_info_1002_524c_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_524c_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_524c_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_524c_1002_0088 = + {0x1002, 0x0088, pci_subsys_1002_524c_1002_0088, 0}; +#undef pci_ss_info_1002_0088 +#define pci_ss_info_1002_0088 pci_ss_info_1002_524c_1002_0088 +static const pciSubsystemInfo pci_ss_info_1002_534d_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_534d_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_534d_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_534d_1002_0018 = + {0x1002, 0x0018, pci_subsys_1002_534d_1002_0018, 0}; +#undef pci_ss_info_1002_0018 +#define pci_ss_info_1002_0018 pci_ss_info_1002_534d_1002_0018 +static const pciSubsystemInfo pci_ss_info_1002_5354_1002_5654 = + {0x1002, 0x5654, pci_subsys_1002_5354_1002_5654, 0}; +#undef pci_ss_info_1002_5654 +#define pci_ss_info_1002_5654 pci_ss_info_1002_5354_1002_5654 +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_0004 = + {0x1002, 0x0004, pci_subsys_1002_5446_1002_0004, 0}; +#undef pci_ss_info_1002_0004 +#define pci_ss_info_1002_0004 pci_ss_info_1002_5446_1002_0004 +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_0008 = + {0x1002, 0x0008, pci_subsys_1002_5446_1002_0008, 0}; +#undef pci_ss_info_1002_0008 +#define pci_ss_info_1002_0008 pci_ss_info_1002_5446_1002_0008 +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_0018 = + {0x1002, 0x0018, pci_subsys_1002_5446_1002_0018, 0}; +#undef pci_ss_info_1002_0018 +#define pci_ss_info_1002_0018 pci_ss_info_1002_5446_1002_0018 +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_0028 = + {0x1002, 0x0028, pci_subsys_1002_5446_1002_0028, 0}; +#undef pci_ss_info_1002_0028 +#define pci_ss_info_1002_0028 pci_ss_info_1002_5446_1002_0028 +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_0029 = + {0x1002, 0x0029, pci_subsys_1002_5446_1002_0029, 0}; +#undef pci_ss_info_1002_0029 +#define pci_ss_info_1002_0029 pci_ss_info_1002_5446_1002_0029 +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_002a = + {0x1002, 0x002a, pci_subsys_1002_5446_1002_002a, 0}; +#undef pci_ss_info_1002_002a +#define pci_ss_info_1002_002a pci_ss_info_1002_5446_1002_002a +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_002b = + {0x1002, 0x002b, pci_subsys_1002_5446_1002_002b, 0}; +#undef pci_ss_info_1002_002b +#define pci_ss_info_1002_002b pci_ss_info_1002_5446_1002_002b +static const pciSubsystemInfo pci_ss_info_1002_5446_1002_0048 = + {0x1002, 0x0048, pci_subsys_1002_5446_1002_0048, 0}; +#undef pci_ss_info_1002_0048 +#define pci_ss_info_1002_0048 pci_ss_info_1002_5446_1002_0048 +static const pciSubsystemInfo pci_ss_info_1002_5452_1002_001c = + {0x1002, 0x001c, pci_subsys_1002_5452_1002_001c, 0}; +#undef pci_ss_info_1002_001c +#define pci_ss_info_1002_001c pci_ss_info_1002_5452_1002_001c +static const pciSubsystemInfo pci_ss_info_1002_5452_103c_1279 = + {0x103c, 0x1279, pci_subsys_1002_5452_103c_1279, 0}; +#undef pci_ss_info_103c_1279 +#define pci_ss_info_103c_1279 pci_ss_info_1002_5452_103c_1279 +static const pciSubsystemInfo pci_ss_info_1002_5654_1002_5654 = + {0x1002, 0x5654, pci_subsys_1002_5654_1002_5654, 0}; +#undef pci_ss_info_1002_5654 +#define pci_ss_info_1002_5654 pci_ss_info_1002_5654_1002_5654 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1004_0304_1004_0304 = + {0x1004, 0x0304, pci_subsys_1004_0304_1004_0304, 0}; +#undef pci_ss_info_1004_0304 +#define pci_ss_info_1004_0304 pci_ss_info_1004_0304_1004_0304 +static const pciSubsystemInfo pci_ss_info_1004_0304_122d_1206 = + {0x122d, 0x1206, pci_subsys_1004_0304_122d_1206, 0}; +#undef pci_ss_info_122d_1206 +#define pci_ss_info_122d_1206 pci_ss_info_1004_0304_122d_1206 +static const pciSubsystemInfo pci_ss_info_1004_0304_1483_5020 = + {0x1483, 0x5020, pci_subsys_1004_0304_1483_5020, 0}; +#undef pci_ss_info_1483_5020 +#define pci_ss_info_1483_5020 pci_ss_info_1004_0304_1483_5020 +static const pciSubsystemInfo pci_ss_info_1004_0305_1004_0305 = + {0x1004, 0x0305, pci_subsys_1004_0305_1004_0305, 0}; +#undef pci_ss_info_1004_0305 +#define pci_ss_info_1004_0305 pci_ss_info_1004_0305_1004_0305 +static const pciSubsystemInfo pci_ss_info_1004_0305_122d_1207 = + {0x122d, 0x1207, pci_subsys_1004_0305_122d_1207, 0}; +#undef pci_ss_info_122d_1207 +#define pci_ss_info_122d_1207 pci_ss_info_1004_0305_122d_1207 +static const pciSubsystemInfo pci_ss_info_1004_0305_1483_5021 = + {0x1483, 0x5021, pci_subsys_1004_0305_1483_5021, 0}; +#undef pci_ss_info_1483_5021 +#define pci_ss_info_1483_5021 pci_ss_info_1004_0305_1483_5021 +static const pciSubsystemInfo pci_ss_info_1004_0306_1004_0306 = + {0x1004, 0x0306, pci_subsys_1004_0306_1004_0306, 0}; +#undef pci_ss_info_1004_0306 +#define pci_ss_info_1004_0306 pci_ss_info_1004_0306_1004_0306 +static const pciSubsystemInfo pci_ss_info_1004_0306_122d_1208 = + {0x122d, 0x1208, pci_subsys_1004_0306_122d_1208, 0}; +#undef pci_ss_info_122d_1208 +#define pci_ss_info_122d_1208 pci_ss_info_1004_0306_122d_1208 +static const pciSubsystemInfo pci_ss_info_1004_0306_1483_5022 = + {0x1483, 0x5022, pci_subsys_1004_0306_1483_5022, 0}; +#undef pci_ss_info_1483_5022 +#define pci_ss_info_1483_5022 pci_ss_info_1004_0306_1483_5022 +#endif +static const pciSubsystemInfo pci_ss_info_1011_0009_1025_0310 = + {0x1025, 0x0310, pci_subsys_1011_0009_1025_0310, 0}; +#undef pci_ss_info_1025_0310 +#define pci_ss_info_1025_0310 pci_ss_info_1011_0009_1025_0310 +static const pciSubsystemInfo pci_ss_info_1011_0009_10b8_2001 = + {0x10b8, 0x2001, pci_subsys_1011_0009_10b8_2001, 0}; +#undef pci_ss_info_10b8_2001 +#define pci_ss_info_10b8_2001 pci_ss_info_1011_0009_10b8_2001 +static const pciSubsystemInfo pci_ss_info_1011_0009_10b8_2002 = + {0x10b8, 0x2002, pci_subsys_1011_0009_10b8_2002, 0}; +#undef pci_ss_info_10b8_2002 +#define pci_ss_info_10b8_2002 pci_ss_info_1011_0009_10b8_2002 +static const pciSubsystemInfo pci_ss_info_1011_0009_10b8_2003 = + {0x10b8, 0x2003, pci_subsys_1011_0009_10b8_2003, 0}; +#undef pci_ss_info_10b8_2003 +#define pci_ss_info_10b8_2003 pci_ss_info_1011_0009_10b8_2003 +static const pciSubsystemInfo pci_ss_info_1011_0009_1109_2400 = + {0x1109, 0x2400, pci_subsys_1011_0009_1109_2400, 0}; +#undef pci_ss_info_1109_2400 +#define pci_ss_info_1109_2400 pci_ss_info_1011_0009_1109_2400 +static const pciSubsystemInfo pci_ss_info_1011_0009_1112_2300 = + {0x1112, 0x2300, pci_subsys_1011_0009_1112_2300, 0}; +#undef pci_ss_info_1112_2300 +#define pci_ss_info_1112_2300 pci_ss_info_1011_0009_1112_2300 +static const pciSubsystemInfo pci_ss_info_1011_0009_1112_2320 = + {0x1112, 0x2320, pci_subsys_1011_0009_1112_2320, 0}; +#undef pci_ss_info_1112_2320 +#define pci_ss_info_1112_2320 pci_ss_info_1011_0009_1112_2320 +static const pciSubsystemInfo pci_ss_info_1011_0009_1112_2340 = + {0x1112, 0x2340, pci_subsys_1011_0009_1112_2340, 0}; +#undef pci_ss_info_1112_2340 +#define pci_ss_info_1112_2340 pci_ss_info_1011_0009_1112_2340 +static const pciSubsystemInfo pci_ss_info_1011_0009_1113_1207 = + {0x1113, 0x1207, pci_subsys_1011_0009_1113_1207, 0}; +#undef pci_ss_info_1113_1207 +#define pci_ss_info_1113_1207 pci_ss_info_1011_0009_1113_1207 +static const pciSubsystemInfo pci_ss_info_1011_0009_1186_1100 = + {0x1186, 0x1100, pci_subsys_1011_0009_1186_1100, 0}; +#undef pci_ss_info_1186_1100 +#define pci_ss_info_1186_1100 pci_ss_info_1011_0009_1186_1100 +static const pciSubsystemInfo pci_ss_info_1011_0009_1186_1112 = + {0x1186, 0x1112, pci_subsys_1011_0009_1186_1112, 0}; +#undef pci_ss_info_1186_1112 +#define pci_ss_info_1186_1112 pci_ss_info_1011_0009_1186_1112 +static const pciSubsystemInfo pci_ss_info_1011_0009_1186_1140 = + {0x1186, 0x1140, pci_subsys_1011_0009_1186_1140, 0}; +#undef pci_ss_info_1186_1140 +#define pci_ss_info_1186_1140 pci_ss_info_1011_0009_1186_1140 +static const pciSubsystemInfo pci_ss_info_1011_0009_1186_1142 = + {0x1186, 0x1142, pci_subsys_1011_0009_1186_1142, 0}; +#undef pci_ss_info_1186_1142 +#define pci_ss_info_1186_1142 pci_ss_info_1011_0009_1186_1142 +static const pciSubsystemInfo pci_ss_info_1011_0009_11f6_0503 = + {0x11f6, 0x0503, pci_subsys_1011_0009_11f6_0503, 0}; +#undef pci_ss_info_11f6_0503 +#define pci_ss_info_11f6_0503 pci_ss_info_1011_0009_11f6_0503 +static const pciSubsystemInfo pci_ss_info_1011_0009_1282_9100 = + {0x1282, 0x9100, pci_subsys_1011_0009_1282_9100, 0}; +#undef pci_ss_info_1282_9100 +#define pci_ss_info_1282_9100 pci_ss_info_1011_0009_1282_9100 +static const pciSubsystemInfo pci_ss_info_1011_0009_1385_1100 = + {0x1385, 0x1100, pci_subsys_1011_0009_1385_1100, 0}; +#undef pci_ss_info_1385_1100 +#define pci_ss_info_1385_1100 pci_ss_info_1011_0009_1385_1100 +static const pciSubsystemInfo pci_ss_info_1011_0009_2646_0001 = + {0x2646, 0x0001, pci_subsys_1011_0009_2646_0001, 0}; +#undef pci_ss_info_2646_0001 +#define pci_ss_info_2646_0001 pci_ss_info_1011_0009_2646_0001 +static const pciSubsystemInfo pci_ss_info_1011_0014_1186_0100 = + {0x1186, 0x0100, pci_subsys_1011_0014_1186_0100, 0}; +#undef pci_ss_info_1186_0100 +#define pci_ss_info_1186_0100 pci_ss_info_1011_0014_1186_0100 +static const pciSubsystemInfo pci_ss_info_1011_0019_1011_500a = + {0x1011, 0x500a, pci_subsys_1011_0019_1011_500a, 0}; +#undef pci_ss_info_1011_500a +#define pci_ss_info_1011_500a pci_ss_info_1011_0019_1011_500a +static const pciSubsystemInfo pci_ss_info_1011_0019_1011_500b = + {0x1011, 0x500b, pci_subsys_1011_0019_1011_500b, 0}; +#undef pci_ss_info_1011_500b +#define pci_ss_info_1011_500b pci_ss_info_1011_0019_1011_500b +static const pciSubsystemInfo pci_ss_info_1011_0019_1014_0001 = + {0x1014, 0x0001, pci_subsys_1011_0019_1014_0001, 0}; +#undef pci_ss_info_1014_0001 +#define pci_ss_info_1014_0001 pci_ss_info_1011_0019_1014_0001 +static const pciSubsystemInfo pci_ss_info_1011_0019_1025_0315 = + {0x1025, 0x0315, pci_subsys_1011_0019_1025_0315, 0}; +#undef pci_ss_info_1025_0315 +#define pci_ss_info_1025_0315 pci_ss_info_1011_0019_1025_0315 +static const pciSubsystemInfo pci_ss_info_1011_0019_1033_800c = + {0x1033, 0x800c, pci_subsys_1011_0019_1033_800c, 0}; +#undef pci_ss_info_1033_800c +#define pci_ss_info_1033_800c pci_ss_info_1011_0019_1033_800c +static const pciSubsystemInfo pci_ss_info_1011_0019_1033_800d = + {0x1033, 0x800d, pci_subsys_1011_0019_1033_800d, 0}; +#undef pci_ss_info_1033_800d +#define pci_ss_info_1033_800d pci_ss_info_1011_0019_1033_800d +static const pciSubsystemInfo pci_ss_info_1011_0019_108d_0016 = + {0x108d, 0x0016, pci_subsys_1011_0019_108d_0016, 0}; +#undef pci_ss_info_108d_0016 +#define pci_ss_info_108d_0016 pci_ss_info_1011_0019_108d_0016 +static const pciSubsystemInfo pci_ss_info_1011_0019_108d_0017 = + {0x108d, 0x0017, pci_subsys_1011_0019_108d_0017, 0}; +#undef pci_ss_info_108d_0017 +#define pci_ss_info_108d_0017 pci_ss_info_1011_0019_108d_0017 +static const pciSubsystemInfo pci_ss_info_1011_0019_10b8_2005 = + {0x10b8, 0x2005, pci_subsys_1011_0019_10b8_2005, 0}; +#undef pci_ss_info_10b8_2005 +#define pci_ss_info_10b8_2005 pci_ss_info_1011_0019_10b8_2005 +static const pciSubsystemInfo pci_ss_info_1011_0019_10b8_8034 = + {0x10b8, 0x8034, pci_subsys_1011_0019_10b8_8034, 0}; +#undef pci_ss_info_10b8_8034 +#define pci_ss_info_10b8_8034 pci_ss_info_1011_0019_10b8_8034 +static const pciSubsystemInfo pci_ss_info_1011_0019_10ef_8169 = + {0x10ef, 0x8169, pci_subsys_1011_0019_10ef_8169, 0}; +#undef pci_ss_info_10ef_8169 +#define pci_ss_info_10ef_8169 pci_ss_info_1011_0019_10ef_8169 +static const pciSubsystemInfo pci_ss_info_1011_0019_1109_2a00 = + {0x1109, 0x2a00, pci_subsys_1011_0019_1109_2a00, 0}; +#undef pci_ss_info_1109_2a00 +#define pci_ss_info_1109_2a00 pci_ss_info_1011_0019_1109_2a00 +static const pciSubsystemInfo pci_ss_info_1011_0019_1109_2b00 = + {0x1109, 0x2b00, pci_subsys_1011_0019_1109_2b00, 0}; +#undef pci_ss_info_1109_2b00 +#define pci_ss_info_1109_2b00 pci_ss_info_1011_0019_1109_2b00 +static const pciSubsystemInfo pci_ss_info_1011_0019_1109_3000 = + {0x1109, 0x3000, pci_subsys_1011_0019_1109_3000, 0}; +#undef pci_ss_info_1109_3000 +#define pci_ss_info_1109_3000 pci_ss_info_1011_0019_1109_3000 +static const pciSubsystemInfo pci_ss_info_1011_0019_1113_1207 = + {0x1113, 0x1207, pci_subsys_1011_0019_1113_1207, 0}; +#undef pci_ss_info_1113_1207 +#define pci_ss_info_1113_1207 pci_ss_info_1011_0019_1113_1207 +static const pciSubsystemInfo pci_ss_info_1011_0019_1113_2220 = + {0x1113, 0x2220, pci_subsys_1011_0019_1113_2220, 0}; +#undef pci_ss_info_1113_2220 +#define pci_ss_info_1113_2220 pci_ss_info_1011_0019_1113_2220 +static const pciSubsystemInfo pci_ss_info_1011_0019_115d_0002 = + {0x115d, 0x0002, pci_subsys_1011_0019_115d_0002, 0}; +#undef pci_ss_info_115d_0002 +#define pci_ss_info_115d_0002 pci_ss_info_1011_0019_115d_0002 +static const pciSubsystemInfo pci_ss_info_1011_0019_1179_0203 = + {0x1179, 0x0203, pci_subsys_1011_0019_1179_0203, 0}; +#undef pci_ss_info_1179_0203 +#define pci_ss_info_1179_0203 pci_ss_info_1011_0019_1179_0203 +static const pciSubsystemInfo pci_ss_info_1011_0019_1179_0204 = + {0x1179, 0x0204, pci_subsys_1011_0019_1179_0204, 0}; +#undef pci_ss_info_1179_0204 +#define pci_ss_info_1179_0204 pci_ss_info_1011_0019_1179_0204 +static const pciSubsystemInfo pci_ss_info_1011_0019_1186_1100 = + {0x1186, 0x1100, pci_subsys_1011_0019_1186_1100, 0}; +#undef pci_ss_info_1186_1100 +#define pci_ss_info_1186_1100 pci_ss_info_1011_0019_1186_1100 +static const pciSubsystemInfo pci_ss_info_1011_0019_1186_1101 = + {0x1186, 0x1101, pci_subsys_1011_0019_1186_1101, 0}; +#undef pci_ss_info_1186_1101 +#define pci_ss_info_1186_1101 pci_ss_info_1011_0019_1186_1101 +static const pciSubsystemInfo pci_ss_info_1011_0019_1186_1102 = + {0x1186, 0x1102, pci_subsys_1011_0019_1186_1102, 0}; +#undef pci_ss_info_1186_1102 +#define pci_ss_info_1186_1102 pci_ss_info_1011_0019_1186_1102 +static const pciSubsystemInfo pci_ss_info_1011_0019_1259_2800 = + {0x1259, 0x2800, pci_subsys_1011_0019_1259_2800, 0}; +#undef pci_ss_info_1259_2800 +#define pci_ss_info_1259_2800 pci_ss_info_1011_0019_1259_2800 +static const pciSubsystemInfo pci_ss_info_1011_0019_1266_0004 = + {0x1266, 0x0004, pci_subsys_1011_0019_1266_0004, 0}; +#undef pci_ss_info_1266_0004 +#define pci_ss_info_1266_0004 pci_ss_info_1011_0019_1266_0004 +static const pciSubsystemInfo pci_ss_info_1011_0019_12af_0019 = + {0x12af, 0x0019, pci_subsys_1011_0019_12af_0019, 0}; +#undef pci_ss_info_12af_0019 +#define pci_ss_info_12af_0019 pci_ss_info_1011_0019_12af_0019 +static const pciSubsystemInfo pci_ss_info_1011_0019_1374_0001 = + {0x1374, 0x0001, pci_subsys_1011_0019_1374_0001, 0}; +#undef pci_ss_info_1374_0001 +#define pci_ss_info_1374_0001 pci_ss_info_1011_0019_1374_0001 +static const pciSubsystemInfo pci_ss_info_1011_0019_1374_0002 = + {0x1374, 0x0002, pci_subsys_1011_0019_1374_0002, 0}; +#undef pci_ss_info_1374_0002 +#define pci_ss_info_1374_0002 pci_ss_info_1011_0019_1374_0002 +static const pciSubsystemInfo pci_ss_info_1011_0019_1374_0007 = + {0x1374, 0x0007, pci_subsys_1011_0019_1374_0007, 0}; +#undef pci_ss_info_1374_0007 +#define pci_ss_info_1374_0007 pci_ss_info_1011_0019_1374_0007 +static const pciSubsystemInfo pci_ss_info_1011_0019_1374_0008 = + {0x1374, 0x0008, pci_subsys_1011_0019_1374_0008, 0}; +#undef pci_ss_info_1374_0008 +#define pci_ss_info_1374_0008 pci_ss_info_1011_0019_1374_0008 +static const pciSubsystemInfo pci_ss_info_1011_0019_1385_2100 = + {0x1385, 0x2100, pci_subsys_1011_0019_1385_2100, 0}; +#undef pci_ss_info_1385_2100 +#define pci_ss_info_1385_2100 pci_ss_info_1011_0019_1385_2100 +static const pciSubsystemInfo pci_ss_info_1011_0019_1395_0001 = + {0x1395, 0x0001, pci_subsys_1011_0019_1395_0001, 0}; +#undef pci_ss_info_1395_0001 +#define pci_ss_info_1395_0001 pci_ss_info_1011_0019_1395_0001 +static const pciSubsystemInfo pci_ss_info_1011_0019_13d1_ab01 = + {0x13d1, 0xab01, pci_subsys_1011_0019_13d1_ab01, 0}; +#undef pci_ss_info_13d1_ab01 +#define pci_ss_info_13d1_ab01 pci_ss_info_1011_0019_13d1_ab01 +static const pciSubsystemInfo pci_ss_info_1011_0019_8086_0001 = + {0x8086, 0x0001, pci_subsys_1011_0019_8086_0001, 0}; +#undef pci_ss_info_8086_0001 +#define pci_ss_info_8086_0001 pci_ss_info_1011_0019_8086_0001 +static const pciSubsystemInfo pci_ss_info_1011_0034_1374_0003 = + {0x1374, 0x0003, pci_subsys_1011_0034_1374_0003, 0}; +#undef pci_ss_info_1374_0003 +#define pci_ss_info_1374_0003 pci_ss_info_1011_0034_1374_0003 +static const pciSubsystemInfo pci_ss_info_1011_0046_0e11_4050 = + {0x0e11, 0x4050, pci_subsys_1011_0046_0e11_4050, 0}; +#undef pci_ss_info_0e11_4050 +#define pci_ss_info_0e11_4050 pci_ss_info_1011_0046_0e11_4050 +static const pciSubsystemInfo pci_ss_info_1011_0046_0e11_4051 = + {0x0e11, 0x4051, pci_subsys_1011_0046_0e11_4051, 0}; +#undef pci_ss_info_0e11_4051 +#define pci_ss_info_0e11_4051 pci_ss_info_1011_0046_0e11_4051 +static const pciSubsystemInfo pci_ss_info_1011_0046_0e11_4058 = + {0x0e11, 0x4058, pci_subsys_1011_0046_0e11_4058, 0}; +#undef pci_ss_info_0e11_4058 +#define pci_ss_info_0e11_4058 pci_ss_info_1011_0046_0e11_4058 +static const pciSubsystemInfo pci_ss_info_1011_0046_103c_10c2 = + {0x103c, 0x10c2, pci_subsys_1011_0046_103c_10c2, 0}; +#undef pci_ss_info_103c_10c2 +#define pci_ss_info_103c_10c2 pci_ss_info_1011_0046_103c_10c2 +static const pciSubsystemInfo pci_ss_info_1011_0046_12d9_000a = + {0x12d9, 0x000a, pci_subsys_1011_0046_12d9_000a, 0}; +#undef pci_ss_info_12d9_000a +#define pci_ss_info_12d9_000a pci_ss_info_1011_0046_12d9_000a +static const pciSubsystemInfo pci_ss_info_1011_0046_9005_0365 = + {0x9005, 0x0365, pci_subsys_1011_0046_9005_0365, 0}; +#undef pci_ss_info_9005_0365 +#define pci_ss_info_9005_0365 pci_ss_info_1011_0046_9005_0365 +static const pciSubsystemInfo pci_ss_info_1011_0046_9005_1364 = + {0x9005, 0x1364, pci_subsys_1011_0046_9005_1364, 0}; +#undef pci_ss_info_9005_1364 +#define pci_ss_info_9005_1364 pci_ss_info_1011_0046_9005_1364 +static const pciSubsystemInfo pci_ss_info_1011_0046_9005_1365 = + {0x9005, 0x1365, pci_subsys_1011_0046_9005_1365, 0}; +#undef pci_ss_info_9005_1365 +#define pci_ss_info_9005_1365 pci_ss_info_1011_0046_9005_1365 +static const pciSubsystemInfo pci_ss_info_1011_0046_e4bf_1000 = + {0xe4bf, 0x1000, pci_subsys_1011_0046_e4bf_1000, 0}; +#undef pci_ss_info_e4bf_1000 +#define pci_ss_info_e4bf_1000 pci_ss_info_1011_0046_e4bf_1000 +static const pciSubsystemInfo pci_ss_info_1011_1065_1069_0020 = + {0x1069, 0x0020, pci_subsys_1011_1065_1069_0020, 0}; +#undef pci_ss_info_1069_0020 +#define pci_ss_info_1069_0020 pci_ss_info_1011_1065_1069_0020 +static const pciSubsystemInfo pci_ss_info_1013_00bc_1013_00bc = + {0x1013, 0x00bc, pci_subsys_1013_00bc_1013_00bc, 0}; +#undef pci_ss_info_1013_00bc +#define pci_ss_info_1013_00bc pci_ss_info_1013_00bc_1013_00bc +static const pciSubsystemInfo pci_ss_info_1013_00d6_13ce_8031 = + {0x13ce, 0x8031, pci_subsys_1013_00d6_13ce_8031, 0}; +#undef pci_ss_info_13ce_8031 +#define pci_ss_info_13ce_8031 pci_ss_info_1013_00d6_13ce_8031 +static const pciSubsystemInfo pci_ss_info_1013_00d6_13cf_8031 = + {0x13cf, 0x8031, pci_subsys_1013_00d6_13cf_8031, 0}; +#undef pci_ss_info_13cf_8031 +#define pci_ss_info_13cf_8031 pci_ss_info_1013_00d6_13cf_8031 +static const pciSubsystemInfo pci_ss_info_1013_6001_1014_1010 = + {0x1014, 0x1010, pci_subsys_1013_6001_1014_1010, 0}; +#undef pci_ss_info_1014_1010 +#define pci_ss_info_1014_1010 pci_ss_info_1013_6001_1014_1010 +static const pciSubsystemInfo pci_ss_info_1013_6003_1013_4280 = + {0x1013, 0x4280, pci_subsys_1013_6003_1013_4280, 0}; +#undef pci_ss_info_1013_4280 +#define pci_ss_info_1013_4280 pci_ss_info_1013_6003_1013_4280 +static const pciSubsystemInfo pci_ss_info_1013_6003_1681_0050 = + {0x1681, 0x0050, pci_subsys_1013_6003_1681_0050, 0}; +#undef pci_ss_info_1681_0050 +#define pci_ss_info_1681_0050 pci_ss_info_1013_6003_1681_0050 +static const pciSubsystemInfo pci_ss_info_1013_6003_1681_a011 = + {0x1681, 0xa011, pci_subsys_1013_6003_1681_a011, 0}; +#undef pci_ss_info_1681_a011 +#define pci_ss_info_1681_a011 pci_ss_info_1013_6003_1681_a011 +static const pciSubsystemInfo pci_ss_info_1013_6005_1013_4281 = + {0x1013, 0x4281, pci_subsys_1013_6005_1013_4281, 0}; +#undef pci_ss_info_1013_4281 +#define pci_ss_info_1013_4281 pci_ss_info_1013_6005_1013_4281 +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10a8 = + {0x10cf, 0x10a8, pci_subsys_1013_6005_10cf_10a8, 0}; +#undef pci_ss_info_10cf_10a8 +#define pci_ss_info_10cf_10a8 pci_ss_info_1013_6005_10cf_10a8 +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10a9 = + {0x10cf, 0x10a9, pci_subsys_1013_6005_10cf_10a9, 0}; +#undef pci_ss_info_10cf_10a9 +#define pci_ss_info_10cf_10a9 pci_ss_info_1013_6005_10cf_10a9 +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10aa = + {0x10cf, 0x10aa, pci_subsys_1013_6005_10cf_10aa, 0}; +#undef pci_ss_info_10cf_10aa +#define pci_ss_info_10cf_10aa pci_ss_info_1013_6005_10cf_10aa +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10ab = + {0x10cf, 0x10ab, pci_subsys_1013_6005_10cf_10ab, 0}; +#undef pci_ss_info_10cf_10ab +#define pci_ss_info_10cf_10ab pci_ss_info_1013_6005_10cf_10ab +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10ac = + {0x10cf, 0x10ac, pci_subsys_1013_6005_10cf_10ac, 0}; +#undef pci_ss_info_10cf_10ac +#define pci_ss_info_10cf_10ac pci_ss_info_1013_6005_10cf_10ac +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10ad = + {0x10cf, 0x10ad, pci_subsys_1013_6005_10cf_10ad, 0}; +#undef pci_ss_info_10cf_10ad +#define pci_ss_info_10cf_10ad pci_ss_info_1013_6005_10cf_10ad +static const pciSubsystemInfo pci_ss_info_1013_6005_10cf_10b4 = + {0x10cf, 0x10b4, pci_subsys_1013_6005_10cf_10b4, 0}; +#undef pci_ss_info_10cf_10b4 +#define pci_ss_info_10cf_10b4 pci_ss_info_1013_6005_10cf_10b4 +static const pciSubsystemInfo pci_ss_info_1013_6005_1179_0001 = + {0x1179, 0x0001, pci_subsys_1013_6005_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1013_6005_1179_0001 +static const pciSubsystemInfo pci_ss_info_1013_6005_14c0_000c = + {0x14c0, 0x000c, pci_subsys_1013_6005_14c0_000c, 0}; +#undef pci_ss_info_14c0_000c +#define pci_ss_info_14c0_000c pci_ss_info_1013_6005_14c0_000c +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1014_002e_1014_002e = + {0x1014, 0x002e, pci_subsys_1014_002e_1014_002e, 0}; +#undef pci_ss_info_1014_002e +#define pci_ss_info_1014_002e pci_ss_info_1014_002e_1014_002e +static const pciSubsystemInfo pci_ss_info_1014_002e_1014_022e = + {0x1014, 0x022e, pci_subsys_1014_002e_1014_022e, 0}; +#undef pci_ss_info_1014_022e +#define pci_ss_info_1014_022e pci_ss_info_1014_002e_1014_022e +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_003e = + {0x1014, 0x003e, pci_subsys_1014_003e_1014_003e, 0}; +#undef pci_ss_info_1014_003e +#define pci_ss_info_1014_003e pci_ss_info_1014_003e_1014_003e +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_00cd = + {0x1014, 0x00cd, pci_subsys_1014_003e_1014_00cd, 0}; +#undef pci_ss_info_1014_00cd +#define pci_ss_info_1014_00cd pci_ss_info_1014_003e_1014_00cd +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_00ce = + {0x1014, 0x00ce, pci_subsys_1014_003e_1014_00ce, 0}; +#undef pci_ss_info_1014_00ce +#define pci_ss_info_1014_00ce pci_ss_info_1014_003e_1014_00ce +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_00cf = + {0x1014, 0x00cf, pci_subsys_1014_003e_1014_00cf, 0}; +#undef pci_ss_info_1014_00cf +#define pci_ss_info_1014_00cf pci_ss_info_1014_003e_1014_00cf +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_00e4 = + {0x1014, 0x00e4, pci_subsys_1014_003e_1014_00e4, 0}; +#undef pci_ss_info_1014_00e4 +#define pci_ss_info_1014_00e4 pci_ss_info_1014_003e_1014_00e4 +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_00e5 = + {0x1014, 0x00e5, pci_subsys_1014_003e_1014_00e5, 0}; +#undef pci_ss_info_1014_00e5 +#define pci_ss_info_1014_00e5 pci_ss_info_1014_003e_1014_00e5 +static const pciSubsystemInfo pci_ss_info_1014_003e_1014_016d = + {0x1014, 0x016d, pci_subsys_1014_003e_1014_016d, 0}; +#undef pci_ss_info_1014_016d +#define pci_ss_info_1014_016d pci_ss_info_1014_003e_1014_016d +static const pciSubsystemInfo pci_ss_info_1014_0090_1014_008e = + {0x1014, 0x008e, pci_subsys_1014_0090_1014_008e, 0}; +#undef pci_ss_info_1014_008e +#define pci_ss_info_1014_008e pci_ss_info_1014_0090_1014_008e +static const pciSubsystemInfo pci_ss_info_1014_0096_1014_0097 = + {0x1014, 0x0097, pci_subsys_1014_0096_1014_0097, 0}; +#undef pci_ss_info_1014_0097 +#define pci_ss_info_1014_0097 pci_ss_info_1014_0096_1014_0097 +static const pciSubsystemInfo pci_ss_info_1014_0096_1014_0098 = + {0x1014, 0x0098, pci_subsys_1014_0096_1014_0098, 0}; +#undef pci_ss_info_1014_0098 +#define pci_ss_info_1014_0098 pci_ss_info_1014_0096_1014_0098 +static const pciSubsystemInfo pci_ss_info_1014_0096_1014_0099 = + {0x1014, 0x0099, pci_subsys_1014_0096_1014_0099, 0}; +#undef pci_ss_info_1014_0099 +#define pci_ss_info_1014_0099 pci_ss_info_1014_0096_1014_0099 +static const pciSubsystemInfo pci_ss_info_1014_0142_1014_0143 = + {0x1014, 0x0143, pci_subsys_1014_0142_1014_0143, 0}; +#undef pci_ss_info_1014_0143 +#define pci_ss_info_1014_0143 pci_ss_info_1014_0142_1014_0143 +static const pciSubsystemInfo pci_ss_info_1014_0144_1014_0145 = + {0x1014, 0x0145, pci_subsys_1014_0144_1014_0145, 0}; +#undef pci_ss_info_1014_0145 +#define pci_ss_info_1014_0145 pci_ss_info_1014_0144_1014_0145 +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_01be = + {0x1014, 0x01be, pci_subsys_1014_01bd_1014_01be, 0}; +#undef pci_ss_info_1014_01be +#define pci_ss_info_1014_01be pci_ss_info_1014_01bd_1014_01be +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_01bf = + {0x1014, 0x01bf, pci_subsys_1014_01bd_1014_01bf, 0}; +#undef pci_ss_info_1014_01bf +#define pci_ss_info_1014_01bf pci_ss_info_1014_01bd_1014_01bf +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_0208 = + {0x1014, 0x0208, pci_subsys_1014_01bd_1014_0208, 0}; +#undef pci_ss_info_1014_0208 +#define pci_ss_info_1014_0208 pci_ss_info_1014_01bd_1014_0208 +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_020e = + {0x1014, 0x020e, pci_subsys_1014_01bd_1014_020e, 0}; +#undef pci_ss_info_1014_020e +#define pci_ss_info_1014_020e pci_ss_info_1014_01bd_1014_020e +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_022e = + {0x1014, 0x022e, pci_subsys_1014_01bd_1014_022e, 0}; +#undef pci_ss_info_1014_022e +#define pci_ss_info_1014_022e pci_ss_info_1014_01bd_1014_022e +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_0258 = + {0x1014, 0x0258, pci_subsys_1014_01bd_1014_0258, 0}; +#undef pci_ss_info_1014_0258 +#define pci_ss_info_1014_0258 pci_ss_info_1014_01bd_1014_0258 +static const pciSubsystemInfo pci_ss_info_1014_01bd_1014_0259 = + {0x1014, 0x0259, pci_subsys_1014_01bd_1014_0259, 0}; +#undef pci_ss_info_1014_0259 +#define pci_ss_info_1014_0259 pci_ss_info_1014_01bd_1014_0259 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_101e_1960_101e_0471 = + {0x101e, 0x0471, pci_subsys_101e_1960_101e_0471, 0}; +#undef pci_ss_info_101e_0471 +#define pci_ss_info_101e_0471 pci_ss_info_101e_1960_101e_0471 +static const pciSubsystemInfo pci_ss_info_101e_1960_101e_0475 = + {0x101e, 0x0475, pci_subsys_101e_1960_101e_0475, 0}; +#undef pci_ss_info_101e_0475 +#define pci_ss_info_101e_0475 pci_ss_info_101e_1960_101e_0475 +static const pciSubsystemInfo pci_ss_info_101e_1960_101e_0493 = + {0x101e, 0x0493, pci_subsys_101e_1960_101e_0493, 0}; +#undef pci_ss_info_101e_0493 +#define pci_ss_info_101e_0493 pci_ss_info_101e_1960_101e_0493 +#endif +static const pciSubsystemInfo pci_ss_info_101e_1960_1028_0471 = + {0x1028, 0x0471, pci_subsys_101e_1960_1028_0471, 0}; +#undef pci_ss_info_1028_0471 +#define pci_ss_info_1028_0471 pci_ss_info_101e_1960_1028_0471 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_101e_1960_1028_0475 = + {0x1028, 0x0475, pci_subsys_101e_1960_1028_0475, 0}; +#undef pci_ss_info_1028_0475 +#define pci_ss_info_1028_0475 pci_ss_info_101e_1960_1028_0475 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_101e_1960_1028_0493 = + {0x1028, 0x0493, pci_subsys_101e_1960_1028_0493, 0}; +#undef pci_ss_info_1028_0493 +#define pci_ss_info_1028_0493 pci_ss_info_101e_1960_1028_0493 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_101e_1960_1028_0511 = + {0x1028, 0x0511, pci_subsys_101e_1960_1028_0511, 0}; +#undef pci_ss_info_1028_0511 +#define pci_ss_info_1028_0511 pci_ss_info_101e_1960_1028_0511 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_101e_9063_101e_0767 = + {0x101e, 0x0767, pci_subsys_101e_9063_101e_0767, 0}; +#undef pci_ss_info_101e_0767 +#define pci_ss_info_101e_0767 pci_ss_info_101e_9063_101e_0767 +#endif +static const pciSubsystemInfo pci_ss_info_1022_2000_1014_2000 = + {0x1014, 0x2000, pci_subsys_1022_2000_1014_2000, 0}; +#undef pci_ss_info_1014_2000 +#define pci_ss_info_1014_2000 pci_ss_info_1022_2000_1014_2000 +static const pciSubsystemInfo pci_ss_info_1022_2000_103c_104c = + {0x103c, 0x104c, pci_subsys_1022_2000_103c_104c, 0}; +#undef pci_ss_info_103c_104c +#define pci_ss_info_103c_104c pci_ss_info_1022_2000_103c_104c +static const pciSubsystemInfo pci_ss_info_1022_2000_103c_1064 = + {0x103c, 0x1064, pci_subsys_1022_2000_103c_1064, 0}; +#undef pci_ss_info_103c_1064 +#define pci_ss_info_103c_1064 pci_ss_info_1022_2000_103c_1064 +static const pciSubsystemInfo pci_ss_info_1022_2000_103c_1065 = + {0x103c, 0x1065, pci_subsys_1022_2000_103c_1065, 0}; +#undef pci_ss_info_103c_1065 +#define pci_ss_info_103c_1065 pci_ss_info_1022_2000_103c_1065 +static const pciSubsystemInfo pci_ss_info_1022_2000_103c_106c = + {0x103c, 0x106c, pci_subsys_1022_2000_103c_106c, 0}; +#undef pci_ss_info_103c_106c +#define pci_ss_info_103c_106c pci_ss_info_1022_2000_103c_106c +static const pciSubsystemInfo pci_ss_info_1022_2000_103c_106e = + {0x103c, 0x106e, pci_subsys_1022_2000_103c_106e, 0}; +#undef pci_ss_info_103c_106e +#define pci_ss_info_103c_106e pci_ss_info_1022_2000_103c_106e +static const pciSubsystemInfo pci_ss_info_1022_2000_103c_10ea = + {0x103c, 0x10ea, pci_subsys_1022_2000_103c_10ea, 0}; +#undef pci_ss_info_103c_10ea +#define pci_ss_info_103c_10ea pci_ss_info_1022_2000_103c_10ea +static const pciSubsystemInfo pci_ss_info_1022_2000_1113_1220 = + {0x1113, 0x1220, pci_subsys_1022_2000_1113_1220, 0}; +#undef pci_ss_info_1113_1220 +#define pci_ss_info_1113_1220 pci_ss_info_1022_2000_1113_1220 +static const pciSubsystemInfo pci_ss_info_1022_2000_1259_2450 = + {0x1259, 0x2450, pci_subsys_1022_2000_1259_2450, 0}; +#undef pci_ss_info_1259_2450 +#define pci_ss_info_1259_2450 pci_ss_info_1022_2000_1259_2450 +static const pciSubsystemInfo pci_ss_info_1022_2000_1259_2454 = + {0x1259, 0x2454, pci_subsys_1022_2000_1259_2454, 0}; +#undef pci_ss_info_1259_2454 +#define pci_ss_info_1259_2454 pci_ss_info_1022_2000_1259_2454 +static const pciSubsystemInfo pci_ss_info_1022_2000_1259_2700 = + {0x1259, 0x2700, pci_subsys_1022_2000_1259_2700, 0}; +#undef pci_ss_info_1259_2700 +#define pci_ss_info_1259_2700 pci_ss_info_1022_2000_1259_2700 +static const pciSubsystemInfo pci_ss_info_1022_2000_1259_2701 = + {0x1259, 0x2701, pci_subsys_1022_2000_1259_2701, 0}; +#undef pci_ss_info_1259_2701 +#define pci_ss_info_1259_2701 pci_ss_info_1022_2000_1259_2701 +static const pciSubsystemInfo pci_ss_info_1022_2001_1092_0a78 = + {0x1092, 0x0a78, pci_subsys_1022_2001_1092_0a78, 0}; +#undef pci_ss_info_1092_0a78 +#define pci_ss_info_1092_0a78 pci_ss_info_1022_2001_1092_0a78 +static const pciSubsystemInfo pci_ss_info_1022_2001_1668_0299 = + {0x1668, 0x0299, pci_subsys_1022_2001_1668_0299, 0}; +#undef pci_ss_info_1668_0299 +#define pci_ss_info_1668_0299 pci_ss_info_1022_2001_1668_0299 +static const pciSubsystemInfo pci_ss_info_1022_7440_1043_8044 = + {0x1043, 0x8044, pci_subsys_1022_7440_1043_8044, 0}; +#undef pci_ss_info_1043_8044 +#define pci_ss_info_1043_8044 pci_ss_info_1022_7440_1043_8044 +static const pciSubsystemInfo pci_ss_info_1022_7443_1043_8044 = + {0x1043, 0x8044, pci_subsys_1022_7443_1043_8044, 0}; +#undef pci_ss_info_1043_8044 +#define pci_ss_info_1043_8044 pci_ss_info_1022_7443_1043_8044 +static const pciSubsystemInfo pci_ss_info_1023_8400_1023_8400 = + {0x1023, 0x8400, pci_subsys_1023_8400_1023_8400, 0}; +#undef pci_ss_info_1023_8400 +#define pci_ss_info_1023_8400 pci_ss_info_1023_8400_1023_8400 +static const pciSubsystemInfo pci_ss_info_1023_8420_0e11_b15a = + {0x0e11, 0xb15a, pci_subsys_1023_8420_0e11_b15a, 0}; +#undef pci_ss_info_0e11_b15a +#define pci_ss_info_0e11_b15a pci_ss_info_1023_8420_0e11_b15a +static const pciSubsystemInfo pci_ss_info_1023_8520_0e11_b16e = + {0x0e11, 0xb16e, pci_subsys_1023_8520_0e11_b16e, 0}; +#undef pci_ss_info_0e11_b16e +#define pci_ss_info_0e11_b16e pci_ss_info_1023_8520_0e11_b16e +static const pciSubsystemInfo pci_ss_info_1023_8520_1023_8520 = + {0x1023, 0x8520, pci_subsys_1023_8520_1023_8520, 0}; +#undef pci_ss_info_1023_8520 +#define pci_ss_info_1023_8520 pci_ss_info_1023_8520_1023_8520 +static const pciSubsystemInfo pci_ss_info_1023_8620_1014_0502 = + {0x1014, 0x0502, pci_subsys_1023_8620_1014_0502, 0}; +#undef pci_ss_info_1014_0502 +#define pci_ss_info_1014_0502 pci_ss_info_1023_8620_1014_0502 +static const pciSubsystemInfo pci_ss_info_1023_9525_10cf_1094 = + {0x10cf, 0x1094, pci_subsys_1023_9525_10cf_1094, 0}; +#undef pci_ss_info_10cf_1094 +#define pci_ss_info_10cf_1094 pci_ss_info_1023_9525_10cf_1094 +static const pciSubsystemInfo pci_ss_info_1023_9750_1014_9750 = + {0x1014, 0x9750, pci_subsys_1023_9750_1014_9750, 0}; +#undef pci_ss_info_1014_9750 +#define pci_ss_info_1014_9750 pci_ss_info_1023_9750_1014_9750 +static const pciSubsystemInfo pci_ss_info_1023_9750_1023_9750 = + {0x1023, 0x9750, pci_subsys_1023_9750_1023_9750, 0}; +#undef pci_ss_info_1023_9750 +#define pci_ss_info_1023_9750 pci_ss_info_1023_9750_1023_9750 +static const pciSubsystemInfo pci_ss_info_1023_9880_1023_9880 = + {0x1023, 0x9880, pci_subsys_1023_9880_1023_9880, 0}; +#undef pci_ss_info_1023_9880 +#define pci_ss_info_1023_9880 pci_ss_info_1023_9880_1023_9880 +static const pciSubsystemInfo pci_ss_info_1025_1521_10b9_1521 = + {0x10b9, 0x1521, pci_subsys_1025_1521_10b9_1521, 0}; +#undef pci_ss_info_10b9_1521 +#define pci_ss_info_10b9_1521 pci_ss_info_1025_1521_10b9_1521 +static const pciSubsystemInfo pci_ss_info_1025_1523_10b9_1523 = + {0x10b9, 0x1523, pci_subsys_1025_1523_10b9_1523, 0}; +#undef pci_ss_info_10b9_1523 +#define pci_ss_info_10b9_1523 pci_ss_info_1025_1523_10b9_1523 +static const pciSubsystemInfo pci_ss_info_1025_1533_10b9_1533 = + {0x10b9, 0x1533, pci_subsys_1025_1533_10b9_1533, 0}; +#undef pci_ss_info_10b9_1533 +#define pci_ss_info_10b9_1533 pci_ss_info_1025_1533_10b9_1533 +static const pciSubsystemInfo pci_ss_info_1025_1541_10b9_1541 = + {0x10b9, 0x1541, pci_subsys_1025_1541_10b9_1541, 0}; +#undef pci_ss_info_10b9_1541 +#define pci_ss_info_10b9_1541 pci_ss_info_1025_1541_10b9_1541 +static const pciSubsystemInfo pci_ss_info_1025_7101_10b9_7101 = + {0x10b9, 0x7101, pci_subsys_1025_7101_10b9_7101, 0}; +#undef pci_ss_info_10b9_7101 +#define pci_ss_info_10b9_7101 pci_ss_info_1025_7101_10b9_7101 +static const pciSubsystemInfo pci_ss_info_1028_0001_1028_0001 = + {0x1028, 0x0001, pci_subsys_1028_0001_1028_0001, 0}; +#undef pci_ss_info_1028_0001 +#define pci_ss_info_1028_0001 pci_ss_info_1028_0001_1028_0001 +static const pciSubsystemInfo pci_ss_info_1028_0002_1028_0002 = + {0x1028, 0x0002, pci_subsys_1028_0002_1028_0002, 0}; +#undef pci_ss_info_1028_0002 +#define pci_ss_info_1028_0002 pci_ss_info_1028_0002_1028_0002 +static const pciSubsystemInfo pci_ss_info_1028_0002_1028_00d1 = + {0x1028, 0x00d1, pci_subsys_1028_0002_1028_00d1, 0}; +#undef pci_ss_info_1028_00d1 +#define pci_ss_info_1028_00d1 pci_ss_info_1028_0002_1028_00d1 +static const pciSubsystemInfo pci_ss_info_1028_0002_1028_00d9 = + {0x1028, 0x00d9, pci_subsys_1028_0002_1028_00d9, 0}; +#undef pci_ss_info_1028_00d9 +#define pci_ss_info_1028_00d9 pci_ss_info_1028_0002_1028_00d9 +static const pciSubsystemInfo pci_ss_info_1028_0003_1028_0003 = + {0x1028, 0x0003, pci_subsys_1028_0003_1028_0003, 0}; +#undef pci_ss_info_1028_0003 +#define pci_ss_info_1028_0003 pci_ss_info_1028_0003_1028_0003 +static const pciSubsystemInfo pci_ss_info_1028_0004_1028_00d0 = + {0x1028, 0x00d0, pci_subsys_1028_0004_1028_00d0, 0}; +#undef pci_ss_info_1028_00d0 +#define pci_ss_info_1028_00d0 pci_ss_info_1028_0004_1028_00d0 +static const pciSubsystemInfo pci_ss_info_1028_000a_1028_0106 = + {0x1028, 0x0106, pci_subsys_1028_000a_1028_0106, 0}; +#undef pci_ss_info_1028_0106 +#define pci_ss_info_1028_0106 pci_ss_info_1028_000a_1028_0106 +static const pciSubsystemInfo pci_ss_info_1028_000a_1028_011b = + {0x1028, 0x011b, pci_subsys_1028_000a_1028_011b, 0}; +#undef pci_ss_info_1028_011b +#define pci_ss_info_1028_011b pci_ss_info_1028_000a_1028_011b +static const pciSubsystemInfo pci_ss_info_1028_000a_1028_0121 = + {0x1028, 0x0121, pci_subsys_1028_000a_1028_0121, 0}; +#undef pci_ss_info_1028_0121 +#define pci_ss_info_1028_0121 pci_ss_info_1028_000a_1028_0121 +static const pciSubsystemInfo pci_ss_info_102b_051a_102b_0100 = + {0x102b, 0x0100, pci_subsys_102b_051a_102b_0100, 0}; +#undef pci_ss_info_102b_0100 +#define pci_ss_info_102b_0100 pci_ss_info_102b_051a_102b_0100 +static const pciSubsystemInfo pci_ss_info_102b_051a_102b_1100 = + {0x102b, 0x1100, pci_subsys_102b_051a_102b_1100, 0}; +#undef pci_ss_info_102b_1100 +#define pci_ss_info_102b_1100 pci_ss_info_102b_051a_102b_1100 +static const pciSubsystemInfo pci_ss_info_102b_051a_102b_1200 = + {0x102b, 0x1200, pci_subsys_102b_051a_102b_1200, 0}; +#undef pci_ss_info_102b_1200 +#define pci_ss_info_102b_1200 pci_ss_info_102b_051a_102b_1200 +static const pciSubsystemInfo pci_ss_info_102b_051a_1100_102b = + {0x1100, 0x102b, pci_subsys_102b_051a_1100_102b, 0}; +#undef pci_ss_info_1100_102b +#define pci_ss_info_1100_102b pci_ss_info_102b_051a_1100_102b +static const pciSubsystemInfo pci_ss_info_102b_051a_110a_0018 = + {0x110a, 0x0018, pci_subsys_102b_051a_110a_0018, 0}; +#undef pci_ss_info_110a_0018 +#define pci_ss_info_110a_0018 pci_ss_info_102b_051a_110a_0018 +static const pciSubsystemInfo pci_ss_info_102b_051b_102b_051b = + {0x102b, 0x051b, pci_subsys_102b_051b_102b_051b, 0}; +#undef pci_ss_info_102b_051b +#define pci_ss_info_102b_051b pci_ss_info_102b_051b_102b_051b +static const pciSubsystemInfo pci_ss_info_102b_051b_102b_1100 = + {0x102b, 0x1100, pci_subsys_102b_051b_102b_1100, 0}; +#undef pci_ss_info_102b_1100 +#define pci_ss_info_102b_1100 pci_ss_info_102b_051b_102b_1100 +static const pciSubsystemInfo pci_ss_info_102b_051b_102b_1200 = + {0x102b, 0x1200, pci_subsys_102b_051b_102b_1200, 0}; +#undef pci_ss_info_102b_1200 +#define pci_ss_info_102b_1200 pci_ss_info_102b_051b_102b_1200 +static const pciSubsystemInfo pci_ss_info_102b_0520_102b_dbc2 = + {0x102b, 0xdbc2, pci_subsys_102b_0520_102b_dbc2, 0}; +#undef pci_ss_info_102b_dbc2 +#define pci_ss_info_102b_dbc2 pci_ss_info_102b_0520_102b_dbc2 +static const pciSubsystemInfo pci_ss_info_102b_0520_102b_dbc8 = + {0x102b, 0xdbc8, pci_subsys_102b_0520_102b_dbc8, 0}; +#undef pci_ss_info_102b_dbc8 +#define pci_ss_info_102b_dbc8 pci_ss_info_102b_0520_102b_dbc8 +static const pciSubsystemInfo pci_ss_info_102b_0520_102b_dbe2 = + {0x102b, 0xdbe2, pci_subsys_102b_0520_102b_dbe2, 0}; +#undef pci_ss_info_102b_dbe2 +#define pci_ss_info_102b_dbe2 pci_ss_info_102b_0520_102b_dbe2 +static const pciSubsystemInfo pci_ss_info_102b_0520_102b_dbe8 = + {0x102b, 0xdbe8, pci_subsys_102b_0520_102b_dbe8, 0}; +#undef pci_ss_info_102b_dbe8 +#define pci_ss_info_102b_dbe8 pci_ss_info_102b_0520_102b_dbe8 +static const pciSubsystemInfo pci_ss_info_102b_0520_102b_ff03 = + {0x102b, 0xff03, pci_subsys_102b_0520_102b_ff03, 0}; +#undef pci_ss_info_102b_ff03 +#define pci_ss_info_102b_ff03 pci_ss_info_102b_0520_102b_ff03 +static const pciSubsystemInfo pci_ss_info_102b_0520_102b_ff04 = + {0x102b, 0xff04, pci_subsys_102b_0520_102b_ff04, 0}; +#undef pci_ss_info_102b_ff04 +#define pci_ss_info_102b_ff04 pci_ss_info_102b_0520_102b_ff04 +static const pciSubsystemInfo pci_ss_info_102b_0521_1014_ff03 = + {0x1014, 0xff03, pci_subsys_102b_0521_1014_ff03, 0}; +#undef pci_ss_info_1014_ff03 +#define pci_ss_info_1014_ff03 pci_ss_info_102b_0521_1014_ff03 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_48e9 = + {0x102b, 0x48e9, pci_subsys_102b_0521_102b_48e9, 0}; +#undef pci_ss_info_102b_48e9 +#define pci_ss_info_102b_48e9 pci_ss_info_102b_0521_102b_48e9 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_48f8 = + {0x102b, 0x48f8, pci_subsys_102b_0521_102b_48f8, 0}; +#undef pci_ss_info_102b_48f8 +#define pci_ss_info_102b_48f8 pci_ss_info_102b_0521_102b_48f8 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_4a60 = + {0x102b, 0x4a60, pci_subsys_102b_0521_102b_4a60, 0}; +#undef pci_ss_info_102b_4a60 +#define pci_ss_info_102b_4a60 pci_ss_info_102b_0521_102b_4a60 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_4a64 = + {0x102b, 0x4a64, pci_subsys_102b_0521_102b_4a64, 0}; +#undef pci_ss_info_102b_4a64 +#define pci_ss_info_102b_4a64 pci_ss_info_102b_0521_102b_4a64 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_c93c = + {0x102b, 0xc93c, pci_subsys_102b_0521_102b_c93c, 0}; +#undef pci_ss_info_102b_c93c +#define pci_ss_info_102b_c93c pci_ss_info_102b_0521_102b_c93c +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_c9b0 = + {0x102b, 0xc9b0, pci_subsys_102b_0521_102b_c9b0, 0}; +#undef pci_ss_info_102b_c9b0 +#define pci_ss_info_102b_c9b0 pci_ss_info_102b_0521_102b_c9b0 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_c9bc = + {0x102b, 0xc9bc, pci_subsys_102b_0521_102b_c9bc, 0}; +#undef pci_ss_info_102b_c9bc +#define pci_ss_info_102b_c9bc pci_ss_info_102b_0521_102b_c9bc +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_ca60 = + {0x102b, 0xca60, pci_subsys_102b_0521_102b_ca60, 0}; +#undef pci_ss_info_102b_ca60 +#define pci_ss_info_102b_ca60 pci_ss_info_102b_0521_102b_ca60 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_ca6c = + {0x102b, 0xca6c, pci_subsys_102b_0521_102b_ca6c, 0}; +#undef pci_ss_info_102b_ca6c +#define pci_ss_info_102b_ca6c pci_ss_info_102b_0521_102b_ca6c +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbbc = + {0x102b, 0xdbbc, pci_subsys_102b_0521_102b_dbbc, 0}; +#undef pci_ss_info_102b_dbbc +#define pci_ss_info_102b_dbbc pci_ss_info_102b_0521_102b_dbbc +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbc2 = + {0x102b, 0xdbc2, pci_subsys_102b_0521_102b_dbc2, 0}; +#undef pci_ss_info_102b_dbc2 +#define pci_ss_info_102b_dbc2 pci_ss_info_102b_0521_102b_dbc2 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbc3 = + {0x102b, 0xdbc3, pci_subsys_102b_0521_102b_dbc3, 0}; +#undef pci_ss_info_102b_dbc3 +#define pci_ss_info_102b_dbc3 pci_ss_info_102b_0521_102b_dbc3 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbc8 = + {0x102b, 0xdbc8, pci_subsys_102b_0521_102b_dbc8, 0}; +#undef pci_ss_info_102b_dbc8 +#define pci_ss_info_102b_dbc8 pci_ss_info_102b_0521_102b_dbc8 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbd2 = + {0x102b, 0xdbd2, pci_subsys_102b_0521_102b_dbd2, 0}; +#undef pci_ss_info_102b_dbd2 +#define pci_ss_info_102b_dbd2 pci_ss_info_102b_0521_102b_dbd2 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbd3 = + {0x102b, 0xdbd3, pci_subsys_102b_0521_102b_dbd3, 0}; +#undef pci_ss_info_102b_dbd3 +#define pci_ss_info_102b_dbd3 pci_ss_info_102b_0521_102b_dbd3 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbd4 = + {0x102b, 0xdbd4, pci_subsys_102b_0521_102b_dbd4, 0}; +#undef pci_ss_info_102b_dbd4 +#define pci_ss_info_102b_dbd4 pci_ss_info_102b_0521_102b_dbd4 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbd5 = + {0x102b, 0xdbd5, pci_subsys_102b_0521_102b_dbd5, 0}; +#undef pci_ss_info_102b_dbd5 +#define pci_ss_info_102b_dbd5 pci_ss_info_102b_0521_102b_dbd5 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbd8 = + {0x102b, 0xdbd8, pci_subsys_102b_0521_102b_dbd8, 0}; +#undef pci_ss_info_102b_dbd8 +#define pci_ss_info_102b_dbd8 pci_ss_info_102b_0521_102b_dbd8 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbd9 = + {0x102b, 0xdbd9, pci_subsys_102b_0521_102b_dbd9, 0}; +#undef pci_ss_info_102b_dbd9 +#define pci_ss_info_102b_dbd9 pci_ss_info_102b_0521_102b_dbd9 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbe2 = + {0x102b, 0xdbe2, pci_subsys_102b_0521_102b_dbe2, 0}; +#undef pci_ss_info_102b_dbe2 +#define pci_ss_info_102b_dbe2 pci_ss_info_102b_0521_102b_dbe2 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbe3 = + {0x102b, 0xdbe3, pci_subsys_102b_0521_102b_dbe3, 0}; +#undef pci_ss_info_102b_dbe3 +#define pci_ss_info_102b_dbe3 pci_ss_info_102b_0521_102b_dbe3 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbe8 = + {0x102b, 0xdbe8, pci_subsys_102b_0521_102b_dbe8, 0}; +#undef pci_ss_info_102b_dbe8 +#define pci_ss_info_102b_dbe8 pci_ss_info_102b_0521_102b_dbe8 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbf2 = + {0x102b, 0xdbf2, pci_subsys_102b_0521_102b_dbf2, 0}; +#undef pci_ss_info_102b_dbf2 +#define pci_ss_info_102b_dbf2 pci_ss_info_102b_0521_102b_dbf2 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbf3 = + {0x102b, 0xdbf3, pci_subsys_102b_0521_102b_dbf3, 0}; +#undef pci_ss_info_102b_dbf3 +#define pci_ss_info_102b_dbf3 pci_ss_info_102b_0521_102b_dbf3 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbf4 = + {0x102b, 0xdbf4, pci_subsys_102b_0521_102b_dbf4, 0}; +#undef pci_ss_info_102b_dbf4 +#define pci_ss_info_102b_dbf4 pci_ss_info_102b_0521_102b_dbf4 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbf5 = + {0x102b, 0xdbf5, pci_subsys_102b_0521_102b_dbf5, 0}; +#undef pci_ss_info_102b_dbf5 +#define pci_ss_info_102b_dbf5 pci_ss_info_102b_0521_102b_dbf5 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbf8 = + {0x102b, 0xdbf8, pci_subsys_102b_0521_102b_dbf8, 0}; +#undef pci_ss_info_102b_dbf8 +#define pci_ss_info_102b_dbf8 pci_ss_info_102b_0521_102b_dbf8 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_dbf9 = + {0x102b, 0xdbf9, pci_subsys_102b_0521_102b_dbf9, 0}; +#undef pci_ss_info_102b_dbf9 +#define pci_ss_info_102b_dbf9 pci_ss_info_102b_0521_102b_dbf9 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_f806 = + {0x102b, 0xf806, pci_subsys_102b_0521_102b_f806, 0}; +#undef pci_ss_info_102b_f806 +#define pci_ss_info_102b_f806 pci_ss_info_102b_0521_102b_f806 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_ff00 = + {0x102b, 0xff00, pci_subsys_102b_0521_102b_ff00, 0}; +#undef pci_ss_info_102b_ff00 +#define pci_ss_info_102b_ff00 pci_ss_info_102b_0521_102b_ff00 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_ff02 = + {0x102b, 0xff02, pci_subsys_102b_0521_102b_ff02, 0}; +#undef pci_ss_info_102b_ff02 +#define pci_ss_info_102b_ff02 pci_ss_info_102b_0521_102b_ff02 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_ff03 = + {0x102b, 0xff03, pci_subsys_102b_0521_102b_ff03, 0}; +#undef pci_ss_info_102b_ff03 +#define pci_ss_info_102b_ff03 pci_ss_info_102b_0521_102b_ff03 +static const pciSubsystemInfo pci_ss_info_102b_0521_102b_ff04 = + {0x102b, 0xff04, pci_subsys_102b_0521_102b_ff04, 0}; +#undef pci_ss_info_102b_ff04 +#define pci_ss_info_102b_ff04 pci_ss_info_102b_0521_102b_ff04 +static const pciSubsystemInfo pci_ss_info_102b_0521_110a_0032 = + {0x110a, 0x0032, pci_subsys_102b_0521_110a_0032, 0}; +#undef pci_ss_info_110a_0032 +#define pci_ss_info_110a_0032 pci_ss_info_102b_0521_110a_0032 +static const pciSubsystemInfo pci_ss_info_102b_0525_0e11_b16f = + {0x0e11, 0xb16f, pci_subsys_102b_0525_0e11_b16f, 0}; +#undef pci_ss_info_0e11_b16f +#define pci_ss_info_0e11_b16f pci_ss_info_102b_0525_0e11_b16f +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0328 = + {0x102b, 0x0328, pci_subsys_102b_0525_102b_0328, 0}; +#undef pci_ss_info_102b_0328 +#define pci_ss_info_102b_0328 pci_ss_info_102b_0525_102b_0328 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0338 = + {0x102b, 0x0338, pci_subsys_102b_0525_102b_0338, 0}; +#undef pci_ss_info_102b_0338 +#define pci_ss_info_102b_0338 pci_ss_info_102b_0525_102b_0338 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0378 = + {0x102b, 0x0378, pci_subsys_102b_0525_102b_0378, 0}; +#undef pci_ss_info_102b_0378 +#define pci_ss_info_102b_0378 pci_ss_info_102b_0525_102b_0378 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0541 = + {0x102b, 0x0541, pci_subsys_102b_0525_102b_0541, 0}; +#undef pci_ss_info_102b_0541 +#define pci_ss_info_102b_0541 pci_ss_info_102b_0525_102b_0541 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0542 = + {0x102b, 0x0542, pci_subsys_102b_0525_102b_0542, 0}; +#undef pci_ss_info_102b_0542 +#define pci_ss_info_102b_0542 pci_ss_info_102b_0525_102b_0542 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0543 = + {0x102b, 0x0543, pci_subsys_102b_0525_102b_0543, 0}; +#undef pci_ss_info_102b_0543 +#define pci_ss_info_102b_0543 pci_ss_info_102b_0525_102b_0543 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0641 = + {0x102b, 0x0641, pci_subsys_102b_0525_102b_0641, 0}; +#undef pci_ss_info_102b_0641 +#define pci_ss_info_102b_0641 pci_ss_info_102b_0525_102b_0641 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0642 = + {0x102b, 0x0642, pci_subsys_102b_0525_102b_0642, 0}; +#undef pci_ss_info_102b_0642 +#define pci_ss_info_102b_0642 pci_ss_info_102b_0525_102b_0642 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0643 = + {0x102b, 0x0643, pci_subsys_102b_0525_102b_0643, 0}; +#undef pci_ss_info_102b_0643 +#define pci_ss_info_102b_0643 pci_ss_info_102b_0525_102b_0643 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_07c0 = + {0x102b, 0x07c0, pci_subsys_102b_0525_102b_07c0, 0}; +#undef pci_ss_info_102b_07c0 +#define pci_ss_info_102b_07c0 pci_ss_info_102b_0525_102b_07c0 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_07c1 = + {0x102b, 0x07c1, pci_subsys_102b_0525_102b_07c1, 0}; +#undef pci_ss_info_102b_07c1 +#define pci_ss_info_102b_07c1 pci_ss_info_102b_0525_102b_07c1 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0d41 = + {0x102b, 0x0d41, pci_subsys_102b_0525_102b_0d41, 0}; +#undef pci_ss_info_102b_0d41 +#define pci_ss_info_102b_0d41 pci_ss_info_102b_0525_102b_0d41 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0d42 = + {0x102b, 0x0d42, pci_subsys_102b_0525_102b_0d42, 0}; +#undef pci_ss_info_102b_0d42 +#define pci_ss_info_102b_0d42 pci_ss_info_102b_0525_102b_0d42 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0e00 = + {0x102b, 0x0e00, pci_subsys_102b_0525_102b_0e00, 0}; +#undef pci_ss_info_102b_0e00 +#define pci_ss_info_102b_0e00 pci_ss_info_102b_0525_102b_0e00 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0e01 = + {0x102b, 0x0e01, pci_subsys_102b_0525_102b_0e01, 0}; +#undef pci_ss_info_102b_0e01 +#define pci_ss_info_102b_0e01 pci_ss_info_102b_0525_102b_0e01 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0e02 = + {0x102b, 0x0e02, pci_subsys_102b_0525_102b_0e02, 0}; +#undef pci_ss_info_102b_0e02 +#define pci_ss_info_102b_0e02 pci_ss_info_102b_0525_102b_0e02 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0e03 = + {0x102b, 0x0e03, pci_subsys_102b_0525_102b_0e03, 0}; +#undef pci_ss_info_102b_0e03 +#define pci_ss_info_102b_0e03 pci_ss_info_102b_0525_102b_0e03 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0f80 = + {0x102b, 0x0f80, pci_subsys_102b_0525_102b_0f80, 0}; +#undef pci_ss_info_102b_0f80 +#define pci_ss_info_102b_0f80 pci_ss_info_102b_0525_102b_0f80 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0f81 = + {0x102b, 0x0f81, pci_subsys_102b_0525_102b_0f81, 0}; +#undef pci_ss_info_102b_0f81 +#define pci_ss_info_102b_0f81 pci_ss_info_102b_0525_102b_0f81 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0f82 = + {0x102b, 0x0f82, pci_subsys_102b_0525_102b_0f82, 0}; +#undef pci_ss_info_102b_0f82 +#define pci_ss_info_102b_0f82 pci_ss_info_102b_0525_102b_0f82 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_0f83 = + {0x102b, 0x0f83, pci_subsys_102b_0525_102b_0f83, 0}; +#undef pci_ss_info_102b_0f83 +#define pci_ss_info_102b_0f83 pci_ss_info_102b_0525_102b_0f83 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_19d8 = + {0x102b, 0x19d8, pci_subsys_102b_0525_102b_19d8, 0}; +#undef pci_ss_info_102b_19d8 +#define pci_ss_info_102b_19d8 pci_ss_info_102b_0525_102b_19d8 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_19f8 = + {0x102b, 0x19f8, pci_subsys_102b_0525_102b_19f8, 0}; +#undef pci_ss_info_102b_19f8 +#define pci_ss_info_102b_19f8 pci_ss_info_102b_0525_102b_19f8 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_2159 = + {0x102b, 0x2159, pci_subsys_102b_0525_102b_2159, 0}; +#undef pci_ss_info_102b_2159 +#define pci_ss_info_102b_2159 pci_ss_info_102b_0525_102b_2159 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_2179 = + {0x102b, 0x2179, pci_subsys_102b_0525_102b_2179, 0}; +#undef pci_ss_info_102b_2179 +#define pci_ss_info_102b_2179 pci_ss_info_102b_0525_102b_2179 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_217d = + {0x102b, 0x217d, pci_subsys_102b_0525_102b_217d, 0}; +#undef pci_ss_info_102b_217d +#define pci_ss_info_102b_217d pci_ss_info_102b_0525_102b_217d +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_23c0 = + {0x102b, 0x23c0, pci_subsys_102b_0525_102b_23c0, 0}; +#undef pci_ss_info_102b_23c0 +#define pci_ss_info_102b_23c0 pci_ss_info_102b_0525_102b_23c0 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_23c1 = + {0x102b, 0x23c1, pci_subsys_102b_0525_102b_23c1, 0}; +#undef pci_ss_info_102b_23c1 +#define pci_ss_info_102b_23c1 pci_ss_info_102b_0525_102b_23c1 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_23c2 = + {0x102b, 0x23c2, pci_subsys_102b_0525_102b_23c2, 0}; +#undef pci_ss_info_102b_23c2 +#define pci_ss_info_102b_23c2 pci_ss_info_102b_0525_102b_23c2 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_23c3 = + {0x102b, 0x23c3, pci_subsys_102b_0525_102b_23c3, 0}; +#undef pci_ss_info_102b_23c3 +#define pci_ss_info_102b_23c3 pci_ss_info_102b_0525_102b_23c3 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_2f58 = + {0x102b, 0x2f58, pci_subsys_102b_0525_102b_2f58, 0}; +#undef pci_ss_info_102b_2f58 +#define pci_ss_info_102b_2f58 pci_ss_info_102b_0525_102b_2f58 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_2f78 = + {0x102b, 0x2f78, pci_subsys_102b_0525_102b_2f78, 0}; +#undef pci_ss_info_102b_2f78 +#define pci_ss_info_102b_2f78 pci_ss_info_102b_0525_102b_2f78 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_3693 = + {0x102b, 0x3693, pci_subsys_102b_0525_102b_3693, 0}; +#undef pci_ss_info_102b_3693 +#define pci_ss_info_102b_3693 pci_ss_info_102b_0525_102b_3693 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_5dd0 = + {0x102b, 0x5dd0, pci_subsys_102b_0525_102b_5dd0, 0}; +#undef pci_ss_info_102b_5dd0 +#define pci_ss_info_102b_5dd0 pci_ss_info_102b_0525_102b_5dd0 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_5f50 = + {0x102b, 0x5f50, pci_subsys_102b_0525_102b_5f50, 0}; +#undef pci_ss_info_102b_5f50 +#define pci_ss_info_102b_5f50 pci_ss_info_102b_0525_102b_5f50 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_5f51 = + {0x102b, 0x5f51, pci_subsys_102b_0525_102b_5f51, 0}; +#undef pci_ss_info_102b_5f51 +#define pci_ss_info_102b_5f51 pci_ss_info_102b_0525_102b_5f51 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_5f52 = + {0x102b, 0x5f52, pci_subsys_102b_0525_102b_5f52, 0}; +#undef pci_ss_info_102b_5f52 +#define pci_ss_info_102b_5f52 pci_ss_info_102b_0525_102b_5f52 +static const pciSubsystemInfo pci_ss_info_102b_0525_102b_9010 = + {0x102b, 0x9010, pci_subsys_102b_0525_102b_9010, 0}; +#undef pci_ss_info_102b_9010 +#define pci_ss_info_102b_9010 pci_ss_info_102b_0525_102b_9010 +static const pciSubsystemInfo pci_ss_info_102b_0525_1458_0400 = + {0x1458, 0x0400, pci_subsys_102b_0525_1458_0400, 0}; +#undef pci_ss_info_1458_0400 +#define pci_ss_info_1458_0400 pci_ss_info_102b_0525_1458_0400 +static const pciSubsystemInfo pci_ss_info_102b_0525_1705_0001 = + {0x1705, 0x0001, pci_subsys_102b_0525_1705_0001, 0}; +#undef pci_ss_info_1705_0001 +#define pci_ss_info_1705_0001 pci_ss_info_102b_0525_1705_0001 +static const pciSubsystemInfo pci_ss_info_102b_0525_1705_0002 = + {0x1705, 0x0002, pci_subsys_102b_0525_1705_0002, 0}; +#undef pci_ss_info_1705_0002 +#define pci_ss_info_1705_0002 pci_ss_info_102b_0525_1705_0002 +static const pciSubsystemInfo pci_ss_info_102b_0525_1705_0003 = + {0x1705, 0x0003, pci_subsys_102b_0525_1705_0003, 0}; +#undef pci_ss_info_1705_0003 +#define pci_ss_info_1705_0003 pci_ss_info_102b_0525_1705_0003 +static const pciSubsystemInfo pci_ss_info_102b_0525_1705_0004 = + {0x1705, 0x0004, pci_subsys_102b_0525_1705_0004, 0}; +#undef pci_ss_info_1705_0004 +#define pci_ss_info_1705_0004 pci_ss_info_102b_0525_1705_0004 +static const pciSubsystemInfo pci_ss_info_102b_0527_102b_0840 = + {0x102b, 0x0840, pci_subsys_102b_0527_102b_0840, 0}; +#undef pci_ss_info_102b_0840 +#define pci_ss_info_102b_0840 pci_ss_info_102b_0527_102b_0840 +static const pciSubsystemInfo pci_ss_info_102b_1000_102b_ff01 = + {0x102b, 0xff01, pci_subsys_102b_1000_102b_ff01, 0}; +#undef pci_ss_info_102b_ff01 +#define pci_ss_info_102b_ff01 pci_ss_info_102b_1000_102b_ff01 +static const pciSubsystemInfo pci_ss_info_102b_1000_102b_ff05 = + {0x102b, 0xff05, pci_subsys_102b_1000_102b_ff05, 0}; +#undef pci_ss_info_102b_ff05 +#define pci_ss_info_102b_ff05 pci_ss_info_102b_1000_102b_ff05 +static const pciSubsystemInfo pci_ss_info_102b_1001_102b_1001 = + {0x102b, 0x1001, pci_subsys_102b_1001_102b_1001, 0}; +#undef pci_ss_info_102b_1001 +#define pci_ss_info_102b_1001 pci_ss_info_102b_1001_102b_1001 +static const pciSubsystemInfo pci_ss_info_102b_1001_102b_ff00 = + {0x102b, 0xff00, pci_subsys_102b_1001_102b_ff00, 0}; +#undef pci_ss_info_102b_ff00 +#define pci_ss_info_102b_ff00 pci_ss_info_102b_1001_102b_ff00 +static const pciSubsystemInfo pci_ss_info_102b_1001_102b_ff01 = + {0x102b, 0xff01, pci_subsys_102b_1001_102b_ff01, 0}; +#undef pci_ss_info_102b_ff01 +#define pci_ss_info_102b_ff01 pci_ss_info_102b_1001_102b_ff01 +static const pciSubsystemInfo pci_ss_info_102b_1001_102b_ff03 = + {0x102b, 0xff03, pci_subsys_102b_1001_102b_ff03, 0}; +#undef pci_ss_info_102b_ff03 +#define pci_ss_info_102b_ff03 pci_ss_info_102b_1001_102b_ff03 +static const pciSubsystemInfo pci_ss_info_102b_1001_102b_ff04 = + {0x102b, 0xff04, pci_subsys_102b_1001_102b_ff04, 0}; +#undef pci_ss_info_102b_ff04 +#define pci_ss_info_102b_ff04 pci_ss_info_102b_1001_102b_ff04 +static const pciSubsystemInfo pci_ss_info_102b_1001_102b_ff05 = + {0x102b, 0xff05, pci_subsys_102b_1001_102b_ff05, 0}; +#undef pci_ss_info_102b_ff05 +#define pci_ss_info_102b_ff05 pci_ss_info_102b_1001_102b_ff05 +static const pciSubsystemInfo pci_ss_info_102b_1001_110a_001e = + {0x110a, 0x001e, pci_subsys_102b_1001_110a_001e, 0}; +#undef pci_ss_info_110a_001e +#define pci_ss_info_110a_001e pci_ss_info_102b_1001_110a_001e +static const pciSubsystemInfo pci_ss_info_102b_2527_102b_0f83 = + {0x102b, 0x0f83, pci_subsys_102b_2527_102b_0f83, 0}; +#undef pci_ss_info_102b_0f83 +#define pci_ss_info_102b_0f83 pci_ss_info_102b_2527_102b_0f83 +static const pciSubsystemInfo pci_ss_info_102b_2527_102b_0f84 = + {0x102b, 0x0f84, pci_subsys_102b_2527_102b_0f84, 0}; +#undef pci_ss_info_102b_0f84 +#define pci_ss_info_102b_0f84 pci_ss_info_102b_2527_102b_0f84 +static const pciSubsystemInfo pci_ss_info_102b_2527_102b_1e41 = + {0x102b, 0x1e41, pci_subsys_102b_2527_102b_1e41, 0}; +#undef pci_ss_info_102b_1e41 +#define pci_ss_info_102b_1e41 pci_ss_info_102b_2527_102b_1e41 +static const pciSubsystemInfo pci_ss_info_102c_00c0_102c_00c0 = + {0x102c, 0x00c0, pci_subsys_102c_00c0_102c_00c0, 0}; +#undef pci_ss_info_102c_00c0 +#define pci_ss_info_102c_00c0 pci_ss_info_102c_00c0_102c_00c0 +static const pciSubsystemInfo pci_ss_info_102c_00e5_0e11_b049 = + {0x0e11, 0xb049, pci_subsys_102c_00e5_0e11_b049, 0}; +#undef pci_ss_info_0e11_b049 +#define pci_ss_info_0e11_b049 pci_ss_info_102c_00e5_0e11_b049 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_102f_0020_102f_00f8 = + {0x102f, 0x00f8, pci_subsys_102f_0020_102f_00f8, 0}; +#undef pci_ss_info_102f_00f8 +#define pci_ss_info_102f_00f8 pci_ss_info_102f_0020_102f_00f8 +#endif +static const pciSubsystemInfo pci_ss_info_1033_0035_1179_0001 = + {0x1179, 0x0001, pci_subsys_1033_0035_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1033_0035_1179_0001 +static const pciSubsystemInfo pci_ss_info_1033_0035_12ee_7000 = + {0x12ee, 0x7000, pci_subsys_1033_0035_12ee_7000, 0}; +#undef pci_ss_info_12ee_7000 +#define pci_ss_info_12ee_7000 pci_ss_info_1033_0035_12ee_7000 +static const pciSubsystemInfo pci_ss_info_1033_0035_1799_0001 = + {0x1799, 0x0001, pci_subsys_1033_0035_1799_0001, 0}; +#undef pci_ss_info_1799_0001 +#define pci_ss_info_1799_0001 pci_ss_info_1033_0035_1799_0001 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_0020 = + {0x1010, 0x0020, pci_subsys_1033_0067_1010_0020, 0}; +#undef pci_ss_info_1010_0020 +#define pci_ss_info_1010_0020 pci_ss_info_1033_0067_1010_0020 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_0080 = + {0x1010, 0x0080, pci_subsys_1033_0067_1010_0080, 0}; +#undef pci_ss_info_1010_0080 +#define pci_ss_info_1010_0080 pci_ss_info_1033_0067_1010_0080 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_0088 = + {0x1010, 0x0088, pci_subsys_1033_0067_1010_0088, 0}; +#undef pci_ss_info_1010_0088 +#define pci_ss_info_1010_0088 pci_ss_info_1033_0067_1010_0088 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_0090 = + {0x1010, 0x0090, pci_subsys_1033_0067_1010_0090, 0}; +#undef pci_ss_info_1010_0090 +#define pci_ss_info_1010_0090 pci_ss_info_1033_0067_1010_0090 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_0098 = + {0x1010, 0x0098, pci_subsys_1033_0067_1010_0098, 0}; +#undef pci_ss_info_1010_0098 +#define pci_ss_info_1010_0098 pci_ss_info_1033_0067_1010_0098 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_00a0 = + {0x1010, 0x00a0, pci_subsys_1033_0067_1010_00a0, 0}; +#undef pci_ss_info_1010_00a0 +#define pci_ss_info_1010_00a0 pci_ss_info_1033_0067_1010_00a0 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_00a8 = + {0x1010, 0x00a8, pci_subsys_1033_0067_1010_00a8, 0}; +#undef pci_ss_info_1010_00a8 +#define pci_ss_info_1010_00a8 pci_ss_info_1033_0067_1010_00a8 +static const pciSubsystemInfo pci_ss_info_1033_0067_1010_0120 = + {0x1010, 0x0120, pci_subsys_1033_0067_1010_0120, 0}; +#undef pci_ss_info_1010_0120 +#define pci_ss_info_1010_0120 pci_ss_info_1033_0067_1010_0120 +static const pciSubsystemInfo pci_ss_info_1033_0074_1033_8014 = + {0x1033, 0x8014, pci_subsys_1033_0074_1033_8014, 0}; +#undef pci_ss_info_1033_8014 +#define pci_ss_info_1033_8014 pci_ss_info_1033_0074_1033_8014 +static const pciSubsystemInfo pci_ss_info_1033_00cd_12ee_8011 = + {0x12ee, 0x8011, pci_subsys_1033_00cd_12ee_8011, 0}; +#undef pci_ss_info_12ee_8011 +#define pci_ss_info_12ee_8011 pci_ss_info_1033_00cd_12ee_8011 +static const pciSubsystemInfo pci_ss_info_1033_00e0_12ee_7001 = + {0x12ee, 0x7001, pci_subsys_1033_00e0_12ee_7001, 0}; +#undef pci_ss_info_12ee_7001 +#define pci_ss_info_12ee_7001 pci_ss_info_1033_00e0_12ee_7001 +static const pciSubsystemInfo pci_ss_info_1033_00e0_1799_0002 = + {0x1799, 0x0002, pci_subsys_1033_00e0_1799_0002, 0}; +#undef pci_ss_info_1799_0002 +#define pci_ss_info_1799_0002 pci_ss_info_1033_00e0_1799_0002 +static const pciSubsystemInfo pci_ss_info_1039_0200_1039_0000 = + {0x1039, 0x0000, pci_subsys_1039_0200_1039_0000, 0}; +#undef pci_ss_info_1039_0000 +#define pci_ss_info_1039_0000 pci_ss_info_1039_0200_1039_0000 +static const pciSubsystemInfo pci_ss_info_1039_0300_107d_2720 = + {0x107d, 0x2720, pci_subsys_1039_0300_107d_2720, 0}; +#undef pci_ss_info_107d_2720 +#define pci_ss_info_107d_2720 pci_ss_info_1039_0300_107d_2720 +static const pciSubsystemInfo pci_ss_info_1039_0900_1039_0900 = + {0x1039, 0x0900, pci_subsys_1039_0900_1039_0900, 0}; +#undef pci_ss_info_1039_0900 +#define pci_ss_info_1039_0900 pci_ss_info_1039_0900_1039_0900 +static const pciSubsystemInfo pci_ss_info_1039_5513_1019_0970 = + {0x1019, 0x0970, pci_subsys_1039_5513_1019_0970, 0}; +#undef pci_ss_info_1019_0970 +#define pci_ss_info_1019_0970 pci_ss_info_1039_5513_1019_0970 +static const pciSubsystemInfo pci_ss_info_1039_5513_1039_5513 = + {0x1039, 0x5513, pci_subsys_1039_5513_1039_5513, 0}; +#undef pci_ss_info_1039_5513 +#define pci_ss_info_1039_5513 pci_ss_info_1039_5513_1039_5513 +static const pciSubsystemInfo pci_ss_info_1039_6300_1019_0970 = + {0x1019, 0x0970, pci_subsys_1039_6300_1019_0970, 0}; +#undef pci_ss_info_1019_0970 +#define pci_ss_info_1019_0970 pci_ss_info_1039_6300_1019_0970 +static const pciSubsystemInfo pci_ss_info_1039_6306_1039_6306 = + {0x1039, 0x6306, pci_subsys_1039_6306_1039_6306, 0}; +#undef pci_ss_info_1039_6306 +#define pci_ss_info_1039_6306 pci_ss_info_1039_6306_1039_6306 +static const pciSubsystemInfo pci_ss_info_1039_6326_1039_6326 = + {0x1039, 0x6326, pci_subsys_1039_6326_1039_6326, 0}; +#undef pci_ss_info_1039_6326 +#define pci_ss_info_1039_6326 pci_ss_info_1039_6326_1039_6326 +static const pciSubsystemInfo pci_ss_info_1039_6326_1092_0a50 = + {0x1092, 0x0a50, pci_subsys_1039_6326_1092_0a50, 0}; +#undef pci_ss_info_1092_0a50 +#define pci_ss_info_1092_0a50 pci_ss_info_1039_6326_1092_0a50 +static const pciSubsystemInfo pci_ss_info_1039_6326_1092_0a70 = + {0x1092, 0x0a70, pci_subsys_1039_6326_1092_0a70, 0}; +#undef pci_ss_info_1092_0a70 +#define pci_ss_info_1092_0a70 pci_ss_info_1039_6326_1092_0a70 +static const pciSubsystemInfo pci_ss_info_1039_6326_1092_4910 = + {0x1092, 0x4910, pci_subsys_1039_6326_1092_4910, 0}; +#undef pci_ss_info_1092_4910 +#define pci_ss_info_1092_4910 pci_ss_info_1039_6326_1092_4910 +static const pciSubsystemInfo pci_ss_info_1039_6326_1092_4920 = + {0x1092, 0x4920, pci_subsys_1039_6326_1092_4920, 0}; +#undef pci_ss_info_1092_4920 +#define pci_ss_info_1092_4920 pci_ss_info_1039_6326_1092_4920 +static const pciSubsystemInfo pci_ss_info_1039_6326_1569_6326 = + {0x1569, 0x6326, pci_subsys_1039_6326_1569_6326, 0}; +#undef pci_ss_info_1569_6326 +#define pci_ss_info_1569_6326 pci_ss_info_1039_6326_1569_6326 +static const pciSubsystemInfo pci_ss_info_1039_7001_1039_7000 = + {0x1039, 0x7000, pci_subsys_1039_7001_1039_7000, 0}; +#undef pci_ss_info_1039_7000 +#define pci_ss_info_1039_7000 pci_ss_info_1039_7001_1039_7000 +static const pciSubsystemInfo pci_ss_info_1039_7002_1509_7002 = + {0x1509, 0x7002, pci_subsys_1039_7002_1509_7002, 0}; +#undef pci_ss_info_1509_7002 +#define pci_ss_info_1509_7002 pci_ss_info_1039_7002_1509_7002 +static const pciSubsystemInfo pci_ss_info_1039_7016_1039_7016 = + {0x1039, 0x7016, pci_subsys_1039_7016_1039_7016, 0}; +#undef pci_ss_info_1039_7016 +#define pci_ss_info_1039_7016 pci_ss_info_1039_7016_1039_7016 +static const pciSubsystemInfo pci_ss_info_1039_7018_1014_01b6 = + {0x1014, 0x01b6, pci_subsys_1039_7018_1014_01b6, 0}; +#undef pci_ss_info_1014_01b6 +#define pci_ss_info_1014_01b6 pci_ss_info_1039_7018_1014_01b6 +static const pciSubsystemInfo pci_ss_info_1039_7018_1014_01b7 = + {0x1014, 0x01b7, pci_subsys_1039_7018_1014_01b7, 0}; +#undef pci_ss_info_1014_01b7 +#define pci_ss_info_1014_01b7 pci_ss_info_1039_7018_1014_01b7 +static const pciSubsystemInfo pci_ss_info_1039_7018_1019_7018 = + {0x1019, 0x7018, pci_subsys_1039_7018_1019_7018, 0}; +#undef pci_ss_info_1019_7018 +#define pci_ss_info_1019_7018 pci_ss_info_1039_7018_1019_7018 +static const pciSubsystemInfo pci_ss_info_1039_7018_1025_000e = + {0x1025, 0x000e, pci_subsys_1039_7018_1025_000e, 0}; +#undef pci_ss_info_1025_000e +#define pci_ss_info_1025_000e pci_ss_info_1039_7018_1025_000e +static const pciSubsystemInfo pci_ss_info_1039_7018_1025_0018 = + {0x1025, 0x0018, pci_subsys_1039_7018_1025_0018, 0}; +#undef pci_ss_info_1025_0018 +#define pci_ss_info_1025_0018 pci_ss_info_1039_7018_1025_0018 +static const pciSubsystemInfo pci_ss_info_1039_7018_1039_7018 = + {0x1039, 0x7018, pci_subsys_1039_7018_1039_7018, 0}; +#undef pci_ss_info_1039_7018 +#define pci_ss_info_1039_7018 pci_ss_info_1039_7018_1039_7018 +static const pciSubsystemInfo pci_ss_info_1039_7018_1043_800b = + {0x1043, 0x800b, pci_subsys_1039_7018_1043_800b, 0}; +#undef pci_ss_info_1043_800b +#define pci_ss_info_1043_800b pci_ss_info_1039_7018_1043_800b +static const pciSubsystemInfo pci_ss_info_1039_7018_1054_7018 = + {0x1054, 0x7018, pci_subsys_1039_7018_1054_7018, 0}; +#undef pci_ss_info_1054_7018 +#define pci_ss_info_1054_7018 pci_ss_info_1039_7018_1054_7018 +static const pciSubsystemInfo pci_ss_info_1039_7018_107d_5330 = + {0x107d, 0x5330, pci_subsys_1039_7018_107d_5330, 0}; +#undef pci_ss_info_107d_5330 +#define pci_ss_info_107d_5330 pci_ss_info_1039_7018_107d_5330 +static const pciSubsystemInfo pci_ss_info_1039_7018_107d_5350 = + {0x107d, 0x5350, pci_subsys_1039_7018_107d_5350, 0}; +#undef pci_ss_info_107d_5350 +#define pci_ss_info_107d_5350 pci_ss_info_1039_7018_107d_5350 +static const pciSubsystemInfo pci_ss_info_1039_7018_1170_3209 = + {0x1170, 0x3209, pci_subsys_1039_7018_1170_3209, 0}; +#undef pci_ss_info_1170_3209 +#define pci_ss_info_1170_3209 pci_ss_info_1039_7018_1170_3209 +static const pciSubsystemInfo pci_ss_info_1039_7018_1462_400a = + {0x1462, 0x400a, pci_subsys_1039_7018_1462_400a, 0}; +#undef pci_ss_info_1462_400a +#define pci_ss_info_1462_400a pci_ss_info_1039_7018_1462_400a +static const pciSubsystemInfo pci_ss_info_1039_7018_14a4_2089 = + {0x14a4, 0x2089, pci_subsys_1039_7018_14a4_2089, 0}; +#undef pci_ss_info_14a4_2089 +#define pci_ss_info_14a4_2089 pci_ss_info_1039_7018_14a4_2089 +static const pciSubsystemInfo pci_ss_info_1039_7018_14cd_2194 = + {0x14cd, 0x2194, pci_subsys_1039_7018_14cd_2194, 0}; +#undef pci_ss_info_14cd_2194 +#define pci_ss_info_14cd_2194 pci_ss_info_1039_7018_14cd_2194 +static const pciSubsystemInfo pci_ss_info_1039_7018_14ff_1100 = + {0x14ff, 0x1100, pci_subsys_1039_7018_14ff_1100, 0}; +#undef pci_ss_info_14ff_1100 +#define pci_ss_info_14ff_1100 pci_ss_info_1039_7018_14ff_1100 +static const pciSubsystemInfo pci_ss_info_1039_7018_152d_8808 = + {0x152d, 0x8808, pci_subsys_1039_7018_152d_8808, 0}; +#undef pci_ss_info_152d_8808 +#define pci_ss_info_152d_8808 pci_ss_info_1039_7018_152d_8808 +static const pciSubsystemInfo pci_ss_info_1039_7018_1558_1103 = + {0x1558, 0x1103, pci_subsys_1039_7018_1558_1103, 0}; +#undef pci_ss_info_1558_1103 +#define pci_ss_info_1558_1103 pci_ss_info_1039_7018_1558_1103 +static const pciSubsystemInfo pci_ss_info_1039_7018_1558_2200 = + {0x1558, 0x2200, pci_subsys_1039_7018_1558_2200, 0}; +#undef pci_ss_info_1558_2200 +#define pci_ss_info_1558_2200 pci_ss_info_1039_7018_1558_2200 +static const pciSubsystemInfo pci_ss_info_1039_7018_1563_7018 = + {0x1563, 0x7018, pci_subsys_1039_7018_1563_7018, 0}; +#undef pci_ss_info_1563_7018 +#define pci_ss_info_1563_7018 pci_ss_info_1039_7018_1563_7018 +static const pciSubsystemInfo pci_ss_info_1039_7018_15c5_0111 = + {0x15c5, 0x0111, pci_subsys_1039_7018_15c5_0111, 0}; +#undef pci_ss_info_15c5_0111 +#define pci_ss_info_15c5_0111 pci_ss_info_1039_7018_15c5_0111 +static const pciSubsystemInfo pci_ss_info_1039_7018_270f_a171 = + {0x270f, 0xa171, pci_subsys_1039_7018_270f_a171, 0}; +#undef pci_ss_info_270f_a171 +#define pci_ss_info_270f_a171 pci_ss_info_1039_7018_270f_a171 +static const pciSubsystemInfo pci_ss_info_1039_7018_a0a0_0022 = + {0xa0a0, 0x0022, pci_subsys_1039_7018_a0a0_0022, 0}; +#undef pci_ss_info_a0a0_0022 +#define pci_ss_info_a0a0_0022 pci_ss_info_1039_7018_a0a0_0022 +static const pciSubsystemInfo pci_ss_info_103c_1029_107e_000f = + {0x107e, 0x000f, pci_subsys_103c_1029_107e_000f, 0}; +#undef pci_ss_info_107e_000f +#define pci_ss_info_107e_000f pci_ss_info_103c_1029_107e_000f +static const pciSubsystemInfo pci_ss_info_103c_1029_9004_9210 = + {0x9004, 0x9210, pci_subsys_103c_1029_9004_9210, 0}; +#undef pci_ss_info_9004_9210 +#define pci_ss_info_9004_9210 pci_ss_info_103c_1029_9004_9210 +static const pciSubsystemInfo pci_ss_info_103c_1029_9004_9211 = + {0x9004, 0x9211, pci_subsys_103c_1029_9004_9211, 0}; +#undef pci_ss_info_9004_9211 +#define pci_ss_info_9004_9211 pci_ss_info_103c_1029_9004_9211 +static const pciSubsystemInfo pci_ss_info_103c_102a_107e_000e = + {0x107e, 0x000e, pci_subsys_103c_102a_107e_000e, 0}; +#undef pci_ss_info_107e_000e +#define pci_ss_info_107e_000e pci_ss_info_103c_102a_107e_000e +static const pciSubsystemInfo pci_ss_info_103c_102a_9004_9110 = + {0x9004, 0x9110, pci_subsys_103c_102a_9004_9110, 0}; +#undef pci_ss_info_9004_9110 +#define pci_ss_info_9004_9110 pci_ss_info_103c_102a_9004_9110 +static const pciSubsystemInfo pci_ss_info_103c_102a_9004_9111 = + {0x9004, 0x9111, pci_subsys_103c_102a_9004_9111, 0}; +#undef pci_ss_info_9004_9111 +#define pci_ss_info_9004_9111 pci_ss_info_103c_102a_9004_9111 +static const pciSubsystemInfo pci_ss_info_103c_1031_103c_1040 = + {0x103c, 0x1040, pci_subsys_103c_1031_103c_1040, 0}; +#undef pci_ss_info_103c_1040 +#define pci_ss_info_103c_1040 pci_ss_info_103c_1031_103c_1040 +static const pciSubsystemInfo pci_ss_info_103c_1031_103c_1041 = + {0x103c, 0x1041, pci_subsys_103c_1031_103c_1041, 0}; +#undef pci_ss_info_103c_1041 +#define pci_ss_info_103c_1041 pci_ss_info_103c_1031_103c_1041 +static const pciSubsystemInfo pci_ss_info_103c_1031_103c_1042 = + {0x103c, 0x1042, pci_subsys_103c_1031_103c_1042, 0}; +#undef pci_ss_info_103c_1042 +#define pci_ss_info_103c_1042 pci_ss_info_103c_1031_103c_1042 +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_1049 = + {0x103c, 0x1049, pci_subsys_103c_1048_103c_1049, 0}; +#undef pci_ss_info_103c_1049 +#define pci_ss_info_103c_1049 pci_ss_info_103c_1048_103c_1049 +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_104a = + {0x103c, 0x104a, pci_subsys_103c_1048_103c_104a, 0}; +#undef pci_ss_info_103c_104a +#define pci_ss_info_103c_104a pci_ss_info_103c_1048_103c_104a +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_104b = + {0x103c, 0x104b, pci_subsys_103c_1048_103c_104b, 0}; +#undef pci_ss_info_103c_104b +#define pci_ss_info_103c_104b pci_ss_info_103c_1048_103c_104b +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_1223 = + {0x103c, 0x1223, pci_subsys_103c_1048_103c_1223, 0}; +#undef pci_ss_info_103c_1223 +#define pci_ss_info_103c_1223 pci_ss_info_103c_1048_103c_1223 +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_1226 = + {0x103c, 0x1226, pci_subsys_103c_1048_103c_1226, 0}; +#undef pci_ss_info_103c_1226 +#define pci_ss_info_103c_1226 pci_ss_info_103c_1048_103c_1226 +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_1227 = + {0x103c, 0x1227, pci_subsys_103c_1048_103c_1227, 0}; +#undef pci_ss_info_103c_1227 +#define pci_ss_info_103c_1227 pci_ss_info_103c_1048_103c_1227 +static const pciSubsystemInfo pci_ss_info_103c_1048_103c_1282 = + {0x103c, 0x1282, pci_subsys_103c_1048_103c_1282, 0}; +#undef pci_ss_info_103c_1282 +#define pci_ss_info_103c_1282 pci_ss_info_103c_1048_103c_1282 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c001 = + {0x1044, 0xc001, pci_subsys_1044_a501_1044_c001, 0}; +#undef pci_ss_info_1044_c001 +#define pci_ss_info_1044_c001 pci_ss_info_1044_a501_1044_c001 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c002 = + {0x1044, 0xc002, pci_subsys_1044_a501_1044_c002, 0}; +#undef pci_ss_info_1044_c002 +#define pci_ss_info_1044_c002 pci_ss_info_1044_a501_1044_c002 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c003 = + {0x1044, 0xc003, pci_subsys_1044_a501_1044_c003, 0}; +#undef pci_ss_info_1044_c003 +#define pci_ss_info_1044_c003 pci_ss_info_1044_a501_1044_c003 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c004 = + {0x1044, 0xc004, pci_subsys_1044_a501_1044_c004, 0}; +#undef pci_ss_info_1044_c004 +#define pci_ss_info_1044_c004 pci_ss_info_1044_a501_1044_c004 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c005 = + {0x1044, 0xc005, pci_subsys_1044_a501_1044_c005, 0}; +#undef pci_ss_info_1044_c005 +#define pci_ss_info_1044_c005 pci_ss_info_1044_a501_1044_c005 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c00a = + {0x1044, 0xc00a, pci_subsys_1044_a501_1044_c00a, 0}; +#undef pci_ss_info_1044_c00a +#define pci_ss_info_1044_c00a pci_ss_info_1044_a501_1044_c00a +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c00b = + {0x1044, 0xc00b, pci_subsys_1044_a501_1044_c00b, 0}; +#undef pci_ss_info_1044_c00b +#define pci_ss_info_1044_c00b pci_ss_info_1044_a501_1044_c00b +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c00c = + {0x1044, 0xc00c, pci_subsys_1044_a501_1044_c00c, 0}; +#undef pci_ss_info_1044_c00c +#define pci_ss_info_1044_c00c pci_ss_info_1044_a501_1044_c00c +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c00d = + {0x1044, 0xc00d, pci_subsys_1044_a501_1044_c00d, 0}; +#undef pci_ss_info_1044_c00d +#define pci_ss_info_1044_c00d pci_ss_info_1044_a501_1044_c00d +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c00e = + {0x1044, 0xc00e, pci_subsys_1044_a501_1044_c00e, 0}; +#undef pci_ss_info_1044_c00e +#define pci_ss_info_1044_c00e pci_ss_info_1044_a501_1044_c00e +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c00f = + {0x1044, 0xc00f, pci_subsys_1044_a501_1044_c00f, 0}; +#undef pci_ss_info_1044_c00f +#define pci_ss_info_1044_c00f pci_ss_info_1044_a501_1044_c00f +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c014 = + {0x1044, 0xc014, pci_subsys_1044_a501_1044_c014, 0}; +#undef pci_ss_info_1044_c014 +#define pci_ss_info_1044_c014 pci_ss_info_1044_a501_1044_c014 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c015 = + {0x1044, 0xc015, pci_subsys_1044_a501_1044_c015, 0}; +#undef pci_ss_info_1044_c015 +#define pci_ss_info_1044_c015 pci_ss_info_1044_a501_1044_c015 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c016 = + {0x1044, 0xc016, pci_subsys_1044_a501_1044_c016, 0}; +#undef pci_ss_info_1044_c016 +#define pci_ss_info_1044_c016 pci_ss_info_1044_a501_1044_c016 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c01e = + {0x1044, 0xc01e, pci_subsys_1044_a501_1044_c01e, 0}; +#undef pci_ss_info_1044_c01e +#define pci_ss_info_1044_c01e pci_ss_info_1044_a501_1044_c01e +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c01f = + {0x1044, 0xc01f, pci_subsys_1044_a501_1044_c01f, 0}; +#undef pci_ss_info_1044_c01f +#define pci_ss_info_1044_c01f pci_ss_info_1044_a501_1044_c01f +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c020 = + {0x1044, 0xc020, pci_subsys_1044_a501_1044_c020, 0}; +#undef pci_ss_info_1044_c020 +#define pci_ss_info_1044_c020 pci_ss_info_1044_a501_1044_c020 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c021 = + {0x1044, 0xc021, pci_subsys_1044_a501_1044_c021, 0}; +#undef pci_ss_info_1044_c021 +#define pci_ss_info_1044_c021 pci_ss_info_1044_a501_1044_c021 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c028 = + {0x1044, 0xc028, pci_subsys_1044_a501_1044_c028, 0}; +#undef pci_ss_info_1044_c028 +#define pci_ss_info_1044_c028 pci_ss_info_1044_a501_1044_c028 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c029 = + {0x1044, 0xc029, pci_subsys_1044_a501_1044_c029, 0}; +#undef pci_ss_info_1044_c029 +#define pci_ss_info_1044_c029 pci_ss_info_1044_a501_1044_c029 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c02a = + {0x1044, 0xc02a, pci_subsys_1044_a501_1044_c02a, 0}; +#undef pci_ss_info_1044_c02a +#define pci_ss_info_1044_c02a pci_ss_info_1044_a501_1044_c02a +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c03c = + {0x1044, 0xc03c, pci_subsys_1044_a501_1044_c03c, 0}; +#undef pci_ss_info_1044_c03c +#define pci_ss_info_1044_c03c pci_ss_info_1044_a501_1044_c03c +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c03d = + {0x1044, 0xc03d, pci_subsys_1044_a501_1044_c03d, 0}; +#undef pci_ss_info_1044_c03d +#define pci_ss_info_1044_c03d pci_ss_info_1044_a501_1044_c03d +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c03e = + {0x1044, 0xc03e, pci_subsys_1044_a501_1044_c03e, 0}; +#undef pci_ss_info_1044_c03e +#define pci_ss_info_1044_c03e pci_ss_info_1044_a501_1044_c03e +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c046 = + {0x1044, 0xc046, pci_subsys_1044_a501_1044_c046, 0}; +#undef pci_ss_info_1044_c046 +#define pci_ss_info_1044_c046 pci_ss_info_1044_a501_1044_c046 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c047 = + {0x1044, 0xc047, pci_subsys_1044_a501_1044_c047, 0}; +#undef pci_ss_info_1044_c047 +#define pci_ss_info_1044_c047 pci_ss_info_1044_a501_1044_c047 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c048 = + {0x1044, 0xc048, pci_subsys_1044_a501_1044_c048, 0}; +#undef pci_ss_info_1044_c048 +#define pci_ss_info_1044_c048 pci_ss_info_1044_a501_1044_c048 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c050 = + {0x1044, 0xc050, pci_subsys_1044_a501_1044_c050, 0}; +#undef pci_ss_info_1044_c050 +#define pci_ss_info_1044_c050 pci_ss_info_1044_a501_1044_c050 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c051 = + {0x1044, 0xc051, pci_subsys_1044_a501_1044_c051, 0}; +#undef pci_ss_info_1044_c051 +#define pci_ss_info_1044_c051 pci_ss_info_1044_a501_1044_c051 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c052 = + {0x1044, 0xc052, pci_subsys_1044_a501_1044_c052, 0}; +#undef pci_ss_info_1044_c052 +#define pci_ss_info_1044_c052 pci_ss_info_1044_a501_1044_c052 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c05a = + {0x1044, 0xc05a, pci_subsys_1044_a501_1044_c05a, 0}; +#undef pci_ss_info_1044_c05a +#define pci_ss_info_1044_c05a pci_ss_info_1044_a501_1044_c05a +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c05b = + {0x1044, 0xc05b, pci_subsys_1044_a501_1044_c05b, 0}; +#undef pci_ss_info_1044_c05b +#define pci_ss_info_1044_c05b pci_ss_info_1044_a501_1044_c05b +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c064 = + {0x1044, 0xc064, pci_subsys_1044_a501_1044_c064, 0}; +#undef pci_ss_info_1044_c064 +#define pci_ss_info_1044_c064 pci_ss_info_1044_a501_1044_c064 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c065 = + {0x1044, 0xc065, pci_subsys_1044_a501_1044_c065, 0}; +#undef pci_ss_info_1044_c065 +#define pci_ss_info_1044_c065 pci_ss_info_1044_a501_1044_c065 +static const pciSubsystemInfo pci_ss_info_1044_a501_1044_c066 = + {0x1044, 0xc066, pci_subsys_1044_a501_1044_c066, 0}; +#undef pci_ss_info_1044_c066 +#define pci_ss_info_1044_c066 pci_ss_info_1044_a501_1044_c066 +#endif +static const pciSubsystemInfo pci_ss_info_104c_3d07_1011_4d10 = + {0x1011, 0x4d10, pci_subsys_104c_3d07_1011_4d10, 0}; +#undef pci_ss_info_1011_4d10 +#define pci_ss_info_1011_4d10 pci_ss_info_104c_3d07_1011_4d10 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1040_000f = + {0x1040, 0x000f, pci_subsys_104c_3d07_1040_000f, 0}; +#undef pci_ss_info_1040_000f +#define pci_ss_info_1040_000f pci_ss_info_104c_3d07_1040_000f +static const pciSubsystemInfo pci_ss_info_104c_3d07_1040_0011 = + {0x1040, 0x0011, pci_subsys_104c_3d07_1040_0011, 0}; +#undef pci_ss_info_1040_0011 +#define pci_ss_info_1040_0011 pci_ss_info_104c_3d07_1040_0011 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1048_0a31 = + {0x1048, 0x0a31, pci_subsys_104c_3d07_1048_0a31, 0}; +#undef pci_ss_info_1048_0a31 +#define pci_ss_info_1048_0a31 pci_ss_info_104c_3d07_1048_0a31 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1048_0a32 = + {0x1048, 0x0a32, pci_subsys_104c_3d07_1048_0a32, 0}; +#undef pci_ss_info_1048_0a32 +#define pci_ss_info_1048_0a32 pci_ss_info_104c_3d07_1048_0a32 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1048_0a35 = + {0x1048, 0x0a35, pci_subsys_104c_3d07_1048_0a35, 0}; +#undef pci_ss_info_1048_0a35 +#define pci_ss_info_1048_0a35 pci_ss_info_104c_3d07_1048_0a35 +static const pciSubsystemInfo pci_ss_info_104c_3d07_107d_2633 = + {0x107d, 0x2633, pci_subsys_104c_3d07_107d_2633, 0}; +#undef pci_ss_info_107d_2633 +#define pci_ss_info_107d_2633 pci_ss_info_104c_3d07_107d_2633 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0127 = + {0x1092, 0x0127, pci_subsys_104c_3d07_1092_0127, 0}; +#undef pci_ss_info_1092_0127 +#define pci_ss_info_1092_0127 pci_ss_info_104c_3d07_1092_0127 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0136 = + {0x1092, 0x0136, pci_subsys_104c_3d07_1092_0136, 0}; +#undef pci_ss_info_1092_0136 +#define pci_ss_info_1092_0136 pci_ss_info_104c_3d07_1092_0136 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0141 = + {0x1092, 0x0141, pci_subsys_104c_3d07_1092_0141, 0}; +#undef pci_ss_info_1092_0141 +#define pci_ss_info_1092_0141 pci_ss_info_104c_3d07_1092_0141 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0146 = + {0x1092, 0x0146, pci_subsys_104c_3d07_1092_0146, 0}; +#undef pci_ss_info_1092_0146 +#define pci_ss_info_1092_0146 pci_ss_info_104c_3d07_1092_0146 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0148 = + {0x1092, 0x0148, pci_subsys_104c_3d07_1092_0148, 0}; +#undef pci_ss_info_1092_0148 +#define pci_ss_info_1092_0148 pci_ss_info_104c_3d07_1092_0148 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0149 = + {0x1092, 0x0149, pci_subsys_104c_3d07_1092_0149, 0}; +#undef pci_ss_info_1092_0149 +#define pci_ss_info_1092_0149 pci_ss_info_104c_3d07_1092_0149 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0152 = + {0x1092, 0x0152, pci_subsys_104c_3d07_1092_0152, 0}; +#undef pci_ss_info_1092_0152 +#define pci_ss_info_1092_0152 pci_ss_info_104c_3d07_1092_0152 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0154 = + {0x1092, 0x0154, pci_subsys_104c_3d07_1092_0154, 0}; +#undef pci_ss_info_1092_0154 +#define pci_ss_info_1092_0154 pci_ss_info_104c_3d07_1092_0154 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0155 = + {0x1092, 0x0155, pci_subsys_104c_3d07_1092_0155, 0}; +#undef pci_ss_info_1092_0155 +#define pci_ss_info_1092_0155 pci_ss_info_104c_3d07_1092_0155 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0156 = + {0x1092, 0x0156, pci_subsys_104c_3d07_1092_0156, 0}; +#undef pci_ss_info_1092_0156 +#define pci_ss_info_1092_0156 pci_ss_info_104c_3d07_1092_0156 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1092_0157 = + {0x1092, 0x0157, pci_subsys_104c_3d07_1092_0157, 0}; +#undef pci_ss_info_1092_0157 +#define pci_ss_info_1092_0157 pci_ss_info_104c_3d07_1092_0157 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1097_3d01 = + {0x1097, 0x3d01, pci_subsys_104c_3d07_1097_3d01, 0}; +#undef pci_ss_info_1097_3d01 +#define pci_ss_info_1097_3d01 pci_ss_info_104c_3d07_1097_3d01 +static const pciSubsystemInfo pci_ss_info_104c_3d07_1102_100f = + {0x1102, 0x100f, pci_subsys_104c_3d07_1102_100f, 0}; +#undef pci_ss_info_1102_100f +#define pci_ss_info_1102_100f pci_ss_info_104c_3d07_1102_100f +static const pciSubsystemInfo pci_ss_info_104c_3d07_3d3d_0100 = + {0x3d3d, 0x0100, pci_subsys_104c_3d07_3d3d_0100, 0}; +#undef pci_ss_info_3d3d_0100 +#define pci_ss_info_3d3d_0100 pci_ss_info_104c_3d07_3d3d_0100 +static const pciSubsystemInfo pci_ss_info_104c_8000_e4bf_1010 = + {0xe4bf, 0x1010, pci_subsys_104c_8000_e4bf_1010, 0}; +#undef pci_ss_info_e4bf_1010 +#define pci_ss_info_e4bf_1010 pci_ss_info_104c_8000_e4bf_1010 +static const pciSubsystemInfo pci_ss_info_104c_8000_e4bf_1020 = + {0xe4bf, 0x1020, pci_subsys_104c_8000_e4bf_1020, 0}; +#undef pci_ss_info_e4bf_1020 +#define pci_ss_info_e4bf_1020 pci_ss_info_104c_8000_e4bf_1020 +static const pciSubsystemInfo pci_ss_info_104c_8009_104d_8032 = + {0x104d, 0x8032, pci_subsys_104c_8009_104d_8032, 0}; +#undef pci_ss_info_104d_8032 +#define pci_ss_info_104d_8032 pci_ss_info_104c_8009_104d_8032 +static const pciSubsystemInfo pci_ss_info_104c_8019_11bd_000a = + {0x11bd, 0x000a, pci_subsys_104c_8019_11bd_000a, 0}; +#undef pci_ss_info_11bd_000a +#define pci_ss_info_11bd_000a pci_ss_info_104c_8019_11bd_000a +static const pciSubsystemInfo pci_ss_info_104c_8019_11bd_000e = + {0x11bd, 0x000e, pci_subsys_104c_8019_11bd_000e, 0}; +#undef pci_ss_info_11bd_000e +#define pci_ss_info_11bd_000e pci_ss_info_104c_8019_11bd_000e +static const pciSubsystemInfo pci_ss_info_104c_8019_e4bf_1010 = + {0xe4bf, 0x1010, pci_subsys_104c_8019_e4bf_1010, 0}; +#undef pci_ss_info_e4bf_1010 +#define pci_ss_info_e4bf_1010 pci_ss_info_104c_8019_e4bf_1010 +static const pciSubsystemInfo pci_ss_info_104c_8021_104d_80df = + {0x104d, 0x80df, pci_subsys_104c_8021_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_104c_8021_104d_80df +static const pciSubsystemInfo pci_ss_info_104c_8021_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_104c_8021_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_104c_8021_104d_80e7 +static const pciSubsystemInfo pci_ss_info_104c_8027_1028_00e6 = + {0x1028, 0x00e6, pci_subsys_104c_8027_1028_00e6, 0}; +#undef pci_ss_info_1028_00e6 +#define pci_ss_info_1028_00e6 pci_ss_info_104c_8027_1028_00e6 +static const pciSubsystemInfo pci_ss_info_104c_ac1b_0e11_b113 = + {0x0e11, 0xb113, pci_subsys_104c_ac1b_0e11_b113, 0}; +#undef pci_ss_info_0e11_b113 +#define pci_ss_info_0e11_b113 pci_ss_info_104c_ac1b_0e11_b113 +static const pciSubsystemInfo pci_ss_info_104c_ac42_1028_00e6 = + {0x1028, 0x00e6, pci_subsys_104c_ac42_1028_00e6, 0}; +#undef pci_ss_info_1028_00e6 +#define pci_ss_info_1028_00e6 pci_ss_info_104c_ac42_1028_00e6 +static const pciSubsystemInfo pci_ss_info_104c_ac51_1014_023b = + {0x1014, 0x023b, pci_subsys_104c_ac51_1014_023b, 0}; +#undef pci_ss_info_1014_023b +#define pci_ss_info_1014_023b pci_ss_info_104c_ac51_1014_023b +static const pciSubsystemInfo pci_ss_info_104c_ac51_10cf_1095 = + {0x10cf, 0x1095, pci_subsys_104c_ac51_10cf_1095, 0}; +#undef pci_ss_info_10cf_1095 +#define pci_ss_info_10cf_1095 pci_ss_info_104c_ac51_10cf_1095 +static const pciSubsystemInfo pci_ss_info_104c_ac51_e4bf_1000 = + {0xe4bf, 0x1000, pci_subsys_104c_ac51_e4bf_1000, 0}; +#undef pci_ss_info_e4bf_1000 +#define pci_ss_info_e4bf_1000 pci_ss_info_104c_ac51_e4bf_1000 +static const pciSubsystemInfo pci_ss_info_104c_ac55_1014_0512 = + {0x1014, 0x0512, pci_subsys_104c_ac55_1014_0512, 0}; +#undef pci_ss_info_1014_0512 +#define pci_ss_info_1014_0512 pci_ss_info_104c_ac55_1014_0512 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1050_0840_1050_0001 = + {0x1050, 0x0001, pci_subsys_1050_0840_1050_0001, 0}; +#undef pci_ss_info_1050_0001 +#define pci_ss_info_1050_0001 pci_ss_info_1050_0840_1050_0001 +static const pciSubsystemInfo pci_ss_info_1050_0840_1050_0840 = + {0x1050, 0x0840, pci_subsys_1050_0840_1050_0840, 0}; +#undef pci_ss_info_1050_0840 +#define pci_ss_info_1050_0840 pci_ss_info_1050_0840_1050_0840 +#endif +static const pciSubsystemInfo pci_ss_info_1057_1801_ecc0_0030 = + {0xecc0, 0x0030, pci_subsys_1057_1801_ecc0_0030, 0}; +#undef pci_ss_info_ecc0_0030 +#define pci_ss_info_ecc0_0030 pci_ss_info_1057_1801_ecc0_0030 +static const pciSubsystemInfo pci_ss_info_1057_5600_1057_0300 = + {0x1057, 0x0300, pci_subsys_1057_5600_1057_0300, 0}; +#undef pci_ss_info_1057_0300 +#define pci_ss_info_1057_0300 pci_ss_info_1057_5600_1057_0300 +static const pciSubsystemInfo pci_ss_info_1057_5600_1057_0301 = + {0x1057, 0x0301, pci_subsys_1057_5600_1057_0301, 0}; +#undef pci_ss_info_1057_0301 +#define pci_ss_info_1057_0301 pci_ss_info_1057_5600_1057_0301 +static const pciSubsystemInfo pci_ss_info_1057_5600_1057_0302 = + {0x1057, 0x0302, pci_subsys_1057_5600_1057_0302, 0}; +#undef pci_ss_info_1057_0302 +#define pci_ss_info_1057_0302 pci_ss_info_1057_5600_1057_0302 +static const pciSubsystemInfo pci_ss_info_1057_5600_1057_5600 = + {0x1057, 0x5600, pci_subsys_1057_5600_1057_5600, 0}; +#undef pci_ss_info_1057_5600 +#define pci_ss_info_1057_5600 pci_ss_info_1057_5600_1057_5600 +static const pciSubsystemInfo pci_ss_info_1057_5600_13d2_0300 = + {0x13d2, 0x0300, pci_subsys_1057_5600_13d2_0300, 0}; +#undef pci_ss_info_13d2_0300 +#define pci_ss_info_13d2_0300 pci_ss_info_1057_5600_13d2_0300 +static const pciSubsystemInfo pci_ss_info_1057_5600_13d2_0301 = + {0x13d2, 0x0301, pci_subsys_1057_5600_13d2_0301, 0}; +#undef pci_ss_info_13d2_0301 +#define pci_ss_info_13d2_0301 pci_ss_info_1057_5600_13d2_0301 +static const pciSubsystemInfo pci_ss_info_1057_5600_13d2_0302 = + {0x13d2, 0x0302, pci_subsys_1057_5600_13d2_0302, 0}; +#undef pci_ss_info_13d2_0302 +#define pci_ss_info_13d2_0302 pci_ss_info_1057_5600_13d2_0302 +static const pciSubsystemInfo pci_ss_info_1057_5600_1436_0300 = + {0x1436, 0x0300, pci_subsys_1057_5600_1436_0300, 0}; +#undef pci_ss_info_1436_0300 +#define pci_ss_info_1436_0300 pci_ss_info_1057_5600_1436_0300 +static const pciSubsystemInfo pci_ss_info_1057_5600_1436_0301 = + {0x1436, 0x0301, pci_subsys_1057_5600_1436_0301, 0}; +#undef pci_ss_info_1436_0301 +#define pci_ss_info_1436_0301 pci_ss_info_1057_5600_1436_0301 +static const pciSubsystemInfo pci_ss_info_1057_5600_1436_0302 = + {0x1436, 0x0302, pci_subsys_1057_5600_1436_0302, 0}; +#undef pci_ss_info_1436_0302 +#define pci_ss_info_1436_0302 pci_ss_info_1057_5600_1436_0302 +static const pciSubsystemInfo pci_ss_info_1057_5600_144f_100c = + {0x144f, 0x100c, pci_subsys_1057_5600_144f_100c, 0}; +#undef pci_ss_info_144f_100c +#define pci_ss_info_144f_100c pci_ss_info_1057_5600_144f_100c +static const pciSubsystemInfo pci_ss_info_1057_5600_1494_0300 = + {0x1494, 0x0300, pci_subsys_1057_5600_1494_0300, 0}; +#undef pci_ss_info_1494_0300 +#define pci_ss_info_1494_0300 pci_ss_info_1057_5600_1494_0300 +static const pciSubsystemInfo pci_ss_info_1057_5600_1494_0301 = + {0x1494, 0x0301, pci_subsys_1057_5600_1494_0301, 0}; +#undef pci_ss_info_1494_0301 +#define pci_ss_info_1494_0301 pci_ss_info_1057_5600_1494_0301 +static const pciSubsystemInfo pci_ss_info_1057_5600_14c8_0300 = + {0x14c8, 0x0300, pci_subsys_1057_5600_14c8_0300, 0}; +#undef pci_ss_info_14c8_0300 +#define pci_ss_info_14c8_0300 pci_ss_info_1057_5600_14c8_0300 +static const pciSubsystemInfo pci_ss_info_1057_5600_14c8_0302 = + {0x14c8, 0x0302, pci_subsys_1057_5600_14c8_0302, 0}; +#undef pci_ss_info_14c8_0302 +#define pci_ss_info_14c8_0302 pci_ss_info_1057_5600_14c8_0302 +static const pciSubsystemInfo pci_ss_info_1057_5600_1668_0300 = + {0x1668, 0x0300, pci_subsys_1057_5600_1668_0300, 0}; +#undef pci_ss_info_1668_0300 +#define pci_ss_info_1668_0300 pci_ss_info_1057_5600_1668_0300 +static const pciSubsystemInfo pci_ss_info_1057_5600_1668_0302 = + {0x1668, 0x0302, pci_subsys_1057_5600_1668_0302, 0}; +#undef pci_ss_info_1668_0302 +#define pci_ss_info_1668_0302 pci_ss_info_1057_5600_1668_0302 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_105a_0d30_105a_4d33 = + {0x105a, 0x4d33, pci_subsys_105a_0d30_105a_4d33, 0}; +#undef pci_ss_info_105a_4d33 +#define pci_ss_info_105a_4d33 pci_ss_info_105a_0d30_105a_4d33 +static const pciSubsystemInfo pci_ss_info_105a_0d38_105a_4d39 = + {0x105a, 0x4d39, pci_subsys_105a_0d38_105a_4d39, 0}; +#undef pci_ss_info_105a_4d39 +#define pci_ss_info_105a_4d39 pci_ss_info_105a_0d38_105a_4d39 +static const pciSubsystemInfo pci_ss_info_105a_4d30_105a_4d33 = + {0x105a, 0x4d33, pci_subsys_105a_4d30_105a_4d33, 0}; +#undef pci_ss_info_105a_4d33 +#define pci_ss_info_105a_4d33 pci_ss_info_105a_4d30_105a_4d33 +static const pciSubsystemInfo pci_ss_info_105a_4d30_105a_4d39 = + {0x105a, 0x4d39, pci_subsys_105a_4d30_105a_4d39, 0}; +#undef pci_ss_info_105a_4d39 +#define pci_ss_info_105a_4d39 pci_ss_info_105a_4d30_105a_4d39 +static const pciSubsystemInfo pci_ss_info_105a_4d33_105a_4d33 = + {0x105a, 0x4d33, pci_subsys_105a_4d33_105a_4d33, 0}; +#undef pci_ss_info_105a_4d33 +#define pci_ss_info_105a_4d33 pci_ss_info_105a_4d33_105a_4d33 +static const pciSubsystemInfo pci_ss_info_105a_4d38_105a_4d30 = + {0x105a, 0x4d30, pci_subsys_105a_4d38_105a_4d30, 0}; +#undef pci_ss_info_105a_4d30 +#define pci_ss_info_105a_4d30 pci_ss_info_105a_4d38_105a_4d30 +static const pciSubsystemInfo pci_ss_info_105a_4d38_105a_4d33 = + {0x105a, 0x4d33, pci_subsys_105a_4d38_105a_4d33, 0}; +#undef pci_ss_info_105a_4d33 +#define pci_ss_info_105a_4d33 pci_ss_info_105a_4d38_105a_4d33 +static const pciSubsystemInfo pci_ss_info_105a_4d38_105a_4d39 = + {0x105a, 0x4d39, pci_subsys_105a_4d38_105a_4d39, 0}; +#undef pci_ss_info_105a_4d39 +#define pci_ss_info_105a_4d39 pci_ss_info_105a_4d38_105a_4d39 +static const pciSubsystemInfo pci_ss_info_105a_4d68_105a_4d68 = + {0x105a, 0x4d68, pci_subsys_105a_4d68_105a_4d68, 0}; +#undef pci_ss_info_105a_4d68 +#define pci_ss_info_105a_4d68 pci_ss_info_105a_4d68_105a_4d68 +static const pciSubsystemInfo pci_ss_info_105a_5275_105a_0275 = + {0x105a, 0x0275, pci_subsys_105a_5275_105a_0275, 0}; +#undef pci_ss_info_105a_0275 +#define pci_ss_info_105a_0275 pci_ss_info_105a_5275_105a_0275 +static const pciSubsystemInfo pci_ss_info_105a_6269_105a_6269 = + {0x105a, 0x6269, pci_subsys_105a_6269_105a_6269, 0}; +#undef pci_ss_info_105a_6269 +#define pci_ss_info_105a_6269 pci_ss_info_105a_6269_105a_6269 +#endif +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0000 = + {0x105d, 0x0000, pci_subsys_105d_2339_105d_0000, 0}; +#undef pci_ss_info_105d_0000 +#define pci_ss_info_105d_0000 pci_ss_info_105d_2339_105d_0000 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0001 = + {0x105d, 0x0001, pci_subsys_105d_2339_105d_0001, 0}; +#undef pci_ss_info_105d_0001 +#define pci_ss_info_105d_0001 pci_ss_info_105d_2339_105d_0001 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0002 = + {0x105d, 0x0002, pci_subsys_105d_2339_105d_0002, 0}; +#undef pci_ss_info_105d_0002 +#define pci_ss_info_105d_0002 pci_ss_info_105d_2339_105d_0002 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0003 = + {0x105d, 0x0003, pci_subsys_105d_2339_105d_0003, 0}; +#undef pci_ss_info_105d_0003 +#define pci_ss_info_105d_0003 pci_ss_info_105d_2339_105d_0003 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0004 = + {0x105d, 0x0004, pci_subsys_105d_2339_105d_0004, 0}; +#undef pci_ss_info_105d_0004 +#define pci_ss_info_105d_0004 pci_ss_info_105d_2339_105d_0004 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0005 = + {0x105d, 0x0005, pci_subsys_105d_2339_105d_0005, 0}; +#undef pci_ss_info_105d_0005 +#define pci_ss_info_105d_0005 pci_ss_info_105d_2339_105d_0005 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0006 = + {0x105d, 0x0006, pci_subsys_105d_2339_105d_0006, 0}; +#undef pci_ss_info_105d_0006 +#define pci_ss_info_105d_0006 pci_ss_info_105d_2339_105d_0006 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0007 = + {0x105d, 0x0007, pci_subsys_105d_2339_105d_0007, 0}; +#undef pci_ss_info_105d_0007 +#define pci_ss_info_105d_0007 pci_ss_info_105d_2339_105d_0007 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0008 = + {0x105d, 0x0008, pci_subsys_105d_2339_105d_0008, 0}; +#undef pci_ss_info_105d_0008 +#define pci_ss_info_105d_0008 pci_ss_info_105d_2339_105d_0008 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_0009 = + {0x105d, 0x0009, pci_subsys_105d_2339_105d_0009, 0}; +#undef pci_ss_info_105d_0009 +#define pci_ss_info_105d_0009 pci_ss_info_105d_2339_105d_0009 +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_000a = + {0x105d, 0x000a, pci_subsys_105d_2339_105d_000a, 0}; +#undef pci_ss_info_105d_000a +#define pci_ss_info_105d_000a pci_ss_info_105d_2339_105d_000a +static const pciSubsystemInfo pci_ss_info_105d_2339_105d_000b = + {0x105d, 0x000b, pci_subsys_105d_2339_105d_000b, 0}; +#undef pci_ss_info_105d_000b +#define pci_ss_info_105d_000b pci_ss_info_105d_2339_105d_000b +static const pciSubsystemInfo pci_ss_info_105d_2339_11a4_000a = + {0x11a4, 0x000a, pci_subsys_105d_2339_11a4_000a, 0}; +#undef pci_ss_info_11a4_000a +#define pci_ss_info_11a4_000a pci_ss_info_105d_2339_11a4_000a +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_0000 = + {0x13cc, 0x0000, pci_subsys_105d_2339_13cc_0000, 0}; +#undef pci_ss_info_13cc_0000 +#define pci_ss_info_13cc_0000 pci_ss_info_105d_2339_13cc_0000 +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_0004 = + {0x13cc, 0x0004, pci_subsys_105d_2339_13cc_0004, 0}; +#undef pci_ss_info_13cc_0004 +#define pci_ss_info_13cc_0004 pci_ss_info_105d_2339_13cc_0004 +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_0005 = + {0x13cc, 0x0005, pci_subsys_105d_2339_13cc_0005, 0}; +#undef pci_ss_info_13cc_0005 +#define pci_ss_info_13cc_0005 pci_ss_info_105d_2339_13cc_0005 +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_0006 = + {0x13cc, 0x0006, pci_subsys_105d_2339_13cc_0006, 0}; +#undef pci_ss_info_13cc_0006 +#define pci_ss_info_13cc_0006 pci_ss_info_105d_2339_13cc_0006 +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_0008 = + {0x13cc, 0x0008, pci_subsys_105d_2339_13cc_0008, 0}; +#undef pci_ss_info_13cc_0008 +#define pci_ss_info_13cc_0008 pci_ss_info_105d_2339_13cc_0008 +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_0009 = + {0x13cc, 0x0009, pci_subsys_105d_2339_13cc_0009, 0}; +#undef pci_ss_info_13cc_0009 +#define pci_ss_info_13cc_0009 pci_ss_info_105d_2339_13cc_0009 +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_000a = + {0x13cc, 0x000a, pci_subsys_105d_2339_13cc_000a, 0}; +#undef pci_ss_info_13cc_000a +#define pci_ss_info_13cc_000a pci_ss_info_105d_2339_13cc_000a +static const pciSubsystemInfo pci_ss_info_105d_2339_13cc_000c = + {0x13cc, 0x000c, pci_subsys_105d_2339_13cc_000c, 0}; +#undef pci_ss_info_13cc_000c +#define pci_ss_info_13cc_000c pci_ss_info_105d_2339_13cc_000c +static const pciSubsystemInfo pci_ss_info_105d_493d_11a4_000a = + {0x11a4, 0x000a, pci_subsys_105d_493d_11a4_000a, 0}; +#undef pci_ss_info_11a4_000a +#define pci_ss_info_11a4_000a pci_ss_info_105d_493d_11a4_000a +static const pciSubsystemInfo pci_ss_info_105d_493d_11a4_000b = + {0x11a4, 0x000b, pci_subsys_105d_493d_11a4_000b, 0}; +#undef pci_ss_info_11a4_000b +#define pci_ss_info_11a4_000b pci_ss_info_105d_493d_11a4_000b +static const pciSubsystemInfo pci_ss_info_105d_493d_13cc_0002 = + {0x13cc, 0x0002, pci_subsys_105d_493d_13cc_0002, 0}; +#undef pci_ss_info_13cc_0002 +#define pci_ss_info_13cc_0002 pci_ss_info_105d_493d_13cc_0002 +static const pciSubsystemInfo pci_ss_info_105d_493d_13cc_0003 = + {0x13cc, 0x0003, pci_subsys_105d_493d_13cc_0003, 0}; +#undef pci_ss_info_13cc_0003 +#define pci_ss_info_13cc_0003 pci_ss_info_105d_493d_13cc_0003 +static const pciSubsystemInfo pci_ss_info_105d_493d_13cc_0007 = + {0x13cc, 0x0007, pci_subsys_105d_493d_13cc_0007, 0}; +#undef pci_ss_info_13cc_0007 +#define pci_ss_info_13cc_0007 pci_ss_info_105d_493d_13cc_0007 +static const pciSubsystemInfo pci_ss_info_105d_493d_13cc_0008 = + {0x13cc, 0x0008, pci_subsys_105d_493d_13cc_0008, 0}; +#undef pci_ss_info_13cc_0008 +#define pci_ss_info_13cc_0008 pci_ss_info_105d_493d_13cc_0008 +static const pciSubsystemInfo pci_ss_info_105d_493d_13cc_0009 = + {0x13cc, 0x0009, pci_subsys_105d_493d_13cc_0009, 0}; +#undef pci_ss_info_13cc_0009 +#define pci_ss_info_13cc_0009 pci_ss_info_105d_493d_13cc_0009 +static const pciSubsystemInfo pci_ss_info_105d_493d_13cc_000a = + {0x13cc, 0x000a, pci_subsys_105d_493d_13cc_000a, 0}; +#undef pci_ss_info_13cc_000a +#define pci_ss_info_13cc_000a pci_ss_info_105d_493d_13cc_000a +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1073_0004_1073_0004 = + {0x1073, 0x0004, pci_subsys_1073_0004_1073_0004, 0}; +#undef pci_ss_info_1073_0004 +#define pci_ss_info_1073_0004 pci_ss_info_1073_0004_1073_0004 +static const pciSubsystemInfo pci_ss_info_1073_0005_1073_0005 = + {0x1073, 0x0005, pci_subsys_1073_0005_1073_0005, 0}; +#undef pci_ss_info_1073_0005 +#define pci_ss_info_1073_0005 pci_ss_info_1073_0005_1073_0005 +static const pciSubsystemInfo pci_ss_info_1073_0008_1073_0008 = + {0x1073, 0x0008, pci_subsys_1073_0008_1073_0008, 0}; +#undef pci_ss_info_1073_0008 +#define pci_ss_info_1073_0008 pci_ss_info_1073_0008_1073_0008 +static const pciSubsystemInfo pci_ss_info_1073_000a_1073_0004 = + {0x1073, 0x0004, pci_subsys_1073_000a_1073_0004, 0}; +#undef pci_ss_info_1073_0004 +#define pci_ss_info_1073_0004 pci_ss_info_1073_000a_1073_0004 +static const pciSubsystemInfo pci_ss_info_1073_000a_1073_000a = + {0x1073, 0x000a, pci_subsys_1073_000a_1073_000a, 0}; +#undef pci_ss_info_1073_000a +#define pci_ss_info_1073_000a pci_ss_info_1073_000a_1073_000a +static const pciSubsystemInfo pci_ss_info_1073_000c_107a_000c = + {0x107a, 0x000c, pci_subsys_1073_000c_107a_000c, 0}; +#undef pci_ss_info_107a_000c +#define pci_ss_info_107a_000c pci_ss_info_1073_000c_107a_000c +static const pciSubsystemInfo pci_ss_info_1073_000d_1073_000d = + {0x1073, 0x000d, pci_subsys_1073_000d_1073_000d, 0}; +#undef pci_ss_info_1073_000d +#define pci_ss_info_1073_000d pci_ss_info_1073_000d_1073_000d +static const pciSubsystemInfo pci_ss_info_1073_0010_1073_0006 = + {0x1073, 0x0006, pci_subsys_1073_0010_1073_0006, 0}; +#undef pci_ss_info_1073_0006 +#define pci_ss_info_1073_0006 pci_ss_info_1073_0010_1073_0006 +static const pciSubsystemInfo pci_ss_info_1073_0010_1073_0010 = + {0x1073, 0x0010, pci_subsys_1073_0010_1073_0010, 0}; +#undef pci_ss_info_1073_0010 +#define pci_ss_info_1073_0010 pci_ss_info_1073_0010_1073_0010 +static const pciSubsystemInfo pci_ss_info_1073_0012_1073_0012 = + {0x1073, 0x0012, pci_subsys_1073_0012_1073_0012, 0}; +#undef pci_ss_info_1073_0012 +#define pci_ss_info_1073_0012 pci_ss_info_1073_0012_1073_0012 +static const pciSubsystemInfo pci_ss_info_1073_2000_1073_2000 = + {0x1073, 0x2000, pci_subsys_1073_2000_1073_2000, 0}; +#undef pci_ss_info_1073_2000 +#define pci_ss_info_1073_2000 pci_ss_info_1073_2000_1073_2000 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1077_1216_101e_8471 = + {0x101e, 0x8471, pci_subsys_1077_1216_101e_8471, 0}; +#undef pci_ss_info_101e_8471 +#define pci_ss_info_101e_8471 pci_ss_info_1077_1216_101e_8471 +static const pciSubsystemInfo pci_ss_info_1077_1216_101e_8493 = + {0x101e, 0x8493, pci_subsys_1077_1216_101e_8493, 0}; +#undef pci_ss_info_101e_8493 +#define pci_ss_info_101e_8493 pci_ss_info_1077_1216_101e_8493 +static const pciSubsystemInfo pci_ss_info_1077_2100_1077_0001 = + {0x1077, 0x0001, pci_subsys_1077_2100_1077_0001, 0}; +#undef pci_ss_info_1077_0001 +#define pci_ss_info_1077_0001 pci_ss_info_1077_2100_1077_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_108d_0004_108d_0004 = + {0x108d, 0x0004, pci_subsys_108d_0004_108d_0004, 0}; +#undef pci_ss_info_108d_0004 +#define pci_ss_info_108d_0004 pci_ss_info_108d_0004_108d_0004 +static const pciSubsystemInfo pci_ss_info_108d_0007_108d_0007 = + {0x108d, 0x0007, pci_subsys_108d_0007_108d_0007, 0}; +#undef pci_ss_info_108d_0007 +#define pci_ss_info_108d_0007 pci_ss_info_108d_0007_108d_0007 +static const pciSubsystemInfo pci_ss_info_108d_0008_108d_0008 = + {0x108d, 0x0008, pci_subsys_108d_0008_108d_0008, 0}; +#undef pci_ss_info_108d_0008 +#define pci_ss_info_108d_0008 pci_ss_info_108d_0008_108d_0008 +static const pciSubsystemInfo pci_ss_info_108d_0019_108d_0016 = + {0x108d, 0x0016, pci_subsys_108d_0019_108d_0016, 0}; +#undef pci_ss_info_108d_0016 +#define pci_ss_info_108d_0016 pci_ss_info_108d_0019_108d_0016 +static const pciSubsystemInfo pci_ss_info_108d_0019_108d_0017 = + {0x108d, 0x0017, pci_subsys_108d_0019_108d_0017, 0}; +#undef pci_ss_info_108d_0017 +#define pci_ss_info_108d_0017 pci_ss_info_108d_0019_108d_0017 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1095_0649_0e11_005d = + {0x0e11, 0x005d, pci_subsys_1095_0649_0e11_005d, 0}; +#undef pci_ss_info_0e11_005d +#define pci_ss_info_0e11_005d pci_ss_info_1095_0649_0e11_005d +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1095_0649_0e11_007e = + {0x0e11, 0x007e, pci_subsys_1095_0649_0e11_007e, 0}; +#undef pci_ss_info_0e11_007e +#define pci_ss_info_0e11_007e pci_ss_info_1095_0649_0e11_007e +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1095_0649_101e_0649 = + {0x101e, 0x0649, pci_subsys_1095_0649_101e_0649, 0}; +#undef pci_ss_info_101e_0649 +#define pci_ss_info_101e_0649 pci_ss_info_1095_0649_101e_0649 +static const pciSubsystemInfo pci_ss_info_1095_0670_1095_0670 = + {0x1095, 0x0670, pci_subsys_1095_0670_1095_0670, 0}; +#undef pci_ss_info_1095_0670 +#define pci_ss_info_1095_0670 pci_ss_info_1095_0670_1095_0670 +#endif +static const pciSubsystemInfo pci_ss_info_109e_0369_1002_0001 = + {0x1002, 0x0001, pci_subsys_109e_0369_1002_0001, 0}; +#undef pci_ss_info_1002_0001 +#define pci_ss_info_1002_0001 pci_ss_info_109e_0369_1002_0001 +static const pciSubsystemInfo pci_ss_info_109e_0369_1002_0003 = + {0x1002, 0x0003, pci_subsys_109e_0369_1002_0003, 0}; +#undef pci_ss_info_1002_0003 +#define pci_ss_info_1002_0003 pci_ss_info_109e_0369_1002_0003 +static const pciSubsystemInfo pci_ss_info_109e_036c_13e9_0070 = + {0x13e9, 0x0070, pci_subsys_109e_036c_13e9_0070, 0}; +#undef pci_ss_info_13e9_0070 +#define pci_ss_info_13e9_0070 pci_ss_info_109e_036c_13e9_0070 +static const pciSubsystemInfo pci_ss_info_109e_036e_0070_13eb = + {0x0070, 0x13eb, pci_subsys_109e_036e_0070_13eb, 0}; +#undef pci_ss_info_0070_13eb +#define pci_ss_info_0070_13eb pci_ss_info_109e_036e_0070_13eb +static const pciSubsystemInfo pci_ss_info_109e_036e_0070_ff01 = + {0x0070, 0xff01, pci_subsys_109e_036e_0070_ff01, 0}; +#undef pci_ss_info_0070_ff01 +#define pci_ss_info_0070_ff01 pci_ss_info_109e_036e_0070_ff01 +static const pciSubsystemInfo pci_ss_info_109e_036e_107d_6606 = + {0x107d, 0x6606, pci_subsys_109e_036e_107d_6606, 0}; +#undef pci_ss_info_107d_6606 +#define pci_ss_info_107d_6606 pci_ss_info_109e_036e_107d_6606 +static const pciSubsystemInfo pci_ss_info_109e_036e_11bd_0012 = + {0x11bd, 0x0012, pci_subsys_109e_036e_11bd_0012, 0}; +#undef pci_ss_info_11bd_0012 +#define pci_ss_info_11bd_0012 pci_ss_info_109e_036e_11bd_0012 +static const pciSubsystemInfo pci_ss_info_109e_036e_11bd_001c = + {0x11bd, 0x001c, pci_subsys_109e_036e_11bd_001c, 0}; +#undef pci_ss_info_11bd_001c +#define pci_ss_info_11bd_001c pci_ss_info_109e_036e_11bd_001c +static const pciSubsystemInfo pci_ss_info_109e_036e_127a_0001 = + {0x127a, 0x0001, pci_subsys_109e_036e_127a_0001, 0}; +#undef pci_ss_info_127a_0001 +#define pci_ss_info_127a_0001 pci_ss_info_109e_036e_127a_0001 +static const pciSubsystemInfo pci_ss_info_109e_036e_127a_0002 = + {0x127a, 0x0002, pci_subsys_109e_036e_127a_0002, 0}; +#undef pci_ss_info_127a_0002 +#define pci_ss_info_127a_0002 pci_ss_info_109e_036e_127a_0002 +static const pciSubsystemInfo pci_ss_info_109e_036e_127a_0003 = + {0x127a, 0x0003, pci_subsys_109e_036e_127a_0003, 0}; +#undef pci_ss_info_127a_0003 +#define pci_ss_info_127a_0003 pci_ss_info_109e_036e_127a_0003 +static const pciSubsystemInfo pci_ss_info_109e_036e_127a_0048 = + {0x127a, 0x0048, pci_subsys_109e_036e_127a_0048, 0}; +#undef pci_ss_info_127a_0048 +#define pci_ss_info_127a_0048 pci_ss_info_109e_036e_127a_0048 +static const pciSubsystemInfo pci_ss_info_109e_036e_144f_3000 = + {0x144f, 0x3000, pci_subsys_109e_036e_144f_3000, 0}; +#undef pci_ss_info_144f_3000 +#define pci_ss_info_144f_3000 pci_ss_info_109e_036e_144f_3000 +static const pciSubsystemInfo pci_ss_info_109e_036e_1461_0004 = + {0x1461, 0x0004, pci_subsys_109e_036e_1461_0004, 0}; +#undef pci_ss_info_1461_0004 +#define pci_ss_info_1461_0004 pci_ss_info_109e_036e_1461_0004 +static const pciSubsystemInfo pci_ss_info_109e_036e_14f1_0001 = + {0x14f1, 0x0001, pci_subsys_109e_036e_14f1_0001, 0}; +#undef pci_ss_info_14f1_0001 +#define pci_ss_info_14f1_0001 pci_ss_info_109e_036e_14f1_0001 +static const pciSubsystemInfo pci_ss_info_109e_036e_14f1_0002 = + {0x14f1, 0x0002, pci_subsys_109e_036e_14f1_0002, 0}; +#undef pci_ss_info_14f1_0002 +#define pci_ss_info_14f1_0002 pci_ss_info_109e_036e_14f1_0002 +static const pciSubsystemInfo pci_ss_info_109e_036e_14f1_0003 = + {0x14f1, 0x0003, pci_subsys_109e_036e_14f1_0003, 0}; +#undef pci_ss_info_14f1_0003 +#define pci_ss_info_14f1_0003 pci_ss_info_109e_036e_14f1_0003 +static const pciSubsystemInfo pci_ss_info_109e_036e_14f1_0048 = + {0x14f1, 0x0048, pci_subsys_109e_036e_14f1_0048, 0}; +#undef pci_ss_info_14f1_0048 +#define pci_ss_info_14f1_0048 pci_ss_info_109e_036e_14f1_0048 +static const pciSubsystemInfo pci_ss_info_109e_036e_1851_1850 = + {0x1851, 0x1850, pci_subsys_109e_036e_1851_1850, 0}; +#undef pci_ss_info_1851_1850 +#define pci_ss_info_1851_1850 pci_ss_info_109e_036e_1851_1850 +static const pciSubsystemInfo pci_ss_info_109e_036e_1851_1851 = + {0x1851, 0x1851, pci_subsys_109e_036e_1851_1851, 0}; +#undef pci_ss_info_1851_1851 +#define pci_ss_info_1851_1851 pci_ss_info_109e_036e_1851_1851 +static const pciSubsystemInfo pci_ss_info_109e_036e_1852_1852 = + {0x1852, 0x1852, pci_subsys_109e_036e_1852_1852, 0}; +#undef pci_ss_info_1852_1852 +#define pci_ss_info_1852_1852 pci_ss_info_109e_036e_1852_1852 +static const pciSubsystemInfo pci_ss_info_109e_036e_bd11_1200 = + {0xbd11, 0x1200, pci_subsys_109e_036e_bd11_1200, 0}; +#undef pci_ss_info_bd11_1200 +#define pci_ss_info_bd11_1200 pci_ss_info_109e_036e_bd11_1200 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0044 = + {0x127a, 0x0044, pci_subsys_109e_036f_127a_0044, 0}; +#undef pci_ss_info_127a_0044 +#define pci_ss_info_127a_0044 pci_ss_info_109e_036f_127a_0044 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0122 = + {0x127a, 0x0122, pci_subsys_109e_036f_127a_0122, 0}; +#undef pci_ss_info_127a_0122 +#define pci_ss_info_127a_0122 pci_ss_info_109e_036f_127a_0122 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0144 = + {0x127a, 0x0144, pci_subsys_109e_036f_127a_0144, 0}; +#undef pci_ss_info_127a_0144 +#define pci_ss_info_127a_0144 pci_ss_info_109e_036f_127a_0144 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0222 = + {0x127a, 0x0222, pci_subsys_109e_036f_127a_0222, 0}; +#undef pci_ss_info_127a_0222 +#define pci_ss_info_127a_0222 pci_ss_info_109e_036f_127a_0222 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0244 = + {0x127a, 0x0244, pci_subsys_109e_036f_127a_0244, 0}; +#undef pci_ss_info_127a_0244 +#define pci_ss_info_127a_0244 pci_ss_info_109e_036f_127a_0244 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0322 = + {0x127a, 0x0322, pci_subsys_109e_036f_127a_0322, 0}; +#undef pci_ss_info_127a_0322 +#define pci_ss_info_127a_0322 pci_ss_info_109e_036f_127a_0322 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_0422 = + {0x127a, 0x0422, pci_subsys_109e_036f_127a_0422, 0}; +#undef pci_ss_info_127a_0422 +#define pci_ss_info_127a_0422 pci_ss_info_109e_036f_127a_0422 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_1122 = + {0x127a, 0x1122, pci_subsys_109e_036f_127a_1122, 0}; +#undef pci_ss_info_127a_1122 +#define pci_ss_info_127a_1122 pci_ss_info_109e_036f_127a_1122 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_1222 = + {0x127a, 0x1222, pci_subsys_109e_036f_127a_1222, 0}; +#undef pci_ss_info_127a_1222 +#define pci_ss_info_127a_1222 pci_ss_info_109e_036f_127a_1222 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_1322 = + {0x127a, 0x1322, pci_subsys_109e_036f_127a_1322, 0}; +#undef pci_ss_info_127a_1322 +#define pci_ss_info_127a_1322 pci_ss_info_109e_036f_127a_1322 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_1522 = + {0x127a, 0x1522, pci_subsys_109e_036f_127a_1522, 0}; +#undef pci_ss_info_127a_1522 +#define pci_ss_info_127a_1522 pci_ss_info_109e_036f_127a_1522 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_1622 = + {0x127a, 0x1622, pci_subsys_109e_036f_127a_1622, 0}; +#undef pci_ss_info_127a_1622 +#define pci_ss_info_127a_1622 pci_ss_info_109e_036f_127a_1622 +static const pciSubsystemInfo pci_ss_info_109e_036f_127a_1722 = + {0x127a, 0x1722, pci_subsys_109e_036f_127a_1722, 0}; +#undef pci_ss_info_127a_1722 +#define pci_ss_info_127a_1722 pci_ss_info_109e_036f_127a_1722 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0044 = + {0x14f1, 0x0044, pci_subsys_109e_036f_14f1_0044, 0}; +#undef pci_ss_info_14f1_0044 +#define pci_ss_info_14f1_0044 pci_ss_info_109e_036f_14f1_0044 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0122 = + {0x14f1, 0x0122, pci_subsys_109e_036f_14f1_0122, 0}; +#undef pci_ss_info_14f1_0122 +#define pci_ss_info_14f1_0122 pci_ss_info_109e_036f_14f1_0122 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0144 = + {0x14f1, 0x0144, pci_subsys_109e_036f_14f1_0144, 0}; +#undef pci_ss_info_14f1_0144 +#define pci_ss_info_14f1_0144 pci_ss_info_109e_036f_14f1_0144 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0222 = + {0x14f1, 0x0222, pci_subsys_109e_036f_14f1_0222, 0}; +#undef pci_ss_info_14f1_0222 +#define pci_ss_info_14f1_0222 pci_ss_info_109e_036f_14f1_0222 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0244 = + {0x14f1, 0x0244, pci_subsys_109e_036f_14f1_0244, 0}; +#undef pci_ss_info_14f1_0244 +#define pci_ss_info_14f1_0244 pci_ss_info_109e_036f_14f1_0244 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0322 = + {0x14f1, 0x0322, pci_subsys_109e_036f_14f1_0322, 0}; +#undef pci_ss_info_14f1_0322 +#define pci_ss_info_14f1_0322 pci_ss_info_109e_036f_14f1_0322 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_0422 = + {0x14f1, 0x0422, pci_subsys_109e_036f_14f1_0422, 0}; +#undef pci_ss_info_14f1_0422 +#define pci_ss_info_14f1_0422 pci_ss_info_109e_036f_14f1_0422 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_1122 = + {0x14f1, 0x1122, pci_subsys_109e_036f_14f1_1122, 0}; +#undef pci_ss_info_14f1_1122 +#define pci_ss_info_14f1_1122 pci_ss_info_109e_036f_14f1_1122 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_1222 = + {0x14f1, 0x1222, pci_subsys_109e_036f_14f1_1222, 0}; +#undef pci_ss_info_14f1_1222 +#define pci_ss_info_14f1_1222 pci_ss_info_109e_036f_14f1_1222 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_1322 = + {0x14f1, 0x1322, pci_subsys_109e_036f_14f1_1322, 0}; +#undef pci_ss_info_14f1_1322 +#define pci_ss_info_14f1_1322 pci_ss_info_109e_036f_14f1_1322 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_1522 = + {0x14f1, 0x1522, pci_subsys_109e_036f_14f1_1522, 0}; +#undef pci_ss_info_14f1_1522 +#define pci_ss_info_14f1_1522 pci_ss_info_109e_036f_14f1_1522 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_1622 = + {0x14f1, 0x1622, pci_subsys_109e_036f_14f1_1622, 0}; +#undef pci_ss_info_14f1_1622 +#define pci_ss_info_14f1_1622 pci_ss_info_109e_036f_14f1_1622 +static const pciSubsystemInfo pci_ss_info_109e_036f_14f1_1722 = + {0x14f1, 0x1722, pci_subsys_109e_036f_14f1_1722, 0}; +#undef pci_ss_info_14f1_1722 +#define pci_ss_info_14f1_1722 pci_ss_info_109e_036f_14f1_1722 +static const pciSubsystemInfo pci_ss_info_109e_036f_1851_1850 = + {0x1851, 0x1850, pci_subsys_109e_036f_1851_1850, 0}; +#undef pci_ss_info_1851_1850 +#define pci_ss_info_1851_1850 pci_ss_info_109e_036f_1851_1850 +static const pciSubsystemInfo pci_ss_info_109e_036f_1851_1851 = + {0x1851, 0x1851, pci_subsys_109e_036f_1851_1851, 0}; +#undef pci_ss_info_1851_1851 +#define pci_ss_info_1851_1851 pci_ss_info_109e_036f_1851_1851 +static const pciSubsystemInfo pci_ss_info_109e_036f_1852_1852 = + {0x1852, 0x1852, pci_subsys_109e_036f_1852_1852, 0}; +#undef pci_ss_info_1852_1852 +#define pci_ss_info_1852_1852 pci_ss_info_109e_036f_1852_1852 +static const pciSubsystemInfo pci_ss_info_109e_0370_1851_1850 = + {0x1851, 0x1850, pci_subsys_109e_0370_1851_1850, 0}; +#undef pci_ss_info_1851_1850 +#define pci_ss_info_1851_1850 pci_ss_info_109e_0370_1851_1850 +static const pciSubsystemInfo pci_ss_info_109e_0370_1851_1851 = + {0x1851, 0x1851, pci_subsys_109e_0370_1851_1851, 0}; +#undef pci_ss_info_1851_1851 +#define pci_ss_info_1851_1851 pci_ss_info_109e_0370_1851_1851 +static const pciSubsystemInfo pci_ss_info_109e_0370_1852_1852 = + {0x1852, 0x1852, pci_subsys_109e_0370_1852_1852, 0}; +#undef pci_ss_info_1852_1852 +#define pci_ss_info_1852_1852 pci_ss_info_109e_0370_1852_1852 +static const pciSubsystemInfo pci_ss_info_109e_0878_0070_13eb = + {0x0070, 0x13eb, pci_subsys_109e_0878_0070_13eb, 0}; +#undef pci_ss_info_0070_13eb +#define pci_ss_info_0070_13eb pci_ss_info_109e_0878_0070_13eb +static const pciSubsystemInfo pci_ss_info_109e_0878_0070_ff01 = + {0x0070, 0xff01, pci_subsys_109e_0878_0070_ff01, 0}; +#undef pci_ss_info_0070_ff01 +#define pci_ss_info_0070_ff01 pci_ss_info_109e_0878_0070_ff01 +static const pciSubsystemInfo pci_ss_info_109e_0878_1002_0001 = + {0x1002, 0x0001, pci_subsys_109e_0878_1002_0001, 0}; +#undef pci_ss_info_1002_0001 +#define pci_ss_info_1002_0001 pci_ss_info_109e_0878_1002_0001 +static const pciSubsystemInfo pci_ss_info_109e_0878_1002_0003 = + {0x1002, 0x0003, pci_subsys_109e_0878_1002_0003, 0}; +#undef pci_ss_info_1002_0003 +#define pci_ss_info_1002_0003 pci_ss_info_109e_0878_1002_0003 +static const pciSubsystemInfo pci_ss_info_109e_0878_11bd_0012 = + {0x11bd, 0x0012, pci_subsys_109e_0878_11bd_0012, 0}; +#undef pci_ss_info_11bd_0012 +#define pci_ss_info_11bd_0012 pci_ss_info_109e_0878_11bd_0012 +static const pciSubsystemInfo pci_ss_info_109e_0878_11bd_001c = + {0x11bd, 0x001c, pci_subsys_109e_0878_11bd_001c, 0}; +#undef pci_ss_info_11bd_001c +#define pci_ss_info_11bd_001c pci_ss_info_109e_0878_11bd_001c +static const pciSubsystemInfo pci_ss_info_109e_0878_127a_0001 = + {0x127a, 0x0001, pci_subsys_109e_0878_127a_0001, 0}; +#undef pci_ss_info_127a_0001 +#define pci_ss_info_127a_0001 pci_ss_info_109e_0878_127a_0001 +static const pciSubsystemInfo pci_ss_info_109e_0878_127a_0002 = + {0x127a, 0x0002, pci_subsys_109e_0878_127a_0002, 0}; +#undef pci_ss_info_127a_0002 +#define pci_ss_info_127a_0002 pci_ss_info_109e_0878_127a_0002 +static const pciSubsystemInfo pci_ss_info_109e_0878_127a_0003 = + {0x127a, 0x0003, pci_subsys_109e_0878_127a_0003, 0}; +#undef pci_ss_info_127a_0003 +#define pci_ss_info_127a_0003 pci_ss_info_109e_0878_127a_0003 +static const pciSubsystemInfo pci_ss_info_109e_0878_127a_0048 = + {0x127a, 0x0048, pci_subsys_109e_0878_127a_0048, 0}; +#undef pci_ss_info_127a_0048 +#define pci_ss_info_127a_0048 pci_ss_info_109e_0878_127a_0048 +static const pciSubsystemInfo pci_ss_info_109e_0878_13e9_0070 = + {0x13e9, 0x0070, pci_subsys_109e_0878_13e9_0070, 0}; +#undef pci_ss_info_13e9_0070 +#define pci_ss_info_13e9_0070 pci_ss_info_109e_0878_13e9_0070 +static const pciSubsystemInfo pci_ss_info_109e_0878_144f_3000 = + {0x144f, 0x3000, pci_subsys_109e_0878_144f_3000, 0}; +#undef pci_ss_info_144f_3000 +#define pci_ss_info_144f_3000 pci_ss_info_109e_0878_144f_3000 +static const pciSubsystemInfo pci_ss_info_109e_0878_1461_0004 = + {0x1461, 0x0004, pci_subsys_109e_0878_1461_0004, 0}; +#undef pci_ss_info_1461_0004 +#define pci_ss_info_1461_0004 pci_ss_info_109e_0878_1461_0004 +static const pciSubsystemInfo pci_ss_info_109e_0878_14f1_0001 = + {0x14f1, 0x0001, pci_subsys_109e_0878_14f1_0001, 0}; +#undef pci_ss_info_14f1_0001 +#define pci_ss_info_14f1_0001 pci_ss_info_109e_0878_14f1_0001 +static const pciSubsystemInfo pci_ss_info_109e_0878_14f1_0002 = + {0x14f1, 0x0002, pci_subsys_109e_0878_14f1_0002, 0}; +#undef pci_ss_info_14f1_0002 +#define pci_ss_info_14f1_0002 pci_ss_info_109e_0878_14f1_0002 +static const pciSubsystemInfo pci_ss_info_109e_0878_14f1_0003 = + {0x14f1, 0x0003, pci_subsys_109e_0878_14f1_0003, 0}; +#undef pci_ss_info_14f1_0003 +#define pci_ss_info_14f1_0003 pci_ss_info_109e_0878_14f1_0003 +static const pciSubsystemInfo pci_ss_info_109e_0878_14f1_0048 = + {0x14f1, 0x0048, pci_subsys_109e_0878_14f1_0048, 0}; +#undef pci_ss_info_14f1_0048 +#define pci_ss_info_14f1_0048 pci_ss_info_109e_0878_14f1_0048 +static const pciSubsystemInfo pci_ss_info_109e_0878_bd11_1200 = + {0xbd11, 0x1200, pci_subsys_109e_0878_bd11_1200, 0}; +#undef pci_ss_info_bd11_1200 +#define pci_ss_info_bd11_1200 pci_ss_info_109e_0878_bd11_1200 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0044 = + {0x127a, 0x0044, pci_subsys_109e_0879_127a_0044, 0}; +#undef pci_ss_info_127a_0044 +#define pci_ss_info_127a_0044 pci_ss_info_109e_0879_127a_0044 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0122 = + {0x127a, 0x0122, pci_subsys_109e_0879_127a_0122, 0}; +#undef pci_ss_info_127a_0122 +#define pci_ss_info_127a_0122 pci_ss_info_109e_0879_127a_0122 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0144 = + {0x127a, 0x0144, pci_subsys_109e_0879_127a_0144, 0}; +#undef pci_ss_info_127a_0144 +#define pci_ss_info_127a_0144 pci_ss_info_109e_0879_127a_0144 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0222 = + {0x127a, 0x0222, pci_subsys_109e_0879_127a_0222, 0}; +#undef pci_ss_info_127a_0222 +#define pci_ss_info_127a_0222 pci_ss_info_109e_0879_127a_0222 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0244 = + {0x127a, 0x0244, pci_subsys_109e_0879_127a_0244, 0}; +#undef pci_ss_info_127a_0244 +#define pci_ss_info_127a_0244 pci_ss_info_109e_0879_127a_0244 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0322 = + {0x127a, 0x0322, pci_subsys_109e_0879_127a_0322, 0}; +#undef pci_ss_info_127a_0322 +#define pci_ss_info_127a_0322 pci_ss_info_109e_0879_127a_0322 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_0422 = + {0x127a, 0x0422, pci_subsys_109e_0879_127a_0422, 0}; +#undef pci_ss_info_127a_0422 +#define pci_ss_info_127a_0422 pci_ss_info_109e_0879_127a_0422 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_1122 = + {0x127a, 0x1122, pci_subsys_109e_0879_127a_1122, 0}; +#undef pci_ss_info_127a_1122 +#define pci_ss_info_127a_1122 pci_ss_info_109e_0879_127a_1122 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_1222 = + {0x127a, 0x1222, pci_subsys_109e_0879_127a_1222, 0}; +#undef pci_ss_info_127a_1222 +#define pci_ss_info_127a_1222 pci_ss_info_109e_0879_127a_1222 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_1322 = + {0x127a, 0x1322, pci_subsys_109e_0879_127a_1322, 0}; +#undef pci_ss_info_127a_1322 +#define pci_ss_info_127a_1322 pci_ss_info_109e_0879_127a_1322 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_1522 = + {0x127a, 0x1522, pci_subsys_109e_0879_127a_1522, 0}; +#undef pci_ss_info_127a_1522 +#define pci_ss_info_127a_1522 pci_ss_info_109e_0879_127a_1522 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_1622 = + {0x127a, 0x1622, pci_subsys_109e_0879_127a_1622, 0}; +#undef pci_ss_info_127a_1622 +#define pci_ss_info_127a_1622 pci_ss_info_109e_0879_127a_1622 +static const pciSubsystemInfo pci_ss_info_109e_0879_127a_1722 = + {0x127a, 0x1722, pci_subsys_109e_0879_127a_1722, 0}; +#undef pci_ss_info_127a_1722 +#define pci_ss_info_127a_1722 pci_ss_info_109e_0879_127a_1722 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0044 = + {0x14f1, 0x0044, pci_subsys_109e_0879_14f1_0044, 0}; +#undef pci_ss_info_14f1_0044 +#define pci_ss_info_14f1_0044 pci_ss_info_109e_0879_14f1_0044 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0122 = + {0x14f1, 0x0122, pci_subsys_109e_0879_14f1_0122, 0}; +#undef pci_ss_info_14f1_0122 +#define pci_ss_info_14f1_0122 pci_ss_info_109e_0879_14f1_0122 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0144 = + {0x14f1, 0x0144, pci_subsys_109e_0879_14f1_0144, 0}; +#undef pci_ss_info_14f1_0144 +#define pci_ss_info_14f1_0144 pci_ss_info_109e_0879_14f1_0144 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0222 = + {0x14f1, 0x0222, pci_subsys_109e_0879_14f1_0222, 0}; +#undef pci_ss_info_14f1_0222 +#define pci_ss_info_14f1_0222 pci_ss_info_109e_0879_14f1_0222 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0244 = + {0x14f1, 0x0244, pci_subsys_109e_0879_14f1_0244, 0}; +#undef pci_ss_info_14f1_0244 +#define pci_ss_info_14f1_0244 pci_ss_info_109e_0879_14f1_0244 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0322 = + {0x14f1, 0x0322, pci_subsys_109e_0879_14f1_0322, 0}; +#undef pci_ss_info_14f1_0322 +#define pci_ss_info_14f1_0322 pci_ss_info_109e_0879_14f1_0322 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_0422 = + {0x14f1, 0x0422, pci_subsys_109e_0879_14f1_0422, 0}; +#undef pci_ss_info_14f1_0422 +#define pci_ss_info_14f1_0422 pci_ss_info_109e_0879_14f1_0422 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_1122 = + {0x14f1, 0x1122, pci_subsys_109e_0879_14f1_1122, 0}; +#undef pci_ss_info_14f1_1122 +#define pci_ss_info_14f1_1122 pci_ss_info_109e_0879_14f1_1122 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_1222 = + {0x14f1, 0x1222, pci_subsys_109e_0879_14f1_1222, 0}; +#undef pci_ss_info_14f1_1222 +#define pci_ss_info_14f1_1222 pci_ss_info_109e_0879_14f1_1222 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_1322 = + {0x14f1, 0x1322, pci_subsys_109e_0879_14f1_1322, 0}; +#undef pci_ss_info_14f1_1322 +#define pci_ss_info_14f1_1322 pci_ss_info_109e_0879_14f1_1322 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_1522 = + {0x14f1, 0x1522, pci_subsys_109e_0879_14f1_1522, 0}; +#undef pci_ss_info_14f1_1522 +#define pci_ss_info_14f1_1522 pci_ss_info_109e_0879_14f1_1522 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_1622 = + {0x14f1, 0x1622, pci_subsys_109e_0879_14f1_1622, 0}; +#undef pci_ss_info_14f1_1622 +#define pci_ss_info_14f1_1622 pci_ss_info_109e_0879_14f1_1622 +static const pciSubsystemInfo pci_ss_info_109e_0879_14f1_1722 = + {0x14f1, 0x1722, pci_subsys_109e_0879_14f1_1722, 0}; +#undef pci_ss_info_14f1_1722 +#define pci_ss_info_14f1_1722 pci_ss_info_109e_0879_14f1_1722 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b4_1b1d_10b4_237e = + {0x10b4, 0x237e, pci_subsys_10b4_1b1d_10b4_237e, 0}; +#undef pci_ss_info_10b4_237e +#define pci_ss_info_10b4_237e pci_ss_info_10b4_1b1d_10b4_237e +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b5_9030_15ed_1002 = + {0x15ed, 0x1002, pci_subsys_10b5_9030_15ed_1002, 0}; +#undef pci_ss_info_15ed_1002 +#define pci_ss_info_15ed_1002 pci_ss_info_10b5_9030_15ed_1002 +static const pciSubsystemInfo pci_ss_info_10b5_9030_15ed_1003 = + {0x15ed, 0x1003, pci_subsys_10b5_9030_15ed_1003, 0}; +#undef pci_ss_info_15ed_1003 +#define pci_ss_info_15ed_1003 pci_ss_info_10b5_9030_15ed_1003 +static const pciSubsystemInfo pci_ss_info_10b5_9050_10b5_2036 = + {0x10b5, 0x2036, pci_subsys_10b5_9050_10b5_2036, 0}; +#undef pci_ss_info_10b5_2036 +#define pci_ss_info_10b5_2036 pci_ss_info_10b5_9050_10b5_2036 +static const pciSubsystemInfo pci_ss_info_10b5_9050_10b5_2273 = + {0x10b5, 0x2273, pci_subsys_10b5_9050_10b5_2273, 0}; +#undef pci_ss_info_10b5_2273 +#define pci_ss_info_10b5_2273 pci_ss_info_10b5_9050_10b5_2273 +static const pciSubsystemInfo pci_ss_info_10b5_9050_10b5_9050 = + {0x10b5, 0x9050, pci_subsys_10b5_9050_10b5_9050, 0}; +#undef pci_ss_info_10b5_9050 +#define pci_ss_info_10b5_9050 pci_ss_info_10b5_9050_10b5_9050 +static const pciSubsystemInfo pci_ss_info_10b5_9050_1522_0001 = + {0x1522, 0x0001, pci_subsys_10b5_9050_1522_0001, 0}; +#undef pci_ss_info_1522_0001 +#define pci_ss_info_1522_0001 pci_ss_info_10b5_9050_1522_0001 +static const pciSubsystemInfo pci_ss_info_10b5_9050_1522_0002 = + {0x1522, 0x0002, pci_subsys_10b5_9050_1522_0002, 0}; +#undef pci_ss_info_1522_0002 +#define pci_ss_info_1522_0002 pci_ss_info_10b5_9050_1522_0002 +static const pciSubsystemInfo pci_ss_info_10b5_9050_1522_0003 = + {0x1522, 0x0003, pci_subsys_10b5_9050_1522_0003, 0}; +#undef pci_ss_info_1522_0003 +#define pci_ss_info_1522_0003 pci_ss_info_10b5_9050_1522_0003 +static const pciSubsystemInfo pci_ss_info_10b5_9050_1522_0004 = + {0x1522, 0x0004, pci_subsys_10b5_9050_1522_0004, 0}; +#undef pci_ss_info_1522_0004 +#define pci_ss_info_1522_0004 pci_ss_info_10b5_9050_1522_0004 +static const pciSubsystemInfo pci_ss_info_10b5_9050_1522_0010 = + {0x1522, 0x0010, pci_subsys_10b5_9050_1522_0010, 0}; +#undef pci_ss_info_1522_0010 +#define pci_ss_info_1522_0010 pci_ss_info_10b5_9050_1522_0010 +static const pciSubsystemInfo pci_ss_info_10b5_9050_1522_0020 = + {0x1522, 0x0020, pci_subsys_10b5_9050_1522_0020, 0}; +#undef pci_ss_info_1522_0020 +#define pci_ss_info_1522_0020 pci_ss_info_10b5_9050_1522_0020 +static const pciSubsystemInfo pci_ss_info_10b5_9050_15ed_1000 = + {0x15ed, 0x1000, pci_subsys_10b5_9050_15ed_1000, 0}; +#undef pci_ss_info_15ed_1000 +#define pci_ss_info_15ed_1000 pci_ss_info_10b5_9050_15ed_1000 +static const pciSubsystemInfo pci_ss_info_10b5_9050_15ed_1001 = + {0x15ed, 0x1001, pci_subsys_10b5_9050_15ed_1001, 0}; +#undef pci_ss_info_15ed_1001 +#define pci_ss_info_15ed_1001 pci_ss_info_10b5_9050_15ed_1001 +static const pciSubsystemInfo pci_ss_info_10b5_9050_15ed_1002 = + {0x15ed, 0x1002, pci_subsys_10b5_9050_15ed_1002, 0}; +#undef pci_ss_info_15ed_1002 +#define pci_ss_info_15ed_1002 pci_ss_info_10b5_9050_15ed_1002 +static const pciSubsystemInfo pci_ss_info_10b5_9050_15ed_1003 = + {0x15ed, 0x1003, pci_subsys_10b5_9050_15ed_1003, 0}; +#undef pci_ss_info_15ed_1003 +#define pci_ss_info_15ed_1003 pci_ss_info_10b5_9050_15ed_1003 +static const pciSubsystemInfo pci_ss_info_10b5_9050_5654_5634 = + {0x5654, 0x5634, pci_subsys_10b5_9050_5654_5634, 0}; +#undef pci_ss_info_5654_5634 +#define pci_ss_info_5654_5634 pci_ss_info_10b5_9050_5654_5634 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d531_c002 = + {0xd531, 0xc002, pci_subsys_10b5_9050_d531_c002, 0}; +#undef pci_ss_info_d531_c002 +#define pci_ss_info_d531_c002 pci_ss_info_10b5_9050_d531_c002 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4006 = + {0xd84d, 0x4006, pci_subsys_10b5_9050_d84d_4006, 0}; +#undef pci_ss_info_d84d_4006 +#define pci_ss_info_d84d_4006 pci_ss_info_10b5_9050_d84d_4006 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4008 = + {0xd84d, 0x4008, pci_subsys_10b5_9050_d84d_4008, 0}; +#undef pci_ss_info_d84d_4008 +#define pci_ss_info_d84d_4008 pci_ss_info_10b5_9050_d84d_4008 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4014 = + {0xd84d, 0x4014, pci_subsys_10b5_9050_d84d_4014, 0}; +#undef pci_ss_info_d84d_4014 +#define pci_ss_info_d84d_4014 pci_ss_info_10b5_9050_d84d_4014 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4018 = + {0xd84d, 0x4018, pci_subsys_10b5_9050_d84d_4018, 0}; +#undef pci_ss_info_d84d_4018 +#define pci_ss_info_d84d_4018 pci_ss_info_10b5_9050_d84d_4018 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4025 = + {0xd84d, 0x4025, pci_subsys_10b5_9050_d84d_4025, 0}; +#undef pci_ss_info_d84d_4025 +#define pci_ss_info_d84d_4025 pci_ss_info_10b5_9050_d84d_4025 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4027 = + {0xd84d, 0x4027, pci_subsys_10b5_9050_d84d_4027, 0}; +#undef pci_ss_info_d84d_4027 +#define pci_ss_info_d84d_4027 pci_ss_info_10b5_9050_d84d_4027 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4028 = + {0xd84d, 0x4028, pci_subsys_10b5_9050_d84d_4028, 0}; +#undef pci_ss_info_d84d_4028 +#define pci_ss_info_d84d_4028 pci_ss_info_10b5_9050_d84d_4028 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4036 = + {0xd84d, 0x4036, pci_subsys_10b5_9050_d84d_4036, 0}; +#undef pci_ss_info_d84d_4036 +#define pci_ss_info_d84d_4036 pci_ss_info_10b5_9050_d84d_4036 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4037 = + {0xd84d, 0x4037, pci_subsys_10b5_9050_d84d_4037, 0}; +#undef pci_ss_info_d84d_4037 +#define pci_ss_info_d84d_4037 pci_ss_info_10b5_9050_d84d_4037 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4038 = + {0xd84d, 0x4038, pci_subsys_10b5_9050_d84d_4038, 0}; +#undef pci_ss_info_d84d_4038 +#define pci_ss_info_d84d_4038 pci_ss_info_10b5_9050_d84d_4038 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4052 = + {0xd84d, 0x4052, pci_subsys_10b5_9050_d84d_4052, 0}; +#undef pci_ss_info_d84d_4052 +#define pci_ss_info_d84d_4052 pci_ss_info_10b5_9050_d84d_4052 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4053 = + {0xd84d, 0x4053, pci_subsys_10b5_9050_d84d_4053, 0}; +#undef pci_ss_info_d84d_4053 +#define pci_ss_info_d84d_4053 pci_ss_info_10b5_9050_d84d_4053 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4055 = + {0xd84d, 0x4055, pci_subsys_10b5_9050_d84d_4055, 0}; +#undef pci_ss_info_d84d_4055 +#define pci_ss_info_d84d_4055 pci_ss_info_10b5_9050_d84d_4055 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4058 = + {0xd84d, 0x4058, pci_subsys_10b5_9050_d84d_4058, 0}; +#undef pci_ss_info_d84d_4058 +#define pci_ss_info_d84d_4058 pci_ss_info_10b5_9050_d84d_4058 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4065 = + {0xd84d, 0x4065, pci_subsys_10b5_9050_d84d_4065, 0}; +#undef pci_ss_info_d84d_4065 +#define pci_ss_info_d84d_4065 pci_ss_info_10b5_9050_d84d_4065 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4068 = + {0xd84d, 0x4068, pci_subsys_10b5_9050_d84d_4068, 0}; +#undef pci_ss_info_d84d_4068 +#define pci_ss_info_d84d_4068 pci_ss_info_10b5_9050_d84d_4068 +static const pciSubsystemInfo pci_ss_info_10b5_9050_d84d_4078 = + {0xd84d, 0x4078, pci_subsys_10b5_9050_d84d_4078, 0}; +#undef pci_ss_info_d84d_4078 +#define pci_ss_info_d84d_4078 pci_ss_info_10b5_9050_d84d_4078 +static const pciSubsystemInfo pci_ss_info_10b5_9054_10b5_2455 = + {0x10b5, 0x2455, pci_subsys_10b5_9054_10b5_2455, 0}; +#undef pci_ss_info_10b5_2455 +#define pci_ss_info_10b5_2455 pci_ss_info_10b5_9054_10b5_2455 +static const pciSubsystemInfo pci_ss_info_10b5_906d_125c_0640 = + {0x125c, 0x0640, pci_subsys_10b5_906d_125c_0640, 0}; +#undef pci_ss_info_125c_0640 +#define pci_ss_info_125c_0640 pci_ss_info_10b5_906d_125c_0640 +static const pciSubsystemInfo pci_ss_info_10b5_9080_10b5_9080 = + {0x10b5, 0x9080, pci_subsys_10b5_9080_10b5_9080, 0}; +#undef pci_ss_info_10b5_9080 +#define pci_ss_info_10b5_9080 pci_ss_info_10b5_9080_10b5_9080 +static const pciSubsystemInfo pci_ss_info_10b5_9080_129d_0002 = + {0x129d, 0x0002, pci_subsys_10b5_9080_129d_0002, 0}; +#undef pci_ss_info_129d_0002 +#define pci_ss_info_129d_0002 pci_ss_info_10b5_9080_129d_0002 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b6_0002_10b6_0002 = + {0x10b6, 0x0002, pci_subsys_10b6_0002_10b6_0002, 0}; +#undef pci_ss_info_10b6_0002 +#define pci_ss_info_10b6_0002 pci_ss_info_10b6_0002_10b6_0002 +static const pciSubsystemInfo pci_ss_info_10b6_0002_10b6_0006 = + {0x10b6, 0x0006, pci_subsys_10b6_0002_10b6_0006, 0}; +#undef pci_ss_info_10b6_0006 +#define pci_ss_info_10b6_0006 pci_ss_info_10b6_0002_10b6_0006 +#endif +static const pciSubsystemInfo pci_ss_info_10b6_0003_0e11_b0fd = + {0x0e11, 0xb0fd, pci_subsys_10b6_0003_0e11_b0fd, 0}; +#undef pci_ss_info_0e11_b0fd +#define pci_ss_info_0e11_b0fd pci_ss_info_10b6_0003_0e11_b0fd +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b6_0003_10b6_0003 = + {0x10b6, 0x0003, pci_subsys_10b6_0003_10b6_0003, 0}; +#undef pci_ss_info_10b6_0003 +#define pci_ss_info_10b6_0003 pci_ss_info_10b6_0003_10b6_0003 +static const pciSubsystemInfo pci_ss_info_10b6_0003_10b6_0007 = + {0x10b6, 0x0007, pci_subsys_10b6_0003_10b6_0007, 0}; +#undef pci_ss_info_10b6_0007 +#define pci_ss_info_10b6_0007 pci_ss_info_10b6_0003_10b6_0007 +static const pciSubsystemInfo pci_ss_info_10b6_0006_10b6_0006 = + {0x10b6, 0x0006, pci_subsys_10b6_0006_10b6_0006, 0}; +#undef pci_ss_info_10b6_0006 +#define pci_ss_info_10b6_0006 pci_ss_info_10b6_0006_10b6_0006 +static const pciSubsystemInfo pci_ss_info_10b6_0007_10b6_0007 = + {0x10b6, 0x0007, pci_subsys_10b6_0007_10b6_0007, 0}; +#undef pci_ss_info_10b6_0007 +#define pci_ss_info_10b6_0007 pci_ss_info_10b6_0007_10b6_0007 +static const pciSubsystemInfo pci_ss_info_10b6_0009_10b6_0009 = + {0x10b6, 0x0009, pci_subsys_10b6_0009_10b6_0009, 0}; +#undef pci_ss_info_10b6_0009 +#define pci_ss_info_10b6_0009 pci_ss_info_10b6_0009_10b6_0009 +static const pciSubsystemInfo pci_ss_info_10b6_000a_10b6_000a = + {0x10b6, 0x000a, pci_subsys_10b6_000a_10b6_000a, 0}; +#undef pci_ss_info_10b6_000a +#define pci_ss_info_10b6_000a pci_ss_info_10b6_000a_10b6_000a +static const pciSubsystemInfo pci_ss_info_10b6_000b_10b6_0008 = + {0x10b6, 0x0008, pci_subsys_10b6_000b_10b6_0008, 0}; +#undef pci_ss_info_10b6_0008 +#define pci_ss_info_10b6_0008 pci_ss_info_10b6_000b_10b6_0008 +static const pciSubsystemInfo pci_ss_info_10b6_000b_10b6_000b = + {0x10b6, 0x000b, pci_subsys_10b6_000b_10b6_000b, 0}; +#undef pci_ss_info_10b6_000b +#define pci_ss_info_10b6_000b pci_ss_info_10b6_000b_10b6_000b +static const pciSubsystemInfo pci_ss_info_10b6_000c_10b6_000c = + {0x10b6, 0x000c, pci_subsys_10b6_000c_10b6_000c, 0}; +#undef pci_ss_info_10b6_000c +#define pci_ss_info_10b6_000c pci_ss_info_10b6_000c_10b6_000c +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b7_1007_10b7_615c = + {0x10b7, 0x615c, pci_subsys_10b7_1007_10b7_615c, 0}; +#undef pci_ss_info_10b7_615c +#define pci_ss_info_10b7_615c pci_ss_info_10b7_1007_10b7_615c +static const pciSubsystemInfo pci_ss_info_10b7_3590_10b7_3590 = + {0x10b7, 0x3590, pci_subsys_10b7_3590_10b7_3590, 0}; +#undef pci_ss_info_10b7_3590 +#define pci_ss_info_10b7_3590 pci_ss_info_10b7_3590_10b7_3590 +static const pciSubsystemInfo pci_ss_info_10b7_5057_10b7_5a57 = + {0x10b7, 0x5a57, pci_subsys_10b7_5057_10b7_5a57, 0}; +#undef pci_ss_info_10b7_5a57 +#define pci_ss_info_10b7_5a57 pci_ss_info_10b7_5057_10b7_5a57 +static const pciSubsystemInfo pci_ss_info_10b7_5157_10b7_5b57 = + {0x10b7, 0x5b57, pci_subsys_10b7_5157_10b7_5b57, 0}; +#undef pci_ss_info_10b7_5b57 +#define pci_ss_info_10b7_5b57 pci_ss_info_10b7_5157_10b7_5b57 +static const pciSubsystemInfo pci_ss_info_10b7_5257_10b7_5c57 = + {0x10b7, 0x5c57, pci_subsys_10b7_5257_10b7_5c57, 0}; +#undef pci_ss_info_10b7_5c57 +#define pci_ss_info_10b7_5c57 pci_ss_info_10b7_5257_10b7_5c57 +static const pciSubsystemInfo pci_ss_info_10b7_5b57_10b7_5b57 = + {0x10b7, 0x5b57, pci_subsys_10b7_5b57_10b7_5b57, 0}; +#undef pci_ss_info_10b7_5b57 +#define pci_ss_info_10b7_5b57 pci_ss_info_10b7_5b57_10b7_5b57 +static const pciSubsystemInfo pci_ss_info_10b7_6056_10b7_6556 = + {0x10b7, 0x6556, pci_subsys_10b7_6056_10b7_6556, 0}; +#undef pci_ss_info_10b7_6556 +#define pci_ss_info_10b7_6556 pci_ss_info_10b7_6056_10b7_6556 +static const pciSubsystemInfo pci_ss_info_10b7_6560_10b7_656a = + {0x10b7, 0x656a, pci_subsys_10b7_6560_10b7_656a, 0}; +#undef pci_ss_info_10b7_656a +#define pci_ss_info_10b7_656a pci_ss_info_10b7_6560_10b7_656a +static const pciSubsystemInfo pci_ss_info_10b7_6561_10b7_656b = + {0x10b7, 0x656b, pci_subsys_10b7_6561_10b7_656b, 0}; +#undef pci_ss_info_10b7_656b +#define pci_ss_info_10b7_656b pci_ss_info_10b7_6561_10b7_656b +static const pciSubsystemInfo pci_ss_info_10b7_6562_10b7_656b = + {0x10b7, 0x656b, pci_subsys_10b7_6562_10b7_656b, 0}; +#undef pci_ss_info_10b7_656b +#define pci_ss_info_10b7_656b pci_ss_info_10b7_6562_10b7_656b +static const pciSubsystemInfo pci_ss_info_10b7_6563_10b7_656b = + {0x10b7, 0x656b, pci_subsys_10b7_6563_10b7_656b, 0}; +#undef pci_ss_info_10b7_656b +#define pci_ss_info_10b7_656b pci_ss_info_10b7_6563_10b7_656b +static const pciSubsystemInfo pci_ss_info_10b7_9004_10b7_9004 = + {0x10b7, 0x9004, pci_subsys_10b7_9004_10b7_9004, 0}; +#undef pci_ss_info_10b7_9004 +#define pci_ss_info_10b7_9004 pci_ss_info_10b7_9004_10b7_9004 +static const pciSubsystemInfo pci_ss_info_10b7_9005_10b7_9005 = + {0x10b7, 0x9005, pci_subsys_10b7_9005_10b7_9005, 0}; +#undef pci_ss_info_10b7_9005 +#define pci_ss_info_10b7_9005 pci_ss_info_10b7_9005_10b7_9005 +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0080 = + {0x1028, 0x0080, pci_subsys_10b7_9055_1028_0080, 0}; +#undef pci_ss_info_1028_0080 +#define pci_ss_info_1028_0080 pci_ss_info_10b7_9055_1028_0080 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0081 = + {0x1028, 0x0081, pci_subsys_10b7_9055_1028_0081, 0}; +#undef pci_ss_info_1028_0081 +#define pci_ss_info_1028_0081 pci_ss_info_10b7_9055_1028_0081 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0082 = + {0x1028, 0x0082, pci_subsys_10b7_9055_1028_0082, 0}; +#undef pci_ss_info_1028_0082 +#define pci_ss_info_1028_0082 pci_ss_info_10b7_9055_1028_0082 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0083 = + {0x1028, 0x0083, pci_subsys_10b7_9055_1028_0083, 0}; +#undef pci_ss_info_1028_0083 +#define pci_ss_info_1028_0083 pci_ss_info_10b7_9055_1028_0083 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0084 = + {0x1028, 0x0084, pci_subsys_10b7_9055_1028_0084, 0}; +#undef pci_ss_info_1028_0084 +#define pci_ss_info_1028_0084 pci_ss_info_10b7_9055_1028_0084 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0085 = + {0x1028, 0x0085, pci_subsys_10b7_9055_1028_0085, 0}; +#undef pci_ss_info_1028_0085 +#define pci_ss_info_1028_0085 pci_ss_info_10b7_9055_1028_0085 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0086 = + {0x1028, 0x0086, pci_subsys_10b7_9055_1028_0086, 0}; +#undef pci_ss_info_1028_0086 +#define pci_ss_info_1028_0086 pci_ss_info_10b7_9055_1028_0086 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0087 = + {0x1028, 0x0087, pci_subsys_10b7_9055_1028_0087, 0}; +#undef pci_ss_info_1028_0087 +#define pci_ss_info_1028_0087 pci_ss_info_10b7_9055_1028_0087 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0088 = + {0x1028, 0x0088, pci_subsys_10b7_9055_1028_0088, 0}; +#undef pci_ss_info_1028_0088 +#define pci_ss_info_1028_0088 pci_ss_info_10b7_9055_1028_0088 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0089 = + {0x1028, 0x0089, pci_subsys_10b7_9055_1028_0089, 0}; +#undef pci_ss_info_1028_0089 +#define pci_ss_info_1028_0089 pci_ss_info_10b7_9055_1028_0089 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0090 = + {0x1028, 0x0090, pci_subsys_10b7_9055_1028_0090, 0}; +#undef pci_ss_info_1028_0090 +#define pci_ss_info_1028_0090 pci_ss_info_10b7_9055_1028_0090 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0091 = + {0x1028, 0x0091, pci_subsys_10b7_9055_1028_0091, 0}; +#undef pci_ss_info_1028_0091 +#define pci_ss_info_1028_0091 pci_ss_info_10b7_9055_1028_0091 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0092 = + {0x1028, 0x0092, pci_subsys_10b7_9055_1028_0092, 0}; +#undef pci_ss_info_1028_0092 +#define pci_ss_info_1028_0092 pci_ss_info_10b7_9055_1028_0092 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0093 = + {0x1028, 0x0093, pci_subsys_10b7_9055_1028_0093, 0}; +#undef pci_ss_info_1028_0093 +#define pci_ss_info_1028_0093 pci_ss_info_10b7_9055_1028_0093 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0094 = + {0x1028, 0x0094, pci_subsys_10b7_9055_1028_0094, 0}; +#undef pci_ss_info_1028_0094 +#define pci_ss_info_1028_0094 pci_ss_info_10b7_9055_1028_0094 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0095 = + {0x1028, 0x0095, pci_subsys_10b7_9055_1028_0095, 0}; +#undef pci_ss_info_1028_0095 +#define pci_ss_info_1028_0095 pci_ss_info_10b7_9055_1028_0095 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0096 = + {0x1028, 0x0096, pci_subsys_10b7_9055_1028_0096, 0}; +#undef pci_ss_info_1028_0096 +#define pci_ss_info_1028_0096 pci_ss_info_10b7_9055_1028_0096 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0097 = + {0x1028, 0x0097, pci_subsys_10b7_9055_1028_0097, 0}; +#undef pci_ss_info_1028_0097 +#define pci_ss_info_1028_0097 pci_ss_info_10b7_9055_1028_0097 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0098 = + {0x1028, 0x0098, pci_subsys_10b7_9055_1028_0098, 0}; +#undef pci_ss_info_1028_0098 +#define pci_ss_info_1028_0098 pci_ss_info_10b7_9055_1028_0098 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9055_1028_0099 = + {0x1028, 0x0099, pci_subsys_10b7_9055_1028_0099, 0}; +#undef pci_ss_info_1028_0099 +#define pci_ss_info_1028_0099 pci_ss_info_10b7_9055_1028_0099 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b7_9055_10b7_9055 = + {0x10b7, 0x9055, pci_subsys_10b7_9055_10b7_9055, 0}; +#undef pci_ss_info_10b7_9055 +#define pci_ss_info_10b7_9055 pci_ss_info_10b7_9055_10b7_9055 +#endif +static const pciSubsystemInfo pci_ss_info_10b7_9200_1028_0095 = + {0x1028, 0x0095, pci_subsys_10b7_9200_1028_0095, 0}; +#undef pci_ss_info_1028_0095 +#define pci_ss_info_1028_0095 pci_ss_info_10b7_9200_1028_0095 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b7_9200_10b7_1000 = + {0x10b7, 0x1000, pci_subsys_10b7_9200_10b7_1000, 0}; +#undef pci_ss_info_10b7_1000 +#define pci_ss_info_10b7_1000 pci_ss_info_10b7_9200_10b7_1000 +static const pciSubsystemInfo pci_ss_info_10b7_9200_10b7_7000 = + {0x10b7, 0x7000, pci_subsys_10b7_9200_10b7_7000, 0}; +#undef pci_ss_info_10b7_7000 +#define pci_ss_info_10b7_7000 pci_ss_info_10b7_9200_10b7_7000 +static const pciSubsystemInfo pci_ss_info_10b7_9800_10b7_9800 = + {0x10b7, 0x9800, pci_subsys_10b7_9800_10b7_9800, 0}; +#undef pci_ss_info_10b7_9800 +#define pci_ss_info_10b7_9800 pci_ss_info_10b7_9800_10b7_9800 +static const pciSubsystemInfo pci_ss_info_10b7_9805_10b7_1201 = + {0x10b7, 0x1201, pci_subsys_10b7_9805_10b7_1201, 0}; +#undef pci_ss_info_10b7_1201 +#define pci_ss_info_10b7_1201 pci_ss_info_10b7_9805_10b7_1201 +static const pciSubsystemInfo pci_ss_info_10b7_9805_10b7_1202 = + {0x10b7, 0x1202, pci_subsys_10b7_9805_10b7_1202, 0}; +#undef pci_ss_info_10b7_1202 +#define pci_ss_info_10b7_1202 pci_ss_info_10b7_9805_10b7_1202 +static const pciSubsystemInfo pci_ss_info_10b7_9805_10b7_9805 = + {0x10b7, 0x9805, pci_subsys_10b7_9805_10b7_9805, 0}; +#undef pci_ss_info_10b7_9805 +#define pci_ss_info_10b7_9805 pci_ss_info_10b7_9805_10b7_9805 +static const pciSubsystemInfo pci_ss_info_10b7_9805_10f1_2462 = + {0x10f1, 0x2462, pci_subsys_10b7_9805_10f1_2462, 0}; +#undef pci_ss_info_10f1_2462 +#define pci_ss_info_10f1_2462 pci_ss_info_10b7_9805_10f1_2462 +static const pciSubsystemInfo pci_ss_info_10b7_9904_10b7_1000 = + {0x10b7, 0x1000, pci_subsys_10b7_9904_10b7_1000, 0}; +#undef pci_ss_info_10b7_1000 +#define pci_ss_info_10b7_1000 pci_ss_info_10b7_9904_10b7_1000 +static const pciSubsystemInfo pci_ss_info_10b7_9904_10b7_2000 = + {0x10b7, 0x2000, pci_subsys_10b7_9904_10b7_2000, 0}; +#undef pci_ss_info_10b7_2000 +#define pci_ss_info_10b7_2000 pci_ss_info_10b7_9904_10b7_2000 +static const pciSubsystemInfo pci_ss_info_10b7_9905_10b7_1101 = + {0x10b7, 0x1101, pci_subsys_10b7_9905_10b7_1101, 0}; +#undef pci_ss_info_10b7_1101 +#define pci_ss_info_10b7_1101 pci_ss_info_10b7_9905_10b7_1101 +static const pciSubsystemInfo pci_ss_info_10b7_9905_10b7_1102 = + {0x10b7, 0x1102, pci_subsys_10b7_9905_10b7_1102, 0}; +#undef pci_ss_info_10b7_1102 +#define pci_ss_info_10b7_1102 pci_ss_info_10b7_9905_10b7_1102 +static const pciSubsystemInfo pci_ss_info_10b7_9905_10b7_2101 = + {0x10b7, 0x2101, pci_subsys_10b7_9905_10b7_2101, 0}; +#undef pci_ss_info_10b7_2101 +#define pci_ss_info_10b7_2101 pci_ss_info_10b7_9905_10b7_2101 +static const pciSubsystemInfo pci_ss_info_10b7_9905_10b7_2102 = + {0x10b7, 0x2102, pci_subsys_10b7_9905_10b7_2102, 0}; +#undef pci_ss_info_10b7_2102 +#define pci_ss_info_10b7_2102 pci_ss_info_10b7_9905_10b7_2102 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10b8_0005_1055_e000 = + {0x1055, 0xe000, pci_subsys_10b8_0005_1055_e000, 0}; +#undef pci_ss_info_1055_e000 +#define pci_ss_info_1055_e000 pci_ss_info_10b8_0005_1055_e000 +static const pciSubsystemInfo pci_ss_info_10b8_0005_1055_e002 = + {0x1055, 0xe002, pci_subsys_10b8_0005_1055_e002, 0}; +#undef pci_ss_info_1055_e002 +#define pci_ss_info_1055_e002 pci_ss_info_10b8_0005_1055_e002 +static const pciSubsystemInfo pci_ss_info_10b8_0005_10b8_a011 = + {0x10b8, 0xa011, pci_subsys_10b8_0005_10b8_a011, 0}; +#undef pci_ss_info_10b8_a011 +#define pci_ss_info_10b8_a011 pci_ss_info_10b8_0005_10b8_a011 +static const pciSubsystemInfo pci_ss_info_10b8_0005_10b8_a014 = + {0x10b8, 0xa014, pci_subsys_10b8_0005_10b8_a014, 0}; +#undef pci_ss_info_10b8_a014 +#define pci_ss_info_10b8_a014 pci_ss_info_10b8_0005_10b8_a014 +static const pciSubsystemInfo pci_ss_info_10b8_0005_10b8_a015 = + {0x10b8, 0xa015, pci_subsys_10b8_0005_10b8_a015, 0}; +#undef pci_ss_info_10b8_a015 +#define pci_ss_info_10b8_a015 pci_ss_info_10b8_0005_10b8_a015 +static const pciSubsystemInfo pci_ss_info_10b8_0005_10b8_a016 = + {0x10b8, 0xa016, pci_subsys_10b8_0005_10b8_a016, 0}; +#undef pci_ss_info_10b8_a016 +#define pci_ss_info_10b8_a016 pci_ss_info_10b8_0005_10b8_a016 +static const pciSubsystemInfo pci_ss_info_10b8_0005_10b8_a017 = + {0x10b8, 0xa017, pci_subsys_10b8_0005_10b8_a017, 0}; +#undef pci_ss_info_10b8_a017 +#define pci_ss_info_10b8_a017 pci_ss_info_10b8_0005_10b8_a017 +static const pciSubsystemInfo pci_ss_info_10b8_0006_1055_e100 = + {0x1055, 0xe100, pci_subsys_10b8_0006_1055_e100, 0}; +#undef pci_ss_info_1055_e100 +#define pci_ss_info_1055_e100 pci_ss_info_10b8_0006_1055_e100 +static const pciSubsystemInfo pci_ss_info_10b8_0006_1055_e102 = + {0x1055, 0xe102, pci_subsys_10b8_0006_1055_e102, 0}; +#undef pci_ss_info_1055_e102 +#define pci_ss_info_1055_e102 pci_ss_info_10b8_0006_1055_e102 +static const pciSubsystemInfo pci_ss_info_10b8_0006_1055_e300 = + {0x1055, 0xe300, pci_subsys_10b8_0006_1055_e300, 0}; +#undef pci_ss_info_1055_e300 +#define pci_ss_info_1055_e300 pci_ss_info_10b8_0006_1055_e300 +static const pciSubsystemInfo pci_ss_info_10b8_0006_1055_e302 = + {0x1055, 0xe302, pci_subsys_10b8_0006_1055_e302, 0}; +#undef pci_ss_info_1055_e302 +#define pci_ss_info_1055_e302 pci_ss_info_10b8_0006_1055_e302 +static const pciSubsystemInfo pci_ss_info_10b8_0006_10b8_a012 = + {0x10b8, 0xa012, pci_subsys_10b8_0006_10b8_a012, 0}; +#undef pci_ss_info_10b8_a012 +#define pci_ss_info_10b8_a012 pci_ss_info_10b8_0006_10b8_a012 +static const pciSubsystemInfo pci_ss_info_10b8_0006_13a2_8002 = + {0x13a2, 0x8002, pci_subsys_10b8_0006_13a2_8002, 0}; +#undef pci_ss_info_13a2_8002 +#define pci_ss_info_13a2_8002 pci_ss_info_10b8_0006_13a2_8002 +static const pciSubsystemInfo pci_ss_info_10b8_0006_13a2_8006 = + {0x13a2, 0x8006, pci_subsys_10b8_0006_13a2_8006, 0}; +#undef pci_ss_info_13a2_8006 +#define pci_ss_info_13a2_8006 pci_ss_info_10b8_0006_13a2_8006 +#endif +static const pciSubsystemInfo pci_ss_info_10b9_0111_10b9_0111 = + {0x10b9, 0x0111, pci_subsys_10b9_0111_10b9_0111, 0}; +#undef pci_ss_info_10b9_0111 +#define pci_ss_info_10b9_0111 pci_ss_info_10b9_0111_10b9_0111 +static const pciSubsystemInfo pci_ss_info_10b9_1521_10b9_1521 = + {0x10b9, 0x1521, pci_subsys_10b9_1521_10b9_1521, 0}; +#undef pci_ss_info_10b9_1521 +#define pci_ss_info_10b9_1521 pci_ss_info_10b9_1521_10b9_1521 +static const pciSubsystemInfo pci_ss_info_10b9_1523_10b9_1523 = + {0x10b9, 0x1523, pci_subsys_10b9_1523_10b9_1523, 0}; +#undef pci_ss_info_10b9_1523 +#define pci_ss_info_10b9_1523 pci_ss_info_10b9_1523_10b9_1523 +static const pciSubsystemInfo pci_ss_info_10b9_1533_10b9_1533 = + {0x10b9, 0x1533, pci_subsys_10b9_1533_10b9_1533, 0}; +#undef pci_ss_info_10b9_1533 +#define pci_ss_info_10b9_1533 pci_ss_info_10b9_1533_10b9_1533 +static const pciSubsystemInfo pci_ss_info_10b9_1541_10b9_1541 = + {0x10b9, 0x1541, pci_subsys_10b9_1541_10b9_1541, 0}; +#undef pci_ss_info_10b9_1541 +#define pci_ss_info_10b9_1541 pci_ss_info_10b9_1541_10b9_1541 +static const pciSubsystemInfo pci_ss_info_10b9_5229_1043_8053 = + {0x1043, 0x8053, pci_subsys_10b9_5229_1043_8053, 0}; +#undef pci_ss_info_1043_8053 +#define pci_ss_info_1043_8053 pci_ss_info_10b9_5229_1043_8053 +static const pciSubsystemInfo pci_ss_info_10b9_5451_1014_0506 = + {0x1014, 0x0506, pci_subsys_10b9_5451_1014_0506, 0}; +#undef pci_ss_info_1014_0506 +#define pci_ss_info_1014_0506 pci_ss_info_10b9_5451_1014_0506 +static const pciSubsystemInfo pci_ss_info_10b9_7101_10b9_7101 = + {0x10b9, 0x7101, pci_subsys_10b9_7101_10b9_7101, 0}; +#undef pci_ss_info_10b9_7101 +#define pci_ss_info_10b9_7101 pci_ss_info_10b9_7101_10b9_7101 +static const pciSubsystemInfo pci_ss_info_10c8_0004_1014_00ba = + {0x1014, 0x00ba, pci_subsys_10c8_0004_1014_00ba, 0}; +#undef pci_ss_info_1014_00ba +#define pci_ss_info_1014_00ba pci_ss_info_10c8_0004_1014_00ba +static const pciSubsystemInfo pci_ss_info_10c8_0004_1025_1007 = + {0x1025, 0x1007, pci_subsys_10c8_0004_1025_1007, 0}; +#undef pci_ss_info_1025_1007 +#define pci_ss_info_1025_1007 pci_ss_info_10c8_0004_1025_1007 +static const pciSubsystemInfo pci_ss_info_10c8_0004_1028_0074 = + {0x1028, 0x0074, pci_subsys_10c8_0004_1028_0074, 0}; +#undef pci_ss_info_1028_0074 +#define pci_ss_info_1028_0074 pci_ss_info_10c8_0004_1028_0074 +static const pciSubsystemInfo pci_ss_info_10c8_0004_1028_0075 = + {0x1028, 0x0075, pci_subsys_10c8_0004_1028_0075, 0}; +#undef pci_ss_info_1028_0075 +#define pci_ss_info_1028_0075 pci_ss_info_10c8_0004_1028_0075 +static const pciSubsystemInfo pci_ss_info_10c8_0004_1028_007d = + {0x1028, 0x007d, pci_subsys_10c8_0004_1028_007d, 0}; +#undef pci_ss_info_1028_007d +#define pci_ss_info_1028_007d pci_ss_info_10c8_0004_1028_007d +static const pciSubsystemInfo pci_ss_info_10c8_0004_1028_007e = + {0x1028, 0x007e, pci_subsys_10c8_0004_1028_007e, 0}; +#undef pci_ss_info_1028_007e +#define pci_ss_info_1028_007e pci_ss_info_10c8_0004_1028_007e +static const pciSubsystemInfo pci_ss_info_10c8_0004_1033_802f = + {0x1033, 0x802f, pci_subsys_10c8_0004_1033_802f, 0}; +#undef pci_ss_info_1033_802f +#define pci_ss_info_1033_802f pci_ss_info_10c8_0004_1033_802f +static const pciSubsystemInfo pci_ss_info_10c8_0004_104d_801b = + {0x104d, 0x801b, pci_subsys_10c8_0004_104d_801b, 0}; +#undef pci_ss_info_104d_801b +#define pci_ss_info_104d_801b pci_ss_info_10c8_0004_104d_801b +static const pciSubsystemInfo pci_ss_info_10c8_0004_104d_802f = + {0x104d, 0x802f, pci_subsys_10c8_0004_104d_802f, 0}; +#undef pci_ss_info_104d_802f +#define pci_ss_info_104d_802f pci_ss_info_10c8_0004_104d_802f +static const pciSubsystemInfo pci_ss_info_10c8_0004_104d_830b = + {0x104d, 0x830b, pci_subsys_10c8_0004_104d_830b, 0}; +#undef pci_ss_info_104d_830b +#define pci_ss_info_104d_830b pci_ss_info_10c8_0004_104d_830b +static const pciSubsystemInfo pci_ss_info_10c8_0004_10ba_0e00 = + {0x10ba, 0x0e00, pci_subsys_10c8_0004_10ba_0e00, 0}; +#undef pci_ss_info_10ba_0e00 +#define pci_ss_info_10ba_0e00 pci_ss_info_10c8_0004_10ba_0e00 +static const pciSubsystemInfo pci_ss_info_10c8_0004_10c8_0004 = + {0x10c8, 0x0004, pci_subsys_10c8_0004_10c8_0004, 0}; +#undef pci_ss_info_10c8_0004 +#define pci_ss_info_10c8_0004 pci_ss_info_10c8_0004_10c8_0004 +static const pciSubsystemInfo pci_ss_info_10c8_0004_10cf_1029 = + {0x10cf, 0x1029, pci_subsys_10c8_0004_10cf_1029, 0}; +#undef pci_ss_info_10cf_1029 +#define pci_ss_info_10cf_1029 pci_ss_info_10c8_0004_10cf_1029 +static const pciSubsystemInfo pci_ss_info_10c8_0004_10f7_8308 = + {0x10f7, 0x8308, pci_subsys_10c8_0004_10f7_8308, 0}; +#undef pci_ss_info_10f7_8308 +#define pci_ss_info_10f7_8308 pci_ss_info_10c8_0004_10f7_8308 +static const pciSubsystemInfo pci_ss_info_10c8_0004_10f7_8309 = + {0x10f7, 0x8309, pci_subsys_10c8_0004_10f7_8309, 0}; +#undef pci_ss_info_10f7_8309 +#define pci_ss_info_10f7_8309 pci_ss_info_10c8_0004_10f7_8309 +static const pciSubsystemInfo pci_ss_info_10c8_0004_10f7_830b = + {0x10f7, 0x830b, pci_subsys_10c8_0004_10f7_830b, 0}; +#undef pci_ss_info_10f7_830b +#define pci_ss_info_10f7_830b pci_ss_info_10c8_0004_10f7_830b +static const pciSubsystemInfo pci_ss_info_10c8_0004_10f7_830d = + {0x10f7, 0x830d, pci_subsys_10c8_0004_10f7_830d, 0}; +#undef pci_ss_info_10f7_830d +#define pci_ss_info_10f7_830d pci_ss_info_10c8_0004_10f7_830d +static const pciSubsystemInfo pci_ss_info_10c8_0004_10f7_8312 = + {0x10f7, 0x8312, pci_subsys_10c8_0004_10f7_8312, 0}; +#undef pci_ss_info_10f7_8312 +#define pci_ss_info_10f7_8312 pci_ss_info_10c8_0004_10f7_8312 +static const pciSubsystemInfo pci_ss_info_10c8_0005_1014_00dd = + {0x1014, 0x00dd, pci_subsys_10c8_0005_1014_00dd, 0}; +#undef pci_ss_info_1014_00dd +#define pci_ss_info_1014_00dd pci_ss_info_10c8_0005_1014_00dd +static const pciSubsystemInfo pci_ss_info_10c8_0016_10c8_0016 = + {0x10c8, 0x0016, pci_subsys_10c8_0016_10c8_0016, 0}; +#undef pci_ss_info_10c8_0016 +#define pci_ss_info_10c8_0016 pci_ss_info_10c8_0016_10c8_0016 +static const pciSubsystemInfo pci_ss_info_10c8_8005_0e11_b0d1 = + {0x0e11, 0xb0d1, pci_subsys_10c8_8005_0e11_b0d1, 0}; +#undef pci_ss_info_0e11_b0d1 +#define pci_ss_info_0e11_b0d1 pci_ss_info_10c8_8005_0e11_b0d1 +static const pciSubsystemInfo pci_ss_info_10c8_8005_0e11_b126 = + {0x0e11, 0xb126, pci_subsys_10c8_8005_0e11_b126, 0}; +#undef pci_ss_info_0e11_b126 +#define pci_ss_info_0e11_b126 pci_ss_info_10c8_8005_0e11_b126 +static const pciSubsystemInfo pci_ss_info_10c8_8005_1014_00dd = + {0x1014, 0x00dd, pci_subsys_10c8_8005_1014_00dd, 0}; +#undef pci_ss_info_1014_00dd +#define pci_ss_info_1014_00dd pci_ss_info_10c8_8005_1014_00dd +static const pciSubsystemInfo pci_ss_info_10c8_8005_1025_1003 = + {0x1025, 0x1003, pci_subsys_10c8_8005_1025_1003, 0}; +#undef pci_ss_info_1025_1003 +#define pci_ss_info_1025_1003 pci_ss_info_10c8_8005_1025_1003 +static const pciSubsystemInfo pci_ss_info_10c8_8005_1028_008f = + {0x1028, 0x008f, pci_subsys_10c8_8005_1028_008f, 0}; +#undef pci_ss_info_1028_008f +#define pci_ss_info_1028_008f pci_ss_info_10c8_8005_1028_008f +static const pciSubsystemInfo pci_ss_info_10c8_8005_103c_0007 = + {0x103c, 0x0007, pci_subsys_10c8_8005_103c_0007, 0}; +#undef pci_ss_info_103c_0007 +#define pci_ss_info_103c_0007 pci_ss_info_10c8_8005_103c_0007 +static const pciSubsystemInfo pci_ss_info_10c8_8005_103c_0008 = + {0x103c, 0x0008, pci_subsys_10c8_8005_103c_0008, 0}; +#undef pci_ss_info_103c_0008 +#define pci_ss_info_103c_0008 pci_ss_info_10c8_8005_103c_0008 +static const pciSubsystemInfo pci_ss_info_10c8_8005_103c_000d = + {0x103c, 0x000d, pci_subsys_10c8_8005_103c_000d, 0}; +#undef pci_ss_info_103c_000d +#define pci_ss_info_103c_000d pci_ss_info_10c8_8005_103c_000d +static const pciSubsystemInfo pci_ss_info_10c8_8005_10c8_8005 = + {0x10c8, 0x8005, pci_subsys_10c8_8005_10c8_8005, 0}; +#undef pci_ss_info_10c8_8005 +#define pci_ss_info_10c8_8005 pci_ss_info_10c8_8005_10c8_8005 +static const pciSubsystemInfo pci_ss_info_10c8_8005_110a_8005 = + {0x110a, 0x8005, pci_subsys_10c8_8005_110a_8005, 0}; +#undef pci_ss_info_110a_8005 +#define pci_ss_info_110a_8005 pci_ss_info_10c8_8005_110a_8005 +static const pciSubsystemInfo pci_ss_info_10c8_8005_14c0_0004 = + {0x14c0, 0x0004, pci_subsys_10c8_8005_14c0_0004, 0}; +#undef pci_ss_info_14c0_0004 +#define pci_ss_info_14c0_0004 pci_ss_info_10c8_8005_14c0_0004 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10cd_1300_10cd_1310 = + {0x10cd, 0x1310, pci_subsys_10cd_1300_10cd_1310, 0}; +#undef pci_ss_info_10cd_1310 +#define pci_ss_info_10cd_1310 pci_ss_info_10cd_1300_10cd_1310 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10d9_0531_1186_1200 = + {0x1186, 0x1200, pci_subsys_10d9_0531_1186_1200, 0}; +#undef pci_ss_info_1186_1200 +#define pci_ss_info_1186_1200 pci_ss_info_10d9_0531_1186_1200 +#endif +static const pciSubsystemInfo pci_ss_info_10de_0020_1043_0200 = + {0x1043, 0x0200, pci_subsys_10de_0020_1043_0200, 0}; +#undef pci_ss_info_1043_0200 +#define pci_ss_info_1043_0200 pci_ss_info_10de_0020_1043_0200 +static const pciSubsystemInfo pci_ss_info_10de_0020_1048_0c18 = + {0x1048, 0x0c18, pci_subsys_10de_0020_1048_0c18, 0}; +#undef pci_ss_info_1048_0c18 +#define pci_ss_info_1048_0c18 pci_ss_info_10de_0020_1048_0c18 +static const pciSubsystemInfo pci_ss_info_10de_0020_1048_0c1b = + {0x1048, 0x0c1b, pci_subsys_10de_0020_1048_0c1b, 0}; +#undef pci_ss_info_1048_0c1b +#define pci_ss_info_1048_0c1b pci_ss_info_10de_0020_1048_0c1b +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_0550 = + {0x1092, 0x0550, pci_subsys_10de_0020_1092_0550, 0}; +#undef pci_ss_info_1092_0550 +#define pci_ss_info_1092_0550 pci_ss_info_10de_0020_1092_0550 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_0552 = + {0x1092, 0x0552, pci_subsys_10de_0020_1092_0552, 0}; +#undef pci_ss_info_1092_0552 +#define pci_ss_info_1092_0552 pci_ss_info_10de_0020_1092_0552 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4804 = + {0x1092, 0x4804, pci_subsys_10de_0020_1092_4804, 0}; +#undef pci_ss_info_1092_4804 +#define pci_ss_info_1092_4804 pci_ss_info_10de_0020_1092_4804 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4808 = + {0x1092, 0x4808, pci_subsys_10de_0020_1092_4808, 0}; +#undef pci_ss_info_1092_4808 +#define pci_ss_info_1092_4808 pci_ss_info_10de_0020_1092_4808 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4810 = + {0x1092, 0x4810, pci_subsys_10de_0020_1092_4810, 0}; +#undef pci_ss_info_1092_4810 +#define pci_ss_info_1092_4810 pci_ss_info_10de_0020_1092_4810 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4812 = + {0x1092, 0x4812, pci_subsys_10de_0020_1092_4812, 0}; +#undef pci_ss_info_1092_4812 +#define pci_ss_info_1092_4812 pci_ss_info_10de_0020_1092_4812 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4815 = + {0x1092, 0x4815, pci_subsys_10de_0020_1092_4815, 0}; +#undef pci_ss_info_1092_4815 +#define pci_ss_info_1092_4815 pci_ss_info_10de_0020_1092_4815 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4820 = + {0x1092, 0x4820, pci_subsys_10de_0020_1092_4820, 0}; +#undef pci_ss_info_1092_4820 +#define pci_ss_info_1092_4820 pci_ss_info_10de_0020_1092_4820 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4822 = + {0x1092, 0x4822, pci_subsys_10de_0020_1092_4822, 0}; +#undef pci_ss_info_1092_4822 +#define pci_ss_info_1092_4822 pci_ss_info_10de_0020_1092_4822 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4904 = + {0x1092, 0x4904, pci_subsys_10de_0020_1092_4904, 0}; +#undef pci_ss_info_1092_4904 +#define pci_ss_info_1092_4904 pci_ss_info_10de_0020_1092_4904 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_4914 = + {0x1092, 0x4914, pci_subsys_10de_0020_1092_4914, 0}; +#undef pci_ss_info_1092_4914 +#define pci_ss_info_1092_4914 pci_ss_info_10de_0020_1092_4914 +static const pciSubsystemInfo pci_ss_info_10de_0020_1092_8225 = + {0x1092, 0x8225, pci_subsys_10de_0020_1092_8225, 0}; +#undef pci_ss_info_1092_8225 +#define pci_ss_info_1092_8225 pci_ss_info_10de_0020_1092_8225 +static const pciSubsystemInfo pci_ss_info_10de_0020_10b4_273d = + {0x10b4, 0x273d, pci_subsys_10de_0020_10b4_273d, 0}; +#undef pci_ss_info_10b4_273d +#define pci_ss_info_10b4_273d pci_ss_info_10de_0020_10b4_273d +static const pciSubsystemInfo pci_ss_info_10de_0020_10b4_273e = + {0x10b4, 0x273e, pci_subsys_10de_0020_10b4_273e, 0}; +#undef pci_ss_info_10b4_273e +#define pci_ss_info_10b4_273e pci_ss_info_10de_0020_10b4_273e +static const pciSubsystemInfo pci_ss_info_10de_0020_10b4_2740 = + {0x10b4, 0x2740, pci_subsys_10de_0020_10b4_2740, 0}; +#undef pci_ss_info_10b4_2740 +#define pci_ss_info_10b4_2740 pci_ss_info_10de_0020_10b4_2740 +static const pciSubsystemInfo pci_ss_info_10de_0020_10de_0020 = + {0x10de, 0x0020, pci_subsys_10de_0020_10de_0020, 0}; +#undef pci_ss_info_10de_0020 +#define pci_ss_info_10de_0020 pci_ss_info_10de_0020_10de_0020 +static const pciSubsystemInfo pci_ss_info_10de_0020_1102_1015 = + {0x1102, 0x1015, pci_subsys_10de_0020_1102_1015, 0}; +#undef pci_ss_info_1102_1015 +#define pci_ss_info_1102_1015 pci_ss_info_10de_0020_1102_1015 +static const pciSubsystemInfo pci_ss_info_10de_0020_1102_1016 = + {0x1102, 0x1016, pci_subsys_10de_0020_1102_1016, 0}; +#undef pci_ss_info_1102_1016 +#define pci_ss_info_1102_1016 pci_ss_info_10de_0020_1102_1016 +static const pciSubsystemInfo pci_ss_info_10de_0028_1043_0200 = + {0x1043, 0x0200, pci_subsys_10de_0028_1043_0200, 0}; +#undef pci_ss_info_1043_0200 +#define pci_ss_info_1043_0200 pci_ss_info_10de_0028_1043_0200 +static const pciSubsystemInfo pci_ss_info_10de_0028_1043_0201 = + {0x1043, 0x0201, pci_subsys_10de_0028_1043_0201, 0}; +#undef pci_ss_info_1043_0201 +#define pci_ss_info_1043_0201 pci_ss_info_10de_0028_1043_0201 +static const pciSubsystemInfo pci_ss_info_10de_0028_1043_0205 = + {0x1043, 0x0205, pci_subsys_10de_0028_1043_0205, 0}; +#undef pci_ss_info_1043_0205 +#define pci_ss_info_1043_0205 pci_ss_info_10de_0028_1043_0205 +static const pciSubsystemInfo pci_ss_info_10de_0028_1043_4000 = + {0x1043, 0x4000, pci_subsys_10de_0028_1043_4000, 0}; +#undef pci_ss_info_1043_4000 +#define pci_ss_info_1043_4000 pci_ss_info_10de_0028_1043_4000 +static const pciSubsystemInfo pci_ss_info_10de_0028_1092_4804 = + {0x1092, 0x4804, pci_subsys_10de_0028_1092_4804, 0}; +#undef pci_ss_info_1092_4804 +#define pci_ss_info_1092_4804 pci_ss_info_10de_0028_1092_4804 +static const pciSubsystemInfo pci_ss_info_10de_0028_1092_4a00 = + {0x1092, 0x4a00, pci_subsys_10de_0028_1092_4a00, 0}; +#undef pci_ss_info_1092_4a00 +#define pci_ss_info_1092_4a00 pci_ss_info_10de_0028_1092_4a00 +static const pciSubsystemInfo pci_ss_info_10de_0028_1092_4a02 = + {0x1092, 0x4a02, pci_subsys_10de_0028_1092_4a02, 0}; +#undef pci_ss_info_1092_4a02 +#define pci_ss_info_1092_4a02 pci_ss_info_10de_0028_1092_4a02 +static const pciSubsystemInfo pci_ss_info_10de_0028_1092_5a00 = + {0x1092, 0x5a00, pci_subsys_10de_0028_1092_5a00, 0}; +#undef pci_ss_info_1092_5a00 +#define pci_ss_info_1092_5a00 pci_ss_info_10de_0028_1092_5a00 +static const pciSubsystemInfo pci_ss_info_10de_0028_1092_6a02 = + {0x1092, 0x6a02, pci_subsys_10de_0028_1092_6a02, 0}; +#undef pci_ss_info_1092_6a02 +#define pci_ss_info_1092_6a02 pci_ss_info_10de_0028_1092_6a02 +static const pciSubsystemInfo pci_ss_info_10de_0028_1092_7a02 = + {0x1092, 0x7a02, pci_subsys_10de_0028_1092_7a02, 0}; +#undef pci_ss_info_1092_7a02 +#define pci_ss_info_1092_7a02 pci_ss_info_10de_0028_1092_7a02 +static const pciSubsystemInfo pci_ss_info_10de_0028_10de_0005 = + {0x10de, 0x0005, pci_subsys_10de_0028_10de_0005, 0}; +#undef pci_ss_info_10de_0005 +#define pci_ss_info_10de_0005 pci_ss_info_10de_0028_10de_0005 +static const pciSubsystemInfo pci_ss_info_10de_0028_10de_000f = + {0x10de, 0x000f, pci_subsys_10de_0028_10de_000f, 0}; +#undef pci_ss_info_10de_000f +#define pci_ss_info_10de_000f pci_ss_info_10de_0028_10de_000f +static const pciSubsystemInfo pci_ss_info_10de_0028_1102_1020 = + {0x1102, 0x1020, pci_subsys_10de_0028_1102_1020, 0}; +#undef pci_ss_info_1102_1020 +#define pci_ss_info_1102_1020 pci_ss_info_10de_0028_1102_1020 +static const pciSubsystemInfo pci_ss_info_10de_0028_1102_1026 = + {0x1102, 0x1026, pci_subsys_10de_0028_1102_1026, 0}; +#undef pci_ss_info_1102_1026 +#define pci_ss_info_1102_1026 pci_ss_info_10de_0028_1102_1026 +static const pciSubsystemInfo pci_ss_info_10de_0028_14af_5810 = + {0x14af, 0x5810, pci_subsys_10de_0028_14af_5810, 0}; +#undef pci_ss_info_14af_5810 +#define pci_ss_info_14af_5810 pci_ss_info_10de_0028_14af_5810 +static const pciSubsystemInfo pci_ss_info_10de_0029_1043_0200 = + {0x1043, 0x0200, pci_subsys_10de_0029_1043_0200, 0}; +#undef pci_ss_info_1043_0200 +#define pci_ss_info_1043_0200 pci_ss_info_10de_0029_1043_0200 +static const pciSubsystemInfo pci_ss_info_10de_0029_1043_0201 = + {0x1043, 0x0201, pci_subsys_10de_0029_1043_0201, 0}; +#undef pci_ss_info_1043_0201 +#define pci_ss_info_1043_0201 pci_ss_info_10de_0029_1043_0201 +static const pciSubsystemInfo pci_ss_info_10de_0029_1043_0205 = + {0x1043, 0x0205, pci_subsys_10de_0029_1043_0205, 0}; +#undef pci_ss_info_1043_0205 +#define pci_ss_info_1043_0205 pci_ss_info_10de_0029_1043_0205 +static const pciSubsystemInfo pci_ss_info_10de_0029_1102_1021 = + {0x1102, 0x1021, pci_subsys_10de_0029_1102_1021, 0}; +#undef pci_ss_info_1102_1021 +#define pci_ss_info_1102_1021 pci_ss_info_10de_0029_1102_1021 +static const pciSubsystemInfo pci_ss_info_10de_0029_1102_1029 = + {0x1102, 0x1029, pci_subsys_10de_0029_1102_1029, 0}; +#undef pci_ss_info_1102_1029 +#define pci_ss_info_1102_1029 pci_ss_info_10de_0029_1102_1029 +static const pciSubsystemInfo pci_ss_info_10de_0029_1102_102f = + {0x1102, 0x102f, pci_subsys_10de_0029_1102_102f, 0}; +#undef pci_ss_info_1102_102f +#define pci_ss_info_1102_102f pci_ss_info_10de_0029_1102_102f +static const pciSubsystemInfo pci_ss_info_10de_0029_14af_5820 = + {0x14af, 0x5820, pci_subsys_10de_0029_14af_5820, 0}; +#undef pci_ss_info_14af_5820 +#define pci_ss_info_14af_5820 pci_ss_info_10de_0029_14af_5820 +static const pciSubsystemInfo pci_ss_info_10de_002c_1043_0200 = + {0x1043, 0x0200, pci_subsys_10de_002c_1043_0200, 0}; +#undef pci_ss_info_1043_0200 +#define pci_ss_info_1043_0200 pci_ss_info_10de_002c_1043_0200 +static const pciSubsystemInfo pci_ss_info_10de_002c_1043_0201 = + {0x1043, 0x0201, pci_subsys_10de_002c_1043_0201, 0}; +#undef pci_ss_info_1043_0201 +#define pci_ss_info_1043_0201 pci_ss_info_10de_002c_1043_0201 +static const pciSubsystemInfo pci_ss_info_10de_002c_1092_6820 = + {0x1092, 0x6820, pci_subsys_10de_002c_1092_6820, 0}; +#undef pci_ss_info_1092_6820 +#define pci_ss_info_1092_6820 pci_ss_info_10de_002c_1092_6820 +static const pciSubsystemInfo pci_ss_info_10de_002c_1102_1031 = + {0x1102, 0x1031, pci_subsys_10de_002c_1102_1031, 0}; +#undef pci_ss_info_1102_1031 +#define pci_ss_info_1102_1031 pci_ss_info_10de_002c_1102_1031 +static const pciSubsystemInfo pci_ss_info_10de_002c_1102_1034 = + {0x1102, 0x1034, pci_subsys_10de_002c_1102_1034, 0}; +#undef pci_ss_info_1102_1034 +#define pci_ss_info_1102_1034 pci_ss_info_10de_002c_1102_1034 +static const pciSubsystemInfo pci_ss_info_10de_002c_14af_5008 = + {0x14af, 0x5008, pci_subsys_10de_002c_14af_5008, 0}; +#undef pci_ss_info_14af_5008 +#define pci_ss_info_14af_5008 pci_ss_info_10de_002c_14af_5008 +static const pciSubsystemInfo pci_ss_info_10de_002d_1043_0200 = + {0x1043, 0x0200, pci_subsys_10de_002d_1043_0200, 0}; +#undef pci_ss_info_1043_0200 +#define pci_ss_info_1043_0200 pci_ss_info_10de_002d_1043_0200 +static const pciSubsystemInfo pci_ss_info_10de_002d_1043_0201 = + {0x1043, 0x0201, pci_subsys_10de_002d_1043_0201, 0}; +#undef pci_ss_info_1043_0201 +#define pci_ss_info_1043_0201 pci_ss_info_10de_002d_1043_0201 +static const pciSubsystemInfo pci_ss_info_10de_002d_1048_0c3a = + {0x1048, 0x0c3a, pci_subsys_10de_002d_1048_0c3a, 0}; +#undef pci_ss_info_1048_0c3a +#define pci_ss_info_1048_0c3a pci_ss_info_10de_002d_1048_0c3a +static const pciSubsystemInfo pci_ss_info_10de_002d_10de_001e = + {0x10de, 0x001e, pci_subsys_10de_002d_10de_001e, 0}; +#undef pci_ss_info_10de_001e +#define pci_ss_info_10de_001e pci_ss_info_10de_002d_10de_001e +static const pciSubsystemInfo pci_ss_info_10de_002d_1102_1023 = + {0x1102, 0x1023, pci_subsys_10de_002d_1102_1023, 0}; +#undef pci_ss_info_1102_1023 +#define pci_ss_info_1102_1023 pci_ss_info_10de_002d_1102_1023 +static const pciSubsystemInfo pci_ss_info_10de_002d_1102_1024 = + {0x1102, 0x1024, pci_subsys_10de_002d_1102_1024, 0}; +#undef pci_ss_info_1102_1024 +#define pci_ss_info_1102_1024 pci_ss_info_10de_002d_1102_1024 +static const pciSubsystemInfo pci_ss_info_10de_002d_1102_102c = + {0x1102, 0x102c, pci_subsys_10de_002d_1102_102c, 0}; +#undef pci_ss_info_1102_102c +#define pci_ss_info_1102_102c pci_ss_info_10de_002d_1102_102c +static const pciSubsystemInfo pci_ss_info_10de_002d_1462_8808 = + {0x1462, 0x8808, pci_subsys_10de_002d_1462_8808, 0}; +#undef pci_ss_info_1462_8808 +#define pci_ss_info_1462_8808 pci_ss_info_10de_002d_1462_8808 +static const pciSubsystemInfo pci_ss_info_10de_002d_1554_1041 = + {0x1554, 0x1041, pci_subsys_10de_002d_1554_1041, 0}; +#undef pci_ss_info_1554_1041 +#define pci_ss_info_1554_1041 pci_ss_info_10de_002d_1554_1041 +static const pciSubsystemInfo pci_ss_info_10de_0060_1043_80ad = + {0x1043, 0x80ad, pci_subsys_10de_0060_1043_80ad, 0}; +#undef pci_ss_info_1043_80ad +#define pci_ss_info_1043_80ad pci_ss_info_10de_0060_1043_80ad +static const pciSubsystemInfo pci_ss_info_10de_0067_1043_0c11 = + {0x1043, 0x0c11, pci_subsys_10de_0067_1043_0c11, 0}; +#undef pci_ss_info_1043_0c11 +#define pci_ss_info_1043_0c11 pci_ss_info_10de_0067_1043_0c11 +static const pciSubsystemInfo pci_ss_info_10de_0068_1043_0c11 = + {0x1043, 0x0c11, pci_subsys_10de_0068_1043_0c11, 0}; +#undef pci_ss_info_1043_0c11 +#define pci_ss_info_1043_0c11 pci_ss_info_10de_0068_1043_0c11 +static const pciSubsystemInfo pci_ss_info_10de_00a0_14af_5810 = + {0x14af, 0x5810, pci_subsys_10de_00a0_14af_5810, 0}; +#undef pci_ss_info_14af_5810 +#define pci_ss_info_14af_5810 pci_ss_info_10de_00a0_14af_5810 +static const pciSubsystemInfo pci_ss_info_10de_0100_1043_0200 = + {0x1043, 0x0200, pci_subsys_10de_0100_1043_0200, 0}; +#undef pci_ss_info_1043_0200 +#define pci_ss_info_1043_0200 pci_ss_info_10de_0100_1043_0200 +static const pciSubsystemInfo pci_ss_info_10de_0100_1043_0201 = + {0x1043, 0x0201, pci_subsys_10de_0100_1043_0201, 0}; +#undef pci_ss_info_1043_0201 +#define pci_ss_info_1043_0201 pci_ss_info_10de_0100_1043_0201 +static const pciSubsystemInfo pci_ss_info_10de_0100_1043_4008 = + {0x1043, 0x4008, pci_subsys_10de_0100_1043_4008, 0}; +#undef pci_ss_info_1043_4008 +#define pci_ss_info_1043_4008 pci_ss_info_10de_0100_1043_4008 +static const pciSubsystemInfo pci_ss_info_10de_0100_1043_4009 = + {0x1043, 0x4009, pci_subsys_10de_0100_1043_4009, 0}; +#undef pci_ss_info_1043_4009 +#define pci_ss_info_1043_4009 pci_ss_info_10de_0100_1043_4009 +static const pciSubsystemInfo pci_ss_info_10de_0100_1102_102d = + {0x1102, 0x102d, pci_subsys_10de_0100_1102_102d, 0}; +#undef pci_ss_info_1102_102d +#define pci_ss_info_1102_102d pci_ss_info_10de_0100_1102_102d +static const pciSubsystemInfo pci_ss_info_10de_0100_14af_5022 = + {0x14af, 0x5022, pci_subsys_10de_0100_14af_5022, 0}; +#undef pci_ss_info_14af_5022 +#define pci_ss_info_14af_5022 pci_ss_info_10de_0100_14af_5022 +static const pciSubsystemInfo pci_ss_info_10de_0101_1043_0202 = + {0x1043, 0x0202, pci_subsys_10de_0101_1043_0202, 0}; +#undef pci_ss_info_1043_0202 +#define pci_ss_info_1043_0202 pci_ss_info_10de_0101_1043_0202 +static const pciSubsystemInfo pci_ss_info_10de_0101_1043_400a = + {0x1043, 0x400a, pci_subsys_10de_0101_1043_400a, 0}; +#undef pci_ss_info_1043_400a +#define pci_ss_info_1043_400a pci_ss_info_10de_0101_1043_400a +static const pciSubsystemInfo pci_ss_info_10de_0101_1043_400b = + {0x1043, 0x400b, pci_subsys_10de_0101_1043_400b, 0}; +#undef pci_ss_info_1043_400b +#define pci_ss_info_1043_400b pci_ss_info_10de_0101_1043_400b +static const pciSubsystemInfo pci_ss_info_10de_0101_1102_102e = + {0x1102, 0x102e, pci_subsys_10de_0101_1102_102e, 0}; +#undef pci_ss_info_1102_102e +#define pci_ss_info_1102_102e pci_ss_info_10de_0101_1102_102e +static const pciSubsystemInfo pci_ss_info_10de_0101_14af_5021 = + {0x14af, 0x5021, pci_subsys_10de_0101_14af_5021, 0}; +#undef pci_ss_info_14af_5021 +#define pci_ss_info_14af_5021 pci_ss_info_10de_0101_14af_5021 +static const pciSubsystemInfo pci_ss_info_10de_0110_1043_4015 = + {0x1043, 0x4015, pci_subsys_10de_0110_1043_4015, 0}; +#undef pci_ss_info_1043_4015 +#define pci_ss_info_1043_4015 pci_ss_info_10de_0110_1043_4015 +static const pciSubsystemInfo pci_ss_info_10de_0110_1043_4031 = + {0x1043, 0x4031, pci_subsys_10de_0110_1043_4031, 0}; +#undef pci_ss_info_1043_4031 +#define pci_ss_info_1043_4031 pci_ss_info_10de_0110_1043_4031 +static const pciSubsystemInfo pci_ss_info_10de_0110_1462_8817 = + {0x1462, 0x8817, pci_subsys_10de_0110_1462_8817, 0}; +#undef pci_ss_info_1462_8817 +#define pci_ss_info_1462_8817 pci_ss_info_10de_0110_1462_8817 +static const pciSubsystemInfo pci_ss_info_10de_0110_14af_7102 = + {0x14af, 0x7102, pci_subsys_10de_0110_14af_7102, 0}; +#undef pci_ss_info_14af_7102 +#define pci_ss_info_14af_7102 pci_ss_info_10de_0110_14af_7102 +static const pciSubsystemInfo pci_ss_info_10de_0110_14af_7103 = + {0x14af, 0x7103, pci_subsys_10de_0110_14af_7103, 0}; +#undef pci_ss_info_14af_7103 +#define pci_ss_info_14af_7103 pci_ss_info_10de_0110_14af_7103 +static const pciSubsystemInfo pci_ss_info_10de_0150_1043_4016 = + {0x1043, 0x4016, pci_subsys_10de_0150_1043_4016, 0}; +#undef pci_ss_info_1043_4016 +#define pci_ss_info_1043_4016 pci_ss_info_10de_0150_1043_4016 +static const pciSubsystemInfo pci_ss_info_10de_0150_107d_2840 = + {0x107d, 0x2840, pci_subsys_10de_0150_107d_2840, 0}; +#undef pci_ss_info_107d_2840 +#define pci_ss_info_107d_2840 pci_ss_info_10de_0150_107d_2840 +static const pciSubsystemInfo pci_ss_info_10de_0150_1462_8831 = + {0x1462, 0x8831, pci_subsys_10de_0150_1462_8831, 0}; +#undef pci_ss_info_1462_8831 +#define pci_ss_info_1462_8831 pci_ss_info_10de_0150_1462_8831 +static const pciSubsystemInfo pci_ss_info_10de_0151_1043_405f = + {0x1043, 0x405f, pci_subsys_10de_0151_1043_405f, 0}; +#undef pci_ss_info_1043_405f +#define pci_ss_info_1043_405f pci_ss_info_10de_0151_1043_405f +static const pciSubsystemInfo pci_ss_info_10de_0152_1048_0c56 = + {0x1048, 0x0c56, pci_subsys_10de_0152_1048_0c56, 0}; +#undef pci_ss_info_1048_0c56 +#define pci_ss_info_1048_0c56 pci_ss_info_10de_0152_1048_0c56 +static const pciSubsystemInfo pci_ss_info_10de_0171_1462_8661 = + {0x1462, 0x8661, pci_subsys_10de_0171_1462_8661, 0}; +#undef pci_ss_info_1462_8661 +#define pci_ss_info_1462_8661 pci_ss_info_10de_0171_1462_8661 +static const pciSubsystemInfo pci_ss_info_10de_0171_1462_8730 = + {0x1462, 0x8730, pci_subsys_10de_0171_1462_8730, 0}; +#undef pci_ss_info_1462_8730 +#define pci_ss_info_1462_8730 pci_ss_info_10de_0171_1462_8730 +static const pciSubsystemInfo pci_ss_info_10de_0171_147b_8f00 = + {0x147b, 0x8f00, pci_subsys_10de_0171_147b_8f00, 0}; +#undef pci_ss_info_147b_8f00 +#define pci_ss_info_147b_8f00 pci_ss_info_10de_0171_147b_8f00 +static const pciSubsystemInfo pci_ss_info_10de_0200_1043_402f = + {0x1043, 0x402f, pci_subsys_10de_0200_1043_402f, 0}; +#undef pci_ss_info_1043_402f +#define pci_ss_info_1043_402f pci_ss_info_10de_0200_1043_402f +static const pciSubsystemInfo pci_ss_info_10de_0202_1043_405b = + {0x1043, 0x405b, pci_subsys_10de_0202_1043_405b, 0}; +#undef pci_ss_info_1043_405b +#define pci_ss_info_1043_405b pci_ss_info_10de_0202_1043_405b +static const pciSubsystemInfo pci_ss_info_10de_0202_1545_002f = + {0x1545, 0x002f, pci_subsys_10de_0202_1545_002f, 0}; +#undef pci_ss_info_1545_002f +#define pci_ss_info_1545_002f pci_ss_info_10de_0202_1545_002f +static const pciSubsystemInfo pci_ss_info_10de_0253_107d_2896 = + {0x107d, 0x2896, pci_subsys_10de_0253_107d_2896, 0}; +#undef pci_ss_info_107d_2896 +#define pci_ss_info_107d_2896 pci_ss_info_10de_0253_107d_2896 +static const pciSubsystemInfo pci_ss_info_10de_0253_147b_8f09 = + {0x147b, 0x8f09, pci_subsys_10de_0253_147b_8f09, 0}; +#undef pci_ss_info_147b_8f09 +#define pci_ss_info_147b_8f09 pci_ss_info_10de_0253_147b_8f09 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10e1_0391_10e1_0391 = + {0x10e1, 0x0391, pci_subsys_10e1_0391_10e1_0391, 0}; +#undef pci_ss_info_10e1_0391 +#define pci_ss_info_10e1_0391 pci_ss_info_10e1_0391_10e1_0391 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10ec_8029_10b8_2011 = + {0x10b8, 0x2011, pci_subsys_10ec_8029_10b8_2011, 0}; +#undef pci_ss_info_10b8_2011 +#define pci_ss_info_10b8_2011 pci_ss_info_10ec_8029_10b8_2011 +static const pciSubsystemInfo pci_ss_info_10ec_8029_10ec_8029 = + {0x10ec, 0x8029, pci_subsys_10ec_8029_10ec_8029, 0}; +#undef pci_ss_info_10ec_8029 +#define pci_ss_info_10ec_8029 pci_ss_info_10ec_8029_10ec_8029 +static const pciSubsystemInfo pci_ss_info_10ec_8029_1113_1208 = + {0x1113, 0x1208, pci_subsys_10ec_8029_1113_1208, 0}; +#undef pci_ss_info_1113_1208 +#define pci_ss_info_1113_1208 pci_ss_info_10ec_8029_1113_1208 +static const pciSubsystemInfo pci_ss_info_10ec_8029_1186_0300 = + {0x1186, 0x0300, pci_subsys_10ec_8029_1186_0300, 0}; +#undef pci_ss_info_1186_0300 +#define pci_ss_info_1186_0300 pci_ss_info_10ec_8029_1186_0300 +static const pciSubsystemInfo pci_ss_info_10ec_8029_1259_2400 = + {0x1259, 0x2400, pci_subsys_10ec_8029_1259_2400, 0}; +#undef pci_ss_info_1259_2400 +#define pci_ss_info_1259_2400 pci_ss_info_10ec_8029_1259_2400 +static const pciSubsystemInfo pci_ss_info_10ec_8129_10ec_8129 = + {0x10ec, 0x8129, pci_subsys_10ec_8129_10ec_8129, 0}; +#undef pci_ss_info_10ec_8129 +#define pci_ss_info_10ec_8129 pci_ss_info_10ec_8129_10ec_8129 +static const pciSubsystemInfo pci_ss_info_10ec_8138_10ec_8138 = + {0x10ec, 0x8138, pci_subsys_10ec_8138_10ec_8138, 0}; +#undef pci_ss_info_10ec_8138 +#define pci_ss_info_10ec_8138 pci_ss_info_10ec_8138_10ec_8138 +#endif +static const pciSubsystemInfo pci_ss_info_10ec_8139_1025_8920 = + {0x1025, 0x8920, pci_subsys_10ec_8139_1025_8920, 0}; +#undef pci_ss_info_1025_8920 +#define pci_ss_info_1025_8920 pci_ss_info_10ec_8139_1025_8920 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_10ec_8139_1025_8921 = + {0x1025, 0x8921, pci_subsys_10ec_8139_1025_8921, 0}; +#undef pci_ss_info_1025_8921 +#define pci_ss_info_1025_8921 pci_ss_info_10ec_8139_1025_8921 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_10ec_8139_10bd_0320 = + {0x10bd, 0x0320, pci_subsys_10ec_8139_10bd_0320, 0}; +#undef pci_ss_info_10bd_0320 +#define pci_ss_info_10bd_0320 pci_ss_info_10ec_8139_10bd_0320 +static const pciSubsystemInfo pci_ss_info_10ec_8139_10ec_8139 = + {0x10ec, 0x8139, pci_subsys_10ec_8139_10ec_8139, 0}; +#undef pci_ss_info_10ec_8139 +#define pci_ss_info_10ec_8139 pci_ss_info_10ec_8139_10ec_8139 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1186_1300 = + {0x1186, 0x1300, pci_subsys_10ec_8139_1186_1300, 0}; +#undef pci_ss_info_1186_1300 +#define pci_ss_info_1186_1300 pci_ss_info_10ec_8139_1186_1300 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1186_1320 = + {0x1186, 0x1320, pci_subsys_10ec_8139_1186_1320, 0}; +#undef pci_ss_info_1186_1320 +#define pci_ss_info_1186_1320 pci_ss_info_10ec_8139_1186_1320 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1186_8139 = + {0x1186, 0x8139, pci_subsys_10ec_8139_1186_8139, 0}; +#undef pci_ss_info_1186_8139 +#define pci_ss_info_1186_8139 pci_ss_info_10ec_8139_1186_8139 +static const pciSubsystemInfo pci_ss_info_10ec_8139_11f6_8139 = + {0x11f6, 0x8139, pci_subsys_10ec_8139_11f6_8139, 0}; +#undef pci_ss_info_11f6_8139 +#define pci_ss_info_11f6_8139 pci_ss_info_10ec_8139_11f6_8139 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1259_2500 = + {0x1259, 0x2500, pci_subsys_10ec_8139_1259_2500, 0}; +#undef pci_ss_info_1259_2500 +#define pci_ss_info_1259_2500 pci_ss_info_10ec_8139_1259_2500 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1259_2503 = + {0x1259, 0x2503, pci_subsys_10ec_8139_1259_2503, 0}; +#undef pci_ss_info_1259_2503 +#define pci_ss_info_1259_2503 pci_ss_info_10ec_8139_1259_2503 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1429_d010 = + {0x1429, 0xd010, pci_subsys_10ec_8139_1429_d010, 0}; +#undef pci_ss_info_1429_d010 +#define pci_ss_info_1429_d010 pci_ss_info_10ec_8139_1429_d010 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1432_9130 = + {0x1432, 0x9130, pci_subsys_10ec_8139_1432_9130, 0}; +#undef pci_ss_info_1432_9130 +#define pci_ss_info_1432_9130 pci_ss_info_10ec_8139_1432_9130 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1436_8139 = + {0x1436, 0x8139, pci_subsys_10ec_8139_1436_8139, 0}; +#undef pci_ss_info_1436_8139 +#define pci_ss_info_1436_8139 pci_ss_info_10ec_8139_1436_8139 +static const pciSubsystemInfo pci_ss_info_10ec_8139_146c_1439 = + {0x146c, 0x1439, pci_subsys_10ec_8139_146c_1439, 0}; +#undef pci_ss_info_146c_1439 +#define pci_ss_info_146c_1439 pci_ss_info_10ec_8139_146c_1439 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1489_6001 = + {0x1489, 0x6001, pci_subsys_10ec_8139_1489_6001, 0}; +#undef pci_ss_info_1489_6001 +#define pci_ss_info_1489_6001 pci_ss_info_10ec_8139_1489_6001 +static const pciSubsystemInfo pci_ss_info_10ec_8139_1489_6002 = + {0x1489, 0x6002, pci_subsys_10ec_8139_1489_6002, 0}; +#undef pci_ss_info_1489_6002 +#define pci_ss_info_1489_6002 pci_ss_info_10ec_8139_1489_6002 +static const pciSubsystemInfo pci_ss_info_10ec_8139_149c_139a = + {0x149c, 0x139a, pci_subsys_10ec_8139_149c_139a, 0}; +#undef pci_ss_info_149c_139a +#define pci_ss_info_149c_139a pci_ss_info_10ec_8139_149c_139a +static const pciSubsystemInfo pci_ss_info_10ec_8139_149c_8139 = + {0x149c, 0x8139, pci_subsys_10ec_8139_149c_8139, 0}; +#undef pci_ss_info_149c_8139 +#define pci_ss_info_149c_8139 pci_ss_info_10ec_8139_149c_8139 +static const pciSubsystemInfo pci_ss_info_10ec_8139_2646_0001 = + {0x2646, 0x0001, pci_subsys_10ec_8139_2646_0001, 0}; +#undef pci_ss_info_2646_0001 +#define pci_ss_info_2646_0001 pci_ss_info_10ec_8139_2646_0001 +static const pciSubsystemInfo pci_ss_info_10ec_8139_8e2e_7000 = + {0x8e2e, 0x7000, pci_subsys_10ec_8139_8e2e_7000, 0}; +#undef pci_ss_info_8e2e_7000 +#define pci_ss_info_8e2e_7000 pci_ss_info_10ec_8139_8e2e_7000 +static const pciSubsystemInfo pci_ss_info_10ec_8139_8e2e_7100 = + {0x8e2e, 0x7100, pci_subsys_10ec_8139_8e2e_7100, 0}; +#undef pci_ss_info_8e2e_7100 +#define pci_ss_info_8e2e_7100 pci_ss_info_10ec_8139_8e2e_7100 +static const pciSubsystemInfo pci_ss_info_10ec_8139_a0a0_0007 = + {0xa0a0, 0x0007, pci_subsys_10ec_8139_a0a0_0007, 0}; +#undef pci_ss_info_a0a0_0007 +#define pci_ss_info_a0a0_0007 pci_ss_info_10ec_8139_a0a0_0007 +static const pciSubsystemInfo pci_ss_info_10ec_8169_1371_434e = + {0x1371, 0x434e, pci_subsys_10ec_8169_1371_434e, 0}; +#undef pci_ss_info_1371_434e +#define pci_ss_info_1371_434e pci_ss_info_10ec_8169_1371_434e +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_0020 = + {0x1102, 0x0020, pci_subsys_1102_0002_1102_0020, 0}; +#undef pci_ss_info_1102_0020 +#define pci_ss_info_1102_0020 pci_ss_info_1102_0002_1102_0020 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_0021 = + {0x1102, 0x0021, pci_subsys_1102_0002_1102_0021, 0}; +#undef pci_ss_info_1102_0021 +#define pci_ss_info_1102_0021 pci_ss_info_1102_0002_1102_0021 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_002f = + {0x1102, 0x002f, pci_subsys_1102_0002_1102_002f, 0}; +#undef pci_ss_info_1102_002f +#define pci_ss_info_1102_002f pci_ss_info_1102_0002_1102_002f +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_4001 = + {0x1102, 0x4001, pci_subsys_1102_0002_1102_4001, 0}; +#undef pci_ss_info_1102_4001 +#define pci_ss_info_1102_4001 pci_ss_info_1102_0002_1102_4001 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8022 = + {0x1102, 0x8022, pci_subsys_1102_0002_1102_8022, 0}; +#undef pci_ss_info_1102_8022 +#define pci_ss_info_1102_8022 pci_ss_info_1102_0002_1102_8022 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8023 = + {0x1102, 0x8023, pci_subsys_1102_0002_1102_8023, 0}; +#undef pci_ss_info_1102_8023 +#define pci_ss_info_1102_8023 pci_ss_info_1102_0002_1102_8023 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8024 = + {0x1102, 0x8024, pci_subsys_1102_0002_1102_8024, 0}; +#undef pci_ss_info_1102_8024 +#define pci_ss_info_1102_8024 pci_ss_info_1102_0002_1102_8024 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8025 = + {0x1102, 0x8025, pci_subsys_1102_0002_1102_8025, 0}; +#undef pci_ss_info_1102_8025 +#define pci_ss_info_1102_8025 pci_ss_info_1102_0002_1102_8025 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8026 = + {0x1102, 0x8026, pci_subsys_1102_0002_1102_8026, 0}; +#undef pci_ss_info_1102_8026 +#define pci_ss_info_1102_8026 pci_ss_info_1102_0002_1102_8026 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8027 = + {0x1102, 0x8027, pci_subsys_1102_0002_1102_8027, 0}; +#undef pci_ss_info_1102_8027 +#define pci_ss_info_1102_8027 pci_ss_info_1102_0002_1102_8027 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8028 = + {0x1102, 0x8028, pci_subsys_1102_0002_1102_8028, 0}; +#undef pci_ss_info_1102_8028 +#define pci_ss_info_1102_8028 pci_ss_info_1102_0002_1102_8028 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8031 = + {0x1102, 0x8031, pci_subsys_1102_0002_1102_8031, 0}; +#undef pci_ss_info_1102_8031 +#define pci_ss_info_1102_8031 pci_ss_info_1102_0002_1102_8031 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8040 = + {0x1102, 0x8040, pci_subsys_1102_0002_1102_8040, 0}; +#undef pci_ss_info_1102_8040 +#define pci_ss_info_1102_8040 pci_ss_info_1102_0002_1102_8040 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8051 = + {0x1102, 0x8051, pci_subsys_1102_0002_1102_8051, 0}; +#undef pci_ss_info_1102_8051 +#define pci_ss_info_1102_8051 pci_ss_info_1102_0002_1102_8051 +static const pciSubsystemInfo pci_ss_info_1102_0002_1102_8061 = + {0x1102, 0x8061, pci_subsys_1102_0002_1102_8061, 0}; +#undef pci_ss_info_1102_8061 +#define pci_ss_info_1102_8061 pci_ss_info_1102_0002_1102_8061 +static const pciSubsystemInfo pci_ss_info_1102_0004_1102_0051 = + {0x1102, 0x0051, pci_subsys_1102_0004_1102_0051, 0}; +#undef pci_ss_info_1102_0051 +#define pci_ss_info_1102_0051 pci_ss_info_1102_0004_1102_0051 +static const pciSubsystemInfo pci_ss_info_1102_0004_1102_0053 = + {0x1102, 0x0053, pci_subsys_1102_0004_1102_0053, 0}; +#undef pci_ss_info_1102_0053 +#define pci_ss_info_1102_0053 pci_ss_info_1102_0004_1102_0053 +static const pciSubsystemInfo pci_ss_info_1102_4001_1102_0010 = + {0x1102, 0x0010, pci_subsys_1102_4001_1102_0010, 0}; +#undef pci_ss_info_1102_0010 +#define pci_ss_info_1102_0010 pci_ss_info_1102_4001_1102_0010 +static const pciSubsystemInfo pci_ss_info_1102_7002_1102_0020 = + {0x1102, 0x0020, pci_subsys_1102_7002_1102_0020, 0}; +#undef pci_ss_info_1102_0020 +#define pci_ss_info_1102_0020 pci_ss_info_1102_7002_1102_0020 +static const pciSubsystemInfo pci_ss_info_1102_7003_1102_0040 = + {0x1102, 0x0040, pci_subsys_1102_7003_1102_0040, 0}; +#undef pci_ss_info_1102_0040 +#define pci_ss_info_1102_0040 pci_ss_info_1102_7003_1102_0040 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1103_0004_1103_0001 = + {0x1103, 0x0001, pci_subsys_1103_0004_1103_0001, 0}; +#undef pci_ss_info_1103_0001 +#define pci_ss_info_1103_0001 pci_ss_info_1103_0004_1103_0001 +static const pciSubsystemInfo pci_ss_info_1103_0004_1103_0005 = + {0x1103, 0x0005, pci_subsys_1103_0004_1103_0005, 0}; +#undef pci_ss_info_1103_0005 +#define pci_ss_info_1103_0005 pci_ss_info_1103_0004_1103_0005 +#endif +static const pciSubsystemInfo pci_ss_info_1106_0305_1043_8033 = + {0x1043, 0x8033, pci_subsys_1106_0305_1043_8033, 0}; +#undef pci_ss_info_1043_8033 +#define pci_ss_info_1043_8033 pci_ss_info_1106_0305_1043_8033 +static const pciSubsystemInfo pci_ss_info_1106_0305_1043_803e = + {0x1043, 0x803e, pci_subsys_1106_0305_1043_803e, 0}; +#undef pci_ss_info_1043_803e +#define pci_ss_info_1043_803e pci_ss_info_1106_0305_1043_803e +static const pciSubsystemInfo pci_ss_info_1106_0305_1043_8042 = + {0x1043, 0x8042, pci_subsys_1106_0305_1043_8042, 0}; +#undef pci_ss_info_1043_8042 +#define pci_ss_info_1043_8042 pci_ss_info_1106_0305_1043_8042 +static const pciSubsystemInfo pci_ss_info_1106_0305_147b_a401 = + {0x147b, 0xa401, pci_subsys_1106_0305_147b_a401, 0}; +#undef pci_ss_info_147b_a401 +#define pci_ss_info_147b_a401 pci_ss_info_1106_0305_147b_a401 +static const pciSubsystemInfo pci_ss_info_1106_0571_1043_8052 = + {0x1043, 0x8052, pci_subsys_1106_0571_1043_8052, 0}; +#undef pci_ss_info_1043_8052 +#define pci_ss_info_1043_8052 pci_ss_info_1106_0571_1043_8052 +static const pciSubsystemInfo pci_ss_info_1106_0571_1106_0571 = + {0x1106, 0x0571, pci_subsys_1106_0571_1106_0571, 0}; +#undef pci_ss_info_1106_0571 +#define pci_ss_info_1106_0571 pci_ss_info_1106_0571_1106_0571 +static const pciSubsystemInfo pci_ss_info_1106_0571_1179_0001 = + {0x1179, 0x0001, pci_subsys_1106_0571_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1106_0571_1179_0001 +static const pciSubsystemInfo pci_ss_info_1106_0571_1458_5002 = + {0x1458, 0x5002, pci_subsys_1106_0571_1458_5002, 0}; +#undef pci_ss_info_1458_5002 +#define pci_ss_info_1458_5002 pci_ss_info_1106_0571_1458_5002 +static const pciSubsystemInfo pci_ss_info_1106_0586_1106_0000 = + {0x1106, 0x0000, pci_subsys_1106_0586_1106_0000, 0}; +#undef pci_ss_info_1106_0000 +#define pci_ss_info_1106_0000 pci_ss_info_1106_0586_1106_0000 +static const pciSubsystemInfo pci_ss_info_1106_0596_1106_0000 = + {0x1106, 0x0000, pci_subsys_1106_0596_1106_0000, 0}; +#undef pci_ss_info_1106_0000 +#define pci_ss_info_1106_0000 pci_ss_info_1106_0596_1106_0000 +static const pciSubsystemInfo pci_ss_info_1106_0596_1458_0596 = + {0x1458, 0x0596, pci_subsys_1106_0596_1458_0596, 0}; +#undef pci_ss_info_1458_0596 +#define pci_ss_info_1458_0596 pci_ss_info_1106_0596_1458_0596 +static const pciSubsystemInfo pci_ss_info_1106_0686_1043_8033 = + {0x1043, 0x8033, pci_subsys_1106_0686_1043_8033, 0}; +#undef pci_ss_info_1043_8033 +#define pci_ss_info_1043_8033 pci_ss_info_1106_0686_1043_8033 +static const pciSubsystemInfo pci_ss_info_1106_0686_1043_803e = + {0x1043, 0x803e, pci_subsys_1106_0686_1043_803e, 0}; +#undef pci_ss_info_1043_803e +#define pci_ss_info_1043_803e pci_ss_info_1106_0686_1043_803e +static const pciSubsystemInfo pci_ss_info_1106_0686_1043_8040 = + {0x1043, 0x8040, pci_subsys_1106_0686_1043_8040, 0}; +#undef pci_ss_info_1043_8040 +#define pci_ss_info_1043_8040 pci_ss_info_1106_0686_1043_8040 +static const pciSubsystemInfo pci_ss_info_1106_0686_1043_8042 = + {0x1043, 0x8042, pci_subsys_1106_0686_1043_8042, 0}; +#undef pci_ss_info_1043_8042 +#define pci_ss_info_1043_8042 pci_ss_info_1106_0686_1043_8042 +static const pciSubsystemInfo pci_ss_info_1106_0686_1106_0000 = + {0x1106, 0x0000, pci_subsys_1106_0686_1106_0000, 0}; +#undef pci_ss_info_1106_0000 +#define pci_ss_info_1106_0000 pci_ss_info_1106_0686_1106_0000 +static const pciSubsystemInfo pci_ss_info_1106_0686_1106_0686 = + {0x1106, 0x0686, pci_subsys_1106_0686_1106_0686, 0}; +#undef pci_ss_info_1106_0686 +#define pci_ss_info_1106_0686 pci_ss_info_1106_0686_1106_0686 +static const pciSubsystemInfo pci_ss_info_1106_0686_1179_0001 = + {0x1179, 0x0001, pci_subsys_1106_0686_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1106_0686_1179_0001 +static const pciSubsystemInfo pci_ss_info_1106_0686_147b_a702 = + {0x147b, 0xa702, pci_subsys_1106_0686_147b_a702, 0}; +#undef pci_ss_info_147b_a702 +#define pci_ss_info_147b_a702 pci_ss_info_1106_0686_147b_a702 +static const pciSubsystemInfo pci_ss_info_1106_0691_1179_0001 = + {0x1179, 0x0001, pci_subsys_1106_0691_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1106_0691_1179_0001 +static const pciSubsystemInfo pci_ss_info_1106_0691_1458_0691 = + {0x1458, 0x0691, pci_subsys_1106_0691_1458_0691, 0}; +#undef pci_ss_info_1458_0691 +#define pci_ss_info_1458_0691 pci_ss_info_1106_0691_1458_0691 +static const pciSubsystemInfo pci_ss_info_1106_3038_0925_1234 = + {0x0925, 0x1234, pci_subsys_1106_3038_0925_1234, 0}; +#undef pci_ss_info_0925_1234 +#define pci_ss_info_0925_1234 pci_ss_info_1106_3038_0925_1234 +static const pciSubsystemInfo pci_ss_info_1106_3038_1179_0001 = + {0x1179, 0x0001, pci_subsys_1106_3038_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1106_3038_1179_0001 +static const pciSubsystemInfo pci_ss_info_1106_3043_10bd_0000 = + {0x10bd, 0x0000, pci_subsys_1106_3043_10bd_0000, 0}; +#undef pci_ss_info_10bd_0000 +#define pci_ss_info_10bd_0000 pci_ss_info_1106_3043_10bd_0000 +static const pciSubsystemInfo pci_ss_info_1106_3043_1106_0100 = + {0x1106, 0x0100, pci_subsys_1106_3043_1106_0100, 0}; +#undef pci_ss_info_1106_0100 +#define pci_ss_info_1106_0100 pci_ss_info_1106_3043_1106_0100 +static const pciSubsystemInfo pci_ss_info_1106_3043_1186_1400 = + {0x1186, 0x1400, pci_subsys_1106_3043_1186_1400, 0}; +#undef pci_ss_info_1186_1400 +#define pci_ss_info_1186_1400 pci_ss_info_1106_3043_1186_1400 +static const pciSubsystemInfo pci_ss_info_1106_3057_1043_8033 = + {0x1043, 0x8033, pci_subsys_1106_3057_1043_8033, 0}; +#undef pci_ss_info_1043_8033 +#define pci_ss_info_1043_8033 pci_ss_info_1106_3057_1043_8033 +static const pciSubsystemInfo pci_ss_info_1106_3057_1043_803e = + {0x1043, 0x803e, pci_subsys_1106_3057_1043_803e, 0}; +#undef pci_ss_info_1043_803e +#define pci_ss_info_1043_803e pci_ss_info_1106_3057_1043_803e +static const pciSubsystemInfo pci_ss_info_1106_3057_1043_8040 = + {0x1043, 0x8040, pci_subsys_1106_3057_1043_8040, 0}; +#undef pci_ss_info_1043_8040 +#define pci_ss_info_1043_8040 pci_ss_info_1106_3057_1043_8040 +static const pciSubsystemInfo pci_ss_info_1106_3057_1043_8042 = + {0x1043, 0x8042, pci_subsys_1106_3057_1043_8042, 0}; +#undef pci_ss_info_1043_8042 +#define pci_ss_info_1043_8042 pci_ss_info_1106_3057_1043_8042 +static const pciSubsystemInfo pci_ss_info_1106_3057_1179_0001 = + {0x1179, 0x0001, pci_subsys_1106_3057_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1106_3057_1179_0001 +static const pciSubsystemInfo pci_ss_info_1106_3058_0e11_b194 = + {0x0e11, 0xb194, pci_subsys_1106_3058_0e11_b194, 0}; +#undef pci_ss_info_0e11_b194 +#define pci_ss_info_0e11_b194 pci_ss_info_1106_3058_0e11_b194 +static const pciSubsystemInfo pci_ss_info_1106_3058_1106_4511 = + {0x1106, 0x4511, pci_subsys_1106_3058_1106_4511, 0}; +#undef pci_ss_info_1106_4511 +#define pci_ss_info_1106_4511 pci_ss_info_1106_3058_1106_4511 +static const pciSubsystemInfo pci_ss_info_1106_3058_1458_7600 = + {0x1458, 0x7600, pci_subsys_1106_3058_1458_7600, 0}; +#undef pci_ss_info_1458_7600 +#define pci_ss_info_1458_7600 pci_ss_info_1106_3058_1458_7600 +static const pciSubsystemInfo pci_ss_info_1106_3058_1462_3091 = + {0x1462, 0x3091, pci_subsys_1106_3058_1462_3091, 0}; +#undef pci_ss_info_1462_3091 +#define pci_ss_info_1462_3091 pci_ss_info_1106_3058_1462_3091 +static const pciSubsystemInfo pci_ss_info_1106_3058_15dd_7609 = + {0x15dd, 0x7609, pci_subsys_1106_3058_15dd_7609, 0}; +#undef pci_ss_info_15dd_7609 +#define pci_ss_info_15dd_7609 pci_ss_info_1106_3058_15dd_7609 +static const pciSubsystemInfo pci_ss_info_1106_3059_1458_a002 = + {0x1458, 0xa002, pci_subsys_1106_3059_1458_a002, 0}; +#undef pci_ss_info_1458_a002 +#define pci_ss_info_1458_a002 pci_ss_info_1106_3059_1458_a002 +static const pciSubsystemInfo pci_ss_info_1106_3065_1106_0102 = + {0x1106, 0x0102, pci_subsys_1106_3065_1106_0102, 0}; +#undef pci_ss_info_1106_0102 +#define pci_ss_info_1106_0102 pci_ss_info_1106_3065_1106_0102 +static const pciSubsystemInfo pci_ss_info_1106_3065_1186_1400 = + {0x1186, 0x1400, pci_subsys_1106_3065_1186_1400, 0}; +#undef pci_ss_info_1186_1400 +#define pci_ss_info_1186_1400 pci_ss_info_1106_3065_1186_1400 +static const pciSubsystemInfo pci_ss_info_1106_3065_1186_1401 = + {0x1186, 0x1401, pci_subsys_1106_3065_1186_1401, 0}; +#undef pci_ss_info_1186_1401 +#define pci_ss_info_1186_1401 pci_ss_info_1106_3065_1186_1401 +static const pciSubsystemInfo pci_ss_info_1106_3074_1043_8052 = + {0x1043, 0x8052, pci_subsys_1106_3074_1043_8052, 0}; +#undef pci_ss_info_1043_8052 +#define pci_ss_info_1043_8052 pci_ss_info_1106_3074_1043_8052 +static const pciSubsystemInfo pci_ss_info_1106_3099_1043_8064 = + {0x1043, 0x8064, pci_subsys_1106_3099_1043_8064, 0}; +#undef pci_ss_info_1043_8064 +#define pci_ss_info_1043_8064 pci_ss_info_1106_3099_1043_8064 +static const pciSubsystemInfo pci_ss_info_1106_3099_1043_807f = + {0x1043, 0x807f, pci_subsys_1106_3099_1043_807f, 0}; +#undef pci_ss_info_1043_807f +#define pci_ss_info_1043_807f pci_ss_info_1106_3099_1043_807f +static const pciSubsystemInfo pci_ss_info_1106_3104_1458_5004 = + {0x1458, 0x5004, pci_subsys_1106_3104_1458_5004, 0}; +#undef pci_ss_info_1458_5004 +#define pci_ss_info_1458_5004 pci_ss_info_1106_3104_1458_5004 +static const pciSubsystemInfo pci_ss_info_1106_3177_1458_5001 = + {0x1458, 0x5001, pci_subsys_1106_3177_1458_5001, 0}; +#undef pci_ss_info_1458_5001 +#define pci_ss_info_1458_5001 pci_ss_info_1106_3177_1458_5001 +static const pciSubsystemInfo pci_ss_info_1106_3189_1458_5000 = + {0x1458, 0x5000, pci_subsys_1106_3189_1458_5000, 0}; +#undef pci_ss_info_1458_5000 +#define pci_ss_info_1458_5000 pci_ss_info_1106_3189_1458_5000 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1113_1211_103c_1207 = + {0x103c, 0x1207, pci_subsys_1113_1211_103c_1207, 0}; +#undef pci_ss_info_103c_1207 +#define pci_ss_info_103c_1207 pci_ss_info_1113_1211_103c_1207 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1113_1211_1113_1211 = + {0x1113, 0x1211, pci_subsys_1113_1211_1113_1211, 0}; +#undef pci_ss_info_1113_1211 +#define pci_ss_info_1113_1211 pci_ss_info_1113_1211_1113_1211 +static const pciSubsystemInfo pci_ss_info_1113_1216_111a_1020 = + {0x111a, 0x1020, pci_subsys_1113_1216_111a_1020, 0}; +#undef pci_ss_info_111a_1020 +#define pci_ss_info_111a_1020 pci_ss_info_1113_1216_111a_1020 +static const pciSubsystemInfo pci_ss_info_1113_9211_1113_9211 = + {0x1113, 0x9211, pci_subsys_1113_9211_1113_9211, 0}; +#undef pci_ss_info_1113_9211 +#define pci_ss_info_1113_9211 pci_ss_info_1113_9211_1113_9211 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_111a_0003_111a_0000 = + {0x111a, 0x0000, pci_subsys_111a_0003_111a_0000, 0}; +#undef pci_ss_info_111a_0000 +#define pci_ss_info_111a_0000 pci_ss_info_111a_0003_111a_0000 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0001 = + {0x111a, 0x0001, pci_subsys_111a_0005_111a_0001, 0}; +#undef pci_ss_info_111a_0001 +#define pci_ss_info_111a_0001 pci_ss_info_111a_0005_111a_0001 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0009 = + {0x111a, 0x0009, pci_subsys_111a_0005_111a_0009, 0}; +#undef pci_ss_info_111a_0009 +#define pci_ss_info_111a_0009 pci_ss_info_111a_0005_111a_0009 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0101 = + {0x111a, 0x0101, pci_subsys_111a_0005_111a_0101, 0}; +#undef pci_ss_info_111a_0101 +#define pci_ss_info_111a_0101 pci_ss_info_111a_0005_111a_0101 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0109 = + {0x111a, 0x0109, pci_subsys_111a_0005_111a_0109, 0}; +#undef pci_ss_info_111a_0109 +#define pci_ss_info_111a_0109 pci_ss_info_111a_0005_111a_0109 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0809 = + {0x111a, 0x0809, pci_subsys_111a_0005_111a_0809, 0}; +#undef pci_ss_info_111a_0809 +#define pci_ss_info_111a_0809 pci_ss_info_111a_0005_111a_0809 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0909 = + {0x111a, 0x0909, pci_subsys_111a_0005_111a_0909, 0}; +#undef pci_ss_info_111a_0909 +#define pci_ss_info_111a_0909 pci_ss_info_111a_0005_111a_0909 +static const pciSubsystemInfo pci_ss_info_111a_0005_111a_0a09 = + {0x111a, 0x0a09, pci_subsys_111a_0005_111a_0a09, 0}; +#undef pci_ss_info_111a_0a09 +#define pci_ss_info_111a_0a09 pci_ss_info_111a_0005_111a_0a09 +static const pciSubsystemInfo pci_ss_info_111a_0007_111a_1001 = + {0x111a, 0x1001, pci_subsys_111a_0007_111a_1001, 0}; +#undef pci_ss_info_111a_1001 +#define pci_ss_info_111a_1001 pci_ss_info_111a_0007_111a_1001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1127_0400_1127_0400 = + {0x1127, 0x0400, pci_subsys_1127_0400_1127_0400, 0}; +#undef pci_ss_info_1127_0400 +#define pci_ss_info_1127_0400 pci_ss_info_1127_0400_1127_0400 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1131_7146_114b_2003 = + {0x114b, 0x2003, pci_subsys_1131_7146_114b_2003, 0}; +#undef pci_ss_info_114b_2003 +#define pci_ss_info_114b_2003 pci_ss_info_1131_7146_114b_2003 +static const pciSubsystemInfo pci_ss_info_1131_7146_11bd_0006 = + {0x11bd, 0x0006, pci_subsys_1131_7146_11bd_0006, 0}; +#undef pci_ss_info_11bd_0006 +#define pci_ss_info_11bd_0006 pci_ss_info_1131_7146_11bd_0006 +static const pciSubsystemInfo pci_ss_info_1131_7146_11bd_000a = + {0x11bd, 0x000a, pci_subsys_1131_7146_11bd_000a, 0}; +#undef pci_ss_info_11bd_000a +#define pci_ss_info_11bd_000a pci_ss_info_1131_7146_11bd_000a +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1133_e001_1133_e001 = + {0x1133, 0xe001, pci_subsys_1133_e001_1133_e001, 0}; +#undef pci_ss_info_1133_e001 +#define pci_ss_info_1133_e001 pci_ss_info_1133_e001_1133_e001 +static const pciSubsystemInfo pci_ss_info_1133_e002_1133_e002 = + {0x1133, 0xe002, pci_subsys_1133_e002_1133_e002, 0}; +#undef pci_ss_info_1133_e002 +#define pci_ss_info_1133_e002 pci_ss_info_1133_e002_1133_e002 +static const pciSubsystemInfo pci_ss_info_1133_e003_1133_e003 = + {0x1133, 0xe003, pci_subsys_1133_e003_1133_e003, 0}; +#undef pci_ss_info_1133_e003 +#define pci_ss_info_1133_e003 pci_ss_info_1133_e003_1133_e003 +static const pciSubsystemInfo pci_ss_info_1133_e004_1133_e004 = + {0x1133, 0xe004, pci_subsys_1133_e004_1133_e004, 0}; +#undef pci_ss_info_1133_e004 +#define pci_ss_info_1133_e004 pci_ss_info_1133_e004_1133_e004 +static const pciSubsystemInfo pci_ss_info_1133_e005_1133_e005 = + {0x1133, 0xe005, pci_subsys_1133_e005_1133_e005, 0}; +#undef pci_ss_info_1133_e005 +#define pci_ss_info_1133_e005 pci_ss_info_1133_e005_1133_e005 +static const pciSubsystemInfo pci_ss_info_1133_e010_1133_e010 = + {0x1133, 0xe010, pci_subsys_1133_e010_1133_e010, 0}; +#undef pci_ss_info_1133_e010 +#define pci_ss_info_1133_e010 pci_ss_info_1133_e010_1133_e010 +static const pciSubsystemInfo pci_ss_info_1133_e012_1133_e012 = + {0x1133, 0xe012, pci_subsys_1133_e012_1133_e012, 0}; +#undef pci_ss_info_1133_e012 +#define pci_ss_info_1133_e012 pci_ss_info_1133_e012_1133_e012 +static const pciSubsystemInfo pci_ss_info_1133_e014_1133_e014 = + {0x1133, 0xe014, pci_subsys_1133_e014_1133_e014, 0}; +#undef pci_ss_info_1133_e014 +#define pci_ss_info_1133_e014 pci_ss_info_1133_e014_1133_e014 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1148_4000_0e11_b03b = + {0x0e11, 0xb03b, pci_subsys_1148_4000_0e11_b03b, 0}; +#undef pci_ss_info_0e11_b03b +#define pci_ss_info_0e11_b03b pci_ss_info_1148_4000_0e11_b03b +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1148_4000_0e11_b03c = + {0x0e11, 0xb03c, pci_subsys_1148_4000_0e11_b03c, 0}; +#undef pci_ss_info_0e11_b03c +#define pci_ss_info_0e11_b03c pci_ss_info_1148_4000_0e11_b03c +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1148_4000_0e11_b03d = + {0x0e11, 0xb03d, pci_subsys_1148_4000_0e11_b03d, 0}; +#undef pci_ss_info_0e11_b03d +#define pci_ss_info_0e11_b03d pci_ss_info_1148_4000_0e11_b03d +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1148_4000_0e11_b03e = + {0x0e11, 0xb03e, pci_subsys_1148_4000_0e11_b03e, 0}; +#undef pci_ss_info_0e11_b03e +#define pci_ss_info_0e11_b03e pci_ss_info_1148_4000_0e11_b03e +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1148_4000_0e11_b03f = + {0x0e11, 0xb03f, pci_subsys_1148_4000_0e11_b03f, 0}; +#undef pci_ss_info_0e11_b03f +#define pci_ss_info_0e11_b03f pci_ss_info_1148_4000_0e11_b03f +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5521 = + {0x1148, 0x5521, pci_subsys_1148_4000_1148_5521, 0}; +#undef pci_ss_info_1148_5521 +#define pci_ss_info_1148_5521 pci_ss_info_1148_4000_1148_5521 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5522 = + {0x1148, 0x5522, pci_subsys_1148_4000_1148_5522, 0}; +#undef pci_ss_info_1148_5522 +#define pci_ss_info_1148_5522 pci_ss_info_1148_4000_1148_5522 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5541 = + {0x1148, 0x5541, pci_subsys_1148_4000_1148_5541, 0}; +#undef pci_ss_info_1148_5541 +#define pci_ss_info_1148_5541 pci_ss_info_1148_4000_1148_5541 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5543 = + {0x1148, 0x5543, pci_subsys_1148_4000_1148_5543, 0}; +#undef pci_ss_info_1148_5543 +#define pci_ss_info_1148_5543 pci_ss_info_1148_4000_1148_5543 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5544 = + {0x1148, 0x5544, pci_subsys_1148_4000_1148_5544, 0}; +#undef pci_ss_info_1148_5544 +#define pci_ss_info_1148_5544 pci_ss_info_1148_4000_1148_5544 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5821 = + {0x1148, 0x5821, pci_subsys_1148_4000_1148_5821, 0}; +#undef pci_ss_info_1148_5821 +#define pci_ss_info_1148_5821 pci_ss_info_1148_4000_1148_5821 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5822 = + {0x1148, 0x5822, pci_subsys_1148_4000_1148_5822, 0}; +#undef pci_ss_info_1148_5822 +#define pci_ss_info_1148_5822 pci_ss_info_1148_4000_1148_5822 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5841 = + {0x1148, 0x5841, pci_subsys_1148_4000_1148_5841, 0}; +#undef pci_ss_info_1148_5841 +#define pci_ss_info_1148_5841 pci_ss_info_1148_4000_1148_5841 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5843 = + {0x1148, 0x5843, pci_subsys_1148_4000_1148_5843, 0}; +#undef pci_ss_info_1148_5843 +#define pci_ss_info_1148_5843 pci_ss_info_1148_4000_1148_5843 +static const pciSubsystemInfo pci_ss_info_1148_4000_1148_5844 = + {0x1148, 0x5844, pci_subsys_1148_4000_1148_5844, 0}; +#undef pci_ss_info_1148_5844 +#define pci_ss_info_1148_5844 pci_ss_info_1148_4000_1148_5844 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9821 = + {0x1148, 0x9821, pci_subsys_1148_4300_1148_9821, 0}; +#undef pci_ss_info_1148_9821 +#define pci_ss_info_1148_9821 pci_ss_info_1148_4300_1148_9821 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9822 = + {0x1148, 0x9822, pci_subsys_1148_4300_1148_9822, 0}; +#undef pci_ss_info_1148_9822 +#define pci_ss_info_1148_9822 pci_ss_info_1148_4300_1148_9822 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9841 = + {0x1148, 0x9841, pci_subsys_1148_4300_1148_9841, 0}; +#undef pci_ss_info_1148_9841 +#define pci_ss_info_1148_9841 pci_ss_info_1148_4300_1148_9841 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9842 = + {0x1148, 0x9842, pci_subsys_1148_4300_1148_9842, 0}; +#undef pci_ss_info_1148_9842 +#define pci_ss_info_1148_9842 pci_ss_info_1148_4300_1148_9842 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9843 = + {0x1148, 0x9843, pci_subsys_1148_4300_1148_9843, 0}; +#undef pci_ss_info_1148_9843 +#define pci_ss_info_1148_9843 pci_ss_info_1148_4300_1148_9843 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9844 = + {0x1148, 0x9844, pci_subsys_1148_4300_1148_9844, 0}; +#undef pci_ss_info_1148_9844 +#define pci_ss_info_1148_9844 pci_ss_info_1148_4300_1148_9844 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9861 = + {0x1148, 0x9861, pci_subsys_1148_4300_1148_9861, 0}; +#undef pci_ss_info_1148_9861 +#define pci_ss_info_1148_9861 pci_ss_info_1148_4300_1148_9861 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9862 = + {0x1148, 0x9862, pci_subsys_1148_4300_1148_9862, 0}; +#undef pci_ss_info_1148_9862 +#define pci_ss_info_1148_9862 pci_ss_info_1148_4300_1148_9862 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9871 = + {0x1148, 0x9871, pci_subsys_1148_4300_1148_9871, 0}; +#undef pci_ss_info_1148_9871 +#define pci_ss_info_1148_9871 pci_ss_info_1148_4300_1148_9871 +static const pciSubsystemInfo pci_ss_info_1148_4300_1148_9872 = + {0x1148, 0x9872, pci_subsys_1148_4300_1148_9872, 0}; +#undef pci_ss_info_1148_9872 +#define pci_ss_info_1148_9872 pci_ss_info_1148_4300_1148_9872 +static const pciSubsystemInfo pci_ss_info_1148_4300_1259_2970 = + {0x1259, 0x2970, pci_subsys_1148_4300_1259_2970, 0}; +#undef pci_ss_info_1259_2970 +#define pci_ss_info_1259_2970 pci_ss_info_1148_4300_1259_2970 +static const pciSubsystemInfo pci_ss_info_1148_4300_1259_2972 = + {0x1259, 0x2972, pci_subsys_1148_4300_1259_2972, 0}; +#undef pci_ss_info_1259_2972 +#define pci_ss_info_1259_2972 pci_ss_info_1148_4300_1259_2972 +static const pciSubsystemInfo pci_ss_info_1148_4300_1259_2975 = + {0x1259, 0x2975, pci_subsys_1148_4300_1259_2975, 0}; +#undef pci_ss_info_1259_2975 +#define pci_ss_info_1259_2975 pci_ss_info_1148_4300_1259_2975 +static const pciSubsystemInfo pci_ss_info_1148_4300_1259_2977 = + {0x1259, 0x2977, pci_subsys_1148_4300_1259_2977, 0}; +#undef pci_ss_info_1259_2977 +#define pci_ss_info_1259_2977 pci_ss_info_1148_4300_1259_2977 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_5021 = + {0x1148, 0x5021, pci_subsys_1148_4320_1148_5021, 0}; +#undef pci_ss_info_1148_5021 +#define pci_ss_info_1148_5021 pci_ss_info_1148_4320_1148_5021 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_5041 = + {0x1148, 0x5041, pci_subsys_1148_4320_1148_5041, 0}; +#undef pci_ss_info_1148_5041 +#define pci_ss_info_1148_5041 pci_ss_info_1148_4320_1148_5041 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_5043 = + {0x1148, 0x5043, pci_subsys_1148_4320_1148_5043, 0}; +#undef pci_ss_info_1148_5043 +#define pci_ss_info_1148_5043 pci_ss_info_1148_4320_1148_5043 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_5051 = + {0x1148, 0x5051, pci_subsys_1148_4320_1148_5051, 0}; +#undef pci_ss_info_1148_5051 +#define pci_ss_info_1148_5051 pci_ss_info_1148_4320_1148_5051 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_5061 = + {0x1148, 0x5061, pci_subsys_1148_4320_1148_5061, 0}; +#undef pci_ss_info_1148_5061 +#define pci_ss_info_1148_5061 pci_ss_info_1148_4320_1148_5061 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_5071 = + {0x1148, 0x5071, pci_subsys_1148_4320_1148_5071, 0}; +#undef pci_ss_info_1148_5071 +#define pci_ss_info_1148_5071 pci_ss_info_1148_4320_1148_5071 +static const pciSubsystemInfo pci_ss_info_1148_4320_1148_9521 = + {0x1148, 0x9521, pci_subsys_1148_4320_1148_9521, 0}; +#undef pci_ss_info_1148_9521 +#define pci_ss_info_1148_9521 pci_ss_info_1148_4320_1148_9521 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_114f_001d_114f_0050 = + {0x114f, 0x0050, pci_subsys_114f_001d_114f_0050, 0}; +#undef pci_ss_info_114f_0050 +#define pci_ss_info_114f_0050 pci_ss_info_114f_001d_114f_0050 +static const pciSubsystemInfo pci_ss_info_114f_001d_114f_0051 = + {0x114f, 0x0051, pci_subsys_114f_001d_114f_0051, 0}; +#undef pci_ss_info_114f_0051 +#define pci_ss_info_114f_0051 pci_ss_info_114f_001d_114f_0051 +static const pciSubsystemInfo pci_ss_info_114f_001d_114f_0052 = + {0x114f, 0x0052, pci_subsys_114f_001d_114f_0052, 0}; +#undef pci_ss_info_114f_0052 +#define pci_ss_info_114f_0052 pci_ss_info_114f_001d_114f_0052 +static const pciSubsystemInfo pci_ss_info_114f_001d_114f_0053 = + {0x114f, 0x0053, pci_subsys_114f_001d_114f_0053, 0}; +#undef pci_ss_info_114f_0053 +#define pci_ss_info_114f_0053 pci_ss_info_114f_001d_114f_0053 +static const pciSubsystemInfo pci_ss_info_114f_0024_114f_0030 = + {0x114f, 0x0030, pci_subsys_114f_0024_114f_0030, 0}; +#undef pci_ss_info_114f_0030 +#define pci_ss_info_114f_0030 pci_ss_info_114f_0024_114f_0030 +static const pciSubsystemInfo pci_ss_info_114f_0024_114f_0031 = + {0x114f, 0x0031, pci_subsys_114f_0024_114f_0031, 0}; +#undef pci_ss_info_114f_0031 +#define pci_ss_info_114f_0031 pci_ss_info_114f_0024_114f_0031 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_115d_0003_1014_0181 = + {0x1014, 0x0181, pci_subsys_115d_0003_1014_0181, 0}; +#undef pci_ss_info_1014_0181 +#define pci_ss_info_1014_0181 pci_ss_info_115d_0003_1014_0181 +static const pciSubsystemInfo pci_ss_info_115d_0003_1014_1181 = + {0x1014, 0x1181, pci_subsys_115d_0003_1014_1181, 0}; +#undef pci_ss_info_1014_1181 +#define pci_ss_info_1014_1181 pci_ss_info_115d_0003_1014_1181 +static const pciSubsystemInfo pci_ss_info_115d_0003_1014_8181 = + {0x1014, 0x8181, pci_subsys_115d_0003_1014_8181, 0}; +#undef pci_ss_info_1014_8181 +#define pci_ss_info_1014_8181 pci_ss_info_115d_0003_1014_8181 +static const pciSubsystemInfo pci_ss_info_115d_0003_1014_9181 = + {0x1014, 0x9181, pci_subsys_115d_0003_1014_9181, 0}; +#undef pci_ss_info_1014_9181 +#define pci_ss_info_1014_9181 pci_ss_info_115d_0003_1014_9181 +static const pciSubsystemInfo pci_ss_info_115d_0003_115d_0181 = + {0x115d, 0x0181, pci_subsys_115d_0003_115d_0181, 0}; +#undef pci_ss_info_115d_0181 +#define pci_ss_info_115d_0181 pci_ss_info_115d_0003_115d_0181 +static const pciSubsystemInfo pci_ss_info_115d_0003_115d_1181 = + {0x115d, 0x1181, pci_subsys_115d_0003_115d_1181, 0}; +#undef pci_ss_info_115d_1181 +#define pci_ss_info_115d_1181 pci_ss_info_115d_0003_115d_1181 +static const pciSubsystemInfo pci_ss_info_115d_0003_1179_0181 = + {0x1179, 0x0181, pci_subsys_115d_0003_1179_0181, 0}; +#undef pci_ss_info_1179_0181 +#define pci_ss_info_1179_0181 pci_ss_info_115d_0003_1179_0181 +#endif +static const pciSubsystemInfo pci_ss_info_115d_0003_8086_8181 = + {0x8086, 0x8181, pci_subsys_115d_0003_8086_8181, 0}; +#undef pci_ss_info_8086_8181 +#define pci_ss_info_8086_8181 pci_ss_info_115d_0003_8086_8181 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_115d_0003_8086_9181 = + {0x8086, 0x9181, pci_subsys_115d_0003_8086_9181, 0}; +#undef pci_ss_info_8086_9181 +#define pci_ss_info_8086_9181 pci_ss_info_115d_0003_8086_9181 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_115d_0005_1014_0182 = + {0x1014, 0x0182, pci_subsys_115d_0005_1014_0182, 0}; +#undef pci_ss_info_1014_0182 +#define pci_ss_info_1014_0182 pci_ss_info_115d_0005_1014_0182 +static const pciSubsystemInfo pci_ss_info_115d_0005_1014_1182 = + {0x1014, 0x1182, pci_subsys_115d_0005_1014_1182, 0}; +#undef pci_ss_info_1014_1182 +#define pci_ss_info_1014_1182 pci_ss_info_115d_0005_1014_1182 +static const pciSubsystemInfo pci_ss_info_115d_0005_115d_0182 = + {0x115d, 0x0182, pci_subsys_115d_0005_115d_0182, 0}; +#undef pci_ss_info_115d_0182 +#define pci_ss_info_115d_0182 pci_ss_info_115d_0005_115d_0182 +static const pciSubsystemInfo pci_ss_info_115d_0005_115d_1182 = + {0x115d, 0x1182, pci_subsys_115d_0005_115d_1182, 0}; +#undef pci_ss_info_115d_1182 +#define pci_ss_info_115d_1182 pci_ss_info_115d_0005_115d_1182 +static const pciSubsystemInfo pci_ss_info_115d_0007_1014_0182 = + {0x1014, 0x0182, pci_subsys_115d_0007_1014_0182, 0}; +#undef pci_ss_info_1014_0182 +#define pci_ss_info_1014_0182 pci_ss_info_115d_0007_1014_0182 +static const pciSubsystemInfo pci_ss_info_115d_0007_1014_1182 = + {0x1014, 0x1182, pci_subsys_115d_0007_1014_1182, 0}; +#undef pci_ss_info_1014_1182 +#define pci_ss_info_1014_1182 pci_ss_info_115d_0007_1014_1182 +static const pciSubsystemInfo pci_ss_info_115d_0007_115d_0182 = + {0x115d, 0x0182, pci_subsys_115d_0007_115d_0182, 0}; +#undef pci_ss_info_115d_0182 +#define pci_ss_info_115d_0182 pci_ss_info_115d_0007_115d_0182 +static const pciSubsystemInfo pci_ss_info_115d_0007_115d_1182 = + {0x115d, 0x1182, pci_subsys_115d_0007_115d_1182, 0}; +#undef pci_ss_info_115d_1182 +#define pci_ss_info_115d_1182 pci_ss_info_115d_0007_115d_1182 +static const pciSubsystemInfo pci_ss_info_115d_000b_1014_0183 = + {0x1014, 0x0183, pci_subsys_115d_000b_1014_0183, 0}; +#undef pci_ss_info_1014_0183 +#define pci_ss_info_1014_0183 pci_ss_info_115d_000b_1014_0183 +static const pciSubsystemInfo pci_ss_info_115d_000b_115d_0183 = + {0x115d, 0x0183, pci_subsys_115d_000b_115d_0183, 0}; +#undef pci_ss_info_115d_0183 +#define pci_ss_info_115d_0183 pci_ss_info_115d_000b_115d_0183 +static const pciSubsystemInfo pci_ss_info_115d_000f_1014_0183 = + {0x1014, 0x0183, pci_subsys_115d_000f_1014_0183, 0}; +#undef pci_ss_info_1014_0183 +#define pci_ss_info_1014_0183 pci_ss_info_115d_000f_1014_0183 +static const pciSubsystemInfo pci_ss_info_115d_000f_115d_0183 = + {0x115d, 0x0183, pci_subsys_115d_000f_115d_0183, 0}; +#undef pci_ss_info_115d_0183 +#define pci_ss_info_115d_0183 pci_ss_info_115d_000f_115d_0183 +static const pciSubsystemInfo pci_ss_info_115d_0101_115d_1081 = + {0x115d, 0x1081, pci_subsys_115d_0101_115d_1081, 0}; +#undef pci_ss_info_115d_1081 +#define pci_ss_info_115d_1081 pci_ss_info_115d_0101_115d_1081 +static const pciSubsystemInfo pci_ss_info_115d_0103_1014_9181 = + {0x1014, 0x9181, pci_subsys_115d_0103_1014_9181, 0}; +#undef pci_ss_info_1014_9181 +#define pci_ss_info_1014_9181 pci_ss_info_115d_0103_1014_9181 +static const pciSubsystemInfo pci_ss_info_115d_0103_1115_1181 = + {0x1115, 0x1181, pci_subsys_115d_0103_1115_1181, 0}; +#undef pci_ss_info_1115_1181 +#define pci_ss_info_1115_1181 pci_ss_info_115d_0103_1115_1181 +static const pciSubsystemInfo pci_ss_info_115d_0103_115d_1181 = + {0x115d, 0x1181, pci_subsys_115d_0103_115d_1181, 0}; +#undef pci_ss_info_115d_1181 +#define pci_ss_info_115d_1181 pci_ss_info_115d_0103_115d_1181 +#endif +static const pciSubsystemInfo pci_ss_info_115d_0103_8086_9181 = + {0x8086, 0x9181, pci_subsys_115d_0103_8086_9181, 0}; +#undef pci_ss_info_8086_9181 +#define pci_ss_info_8086_9181 pci_ss_info_115d_0103_8086_9181 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1163_2000_1092_2000 = + {0x1092, 0x2000, pci_subsys_1163_2000_1092_2000, 0}; +#undef pci_ss_info_1092_2000 +#define pci_ss_info_1092_2000 pci_ss_info_1163_2000_1092_2000 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1179_0d01_1179_0001 = + {0x1179, 0x0001, pci_subsys_1179_0d01_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1179_0d01_1179_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1180_0475_144d_c006 = + {0x144d, 0xc006, pci_subsys_1180_0475_144d_c006, 0}; +#undef pci_ss_info_144d_c006 +#define pci_ss_info_144d_c006 pci_ss_info_1180_0475_144d_c006 +static const pciSubsystemInfo pci_ss_info_1180_0476_1014_0185 = + {0x1014, 0x0185, pci_subsys_1180_0476_1014_0185, 0}; +#undef pci_ss_info_1014_0185 +#define pci_ss_info_1014_0185 pci_ss_info_1180_0476_1014_0185 +#endif +static const pciSubsystemInfo pci_ss_info_1180_0476_104d_80df = + {0x104d, 0x80df, pci_subsys_1180_0476_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_1180_0476_104d_80df +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1180_0476_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_1180_0476_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_1180_0476_104d_80e7 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1180_0478_1014_0184 = + {0x1014, 0x0184, pci_subsys_1180_0478_1014_0184, 0}; +#undef pci_ss_info_1014_0184 +#define pci_ss_info_1014_0184 pci_ss_info_1180_0478_1014_0184 +static const pciSubsystemInfo pci_ss_info_1180_0522_1014_01cf = + {0x1014, 0x01cf, pci_subsys_1180_0522_1014_01cf, 0}; +#undef pci_ss_info_1014_01cf +#define pci_ss_info_1014_01cf pci_ss_info_1180_0522_1014_01cf +static const pciSubsystemInfo pci_ss_info_1180_0551_144d_c006 = + {0x144d, 0xc006, pci_subsys_1180_0551_144d_c006, 0}; +#undef pci_ss_info_144d_c006 +#define pci_ss_info_144d_c006 pci_ss_info_1180_0551_144d_c006 +static const pciSubsystemInfo pci_ss_info_1180_0552_1014_0511 = + {0x1014, 0x0511, pci_subsys_1180_0552_1014_0511, 0}; +#undef pci_ss_info_1014_0511 +#define pci_ss_info_1014_0511 pci_ss_info_1180_0552_1014_0511 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1186_1002_1186_1002 = + {0x1186, 0x1002, pci_subsys_1186_1002_1186_1002, 0}; +#undef pci_ss_info_1186_1002 +#define pci_ss_info_1186_1002 pci_ss_info_1186_1002_1186_1002 +static const pciSubsystemInfo pci_ss_info_1186_1002_1186_1012 = + {0x1186, 0x1012, pci_subsys_1186_1002_1186_1012, 0}; +#undef pci_ss_info_1186_1012 +#define pci_ss_info_1186_1012 pci_ss_info_1186_1002_1186_1012 +static const pciSubsystemInfo pci_ss_info_1186_1300_1186_1300 = + {0x1186, 0x1300, pci_subsys_1186_1300_1186_1300, 0}; +#undef pci_ss_info_1186_1300 +#define pci_ss_info_1186_1300 pci_ss_info_1186_1300_1186_1300 +static const pciSubsystemInfo pci_ss_info_1186_1300_1186_1301 = + {0x1186, 0x1301, pci_subsys_1186_1300_1186_1301, 0}; +#undef pci_ss_info_1186_1301 +#define pci_ss_info_1186_1301 pci_ss_info_1186_1300_1186_1301 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11ad_0002_11ad_0002 = + {0x11ad, 0x0002, pci_subsys_11ad_0002_11ad_0002, 0}; +#undef pci_ss_info_11ad_0002 +#define pci_ss_info_11ad_0002 pci_ss_info_11ad_0002_11ad_0002 +static const pciSubsystemInfo pci_ss_info_11ad_0002_11ad_0003 = + {0x11ad, 0x0003, pci_subsys_11ad_0002_11ad_0003, 0}; +#undef pci_ss_info_11ad_0003 +#define pci_ss_info_11ad_0003 pci_ss_info_11ad_0002_11ad_0003 +static const pciSubsystemInfo pci_ss_info_11ad_0002_11ad_f003 = + {0x11ad, 0xf003, pci_subsys_11ad_0002_11ad_f003, 0}; +#undef pci_ss_info_11ad_f003 +#define pci_ss_info_11ad_f003 pci_ss_info_11ad_0002_11ad_f003 +static const pciSubsystemInfo pci_ss_info_11ad_0002_11ad_ffff = + {0x11ad, 0xffff, pci_subsys_11ad_0002_11ad_ffff, 0}; +#undef pci_ss_info_11ad_ffff +#define pci_ss_info_11ad_ffff pci_ss_info_11ad_0002_11ad_ffff +static const pciSubsystemInfo pci_ss_info_11ad_0002_1385_f004 = + {0x1385, 0xf004, pci_subsys_11ad_0002_1385_f004, 0}; +#undef pci_ss_info_1385_f004 +#define pci_ss_info_1385_f004 pci_ss_info_11ad_0002_1385_f004 +static const pciSubsystemInfo pci_ss_info_11ad_c115_11ad_c001 = + {0x11ad, 0xc001, pci_subsys_11ad_c115_11ad_c001, 0}; +#undef pci_ss_info_11ad_c001 +#define pci_ss_info_11ad_c001 pci_ss_info_11ad_c115_11ad_c001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0440_1033_8015 = + {0x1033, 0x8015, pci_subsys_11c1_0440_1033_8015, 0}; +#undef pci_ss_info_1033_8015 +#define pci_ss_info_1033_8015 pci_ss_info_11c1_0440_1033_8015 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0440_1033_8047 = + {0x1033, 0x8047, pci_subsys_11c1_0440_1033_8047, 0}; +#undef pci_ss_info_1033_8047 +#define pci_ss_info_1033_8047 pci_ss_info_11c1_0440_1033_8047 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0440_1033_804f = + {0x1033, 0x804f, pci_subsys_11c1_0440_1033_804f, 0}; +#undef pci_ss_info_1033_804f +#define pci_ss_info_1033_804f pci_ss_info_11c1_0440_1033_804f +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11c1_0440_10cf_102c = + {0x10cf, 0x102c, pci_subsys_11c1_0440_10cf_102c, 0}; +#undef pci_ss_info_10cf_102c +#define pci_ss_info_10cf_102c pci_ss_info_11c1_0440_10cf_102c +static const pciSubsystemInfo pci_ss_info_11c1_0440_10cf_104a = + {0x10cf, 0x104a, pci_subsys_11c1_0440_10cf_104a, 0}; +#undef pci_ss_info_10cf_104a +#define pci_ss_info_10cf_104a pci_ss_info_11c1_0440_10cf_104a +static const pciSubsystemInfo pci_ss_info_11c1_0440_10cf_105f = + {0x10cf, 0x105f, pci_subsys_11c1_0440_10cf_105f, 0}; +#undef pci_ss_info_10cf_105f +#define pci_ss_info_10cf_105f pci_ss_info_11c1_0440_10cf_105f +static const pciSubsystemInfo pci_ss_info_11c1_0440_1179_0001 = + {0x1179, 0x0001, pci_subsys_11c1_0440_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_11c1_0440_1179_0001 +static const pciSubsystemInfo pci_ss_info_11c1_0440_11c1_0440 = + {0x11c1, 0x0440, pci_subsys_11c1_0440_11c1_0440, 0}; +#undef pci_ss_info_11c1_0440 +#define pci_ss_info_11c1_0440 pci_ss_info_11c1_0440_11c1_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0440_122d_4101 = + {0x122d, 0x4101, pci_subsys_11c1_0440_122d_4101, 0}; +#undef pci_ss_info_122d_4101 +#define pci_ss_info_122d_4101 pci_ss_info_11c1_0440_122d_4101 +static const pciSubsystemInfo pci_ss_info_11c1_0440_122d_4102 = + {0x122d, 0x4102, pci_subsys_11c1_0440_122d_4102, 0}; +#undef pci_ss_info_122d_4102 +#define pci_ss_info_122d_4102 pci_ss_info_11c1_0440_122d_4102 +static const pciSubsystemInfo pci_ss_info_11c1_0440_13e0_0040 = + {0x13e0, 0x0040, pci_subsys_11c1_0440_13e0_0040, 0}; +#undef pci_ss_info_13e0_0040 +#define pci_ss_info_13e0_0040 pci_ss_info_11c1_0440_13e0_0040 +static const pciSubsystemInfo pci_ss_info_11c1_0440_13e0_0440 = + {0x13e0, 0x0440, pci_subsys_11c1_0440_13e0_0440, 0}; +#undef pci_ss_info_13e0_0440 +#define pci_ss_info_13e0_0440 pci_ss_info_11c1_0440_13e0_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0440_13e0_0441 = + {0x13e0, 0x0441, pci_subsys_11c1_0440_13e0_0441, 0}; +#undef pci_ss_info_13e0_0441 +#define pci_ss_info_13e0_0441 pci_ss_info_11c1_0440_13e0_0441 +static const pciSubsystemInfo pci_ss_info_11c1_0440_13e0_0450 = + {0x13e0, 0x0450, pci_subsys_11c1_0440_13e0_0450, 0}; +#undef pci_ss_info_13e0_0450 +#define pci_ss_info_13e0_0450 pci_ss_info_11c1_0440_13e0_0450 +static const pciSubsystemInfo pci_ss_info_11c1_0440_13e0_f100 = + {0x13e0, 0xf100, pci_subsys_11c1_0440_13e0_f100, 0}; +#undef pci_ss_info_13e0_f100 +#define pci_ss_info_13e0_f100 pci_ss_info_11c1_0440_13e0_f100 +static const pciSubsystemInfo pci_ss_info_11c1_0440_13e0_f101 = + {0x13e0, 0xf101, pci_subsys_11c1_0440_13e0_f101, 0}; +#undef pci_ss_info_13e0_f101 +#define pci_ss_info_13e0_f101 pci_ss_info_11c1_0440_13e0_f101 +static const pciSubsystemInfo pci_ss_info_11c1_0440_144d_2101 = + {0x144d, 0x2101, pci_subsys_11c1_0440_144d_2101, 0}; +#undef pci_ss_info_144d_2101 +#define pci_ss_info_144d_2101 pci_ss_info_11c1_0440_144d_2101 +static const pciSubsystemInfo pci_ss_info_11c1_0440_149f_0440 = + {0x149f, 0x0440, pci_subsys_11c1_0440_149f_0440, 0}; +#undef pci_ss_info_149f_0440 +#define pci_ss_info_149f_0440 pci_ss_info_11c1_0440_149f_0440 +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0441_1033_804d = + {0x1033, 0x804d, pci_subsys_11c1_0441_1033_804d, 0}; +#undef pci_ss_info_1033_804d +#define pci_ss_info_1033_804d pci_ss_info_11c1_0441_1033_804d +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0441_1033_8065 = + {0x1033, 0x8065, pci_subsys_11c1_0441_1033_8065, 0}; +#undef pci_ss_info_1033_8065 +#define pci_ss_info_1033_8065 pci_ss_info_11c1_0441_1033_8065 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0441_1092_0440 = + {0x1092, 0x0440, pci_subsys_11c1_0441_1092_0440, 0}; +#undef pci_ss_info_1092_0440 +#define pci_ss_info_1092_0440 pci_ss_info_11c1_0441_1092_0440 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11c1_0441_1179_0001 = + {0x1179, 0x0001, pci_subsys_11c1_0441_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_11c1_0441_1179_0001 +static const pciSubsystemInfo pci_ss_info_11c1_0441_11c1_0440 = + {0x11c1, 0x0440, pci_subsys_11c1_0441_11c1_0440, 0}; +#undef pci_ss_info_11c1_0440 +#define pci_ss_info_11c1_0440 pci_ss_info_11c1_0441_11c1_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0441_11c1_0441 = + {0x11c1, 0x0441, pci_subsys_11c1_0441_11c1_0441, 0}; +#undef pci_ss_info_11c1_0441 +#define pci_ss_info_11c1_0441 pci_ss_info_11c1_0441_11c1_0441 +static const pciSubsystemInfo pci_ss_info_11c1_0441_122d_4100 = + {0x122d, 0x4100, pci_subsys_11c1_0441_122d_4100, 0}; +#undef pci_ss_info_122d_4100 +#define pci_ss_info_122d_4100 pci_ss_info_11c1_0441_122d_4100 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_0040 = + {0x13e0, 0x0040, pci_subsys_11c1_0441_13e0_0040, 0}; +#undef pci_ss_info_13e0_0040 +#define pci_ss_info_13e0_0040 pci_ss_info_11c1_0441_13e0_0040 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_0100 = + {0x13e0, 0x0100, pci_subsys_11c1_0441_13e0_0100, 0}; +#undef pci_ss_info_13e0_0100 +#define pci_ss_info_13e0_0100 pci_ss_info_11c1_0441_13e0_0100 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_0410 = + {0x13e0, 0x0410, pci_subsys_11c1_0441_13e0_0410, 0}; +#undef pci_ss_info_13e0_0410 +#define pci_ss_info_13e0_0410 pci_ss_info_11c1_0441_13e0_0410 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_0420 = + {0x13e0, 0x0420, pci_subsys_11c1_0441_13e0_0420, 0}; +#undef pci_ss_info_13e0_0420 +#define pci_ss_info_13e0_0420 pci_ss_info_11c1_0441_13e0_0420 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_0440 = + {0x13e0, 0x0440, pci_subsys_11c1_0441_13e0_0440, 0}; +#undef pci_ss_info_13e0_0440 +#define pci_ss_info_13e0_0440 pci_ss_info_11c1_0441_13e0_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_0443 = + {0x13e0, 0x0443, pci_subsys_11c1_0441_13e0_0443, 0}; +#undef pci_ss_info_13e0_0443 +#define pci_ss_info_13e0_0443 pci_ss_info_11c1_0441_13e0_0443 +static const pciSubsystemInfo pci_ss_info_11c1_0441_13e0_f102 = + {0x13e0, 0xf102, pci_subsys_11c1_0441_13e0_f102, 0}; +#undef pci_ss_info_13e0_f102 +#define pci_ss_info_13e0_f102 pci_ss_info_11c1_0441_13e0_f102 +static const pciSubsystemInfo pci_ss_info_11c1_0441_1416_9804 = + {0x1416, 0x9804, pci_subsys_11c1_0441_1416_9804, 0}; +#undef pci_ss_info_1416_9804 +#define pci_ss_info_1416_9804 pci_ss_info_11c1_0441_1416_9804 +static const pciSubsystemInfo pci_ss_info_11c1_0441_141d_0440 = + {0x141d, 0x0440, pci_subsys_11c1_0441_141d_0440, 0}; +#undef pci_ss_info_141d_0440 +#define pci_ss_info_141d_0440 pci_ss_info_11c1_0441_141d_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0441_144f_0441 = + {0x144f, 0x0441, pci_subsys_11c1_0441_144f_0441, 0}; +#undef pci_ss_info_144f_0441 +#define pci_ss_info_144f_0441 pci_ss_info_11c1_0441_144f_0441 +static const pciSubsystemInfo pci_ss_info_11c1_0441_144f_0449 = + {0x144f, 0x0449, pci_subsys_11c1_0441_144f_0449, 0}; +#undef pci_ss_info_144f_0449 +#define pci_ss_info_144f_0449 pci_ss_info_11c1_0441_144f_0449 +static const pciSubsystemInfo pci_ss_info_11c1_0441_144f_110d = + {0x144f, 0x110d, pci_subsys_11c1_0441_144f_110d, 0}; +#undef pci_ss_info_144f_110d +#define pci_ss_info_144f_110d pci_ss_info_11c1_0441_144f_110d +static const pciSubsystemInfo pci_ss_info_11c1_0441_1468_0441 = + {0x1468, 0x0441, pci_subsys_11c1_0441_1468_0441, 0}; +#undef pci_ss_info_1468_0441 +#define pci_ss_info_1468_0441 pci_ss_info_11c1_0441_1468_0441 +static const pciSubsystemInfo pci_ss_info_11c1_0441_1668_0440 = + {0x1668, 0x0440, pci_subsys_11c1_0441_1668_0440, 0}; +#undef pci_ss_info_1668_0440 +#define pci_ss_info_1668_0440 pci_ss_info_11c1_0441_1668_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0442_11c1_0440 = + {0x11c1, 0x0440, pci_subsys_11c1_0442_11c1_0440, 0}; +#undef pci_ss_info_11c1_0440 +#define pci_ss_info_11c1_0440 pci_ss_info_11c1_0442_11c1_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0442_11c1_0442 = + {0x11c1, 0x0442, pci_subsys_11c1_0442_11c1_0442, 0}; +#undef pci_ss_info_11c1_0442 +#define pci_ss_info_11c1_0442 pci_ss_info_11c1_0442_11c1_0442 +static const pciSubsystemInfo pci_ss_info_11c1_0442_13e0_0412 = + {0x13e0, 0x0412, pci_subsys_11c1_0442_13e0_0412, 0}; +#undef pci_ss_info_13e0_0412 +#define pci_ss_info_13e0_0412 pci_ss_info_11c1_0442_13e0_0412 +static const pciSubsystemInfo pci_ss_info_11c1_0442_13e0_0442 = + {0x13e0, 0x0442, pci_subsys_11c1_0442_13e0_0442, 0}; +#undef pci_ss_info_13e0_0442 +#define pci_ss_info_13e0_0442 pci_ss_info_11c1_0442_13e0_0442 +static const pciSubsystemInfo pci_ss_info_11c1_0442_13fc_2471 = + {0x13fc, 0x2471, pci_subsys_11c1_0442_13fc_2471, 0}; +#undef pci_ss_info_13fc_2471 +#define pci_ss_info_13fc_2471 pci_ss_info_11c1_0442_13fc_2471 +static const pciSubsystemInfo pci_ss_info_11c1_0442_144d_2104 = + {0x144d, 0x2104, pci_subsys_11c1_0442_144d_2104, 0}; +#undef pci_ss_info_144d_2104 +#define pci_ss_info_144d_2104 pci_ss_info_11c1_0442_144d_2104 +static const pciSubsystemInfo pci_ss_info_11c1_0442_144f_1104 = + {0x144f, 0x1104, pci_subsys_11c1_0442_144f_1104, 0}; +#undef pci_ss_info_144f_1104 +#define pci_ss_info_144f_1104 pci_ss_info_11c1_0442_144f_1104 +static const pciSubsystemInfo pci_ss_info_11c1_0442_149f_0440 = + {0x149f, 0x0440, pci_subsys_11c1_0442_149f_0440, 0}; +#undef pci_ss_info_149f_0440 +#define pci_ss_info_149f_0440 pci_ss_info_11c1_0442_149f_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0442_1668_0440 = + {0x1668, 0x0440, pci_subsys_11c1_0442_1668_0440, 0}; +#undef pci_ss_info_1668_0440 +#define pci_ss_info_1668_0440 pci_ss_info_11c1_0442_1668_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0448_1014_0131 = + {0x1014, 0x0131, pci_subsys_11c1_0448_1014_0131, 0}; +#undef pci_ss_info_1014_0131 +#define pci_ss_info_1014_0131 pci_ss_info_11c1_0448_1014_0131 +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0448_1033_8066 = + {0x1033, 0x8066, pci_subsys_11c1_0448_1033_8066, 0}; +#undef pci_ss_info_1033_8066 +#define pci_ss_info_1033_8066 pci_ss_info_11c1_0448_1033_8066 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11c1_0448_13e0_0030 = + {0x13e0, 0x0030, pci_subsys_11c1_0448_13e0_0030, 0}; +#undef pci_ss_info_13e0_0030 +#define pci_ss_info_13e0_0030 pci_ss_info_11c1_0448_13e0_0030 +static const pciSubsystemInfo pci_ss_info_11c1_0448_13e0_0040 = + {0x13e0, 0x0040, pci_subsys_11c1_0448_13e0_0040, 0}; +#undef pci_ss_info_13e0_0040 +#define pci_ss_info_13e0_0040 pci_ss_info_11c1_0448_13e0_0040 +static const pciSubsystemInfo pci_ss_info_11c1_0448_1668_2400 = + {0x1668, 0x2400, pci_subsys_11c1_0448_1668_2400, 0}; +#undef pci_ss_info_1668_2400 +#define pci_ss_info_1668_2400 pci_ss_info_11c1_0448_1668_2400 +#endif +static const pciSubsystemInfo pci_ss_info_11c1_0449_0e11_b14d = + {0x0e11, 0xb14d, pci_subsys_11c1_0449_0e11_b14d, 0}; +#undef pci_ss_info_0e11_b14d +#define pci_ss_info_0e11_b14d pci_ss_info_11c1_0449_0e11_b14d +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11c1_0449_13e0_0020 = + {0x13e0, 0x0020, pci_subsys_11c1_0449_13e0_0020, 0}; +#undef pci_ss_info_13e0_0020 +#define pci_ss_info_13e0_0020 pci_ss_info_11c1_0449_13e0_0020 +static const pciSubsystemInfo pci_ss_info_11c1_0449_13e0_0041 = + {0x13e0, 0x0041, pci_subsys_11c1_0449_13e0_0041, 0}; +#undef pci_ss_info_13e0_0041 +#define pci_ss_info_13e0_0041 pci_ss_info_11c1_0449_13e0_0041 +static const pciSubsystemInfo pci_ss_info_11c1_0449_1436_0440 = + {0x1436, 0x0440, pci_subsys_11c1_0449_1436_0440, 0}; +#undef pci_ss_info_1436_0440 +#define pci_ss_info_1436_0440 pci_ss_info_11c1_0449_1436_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0449_144f_0449 = + {0x144f, 0x0449, pci_subsys_11c1_0449_144f_0449, 0}; +#undef pci_ss_info_144f_0449 +#define pci_ss_info_144f_0449 pci_ss_info_11c1_0449_144f_0449 +static const pciSubsystemInfo pci_ss_info_11c1_0449_1468_0410 = + {0x1468, 0x0410, pci_subsys_11c1_0449_1468_0410, 0}; +#undef pci_ss_info_1468_0410 +#define pci_ss_info_1468_0410 pci_ss_info_11c1_0449_1468_0410 +static const pciSubsystemInfo pci_ss_info_11c1_0449_1468_0440 = + {0x1468, 0x0440, pci_subsys_11c1_0449_1468_0440, 0}; +#undef pci_ss_info_1468_0440 +#define pci_ss_info_1468_0440 pci_ss_info_11c1_0449_1468_0440 +static const pciSubsystemInfo pci_ss_info_11c1_0449_1468_0449 = + {0x1468, 0x0449, pci_subsys_11c1_0449_1468_0449, 0}; +#undef pci_ss_info_1468_0449 +#define pci_ss_info_1468_0449 pci_ss_info_11c1_0449_1468_0449 +static const pciSubsystemInfo pci_ss_info_11c1_044a_10cf_1072 = + {0x10cf, 0x1072, pci_subsys_11c1_044a_10cf_1072, 0}; +#undef pci_ss_info_10cf_1072 +#define pci_ss_info_10cf_1072 pci_ss_info_11c1_044a_10cf_1072 +static const pciSubsystemInfo pci_ss_info_11c1_044a_13e0_0012 = + {0x13e0, 0x0012, pci_subsys_11c1_044a_13e0_0012, 0}; +#undef pci_ss_info_13e0_0012 +#define pci_ss_info_13e0_0012 pci_ss_info_11c1_044a_13e0_0012 +static const pciSubsystemInfo pci_ss_info_11c1_044a_13e0_0042 = + {0x13e0, 0x0042, pci_subsys_11c1_044a_13e0_0042, 0}; +#undef pci_ss_info_13e0_0042 +#define pci_ss_info_13e0_0042 pci_ss_info_11c1_044a_13e0_0042 +static const pciSubsystemInfo pci_ss_info_11c1_044a_144f_1005 = + {0x144f, 0x1005, pci_subsys_11c1_044a_144f_1005, 0}; +#undef pci_ss_info_144f_1005 +#define pci_ss_info_144f_1005 pci_ss_info_11c1_044a_144f_1005 +static const pciSubsystemInfo pci_ss_info_11c1_0450_144f_4005 = + {0x144f, 0x4005, pci_subsys_11c1_0450_144f_4005, 0}; +#undef pci_ss_info_144f_4005 +#define pci_ss_info_144f_4005 pci_ss_info_11c1_0450_144f_4005 +static const pciSubsystemInfo pci_ss_info_11c1_5811_dead_0800 = + {0xdead, 0x0800, pci_subsys_11c1_5811_dead_0800, 0}; +#undef pci_ss_info_dead_0800 +#define pci_ss_info_dead_0800 pci_ss_info_11c1_5811_dead_0800 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11cb_2000_11cb_0200 = + {0x11cb, 0x0200, pci_subsys_11cb_2000_11cb_0200, 0}; +#undef pci_ss_info_11cb_0200 +#define pci_ss_info_11cb_0200 pci_ss_info_11cb_2000_11cb_0200 +static const pciSubsystemInfo pci_ss_info_11cb_2000_11cb_b008 = + {0x11cb, 0xb008, pci_subsys_11cb_2000_11cb_b008, 0}; +#undef pci_ss_info_11cb_b008 +#define pci_ss_info_11cb_b008 pci_ss_info_11cb_2000_11cb_b008 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11de_6057_1031_7efe = + {0x1031, 0x7efe, pci_subsys_11de_6057_1031_7efe, 0}; +#undef pci_ss_info_1031_7efe +#define pci_ss_info_1031_7efe pci_ss_info_11de_6057_1031_7efe +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_11de_6057_1031_fc00 = + {0x1031, 0xfc00, pci_subsys_11de_6057_1031_fc00, 0}; +#undef pci_ss_info_1031_fc00 +#define pci_ss_info_1031_fc00 pci_ss_info_11de_6057_1031_fc00 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11de_6057_13ca_4231 = + {0x13ca, 0x4231, pci_subsys_11de_6057_13ca_4231, 0}; +#undef pci_ss_info_13ca_4231 +#define pci_ss_info_13ca_4231 pci_ss_info_11de_6057_13ca_4231 +static const pciSubsystemInfo pci_ss_info_11de_6120_1328_f001 = + {0x1328, 0xf001, pci_subsys_11de_6120_1328_f001, 0}; +#undef pci_ss_info_1328_f001 +#define pci_ss_info_1328_f001 pci_ss_info_11de_6120_1328_f001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_11f6_2011_11f6_2011 = + {0x11f6, 0x2011, pci_subsys_11f6_2011_11f6_2011, 0}; +#undef pci_ss_info_11f6_2011 +#define pci_ss_info_11f6_2011 pci_ss_info_11f6_2011_11f6_2011 +static const pciSubsystemInfo pci_ss_info_11f6_2201_11f6_2011 = + {0x11f6, 0x2011, pci_subsys_11f6_2201_11f6_2011, 0}; +#undef pci_ss_info_11f6_2011 +#define pci_ss_info_11f6_2011 pci_ss_info_11f6_2201_11f6_2011 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1202_4300_1202_9841 = + {0x1202, 0x9841, pci_subsys_1202_4300_1202_9841, 0}; +#undef pci_ss_info_1202_9841 +#define pci_ss_info_1202_9841 pci_ss_info_1202_4300_1202_9841 +static const pciSubsystemInfo pci_ss_info_1202_4300_1202_9842 = + {0x1202, 0x9842, pci_subsys_1202_4300_1202_9842, 0}; +#undef pci_ss_info_1202_9842 +#define pci_ss_info_1202_9842 pci_ss_info_1202_4300_1202_9842 +static const pciSubsystemInfo pci_ss_info_1202_4300_1202_9843 = + {0x1202, 0x9843, pci_subsys_1202_4300_1202_9843, 0}; +#undef pci_ss_info_1202_9843 +#define pci_ss_info_1202_9843 pci_ss_info_1202_4300_1202_9843 +static const pciSubsystemInfo pci_ss_info_1202_4300_1202_9844 = + {0x1202, 0x9844, pci_subsys_1202_4300_1202_9844, 0}; +#undef pci_ss_info_1202_9844 +#define pci_ss_info_1202_9844 pci_ss_info_1202_4300_1202_9844 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1217_6933_1025_1016 = + {0x1025, 0x1016, pci_subsys_1217_6933_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_1217_6933_1025_1016 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1217_6972_1179_0001 = + {0x1179, 0x0001, pci_subsys_1217_6972_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_1217_6972_1179_0001 +#endif +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_0003 = + {0x1092, 0x0003, pci_subsys_121a_0003_1092_0003, 0}; +#undef pci_ss_info_1092_0003 +#define pci_ss_info_1092_0003 pci_ss_info_121a_0003_1092_0003 +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_4000 = + {0x1092, 0x4000, pci_subsys_121a_0003_1092_4000, 0}; +#undef pci_ss_info_1092_4000 +#define pci_ss_info_1092_4000 pci_ss_info_121a_0003_1092_4000 +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_4002 = + {0x1092, 0x4002, pci_subsys_121a_0003_1092_4002, 0}; +#undef pci_ss_info_1092_4002 +#define pci_ss_info_1092_4002 pci_ss_info_121a_0003_1092_4002 +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_4801 = + {0x1092, 0x4801, pci_subsys_121a_0003_1092_4801, 0}; +#undef pci_ss_info_1092_4801 +#define pci_ss_info_1092_4801 pci_ss_info_121a_0003_1092_4801 +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_4803 = + {0x1092, 0x4803, pci_subsys_121a_0003_1092_4803, 0}; +#undef pci_ss_info_1092_4803 +#define pci_ss_info_1092_4803 pci_ss_info_121a_0003_1092_4803 +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_8030 = + {0x1092, 0x8030, pci_subsys_121a_0003_1092_8030, 0}; +#undef pci_ss_info_1092_8030 +#define pci_ss_info_1092_8030 pci_ss_info_121a_0003_1092_8030 +static const pciSubsystemInfo pci_ss_info_121a_0003_1092_8035 = + {0x1092, 0x8035, pci_subsys_121a_0003_1092_8035, 0}; +#undef pci_ss_info_1092_8035 +#define pci_ss_info_1092_8035 pci_ss_info_121a_0003_1092_8035 +static const pciSubsystemInfo pci_ss_info_121a_0003_10b0_0001 = + {0x10b0, 0x0001, pci_subsys_121a_0003_10b0_0001, 0}; +#undef pci_ss_info_10b0_0001 +#define pci_ss_info_10b0_0001 pci_ss_info_121a_0003_10b0_0001 +static const pciSubsystemInfo pci_ss_info_121a_0003_1102_1018 = + {0x1102, 0x1018, pci_subsys_121a_0003_1102_1018, 0}; +#undef pci_ss_info_1102_1018 +#define pci_ss_info_1102_1018 pci_ss_info_121a_0003_1102_1018 +static const pciSubsystemInfo pci_ss_info_121a_0003_121a_0001 = + {0x121a, 0x0001, pci_subsys_121a_0003_121a_0001, 0}; +#undef pci_ss_info_121a_0001 +#define pci_ss_info_121a_0001 pci_ss_info_121a_0003_121a_0001 +static const pciSubsystemInfo pci_ss_info_121a_0003_121a_0003 = + {0x121a, 0x0003, pci_subsys_121a_0003_121a_0003, 0}; +#undef pci_ss_info_121a_0003 +#define pci_ss_info_121a_0003 pci_ss_info_121a_0003_121a_0003 +static const pciSubsystemInfo pci_ss_info_121a_0003_121a_0004 = + {0x121a, 0x0004, pci_subsys_121a_0003_121a_0004, 0}; +#undef pci_ss_info_121a_0004 +#define pci_ss_info_121a_0004 pci_ss_info_121a_0003_121a_0004 +static const pciSubsystemInfo pci_ss_info_121a_0003_139c_0016 = + {0x139c, 0x0016, pci_subsys_121a_0003_139c_0016, 0}; +#undef pci_ss_info_139c_0016 +#define pci_ss_info_139c_0016 pci_ss_info_121a_0003_139c_0016 +static const pciSubsystemInfo pci_ss_info_121a_0003_139c_0017 = + {0x139c, 0x0017, pci_subsys_121a_0003_139c_0017, 0}; +#undef pci_ss_info_139c_0017 +#define pci_ss_info_139c_0017 pci_ss_info_121a_0003_139c_0017 +static const pciSubsystemInfo pci_ss_info_121a_0003_14af_0002 = + {0x14af, 0x0002, pci_subsys_121a_0003_14af_0002, 0}; +#undef pci_ss_info_14af_0002 +#define pci_ss_info_14af_0002 pci_ss_info_121a_0003_14af_0002 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0004 = + {0x121a, 0x0004, pci_subsys_121a_0005_121a_0004, 0}; +#undef pci_ss_info_121a_0004 +#define pci_ss_info_121a_0004 pci_ss_info_121a_0005_121a_0004 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0030 = + {0x121a, 0x0030, pci_subsys_121a_0005_121a_0030, 0}; +#undef pci_ss_info_121a_0030 +#define pci_ss_info_121a_0030 pci_ss_info_121a_0005_121a_0030 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0031 = + {0x121a, 0x0031, pci_subsys_121a_0005_121a_0031, 0}; +#undef pci_ss_info_121a_0031 +#define pci_ss_info_121a_0031 pci_ss_info_121a_0005_121a_0031 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0034 = + {0x121a, 0x0034, pci_subsys_121a_0005_121a_0034, 0}; +#undef pci_ss_info_121a_0034 +#define pci_ss_info_121a_0034 pci_ss_info_121a_0005_121a_0034 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0036 = + {0x121a, 0x0036, pci_subsys_121a_0005_121a_0036, 0}; +#undef pci_ss_info_121a_0036 +#define pci_ss_info_121a_0036 pci_ss_info_121a_0005_121a_0036 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0037 = + {0x121a, 0x0037, pci_subsys_121a_0005_121a_0037, 0}; +#undef pci_ss_info_121a_0037 +#define pci_ss_info_121a_0037 pci_ss_info_121a_0005_121a_0037 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0038 = + {0x121a, 0x0038, pci_subsys_121a_0005_121a_0038, 0}; +#undef pci_ss_info_121a_0038 +#define pci_ss_info_121a_0038 pci_ss_info_121a_0005_121a_0038 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_003a = + {0x121a, 0x003a, pci_subsys_121a_0005_121a_003a, 0}; +#undef pci_ss_info_121a_003a +#define pci_ss_info_121a_003a pci_ss_info_121a_0005_121a_003a +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0044 = + {0x121a, 0x0044, pci_subsys_121a_0005_121a_0044, 0}; +#undef pci_ss_info_121a_0044 +#define pci_ss_info_121a_0044 pci_ss_info_121a_0005_121a_0044 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_004b = + {0x121a, 0x004b, pci_subsys_121a_0005_121a_004b, 0}; +#undef pci_ss_info_121a_004b +#define pci_ss_info_121a_004b pci_ss_info_121a_0005_121a_004b +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_004c = + {0x121a, 0x004c, pci_subsys_121a_0005_121a_004c, 0}; +#undef pci_ss_info_121a_004c +#define pci_ss_info_121a_004c pci_ss_info_121a_0005_121a_004c +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_004d = + {0x121a, 0x004d, pci_subsys_121a_0005_121a_004d, 0}; +#undef pci_ss_info_121a_004d +#define pci_ss_info_121a_004d pci_ss_info_121a_0005_121a_004d +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_004e = + {0x121a, 0x004e, pci_subsys_121a_0005_121a_004e, 0}; +#undef pci_ss_info_121a_004e +#define pci_ss_info_121a_004e pci_ss_info_121a_0005_121a_004e +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0051 = + {0x121a, 0x0051, pci_subsys_121a_0005_121a_0051, 0}; +#undef pci_ss_info_121a_0051 +#define pci_ss_info_121a_0051 pci_ss_info_121a_0005_121a_0051 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0052 = + {0x121a, 0x0052, pci_subsys_121a_0005_121a_0052, 0}; +#undef pci_ss_info_121a_0052 +#define pci_ss_info_121a_0052 pci_ss_info_121a_0005_121a_0052 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0060 = + {0x121a, 0x0060, pci_subsys_121a_0005_121a_0060, 0}; +#undef pci_ss_info_121a_0060 +#define pci_ss_info_121a_0060 pci_ss_info_121a_0005_121a_0060 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0061 = + {0x121a, 0x0061, pci_subsys_121a_0005_121a_0061, 0}; +#undef pci_ss_info_121a_0061 +#define pci_ss_info_121a_0061 pci_ss_info_121a_0005_121a_0061 +static const pciSubsystemInfo pci_ss_info_121a_0005_121a_0062 = + {0x121a, 0x0062, pci_subsys_121a_0005_121a_0062, 0}; +#undef pci_ss_info_121a_0062 +#define pci_ss_info_121a_0062 pci_ss_info_121a_0005_121a_0062 +static const pciSubsystemInfo pci_ss_info_121a_0009_121a_0009 = + {0x121a, 0x0009, pci_subsys_121a_0009_121a_0009, 0}; +#undef pci_ss_info_121a_0009 +#define pci_ss_info_121a_0009 pci_ss_info_121a_0009_121a_0009 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_122d_50dc_122d_0001 = + {0x122d, 0x0001, pci_subsys_122d_50dc_122d_0001, 0}; +#undef pci_ss_info_122d_0001 +#define pci_ss_info_122d_0001 pci_ss_info_122d_50dc_122d_0001 +static const pciSubsystemInfo pci_ss_info_122d_80da_122d_0001 = + {0x122d, 0x0001, pci_subsys_122d_80da_122d_0001, 0}; +#undef pci_ss_info_122d_0001 +#define pci_ss_info_122d_0001 pci_ss_info_122d_80da_122d_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_123f_8120_11bd_0006 = + {0x11bd, 0x0006, pci_subsys_123f_8120_11bd_0006, 0}; +#undef pci_ss_info_11bd_0006 +#define pci_ss_info_11bd_0006 pci_ss_info_123f_8120_11bd_0006 +static const pciSubsystemInfo pci_ss_info_123f_8120_11bd_000a = + {0x11bd, 0x000a, pci_subsys_123f_8120_11bd_000a, 0}; +#undef pci_ss_info_11bd_000a +#define pci_ss_info_11bd_000a pci_ss_info_123f_8120_11bd_000a +#endif +static const pciSubsystemInfo pci_ss_info_123f_8888_1002_0001 = + {0x1002, 0x0001, pci_subsys_123f_8888_1002_0001, 0}; +#undef pci_ss_info_1002_0001 +#define pci_ss_info_1002_0001 pci_ss_info_123f_8888_1002_0001 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_123f_8888_1002_0002 = + {0x1002, 0x0002, pci_subsys_123f_8888_1002_0002, 0}; +#undef pci_ss_info_1002_0002 +#define pci_ss_info_1002_0002 pci_ss_info_123f_8888_1002_0002 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_123f_8888_1328_0001 = + {0x1328, 0x0001, pci_subsys_123f_8888_1328_0001, 0}; +#undef pci_ss_info_1328_0001 +#define pci_ss_info_1328_0001 pci_ss_info_123f_8888_1328_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1242_1560_1242_6562 = + {0x1242, 0x6562, pci_subsys_1242_1560_1242_6562, 0}; +#undef pci_ss_info_1242_6562 +#define pci_ss_info_1242_6562 pci_ss_info_1242_1560_1242_6562 +static const pciSubsystemInfo pci_ss_info_1242_1560_1242_656a = + {0x1242, 0x656a, pci_subsys_1242_1560_1242_656a, 0}; +#undef pci_ss_info_1242_656a +#define pci_ss_info_1242_656a pci_ss_info_1242_1560_1242_656a +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1244_0a00_1244_0a00 = + {0x1244, 0x0a00, pci_subsys_1244_0a00_1244_0a00, 0}; +#undef pci_ss_info_1244_0a00 +#define pci_ss_info_1244_0a00 pci_ss_info_1244_0a00_1244_0a00 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_124b_0040_124b_9080 = + {0x124b, 0x9080, pci_subsys_124b_0040_124b_9080, 0}; +#undef pci_ss_info_124b_9080 +#define pci_ss_info_124b_9080 pci_ss_info_124b_0040_124b_9080 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_125d_1968_1028_0085 = + {0x1028, 0x0085, pci_subsys_125d_1968_1028_0085, 0}; +#undef pci_ss_info_1028_0085 +#define pci_ss_info_1028_0085 pci_ss_info_125d_1968_1028_0085 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_125d_1968_1033_8051 = + {0x1033, 0x8051, pci_subsys_125d_1968_1033_8051, 0}; +#undef pci_ss_info_1033_8051 +#define pci_ss_info_1033_8051 pci_ss_info_125d_1968_1033_8051 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_125d_1969_1014_0166 = + {0x1014, 0x0166, pci_subsys_125d_1969_1014_0166, 0}; +#undef pci_ss_info_1014_0166 +#define pci_ss_info_1014_0166 pci_ss_info_125d_1969_1014_0166 +static const pciSubsystemInfo pci_ss_info_125d_1969_125d_8888 = + {0x125d, 0x8888, pci_subsys_125d_1969_125d_8888, 0}; +#undef pci_ss_info_125d_8888 +#define pci_ss_info_125d_8888 pci_ss_info_125d_1969_125d_8888 +#endif +static const pciSubsystemInfo pci_ss_info_125d_1978_0e11_b112 = + {0x0e11, 0xb112, pci_subsys_125d_1978_0e11_b112, 0}; +#undef pci_ss_info_0e11_b112 +#define pci_ss_info_0e11_b112 pci_ss_info_125d_1978_0e11_b112 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_125d_1978_1033_803c = + {0x1033, 0x803c, pci_subsys_125d_1978_1033_803c, 0}; +#undef pci_ss_info_1033_803c +#define pci_ss_info_1033_803c pci_ss_info_125d_1978_1033_803c +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_125d_1978_1033_8058 = + {0x1033, 0x8058, pci_subsys_125d_1978_1033_8058, 0}; +#undef pci_ss_info_1033_8058 +#define pci_ss_info_1033_8058 pci_ss_info_125d_1978_1033_8058 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_125d_1978_1092_4000 = + {0x1092, 0x4000, pci_subsys_125d_1978_1092_4000, 0}; +#undef pci_ss_info_1092_4000 +#define pci_ss_info_1092_4000 pci_ss_info_125d_1978_1092_4000 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_125d_1978_1179_0001 = + {0x1179, 0x0001, pci_subsys_125d_1978_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_125d_1978_1179_0001 +#endif +static const pciSubsystemInfo pci_ss_info_125d_1988_1092_4100 = + {0x1092, 0x4100, pci_subsys_125d_1988_1092_4100, 0}; +#undef pci_ss_info_1092_4100 +#define pci_ss_info_1092_4100 pci_ss_info_125d_1988_1092_4100 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_125d_1988_125d_1988 = + {0x125d, 0x1988, pci_subsys_125d_1988_125d_1988, 0}; +#undef pci_ss_info_125d_1988 +#define pci_ss_info_125d_1988 pci_ss_info_125d_1988_125d_1988 +static const pciSubsystemInfo pci_ss_info_125d_1989_125d_1989 = + {0x125d, 0x1989, pci_subsys_125d_1989_125d_1989, 0}; +#undef pci_ss_info_125d_1989 +#define pci_ss_info_125d_1989 pci_ss_info_125d_1989_125d_1989 +#endif +static const pciSubsystemInfo pci_ss_info_125d_1998_1028_00e6 = + {0x1028, 0x00e6, pci_subsys_125d_1998_1028_00e6, 0}; +#undef pci_ss_info_1028_00e6 +#define pci_ss_info_1028_00e6 pci_ss_info_125d_1998_1028_00e6 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_125d_2898_125d_0424 = + {0x125d, 0x0424, pci_subsys_125d_2898_125d_0424, 0}; +#undef pci_ss_info_125d_0424 +#define pci_ss_info_125d_0424 pci_ss_info_125d_2898_125d_0424 +static const pciSubsystemInfo pci_ss_info_125d_2898_125d_0425 = + {0x125d, 0x0425, pci_subsys_125d_2898_125d_0425, 0}; +#undef pci_ss_info_125d_0425 +#define pci_ss_info_125d_0425 pci_ss_info_125d_2898_125d_0425 +static const pciSubsystemInfo pci_ss_info_125d_2898_125d_0426 = + {0x125d, 0x0426, pci_subsys_125d_2898_125d_0426, 0}; +#undef pci_ss_info_125d_0426 +#define pci_ss_info_125d_0426 pci_ss_info_125d_2898_125d_0426 +static const pciSubsystemInfo pci_ss_info_125d_2898_125d_0427 = + {0x125d, 0x0427, pci_subsys_125d_2898_125d_0427, 0}; +#undef pci_ss_info_125d_0427 +#define pci_ss_info_125d_0427 pci_ss_info_125d_2898_125d_0427 +static const pciSubsystemInfo pci_ss_info_125d_2898_125d_0428 = + {0x125d, 0x0428, pci_subsys_125d_2898_125d_0428, 0}; +#undef pci_ss_info_125d_0428 +#define pci_ss_info_125d_0428 pci_ss_info_125d_2898_125d_0428 +static const pciSubsystemInfo pci_ss_info_125d_2898_125d_0429 = + {0x125d, 0x0429, pci_subsys_125d_2898_125d_0429, 0}; +#undef pci_ss_info_125d_0429 +#define pci_ss_info_125d_0429 pci_ss_info_125d_2898_125d_0429 +static const pciSubsystemInfo pci_ss_info_125d_2898_147a_c001 = + {0x147a, 0xc001, pci_subsys_125d_2898_147a_c001, 0}; +#undef pci_ss_info_147a_c001 +#define pci_ss_info_147a_c001 pci_ss_info_125d_2898_147a_c001 +static const pciSubsystemInfo pci_ss_info_125d_2898_14fe_0428 = + {0x14fe, 0x0428, pci_subsys_125d_2898_14fe_0428, 0}; +#undef pci_ss_info_14fe_0428 +#define pci_ss_info_14fe_0428 pci_ss_info_125d_2898_14fe_0428 +static const pciSubsystemInfo pci_ss_info_125d_2898_14fe_0429 = + {0x14fe, 0x0429, pci_subsys_125d_2898_14fe_0429, 0}; +#undef pci_ss_info_14fe_0429 +#define pci_ss_info_14fe_0429 pci_ss_info_125d_2898_14fe_0429 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1260_3873_1186_3501 = + {0x1186, 0x3501, pci_subsys_1260_3873_1186_3501, 0}; +#undef pci_ss_info_1186_3501 +#define pci_ss_info_1186_3501 pci_ss_info_1260_3873_1186_3501 +static const pciSubsystemInfo pci_ss_info_1260_3873_1668_0414 = + {0x1668, 0x0414, pci_subsys_1260_3873_1668_0414, 0}; +#undef pci_ss_info_1668_0414 +#define pci_ss_info_1668_0414 pci_ss_info_1260_3873_1668_0414 +static const pciSubsystemInfo pci_ss_info_1260_3873_1737_3874 = + {0x1737, 0x3874, pci_subsys_1260_3873_1737_3874, 0}; +#undef pci_ss_info_1737_3874 +#define pci_ss_info_1737_3874 pci_ss_info_1260_3873_1737_3874 +#endif +static const pciSubsystemInfo pci_ss_info_1260_3873_8086_2513 = + {0x8086, 0x2513, pci_subsys_1260_3873_8086_2513, 0}; +#undef pci_ss_info_8086_2513 +#define pci_ss_info_8086_2513 pci_ss_info_1260_3873_8086_2513 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1266_1910_1266_1910 = + {0x1266, 0x1910, pci_subsys_1266_1910_1266_1910, 0}; +#undef pci_ss_info_1266_1910 +#define pci_ss_info_1266_1910 pci_ss_info_1266_1910_1266_1910 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_0e11_0024 = + {0x0e11, 0x0024, pci_subsys_1274_1371_0e11_0024, 0}; +#undef pci_ss_info_0e11_0024 +#define pci_ss_info_0e11_0024 pci_ss_info_1274_1371_0e11_0024 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_0e11_b1a7 = + {0x0e11, 0xb1a7, pci_subsys_1274_1371_0e11_b1a7, 0}; +#undef pci_ss_info_0e11_b1a7 +#define pci_ss_info_0e11_b1a7 pci_ss_info_1274_1371_0e11_b1a7 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_1033_80ac = + {0x1033, 0x80ac, pci_subsys_1274_1371_1033_80ac, 0}; +#undef pci_ss_info_1033_80ac +#define pci_ss_info_1033_80ac pci_ss_info_1274_1371_1033_80ac +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1274_1371_1042_1854 = + {0x1042, 0x1854, pci_subsys_1274_1371_1042_1854, 0}; +#undef pci_ss_info_1042_1854 +#define pci_ss_info_1042_1854 pci_ss_info_1274_1371_1042_1854 +static const pciSubsystemInfo pci_ss_info_1274_1371_107b_8054 = + {0x107b, 0x8054, pci_subsys_1274_1371_107b_8054, 0}; +#undef pci_ss_info_107b_8054 +#define pci_ss_info_107b_8054 pci_ss_info_1274_1371_107b_8054 +static const pciSubsystemInfo pci_ss_info_1274_1371_1274_1371 = + {0x1274, 0x1371, pci_subsys_1274_1371_1274_1371, 0}; +#undef pci_ss_info_1274_1371 +#define pci_ss_info_1274_1371 pci_ss_info_1274_1371_1274_1371 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6470 = + {0x1462, 0x6470, pci_subsys_1274_1371_1462_6470, 0}; +#undef pci_ss_info_1462_6470 +#define pci_ss_info_1462_6470 pci_ss_info_1274_1371_1462_6470 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6560 = + {0x1462, 0x6560, pci_subsys_1274_1371_1462_6560, 0}; +#undef pci_ss_info_1462_6560 +#define pci_ss_info_1462_6560 pci_ss_info_1274_1371_1462_6560 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6630 = + {0x1462, 0x6630, pci_subsys_1274_1371_1462_6630, 0}; +#undef pci_ss_info_1462_6630 +#define pci_ss_info_1462_6630 pci_ss_info_1274_1371_1462_6630 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6631 = + {0x1462, 0x6631, pci_subsys_1274_1371_1462_6631, 0}; +#undef pci_ss_info_1462_6631 +#define pci_ss_info_1462_6631 pci_ss_info_1274_1371_1462_6631 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6632 = + {0x1462, 0x6632, pci_subsys_1274_1371_1462_6632, 0}; +#undef pci_ss_info_1462_6632 +#define pci_ss_info_1462_6632 pci_ss_info_1274_1371_1462_6632 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6633 = + {0x1462, 0x6633, pci_subsys_1274_1371_1462_6633, 0}; +#undef pci_ss_info_1462_6633 +#define pci_ss_info_1462_6633 pci_ss_info_1274_1371_1462_6633 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6820 = + {0x1462, 0x6820, pci_subsys_1274_1371_1462_6820, 0}; +#undef pci_ss_info_1462_6820 +#define pci_ss_info_1462_6820 pci_ss_info_1274_1371_1462_6820 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6822 = + {0x1462, 0x6822, pci_subsys_1274_1371_1462_6822, 0}; +#undef pci_ss_info_1462_6822 +#define pci_ss_info_1462_6822 pci_ss_info_1274_1371_1462_6822 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6830 = + {0x1462, 0x6830, pci_subsys_1274_1371_1462_6830, 0}; +#undef pci_ss_info_1462_6830 +#define pci_ss_info_1462_6830 pci_ss_info_1274_1371_1462_6830 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6880 = + {0x1462, 0x6880, pci_subsys_1274_1371_1462_6880, 0}; +#undef pci_ss_info_1462_6880 +#define pci_ss_info_1462_6880 pci_ss_info_1274_1371_1462_6880 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6900 = + {0x1462, 0x6900, pci_subsys_1274_1371_1462_6900, 0}; +#undef pci_ss_info_1462_6900 +#define pci_ss_info_1462_6900 pci_ss_info_1274_1371_1462_6900 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6910 = + {0x1462, 0x6910, pci_subsys_1274_1371_1462_6910, 0}; +#undef pci_ss_info_1462_6910 +#define pci_ss_info_1462_6910 pci_ss_info_1274_1371_1462_6910 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6930 = + {0x1462, 0x6930, pci_subsys_1274_1371_1462_6930, 0}; +#undef pci_ss_info_1462_6930 +#define pci_ss_info_1462_6930 pci_ss_info_1274_1371_1462_6930 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6990 = + {0x1462, 0x6990, pci_subsys_1274_1371_1462_6990, 0}; +#undef pci_ss_info_1462_6990 +#define pci_ss_info_1462_6990 pci_ss_info_1274_1371_1462_6990 +static const pciSubsystemInfo pci_ss_info_1274_1371_1462_6991 = + {0x1462, 0x6991, pci_subsys_1274_1371_1462_6991, 0}; +#undef pci_ss_info_1462_6991 +#define pci_ss_info_1462_6991 pci_ss_info_1274_1371_1462_6991 +static const pciSubsystemInfo pci_ss_info_1274_1371_14a4_2077 = + {0x14a4, 0x2077, pci_subsys_1274_1371_14a4_2077, 0}; +#undef pci_ss_info_14a4_2077 +#define pci_ss_info_14a4_2077 pci_ss_info_1274_1371_14a4_2077 +static const pciSubsystemInfo pci_ss_info_1274_1371_14a4_2105 = + {0x14a4, 0x2105, pci_subsys_1274_1371_14a4_2105, 0}; +#undef pci_ss_info_14a4_2105 +#define pci_ss_info_14a4_2105 pci_ss_info_1274_1371_14a4_2105 +static const pciSubsystemInfo pci_ss_info_1274_1371_14a4_2107 = + {0x14a4, 0x2107, pci_subsys_1274_1371_14a4_2107, 0}; +#undef pci_ss_info_14a4_2107 +#define pci_ss_info_14a4_2107 pci_ss_info_1274_1371_14a4_2107 +static const pciSubsystemInfo pci_ss_info_1274_1371_14a4_2172 = + {0x14a4, 0x2172, pci_subsys_1274_1371_14a4_2172, 0}; +#undef pci_ss_info_14a4_2172 +#define pci_ss_info_14a4_2172 pci_ss_info_1274_1371_14a4_2172 +static const pciSubsystemInfo pci_ss_info_1274_1371_1509_9902 = + {0x1509, 0x9902, pci_subsys_1274_1371_1509_9902, 0}; +#undef pci_ss_info_1509_9902 +#define pci_ss_info_1509_9902 pci_ss_info_1274_1371_1509_9902 +static const pciSubsystemInfo pci_ss_info_1274_1371_1509_9903 = + {0x1509, 0x9903, pci_subsys_1274_1371_1509_9903, 0}; +#undef pci_ss_info_1509_9903 +#define pci_ss_info_1509_9903 pci_ss_info_1274_1371_1509_9903 +static const pciSubsystemInfo pci_ss_info_1274_1371_1509_9904 = + {0x1509, 0x9904, pci_subsys_1274_1371_1509_9904, 0}; +#undef pci_ss_info_1509_9904 +#define pci_ss_info_1509_9904 pci_ss_info_1274_1371_1509_9904 +static const pciSubsystemInfo pci_ss_info_1274_1371_1509_9905 = + {0x1509, 0x9905, pci_subsys_1274_1371_1509_9905, 0}; +#undef pci_ss_info_1509_9905 +#define pci_ss_info_1509_9905 pci_ss_info_1274_1371_1509_9905 +static const pciSubsystemInfo pci_ss_info_1274_1371_152d_8801 = + {0x152d, 0x8801, pci_subsys_1274_1371_152d_8801, 0}; +#undef pci_ss_info_152d_8801 +#define pci_ss_info_152d_8801 pci_ss_info_1274_1371_152d_8801 +static const pciSubsystemInfo pci_ss_info_1274_1371_152d_8802 = + {0x152d, 0x8802, pci_subsys_1274_1371_152d_8802, 0}; +#undef pci_ss_info_152d_8802 +#define pci_ss_info_152d_8802 pci_ss_info_1274_1371_152d_8802 +static const pciSubsystemInfo pci_ss_info_1274_1371_152d_8803 = + {0x152d, 0x8803, pci_subsys_1274_1371_152d_8803, 0}; +#undef pci_ss_info_152d_8803 +#define pci_ss_info_152d_8803 pci_ss_info_1274_1371_152d_8803 +static const pciSubsystemInfo pci_ss_info_1274_1371_152d_8804 = + {0x152d, 0x8804, pci_subsys_1274_1371_152d_8804, 0}; +#undef pci_ss_info_152d_8804 +#define pci_ss_info_152d_8804 pci_ss_info_1274_1371_152d_8804 +static const pciSubsystemInfo pci_ss_info_1274_1371_152d_8805 = + {0x152d, 0x8805, pci_subsys_1274_1371_152d_8805, 0}; +#undef pci_ss_info_152d_8805 +#define pci_ss_info_152d_8805 pci_ss_info_1274_1371_152d_8805 +static const pciSubsystemInfo pci_ss_info_1274_1371_270f_2001 = + {0x270f, 0x2001, pci_subsys_1274_1371_270f_2001, 0}; +#undef pci_ss_info_270f_2001 +#define pci_ss_info_270f_2001 pci_ss_info_1274_1371_270f_2001 +static const pciSubsystemInfo pci_ss_info_1274_1371_270f_2200 = + {0x270f, 0x2200, pci_subsys_1274_1371_270f_2200, 0}; +#undef pci_ss_info_270f_2200 +#define pci_ss_info_270f_2200 pci_ss_info_1274_1371_270f_2200 +static const pciSubsystemInfo pci_ss_info_1274_1371_270f_3000 = + {0x270f, 0x3000, pci_subsys_1274_1371_270f_3000, 0}; +#undef pci_ss_info_270f_3000 +#define pci_ss_info_270f_3000 pci_ss_info_1274_1371_270f_3000 +static const pciSubsystemInfo pci_ss_info_1274_1371_270f_3100 = + {0x270f, 0x3100, pci_subsys_1274_1371_270f_3100, 0}; +#undef pci_ss_info_270f_3100 +#define pci_ss_info_270f_3100 pci_ss_info_1274_1371_270f_3100 +static const pciSubsystemInfo pci_ss_info_1274_1371_270f_3102 = + {0x270f, 0x3102, pci_subsys_1274_1371_270f_3102, 0}; +#undef pci_ss_info_270f_3102 +#define pci_ss_info_270f_3102 pci_ss_info_1274_1371_270f_3102 +static const pciSubsystemInfo pci_ss_info_1274_1371_270f_7060 = + {0x270f, 0x7060, pci_subsys_1274_1371_270f_7060, 0}; +#undef pci_ss_info_270f_7060 +#define pci_ss_info_270f_7060 pci_ss_info_1274_1371_270f_7060 +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_4249 = + {0x8086, 0x4249, pci_subsys_1274_1371_8086_4249, 0}; +#undef pci_ss_info_8086_4249 +#define pci_ss_info_8086_4249 pci_ss_info_1274_1371_8086_4249 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_424c = + {0x8086, 0x424c, pci_subsys_1274_1371_8086_424c, 0}; +#undef pci_ss_info_8086_424c +#define pci_ss_info_8086_424c pci_ss_info_1274_1371_8086_424c +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_425a = + {0x8086, 0x425a, pci_subsys_1274_1371_8086_425a, 0}; +#undef pci_ss_info_8086_425a +#define pci_ss_info_8086_425a pci_ss_info_1274_1371_8086_425a +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_4341 = + {0x8086, 0x4341, pci_subsys_1274_1371_8086_4341, 0}; +#undef pci_ss_info_8086_4341 +#define pci_ss_info_8086_4341 pci_ss_info_1274_1371_8086_4341 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_4343 = + {0x8086, 0x4343, pci_subsys_1274_1371_8086_4343, 0}; +#undef pci_ss_info_8086_4343 +#define pci_ss_info_8086_4343 pci_ss_info_1274_1371_8086_4343 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_4649 = + {0x8086, 0x4649, pci_subsys_1274_1371_8086_4649, 0}; +#undef pci_ss_info_8086_4649 +#define pci_ss_info_8086_4649 pci_ss_info_1274_1371_8086_4649 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_464a = + {0x8086, 0x464a, pci_subsys_1274_1371_8086_464a, 0}; +#undef pci_ss_info_8086_464a +#define pci_ss_info_8086_464a pci_ss_info_1274_1371_8086_464a +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_4d4f = + {0x8086, 0x4d4f, pci_subsys_1274_1371_8086_4d4f, 0}; +#undef pci_ss_info_8086_4d4f +#define pci_ss_info_8086_4d4f pci_ss_info_1274_1371_8086_4d4f +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_4f43 = + {0x8086, 0x4f43, pci_subsys_1274_1371_8086_4f43, 0}; +#undef pci_ss_info_8086_4f43 +#define pci_ss_info_8086_4f43 pci_ss_info_1274_1371_8086_4f43 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_5243 = + {0x8086, 0x5243, pci_subsys_1274_1371_8086_5243, 0}; +#undef pci_ss_info_8086_5243 +#define pci_ss_info_8086_5243 pci_ss_info_1274_1371_8086_5243 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_5352 = + {0x8086, 0x5352, pci_subsys_1274_1371_8086_5352, 0}; +#undef pci_ss_info_8086_5352 +#define pci_ss_info_8086_5352 pci_ss_info_1274_1371_8086_5352 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_5643 = + {0x8086, 0x5643, pci_subsys_1274_1371_8086_5643, 0}; +#undef pci_ss_info_8086_5643 +#define pci_ss_info_8086_5643 pci_ss_info_1274_1371_8086_5643 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_1274_1371_8086_5753 = + {0x8086, 0x5753, pci_subsys_1274_1371_8086_5753, 0}; +#undef pci_ss_info_8086_5753 +#define pci_ss_info_8086_5753 pci_ss_info_1274_1371_8086_5753 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1274_5880_1274_2000 = + {0x1274, 0x2000, pci_subsys_1274_5880_1274_2000, 0}; +#undef pci_ss_info_1274_2000 +#define pci_ss_info_1274_2000 pci_ss_info_1274_5880_1274_2000 +static const pciSubsystemInfo pci_ss_info_1274_5880_1274_2003 = + {0x1274, 0x2003, pci_subsys_1274_5880_1274_2003, 0}; +#undef pci_ss_info_1274_2003 +#define pci_ss_info_1274_2003 pci_ss_info_1274_5880_1274_2003 +static const pciSubsystemInfo pci_ss_info_1274_5880_1274_5880 = + {0x1274, 0x5880, pci_subsys_1274_5880_1274_5880, 0}; +#undef pci_ss_info_1274_5880 +#define pci_ss_info_1274_5880 pci_ss_info_1274_5880_1274_5880 +static const pciSubsystemInfo pci_ss_info_1274_5880_1458_a000 = + {0x1458, 0xa000, pci_subsys_1274_5880_1458_a000, 0}; +#undef pci_ss_info_1458_a000 +#define pci_ss_info_1458_a000 pci_ss_info_1274_5880_1458_a000 +static const pciSubsystemInfo pci_ss_info_1274_5880_1462_6880 = + {0x1462, 0x6880, pci_subsys_1274_5880_1462_6880, 0}; +#undef pci_ss_info_1462_6880 +#define pci_ss_info_1462_6880 pci_ss_info_1274_5880_1462_6880 +static const pciSubsystemInfo pci_ss_info_1274_5880_270f_2001 = + {0x270f, 0x2001, pci_subsys_1274_5880_270f_2001, 0}; +#undef pci_ss_info_270f_2001 +#define pci_ss_info_270f_2001 pci_ss_info_1274_5880_270f_2001 +static const pciSubsystemInfo pci_ss_info_1274_5880_270f_2200 = + {0x270f, 0x2200, pci_subsys_1274_5880_270f_2200, 0}; +#undef pci_ss_info_270f_2200 +#define pci_ss_info_270f_2200 pci_ss_info_1274_5880_270f_2200 +static const pciSubsystemInfo pci_ss_info_1274_5880_270f_7040 = + {0x270f, 0x7040, pci_subsys_1274_5880_270f_7040, 0}; +#undef pci_ss_info_270f_7040 +#define pci_ss_info_270f_7040 pci_ss_info_1274_5880_270f_7040 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_1002_1092_094c = + {0x1092, 0x094c, pci_subsys_127a_1002_1092_094c, 0}; +#undef pci_ss_info_1092_094c +#define pci_ss_info_1092_094c pci_ss_info_127a_1002_1092_094c +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_127a_1002_122d_4002 = + {0x122d, 0x4002, pci_subsys_127a_1002_122d_4002, 0}; +#undef pci_ss_info_122d_4002 +#define pci_ss_info_122d_4002 pci_ss_info_127a_1002_122d_4002 +static const pciSubsystemInfo pci_ss_info_127a_1002_122d_4005 = + {0x122d, 0x4005, pci_subsys_127a_1002_122d_4005, 0}; +#undef pci_ss_info_122d_4005 +#define pci_ss_info_122d_4005 pci_ss_info_127a_1002_122d_4005 +static const pciSubsystemInfo pci_ss_info_127a_1002_122d_4007 = + {0x122d, 0x4007, pci_subsys_127a_1002_122d_4007, 0}; +#undef pci_ss_info_122d_4007 +#define pci_ss_info_122d_4007 pci_ss_info_127a_1002_122d_4007 +static const pciSubsystemInfo pci_ss_info_127a_1002_122d_4012 = + {0x122d, 0x4012, pci_subsys_127a_1002_122d_4012, 0}; +#undef pci_ss_info_122d_4012 +#define pci_ss_info_122d_4012 pci_ss_info_127a_1002_122d_4012 +static const pciSubsystemInfo pci_ss_info_127a_1002_122d_4017 = + {0x122d, 0x4017, pci_subsys_127a_1002_122d_4017, 0}; +#undef pci_ss_info_122d_4017 +#define pci_ss_info_122d_4017 pci_ss_info_127a_1002_122d_4017 +static const pciSubsystemInfo pci_ss_info_127a_1002_122d_4018 = + {0x122d, 0x4018, pci_subsys_127a_1002_122d_4018, 0}; +#undef pci_ss_info_122d_4018 +#define pci_ss_info_122d_4018 pci_ss_info_127a_1002_122d_4018 +static const pciSubsystemInfo pci_ss_info_127a_1002_127a_1002 = + {0x127a, 0x1002, pci_subsys_127a_1002_127a_1002, 0}; +#undef pci_ss_info_127a_1002 +#define pci_ss_info_127a_1002 pci_ss_info_127a_1002_127a_1002 +#endif +static const pciSubsystemInfo pci_ss_info_127a_1003_0e11_b0bc = + {0x0e11, 0xb0bc, pci_subsys_127a_1003_0e11_b0bc, 0}; +#undef pci_ss_info_0e11_b0bc +#define pci_ss_info_0e11_b0bc pci_ss_info_127a_1003_0e11_b0bc +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_1003_0e11_b114 = + {0x0e11, 0xb114, pci_subsys_127a_1003_0e11_b114, 0}; +#undef pci_ss_info_0e11_b114 +#define pci_ss_info_0e11_b114 pci_ss_info_127a_1003_0e11_b114 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_1003_1033_802b = + {0x1033, 0x802b, pci_subsys_127a_1003_1033_802b, 0}; +#undef pci_ss_info_1033_802b +#define pci_ss_info_1033_802b pci_ss_info_127a_1003_1033_802b +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_127a_1003_13df_1003 = + {0x13df, 0x1003, pci_subsys_127a_1003_13df_1003, 0}; +#undef pci_ss_info_13df_1003 +#define pci_ss_info_13df_1003 pci_ss_info_127a_1003_13df_1003 +static const pciSubsystemInfo pci_ss_info_127a_1003_13e0_0117 = + {0x13e0, 0x0117, pci_subsys_127a_1003_13e0_0117, 0}; +#undef pci_ss_info_13e0_0117 +#define pci_ss_info_13e0_0117 pci_ss_info_127a_1003_13e0_0117 +static const pciSubsystemInfo pci_ss_info_127a_1003_13e0_0147 = + {0x13e0, 0x0147, pci_subsys_127a_1003_13e0_0147, 0}; +#undef pci_ss_info_13e0_0147 +#define pci_ss_info_13e0_0147 pci_ss_info_127a_1003_13e0_0147 +static const pciSubsystemInfo pci_ss_info_127a_1003_13e0_0197 = + {0x13e0, 0x0197, pci_subsys_127a_1003_13e0_0197, 0}; +#undef pci_ss_info_13e0_0197 +#define pci_ss_info_13e0_0197 pci_ss_info_127a_1003_13e0_0197 +static const pciSubsystemInfo pci_ss_info_127a_1003_13e0_01c7 = + {0x13e0, 0x01c7, pci_subsys_127a_1003_13e0_01c7, 0}; +#undef pci_ss_info_13e0_01c7 +#define pci_ss_info_13e0_01c7 pci_ss_info_127a_1003_13e0_01c7 +static const pciSubsystemInfo pci_ss_info_127a_1003_13e0_01f7 = + {0x13e0, 0x01f7, pci_subsys_127a_1003_13e0_01f7, 0}; +#undef pci_ss_info_13e0_01f7 +#define pci_ss_info_13e0_01f7 pci_ss_info_127a_1003_13e0_01f7 +static const pciSubsystemInfo pci_ss_info_127a_1003_1436_1003 = + {0x1436, 0x1003, pci_subsys_127a_1003_1436_1003, 0}; +#undef pci_ss_info_1436_1003 +#define pci_ss_info_1436_1003 pci_ss_info_127a_1003_1436_1003 +static const pciSubsystemInfo pci_ss_info_127a_1003_1436_1103 = + {0x1436, 0x1103, pci_subsys_127a_1003_1436_1103, 0}; +#undef pci_ss_info_1436_1103 +#define pci_ss_info_1436_1103 pci_ss_info_127a_1003_1436_1103 +static const pciSubsystemInfo pci_ss_info_127a_1003_1436_1602 = + {0x1436, 0x1602, pci_subsys_127a_1003_1436_1602, 0}; +#undef pci_ss_info_1436_1602 +#define pci_ss_info_1436_1602 pci_ss_info_127a_1003_1436_1602 +static const pciSubsystemInfo pci_ss_info_127a_1004_1048_1500 = + {0x1048, 0x1500, pci_subsys_127a_1004_1048_1500, 0}; +#undef pci_ss_info_1048_1500 +#define pci_ss_info_1048_1500 pci_ss_info_127a_1004_1048_1500 +static const pciSubsystemInfo pci_ss_info_127a_1004_10cf_1059 = + {0x10cf, 0x1059, pci_subsys_127a_1004_10cf_1059, 0}; +#undef pci_ss_info_10cf_1059 +#define pci_ss_info_10cf_1059 pci_ss_info_127a_1004_10cf_1059 +#endif +static const pciSubsystemInfo pci_ss_info_127a_1005_1033_8029 = + {0x1033, 0x8029, pci_subsys_127a_1005_1033_8029, 0}; +#undef pci_ss_info_1033_8029 +#define pci_ss_info_1033_8029 pci_ss_info_127a_1005_1033_8029 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_1005_1033_8054 = + {0x1033, 0x8054, pci_subsys_127a_1005_1033_8054, 0}; +#undef pci_ss_info_1033_8054 +#define pci_ss_info_1033_8054 pci_ss_info_127a_1005_1033_8054 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_127a_1005_10cf_103c = + {0x10cf, 0x103c, pci_subsys_127a_1005_10cf_103c, 0}; +#undef pci_ss_info_10cf_103c +#define pci_ss_info_10cf_103c pci_ss_info_127a_1005_10cf_103c +static const pciSubsystemInfo pci_ss_info_127a_1005_10cf_1055 = + {0x10cf, 0x1055, pci_subsys_127a_1005_10cf_1055, 0}; +#undef pci_ss_info_10cf_1055 +#define pci_ss_info_10cf_1055 pci_ss_info_127a_1005_10cf_1055 +static const pciSubsystemInfo pci_ss_info_127a_1005_10cf_1056 = + {0x10cf, 0x1056, pci_subsys_127a_1005_10cf_1056, 0}; +#undef pci_ss_info_10cf_1056 +#define pci_ss_info_10cf_1056 pci_ss_info_127a_1005_10cf_1056 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4003 = + {0x122d, 0x4003, pci_subsys_127a_1005_122d_4003, 0}; +#undef pci_ss_info_122d_4003 +#define pci_ss_info_122d_4003 pci_ss_info_127a_1005_122d_4003 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4006 = + {0x122d, 0x4006, pci_subsys_127a_1005_122d_4006, 0}; +#undef pci_ss_info_122d_4006 +#define pci_ss_info_122d_4006 pci_ss_info_127a_1005_122d_4006 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4008 = + {0x122d, 0x4008, pci_subsys_127a_1005_122d_4008, 0}; +#undef pci_ss_info_122d_4008 +#define pci_ss_info_122d_4008 pci_ss_info_127a_1005_122d_4008 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4009 = + {0x122d, 0x4009, pci_subsys_127a_1005_122d_4009, 0}; +#undef pci_ss_info_122d_4009 +#define pci_ss_info_122d_4009 pci_ss_info_127a_1005_122d_4009 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4010 = + {0x122d, 0x4010, pci_subsys_127a_1005_122d_4010, 0}; +#undef pci_ss_info_122d_4010 +#define pci_ss_info_122d_4010 pci_ss_info_127a_1005_122d_4010 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4011 = + {0x122d, 0x4011, pci_subsys_127a_1005_122d_4011, 0}; +#undef pci_ss_info_122d_4011 +#define pci_ss_info_122d_4011 pci_ss_info_127a_1005_122d_4011 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4013 = + {0x122d, 0x4013, pci_subsys_127a_1005_122d_4013, 0}; +#undef pci_ss_info_122d_4013 +#define pci_ss_info_122d_4013 pci_ss_info_127a_1005_122d_4013 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4015 = + {0x122d, 0x4015, pci_subsys_127a_1005_122d_4015, 0}; +#undef pci_ss_info_122d_4015 +#define pci_ss_info_122d_4015 pci_ss_info_127a_1005_122d_4015 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4016 = + {0x122d, 0x4016, pci_subsys_127a_1005_122d_4016, 0}; +#undef pci_ss_info_122d_4016 +#define pci_ss_info_122d_4016 pci_ss_info_127a_1005_122d_4016 +static const pciSubsystemInfo pci_ss_info_127a_1005_122d_4019 = + {0x122d, 0x4019, pci_subsys_127a_1005_122d_4019, 0}; +#undef pci_ss_info_122d_4019 +#define pci_ss_info_122d_4019 pci_ss_info_127a_1005_122d_4019 +static const pciSubsystemInfo pci_ss_info_127a_1005_13df_1005 = + {0x13df, 0x1005, pci_subsys_127a_1005_13df_1005, 0}; +#undef pci_ss_info_13df_1005 +#define pci_ss_info_13df_1005 pci_ss_info_127a_1005_13df_1005 +static const pciSubsystemInfo pci_ss_info_127a_1005_13e0_0187 = + {0x13e0, 0x0187, pci_subsys_127a_1005_13e0_0187, 0}; +#undef pci_ss_info_13e0_0187 +#define pci_ss_info_13e0_0187 pci_ss_info_127a_1005_13e0_0187 +static const pciSubsystemInfo pci_ss_info_127a_1005_13e0_01a7 = + {0x13e0, 0x01a7, pci_subsys_127a_1005_13e0_01a7, 0}; +#undef pci_ss_info_13e0_01a7 +#define pci_ss_info_13e0_01a7 pci_ss_info_127a_1005_13e0_01a7 +static const pciSubsystemInfo pci_ss_info_127a_1005_13e0_01b7 = + {0x13e0, 0x01b7, pci_subsys_127a_1005_13e0_01b7, 0}; +#undef pci_ss_info_13e0_01b7 +#define pci_ss_info_13e0_01b7 pci_ss_info_127a_1005_13e0_01b7 +static const pciSubsystemInfo pci_ss_info_127a_1005_13e0_01d7 = + {0x13e0, 0x01d7, pci_subsys_127a_1005_13e0_01d7, 0}; +#undef pci_ss_info_13e0_01d7 +#define pci_ss_info_13e0_01d7 pci_ss_info_127a_1005_13e0_01d7 +static const pciSubsystemInfo pci_ss_info_127a_1005_1436_1005 = + {0x1436, 0x1005, pci_subsys_127a_1005_1436_1005, 0}; +#undef pci_ss_info_1436_1005 +#define pci_ss_info_1436_1005 pci_ss_info_127a_1005_1436_1005 +static const pciSubsystemInfo pci_ss_info_127a_1005_1436_1105 = + {0x1436, 0x1105, pci_subsys_127a_1005_1436_1105, 0}; +#undef pci_ss_info_1436_1105 +#define pci_ss_info_1436_1105 pci_ss_info_127a_1005_1436_1105 +static const pciSubsystemInfo pci_ss_info_127a_1005_1437_1105 = + {0x1437, 0x1105, pci_subsys_127a_1005_1437_1105, 0}; +#undef pci_ss_info_1437_1105 +#define pci_ss_info_1437_1105 pci_ss_info_127a_1005_1437_1105 +static const pciSubsystemInfo pci_ss_info_127a_1022_1436_1303 = + {0x1436, 0x1303, pci_subsys_127a_1022_1436_1303, 0}; +#undef pci_ss_info_1436_1303 +#define pci_ss_info_1436_1303 pci_ss_info_127a_1022_1436_1303 +static const pciSubsystemInfo pci_ss_info_127a_1023_122d_4020 = + {0x122d, 0x4020, pci_subsys_127a_1023_122d_4020, 0}; +#undef pci_ss_info_122d_4020 +#define pci_ss_info_122d_4020 pci_ss_info_127a_1023_122d_4020 +static const pciSubsystemInfo pci_ss_info_127a_1023_122d_4023 = + {0x122d, 0x4023, pci_subsys_127a_1023_122d_4023, 0}; +#undef pci_ss_info_122d_4023 +#define pci_ss_info_122d_4023 pci_ss_info_127a_1023_122d_4023 +static const pciSubsystemInfo pci_ss_info_127a_1023_13e0_0247 = + {0x13e0, 0x0247, pci_subsys_127a_1023_13e0_0247, 0}; +#undef pci_ss_info_13e0_0247 +#define pci_ss_info_13e0_0247 pci_ss_info_127a_1023_13e0_0247 +static const pciSubsystemInfo pci_ss_info_127a_1023_13e0_0297 = + {0x13e0, 0x0297, pci_subsys_127a_1023_13e0_0297, 0}; +#undef pci_ss_info_13e0_0297 +#define pci_ss_info_13e0_0297 pci_ss_info_127a_1023_13e0_0297 +static const pciSubsystemInfo pci_ss_info_127a_1023_13e0_02c7 = + {0x13e0, 0x02c7, pci_subsys_127a_1023_13e0_02c7, 0}; +#undef pci_ss_info_13e0_02c7 +#define pci_ss_info_13e0_02c7 pci_ss_info_127a_1023_13e0_02c7 +static const pciSubsystemInfo pci_ss_info_127a_1023_1436_1203 = + {0x1436, 0x1203, pci_subsys_127a_1023_1436_1203, 0}; +#undef pci_ss_info_1436_1203 +#define pci_ss_info_1436_1203 pci_ss_info_127a_1023_1436_1203 +static const pciSubsystemInfo pci_ss_info_127a_1023_1436_1303 = + {0x1436, 0x1303, pci_subsys_127a_1023_1436_1303, 0}; +#undef pci_ss_info_1436_1303 +#define pci_ss_info_1436_1303 pci_ss_info_127a_1023_1436_1303 +static const pciSubsystemInfo pci_ss_info_127a_1025_10cf_106a = + {0x10cf, 0x106a, pci_subsys_127a_1025_10cf_106a, 0}; +#undef pci_ss_info_10cf_106a +#define pci_ss_info_10cf_106a pci_ss_info_127a_1025_10cf_106a +static const pciSubsystemInfo pci_ss_info_127a_1025_122d_4021 = + {0x122d, 0x4021, pci_subsys_127a_1025_122d_4021, 0}; +#undef pci_ss_info_122d_4021 +#define pci_ss_info_122d_4021 pci_ss_info_127a_1025_122d_4021 +static const pciSubsystemInfo pci_ss_info_127a_1025_122d_4022 = + {0x122d, 0x4022, pci_subsys_127a_1025_122d_4022, 0}; +#undef pci_ss_info_122d_4022 +#define pci_ss_info_122d_4022 pci_ss_info_127a_1025_122d_4022 +static const pciSubsystemInfo pci_ss_info_127a_1025_122d_4024 = + {0x122d, 0x4024, pci_subsys_127a_1025_122d_4024, 0}; +#undef pci_ss_info_122d_4024 +#define pci_ss_info_122d_4024 pci_ss_info_127a_1025_122d_4024 +static const pciSubsystemInfo pci_ss_info_127a_1025_122d_4025 = + {0x122d, 0x4025, pci_subsys_127a_1025_122d_4025, 0}; +#undef pci_ss_info_122d_4025 +#define pci_ss_info_122d_4025 pci_ss_info_127a_1025_122d_4025 +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_8044 = + {0x104d, 0x8044, pci_subsys_127a_2005_104d_8044, 0}; +#undef pci_ss_info_104d_8044 +#define pci_ss_info_104d_8044 pci_ss_info_127a_2005_104d_8044 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_8045 = + {0x104d, 0x8045, pci_subsys_127a_2005_104d_8045, 0}; +#undef pci_ss_info_104d_8045 +#define pci_ss_info_104d_8045 pci_ss_info_127a_2005_104d_8045 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_8055 = + {0x104d, 0x8055, pci_subsys_127a_2005_104d_8055, 0}; +#undef pci_ss_info_104d_8055 +#define pci_ss_info_104d_8055 pci_ss_info_127a_2005_104d_8055 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_8056 = + {0x104d, 0x8056, pci_subsys_127a_2005_104d_8056, 0}; +#undef pci_ss_info_104d_8056 +#define pci_ss_info_104d_8056 pci_ss_info_127a_2005_104d_8056 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_805a = + {0x104d, 0x805a, pci_subsys_127a_2005_104d_805a, 0}; +#undef pci_ss_info_104d_805a +#define pci_ss_info_104d_805a pci_ss_info_127a_2005_104d_805a +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_805f = + {0x104d, 0x805f, pci_subsys_127a_2005_104d_805f, 0}; +#undef pci_ss_info_104d_805f +#define pci_ss_info_104d_805f pci_ss_info_127a_2005_104d_805f +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_127a_2005_104d_8074 = + {0x104d, 0x8074, pci_subsys_127a_2005_104d_8074, 0}; +#undef pci_ss_info_104d_8074 +#define pci_ss_info_104d_8074 pci_ss_info_127a_2005_104d_8074 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_127a_2013_1179_0001 = + {0x1179, 0x0001, pci_subsys_127a_2013_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_127a_2013_1179_0001 +static const pciSubsystemInfo pci_ss_info_127a_2013_1179_ff00 = + {0x1179, 0xff00, pci_subsys_127a_2013_1179_ff00, 0}; +#undef pci_ss_info_1179_ff00 +#define pci_ss_info_1179_ff00 pci_ss_info_127a_2013_1179_ff00 +static const pciSubsystemInfo pci_ss_info_127a_2014_10cf_1057 = + {0x10cf, 0x1057, pci_subsys_127a_2014_10cf_1057, 0}; +#undef pci_ss_info_10cf_1057 +#define pci_ss_info_10cf_1057 pci_ss_info_127a_2014_10cf_1057 +static const pciSubsystemInfo pci_ss_info_127a_2014_122d_4050 = + {0x122d, 0x4050, pci_subsys_127a_2014_122d_4050, 0}; +#undef pci_ss_info_122d_4050 +#define pci_ss_info_122d_4050 pci_ss_info_127a_2014_122d_4050 +static const pciSubsystemInfo pci_ss_info_127a_2014_122d_4055 = + {0x122d, 0x4055, pci_subsys_127a_2014_122d_4055, 0}; +#undef pci_ss_info_122d_4055 +#define pci_ss_info_122d_4055 pci_ss_info_127a_2014_122d_4055 +static const pciSubsystemInfo pci_ss_info_127a_2015_10cf_1063 = + {0x10cf, 0x1063, pci_subsys_127a_2015_10cf_1063, 0}; +#undef pci_ss_info_10cf_1063 +#define pci_ss_info_10cf_1063 pci_ss_info_127a_2015_10cf_1063 +static const pciSubsystemInfo pci_ss_info_127a_2015_10cf_1064 = + {0x10cf, 0x1064, pci_subsys_127a_2015_10cf_1064, 0}; +#undef pci_ss_info_10cf_1064 +#define pci_ss_info_10cf_1064 pci_ss_info_127a_2015_10cf_1064 +static const pciSubsystemInfo pci_ss_info_127a_2015_1468_2015 = + {0x1468, 0x2015, pci_subsys_127a_2015_1468_2015, 0}; +#undef pci_ss_info_1468_2015 +#define pci_ss_info_1468_2015 pci_ss_info_127a_2015_1468_2015 +static const pciSubsystemInfo pci_ss_info_127a_2016_122d_4051 = + {0x122d, 0x4051, pci_subsys_127a_2016_122d_4051, 0}; +#undef pci_ss_info_122d_4051 +#define pci_ss_info_122d_4051 pci_ss_info_127a_2016_122d_4051 +static const pciSubsystemInfo pci_ss_info_127a_2016_122d_4052 = + {0x122d, 0x4052, pci_subsys_127a_2016_122d_4052, 0}; +#undef pci_ss_info_122d_4052 +#define pci_ss_info_122d_4052 pci_ss_info_127a_2016_122d_4052 +static const pciSubsystemInfo pci_ss_info_127a_2016_122d_4054 = + {0x122d, 0x4054, pci_subsys_127a_2016_122d_4054, 0}; +#undef pci_ss_info_122d_4054 +#define pci_ss_info_122d_4054 pci_ss_info_127a_2016_122d_4054 +static const pciSubsystemInfo pci_ss_info_127a_2016_122d_4056 = + {0x122d, 0x4056, pci_subsys_127a_2016_122d_4056, 0}; +#undef pci_ss_info_122d_4056 +#define pci_ss_info_122d_4056 pci_ss_info_127a_2016_122d_4056 +static const pciSubsystemInfo pci_ss_info_127a_2016_122d_4057 = + {0x122d, 0x4057, pci_subsys_127a_2016_122d_4057, 0}; +#undef pci_ss_info_122d_4057 +#define pci_ss_info_122d_4057 pci_ss_info_127a_2016_122d_4057 +static const pciSubsystemInfo pci_ss_info_127a_4311_127a_4311 = + {0x127a, 0x4311, pci_subsys_127a_4311_127a_4311, 0}; +#undef pci_ss_info_127a_4311 +#define pci_ss_info_127a_4311 pci_ss_info_127a_4311_127a_4311 +static const pciSubsystemInfo pci_ss_info_127a_4311_13e0_0210 = + {0x13e0, 0x0210, pci_subsys_127a_4311_13e0_0210, 0}; +#undef pci_ss_info_13e0_0210 +#define pci_ss_info_13e0_0210 pci_ss_info_127a_4311_13e0_0210 +static const pciSubsystemInfo pci_ss_info_127a_4320_1235_4320 = + {0x1235, 0x4320, pci_subsys_127a_4320_1235_4320, 0}; +#undef pci_ss_info_1235_4320 +#define pci_ss_info_1235_4320 pci_ss_info_127a_4320_1235_4320 +static const pciSubsystemInfo pci_ss_info_127a_4321_1235_4321 = + {0x1235, 0x4321, pci_subsys_127a_4321_1235_4321, 0}; +#undef pci_ss_info_1235_4321 +#define pci_ss_info_1235_4321 pci_ss_info_127a_4321_1235_4321 +static const pciSubsystemInfo pci_ss_info_127a_4321_1235_4324 = + {0x1235, 0x4324, pci_subsys_127a_4321_1235_4324, 0}; +#undef pci_ss_info_1235_4324 +#define pci_ss_info_1235_4324 pci_ss_info_127a_4321_1235_4324 +static const pciSubsystemInfo pci_ss_info_127a_4321_13e0_0210 = + {0x13e0, 0x0210, pci_subsys_127a_4321_13e0_0210, 0}; +#undef pci_ss_info_13e0_0210 +#define pci_ss_info_13e0_0210 pci_ss_info_127a_4321_13e0_0210 +static const pciSubsystemInfo pci_ss_info_127a_4321_144d_2321 = + {0x144d, 0x2321, pci_subsys_127a_4321_144d_2321, 0}; +#undef pci_ss_info_144d_2321 +#define pci_ss_info_144d_2321 pci_ss_info_127a_4321_144d_2321 +static const pciSubsystemInfo pci_ss_info_127a_4322_1235_4322 = + {0x1235, 0x4322, pci_subsys_127a_4322_1235_4322, 0}; +#undef pci_ss_info_1235_4322 +#define pci_ss_info_1235_4322 pci_ss_info_127a_4322_1235_4322 +static const pciSubsystemInfo pci_ss_info_127a_8234_108d_0022 = + {0x108d, 0x0022, pci_subsys_127a_8234_108d_0022, 0}; +#undef pci_ss_info_108d_0022 +#define pci_ss_info_108d_0022 pci_ss_info_127a_8234_108d_0022 +static const pciSubsystemInfo pci_ss_info_127a_8234_108d_0027 = + {0x108d, 0x0027, pci_subsys_127a_8234_108d_0027, 0}; +#undef pci_ss_info_108d_0027 +#define pci_ss_info_108d_0027 pci_ss_info_127a_8234_108d_0027 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_12ae_0001_12ae_0001 = + {0x12ae, 0x0001, pci_subsys_12ae_0001_12ae_0001, 0}; +#undef pci_ss_info_12ae_0001 +#define pci_ss_info_12ae_0001 pci_ss_info_12ae_0001_12ae_0001 +static const pciSubsystemInfo pci_ss_info_12ae_0001_1410_0104 = + {0x1410, 0x0104, pci_subsys_12ae_0001_1410_0104, 0}; +#undef pci_ss_info_1410_0104 +#define pci_ss_info_1410_0104 pci_ss_info_12ae_0001_1410_0104 +static const pciSubsystemInfo pci_ss_info_12ae_0002_12ae_0002 = + {0x12ae, 0x0002, pci_subsys_12ae_0002_12ae_0002, 0}; +#undef pci_ss_info_12ae_0002 +#define pci_ss_info_12ae_0002 pci_ss_info_12ae_0002_12ae_0002 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_005c = + {0x12b9, 0x005c, pci_subsys_12b9_1006_12b9_005c, 0}; +#undef pci_ss_info_12b9_005c +#define pci_ss_info_12b9_005c pci_ss_info_12b9_1006_12b9_005c +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_005e = + {0x12b9, 0x005e, pci_subsys_12b9_1006_12b9_005e, 0}; +#undef pci_ss_info_12b9_005e +#define pci_ss_info_12b9_005e pci_ss_info_12b9_1006_12b9_005e +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_0062 = + {0x12b9, 0x0062, pci_subsys_12b9_1006_12b9_0062, 0}; +#undef pci_ss_info_12b9_0062 +#define pci_ss_info_12b9_0062 pci_ss_info_12b9_1006_12b9_0062 +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_0068 = + {0x12b9, 0x0068, pci_subsys_12b9_1006_12b9_0068, 0}; +#undef pci_ss_info_12b9_0068 +#define pci_ss_info_12b9_0068 pci_ss_info_12b9_1006_12b9_0068 +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_007a = + {0x12b9, 0x007a, pci_subsys_12b9_1006_12b9_007a, 0}; +#undef pci_ss_info_12b9_007a +#define pci_ss_info_12b9_007a pci_ss_info_12b9_1006_12b9_007a +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_007f = + {0x12b9, 0x007f, pci_subsys_12b9_1006_12b9_007f, 0}; +#undef pci_ss_info_12b9_007f +#define pci_ss_info_12b9_007f pci_ss_info_12b9_1006_12b9_007f +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_0080 = + {0x12b9, 0x0080, pci_subsys_12b9_1006_12b9_0080, 0}; +#undef pci_ss_info_12b9_0080 +#define pci_ss_info_12b9_0080 pci_ss_info_12b9_1006_12b9_0080 +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_0081 = + {0x12b9, 0x0081, pci_subsys_12b9_1006_12b9_0081, 0}; +#undef pci_ss_info_12b9_0081 +#define pci_ss_info_12b9_0081 pci_ss_info_12b9_1006_12b9_0081 +static const pciSubsystemInfo pci_ss_info_12b9_1006_12b9_0091 = + {0x12b9, 0x0091, pci_subsys_12b9_1006_12b9_0091, 0}; +#undef pci_ss_info_12b9_0091 +#define pci_ss_info_12b9_0091 pci_ss_info_12b9_1006_12b9_0091 +static const pciSubsystemInfo pci_ss_info_12b9_1007_12b9_00a3 = + {0x12b9, 0x00a3, pci_subsys_12b9_1007_12b9_00a3, 0}; +#undef pci_ss_info_12b9_00a3 +#define pci_ss_info_12b9_00a3 pci_ss_info_12b9_1007_12b9_00a3 +static const pciSubsystemInfo pci_ss_info_12b9_1008_12b9_00a2 = + {0x12b9, 0x00a2, pci_subsys_12b9_1008_12b9_00a2, 0}; +#undef pci_ss_info_12b9_00a2 +#define pci_ss_info_12b9_00a2 pci_ss_info_12b9_1008_12b9_00a2 +static const pciSubsystemInfo pci_ss_info_12b9_1008_12b9_00aa = + {0x12b9, 0x00aa, pci_subsys_12b9_1008_12b9_00aa, 0}; +#undef pci_ss_info_12b9_00aa +#define pci_ss_info_12b9_00aa pci_ss_info_12b9_1008_12b9_00aa +static const pciSubsystemInfo pci_ss_info_12b9_1008_12b9_00ab = + {0x12b9, 0x00ab, pci_subsys_12b9_1008_12b9_00ab, 0}; +#undef pci_ss_info_12b9_00ab +#define pci_ss_info_12b9_00ab pci_ss_info_12b9_1008_12b9_00ab +static const pciSubsystemInfo pci_ss_info_12b9_1008_12b9_00ac = + {0x12b9, 0x00ac, pci_subsys_12b9_1008_12b9_00ac, 0}; +#undef pci_ss_info_12b9_00ac +#define pci_ss_info_12b9_00ac pci_ss_info_12b9_1008_12b9_00ac +static const pciSubsystemInfo pci_ss_info_12b9_1008_12b9_00ad = + {0x12b9, 0x00ad, pci_subsys_12b9_1008_12b9_00ad, 0}; +#undef pci_ss_info_12b9_00ad +#define pci_ss_info_12b9_00ad pci_ss_info_12b9_1008_12b9_00ad +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_12be_3042_12be_3042 = + {0x12be, 0x3042, pci_subsys_12be_3042_12be_3042, 0}; +#undef pci_ss_info_12be_3042 +#define pci_ss_info_12be_3042 pci_ss_info_12be_3042_12be_3042 +#endif +static const pciSubsystemInfo pci_ss_info_12d2_0018_1048_0c10 = + {0x1048, 0x0c10, pci_subsys_12d2_0018_1048_0c10, 0}; +#undef pci_ss_info_1048_0c10 +#define pci_ss_info_1048_0c10 pci_ss_info_12d2_0018_1048_0c10 +static const pciSubsystemInfo pci_ss_info_12d2_0018_107b_8030 = + {0x107b, 0x8030, pci_subsys_12d2_0018_107b_8030, 0}; +#undef pci_ss_info_107b_8030 +#define pci_ss_info_107b_8030 pci_ss_info_12d2_0018_107b_8030 +static const pciSubsystemInfo pci_ss_info_12d2_0018_1092_0350 = + {0x1092, 0x0350, pci_subsys_12d2_0018_1092_0350, 0}; +#undef pci_ss_info_1092_0350 +#define pci_ss_info_1092_0350 pci_ss_info_12d2_0018_1092_0350 +static const pciSubsystemInfo pci_ss_info_12d2_0018_1092_1092 = + {0x1092, 0x1092, pci_subsys_12d2_0018_1092_1092, 0}; +#undef pci_ss_info_1092_1092 +#define pci_ss_info_1092_1092 pci_ss_info_12d2_0018_1092_1092 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b1b = + {0x10b4, 0x1b1b, pci_subsys_12d2_0018_10b4_1b1b, 0}; +#undef pci_ss_info_10b4_1b1b +#define pci_ss_info_10b4_1b1b pci_ss_info_12d2_0018_10b4_1b1b +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b1d = + {0x10b4, 0x1b1d, pci_subsys_12d2_0018_10b4_1b1d, 0}; +#undef pci_ss_info_10b4_1b1d +#define pci_ss_info_10b4_1b1d pci_ss_info_12d2_0018_10b4_1b1d +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b1e = + {0x10b4, 0x1b1e, pci_subsys_12d2_0018_10b4_1b1e, 0}; +#undef pci_ss_info_10b4_1b1e +#define pci_ss_info_10b4_1b1e pci_ss_info_12d2_0018_10b4_1b1e +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b20 = + {0x10b4, 0x1b20, pci_subsys_12d2_0018_10b4_1b20, 0}; +#undef pci_ss_info_10b4_1b20 +#define pci_ss_info_10b4_1b20 pci_ss_info_12d2_0018_10b4_1b20 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b21 = + {0x10b4, 0x1b21, pci_subsys_12d2_0018_10b4_1b21, 0}; +#undef pci_ss_info_10b4_1b21 +#define pci_ss_info_10b4_1b21 pci_ss_info_12d2_0018_10b4_1b21 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b22 = + {0x10b4, 0x1b22, pci_subsys_12d2_0018_10b4_1b22, 0}; +#undef pci_ss_info_10b4_1b22 +#define pci_ss_info_10b4_1b22 pci_ss_info_12d2_0018_10b4_1b22 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b23 = + {0x10b4, 0x1b23, pci_subsys_12d2_0018_10b4_1b23, 0}; +#undef pci_ss_info_10b4_1b23 +#define pci_ss_info_10b4_1b23 pci_ss_info_12d2_0018_10b4_1b23 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b27 = + {0x10b4, 0x1b27, pci_subsys_12d2_0018_10b4_1b27, 0}; +#undef pci_ss_info_10b4_1b27 +#define pci_ss_info_10b4_1b27 pci_ss_info_12d2_0018_10b4_1b27 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_1b88 = + {0x10b4, 0x1b88, pci_subsys_12d2_0018_10b4_1b88, 0}; +#undef pci_ss_info_10b4_1b88 +#define pci_ss_info_10b4_1b88 pci_ss_info_12d2_0018_10b4_1b88 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_222a = + {0x10b4, 0x222a, pci_subsys_12d2_0018_10b4_222a, 0}; +#undef pci_ss_info_10b4_222a +#define pci_ss_info_10b4_222a pci_ss_info_12d2_0018_10b4_222a +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_2230 = + {0x10b4, 0x2230, pci_subsys_12d2_0018_10b4_2230, 0}; +#undef pci_ss_info_10b4_2230 +#define pci_ss_info_10b4_2230 pci_ss_info_12d2_0018_10b4_2230 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_2232 = + {0x10b4, 0x2232, pci_subsys_12d2_0018_10b4_2232, 0}; +#undef pci_ss_info_10b4_2232 +#define pci_ss_info_10b4_2232 pci_ss_info_12d2_0018_10b4_2232 +static const pciSubsystemInfo pci_ss_info_12d2_0018_10b4_2235 = + {0x10b4, 0x2235, pci_subsys_12d2_0018_10b4_2235, 0}; +#undef pci_ss_info_10b4_2235 +#define pci_ss_info_10b4_2235 pci_ss_info_12d2_0018_10b4_2235 +static const pciSubsystemInfo pci_ss_info_12d2_0018_2a15_54a3 = + {0x2a15, 0x54a3, pci_subsys_12d2_0018_2a15_54a3, 0}; +#undef pci_ss_info_2a15_54a3 +#define pci_ss_info_2a15_54a3 pci_ss_info_12d2_0018_2a15_54a3 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0001_104d_8036 = + {0x104d, 0x8036, pci_subsys_12eb_0001_104d_8036, 0}; +#undef pci_ss_info_104d_8036 +#define pci_ss_info_104d_8036 pci_ss_info_12eb_0001_104d_8036 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0001_1092_2000 = + {0x1092, 0x2000, pci_subsys_12eb_0001_1092_2000, 0}; +#undef pci_ss_info_1092_2000 +#define pci_ss_info_1092_2000 pci_ss_info_12eb_0001_1092_2000 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0001_1092_2100 = + {0x1092, 0x2100, pci_subsys_12eb_0001_1092_2100, 0}; +#undef pci_ss_info_1092_2100 +#define pci_ss_info_1092_2100 pci_ss_info_12eb_0001_1092_2100 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0001_1092_2110 = + {0x1092, 0x2110, pci_subsys_12eb_0001_1092_2110, 0}; +#undef pci_ss_info_1092_2110 +#define pci_ss_info_1092_2110 pci_ss_info_12eb_0001_1092_2110 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0001_1092_2200 = + {0x1092, 0x2200, pci_subsys_12eb_0001_1092_2200, 0}; +#undef pci_ss_info_1092_2200 +#define pci_ss_info_1092_2200 pci_ss_info_12eb_0001_1092_2200 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_12eb_0001_122d_1002 = + {0x122d, 0x1002, pci_subsys_12eb_0001_122d_1002, 0}; +#undef pci_ss_info_122d_1002 +#define pci_ss_info_122d_1002 pci_ss_info_12eb_0001_122d_1002 +static const pciSubsystemInfo pci_ss_info_12eb_0001_12eb_0001 = + {0x12eb, 0x0001, pci_subsys_12eb_0001_12eb_0001, 0}; +#undef pci_ss_info_12eb_0001 +#define pci_ss_info_12eb_0001 pci_ss_info_12eb_0001_12eb_0001 +static const pciSubsystemInfo pci_ss_info_12eb_0001_5053_3355 = + {0x5053, 0x3355, pci_subsys_12eb_0001_5053_3355, 0}; +#undef pci_ss_info_5053_3355 +#define pci_ss_info_5053_3355 pci_ss_info_12eb_0001_5053_3355 +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_104d_8049 = + {0x104d, 0x8049, pci_subsys_12eb_0002_104d_8049, 0}; +#undef pci_ss_info_104d_8049 +#define pci_ss_info_104d_8049 pci_ss_info_12eb_0002_104d_8049 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_104d_807b = + {0x104d, 0x807b, pci_subsys_12eb_0002_104d_807b, 0}; +#undef pci_ss_info_104d_807b +#define pci_ss_info_104d_807b pci_ss_info_12eb_0002_104d_807b +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_1092_3000 = + {0x1092, 0x3000, pci_subsys_12eb_0002_1092_3000, 0}; +#undef pci_ss_info_1092_3000 +#define pci_ss_info_1092_3000 pci_ss_info_12eb_0002_1092_3000 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_1092_3001 = + {0x1092, 0x3001, pci_subsys_12eb_0002_1092_3001, 0}; +#undef pci_ss_info_1092_3001 +#define pci_ss_info_1092_3001 pci_ss_info_12eb_0002_1092_3001 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_1092_3002 = + {0x1092, 0x3002, pci_subsys_12eb_0002_1092_3002, 0}; +#undef pci_ss_info_1092_3002 +#define pci_ss_info_1092_3002 pci_ss_info_12eb_0002_1092_3002 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_1092_3003 = + {0x1092, 0x3003, pci_subsys_12eb_0002_1092_3003, 0}; +#undef pci_ss_info_1092_3003 +#define pci_ss_info_1092_3003 pci_ss_info_12eb_0002_1092_3003 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0002_1092_3004 = + {0x1092, 0x3004, pci_subsys_12eb_0002_1092_3004, 0}; +#undef pci_ss_info_1092_3004 +#define pci_ss_info_1092_3004 pci_ss_info_12eb_0002_1092_3004 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_12eb_0002_12eb_0001 = + {0x12eb, 0x0001, pci_subsys_12eb_0002_12eb_0001, 0}; +#undef pci_ss_info_12eb_0001 +#define pci_ss_info_12eb_0001 pci_ss_info_12eb_0002_12eb_0001 +static const pciSubsystemInfo pci_ss_info_12eb_0002_12eb_0002 = + {0x12eb, 0x0002, pci_subsys_12eb_0002_12eb_0002, 0}; +#undef pci_ss_info_12eb_0002 +#define pci_ss_info_12eb_0002 pci_ss_info_12eb_0002_12eb_0002 +static const pciSubsystemInfo pci_ss_info_12eb_0002_12eb_0088 = + {0x12eb, 0x0088, pci_subsys_12eb_0002_12eb_0088, 0}; +#undef pci_ss_info_12eb_0088 +#define pci_ss_info_12eb_0088 pci_ss_info_12eb_0002_12eb_0088 +static const pciSubsystemInfo pci_ss_info_12eb_0002_144d_3510 = + {0x144d, 0x3510, pci_subsys_12eb_0002_144d_3510, 0}; +#undef pci_ss_info_144d_3510 +#define pci_ss_info_144d_3510 pci_ss_info_12eb_0002_144d_3510 +static const pciSubsystemInfo pci_ss_info_12eb_0002_5053_3356 = + {0x5053, 0x3356, pci_subsys_12eb_0002_5053_3356, 0}; +#undef pci_ss_info_5053_3356 +#define pci_ss_info_5053_3356 pci_ss_info_12eb_0002_5053_3356 +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0003_104d_8049 = + {0x104d, 0x8049, pci_subsys_12eb_0003_104d_8049, 0}; +#undef pci_ss_info_104d_8049 +#define pci_ss_info_104d_8049 pci_ss_info_12eb_0003_104d_8049 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_12eb_0003_104d_8077 = + {0x104d, 0x8077, pci_subsys_12eb_0003_104d_8077, 0}; +#undef pci_ss_info_104d_8077 +#define pci_ss_info_104d_8077 pci_ss_info_12eb_0003_104d_8077 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_12eb_0003_109f_1000 = + {0x109f, 0x1000, pci_subsys_12eb_0003_109f_1000, 0}; +#undef pci_ss_info_109f_1000 +#define pci_ss_info_109f_1000 pci_ss_info_12eb_0003_109f_1000 +static const pciSubsystemInfo pci_ss_info_12eb_0003_12eb_0003 = + {0x12eb, 0x0003, pci_subsys_12eb_0003_12eb_0003, 0}; +#undef pci_ss_info_12eb_0003 +#define pci_ss_info_12eb_0003 pci_ss_info_12eb_0003_12eb_0003 +static const pciSubsystemInfo pci_ss_info_12eb_0003_1462_6780 = + {0x1462, 0x6780, pci_subsys_12eb_0003_1462_6780, 0}; +#undef pci_ss_info_1462_6780 +#define pci_ss_info_1462_6780 pci_ss_info_12eb_0003_1462_6780 +static const pciSubsystemInfo pci_ss_info_12eb_0003_14a4_2073 = + {0x14a4, 0x2073, pci_subsys_12eb_0003_14a4_2073, 0}; +#undef pci_ss_info_14a4_2073 +#define pci_ss_info_14a4_2073 pci_ss_info_12eb_0003_14a4_2073 +static const pciSubsystemInfo pci_ss_info_12eb_0003_14a4_2091 = + {0x14a4, 0x2091, pci_subsys_12eb_0003_14a4_2091, 0}; +#undef pci_ss_info_14a4_2091 +#define pci_ss_info_14a4_2091 pci_ss_info_12eb_0003_14a4_2091 +static const pciSubsystemInfo pci_ss_info_12eb_0003_14a4_2104 = + {0x14a4, 0x2104, pci_subsys_12eb_0003_14a4_2104, 0}; +#undef pci_ss_info_14a4_2104 +#define pci_ss_info_14a4_2104 pci_ss_info_12eb_0003_14a4_2104 +static const pciSubsystemInfo pci_ss_info_12eb_0003_14a4_2106 = + {0x14a4, 0x2106, pci_subsys_12eb_0003_14a4_2106, 0}; +#undef pci_ss_info_14a4_2106 +#define pci_ss_info_14a4_2106 pci_ss_info_12eb_0003_14a4_2106 +static const pciSubsystemInfo pci_ss_info_12eb_8803_12eb_8803 = + {0x12eb, 0x8803, pci_subsys_12eb_8803_12eb_8803, 0}; +#undef pci_ss_info_12eb_8803 +#define pci_ss_info_12eb_8803 pci_ss_info_12eb_8803_12eb_8803 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1308_0001_1308_0001 = + {0x1308, 0x0001, pci_subsys_1308_0001_1308_0001, 0}; +#undef pci_ss_info_1308_0001 +#define pci_ss_info_1308_0001 pci_ss_info_1308_0001_1308_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_131f_2030_131f_2030 = + {0x131f, 0x2030, pci_subsys_131f_2030_131f_2030, 0}; +#undef pci_ss_info_131f_2030 +#define pci_ss_info_131f_2030 pci_ss_info_131f_2030_131f_2030 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_134d_7891_134d_0001 = + {0x134d, 0x0001, pci_subsys_134d_7891_134d_0001, 0}; +#undef pci_ss_info_134d_0001 +#define pci_ss_info_134d_0001 pci_ss_info_134d_7891_134d_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1394_0001_1394_0001 = + {0x1394, 0x0001, pci_subsys_1394_0001_1394_0001, 0}; +#undef pci_ss_info_1394_0001 +#define pci_ss_info_1394_0001 pci_ss_info_1394_0001_1394_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1397_2bd0_1397_2bd0 = + {0x1397, 0x2bd0, pci_subsys_1397_2bd0_1397_2bd0, 0}; +#undef pci_ss_info_1397_2bd0 +#define pci_ss_info_1397_2bd0 pci_ss_info_1397_2bd0_1397_2bd0 +static const pciSubsystemInfo pci_ss_info_1397_2bd0_e4bf_1000 = + {0xe4bf, 0x1000, pci_subsys_1397_2bd0_e4bf_1000, 0}; +#undef pci_ss_info_e4bf_1000 +#define pci_ss_info_e4bf_1000 pci_ss_info_1397_2bd0_e4bf_1000 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_13df_0001_13df_0001 = + {0x13df, 0x0001, pci_subsys_13df_0001_13df_0001, 0}; +#undef pci_ss_info_13df_0001 +#define pci_ss_info_13df_0001 pci_ss_info_13df_0001_13df_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_13f6_0100_13f6_ffff = + {0x13f6, 0xffff, pci_subsys_13f6_0100_13f6_ffff, 0}; +#undef pci_ss_info_13f6_ffff +#define pci_ss_info_13f6_ffff pci_ss_info_13f6_0100_13f6_ffff +static const pciSubsystemInfo pci_ss_info_13f6_0101_13f6_0101 = + {0x13f6, 0x0101, pci_subsys_13f6_0101_13f6_0101, 0}; +#undef pci_ss_info_13f6_0101 +#define pci_ss_info_13f6_0101 pci_ss_info_13f6_0101_13f6_0101 +static const pciSubsystemInfo pci_ss_info_13f6_0111_1019_0970 = + {0x1019, 0x0970, pci_subsys_13f6_0111_1019_0970, 0}; +#undef pci_ss_info_1019_0970 +#define pci_ss_info_1019_0970 pci_ss_info_13f6_0111_1019_0970 +static const pciSubsystemInfo pci_ss_info_13f6_0111_1043_8077 = + {0x1043, 0x8077, pci_subsys_13f6_0111_1043_8077, 0}; +#undef pci_ss_info_1043_8077 +#define pci_ss_info_1043_8077 pci_ss_info_13f6_0111_1043_8077 +static const pciSubsystemInfo pci_ss_info_13f6_0111_1043_80e2 = + {0x1043, 0x80e2, pci_subsys_13f6_0111_1043_80e2, 0}; +#undef pci_ss_info_1043_80e2 +#define pci_ss_info_1043_80e2 pci_ss_info_13f6_0111_1043_80e2 +static const pciSubsystemInfo pci_ss_info_13f6_0111_13f6_0111 = + {0x13f6, 0x0111, pci_subsys_13f6_0111_13f6_0111, 0}; +#undef pci_ss_info_13f6_0111 +#define pci_ss_info_13f6_0111 pci_ss_info_13f6_0111_13f6_0111 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1415_9501_15ed_2000 = + {0x15ed, 0x2000, pci_subsys_1415_9501_15ed_2000, 0}; +#undef pci_ss_info_15ed_2000 +#define pci_ss_info_15ed_2000 pci_ss_info_1415_9501_15ed_2000 +static const pciSubsystemInfo pci_ss_info_1415_9501_15ed_2001 = + {0x15ed, 0x2001, pci_subsys_1415_9501_15ed_2001, 0}; +#undef pci_ss_info_15ed_2001 +#define pci_ss_info_15ed_2001 pci_ss_info_1415_9501_15ed_2001 +static const pciSubsystemInfo pci_ss_info_1415_9511_15ed_2000 = + {0x15ed, 0x2000, pci_subsys_1415_9511_15ed_2000, 0}; +#undef pci_ss_info_15ed_2000 +#define pci_ss_info_15ed_2000 pci_ss_info_1415_9511_15ed_2000 +static const pciSubsystemInfo pci_ss_info_1415_9511_15ed_2001 = + {0x15ed, 0x2001, pci_subsys_1415_9511_15ed_2001, 0}; +#undef pci_ss_info_15ed_2001 +#define pci_ss_info_15ed_2001 pci_ss_info_1415_9511_15ed_2001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_1644_1014_0277 = + {0x1014, 0x0277, pci_subsys_14e4_1644_1014_0277, 0}; +#undef pci_ss_info_1014_0277 +#define pci_ss_info_1014_0277 pci_ss_info_14e4_1644_1014_0277 +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1644_1028_00d1 = + {0x1028, 0x00d1, pci_subsys_14e4_1644_1028_00d1, 0}; +#undef pci_ss_info_1028_00d1 +#define pci_ss_info_1028_00d1 pci_ss_info_14e4_1644_1028_00d1 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1644_1028_0106 = + {0x1028, 0x0106, pci_subsys_14e4_1644_1028_0106, 0}; +#undef pci_ss_info_1028_0106 +#define pci_ss_info_1028_0106 pci_ss_info_14e4_1644_1028_0106 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1644_1028_0109 = + {0x1028, 0x0109, pci_subsys_14e4_1644_1028_0109, 0}; +#undef pci_ss_info_1028_0109 +#define pci_ss_info_1028_0109 pci_ss_info_14e4_1644_1028_0109 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1644_1028_010a = + {0x1028, 0x010a, pci_subsys_14e4_1644_1028_010a, 0}; +#undef pci_ss_info_1028_010a +#define pci_ss_info_1028_010a pci_ss_info_14e4_1644_1028_010a +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1000 = + {0x10b7, 0x1000, pci_subsys_14e4_1644_10b7_1000, 0}; +#undef pci_ss_info_10b7_1000 +#define pci_ss_info_10b7_1000 pci_ss_info_14e4_1644_10b7_1000 +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1001 = + {0x10b7, 0x1001, pci_subsys_14e4_1644_10b7_1001, 0}; +#undef pci_ss_info_10b7_1001 +#define pci_ss_info_10b7_1001 pci_ss_info_14e4_1644_10b7_1001 +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1002 = + {0x10b7, 0x1002, pci_subsys_14e4_1644_10b7_1002, 0}; +#undef pci_ss_info_10b7_1002 +#define pci_ss_info_10b7_1002 pci_ss_info_14e4_1644_10b7_1002 +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1003 = + {0x10b7, 0x1003, pci_subsys_14e4_1644_10b7_1003, 0}; +#undef pci_ss_info_10b7_1003 +#define pci_ss_info_10b7_1003 pci_ss_info_14e4_1644_10b7_1003 +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1004 = + {0x10b7, 0x1004, pci_subsys_14e4_1644_10b7_1004, 0}; +#undef pci_ss_info_10b7_1004 +#define pci_ss_info_10b7_1004 pci_ss_info_14e4_1644_10b7_1004 +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1005 = + {0x10b7, 0x1005, pci_subsys_14e4_1644_10b7_1005, 0}; +#undef pci_ss_info_10b7_1005 +#define pci_ss_info_10b7_1005 pci_ss_info_14e4_1644_10b7_1005 +static const pciSubsystemInfo pci_ss_info_14e4_1644_10b7_1008 = + {0x10b7, 0x1008, pci_subsys_14e4_1644_10b7_1008, 0}; +#undef pci_ss_info_10b7_1008 +#define pci_ss_info_10b7_1008 pci_ss_info_14e4_1644_10b7_1008 +static const pciSubsystemInfo pci_ss_info_14e4_1644_14e4_0002 = + {0x14e4, 0x0002, pci_subsys_14e4_1644_14e4_0002, 0}; +#undef pci_ss_info_14e4_0002 +#define pci_ss_info_14e4_0002 pci_ss_info_14e4_1644_14e4_0002 +static const pciSubsystemInfo pci_ss_info_14e4_1644_14e4_0003 = + {0x14e4, 0x0003, pci_subsys_14e4_1644_14e4_0003, 0}; +#undef pci_ss_info_14e4_0003 +#define pci_ss_info_14e4_0003 pci_ss_info_14e4_1644_14e4_0003 +static const pciSubsystemInfo pci_ss_info_14e4_1644_14e4_0004 = + {0x14e4, 0x0004, pci_subsys_14e4_1644_14e4_0004, 0}; +#undef pci_ss_info_14e4_0004 +#define pci_ss_info_14e4_0004 pci_ss_info_14e4_1644_14e4_0004 +static const pciSubsystemInfo pci_ss_info_14e4_1644_14e4_1028 = + {0x14e4, 0x1028, pci_subsys_14e4_1644_14e4_1028, 0}; +#undef pci_ss_info_14e4_1028 +#define pci_ss_info_14e4_1028 pci_ss_info_14e4_1644_14e4_1028 +static const pciSubsystemInfo pci_ss_info_14e4_1644_14e4_1644 = + {0x14e4, 0x1644, pci_subsys_14e4_1644_14e4_1644, 0}; +#undef pci_ss_info_14e4_1644 +#define pci_ss_info_14e4_1644 pci_ss_info_14e4_1644_14e4_1644 +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_0e11_007c = + {0x0e11, 0x007c, pci_subsys_14e4_1645_0e11_007c, 0}; +#undef pci_ss_info_0e11_007c +#define pci_ss_info_0e11_007c pci_ss_info_14e4_1645_0e11_007c +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_0e11_007d = + {0x0e11, 0x007d, pci_subsys_14e4_1645_0e11_007d, 0}; +#undef pci_ss_info_0e11_007d +#define pci_ss_info_0e11_007d pci_ss_info_14e4_1645_0e11_007d +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_0e11_0085 = + {0x0e11, 0x0085, pci_subsys_14e4_1645_0e11_0085, 0}; +#undef pci_ss_info_0e11_0085 +#define pci_ss_info_0e11_0085 pci_ss_info_14e4_1645_0e11_0085 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_0e11_0099 = + {0x0e11, 0x0099, pci_subsys_14e4_1645_0e11_0099, 0}; +#undef pci_ss_info_0e11_0099 +#define pci_ss_info_0e11_0099 pci_ss_info_14e4_1645_0e11_0099 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_0e11_009a = + {0x0e11, 0x009a, pci_subsys_14e4_1645_0e11_009a, 0}; +#undef pci_ss_info_0e11_009a +#define pci_ss_info_0e11_009a pci_ss_info_14e4_1645_0e11_009a +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_0e11_00c1 = + {0x0e11, 0x00c1, pci_subsys_14e4_1645_0e11_00c1, 0}; +#undef pci_ss_info_0e11_00c1 +#define pci_ss_info_0e11_00c1 pci_ss_info_14e4_1645_0e11_00c1 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1645_1028_0121 = + {0x1028, 0x0121, pci_subsys_14e4_1645_1028_0121, 0}; +#undef pci_ss_info_1028_0121 +#define pci_ss_info_1028_0121 pci_ss_info_14e4_1645_1028_0121 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_1645_10b7_1004 = + {0x10b7, 0x1004, pci_subsys_14e4_1645_10b7_1004, 0}; +#undef pci_ss_info_10b7_1004 +#define pci_ss_info_10b7_1004 pci_ss_info_14e4_1645_10b7_1004 +static const pciSubsystemInfo pci_ss_info_14e4_1645_10b7_1006 = + {0x10b7, 0x1006, pci_subsys_14e4_1645_10b7_1006, 0}; +#undef pci_ss_info_10b7_1006 +#define pci_ss_info_10b7_1006 pci_ss_info_14e4_1645_10b7_1006 +static const pciSubsystemInfo pci_ss_info_14e4_1645_10b7_1007 = + {0x10b7, 0x1007, pci_subsys_14e4_1645_10b7_1007, 0}; +#undef pci_ss_info_10b7_1007 +#define pci_ss_info_10b7_1007 pci_ss_info_14e4_1645_10b7_1007 +static const pciSubsystemInfo pci_ss_info_14e4_1645_10b7_1008 = + {0x10b7, 0x1008, pci_subsys_14e4_1645_10b7_1008, 0}; +#undef pci_ss_info_10b7_1008 +#define pci_ss_info_10b7_1008 pci_ss_info_14e4_1645_10b7_1008 +static const pciSubsystemInfo pci_ss_info_14e4_1645_14e4_0001 = + {0x14e4, 0x0001, pci_subsys_14e4_1645_14e4_0001, 0}; +#undef pci_ss_info_14e4_0001 +#define pci_ss_info_14e4_0001 pci_ss_info_14e4_1645_14e4_0001 +static const pciSubsystemInfo pci_ss_info_14e4_1645_14e4_0005 = + {0x14e4, 0x0005, pci_subsys_14e4_1645_14e4_0005, 0}; +#undef pci_ss_info_14e4_0005 +#define pci_ss_info_14e4_0005 pci_ss_info_14e4_1645_14e4_0005 +static const pciSubsystemInfo pci_ss_info_14e4_1645_14e4_0006 = + {0x14e4, 0x0006, pci_subsys_14e4_1645_14e4_0006, 0}; +#undef pci_ss_info_14e4_0006 +#define pci_ss_info_14e4_0006 pci_ss_info_14e4_1645_14e4_0006 +static const pciSubsystemInfo pci_ss_info_14e4_1645_14e4_0007 = + {0x14e4, 0x0007, pci_subsys_14e4_1645_14e4_0007, 0}; +#undef pci_ss_info_14e4_0007 +#define pci_ss_info_14e4_0007 pci_ss_info_14e4_1645_14e4_0007 +static const pciSubsystemInfo pci_ss_info_14e4_1645_14e4_0008 = + {0x14e4, 0x0008, pci_subsys_14e4_1645_14e4_0008, 0}; +#undef pci_ss_info_14e4_0008 +#define pci_ss_info_14e4_0008 pci_ss_info_14e4_1645_14e4_0008 +static const pciSubsystemInfo pci_ss_info_14e4_1645_14e4_8008 = + {0x14e4, 0x8008, pci_subsys_14e4_1645_14e4_8008, 0}; +#undef pci_ss_info_14e4_8008 +#define pci_ss_info_14e4_8008 pci_ss_info_14e4_1645_14e4_8008 +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1646_0e11_00bb = + {0x0e11, 0x00bb, pci_subsys_14e4_1646_0e11_00bb, 0}; +#undef pci_ss_info_0e11_00bb +#define pci_ss_info_0e11_00bb pci_ss_info_14e4_1646_0e11_00bb +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1646_1028_0126 = + {0x1028, 0x0126, pci_subsys_14e4_1646_1028_0126, 0}; +#undef pci_ss_info_1028_0126 +#define pci_ss_info_1028_0126 pci_ss_info_14e4_1646_1028_0126 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_1646_14e4_8009 = + {0x14e4, 0x8009, pci_subsys_14e4_1646_14e4_8009, 0}; +#undef pci_ss_info_14e4_8009 +#define pci_ss_info_14e4_8009 pci_ss_info_14e4_1646_14e4_8009 +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1647_0e11_0099 = + {0x0e11, 0x0099, pci_subsys_14e4_1647_0e11_0099, 0}; +#undef pci_ss_info_0e11_0099 +#define pci_ss_info_0e11_0099 pci_ss_info_14e4_1647_0e11_0099 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1647_0e11_009a = + {0x0e11, 0x009a, pci_subsys_14e4_1647_0e11_009a, 0}; +#undef pci_ss_info_0e11_009a +#define pci_ss_info_0e11_009a pci_ss_info_14e4_1647_0e11_009a +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_1647_14e4_0009 = + {0x14e4, 0x0009, pci_subsys_14e4_1647_14e4_0009, 0}; +#undef pci_ss_info_14e4_0009 +#define pci_ss_info_14e4_0009 pci_ss_info_14e4_1647_14e4_0009 +static const pciSubsystemInfo pci_ss_info_14e4_1647_14e4_000a = + {0x14e4, 0x000a, pci_subsys_14e4_1647_14e4_000a, 0}; +#undef pci_ss_info_14e4_000a +#define pci_ss_info_14e4_000a pci_ss_info_14e4_1647_14e4_000a +static const pciSubsystemInfo pci_ss_info_14e4_1647_14e4_000b = + {0x14e4, 0x000b, pci_subsys_14e4_1647_14e4_000b, 0}; +#undef pci_ss_info_14e4_000b +#define pci_ss_info_14e4_000b pci_ss_info_14e4_1647_14e4_000b +static const pciSubsystemInfo pci_ss_info_14e4_1647_14e4_8009 = + {0x14e4, 0x8009, pci_subsys_14e4_1647_14e4_8009, 0}; +#undef pci_ss_info_14e4_8009 +#define pci_ss_info_14e4_8009 pci_ss_info_14e4_1647_14e4_8009 +static const pciSubsystemInfo pci_ss_info_14e4_1647_14e4_800a = + {0x14e4, 0x800a, pci_subsys_14e4_1647_14e4_800a, 0}; +#undef pci_ss_info_14e4_800a +#define pci_ss_info_14e4_800a pci_ss_info_14e4_1647_14e4_800a +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1648_0e11_00cf = + {0x0e11, 0x00cf, pci_subsys_14e4_1648_0e11_00cf, 0}; +#undef pci_ss_info_0e11_00cf +#define pci_ss_info_0e11_00cf pci_ss_info_14e4_1648_0e11_00cf +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1648_0e11_00d0 = + {0x0e11, 0x00d0, pci_subsys_14e4_1648_0e11_00d0, 0}; +#undef pci_ss_info_0e11_00d0 +#define pci_ss_info_0e11_00d0 pci_ss_info_14e4_1648_0e11_00d0 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_1648_0e11_00d1 = + {0x0e11, 0x00d1, pci_subsys_14e4_1648_0e11_00d1, 0}; +#undef pci_ss_info_0e11_00d1 +#define pci_ss_info_0e11_00d1 pci_ss_info_14e4_1648_0e11_00d1 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_1648_10b7_2000 = + {0x10b7, 0x2000, pci_subsys_14e4_1648_10b7_2000, 0}; +#undef pci_ss_info_10b7_2000 +#define pci_ss_info_10b7_2000 pci_ss_info_14e4_1648_10b7_2000 +static const pciSubsystemInfo pci_ss_info_14e4_1648_10b7_3000 = + {0x10b7, 0x3000, pci_subsys_14e4_1648_10b7_3000, 0}; +#undef pci_ss_info_10b7_3000 +#define pci_ss_info_10b7_3000 pci_ss_info_14e4_1648_10b7_3000 +static const pciSubsystemInfo pci_ss_info_14e4_1648_1166_1648 = + {0x1166, 0x1648, pci_subsys_14e4_1648_1166_1648, 0}; +#undef pci_ss_info_1166_1648 +#define pci_ss_info_1166_1648 pci_ss_info_14e4_1648_1166_1648 +static const pciSubsystemInfo pci_ss_info_14e4_1696_14e4_000d = + {0x14e4, 0x000d, pci_subsys_14e4_1696_14e4_000d, 0}; +#undef pci_ss_info_14e4_000d +#define pci_ss_info_14e4_000d pci_ss_info_14e4_1696_14e4_000d +#endif +static const pciSubsystemInfo pci_ss_info_14e4_16a6_0e11_00bb = + {0x0e11, 0x00bb, pci_subsys_14e4_16a6_0e11_00bb, 0}; +#undef pci_ss_info_0e11_00bb +#define pci_ss_info_0e11_00bb pci_ss_info_14e4_16a6_0e11_00bb +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_16a6_1028_0126 = + {0x1028, 0x0126, pci_subsys_14e4_16a6_1028_0126, 0}; +#undef pci_ss_info_1028_0126 +#define pci_ss_info_1028_0126 pci_ss_info_14e4_16a6_1028_0126 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_16a6_14e4_000c = + {0x14e4, 0x000c, pci_subsys_14e4_16a6_14e4_000c, 0}; +#undef pci_ss_info_14e4_000c +#define pci_ss_info_14e4_000c pci_ss_info_14e4_16a6_14e4_000c +static const pciSubsystemInfo pci_ss_info_14e4_16a6_14e4_8009 = + {0x14e4, 0x8009, pci_subsys_14e4_16a6_14e4_8009, 0}; +#undef pci_ss_info_14e4_8009 +#define pci_ss_info_14e4_8009 pci_ss_info_14e4_16a6_14e4_8009 +#endif +static const pciSubsystemInfo pci_ss_info_14e4_16a7_0e11_00ca = + {0x0e11, 0x00ca, pci_subsys_14e4_16a7_0e11_00ca, 0}; +#undef pci_ss_info_0e11_00ca +#define pci_ss_info_0e11_00ca pci_ss_info_14e4_16a7_0e11_00ca +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14e4_16a7_0e11_00cb = + {0x0e11, 0x00cb, pci_subsys_14e4_16a7_0e11_00cb, 0}; +#undef pci_ss_info_0e11_00cb +#define pci_ss_info_0e11_00cb pci_ss_info_14e4_16a7_0e11_00cb +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14e4_16a7_14e4_0009 = + {0x14e4, 0x0009, pci_subsys_14e4_16a7_14e4_0009, 0}; +#undef pci_ss_info_14e4_0009 +#define pci_ss_info_14e4_0009 pci_ss_info_14e4_16a7_14e4_0009 +static const pciSubsystemInfo pci_ss_info_14e4_16a7_14e4_000a = + {0x14e4, 0x000a, pci_subsys_14e4_16a7_14e4_000a, 0}; +#undef pci_ss_info_14e4_000a +#define pci_ss_info_14e4_000a pci_ss_info_14e4_16a7_14e4_000a +static const pciSubsystemInfo pci_ss_info_14e4_16a7_14e4_000b = + {0x14e4, 0x000b, pci_subsys_14e4_16a7_14e4_000b, 0}; +#undef pci_ss_info_14e4_000b +#define pci_ss_info_14e4_000b pci_ss_info_14e4_16a7_14e4_000b +static const pciSubsystemInfo pci_ss_info_14e4_16a7_14e4_800a = + {0x14e4, 0x800a, pci_subsys_14e4_16a7_14e4_800a, 0}; +#undef pci_ss_info_14e4_800a +#define pci_ss_info_14e4_800a pci_ss_info_14e4_16a7_14e4_800a +static const pciSubsystemInfo pci_ss_info_14e4_16a8_10b7_2001 = + {0x10b7, 0x2001, pci_subsys_14e4_16a8_10b7_2001, 0}; +#undef pci_ss_info_10b7_2001 +#define pci_ss_info_10b7_2001 pci_ss_info_14e4_16a8_10b7_2001 +static const pciSubsystemInfo pci_ss_info_14e4_16c6_10b7_1100 = + {0x10b7, 0x1100, pci_subsys_14e4_16c6_10b7_1100, 0}; +#undef pci_ss_info_10b7_1100 +#define pci_ss_info_10b7_1100 pci_ss_info_14e4_16c6_10b7_1100 +static const pciSubsystemInfo pci_ss_info_14e4_16c6_14e4_000c = + {0x14e4, 0x000c, pci_subsys_14e4_16c6_14e4_000c, 0}; +#undef pci_ss_info_14e4_000c +#define pci_ss_info_14e4_000c pci_ss_info_14e4_16c6_14e4_000c +static const pciSubsystemInfo pci_ss_info_14e4_16c6_14e4_8009 = + {0x14e4, 0x8009, pci_subsys_14e4_16c6_14e4_8009, 0}; +#undef pci_ss_info_14e4_8009 +#define pci_ss_info_14e4_8009 pci_ss_info_14e4_16c6_14e4_8009 +static const pciSubsystemInfo pci_ss_info_14e4_16c7_14e4_0009 = + {0x14e4, 0x0009, pci_subsys_14e4_16c7_14e4_0009, 0}; +#undef pci_ss_info_14e4_0009 +#define pci_ss_info_14e4_0009 pci_ss_info_14e4_16c7_14e4_0009 +static const pciSubsystemInfo pci_ss_info_14e4_16c7_14e4_000a = + {0x14e4, 0x000a, pci_subsys_14e4_16c7_14e4_000a, 0}; +#undef pci_ss_info_14e4_000a +#define pci_ss_info_14e4_000a pci_ss_info_14e4_16c7_14e4_000a +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_1033_1033_8077 = + {0x1033, 0x8077, pci_subsys_14f1_1033_1033_8077, 0}; +#undef pci_ss_info_1033_8077 +#define pci_ss_info_1033_8077 pci_ss_info_14f1_1033_1033_8077 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14f1_1033_122d_4027 = + {0x122d, 0x4027, pci_subsys_14f1_1033_122d_4027, 0}; +#undef pci_ss_info_122d_4027 +#define pci_ss_info_122d_4027 pci_ss_info_14f1_1033_122d_4027 +static const pciSubsystemInfo pci_ss_info_14f1_1033_122d_4030 = + {0x122d, 0x4030, pci_subsys_14f1_1033_122d_4030, 0}; +#undef pci_ss_info_122d_4030 +#define pci_ss_info_122d_4030 pci_ss_info_14f1_1033_122d_4030 +static const pciSubsystemInfo pci_ss_info_14f1_1033_122d_4034 = + {0x122d, 0x4034, pci_subsys_14f1_1033_122d_4034, 0}; +#undef pci_ss_info_122d_4034 +#define pci_ss_info_122d_4034 pci_ss_info_14f1_1033_122d_4034 +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_020d = + {0x13e0, 0x020d, pci_subsys_14f1_1033_13e0_020d, 0}; +#undef pci_ss_info_13e0_020d +#define pci_ss_info_13e0_020d pci_ss_info_14f1_1033_13e0_020d +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_020e = + {0x13e0, 0x020e, pci_subsys_14f1_1033_13e0_020e, 0}; +#undef pci_ss_info_13e0_020e +#define pci_ss_info_13e0_020e pci_ss_info_14f1_1033_13e0_020e +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_0261 = + {0x13e0, 0x0261, pci_subsys_14f1_1033_13e0_0261, 0}; +#undef pci_ss_info_13e0_0261 +#define pci_ss_info_13e0_0261 pci_ss_info_14f1_1033_13e0_0261 +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_0290 = + {0x13e0, 0x0290, pci_subsys_14f1_1033_13e0_0290, 0}; +#undef pci_ss_info_13e0_0290 +#define pci_ss_info_13e0_0290 pci_ss_info_14f1_1033_13e0_0290 +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_02a0 = + {0x13e0, 0x02a0, pci_subsys_14f1_1033_13e0_02a0, 0}; +#undef pci_ss_info_13e0_02a0 +#define pci_ss_info_13e0_02a0 pci_ss_info_14f1_1033_13e0_02a0 +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_02b0 = + {0x13e0, 0x02b0, pci_subsys_14f1_1033_13e0_02b0, 0}; +#undef pci_ss_info_13e0_02b0 +#define pci_ss_info_13e0_02b0 pci_ss_info_14f1_1033_13e0_02b0 +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_02c0 = + {0x13e0, 0x02c0, pci_subsys_14f1_1033_13e0_02c0, 0}; +#undef pci_ss_info_13e0_02c0 +#define pci_ss_info_13e0_02c0 pci_ss_info_14f1_1033_13e0_02c0 +static const pciSubsystemInfo pci_ss_info_14f1_1033_13e0_02d0 = + {0x13e0, 0x02d0, pci_subsys_14f1_1033_13e0_02d0, 0}; +#undef pci_ss_info_13e0_02d0 +#define pci_ss_info_13e0_02d0 pci_ss_info_14f1_1033_13e0_02d0 +static const pciSubsystemInfo pci_ss_info_14f1_1033_144f_1500 = + {0x144f, 0x1500, pci_subsys_14f1_1033_144f_1500, 0}; +#undef pci_ss_info_144f_1500 +#define pci_ss_info_144f_1500 pci_ss_info_14f1_1033_144f_1500 +static const pciSubsystemInfo pci_ss_info_14f1_1033_144f_1501 = + {0x144f, 0x1501, pci_subsys_14f1_1033_144f_1501, 0}; +#undef pci_ss_info_144f_1501 +#define pci_ss_info_144f_1501 pci_ss_info_14f1_1033_144f_1501 +static const pciSubsystemInfo pci_ss_info_14f1_1033_144f_150a = + {0x144f, 0x150a, pci_subsys_14f1_1033_144f_150a, 0}; +#undef pci_ss_info_144f_150a +#define pci_ss_info_144f_150a pci_ss_info_14f1_1033_144f_150a +static const pciSubsystemInfo pci_ss_info_14f1_1033_144f_150b = + {0x144f, 0x150b, pci_subsys_14f1_1033_144f_150b, 0}; +#undef pci_ss_info_144f_150b +#define pci_ss_info_144f_150b pci_ss_info_14f1_1033_144f_150b +static const pciSubsystemInfo pci_ss_info_14f1_1033_144f_1510 = + {0x144f, 0x1510, pci_subsys_14f1_1033_144f_1510, 0}; +#undef pci_ss_info_144f_1510 +#define pci_ss_info_144f_1510 pci_ss_info_14f1_1033_144f_1510 +static const pciSubsystemInfo pci_ss_info_14f1_1035_10cf_1098 = + {0x10cf, 0x1098, pci_subsys_14f1_1035_10cf_1098, 0}; +#undef pci_ss_info_10cf_1098 +#define pci_ss_info_10cf_1098 pci_ss_info_14f1_1035_10cf_1098 +#endif +static const pciSubsystemInfo pci_ss_info_14f1_1036_104d_8067 = + {0x104d, 0x8067, pci_subsys_14f1_1036_104d_8067, 0}; +#undef pci_ss_info_104d_8067 +#define pci_ss_info_104d_8067 pci_ss_info_14f1_1036_104d_8067 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14f1_1036_122d_4029 = + {0x122d, 0x4029, pci_subsys_14f1_1036_122d_4029, 0}; +#undef pci_ss_info_122d_4029 +#define pci_ss_info_122d_4029 pci_ss_info_14f1_1036_122d_4029 +static const pciSubsystemInfo pci_ss_info_14f1_1036_122d_4031 = + {0x122d, 0x4031, pci_subsys_14f1_1036_122d_4031, 0}; +#undef pci_ss_info_122d_4031 +#define pci_ss_info_122d_4031 pci_ss_info_14f1_1036_122d_4031 +static const pciSubsystemInfo pci_ss_info_14f1_1036_13e0_0209 = + {0x13e0, 0x0209, pci_subsys_14f1_1036_13e0_0209, 0}; +#undef pci_ss_info_13e0_0209 +#define pci_ss_info_13e0_0209 pci_ss_info_14f1_1036_13e0_0209 +static const pciSubsystemInfo pci_ss_info_14f1_1036_13e0_020a = + {0x13e0, 0x020a, pci_subsys_14f1_1036_13e0_020a, 0}; +#undef pci_ss_info_13e0_020a +#define pci_ss_info_13e0_020a pci_ss_info_14f1_1036_13e0_020a +static const pciSubsystemInfo pci_ss_info_14f1_1036_13e0_0260 = + {0x13e0, 0x0260, pci_subsys_14f1_1036_13e0_0260, 0}; +#undef pci_ss_info_13e0_0260 +#define pci_ss_info_13e0_0260 pci_ss_info_14f1_1036_13e0_0260 +static const pciSubsystemInfo pci_ss_info_14f1_1036_13e0_0270 = + {0x13e0, 0x0270, pci_subsys_14f1_1036_13e0_0270, 0}; +#undef pci_ss_info_13e0_0270 +#define pci_ss_info_13e0_0270 pci_ss_info_14f1_1036_13e0_0270 +static const pciSubsystemInfo pci_ss_info_14f1_1066_122d_4033 = + {0x122d, 0x4033, pci_subsys_14f1_1066_122d_4033, 0}; +#undef pci_ss_info_122d_4033 +#define pci_ss_info_122d_4033 pci_ss_info_14f1_1066_122d_4033 +static const pciSubsystemInfo pci_ss_info_14f1_1453_13e0_0240 = + {0x13e0, 0x0240, pci_subsys_14f1_1453_13e0_0240, 0}; +#undef pci_ss_info_13e0_0240 +#define pci_ss_info_13e0_0240 pci_ss_info_14f1_1453_13e0_0240 +static const pciSubsystemInfo pci_ss_info_14f1_1453_13e0_0250 = + {0x13e0, 0x0250, pci_subsys_14f1_1453_13e0_0250, 0}; +#undef pci_ss_info_13e0_0250 +#define pci_ss_info_13e0_0250 pci_ss_info_14f1_1453_13e0_0250 +static const pciSubsystemInfo pci_ss_info_14f1_1453_144f_1502 = + {0x144f, 0x1502, pci_subsys_14f1_1453_144f_1502, 0}; +#undef pci_ss_info_144f_1502 +#define pci_ss_info_144f_1502 pci_ss_info_14f1_1453_144f_1502 +static const pciSubsystemInfo pci_ss_info_14f1_1453_144f_1503 = + {0x144f, 0x1503, pci_subsys_14f1_1453_144f_1503, 0}; +#undef pci_ss_info_144f_1503 +#define pci_ss_info_144f_1503 pci_ss_info_14f1_1453_144f_1503 +static const pciSubsystemInfo pci_ss_info_14f1_1456_122d_4035 = + {0x122d, 0x4035, pci_subsys_14f1_1456_122d_4035, 0}; +#undef pci_ss_info_122d_4035 +#define pci_ss_info_122d_4035 pci_ss_info_14f1_1456_122d_4035 +static const pciSubsystemInfo pci_ss_info_14f1_1456_122d_4302 = + {0x122d, 0x4302, pci_subsys_14f1_1456_122d_4302, 0}; +#undef pci_ss_info_122d_4302 +#define pci_ss_info_122d_4302 pci_ss_info_14f1_1456_122d_4302 +#endif +static const pciSubsystemInfo pci_ss_info_14f1_1803_0e11_0023 = + {0x0e11, 0x0023, pci_subsys_14f1_1803_0e11_0023, 0}; +#undef pci_ss_info_0e11_0023 +#define pci_ss_info_0e11_0023 pci_ss_info_14f1_1803_0e11_0023 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_1803_0e11_0043 = + {0x0e11, 0x0043, pci_subsys_14f1_1803_0e11_0043, 0}; +#undef pci_ss_info_0e11_0043 +#define pci_ss_info_0e11_0043 pci_ss_info_14f1_1803_0e11_0043 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_1815_0e11_0022 = + {0x0e11, 0x0022, pci_subsys_14f1_1815_0e11_0022, 0}; +#undef pci_ss_info_0e11_0022 +#define pci_ss_info_0e11_0022 pci_ss_info_14f1_1815_0e11_0022 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_1815_0e11_0042 = + {0x0e11, 0x0042, pci_subsys_14f1_1815_0e11_0042, 0}; +#undef pci_ss_info_0e11_0042 +#define pci_ss_info_0e11_0042 pci_ss_info_14f1_1815_0e11_0042 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2013_0e11_b195 = + {0x0e11, 0xb195, pci_subsys_14f1_2013_0e11_b195, 0}; +#undef pci_ss_info_0e11_b195 +#define pci_ss_info_0e11_b195 pci_ss_info_14f1_2013_0e11_b195 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2013_0e11_b196 = + {0x0e11, 0xb196, pci_subsys_14f1_2013_0e11_b196, 0}; +#undef pci_ss_info_0e11_b196 +#define pci_ss_info_0e11_b196 pci_ss_info_14f1_2013_0e11_b196 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2013_0e11_b1be = + {0x0e11, 0xb1be, pci_subsys_14f1_2013_0e11_b1be, 0}; +#undef pci_ss_info_0e11_b1be +#define pci_ss_info_0e11_b1be pci_ss_info_14f1_2013_0e11_b1be +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2013_1025_8013 = + {0x1025, 0x8013, pci_subsys_14f1_2013_1025_8013, 0}; +#undef pci_ss_info_1025_8013 +#define pci_ss_info_1025_8013 pci_ss_info_14f1_2013_1025_8013 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2013_1033_809d = + {0x1033, 0x809d, pci_subsys_14f1_2013_1033_809d, 0}; +#undef pci_ss_info_1033_809d +#define pci_ss_info_1033_809d pci_ss_info_14f1_2013_1033_809d +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2013_1033_80bc = + {0x1033, 0x80bc, pci_subsys_14f1_2013_1033_80bc, 0}; +#undef pci_ss_info_1033_80bc +#define pci_ss_info_1033_80bc pci_ss_info_14f1_2013_1033_80bc +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14f1_2013_155d_6793 = + {0x155d, 0x6793, pci_subsys_14f1_2013_155d_6793, 0}; +#undef pci_ss_info_155d_6793 +#define pci_ss_info_155d_6793 pci_ss_info_14f1_2013_155d_6793 +static const pciSubsystemInfo pci_ss_info_14f1_2013_155d_8850 = + {0x155d, 0x8850, pci_subsys_14f1_2013_155d_8850, 0}; +#undef pci_ss_info_155d_8850 +#define pci_ss_info_155d_8850 pci_ss_info_14f1_2013_155d_8850 +static const pciSubsystemInfo pci_ss_info_14f1_2093_155d_2f07 = + {0x155d, 0x2f07, pci_subsys_14f1_2093_155d_2f07, 0}; +#undef pci_ss_info_155d_2f07 +#define pci_ss_info_155d_2f07 pci_ss_info_14f1_2093_155d_2f07 +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2443_104d_8075 = + {0x104d, 0x8075, pci_subsys_14f1_2443_104d_8075, 0}; +#undef pci_ss_info_104d_8075 +#define pci_ss_info_104d_8075 pci_ss_info_14f1_2443_104d_8075 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2443_104d_8083 = + {0x104d, 0x8083, pci_subsys_14f1_2443_104d_8083, 0}; +#undef pci_ss_info_104d_8083 +#define pci_ss_info_104d_8083 pci_ss_info_14f1_2443_104d_8083 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_14f1_2443_104d_8097 = + {0x104d, 0x8097, pci_subsys_14f1_2443_104d_8097, 0}; +#undef pci_ss_info_104d_8097 +#define pci_ss_info_104d_8097 pci_ss_info_14f1_2443_104d_8097 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_14f1_2f00_13e0_8d84 = + {0x13e0, 0x8d84, pci_subsys_14f1_2f00_13e0_8d84, 0}; +#undef pci_ss_info_13e0_8d84 +#define pci_ss_info_13e0_8d84 pci_ss_info_14f1_2f00_13e0_8d84 +static const pciSubsystemInfo pci_ss_info_14f1_2f00_13e0_8d85 = + {0x13e0, 0x8d85, pci_subsys_14f1_2f00_13e0_8d85, 0}; +#undef pci_ss_info_13e0_8d85 +#define pci_ss_info_13e0_8d85 pci_ss_info_14f1_2f00_13e0_8d85 +static const pciSubsystemInfo pci_ss_info_14f1_2f00_14f1_2004 = + {0x14f1, 0x2004, pci_subsys_14f1_2f00_14f1_2004, 0}; +#undef pci_ss_info_14f1_2004 +#define pci_ss_info_14f1_2004 pci_ss_info_14f1_2f00_14f1_2004 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1516_0803_1320_10bd = + {0x1320, 0x10bd, pci_subsys_1516_0803_1320_10bd, 0}; +#undef pci_ss_info_1320_10bd +#define pci_ss_info_1320_10bd pci_ss_info_1516_0803_1320_10bd +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0200 = + {0x1522, 0x0200, pci_subsys_1522_0100_1522_0200, 0}; +#undef pci_ss_info_1522_0200 +#define pci_ss_info_1522_0200 pci_ss_info_1522_0100_1522_0200 +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0300 = + {0x1522, 0x0300, pci_subsys_1522_0100_1522_0300, 0}; +#undef pci_ss_info_1522_0300 +#define pci_ss_info_1522_0300 pci_ss_info_1522_0100_1522_0300 +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0400 = + {0x1522, 0x0400, pci_subsys_1522_0100_1522_0400, 0}; +#undef pci_ss_info_1522_0400 +#define pci_ss_info_1522_0400 pci_ss_info_1522_0100_1522_0400 +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0500 = + {0x1522, 0x0500, pci_subsys_1522_0100_1522_0500, 0}; +#undef pci_ss_info_1522_0500 +#define pci_ss_info_1522_0500 pci_ss_info_1522_0100_1522_0500 +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0600 = + {0x1522, 0x0600, pci_subsys_1522_0100_1522_0600, 0}; +#undef pci_ss_info_1522_0600 +#define pci_ss_info_1522_0600 pci_ss_info_1522_0100_1522_0600 +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0700 = + {0x1522, 0x0700, pci_subsys_1522_0100_1522_0700, 0}; +#undef pci_ss_info_1522_0700 +#define pci_ss_info_1522_0700 pci_ss_info_1522_0100_1522_0700 +static const pciSubsystemInfo pci_ss_info_1522_0100_1522_0800 = + {0x1522, 0x0800, pci_subsys_1522_0100_1522_0800, 0}; +#undef pci_ss_info_1522_0800 +#define pci_ss_info_1522_0800 pci_ss_info_1522_0100_1522_0800 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_173b_03ea_173b_0001 = + {0x173b, 0x0001, pci_subsys_173b_03ea_173b_0001, 0}; +#undef pci_ss_info_173b_0001 +#define pci_ss_info_173b_0001 pci_ss_info_173b_03ea_173b_0001 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_1813_4000_16be_0001 = + {0x16be, 0x0001, pci_subsys_1813_4000_16be_0001, 0}; +#undef pci_ss_info_16be_0001 +#define pci_ss_info_16be_0001 pci_ss_info_1813_4000_16be_0001 +static const pciSubsystemInfo pci_ss_info_1813_4100_16be_0002 = + {0x16be, 0x0002, pci_subsys_1813_4100_16be_0002, 0}; +#undef pci_ss_info_16be_0002 +#define pci_ss_info_16be_0002 pci_ss_info_1813_4100_16be_0002 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_3388_8011_3388_8011 = + {0x3388, 0x8011, pci_subsys_3388_8011_3388_8011, 0}; +#undef pci_ss_info_3388_8011 +#define pci_ss_info_3388_8011 pci_ss_info_3388_8011_3388_8011 +static const pciSubsystemInfo pci_ss_info_3388_8012_3388_8012 = + {0x3388, 0x8012, pci_subsys_3388_8012_3388_8012, 0}; +#undef pci_ss_info_3388_8012 +#define pci_ss_info_3388_8012 pci_ss_info_3388_8012_3388_8012 +static const pciSubsystemInfo pci_ss_info_3388_8013_3388_8013 = + {0x3388, 0x8013, pci_subsys_3388_8013_3388_8013, 0}; +#undef pci_ss_info_3388_8013 +#define pci_ss_info_3388_8013 pci_ss_info_3388_8013_3388_8013 +#endif +static const pciSubsystemInfo pci_ss_info_3d3d_0009_1040_0011 = + {0x1040, 0x0011, pci_subsys_3d3d_0009_1040_0011, 0}; +#undef pci_ss_info_1040_0011 +#define pci_ss_info_1040_0011 pci_ss_info_3d3d_0009_1040_0011 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0100 = + {0x3d3d, 0x0100, pci_subsys_3d3d_0009_3d3d_0100, 0}; +#undef pci_ss_info_3d3d_0100 +#define pci_ss_info_3d3d_0100 pci_ss_info_3d3d_0009_3d3d_0100 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0111 = + {0x3d3d, 0x0111, pci_subsys_3d3d_0009_3d3d_0111, 0}; +#undef pci_ss_info_3d3d_0111 +#define pci_ss_info_3d3d_0111 pci_ss_info_3d3d_0009_3d3d_0111 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0114 = + {0x3d3d, 0x0114, pci_subsys_3d3d_0009_3d3d_0114, 0}; +#undef pci_ss_info_3d3d_0114 +#define pci_ss_info_3d3d_0114 pci_ss_info_3d3d_0009_3d3d_0114 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0116 = + {0x3d3d, 0x0116, pci_subsys_3d3d_0009_3d3d_0116, 0}; +#undef pci_ss_info_3d3d_0116 +#define pci_ss_info_3d3d_0116 pci_ss_info_3d3d_0009_3d3d_0116 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0119 = + {0x3d3d, 0x0119, pci_subsys_3d3d_0009_3d3d_0119, 0}; +#undef pci_ss_info_3d3d_0119 +#define pci_ss_info_3d3d_0119 pci_ss_info_3d3d_0009_3d3d_0119 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0120 = + {0x3d3d, 0x0120, pci_subsys_3d3d_0009_3d3d_0120, 0}; +#undef pci_ss_info_3d3d_0120 +#define pci_ss_info_3d3d_0120 pci_ss_info_3d3d_0009_3d3d_0120 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0125 = + {0x3d3d, 0x0125, pci_subsys_3d3d_0009_3d3d_0125, 0}; +#undef pci_ss_info_3d3d_0125 +#define pci_ss_info_3d3d_0125 pci_ss_info_3d3d_0009_3d3d_0125 +static const pciSubsystemInfo pci_ss_info_3d3d_0009_3d3d_0127 = + {0x3d3d, 0x0127, pci_subsys_3d3d_0009_3d3d_0127, 0}; +#undef pci_ss_info_3d3d_0127 +#define pci_ss_info_3d3d_0127 pci_ss_info_3d3d_0009_3d3d_0127 +static const pciSubsystemInfo pci_ss_info_3d3d_000a_3d3d_0121 = + {0x3d3d, 0x0121, pci_subsys_3d3d_000a_3d3d_0121, 0}; +#undef pci_ss_info_3d3d_0121 +#define pci_ss_info_3d3d_0121 pci_ss_info_3d3d_000a_3d3d_0121 +static const pciSubsystemInfo pci_ss_info_3d3d_000c_3d3d_0144 = + {0x3d3d, 0x0144, pci_subsys_3d3d_000c_3d3d_0144, 0}; +#undef pci_ss_info_3d3d_0144 +#define pci_ss_info_3d3d_0144 pci_ss_info_3d3d_000c_3d3d_0144 +static const pciSubsystemInfo pci_ss_info_4005_4000_4005_4000 = + {0x4005, 0x4000, pci_subsys_4005_4000_4005_4000, 0}; +#undef pci_ss_info_4005_4000 +#define pci_ss_info_4005_4000 pci_ss_info_4005_4000_4005_4000 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_4a14_5000_4a14_5000 = + {0x4a14, 0x5000, pci_subsys_4a14_5000_4a14_5000, 0}; +#undef pci_ss_info_4a14_5000 +#define pci_ss_info_4a14_5000 pci_ss_info_4a14_5000_4a14_5000 +#endif +static const pciSubsystemInfo pci_ss_info_5333_8900_5333_8900 = + {0x5333, 0x8900, pci_subsys_5333_8900_5333_8900, 0}; +#undef pci_ss_info_5333_8900 +#define pci_ss_info_5333_8900 pci_ss_info_5333_8900_5333_8900 +static const pciSubsystemInfo pci_ss_info_5333_8901_5333_8901 = + {0x5333, 0x8901, pci_subsys_5333_8901_5333_8901, 0}; +#undef pci_ss_info_5333_8901 +#define pci_ss_info_5333_8901 pci_ss_info_5333_8901_5333_8901 +static const pciSubsystemInfo pci_ss_info_5333_8904_1014_00db = + {0x1014, 0x00db, pci_subsys_5333_8904_1014_00db, 0}; +#undef pci_ss_info_1014_00db +#define pci_ss_info_1014_00db pci_ss_info_5333_8904_1014_00db +static const pciSubsystemInfo pci_ss_info_5333_8904_5333_8904 = + {0x5333, 0x8904, pci_subsys_5333_8904_5333_8904, 0}; +#undef pci_ss_info_5333_8904 +#define pci_ss_info_5333_8904 pci_ss_info_5333_8904_5333_8904 +static const pciSubsystemInfo pci_ss_info_5333_8a01_0e11_b032 = + {0x0e11, 0xb032, pci_subsys_5333_8a01_0e11_b032, 0}; +#undef pci_ss_info_0e11_b032 +#define pci_ss_info_0e11_b032 pci_ss_info_5333_8a01_0e11_b032 +static const pciSubsystemInfo pci_ss_info_5333_8a01_10b4_1617 = + {0x10b4, 0x1617, pci_subsys_5333_8a01_10b4_1617, 0}; +#undef pci_ss_info_10b4_1617 +#define pci_ss_info_10b4_1617 pci_ss_info_5333_8a01_10b4_1617 +static const pciSubsystemInfo pci_ss_info_5333_8a01_10b4_1717 = + {0x10b4, 0x1717, pci_subsys_5333_8a01_10b4_1717, 0}; +#undef pci_ss_info_10b4_1717 +#define pci_ss_info_10b4_1717 pci_ss_info_5333_8a01_10b4_1717 +static const pciSubsystemInfo pci_ss_info_5333_8a01_5333_8a01 = + {0x5333, 0x8a01, pci_subsys_5333_8a01_5333_8a01, 0}; +#undef pci_ss_info_5333_8a01 +#define pci_ss_info_5333_8a01 pci_ss_info_5333_8a01_5333_8a01 +static const pciSubsystemInfo pci_ss_info_5333_8a10_1092_8a10 = + {0x1092, 0x8a10, pci_subsys_5333_8a10_1092_8a10, 0}; +#undef pci_ss_info_1092_8a10 +#define pci_ss_info_1092_8a10 pci_ss_info_5333_8a10_1092_8a10 +static const pciSubsystemInfo pci_ss_info_5333_8a13_5333_8a13 = + {0x5333, 0x8a13, pci_subsys_5333_8a13_5333_8a13, 0}; +#undef pci_ss_info_5333_8a13 +#define pci_ss_info_5333_8a13 pci_ss_info_5333_8a13_5333_8a13 +static const pciSubsystemInfo pci_ss_info_5333_8a20_5333_8a20 = + {0x5333, 0x8a20, pci_subsys_5333_8a20_5333_8a20, 0}; +#undef pci_ss_info_5333_8a20 +#define pci_ss_info_5333_8a20 pci_ss_info_5333_8a20_5333_8a20 +static const pciSubsystemInfo pci_ss_info_5333_8a21_5333_8a21 = + {0x5333, 0x8a21, pci_subsys_5333_8a21_5333_8a21, 0}; +#undef pci_ss_info_5333_8a21 +#define pci_ss_info_5333_8a21 pci_ss_info_5333_8a21_5333_8a21 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1033_8068 = + {0x1033, 0x8068, pci_subsys_5333_8a22_1033_8068, 0}; +#undef pci_ss_info_1033_8068 +#define pci_ss_info_1033_8068 pci_ss_info_5333_8a22_1033_8068 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1033_8069 = + {0x1033, 0x8069, pci_subsys_5333_8a22_1033_8069, 0}; +#undef pci_ss_info_1033_8069 +#define pci_ss_info_1033_8069 pci_ss_info_5333_8a22_1033_8069 +static const pciSubsystemInfo pci_ss_info_5333_8a22_105d_0018 = + {0x105d, 0x0018, pci_subsys_5333_8a22_105d_0018, 0}; +#undef pci_ss_info_105d_0018 +#define pci_ss_info_105d_0018 pci_ss_info_5333_8a22_105d_0018 +static const pciSubsystemInfo pci_ss_info_5333_8a22_105d_002a = + {0x105d, 0x002a, pci_subsys_5333_8a22_105d_002a, 0}; +#undef pci_ss_info_105d_002a +#define pci_ss_info_105d_002a pci_ss_info_5333_8a22_105d_002a +static const pciSubsystemInfo pci_ss_info_5333_8a22_105d_003a = + {0x105d, 0x003a, pci_subsys_5333_8a22_105d_003a, 0}; +#undef pci_ss_info_105d_003a +#define pci_ss_info_105d_003a pci_ss_info_5333_8a22_105d_003a +static const pciSubsystemInfo pci_ss_info_5333_8a22_105d_092f = + {0x105d, 0x092f, pci_subsys_5333_8a22_105d_092f, 0}; +#undef pci_ss_info_105d_092f +#define pci_ss_info_105d_092f pci_ss_info_5333_8a22_105d_092f +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4207 = + {0x1092, 0x4207, pci_subsys_5333_8a22_1092_4207, 0}; +#undef pci_ss_info_1092_4207 +#define pci_ss_info_1092_4207 pci_ss_info_5333_8a22_1092_4207 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4800 = + {0x1092, 0x4800, pci_subsys_5333_8a22_1092_4800, 0}; +#undef pci_ss_info_1092_4800 +#define pci_ss_info_1092_4800 pci_ss_info_5333_8a22_1092_4800 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4807 = + {0x1092, 0x4807, pci_subsys_5333_8a22_1092_4807, 0}; +#undef pci_ss_info_1092_4807 +#define pci_ss_info_1092_4807 pci_ss_info_5333_8a22_1092_4807 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4808 = + {0x1092, 0x4808, pci_subsys_5333_8a22_1092_4808, 0}; +#undef pci_ss_info_1092_4808 +#define pci_ss_info_1092_4808 pci_ss_info_5333_8a22_1092_4808 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4809 = + {0x1092, 0x4809, pci_subsys_5333_8a22_1092_4809, 0}; +#undef pci_ss_info_1092_4809 +#define pci_ss_info_1092_4809 pci_ss_info_5333_8a22_1092_4809 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_480e = + {0x1092, 0x480e, pci_subsys_5333_8a22_1092_480e, 0}; +#undef pci_ss_info_1092_480e +#define pci_ss_info_1092_480e pci_ss_info_5333_8a22_1092_480e +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4904 = + {0x1092, 0x4904, pci_subsys_5333_8a22_1092_4904, 0}; +#undef pci_ss_info_1092_4904 +#define pci_ss_info_1092_4904 pci_ss_info_5333_8a22_1092_4904 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4905 = + {0x1092, 0x4905, pci_subsys_5333_8a22_1092_4905, 0}; +#undef pci_ss_info_1092_4905 +#define pci_ss_info_1092_4905 pci_ss_info_5333_8a22_1092_4905 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4a09 = + {0x1092, 0x4a09, pci_subsys_5333_8a22_1092_4a09, 0}; +#undef pci_ss_info_1092_4a09 +#define pci_ss_info_1092_4a09 pci_ss_info_5333_8a22_1092_4a09 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4a0b = + {0x1092, 0x4a0b, pci_subsys_5333_8a22_1092_4a0b, 0}; +#undef pci_ss_info_1092_4a0b +#define pci_ss_info_1092_4a0b pci_ss_info_5333_8a22_1092_4a0b +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4a0f = + {0x1092, 0x4a0f, pci_subsys_5333_8a22_1092_4a0f, 0}; +#undef pci_ss_info_1092_4a0f +#define pci_ss_info_1092_4a0f pci_ss_info_5333_8a22_1092_4a0f +static const pciSubsystemInfo pci_ss_info_5333_8a22_1092_4e01 = + {0x1092, 0x4e01, pci_subsys_5333_8a22_1092_4e01, 0}; +#undef pci_ss_info_1092_4e01 +#define pci_ss_info_1092_4e01 pci_ss_info_5333_8a22_1092_4e01 +static const pciSubsystemInfo pci_ss_info_5333_8a22_1102_101d = + {0x1102, 0x101d, pci_subsys_5333_8a22_1102_101d, 0}; +#undef pci_ss_info_1102_101d +#define pci_ss_info_1102_101d pci_ss_info_5333_8a22_1102_101d +static const pciSubsystemInfo pci_ss_info_5333_8a22_1102_101e = + {0x1102, 0x101e, pci_subsys_5333_8a22_1102_101e, 0}; +#undef pci_ss_info_1102_101e +#define pci_ss_info_1102_101e pci_ss_info_5333_8a22_1102_101e +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_8100 = + {0x5333, 0x8100, pci_subsys_5333_8a22_5333_8100, 0}; +#undef pci_ss_info_5333_8100 +#define pci_ss_info_5333_8100 pci_ss_info_5333_8a22_5333_8100 +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_8110 = + {0x5333, 0x8110, pci_subsys_5333_8a22_5333_8110, 0}; +#undef pci_ss_info_5333_8110 +#define pci_ss_info_5333_8110 pci_ss_info_5333_8a22_5333_8110 +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_8125 = + {0x5333, 0x8125, pci_subsys_5333_8a22_5333_8125, 0}; +#undef pci_ss_info_5333_8125 +#define pci_ss_info_5333_8125 pci_ss_info_5333_8a22_5333_8125 +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_8143 = + {0x5333, 0x8143, pci_subsys_5333_8a22_5333_8143, 0}; +#undef pci_ss_info_5333_8143 +#define pci_ss_info_5333_8143 pci_ss_info_5333_8a22_5333_8143 +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_8a22 = + {0x5333, 0x8a22, pci_subsys_5333_8a22_5333_8a22, 0}; +#undef pci_ss_info_5333_8a22 +#define pci_ss_info_5333_8a22 pci_ss_info_5333_8a22_5333_8a22 +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_8a2e = + {0x5333, 0x8a2e, pci_subsys_5333_8a22_5333_8a2e, 0}; +#undef pci_ss_info_5333_8a2e +#define pci_ss_info_5333_8a2e pci_ss_info_5333_8a22_5333_8a2e +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_9125 = + {0x5333, 0x9125, pci_subsys_5333_8a22_5333_9125, 0}; +#undef pci_ss_info_5333_9125 +#define pci_ss_info_5333_9125 pci_ss_info_5333_8a22_5333_9125 +static const pciSubsystemInfo pci_ss_info_5333_8a22_5333_9143 = + {0x5333, 0x9143, pci_subsys_5333_8a22_5333_9143, 0}; +#undef pci_ss_info_5333_9143 +#define pci_ss_info_5333_9143 pci_ss_info_5333_8a22_5333_9143 +static const pciSubsystemInfo pci_ss_info_5333_8c01_1179_0001 = + {0x1179, 0x0001, pci_subsys_5333_8c01_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_5333_8c01_1179_0001 +static const pciSubsystemInfo pci_ss_info_5333_8c12_1014_017f = + {0x1014, 0x017f, pci_subsys_5333_8c12_1014_017f, 0}; +#undef pci_ss_info_1014_017f +#define pci_ss_info_1014_017f pci_ss_info_5333_8c12_1014_017f +static const pciSubsystemInfo pci_ss_info_5333_8c13_1179_0001 = + {0x1179, 0x0001, pci_subsys_5333_8c13_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_5333_8c13_1179_0001 +static const pciSubsystemInfo pci_ss_info_5333_8c2e_1014_01fc = + {0x1014, 0x01fc, pci_subsys_5333_8c2e_1014_01fc, 0}; +#undef pci_ss_info_1014_01fc +#define pci_ss_info_1014_01fc pci_ss_info_5333_8c2e_1014_01fc +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5932 = + {0x1092, 0x5932, pci_subsys_5333_9102_1092_5932, 0}; +#undef pci_ss_info_1092_5932 +#define pci_ss_info_1092_5932 pci_ss_info_5333_9102_1092_5932 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5934 = + {0x1092, 0x5934, pci_subsys_5333_9102_1092_5934, 0}; +#undef pci_ss_info_1092_5934 +#define pci_ss_info_1092_5934 pci_ss_info_5333_9102_1092_5934 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5952 = + {0x1092, 0x5952, pci_subsys_5333_9102_1092_5952, 0}; +#undef pci_ss_info_1092_5952 +#define pci_ss_info_1092_5952 pci_ss_info_5333_9102_1092_5952 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5954 = + {0x1092, 0x5954, pci_subsys_5333_9102_1092_5954, 0}; +#undef pci_ss_info_1092_5954 +#define pci_ss_info_1092_5954 pci_ss_info_5333_9102_1092_5954 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5a35 = + {0x1092, 0x5a35, pci_subsys_5333_9102_1092_5a35, 0}; +#undef pci_ss_info_1092_5a35 +#define pci_ss_info_1092_5a35 pci_ss_info_5333_9102_1092_5a35 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5a37 = + {0x1092, 0x5a37, pci_subsys_5333_9102_1092_5a37, 0}; +#undef pci_ss_info_1092_5a37 +#define pci_ss_info_1092_5a37 pci_ss_info_5333_9102_1092_5a37 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5a55 = + {0x1092, 0x5a55, pci_subsys_5333_9102_1092_5a55, 0}; +#undef pci_ss_info_1092_5a55 +#define pci_ss_info_1092_5a55 pci_ss_info_5333_9102_1092_5a55 +static const pciSubsystemInfo pci_ss_info_5333_9102_1092_5a57 = + {0x1092, 0x5a57, pci_subsys_5333_9102_1092_5a57, 0}; +#undef pci_ss_info_1092_5a57 +#define pci_ss_info_1092_5a57 pci_ss_info_5333_9102_1092_5a57 +static const pciSubsystemInfo pci_ss_info_8086_1000_0e11_b0df = + {0x0e11, 0xb0df, pci_subsys_8086_1000_0e11_b0df, 0}; +#undef pci_ss_info_0e11_b0df +#define pci_ss_info_0e11_b0df pci_ss_info_8086_1000_0e11_b0df +static const pciSubsystemInfo pci_ss_info_8086_1000_0e11_b0e0 = + {0x0e11, 0xb0e0, pci_subsys_8086_1000_0e11_b0e0, 0}; +#undef pci_ss_info_0e11_b0e0 +#define pci_ss_info_0e11_b0e0 pci_ss_info_8086_1000_0e11_b0e0 +static const pciSubsystemInfo pci_ss_info_8086_1000_0e11_b123 = + {0x0e11, 0xb123, pci_subsys_8086_1000_0e11_b123, 0}; +#undef pci_ss_info_0e11_b123 +#define pci_ss_info_0e11_b123 pci_ss_info_8086_1000_0e11_b123 +static const pciSubsystemInfo pci_ss_info_8086_1000_1014_0119 = + {0x1014, 0x0119, pci_subsys_8086_1000_1014_0119, 0}; +#undef pci_ss_info_1014_0119 +#define pci_ss_info_1014_0119 pci_ss_info_8086_1000_1014_0119 +static const pciSubsystemInfo pci_ss_info_8086_1000_8086_1000 = + {0x8086, 0x1000, pci_subsys_8086_1000_8086_1000, 0}; +#undef pci_ss_info_8086_1000 +#define pci_ss_info_8086_1000 pci_ss_info_8086_1000_8086_1000 +static const pciSubsystemInfo pci_ss_info_8086_1001_0e11_004a = + {0x0e11, 0x004a, pci_subsys_8086_1001_0e11_004a, 0}; +#undef pci_ss_info_0e11_004a +#define pci_ss_info_0e11_004a pci_ss_info_8086_1001_0e11_004a +static const pciSubsystemInfo pci_ss_info_8086_1001_1014_01ea = + {0x1014, 0x01ea, pci_subsys_8086_1001_1014_01ea, 0}; +#undef pci_ss_info_1014_01ea +#define pci_ss_info_1014_01ea pci_ss_info_8086_1001_1014_01ea +static const pciSubsystemInfo pci_ss_info_8086_1001_8086_1003 = + {0x8086, 0x1003, pci_subsys_8086_1001_8086_1003, 0}; +#undef pci_ss_info_8086_1003 +#define pci_ss_info_8086_1003 pci_ss_info_8086_1001_8086_1003 +static const pciSubsystemInfo pci_ss_info_8086_1002_8086_200e = + {0x8086, 0x200e, pci_subsys_8086_1002_8086_200e, 0}; +#undef pci_ss_info_8086_200e +#define pci_ss_info_8086_200e pci_ss_info_8086_1002_8086_200e +static const pciSubsystemInfo pci_ss_info_8086_1002_8086_2013 = + {0x8086, 0x2013, pci_subsys_8086_1002_8086_2013, 0}; +#undef pci_ss_info_8086_2013 +#define pci_ss_info_8086_2013 pci_ss_info_8086_1002_8086_2013 +static const pciSubsystemInfo pci_ss_info_8086_1002_8086_2017 = + {0x8086, 0x2017, pci_subsys_8086_1002_8086_2017, 0}; +#undef pci_ss_info_8086_2017 +#define pci_ss_info_8086_2017 pci_ss_info_8086_1002_8086_2017 +static const pciSubsystemInfo pci_ss_info_8086_1004_0e11_0049 = + {0x0e11, 0x0049, pci_subsys_8086_1004_0e11_0049, 0}; +#undef pci_ss_info_0e11_0049 +#define pci_ss_info_0e11_0049 pci_ss_info_8086_1004_0e11_0049 +static const pciSubsystemInfo pci_ss_info_8086_1004_0e11_b1a4 = + {0x0e11, 0xb1a4, pci_subsys_8086_1004_0e11_b1a4, 0}; +#undef pci_ss_info_0e11_b1a4 +#define pci_ss_info_0e11_b1a4 pci_ss_info_8086_1004_0e11_b1a4 +static const pciSubsystemInfo pci_ss_info_8086_1004_1014_10f2 = + {0x1014, 0x10f2, pci_subsys_8086_1004_1014_10f2, 0}; +#undef pci_ss_info_1014_10f2 +#define pci_ss_info_1014_10f2 pci_ss_info_8086_1004_1014_10f2 +static const pciSubsystemInfo pci_ss_info_8086_1004_8086_1004 = + {0x8086, 0x1004, pci_subsys_8086_1004_8086_1004, 0}; +#undef pci_ss_info_8086_1004 +#define pci_ss_info_8086_1004 pci_ss_info_8086_1004_8086_1004 +static const pciSubsystemInfo pci_ss_info_8086_1004_8086_2004 = + {0x8086, 0x2004, pci_subsys_8086_1004_8086_2004, 0}; +#undef pci_ss_info_8086_2004 +#define pci_ss_info_8086_2004 pci_ss_info_8086_1004_8086_2004 +static const pciSubsystemInfo pci_ss_info_8086_1008_8086_1107 = + {0x8086, 0x1107, pci_subsys_8086_1008_8086_1107, 0}; +#undef pci_ss_info_8086_1107 +#define pci_ss_info_8086_1107 pci_ss_info_8086_1008_8086_1107 +static const pciSubsystemInfo pci_ss_info_8086_1008_8086_2107 = + {0x8086, 0x2107, pci_subsys_8086_1008_8086_2107, 0}; +#undef pci_ss_info_8086_2107 +#define pci_ss_info_8086_2107 pci_ss_info_8086_1008_8086_2107 +static const pciSubsystemInfo pci_ss_info_8086_1008_8086_2110 = + {0x8086, 0x2110, pci_subsys_8086_1008_8086_2110, 0}; +#undef pci_ss_info_8086_2110 +#define pci_ss_info_8086_2110 pci_ss_info_8086_1008_8086_2110 +static const pciSubsystemInfo pci_ss_info_8086_1009_8086_1109 = + {0x8086, 0x1109, pci_subsys_8086_1009_8086_1109, 0}; +#undef pci_ss_info_8086_1109 +#define pci_ss_info_8086_1109 pci_ss_info_8086_1009_8086_1109 +static const pciSubsystemInfo pci_ss_info_8086_1009_8086_2109 = + {0x8086, 0x2109, pci_subsys_8086_1009_8086_2109, 0}; +#undef pci_ss_info_8086_2109 +#define pci_ss_info_8086_2109 pci_ss_info_8086_1009_8086_2109 +static const pciSubsystemInfo pci_ss_info_8086_100c_8086_1112 = + {0x8086, 0x1112, pci_subsys_8086_100c_8086_1112, 0}; +#undef pci_ss_info_8086_1112 +#define pci_ss_info_8086_1112 pci_ss_info_8086_100c_8086_1112 +static const pciSubsystemInfo pci_ss_info_8086_100c_8086_2112 = + {0x8086, 0x2112, pci_subsys_8086_100c_8086_2112, 0}; +#undef pci_ss_info_8086_2112 +#define pci_ss_info_8086_2112 pci_ss_info_8086_100c_8086_2112 +static const pciSubsystemInfo pci_ss_info_8086_100e_8086_001e = + {0x8086, 0x001e, pci_subsys_8086_100e_8086_001e, 0}; +#undef pci_ss_info_8086_001e +#define pci_ss_info_8086_001e pci_ss_info_8086_100e_8086_001e +static const pciSubsystemInfo pci_ss_info_8086_100e_8086_002e = + {0x8086, 0x002e, pci_subsys_8086_100e_8086_002e, 0}; +#undef pci_ss_info_8086_002e +#define pci_ss_info_8086_002e pci_ss_info_8086_100e_8086_002e +static const pciSubsystemInfo pci_ss_info_8086_100f_8086_1001 = + {0x8086, 0x1001, pci_subsys_8086_100f_8086_1001, 0}; +#undef pci_ss_info_8086_1001 +#define pci_ss_info_8086_1001 pci_ss_info_8086_100f_8086_1001 +static const pciSubsystemInfo pci_ss_info_8086_1010_8086_1011 = + {0x8086, 0x1011, pci_subsys_8086_1010_8086_1011, 0}; +#undef pci_ss_info_8086_1011 +#define pci_ss_info_8086_1011 pci_ss_info_8086_1010_8086_1011 +static const pciSubsystemInfo pci_ss_info_8086_1011_8086_1002 = + {0x8086, 0x1002, pci_subsys_8086_1011_8086_1002, 0}; +#undef pci_ss_info_8086_1002 +#define pci_ss_info_8086_1002 pci_ss_info_8086_1011_8086_1002 +static const pciSubsystemInfo pci_ss_info_8086_1012_8086_1012 = + {0x8086, 0x1012, pci_subsys_8086_1012_8086_1012, 0}; +#undef pci_ss_info_8086_1012 +#define pci_ss_info_8086_1012 pci_ss_info_8086_1012_8086_1012 +static const pciSubsystemInfo pci_ss_info_8086_1031_1014_0209 = + {0x1014, 0x0209, pci_subsys_8086_1031_1014_0209, 0}; +#undef pci_ss_info_1014_0209 +#define pci_ss_info_1014_0209 pci_ss_info_8086_1031_1014_0209 +static const pciSubsystemInfo pci_ss_info_8086_1031_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_1031_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_1031_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_1031_107b_5350 = + {0x107b, 0x5350, pci_subsys_8086_1031_107b_5350, 0}; +#undef pci_ss_info_107b_5350 +#define pci_ss_info_107b_5350 pci_ss_info_8086_1031_107b_5350 +static const pciSubsystemInfo pci_ss_info_8086_1031_1179_0001 = + {0x1179, 0x0001, pci_subsys_8086_1031_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_8086_1031_1179_0001 +static const pciSubsystemInfo pci_ss_info_8086_1031_144d_c000 = + {0x144d, 0xc000, pci_subsys_8086_1031_144d_c000, 0}; +#undef pci_ss_info_144d_c000 +#define pci_ss_info_144d_c000 pci_ss_info_8086_1031_144d_c000 +static const pciSubsystemInfo pci_ss_info_8086_1031_144d_c001 = + {0x144d, 0xc001, pci_subsys_8086_1031_144d_c001, 0}; +#undef pci_ss_info_144d_c001 +#define pci_ss_info_144d_c001 pci_ss_info_8086_1031_144d_c001 +static const pciSubsystemInfo pci_ss_info_8086_1031_144d_c003 = + {0x144d, 0xc003, pci_subsys_8086_1031_144d_c003, 0}; +#undef pci_ss_info_144d_c003 +#define pci_ss_info_144d_c003 pci_ss_info_8086_1031_144d_c003 +static const pciSubsystemInfo pci_ss_info_8086_1031_144d_c006 = + {0x144d, 0xc006, pci_subsys_8086_1031_144d_c006, 0}; +#undef pci_ss_info_144d_c006 +#define pci_ss_info_144d_c006 pci_ss_info_8086_1031_144d_c006 +static const pciSubsystemInfo pci_ss_info_8086_1040_16be_1040 = + {0x16be, 0x1040, pci_subsys_8086_1040_16be_1040, 0}; +#undef pci_ss_info_16be_1040 +#define pci_ss_info_16be_1040 pci_ss_info_8086_1040_16be_1040 +static const pciSubsystemInfo pci_ss_info_8086_1130_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_1130_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_1130_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_1130_1043_8027 = + {0x1043, 0x8027, pci_subsys_8086_1130_1043_8027, 0}; +#undef pci_ss_info_1043_8027 +#define pci_ss_info_1043_8027 pci_ss_info_8086_1130_1043_8027 +static const pciSubsystemInfo pci_ss_info_8086_1130_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_1130_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_1130_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_1132_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_1132_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_1132_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_1132_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_1132_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_1132_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_1161_8086_1161 = + {0x8086, 0x1161, pci_subsys_8086_1161_8086_1161, 0}; +#undef pci_ss_info_8086_1161 +#define pci_ss_info_8086_1161 pci_ss_info_8086_1161_8086_1161 +static const pciSubsystemInfo pci_ss_info_8086_1200_172a_0000 = + {0x172a, 0x0000, pci_subsys_8086_1200_172a_0000, 0}; +#undef pci_ss_info_172a_0000 +#define pci_ss_info_172a_0000 pci_ss_info_8086_1200_172a_0000 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3001 = + {0x0e11, 0x3001, pci_subsys_8086_1229_0e11_3001, 0}; +#undef pci_ss_info_0e11_3001 +#define pci_ss_info_0e11_3001 pci_ss_info_8086_1229_0e11_3001 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3002 = + {0x0e11, 0x3002, pci_subsys_8086_1229_0e11_3002, 0}; +#undef pci_ss_info_0e11_3002 +#define pci_ss_info_0e11_3002 pci_ss_info_8086_1229_0e11_3002 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3003 = + {0x0e11, 0x3003, pci_subsys_8086_1229_0e11_3003, 0}; +#undef pci_ss_info_0e11_3003 +#define pci_ss_info_0e11_3003 pci_ss_info_8086_1229_0e11_3003 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3004 = + {0x0e11, 0x3004, pci_subsys_8086_1229_0e11_3004, 0}; +#undef pci_ss_info_0e11_3004 +#define pci_ss_info_0e11_3004 pci_ss_info_8086_1229_0e11_3004 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3005 = + {0x0e11, 0x3005, pci_subsys_8086_1229_0e11_3005, 0}; +#undef pci_ss_info_0e11_3005 +#define pci_ss_info_0e11_3005 pci_ss_info_8086_1229_0e11_3005 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3006 = + {0x0e11, 0x3006, pci_subsys_8086_1229_0e11_3006, 0}; +#undef pci_ss_info_0e11_3006 +#define pci_ss_info_0e11_3006 pci_ss_info_8086_1229_0e11_3006 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_3007 = + {0x0e11, 0x3007, pci_subsys_8086_1229_0e11_3007, 0}; +#undef pci_ss_info_0e11_3007 +#define pci_ss_info_0e11_3007 pci_ss_info_8086_1229_0e11_3007 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b01e = + {0x0e11, 0xb01e, pci_subsys_8086_1229_0e11_b01e, 0}; +#undef pci_ss_info_0e11_b01e +#define pci_ss_info_0e11_b01e pci_ss_info_8086_1229_0e11_b01e +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b01f = + {0x0e11, 0xb01f, pci_subsys_8086_1229_0e11_b01f, 0}; +#undef pci_ss_info_0e11_b01f +#define pci_ss_info_0e11_b01f pci_ss_info_8086_1229_0e11_b01f +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b02f = + {0x0e11, 0xb02f, pci_subsys_8086_1229_0e11_b02f, 0}; +#undef pci_ss_info_0e11_b02f +#define pci_ss_info_0e11_b02f pci_ss_info_8086_1229_0e11_b02f +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b04a = + {0x0e11, 0xb04a, pci_subsys_8086_1229_0e11_b04a, 0}; +#undef pci_ss_info_0e11_b04a +#define pci_ss_info_0e11_b04a pci_ss_info_8086_1229_0e11_b04a +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b0c6 = + {0x0e11, 0xb0c6, pci_subsys_8086_1229_0e11_b0c6, 0}; +#undef pci_ss_info_0e11_b0c6 +#define pci_ss_info_0e11_b0c6 pci_ss_info_8086_1229_0e11_b0c6 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b0c7 = + {0x0e11, 0xb0c7, pci_subsys_8086_1229_0e11_b0c7, 0}; +#undef pci_ss_info_0e11_b0c7 +#define pci_ss_info_0e11_b0c7 pci_ss_info_8086_1229_0e11_b0c7 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b0d7 = + {0x0e11, 0xb0d7, pci_subsys_8086_1229_0e11_b0d7, 0}; +#undef pci_ss_info_0e11_b0d7 +#define pci_ss_info_0e11_b0d7 pci_ss_info_8086_1229_0e11_b0d7 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b0dd = + {0x0e11, 0xb0dd, pci_subsys_8086_1229_0e11_b0dd, 0}; +#undef pci_ss_info_0e11_b0dd +#define pci_ss_info_0e11_b0dd pci_ss_info_8086_1229_0e11_b0dd +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b0de = + {0x0e11, 0xb0de, pci_subsys_8086_1229_0e11_b0de, 0}; +#undef pci_ss_info_0e11_b0de +#define pci_ss_info_0e11_b0de pci_ss_info_8086_1229_0e11_b0de +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b0e1 = + {0x0e11, 0xb0e1, pci_subsys_8086_1229_0e11_b0e1, 0}; +#undef pci_ss_info_0e11_b0e1 +#define pci_ss_info_0e11_b0e1 pci_ss_info_8086_1229_0e11_b0e1 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b134 = + {0x0e11, 0xb134, pci_subsys_8086_1229_0e11_b134, 0}; +#undef pci_ss_info_0e11_b134 +#define pci_ss_info_0e11_b134 pci_ss_info_8086_1229_0e11_b134 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b13c = + {0x0e11, 0xb13c, pci_subsys_8086_1229_0e11_b13c, 0}; +#undef pci_ss_info_0e11_b13c +#define pci_ss_info_0e11_b13c pci_ss_info_8086_1229_0e11_b13c +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b144 = + {0x0e11, 0xb144, pci_subsys_8086_1229_0e11_b144, 0}; +#undef pci_ss_info_0e11_b144 +#define pci_ss_info_0e11_b144 pci_ss_info_8086_1229_0e11_b144 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b163 = + {0x0e11, 0xb163, pci_subsys_8086_1229_0e11_b163, 0}; +#undef pci_ss_info_0e11_b163 +#define pci_ss_info_0e11_b163 pci_ss_info_8086_1229_0e11_b163 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b164 = + {0x0e11, 0xb164, pci_subsys_8086_1229_0e11_b164, 0}; +#undef pci_ss_info_0e11_b164 +#define pci_ss_info_0e11_b164 pci_ss_info_8086_1229_0e11_b164 +static const pciSubsystemInfo pci_ss_info_8086_1229_0e11_b1a4 = + {0x0e11, 0xb1a4, pci_subsys_8086_1229_0e11_b1a4, 0}; +#undef pci_ss_info_0e11_b1a4 +#define pci_ss_info_0e11_b1a4 pci_ss_info_8086_1229_0e11_b1a4 +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_005c = + {0x1014, 0x005c, pci_subsys_8086_1229_1014_005c, 0}; +#undef pci_ss_info_1014_005c +#define pci_ss_info_1014_005c pci_ss_info_8086_1229_1014_005c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_01bc = + {0x1014, 0x01bc, pci_subsys_8086_1229_1014_01bc, 0}; +#undef pci_ss_info_1014_01bc +#define pci_ss_info_1014_01bc pci_ss_info_8086_1229_1014_01bc +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_01f1 = + {0x1014, 0x01f1, pci_subsys_8086_1229_1014_01f1, 0}; +#undef pci_ss_info_1014_01f1 +#define pci_ss_info_1014_01f1 pci_ss_info_8086_1229_1014_01f1 +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_01f2 = + {0x1014, 0x01f2, pci_subsys_8086_1229_1014_01f2, 0}; +#undef pci_ss_info_1014_01f2 +#define pci_ss_info_1014_01f2 pci_ss_info_8086_1229_1014_01f2 +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_0207 = + {0x1014, 0x0207, pci_subsys_8086_1229_1014_0207, 0}; +#undef pci_ss_info_1014_0207 +#define pci_ss_info_1014_0207 pci_ss_info_8086_1229_1014_0207 +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_0232 = + {0x1014, 0x0232, pci_subsys_8086_1229_1014_0232, 0}; +#undef pci_ss_info_1014_0232 +#define pci_ss_info_1014_0232 pci_ss_info_8086_1229_1014_0232 +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_023a = + {0x1014, 0x023a, pci_subsys_8086_1229_1014_023a, 0}; +#undef pci_ss_info_1014_023a +#define pci_ss_info_1014_023a pci_ss_info_8086_1229_1014_023a +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_105c = + {0x1014, 0x105c, pci_subsys_8086_1229_1014_105c, 0}; +#undef pci_ss_info_1014_105c +#define pci_ss_info_1014_105c pci_ss_info_8086_1229_1014_105c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_2205 = + {0x1014, 0x2205, pci_subsys_8086_1229_1014_2205, 0}; +#undef pci_ss_info_1014_2205 +#define pci_ss_info_1014_2205 pci_ss_info_8086_1229_1014_2205 +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_305c = + {0x1014, 0x305c, pci_subsys_8086_1229_1014_305c, 0}; +#undef pci_ss_info_1014_305c +#define pci_ss_info_1014_305c pci_ss_info_8086_1229_1014_305c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_405c = + {0x1014, 0x405c, pci_subsys_8086_1229_1014_405c, 0}; +#undef pci_ss_info_1014_405c +#define pci_ss_info_1014_405c pci_ss_info_8086_1229_1014_405c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_505c = + {0x1014, 0x505c, pci_subsys_8086_1229_1014_505c, 0}; +#undef pci_ss_info_1014_505c +#define pci_ss_info_1014_505c pci_ss_info_8086_1229_1014_505c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_605c = + {0x1014, 0x605c, pci_subsys_8086_1229_1014_605c, 0}; +#undef pci_ss_info_1014_605c +#define pci_ss_info_1014_605c pci_ss_info_8086_1229_1014_605c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_705c = + {0x1014, 0x705c, pci_subsys_8086_1229_1014_705c, 0}; +#undef pci_ss_info_1014_705c +#define pci_ss_info_1014_705c pci_ss_info_8086_1229_1014_705c +static const pciSubsystemInfo pci_ss_info_8086_1229_1014_805c = + {0x1014, 0x805c, pci_subsys_8086_1229_1014_805c, 0}; +#undef pci_ss_info_1014_805c +#define pci_ss_info_1014_805c pci_ss_info_8086_1229_1014_805c +static const pciSubsystemInfo pci_ss_info_8086_1229_1028_009b = + {0x1028, 0x009b, pci_subsys_8086_1229_1028_009b, 0}; +#undef pci_ss_info_1028_009b +#define pci_ss_info_1028_009b pci_ss_info_8086_1229_1028_009b +static const pciSubsystemInfo pci_ss_info_8086_1229_1033_8000 = + {0x1033, 0x8000, pci_subsys_8086_1229_1033_8000, 0}; +#undef pci_ss_info_1033_8000 +#define pci_ss_info_1033_8000 pci_ss_info_8086_1229_1033_8000 +static const pciSubsystemInfo pci_ss_info_8086_1229_1033_8016 = + {0x1033, 0x8016, pci_subsys_8086_1229_1033_8016, 0}; +#undef pci_ss_info_1033_8016 +#define pci_ss_info_1033_8016 pci_ss_info_8086_1229_1033_8016 +static const pciSubsystemInfo pci_ss_info_8086_1229_1033_801f = + {0x1033, 0x801f, pci_subsys_8086_1229_1033_801f, 0}; +#undef pci_ss_info_1033_801f +#define pci_ss_info_1033_801f pci_ss_info_8086_1229_1033_801f +static const pciSubsystemInfo pci_ss_info_8086_1229_1033_8026 = + {0x1033, 0x8026, pci_subsys_8086_1229_1033_8026, 0}; +#undef pci_ss_info_1033_8026 +#define pci_ss_info_1033_8026 pci_ss_info_8086_1229_1033_8026 +static const pciSubsystemInfo pci_ss_info_8086_1229_1033_8063 = + {0x1033, 0x8063, pci_subsys_8086_1229_1033_8063, 0}; +#undef pci_ss_info_1033_8063 +#define pci_ss_info_1033_8063 pci_ss_info_8086_1229_1033_8063 +static const pciSubsystemInfo pci_ss_info_8086_1229_1033_8064 = + {0x1033, 0x8064, pci_subsys_8086_1229_1033_8064, 0}; +#undef pci_ss_info_1033_8064 +#define pci_ss_info_1033_8064 pci_ss_info_8086_1229_1033_8064 +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_10c0 = + {0x103c, 0x10c0, pci_subsys_8086_1229_103c_10c0, 0}; +#undef pci_ss_info_103c_10c0 +#define pci_ss_info_103c_10c0 pci_ss_info_8086_1229_103c_10c0 +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_10c3 = + {0x103c, 0x10c3, pci_subsys_8086_1229_103c_10c3, 0}; +#undef pci_ss_info_103c_10c3 +#define pci_ss_info_103c_10c3 pci_ss_info_8086_1229_103c_10c3 +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_10ca = + {0x103c, 0x10ca, pci_subsys_8086_1229_103c_10ca, 0}; +#undef pci_ss_info_103c_10ca +#define pci_ss_info_103c_10ca pci_ss_info_8086_1229_103c_10ca +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_10cb = + {0x103c, 0x10cb, pci_subsys_8086_1229_103c_10cb, 0}; +#undef pci_ss_info_103c_10cb +#define pci_ss_info_103c_10cb pci_ss_info_8086_1229_103c_10cb +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_10e3 = + {0x103c, 0x10e3, pci_subsys_8086_1229_103c_10e3, 0}; +#undef pci_ss_info_103c_10e3 +#define pci_ss_info_103c_10e3 pci_ss_info_8086_1229_103c_10e3 +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_10e4 = + {0x103c, 0x10e4, pci_subsys_8086_1229_103c_10e4, 0}; +#undef pci_ss_info_103c_10e4 +#define pci_ss_info_103c_10e4 pci_ss_info_8086_1229_103c_10e4 +static const pciSubsystemInfo pci_ss_info_8086_1229_103c_1200 = + {0x103c, 0x1200, pci_subsys_8086_1229_103c_1200, 0}; +#undef pci_ss_info_103c_1200 +#define pci_ss_info_103c_1200 pci_ss_info_8086_1229_103c_1200 +static const pciSubsystemInfo pci_ss_info_8086_1229_10c3_1100 = + {0x10c3, 0x1100, pci_subsys_8086_1229_10c3_1100, 0}; +#undef pci_ss_info_10c3_1100 +#define pci_ss_info_10c3_1100 pci_ss_info_8086_1229_10c3_1100 +static const pciSubsystemInfo pci_ss_info_8086_1229_10cf_1115 = + {0x10cf, 0x1115, pci_subsys_8086_1229_10cf_1115, 0}; +#undef pci_ss_info_10cf_1115 +#define pci_ss_info_10cf_1115 pci_ss_info_8086_1229_10cf_1115 +static const pciSubsystemInfo pci_ss_info_8086_1229_10cf_1143 = + {0x10cf, 0x1143, pci_subsys_8086_1229_10cf_1143, 0}; +#undef pci_ss_info_10cf_1143 +#define pci_ss_info_10cf_1143 pci_ss_info_8086_1229_10cf_1143 +static const pciSubsystemInfo pci_ss_info_8086_1229_1179_0001 = + {0x1179, 0x0001, pci_subsys_8086_1229_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_8086_1229_1179_0001 +static const pciSubsystemInfo pci_ss_info_8086_1229_1179_0002 = + {0x1179, 0x0002, pci_subsys_8086_1229_1179_0002, 0}; +#undef pci_ss_info_1179_0002 +#define pci_ss_info_1179_0002 pci_ss_info_8086_1229_1179_0002 +static const pciSubsystemInfo pci_ss_info_8086_1229_1179_0003 = + {0x1179, 0x0003, pci_subsys_8086_1229_1179_0003, 0}; +#undef pci_ss_info_1179_0003 +#define pci_ss_info_1179_0003 pci_ss_info_8086_1229_1179_0003 +static const pciSubsystemInfo pci_ss_info_8086_1229_1259_2560 = + {0x1259, 0x2560, pci_subsys_8086_1229_1259_2560, 0}; +#undef pci_ss_info_1259_2560 +#define pci_ss_info_1259_2560 pci_ss_info_8086_1229_1259_2560 +static const pciSubsystemInfo pci_ss_info_8086_1229_1259_2561 = + {0x1259, 0x2561, pci_subsys_8086_1229_1259_2561, 0}; +#undef pci_ss_info_1259_2561 +#define pci_ss_info_1259_2561 pci_ss_info_8086_1229_1259_2561 +static const pciSubsystemInfo pci_ss_info_8086_1229_1266_0001 = + {0x1266, 0x0001, pci_subsys_8086_1229_1266_0001, 0}; +#undef pci_ss_info_1266_0001 +#define pci_ss_info_1266_0001 pci_ss_info_8086_1229_1266_0001 +static const pciSubsystemInfo pci_ss_info_8086_1229_144d_2501 = + {0x144d, 0x2501, pci_subsys_8086_1229_144d_2501, 0}; +#undef pci_ss_info_144d_2501 +#define pci_ss_info_144d_2501 pci_ss_info_8086_1229_144d_2501 +static const pciSubsystemInfo pci_ss_info_8086_1229_144d_2502 = + {0x144d, 0x2502, pci_subsys_8086_1229_144d_2502, 0}; +#undef pci_ss_info_144d_2502 +#define pci_ss_info_144d_2502 pci_ss_info_8086_1229_144d_2502 +static const pciSubsystemInfo pci_ss_info_8086_1229_1668_1100 = + {0x1668, 0x1100, pci_subsys_8086_1229_1668_1100, 0}; +#undef pci_ss_info_1668_1100 +#define pci_ss_info_1668_1100 pci_ss_info_8086_1229_1668_1100 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0001 = + {0x8086, 0x0001, pci_subsys_8086_1229_8086_0001, 0}; +#undef pci_ss_info_8086_0001 +#define pci_ss_info_8086_0001 pci_ss_info_8086_1229_8086_0001 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0002 = + {0x8086, 0x0002, pci_subsys_8086_1229_8086_0002, 0}; +#undef pci_ss_info_8086_0002 +#define pci_ss_info_8086_0002 pci_ss_info_8086_1229_8086_0002 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0003 = + {0x8086, 0x0003, pci_subsys_8086_1229_8086_0003, 0}; +#undef pci_ss_info_8086_0003 +#define pci_ss_info_8086_0003 pci_ss_info_8086_1229_8086_0003 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0004 = + {0x8086, 0x0004, pci_subsys_8086_1229_8086_0004, 0}; +#undef pci_ss_info_8086_0004 +#define pci_ss_info_8086_0004 pci_ss_info_8086_1229_8086_0004 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0005 = + {0x8086, 0x0005, pci_subsys_8086_1229_8086_0005, 0}; +#undef pci_ss_info_8086_0005 +#define pci_ss_info_8086_0005 pci_ss_info_8086_1229_8086_0005 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0006 = + {0x8086, 0x0006, pci_subsys_8086_1229_8086_0006, 0}; +#undef pci_ss_info_8086_0006 +#define pci_ss_info_8086_0006 pci_ss_info_8086_1229_8086_0006 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0007 = + {0x8086, 0x0007, pci_subsys_8086_1229_8086_0007, 0}; +#undef pci_ss_info_8086_0007 +#define pci_ss_info_8086_0007 pci_ss_info_8086_1229_8086_0007 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0008 = + {0x8086, 0x0008, pci_subsys_8086_1229_8086_0008, 0}; +#undef pci_ss_info_8086_0008 +#define pci_ss_info_8086_0008 pci_ss_info_8086_1229_8086_0008 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0009 = + {0x8086, 0x0009, pci_subsys_8086_1229_8086_0009, 0}; +#undef pci_ss_info_8086_0009 +#define pci_ss_info_8086_0009 pci_ss_info_8086_1229_8086_0009 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_000a = + {0x8086, 0x000a, pci_subsys_8086_1229_8086_000a, 0}; +#undef pci_ss_info_8086_000a +#define pci_ss_info_8086_000a pci_ss_info_8086_1229_8086_000a +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_000b = + {0x8086, 0x000b, pci_subsys_8086_1229_8086_000b, 0}; +#undef pci_ss_info_8086_000b +#define pci_ss_info_8086_000b pci_ss_info_8086_1229_8086_000b +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_000c = + {0x8086, 0x000c, pci_subsys_8086_1229_8086_000c, 0}; +#undef pci_ss_info_8086_000c +#define pci_ss_info_8086_000c pci_ss_info_8086_1229_8086_000c +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_000d = + {0x8086, 0x000d, pci_subsys_8086_1229_8086_000d, 0}; +#undef pci_ss_info_8086_000d +#define pci_ss_info_8086_000d pci_ss_info_8086_1229_8086_000d +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_000e = + {0x8086, 0x000e, pci_subsys_8086_1229_8086_000e, 0}; +#undef pci_ss_info_8086_000e +#define pci_ss_info_8086_000e pci_ss_info_8086_1229_8086_000e +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_000f = + {0x8086, 0x000f, pci_subsys_8086_1229_8086_000f, 0}; +#undef pci_ss_info_8086_000f +#define pci_ss_info_8086_000f pci_ss_info_8086_1229_8086_000f +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0010 = + {0x8086, 0x0010, pci_subsys_8086_1229_8086_0010, 0}; +#undef pci_ss_info_8086_0010 +#define pci_ss_info_8086_0010 pci_ss_info_8086_1229_8086_0010 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0011 = + {0x8086, 0x0011, pci_subsys_8086_1229_8086_0011, 0}; +#undef pci_ss_info_8086_0011 +#define pci_ss_info_8086_0011 pci_ss_info_8086_1229_8086_0011 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0012 = + {0x8086, 0x0012, pci_subsys_8086_1229_8086_0012, 0}; +#undef pci_ss_info_8086_0012 +#define pci_ss_info_8086_0012 pci_ss_info_8086_1229_8086_0012 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0013 = + {0x8086, 0x0013, pci_subsys_8086_1229_8086_0013, 0}; +#undef pci_ss_info_8086_0013 +#define pci_ss_info_8086_0013 pci_ss_info_8086_1229_8086_0013 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0030 = + {0x8086, 0x0030, pci_subsys_8086_1229_8086_0030, 0}; +#undef pci_ss_info_8086_0030 +#define pci_ss_info_8086_0030 pci_ss_info_8086_1229_8086_0030 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0031 = + {0x8086, 0x0031, pci_subsys_8086_1229_8086_0031, 0}; +#undef pci_ss_info_8086_0031 +#define pci_ss_info_8086_0031 pci_ss_info_8086_1229_8086_0031 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0040 = + {0x8086, 0x0040, pci_subsys_8086_1229_8086_0040, 0}; +#undef pci_ss_info_8086_0040 +#define pci_ss_info_8086_0040 pci_ss_info_8086_1229_8086_0040 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0041 = + {0x8086, 0x0041, pci_subsys_8086_1229_8086_0041, 0}; +#undef pci_ss_info_8086_0041 +#define pci_ss_info_8086_0041 pci_ss_info_8086_1229_8086_0041 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0042 = + {0x8086, 0x0042, pci_subsys_8086_1229_8086_0042, 0}; +#undef pci_ss_info_8086_0042 +#define pci_ss_info_8086_0042 pci_ss_info_8086_1229_8086_0042 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_0050 = + {0x8086, 0x0050, pci_subsys_8086_1229_8086_0050, 0}; +#undef pci_ss_info_8086_0050 +#define pci_ss_info_8086_0050 pci_ss_info_8086_1229_8086_0050 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1009 = + {0x8086, 0x1009, pci_subsys_8086_1229_8086_1009, 0}; +#undef pci_ss_info_8086_1009 +#define pci_ss_info_8086_1009 pci_ss_info_8086_1229_8086_1009 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_100c = + {0x8086, 0x100c, pci_subsys_8086_1229_8086_100c, 0}; +#undef pci_ss_info_8086_100c +#define pci_ss_info_8086_100c pci_ss_info_8086_1229_8086_100c +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1012 = + {0x8086, 0x1012, pci_subsys_8086_1229_8086_1012, 0}; +#undef pci_ss_info_8086_1012 +#define pci_ss_info_8086_1012 pci_ss_info_8086_1229_8086_1012 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1013 = + {0x8086, 0x1013, pci_subsys_8086_1229_8086_1013, 0}; +#undef pci_ss_info_8086_1013 +#define pci_ss_info_8086_1013 pci_ss_info_8086_1229_8086_1013 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1015 = + {0x8086, 0x1015, pci_subsys_8086_1229_8086_1015, 0}; +#undef pci_ss_info_8086_1015 +#define pci_ss_info_8086_1015 pci_ss_info_8086_1229_8086_1015 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1017 = + {0x8086, 0x1017, pci_subsys_8086_1229_8086_1017, 0}; +#undef pci_ss_info_8086_1017 +#define pci_ss_info_8086_1017 pci_ss_info_8086_1229_8086_1017 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1030 = + {0x8086, 0x1030, pci_subsys_8086_1229_8086_1030, 0}; +#undef pci_ss_info_8086_1030 +#define pci_ss_info_8086_1030 pci_ss_info_8086_1229_8086_1030 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1040 = + {0x8086, 0x1040, pci_subsys_8086_1229_8086_1040, 0}; +#undef pci_ss_info_8086_1040 +#define pci_ss_info_8086_1040 pci_ss_info_8086_1229_8086_1040 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1041 = + {0x8086, 0x1041, pci_subsys_8086_1229_8086_1041, 0}; +#undef pci_ss_info_8086_1041 +#define pci_ss_info_8086_1041 pci_ss_info_8086_1229_8086_1041 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1042 = + {0x8086, 0x1042, pci_subsys_8086_1229_8086_1042, 0}; +#undef pci_ss_info_8086_1042 +#define pci_ss_info_8086_1042 pci_ss_info_8086_1229_8086_1042 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1050 = + {0x8086, 0x1050, pci_subsys_8086_1229_8086_1050, 0}; +#undef pci_ss_info_8086_1050 +#define pci_ss_info_8086_1050 pci_ss_info_8086_1229_8086_1050 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1051 = + {0x8086, 0x1051, pci_subsys_8086_1229_8086_1051, 0}; +#undef pci_ss_info_8086_1051 +#define pci_ss_info_8086_1051 pci_ss_info_8086_1229_8086_1051 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_1052 = + {0x8086, 0x1052, pci_subsys_8086_1229_8086_1052, 0}; +#undef pci_ss_info_8086_1052 +#define pci_ss_info_8086_1052 pci_ss_info_8086_1229_8086_1052 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_10f0 = + {0x8086, 0x10f0, pci_subsys_8086_1229_8086_10f0, 0}; +#undef pci_ss_info_8086_10f0 +#define pci_ss_info_8086_10f0 pci_ss_info_8086_1229_8086_10f0 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2009 = + {0x8086, 0x2009, pci_subsys_8086_1229_8086_2009, 0}; +#undef pci_ss_info_8086_2009 +#define pci_ss_info_8086_2009 pci_ss_info_8086_1229_8086_2009 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_200d = + {0x8086, 0x200d, pci_subsys_8086_1229_8086_200d, 0}; +#undef pci_ss_info_8086_200d +#define pci_ss_info_8086_200d pci_ss_info_8086_1229_8086_200d +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_200e = + {0x8086, 0x200e, pci_subsys_8086_1229_8086_200e, 0}; +#undef pci_ss_info_8086_200e +#define pci_ss_info_8086_200e pci_ss_info_8086_1229_8086_200e +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_200f = + {0x8086, 0x200f, pci_subsys_8086_1229_8086_200f, 0}; +#undef pci_ss_info_8086_200f +#define pci_ss_info_8086_200f pci_ss_info_8086_1229_8086_200f +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2010 = + {0x8086, 0x2010, pci_subsys_8086_1229_8086_2010, 0}; +#undef pci_ss_info_8086_2010 +#define pci_ss_info_8086_2010 pci_ss_info_8086_1229_8086_2010 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2013 = + {0x8086, 0x2013, pci_subsys_8086_1229_8086_2013, 0}; +#undef pci_ss_info_8086_2013 +#define pci_ss_info_8086_2013 pci_ss_info_8086_1229_8086_2013 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2016 = + {0x8086, 0x2016, pci_subsys_8086_1229_8086_2016, 0}; +#undef pci_ss_info_8086_2016 +#define pci_ss_info_8086_2016 pci_ss_info_8086_1229_8086_2016 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2017 = + {0x8086, 0x2017, pci_subsys_8086_1229_8086_2017, 0}; +#undef pci_ss_info_8086_2017 +#define pci_ss_info_8086_2017 pci_ss_info_8086_1229_8086_2017 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2018 = + {0x8086, 0x2018, pci_subsys_8086_1229_8086_2018, 0}; +#undef pci_ss_info_8086_2018 +#define pci_ss_info_8086_2018 pci_ss_info_8086_1229_8086_2018 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2019 = + {0x8086, 0x2019, pci_subsys_8086_1229_8086_2019, 0}; +#undef pci_ss_info_8086_2019 +#define pci_ss_info_8086_2019 pci_ss_info_8086_1229_8086_2019 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2101 = + {0x8086, 0x2101, pci_subsys_8086_1229_8086_2101, 0}; +#undef pci_ss_info_8086_2101 +#define pci_ss_info_8086_2101 pci_ss_info_8086_1229_8086_2101 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2102 = + {0x8086, 0x2102, pci_subsys_8086_1229_8086_2102, 0}; +#undef pci_ss_info_8086_2102 +#define pci_ss_info_8086_2102 pci_ss_info_8086_1229_8086_2102 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2103 = + {0x8086, 0x2103, pci_subsys_8086_1229_8086_2103, 0}; +#undef pci_ss_info_8086_2103 +#define pci_ss_info_8086_2103 pci_ss_info_8086_1229_8086_2103 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2104 = + {0x8086, 0x2104, pci_subsys_8086_1229_8086_2104, 0}; +#undef pci_ss_info_8086_2104 +#define pci_ss_info_8086_2104 pci_ss_info_8086_1229_8086_2104 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2105 = + {0x8086, 0x2105, pci_subsys_8086_1229_8086_2105, 0}; +#undef pci_ss_info_8086_2105 +#define pci_ss_info_8086_2105 pci_ss_info_8086_1229_8086_2105 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2106 = + {0x8086, 0x2106, pci_subsys_8086_1229_8086_2106, 0}; +#undef pci_ss_info_8086_2106 +#define pci_ss_info_8086_2106 pci_ss_info_8086_1229_8086_2106 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2107 = + {0x8086, 0x2107, pci_subsys_8086_1229_8086_2107, 0}; +#undef pci_ss_info_8086_2107 +#define pci_ss_info_8086_2107 pci_ss_info_8086_1229_8086_2107 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2108 = + {0x8086, 0x2108, pci_subsys_8086_1229_8086_2108, 0}; +#undef pci_ss_info_8086_2108 +#define pci_ss_info_8086_2108 pci_ss_info_8086_1229_8086_2108 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2200 = + {0x8086, 0x2200, pci_subsys_8086_1229_8086_2200, 0}; +#undef pci_ss_info_8086_2200 +#define pci_ss_info_8086_2200 pci_ss_info_8086_1229_8086_2200 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2201 = + {0x8086, 0x2201, pci_subsys_8086_1229_8086_2201, 0}; +#undef pci_ss_info_8086_2201 +#define pci_ss_info_8086_2201 pci_ss_info_8086_1229_8086_2201 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2202 = + {0x8086, 0x2202, pci_subsys_8086_1229_8086_2202, 0}; +#undef pci_ss_info_8086_2202 +#define pci_ss_info_8086_2202 pci_ss_info_8086_1229_8086_2202 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2203 = + {0x8086, 0x2203, pci_subsys_8086_1229_8086_2203, 0}; +#undef pci_ss_info_8086_2203 +#define pci_ss_info_8086_2203 pci_ss_info_8086_1229_8086_2203 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2204 = + {0x8086, 0x2204, pci_subsys_8086_1229_8086_2204, 0}; +#undef pci_ss_info_8086_2204 +#define pci_ss_info_8086_2204 pci_ss_info_8086_1229_8086_2204 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2205 = + {0x8086, 0x2205, pci_subsys_8086_1229_8086_2205, 0}; +#undef pci_ss_info_8086_2205 +#define pci_ss_info_8086_2205 pci_ss_info_8086_1229_8086_2205 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2206 = + {0x8086, 0x2206, pci_subsys_8086_1229_8086_2206, 0}; +#undef pci_ss_info_8086_2206 +#define pci_ss_info_8086_2206 pci_ss_info_8086_1229_8086_2206 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2207 = + {0x8086, 0x2207, pci_subsys_8086_1229_8086_2207, 0}; +#undef pci_ss_info_8086_2207 +#define pci_ss_info_8086_2207 pci_ss_info_8086_1229_8086_2207 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2208 = + {0x8086, 0x2208, pci_subsys_8086_1229_8086_2208, 0}; +#undef pci_ss_info_8086_2208 +#define pci_ss_info_8086_2208 pci_ss_info_8086_1229_8086_2208 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2402 = + {0x8086, 0x2402, pci_subsys_8086_1229_8086_2402, 0}; +#undef pci_ss_info_8086_2402 +#define pci_ss_info_8086_2402 pci_ss_info_8086_1229_8086_2402 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2407 = + {0x8086, 0x2407, pci_subsys_8086_1229_8086_2407, 0}; +#undef pci_ss_info_8086_2407 +#define pci_ss_info_8086_2407 pci_ss_info_8086_1229_8086_2407 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2408 = + {0x8086, 0x2408, pci_subsys_8086_1229_8086_2408, 0}; +#undef pci_ss_info_8086_2408 +#define pci_ss_info_8086_2408 pci_ss_info_8086_1229_8086_2408 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2409 = + {0x8086, 0x2409, pci_subsys_8086_1229_8086_2409, 0}; +#undef pci_ss_info_8086_2409 +#define pci_ss_info_8086_2409 pci_ss_info_8086_1229_8086_2409 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_240f = + {0x8086, 0x240f, pci_subsys_8086_1229_8086_240f, 0}; +#undef pci_ss_info_8086_240f +#define pci_ss_info_8086_240f pci_ss_info_8086_1229_8086_240f +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2410 = + {0x8086, 0x2410, pci_subsys_8086_1229_8086_2410, 0}; +#undef pci_ss_info_8086_2410 +#define pci_ss_info_8086_2410 pci_ss_info_8086_1229_8086_2410 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2411 = + {0x8086, 0x2411, pci_subsys_8086_1229_8086_2411, 0}; +#undef pci_ss_info_8086_2411 +#define pci_ss_info_8086_2411 pci_ss_info_8086_1229_8086_2411 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2412 = + {0x8086, 0x2412, pci_subsys_8086_1229_8086_2412, 0}; +#undef pci_ss_info_8086_2412 +#define pci_ss_info_8086_2412 pci_ss_info_8086_1229_8086_2412 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_2413 = + {0x8086, 0x2413, pci_subsys_8086_1229_8086_2413, 0}; +#undef pci_ss_info_8086_2413 +#define pci_ss_info_8086_2413 pci_ss_info_8086_1229_8086_2413 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3000 = + {0x8086, 0x3000, pci_subsys_8086_1229_8086_3000, 0}; +#undef pci_ss_info_8086_3000 +#define pci_ss_info_8086_3000 pci_ss_info_8086_1229_8086_3000 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3001 = + {0x8086, 0x3001, pci_subsys_8086_1229_8086_3001, 0}; +#undef pci_ss_info_8086_3001 +#define pci_ss_info_8086_3001 pci_ss_info_8086_1229_8086_3001 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3002 = + {0x8086, 0x3002, pci_subsys_8086_1229_8086_3002, 0}; +#undef pci_ss_info_8086_3002 +#define pci_ss_info_8086_3002 pci_ss_info_8086_1229_8086_3002 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3006 = + {0x8086, 0x3006, pci_subsys_8086_1229_8086_3006, 0}; +#undef pci_ss_info_8086_3006 +#define pci_ss_info_8086_3006 pci_ss_info_8086_1229_8086_3006 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3007 = + {0x8086, 0x3007, pci_subsys_8086_1229_8086_3007, 0}; +#undef pci_ss_info_8086_3007 +#define pci_ss_info_8086_3007 pci_ss_info_8086_1229_8086_3007 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3008 = + {0x8086, 0x3008, pci_subsys_8086_1229_8086_3008, 0}; +#undef pci_ss_info_8086_3008 +#define pci_ss_info_8086_3008 pci_ss_info_8086_1229_8086_3008 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3010 = + {0x8086, 0x3010, pci_subsys_8086_1229_8086_3010, 0}; +#undef pci_ss_info_8086_3010 +#define pci_ss_info_8086_3010 pci_ss_info_8086_1229_8086_3010 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3011 = + {0x8086, 0x3011, pci_subsys_8086_1229_8086_3011, 0}; +#undef pci_ss_info_8086_3011 +#define pci_ss_info_8086_3011 pci_ss_info_8086_1229_8086_3011 +static const pciSubsystemInfo pci_ss_info_8086_1229_8086_3012 = + {0x8086, 0x3012, pci_subsys_8086_1229_8086_3012, 0}; +#undef pci_ss_info_8086_3012 +#define pci_ss_info_8086_3012 pci_ss_info_8086_1229_8086_3012 +static const pciSubsystemInfo pci_ss_info_8086_1361_8086_1361 = + {0x8086, 0x1361, pci_subsys_8086_1361_8086_1361, 0}; +#undef pci_ss_info_8086_1361 +#define pci_ss_info_8086_1361 pci_ss_info_8086_1361_8086_1361 +static const pciSubsystemInfo pci_ss_info_8086_1361_8086_8000 = + {0x8086, 0x8000, pci_subsys_8086_1361_8086_8000, 0}; +#undef pci_ss_info_8086_8000 +#define pci_ss_info_8086_8000 pci_ss_info_8086_1361_8086_8000 +static const pciSubsystemInfo pci_ss_info_8086_1461_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_1461_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_1461_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_0431 = + {0x101e, 0x0431, pci_subsys_8086_1960_101e_0431, 0}; +#undef pci_ss_info_101e_0431 +#define pci_ss_info_101e_0431 pci_ss_info_8086_1960_101e_0431 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_0438 = + {0x101e, 0x0438, pci_subsys_8086_1960_101e_0438, 0}; +#undef pci_ss_info_101e_0438 +#define pci_ss_info_101e_0438 pci_ss_info_8086_1960_101e_0438 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_0466 = + {0x101e, 0x0466, pci_subsys_8086_1960_101e_0466, 0}; +#undef pci_ss_info_101e_0466 +#define pci_ss_info_101e_0466 pci_ss_info_8086_1960_101e_0466 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_0467 = + {0x101e, 0x0467, pci_subsys_8086_1960_101e_0467, 0}; +#undef pci_ss_info_101e_0467 +#define pci_ss_info_101e_0467 pci_ss_info_8086_1960_101e_0467 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_0490 = + {0x101e, 0x0490, pci_subsys_8086_1960_101e_0490, 0}; +#undef pci_ss_info_101e_0490 +#define pci_ss_info_101e_0490 pci_ss_info_8086_1960_101e_0490 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_0762 = + {0x101e, 0x0762, pci_subsys_8086_1960_101e_0762, 0}; +#undef pci_ss_info_101e_0762 +#define pci_ss_info_101e_0762 pci_ss_info_8086_1960_101e_0762 +static const pciSubsystemInfo pci_ss_info_8086_1960_101e_09a0 = + {0x101e, 0x09a0, pci_subsys_8086_1960_101e_09a0, 0}; +#undef pci_ss_info_101e_09a0 +#define pci_ss_info_101e_09a0 pci_ss_info_8086_1960_101e_09a0 +static const pciSubsystemInfo pci_ss_info_8086_1960_1028_0467 = + {0x1028, 0x0467, pci_subsys_8086_1960_1028_0467, 0}; +#undef pci_ss_info_1028_0467 +#define pci_ss_info_1028_0467 pci_ss_info_8086_1960_1028_0467 +static const pciSubsystemInfo pci_ss_info_8086_1960_1028_1111 = + {0x1028, 0x1111, pci_subsys_8086_1960_1028_1111, 0}; +#undef pci_ss_info_1028_1111 +#define pci_ss_info_1028_1111 pci_ss_info_8086_1960_1028_1111 +static const pciSubsystemInfo pci_ss_info_8086_1960_103c_03a2 = + {0x103c, 0x03a2, pci_subsys_8086_1960_103c_03a2, 0}; +#undef pci_ss_info_103c_03a2 +#define pci_ss_info_103c_03a2 pci_ss_info_8086_1960_103c_03a2 +static const pciSubsystemInfo pci_ss_info_8086_1960_103c_10c6 = + {0x103c, 0x10c6, pci_subsys_8086_1960_103c_10c6, 0}; +#undef pci_ss_info_103c_10c6 +#define pci_ss_info_103c_10c6 pci_ss_info_8086_1960_103c_10c6 +static const pciSubsystemInfo pci_ss_info_8086_1960_103c_10c7 = + {0x103c, 0x10c7, pci_subsys_8086_1960_103c_10c7, 0}; +#undef pci_ss_info_103c_10c7 +#define pci_ss_info_103c_10c7 pci_ss_info_8086_1960_103c_10c7 +static const pciSubsystemInfo pci_ss_info_8086_1960_103c_10cc = + {0x103c, 0x10cc, pci_subsys_8086_1960_103c_10cc, 0}; +#undef pci_ss_info_103c_10cc +#define pci_ss_info_103c_10cc pci_ss_info_8086_1960_103c_10cc +static const pciSubsystemInfo pci_ss_info_8086_1960_103c_10cd = + {0x103c, 0x10cd, pci_subsys_8086_1960_103c_10cd, 0}; +#undef pci_ss_info_103c_10cd +#define pci_ss_info_103c_10cd pci_ss_info_8086_1960_103c_10cd +static const pciSubsystemInfo pci_ss_info_8086_1960_105a_0000 = + {0x105a, 0x0000, pci_subsys_8086_1960_105a_0000, 0}; +#undef pci_ss_info_105a_0000 +#define pci_ss_info_105a_0000 pci_ss_info_8086_1960_105a_0000 +static const pciSubsystemInfo pci_ss_info_8086_1960_105a_2168 = + {0x105a, 0x2168, pci_subsys_8086_1960_105a_2168, 0}; +#undef pci_ss_info_105a_2168 +#define pci_ss_info_105a_2168 pci_ss_info_8086_1960_105a_2168 +static const pciSubsystemInfo pci_ss_info_8086_1960_105a_5168 = + {0x105a, 0x5168, pci_subsys_8086_1960_105a_5168, 0}; +#undef pci_ss_info_105a_5168 +#define pci_ss_info_105a_5168 pci_ss_info_8086_1960_105a_5168 +static const pciSubsystemInfo pci_ss_info_8086_1960_1111_1111 = + {0x1111, 0x1111, pci_subsys_8086_1960_1111_1111, 0}; +#undef pci_ss_info_1111_1111 +#define pci_ss_info_1111_1111 pci_ss_info_8086_1960_1111_1111 +static const pciSubsystemInfo pci_ss_info_8086_1960_1111_1112 = + {0x1111, 0x1112, pci_subsys_8086_1960_1111_1112, 0}; +#undef pci_ss_info_1111_1112 +#define pci_ss_info_1111_1112 pci_ss_info_8086_1960_1111_1112 +static const pciSubsystemInfo pci_ss_info_8086_1960_113c_03a2 = + {0x113c, 0x03a2, pci_subsys_8086_1960_113c_03a2, 0}; +#undef pci_ss_info_113c_03a2 +#define pci_ss_info_113c_03a2 pci_ss_info_8086_1960_113c_03a2 +static const pciSubsystemInfo pci_ss_info_8086_1962_105a_0000 = + {0x105a, 0x0000, pci_subsys_8086_1962_105a_0000, 0}; +#undef pci_ss_info_105a_0000 +#define pci_ss_info_105a_0000 pci_ss_info_8086_1962_105a_0000 +static const pciSubsystemInfo pci_ss_info_8086_2415_1028_0095 = + {0x1028, 0x0095, pci_subsys_8086_2415_1028_0095, 0}; +#undef pci_ss_info_1028_0095 +#define pci_ss_info_1028_0095 pci_ss_info_8086_2415_1028_0095 +static const pciSubsystemInfo pci_ss_info_8086_2415_11d4_0040 = + {0x11d4, 0x0040, pci_subsys_8086_2415_11d4_0040, 0}; +#undef pci_ss_info_11d4_0040 +#define pci_ss_info_11d4_0040 pci_ss_info_8086_2415_11d4_0040 +static const pciSubsystemInfo pci_ss_info_8086_2415_11d4_0048 = + {0x11d4, 0x0048, pci_subsys_8086_2415_11d4_0048, 0}; +#undef pci_ss_info_11d4_0048 +#define pci_ss_info_11d4_0048 pci_ss_info_8086_2415_11d4_0048 +static const pciSubsystemInfo pci_ss_info_8086_2415_11d4_5340 = + {0x11d4, 0x5340, pci_subsys_8086_2415_11d4_5340, 0}; +#undef pci_ss_info_11d4_5340 +#define pci_ss_info_11d4_5340 pci_ss_info_8086_2415_11d4_5340 +static const pciSubsystemInfo pci_ss_info_8086_2425_11d4_0040 = + {0x11d4, 0x0040, pci_subsys_8086_2425_11d4_0040, 0}; +#undef pci_ss_info_11d4_0040 +#define pci_ss_info_11d4_0040 pci_ss_info_8086_2425_11d4_0040 +static const pciSubsystemInfo pci_ss_info_8086_2425_11d4_0048 = + {0x11d4, 0x0048, pci_subsys_8086_2425_11d4_0048, 0}; +#undef pci_ss_info_11d4_0048 +#define pci_ss_info_11d4_0048 pci_ss_info_8086_2425_11d4_0048 +static const pciSubsystemInfo pci_ss_info_8086_2442_1014_01c6 = + {0x1014, 0x01c6, pci_subsys_8086_2442_1014_01c6, 0}; +#undef pci_ss_info_1014_01c6 +#define pci_ss_info_1014_01c6 pci_ss_info_8086_2442_1014_01c6 +static const pciSubsystemInfo pci_ss_info_8086_2442_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_2442_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_2442_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_2442_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_2442_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_2442_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_2442_147b_0507 = + {0x147b, 0x0507, pci_subsys_8086_2442_147b_0507, 0}; +#undef pci_ss_info_147b_0507 +#define pci_ss_info_147b_0507 pci_ss_info_8086_2442_147b_0507 +static const pciSubsystemInfo pci_ss_info_8086_2443_1014_01c6 = + {0x1014, 0x01c6, pci_subsys_8086_2443_1014_01c6, 0}; +#undef pci_ss_info_1014_01c6 +#define pci_ss_info_1014_01c6 pci_ss_info_8086_2443_1014_01c6 +static const pciSubsystemInfo pci_ss_info_8086_2443_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_2443_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_2443_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_2443_1043_8027 = + {0x1043, 0x8027, pci_subsys_8086_2443_1043_8027, 0}; +#undef pci_ss_info_1043_8027 +#define pci_ss_info_1043_8027 pci_ss_info_8086_2443_1043_8027 +static const pciSubsystemInfo pci_ss_info_8086_2443_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_2443_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_2443_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_2443_147b_0507 = + {0x147b, 0x0507, pci_subsys_8086_2443_147b_0507, 0}; +#undef pci_ss_info_147b_0507 +#define pci_ss_info_147b_0507 pci_ss_info_8086_2443_147b_0507 +static const pciSubsystemInfo pci_ss_info_8086_2444_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_2444_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_2444_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_2444_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_2444_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_2444_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_2444_147b_0507 = + {0x147b, 0x0507, pci_subsys_8086_2444_147b_0507, 0}; +#undef pci_ss_info_147b_0507 +#define pci_ss_info_147b_0507 pci_ss_info_8086_2444_147b_0507 +static const pciSubsystemInfo pci_ss_info_8086_2445_1014_01c6 = + {0x1014, 0x01c6, pci_subsys_8086_2445_1014_01c6, 0}; +#undef pci_ss_info_1014_01c6 +#define pci_ss_info_1014_01c6 pci_ss_info_8086_2445_1014_01c6 +static const pciSubsystemInfo pci_ss_info_8086_2445_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_2445_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_2445_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_2445_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_2445_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_2445_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_2445_1462_3370 = + {0x1462, 0x3370, pci_subsys_8086_2445_1462_3370, 0}; +#undef pci_ss_info_1462_3370 +#define pci_ss_info_1462_3370 pci_ss_info_8086_2445_1462_3370 +static const pciSubsystemInfo pci_ss_info_8086_2445_147b_0507 = + {0x147b, 0x0507, pci_subsys_8086_2445_147b_0507, 0}; +#undef pci_ss_info_147b_0507 +#define pci_ss_info_147b_0507 pci_ss_info_8086_2445_147b_0507 +static const pciSubsystemInfo pci_ss_info_8086_2446_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_2446_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_2446_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_2446_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_2446_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_2446_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_2449_0e11_0012 = + {0x0e11, 0x0012, pci_subsys_8086_2449_0e11_0012, 0}; +#undef pci_ss_info_0e11_0012 +#define pci_ss_info_0e11_0012 pci_ss_info_8086_2449_0e11_0012 +static const pciSubsystemInfo pci_ss_info_8086_2449_0e11_0091 = + {0x0e11, 0x0091, pci_subsys_8086_2449_0e11_0091, 0}; +#undef pci_ss_info_0e11_0091 +#define pci_ss_info_0e11_0091 pci_ss_info_8086_2449_0e11_0091 +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_01ce = + {0x1014, 0x01ce, pci_subsys_8086_2449_1014_01ce, 0}; +#undef pci_ss_info_1014_01ce +#define pci_ss_info_1014_01ce pci_ss_info_8086_2449_1014_01ce +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_01dc = + {0x1014, 0x01dc, pci_subsys_8086_2449_1014_01dc, 0}; +#undef pci_ss_info_1014_01dc +#define pci_ss_info_1014_01dc pci_ss_info_8086_2449_1014_01dc +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_01eb = + {0x1014, 0x01eb, pci_subsys_8086_2449_1014_01eb, 0}; +#undef pci_ss_info_1014_01eb +#define pci_ss_info_1014_01eb pci_ss_info_8086_2449_1014_01eb +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_01ec = + {0x1014, 0x01ec, pci_subsys_8086_2449_1014_01ec, 0}; +#undef pci_ss_info_1014_01ec +#define pci_ss_info_1014_01ec pci_ss_info_8086_2449_1014_01ec +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_0202 = + {0x1014, 0x0202, pci_subsys_8086_2449_1014_0202, 0}; +#undef pci_ss_info_1014_0202 +#define pci_ss_info_1014_0202 pci_ss_info_8086_2449_1014_0202 +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_0205 = + {0x1014, 0x0205, pci_subsys_8086_2449_1014_0205, 0}; +#undef pci_ss_info_1014_0205 +#define pci_ss_info_1014_0205 pci_ss_info_8086_2449_1014_0205 +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_0217 = + {0x1014, 0x0217, pci_subsys_8086_2449_1014_0217, 0}; +#undef pci_ss_info_1014_0217 +#define pci_ss_info_1014_0217 pci_ss_info_8086_2449_1014_0217 +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_0234 = + {0x1014, 0x0234, pci_subsys_8086_2449_1014_0234, 0}; +#undef pci_ss_info_1014_0234 +#define pci_ss_info_1014_0234 pci_ss_info_8086_2449_1014_0234 +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_023d = + {0x1014, 0x023d, pci_subsys_8086_2449_1014_023d, 0}; +#undef pci_ss_info_1014_023d +#define pci_ss_info_1014_023d pci_ss_info_8086_2449_1014_023d +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_0244 = + {0x1014, 0x0244, pci_subsys_8086_2449_1014_0244, 0}; +#undef pci_ss_info_1014_0244 +#define pci_ss_info_1014_0244 pci_ss_info_8086_2449_1014_0244 +static const pciSubsystemInfo pci_ss_info_8086_2449_1014_0245 = + {0x1014, 0x0245, pci_subsys_8086_2449_1014_0245, 0}; +#undef pci_ss_info_1014_0245 +#define pci_ss_info_1014_0245 pci_ss_info_8086_2449_1014_0245 +static const pciSubsystemInfo pci_ss_info_8086_2449_109f_315d = + {0x109f, 0x315d, pci_subsys_8086_2449_109f_315d, 0}; +#undef pci_ss_info_109f_315d +#define pci_ss_info_109f_315d pci_ss_info_8086_2449_109f_315d +static const pciSubsystemInfo pci_ss_info_8086_2449_109f_3181 = + {0x109f, 0x3181, pci_subsys_8086_2449_109f_3181, 0}; +#undef pci_ss_info_109f_3181 +#define pci_ss_info_109f_3181 pci_ss_info_8086_2449_109f_3181 +static const pciSubsystemInfo pci_ss_info_8086_2449_1186_7801 = + {0x1186, 0x7801, pci_subsys_8086_2449_1186_7801, 0}; +#undef pci_ss_info_1186_7801 +#define pci_ss_info_1186_7801 pci_ss_info_8086_2449_1186_7801 +static const pciSubsystemInfo pci_ss_info_8086_2449_144d_2602 = + {0x144d, 0x2602, pci_subsys_8086_2449_144d_2602, 0}; +#undef pci_ss_info_144d_2602 +#define pci_ss_info_144d_2602 pci_ss_info_8086_2449_144d_2602 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3010 = + {0x8086, 0x3010, pci_subsys_8086_2449_8086_3010, 0}; +#undef pci_ss_info_8086_3010 +#define pci_ss_info_8086_3010 pci_ss_info_8086_2449_8086_3010 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3011 = + {0x8086, 0x3011, pci_subsys_8086_2449_8086_3011, 0}; +#undef pci_ss_info_8086_3011 +#define pci_ss_info_8086_3011 pci_ss_info_8086_2449_8086_3011 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3012 = + {0x8086, 0x3012, pci_subsys_8086_2449_8086_3012, 0}; +#undef pci_ss_info_8086_3012 +#define pci_ss_info_8086_3012 pci_ss_info_8086_2449_8086_3012 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3013 = + {0x8086, 0x3013, pci_subsys_8086_2449_8086_3013, 0}; +#undef pci_ss_info_8086_3013 +#define pci_ss_info_8086_3013 pci_ss_info_8086_2449_8086_3013 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3014 = + {0x8086, 0x3014, pci_subsys_8086_2449_8086_3014, 0}; +#undef pci_ss_info_8086_3014 +#define pci_ss_info_8086_3014 pci_ss_info_8086_2449_8086_3014 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3015 = + {0x8086, 0x3015, pci_subsys_8086_2449_8086_3015, 0}; +#undef pci_ss_info_8086_3015 +#define pci_ss_info_8086_3015 pci_ss_info_8086_2449_8086_3015 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3016 = + {0x8086, 0x3016, pci_subsys_8086_2449_8086_3016, 0}; +#undef pci_ss_info_8086_3016 +#define pci_ss_info_8086_3016 pci_ss_info_8086_2449_8086_3016 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3017 = + {0x8086, 0x3017, pci_subsys_8086_2449_8086_3017, 0}; +#undef pci_ss_info_8086_3017 +#define pci_ss_info_8086_3017 pci_ss_info_8086_2449_8086_3017 +static const pciSubsystemInfo pci_ss_info_8086_2449_8086_3018 = + {0x8086, 0x3018, pci_subsys_8086_2449_8086_3018, 0}; +#undef pci_ss_info_8086_3018 +#define pci_ss_info_8086_3018 pci_ss_info_8086_2449_8086_3018 +static const pciSubsystemInfo pci_ss_info_8086_244a_1025_1016 = + {0x1025, 0x1016, pci_subsys_8086_244a_1025_1016, 0}; +#undef pci_ss_info_1025_1016 +#define pci_ss_info_1025_1016 pci_ss_info_8086_244a_1025_1016 +static const pciSubsystemInfo pci_ss_info_8086_244a_104d_80df = + {0x104d, 0x80df, pci_subsys_8086_244a_104d_80df, 0}; +#undef pci_ss_info_104d_80df +#define pci_ss_info_104d_80df pci_ss_info_8086_244a_104d_80df +static const pciSubsystemInfo pci_ss_info_8086_244b_1014_01c6 = + {0x1014, 0x01c6, pci_subsys_8086_244b_1014_01c6, 0}; +#undef pci_ss_info_1014_01c6 +#define pci_ss_info_1014_01c6 pci_ss_info_8086_244b_1014_01c6 +static const pciSubsystemInfo pci_ss_info_8086_244b_1043_8027 = + {0x1043, 0x8027, pci_subsys_8086_244b_1043_8027, 0}; +#undef pci_ss_info_1043_8027 +#define pci_ss_info_1043_8027 pci_ss_info_8086_244b_1043_8027 +static const pciSubsystemInfo pci_ss_info_8086_244b_147b_0507 = + {0x147b, 0x0507, pci_subsys_8086_244b_147b_0507, 0}; +#undef pci_ss_info_147b_0507 +#define pci_ss_info_147b_0507 pci_ss_info_8086_244b_147b_0507 +static const pciSubsystemInfo pci_ss_info_8086_2482_1014_0220 = + {0x1014, 0x0220, pci_subsys_8086_2482_1014_0220, 0}; +#undef pci_ss_info_1014_0220 +#define pci_ss_info_1014_0220 pci_ss_info_8086_2482_1014_0220 +static const pciSubsystemInfo pci_ss_info_8086_2482_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_2482_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_2482_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_2482_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_2482_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_2482_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_2482_8086_1958 = + {0x8086, 0x1958, pci_subsys_8086_2482_8086_1958, 0}; +#undef pci_ss_info_8086_1958 +#define pci_ss_info_8086_1958 pci_ss_info_8086_2482_8086_1958 +static const pciSubsystemInfo pci_ss_info_8086_2483_1014_0220 = + {0x1014, 0x0220, pci_subsys_8086_2483_1014_0220, 0}; +#undef pci_ss_info_1014_0220 +#define pci_ss_info_1014_0220 pci_ss_info_8086_2483_1014_0220 +static const pciSubsystemInfo pci_ss_info_8086_2483_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_2483_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_2483_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_2483_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_2483_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_2483_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_2483_8086_1958 = + {0x8086, 0x1958, pci_subsys_8086_2483_8086_1958, 0}; +#undef pci_ss_info_8086_1958 +#define pci_ss_info_8086_1958 pci_ss_info_8086_2483_8086_1958 +static const pciSubsystemInfo pci_ss_info_8086_2484_1014_0220 = + {0x1014, 0x0220, pci_subsys_8086_2484_1014_0220, 0}; +#undef pci_ss_info_1014_0220 +#define pci_ss_info_1014_0220 pci_ss_info_8086_2484_1014_0220 +static const pciSubsystemInfo pci_ss_info_8086_2484_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_2484_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_2484_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_2484_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_2484_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_2484_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_2484_8086_1958 = + {0x8086, 0x1958, pci_subsys_8086_2484_8086_1958, 0}; +#undef pci_ss_info_8086_1958 +#define pci_ss_info_8086_1958 pci_ss_info_8086_2484_8086_1958 +static const pciSubsystemInfo pci_ss_info_8086_2485_1014_0222 = + {0x1014, 0x0222, pci_subsys_8086_2485_1014_0222, 0}; +#undef pci_ss_info_1014_0222 +#define pci_ss_info_1014_0222 pci_ss_info_8086_2485_1014_0222 +static const pciSubsystemInfo pci_ss_info_8086_2485_1014_0508 = + {0x1014, 0x0508, pci_subsys_8086_2485_1014_0508, 0}; +#undef pci_ss_info_1014_0508 +#define pci_ss_info_1014_0508 pci_ss_info_8086_2485_1014_0508 +static const pciSubsystemInfo pci_ss_info_8086_2485_1014_051c = + {0x1014, 0x051c, pci_subsys_8086_2485_1014_051c, 0}; +#undef pci_ss_info_1014_051c +#define pci_ss_info_1014_051c pci_ss_info_8086_2485_1014_051c +static const pciSubsystemInfo pci_ss_info_8086_2485_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_2485_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_2485_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_2485_144d_c006 = + {0x144d, 0xc006, pci_subsys_8086_2485_144d_c006, 0}; +#undef pci_ss_info_144d_c006 +#define pci_ss_info_144d_c006 pci_ss_info_8086_2485_144d_c006 +static const pciSubsystemInfo pci_ss_info_8086_2486_1014_0223 = + {0x1014, 0x0223, pci_subsys_8086_2486_1014_0223, 0}; +#undef pci_ss_info_1014_0223 +#define pci_ss_info_1014_0223 pci_ss_info_8086_2486_1014_0223 +static const pciSubsystemInfo pci_ss_info_8086_2486_1014_0503 = + {0x1014, 0x0503, pci_subsys_8086_2486_1014_0503, 0}; +#undef pci_ss_info_1014_0503 +#define pci_ss_info_1014_0503 pci_ss_info_8086_2486_1014_0503 +static const pciSubsystemInfo pci_ss_info_8086_2486_1014_051a = + {0x1014, 0x051a, pci_subsys_8086_2486_1014_051a, 0}; +#undef pci_ss_info_1014_051a +#define pci_ss_info_1014_051a pci_ss_info_8086_2486_1014_051a +static const pciSubsystemInfo pci_ss_info_8086_2486_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_2486_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_2486_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_2486_1179_0001 = + {0x1179, 0x0001, pci_subsys_8086_2486_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_8086_2486_1179_0001 +static const pciSubsystemInfo pci_ss_info_8086_2486_134d_4c21 = + {0x134d, 0x4c21, pci_subsys_8086_2486_134d_4c21, 0}; +#undef pci_ss_info_134d_4c21 +#define pci_ss_info_134d_4c21 pci_ss_info_8086_2486_134d_4c21 +static const pciSubsystemInfo pci_ss_info_8086_2486_144d_2115 = + {0x144d, 0x2115, pci_subsys_8086_2486_144d_2115, 0}; +#undef pci_ss_info_144d_2115 +#define pci_ss_info_144d_2115 pci_ss_info_8086_2486_144d_2115 +static const pciSubsystemInfo pci_ss_info_8086_2486_14f1_5421 = + {0x14f1, 0x5421, pci_subsys_8086_2486_14f1_5421, 0}; +#undef pci_ss_info_14f1_5421 +#define pci_ss_info_14f1_5421 pci_ss_info_8086_2486_14f1_5421 +static const pciSubsystemInfo pci_ss_info_8086_2487_1014_0220 = + {0x1014, 0x0220, pci_subsys_8086_2487_1014_0220, 0}; +#undef pci_ss_info_1014_0220 +#define pci_ss_info_1014_0220 pci_ss_info_8086_2487_1014_0220 +static const pciSubsystemInfo pci_ss_info_8086_2487_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_2487_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_2487_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_2487_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_2487_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_2487_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_2487_8086_1958 = + {0x8086, 0x1958, pci_subsys_8086_2487_8086_1958, 0}; +#undef pci_ss_info_8086_1958 +#define pci_ss_info_8086_1958 pci_ss_info_8086_2487_8086_1958 +static const pciSubsystemInfo pci_ss_info_8086_248a_1014_0220 = + {0x1014, 0x0220, pci_subsys_8086_248a_1014_0220, 0}; +#undef pci_ss_info_1014_0220 +#define pci_ss_info_1014_0220 pci_ss_info_8086_248a_1014_0220 +static const pciSubsystemInfo pci_ss_info_8086_248a_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_248a_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_248a_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_248a_8086_1958 = + {0x8086, 0x1958, pci_subsys_8086_248a_8086_1958, 0}; +#undef pci_ss_info_8086_1958 +#define pci_ss_info_8086_1958 pci_ss_info_8086_248a_8086_1958 +static const pciSubsystemInfo pci_ss_info_8086_248b_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_248b_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_248b_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_24c0_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24c0_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24c0_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24c2_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24c2_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24c2_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24c3_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24c3_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24c3_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24c4_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24c4_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24c4_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24c5_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24c5_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24c5_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24c7_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24c7_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24c7_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24cb_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_24cb_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_24cb_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_24cd_1462_3981 = + {0x1462, 0x3981, pci_subsys_8086_24cd_1462_3981, 0}; +#undef pci_ss_info_1462_3981 +#define pci_ss_info_1462_3981 pci_ss_info_8086_24cd_1462_3981 +static const pciSubsystemInfo pci_ss_info_8086_2500_1028_0095 = + {0x1028, 0x0095, pci_subsys_8086_2500_1028_0095, 0}; +#undef pci_ss_info_1028_0095 +#define pci_ss_info_1028_0095 pci_ss_info_8086_2500_1028_0095 +static const pciSubsystemInfo pci_ss_info_8086_2500_1043_801c = + {0x1043, 0x801c, pci_subsys_8086_2500_1043_801c, 0}; +#undef pci_ss_info_1043_801c +#define pci_ss_info_1043_801c pci_ss_info_8086_2500_1043_801c +static const pciSubsystemInfo pci_ss_info_8086_2501_1043_801c = + {0x1043, 0x801c, pci_subsys_8086_2501_1043_801c, 0}; +#undef pci_ss_info_1043_801c +#define pci_ss_info_1043_801c pci_ss_info_8086_2501_1043_801c +static const pciSubsystemInfo pci_ss_info_8086_2530_147b_0507 = + {0x147b, 0x0507, pci_subsys_8086_2530_147b_0507, 0}; +#undef pci_ss_info_147b_0507 +#define pci_ss_info_147b_0507 pci_ss_info_8086_2530_147b_0507 +static const pciSubsystemInfo pci_ss_info_8086_2540_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_2540_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_2540_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_2541_15d9_3480 = + {0x15d9, 0x3480, pci_subsys_8086_2541_15d9_3480, 0}; +#undef pci_ss_info_15d9_3480 +#define pci_ss_info_15d9_3480 pci_ss_info_8086_2541_15d9_3480 +static const pciSubsystemInfo pci_ss_info_8086_2560_1462_5800 = + {0x1462, 0x5800, pci_subsys_8086_2560_1462_5800, 0}; +#undef pci_ss_info_1462_5800 +#define pci_ss_info_1462_5800 pci_ss_info_8086_2560_1462_5800 +static const pciSubsystemInfo pci_ss_info_8086_3575_1014_021d = + {0x1014, 0x021d, pci_subsys_8086_3575_1014_021d, 0}; +#undef pci_ss_info_1014_021d +#define pci_ss_info_1014_021d pci_ss_info_8086_3575_1014_021d +static const pciSubsystemInfo pci_ss_info_8086_3575_104d_80e7 = + {0x104d, 0x80e7, pci_subsys_8086_3575_104d_80e7, 0}; +#undef pci_ss_info_104d_80e7 +#define pci_ss_info_104d_80e7 pci_ss_info_8086_3575_104d_80e7 +static const pciSubsystemInfo pci_ss_info_8086_3577_1014_0513 = + {0x1014, 0x0513, pci_subsys_8086_3577_1014_0513, 0}; +#undef pci_ss_info_1014_0513 +#define pci_ss_info_1014_0513 pci_ss_info_8086_3577_1014_0513 +static const pciSubsystemInfo pci_ss_info_8086_5201_8086_0001 = + {0x8086, 0x0001, pci_subsys_8086_5201_8086_0001, 0}; +#undef pci_ss_info_8086_0001 +#define pci_ss_info_8086_0001 pci_ss_info_8086_5201_8086_0001 +static const pciSubsystemInfo pci_ss_info_8086_7190_0e11_0500 = + {0x0e11, 0x0500, pci_subsys_8086_7190_0e11_0500, 0}; +#undef pci_ss_info_0e11_0500 +#define pci_ss_info_0e11_0500 pci_ss_info_8086_7190_0e11_0500 +static const pciSubsystemInfo pci_ss_info_8086_7190_0e11_b110 = + {0x0e11, 0xb110, pci_subsys_8086_7190_0e11_b110, 0}; +#undef pci_ss_info_0e11_b110 +#define pci_ss_info_0e11_b110 pci_ss_info_8086_7190_0e11_b110 +static const pciSubsystemInfo pci_ss_info_8086_7190_1179_0001 = + {0x1179, 0x0001, pci_subsys_8086_7190_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_8086_7190_1179_0001 +static const pciSubsystemInfo pci_ss_info_8086_7192_0e11_0460 = + {0x0e11, 0x0460, pci_subsys_8086_7192_0e11_0460, 0}; +#undef pci_ss_info_0e11_0460 +#define pci_ss_info_0e11_0460 pci_ss_info_8086_7192_0e11_0460 +static const pciSubsystemInfo pci_ss_info_8086_7195_10cf_1099 = + {0x10cf, 0x1099, pci_subsys_8086_7195_10cf_1099, 0}; +#undef pci_ss_info_10cf_1099 +#define pci_ss_info_10cf_1099 pci_ss_info_8086_7195_10cf_1099 +static const pciSubsystemInfo pci_ss_info_8086_7195_11d4_0040 = + {0x11d4, 0x0040, pci_subsys_8086_7195_11d4_0040, 0}; +#undef pci_ss_info_11d4_0040 +#define pci_ss_info_11d4_0040 pci_ss_info_8086_7195_11d4_0040 +static const pciSubsystemInfo pci_ss_info_8086_7195_11d4_0048 = + {0x11d4, 0x0048, pci_subsys_8086_7195_11d4_0048, 0}; +#undef pci_ss_info_11d4_0048 +#define pci_ss_info_11d4_0048 pci_ss_info_8086_7195_11d4_0048 +static const pciSubsystemInfo pci_ss_info_8086_7800_003d_0008 = + {0x003d, 0x0008, pci_subsys_8086_7800_003d_0008, 0}; +#undef pci_ss_info_003d_0008 +#define pci_ss_info_003d_0008 pci_ss_info_8086_7800_003d_0008 +static const pciSubsystemInfo pci_ss_info_8086_7800_003d_000b = + {0x003d, 0x000b, pci_subsys_8086_7800_003d_000b, 0}; +#undef pci_ss_info_003d_000b +#define pci_ss_info_003d_000b pci_ss_info_8086_7800_003d_000b +static const pciSubsystemInfo pci_ss_info_8086_7800_1092_0100 = + {0x1092, 0x0100, pci_subsys_8086_7800_1092_0100, 0}; +#undef pci_ss_info_1092_0100 +#define pci_ss_info_1092_0100 pci_ss_info_8086_7800_1092_0100 +static const pciSubsystemInfo pci_ss_info_8086_7800_10b4_201a = + {0x10b4, 0x201a, pci_subsys_8086_7800_10b4_201a, 0}; +#undef pci_ss_info_10b4_201a +#define pci_ss_info_10b4_201a pci_ss_info_8086_7800_10b4_201a +static const pciSubsystemInfo pci_ss_info_8086_7800_10b4_202f = + {0x10b4, 0x202f, pci_subsys_8086_7800_10b4_202f, 0}; +#undef pci_ss_info_10b4_202f +#define pci_ss_info_10b4_202f pci_ss_info_8086_7800_10b4_202f +static const pciSubsystemInfo pci_ss_info_8086_7800_8086_0000 = + {0x8086, 0x0000, pci_subsys_8086_7800_8086_0000, 0}; +#undef pci_ss_info_8086_0000 +#define pci_ss_info_8086_0000 pci_ss_info_8086_7800_8086_0000 +static const pciSubsystemInfo pci_ss_info_8086_7800_8086_0100 = + {0x8086, 0x0100, pci_subsys_8086_7800_8086_0100, 0}; +#undef pci_ss_info_8086_0100 +#define pci_ss_info_8086_0100 pci_ss_info_8086_7800_8086_0100 +static const pciSubsystemInfo pci_ss_info_8086_b555_e4bf_1000 = + {0xe4bf, 0x1000, pci_subsys_8086_b555_e4bf_1000, 0}; +#undef pci_ss_info_e4bf_1000 +#define pci_ss_info_e4bf_1000 pci_ss_info_8086_b555_e4bf_1000 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_9004_5078_9004_7850 = + {0x9004, 0x7850, pci_subsys_9004_5078_9004_7850, 0}; +#undef pci_ss_info_9004_7850 +#define pci_ss_info_9004_7850 pci_ss_info_9004_5078_9004_7850 +static const pciSubsystemInfo pci_ss_info_9004_5647_9004_7710 = + {0x9004, 0x7710, pci_subsys_9004_5647_9004_7710, 0}; +#undef pci_ss_info_9004_7710 +#define pci_ss_info_9004_7710 pci_ss_info_9004_5647_9004_7710 +static const pciSubsystemInfo pci_ss_info_9004_5647_9004_7711 = + {0x9004, 0x7711, pci_subsys_9004_5647_9004_7711, 0}; +#undef pci_ss_info_9004_7711 +#define pci_ss_info_9004_7711 pci_ss_info_9004_5647_9004_7711 +static const pciSubsystemInfo pci_ss_info_9004_6075_9004_7560 = + {0x9004, 0x7560, pci_subsys_9004_6075_9004_7560, 0}; +#undef pci_ss_info_9004_7560 +#define pci_ss_info_9004_7560 pci_ss_info_9004_6075_9004_7560 +static const pciSubsystemInfo pci_ss_info_9004_6178_9004_7861 = + {0x9004, 0x7861, pci_subsys_9004_6178_9004_7861, 0}; +#undef pci_ss_info_9004_7861 +#define pci_ss_info_9004_7861 pci_ss_info_9004_6178_9004_7861 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0008 = + {0x9004, 0x0008, pci_subsys_9004_6915_9004_0008, 0}; +#undef pci_ss_info_9004_0008 +#define pci_ss_info_9004_0008 pci_ss_info_9004_6915_9004_0008 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0009 = + {0x9004, 0x0009, pci_subsys_9004_6915_9004_0009, 0}; +#undef pci_ss_info_9004_0009 +#define pci_ss_info_9004_0009 pci_ss_info_9004_6915_9004_0009 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0010 = + {0x9004, 0x0010, pci_subsys_9004_6915_9004_0010, 0}; +#undef pci_ss_info_9004_0010 +#define pci_ss_info_9004_0010 pci_ss_info_9004_6915_9004_0010 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0018 = + {0x9004, 0x0018, pci_subsys_9004_6915_9004_0018, 0}; +#undef pci_ss_info_9004_0018 +#define pci_ss_info_9004_0018 pci_ss_info_9004_6915_9004_0018 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0019 = + {0x9004, 0x0019, pci_subsys_9004_6915_9004_0019, 0}; +#undef pci_ss_info_9004_0019 +#define pci_ss_info_9004_0019 pci_ss_info_9004_6915_9004_0019 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0020 = + {0x9004, 0x0020, pci_subsys_9004_6915_9004_0020, 0}; +#undef pci_ss_info_9004_0020 +#define pci_ss_info_9004_0020 pci_ss_info_9004_6915_9004_0020 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_0028 = + {0x9004, 0x0028, pci_subsys_9004_6915_9004_0028, 0}; +#undef pci_ss_info_9004_0028 +#define pci_ss_info_9004_0028 pci_ss_info_9004_6915_9004_0028 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8008 = + {0x9004, 0x8008, pci_subsys_9004_6915_9004_8008, 0}; +#undef pci_ss_info_9004_8008 +#define pci_ss_info_9004_8008 pci_ss_info_9004_6915_9004_8008 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8009 = + {0x9004, 0x8009, pci_subsys_9004_6915_9004_8009, 0}; +#undef pci_ss_info_9004_8009 +#define pci_ss_info_9004_8009 pci_ss_info_9004_6915_9004_8009 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8010 = + {0x9004, 0x8010, pci_subsys_9004_6915_9004_8010, 0}; +#undef pci_ss_info_9004_8010 +#define pci_ss_info_9004_8010 pci_ss_info_9004_6915_9004_8010 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8018 = + {0x9004, 0x8018, pci_subsys_9004_6915_9004_8018, 0}; +#undef pci_ss_info_9004_8018 +#define pci_ss_info_9004_8018 pci_ss_info_9004_6915_9004_8018 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8019 = + {0x9004, 0x8019, pci_subsys_9004_6915_9004_8019, 0}; +#undef pci_ss_info_9004_8019 +#define pci_ss_info_9004_8019 pci_ss_info_9004_6915_9004_8019 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8020 = + {0x9004, 0x8020, pci_subsys_9004_6915_9004_8020, 0}; +#undef pci_ss_info_9004_8020 +#define pci_ss_info_9004_8020 pci_ss_info_9004_6915_9004_8020 +static const pciSubsystemInfo pci_ss_info_9004_6915_9004_8028 = + {0x9004, 0x8028, pci_subsys_9004_6915_9004_8028, 0}; +#undef pci_ss_info_9004_8028 +#define pci_ss_info_9004_8028 pci_ss_info_9004_6915_9004_8028 +static const pciSubsystemInfo pci_ss_info_9004_7815_9004_7815 = + {0x9004, 0x7815, pci_subsys_9004_7815_9004_7815, 0}; +#undef pci_ss_info_9004_7815 +#define pci_ss_info_9004_7815 pci_ss_info_9004_7815_9004_7815 +static const pciSubsystemInfo pci_ss_info_9004_7815_9004_7840 = + {0x9004, 0x7840, pci_subsys_9004_7815_9004_7840, 0}; +#undef pci_ss_info_9004_7840 +#define pci_ss_info_9004_7840 pci_ss_info_9004_7815_9004_7840 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7890 = + {0x9004, 0x7890, pci_subsys_9004_7895_9004_7890, 0}; +#undef pci_ss_info_9004_7890 +#define pci_ss_info_9004_7890 pci_ss_info_9004_7895_9004_7890 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7891 = + {0x9004, 0x7891, pci_subsys_9004_7895_9004_7891, 0}; +#undef pci_ss_info_9004_7891 +#define pci_ss_info_9004_7891 pci_ss_info_9004_7895_9004_7891 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7892 = + {0x9004, 0x7892, pci_subsys_9004_7895_9004_7892, 0}; +#undef pci_ss_info_9004_7892 +#define pci_ss_info_9004_7892 pci_ss_info_9004_7895_9004_7892 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7894 = + {0x9004, 0x7894, pci_subsys_9004_7895_9004_7894, 0}; +#undef pci_ss_info_9004_7894 +#define pci_ss_info_9004_7894 pci_ss_info_9004_7895_9004_7894 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7895 = + {0x9004, 0x7895, pci_subsys_9004_7895_9004_7895, 0}; +#undef pci_ss_info_9004_7895 +#define pci_ss_info_9004_7895 pci_ss_info_9004_7895_9004_7895 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7896 = + {0x9004, 0x7896, pci_subsys_9004_7895_9004_7896, 0}; +#undef pci_ss_info_9004_7896 +#define pci_ss_info_9004_7896 pci_ss_info_9004_7895_9004_7896 +static const pciSubsystemInfo pci_ss_info_9004_7895_9004_7897 = + {0x9004, 0x7897, pci_subsys_9004_7895_9004_7897, 0}; +#undef pci_ss_info_9004_7897 +#define pci_ss_info_9004_7897 pci_ss_info_9004_7895_9004_7897 +static const pciSubsystemInfo pci_ss_info_9004_8078_9004_7880 = + {0x9004, 0x7880, pci_subsys_9004_8078_9004_7880, 0}; +#undef pci_ss_info_9004_7880 +#define pci_ss_info_9004_7880 pci_ss_info_9004_8078_9004_7880 +static const pciSubsystemInfo pci_ss_info_9004_8178_9004_7881 = + {0x9004, 0x7881, pci_subsys_9004_8178_9004_7881, 0}; +#undef pci_ss_info_9004_7881 +#define pci_ss_info_9004_7881 pci_ss_info_9004_8178_9004_7881 +static const pciSubsystemInfo pci_ss_info_9004_8778_9004_7887 = + {0x9004, 0x7887, pci_subsys_9004_8778_9004_7887, 0}; +#undef pci_ss_info_9004_7887 +#define pci_ss_info_9004_7887 pci_ss_info_9004_8778_9004_7887 +static const pciSubsystemInfo pci_ss_info_9004_8878_9004_7888 = + {0x9004, 0x7888, pci_subsys_9004_8878_9004_7888, 0}; +#undef pci_ss_info_9004_7888 +#define pci_ss_info_9004_7888 pci_ss_info_9004_8878_9004_7888 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_9005_0010_9005_2180 = + {0x9005, 0x2180, pci_subsys_9005_0010_9005_2180, 0}; +#undef pci_ss_info_9005_2180 +#define pci_ss_info_9005_2180 pci_ss_info_9005_0010_9005_2180 +static const pciSubsystemInfo pci_ss_info_9005_0010_9005_8100 = + {0x9005, 0x8100, pci_subsys_9005_0010_9005_8100, 0}; +#undef pci_ss_info_9005_8100 +#define pci_ss_info_9005_8100 pci_ss_info_9005_0010_9005_8100 +static const pciSubsystemInfo pci_ss_info_9005_0010_9005_a180 = + {0x9005, 0xa180, pci_subsys_9005_0010_9005_a180, 0}; +#undef pci_ss_info_9005_a180 +#define pci_ss_info_9005_a180 pci_ss_info_9005_0010_9005_a180 +static const pciSubsystemInfo pci_ss_info_9005_0010_9005_e100 = + {0x9005, 0xe100, pci_subsys_9005_0010_9005_e100, 0}; +#undef pci_ss_info_9005_e100 +#define pci_ss_info_9005_e100 pci_ss_info_9005_0010_9005_e100 +static const pciSubsystemInfo pci_ss_info_9005_0013_9005_0003 = + {0x9005, 0x0003, pci_subsys_9005_0013_9005_0003, 0}; +#undef pci_ss_info_9005_0003 +#define pci_ss_info_9005_0003 pci_ss_info_9005_0013_9005_0003 +static const pciSubsystemInfo pci_ss_info_9005_001f_9005_000f = + {0x9005, 0x000f, pci_subsys_9005_001f_9005_000f, 0}; +#undef pci_ss_info_9005_000f +#define pci_ss_info_9005_000f pci_ss_info_9005_001f_9005_000f +static const pciSubsystemInfo pci_ss_info_9005_001f_9005_a180 = + {0x9005, 0xa180, pci_subsys_9005_001f_9005_a180, 0}; +#undef pci_ss_info_9005_a180 +#define pci_ss_info_9005_a180 pci_ss_info_9005_001f_9005_a180 +static const pciSubsystemInfo pci_ss_info_9005_0050_9005_f500 = + {0x9005, 0xf500, pci_subsys_9005_0050_9005_f500, 0}; +#undef pci_ss_info_9005_f500 +#define pci_ss_info_9005_f500 pci_ss_info_9005_0050_9005_f500 +static const pciSubsystemInfo pci_ss_info_9005_0051_9005_b500 = + {0x9005, 0xb500, pci_subsys_9005_0051_9005_b500, 0}; +#undef pci_ss_info_9005_b500 +#define pci_ss_info_9005_b500 pci_ss_info_9005_0051_9005_b500 +static const pciSubsystemInfo pci_ss_info_9005_0053_9005_ffff = + {0x9005, 0xffff, pci_subsys_9005_0053_9005_ffff, 0}; +#undef pci_ss_info_9005_ffff +#define pci_ss_info_9005_ffff pci_ss_info_9005_0053_9005_ffff +#endif +static const pciSubsystemInfo pci_ss_info_9005_0080_0e11_e2a0 = + {0x0e11, 0xe2a0, pci_subsys_9005_0080_0e11_e2a0, 0}; +#undef pci_ss_info_0e11_e2a0 +#define pci_ss_info_0e11_e2a0 pci_ss_info_9005_0080_0e11_e2a0 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_9005_0080_9005_62a0 = + {0x9005, 0x62a0, pci_subsys_9005_0080_9005_62a0, 0}; +#undef pci_ss_info_9005_62a0 +#define pci_ss_info_9005_62a0 pci_ss_info_9005_0080_9005_62a0 +static const pciSubsystemInfo pci_ss_info_9005_0080_9005_e220 = + {0x9005, 0xe220, pci_subsys_9005_0080_9005_e220, 0}; +#undef pci_ss_info_9005_e220 +#define pci_ss_info_9005_e220 pci_ss_info_9005_0080_9005_e220 +static const pciSubsystemInfo pci_ss_info_9005_0080_9005_e2a0 = + {0x9005, 0xe2a0, pci_subsys_9005_0080_9005_e2a0, 0}; +#undef pci_ss_info_9005_e2a0 +#define pci_ss_info_9005_e2a0 pci_ss_info_9005_0080_9005_e2a0 +static const pciSubsystemInfo pci_ss_info_9005_0081_9005_62a1 = + {0x9005, 0x62a1, pci_subsys_9005_0081_9005_62a1, 0}; +#undef pci_ss_info_9005_62a1 +#define pci_ss_info_9005_62a1 pci_ss_info_9005_0081_9005_62a1 +static const pciSubsystemInfo pci_ss_info_9005_008f_1179_0001 = + {0x1179, 0x0001, pci_subsys_9005_008f_1179_0001, 0}; +#undef pci_ss_info_1179_0001 +#define pci_ss_info_1179_0001 pci_ss_info_9005_008f_1179_0001 +static const pciSubsystemInfo pci_ss_info_9005_008f_15d9_9005 = + {0x15d9, 0x9005, pci_subsys_9005_008f_15d9_9005, 0}; +#undef pci_ss_info_15d9_9005 +#define pci_ss_info_15d9_9005 pci_ss_info_9005_008f_15d9_9005 +#endif +static const pciSubsystemInfo pci_ss_info_9005_00c0_0e11_f620 = + {0x0e11, 0xf620, pci_subsys_9005_00c0_0e11_f620, 0}; +#undef pci_ss_info_0e11_f620 +#define pci_ss_info_0e11_f620 pci_ss_info_9005_00c0_0e11_f620 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_9005_00c0_9005_f620 = + {0x9005, 0xf620, pci_subsys_9005_00c0_9005_f620, 0}; +#undef pci_ss_info_9005_f620 +#define pci_ss_info_9005_f620 pci_ss_info_9005_00c0_9005_f620 +#endif +static const pciSubsystemInfo pci_ss_info_9005_00c5_1028_00c5 = + {0x1028, 0x00c5, pci_subsys_9005_00c5_1028_00c5, 0}; +#undef pci_ss_info_1028_00c5 +#define pci_ss_info_1028_00c5 pci_ss_info_9005_00c5_1028_00c5 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_9005_00cf_1028_00d1 = + {0x1028, 0x00d1, pci_subsys_9005_00cf_1028_00d1, 0}; +#undef pci_ss_info_1028_00d1 +#define pci_ss_info_1028_00d1 pci_ss_info_9005_00cf_1028_00d1 +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_9005_00cf_10f1_2462 = + {0x10f1, 0x2462, pci_subsys_9005_00cf_10f1_2462, 0}; +#undef pci_ss_info_10f1_2462 +#define pci_ss_info_10f1_2462 pci_ss_info_9005_00cf_10f1_2462 +static const pciSubsystemInfo pci_ss_info_9005_00cf_15d9_9005 = + {0x15d9, 0x9005, pci_subsys_9005_00cf_15d9_9005, 0}; +#undef pci_ss_info_15d9_9005 +#define pci_ss_info_15d9_9005 pci_ss_info_9005_00cf_15d9_9005 +static const pciSubsystemInfo pci_ss_info_9005_0250_1014_0279 = + {0x1014, 0x0279, pci_subsys_9005_0250_1014_0279, 0}; +#undef pci_ss_info_1014_0279 +#define pci_ss_info_1014_0279 pci_ss_info_9005_0250_1014_0279 +static const pciSubsystemInfo pci_ss_info_9005_0250_1014_028c = + {0x1014, 0x028c, pci_subsys_9005_0250_1014_028c, 0}; +#undef pci_ss_info_1014_028c +#define pci_ss_info_1014_028c pci_ss_info_9005_0250_1014_028c +#endif +static const pciSubsystemInfo pci_ss_info_9005_0285_1028_0287 = + {0x1028, 0x0287, pci_subsys_9005_0285_1028_0287, 0}; +#undef pci_ss_info_1028_0287 +#define pci_ss_info_1028_0287 pci_ss_info_9005_0285_1028_0287 +#ifdef VENDOR_INCLUDE_NONVIDEO +#endif +static const pciSubsystemInfo pci_ss_info_9005_8011_0e11_00ac = + {0x0e11, 0x00ac, pci_subsys_9005_8011_0e11_00ac, 0}; +#undef pci_ss_info_0e11_00ac +#define pci_ss_info_0e11_00ac pci_ss_info_9005_8011_0e11_00ac +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_9005_8011_9005_0041 = + {0x9005, 0x0041, pci_subsys_9005_8011_9005_0041, 0}; +#undef pci_ss_info_9005_0041 +#define pci_ss_info_9005_0041 pci_ss_info_9005_8011_9005_0041 +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo pci_ss_info_e159_0001_0059_0001 = + {0x0059, 0x0001, pci_subsys_e159_0001_0059_0001, 0}; +#undef pci_ss_info_0059_0001 +#define pci_ss_info_0059_0001 pci_ss_info_e159_0001_0059_0001 +static const pciSubsystemInfo pci_ss_info_e159_0001_0059_0003 = + {0x0059, 0x0003, pci_subsys_e159_0001_0059_0003, 0}; +#undef pci_ss_info_0059_0003 +#define pci_ss_info_0059_0003 pci_ss_info_e159_0001_0059_0003 +#endif +#define pci_ss_list_0675_1700 NULL +#define pci_ss_list_0675_1702 NULL +#define pci_ss_list_09c1_0704 NULL +#define pci_ss_list_0e11_0001 NULL +#define pci_ss_list_0e11_0002 NULL +#define pci_ss_list_0e11_0049 NULL +#define pci_ss_list_0e11_004a NULL +#define pci_ss_list_0e11_0508 NULL +#define pci_ss_list_0e11_1000 NULL +#define pci_ss_list_0e11_2000 NULL +#define pci_ss_list_0e11_3032 NULL +#define pci_ss_list_0e11_3033 NULL +#define pci_ss_list_0e11_3034 NULL +#define pci_ss_list_0e11_4000 NULL +#define pci_ss_list_0e11_6010 NULL +#define pci_ss_list_0e11_7020 NULL +#define pci_ss_list_0e11_a0ec NULL +#define pci_ss_list_0e11_a0f0 NULL +#define pci_ss_list_0e11_a0f3 NULL +static const pciSubsystemInfo *pci_ss_list_0e11_a0f7[] = { + &pci_ss_info_0e11_a0f7_8086_002a, + &pci_ss_info_0e11_a0f7_8086_002b, + NULL +}; +#define pci_ss_list_0e11_a0f8 NULL +#define pci_ss_list_0e11_a0fc NULL +static const pciSubsystemInfo *pci_ss_list_0e11_ae10[] = { + &pci_ss_info_0e11_ae10_0e11_4030, + &pci_ss_info_0e11_ae10_0e11_4031, + &pci_ss_info_0e11_ae10_0e11_4032, + &pci_ss_info_0e11_ae10_0e11_4033, + NULL +}; +#define pci_ss_list_0e11_ae29 NULL +#define pci_ss_list_0e11_ae2a NULL +#define pci_ss_list_0e11_ae2b NULL +#define pci_ss_list_0e11_ae31 NULL +#define pci_ss_list_0e11_ae32 NULL +#define pci_ss_list_0e11_ae33 NULL +#define pci_ss_list_0e11_ae34 NULL +#define pci_ss_list_0e11_ae35 NULL +#define pci_ss_list_0e11_ae40 NULL +#define pci_ss_list_0e11_ae43 NULL +#define pci_ss_list_0e11_ae69 NULL +#define pci_ss_list_0e11_ae6c NULL +#define pci_ss_list_0e11_ae6d NULL +#define pci_ss_list_0e11_b011 NULL +#define pci_ss_list_0e11_b012 NULL +#define pci_ss_list_0e11_b01e NULL +#define pci_ss_list_0e11_b01f NULL +#define pci_ss_list_0e11_b02f NULL +#define pci_ss_list_0e11_b030 NULL +#define pci_ss_list_0e11_b04a NULL +#define pci_ss_list_0e11_b060 NULL +#define pci_ss_list_0e11_b0c6 NULL +#define pci_ss_list_0e11_b0c7 NULL +#define pci_ss_list_0e11_b0d7 NULL +#define pci_ss_list_0e11_b0dd NULL +#define pci_ss_list_0e11_b0de NULL +#define pci_ss_list_0e11_b0df NULL +#define pci_ss_list_0e11_b0e0 NULL +#define pci_ss_list_0e11_b0e1 NULL +#define pci_ss_list_0e11_b123 NULL +#define pci_ss_list_0e11_b134 NULL +#define pci_ss_list_0e11_b13c NULL +#define pci_ss_list_0e11_b144 NULL +#define pci_ss_list_0e11_b163 NULL +#define pci_ss_list_0e11_b164 NULL +#define pci_ss_list_0e11_b178 NULL +#define pci_ss_list_0e11_b1a4 NULL +#define pci_ss_list_0e11_f130 NULL +#define pci_ss_list_0e11_f150 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1000_0001[] = { + &pci_ss_info_1000_0001_1000_1000, + NULL +}; +#define pci_ss_list_1000_0002 NULL +#define pci_ss_list_1000_0003 NULL +#define pci_ss_list_1000_0004 NULL +#define pci_ss_list_1000_0005 NULL +#define pci_ss_list_1000_0006 NULL +#define pci_ss_list_1000_000a NULL +#define pci_ss_list_1000_000b NULL +static const pciSubsystemInfo *pci_ss_list_1000_000c[] = { + &pci_ss_info_1000_000c_1de1_3907, + NULL +}; +#define pci_ss_list_1000_000d NULL +static const pciSubsystemInfo *pci_ss_list_1000_000f[] = { + &pci_ss_info_1000_000f_0e11_7004, + &pci_ss_info_1000_000f_1092_8760, + &pci_ss_info_1000_000f_1de1_3904, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1000_0010[] = { + &pci_ss_info_1000_0010_0e11_4040, + &pci_ss_info_1000_0010_0e11_4048, + NULL +}; +#define pci_ss_list_1000_0012 NULL +#define pci_ss_list_1000_0013 NULL +static const pciSubsystemInfo *pci_ss_list_1000_0020[] = { + &pci_ss_info_1000_0020_1de1_1020, + NULL +}; +#define pci_ss_list_1000_0021 NULL +static const pciSubsystemInfo *pci_ss_list_1000_0030[] = { + &pci_ss_info_1000_0030_1028_1010, + NULL +}; +#define pci_ss_list_1000_0040 NULL +static const pciSubsystemInfo *pci_ss_list_1000_008f[] = { + &pci_ss_info_1000_008f_1092_8000, + &pci_ss_info_1000_008f_1092_8760, + NULL +}; +#define pci_ss_list_1000_0621 NULL +#define pci_ss_list_1000_0622 NULL +#define pci_ss_list_1000_0623 NULL +#define pci_ss_list_1000_0624 NULL +#define pci_ss_list_1000_0625 NULL +#define pci_ss_list_1000_0626 NULL +#define pci_ss_list_1000_0627 NULL +#define pci_ss_list_1000_0628 NULL +#define pci_ss_list_1000_0629 NULL +#define pci_ss_list_1000_0701 NULL +static const pciSubsystemInfo *pci_ss_list_1000_0702[] = { + &pci_ss_info_1000_0702_1318_0000, + NULL +}; +#define pci_ss_list_1000_0901 NULL +#define pci_ss_list_1000_1000 NULL +static const pciSubsystemInfo *pci_ss_list_1000_1960[] = { + &pci_ss_info_1000_1960_1028_0518, + &pci_ss_info_1000_1960_1028_0520, + &pci_ss_info_1000_1960_1028_0531, + NULL +}; +#endif +#define pci_ss_list_1001_0010 NULL +#define pci_ss_list_1001_0011 NULL +#define pci_ss_list_1001_0012 NULL +#define pci_ss_list_1001_0013 NULL +#define pci_ss_list_1001_0014 NULL +#define pci_ss_list_1001_0015 NULL +#define pci_ss_list_1001_0016 NULL +#define pci_ss_list_1001_0017 NULL +#define pci_ss_list_1001_9100 NULL +#define pci_ss_list_1002_4144 NULL +#define pci_ss_list_1002_4145 NULL +#define pci_ss_list_1002_4146 NULL +#define pci_ss_list_1002_4147 NULL +#define pci_ss_list_1002_4158 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4242[] = { + &pci_ss_info_1002_4242_1002_02aa, + NULL +}; +#define pci_ss_list_1002_4336 NULL +#define pci_ss_list_1002_4337 NULL +#define pci_ss_list_1002_4354 NULL +#define pci_ss_list_1002_4358 NULL +#define pci_ss_list_1002_4554 NULL +#define pci_ss_list_1002_4654 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4742[] = { + &pci_ss_info_1002_4742_1002_0040, + &pci_ss_info_1002_4742_1002_0044, + &pci_ss_info_1002_4742_1002_0061, + &pci_ss_info_1002_4742_1002_0062, + &pci_ss_info_1002_4742_1002_0063, + &pci_ss_info_1002_4742_1002_0080, + &pci_ss_info_1002_4742_1002_0084, + &pci_ss_info_1002_4742_1002_4742, + &pci_ss_info_1002_4742_1002_8001, + &pci_ss_info_1002_4742_1028_0082, + &pci_ss_info_1002_4742_1028_4082, + &pci_ss_info_1002_4742_1028_8082, + &pci_ss_info_1002_4742_1028_c082, + &pci_ss_info_1002_4742_8086_4152, + &pci_ss_info_1002_4742_8086_464a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_4744[] = { + &pci_ss_info_1002_4744_1002_4744, + NULL +}; +#define pci_ss_list_1002_4747 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4749[] = { + &pci_ss_info_1002_4749_1002_0061, + &pci_ss_info_1002_4749_1002_0062, + NULL +}; +#define pci_ss_list_1002_474c NULL +static const pciSubsystemInfo *pci_ss_list_1002_474d[] = { + &pci_ss_info_1002_474d_1002_0004, + &pci_ss_info_1002_474d_1002_0008, + &pci_ss_info_1002_474d_1002_0080, + &pci_ss_info_1002_474d_1002_0084, + &pci_ss_info_1002_474d_1002_474d, + &pci_ss_info_1002_474d_1033_806a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_474e[] = { + &pci_ss_info_1002_474e_1002_474e, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_474f[] = { + &pci_ss_info_1002_474f_1002_0008, + &pci_ss_info_1002_474f_1002_474f, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_4750[] = { + &pci_ss_info_1002_4750_1002_0040, + &pci_ss_info_1002_4750_1002_0044, + &pci_ss_info_1002_4750_1002_0080, + &pci_ss_info_1002_4750_1002_0084, + &pci_ss_info_1002_4750_1002_4750, + NULL +}; +#define pci_ss_list_1002_4751 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4752[] = { + &pci_ss_info_1002_4752_1002_0008, + &pci_ss_info_1002_4752_1002_4752, + &pci_ss_info_1002_4752_1002_8008, + &pci_ss_info_1002_4752_1028_00d1, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_4753[] = { + &pci_ss_info_1002_4753_1002_4753, + NULL +}; +#define pci_ss_list_1002_4754 NULL +#define pci_ss_list_1002_4755 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4756[] = { + &pci_ss_info_1002_4756_1002_4756, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_4757[] = { + &pci_ss_info_1002_4757_1002_4757, + &pci_ss_info_1002_4757_1028_0089, + &pci_ss_info_1002_4757_1028_4082, + &pci_ss_info_1002_4757_1028_8082, + &pci_ss_info_1002_4757_1028_c082, + NULL +}; +#define pci_ss_list_1002_4758 NULL +#define pci_ss_list_1002_4759 NULL +static const pciSubsystemInfo *pci_ss_list_1002_475a[] = { + &pci_ss_info_1002_475a_1002_0087, + &pci_ss_info_1002_475a_1002_475a, + NULL +}; +#define pci_ss_list_1002_4964 NULL +#define pci_ss_list_1002_4965 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4966[] = { + &pci_ss_info_1002_4966_10f1_0002, + &pci_ss_info_1002_4966_148c_2039, + &pci_ss_info_1002_4966_1509_9a00, + &pci_ss_info_1002_4966_1681_0040, + &pci_ss_info_1002_4966_174b_7176, + &pci_ss_info_1002_4966_174b_7192, + &pci_ss_info_1002_4966_17af_2005, + &pci_ss_info_1002_4966_17af_2006, + NULL +}; +#define pci_ss_list_1002_4967 NULL +#define pci_ss_list_1002_496e NULL +static const pciSubsystemInfo *pci_ss_list_1002_4c42[] = { + &pci_ss_info_1002_4c42_0e11_b0e8, + &pci_ss_info_1002_4c42_0e11_b10e, + &pci_ss_info_1002_4c42_1002_0040, + &pci_ss_info_1002_4c42_1002_0044, + &pci_ss_info_1002_4c42_1002_4c42, + &pci_ss_info_1002_4c42_1002_8001, + &pci_ss_info_1002_4c42_1028_0085, + NULL +}; +#define pci_ss_list_1002_4c44 NULL +#define pci_ss_list_1002_4c45 NULL +#define pci_ss_list_1002_4c46 NULL +#define pci_ss_list_1002_4c47 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4c49[] = { + &pci_ss_info_1002_4c49_1002_0004, + &pci_ss_info_1002_4c49_1002_0040, + &pci_ss_info_1002_4c49_1002_0044, + &pci_ss_info_1002_4c49_1002_4c49, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_4c4d[] = { + &pci_ss_info_1002_4c4d_0e11_b111, + &pci_ss_info_1002_4c4d_1002_0084, + &pci_ss_info_1002_4c4d_1014_0154, + NULL +}; +#define pci_ss_list_1002_4c4e NULL +static const pciSubsystemInfo *pci_ss_list_1002_4c50[] = { + &pci_ss_info_1002_4c50_1002_4c50, + NULL +}; +#define pci_ss_list_1002_4c51 NULL +#define pci_ss_list_1002_4c52 NULL +#define pci_ss_list_1002_4c53 NULL +#define pci_ss_list_1002_4c54 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4c57[] = { + &pci_ss_info_1002_4c57_1014_0517, + &pci_ss_info_1002_4c57_1028_00e6, + &pci_ss_info_1002_4c57_144d_c006, + NULL +}; +#define pci_ss_list_1002_4c58 NULL +static const pciSubsystemInfo *pci_ss_list_1002_4c59[] = { + &pci_ss_info_1002_4c59_1014_0235, + &pci_ss_info_1002_4c59_1014_0239, + &pci_ss_info_1002_4c59_104d_80e7, + NULL +}; +#define pci_ss_list_1002_4c5a NULL +#define pci_ss_list_1002_4c64 NULL +#define pci_ss_list_1002_4c65 NULL +#define pci_ss_list_1002_4c66 NULL +#define pci_ss_list_1002_4c67 NULL +#define pci_ss_list_1002_4d46 NULL +#define pci_ss_list_1002_4d4c NULL +#define pci_ss_list_1002_4e44 NULL +#define pci_ss_list_1002_4e45 NULL +#define pci_ss_list_1002_4e46 NULL +#define pci_ss_list_1002_4e47 NULL +#define pci_ss_list_1002_4e64 NULL +#define pci_ss_list_1002_4e65 NULL +#define pci_ss_list_1002_4e66 NULL +#define pci_ss_list_1002_4e67 NULL +#define pci_ss_list_1002_5041 NULL +#define pci_ss_list_1002_5042 NULL +#define pci_ss_list_1002_5043 NULL +static const pciSubsystemInfo *pci_ss_list_1002_5044[] = { + &pci_ss_info_1002_5044_1002_0028, + &pci_ss_info_1002_5044_1002_0029, + NULL +}; +#define pci_ss_list_1002_5045 NULL +static const pciSubsystemInfo *pci_ss_list_1002_5046[] = { + &pci_ss_info_1002_5046_1002_0004, + &pci_ss_info_1002_5046_1002_0008, + &pci_ss_info_1002_5046_1002_0014, + &pci_ss_info_1002_5046_1002_0018, + &pci_ss_info_1002_5046_1002_0028, + &pci_ss_info_1002_5046_1002_002a, + &pci_ss_info_1002_5046_1002_0048, + &pci_ss_info_1002_5046_1002_2000, + &pci_ss_info_1002_5046_1002_2001, + NULL +}; +#define pci_ss_list_1002_5047 NULL +#define pci_ss_list_1002_5048 NULL +#define pci_ss_list_1002_5049 NULL +#define pci_ss_list_1002_504a NULL +#define pci_ss_list_1002_504b NULL +#define pci_ss_list_1002_504c NULL +#define pci_ss_list_1002_504d NULL +#define pci_ss_list_1002_504e NULL +#define pci_ss_list_1002_504f NULL +static const pciSubsystemInfo *pci_ss_list_1002_5050[] = { + &pci_ss_info_1002_5050_1002_0008, + NULL +}; +#define pci_ss_list_1002_5051 NULL +#define pci_ss_list_1002_5052 NULL +#define pci_ss_list_1002_5053 NULL +#define pci_ss_list_1002_5054 NULL +#define pci_ss_list_1002_5055 NULL +#define pci_ss_list_1002_5056 NULL +#define pci_ss_list_1002_5057 NULL +#define pci_ss_list_1002_5058 NULL +static const pciSubsystemInfo *pci_ss_list_1002_5144[] = { + &pci_ss_info_1002_5144_1002_0008, + &pci_ss_info_1002_5144_1002_0009, + &pci_ss_info_1002_5144_1002_000a, + &pci_ss_info_1002_5144_1002_001a, + &pci_ss_info_1002_5144_1002_0029, + &pci_ss_info_1002_5144_1002_0038, + &pci_ss_info_1002_5144_1002_0039, + &pci_ss_info_1002_5144_1002_008a, + &pci_ss_info_1002_5144_1002_00ba, + &pci_ss_info_1002_5144_1002_0139, + &pci_ss_info_1002_5144_1002_028a, + &pci_ss_info_1002_5144_1002_02aa, + &pci_ss_info_1002_5144_1002_053a, + NULL +}; +#define pci_ss_list_1002_5145 NULL +#define pci_ss_list_1002_5146 NULL +#define pci_ss_list_1002_5147 NULL +static const pciSubsystemInfo *pci_ss_list_1002_5148[] = { + &pci_ss_info_1002_5148_1002_010a, + &pci_ss_info_1002_5148_1002_0152, + &pci_ss_info_1002_5148_1002_0162, + &pci_ss_info_1002_5148_1002_0172, + NULL +}; +#define pci_ss_list_1002_5149 NULL +#define pci_ss_list_1002_514a NULL +#define pci_ss_list_1002_514b NULL +static const pciSubsystemInfo *pci_ss_list_1002_514c[] = { + &pci_ss_info_1002_514c_1002_003a, + &pci_ss_info_1002_514c_1002_013a, + &pci_ss_info_1002_514c_148c_2026, + &pci_ss_info_1002_514c_174b_7149, + NULL +}; +#define pci_ss_list_1002_514d NULL +#define pci_ss_list_1002_514e NULL +#define pci_ss_list_1002_514f NULL +static const pciSubsystemInfo *pci_ss_list_1002_5157[] = { + &pci_ss_info_1002_5157_1002_013a, + &pci_ss_info_1002_5157_1458_4000, + &pci_ss_info_1002_5157_148c_2024, + &pci_ss_info_1002_5157_148c_2025, + &pci_ss_info_1002_5157_148c_2036, + &pci_ss_info_1002_5157_174b_7147, + &pci_ss_info_1002_5157_174b_7161, + &pci_ss_info_1002_5157_17af_0202, + NULL +}; +#define pci_ss_list_1002_5158 NULL +static const pciSubsystemInfo *pci_ss_list_1002_5159[] = { + &pci_ss_info_1002_5159_1002_000a, + &pci_ss_info_1002_5159_1002_000b, + &pci_ss_info_1002_5159_1002_0038, + &pci_ss_info_1002_5159_1002_003a, + &pci_ss_info_1002_5159_1002_00ba, + &pci_ss_info_1002_5159_1002_013a, + &pci_ss_info_1002_5159_1458_4002, + &pci_ss_info_1002_5159_148c_2003, + &pci_ss_info_1002_5159_148c_2023, + &pci_ss_info_1002_5159_174b_7112, + &pci_ss_info_1002_5159_1787_0202, + NULL +}; +#define pci_ss_list_1002_515a NULL +#define pci_ss_list_1002_5168 NULL +#define pci_ss_list_1002_5169 NULL +#define pci_ss_list_1002_516a NULL +#define pci_ss_list_1002_516b NULL +#define pci_ss_list_1002_516c NULL +static const pciSubsystemInfo *pci_ss_list_1002_5245[] = { + &pci_ss_info_1002_5245_1002_0008, + &pci_ss_info_1002_5245_1002_0028, + &pci_ss_info_1002_5245_1002_0029, + &pci_ss_info_1002_5245_1002_0068, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_5246[] = { + &pci_ss_info_1002_5246_1002_0004, + &pci_ss_info_1002_5246_1002_0008, + &pci_ss_info_1002_5246_1002_0028, + &pci_ss_info_1002_5246_1002_0044, + &pci_ss_info_1002_5246_1002_0068, + &pci_ss_info_1002_5246_1002_0448, + NULL +}; +#define pci_ss_list_1002_5247 NULL +#define pci_ss_list_1002_524b NULL +static const pciSubsystemInfo *pci_ss_list_1002_524c[] = { + &pci_ss_info_1002_524c_1002_0008, + &pci_ss_info_1002_524c_1002_0088, + NULL +}; +#define pci_ss_list_1002_5345 NULL +#define pci_ss_list_1002_5346 NULL +#define pci_ss_list_1002_5347 NULL +#define pci_ss_list_1002_5348 NULL +#define pci_ss_list_1002_534b NULL +#define pci_ss_list_1002_534c NULL +static const pciSubsystemInfo *pci_ss_list_1002_534d[] = { + &pci_ss_info_1002_534d_1002_0008, + &pci_ss_info_1002_534d_1002_0018, + NULL +}; +#define pci_ss_list_1002_534e NULL +static const pciSubsystemInfo *pci_ss_list_1002_5354[] = { + &pci_ss_info_1002_5354_1002_5654, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1002_5446[] = { + &pci_ss_info_1002_5446_1002_0004, + &pci_ss_info_1002_5446_1002_0008, + &pci_ss_info_1002_5446_1002_0018, + &pci_ss_info_1002_5446_1002_0028, + &pci_ss_info_1002_5446_1002_0029, + &pci_ss_info_1002_5446_1002_002a, + &pci_ss_info_1002_5446_1002_002b, + &pci_ss_info_1002_5446_1002_0048, + NULL +}; +#define pci_ss_list_1002_544c NULL +static const pciSubsystemInfo *pci_ss_list_1002_5452[] = { + &pci_ss_info_1002_5452_1002_001c, + &pci_ss_info_1002_5452_103c_1279, + NULL +}; +#define pci_ss_list_1002_5453 NULL +#define pci_ss_list_1002_5454 NULL +#define pci_ss_list_1002_5455 NULL +static const pciSubsystemInfo *pci_ss_list_1002_5654[] = { + &pci_ss_info_1002_5654_1002_5654, + NULL +}; +#define pci_ss_list_1002_5655 NULL +#define pci_ss_list_1002_5656 NULL +#define pci_ss_list_1002_700f NULL +#define pci_ss_list_1003_0201 NULL +#define pci_ss_list_1004_0005 NULL +#define pci_ss_list_1004_0006 NULL +#define pci_ss_list_1004_0007 NULL +#define pci_ss_list_1004_0008 NULL +#define pci_ss_list_1004_0009 NULL +#define pci_ss_list_1004_000c NULL +#define pci_ss_list_1004_000d NULL +#define pci_ss_list_1004_0101 NULL +#define pci_ss_list_1004_0102 NULL +#define pci_ss_list_1004_0103 NULL +#define pci_ss_list_1004_0104 NULL +#define pci_ss_list_1004_0105 NULL +#define pci_ss_list_1004_0200 NULL +#define pci_ss_list_1004_0280 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1004_0304[] = { + &pci_ss_info_1004_0304_1004_0304, + &pci_ss_info_1004_0304_122d_1206, + &pci_ss_info_1004_0304_1483_5020, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1004_0305[] = { + &pci_ss_info_1004_0305_1004_0305, + &pci_ss_info_1004_0305_122d_1207, + &pci_ss_info_1004_0305_1483_5021, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1004_0306[] = { + &pci_ss_info_1004_0306_1004_0306, + &pci_ss_info_1004_0306_122d_1208, + &pci_ss_info_1004_0306_1483_5022, + NULL +}; +#define pci_ss_list_1004_0307 NULL +#define pci_ss_list_1004_0308 NULL +#define pci_ss_list_1004_0702 NULL +#define pci_ss_list_1004_0703 NULL +#endif +#define pci_ss_list_1005_2064 NULL +#define pci_ss_list_1005_2128 NULL +#define pci_ss_list_1005_2301 NULL +#define pci_ss_list_1005_2302 NULL +#define pci_ss_list_1005_2364 NULL +#define pci_ss_list_1005_2464 NULL +#define pci_ss_list_1005_2501 NULL +#define pci_ss_list_100b_0001 NULL +#define pci_ss_list_100b_0002 NULL +#define pci_ss_list_100b_000e NULL +#define pci_ss_list_100b_000f NULL +#define pci_ss_list_100b_0011 NULL +#define pci_ss_list_100b_0012 NULL +#define pci_ss_list_100b_0020 NULL +#define pci_ss_list_100b_0022 NULL +#define pci_ss_list_100b_0500 NULL +#define pci_ss_list_100b_0501 NULL +#define pci_ss_list_100b_0502 NULL +#define pci_ss_list_100b_0503 NULL +#define pci_ss_list_100b_0504 NULL +#define pci_ss_list_100b_0505 NULL +#define pci_ss_list_100b_d001 NULL +#define pci_ss_list_100c_3202 NULL +#define pci_ss_list_100c_3205 NULL +#define pci_ss_list_100c_3206 NULL +#define pci_ss_list_100c_3207 NULL +#define pci_ss_list_100c_3208 NULL +#define pci_ss_list_100c_4702 NULL +#define pci_ss_list_100e_9000 NULL +#define pci_ss_list_100e_9001 NULL +#define pci_ss_list_100e_9002 NULL +#define pci_ss_list_100e_9100 NULL +#define pci_ss_list_1011_0001 NULL +#define pci_ss_list_1011_0002 NULL +#define pci_ss_list_1011_0004 NULL +#define pci_ss_list_1011_0007 NULL +#define pci_ss_list_1011_0008 NULL +static const pciSubsystemInfo *pci_ss_list_1011_0009[] = { + &pci_ss_info_1011_0009_1025_0310, + &pci_ss_info_1011_0009_10b8_2001, + &pci_ss_info_1011_0009_10b8_2002, + &pci_ss_info_1011_0009_10b8_2003, + &pci_ss_info_1011_0009_1109_2400, + &pci_ss_info_1011_0009_1112_2300, + &pci_ss_info_1011_0009_1112_2320, + &pci_ss_info_1011_0009_1112_2340, + &pci_ss_info_1011_0009_1113_1207, + &pci_ss_info_1011_0009_1186_1100, + &pci_ss_info_1011_0009_1186_1112, + &pci_ss_info_1011_0009_1186_1140, + &pci_ss_info_1011_0009_1186_1142, + &pci_ss_info_1011_0009_11f6_0503, + &pci_ss_info_1011_0009_1282_9100, + &pci_ss_info_1011_0009_1385_1100, + &pci_ss_info_1011_0009_2646_0001, + NULL +}; +#define pci_ss_list_1011_000a NULL +#define pci_ss_list_1011_000d NULL +#define pci_ss_list_1011_000f NULL +static const pciSubsystemInfo *pci_ss_list_1011_0014[] = { + &pci_ss_info_1011_0014_1186_0100, + NULL +}; +#define pci_ss_list_1011_0016 NULL +static const pciSubsystemInfo *pci_ss_list_1011_0019[] = { + &pci_ss_info_1011_0019_1011_500a, + &pci_ss_info_1011_0019_1011_500b, + &pci_ss_info_1011_0019_1014_0001, + &pci_ss_info_1011_0019_1025_0315, + &pci_ss_info_1011_0019_1033_800c, + &pci_ss_info_1011_0019_1033_800d, + &pci_ss_info_1011_0019_108d_0016, + &pci_ss_info_1011_0019_108d_0017, + &pci_ss_info_1011_0019_10b8_2005, + &pci_ss_info_1011_0019_10b8_8034, + &pci_ss_info_1011_0019_10ef_8169, + &pci_ss_info_1011_0019_1109_2a00, + &pci_ss_info_1011_0019_1109_2b00, + &pci_ss_info_1011_0019_1109_3000, + &pci_ss_info_1011_0019_1113_1207, + &pci_ss_info_1011_0019_1113_2220, + &pci_ss_info_1011_0019_115d_0002, + &pci_ss_info_1011_0019_1179_0203, + &pci_ss_info_1011_0019_1179_0204, + &pci_ss_info_1011_0019_1186_1100, + &pci_ss_info_1011_0019_1186_1101, + &pci_ss_info_1011_0019_1186_1102, + &pci_ss_info_1011_0019_1259_2800, + &pci_ss_info_1011_0019_1266_0004, + &pci_ss_info_1011_0019_12af_0019, + &pci_ss_info_1011_0019_1374_0001, + &pci_ss_info_1011_0019_1374_0002, + &pci_ss_info_1011_0019_1374_0007, + &pci_ss_info_1011_0019_1374_0008, + &pci_ss_info_1011_0019_1385_2100, + &pci_ss_info_1011_0019_1395_0001, + &pci_ss_info_1011_0019_13d1_ab01, + &pci_ss_info_1011_0019_8086_0001, + NULL +}; +#define pci_ss_list_1011_001a NULL +#define pci_ss_list_1011_0021 NULL +#define pci_ss_list_1011_0022 NULL +#define pci_ss_list_1011_0023 NULL +#define pci_ss_list_1011_0024 NULL +#define pci_ss_list_1011_0025 NULL +#define pci_ss_list_1011_0026 NULL +static const pciSubsystemInfo *pci_ss_list_1011_0034[] = { + &pci_ss_info_1011_0034_1374_0003, + NULL +}; +#define pci_ss_list_1011_0045 NULL +static const pciSubsystemInfo *pci_ss_list_1011_0046[] = { + &pci_ss_info_1011_0046_0e11_4050, + &pci_ss_info_1011_0046_0e11_4051, + &pci_ss_info_1011_0046_0e11_4058, + &pci_ss_info_1011_0046_103c_10c2, + &pci_ss_info_1011_0046_12d9_000a, + &pci_ss_info_1011_0046_9005_0365, + &pci_ss_info_1011_0046_9005_1364, + &pci_ss_info_1011_0046_9005_1365, + &pci_ss_info_1011_0046_e4bf_1000, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1011_1065[] = { + &pci_ss_info_1011_1065_1069_0020, + NULL +}; +#define pci_ss_list_1013_0038 NULL +#define pci_ss_list_1013_0040 NULL +#define pci_ss_list_1013_004c NULL +#define pci_ss_list_1013_00a0 NULL +#define pci_ss_list_1013_00a2 NULL +#define pci_ss_list_1013_00a4 NULL +#define pci_ss_list_1013_00a8 NULL +#define pci_ss_list_1013_00ac NULL +#define pci_ss_list_1013_00b0 NULL +#define pci_ss_list_1013_00b8 NULL +static const pciSubsystemInfo *pci_ss_list_1013_00bc[] = { + &pci_ss_info_1013_00bc_1013_00bc, + NULL +}; +#define pci_ss_list_1013_00d0 NULL +#define pci_ss_list_1013_00d2 NULL +#define pci_ss_list_1013_00d4 NULL +#define pci_ss_list_1013_00d5 NULL +static const pciSubsystemInfo *pci_ss_list_1013_00d6[] = { + &pci_ss_info_1013_00d6_13ce_8031, + &pci_ss_info_1013_00d6_13cf_8031, + NULL +}; +#define pci_ss_list_1013_00e8 NULL +#define pci_ss_list_1013_1100 NULL +#define pci_ss_list_1013_1110 NULL +#define pci_ss_list_1013_1112 NULL +#define pci_ss_list_1013_1113 NULL +#define pci_ss_list_1013_1200 NULL +#define pci_ss_list_1013_1202 NULL +#define pci_ss_list_1013_1204 NULL +#define pci_ss_list_1013_4400 NULL +static const pciSubsystemInfo *pci_ss_list_1013_6001[] = { + &pci_ss_info_1013_6001_1014_1010, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1013_6003[] = { + &pci_ss_info_1013_6003_1013_4280, + &pci_ss_info_1013_6003_1681_0050, + &pci_ss_info_1013_6003_1681_a011, + NULL +}; +#define pci_ss_list_1013_6004 NULL +static const pciSubsystemInfo *pci_ss_list_1013_6005[] = { + &pci_ss_info_1013_6005_1013_4281, + &pci_ss_info_1013_6005_10cf_10a8, + &pci_ss_info_1013_6005_10cf_10a9, + &pci_ss_info_1013_6005_10cf_10aa, + &pci_ss_info_1013_6005_10cf_10ab, + &pci_ss_info_1013_6005_10cf_10ac, + &pci_ss_info_1013_6005_10cf_10ad, + &pci_ss_info_1013_6005_10cf_10b4, + &pci_ss_info_1013_6005_1179_0001, + &pci_ss_info_1013_6005_14c0_000c, + NULL +}; +#define pci_ss_list_1014_0002 NULL +#define pci_ss_list_1014_0005 NULL +#define pci_ss_list_1014_0007 NULL +#define pci_ss_list_1014_000a NULL +#define pci_ss_list_1014_0017 NULL +#define pci_ss_list_1014_0018 NULL +#define pci_ss_list_1014_001b NULL +#define pci_ss_list_1014_001c NULL +#define pci_ss_list_1014_001d NULL +#define pci_ss_list_1014_0020 NULL +#define pci_ss_list_1014_0022 NULL +#define pci_ss_list_1014_002d NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1014_002e[] = { + &pci_ss_info_1014_002e_1014_002e, + &pci_ss_info_1014_002e_1014_022e, + NULL +}; +#define pci_ss_list_1014_0036 NULL +#define pci_ss_list_1014_003a NULL +static const pciSubsystemInfo *pci_ss_list_1014_003e[] = { + &pci_ss_info_1014_003e_1014_003e, + &pci_ss_info_1014_003e_1014_00cd, + &pci_ss_info_1014_003e_1014_00ce, + &pci_ss_info_1014_003e_1014_00cf, + &pci_ss_info_1014_003e_1014_00e4, + &pci_ss_info_1014_003e_1014_00e5, + &pci_ss_info_1014_003e_1014_016d, + NULL +}; +#define pci_ss_list_1014_0045 NULL +#define pci_ss_list_1014_0046 NULL +#define pci_ss_list_1014_0047 NULL +#define pci_ss_list_1014_0048 NULL +#define pci_ss_list_1014_0049 NULL +#define pci_ss_list_1014_004e NULL +#define pci_ss_list_1014_004f NULL +#define pci_ss_list_1014_0050 NULL +#define pci_ss_list_1014_0053 NULL +#define pci_ss_list_1014_0057 NULL +#define pci_ss_list_1014_005c NULL +#define pci_ss_list_1014_007c NULL +#define pci_ss_list_1014_007d NULL +static const pciSubsystemInfo *pci_ss_list_1014_0090[] = { + &pci_ss_info_1014_0090_1014_008e, + NULL +}; +#define pci_ss_list_1014_0095 NULL +static const pciSubsystemInfo *pci_ss_list_1014_0096[] = { + &pci_ss_info_1014_0096_1014_0097, + &pci_ss_info_1014_0096_1014_0098, + &pci_ss_info_1014_0096_1014_0099, + NULL +}; +#define pci_ss_list_1014_00a5 NULL +#define pci_ss_list_1014_00a6 NULL +#define pci_ss_list_1014_00b7 NULL +#define pci_ss_list_1014_00be NULL +#define pci_ss_list_1014_00dc NULL +#define pci_ss_list_1014_00fc NULL +#define pci_ss_list_1014_0105 NULL +#define pci_ss_list_1014_010f NULL +static const pciSubsystemInfo *pci_ss_list_1014_0142[] = { + &pci_ss_info_1014_0142_1014_0143, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1014_0144[] = { + &pci_ss_info_1014_0144_1014_0145, + NULL +}; +#define pci_ss_list_1014_0156 NULL +#define pci_ss_list_1014_01a7 NULL +static const pciSubsystemInfo *pci_ss_list_1014_01bd[] = { + &pci_ss_info_1014_01bd_1014_01be, + &pci_ss_info_1014_01bd_1014_01bf, + &pci_ss_info_1014_01bd_1014_0208, + &pci_ss_info_1014_01bd_1014_020e, + &pci_ss_info_1014_01bd_1014_022e, + &pci_ss_info_1014_01bd_1014_0258, + &pci_ss_info_1014_01bd_1014_0259, + NULL +}; +#define pci_ss_list_1014_0302 NULL +#define pci_ss_list_1014_ffff NULL +#endif +#define pci_ss_list_1017_5343 NULL +#define pci_ss_list_101a_0005 NULL +#define pci_ss_list_101c_0193 NULL +#define pci_ss_list_101c_0196 NULL +#define pci_ss_list_101c_0197 NULL +#define pci_ss_list_101c_0296 NULL +#define pci_ss_list_101c_3193 NULL +#define pci_ss_list_101c_3197 NULL +#define pci_ss_list_101c_3296 NULL +#define pci_ss_list_101c_4296 NULL +#define pci_ss_list_101c_9710 NULL +#define pci_ss_list_101c_9712 NULL +#define pci_ss_list_101c_c24a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_101e_1960[] = { + &pci_ss_info_101e_1960_101e_0471, + &pci_ss_info_101e_1960_101e_0475, + &pci_ss_info_101e_1960_101e_0493, + &pci_ss_info_101e_1960_1028_0471, + &pci_ss_info_101e_1960_1028_0475, + &pci_ss_info_101e_1960_1028_0493, + &pci_ss_info_101e_1960_1028_0511, + NULL +}; +#define pci_ss_list_101e_9010 NULL +#define pci_ss_list_101e_9030 NULL +#define pci_ss_list_101e_9031 NULL +#define pci_ss_list_101e_9032 NULL +#define pci_ss_list_101e_9033 NULL +#define pci_ss_list_101e_9040 NULL +#define pci_ss_list_101e_9060 NULL +static const pciSubsystemInfo *pci_ss_list_101e_9063[] = { + &pci_ss_info_101e_9063_101e_0767, + NULL +}; +#endif +#define pci_ss_list_1022_1100 NULL +#define pci_ss_list_1022_1101 NULL +#define pci_ss_list_1022_1102 NULL +#define pci_ss_list_1022_1103 NULL +static const pciSubsystemInfo *pci_ss_list_1022_2000[] = { + &pci_ss_info_1022_2000_1014_2000, + &pci_ss_info_1022_2000_103c_104c, + &pci_ss_info_1022_2000_103c_1064, + &pci_ss_info_1022_2000_103c_1065, + &pci_ss_info_1022_2000_103c_106c, + &pci_ss_info_1022_2000_103c_106e, + &pci_ss_info_1022_2000_103c_10ea, + &pci_ss_info_1022_2000_1113_1220, + &pci_ss_info_1022_2000_1259_2450, + &pci_ss_info_1022_2000_1259_2454, + &pci_ss_info_1022_2000_1259_2700, + &pci_ss_info_1022_2000_1259_2701, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1022_2001[] = { + &pci_ss_info_1022_2001_1092_0a78, + &pci_ss_info_1022_2001_1668_0299, + NULL +}; +#define pci_ss_list_1022_2020 NULL +#define pci_ss_list_1022_2040 NULL +#define pci_ss_list_1022_3000 NULL +#define pci_ss_list_1022_7006 NULL +#define pci_ss_list_1022_7007 NULL +#define pci_ss_list_1022_700c NULL +#define pci_ss_list_1022_700d NULL +#define pci_ss_list_1022_700e NULL +#define pci_ss_list_1022_700f NULL +#define pci_ss_list_1022_7400 NULL +#define pci_ss_list_1022_7401 NULL +#define pci_ss_list_1022_7403 NULL +#define pci_ss_list_1022_7404 NULL +#define pci_ss_list_1022_7408 NULL +#define pci_ss_list_1022_7409 NULL +#define pci_ss_list_1022_740b NULL +#define pci_ss_list_1022_740c NULL +#define pci_ss_list_1022_7410 NULL +#define pci_ss_list_1022_7411 NULL +#define pci_ss_list_1022_7413 NULL +#define pci_ss_list_1022_7414 NULL +static const pciSubsystemInfo *pci_ss_list_1022_7440[] = { + &pci_ss_info_1022_7440_1043_8044, + NULL +}; +#define pci_ss_list_1022_7441 NULL +static const pciSubsystemInfo *pci_ss_list_1022_7443[] = { + &pci_ss_info_1022_7443_1043_8044, + NULL +}; +#define pci_ss_list_1022_7445 NULL +#define pci_ss_list_1022_7446 NULL +#define pci_ss_list_1022_7448 NULL +#define pci_ss_list_1022_7449 NULL +#define pci_ss_list_1022_7450 NULL +#define pci_ss_list_1022_7451 NULL +#define pci_ss_list_1022_7454 NULL +#define pci_ss_list_1022_7455 NULL +#define pci_ss_list_1022_7460 NULL +#define pci_ss_list_1022_7461 NULL +#define pci_ss_list_1022_7462 NULL +#define pci_ss_list_1022_7464 NULL +#define pci_ss_list_1022_7468 NULL +#define pci_ss_list_1022_7469 NULL +#define pci_ss_list_1022_746a NULL +#define pci_ss_list_1022_746b NULL +#define pci_ss_list_1022_746d NULL +#define pci_ss_list_1022_746e NULL +#define pci_ss_list_1023_0194 NULL +#define pci_ss_list_1023_2000 NULL +#define pci_ss_list_1023_2001 NULL +static const pciSubsystemInfo *pci_ss_list_1023_8400[] = { + &pci_ss_info_1023_8400_1023_8400, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1023_8420[] = { + &pci_ss_info_1023_8420_0e11_b15a, + NULL +}; +#define pci_ss_list_1023_8500 NULL +static const pciSubsystemInfo *pci_ss_list_1023_8520[] = { + &pci_ss_info_1023_8520_0e11_b16e, + &pci_ss_info_1023_8520_1023_8520, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1023_8620[] = { + &pci_ss_info_1023_8620_1014_0502, + NULL +}; +#define pci_ss_list_1023_8820 NULL +#define pci_ss_list_1023_9320 NULL +#define pci_ss_list_1023_9350 NULL +#define pci_ss_list_1023_9360 NULL +#define pci_ss_list_1023_9382 NULL +#define pci_ss_list_1023_9383 NULL +#define pci_ss_list_1023_9385 NULL +#define pci_ss_list_1023_9386 NULL +#define pci_ss_list_1023_9388 NULL +#define pci_ss_list_1023_9397 NULL +#define pci_ss_list_1023_939a NULL +#define pci_ss_list_1023_9420 NULL +#define pci_ss_list_1023_9430 NULL +#define pci_ss_list_1023_9440 NULL +#define pci_ss_list_1023_9460 NULL +#define pci_ss_list_1023_9470 NULL +#define pci_ss_list_1023_9520 NULL +static const pciSubsystemInfo *pci_ss_list_1023_9525[] = { + &pci_ss_info_1023_9525_10cf_1094, + NULL +}; +#define pci_ss_list_1023_9540 NULL +#define pci_ss_list_1023_9660 NULL +#define pci_ss_list_1023_9680 NULL +#define pci_ss_list_1023_9682 NULL +#define pci_ss_list_1023_9683 NULL +#define pci_ss_list_1023_9685 NULL +static const pciSubsystemInfo *pci_ss_list_1023_9750[] = { + &pci_ss_info_1023_9750_1014_9750, + &pci_ss_info_1023_9750_1023_9750, + NULL +}; +#define pci_ss_list_1023_9753 NULL +#define pci_ss_list_1023_9754 NULL +#define pci_ss_list_1023_9759 NULL +#define pci_ss_list_1023_9783 NULL +#define pci_ss_list_1023_9785 NULL +#define pci_ss_list_1023_9850 NULL +static const pciSubsystemInfo *pci_ss_list_1023_9880[] = { + &pci_ss_info_1023_9880_1023_9880, + NULL +}; +#define pci_ss_list_1023_9910 NULL +#define pci_ss_list_1023_9930 NULL +#define pci_ss_list_1025_1435 NULL +#define pci_ss_list_1025_1445 NULL +#define pci_ss_list_1025_1449 NULL +#define pci_ss_list_1025_1451 NULL +#define pci_ss_list_1025_1461 NULL +#define pci_ss_list_1025_1489 NULL +#define pci_ss_list_1025_1511 NULL +#define pci_ss_list_1025_1512 NULL +#define pci_ss_list_1025_1513 NULL +static const pciSubsystemInfo *pci_ss_list_1025_1521[] = { + &pci_ss_info_1025_1521_10b9_1521, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1025_1523[] = { + &pci_ss_info_1025_1523_10b9_1523, + NULL +}; +#define pci_ss_list_1025_1531 NULL +static const pciSubsystemInfo *pci_ss_list_1025_1533[] = { + &pci_ss_info_1025_1533_10b9_1533, + NULL +}; +#define pci_ss_list_1025_1535 NULL +static const pciSubsystemInfo *pci_ss_list_1025_1541[] = { + &pci_ss_info_1025_1541_10b9_1541, + NULL +}; +#define pci_ss_list_1025_1542 NULL +#define pci_ss_list_1025_1543 NULL +#define pci_ss_list_1025_1561 NULL +#define pci_ss_list_1025_1621 NULL +#define pci_ss_list_1025_1631 NULL +#define pci_ss_list_1025_1641 NULL +#define pci_ss_list_1025_1647 NULL +#define pci_ss_list_1025_3141 NULL +#define pci_ss_list_1025_3143 NULL +#define pci_ss_list_1025_3145 NULL +#define pci_ss_list_1025_3147 NULL +#define pci_ss_list_1025_3149 NULL +#define pci_ss_list_1025_3151 NULL +#define pci_ss_list_1025_3307 NULL +#define pci_ss_list_1025_3309 NULL +#define pci_ss_list_1025_3321 NULL +#define pci_ss_list_1025_5212 NULL +#define pci_ss_list_1025_5215 NULL +#define pci_ss_list_1025_5217 NULL +#define pci_ss_list_1025_5219 NULL +#define pci_ss_list_1025_5225 NULL +#define pci_ss_list_1025_5229 NULL +#define pci_ss_list_1025_5235 NULL +#define pci_ss_list_1025_5237 NULL +#define pci_ss_list_1025_5240 NULL +#define pci_ss_list_1025_5241 NULL +#define pci_ss_list_1025_5242 NULL +#define pci_ss_list_1025_5243 NULL +#define pci_ss_list_1025_5244 NULL +#define pci_ss_list_1025_5247 NULL +#define pci_ss_list_1025_5251 NULL +#define pci_ss_list_1025_5427 NULL +#define pci_ss_list_1025_5451 NULL +#define pci_ss_list_1025_5453 NULL +static const pciSubsystemInfo *pci_ss_list_1025_7101[] = { + &pci_ss_info_1025_7101_10b9_7101, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1028_0001[] = { + &pci_ss_info_1028_0001_1028_0001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1028_0002[] = { + &pci_ss_info_1028_0002_1028_0002, + &pci_ss_info_1028_0002_1028_00d1, + &pci_ss_info_1028_0002_1028_00d9, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1028_0003[] = { + &pci_ss_info_1028_0003_1028_0003, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1028_0004[] = { + &pci_ss_info_1028_0004_1028_00d0, + NULL +}; +#define pci_ss_list_1028_0005 NULL +#define pci_ss_list_1028_0006 NULL +#define pci_ss_list_1028_0007 NULL +#define pci_ss_list_1028_0008 NULL +static const pciSubsystemInfo *pci_ss_list_1028_000a[] = { + &pci_ss_info_1028_000a_1028_0106, + &pci_ss_info_1028_000a_1028_011b, + &pci_ss_info_1028_000a_1028_0121, + NULL +}; +#define pci_ss_list_1028_000c NULL +#define pci_ss_list_1028_000e NULL +#define pci_ss_list_1028_000f NULL +#define pci_ss_list_102a_0000 NULL +#define pci_ss_list_102a_0010 NULL +#define pci_ss_list_102b_0010 NULL +#define pci_ss_list_102b_0518 NULL +#define pci_ss_list_102b_0519 NULL +static const pciSubsystemInfo *pci_ss_list_102b_051a[] = { + &pci_ss_info_102b_051a_102b_0100, + &pci_ss_info_102b_051a_102b_1100, + &pci_ss_info_102b_051a_102b_1200, + &pci_ss_info_102b_051a_1100_102b, + &pci_ss_info_102b_051a_110a_0018, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_102b_051b[] = { + &pci_ss_info_102b_051b_102b_051b, + &pci_ss_info_102b_051b_102b_1100, + &pci_ss_info_102b_051b_102b_1200, + NULL +}; +#define pci_ss_list_102b_051e NULL +#define pci_ss_list_102b_051f NULL +static const pciSubsystemInfo *pci_ss_list_102b_0520[] = { + &pci_ss_info_102b_0520_102b_dbc2, + &pci_ss_info_102b_0520_102b_dbc8, + &pci_ss_info_102b_0520_102b_dbe2, + &pci_ss_info_102b_0520_102b_dbe8, + &pci_ss_info_102b_0520_102b_ff03, + &pci_ss_info_102b_0520_102b_ff04, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_102b_0521[] = { + &pci_ss_info_102b_0521_1014_ff03, + &pci_ss_info_102b_0521_102b_48e9, + &pci_ss_info_102b_0521_102b_48f8, + &pci_ss_info_102b_0521_102b_4a60, + &pci_ss_info_102b_0521_102b_4a64, + &pci_ss_info_102b_0521_102b_c93c, + &pci_ss_info_102b_0521_102b_c9b0, + &pci_ss_info_102b_0521_102b_c9bc, + &pci_ss_info_102b_0521_102b_ca60, + &pci_ss_info_102b_0521_102b_ca6c, + &pci_ss_info_102b_0521_102b_dbbc, + &pci_ss_info_102b_0521_102b_dbc2, + &pci_ss_info_102b_0521_102b_dbc3, + &pci_ss_info_102b_0521_102b_dbc8, + &pci_ss_info_102b_0521_102b_dbd2, + &pci_ss_info_102b_0521_102b_dbd3, + &pci_ss_info_102b_0521_102b_dbd4, + &pci_ss_info_102b_0521_102b_dbd5, + &pci_ss_info_102b_0521_102b_dbd8, + &pci_ss_info_102b_0521_102b_dbd9, + &pci_ss_info_102b_0521_102b_dbe2, + &pci_ss_info_102b_0521_102b_dbe3, + &pci_ss_info_102b_0521_102b_dbe8, + &pci_ss_info_102b_0521_102b_dbf2, + &pci_ss_info_102b_0521_102b_dbf3, + &pci_ss_info_102b_0521_102b_dbf4, + &pci_ss_info_102b_0521_102b_dbf5, + &pci_ss_info_102b_0521_102b_dbf8, + &pci_ss_info_102b_0521_102b_dbf9, + &pci_ss_info_102b_0521_102b_f806, + &pci_ss_info_102b_0521_102b_ff00, + &pci_ss_info_102b_0521_102b_ff02, + &pci_ss_info_102b_0521_102b_ff03, + &pci_ss_info_102b_0521_102b_ff04, + &pci_ss_info_102b_0521_110a_0032, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_102b_0525[] = { + &pci_ss_info_102b_0525_0e11_b16f, + &pci_ss_info_102b_0525_102b_0328, + &pci_ss_info_102b_0525_102b_0338, + &pci_ss_info_102b_0525_102b_0378, + &pci_ss_info_102b_0525_102b_0541, + &pci_ss_info_102b_0525_102b_0542, + &pci_ss_info_102b_0525_102b_0543, + &pci_ss_info_102b_0525_102b_0641, + &pci_ss_info_102b_0525_102b_0642, + &pci_ss_info_102b_0525_102b_0643, + &pci_ss_info_102b_0525_102b_07c0, + &pci_ss_info_102b_0525_102b_07c1, + &pci_ss_info_102b_0525_102b_0d41, + &pci_ss_info_102b_0525_102b_0d42, + &pci_ss_info_102b_0525_102b_0e00, + &pci_ss_info_102b_0525_102b_0e01, + &pci_ss_info_102b_0525_102b_0e02, + &pci_ss_info_102b_0525_102b_0e03, + &pci_ss_info_102b_0525_102b_0f80, + &pci_ss_info_102b_0525_102b_0f81, + &pci_ss_info_102b_0525_102b_0f82, + &pci_ss_info_102b_0525_102b_0f83, + &pci_ss_info_102b_0525_102b_19d8, + &pci_ss_info_102b_0525_102b_19f8, + &pci_ss_info_102b_0525_102b_2159, + &pci_ss_info_102b_0525_102b_2179, + &pci_ss_info_102b_0525_102b_217d, + &pci_ss_info_102b_0525_102b_23c0, + &pci_ss_info_102b_0525_102b_23c1, + &pci_ss_info_102b_0525_102b_23c2, + &pci_ss_info_102b_0525_102b_23c3, + &pci_ss_info_102b_0525_102b_2f58, + &pci_ss_info_102b_0525_102b_2f78, + &pci_ss_info_102b_0525_102b_3693, + &pci_ss_info_102b_0525_102b_5dd0, + &pci_ss_info_102b_0525_102b_5f50, + &pci_ss_info_102b_0525_102b_5f51, + &pci_ss_info_102b_0525_102b_5f52, + &pci_ss_info_102b_0525_102b_9010, + &pci_ss_info_102b_0525_1458_0400, + &pci_ss_info_102b_0525_1705_0001, + &pci_ss_info_102b_0525_1705_0002, + &pci_ss_info_102b_0525_1705_0003, + &pci_ss_info_102b_0525_1705_0004, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_102b_0527[] = { + &pci_ss_info_102b_0527_102b_0840, + NULL +}; +#define pci_ss_list_102b_0d10 NULL +static const pciSubsystemInfo *pci_ss_list_102b_1000[] = { + &pci_ss_info_102b_1000_102b_ff01, + &pci_ss_info_102b_1000_102b_ff05, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_102b_1001[] = { + &pci_ss_info_102b_1001_102b_1001, + &pci_ss_info_102b_1001_102b_ff00, + &pci_ss_info_102b_1001_102b_ff01, + &pci_ss_info_102b_1001_102b_ff03, + &pci_ss_info_102b_1001_102b_ff04, + &pci_ss_info_102b_1001_102b_ff05, + &pci_ss_info_102b_1001_110a_001e, + NULL +}; +#define pci_ss_list_102b_2007 NULL +static const pciSubsystemInfo *pci_ss_list_102b_2527[] = { + &pci_ss_info_102b_2527_102b_0f83, + &pci_ss_info_102b_2527_102b_0f84, + &pci_ss_info_102b_2527_102b_1e41, + NULL +}; +#define pci_ss_list_102b_4536 NULL +#define pci_ss_list_102b_6573 NULL +#define pci_ss_list_102c_00b8 NULL +static const pciSubsystemInfo *pci_ss_list_102c_00c0[] = { + &pci_ss_info_102c_00c0_102c_00c0, + NULL +}; +#define pci_ss_list_102c_00d0 NULL +#define pci_ss_list_102c_00d8 NULL +#define pci_ss_list_102c_00dc NULL +#define pci_ss_list_102c_00e0 NULL +#define pci_ss_list_102c_00e4 NULL +static const pciSubsystemInfo *pci_ss_list_102c_00e5[] = { + &pci_ss_info_102c_00e5_0e11_b049, + NULL +}; +#define pci_ss_list_102c_00f0 NULL +#define pci_ss_list_102c_00f4 NULL +#define pci_ss_list_102c_00f5 NULL +#define pci_ss_list_102c_0c30 NULL +#define pci_ss_list_102d_50dc NULL +#define pci_ss_list_102f_0009 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_102f_0020[] = { + &pci_ss_info_102f_0020_102f_00f8, + NULL +}; +#endif +#define pci_ss_list_1031_5601 NULL +#define pci_ss_list_1031_5607 NULL +#define pci_ss_list_1031_5631 NULL +#define pci_ss_list_1031_6057 NULL +#define pci_ss_list_1033_0001 NULL +#define pci_ss_list_1033_0002 NULL +#define pci_ss_list_1033_0003 NULL +#define pci_ss_list_1033_0004 NULL +#define pci_ss_list_1033_0005 NULL +#define pci_ss_list_1033_0006 NULL +#define pci_ss_list_1033_0007 NULL +#define pci_ss_list_1033_0008 NULL +#define pci_ss_list_1033_0009 NULL +#define pci_ss_list_1033_0016 NULL +#define pci_ss_list_1033_001a NULL +#define pci_ss_list_1033_0021 NULL +#define pci_ss_list_1033_0029 NULL +#define pci_ss_list_1033_002a NULL +#define pci_ss_list_1033_002c NULL +#define pci_ss_list_1033_002d NULL +static const pciSubsystemInfo *pci_ss_list_1033_0035[] = { + &pci_ss_info_1033_0035_1179_0001, + &pci_ss_info_1033_0035_12ee_7000, + &pci_ss_info_1033_0035_1799_0001, + NULL +}; +#define pci_ss_list_1033_003b NULL +#define pci_ss_list_1033_003e NULL +#define pci_ss_list_1033_0046 NULL +#define pci_ss_list_1033_005a NULL +#define pci_ss_list_1033_0063 NULL +static const pciSubsystemInfo *pci_ss_list_1033_0067[] = { + &pci_ss_info_1033_0067_1010_0020, + &pci_ss_info_1033_0067_1010_0080, + &pci_ss_info_1033_0067_1010_0088, + &pci_ss_info_1033_0067_1010_0090, + &pci_ss_info_1033_0067_1010_0098, + &pci_ss_info_1033_0067_1010_00a0, + &pci_ss_info_1033_0067_1010_00a8, + &pci_ss_info_1033_0067_1010_0120, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1033_0074[] = { + &pci_ss_info_1033_0074_1033_8014, + NULL +}; +#define pci_ss_list_1033_009b NULL +#define pci_ss_list_1033_00a6 NULL +static const pciSubsystemInfo *pci_ss_list_1033_00cd[] = { + &pci_ss_info_1033_00cd_12ee_8011, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1033_00e0[] = { + &pci_ss_info_1033_00e0_12ee_7001, + &pci_ss_info_1033_00e0_1799_0002, + NULL +}; +#define pci_ss_list_1036_0000 NULL +#define pci_ss_list_1039_0001 NULL +#define pci_ss_list_1039_0002 NULL +#define pci_ss_list_1039_0006 NULL +#define pci_ss_list_1039_0008 NULL +#define pci_ss_list_1039_0009 NULL +#define pci_ss_list_1039_0018 NULL +static const pciSubsystemInfo *pci_ss_list_1039_0200[] = { + &pci_ss_info_1039_0200_1039_0000, + NULL +}; +#define pci_ss_list_1039_0204 NULL +#define pci_ss_list_1039_0205 NULL +static const pciSubsystemInfo *pci_ss_list_1039_0300[] = { + &pci_ss_info_1039_0300_107d_2720, + NULL +}; +#define pci_ss_list_1039_0310 NULL +#define pci_ss_list_1039_0315 NULL +#define pci_ss_list_1039_0325 NULL +#define pci_ss_list_1039_0330 NULL +#define pci_ss_list_1039_0406 NULL +#define pci_ss_list_1039_0496 NULL +#define pci_ss_list_1039_0530 NULL +#define pci_ss_list_1039_0540 NULL +#define pci_ss_list_1039_0597 NULL +#define pci_ss_list_1039_0601 NULL +#define pci_ss_list_1039_0620 NULL +#define pci_ss_list_1039_0630 NULL +#define pci_ss_list_1039_0633 NULL +#define pci_ss_list_1039_0635 NULL +#define pci_ss_list_1039_0645 NULL +#define pci_ss_list_1039_0646 NULL +#define pci_ss_list_1039_0650 NULL +#define pci_ss_list_1039_0651 NULL +#define pci_ss_list_1039_0730 NULL +#define pci_ss_list_1039_0733 NULL +#define pci_ss_list_1039_0735 NULL +#define pci_ss_list_1039_0740 NULL +#define pci_ss_list_1039_0745 NULL +static const pciSubsystemInfo *pci_ss_list_1039_0900[] = { + &pci_ss_info_1039_0900_1039_0900, + NULL +}; +#define pci_ss_list_1039_0961 NULL +#define pci_ss_list_1039_0962 NULL +#define pci_ss_list_1039_3602 NULL +#define pci_ss_list_1039_5107 NULL +#define pci_ss_list_1039_5300 NULL +#define pci_ss_list_1039_5315 NULL +#define pci_ss_list_1039_5401 NULL +#define pci_ss_list_1039_5511 NULL +static const pciSubsystemInfo *pci_ss_list_1039_5513[] = { + &pci_ss_info_1039_5513_1019_0970, + &pci_ss_info_1039_5513_1039_5513, + NULL +}; +#define pci_ss_list_1039_5517 NULL +#define pci_ss_list_1039_5571 NULL +#define pci_ss_list_1039_5581 NULL +#define pci_ss_list_1039_5582 NULL +#define pci_ss_list_1039_5591 NULL +#define pci_ss_list_1039_5596 NULL +#define pci_ss_list_1039_5597 NULL +#define pci_ss_list_1039_5600 NULL +#define pci_ss_list_1039_6204 NULL +#define pci_ss_list_1039_6205 NULL +#define pci_ss_list_1039_6236 NULL +static const pciSubsystemInfo *pci_ss_list_1039_6300[] = { + &pci_ss_info_1039_6300_1019_0970, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1039_6306[] = { + &pci_ss_info_1039_6306_1039_6306, + NULL +}; +#define pci_ss_list_1039_6325 NULL +static const pciSubsystemInfo *pci_ss_list_1039_6326[] = { + &pci_ss_info_1039_6326_1039_6326, + &pci_ss_info_1039_6326_1092_0a50, + &pci_ss_info_1039_6326_1092_0a70, + &pci_ss_info_1039_6326_1092_4910, + &pci_ss_info_1039_6326_1092_4920, + &pci_ss_info_1039_6326_1569_6326, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1039_7001[] = { + &pci_ss_info_1039_7001_1039_7000, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1039_7002[] = { + &pci_ss_info_1039_7002_1509_7002, + NULL +}; +#define pci_ss_list_1039_7007 NULL +#define pci_ss_list_1039_7012 NULL +#define pci_ss_list_1039_7013 NULL +static const pciSubsystemInfo *pci_ss_list_1039_7016[] = { + &pci_ss_info_1039_7016_1039_7016, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1039_7018[] = { + &pci_ss_info_1039_7018_1014_01b6, + &pci_ss_info_1039_7018_1014_01b7, + &pci_ss_info_1039_7018_1019_7018, + &pci_ss_info_1039_7018_1025_000e, + &pci_ss_info_1039_7018_1025_0018, + &pci_ss_info_1039_7018_1039_7018, + &pci_ss_info_1039_7018_1043_800b, + &pci_ss_info_1039_7018_1054_7018, + &pci_ss_info_1039_7018_107d_5330, + &pci_ss_info_1039_7018_107d_5350, + &pci_ss_info_1039_7018_1170_3209, + &pci_ss_info_1039_7018_1462_400a, + &pci_ss_info_1039_7018_14a4_2089, + &pci_ss_info_1039_7018_14cd_2194, + &pci_ss_info_1039_7018_14ff_1100, + &pci_ss_info_1039_7018_152d_8808, + &pci_ss_info_1039_7018_1558_1103, + &pci_ss_info_1039_7018_1558_2200, + &pci_ss_info_1039_7018_1563_7018, + &pci_ss_info_1039_7018_15c5_0111, + &pci_ss_info_1039_7018_270f_a171, + &pci_ss_info_1039_7018_a0a0_0022, + NULL +}; +#define pci_ss_list_103c_1005 NULL +#define pci_ss_list_103c_1006 NULL +#define pci_ss_list_103c_1008 NULL +#define pci_ss_list_103c_100a NULL +#define pci_ss_list_103c_1028 NULL +static const pciSubsystemInfo *pci_ss_list_103c_1029[] = { + &pci_ss_info_103c_1029_107e_000f, + &pci_ss_info_103c_1029_9004_9210, + &pci_ss_info_103c_1029_9004_9211, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_103c_102a[] = { + &pci_ss_info_103c_102a_107e_000e, + &pci_ss_info_103c_102a_9004_9110, + &pci_ss_info_103c_102a_9004_9111, + NULL +}; +#define pci_ss_list_103c_1030 NULL +static const pciSubsystemInfo *pci_ss_list_103c_1031[] = { + &pci_ss_info_103c_1031_103c_1040, + &pci_ss_info_103c_1031_103c_1041, + &pci_ss_info_103c_1031_103c_1042, + NULL +}; +#define pci_ss_list_103c_1040 NULL +#define pci_ss_list_103c_1041 NULL +#define pci_ss_list_103c_1042 NULL +static const pciSubsystemInfo *pci_ss_list_103c_1048[] = { + &pci_ss_info_103c_1048_103c_1049, + &pci_ss_info_103c_1048_103c_104a, + &pci_ss_info_103c_1048_103c_104b, + &pci_ss_info_103c_1048_103c_1223, + &pci_ss_info_103c_1048_103c_1226, + &pci_ss_info_103c_1048_103c_1227, + &pci_ss_info_103c_1048_103c_1282, + NULL +}; +#define pci_ss_list_103c_1064 NULL +#define pci_ss_list_103c_108b NULL +#define pci_ss_list_103c_10c1 NULL +#define pci_ss_list_103c_10ed NULL +#define pci_ss_list_103c_1200 NULL +#define pci_ss_list_103c_1219 NULL +#define pci_ss_list_103c_121a NULL +#define pci_ss_list_103c_121b NULL +#define pci_ss_list_103c_121c NULL +#define pci_ss_list_103c_1229 NULL +#define pci_ss_list_103c_122a NULL +#define pci_ss_list_103c_122e NULL +#define pci_ss_list_103c_1290 NULL +#define pci_ss_list_103c_2910 NULL +#define pci_ss_list_103c_2925 NULL +#define pci_ss_list_1042_1000 NULL +#define pci_ss_list_1042_1001 NULL +#define pci_ss_list_1042_3000 NULL +#define pci_ss_list_1042_3010 NULL +#define pci_ss_list_1042_3020 NULL +#define pci_ss_list_1043_0675 NULL +#define pci_ss_list_1043_4021 NULL +#define pci_ss_list_1044_1012 NULL +#define pci_ss_list_1044_a400 NULL +#define pci_ss_list_1044_a500 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1044_a501[] = { + &pci_ss_info_1044_a501_1044_c001, + &pci_ss_info_1044_a501_1044_c002, + &pci_ss_info_1044_a501_1044_c003, + &pci_ss_info_1044_a501_1044_c004, + &pci_ss_info_1044_a501_1044_c005, + &pci_ss_info_1044_a501_1044_c00a, + &pci_ss_info_1044_a501_1044_c00b, + &pci_ss_info_1044_a501_1044_c00c, + &pci_ss_info_1044_a501_1044_c00d, + &pci_ss_info_1044_a501_1044_c00e, + &pci_ss_info_1044_a501_1044_c00f, + &pci_ss_info_1044_a501_1044_c014, + &pci_ss_info_1044_a501_1044_c015, + &pci_ss_info_1044_a501_1044_c016, + &pci_ss_info_1044_a501_1044_c01e, + &pci_ss_info_1044_a501_1044_c01f, + &pci_ss_info_1044_a501_1044_c020, + &pci_ss_info_1044_a501_1044_c021, + &pci_ss_info_1044_a501_1044_c028, + &pci_ss_info_1044_a501_1044_c029, + &pci_ss_info_1044_a501_1044_c02a, + &pci_ss_info_1044_a501_1044_c03c, + &pci_ss_info_1044_a501_1044_c03d, + &pci_ss_info_1044_a501_1044_c03e, + &pci_ss_info_1044_a501_1044_c046, + &pci_ss_info_1044_a501_1044_c047, + &pci_ss_info_1044_a501_1044_c048, + &pci_ss_info_1044_a501_1044_c050, + &pci_ss_info_1044_a501_1044_c051, + &pci_ss_info_1044_a501_1044_c052, + &pci_ss_info_1044_a501_1044_c05a, + &pci_ss_info_1044_a501_1044_c05b, + &pci_ss_info_1044_a501_1044_c064, + &pci_ss_info_1044_a501_1044_c065, + &pci_ss_info_1044_a501_1044_c066, + NULL +}; +#define pci_ss_list_1044_a511 NULL +#endif +#define pci_ss_list_1045_a0f8 NULL +#define pci_ss_list_1045_c101 NULL +#define pci_ss_list_1045_c178 NULL +#define pci_ss_list_1045_c556 NULL +#define pci_ss_list_1045_c557 NULL +#define pci_ss_list_1045_c558 NULL +#define pci_ss_list_1045_c567 NULL +#define pci_ss_list_1045_c568 NULL +#define pci_ss_list_1045_c569 NULL +#define pci_ss_list_1045_c621 NULL +#define pci_ss_list_1045_c700 NULL +#define pci_ss_list_1045_c701 NULL +#define pci_ss_list_1045_c814 NULL +#define pci_ss_list_1045_c822 NULL +#define pci_ss_list_1045_c824 NULL +#define pci_ss_list_1045_c825 NULL +#define pci_ss_list_1045_c832 NULL +#define pci_ss_list_1045_c861 NULL +#define pci_ss_list_1045_c895 NULL +#define pci_ss_list_1045_c935 NULL +#define pci_ss_list_1045_d568 NULL +#define pci_ss_list_1045_d721 NULL +#define pci_ss_list_1048_0d22 NULL +#define pci_ss_list_1048_1000 NULL +#define pci_ss_list_1048_3000 NULL +#define pci_ss_list_104a_0008 NULL +#define pci_ss_list_104a_0009 NULL +#define pci_ss_list_104a_0010 NULL +#define pci_ss_list_104a_0210 NULL +#define pci_ss_list_104a_0981 NULL +#define pci_ss_list_104a_1746 NULL +#define pci_ss_list_104a_2774 NULL +#define pci_ss_list_104a_3520 NULL +#define pci_ss_list_104b_0140 NULL +#define pci_ss_list_104b_1040 NULL +#define pci_ss_list_104b_8130 NULL +#define pci_ss_list_104c_0500 NULL +#define pci_ss_list_104c_0508 NULL +#define pci_ss_list_104c_1000 NULL +#define pci_ss_list_104c_104c NULL +#define pci_ss_list_104c_3d04 NULL +static const pciSubsystemInfo *pci_ss_list_104c_3d07[] = { + &pci_ss_info_104c_3d07_1011_4d10, + &pci_ss_info_104c_3d07_1040_000f, + &pci_ss_info_104c_3d07_1040_0011, + &pci_ss_info_104c_3d07_1048_0a31, + &pci_ss_info_104c_3d07_1048_0a32, + &pci_ss_info_104c_3d07_1048_0a35, + &pci_ss_info_104c_3d07_107d_2633, + &pci_ss_info_104c_3d07_1092_0127, + &pci_ss_info_104c_3d07_1092_0136, + &pci_ss_info_104c_3d07_1092_0141, + &pci_ss_info_104c_3d07_1092_0146, + &pci_ss_info_104c_3d07_1092_0148, + &pci_ss_info_104c_3d07_1092_0149, + &pci_ss_info_104c_3d07_1092_0152, + &pci_ss_info_104c_3d07_1092_0154, + &pci_ss_info_104c_3d07_1092_0155, + &pci_ss_info_104c_3d07_1092_0156, + &pci_ss_info_104c_3d07_1092_0157, + &pci_ss_info_104c_3d07_1097_3d01, + &pci_ss_info_104c_3d07_1102_100f, + &pci_ss_info_104c_3d07_3d3d_0100, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_104c_8000[] = { + &pci_ss_info_104c_8000_e4bf_1010, + &pci_ss_info_104c_8000_e4bf_1020, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_104c_8009[] = { + &pci_ss_info_104c_8009_104d_8032, + NULL +}; +#define pci_ss_list_104c_8017 NULL +static const pciSubsystemInfo *pci_ss_list_104c_8019[] = { + &pci_ss_info_104c_8019_11bd_000a, + &pci_ss_info_104c_8019_11bd_000e, + &pci_ss_info_104c_8019_e4bf_1010, + NULL +}; +#define pci_ss_list_104c_8020 NULL +static const pciSubsystemInfo *pci_ss_list_104c_8021[] = { + &pci_ss_info_104c_8021_104d_80df, + &pci_ss_info_104c_8021_104d_80e7, + NULL +}; +#define pci_ss_list_104c_8022 NULL +#define pci_ss_list_104c_8023 NULL +#define pci_ss_list_104c_8024 NULL +#define pci_ss_list_104c_8026 NULL +static const pciSubsystemInfo *pci_ss_list_104c_8027[] = { + &pci_ss_info_104c_8027_1028_00e6, + NULL +}; +#define pci_ss_list_104c_8400 NULL +#define pci_ss_list_104c_a001 NULL +#define pci_ss_list_104c_a100 NULL +#define pci_ss_list_104c_a102 NULL +#define pci_ss_list_104c_a106 NULL +#define pci_ss_list_104c_ac10 NULL +#define pci_ss_list_104c_ac11 NULL +#define pci_ss_list_104c_ac12 NULL +#define pci_ss_list_104c_ac13 NULL +#define pci_ss_list_104c_ac15 NULL +#define pci_ss_list_104c_ac16 NULL +#define pci_ss_list_104c_ac17 NULL +#define pci_ss_list_104c_ac18 NULL +#define pci_ss_list_104c_ac19 NULL +#define pci_ss_list_104c_ac1a NULL +static const pciSubsystemInfo *pci_ss_list_104c_ac1b[] = { + &pci_ss_info_104c_ac1b_0e11_b113, + NULL +}; +#define pci_ss_list_104c_ac1c NULL +#define pci_ss_list_104c_ac1d NULL +#define pci_ss_list_104c_ac1e NULL +#define pci_ss_list_104c_ac1f NULL +#define pci_ss_list_104c_ac20 NULL +#define pci_ss_list_104c_ac21 NULL +#define pci_ss_list_104c_ac22 NULL +#define pci_ss_list_104c_ac23 NULL +#define pci_ss_list_104c_ac28 NULL +#define pci_ss_list_104c_ac30 NULL +#define pci_ss_list_104c_ac40 NULL +#define pci_ss_list_104c_ac41 NULL +static const pciSubsystemInfo *pci_ss_list_104c_ac42[] = { + &pci_ss_info_104c_ac42_1028_00e6, + NULL +}; +#define pci_ss_list_104c_ac50 NULL +static const pciSubsystemInfo *pci_ss_list_104c_ac51[] = { + &pci_ss_info_104c_ac51_1014_023b, + &pci_ss_info_104c_ac51_10cf_1095, + &pci_ss_info_104c_ac51_e4bf_1000, + NULL +}; +#define pci_ss_list_104c_ac52 NULL +#define pci_ss_list_104c_ac53 NULL +static const pciSubsystemInfo *pci_ss_list_104c_ac55[] = { + &pci_ss_info_104c_ac55_1014_0512, + NULL +}; +#define pci_ss_list_104c_ac56 NULL +#define pci_ss_list_104c_ac60 NULL +#define pci_ss_list_104c_fe00 NULL +#define pci_ss_list_104c_fe03 NULL +#define pci_ss_list_104d_8009 NULL +#define pci_ss_list_104d_8039 NULL +#define pci_ss_list_104d_8056 NULL +#define pci_ss_list_104d_808a NULL +#define pci_ss_list_104e_0017 NULL +#define pci_ss_list_104e_0107 NULL +#define pci_ss_list_104e_0109 NULL +#define pci_ss_list_104e_0111 NULL +#define pci_ss_list_104e_0217 NULL +#define pci_ss_list_104e_0317 NULL +#define pci_ss_list_1050_0000 NULL +#define pci_ss_list_1050_0001 NULL +#define pci_ss_list_1050_0105 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1050_0840[] = { + &pci_ss_info_1050_0840_1050_0001, + &pci_ss_info_1050_0840_1050_0840, + NULL +}; +#define pci_ss_list_1050_0940 NULL +#define pci_ss_list_1050_5a5a NULL +#define pci_ss_list_1050_6692 NULL +#define pci_ss_list_1050_9970 NULL +#endif +#define pci_ss_list_1055_9130 NULL +#define pci_ss_list_1055_9460 NULL +#define pci_ss_list_1055_9462 NULL +#define pci_ss_list_1055_9463 NULL +#define pci_ss_list_1057_0001 NULL +#define pci_ss_list_1057_0002 NULL +#define pci_ss_list_1057_0003 NULL +#define pci_ss_list_1057_0004 NULL +#define pci_ss_list_1057_0006 NULL +#define pci_ss_list_1057_0100 NULL +#define pci_ss_list_1057_0431 NULL +static const pciSubsystemInfo *pci_ss_list_1057_1801[] = { + &pci_ss_info_1057_1801_ecc0_0030, + NULL +}; +#define pci_ss_list_1057_18c0 NULL +#define pci_ss_list_1057_4801 NULL +#define pci_ss_list_1057_4802 NULL +#define pci_ss_list_1057_4803 NULL +#define pci_ss_list_1057_4806 NULL +#define pci_ss_list_1057_4d68 NULL +static const pciSubsystemInfo *pci_ss_list_1057_5600[] = { + &pci_ss_info_1057_5600_1057_0300, + &pci_ss_info_1057_5600_1057_0301, + &pci_ss_info_1057_5600_1057_0302, + &pci_ss_info_1057_5600_1057_5600, + &pci_ss_info_1057_5600_13d2_0300, + &pci_ss_info_1057_5600_13d2_0301, + &pci_ss_info_1057_5600_13d2_0302, + &pci_ss_info_1057_5600_1436_0300, + &pci_ss_info_1057_5600_1436_0301, + &pci_ss_info_1057_5600_1436_0302, + &pci_ss_info_1057_5600_144f_100c, + &pci_ss_info_1057_5600_1494_0300, + &pci_ss_info_1057_5600_1494_0301, + &pci_ss_info_1057_5600_14c8_0300, + &pci_ss_info_1057_5600_14c8_0302, + &pci_ss_info_1057_5600_1668_0300, + &pci_ss_info_1057_5600_1668_0302, + NULL +}; +#define pci_ss_list_1057_6400 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_105a_0d30[] = { + &pci_ss_info_105a_0d30_105a_4d33, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_105a_0d38[] = { + &pci_ss_info_105a_0d38_105a_4d39, + NULL +}; +#define pci_ss_list_105a_1275 NULL +#define pci_ss_list_105a_3376 NULL +static const pciSubsystemInfo *pci_ss_list_105a_4d30[] = { + &pci_ss_info_105a_4d30_105a_4d33, + &pci_ss_info_105a_4d30_105a_4d39, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_105a_4d33[] = { + &pci_ss_info_105a_4d33_105a_4d33, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_105a_4d38[] = { + &pci_ss_info_105a_4d38_105a_4d30, + &pci_ss_info_105a_4d38_105a_4d33, + &pci_ss_info_105a_4d38_105a_4d39, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_105a_4d68[] = { + &pci_ss_info_105a_4d68_105a_4d68, + NULL +}; +#define pci_ss_list_105a_4d69 NULL +static const pciSubsystemInfo *pci_ss_list_105a_5275[] = { + &pci_ss_info_105a_5275_105a_0275, + NULL +}; +#define pci_ss_list_105a_5300 NULL +#define pci_ss_list_105a_6268 NULL +static const pciSubsystemInfo *pci_ss_list_105a_6269[] = { + &pci_ss_info_105a_6269_105a_6269, + NULL +}; +#define pci_ss_list_105a_6621 NULL +#define pci_ss_list_105a_7275 NULL +#endif +#define pci_ss_list_105d_2309 NULL +static const pciSubsystemInfo *pci_ss_list_105d_2339[] = { + &pci_ss_info_105d_2339_105d_0000, + &pci_ss_info_105d_2339_105d_0001, + &pci_ss_info_105d_2339_105d_0002, + &pci_ss_info_105d_2339_105d_0003, + &pci_ss_info_105d_2339_105d_0004, + &pci_ss_info_105d_2339_105d_0005, + &pci_ss_info_105d_2339_105d_0006, + &pci_ss_info_105d_2339_105d_0007, + &pci_ss_info_105d_2339_105d_0008, + &pci_ss_info_105d_2339_105d_0009, + &pci_ss_info_105d_2339_105d_000a, + &pci_ss_info_105d_2339_105d_000b, + &pci_ss_info_105d_2339_11a4_000a, + &pci_ss_info_105d_2339_13cc_0000, + &pci_ss_info_105d_2339_13cc_0004, + &pci_ss_info_105d_2339_13cc_0005, + &pci_ss_info_105d_2339_13cc_0006, + &pci_ss_info_105d_2339_13cc_0008, + &pci_ss_info_105d_2339_13cc_0009, + &pci_ss_info_105d_2339_13cc_000a, + &pci_ss_info_105d_2339_13cc_000c, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_105d_493d[] = { + &pci_ss_info_105d_493d_11a4_000a, + &pci_ss_info_105d_493d_11a4_000b, + &pci_ss_info_105d_493d_13cc_0002, + &pci_ss_info_105d_493d_13cc_0003, + &pci_ss_info_105d_493d_13cc_0007, + &pci_ss_info_105d_493d_13cc_0008, + &pci_ss_info_105d_493d_13cc_0009, + &pci_ss_info_105d_493d_13cc_000a, + NULL +}; +#define pci_ss_list_105d_5348 NULL +#define pci_ss_list_1060_0001 NULL +#define pci_ss_list_1060_0002 NULL +#define pci_ss_list_1060_0101 NULL +#define pci_ss_list_1060_0881 NULL +#define pci_ss_list_1060_0886 NULL +#define pci_ss_list_1060_0891 NULL +#define pci_ss_list_1060_1001 NULL +#define pci_ss_list_1060_673a NULL +#define pci_ss_list_1060_673b NULL +#define pci_ss_list_1060_8710 NULL +#define pci_ss_list_1060_886a NULL +#define pci_ss_list_1060_8881 NULL +#define pci_ss_list_1060_8886 NULL +#define pci_ss_list_1060_888a NULL +#define pci_ss_list_1060_8891 NULL +#define pci_ss_list_1060_9017 NULL +#define pci_ss_list_1060_9018 NULL +#define pci_ss_list_1060_9026 NULL +#define pci_ss_list_1060_e881 NULL +#define pci_ss_list_1060_e886 NULL +#define pci_ss_list_1060_e88a NULL +#define pci_ss_list_1060_e891 NULL +#define pci_ss_list_1061_0001 NULL +#define pci_ss_list_1061_0002 NULL +#define pci_ss_list_1066_0000 NULL +#define pci_ss_list_1066_0001 NULL +#define pci_ss_list_1066_0002 NULL +#define pci_ss_list_1066_0003 NULL +#define pci_ss_list_1066_0004 NULL +#define pci_ss_list_1066_0005 NULL +#define pci_ss_list_1066_8002 NULL +#define pci_ss_list_1067_1002 NULL +#define pci_ss_list_1069_0001 NULL +#define pci_ss_list_1069_0002 NULL +#define pci_ss_list_1069_0010 NULL +#define pci_ss_list_1069_0050 NULL +#define pci_ss_list_1069_ba55 NULL +#define pci_ss_list_1069_ba56 NULL +#define pci_ss_list_106b_0001 NULL +#define pci_ss_list_106b_0002 NULL +#define pci_ss_list_106b_0003 NULL +#define pci_ss_list_106b_0004 NULL +#define pci_ss_list_106b_0007 NULL +#define pci_ss_list_106b_000e NULL +#define pci_ss_list_106b_0010 NULL +#define pci_ss_list_106b_0017 NULL +#define pci_ss_list_106b_0018 NULL +#define pci_ss_list_106b_0019 NULL +#define pci_ss_list_106b_001e NULL +#define pci_ss_list_106b_001f NULL +#define pci_ss_list_106b_0020 NULL +#define pci_ss_list_106b_0021 NULL +#define pci_ss_list_106b_0022 NULL +#define pci_ss_list_106b_0024 NULL +#define pci_ss_list_106b_0025 NULL +#define pci_ss_list_106b_0026 NULL +#define pci_ss_list_106b_0027 NULL +#define pci_ss_list_106b_0028 NULL +#define pci_ss_list_106b_0029 NULL +#define pci_ss_list_106b_002d NULL +#define pci_ss_list_106b_002e NULL +#define pci_ss_list_106b_002f NULL +#define pci_ss_list_106b_0030 NULL +#define pci_ss_list_106b_0031 NULL +#define pci_ss_list_106b_0032 NULL +#define pci_ss_list_106b_0033 NULL +#define pci_ss_list_106b_0034 NULL +#define pci_ss_list_106b_1645 NULL +#define pci_ss_list_106c_8801 NULL +#define pci_ss_list_106c_8802 NULL +#define pci_ss_list_106c_8803 NULL +#define pci_ss_list_106c_8804 NULL +#define pci_ss_list_106c_8805 NULL +#define pci_ss_list_1073_0001 NULL +#define pci_ss_list_1073_0002 NULL +#define pci_ss_list_1073_0003 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1073_0004[] = { + &pci_ss_info_1073_0004_1073_0004, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1073_0005[] = { + &pci_ss_info_1073_0005_1073_0005, + NULL +}; +#define pci_ss_list_1073_0006 NULL +static const pciSubsystemInfo *pci_ss_list_1073_0008[] = { + &pci_ss_info_1073_0008_1073_0008, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1073_000a[] = { + &pci_ss_info_1073_000a_1073_0004, + &pci_ss_info_1073_000a_1073_000a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1073_000c[] = { + &pci_ss_info_1073_000c_107a_000c, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1073_000d[] = { + &pci_ss_info_1073_000d_1073_000d, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1073_0010[] = { + &pci_ss_info_1073_0010_1073_0006, + &pci_ss_info_1073_0010_1073_0010, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1073_0012[] = { + &pci_ss_info_1073_0012_1073_0012, + NULL +}; +#define pci_ss_list_1073_0020 NULL +static const pciSubsystemInfo *pci_ss_list_1073_2000[] = { + &pci_ss_info_1073_2000_1073_2000, + NULL +}; +#endif +#define pci_ss_list_1074_4e78 NULL +#define pci_ss_list_1077_1016 NULL +#define pci_ss_list_1077_1020 NULL +#define pci_ss_list_1077_1022 NULL +#define pci_ss_list_1077_1080 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1077_1216[] = { + &pci_ss_info_1077_1216_101e_8471, + &pci_ss_info_1077_1216_101e_8493, + NULL +}; +#define pci_ss_list_1077_1240 NULL +#define pci_ss_list_1077_1280 NULL +#define pci_ss_list_1077_2020 NULL +static const pciSubsystemInfo *pci_ss_list_1077_2100[] = { + &pci_ss_info_1077_2100_1077_0001, + NULL +}; +#define pci_ss_list_1077_2200 NULL +#define pci_ss_list_1077_2300 NULL +#define pci_ss_list_1077_2312 NULL +#endif +#define pci_ss_list_1078_0000 NULL +#define pci_ss_list_1078_0001 NULL +#define pci_ss_list_1078_0002 NULL +#define pci_ss_list_1078_0100 NULL +#define pci_ss_list_1078_0101 NULL +#define pci_ss_list_1078_0102 NULL +#define pci_ss_list_1078_0103 NULL +#define pci_ss_list_1078_0104 NULL +#define pci_ss_list_1078_0400 NULL +#define pci_ss_list_1078_0401 NULL +#define pci_ss_list_1078_0402 NULL +#define pci_ss_list_1078_0403 NULL +#define pci_ss_list_107d_0000 NULL +#define pci_ss_list_107e_0001 NULL +#define pci_ss_list_107e_0002 NULL +#define pci_ss_list_107e_0004 NULL +#define pci_ss_list_107e_0005 NULL +#define pci_ss_list_107e_0008 NULL +#define pci_ss_list_107e_9003 NULL +#define pci_ss_list_107e_9007 NULL +#define pci_ss_list_107e_9008 NULL +#define pci_ss_list_107e_900c NULL +#define pci_ss_list_107e_900e NULL +#define pci_ss_list_107e_9011 NULL +#define pci_ss_list_107e_9013 NULL +#define pci_ss_list_107e_9023 NULL +#define pci_ss_list_107e_9027 NULL +#define pci_ss_list_107e_9031 NULL +#define pci_ss_list_107e_9033 NULL +#define pci_ss_list_107f_0802 NULL +#define pci_ss_list_1080_0600 NULL +#define pci_ss_list_1080_c691 NULL +#define pci_ss_list_1080_c693 NULL +#define pci_ss_list_1081_0d47 NULL +#define pci_ss_list_1083_0001 NULL +#define pci_ss_list_108a_0001 NULL +#define pci_ss_list_108a_0010 NULL +#define pci_ss_list_108a_0040 NULL +#define pci_ss_list_108a_3000 NULL +#define pci_ss_list_108d_0001 NULL +#define pci_ss_list_108d_0002 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_108d_0004[] = { + &pci_ss_info_108d_0004_108d_0004, + NULL +}; +#define pci_ss_list_108d_0005 NULL +#define pci_ss_list_108d_0006 NULL +static const pciSubsystemInfo *pci_ss_list_108d_0007[] = { + &pci_ss_info_108d_0007_108d_0007, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_108d_0008[] = { + &pci_ss_info_108d_0008_108d_0008, + NULL +}; +#define pci_ss_list_108d_0011 NULL +#define pci_ss_list_108d_0012 NULL +#define pci_ss_list_108d_0013 NULL +#define pci_ss_list_108d_0014 NULL +static const pciSubsystemInfo *pci_ss_list_108d_0019[] = { + &pci_ss_info_108d_0019_108d_0016, + &pci_ss_info_108d_0019_108d_0017, + NULL +}; +#define pci_ss_list_108d_0021 NULL +#define pci_ss_list_108d_0022 NULL +#endif +#define pci_ss_list_108e_0001 NULL +#define pci_ss_list_108e_1000 NULL +#define pci_ss_list_108e_1001 NULL +#define pci_ss_list_108e_1100 NULL +#define pci_ss_list_108e_1101 NULL +#define pci_ss_list_108e_1102 NULL +#define pci_ss_list_108e_1103 NULL +#define pci_ss_list_108e_2bad NULL +#define pci_ss_list_108e_5000 NULL +#define pci_ss_list_108e_5043 NULL +#define pci_ss_list_108e_8000 NULL +#define pci_ss_list_108e_8001 NULL +#define pci_ss_list_108e_a000 NULL +#define pci_ss_list_108e_a001 NULL +#define pci_ss_list_1091_0020 NULL +#define pci_ss_list_1091_0021 NULL +#define pci_ss_list_1091_0040 NULL +#define pci_ss_list_1091_0041 NULL +#define pci_ss_list_1091_0060 NULL +#define pci_ss_list_1091_00e4 NULL +#define pci_ss_list_1091_0720 NULL +#define pci_ss_list_1092_00a0 NULL +#define pci_ss_list_1092_00a8 NULL +#define pci_ss_list_1092_0550 NULL +#define pci_ss_list_1092_08d4 NULL +#define pci_ss_list_1092_094c NULL +#define pci_ss_list_1092_1092 NULL +#define pci_ss_list_1092_6120 NULL +#define pci_ss_list_1092_8810 NULL +#define pci_ss_list_1092_8811 NULL +#define pci_ss_list_1092_8880 NULL +#define pci_ss_list_1092_8881 NULL +#define pci_ss_list_1092_88b0 NULL +#define pci_ss_list_1092_88b1 NULL +#define pci_ss_list_1092_88c0 NULL +#define pci_ss_list_1092_88c1 NULL +#define pci_ss_list_1092_88d0 NULL +#define pci_ss_list_1092_88d1 NULL +#define pci_ss_list_1092_88f0 NULL +#define pci_ss_list_1092_88f1 NULL +#define pci_ss_list_1092_9999 NULL +#define pci_ss_list_1093_0160 NULL +#define pci_ss_list_1093_0162 NULL +#define pci_ss_list_1093_1170 NULL +#define pci_ss_list_1093_1180 NULL +#define pci_ss_list_1093_1190 NULL +#define pci_ss_list_1093_1330 NULL +#define pci_ss_list_1093_1350 NULL +#define pci_ss_list_1093_2a60 NULL +#define pci_ss_list_1093_b001 NULL +#define pci_ss_list_1093_b011 NULL +#define pci_ss_list_1093_b021 NULL +#define pci_ss_list_1093_b031 NULL +#define pci_ss_list_1093_b041 NULL +#define pci_ss_list_1093_b051 NULL +#define pci_ss_list_1093_b061 NULL +#define pci_ss_list_1093_b071 NULL +#define pci_ss_list_1093_b081 NULL +#define pci_ss_list_1093_b091 NULL +#define pci_ss_list_1093_c801 NULL +#define pci_ss_list_1093_c831 NULL +#define pci_ss_list_1095_0640 NULL +#define pci_ss_list_1095_0643 NULL +#define pci_ss_list_1095_0646 NULL +#define pci_ss_list_1095_0647 NULL +#define pci_ss_list_1095_0648 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1095_0649[] = { + &pci_ss_info_1095_0649_0e11_005d, + &pci_ss_info_1095_0649_0e11_007e, + &pci_ss_info_1095_0649_101e_0649, + NULL +}; +#define pci_ss_list_1095_0650 NULL +static const pciSubsystemInfo *pci_ss_list_1095_0670[] = { + &pci_ss_info_1095_0670_1095_0670, + NULL +}; +#define pci_ss_list_1095_0673 NULL +#define pci_ss_list_1095_0680 NULL +#define pci_ss_list_1095_3112 NULL +#endif +#define pci_ss_list_1098_0001 NULL +#define pci_ss_list_1098_0002 NULL +#define pci_ss_list_109e_0350 NULL +#define pci_ss_list_109e_0351 NULL +static const pciSubsystemInfo *pci_ss_list_109e_0369[] = { + &pci_ss_info_109e_0369_1002_0001, + &pci_ss_info_109e_0369_1002_0003, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_109e_036c[] = { + &pci_ss_info_109e_036c_13e9_0070, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_109e_036e[] = { + &pci_ss_info_109e_036e_0070_13eb, + &pci_ss_info_109e_036e_0070_ff01, + &pci_ss_info_109e_036e_107d_6606, + &pci_ss_info_109e_036e_11bd_0012, + &pci_ss_info_109e_036e_11bd_001c, + &pci_ss_info_109e_036e_127a_0001, + &pci_ss_info_109e_036e_127a_0002, + &pci_ss_info_109e_036e_127a_0003, + &pci_ss_info_109e_036e_127a_0048, + &pci_ss_info_109e_036e_144f_3000, + &pci_ss_info_109e_036e_1461_0004, + &pci_ss_info_109e_036e_14f1_0001, + &pci_ss_info_109e_036e_14f1_0002, + &pci_ss_info_109e_036e_14f1_0003, + &pci_ss_info_109e_036e_14f1_0048, + &pci_ss_info_109e_036e_1851_1850, + &pci_ss_info_109e_036e_1851_1851, + &pci_ss_info_109e_036e_1852_1852, + &pci_ss_info_109e_036e_bd11_1200, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_109e_036f[] = { + &pci_ss_info_109e_036f_127a_0044, + &pci_ss_info_109e_036f_127a_0122, + &pci_ss_info_109e_036f_127a_0144, + &pci_ss_info_109e_036f_127a_0222, + &pci_ss_info_109e_036f_127a_0244, + &pci_ss_info_109e_036f_127a_0322, + &pci_ss_info_109e_036f_127a_0422, + &pci_ss_info_109e_036f_127a_1122, + &pci_ss_info_109e_036f_127a_1222, + &pci_ss_info_109e_036f_127a_1322, + &pci_ss_info_109e_036f_127a_1522, + &pci_ss_info_109e_036f_127a_1622, + &pci_ss_info_109e_036f_127a_1722, + &pci_ss_info_109e_036f_14f1_0044, + &pci_ss_info_109e_036f_14f1_0122, + &pci_ss_info_109e_036f_14f1_0144, + &pci_ss_info_109e_036f_14f1_0222, + &pci_ss_info_109e_036f_14f1_0244, + &pci_ss_info_109e_036f_14f1_0322, + &pci_ss_info_109e_036f_14f1_0422, + &pci_ss_info_109e_036f_14f1_1122, + &pci_ss_info_109e_036f_14f1_1222, + &pci_ss_info_109e_036f_14f1_1322, + &pci_ss_info_109e_036f_14f1_1522, + &pci_ss_info_109e_036f_14f1_1622, + &pci_ss_info_109e_036f_14f1_1722, + &pci_ss_info_109e_036f_1851_1850, + &pci_ss_info_109e_036f_1851_1851, + &pci_ss_info_109e_036f_1852_1852, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_109e_0370[] = { + &pci_ss_info_109e_0370_1851_1850, + &pci_ss_info_109e_0370_1851_1851, + &pci_ss_info_109e_0370_1852_1852, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_109e_0878[] = { + &pci_ss_info_109e_0878_0070_13eb, + &pci_ss_info_109e_0878_0070_ff01, + &pci_ss_info_109e_0878_1002_0001, + &pci_ss_info_109e_0878_1002_0003, + &pci_ss_info_109e_0878_11bd_0012, + &pci_ss_info_109e_0878_11bd_001c, + &pci_ss_info_109e_0878_127a_0001, + &pci_ss_info_109e_0878_127a_0002, + &pci_ss_info_109e_0878_127a_0003, + &pci_ss_info_109e_0878_127a_0048, + &pci_ss_info_109e_0878_13e9_0070, + &pci_ss_info_109e_0878_144f_3000, + &pci_ss_info_109e_0878_1461_0004, + &pci_ss_info_109e_0878_14f1_0001, + &pci_ss_info_109e_0878_14f1_0002, + &pci_ss_info_109e_0878_14f1_0003, + &pci_ss_info_109e_0878_14f1_0048, + &pci_ss_info_109e_0878_bd11_1200, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_109e_0879[] = { + &pci_ss_info_109e_0879_127a_0044, + &pci_ss_info_109e_0879_127a_0122, + &pci_ss_info_109e_0879_127a_0144, + &pci_ss_info_109e_0879_127a_0222, + &pci_ss_info_109e_0879_127a_0244, + &pci_ss_info_109e_0879_127a_0322, + &pci_ss_info_109e_0879_127a_0422, + &pci_ss_info_109e_0879_127a_1122, + &pci_ss_info_109e_0879_127a_1222, + &pci_ss_info_109e_0879_127a_1322, + &pci_ss_info_109e_0879_127a_1522, + &pci_ss_info_109e_0879_127a_1622, + &pci_ss_info_109e_0879_127a_1722, + &pci_ss_info_109e_0879_14f1_0044, + &pci_ss_info_109e_0879_14f1_0122, + &pci_ss_info_109e_0879_14f1_0144, + &pci_ss_info_109e_0879_14f1_0222, + &pci_ss_info_109e_0879_14f1_0244, + &pci_ss_info_109e_0879_14f1_0322, + &pci_ss_info_109e_0879_14f1_0422, + &pci_ss_info_109e_0879_14f1_1122, + &pci_ss_info_109e_0879_14f1_1222, + &pci_ss_info_109e_0879_14f1_1322, + &pci_ss_info_109e_0879_14f1_1522, + &pci_ss_info_109e_0879_14f1_1622, + &pci_ss_info_109e_0879_14f1_1722, + NULL +}; +#define pci_ss_list_109e_0880 NULL +#define pci_ss_list_109e_2115 NULL +#define pci_ss_list_109e_2125 NULL +#define pci_ss_list_109e_2164 NULL +#define pci_ss_list_109e_2165 NULL +#define pci_ss_list_109e_8230 NULL +#define pci_ss_list_109e_8472 NULL +#define pci_ss_list_109e_8474 NULL +#define pci_ss_list_10a5_5449 NULL +#define pci_ss_list_10a8_0000 NULL +#define pci_ss_list_10a9_0001 NULL +#define pci_ss_list_10a9_0002 NULL +#define pci_ss_list_10a9_0003 NULL +#define pci_ss_list_10a9_0004 NULL +#define pci_ss_list_10a9_0005 NULL +#define pci_ss_list_10a9_0006 NULL +#define pci_ss_list_10a9_0007 NULL +#define pci_ss_list_10a9_0008 NULL +#define pci_ss_list_10a9_0009 NULL +#define pci_ss_list_10a9_0010 NULL +#define pci_ss_list_10a9_0011 NULL +#define pci_ss_list_10a9_0012 NULL +#define pci_ss_list_10a9_1001 NULL +#define pci_ss_list_10a9_1002 NULL +#define pci_ss_list_10a9_1003 NULL +#define pci_ss_list_10a9_1004 NULL +#define pci_ss_list_10a9_1005 NULL +#define pci_ss_list_10a9_1006 NULL +#define pci_ss_list_10a9_1007 NULL +#define pci_ss_list_10a9_1008 NULL +#define pci_ss_list_10a9_2001 NULL +#define pci_ss_list_10a9_2002 NULL +#define pci_ss_list_10a9_8001 NULL +#define pci_ss_list_10a9_8002 NULL +#define pci_ss_list_10aa_0000 NULL +#define pci_ss_list_10ad_0001 NULL +#define pci_ss_list_10ad_0003 NULL +#define pci_ss_list_10ad_0005 NULL +#define pci_ss_list_10ad_0103 NULL +#define pci_ss_list_10ad_0105 NULL +#define pci_ss_list_10ad_0565 NULL +#define pci_ss_list_10b3_3106 NULL +#define pci_ss_list_10b3_b106 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b4_1b1d[] = { + &pci_ss_info_10b4_1b1d_10b4_237e, + NULL +}; +#endif +#define pci_ss_list_10b5_0001 NULL +#define pci_ss_list_10b5_1076 NULL +#define pci_ss_list_10b5_1077 NULL +#define pci_ss_list_10b5_1078 NULL +#define pci_ss_list_10b5_1103 NULL +#define pci_ss_list_10b5_1146 NULL +#define pci_ss_list_10b5_1147 NULL +#define pci_ss_list_10b5_2724 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b5_9030[] = { + &pci_ss_info_10b5_9030_15ed_1002, + &pci_ss_info_10b5_9030_15ed_1003, + NULL +}; +#define pci_ss_list_10b5_9036 NULL +static const pciSubsystemInfo *pci_ss_list_10b5_9050[] = { + &pci_ss_info_10b5_9050_10b5_2036, + &pci_ss_info_10b5_9050_10b5_2273, + &pci_ss_info_10b5_9050_10b5_9050, + &pci_ss_info_10b5_9050_1522_0001, + &pci_ss_info_10b5_9050_1522_0002, + &pci_ss_info_10b5_9050_1522_0003, + &pci_ss_info_10b5_9050_1522_0004, + &pci_ss_info_10b5_9050_1522_0010, + &pci_ss_info_10b5_9050_1522_0020, + &pci_ss_info_10b5_9050_15ed_1000, + &pci_ss_info_10b5_9050_15ed_1001, + &pci_ss_info_10b5_9050_15ed_1002, + &pci_ss_info_10b5_9050_15ed_1003, + &pci_ss_info_10b5_9050_5654_5634, + &pci_ss_info_10b5_9050_d531_c002, + &pci_ss_info_10b5_9050_d84d_4006, + &pci_ss_info_10b5_9050_d84d_4008, + &pci_ss_info_10b5_9050_d84d_4014, + &pci_ss_info_10b5_9050_d84d_4018, + &pci_ss_info_10b5_9050_d84d_4025, + &pci_ss_info_10b5_9050_d84d_4027, + &pci_ss_info_10b5_9050_d84d_4028, + &pci_ss_info_10b5_9050_d84d_4036, + &pci_ss_info_10b5_9050_d84d_4037, + &pci_ss_info_10b5_9050_d84d_4038, + &pci_ss_info_10b5_9050_d84d_4052, + &pci_ss_info_10b5_9050_d84d_4053, + &pci_ss_info_10b5_9050_d84d_4055, + &pci_ss_info_10b5_9050_d84d_4058, + &pci_ss_info_10b5_9050_d84d_4065, + &pci_ss_info_10b5_9050_d84d_4068, + &pci_ss_info_10b5_9050_d84d_4078, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b5_9054[] = { + &pci_ss_info_10b5_9054_10b5_2455, + NULL +}; +#define pci_ss_list_10b5_9060 NULL +static const pciSubsystemInfo *pci_ss_list_10b5_906d[] = { + &pci_ss_info_10b5_906d_125c_0640, + NULL +}; +#define pci_ss_list_10b5_906e NULL +static const pciSubsystemInfo *pci_ss_list_10b5_9080[] = { + &pci_ss_info_10b5_9080_10b5_9080, + &pci_ss_info_10b5_9080_129d_0002, + NULL +}; +#endif +#define pci_ss_list_10b6_0001 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b6_0002[] = { + &pci_ss_info_10b6_0002_10b6_0002, + &pci_ss_info_10b6_0002_10b6_0006, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b6_0003[] = { + &pci_ss_info_10b6_0003_0e11_b0fd, + &pci_ss_info_10b6_0003_10b6_0003, + &pci_ss_info_10b6_0003_10b6_0007, + NULL +}; +#define pci_ss_list_10b6_0004 NULL +static const pciSubsystemInfo *pci_ss_list_10b6_0006[] = { + &pci_ss_info_10b6_0006_10b6_0006, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b6_0007[] = { + &pci_ss_info_10b6_0007_10b6_0007, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b6_0009[] = { + &pci_ss_info_10b6_0009_10b6_0009, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b6_000a[] = { + &pci_ss_info_10b6_000a_10b6_000a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b6_000b[] = { + &pci_ss_info_10b6_000b_10b6_0008, + &pci_ss_info_10b6_000b_10b6_000b, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b6_000c[] = { + &pci_ss_info_10b6_000c_10b6_000c, + NULL +}; +#define pci_ss_list_10b6_1000 NULL +#define pci_ss_list_10b6_1001 NULL +#endif +#define pci_ss_list_10b7_0001 NULL +#define pci_ss_list_10b7_1006 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b7_1007[] = { + &pci_ss_info_10b7_1007_10b7_615c, + NULL +}; +#define pci_ss_list_10b7_3390 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_3590[] = { + &pci_ss_info_10b7_3590_10b7_3590, + NULL +}; +#define pci_ss_list_10b7_4500 NULL +#define pci_ss_list_10b7_5055 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_5057[] = { + &pci_ss_info_10b7_5057_10b7_5a57, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_5157[] = { + &pci_ss_info_10b7_5157_10b7_5b57, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_5257[] = { + &pci_ss_info_10b7_5257_10b7_5c57, + NULL +}; +#define pci_ss_list_10b7_5900 NULL +#define pci_ss_list_10b7_5920 NULL +#define pci_ss_list_10b7_5950 NULL +#define pci_ss_list_10b7_5951 NULL +#define pci_ss_list_10b7_5952 NULL +#define pci_ss_list_10b7_5970 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_5b57[] = { + &pci_ss_info_10b7_5b57_10b7_5b57, + NULL +}; +#define pci_ss_list_10b7_6055 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_6056[] = { + &pci_ss_info_10b7_6056_10b7_6556, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_6560[] = { + &pci_ss_info_10b7_6560_10b7_656a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_6561[] = { + &pci_ss_info_10b7_6561_10b7_656b, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_6562[] = { + &pci_ss_info_10b7_6562_10b7_656b, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_6563[] = { + &pci_ss_info_10b7_6563_10b7_656b, + NULL +}; +#define pci_ss_list_10b7_6564 NULL +#define pci_ss_list_10b7_7646 NULL +#define pci_ss_list_10b7_7940 NULL +#define pci_ss_list_10b7_7980 NULL +#define pci_ss_list_10b7_7990 NULL +#define pci_ss_list_10b7_8811 NULL +#define pci_ss_list_10b7_9000 NULL +#define pci_ss_list_10b7_9001 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_9004[] = { + &pci_ss_info_10b7_9004_10b7_9004, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_9005[] = { + &pci_ss_info_10b7_9005_10b7_9005, + NULL +}; +#define pci_ss_list_10b7_9006 NULL +#define pci_ss_list_10b7_900a NULL +#define pci_ss_list_10b7_9050 NULL +#define pci_ss_list_10b7_9051 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_9055[] = { + &pci_ss_info_10b7_9055_1028_0080, + &pci_ss_info_10b7_9055_1028_0081, + &pci_ss_info_10b7_9055_1028_0082, + &pci_ss_info_10b7_9055_1028_0083, + &pci_ss_info_10b7_9055_1028_0084, + &pci_ss_info_10b7_9055_1028_0085, + &pci_ss_info_10b7_9055_1028_0086, + &pci_ss_info_10b7_9055_1028_0087, + &pci_ss_info_10b7_9055_1028_0088, + &pci_ss_info_10b7_9055_1028_0089, + &pci_ss_info_10b7_9055_1028_0090, + &pci_ss_info_10b7_9055_1028_0091, + &pci_ss_info_10b7_9055_1028_0092, + &pci_ss_info_10b7_9055_1028_0093, + &pci_ss_info_10b7_9055_1028_0094, + &pci_ss_info_10b7_9055_1028_0095, + &pci_ss_info_10b7_9055_1028_0096, + &pci_ss_info_10b7_9055_1028_0097, + &pci_ss_info_10b7_9055_1028_0098, + &pci_ss_info_10b7_9055_1028_0099, + &pci_ss_info_10b7_9055_10b7_9055, + NULL +}; +#define pci_ss_list_10b7_9056 NULL +#define pci_ss_list_10b7_9058 NULL +#define pci_ss_list_10b7_905a NULL +static const pciSubsystemInfo *pci_ss_list_10b7_9200[] = { + &pci_ss_info_10b7_9200_1028_0095, + &pci_ss_info_10b7_9200_10b7_1000, + &pci_ss_info_10b7_9200_10b7_7000, + NULL +}; +#define pci_ss_list_10b7_9201 NULL +#define pci_ss_list_10b7_9300 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_9800[] = { + &pci_ss_info_10b7_9800_10b7_9800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_9805[] = { + &pci_ss_info_10b7_9805_10b7_1201, + &pci_ss_info_10b7_9805_10b7_1202, + &pci_ss_info_10b7_9805_10b7_9805, + &pci_ss_info_10b7_9805_10f1_2462, + NULL +}; +#define pci_ss_list_10b7_9900 NULL +#define pci_ss_list_10b7_9902 NULL +#define pci_ss_list_10b7_9903 NULL +static const pciSubsystemInfo *pci_ss_list_10b7_9904[] = { + &pci_ss_info_10b7_9904_10b7_1000, + &pci_ss_info_10b7_9904_10b7_2000, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b7_9905[] = { + &pci_ss_info_10b7_9905_10b7_1101, + &pci_ss_info_10b7_9905_10b7_1102, + &pci_ss_info_10b7_9905_10b7_2101, + &pci_ss_info_10b7_9905_10b7_2102, + NULL +}; +#define pci_ss_list_10b7_9908 NULL +#define pci_ss_list_10b7_9909 NULL +#define pci_ss_list_10b7_990b NULL +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b8_0005[] = { + &pci_ss_info_10b8_0005_1055_e000, + &pci_ss_info_10b8_0005_1055_e002, + &pci_ss_info_10b8_0005_10b8_a011, + &pci_ss_info_10b8_0005_10b8_a014, + &pci_ss_info_10b8_0005_10b8_a015, + &pci_ss_info_10b8_0005_10b8_a016, + &pci_ss_info_10b8_0005_10b8_a017, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b8_0006[] = { + &pci_ss_info_10b8_0006_1055_e100, + &pci_ss_info_10b8_0006_1055_e102, + &pci_ss_info_10b8_0006_1055_e300, + &pci_ss_info_10b8_0006_1055_e302, + &pci_ss_info_10b8_0006_10b8_a012, + &pci_ss_info_10b8_0006_13a2_8002, + &pci_ss_info_10b8_0006_13a2_8006, + NULL +}; +#define pci_ss_list_10b8_1000 NULL +#define pci_ss_list_10b8_1001 NULL +#define pci_ss_list_10b8_a011 NULL +#define pci_ss_list_10b8_b106 NULL +#endif +static const pciSubsystemInfo *pci_ss_list_10b9_0111[] = { + &pci_ss_info_10b9_0111_10b9_0111, + NULL +}; +#define pci_ss_list_10b9_1435 NULL +#define pci_ss_list_10b9_1445 NULL +#define pci_ss_list_10b9_1449 NULL +#define pci_ss_list_10b9_1451 NULL +#define pci_ss_list_10b9_1461 NULL +#define pci_ss_list_10b9_1489 NULL +#define pci_ss_list_10b9_1511 NULL +#define pci_ss_list_10b9_1512 NULL +#define pci_ss_list_10b9_1513 NULL +static const pciSubsystemInfo *pci_ss_list_10b9_1521[] = { + &pci_ss_info_10b9_1521_10b9_1521, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b9_1523[] = { + &pci_ss_info_10b9_1523_10b9_1523, + NULL +}; +#define pci_ss_list_10b9_1531 NULL +static const pciSubsystemInfo *pci_ss_list_10b9_1533[] = { + &pci_ss_info_10b9_1533_10b9_1533, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10b9_1541[] = { + &pci_ss_info_10b9_1541_10b9_1541, + NULL +}; +#define pci_ss_list_10b9_1543 NULL +#define pci_ss_list_10b9_1563 NULL +#define pci_ss_list_10b9_1621 NULL +#define pci_ss_list_10b9_1631 NULL +#define pci_ss_list_10b9_1632 NULL +#define pci_ss_list_10b9_1641 NULL +#define pci_ss_list_10b9_1644 NULL +#define pci_ss_list_10b9_1646 NULL +#define pci_ss_list_10b9_1647 NULL +#define pci_ss_list_10b9_1651 NULL +#define pci_ss_list_10b9_1671 NULL +#define pci_ss_list_10b9_1681 NULL +#define pci_ss_list_10b9_1687 NULL +#define pci_ss_list_10b9_3141 NULL +#define pci_ss_list_10b9_3143 NULL +#define pci_ss_list_10b9_3145 NULL +#define pci_ss_list_10b9_3147 NULL +#define pci_ss_list_10b9_3149 NULL +#define pci_ss_list_10b9_3151 NULL +#define pci_ss_list_10b9_3307 NULL +#define pci_ss_list_10b9_3309 NULL +#define pci_ss_list_10b9_5212 NULL +#define pci_ss_list_10b9_5215 NULL +#define pci_ss_list_10b9_5217 NULL +#define pci_ss_list_10b9_5219 NULL +#define pci_ss_list_10b9_5225 NULL +static const pciSubsystemInfo *pci_ss_list_10b9_5229[] = { + &pci_ss_info_10b9_5229_1043_8053, + NULL +}; +#define pci_ss_list_10b9_5235 NULL +#define pci_ss_list_10b9_5237 NULL +#define pci_ss_list_10b9_5239 NULL +#define pci_ss_list_10b9_5243 NULL +#define pci_ss_list_10b9_5247 NULL +#define pci_ss_list_10b9_5249 NULL +#define pci_ss_list_10b9_5251 NULL +#define pci_ss_list_10b9_5253 NULL +#define pci_ss_list_10b9_5261 NULL +static const pciSubsystemInfo *pci_ss_list_10b9_5451[] = { + &pci_ss_info_10b9_5451_1014_0506, + NULL +}; +#define pci_ss_list_10b9_5453 NULL +#define pci_ss_list_10b9_5455 NULL +#define pci_ss_list_10b9_5457 NULL +#define pci_ss_list_10b9_5459 NULL +#define pci_ss_list_10b9_545a NULL +#define pci_ss_list_10b9_5471 NULL +#define pci_ss_list_10b9_5473 NULL +static const pciSubsystemInfo *pci_ss_list_10b9_7101[] = { + &pci_ss_info_10b9_7101_10b9_7101, + NULL +}; +#define pci_ss_list_10ba_0301 NULL +#define pci_ss_list_10bd_0e34 NULL +#define pci_ss_list_10c3_1100 NULL +#define pci_ss_list_10c8_0001 NULL +#define pci_ss_list_10c8_0002 NULL +#define pci_ss_list_10c8_0003 NULL +static const pciSubsystemInfo *pci_ss_list_10c8_0004[] = { + &pci_ss_info_10c8_0004_1014_00ba, + &pci_ss_info_10c8_0004_1025_1007, + &pci_ss_info_10c8_0004_1028_0074, + &pci_ss_info_10c8_0004_1028_0075, + &pci_ss_info_10c8_0004_1028_007d, + &pci_ss_info_10c8_0004_1028_007e, + &pci_ss_info_10c8_0004_1033_802f, + &pci_ss_info_10c8_0004_104d_801b, + &pci_ss_info_10c8_0004_104d_802f, + &pci_ss_info_10c8_0004_104d_830b, + &pci_ss_info_10c8_0004_10ba_0e00, + &pci_ss_info_10c8_0004_10c8_0004, + &pci_ss_info_10c8_0004_10cf_1029, + &pci_ss_info_10c8_0004_10f7_8308, + &pci_ss_info_10c8_0004_10f7_8309, + &pci_ss_info_10c8_0004_10f7_830b, + &pci_ss_info_10c8_0004_10f7_830d, + &pci_ss_info_10c8_0004_10f7_8312, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10c8_0005[] = { + &pci_ss_info_10c8_0005_1014_00dd, + NULL +}; +#define pci_ss_list_10c8_0006 NULL +static const pciSubsystemInfo *pci_ss_list_10c8_0016[] = { + &pci_ss_info_10c8_0016_10c8_0016, + NULL +}; +#define pci_ss_list_10c8_0025 NULL +#define pci_ss_list_10c8_0083 NULL +static const pciSubsystemInfo *pci_ss_list_10c8_8005[] = { + &pci_ss_info_10c8_8005_0e11_b0d1, + &pci_ss_info_10c8_8005_0e11_b126, + &pci_ss_info_10c8_8005_1014_00dd, + &pci_ss_info_10c8_8005_1025_1003, + &pci_ss_info_10c8_8005_1028_008f, + &pci_ss_info_10c8_8005_103c_0007, + &pci_ss_info_10c8_8005_103c_0008, + &pci_ss_info_10c8_8005_103c_000d, + &pci_ss_info_10c8_8005_10c8_8005, + &pci_ss_info_10c8_8005_110a_8005, + &pci_ss_info_10c8_8005_14c0_0004, + NULL +}; +#define pci_ss_list_10c8_8006 NULL +#define pci_ss_list_10c8_8016 NULL +#define pci_ss_list_10cd_1100 NULL +#define pci_ss_list_10cd_1200 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10cd_1300[] = { + &pci_ss_info_10cd_1300_10cd_1310, + NULL +}; +#define pci_ss_list_10cd_2300 NULL +#define pci_ss_list_10cd_2500 NULL +#endif +#define pci_ss_list_10cf_2001 NULL +#define pci_ss_list_10d9_0512 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10d9_0531[] = { + &pci_ss_info_10d9_0531_1186_1200, + NULL +}; +#define pci_ss_list_10d9_8625 NULL +#define pci_ss_list_10d9_8888 NULL +#endif +#define pci_ss_list_10da_0508 NULL +#define pci_ss_list_10da_3390 NULL +#define pci_ss_list_10dc_0001 NULL +#define pci_ss_list_10dc_0002 NULL +#define pci_ss_list_10dc_0021 NULL +#define pci_ss_list_10dc_0022 NULL +#define pci_ss_list_10dc_10dc NULL +#define pci_ss_list_10de_0008 NULL +#define pci_ss_list_10de_0009 NULL +#define pci_ss_list_10de_0010 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0020[] = { + &pci_ss_info_10de_0020_1043_0200, + &pci_ss_info_10de_0020_1048_0c18, + &pci_ss_info_10de_0020_1048_0c1b, + &pci_ss_info_10de_0020_1092_0550, + &pci_ss_info_10de_0020_1092_0552, + &pci_ss_info_10de_0020_1092_4804, + &pci_ss_info_10de_0020_1092_4808, + &pci_ss_info_10de_0020_1092_4810, + &pci_ss_info_10de_0020_1092_4812, + &pci_ss_info_10de_0020_1092_4815, + &pci_ss_info_10de_0020_1092_4820, + &pci_ss_info_10de_0020_1092_4822, + &pci_ss_info_10de_0020_1092_4904, + &pci_ss_info_10de_0020_1092_4914, + &pci_ss_info_10de_0020_1092_8225, + &pci_ss_info_10de_0020_10b4_273d, + &pci_ss_info_10de_0020_10b4_273e, + &pci_ss_info_10de_0020_10b4_2740, + &pci_ss_info_10de_0020_10de_0020, + &pci_ss_info_10de_0020_1102_1015, + &pci_ss_info_10de_0020_1102_1016, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0028[] = { + &pci_ss_info_10de_0028_1043_0200, + &pci_ss_info_10de_0028_1043_0201, + &pci_ss_info_10de_0028_1043_0205, + &pci_ss_info_10de_0028_1043_4000, + &pci_ss_info_10de_0028_1092_4804, + &pci_ss_info_10de_0028_1092_4a00, + &pci_ss_info_10de_0028_1092_4a02, + &pci_ss_info_10de_0028_1092_5a00, + &pci_ss_info_10de_0028_1092_6a02, + &pci_ss_info_10de_0028_1092_7a02, + &pci_ss_info_10de_0028_10de_0005, + &pci_ss_info_10de_0028_10de_000f, + &pci_ss_info_10de_0028_1102_1020, + &pci_ss_info_10de_0028_1102_1026, + &pci_ss_info_10de_0028_14af_5810, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0029[] = { + &pci_ss_info_10de_0029_1043_0200, + &pci_ss_info_10de_0029_1043_0201, + &pci_ss_info_10de_0029_1043_0205, + &pci_ss_info_10de_0029_1102_1021, + &pci_ss_info_10de_0029_1102_1029, + &pci_ss_info_10de_0029_1102_102f, + &pci_ss_info_10de_0029_14af_5820, + NULL +}; +#define pci_ss_list_10de_002a NULL +#define pci_ss_list_10de_002b NULL +static const pciSubsystemInfo *pci_ss_list_10de_002c[] = { + &pci_ss_info_10de_002c_1043_0200, + &pci_ss_info_10de_002c_1043_0201, + &pci_ss_info_10de_002c_1092_6820, + &pci_ss_info_10de_002c_1102_1031, + &pci_ss_info_10de_002c_1102_1034, + &pci_ss_info_10de_002c_14af_5008, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_002d[] = { + &pci_ss_info_10de_002d_1043_0200, + &pci_ss_info_10de_002d_1043_0201, + &pci_ss_info_10de_002d_1048_0c3a, + &pci_ss_info_10de_002d_10de_001e, + &pci_ss_info_10de_002d_1102_1023, + &pci_ss_info_10de_002d_1102_1024, + &pci_ss_info_10de_002d_1102_102c, + &pci_ss_info_10de_002d_1462_8808, + &pci_ss_info_10de_002d_1554_1041, + NULL +}; +#define pci_ss_list_10de_002e NULL +#define pci_ss_list_10de_002f NULL +static const pciSubsystemInfo *pci_ss_list_10de_0060[] = { + &pci_ss_info_10de_0060_1043_80ad, + NULL +}; +#define pci_ss_list_10de_0064 NULL +#define pci_ss_list_10de_0065 NULL +#define pci_ss_list_10de_0066 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0067[] = { + &pci_ss_info_10de_0067_1043_0c11, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0068[] = { + &pci_ss_info_10de_0068_1043_0c11, + NULL +}; +#define pci_ss_list_10de_006a NULL +#define pci_ss_list_10de_006b NULL +#define pci_ss_list_10de_006e NULL +static const pciSubsystemInfo *pci_ss_list_10de_00a0[] = { + &pci_ss_info_10de_00a0_14af_5810, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0100[] = { + &pci_ss_info_10de_0100_1043_0200, + &pci_ss_info_10de_0100_1043_0201, + &pci_ss_info_10de_0100_1043_4008, + &pci_ss_info_10de_0100_1043_4009, + &pci_ss_info_10de_0100_1102_102d, + &pci_ss_info_10de_0100_14af_5022, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0101[] = { + &pci_ss_info_10de_0101_1043_0202, + &pci_ss_info_10de_0101_1043_400a, + &pci_ss_info_10de_0101_1043_400b, + &pci_ss_info_10de_0101_1102_102e, + &pci_ss_info_10de_0101_14af_5021, + NULL +}; +#define pci_ss_list_10de_0103 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0110[] = { + &pci_ss_info_10de_0110_1043_4015, + &pci_ss_info_10de_0110_1043_4031, + &pci_ss_info_10de_0110_1462_8817, + &pci_ss_info_10de_0110_14af_7102, + &pci_ss_info_10de_0110_14af_7103, + NULL +}; +#define pci_ss_list_10de_0111 NULL +#define pci_ss_list_10de_0112 NULL +#define pci_ss_list_10de_0113 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0150[] = { + &pci_ss_info_10de_0150_1043_4016, + &pci_ss_info_10de_0150_107d_2840, + &pci_ss_info_10de_0150_1462_8831, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0151[] = { + &pci_ss_info_10de_0151_1043_405f, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10de_0152[] = { + &pci_ss_info_10de_0152_1048_0c56, + NULL +}; +#define pci_ss_list_10de_0153 NULL +#define pci_ss_list_10de_0170 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0171[] = { + &pci_ss_info_10de_0171_1462_8661, + &pci_ss_info_10de_0171_1462_8730, + &pci_ss_info_10de_0171_147b_8f00, + NULL +}; +#define pci_ss_list_10de_0172 NULL +#define pci_ss_list_10de_0173 NULL +#define pci_ss_list_10de_0174 NULL +#define pci_ss_list_10de_0175 NULL +#define pci_ss_list_10de_0176 NULL +#define pci_ss_list_10de_0178 NULL +#define pci_ss_list_10de_0179 NULL +#define pci_ss_list_10de_017a NULL +#define pci_ss_list_10de_017b NULL +#define pci_ss_list_10de_017c NULL +#define pci_ss_list_10de_0181 NULL +#define pci_ss_list_10de_0182 NULL +#define pci_ss_list_10de_0183 NULL +#define pci_ss_list_10de_0188 NULL +#define pci_ss_list_10de_018a NULL +#define pci_ss_list_10de_018b NULL +#define pci_ss_list_10de_01a0 NULL +#define pci_ss_list_10de_01a4 NULL +#define pci_ss_list_10de_01ab NULL +#define pci_ss_list_10de_01ac NULL +#define pci_ss_list_10de_01ad NULL +#define pci_ss_list_10de_01b1 NULL +#define pci_ss_list_10de_01b2 NULL +#define pci_ss_list_10de_01b4 NULL +#define pci_ss_list_10de_01b7 NULL +#define pci_ss_list_10de_01b8 NULL +#define pci_ss_list_10de_01bc NULL +#define pci_ss_list_10de_01c1 NULL +#define pci_ss_list_10de_01c2 NULL +#define pci_ss_list_10de_01c3 NULL +#define pci_ss_list_10de_01e8 NULL +#define pci_ss_list_10de_01f0 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0200[] = { + &pci_ss_info_10de_0200_1043_402f, + NULL +}; +#define pci_ss_list_10de_0201 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0202[] = { + &pci_ss_info_10de_0202_1043_405b, + &pci_ss_info_10de_0202_1545_002f, + NULL +}; +#define pci_ss_list_10de_0203 NULL +#define pci_ss_list_10de_0250 NULL +#define pci_ss_list_10de_0251 NULL +#define pci_ss_list_10de_0252 NULL +static const pciSubsystemInfo *pci_ss_list_10de_0253[] = { + &pci_ss_info_10de_0253_107d_2896, + &pci_ss_info_10de_0253_147b_8f09, + NULL +}; +#define pci_ss_list_10de_0258 NULL +#define pci_ss_list_10de_0259 NULL +#define pci_ss_list_10de_025b NULL +#define pci_ss_list_10de_0280 NULL +#define pci_ss_list_10de_0281 NULL +#define pci_ss_list_10de_0282 NULL +#define pci_ss_list_10de_0288 NULL +#define pci_ss_list_10de_0289 NULL +#define pci_ss_list_10de_0300 NULL +#define pci_ss_list_10de_0301 NULL +#define pci_ss_list_10de_0302 NULL +#define pci_ss_list_10de_0308 NULL +#define pci_ss_list_10de_0309 NULL +#define pci_ss_list_10df_1ae5 NULL +#define pci_ss_list_10df_f085 NULL +#define pci_ss_list_10df_f095 NULL +#define pci_ss_list_10df_f098 NULL +#define pci_ss_list_10df_f700 NULL +#define pci_ss_list_10df_f800 NULL +#define pci_ss_list_10df_f900 NULL +#define pci_ss_list_10df_f980 NULL +#define pci_ss_list_10e0_5026 NULL +#define pci_ss_list_10e0_5027 NULL +#define pci_ss_list_10e0_5028 NULL +#define pci_ss_list_10e0_8849 NULL +#define pci_ss_list_10e0_8853 NULL +#define pci_ss_list_10e0_9128 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10e1_0391[] = { + &pci_ss_info_10e1_0391_10e1_0391, + NULL +}; +#define pci_ss_list_10e1_690c NULL +#define pci_ss_list_10e1_dc29 NULL +#endif +#define pci_ss_list_10e3_0000 NULL +#define pci_ss_list_10e3_0860 NULL +#define pci_ss_list_10e3_0862 NULL +#define pci_ss_list_10e8_2011 NULL +#define pci_ss_list_10e8_4750 NULL +#define pci_ss_list_10e8_5920 NULL +#define pci_ss_list_10e8_8043 NULL +#define pci_ss_list_10e8_8062 NULL +#define pci_ss_list_10e8_807d NULL +#define pci_ss_list_10e8_8088 NULL +#define pci_ss_list_10e8_8089 NULL +#define pci_ss_list_10e8_809c NULL +#define pci_ss_list_10e8_80d7 NULL +#define pci_ss_list_10e8_80d9 NULL +#define pci_ss_list_10e8_80da NULL +#define pci_ss_list_10e8_811a NULL +#define pci_ss_list_10e8_8170 NULL +#define pci_ss_list_10e8_82db NULL +#define pci_ss_list_10ea_1680 NULL +#define pci_ss_list_10ea_1682 NULL +#define pci_ss_list_10ea_1683 NULL +#define pci_ss_list_10ea_2000 NULL +#define pci_ss_list_10ea_2010 NULL +#define pci_ss_list_10ea_5000 NULL +#define pci_ss_list_10ea_5050 NULL +#define pci_ss_list_10ea_5202 NULL +#define pci_ss_list_10eb_0101 NULL +#define pci_ss_list_10eb_8111 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10ec_8029[] = { + &pci_ss_info_10ec_8029_10b8_2011, + &pci_ss_info_10ec_8029_10ec_8029, + &pci_ss_info_10ec_8029_1113_1208, + &pci_ss_info_10ec_8029_1186_0300, + &pci_ss_info_10ec_8029_1259_2400, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10ec_8129[] = { + &pci_ss_info_10ec_8129_10ec_8129, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10ec_8138[] = { + &pci_ss_info_10ec_8138_10ec_8138, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10ec_8139[] = { + &pci_ss_info_10ec_8139_1025_8920, + &pci_ss_info_10ec_8139_1025_8921, + &pci_ss_info_10ec_8139_10bd_0320, + &pci_ss_info_10ec_8139_10ec_8139, + &pci_ss_info_10ec_8139_1186_1300, + &pci_ss_info_10ec_8139_1186_1320, + &pci_ss_info_10ec_8139_1186_8139, + &pci_ss_info_10ec_8139_11f6_8139, + &pci_ss_info_10ec_8139_1259_2500, + &pci_ss_info_10ec_8139_1259_2503, + &pci_ss_info_10ec_8139_1429_d010, + &pci_ss_info_10ec_8139_1432_9130, + &pci_ss_info_10ec_8139_1436_8139, + &pci_ss_info_10ec_8139_146c_1439, + &pci_ss_info_10ec_8139_1489_6001, + &pci_ss_info_10ec_8139_1489_6002, + &pci_ss_info_10ec_8139_149c_139a, + &pci_ss_info_10ec_8139_149c_8139, + &pci_ss_info_10ec_8139_2646_0001, + &pci_ss_info_10ec_8139_8e2e_7000, + &pci_ss_info_10ec_8139_8e2e_7100, + &pci_ss_info_10ec_8139_a0a0_0007, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_10ec_8169[] = { + &pci_ss_info_10ec_8169_1371_434e, + NULL +}; +#define pci_ss_list_10ec_8197 NULL +#endif +#define pci_ss_list_10ed_7310 NULL +#define pci_ss_list_10ee_3fc0 NULL +#define pci_ss_list_10ee_3fc1 NULL +#define pci_ss_list_10ee_3fc2 NULL +#define pci_ss_list_10ee_3fc3 NULL +#define pci_ss_list_10ee_3fc4 NULL +#define pci_ss_list_10ee_3fc5 NULL +#define pci_ss_list_10ef_8154 NULL +#define pci_ss_list_10f5_a001 NULL +#define pci_ss_list_10fa_000c NULL +#define pci_ss_list_10fb_186f NULL +#define pci_ss_list_10fc_0003 NULL +#define pci_ss_list_10fc_0005 NULL +#define pci_ss_list_1101_1060 NULL +#define pci_ss_list_1101_9100 NULL +#define pci_ss_list_1101_9400 NULL +#define pci_ss_list_1101_9401 NULL +#define pci_ss_list_1101_9500 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1102_0002[] = { + &pci_ss_info_1102_0002_1102_0020, + &pci_ss_info_1102_0002_1102_0021, + &pci_ss_info_1102_0002_1102_002f, + &pci_ss_info_1102_0002_1102_4001, + &pci_ss_info_1102_0002_1102_8022, + &pci_ss_info_1102_0002_1102_8023, + &pci_ss_info_1102_0002_1102_8024, + &pci_ss_info_1102_0002_1102_8025, + &pci_ss_info_1102_0002_1102_8026, + &pci_ss_info_1102_0002_1102_8027, + &pci_ss_info_1102_0002_1102_8028, + &pci_ss_info_1102_0002_1102_8031, + &pci_ss_info_1102_0002_1102_8040, + &pci_ss_info_1102_0002_1102_8051, + &pci_ss_info_1102_0002_1102_8061, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1102_0004[] = { + &pci_ss_info_1102_0004_1102_0051, + &pci_ss_info_1102_0004_1102_0053, + NULL +}; +#define pci_ss_list_1102_0006 NULL +static const pciSubsystemInfo *pci_ss_list_1102_4001[] = { + &pci_ss_info_1102_4001_1102_0010, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1102_7002[] = { + &pci_ss_info_1102_7002_1102_0020, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1102_7003[] = { + &pci_ss_info_1102_7003_1102_0040, + NULL +}; +#define pci_ss_list_1102_7004 NULL +#define pci_ss_list_1102_8064 NULL +#define pci_ss_list_1102_8938 NULL +#endif +#define pci_ss_list_1103_0003 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1103_0004[] = { + &pci_ss_info_1103_0004_1103_0001, + &pci_ss_info_1103_0004_1103_0005, + NULL +}; +#define pci_ss_list_1103_0005 NULL +#define pci_ss_list_1103_0006 NULL +#define pci_ss_list_1103_0007 NULL +#define pci_ss_list_1103_0008 NULL +#endif +#define pci_ss_list_1105_1105 NULL +#define pci_ss_list_1105_8300 NULL +#define pci_ss_list_1105_8400 NULL +#define pci_ss_list_1106_0102 NULL +#define pci_ss_list_1106_0130 NULL +static const pciSubsystemInfo *pci_ss_list_1106_0305[] = { + &pci_ss_info_1106_0305_1043_8033, + &pci_ss_info_1106_0305_1043_803e, + &pci_ss_info_1106_0305_1043_8042, + &pci_ss_info_1106_0305_147b_a401, + NULL +}; +#define pci_ss_list_1106_0391 NULL +#define pci_ss_list_1106_0501 NULL +#define pci_ss_list_1106_0505 NULL +#define pci_ss_list_1106_0561 NULL +static const pciSubsystemInfo *pci_ss_list_1106_0571[] = { + &pci_ss_info_1106_0571_1043_8052, + &pci_ss_info_1106_0571_1106_0571, + &pci_ss_info_1106_0571_1179_0001, + &pci_ss_info_1106_0571_1458_5002, + NULL +}; +#define pci_ss_list_1106_0576 NULL +#define pci_ss_list_1106_0585 NULL +static const pciSubsystemInfo *pci_ss_list_1106_0586[] = { + &pci_ss_info_1106_0586_1106_0000, + NULL +}; +#define pci_ss_list_1106_0595 NULL +static const pciSubsystemInfo *pci_ss_list_1106_0596[] = { + &pci_ss_info_1106_0596_1106_0000, + &pci_ss_info_1106_0596_1458_0596, + NULL +}; +#define pci_ss_list_1106_0597 NULL +#define pci_ss_list_1106_0598 NULL +#define pci_ss_list_1106_0601 NULL +#define pci_ss_list_1106_0605 NULL +#define pci_ss_list_1106_0680 NULL +static const pciSubsystemInfo *pci_ss_list_1106_0686[] = { + &pci_ss_info_1106_0686_1043_8033, + &pci_ss_info_1106_0686_1043_803e, + &pci_ss_info_1106_0686_1043_8040, + &pci_ss_info_1106_0686_1043_8042, + &pci_ss_info_1106_0686_1106_0000, + &pci_ss_info_1106_0686_1106_0686, + &pci_ss_info_1106_0686_1179_0001, + &pci_ss_info_1106_0686_147b_a702, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1106_0691[] = { + &pci_ss_info_1106_0691_1179_0001, + &pci_ss_info_1106_0691_1458_0691, + NULL +}; +#define pci_ss_list_1106_0693 NULL +#define pci_ss_list_1106_0698 NULL +#define pci_ss_list_1106_0926 NULL +#define pci_ss_list_1106_1000 NULL +#define pci_ss_list_1106_1106 NULL +#define pci_ss_list_1106_1571 NULL +#define pci_ss_list_1106_1595 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3038[] = { + &pci_ss_info_1106_3038_0925_1234, + &pci_ss_info_1106_3038_1179_0001, + NULL +}; +#define pci_ss_list_1106_3040 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3043[] = { + &pci_ss_info_1106_3043_10bd_0000, + &pci_ss_info_1106_3043_1106_0100, + &pci_ss_info_1106_3043_1186_1400, + NULL +}; +#define pci_ss_list_1106_3044 NULL +#define pci_ss_list_1106_3050 NULL +#define pci_ss_list_1106_3051 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3057[] = { + &pci_ss_info_1106_3057_1043_8033, + &pci_ss_info_1106_3057_1043_803e, + &pci_ss_info_1106_3057_1043_8040, + &pci_ss_info_1106_3057_1043_8042, + &pci_ss_info_1106_3057_1179_0001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1106_3058[] = { + &pci_ss_info_1106_3058_0e11_b194, + &pci_ss_info_1106_3058_1106_4511, + &pci_ss_info_1106_3058_1458_7600, + &pci_ss_info_1106_3058_1462_3091, + &pci_ss_info_1106_3058_15dd_7609, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1106_3059[] = { + &pci_ss_info_1106_3059_1458_a002, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1106_3065[] = { + &pci_ss_info_1106_3065_1106_0102, + &pci_ss_info_1106_3065_1186_1400, + &pci_ss_info_1106_3065_1186_1401, + NULL +}; +#define pci_ss_list_1106_3068 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3074[] = { + &pci_ss_info_1106_3074_1043_8052, + NULL +}; +#define pci_ss_list_1106_3091 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3099[] = { + &pci_ss_info_1106_3099_1043_8064, + &pci_ss_info_1106_3099_1043_807f, + NULL +}; +#define pci_ss_list_1106_3101 NULL +#define pci_ss_list_1106_3102 NULL +#define pci_ss_list_1106_3103 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3104[] = { + &pci_ss_info_1106_3104_1458_5004, + NULL +}; +#define pci_ss_list_1106_3106 NULL +#define pci_ss_list_1106_3109 NULL +#define pci_ss_list_1106_3112 NULL +#define pci_ss_list_1106_3116 NULL +#define pci_ss_list_1106_3122 NULL +#define pci_ss_list_1106_3123 NULL +#define pci_ss_list_1106_3128 NULL +#define pci_ss_list_1106_3133 NULL +#define pci_ss_list_1106_3147 NULL +#define pci_ss_list_1106_3148 NULL +#define pci_ss_list_1106_3156 NULL +#define pci_ss_list_1106_3168 NULL +static const pciSubsystemInfo *pci_ss_list_1106_3177[] = { + &pci_ss_info_1106_3177_1458_5001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1106_3189[] = { + &pci_ss_info_1106_3189_1458_5000, + NULL +}; +#define pci_ss_list_1106_5030 NULL +#define pci_ss_list_1106_6100 NULL +#define pci_ss_list_1106_8231 NULL +#define pci_ss_list_1106_8235 NULL +#define pci_ss_list_1106_8305 NULL +#define pci_ss_list_1106_8391 NULL +#define pci_ss_list_1106_8501 NULL +#define pci_ss_list_1106_8596 NULL +#define pci_ss_list_1106_8597 NULL +#define pci_ss_list_1106_8598 NULL +#define pci_ss_list_1106_8601 NULL +#define pci_ss_list_1106_8605 NULL +#define pci_ss_list_1106_8691 NULL +#define pci_ss_list_1106_8693 NULL +#define pci_ss_list_1106_b091 NULL +#define pci_ss_list_1106_b099 NULL +#define pci_ss_list_1106_b101 NULL +#define pci_ss_list_1106_b102 NULL +#define pci_ss_list_1106_b103 NULL +#define pci_ss_list_1106_b112 NULL +#define pci_ss_list_1106_b168 NULL +#define pci_ss_list_1107_0576 NULL +#define pci_ss_list_1108_0100 NULL +#define pci_ss_list_1108_0101 NULL +#define pci_ss_list_1108_0105 NULL +#define pci_ss_list_1108_0108 NULL +#define pci_ss_list_1108_0138 NULL +#define pci_ss_list_1108_0139 NULL +#define pci_ss_list_1108_013c NULL +#define pci_ss_list_1108_013d NULL +#define pci_ss_list_1109_1400 NULL +#define pci_ss_list_110a_0002 NULL +#define pci_ss_list_110a_0005 NULL +#define pci_ss_list_110a_2102 NULL +#define pci_ss_list_110a_4942 NULL +#define pci_ss_list_110a_6120 NULL +#define pci_ss_list_110b_0001 NULL +#define pci_ss_list_110b_0004 NULL +#define pci_ss_list_1110_6037 NULL +#define pci_ss_list_1110_6073 NULL +#define pci_ss_list_1112_2200 NULL +#define pci_ss_list_1112_2300 NULL +#define pci_ss_list_1112_2340 NULL +#define pci_ss_list_1112_2400 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1113_1211[] = { + &pci_ss_info_1113_1211_103c_1207, + &pci_ss_info_1113_1211_1113_1211, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1113_1216[] = { + &pci_ss_info_1113_1216_111a_1020, + NULL +}; +#define pci_ss_list_1113_1217 NULL +#define pci_ss_list_1113_5105 NULL +static const pciSubsystemInfo *pci_ss_list_1113_9211[] = { + &pci_ss_info_1113_9211_1113_9211, + NULL +}; +#define pci_ss_list_1113_9511 NULL +#endif +#define pci_ss_list_1116_0022 NULL +#define pci_ss_list_1116_0023 NULL +#define pci_ss_list_1116_0024 NULL +#define pci_ss_list_1116_0025 NULL +#define pci_ss_list_1116_0026 NULL +#define pci_ss_list_1116_0027 NULL +#define pci_ss_list_1116_0028 NULL +#define pci_ss_list_1117_9500 NULL +#define pci_ss_list_1117_9501 NULL +#define pci_ss_list_1119_0000 NULL +#define pci_ss_list_1119_0001 NULL +#define pci_ss_list_1119_0002 NULL +#define pci_ss_list_1119_0003 NULL +#define pci_ss_list_1119_0004 NULL +#define pci_ss_list_1119_0005 NULL +#define pci_ss_list_1119_0006 NULL +#define pci_ss_list_1119_0007 NULL +#define pci_ss_list_1119_0008 NULL +#define pci_ss_list_1119_0009 NULL +#define pci_ss_list_1119_000a NULL +#define pci_ss_list_1119_000b NULL +#define pci_ss_list_1119_000c NULL +#define pci_ss_list_1119_000d NULL +#define pci_ss_list_1119_0100 NULL +#define pci_ss_list_1119_0101 NULL +#define pci_ss_list_1119_0102 NULL +#define pci_ss_list_1119_0103 NULL +#define pci_ss_list_1119_0104 NULL +#define pci_ss_list_1119_0105 NULL +#define pci_ss_list_1119_0110 NULL +#define pci_ss_list_1119_0111 NULL +#define pci_ss_list_1119_0112 NULL +#define pci_ss_list_1119_0113 NULL +#define pci_ss_list_1119_0114 NULL +#define pci_ss_list_1119_0115 NULL +#define pci_ss_list_1119_0118 NULL +#define pci_ss_list_1119_0119 NULL +#define pci_ss_list_1119_011a NULL +#define pci_ss_list_1119_011b NULL +#define pci_ss_list_1119_0120 NULL +#define pci_ss_list_1119_0121 NULL +#define pci_ss_list_1119_0122 NULL +#define pci_ss_list_1119_0123 NULL +#define pci_ss_list_1119_0124 NULL +#define pci_ss_list_1119_0125 NULL +#define pci_ss_list_1119_0136 NULL +#define pci_ss_list_1119_0137 NULL +#define pci_ss_list_1119_0138 NULL +#define pci_ss_list_1119_0139 NULL +#define pci_ss_list_1119_013a NULL +#define pci_ss_list_1119_013b NULL +#define pci_ss_list_1119_013c NULL +#define pci_ss_list_1119_013d NULL +#define pci_ss_list_1119_013e NULL +#define pci_ss_list_1119_013f NULL +#define pci_ss_list_1119_0166 NULL +#define pci_ss_list_1119_0167 NULL +#define pci_ss_list_1119_0168 NULL +#define pci_ss_list_1119_0169 NULL +#define pci_ss_list_1119_016a NULL +#define pci_ss_list_1119_016b NULL +#define pci_ss_list_1119_016c NULL +#define pci_ss_list_1119_016d NULL +#define pci_ss_list_1119_016e NULL +#define pci_ss_list_1119_016f NULL +#define pci_ss_list_1119_01d6 NULL +#define pci_ss_list_1119_01d7 NULL +#define pci_ss_list_1119_01f6 NULL +#define pci_ss_list_1119_01f7 NULL +#define pci_ss_list_1119_01fc NULL +#define pci_ss_list_1119_01fd NULL +#define pci_ss_list_1119_01fe NULL +#define pci_ss_list_1119_01ff NULL +#define pci_ss_list_1119_0210 NULL +#define pci_ss_list_1119_0211 NULL +#define pci_ss_list_1119_0260 NULL +#define pci_ss_list_1119_0261 NULL +#define pci_ss_list_1119_0300 NULL +#define pci_ss_list_111a_0000 NULL +#define pci_ss_list_111a_0002 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_111a_0003[] = { + &pci_ss_info_111a_0003_111a_0000, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_111a_0005[] = { + &pci_ss_info_111a_0005_111a_0001, + &pci_ss_info_111a_0005_111a_0009, + &pci_ss_info_111a_0005_111a_0101, + &pci_ss_info_111a_0005_111a_0109, + &pci_ss_info_111a_0005_111a_0809, + &pci_ss_info_111a_0005_111a_0909, + &pci_ss_info_111a_0005_111a_0a09, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_111a_0007[] = { + &pci_ss_info_111a_0007_111a_1001, + NULL +}; +#endif +#define pci_ss_list_111c_0001 NULL +#define pci_ss_list_111d_0001 NULL +#define pci_ss_list_111d_0003 NULL +#define pci_ss_list_111f_4a47 NULL +#define pci_ss_list_111f_5243 NULL +#define pci_ss_list_1127_0200 NULL +#define pci_ss_list_1127_0210 NULL +#define pci_ss_list_1127_0250 NULL +#define pci_ss_list_1127_0300 NULL +#define pci_ss_list_1127_0310 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1127_0400[] = { + &pci_ss_info_1127_0400_1127_0400, + NULL +}; +#endif +#define pci_ss_list_112f_0000 NULL +#define pci_ss_list_112f_0001 NULL +#define pci_ss_list_1131_1561 NULL +#define pci_ss_list_1131_1562 NULL +#define pci_ss_list_1131_3400 NULL +#define pci_ss_list_1131_7130 NULL +#define pci_ss_list_1131_7133 NULL +#define pci_ss_list_1131_7134 NULL +#define pci_ss_list_1131_7135 NULL +#define pci_ss_list_1131_7145 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1131_7146[] = { + &pci_ss_info_1131_7146_114b_2003, + &pci_ss_info_1131_7146_11bd_0006, + &pci_ss_info_1131_7146_11bd_000a, + NULL +}; +#endif +#define pci_ss_list_1133_7901 NULL +#define pci_ss_list_1133_7902 NULL +#define pci_ss_list_1133_7911 NULL +#define pci_ss_list_1133_7912 NULL +#define pci_ss_list_1133_7941 NULL +#define pci_ss_list_1133_7942 NULL +#define pci_ss_list_1133_7943 NULL +#define pci_ss_list_1133_7944 NULL +#define pci_ss_list_1133_b921 NULL +#define pci_ss_list_1133_b922 NULL +#define pci_ss_list_1133_b923 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1133_e001[] = { + &pci_ss_info_1133_e001_1133_e001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1133_e002[] = { + &pci_ss_info_1133_e002_1133_e002, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1133_e003[] = { + &pci_ss_info_1133_e003_1133_e003, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1133_e004[] = { + &pci_ss_info_1133_e004_1133_e004, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1133_e005[] = { + &pci_ss_info_1133_e005_1133_e005, + NULL +}; +#define pci_ss_list_1133_e00b NULL +static const pciSubsystemInfo *pci_ss_list_1133_e010[] = { + &pci_ss_info_1133_e010_1133_e010, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1133_e012[] = { + &pci_ss_info_1133_e012_1133_e012, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1133_e014[] = { + &pci_ss_info_1133_e014_1133_e014, + NULL +}; +#define pci_ss_list_1133_e018 NULL +#endif +#define pci_ss_list_1134_0001 NULL +#define pci_ss_list_1135_0001 NULL +#define pci_ss_list_1138_8905 NULL +#define pci_ss_list_1139_0001 NULL +#define pci_ss_list_113c_0000 NULL +#define pci_ss_list_113c_0001 NULL +#define pci_ss_list_113c_0911 NULL +#define pci_ss_list_113c_0912 NULL +#define pci_ss_list_113c_0913 NULL +#define pci_ss_list_113c_0914 NULL +#define pci_ss_list_113f_0808 NULL +#define pci_ss_list_113f_1010 NULL +#define pci_ss_list_113f_80c0 NULL +#define pci_ss_list_113f_80c4 NULL +#define pci_ss_list_113f_80c8 NULL +#define pci_ss_list_113f_8888 NULL +#define pci_ss_list_113f_9090 NULL +#define pci_ss_list_1142_3210 NULL +#define pci_ss_list_1142_6422 NULL +#define pci_ss_list_1142_6424 NULL +#define pci_ss_list_1142_6425 NULL +#define pci_ss_list_1142_643d NULL +#define pci_ss_list_1144_0001 NULL +#define pci_ss_list_1145_8007 NULL +#define pci_ss_list_1145_f007 NULL +#define pci_ss_list_1145_f010 NULL +#define pci_ss_list_1145_f012 NULL +#define pci_ss_list_1145_f013 NULL +#define pci_ss_list_1145_f015 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1148_4000[] = { + &pci_ss_info_1148_4000_0e11_b03b, + &pci_ss_info_1148_4000_0e11_b03c, + &pci_ss_info_1148_4000_0e11_b03d, + &pci_ss_info_1148_4000_0e11_b03e, + &pci_ss_info_1148_4000_0e11_b03f, + &pci_ss_info_1148_4000_1148_5521, + &pci_ss_info_1148_4000_1148_5522, + &pci_ss_info_1148_4000_1148_5541, + &pci_ss_info_1148_4000_1148_5543, + &pci_ss_info_1148_4000_1148_5544, + &pci_ss_info_1148_4000_1148_5821, + &pci_ss_info_1148_4000_1148_5822, + &pci_ss_info_1148_4000_1148_5841, + &pci_ss_info_1148_4000_1148_5843, + &pci_ss_info_1148_4000_1148_5844, + NULL +}; +#define pci_ss_list_1148_4200 NULL +static const pciSubsystemInfo *pci_ss_list_1148_4300[] = { + &pci_ss_info_1148_4300_1148_9821, + &pci_ss_info_1148_4300_1148_9822, + &pci_ss_info_1148_4300_1148_9841, + &pci_ss_info_1148_4300_1148_9842, + &pci_ss_info_1148_4300_1148_9843, + &pci_ss_info_1148_4300_1148_9844, + &pci_ss_info_1148_4300_1148_9861, + &pci_ss_info_1148_4300_1148_9862, + &pci_ss_info_1148_4300_1148_9871, + &pci_ss_info_1148_4300_1148_9872, + &pci_ss_info_1148_4300_1259_2970, + &pci_ss_info_1148_4300_1259_2972, + &pci_ss_info_1148_4300_1259_2975, + &pci_ss_info_1148_4300_1259_2977, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1148_4320[] = { + &pci_ss_info_1148_4320_1148_5021, + &pci_ss_info_1148_4320_1148_5041, + &pci_ss_info_1148_4320_1148_5043, + &pci_ss_info_1148_4320_1148_5051, + &pci_ss_info_1148_4320_1148_5061, + &pci_ss_info_1148_4320_1148_5071, + &pci_ss_info_1148_4320_1148_9521, + NULL +}; +#define pci_ss_list_1148_4400 NULL +#endif +#define pci_ss_list_114a_5579 NULL +#define pci_ss_list_114a_5587 NULL +#define pci_ss_list_114a_6504 NULL +#define pci_ss_list_114a_7587 NULL +#define pci_ss_list_114f_0002 NULL +#define pci_ss_list_114f_0003 NULL +#define pci_ss_list_114f_0004 NULL +#define pci_ss_list_114f_0005 NULL +#define pci_ss_list_114f_0006 NULL +#define pci_ss_list_114f_0009 NULL +#define pci_ss_list_114f_000a NULL +#define pci_ss_list_114f_000c NULL +#define pci_ss_list_114f_000d NULL +#define pci_ss_list_114f_0011 NULL +#define pci_ss_list_114f_0012 NULL +#define pci_ss_list_114f_0013 NULL +#define pci_ss_list_114f_0014 NULL +#define pci_ss_list_114f_0015 NULL +#define pci_ss_list_114f_0016 NULL +#define pci_ss_list_114f_0017 NULL +#define pci_ss_list_114f_001a NULL +#define pci_ss_list_114f_001b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_114f_001d[] = { + &pci_ss_info_114f_001d_114f_0050, + &pci_ss_info_114f_001d_114f_0051, + &pci_ss_info_114f_001d_114f_0052, + &pci_ss_info_114f_001d_114f_0053, + NULL +}; +#define pci_ss_list_114f_0023 NULL +static const pciSubsystemInfo *pci_ss_list_114f_0024[] = { + &pci_ss_info_114f_0024_114f_0030, + &pci_ss_info_114f_0024_114f_0031, + NULL +}; +#define pci_ss_list_114f_0026 NULL +#define pci_ss_list_114f_0027 NULL +#define pci_ss_list_114f_0034 NULL +#define pci_ss_list_114f_0035 NULL +#define pci_ss_list_114f_0040 NULL +#define pci_ss_list_114f_0042 NULL +#define pci_ss_list_114f_0070 NULL +#define pci_ss_list_114f_0071 NULL +#define pci_ss_list_114f_0072 NULL +#define pci_ss_list_114f_0073 NULL +#define pci_ss_list_114f_6001 NULL +#endif +#define pci_ss_list_1158_3011 NULL +#define pci_ss_list_1158_9050 NULL +#define pci_ss_list_1158_9051 NULL +#define pci_ss_list_1159_0001 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_115d_0003[] = { + &pci_ss_info_115d_0003_1014_0181, + &pci_ss_info_115d_0003_1014_1181, + &pci_ss_info_115d_0003_1014_8181, + &pci_ss_info_115d_0003_1014_9181, + &pci_ss_info_115d_0003_115d_0181, + &pci_ss_info_115d_0003_115d_1181, + &pci_ss_info_115d_0003_1179_0181, + &pci_ss_info_115d_0003_8086_8181, + &pci_ss_info_115d_0003_8086_9181, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_115d_0005[] = { + &pci_ss_info_115d_0005_1014_0182, + &pci_ss_info_115d_0005_1014_1182, + &pci_ss_info_115d_0005_115d_0182, + &pci_ss_info_115d_0005_115d_1182, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_115d_0007[] = { + &pci_ss_info_115d_0007_1014_0182, + &pci_ss_info_115d_0007_1014_1182, + &pci_ss_info_115d_0007_115d_0182, + &pci_ss_info_115d_0007_115d_1182, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_115d_000b[] = { + &pci_ss_info_115d_000b_1014_0183, + &pci_ss_info_115d_000b_115d_0183, + NULL +}; +#define pci_ss_list_115d_000c NULL +static const pciSubsystemInfo *pci_ss_list_115d_000f[] = { + &pci_ss_info_115d_000f_1014_0183, + &pci_ss_info_115d_000f_115d_0183, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_115d_0101[] = { + &pci_ss_info_115d_0101_115d_1081, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_115d_0103[] = { + &pci_ss_info_115d_0103_1014_9181, + &pci_ss_info_115d_0103_1115_1181, + &pci_ss_info_115d_0103_115d_1181, + &pci_ss_info_115d_0103_8086_9181, + NULL +}; +#endif +#define pci_ss_list_1163_0001 NULL +static const pciSubsystemInfo *pci_ss_list_1163_2000[] = { + &pci_ss_info_1163_2000_1092_2000, + NULL +}; +#define pci_ss_list_1165_0001 NULL +#define pci_ss_list_1166_0005 NULL +#define pci_ss_list_1166_0007 NULL +#define pci_ss_list_1166_0008 NULL +#define pci_ss_list_1166_0009 NULL +#define pci_ss_list_1166_0010 NULL +#define pci_ss_list_1166_0011 NULL +#define pci_ss_list_1166_0012 NULL +#define pci_ss_list_1166_0013 NULL +#define pci_ss_list_1166_0014 NULL +#define pci_ss_list_1166_0015 NULL +#define pci_ss_list_1166_0016 NULL +#define pci_ss_list_1166_0017 NULL +#define pci_ss_list_1166_0200 NULL +#define pci_ss_list_1166_0201 NULL +#define pci_ss_list_1166_0203 NULL +#define pci_ss_list_1166_0211 NULL +#define pci_ss_list_1166_0212 NULL +#define pci_ss_list_1166_0213 NULL +#define pci_ss_list_1166_0220 NULL +#define pci_ss_list_1166_0221 NULL +#define pci_ss_list_1166_0225 NULL +#define pci_ss_list_1166_0227 NULL +#define pci_ss_list_116a_6100 NULL +#define pci_ss_list_116a_6800 NULL +#define pci_ss_list_116a_7100 NULL +#define pci_ss_list_116a_7800 NULL +#define pci_ss_list_1178_afa1 NULL +#define pci_ss_list_1179_0103 NULL +#define pci_ss_list_1179_0404 NULL +#define pci_ss_list_1179_0406 NULL +#define pci_ss_list_1179_0407 NULL +#define pci_ss_list_1179_0601 NULL +#define pci_ss_list_1179_0603 NULL +#define pci_ss_list_1179_060a NULL +#define pci_ss_list_1179_060f NULL +#define pci_ss_list_1179_0617 NULL +#define pci_ss_list_1179_0618 NULL +#define pci_ss_list_1179_0701 NULL +#define pci_ss_list_1179_0804 NULL +#define pci_ss_list_1179_0805 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1179_0d01[] = { + &pci_ss_info_1179_0d01_1179_0001, + NULL +}; +#endif +#define pci_ss_list_1180_0465 NULL +#define pci_ss_list_1180_0466 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1180_0475[] = { + &pci_ss_info_1180_0475_144d_c006, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1180_0476[] = { + &pci_ss_info_1180_0476_1014_0185, + &pci_ss_info_1180_0476_104d_80df, + &pci_ss_info_1180_0476_104d_80e7, + NULL +}; +#define pci_ss_list_1180_0477 NULL +static const pciSubsystemInfo *pci_ss_list_1180_0478[] = { + &pci_ss_info_1180_0478_1014_0184, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1180_0522[] = { + &pci_ss_info_1180_0522_1014_01cf, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1180_0551[] = { + &pci_ss_info_1180_0551_144d_c006, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1180_0552[] = { + &pci_ss_info_1180_0552_1014_0511, + NULL +}; +#endif +#define pci_ss_list_1186_0100 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1186_1002[] = { + &pci_ss_info_1186_1002_1186_1002, + &pci_ss_info_1186_1002_1186_1012, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1186_1300[] = { + &pci_ss_info_1186_1300_1186_1300, + &pci_ss_info_1186_1300_1186_1301, + NULL +}; +#define pci_ss_list_1186_1340 NULL +#define pci_ss_list_1186_1561 NULL +#define pci_ss_list_1186_4000 NULL +#endif +#define pci_ss_list_118c_0014 NULL +#define pci_ss_list_118c_1117 NULL +#define pci_ss_list_118d_0001 NULL +#define pci_ss_list_118d_0012 NULL +#define pci_ss_list_118d_0014 NULL +#define pci_ss_list_118d_0024 NULL +#define pci_ss_list_118d_0044 NULL +#define pci_ss_list_118d_0112 NULL +#define pci_ss_list_118d_0114 NULL +#define pci_ss_list_118d_0124 NULL +#define pci_ss_list_118d_0144 NULL +#define pci_ss_list_118d_0212 NULL +#define pci_ss_list_118d_0214 NULL +#define pci_ss_list_118d_0224 NULL +#define pci_ss_list_118d_0244 NULL +#define pci_ss_list_118d_0312 NULL +#define pci_ss_list_118d_0314 NULL +#define pci_ss_list_118d_0324 NULL +#define pci_ss_list_118d_0344 NULL +#define pci_ss_list_1190_c731 NULL +#define pci_ss_list_1191_0003 NULL +#define pci_ss_list_1191_0004 NULL +#define pci_ss_list_1191_0005 NULL +#define pci_ss_list_1191_0006 NULL +#define pci_ss_list_1191_0007 NULL +#define pci_ss_list_1191_0008 NULL +#define pci_ss_list_1191_0009 NULL +#define pci_ss_list_1191_8002 NULL +#define pci_ss_list_1191_8010 NULL +#define pci_ss_list_1191_8020 NULL +#define pci_ss_list_1191_8030 NULL +#define pci_ss_list_1191_8040 NULL +#define pci_ss_list_1191_8050 NULL +#define pci_ss_list_1193_0001 NULL +#define pci_ss_list_1193_0002 NULL +#define pci_ss_list_119b_1221 NULL +#define pci_ss_list_119e_0001 NULL +#define pci_ss_list_119e_0003 NULL +#define pci_ss_list_11a9_4240 NULL +#define pci_ss_list_11ab_0146 NULL +#define pci_ss_list_11ab_4611 NULL +#define pci_ss_list_11ab_4620 NULL +#define pci_ss_list_11ab_4801 NULL +#define pci_ss_list_11ab_f003 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11ad_0002[] = { + &pci_ss_info_11ad_0002_11ad_0002, + &pci_ss_info_11ad_0002_11ad_0003, + &pci_ss_info_11ad_0002_11ad_f003, + &pci_ss_info_11ad_0002_11ad_ffff, + &pci_ss_info_11ad_0002_1385_f004, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11ad_c115[] = { + &pci_ss_info_11ad_c115_11ad_c001, + NULL +}; +#endif +#define pci_ss_list_11b0_0002 NULL +#define pci_ss_list_11b0_0292 NULL +#define pci_ss_list_11b0_0960 NULL +#define pci_ss_list_11b0_c960 NULL +#define pci_ss_list_11b8_0001 NULL +#define pci_ss_list_11b9_c0ed NULL +#define pci_ss_list_11bc_0001 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11c1_0440[] = { + &pci_ss_info_11c1_0440_1033_8015, + &pci_ss_info_11c1_0440_1033_8047, + &pci_ss_info_11c1_0440_1033_804f, + &pci_ss_info_11c1_0440_10cf_102c, + &pci_ss_info_11c1_0440_10cf_104a, + &pci_ss_info_11c1_0440_10cf_105f, + &pci_ss_info_11c1_0440_1179_0001, + &pci_ss_info_11c1_0440_11c1_0440, + &pci_ss_info_11c1_0440_122d_4101, + &pci_ss_info_11c1_0440_122d_4102, + &pci_ss_info_11c1_0440_13e0_0040, + &pci_ss_info_11c1_0440_13e0_0440, + &pci_ss_info_11c1_0440_13e0_0441, + &pci_ss_info_11c1_0440_13e0_0450, + &pci_ss_info_11c1_0440_13e0_f100, + &pci_ss_info_11c1_0440_13e0_f101, + &pci_ss_info_11c1_0440_144d_2101, + &pci_ss_info_11c1_0440_149f_0440, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11c1_0441[] = { + &pci_ss_info_11c1_0441_1033_804d, + &pci_ss_info_11c1_0441_1033_8065, + &pci_ss_info_11c1_0441_1092_0440, + &pci_ss_info_11c1_0441_1179_0001, + &pci_ss_info_11c1_0441_11c1_0440, + &pci_ss_info_11c1_0441_11c1_0441, + &pci_ss_info_11c1_0441_122d_4100, + &pci_ss_info_11c1_0441_13e0_0040, + &pci_ss_info_11c1_0441_13e0_0100, + &pci_ss_info_11c1_0441_13e0_0410, + &pci_ss_info_11c1_0441_13e0_0420, + &pci_ss_info_11c1_0441_13e0_0440, + &pci_ss_info_11c1_0441_13e0_0443, + &pci_ss_info_11c1_0441_13e0_f102, + &pci_ss_info_11c1_0441_1416_9804, + &pci_ss_info_11c1_0441_141d_0440, + &pci_ss_info_11c1_0441_144f_0441, + &pci_ss_info_11c1_0441_144f_0449, + &pci_ss_info_11c1_0441_144f_110d, + &pci_ss_info_11c1_0441_1468_0441, + &pci_ss_info_11c1_0441_1668_0440, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11c1_0442[] = { + &pci_ss_info_11c1_0442_11c1_0440, + &pci_ss_info_11c1_0442_11c1_0442, + &pci_ss_info_11c1_0442_13e0_0412, + &pci_ss_info_11c1_0442_13e0_0442, + &pci_ss_info_11c1_0442_13fc_2471, + &pci_ss_info_11c1_0442_144d_2104, + &pci_ss_info_11c1_0442_144f_1104, + &pci_ss_info_11c1_0442_149f_0440, + &pci_ss_info_11c1_0442_1668_0440, + NULL +}; +#define pci_ss_list_11c1_0443 NULL +#define pci_ss_list_11c1_0444 NULL +#define pci_ss_list_11c1_0445 NULL +#define pci_ss_list_11c1_0446 NULL +#define pci_ss_list_11c1_0447 NULL +static const pciSubsystemInfo *pci_ss_list_11c1_0448[] = { + &pci_ss_info_11c1_0448_1014_0131, + &pci_ss_info_11c1_0448_1033_8066, + &pci_ss_info_11c1_0448_13e0_0030, + &pci_ss_info_11c1_0448_13e0_0040, + &pci_ss_info_11c1_0448_1668_2400, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11c1_0449[] = { + &pci_ss_info_11c1_0449_0e11_b14d, + &pci_ss_info_11c1_0449_13e0_0020, + &pci_ss_info_11c1_0449_13e0_0041, + &pci_ss_info_11c1_0449_1436_0440, + &pci_ss_info_11c1_0449_144f_0449, + &pci_ss_info_11c1_0449_1468_0410, + &pci_ss_info_11c1_0449_1468_0440, + &pci_ss_info_11c1_0449_1468_0449, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11c1_044a[] = { + &pci_ss_info_11c1_044a_10cf_1072, + &pci_ss_info_11c1_044a_13e0_0012, + &pci_ss_info_11c1_044a_13e0_0042, + &pci_ss_info_11c1_044a_144f_1005, + NULL +}; +#define pci_ss_list_11c1_044b NULL +#define pci_ss_list_11c1_044c NULL +#define pci_ss_list_11c1_044d NULL +#define pci_ss_list_11c1_044e NULL +#define pci_ss_list_11c1_044f NULL +static const pciSubsystemInfo *pci_ss_list_11c1_0450[] = { + &pci_ss_info_11c1_0450_144f_4005, + NULL +}; +#define pci_ss_list_11c1_0451 NULL +#define pci_ss_list_11c1_0452 NULL +#define pci_ss_list_11c1_0453 NULL +#define pci_ss_list_11c1_0454 NULL +#define pci_ss_list_11c1_0455 NULL +#define pci_ss_list_11c1_0456 NULL +#define pci_ss_list_11c1_0457 NULL +#define pci_ss_list_11c1_0458 NULL +#define pci_ss_list_11c1_0459 NULL +#define pci_ss_list_11c1_045a NULL +#define pci_ss_list_11c1_045c NULL +#define pci_ss_list_11c1_0461 NULL +#define pci_ss_list_11c1_0462 NULL +#define pci_ss_list_11c1_0480 NULL +#define pci_ss_list_11c1_5801 NULL +#define pci_ss_list_11c1_5802 NULL +#define pci_ss_list_11c1_5803 NULL +static const pciSubsystemInfo *pci_ss_list_11c1_5811[] = { + &pci_ss_info_11c1_5811_dead_0800, + NULL +}; +#endif +#define pci_ss_list_11c8_0658 NULL +#define pci_ss_list_11c8_d665 NULL +#define pci_ss_list_11c8_d667 NULL +#define pci_ss_list_11c9_0010 NULL +#define pci_ss_list_11c9_0011 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11cb_2000[] = { + &pci_ss_info_11cb_2000_11cb_0200, + &pci_ss_info_11cb_2000_11cb_b008, + NULL +}; +#define pci_ss_list_11cb_4000 NULL +#define pci_ss_list_11cb_8000 NULL +#endif +#define pci_ss_list_11d1_01f7 NULL +#define pci_ss_list_11d4_1805 NULL +#define pci_ss_list_11d4_1889 NULL +#define pci_ss_list_11d5_0115 NULL +#define pci_ss_list_11d5_0117 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11de_6057[] = { + &pci_ss_info_11de_6057_1031_7efe, + &pci_ss_info_11de_6057_1031_fc00, + &pci_ss_info_11de_6057_13ca_4231, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11de_6120[] = { + &pci_ss_info_11de_6120_1328_f001, + NULL +}; +#endif +#define pci_ss_list_11e3_5030 NULL +#define pci_ss_list_11f0_4231 NULL +#define pci_ss_list_11f0_4232 NULL +#define pci_ss_list_11f0_4233 NULL +#define pci_ss_list_11f0_4234 NULL +#define pci_ss_list_11f0_4235 NULL +#define pci_ss_list_11f0_4236 NULL +#define pci_ss_list_11f0_4731 NULL +#define pci_ss_list_11f4_2915 NULL +#define pci_ss_list_11f6_0112 NULL +#define pci_ss_list_11f6_0113 NULL +#define pci_ss_list_11f6_1401 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11f6_2011[] = { + &pci_ss_info_11f6_2011_11f6_2011, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_11f6_2201[] = { + &pci_ss_info_11f6_2201_11f6_2011, + NULL +}; +#define pci_ss_list_11f6_9881 NULL +#endif +#define pci_ss_list_11f8_7375 NULL +#define pci_ss_list_11fe_0001 NULL +#define pci_ss_list_11fe_0002 NULL +#define pci_ss_list_11fe_0003 NULL +#define pci_ss_list_11fe_0004 NULL +#define pci_ss_list_11fe_0005 NULL +#define pci_ss_list_11fe_0006 NULL +#define pci_ss_list_11fe_0007 NULL +#define pci_ss_list_11fe_0008 NULL +#define pci_ss_list_11fe_0009 NULL +#define pci_ss_list_11fe_000a NULL +#define pci_ss_list_11fe_000b NULL +#define pci_ss_list_11fe_000c NULL +#define pci_ss_list_11fe_8015 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1202_4300[] = { + &pci_ss_info_1202_4300_1202_9841, + &pci_ss_info_1202_4300_1202_9842, + &pci_ss_info_1202_4300_1202_9843, + &pci_ss_info_1202_4300_1202_9844, + NULL +}; +#endif +#define pci_ss_list_1208_4853 NULL +#define pci_ss_list_120e_0100 NULL +#define pci_ss_list_120e_0101 NULL +#define pci_ss_list_120e_0102 NULL +#define pci_ss_list_120e_0103 NULL +#define pci_ss_list_120e_0104 NULL +#define pci_ss_list_120e_0105 NULL +#define pci_ss_list_120e_0200 NULL +#define pci_ss_list_120e_0201 NULL +#define pci_ss_list_120e_0300 NULL +#define pci_ss_list_120e_0301 NULL +#define pci_ss_list_120e_0310 NULL +#define pci_ss_list_120e_0311 NULL +#define pci_ss_list_120e_0320 NULL +#define pci_ss_list_120e_0321 NULL +#define pci_ss_list_120e_0400 NULL +#define pci_ss_list_120f_0001 NULL +#define pci_ss_list_1217_6729 NULL +#define pci_ss_list_1217_673a NULL +#define pci_ss_list_1217_6832 NULL +#define pci_ss_list_1217_6836 NULL +#define pci_ss_list_1217_6872 NULL +#define pci_ss_list_1217_6925 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1217_6933[] = { + &pci_ss_info_1217_6933_1025_1016, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1217_6972[] = { + &pci_ss_info_1217_6972_1179_0001, + NULL +}; +#endif +#define pci_ss_list_121a_0001 NULL +#define pci_ss_list_121a_0002 NULL +static const pciSubsystemInfo *pci_ss_list_121a_0003[] = { + &pci_ss_info_121a_0003_1092_0003, + &pci_ss_info_121a_0003_1092_4000, + &pci_ss_info_121a_0003_1092_4002, + &pci_ss_info_121a_0003_1092_4801, + &pci_ss_info_121a_0003_1092_4803, + &pci_ss_info_121a_0003_1092_8030, + &pci_ss_info_121a_0003_1092_8035, + &pci_ss_info_121a_0003_10b0_0001, + &pci_ss_info_121a_0003_1102_1018, + &pci_ss_info_121a_0003_121a_0001, + &pci_ss_info_121a_0003_121a_0003, + &pci_ss_info_121a_0003_121a_0004, + &pci_ss_info_121a_0003_139c_0016, + &pci_ss_info_121a_0003_139c_0017, + &pci_ss_info_121a_0003_14af_0002, + NULL +}; +#define pci_ss_list_121a_0004 NULL +static const pciSubsystemInfo *pci_ss_list_121a_0005[] = { + &pci_ss_info_121a_0005_121a_0004, + &pci_ss_info_121a_0005_121a_0030, + &pci_ss_info_121a_0005_121a_0031, + &pci_ss_info_121a_0005_121a_0034, + &pci_ss_info_121a_0005_121a_0036, + &pci_ss_info_121a_0005_121a_0037, + &pci_ss_info_121a_0005_121a_0038, + &pci_ss_info_121a_0005_121a_003a, + &pci_ss_info_121a_0005_121a_0044, + &pci_ss_info_121a_0005_121a_004b, + &pci_ss_info_121a_0005_121a_004c, + &pci_ss_info_121a_0005_121a_004d, + &pci_ss_info_121a_0005_121a_004e, + &pci_ss_info_121a_0005_121a_0051, + &pci_ss_info_121a_0005_121a_0052, + &pci_ss_info_121a_0005_121a_0060, + &pci_ss_info_121a_0005_121a_0061, + &pci_ss_info_121a_0005_121a_0062, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_121a_0009[] = { + &pci_ss_info_121a_0009_121a_0009, + NULL +}; +#define pci_ss_list_121a_0057 NULL +#define pci_ss_list_1220_1220 NULL +#define pci_ss_list_1223_0003 NULL +#define pci_ss_list_1223_0004 NULL +#define pci_ss_list_1223_0005 NULL +#define pci_ss_list_1223_0008 NULL +#define pci_ss_list_1223_0009 NULL +#define pci_ss_list_1223_000a NULL +#define pci_ss_list_1223_000b NULL +#define pci_ss_list_1223_000c NULL +#define pci_ss_list_1223_000d NULL +#define pci_ss_list_1223_000e NULL +#define pci_ss_list_122d_1206 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_122d_50dc[] = { + &pci_ss_info_122d_50dc_122d_0001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_122d_80da[] = { + &pci_ss_info_122d_80da_122d_0001, + NULL +}; +#endif +#define pci_ss_list_1236_0000 NULL +#define pci_ss_list_1236_6401 NULL +#define pci_ss_list_123d_0000 NULL +#define pci_ss_list_123d_0002 NULL +#define pci_ss_list_123d_0003 NULL +#define pci_ss_list_123f_00e4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_123f_8120[] = { + &pci_ss_info_123f_8120_11bd_0006, + &pci_ss_info_123f_8120_11bd_000a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_123f_8888[] = { + &pci_ss_info_123f_8888_1002_0001, + &pci_ss_info_123f_8888_1002_0002, + &pci_ss_info_123f_8888_1328_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1242_1560[] = { + &pci_ss_info_1242_1560_1242_6562, + &pci_ss_info_1242_1560_1242_656a, + NULL +}; +#define pci_ss_list_1242_4643 NULL +#endif +#define pci_ss_list_1244_0700 NULL +#define pci_ss_list_1244_0800 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1244_0a00[] = { + &pci_ss_info_1244_0a00_1244_0a00, + NULL +}; +#define pci_ss_list_1244_0e00 NULL +#define pci_ss_list_1244_1100 NULL +#define pci_ss_list_1244_1200 NULL +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_124b_0040[] = { + &pci_ss_info_124b_0040_124b_9080, + NULL +}; +#endif +#define pci_ss_list_124d_0000 NULL +#define pci_ss_list_124d_0002 NULL +#define pci_ss_list_124d_0003 NULL +#define pci_ss_list_124d_0004 NULL +#define pci_ss_list_124f_0041 NULL +#define pci_ss_list_1255_1110 NULL +#define pci_ss_list_1255_1210 NULL +#define pci_ss_list_1255_2110 NULL +#define pci_ss_list_1255_2120 NULL +#define pci_ss_list_1255_2130 NULL +#define pci_ss_list_1256_4201 NULL +#define pci_ss_list_1256_4401 NULL +#define pci_ss_list_1256_5201 NULL +#define pci_ss_list_1259_2560 NULL +#define pci_ss_list_125b_1400 NULL +#define pci_ss_list_125c_0640 NULL +#define pci_ss_list_125d_0000 NULL +#define pci_ss_list_125d_1948 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_125d_1968[] = { + &pci_ss_info_125d_1968_1028_0085, + &pci_ss_info_125d_1968_1033_8051, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_125d_1969[] = { + &pci_ss_info_125d_1969_1014_0166, + &pci_ss_info_125d_1969_125d_8888, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_125d_1978[] = { + &pci_ss_info_125d_1978_0e11_b112, + &pci_ss_info_125d_1978_1033_803c, + &pci_ss_info_125d_1978_1033_8058, + &pci_ss_info_125d_1978_1092_4000, + &pci_ss_info_125d_1978_1179_0001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_125d_1988[] = { + &pci_ss_info_125d_1988_1092_4100, + &pci_ss_info_125d_1988_125d_1988, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_125d_1989[] = { + &pci_ss_info_125d_1989_125d_1989, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_125d_1998[] = { + &pci_ss_info_125d_1998_1028_00e6, + NULL +}; +#define pci_ss_list_125d_1999 NULL +#define pci_ss_list_125d_199a NULL +#define pci_ss_list_125d_199b NULL +#define pci_ss_list_125d_2808 NULL +#define pci_ss_list_125d_2838 NULL +static const pciSubsystemInfo *pci_ss_list_125d_2898[] = { + &pci_ss_info_125d_2898_125d_0424, + &pci_ss_info_125d_2898_125d_0425, + &pci_ss_info_125d_2898_125d_0426, + &pci_ss_info_125d_2898_125d_0427, + &pci_ss_info_125d_2898_125d_0428, + &pci_ss_info_125d_2898_125d_0429, + &pci_ss_info_125d_2898_147a_c001, + &pci_ss_info_125d_2898_14fe_0428, + &pci_ss_info_125d_2898_14fe_0429, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1260_3873[] = { + &pci_ss_info_1260_3873_1186_3501, + &pci_ss_info_1260_3873_1668_0414, + &pci_ss_info_1260_3873_1737_3874, + &pci_ss_info_1260_3873_8086_2513, + NULL +}; +#define pci_ss_list_1260_8130 NULL +#define pci_ss_list_1260_8131 NULL +#endif +#define pci_ss_list_1266_0001 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1266_1910[] = { + &pci_ss_info_1266_1910_1266_1910, + NULL +}; +#endif +#define pci_ss_list_1267_5352 NULL +#define pci_ss_list_1267_5a4b NULL +#define pci_ss_list_126f_0710 NULL +#define pci_ss_list_126f_0712 NULL +#define pci_ss_list_126f_0720 NULL +#define pci_ss_list_126f_0810 NULL +#define pci_ss_list_126f_0811 NULL +#define pci_ss_list_126f_0820 NULL +#define pci_ss_list_126f_0910 NULL +#define pci_ss_list_1273_0002 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1274_1371[] = { + &pci_ss_info_1274_1371_0e11_0024, + &pci_ss_info_1274_1371_0e11_b1a7, + &pci_ss_info_1274_1371_1033_80ac, + &pci_ss_info_1274_1371_1042_1854, + &pci_ss_info_1274_1371_107b_8054, + &pci_ss_info_1274_1371_1274_1371, + &pci_ss_info_1274_1371_1462_6470, + &pci_ss_info_1274_1371_1462_6560, + &pci_ss_info_1274_1371_1462_6630, + &pci_ss_info_1274_1371_1462_6631, + &pci_ss_info_1274_1371_1462_6632, + &pci_ss_info_1274_1371_1462_6633, + &pci_ss_info_1274_1371_1462_6820, + &pci_ss_info_1274_1371_1462_6822, + &pci_ss_info_1274_1371_1462_6830, + &pci_ss_info_1274_1371_1462_6880, + &pci_ss_info_1274_1371_1462_6900, + &pci_ss_info_1274_1371_1462_6910, + &pci_ss_info_1274_1371_1462_6930, + &pci_ss_info_1274_1371_1462_6990, + &pci_ss_info_1274_1371_1462_6991, + &pci_ss_info_1274_1371_14a4_2077, + &pci_ss_info_1274_1371_14a4_2105, + &pci_ss_info_1274_1371_14a4_2107, + &pci_ss_info_1274_1371_14a4_2172, + &pci_ss_info_1274_1371_1509_9902, + &pci_ss_info_1274_1371_1509_9903, + &pci_ss_info_1274_1371_1509_9904, + &pci_ss_info_1274_1371_1509_9905, + &pci_ss_info_1274_1371_152d_8801, + &pci_ss_info_1274_1371_152d_8802, + &pci_ss_info_1274_1371_152d_8803, + &pci_ss_info_1274_1371_152d_8804, + &pci_ss_info_1274_1371_152d_8805, + &pci_ss_info_1274_1371_270f_2001, + &pci_ss_info_1274_1371_270f_2200, + &pci_ss_info_1274_1371_270f_3000, + &pci_ss_info_1274_1371_270f_3100, + &pci_ss_info_1274_1371_270f_3102, + &pci_ss_info_1274_1371_270f_7060, + &pci_ss_info_1274_1371_8086_4249, + &pci_ss_info_1274_1371_8086_424c, + &pci_ss_info_1274_1371_8086_425a, + &pci_ss_info_1274_1371_8086_4341, + &pci_ss_info_1274_1371_8086_4343, + &pci_ss_info_1274_1371_8086_4649, + &pci_ss_info_1274_1371_8086_464a, + &pci_ss_info_1274_1371_8086_4d4f, + &pci_ss_info_1274_1371_8086_4f43, + &pci_ss_info_1274_1371_8086_5243, + &pci_ss_info_1274_1371_8086_5352, + &pci_ss_info_1274_1371_8086_5643, + &pci_ss_info_1274_1371_8086_5753, + NULL +}; +#define pci_ss_list_1274_5000 NULL +static const pciSubsystemInfo *pci_ss_list_1274_5880[] = { + &pci_ss_info_1274_5880_1274_2000, + &pci_ss_info_1274_5880_1274_2003, + &pci_ss_info_1274_5880_1274_5880, + &pci_ss_info_1274_5880_1458_a000, + &pci_ss_info_1274_5880_1462_6880, + &pci_ss_info_1274_5880_270f_2001, + &pci_ss_info_1274_5880_270f_2200, + &pci_ss_info_1274_5880_270f_7040, + NULL +}; +#endif +#define pci_ss_list_1278_0701 NULL +#define pci_ss_list_1279_0295 NULL +#define pci_ss_list_1279_0395 NULL +#define pci_ss_list_1279_0396 NULL +#define pci_ss_list_1279_0397 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_127a_1002[] = { + &pci_ss_info_127a_1002_1092_094c, + &pci_ss_info_127a_1002_122d_4002, + &pci_ss_info_127a_1002_122d_4005, + &pci_ss_info_127a_1002_122d_4007, + &pci_ss_info_127a_1002_122d_4012, + &pci_ss_info_127a_1002_122d_4017, + &pci_ss_info_127a_1002_122d_4018, + &pci_ss_info_127a_1002_127a_1002, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_1003[] = { + &pci_ss_info_127a_1003_0e11_b0bc, + &pci_ss_info_127a_1003_0e11_b114, + &pci_ss_info_127a_1003_1033_802b, + &pci_ss_info_127a_1003_13df_1003, + &pci_ss_info_127a_1003_13e0_0117, + &pci_ss_info_127a_1003_13e0_0147, + &pci_ss_info_127a_1003_13e0_0197, + &pci_ss_info_127a_1003_13e0_01c7, + &pci_ss_info_127a_1003_13e0_01f7, + &pci_ss_info_127a_1003_1436_1003, + &pci_ss_info_127a_1003_1436_1103, + &pci_ss_info_127a_1003_1436_1602, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_1004[] = { + &pci_ss_info_127a_1004_1048_1500, + &pci_ss_info_127a_1004_10cf_1059, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_1005[] = { + &pci_ss_info_127a_1005_1033_8029, + &pci_ss_info_127a_1005_1033_8054, + &pci_ss_info_127a_1005_10cf_103c, + &pci_ss_info_127a_1005_10cf_1055, + &pci_ss_info_127a_1005_10cf_1056, + &pci_ss_info_127a_1005_122d_4003, + &pci_ss_info_127a_1005_122d_4006, + &pci_ss_info_127a_1005_122d_4008, + &pci_ss_info_127a_1005_122d_4009, + &pci_ss_info_127a_1005_122d_4010, + &pci_ss_info_127a_1005_122d_4011, + &pci_ss_info_127a_1005_122d_4013, + &pci_ss_info_127a_1005_122d_4015, + &pci_ss_info_127a_1005_122d_4016, + &pci_ss_info_127a_1005_122d_4019, + &pci_ss_info_127a_1005_13df_1005, + &pci_ss_info_127a_1005_13e0_0187, + &pci_ss_info_127a_1005_13e0_01a7, + &pci_ss_info_127a_1005_13e0_01b7, + &pci_ss_info_127a_1005_13e0_01d7, + &pci_ss_info_127a_1005_1436_1005, + &pci_ss_info_127a_1005_1436_1105, + &pci_ss_info_127a_1005_1437_1105, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_1022[] = { + &pci_ss_info_127a_1022_1436_1303, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_1023[] = { + &pci_ss_info_127a_1023_122d_4020, + &pci_ss_info_127a_1023_122d_4023, + &pci_ss_info_127a_1023_13e0_0247, + &pci_ss_info_127a_1023_13e0_0297, + &pci_ss_info_127a_1023_13e0_02c7, + &pci_ss_info_127a_1023_1436_1203, + &pci_ss_info_127a_1023_1436_1303, + NULL +}; +#define pci_ss_list_127a_1024 NULL +static const pciSubsystemInfo *pci_ss_list_127a_1025[] = { + &pci_ss_info_127a_1025_10cf_106a, + &pci_ss_info_127a_1025_122d_4021, + &pci_ss_info_127a_1025_122d_4022, + &pci_ss_info_127a_1025_122d_4024, + &pci_ss_info_127a_1025_122d_4025, + NULL +}; +#define pci_ss_list_127a_1026 NULL +#define pci_ss_list_127a_1032 NULL +#define pci_ss_list_127a_1033 NULL +#define pci_ss_list_127a_1034 NULL +#define pci_ss_list_127a_1035 NULL +#define pci_ss_list_127a_1036 NULL +#define pci_ss_list_127a_1085 NULL +static const pciSubsystemInfo *pci_ss_list_127a_2005[] = { + &pci_ss_info_127a_2005_104d_8044, + &pci_ss_info_127a_2005_104d_8045, + &pci_ss_info_127a_2005_104d_8055, + &pci_ss_info_127a_2005_104d_8056, + &pci_ss_info_127a_2005_104d_805a, + &pci_ss_info_127a_2005_104d_805f, + &pci_ss_info_127a_2005_104d_8074, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_2013[] = { + &pci_ss_info_127a_2013_1179_0001, + &pci_ss_info_127a_2013_1179_ff00, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_2014[] = { + &pci_ss_info_127a_2014_10cf_1057, + &pci_ss_info_127a_2014_122d_4050, + &pci_ss_info_127a_2014_122d_4055, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_2015[] = { + &pci_ss_info_127a_2015_10cf_1063, + &pci_ss_info_127a_2015_10cf_1064, + &pci_ss_info_127a_2015_1468_2015, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_2016[] = { + &pci_ss_info_127a_2016_122d_4051, + &pci_ss_info_127a_2016_122d_4052, + &pci_ss_info_127a_2016_122d_4054, + &pci_ss_info_127a_2016_122d_4056, + &pci_ss_info_127a_2016_122d_4057, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_4311[] = { + &pci_ss_info_127a_4311_127a_4311, + &pci_ss_info_127a_4311_13e0_0210, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_4320[] = { + &pci_ss_info_127a_4320_1235_4320, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_4321[] = { + &pci_ss_info_127a_4321_1235_4321, + &pci_ss_info_127a_4321_1235_4324, + &pci_ss_info_127a_4321_13e0_0210, + &pci_ss_info_127a_4321_144d_2321, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_4322[] = { + &pci_ss_info_127a_4322_1235_4322, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_127a_8234[] = { + &pci_ss_info_127a_8234_108d_0022, + &pci_ss_info_127a_8234_108d_0027, + NULL +}; +#endif +#define pci_ss_list_1282_9009 NULL +#define pci_ss_list_1282_9100 NULL +#define pci_ss_list_1282_9102 NULL +#define pci_ss_list_1282_9132 NULL +#define pci_ss_list_1283_673a NULL +#define pci_ss_list_1283_8330 NULL +#define pci_ss_list_1283_8888 NULL +#define pci_ss_list_1283_8889 NULL +#define pci_ss_list_1283_e886 NULL +#define pci_ss_list_1285_0100 NULL +#define pci_ss_list_1287_001e NULL +#define pci_ss_list_1287_001f NULL +#define pci_ss_list_128d_0021 NULL +#define pci_ss_list_128e_0008 NULL +#define pci_ss_list_128e_0009 NULL +#define pci_ss_list_128e_000a NULL +#define pci_ss_list_128e_000b NULL +#define pci_ss_list_128e_000c NULL +#define pci_ss_list_129a_0615 NULL +#define pci_ss_list_12ab_3000 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12ae_0001[] = { + &pci_ss_info_12ae_0001_12ae_0001, + &pci_ss_info_12ae_0001_1410_0104, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_12ae_0002[] = { + &pci_ss_info_12ae_0002_12ae_0002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12b9_1006[] = { + &pci_ss_info_12b9_1006_12b9_005c, + &pci_ss_info_12b9_1006_12b9_005e, + &pci_ss_info_12b9_1006_12b9_0062, + &pci_ss_info_12b9_1006_12b9_0068, + &pci_ss_info_12b9_1006_12b9_007a, + &pci_ss_info_12b9_1006_12b9_007f, + &pci_ss_info_12b9_1006_12b9_0080, + &pci_ss_info_12b9_1006_12b9_0081, + &pci_ss_info_12b9_1006_12b9_0091, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_12b9_1007[] = { + &pci_ss_info_12b9_1007_12b9_00a3, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_12b9_1008[] = { + &pci_ss_info_12b9_1008_12b9_00a2, + &pci_ss_info_12b9_1008_12b9_00aa, + &pci_ss_info_12b9_1008_12b9_00ab, + &pci_ss_info_12b9_1008_12b9_00ac, + &pci_ss_info_12b9_1008_12b9_00ad, + NULL +}; +#endif +#define pci_ss_list_12be_3041 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12be_3042[] = { + &pci_ss_info_12be_3042_12be_3042, + NULL +}; +#endif +#define pci_ss_list_12c3_0058 NULL +#define pci_ss_list_12c3_5598 NULL +#define pci_ss_list_12c5_007e NULL +#define pci_ss_list_12c5_007f NULL +#define pci_ss_list_12c5_0081 NULL +#define pci_ss_list_12c5_0085 NULL +#define pci_ss_list_12c5_0086 NULL +#define pci_ss_list_12d2_0008 NULL +#define pci_ss_list_12d2_0009 NULL +static const pciSubsystemInfo *pci_ss_list_12d2_0018[] = { + &pci_ss_info_12d2_0018_1048_0c10, + &pci_ss_info_12d2_0018_107b_8030, + &pci_ss_info_12d2_0018_1092_0350, + &pci_ss_info_12d2_0018_1092_1092, + &pci_ss_info_12d2_0018_10b4_1b1b, + &pci_ss_info_12d2_0018_10b4_1b1d, + &pci_ss_info_12d2_0018_10b4_1b1e, + &pci_ss_info_12d2_0018_10b4_1b20, + &pci_ss_info_12d2_0018_10b4_1b21, + &pci_ss_info_12d2_0018_10b4_1b22, + &pci_ss_info_12d2_0018_10b4_1b23, + &pci_ss_info_12d2_0018_10b4_1b27, + &pci_ss_info_12d2_0018_10b4_1b88, + &pci_ss_info_12d2_0018_10b4_222a, + &pci_ss_info_12d2_0018_10b4_2230, + &pci_ss_info_12d2_0018_10b4_2232, + &pci_ss_info_12d2_0018_10b4_2235, + &pci_ss_info_12d2_0018_2a15_54a3, + NULL +}; +#define pci_ss_list_12d2_0019 NULL +#define pci_ss_list_12d2_0020 NULL +#define pci_ss_list_12d2_0028 NULL +#define pci_ss_list_12d2_0029 NULL +#define pci_ss_list_12d2_002c NULL +#define pci_ss_list_12d2_00a0 NULL +#define pci_ss_list_12e0_0010 NULL +#define pci_ss_list_12e0_0020 NULL +#define pci_ss_list_12e0_0030 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12eb_0001[] = { + &pci_ss_info_12eb_0001_104d_8036, + &pci_ss_info_12eb_0001_1092_2000, + &pci_ss_info_12eb_0001_1092_2100, + &pci_ss_info_12eb_0001_1092_2110, + &pci_ss_info_12eb_0001_1092_2200, + &pci_ss_info_12eb_0001_122d_1002, + &pci_ss_info_12eb_0001_12eb_0001, + &pci_ss_info_12eb_0001_5053_3355, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_12eb_0002[] = { + &pci_ss_info_12eb_0002_104d_8049, + &pci_ss_info_12eb_0002_104d_807b, + &pci_ss_info_12eb_0002_1092_3000, + &pci_ss_info_12eb_0002_1092_3001, + &pci_ss_info_12eb_0002_1092_3002, + &pci_ss_info_12eb_0002_1092_3003, + &pci_ss_info_12eb_0002_1092_3004, + &pci_ss_info_12eb_0002_12eb_0001, + &pci_ss_info_12eb_0002_12eb_0002, + &pci_ss_info_12eb_0002_12eb_0088, + &pci_ss_info_12eb_0002_144d_3510, + &pci_ss_info_12eb_0002_5053_3356, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_12eb_0003[] = { + &pci_ss_info_12eb_0003_104d_8049, + &pci_ss_info_12eb_0003_104d_8077, + &pci_ss_info_12eb_0003_109f_1000, + &pci_ss_info_12eb_0003_12eb_0003, + &pci_ss_info_12eb_0003_1462_6780, + &pci_ss_info_12eb_0003_14a4_2073, + &pci_ss_info_12eb_0003_14a4_2091, + &pci_ss_info_12eb_0003_14a4_2104, + &pci_ss_info_12eb_0003_14a4_2106, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_12eb_8803[] = { + &pci_ss_info_12eb_8803_12eb_8803, + NULL +}; +#endif +#define pci_ss_list_12f8_0002 NULL +#define pci_ss_list_1307_0001 NULL +#define pci_ss_list_1307_000b NULL +#define pci_ss_list_1307_000c NULL +#define pci_ss_list_1307_000d NULL +#define pci_ss_list_1307_000f NULL +#define pci_ss_list_1307_0010 NULL +#define pci_ss_list_1307_0014 NULL +#define pci_ss_list_1307_0015 NULL +#define pci_ss_list_1307_0016 NULL +#define pci_ss_list_1307_0017 NULL +#define pci_ss_list_1307_0018 NULL +#define pci_ss_list_1307_0019 NULL +#define pci_ss_list_1307_001a NULL +#define pci_ss_list_1307_001b NULL +#define pci_ss_list_1307_001c NULL +#define pci_ss_list_1307_001d NULL +#define pci_ss_list_1307_001e NULL +#define pci_ss_list_1307_001f NULL +#define pci_ss_list_1307_0020 NULL +#define pci_ss_list_1307_0021 NULL +#define pci_ss_list_1307_0022 NULL +#define pci_ss_list_1307_0023 NULL +#define pci_ss_list_1307_0024 NULL +#define pci_ss_list_1307_0025 NULL +#define pci_ss_list_1307_0026 NULL +#define pci_ss_list_1307_0027 NULL +#define pci_ss_list_1307_0028 NULL +#define pci_ss_list_1307_0029 NULL +#define pci_ss_list_1307_002c NULL +#define pci_ss_list_1307_0033 NULL +#define pci_ss_list_1307_0034 NULL +#define pci_ss_list_1307_0035 NULL +#define pci_ss_list_1307_0036 NULL +#define pci_ss_list_1307_0037 NULL +#define pci_ss_list_1307_004c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1308_0001[] = { + &pci_ss_info_1308_0001_1308_0001, + NULL +}; +#endif +#define pci_ss_list_1317_0981 NULL +#define pci_ss_list_1317_0985 NULL +#define pci_ss_list_1317_1985 NULL +#define pci_ss_list_1318_0911 NULL +#define pci_ss_list_1319_0801 NULL +#define pci_ss_list_1319_0802 NULL +#define pci_ss_list_1319_1000 NULL +#define pci_ss_list_1319_1001 NULL +#define pci_ss_list_131f_1000 NULL +#define pci_ss_list_131f_1001 NULL +#define pci_ss_list_131f_1002 NULL +#define pci_ss_list_131f_1010 NULL +#define pci_ss_list_131f_1011 NULL +#define pci_ss_list_131f_1012 NULL +#define pci_ss_list_131f_1020 NULL +#define pci_ss_list_131f_1021 NULL +#define pci_ss_list_131f_1030 NULL +#define pci_ss_list_131f_1031 NULL +#define pci_ss_list_131f_1032 NULL +#define pci_ss_list_131f_1034 NULL +#define pci_ss_list_131f_1035 NULL +#define pci_ss_list_131f_1036 NULL +#define pci_ss_list_131f_1050 NULL +#define pci_ss_list_131f_1051 NULL +#define pci_ss_list_131f_1052 NULL +#define pci_ss_list_131f_2000 NULL +#define pci_ss_list_131f_2001 NULL +#define pci_ss_list_131f_2002 NULL +#define pci_ss_list_131f_2010 NULL +#define pci_ss_list_131f_2011 NULL +#define pci_ss_list_131f_2012 NULL +#define pci_ss_list_131f_2020 NULL +#define pci_ss_list_131f_2021 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_131f_2030[] = { + &pci_ss_info_131f_2030_131f_2030, + NULL +}; +#define pci_ss_list_131f_2031 NULL +#define pci_ss_list_131f_2032 NULL +#define pci_ss_list_131f_2040 NULL +#define pci_ss_list_131f_2041 NULL +#define pci_ss_list_131f_2042 NULL +#define pci_ss_list_131f_2050 NULL +#define pci_ss_list_131f_2051 NULL +#define pci_ss_list_131f_2052 NULL +#define pci_ss_list_131f_2060 NULL +#define pci_ss_list_131f_2061 NULL +#define pci_ss_list_131f_2062 NULL +#endif +#define pci_ss_list_1332_5415 NULL +#define pci_ss_list_134a_0001 NULL +#define pci_ss_list_134a_0002 NULL +#define pci_ss_list_134d_7890 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_134d_7891[] = { + &pci_ss_info_134d_7891_134d_0001, + NULL +}; +#define pci_ss_list_134d_7892 NULL +#define pci_ss_list_134d_7893 NULL +#define pci_ss_list_134d_7894 NULL +#define pci_ss_list_134d_7895 NULL +#define pci_ss_list_134d_7896 NULL +#define pci_ss_list_134d_7897 NULL +#endif +#define pci_ss_list_1353_0002 NULL +#define pci_ss_list_1353_0003 NULL +#define pci_ss_list_1353_0004 NULL +#define pci_ss_list_1353_0005 NULL +#define pci_ss_list_135c_0010 NULL +#define pci_ss_list_135c_0020 NULL +#define pci_ss_list_135c_0030 NULL +#define pci_ss_list_135c_0040 NULL +#define pci_ss_list_135c_0050 NULL +#define pci_ss_list_135c_0060 NULL +#define pci_ss_list_135c_00f0 NULL +#define pci_ss_list_135c_0170 NULL +#define pci_ss_list_135c_0180 NULL +#define pci_ss_list_135c_0190 NULL +#define pci_ss_list_135c_01a0 NULL +#define pci_ss_list_135c_01b0 NULL +#define pci_ss_list_135c_01c0 NULL +#define pci_ss_list_135e_7101 NULL +#define pci_ss_list_135e_7201 NULL +#define pci_ss_list_135e_7202 NULL +#define pci_ss_list_135e_7401 NULL +#define pci_ss_list_135e_7402 NULL +#define pci_ss_list_135e_7801 NULL +#define pci_ss_list_135e_8001 NULL +#define pci_ss_list_1385_4100 NULL +#define pci_ss_list_1385_620a NULL +#define pci_ss_list_1385_622a NULL +#define pci_ss_list_1385_630a NULL +#define pci_ss_list_1385_f311 NULL +#define pci_ss_list_1389_0001 NULL +#define pci_ss_list_1393_1040 NULL +#define pci_ss_list_1393_1680 NULL +#define pci_ss_list_1393_2040 NULL +#define pci_ss_list_1393_2180 NULL +#define pci_ss_list_1393_3200 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1394_0001[] = { + &pci_ss_info_1394_0001_1394_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1397_2bd0[] = { + &pci_ss_info_1397_2bd0_1397_2bd0, + &pci_ss_info_1397_2bd0_e4bf_1000, + NULL +}; +#endif +#define pci_ss_list_139a_0001 NULL +#define pci_ss_list_139a_0003 NULL +#define pci_ss_list_139a_0005 NULL +#define pci_ss_list_13a3_0005 NULL +#define pci_ss_list_13a3_0006 NULL +#define pci_ss_list_13a3_0007 NULL +#define pci_ss_list_13a3_0012 NULL +#define pci_ss_list_13a3_0014 NULL +#define pci_ss_list_13a3_0016 NULL +#define pci_ss_list_13a3_0017 NULL +#define pci_ss_list_13a3_0018 NULL +#define pci_ss_list_13a8_0158 NULL +#define pci_ss_list_13c0_0010 NULL +#define pci_ss_list_13c1_1000 NULL +#define pci_ss_list_13c1_1001 NULL +#define pci_ss_list_13c1_1002 NULL +#define pci_ss_list_13d0_2103 NULL +#define pci_ss_list_13d1_ab02 NULL +#define pci_ss_list_13d1_ab06 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13df_0001[] = { + &pci_ss_info_13df_0001_13df_0001, + NULL +}; +#endif +#define pci_ss_list_13f0_0201 NULL +#define pci_ss_list_13f4_1401 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13f6_0100[] = { + &pci_ss_info_13f6_0100_13f6_ffff, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_13f6_0101[] = { + &pci_ss_info_13f6_0101_13f6_0101, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_13f6_0111[] = { + &pci_ss_info_13f6_0111_1019_0970, + &pci_ss_info_13f6_0111_1043_8077, + &pci_ss_info_13f6_0111_1043_80e2, + &pci_ss_info_13f6_0111_13f6_0111, + NULL +}; +#define pci_ss_list_13f6_0211 NULL +#endif +#define pci_ss_list_13fe_1756 NULL +#define pci_ss_list_1400_1401 NULL +#define pci_ss_list_1407_0100 NULL +#define pci_ss_list_1407_0101 NULL +#define pci_ss_list_1407_0102 NULL +#define pci_ss_list_1407_0200 NULL +#define pci_ss_list_1407_0201 NULL +#define pci_ss_list_1407_0202 NULL +#define pci_ss_list_1407_0500 NULL +#define pci_ss_list_1407_0600 NULL +#define pci_ss_list_1407_8000 NULL +#define pci_ss_list_1407_8001 NULL +#define pci_ss_list_1407_8002 NULL +#define pci_ss_list_1407_8003 NULL +#define pci_ss_list_1407_8800 NULL +#define pci_ss_list_1409_7168 NULL +#define pci_ss_list_1412_1712 NULL +#define pci_ss_list_1412_1724 NULL +#define pci_ss_list_1415_8403 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1415_9501[] = { + &pci_ss_info_1415_9501_15ed_2000, + &pci_ss_info_1415_9501_15ed_2001, + NULL +}; +#define pci_ss_list_1415_950a NULL +#define pci_ss_list_1415_950b NULL +static const pciSubsystemInfo *pci_ss_list_1415_9511[] = { + &pci_ss_info_1415_9511_15ed_2000, + &pci_ss_info_1415_9511_15ed_2001, + NULL +}; +#define pci_ss_list_1415_9521 NULL +#endif +#define pci_ss_list_144a_7296 NULL +#define pci_ss_list_144a_7432 NULL +#define pci_ss_list_144a_7433 NULL +#define pci_ss_list_144a_7434 NULL +#define pci_ss_list_144a_7841 NULL +#define pci_ss_list_144a_8133 NULL +#define pci_ss_list_144a_8554 NULL +#define pci_ss_list_144a_9111 NULL +#define pci_ss_list_144a_9113 NULL +#define pci_ss_list_144a_9114 NULL +#define pci_ss_list_145f_0001 NULL +#define pci_ss_list_148d_1003 NULL +#define pci_ss_list_14af_7102 NULL +#define pci_ss_list_14b3_0000 NULL +#define pci_ss_list_14b5_0200 NULL +#define pci_ss_list_14b5_0300 NULL +#define pci_ss_list_14b5_0400 NULL +#define pci_ss_list_14b5_0600 NULL +#define pci_ss_list_14b5_0800 NULL +#define pci_ss_list_14b5_0900 NULL +#define pci_ss_list_14b5_0a00 NULL +#define pci_ss_list_14b5_0b00 NULL +#define pci_ss_list_14b7_0001 NULL +#define pci_ss_list_14b9_0001 NULL +#define pci_ss_list_14b9_0340 NULL +#define pci_ss_list_14b9_0350 NULL +#define pci_ss_list_14b9_4500 NULL +#define pci_ss_list_14b9_4800 NULL +#define pci_ss_list_14b9_a504 NULL +#define pci_ss_list_14d2_8001 NULL +#define pci_ss_list_14d2_8002 NULL +#define pci_ss_list_14d2_8010 NULL +#define pci_ss_list_14d2_8011 NULL +#define pci_ss_list_14d2_8020 NULL +#define pci_ss_list_14d2_8021 NULL +#define pci_ss_list_14d2_8040 NULL +#define pci_ss_list_14d2_8080 NULL +#define pci_ss_list_14d2_a000 NULL +#define pci_ss_list_14d2_a001 NULL +#define pci_ss_list_14d2_a003 NULL +#define pci_ss_list_14d2_a004 NULL +#define pci_ss_list_14d2_a005 NULL +#define pci_ss_list_14d2_e001 NULL +#define pci_ss_list_14d2_e010 NULL +#define pci_ss_list_14d2_e020 NULL +#define pci_ss_list_14db_2120 NULL +#define pci_ss_list_14dc_0000 NULL +#define pci_ss_list_14dc_0001 NULL +#define pci_ss_list_14dc_0002 NULL +#define pci_ss_list_14dc_0003 NULL +#define pci_ss_list_14dc_0004 NULL +#define pci_ss_list_14dc_0005 NULL +#define pci_ss_list_14dc_0006 NULL +#define pci_ss_list_14dc_0007 NULL +#define pci_ss_list_14dc_0008 NULL +#define pci_ss_list_14dc_0009 NULL +#define pci_ss_list_14dc_000a NULL +#define pci_ss_list_14dc_000b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14e4_1644[] = { + &pci_ss_info_14e4_1644_1014_0277, + &pci_ss_info_14e4_1644_1028_00d1, + &pci_ss_info_14e4_1644_1028_0106, + &pci_ss_info_14e4_1644_1028_0109, + &pci_ss_info_14e4_1644_1028_010a, + &pci_ss_info_14e4_1644_10b7_1000, + &pci_ss_info_14e4_1644_10b7_1001, + &pci_ss_info_14e4_1644_10b7_1002, + &pci_ss_info_14e4_1644_10b7_1003, + &pci_ss_info_14e4_1644_10b7_1004, + &pci_ss_info_14e4_1644_10b7_1005, + &pci_ss_info_14e4_1644_10b7_1008, + &pci_ss_info_14e4_1644_14e4_0002, + &pci_ss_info_14e4_1644_14e4_0003, + &pci_ss_info_14e4_1644_14e4_0004, + &pci_ss_info_14e4_1644_14e4_1028, + &pci_ss_info_14e4_1644_14e4_1644, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_1645[] = { + &pci_ss_info_14e4_1645_0e11_007c, + &pci_ss_info_14e4_1645_0e11_007d, + &pci_ss_info_14e4_1645_0e11_0085, + &pci_ss_info_14e4_1645_0e11_0099, + &pci_ss_info_14e4_1645_0e11_009a, + &pci_ss_info_14e4_1645_0e11_00c1, + &pci_ss_info_14e4_1645_1028_0121, + &pci_ss_info_14e4_1645_10b7_1004, + &pci_ss_info_14e4_1645_10b7_1006, + &pci_ss_info_14e4_1645_10b7_1007, + &pci_ss_info_14e4_1645_10b7_1008, + &pci_ss_info_14e4_1645_14e4_0001, + &pci_ss_info_14e4_1645_14e4_0005, + &pci_ss_info_14e4_1645_14e4_0006, + &pci_ss_info_14e4_1645_14e4_0007, + &pci_ss_info_14e4_1645_14e4_0008, + &pci_ss_info_14e4_1645_14e4_8008, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_1646[] = { + &pci_ss_info_14e4_1646_0e11_00bb, + &pci_ss_info_14e4_1646_1028_0126, + &pci_ss_info_14e4_1646_14e4_8009, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_1647[] = { + &pci_ss_info_14e4_1647_0e11_0099, + &pci_ss_info_14e4_1647_0e11_009a, + &pci_ss_info_14e4_1647_14e4_0009, + &pci_ss_info_14e4_1647_14e4_000a, + &pci_ss_info_14e4_1647_14e4_000b, + &pci_ss_info_14e4_1647_14e4_8009, + &pci_ss_info_14e4_1647_14e4_800a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_1648[] = { + &pci_ss_info_14e4_1648_0e11_00cf, + &pci_ss_info_14e4_1648_0e11_00d0, + &pci_ss_info_14e4_1648_0e11_00d1, + &pci_ss_info_14e4_1648_10b7_2000, + &pci_ss_info_14e4_1648_10b7_3000, + &pci_ss_info_14e4_1648_1166_1648, + NULL +}; +#define pci_ss_list_14e4_164d NULL +#define pci_ss_list_14e4_1653 NULL +#define pci_ss_list_14e4_165d NULL +static const pciSubsystemInfo *pci_ss_list_14e4_1696[] = { + &pci_ss_info_14e4_1696_14e4_000d, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_16a6[] = { + &pci_ss_info_14e4_16a6_0e11_00bb, + &pci_ss_info_14e4_16a6_1028_0126, + &pci_ss_info_14e4_16a6_14e4_000c, + &pci_ss_info_14e4_16a6_14e4_8009, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_16a7[] = { + &pci_ss_info_14e4_16a7_0e11_00ca, + &pci_ss_info_14e4_16a7_0e11_00cb, + &pci_ss_info_14e4_16a7_14e4_0009, + &pci_ss_info_14e4_16a7_14e4_000a, + &pci_ss_info_14e4_16a7_14e4_000b, + &pci_ss_info_14e4_16a7_14e4_800a, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_16a8[] = { + &pci_ss_info_14e4_16a8_10b7_2001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_16c6[] = { + &pci_ss_info_14e4_16c6_10b7_1100, + &pci_ss_info_14e4_16c6_14e4_000c, + &pci_ss_info_14e4_16c6_14e4_8009, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14e4_16c7[] = { + &pci_ss_info_14e4_16c7_14e4_0009, + &pci_ss_info_14e4_16c7_14e4_000a, + NULL +}; +#define pci_ss_list_14e4_4210 NULL +#define pci_ss_list_14e4_4211 NULL +#define pci_ss_list_14e4_4212 NULL +#define pci_ss_list_14e4_4301 NULL +#define pci_ss_list_14e4_4401 NULL +#define pci_ss_list_14e4_4402 NULL +#define pci_ss_list_14e4_4410 NULL +#define pci_ss_list_14e4_4411 NULL +#define pci_ss_list_14e4_4412 NULL +#define pci_ss_list_14e4_5820 NULL +#define pci_ss_list_14e4_5821 NULL +#endif +#define pci_ss_list_14ea_ab06 NULL +#define pci_ss_list_14f1_1002 NULL +#define pci_ss_list_14f1_1003 NULL +#define pci_ss_list_14f1_1004 NULL +#define pci_ss_list_14f1_1005 NULL +#define pci_ss_list_14f1_1006 NULL +#define pci_ss_list_14f1_1022 NULL +#define pci_ss_list_14f1_1023 NULL +#define pci_ss_list_14f1_1024 NULL +#define pci_ss_list_14f1_1025 NULL +#define pci_ss_list_14f1_1026 NULL +#define pci_ss_list_14f1_1032 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14f1_1033[] = { + &pci_ss_info_14f1_1033_1033_8077, + &pci_ss_info_14f1_1033_122d_4027, + &pci_ss_info_14f1_1033_122d_4030, + &pci_ss_info_14f1_1033_122d_4034, + &pci_ss_info_14f1_1033_13e0_020d, + &pci_ss_info_14f1_1033_13e0_020e, + &pci_ss_info_14f1_1033_13e0_0261, + &pci_ss_info_14f1_1033_13e0_0290, + &pci_ss_info_14f1_1033_13e0_02a0, + &pci_ss_info_14f1_1033_13e0_02b0, + &pci_ss_info_14f1_1033_13e0_02c0, + &pci_ss_info_14f1_1033_13e0_02d0, + &pci_ss_info_14f1_1033_144f_1500, + &pci_ss_info_14f1_1033_144f_1501, + &pci_ss_info_14f1_1033_144f_150a, + &pci_ss_info_14f1_1033_144f_150b, + &pci_ss_info_14f1_1033_144f_1510, + NULL +}; +#define pci_ss_list_14f1_1034 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_1035[] = { + &pci_ss_info_14f1_1035_10cf_1098, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14f1_1036[] = { + &pci_ss_info_14f1_1036_104d_8067, + &pci_ss_info_14f1_1036_122d_4029, + &pci_ss_info_14f1_1036_122d_4031, + &pci_ss_info_14f1_1036_13e0_0209, + &pci_ss_info_14f1_1036_13e0_020a, + &pci_ss_info_14f1_1036_13e0_0260, + &pci_ss_info_14f1_1036_13e0_0270, + NULL +}; +#define pci_ss_list_14f1_1052 NULL +#define pci_ss_list_14f1_1053 NULL +#define pci_ss_list_14f1_1054 NULL +#define pci_ss_list_14f1_1055 NULL +#define pci_ss_list_14f1_1056 NULL +#define pci_ss_list_14f1_1057 NULL +#define pci_ss_list_14f1_1059 NULL +#define pci_ss_list_14f1_1063 NULL +#define pci_ss_list_14f1_1064 NULL +#define pci_ss_list_14f1_1065 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_1066[] = { + &pci_ss_info_14f1_1066_122d_4033, + NULL +}; +#define pci_ss_list_14f1_1433 NULL +#define pci_ss_list_14f1_1434 NULL +#define pci_ss_list_14f1_1435 NULL +#define pci_ss_list_14f1_1436 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_1453[] = { + &pci_ss_info_14f1_1453_13e0_0240, + &pci_ss_info_14f1_1453_13e0_0250, + &pci_ss_info_14f1_1453_144f_1502, + &pci_ss_info_14f1_1453_144f_1503, + NULL +}; +#define pci_ss_list_14f1_1454 NULL +#define pci_ss_list_14f1_1455 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_1456[] = { + &pci_ss_info_14f1_1456_122d_4035, + &pci_ss_info_14f1_1456_122d_4302, + NULL +}; +#define pci_ss_list_14f1_1610 NULL +#define pci_ss_list_14f1_1611 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_1803[] = { + &pci_ss_info_14f1_1803_0e11_0023, + &pci_ss_info_14f1_1803_0e11_0043, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_14f1_1815[] = { + &pci_ss_info_14f1_1815_0e11_0022, + &pci_ss_info_14f1_1815_0e11_0042, + NULL +}; +#define pci_ss_list_14f1_2003 NULL +#define pci_ss_list_14f1_2004 NULL +#define pci_ss_list_14f1_2005 NULL +#define pci_ss_list_14f1_2006 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_2013[] = { + &pci_ss_info_14f1_2013_0e11_b195, + &pci_ss_info_14f1_2013_0e11_b196, + &pci_ss_info_14f1_2013_0e11_b1be, + &pci_ss_info_14f1_2013_1025_8013, + &pci_ss_info_14f1_2013_1033_809d, + &pci_ss_info_14f1_2013_1033_80bc, + &pci_ss_info_14f1_2013_155d_6793, + &pci_ss_info_14f1_2013_155d_8850, + NULL +}; +#define pci_ss_list_14f1_2014 NULL +#define pci_ss_list_14f1_2015 NULL +#define pci_ss_list_14f1_2016 NULL +#define pci_ss_list_14f1_2043 NULL +#define pci_ss_list_14f1_2044 NULL +#define pci_ss_list_14f1_2045 NULL +#define pci_ss_list_14f1_2046 NULL +#define pci_ss_list_14f1_2063 NULL +#define pci_ss_list_14f1_2064 NULL +#define pci_ss_list_14f1_2065 NULL +#define pci_ss_list_14f1_2066 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_2093[] = { + &pci_ss_info_14f1_2093_155d_2f07, + NULL +}; +#define pci_ss_list_14f1_2143 NULL +#define pci_ss_list_14f1_2144 NULL +#define pci_ss_list_14f1_2145 NULL +#define pci_ss_list_14f1_2146 NULL +#define pci_ss_list_14f1_2163 NULL +#define pci_ss_list_14f1_2164 NULL +#define pci_ss_list_14f1_2165 NULL +#define pci_ss_list_14f1_2166 NULL +#define pci_ss_list_14f1_2343 NULL +#define pci_ss_list_14f1_2344 NULL +#define pci_ss_list_14f1_2345 NULL +#define pci_ss_list_14f1_2346 NULL +#define pci_ss_list_14f1_2363 NULL +#define pci_ss_list_14f1_2364 NULL +#define pci_ss_list_14f1_2365 NULL +#define pci_ss_list_14f1_2366 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_2443[] = { + &pci_ss_info_14f1_2443_104d_8075, + &pci_ss_info_14f1_2443_104d_8083, + &pci_ss_info_14f1_2443_104d_8097, + NULL +}; +#define pci_ss_list_14f1_2444 NULL +#define pci_ss_list_14f1_2445 NULL +#define pci_ss_list_14f1_2446 NULL +#define pci_ss_list_14f1_2463 NULL +#define pci_ss_list_14f1_2464 NULL +#define pci_ss_list_14f1_2465 NULL +#define pci_ss_list_14f1_2466 NULL +static const pciSubsystemInfo *pci_ss_list_14f1_2f00[] = { + &pci_ss_info_14f1_2f00_13e0_8d84, + &pci_ss_info_14f1_2f00_13e0_8d85, + &pci_ss_info_14f1_2f00_14f1_2004, + NULL +}; +#define pci_ss_list_14f1_8234 NULL +#endif +#define pci_ss_list_1507_0001 NULL +#define pci_ss_list_1507_0002 NULL +#define pci_ss_list_1507_0003 NULL +#define pci_ss_list_1507_0100 NULL +#define pci_ss_list_1507_0431 NULL +#define pci_ss_list_1507_4801 NULL +#define pci_ss_list_1507_4802 NULL +#define pci_ss_list_1507_4803 NULL +#define pci_ss_list_1507_4806 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1516_0803[] = { + &pci_ss_info_1516_0803_1320_10bd, + NULL +}; +#endif +#define pci_ss_list_151a_1002 NULL +#define pci_ss_list_151a_1004 NULL +#define pci_ss_list_151a_1008 NULL +#define pci_ss_list_151f_0000 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1522_0100[] = { + &pci_ss_info_1522_0100_1522_0200, + &pci_ss_info_1522_0100_1522_0300, + &pci_ss_info_1522_0100_1522_0400, + &pci_ss_info_1522_0100_1522_0500, + &pci_ss_info_1522_0100_1522_0600, + &pci_ss_info_1522_0100_1522_0700, + &pci_ss_info_1522_0100_1522_0800, + NULL +}; +#endif +#define pci_ss_list_1524_1211 NULL +#define pci_ss_list_1524_1225 NULL +#define pci_ss_list_1524_1410 NULL +#define pci_ss_list_1524_1420 NULL +#define pci_ss_list_1543_3052 NULL +#define pci_ss_list_1543_4c22 NULL +#define pci_ss_list_1571_a001 NULL +#define pci_ss_list_1571_a002 NULL +#define pci_ss_list_1571_a003 NULL +#define pci_ss_list_1571_a004 NULL +#define pci_ss_list_1571_a005 NULL +#define pci_ss_list_1571_a006 NULL +#define pci_ss_list_1571_a007 NULL +#define pci_ss_list_1571_a008 NULL +#define pci_ss_list_1571_a009 NULL +#define pci_ss_list_1571_a00a NULL +#define pci_ss_list_1571_a00b NULL +#define pci_ss_list_1571_a00c NULL +#define pci_ss_list_1571_a00d NULL +#define pci_ss_list_1571_a201 NULL +#define pci_ss_list_1571_a202 NULL +#define pci_ss_list_1571_a203 NULL +#define pci_ss_list_1571_a204 NULL +#define pci_ss_list_1571_a205 NULL +#define pci_ss_list_1571_a206 NULL +#define pci_ss_list_157c_8001 NULL +#define pci_ss_list_1592_0781 NULL +#define pci_ss_list_1592_0782 NULL +#define pci_ss_list_1592_0783 NULL +#define pci_ss_list_1592_0785 NULL +#define pci_ss_list_1592_0786 NULL +#define pci_ss_list_1592_0787 NULL +#define pci_ss_list_1592_0788 NULL +#define pci_ss_list_1592_078a NULL +#define pci_ss_list_15a2_0001 NULL +#define pci_ss_list_15ad_0710 NULL +#define pci_ss_list_15b3_5274 NULL +#define pci_ss_list_15bc_2929 NULL +#define pci_ss_list_15c7_0349 NULL +#define pci_ss_list_15dc_0001 NULL +#define pci_ss_list_15e8_0130 NULL +#define pci_ss_list_1619_0400 NULL +#define pci_ss_list_1619_0440 NULL +#define pci_ss_list_1629_1003 NULL +#define pci_ss_list_1629_2002 NULL +#define pci_ss_list_1638_1100 NULL +#define pci_ss_list_163c_5449 NULL +#define pci_ss_list_165a_c100 NULL +#define pci_ss_list_165a_d200 NULL +#define pci_ss_list_165a_d300 NULL +#define pci_ss_list_16ab_1102 NULL +#define pci_ss_list_16ec_3685 NULL +#define pci_ss_list_173b_03e8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_173b_03ea[] = { + &pci_ss_info_173b_03ea_173b_0001, + NULL +}; +#endif +#define pci_ss_list_1743_8139 NULL +#define pci_ss_list_1796_0001 NULL +#define pci_ss_list_1796_0002 NULL +#define pci_ss_list_1796_0003 NULL +#define pci_ss_list_1796_0004 NULL +#define pci_ss_list_1796_0005 NULL +#define pci_ss_list_1796_0006 NULL +#define pci_ss_list_17cc_2280 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1813_4000[] = { + &pci_ss_info_1813_4000_16be_0001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1813_4100[] = { + &pci_ss_info_1813_4100_16be_0002, + NULL +}; +#endif +#define pci_ss_list_1888_0301 NULL +#define pci_ss_list_1888_0601 NULL +#define pci_ss_list_1888_0710 NULL +#define pci_ss_list_1888_0720 NULL +#define pci_ss_list_1a08_0000 NULL +#define pci_ss_list_1c1c_0001 NULL +#define pci_ss_list_1d44_a400 NULL +#define pci_ss_list_1de1_0391 NULL +#define pci_ss_list_1de1_2020 NULL +#define pci_ss_list_1de1_690c NULL +#define pci_ss_list_1de1_dc29 NULL +#define pci_ss_list_2348_2010 NULL +#define pci_ss_list_3388_0013 NULL +#define pci_ss_list_3388_0014 NULL +#define pci_ss_list_3388_0021 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_3388_8011[] = { + &pci_ss_info_3388_8011_3388_8011, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_3388_8012[] = { + &pci_ss_info_3388_8012_3388_8012, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_3388_8013[] = { + &pci_ss_info_3388_8013_3388_8013, + NULL +}; +#endif +#define pci_ss_list_3d3d_0001 NULL +#define pci_ss_list_3d3d_0002 NULL +#define pci_ss_list_3d3d_0003 NULL +#define pci_ss_list_3d3d_0004 NULL +#define pci_ss_list_3d3d_0005 NULL +#define pci_ss_list_3d3d_0006 NULL +#define pci_ss_list_3d3d_0007 NULL +#define pci_ss_list_3d3d_0008 NULL +static const pciSubsystemInfo *pci_ss_list_3d3d_0009[] = { + &pci_ss_info_3d3d_0009_1040_0011, + &pci_ss_info_3d3d_0009_3d3d_0100, + &pci_ss_info_3d3d_0009_3d3d_0111, + &pci_ss_info_3d3d_0009_3d3d_0114, + &pci_ss_info_3d3d_0009_3d3d_0116, + &pci_ss_info_3d3d_0009_3d3d_0119, + &pci_ss_info_3d3d_0009_3d3d_0120, + &pci_ss_info_3d3d_0009_3d3d_0125, + &pci_ss_info_3d3d_0009_3d3d_0127, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_3d3d_000a[] = { + &pci_ss_info_3d3d_000a_3d3d_0121, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_3d3d_000c[] = { + &pci_ss_info_3d3d_000c_3d3d_0144, + NULL +}; +#define pci_ss_list_3d3d_0100 NULL +#define pci_ss_list_3d3d_1004 NULL +#define pci_ss_list_3d3d_3d04 NULL +#define pci_ss_list_3d3d_ffff NULL +#define pci_ss_list_4005_0300 NULL +#define pci_ss_list_4005_0308 NULL +#define pci_ss_list_4005_0309 NULL +#define pci_ss_list_4005_1064 NULL +#define pci_ss_list_4005_2064 NULL +#define pci_ss_list_4005_2128 NULL +#define pci_ss_list_4005_2301 NULL +#define pci_ss_list_4005_2302 NULL +#define pci_ss_list_4005_2303 NULL +#define pci_ss_list_4005_2364 NULL +#define pci_ss_list_4005_2464 NULL +#define pci_ss_list_4005_2501 NULL +static const pciSubsystemInfo *pci_ss_list_4005_4000[] = { + &pci_ss_info_4005_4000_4005_4000, + NULL +}; +#define pci_ss_list_4005_4710 NULL +#define pci_ss_list_4033_1360 NULL +#define pci_ss_list_416c_0100 NULL +#define pci_ss_list_416c_0200 NULL +#define pci_ss_list_4444_0803 NULL +#define pci_ss_list_4916_1960 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_4a14_5000[] = { + &pci_ss_info_4a14_5000_4a14_5000, + NULL +}; +#endif +#define pci_ss_list_4d51_0200 NULL +#define pci_ss_list_4ddc_0100 NULL +#define pci_ss_list_4ddc_0801 NULL +#define pci_ss_list_4ddc_0802 NULL +#define pci_ss_list_4ddc_0811 NULL +#define pci_ss_list_4ddc_0812 NULL +#define pci_ss_list_4ddc_0881 NULL +#define pci_ss_list_4ddc_0882 NULL +#define pci_ss_list_4ddc_0891 NULL +#define pci_ss_list_4ddc_0892 NULL +#define pci_ss_list_4ddc_0901 NULL +#define pci_ss_list_4ddc_0902 NULL +#define pci_ss_list_4ddc_0903 NULL +#define pci_ss_list_4ddc_0904 NULL +#define pci_ss_list_4ddc_0b01 NULL +#define pci_ss_list_4ddc_0b02 NULL +#define pci_ss_list_4ddc_0b03 NULL +#define pci_ss_list_4ddc_0b04 NULL +#define pci_ss_list_5046_1001 NULL +#define pci_ss_list_5053_2010 NULL +#define pci_ss_list_5145_3031 NULL +#define pci_ss_list_5301_0001 NULL +#define pci_ss_list_5333_0551 NULL +#define pci_ss_list_5333_5631 NULL +#define pci_ss_list_5333_8800 NULL +#define pci_ss_list_5333_8801 NULL +#define pci_ss_list_5333_8810 NULL +#define pci_ss_list_5333_8811 NULL +#define pci_ss_list_5333_8812 NULL +#define pci_ss_list_5333_8813 NULL +#define pci_ss_list_5333_8814 NULL +#define pci_ss_list_5333_8815 NULL +#define pci_ss_list_5333_883d NULL +#define pci_ss_list_5333_8870 NULL +#define pci_ss_list_5333_8880 NULL +#define pci_ss_list_5333_8881 NULL +#define pci_ss_list_5333_8882 NULL +#define pci_ss_list_5333_8883 NULL +#define pci_ss_list_5333_88b0 NULL +#define pci_ss_list_5333_88b1 NULL +#define pci_ss_list_5333_88b2 NULL +#define pci_ss_list_5333_88b3 NULL +#define pci_ss_list_5333_88c0 NULL +#define pci_ss_list_5333_88c1 NULL +#define pci_ss_list_5333_88c2 NULL +#define pci_ss_list_5333_88c3 NULL +#define pci_ss_list_5333_88d0 NULL +#define pci_ss_list_5333_88d1 NULL +#define pci_ss_list_5333_88d2 NULL +#define pci_ss_list_5333_88d3 NULL +#define pci_ss_list_5333_88f0 NULL +#define pci_ss_list_5333_88f1 NULL +#define pci_ss_list_5333_88f2 NULL +#define pci_ss_list_5333_88f3 NULL +static const pciSubsystemInfo *pci_ss_list_5333_8900[] = { + &pci_ss_info_5333_8900_5333_8900, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8901[] = { + &pci_ss_info_5333_8901_5333_8901, + NULL +}; +#define pci_ss_list_5333_8902 NULL +#define pci_ss_list_5333_8903 NULL +static const pciSubsystemInfo *pci_ss_list_5333_8904[] = { + &pci_ss_info_5333_8904_1014_00db, + &pci_ss_info_5333_8904_5333_8904, + NULL +}; +#define pci_ss_list_5333_8905 NULL +#define pci_ss_list_5333_8906 NULL +#define pci_ss_list_5333_8907 NULL +#define pci_ss_list_5333_8908 NULL +#define pci_ss_list_5333_8909 NULL +#define pci_ss_list_5333_890a NULL +#define pci_ss_list_5333_890b NULL +#define pci_ss_list_5333_890c NULL +#define pci_ss_list_5333_890d NULL +#define pci_ss_list_5333_890e NULL +#define pci_ss_list_5333_890f NULL +static const pciSubsystemInfo *pci_ss_list_5333_8a01[] = { + &pci_ss_info_5333_8a01_0e11_b032, + &pci_ss_info_5333_8a01_10b4_1617, + &pci_ss_info_5333_8a01_10b4_1717, + &pci_ss_info_5333_8a01_5333_8a01, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8a10[] = { + &pci_ss_info_5333_8a10_1092_8a10, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8a13[] = { + &pci_ss_info_5333_8a13_5333_8a13, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8a20[] = { + &pci_ss_info_5333_8a20_5333_8a20, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8a21[] = { + &pci_ss_info_5333_8a21_5333_8a21, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8a22[] = { + &pci_ss_info_5333_8a22_1033_8068, + &pci_ss_info_5333_8a22_1033_8069, + &pci_ss_info_5333_8a22_105d_0018, + &pci_ss_info_5333_8a22_105d_002a, + &pci_ss_info_5333_8a22_105d_003a, + &pci_ss_info_5333_8a22_105d_092f, + &pci_ss_info_5333_8a22_1092_4207, + &pci_ss_info_5333_8a22_1092_4800, + &pci_ss_info_5333_8a22_1092_4807, + &pci_ss_info_5333_8a22_1092_4808, + &pci_ss_info_5333_8a22_1092_4809, + &pci_ss_info_5333_8a22_1092_480e, + &pci_ss_info_5333_8a22_1092_4904, + &pci_ss_info_5333_8a22_1092_4905, + &pci_ss_info_5333_8a22_1092_4a09, + &pci_ss_info_5333_8a22_1092_4a0b, + &pci_ss_info_5333_8a22_1092_4a0f, + &pci_ss_info_5333_8a22_1092_4e01, + &pci_ss_info_5333_8a22_1102_101d, + &pci_ss_info_5333_8a22_1102_101e, + &pci_ss_info_5333_8a22_5333_8100, + &pci_ss_info_5333_8a22_5333_8110, + &pci_ss_info_5333_8a22_5333_8125, + &pci_ss_info_5333_8a22_5333_8143, + &pci_ss_info_5333_8a22_5333_8a22, + &pci_ss_info_5333_8a22_5333_8a2e, + &pci_ss_info_5333_8a22_5333_9125, + &pci_ss_info_5333_8a22_5333_9143, + NULL +}; +#define pci_ss_list_5333_8a23 NULL +#define pci_ss_list_5333_8a25 NULL +#define pci_ss_list_5333_8a26 NULL +#define pci_ss_list_5333_8c00 NULL +static const pciSubsystemInfo *pci_ss_list_5333_8c01[] = { + &pci_ss_info_5333_8c01_1179_0001, + NULL +}; +#define pci_ss_list_5333_8c02 NULL +#define pci_ss_list_5333_8c03 NULL +#define pci_ss_list_5333_8c10 NULL +#define pci_ss_list_5333_8c11 NULL +static const pciSubsystemInfo *pci_ss_list_5333_8c12[] = { + &pci_ss_info_5333_8c12_1014_017f, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_5333_8c13[] = { + &pci_ss_info_5333_8c13_1179_0001, + NULL +}; +#define pci_ss_list_5333_8c22 NULL +#define pci_ss_list_5333_8c24 NULL +#define pci_ss_list_5333_8c26 NULL +#define pci_ss_list_5333_8c2a NULL +#define pci_ss_list_5333_8c2b NULL +#define pci_ss_list_5333_8c2c NULL +#define pci_ss_list_5333_8c2d NULL +static const pciSubsystemInfo *pci_ss_list_5333_8c2e[] = { + &pci_ss_info_5333_8c2e_1014_01fc, + NULL +}; +#define pci_ss_list_5333_8c2f NULL +#define pci_ss_list_5333_8d01 NULL +#define pci_ss_list_5333_8d02 NULL +#define pci_ss_list_5333_8d03 NULL +#define pci_ss_list_5333_8d04 NULL +static const pciSubsystemInfo *pci_ss_list_5333_9102[] = { + &pci_ss_info_5333_9102_1092_5932, + &pci_ss_info_5333_9102_1092_5934, + &pci_ss_info_5333_9102_1092_5952, + &pci_ss_info_5333_9102_1092_5954, + &pci_ss_info_5333_9102_1092_5a35, + &pci_ss_info_5333_9102_1092_5a37, + &pci_ss_info_5333_9102_1092_5a55, + &pci_ss_info_5333_9102_1092_5a57, + NULL +}; +#define pci_ss_list_5333_ca00 NULL +#define pci_ss_list_5455_4458 NULL +#define pci_ss_list_5544_0001 NULL +#define pci_ss_list_5555_0003 NULL +#define pci_ss_list_6374_6773 NULL +#define pci_ss_list_6666_0001 NULL +#define pci_ss_list_6666_0002 NULL +#define pci_ss_list_8008_0010 NULL +#define pci_ss_list_8008_0011 NULL +#define pci_ss_list_8086_0007 NULL +#define pci_ss_list_8086_0008 NULL +#define pci_ss_list_8086_0039 NULL +#define pci_ss_list_8086_0122 NULL +#define pci_ss_list_8086_0482 NULL +#define pci_ss_list_8086_0483 NULL +#define pci_ss_list_8086_0484 NULL +#define pci_ss_list_8086_0486 NULL +#define pci_ss_list_8086_04a3 NULL +#define pci_ss_list_8086_04d0 NULL +#define pci_ss_list_8086_0600 NULL +#define pci_ss_list_8086_0960 NULL +#define pci_ss_list_8086_0962 NULL +#define pci_ss_list_8086_0964 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1000[] = { + &pci_ss_info_8086_1000_0e11_b0df, + &pci_ss_info_8086_1000_0e11_b0e0, + &pci_ss_info_8086_1000_0e11_b123, + &pci_ss_info_8086_1000_1014_0119, + &pci_ss_info_8086_1000_8086_1000, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1001[] = { + &pci_ss_info_8086_1001_0e11_004a, + &pci_ss_info_8086_1001_1014_01ea, + &pci_ss_info_8086_1001_8086_1003, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1002[] = { + &pci_ss_info_8086_1002_8086_200e, + &pci_ss_info_8086_1002_8086_2013, + &pci_ss_info_8086_1002_8086_2017, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1004[] = { + &pci_ss_info_8086_1004_0e11_0049, + &pci_ss_info_8086_1004_0e11_b1a4, + &pci_ss_info_8086_1004_1014_10f2, + &pci_ss_info_8086_1004_8086_1004, + &pci_ss_info_8086_1004_8086_2004, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1008[] = { + &pci_ss_info_8086_1008_8086_1107, + &pci_ss_info_8086_1008_8086_2107, + &pci_ss_info_8086_1008_8086_2110, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1009[] = { + &pci_ss_info_8086_1009_8086_1109, + &pci_ss_info_8086_1009_8086_2109, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_100c[] = { + &pci_ss_info_8086_100c_8086_1112, + &pci_ss_info_8086_100c_8086_2112, + NULL +}; +#define pci_ss_list_8086_100d NULL +static const pciSubsystemInfo *pci_ss_list_8086_100e[] = { + &pci_ss_info_8086_100e_8086_001e, + &pci_ss_info_8086_100e_8086_002e, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_100f[] = { + &pci_ss_info_8086_100f_8086_1001, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1010[] = { + &pci_ss_info_8086_1010_8086_1011, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1011[] = { + &pci_ss_info_8086_1011_8086_1002, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1012[] = { + &pci_ss_info_8086_1012_8086_1012, + NULL +}; +#define pci_ss_list_8086_1015 NULL +#define pci_ss_list_8086_1029 NULL +#define pci_ss_list_8086_1030 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1031[] = { + &pci_ss_info_8086_1031_1014_0209, + &pci_ss_info_8086_1031_104d_80e7, + &pci_ss_info_8086_1031_107b_5350, + &pci_ss_info_8086_1031_1179_0001, + &pci_ss_info_8086_1031_144d_c000, + &pci_ss_info_8086_1031_144d_c001, + &pci_ss_info_8086_1031_144d_c003, + &pci_ss_info_8086_1031_144d_c006, + NULL +}; +#define pci_ss_list_8086_1032 NULL +#define pci_ss_list_8086_1033 NULL +#define pci_ss_list_8086_1034 NULL +#define pci_ss_list_8086_1035 NULL +#define pci_ss_list_8086_1036 NULL +#define pci_ss_list_8086_1037 NULL +#define pci_ss_list_8086_1038 NULL +#define pci_ss_list_8086_1039 NULL +#define pci_ss_list_8086_103a NULL +#define pci_ss_list_8086_103b NULL +#define pci_ss_list_8086_103c NULL +#define pci_ss_list_8086_103d NULL +#define pci_ss_list_8086_103e NULL +static const pciSubsystemInfo *pci_ss_list_8086_1040[] = { + &pci_ss_info_8086_1040_16be_1040, + NULL +}; +#define pci_ss_list_8086_1059 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1130[] = { + &pci_ss_info_8086_1130_1025_1016, + &pci_ss_info_8086_1130_1043_8027, + &pci_ss_info_8086_1130_104d_80df, + NULL +}; +#define pci_ss_list_8086_1131 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1132[] = { + &pci_ss_info_8086_1132_1025_1016, + &pci_ss_info_8086_1132_104d_80df, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1161[] = { + &pci_ss_info_8086_1161_8086_1161, + NULL +}; +#define pci_ss_list_8086_1162 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1200[] = { + &pci_ss_info_8086_1200_172a_0000, + NULL +}; +#define pci_ss_list_8086_1209 NULL +#define pci_ss_list_8086_1221 NULL +#define pci_ss_list_8086_1222 NULL +#define pci_ss_list_8086_1223 NULL +#define pci_ss_list_8086_1225 NULL +#define pci_ss_list_8086_1226 NULL +#define pci_ss_list_8086_1227 NULL +#define pci_ss_list_8086_1228 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1229[] = { + &pci_ss_info_8086_1229_0e11_3001, + &pci_ss_info_8086_1229_0e11_3002, + &pci_ss_info_8086_1229_0e11_3003, + &pci_ss_info_8086_1229_0e11_3004, + &pci_ss_info_8086_1229_0e11_3005, + &pci_ss_info_8086_1229_0e11_3006, + &pci_ss_info_8086_1229_0e11_3007, + &pci_ss_info_8086_1229_0e11_b01e, + &pci_ss_info_8086_1229_0e11_b01f, + &pci_ss_info_8086_1229_0e11_b02f, + &pci_ss_info_8086_1229_0e11_b04a, + &pci_ss_info_8086_1229_0e11_b0c6, + &pci_ss_info_8086_1229_0e11_b0c7, + &pci_ss_info_8086_1229_0e11_b0d7, + &pci_ss_info_8086_1229_0e11_b0dd, + &pci_ss_info_8086_1229_0e11_b0de, + &pci_ss_info_8086_1229_0e11_b0e1, + &pci_ss_info_8086_1229_0e11_b134, + &pci_ss_info_8086_1229_0e11_b13c, + &pci_ss_info_8086_1229_0e11_b144, + &pci_ss_info_8086_1229_0e11_b163, + &pci_ss_info_8086_1229_0e11_b164, + &pci_ss_info_8086_1229_0e11_b1a4, + &pci_ss_info_8086_1229_1014_005c, + &pci_ss_info_8086_1229_1014_01bc, + &pci_ss_info_8086_1229_1014_01f1, + &pci_ss_info_8086_1229_1014_01f2, + &pci_ss_info_8086_1229_1014_0207, + &pci_ss_info_8086_1229_1014_0232, + &pci_ss_info_8086_1229_1014_023a, + &pci_ss_info_8086_1229_1014_105c, + &pci_ss_info_8086_1229_1014_2205, + &pci_ss_info_8086_1229_1014_305c, + &pci_ss_info_8086_1229_1014_405c, + &pci_ss_info_8086_1229_1014_505c, + &pci_ss_info_8086_1229_1014_605c, + &pci_ss_info_8086_1229_1014_705c, + &pci_ss_info_8086_1229_1014_805c, + &pci_ss_info_8086_1229_1028_009b, + &pci_ss_info_8086_1229_1033_8000, + &pci_ss_info_8086_1229_1033_8016, + &pci_ss_info_8086_1229_1033_801f, + &pci_ss_info_8086_1229_1033_8026, + &pci_ss_info_8086_1229_1033_8063, + &pci_ss_info_8086_1229_1033_8064, + &pci_ss_info_8086_1229_103c_10c0, + &pci_ss_info_8086_1229_103c_10c3, + &pci_ss_info_8086_1229_103c_10ca, + &pci_ss_info_8086_1229_103c_10cb, + &pci_ss_info_8086_1229_103c_10e3, + &pci_ss_info_8086_1229_103c_10e4, + &pci_ss_info_8086_1229_103c_1200, + &pci_ss_info_8086_1229_10c3_1100, + &pci_ss_info_8086_1229_10cf_1115, + &pci_ss_info_8086_1229_10cf_1143, + &pci_ss_info_8086_1229_1179_0001, + &pci_ss_info_8086_1229_1179_0002, + &pci_ss_info_8086_1229_1179_0003, + &pci_ss_info_8086_1229_1259_2560, + &pci_ss_info_8086_1229_1259_2561, + &pci_ss_info_8086_1229_1266_0001, + &pci_ss_info_8086_1229_144d_2501, + &pci_ss_info_8086_1229_144d_2502, + &pci_ss_info_8086_1229_1668_1100, + &pci_ss_info_8086_1229_8086_0001, + &pci_ss_info_8086_1229_8086_0002, + &pci_ss_info_8086_1229_8086_0003, + &pci_ss_info_8086_1229_8086_0004, + &pci_ss_info_8086_1229_8086_0005, + &pci_ss_info_8086_1229_8086_0006, + &pci_ss_info_8086_1229_8086_0007, + &pci_ss_info_8086_1229_8086_0008, + &pci_ss_info_8086_1229_8086_0009, + &pci_ss_info_8086_1229_8086_000a, + &pci_ss_info_8086_1229_8086_000b, + &pci_ss_info_8086_1229_8086_000c, + &pci_ss_info_8086_1229_8086_000d, + &pci_ss_info_8086_1229_8086_000e, + &pci_ss_info_8086_1229_8086_000f, + &pci_ss_info_8086_1229_8086_0010, + &pci_ss_info_8086_1229_8086_0011, + &pci_ss_info_8086_1229_8086_0012, + &pci_ss_info_8086_1229_8086_0013, + &pci_ss_info_8086_1229_8086_0030, + &pci_ss_info_8086_1229_8086_0031, + &pci_ss_info_8086_1229_8086_0040, + &pci_ss_info_8086_1229_8086_0041, + &pci_ss_info_8086_1229_8086_0042, + &pci_ss_info_8086_1229_8086_0050, + &pci_ss_info_8086_1229_8086_1009, + &pci_ss_info_8086_1229_8086_100c, + &pci_ss_info_8086_1229_8086_1012, + &pci_ss_info_8086_1229_8086_1013, + &pci_ss_info_8086_1229_8086_1015, + &pci_ss_info_8086_1229_8086_1017, + &pci_ss_info_8086_1229_8086_1030, + &pci_ss_info_8086_1229_8086_1040, + &pci_ss_info_8086_1229_8086_1041, + &pci_ss_info_8086_1229_8086_1042, + &pci_ss_info_8086_1229_8086_1050, + &pci_ss_info_8086_1229_8086_1051, + &pci_ss_info_8086_1229_8086_1052, + &pci_ss_info_8086_1229_8086_10f0, + &pci_ss_info_8086_1229_8086_2009, + &pci_ss_info_8086_1229_8086_200d, + &pci_ss_info_8086_1229_8086_200e, + &pci_ss_info_8086_1229_8086_200f, + &pci_ss_info_8086_1229_8086_2010, + &pci_ss_info_8086_1229_8086_2013, + &pci_ss_info_8086_1229_8086_2016, + &pci_ss_info_8086_1229_8086_2017, + &pci_ss_info_8086_1229_8086_2018, + &pci_ss_info_8086_1229_8086_2019, + &pci_ss_info_8086_1229_8086_2101, + &pci_ss_info_8086_1229_8086_2102, + &pci_ss_info_8086_1229_8086_2103, + &pci_ss_info_8086_1229_8086_2104, + &pci_ss_info_8086_1229_8086_2105, + &pci_ss_info_8086_1229_8086_2106, + &pci_ss_info_8086_1229_8086_2107, + &pci_ss_info_8086_1229_8086_2108, + &pci_ss_info_8086_1229_8086_2200, + &pci_ss_info_8086_1229_8086_2201, + &pci_ss_info_8086_1229_8086_2202, + &pci_ss_info_8086_1229_8086_2203, + &pci_ss_info_8086_1229_8086_2204, + &pci_ss_info_8086_1229_8086_2205, + &pci_ss_info_8086_1229_8086_2206, + &pci_ss_info_8086_1229_8086_2207, + &pci_ss_info_8086_1229_8086_2208, + &pci_ss_info_8086_1229_8086_2402, + &pci_ss_info_8086_1229_8086_2407, + &pci_ss_info_8086_1229_8086_2408, + &pci_ss_info_8086_1229_8086_2409, + &pci_ss_info_8086_1229_8086_240f, + &pci_ss_info_8086_1229_8086_2410, + &pci_ss_info_8086_1229_8086_2411, + &pci_ss_info_8086_1229_8086_2412, + &pci_ss_info_8086_1229_8086_2413, + &pci_ss_info_8086_1229_8086_3000, + &pci_ss_info_8086_1229_8086_3001, + &pci_ss_info_8086_1229_8086_3002, + &pci_ss_info_8086_1229_8086_3006, + &pci_ss_info_8086_1229_8086_3007, + &pci_ss_info_8086_1229_8086_3008, + &pci_ss_info_8086_1229_8086_3010, + &pci_ss_info_8086_1229_8086_3011, + &pci_ss_info_8086_1229_8086_3012, + NULL +}; +#define pci_ss_list_8086_122d NULL +#define pci_ss_list_8086_122e NULL +#define pci_ss_list_8086_1230 NULL +#define pci_ss_list_8086_1231 NULL +#define pci_ss_list_8086_1234 NULL +#define pci_ss_list_8086_1235 NULL +#define pci_ss_list_8086_1237 NULL +#define pci_ss_list_8086_1239 NULL +#define pci_ss_list_8086_123b NULL +#define pci_ss_list_8086_123c NULL +#define pci_ss_list_8086_123d NULL +#define pci_ss_list_8086_123f NULL +#define pci_ss_list_8086_1240 NULL +#define pci_ss_list_8086_124b NULL +#define pci_ss_list_8086_1250 NULL +#define pci_ss_list_8086_1360 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1361[] = { + &pci_ss_info_8086_1361_8086_1361, + &pci_ss_info_8086_1361_8086_8000, + NULL +}; +#define pci_ss_list_8086_1460 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1461[] = { + &pci_ss_info_8086_1461_15d9_3480, + NULL +}; +#define pci_ss_list_8086_1462 NULL +static const pciSubsystemInfo *pci_ss_list_8086_1960[] = { + &pci_ss_info_8086_1960_101e_0431, + &pci_ss_info_8086_1960_101e_0438, + &pci_ss_info_8086_1960_101e_0466, + &pci_ss_info_8086_1960_101e_0467, + &pci_ss_info_8086_1960_101e_0490, + &pci_ss_info_8086_1960_101e_0762, + &pci_ss_info_8086_1960_101e_09a0, + &pci_ss_info_8086_1960_1028_0467, + &pci_ss_info_8086_1960_1028_1111, + &pci_ss_info_8086_1960_103c_03a2, + &pci_ss_info_8086_1960_103c_10c6, + &pci_ss_info_8086_1960_103c_10c7, + &pci_ss_info_8086_1960_103c_10cc, + &pci_ss_info_8086_1960_103c_10cd, + &pci_ss_info_8086_1960_105a_0000, + &pci_ss_info_8086_1960_105a_2168, + &pci_ss_info_8086_1960_105a_5168, + &pci_ss_info_8086_1960_1111_1111, + &pci_ss_info_8086_1960_1111_1112, + &pci_ss_info_8086_1960_113c_03a2, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_1962[] = { + &pci_ss_info_8086_1962_105a_0000, + NULL +}; +#define pci_ss_list_8086_1a21 NULL +#define pci_ss_list_8086_1a23 NULL +#define pci_ss_list_8086_1a24 NULL +#define pci_ss_list_8086_1a30 NULL +#define pci_ss_list_8086_1a31 NULL +#define pci_ss_list_8086_2410 NULL +#define pci_ss_list_8086_2411 NULL +#define pci_ss_list_8086_2412 NULL +#define pci_ss_list_8086_2413 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2415[] = { + &pci_ss_info_8086_2415_1028_0095, + &pci_ss_info_8086_2415_11d4_0040, + &pci_ss_info_8086_2415_11d4_0048, + &pci_ss_info_8086_2415_11d4_5340, + NULL +}; +#define pci_ss_list_8086_2416 NULL +#define pci_ss_list_8086_2418 NULL +#define pci_ss_list_8086_2420 NULL +#define pci_ss_list_8086_2421 NULL +#define pci_ss_list_8086_2422 NULL +#define pci_ss_list_8086_2423 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2425[] = { + &pci_ss_info_8086_2425_11d4_0040, + &pci_ss_info_8086_2425_11d4_0048, + NULL +}; +#define pci_ss_list_8086_2426 NULL +#define pci_ss_list_8086_2428 NULL +#define pci_ss_list_8086_2440 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2442[] = { + &pci_ss_info_8086_2442_1014_01c6, + &pci_ss_info_8086_2442_1025_1016, + &pci_ss_info_8086_2442_104d_80df, + &pci_ss_info_8086_2442_147b_0507, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2443[] = { + &pci_ss_info_8086_2443_1014_01c6, + &pci_ss_info_8086_2443_1025_1016, + &pci_ss_info_8086_2443_1043_8027, + &pci_ss_info_8086_2443_104d_80df, + &pci_ss_info_8086_2443_147b_0507, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2444[] = { + &pci_ss_info_8086_2444_1025_1016, + &pci_ss_info_8086_2444_104d_80df, + &pci_ss_info_8086_2444_147b_0507, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2445[] = { + &pci_ss_info_8086_2445_1014_01c6, + &pci_ss_info_8086_2445_1025_1016, + &pci_ss_info_8086_2445_104d_80df, + &pci_ss_info_8086_2445_1462_3370, + &pci_ss_info_8086_2445_147b_0507, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2446[] = { + &pci_ss_info_8086_2446_1025_1016, + &pci_ss_info_8086_2446_104d_80df, + NULL +}; +#define pci_ss_list_8086_2448 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2449[] = { + &pci_ss_info_8086_2449_0e11_0012, + &pci_ss_info_8086_2449_0e11_0091, + &pci_ss_info_8086_2449_1014_01ce, + &pci_ss_info_8086_2449_1014_01dc, + &pci_ss_info_8086_2449_1014_01eb, + &pci_ss_info_8086_2449_1014_01ec, + &pci_ss_info_8086_2449_1014_0202, + &pci_ss_info_8086_2449_1014_0205, + &pci_ss_info_8086_2449_1014_0217, + &pci_ss_info_8086_2449_1014_0234, + &pci_ss_info_8086_2449_1014_023d, + &pci_ss_info_8086_2449_1014_0244, + &pci_ss_info_8086_2449_1014_0245, + &pci_ss_info_8086_2449_109f_315d, + &pci_ss_info_8086_2449_109f_3181, + &pci_ss_info_8086_2449_1186_7801, + &pci_ss_info_8086_2449_144d_2602, + &pci_ss_info_8086_2449_8086_3010, + &pci_ss_info_8086_2449_8086_3011, + &pci_ss_info_8086_2449_8086_3012, + &pci_ss_info_8086_2449_8086_3013, + &pci_ss_info_8086_2449_8086_3014, + &pci_ss_info_8086_2449_8086_3015, + &pci_ss_info_8086_2449_8086_3016, + &pci_ss_info_8086_2449_8086_3017, + &pci_ss_info_8086_2449_8086_3018, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_244a[] = { + &pci_ss_info_8086_244a_1025_1016, + &pci_ss_info_8086_244a_104d_80df, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_244b[] = { + &pci_ss_info_8086_244b_1014_01c6, + &pci_ss_info_8086_244b_1043_8027, + &pci_ss_info_8086_244b_147b_0507, + NULL +}; +#define pci_ss_list_8086_244c NULL +#define pci_ss_list_8086_244e NULL +#define pci_ss_list_8086_2450 NULL +#define pci_ss_list_8086_2452 NULL +#define pci_ss_list_8086_2453 NULL +#define pci_ss_list_8086_2459 NULL +#define pci_ss_list_8086_245b NULL +#define pci_ss_list_8086_245d NULL +#define pci_ss_list_8086_245e NULL +#define pci_ss_list_8086_2480 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2482[] = { + &pci_ss_info_8086_2482_1014_0220, + &pci_ss_info_8086_2482_104d_80e7, + &pci_ss_info_8086_2482_15d9_3480, + &pci_ss_info_8086_2482_8086_1958, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2483[] = { + &pci_ss_info_8086_2483_1014_0220, + &pci_ss_info_8086_2483_104d_80e7, + &pci_ss_info_8086_2483_15d9_3480, + &pci_ss_info_8086_2483_8086_1958, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2484[] = { + &pci_ss_info_8086_2484_1014_0220, + &pci_ss_info_8086_2484_104d_80e7, + &pci_ss_info_8086_2484_15d9_3480, + &pci_ss_info_8086_2484_8086_1958, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2485[] = { + &pci_ss_info_8086_2485_1014_0222, + &pci_ss_info_8086_2485_1014_0508, + &pci_ss_info_8086_2485_1014_051c, + &pci_ss_info_8086_2485_104d_80e7, + &pci_ss_info_8086_2485_144d_c006, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2486[] = { + &pci_ss_info_8086_2486_1014_0223, + &pci_ss_info_8086_2486_1014_0503, + &pci_ss_info_8086_2486_1014_051a, + &pci_ss_info_8086_2486_104d_80e7, + &pci_ss_info_8086_2486_1179_0001, + &pci_ss_info_8086_2486_134d_4c21, + &pci_ss_info_8086_2486_144d_2115, + &pci_ss_info_8086_2486_14f1_5421, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2487[] = { + &pci_ss_info_8086_2487_1014_0220, + &pci_ss_info_8086_2487_104d_80e7, + &pci_ss_info_8086_2487_15d9_3480, + &pci_ss_info_8086_2487_8086_1958, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_248a[] = { + &pci_ss_info_8086_248a_1014_0220, + &pci_ss_info_8086_248a_104d_80e7, + &pci_ss_info_8086_248a_8086_1958, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_248b[] = { + &pci_ss_info_8086_248b_15d9_3480, + NULL +}; +#define pci_ss_list_8086_248c NULL +static const pciSubsystemInfo *pci_ss_list_8086_24c0[] = { + &pci_ss_info_8086_24c0_1462_5800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_24c2[] = { + &pci_ss_info_8086_24c2_1462_5800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_24c3[] = { + &pci_ss_info_8086_24c3_1462_5800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_24c4[] = { + &pci_ss_info_8086_24c4_1462_5800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_24c5[] = { + &pci_ss_info_8086_24c5_1462_5800, + NULL +}; +#define pci_ss_list_8086_24c6 NULL +static const pciSubsystemInfo *pci_ss_list_8086_24c7[] = { + &pci_ss_info_8086_24c7_1462_5800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_24cb[] = { + &pci_ss_info_8086_24cb_1462_5800, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_24cd[] = { + &pci_ss_info_8086_24cd_1462_3981, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2500[] = { + &pci_ss_info_8086_2500_1028_0095, + &pci_ss_info_8086_2500_1043_801c, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2501[] = { + &pci_ss_info_8086_2501_1043_801c, + NULL +}; +#define pci_ss_list_8086_250b NULL +#define pci_ss_list_8086_250f NULL +#define pci_ss_list_8086_2520 NULL +#define pci_ss_list_8086_2521 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2530[] = { + &pci_ss_info_8086_2530_147b_0507, + NULL +}; +#define pci_ss_list_8086_2531 NULL +#define pci_ss_list_8086_2532 NULL +#define pci_ss_list_8086_2533 NULL +#define pci_ss_list_8086_2534 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2540[] = { + &pci_ss_info_8086_2540_15d9_3480, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_8086_2541[] = { + &pci_ss_info_8086_2541_15d9_3480, + NULL +}; +#define pci_ss_list_8086_2543 NULL +#define pci_ss_list_8086_2544 NULL +#define pci_ss_list_8086_2545 NULL +#define pci_ss_list_8086_2546 NULL +#define pci_ss_list_8086_2547 NULL +#define pci_ss_list_8086_2548 NULL +static const pciSubsystemInfo *pci_ss_list_8086_2560[] = { + &pci_ss_info_8086_2560_1462_5800, + NULL +}; +#define pci_ss_list_8086_2561 NULL +#define pci_ss_list_8086_2562 NULL +#define pci_ss_list_8086_2570 NULL +#define pci_ss_list_8086_2572 NULL +#define pci_ss_list_8086_3092 NULL +static const pciSubsystemInfo *pci_ss_list_8086_3575[] = { + &pci_ss_info_8086_3575_1014_021d, + &pci_ss_info_8086_3575_104d_80e7, + NULL +}; +#define pci_ss_list_8086_3576 NULL +static const pciSubsystemInfo *pci_ss_list_8086_3577[] = { + &pci_ss_info_8086_3577_1014_0513, + NULL +}; +#define pci_ss_list_8086_3578 NULL +#define pci_ss_list_8086_3580 NULL +#define pci_ss_list_8086_3582 NULL +#define pci_ss_list_8086_5200 NULL +static const pciSubsystemInfo *pci_ss_list_8086_5201[] = { + &pci_ss_info_8086_5201_8086_0001, + NULL +}; +#define pci_ss_list_8086_530d NULL +#define pci_ss_list_8086_7000 NULL +#define pci_ss_list_8086_7010 NULL +#define pci_ss_list_8086_7020 NULL +#define pci_ss_list_8086_7030 NULL +#define pci_ss_list_8086_7100 NULL +#define pci_ss_list_8086_7110 NULL +#define pci_ss_list_8086_7111 NULL +#define pci_ss_list_8086_7112 NULL +#define pci_ss_list_8086_7113 NULL +#define pci_ss_list_8086_7120 NULL +#define pci_ss_list_8086_7121 NULL +#define pci_ss_list_8086_7122 NULL +#define pci_ss_list_8086_7123 NULL +#define pci_ss_list_8086_7124 NULL +#define pci_ss_list_8086_7125 NULL +#define pci_ss_list_8086_7126 NULL +#define pci_ss_list_8086_7128 NULL +#define pci_ss_list_8086_712a NULL +#define pci_ss_list_8086_7180 NULL +#define pci_ss_list_8086_7181 NULL +static const pciSubsystemInfo *pci_ss_list_8086_7190[] = { + &pci_ss_info_8086_7190_0e11_0500, + &pci_ss_info_8086_7190_0e11_b110, + &pci_ss_info_8086_7190_1179_0001, + NULL +}; +#define pci_ss_list_8086_7191 NULL +static const pciSubsystemInfo *pci_ss_list_8086_7192[] = { + &pci_ss_info_8086_7192_0e11_0460, + NULL +}; +#define pci_ss_list_8086_7194 NULL +static const pciSubsystemInfo *pci_ss_list_8086_7195[] = { + &pci_ss_info_8086_7195_10cf_1099, + &pci_ss_info_8086_7195_11d4_0040, + &pci_ss_info_8086_7195_11d4_0048, + NULL +}; +#define pci_ss_list_8086_7196 NULL +#define pci_ss_list_8086_7198 NULL +#define pci_ss_list_8086_7199 NULL +#define pci_ss_list_8086_719a NULL +#define pci_ss_list_8086_719b NULL +#define pci_ss_list_8086_71a0 NULL +#define pci_ss_list_8086_71a1 NULL +#define pci_ss_list_8086_71a2 NULL +#define pci_ss_list_8086_7600 NULL +#define pci_ss_list_8086_7601 NULL +#define pci_ss_list_8086_7602 NULL +#define pci_ss_list_8086_7603 NULL +static const pciSubsystemInfo *pci_ss_list_8086_7800[] = { + &pci_ss_info_8086_7800_003d_0008, + &pci_ss_info_8086_7800_003d_000b, + &pci_ss_info_8086_7800_1092_0100, + &pci_ss_info_8086_7800_10b4_201a, + &pci_ss_info_8086_7800_10b4_202f, + &pci_ss_info_8086_7800_8086_0000, + &pci_ss_info_8086_7800_8086_0100, + NULL +}; +#define pci_ss_list_8086_84c4 NULL +#define pci_ss_list_8086_84c5 NULL +#define pci_ss_list_8086_84ca NULL +#define pci_ss_list_8086_84cb NULL +#define pci_ss_list_8086_84e0 NULL +#define pci_ss_list_8086_84e1 NULL +#define pci_ss_list_8086_84e2 NULL +#define pci_ss_list_8086_84e3 NULL +#define pci_ss_list_8086_84e4 NULL +#define pci_ss_list_8086_84e6 NULL +#define pci_ss_list_8086_84ea NULL +#define pci_ss_list_8086_9621 NULL +#define pci_ss_list_8086_9622 NULL +#define pci_ss_list_8086_9641 NULL +#define pci_ss_list_8086_96a1 NULL +#define pci_ss_list_8086_b152 NULL +#define pci_ss_list_8086_b154 NULL +static const pciSubsystemInfo *pci_ss_list_8086_b555[] = { + &pci_ss_info_8086_b555_e4bf_1000, + NULL +}; +#define pci_ss_list_8086_ffff NULL +#define pci_ss_list_8800_2008 NULL +#define pci_ss_list_8e2e_3000 NULL +#define pci_ss_list_9004_1078 NULL +#define pci_ss_list_9004_1160 NULL +#define pci_ss_list_9004_2178 NULL +#define pci_ss_list_9004_3860 NULL +#define pci_ss_list_9004_3b78 NULL +#define pci_ss_list_9004_5075 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_9004_5078[] = { + &pci_ss_info_9004_5078_9004_7850, + NULL +}; +#define pci_ss_list_9004_5175 NULL +#define pci_ss_list_9004_5178 NULL +#define pci_ss_list_9004_5275 NULL +#define pci_ss_list_9004_5278 NULL +#define pci_ss_list_9004_5375 NULL +#define pci_ss_list_9004_5378 NULL +#define pci_ss_list_9004_5475 NULL +#define pci_ss_list_9004_5478 NULL +#define pci_ss_list_9004_5575 NULL +#define pci_ss_list_9004_5578 NULL +static const pciSubsystemInfo *pci_ss_list_9004_5647[] = { + &pci_ss_info_9004_5647_9004_7710, + &pci_ss_info_9004_5647_9004_7711, + NULL +}; +#define pci_ss_list_9004_5675 NULL +#define pci_ss_list_9004_5678 NULL +#define pci_ss_list_9004_5775 NULL +#define pci_ss_list_9004_5778 NULL +#define pci_ss_list_9004_5800 NULL +#define pci_ss_list_9004_5900 NULL +#define pci_ss_list_9004_5905 NULL +#define pci_ss_list_9004_6038 NULL +static const pciSubsystemInfo *pci_ss_list_9004_6075[] = { + &pci_ss_info_9004_6075_9004_7560, + NULL +}; +#define pci_ss_list_9004_6078 NULL +static const pciSubsystemInfo *pci_ss_list_9004_6178[] = { + &pci_ss_info_9004_6178_9004_7861, + NULL +}; +#define pci_ss_list_9004_6278 NULL +#define pci_ss_list_9004_6378 NULL +#define pci_ss_list_9004_6478 NULL +#define pci_ss_list_9004_6578 NULL +#define pci_ss_list_9004_6678 NULL +#define pci_ss_list_9004_6778 NULL +static const pciSubsystemInfo *pci_ss_list_9004_6915[] = { + &pci_ss_info_9004_6915_9004_0008, + &pci_ss_info_9004_6915_9004_0009, + &pci_ss_info_9004_6915_9004_0010, + &pci_ss_info_9004_6915_9004_0018, + &pci_ss_info_9004_6915_9004_0019, + &pci_ss_info_9004_6915_9004_0020, + &pci_ss_info_9004_6915_9004_0028, + &pci_ss_info_9004_6915_9004_8008, + &pci_ss_info_9004_6915_9004_8009, + &pci_ss_info_9004_6915_9004_8010, + &pci_ss_info_9004_6915_9004_8018, + &pci_ss_info_9004_6915_9004_8019, + &pci_ss_info_9004_6915_9004_8020, + &pci_ss_info_9004_6915_9004_8028, + NULL +}; +#define pci_ss_list_9004_7078 NULL +#define pci_ss_list_9004_7178 NULL +#define pci_ss_list_9004_7278 NULL +#define pci_ss_list_9004_7378 NULL +#define pci_ss_list_9004_7478 NULL +#define pci_ss_list_9004_7578 NULL +#define pci_ss_list_9004_7678 NULL +#define pci_ss_list_9004_7778 NULL +#define pci_ss_list_9004_7810 NULL +static const pciSubsystemInfo *pci_ss_list_9004_7815[] = { + &pci_ss_info_9004_7815_9004_7815, + &pci_ss_info_9004_7815_9004_7840, + NULL +}; +#define pci_ss_list_9004_7850 NULL +#define pci_ss_list_9004_7855 NULL +#define pci_ss_list_9004_7860 NULL +#define pci_ss_list_9004_7870 NULL +#define pci_ss_list_9004_7871 NULL +#define pci_ss_list_9004_7872 NULL +#define pci_ss_list_9004_7873 NULL +#define pci_ss_list_9004_7874 NULL +#define pci_ss_list_9004_7880 NULL +#define pci_ss_list_9004_7890 NULL +#define pci_ss_list_9004_7891 NULL +#define pci_ss_list_9004_7892 NULL +#define pci_ss_list_9004_7893 NULL +#define pci_ss_list_9004_7894 NULL +static const pciSubsystemInfo *pci_ss_list_9004_7895[] = { + &pci_ss_info_9004_7895_9004_7890, + &pci_ss_info_9004_7895_9004_7891, + &pci_ss_info_9004_7895_9004_7892, + &pci_ss_info_9004_7895_9004_7894, + &pci_ss_info_9004_7895_9004_7895, + &pci_ss_info_9004_7895_9004_7896, + &pci_ss_info_9004_7895_9004_7897, + NULL +}; +#define pci_ss_list_9004_7896 NULL +#define pci_ss_list_9004_7897 NULL +static const pciSubsystemInfo *pci_ss_list_9004_8078[] = { + &pci_ss_info_9004_8078_9004_7880, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9004_8178[] = { + &pci_ss_info_9004_8178_9004_7881, + NULL +}; +#define pci_ss_list_9004_8278 NULL +#define pci_ss_list_9004_8378 NULL +#define pci_ss_list_9004_8478 NULL +#define pci_ss_list_9004_8578 NULL +#define pci_ss_list_9004_8678 NULL +static const pciSubsystemInfo *pci_ss_list_9004_8778[] = { + &pci_ss_info_9004_8778_9004_7887, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9004_8878[] = { + &pci_ss_info_9004_8878_9004_7888, + NULL +}; +#define pci_ss_list_9004_8b78 NULL +#define pci_ss_list_9004_ec78 NULL +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_9005_0010[] = { + &pci_ss_info_9005_0010_9005_2180, + &pci_ss_info_9005_0010_9005_8100, + &pci_ss_info_9005_0010_9005_a180, + &pci_ss_info_9005_0010_9005_e100, + NULL +}; +#define pci_ss_list_9005_0011 NULL +static const pciSubsystemInfo *pci_ss_list_9005_0013[] = { + &pci_ss_info_9005_0013_9005_0003, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_001f[] = { + &pci_ss_info_9005_001f_9005_000f, + &pci_ss_info_9005_001f_9005_a180, + NULL +}; +#define pci_ss_list_9005_0020 NULL +#define pci_ss_list_9005_002f NULL +#define pci_ss_list_9005_0030 NULL +#define pci_ss_list_9005_003f NULL +static const pciSubsystemInfo *pci_ss_list_9005_0050[] = { + &pci_ss_info_9005_0050_9005_f500, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_0051[] = { + &pci_ss_info_9005_0051_9005_b500, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_0053[] = { + &pci_ss_info_9005_0053_9005_ffff, + NULL +}; +#define pci_ss_list_9005_005f NULL +static const pciSubsystemInfo *pci_ss_list_9005_0080[] = { + &pci_ss_info_9005_0080_0e11_e2a0, + &pci_ss_info_9005_0080_9005_62a0, + &pci_ss_info_9005_0080_9005_e220, + &pci_ss_info_9005_0080_9005_e2a0, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_0081[] = { + &pci_ss_info_9005_0081_9005_62a1, + NULL +}; +#define pci_ss_list_9005_0083 NULL +static const pciSubsystemInfo *pci_ss_list_9005_008f[] = { + &pci_ss_info_9005_008f_1179_0001, + &pci_ss_info_9005_008f_15d9_9005, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_00c0[] = { + &pci_ss_info_9005_00c0_0e11_f620, + &pci_ss_info_9005_00c0_9005_f620, + NULL +}; +#define pci_ss_list_9005_00c1 NULL +#define pci_ss_list_9005_00c3 NULL +static const pciSubsystemInfo *pci_ss_list_9005_00c5[] = { + &pci_ss_info_9005_00c5_1028_00c5, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_00cf[] = { + &pci_ss_info_9005_00cf_1028_00d1, + &pci_ss_info_9005_00cf_10f1_2462, + &pci_ss_info_9005_00cf_15d9_9005, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_0250[] = { + &pci_ss_info_9005_0250_1014_0279, + &pci_ss_info_9005_0250_1014_028c, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_9005_0285[] = { + &pci_ss_info_9005_0285_1028_0287, + NULL +}; +#define pci_ss_list_9005_8000 NULL +#define pci_ss_list_9005_800f NULL +#define pci_ss_list_9005_8010 NULL +static const pciSubsystemInfo *pci_ss_list_9005_8011[] = { + &pci_ss_info_9005_8011_0e11_00ac, + &pci_ss_info_9005_8011_9005_0041, + NULL +}; +#define pci_ss_list_9005_8012 NULL +#define pci_ss_list_9005_8013 NULL +#define pci_ss_list_9005_8014 NULL +#define pci_ss_list_9005_801e NULL +#define pci_ss_list_9005_801f NULL +#define pci_ss_list_9005_8090 NULL +#define pci_ss_list_9005_8091 NULL +#define pci_ss_list_9005_8092 NULL +#define pci_ss_list_9005_8093 NULL +#define pci_ss_list_9005_8094 NULL +#define pci_ss_list_9005_809e NULL +#define pci_ss_list_9005_809f NULL +#endif +#define pci_ss_list_907f_2015 NULL +#define pci_ss_list_9412_6565 NULL +#define pci_ss_list_9699_6565 NULL +#define pci_ss_list_9710_9815 NULL +#define pci_ss_list_9710_9835 NULL +#define pci_ss_list_cddd_0101 NULL +#define pci_ss_list_cddd_0200 NULL +#define pci_ss_list_d4d4_0601 NULL +#define pci_ss_list_e000_e000 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_e159_0001[] = { + &pci_ss_info_e159_0001_0059_0001, + &pci_ss_info_e159_0001_0059_0003, + NULL +}; +#define pci_ss_list_e159_0002 NULL +#endif +#define pci_ss_list_ea60_9896 NULL +#define pci_ss_list_ea60_9897 NULL +#define pci_ss_list_ea60_9898 NULL +#define pci_ss_list_eace_3100 NULL +#define pci_ss_list_eace_3200 NULL +#define pci_ss_list_eace_320e NULL +#define pci_ss_list_eace_340e NULL +#define pci_ss_list_eace_341e NULL +#define pci_ss_list_eace_3500 NULL +#define pci_ss_list_eace_351c NULL +#define pci_ss_list_eace_4100 NULL +#define pci_ss_list_eace_4110 NULL +#define pci_ss_list_eace_4220 NULL +#define pci_ss_list_eace_422e NULL +#define pci_ss_list_ec80_ec00 NULL +#define pci_ss_list_ecc0_0050 NULL +#define pci_ss_list_ecc0_0051 NULL +#define pci_ss_list_ecc0_0060 NULL +#define pci_ss_list_ecc0_0070 NULL +#define pci_ss_list_ecc0_0071 NULL +#define pci_ss_list_ecc0_0072 NULL +#define pci_ss_list_ecc0_0080 NULL +#define pci_ss_list_edd8_a091 NULL +#define pci_ss_list_edd8_a099 NULL +#define pci_ss_list_edd8_a0a1 NULL +#define pci_ss_list_edd8_a0a9 NULL +#define pci_ss_list_f1d0_cafe NULL +#define pci_ss_list_f1d0_efac NULL +#define pci_ss_list_f1d0_facd NULL +#define pci_ss_list_feda_a0fa NULL +#define pci_ss_list_feda_a10e NULL +#define pci_ss_list_fffe_0710 NULL +#ifdef INIT_VENDOR_SUBSYS_INFO +#define pci_ss_list_0000 NULL +#define pci_ss_list_001a NULL +#define pci_ss_list_0033 NULL +static const pciSubsystemInfo *pci_ss_list_003d[] = { + &pci_ss_info_003d_0008, + &pci_ss_info_003d_000b, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_0059[] = { + &pci_ss_info_0059_0001, + &pci_ss_info_0059_0003, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_0070[] = { + &pci_ss_info_0070_13eb, + &pci_ss_info_0070_ff01, + NULL +}; +#endif +#define pci_ss_list_0100 NULL +#define pci_ss_list_0675 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_0925[] = { + &pci_ss_info_0925_1234, + NULL +}; +#endif +#define pci_ss_list_09c1 NULL +#define pci_ss_list_0a89 NULL +static const pciSubsystemInfo *pci_ss_list_0e11[] = { + &pci_ss_info_0e11_0012, + &pci_ss_info_0e11_0022, + &pci_ss_info_0e11_0023, + &pci_ss_info_0e11_0024, + &pci_ss_info_0e11_0042, + &pci_ss_info_0e11_0043, + &pci_ss_info_0e11_0049, + &pci_ss_info_0e11_004a, + &pci_ss_info_0e11_005d, + &pci_ss_info_0e11_007c, + &pci_ss_info_0e11_007d, + &pci_ss_info_0e11_007e, + &pci_ss_info_0e11_0085, + &pci_ss_info_0e11_0091, + &pci_ss_info_0e11_0099, + &pci_ss_info_0e11_009a, + &pci_ss_info_0e11_00ac, + &pci_ss_info_0e11_00bb, + &pci_ss_info_0e11_00c1, + &pci_ss_info_0e11_00ca, + &pci_ss_info_0e11_00cb, + &pci_ss_info_0e11_00cf, + &pci_ss_info_0e11_00d0, + &pci_ss_info_0e11_00d1, + &pci_ss_info_0e11_0460, + &pci_ss_info_0e11_0500, + &pci_ss_info_0e11_3001, + &pci_ss_info_0e11_3002, + &pci_ss_info_0e11_3003, + &pci_ss_info_0e11_3004, + &pci_ss_info_0e11_3005, + &pci_ss_info_0e11_3006, + &pci_ss_info_0e11_3007, + &pci_ss_info_0e11_4030, + &pci_ss_info_0e11_4031, + &pci_ss_info_0e11_4032, + &pci_ss_info_0e11_4033, + &pci_ss_info_0e11_4040, + &pci_ss_info_0e11_4048, + &pci_ss_info_0e11_4050, + &pci_ss_info_0e11_4051, + &pci_ss_info_0e11_4058, + &pci_ss_info_0e11_7004, + &pci_ss_info_0e11_b01e, + &pci_ss_info_0e11_b01f, + &pci_ss_info_0e11_b02f, + &pci_ss_info_0e11_b032, + &pci_ss_info_0e11_b03b, + &pci_ss_info_0e11_b03c, + &pci_ss_info_0e11_b03d, + &pci_ss_info_0e11_b03e, + &pci_ss_info_0e11_b03f, + &pci_ss_info_0e11_b049, + &pci_ss_info_0e11_b04a, + &pci_ss_info_0e11_b0bc, + &pci_ss_info_0e11_b0c6, + &pci_ss_info_0e11_b0c7, + &pci_ss_info_0e11_b0d1, + &pci_ss_info_0e11_b0d7, + &pci_ss_info_0e11_b0dd, + &pci_ss_info_0e11_b0de, + &pci_ss_info_0e11_b0df, + &pci_ss_info_0e11_b0e0, + &pci_ss_info_0e11_b0e1, + &pci_ss_info_0e11_b0e8, + &pci_ss_info_0e11_b0fd, + &pci_ss_info_0e11_b10e, + &pci_ss_info_0e11_b110, + &pci_ss_info_0e11_b111, + &pci_ss_info_0e11_b112, + &pci_ss_info_0e11_b113, + &pci_ss_info_0e11_b114, + &pci_ss_info_0e11_b123, + &pci_ss_info_0e11_b126, + &pci_ss_info_0e11_b134, + &pci_ss_info_0e11_b13c, + &pci_ss_info_0e11_b144, + &pci_ss_info_0e11_b14d, + &pci_ss_info_0e11_b15a, + &pci_ss_info_0e11_b163, + &pci_ss_info_0e11_b164, + &pci_ss_info_0e11_b16e, + &pci_ss_info_0e11_b16f, + &pci_ss_info_0e11_b194, + &pci_ss_info_0e11_b195, + &pci_ss_info_0e11_b196, + &pci_ss_info_0e11_b1a4, + &pci_ss_info_0e11_b1a7, + &pci_ss_info_0e11_b1be, + &pci_ss_info_0e11_e2a0, + &pci_ss_info_0e11_f620, + NULL +}; +#define pci_ss_list_0e55 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1000[] = { + &pci_ss_info_1000_1000, + NULL +}; +#endif +#define pci_ss_list_1001 NULL +static const pciSubsystemInfo *pci_ss_list_1002[] = { + &pci_ss_info_1002_0001, + &pci_ss_info_1002_0002, + &pci_ss_info_1002_0003, + &pci_ss_info_1002_0004, + &pci_ss_info_1002_0008, + &pci_ss_info_1002_0009, + &pci_ss_info_1002_000a, + &pci_ss_info_1002_000b, + &pci_ss_info_1002_0014, + &pci_ss_info_1002_0018, + &pci_ss_info_1002_001a, + &pci_ss_info_1002_001c, + &pci_ss_info_1002_0028, + &pci_ss_info_1002_0029, + &pci_ss_info_1002_002a, + &pci_ss_info_1002_002b, + &pci_ss_info_1002_0038, + &pci_ss_info_1002_0039, + &pci_ss_info_1002_003a, + &pci_ss_info_1002_0040, + &pci_ss_info_1002_0044, + &pci_ss_info_1002_0048, + &pci_ss_info_1002_0061, + &pci_ss_info_1002_0062, + &pci_ss_info_1002_0063, + &pci_ss_info_1002_0068, + &pci_ss_info_1002_0080, + &pci_ss_info_1002_0084, + &pci_ss_info_1002_0087, + &pci_ss_info_1002_0088, + &pci_ss_info_1002_008a, + &pci_ss_info_1002_00ba, + &pci_ss_info_1002_010a, + &pci_ss_info_1002_0139, + &pci_ss_info_1002_013a, + &pci_ss_info_1002_0152, + &pci_ss_info_1002_0162, + &pci_ss_info_1002_0172, + &pci_ss_info_1002_028a, + &pci_ss_info_1002_02aa, + &pci_ss_info_1002_0448, + &pci_ss_info_1002_053a, + &pci_ss_info_1002_2000, + &pci_ss_info_1002_2001, + &pci_ss_info_1002_4742, + &pci_ss_info_1002_4744, + &pci_ss_info_1002_474d, + &pci_ss_info_1002_474e, + &pci_ss_info_1002_474f, + &pci_ss_info_1002_4750, + &pci_ss_info_1002_4752, + &pci_ss_info_1002_4753, + &pci_ss_info_1002_4756, + &pci_ss_info_1002_4757, + &pci_ss_info_1002_475a, + &pci_ss_info_1002_4c42, + &pci_ss_info_1002_4c49, + &pci_ss_info_1002_4c50, + &pci_ss_info_1002_5654, + &pci_ss_info_1002_8001, + &pci_ss_info_1002_8008, + NULL +}; +#define pci_ss_list_1003 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1004[] = { + &pci_ss_info_1004_0304, + &pci_ss_info_1004_0305, + &pci_ss_info_1004_0306, + NULL +}; +#endif +#define pci_ss_list_1005 NULL +#define pci_ss_list_1006 NULL +#define pci_ss_list_1007 NULL +#define pci_ss_list_1008 NULL +#define pci_ss_list_100a NULL +#define pci_ss_list_100b NULL +#define pci_ss_list_100c NULL +#define pci_ss_list_100d NULL +#define pci_ss_list_100e NULL +static const pciSubsystemInfo *pci_ss_list_1010[] = { + &pci_ss_info_1010_0020, + &pci_ss_info_1010_0080, + &pci_ss_info_1010_0088, + &pci_ss_info_1010_0090, + &pci_ss_info_1010_0098, + &pci_ss_info_1010_00a0, + &pci_ss_info_1010_00a8, + &pci_ss_info_1010_0120, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1011[] = { + &pci_ss_info_1011_4d10, + &pci_ss_info_1011_500a, + &pci_ss_info_1011_500b, + NULL +}; +#define pci_ss_list_1012 NULL +static const pciSubsystemInfo *pci_ss_list_1013[] = { + &pci_ss_info_1013_00bc, + &pci_ss_info_1013_4280, + &pci_ss_info_1013_4281, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1014[] = { + &pci_ss_info_1014_0001, + &pci_ss_info_1014_002e, + &pci_ss_info_1014_003e, + &pci_ss_info_1014_005c, + &pci_ss_info_1014_008e, + &pci_ss_info_1014_0097, + &pci_ss_info_1014_0098, + &pci_ss_info_1014_0099, + &pci_ss_info_1014_00ba, + &pci_ss_info_1014_00cd, + &pci_ss_info_1014_00ce, + &pci_ss_info_1014_00cf, + &pci_ss_info_1014_00db, + &pci_ss_info_1014_00dd, + &pci_ss_info_1014_00e4, + &pci_ss_info_1014_00e5, + &pci_ss_info_1014_0119, + &pci_ss_info_1014_0131, + &pci_ss_info_1014_0143, + &pci_ss_info_1014_0145, + &pci_ss_info_1014_0154, + &pci_ss_info_1014_0166, + &pci_ss_info_1014_016d, + &pci_ss_info_1014_017f, + &pci_ss_info_1014_0181, + &pci_ss_info_1014_0182, + &pci_ss_info_1014_0183, + &pci_ss_info_1014_0184, + &pci_ss_info_1014_0185, + &pci_ss_info_1014_01b6, + &pci_ss_info_1014_01b7, + &pci_ss_info_1014_01bc, + &pci_ss_info_1014_01be, + &pci_ss_info_1014_01bf, + &pci_ss_info_1014_01c6, + &pci_ss_info_1014_01ce, + &pci_ss_info_1014_01cf, + &pci_ss_info_1014_01dc, + &pci_ss_info_1014_01ea, + &pci_ss_info_1014_01eb, + &pci_ss_info_1014_01ec, + &pci_ss_info_1014_01f1, + &pci_ss_info_1014_01f2, + &pci_ss_info_1014_01fc, + &pci_ss_info_1014_0202, + &pci_ss_info_1014_0205, + &pci_ss_info_1014_0207, + &pci_ss_info_1014_0208, + &pci_ss_info_1014_0209, + &pci_ss_info_1014_020e, + &pci_ss_info_1014_0217, + &pci_ss_info_1014_021d, + &pci_ss_info_1014_0220, + &pci_ss_info_1014_0222, + &pci_ss_info_1014_0223, + &pci_ss_info_1014_022e, + &pci_ss_info_1014_0232, + &pci_ss_info_1014_0234, + &pci_ss_info_1014_0235, + &pci_ss_info_1014_0239, + &pci_ss_info_1014_023a, + &pci_ss_info_1014_023b, + &pci_ss_info_1014_023d, + &pci_ss_info_1014_0244, + &pci_ss_info_1014_0245, + &pci_ss_info_1014_0258, + &pci_ss_info_1014_0259, + &pci_ss_info_1014_0277, + &pci_ss_info_1014_0279, + &pci_ss_info_1014_028c, + &pci_ss_info_1014_0502, + &pci_ss_info_1014_0503, + &pci_ss_info_1014_0506, + &pci_ss_info_1014_0508, + &pci_ss_info_1014_0511, + &pci_ss_info_1014_0512, + &pci_ss_info_1014_0513, + &pci_ss_info_1014_0517, + &pci_ss_info_1014_051a, + &pci_ss_info_1014_051c, + &pci_ss_info_1014_1010, + &pci_ss_info_1014_105c, + &pci_ss_info_1014_10f2, + &pci_ss_info_1014_1181, + &pci_ss_info_1014_1182, + &pci_ss_info_1014_2000, + &pci_ss_info_1014_2205, + &pci_ss_info_1014_305c, + &pci_ss_info_1014_405c, + &pci_ss_info_1014_505c, + &pci_ss_info_1014_605c, + &pci_ss_info_1014_705c, + &pci_ss_info_1014_805c, + &pci_ss_info_1014_8181, + &pci_ss_info_1014_9181, + &pci_ss_info_1014_9750, + &pci_ss_info_1014_ff03, + NULL +}; +#endif +#define pci_ss_list_1015 NULL +#define pci_ss_list_1016 NULL +#define pci_ss_list_1017 NULL +#define pci_ss_list_1018 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1019[] = { + &pci_ss_info_1019_0970, + &pci_ss_info_1019_7018, + NULL +}; +#endif +#define pci_ss_list_101a NULL +#define pci_ss_list_101b NULL +#define pci_ss_list_101c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_101e[] = { + &pci_ss_info_101e_0431, + &pci_ss_info_101e_0438, + &pci_ss_info_101e_0466, + &pci_ss_info_101e_0467, + &pci_ss_info_101e_0471, + &pci_ss_info_101e_0475, + &pci_ss_info_101e_0490, + &pci_ss_info_101e_0493, + &pci_ss_info_101e_0649, + &pci_ss_info_101e_0762, + &pci_ss_info_101e_0767, + &pci_ss_info_101e_09a0, + &pci_ss_info_101e_8471, + &pci_ss_info_101e_8493, + NULL +}; +#endif +#define pci_ss_list_101f NULL +#define pci_ss_list_1020 NULL +#define pci_ss_list_1021 NULL +#define pci_ss_list_1022 NULL +static const pciSubsystemInfo *pci_ss_list_1023[] = { + &pci_ss_info_1023_8400, + &pci_ss_info_1023_8520, + &pci_ss_info_1023_9750, + &pci_ss_info_1023_9880, + NULL +}; +#define pci_ss_list_1024 NULL +static const pciSubsystemInfo *pci_ss_list_1025[] = { + &pci_ss_info_1025_000e, + &pci_ss_info_1025_0018, + &pci_ss_info_1025_0310, + &pci_ss_info_1025_0315, + &pci_ss_info_1025_1003, + &pci_ss_info_1025_1007, + &pci_ss_info_1025_1016, + &pci_ss_info_1025_8013, + &pci_ss_info_1025_8920, + &pci_ss_info_1025_8921, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_1028[] = { + &pci_ss_info_1028_0001, + &pci_ss_info_1028_0002, + &pci_ss_info_1028_0003, + &pci_ss_info_1028_0074, + &pci_ss_info_1028_0075, + &pci_ss_info_1028_007d, + &pci_ss_info_1028_007e, + &pci_ss_info_1028_0080, + &pci_ss_info_1028_0081, + &pci_ss_info_1028_0082, + &pci_ss_info_1028_0083, + &pci_ss_info_1028_0084, + &pci_ss_info_1028_0085, + &pci_ss_info_1028_0086, + &pci_ss_info_1028_0087, + &pci_ss_info_1028_0088, + &pci_ss_info_1028_0089, + &pci_ss_info_1028_008f, + &pci_ss_info_1028_0090, + &pci_ss_info_1028_0091, + &pci_ss_info_1028_0092, + &pci_ss_info_1028_0093, + &pci_ss_info_1028_0094, + &pci_ss_info_1028_0095, + &pci_ss_info_1028_0096, + &pci_ss_info_1028_0097, + &pci_ss_info_1028_0098, + &pci_ss_info_1028_0099, + &pci_ss_info_1028_009b, + &pci_ss_info_1028_00c5, + &pci_ss_info_1028_00d0, + &pci_ss_info_1028_00d1, + &pci_ss_info_1028_00d9, + &pci_ss_info_1028_00e6, + &pci_ss_info_1028_0106, + &pci_ss_info_1028_0109, + &pci_ss_info_1028_010a, + &pci_ss_info_1028_011b, + &pci_ss_info_1028_0121, + &pci_ss_info_1028_0126, + &pci_ss_info_1028_0287, + &pci_ss_info_1028_0467, + &pci_ss_info_1028_0471, + &pci_ss_info_1028_0475, + &pci_ss_info_1028_0493, + &pci_ss_info_1028_0511, + &pci_ss_info_1028_0518, + &pci_ss_info_1028_0520, + &pci_ss_info_1028_0531, + &pci_ss_info_1028_1010, + &pci_ss_info_1028_1111, + &pci_ss_info_1028_4082, + &pci_ss_info_1028_8082, + &pci_ss_info_1028_c082, + NULL +}; +#define pci_ss_list_1029 NULL +#define pci_ss_list_102a NULL +static const pciSubsystemInfo *pci_ss_list_102b[] = { + &pci_ss_info_102b_0100, + &pci_ss_info_102b_0328, + &pci_ss_info_102b_0338, + &pci_ss_info_102b_0378, + &pci_ss_info_102b_051b, + &pci_ss_info_102b_0541, + &pci_ss_info_102b_0542, + &pci_ss_info_102b_0543, + &pci_ss_info_102b_0641, + &pci_ss_info_102b_0642, + &pci_ss_info_102b_0643, + &pci_ss_info_102b_07c0, + &pci_ss_info_102b_07c1, + &pci_ss_info_102b_0840, + &pci_ss_info_102b_0d41, + &pci_ss_info_102b_0d42, + &pci_ss_info_102b_0e00, + &pci_ss_info_102b_0e01, + &pci_ss_info_102b_0e02, + &pci_ss_info_102b_0e03, + &pci_ss_info_102b_0f80, + &pci_ss_info_102b_0f81, + &pci_ss_info_102b_0f82, + &pci_ss_info_102b_0f83, + &pci_ss_info_102b_0f84, + &pci_ss_info_102b_1001, + &pci_ss_info_102b_1100, + &pci_ss_info_102b_1200, + &pci_ss_info_102b_19d8, + &pci_ss_info_102b_19f8, + &pci_ss_info_102b_1e41, + &pci_ss_info_102b_2159, + &pci_ss_info_102b_2179, + &pci_ss_info_102b_217d, + &pci_ss_info_102b_23c0, + &pci_ss_info_102b_23c1, + &pci_ss_info_102b_23c2, + &pci_ss_info_102b_23c3, + &pci_ss_info_102b_2f58, + &pci_ss_info_102b_2f78, + &pci_ss_info_102b_3693, + &pci_ss_info_102b_48e9, + &pci_ss_info_102b_48f8, + &pci_ss_info_102b_4a60, + &pci_ss_info_102b_4a64, + &pci_ss_info_102b_5dd0, + &pci_ss_info_102b_5f50, + &pci_ss_info_102b_5f51, + &pci_ss_info_102b_5f52, + &pci_ss_info_102b_9010, + &pci_ss_info_102b_c93c, + &pci_ss_info_102b_c9b0, + &pci_ss_info_102b_c9bc, + &pci_ss_info_102b_ca60, + &pci_ss_info_102b_ca6c, + &pci_ss_info_102b_dbbc, + &pci_ss_info_102b_dbc2, + &pci_ss_info_102b_dbc3, + &pci_ss_info_102b_dbc8, + &pci_ss_info_102b_dbd2, + &pci_ss_info_102b_dbd3, + &pci_ss_info_102b_dbd4, + &pci_ss_info_102b_dbd5, + &pci_ss_info_102b_dbd8, + &pci_ss_info_102b_dbd9, + &pci_ss_info_102b_dbe2, + &pci_ss_info_102b_dbe3, + &pci_ss_info_102b_dbe8, + &pci_ss_info_102b_dbf2, + &pci_ss_info_102b_dbf3, + &pci_ss_info_102b_dbf4, + &pci_ss_info_102b_dbf5, + &pci_ss_info_102b_dbf8, + &pci_ss_info_102b_dbf9, + &pci_ss_info_102b_f806, + &pci_ss_info_102b_ff00, + &pci_ss_info_102b_ff01, + &pci_ss_info_102b_ff02, + &pci_ss_info_102b_ff03, + &pci_ss_info_102b_ff04, + &pci_ss_info_102b_ff05, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_102c[] = { + &pci_ss_info_102c_00c0, + NULL +}; +#define pci_ss_list_102d NULL +#define pci_ss_list_102e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_102f[] = { + &pci_ss_info_102f_00f8, + NULL +}; +#endif +#define pci_ss_list_1030 NULL +static const pciSubsystemInfo *pci_ss_list_1031[] = { + &pci_ss_info_1031_7efe, + &pci_ss_info_1031_fc00, + NULL +}; +#define pci_ss_list_1032 NULL +static const pciSubsystemInfo *pci_ss_list_1033[] = { + &pci_ss_info_1033_8000, + &pci_ss_info_1033_800c, + &pci_ss_info_1033_800d, + &pci_ss_info_1033_8014, + &pci_ss_info_1033_8015, + &pci_ss_info_1033_8016, + &pci_ss_info_1033_801f, + &pci_ss_info_1033_8026, + &pci_ss_info_1033_8029, + &pci_ss_info_1033_802b, + &pci_ss_info_1033_802f, + &pci_ss_info_1033_803c, + &pci_ss_info_1033_8047, + &pci_ss_info_1033_804d, + &pci_ss_info_1033_804f, + &pci_ss_info_1033_8051, + &pci_ss_info_1033_8054, + &pci_ss_info_1033_8058, + &pci_ss_info_1033_8063, + &pci_ss_info_1033_8064, + &pci_ss_info_1033_8065, + &pci_ss_info_1033_8066, + &pci_ss_info_1033_8068, + &pci_ss_info_1033_8069, + &pci_ss_info_1033_806a, + &pci_ss_info_1033_8077, + &pci_ss_info_1033_809d, + &pci_ss_info_1033_80ac, + &pci_ss_info_1033_80bc, + NULL +}; +#define pci_ss_list_1034 NULL +#define pci_ss_list_1035 NULL +#define pci_ss_list_1036 NULL +#define pci_ss_list_1037 NULL +#define pci_ss_list_1038 NULL +static const pciSubsystemInfo *pci_ss_list_1039[] = { + &pci_ss_info_1039_0000, + &pci_ss_info_1039_0900, + &pci_ss_info_1039_5513, + &pci_ss_info_1039_6306, + &pci_ss_info_1039_6326, + &pci_ss_info_1039_7000, + &pci_ss_info_1039_7016, + &pci_ss_info_1039_7018, + NULL +}; +#define pci_ss_list_103a NULL +#define pci_ss_list_103b NULL +static const pciSubsystemInfo *pci_ss_list_103c[] = { + &pci_ss_info_103c_0007, + &pci_ss_info_103c_0008, + &pci_ss_info_103c_000d, + &pci_ss_info_103c_03a2, + &pci_ss_info_103c_1040, + &pci_ss_info_103c_1041, + &pci_ss_info_103c_1042, + &pci_ss_info_103c_1049, + &pci_ss_info_103c_104a, + &pci_ss_info_103c_104b, + &pci_ss_info_103c_104c, + &pci_ss_info_103c_1064, + &pci_ss_info_103c_1065, + &pci_ss_info_103c_106c, + &pci_ss_info_103c_106e, + &pci_ss_info_103c_10c0, + &pci_ss_info_103c_10c2, + &pci_ss_info_103c_10c3, + &pci_ss_info_103c_10c6, + &pci_ss_info_103c_10c7, + &pci_ss_info_103c_10ca, + &pci_ss_info_103c_10cb, + &pci_ss_info_103c_10cc, + &pci_ss_info_103c_10cd, + &pci_ss_info_103c_10e3, + &pci_ss_info_103c_10e4, + &pci_ss_info_103c_10ea, + &pci_ss_info_103c_1200, + &pci_ss_info_103c_1207, + &pci_ss_info_103c_1223, + &pci_ss_info_103c_1226, + &pci_ss_info_103c_1227, + &pci_ss_info_103c_1279, + &pci_ss_info_103c_1282, + NULL +}; +#define pci_ss_list_103e NULL +#define pci_ss_list_103f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1040[] = { + &pci_ss_info_1040_000f, + &pci_ss_info_1040_0011, + NULL +}; +#endif +#define pci_ss_list_1041 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1042[] = { + &pci_ss_info_1042_1854, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1043[] = { + &pci_ss_info_1043_0200, + &pci_ss_info_1043_0201, + &pci_ss_info_1043_0202, + &pci_ss_info_1043_0205, + &pci_ss_info_1043_0c11, + &pci_ss_info_1043_4000, + &pci_ss_info_1043_4008, + &pci_ss_info_1043_4009, + &pci_ss_info_1043_400a, + &pci_ss_info_1043_400b, + &pci_ss_info_1043_4015, + &pci_ss_info_1043_4016, + &pci_ss_info_1043_402f, + &pci_ss_info_1043_4031, + &pci_ss_info_1043_405b, + &pci_ss_info_1043_405f, + &pci_ss_info_1043_800b, + &pci_ss_info_1043_801c, + &pci_ss_info_1043_8027, + &pci_ss_info_1043_8033, + &pci_ss_info_1043_803e, + &pci_ss_info_1043_8040, + &pci_ss_info_1043_8042, + &pci_ss_info_1043_8044, + &pci_ss_info_1043_8052, + &pci_ss_info_1043_8053, + &pci_ss_info_1043_8064, + &pci_ss_info_1043_8077, + &pci_ss_info_1043_807f, + &pci_ss_info_1043_80ad, + &pci_ss_info_1043_80e2, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1044[] = { + &pci_ss_info_1044_c001, + &pci_ss_info_1044_c002, + &pci_ss_info_1044_c003, + &pci_ss_info_1044_c004, + &pci_ss_info_1044_c005, + &pci_ss_info_1044_c00a, + &pci_ss_info_1044_c00b, + &pci_ss_info_1044_c00c, + &pci_ss_info_1044_c00d, + &pci_ss_info_1044_c00e, + &pci_ss_info_1044_c00f, + &pci_ss_info_1044_c014, + &pci_ss_info_1044_c015, + &pci_ss_info_1044_c016, + &pci_ss_info_1044_c01e, + &pci_ss_info_1044_c01f, + &pci_ss_info_1044_c020, + &pci_ss_info_1044_c021, + &pci_ss_info_1044_c028, + &pci_ss_info_1044_c029, + &pci_ss_info_1044_c02a, + &pci_ss_info_1044_c03c, + &pci_ss_info_1044_c03d, + &pci_ss_info_1044_c03e, + &pci_ss_info_1044_c046, + &pci_ss_info_1044_c047, + &pci_ss_info_1044_c048, + &pci_ss_info_1044_c050, + &pci_ss_info_1044_c051, + &pci_ss_info_1044_c052, + &pci_ss_info_1044_c05a, + &pci_ss_info_1044_c05b, + &pci_ss_info_1044_c064, + &pci_ss_info_1044_c065, + &pci_ss_info_1044_c066, + NULL +}; +#endif +#define pci_ss_list_1045 NULL +#define pci_ss_list_1046 NULL +#define pci_ss_list_1047 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1048[] = { + &pci_ss_info_1048_0a31, + &pci_ss_info_1048_0a32, + &pci_ss_info_1048_0a35, + &pci_ss_info_1048_0c10, + &pci_ss_info_1048_0c18, + &pci_ss_info_1048_0c1b, + &pci_ss_info_1048_0c3a, + &pci_ss_info_1048_0c56, + &pci_ss_info_1048_1500, + NULL +}; +#endif +#define pci_ss_list_1049 NULL +#define pci_ss_list_104a NULL +#define pci_ss_list_104b NULL +#define pci_ss_list_104c NULL +static const pciSubsystemInfo *pci_ss_list_104d[] = { + &pci_ss_info_104d_801b, + &pci_ss_info_104d_802f, + &pci_ss_info_104d_8032, + &pci_ss_info_104d_8036, + &pci_ss_info_104d_8044, + &pci_ss_info_104d_8045, + &pci_ss_info_104d_8049, + &pci_ss_info_104d_8055, + &pci_ss_info_104d_8056, + &pci_ss_info_104d_805a, + &pci_ss_info_104d_805f, + &pci_ss_info_104d_8067, + &pci_ss_info_104d_8074, + &pci_ss_info_104d_8075, + &pci_ss_info_104d_8077, + &pci_ss_info_104d_807b, + &pci_ss_info_104d_8083, + &pci_ss_info_104d_8097, + &pci_ss_info_104d_80df, + &pci_ss_info_104d_80e7, + &pci_ss_info_104d_830b, + NULL +}; +#define pci_ss_list_104e NULL +#define pci_ss_list_104f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1050[] = { + &pci_ss_info_1050_0001, + &pci_ss_info_1050_0840, + NULL +}; +#endif +#define pci_ss_list_1051 NULL +#define pci_ss_list_1052 NULL +#define pci_ss_list_1053 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1054[] = { + &pci_ss_info_1054_7018, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1055[] = { + &pci_ss_info_1055_e000, + &pci_ss_info_1055_e002, + &pci_ss_info_1055_e100, + &pci_ss_info_1055_e102, + &pci_ss_info_1055_e300, + &pci_ss_info_1055_e302, + NULL +}; +#endif +#define pci_ss_list_1056 NULL +static const pciSubsystemInfo *pci_ss_list_1057[] = { + &pci_ss_info_1057_0300, + &pci_ss_info_1057_0301, + &pci_ss_info_1057_0302, + &pci_ss_info_1057_5600, + NULL +}; +#define pci_ss_list_1058 NULL +#define pci_ss_list_1059 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_105a[] = { + &pci_ss_info_105a_0000, + &pci_ss_info_105a_0275, + &pci_ss_info_105a_2168, + &pci_ss_info_105a_4d30, + &pci_ss_info_105a_4d33, + &pci_ss_info_105a_4d39, + &pci_ss_info_105a_4d68, + &pci_ss_info_105a_5168, + &pci_ss_info_105a_6269, + NULL +}; +#endif +#define pci_ss_list_105b NULL +#define pci_ss_list_105c NULL +static const pciSubsystemInfo *pci_ss_list_105d[] = { + &pci_ss_info_105d_0000, + &pci_ss_info_105d_0001, + &pci_ss_info_105d_0002, + &pci_ss_info_105d_0003, + &pci_ss_info_105d_0004, + &pci_ss_info_105d_0005, + &pci_ss_info_105d_0006, + &pci_ss_info_105d_0007, + &pci_ss_info_105d_0008, + &pci_ss_info_105d_0009, + &pci_ss_info_105d_000a, + &pci_ss_info_105d_000b, + &pci_ss_info_105d_0018, + &pci_ss_info_105d_002a, + &pci_ss_info_105d_003a, + &pci_ss_info_105d_092f, + NULL +}; +#define pci_ss_list_105e NULL +#define pci_ss_list_105f NULL +#define pci_ss_list_1060 NULL +#define pci_ss_list_1061 NULL +#define pci_ss_list_1062 NULL +#define pci_ss_list_1063 NULL +#define pci_ss_list_1064 NULL +#define pci_ss_list_1065 NULL +#define pci_ss_list_1066 NULL +#define pci_ss_list_1067 NULL +#define pci_ss_list_1068 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1069[] = { + &pci_ss_info_1069_0020, + NULL +}; +#endif +#define pci_ss_list_106a NULL +#define pci_ss_list_106b NULL +#define pci_ss_list_106c NULL +#define pci_ss_list_106d NULL +#define pci_ss_list_106e NULL +#define pci_ss_list_106f NULL +#define pci_ss_list_1070 NULL +#define pci_ss_list_1071 NULL +#define pci_ss_list_1072 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1073[] = { + &pci_ss_info_1073_0004, + &pci_ss_info_1073_0005, + &pci_ss_info_1073_0006, + &pci_ss_info_1073_0008, + &pci_ss_info_1073_000a, + &pci_ss_info_1073_000d, + &pci_ss_info_1073_0010, + &pci_ss_info_1073_0012, + &pci_ss_info_1073_2000, + NULL +}; +#endif +#define pci_ss_list_1074 NULL +#define pci_ss_list_1075 NULL +#define pci_ss_list_1076 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1077[] = { + &pci_ss_info_1077_0001, + NULL +}; +#endif +#define pci_ss_list_1078 NULL +#define pci_ss_list_1079 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_107a[] = { + &pci_ss_info_107a_000c, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_107b[] = { + &pci_ss_info_107b_5350, + &pci_ss_info_107b_8030, + &pci_ss_info_107b_8054, + NULL +}; +#endif +#define pci_ss_list_107c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_107d[] = { + &pci_ss_info_107d_2633, + &pci_ss_info_107d_2720, + &pci_ss_info_107d_2840, + &pci_ss_info_107d_2896, + &pci_ss_info_107d_5330, + &pci_ss_info_107d_5350, + &pci_ss_info_107d_6606, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_107e[] = { + &pci_ss_info_107e_000e, + &pci_ss_info_107e_000f, + NULL +}; +#endif +#define pci_ss_list_107f NULL +#define pci_ss_list_1080 NULL +#define pci_ss_list_1081 NULL +#define pci_ss_list_1082 NULL +#define pci_ss_list_1083 NULL +#define pci_ss_list_1084 NULL +#define pci_ss_list_1085 NULL +#define pci_ss_list_1086 NULL +#define pci_ss_list_1087 NULL +#define pci_ss_list_1088 NULL +#define pci_ss_list_1089 NULL +#define pci_ss_list_108a NULL +#define pci_ss_list_108c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_108d[] = { + &pci_ss_info_108d_0004, + &pci_ss_info_108d_0007, + &pci_ss_info_108d_0008, + &pci_ss_info_108d_0016, + &pci_ss_info_108d_0017, + &pci_ss_info_108d_0022, + &pci_ss_info_108d_0027, + NULL +}; +#endif +#define pci_ss_list_108e NULL +#define pci_ss_list_108f NULL +#define pci_ss_list_1090 NULL +#define pci_ss_list_1091 NULL +static const pciSubsystemInfo *pci_ss_list_1092[] = { + &pci_ss_info_1092_0003, + &pci_ss_info_1092_0100, + &pci_ss_info_1092_0127, + &pci_ss_info_1092_0136, + &pci_ss_info_1092_0141, + &pci_ss_info_1092_0146, + &pci_ss_info_1092_0148, + &pci_ss_info_1092_0149, + &pci_ss_info_1092_0152, + &pci_ss_info_1092_0154, + &pci_ss_info_1092_0155, + &pci_ss_info_1092_0156, + &pci_ss_info_1092_0157, + &pci_ss_info_1092_0350, + &pci_ss_info_1092_0440, + &pci_ss_info_1092_0550, + &pci_ss_info_1092_0552, + &pci_ss_info_1092_094c, + &pci_ss_info_1092_0a50, + &pci_ss_info_1092_0a70, + &pci_ss_info_1092_0a78, + &pci_ss_info_1092_1092, + &pci_ss_info_1092_2000, + &pci_ss_info_1092_2100, + &pci_ss_info_1092_2110, + &pci_ss_info_1092_2200, + &pci_ss_info_1092_3000, + &pci_ss_info_1092_3001, + &pci_ss_info_1092_3002, + &pci_ss_info_1092_3003, + &pci_ss_info_1092_3004, + &pci_ss_info_1092_4000, + &pci_ss_info_1092_4002, + &pci_ss_info_1092_4100, + &pci_ss_info_1092_4207, + &pci_ss_info_1092_4800, + &pci_ss_info_1092_4801, + &pci_ss_info_1092_4803, + &pci_ss_info_1092_4804, + &pci_ss_info_1092_4807, + &pci_ss_info_1092_4808, + &pci_ss_info_1092_4809, + &pci_ss_info_1092_480e, + &pci_ss_info_1092_4810, + &pci_ss_info_1092_4812, + &pci_ss_info_1092_4815, + &pci_ss_info_1092_4820, + &pci_ss_info_1092_4822, + &pci_ss_info_1092_4904, + &pci_ss_info_1092_4905, + &pci_ss_info_1092_4910, + &pci_ss_info_1092_4914, + &pci_ss_info_1092_4920, + &pci_ss_info_1092_4a00, + &pci_ss_info_1092_4a02, + &pci_ss_info_1092_4a09, + &pci_ss_info_1092_4a0b, + &pci_ss_info_1092_4a0f, + &pci_ss_info_1092_4e01, + &pci_ss_info_1092_5932, + &pci_ss_info_1092_5934, + &pci_ss_info_1092_5952, + &pci_ss_info_1092_5954, + &pci_ss_info_1092_5a00, + &pci_ss_info_1092_5a35, + &pci_ss_info_1092_5a37, + &pci_ss_info_1092_5a55, + &pci_ss_info_1092_5a57, + &pci_ss_info_1092_6820, + &pci_ss_info_1092_6a02, + &pci_ss_info_1092_7a02, + &pci_ss_info_1092_8000, + &pci_ss_info_1092_8030, + &pci_ss_info_1092_8035, + &pci_ss_info_1092_8225, + &pci_ss_info_1092_8760, + &pci_ss_info_1092_8a10, + NULL +}; +#define pci_ss_list_1093 NULL +#define pci_ss_list_1094 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1095[] = { + &pci_ss_info_1095_0670, + NULL +}; +#endif +#define pci_ss_list_1096 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1097[] = { + &pci_ss_info_1097_3d01, + NULL +}; +#endif +#define pci_ss_list_1098 NULL +#define pci_ss_list_1099 NULL +#define pci_ss_list_109a NULL +#define pci_ss_list_109b NULL +#define pci_ss_list_109c NULL +#define pci_ss_list_109d NULL +#define pci_ss_list_109e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_109f[] = { + &pci_ss_info_109f_1000, + &pci_ss_info_109f_315d, + &pci_ss_info_109f_3181, + NULL +}; +#endif +#define pci_ss_list_10a0 NULL +#define pci_ss_list_10a1 NULL +#define pci_ss_list_10a2 NULL +#define pci_ss_list_10a3 NULL +#define pci_ss_list_10a4 NULL +#define pci_ss_list_10a5 NULL +#define pci_ss_list_10a6 NULL +#define pci_ss_list_10a7 NULL +#define pci_ss_list_10a8 NULL +#define pci_ss_list_10a9 NULL +#define pci_ss_list_10aa NULL +#define pci_ss_list_10ab NULL +#define pci_ss_list_10ac NULL +#define pci_ss_list_10ad NULL +#define pci_ss_list_10ae NULL +#define pci_ss_list_10af NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b0[] = { + &pci_ss_info_10b0_0001, + NULL +}; +#endif +#define pci_ss_list_10b1 NULL +#define pci_ss_list_10b2 NULL +#define pci_ss_list_10b3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b4[] = { + &pci_ss_info_10b4_1617, + &pci_ss_info_10b4_1717, + &pci_ss_info_10b4_1b1b, + &pci_ss_info_10b4_1b1d, + &pci_ss_info_10b4_1b1e, + &pci_ss_info_10b4_1b20, + &pci_ss_info_10b4_1b21, + &pci_ss_info_10b4_1b22, + &pci_ss_info_10b4_1b23, + &pci_ss_info_10b4_1b27, + &pci_ss_info_10b4_1b88, + &pci_ss_info_10b4_201a, + &pci_ss_info_10b4_202f, + &pci_ss_info_10b4_222a, + &pci_ss_info_10b4_2230, + &pci_ss_info_10b4_2232, + &pci_ss_info_10b4_2235, + &pci_ss_info_10b4_237e, + &pci_ss_info_10b4_273d, + &pci_ss_info_10b4_273e, + &pci_ss_info_10b4_2740, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b5[] = { + &pci_ss_info_10b5_2036, + &pci_ss_info_10b5_2273, + &pci_ss_info_10b5_2455, + &pci_ss_info_10b5_9050, + &pci_ss_info_10b5_9080, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b6[] = { + &pci_ss_info_10b6_0002, + &pci_ss_info_10b6_0003, + &pci_ss_info_10b6_0006, + &pci_ss_info_10b6_0007, + &pci_ss_info_10b6_0008, + &pci_ss_info_10b6_0009, + &pci_ss_info_10b6_000a, + &pci_ss_info_10b6_000b, + &pci_ss_info_10b6_000c, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b7[] = { + &pci_ss_info_10b7_1000, + &pci_ss_info_10b7_1001, + &pci_ss_info_10b7_1002, + &pci_ss_info_10b7_1003, + &pci_ss_info_10b7_1004, + &pci_ss_info_10b7_1005, + &pci_ss_info_10b7_1006, + &pci_ss_info_10b7_1007, + &pci_ss_info_10b7_1008, + &pci_ss_info_10b7_1100, + &pci_ss_info_10b7_1101, + &pci_ss_info_10b7_1102, + &pci_ss_info_10b7_1201, + &pci_ss_info_10b7_1202, + &pci_ss_info_10b7_2000, + &pci_ss_info_10b7_2001, + &pci_ss_info_10b7_2101, + &pci_ss_info_10b7_2102, + &pci_ss_info_10b7_3000, + &pci_ss_info_10b7_3590, + &pci_ss_info_10b7_5a57, + &pci_ss_info_10b7_5b57, + &pci_ss_info_10b7_5c57, + &pci_ss_info_10b7_615c, + &pci_ss_info_10b7_6556, + &pci_ss_info_10b7_656a, + &pci_ss_info_10b7_656b, + &pci_ss_info_10b7_7000, + &pci_ss_info_10b7_9004, + &pci_ss_info_10b7_9005, + &pci_ss_info_10b7_9055, + &pci_ss_info_10b7_9800, + &pci_ss_info_10b7_9805, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10b8[] = { + &pci_ss_info_10b8_2001, + &pci_ss_info_10b8_2002, + &pci_ss_info_10b8_2003, + &pci_ss_info_10b8_2005, + &pci_ss_info_10b8_2011, + &pci_ss_info_10b8_8034, + &pci_ss_info_10b8_a011, + &pci_ss_info_10b8_a012, + &pci_ss_info_10b8_a014, + &pci_ss_info_10b8_a015, + &pci_ss_info_10b8_a016, + &pci_ss_info_10b8_a017, + NULL +}; +#endif +static const pciSubsystemInfo *pci_ss_list_10b9[] = { + &pci_ss_info_10b9_0111, + &pci_ss_info_10b9_1521, + &pci_ss_info_10b9_1523, + &pci_ss_info_10b9_1533, + &pci_ss_info_10b9_1541, + &pci_ss_info_10b9_7101, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10ba[] = { + &pci_ss_info_10ba_0e00, + NULL +}; +#endif +#define pci_ss_list_10bb NULL +#define pci_ss_list_10bc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10bd[] = { + &pci_ss_info_10bd_0000, + &pci_ss_info_10bd_0320, + NULL +}; +#endif +#define pci_ss_list_10be NULL +#define pci_ss_list_10bf NULL +#define pci_ss_list_10c0 NULL +#define pci_ss_list_10c1 NULL +#define pci_ss_list_10c2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10c3[] = { + &pci_ss_info_10c3_1100, + NULL +}; +#endif +#define pci_ss_list_10c4 NULL +#define pci_ss_list_10c5 NULL +#define pci_ss_list_10c6 NULL +#define pci_ss_list_10c7 NULL +static const pciSubsystemInfo *pci_ss_list_10c8[] = { + &pci_ss_info_10c8_0004, + &pci_ss_info_10c8_0016, + &pci_ss_info_10c8_8005, + NULL +}; +#define pci_ss_list_10c9 NULL +#define pci_ss_list_10ca NULL +#define pci_ss_list_10cb NULL +#define pci_ss_list_10cc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10cd[] = { + &pci_ss_info_10cd_1310, + NULL +}; +#endif +#define pci_ss_list_10ce NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10cf[] = { + &pci_ss_info_10cf_1029, + &pci_ss_info_10cf_102c, + &pci_ss_info_10cf_103c, + &pci_ss_info_10cf_104a, + &pci_ss_info_10cf_1055, + &pci_ss_info_10cf_1056, + &pci_ss_info_10cf_1057, + &pci_ss_info_10cf_1059, + &pci_ss_info_10cf_105f, + &pci_ss_info_10cf_1063, + &pci_ss_info_10cf_1064, + &pci_ss_info_10cf_106a, + &pci_ss_info_10cf_1072, + &pci_ss_info_10cf_1094, + &pci_ss_info_10cf_1095, + &pci_ss_info_10cf_1098, + &pci_ss_info_10cf_1099, + &pci_ss_info_10cf_10a8, + &pci_ss_info_10cf_10a9, + &pci_ss_info_10cf_10aa, + &pci_ss_info_10cf_10ab, + &pci_ss_info_10cf_10ac, + &pci_ss_info_10cf_10ad, + &pci_ss_info_10cf_10b4, + &pci_ss_info_10cf_1115, + &pci_ss_info_10cf_1143, + NULL +}; +#endif +#define pci_ss_list_10d0 NULL +#define pci_ss_list_10d1 NULL +#define pci_ss_list_10d2 NULL +#define pci_ss_list_10d3 NULL +#define pci_ss_list_10d4 NULL +#define pci_ss_list_10d5 NULL +#define pci_ss_list_10d6 NULL +#define pci_ss_list_10d7 NULL +#define pci_ss_list_10d8 NULL +#define pci_ss_list_10d9 NULL +#define pci_ss_list_10da NULL +#define pci_ss_list_10db NULL +#define pci_ss_list_10dc NULL +#define pci_ss_list_10dd NULL +static const pciSubsystemInfo *pci_ss_list_10de[] = { + &pci_ss_info_10de_0005, + &pci_ss_info_10de_000f, + &pci_ss_info_10de_001e, + &pci_ss_info_10de_0020, + NULL +}; +#define pci_ss_list_10df NULL +#define pci_ss_list_10e0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10e1[] = { + &pci_ss_info_10e1_0391, + NULL +}; +#endif +#define pci_ss_list_10e2 NULL +#define pci_ss_list_10e3 NULL +#define pci_ss_list_10e4 NULL +#define pci_ss_list_10e5 NULL +#define pci_ss_list_10e6 NULL +#define pci_ss_list_10e7 NULL +#define pci_ss_list_10e8 NULL +#define pci_ss_list_10e9 NULL +#define pci_ss_list_10ea NULL +#define pci_ss_list_10eb NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10ec[] = { + &pci_ss_info_10ec_8029, + &pci_ss_info_10ec_8129, + &pci_ss_info_10ec_8138, + &pci_ss_info_10ec_8139, + NULL +}; +#endif +#define pci_ss_list_10ed NULL +#define pci_ss_list_10ee NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10ef[] = { + &pci_ss_info_10ef_8169, + NULL +}; +#endif +#define pci_ss_list_10f0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10f1[] = { + &pci_ss_info_10f1_0002, + &pci_ss_info_10f1_2462, + NULL +}; +#endif +#define pci_ss_list_10f2 NULL +#define pci_ss_list_10f3 NULL +#define pci_ss_list_10f4 NULL +#define pci_ss_list_10f5 NULL +#define pci_ss_list_10f6 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_10f7[] = { + &pci_ss_info_10f7_8308, + &pci_ss_info_10f7_8309, + &pci_ss_info_10f7_830b, + &pci_ss_info_10f7_830d, + &pci_ss_info_10f7_8312, + NULL +}; +#endif +#define pci_ss_list_10f8 NULL +#define pci_ss_list_10f9 NULL +#define pci_ss_list_10fa NULL +#define pci_ss_list_10fb NULL +#define pci_ss_list_10fc NULL +#define pci_ss_list_10fd NULL +#define pci_ss_list_10fe NULL +#define pci_ss_list_10ff NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1100[] = { + &pci_ss_info_1100_102b, + NULL +}; +#endif +#define pci_ss_list_1101 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1102[] = { + &pci_ss_info_1102_0010, + &pci_ss_info_1102_0020, + &pci_ss_info_1102_0021, + &pci_ss_info_1102_002f, + &pci_ss_info_1102_0040, + &pci_ss_info_1102_0051, + &pci_ss_info_1102_0053, + &pci_ss_info_1102_100f, + &pci_ss_info_1102_1015, + &pci_ss_info_1102_1016, + &pci_ss_info_1102_1018, + &pci_ss_info_1102_101d, + &pci_ss_info_1102_101e, + &pci_ss_info_1102_1020, + &pci_ss_info_1102_1021, + &pci_ss_info_1102_1023, + &pci_ss_info_1102_1024, + &pci_ss_info_1102_1026, + &pci_ss_info_1102_1029, + &pci_ss_info_1102_102c, + &pci_ss_info_1102_102d, + &pci_ss_info_1102_102e, + &pci_ss_info_1102_102f, + &pci_ss_info_1102_1031, + &pci_ss_info_1102_1034, + &pci_ss_info_1102_4001, + &pci_ss_info_1102_8022, + &pci_ss_info_1102_8023, + &pci_ss_info_1102_8024, + &pci_ss_info_1102_8025, + &pci_ss_info_1102_8026, + &pci_ss_info_1102_8027, + &pci_ss_info_1102_8028, + &pci_ss_info_1102_8031, + &pci_ss_info_1102_8040, + &pci_ss_info_1102_8051, + &pci_ss_info_1102_8061, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1103[] = { + &pci_ss_info_1103_0001, + &pci_ss_info_1103_0005, + NULL +}; +#endif +#define pci_ss_list_1104 NULL +#define pci_ss_list_1105 NULL +static const pciSubsystemInfo *pci_ss_list_1106[] = { + &pci_ss_info_1106_0000, + &pci_ss_info_1106_0100, + &pci_ss_info_1106_0102, + &pci_ss_info_1106_0571, + &pci_ss_info_1106_0686, + &pci_ss_info_1106_4511, + NULL +}; +#define pci_ss_list_1107 NULL +#define pci_ss_list_1108 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1109[] = { + &pci_ss_info_1109_2400, + &pci_ss_info_1109_2a00, + &pci_ss_info_1109_2b00, + &pci_ss_info_1109_3000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_110a[] = { + &pci_ss_info_110a_0018, + &pci_ss_info_110a_001e, + &pci_ss_info_110a_0032, + &pci_ss_info_110a_8005, + NULL +}; +#endif +#define pci_ss_list_110b NULL +#define pci_ss_list_110c NULL +#define pci_ss_list_110d NULL +#define pci_ss_list_110e NULL +#define pci_ss_list_110f NULL +#define pci_ss_list_1110 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1111[] = { + &pci_ss_info_1111_1111, + &pci_ss_info_1111_1112, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1112[] = { + &pci_ss_info_1112_2300, + &pci_ss_info_1112_2320, + &pci_ss_info_1112_2340, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1113[] = { + &pci_ss_info_1113_1207, + &pci_ss_info_1113_1208, + &pci_ss_info_1113_1211, + &pci_ss_info_1113_1220, + &pci_ss_info_1113_2220, + &pci_ss_info_1113_9211, + NULL +}; +#endif +#define pci_ss_list_1114 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1115[] = { + &pci_ss_info_1115_1181, + NULL +}; +#endif +#define pci_ss_list_1116 NULL +#define pci_ss_list_1117 NULL +#define pci_ss_list_1118 NULL +#define pci_ss_list_1119 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_111a[] = { + &pci_ss_info_111a_0000, + &pci_ss_info_111a_0001, + &pci_ss_info_111a_0009, + &pci_ss_info_111a_0101, + &pci_ss_info_111a_0109, + &pci_ss_info_111a_0809, + &pci_ss_info_111a_0909, + &pci_ss_info_111a_0a09, + &pci_ss_info_111a_1001, + &pci_ss_info_111a_1020, + NULL +}; +#endif +#define pci_ss_list_111b NULL +#define pci_ss_list_111c NULL +#define pci_ss_list_111d NULL +#define pci_ss_list_111e NULL +#define pci_ss_list_111f NULL +#define pci_ss_list_1120 NULL +#define pci_ss_list_1121 NULL +#define pci_ss_list_1122 NULL +#define pci_ss_list_1123 NULL +#define pci_ss_list_1124 NULL +#define pci_ss_list_1125 NULL +#define pci_ss_list_1126 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1127[] = { + &pci_ss_info_1127_0400, + NULL +}; +#endif +#define pci_ss_list_1129 NULL +#define pci_ss_list_112a NULL +#define pci_ss_list_112b NULL +#define pci_ss_list_112c NULL +#define pci_ss_list_112d NULL +#define pci_ss_list_112e NULL +#define pci_ss_list_112f NULL +#define pci_ss_list_1130 NULL +#define pci_ss_list_1131 NULL +#define pci_ss_list_1132 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1133[] = { + &pci_ss_info_1133_e001, + &pci_ss_info_1133_e002, + &pci_ss_info_1133_e003, + &pci_ss_info_1133_e004, + &pci_ss_info_1133_e005, + &pci_ss_info_1133_e010, + &pci_ss_info_1133_e012, + &pci_ss_info_1133_e014, + NULL +}; +#endif +#define pci_ss_list_1134 NULL +#define pci_ss_list_1135 NULL +#define pci_ss_list_1136 NULL +#define pci_ss_list_1137 NULL +#define pci_ss_list_1138 NULL +#define pci_ss_list_1139 NULL +#define pci_ss_list_113a NULL +#define pci_ss_list_113b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_113c[] = { + &pci_ss_info_113c_03a2, + NULL +}; +#endif +#define pci_ss_list_113d NULL +#define pci_ss_list_113e NULL +#define pci_ss_list_113f NULL +#define pci_ss_list_1140 NULL +#define pci_ss_list_1141 NULL +#define pci_ss_list_1142 NULL +#define pci_ss_list_1143 NULL +#define pci_ss_list_1144 NULL +#define pci_ss_list_1145 NULL +#define pci_ss_list_1146 NULL +#define pci_ss_list_1147 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1148[] = { + &pci_ss_info_1148_5021, + &pci_ss_info_1148_5041, + &pci_ss_info_1148_5043, + &pci_ss_info_1148_5051, + &pci_ss_info_1148_5061, + &pci_ss_info_1148_5071, + &pci_ss_info_1148_5521, + &pci_ss_info_1148_5522, + &pci_ss_info_1148_5541, + &pci_ss_info_1148_5543, + &pci_ss_info_1148_5544, + &pci_ss_info_1148_5821, + &pci_ss_info_1148_5822, + &pci_ss_info_1148_5841, + &pci_ss_info_1148_5843, + &pci_ss_info_1148_5844, + &pci_ss_info_1148_9521, + &pci_ss_info_1148_9821, + &pci_ss_info_1148_9822, + &pci_ss_info_1148_9841, + &pci_ss_info_1148_9842, + &pci_ss_info_1148_9843, + &pci_ss_info_1148_9844, + &pci_ss_info_1148_9861, + &pci_ss_info_1148_9862, + &pci_ss_info_1148_9871, + &pci_ss_info_1148_9872, + NULL +}; +#endif +#define pci_ss_list_1149 NULL +#define pci_ss_list_114a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_114b[] = { + &pci_ss_info_114b_2003, + NULL +}; +#endif +#define pci_ss_list_114c NULL +#define pci_ss_list_114d NULL +#define pci_ss_list_114e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_114f[] = { + &pci_ss_info_114f_0030, + &pci_ss_info_114f_0031, + &pci_ss_info_114f_0050, + &pci_ss_info_114f_0051, + &pci_ss_info_114f_0052, + &pci_ss_info_114f_0053, + NULL +}; +#endif +#define pci_ss_list_1150 NULL +#define pci_ss_list_1151 NULL +#define pci_ss_list_1152 NULL +#define pci_ss_list_1153 NULL +#define pci_ss_list_1154 NULL +#define pci_ss_list_1155 NULL +#define pci_ss_list_1156 NULL +#define pci_ss_list_1157 NULL +#define pci_ss_list_1158 NULL +#define pci_ss_list_1159 NULL +#define pci_ss_list_115a NULL +#define pci_ss_list_115b NULL +#define pci_ss_list_115c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_115d[] = { + &pci_ss_info_115d_0002, + &pci_ss_info_115d_0181, + &pci_ss_info_115d_0182, + &pci_ss_info_115d_0183, + &pci_ss_info_115d_1081, + &pci_ss_info_115d_1181, + &pci_ss_info_115d_1182, + NULL +}; +#endif +#define pci_ss_list_115e NULL +#define pci_ss_list_115f NULL +#define pci_ss_list_1160 NULL +#define pci_ss_list_1161 NULL +#define pci_ss_list_1162 NULL +#define pci_ss_list_1163 NULL +#define pci_ss_list_1164 NULL +#define pci_ss_list_1165 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1166[] = { + &pci_ss_info_1166_1648, + NULL +}; +#endif +#define pci_ss_list_1167 NULL +#define pci_ss_list_1168 NULL +#define pci_ss_list_1169 NULL +#define pci_ss_list_116a NULL +#define pci_ss_list_116b NULL +#define pci_ss_list_116c NULL +#define pci_ss_list_116d NULL +#define pci_ss_list_116e NULL +#define pci_ss_list_116f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1170[] = { + &pci_ss_info_1170_3209, + NULL +}; +#endif +#define pci_ss_list_1171 NULL +#define pci_ss_list_1172 NULL +#define pci_ss_list_1173 NULL +#define pci_ss_list_1174 NULL +#define pci_ss_list_1175 NULL +#define pci_ss_list_1176 NULL +#define pci_ss_list_1177 NULL +#define pci_ss_list_1178 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1179[] = { + &pci_ss_info_1179_0001, + &pci_ss_info_1179_0002, + &pci_ss_info_1179_0003, + &pci_ss_info_1179_0181, + &pci_ss_info_1179_0203, + &pci_ss_info_1179_0204, + &pci_ss_info_1179_ff00, + NULL +}; +#endif +#define pci_ss_list_117a NULL +#define pci_ss_list_117b NULL +#define pci_ss_list_117c NULL +#define pci_ss_list_117d NULL +#define pci_ss_list_117e NULL +#define pci_ss_list_117f NULL +#define pci_ss_list_1180 NULL +#define pci_ss_list_1181 NULL +#define pci_ss_list_1183 NULL +#define pci_ss_list_1184 NULL +#define pci_ss_list_1185 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1186[] = { + &pci_ss_info_1186_0100, + &pci_ss_info_1186_0300, + &pci_ss_info_1186_1002, + &pci_ss_info_1186_1012, + &pci_ss_info_1186_1100, + &pci_ss_info_1186_1101, + &pci_ss_info_1186_1102, + &pci_ss_info_1186_1112, + &pci_ss_info_1186_1140, + &pci_ss_info_1186_1142, + &pci_ss_info_1186_1200, + &pci_ss_info_1186_1300, + &pci_ss_info_1186_1301, + &pci_ss_info_1186_1320, + &pci_ss_info_1186_1400, + &pci_ss_info_1186_1401, + &pci_ss_info_1186_3501, + &pci_ss_info_1186_7801, + &pci_ss_info_1186_8139, + NULL +}; +#endif +#define pci_ss_list_1187 NULL +#define pci_ss_list_1188 NULL +#define pci_ss_list_1189 NULL +#define pci_ss_list_118a NULL +#define pci_ss_list_118b NULL +#define pci_ss_list_118c NULL +#define pci_ss_list_118d NULL +#define pci_ss_list_118e NULL +#define pci_ss_list_118f NULL +#define pci_ss_list_1190 NULL +#define pci_ss_list_1191 NULL +#define pci_ss_list_1192 NULL +#define pci_ss_list_1193 NULL +#define pci_ss_list_1194 NULL +#define pci_ss_list_1195 NULL +#define pci_ss_list_1196 NULL +#define pci_ss_list_1197 NULL +#define pci_ss_list_1198 NULL +#define pci_ss_list_1199 NULL +#define pci_ss_list_119a NULL +#define pci_ss_list_119b NULL +#define pci_ss_list_119c NULL +#define pci_ss_list_119d NULL +#define pci_ss_list_119e NULL +#define pci_ss_list_119f NULL +#define pci_ss_list_11a0 NULL +#define pci_ss_list_11a1 NULL +#define pci_ss_list_11a2 NULL +#define pci_ss_list_11a3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11a4[] = { + &pci_ss_info_11a4_000a, + &pci_ss_info_11a4_000b, + NULL +}; +#endif +#define pci_ss_list_11a5 NULL +#define pci_ss_list_11a6 NULL +#define pci_ss_list_11a7 NULL +#define pci_ss_list_11a8 NULL +#define pci_ss_list_11a9 NULL +#define pci_ss_list_11aa NULL +#define pci_ss_list_11ab NULL +#define pci_ss_list_11ac NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11ad[] = { + &pci_ss_info_11ad_0002, + &pci_ss_info_11ad_0003, + &pci_ss_info_11ad_c001, + &pci_ss_info_11ad_f003, + &pci_ss_info_11ad_ffff, + NULL +}; +#endif +#define pci_ss_list_11ae NULL +#define pci_ss_list_11af NULL +#define pci_ss_list_11b0 NULL +#define pci_ss_list_11b1 NULL +#define pci_ss_list_11b2 NULL +#define pci_ss_list_11b3 NULL +#define pci_ss_list_11b4 NULL +#define pci_ss_list_11b5 NULL +#define pci_ss_list_11b6 NULL +#define pci_ss_list_11b7 NULL +#define pci_ss_list_11b8 NULL +#define pci_ss_list_11b9 NULL +#define pci_ss_list_11ba NULL +#define pci_ss_list_11bb NULL +#define pci_ss_list_11bc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11bd[] = { + &pci_ss_info_11bd_0006, + &pci_ss_info_11bd_000a, + &pci_ss_info_11bd_000e, + &pci_ss_info_11bd_0012, + &pci_ss_info_11bd_001c, + NULL +}; +#endif +#define pci_ss_list_11be NULL +#define pci_ss_list_11bf NULL +#define pci_ss_list_11c0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11c1[] = { + &pci_ss_info_11c1_0440, + &pci_ss_info_11c1_0441, + &pci_ss_info_11c1_0442, + NULL +}; +#endif +#define pci_ss_list_11c2 NULL +#define pci_ss_list_11c3 NULL +#define pci_ss_list_11c4 NULL +#define pci_ss_list_11c5 NULL +#define pci_ss_list_11c6 NULL +#define pci_ss_list_11c7 NULL +#define pci_ss_list_11c8 NULL +#define pci_ss_list_11c9 NULL +#define pci_ss_list_11ca NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11cb[] = { + &pci_ss_info_11cb_0200, + &pci_ss_info_11cb_b008, + NULL +}; +#endif +#define pci_ss_list_11cc NULL +#define pci_ss_list_11cd NULL +#define pci_ss_list_11ce NULL +#define pci_ss_list_11cf NULL +#define pci_ss_list_11d0 NULL +#define pci_ss_list_11d1 NULL +#define pci_ss_list_11d2 NULL +#define pci_ss_list_11d3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11d4[] = { + &pci_ss_info_11d4_0040, + &pci_ss_info_11d4_0048, + &pci_ss_info_11d4_5340, + NULL +}; +#endif +#define pci_ss_list_11d5 NULL +#define pci_ss_list_11d6 NULL +#define pci_ss_list_11d7 NULL +#define pci_ss_list_11d8 NULL +#define pci_ss_list_11d9 NULL +#define pci_ss_list_11da NULL +#define pci_ss_list_11db NULL +#define pci_ss_list_11dc NULL +#define pci_ss_list_11dd NULL +#define pci_ss_list_11de NULL +#define pci_ss_list_11df NULL +#define pci_ss_list_11e0 NULL +#define pci_ss_list_11e1 NULL +#define pci_ss_list_11e2 NULL +#define pci_ss_list_11e3 NULL +#define pci_ss_list_11e4 NULL +#define pci_ss_list_11e5 NULL +#define pci_ss_list_11e6 NULL +#define pci_ss_list_11e7 NULL +#define pci_ss_list_11e8 NULL +#define pci_ss_list_11e9 NULL +#define pci_ss_list_11ea NULL +#define pci_ss_list_11eb NULL +#define pci_ss_list_11ec NULL +#define pci_ss_list_11ed NULL +#define pci_ss_list_11ee NULL +#define pci_ss_list_11ef NULL +#define pci_ss_list_11f0 NULL +#define pci_ss_list_11f1 NULL +#define pci_ss_list_11f2 NULL +#define pci_ss_list_11f3 NULL +#define pci_ss_list_11f4 NULL +#define pci_ss_list_11f5 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_11f6[] = { + &pci_ss_info_11f6_0503, + &pci_ss_info_11f6_2011, + &pci_ss_info_11f6_8139, + NULL +}; +#endif +#define pci_ss_list_11f7 NULL +#define pci_ss_list_11f8 NULL +#define pci_ss_list_11f9 NULL +#define pci_ss_list_11fa NULL +#define pci_ss_list_11fb NULL +#define pci_ss_list_11fc NULL +#define pci_ss_list_11fd NULL +#define pci_ss_list_11fe NULL +#define pci_ss_list_11ff NULL +#define pci_ss_list_1200 NULL +#define pci_ss_list_1201 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1202[] = { + &pci_ss_info_1202_9841, + &pci_ss_info_1202_9842, + &pci_ss_info_1202_9843, + &pci_ss_info_1202_9844, + NULL +}; +#endif +#define pci_ss_list_1203 NULL +#define pci_ss_list_1204 NULL +#define pci_ss_list_1205 NULL +#define pci_ss_list_1206 NULL +#define pci_ss_list_1208 NULL +#define pci_ss_list_1209 NULL +#define pci_ss_list_120a NULL +#define pci_ss_list_120b NULL +#define pci_ss_list_120c NULL +#define pci_ss_list_120d NULL +#define pci_ss_list_120e NULL +#define pci_ss_list_120f NULL +#define pci_ss_list_1210 NULL +#define pci_ss_list_1211 NULL +#define pci_ss_list_1212 NULL +#define pci_ss_list_1213 NULL +#define pci_ss_list_1214 NULL +#define pci_ss_list_1215 NULL +#define pci_ss_list_1216 NULL +#define pci_ss_list_1217 NULL +#define pci_ss_list_1218 NULL +#define pci_ss_list_1219 NULL +static const pciSubsystemInfo *pci_ss_list_121a[] = { + &pci_ss_info_121a_0001, + &pci_ss_info_121a_0003, + &pci_ss_info_121a_0004, + &pci_ss_info_121a_0009, + &pci_ss_info_121a_0030, + &pci_ss_info_121a_0031, + &pci_ss_info_121a_0034, + &pci_ss_info_121a_0036, + &pci_ss_info_121a_0037, + &pci_ss_info_121a_0038, + &pci_ss_info_121a_003a, + &pci_ss_info_121a_0044, + &pci_ss_info_121a_004b, + &pci_ss_info_121a_004c, + &pci_ss_info_121a_004d, + &pci_ss_info_121a_004e, + &pci_ss_info_121a_0051, + &pci_ss_info_121a_0052, + &pci_ss_info_121a_0060, + &pci_ss_info_121a_0061, + &pci_ss_info_121a_0062, + NULL +}; +#define pci_ss_list_121b NULL +#define pci_ss_list_121c NULL +#define pci_ss_list_121d NULL +#define pci_ss_list_121e NULL +#define pci_ss_list_121f NULL +#define pci_ss_list_1220 NULL +#define pci_ss_list_1221 NULL +#define pci_ss_list_1222 NULL +#define pci_ss_list_1223 NULL +#define pci_ss_list_1224 NULL +#define pci_ss_list_1225 NULL +#define pci_ss_list_1227 NULL +#define pci_ss_list_1228 NULL +#define pci_ss_list_1229 NULL +#define pci_ss_list_122a NULL +#define pci_ss_list_122b NULL +#define pci_ss_list_122c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_122d[] = { + &pci_ss_info_122d_0001, + &pci_ss_info_122d_1002, + &pci_ss_info_122d_1206, + &pci_ss_info_122d_1207, + &pci_ss_info_122d_1208, + &pci_ss_info_122d_4002, + &pci_ss_info_122d_4003, + &pci_ss_info_122d_4005, + &pci_ss_info_122d_4006, + &pci_ss_info_122d_4007, + &pci_ss_info_122d_4008, + &pci_ss_info_122d_4009, + &pci_ss_info_122d_4010, + &pci_ss_info_122d_4011, + &pci_ss_info_122d_4012, + &pci_ss_info_122d_4013, + &pci_ss_info_122d_4015, + &pci_ss_info_122d_4016, + &pci_ss_info_122d_4017, + &pci_ss_info_122d_4018, + &pci_ss_info_122d_4019, + &pci_ss_info_122d_4020, + &pci_ss_info_122d_4021, + &pci_ss_info_122d_4022, + &pci_ss_info_122d_4023, + &pci_ss_info_122d_4024, + &pci_ss_info_122d_4025, + &pci_ss_info_122d_4027, + &pci_ss_info_122d_4029, + &pci_ss_info_122d_4030, + &pci_ss_info_122d_4031, + &pci_ss_info_122d_4033, + &pci_ss_info_122d_4034, + &pci_ss_info_122d_4035, + &pci_ss_info_122d_4050, + &pci_ss_info_122d_4051, + &pci_ss_info_122d_4052, + &pci_ss_info_122d_4054, + &pci_ss_info_122d_4055, + &pci_ss_info_122d_4056, + &pci_ss_info_122d_4057, + &pci_ss_info_122d_4100, + &pci_ss_info_122d_4101, + &pci_ss_info_122d_4102, + &pci_ss_info_122d_4302, + NULL +}; +#endif +#define pci_ss_list_122e NULL +#define pci_ss_list_122f NULL +#define pci_ss_list_1230 NULL +#define pci_ss_list_1231 NULL +#define pci_ss_list_1232 NULL +#define pci_ss_list_1233 NULL +#define pci_ss_list_1234 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1235[] = { + &pci_ss_info_1235_4320, + &pci_ss_info_1235_4321, + &pci_ss_info_1235_4322, + &pci_ss_info_1235_4324, + NULL +}; +#endif +#define pci_ss_list_1236 NULL +#define pci_ss_list_1237 NULL +#define pci_ss_list_1238 NULL +#define pci_ss_list_1239 NULL +#define pci_ss_list_123a NULL +#define pci_ss_list_123b NULL +#define pci_ss_list_123c NULL +#define pci_ss_list_123d NULL +#define pci_ss_list_123e NULL +#define pci_ss_list_123f NULL +#define pci_ss_list_1240 NULL +#define pci_ss_list_1241 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1242[] = { + &pci_ss_info_1242_6562, + &pci_ss_info_1242_656a, + NULL +}; +#endif +#define pci_ss_list_1243 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1244[] = { + &pci_ss_info_1244_0a00, + NULL +}; +#endif +#define pci_ss_list_1245 NULL +#define pci_ss_list_1246 NULL +#define pci_ss_list_1247 NULL +#define pci_ss_list_1248 NULL +#define pci_ss_list_1249 NULL +#define pci_ss_list_124a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_124b[] = { + &pci_ss_info_124b_9080, + NULL +}; +#endif +#define pci_ss_list_124c NULL +#define pci_ss_list_124d NULL +#define pci_ss_list_124e NULL +#define pci_ss_list_124f NULL +#define pci_ss_list_1250 NULL +#define pci_ss_list_1251 NULL +#define pci_ss_list_1253 NULL +#define pci_ss_list_1254 NULL +#define pci_ss_list_1255 NULL +#define pci_ss_list_1256 NULL +#define pci_ss_list_1257 NULL +#define pci_ss_list_1258 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1259[] = { + &pci_ss_info_1259_2400, + &pci_ss_info_1259_2450, + &pci_ss_info_1259_2454, + &pci_ss_info_1259_2500, + &pci_ss_info_1259_2503, + &pci_ss_info_1259_2560, + &pci_ss_info_1259_2561, + &pci_ss_info_1259_2700, + &pci_ss_info_1259_2701, + &pci_ss_info_1259_2800, + &pci_ss_info_1259_2970, + &pci_ss_info_1259_2972, + &pci_ss_info_1259_2975, + &pci_ss_info_1259_2977, + NULL +}; +#endif +#define pci_ss_list_125a NULL +#define pci_ss_list_125b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_125c[] = { + &pci_ss_info_125c_0640, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_125d[] = { + &pci_ss_info_125d_0424, + &pci_ss_info_125d_0425, + &pci_ss_info_125d_0426, + &pci_ss_info_125d_0427, + &pci_ss_info_125d_0428, + &pci_ss_info_125d_0429, + &pci_ss_info_125d_1988, + &pci_ss_info_125d_1989, + &pci_ss_info_125d_8888, + NULL +}; +#endif +#define pci_ss_list_125e NULL +#define pci_ss_list_125f NULL +#define pci_ss_list_1260 NULL +#define pci_ss_list_1261 NULL +#define pci_ss_list_1262 NULL +#define pci_ss_list_1263 NULL +#define pci_ss_list_1264 NULL +#define pci_ss_list_1265 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1266[] = { + &pci_ss_info_1266_0001, + &pci_ss_info_1266_0004, + &pci_ss_info_1266_1910, + NULL +}; +#endif +#define pci_ss_list_1267 NULL +#define pci_ss_list_1268 NULL +#define pci_ss_list_1269 NULL +#define pci_ss_list_126a NULL +#define pci_ss_list_126b NULL +#define pci_ss_list_126c NULL +#define pci_ss_list_126d NULL +#define pci_ss_list_126e NULL +#define pci_ss_list_126f NULL +#define pci_ss_list_1270 NULL +#define pci_ss_list_1271 NULL +#define pci_ss_list_1272 NULL +#define pci_ss_list_1273 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1274[] = { + &pci_ss_info_1274_1371, + &pci_ss_info_1274_2000, + &pci_ss_info_1274_2003, + &pci_ss_info_1274_5880, + NULL +}; +#endif +#define pci_ss_list_1275 NULL +#define pci_ss_list_1276 NULL +#define pci_ss_list_1277 NULL +#define pci_ss_list_1278 NULL +#define pci_ss_list_1279 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_127a[] = { + &pci_ss_info_127a_0001, + &pci_ss_info_127a_0002, + &pci_ss_info_127a_0003, + &pci_ss_info_127a_0044, + &pci_ss_info_127a_0048, + &pci_ss_info_127a_0122, + &pci_ss_info_127a_0144, + &pci_ss_info_127a_0222, + &pci_ss_info_127a_0244, + &pci_ss_info_127a_0322, + &pci_ss_info_127a_0422, + &pci_ss_info_127a_1002, + &pci_ss_info_127a_1122, + &pci_ss_info_127a_1222, + &pci_ss_info_127a_1322, + &pci_ss_info_127a_1522, + &pci_ss_info_127a_1622, + &pci_ss_info_127a_1722, + &pci_ss_info_127a_4311, + NULL +}; +#endif +#define pci_ss_list_127b NULL +#define pci_ss_list_127c NULL +#define pci_ss_list_127d NULL +#define pci_ss_list_127e NULL +#define pci_ss_list_127f NULL +#define pci_ss_list_1280 NULL +#define pci_ss_list_1281 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1282[] = { + &pci_ss_info_1282_9100, + NULL +}; +#endif +#define pci_ss_list_1283 NULL +#define pci_ss_list_1284 NULL +#define pci_ss_list_1285 NULL +#define pci_ss_list_1286 NULL +#define pci_ss_list_1287 NULL +#define pci_ss_list_1288 NULL +#define pci_ss_list_1289 NULL +#define pci_ss_list_128a NULL +#define pci_ss_list_128b NULL +#define pci_ss_list_128c NULL +#define pci_ss_list_128d NULL +#define pci_ss_list_128e NULL +#define pci_ss_list_128f NULL +#define pci_ss_list_1290 NULL +#define pci_ss_list_1291 NULL +#define pci_ss_list_1292 NULL +#define pci_ss_list_1293 NULL +#define pci_ss_list_1294 NULL +#define pci_ss_list_1295 NULL +#define pci_ss_list_1296 NULL +#define pci_ss_list_1297 NULL +#define pci_ss_list_1298 NULL +#define pci_ss_list_1299 NULL +#define pci_ss_list_129a NULL +#define pci_ss_list_129b NULL +#define pci_ss_list_129c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_129d[] = { + &pci_ss_info_129d_0002, + NULL +}; +#endif +#define pci_ss_list_129e NULL +#define pci_ss_list_129f NULL +#define pci_ss_list_12a0 NULL +#define pci_ss_list_12a1 NULL +#define pci_ss_list_12a2 NULL +#define pci_ss_list_12a3 NULL +#define pci_ss_list_12a4 NULL +#define pci_ss_list_12a5 NULL +#define pci_ss_list_12a6 NULL +#define pci_ss_list_12a7 NULL +#define pci_ss_list_12a8 NULL +#define pci_ss_list_12a9 NULL +#define pci_ss_list_12aa NULL +#define pci_ss_list_12ab NULL +#define pci_ss_list_12ac NULL +#define pci_ss_list_12ad NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12ae[] = { + &pci_ss_info_12ae_0001, + &pci_ss_info_12ae_0002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12af[] = { + &pci_ss_info_12af_0019, + NULL +}; +#endif +#define pci_ss_list_12b0 NULL +#define pci_ss_list_12b1 NULL +#define pci_ss_list_12b2 NULL +#define pci_ss_list_12b3 NULL +#define pci_ss_list_12b4 NULL +#define pci_ss_list_12b5 NULL +#define pci_ss_list_12b6 NULL +#define pci_ss_list_12b7 NULL +#define pci_ss_list_12b8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12b9[] = { + &pci_ss_info_12b9_005c, + &pci_ss_info_12b9_005e, + &pci_ss_info_12b9_0062, + &pci_ss_info_12b9_0068, + &pci_ss_info_12b9_007a, + &pci_ss_info_12b9_007f, + &pci_ss_info_12b9_0080, + &pci_ss_info_12b9_0081, + &pci_ss_info_12b9_0091, + &pci_ss_info_12b9_00a2, + &pci_ss_info_12b9_00a3, + &pci_ss_info_12b9_00aa, + &pci_ss_info_12b9_00ab, + &pci_ss_info_12b9_00ac, + &pci_ss_info_12b9_00ad, + NULL +}; +#endif +#define pci_ss_list_12ba NULL +#define pci_ss_list_12bb NULL +#define pci_ss_list_12bc NULL +#define pci_ss_list_12bd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12be[] = { + &pci_ss_info_12be_3042, + NULL +}; +#endif +#define pci_ss_list_12bf NULL +#define pci_ss_list_12c0 NULL +#define pci_ss_list_12c1 NULL +#define pci_ss_list_12c2 NULL +#define pci_ss_list_12c3 NULL +#define pci_ss_list_12c4 NULL +#define pci_ss_list_12c5 NULL +#define pci_ss_list_12c6 NULL +#define pci_ss_list_12c7 NULL +#define pci_ss_list_12c8 NULL +#define pci_ss_list_12c9 NULL +#define pci_ss_list_12ca NULL +#define pci_ss_list_12cb NULL +#define pci_ss_list_12cc NULL +#define pci_ss_list_12cd NULL +#define pci_ss_list_12ce NULL +#define pci_ss_list_12cf NULL +#define pci_ss_list_12d0 NULL +#define pci_ss_list_12d1 NULL +#define pci_ss_list_12d2 NULL +#define pci_ss_list_12d3 NULL +#define pci_ss_list_12d4 NULL +#define pci_ss_list_12d5 NULL +#define pci_ss_list_12d6 NULL +#define pci_ss_list_12d7 NULL +#define pci_ss_list_12d8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12d9[] = { + &pci_ss_info_12d9_000a, + NULL +}; +#endif +#define pci_ss_list_12da NULL +#define pci_ss_list_12db NULL +#define pci_ss_list_12dc NULL +#define pci_ss_list_12dd NULL +#define pci_ss_list_12de NULL +#define pci_ss_list_12df NULL +#define pci_ss_list_12e0 NULL +#define pci_ss_list_12e1 NULL +#define pci_ss_list_12e2 NULL +#define pci_ss_list_12e3 NULL +#define pci_ss_list_12e4 NULL +#define pci_ss_list_12e5 NULL +#define pci_ss_list_12e6 NULL +#define pci_ss_list_12e7 NULL +#define pci_ss_list_12e8 NULL +#define pci_ss_list_12e9 NULL +#define pci_ss_list_12ea NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12eb[] = { + &pci_ss_info_12eb_0001, + &pci_ss_info_12eb_0002, + &pci_ss_info_12eb_0003, + &pci_ss_info_12eb_0088, + &pci_ss_info_12eb_8803, + NULL +}; +#endif +#define pci_ss_list_12ec NULL +#define pci_ss_list_12ed NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_12ee[] = { + &pci_ss_info_12ee_7000, + &pci_ss_info_12ee_7001, + &pci_ss_info_12ee_8011, + NULL +}; +#endif +#define pci_ss_list_12ef NULL +#define pci_ss_list_12f0 NULL +#define pci_ss_list_12f1 NULL +#define pci_ss_list_12f2 NULL +#define pci_ss_list_12f3 NULL +#define pci_ss_list_12f4 NULL +#define pci_ss_list_12f5 NULL +#define pci_ss_list_12f6 NULL +#define pci_ss_list_12f7 NULL +#define pci_ss_list_12f8 NULL +#define pci_ss_list_12f9 NULL +#define pci_ss_list_12fb NULL +#define pci_ss_list_12fc NULL +#define pci_ss_list_12fd NULL +#define pci_ss_list_12fe NULL +#define pci_ss_list_12ff NULL +#define pci_ss_list_1300 NULL +#define pci_ss_list_1302 NULL +#define pci_ss_list_1303 NULL +#define pci_ss_list_1304 NULL +#define pci_ss_list_1305 NULL +#define pci_ss_list_1306 NULL +#define pci_ss_list_1307 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1308[] = { + &pci_ss_info_1308_0001, + NULL +}; +#endif +#define pci_ss_list_1309 NULL +#define pci_ss_list_130a NULL +#define pci_ss_list_130b NULL +#define pci_ss_list_130c NULL +#define pci_ss_list_130d NULL +#define pci_ss_list_130e NULL +#define pci_ss_list_130f NULL +#define pci_ss_list_1310 NULL +#define pci_ss_list_1311 NULL +#define pci_ss_list_1312 NULL +#define pci_ss_list_1313 NULL +#define pci_ss_list_1316 NULL +#define pci_ss_list_1317 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1318[] = { + &pci_ss_info_1318_0000, + NULL +}; +#endif +#define pci_ss_list_1319 NULL +#define pci_ss_list_131a NULL +#define pci_ss_list_131c NULL +#define pci_ss_list_131d NULL +#define pci_ss_list_131e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_131f[] = { + &pci_ss_info_131f_2030, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1320[] = { + &pci_ss_info_1320_10bd, + NULL +}; +#endif +#define pci_ss_list_1321 NULL +#define pci_ss_list_1322 NULL +#define pci_ss_list_1323 NULL +#define pci_ss_list_1324 NULL +#define pci_ss_list_1325 NULL +#define pci_ss_list_1326 NULL +#define pci_ss_list_1327 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1328[] = { + &pci_ss_info_1328_0001, + &pci_ss_info_1328_f001, + NULL +}; +#endif +#define pci_ss_list_1329 NULL +#define pci_ss_list_132a NULL +#define pci_ss_list_132b NULL +#define pci_ss_list_132c NULL +#define pci_ss_list_132d NULL +#define pci_ss_list_1330 NULL +#define pci_ss_list_1331 NULL +#define pci_ss_list_1332 NULL +#define pci_ss_list_1334 NULL +#define pci_ss_list_1335 NULL +#define pci_ss_list_1337 NULL +#define pci_ss_list_1338 NULL +#define pci_ss_list_133a NULL +#define pci_ss_list_133b NULL +#define pci_ss_list_133c NULL +#define pci_ss_list_133d NULL +#define pci_ss_list_133e NULL +#define pci_ss_list_133f NULL +#define pci_ss_list_1340 NULL +#define pci_ss_list_1341 NULL +#define pci_ss_list_1342 NULL +#define pci_ss_list_1343 NULL +#define pci_ss_list_1344 NULL +#define pci_ss_list_1345 NULL +#define pci_ss_list_1347 NULL +#define pci_ss_list_1349 NULL +#define pci_ss_list_134a NULL +#define pci_ss_list_134b NULL +#define pci_ss_list_134c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_134d[] = { + &pci_ss_info_134d_0001, + &pci_ss_info_134d_4c21, + NULL +}; +#endif +#define pci_ss_list_134e NULL +#define pci_ss_list_134f NULL +#define pci_ss_list_1350 NULL +#define pci_ss_list_1351 NULL +#define pci_ss_list_1353 NULL +#define pci_ss_list_1354 NULL +#define pci_ss_list_1355 NULL +#define pci_ss_list_1356 NULL +#define pci_ss_list_1359 NULL +#define pci_ss_list_135a NULL +#define pci_ss_list_135b NULL +#define pci_ss_list_135c NULL +#define pci_ss_list_135d NULL +#define pci_ss_list_135e NULL +#define pci_ss_list_135f NULL +#define pci_ss_list_1360 NULL +#define pci_ss_list_1361 NULL +#define pci_ss_list_1362 NULL +#define pci_ss_list_1363 NULL +#define pci_ss_list_1364 NULL +#define pci_ss_list_1365 NULL +#define pci_ss_list_1366 NULL +#define pci_ss_list_1367 NULL +#define pci_ss_list_1368 NULL +#define pci_ss_list_1369 NULL +#define pci_ss_list_136a NULL +#define pci_ss_list_136b NULL +#define pci_ss_list_136c NULL +#define pci_ss_list_136d NULL +#define pci_ss_list_136f NULL +#define pci_ss_list_1370 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1371[] = { + &pci_ss_info_1371_434e, + NULL +}; +#endif +#define pci_ss_list_1373 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1374[] = { + &pci_ss_info_1374_0001, + &pci_ss_info_1374_0002, + &pci_ss_info_1374_0003, + &pci_ss_info_1374_0007, + &pci_ss_info_1374_0008, + NULL +}; +#endif +#define pci_ss_list_1375 NULL +#define pci_ss_list_1376 NULL +#define pci_ss_list_1377 NULL +#define pci_ss_list_1378 NULL +#define pci_ss_list_1379 NULL +#define pci_ss_list_137a NULL +#define pci_ss_list_137b NULL +#define pci_ss_list_137c NULL +#define pci_ss_list_137d NULL +#define pci_ss_list_137e NULL +#define pci_ss_list_137f NULL +#define pci_ss_list_1380 NULL +#define pci_ss_list_1381 NULL +#define pci_ss_list_1382 NULL +#define pci_ss_list_1383 NULL +#define pci_ss_list_1384 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1385[] = { + &pci_ss_info_1385_1100, + &pci_ss_info_1385_2100, + &pci_ss_info_1385_f004, + NULL +}; +#endif +#define pci_ss_list_1386 NULL +#define pci_ss_list_1387 NULL +#define pci_ss_list_1388 NULL +#define pci_ss_list_1389 NULL +#define pci_ss_list_138a NULL +#define pci_ss_list_138b NULL +#define pci_ss_list_138c NULL +#define pci_ss_list_138d NULL +#define pci_ss_list_138e NULL +#define pci_ss_list_138f NULL +#define pci_ss_list_1390 NULL +#define pci_ss_list_1391 NULL +#define pci_ss_list_1392 NULL +#define pci_ss_list_1393 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1394[] = { + &pci_ss_info_1394_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1395[] = { + &pci_ss_info_1395_0001, + NULL +}; +#endif +#define pci_ss_list_1396 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1397[] = { + &pci_ss_info_1397_2bd0, + NULL +}; +#endif +#define pci_ss_list_1398 NULL +#define pci_ss_list_1399 NULL +#define pci_ss_list_139a NULL +#define pci_ss_list_139b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_139c[] = { + &pci_ss_info_139c_0016, + &pci_ss_info_139c_0017, + NULL +}; +#endif +#define pci_ss_list_139d NULL +#define pci_ss_list_139e NULL +#define pci_ss_list_139f NULL +#define pci_ss_list_13a0 NULL +#define pci_ss_list_13a1 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13a2[] = { + &pci_ss_info_13a2_8002, + &pci_ss_info_13a2_8006, + NULL +}; +#endif +#define pci_ss_list_13a3 NULL +#define pci_ss_list_13a4 NULL +#define pci_ss_list_13a5 NULL +#define pci_ss_list_13a6 NULL +#define pci_ss_list_13a7 NULL +#define pci_ss_list_13a8 NULL +#define pci_ss_list_13a9 NULL +#define pci_ss_list_13aa NULL +#define pci_ss_list_13ab NULL +#define pci_ss_list_13ac NULL +#define pci_ss_list_13ad NULL +#define pci_ss_list_13ae NULL +#define pci_ss_list_13af NULL +#define pci_ss_list_13b0 NULL +#define pci_ss_list_13b1 NULL +#define pci_ss_list_13b2 NULL +#define pci_ss_list_13b3 NULL +#define pci_ss_list_13b4 NULL +#define pci_ss_list_13b5 NULL +#define pci_ss_list_13b6 NULL +#define pci_ss_list_13b7 NULL +#define pci_ss_list_13b8 NULL +#define pci_ss_list_13b9 NULL +#define pci_ss_list_13ba NULL +#define pci_ss_list_13bb NULL +#define pci_ss_list_13bc NULL +#define pci_ss_list_13bd NULL +#define pci_ss_list_13be NULL +#define pci_ss_list_13bf NULL +#define pci_ss_list_13c0 NULL +#define pci_ss_list_13c1 NULL +#define pci_ss_list_13c2 NULL +#define pci_ss_list_13c3 NULL +#define pci_ss_list_13c4 NULL +#define pci_ss_list_13c5 NULL +#define pci_ss_list_13c6 NULL +#define pci_ss_list_13c7 NULL +#define pci_ss_list_13c8 NULL +#define pci_ss_list_13c9 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13ca[] = { + &pci_ss_info_13ca_4231, + NULL +}; +#endif +#define pci_ss_list_13cb NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13cc[] = { + &pci_ss_info_13cc_0000, + &pci_ss_info_13cc_0002, + &pci_ss_info_13cc_0003, + &pci_ss_info_13cc_0004, + &pci_ss_info_13cc_0005, + &pci_ss_info_13cc_0006, + &pci_ss_info_13cc_0007, + &pci_ss_info_13cc_0008, + &pci_ss_info_13cc_0009, + &pci_ss_info_13cc_000a, + &pci_ss_info_13cc_000c, + NULL +}; +#endif +#define pci_ss_list_13cd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13ce[] = { + &pci_ss_info_13ce_8031, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13cf[] = { + &pci_ss_info_13cf_8031, + NULL +}; +#endif +#define pci_ss_list_13d0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13d1[] = { + &pci_ss_info_13d1_ab01, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13d2[] = { + &pci_ss_info_13d2_0300, + &pci_ss_info_13d2_0301, + &pci_ss_info_13d2_0302, + NULL +}; +#endif +#define pci_ss_list_13d3 NULL +#define pci_ss_list_13d4 NULL +#define pci_ss_list_13d5 NULL +#define pci_ss_list_13d6 NULL +#define pci_ss_list_13d7 NULL +#define pci_ss_list_13d8 NULL +#define pci_ss_list_13d9 NULL +#define pci_ss_list_13da NULL +#define pci_ss_list_13db NULL +#define pci_ss_list_13dc NULL +#define pci_ss_list_13dd NULL +#define pci_ss_list_13de NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13df[] = { + &pci_ss_info_13df_0001, + &pci_ss_info_13df_1003, + &pci_ss_info_13df_1005, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13e0[] = { + &pci_ss_info_13e0_0012, + &pci_ss_info_13e0_0020, + &pci_ss_info_13e0_0030, + &pci_ss_info_13e0_0040, + &pci_ss_info_13e0_0041, + &pci_ss_info_13e0_0042, + &pci_ss_info_13e0_0100, + &pci_ss_info_13e0_0117, + &pci_ss_info_13e0_0147, + &pci_ss_info_13e0_0187, + &pci_ss_info_13e0_0197, + &pci_ss_info_13e0_01a7, + &pci_ss_info_13e0_01b7, + &pci_ss_info_13e0_01c7, + &pci_ss_info_13e0_01d7, + &pci_ss_info_13e0_01f7, + &pci_ss_info_13e0_0209, + &pci_ss_info_13e0_020a, + &pci_ss_info_13e0_020d, + &pci_ss_info_13e0_020e, + &pci_ss_info_13e0_0210, + &pci_ss_info_13e0_0240, + &pci_ss_info_13e0_0247, + &pci_ss_info_13e0_0250, + &pci_ss_info_13e0_0260, + &pci_ss_info_13e0_0261, + &pci_ss_info_13e0_0270, + &pci_ss_info_13e0_0290, + &pci_ss_info_13e0_0297, + &pci_ss_info_13e0_02a0, + &pci_ss_info_13e0_02b0, + &pci_ss_info_13e0_02c0, + &pci_ss_info_13e0_02c7, + &pci_ss_info_13e0_02d0, + &pci_ss_info_13e0_0410, + &pci_ss_info_13e0_0412, + &pci_ss_info_13e0_0420, + &pci_ss_info_13e0_0440, + &pci_ss_info_13e0_0441, + &pci_ss_info_13e0_0442, + &pci_ss_info_13e0_0443, + &pci_ss_info_13e0_0450, + &pci_ss_info_13e0_8d84, + &pci_ss_info_13e0_8d85, + &pci_ss_info_13e0_f100, + &pci_ss_info_13e0_f101, + &pci_ss_info_13e0_f102, + NULL +}; +#endif +#define pci_ss_list_13e1 NULL +#define pci_ss_list_13e2 NULL +#define pci_ss_list_13e3 NULL +#define pci_ss_list_13e4 NULL +#define pci_ss_list_13e5 NULL +#define pci_ss_list_13e6 NULL +#define pci_ss_list_13e7 NULL +#define pci_ss_list_13e8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13e9[] = { + &pci_ss_info_13e9_0070, + NULL +}; +#endif +#define pci_ss_list_13ea NULL +#define pci_ss_list_13eb NULL +#define pci_ss_list_13ec NULL +#define pci_ss_list_13ed NULL +#define pci_ss_list_13ee NULL +#define pci_ss_list_13ef NULL +#define pci_ss_list_13f0 NULL +#define pci_ss_list_13f1 NULL +#define pci_ss_list_13f2 NULL +#define pci_ss_list_13f3 NULL +#define pci_ss_list_13f4 NULL +#define pci_ss_list_13f5 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13f6[] = { + &pci_ss_info_13f6_0101, + &pci_ss_info_13f6_0111, + &pci_ss_info_13f6_ffff, + NULL +}; +#endif +#define pci_ss_list_13f7 NULL +#define pci_ss_list_13f8 NULL +#define pci_ss_list_13f9 NULL +#define pci_ss_list_13fa NULL +#define pci_ss_list_13fb NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_13fc[] = { + &pci_ss_info_13fc_2471, + NULL +}; +#endif +#define pci_ss_list_13fd NULL +#define pci_ss_list_13fe NULL +#define pci_ss_list_13ff NULL +#define pci_ss_list_1400 NULL +#define pci_ss_list_1401 NULL +#define pci_ss_list_1402 NULL +#define pci_ss_list_1403 NULL +#define pci_ss_list_1404 NULL +#define pci_ss_list_1405 NULL +#define pci_ss_list_1406 NULL +#define pci_ss_list_1407 NULL +#define pci_ss_list_1408 NULL +#define pci_ss_list_1409 NULL +#define pci_ss_list_140a NULL +#define pci_ss_list_140b NULL +#define pci_ss_list_140c NULL +#define pci_ss_list_140d NULL +#define pci_ss_list_140e NULL +#define pci_ss_list_140f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1410[] = { + &pci_ss_info_1410_0104, + NULL +}; +#endif +#define pci_ss_list_1411 NULL +#define pci_ss_list_1412 NULL +#define pci_ss_list_1413 NULL +#define pci_ss_list_1414 NULL +#define pci_ss_list_1415 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1416[] = { + &pci_ss_info_1416_9804, + NULL +}; +#endif +#define pci_ss_list_1417 NULL +#define pci_ss_list_1418 NULL +#define pci_ss_list_1419 NULL +#define pci_ss_list_141a NULL +#define pci_ss_list_141b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_141d[] = { + &pci_ss_info_141d_0440, + NULL +}; +#endif +#define pci_ss_list_141e NULL +#define pci_ss_list_141f NULL +#define pci_ss_list_1420 NULL +#define pci_ss_list_1421 NULL +#define pci_ss_list_1422 NULL +#define pci_ss_list_1423 NULL +#define pci_ss_list_1424 NULL +#define pci_ss_list_1425 NULL +#define pci_ss_list_1426 NULL +#define pci_ss_list_1427 NULL +#define pci_ss_list_1428 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1429[] = { + &pci_ss_info_1429_d010, + NULL +}; +#endif +#define pci_ss_list_142a NULL +#define pci_ss_list_142b NULL +#define pci_ss_list_142c NULL +#define pci_ss_list_142d NULL +#define pci_ss_list_142e NULL +#define pci_ss_list_142f NULL +#define pci_ss_list_1430 NULL +#define pci_ss_list_1431 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1432[] = { + &pci_ss_info_1432_9130, + NULL +}; +#endif +#define pci_ss_list_1433 NULL +#define pci_ss_list_1435 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1436[] = { + &pci_ss_info_1436_0300, + &pci_ss_info_1436_0301, + &pci_ss_info_1436_0302, + &pci_ss_info_1436_0440, + &pci_ss_info_1436_1003, + &pci_ss_info_1436_1005, + &pci_ss_info_1436_1103, + &pci_ss_info_1436_1105, + &pci_ss_info_1436_1203, + &pci_ss_info_1436_1303, + &pci_ss_info_1436_1602, + &pci_ss_info_1436_8139, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1437[] = { + &pci_ss_info_1437_1105, + NULL +}; +#endif +#define pci_ss_list_1438 NULL +#define pci_ss_list_1439 NULL +#define pci_ss_list_143a NULL +#define pci_ss_list_143b NULL +#define pci_ss_list_143c NULL +#define pci_ss_list_143d NULL +#define pci_ss_list_143e NULL +#define pci_ss_list_143f NULL +#define pci_ss_list_1440 NULL +#define pci_ss_list_1441 NULL +#define pci_ss_list_1442 NULL +#define pci_ss_list_1443 NULL +#define pci_ss_list_1444 NULL +#define pci_ss_list_1445 NULL +#define pci_ss_list_1446 NULL +#define pci_ss_list_1447 NULL +#define pci_ss_list_1448 NULL +#define pci_ss_list_1449 NULL +#define pci_ss_list_144a NULL +#define pci_ss_list_144b NULL +#define pci_ss_list_144c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_144d[] = { + &pci_ss_info_144d_2101, + &pci_ss_info_144d_2104, + &pci_ss_info_144d_2115, + &pci_ss_info_144d_2321, + &pci_ss_info_144d_2501, + &pci_ss_info_144d_2502, + &pci_ss_info_144d_2602, + &pci_ss_info_144d_3510, + &pci_ss_info_144d_c000, + &pci_ss_info_144d_c001, + &pci_ss_info_144d_c003, + &pci_ss_info_144d_c006, + NULL +}; +#endif +#define pci_ss_list_144e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_144f[] = { + &pci_ss_info_144f_0441, + &pci_ss_info_144f_0449, + &pci_ss_info_144f_1005, + &pci_ss_info_144f_100c, + &pci_ss_info_144f_1104, + &pci_ss_info_144f_110d, + &pci_ss_info_144f_1500, + &pci_ss_info_144f_1501, + &pci_ss_info_144f_1502, + &pci_ss_info_144f_1503, + &pci_ss_info_144f_150a, + &pci_ss_info_144f_150b, + &pci_ss_info_144f_1510, + &pci_ss_info_144f_3000, + &pci_ss_info_144f_4005, + NULL +}; +#endif +#define pci_ss_list_1450 NULL +#define pci_ss_list_1451 NULL +#define pci_ss_list_1453 NULL +#define pci_ss_list_1454 NULL +#define pci_ss_list_1455 NULL +#define pci_ss_list_1456 NULL +#define pci_ss_list_1457 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1458[] = { + &pci_ss_info_1458_0400, + &pci_ss_info_1458_0596, + &pci_ss_info_1458_0691, + &pci_ss_info_1458_4000, + &pci_ss_info_1458_4002, + &pci_ss_info_1458_5000, + &pci_ss_info_1458_5001, + &pci_ss_info_1458_5002, + &pci_ss_info_1458_5004, + &pci_ss_info_1458_7600, + &pci_ss_info_1458_a000, + &pci_ss_info_1458_a002, + NULL +}; +#endif +#define pci_ss_list_1459 NULL +#define pci_ss_list_145a NULL +#define pci_ss_list_145b NULL +#define pci_ss_list_145c NULL +#define pci_ss_list_145d NULL +#define pci_ss_list_145e NULL +#define pci_ss_list_145f NULL +#define pci_ss_list_1460 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1461[] = { + &pci_ss_info_1461_0004, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1462[] = { + &pci_ss_info_1462_3091, + &pci_ss_info_1462_3370, + &pci_ss_info_1462_3981, + &pci_ss_info_1462_400a, + &pci_ss_info_1462_5800, + &pci_ss_info_1462_6470, + &pci_ss_info_1462_6560, + &pci_ss_info_1462_6630, + &pci_ss_info_1462_6631, + &pci_ss_info_1462_6632, + &pci_ss_info_1462_6633, + &pci_ss_info_1462_6780, + &pci_ss_info_1462_6820, + &pci_ss_info_1462_6822, + &pci_ss_info_1462_6830, + &pci_ss_info_1462_6880, + &pci_ss_info_1462_6900, + &pci_ss_info_1462_6910, + &pci_ss_info_1462_6930, + &pci_ss_info_1462_6990, + &pci_ss_info_1462_6991, + &pci_ss_info_1462_8661, + &pci_ss_info_1462_8730, + &pci_ss_info_1462_8808, + &pci_ss_info_1462_8817, + &pci_ss_info_1462_8831, + NULL +}; +#endif +#define pci_ss_list_1463 NULL +#define pci_ss_list_1464 NULL +#define pci_ss_list_1465 NULL +#define pci_ss_list_1466 NULL +#define pci_ss_list_1467 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1468[] = { + &pci_ss_info_1468_0410, + &pci_ss_info_1468_0440, + &pci_ss_info_1468_0441, + &pci_ss_info_1468_0449, + &pci_ss_info_1468_2015, + NULL +}; +#endif +#define pci_ss_list_1469 NULL +#define pci_ss_list_146a NULL +#define pci_ss_list_146b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_146c[] = { + &pci_ss_info_146c_1439, + NULL +}; +#endif +#define pci_ss_list_146d NULL +#define pci_ss_list_146e NULL +#define pci_ss_list_146f NULL +#define pci_ss_list_1470 NULL +#define pci_ss_list_1471 NULL +#define pci_ss_list_1472 NULL +#define pci_ss_list_1473 NULL +#define pci_ss_list_1474 NULL +#define pci_ss_list_1475 NULL +#define pci_ss_list_1476 NULL +#define pci_ss_list_1477 NULL +#define pci_ss_list_1478 NULL +#define pci_ss_list_1479 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_147a[] = { + &pci_ss_info_147a_c001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_147b[] = { + &pci_ss_info_147b_0507, + &pci_ss_info_147b_8f00, + &pci_ss_info_147b_8f09, + &pci_ss_info_147b_a401, + &pci_ss_info_147b_a702, + NULL +}; +#endif +#define pci_ss_list_147c NULL +#define pci_ss_list_147d NULL +#define pci_ss_list_147e NULL +#define pci_ss_list_147f NULL +#define pci_ss_list_1480 NULL +#define pci_ss_list_1481 NULL +#define pci_ss_list_1482 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1483[] = { + &pci_ss_info_1483_5020, + &pci_ss_info_1483_5021, + &pci_ss_info_1483_5022, + NULL +}; +#endif +#define pci_ss_list_1484 NULL +#define pci_ss_list_1485 NULL +#define pci_ss_list_1486 NULL +#define pci_ss_list_1487 NULL +#define pci_ss_list_1488 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1489[] = { + &pci_ss_info_1489_6001, + &pci_ss_info_1489_6002, + NULL +}; +#endif +#define pci_ss_list_148a NULL +#define pci_ss_list_148b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_148c[] = { + &pci_ss_info_148c_2003, + &pci_ss_info_148c_2023, + &pci_ss_info_148c_2024, + &pci_ss_info_148c_2025, + &pci_ss_info_148c_2026, + &pci_ss_info_148c_2036, + &pci_ss_info_148c_2039, + NULL +}; +#endif +#define pci_ss_list_148d NULL +#define pci_ss_list_148e NULL +#define pci_ss_list_148f NULL +#define pci_ss_list_1490 NULL +#define pci_ss_list_1491 NULL +#define pci_ss_list_1492 NULL +#define pci_ss_list_1493 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1494[] = { + &pci_ss_info_1494_0300, + &pci_ss_info_1494_0301, + NULL +}; +#endif +#define pci_ss_list_1495 NULL +#define pci_ss_list_1496 NULL +#define pci_ss_list_1497 NULL +#define pci_ss_list_1498 NULL +#define pci_ss_list_1499 NULL +#define pci_ss_list_149a NULL +#define pci_ss_list_149b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_149c[] = { + &pci_ss_info_149c_139a, + &pci_ss_info_149c_8139, + NULL +}; +#endif +#define pci_ss_list_149d NULL +#define pci_ss_list_149e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_149f[] = { + &pci_ss_info_149f_0440, + NULL +}; +#endif +#define pci_ss_list_14a0 NULL +#define pci_ss_list_14a1 NULL +#define pci_ss_list_14a2 NULL +#define pci_ss_list_14a3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14a4[] = { + &pci_ss_info_14a4_2073, + &pci_ss_info_14a4_2077, + &pci_ss_info_14a4_2089, + &pci_ss_info_14a4_2091, + &pci_ss_info_14a4_2104, + &pci_ss_info_14a4_2105, + &pci_ss_info_14a4_2106, + &pci_ss_info_14a4_2107, + &pci_ss_info_14a4_2172, + NULL +}; +#endif +#define pci_ss_list_14a5 NULL +#define pci_ss_list_14a6 NULL +#define pci_ss_list_14a7 NULL +#define pci_ss_list_14a8 NULL +#define pci_ss_list_14a9 NULL +#define pci_ss_list_14aa NULL +#define pci_ss_list_14ab NULL +#define pci_ss_list_14ac NULL +#define pci_ss_list_14ad NULL +#define pci_ss_list_14ae NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14af[] = { + &pci_ss_info_14af_0002, + &pci_ss_info_14af_5008, + &pci_ss_info_14af_5021, + &pci_ss_info_14af_5022, + &pci_ss_info_14af_5810, + &pci_ss_info_14af_5820, + &pci_ss_info_14af_7102, + &pci_ss_info_14af_7103, + NULL +}; +#endif +#define pci_ss_list_14b0 NULL +#define pci_ss_list_14b1 NULL +#define pci_ss_list_14b2 NULL +#define pci_ss_list_14b3 NULL +#define pci_ss_list_14b4 NULL +#define pci_ss_list_14b5 NULL +#define pci_ss_list_14b6 NULL +#define pci_ss_list_14b7 NULL +#define pci_ss_list_14b8 NULL +#define pci_ss_list_14b9 NULL +#define pci_ss_list_14ba NULL +#define pci_ss_list_14bb NULL +#define pci_ss_list_14bc NULL +#define pci_ss_list_14bd NULL +#define pci_ss_list_14be NULL +#define pci_ss_list_14bf NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14c0[] = { + &pci_ss_info_14c0_0004, + &pci_ss_info_14c0_000c, + NULL +}; +#endif +#define pci_ss_list_14c1 NULL +#define pci_ss_list_14c2 NULL +#define pci_ss_list_14c3 NULL +#define pci_ss_list_14c4 NULL +#define pci_ss_list_14c5 NULL +#define pci_ss_list_14c6 NULL +#define pci_ss_list_14c7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14c8[] = { + &pci_ss_info_14c8_0300, + &pci_ss_info_14c8_0302, + NULL +}; +#endif +#define pci_ss_list_14c9 NULL +#define pci_ss_list_14ca NULL +#define pci_ss_list_14cb NULL +#define pci_ss_list_14cc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14cd[] = { + &pci_ss_info_14cd_2194, + NULL +}; +#endif +#define pci_ss_list_14ce NULL +#define pci_ss_list_14cf NULL +#define pci_ss_list_14d0 NULL +#define pci_ss_list_14d1 NULL +#define pci_ss_list_14d2 NULL +#define pci_ss_list_14d3 NULL +#define pci_ss_list_14d4 NULL +#define pci_ss_list_14d5 NULL +#define pci_ss_list_14d6 NULL +#define pci_ss_list_14d7 NULL +#define pci_ss_list_14d8 NULL +#define pci_ss_list_14d9 NULL +#define pci_ss_list_14da NULL +#define pci_ss_list_14db NULL +#define pci_ss_list_14dc NULL +#define pci_ss_list_14dd NULL +#define pci_ss_list_14de NULL +#define pci_ss_list_14df NULL +#define pci_ss_list_14e1 NULL +#define pci_ss_list_14e2 NULL +#define pci_ss_list_14e3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14e4[] = { + &pci_ss_info_14e4_0001, + &pci_ss_info_14e4_0002, + &pci_ss_info_14e4_0003, + &pci_ss_info_14e4_0004, + &pci_ss_info_14e4_0005, + &pci_ss_info_14e4_0006, + &pci_ss_info_14e4_0007, + &pci_ss_info_14e4_0008, + &pci_ss_info_14e4_0009, + &pci_ss_info_14e4_000a, + &pci_ss_info_14e4_000b, + &pci_ss_info_14e4_000c, + &pci_ss_info_14e4_000d, + &pci_ss_info_14e4_1028, + &pci_ss_info_14e4_1644, + &pci_ss_info_14e4_8008, + &pci_ss_info_14e4_8009, + &pci_ss_info_14e4_800a, + NULL +}; +#endif +#define pci_ss_list_14e5 NULL +#define pci_ss_list_14e6 NULL +#define pci_ss_list_14e7 NULL +#define pci_ss_list_14e8 NULL +#define pci_ss_list_14e9 NULL +#define pci_ss_list_14ea NULL +#define pci_ss_list_14eb NULL +#define pci_ss_list_14ec NULL +#define pci_ss_list_14ed NULL +#define pci_ss_list_14ee NULL +#define pci_ss_list_14ef NULL +#define pci_ss_list_14f0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14f1[] = { + &pci_ss_info_14f1_0001, + &pci_ss_info_14f1_0002, + &pci_ss_info_14f1_0003, + &pci_ss_info_14f1_0044, + &pci_ss_info_14f1_0048, + &pci_ss_info_14f1_0122, + &pci_ss_info_14f1_0144, + &pci_ss_info_14f1_0222, + &pci_ss_info_14f1_0244, + &pci_ss_info_14f1_0322, + &pci_ss_info_14f1_0422, + &pci_ss_info_14f1_1122, + &pci_ss_info_14f1_1222, + &pci_ss_info_14f1_1322, + &pci_ss_info_14f1_1522, + &pci_ss_info_14f1_1622, + &pci_ss_info_14f1_1722, + &pci_ss_info_14f1_2004, + &pci_ss_info_14f1_5421, + NULL +}; +#endif +#define pci_ss_list_14f2 NULL +#define pci_ss_list_14f3 NULL +#define pci_ss_list_14f4 NULL +#define pci_ss_list_14f5 NULL +#define pci_ss_list_14f6 NULL +#define pci_ss_list_14f7 NULL +#define pci_ss_list_14f8 NULL +#define pci_ss_list_14f9 NULL +#define pci_ss_list_14fa NULL +#define pci_ss_list_14fb NULL +#define pci_ss_list_14fc NULL +#define pci_ss_list_14fd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14fe[] = { + &pci_ss_info_14fe_0428, + &pci_ss_info_14fe_0429, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_14ff[] = { + &pci_ss_info_14ff_1100, + NULL +}; +#endif +#define pci_ss_list_1500 NULL +#define pci_ss_list_1501 NULL +#define pci_ss_list_1502 NULL +#define pci_ss_list_1503 NULL +#define pci_ss_list_1504 NULL +#define pci_ss_list_1505 NULL +#define pci_ss_list_1506 NULL +#define pci_ss_list_1507 NULL +#define pci_ss_list_1508 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1509[] = { + &pci_ss_info_1509_7002, + &pci_ss_info_1509_9902, + &pci_ss_info_1509_9903, + &pci_ss_info_1509_9904, + &pci_ss_info_1509_9905, + &pci_ss_info_1509_9a00, + NULL +}; +#endif +#define pci_ss_list_150a NULL +#define pci_ss_list_150b NULL +#define pci_ss_list_150c NULL +#define pci_ss_list_150d NULL +#define pci_ss_list_150e NULL +#define pci_ss_list_150f NULL +#define pci_ss_list_1510 NULL +#define pci_ss_list_1511 NULL +#define pci_ss_list_1512 NULL +#define pci_ss_list_1513 NULL +#define pci_ss_list_1514 NULL +#define pci_ss_list_1515 NULL +#define pci_ss_list_1516 NULL +#define pci_ss_list_1517 NULL +#define pci_ss_list_1518 NULL +#define pci_ss_list_1519 NULL +#define pci_ss_list_151a NULL +#define pci_ss_list_151b NULL +#define pci_ss_list_151c NULL +#define pci_ss_list_151d NULL +#define pci_ss_list_151e NULL +#define pci_ss_list_151f NULL +#define pci_ss_list_1520 NULL +#define pci_ss_list_1521 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1522[] = { + &pci_ss_info_1522_0001, + &pci_ss_info_1522_0002, + &pci_ss_info_1522_0003, + &pci_ss_info_1522_0004, + &pci_ss_info_1522_0010, + &pci_ss_info_1522_0020, + &pci_ss_info_1522_0200, + &pci_ss_info_1522_0300, + &pci_ss_info_1522_0400, + &pci_ss_info_1522_0500, + &pci_ss_info_1522_0600, + &pci_ss_info_1522_0700, + &pci_ss_info_1522_0800, + NULL +}; +#endif +#define pci_ss_list_1523 NULL +#define pci_ss_list_1524 NULL +#define pci_ss_list_1525 NULL +#define pci_ss_list_1526 NULL +#define pci_ss_list_1527 NULL +#define pci_ss_list_1528 NULL +#define pci_ss_list_1529 NULL +#define pci_ss_list_152a NULL +#define pci_ss_list_152b NULL +#define pci_ss_list_152c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_152d[] = { + &pci_ss_info_152d_8801, + &pci_ss_info_152d_8802, + &pci_ss_info_152d_8803, + &pci_ss_info_152d_8804, + &pci_ss_info_152d_8805, + &pci_ss_info_152d_8808, + NULL +}; +#endif +#define pci_ss_list_152e NULL +#define pci_ss_list_152f NULL +#define pci_ss_list_1530 NULL +#define pci_ss_list_1531 NULL +#define pci_ss_list_1532 NULL +#define pci_ss_list_1533 NULL +#define pci_ss_list_1534 NULL +#define pci_ss_list_1535 NULL +#define pci_ss_list_1537 NULL +#define pci_ss_list_1538 NULL +#define pci_ss_list_1539 NULL +#define pci_ss_list_153a NULL +#define pci_ss_list_153b NULL +#define pci_ss_list_153c NULL +#define pci_ss_list_153d NULL +#define pci_ss_list_153e NULL +#define pci_ss_list_153f NULL +#define pci_ss_list_1540 NULL +#define pci_ss_list_1541 NULL +#define pci_ss_list_1542 NULL +#define pci_ss_list_1543 NULL +#define pci_ss_list_1544 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1545[] = { + &pci_ss_info_1545_002f, + NULL +}; +#endif +#define pci_ss_list_1546 NULL +#define pci_ss_list_1547 NULL +#define pci_ss_list_1548 NULL +#define pci_ss_list_1549 NULL +#define pci_ss_list_154a NULL +#define pci_ss_list_154b NULL +#define pci_ss_list_154c NULL +#define pci_ss_list_154d NULL +#define pci_ss_list_154e NULL +#define pci_ss_list_154f NULL +#define pci_ss_list_1550 NULL +#define pci_ss_list_1551 NULL +#define pci_ss_list_1552 NULL +#define pci_ss_list_1553 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1554[] = { + &pci_ss_info_1554_1041, + NULL +}; +#endif +#define pci_ss_list_1555 NULL +#define pci_ss_list_1556 NULL +#define pci_ss_list_1557 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1558[] = { + &pci_ss_info_1558_1103, + &pci_ss_info_1558_2200, + NULL +}; +#endif +#define pci_ss_list_1559 NULL +#define pci_ss_list_155a NULL +#define pci_ss_list_155b NULL +#define pci_ss_list_155c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_155d[] = { + &pci_ss_info_155d_2f07, + &pci_ss_info_155d_6793, + &pci_ss_info_155d_8850, + NULL +}; +#endif +#define pci_ss_list_155e NULL +#define pci_ss_list_155f NULL +#define pci_ss_list_1560 NULL +#define pci_ss_list_1561 NULL +#define pci_ss_list_1562 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1563[] = { + &pci_ss_info_1563_7018, + NULL +}; +#endif +#define pci_ss_list_1564 NULL +#define pci_ss_list_1565 NULL +#define pci_ss_list_1566 NULL +#define pci_ss_list_1567 NULL +#define pci_ss_list_1568 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1569[] = { + &pci_ss_info_1569_6326, + NULL +}; +#endif +#define pci_ss_list_156a NULL +#define pci_ss_list_156b NULL +#define pci_ss_list_156c NULL +#define pci_ss_list_156d NULL +#define pci_ss_list_156e NULL +#define pci_ss_list_156f NULL +#define pci_ss_list_1570 NULL +#define pci_ss_list_1571 NULL +#define pci_ss_list_1572 NULL +#define pci_ss_list_1573 NULL +#define pci_ss_list_1574 NULL +#define pci_ss_list_1575 NULL +#define pci_ss_list_1576 NULL +#define pci_ss_list_1578 NULL +#define pci_ss_list_1579 NULL +#define pci_ss_list_157a NULL +#define pci_ss_list_157b NULL +#define pci_ss_list_157c NULL +#define pci_ss_list_157d NULL +#define pci_ss_list_157e NULL +#define pci_ss_list_157f NULL +#define pci_ss_list_1580 NULL +#define pci_ss_list_1581 NULL +#define pci_ss_list_1582 NULL +#define pci_ss_list_1583 NULL +#define pci_ss_list_1584 NULL +#define pci_ss_list_1585 NULL +#define pci_ss_list_1586 NULL +#define pci_ss_list_1587 NULL +#define pci_ss_list_1588 NULL +#define pci_ss_list_1589 NULL +#define pci_ss_list_158a NULL +#define pci_ss_list_158b NULL +#define pci_ss_list_158c NULL +#define pci_ss_list_158d NULL +#define pci_ss_list_158e NULL +#define pci_ss_list_158f NULL +#define pci_ss_list_1590 NULL +#define pci_ss_list_1591 NULL +#define pci_ss_list_1592 NULL +#define pci_ss_list_1593 NULL +#define pci_ss_list_1594 NULL +#define pci_ss_list_1595 NULL +#define pci_ss_list_1596 NULL +#define pci_ss_list_1597 NULL +#define pci_ss_list_1598 NULL +#define pci_ss_list_1599 NULL +#define pci_ss_list_159a NULL +#define pci_ss_list_159b NULL +#define pci_ss_list_159c NULL +#define pci_ss_list_159d NULL +#define pci_ss_list_159e NULL +#define pci_ss_list_159f NULL +#define pci_ss_list_15a0 NULL +#define pci_ss_list_15a1 NULL +#define pci_ss_list_15a2 NULL +#define pci_ss_list_15a3 NULL +#define pci_ss_list_15a4 NULL +#define pci_ss_list_15a5 NULL +#define pci_ss_list_15a6 NULL +#define pci_ss_list_15a7 NULL +#define pci_ss_list_15a8 NULL +#define pci_ss_list_15aa NULL +#define pci_ss_list_15ab NULL +#define pci_ss_list_15ac NULL +#define pci_ss_list_15ad NULL +#define pci_ss_list_15ae NULL +#define pci_ss_list_15b0 NULL +#define pci_ss_list_15b1 NULL +#define pci_ss_list_15b2 NULL +#define pci_ss_list_15b3 NULL +#define pci_ss_list_15b4 NULL +#define pci_ss_list_15b5 NULL +#define pci_ss_list_15b6 NULL +#define pci_ss_list_15b7 NULL +#define pci_ss_list_15b8 NULL +#define pci_ss_list_15b9 NULL +#define pci_ss_list_15ba NULL +#define pci_ss_list_15bb NULL +#define pci_ss_list_15bc NULL +#define pci_ss_list_15bd NULL +#define pci_ss_list_15be NULL +#define pci_ss_list_15bf NULL +#define pci_ss_list_15c0 NULL +#define pci_ss_list_15c1 NULL +#define pci_ss_list_15c2 NULL +#define pci_ss_list_15c3 NULL +#define pci_ss_list_15c4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_15c5[] = { + &pci_ss_info_15c5_0111, + NULL +}; +#endif +#define pci_ss_list_15c6 NULL +#define pci_ss_list_15c7 NULL +#define pci_ss_list_15c8 NULL +#define pci_ss_list_15c9 NULL +#define pci_ss_list_15ca NULL +#define pci_ss_list_15cb NULL +#define pci_ss_list_15cc NULL +#define pci_ss_list_15cd NULL +#define pci_ss_list_15ce NULL +#define pci_ss_list_15cf NULL +#define pci_ss_list_15d1 NULL +#define pci_ss_list_15d2 NULL +#define pci_ss_list_15d3 NULL +#define pci_ss_list_15d4 NULL +#define pci_ss_list_15d5 NULL +#define pci_ss_list_15d6 NULL +#define pci_ss_list_15d7 NULL +#define pci_ss_list_15d8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_15d9[] = { + &pci_ss_info_15d9_3480, + &pci_ss_info_15d9_9005, + NULL +}; +#endif +#define pci_ss_list_15da NULL +#define pci_ss_list_15db NULL +#define pci_ss_list_15dc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_15dd[] = { + &pci_ss_info_15dd_7609, + NULL +}; +#endif +#define pci_ss_list_15de NULL +#define pci_ss_list_15df NULL +#define pci_ss_list_15e0 NULL +#define pci_ss_list_15e1 NULL +#define pci_ss_list_15e2 NULL +#define pci_ss_list_15e3 NULL +#define pci_ss_list_15e4 NULL +#define pci_ss_list_15e5 NULL +#define pci_ss_list_15e6 NULL +#define pci_ss_list_15e7 NULL +#define pci_ss_list_15e8 NULL +#define pci_ss_list_15e9 NULL +#define pci_ss_list_15ea NULL +#define pci_ss_list_15eb NULL +#define pci_ss_list_15ec NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_15ed[] = { + &pci_ss_info_15ed_1000, + &pci_ss_info_15ed_1001, + &pci_ss_info_15ed_1002, + &pci_ss_info_15ed_1003, + &pci_ss_info_15ed_2000, + &pci_ss_info_15ed_2001, + NULL +}; +#endif +#define pci_ss_list_15ee NULL +#define pci_ss_list_15ef NULL +#define pci_ss_list_15f0 NULL +#define pci_ss_list_15f1 NULL +#define pci_ss_list_15f2 NULL +#define pci_ss_list_15f3 NULL +#define pci_ss_list_15f4 NULL +#define pci_ss_list_15f5 NULL +#define pci_ss_list_15f6 NULL +#define pci_ss_list_15f7 NULL +#define pci_ss_list_15f8 NULL +#define pci_ss_list_15f9 NULL +#define pci_ss_list_15fa NULL +#define pci_ss_list_15fb NULL +#define pci_ss_list_15fc NULL +#define pci_ss_list_15fd NULL +#define pci_ss_list_15fe NULL +#define pci_ss_list_15ff NULL +#define pci_ss_list_1600 NULL +#define pci_ss_list_1601 NULL +#define pci_ss_list_1602 NULL +#define pci_ss_list_1603 NULL +#define pci_ss_list_1604 NULL +#define pci_ss_list_1605 NULL +#define pci_ss_list_1606 NULL +#define pci_ss_list_1607 NULL +#define pci_ss_list_1608 NULL +#define pci_ss_list_1609 NULL +#define pci_ss_list_1612 NULL +#define pci_ss_list_1619 NULL +#define pci_ss_list_1629 NULL +#define pci_ss_list_1638 NULL +#define pci_ss_list_163c NULL +#define pci_ss_list_1657 NULL +#define pci_ss_list_165a NULL +#define pci_ss_list_165d NULL +#define pci_ss_list_1661 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1668[] = { + &pci_ss_info_1668_0299, + &pci_ss_info_1668_0300, + &pci_ss_info_1668_0302, + &pci_ss_info_1668_0414, + &pci_ss_info_1668_0440, + &pci_ss_info_1668_1100, + &pci_ss_info_1668_2400, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1681[] = { + &pci_ss_info_1681_0040, + &pci_ss_info_1681_0050, + &pci_ss_info_1681_a011, + NULL +}; +#endif +#define pci_ss_list_16ab NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_16be[] = { + &pci_ss_info_16be_0001, + &pci_ss_info_16be_0002, + &pci_ss_info_16be_1040, + NULL +}; +#endif +#define pci_ss_list_16ec NULL +#define pci_ss_list_16f6 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1705[] = { + &pci_ss_info_1705_0001, + &pci_ss_info_1705_0002, + &pci_ss_info_1705_0003, + &pci_ss_info_1705_0004, + NULL +}; +#endif +#define pci_ss_list_170b NULL +#define pci_ss_list_170c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_172a[] = { + &pci_ss_info_172a_0000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1737[] = { + &pci_ss_info_1737_3874, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_173b[] = { + &pci_ss_info_173b_0001, + NULL +}; +#endif +#define pci_ss_list_1743 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_174b[] = { + &pci_ss_info_174b_7112, + &pci_ss_info_174b_7147, + &pci_ss_info_174b_7149, + &pci_ss_info_174b_7161, + &pci_ss_info_174b_7176, + &pci_ss_info_174b_7192, + NULL +}; +#endif +#define pci_ss_list_175e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1787[] = { + &pci_ss_info_1787_0202, + NULL +}; +#endif +#define pci_ss_list_1796 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1799[] = { + &pci_ss_info_1799_0001, + &pci_ss_info_1799_0002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_17af[] = { + &pci_ss_info_17af_0202, + &pci_ss_info_17af_2005, + &pci_ss_info_17af_2006, + NULL +}; +#endif +#define pci_ss_list_17cc NULL +#define pci_ss_list_1813 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1851[] = { + &pci_ss_info_1851_1850, + &pci_ss_info_1851_1851, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1852[] = { + &pci_ss_info_1852_1852, + NULL +}; +#endif +#define pci_ss_list_1888 NULL +#define pci_ss_list_1a08 NULL +#define pci_ss_list_1b13 NULL +#define pci_ss_list_1c1c NULL +#define pci_ss_list_1d44 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_1de1[] = { + &pci_ss_info_1de1_1020, + &pci_ss_info_1de1_3904, + &pci_ss_info_1de1_3907, + NULL +}; +#endif +#define pci_ss_list_2000 NULL +#define pci_ss_list_2001 NULL +#define pci_ss_list_2003 NULL +#define pci_ss_list_2004 NULL +#define pci_ss_list_21c3 NULL +#define pci_ss_list_2348 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_2646[] = { + &pci_ss_info_2646_0001, + NULL +}; +#endif +#define pci_ss_list_270b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_270f[] = { + &pci_ss_info_270f_2001, + &pci_ss_info_270f_2200, + &pci_ss_info_270f_3000, + &pci_ss_info_270f_3100, + &pci_ss_info_270f_3102, + &pci_ss_info_270f_7040, + &pci_ss_info_270f_7060, + &pci_ss_info_270f_a171, + NULL +}; +#endif +#define pci_ss_list_2711 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_2a15[] = { + &pci_ss_info_2a15_54a3, + NULL +}; +#endif +#define pci_ss_list_3000 NULL +#define pci_ss_list_3142 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_3388[] = { + &pci_ss_info_3388_8011, + &pci_ss_info_3388_8012, + &pci_ss_info_3388_8013, + NULL +}; +#endif +#define pci_ss_list_3411 NULL +#define pci_ss_list_3513 NULL +#define pci_ss_list_38ef NULL +static const pciSubsystemInfo *pci_ss_list_3d3d[] = { + &pci_ss_info_3d3d_0100, + &pci_ss_info_3d3d_0111, + &pci_ss_info_3d3d_0114, + &pci_ss_info_3d3d_0116, + &pci_ss_info_3d3d_0119, + &pci_ss_info_3d3d_0120, + &pci_ss_info_3d3d_0121, + &pci_ss_info_3d3d_0125, + &pci_ss_info_3d3d_0127, + &pci_ss_info_3d3d_0144, + NULL +}; +static const pciSubsystemInfo *pci_ss_list_4005[] = { + &pci_ss_info_4005_4000, + NULL +}; +#define pci_ss_list_4033 NULL +#define pci_ss_list_4143 NULL +#define pci_ss_list_416c NULL +#define pci_ss_list_4444 NULL +#define pci_ss_list_4468 NULL +#define pci_ss_list_4594 NULL +#define pci_ss_list_45fb NULL +#define pci_ss_list_4680 NULL +#define pci_ss_list_4843 NULL +#define pci_ss_list_4916 NULL +#define pci_ss_list_4943 NULL +#define pci_ss_list_4978 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_4a14[] = { + &pci_ss_info_4a14_5000, + NULL +}; +#endif +#define pci_ss_list_4b10 NULL +#define pci_ss_list_4c48 NULL +#define pci_ss_list_4c53 NULL +#define pci_ss_list_4ca1 NULL +#define pci_ss_list_4d51 NULL +#define pci_ss_list_4d54 NULL +#define pci_ss_list_4ddc NULL +#define pci_ss_list_5046 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_5053[] = { + &pci_ss_info_5053_3355, + &pci_ss_info_5053_3356, + NULL +}; +#endif +#define pci_ss_list_5136 NULL +#define pci_ss_list_5143 NULL +#define pci_ss_list_5145 NULL +#define pci_ss_list_5168 NULL +#define pci_ss_list_5301 NULL +static const pciSubsystemInfo *pci_ss_list_5333[] = { + &pci_ss_info_5333_8100, + &pci_ss_info_5333_8110, + &pci_ss_info_5333_8125, + &pci_ss_info_5333_8143, + &pci_ss_info_5333_8900, + &pci_ss_info_5333_8901, + &pci_ss_info_5333_8904, + &pci_ss_info_5333_8a01, + &pci_ss_info_5333_8a13, + &pci_ss_info_5333_8a20, + &pci_ss_info_5333_8a21, + &pci_ss_info_5333_8a22, + &pci_ss_info_5333_8a2e, + &pci_ss_info_5333_9125, + &pci_ss_info_5333_9143, + NULL +}; +#define pci_ss_list_544c NULL +#define pci_ss_list_5455 NULL +#define pci_ss_list_5519 NULL +#define pci_ss_list_5544 NULL +#define pci_ss_list_5555 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_5654[] = { + &pci_ss_info_5654_5634, + NULL +}; +#endif +#define pci_ss_list_5700 NULL +#define pci_ss_list_6356 NULL +#define pci_ss_list_6374 NULL +#define pci_ss_list_6409 NULL +#define pci_ss_list_6666 NULL +#define pci_ss_list_7604 NULL +#define pci_ss_list_7bde NULL +#define pci_ss_list_7fed NULL +#define pci_ss_list_8008 NULL +static const pciSubsystemInfo *pci_ss_list_8086[] = { + &pci_ss_info_8086_0000, + &pci_ss_info_8086_0001, + &pci_ss_info_8086_0002, + &pci_ss_info_8086_0003, + &pci_ss_info_8086_0004, + &pci_ss_info_8086_0005, + &pci_ss_info_8086_0006, + &pci_ss_info_8086_0007, + &pci_ss_info_8086_0008, + &pci_ss_info_8086_0009, + &pci_ss_info_8086_000a, + &pci_ss_info_8086_000b, + &pci_ss_info_8086_000c, + &pci_ss_info_8086_000d, + &pci_ss_info_8086_000e, + &pci_ss_info_8086_000f, + &pci_ss_info_8086_0010, + &pci_ss_info_8086_0011, + &pci_ss_info_8086_0012, + &pci_ss_info_8086_0013, + &pci_ss_info_8086_001e, + &pci_ss_info_8086_002a, + &pci_ss_info_8086_002b, + &pci_ss_info_8086_002e, + &pci_ss_info_8086_0030, + &pci_ss_info_8086_0031, + &pci_ss_info_8086_0040, + &pci_ss_info_8086_0041, + &pci_ss_info_8086_0042, + &pci_ss_info_8086_0050, + &pci_ss_info_8086_0100, + &pci_ss_info_8086_1000, + &pci_ss_info_8086_1001, + &pci_ss_info_8086_1002, + &pci_ss_info_8086_1003, + &pci_ss_info_8086_1004, + &pci_ss_info_8086_1009, + &pci_ss_info_8086_100c, + &pci_ss_info_8086_1011, + &pci_ss_info_8086_1012, + &pci_ss_info_8086_1013, + &pci_ss_info_8086_1015, + &pci_ss_info_8086_1017, + &pci_ss_info_8086_1030, + &pci_ss_info_8086_1040, + &pci_ss_info_8086_1041, + &pci_ss_info_8086_1042, + &pci_ss_info_8086_1050, + &pci_ss_info_8086_1051, + &pci_ss_info_8086_1052, + &pci_ss_info_8086_10f0, + &pci_ss_info_8086_1107, + &pci_ss_info_8086_1109, + &pci_ss_info_8086_1112, + &pci_ss_info_8086_1161, + &pci_ss_info_8086_1361, + &pci_ss_info_8086_1958, + &pci_ss_info_8086_2004, + &pci_ss_info_8086_2009, + &pci_ss_info_8086_200d, + &pci_ss_info_8086_200e, + &pci_ss_info_8086_200f, + &pci_ss_info_8086_2010, + &pci_ss_info_8086_2013, + &pci_ss_info_8086_2016, + &pci_ss_info_8086_2017, + &pci_ss_info_8086_2018, + &pci_ss_info_8086_2019, + &pci_ss_info_8086_2101, + &pci_ss_info_8086_2102, + &pci_ss_info_8086_2103, + &pci_ss_info_8086_2104, + &pci_ss_info_8086_2105, + &pci_ss_info_8086_2106, + &pci_ss_info_8086_2107, + &pci_ss_info_8086_2108, + &pci_ss_info_8086_2109, + &pci_ss_info_8086_2110, + &pci_ss_info_8086_2112, + &pci_ss_info_8086_2200, + &pci_ss_info_8086_2201, + &pci_ss_info_8086_2202, + &pci_ss_info_8086_2203, + &pci_ss_info_8086_2204, + &pci_ss_info_8086_2205, + &pci_ss_info_8086_2206, + &pci_ss_info_8086_2207, + &pci_ss_info_8086_2208, + &pci_ss_info_8086_2402, + &pci_ss_info_8086_2407, + &pci_ss_info_8086_2408, + &pci_ss_info_8086_2409, + &pci_ss_info_8086_240f, + &pci_ss_info_8086_2410, + &pci_ss_info_8086_2411, + &pci_ss_info_8086_2412, + &pci_ss_info_8086_2413, + &pci_ss_info_8086_2513, + &pci_ss_info_8086_3000, + &pci_ss_info_8086_3001, + &pci_ss_info_8086_3002, + &pci_ss_info_8086_3006, + &pci_ss_info_8086_3007, + &pci_ss_info_8086_3008, + &pci_ss_info_8086_3010, + &pci_ss_info_8086_3011, + &pci_ss_info_8086_3012, + &pci_ss_info_8086_3013, + &pci_ss_info_8086_3014, + &pci_ss_info_8086_3015, + &pci_ss_info_8086_3016, + &pci_ss_info_8086_3017, + &pci_ss_info_8086_3018, + &pci_ss_info_8086_4152, + &pci_ss_info_8086_4249, + &pci_ss_info_8086_424c, + &pci_ss_info_8086_425a, + &pci_ss_info_8086_4341, + &pci_ss_info_8086_4343, + &pci_ss_info_8086_4649, + &pci_ss_info_8086_464a, + &pci_ss_info_8086_4d4f, + &pci_ss_info_8086_4f43, + &pci_ss_info_8086_5243, + &pci_ss_info_8086_5352, + &pci_ss_info_8086_5643, + &pci_ss_info_8086_5753, + &pci_ss_info_8086_8000, + &pci_ss_info_8086_8181, + &pci_ss_info_8086_9181, + NULL +}; +#define pci_ss_list_8800 NULL +#define pci_ss_list_8866 NULL +#define pci_ss_list_8888 NULL +#define pci_ss_list_8e0e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_8e2e[] = { + &pci_ss_info_8e2e_7000, + &pci_ss_info_8e2e_7100, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_9004[] = { + &pci_ss_info_9004_0008, + &pci_ss_info_9004_0009, + &pci_ss_info_9004_0010, + &pci_ss_info_9004_0018, + &pci_ss_info_9004_0019, + &pci_ss_info_9004_0020, + &pci_ss_info_9004_0028, + &pci_ss_info_9004_7560, + &pci_ss_info_9004_7710, + &pci_ss_info_9004_7711, + &pci_ss_info_9004_7815, + &pci_ss_info_9004_7840, + &pci_ss_info_9004_7850, + &pci_ss_info_9004_7861, + &pci_ss_info_9004_7880, + &pci_ss_info_9004_7881, + &pci_ss_info_9004_7887, + &pci_ss_info_9004_7888, + &pci_ss_info_9004_7890, + &pci_ss_info_9004_7891, + &pci_ss_info_9004_7892, + &pci_ss_info_9004_7894, + &pci_ss_info_9004_7895, + &pci_ss_info_9004_7896, + &pci_ss_info_9004_7897, + &pci_ss_info_9004_8008, + &pci_ss_info_9004_8009, + &pci_ss_info_9004_8010, + &pci_ss_info_9004_8018, + &pci_ss_info_9004_8019, + &pci_ss_info_9004_8020, + &pci_ss_info_9004_8028, + &pci_ss_info_9004_9110, + &pci_ss_info_9004_9111, + &pci_ss_info_9004_9210, + &pci_ss_info_9004_9211, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_9005[] = { + &pci_ss_info_9005_0003, + &pci_ss_info_9005_000f, + &pci_ss_info_9005_0041, + &pci_ss_info_9005_0365, + &pci_ss_info_9005_1364, + &pci_ss_info_9005_1365, + &pci_ss_info_9005_2180, + &pci_ss_info_9005_62a0, + &pci_ss_info_9005_62a1, + &pci_ss_info_9005_8100, + &pci_ss_info_9005_a180, + &pci_ss_info_9005_b500, + &pci_ss_info_9005_e100, + &pci_ss_info_9005_e220, + &pci_ss_info_9005_e2a0, + &pci_ss_info_9005_f500, + &pci_ss_info_9005_f620, + &pci_ss_info_9005_ffff, + NULL +}; +#endif +#define pci_ss_list_907f NULL +#define pci_ss_list_919a NULL +#define pci_ss_list_9412 NULL +#define pci_ss_list_9699 NULL +#define pci_ss_list_9710 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_a0a0[] = { + &pci_ss_info_a0a0_0007, + &pci_ss_info_a0a0_0022, + NULL +}; +#endif +#define pci_ss_list_a0f1 NULL +#define pci_ss_list_a200 NULL +#define pci_ss_list_a259 NULL +#define pci_ss_list_a25b NULL +#define pci_ss_list_a304 NULL +#define pci_ss_list_a727 NULL +#define pci_ss_list_aa42 NULL +#define pci_ss_list_ac1e NULL +#define pci_ss_list_b1b3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_bd11[] = { + &pci_ss_info_bd11_1200, + NULL +}; +#endif +#define pci_ss_list_c001 NULL +#define pci_ss_list_c0a9 NULL +#define pci_ss_list_c0de NULL +#define pci_ss_list_c0fe NULL +#define pci_ss_list_ca50 NULL +#define pci_ss_list_cafe NULL +#define pci_ss_list_cccc NULL +#define pci_ss_list_cddd NULL +#define pci_ss_list_d4d4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_d531[] = { + &pci_ss_info_d531_c002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_d84d[] = { + &pci_ss_info_d84d_4006, + &pci_ss_info_d84d_4008, + &pci_ss_info_d84d_4014, + &pci_ss_info_d84d_4018, + &pci_ss_info_d84d_4025, + &pci_ss_info_d84d_4027, + &pci_ss_info_d84d_4028, + &pci_ss_info_d84d_4036, + &pci_ss_info_d84d_4037, + &pci_ss_info_d84d_4038, + &pci_ss_info_d84d_4052, + &pci_ss_info_d84d_4053, + &pci_ss_info_d84d_4055, + &pci_ss_info_d84d_4058, + &pci_ss_info_d84d_4065, + &pci_ss_info_d84d_4068, + &pci_ss_info_d84d_4078, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_dead[] = { + &pci_ss_info_dead_0800, + NULL +}; +#endif +#define pci_ss_list_e000 NULL +#define pci_ss_list_e159 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_e4bf[] = { + &pci_ss_info_e4bf_1000, + &pci_ss_info_e4bf_1010, + &pci_ss_info_e4bf_1020, + NULL +}; +#endif +#define pci_ss_list_ea01 NULL +#define pci_ss_list_ea60 NULL +#define pci_ss_list_eabb NULL +#define pci_ss_list_eace NULL +#define pci_ss_list_ec80 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciSubsystemInfo *pci_ss_list_ecc0[] = { + &pci_ss_info_ecc0_0030, + NULL +}; +#endif +#define pci_ss_list_edd8 NULL +#define pci_ss_list_f1d0 NULL +#define pci_ss_list_fa57 NULL +#define pci_ss_list_febd NULL +#define pci_ss_list_feda NULL +#define pci_ss_list_fffe NULL +#define pci_ss_list_ffff NULL +#endif /* INIT_VENDOR_SUBSYS_INFO */ +#endif /* INIT_SUBSYS_INFO */ +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_0675_1700 = { + 0x1700, pci_device_0675_1700, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0675_1700, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0675_1702 = { + 0x1702, pci_device_0675_1702, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0675_1702, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_09c1_0704 = { + 0x0704, pci_device_09c1_0704, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_09c1_0704, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_0e11_0001 = { + 0x0001, pci_device_0e11_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_0002 = { + 0x0002, pci_device_0e11_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_0049 = { + 0x0049, pci_device_0e11_0049, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_0049, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_004a = { + 0x004a, pci_device_0e11_004a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_004a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_0508 = { + 0x0508, pci_device_0e11_0508, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_0508, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_1000 = { + 0x1000, pci_device_0e11_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_2000 = { + 0x2000, pci_device_0e11_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_2000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_3032 = { + 0x3032, pci_device_0e11_3032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_3032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_3033 = { + 0x3033, pci_device_0e11_3033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_3033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_3034 = { + 0x3034, pci_device_0e11_3034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_3034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_4000 = { + 0x4000, pci_device_0e11_4000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_4000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_6010 = { + 0x6010, pci_device_0e11_6010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_6010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_7020 = { + 0x7020, pci_device_0e11_7020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_7020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_a0ec = { + 0xa0ec, pci_device_0e11_a0ec, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_a0ec, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_a0f0 = { + 0xa0f0, pci_device_0e11_a0f0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_a0f0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_a0f3 = { + 0xa0f3, pci_device_0e11_a0f3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_a0f3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_a0f7 = { + 0xa0f7, pci_device_0e11_a0f7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_a0f7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_a0f8 = { + 0xa0f8, pci_device_0e11_a0f8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_a0f8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_a0fc = { + 0xa0fc, pci_device_0e11_a0fc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_a0fc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae10 = { + 0xae10, pci_device_0e11_ae10, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae10, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae29 = { + 0xae29, pci_device_0e11_ae29, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae29, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae2a = { + 0xae2a, pci_device_0e11_ae2a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae2a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae2b = { + 0xae2b, pci_device_0e11_ae2b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae2b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae31 = { + 0xae31, pci_device_0e11_ae31, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae31, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae32 = { + 0xae32, pci_device_0e11_ae32, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae32, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae33 = { + 0xae33, pci_device_0e11_ae33, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae33, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae34 = { + 0xae34, pci_device_0e11_ae34, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae34, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae35 = { + 0xae35, pci_device_0e11_ae35, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae35, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae40 = { + 0xae40, pci_device_0e11_ae40, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae40, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae43 = { + 0xae43, pci_device_0e11_ae43, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae43, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae69 = { + 0xae69, pci_device_0e11_ae69, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae69, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae6c = { + 0xae6c, pci_device_0e11_ae6c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae6c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_ae6d = { + 0xae6d, pci_device_0e11_ae6d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_ae6d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b011 = { + 0xb011, pci_device_0e11_b011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b012 = { + 0xb012, pci_device_0e11_b012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b01e = { + 0xb01e, pci_device_0e11_b01e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b01e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b01f = { + 0xb01f, pci_device_0e11_b01f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b01f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b02f = { + 0xb02f, pci_device_0e11_b02f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b02f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b030 = { + 0xb030, pci_device_0e11_b030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b04a = { + 0xb04a, pci_device_0e11_b04a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b04a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b060 = { + 0xb060, pci_device_0e11_b060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0c6 = { + 0xb0c6, pci_device_0e11_b0c6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0c6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0c7 = { + 0xb0c7, pci_device_0e11_b0c7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0c7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0d7 = { + 0xb0d7, pci_device_0e11_b0d7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0d7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0dd = { + 0xb0dd, pci_device_0e11_b0dd, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0dd, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0de = { + 0xb0de, pci_device_0e11_b0de, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0de, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0df = { + 0xb0df, pci_device_0e11_b0df, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0df, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0e0 = { + 0xb0e0, pci_device_0e11_b0e0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0e0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b0e1 = { + 0xb0e1, pci_device_0e11_b0e1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b0e1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b123 = { + 0xb123, pci_device_0e11_b123, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b123, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b134 = { + 0xb134, pci_device_0e11_b134, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b134, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b13c = { + 0xb13c, pci_device_0e11_b13c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b13c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b144 = { + 0xb144, pci_device_0e11_b144, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b144, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b163 = { + 0xb163, pci_device_0e11_b163, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b163, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b164 = { + 0xb164, pci_device_0e11_b164, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b164, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b178 = { + 0xb178, pci_device_0e11_b178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_b1a4 = { + 0xb1a4, pci_device_0e11_b1a4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_b1a4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_f130 = { + 0xf130, pci_device_0e11_f130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_f130, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_0e11_f150 = { + 0xf150, pci_device_0e11_f150, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_0e11_f150, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1000_0001 = { + 0x0001, pci_device_1000_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0002 = { + 0x0002, pci_device_1000_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0003 = { + 0x0003, pci_device_1000_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0004 = { + 0x0004, pci_device_1000_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0005 = { + 0x0005, pci_device_1000_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0006 = { + 0x0006, pci_device_1000_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_000a = { + 0x000a, pci_device_1000_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_000b = { + 0x000b, pci_device_1000_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_000c = { + 0x000c, pci_device_1000_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_000d = { + 0x000d, pci_device_1000_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_000f = { + 0x000f, pci_device_1000_000f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_000f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0010 = { + 0x0010, pci_device_1000_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0012 = { + 0x0012, pci_device_1000_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0013 = { + 0x0013, pci_device_1000_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0020 = { + 0x0020, pci_device_1000_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0021 = { + 0x0021, pci_device_1000_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0030 = { + 0x0030, pci_device_1000_0030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0040 = { + 0x0040, pci_device_1000_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_008f = { + 0x008f, pci_device_1000_008f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_008f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0621 = { + 0x0621, pci_device_1000_0621, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0621, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0622 = { + 0x0622, pci_device_1000_0622, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0622, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0623 = { + 0x0623, pci_device_1000_0623, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0623, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0624 = { + 0x0624, pci_device_1000_0624, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0624, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0625 = { + 0x0625, pci_device_1000_0625, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0625, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0626 = { + 0x0626, pci_device_1000_0626, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0626, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0627 = { + 0x0627, pci_device_1000_0627, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0627, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0628 = { + 0x0628, pci_device_1000_0628, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0628, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0629 = { + 0x0629, pci_device_1000_0629, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0629, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0701 = { + 0x0701, pci_device_1000_0701, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0701, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0702 = { + 0x0702, pci_device_1000_0702, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0702, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_0901 = { + 0x0901, pci_device_1000_0901, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_0901, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_1000 = { + 0x1000, pci_device_1000_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1000_1960 = { + 0x1960, pci_device_1000_1960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1000_1960, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1001_0010 = { + 0x0010, pci_device_1001_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0011 = { + 0x0011, pci_device_1001_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0012 = { + 0x0012, pci_device_1001_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0013 = { + 0x0013, pci_device_1001_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0014 = { + 0x0014, pci_device_1001_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0015 = { + 0x0015, pci_device_1001_0015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0016 = { + 0x0016, pci_device_1001_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_0017 = { + 0x0017, pci_device_1001_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1001_9100 = { + 0x9100, pci_device_1001_9100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1001_9100, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1002_4144 = { + 0x4144, pci_device_1002_4144, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4144, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4145 = { + 0x4145, pci_device_1002_4145, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4145, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4146 = { + 0x4146, pci_device_1002_4146, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4146, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4147 = { + 0x4147, pci_device_1002_4147, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4147, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4158 = { + 0x4158, pci_device_1002_4158, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4158, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4242 = { + 0x4242, pci_device_1002_4242, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4242, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4336 = { + 0x4336, pci_device_1002_4336, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4336, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4337 = { + 0x4337, pci_device_1002_4337, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4337, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4354 = { + 0x4354, pci_device_1002_4354, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4354, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4358 = { + 0x4358, pci_device_1002_4358, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4358, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4554 = { + 0x4554, pci_device_1002_4554, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4554, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4654 = { + 0x4654, pci_device_1002_4654, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4654, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4742 = { + 0x4742, pci_device_1002_4742, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4742, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4744 = { + 0x4744, pci_device_1002_4744, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4744, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4747 = { + 0x4747, pci_device_1002_4747, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4747, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4749 = { + 0x4749, pci_device_1002_4749, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4749, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_474c = { + 0x474c, pci_device_1002_474c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_474c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_474d = { + 0x474d, pci_device_1002_474d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_474d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_474e = { + 0x474e, pci_device_1002_474e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_474e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_474f = { + 0x474f, pci_device_1002_474f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_474f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4750 = { + 0x4750, pci_device_1002_4750, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4750, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4751 = { + 0x4751, pci_device_1002_4751, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4751, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4752 = { + 0x4752, pci_device_1002_4752, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4752, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4753 = { + 0x4753, pci_device_1002_4753, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4753, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4754 = { + 0x4754, pci_device_1002_4754, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4754, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4755 = { + 0x4755, pci_device_1002_4755, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4755, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4756 = { + 0x4756, pci_device_1002_4756, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4756, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4757 = { + 0x4757, pci_device_1002_4757, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4757, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4758 = { + 0x4758, pci_device_1002_4758, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4758, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4759 = { + 0x4759, pci_device_1002_4759, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4759, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_475a = { + 0x475a, pci_device_1002_475a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_475a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4964 = { + 0x4964, pci_device_1002_4964, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4964, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4965 = { + 0x4965, pci_device_1002_4965, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4965, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4966 = { + 0x4966, pci_device_1002_4966, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4966, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4967 = { + 0x4967, pci_device_1002_4967, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4967, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_496e = { + 0x496e, pci_device_1002_496e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_496e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c42 = { + 0x4c42, pci_device_1002_4c42, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c42, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c44 = { + 0x4c44, pci_device_1002_4c44, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c44, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c45 = { + 0x4c45, pci_device_1002_4c45, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c45, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c46 = { + 0x4c46, pci_device_1002_4c46, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c46, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c47 = { + 0x4c47, pci_device_1002_4c47, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c47, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c49 = { + 0x4c49, pci_device_1002_4c49, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c49, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c4d = { + 0x4c4d, pci_device_1002_4c4d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c4d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c4e = { + 0x4c4e, pci_device_1002_4c4e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c4e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c50 = { + 0x4c50, pci_device_1002_4c50, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c50, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c51 = { + 0x4c51, pci_device_1002_4c51, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c51, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c52 = { + 0x4c52, pci_device_1002_4c52, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c52, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c53 = { + 0x4c53, pci_device_1002_4c53, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c53, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c54 = { + 0x4c54, pci_device_1002_4c54, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c54, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c57 = { + 0x4c57, pci_device_1002_4c57, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c57, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c58 = { + 0x4c58, pci_device_1002_4c58, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c58, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c59 = { + 0x4c59, pci_device_1002_4c59, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c59, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c5a = { + 0x4c5a, pci_device_1002_4c5a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c5a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c64 = { + 0x4c64, pci_device_1002_4c64, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c64, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c65 = { + 0x4c65, pci_device_1002_4c65, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c65, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c66 = { + 0x4c66, pci_device_1002_4c66, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c66, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4c67 = { + 0x4c67, pci_device_1002_4c67, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4c67, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4d46 = { + 0x4d46, pci_device_1002_4d46, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4d46, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4d4c = { + 0x4d4c, pci_device_1002_4d4c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4d4c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e44 = { + 0x4e44, pci_device_1002_4e44, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e44, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e45 = { + 0x4e45, pci_device_1002_4e45, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e45, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e46 = { + 0x4e46, pci_device_1002_4e46, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e46, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e47 = { + 0x4e47, pci_device_1002_4e47, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e47, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e64 = { + 0x4e64, pci_device_1002_4e64, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e64, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e65 = { + 0x4e65, pci_device_1002_4e65, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e65, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e66 = { + 0x4e66, pci_device_1002_4e66, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e66, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_4e67 = { + 0x4e67, pci_device_1002_4e67, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_4e67, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5041 = { + 0x5041, pci_device_1002_5041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5041, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5042 = { + 0x5042, pci_device_1002_5042, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5042, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5043 = { + 0x5043, pci_device_1002_5043, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5043, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5044 = { + 0x5044, pci_device_1002_5044, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5044, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5045 = { + 0x5045, pci_device_1002_5045, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5045, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5046 = { + 0x5046, pci_device_1002_5046, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5046, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5047 = { + 0x5047, pci_device_1002_5047, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5047, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5048 = { + 0x5048, pci_device_1002_5048, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5048, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5049 = { + 0x5049, pci_device_1002_5049, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5049, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_504a = { + 0x504a, pci_device_1002_504a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_504a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_504b = { + 0x504b, pci_device_1002_504b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_504b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_504c = { + 0x504c, pci_device_1002_504c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_504c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_504d = { + 0x504d, pci_device_1002_504d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_504d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_504e = { + 0x504e, pci_device_1002_504e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_504e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_504f = { + 0x504f, pci_device_1002_504f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_504f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5050 = { + 0x5050, pci_device_1002_5050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5051 = { + 0x5051, pci_device_1002_5051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5052 = { + 0x5052, pci_device_1002_5052, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5052, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5053 = { + 0x5053, pci_device_1002_5053, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5053, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5054 = { + 0x5054, pci_device_1002_5054, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5054, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5055 = { + 0x5055, pci_device_1002_5055, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5055, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5056 = { + 0x5056, pci_device_1002_5056, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5056, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5057 = { + 0x5057, pci_device_1002_5057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5058 = { + 0x5058, pci_device_1002_5058, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5058, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5144 = { + 0x5144, pci_device_1002_5144, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5144, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5145 = { + 0x5145, pci_device_1002_5145, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5145, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5146 = { + 0x5146, pci_device_1002_5146, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5146, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5147 = { + 0x5147, pci_device_1002_5147, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5147, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5148 = { + 0x5148, pci_device_1002_5148, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5148, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5149 = { + 0x5149, pci_device_1002_5149, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5149, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_514a = { + 0x514a, pci_device_1002_514a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_514a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_514b = { + 0x514b, pci_device_1002_514b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_514b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_514c = { + 0x514c, pci_device_1002_514c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_514c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_514d = { + 0x514d, pci_device_1002_514d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_514d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_514e = { + 0x514e, pci_device_1002_514e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_514e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_514f = { + 0x514f, pci_device_1002_514f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_514f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5157 = { + 0x5157, pci_device_1002_5157, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5157, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5158 = { + 0x5158, pci_device_1002_5158, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5158, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5159 = { + 0x5159, pci_device_1002_5159, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5159, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_515a = { + 0x515a, pci_device_1002_515a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_515a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5168 = { + 0x5168, pci_device_1002_5168, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5168, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5169 = { + 0x5169, pci_device_1002_5169, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5169, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_516a = { + 0x516a, pci_device_1002_516a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_516a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_516b = { + 0x516b, pci_device_1002_516b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_516b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_516c = { + 0x516c, pci_device_1002_516c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_516c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5245 = { + 0x5245, pci_device_1002_5245, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5245, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5246 = { + 0x5246, pci_device_1002_5246, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5246, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5247 = { + 0x5247, pci_device_1002_5247, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5247, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_524b = { + 0x524b, pci_device_1002_524b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_524b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_524c = { + 0x524c, pci_device_1002_524c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_524c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5345 = { + 0x5345, pci_device_1002_5345, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5345, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5346 = { + 0x5346, pci_device_1002_5346, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5346, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5347 = { + 0x5347, pci_device_1002_5347, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5347, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5348 = { + 0x5348, pci_device_1002_5348, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5348, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_534b = { + 0x534b, pci_device_1002_534b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_534b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_534c = { + 0x534c, pci_device_1002_534c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_534c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_534d = { + 0x534d, pci_device_1002_534d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_534d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_534e = { + 0x534e, pci_device_1002_534e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_534e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5354 = { + 0x5354, pci_device_1002_5354, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5354, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5446 = { + 0x5446, pci_device_1002_5446, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5446, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_544c = { + 0x544c, pci_device_1002_544c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_544c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5452 = { + 0x5452, pci_device_1002_5452, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5452, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5453 = { + 0x5453, pci_device_1002_5453, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5453, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5454 = { + 0x5454, pci_device_1002_5454, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5454, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5455 = { + 0x5455, pci_device_1002_5455, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5455, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5654 = { + 0x5654, pci_device_1002_5654, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5654, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5655 = { + 0x5655, pci_device_1002_5655, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5655, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_5656 = { + 0x5656, pci_device_1002_5656, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_5656, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1002_700f = { + 0x700f, pci_device_1002_700f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1002_700f, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1003_0201 = { + 0x0201, pci_device_1003_0201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1003_0201, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1004_0005 = { + 0x0005, pci_device_1004_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0006 = { + 0x0006, pci_device_1004_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0007 = { + 0x0007, pci_device_1004_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0008 = { + 0x0008, pci_device_1004_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0009 = { + 0x0009, pci_device_1004_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_000c = { + 0x000c, pci_device_1004_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_000d = { + 0x000d, pci_device_1004_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0101 = { + 0x0101, pci_device_1004_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0102 = { + 0x0102, pci_device_1004_0102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0103 = { + 0x0103, pci_device_1004_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0104 = { + 0x0104, pci_device_1004_0104, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0104, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0105 = { + 0x0105, pci_device_1004_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0200 = { + 0x0200, pci_device_1004_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0280 = { + 0x0280, pci_device_1004_0280, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0280, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0304 = { + 0x0304, pci_device_1004_0304, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0304, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0305 = { + 0x0305, pci_device_1004_0305, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0305, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0306 = { + 0x0306, pci_device_1004_0306, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0306, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0307 = { + 0x0307, pci_device_1004_0307, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0307, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0308 = { + 0x0308, pci_device_1004_0308, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0308, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0702 = { + 0x0702, pci_device_1004_0702, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0702, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1004_0703 = { + 0x0703, pci_device_1004_0703, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1004_0703, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1005_2064 = { + 0x2064, pci_device_1005_2064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1005_2128 = { + 0x2128, pci_device_1005_2128, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2128, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1005_2301 = { + 0x2301, pci_device_1005_2301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2301, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1005_2302 = { + 0x2302, pci_device_1005_2302, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2302, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1005_2364 = { + 0x2364, pci_device_1005_2364, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2364, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1005_2464 = { + 0x2464, pci_device_1005_2464, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2464, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1005_2501 = { + 0x2501, pci_device_1005_2501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1005_2501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0001 = { + 0x0001, pci_device_100b_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0002 = { + 0x0002, pci_device_100b_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_000e = { + 0x000e, pci_device_100b_000e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_000e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_000f = { + 0x000f, pci_device_100b_000f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_000f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0011 = { + 0x0011, pci_device_100b_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0012 = { + 0x0012, pci_device_100b_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0020 = { + 0x0020, pci_device_100b_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0022 = { + 0x0022, pci_device_100b_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0500 = { + 0x0500, pci_device_100b_0500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0501 = { + 0x0501, pci_device_100b_0501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0502 = { + 0x0502, pci_device_100b_0502, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0502, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0503 = { + 0x0503, pci_device_100b_0503, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0503, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0504 = { + 0x0504, pci_device_100b_0504, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0504, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_0505 = { + 0x0505, pci_device_100b_0505, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_0505, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100b_d001 = { + 0xd001, pci_device_100b_d001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100b_d001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100c_3202 = { + 0x3202, pci_device_100c_3202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100c_3202, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100c_3205 = { + 0x3205, pci_device_100c_3205, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100c_3205, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100c_3206 = { + 0x3206, pci_device_100c_3206, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100c_3206, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100c_3207 = { + 0x3207, pci_device_100c_3207, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100c_3207, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100c_3208 = { + 0x3208, pci_device_100c_3208, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100c_3208, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100c_4702 = { + 0x4702, pci_device_100c_4702, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100c_4702, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100e_9000 = { + 0x9000, pci_device_100e_9000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100e_9000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100e_9001 = { + 0x9001, pci_device_100e_9001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100e_9001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100e_9002 = { + 0x9002, pci_device_100e_9002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100e_9002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_100e_9100 = { + 0x9100, pci_device_100e_9100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_100e_9100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0001 = { + 0x0001, pci_device_1011_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0002 = { + 0x0002, pci_device_1011_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0004 = { + 0x0004, pci_device_1011_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0007 = { + 0x0007, pci_device_1011_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0008 = { + 0x0008, pci_device_1011_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0009 = { + 0x0009, pci_device_1011_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_000a = { + 0x000a, pci_device_1011_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_000d = { + 0x000d, pci_device_1011_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_000f = { + 0x000f, pci_device_1011_000f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_000f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0014 = { + 0x0014, pci_device_1011_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0016 = { + 0x0016, pci_device_1011_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0019 = { + 0x0019, pci_device_1011_0019, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0019, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_001a = { + 0x001a, pci_device_1011_001a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_001a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0021 = { + 0x0021, pci_device_1011_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0022 = { + 0x0022, pci_device_1011_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0023 = { + 0x0023, pci_device_1011_0023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0024 = { + 0x0024, pci_device_1011_0024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0025 = { + 0x0025, pci_device_1011_0025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0026 = { + 0x0026, pci_device_1011_0026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0034 = { + 0x0034, pci_device_1011_0034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0045 = { + 0x0045, pci_device_1011_0045, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0045, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_0046 = { + 0x0046, pci_device_1011_0046, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_0046, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1011_1065 = { + 0x1065, pci_device_1011_1065, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1011_1065, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_0038 = { + 0x0038, pci_device_1013_0038, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_0038, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_0040 = { + 0x0040, pci_device_1013_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_0040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_004c = { + 0x004c, pci_device_1013_004c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_004c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00a0 = { + 0x00a0, pci_device_1013_00a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00a0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00a2 = { + 0x00a2, pci_device_1013_00a2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00a2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00a4 = { + 0x00a4, pci_device_1013_00a4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00a4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00a8 = { + 0x00a8, pci_device_1013_00a8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00a8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00ac = { + 0x00ac, pci_device_1013_00ac, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00ac, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00b0 = { + 0x00b0, pci_device_1013_00b0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00b0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00b8 = { + 0x00b8, pci_device_1013_00b8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00b8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00bc = { + 0x00bc, pci_device_1013_00bc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00bc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00d0 = { + 0x00d0, pci_device_1013_00d0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00d0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00d2 = { + 0x00d2, pci_device_1013_00d2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00d2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00d4 = { + 0x00d4, pci_device_1013_00d4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00d4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00d5 = { + 0x00d5, pci_device_1013_00d5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00d5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00d6 = { + 0x00d6, pci_device_1013_00d6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00d6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_00e8 = { + 0x00e8, pci_device_1013_00e8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_00e8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1100 = { + 0x1100, pci_device_1013_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1110 = { + 0x1110, pci_device_1013_1110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1112 = { + 0x1112, pci_device_1013_1112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1113 = { + 0x1113, pci_device_1013_1113, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1113, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1200 = { + 0x1200, pci_device_1013_1200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1202 = { + 0x1202, pci_device_1013_1202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1202, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_1204 = { + 0x1204, pci_device_1013_1204, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_1204, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_4400 = { + 0x4400, pci_device_1013_4400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_4400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_6001 = { + 0x6001, pci_device_1013_6001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_6001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_6003 = { + 0x6003, pci_device_1013_6003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_6003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_6004 = { + 0x6004, pci_device_1013_6004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_6004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1013_6005 = { + 0x6005, pci_device_1013_6005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1013_6005, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1014_0002 = { + 0x0002, pci_device_1014_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0005 = { + 0x0005, pci_device_1014_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0007 = { + 0x0007, pci_device_1014_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_000a = { + 0x000a, pci_device_1014_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0017 = { + 0x0017, pci_device_1014_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0018 = { + 0x0018, pci_device_1014_0018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_001b = { + 0x001b, pci_device_1014_001b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_001b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_001c = { + 0x001c, pci_device_1014_001c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_001c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_001d = { + 0x001d, pci_device_1014_001d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_001d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0020 = { + 0x0020, pci_device_1014_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0022 = { + 0x0022, pci_device_1014_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_002d = { + 0x002d, pci_device_1014_002d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_002d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_002e = { + 0x002e, pci_device_1014_002e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_002e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0036 = { + 0x0036, pci_device_1014_0036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_003a = { + 0x003a, pci_device_1014_003a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_003a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_003e = { + 0x003e, pci_device_1014_003e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_003e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0045 = { + 0x0045, pci_device_1014_0045, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0045, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0046 = { + 0x0046, pci_device_1014_0046, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0046, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0047 = { + 0x0047, pci_device_1014_0047, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0047, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0048 = { + 0x0048, pci_device_1014_0048, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0048, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0049 = { + 0x0049, pci_device_1014_0049, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0049, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_004e = { + 0x004e, pci_device_1014_004e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_004e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_004f = { + 0x004f, pci_device_1014_004f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_004f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0050 = { + 0x0050, pci_device_1014_0050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0053 = { + 0x0053, pci_device_1014_0053, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0053, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0057 = { + 0x0057, pci_device_1014_0057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_005c = { + 0x005c, pci_device_1014_005c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_005c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_007c = { + 0x007c, pci_device_1014_007c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_007c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_007d = { + 0x007d, pci_device_1014_007d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_007d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0090 = { + 0x0090, pci_device_1014_0090, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0090, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0095 = { + 0x0095, pci_device_1014_0095, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0095, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0096 = { + 0x0096, pci_device_1014_0096, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0096, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_00a5 = { + 0x00a5, pci_device_1014_00a5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_00a5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_00a6 = { + 0x00a6, pci_device_1014_00a6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_00a6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_00b7 = { + 0x00b7, pci_device_1014_00b7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_00b7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_00be = { + 0x00be, pci_device_1014_00be, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_00be, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_00dc = { + 0x00dc, pci_device_1014_00dc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_00dc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_00fc = { + 0x00fc, pci_device_1014_00fc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_00fc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0105 = { + 0x0105, pci_device_1014_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_010f = { + 0x010f, pci_device_1014_010f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_010f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0142 = { + 0x0142, pci_device_1014_0142, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0142, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0144 = { + 0x0144, pci_device_1014_0144, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0144, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0156 = { + 0x0156, pci_device_1014_0156, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0156, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_01a7 = { + 0x01a7, pci_device_1014_01a7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_01a7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_01bd = { + 0x01bd, pci_device_1014_01bd, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_01bd, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_0302 = { + 0x0302, pci_device_1014_0302, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_0302, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1014_ffff = { + 0xffff, pci_device_1014_ffff, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1014_ffff, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1017_5343 = { + 0x5343, pci_device_1017_5343, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1017_5343, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_101a_0005 = { + 0x0005, pci_device_101a_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101a_0005, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_101c_0193 = { + 0x0193, pci_device_101c_0193, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_0193, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_0196 = { + 0x0196, pci_device_101c_0196, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_0196, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_0197 = { + 0x0197, pci_device_101c_0197, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_0197, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_0296 = { + 0x0296, pci_device_101c_0296, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_0296, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_3193 = { + 0x3193, pci_device_101c_3193, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_3193, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_3197 = { + 0x3197, pci_device_101c_3197, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_3197, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_3296 = { + 0x3296, pci_device_101c_3296, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_3296, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_4296 = { + 0x4296, pci_device_101c_4296, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_4296, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_9710 = { + 0x9710, pci_device_101c_9710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_9710, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_9712 = { + 0x9712, pci_device_101c_9712, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_9712, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101c_c24a = { + 0xc24a, pci_device_101c_c24a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101c_c24a, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_101e_1960 = { + 0x1960, pci_device_101e_1960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_1960, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9010 = { + 0x9010, pci_device_101e_9010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9030 = { + 0x9030, pci_device_101e_9030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9031 = { + 0x9031, pci_device_101e_9031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9032 = { + 0x9032, pci_device_101e_9032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9033 = { + 0x9033, pci_device_101e_9033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9040 = { + 0x9040, pci_device_101e_9040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9060 = { + 0x9060, pci_device_101e_9060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_101e_9063 = { + 0x9063, pci_device_101e_9063, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_101e_9063, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1022_1100 = { + 0x1100, pci_device_1022_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_1100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_1101 = { + 0x1101, pci_device_1022_1101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_1101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_1102 = { + 0x1102, pci_device_1022_1102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_1102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_1103 = { + 0x1103, pci_device_1022_1103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_1103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_2000 = { + 0x2000, pci_device_1022_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_2000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_2001 = { + 0x2001, pci_device_1022_2001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_2001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_2020 = { + 0x2020, pci_device_1022_2020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_2020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_2040 = { + 0x2040, pci_device_1022_2040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_2040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_3000 = { + 0x3000, pci_device_1022_3000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_3000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7006 = { + 0x7006, pci_device_1022_7006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7007 = { + 0x7007, pci_device_1022_7007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_700c = { + 0x700c, pci_device_1022_700c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_700c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_700d = { + 0x700d, pci_device_1022_700d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_700d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_700e = { + 0x700e, pci_device_1022_700e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_700e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_700f = { + 0x700f, pci_device_1022_700f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_700f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7400 = { + 0x7400, pci_device_1022_7400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7401 = { + 0x7401, pci_device_1022_7401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7403 = { + 0x7403, pci_device_1022_7403, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7403, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7404 = { + 0x7404, pci_device_1022_7404, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7404, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7408 = { + 0x7408, pci_device_1022_7408, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7408, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7409 = { + 0x7409, pci_device_1022_7409, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7409, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_740b = { + 0x740b, pci_device_1022_740b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_740b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_740c = { + 0x740c, pci_device_1022_740c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_740c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7410 = { + 0x7410, pci_device_1022_7410, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7410, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7411 = { + 0x7411, pci_device_1022_7411, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7411, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7413 = { + 0x7413, pci_device_1022_7413, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7413, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7414 = { + 0x7414, pci_device_1022_7414, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7414, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7440 = { + 0x7440, pci_device_1022_7440, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7440, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7441 = { + 0x7441, pci_device_1022_7441, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7441, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7443 = { + 0x7443, pci_device_1022_7443, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7443, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7445 = { + 0x7445, pci_device_1022_7445, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7445, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7446 = { + 0x7446, pci_device_1022_7446, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7446, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7448 = { + 0x7448, pci_device_1022_7448, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7448, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7449 = { + 0x7449, pci_device_1022_7449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7449, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7450 = { + 0x7450, pci_device_1022_7450, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7450, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7451 = { + 0x7451, pci_device_1022_7451, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7451, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7454 = { + 0x7454, pci_device_1022_7454, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7454, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7455 = { + 0x7455, pci_device_1022_7455, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7455, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7460 = { + 0x7460, pci_device_1022_7460, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7460, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7461 = { + 0x7461, pci_device_1022_7461, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7461, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7462 = { + 0x7462, pci_device_1022_7462, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7462, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7464 = { + 0x7464, pci_device_1022_7464, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7464, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7468 = { + 0x7468, pci_device_1022_7468, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7468, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_7469 = { + 0x7469, pci_device_1022_7469, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_7469, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_746a = { + 0x746a, pci_device_1022_746a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_746a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_746b = { + 0x746b, pci_device_1022_746b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_746b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_746d = { + 0x746d, pci_device_1022_746d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_746d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1022_746e = { + 0x746e, pci_device_1022_746e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1022_746e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_0194 = { + 0x0194, pci_device_1023_0194, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_0194, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_2000 = { + 0x2000, pci_device_1023_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_2000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_2001 = { + 0x2001, pci_device_1023_2001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_2001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_8400 = { + 0x8400, pci_device_1023_8400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_8400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_8420 = { + 0x8420, pci_device_1023_8420, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_8420, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_8500 = { + 0x8500, pci_device_1023_8500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_8500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_8520 = { + 0x8520, pci_device_1023_8520, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_8520, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_8620 = { + 0x8620, pci_device_1023_8620, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_8620, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_8820 = { + 0x8820, pci_device_1023_8820, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_8820, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9320 = { + 0x9320, pci_device_1023_9320, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9320, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9350 = { + 0x9350, pci_device_1023_9350, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9350, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9360 = { + 0x9360, pci_device_1023_9360, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9360, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9382 = { + 0x9382, pci_device_1023_9382, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9382, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9383 = { + 0x9383, pci_device_1023_9383, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9383, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9385 = { + 0x9385, pci_device_1023_9385, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9385, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9386 = { + 0x9386, pci_device_1023_9386, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9386, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9388 = { + 0x9388, pci_device_1023_9388, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9388, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9397 = { + 0x9397, pci_device_1023_9397, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9397, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_939a = { + 0x939a, pci_device_1023_939a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_939a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9420 = { + 0x9420, pci_device_1023_9420, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9420, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9430 = { + 0x9430, pci_device_1023_9430, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9430, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9440 = { + 0x9440, pci_device_1023_9440, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9440, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9460 = { + 0x9460, pci_device_1023_9460, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9460, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9470 = { + 0x9470, pci_device_1023_9470, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9470, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9520 = { + 0x9520, pci_device_1023_9520, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9520, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9525 = { + 0x9525, pci_device_1023_9525, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9525, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9540 = { + 0x9540, pci_device_1023_9540, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9540, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9660 = { + 0x9660, pci_device_1023_9660, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9660, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9680 = { + 0x9680, pci_device_1023_9680, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9680, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9682 = { + 0x9682, pci_device_1023_9682, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9682, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9683 = { + 0x9683, pci_device_1023_9683, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9683, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9685 = { + 0x9685, pci_device_1023_9685, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9685, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9750 = { + 0x9750, pci_device_1023_9750, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9750, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9753 = { + 0x9753, pci_device_1023_9753, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9753, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9754 = { + 0x9754, pci_device_1023_9754, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9754, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9759 = { + 0x9759, pci_device_1023_9759, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9759, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9783 = { + 0x9783, pci_device_1023_9783, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9783, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9785 = { + 0x9785, pci_device_1023_9785, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9785, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9850 = { + 0x9850, pci_device_1023_9850, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9850, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9880 = { + 0x9880, pci_device_1023_9880, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9880, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9910 = { + 0x9910, pci_device_1023_9910, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9910, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1023_9930 = { + 0x9930, pci_device_1023_9930, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1023_9930, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1435 = { + 0x1435, pci_device_1025_1435, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1435, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1445 = { + 0x1445, pci_device_1025_1445, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1445, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1449 = { + 0x1449, pci_device_1025_1449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1449, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1451 = { + 0x1451, pci_device_1025_1451, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1451, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1461 = { + 0x1461, pci_device_1025_1461, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1461, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1489 = { + 0x1489, pci_device_1025_1489, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1489, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1511 = { + 0x1511, pci_device_1025_1511, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1511, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1512 = { + 0x1512, pci_device_1025_1512, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1512, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1513 = { + 0x1513, pci_device_1025_1513, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1513, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1521 = { + 0x1521, pci_device_1025_1521, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1521, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1523 = { + 0x1523, pci_device_1025_1523, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1523, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1531 = { + 0x1531, pci_device_1025_1531, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1531, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1533 = { + 0x1533, pci_device_1025_1533, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1533, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1535 = { + 0x1535, pci_device_1025_1535, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1535, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1541 = { + 0x1541, pci_device_1025_1541, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1541, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1542 = { + 0x1542, pci_device_1025_1542, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1542, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1543 = { + 0x1543, pci_device_1025_1543, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1543, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1561 = { + 0x1561, pci_device_1025_1561, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1561, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1621 = { + 0x1621, pci_device_1025_1621, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1621, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1631 = { + 0x1631, pci_device_1025_1631, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1631, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1641 = { + 0x1641, pci_device_1025_1641, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1641, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_1647 = { + 0x1647, pci_device_1025_1647, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_1647, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3141 = { + 0x3141, pci_device_1025_3141, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3141, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3143 = { + 0x3143, pci_device_1025_3143, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3143, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3145 = { + 0x3145, pci_device_1025_3145, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3145, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3147 = { + 0x3147, pci_device_1025_3147, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3147, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3149 = { + 0x3149, pci_device_1025_3149, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3149, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3151 = { + 0x3151, pci_device_1025_3151, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3151, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3307 = { + 0x3307, pci_device_1025_3307, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3307, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3309 = { + 0x3309, pci_device_1025_3309, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3309, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_3321 = { + 0x3321, pci_device_1025_3321, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_3321, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5212 = { + 0x5212, pci_device_1025_5212, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5212, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5215 = { + 0x5215, pci_device_1025_5215, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5215, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5217 = { + 0x5217, pci_device_1025_5217, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5217, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5219 = { + 0x5219, pci_device_1025_5219, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5219, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5225 = { + 0x5225, pci_device_1025_5225, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5225, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5229 = { + 0x5229, pci_device_1025_5229, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5229, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5235 = { + 0x5235, pci_device_1025_5235, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5235, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5237 = { + 0x5237, pci_device_1025_5237, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5237, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5240 = { + 0x5240, pci_device_1025_5240, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5240, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5241 = { + 0x5241, pci_device_1025_5241, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5241, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5242 = { + 0x5242, pci_device_1025_5242, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5242, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5243 = { + 0x5243, pci_device_1025_5243, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5243, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5244 = { + 0x5244, pci_device_1025_5244, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5244, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5247 = { + 0x5247, pci_device_1025_5247, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5247, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5251 = { + 0x5251, pci_device_1025_5251, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5251, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5427 = { + 0x5427, pci_device_1025_5427, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5427, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5451 = { + 0x5451, pci_device_1025_5451, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5451, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_5453 = { + 0x5453, pci_device_1025_5453, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_5453, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1025_7101 = { + 0x7101, pci_device_1025_7101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1025_7101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0001 = { + 0x0001, pci_device_1028_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0002 = { + 0x0002, pci_device_1028_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0003 = { + 0x0003, pci_device_1028_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0004 = { + 0x0004, pci_device_1028_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0005 = { + 0x0005, pci_device_1028_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0006 = { + 0x0006, pci_device_1028_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0007 = { + 0x0007, pci_device_1028_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_0008 = { + 0x0008, pci_device_1028_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_000a = { + 0x000a, pci_device_1028_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_000c = { + 0x000c, pci_device_1028_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_000e = { + 0x000e, pci_device_1028_000e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_000e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1028_000f = { + 0x000f, pci_device_1028_000f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1028_000f, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_102a_0000 = { + 0x0000, pci_device_102a_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102a_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102a_0010 = { + 0x0010, pci_device_102a_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102a_0010, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_102b_0010 = { + 0x0010, pci_device_102b_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0518 = { + 0x0518, pci_device_102b_0518, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0518, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0519 = { + 0x0519, pci_device_102b_0519, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0519, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_051a = { + 0x051a, pci_device_102b_051a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_051a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_051b = { + 0x051b, pci_device_102b_051b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_051b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_051e = { + 0x051e, pci_device_102b_051e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_051e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_051f = { + 0x051f, pci_device_102b_051f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_051f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0520 = { + 0x0520, pci_device_102b_0520, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0520, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0521 = { + 0x0521, pci_device_102b_0521, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0521, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0525 = { + 0x0525, pci_device_102b_0525, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0525, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0527 = { + 0x0527, pci_device_102b_0527, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0527, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_0d10 = { + 0x0d10, pci_device_102b_0d10, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_0d10, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_1000 = { + 0x1000, pci_device_102b_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_1001 = { + 0x1001, pci_device_102b_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_2007 = { + 0x2007, pci_device_102b_2007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_2007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_2527 = { + 0x2527, pci_device_102b_2527, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_2527, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_4536 = { + 0x4536, pci_device_102b_4536, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_4536, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102b_6573 = { + 0x6573, pci_device_102b_6573, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102b_6573, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00b8 = { + 0x00b8, pci_device_102c_00b8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00b8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00c0 = { + 0x00c0, pci_device_102c_00c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00d0 = { + 0x00d0, pci_device_102c_00d0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00d0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00d8 = { + 0x00d8, pci_device_102c_00d8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00d8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00dc = { + 0x00dc, pci_device_102c_00dc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00dc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00e0 = { + 0x00e0, pci_device_102c_00e0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00e0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00e4 = { + 0x00e4, pci_device_102c_00e4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00e4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00e5 = { + 0x00e5, pci_device_102c_00e5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00e5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00f0 = { + 0x00f0, pci_device_102c_00f0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00f0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00f4 = { + 0x00f4, pci_device_102c_00f4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00f4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_00f5 = { + 0x00f5, pci_device_102c_00f5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_00f5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102c_0c30 = { + 0x0c30, pci_device_102c_0c30, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102c_0c30, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_102d_50dc = { + 0x50dc, pci_device_102d_50dc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102d_50dc, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_102f_0009 = { + 0x0009, pci_device_102f_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102f_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_102f_0020 = { + 0x0020, pci_device_102f_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_102f_0020, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1031_5601 = { + 0x5601, pci_device_1031_5601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1031_5601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1031_5607 = { + 0x5607, pci_device_1031_5607, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1031_5607, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1031_5631 = { + 0x5631, pci_device_1031_5631, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1031_5631, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1031_6057 = { + 0x6057, pci_device_1031_6057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1031_6057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0001 = { + 0x0001, pci_device_1033_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0002 = { + 0x0002, pci_device_1033_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0003 = { + 0x0003, pci_device_1033_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0004 = { + 0x0004, pci_device_1033_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0005 = { + 0x0005, pci_device_1033_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0006 = { + 0x0006, pci_device_1033_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0007 = { + 0x0007, pci_device_1033_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0008 = { + 0x0008, pci_device_1033_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0009 = { + 0x0009, pci_device_1033_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0016 = { + 0x0016, pci_device_1033_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_001a = { + 0x001a, pci_device_1033_001a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_001a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0021 = { + 0x0021, pci_device_1033_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0029 = { + 0x0029, pci_device_1033_0029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_002a = { + 0x002a, pci_device_1033_002a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_002a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_002c = { + 0x002c, pci_device_1033_002c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_002c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_002d = { + 0x002d, pci_device_1033_002d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_002d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0035 = { + 0x0035, pci_device_1033_0035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_003b = { + 0x003b, pci_device_1033_003b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_003b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_003e = { + 0x003e, pci_device_1033_003e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_003e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0046 = { + 0x0046, pci_device_1033_0046, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0046, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_005a = { + 0x005a, pci_device_1033_005a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_005a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0063 = { + 0x0063, pci_device_1033_0063, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0063, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0067 = { + 0x0067, pci_device_1033_0067, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0067, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_0074 = { + 0x0074, pci_device_1033_0074, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_0074, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_009b = { + 0x009b, pci_device_1033_009b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_009b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_00a6 = { + 0x00a6, pci_device_1033_00a6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_00a6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_00cd = { + 0x00cd, pci_device_1033_00cd, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_00cd, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1033_00e0 = { + 0x00e0, pci_device_1033_00e0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1033_00e0, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1036_0000 = { + 0x0000, pci_device_1036_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1036_0000, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1039_0001 = { + 0x0001, pci_device_1039_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0002 = { + 0x0002, pci_device_1039_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0006 = { + 0x0006, pci_device_1039_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0008 = { + 0x0008, pci_device_1039_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0009 = { + 0x0009, pci_device_1039_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0018 = { + 0x0018, pci_device_1039_0018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0200 = { + 0x0200, pci_device_1039_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0204 = { + 0x0204, pci_device_1039_0204, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0204, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0205 = { + 0x0205, pci_device_1039_0205, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0205, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0300 = { + 0x0300, pci_device_1039_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0310 = { + 0x0310, pci_device_1039_0310, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0310, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0315 = { + 0x0315, pci_device_1039_0315, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0315, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0325 = { + 0x0325, pci_device_1039_0325, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0325, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0330 = { + 0x0330, pci_device_1039_0330, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0330, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0406 = { + 0x0406, pci_device_1039_0406, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0406, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0496 = { + 0x0496, pci_device_1039_0496, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0496, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0530 = { + 0x0530, pci_device_1039_0530, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0530, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0540 = { + 0x0540, pci_device_1039_0540, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0540, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0597 = { + 0x0597, pci_device_1039_0597, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0597, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0601 = { + 0x0601, pci_device_1039_0601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0620 = { + 0x0620, pci_device_1039_0620, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0620, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0630 = { + 0x0630, pci_device_1039_0630, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0630, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0633 = { + 0x0633, pci_device_1039_0633, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0633, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0635 = { + 0x0635, pci_device_1039_0635, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0635, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0645 = { + 0x0645, pci_device_1039_0645, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0645, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0646 = { + 0x0646, pci_device_1039_0646, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0646, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0650 = { + 0x0650, pci_device_1039_0650, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0650, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0651 = { + 0x0651, pci_device_1039_0651, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0651, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0730 = { + 0x0730, pci_device_1039_0730, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0730, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0733 = { + 0x0733, pci_device_1039_0733, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0733, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0735 = { + 0x0735, pci_device_1039_0735, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0735, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0740 = { + 0x0740, pci_device_1039_0740, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0740, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0745 = { + 0x0745, pci_device_1039_0745, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0745, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0900 = { + 0x0900, pci_device_1039_0900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0961 = { + 0x0961, pci_device_1039_0961, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0961, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_0962 = { + 0x0962, pci_device_1039_0962, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_0962, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_3602 = { + 0x3602, pci_device_1039_3602, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_3602, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5107 = { + 0x5107, pci_device_1039_5107, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5107, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5300 = { + 0x5300, pci_device_1039_5300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5315 = { + 0x5315, pci_device_1039_5315, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5315, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5401 = { + 0x5401, pci_device_1039_5401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5511 = { + 0x5511, pci_device_1039_5511, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5511, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5513 = { + 0x5513, pci_device_1039_5513, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5513, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5517 = { + 0x5517, pci_device_1039_5517, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5517, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5571 = { + 0x5571, pci_device_1039_5571, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5571, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5581 = { + 0x5581, pci_device_1039_5581, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5581, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5582 = { + 0x5582, pci_device_1039_5582, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5582, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5591 = { + 0x5591, pci_device_1039_5591, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5591, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5596 = { + 0x5596, pci_device_1039_5596, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5596, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5597 = { + 0x5597, pci_device_1039_5597, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5597, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_5600 = { + 0x5600, pci_device_1039_5600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_5600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6204 = { + 0x6204, pci_device_1039_6204, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6204, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6205 = { + 0x6205, pci_device_1039_6205, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6205, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6236 = { + 0x6236, pci_device_1039_6236, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6236, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6300 = { + 0x6300, pci_device_1039_6300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6306 = { + 0x6306, pci_device_1039_6306, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6306, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6325 = { + 0x6325, pci_device_1039_6325, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6325, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_6326 = { + 0x6326, pci_device_1039_6326, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_6326, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7001 = { + 0x7001, pci_device_1039_7001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7002 = { + 0x7002, pci_device_1039_7002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7007 = { + 0x7007, pci_device_1039_7007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7012 = { + 0x7012, pci_device_1039_7012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7013 = { + 0x7013, pci_device_1039_7013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7016 = { + 0x7016, pci_device_1039_7016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1039_7018 = { + 0x7018, pci_device_1039_7018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1039_7018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1005 = { + 0x1005, pci_device_103c_1005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1006 = { + 0x1006, pci_device_103c_1006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1008 = { + 0x1008, pci_device_103c_1008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_100a = { + 0x100a, pci_device_103c_100a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_100a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1028 = { + 0x1028, pci_device_103c_1028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1028, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1029 = { + 0x1029, pci_device_103c_1029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_102a = { + 0x102a, pci_device_103c_102a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_102a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1030 = { + 0x1030, pci_device_103c_1030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1031 = { + 0x1031, pci_device_103c_1031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1040 = { + 0x1040, pci_device_103c_1040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1041 = { + 0x1041, pci_device_103c_1041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1041, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1042 = { + 0x1042, pci_device_103c_1042, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1042, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1048 = { + 0x1048, pci_device_103c_1048, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1048, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1064 = { + 0x1064, pci_device_103c_1064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_108b = { + 0x108b, pci_device_103c_108b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_108b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_10c1 = { + 0x10c1, pci_device_103c_10c1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_10c1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_10ed = { + 0x10ed, pci_device_103c_10ed, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_10ed, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1200 = { + 0x1200, pci_device_103c_1200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1219 = { + 0x1219, pci_device_103c_1219, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1219, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_121a = { + 0x121a, pci_device_103c_121a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_121a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_121b = { + 0x121b, pci_device_103c_121b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_121b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_121c = { + 0x121c, pci_device_103c_121c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_121c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1229 = { + 0x1229, pci_device_103c_1229, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1229, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_122a = { + 0x122a, pci_device_103c_122a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_122a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_122e = { + 0x122e, pci_device_103c_122e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_122e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_1290 = { + 0x1290, pci_device_103c_1290, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_1290, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_2910 = { + 0x2910, pci_device_103c_2910, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_2910, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_103c_2925 = { + 0x2925, pci_device_103c_2925, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_103c_2925, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1042_1000 = { + 0x1000, pci_device_1042_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1042_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1042_1001 = { + 0x1001, pci_device_1042_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1042_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1042_3000 = { + 0x3000, pci_device_1042_3000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1042_3000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1042_3010 = { + 0x3010, pci_device_1042_3010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1042_3010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1042_3020 = { + 0x3020, pci_device_1042_3020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1042_3020, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1043_0675 = { + 0x0675, pci_device_1043_0675, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1043_0675, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1043_4021 = { + 0x4021, pci_device_1043_4021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1043_4021, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1044_1012 = { + 0x1012, pci_device_1044_1012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1044_1012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1044_a400 = { + 0xa400, pci_device_1044_a400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1044_a400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1044_a500 = { + 0xa500, pci_device_1044_a500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1044_a500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1044_a501 = { + 0xa501, pci_device_1044_a501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1044_a501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1044_a511 = { + 0xa511, pci_device_1044_a511, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1044_a511, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1045_a0f8 = { + 0xa0f8, pci_device_1045_a0f8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_a0f8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c101 = { + 0xc101, pci_device_1045_c101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c178 = { + 0xc178, pci_device_1045_c178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c556 = { + 0xc556, pci_device_1045_c556, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c556, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c557 = { + 0xc557, pci_device_1045_c557, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c557, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c558 = { + 0xc558, pci_device_1045_c558, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c558, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c567 = { + 0xc567, pci_device_1045_c567, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c567, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c568 = { + 0xc568, pci_device_1045_c568, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c568, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c569 = { + 0xc569, pci_device_1045_c569, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c569, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c621 = { + 0xc621, pci_device_1045_c621, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c621, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c700 = { + 0xc700, pci_device_1045_c700, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c700, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c701 = { + 0xc701, pci_device_1045_c701, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c701, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c814 = { + 0xc814, pci_device_1045_c814, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c814, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c822 = { + 0xc822, pci_device_1045_c822, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c822, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c824 = { + 0xc824, pci_device_1045_c824, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c824, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c825 = { + 0xc825, pci_device_1045_c825, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c825, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c832 = { + 0xc832, pci_device_1045_c832, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c832, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c861 = { + 0xc861, pci_device_1045_c861, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c861, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c895 = { + 0xc895, pci_device_1045_c895, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c895, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_c935 = { + 0xc935, pci_device_1045_c935, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_c935, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_d568 = { + 0xd568, pci_device_1045_d568, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_d568, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1045_d721 = { + 0xd721, pci_device_1045_d721, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1045_d721, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1048_0d22 = { + 0x0d22, pci_device_1048_0d22, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1048_0d22, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1048_1000 = { + 0x1000, pci_device_1048_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1048_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1048_3000 = { + 0x3000, pci_device_1048_3000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1048_3000, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_104a_0008 = { + 0x0008, pci_device_104a_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_0009 = { + 0x0009, pci_device_104a_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_0010 = { + 0x0010, pci_device_104a_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_0210 = { + 0x0210, pci_device_104a_0210, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_0210, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_0981 = { + 0x0981, pci_device_104a_0981, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_0981, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_1746 = { + 0x1746, pci_device_104a_1746, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_1746, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_2774 = { + 0x2774, pci_device_104a_2774, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_2774, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104a_3520 = { + 0x3520, pci_device_104a_3520, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104a_3520, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_104b_0140 = { + 0x0140, pci_device_104b_0140, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104b_0140, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104b_1040 = { + 0x1040, pci_device_104b_1040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104b_1040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104b_8130 = { + 0x8130, pci_device_104b_8130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104b_8130, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_104c_0500 = { + 0x0500, pci_device_104c_0500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_0500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_0508 = { + 0x0508, pci_device_104c_0508, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_0508, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_1000 = { + 0x1000, pci_device_104c_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_104c = { + 0x104c, pci_device_104c_104c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_104c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_3d04 = { + 0x3d04, pci_device_104c_3d04, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_3d04, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_3d07 = { + 0x3d07, pci_device_104c_3d07, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_3d07, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8000 = { + 0x8000, pci_device_104c_8000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8009 = { + 0x8009, pci_device_104c_8009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8017 = { + 0x8017, pci_device_104c_8017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8019 = { + 0x8019, pci_device_104c_8019, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8019, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8020 = { + 0x8020, pci_device_104c_8020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8021 = { + 0x8021, pci_device_104c_8021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8022 = { + 0x8022, pci_device_104c_8022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8023 = { + 0x8023, pci_device_104c_8023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8024 = { + 0x8024, pci_device_104c_8024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8026 = { + 0x8026, pci_device_104c_8026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8027 = { + 0x8027, pci_device_104c_8027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_8400 = { + 0x8400, pci_device_104c_8400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_8400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_a001 = { + 0xa001, pci_device_104c_a001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_a001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_a100 = { + 0xa100, pci_device_104c_a100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_a100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_a102 = { + 0xa102, pci_device_104c_a102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_a102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_a106 = { + 0xa106, pci_device_104c_a106, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_a106, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac10 = { + 0xac10, pci_device_104c_ac10, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac10, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac11 = { + 0xac11, pci_device_104c_ac11, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac11, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac12 = { + 0xac12, pci_device_104c_ac12, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac12, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac13 = { + 0xac13, pci_device_104c_ac13, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac13, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac15 = { + 0xac15, pci_device_104c_ac15, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac15, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac16 = { + 0xac16, pci_device_104c_ac16, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac16, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac17 = { + 0xac17, pci_device_104c_ac17, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac17, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac18 = { + 0xac18, pci_device_104c_ac18, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac18, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac19 = { + 0xac19, pci_device_104c_ac19, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac19, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac1a = { + 0xac1a, pci_device_104c_ac1a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac1a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac1b = { + 0xac1b, pci_device_104c_ac1b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac1b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac1c = { + 0xac1c, pci_device_104c_ac1c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac1c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac1d = { + 0xac1d, pci_device_104c_ac1d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac1d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac1e = { + 0xac1e, pci_device_104c_ac1e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac1e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac1f = { + 0xac1f, pci_device_104c_ac1f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac1f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac20 = { + 0xac20, pci_device_104c_ac20, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac20, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac21 = { + 0xac21, pci_device_104c_ac21, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac21, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac22 = { + 0xac22, pci_device_104c_ac22, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac22, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac23 = { + 0xac23, pci_device_104c_ac23, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac23, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac28 = { + 0xac28, pci_device_104c_ac28, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac28, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac30 = { + 0xac30, pci_device_104c_ac30, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac30, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac40 = { + 0xac40, pci_device_104c_ac40, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac40, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac41 = { + 0xac41, pci_device_104c_ac41, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac41, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac42 = { + 0xac42, pci_device_104c_ac42, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac42, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac50 = { + 0xac50, pci_device_104c_ac50, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac50, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac51 = { + 0xac51, pci_device_104c_ac51, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac51, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac52 = { + 0xac52, pci_device_104c_ac52, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac52, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac53 = { + 0xac53, pci_device_104c_ac53, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac53, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac55 = { + 0xac55, pci_device_104c_ac55, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac55, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac56 = { + 0xac56, pci_device_104c_ac56, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac56, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_ac60 = { + 0xac60, pci_device_104c_ac60, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_ac60, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_fe00 = { + 0xfe00, pci_device_104c_fe00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_fe00, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104c_fe03 = { + 0xfe03, pci_device_104c_fe03, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104c_fe03, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104d_8009 = { + 0x8009, pci_device_104d_8009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104d_8009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104d_8039 = { + 0x8039, pci_device_104d_8039, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104d_8039, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104d_8056 = { + 0x8056, pci_device_104d_8056, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104d_8056, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104d_808a = { + 0x808a, pci_device_104d_808a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104d_808a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104e_0017 = { + 0x0017, pci_device_104e_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104e_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104e_0107 = { + 0x0107, pci_device_104e_0107, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104e_0107, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104e_0109 = { + 0x0109, pci_device_104e_0109, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104e_0109, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104e_0111 = { + 0x0111, pci_device_104e_0111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104e_0111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104e_0217 = { + 0x0217, pci_device_104e_0217, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104e_0217, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_104e_0317 = { + 0x0317, pci_device_104e_0317, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_104e_0317, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1050_0000 = { + 0x0000, pci_device_1050_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_0001 = { + 0x0001, pci_device_1050_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_0105 = { + 0x0105, pci_device_1050_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_0840 = { + 0x0840, pci_device_1050_0840, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_0840, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_0940 = { + 0x0940, pci_device_1050_0940, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_0940, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_5a5a = { + 0x5a5a, pci_device_1050_5a5a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_5a5a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_6692 = { + 0x6692, pci_device_1050_6692, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_6692, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1050_9970 = { + 0x9970, pci_device_1050_9970, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1050_9970, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1055_9130 = { + 0x9130, pci_device_1055_9130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1055_9130, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1055_9460 = { + 0x9460, pci_device_1055_9460, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1055_9460, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1055_9462 = { + 0x9462, pci_device_1055_9462, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1055_9462, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1055_9463 = { + 0x9463, pci_device_1055_9463, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1055_9463, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1057_0001 = { + 0x0001, pci_device_1057_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_0002 = { + 0x0002, pci_device_1057_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_0003 = { + 0x0003, pci_device_1057_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_0004 = { + 0x0004, pci_device_1057_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_0006 = { + 0x0006, pci_device_1057_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_0100 = { + 0x0100, pci_device_1057_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_0431 = { + 0x0431, pci_device_1057_0431, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_0431, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_1801 = { + 0x1801, pci_device_1057_1801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_1801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_18c0 = { + 0x18c0, pci_device_1057_18c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_18c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_4801 = { + 0x4801, pci_device_1057_4801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_4801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_4802 = { + 0x4802, pci_device_1057_4802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_4802, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_4803 = { + 0x4803, pci_device_1057_4803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_4803, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_4806 = { + 0x4806, pci_device_1057_4806, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_4806, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_4d68 = { + 0x4d68, pci_device_1057_4d68, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_4d68, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_5600 = { + 0x5600, pci_device_1057_5600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_5600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1057_6400 = { + 0x6400, pci_device_1057_6400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1057_6400, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_105a_0d30 = { + 0x0d30, pci_device_105a_0d30, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_0d30, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_0d38 = { + 0x0d38, pci_device_105a_0d38, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_0d38, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_1275 = { + 0x1275, pci_device_105a_1275, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_1275, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_3376 = { + 0x3376, pci_device_105a_3376, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_3376, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_4d30 = { + 0x4d30, pci_device_105a_4d30, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_4d30, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_4d33 = { + 0x4d33, pci_device_105a_4d33, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_4d33, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_4d38 = { + 0x4d38, pci_device_105a_4d38, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_4d38, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_4d68 = { + 0x4d68, pci_device_105a_4d68, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_4d68, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_4d69 = { + 0x4d69, pci_device_105a_4d69, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_4d69, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_5275 = { + 0x5275, pci_device_105a_5275, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_5275, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_5300 = { + 0x5300, pci_device_105a_5300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_5300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_6268 = { + 0x6268, pci_device_105a_6268, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_6268, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_6269 = { + 0x6269, pci_device_105a_6269, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_6269, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_6621 = { + 0x6621, pci_device_105a_6621, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_6621, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105a_7275 = { + 0x7275, pci_device_105a_7275, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105a_7275, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_105d_2309 = { + 0x2309, pci_device_105d_2309, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105d_2309, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105d_2339 = { + 0x2339, pci_device_105d_2339, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105d_2339, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105d_493d = { + 0x493d, pci_device_105d_493d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105d_493d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_105d_5348 = { + 0x5348, pci_device_105d_5348, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_105d_5348, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1060_0001 = { + 0x0001, pci_device_1060_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_0002 = { + 0x0002, pci_device_1060_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_0101 = { + 0x0101, pci_device_1060_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_0881 = { + 0x0881, pci_device_1060_0881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_0881, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_0886 = { + 0x0886, pci_device_1060_0886, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_0886, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_0891 = { + 0x0891, pci_device_1060_0891, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_0891, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_1001 = { + 0x1001, pci_device_1060_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_673a = { + 0x673a, pci_device_1060_673a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_673a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_673b = { + 0x673b, pci_device_1060_673b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_673b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_8710 = { + 0x8710, pci_device_1060_8710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_8710, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_886a = { + 0x886a, pci_device_1060_886a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_886a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_8881 = { + 0x8881, pci_device_1060_8881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_8881, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_8886 = { + 0x8886, pci_device_1060_8886, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_8886, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_888a = { + 0x888a, pci_device_1060_888a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_888a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_8891 = { + 0x8891, pci_device_1060_8891, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_8891, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_9017 = { + 0x9017, pci_device_1060_9017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_9017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_9018 = { + 0x9018, pci_device_1060_9018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_9018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_9026 = { + 0x9026, pci_device_1060_9026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_9026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_e881 = { + 0xe881, pci_device_1060_e881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_e881, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_e886 = { + 0xe886, pci_device_1060_e886, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_e886, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_e88a = { + 0xe88a, pci_device_1060_e88a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_e88a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1060_e891 = { + 0xe891, pci_device_1060_e891, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1060_e891, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1061_0001 = { + 0x0001, pci_device_1061_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1061_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1061_0002 = { + 0x0002, pci_device_1061_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1061_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1066_0000 = { + 0x0000, pci_device_1066_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1066_0001 = { + 0x0001, pci_device_1066_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1066_0002 = { + 0x0002, pci_device_1066_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1066_0003 = { + 0x0003, pci_device_1066_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1066_0004 = { + 0x0004, pci_device_1066_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1066_0005 = { + 0x0005, pci_device_1066_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1066_8002 = { + 0x8002, pci_device_1066_8002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1066_8002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1067_1002 = { + 0x1002, pci_device_1067_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1067_1002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1069_0001 = { + 0x0001, pci_device_1069_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1069_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1069_0002 = { + 0x0002, pci_device_1069_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1069_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1069_0010 = { + 0x0010, pci_device_1069_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1069_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1069_0050 = { + 0x0050, pci_device_1069_0050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1069_0050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1069_ba55 = { + 0xba55, pci_device_1069_ba55, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1069_ba55, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1069_ba56 = { + 0xba56, pci_device_1069_ba56, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1069_ba56, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_106b_0001 = { + 0x0001, pci_device_106b_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0002 = { + 0x0002, pci_device_106b_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0003 = { + 0x0003, pci_device_106b_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0004 = { + 0x0004, pci_device_106b_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0007 = { + 0x0007, pci_device_106b_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_000e = { + 0x000e, pci_device_106b_000e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_000e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0010 = { + 0x0010, pci_device_106b_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0017 = { + 0x0017, pci_device_106b_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0018 = { + 0x0018, pci_device_106b_0018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0019 = { + 0x0019, pci_device_106b_0019, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0019, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_001e = { + 0x001e, pci_device_106b_001e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_001e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_001f = { + 0x001f, pci_device_106b_001f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_001f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0020 = { + 0x0020, pci_device_106b_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0021 = { + 0x0021, pci_device_106b_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0022 = { + 0x0022, pci_device_106b_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0024 = { + 0x0024, pci_device_106b_0024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0025 = { + 0x0025, pci_device_106b_0025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0026 = { + 0x0026, pci_device_106b_0026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0027 = { + 0x0027, pci_device_106b_0027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0028 = { + 0x0028, pci_device_106b_0028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0028, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0029 = { + 0x0029, pci_device_106b_0029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_002d = { + 0x002d, pci_device_106b_002d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_002d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_002e = { + 0x002e, pci_device_106b_002e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_002e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_002f = { + 0x002f, pci_device_106b_002f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_002f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0030 = { + 0x0030, pci_device_106b_0030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0031 = { + 0x0031, pci_device_106b_0031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0032 = { + 0x0032, pci_device_106b_0032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0033 = { + 0x0033, pci_device_106b_0033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_0034 = { + 0x0034, pci_device_106b_0034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_0034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106b_1645 = { + 0x1645, pci_device_106b_1645, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106b_1645, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_106c_8801 = { + 0x8801, pci_device_106c_8801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106c_8801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106c_8802 = { + 0x8802, pci_device_106c_8802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106c_8802, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106c_8803 = { + 0x8803, pci_device_106c_8803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106c_8803, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106c_8804 = { + 0x8804, pci_device_106c_8804, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106c_8804, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_106c_8805 = { + 0x8805, pci_device_106c_8805, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_106c_8805, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1073_0001 = { + 0x0001, pci_device_1073_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0002 = { + 0x0002, pci_device_1073_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0003 = { + 0x0003, pci_device_1073_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0004 = { + 0x0004, pci_device_1073_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0005 = { + 0x0005, pci_device_1073_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0006 = { + 0x0006, pci_device_1073_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0008 = { + 0x0008, pci_device_1073_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_000a = { + 0x000a, pci_device_1073_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_000c = { + 0x000c, pci_device_1073_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_000d = { + 0x000d, pci_device_1073_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0010 = { + 0x0010, pci_device_1073_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0012 = { + 0x0012, pci_device_1073_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_0020 = { + 0x0020, pci_device_1073_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1073_2000 = { + 0x2000, pci_device_1073_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1073_2000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1074_4e78 = { + 0x4e78, pci_device_1074_4e78, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1074_4e78, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1077_1016 = { + 0x1016, pci_device_1077_1016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_1020 = { + 0x1020, pci_device_1077_1020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_1022 = { + 0x1022, pci_device_1077_1022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_1080 = { + 0x1080, pci_device_1077_1080, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1080, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_1216 = { + 0x1216, pci_device_1077_1216, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1216, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_1240 = { + 0x1240, pci_device_1077_1240, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1240, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_1280 = { + 0x1280, pci_device_1077_1280, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_1280, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_2020 = { + 0x2020, pci_device_1077_2020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_2020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_2100 = { + 0x2100, pci_device_1077_2100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_2100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_2200 = { + 0x2200, pci_device_1077_2200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_2200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_2300 = { + 0x2300, pci_device_1077_2300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_2300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1077_2312 = { + 0x2312, pci_device_1077_2312, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1077_2312, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1078_0000 = { + 0x0000, pci_device_1078_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0001 = { + 0x0001, pci_device_1078_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0002 = { + 0x0002, pci_device_1078_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0100 = { + 0x0100, pci_device_1078_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0101 = { + 0x0101, pci_device_1078_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0102 = { + 0x0102, pci_device_1078_0102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0103 = { + 0x0103, pci_device_1078_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0104 = { + 0x0104, pci_device_1078_0104, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0104, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0400 = { + 0x0400, pci_device_1078_0400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0401 = { + 0x0401, pci_device_1078_0401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0402 = { + 0x0402, pci_device_1078_0402, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0402, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1078_0403 = { + 0x0403, pci_device_1078_0403, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1078_0403, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_107d_0000 = { + 0x0000, pci_device_107d_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107d_0000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_107e_0001 = { + 0x0001, pci_device_107e_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_0002 = { + 0x0002, pci_device_107e_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_0004 = { + 0x0004, pci_device_107e_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_0005 = { + 0x0005, pci_device_107e_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_0008 = { + 0x0008, pci_device_107e_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9003 = { + 0x9003, pci_device_107e_9003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9007 = { + 0x9007, pci_device_107e_9007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9008 = { + 0x9008, pci_device_107e_9008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_900c = { + 0x900c, pci_device_107e_900c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_900c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_900e = { + 0x900e, pci_device_107e_900e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_900e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9011 = { + 0x9011, pci_device_107e_9011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9013 = { + 0x9013, pci_device_107e_9013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9023 = { + 0x9023, pci_device_107e_9023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9027 = { + 0x9027, pci_device_107e_9027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9031 = { + 0x9031, pci_device_107e_9031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_107e_9033 = { + 0x9033, pci_device_107e_9033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107e_9033, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_107f_0802 = { + 0x0802, pci_device_107f_0802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_107f_0802, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1080_0600 = { + 0x0600, pci_device_1080_0600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1080_0600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1080_c691 = { + 0xc691, pci_device_1080_c691, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1080_c691, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1080_c693 = { + 0xc693, pci_device_1080_c693, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1080_c693, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1081_0d47 = { + 0x0d47, pci_device_1081_0d47, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1081_0d47, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1083_0001 = { + 0x0001, pci_device_1083_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1083_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_108a_0001 = { + 0x0001, pci_device_108a_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108a_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108a_0010 = { + 0x0010, pci_device_108a_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108a_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108a_0040 = { + 0x0040, pci_device_108a_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108a_0040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108a_3000 = { + 0x3000, pci_device_108a_3000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108a_3000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_108d_0001 = { + 0x0001, pci_device_108d_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0002 = { + 0x0002, pci_device_108d_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0004 = { + 0x0004, pci_device_108d_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0005 = { + 0x0005, pci_device_108d_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0006 = { + 0x0006, pci_device_108d_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0007 = { + 0x0007, pci_device_108d_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0008 = { + 0x0008, pci_device_108d_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0011 = { + 0x0011, pci_device_108d_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0012 = { + 0x0012, pci_device_108d_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0013 = { + 0x0013, pci_device_108d_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0014 = { + 0x0014, pci_device_108d_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0019 = { + 0x0019, pci_device_108d_0019, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0019, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0021 = { + 0x0021, pci_device_108d_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108d_0022 = { + 0x0022, pci_device_108d_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108d_0022, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_108e_0001 = { + 0x0001, pci_device_108e_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_1000 = { + 0x1000, pci_device_108e_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_1001 = { + 0x1001, pci_device_108e_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_1100 = { + 0x1100, pci_device_108e_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_1100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_1101 = { + 0x1101, pci_device_108e_1101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_1101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_1102 = { + 0x1102, pci_device_108e_1102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_1102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_1103 = { + 0x1103, pci_device_108e_1103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_1103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_2bad = { + 0x2bad, pci_device_108e_2bad, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_2bad, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_5000 = { + 0x5000, pci_device_108e_5000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_5000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_5043 = { + 0x5043, pci_device_108e_5043, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_5043, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_8000 = { + 0x8000, pci_device_108e_8000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_8000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_8001 = { + 0x8001, pci_device_108e_8001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_8001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_a000 = { + 0xa000, pci_device_108e_a000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_a000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_108e_a001 = { + 0xa001, pci_device_108e_a001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_108e_a001, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1091_0020 = { + 0x0020, pci_device_1091_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1091_0021 = { + 0x0021, pci_device_1091_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1091_0040 = { + 0x0040, pci_device_1091_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_0040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1091_0041 = { + 0x0041, pci_device_1091_0041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_0041, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1091_0060 = { + 0x0060, pci_device_1091_0060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_0060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1091_00e4 = { + 0x00e4, pci_device_1091_00e4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_00e4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1091_0720 = { + 0x0720, pci_device_1091_0720, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1091_0720, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1092_00a0 = { + 0x00a0, pci_device_1092_00a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_00a0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_00a8 = { + 0x00a8, pci_device_1092_00a8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_00a8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_0550 = { + 0x0550, pci_device_1092_0550, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_0550, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_08d4 = { + 0x08d4, pci_device_1092_08d4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_08d4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_094c = { + 0x094c, pci_device_1092_094c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_094c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_1092 = { + 0x1092, pci_device_1092_1092, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_1092, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_6120 = { + 0x6120, pci_device_1092_6120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_6120, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_8810 = { + 0x8810, pci_device_1092_8810, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_8810, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_8811 = { + 0x8811, pci_device_1092_8811, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_8811, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_8880 = { + 0x8880, pci_device_1092_8880, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_8880, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_8881 = { + 0x8881, pci_device_1092_8881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_8881, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88b0 = { + 0x88b0, pci_device_1092_88b0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88b0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88b1 = { + 0x88b1, pci_device_1092_88b1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88b1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88c0 = { + 0x88c0, pci_device_1092_88c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88c1 = { + 0x88c1, pci_device_1092_88c1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88c1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88d0 = { + 0x88d0, pci_device_1092_88d0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88d0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88d1 = { + 0x88d1, pci_device_1092_88d1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88d1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88f0 = { + 0x88f0, pci_device_1092_88f0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88f0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_88f1 = { + 0x88f1, pci_device_1092_88f1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_88f1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1092_9999 = { + 0x9999, pci_device_1092_9999, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1092_9999, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1093_0160 = { + 0x0160, pci_device_1093_0160, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_0160, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_0162 = { + 0x0162, pci_device_1093_0162, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_0162, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_1170 = { + 0x1170, pci_device_1093_1170, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_1170, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_1180 = { + 0x1180, pci_device_1093_1180, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_1180, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_1190 = { + 0x1190, pci_device_1093_1190, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_1190, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_1330 = { + 0x1330, pci_device_1093_1330, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_1330, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_1350 = { + 0x1350, pci_device_1093_1350, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_1350, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_2a60 = { + 0x2a60, pci_device_1093_2a60, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_2a60, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b001 = { + 0xb001, pci_device_1093_b001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b011 = { + 0xb011, pci_device_1093_b011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b021 = { + 0xb021, pci_device_1093_b021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b031 = { + 0xb031, pci_device_1093_b031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b041 = { + 0xb041, pci_device_1093_b041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b041, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b051 = { + 0xb051, pci_device_1093_b051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b061 = { + 0xb061, pci_device_1093_b061, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b061, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b071 = { + 0xb071, pci_device_1093_b071, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b071, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b081 = { + 0xb081, pci_device_1093_b081, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b081, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_b091 = { + 0xb091, pci_device_1093_b091, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_b091, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_c801 = { + 0xc801, pci_device_1093_c801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_c801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1093_c831 = { + 0xc831, pci_device_1093_c831, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1093_c831, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1095_0640 = { + 0x0640, pci_device_1095_0640, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0640, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0643 = { + 0x0643, pci_device_1095_0643, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0643, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0646 = { + 0x0646, pci_device_1095_0646, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0646, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0647 = { + 0x0647, pci_device_1095_0647, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0647, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0648 = { + 0x0648, pci_device_1095_0648, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0648, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0649 = { + 0x0649, pci_device_1095_0649, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0649, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0650 = { + 0x0650, pci_device_1095_0650, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0650, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0670 = { + 0x0670, pci_device_1095_0670, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0670, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0673 = { + 0x0673, pci_device_1095_0673, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0673, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_0680 = { + 0x0680, pci_device_1095_0680, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_0680, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1095_3112 = { + 0x3112, pci_device_1095_3112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1095_3112, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1098_0001 = { + 0x0001, pci_device_1098_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1098_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1098_0002 = { + 0x0002, pci_device_1098_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1098_0002, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_109e_0350 = { + 0x0350, pci_device_109e_0350, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0350, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_0351 = { + 0x0351, pci_device_109e_0351, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0351, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_0369 = { + 0x0369, pci_device_109e_0369, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0369, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_036c = { + 0x036c, pci_device_109e_036c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_036c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_036e = { + 0x036e, pci_device_109e_036e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_036e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_036f = { + 0x036f, pci_device_109e_036f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_036f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_0370 = { + 0x0370, pci_device_109e_0370, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0370, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_0878 = { + 0x0878, pci_device_109e_0878, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0878, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_0879 = { + 0x0879, pci_device_109e_0879, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0879, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_0880 = { + 0x0880, pci_device_109e_0880, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_0880, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_2115 = { + 0x2115, pci_device_109e_2115, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_2115, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_2125 = { + 0x2125, pci_device_109e_2125, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_2125, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_2164 = { + 0x2164, pci_device_109e_2164, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_2164, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_2165 = { + 0x2165, pci_device_109e_2165, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_2165, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_8230 = { + 0x8230, pci_device_109e_8230, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_8230, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_8472 = { + 0x8472, pci_device_109e_8472, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_8472, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_109e_8474 = { + 0x8474, pci_device_109e_8474, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_109e_8474, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10a5_5449 = { + 0x5449, pci_device_10a5_5449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a5_5449, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10a8_0000 = { + 0x0000, pci_device_10a8_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a8_0000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10a9_0001 = { + 0x0001, pci_device_10a9_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0002 = { + 0x0002, pci_device_10a9_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0003 = { + 0x0003, pci_device_10a9_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0004 = { + 0x0004, pci_device_10a9_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0005 = { + 0x0005, pci_device_10a9_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0006 = { + 0x0006, pci_device_10a9_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0007 = { + 0x0007, pci_device_10a9_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0008 = { + 0x0008, pci_device_10a9_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0009 = { + 0x0009, pci_device_10a9_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0010 = { + 0x0010, pci_device_10a9_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0011 = { + 0x0011, pci_device_10a9_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_0012 = { + 0x0012, pci_device_10a9_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1001 = { + 0x1001, pci_device_10a9_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1002 = { + 0x1002, pci_device_10a9_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1003 = { + 0x1003, pci_device_10a9_1003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1004 = { + 0x1004, pci_device_10a9_1004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1005 = { + 0x1005, pci_device_10a9_1005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1006 = { + 0x1006, pci_device_10a9_1006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1007 = { + 0x1007, pci_device_10a9_1007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_1008 = { + 0x1008, pci_device_10a9_1008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_1008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_2001 = { + 0x2001, pci_device_10a9_2001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_2001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_2002 = { + 0x2002, pci_device_10a9_2002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_2002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_8001 = { + 0x8001, pci_device_10a9_8001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_8001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10a9_8002 = { + 0x8002, pci_device_10a9_8002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10a9_8002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10aa_0000 = { + 0x0000, pci_device_10aa_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10aa_0000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10ad_0001 = { + 0x0001, pci_device_10ad_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ad_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ad_0003 = { + 0x0003, pci_device_10ad_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ad_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ad_0005 = { + 0x0005, pci_device_10ad_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ad_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ad_0103 = { + 0x0103, pci_device_10ad_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ad_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ad_0105 = { + 0x0105, pci_device_10ad_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ad_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ad_0565 = { + 0x0565, pci_device_10ad_0565, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ad_0565, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10b3_3106 = { + 0x3106, pci_device_10b3_3106, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b3_3106, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b3_b106 = { + 0xb106, pci_device_10b3_b106, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b3_b106, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10b4_1b1d = { + 0x1b1d, pci_device_10b4_1b1d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b4_1b1d, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10b5_0001 = { + 0x0001, pci_device_10b5_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_1076 = { + 0x1076, pci_device_10b5_1076, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_1076, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_1077 = { + 0x1077, pci_device_10b5_1077, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_1077, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_1078 = { + 0x1078, pci_device_10b5_1078, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_1078, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_1103 = { + 0x1103, pci_device_10b5_1103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_1103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_1146 = { + 0x1146, pci_device_10b5_1146, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_1146, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_1147 = { + 0x1147, pci_device_10b5_1147, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_1147, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_2724 = { + 0x2724, pci_device_10b5_2724, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_2724, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_9030 = { + 0x9030, pci_device_10b5_9030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_9030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_9036 = { + 0x9036, pci_device_10b5_9036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_9036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_9050 = { + 0x9050, pci_device_10b5_9050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_9050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_9054 = { + 0x9054, pci_device_10b5_9054, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_9054, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_9060 = { + 0x9060, pci_device_10b5_9060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_9060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_906d = { + 0x906d, pci_device_10b5_906d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_906d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_906e = { + 0x906e, pci_device_10b5_906e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_906e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b5_9080 = { + 0x9080, pci_device_10b5_9080, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b5_9080, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10b6_0001 = { + 0x0001, pci_device_10b6_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_0002 = { + 0x0002, pci_device_10b6_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_0003 = { + 0x0003, pci_device_10b6_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_0004 = { + 0x0004, pci_device_10b6_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_0006 = { + 0x0006, pci_device_10b6_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_0007 = { + 0x0007, pci_device_10b6_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_0009 = { + 0x0009, pci_device_10b6_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_000a = { + 0x000a, pci_device_10b6_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_000b = { + 0x000b, pci_device_10b6_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_000c = { + 0x000c, pci_device_10b6_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_1000 = { + 0x1000, pci_device_10b6_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b6_1001 = { + 0x1001, pci_device_10b6_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b6_1001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10b7_0001 = { + 0x0001, pci_device_10b7_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_1006 = { + 0x1006, pci_device_10b7_1006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_1006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_1007 = { + 0x1007, pci_device_10b7_1007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_1007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_3390 = { + 0x3390, pci_device_10b7_3390, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_3390, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_3590 = { + 0x3590, pci_device_10b7_3590, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_3590, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_4500 = { + 0x4500, pci_device_10b7_4500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_4500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5055 = { + 0x5055, pci_device_10b7_5055, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5055, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5057 = { + 0x5057, pci_device_10b7_5057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5157 = { + 0x5157, pci_device_10b7_5157, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5157, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5257 = { + 0x5257, pci_device_10b7_5257, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5257, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5900 = { + 0x5900, pci_device_10b7_5900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5920 = { + 0x5920, pci_device_10b7_5920, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5920, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5950 = { + 0x5950, pci_device_10b7_5950, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5950, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5951 = { + 0x5951, pci_device_10b7_5951, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5951, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5952 = { + 0x5952, pci_device_10b7_5952, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5952, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5970 = { + 0x5970, pci_device_10b7_5970, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5970, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_5b57 = { + 0x5b57, pci_device_10b7_5b57, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_5b57, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6055 = { + 0x6055, pci_device_10b7_6055, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6055, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6056 = { + 0x6056, pci_device_10b7_6056, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6056, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6560 = { + 0x6560, pci_device_10b7_6560, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6560, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6561 = { + 0x6561, pci_device_10b7_6561, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6561, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6562 = { + 0x6562, pci_device_10b7_6562, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6562, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6563 = { + 0x6563, pci_device_10b7_6563, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6563, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_6564 = { + 0x6564, pci_device_10b7_6564, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_6564, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_7646 = { + 0x7646, pci_device_10b7_7646, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_7646, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_7940 = { + 0x7940, pci_device_10b7_7940, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_7940, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_7980 = { + 0x7980, pci_device_10b7_7980, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_7980, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_7990 = { + 0x7990, pci_device_10b7_7990, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_7990, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_8811 = { + 0x8811, pci_device_10b7_8811, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_8811, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9000 = { + 0x9000, pci_device_10b7_9000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9001 = { + 0x9001, pci_device_10b7_9001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9004 = { + 0x9004, pci_device_10b7_9004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9005 = { + 0x9005, pci_device_10b7_9005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9006 = { + 0x9006, pci_device_10b7_9006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_900a = { + 0x900a, pci_device_10b7_900a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_900a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9050 = { + 0x9050, pci_device_10b7_9050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9051 = { + 0x9051, pci_device_10b7_9051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9055 = { + 0x9055, pci_device_10b7_9055, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9055, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9056 = { + 0x9056, pci_device_10b7_9056, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9056, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9058 = { + 0x9058, pci_device_10b7_9058, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9058, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_905a = { + 0x905a, pci_device_10b7_905a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_905a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9200 = { + 0x9200, pci_device_10b7_9200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9201 = { + 0x9201, pci_device_10b7_9201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9300 = { + 0x9300, pci_device_10b7_9300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9800 = { + 0x9800, pci_device_10b7_9800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9805 = { + 0x9805, pci_device_10b7_9805, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9805, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9900 = { + 0x9900, pci_device_10b7_9900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9902 = { + 0x9902, pci_device_10b7_9902, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9902, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9903 = { + 0x9903, pci_device_10b7_9903, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9903, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9904 = { + 0x9904, pci_device_10b7_9904, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9904, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9905 = { + 0x9905, pci_device_10b7_9905, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9905, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9908 = { + 0x9908, pci_device_10b7_9908, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9908, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_9909 = { + 0x9909, pci_device_10b7_9909, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_9909, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b7_990b = { + 0x990b, pci_device_10b7_990b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b7_990b, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10b8_0005 = { + 0x0005, pci_device_10b8_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b8_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b8_0006 = { + 0x0006, pci_device_10b8_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b8_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b8_1000 = { + 0x1000, pci_device_10b8_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b8_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b8_1001 = { + 0x1001, pci_device_10b8_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b8_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b8_a011 = { + 0xa011, pci_device_10b8_a011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b8_a011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b8_b106 = { + 0xb106, pci_device_10b8_b106, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b8_b106, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_10b9_0111 = { + 0x0111, pci_device_10b9_0111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_0111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1435 = { + 0x1435, pci_device_10b9_1435, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1435, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1445 = { + 0x1445, pci_device_10b9_1445, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1445, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1449 = { + 0x1449, pci_device_10b9_1449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1449, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1451 = { + 0x1451, pci_device_10b9_1451, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1451, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1461 = { + 0x1461, pci_device_10b9_1461, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1461, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1489 = { + 0x1489, pci_device_10b9_1489, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1489, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1511 = { + 0x1511, pci_device_10b9_1511, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1511, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1512 = { + 0x1512, pci_device_10b9_1512, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1512, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1513 = { + 0x1513, pci_device_10b9_1513, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1513, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1521 = { + 0x1521, pci_device_10b9_1521, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1521, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1523 = { + 0x1523, pci_device_10b9_1523, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1523, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1531 = { + 0x1531, pci_device_10b9_1531, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1531, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1533 = { + 0x1533, pci_device_10b9_1533, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1533, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1541 = { + 0x1541, pci_device_10b9_1541, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1541, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1543 = { + 0x1543, pci_device_10b9_1543, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1543, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1563 = { + 0x1563, pci_device_10b9_1563, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1563, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1621 = { + 0x1621, pci_device_10b9_1621, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1621, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1631 = { + 0x1631, pci_device_10b9_1631, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1631, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1632 = { + 0x1632, pci_device_10b9_1632, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1632, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1641 = { + 0x1641, pci_device_10b9_1641, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1641, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1644 = { + 0x1644, pci_device_10b9_1644, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1644, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1646 = { + 0x1646, pci_device_10b9_1646, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1646, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1647 = { + 0x1647, pci_device_10b9_1647, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1647, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1651 = { + 0x1651, pci_device_10b9_1651, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1651, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1671 = { + 0x1671, pci_device_10b9_1671, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1671, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1681 = { + 0x1681, pci_device_10b9_1681, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1681, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_1687 = { + 0x1687, pci_device_10b9_1687, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_1687, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3141 = { + 0x3141, pci_device_10b9_3141, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3141, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3143 = { + 0x3143, pci_device_10b9_3143, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3143, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3145 = { + 0x3145, pci_device_10b9_3145, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3145, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3147 = { + 0x3147, pci_device_10b9_3147, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3147, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3149 = { + 0x3149, pci_device_10b9_3149, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3149, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3151 = { + 0x3151, pci_device_10b9_3151, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3151, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3307 = { + 0x3307, pci_device_10b9_3307, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3307, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_3309 = { + 0x3309, pci_device_10b9_3309, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_3309, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5212 = { + 0x5212, pci_device_10b9_5212, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5212, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5215 = { + 0x5215, pci_device_10b9_5215, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5215, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5217 = { + 0x5217, pci_device_10b9_5217, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5217, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5219 = { + 0x5219, pci_device_10b9_5219, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5219, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5225 = { + 0x5225, pci_device_10b9_5225, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5225, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5229 = { + 0x5229, pci_device_10b9_5229, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5229, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5235 = { + 0x5235, pci_device_10b9_5235, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5235, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5237 = { + 0x5237, pci_device_10b9_5237, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5237, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5239 = { + 0x5239, pci_device_10b9_5239, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5239, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5243 = { + 0x5243, pci_device_10b9_5243, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5243, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5247 = { + 0x5247, pci_device_10b9_5247, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5247, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5249 = { + 0x5249, pci_device_10b9_5249, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5249, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5251 = { + 0x5251, pci_device_10b9_5251, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5251, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5253 = { + 0x5253, pci_device_10b9_5253, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5253, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5261 = { + 0x5261, pci_device_10b9_5261, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5261, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5451 = { + 0x5451, pci_device_10b9_5451, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5451, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5453 = { + 0x5453, pci_device_10b9_5453, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5453, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5455 = { + 0x5455, pci_device_10b9_5455, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5455, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5457 = { + 0x5457, pci_device_10b9_5457, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5457, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5459 = { + 0x5459, pci_device_10b9_5459, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5459, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_545a = { + 0x545a, pci_device_10b9_545a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_545a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5471 = { + 0x5471, pci_device_10b9_5471, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5471, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_5473 = { + 0x5473, pci_device_10b9_5473, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_5473, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10b9_7101 = { + 0x7101, pci_device_10b9_7101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10b9_7101, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10ba_0301 = { + 0x0301, pci_device_10ba_0301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ba_0301, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10bd_0e34 = { + 0x0e34, pci_device_10bd_0e34, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10bd_0e34, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10c3_1100 = { + 0x1100, pci_device_10c3_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c3_1100, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_10c8_0001 = { + 0x0001, pci_device_10c8_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0002 = { + 0x0002, pci_device_10c8_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0003 = { + 0x0003, pci_device_10c8_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0004 = { + 0x0004, pci_device_10c8_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0005 = { + 0x0005, pci_device_10c8_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0006 = { + 0x0006, pci_device_10c8_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0016 = { + 0x0016, pci_device_10c8_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0025 = { + 0x0025, pci_device_10c8_0025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_0083 = { + 0x0083, pci_device_10c8_0083, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_0083, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_8005 = { + 0x8005, pci_device_10c8_8005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_8005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_8006 = { + 0x8006, pci_device_10c8_8006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_8006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10c8_8016 = { + 0x8016, pci_device_10c8_8016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10c8_8016, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10cd_1100 = { + 0x1100, pci_device_10cd_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10cd_1100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10cd_1200 = { + 0x1200, pci_device_10cd_1200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10cd_1200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10cd_1300 = { + 0x1300, pci_device_10cd_1300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10cd_1300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10cd_2300 = { + 0x2300, pci_device_10cd_2300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10cd_2300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10cd_2500 = { + 0x2500, pci_device_10cd_2500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10cd_2500, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10cf_2001 = { + 0x2001, pci_device_10cf_2001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10cf_2001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10d9_0512 = { + 0x0512, pci_device_10d9_0512, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10d9_0512, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10d9_0531 = { + 0x0531, pci_device_10d9_0531, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10d9_0531, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10d9_8625 = { + 0x8625, pci_device_10d9_8625, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10d9_8625, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10d9_8888 = { + 0x8888, pci_device_10d9_8888, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10d9_8888, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10da_0508 = { + 0x0508, pci_device_10da_0508, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10da_0508, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10da_3390 = { + 0x3390, pci_device_10da_3390, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10da_3390, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10dc_0001 = { + 0x0001, pci_device_10dc_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10dc_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10dc_0002 = { + 0x0002, pci_device_10dc_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10dc_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10dc_0021 = { + 0x0021, pci_device_10dc_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10dc_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10dc_0022 = { + 0x0022, pci_device_10dc_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10dc_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10dc_10dc = { + 0x10dc, pci_device_10dc_10dc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10dc_10dc, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_10de_0008 = { + 0x0008, pci_device_10de_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0009 = { + 0x0009, pci_device_10de_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0010 = { + 0x0010, pci_device_10de_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0020 = { + 0x0020, pci_device_10de_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0028 = { + 0x0028, pci_device_10de_0028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0028, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0029 = { + 0x0029, pci_device_10de_0029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_002a = { + 0x002a, pci_device_10de_002a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_002a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_002b = { + 0x002b, pci_device_10de_002b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_002b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_002c = { + 0x002c, pci_device_10de_002c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_002c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_002d = { + 0x002d, pci_device_10de_002d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_002d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_002e = { + 0x002e, pci_device_10de_002e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_002e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_002f = { + 0x002f, pci_device_10de_002f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_002f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0060 = { + 0x0060, pci_device_10de_0060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0064 = { + 0x0064, pci_device_10de_0064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0065 = { + 0x0065, pci_device_10de_0065, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0065, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0066 = { + 0x0066, pci_device_10de_0066, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0066, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0067 = { + 0x0067, pci_device_10de_0067, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0067, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0068 = { + 0x0068, pci_device_10de_0068, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0068, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_006a = { + 0x006a, pci_device_10de_006a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_006a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_006b = { + 0x006b, pci_device_10de_006b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_006b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_006e = { + 0x006e, pci_device_10de_006e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_006e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_00a0 = { + 0x00a0, pci_device_10de_00a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_00a0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0100 = { + 0x0100, pci_device_10de_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0101 = { + 0x0101, pci_device_10de_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0103 = { + 0x0103, pci_device_10de_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0110 = { + 0x0110, pci_device_10de_0110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0111 = { + 0x0111, pci_device_10de_0111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0112 = { + 0x0112, pci_device_10de_0112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0113 = { + 0x0113, pci_device_10de_0113, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0113, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0150 = { + 0x0150, pci_device_10de_0150, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0150, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0151 = { + 0x0151, pci_device_10de_0151, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0151, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0152 = { + 0x0152, pci_device_10de_0152, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0152, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0153 = { + 0x0153, pci_device_10de_0153, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0153, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0170 = { + 0x0170, pci_device_10de_0170, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0170, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0171 = { + 0x0171, pci_device_10de_0171, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0171, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0172 = { + 0x0172, pci_device_10de_0172, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0172, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0173 = { + 0x0173, pci_device_10de_0173, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0173, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0174 = { + 0x0174, pci_device_10de_0174, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0174, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0175 = { + 0x0175, pci_device_10de_0175, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0175, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0176 = { + 0x0176, pci_device_10de_0176, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0176, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0178 = { + 0x0178, pci_device_10de_0178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0179 = { + 0x0179, pci_device_10de_0179, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0179, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_017a = { + 0x017a, pci_device_10de_017a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_017a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_017b = { + 0x017b, pci_device_10de_017b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_017b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_017c = { + 0x017c, pci_device_10de_017c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_017c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0181 = { + 0x0181, pci_device_10de_0181, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0181, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0182 = { + 0x0182, pci_device_10de_0182, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0182, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0183 = { + 0x0183, pci_device_10de_0183, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0183, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0188 = { + 0x0188, pci_device_10de_0188, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0188, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_018a = { + 0x018a, pci_device_10de_018a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_018a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_018b = { + 0x018b, pci_device_10de_018b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_018b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01a0 = { + 0x01a0, pci_device_10de_01a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01a0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01a4 = { + 0x01a4, pci_device_10de_01a4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01a4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01ab = { + 0x01ab, pci_device_10de_01ab, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01ab, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01ac = { + 0x01ac, pci_device_10de_01ac, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01ac, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01ad = { + 0x01ad, pci_device_10de_01ad, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01ad, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01b1 = { + 0x01b1, pci_device_10de_01b1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01b1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01b2 = { + 0x01b2, pci_device_10de_01b2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01b2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01b4 = { + 0x01b4, pci_device_10de_01b4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01b4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01b7 = { + 0x01b7, pci_device_10de_01b7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01b7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01b8 = { + 0x01b8, pci_device_10de_01b8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01b8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01bc = { + 0x01bc, pci_device_10de_01bc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01bc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01c1 = { + 0x01c1, pci_device_10de_01c1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01c1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01c2 = { + 0x01c2, pci_device_10de_01c2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01c2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01c3 = { + 0x01c3, pci_device_10de_01c3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01c3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01e8 = { + 0x01e8, pci_device_10de_01e8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01e8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_01f0 = { + 0x01f0, pci_device_10de_01f0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_01f0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0200 = { + 0x0200, pci_device_10de_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0201 = { + 0x0201, pci_device_10de_0201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0202 = { + 0x0202, pci_device_10de_0202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0202, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0203 = { + 0x0203, pci_device_10de_0203, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0203, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0250 = { + 0x0250, pci_device_10de_0250, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0250, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0251 = { + 0x0251, pci_device_10de_0251, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0251, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0252 = { + 0x0252, pci_device_10de_0252, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0252, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0253 = { + 0x0253, pci_device_10de_0253, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0253, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0258 = { + 0x0258, pci_device_10de_0258, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0258, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0259 = { + 0x0259, pci_device_10de_0259, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0259, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_025b = { + 0x025b, pci_device_10de_025b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_025b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0280 = { + 0x0280, pci_device_10de_0280, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0280, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0281 = { + 0x0281, pci_device_10de_0281, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0281, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0282 = { + 0x0282, pci_device_10de_0282, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0282, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0288 = { + 0x0288, pci_device_10de_0288, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0288, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0289 = { + 0x0289, pci_device_10de_0289, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0289, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0300 = { + 0x0300, pci_device_10de_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0301 = { + 0x0301, pci_device_10de_0301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0301, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0302 = { + 0x0302, pci_device_10de_0302, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0302, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0308 = { + 0x0308, pci_device_10de_0308, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0308, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10de_0309 = { + 0x0309, pci_device_10de_0309, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10de_0309, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10df_1ae5 = { + 0x1ae5, pci_device_10df_1ae5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_1ae5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f085 = { + 0xf085, pci_device_10df_f085, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f085, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f095 = { + 0xf095, pci_device_10df_f095, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f095, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f098 = { + 0xf098, pci_device_10df_f098, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f098, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f700 = { + 0xf700, pci_device_10df_f700, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f700, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f800 = { + 0xf800, pci_device_10df_f800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f900 = { + 0xf900, pci_device_10df_f900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10df_f980 = { + 0xf980, pci_device_10df_f980, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10df_f980, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_10e0_5026 = { + 0x5026, pci_device_10e0_5026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e0_5026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e0_5027 = { + 0x5027, pci_device_10e0_5027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e0_5027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e0_5028 = { + 0x5028, pci_device_10e0_5028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e0_5028, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e0_8849 = { + 0x8849, pci_device_10e0_8849, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e0_8849, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e0_8853 = { + 0x8853, pci_device_10e0_8853, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e0_8853, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e0_9128 = { + 0x9128, pci_device_10e0_9128, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e0_9128, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10e1_0391 = { + 0x0391, pci_device_10e1_0391, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e1_0391, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e1_690c = { + 0x690c, pci_device_10e1_690c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e1_690c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e1_dc29 = { + 0xdc29, pci_device_10e1_dc29, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e1_dc29, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10e3_0000 = { + 0x0000, pci_device_10e3_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e3_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e3_0860 = { + 0x0860, pci_device_10e3_0860, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e3_0860, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e3_0862 = { + 0x0862, pci_device_10e3_0862, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e3_0862, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10e8_2011 = { + 0x2011, pci_device_10e8_2011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_2011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_4750 = { + 0x4750, pci_device_10e8_4750, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_4750, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_5920 = { + 0x5920, pci_device_10e8_5920, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_5920, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_8043 = { + 0x8043, pci_device_10e8_8043, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_8043, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_8062 = { + 0x8062, pci_device_10e8_8062, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_8062, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_807d = { + 0x807d, pci_device_10e8_807d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_807d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_8088 = { + 0x8088, pci_device_10e8_8088, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_8088, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_8089 = { + 0x8089, pci_device_10e8_8089, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_8089, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_809c = { + 0x809c, pci_device_10e8_809c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_809c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_80d7 = { + 0x80d7, pci_device_10e8_80d7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_80d7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_80d9 = { + 0x80d9, pci_device_10e8_80d9, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_80d9, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_80da = { + 0x80da, pci_device_10e8_80da, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_80da, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_811a = { + 0x811a, pci_device_10e8_811a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_811a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_8170 = { + 0x8170, pci_device_10e8_8170, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_8170, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10e8_82db = { + 0x82db, pci_device_10e8_82db, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10e8_82db, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_10ea_1680 = { + 0x1680, pci_device_10ea_1680, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_1680, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_1682 = { + 0x1682, pci_device_10ea_1682, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_1682, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_1683 = { + 0x1683, pci_device_10ea_1683, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_1683, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_2000 = { + 0x2000, pci_device_10ea_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_2000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_2010 = { + 0x2010, pci_device_10ea_2010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_2010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_5000 = { + 0x5000, pci_device_10ea_5000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_5000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_5050 = { + 0x5050, pci_device_10ea_5050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_5050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ea_5202 = { + 0x5202, pci_device_10ea_5202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ea_5202, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10eb_0101 = { + 0x0101, pci_device_10eb_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10eb_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10eb_8111 = { + 0x8111, pci_device_10eb_8111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10eb_8111, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10ec_8029 = { + 0x8029, pci_device_10ec_8029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ec_8029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ec_8129 = { + 0x8129, pci_device_10ec_8129, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ec_8129, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ec_8138 = { + 0x8138, pci_device_10ec_8138, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ec_8138, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ec_8139 = { + 0x8139, pci_device_10ec_8139, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ec_8139, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ec_8169 = { + 0x8169, pci_device_10ec_8169, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ec_8169, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ec_8197 = { + 0x8197, pci_device_10ec_8197, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ec_8197, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10ed_7310 = { + 0x7310, pci_device_10ed_7310, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ed_7310, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10ee_3fc0 = { + 0x3fc0, pci_device_10ee_3fc0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ee_3fc0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ee_3fc1 = { + 0x3fc1, pci_device_10ee_3fc1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ee_3fc1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ee_3fc2 = { + 0x3fc2, pci_device_10ee_3fc2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ee_3fc2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ee_3fc3 = { + 0x3fc3, pci_device_10ee_3fc3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ee_3fc3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ee_3fc4 = { + 0x3fc4, pci_device_10ee_3fc4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ee_3fc4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10ee_3fc5 = { + 0x3fc5, pci_device_10ee_3fc5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ee_3fc5, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10ef_8154 = { + 0x8154, pci_device_10ef_8154, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10ef_8154, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10f5_a001 = { + 0xa001, pci_device_10f5_a001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10f5_a001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10fa_000c = { + 0x000c, pci_device_10fa_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10fa_000c, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10fb_186f = { + 0x186f, pci_device_10fb_186f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10fb_186f, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_10fc_0003 = { + 0x0003, pci_device_10fc_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10fc_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_10fc_0005 = { + 0x0005, pci_device_10fc_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_10fc_0005, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1101_1060 = { + 0x1060, pci_device_1101_1060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1101_1060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1101_9100 = { + 0x9100, pci_device_1101_9100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1101_9100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1101_9400 = { + 0x9400, pci_device_1101_9400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1101_9400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1101_9401 = { + 0x9401, pci_device_1101_9401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1101_9401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1101_9500 = { + 0x9500, pci_device_1101_9500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1101_9500, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1102_0002 = { + 0x0002, pci_device_1102_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_0002, +#else + NULL, +#endif + 0x0401 +}; +static const pciDeviceInfo pci_dev_info_1102_0004 = { + 0x0004, pci_device_1102_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_0006 = { + 0x0006, pci_device_1102_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_4001 = { + 0x4001, pci_device_1102_4001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_4001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_7002 = { + 0x7002, pci_device_1102_7002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_7002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_7003 = { + 0x7003, pci_device_1102_7003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_7003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_7004 = { + 0x7004, pci_device_1102_7004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_7004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_8064 = { + 0x8064, pci_device_1102_8064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_8064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1102_8938 = { + 0x8938, pci_device_1102_8938, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1102_8938, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1103_0003 = { + 0x0003, pci_device_1103_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1103_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1103_0004 = { + 0x0004, pci_device_1103_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1103_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1103_0005 = { + 0x0005, pci_device_1103_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1103_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1103_0006 = { + 0x0006, pci_device_1103_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1103_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1103_0007 = { + 0x0007, pci_device_1103_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1103_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1103_0008 = { + 0x0008, pci_device_1103_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1103_0008, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1105_1105 = { + 0x1105, pci_device_1105_1105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1105_1105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1105_8300 = { + 0x8300, pci_device_1105_8300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1105_8300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1105_8400 = { + 0x8400, pci_device_1105_8400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1105_8400, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1106_0102 = { + 0x0102, pci_device_1106_0102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0130 = { + 0x0130, pci_device_1106_0130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0130, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0305 = { + 0x0305, pci_device_1106_0305, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0305, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0391 = { + 0x0391, pci_device_1106_0391, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0391, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0501 = { + 0x0501, pci_device_1106_0501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0505 = { + 0x0505, pci_device_1106_0505, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0505, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0561 = { + 0x0561, pci_device_1106_0561, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0561, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0571 = { + 0x0571, pci_device_1106_0571, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0571, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0576 = { + 0x0576, pci_device_1106_0576, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0576, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0585 = { + 0x0585, pci_device_1106_0585, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0585, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0586 = { + 0x0586, pci_device_1106_0586, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0586, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0595 = { + 0x0595, pci_device_1106_0595, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0595, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0596 = { + 0x0596, pci_device_1106_0596, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0596, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0597 = { + 0x0597, pci_device_1106_0597, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0597, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0598 = { + 0x0598, pci_device_1106_0598, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0598, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0601 = { + 0x0601, pci_device_1106_0601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0605 = { + 0x0605, pci_device_1106_0605, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0605, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0680 = { + 0x0680, pci_device_1106_0680, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0680, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0686 = { + 0x0686, pci_device_1106_0686, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0686, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0691 = { + 0x0691, pci_device_1106_0691, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0691, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0693 = { + 0x0693, pci_device_1106_0693, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0693, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0698 = { + 0x0698, pci_device_1106_0698, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0698, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_0926 = { + 0x0926, pci_device_1106_0926, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_0926, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_1000 = { + 0x1000, pci_device_1106_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_1106 = { + 0x1106, pci_device_1106_1106, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_1106, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_1571 = { + 0x1571, pci_device_1106_1571, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_1571, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_1595 = { + 0x1595, pci_device_1106_1595, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_1595, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3038 = { + 0x3038, pci_device_1106_3038, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3038, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3040 = { + 0x3040, pci_device_1106_3040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3043 = { + 0x3043, pci_device_1106_3043, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3043, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3044 = { + 0x3044, pci_device_1106_3044, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3044, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3050 = { + 0x3050, pci_device_1106_3050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3051 = { + 0x3051, pci_device_1106_3051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3057 = { + 0x3057, pci_device_1106_3057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3058 = { + 0x3058, pci_device_1106_3058, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3058, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3059 = { + 0x3059, pci_device_1106_3059, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3059, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3065 = { + 0x3065, pci_device_1106_3065, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3065, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3068 = { + 0x3068, pci_device_1106_3068, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3068, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3074 = { + 0x3074, pci_device_1106_3074, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3074, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3091 = { + 0x3091, pci_device_1106_3091, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3091, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3099 = { + 0x3099, pci_device_1106_3099, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3099, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3101 = { + 0x3101, pci_device_1106_3101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3102 = { + 0x3102, pci_device_1106_3102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3103 = { + 0x3103, pci_device_1106_3103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3104 = { + 0x3104, pci_device_1106_3104, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3104, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3106 = { + 0x3106, pci_device_1106_3106, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3106, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3109 = { + 0x3109, pci_device_1106_3109, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3109, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3112 = { + 0x3112, pci_device_1106_3112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3116 = { + 0x3116, pci_device_1106_3116, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3116, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3122 = { + 0x3122, pci_device_1106_3122, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3122, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3123 = { + 0x3123, pci_device_1106_3123, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3123, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3128 = { + 0x3128, pci_device_1106_3128, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3128, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3133 = { + 0x3133, pci_device_1106_3133, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3133, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3147 = { + 0x3147, pci_device_1106_3147, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3147, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3148 = { + 0x3148, pci_device_1106_3148, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3148, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3156 = { + 0x3156, pci_device_1106_3156, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3156, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3168 = { + 0x3168, pci_device_1106_3168, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3168, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3177 = { + 0x3177, pci_device_1106_3177, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3177, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_3189 = { + 0x3189, pci_device_1106_3189, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_3189, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_5030 = { + 0x5030, pci_device_1106_5030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_5030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_6100 = { + 0x6100, pci_device_1106_6100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_6100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8231 = { + 0x8231, pci_device_1106_8231, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8231, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8235 = { + 0x8235, pci_device_1106_8235, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8235, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8305 = { + 0x8305, pci_device_1106_8305, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8305, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8391 = { + 0x8391, pci_device_1106_8391, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8391, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8501 = { + 0x8501, pci_device_1106_8501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8596 = { + 0x8596, pci_device_1106_8596, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8596, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8597 = { + 0x8597, pci_device_1106_8597, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8597, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8598 = { + 0x8598, pci_device_1106_8598, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8598, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8601 = { + 0x8601, pci_device_1106_8601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8605 = { + 0x8605, pci_device_1106_8605, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8605, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8691 = { + 0x8691, pci_device_1106_8691, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8691, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_8693 = { + 0x8693, pci_device_1106_8693, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_8693, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b091 = { + 0xb091, pci_device_1106_b091, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b091, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b099 = { + 0xb099, pci_device_1106_b099, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b099, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b101 = { + 0xb101, pci_device_1106_b101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b102 = { + 0xb102, pci_device_1106_b102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b103 = { + 0xb103, pci_device_1106_b103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b112 = { + 0xb112, pci_device_1106_b112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1106_b168 = { + 0xb168, pci_device_1106_b168, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1106_b168, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1107_0576 = { + 0x0576, pci_device_1107_0576, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1107_0576, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1108_0100 = { + 0x0100, pci_device_1108_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_0101 = { + 0x0101, pci_device_1108_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_0105 = { + 0x0105, pci_device_1108_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_0108 = { + 0x0108, pci_device_1108_0108, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_0108, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_0138 = { + 0x0138, pci_device_1108_0138, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_0138, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_0139 = { + 0x0139, pci_device_1108_0139, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_0139, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_013c = { + 0x013c, pci_device_1108_013c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_013c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1108_013d = { + 0x013d, pci_device_1108_013d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1108_013d, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1109_1400 = { + 0x1400, pci_device_1109_1400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1109_1400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_110a_0002 = { + 0x0002, pci_device_110a_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110a_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_110a_0005 = { + 0x0005, pci_device_110a_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110a_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_110a_2102 = { + 0x2102, pci_device_110a_2102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110a_2102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_110a_4942 = { + 0x4942, pci_device_110a_4942, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110a_4942, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_110a_6120 = { + 0x6120, pci_device_110a_6120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110a_6120, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_110b_0001 = { + 0x0001, pci_device_110b_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110b_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_110b_0004 = { + 0x0004, pci_device_110b_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_110b_0004, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1110_6037 = { + 0x6037, pci_device_1110_6037, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1110_6037, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1110_6073 = { + 0x6073, pci_device_1110_6073, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1110_6073, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1112_2200 = { + 0x2200, pci_device_1112_2200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1112_2200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1112_2300 = { + 0x2300, pci_device_1112_2300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1112_2300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1112_2340 = { + 0x2340, pci_device_1112_2340, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1112_2340, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1112_2400 = { + 0x2400, pci_device_1112_2400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1112_2400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1113_1211 = { + 0x1211, pci_device_1113_1211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1113_1211, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1113_1216 = { + 0x1216, pci_device_1113_1216, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1113_1216, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1113_1217 = { + 0x1217, pci_device_1113_1217, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1113_1217, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1113_5105 = { + 0x5105, pci_device_1113_5105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1113_5105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1113_9211 = { + 0x9211, pci_device_1113_9211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1113_9211, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1113_9511 = { + 0x9511, pci_device_1113_9511, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1113_9511, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1116_0022 = { + 0x0022, pci_device_1116_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1116_0023 = { + 0x0023, pci_device_1116_0023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1116_0024 = { + 0x0024, pci_device_1116_0024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1116_0025 = { + 0x0025, pci_device_1116_0025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1116_0026 = { + 0x0026, pci_device_1116_0026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1116_0027 = { + 0x0027, pci_device_1116_0027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1116_0028 = { + 0x0028, pci_device_1116_0028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1116_0028, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1117_9500 = { + 0x9500, pci_device_1117_9500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1117_9500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1117_9501 = { + 0x9501, pci_device_1117_9501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1117_9501, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1119_0000 = { + 0x0000, pci_device_1119_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0001 = { + 0x0001, pci_device_1119_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0002 = { + 0x0002, pci_device_1119_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0003 = { + 0x0003, pci_device_1119_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0004 = { + 0x0004, pci_device_1119_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0005 = { + 0x0005, pci_device_1119_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0006 = { + 0x0006, pci_device_1119_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0007 = { + 0x0007, pci_device_1119_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0008 = { + 0x0008, pci_device_1119_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0009 = { + 0x0009, pci_device_1119_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_000a = { + 0x000a, pci_device_1119_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_000b = { + 0x000b, pci_device_1119_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_000c = { + 0x000c, pci_device_1119_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_000d = { + 0x000d, pci_device_1119_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0100 = { + 0x0100, pci_device_1119_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0101 = { + 0x0101, pci_device_1119_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0102 = { + 0x0102, pci_device_1119_0102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0103 = { + 0x0103, pci_device_1119_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0104 = { + 0x0104, pci_device_1119_0104, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0104, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0105 = { + 0x0105, pci_device_1119_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0110 = { + 0x0110, pci_device_1119_0110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0111 = { + 0x0111, pci_device_1119_0111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0112 = { + 0x0112, pci_device_1119_0112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0113 = { + 0x0113, pci_device_1119_0113, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0113, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0114 = { + 0x0114, pci_device_1119_0114, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0114, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0115 = { + 0x0115, pci_device_1119_0115, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0115, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0118 = { + 0x0118, pci_device_1119_0118, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0118, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0119 = { + 0x0119, pci_device_1119_0119, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0119, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_011a = { + 0x011a, pci_device_1119_011a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_011a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_011b = { + 0x011b, pci_device_1119_011b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_011b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0120 = { + 0x0120, pci_device_1119_0120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0120, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0121 = { + 0x0121, pci_device_1119_0121, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0121, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0122 = { + 0x0122, pci_device_1119_0122, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0122, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0123 = { + 0x0123, pci_device_1119_0123, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0123, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0124 = { + 0x0124, pci_device_1119_0124, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0124, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0125 = { + 0x0125, pci_device_1119_0125, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0125, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0136 = { + 0x0136, pci_device_1119_0136, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0136, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0137 = { + 0x0137, pci_device_1119_0137, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0137, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0138 = { + 0x0138, pci_device_1119_0138, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0138, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0139 = { + 0x0139, pci_device_1119_0139, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0139, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_013a = { + 0x013a, pci_device_1119_013a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_013a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_013b = { + 0x013b, pci_device_1119_013b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_013b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_013c = { + 0x013c, pci_device_1119_013c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_013c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_013d = { + 0x013d, pci_device_1119_013d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_013d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_013e = { + 0x013e, pci_device_1119_013e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_013e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_013f = { + 0x013f, pci_device_1119_013f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_013f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0166 = { + 0x0166, pci_device_1119_0166, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0166, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0167 = { + 0x0167, pci_device_1119_0167, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0167, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0168 = { + 0x0168, pci_device_1119_0168, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0168, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0169 = { + 0x0169, pci_device_1119_0169, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0169, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_016a = { + 0x016a, pci_device_1119_016a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_016a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_016b = { + 0x016b, pci_device_1119_016b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_016b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_016c = { + 0x016c, pci_device_1119_016c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_016c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_016d = { + 0x016d, pci_device_1119_016d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_016d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_016e = { + 0x016e, pci_device_1119_016e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_016e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_016f = { + 0x016f, pci_device_1119_016f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_016f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01d6 = { + 0x01d6, pci_device_1119_01d6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01d6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01d7 = { + 0x01d7, pci_device_1119_01d7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01d7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01f6 = { + 0x01f6, pci_device_1119_01f6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01f6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01f7 = { + 0x01f7, pci_device_1119_01f7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01f7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01fc = { + 0x01fc, pci_device_1119_01fc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01fc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01fd = { + 0x01fd, pci_device_1119_01fd, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01fd, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01fe = { + 0x01fe, pci_device_1119_01fe, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01fe, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_01ff = { + 0x01ff, pci_device_1119_01ff, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_01ff, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0210 = { + 0x0210, pci_device_1119_0210, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0210, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0211 = { + 0x0211, pci_device_1119_0211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0211, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0260 = { + 0x0260, pci_device_1119_0260, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0260, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0261 = { + 0x0261, pci_device_1119_0261, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0261, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1119_0300 = { + 0x0300, pci_device_1119_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1119_0300, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_111a_0000 = { + 0x0000, pci_device_111a_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111a_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_111a_0002 = { + 0x0002, pci_device_111a_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111a_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_111a_0003 = { + 0x0003, pci_device_111a_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111a_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_111a_0005 = { + 0x0005, pci_device_111a_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111a_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_111a_0007 = { + 0x0007, pci_device_111a_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111a_0007, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_111c_0001 = { + 0x0001, pci_device_111c_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111c_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_111d_0001 = { + 0x0001, pci_device_111d_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111d_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_111d_0003 = { + 0x0003, pci_device_111d_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111d_0003, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_111f_4a47 = { + 0x4a47, pci_device_111f_4a47, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111f_4a47, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_111f_5243 = { + 0x5243, pci_device_111f_5243, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_111f_5243, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1127_0200 = { + 0x0200, pci_device_1127_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1127_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1127_0210 = { + 0x0210, pci_device_1127_0210, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1127_0210, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1127_0250 = { + 0x0250, pci_device_1127_0250, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1127_0250, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1127_0300 = { + 0x0300, pci_device_1127_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1127_0300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1127_0310 = { + 0x0310, pci_device_1127_0310, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1127_0310, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1127_0400 = { + 0x0400, pci_device_1127_0400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1127_0400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_112f_0000 = { + 0x0000, pci_device_112f_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_112f_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_112f_0001 = { + 0x0001, pci_device_112f_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_112f_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1131_1561 = { + 0x1561, pci_device_1131_1561, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_1561, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_1562 = { + 0x1562, pci_device_1131_1562, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_1562, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_3400 = { + 0x3400, pci_device_1131_3400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_3400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_7130 = { + 0x7130, pci_device_1131_7130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_7130, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_7133 = { + 0x7133, pci_device_1131_7133, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_7133, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_7134 = { + 0x7134, pci_device_1131_7134, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_7134, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_7135 = { + 0x7135, pci_device_1131_7135, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_7135, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_7145 = { + 0x7145, pci_device_1131_7145, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_7145, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1131_7146 = { + 0x7146, pci_device_1131_7146, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1131_7146, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1133_7901 = { + 0x7901, pci_device_1133_7901, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7901, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7902 = { + 0x7902, pci_device_1133_7902, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7902, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7911 = { + 0x7911, pci_device_1133_7911, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7911, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7912 = { + 0x7912, pci_device_1133_7912, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7912, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7941 = { + 0x7941, pci_device_1133_7941, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7941, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7942 = { + 0x7942, pci_device_1133_7942, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7942, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7943 = { + 0x7943, pci_device_1133_7943, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7943, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_7944 = { + 0x7944, pci_device_1133_7944, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_7944, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_b921 = { + 0xb921, pci_device_1133_b921, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_b921, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_b922 = { + 0xb922, pci_device_1133_b922, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_b922, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_b923 = { + 0xb923, pci_device_1133_b923, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_b923, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e001 = { + 0xe001, pci_device_1133_e001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e002 = { + 0xe002, pci_device_1133_e002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e003 = { + 0xe003, pci_device_1133_e003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e004 = { + 0xe004, pci_device_1133_e004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e005 = { + 0xe005, pci_device_1133_e005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e00b = { + 0xe00b, pci_device_1133_e00b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e00b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e010 = { + 0xe010, pci_device_1133_e010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e012 = { + 0xe012, pci_device_1133_e012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e014 = { + 0xe014, pci_device_1133_e014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1133_e018 = { + 0xe018, pci_device_1133_e018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1133_e018, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1134_0001 = { + 0x0001, pci_device_1134_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1134_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1135_0001 = { + 0x0001, pci_device_1135_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1135_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1138_8905 = { + 0x8905, pci_device_1138_8905, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1138_8905, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1139_0001 = { + 0x0001, pci_device_1139_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1139_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_113c_0000 = { + 0x0000, pci_device_113c_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113c_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113c_0001 = { + 0x0001, pci_device_113c_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113c_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113c_0911 = { + 0x0911, pci_device_113c_0911, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113c_0911, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113c_0912 = { + 0x0912, pci_device_113c_0912, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113c_0912, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113c_0913 = { + 0x0913, pci_device_113c_0913, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113c_0913, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113c_0914 = { + 0x0914, pci_device_113c_0914, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113c_0914, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_113f_0808 = { + 0x0808, pci_device_113f_0808, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_0808, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113f_1010 = { + 0x1010, pci_device_113f_1010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_1010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113f_80c0 = { + 0x80c0, pci_device_113f_80c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_80c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113f_80c4 = { + 0x80c4, pci_device_113f_80c4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_80c4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113f_80c8 = { + 0x80c8, pci_device_113f_80c8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_80c8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113f_8888 = { + 0x8888, pci_device_113f_8888, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_8888, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_113f_9090 = { + 0x9090, pci_device_113f_9090, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_113f_9090, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1142_3210 = { + 0x3210, pci_device_1142_3210, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1142_3210, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1142_6422 = { + 0x6422, pci_device_1142_6422, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1142_6422, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1142_6424 = { + 0x6424, pci_device_1142_6424, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1142_6424, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1142_6425 = { + 0x6425, pci_device_1142_6425, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1142_6425, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1142_643d = { + 0x643d, pci_device_1142_643d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1142_643d, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1144_0001 = { + 0x0001, pci_device_1144_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1144_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1145_8007 = { + 0x8007, pci_device_1145_8007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1145_8007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1145_f007 = { + 0xf007, pci_device_1145_f007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1145_f007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1145_f010 = { + 0xf010, pci_device_1145_f010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1145_f010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1145_f012 = { + 0xf012, pci_device_1145_f012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1145_f012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1145_f013 = { + 0xf013, pci_device_1145_f013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1145_f013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1145_f015 = { + 0xf015, pci_device_1145_f015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1145_f015, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1148_4000 = { + 0x4000, pci_device_1148_4000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1148_4000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1148_4200 = { + 0x4200, pci_device_1148_4200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1148_4200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1148_4300 = { + 0x4300, pci_device_1148_4300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1148_4300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1148_4320 = { + 0x4320, pci_device_1148_4320, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1148_4320, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1148_4400 = { + 0x4400, pci_device_1148_4400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1148_4400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_114a_5579 = { + 0x5579, pci_device_114a_5579, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114a_5579, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114a_5587 = { + 0x5587, pci_device_114a_5587, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114a_5587, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114a_6504 = { + 0x6504, pci_device_114a_6504, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114a_6504, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114a_7587 = { + 0x7587, pci_device_114a_7587, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114a_7587, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_114f_0002 = { + 0x0002, pci_device_114f_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0003 = { + 0x0003, pci_device_114f_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0004 = { + 0x0004, pci_device_114f_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0005 = { + 0x0005, pci_device_114f_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0006 = { + 0x0006, pci_device_114f_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0009 = { + 0x0009, pci_device_114f_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_000a = { + 0x000a, pci_device_114f_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_000c = { + 0x000c, pci_device_114f_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_000d = { + 0x000d, pci_device_114f_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0011 = { + 0x0011, pci_device_114f_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0012 = { + 0x0012, pci_device_114f_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0013 = { + 0x0013, pci_device_114f_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0014 = { + 0x0014, pci_device_114f_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0015 = { + 0x0015, pci_device_114f_0015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0016 = { + 0x0016, pci_device_114f_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0017 = { + 0x0017, pci_device_114f_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_001a = { + 0x001a, pci_device_114f_001a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_001a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_001b = { + 0x001b, pci_device_114f_001b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_001b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_001d = { + 0x001d, pci_device_114f_001d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_001d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0023 = { + 0x0023, pci_device_114f_0023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0024 = { + 0x0024, pci_device_114f_0024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0026 = { + 0x0026, pci_device_114f_0026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0027 = { + 0x0027, pci_device_114f_0027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0034 = { + 0x0034, pci_device_114f_0034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0035 = { + 0x0035, pci_device_114f_0035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0040 = { + 0x0040, pci_device_114f_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0042 = { + 0x0042, pci_device_114f_0042, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0042, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0070 = { + 0x0070, pci_device_114f_0070, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0070, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0071 = { + 0x0071, pci_device_114f_0071, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0071, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0072 = { + 0x0072, pci_device_114f_0072, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0072, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_0073 = { + 0x0073, pci_device_114f_0073, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_0073, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_114f_6001 = { + 0x6001, pci_device_114f_6001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_114f_6001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1158_3011 = { + 0x3011, pci_device_1158_3011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1158_3011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1158_9050 = { + 0x9050, pci_device_1158_9050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1158_9050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1158_9051 = { + 0x9051, pci_device_1158_9051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1158_9051, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1159_0001 = { + 0x0001, pci_device_1159_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1159_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_115d_0003 = { + 0x0003, pci_device_115d_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_0005 = { + 0x0005, pci_device_115d_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_0007 = { + 0x0007, pci_device_115d_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_000b = { + 0x000b, pci_device_115d_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_000c = { + 0x000c, pci_device_115d_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_000f = { + 0x000f, pci_device_115d_000f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_000f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_0101 = { + 0x0101, pci_device_115d_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_115d_0103 = { + 0x0103, pci_device_115d_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_115d_0103, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_1163_0001 = { + 0x0001, pci_device_1163_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1163_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1163_2000 = { + 0x2000, pci_device_1163_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1163_2000, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1165_0001 = { + 0x0001, pci_device_1165_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1165_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1166_0005 = { + 0x0005, pci_device_1166_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0007 = { + 0x0007, pci_device_1166_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0008 = { + 0x0008, pci_device_1166_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0009 = { + 0x0009, pci_device_1166_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0010 = { + 0x0010, pci_device_1166_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0011 = { + 0x0011, pci_device_1166_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0012 = { + 0x0012, pci_device_1166_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0013 = { + 0x0013, pci_device_1166_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0014 = { + 0x0014, pci_device_1166_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0015 = { + 0x0015, pci_device_1166_0015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0016 = { + 0x0016, pci_device_1166_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0017 = { + 0x0017, pci_device_1166_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0200 = { + 0x0200, pci_device_1166_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0201 = { + 0x0201, pci_device_1166_0201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0203 = { + 0x0203, pci_device_1166_0203, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0203, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0211 = { + 0x0211, pci_device_1166_0211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0211, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0212 = { + 0x0212, pci_device_1166_0212, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0212, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0213 = { + 0x0213, pci_device_1166_0213, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0213, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0220 = { + 0x0220, pci_device_1166_0220, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0220, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0221 = { + 0x0221, pci_device_1166_0221, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0221, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0225 = { + 0x0225, pci_device_1166_0225, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0225, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1166_0227 = { + 0x0227, pci_device_1166_0227, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1166_0227, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_116a_6100 = { + 0x6100, pci_device_116a_6100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_116a_6100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_116a_6800 = { + 0x6800, pci_device_116a_6800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_116a_6800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_116a_7100 = { + 0x7100, pci_device_116a_7100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_116a_7100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_116a_7800 = { + 0x7800, pci_device_116a_7800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_116a_7800, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1178_afa1 = { + 0xafa1, pci_device_1178_afa1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1178_afa1, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1179_0103 = { + 0x0103, pci_device_1179_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0404 = { + 0x0404, pci_device_1179_0404, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0404, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0406 = { + 0x0406, pci_device_1179_0406, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0406, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0407 = { + 0x0407, pci_device_1179_0407, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0407, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0601 = { + 0x0601, pci_device_1179_0601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0603 = { + 0x0603, pci_device_1179_0603, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0603, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_060a = { + 0x060a, pci_device_1179_060a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_060a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_060f = { + 0x060f, pci_device_1179_060f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_060f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0617 = { + 0x0617, pci_device_1179_0617, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0617, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0618 = { + 0x0618, pci_device_1179_0618, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0618, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0701 = { + 0x0701, pci_device_1179_0701, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0701, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0804 = { + 0x0804, pci_device_1179_0804, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0804, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0805 = { + 0x0805, pci_device_1179_0805, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0805, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1179_0d01 = { + 0x0d01, pci_device_1179_0d01, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1179_0d01, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1180_0465 = { + 0x0465, pci_device_1180_0465, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0465, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0466 = { + 0x0466, pci_device_1180_0466, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0466, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0475 = { + 0x0475, pci_device_1180_0475, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0475, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0476 = { + 0x0476, pci_device_1180_0476, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0476, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0477 = { + 0x0477, pci_device_1180_0477, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0477, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0478 = { + 0x0478, pci_device_1180_0478, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0478, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0522 = { + 0x0522, pci_device_1180_0522, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0522, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0551 = { + 0x0551, pci_device_1180_0551, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0551, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1180_0552 = { + 0x0552, pci_device_1180_0552, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1180_0552, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1186_0100 = { + 0x0100, pci_device_1186_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1186_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1186_1002 = { + 0x1002, pci_device_1186_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1186_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1186_1300 = { + 0x1300, pci_device_1186_1300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1186_1300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1186_1340 = { + 0x1340, pci_device_1186_1340, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1186_1340, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1186_1561 = { + 0x1561, pci_device_1186_1561, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1186_1561, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1186_4000 = { + 0x4000, pci_device_1186_4000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1186_4000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_118c_0014 = { + 0x0014, pci_device_118c_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118c_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118c_1117 = { + 0x1117, pci_device_118c_1117, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118c_1117, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_118d_0001 = { + 0x0001, pci_device_118d_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0012 = { + 0x0012, pci_device_118d_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0014 = { + 0x0014, pci_device_118d_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0024 = { + 0x0024, pci_device_118d_0024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0044 = { + 0x0044, pci_device_118d_0044, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0044, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0112 = { + 0x0112, pci_device_118d_0112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0114 = { + 0x0114, pci_device_118d_0114, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0114, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0124 = { + 0x0124, pci_device_118d_0124, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0124, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0144 = { + 0x0144, pci_device_118d_0144, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0144, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0212 = { + 0x0212, pci_device_118d_0212, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0212, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0214 = { + 0x0214, pci_device_118d_0214, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0214, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0224 = { + 0x0224, pci_device_118d_0224, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0224, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0244 = { + 0x0244, pci_device_118d_0244, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0244, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0312 = { + 0x0312, pci_device_118d_0312, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0312, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0314 = { + 0x0314, pci_device_118d_0314, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0314, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0324 = { + 0x0324, pci_device_118d_0324, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0324, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_118d_0344 = { + 0x0344, pci_device_118d_0344, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_118d_0344, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1190_c731 = { + 0xc731, pci_device_1190_c731, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1190_c731, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1191_0003 = { + 0x0003, pci_device_1191_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_0004 = { + 0x0004, pci_device_1191_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_0005 = { + 0x0005, pci_device_1191_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_0006 = { + 0x0006, pci_device_1191_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_0007 = { + 0x0007, pci_device_1191_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_0008 = { + 0x0008, pci_device_1191_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_0009 = { + 0x0009, pci_device_1191_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_8002 = { + 0x8002, pci_device_1191_8002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_8002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_8010 = { + 0x8010, pci_device_1191_8010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_8010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_8020 = { + 0x8020, pci_device_1191_8020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_8020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_8030 = { + 0x8030, pci_device_1191_8030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_8030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_8040 = { + 0x8040, pci_device_1191_8040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_8040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1191_8050 = { + 0x8050, pci_device_1191_8050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1191_8050, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1193_0001 = { + 0x0001, pci_device_1193_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1193_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1193_0002 = { + 0x0002, pci_device_1193_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1193_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_119b_1221 = { + 0x1221, pci_device_119b_1221, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_119b_1221, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_119e_0001 = { + 0x0001, pci_device_119e_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_119e_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_119e_0003 = { + 0x0003, pci_device_119e_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_119e_0003, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11a9_4240 = { + 0x4240, pci_device_11a9_4240, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11a9_4240, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11ab_0146 = { + 0x0146, pci_device_11ab_0146, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ab_0146, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11ab_4611 = { + 0x4611, pci_device_11ab_4611, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ab_4611, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11ab_4620 = { + 0x4620, pci_device_11ab_4620, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ab_4620, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11ab_4801 = { + 0x4801, pci_device_11ab_4801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ab_4801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11ab_f003 = { + 0xf003, pci_device_11ab_f003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ab_f003, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11ad_0002 = { + 0x0002, pci_device_11ad_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ad_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11ad_c115 = { + 0xc115, pci_device_11ad_c115, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11ad_c115, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11b0_0002 = { + 0x0002, pci_device_11b0_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11b0_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11b0_0292 = { + 0x0292, pci_device_11b0_0292, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11b0_0292, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11b0_0960 = { + 0x0960, pci_device_11b0_0960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11b0_0960, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11b0_c960 = { + 0xc960, pci_device_11b0_c960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11b0_c960, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11b8_0001 = { + 0x0001, pci_device_11b8_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11b8_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11b9_c0ed = { + 0xc0ed, pci_device_11b9_c0ed, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11b9_c0ed, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11bc_0001 = { + 0x0001, pci_device_11bc_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11bc_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11c1_0440 = { + 0x0440, pci_device_11c1_0440, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0440, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0441 = { + 0x0441, pci_device_11c1_0441, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0441, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0442 = { + 0x0442, pci_device_11c1_0442, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0442, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0443 = { + 0x0443, pci_device_11c1_0443, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0443, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0444 = { + 0x0444, pci_device_11c1_0444, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0444, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0445 = { + 0x0445, pci_device_11c1_0445, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0445, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0446 = { + 0x0446, pci_device_11c1_0446, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0446, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0447 = { + 0x0447, pci_device_11c1_0447, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0447, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0448 = { + 0x0448, pci_device_11c1_0448, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0448, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0449 = { + 0x0449, pci_device_11c1_0449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0449, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_044a = { + 0x044a, pci_device_11c1_044a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_044a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_044b = { + 0x044b, pci_device_11c1_044b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_044b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_044c = { + 0x044c, pci_device_11c1_044c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_044c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_044d = { + 0x044d, pci_device_11c1_044d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_044d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_044e = { + 0x044e, pci_device_11c1_044e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_044e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_044f = { + 0x044f, pci_device_11c1_044f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_044f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0450 = { + 0x0450, pci_device_11c1_0450, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0450, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0451 = { + 0x0451, pci_device_11c1_0451, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0451, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0452 = { + 0x0452, pci_device_11c1_0452, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0452, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0453 = { + 0x0453, pci_device_11c1_0453, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0453, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0454 = { + 0x0454, pci_device_11c1_0454, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0454, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0455 = { + 0x0455, pci_device_11c1_0455, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0455, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0456 = { + 0x0456, pci_device_11c1_0456, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0456, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0457 = { + 0x0457, pci_device_11c1_0457, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0457, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0458 = { + 0x0458, pci_device_11c1_0458, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0458, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0459 = { + 0x0459, pci_device_11c1_0459, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0459, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_045a = { + 0x045a, pci_device_11c1_045a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_045a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_045c = { + 0x045c, pci_device_11c1_045c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_045c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0461 = { + 0x0461, pci_device_11c1_0461, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0461, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0462 = { + 0x0462, pci_device_11c1_0462, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0462, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_0480 = { + 0x0480, pci_device_11c1_0480, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_0480, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_5801 = { + 0x5801, pci_device_11c1_5801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_5801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_5802 = { + 0x5802, pci_device_11c1_5802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_5802, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_5803 = { + 0x5803, pci_device_11c1_5803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_5803, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c1_5811 = { + 0x5811, pci_device_11c1_5811, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c1_5811, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11c8_0658 = { + 0x0658, pci_device_11c8_0658, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c8_0658, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c8_d665 = { + 0xd665, pci_device_11c8_d665, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c8_d665, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c8_d667 = { + 0xd667, pci_device_11c8_d667, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c8_d667, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11c9_0010 = { + 0x0010, pci_device_11c9_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c9_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11c9_0011 = { + 0x0011, pci_device_11c9_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11c9_0011, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11cb_2000 = { + 0x2000, pci_device_11cb_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11cb_2000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11cb_4000 = { + 0x4000, pci_device_11cb_4000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11cb_4000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11cb_8000 = { + 0x8000, pci_device_11cb_8000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11cb_8000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11d1_01f7 = { + 0x01f7, pci_device_11d1_01f7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11d1_01f7, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11d4_1805 = { + 0x1805, pci_device_11d4_1805, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11d4_1805, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11d4_1889 = { + 0x1889, pci_device_11d4_1889, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11d4_1889, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11d5_0115 = { + 0x0115, pci_device_11d5_0115, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11d5_0115, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11d5_0117 = { + 0x0117, pci_device_11d5_0117, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11d5_0117, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11de_6057 = { + 0x6057, pci_device_11de_6057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11de_6057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11de_6120 = { + 0x6120, pci_device_11de_6120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11de_6120, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11e3_5030 = { + 0x5030, pci_device_11e3_5030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11e3_5030, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11f0_4231 = { + 0x4231, pci_device_11f0_4231, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4231, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f0_4232 = { + 0x4232, pci_device_11f0_4232, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4232, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f0_4233 = { + 0x4233, pci_device_11f0_4233, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4233, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f0_4234 = { + 0x4234, pci_device_11f0_4234, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4234, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f0_4235 = { + 0x4235, pci_device_11f0_4235, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4235, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f0_4236 = { + 0x4236, pci_device_11f0_4236, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4236, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f0_4731 = { + 0x4731, pci_device_11f0_4731, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f0_4731, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11f4_2915 = { + 0x2915, pci_device_11f4_2915, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f4_2915, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11f6_0112 = { + 0x0112, pci_device_11f6_0112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f6_0112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f6_0113 = { + 0x0113, pci_device_11f6_0113, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f6_0113, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f6_1401 = { + 0x1401, pci_device_11f6_1401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f6_1401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f6_2011 = { + 0x2011, pci_device_11f6_2011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f6_2011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f6_2201 = { + 0x2201, pci_device_11f6_2201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f6_2201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11f6_9881 = { + 0x9881, pci_device_11f6_9881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f6_9881, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11f8_7375 = { + 0x7375, pci_device_11f8_7375, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11f8_7375, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_11fe_0001 = { + 0x0001, pci_device_11fe_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0002 = { + 0x0002, pci_device_11fe_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0003 = { + 0x0003, pci_device_11fe_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0004 = { + 0x0004, pci_device_11fe_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0005 = { + 0x0005, pci_device_11fe_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0006 = { + 0x0006, pci_device_11fe_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0007 = { + 0x0007, pci_device_11fe_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0008 = { + 0x0008, pci_device_11fe_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_0009 = { + 0x0009, pci_device_11fe_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_000a = { + 0x000a, pci_device_11fe_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_000b = { + 0x000b, pci_device_11fe_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_000c = { + 0x000c, pci_device_11fe_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_11fe_8015 = { + 0x8015, pci_device_11fe_8015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_11fe_8015, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1202_4300 = { + 0x4300, pci_device_1202_4300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1202_4300, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1208_4853 = { + 0x4853, pci_device_1208_4853, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1208_4853, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_120e_0100 = { + 0x0100, pci_device_120e_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0101 = { + 0x0101, pci_device_120e_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0102 = { + 0x0102, pci_device_120e_0102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0103 = { + 0x0103, pci_device_120e_0103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0103, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0104 = { + 0x0104, pci_device_120e_0104, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0104, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0105 = { + 0x0105, pci_device_120e_0105, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0105, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0200 = { + 0x0200, pci_device_120e_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0201 = { + 0x0201, pci_device_120e_0201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0300 = { + 0x0300, pci_device_120e_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0301 = { + 0x0301, pci_device_120e_0301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0301, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0310 = { + 0x0310, pci_device_120e_0310, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0310, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0311 = { + 0x0311, pci_device_120e_0311, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0311, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0320 = { + 0x0320, pci_device_120e_0320, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0320, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0321 = { + 0x0321, pci_device_120e_0321, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0321, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_120e_0400 = { + 0x0400, pci_device_120e_0400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120e_0400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_120f_0001 = { + 0x0001, pci_device_120f_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_120f_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1217_6729 = { + 0x6729, pci_device_1217_6729, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6729, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_673a = { + 0x673a, pci_device_1217_673a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_673a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_6832 = { + 0x6832, pci_device_1217_6832, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6832, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_6836 = { + 0x6836, pci_device_1217_6836, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6836, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_6872 = { + 0x6872, pci_device_1217_6872, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6872, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_6925 = { + 0x6925, pci_device_1217_6925, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6925, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_6933 = { + 0x6933, pci_device_1217_6933, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6933, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1217_6972 = { + 0x6972, pci_device_1217_6972, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1217_6972, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_121a_0001 = { + 0x0001, pci_device_121a_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_121a_0002 = { + 0x0002, pci_device_121a_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_121a_0003 = { + 0x0003, pci_device_121a_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_121a_0004 = { + 0x0004, pci_device_121a_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_121a_0005 = { + 0x0005, pci_device_121a_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_121a_0009 = { + 0x0009, pci_device_121a_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_121a_0057 = { + 0x0057, pci_device_121a_0057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_121a_0057, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1220_1220 = { + 0x1220, pci_device_1220_1220, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1220_1220, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1223_0003 = { + 0x0003, pci_device_1223_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_0004 = { + 0x0004, pci_device_1223_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_0005 = { + 0x0005, pci_device_1223_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_0008 = { + 0x0008, pci_device_1223_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_0009 = { + 0x0009, pci_device_1223_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_000a = { + 0x000a, pci_device_1223_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_000b = { + 0x000b, pci_device_1223_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_000c = { + 0x000c, pci_device_1223_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_000d = { + 0x000d, pci_device_1223_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1223_000e = { + 0x000e, pci_device_1223_000e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1223_000e, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_122d_1206 = { + 0x1206, pci_device_122d_1206, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_122d_1206, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_122d_50dc = { + 0x50dc, pci_device_122d_50dc, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_122d_50dc, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_122d_80da = { + 0x80da, pci_device_122d_80da, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_122d_80da, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1236_0000 = { + 0x0000, pci_device_1236_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1236_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1236_6401 = { + 0x6401, pci_device_1236_6401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1236_6401, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_123d_0000 = { + 0x0000, pci_device_123d_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_123d_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_123d_0002 = { + 0x0002, pci_device_123d_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_123d_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_123d_0003 = { + 0x0003, pci_device_123d_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_123d_0003, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_123f_00e4 = { + 0x00e4, pci_device_123f_00e4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_123f_00e4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_123f_8120 = { + 0x8120, pci_device_123f_8120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_123f_8120, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_123f_8888 = { + 0x8888, pci_device_123f_8888, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_123f_8888, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1242_1560 = { + 0x1560, pci_device_1242_1560, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1242_1560, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1242_4643 = { + 0x4643, pci_device_1242_4643, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1242_4643, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1244_0700 = { + 0x0700, pci_device_1244_0700, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1244_0700, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1244_0800 = { + 0x0800, pci_device_1244_0800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1244_0800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1244_0a00 = { + 0x0a00, pci_device_1244_0a00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1244_0a00, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1244_0e00 = { + 0x0e00, pci_device_1244_0e00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1244_0e00, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1244_1100 = { + 0x1100, pci_device_1244_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1244_1100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1244_1200 = { + 0x1200, pci_device_1244_1200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1244_1200, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_124b_0040 = { + 0x0040, pci_device_124b_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_124b_0040, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_124d_0000 = { + 0x0000, pci_device_124d_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_124d_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_124d_0002 = { + 0x0002, pci_device_124d_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_124d_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_124d_0003 = { + 0x0003, pci_device_124d_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_124d_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_124d_0004 = { + 0x0004, pci_device_124d_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_124d_0004, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_124f_0041 = { + 0x0041, pci_device_124f_0041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_124f_0041, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1255_1110 = { + 0x1110, pci_device_1255_1110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1255_1110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1255_1210 = { + 0x1210, pci_device_1255_1210, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1255_1210, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1255_2110 = { + 0x2110, pci_device_1255_2110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1255_2110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1255_2120 = { + 0x2120, pci_device_1255_2120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1255_2120, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1255_2130 = { + 0x2130, pci_device_1255_2130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1255_2130, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1256_4201 = { + 0x4201, pci_device_1256_4201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1256_4201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1256_4401 = { + 0x4401, pci_device_1256_4401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1256_4401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1256_5201 = { + 0x5201, pci_device_1256_5201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1256_5201, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1259_2560 = { + 0x2560, pci_device_1259_2560, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1259_2560, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_125b_1400 = { + 0x1400, pci_device_125b_1400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125b_1400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_125c_0640 = { + 0x0640, pci_device_125c_0640, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125c_0640, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_125d_0000 = { + 0x0000, pci_device_125d_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1948 = { + 0x1948, pci_device_125d_1948, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1948, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1968 = { + 0x1968, pci_device_125d_1968, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1968, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1969 = { + 0x1969, pci_device_125d_1969, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1969, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1978 = { + 0x1978, pci_device_125d_1978, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1978, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1988 = { + 0x1988, pci_device_125d_1988, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1988, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1989 = { + 0x1989, pci_device_125d_1989, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1989, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1998 = { + 0x1998, pci_device_125d_1998, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1998, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_1999 = { + 0x1999, pci_device_125d_1999, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_1999, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_199a = { + 0x199a, pci_device_125d_199a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_199a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_199b = { + 0x199b, pci_device_125d_199b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_199b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_2808 = { + 0x2808, pci_device_125d_2808, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_2808, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_2838 = { + 0x2838, pci_device_125d_2838, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_2838, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_125d_2898 = { + 0x2898, pci_device_125d_2898, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_125d_2898, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1260_3873 = { + 0x3873, pci_device_1260_3873, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1260_3873, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1260_8130 = { + 0x8130, pci_device_1260_8130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1260_8130, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1260_8131 = { + 0x8131, pci_device_1260_8131, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1260_8131, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1266_0001 = { + 0x0001, pci_device_1266_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1266_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1266_1910 = { + 0x1910, pci_device_1266_1910, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1266_1910, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1267_5352 = { + 0x5352, pci_device_1267_5352, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1267_5352, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1267_5a4b = { + 0x5a4b, pci_device_1267_5a4b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1267_5a4b, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_126f_0710 = { + 0x0710, pci_device_126f_0710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0710, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_126f_0712 = { + 0x0712, pci_device_126f_0712, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0712, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_126f_0720 = { + 0x0720, pci_device_126f_0720, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0720, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_126f_0810 = { + 0x0810, pci_device_126f_0810, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0810, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_126f_0811 = { + 0x0811, pci_device_126f_0811, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0811, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_126f_0820 = { + 0x0820, pci_device_126f_0820, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0820, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_126f_0910 = { + 0x0910, pci_device_126f_0910, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_126f_0910, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1273_0002 = { + 0x0002, pci_device_1273_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1273_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1274_1371 = { + 0x1371, pci_device_1274_1371, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1274_1371, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1274_5000 = { + 0x5000, pci_device_1274_5000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1274_5000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1274_5880 = { + 0x5880, pci_device_1274_5880, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1274_5880, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1278_0701 = { + 0x0701, pci_device_1278_0701, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1278_0701, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1279_0295 = { + 0x0295, pci_device_1279_0295, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1279_0295, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1279_0395 = { + 0x0395, pci_device_1279_0395, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1279_0395, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1279_0396 = { + 0x0396, pci_device_1279_0396, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1279_0396, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1279_0397 = { + 0x0397, pci_device_1279_0397, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1279_0397, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_127a_1002 = { + 0x1002, pci_device_127a_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1003 = { + 0x1003, pci_device_127a_1003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1004 = { + 0x1004, pci_device_127a_1004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1005 = { + 0x1005, pci_device_127a_1005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1022 = { + 0x1022, pci_device_127a_1022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1023 = { + 0x1023, pci_device_127a_1023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1024 = { + 0x1024, pci_device_127a_1024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1025 = { + 0x1025, pci_device_127a_1025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1026 = { + 0x1026, pci_device_127a_1026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1032 = { + 0x1032, pci_device_127a_1032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1033 = { + 0x1033, pci_device_127a_1033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1034 = { + 0x1034, pci_device_127a_1034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1035 = { + 0x1035, pci_device_127a_1035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1036 = { + 0x1036, pci_device_127a_1036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_1085 = { + 0x1085, pci_device_127a_1085, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_1085, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_2005 = { + 0x2005, pci_device_127a_2005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_2005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_2013 = { + 0x2013, pci_device_127a_2013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_2013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_2014 = { + 0x2014, pci_device_127a_2014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_2014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_2015 = { + 0x2015, pci_device_127a_2015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_2015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_2016 = { + 0x2016, pci_device_127a_2016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_2016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_4311 = { + 0x4311, pci_device_127a_4311, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_4311, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_4320 = { + 0x4320, pci_device_127a_4320, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_4320, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_4321 = { + 0x4321, pci_device_127a_4321, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_4321, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_4322 = { + 0x4322, pci_device_127a_4322, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_4322, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_127a_8234 = { + 0x8234, pci_device_127a_8234, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_127a_8234, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1282_9009 = { + 0x9009, pci_device_1282_9009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1282_9009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1282_9100 = { + 0x9100, pci_device_1282_9100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1282_9100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1282_9102 = { + 0x9102, pci_device_1282_9102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1282_9102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1282_9132 = { + 0x9132, pci_device_1282_9132, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1282_9132, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1283_673a = { + 0x673a, pci_device_1283_673a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1283_673a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1283_8330 = { + 0x8330, pci_device_1283_8330, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1283_8330, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1283_8888 = { + 0x8888, pci_device_1283_8888, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1283_8888, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1283_8889 = { + 0x8889, pci_device_1283_8889, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1283_8889, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1283_e886 = { + 0xe886, pci_device_1283_e886, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1283_e886, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1285_0100 = { + 0x0100, pci_device_1285_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1285_0100, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1287_001e = { + 0x001e, pci_device_1287_001e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1287_001e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1287_001f = { + 0x001f, pci_device_1287_001f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1287_001f, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_128d_0021 = { + 0x0021, pci_device_128d_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_128d_0021, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_128e_0008 = { + 0x0008, pci_device_128e_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_128e_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_128e_0009 = { + 0x0009, pci_device_128e_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_128e_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_128e_000a = { + 0x000a, pci_device_128e_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_128e_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_128e_000b = { + 0x000b, pci_device_128e_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_128e_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_128e_000c = { + 0x000c, pci_device_128e_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_128e_000c, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_129a_0615 = { + 0x0615, pci_device_129a_0615, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_129a_0615, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12ab_3000 = { + 0x3000, pci_device_12ab_3000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12ab_3000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12ae_0001 = { + 0x0001, pci_device_12ae_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12ae_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12ae_0002 = { + 0x0002, pci_device_12ae_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12ae_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12b9_1006 = { + 0x1006, pci_device_12b9_1006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12b9_1006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12b9_1007 = { + 0x1007, pci_device_12b9_1007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12b9_1007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12b9_1008 = { + 0x1008, pci_device_12b9_1008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12b9_1008, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12be_3041 = { + 0x3041, pci_device_12be_3041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12be_3041, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12be_3042 = { + 0x3042, pci_device_12be_3042, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12be_3042, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12c3_0058 = { + 0x0058, pci_device_12c3_0058, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c3_0058, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12c3_5598 = { + 0x5598, pci_device_12c3_5598, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c3_5598, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12c5_007e = { + 0x007e, pci_device_12c5_007e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c5_007e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12c5_007f = { + 0x007f, pci_device_12c5_007f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c5_007f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12c5_0081 = { + 0x0081, pci_device_12c5_0081, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c5_0081, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12c5_0085 = { + 0x0085, pci_device_12c5_0085, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c5_0085, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12c5_0086 = { + 0x0086, pci_device_12c5_0086, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12c5_0086, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_12d2_0008 = { + 0x0008, pci_device_12d2_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_0009 = { + 0x0009, pci_device_12d2_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_0018 = { + 0x0018, pci_device_12d2_0018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_0019 = { + 0x0019, pci_device_12d2_0019, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0019, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_0020 = { + 0x0020, pci_device_12d2_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_0028 = { + 0x0028, pci_device_12d2_0028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0028, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_0029 = { + 0x0029, pci_device_12d2_0029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_0029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_002c = { + 0x002c, pci_device_12d2_002c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_002c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12d2_00a0 = { + 0x00a0, pci_device_12d2_00a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12d2_00a0, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12e0_0010 = { + 0x0010, pci_device_12e0_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12e0_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12e0_0020 = { + 0x0020, pci_device_12e0_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12e0_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12e0_0030 = { + 0x0030, pci_device_12e0_0030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12e0_0030, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12eb_0001 = { + 0x0001, pci_device_12eb_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12eb_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12eb_0002 = { + 0x0002, pci_device_12eb_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12eb_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12eb_0003 = { + 0x0003, pci_device_12eb_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12eb_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_12eb_8803 = { + 0x8803, pci_device_12eb_8803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12eb_8803, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_12f8_0002 = { + 0x0002, pci_device_12f8_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_12f8_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1307_0001 = { + 0x0001, pci_device_1307_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_000b = { + 0x000b, pci_device_1307_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_000b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_000c = { + 0x000c, pci_device_1307_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_000d = { + 0x000d, pci_device_1307_000d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_000d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_000f = { + 0x000f, pci_device_1307_000f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_000f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0010 = { + 0x0010, pci_device_1307_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0014 = { + 0x0014, pci_device_1307_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0015 = { + 0x0015, pci_device_1307_0015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0016 = { + 0x0016, pci_device_1307_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0017 = { + 0x0017, pci_device_1307_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0018 = { + 0x0018, pci_device_1307_0018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0018, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0019 = { + 0x0019, pci_device_1307_0019, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0019, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_001a = { + 0x001a, pci_device_1307_001a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_001a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_001b = { + 0x001b, pci_device_1307_001b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_001b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_001c = { + 0x001c, pci_device_1307_001c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_001c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_001d = { + 0x001d, pci_device_1307_001d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_001d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_001e = { + 0x001e, pci_device_1307_001e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_001e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_001f = { + 0x001f, pci_device_1307_001f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_001f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0020 = { + 0x0020, pci_device_1307_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0021 = { + 0x0021, pci_device_1307_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0022 = { + 0x0022, pci_device_1307_0022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0023 = { + 0x0023, pci_device_1307_0023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0024 = { + 0x0024, pci_device_1307_0024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0025 = { + 0x0025, pci_device_1307_0025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0026 = { + 0x0026, pci_device_1307_0026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0027 = { + 0x0027, pci_device_1307_0027, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0027, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0028 = { + 0x0028, pci_device_1307_0028, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0028, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0029 = { + 0x0029, pci_device_1307_0029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_002c = { + 0x002c, pci_device_1307_002c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_002c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0033 = { + 0x0033, pci_device_1307_0033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0034 = { + 0x0034, pci_device_1307_0034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0035 = { + 0x0035, pci_device_1307_0035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0036 = { + 0x0036, pci_device_1307_0036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_0037 = { + 0x0037, pci_device_1307_0037, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_0037, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1307_004c = { + 0x004c, pci_device_1307_004c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1307_004c, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1308_0001 = { + 0x0001, pci_device_1308_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1308_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1317_0981 = { + 0x0981, pci_device_1317_0981, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1317_0981, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1317_0985 = { + 0x0985, pci_device_1317_0985, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1317_0985, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1317_1985 = { + 0x1985, pci_device_1317_1985, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1317_1985, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1318_0911 = { + 0x0911, pci_device_1318_0911, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1318_0911, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1319_0801 = { + 0x0801, pci_device_1319_0801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1319_0801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1319_0802 = { + 0x0802, pci_device_1319_0802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1319_0802, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1319_1000 = { + 0x1000, pci_device_1319_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1319_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1319_1001 = { + 0x1001, pci_device_1319_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1319_1001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_131f_1000 = { + 0x1000, pci_device_131f_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1001 = { + 0x1001, pci_device_131f_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1002 = { + 0x1002, pci_device_131f_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1010 = { + 0x1010, pci_device_131f_1010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1011 = { + 0x1011, pci_device_131f_1011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1012 = { + 0x1012, pci_device_131f_1012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1020 = { + 0x1020, pci_device_131f_1020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1021 = { + 0x1021, pci_device_131f_1021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1030 = { + 0x1030, pci_device_131f_1030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1031 = { + 0x1031, pci_device_131f_1031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1032 = { + 0x1032, pci_device_131f_1032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1034 = { + 0x1034, pci_device_131f_1034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1035 = { + 0x1035, pci_device_131f_1035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1036 = { + 0x1036, pci_device_131f_1036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1050 = { + 0x1050, pci_device_131f_1050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1051 = { + 0x1051, pci_device_131f_1051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_1052 = { + 0x1052, pci_device_131f_1052, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_1052, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2000 = { + 0x2000, pci_device_131f_2000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2001 = { + 0x2001, pci_device_131f_2001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2002 = { + 0x2002, pci_device_131f_2002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2010 = { + 0x2010, pci_device_131f_2010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2011 = { + 0x2011, pci_device_131f_2011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2012 = { + 0x2012, pci_device_131f_2012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2020 = { + 0x2020, pci_device_131f_2020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2021 = { + 0x2021, pci_device_131f_2021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2030 = { + 0x2030, pci_device_131f_2030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2031 = { + 0x2031, pci_device_131f_2031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2032 = { + 0x2032, pci_device_131f_2032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2040 = { + 0x2040, pci_device_131f_2040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2041 = { + 0x2041, pci_device_131f_2041, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2041, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2042 = { + 0x2042, pci_device_131f_2042, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2042, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2050 = { + 0x2050, pci_device_131f_2050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2051 = { + 0x2051, pci_device_131f_2051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2052 = { + 0x2052, pci_device_131f_2052, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2052, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2060 = { + 0x2060, pci_device_131f_2060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2061 = { + 0x2061, pci_device_131f_2061, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2061, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_131f_2062 = { + 0x2062, pci_device_131f_2062, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_131f_2062, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1332_5415 = { + 0x5415, pci_device_1332_5415, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1332_5415, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_134a_0001 = { + 0x0001, pci_device_134a_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134a_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134a_0002 = { + 0x0002, pci_device_134a_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134a_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_134d_7890 = { + 0x7890, pci_device_134d_7890, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7890, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7891 = { + 0x7891, pci_device_134d_7891, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7891, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7892 = { + 0x7892, pci_device_134d_7892, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7892, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7893 = { + 0x7893, pci_device_134d_7893, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7893, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7894 = { + 0x7894, pci_device_134d_7894, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7894, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7895 = { + 0x7895, pci_device_134d_7895, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7895, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7896 = { + 0x7896, pci_device_134d_7896, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7896, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_134d_7897 = { + 0x7897, pci_device_134d_7897, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_134d_7897, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1353_0002 = { + 0x0002, pci_device_1353_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1353_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1353_0003 = { + 0x0003, pci_device_1353_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1353_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1353_0004 = { + 0x0004, pci_device_1353_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1353_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1353_0005 = { + 0x0005, pci_device_1353_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1353_0005, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_135c_0010 = { + 0x0010, pci_device_135c_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0020 = { + 0x0020, pci_device_135c_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0030 = { + 0x0030, pci_device_135c_0030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0040 = { + 0x0040, pci_device_135c_0040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0050 = { + 0x0050, pci_device_135c_0050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0060 = { + 0x0060, pci_device_135c_0060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_00f0 = { + 0x00f0, pci_device_135c_00f0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_00f0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0170 = { + 0x0170, pci_device_135c_0170, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0170, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0180 = { + 0x0180, pci_device_135c_0180, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0180, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_0190 = { + 0x0190, pci_device_135c_0190, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_0190, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_01a0 = { + 0x01a0, pci_device_135c_01a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_01a0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_01b0 = { + 0x01b0, pci_device_135c_01b0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_01b0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135c_01c0 = { + 0x01c0, pci_device_135c_01c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135c_01c0, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_135e_7101 = { + 0x7101, pci_device_135e_7101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_7101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135e_7201 = { + 0x7201, pci_device_135e_7201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_7201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135e_7202 = { + 0x7202, pci_device_135e_7202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_7202, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135e_7401 = { + 0x7401, pci_device_135e_7401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_7401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135e_7402 = { + 0x7402, pci_device_135e_7402, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_7402, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135e_7801 = { + 0x7801, pci_device_135e_7801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_7801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_135e_8001 = { + 0x8001, pci_device_135e_8001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_135e_8001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1385_4100 = { + 0x4100, pci_device_1385_4100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1385_4100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1385_620a = { + 0x620a, pci_device_1385_620a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1385_620a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1385_622a = { + 0x622a, pci_device_1385_622a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1385_622a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1385_630a = { + 0x630a, pci_device_1385_630a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1385_630a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1385_f311 = { + 0xf311, pci_device_1385_f311, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1385_f311, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1389_0001 = { + 0x0001, pci_device_1389_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1389_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1393_1040 = { + 0x1040, pci_device_1393_1040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1393_1040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1393_1680 = { + 0x1680, pci_device_1393_1680, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1393_1680, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1393_2040 = { + 0x2040, pci_device_1393_2040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1393_2040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1393_2180 = { + 0x2180, pci_device_1393_2180, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1393_2180, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1393_3200 = { + 0x3200, pci_device_1393_3200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1393_3200, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1394_0001 = { + 0x0001, pci_device_1394_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1394_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1397_2bd0 = { + 0x2bd0, pci_device_1397_2bd0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1397_2bd0, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_139a_0001 = { + 0x0001, pci_device_139a_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_139a_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_139a_0003 = { + 0x0003, pci_device_139a_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_139a_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_139a_0005 = { + 0x0005, pci_device_139a_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_139a_0005, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13a3_0005 = { + 0x0005, pci_device_13a3_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0006 = { + 0x0006, pci_device_13a3_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0007 = { + 0x0007, pci_device_13a3_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0012 = { + 0x0012, pci_device_13a3_0012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0014 = { + 0x0014, pci_device_13a3_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0016 = { + 0x0016, pci_device_13a3_0016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0017 = { + 0x0017, pci_device_13a3_0017, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0017, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13a3_0018 = { + 0x0018, pci_device_13a3_0018, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a3_0018, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13a8_0158 = { + 0x0158, pci_device_13a8_0158, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13a8_0158, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13c0_0010 = { + 0x0010, pci_device_13c0_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13c0_0010, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13c1_1000 = { + 0x1000, pci_device_13c1_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13c1_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13c1_1001 = { + 0x1001, pci_device_13c1_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13c1_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13c1_1002 = { + 0x1002, pci_device_13c1_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13c1_1002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13d0_2103 = { + 0x2103, pci_device_13d0_2103, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13d0_2103, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13d1_ab02 = { + 0xab02, pci_device_13d1_ab02, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13d1_ab02, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13d1_ab06 = { + 0xab06, pci_device_13d1_ab06, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13d1_ab06, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13df_0001 = { + 0x0001, pci_device_13df_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13df_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13f0_0201 = { + 0x0201, pci_device_13f0_0201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13f0_0201, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13f4_1401 = { + 0x1401, pci_device_13f4_1401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13f4_1401, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13f6_0100 = { + 0x0100, pci_device_13f6_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13f6_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13f6_0101 = { + 0x0101, pci_device_13f6_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13f6_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13f6_0111 = { + 0x0111, pci_device_13f6_0111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13f6_0111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_13f6_0211 = { + 0x0211, pci_device_13f6_0211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13f6_0211, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_13fe_1756 = { + 0x1756, pci_device_13fe_1756, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_13fe_1756, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1400_1401 = { + 0x1401, pci_device_1400_1401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1400_1401, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1407_0100 = { + 0x0100, pci_device_1407_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0101 = { + 0x0101, pci_device_1407_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0102 = { + 0x0102, pci_device_1407_0102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0200 = { + 0x0200, pci_device_1407_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0201 = { + 0x0201, pci_device_1407_0201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0202 = { + 0x0202, pci_device_1407_0202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0202, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0500 = { + 0x0500, pci_device_1407_0500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_0600 = { + 0x0600, pci_device_1407_0600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_0600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_8000 = { + 0x8000, pci_device_1407_8000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_8000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_8001 = { + 0x8001, pci_device_1407_8001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_8001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_8002 = { + 0x8002, pci_device_1407_8002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_8002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_8003 = { + 0x8003, pci_device_1407_8003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_8003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1407_8800 = { + 0x8800, pci_device_1407_8800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1407_8800, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1409_7168 = { + 0x7168, pci_device_1409_7168, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1409_7168, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1412_1712 = { + 0x1712, pci_device_1412_1712, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1412_1712, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1412_1724 = { + 0x1724, pci_device_1412_1724, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1412_1724, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1415_8403 = { + 0x8403, pci_device_1415_8403, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1415_8403, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1415_9501 = { + 0x9501, pci_device_1415_9501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1415_9501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1415_950a = { + 0x950a, pci_device_1415_950a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1415_950a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1415_950b = { + 0x950b, pci_device_1415_950b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1415_950b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1415_9511 = { + 0x9511, pci_device_1415_9511, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1415_9511, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1415_9521 = { + 0x9521, pci_device_1415_9521, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1415_9521, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_144a_7296 = { + 0x7296, pci_device_144a_7296, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_7296, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_7432 = { + 0x7432, pci_device_144a_7432, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_7432, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_7433 = { + 0x7433, pci_device_144a_7433, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_7433, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_7434 = { + 0x7434, pci_device_144a_7434, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_7434, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_7841 = { + 0x7841, pci_device_144a_7841, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_7841, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_8133 = { + 0x8133, pci_device_144a_8133, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_8133, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_8554 = { + 0x8554, pci_device_144a_8554, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_8554, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_9111 = { + 0x9111, pci_device_144a_9111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_9111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_9113 = { + 0x9113, pci_device_144a_9113, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_9113, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_144a_9114 = { + 0x9114, pci_device_144a_9114, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_144a_9114, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_145f_0001 = { + 0x0001, pci_device_145f_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_145f_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_148d_1003 = { + 0x1003, pci_device_148d_1003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_148d_1003, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14af_7102 = { + 0x7102, pci_device_14af_7102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14af_7102, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14b3_0000 = { + 0x0000, pci_device_14b3_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b3_0000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14b5_0200 = { + 0x0200, pci_device_14b5_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0300 = { + 0x0300, pci_device_14b5_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0400 = { + 0x0400, pci_device_14b5_0400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0600 = { + 0x0600, pci_device_14b5_0600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0800 = { + 0x0800, pci_device_14b5_0800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0900 = { + 0x0900, pci_device_14b5_0900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0a00 = { + 0x0a00, pci_device_14b5_0a00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0a00, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b5_0b00 = { + 0x0b00, pci_device_14b5_0b00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b5_0b00, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14b7_0001 = { + 0x0001, pci_device_14b7_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b7_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14b9_0001 = { + 0x0001, pci_device_14b9_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b9_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b9_0340 = { + 0x0340, pci_device_14b9_0340, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b9_0340, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b9_0350 = { + 0x0350, pci_device_14b9_0350, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b9_0350, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b9_4500 = { + 0x4500, pci_device_14b9_4500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b9_4500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b9_4800 = { + 0x4800, pci_device_14b9_4800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b9_4800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14b9_a504 = { + 0xa504, pci_device_14b9_a504, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14b9_a504, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14d2_8001 = { + 0x8001, pci_device_14d2_8001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8002 = { + 0x8002, pci_device_14d2_8002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8010 = { + 0x8010, pci_device_14d2_8010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8011 = { + 0x8011, pci_device_14d2_8011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8020 = { + 0x8020, pci_device_14d2_8020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8021 = { + 0x8021, pci_device_14d2_8021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8040 = { + 0x8040, pci_device_14d2_8040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_8080 = { + 0x8080, pci_device_14d2_8080, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_8080, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_a000 = { + 0xa000, pci_device_14d2_a000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_a000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_a001 = { + 0xa001, pci_device_14d2_a001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_a001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_a003 = { + 0xa003, pci_device_14d2_a003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_a003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_a004 = { + 0xa004, pci_device_14d2_a004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_a004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_a005 = { + 0xa005, pci_device_14d2_a005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_a005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_e001 = { + 0xe001, pci_device_14d2_e001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_e001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_e010 = { + 0xe010, pci_device_14d2_e010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_e010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14d2_e020 = { + 0xe020, pci_device_14d2_e020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14d2_e020, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14db_2120 = { + 0x2120, pci_device_14db_2120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14db_2120, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14dc_0000 = { + 0x0000, pci_device_14dc_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0001 = { + 0x0001, pci_device_14dc_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0002 = { + 0x0002, pci_device_14dc_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0003 = { + 0x0003, pci_device_14dc_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0004 = { + 0x0004, pci_device_14dc_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0005 = { + 0x0005, pci_device_14dc_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0006 = { + 0x0006, pci_device_14dc_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0007 = { + 0x0007, pci_device_14dc_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0008 = { + 0x0008, pci_device_14dc_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_0009 = { + 0x0009, pci_device_14dc_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_000a = { + 0x000a, pci_device_14dc_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14dc_000b = { + 0x000b, pci_device_14dc_000b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14dc_000b, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14e4_1644 = { + 0x1644, pci_device_14e4_1644, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1644, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_1645 = { + 0x1645, pci_device_14e4_1645, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1645, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_1646 = { + 0x1646, pci_device_14e4_1646, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1646, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_1647 = { + 0x1647, pci_device_14e4_1647, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1647, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_1648 = { + 0x1648, pci_device_14e4_1648, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1648, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_164d = { + 0x164d, pci_device_14e4_164d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_164d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_1653 = { + 0x1653, pci_device_14e4_1653, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1653, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_165d = { + 0x165d, pci_device_14e4_165d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_165d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_1696 = { + 0x1696, pci_device_14e4_1696, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_1696, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_16a6 = { + 0x16a6, pci_device_14e4_16a6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_16a6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_16a7 = { + 0x16a7, pci_device_14e4_16a7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_16a7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_16a8 = { + 0x16a8, pci_device_14e4_16a8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_16a8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_16c6 = { + 0x16c6, pci_device_14e4_16c6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_16c6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_16c7 = { + 0x16c7, pci_device_14e4_16c7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_16c7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4210 = { + 0x4210, pci_device_14e4_4210, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4210, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4211 = { + 0x4211, pci_device_14e4_4211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4211, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4212 = { + 0x4212, pci_device_14e4_4212, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4212, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4301 = { + 0x4301, pci_device_14e4_4301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4301, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4401 = { + 0x4401, pci_device_14e4_4401, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4401, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4402 = { + 0x4402, pci_device_14e4_4402, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4402, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4410 = { + 0x4410, pci_device_14e4_4410, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4410, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4411 = { + 0x4411, pci_device_14e4_4411, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4411, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_4412 = { + 0x4412, pci_device_14e4_4412, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_4412, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_5820 = { + 0x5820, pci_device_14e4_5820, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_5820, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14e4_5821 = { + 0x5821, pci_device_14e4_5821, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14e4_5821, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14ea_ab06 = { + 0xab06, pci_device_14ea_ab06, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14ea_ab06, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_14f1_1002 = { + 0x1002, pci_device_14f1_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1003 = { + 0x1003, pci_device_14f1_1003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1004 = { + 0x1004, pci_device_14f1_1004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1005 = { + 0x1005, pci_device_14f1_1005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1006 = { + 0x1006, pci_device_14f1_1006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1022 = { + 0x1022, pci_device_14f1_1022, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1022, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1023 = { + 0x1023, pci_device_14f1_1023, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1023, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1024 = { + 0x1024, pci_device_14f1_1024, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1024, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1025 = { + 0x1025, pci_device_14f1_1025, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1025, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1026 = { + 0x1026, pci_device_14f1_1026, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1026, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1032 = { + 0x1032, pci_device_14f1_1032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1033 = { + 0x1033, pci_device_14f1_1033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1034 = { + 0x1034, pci_device_14f1_1034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1035 = { + 0x1035, pci_device_14f1_1035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1036 = { + 0x1036, pci_device_14f1_1036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1052 = { + 0x1052, pci_device_14f1_1052, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1052, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1053 = { + 0x1053, pci_device_14f1_1053, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1053, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1054 = { + 0x1054, pci_device_14f1_1054, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1054, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1055 = { + 0x1055, pci_device_14f1_1055, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1055, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1056 = { + 0x1056, pci_device_14f1_1056, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1056, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1057 = { + 0x1057, pci_device_14f1_1057, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1057, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1059 = { + 0x1059, pci_device_14f1_1059, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1059, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1063 = { + 0x1063, pci_device_14f1_1063, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1063, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1064 = { + 0x1064, pci_device_14f1_1064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1065 = { + 0x1065, pci_device_14f1_1065, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1065, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1066 = { + 0x1066, pci_device_14f1_1066, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1066, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1433 = { + 0x1433, pci_device_14f1_1433, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1433, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1434 = { + 0x1434, pci_device_14f1_1434, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1434, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1435 = { + 0x1435, pci_device_14f1_1435, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1435, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1436 = { + 0x1436, pci_device_14f1_1436, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1436, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1453 = { + 0x1453, pci_device_14f1_1453, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1453, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1454 = { + 0x1454, pci_device_14f1_1454, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1454, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1455 = { + 0x1455, pci_device_14f1_1455, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1455, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1456 = { + 0x1456, pci_device_14f1_1456, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1456, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1610 = { + 0x1610, pci_device_14f1_1610, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1610, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1611 = { + 0x1611, pci_device_14f1_1611, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1611, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1803 = { + 0x1803, pci_device_14f1_1803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1803, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_1815 = { + 0x1815, pci_device_14f1_1815, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_1815, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2003 = { + 0x2003, pci_device_14f1_2003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2004 = { + 0x2004, pci_device_14f1_2004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2005 = { + 0x2005, pci_device_14f1_2005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2006 = { + 0x2006, pci_device_14f1_2006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2013 = { + 0x2013, pci_device_14f1_2013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2014 = { + 0x2014, pci_device_14f1_2014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2015 = { + 0x2015, pci_device_14f1_2015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2016 = { + 0x2016, pci_device_14f1_2016, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2016, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2043 = { + 0x2043, pci_device_14f1_2043, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2043, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2044 = { + 0x2044, pci_device_14f1_2044, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2044, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2045 = { + 0x2045, pci_device_14f1_2045, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2045, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2046 = { + 0x2046, pci_device_14f1_2046, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2046, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2063 = { + 0x2063, pci_device_14f1_2063, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2063, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2064 = { + 0x2064, pci_device_14f1_2064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2065 = { + 0x2065, pci_device_14f1_2065, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2065, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2066 = { + 0x2066, pci_device_14f1_2066, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2066, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2093 = { + 0x2093, pci_device_14f1_2093, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2093, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2143 = { + 0x2143, pci_device_14f1_2143, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2143, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2144 = { + 0x2144, pci_device_14f1_2144, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2144, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2145 = { + 0x2145, pci_device_14f1_2145, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2145, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2146 = { + 0x2146, pci_device_14f1_2146, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2146, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2163 = { + 0x2163, pci_device_14f1_2163, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2163, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2164 = { + 0x2164, pci_device_14f1_2164, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2164, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2165 = { + 0x2165, pci_device_14f1_2165, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2165, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2166 = { + 0x2166, pci_device_14f1_2166, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2166, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2343 = { + 0x2343, pci_device_14f1_2343, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2343, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2344 = { + 0x2344, pci_device_14f1_2344, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2344, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2345 = { + 0x2345, pci_device_14f1_2345, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2345, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2346 = { + 0x2346, pci_device_14f1_2346, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2346, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2363 = { + 0x2363, pci_device_14f1_2363, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2363, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2364 = { + 0x2364, pci_device_14f1_2364, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2364, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2365 = { + 0x2365, pci_device_14f1_2365, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2365, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2366 = { + 0x2366, pci_device_14f1_2366, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2366, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2443 = { + 0x2443, pci_device_14f1_2443, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2443, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2444 = { + 0x2444, pci_device_14f1_2444, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2444, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2445 = { + 0x2445, pci_device_14f1_2445, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2445, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2446 = { + 0x2446, pci_device_14f1_2446, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2446, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2463 = { + 0x2463, pci_device_14f1_2463, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2463, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2464 = { + 0x2464, pci_device_14f1_2464, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2464, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2465 = { + 0x2465, pci_device_14f1_2465, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2465, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2466 = { + 0x2466, pci_device_14f1_2466, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2466, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_2f00 = { + 0x2f00, pci_device_14f1_2f00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_2f00, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_14f1_8234 = { + 0x8234, pci_device_14f1_8234, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_14f1_8234, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1507_0001 = { + 0x0001, pci_device_1507_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_0002 = { + 0x0002, pci_device_1507_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_0003 = { + 0x0003, pci_device_1507_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_0100 = { + 0x0100, pci_device_1507_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_0431 = { + 0x0431, pci_device_1507_0431, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_0431, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_4801 = { + 0x4801, pci_device_1507_4801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_4801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_4802 = { + 0x4802, pci_device_1507_4802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_4802, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_4803 = { + 0x4803, pci_device_1507_4803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_4803, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1507_4806 = { + 0x4806, pci_device_1507_4806, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1507_4806, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1516_0803 = { + 0x0803, pci_device_1516_0803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1516_0803, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_151a_1002 = { + 0x1002, pci_device_151a_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_151a_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_151a_1004 = { + 0x1004, pci_device_151a_1004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_151a_1004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_151a_1008 = { + 0x1008, pci_device_151a_1008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_151a_1008, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_151f_0000 = { + 0x0000, pci_device_151f_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_151f_0000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1522_0100 = { + 0x0100, pci_device_1522_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1522_0100, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1524_1211 = { + 0x1211, pci_device_1524_1211, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1524_1211, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1524_1225 = { + 0x1225, pci_device_1524_1225, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1524_1225, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1524_1410 = { + 0x1410, pci_device_1524_1410, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1524_1410, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1524_1420 = { + 0x1420, pci_device_1524_1420, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1524_1420, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1543_3052 = { + 0x3052, pci_device_1543_3052, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1543_3052, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1543_4c22 = { + 0x4c22, pci_device_1543_4c22, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1543_4c22, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1571_a001 = { + 0xa001, pci_device_1571_a001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a002 = { + 0xa002, pci_device_1571_a002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a003 = { + 0xa003, pci_device_1571_a003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a004 = { + 0xa004, pci_device_1571_a004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a005 = { + 0xa005, pci_device_1571_a005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a006 = { + 0xa006, pci_device_1571_a006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a007 = { + 0xa007, pci_device_1571_a007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a008 = { + 0xa008, pci_device_1571_a008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a009 = { + 0xa009, pci_device_1571_a009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a00a = { + 0xa00a, pci_device_1571_a00a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a00a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a00b = { + 0xa00b, pci_device_1571_a00b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a00b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a00c = { + 0xa00c, pci_device_1571_a00c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a00c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a00d = { + 0xa00d, pci_device_1571_a00d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a00d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a201 = { + 0xa201, pci_device_1571_a201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a202 = { + 0xa202, pci_device_1571_a202, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a202, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a203 = { + 0xa203, pci_device_1571_a203, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a203, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a204 = { + 0xa204, pci_device_1571_a204, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a204, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a205 = { + 0xa205, pci_device_1571_a205, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a205, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1571_a206 = { + 0xa206, pci_device_1571_a206, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1571_a206, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_157c_8001 = { + 0x8001, pci_device_157c_8001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_157c_8001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1592_0781 = { + 0x0781, pci_device_1592_0781, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0781, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_0782 = { + 0x0782, pci_device_1592_0782, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0782, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_0783 = { + 0x0783, pci_device_1592_0783, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0783, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_0785 = { + 0x0785, pci_device_1592_0785, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0785, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_0786 = { + 0x0786, pci_device_1592_0786, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0786, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_0787 = { + 0x0787, pci_device_1592_0787, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0787, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_0788 = { + 0x0788, pci_device_1592_0788, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_0788, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1592_078a = { + 0x078a, pci_device_1592_078a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1592_078a, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_15a2_0001 = { + 0x0001, pci_device_15a2_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15a2_0001, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_15ad_0710 = { + 0x0710, pci_device_15ad_0710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15ad_0710, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_15b3_5274 = { + 0x5274, pci_device_15b3_5274, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15b3_5274, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_15bc_2929 = { + 0x2929, pci_device_15bc_2929, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15bc_2929, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_15c7_0349 = { + 0x0349, pci_device_15c7_0349, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15c7_0349, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_15dc_0001 = { + 0x0001, pci_device_15dc_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15dc_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_15e8_0130 = { + 0x0130, pci_device_15e8_0130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_15e8_0130, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1619_0400 = { + 0x0400, pci_device_1619_0400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1619_0400, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1619_0440 = { + 0x0440, pci_device_1619_0440, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1619_0440, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1629_1003 = { + 0x1003, pci_device_1629_1003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1629_1003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1629_2002 = { + 0x2002, pci_device_1629_2002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1629_2002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1638_1100 = { + 0x1100, pci_device_1638_1100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1638_1100, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_163c_5449 = { + 0x5449, pci_device_163c_5449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_163c_5449, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_165a_c100 = { + 0xc100, pci_device_165a_c100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_165a_c100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_165a_d200 = { + 0xd200, pci_device_165a_d200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_165a_d200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_165a_d300 = { + 0xd300, pci_device_165a_d300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_165a_d300, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_16ab_1102 = { + 0x1102, pci_device_16ab_1102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_16ab_1102, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_16ec_3685 = { + 0x3685, pci_device_16ec_3685, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_16ec_3685, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_173b_03e8 = { + 0x03e8, pci_device_173b_03e8, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_173b_03e8, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_173b_03ea = { + 0x03ea, pci_device_173b_03ea, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_173b_03ea, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1743_8139 = { + 0x8139, pci_device_1743_8139, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1743_8139, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1796_0001 = { + 0x0001, pci_device_1796_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1796_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1796_0002 = { + 0x0002, pci_device_1796_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1796_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1796_0003 = { + 0x0003, pci_device_1796_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1796_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1796_0004 = { + 0x0004, pci_device_1796_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1796_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1796_0005 = { + 0x0005, pci_device_1796_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1796_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1796_0006 = { + 0x0006, pci_device_1796_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1796_0006, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_17cc_2280 = { + 0x2280, pci_device_17cc_2280, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_17cc_2280, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1813_4000 = { + 0x4000, pci_device_1813_4000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1813_4000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1813_4100 = { + 0x4100, pci_device_1813_4100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1813_4100, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1888_0301 = { + 0x0301, pci_device_1888_0301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1888_0301, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1888_0601 = { + 0x0601, pci_device_1888_0601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1888_0601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1888_0710 = { + 0x0710, pci_device_1888_0710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1888_0710, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1888_0720 = { + 0x0720, pci_device_1888_0720, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1888_0720, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1a08_0000 = { + 0x0000, pci_device_1a08_0000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1a08_0000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1c1c_0001 = { + 0x0001, pci_device_1c1c_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1c1c_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1d44_a400 = { + 0xa400, pci_device_1d44_a400, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1d44_a400, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_1de1_0391 = { + 0x0391, pci_device_1de1_0391, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1de1_0391, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1de1_2020 = { + 0x2020, pci_device_1de1_2020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1de1_2020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1de1_690c = { + 0x690c, pci_device_1de1_690c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1de1_690c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_1de1_dc29 = { + 0xdc29, pci_device_1de1_dc29, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_1de1_dc29, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_2348_2010 = { + 0x2010, pci_device_2348_2010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_2348_2010, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_3388_0013 = { + 0x0013, pci_device_3388_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3388_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3388_0014 = { + 0x0014, pci_device_3388_0014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3388_0014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3388_0021 = { + 0x0021, pci_device_3388_0021, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3388_0021, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3388_8011 = { + 0x8011, pci_device_3388_8011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3388_8011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3388_8012 = { + 0x8012, pci_device_3388_8012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3388_8012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3388_8013 = { + 0x8013, pci_device_3388_8013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3388_8013, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_3d3d_0001 = { + 0x0001, pci_device_3d3d_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0002 = { + 0x0002, pci_device_3d3d_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0003 = { + 0x0003, pci_device_3d3d_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0003, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0004 = { + 0x0004, pci_device_3d3d_0004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0005 = { + 0x0005, pci_device_3d3d_0005, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0005, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0006 = { + 0x0006, pci_device_3d3d_0006, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0006, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0007 = { + 0x0007, pci_device_3d3d_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0008 = { + 0x0008, pci_device_3d3d_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0009 = { + 0x0009, pci_device_3d3d_0009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_000a = { + 0x000a, pci_device_3d3d_000a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_000a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_000c = { + 0x000c, pci_device_3d3d_000c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_000c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_0100 = { + 0x0100, pci_device_3d3d_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_1004 = { + 0x1004, pci_device_3d3d_1004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_1004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_3d04 = { + 0x3d04, pci_device_3d3d_3d04, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_3d04, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_3d3d_ffff = { + 0xffff, pci_device_3d3d_ffff, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_3d3d_ffff, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_0300 = { + 0x0300, pci_device_4005_0300, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_0300, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_0308 = { + 0x0308, pci_device_4005_0308, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_0308, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_0309 = { + 0x0309, pci_device_4005_0309, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_0309, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_1064 = { + 0x1064, pci_device_4005_1064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_1064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2064 = { + 0x2064, pci_device_4005_2064, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2064, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2128 = { + 0x2128, pci_device_4005_2128, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2128, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2301 = { + 0x2301, pci_device_4005_2301, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2301, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2302 = { + 0x2302, pci_device_4005_2302, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2302, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2303 = { + 0x2303, pci_device_4005_2303, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2303, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2364 = { + 0x2364, pci_device_4005_2364, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2364, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2464 = { + 0x2464, pci_device_4005_2464, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2464, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_2501 = { + 0x2501, pci_device_4005_2501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_2501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_4000 = { + 0x4000, pci_device_4005_4000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_4000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4005_4710 = { + 0x4710, pci_device_4005_4710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4005_4710, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_4033_1360 = { + 0x1360, pci_device_4033_1360, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4033_1360, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_416c_0100 = { + 0x0100, pci_device_416c_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_416c_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_416c_0200 = { + 0x0200, pci_device_416c_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_416c_0200, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_4444_0803 = { + 0x0803, pci_device_4444_0803, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4444_0803, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_4916_1960 = { + 0x1960, pci_device_4916_1960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4916_1960, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_4a14_5000 = { + 0x5000, pci_device_4a14_5000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4a14_5000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_4d51_0200 = { + 0x0200, pci_device_4d51_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4d51_0200, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_4ddc_0100 = { + 0x0100, pci_device_4ddc_0100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0801 = { + 0x0801, pci_device_4ddc_0801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0802 = { + 0x0802, pci_device_4ddc_0802, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0802, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0811 = { + 0x0811, pci_device_4ddc_0811, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0811, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0812 = { + 0x0812, pci_device_4ddc_0812, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0812, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0881 = { + 0x0881, pci_device_4ddc_0881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0881, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0882 = { + 0x0882, pci_device_4ddc_0882, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0882, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0891 = { + 0x0891, pci_device_4ddc_0891, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0891, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0892 = { + 0x0892, pci_device_4ddc_0892, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0892, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0901 = { + 0x0901, pci_device_4ddc_0901, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0901, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0902 = { + 0x0902, pci_device_4ddc_0902, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0902, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0903 = { + 0x0903, pci_device_4ddc_0903, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0903, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0904 = { + 0x0904, pci_device_4ddc_0904, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0904, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0b01 = { + 0x0b01, pci_device_4ddc_0b01, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0b01, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0b02 = { + 0x0b02, pci_device_4ddc_0b02, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0b02, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0b03 = { + 0x0b03, pci_device_4ddc_0b03, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0b03, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_4ddc_0b04 = { + 0x0b04, pci_device_4ddc_0b04, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_4ddc_0b04, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5046_1001 = { + 0x1001, pci_device_5046_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5046_1001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5053_2010 = { + 0x2010, pci_device_5053_2010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5053_2010, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5145_3031 = { + 0x3031, pci_device_5145_3031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5145_3031, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5301_0001 = { + 0x0001, pci_device_5301_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5301_0001, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_5333_0551 = { + 0x0551, pci_device_5333_0551, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_0551, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_5631 = { + 0x5631, pci_device_5333_5631, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_5631, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8800 = { + 0x8800, pci_device_5333_8800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8801 = { + 0x8801, pci_device_5333_8801, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8801, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8810 = { + 0x8810, pci_device_5333_8810, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8810, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8811 = { + 0x8811, pci_device_5333_8811, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8811, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8812 = { + 0x8812, pci_device_5333_8812, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8812, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8813 = { + 0x8813, pci_device_5333_8813, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8813, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8814 = { + 0x8814, pci_device_5333_8814, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8814, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8815 = { + 0x8815, pci_device_5333_8815, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8815, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_883d = { + 0x883d, pci_device_5333_883d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_883d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8870 = { + 0x8870, pci_device_5333_8870, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8870, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8880 = { + 0x8880, pci_device_5333_8880, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8880, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8881 = { + 0x8881, pci_device_5333_8881, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8881, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8882 = { + 0x8882, pci_device_5333_8882, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8882, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8883 = { + 0x8883, pci_device_5333_8883, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8883, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88b0 = { + 0x88b0, pci_device_5333_88b0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88b0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88b1 = { + 0x88b1, pci_device_5333_88b1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88b1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88b2 = { + 0x88b2, pci_device_5333_88b2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88b2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88b3 = { + 0x88b3, pci_device_5333_88b3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88b3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88c0 = { + 0x88c0, pci_device_5333_88c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88c1 = { + 0x88c1, pci_device_5333_88c1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88c1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88c2 = { + 0x88c2, pci_device_5333_88c2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88c2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88c3 = { + 0x88c3, pci_device_5333_88c3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88c3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88d0 = { + 0x88d0, pci_device_5333_88d0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88d0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88d1 = { + 0x88d1, pci_device_5333_88d1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88d1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88d2 = { + 0x88d2, pci_device_5333_88d2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88d2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88d3 = { + 0x88d3, pci_device_5333_88d3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88d3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88f0 = { + 0x88f0, pci_device_5333_88f0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88f0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88f1 = { + 0x88f1, pci_device_5333_88f1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88f1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88f2 = { + 0x88f2, pci_device_5333_88f2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88f2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_88f3 = { + 0x88f3, pci_device_5333_88f3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_88f3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8900 = { + 0x8900, pci_device_5333_8900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8901 = { + 0x8901, pci_device_5333_8901, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8901, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8902 = { + 0x8902, pci_device_5333_8902, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8902, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8903 = { + 0x8903, pci_device_5333_8903, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8903, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8904 = { + 0x8904, pci_device_5333_8904, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8904, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8905 = { + 0x8905, pci_device_5333_8905, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8905, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8906 = { + 0x8906, pci_device_5333_8906, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8906, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8907 = { + 0x8907, pci_device_5333_8907, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8907, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8908 = { + 0x8908, pci_device_5333_8908, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8908, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8909 = { + 0x8909, pci_device_5333_8909, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8909, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_890a = { + 0x890a, pci_device_5333_890a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_890a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_890b = { + 0x890b, pci_device_5333_890b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_890b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_890c = { + 0x890c, pci_device_5333_890c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_890c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_890d = { + 0x890d, pci_device_5333_890d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_890d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_890e = { + 0x890e, pci_device_5333_890e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_890e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_890f = { + 0x890f, pci_device_5333_890f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_890f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a01 = { + 0x8a01, pci_device_5333_8a01, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a01, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a10 = { + 0x8a10, pci_device_5333_8a10, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a10, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a13 = { + 0x8a13, pci_device_5333_8a13, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a13, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a20 = { + 0x8a20, pci_device_5333_8a20, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a20, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a21 = { + 0x8a21, pci_device_5333_8a21, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a21, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a22 = { + 0x8a22, pci_device_5333_8a22, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a22, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a23 = { + 0x8a23, pci_device_5333_8a23, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a23, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a25 = { + 0x8a25, pci_device_5333_8a25, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a25, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8a26 = { + 0x8a26, pci_device_5333_8a26, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8a26, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c00 = { + 0x8c00, pci_device_5333_8c00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c00, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c01 = { + 0x8c01, pci_device_5333_8c01, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c01, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c02 = { + 0x8c02, pci_device_5333_8c02, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c02, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c03 = { + 0x8c03, pci_device_5333_8c03, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c03, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c10 = { + 0x8c10, pci_device_5333_8c10, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c10, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c11 = { + 0x8c11, pci_device_5333_8c11, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c11, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c12 = { + 0x8c12, pci_device_5333_8c12, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c12, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c13 = { + 0x8c13, pci_device_5333_8c13, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c13, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c22 = { + 0x8c22, pci_device_5333_8c22, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c22, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c24 = { + 0x8c24, pci_device_5333_8c24, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c24, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c26 = { + 0x8c26, pci_device_5333_8c26, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c26, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c2a = { + 0x8c2a, pci_device_5333_8c2a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c2a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c2b = { + 0x8c2b, pci_device_5333_8c2b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c2b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c2c = { + 0x8c2c, pci_device_5333_8c2c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c2c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c2d = { + 0x8c2d, pci_device_5333_8c2d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c2d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c2e = { + 0x8c2e, pci_device_5333_8c2e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c2e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8c2f = { + 0x8c2f, pci_device_5333_8c2f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8c2f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8d01 = { + 0x8d01, pci_device_5333_8d01, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8d01, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8d02 = { + 0x8d02, pci_device_5333_8d02, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8d02, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8d03 = { + 0x8d03, pci_device_5333_8d03, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8d03, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_8d04 = { + 0x8d04, pci_device_5333_8d04, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_8d04, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_9102 = { + 0x9102, pci_device_5333_9102, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_9102, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_5333_ca00 = { + 0xca00, pci_device_5333_ca00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5333_ca00, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5455_4458 = { + 0x4458, pci_device_5455_4458, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5455_4458, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5544_0001 = { + 0x0001, pci_device_5544_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5544_0001, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_5555_0003 = { + 0x0003, pci_device_5555_0003, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_5555_0003, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_6374_6773 = { + 0x6773, pci_device_6374_6773, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_6374_6773, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_6666_0001 = { + 0x0001, pci_device_6666_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_6666_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_6666_0002 = { + 0x0002, pci_device_6666_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_6666_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_8008_0010 = { + 0x0010, pci_device_8008_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8008_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8008_0011 = { + 0x0011, pci_device_8008_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8008_0011, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_8086_0007 = { + 0x0007, pci_device_8086_0007, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0007, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0008 = { + 0x0008, pci_device_8086_0008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0039 = { + 0x0039, pci_device_8086_0039, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0039, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0122 = { + 0x0122, pci_device_8086_0122, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0122, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0482 = { + 0x0482, pci_device_8086_0482, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0482, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0483 = { + 0x0483, pci_device_8086_0483, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0483, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0484 = { + 0x0484, pci_device_8086_0484, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0484, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0486 = { + 0x0486, pci_device_8086_0486, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0486, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_04a3 = { + 0x04a3, pci_device_8086_04a3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_04a3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_04d0 = { + 0x04d0, pci_device_8086_04d0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_04d0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0600 = { + 0x0600, pci_device_8086_0600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0960 = { + 0x0960, pci_device_8086_0960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0960, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0962 = { + 0x0962, pci_device_8086_0962, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0962, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_0964 = { + 0x0964, pci_device_8086_0964, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_0964, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1000 = { + 0x1000, pci_device_8086_1000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1001 = { + 0x1001, pci_device_8086_1001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1002 = { + 0x1002, pci_device_8086_1002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1002, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1004 = { + 0x1004, pci_device_8086_1004, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1004, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1008 = { + 0x1008, pci_device_8086_1008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1008, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1009 = { + 0x1009, pci_device_8086_1009, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1009, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_100c = { + 0x100c, pci_device_8086_100c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_100c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_100d = { + 0x100d, pci_device_8086_100d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_100d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_100e = { + 0x100e, pci_device_8086_100e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_100e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_100f = { + 0x100f, pci_device_8086_100f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_100f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1010 = { + 0x1010, pci_device_8086_1010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1011 = { + 0x1011, pci_device_8086_1011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1012 = { + 0x1012, pci_device_8086_1012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1015 = { + 0x1015, pci_device_8086_1015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1015, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1029 = { + 0x1029, pci_device_8086_1029, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1029, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1030 = { + 0x1030, pci_device_8086_1030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1031 = { + 0x1031, pci_device_8086_1031, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1031, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1032 = { + 0x1032, pci_device_8086_1032, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1032, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1033 = { + 0x1033, pci_device_8086_1033, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1033, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1034 = { + 0x1034, pci_device_8086_1034, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1034, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1035 = { + 0x1035, pci_device_8086_1035, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1035, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1036 = { + 0x1036, pci_device_8086_1036, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1036, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1037 = { + 0x1037, pci_device_8086_1037, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1037, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1038 = { + 0x1038, pci_device_8086_1038, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1038, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1039 = { + 0x1039, pci_device_8086_1039, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1039, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_103a = { + 0x103a, pci_device_8086_103a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_103a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_103b = { + 0x103b, pci_device_8086_103b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_103b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_103c = { + 0x103c, pci_device_8086_103c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_103c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_103d = { + 0x103d, pci_device_8086_103d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_103d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_103e = { + 0x103e, pci_device_8086_103e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_103e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1040 = { + 0x1040, pci_device_8086_1040, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1040, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1059 = { + 0x1059, pci_device_8086_1059, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1059, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1130 = { + 0x1130, pci_device_8086_1130, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1130, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1131 = { + 0x1131, pci_device_8086_1131, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1131, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1132 = { + 0x1132, pci_device_8086_1132, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1132, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1161 = { + 0x1161, pci_device_8086_1161, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1161, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1162 = { + 0x1162, pci_device_8086_1162, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1162, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1200 = { + 0x1200, pci_device_8086_1200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1209 = { + 0x1209, pci_device_8086_1209, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1209, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1221 = { + 0x1221, pci_device_8086_1221, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1221, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1222 = { + 0x1222, pci_device_8086_1222, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1222, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1223 = { + 0x1223, pci_device_8086_1223, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1223, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1225 = { + 0x1225, pci_device_8086_1225, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1225, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1226 = { + 0x1226, pci_device_8086_1226, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1226, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1227 = { + 0x1227, pci_device_8086_1227, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1227, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1228 = { + 0x1228, pci_device_8086_1228, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1228, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1229 = { + 0x1229, pci_device_8086_1229, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1229, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_122d = { + 0x122d, pci_device_8086_122d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_122d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_122e = { + 0x122e, pci_device_8086_122e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_122e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1230 = { + 0x1230, pci_device_8086_1230, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1230, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1231 = { + 0x1231, pci_device_8086_1231, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1231, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1234 = { + 0x1234, pci_device_8086_1234, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1234, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1235 = { + 0x1235, pci_device_8086_1235, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1235, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1237 = { + 0x1237, pci_device_8086_1237, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1237, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1239 = { + 0x1239, pci_device_8086_1239, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1239, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_123b = { + 0x123b, pci_device_8086_123b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_123b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_123c = { + 0x123c, pci_device_8086_123c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_123c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_123d = { + 0x123d, pci_device_8086_123d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_123d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_123f = { + 0x123f, pci_device_8086_123f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_123f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1240 = { + 0x1240, pci_device_8086_1240, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1240, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_124b = { + 0x124b, pci_device_8086_124b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_124b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1250 = { + 0x1250, pci_device_8086_1250, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1250, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1360 = { + 0x1360, pci_device_8086_1360, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1360, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1361 = { + 0x1361, pci_device_8086_1361, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1361, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1460 = { + 0x1460, pci_device_8086_1460, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1460, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1461 = { + 0x1461, pci_device_8086_1461, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1461, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1462 = { + 0x1462, pci_device_8086_1462, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1462, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1960 = { + 0x1960, pci_device_8086_1960, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1960, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1962 = { + 0x1962, pci_device_8086_1962, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1962, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1a21 = { + 0x1a21, pci_device_8086_1a21, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1a21, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1a23 = { + 0x1a23, pci_device_8086_1a23, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1a23, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1a24 = { + 0x1a24, pci_device_8086_1a24, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1a24, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1a30 = { + 0x1a30, pci_device_8086_1a30, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1a30, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_1a31 = { + 0x1a31, pci_device_8086_1a31, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_1a31, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2410 = { + 0x2410, pci_device_8086_2410, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2410, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2411 = { + 0x2411, pci_device_8086_2411, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2411, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2412 = { + 0x2412, pci_device_8086_2412, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2412, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2413 = { + 0x2413, pci_device_8086_2413, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2413, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2415 = { + 0x2415, pci_device_8086_2415, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2415, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2416 = { + 0x2416, pci_device_8086_2416, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2416, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2418 = { + 0x2418, pci_device_8086_2418, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2418, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2420 = { + 0x2420, pci_device_8086_2420, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2420, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2421 = { + 0x2421, pci_device_8086_2421, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2421, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2422 = { + 0x2422, pci_device_8086_2422, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2422, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2423 = { + 0x2423, pci_device_8086_2423, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2423, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2425 = { + 0x2425, pci_device_8086_2425, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2425, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2426 = { + 0x2426, pci_device_8086_2426, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2426, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2428 = { + 0x2428, pci_device_8086_2428, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2428, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2440 = { + 0x2440, pci_device_8086_2440, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2440, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2442 = { + 0x2442, pci_device_8086_2442, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2442, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2443 = { + 0x2443, pci_device_8086_2443, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2443, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2444 = { + 0x2444, pci_device_8086_2444, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2444, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2445 = { + 0x2445, pci_device_8086_2445, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2445, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2446 = { + 0x2446, pci_device_8086_2446, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2446, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2448 = { + 0x2448, pci_device_8086_2448, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2448, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2449 = { + 0x2449, pci_device_8086_2449, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2449, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_244a = { + 0x244a, pci_device_8086_244a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_244a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_244b = { + 0x244b, pci_device_8086_244b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_244b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_244c = { + 0x244c, pci_device_8086_244c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_244c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_244e = { + 0x244e, pci_device_8086_244e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_244e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2450 = { + 0x2450, pci_device_8086_2450, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2450, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2452 = { + 0x2452, pci_device_8086_2452, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2452, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2453 = { + 0x2453, pci_device_8086_2453, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2453, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2459 = { + 0x2459, pci_device_8086_2459, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2459, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_245b = { + 0x245b, pci_device_8086_245b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_245b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_245d = { + 0x245d, pci_device_8086_245d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_245d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_245e = { + 0x245e, pci_device_8086_245e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_245e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2480 = { + 0x2480, pci_device_8086_2480, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2480, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2482 = { + 0x2482, pci_device_8086_2482, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2482, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2483 = { + 0x2483, pci_device_8086_2483, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2483, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2484 = { + 0x2484, pci_device_8086_2484, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2484, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2485 = { + 0x2485, pci_device_8086_2485, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2485, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2486 = { + 0x2486, pci_device_8086_2486, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2486, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2487 = { + 0x2487, pci_device_8086_2487, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2487, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_248a = { + 0x248a, pci_device_8086_248a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_248a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_248b = { + 0x248b, pci_device_8086_248b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_248b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_248c = { + 0x248c, pci_device_8086_248c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_248c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c0 = { + 0x24c0, pci_device_8086_24c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c2 = { + 0x24c2, pci_device_8086_24c2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c3 = { + 0x24c3, pci_device_8086_24c3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c4 = { + 0x24c4, pci_device_8086_24c4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c5 = { + 0x24c5, pci_device_8086_24c5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c6 = { + 0x24c6, pci_device_8086_24c6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24c7 = { + 0x24c7, pci_device_8086_24c7, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24c7, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24cb = { + 0x24cb, pci_device_8086_24cb, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24cb, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_24cd = { + 0x24cd, pci_device_8086_24cd, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_24cd, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2500 = { + 0x2500, pci_device_8086_2500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2501 = { + 0x2501, pci_device_8086_2501, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2501, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_250b = { + 0x250b, pci_device_8086_250b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_250b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_250f = { + 0x250f, pci_device_8086_250f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_250f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2520 = { + 0x2520, pci_device_8086_2520, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2520, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2521 = { + 0x2521, pci_device_8086_2521, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2521, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2530 = { + 0x2530, pci_device_8086_2530, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2530, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2531 = { + 0x2531, pci_device_8086_2531, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2531, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2532 = { + 0x2532, pci_device_8086_2532, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2532, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2533 = { + 0x2533, pci_device_8086_2533, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2533, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2534 = { + 0x2534, pci_device_8086_2534, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2534, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2540 = { + 0x2540, pci_device_8086_2540, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2540, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2541 = { + 0x2541, pci_device_8086_2541, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2541, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2543 = { + 0x2543, pci_device_8086_2543, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2543, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2544 = { + 0x2544, pci_device_8086_2544, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2544, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2545 = { + 0x2545, pci_device_8086_2545, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2545, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2546 = { + 0x2546, pci_device_8086_2546, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2546, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2547 = { + 0x2547, pci_device_8086_2547, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2547, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2548 = { + 0x2548, pci_device_8086_2548, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2548, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2560 = { + 0x2560, pci_device_8086_2560, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2560, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2561 = { + 0x2561, pci_device_8086_2561, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2561, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2562 = { + 0x2562, pci_device_8086_2562, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2562, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2570 = { + 0x2570, pci_device_8086_2570, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2570, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_2572 = { + 0x2572, pci_device_8086_2572, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_2572, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3092 = { + 0x3092, pci_device_8086_3092, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3092, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3575 = { + 0x3575, pci_device_8086_3575, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3575, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3576 = { + 0x3576, pci_device_8086_3576, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3576, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3577 = { + 0x3577, pci_device_8086_3577, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3577, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3578 = { + 0x3578, pci_device_8086_3578, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3578, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3580 = { + 0x3580, pci_device_8086_3580, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3580, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_3582 = { + 0x3582, pci_device_8086_3582, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_3582, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_5200 = { + 0x5200, pci_device_8086_5200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_5200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_5201 = { + 0x5201, pci_device_8086_5201, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_5201, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_530d = { + 0x530d, pci_device_8086_530d, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_530d, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7000 = { + 0x7000, pci_device_8086_7000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7010 = { + 0x7010, pci_device_8086_7010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7020 = { + 0x7020, pci_device_8086_7020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7030 = { + 0x7030, pci_device_8086_7030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7100 = { + 0x7100, pci_device_8086_7100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7110 = { + 0x7110, pci_device_8086_7110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7111 = { + 0x7111, pci_device_8086_7111, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7111, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7112 = { + 0x7112, pci_device_8086_7112, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7112, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7113 = { + 0x7113, pci_device_8086_7113, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7113, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7120 = { + 0x7120, pci_device_8086_7120, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7120, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7121 = { + 0x7121, pci_device_8086_7121, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7121, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7122 = { + 0x7122, pci_device_8086_7122, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7122, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7123 = { + 0x7123, pci_device_8086_7123, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7123, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7124 = { + 0x7124, pci_device_8086_7124, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7124, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7125 = { + 0x7125, pci_device_8086_7125, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7125, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7126 = { + 0x7126, pci_device_8086_7126, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7126, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7128 = { + 0x7128, pci_device_8086_7128, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7128, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_712a = { + 0x712a, pci_device_8086_712a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_712a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7180 = { + 0x7180, pci_device_8086_7180, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7180, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7181 = { + 0x7181, pci_device_8086_7181, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7181, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7190 = { + 0x7190, pci_device_8086_7190, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7190, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7191 = { + 0x7191, pci_device_8086_7191, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7191, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7192 = { + 0x7192, pci_device_8086_7192, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7192, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7194 = { + 0x7194, pci_device_8086_7194, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7194, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7195 = { + 0x7195, pci_device_8086_7195, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7195, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7196 = { + 0x7196, pci_device_8086_7196, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7196, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7198 = { + 0x7198, pci_device_8086_7198, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7198, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7199 = { + 0x7199, pci_device_8086_7199, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7199, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_719a = { + 0x719a, pci_device_8086_719a, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_719a, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_719b = { + 0x719b, pci_device_8086_719b, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_719b, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_71a0 = { + 0x71a0, pci_device_8086_71a0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_71a0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_71a1 = { + 0x71a1, pci_device_8086_71a1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_71a1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_71a2 = { + 0x71a2, pci_device_8086_71a2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_71a2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7600 = { + 0x7600, pci_device_8086_7600, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7600, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7601 = { + 0x7601, pci_device_8086_7601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7601, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7602 = { + 0x7602, pci_device_8086_7602, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7602, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7603 = { + 0x7603, pci_device_8086_7603, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7603, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_7800 = { + 0x7800, pci_device_8086_7800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_7800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84c4 = { + 0x84c4, pci_device_8086_84c4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84c4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84c5 = { + 0x84c5, pci_device_8086_84c5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84c5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84ca = { + 0x84ca, pci_device_8086_84ca, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84ca, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84cb = { + 0x84cb, pci_device_8086_84cb, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84cb, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84e0 = { + 0x84e0, pci_device_8086_84e0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84e0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84e1 = { + 0x84e1, pci_device_8086_84e1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84e1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84e2 = { + 0x84e2, pci_device_8086_84e2, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84e2, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84e3 = { + 0x84e3, pci_device_8086_84e3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84e3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84e4 = { + 0x84e4, pci_device_8086_84e4, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84e4, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84e6 = { + 0x84e6, pci_device_8086_84e6, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84e6, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_84ea = { + 0x84ea, pci_device_8086_84ea, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_84ea, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_9621 = { + 0x9621, pci_device_8086_9621, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_9621, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_9622 = { + 0x9622, pci_device_8086_9622, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_9622, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_9641 = { + 0x9641, pci_device_8086_9641, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_9641, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_96a1 = { + 0x96a1, pci_device_8086_96a1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_96a1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_b152 = { + 0xb152, pci_device_8086_b152, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_b152, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_b154 = { + 0xb154, pci_device_8086_b154, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_b154, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_b555 = { + 0xb555, pci_device_8086_b555, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_b555, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_8086_ffff = { + 0xffff, pci_device_8086_ffff, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8086_ffff, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_8800_2008 = { + 0x2008, pci_device_8800_2008, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8800_2008, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_8e2e_3000 = { + 0x3000, pci_device_8e2e_3000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_8e2e_3000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_9004_1078 = { + 0x1078, pci_device_9004_1078, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_1078, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_1160 = { + 0x1160, pci_device_9004_1160, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_1160, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_2178 = { + 0x2178, pci_device_9004_2178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_2178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_3860 = { + 0x3860, pci_device_9004_3860, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_3860, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_3b78 = { + 0x3b78, pci_device_9004_3b78, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_3b78, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5075 = { + 0x5075, pci_device_9004_5075, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5075, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5078 = { + 0x5078, pci_device_9004_5078, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5078, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5175 = { + 0x5175, pci_device_9004_5175, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5175, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5178 = { + 0x5178, pci_device_9004_5178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5275 = { + 0x5275, pci_device_9004_5275, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5275, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5278 = { + 0x5278, pci_device_9004_5278, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5278, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5375 = { + 0x5375, pci_device_9004_5375, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5375, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5378 = { + 0x5378, pci_device_9004_5378, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5378, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5475 = { + 0x5475, pci_device_9004_5475, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5475, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5478 = { + 0x5478, pci_device_9004_5478, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5478, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5575 = { + 0x5575, pci_device_9004_5575, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5575, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5578 = { + 0x5578, pci_device_9004_5578, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5578, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5647 = { + 0x5647, pci_device_9004_5647, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5647, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5675 = { + 0x5675, pci_device_9004_5675, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5675, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5678 = { + 0x5678, pci_device_9004_5678, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5678, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5775 = { + 0x5775, pci_device_9004_5775, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5775, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5778 = { + 0x5778, pci_device_9004_5778, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5778, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5800 = { + 0x5800, pci_device_9004_5800, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5800, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5900 = { + 0x5900, pci_device_9004_5900, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5900, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_5905 = { + 0x5905, pci_device_9004_5905, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_5905, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6038 = { + 0x6038, pci_device_9004_6038, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6038, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6075 = { + 0x6075, pci_device_9004_6075, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6075, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6078 = { + 0x6078, pci_device_9004_6078, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6078, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6178 = { + 0x6178, pci_device_9004_6178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6278 = { + 0x6278, pci_device_9004_6278, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6278, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6378 = { + 0x6378, pci_device_9004_6378, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6378, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6478 = { + 0x6478, pci_device_9004_6478, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6478, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6578 = { + 0x6578, pci_device_9004_6578, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6578, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6678 = { + 0x6678, pci_device_9004_6678, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6678, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6778 = { + 0x6778, pci_device_9004_6778, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6778, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_6915 = { + 0x6915, pci_device_9004_6915, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_6915, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7078 = { + 0x7078, pci_device_9004_7078, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7078, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7178 = { + 0x7178, pci_device_9004_7178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7278 = { + 0x7278, pci_device_9004_7278, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7278, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7378 = { + 0x7378, pci_device_9004_7378, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7378, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7478 = { + 0x7478, pci_device_9004_7478, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7478, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7578 = { + 0x7578, pci_device_9004_7578, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7578, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7678 = { + 0x7678, pci_device_9004_7678, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7678, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7778 = { + 0x7778, pci_device_9004_7778, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7778, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7810 = { + 0x7810, pci_device_9004_7810, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7810, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7815 = { + 0x7815, pci_device_9004_7815, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7815, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7850 = { + 0x7850, pci_device_9004_7850, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7850, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7855 = { + 0x7855, pci_device_9004_7855, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7855, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7860 = { + 0x7860, pci_device_9004_7860, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7860, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7870 = { + 0x7870, pci_device_9004_7870, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7870, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7871 = { + 0x7871, pci_device_9004_7871, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7871, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7872 = { + 0x7872, pci_device_9004_7872, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7872, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7873 = { + 0x7873, pci_device_9004_7873, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7873, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7874 = { + 0x7874, pci_device_9004_7874, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7874, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7880 = { + 0x7880, pci_device_9004_7880, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7880, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7890 = { + 0x7890, pci_device_9004_7890, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7890, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7891 = { + 0x7891, pci_device_9004_7891, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7891, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7892 = { + 0x7892, pci_device_9004_7892, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7892, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7893 = { + 0x7893, pci_device_9004_7893, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7893, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7894 = { + 0x7894, pci_device_9004_7894, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7894, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7895 = { + 0x7895, pci_device_9004_7895, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7895, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7896 = { + 0x7896, pci_device_9004_7896, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7896, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_7897 = { + 0x7897, pci_device_9004_7897, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_7897, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8078 = { + 0x8078, pci_device_9004_8078, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8078, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8178 = { + 0x8178, pci_device_9004_8178, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8178, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8278 = { + 0x8278, pci_device_9004_8278, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8278, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8378 = { + 0x8378, pci_device_9004_8378, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8378, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8478 = { + 0x8478, pci_device_9004_8478, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8478, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8578 = { + 0x8578, pci_device_9004_8578, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8578, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8678 = { + 0x8678, pci_device_9004_8678, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8678, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8778 = { + 0x8778, pci_device_9004_8778, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8778, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8878 = { + 0x8878, pci_device_9004_8878, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8878, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_8b78 = { + 0x8b78, pci_device_9004_8b78, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_8b78, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9004_ec78 = { + 0xec78, pci_device_9004_ec78, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9004_ec78, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_9005_0010 = { + 0x0010, pci_device_9005_0010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0011 = { + 0x0011, pci_device_9005_0011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0013 = { + 0x0013, pci_device_9005_0013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_001f = { + 0x001f, pci_device_9005_001f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_001f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0020 = { + 0x0020, pci_device_9005_0020, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0020, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_002f = { + 0x002f, pci_device_9005_002f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_002f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0030 = { + 0x0030, pci_device_9005_0030, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0030, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_003f = { + 0x003f, pci_device_9005_003f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_003f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0050 = { + 0x0050, pci_device_9005_0050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0051 = { + 0x0051, pci_device_9005_0051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0053 = { + 0x0053, pci_device_9005_0053, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0053, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_005f = { + 0x005f, pci_device_9005_005f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_005f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0080 = { + 0x0080, pci_device_9005_0080, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0080, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0081 = { + 0x0081, pci_device_9005_0081, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0081, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0083 = { + 0x0083, pci_device_9005_0083, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0083, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_008f = { + 0x008f, pci_device_9005_008f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_008f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_00c0 = { + 0x00c0, pci_device_9005_00c0, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_00c0, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_00c1 = { + 0x00c1, pci_device_9005_00c1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_00c1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_00c3 = { + 0x00c3, pci_device_9005_00c3, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_00c3, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_00c5 = { + 0x00c5, pci_device_9005_00c5, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_00c5, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_00cf = { + 0x00cf, pci_device_9005_00cf, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_00cf, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0250 = { + 0x0250, pci_device_9005_0250, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0250, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_0285 = { + 0x0285, pci_device_9005_0285, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_0285, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8000 = { + 0x8000, pci_device_9005_8000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8000, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_800f = { + 0x800f, pci_device_9005_800f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_800f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8010 = { + 0x8010, pci_device_9005_8010, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8010, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8011 = { + 0x8011, pci_device_9005_8011, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8011, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8012 = { + 0x8012, pci_device_9005_8012, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8012, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8013 = { + 0x8013, pci_device_9005_8013, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8013, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8014 = { + 0x8014, pci_device_9005_8014, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8014, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_801e = { + 0x801e, pci_device_9005_801e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_801e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_801f = { + 0x801f, pci_device_9005_801f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_801f, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8090 = { + 0x8090, pci_device_9005_8090, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8090, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8091 = { + 0x8091, pci_device_9005_8091, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8091, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8092 = { + 0x8092, pci_device_9005_8092, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8092, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8093 = { + 0x8093, pci_device_9005_8093, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8093, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_8094 = { + 0x8094, pci_device_9005_8094, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_8094, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_809e = { + 0x809e, pci_device_9005_809e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_809e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9005_809f = { + 0x809f, pci_device_9005_809f, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9005_809f, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_907f_2015 = { + 0x2015, pci_device_907f_2015, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_907f_2015, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_9412_6565 = { + 0x6565, pci_device_9412_6565, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9412_6565, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_9699_6565 = { + 0x6565, pci_device_9699_6565, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9699_6565, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_9710_9815 = { + 0x9815, pci_device_9710_9815, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9710_9815, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_9710_9835 = { + 0x9835, pci_device_9710_9835, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_9710_9835, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_cddd_0101 = { + 0x0101, pci_device_cddd_0101, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_cddd_0101, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_cddd_0200 = { + 0x0200, pci_device_cddd_0200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_cddd_0200, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_d4d4_0601 = { + 0x0601, pci_device_d4d4_0601, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_d4d4_0601, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_e000_e000 = { + 0xe000, pci_device_e000_e000, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_e000_e000, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_e159_0001 = { + 0x0001, pci_device_e159_0001, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_e159_0001, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_e159_0002 = { + 0x0002, pci_device_e159_0002, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_e159_0002, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_ea60_9896 = { + 0x9896, pci_device_ea60_9896, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ea60_9896, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ea60_9897 = { + 0x9897, pci_device_ea60_9897, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ea60_9897, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ea60_9898 = { + 0x9898, pci_device_ea60_9898, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ea60_9898, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_eace_3100 = { + 0x3100, pci_device_eace_3100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_3100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_3200 = { + 0x3200, pci_device_eace_3200, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_3200, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_320e = { + 0x320e, pci_device_eace_320e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_320e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_340e = { + 0x340e, pci_device_eace_340e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_340e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_341e = { + 0x341e, pci_device_eace_341e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_341e, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_3500 = { + 0x3500, pci_device_eace_3500, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_3500, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_351c = { + 0x351c, pci_device_eace_351c, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_351c, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_4100 = { + 0x4100, pci_device_eace_4100, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_4100, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_4110 = { + 0x4110, pci_device_eace_4110, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_4110, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_4220 = { + 0x4220, pci_device_eace_4220, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_4220, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_eace_422e = { + 0x422e, pci_device_eace_422e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_eace_422e, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_ec80_ec00 = { + 0xec00, pci_device_ec80_ec00, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ec80_ec00, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_ecc0_0050 = { + 0x0050, pci_device_ecc0_0050, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0050, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ecc0_0051 = { + 0x0051, pci_device_ecc0_0051, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0051, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ecc0_0060 = { + 0x0060, pci_device_ecc0_0060, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0060, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ecc0_0070 = { + 0x0070, pci_device_ecc0_0070, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0070, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ecc0_0071 = { + 0x0071, pci_device_ecc0_0071, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0071, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ecc0_0072 = { + 0x0072, pci_device_ecc0_0072, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0072, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_ecc0_0080 = { + 0x0080, pci_device_ecc0_0080, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_ecc0_0080, +#else + NULL, +#endif + 0 +}; +#endif +static const pciDeviceInfo pci_dev_info_edd8_a091 = { + 0xa091, pci_device_edd8_a091, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_edd8_a091, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_edd8_a099 = { + 0xa099, pci_device_edd8_a099, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_edd8_a099, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_edd8_a0a1 = { + 0xa0a1, pci_device_edd8_a0a1, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_edd8_a0a1, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_edd8_a0a9 = { + 0xa0a9, pci_device_edd8_a0a9, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_edd8_a0a9, +#else + NULL, +#endif + 0 +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_f1d0_cafe = { + 0xcafe, pci_device_f1d0_cafe, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_f1d0_cafe, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_f1d0_efac = { + 0xefac, pci_device_f1d0_efac, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_f1d0_efac, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_f1d0_facd = { + 0xfacd, pci_device_f1d0_facd, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_f1d0_facd, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_feda_a0fa = { + 0xa0fa, pci_device_feda_a0fa, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_feda_a0fa, +#else + NULL, +#endif + 0 +}; +static const pciDeviceInfo pci_dev_info_feda_a10e = { + 0xa10e, pci_device_feda_a10e, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_feda_a10e, +#else + NULL, +#endif + 0 +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo pci_dev_info_fffe_0710 = { + 0x0710, pci_device_fffe_0710, +#ifdef INIT_SUBSYS_INFO + pci_ss_list_fffe_0710, +#else + NULL, +#endif + 0 +}; +#endif +#define pci_dev_list_0000 NULL +#define pci_dev_list_001a NULL +#define pci_dev_list_0033 NULL +#define pci_dev_list_003d NULL +#define pci_dev_list_0059 NULL +#define pci_dev_list_0070 NULL +#define pci_dev_list_0100 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_0675[] = { + &pci_dev_info_0675_1700, + &pci_dev_info_0675_1702, + NULL +}; +#endif +#define pci_dev_list_0925 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_09c1[] = { + &pci_dev_info_09c1_0704, + NULL +}; +#endif +#define pci_dev_list_0a89 NULL +static const pciDeviceInfo *pci_dev_list_0e11[] = { + &pci_dev_info_0e11_0001, + &pci_dev_info_0e11_0002, + &pci_dev_info_0e11_0049, + &pci_dev_info_0e11_004a, + &pci_dev_info_0e11_0508, + &pci_dev_info_0e11_1000, + &pci_dev_info_0e11_2000, + &pci_dev_info_0e11_3032, + &pci_dev_info_0e11_3033, + &pci_dev_info_0e11_3034, + &pci_dev_info_0e11_4000, + &pci_dev_info_0e11_6010, + &pci_dev_info_0e11_7020, + &pci_dev_info_0e11_a0ec, + &pci_dev_info_0e11_a0f0, + &pci_dev_info_0e11_a0f3, + &pci_dev_info_0e11_a0f7, + &pci_dev_info_0e11_a0f8, + &pci_dev_info_0e11_a0fc, + &pci_dev_info_0e11_ae10, + &pci_dev_info_0e11_ae29, + &pci_dev_info_0e11_ae2a, + &pci_dev_info_0e11_ae2b, + &pci_dev_info_0e11_ae31, + &pci_dev_info_0e11_ae32, + &pci_dev_info_0e11_ae33, + &pci_dev_info_0e11_ae34, + &pci_dev_info_0e11_ae35, + &pci_dev_info_0e11_ae40, + &pci_dev_info_0e11_ae43, + &pci_dev_info_0e11_ae69, + &pci_dev_info_0e11_ae6c, + &pci_dev_info_0e11_ae6d, + &pci_dev_info_0e11_b011, + &pci_dev_info_0e11_b012, + &pci_dev_info_0e11_b01e, + &pci_dev_info_0e11_b01f, + &pci_dev_info_0e11_b02f, + &pci_dev_info_0e11_b030, + &pci_dev_info_0e11_b04a, + &pci_dev_info_0e11_b060, + &pci_dev_info_0e11_b0c6, + &pci_dev_info_0e11_b0c7, + &pci_dev_info_0e11_b0d7, + &pci_dev_info_0e11_b0dd, + &pci_dev_info_0e11_b0de, + &pci_dev_info_0e11_b0df, + &pci_dev_info_0e11_b0e0, + &pci_dev_info_0e11_b0e1, + &pci_dev_info_0e11_b123, + &pci_dev_info_0e11_b134, + &pci_dev_info_0e11_b13c, + &pci_dev_info_0e11_b144, + &pci_dev_info_0e11_b163, + &pci_dev_info_0e11_b164, + &pci_dev_info_0e11_b178, + &pci_dev_info_0e11_b1a4, + &pci_dev_info_0e11_f130, + &pci_dev_info_0e11_f150, + NULL +}; +#define pci_dev_list_0e55 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1000[] = { + &pci_dev_info_1000_0001, + &pci_dev_info_1000_0002, + &pci_dev_info_1000_0003, + &pci_dev_info_1000_0004, + &pci_dev_info_1000_0005, + &pci_dev_info_1000_0006, + &pci_dev_info_1000_000a, + &pci_dev_info_1000_000b, + &pci_dev_info_1000_000c, + &pci_dev_info_1000_000d, + &pci_dev_info_1000_000f, + &pci_dev_info_1000_0010, + &pci_dev_info_1000_0012, + &pci_dev_info_1000_0013, + &pci_dev_info_1000_0020, + &pci_dev_info_1000_0021, + &pci_dev_info_1000_0030, + &pci_dev_info_1000_0040, + &pci_dev_info_1000_008f, + &pci_dev_info_1000_0621, + &pci_dev_info_1000_0622, + &pci_dev_info_1000_0623, + &pci_dev_info_1000_0624, + &pci_dev_info_1000_0625, + &pci_dev_info_1000_0626, + &pci_dev_info_1000_0627, + &pci_dev_info_1000_0628, + &pci_dev_info_1000_0629, + &pci_dev_info_1000_0701, + &pci_dev_info_1000_0702, + &pci_dev_info_1000_0901, + &pci_dev_info_1000_1000, + &pci_dev_info_1000_1960, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1001[] = { + &pci_dev_info_1001_0010, + &pci_dev_info_1001_0011, + &pci_dev_info_1001_0012, + &pci_dev_info_1001_0013, + &pci_dev_info_1001_0014, + &pci_dev_info_1001_0015, + &pci_dev_info_1001_0016, + &pci_dev_info_1001_0017, + &pci_dev_info_1001_9100, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_1002[] = { + &pci_dev_info_1002_4144, + &pci_dev_info_1002_4145, + &pci_dev_info_1002_4146, + &pci_dev_info_1002_4147, + &pci_dev_info_1002_4158, + &pci_dev_info_1002_4242, + &pci_dev_info_1002_4336, + &pci_dev_info_1002_4337, + &pci_dev_info_1002_4354, + &pci_dev_info_1002_4358, + &pci_dev_info_1002_4554, + &pci_dev_info_1002_4654, + &pci_dev_info_1002_4742, + &pci_dev_info_1002_4744, + &pci_dev_info_1002_4747, + &pci_dev_info_1002_4749, + &pci_dev_info_1002_474c, + &pci_dev_info_1002_474d, + &pci_dev_info_1002_474e, + &pci_dev_info_1002_474f, + &pci_dev_info_1002_4750, + &pci_dev_info_1002_4751, + &pci_dev_info_1002_4752, + &pci_dev_info_1002_4753, + &pci_dev_info_1002_4754, + &pci_dev_info_1002_4755, + &pci_dev_info_1002_4756, + &pci_dev_info_1002_4757, + &pci_dev_info_1002_4758, + &pci_dev_info_1002_4759, + &pci_dev_info_1002_475a, + &pci_dev_info_1002_4964, + &pci_dev_info_1002_4965, + &pci_dev_info_1002_4966, + &pci_dev_info_1002_4967, + &pci_dev_info_1002_496e, + &pci_dev_info_1002_4c42, + &pci_dev_info_1002_4c44, + &pci_dev_info_1002_4c45, + &pci_dev_info_1002_4c46, + &pci_dev_info_1002_4c47, + &pci_dev_info_1002_4c49, + &pci_dev_info_1002_4c4d, + &pci_dev_info_1002_4c4e, + &pci_dev_info_1002_4c50, + &pci_dev_info_1002_4c51, + &pci_dev_info_1002_4c52, + &pci_dev_info_1002_4c53, + &pci_dev_info_1002_4c54, + &pci_dev_info_1002_4c57, + &pci_dev_info_1002_4c58, + &pci_dev_info_1002_4c59, + &pci_dev_info_1002_4c5a, + &pci_dev_info_1002_4c64, + &pci_dev_info_1002_4c65, + &pci_dev_info_1002_4c66, + &pci_dev_info_1002_4c67, + &pci_dev_info_1002_4d46, + &pci_dev_info_1002_4d4c, + &pci_dev_info_1002_4e44, + &pci_dev_info_1002_4e45, + &pci_dev_info_1002_4e46, + &pci_dev_info_1002_4e47, + &pci_dev_info_1002_4e64, + &pci_dev_info_1002_4e65, + &pci_dev_info_1002_4e66, + &pci_dev_info_1002_4e67, + &pci_dev_info_1002_5041, + &pci_dev_info_1002_5042, + &pci_dev_info_1002_5043, + &pci_dev_info_1002_5044, + &pci_dev_info_1002_5045, + &pci_dev_info_1002_5046, + &pci_dev_info_1002_5047, + &pci_dev_info_1002_5048, + &pci_dev_info_1002_5049, + &pci_dev_info_1002_504a, + &pci_dev_info_1002_504b, + &pci_dev_info_1002_504c, + &pci_dev_info_1002_504d, + &pci_dev_info_1002_504e, + &pci_dev_info_1002_504f, + &pci_dev_info_1002_5050, + &pci_dev_info_1002_5051, + &pci_dev_info_1002_5052, + &pci_dev_info_1002_5053, + &pci_dev_info_1002_5054, + &pci_dev_info_1002_5055, + &pci_dev_info_1002_5056, + &pci_dev_info_1002_5057, + &pci_dev_info_1002_5058, + &pci_dev_info_1002_5144, + &pci_dev_info_1002_5145, + &pci_dev_info_1002_5146, + &pci_dev_info_1002_5147, + &pci_dev_info_1002_5148, + &pci_dev_info_1002_5149, + &pci_dev_info_1002_514a, + &pci_dev_info_1002_514b, + &pci_dev_info_1002_514c, + &pci_dev_info_1002_514d, + &pci_dev_info_1002_514e, + &pci_dev_info_1002_514f, + &pci_dev_info_1002_5157, + &pci_dev_info_1002_5158, + &pci_dev_info_1002_5159, + &pci_dev_info_1002_515a, + &pci_dev_info_1002_5168, + &pci_dev_info_1002_5169, + &pci_dev_info_1002_516a, + &pci_dev_info_1002_516b, + &pci_dev_info_1002_516c, + &pci_dev_info_1002_5245, + &pci_dev_info_1002_5246, + &pci_dev_info_1002_5247, + &pci_dev_info_1002_524b, + &pci_dev_info_1002_524c, + &pci_dev_info_1002_5345, + &pci_dev_info_1002_5346, + &pci_dev_info_1002_5347, + &pci_dev_info_1002_5348, + &pci_dev_info_1002_534b, + &pci_dev_info_1002_534c, + &pci_dev_info_1002_534d, + &pci_dev_info_1002_534e, + &pci_dev_info_1002_5354, + &pci_dev_info_1002_5446, + &pci_dev_info_1002_544c, + &pci_dev_info_1002_5452, + &pci_dev_info_1002_5453, + &pci_dev_info_1002_5454, + &pci_dev_info_1002_5455, + &pci_dev_info_1002_5654, + &pci_dev_info_1002_5655, + &pci_dev_info_1002_5656, + &pci_dev_info_1002_700f, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1003[] = { + &pci_dev_info_1003_0201, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1004[] = { + &pci_dev_info_1004_0005, + &pci_dev_info_1004_0006, + &pci_dev_info_1004_0007, + &pci_dev_info_1004_0008, + &pci_dev_info_1004_0009, + &pci_dev_info_1004_000c, + &pci_dev_info_1004_000d, + &pci_dev_info_1004_0101, + &pci_dev_info_1004_0102, + &pci_dev_info_1004_0103, + &pci_dev_info_1004_0104, + &pci_dev_info_1004_0105, + &pci_dev_info_1004_0200, + &pci_dev_info_1004_0280, + &pci_dev_info_1004_0304, + &pci_dev_info_1004_0305, + &pci_dev_info_1004_0306, + &pci_dev_info_1004_0307, + &pci_dev_info_1004_0308, + &pci_dev_info_1004_0702, + &pci_dev_info_1004_0703, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_1005[] = { + &pci_dev_info_1005_2064, + &pci_dev_info_1005_2128, + &pci_dev_info_1005_2301, + &pci_dev_info_1005_2302, + &pci_dev_info_1005_2364, + &pci_dev_info_1005_2464, + &pci_dev_info_1005_2501, + NULL +}; +#define pci_dev_list_1006 NULL +#define pci_dev_list_1007 NULL +#define pci_dev_list_1008 NULL +#define pci_dev_list_100a NULL +static const pciDeviceInfo *pci_dev_list_100b[] = { + &pci_dev_info_100b_0001, + &pci_dev_info_100b_0002, + &pci_dev_info_100b_000e, + &pci_dev_info_100b_000f, + &pci_dev_info_100b_0011, + &pci_dev_info_100b_0012, + &pci_dev_info_100b_0020, + &pci_dev_info_100b_0022, + &pci_dev_info_100b_0500, + &pci_dev_info_100b_0501, + &pci_dev_info_100b_0502, + &pci_dev_info_100b_0503, + &pci_dev_info_100b_0504, + &pci_dev_info_100b_0505, + &pci_dev_info_100b_d001, + NULL +}; +static const pciDeviceInfo *pci_dev_list_100c[] = { + &pci_dev_info_100c_3202, + &pci_dev_info_100c_3205, + &pci_dev_info_100c_3206, + &pci_dev_info_100c_3207, + &pci_dev_info_100c_3208, + &pci_dev_info_100c_4702, + NULL +}; +#define pci_dev_list_100d NULL +static const pciDeviceInfo *pci_dev_list_100e[] = { + &pci_dev_info_100e_9000, + &pci_dev_info_100e_9001, + &pci_dev_info_100e_9002, + &pci_dev_info_100e_9100, + NULL +}; +#define pci_dev_list_1010 NULL +static const pciDeviceInfo *pci_dev_list_1011[] = { + &pci_dev_info_1011_0001, + &pci_dev_info_1011_0002, + &pci_dev_info_1011_0004, + &pci_dev_info_1011_0007, + &pci_dev_info_1011_0008, + &pci_dev_info_1011_0009, + &pci_dev_info_1011_000a, + &pci_dev_info_1011_000d, + &pci_dev_info_1011_000f, + &pci_dev_info_1011_0014, + &pci_dev_info_1011_0016, + &pci_dev_info_1011_0019, + &pci_dev_info_1011_001a, + &pci_dev_info_1011_0021, + &pci_dev_info_1011_0022, + &pci_dev_info_1011_0023, + &pci_dev_info_1011_0024, + &pci_dev_info_1011_0025, + &pci_dev_info_1011_0026, + &pci_dev_info_1011_0034, + &pci_dev_info_1011_0045, + &pci_dev_info_1011_0046, + &pci_dev_info_1011_1065, + NULL +}; +#define pci_dev_list_1012 NULL +static const pciDeviceInfo *pci_dev_list_1013[] = { + &pci_dev_info_1013_0038, + &pci_dev_info_1013_0040, + &pci_dev_info_1013_004c, + &pci_dev_info_1013_00a0, + &pci_dev_info_1013_00a2, + &pci_dev_info_1013_00a4, + &pci_dev_info_1013_00a8, + &pci_dev_info_1013_00ac, + &pci_dev_info_1013_00b0, + &pci_dev_info_1013_00b8, + &pci_dev_info_1013_00bc, + &pci_dev_info_1013_00d0, + &pci_dev_info_1013_00d2, + &pci_dev_info_1013_00d4, + &pci_dev_info_1013_00d5, + &pci_dev_info_1013_00d6, + &pci_dev_info_1013_00e8, + &pci_dev_info_1013_1100, + &pci_dev_info_1013_1110, + &pci_dev_info_1013_1112, + &pci_dev_info_1013_1113, + &pci_dev_info_1013_1200, + &pci_dev_info_1013_1202, + &pci_dev_info_1013_1204, + &pci_dev_info_1013_4400, + &pci_dev_info_1013_6001, + &pci_dev_info_1013_6003, + &pci_dev_info_1013_6004, + &pci_dev_info_1013_6005, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1014[] = { + &pci_dev_info_1014_0002, + &pci_dev_info_1014_0005, + &pci_dev_info_1014_0007, + &pci_dev_info_1014_000a, + &pci_dev_info_1014_0017, + &pci_dev_info_1014_0018, + &pci_dev_info_1014_001b, + &pci_dev_info_1014_001c, + &pci_dev_info_1014_001d, + &pci_dev_info_1014_0020, + &pci_dev_info_1014_0022, + &pci_dev_info_1014_002d, + &pci_dev_info_1014_002e, + &pci_dev_info_1014_0036, + &pci_dev_info_1014_003a, + &pci_dev_info_1014_003e, + &pci_dev_info_1014_0045, + &pci_dev_info_1014_0046, + &pci_dev_info_1014_0047, + &pci_dev_info_1014_0048, + &pci_dev_info_1014_0049, + &pci_dev_info_1014_004e, + &pci_dev_info_1014_004f, + &pci_dev_info_1014_0050, + &pci_dev_info_1014_0053, + &pci_dev_info_1014_0057, + &pci_dev_info_1014_005c, + &pci_dev_info_1014_007c, + &pci_dev_info_1014_007d, + &pci_dev_info_1014_0090, + &pci_dev_info_1014_0095, + &pci_dev_info_1014_0096, + &pci_dev_info_1014_00a5, + &pci_dev_info_1014_00a6, + &pci_dev_info_1014_00b7, + &pci_dev_info_1014_00be, + &pci_dev_info_1014_00dc, + &pci_dev_info_1014_00fc, + &pci_dev_info_1014_0105, + &pci_dev_info_1014_010f, + &pci_dev_info_1014_0142, + &pci_dev_info_1014_0144, + &pci_dev_info_1014_0156, + &pci_dev_info_1014_01a7, + &pci_dev_info_1014_01bd, + &pci_dev_info_1014_0302, + &pci_dev_info_1014_ffff, + NULL +}; +#endif +#define pci_dev_list_1015 NULL +#define pci_dev_list_1016 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1017[] = { + &pci_dev_info_1017_5343, + NULL +}; +#endif +#define pci_dev_list_1018 NULL +#define pci_dev_list_1019 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_101a[] = { + &pci_dev_info_101a_0005, + NULL +}; +#endif +#define pci_dev_list_101b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_101c[] = { + &pci_dev_info_101c_0193, + &pci_dev_info_101c_0196, + &pci_dev_info_101c_0197, + &pci_dev_info_101c_0296, + &pci_dev_info_101c_3193, + &pci_dev_info_101c_3197, + &pci_dev_info_101c_3296, + &pci_dev_info_101c_4296, + &pci_dev_info_101c_9710, + &pci_dev_info_101c_9712, + &pci_dev_info_101c_c24a, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_101e[] = { + &pci_dev_info_101e_1960, + &pci_dev_info_101e_9010, + &pci_dev_info_101e_9030, + &pci_dev_info_101e_9031, + &pci_dev_info_101e_9032, + &pci_dev_info_101e_9033, + &pci_dev_info_101e_9040, + &pci_dev_info_101e_9060, + &pci_dev_info_101e_9063, + NULL +}; +#endif +#define pci_dev_list_101f NULL +#define pci_dev_list_1020 NULL +#define pci_dev_list_1021 NULL +static const pciDeviceInfo *pci_dev_list_1022[] = { + &pci_dev_info_1022_1100, + &pci_dev_info_1022_1101, + &pci_dev_info_1022_1102, + &pci_dev_info_1022_1103, + &pci_dev_info_1022_2000, + &pci_dev_info_1022_2001, + &pci_dev_info_1022_2020, + &pci_dev_info_1022_2040, + &pci_dev_info_1022_3000, + &pci_dev_info_1022_7006, + &pci_dev_info_1022_7007, + &pci_dev_info_1022_700c, + &pci_dev_info_1022_700d, + &pci_dev_info_1022_700e, + &pci_dev_info_1022_700f, + &pci_dev_info_1022_7400, + &pci_dev_info_1022_7401, + &pci_dev_info_1022_7403, + &pci_dev_info_1022_7404, + &pci_dev_info_1022_7408, + &pci_dev_info_1022_7409, + &pci_dev_info_1022_740b, + &pci_dev_info_1022_740c, + &pci_dev_info_1022_7410, + &pci_dev_info_1022_7411, + &pci_dev_info_1022_7413, + &pci_dev_info_1022_7414, + &pci_dev_info_1022_7440, + &pci_dev_info_1022_7441, + &pci_dev_info_1022_7443, + &pci_dev_info_1022_7445, + &pci_dev_info_1022_7446, + &pci_dev_info_1022_7448, + &pci_dev_info_1022_7449, + &pci_dev_info_1022_7450, + &pci_dev_info_1022_7451, + &pci_dev_info_1022_7454, + &pci_dev_info_1022_7455, + &pci_dev_info_1022_7460, + &pci_dev_info_1022_7461, + &pci_dev_info_1022_7462, + &pci_dev_info_1022_7464, + &pci_dev_info_1022_7468, + &pci_dev_info_1022_7469, + &pci_dev_info_1022_746a, + &pci_dev_info_1022_746b, + &pci_dev_info_1022_746d, + &pci_dev_info_1022_746e, + NULL +}; +static const pciDeviceInfo *pci_dev_list_1023[] = { + &pci_dev_info_1023_0194, + &pci_dev_info_1023_2000, + &pci_dev_info_1023_2001, + &pci_dev_info_1023_8400, + &pci_dev_info_1023_8420, + &pci_dev_info_1023_8500, + &pci_dev_info_1023_8520, + &pci_dev_info_1023_8620, + &pci_dev_info_1023_8820, + &pci_dev_info_1023_9320, + &pci_dev_info_1023_9350, + &pci_dev_info_1023_9360, + &pci_dev_info_1023_9382, + &pci_dev_info_1023_9383, + &pci_dev_info_1023_9385, + &pci_dev_info_1023_9386, + &pci_dev_info_1023_9388, + &pci_dev_info_1023_9397, + &pci_dev_info_1023_939a, + &pci_dev_info_1023_9420, + &pci_dev_info_1023_9430, + &pci_dev_info_1023_9440, + &pci_dev_info_1023_9460, + &pci_dev_info_1023_9470, + &pci_dev_info_1023_9520, + &pci_dev_info_1023_9525, + &pci_dev_info_1023_9540, + &pci_dev_info_1023_9660, + &pci_dev_info_1023_9680, + &pci_dev_info_1023_9682, + &pci_dev_info_1023_9683, + &pci_dev_info_1023_9685, + &pci_dev_info_1023_9750, + &pci_dev_info_1023_9753, + &pci_dev_info_1023_9754, + &pci_dev_info_1023_9759, + &pci_dev_info_1023_9783, + &pci_dev_info_1023_9785, + &pci_dev_info_1023_9850, + &pci_dev_info_1023_9880, + &pci_dev_info_1023_9910, + &pci_dev_info_1023_9930, + NULL +}; +#define pci_dev_list_1024 NULL +static const pciDeviceInfo *pci_dev_list_1025[] = { + &pci_dev_info_1025_1435, + &pci_dev_info_1025_1445, + &pci_dev_info_1025_1449, + &pci_dev_info_1025_1451, + &pci_dev_info_1025_1461, + &pci_dev_info_1025_1489, + &pci_dev_info_1025_1511, + &pci_dev_info_1025_1512, + &pci_dev_info_1025_1513, + &pci_dev_info_1025_1521, + &pci_dev_info_1025_1523, + &pci_dev_info_1025_1531, + &pci_dev_info_1025_1533, + &pci_dev_info_1025_1535, + &pci_dev_info_1025_1541, + &pci_dev_info_1025_1542, + &pci_dev_info_1025_1543, + &pci_dev_info_1025_1561, + &pci_dev_info_1025_1621, + &pci_dev_info_1025_1631, + &pci_dev_info_1025_1641, + &pci_dev_info_1025_1647, + &pci_dev_info_1025_3141, + &pci_dev_info_1025_3143, + &pci_dev_info_1025_3145, + &pci_dev_info_1025_3147, + &pci_dev_info_1025_3149, + &pci_dev_info_1025_3151, + &pci_dev_info_1025_3307, + &pci_dev_info_1025_3309, + &pci_dev_info_1025_3321, + &pci_dev_info_1025_5212, + &pci_dev_info_1025_5215, + &pci_dev_info_1025_5217, + &pci_dev_info_1025_5219, + &pci_dev_info_1025_5225, + &pci_dev_info_1025_5229, + &pci_dev_info_1025_5235, + &pci_dev_info_1025_5237, + &pci_dev_info_1025_5240, + &pci_dev_info_1025_5241, + &pci_dev_info_1025_5242, + &pci_dev_info_1025_5243, + &pci_dev_info_1025_5244, + &pci_dev_info_1025_5247, + &pci_dev_info_1025_5251, + &pci_dev_info_1025_5427, + &pci_dev_info_1025_5451, + &pci_dev_info_1025_5453, + &pci_dev_info_1025_7101, + NULL +}; +static const pciDeviceInfo *pci_dev_list_1028[] = { + &pci_dev_info_1028_0001, + &pci_dev_info_1028_0002, + &pci_dev_info_1028_0003, + &pci_dev_info_1028_0004, + &pci_dev_info_1028_0005, + &pci_dev_info_1028_0006, + &pci_dev_info_1028_0007, + &pci_dev_info_1028_0008, + &pci_dev_info_1028_000a, + &pci_dev_info_1028_000c, + &pci_dev_info_1028_000e, + &pci_dev_info_1028_000f, + NULL +}; +#define pci_dev_list_1029 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_102a[] = { + &pci_dev_info_102a_0000, + &pci_dev_info_102a_0010, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_102b[] = { + &pci_dev_info_102b_0010, + &pci_dev_info_102b_0518, + &pci_dev_info_102b_0519, + &pci_dev_info_102b_051a, + &pci_dev_info_102b_051b, + &pci_dev_info_102b_051e, + &pci_dev_info_102b_051f, + &pci_dev_info_102b_0520, + &pci_dev_info_102b_0521, + &pci_dev_info_102b_0525, + &pci_dev_info_102b_0527, + &pci_dev_info_102b_0d10, + &pci_dev_info_102b_1000, + &pci_dev_info_102b_1001, + &pci_dev_info_102b_2007, + &pci_dev_info_102b_2527, + &pci_dev_info_102b_4536, + &pci_dev_info_102b_6573, + NULL +}; +static const pciDeviceInfo *pci_dev_list_102c[] = { + &pci_dev_info_102c_00b8, + &pci_dev_info_102c_00c0, + &pci_dev_info_102c_00d0, + &pci_dev_info_102c_00d8, + &pci_dev_info_102c_00dc, + &pci_dev_info_102c_00e0, + &pci_dev_info_102c_00e4, + &pci_dev_info_102c_00e5, + &pci_dev_info_102c_00f0, + &pci_dev_info_102c_00f4, + &pci_dev_info_102c_00f5, + &pci_dev_info_102c_0c30, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_102d[] = { + &pci_dev_info_102d_50dc, + NULL +}; +#endif +#define pci_dev_list_102e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_102f[] = { + &pci_dev_info_102f_0009, + &pci_dev_info_102f_0020, + NULL +}; +#endif +#define pci_dev_list_1030 NULL +static const pciDeviceInfo *pci_dev_list_1031[] = { + &pci_dev_info_1031_5601, + &pci_dev_info_1031_5607, + &pci_dev_info_1031_5631, + &pci_dev_info_1031_6057, + NULL +}; +#define pci_dev_list_1032 NULL +static const pciDeviceInfo *pci_dev_list_1033[] = { + &pci_dev_info_1033_0001, + &pci_dev_info_1033_0002, + &pci_dev_info_1033_0003, + &pci_dev_info_1033_0004, + &pci_dev_info_1033_0005, + &pci_dev_info_1033_0006, + &pci_dev_info_1033_0007, + &pci_dev_info_1033_0008, + &pci_dev_info_1033_0009, + &pci_dev_info_1033_0016, + &pci_dev_info_1033_001a, + &pci_dev_info_1033_0021, + &pci_dev_info_1033_0029, + &pci_dev_info_1033_002a, + &pci_dev_info_1033_002c, + &pci_dev_info_1033_002d, + &pci_dev_info_1033_0035, + &pci_dev_info_1033_003b, + &pci_dev_info_1033_003e, + &pci_dev_info_1033_0046, + &pci_dev_info_1033_005a, + &pci_dev_info_1033_0063, + &pci_dev_info_1033_0067, + &pci_dev_info_1033_0074, + &pci_dev_info_1033_009b, + &pci_dev_info_1033_00a6, + &pci_dev_info_1033_00cd, + &pci_dev_info_1033_00e0, + NULL +}; +#define pci_dev_list_1034 NULL +#define pci_dev_list_1035 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1036[] = { + &pci_dev_info_1036_0000, + NULL +}; +#endif +#define pci_dev_list_1037 NULL +#define pci_dev_list_1038 NULL +static const pciDeviceInfo *pci_dev_list_1039[] = { + &pci_dev_info_1039_0001, + &pci_dev_info_1039_0002, + &pci_dev_info_1039_0006, + &pci_dev_info_1039_0008, + &pci_dev_info_1039_0009, + &pci_dev_info_1039_0018, + &pci_dev_info_1039_0200, + &pci_dev_info_1039_0204, + &pci_dev_info_1039_0205, + &pci_dev_info_1039_0300, + &pci_dev_info_1039_0310, + &pci_dev_info_1039_0315, + &pci_dev_info_1039_0325, + &pci_dev_info_1039_0330, + &pci_dev_info_1039_0406, + &pci_dev_info_1039_0496, + &pci_dev_info_1039_0530, + &pci_dev_info_1039_0540, + &pci_dev_info_1039_0597, + &pci_dev_info_1039_0601, + &pci_dev_info_1039_0620, + &pci_dev_info_1039_0630, + &pci_dev_info_1039_0633, + &pci_dev_info_1039_0635, + &pci_dev_info_1039_0645, + &pci_dev_info_1039_0646, + &pci_dev_info_1039_0650, + &pci_dev_info_1039_0651, + &pci_dev_info_1039_0730, + &pci_dev_info_1039_0733, + &pci_dev_info_1039_0735, + &pci_dev_info_1039_0740, + &pci_dev_info_1039_0745, + &pci_dev_info_1039_0900, + &pci_dev_info_1039_0961, + &pci_dev_info_1039_0962, + &pci_dev_info_1039_3602, + &pci_dev_info_1039_5107, + &pci_dev_info_1039_5300, + &pci_dev_info_1039_5315, + &pci_dev_info_1039_5401, + &pci_dev_info_1039_5511, + &pci_dev_info_1039_5513, + &pci_dev_info_1039_5517, + &pci_dev_info_1039_5571, + &pci_dev_info_1039_5581, + &pci_dev_info_1039_5582, + &pci_dev_info_1039_5591, + &pci_dev_info_1039_5596, + &pci_dev_info_1039_5597, + &pci_dev_info_1039_5600, + &pci_dev_info_1039_6204, + &pci_dev_info_1039_6205, + &pci_dev_info_1039_6236, + &pci_dev_info_1039_6300, + &pci_dev_info_1039_6306, + &pci_dev_info_1039_6325, + &pci_dev_info_1039_6326, + &pci_dev_info_1039_7001, + &pci_dev_info_1039_7002, + &pci_dev_info_1039_7007, + &pci_dev_info_1039_7012, + &pci_dev_info_1039_7013, + &pci_dev_info_1039_7016, + &pci_dev_info_1039_7018, + NULL +}; +#define pci_dev_list_103a NULL +#define pci_dev_list_103b NULL +static const pciDeviceInfo *pci_dev_list_103c[] = { + &pci_dev_info_103c_1005, + &pci_dev_info_103c_1006, + &pci_dev_info_103c_1008, + &pci_dev_info_103c_100a, + &pci_dev_info_103c_1028, + &pci_dev_info_103c_1029, + &pci_dev_info_103c_102a, + &pci_dev_info_103c_1030, + &pci_dev_info_103c_1031, + &pci_dev_info_103c_1040, + &pci_dev_info_103c_1041, + &pci_dev_info_103c_1042, + &pci_dev_info_103c_1048, + &pci_dev_info_103c_1064, + &pci_dev_info_103c_108b, + &pci_dev_info_103c_10c1, + &pci_dev_info_103c_10ed, + &pci_dev_info_103c_1200, + &pci_dev_info_103c_1219, + &pci_dev_info_103c_121a, + &pci_dev_info_103c_121b, + &pci_dev_info_103c_121c, + &pci_dev_info_103c_1229, + &pci_dev_info_103c_122a, + &pci_dev_info_103c_122e, + &pci_dev_info_103c_1290, + &pci_dev_info_103c_2910, + &pci_dev_info_103c_2925, + NULL +}; +#define pci_dev_list_103e NULL +#define pci_dev_list_103f NULL +#define pci_dev_list_1040 NULL +#define pci_dev_list_1041 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1042[] = { + &pci_dev_info_1042_1000, + &pci_dev_info_1042_1001, + &pci_dev_info_1042_3000, + &pci_dev_info_1042_3010, + &pci_dev_info_1042_3020, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1043[] = { + &pci_dev_info_1043_0675, + &pci_dev_info_1043_4021, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1044[] = { + &pci_dev_info_1044_1012, + &pci_dev_info_1044_a400, + &pci_dev_info_1044_a500, + &pci_dev_info_1044_a501, + &pci_dev_info_1044_a511, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1045[] = { + &pci_dev_info_1045_a0f8, + &pci_dev_info_1045_c101, + &pci_dev_info_1045_c178, + &pci_dev_info_1045_c556, + &pci_dev_info_1045_c557, + &pci_dev_info_1045_c558, + &pci_dev_info_1045_c567, + &pci_dev_info_1045_c568, + &pci_dev_info_1045_c569, + &pci_dev_info_1045_c621, + &pci_dev_info_1045_c700, + &pci_dev_info_1045_c701, + &pci_dev_info_1045_c814, + &pci_dev_info_1045_c822, + &pci_dev_info_1045_c824, + &pci_dev_info_1045_c825, + &pci_dev_info_1045_c832, + &pci_dev_info_1045_c861, + &pci_dev_info_1045_c895, + &pci_dev_info_1045_c935, + &pci_dev_info_1045_d568, + &pci_dev_info_1045_d721, + NULL +}; +#endif +#define pci_dev_list_1046 NULL +#define pci_dev_list_1047 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1048[] = { + &pci_dev_info_1048_0d22, + &pci_dev_info_1048_1000, + &pci_dev_info_1048_3000, + NULL +}; +#endif +#define pci_dev_list_1049 NULL +static const pciDeviceInfo *pci_dev_list_104a[] = { + &pci_dev_info_104a_0008, + &pci_dev_info_104a_0009, + &pci_dev_info_104a_0010, + &pci_dev_info_104a_0210, + &pci_dev_info_104a_0981, + &pci_dev_info_104a_1746, + &pci_dev_info_104a_2774, + &pci_dev_info_104a_3520, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_104b[] = { + &pci_dev_info_104b_0140, + &pci_dev_info_104b_1040, + &pci_dev_info_104b_8130, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_104c[] = { + &pci_dev_info_104c_0500, + &pci_dev_info_104c_0508, + &pci_dev_info_104c_1000, + &pci_dev_info_104c_104c, + &pci_dev_info_104c_3d04, + &pci_dev_info_104c_3d07, + &pci_dev_info_104c_8000, + &pci_dev_info_104c_8009, + &pci_dev_info_104c_8017, + &pci_dev_info_104c_8019, + &pci_dev_info_104c_8020, + &pci_dev_info_104c_8021, + &pci_dev_info_104c_8022, + &pci_dev_info_104c_8023, + &pci_dev_info_104c_8024, + &pci_dev_info_104c_8026, + &pci_dev_info_104c_8027, + &pci_dev_info_104c_8400, + &pci_dev_info_104c_a001, + &pci_dev_info_104c_a100, + &pci_dev_info_104c_a102, + &pci_dev_info_104c_a106, + &pci_dev_info_104c_ac10, + &pci_dev_info_104c_ac11, + &pci_dev_info_104c_ac12, + &pci_dev_info_104c_ac13, + &pci_dev_info_104c_ac15, + &pci_dev_info_104c_ac16, + &pci_dev_info_104c_ac17, + &pci_dev_info_104c_ac18, + &pci_dev_info_104c_ac19, + &pci_dev_info_104c_ac1a, + &pci_dev_info_104c_ac1b, + &pci_dev_info_104c_ac1c, + &pci_dev_info_104c_ac1d, + &pci_dev_info_104c_ac1e, + &pci_dev_info_104c_ac1f, + &pci_dev_info_104c_ac20, + &pci_dev_info_104c_ac21, + &pci_dev_info_104c_ac22, + &pci_dev_info_104c_ac23, + &pci_dev_info_104c_ac28, + &pci_dev_info_104c_ac30, + &pci_dev_info_104c_ac40, + &pci_dev_info_104c_ac41, + &pci_dev_info_104c_ac42, + &pci_dev_info_104c_ac50, + &pci_dev_info_104c_ac51, + &pci_dev_info_104c_ac52, + &pci_dev_info_104c_ac53, + &pci_dev_info_104c_ac55, + &pci_dev_info_104c_ac56, + &pci_dev_info_104c_ac60, + &pci_dev_info_104c_fe00, + &pci_dev_info_104c_fe03, + NULL +}; +static const pciDeviceInfo *pci_dev_list_104d[] = { + &pci_dev_info_104d_8009, + &pci_dev_info_104d_8039, + &pci_dev_info_104d_8056, + &pci_dev_info_104d_808a, + NULL +}; +static const pciDeviceInfo *pci_dev_list_104e[] = { + &pci_dev_info_104e_0017, + &pci_dev_info_104e_0107, + &pci_dev_info_104e_0109, + &pci_dev_info_104e_0111, + &pci_dev_info_104e_0217, + &pci_dev_info_104e_0317, + NULL +}; +#define pci_dev_list_104f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1050[] = { + &pci_dev_info_1050_0000, + &pci_dev_info_1050_0001, + &pci_dev_info_1050_0105, + &pci_dev_info_1050_0840, + &pci_dev_info_1050_0940, + &pci_dev_info_1050_5a5a, + &pci_dev_info_1050_6692, + &pci_dev_info_1050_9970, + NULL +}; +#endif +#define pci_dev_list_1051 NULL +#define pci_dev_list_1052 NULL +#define pci_dev_list_1053 NULL +#define pci_dev_list_1054 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1055[] = { + &pci_dev_info_1055_9130, + &pci_dev_info_1055_9460, + &pci_dev_info_1055_9462, + &pci_dev_info_1055_9463, + NULL +}; +#endif +#define pci_dev_list_1056 NULL +static const pciDeviceInfo *pci_dev_list_1057[] = { + &pci_dev_info_1057_0001, + &pci_dev_info_1057_0002, + &pci_dev_info_1057_0003, + &pci_dev_info_1057_0004, + &pci_dev_info_1057_0006, + &pci_dev_info_1057_0100, + &pci_dev_info_1057_0431, + &pci_dev_info_1057_1801, + &pci_dev_info_1057_18c0, + &pci_dev_info_1057_4801, + &pci_dev_info_1057_4802, + &pci_dev_info_1057_4803, + &pci_dev_info_1057_4806, + &pci_dev_info_1057_4d68, + &pci_dev_info_1057_5600, + &pci_dev_info_1057_6400, + NULL +}; +#define pci_dev_list_1058 NULL +#define pci_dev_list_1059 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_105a[] = { + &pci_dev_info_105a_0d30, + &pci_dev_info_105a_0d38, + &pci_dev_info_105a_1275, + &pci_dev_info_105a_3376, + &pci_dev_info_105a_4d30, + &pci_dev_info_105a_4d33, + &pci_dev_info_105a_4d38, + &pci_dev_info_105a_4d68, + &pci_dev_info_105a_4d69, + &pci_dev_info_105a_5275, + &pci_dev_info_105a_5300, + &pci_dev_info_105a_6268, + &pci_dev_info_105a_6269, + &pci_dev_info_105a_6621, + &pci_dev_info_105a_7275, + NULL +}; +#endif +#define pci_dev_list_105b NULL +#define pci_dev_list_105c NULL +static const pciDeviceInfo *pci_dev_list_105d[] = { + &pci_dev_info_105d_2309, + &pci_dev_info_105d_2339, + &pci_dev_info_105d_493d, + &pci_dev_info_105d_5348, + NULL +}; +#define pci_dev_list_105e NULL +#define pci_dev_list_105f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1060[] = { + &pci_dev_info_1060_0001, + &pci_dev_info_1060_0002, + &pci_dev_info_1060_0101, + &pci_dev_info_1060_0881, + &pci_dev_info_1060_0886, + &pci_dev_info_1060_0891, + &pci_dev_info_1060_1001, + &pci_dev_info_1060_673a, + &pci_dev_info_1060_673b, + &pci_dev_info_1060_8710, + &pci_dev_info_1060_886a, + &pci_dev_info_1060_8881, + &pci_dev_info_1060_8886, + &pci_dev_info_1060_888a, + &pci_dev_info_1060_8891, + &pci_dev_info_1060_9017, + &pci_dev_info_1060_9018, + &pci_dev_info_1060_9026, + &pci_dev_info_1060_e881, + &pci_dev_info_1060_e886, + &pci_dev_info_1060_e88a, + &pci_dev_info_1060_e891, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1061[] = { + &pci_dev_info_1061_0001, + &pci_dev_info_1061_0002, + NULL +}; +#endif +#define pci_dev_list_1062 NULL +#define pci_dev_list_1063 NULL +#define pci_dev_list_1064 NULL +#define pci_dev_list_1065 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1066[] = { + &pci_dev_info_1066_0000, + &pci_dev_info_1066_0001, + &pci_dev_info_1066_0002, + &pci_dev_info_1066_0003, + &pci_dev_info_1066_0004, + &pci_dev_info_1066_0005, + &pci_dev_info_1066_8002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1067[] = { + &pci_dev_info_1067_1002, + NULL +}; +#endif +#define pci_dev_list_1068 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1069[] = { + &pci_dev_info_1069_0001, + &pci_dev_info_1069_0002, + &pci_dev_info_1069_0010, + &pci_dev_info_1069_0050, + &pci_dev_info_1069_ba55, + &pci_dev_info_1069_ba56, + NULL +}; +#endif +#define pci_dev_list_106a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_106b[] = { + &pci_dev_info_106b_0001, + &pci_dev_info_106b_0002, + &pci_dev_info_106b_0003, + &pci_dev_info_106b_0004, + &pci_dev_info_106b_0007, + &pci_dev_info_106b_000e, + &pci_dev_info_106b_0010, + &pci_dev_info_106b_0017, + &pci_dev_info_106b_0018, + &pci_dev_info_106b_0019, + &pci_dev_info_106b_001e, + &pci_dev_info_106b_001f, + &pci_dev_info_106b_0020, + &pci_dev_info_106b_0021, + &pci_dev_info_106b_0022, + &pci_dev_info_106b_0024, + &pci_dev_info_106b_0025, + &pci_dev_info_106b_0026, + &pci_dev_info_106b_0027, + &pci_dev_info_106b_0028, + &pci_dev_info_106b_0029, + &pci_dev_info_106b_002d, + &pci_dev_info_106b_002e, + &pci_dev_info_106b_002f, + &pci_dev_info_106b_0030, + &pci_dev_info_106b_0031, + &pci_dev_info_106b_0032, + &pci_dev_info_106b_0033, + &pci_dev_info_106b_0034, + &pci_dev_info_106b_1645, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_106c[] = { + &pci_dev_info_106c_8801, + &pci_dev_info_106c_8802, + &pci_dev_info_106c_8803, + &pci_dev_info_106c_8804, + &pci_dev_info_106c_8805, + NULL +}; +#endif +#define pci_dev_list_106d NULL +#define pci_dev_list_106e NULL +#define pci_dev_list_106f NULL +#define pci_dev_list_1070 NULL +#define pci_dev_list_1071 NULL +#define pci_dev_list_1072 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1073[] = { + &pci_dev_info_1073_0001, + &pci_dev_info_1073_0002, + &pci_dev_info_1073_0003, + &pci_dev_info_1073_0004, + &pci_dev_info_1073_0005, + &pci_dev_info_1073_0006, + &pci_dev_info_1073_0008, + &pci_dev_info_1073_000a, + &pci_dev_info_1073_000c, + &pci_dev_info_1073_000d, + &pci_dev_info_1073_0010, + &pci_dev_info_1073_0012, + &pci_dev_info_1073_0020, + &pci_dev_info_1073_2000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1074[] = { + &pci_dev_info_1074_4e78, + NULL +}; +#endif +#define pci_dev_list_1075 NULL +#define pci_dev_list_1076 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1077[] = { + &pci_dev_info_1077_1016, + &pci_dev_info_1077_1020, + &pci_dev_info_1077_1022, + &pci_dev_info_1077_1080, + &pci_dev_info_1077_1216, + &pci_dev_info_1077_1240, + &pci_dev_info_1077_1280, + &pci_dev_info_1077_2020, + &pci_dev_info_1077_2100, + &pci_dev_info_1077_2200, + &pci_dev_info_1077_2300, + &pci_dev_info_1077_2312, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_1078[] = { + &pci_dev_info_1078_0000, + &pci_dev_info_1078_0001, + &pci_dev_info_1078_0002, + &pci_dev_info_1078_0100, + &pci_dev_info_1078_0101, + &pci_dev_info_1078_0102, + &pci_dev_info_1078_0103, + &pci_dev_info_1078_0104, + &pci_dev_info_1078_0400, + &pci_dev_info_1078_0401, + &pci_dev_info_1078_0402, + &pci_dev_info_1078_0403, + NULL +}; +#define pci_dev_list_1079 NULL +#define pci_dev_list_107a NULL +#define pci_dev_list_107b NULL +#define pci_dev_list_107c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_107d[] = { + &pci_dev_info_107d_0000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_107e[] = { + &pci_dev_info_107e_0001, + &pci_dev_info_107e_0002, + &pci_dev_info_107e_0004, + &pci_dev_info_107e_0005, + &pci_dev_info_107e_0008, + &pci_dev_info_107e_9003, + &pci_dev_info_107e_9007, + &pci_dev_info_107e_9008, + &pci_dev_info_107e_900c, + &pci_dev_info_107e_900e, + &pci_dev_info_107e_9011, + &pci_dev_info_107e_9013, + &pci_dev_info_107e_9023, + &pci_dev_info_107e_9027, + &pci_dev_info_107e_9031, + &pci_dev_info_107e_9033, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_107f[] = { + &pci_dev_info_107f_0802, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1080[] = { + &pci_dev_info_1080_0600, + &pci_dev_info_1080_c691, + &pci_dev_info_1080_c693, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1081[] = { + &pci_dev_info_1081_0d47, + NULL +}; +#endif +#define pci_dev_list_1082 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1083[] = { + &pci_dev_info_1083_0001, + NULL +}; +#endif +#define pci_dev_list_1084 NULL +#define pci_dev_list_1085 NULL +#define pci_dev_list_1086 NULL +#define pci_dev_list_1087 NULL +#define pci_dev_list_1088 NULL +#define pci_dev_list_1089 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_108a[] = { + &pci_dev_info_108a_0001, + &pci_dev_info_108a_0010, + &pci_dev_info_108a_0040, + &pci_dev_info_108a_3000, + NULL +}; +#endif +#define pci_dev_list_108c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_108d[] = { + &pci_dev_info_108d_0001, + &pci_dev_info_108d_0002, + &pci_dev_info_108d_0004, + &pci_dev_info_108d_0005, + &pci_dev_info_108d_0006, + &pci_dev_info_108d_0007, + &pci_dev_info_108d_0008, + &pci_dev_info_108d_0011, + &pci_dev_info_108d_0012, + &pci_dev_info_108d_0013, + &pci_dev_info_108d_0014, + &pci_dev_info_108d_0019, + &pci_dev_info_108d_0021, + &pci_dev_info_108d_0022, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_108e[] = { + &pci_dev_info_108e_0001, + &pci_dev_info_108e_1000, + &pci_dev_info_108e_1001, + &pci_dev_info_108e_1100, + &pci_dev_info_108e_1101, + &pci_dev_info_108e_1102, + &pci_dev_info_108e_1103, + &pci_dev_info_108e_2bad, + &pci_dev_info_108e_5000, + &pci_dev_info_108e_5043, + &pci_dev_info_108e_8000, + &pci_dev_info_108e_8001, + &pci_dev_info_108e_a000, + &pci_dev_info_108e_a001, + NULL +}; +#define pci_dev_list_108f NULL +#define pci_dev_list_1090 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1091[] = { + &pci_dev_info_1091_0020, + &pci_dev_info_1091_0021, + &pci_dev_info_1091_0040, + &pci_dev_info_1091_0041, + &pci_dev_info_1091_0060, + &pci_dev_info_1091_00e4, + &pci_dev_info_1091_0720, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_1092[] = { + &pci_dev_info_1092_00a0, + &pci_dev_info_1092_00a8, + &pci_dev_info_1092_0550, + &pci_dev_info_1092_08d4, + &pci_dev_info_1092_094c, + &pci_dev_info_1092_1092, + &pci_dev_info_1092_6120, + &pci_dev_info_1092_8810, + &pci_dev_info_1092_8811, + &pci_dev_info_1092_8880, + &pci_dev_info_1092_8881, + &pci_dev_info_1092_88b0, + &pci_dev_info_1092_88b1, + &pci_dev_info_1092_88c0, + &pci_dev_info_1092_88c1, + &pci_dev_info_1092_88d0, + &pci_dev_info_1092_88d1, + &pci_dev_info_1092_88f0, + &pci_dev_info_1092_88f1, + &pci_dev_info_1092_9999, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1093[] = { + &pci_dev_info_1093_0160, + &pci_dev_info_1093_0162, + &pci_dev_info_1093_1170, + &pci_dev_info_1093_1180, + &pci_dev_info_1093_1190, + &pci_dev_info_1093_1330, + &pci_dev_info_1093_1350, + &pci_dev_info_1093_2a60, + &pci_dev_info_1093_b001, + &pci_dev_info_1093_b011, + &pci_dev_info_1093_b021, + &pci_dev_info_1093_b031, + &pci_dev_info_1093_b041, + &pci_dev_info_1093_b051, + &pci_dev_info_1093_b061, + &pci_dev_info_1093_b071, + &pci_dev_info_1093_b081, + &pci_dev_info_1093_b091, + &pci_dev_info_1093_c801, + &pci_dev_info_1093_c831, + NULL +}; +#endif +#define pci_dev_list_1094 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1095[] = { + &pci_dev_info_1095_0640, + &pci_dev_info_1095_0643, + &pci_dev_info_1095_0646, + &pci_dev_info_1095_0647, + &pci_dev_info_1095_0648, + &pci_dev_info_1095_0649, + &pci_dev_info_1095_0650, + &pci_dev_info_1095_0670, + &pci_dev_info_1095_0673, + &pci_dev_info_1095_0680, + &pci_dev_info_1095_3112, + NULL +}; +#endif +#define pci_dev_list_1096 NULL +#define pci_dev_list_1097 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1098[] = { + &pci_dev_info_1098_0001, + &pci_dev_info_1098_0002, + NULL +}; +#endif +#define pci_dev_list_1099 NULL +#define pci_dev_list_109a NULL +#define pci_dev_list_109b NULL +#define pci_dev_list_109c NULL +#define pci_dev_list_109d NULL +static const pciDeviceInfo *pci_dev_list_109e[] = { + &pci_dev_info_109e_0350, + &pci_dev_info_109e_0351, + &pci_dev_info_109e_0369, + &pci_dev_info_109e_036c, + &pci_dev_info_109e_036e, + &pci_dev_info_109e_036f, + &pci_dev_info_109e_0370, + &pci_dev_info_109e_0878, + &pci_dev_info_109e_0879, + &pci_dev_info_109e_0880, + &pci_dev_info_109e_2115, + &pci_dev_info_109e_2125, + &pci_dev_info_109e_2164, + &pci_dev_info_109e_2165, + &pci_dev_info_109e_8230, + &pci_dev_info_109e_8472, + &pci_dev_info_109e_8474, + NULL +}; +#define pci_dev_list_109f NULL +#define pci_dev_list_10a0 NULL +#define pci_dev_list_10a1 NULL +#define pci_dev_list_10a2 NULL +#define pci_dev_list_10a3 NULL +#define pci_dev_list_10a4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10a5[] = { + &pci_dev_info_10a5_5449, + NULL +}; +#endif +#define pci_dev_list_10a6 NULL +#define pci_dev_list_10a7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10a8[] = { + &pci_dev_info_10a8_0000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10a9[] = { + &pci_dev_info_10a9_0001, + &pci_dev_info_10a9_0002, + &pci_dev_info_10a9_0003, + &pci_dev_info_10a9_0004, + &pci_dev_info_10a9_0005, + &pci_dev_info_10a9_0006, + &pci_dev_info_10a9_0007, + &pci_dev_info_10a9_0008, + &pci_dev_info_10a9_0009, + &pci_dev_info_10a9_0010, + &pci_dev_info_10a9_0011, + &pci_dev_info_10a9_0012, + &pci_dev_info_10a9_1001, + &pci_dev_info_10a9_1002, + &pci_dev_info_10a9_1003, + &pci_dev_info_10a9_1004, + &pci_dev_info_10a9_1005, + &pci_dev_info_10a9_1006, + &pci_dev_info_10a9_1007, + &pci_dev_info_10a9_1008, + &pci_dev_info_10a9_2001, + &pci_dev_info_10a9_2002, + &pci_dev_info_10a9_8001, + &pci_dev_info_10a9_8002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10aa[] = { + &pci_dev_info_10aa_0000, + NULL +}; +#endif +#define pci_dev_list_10ab NULL +#define pci_dev_list_10ac NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10ad[] = { + &pci_dev_info_10ad_0001, + &pci_dev_info_10ad_0003, + &pci_dev_info_10ad_0005, + &pci_dev_info_10ad_0103, + &pci_dev_info_10ad_0105, + &pci_dev_info_10ad_0565, + NULL +}; +#endif +#define pci_dev_list_10ae NULL +#define pci_dev_list_10af NULL +#define pci_dev_list_10b0 NULL +#define pci_dev_list_10b1 NULL +#define pci_dev_list_10b2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10b3[] = { + &pci_dev_info_10b3_3106, + &pci_dev_info_10b3_b106, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10b4[] = { + &pci_dev_info_10b4_1b1d, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10b5[] = { + &pci_dev_info_10b5_0001, + &pci_dev_info_10b5_1076, + &pci_dev_info_10b5_1077, + &pci_dev_info_10b5_1078, + &pci_dev_info_10b5_1103, + &pci_dev_info_10b5_1146, + &pci_dev_info_10b5_1147, + &pci_dev_info_10b5_2724, + &pci_dev_info_10b5_9030, + &pci_dev_info_10b5_9036, + &pci_dev_info_10b5_9050, + &pci_dev_info_10b5_9054, + &pci_dev_info_10b5_9060, + &pci_dev_info_10b5_906d, + &pci_dev_info_10b5_906e, + &pci_dev_info_10b5_9080, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10b6[] = { + &pci_dev_info_10b6_0001, + &pci_dev_info_10b6_0002, + &pci_dev_info_10b6_0003, + &pci_dev_info_10b6_0004, + &pci_dev_info_10b6_0006, + &pci_dev_info_10b6_0007, + &pci_dev_info_10b6_0009, + &pci_dev_info_10b6_000a, + &pci_dev_info_10b6_000b, + &pci_dev_info_10b6_000c, + &pci_dev_info_10b6_1000, + &pci_dev_info_10b6_1001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10b7[] = { + &pci_dev_info_10b7_0001, + &pci_dev_info_10b7_1006, + &pci_dev_info_10b7_1007, + &pci_dev_info_10b7_3390, + &pci_dev_info_10b7_3590, + &pci_dev_info_10b7_4500, + &pci_dev_info_10b7_5055, + &pci_dev_info_10b7_5057, + &pci_dev_info_10b7_5157, + &pci_dev_info_10b7_5257, + &pci_dev_info_10b7_5900, + &pci_dev_info_10b7_5920, + &pci_dev_info_10b7_5950, + &pci_dev_info_10b7_5951, + &pci_dev_info_10b7_5952, + &pci_dev_info_10b7_5970, + &pci_dev_info_10b7_5b57, + &pci_dev_info_10b7_6055, + &pci_dev_info_10b7_6056, + &pci_dev_info_10b7_6560, + &pci_dev_info_10b7_6561, + &pci_dev_info_10b7_6562, + &pci_dev_info_10b7_6563, + &pci_dev_info_10b7_6564, + &pci_dev_info_10b7_7646, + &pci_dev_info_10b7_7940, + &pci_dev_info_10b7_7980, + &pci_dev_info_10b7_7990, + &pci_dev_info_10b7_8811, + &pci_dev_info_10b7_9000, + &pci_dev_info_10b7_9001, + &pci_dev_info_10b7_9004, + &pci_dev_info_10b7_9005, + &pci_dev_info_10b7_9006, + &pci_dev_info_10b7_900a, + &pci_dev_info_10b7_9050, + &pci_dev_info_10b7_9051, + &pci_dev_info_10b7_9055, + &pci_dev_info_10b7_9056, + &pci_dev_info_10b7_9058, + &pci_dev_info_10b7_905a, + &pci_dev_info_10b7_9200, + &pci_dev_info_10b7_9201, + &pci_dev_info_10b7_9300, + &pci_dev_info_10b7_9800, + &pci_dev_info_10b7_9805, + &pci_dev_info_10b7_9900, + &pci_dev_info_10b7_9902, + &pci_dev_info_10b7_9903, + &pci_dev_info_10b7_9904, + &pci_dev_info_10b7_9905, + &pci_dev_info_10b7_9908, + &pci_dev_info_10b7_9909, + &pci_dev_info_10b7_990b, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10b8[] = { + &pci_dev_info_10b8_0005, + &pci_dev_info_10b8_0006, + &pci_dev_info_10b8_1000, + &pci_dev_info_10b8_1001, + &pci_dev_info_10b8_a011, + &pci_dev_info_10b8_b106, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_10b9[] = { + &pci_dev_info_10b9_0111, + &pci_dev_info_10b9_1435, + &pci_dev_info_10b9_1445, + &pci_dev_info_10b9_1449, + &pci_dev_info_10b9_1451, + &pci_dev_info_10b9_1461, + &pci_dev_info_10b9_1489, + &pci_dev_info_10b9_1511, + &pci_dev_info_10b9_1512, + &pci_dev_info_10b9_1513, + &pci_dev_info_10b9_1521, + &pci_dev_info_10b9_1523, + &pci_dev_info_10b9_1531, + &pci_dev_info_10b9_1533, + &pci_dev_info_10b9_1541, + &pci_dev_info_10b9_1543, + &pci_dev_info_10b9_1563, + &pci_dev_info_10b9_1621, + &pci_dev_info_10b9_1631, + &pci_dev_info_10b9_1632, + &pci_dev_info_10b9_1641, + &pci_dev_info_10b9_1644, + &pci_dev_info_10b9_1646, + &pci_dev_info_10b9_1647, + &pci_dev_info_10b9_1651, + &pci_dev_info_10b9_1671, + &pci_dev_info_10b9_1681, + &pci_dev_info_10b9_1687, + &pci_dev_info_10b9_3141, + &pci_dev_info_10b9_3143, + &pci_dev_info_10b9_3145, + &pci_dev_info_10b9_3147, + &pci_dev_info_10b9_3149, + &pci_dev_info_10b9_3151, + &pci_dev_info_10b9_3307, + &pci_dev_info_10b9_3309, + &pci_dev_info_10b9_5212, + &pci_dev_info_10b9_5215, + &pci_dev_info_10b9_5217, + &pci_dev_info_10b9_5219, + &pci_dev_info_10b9_5225, + &pci_dev_info_10b9_5229, + &pci_dev_info_10b9_5235, + &pci_dev_info_10b9_5237, + &pci_dev_info_10b9_5239, + &pci_dev_info_10b9_5243, + &pci_dev_info_10b9_5247, + &pci_dev_info_10b9_5249, + &pci_dev_info_10b9_5251, + &pci_dev_info_10b9_5253, + &pci_dev_info_10b9_5261, + &pci_dev_info_10b9_5451, + &pci_dev_info_10b9_5453, + &pci_dev_info_10b9_5455, + &pci_dev_info_10b9_5457, + &pci_dev_info_10b9_5459, + &pci_dev_info_10b9_545a, + &pci_dev_info_10b9_5471, + &pci_dev_info_10b9_5473, + &pci_dev_info_10b9_7101, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10ba[] = { + &pci_dev_info_10ba_0301, + NULL +}; +#endif +#define pci_dev_list_10bb NULL +#define pci_dev_list_10bc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10bd[] = { + &pci_dev_info_10bd_0e34, + NULL +}; +#endif +#define pci_dev_list_10be NULL +#define pci_dev_list_10bf NULL +#define pci_dev_list_10c0 NULL +#define pci_dev_list_10c1 NULL +#define pci_dev_list_10c2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10c3[] = { + &pci_dev_info_10c3_1100, + NULL +}; +#endif +#define pci_dev_list_10c4 NULL +#define pci_dev_list_10c5 NULL +#define pci_dev_list_10c6 NULL +#define pci_dev_list_10c7 NULL +static const pciDeviceInfo *pci_dev_list_10c8[] = { + &pci_dev_info_10c8_0001, + &pci_dev_info_10c8_0002, + &pci_dev_info_10c8_0003, + &pci_dev_info_10c8_0004, + &pci_dev_info_10c8_0005, + &pci_dev_info_10c8_0006, + &pci_dev_info_10c8_0016, + &pci_dev_info_10c8_0025, + &pci_dev_info_10c8_0083, + &pci_dev_info_10c8_8005, + &pci_dev_info_10c8_8006, + &pci_dev_info_10c8_8016, + NULL +}; +#define pci_dev_list_10c9 NULL +#define pci_dev_list_10ca NULL +#define pci_dev_list_10cb NULL +#define pci_dev_list_10cc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10cd[] = { + &pci_dev_info_10cd_1100, + &pci_dev_info_10cd_1200, + &pci_dev_info_10cd_1300, + &pci_dev_info_10cd_2300, + &pci_dev_info_10cd_2500, + NULL +}; +#endif +#define pci_dev_list_10ce NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10cf[] = { + &pci_dev_info_10cf_2001, + NULL +}; +#endif +#define pci_dev_list_10d0 NULL +#define pci_dev_list_10d1 NULL +#define pci_dev_list_10d2 NULL +#define pci_dev_list_10d3 NULL +#define pci_dev_list_10d4 NULL +#define pci_dev_list_10d5 NULL +#define pci_dev_list_10d6 NULL +#define pci_dev_list_10d7 NULL +#define pci_dev_list_10d8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10d9[] = { + &pci_dev_info_10d9_0512, + &pci_dev_info_10d9_0531, + &pci_dev_info_10d9_8625, + &pci_dev_info_10d9_8888, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10da[] = { + &pci_dev_info_10da_0508, + &pci_dev_info_10da_3390, + NULL +}; +#endif +#define pci_dev_list_10db NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10dc[] = { + &pci_dev_info_10dc_0001, + &pci_dev_info_10dc_0002, + &pci_dev_info_10dc_0021, + &pci_dev_info_10dc_0022, + &pci_dev_info_10dc_10dc, + NULL +}; +#endif +#define pci_dev_list_10dd NULL +static const pciDeviceInfo *pci_dev_list_10de[] = { + &pci_dev_info_10de_0008, + &pci_dev_info_10de_0009, + &pci_dev_info_10de_0010, + &pci_dev_info_10de_0020, + &pci_dev_info_10de_0028, + &pci_dev_info_10de_0029, + &pci_dev_info_10de_002a, + &pci_dev_info_10de_002b, + &pci_dev_info_10de_002c, + &pci_dev_info_10de_002d, + &pci_dev_info_10de_002e, + &pci_dev_info_10de_002f, + &pci_dev_info_10de_0060, + &pci_dev_info_10de_0064, + &pci_dev_info_10de_0065, + &pci_dev_info_10de_0066, + &pci_dev_info_10de_0067, + &pci_dev_info_10de_0068, + &pci_dev_info_10de_006a, + &pci_dev_info_10de_006b, + &pci_dev_info_10de_006e, + &pci_dev_info_10de_00a0, + &pci_dev_info_10de_0100, + &pci_dev_info_10de_0101, + &pci_dev_info_10de_0103, + &pci_dev_info_10de_0110, + &pci_dev_info_10de_0111, + &pci_dev_info_10de_0112, + &pci_dev_info_10de_0113, + &pci_dev_info_10de_0150, + &pci_dev_info_10de_0151, + &pci_dev_info_10de_0152, + &pci_dev_info_10de_0153, + &pci_dev_info_10de_0170, + &pci_dev_info_10de_0171, + &pci_dev_info_10de_0172, + &pci_dev_info_10de_0173, + &pci_dev_info_10de_0174, + &pci_dev_info_10de_0175, + &pci_dev_info_10de_0176, + &pci_dev_info_10de_0178, + &pci_dev_info_10de_0179, + &pci_dev_info_10de_017a, + &pci_dev_info_10de_017b, + &pci_dev_info_10de_017c, + &pci_dev_info_10de_0181, + &pci_dev_info_10de_0182, + &pci_dev_info_10de_0183, + &pci_dev_info_10de_0188, + &pci_dev_info_10de_018a, + &pci_dev_info_10de_018b, + &pci_dev_info_10de_01a0, + &pci_dev_info_10de_01a4, + &pci_dev_info_10de_01ab, + &pci_dev_info_10de_01ac, + &pci_dev_info_10de_01ad, + &pci_dev_info_10de_01b1, + &pci_dev_info_10de_01b2, + &pci_dev_info_10de_01b4, + &pci_dev_info_10de_01b7, + &pci_dev_info_10de_01b8, + &pci_dev_info_10de_01bc, + &pci_dev_info_10de_01c1, + &pci_dev_info_10de_01c2, + &pci_dev_info_10de_01c3, + &pci_dev_info_10de_01e8, + &pci_dev_info_10de_01f0, + &pci_dev_info_10de_0200, + &pci_dev_info_10de_0201, + &pci_dev_info_10de_0202, + &pci_dev_info_10de_0203, + &pci_dev_info_10de_0250, + &pci_dev_info_10de_0251, + &pci_dev_info_10de_0252, + &pci_dev_info_10de_0253, + &pci_dev_info_10de_0258, + &pci_dev_info_10de_0259, + &pci_dev_info_10de_025b, + &pci_dev_info_10de_0280, + &pci_dev_info_10de_0281, + &pci_dev_info_10de_0282, + &pci_dev_info_10de_0288, + &pci_dev_info_10de_0289, + &pci_dev_info_10de_0300, + &pci_dev_info_10de_0301, + &pci_dev_info_10de_0302, + &pci_dev_info_10de_0308, + &pci_dev_info_10de_0309, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10df[] = { + &pci_dev_info_10df_1ae5, + &pci_dev_info_10df_f085, + &pci_dev_info_10df_f095, + &pci_dev_info_10df_f098, + &pci_dev_info_10df_f700, + &pci_dev_info_10df_f800, + &pci_dev_info_10df_f900, + &pci_dev_info_10df_f980, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_10e0[] = { + &pci_dev_info_10e0_5026, + &pci_dev_info_10e0_5027, + &pci_dev_info_10e0_5028, + &pci_dev_info_10e0_8849, + &pci_dev_info_10e0_8853, + &pci_dev_info_10e0_9128, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10e1[] = { + &pci_dev_info_10e1_0391, + &pci_dev_info_10e1_690c, + &pci_dev_info_10e1_dc29, + NULL +}; +#endif +#define pci_dev_list_10e2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10e3[] = { + &pci_dev_info_10e3_0000, + &pci_dev_info_10e3_0860, + &pci_dev_info_10e3_0862, + NULL +}; +#endif +#define pci_dev_list_10e4 NULL +#define pci_dev_list_10e5 NULL +#define pci_dev_list_10e6 NULL +#define pci_dev_list_10e7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10e8[] = { + &pci_dev_info_10e8_2011, + &pci_dev_info_10e8_4750, + &pci_dev_info_10e8_5920, + &pci_dev_info_10e8_8043, + &pci_dev_info_10e8_8062, + &pci_dev_info_10e8_807d, + &pci_dev_info_10e8_8088, + &pci_dev_info_10e8_8089, + &pci_dev_info_10e8_809c, + &pci_dev_info_10e8_80d7, + &pci_dev_info_10e8_80d9, + &pci_dev_info_10e8_80da, + &pci_dev_info_10e8_811a, + &pci_dev_info_10e8_8170, + &pci_dev_info_10e8_82db, + NULL +}; +#endif +#define pci_dev_list_10e9 NULL +static const pciDeviceInfo *pci_dev_list_10ea[] = { + &pci_dev_info_10ea_1680, + &pci_dev_info_10ea_1682, + &pci_dev_info_10ea_1683, + &pci_dev_info_10ea_2000, + &pci_dev_info_10ea_2010, + &pci_dev_info_10ea_5000, + &pci_dev_info_10ea_5050, + &pci_dev_info_10ea_5202, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10eb[] = { + &pci_dev_info_10eb_0101, + &pci_dev_info_10eb_8111, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10ec[] = { + &pci_dev_info_10ec_8029, + &pci_dev_info_10ec_8129, + &pci_dev_info_10ec_8138, + &pci_dev_info_10ec_8139, + &pci_dev_info_10ec_8169, + &pci_dev_info_10ec_8197, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10ed[] = { + &pci_dev_info_10ed_7310, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10ee[] = { + &pci_dev_info_10ee_3fc0, + &pci_dev_info_10ee_3fc1, + &pci_dev_info_10ee_3fc2, + &pci_dev_info_10ee_3fc3, + &pci_dev_info_10ee_3fc4, + &pci_dev_info_10ee_3fc5, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10ef[] = { + &pci_dev_info_10ef_8154, + NULL +}; +#endif +#define pci_dev_list_10f0 NULL +#define pci_dev_list_10f1 NULL +#define pci_dev_list_10f2 NULL +#define pci_dev_list_10f3 NULL +#define pci_dev_list_10f4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10f5[] = { + &pci_dev_info_10f5_a001, + NULL +}; +#endif +#define pci_dev_list_10f6 NULL +#define pci_dev_list_10f7 NULL +#define pci_dev_list_10f8 NULL +#define pci_dev_list_10f9 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10fa[] = { + &pci_dev_info_10fa_000c, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10fb[] = { + &pci_dev_info_10fb_186f, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_10fc[] = { + &pci_dev_info_10fc_0003, + &pci_dev_info_10fc_0005, + NULL +}; +#endif +#define pci_dev_list_10fd NULL +#define pci_dev_list_10fe NULL +#define pci_dev_list_10ff NULL +#define pci_dev_list_1100 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1101[] = { + &pci_dev_info_1101_1060, + &pci_dev_info_1101_9100, + &pci_dev_info_1101_9400, + &pci_dev_info_1101_9401, + &pci_dev_info_1101_9500, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1102[] = { + &pci_dev_info_1102_0002, + &pci_dev_info_1102_0004, + &pci_dev_info_1102_0006, + &pci_dev_info_1102_4001, + &pci_dev_info_1102_7002, + &pci_dev_info_1102_7003, + &pci_dev_info_1102_7004, + &pci_dev_info_1102_8064, + &pci_dev_info_1102_8938, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1103[] = { + &pci_dev_info_1103_0003, + &pci_dev_info_1103_0004, + &pci_dev_info_1103_0005, + &pci_dev_info_1103_0006, + &pci_dev_info_1103_0007, + &pci_dev_info_1103_0008, + NULL +}; +#endif +#define pci_dev_list_1104 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1105[] = { + &pci_dev_info_1105_1105, + &pci_dev_info_1105_8300, + &pci_dev_info_1105_8400, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_1106[] = { + &pci_dev_info_1106_0102, + &pci_dev_info_1106_0130, + &pci_dev_info_1106_0305, + &pci_dev_info_1106_0391, + &pci_dev_info_1106_0501, + &pci_dev_info_1106_0505, + &pci_dev_info_1106_0561, + &pci_dev_info_1106_0571, + &pci_dev_info_1106_0576, + &pci_dev_info_1106_0585, + &pci_dev_info_1106_0586, + &pci_dev_info_1106_0595, + &pci_dev_info_1106_0596, + &pci_dev_info_1106_0597, + &pci_dev_info_1106_0598, + &pci_dev_info_1106_0601, + &pci_dev_info_1106_0605, + &pci_dev_info_1106_0680, + &pci_dev_info_1106_0686, + &pci_dev_info_1106_0691, + &pci_dev_info_1106_0693, + &pci_dev_info_1106_0698, + &pci_dev_info_1106_0926, + &pci_dev_info_1106_1000, + &pci_dev_info_1106_1106, + &pci_dev_info_1106_1571, + &pci_dev_info_1106_1595, + &pci_dev_info_1106_3038, + &pci_dev_info_1106_3040, + &pci_dev_info_1106_3043, + &pci_dev_info_1106_3044, + &pci_dev_info_1106_3050, + &pci_dev_info_1106_3051, + &pci_dev_info_1106_3057, + &pci_dev_info_1106_3058, + &pci_dev_info_1106_3059, + &pci_dev_info_1106_3065, + &pci_dev_info_1106_3068, + &pci_dev_info_1106_3074, + &pci_dev_info_1106_3091, + &pci_dev_info_1106_3099, + &pci_dev_info_1106_3101, + &pci_dev_info_1106_3102, + &pci_dev_info_1106_3103, + &pci_dev_info_1106_3104, + &pci_dev_info_1106_3106, + &pci_dev_info_1106_3109, + &pci_dev_info_1106_3112, + &pci_dev_info_1106_3116, + &pci_dev_info_1106_3122, + &pci_dev_info_1106_3123, + &pci_dev_info_1106_3128, + &pci_dev_info_1106_3133, + &pci_dev_info_1106_3147, + &pci_dev_info_1106_3148, + &pci_dev_info_1106_3156, + &pci_dev_info_1106_3168, + &pci_dev_info_1106_3177, + &pci_dev_info_1106_3189, + &pci_dev_info_1106_5030, + &pci_dev_info_1106_6100, + &pci_dev_info_1106_8231, + &pci_dev_info_1106_8235, + &pci_dev_info_1106_8305, + &pci_dev_info_1106_8391, + &pci_dev_info_1106_8501, + &pci_dev_info_1106_8596, + &pci_dev_info_1106_8597, + &pci_dev_info_1106_8598, + &pci_dev_info_1106_8601, + &pci_dev_info_1106_8605, + &pci_dev_info_1106_8691, + &pci_dev_info_1106_8693, + &pci_dev_info_1106_b091, + &pci_dev_info_1106_b099, + &pci_dev_info_1106_b101, + &pci_dev_info_1106_b102, + &pci_dev_info_1106_b103, + &pci_dev_info_1106_b112, + &pci_dev_info_1106_b168, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1107[] = { + &pci_dev_info_1107_0576, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1108[] = { + &pci_dev_info_1108_0100, + &pci_dev_info_1108_0101, + &pci_dev_info_1108_0105, + &pci_dev_info_1108_0108, + &pci_dev_info_1108_0138, + &pci_dev_info_1108_0139, + &pci_dev_info_1108_013c, + &pci_dev_info_1108_013d, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1109[] = { + &pci_dev_info_1109_1400, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_110a[] = { + &pci_dev_info_110a_0002, + &pci_dev_info_110a_0005, + &pci_dev_info_110a_2102, + &pci_dev_info_110a_4942, + &pci_dev_info_110a_6120, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_110b[] = { + &pci_dev_info_110b_0001, + &pci_dev_info_110b_0004, + NULL +}; +#endif +#define pci_dev_list_110c NULL +#define pci_dev_list_110d NULL +#define pci_dev_list_110e NULL +#define pci_dev_list_110f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1110[] = { + &pci_dev_info_1110_6037, + &pci_dev_info_1110_6073, + NULL +}; +#endif +#define pci_dev_list_1111 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1112[] = { + &pci_dev_info_1112_2200, + &pci_dev_info_1112_2300, + &pci_dev_info_1112_2340, + &pci_dev_info_1112_2400, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1113[] = { + &pci_dev_info_1113_1211, + &pci_dev_info_1113_1216, + &pci_dev_info_1113_1217, + &pci_dev_info_1113_5105, + &pci_dev_info_1113_9211, + &pci_dev_info_1113_9511, + NULL +}; +#endif +#define pci_dev_list_1114 NULL +#define pci_dev_list_1115 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1116[] = { + &pci_dev_info_1116_0022, + &pci_dev_info_1116_0023, + &pci_dev_info_1116_0024, + &pci_dev_info_1116_0025, + &pci_dev_info_1116_0026, + &pci_dev_info_1116_0027, + &pci_dev_info_1116_0028, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1117[] = { + &pci_dev_info_1117_9500, + &pci_dev_info_1117_9501, + NULL +}; +#endif +#define pci_dev_list_1118 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1119[] = { + &pci_dev_info_1119_0000, + &pci_dev_info_1119_0001, + &pci_dev_info_1119_0002, + &pci_dev_info_1119_0003, + &pci_dev_info_1119_0004, + &pci_dev_info_1119_0005, + &pci_dev_info_1119_0006, + &pci_dev_info_1119_0007, + &pci_dev_info_1119_0008, + &pci_dev_info_1119_0009, + &pci_dev_info_1119_000a, + &pci_dev_info_1119_000b, + &pci_dev_info_1119_000c, + &pci_dev_info_1119_000d, + &pci_dev_info_1119_0100, + &pci_dev_info_1119_0101, + &pci_dev_info_1119_0102, + &pci_dev_info_1119_0103, + &pci_dev_info_1119_0104, + &pci_dev_info_1119_0105, + &pci_dev_info_1119_0110, + &pci_dev_info_1119_0111, + &pci_dev_info_1119_0112, + &pci_dev_info_1119_0113, + &pci_dev_info_1119_0114, + &pci_dev_info_1119_0115, + &pci_dev_info_1119_0118, + &pci_dev_info_1119_0119, + &pci_dev_info_1119_011a, + &pci_dev_info_1119_011b, + &pci_dev_info_1119_0120, + &pci_dev_info_1119_0121, + &pci_dev_info_1119_0122, + &pci_dev_info_1119_0123, + &pci_dev_info_1119_0124, + &pci_dev_info_1119_0125, + &pci_dev_info_1119_0136, + &pci_dev_info_1119_0137, + &pci_dev_info_1119_0138, + &pci_dev_info_1119_0139, + &pci_dev_info_1119_013a, + &pci_dev_info_1119_013b, + &pci_dev_info_1119_013c, + &pci_dev_info_1119_013d, + &pci_dev_info_1119_013e, + &pci_dev_info_1119_013f, + &pci_dev_info_1119_0166, + &pci_dev_info_1119_0167, + &pci_dev_info_1119_0168, + &pci_dev_info_1119_0169, + &pci_dev_info_1119_016a, + &pci_dev_info_1119_016b, + &pci_dev_info_1119_016c, + &pci_dev_info_1119_016d, + &pci_dev_info_1119_016e, + &pci_dev_info_1119_016f, + &pci_dev_info_1119_01d6, + &pci_dev_info_1119_01d7, + &pci_dev_info_1119_01f6, + &pci_dev_info_1119_01f7, + &pci_dev_info_1119_01fc, + &pci_dev_info_1119_01fd, + &pci_dev_info_1119_01fe, + &pci_dev_info_1119_01ff, + &pci_dev_info_1119_0210, + &pci_dev_info_1119_0211, + &pci_dev_info_1119_0260, + &pci_dev_info_1119_0261, + &pci_dev_info_1119_0300, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_111a[] = { + &pci_dev_info_111a_0000, + &pci_dev_info_111a_0002, + &pci_dev_info_111a_0003, + &pci_dev_info_111a_0005, + &pci_dev_info_111a_0007, + NULL +}; +#endif +#define pci_dev_list_111b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_111c[] = { + &pci_dev_info_111c_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_111d[] = { + &pci_dev_info_111d_0001, + &pci_dev_info_111d_0003, + NULL +}; +#endif +#define pci_dev_list_111e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_111f[] = { + &pci_dev_info_111f_4a47, + &pci_dev_info_111f_5243, + NULL +}; +#endif +#define pci_dev_list_1120 NULL +#define pci_dev_list_1121 NULL +#define pci_dev_list_1122 NULL +#define pci_dev_list_1123 NULL +#define pci_dev_list_1124 NULL +#define pci_dev_list_1125 NULL +#define pci_dev_list_1126 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1127[] = { + &pci_dev_info_1127_0200, + &pci_dev_info_1127_0210, + &pci_dev_info_1127_0250, + &pci_dev_info_1127_0300, + &pci_dev_info_1127_0310, + &pci_dev_info_1127_0400, + NULL +}; +#endif +#define pci_dev_list_1129 NULL +#define pci_dev_list_112a NULL +#define pci_dev_list_112b NULL +#define pci_dev_list_112c NULL +#define pci_dev_list_112d NULL +#define pci_dev_list_112e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_112f[] = { + &pci_dev_info_112f_0000, + &pci_dev_info_112f_0001, + NULL +}; +#endif +#define pci_dev_list_1130 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1131[] = { + &pci_dev_info_1131_1561, + &pci_dev_info_1131_1562, + &pci_dev_info_1131_3400, + &pci_dev_info_1131_7130, + &pci_dev_info_1131_7133, + &pci_dev_info_1131_7134, + &pci_dev_info_1131_7135, + &pci_dev_info_1131_7145, + &pci_dev_info_1131_7146, + NULL +}; +#endif +#define pci_dev_list_1132 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1133[] = { + &pci_dev_info_1133_7901, + &pci_dev_info_1133_7902, + &pci_dev_info_1133_7911, + &pci_dev_info_1133_7912, + &pci_dev_info_1133_7941, + &pci_dev_info_1133_7942, + &pci_dev_info_1133_7943, + &pci_dev_info_1133_7944, + &pci_dev_info_1133_b921, + &pci_dev_info_1133_b922, + &pci_dev_info_1133_b923, + &pci_dev_info_1133_e001, + &pci_dev_info_1133_e002, + &pci_dev_info_1133_e003, + &pci_dev_info_1133_e004, + &pci_dev_info_1133_e005, + &pci_dev_info_1133_e00b, + &pci_dev_info_1133_e010, + &pci_dev_info_1133_e012, + &pci_dev_info_1133_e014, + &pci_dev_info_1133_e018, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1134[] = { + &pci_dev_info_1134_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1135[] = { + &pci_dev_info_1135_0001, + NULL +}; +#endif +#define pci_dev_list_1136 NULL +#define pci_dev_list_1137 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1138[] = { + &pci_dev_info_1138_8905, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1139[] = { + &pci_dev_info_1139_0001, + NULL +}; +#endif +#define pci_dev_list_113a NULL +#define pci_dev_list_113b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_113c[] = { + &pci_dev_info_113c_0000, + &pci_dev_info_113c_0001, + &pci_dev_info_113c_0911, + &pci_dev_info_113c_0912, + &pci_dev_info_113c_0913, + &pci_dev_info_113c_0914, + NULL +}; +#endif +#define pci_dev_list_113d NULL +#define pci_dev_list_113e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_113f[] = { + &pci_dev_info_113f_0808, + &pci_dev_info_113f_1010, + &pci_dev_info_113f_80c0, + &pci_dev_info_113f_80c4, + &pci_dev_info_113f_80c8, + &pci_dev_info_113f_8888, + &pci_dev_info_113f_9090, + NULL +}; +#endif +#define pci_dev_list_1140 NULL +#define pci_dev_list_1141 NULL +static const pciDeviceInfo *pci_dev_list_1142[] = { + &pci_dev_info_1142_3210, + &pci_dev_info_1142_6422, + &pci_dev_info_1142_6424, + &pci_dev_info_1142_6425, + &pci_dev_info_1142_643d, + NULL +}; +#define pci_dev_list_1143 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1144[] = { + &pci_dev_info_1144_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1145[] = { + &pci_dev_info_1145_8007, + &pci_dev_info_1145_f007, + &pci_dev_info_1145_f010, + &pci_dev_info_1145_f012, + &pci_dev_info_1145_f013, + &pci_dev_info_1145_f015, + NULL +}; +#endif +#define pci_dev_list_1146 NULL +#define pci_dev_list_1147 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1148[] = { + &pci_dev_info_1148_4000, + &pci_dev_info_1148_4200, + &pci_dev_info_1148_4300, + &pci_dev_info_1148_4320, + &pci_dev_info_1148_4400, + NULL +}; +#endif +#define pci_dev_list_1149 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_114a[] = { + &pci_dev_info_114a_5579, + &pci_dev_info_114a_5587, + &pci_dev_info_114a_6504, + &pci_dev_info_114a_7587, + NULL +}; +#endif +#define pci_dev_list_114b NULL +#define pci_dev_list_114c NULL +#define pci_dev_list_114d NULL +#define pci_dev_list_114e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_114f[] = { + &pci_dev_info_114f_0002, + &pci_dev_info_114f_0003, + &pci_dev_info_114f_0004, + &pci_dev_info_114f_0005, + &pci_dev_info_114f_0006, + &pci_dev_info_114f_0009, + &pci_dev_info_114f_000a, + &pci_dev_info_114f_000c, + &pci_dev_info_114f_000d, + &pci_dev_info_114f_0011, + &pci_dev_info_114f_0012, + &pci_dev_info_114f_0013, + &pci_dev_info_114f_0014, + &pci_dev_info_114f_0015, + &pci_dev_info_114f_0016, + &pci_dev_info_114f_0017, + &pci_dev_info_114f_001a, + &pci_dev_info_114f_001b, + &pci_dev_info_114f_001d, + &pci_dev_info_114f_0023, + &pci_dev_info_114f_0024, + &pci_dev_info_114f_0026, + &pci_dev_info_114f_0027, + &pci_dev_info_114f_0034, + &pci_dev_info_114f_0035, + &pci_dev_info_114f_0040, + &pci_dev_info_114f_0042, + &pci_dev_info_114f_0070, + &pci_dev_info_114f_0071, + &pci_dev_info_114f_0072, + &pci_dev_info_114f_0073, + &pci_dev_info_114f_6001, + NULL +}; +#endif +#define pci_dev_list_1150 NULL +#define pci_dev_list_1151 NULL +#define pci_dev_list_1152 NULL +#define pci_dev_list_1153 NULL +#define pci_dev_list_1154 NULL +#define pci_dev_list_1155 NULL +#define pci_dev_list_1156 NULL +#define pci_dev_list_1157 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1158[] = { + &pci_dev_info_1158_3011, + &pci_dev_info_1158_9050, + &pci_dev_info_1158_9051, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1159[] = { + &pci_dev_info_1159_0001, + NULL +}; +#endif +#define pci_dev_list_115a NULL +#define pci_dev_list_115b NULL +#define pci_dev_list_115c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_115d[] = { + &pci_dev_info_115d_0003, + &pci_dev_info_115d_0005, + &pci_dev_info_115d_0007, + &pci_dev_info_115d_000b, + &pci_dev_info_115d_000c, + &pci_dev_info_115d_000f, + &pci_dev_info_115d_0101, + &pci_dev_info_115d_0103, + NULL +}; +#endif +#define pci_dev_list_115e NULL +#define pci_dev_list_115f NULL +#define pci_dev_list_1160 NULL +#define pci_dev_list_1161 NULL +#define pci_dev_list_1162 NULL +static const pciDeviceInfo *pci_dev_list_1163[] = { + &pci_dev_info_1163_0001, + &pci_dev_info_1163_2000, + NULL +}; +#define pci_dev_list_1164 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1165[] = { + &pci_dev_info_1165_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1166[] = { + &pci_dev_info_1166_0005, + &pci_dev_info_1166_0007, + &pci_dev_info_1166_0008, + &pci_dev_info_1166_0009, + &pci_dev_info_1166_0010, + &pci_dev_info_1166_0011, + &pci_dev_info_1166_0012, + &pci_dev_info_1166_0013, + &pci_dev_info_1166_0014, + &pci_dev_info_1166_0015, + &pci_dev_info_1166_0016, + &pci_dev_info_1166_0017, + &pci_dev_info_1166_0200, + &pci_dev_info_1166_0201, + &pci_dev_info_1166_0203, + &pci_dev_info_1166_0211, + &pci_dev_info_1166_0212, + &pci_dev_info_1166_0213, + &pci_dev_info_1166_0220, + &pci_dev_info_1166_0221, + &pci_dev_info_1166_0225, + &pci_dev_info_1166_0227, + NULL +}; +#endif +#define pci_dev_list_1167 NULL +#define pci_dev_list_1168 NULL +#define pci_dev_list_1169 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_116a[] = { + &pci_dev_info_116a_6100, + &pci_dev_info_116a_6800, + &pci_dev_info_116a_7100, + &pci_dev_info_116a_7800, + NULL +}; +#endif +#define pci_dev_list_116b NULL +#define pci_dev_list_116c NULL +#define pci_dev_list_116d NULL +#define pci_dev_list_116e NULL +#define pci_dev_list_116f NULL +#define pci_dev_list_1170 NULL +#define pci_dev_list_1171 NULL +#define pci_dev_list_1172 NULL +#define pci_dev_list_1173 NULL +#define pci_dev_list_1174 NULL +#define pci_dev_list_1175 NULL +#define pci_dev_list_1176 NULL +#define pci_dev_list_1177 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1178[] = { + &pci_dev_info_1178_afa1, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1179[] = { + &pci_dev_info_1179_0103, + &pci_dev_info_1179_0404, + &pci_dev_info_1179_0406, + &pci_dev_info_1179_0407, + &pci_dev_info_1179_0601, + &pci_dev_info_1179_0603, + &pci_dev_info_1179_060a, + &pci_dev_info_1179_060f, + &pci_dev_info_1179_0617, + &pci_dev_info_1179_0618, + &pci_dev_info_1179_0701, + &pci_dev_info_1179_0804, + &pci_dev_info_1179_0805, + &pci_dev_info_1179_0d01, + NULL +}; +#endif +#define pci_dev_list_117a NULL +#define pci_dev_list_117b NULL +#define pci_dev_list_117c NULL +#define pci_dev_list_117d NULL +#define pci_dev_list_117e NULL +#define pci_dev_list_117f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1180[] = { + &pci_dev_info_1180_0465, + &pci_dev_info_1180_0466, + &pci_dev_info_1180_0475, + &pci_dev_info_1180_0476, + &pci_dev_info_1180_0477, + &pci_dev_info_1180_0478, + &pci_dev_info_1180_0522, + &pci_dev_info_1180_0551, + &pci_dev_info_1180_0552, + NULL +}; +#endif +#define pci_dev_list_1181 NULL +#define pci_dev_list_1183 NULL +#define pci_dev_list_1184 NULL +#define pci_dev_list_1185 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1186[] = { + &pci_dev_info_1186_0100, + &pci_dev_info_1186_1002, + &pci_dev_info_1186_1300, + &pci_dev_info_1186_1340, + &pci_dev_info_1186_1561, + &pci_dev_info_1186_4000, + NULL +}; +#endif +#define pci_dev_list_1187 NULL +#define pci_dev_list_1188 NULL +#define pci_dev_list_1189 NULL +#define pci_dev_list_118a NULL +#define pci_dev_list_118b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_118c[] = { + &pci_dev_info_118c_0014, + &pci_dev_info_118c_1117, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_118d[] = { + &pci_dev_info_118d_0001, + &pci_dev_info_118d_0012, + &pci_dev_info_118d_0014, + &pci_dev_info_118d_0024, + &pci_dev_info_118d_0044, + &pci_dev_info_118d_0112, + &pci_dev_info_118d_0114, + &pci_dev_info_118d_0124, + &pci_dev_info_118d_0144, + &pci_dev_info_118d_0212, + &pci_dev_info_118d_0214, + &pci_dev_info_118d_0224, + &pci_dev_info_118d_0244, + &pci_dev_info_118d_0312, + &pci_dev_info_118d_0314, + &pci_dev_info_118d_0324, + &pci_dev_info_118d_0344, + NULL +}; +#endif +#define pci_dev_list_118e NULL +#define pci_dev_list_118f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1190[] = { + &pci_dev_info_1190_c731, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1191[] = { + &pci_dev_info_1191_0003, + &pci_dev_info_1191_0004, + &pci_dev_info_1191_0005, + &pci_dev_info_1191_0006, + &pci_dev_info_1191_0007, + &pci_dev_info_1191_0008, + &pci_dev_info_1191_0009, + &pci_dev_info_1191_8002, + &pci_dev_info_1191_8010, + &pci_dev_info_1191_8020, + &pci_dev_info_1191_8030, + &pci_dev_info_1191_8040, + &pci_dev_info_1191_8050, + NULL +}; +#endif +#define pci_dev_list_1192 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1193[] = { + &pci_dev_info_1193_0001, + &pci_dev_info_1193_0002, + NULL +}; +#endif +#define pci_dev_list_1194 NULL +#define pci_dev_list_1195 NULL +#define pci_dev_list_1196 NULL +#define pci_dev_list_1197 NULL +#define pci_dev_list_1198 NULL +#define pci_dev_list_1199 NULL +#define pci_dev_list_119a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_119b[] = { + &pci_dev_info_119b_1221, + NULL +}; +#endif +#define pci_dev_list_119c NULL +#define pci_dev_list_119d NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_119e[] = { + &pci_dev_info_119e_0001, + &pci_dev_info_119e_0003, + NULL +}; +#endif +#define pci_dev_list_119f NULL +#define pci_dev_list_11a0 NULL +#define pci_dev_list_11a1 NULL +#define pci_dev_list_11a2 NULL +#define pci_dev_list_11a3 NULL +#define pci_dev_list_11a4 NULL +#define pci_dev_list_11a5 NULL +#define pci_dev_list_11a6 NULL +#define pci_dev_list_11a7 NULL +#define pci_dev_list_11a8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11a9[] = { + &pci_dev_info_11a9_4240, + NULL +}; +#endif +#define pci_dev_list_11aa NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11ab[] = { + &pci_dev_info_11ab_0146, + &pci_dev_info_11ab_4611, + &pci_dev_info_11ab_4620, + &pci_dev_info_11ab_4801, + &pci_dev_info_11ab_f003, + NULL +}; +#endif +#define pci_dev_list_11ac NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11ad[] = { + &pci_dev_info_11ad_0002, + &pci_dev_info_11ad_c115, + NULL +}; +#endif +#define pci_dev_list_11ae NULL +#define pci_dev_list_11af NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11b0[] = { + &pci_dev_info_11b0_0002, + &pci_dev_info_11b0_0292, + &pci_dev_info_11b0_0960, + &pci_dev_info_11b0_c960, + NULL +}; +#endif +#define pci_dev_list_11b1 NULL +#define pci_dev_list_11b2 NULL +#define pci_dev_list_11b3 NULL +#define pci_dev_list_11b4 NULL +#define pci_dev_list_11b5 NULL +#define pci_dev_list_11b6 NULL +#define pci_dev_list_11b7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11b8[] = { + &pci_dev_info_11b8_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11b9[] = { + &pci_dev_info_11b9_c0ed, + NULL +}; +#endif +#define pci_dev_list_11ba NULL +#define pci_dev_list_11bb NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11bc[] = { + &pci_dev_info_11bc_0001, + NULL +}; +#endif +#define pci_dev_list_11bd NULL +#define pci_dev_list_11be NULL +#define pci_dev_list_11bf NULL +#define pci_dev_list_11c0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11c1[] = { + &pci_dev_info_11c1_0440, + &pci_dev_info_11c1_0441, + &pci_dev_info_11c1_0442, + &pci_dev_info_11c1_0443, + &pci_dev_info_11c1_0444, + &pci_dev_info_11c1_0445, + &pci_dev_info_11c1_0446, + &pci_dev_info_11c1_0447, + &pci_dev_info_11c1_0448, + &pci_dev_info_11c1_0449, + &pci_dev_info_11c1_044a, + &pci_dev_info_11c1_044b, + &pci_dev_info_11c1_044c, + &pci_dev_info_11c1_044d, + &pci_dev_info_11c1_044e, + &pci_dev_info_11c1_044f, + &pci_dev_info_11c1_0450, + &pci_dev_info_11c1_0451, + &pci_dev_info_11c1_0452, + &pci_dev_info_11c1_0453, + &pci_dev_info_11c1_0454, + &pci_dev_info_11c1_0455, + &pci_dev_info_11c1_0456, + &pci_dev_info_11c1_0457, + &pci_dev_info_11c1_0458, + &pci_dev_info_11c1_0459, + &pci_dev_info_11c1_045a, + &pci_dev_info_11c1_045c, + &pci_dev_info_11c1_0461, + &pci_dev_info_11c1_0462, + &pci_dev_info_11c1_0480, + &pci_dev_info_11c1_5801, + &pci_dev_info_11c1_5802, + &pci_dev_info_11c1_5803, + &pci_dev_info_11c1_5811, + NULL +}; +#endif +#define pci_dev_list_11c2 NULL +#define pci_dev_list_11c3 NULL +#define pci_dev_list_11c4 NULL +#define pci_dev_list_11c5 NULL +#define pci_dev_list_11c6 NULL +#define pci_dev_list_11c7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11c8[] = { + &pci_dev_info_11c8_0658, + &pci_dev_info_11c8_d665, + &pci_dev_info_11c8_d667, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11c9[] = { + &pci_dev_info_11c9_0010, + &pci_dev_info_11c9_0011, + NULL +}; +#endif +#define pci_dev_list_11ca NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11cb[] = { + &pci_dev_info_11cb_2000, + &pci_dev_info_11cb_4000, + &pci_dev_info_11cb_8000, + NULL +}; +#endif +#define pci_dev_list_11cc NULL +#define pci_dev_list_11cd NULL +#define pci_dev_list_11ce NULL +#define pci_dev_list_11cf NULL +#define pci_dev_list_11d0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11d1[] = { + &pci_dev_info_11d1_01f7, + NULL +}; +#endif +#define pci_dev_list_11d2 NULL +#define pci_dev_list_11d3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11d4[] = { + &pci_dev_info_11d4_1805, + &pci_dev_info_11d4_1889, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11d5[] = { + &pci_dev_info_11d5_0115, + &pci_dev_info_11d5_0117, + NULL +}; +#endif +#define pci_dev_list_11d6 NULL +#define pci_dev_list_11d7 NULL +#define pci_dev_list_11d8 NULL +#define pci_dev_list_11d9 NULL +#define pci_dev_list_11da NULL +#define pci_dev_list_11db NULL +#define pci_dev_list_11dc NULL +#define pci_dev_list_11dd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11de[] = { + &pci_dev_info_11de_6057, + &pci_dev_info_11de_6120, + NULL +}; +#endif +#define pci_dev_list_11df NULL +#define pci_dev_list_11e0 NULL +#define pci_dev_list_11e1 NULL +#define pci_dev_list_11e2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11e3[] = { + &pci_dev_info_11e3_5030, + NULL +}; +#endif +#define pci_dev_list_11e4 NULL +#define pci_dev_list_11e5 NULL +#define pci_dev_list_11e6 NULL +#define pci_dev_list_11e7 NULL +#define pci_dev_list_11e8 NULL +#define pci_dev_list_11e9 NULL +#define pci_dev_list_11ea NULL +#define pci_dev_list_11eb NULL +#define pci_dev_list_11ec NULL +#define pci_dev_list_11ed NULL +#define pci_dev_list_11ee NULL +#define pci_dev_list_11ef NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11f0[] = { + &pci_dev_info_11f0_4231, + &pci_dev_info_11f0_4232, + &pci_dev_info_11f0_4233, + &pci_dev_info_11f0_4234, + &pci_dev_info_11f0_4235, + &pci_dev_info_11f0_4236, + &pci_dev_info_11f0_4731, + NULL +}; +#endif +#define pci_dev_list_11f1 NULL +#define pci_dev_list_11f2 NULL +#define pci_dev_list_11f3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11f4[] = { + &pci_dev_info_11f4_2915, + NULL +}; +#endif +#define pci_dev_list_11f5 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11f6[] = { + &pci_dev_info_11f6_0112, + &pci_dev_info_11f6_0113, + &pci_dev_info_11f6_1401, + &pci_dev_info_11f6_2011, + &pci_dev_info_11f6_2201, + &pci_dev_info_11f6_9881, + NULL +}; +#endif +#define pci_dev_list_11f7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11f8[] = { + &pci_dev_info_11f8_7375, + NULL +}; +#endif +#define pci_dev_list_11f9 NULL +#define pci_dev_list_11fa NULL +#define pci_dev_list_11fb NULL +#define pci_dev_list_11fc NULL +#define pci_dev_list_11fd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_11fe[] = { + &pci_dev_info_11fe_0001, + &pci_dev_info_11fe_0002, + &pci_dev_info_11fe_0003, + &pci_dev_info_11fe_0004, + &pci_dev_info_11fe_0005, + &pci_dev_info_11fe_0006, + &pci_dev_info_11fe_0007, + &pci_dev_info_11fe_0008, + &pci_dev_info_11fe_0009, + &pci_dev_info_11fe_000a, + &pci_dev_info_11fe_000b, + &pci_dev_info_11fe_000c, + &pci_dev_info_11fe_8015, + NULL +}; +#endif +#define pci_dev_list_11ff NULL +#define pci_dev_list_1200 NULL +#define pci_dev_list_1201 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1202[] = { + &pci_dev_info_1202_4300, + NULL +}; +#endif +#define pci_dev_list_1203 NULL +#define pci_dev_list_1204 NULL +#define pci_dev_list_1205 NULL +#define pci_dev_list_1206 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1208[] = { + &pci_dev_info_1208_4853, + NULL +}; +#endif +#define pci_dev_list_1209 NULL +#define pci_dev_list_120a NULL +#define pci_dev_list_120b NULL +#define pci_dev_list_120c NULL +#define pci_dev_list_120d NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_120e[] = { + &pci_dev_info_120e_0100, + &pci_dev_info_120e_0101, + &pci_dev_info_120e_0102, + &pci_dev_info_120e_0103, + &pci_dev_info_120e_0104, + &pci_dev_info_120e_0105, + &pci_dev_info_120e_0200, + &pci_dev_info_120e_0201, + &pci_dev_info_120e_0300, + &pci_dev_info_120e_0301, + &pci_dev_info_120e_0310, + &pci_dev_info_120e_0311, + &pci_dev_info_120e_0320, + &pci_dev_info_120e_0321, + &pci_dev_info_120e_0400, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_120f[] = { + &pci_dev_info_120f_0001, + NULL +}; +#endif +#define pci_dev_list_1210 NULL +#define pci_dev_list_1211 NULL +#define pci_dev_list_1212 NULL +#define pci_dev_list_1213 NULL +#define pci_dev_list_1214 NULL +#define pci_dev_list_1215 NULL +#define pci_dev_list_1216 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1217[] = { + &pci_dev_info_1217_6729, + &pci_dev_info_1217_673a, + &pci_dev_info_1217_6832, + &pci_dev_info_1217_6836, + &pci_dev_info_1217_6872, + &pci_dev_info_1217_6925, + &pci_dev_info_1217_6933, + &pci_dev_info_1217_6972, + NULL +}; +#endif +#define pci_dev_list_1218 NULL +#define pci_dev_list_1219 NULL +static const pciDeviceInfo *pci_dev_list_121a[] = { + &pci_dev_info_121a_0001, + &pci_dev_info_121a_0002, + &pci_dev_info_121a_0003, + &pci_dev_info_121a_0004, + &pci_dev_info_121a_0005, + &pci_dev_info_121a_0009, + &pci_dev_info_121a_0057, + NULL +}; +#define pci_dev_list_121b NULL +#define pci_dev_list_121c NULL +#define pci_dev_list_121d NULL +#define pci_dev_list_121e NULL +#define pci_dev_list_121f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1220[] = { + &pci_dev_info_1220_1220, + NULL +}; +#endif +#define pci_dev_list_1221 NULL +#define pci_dev_list_1222 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1223[] = { + &pci_dev_info_1223_0003, + &pci_dev_info_1223_0004, + &pci_dev_info_1223_0005, + &pci_dev_info_1223_0008, + &pci_dev_info_1223_0009, + &pci_dev_info_1223_000a, + &pci_dev_info_1223_000b, + &pci_dev_info_1223_000c, + &pci_dev_info_1223_000d, + &pci_dev_info_1223_000e, + NULL +}; +#endif +#define pci_dev_list_1224 NULL +#define pci_dev_list_1225 NULL +#define pci_dev_list_1227 NULL +#define pci_dev_list_1228 NULL +#define pci_dev_list_1229 NULL +#define pci_dev_list_122a NULL +#define pci_dev_list_122b NULL +#define pci_dev_list_122c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_122d[] = { + &pci_dev_info_122d_1206, + &pci_dev_info_122d_50dc, + &pci_dev_info_122d_80da, + NULL +}; +#endif +#define pci_dev_list_122e NULL +#define pci_dev_list_122f NULL +#define pci_dev_list_1230 NULL +#define pci_dev_list_1231 NULL +#define pci_dev_list_1232 NULL +#define pci_dev_list_1233 NULL +#define pci_dev_list_1234 NULL +#define pci_dev_list_1235 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1236[] = { + &pci_dev_info_1236_0000, + &pci_dev_info_1236_6401, + NULL +}; +#endif +#define pci_dev_list_1237 NULL +#define pci_dev_list_1238 NULL +#define pci_dev_list_1239 NULL +#define pci_dev_list_123a NULL +#define pci_dev_list_123b NULL +#define pci_dev_list_123c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_123d[] = { + &pci_dev_info_123d_0000, + &pci_dev_info_123d_0002, + &pci_dev_info_123d_0003, + NULL +}; +#endif +#define pci_dev_list_123e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_123f[] = { + &pci_dev_info_123f_00e4, + &pci_dev_info_123f_8120, + &pci_dev_info_123f_8888, + NULL +}; +#endif +#define pci_dev_list_1240 NULL +#define pci_dev_list_1241 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1242[] = { + &pci_dev_info_1242_1560, + &pci_dev_info_1242_4643, + NULL +}; +#endif +#define pci_dev_list_1243 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1244[] = { + &pci_dev_info_1244_0700, + &pci_dev_info_1244_0800, + &pci_dev_info_1244_0a00, + &pci_dev_info_1244_0e00, + &pci_dev_info_1244_1100, + &pci_dev_info_1244_1200, + NULL +}; +#endif +#define pci_dev_list_1245 NULL +#define pci_dev_list_1246 NULL +#define pci_dev_list_1247 NULL +#define pci_dev_list_1248 NULL +#define pci_dev_list_1249 NULL +#define pci_dev_list_124a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_124b[] = { + &pci_dev_info_124b_0040, + NULL +}; +#endif +#define pci_dev_list_124c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_124d[] = { + &pci_dev_info_124d_0000, + &pci_dev_info_124d_0002, + &pci_dev_info_124d_0003, + &pci_dev_info_124d_0004, + NULL +}; +#endif +#define pci_dev_list_124e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_124f[] = { + &pci_dev_info_124f_0041, + NULL +}; +#endif +#define pci_dev_list_1250 NULL +#define pci_dev_list_1251 NULL +#define pci_dev_list_1253 NULL +#define pci_dev_list_1254 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1255[] = { + &pci_dev_info_1255_1110, + &pci_dev_info_1255_1210, + &pci_dev_info_1255_2110, + &pci_dev_info_1255_2120, + &pci_dev_info_1255_2130, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1256[] = { + &pci_dev_info_1256_4201, + &pci_dev_info_1256_4401, + &pci_dev_info_1256_5201, + NULL +}; +#endif +#define pci_dev_list_1257 NULL +#define pci_dev_list_1258 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1259[] = { + &pci_dev_info_1259_2560, + NULL +}; +#endif +#define pci_dev_list_125a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_125b[] = { + &pci_dev_info_125b_1400, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_125c[] = { + &pci_dev_info_125c_0640, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_125d[] = { + &pci_dev_info_125d_0000, + &pci_dev_info_125d_1948, + &pci_dev_info_125d_1968, + &pci_dev_info_125d_1969, + &pci_dev_info_125d_1978, + &pci_dev_info_125d_1988, + &pci_dev_info_125d_1989, + &pci_dev_info_125d_1998, + &pci_dev_info_125d_1999, + &pci_dev_info_125d_199a, + &pci_dev_info_125d_199b, + &pci_dev_info_125d_2808, + &pci_dev_info_125d_2838, + &pci_dev_info_125d_2898, + NULL +}; +#endif +#define pci_dev_list_125e NULL +#define pci_dev_list_125f NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1260[] = { + &pci_dev_info_1260_3873, + &pci_dev_info_1260_8130, + &pci_dev_info_1260_8131, + NULL +}; +#endif +#define pci_dev_list_1261 NULL +#define pci_dev_list_1262 NULL +#define pci_dev_list_1263 NULL +#define pci_dev_list_1264 NULL +#define pci_dev_list_1265 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1266[] = { + &pci_dev_info_1266_0001, + &pci_dev_info_1266_1910, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1267[] = { + &pci_dev_info_1267_5352, + &pci_dev_info_1267_5a4b, + NULL +}; +#endif +#define pci_dev_list_1268 NULL +#define pci_dev_list_1269 NULL +#define pci_dev_list_126a NULL +#define pci_dev_list_126b NULL +#define pci_dev_list_126c NULL +#define pci_dev_list_126d NULL +#define pci_dev_list_126e NULL +static const pciDeviceInfo *pci_dev_list_126f[] = { + &pci_dev_info_126f_0710, + &pci_dev_info_126f_0712, + &pci_dev_info_126f_0720, + &pci_dev_info_126f_0810, + &pci_dev_info_126f_0811, + &pci_dev_info_126f_0820, + &pci_dev_info_126f_0910, + NULL +}; +#define pci_dev_list_1270 NULL +#define pci_dev_list_1271 NULL +#define pci_dev_list_1272 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1273[] = { + &pci_dev_info_1273_0002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1274[] = { + &pci_dev_info_1274_1371, + &pci_dev_info_1274_5000, + &pci_dev_info_1274_5880, + NULL +}; +#endif +#define pci_dev_list_1275 NULL +#define pci_dev_list_1276 NULL +#define pci_dev_list_1277 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1278[] = { + &pci_dev_info_1278_0701, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1279[] = { + &pci_dev_info_1279_0295, + &pci_dev_info_1279_0395, + &pci_dev_info_1279_0396, + &pci_dev_info_1279_0397, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_127a[] = { + &pci_dev_info_127a_1002, + &pci_dev_info_127a_1003, + &pci_dev_info_127a_1004, + &pci_dev_info_127a_1005, + &pci_dev_info_127a_1022, + &pci_dev_info_127a_1023, + &pci_dev_info_127a_1024, + &pci_dev_info_127a_1025, + &pci_dev_info_127a_1026, + &pci_dev_info_127a_1032, + &pci_dev_info_127a_1033, + &pci_dev_info_127a_1034, + &pci_dev_info_127a_1035, + &pci_dev_info_127a_1036, + &pci_dev_info_127a_1085, + &pci_dev_info_127a_2005, + &pci_dev_info_127a_2013, + &pci_dev_info_127a_2014, + &pci_dev_info_127a_2015, + &pci_dev_info_127a_2016, + &pci_dev_info_127a_4311, + &pci_dev_info_127a_4320, + &pci_dev_info_127a_4321, + &pci_dev_info_127a_4322, + &pci_dev_info_127a_8234, + NULL +}; +#endif +#define pci_dev_list_127b NULL +#define pci_dev_list_127c NULL +#define pci_dev_list_127d NULL +#define pci_dev_list_127e NULL +#define pci_dev_list_127f NULL +#define pci_dev_list_1280 NULL +#define pci_dev_list_1281 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1282[] = { + &pci_dev_info_1282_9009, + &pci_dev_info_1282_9100, + &pci_dev_info_1282_9102, + &pci_dev_info_1282_9132, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1283[] = { + &pci_dev_info_1283_673a, + &pci_dev_info_1283_8330, + &pci_dev_info_1283_8888, + &pci_dev_info_1283_8889, + &pci_dev_info_1283_e886, + NULL +}; +#endif +#define pci_dev_list_1284 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1285[] = { + &pci_dev_info_1285_0100, + NULL +}; +#endif +#define pci_dev_list_1286 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1287[] = { + &pci_dev_info_1287_001e, + &pci_dev_info_1287_001f, + NULL +}; +#endif +#define pci_dev_list_1288 NULL +#define pci_dev_list_1289 NULL +#define pci_dev_list_128a NULL +#define pci_dev_list_128b NULL +#define pci_dev_list_128c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_128d[] = { + &pci_dev_info_128d_0021, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_128e[] = { + &pci_dev_info_128e_0008, + &pci_dev_info_128e_0009, + &pci_dev_info_128e_000a, + &pci_dev_info_128e_000b, + &pci_dev_info_128e_000c, + NULL +}; +#endif +#define pci_dev_list_128f NULL +#define pci_dev_list_1290 NULL +#define pci_dev_list_1291 NULL +#define pci_dev_list_1292 NULL +#define pci_dev_list_1293 NULL +#define pci_dev_list_1294 NULL +#define pci_dev_list_1295 NULL +#define pci_dev_list_1296 NULL +#define pci_dev_list_1297 NULL +#define pci_dev_list_1298 NULL +#define pci_dev_list_1299 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_129a[] = { + &pci_dev_info_129a_0615, + NULL +}; +#endif +#define pci_dev_list_129b NULL +#define pci_dev_list_129c NULL +#define pci_dev_list_129d NULL +#define pci_dev_list_129e NULL +#define pci_dev_list_129f NULL +#define pci_dev_list_12a0 NULL +#define pci_dev_list_12a1 NULL +#define pci_dev_list_12a2 NULL +#define pci_dev_list_12a3 NULL +#define pci_dev_list_12a4 NULL +#define pci_dev_list_12a5 NULL +#define pci_dev_list_12a6 NULL +#define pci_dev_list_12a7 NULL +#define pci_dev_list_12a8 NULL +#define pci_dev_list_12a9 NULL +#define pci_dev_list_12aa NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12ab[] = { + &pci_dev_info_12ab_3000, + NULL +}; +#endif +#define pci_dev_list_12ac NULL +#define pci_dev_list_12ad NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12ae[] = { + &pci_dev_info_12ae_0001, + &pci_dev_info_12ae_0002, + NULL +}; +#endif +#define pci_dev_list_12af NULL +#define pci_dev_list_12b0 NULL +#define pci_dev_list_12b1 NULL +#define pci_dev_list_12b2 NULL +#define pci_dev_list_12b3 NULL +#define pci_dev_list_12b4 NULL +#define pci_dev_list_12b5 NULL +#define pci_dev_list_12b6 NULL +#define pci_dev_list_12b7 NULL +#define pci_dev_list_12b8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12b9[] = { + &pci_dev_info_12b9_1006, + &pci_dev_info_12b9_1007, + &pci_dev_info_12b9_1008, + NULL +}; +#endif +#define pci_dev_list_12ba NULL +#define pci_dev_list_12bb NULL +#define pci_dev_list_12bc NULL +#define pci_dev_list_12bd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12be[] = { + &pci_dev_info_12be_3041, + &pci_dev_info_12be_3042, + NULL +}; +#endif +#define pci_dev_list_12bf NULL +#define pci_dev_list_12c0 NULL +#define pci_dev_list_12c1 NULL +#define pci_dev_list_12c2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12c3[] = { + &pci_dev_info_12c3_0058, + &pci_dev_info_12c3_5598, + NULL +}; +#endif +#define pci_dev_list_12c4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12c5[] = { + &pci_dev_info_12c5_007e, + &pci_dev_info_12c5_007f, + &pci_dev_info_12c5_0081, + &pci_dev_info_12c5_0085, + &pci_dev_info_12c5_0086, + NULL +}; +#endif +#define pci_dev_list_12c6 NULL +#define pci_dev_list_12c7 NULL +#define pci_dev_list_12c8 NULL +#define pci_dev_list_12c9 NULL +#define pci_dev_list_12ca NULL +#define pci_dev_list_12cb NULL +#define pci_dev_list_12cc NULL +#define pci_dev_list_12cd NULL +#define pci_dev_list_12ce NULL +#define pci_dev_list_12cf NULL +#define pci_dev_list_12d0 NULL +#define pci_dev_list_12d1 NULL +static const pciDeviceInfo *pci_dev_list_12d2[] = { + &pci_dev_info_12d2_0008, + &pci_dev_info_12d2_0009, + &pci_dev_info_12d2_0018, + &pci_dev_info_12d2_0019, + &pci_dev_info_12d2_0020, + &pci_dev_info_12d2_0028, + &pci_dev_info_12d2_0029, + &pci_dev_info_12d2_002c, + &pci_dev_info_12d2_00a0, + NULL +}; +#define pci_dev_list_12d3 NULL +#define pci_dev_list_12d4 NULL +#define pci_dev_list_12d5 NULL +#define pci_dev_list_12d6 NULL +#define pci_dev_list_12d7 NULL +#define pci_dev_list_12d8 NULL +#define pci_dev_list_12d9 NULL +#define pci_dev_list_12da NULL +#define pci_dev_list_12db NULL +#define pci_dev_list_12dc NULL +#define pci_dev_list_12dd NULL +#define pci_dev_list_12de NULL +#define pci_dev_list_12df NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12e0[] = { + &pci_dev_info_12e0_0010, + &pci_dev_info_12e0_0020, + &pci_dev_info_12e0_0030, + NULL +}; +#endif +#define pci_dev_list_12e1 NULL +#define pci_dev_list_12e2 NULL +#define pci_dev_list_12e3 NULL +#define pci_dev_list_12e4 NULL +#define pci_dev_list_12e5 NULL +#define pci_dev_list_12e6 NULL +#define pci_dev_list_12e7 NULL +#define pci_dev_list_12e8 NULL +#define pci_dev_list_12e9 NULL +#define pci_dev_list_12ea NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12eb[] = { + &pci_dev_info_12eb_0001, + &pci_dev_info_12eb_0002, + &pci_dev_info_12eb_0003, + &pci_dev_info_12eb_8803, + NULL +}; +#endif +#define pci_dev_list_12ec NULL +#define pci_dev_list_12ed NULL +#define pci_dev_list_12ee NULL +#define pci_dev_list_12ef NULL +#define pci_dev_list_12f0 NULL +#define pci_dev_list_12f1 NULL +#define pci_dev_list_12f2 NULL +#define pci_dev_list_12f3 NULL +#define pci_dev_list_12f4 NULL +#define pci_dev_list_12f5 NULL +#define pci_dev_list_12f6 NULL +#define pci_dev_list_12f7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_12f8[] = { + &pci_dev_info_12f8_0002, + NULL +}; +#endif +#define pci_dev_list_12f9 NULL +#define pci_dev_list_12fb NULL +#define pci_dev_list_12fc NULL +#define pci_dev_list_12fd NULL +#define pci_dev_list_12fe NULL +#define pci_dev_list_12ff NULL +#define pci_dev_list_1300 NULL +#define pci_dev_list_1302 NULL +#define pci_dev_list_1303 NULL +#define pci_dev_list_1304 NULL +#define pci_dev_list_1305 NULL +#define pci_dev_list_1306 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1307[] = { + &pci_dev_info_1307_0001, + &pci_dev_info_1307_000b, + &pci_dev_info_1307_000c, + &pci_dev_info_1307_000d, + &pci_dev_info_1307_000f, + &pci_dev_info_1307_0010, + &pci_dev_info_1307_0014, + &pci_dev_info_1307_0015, + &pci_dev_info_1307_0016, + &pci_dev_info_1307_0017, + &pci_dev_info_1307_0018, + &pci_dev_info_1307_0019, + &pci_dev_info_1307_001a, + &pci_dev_info_1307_001b, + &pci_dev_info_1307_001c, + &pci_dev_info_1307_001d, + &pci_dev_info_1307_001e, + &pci_dev_info_1307_001f, + &pci_dev_info_1307_0020, + &pci_dev_info_1307_0021, + &pci_dev_info_1307_0022, + &pci_dev_info_1307_0023, + &pci_dev_info_1307_0024, + &pci_dev_info_1307_0025, + &pci_dev_info_1307_0026, + &pci_dev_info_1307_0027, + &pci_dev_info_1307_0028, + &pci_dev_info_1307_0029, + &pci_dev_info_1307_002c, + &pci_dev_info_1307_0033, + &pci_dev_info_1307_0034, + &pci_dev_info_1307_0035, + &pci_dev_info_1307_0036, + &pci_dev_info_1307_0037, + &pci_dev_info_1307_004c, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1308[] = { + &pci_dev_info_1308_0001, + NULL +}; +#endif +#define pci_dev_list_1309 NULL +#define pci_dev_list_130a NULL +#define pci_dev_list_130b NULL +#define pci_dev_list_130c NULL +#define pci_dev_list_130d NULL +#define pci_dev_list_130e NULL +#define pci_dev_list_130f NULL +#define pci_dev_list_1310 NULL +#define pci_dev_list_1311 NULL +#define pci_dev_list_1312 NULL +#define pci_dev_list_1313 NULL +#define pci_dev_list_1316 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1317[] = { + &pci_dev_info_1317_0981, + &pci_dev_info_1317_0985, + &pci_dev_info_1317_1985, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1318[] = { + &pci_dev_info_1318_0911, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1319[] = { + &pci_dev_info_1319_0801, + &pci_dev_info_1319_0802, + &pci_dev_info_1319_1000, + &pci_dev_info_1319_1001, + NULL +}; +#endif +#define pci_dev_list_131a NULL +#define pci_dev_list_131c NULL +#define pci_dev_list_131d NULL +#define pci_dev_list_131e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_131f[] = { + &pci_dev_info_131f_1000, + &pci_dev_info_131f_1001, + &pci_dev_info_131f_1002, + &pci_dev_info_131f_1010, + &pci_dev_info_131f_1011, + &pci_dev_info_131f_1012, + &pci_dev_info_131f_1020, + &pci_dev_info_131f_1021, + &pci_dev_info_131f_1030, + &pci_dev_info_131f_1031, + &pci_dev_info_131f_1032, + &pci_dev_info_131f_1034, + &pci_dev_info_131f_1035, + &pci_dev_info_131f_1036, + &pci_dev_info_131f_1050, + &pci_dev_info_131f_1051, + &pci_dev_info_131f_1052, + &pci_dev_info_131f_2000, + &pci_dev_info_131f_2001, + &pci_dev_info_131f_2002, + &pci_dev_info_131f_2010, + &pci_dev_info_131f_2011, + &pci_dev_info_131f_2012, + &pci_dev_info_131f_2020, + &pci_dev_info_131f_2021, + &pci_dev_info_131f_2030, + &pci_dev_info_131f_2031, + &pci_dev_info_131f_2032, + &pci_dev_info_131f_2040, + &pci_dev_info_131f_2041, + &pci_dev_info_131f_2042, + &pci_dev_info_131f_2050, + &pci_dev_info_131f_2051, + &pci_dev_info_131f_2052, + &pci_dev_info_131f_2060, + &pci_dev_info_131f_2061, + &pci_dev_info_131f_2062, + NULL +}; +#endif +#define pci_dev_list_1320 NULL +#define pci_dev_list_1321 NULL +#define pci_dev_list_1322 NULL +#define pci_dev_list_1323 NULL +#define pci_dev_list_1324 NULL +#define pci_dev_list_1325 NULL +#define pci_dev_list_1326 NULL +#define pci_dev_list_1327 NULL +#define pci_dev_list_1328 NULL +#define pci_dev_list_1329 NULL +#define pci_dev_list_132a NULL +#define pci_dev_list_132b NULL +#define pci_dev_list_132c NULL +#define pci_dev_list_132d NULL +#define pci_dev_list_1330 NULL +#define pci_dev_list_1331 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1332[] = { + &pci_dev_info_1332_5415, + NULL +}; +#endif +#define pci_dev_list_1334 NULL +#define pci_dev_list_1335 NULL +#define pci_dev_list_1337 NULL +#define pci_dev_list_1338 NULL +#define pci_dev_list_133a NULL +#define pci_dev_list_133b NULL +#define pci_dev_list_133c NULL +#define pci_dev_list_133d NULL +#define pci_dev_list_133e NULL +#define pci_dev_list_133f NULL +#define pci_dev_list_1340 NULL +#define pci_dev_list_1341 NULL +#define pci_dev_list_1342 NULL +#define pci_dev_list_1343 NULL +#define pci_dev_list_1344 NULL +#define pci_dev_list_1345 NULL +#define pci_dev_list_1347 NULL +#define pci_dev_list_1349 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_134a[] = { + &pci_dev_info_134a_0001, + &pci_dev_info_134a_0002, + NULL +}; +#endif +#define pci_dev_list_134b NULL +#define pci_dev_list_134c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_134d[] = { + &pci_dev_info_134d_7890, + &pci_dev_info_134d_7891, + &pci_dev_info_134d_7892, + &pci_dev_info_134d_7893, + &pci_dev_info_134d_7894, + &pci_dev_info_134d_7895, + &pci_dev_info_134d_7896, + &pci_dev_info_134d_7897, + NULL +}; +#endif +#define pci_dev_list_134e NULL +#define pci_dev_list_134f NULL +#define pci_dev_list_1350 NULL +#define pci_dev_list_1351 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1353[] = { + &pci_dev_info_1353_0002, + &pci_dev_info_1353_0003, + &pci_dev_info_1353_0004, + &pci_dev_info_1353_0005, + NULL +}; +#endif +#define pci_dev_list_1354 NULL +#define pci_dev_list_1355 NULL +#define pci_dev_list_1356 NULL +#define pci_dev_list_1359 NULL +#define pci_dev_list_135a NULL +#define pci_dev_list_135b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_135c[] = { + &pci_dev_info_135c_0010, + &pci_dev_info_135c_0020, + &pci_dev_info_135c_0030, + &pci_dev_info_135c_0040, + &pci_dev_info_135c_0050, + &pci_dev_info_135c_0060, + &pci_dev_info_135c_00f0, + &pci_dev_info_135c_0170, + &pci_dev_info_135c_0180, + &pci_dev_info_135c_0190, + &pci_dev_info_135c_01a0, + &pci_dev_info_135c_01b0, + &pci_dev_info_135c_01c0, + NULL +}; +#endif +#define pci_dev_list_135d NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_135e[] = { + &pci_dev_info_135e_7101, + &pci_dev_info_135e_7201, + &pci_dev_info_135e_7202, + &pci_dev_info_135e_7401, + &pci_dev_info_135e_7402, + &pci_dev_info_135e_7801, + &pci_dev_info_135e_8001, + NULL +}; +#endif +#define pci_dev_list_135f NULL +#define pci_dev_list_1360 NULL +#define pci_dev_list_1361 NULL +#define pci_dev_list_1362 NULL +#define pci_dev_list_1363 NULL +#define pci_dev_list_1364 NULL +#define pci_dev_list_1365 NULL +#define pci_dev_list_1366 NULL +#define pci_dev_list_1367 NULL +#define pci_dev_list_1368 NULL +#define pci_dev_list_1369 NULL +#define pci_dev_list_136a NULL +#define pci_dev_list_136b NULL +#define pci_dev_list_136c NULL +#define pci_dev_list_136d NULL +#define pci_dev_list_136f NULL +#define pci_dev_list_1370 NULL +#define pci_dev_list_1371 NULL +#define pci_dev_list_1373 NULL +#define pci_dev_list_1374 NULL +#define pci_dev_list_1375 NULL +#define pci_dev_list_1376 NULL +#define pci_dev_list_1377 NULL +#define pci_dev_list_1378 NULL +#define pci_dev_list_1379 NULL +#define pci_dev_list_137a NULL +#define pci_dev_list_137b NULL +#define pci_dev_list_137c NULL +#define pci_dev_list_137d NULL +#define pci_dev_list_137e NULL +#define pci_dev_list_137f NULL +#define pci_dev_list_1380 NULL +#define pci_dev_list_1381 NULL +#define pci_dev_list_1382 NULL +#define pci_dev_list_1383 NULL +#define pci_dev_list_1384 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1385[] = { + &pci_dev_info_1385_4100, + &pci_dev_info_1385_620a, + &pci_dev_info_1385_622a, + &pci_dev_info_1385_630a, + &pci_dev_info_1385_f311, + NULL +}; +#endif +#define pci_dev_list_1386 NULL +#define pci_dev_list_1387 NULL +#define pci_dev_list_1388 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1389[] = { + &pci_dev_info_1389_0001, + NULL +}; +#endif +#define pci_dev_list_138a NULL +#define pci_dev_list_138b NULL +#define pci_dev_list_138c NULL +#define pci_dev_list_138d NULL +#define pci_dev_list_138e NULL +#define pci_dev_list_138f NULL +#define pci_dev_list_1390 NULL +#define pci_dev_list_1391 NULL +#define pci_dev_list_1392 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1393[] = { + &pci_dev_info_1393_1040, + &pci_dev_info_1393_1680, + &pci_dev_info_1393_2040, + &pci_dev_info_1393_2180, + &pci_dev_info_1393_3200, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1394[] = { + &pci_dev_info_1394_0001, + NULL +}; +#endif +#define pci_dev_list_1395 NULL +#define pci_dev_list_1396 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1397[] = { + &pci_dev_info_1397_2bd0, + NULL +}; +#endif +#define pci_dev_list_1398 NULL +#define pci_dev_list_1399 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_139a[] = { + &pci_dev_info_139a_0001, + &pci_dev_info_139a_0003, + &pci_dev_info_139a_0005, + NULL +}; +#endif +#define pci_dev_list_139b NULL +#define pci_dev_list_139c NULL +#define pci_dev_list_139d NULL +#define pci_dev_list_139e NULL +#define pci_dev_list_139f NULL +#define pci_dev_list_13a0 NULL +#define pci_dev_list_13a1 NULL +#define pci_dev_list_13a2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13a3[] = { + &pci_dev_info_13a3_0005, + &pci_dev_info_13a3_0006, + &pci_dev_info_13a3_0007, + &pci_dev_info_13a3_0012, + &pci_dev_info_13a3_0014, + &pci_dev_info_13a3_0016, + &pci_dev_info_13a3_0017, + &pci_dev_info_13a3_0018, + NULL +}; +#endif +#define pci_dev_list_13a4 NULL +#define pci_dev_list_13a5 NULL +#define pci_dev_list_13a6 NULL +#define pci_dev_list_13a7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13a8[] = { + &pci_dev_info_13a8_0158, + NULL +}; +#endif +#define pci_dev_list_13a9 NULL +#define pci_dev_list_13aa NULL +#define pci_dev_list_13ab NULL +#define pci_dev_list_13ac NULL +#define pci_dev_list_13ad NULL +#define pci_dev_list_13ae NULL +#define pci_dev_list_13af NULL +#define pci_dev_list_13b0 NULL +#define pci_dev_list_13b1 NULL +#define pci_dev_list_13b2 NULL +#define pci_dev_list_13b3 NULL +#define pci_dev_list_13b4 NULL +#define pci_dev_list_13b5 NULL +#define pci_dev_list_13b6 NULL +#define pci_dev_list_13b7 NULL +#define pci_dev_list_13b8 NULL +#define pci_dev_list_13b9 NULL +#define pci_dev_list_13ba NULL +#define pci_dev_list_13bb NULL +#define pci_dev_list_13bc NULL +#define pci_dev_list_13bd NULL +#define pci_dev_list_13be NULL +#define pci_dev_list_13bf NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13c0[] = { + &pci_dev_info_13c0_0010, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13c1[] = { + &pci_dev_info_13c1_1000, + &pci_dev_info_13c1_1001, + &pci_dev_info_13c1_1002, + NULL +}; +#endif +#define pci_dev_list_13c2 NULL +#define pci_dev_list_13c3 NULL +#define pci_dev_list_13c4 NULL +#define pci_dev_list_13c5 NULL +#define pci_dev_list_13c6 NULL +#define pci_dev_list_13c7 NULL +#define pci_dev_list_13c8 NULL +#define pci_dev_list_13c9 NULL +#define pci_dev_list_13ca NULL +#define pci_dev_list_13cb NULL +#define pci_dev_list_13cc NULL +#define pci_dev_list_13cd NULL +#define pci_dev_list_13ce NULL +#define pci_dev_list_13cf NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13d0[] = { + &pci_dev_info_13d0_2103, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13d1[] = { + &pci_dev_info_13d1_ab02, + &pci_dev_info_13d1_ab06, + NULL +}; +#endif +#define pci_dev_list_13d2 NULL +#define pci_dev_list_13d3 NULL +#define pci_dev_list_13d4 NULL +#define pci_dev_list_13d5 NULL +#define pci_dev_list_13d6 NULL +#define pci_dev_list_13d7 NULL +#define pci_dev_list_13d8 NULL +#define pci_dev_list_13d9 NULL +#define pci_dev_list_13da NULL +#define pci_dev_list_13db NULL +#define pci_dev_list_13dc NULL +#define pci_dev_list_13dd NULL +#define pci_dev_list_13de NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13df[] = { + &pci_dev_info_13df_0001, + NULL +}; +#endif +#define pci_dev_list_13e0 NULL +#define pci_dev_list_13e1 NULL +#define pci_dev_list_13e2 NULL +#define pci_dev_list_13e3 NULL +#define pci_dev_list_13e4 NULL +#define pci_dev_list_13e5 NULL +#define pci_dev_list_13e6 NULL +#define pci_dev_list_13e7 NULL +#define pci_dev_list_13e8 NULL +#define pci_dev_list_13e9 NULL +#define pci_dev_list_13ea NULL +#define pci_dev_list_13eb NULL +#define pci_dev_list_13ec NULL +#define pci_dev_list_13ed NULL +#define pci_dev_list_13ee NULL +#define pci_dev_list_13ef NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13f0[] = { + &pci_dev_info_13f0_0201, + NULL +}; +#endif +#define pci_dev_list_13f1 NULL +#define pci_dev_list_13f2 NULL +#define pci_dev_list_13f3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13f4[] = { + &pci_dev_info_13f4_1401, + NULL +}; +#endif +#define pci_dev_list_13f5 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13f6[] = { + &pci_dev_info_13f6_0100, + &pci_dev_info_13f6_0101, + &pci_dev_info_13f6_0111, + &pci_dev_info_13f6_0211, + NULL +}; +#endif +#define pci_dev_list_13f7 NULL +#define pci_dev_list_13f8 NULL +#define pci_dev_list_13f9 NULL +#define pci_dev_list_13fa NULL +#define pci_dev_list_13fb NULL +#define pci_dev_list_13fc NULL +#define pci_dev_list_13fd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_13fe[] = { + &pci_dev_info_13fe_1756, + NULL +}; +#endif +#define pci_dev_list_13ff NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1400[] = { + &pci_dev_info_1400_1401, + NULL +}; +#endif +#define pci_dev_list_1401 NULL +#define pci_dev_list_1402 NULL +#define pci_dev_list_1403 NULL +#define pci_dev_list_1404 NULL +#define pci_dev_list_1405 NULL +#define pci_dev_list_1406 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1407[] = { + &pci_dev_info_1407_0100, + &pci_dev_info_1407_0101, + &pci_dev_info_1407_0102, + &pci_dev_info_1407_0200, + &pci_dev_info_1407_0201, + &pci_dev_info_1407_0202, + &pci_dev_info_1407_0500, + &pci_dev_info_1407_0600, + &pci_dev_info_1407_8000, + &pci_dev_info_1407_8001, + &pci_dev_info_1407_8002, + &pci_dev_info_1407_8003, + &pci_dev_info_1407_8800, + NULL +}; +#endif +#define pci_dev_list_1408 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1409[] = { + &pci_dev_info_1409_7168, + NULL +}; +#endif +#define pci_dev_list_140a NULL +#define pci_dev_list_140b NULL +#define pci_dev_list_140c NULL +#define pci_dev_list_140d NULL +#define pci_dev_list_140e NULL +#define pci_dev_list_140f NULL +#define pci_dev_list_1410 NULL +#define pci_dev_list_1411 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1412[] = { + &pci_dev_info_1412_1712, + &pci_dev_info_1412_1724, + NULL +}; +#endif +#define pci_dev_list_1413 NULL +#define pci_dev_list_1414 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1415[] = { + &pci_dev_info_1415_8403, + &pci_dev_info_1415_9501, + &pci_dev_info_1415_950a, + &pci_dev_info_1415_950b, + &pci_dev_info_1415_9511, + &pci_dev_info_1415_9521, + NULL +}; +#endif +#define pci_dev_list_1416 NULL +#define pci_dev_list_1417 NULL +#define pci_dev_list_1418 NULL +#define pci_dev_list_1419 NULL +#define pci_dev_list_141a NULL +#define pci_dev_list_141b NULL +#define pci_dev_list_141d NULL +#define pci_dev_list_141e NULL +#define pci_dev_list_141f NULL +#define pci_dev_list_1420 NULL +#define pci_dev_list_1421 NULL +#define pci_dev_list_1422 NULL +#define pci_dev_list_1423 NULL +#define pci_dev_list_1424 NULL +#define pci_dev_list_1425 NULL +#define pci_dev_list_1426 NULL +#define pci_dev_list_1427 NULL +#define pci_dev_list_1428 NULL +#define pci_dev_list_1429 NULL +#define pci_dev_list_142a NULL +#define pci_dev_list_142b NULL +#define pci_dev_list_142c NULL +#define pci_dev_list_142d NULL +#define pci_dev_list_142e NULL +#define pci_dev_list_142f NULL +#define pci_dev_list_1430 NULL +#define pci_dev_list_1431 NULL +#define pci_dev_list_1432 NULL +#define pci_dev_list_1433 NULL +#define pci_dev_list_1435 NULL +#define pci_dev_list_1436 NULL +#define pci_dev_list_1437 NULL +#define pci_dev_list_1438 NULL +#define pci_dev_list_1439 NULL +#define pci_dev_list_143a NULL +#define pci_dev_list_143b NULL +#define pci_dev_list_143c NULL +#define pci_dev_list_143d NULL +#define pci_dev_list_143e NULL +#define pci_dev_list_143f NULL +#define pci_dev_list_1440 NULL +#define pci_dev_list_1441 NULL +#define pci_dev_list_1442 NULL +#define pci_dev_list_1443 NULL +#define pci_dev_list_1444 NULL +#define pci_dev_list_1445 NULL +#define pci_dev_list_1446 NULL +#define pci_dev_list_1447 NULL +#define pci_dev_list_1448 NULL +#define pci_dev_list_1449 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_144a[] = { + &pci_dev_info_144a_7296, + &pci_dev_info_144a_7432, + &pci_dev_info_144a_7433, + &pci_dev_info_144a_7434, + &pci_dev_info_144a_7841, + &pci_dev_info_144a_8133, + &pci_dev_info_144a_8554, + &pci_dev_info_144a_9111, + &pci_dev_info_144a_9113, + &pci_dev_info_144a_9114, + NULL +}; +#endif +#define pci_dev_list_144b NULL +#define pci_dev_list_144c NULL +#define pci_dev_list_144d NULL +#define pci_dev_list_144e NULL +#define pci_dev_list_144f NULL +#define pci_dev_list_1450 NULL +#define pci_dev_list_1451 NULL +#define pci_dev_list_1453 NULL +#define pci_dev_list_1454 NULL +#define pci_dev_list_1455 NULL +#define pci_dev_list_1456 NULL +#define pci_dev_list_1457 NULL +#define pci_dev_list_1458 NULL +#define pci_dev_list_1459 NULL +#define pci_dev_list_145a NULL +#define pci_dev_list_145b NULL +#define pci_dev_list_145c NULL +#define pci_dev_list_145d NULL +#define pci_dev_list_145e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_145f[] = { + &pci_dev_info_145f_0001, + NULL +}; +#endif +#define pci_dev_list_1460 NULL +#define pci_dev_list_1461 NULL +#define pci_dev_list_1462 NULL +#define pci_dev_list_1463 NULL +#define pci_dev_list_1464 NULL +#define pci_dev_list_1465 NULL +#define pci_dev_list_1466 NULL +#define pci_dev_list_1467 NULL +#define pci_dev_list_1468 NULL +#define pci_dev_list_1469 NULL +#define pci_dev_list_146a NULL +#define pci_dev_list_146b NULL +#define pci_dev_list_146c NULL +#define pci_dev_list_146d NULL +#define pci_dev_list_146e NULL +#define pci_dev_list_146f NULL +#define pci_dev_list_1470 NULL +#define pci_dev_list_1471 NULL +#define pci_dev_list_1472 NULL +#define pci_dev_list_1473 NULL +#define pci_dev_list_1474 NULL +#define pci_dev_list_1475 NULL +#define pci_dev_list_1476 NULL +#define pci_dev_list_1477 NULL +#define pci_dev_list_1478 NULL +#define pci_dev_list_1479 NULL +#define pci_dev_list_147a NULL +#define pci_dev_list_147b NULL +#define pci_dev_list_147c NULL +#define pci_dev_list_147d NULL +#define pci_dev_list_147e NULL +#define pci_dev_list_147f NULL +#define pci_dev_list_1480 NULL +#define pci_dev_list_1481 NULL +#define pci_dev_list_1482 NULL +#define pci_dev_list_1483 NULL +#define pci_dev_list_1484 NULL +#define pci_dev_list_1485 NULL +#define pci_dev_list_1486 NULL +#define pci_dev_list_1487 NULL +#define pci_dev_list_1488 NULL +#define pci_dev_list_1489 NULL +#define pci_dev_list_148a NULL +#define pci_dev_list_148b NULL +#define pci_dev_list_148c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_148d[] = { + &pci_dev_info_148d_1003, + NULL +}; +#endif +#define pci_dev_list_148e NULL +#define pci_dev_list_148f NULL +#define pci_dev_list_1490 NULL +#define pci_dev_list_1491 NULL +#define pci_dev_list_1492 NULL +#define pci_dev_list_1493 NULL +#define pci_dev_list_1494 NULL +#define pci_dev_list_1495 NULL +#define pci_dev_list_1496 NULL +#define pci_dev_list_1497 NULL +#define pci_dev_list_1498 NULL +#define pci_dev_list_1499 NULL +#define pci_dev_list_149a NULL +#define pci_dev_list_149b NULL +#define pci_dev_list_149c NULL +#define pci_dev_list_149d NULL +#define pci_dev_list_149e NULL +#define pci_dev_list_149f NULL +#define pci_dev_list_14a0 NULL +#define pci_dev_list_14a1 NULL +#define pci_dev_list_14a2 NULL +#define pci_dev_list_14a3 NULL +#define pci_dev_list_14a4 NULL +#define pci_dev_list_14a5 NULL +#define pci_dev_list_14a6 NULL +#define pci_dev_list_14a7 NULL +#define pci_dev_list_14a8 NULL +#define pci_dev_list_14a9 NULL +#define pci_dev_list_14aa NULL +#define pci_dev_list_14ab NULL +#define pci_dev_list_14ac NULL +#define pci_dev_list_14ad NULL +#define pci_dev_list_14ae NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14af[] = { + &pci_dev_info_14af_7102, + NULL +}; +#endif +#define pci_dev_list_14b0 NULL +#define pci_dev_list_14b1 NULL +#define pci_dev_list_14b2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14b3[] = { + &pci_dev_info_14b3_0000, + NULL +}; +#endif +#define pci_dev_list_14b4 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14b5[] = { + &pci_dev_info_14b5_0200, + &pci_dev_info_14b5_0300, + &pci_dev_info_14b5_0400, + &pci_dev_info_14b5_0600, + &pci_dev_info_14b5_0800, + &pci_dev_info_14b5_0900, + &pci_dev_info_14b5_0a00, + &pci_dev_info_14b5_0b00, + NULL +}; +#endif +#define pci_dev_list_14b6 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14b7[] = { + &pci_dev_info_14b7_0001, + NULL +}; +#endif +#define pci_dev_list_14b8 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14b9[] = { + &pci_dev_info_14b9_0001, + &pci_dev_info_14b9_0340, + &pci_dev_info_14b9_0350, + &pci_dev_info_14b9_4500, + &pci_dev_info_14b9_4800, + &pci_dev_info_14b9_a504, + NULL +}; +#endif +#define pci_dev_list_14ba NULL +#define pci_dev_list_14bb NULL +#define pci_dev_list_14bc NULL +#define pci_dev_list_14bd NULL +#define pci_dev_list_14be NULL +#define pci_dev_list_14bf NULL +#define pci_dev_list_14c0 NULL +#define pci_dev_list_14c1 NULL +#define pci_dev_list_14c2 NULL +#define pci_dev_list_14c3 NULL +#define pci_dev_list_14c4 NULL +#define pci_dev_list_14c5 NULL +#define pci_dev_list_14c6 NULL +#define pci_dev_list_14c7 NULL +#define pci_dev_list_14c8 NULL +#define pci_dev_list_14c9 NULL +#define pci_dev_list_14ca NULL +#define pci_dev_list_14cb NULL +#define pci_dev_list_14cc NULL +#define pci_dev_list_14cd NULL +#define pci_dev_list_14ce NULL +#define pci_dev_list_14cf NULL +#define pci_dev_list_14d0 NULL +#define pci_dev_list_14d1 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14d2[] = { + &pci_dev_info_14d2_8001, + &pci_dev_info_14d2_8002, + &pci_dev_info_14d2_8010, + &pci_dev_info_14d2_8011, + &pci_dev_info_14d2_8020, + &pci_dev_info_14d2_8021, + &pci_dev_info_14d2_8040, + &pci_dev_info_14d2_8080, + &pci_dev_info_14d2_a000, + &pci_dev_info_14d2_a001, + &pci_dev_info_14d2_a003, + &pci_dev_info_14d2_a004, + &pci_dev_info_14d2_a005, + &pci_dev_info_14d2_e001, + &pci_dev_info_14d2_e010, + &pci_dev_info_14d2_e020, + NULL +}; +#endif +#define pci_dev_list_14d3 NULL +#define pci_dev_list_14d4 NULL +#define pci_dev_list_14d5 NULL +#define pci_dev_list_14d6 NULL +#define pci_dev_list_14d7 NULL +#define pci_dev_list_14d8 NULL +#define pci_dev_list_14d9 NULL +#define pci_dev_list_14da NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14db[] = { + &pci_dev_info_14db_2120, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14dc[] = { + &pci_dev_info_14dc_0000, + &pci_dev_info_14dc_0001, + &pci_dev_info_14dc_0002, + &pci_dev_info_14dc_0003, + &pci_dev_info_14dc_0004, + &pci_dev_info_14dc_0005, + &pci_dev_info_14dc_0006, + &pci_dev_info_14dc_0007, + &pci_dev_info_14dc_0008, + &pci_dev_info_14dc_0009, + &pci_dev_info_14dc_000a, + &pci_dev_info_14dc_000b, + NULL +}; +#endif +#define pci_dev_list_14dd NULL +#define pci_dev_list_14de NULL +#define pci_dev_list_14df NULL +#define pci_dev_list_14e1 NULL +#define pci_dev_list_14e2 NULL +#define pci_dev_list_14e3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14e4[] = { + &pci_dev_info_14e4_1644, + &pci_dev_info_14e4_1645, + &pci_dev_info_14e4_1646, + &pci_dev_info_14e4_1647, + &pci_dev_info_14e4_1648, + &pci_dev_info_14e4_164d, + &pci_dev_info_14e4_1653, + &pci_dev_info_14e4_165d, + &pci_dev_info_14e4_1696, + &pci_dev_info_14e4_16a6, + &pci_dev_info_14e4_16a7, + &pci_dev_info_14e4_16a8, + &pci_dev_info_14e4_16c6, + &pci_dev_info_14e4_16c7, + &pci_dev_info_14e4_4210, + &pci_dev_info_14e4_4211, + &pci_dev_info_14e4_4212, + &pci_dev_info_14e4_4301, + &pci_dev_info_14e4_4401, + &pci_dev_info_14e4_4402, + &pci_dev_info_14e4_4410, + &pci_dev_info_14e4_4411, + &pci_dev_info_14e4_4412, + &pci_dev_info_14e4_5820, + &pci_dev_info_14e4_5821, + NULL +}; +#endif +#define pci_dev_list_14e5 NULL +#define pci_dev_list_14e6 NULL +#define pci_dev_list_14e7 NULL +#define pci_dev_list_14e8 NULL +#define pci_dev_list_14e9 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14ea[] = { + &pci_dev_info_14ea_ab06, + NULL +}; +#endif +#define pci_dev_list_14eb NULL +#define pci_dev_list_14ec NULL +#define pci_dev_list_14ed NULL +#define pci_dev_list_14ee NULL +#define pci_dev_list_14ef NULL +#define pci_dev_list_14f0 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_14f1[] = { + &pci_dev_info_14f1_1002, + &pci_dev_info_14f1_1003, + &pci_dev_info_14f1_1004, + &pci_dev_info_14f1_1005, + &pci_dev_info_14f1_1006, + &pci_dev_info_14f1_1022, + &pci_dev_info_14f1_1023, + &pci_dev_info_14f1_1024, + &pci_dev_info_14f1_1025, + &pci_dev_info_14f1_1026, + &pci_dev_info_14f1_1032, + &pci_dev_info_14f1_1033, + &pci_dev_info_14f1_1034, + &pci_dev_info_14f1_1035, + &pci_dev_info_14f1_1036, + &pci_dev_info_14f1_1052, + &pci_dev_info_14f1_1053, + &pci_dev_info_14f1_1054, + &pci_dev_info_14f1_1055, + &pci_dev_info_14f1_1056, + &pci_dev_info_14f1_1057, + &pci_dev_info_14f1_1059, + &pci_dev_info_14f1_1063, + &pci_dev_info_14f1_1064, + &pci_dev_info_14f1_1065, + &pci_dev_info_14f1_1066, + &pci_dev_info_14f1_1433, + &pci_dev_info_14f1_1434, + &pci_dev_info_14f1_1435, + &pci_dev_info_14f1_1436, + &pci_dev_info_14f1_1453, + &pci_dev_info_14f1_1454, + &pci_dev_info_14f1_1455, + &pci_dev_info_14f1_1456, + &pci_dev_info_14f1_1610, + &pci_dev_info_14f1_1611, + &pci_dev_info_14f1_1803, + &pci_dev_info_14f1_1815, + &pci_dev_info_14f1_2003, + &pci_dev_info_14f1_2004, + &pci_dev_info_14f1_2005, + &pci_dev_info_14f1_2006, + &pci_dev_info_14f1_2013, + &pci_dev_info_14f1_2014, + &pci_dev_info_14f1_2015, + &pci_dev_info_14f1_2016, + &pci_dev_info_14f1_2043, + &pci_dev_info_14f1_2044, + &pci_dev_info_14f1_2045, + &pci_dev_info_14f1_2046, + &pci_dev_info_14f1_2063, + &pci_dev_info_14f1_2064, + &pci_dev_info_14f1_2065, + &pci_dev_info_14f1_2066, + &pci_dev_info_14f1_2093, + &pci_dev_info_14f1_2143, + &pci_dev_info_14f1_2144, + &pci_dev_info_14f1_2145, + &pci_dev_info_14f1_2146, + &pci_dev_info_14f1_2163, + &pci_dev_info_14f1_2164, + &pci_dev_info_14f1_2165, + &pci_dev_info_14f1_2166, + &pci_dev_info_14f1_2343, + &pci_dev_info_14f1_2344, + &pci_dev_info_14f1_2345, + &pci_dev_info_14f1_2346, + &pci_dev_info_14f1_2363, + &pci_dev_info_14f1_2364, + &pci_dev_info_14f1_2365, + &pci_dev_info_14f1_2366, + &pci_dev_info_14f1_2443, + &pci_dev_info_14f1_2444, + &pci_dev_info_14f1_2445, + &pci_dev_info_14f1_2446, + &pci_dev_info_14f1_2463, + &pci_dev_info_14f1_2464, + &pci_dev_info_14f1_2465, + &pci_dev_info_14f1_2466, + &pci_dev_info_14f1_2f00, + &pci_dev_info_14f1_8234, + NULL +}; +#endif +#define pci_dev_list_14f2 NULL +#define pci_dev_list_14f3 NULL +#define pci_dev_list_14f4 NULL +#define pci_dev_list_14f5 NULL +#define pci_dev_list_14f6 NULL +#define pci_dev_list_14f7 NULL +#define pci_dev_list_14f8 NULL +#define pci_dev_list_14f9 NULL +#define pci_dev_list_14fa NULL +#define pci_dev_list_14fb NULL +#define pci_dev_list_14fc NULL +#define pci_dev_list_14fd NULL +#define pci_dev_list_14fe NULL +#define pci_dev_list_14ff NULL +#define pci_dev_list_1500 NULL +#define pci_dev_list_1501 NULL +#define pci_dev_list_1502 NULL +#define pci_dev_list_1503 NULL +#define pci_dev_list_1504 NULL +#define pci_dev_list_1505 NULL +#define pci_dev_list_1506 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1507[] = { + &pci_dev_info_1507_0001, + &pci_dev_info_1507_0002, + &pci_dev_info_1507_0003, + &pci_dev_info_1507_0100, + &pci_dev_info_1507_0431, + &pci_dev_info_1507_4801, + &pci_dev_info_1507_4802, + &pci_dev_info_1507_4803, + &pci_dev_info_1507_4806, + NULL +}; +#endif +#define pci_dev_list_1508 NULL +#define pci_dev_list_1509 NULL +#define pci_dev_list_150a NULL +#define pci_dev_list_150b NULL +#define pci_dev_list_150c NULL +#define pci_dev_list_150d NULL +#define pci_dev_list_150e NULL +#define pci_dev_list_150f NULL +#define pci_dev_list_1510 NULL +#define pci_dev_list_1511 NULL +#define pci_dev_list_1512 NULL +#define pci_dev_list_1513 NULL +#define pci_dev_list_1514 NULL +#define pci_dev_list_1515 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1516[] = { + &pci_dev_info_1516_0803, + NULL +}; +#endif +#define pci_dev_list_1517 NULL +#define pci_dev_list_1518 NULL +#define pci_dev_list_1519 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_151a[] = { + &pci_dev_info_151a_1002, + &pci_dev_info_151a_1004, + &pci_dev_info_151a_1008, + NULL +}; +#endif +#define pci_dev_list_151b NULL +#define pci_dev_list_151c NULL +#define pci_dev_list_151d NULL +#define pci_dev_list_151e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_151f[] = { + &pci_dev_info_151f_0000, + NULL +}; +#endif +#define pci_dev_list_1520 NULL +#define pci_dev_list_1521 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1522[] = { + &pci_dev_info_1522_0100, + NULL +}; +#endif +#define pci_dev_list_1523 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1524[] = { + &pci_dev_info_1524_1211, + &pci_dev_info_1524_1225, + &pci_dev_info_1524_1410, + &pci_dev_info_1524_1420, + NULL +}; +#endif +#define pci_dev_list_1525 NULL +#define pci_dev_list_1526 NULL +#define pci_dev_list_1527 NULL +#define pci_dev_list_1528 NULL +#define pci_dev_list_1529 NULL +#define pci_dev_list_152a NULL +#define pci_dev_list_152b NULL +#define pci_dev_list_152c NULL +#define pci_dev_list_152d NULL +#define pci_dev_list_152e NULL +#define pci_dev_list_152f NULL +#define pci_dev_list_1530 NULL +#define pci_dev_list_1531 NULL +#define pci_dev_list_1532 NULL +#define pci_dev_list_1533 NULL +#define pci_dev_list_1534 NULL +#define pci_dev_list_1535 NULL +#define pci_dev_list_1537 NULL +#define pci_dev_list_1538 NULL +#define pci_dev_list_1539 NULL +#define pci_dev_list_153a NULL +#define pci_dev_list_153b NULL +#define pci_dev_list_153c NULL +#define pci_dev_list_153d NULL +#define pci_dev_list_153e NULL +#define pci_dev_list_153f NULL +#define pci_dev_list_1540 NULL +#define pci_dev_list_1541 NULL +#define pci_dev_list_1542 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1543[] = { + &pci_dev_info_1543_3052, + &pci_dev_info_1543_4c22, + NULL +}; +#endif +#define pci_dev_list_1544 NULL +#define pci_dev_list_1545 NULL +#define pci_dev_list_1546 NULL +#define pci_dev_list_1547 NULL +#define pci_dev_list_1548 NULL +#define pci_dev_list_1549 NULL +#define pci_dev_list_154a NULL +#define pci_dev_list_154b NULL +#define pci_dev_list_154c NULL +#define pci_dev_list_154d NULL +#define pci_dev_list_154e NULL +#define pci_dev_list_154f NULL +#define pci_dev_list_1550 NULL +#define pci_dev_list_1551 NULL +#define pci_dev_list_1552 NULL +#define pci_dev_list_1553 NULL +#define pci_dev_list_1554 NULL +#define pci_dev_list_1555 NULL +#define pci_dev_list_1556 NULL +#define pci_dev_list_1557 NULL +#define pci_dev_list_1558 NULL +#define pci_dev_list_1559 NULL +#define pci_dev_list_155a NULL +#define pci_dev_list_155b NULL +#define pci_dev_list_155c NULL +#define pci_dev_list_155d NULL +#define pci_dev_list_155e NULL +#define pci_dev_list_155f NULL +#define pci_dev_list_1560 NULL +#define pci_dev_list_1561 NULL +#define pci_dev_list_1562 NULL +#define pci_dev_list_1563 NULL +#define pci_dev_list_1564 NULL +#define pci_dev_list_1565 NULL +#define pci_dev_list_1566 NULL +#define pci_dev_list_1567 NULL +#define pci_dev_list_1568 NULL +#define pci_dev_list_1569 NULL +#define pci_dev_list_156a NULL +#define pci_dev_list_156b NULL +#define pci_dev_list_156c NULL +#define pci_dev_list_156d NULL +#define pci_dev_list_156e NULL +#define pci_dev_list_156f NULL +#define pci_dev_list_1570 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1571[] = { + &pci_dev_info_1571_a001, + &pci_dev_info_1571_a002, + &pci_dev_info_1571_a003, + &pci_dev_info_1571_a004, + &pci_dev_info_1571_a005, + &pci_dev_info_1571_a006, + &pci_dev_info_1571_a007, + &pci_dev_info_1571_a008, + &pci_dev_info_1571_a009, + &pci_dev_info_1571_a00a, + &pci_dev_info_1571_a00b, + &pci_dev_info_1571_a00c, + &pci_dev_info_1571_a00d, + &pci_dev_info_1571_a201, + &pci_dev_info_1571_a202, + &pci_dev_info_1571_a203, + &pci_dev_info_1571_a204, + &pci_dev_info_1571_a205, + &pci_dev_info_1571_a206, + NULL +}; +#endif +#define pci_dev_list_1572 NULL +#define pci_dev_list_1573 NULL +#define pci_dev_list_1574 NULL +#define pci_dev_list_1575 NULL +#define pci_dev_list_1576 NULL +#define pci_dev_list_1578 NULL +#define pci_dev_list_1579 NULL +#define pci_dev_list_157a NULL +#define pci_dev_list_157b NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_157c[] = { + &pci_dev_info_157c_8001, + NULL +}; +#endif +#define pci_dev_list_157d NULL +#define pci_dev_list_157e NULL +#define pci_dev_list_157f NULL +#define pci_dev_list_1580 NULL +#define pci_dev_list_1581 NULL +#define pci_dev_list_1582 NULL +#define pci_dev_list_1583 NULL +#define pci_dev_list_1584 NULL +#define pci_dev_list_1585 NULL +#define pci_dev_list_1586 NULL +#define pci_dev_list_1587 NULL +#define pci_dev_list_1588 NULL +#define pci_dev_list_1589 NULL +#define pci_dev_list_158a NULL +#define pci_dev_list_158b NULL +#define pci_dev_list_158c NULL +#define pci_dev_list_158d NULL +#define pci_dev_list_158e NULL +#define pci_dev_list_158f NULL +#define pci_dev_list_1590 NULL +#define pci_dev_list_1591 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1592[] = { + &pci_dev_info_1592_0781, + &pci_dev_info_1592_0782, + &pci_dev_info_1592_0783, + &pci_dev_info_1592_0785, + &pci_dev_info_1592_0786, + &pci_dev_info_1592_0787, + &pci_dev_info_1592_0788, + &pci_dev_info_1592_078a, + NULL +}; +#endif +#define pci_dev_list_1593 NULL +#define pci_dev_list_1594 NULL +#define pci_dev_list_1595 NULL +#define pci_dev_list_1596 NULL +#define pci_dev_list_1597 NULL +#define pci_dev_list_1598 NULL +#define pci_dev_list_1599 NULL +#define pci_dev_list_159a NULL +#define pci_dev_list_159b NULL +#define pci_dev_list_159c NULL +#define pci_dev_list_159d NULL +#define pci_dev_list_159e NULL +#define pci_dev_list_159f NULL +#define pci_dev_list_15a0 NULL +#define pci_dev_list_15a1 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_15a2[] = { + &pci_dev_info_15a2_0001, + NULL +}; +#endif +#define pci_dev_list_15a3 NULL +#define pci_dev_list_15a4 NULL +#define pci_dev_list_15a5 NULL +#define pci_dev_list_15a6 NULL +#define pci_dev_list_15a7 NULL +#define pci_dev_list_15a8 NULL +#define pci_dev_list_15aa NULL +#define pci_dev_list_15ab NULL +#define pci_dev_list_15ac NULL +static const pciDeviceInfo *pci_dev_list_15ad[] = { + &pci_dev_info_15ad_0710, + NULL +}; +#define pci_dev_list_15ae NULL +#define pci_dev_list_15b0 NULL +#define pci_dev_list_15b1 NULL +#define pci_dev_list_15b2 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_15b3[] = { + &pci_dev_info_15b3_5274, + NULL +}; +#endif +#define pci_dev_list_15b4 NULL +#define pci_dev_list_15b5 NULL +#define pci_dev_list_15b6 NULL +#define pci_dev_list_15b7 NULL +#define pci_dev_list_15b8 NULL +#define pci_dev_list_15b9 NULL +#define pci_dev_list_15ba NULL +#define pci_dev_list_15bb NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_15bc[] = { + &pci_dev_info_15bc_2929, + NULL +}; +#endif +#define pci_dev_list_15bd NULL +#define pci_dev_list_15be NULL +#define pci_dev_list_15bf NULL +#define pci_dev_list_15c0 NULL +#define pci_dev_list_15c1 NULL +#define pci_dev_list_15c2 NULL +#define pci_dev_list_15c3 NULL +#define pci_dev_list_15c4 NULL +#define pci_dev_list_15c5 NULL +#define pci_dev_list_15c6 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_15c7[] = { + &pci_dev_info_15c7_0349, + NULL +}; +#endif +#define pci_dev_list_15c8 NULL +#define pci_dev_list_15c9 NULL +#define pci_dev_list_15ca NULL +#define pci_dev_list_15cb NULL +#define pci_dev_list_15cc NULL +#define pci_dev_list_15cd NULL +#define pci_dev_list_15ce NULL +#define pci_dev_list_15cf NULL +#define pci_dev_list_15d1 NULL +#define pci_dev_list_15d2 NULL +#define pci_dev_list_15d3 NULL +#define pci_dev_list_15d4 NULL +#define pci_dev_list_15d5 NULL +#define pci_dev_list_15d6 NULL +#define pci_dev_list_15d7 NULL +#define pci_dev_list_15d8 NULL +#define pci_dev_list_15d9 NULL +#define pci_dev_list_15da NULL +#define pci_dev_list_15db NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_15dc[] = { + &pci_dev_info_15dc_0001, + NULL +}; +#endif +#define pci_dev_list_15dd NULL +#define pci_dev_list_15de NULL +#define pci_dev_list_15df NULL +#define pci_dev_list_15e0 NULL +#define pci_dev_list_15e1 NULL +#define pci_dev_list_15e2 NULL +#define pci_dev_list_15e3 NULL +#define pci_dev_list_15e4 NULL +#define pci_dev_list_15e5 NULL +#define pci_dev_list_15e6 NULL +#define pci_dev_list_15e7 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_15e8[] = { + &pci_dev_info_15e8_0130, + NULL +}; +#endif +#define pci_dev_list_15e9 NULL +#define pci_dev_list_15ea NULL +#define pci_dev_list_15eb NULL +#define pci_dev_list_15ec NULL +#define pci_dev_list_15ed NULL +#define pci_dev_list_15ee NULL +#define pci_dev_list_15ef NULL +#define pci_dev_list_15f0 NULL +#define pci_dev_list_15f1 NULL +#define pci_dev_list_15f2 NULL +#define pci_dev_list_15f3 NULL +#define pci_dev_list_15f4 NULL +#define pci_dev_list_15f5 NULL +#define pci_dev_list_15f6 NULL +#define pci_dev_list_15f7 NULL +#define pci_dev_list_15f8 NULL +#define pci_dev_list_15f9 NULL +#define pci_dev_list_15fa NULL +#define pci_dev_list_15fb NULL +#define pci_dev_list_15fc NULL +#define pci_dev_list_15fd NULL +#define pci_dev_list_15fe NULL +#define pci_dev_list_15ff NULL +#define pci_dev_list_1600 NULL +#define pci_dev_list_1601 NULL +#define pci_dev_list_1602 NULL +#define pci_dev_list_1603 NULL +#define pci_dev_list_1604 NULL +#define pci_dev_list_1605 NULL +#define pci_dev_list_1606 NULL +#define pci_dev_list_1607 NULL +#define pci_dev_list_1608 NULL +#define pci_dev_list_1609 NULL +#define pci_dev_list_1612 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1619[] = { + &pci_dev_info_1619_0400, + &pci_dev_info_1619_0440, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1629[] = { + &pci_dev_info_1629_1003, + &pci_dev_info_1629_2002, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1638[] = { + &pci_dev_info_1638_1100, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_163c[] = { + &pci_dev_info_163c_5449, + NULL +}; +#endif +#define pci_dev_list_1657 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_165a[] = { + &pci_dev_info_165a_c100, + &pci_dev_info_165a_d200, + &pci_dev_info_165a_d300, + NULL +}; +#endif +#define pci_dev_list_165d NULL +#define pci_dev_list_1661 NULL +#define pci_dev_list_1668 NULL +#define pci_dev_list_1681 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_16ab[] = { + &pci_dev_info_16ab_1102, + NULL +}; +#endif +#define pci_dev_list_16be NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_16ec[] = { + &pci_dev_info_16ec_3685, + NULL +}; +#endif +#define pci_dev_list_16f6 NULL +#define pci_dev_list_1705 NULL +#define pci_dev_list_170b NULL +#define pci_dev_list_170c NULL +#define pci_dev_list_172a NULL +#define pci_dev_list_1737 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_173b[] = { + &pci_dev_info_173b_03e8, + &pci_dev_info_173b_03ea, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1743[] = { + &pci_dev_info_1743_8139, + NULL +}; +#endif +#define pci_dev_list_174b NULL +#define pci_dev_list_175e NULL +#define pci_dev_list_1787 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1796[] = { + &pci_dev_info_1796_0001, + &pci_dev_info_1796_0002, + &pci_dev_info_1796_0003, + &pci_dev_info_1796_0004, + &pci_dev_info_1796_0005, + &pci_dev_info_1796_0006, + NULL +}; +#endif +#define pci_dev_list_1799 NULL +#define pci_dev_list_17af NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_17cc[] = { + &pci_dev_info_17cc_2280, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1813[] = { + &pci_dev_info_1813_4000, + &pci_dev_info_1813_4100, + NULL +}; +#endif +#define pci_dev_list_1851 NULL +#define pci_dev_list_1852 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1888[] = { + &pci_dev_info_1888_0301, + &pci_dev_info_1888_0601, + &pci_dev_info_1888_0710, + &pci_dev_info_1888_0720, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1a08[] = { + &pci_dev_info_1a08_0000, + NULL +}; +#endif +#define pci_dev_list_1b13 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1c1c[] = { + &pci_dev_info_1c1c_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1d44[] = { + &pci_dev_info_1d44_a400, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_1de1[] = { + &pci_dev_info_1de1_0391, + &pci_dev_info_1de1_2020, + &pci_dev_info_1de1_690c, + &pci_dev_info_1de1_dc29, + NULL +}; +#endif +#define pci_dev_list_2000 NULL +#define pci_dev_list_2001 NULL +#define pci_dev_list_2003 NULL +#define pci_dev_list_2004 NULL +#define pci_dev_list_21c3 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_2348[] = { + &pci_dev_info_2348_2010, + NULL +}; +#endif +#define pci_dev_list_2646 NULL +#define pci_dev_list_270b NULL +#define pci_dev_list_270f NULL +#define pci_dev_list_2711 NULL +#define pci_dev_list_2a15 NULL +#define pci_dev_list_3000 NULL +#define pci_dev_list_3142 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_3388[] = { + &pci_dev_info_3388_0013, + &pci_dev_info_3388_0014, + &pci_dev_info_3388_0021, + &pci_dev_info_3388_8011, + &pci_dev_info_3388_8012, + &pci_dev_info_3388_8013, + NULL +}; +#endif +#define pci_dev_list_3411 NULL +#define pci_dev_list_3513 NULL +#define pci_dev_list_38ef NULL +static const pciDeviceInfo *pci_dev_list_3d3d[] = { + &pci_dev_info_3d3d_0001, + &pci_dev_info_3d3d_0002, + &pci_dev_info_3d3d_0003, + &pci_dev_info_3d3d_0004, + &pci_dev_info_3d3d_0005, + &pci_dev_info_3d3d_0006, + &pci_dev_info_3d3d_0007, + &pci_dev_info_3d3d_0008, + &pci_dev_info_3d3d_0009, + &pci_dev_info_3d3d_000a, + &pci_dev_info_3d3d_000c, + &pci_dev_info_3d3d_0100, + &pci_dev_info_3d3d_1004, + &pci_dev_info_3d3d_3d04, + &pci_dev_info_3d3d_ffff, + NULL +}; +static const pciDeviceInfo *pci_dev_list_4005[] = { + &pci_dev_info_4005_0300, + &pci_dev_info_4005_0308, + &pci_dev_info_4005_0309, + &pci_dev_info_4005_1064, + &pci_dev_info_4005_2064, + &pci_dev_info_4005_2128, + &pci_dev_info_4005_2301, + &pci_dev_info_4005_2302, + &pci_dev_info_4005_2303, + &pci_dev_info_4005_2364, + &pci_dev_info_4005_2464, + &pci_dev_info_4005_2501, + &pci_dev_info_4005_4000, + &pci_dev_info_4005_4710, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_4033[] = { + &pci_dev_info_4033_1360, + NULL +}; +#endif +#define pci_dev_list_4143 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_416c[] = { + &pci_dev_info_416c_0100, + &pci_dev_info_416c_0200, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_4444[] = { + &pci_dev_info_4444_0803, + NULL +}; +#endif +#define pci_dev_list_4468 NULL +#define pci_dev_list_4594 NULL +#define pci_dev_list_45fb NULL +#define pci_dev_list_4680 NULL +#define pci_dev_list_4843 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_4916[] = { + &pci_dev_info_4916_1960, + NULL +}; +#endif +#define pci_dev_list_4943 NULL +#define pci_dev_list_4978 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_4a14[] = { + &pci_dev_info_4a14_5000, + NULL +}; +#endif +#define pci_dev_list_4b10 NULL +#define pci_dev_list_4c48 NULL +#define pci_dev_list_4c53 NULL +#define pci_dev_list_4ca1 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_4d51[] = { + &pci_dev_info_4d51_0200, + NULL +}; +#endif +#define pci_dev_list_4d54 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_4ddc[] = { + &pci_dev_info_4ddc_0100, + &pci_dev_info_4ddc_0801, + &pci_dev_info_4ddc_0802, + &pci_dev_info_4ddc_0811, + &pci_dev_info_4ddc_0812, + &pci_dev_info_4ddc_0881, + &pci_dev_info_4ddc_0882, + &pci_dev_info_4ddc_0891, + &pci_dev_info_4ddc_0892, + &pci_dev_info_4ddc_0901, + &pci_dev_info_4ddc_0902, + &pci_dev_info_4ddc_0903, + &pci_dev_info_4ddc_0904, + &pci_dev_info_4ddc_0b01, + &pci_dev_info_4ddc_0b02, + &pci_dev_info_4ddc_0b03, + &pci_dev_info_4ddc_0b04, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5046[] = { + &pci_dev_info_5046_1001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5053[] = { + &pci_dev_info_5053_2010, + NULL +}; +#endif +#define pci_dev_list_5136 NULL +#define pci_dev_list_5143 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5145[] = { + &pci_dev_info_5145_3031, + NULL +}; +#endif +#define pci_dev_list_5168 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5301[] = { + &pci_dev_info_5301_0001, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_5333[] = { + &pci_dev_info_5333_0551, + &pci_dev_info_5333_5631, + &pci_dev_info_5333_8800, + &pci_dev_info_5333_8801, + &pci_dev_info_5333_8810, + &pci_dev_info_5333_8811, + &pci_dev_info_5333_8812, + &pci_dev_info_5333_8813, + &pci_dev_info_5333_8814, + &pci_dev_info_5333_8815, + &pci_dev_info_5333_883d, + &pci_dev_info_5333_8870, + &pci_dev_info_5333_8880, + &pci_dev_info_5333_8881, + &pci_dev_info_5333_8882, + &pci_dev_info_5333_8883, + &pci_dev_info_5333_88b0, + &pci_dev_info_5333_88b1, + &pci_dev_info_5333_88b2, + &pci_dev_info_5333_88b3, + &pci_dev_info_5333_88c0, + &pci_dev_info_5333_88c1, + &pci_dev_info_5333_88c2, + &pci_dev_info_5333_88c3, + &pci_dev_info_5333_88d0, + &pci_dev_info_5333_88d1, + &pci_dev_info_5333_88d2, + &pci_dev_info_5333_88d3, + &pci_dev_info_5333_88f0, + &pci_dev_info_5333_88f1, + &pci_dev_info_5333_88f2, + &pci_dev_info_5333_88f3, + &pci_dev_info_5333_8900, + &pci_dev_info_5333_8901, + &pci_dev_info_5333_8902, + &pci_dev_info_5333_8903, + &pci_dev_info_5333_8904, + &pci_dev_info_5333_8905, + &pci_dev_info_5333_8906, + &pci_dev_info_5333_8907, + &pci_dev_info_5333_8908, + &pci_dev_info_5333_8909, + &pci_dev_info_5333_890a, + &pci_dev_info_5333_890b, + &pci_dev_info_5333_890c, + &pci_dev_info_5333_890d, + &pci_dev_info_5333_890e, + &pci_dev_info_5333_890f, + &pci_dev_info_5333_8a01, + &pci_dev_info_5333_8a10, + &pci_dev_info_5333_8a13, + &pci_dev_info_5333_8a20, + &pci_dev_info_5333_8a21, + &pci_dev_info_5333_8a22, + &pci_dev_info_5333_8a23, + &pci_dev_info_5333_8a25, + &pci_dev_info_5333_8a26, + &pci_dev_info_5333_8c00, + &pci_dev_info_5333_8c01, + &pci_dev_info_5333_8c02, + &pci_dev_info_5333_8c03, + &pci_dev_info_5333_8c10, + &pci_dev_info_5333_8c11, + &pci_dev_info_5333_8c12, + &pci_dev_info_5333_8c13, + &pci_dev_info_5333_8c22, + &pci_dev_info_5333_8c24, + &pci_dev_info_5333_8c26, + &pci_dev_info_5333_8c2a, + &pci_dev_info_5333_8c2b, + &pci_dev_info_5333_8c2c, + &pci_dev_info_5333_8c2d, + &pci_dev_info_5333_8c2e, + &pci_dev_info_5333_8c2f, + &pci_dev_info_5333_8d01, + &pci_dev_info_5333_8d02, + &pci_dev_info_5333_8d03, + &pci_dev_info_5333_8d04, + &pci_dev_info_5333_9102, + &pci_dev_info_5333_ca00, + NULL +}; +#define pci_dev_list_544c NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5455[] = { + &pci_dev_info_5455_4458, + NULL +}; +#endif +#define pci_dev_list_5519 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5544[] = { + &pci_dev_info_5544_0001, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_5555[] = { + &pci_dev_info_5555_0003, + NULL +}; +#endif +#define pci_dev_list_5654 NULL +#define pci_dev_list_5700 NULL +#define pci_dev_list_6356 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_6374[] = { + &pci_dev_info_6374_6773, + NULL +}; +#endif +#define pci_dev_list_6409 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_6666[] = { + &pci_dev_info_6666_0001, + &pci_dev_info_6666_0002, + NULL +}; +#endif +#define pci_dev_list_7604 NULL +#define pci_dev_list_7bde NULL +#define pci_dev_list_7fed NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_8008[] = { + &pci_dev_info_8008_0010, + &pci_dev_info_8008_0011, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_8086[] = { + &pci_dev_info_8086_0007, + &pci_dev_info_8086_0008, + &pci_dev_info_8086_0039, + &pci_dev_info_8086_0122, + &pci_dev_info_8086_0482, + &pci_dev_info_8086_0483, + &pci_dev_info_8086_0484, + &pci_dev_info_8086_0486, + &pci_dev_info_8086_04a3, + &pci_dev_info_8086_04d0, + &pci_dev_info_8086_0600, + &pci_dev_info_8086_0960, + &pci_dev_info_8086_0962, + &pci_dev_info_8086_0964, + &pci_dev_info_8086_1000, + &pci_dev_info_8086_1001, + &pci_dev_info_8086_1002, + &pci_dev_info_8086_1004, + &pci_dev_info_8086_1008, + &pci_dev_info_8086_1009, + &pci_dev_info_8086_100c, + &pci_dev_info_8086_100d, + &pci_dev_info_8086_100e, + &pci_dev_info_8086_100f, + &pci_dev_info_8086_1010, + &pci_dev_info_8086_1011, + &pci_dev_info_8086_1012, + &pci_dev_info_8086_1015, + &pci_dev_info_8086_1029, + &pci_dev_info_8086_1030, + &pci_dev_info_8086_1031, + &pci_dev_info_8086_1032, + &pci_dev_info_8086_1033, + &pci_dev_info_8086_1034, + &pci_dev_info_8086_1035, + &pci_dev_info_8086_1036, + &pci_dev_info_8086_1037, + &pci_dev_info_8086_1038, + &pci_dev_info_8086_1039, + &pci_dev_info_8086_103a, + &pci_dev_info_8086_103b, + &pci_dev_info_8086_103c, + &pci_dev_info_8086_103d, + &pci_dev_info_8086_103e, + &pci_dev_info_8086_1040, + &pci_dev_info_8086_1059, + &pci_dev_info_8086_1130, + &pci_dev_info_8086_1131, + &pci_dev_info_8086_1132, + &pci_dev_info_8086_1161, + &pci_dev_info_8086_1162, + &pci_dev_info_8086_1200, + &pci_dev_info_8086_1209, + &pci_dev_info_8086_1221, + &pci_dev_info_8086_1222, + &pci_dev_info_8086_1223, + &pci_dev_info_8086_1225, + &pci_dev_info_8086_1226, + &pci_dev_info_8086_1227, + &pci_dev_info_8086_1228, + &pci_dev_info_8086_1229, + &pci_dev_info_8086_122d, + &pci_dev_info_8086_122e, + &pci_dev_info_8086_1230, + &pci_dev_info_8086_1231, + &pci_dev_info_8086_1234, + &pci_dev_info_8086_1235, + &pci_dev_info_8086_1237, + &pci_dev_info_8086_1239, + &pci_dev_info_8086_123b, + &pci_dev_info_8086_123c, + &pci_dev_info_8086_123d, + &pci_dev_info_8086_123f, + &pci_dev_info_8086_1240, + &pci_dev_info_8086_124b, + &pci_dev_info_8086_1250, + &pci_dev_info_8086_1360, + &pci_dev_info_8086_1361, + &pci_dev_info_8086_1460, + &pci_dev_info_8086_1461, + &pci_dev_info_8086_1462, + &pci_dev_info_8086_1960, + &pci_dev_info_8086_1962, + &pci_dev_info_8086_1a21, + &pci_dev_info_8086_1a23, + &pci_dev_info_8086_1a24, + &pci_dev_info_8086_1a30, + &pci_dev_info_8086_1a31, + &pci_dev_info_8086_2410, + &pci_dev_info_8086_2411, + &pci_dev_info_8086_2412, + &pci_dev_info_8086_2413, + &pci_dev_info_8086_2415, + &pci_dev_info_8086_2416, + &pci_dev_info_8086_2418, + &pci_dev_info_8086_2420, + &pci_dev_info_8086_2421, + &pci_dev_info_8086_2422, + &pci_dev_info_8086_2423, + &pci_dev_info_8086_2425, + &pci_dev_info_8086_2426, + &pci_dev_info_8086_2428, + &pci_dev_info_8086_2440, + &pci_dev_info_8086_2442, + &pci_dev_info_8086_2443, + &pci_dev_info_8086_2444, + &pci_dev_info_8086_2445, + &pci_dev_info_8086_2446, + &pci_dev_info_8086_2448, + &pci_dev_info_8086_2449, + &pci_dev_info_8086_244a, + &pci_dev_info_8086_244b, + &pci_dev_info_8086_244c, + &pci_dev_info_8086_244e, + &pci_dev_info_8086_2450, + &pci_dev_info_8086_2452, + &pci_dev_info_8086_2453, + &pci_dev_info_8086_2459, + &pci_dev_info_8086_245b, + &pci_dev_info_8086_245d, + &pci_dev_info_8086_245e, + &pci_dev_info_8086_2480, + &pci_dev_info_8086_2482, + &pci_dev_info_8086_2483, + &pci_dev_info_8086_2484, + &pci_dev_info_8086_2485, + &pci_dev_info_8086_2486, + &pci_dev_info_8086_2487, + &pci_dev_info_8086_248a, + &pci_dev_info_8086_248b, + &pci_dev_info_8086_248c, + &pci_dev_info_8086_24c0, + &pci_dev_info_8086_24c2, + &pci_dev_info_8086_24c3, + &pci_dev_info_8086_24c4, + &pci_dev_info_8086_24c5, + &pci_dev_info_8086_24c6, + &pci_dev_info_8086_24c7, + &pci_dev_info_8086_24cb, + &pci_dev_info_8086_24cd, + &pci_dev_info_8086_2500, + &pci_dev_info_8086_2501, + &pci_dev_info_8086_250b, + &pci_dev_info_8086_250f, + &pci_dev_info_8086_2520, + &pci_dev_info_8086_2521, + &pci_dev_info_8086_2530, + &pci_dev_info_8086_2531, + &pci_dev_info_8086_2532, + &pci_dev_info_8086_2533, + &pci_dev_info_8086_2534, + &pci_dev_info_8086_2540, + &pci_dev_info_8086_2541, + &pci_dev_info_8086_2543, + &pci_dev_info_8086_2544, + &pci_dev_info_8086_2545, + &pci_dev_info_8086_2546, + &pci_dev_info_8086_2547, + &pci_dev_info_8086_2548, + &pci_dev_info_8086_2560, + &pci_dev_info_8086_2561, + &pci_dev_info_8086_2562, + &pci_dev_info_8086_2570, + &pci_dev_info_8086_2572, + &pci_dev_info_8086_3092, + &pci_dev_info_8086_3575, + &pci_dev_info_8086_3576, + &pci_dev_info_8086_3577, + &pci_dev_info_8086_3578, + &pci_dev_info_8086_3580, + &pci_dev_info_8086_3582, + &pci_dev_info_8086_5200, + &pci_dev_info_8086_5201, + &pci_dev_info_8086_530d, + &pci_dev_info_8086_7000, + &pci_dev_info_8086_7010, + &pci_dev_info_8086_7020, + &pci_dev_info_8086_7030, + &pci_dev_info_8086_7100, + &pci_dev_info_8086_7110, + &pci_dev_info_8086_7111, + &pci_dev_info_8086_7112, + &pci_dev_info_8086_7113, + &pci_dev_info_8086_7120, + &pci_dev_info_8086_7121, + &pci_dev_info_8086_7122, + &pci_dev_info_8086_7123, + &pci_dev_info_8086_7124, + &pci_dev_info_8086_7125, + &pci_dev_info_8086_7126, + &pci_dev_info_8086_7128, + &pci_dev_info_8086_712a, + &pci_dev_info_8086_7180, + &pci_dev_info_8086_7181, + &pci_dev_info_8086_7190, + &pci_dev_info_8086_7191, + &pci_dev_info_8086_7192, + &pci_dev_info_8086_7194, + &pci_dev_info_8086_7195, + &pci_dev_info_8086_7196, + &pci_dev_info_8086_7198, + &pci_dev_info_8086_7199, + &pci_dev_info_8086_719a, + &pci_dev_info_8086_719b, + &pci_dev_info_8086_71a0, + &pci_dev_info_8086_71a1, + &pci_dev_info_8086_71a2, + &pci_dev_info_8086_7600, + &pci_dev_info_8086_7601, + &pci_dev_info_8086_7602, + &pci_dev_info_8086_7603, + &pci_dev_info_8086_7800, + &pci_dev_info_8086_84c4, + &pci_dev_info_8086_84c5, + &pci_dev_info_8086_84ca, + &pci_dev_info_8086_84cb, + &pci_dev_info_8086_84e0, + &pci_dev_info_8086_84e1, + &pci_dev_info_8086_84e2, + &pci_dev_info_8086_84e3, + &pci_dev_info_8086_84e4, + &pci_dev_info_8086_84e6, + &pci_dev_info_8086_84ea, + &pci_dev_info_8086_9621, + &pci_dev_info_8086_9622, + &pci_dev_info_8086_9641, + &pci_dev_info_8086_96a1, + &pci_dev_info_8086_b152, + &pci_dev_info_8086_b154, + &pci_dev_info_8086_b555, + &pci_dev_info_8086_ffff, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_8800[] = { + &pci_dev_info_8800_2008, + NULL +}; +#endif +#define pci_dev_list_8866 NULL +#define pci_dev_list_8888 NULL +#define pci_dev_list_8e0e NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_8e2e[] = { + &pci_dev_info_8e2e_3000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_9004[] = { + &pci_dev_info_9004_1078, + &pci_dev_info_9004_1160, + &pci_dev_info_9004_2178, + &pci_dev_info_9004_3860, + &pci_dev_info_9004_3b78, + &pci_dev_info_9004_5075, + &pci_dev_info_9004_5078, + &pci_dev_info_9004_5175, + &pci_dev_info_9004_5178, + &pci_dev_info_9004_5275, + &pci_dev_info_9004_5278, + &pci_dev_info_9004_5375, + &pci_dev_info_9004_5378, + &pci_dev_info_9004_5475, + &pci_dev_info_9004_5478, + &pci_dev_info_9004_5575, + &pci_dev_info_9004_5578, + &pci_dev_info_9004_5647, + &pci_dev_info_9004_5675, + &pci_dev_info_9004_5678, + &pci_dev_info_9004_5775, + &pci_dev_info_9004_5778, + &pci_dev_info_9004_5800, + &pci_dev_info_9004_5900, + &pci_dev_info_9004_5905, + &pci_dev_info_9004_6038, + &pci_dev_info_9004_6075, + &pci_dev_info_9004_6078, + &pci_dev_info_9004_6178, + &pci_dev_info_9004_6278, + &pci_dev_info_9004_6378, + &pci_dev_info_9004_6478, + &pci_dev_info_9004_6578, + &pci_dev_info_9004_6678, + &pci_dev_info_9004_6778, + &pci_dev_info_9004_6915, + &pci_dev_info_9004_7078, + &pci_dev_info_9004_7178, + &pci_dev_info_9004_7278, + &pci_dev_info_9004_7378, + &pci_dev_info_9004_7478, + &pci_dev_info_9004_7578, + &pci_dev_info_9004_7678, + &pci_dev_info_9004_7778, + &pci_dev_info_9004_7810, + &pci_dev_info_9004_7815, + &pci_dev_info_9004_7850, + &pci_dev_info_9004_7855, + &pci_dev_info_9004_7860, + &pci_dev_info_9004_7870, + &pci_dev_info_9004_7871, + &pci_dev_info_9004_7872, + &pci_dev_info_9004_7873, + &pci_dev_info_9004_7874, + &pci_dev_info_9004_7880, + &pci_dev_info_9004_7890, + &pci_dev_info_9004_7891, + &pci_dev_info_9004_7892, + &pci_dev_info_9004_7893, + &pci_dev_info_9004_7894, + &pci_dev_info_9004_7895, + &pci_dev_info_9004_7896, + &pci_dev_info_9004_7897, + &pci_dev_info_9004_8078, + &pci_dev_info_9004_8178, + &pci_dev_info_9004_8278, + &pci_dev_info_9004_8378, + &pci_dev_info_9004_8478, + &pci_dev_info_9004_8578, + &pci_dev_info_9004_8678, + &pci_dev_info_9004_8778, + &pci_dev_info_9004_8878, + &pci_dev_info_9004_8b78, + &pci_dev_info_9004_ec78, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_9005[] = { + &pci_dev_info_9005_0010, + &pci_dev_info_9005_0011, + &pci_dev_info_9005_0013, + &pci_dev_info_9005_001f, + &pci_dev_info_9005_0020, + &pci_dev_info_9005_002f, + &pci_dev_info_9005_0030, + &pci_dev_info_9005_003f, + &pci_dev_info_9005_0050, + &pci_dev_info_9005_0051, + &pci_dev_info_9005_0053, + &pci_dev_info_9005_005f, + &pci_dev_info_9005_0080, + &pci_dev_info_9005_0081, + &pci_dev_info_9005_0083, + &pci_dev_info_9005_008f, + &pci_dev_info_9005_00c0, + &pci_dev_info_9005_00c1, + &pci_dev_info_9005_00c3, + &pci_dev_info_9005_00c5, + &pci_dev_info_9005_00cf, + &pci_dev_info_9005_0250, + &pci_dev_info_9005_0285, + &pci_dev_info_9005_8000, + &pci_dev_info_9005_800f, + &pci_dev_info_9005_8010, + &pci_dev_info_9005_8011, + &pci_dev_info_9005_8012, + &pci_dev_info_9005_8013, + &pci_dev_info_9005_8014, + &pci_dev_info_9005_801e, + &pci_dev_info_9005_801f, + &pci_dev_info_9005_8090, + &pci_dev_info_9005_8091, + &pci_dev_info_9005_8092, + &pci_dev_info_9005_8093, + &pci_dev_info_9005_8094, + &pci_dev_info_9005_809e, + &pci_dev_info_9005_809f, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_907f[] = { + &pci_dev_info_907f_2015, + NULL +}; +#endif +#define pci_dev_list_919a NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_9412[] = { + &pci_dev_info_9412_6565, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_9699[] = { + &pci_dev_info_9699_6565, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_9710[] = { + &pci_dev_info_9710_9815, + &pci_dev_info_9710_9835, + NULL +}; +#endif +#define pci_dev_list_a0a0 NULL +#define pci_dev_list_a0f1 NULL +#define pci_dev_list_a200 NULL +#define pci_dev_list_a259 NULL +#define pci_dev_list_a25b NULL +#define pci_dev_list_a304 NULL +#define pci_dev_list_a727 NULL +#define pci_dev_list_aa42 NULL +#define pci_dev_list_ac1e NULL +#define pci_dev_list_b1b3 NULL +#define pci_dev_list_bd11 NULL +#define pci_dev_list_c001 NULL +#define pci_dev_list_c0a9 NULL +#define pci_dev_list_c0de NULL +#define pci_dev_list_c0fe NULL +#define pci_dev_list_ca50 NULL +#define pci_dev_list_cafe NULL +#define pci_dev_list_cccc NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_cddd[] = { + &pci_dev_info_cddd_0101, + &pci_dev_info_cddd_0200, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_d4d4[] = { + &pci_dev_info_d4d4_0601, + NULL +}; +#endif +#define pci_dev_list_d531 NULL +#define pci_dev_list_d84d NULL +#define pci_dev_list_dead NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_e000[] = { + &pci_dev_info_e000_e000, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_e159[] = { + &pci_dev_info_e159_0001, + &pci_dev_info_e159_0002, + NULL +}; +#endif +#define pci_dev_list_e4bf NULL +#define pci_dev_list_ea01 NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_ea60[] = { + &pci_dev_info_ea60_9896, + &pci_dev_info_ea60_9897, + &pci_dev_info_ea60_9898, + NULL +}; +#endif +#define pci_dev_list_eabb NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_eace[] = { + &pci_dev_info_eace_3100, + &pci_dev_info_eace_3200, + &pci_dev_info_eace_320e, + &pci_dev_info_eace_340e, + &pci_dev_info_eace_341e, + &pci_dev_info_eace_3500, + &pci_dev_info_eace_351c, + &pci_dev_info_eace_4100, + &pci_dev_info_eace_4110, + &pci_dev_info_eace_4220, + &pci_dev_info_eace_422e, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_ec80[] = { + &pci_dev_info_ec80_ec00, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_ecc0[] = { + &pci_dev_info_ecc0_0050, + &pci_dev_info_ecc0_0051, + &pci_dev_info_ecc0_0060, + &pci_dev_info_ecc0_0070, + &pci_dev_info_ecc0_0071, + &pci_dev_info_ecc0_0072, + &pci_dev_info_ecc0_0080, + NULL +}; +#endif +static const pciDeviceInfo *pci_dev_list_edd8[] = { + &pci_dev_info_edd8_a091, + &pci_dev_info_edd8_a099, + &pci_dev_info_edd8_a0a1, + &pci_dev_info_edd8_a0a9, + NULL +}; +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_f1d0[] = { + &pci_dev_info_f1d0_cafe, + &pci_dev_info_f1d0_efac, + &pci_dev_info_f1d0_facd, + NULL +}; +#endif +#define pci_dev_list_fa57 NULL +#define pci_dev_list_febd NULL +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_feda[] = { + &pci_dev_info_feda_a0fa, + &pci_dev_info_feda_a10e, + NULL +}; +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO +static const pciDeviceInfo *pci_dev_list_fffe[] = { + &pci_dev_info_fffe_0710, + NULL +}; +#endif +#define pci_dev_list_ffff NULL + +static const pciVendorInfo pciVendorInfoList[] = { +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0000, pci_vendor_0000, pci_dev_list_0000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x001a, pci_vendor_001a, pci_dev_list_001a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0033, pci_vendor_0033, pci_dev_list_0033}, +#endif + {0x003d, pci_vendor_003d, pci_dev_list_003d}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0059, pci_vendor_0059, pci_dev_list_0059}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0070, pci_vendor_0070, pci_dev_list_0070}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0100, pci_vendor_0100, pci_dev_list_0100}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0675, pci_vendor_0675, pci_dev_list_0675}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0925, pci_vendor_0925, pci_dev_list_0925}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x09c1, pci_vendor_09c1, pci_dev_list_09c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0a89, pci_vendor_0a89, pci_dev_list_0a89}, +#endif + {0x0e11, pci_vendor_0e11, pci_dev_list_0e11}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0e55, pci_vendor_0e55, pci_dev_list_0e55}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1000, pci_vendor_1000, pci_dev_list_1000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1001, pci_vendor_1001, pci_dev_list_1001}, +#endif + {0x1002, pci_vendor_1002, pci_dev_list_1002}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1003, pci_vendor_1003, pci_dev_list_1003}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1004, pci_vendor_1004, pci_dev_list_1004}, +#endif + {0x1005, pci_vendor_1005, pci_dev_list_1005}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1006, pci_vendor_1006, pci_dev_list_1006}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1007, pci_vendor_1007, pci_dev_list_1007}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1008, pci_vendor_1008, pci_dev_list_1008}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x100a, pci_vendor_100a, pci_dev_list_100a}, +#endif + {0x100b, pci_vendor_100b, pci_dev_list_100b}, + {0x100c, pci_vendor_100c, pci_dev_list_100c}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x100d, pci_vendor_100d, pci_dev_list_100d}, +#endif + {0x100e, pci_vendor_100e, pci_dev_list_100e}, + {0x1010, pci_vendor_1010, pci_dev_list_1010}, + {0x1011, pci_vendor_1011, pci_dev_list_1011}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1012, pci_vendor_1012, pci_dev_list_1012}, +#endif + {0x1013, pci_vendor_1013, pci_dev_list_1013}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1014, pci_vendor_1014, pci_dev_list_1014}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1015, pci_vendor_1015, pci_dev_list_1015}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1016, pci_vendor_1016, pci_dev_list_1016}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1017, pci_vendor_1017, pci_dev_list_1017}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1018, pci_vendor_1018, pci_dev_list_1018}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1019, pci_vendor_1019, pci_dev_list_1019}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101a, pci_vendor_101a, pci_dev_list_101a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101b, pci_vendor_101b, pci_dev_list_101b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101c, pci_vendor_101c, pci_dev_list_101c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101e, pci_vendor_101e, pci_dev_list_101e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101f, pci_vendor_101f, pci_dev_list_101f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1020, pci_vendor_1020, pci_dev_list_1020}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1021, pci_vendor_1021, pci_dev_list_1021}, +#endif + {0x1022, pci_vendor_1022, pci_dev_list_1022}, + {0x1023, pci_vendor_1023, pci_dev_list_1023}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1024, pci_vendor_1024, pci_dev_list_1024}, +#endif + {0x1025, pci_vendor_1025, pci_dev_list_1025}, + {0x1028, pci_vendor_1028, pci_dev_list_1028}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1029, pci_vendor_1029, pci_dev_list_1029}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102a, pci_vendor_102a, pci_dev_list_102a}, +#endif + {0x102b, pci_vendor_102b, pci_dev_list_102b}, + {0x102c, pci_vendor_102c, pci_dev_list_102c}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102d, pci_vendor_102d, pci_dev_list_102d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102e, pci_vendor_102e, pci_dev_list_102e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102f, pci_vendor_102f, pci_dev_list_102f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1030, pci_vendor_1030, pci_dev_list_1030}, +#endif + {0x1031, pci_vendor_1031, pci_dev_list_1031}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1032, pci_vendor_1032, pci_dev_list_1032}, +#endif + {0x1033, pci_vendor_1033, pci_dev_list_1033}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1034, pci_vendor_1034, pci_dev_list_1034}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1035, pci_vendor_1035, pci_dev_list_1035}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1036, pci_vendor_1036, pci_dev_list_1036}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1037, pci_vendor_1037, pci_dev_list_1037}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1038, pci_vendor_1038, pci_dev_list_1038}, +#endif + {0x1039, pci_vendor_1039, pci_dev_list_1039}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103a, pci_vendor_103a, pci_dev_list_103a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103b, pci_vendor_103b, pci_dev_list_103b}, +#endif + {0x103c, pci_vendor_103c, pci_dev_list_103c}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103e, pci_vendor_103e, pci_dev_list_103e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103f, pci_vendor_103f, pci_dev_list_103f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1040, pci_vendor_1040, pci_dev_list_1040}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1041, pci_vendor_1041, pci_dev_list_1041}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1042, pci_vendor_1042, pci_dev_list_1042}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1043, pci_vendor_1043, pci_dev_list_1043}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1044, pci_vendor_1044, pci_dev_list_1044}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1045, pci_vendor_1045, pci_dev_list_1045}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1046, pci_vendor_1046, pci_dev_list_1046}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1047, pci_vendor_1047, pci_dev_list_1047}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1048, pci_vendor_1048, pci_dev_list_1048}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1049, pci_vendor_1049, pci_dev_list_1049}, +#endif + {0x104a, pci_vendor_104a, pci_dev_list_104a}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x104b, pci_vendor_104b, pci_dev_list_104b}, +#endif + {0x104c, pci_vendor_104c, pci_dev_list_104c}, + {0x104d, pci_vendor_104d, pci_dev_list_104d}, + {0x104e, pci_vendor_104e, pci_dev_list_104e}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x104f, pci_vendor_104f, pci_dev_list_104f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1050, pci_vendor_1050, pci_dev_list_1050}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1051, pci_vendor_1051, pci_dev_list_1051}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1052, pci_vendor_1052, pci_dev_list_1052}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1053, pci_vendor_1053, pci_dev_list_1053}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1054, pci_vendor_1054, pci_dev_list_1054}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1055, pci_vendor_1055, pci_dev_list_1055}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1056, pci_vendor_1056, pci_dev_list_1056}, +#endif + {0x1057, pci_vendor_1057, pci_dev_list_1057}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1058, pci_vendor_1058, pci_dev_list_1058}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1059, pci_vendor_1059, pci_dev_list_1059}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105a, pci_vendor_105a, pci_dev_list_105a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105b, pci_vendor_105b, pci_dev_list_105b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105c, pci_vendor_105c, pci_dev_list_105c}, +#endif + {0x105d, pci_vendor_105d, pci_dev_list_105d}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105e, pci_vendor_105e, pci_dev_list_105e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105f, pci_vendor_105f, pci_dev_list_105f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1060, pci_vendor_1060, pci_dev_list_1060}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1061, pci_vendor_1061, pci_dev_list_1061}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1062, pci_vendor_1062, pci_dev_list_1062}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1063, pci_vendor_1063, pci_dev_list_1063}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1064, pci_vendor_1064, pci_dev_list_1064}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1065, pci_vendor_1065, pci_dev_list_1065}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1066, pci_vendor_1066, pci_dev_list_1066}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1067, pci_vendor_1067, pci_dev_list_1067}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1068, pci_vendor_1068, pci_dev_list_1068}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1069, pci_vendor_1069, pci_dev_list_1069}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106a, pci_vendor_106a, pci_dev_list_106a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106b, pci_vendor_106b, pci_dev_list_106b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106c, pci_vendor_106c, pci_dev_list_106c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106d, pci_vendor_106d, pci_dev_list_106d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106e, pci_vendor_106e, pci_dev_list_106e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106f, pci_vendor_106f, pci_dev_list_106f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1070, pci_vendor_1070, pci_dev_list_1070}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1071, pci_vendor_1071, pci_dev_list_1071}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1072, pci_vendor_1072, pci_dev_list_1072}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1073, pci_vendor_1073, pci_dev_list_1073}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1074, pci_vendor_1074, pci_dev_list_1074}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1075, pci_vendor_1075, pci_dev_list_1075}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1076, pci_vendor_1076, pci_dev_list_1076}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1077, pci_vendor_1077, pci_dev_list_1077}, +#endif + {0x1078, pci_vendor_1078, pci_dev_list_1078}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1079, pci_vendor_1079, pci_dev_list_1079}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107a, pci_vendor_107a, pci_dev_list_107a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107b, pci_vendor_107b, pci_dev_list_107b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107c, pci_vendor_107c, pci_dev_list_107c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107d, pci_vendor_107d, pci_dev_list_107d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107e, pci_vendor_107e, pci_dev_list_107e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107f, pci_vendor_107f, pci_dev_list_107f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1080, pci_vendor_1080, pci_dev_list_1080}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1081, pci_vendor_1081, pci_dev_list_1081}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1082, pci_vendor_1082, pci_dev_list_1082}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1083, pci_vendor_1083, pci_dev_list_1083}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1084, pci_vendor_1084, pci_dev_list_1084}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1085, pci_vendor_1085, pci_dev_list_1085}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1086, pci_vendor_1086, pci_dev_list_1086}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1087, pci_vendor_1087, pci_dev_list_1087}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1088, pci_vendor_1088, pci_dev_list_1088}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1089, pci_vendor_1089, pci_dev_list_1089}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108a, pci_vendor_108a, pci_dev_list_108a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108c, pci_vendor_108c, pci_dev_list_108c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108d, pci_vendor_108d, pci_dev_list_108d}, +#endif + {0x108e, pci_vendor_108e, pci_dev_list_108e}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108f, pci_vendor_108f, pci_dev_list_108f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1090, pci_vendor_1090, pci_dev_list_1090}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1091, pci_vendor_1091, pci_dev_list_1091}, +#endif + {0x1092, pci_vendor_1092, pci_dev_list_1092}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1093, pci_vendor_1093, pci_dev_list_1093}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1094, pci_vendor_1094, pci_dev_list_1094}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1095, pci_vendor_1095, pci_dev_list_1095}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1096, pci_vendor_1096, pci_dev_list_1096}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1097, pci_vendor_1097, pci_dev_list_1097}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1098, pci_vendor_1098, pci_dev_list_1098}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1099, pci_vendor_1099, pci_dev_list_1099}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109a, pci_vendor_109a, pci_dev_list_109a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109b, pci_vendor_109b, pci_dev_list_109b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109c, pci_vendor_109c, pci_dev_list_109c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109d, pci_vendor_109d, pci_dev_list_109d}, +#endif + {0x109e, pci_vendor_109e, pci_dev_list_109e}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109f, pci_vendor_109f, pci_dev_list_109f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a0, pci_vendor_10a0, pci_dev_list_10a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a1, pci_vendor_10a1, pci_dev_list_10a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a2, pci_vendor_10a2, pci_dev_list_10a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a3, pci_vendor_10a3, pci_dev_list_10a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a4, pci_vendor_10a4, pci_dev_list_10a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a5, pci_vendor_10a5, pci_dev_list_10a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a6, pci_vendor_10a6, pci_dev_list_10a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a7, pci_vendor_10a7, pci_dev_list_10a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a8, pci_vendor_10a8, pci_dev_list_10a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a9, pci_vendor_10a9, pci_dev_list_10a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10aa, pci_vendor_10aa, pci_dev_list_10aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ab, pci_vendor_10ab, pci_dev_list_10ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ac, pci_vendor_10ac, pci_dev_list_10ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ad, pci_vendor_10ad, pci_dev_list_10ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ae, pci_vendor_10ae, pci_dev_list_10ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10af, pci_vendor_10af, pci_dev_list_10af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b0, pci_vendor_10b0, pci_dev_list_10b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b1, pci_vendor_10b1, pci_dev_list_10b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b2, pci_vendor_10b2, pci_dev_list_10b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b3, pci_vendor_10b3, pci_dev_list_10b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b4, pci_vendor_10b4, pci_dev_list_10b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b5, pci_vendor_10b5, pci_dev_list_10b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b6, pci_vendor_10b6, pci_dev_list_10b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b7, pci_vendor_10b7, pci_dev_list_10b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b8, pci_vendor_10b8, pci_dev_list_10b8}, +#endif + {0x10b9, pci_vendor_10b9, pci_dev_list_10b9}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ba, pci_vendor_10ba, pci_dev_list_10ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bb, pci_vendor_10bb, pci_dev_list_10bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bc, pci_vendor_10bc, pci_dev_list_10bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bd, pci_vendor_10bd, pci_dev_list_10bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10be, pci_vendor_10be, pci_dev_list_10be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bf, pci_vendor_10bf, pci_dev_list_10bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c0, pci_vendor_10c0, pci_dev_list_10c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c1, pci_vendor_10c1, pci_dev_list_10c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c2, pci_vendor_10c2, pci_dev_list_10c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c3, pci_vendor_10c3, pci_dev_list_10c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c4, pci_vendor_10c4, pci_dev_list_10c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c5, pci_vendor_10c5, pci_dev_list_10c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c6, pci_vendor_10c6, pci_dev_list_10c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c7, pci_vendor_10c7, pci_dev_list_10c7}, +#endif + {0x10c8, pci_vendor_10c8, pci_dev_list_10c8}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c9, pci_vendor_10c9, pci_dev_list_10c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ca, pci_vendor_10ca, pci_dev_list_10ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cb, pci_vendor_10cb, pci_dev_list_10cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cc, pci_vendor_10cc, pci_dev_list_10cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cd, pci_vendor_10cd, pci_dev_list_10cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ce, pci_vendor_10ce, pci_dev_list_10ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cf, pci_vendor_10cf, pci_dev_list_10cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d0, pci_vendor_10d0, pci_dev_list_10d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d1, pci_vendor_10d1, pci_dev_list_10d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d2, pci_vendor_10d2, pci_dev_list_10d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d3, pci_vendor_10d3, pci_dev_list_10d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d4, pci_vendor_10d4, pci_dev_list_10d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d5, pci_vendor_10d5, pci_dev_list_10d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d6, pci_vendor_10d6, pci_dev_list_10d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d7, pci_vendor_10d7, pci_dev_list_10d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d8, pci_vendor_10d8, pci_dev_list_10d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d9, pci_vendor_10d9, pci_dev_list_10d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10da, pci_vendor_10da, pci_dev_list_10da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10db, pci_vendor_10db, pci_dev_list_10db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10dc, pci_vendor_10dc, pci_dev_list_10dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10dd, pci_vendor_10dd, pci_dev_list_10dd}, +#endif + {0x10de, pci_vendor_10de, pci_dev_list_10de}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10df, pci_vendor_10df, pci_dev_list_10df}, +#endif + {0x10e0, pci_vendor_10e0, pci_dev_list_10e0}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e1, pci_vendor_10e1, pci_dev_list_10e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e2, pci_vendor_10e2, pci_dev_list_10e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e3, pci_vendor_10e3, pci_dev_list_10e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e4, pci_vendor_10e4, pci_dev_list_10e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e5, pci_vendor_10e5, pci_dev_list_10e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e6, pci_vendor_10e6, pci_dev_list_10e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e7, pci_vendor_10e7, pci_dev_list_10e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e8, pci_vendor_10e8, pci_dev_list_10e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e9, pci_vendor_10e9, pci_dev_list_10e9}, +#endif + {0x10ea, pci_vendor_10ea, pci_dev_list_10ea}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10eb, pci_vendor_10eb, pci_dev_list_10eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ec, pci_vendor_10ec, pci_dev_list_10ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ed, pci_vendor_10ed, pci_dev_list_10ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ee, pci_vendor_10ee, pci_dev_list_10ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ef, pci_vendor_10ef, pci_dev_list_10ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f0, pci_vendor_10f0, pci_dev_list_10f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f1, pci_vendor_10f1, pci_dev_list_10f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f2, pci_vendor_10f2, pci_dev_list_10f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f3, pci_vendor_10f3, pci_dev_list_10f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f4, pci_vendor_10f4, pci_dev_list_10f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f5, pci_vendor_10f5, pci_dev_list_10f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f6, pci_vendor_10f6, pci_dev_list_10f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f7, pci_vendor_10f7, pci_dev_list_10f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f8, pci_vendor_10f8, pci_dev_list_10f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f9, pci_vendor_10f9, pci_dev_list_10f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fa, pci_vendor_10fa, pci_dev_list_10fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fb, pci_vendor_10fb, pci_dev_list_10fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fc, pci_vendor_10fc, pci_dev_list_10fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fd, pci_vendor_10fd, pci_dev_list_10fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fe, pci_vendor_10fe, pci_dev_list_10fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ff, pci_vendor_10ff, pci_dev_list_10ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1100, pci_vendor_1100, pci_dev_list_1100}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1101, pci_vendor_1101, pci_dev_list_1101}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1102, pci_vendor_1102, pci_dev_list_1102}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1103, pci_vendor_1103, pci_dev_list_1103}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1104, pci_vendor_1104, pci_dev_list_1104}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1105, pci_vendor_1105, pci_dev_list_1105}, +#endif + {0x1106, pci_vendor_1106, pci_dev_list_1106}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1107, pci_vendor_1107, pci_dev_list_1107}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1108, pci_vendor_1108, pci_dev_list_1108}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1109, pci_vendor_1109, pci_dev_list_1109}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110a, pci_vendor_110a, pci_dev_list_110a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110b, pci_vendor_110b, pci_dev_list_110b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110c, pci_vendor_110c, pci_dev_list_110c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110d, pci_vendor_110d, pci_dev_list_110d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110e, pci_vendor_110e, pci_dev_list_110e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110f, pci_vendor_110f, pci_dev_list_110f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1110, pci_vendor_1110, pci_dev_list_1110}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1111, pci_vendor_1111, pci_dev_list_1111}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1112, pci_vendor_1112, pci_dev_list_1112}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1113, pci_vendor_1113, pci_dev_list_1113}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1114, pci_vendor_1114, pci_dev_list_1114}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1115, pci_vendor_1115, pci_dev_list_1115}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1116, pci_vendor_1116, pci_dev_list_1116}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1117, pci_vendor_1117, pci_dev_list_1117}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1118, pci_vendor_1118, pci_dev_list_1118}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1119, pci_vendor_1119, pci_dev_list_1119}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111a, pci_vendor_111a, pci_dev_list_111a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111b, pci_vendor_111b, pci_dev_list_111b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111c, pci_vendor_111c, pci_dev_list_111c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111d, pci_vendor_111d, pci_dev_list_111d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111e, pci_vendor_111e, pci_dev_list_111e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111f, pci_vendor_111f, pci_dev_list_111f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1120, pci_vendor_1120, pci_dev_list_1120}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1121, pci_vendor_1121, pci_dev_list_1121}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1122, pci_vendor_1122, pci_dev_list_1122}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1123, pci_vendor_1123, pci_dev_list_1123}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1124, pci_vendor_1124, pci_dev_list_1124}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1125, pci_vendor_1125, pci_dev_list_1125}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1126, pci_vendor_1126, pci_dev_list_1126}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1127, pci_vendor_1127, pci_dev_list_1127}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1129, pci_vendor_1129, pci_dev_list_1129}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112a, pci_vendor_112a, pci_dev_list_112a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112b, pci_vendor_112b, pci_dev_list_112b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112c, pci_vendor_112c, pci_dev_list_112c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112d, pci_vendor_112d, pci_dev_list_112d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112e, pci_vendor_112e, pci_dev_list_112e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112f, pci_vendor_112f, pci_dev_list_112f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1130, pci_vendor_1130, pci_dev_list_1130}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1131, pci_vendor_1131, pci_dev_list_1131}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1132, pci_vendor_1132, pci_dev_list_1132}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1133, pci_vendor_1133, pci_dev_list_1133}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1134, pci_vendor_1134, pci_dev_list_1134}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1135, pci_vendor_1135, pci_dev_list_1135}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1136, pci_vendor_1136, pci_dev_list_1136}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1137, pci_vendor_1137, pci_dev_list_1137}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1138, pci_vendor_1138, pci_dev_list_1138}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1139, pci_vendor_1139, pci_dev_list_1139}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113a, pci_vendor_113a, pci_dev_list_113a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113b, pci_vendor_113b, pci_dev_list_113b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113c, pci_vendor_113c, pci_dev_list_113c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113d, pci_vendor_113d, pci_dev_list_113d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113e, pci_vendor_113e, pci_dev_list_113e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113f, pci_vendor_113f, pci_dev_list_113f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1140, pci_vendor_1140, pci_dev_list_1140}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1141, pci_vendor_1141, pci_dev_list_1141}, +#endif + {0x1142, pci_vendor_1142, pci_dev_list_1142}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1143, pci_vendor_1143, pci_dev_list_1143}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1144, pci_vendor_1144, pci_dev_list_1144}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1145, pci_vendor_1145, pci_dev_list_1145}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1146, pci_vendor_1146, pci_dev_list_1146}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1147, pci_vendor_1147, pci_dev_list_1147}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1148, pci_vendor_1148, pci_dev_list_1148}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1149, pci_vendor_1149, pci_dev_list_1149}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114a, pci_vendor_114a, pci_dev_list_114a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114b, pci_vendor_114b, pci_dev_list_114b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114c, pci_vendor_114c, pci_dev_list_114c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114d, pci_vendor_114d, pci_dev_list_114d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114e, pci_vendor_114e, pci_dev_list_114e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114f, pci_vendor_114f, pci_dev_list_114f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1150, pci_vendor_1150, pci_dev_list_1150}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1151, pci_vendor_1151, pci_dev_list_1151}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1152, pci_vendor_1152, pci_dev_list_1152}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1153, pci_vendor_1153, pci_dev_list_1153}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1154, pci_vendor_1154, pci_dev_list_1154}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1155, pci_vendor_1155, pci_dev_list_1155}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1156, pci_vendor_1156, pci_dev_list_1156}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1157, pci_vendor_1157, pci_dev_list_1157}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1158, pci_vendor_1158, pci_dev_list_1158}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1159, pci_vendor_1159, pci_dev_list_1159}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115a, pci_vendor_115a, pci_dev_list_115a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115b, pci_vendor_115b, pci_dev_list_115b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115c, pci_vendor_115c, pci_dev_list_115c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115d, pci_vendor_115d, pci_dev_list_115d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115e, pci_vendor_115e, pci_dev_list_115e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115f, pci_vendor_115f, pci_dev_list_115f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1160, pci_vendor_1160, pci_dev_list_1160}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1161, pci_vendor_1161, pci_dev_list_1161}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1162, pci_vendor_1162, pci_dev_list_1162}, +#endif + {0x1163, pci_vendor_1163, pci_dev_list_1163}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1164, pci_vendor_1164, pci_dev_list_1164}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1165, pci_vendor_1165, pci_dev_list_1165}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1166, pci_vendor_1166, pci_dev_list_1166}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1167, pci_vendor_1167, pci_dev_list_1167}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1168, pci_vendor_1168, pci_dev_list_1168}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1169, pci_vendor_1169, pci_dev_list_1169}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116a, pci_vendor_116a, pci_dev_list_116a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116b, pci_vendor_116b, pci_dev_list_116b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116c, pci_vendor_116c, pci_dev_list_116c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116d, pci_vendor_116d, pci_dev_list_116d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116e, pci_vendor_116e, pci_dev_list_116e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116f, pci_vendor_116f, pci_dev_list_116f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1170, pci_vendor_1170, pci_dev_list_1170}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1171, pci_vendor_1171, pci_dev_list_1171}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1172, pci_vendor_1172, pci_dev_list_1172}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1173, pci_vendor_1173, pci_dev_list_1173}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1174, pci_vendor_1174, pci_dev_list_1174}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1175, pci_vendor_1175, pci_dev_list_1175}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1176, pci_vendor_1176, pci_dev_list_1176}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1177, pci_vendor_1177, pci_dev_list_1177}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1178, pci_vendor_1178, pci_dev_list_1178}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1179, pci_vendor_1179, pci_dev_list_1179}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117a, pci_vendor_117a, pci_dev_list_117a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117b, pci_vendor_117b, pci_dev_list_117b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117c, pci_vendor_117c, pci_dev_list_117c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117d, pci_vendor_117d, pci_dev_list_117d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117e, pci_vendor_117e, pci_dev_list_117e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117f, pci_vendor_117f, pci_dev_list_117f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1180, pci_vendor_1180, pci_dev_list_1180}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1181, pci_vendor_1181, pci_dev_list_1181}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1183, pci_vendor_1183, pci_dev_list_1183}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1184, pci_vendor_1184, pci_dev_list_1184}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1185, pci_vendor_1185, pci_dev_list_1185}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1186, pci_vendor_1186, pci_dev_list_1186}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1187, pci_vendor_1187, pci_dev_list_1187}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1188, pci_vendor_1188, pci_dev_list_1188}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1189, pci_vendor_1189, pci_dev_list_1189}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118a, pci_vendor_118a, pci_dev_list_118a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118b, pci_vendor_118b, pci_dev_list_118b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118c, pci_vendor_118c, pci_dev_list_118c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118d, pci_vendor_118d, pci_dev_list_118d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118e, pci_vendor_118e, pci_dev_list_118e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118f, pci_vendor_118f, pci_dev_list_118f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1190, pci_vendor_1190, pci_dev_list_1190}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1191, pci_vendor_1191, pci_dev_list_1191}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1192, pci_vendor_1192, pci_dev_list_1192}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1193, pci_vendor_1193, pci_dev_list_1193}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1194, pci_vendor_1194, pci_dev_list_1194}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1195, pci_vendor_1195, pci_dev_list_1195}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1196, pci_vendor_1196, pci_dev_list_1196}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1197, pci_vendor_1197, pci_dev_list_1197}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1198, pci_vendor_1198, pci_dev_list_1198}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1199, pci_vendor_1199, pci_dev_list_1199}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119a, pci_vendor_119a, pci_dev_list_119a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119b, pci_vendor_119b, pci_dev_list_119b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119c, pci_vendor_119c, pci_dev_list_119c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119d, pci_vendor_119d, pci_dev_list_119d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119e, pci_vendor_119e, pci_dev_list_119e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119f, pci_vendor_119f, pci_dev_list_119f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a0, pci_vendor_11a0, pci_dev_list_11a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a1, pci_vendor_11a1, pci_dev_list_11a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a2, pci_vendor_11a2, pci_dev_list_11a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a3, pci_vendor_11a3, pci_dev_list_11a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a4, pci_vendor_11a4, pci_dev_list_11a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a5, pci_vendor_11a5, pci_dev_list_11a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a6, pci_vendor_11a6, pci_dev_list_11a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a7, pci_vendor_11a7, pci_dev_list_11a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a8, pci_vendor_11a8, pci_dev_list_11a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a9, pci_vendor_11a9, pci_dev_list_11a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11aa, pci_vendor_11aa, pci_dev_list_11aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ab, pci_vendor_11ab, pci_dev_list_11ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ac, pci_vendor_11ac, pci_dev_list_11ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ad, pci_vendor_11ad, pci_dev_list_11ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ae, pci_vendor_11ae, pci_dev_list_11ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11af, pci_vendor_11af, pci_dev_list_11af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b0, pci_vendor_11b0, pci_dev_list_11b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b1, pci_vendor_11b1, pci_dev_list_11b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b2, pci_vendor_11b2, pci_dev_list_11b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b3, pci_vendor_11b3, pci_dev_list_11b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b4, pci_vendor_11b4, pci_dev_list_11b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b5, pci_vendor_11b5, pci_dev_list_11b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b6, pci_vendor_11b6, pci_dev_list_11b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b7, pci_vendor_11b7, pci_dev_list_11b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b8, pci_vendor_11b8, pci_dev_list_11b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b9, pci_vendor_11b9, pci_dev_list_11b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ba, pci_vendor_11ba, pci_dev_list_11ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bb, pci_vendor_11bb, pci_dev_list_11bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bc, pci_vendor_11bc, pci_dev_list_11bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bd, pci_vendor_11bd, pci_dev_list_11bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11be, pci_vendor_11be, pci_dev_list_11be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bf, pci_vendor_11bf, pci_dev_list_11bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c0, pci_vendor_11c0, pci_dev_list_11c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c1, pci_vendor_11c1, pci_dev_list_11c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c2, pci_vendor_11c2, pci_dev_list_11c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c3, pci_vendor_11c3, pci_dev_list_11c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c4, pci_vendor_11c4, pci_dev_list_11c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c5, pci_vendor_11c5, pci_dev_list_11c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c6, pci_vendor_11c6, pci_dev_list_11c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c7, pci_vendor_11c7, pci_dev_list_11c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c8, pci_vendor_11c8, pci_dev_list_11c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c9, pci_vendor_11c9, pci_dev_list_11c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ca, pci_vendor_11ca, pci_dev_list_11ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cb, pci_vendor_11cb, pci_dev_list_11cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cc, pci_vendor_11cc, pci_dev_list_11cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cd, pci_vendor_11cd, pci_dev_list_11cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ce, pci_vendor_11ce, pci_dev_list_11ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cf, pci_vendor_11cf, pci_dev_list_11cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d0, pci_vendor_11d0, pci_dev_list_11d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d1, pci_vendor_11d1, pci_dev_list_11d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d2, pci_vendor_11d2, pci_dev_list_11d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d3, pci_vendor_11d3, pci_dev_list_11d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d4, pci_vendor_11d4, pci_dev_list_11d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d5, pci_vendor_11d5, pci_dev_list_11d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d6, pci_vendor_11d6, pci_dev_list_11d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d7, pci_vendor_11d7, pci_dev_list_11d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d8, pci_vendor_11d8, pci_dev_list_11d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d9, pci_vendor_11d9, pci_dev_list_11d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11da, pci_vendor_11da, pci_dev_list_11da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11db, pci_vendor_11db, pci_dev_list_11db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11dc, pci_vendor_11dc, pci_dev_list_11dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11dd, pci_vendor_11dd, pci_dev_list_11dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11de, pci_vendor_11de, pci_dev_list_11de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11df, pci_vendor_11df, pci_dev_list_11df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e0, pci_vendor_11e0, pci_dev_list_11e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e1, pci_vendor_11e1, pci_dev_list_11e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e2, pci_vendor_11e2, pci_dev_list_11e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e3, pci_vendor_11e3, pci_dev_list_11e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e4, pci_vendor_11e4, pci_dev_list_11e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e5, pci_vendor_11e5, pci_dev_list_11e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e6, pci_vendor_11e6, pci_dev_list_11e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e7, pci_vendor_11e7, pci_dev_list_11e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e8, pci_vendor_11e8, pci_dev_list_11e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e9, pci_vendor_11e9, pci_dev_list_11e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ea, pci_vendor_11ea, pci_dev_list_11ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11eb, pci_vendor_11eb, pci_dev_list_11eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ec, pci_vendor_11ec, pci_dev_list_11ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ed, pci_vendor_11ed, pci_dev_list_11ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ee, pci_vendor_11ee, pci_dev_list_11ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ef, pci_vendor_11ef, pci_dev_list_11ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f0, pci_vendor_11f0, pci_dev_list_11f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f1, pci_vendor_11f1, pci_dev_list_11f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f2, pci_vendor_11f2, pci_dev_list_11f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f3, pci_vendor_11f3, pci_dev_list_11f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f4, pci_vendor_11f4, pci_dev_list_11f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f5, pci_vendor_11f5, pci_dev_list_11f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f6, pci_vendor_11f6, pci_dev_list_11f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f7, pci_vendor_11f7, pci_dev_list_11f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f8, pci_vendor_11f8, pci_dev_list_11f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f9, pci_vendor_11f9, pci_dev_list_11f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fa, pci_vendor_11fa, pci_dev_list_11fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fb, pci_vendor_11fb, pci_dev_list_11fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fc, pci_vendor_11fc, pci_dev_list_11fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fd, pci_vendor_11fd, pci_dev_list_11fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fe, pci_vendor_11fe, pci_dev_list_11fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ff, pci_vendor_11ff, pci_dev_list_11ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1200, pci_vendor_1200, pci_dev_list_1200}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1201, pci_vendor_1201, pci_dev_list_1201}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1202, pci_vendor_1202, pci_dev_list_1202}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1203, pci_vendor_1203, pci_dev_list_1203}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1204, pci_vendor_1204, pci_dev_list_1204}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1205, pci_vendor_1205, pci_dev_list_1205}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1206, pci_vendor_1206, pci_dev_list_1206}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1208, pci_vendor_1208, pci_dev_list_1208}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1209, pci_vendor_1209, pci_dev_list_1209}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120a, pci_vendor_120a, pci_dev_list_120a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120b, pci_vendor_120b, pci_dev_list_120b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120c, pci_vendor_120c, pci_dev_list_120c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120d, pci_vendor_120d, pci_dev_list_120d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120e, pci_vendor_120e, pci_dev_list_120e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120f, pci_vendor_120f, pci_dev_list_120f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1210, pci_vendor_1210, pci_dev_list_1210}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1211, pci_vendor_1211, pci_dev_list_1211}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1212, pci_vendor_1212, pci_dev_list_1212}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1213, pci_vendor_1213, pci_dev_list_1213}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1214, pci_vendor_1214, pci_dev_list_1214}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1215, pci_vendor_1215, pci_dev_list_1215}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1216, pci_vendor_1216, pci_dev_list_1216}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1217, pci_vendor_1217, pci_dev_list_1217}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1218, pci_vendor_1218, pci_dev_list_1218}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1219, pci_vendor_1219, pci_dev_list_1219}, +#endif + {0x121a, pci_vendor_121a, pci_dev_list_121a}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121b, pci_vendor_121b, pci_dev_list_121b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121c, pci_vendor_121c, pci_dev_list_121c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121d, pci_vendor_121d, pci_dev_list_121d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121e, pci_vendor_121e, pci_dev_list_121e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121f, pci_vendor_121f, pci_dev_list_121f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1220, pci_vendor_1220, pci_dev_list_1220}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1221, pci_vendor_1221, pci_dev_list_1221}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1222, pci_vendor_1222, pci_dev_list_1222}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1223, pci_vendor_1223, pci_dev_list_1223}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1224, pci_vendor_1224, pci_dev_list_1224}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1225, pci_vendor_1225, pci_dev_list_1225}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1227, pci_vendor_1227, pci_dev_list_1227}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1228, pci_vendor_1228, pci_dev_list_1228}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1229, pci_vendor_1229, pci_dev_list_1229}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122a, pci_vendor_122a, pci_dev_list_122a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122b, pci_vendor_122b, pci_dev_list_122b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122c, pci_vendor_122c, pci_dev_list_122c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122d, pci_vendor_122d, pci_dev_list_122d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122e, pci_vendor_122e, pci_dev_list_122e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122f, pci_vendor_122f, pci_dev_list_122f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1230, pci_vendor_1230, pci_dev_list_1230}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1231, pci_vendor_1231, pci_dev_list_1231}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1232, pci_vendor_1232, pci_dev_list_1232}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1233, pci_vendor_1233, pci_dev_list_1233}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1234, pci_vendor_1234, pci_dev_list_1234}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1235, pci_vendor_1235, pci_dev_list_1235}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1236, pci_vendor_1236, pci_dev_list_1236}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1237, pci_vendor_1237, pci_dev_list_1237}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1238, pci_vendor_1238, pci_dev_list_1238}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1239, pci_vendor_1239, pci_dev_list_1239}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123a, pci_vendor_123a, pci_dev_list_123a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123b, pci_vendor_123b, pci_dev_list_123b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123c, pci_vendor_123c, pci_dev_list_123c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123d, pci_vendor_123d, pci_dev_list_123d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123e, pci_vendor_123e, pci_dev_list_123e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123f, pci_vendor_123f, pci_dev_list_123f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1240, pci_vendor_1240, pci_dev_list_1240}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1241, pci_vendor_1241, pci_dev_list_1241}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1242, pci_vendor_1242, pci_dev_list_1242}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1243, pci_vendor_1243, pci_dev_list_1243}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1244, pci_vendor_1244, pci_dev_list_1244}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1245, pci_vendor_1245, pci_dev_list_1245}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1246, pci_vendor_1246, pci_dev_list_1246}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1247, pci_vendor_1247, pci_dev_list_1247}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1248, pci_vendor_1248, pci_dev_list_1248}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1249, pci_vendor_1249, pci_dev_list_1249}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124a, pci_vendor_124a, pci_dev_list_124a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124b, pci_vendor_124b, pci_dev_list_124b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124c, pci_vendor_124c, pci_dev_list_124c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124d, pci_vendor_124d, pci_dev_list_124d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124e, pci_vendor_124e, pci_dev_list_124e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124f, pci_vendor_124f, pci_dev_list_124f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1250, pci_vendor_1250, pci_dev_list_1250}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1251, pci_vendor_1251, pci_dev_list_1251}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1253, pci_vendor_1253, pci_dev_list_1253}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1254, pci_vendor_1254, pci_dev_list_1254}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1255, pci_vendor_1255, pci_dev_list_1255}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1256, pci_vendor_1256, pci_dev_list_1256}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1257, pci_vendor_1257, pci_dev_list_1257}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1258, pci_vendor_1258, pci_dev_list_1258}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1259, pci_vendor_1259, pci_dev_list_1259}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125a, pci_vendor_125a, pci_dev_list_125a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125b, pci_vendor_125b, pci_dev_list_125b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125c, pci_vendor_125c, pci_dev_list_125c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125d, pci_vendor_125d, pci_dev_list_125d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125e, pci_vendor_125e, pci_dev_list_125e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125f, pci_vendor_125f, pci_dev_list_125f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1260, pci_vendor_1260, pci_dev_list_1260}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1261, pci_vendor_1261, pci_dev_list_1261}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1262, pci_vendor_1262, pci_dev_list_1262}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1263, pci_vendor_1263, pci_dev_list_1263}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1264, pci_vendor_1264, pci_dev_list_1264}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1265, pci_vendor_1265, pci_dev_list_1265}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1266, pci_vendor_1266, pci_dev_list_1266}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1267, pci_vendor_1267, pci_dev_list_1267}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1268, pci_vendor_1268, pci_dev_list_1268}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1269, pci_vendor_1269, pci_dev_list_1269}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126a, pci_vendor_126a, pci_dev_list_126a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126b, pci_vendor_126b, pci_dev_list_126b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126c, pci_vendor_126c, pci_dev_list_126c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126d, pci_vendor_126d, pci_dev_list_126d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126e, pci_vendor_126e, pci_dev_list_126e}, +#endif + {0x126f, pci_vendor_126f, pci_dev_list_126f}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1270, pci_vendor_1270, pci_dev_list_1270}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1271, pci_vendor_1271, pci_dev_list_1271}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1272, pci_vendor_1272, pci_dev_list_1272}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1273, pci_vendor_1273, pci_dev_list_1273}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1274, pci_vendor_1274, pci_dev_list_1274}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1275, pci_vendor_1275, pci_dev_list_1275}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1276, pci_vendor_1276, pci_dev_list_1276}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1277, pci_vendor_1277, pci_dev_list_1277}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1278, pci_vendor_1278, pci_dev_list_1278}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1279, pci_vendor_1279, pci_dev_list_1279}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127a, pci_vendor_127a, pci_dev_list_127a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127b, pci_vendor_127b, pci_dev_list_127b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127c, pci_vendor_127c, pci_dev_list_127c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127d, pci_vendor_127d, pci_dev_list_127d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127e, pci_vendor_127e, pci_dev_list_127e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127f, pci_vendor_127f, pci_dev_list_127f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1280, pci_vendor_1280, pci_dev_list_1280}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1281, pci_vendor_1281, pci_dev_list_1281}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1282, pci_vendor_1282, pci_dev_list_1282}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1283, pci_vendor_1283, pci_dev_list_1283}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1284, pci_vendor_1284, pci_dev_list_1284}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1285, pci_vendor_1285, pci_dev_list_1285}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1286, pci_vendor_1286, pci_dev_list_1286}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1287, pci_vendor_1287, pci_dev_list_1287}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1288, pci_vendor_1288, pci_dev_list_1288}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1289, pci_vendor_1289, pci_dev_list_1289}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128a, pci_vendor_128a, pci_dev_list_128a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128b, pci_vendor_128b, pci_dev_list_128b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128c, pci_vendor_128c, pci_dev_list_128c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128d, pci_vendor_128d, pci_dev_list_128d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128e, pci_vendor_128e, pci_dev_list_128e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128f, pci_vendor_128f, pci_dev_list_128f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1290, pci_vendor_1290, pci_dev_list_1290}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1291, pci_vendor_1291, pci_dev_list_1291}, +#endif + {0x1292, pci_vendor_1292, pci_dev_list_1292}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1293, pci_vendor_1293, pci_dev_list_1293}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1294, pci_vendor_1294, pci_dev_list_1294}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1295, pci_vendor_1295, pci_dev_list_1295}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1296, pci_vendor_1296, pci_dev_list_1296}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1297, pci_vendor_1297, pci_dev_list_1297}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1298, pci_vendor_1298, pci_dev_list_1298}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1299, pci_vendor_1299, pci_dev_list_1299}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129a, pci_vendor_129a, pci_dev_list_129a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129b, pci_vendor_129b, pci_dev_list_129b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129c, pci_vendor_129c, pci_dev_list_129c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129d, pci_vendor_129d, pci_dev_list_129d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129e, pci_vendor_129e, pci_dev_list_129e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129f, pci_vendor_129f, pci_dev_list_129f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a0, pci_vendor_12a0, pci_dev_list_12a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a1, pci_vendor_12a1, pci_dev_list_12a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a2, pci_vendor_12a2, pci_dev_list_12a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a3, pci_vendor_12a3, pci_dev_list_12a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a4, pci_vendor_12a4, pci_dev_list_12a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a5, pci_vendor_12a5, pci_dev_list_12a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a6, pci_vendor_12a6, pci_dev_list_12a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a7, pci_vendor_12a7, pci_dev_list_12a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a8, pci_vendor_12a8, pci_dev_list_12a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a9, pci_vendor_12a9, pci_dev_list_12a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12aa, pci_vendor_12aa, pci_dev_list_12aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ab, pci_vendor_12ab, pci_dev_list_12ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ac, pci_vendor_12ac, pci_dev_list_12ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ad, pci_vendor_12ad, pci_dev_list_12ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ae, pci_vendor_12ae, pci_dev_list_12ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12af, pci_vendor_12af, pci_dev_list_12af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b0, pci_vendor_12b0, pci_dev_list_12b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b1, pci_vendor_12b1, pci_dev_list_12b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b2, pci_vendor_12b2, pci_dev_list_12b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b3, pci_vendor_12b3, pci_dev_list_12b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b4, pci_vendor_12b4, pci_dev_list_12b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b5, pci_vendor_12b5, pci_dev_list_12b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b6, pci_vendor_12b6, pci_dev_list_12b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b7, pci_vendor_12b7, pci_dev_list_12b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b8, pci_vendor_12b8, pci_dev_list_12b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b9, pci_vendor_12b9, pci_dev_list_12b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ba, pci_vendor_12ba, pci_dev_list_12ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bb, pci_vendor_12bb, pci_dev_list_12bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bc, pci_vendor_12bc, pci_dev_list_12bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bd, pci_vendor_12bd, pci_dev_list_12bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12be, pci_vendor_12be, pci_dev_list_12be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bf, pci_vendor_12bf, pci_dev_list_12bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c0, pci_vendor_12c0, pci_dev_list_12c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c1, pci_vendor_12c1, pci_dev_list_12c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c2, pci_vendor_12c2, pci_dev_list_12c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c3, pci_vendor_12c3, pci_dev_list_12c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c4, pci_vendor_12c4, pci_dev_list_12c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c5, pci_vendor_12c5, pci_dev_list_12c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c6, pci_vendor_12c6, pci_dev_list_12c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c7, pci_vendor_12c7, pci_dev_list_12c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c8, pci_vendor_12c8, pci_dev_list_12c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c9, pci_vendor_12c9, pci_dev_list_12c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ca, pci_vendor_12ca, pci_dev_list_12ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cb, pci_vendor_12cb, pci_dev_list_12cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cc, pci_vendor_12cc, pci_dev_list_12cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cd, pci_vendor_12cd, pci_dev_list_12cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ce, pci_vendor_12ce, pci_dev_list_12ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cf, pci_vendor_12cf, pci_dev_list_12cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d0, pci_vendor_12d0, pci_dev_list_12d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d1, pci_vendor_12d1, pci_dev_list_12d1}, +#endif + {0x12d2, pci_vendor_12d2, pci_dev_list_12d2}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d3, pci_vendor_12d3, pci_dev_list_12d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d4, pci_vendor_12d4, pci_dev_list_12d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d5, pci_vendor_12d5, pci_dev_list_12d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d6, pci_vendor_12d6, pci_dev_list_12d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d7, pci_vendor_12d7, pci_dev_list_12d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d8, pci_vendor_12d8, pci_dev_list_12d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d9, pci_vendor_12d9, pci_dev_list_12d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12da, pci_vendor_12da, pci_dev_list_12da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12db, pci_vendor_12db, pci_dev_list_12db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12dc, pci_vendor_12dc, pci_dev_list_12dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12dd, pci_vendor_12dd, pci_dev_list_12dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12de, pci_vendor_12de, pci_dev_list_12de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12df, pci_vendor_12df, pci_dev_list_12df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e0, pci_vendor_12e0, pci_dev_list_12e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e1, pci_vendor_12e1, pci_dev_list_12e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e2, pci_vendor_12e2, pci_dev_list_12e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e3, pci_vendor_12e3, pci_dev_list_12e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e4, pci_vendor_12e4, pci_dev_list_12e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e5, pci_vendor_12e5, pci_dev_list_12e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e6, pci_vendor_12e6, pci_dev_list_12e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e7, pci_vendor_12e7, pci_dev_list_12e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e8, pci_vendor_12e8, pci_dev_list_12e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e9, pci_vendor_12e9, pci_dev_list_12e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ea, pci_vendor_12ea, pci_dev_list_12ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12eb, pci_vendor_12eb, pci_dev_list_12eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ec, pci_vendor_12ec, pci_dev_list_12ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ed, pci_vendor_12ed, pci_dev_list_12ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ee, pci_vendor_12ee, pci_dev_list_12ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ef, pci_vendor_12ef, pci_dev_list_12ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f0, pci_vendor_12f0, pci_dev_list_12f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f1, pci_vendor_12f1, pci_dev_list_12f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f2, pci_vendor_12f2, pci_dev_list_12f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f3, pci_vendor_12f3, pci_dev_list_12f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f4, pci_vendor_12f4, pci_dev_list_12f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f5, pci_vendor_12f5, pci_dev_list_12f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f6, pci_vendor_12f6, pci_dev_list_12f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f7, pci_vendor_12f7, pci_dev_list_12f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f8, pci_vendor_12f8, pci_dev_list_12f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f9, pci_vendor_12f9, pci_dev_list_12f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fb, pci_vendor_12fb, pci_dev_list_12fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fc, pci_vendor_12fc, pci_dev_list_12fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fd, pci_vendor_12fd, pci_dev_list_12fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fe, pci_vendor_12fe, pci_dev_list_12fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ff, pci_vendor_12ff, pci_dev_list_12ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1300, pci_vendor_1300, pci_dev_list_1300}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1302, pci_vendor_1302, pci_dev_list_1302}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1303, pci_vendor_1303, pci_dev_list_1303}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1304, pci_vendor_1304, pci_dev_list_1304}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1305, pci_vendor_1305, pci_dev_list_1305}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1306, pci_vendor_1306, pci_dev_list_1306}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1307, pci_vendor_1307, pci_dev_list_1307}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1308, pci_vendor_1308, pci_dev_list_1308}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1309, pci_vendor_1309, pci_dev_list_1309}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130a, pci_vendor_130a, pci_dev_list_130a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130b, pci_vendor_130b, pci_dev_list_130b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130c, pci_vendor_130c, pci_dev_list_130c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130d, pci_vendor_130d, pci_dev_list_130d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130e, pci_vendor_130e, pci_dev_list_130e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130f, pci_vendor_130f, pci_dev_list_130f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1310, pci_vendor_1310, pci_dev_list_1310}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1311, pci_vendor_1311, pci_dev_list_1311}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1312, pci_vendor_1312, pci_dev_list_1312}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1313, pci_vendor_1313, pci_dev_list_1313}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1316, pci_vendor_1316, pci_dev_list_1316}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1317, pci_vendor_1317, pci_dev_list_1317}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1318, pci_vendor_1318, pci_dev_list_1318}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1319, pci_vendor_1319, pci_dev_list_1319}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131a, pci_vendor_131a, pci_dev_list_131a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131c, pci_vendor_131c, pci_dev_list_131c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131d, pci_vendor_131d, pci_dev_list_131d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131e, pci_vendor_131e, pci_dev_list_131e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131f, pci_vendor_131f, pci_dev_list_131f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1320, pci_vendor_1320, pci_dev_list_1320}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1321, pci_vendor_1321, pci_dev_list_1321}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1322, pci_vendor_1322, pci_dev_list_1322}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1323, pci_vendor_1323, pci_dev_list_1323}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1324, pci_vendor_1324, pci_dev_list_1324}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1325, pci_vendor_1325, pci_dev_list_1325}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1326, pci_vendor_1326, pci_dev_list_1326}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1327, pci_vendor_1327, pci_dev_list_1327}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1328, pci_vendor_1328, pci_dev_list_1328}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1329, pci_vendor_1329, pci_dev_list_1329}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132a, pci_vendor_132a, pci_dev_list_132a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132b, pci_vendor_132b, pci_dev_list_132b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132c, pci_vendor_132c, pci_dev_list_132c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132d, pci_vendor_132d, pci_dev_list_132d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1330, pci_vendor_1330, pci_dev_list_1330}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1331, pci_vendor_1331, pci_dev_list_1331}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1332, pci_vendor_1332, pci_dev_list_1332}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1334, pci_vendor_1334, pci_dev_list_1334}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1335, pci_vendor_1335, pci_dev_list_1335}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1337, pci_vendor_1337, pci_dev_list_1337}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1338, pci_vendor_1338, pci_dev_list_1338}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133a, pci_vendor_133a, pci_dev_list_133a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133b, pci_vendor_133b, pci_dev_list_133b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133c, pci_vendor_133c, pci_dev_list_133c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133d, pci_vendor_133d, pci_dev_list_133d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133e, pci_vendor_133e, pci_dev_list_133e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133f, pci_vendor_133f, pci_dev_list_133f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1340, pci_vendor_1340, pci_dev_list_1340}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1341, pci_vendor_1341, pci_dev_list_1341}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1342, pci_vendor_1342, pci_dev_list_1342}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1343, pci_vendor_1343, pci_dev_list_1343}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1344, pci_vendor_1344, pci_dev_list_1344}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1345, pci_vendor_1345, pci_dev_list_1345}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1347, pci_vendor_1347, pci_dev_list_1347}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1349, pci_vendor_1349, pci_dev_list_1349}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134a, pci_vendor_134a, pci_dev_list_134a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134b, pci_vendor_134b, pci_dev_list_134b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134c, pci_vendor_134c, pci_dev_list_134c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134d, pci_vendor_134d, pci_dev_list_134d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134e, pci_vendor_134e, pci_dev_list_134e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134f, pci_vendor_134f, pci_dev_list_134f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1350, pci_vendor_1350, pci_dev_list_1350}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1351, pci_vendor_1351, pci_dev_list_1351}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1353, pci_vendor_1353, pci_dev_list_1353}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1354, pci_vendor_1354, pci_dev_list_1354}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1355, pci_vendor_1355, pci_dev_list_1355}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1356, pci_vendor_1356, pci_dev_list_1356}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1359, pci_vendor_1359, pci_dev_list_1359}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135a, pci_vendor_135a, pci_dev_list_135a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135b, pci_vendor_135b, pci_dev_list_135b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135c, pci_vendor_135c, pci_dev_list_135c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135d, pci_vendor_135d, pci_dev_list_135d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135e, pci_vendor_135e, pci_dev_list_135e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135f, pci_vendor_135f, pci_dev_list_135f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1360, pci_vendor_1360, pci_dev_list_1360}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1361, pci_vendor_1361, pci_dev_list_1361}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1362, pci_vendor_1362, pci_dev_list_1362}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1363, pci_vendor_1363, pci_dev_list_1363}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1364, pci_vendor_1364, pci_dev_list_1364}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1365, pci_vendor_1365, pci_dev_list_1365}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1366, pci_vendor_1366, pci_dev_list_1366}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1367, pci_vendor_1367, pci_dev_list_1367}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1368, pci_vendor_1368, pci_dev_list_1368}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1369, pci_vendor_1369, pci_dev_list_1369}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136a, pci_vendor_136a, pci_dev_list_136a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136b, pci_vendor_136b, pci_dev_list_136b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136c, pci_vendor_136c, pci_dev_list_136c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136d, pci_vendor_136d, pci_dev_list_136d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136f, pci_vendor_136f, pci_dev_list_136f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1370, pci_vendor_1370, pci_dev_list_1370}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1371, pci_vendor_1371, pci_dev_list_1371}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1373, pci_vendor_1373, pci_dev_list_1373}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1374, pci_vendor_1374, pci_dev_list_1374}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1375, pci_vendor_1375, pci_dev_list_1375}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1376, pci_vendor_1376, pci_dev_list_1376}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1377, pci_vendor_1377, pci_dev_list_1377}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1378, pci_vendor_1378, pci_dev_list_1378}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1379, pci_vendor_1379, pci_dev_list_1379}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137a, pci_vendor_137a, pci_dev_list_137a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137b, pci_vendor_137b, pci_dev_list_137b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137c, pci_vendor_137c, pci_dev_list_137c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137d, pci_vendor_137d, pci_dev_list_137d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137e, pci_vendor_137e, pci_dev_list_137e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137f, pci_vendor_137f, pci_dev_list_137f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1380, pci_vendor_1380, pci_dev_list_1380}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1381, pci_vendor_1381, pci_dev_list_1381}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1382, pci_vendor_1382, pci_dev_list_1382}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1383, pci_vendor_1383, pci_dev_list_1383}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1384, pci_vendor_1384, pci_dev_list_1384}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1385, pci_vendor_1385, pci_dev_list_1385}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1386, pci_vendor_1386, pci_dev_list_1386}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1387, pci_vendor_1387, pci_dev_list_1387}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1388, pci_vendor_1388, pci_dev_list_1388}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1389, pci_vendor_1389, pci_dev_list_1389}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138a, pci_vendor_138a, pci_dev_list_138a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138b, pci_vendor_138b, pci_dev_list_138b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138c, pci_vendor_138c, pci_dev_list_138c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138d, pci_vendor_138d, pci_dev_list_138d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138e, pci_vendor_138e, pci_dev_list_138e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138f, pci_vendor_138f, pci_dev_list_138f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1390, pci_vendor_1390, pci_dev_list_1390}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1391, pci_vendor_1391, pci_dev_list_1391}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1392, pci_vendor_1392, pci_dev_list_1392}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1393, pci_vendor_1393, pci_dev_list_1393}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1394, pci_vendor_1394, pci_dev_list_1394}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1395, pci_vendor_1395, pci_dev_list_1395}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1396, pci_vendor_1396, pci_dev_list_1396}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1397, pci_vendor_1397, pci_dev_list_1397}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1398, pci_vendor_1398, pci_dev_list_1398}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1399, pci_vendor_1399, pci_dev_list_1399}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139a, pci_vendor_139a, pci_dev_list_139a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139b, pci_vendor_139b, pci_dev_list_139b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139c, pci_vendor_139c, pci_dev_list_139c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139d, pci_vendor_139d, pci_dev_list_139d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139e, pci_vendor_139e, pci_dev_list_139e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139f, pci_vendor_139f, pci_dev_list_139f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a0, pci_vendor_13a0, pci_dev_list_13a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a1, pci_vendor_13a1, pci_dev_list_13a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a2, pci_vendor_13a2, pci_dev_list_13a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a3, pci_vendor_13a3, pci_dev_list_13a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a4, pci_vendor_13a4, pci_dev_list_13a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a5, pci_vendor_13a5, pci_dev_list_13a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a6, pci_vendor_13a6, pci_dev_list_13a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a7, pci_vendor_13a7, pci_dev_list_13a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a8, pci_vendor_13a8, pci_dev_list_13a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a9, pci_vendor_13a9, pci_dev_list_13a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13aa, pci_vendor_13aa, pci_dev_list_13aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ab, pci_vendor_13ab, pci_dev_list_13ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ac, pci_vendor_13ac, pci_dev_list_13ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ad, pci_vendor_13ad, pci_dev_list_13ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ae, pci_vendor_13ae, pci_dev_list_13ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13af, pci_vendor_13af, pci_dev_list_13af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b0, pci_vendor_13b0, pci_dev_list_13b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b1, pci_vendor_13b1, pci_dev_list_13b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b2, pci_vendor_13b2, pci_dev_list_13b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b3, pci_vendor_13b3, pci_dev_list_13b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b4, pci_vendor_13b4, pci_dev_list_13b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b5, pci_vendor_13b5, pci_dev_list_13b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b6, pci_vendor_13b6, pci_dev_list_13b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b7, pci_vendor_13b7, pci_dev_list_13b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b8, pci_vendor_13b8, pci_dev_list_13b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b9, pci_vendor_13b9, pci_dev_list_13b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ba, pci_vendor_13ba, pci_dev_list_13ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bb, pci_vendor_13bb, pci_dev_list_13bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bc, pci_vendor_13bc, pci_dev_list_13bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bd, pci_vendor_13bd, pci_dev_list_13bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13be, pci_vendor_13be, pci_dev_list_13be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bf, pci_vendor_13bf, pci_dev_list_13bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c0, pci_vendor_13c0, pci_dev_list_13c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c1, pci_vendor_13c1, pci_dev_list_13c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c2, pci_vendor_13c2, pci_dev_list_13c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c3, pci_vendor_13c3, pci_dev_list_13c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c4, pci_vendor_13c4, pci_dev_list_13c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c5, pci_vendor_13c5, pci_dev_list_13c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c6, pci_vendor_13c6, pci_dev_list_13c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c7, pci_vendor_13c7, pci_dev_list_13c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c8, pci_vendor_13c8, pci_dev_list_13c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c9, pci_vendor_13c9, pci_dev_list_13c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ca, pci_vendor_13ca, pci_dev_list_13ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cb, pci_vendor_13cb, pci_dev_list_13cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cc, pci_vendor_13cc, pci_dev_list_13cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cd, pci_vendor_13cd, pci_dev_list_13cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ce, pci_vendor_13ce, pci_dev_list_13ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cf, pci_vendor_13cf, pci_dev_list_13cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d0, pci_vendor_13d0, pci_dev_list_13d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d1, pci_vendor_13d1, pci_dev_list_13d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d2, pci_vendor_13d2, pci_dev_list_13d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d3, pci_vendor_13d3, pci_dev_list_13d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d4, pci_vendor_13d4, pci_dev_list_13d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d5, pci_vendor_13d5, pci_dev_list_13d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d6, pci_vendor_13d6, pci_dev_list_13d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d7, pci_vendor_13d7, pci_dev_list_13d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d8, pci_vendor_13d8, pci_dev_list_13d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d9, pci_vendor_13d9, pci_dev_list_13d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13da, pci_vendor_13da, pci_dev_list_13da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13db, pci_vendor_13db, pci_dev_list_13db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13dc, pci_vendor_13dc, pci_dev_list_13dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13dd, pci_vendor_13dd, pci_dev_list_13dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13de, pci_vendor_13de, pci_dev_list_13de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13df, pci_vendor_13df, pci_dev_list_13df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e0, pci_vendor_13e0, pci_dev_list_13e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e1, pci_vendor_13e1, pci_dev_list_13e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e2, pci_vendor_13e2, pci_dev_list_13e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e3, pci_vendor_13e3, pci_dev_list_13e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e4, pci_vendor_13e4, pci_dev_list_13e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e5, pci_vendor_13e5, pci_dev_list_13e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e6, pci_vendor_13e6, pci_dev_list_13e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e7, pci_vendor_13e7, pci_dev_list_13e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e8, pci_vendor_13e8, pci_dev_list_13e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e9, pci_vendor_13e9, pci_dev_list_13e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ea, pci_vendor_13ea, pci_dev_list_13ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13eb, pci_vendor_13eb, pci_dev_list_13eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ec, pci_vendor_13ec, pci_dev_list_13ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ed, pci_vendor_13ed, pci_dev_list_13ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ee, pci_vendor_13ee, pci_dev_list_13ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ef, pci_vendor_13ef, pci_dev_list_13ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f0, pci_vendor_13f0, pci_dev_list_13f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f1, pci_vendor_13f1, pci_dev_list_13f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f2, pci_vendor_13f2, pci_dev_list_13f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f3, pci_vendor_13f3, pci_dev_list_13f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f4, pci_vendor_13f4, pci_dev_list_13f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f5, pci_vendor_13f5, pci_dev_list_13f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f6, pci_vendor_13f6, pci_dev_list_13f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f7, pci_vendor_13f7, pci_dev_list_13f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f8, pci_vendor_13f8, pci_dev_list_13f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f9, pci_vendor_13f9, pci_dev_list_13f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fa, pci_vendor_13fa, pci_dev_list_13fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fb, pci_vendor_13fb, pci_dev_list_13fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fc, pci_vendor_13fc, pci_dev_list_13fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fd, pci_vendor_13fd, pci_dev_list_13fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fe, pci_vendor_13fe, pci_dev_list_13fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ff, pci_vendor_13ff, pci_dev_list_13ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1400, pci_vendor_1400, pci_dev_list_1400}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1401, pci_vendor_1401, pci_dev_list_1401}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1402, pci_vendor_1402, pci_dev_list_1402}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1403, pci_vendor_1403, pci_dev_list_1403}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1404, pci_vendor_1404, pci_dev_list_1404}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1405, pci_vendor_1405, pci_dev_list_1405}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1406, pci_vendor_1406, pci_dev_list_1406}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1407, pci_vendor_1407, pci_dev_list_1407}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1408, pci_vendor_1408, pci_dev_list_1408}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1409, pci_vendor_1409, pci_dev_list_1409}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140a, pci_vendor_140a, pci_dev_list_140a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140b, pci_vendor_140b, pci_dev_list_140b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140c, pci_vendor_140c, pci_dev_list_140c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140d, pci_vendor_140d, pci_dev_list_140d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140e, pci_vendor_140e, pci_dev_list_140e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140f, pci_vendor_140f, pci_dev_list_140f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1410, pci_vendor_1410, pci_dev_list_1410}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1411, pci_vendor_1411, pci_dev_list_1411}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1412, pci_vendor_1412, pci_dev_list_1412}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1413, pci_vendor_1413, pci_dev_list_1413}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1414, pci_vendor_1414, pci_dev_list_1414}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1415, pci_vendor_1415, pci_dev_list_1415}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1416, pci_vendor_1416, pci_dev_list_1416}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1417, pci_vendor_1417, pci_dev_list_1417}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1418, pci_vendor_1418, pci_dev_list_1418}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1419, pci_vendor_1419, pci_dev_list_1419}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141a, pci_vendor_141a, pci_dev_list_141a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141b, pci_vendor_141b, pci_dev_list_141b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141d, pci_vendor_141d, pci_dev_list_141d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141e, pci_vendor_141e, pci_dev_list_141e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141f, pci_vendor_141f, pci_dev_list_141f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1420, pci_vendor_1420, pci_dev_list_1420}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1421, pci_vendor_1421, pci_dev_list_1421}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1422, pci_vendor_1422, pci_dev_list_1422}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1423, pci_vendor_1423, pci_dev_list_1423}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1424, pci_vendor_1424, pci_dev_list_1424}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1425, pci_vendor_1425, pci_dev_list_1425}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1426, pci_vendor_1426, pci_dev_list_1426}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1427, pci_vendor_1427, pci_dev_list_1427}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1428, pci_vendor_1428, pci_dev_list_1428}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1429, pci_vendor_1429, pci_dev_list_1429}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142a, pci_vendor_142a, pci_dev_list_142a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142b, pci_vendor_142b, pci_dev_list_142b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142c, pci_vendor_142c, pci_dev_list_142c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142d, pci_vendor_142d, pci_dev_list_142d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142e, pci_vendor_142e, pci_dev_list_142e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142f, pci_vendor_142f, pci_dev_list_142f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1430, pci_vendor_1430, pci_dev_list_1430}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1431, pci_vendor_1431, pci_dev_list_1431}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1432, pci_vendor_1432, pci_dev_list_1432}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1433, pci_vendor_1433, pci_dev_list_1433}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1435, pci_vendor_1435, pci_dev_list_1435}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1436, pci_vendor_1436, pci_dev_list_1436}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1437, pci_vendor_1437, pci_dev_list_1437}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1438, pci_vendor_1438, pci_dev_list_1438}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1439, pci_vendor_1439, pci_dev_list_1439}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143a, pci_vendor_143a, pci_dev_list_143a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143b, pci_vendor_143b, pci_dev_list_143b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143c, pci_vendor_143c, pci_dev_list_143c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143d, pci_vendor_143d, pci_dev_list_143d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143e, pci_vendor_143e, pci_dev_list_143e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143f, pci_vendor_143f, pci_dev_list_143f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1440, pci_vendor_1440, pci_dev_list_1440}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1441, pci_vendor_1441, pci_dev_list_1441}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1442, pci_vendor_1442, pci_dev_list_1442}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1443, pci_vendor_1443, pci_dev_list_1443}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1444, pci_vendor_1444, pci_dev_list_1444}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1445, pci_vendor_1445, pci_dev_list_1445}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1446, pci_vendor_1446, pci_dev_list_1446}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1447, pci_vendor_1447, pci_dev_list_1447}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1448, pci_vendor_1448, pci_dev_list_1448}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1449, pci_vendor_1449, pci_dev_list_1449}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144a, pci_vendor_144a, pci_dev_list_144a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144b, pci_vendor_144b, pci_dev_list_144b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144c, pci_vendor_144c, pci_dev_list_144c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144d, pci_vendor_144d, pci_dev_list_144d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144e, pci_vendor_144e, pci_dev_list_144e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144f, pci_vendor_144f, pci_dev_list_144f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1450, pci_vendor_1450, pci_dev_list_1450}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1451, pci_vendor_1451, pci_dev_list_1451}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1453, pci_vendor_1453, pci_dev_list_1453}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1454, pci_vendor_1454, pci_dev_list_1454}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1455, pci_vendor_1455, pci_dev_list_1455}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1456, pci_vendor_1456, pci_dev_list_1456}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1457, pci_vendor_1457, pci_dev_list_1457}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1458, pci_vendor_1458, pci_dev_list_1458}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1459, pci_vendor_1459, pci_dev_list_1459}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145a, pci_vendor_145a, pci_dev_list_145a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145b, pci_vendor_145b, pci_dev_list_145b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145c, pci_vendor_145c, pci_dev_list_145c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145d, pci_vendor_145d, pci_dev_list_145d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145e, pci_vendor_145e, pci_dev_list_145e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145f, pci_vendor_145f, pci_dev_list_145f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1460, pci_vendor_1460, pci_dev_list_1460}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1461, pci_vendor_1461, pci_dev_list_1461}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1462, pci_vendor_1462, pci_dev_list_1462}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1463, pci_vendor_1463, pci_dev_list_1463}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1464, pci_vendor_1464, pci_dev_list_1464}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1465, pci_vendor_1465, pci_dev_list_1465}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1466, pci_vendor_1466, pci_dev_list_1466}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1467, pci_vendor_1467, pci_dev_list_1467}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1468, pci_vendor_1468, pci_dev_list_1468}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1469, pci_vendor_1469, pci_dev_list_1469}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146a, pci_vendor_146a, pci_dev_list_146a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146b, pci_vendor_146b, pci_dev_list_146b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146c, pci_vendor_146c, pci_dev_list_146c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146d, pci_vendor_146d, pci_dev_list_146d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146e, pci_vendor_146e, pci_dev_list_146e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146f, pci_vendor_146f, pci_dev_list_146f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1470, pci_vendor_1470, pci_dev_list_1470}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1471, pci_vendor_1471, pci_dev_list_1471}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1472, pci_vendor_1472, pci_dev_list_1472}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1473, pci_vendor_1473, pci_dev_list_1473}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1474, pci_vendor_1474, pci_dev_list_1474}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1475, pci_vendor_1475, pci_dev_list_1475}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1476, pci_vendor_1476, pci_dev_list_1476}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1477, pci_vendor_1477, pci_dev_list_1477}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1478, pci_vendor_1478, pci_dev_list_1478}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1479, pci_vendor_1479, pci_dev_list_1479}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147a, pci_vendor_147a, pci_dev_list_147a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147b, pci_vendor_147b, pci_dev_list_147b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147c, pci_vendor_147c, pci_dev_list_147c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147d, pci_vendor_147d, pci_dev_list_147d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147e, pci_vendor_147e, pci_dev_list_147e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147f, pci_vendor_147f, pci_dev_list_147f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1480, pci_vendor_1480, pci_dev_list_1480}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1481, pci_vendor_1481, pci_dev_list_1481}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1482, pci_vendor_1482, pci_dev_list_1482}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1483, pci_vendor_1483, pci_dev_list_1483}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1484, pci_vendor_1484, pci_dev_list_1484}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1485, pci_vendor_1485, pci_dev_list_1485}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1486, pci_vendor_1486, pci_dev_list_1486}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1487, pci_vendor_1487, pci_dev_list_1487}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1488, pci_vendor_1488, pci_dev_list_1488}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1489, pci_vendor_1489, pci_dev_list_1489}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148a, pci_vendor_148a, pci_dev_list_148a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148b, pci_vendor_148b, pci_dev_list_148b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148c, pci_vendor_148c, pci_dev_list_148c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148d, pci_vendor_148d, pci_dev_list_148d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148e, pci_vendor_148e, pci_dev_list_148e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148f, pci_vendor_148f, pci_dev_list_148f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1490, pci_vendor_1490, pci_dev_list_1490}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1491, pci_vendor_1491, pci_dev_list_1491}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1492, pci_vendor_1492, pci_dev_list_1492}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1493, pci_vendor_1493, pci_dev_list_1493}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1494, pci_vendor_1494, pci_dev_list_1494}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1495, pci_vendor_1495, pci_dev_list_1495}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1496, pci_vendor_1496, pci_dev_list_1496}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1497, pci_vendor_1497, pci_dev_list_1497}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1498, pci_vendor_1498, pci_dev_list_1498}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1499, pci_vendor_1499, pci_dev_list_1499}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149a, pci_vendor_149a, pci_dev_list_149a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149b, pci_vendor_149b, pci_dev_list_149b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149c, pci_vendor_149c, pci_dev_list_149c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149d, pci_vendor_149d, pci_dev_list_149d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149e, pci_vendor_149e, pci_dev_list_149e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149f, pci_vendor_149f, pci_dev_list_149f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a0, pci_vendor_14a0, pci_dev_list_14a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a1, pci_vendor_14a1, pci_dev_list_14a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a2, pci_vendor_14a2, pci_dev_list_14a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a3, pci_vendor_14a3, pci_dev_list_14a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a4, pci_vendor_14a4, pci_dev_list_14a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a5, pci_vendor_14a5, pci_dev_list_14a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a6, pci_vendor_14a6, pci_dev_list_14a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a7, pci_vendor_14a7, pci_dev_list_14a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a8, pci_vendor_14a8, pci_dev_list_14a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a9, pci_vendor_14a9, pci_dev_list_14a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14aa, pci_vendor_14aa, pci_dev_list_14aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ab, pci_vendor_14ab, pci_dev_list_14ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ac, pci_vendor_14ac, pci_dev_list_14ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ad, pci_vendor_14ad, pci_dev_list_14ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ae, pci_vendor_14ae, pci_dev_list_14ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14af, pci_vendor_14af, pci_dev_list_14af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b0, pci_vendor_14b0, pci_dev_list_14b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b1, pci_vendor_14b1, pci_dev_list_14b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b2, pci_vendor_14b2, pci_dev_list_14b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b3, pci_vendor_14b3, pci_dev_list_14b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b4, pci_vendor_14b4, pci_dev_list_14b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b5, pci_vendor_14b5, pci_dev_list_14b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b6, pci_vendor_14b6, pci_dev_list_14b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b7, pci_vendor_14b7, pci_dev_list_14b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b8, pci_vendor_14b8, pci_dev_list_14b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b9, pci_vendor_14b9, pci_dev_list_14b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ba, pci_vendor_14ba, pci_dev_list_14ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bb, pci_vendor_14bb, pci_dev_list_14bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bc, pci_vendor_14bc, pci_dev_list_14bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bd, pci_vendor_14bd, pci_dev_list_14bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14be, pci_vendor_14be, pci_dev_list_14be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bf, pci_vendor_14bf, pci_dev_list_14bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c0, pci_vendor_14c0, pci_dev_list_14c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c1, pci_vendor_14c1, pci_dev_list_14c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c2, pci_vendor_14c2, pci_dev_list_14c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c3, pci_vendor_14c3, pci_dev_list_14c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c4, pci_vendor_14c4, pci_dev_list_14c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c5, pci_vendor_14c5, pci_dev_list_14c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c6, pci_vendor_14c6, pci_dev_list_14c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c7, pci_vendor_14c7, pci_dev_list_14c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c8, pci_vendor_14c8, pci_dev_list_14c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c9, pci_vendor_14c9, pci_dev_list_14c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ca, pci_vendor_14ca, pci_dev_list_14ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cb, pci_vendor_14cb, pci_dev_list_14cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cc, pci_vendor_14cc, pci_dev_list_14cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cd, pci_vendor_14cd, pci_dev_list_14cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ce, pci_vendor_14ce, pci_dev_list_14ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cf, pci_vendor_14cf, pci_dev_list_14cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d0, pci_vendor_14d0, pci_dev_list_14d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d1, pci_vendor_14d1, pci_dev_list_14d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d2, pci_vendor_14d2, pci_dev_list_14d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d3, pci_vendor_14d3, pci_dev_list_14d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d4, pci_vendor_14d4, pci_dev_list_14d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d5, pci_vendor_14d5, pci_dev_list_14d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d6, pci_vendor_14d6, pci_dev_list_14d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d7, pci_vendor_14d7, pci_dev_list_14d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d8, pci_vendor_14d8, pci_dev_list_14d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d9, pci_vendor_14d9, pci_dev_list_14d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14da, pci_vendor_14da, pci_dev_list_14da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14db, pci_vendor_14db, pci_dev_list_14db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14dc, pci_vendor_14dc, pci_dev_list_14dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14dd, pci_vendor_14dd, pci_dev_list_14dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14de, pci_vendor_14de, pci_dev_list_14de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14df, pci_vendor_14df, pci_dev_list_14df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e1, pci_vendor_14e1, pci_dev_list_14e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e2, pci_vendor_14e2, pci_dev_list_14e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e3, pci_vendor_14e3, pci_dev_list_14e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e4, pci_vendor_14e4, pci_dev_list_14e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e5, pci_vendor_14e5, pci_dev_list_14e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e6, pci_vendor_14e6, pci_dev_list_14e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e7, pci_vendor_14e7, pci_dev_list_14e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e8, pci_vendor_14e8, pci_dev_list_14e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e9, pci_vendor_14e9, pci_dev_list_14e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ea, pci_vendor_14ea, pci_dev_list_14ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14eb, pci_vendor_14eb, pci_dev_list_14eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ec, pci_vendor_14ec, pci_dev_list_14ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ed, pci_vendor_14ed, pci_dev_list_14ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ee, pci_vendor_14ee, pci_dev_list_14ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ef, pci_vendor_14ef, pci_dev_list_14ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f0, pci_vendor_14f0, pci_dev_list_14f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f1, pci_vendor_14f1, pci_dev_list_14f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f2, pci_vendor_14f2, pci_dev_list_14f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f3, pci_vendor_14f3, pci_dev_list_14f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f4, pci_vendor_14f4, pci_dev_list_14f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f5, pci_vendor_14f5, pci_dev_list_14f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f6, pci_vendor_14f6, pci_dev_list_14f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f7, pci_vendor_14f7, pci_dev_list_14f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f8, pci_vendor_14f8, pci_dev_list_14f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f9, pci_vendor_14f9, pci_dev_list_14f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fa, pci_vendor_14fa, pci_dev_list_14fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fb, pci_vendor_14fb, pci_dev_list_14fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fc, pci_vendor_14fc, pci_dev_list_14fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fd, pci_vendor_14fd, pci_dev_list_14fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fe, pci_vendor_14fe, pci_dev_list_14fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ff, pci_vendor_14ff, pci_dev_list_14ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1500, pci_vendor_1500, pci_dev_list_1500}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1501, pci_vendor_1501, pci_dev_list_1501}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1502, pci_vendor_1502, pci_dev_list_1502}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1503, pci_vendor_1503, pci_dev_list_1503}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1504, pci_vendor_1504, pci_dev_list_1504}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1505, pci_vendor_1505, pci_dev_list_1505}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1506, pci_vendor_1506, pci_dev_list_1506}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1507, pci_vendor_1507, pci_dev_list_1507}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1508, pci_vendor_1508, pci_dev_list_1508}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1509, pci_vendor_1509, pci_dev_list_1509}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150a, pci_vendor_150a, pci_dev_list_150a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150b, pci_vendor_150b, pci_dev_list_150b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150c, pci_vendor_150c, pci_dev_list_150c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150d, pci_vendor_150d, pci_dev_list_150d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150e, pci_vendor_150e, pci_dev_list_150e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150f, pci_vendor_150f, pci_dev_list_150f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1510, pci_vendor_1510, pci_dev_list_1510}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1511, pci_vendor_1511, pci_dev_list_1511}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1512, pci_vendor_1512, pci_dev_list_1512}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1513, pci_vendor_1513, pci_dev_list_1513}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1514, pci_vendor_1514, pci_dev_list_1514}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1515, pci_vendor_1515, pci_dev_list_1515}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1516, pci_vendor_1516, pci_dev_list_1516}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1517, pci_vendor_1517, pci_dev_list_1517}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1518, pci_vendor_1518, pci_dev_list_1518}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1519, pci_vendor_1519, pci_dev_list_1519}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151a, pci_vendor_151a, pci_dev_list_151a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151b, pci_vendor_151b, pci_dev_list_151b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151c, pci_vendor_151c, pci_dev_list_151c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151d, pci_vendor_151d, pci_dev_list_151d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151e, pci_vendor_151e, pci_dev_list_151e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151f, pci_vendor_151f, pci_dev_list_151f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1520, pci_vendor_1520, pci_dev_list_1520}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1521, pci_vendor_1521, pci_dev_list_1521}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1522, pci_vendor_1522, pci_dev_list_1522}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1523, pci_vendor_1523, pci_dev_list_1523}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1524, pci_vendor_1524, pci_dev_list_1524}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1525, pci_vendor_1525, pci_dev_list_1525}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1526, pci_vendor_1526, pci_dev_list_1526}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1527, pci_vendor_1527, pci_dev_list_1527}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1528, pci_vendor_1528, pci_dev_list_1528}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1529, pci_vendor_1529, pci_dev_list_1529}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152a, pci_vendor_152a, pci_dev_list_152a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152b, pci_vendor_152b, pci_dev_list_152b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152c, pci_vendor_152c, pci_dev_list_152c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152d, pci_vendor_152d, pci_dev_list_152d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152e, pci_vendor_152e, pci_dev_list_152e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152f, pci_vendor_152f, pci_dev_list_152f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1530, pci_vendor_1530, pci_dev_list_1530}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1531, pci_vendor_1531, pci_dev_list_1531}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1532, pci_vendor_1532, pci_dev_list_1532}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1533, pci_vendor_1533, pci_dev_list_1533}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1534, pci_vendor_1534, pci_dev_list_1534}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1535, pci_vendor_1535, pci_dev_list_1535}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1537, pci_vendor_1537, pci_dev_list_1537}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1538, pci_vendor_1538, pci_dev_list_1538}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1539, pci_vendor_1539, pci_dev_list_1539}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153a, pci_vendor_153a, pci_dev_list_153a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153b, pci_vendor_153b, pci_dev_list_153b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153c, pci_vendor_153c, pci_dev_list_153c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153d, pci_vendor_153d, pci_dev_list_153d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153e, pci_vendor_153e, pci_dev_list_153e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153f, pci_vendor_153f, pci_dev_list_153f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1540, pci_vendor_1540, pci_dev_list_1540}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1541, pci_vendor_1541, pci_dev_list_1541}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1542, pci_vendor_1542, pci_dev_list_1542}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1543, pci_vendor_1543, pci_dev_list_1543}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1544, pci_vendor_1544, pci_dev_list_1544}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1545, pci_vendor_1545, pci_dev_list_1545}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1546, pci_vendor_1546, pci_dev_list_1546}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1547, pci_vendor_1547, pci_dev_list_1547}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1548, pci_vendor_1548, pci_dev_list_1548}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1549, pci_vendor_1549, pci_dev_list_1549}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154a, pci_vendor_154a, pci_dev_list_154a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154b, pci_vendor_154b, pci_dev_list_154b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154c, pci_vendor_154c, pci_dev_list_154c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154d, pci_vendor_154d, pci_dev_list_154d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154e, pci_vendor_154e, pci_dev_list_154e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154f, pci_vendor_154f, pci_dev_list_154f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1550, pci_vendor_1550, pci_dev_list_1550}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1551, pci_vendor_1551, pci_dev_list_1551}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1552, pci_vendor_1552, pci_dev_list_1552}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1553, pci_vendor_1553, pci_dev_list_1553}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1554, pci_vendor_1554, pci_dev_list_1554}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1555, pci_vendor_1555, pci_dev_list_1555}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1556, pci_vendor_1556, pci_dev_list_1556}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1557, pci_vendor_1557, pci_dev_list_1557}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1558, pci_vendor_1558, pci_dev_list_1558}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1559, pci_vendor_1559, pci_dev_list_1559}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155a, pci_vendor_155a, pci_dev_list_155a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155b, pci_vendor_155b, pci_dev_list_155b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155c, pci_vendor_155c, pci_dev_list_155c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155d, pci_vendor_155d, pci_dev_list_155d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155e, pci_vendor_155e, pci_dev_list_155e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155f, pci_vendor_155f, pci_dev_list_155f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1560, pci_vendor_1560, pci_dev_list_1560}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1561, pci_vendor_1561, pci_dev_list_1561}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1562, pci_vendor_1562, pci_dev_list_1562}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1563, pci_vendor_1563, pci_dev_list_1563}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1564, pci_vendor_1564, pci_dev_list_1564}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1565, pci_vendor_1565, pci_dev_list_1565}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1566, pci_vendor_1566, pci_dev_list_1566}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1567, pci_vendor_1567, pci_dev_list_1567}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1568, pci_vendor_1568, pci_dev_list_1568}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1569, pci_vendor_1569, pci_dev_list_1569}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156a, pci_vendor_156a, pci_dev_list_156a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156b, pci_vendor_156b, pci_dev_list_156b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156c, pci_vendor_156c, pci_dev_list_156c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156d, pci_vendor_156d, pci_dev_list_156d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156e, pci_vendor_156e, pci_dev_list_156e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156f, pci_vendor_156f, pci_dev_list_156f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1570, pci_vendor_1570, pci_dev_list_1570}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1571, pci_vendor_1571, pci_dev_list_1571}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1572, pci_vendor_1572, pci_dev_list_1572}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1573, pci_vendor_1573, pci_dev_list_1573}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1574, pci_vendor_1574, pci_dev_list_1574}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1575, pci_vendor_1575, pci_dev_list_1575}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1576, pci_vendor_1576, pci_dev_list_1576}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1578, pci_vendor_1578, pci_dev_list_1578}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1579, pci_vendor_1579, pci_dev_list_1579}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157a, pci_vendor_157a, pci_dev_list_157a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157b, pci_vendor_157b, pci_dev_list_157b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157c, pci_vendor_157c, pci_dev_list_157c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157d, pci_vendor_157d, pci_dev_list_157d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157e, pci_vendor_157e, pci_dev_list_157e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157f, pci_vendor_157f, pci_dev_list_157f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1580, pci_vendor_1580, pci_dev_list_1580}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1581, pci_vendor_1581, pci_dev_list_1581}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1582, pci_vendor_1582, pci_dev_list_1582}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1583, pci_vendor_1583, pci_dev_list_1583}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1584, pci_vendor_1584, pci_dev_list_1584}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1585, pci_vendor_1585, pci_dev_list_1585}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1586, pci_vendor_1586, pci_dev_list_1586}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1587, pci_vendor_1587, pci_dev_list_1587}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1588, pci_vendor_1588, pci_dev_list_1588}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1589, pci_vendor_1589, pci_dev_list_1589}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158a, pci_vendor_158a, pci_dev_list_158a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158b, pci_vendor_158b, pci_dev_list_158b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158c, pci_vendor_158c, pci_dev_list_158c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158d, pci_vendor_158d, pci_dev_list_158d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158e, pci_vendor_158e, pci_dev_list_158e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158f, pci_vendor_158f, pci_dev_list_158f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1590, pci_vendor_1590, pci_dev_list_1590}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1591, pci_vendor_1591, pci_dev_list_1591}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1592, pci_vendor_1592, pci_dev_list_1592}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1593, pci_vendor_1593, pci_dev_list_1593}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1594, pci_vendor_1594, pci_dev_list_1594}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1595, pci_vendor_1595, pci_dev_list_1595}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1596, pci_vendor_1596, pci_dev_list_1596}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1597, pci_vendor_1597, pci_dev_list_1597}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1598, pci_vendor_1598, pci_dev_list_1598}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1599, pci_vendor_1599, pci_dev_list_1599}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159a, pci_vendor_159a, pci_dev_list_159a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159b, pci_vendor_159b, pci_dev_list_159b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159c, pci_vendor_159c, pci_dev_list_159c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159d, pci_vendor_159d, pci_dev_list_159d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159e, pci_vendor_159e, pci_dev_list_159e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159f, pci_vendor_159f, pci_dev_list_159f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a0, pci_vendor_15a0, pci_dev_list_15a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a1, pci_vendor_15a1, pci_dev_list_15a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a2, pci_vendor_15a2, pci_dev_list_15a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a3, pci_vendor_15a3, pci_dev_list_15a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a4, pci_vendor_15a4, pci_dev_list_15a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a5, pci_vendor_15a5, pci_dev_list_15a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a6, pci_vendor_15a6, pci_dev_list_15a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a7, pci_vendor_15a7, pci_dev_list_15a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a8, pci_vendor_15a8, pci_dev_list_15a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15aa, pci_vendor_15aa, pci_dev_list_15aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ab, pci_vendor_15ab, pci_dev_list_15ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ac, pci_vendor_15ac, pci_dev_list_15ac}, +#endif + {0x15ad, pci_vendor_15ad, pci_dev_list_15ad}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ae, pci_vendor_15ae, pci_dev_list_15ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b0, pci_vendor_15b0, pci_dev_list_15b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b1, pci_vendor_15b1, pci_dev_list_15b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b2, pci_vendor_15b2, pci_dev_list_15b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b3, pci_vendor_15b3, pci_dev_list_15b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b4, pci_vendor_15b4, pci_dev_list_15b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b5, pci_vendor_15b5, pci_dev_list_15b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b6, pci_vendor_15b6, pci_dev_list_15b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b7, pci_vendor_15b7, pci_dev_list_15b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b8, pci_vendor_15b8, pci_dev_list_15b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b9, pci_vendor_15b9, pci_dev_list_15b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ba, pci_vendor_15ba, pci_dev_list_15ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bb, pci_vendor_15bb, pci_dev_list_15bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bc, pci_vendor_15bc, pci_dev_list_15bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bd, pci_vendor_15bd, pci_dev_list_15bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15be, pci_vendor_15be, pci_dev_list_15be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bf, pci_vendor_15bf, pci_dev_list_15bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c0, pci_vendor_15c0, pci_dev_list_15c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c1, pci_vendor_15c1, pci_dev_list_15c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c2, pci_vendor_15c2, pci_dev_list_15c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c3, pci_vendor_15c3, pci_dev_list_15c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c4, pci_vendor_15c4, pci_dev_list_15c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c5, pci_vendor_15c5, pci_dev_list_15c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c6, pci_vendor_15c6, pci_dev_list_15c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c7, pci_vendor_15c7, pci_dev_list_15c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c8, pci_vendor_15c8, pci_dev_list_15c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c9, pci_vendor_15c9, pci_dev_list_15c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ca, pci_vendor_15ca, pci_dev_list_15ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cb, pci_vendor_15cb, pci_dev_list_15cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cc, pci_vendor_15cc, pci_dev_list_15cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cd, pci_vendor_15cd, pci_dev_list_15cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ce, pci_vendor_15ce, pci_dev_list_15ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cf, pci_vendor_15cf, pci_dev_list_15cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d1, pci_vendor_15d1, pci_dev_list_15d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d2, pci_vendor_15d2, pci_dev_list_15d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d3, pci_vendor_15d3, pci_dev_list_15d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d4, pci_vendor_15d4, pci_dev_list_15d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d5, pci_vendor_15d5, pci_dev_list_15d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d6, pci_vendor_15d6, pci_dev_list_15d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d7, pci_vendor_15d7, pci_dev_list_15d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d8, pci_vendor_15d8, pci_dev_list_15d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d9, pci_vendor_15d9, pci_dev_list_15d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15da, pci_vendor_15da, pci_dev_list_15da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15db, pci_vendor_15db, pci_dev_list_15db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15dc, pci_vendor_15dc, pci_dev_list_15dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15dd, pci_vendor_15dd, pci_dev_list_15dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15de, pci_vendor_15de, pci_dev_list_15de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15df, pci_vendor_15df, pci_dev_list_15df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e0, pci_vendor_15e0, pci_dev_list_15e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e1, pci_vendor_15e1, pci_dev_list_15e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e2, pci_vendor_15e2, pci_dev_list_15e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e3, pci_vendor_15e3, pci_dev_list_15e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e4, pci_vendor_15e4, pci_dev_list_15e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e5, pci_vendor_15e5, pci_dev_list_15e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e6, pci_vendor_15e6, pci_dev_list_15e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e7, pci_vendor_15e7, pci_dev_list_15e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e8, pci_vendor_15e8, pci_dev_list_15e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e9, pci_vendor_15e9, pci_dev_list_15e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ea, pci_vendor_15ea, pci_dev_list_15ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15eb, pci_vendor_15eb, pci_dev_list_15eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ec, pci_vendor_15ec, pci_dev_list_15ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ed, pci_vendor_15ed, pci_dev_list_15ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ee, pci_vendor_15ee, pci_dev_list_15ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ef, pci_vendor_15ef, pci_dev_list_15ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f0, pci_vendor_15f0, pci_dev_list_15f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f1, pci_vendor_15f1, pci_dev_list_15f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f2, pci_vendor_15f2, pci_dev_list_15f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f3, pci_vendor_15f3, pci_dev_list_15f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f4, pci_vendor_15f4, pci_dev_list_15f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f5, pci_vendor_15f5, pci_dev_list_15f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f6, pci_vendor_15f6, pci_dev_list_15f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f7, pci_vendor_15f7, pci_dev_list_15f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f8, pci_vendor_15f8, pci_dev_list_15f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f9, pci_vendor_15f9, pci_dev_list_15f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fa, pci_vendor_15fa, pci_dev_list_15fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fb, pci_vendor_15fb, pci_dev_list_15fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fc, pci_vendor_15fc, pci_dev_list_15fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fd, pci_vendor_15fd, pci_dev_list_15fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fe, pci_vendor_15fe, pci_dev_list_15fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ff, pci_vendor_15ff, pci_dev_list_15ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1600, pci_vendor_1600, pci_dev_list_1600}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1601, pci_vendor_1601, pci_dev_list_1601}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1602, pci_vendor_1602, pci_dev_list_1602}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1603, pci_vendor_1603, pci_dev_list_1603}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1604, pci_vendor_1604, pci_dev_list_1604}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1605, pci_vendor_1605, pci_dev_list_1605}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1606, pci_vendor_1606, pci_dev_list_1606}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1607, pci_vendor_1607, pci_dev_list_1607}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1608, pci_vendor_1608, pci_dev_list_1608}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1609, pci_vendor_1609, pci_dev_list_1609}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1612, pci_vendor_1612, pci_dev_list_1612}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1619, pci_vendor_1619, pci_dev_list_1619}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1629, pci_vendor_1629, pci_dev_list_1629}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1638, pci_vendor_1638, pci_dev_list_1638}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x163c, pci_vendor_163c, pci_dev_list_163c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1657, pci_vendor_1657, pci_dev_list_1657}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x165a, pci_vendor_165a, pci_dev_list_165a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x165d, pci_vendor_165d, pci_dev_list_165d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1661, pci_vendor_1661, pci_dev_list_1661}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1668, pci_vendor_1668, pci_dev_list_1668}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1681, pci_vendor_1681, pci_dev_list_1681}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16ab, pci_vendor_16ab, pci_dev_list_16ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16be, pci_vendor_16be, pci_dev_list_16be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16ec, pci_vendor_16ec, pci_dev_list_16ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16f6, pci_vendor_16f6, pci_dev_list_16f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1705, pci_vendor_1705, pci_dev_list_1705}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x170b, pci_vendor_170b, pci_dev_list_170b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x170c, pci_vendor_170c, pci_dev_list_170c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x172a, pci_vendor_172a, pci_dev_list_172a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1737, pci_vendor_1737, pci_dev_list_1737}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x173b, pci_vendor_173b, pci_dev_list_173b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1743, pci_vendor_1743, pci_dev_list_1743}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x174b, pci_vendor_174b, pci_dev_list_174b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x175e, pci_vendor_175e, pci_dev_list_175e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1787, pci_vendor_1787, pci_dev_list_1787}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1796, pci_vendor_1796, pci_dev_list_1796}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1799, pci_vendor_1799, pci_dev_list_1799}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x17af, pci_vendor_17af, pci_dev_list_17af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x17cc, pci_vendor_17cc, pci_dev_list_17cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1813, pci_vendor_1813, pci_dev_list_1813}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1851, pci_vendor_1851, pci_dev_list_1851}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1852, pci_vendor_1852, pci_dev_list_1852}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1888, pci_vendor_1888, pci_dev_list_1888}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1a08, pci_vendor_1a08, pci_dev_list_1a08}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1b13, pci_vendor_1b13, pci_dev_list_1b13}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1c1c, pci_vendor_1c1c, pci_dev_list_1c1c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1d44, pci_vendor_1d44, pci_dev_list_1d44}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1de1, pci_vendor_1de1, pci_dev_list_1de1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2000, pci_vendor_2000, pci_dev_list_2000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2001, pci_vendor_2001, pci_dev_list_2001}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2003, pci_vendor_2003, pci_dev_list_2003}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2004, pci_vendor_2004, pci_dev_list_2004}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x21c3, pci_vendor_21c3, pci_dev_list_21c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2348, pci_vendor_2348, pci_dev_list_2348}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2646, pci_vendor_2646, pci_dev_list_2646}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x270b, pci_vendor_270b, pci_dev_list_270b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x270f, pci_vendor_270f, pci_dev_list_270f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2711, pci_vendor_2711, pci_dev_list_2711}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2a15, pci_vendor_2a15, pci_dev_list_2a15}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3000, pci_vendor_3000, pci_dev_list_3000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3142, pci_vendor_3142, pci_dev_list_3142}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3388, pci_vendor_3388, pci_dev_list_3388}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3411, pci_vendor_3411, pci_dev_list_3411}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3513, pci_vendor_3513, pci_dev_list_3513}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x38ef, pci_vendor_38ef, pci_dev_list_38ef}, +#endif + {0x3d3d, pci_vendor_3d3d, pci_dev_list_3d3d}, + {0x4005, pci_vendor_4005, pci_dev_list_4005}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4033, pci_vendor_4033, pci_dev_list_4033}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4143, pci_vendor_4143, pci_dev_list_4143}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x416c, pci_vendor_416c, pci_dev_list_416c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4444, pci_vendor_4444, pci_dev_list_4444}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4468, pci_vendor_4468, pci_dev_list_4468}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4594, pci_vendor_4594, pci_dev_list_4594}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x45fb, pci_vendor_45fb, pci_dev_list_45fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4680, pci_vendor_4680, pci_dev_list_4680}, +#endif + {0x4843, pci_vendor_4843, pci_dev_list_4843}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4916, pci_vendor_4916, pci_dev_list_4916}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4943, pci_vendor_4943, pci_dev_list_4943}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4978, pci_vendor_4978, pci_dev_list_4978}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4a14, pci_vendor_4a14, pci_dev_list_4a14}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4b10, pci_vendor_4b10, pci_dev_list_4b10}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4c48, pci_vendor_4c48, pci_dev_list_4c48}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4c53, pci_vendor_4c53, pci_dev_list_4c53}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4ca1, pci_vendor_4ca1, pci_dev_list_4ca1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4d51, pci_vendor_4d51, pci_dev_list_4d51}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4d54, pci_vendor_4d54, pci_dev_list_4d54}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4ddc, pci_vendor_4ddc, pci_dev_list_4ddc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5046, pci_vendor_5046, pci_dev_list_5046}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5053, pci_vendor_5053, pci_dev_list_5053}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5136, pci_vendor_5136, pci_dev_list_5136}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5143, pci_vendor_5143, pci_dev_list_5143}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5145, pci_vendor_5145, pci_dev_list_5145}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5168, pci_vendor_5168, pci_dev_list_5168}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5301, pci_vendor_5301, pci_dev_list_5301}, +#endif + {0x5333, pci_vendor_5333, pci_dev_list_5333}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x544c, pci_vendor_544c, pci_dev_list_544c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5455, pci_vendor_5455, pci_dev_list_5455}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5519, pci_vendor_5519, pci_dev_list_5519}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5544, pci_vendor_5544, pci_dev_list_5544}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5555, pci_vendor_5555, pci_dev_list_5555}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5654, pci_vendor_5654, pci_dev_list_5654}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5700, pci_vendor_5700, pci_dev_list_5700}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6356, pci_vendor_6356, pci_dev_list_6356}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6374, pci_vendor_6374, pci_dev_list_6374}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6409, pci_vendor_6409, pci_dev_list_6409}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6666, pci_vendor_6666, pci_dev_list_6666}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x7604, pci_vendor_7604, pci_dev_list_7604}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x7bde, pci_vendor_7bde, pci_dev_list_7bde}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x7fed, pci_vendor_7fed, pci_dev_list_7fed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8008, pci_vendor_8008, pci_dev_list_8008}, +#endif + {0x8086, pci_vendor_8086, pci_dev_list_8086}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8800, pci_vendor_8800, pci_dev_list_8800}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8866, pci_vendor_8866, pci_dev_list_8866}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8888, pci_vendor_8888, pci_dev_list_8888}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8e0e, pci_vendor_8e0e, pci_dev_list_8e0e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8e2e, pci_vendor_8e2e, pci_dev_list_8e2e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9004, pci_vendor_9004, pci_dev_list_9004}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9005, pci_vendor_9005, pci_dev_list_9005}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x907f, pci_vendor_907f, pci_dev_list_907f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x919a, pci_vendor_919a, pci_dev_list_919a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9412, pci_vendor_9412, pci_dev_list_9412}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9699, pci_vendor_9699, pci_dev_list_9699}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9710, pci_vendor_9710, pci_dev_list_9710}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa0a0, pci_vendor_a0a0, pci_dev_list_a0a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa0f1, pci_vendor_a0f1, pci_dev_list_a0f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa200, pci_vendor_a200, pci_dev_list_a200}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa259, pci_vendor_a259, pci_dev_list_a259}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa25b, pci_vendor_a25b, pci_dev_list_a25b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa304, pci_vendor_a304, pci_dev_list_a304}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa727, pci_vendor_a727, pci_dev_list_a727}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xaa42, pci_vendor_aa42, pci_dev_list_aa42}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xac1e, pci_vendor_ac1e, pci_dev_list_ac1e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xb1b3, pci_vendor_b1b3, pci_dev_list_b1b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xbd11, pci_vendor_bd11, pci_dev_list_bd11}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc001, pci_vendor_c001, pci_dev_list_c001}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc0a9, pci_vendor_c0a9, pci_dev_list_c0a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc0de, pci_vendor_c0de, pci_dev_list_c0de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc0fe, pci_vendor_c0fe, pci_dev_list_c0fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xca50, pci_vendor_ca50, pci_dev_list_ca50}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xcafe, pci_vendor_cafe, pci_dev_list_cafe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xcccc, pci_vendor_cccc, pci_dev_list_cccc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xcddd, pci_vendor_cddd, pci_dev_list_cddd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xd4d4, pci_vendor_d4d4, pci_dev_list_d4d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xd531, pci_vendor_d531, pci_dev_list_d531}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xd84d, pci_vendor_d84d, pci_dev_list_d84d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xdead, pci_vendor_dead, pci_dev_list_dead}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xe000, pci_vendor_e000, pci_dev_list_e000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xe159, pci_vendor_e159, pci_dev_list_e159}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xe4bf, pci_vendor_e4bf, pci_dev_list_e4bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xea01, pci_vendor_ea01, pci_dev_list_ea01}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xea60, pci_vendor_ea60, pci_dev_list_ea60}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xeabb, pci_vendor_eabb, pci_dev_list_eabb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xeace, pci_vendor_eace, pci_dev_list_eace}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xec80, pci_vendor_ec80, pci_dev_list_ec80}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xecc0, pci_vendor_ecc0, pci_dev_list_ecc0}, +#endif + {0xedd8, pci_vendor_edd8, pci_dev_list_edd8}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xf1d0, pci_vendor_f1d0, pci_dev_list_f1d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfa57, pci_vendor_fa57, pci_dev_list_fa57}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfebd, pci_vendor_febd, pci_dev_list_febd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfeda, pci_vendor_feda, pci_dev_list_feda}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfffe, pci_vendor_fffe, pci_dev_list_fffe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xffff, pci_vendor_ffff, pci_dev_list_ffff}, +#endif + {0x0000, NULL, NULL} +}; + +#if defined(INIT_VENDOR_SUBSYS_INFO) && defined(INIT_SUBSYS_INFO) +static const pciVendorSubsysInfo pciVendorSubsysInfoList[] = { +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0000, pci_vendor_0000, pci_ss_list_0000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x001a, pci_vendor_001a, pci_ss_list_001a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0033, pci_vendor_0033, pci_ss_list_0033}, +#endif + {0x003d, pci_vendor_003d, pci_ss_list_003d}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0059, pci_vendor_0059, pci_ss_list_0059}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0070, pci_vendor_0070, pci_ss_list_0070}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0100, pci_vendor_0100, pci_ss_list_0100}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0675, pci_vendor_0675, pci_ss_list_0675}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0925, pci_vendor_0925, pci_ss_list_0925}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x09c1, pci_vendor_09c1, pci_ss_list_09c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0a89, pci_vendor_0a89, pci_ss_list_0a89}, +#endif + {0x0e11, pci_vendor_0e11, pci_ss_list_0e11}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x0e55, pci_vendor_0e55, pci_ss_list_0e55}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1000, pci_vendor_1000, pci_ss_list_1000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1001, pci_vendor_1001, pci_ss_list_1001}, +#endif + {0x1002, pci_vendor_1002, pci_ss_list_1002}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1003, pci_vendor_1003, pci_ss_list_1003}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1004, pci_vendor_1004, pci_ss_list_1004}, +#endif + {0x1005, pci_vendor_1005, pci_ss_list_1005}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1006, pci_vendor_1006, pci_ss_list_1006}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1007, pci_vendor_1007, pci_ss_list_1007}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1008, pci_vendor_1008, pci_ss_list_1008}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x100a, pci_vendor_100a, pci_ss_list_100a}, +#endif + {0x100b, pci_vendor_100b, pci_ss_list_100b}, + {0x100c, pci_vendor_100c, pci_ss_list_100c}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x100d, pci_vendor_100d, pci_ss_list_100d}, +#endif + {0x100e, pci_vendor_100e, pci_ss_list_100e}, + {0x1010, pci_vendor_1010, pci_ss_list_1010}, + {0x1011, pci_vendor_1011, pci_ss_list_1011}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1012, pci_vendor_1012, pci_ss_list_1012}, +#endif + {0x1013, pci_vendor_1013, pci_ss_list_1013}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1014, pci_vendor_1014, pci_ss_list_1014}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1015, pci_vendor_1015, pci_ss_list_1015}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1016, pci_vendor_1016, pci_ss_list_1016}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1017, pci_vendor_1017, pci_ss_list_1017}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1018, pci_vendor_1018, pci_ss_list_1018}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1019, pci_vendor_1019, pci_ss_list_1019}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101a, pci_vendor_101a, pci_ss_list_101a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101b, pci_vendor_101b, pci_ss_list_101b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101c, pci_vendor_101c, pci_ss_list_101c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101e, pci_vendor_101e, pci_ss_list_101e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x101f, pci_vendor_101f, pci_ss_list_101f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1020, pci_vendor_1020, pci_ss_list_1020}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1021, pci_vendor_1021, pci_ss_list_1021}, +#endif + {0x1022, pci_vendor_1022, pci_ss_list_1022}, + {0x1023, pci_vendor_1023, pci_ss_list_1023}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1024, pci_vendor_1024, pci_ss_list_1024}, +#endif + {0x1025, pci_vendor_1025, pci_ss_list_1025}, + {0x1028, pci_vendor_1028, pci_ss_list_1028}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1029, pci_vendor_1029, pci_ss_list_1029}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102a, pci_vendor_102a, pci_ss_list_102a}, +#endif + {0x102b, pci_vendor_102b, pci_ss_list_102b}, + {0x102c, pci_vendor_102c, pci_ss_list_102c}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102d, pci_vendor_102d, pci_ss_list_102d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102e, pci_vendor_102e, pci_ss_list_102e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x102f, pci_vendor_102f, pci_ss_list_102f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1030, pci_vendor_1030, pci_ss_list_1030}, +#endif + {0x1031, pci_vendor_1031, pci_ss_list_1031}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1032, pci_vendor_1032, pci_ss_list_1032}, +#endif + {0x1033, pci_vendor_1033, pci_ss_list_1033}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1034, pci_vendor_1034, pci_ss_list_1034}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1035, pci_vendor_1035, pci_ss_list_1035}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1036, pci_vendor_1036, pci_ss_list_1036}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1037, pci_vendor_1037, pci_ss_list_1037}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1038, pci_vendor_1038, pci_ss_list_1038}, +#endif + {0x1039, pci_vendor_1039, pci_ss_list_1039}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103a, pci_vendor_103a, pci_ss_list_103a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103b, pci_vendor_103b, pci_ss_list_103b}, +#endif + {0x103c, pci_vendor_103c, pci_ss_list_103c}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103e, pci_vendor_103e, pci_ss_list_103e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x103f, pci_vendor_103f, pci_ss_list_103f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1040, pci_vendor_1040, pci_ss_list_1040}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1041, pci_vendor_1041, pci_ss_list_1041}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1042, pci_vendor_1042, pci_ss_list_1042}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1043, pci_vendor_1043, pci_ss_list_1043}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1044, pci_vendor_1044, pci_ss_list_1044}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1045, pci_vendor_1045, pci_ss_list_1045}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1046, pci_vendor_1046, pci_ss_list_1046}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1047, pci_vendor_1047, pci_ss_list_1047}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1048, pci_vendor_1048, pci_ss_list_1048}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1049, pci_vendor_1049, pci_ss_list_1049}, +#endif + {0x104a, pci_vendor_104a, pci_ss_list_104a}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x104b, pci_vendor_104b, pci_ss_list_104b}, +#endif + {0x104c, pci_vendor_104c, pci_ss_list_104c}, + {0x104d, pci_vendor_104d, pci_ss_list_104d}, + {0x104e, pci_vendor_104e, pci_ss_list_104e}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x104f, pci_vendor_104f, pci_ss_list_104f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1050, pci_vendor_1050, pci_ss_list_1050}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1051, pci_vendor_1051, pci_ss_list_1051}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1052, pci_vendor_1052, pci_ss_list_1052}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1053, pci_vendor_1053, pci_ss_list_1053}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1054, pci_vendor_1054, pci_ss_list_1054}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1055, pci_vendor_1055, pci_ss_list_1055}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1056, pci_vendor_1056, pci_ss_list_1056}, +#endif + {0x1057, pci_vendor_1057, pci_ss_list_1057}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1058, pci_vendor_1058, pci_ss_list_1058}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1059, pci_vendor_1059, pci_ss_list_1059}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105a, pci_vendor_105a, pci_ss_list_105a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105b, pci_vendor_105b, pci_ss_list_105b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105c, pci_vendor_105c, pci_ss_list_105c}, +#endif + {0x105d, pci_vendor_105d, pci_ss_list_105d}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105e, pci_vendor_105e, pci_ss_list_105e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x105f, pci_vendor_105f, pci_ss_list_105f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1060, pci_vendor_1060, pci_ss_list_1060}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1061, pci_vendor_1061, pci_ss_list_1061}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1062, pci_vendor_1062, pci_ss_list_1062}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1063, pci_vendor_1063, pci_ss_list_1063}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1064, pci_vendor_1064, pci_ss_list_1064}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1065, pci_vendor_1065, pci_ss_list_1065}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1066, pci_vendor_1066, pci_ss_list_1066}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1067, pci_vendor_1067, pci_ss_list_1067}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1068, pci_vendor_1068, pci_ss_list_1068}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1069, pci_vendor_1069, pci_ss_list_1069}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106a, pci_vendor_106a, pci_ss_list_106a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106b, pci_vendor_106b, pci_ss_list_106b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106c, pci_vendor_106c, pci_ss_list_106c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106d, pci_vendor_106d, pci_ss_list_106d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106e, pci_vendor_106e, pci_ss_list_106e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x106f, pci_vendor_106f, pci_ss_list_106f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1070, pci_vendor_1070, pci_ss_list_1070}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1071, pci_vendor_1071, pci_ss_list_1071}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1072, pci_vendor_1072, pci_ss_list_1072}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1073, pci_vendor_1073, pci_ss_list_1073}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1074, pci_vendor_1074, pci_ss_list_1074}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1075, pci_vendor_1075, pci_ss_list_1075}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1076, pci_vendor_1076, pci_ss_list_1076}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1077, pci_vendor_1077, pci_ss_list_1077}, +#endif + {0x1078, pci_vendor_1078, pci_ss_list_1078}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1079, pci_vendor_1079, pci_ss_list_1079}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107a, pci_vendor_107a, pci_ss_list_107a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107b, pci_vendor_107b, pci_ss_list_107b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107c, pci_vendor_107c, pci_ss_list_107c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107d, pci_vendor_107d, pci_ss_list_107d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107e, pci_vendor_107e, pci_ss_list_107e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x107f, pci_vendor_107f, pci_ss_list_107f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1080, pci_vendor_1080, pci_ss_list_1080}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1081, pci_vendor_1081, pci_ss_list_1081}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1082, pci_vendor_1082, pci_ss_list_1082}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1083, pci_vendor_1083, pci_ss_list_1083}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1084, pci_vendor_1084, pci_ss_list_1084}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1085, pci_vendor_1085, pci_ss_list_1085}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1086, pci_vendor_1086, pci_ss_list_1086}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1087, pci_vendor_1087, pci_ss_list_1087}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1088, pci_vendor_1088, pci_ss_list_1088}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1089, pci_vendor_1089, pci_ss_list_1089}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108a, pci_vendor_108a, pci_ss_list_108a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108c, pci_vendor_108c, pci_ss_list_108c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108d, pci_vendor_108d, pci_ss_list_108d}, +#endif + {0x108e, pci_vendor_108e, pci_ss_list_108e}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x108f, pci_vendor_108f, pci_ss_list_108f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1090, pci_vendor_1090, pci_ss_list_1090}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1091, pci_vendor_1091, pci_ss_list_1091}, +#endif + {0x1092, pci_vendor_1092, pci_ss_list_1092}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1093, pci_vendor_1093, pci_ss_list_1093}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1094, pci_vendor_1094, pci_ss_list_1094}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1095, pci_vendor_1095, pci_ss_list_1095}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1096, pci_vendor_1096, pci_ss_list_1096}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1097, pci_vendor_1097, pci_ss_list_1097}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1098, pci_vendor_1098, pci_ss_list_1098}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1099, pci_vendor_1099, pci_ss_list_1099}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109a, pci_vendor_109a, pci_ss_list_109a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109b, pci_vendor_109b, pci_ss_list_109b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109c, pci_vendor_109c, pci_ss_list_109c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109d, pci_vendor_109d, pci_ss_list_109d}, +#endif + {0x109e, pci_vendor_109e, pci_ss_list_109e}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x109f, pci_vendor_109f, pci_ss_list_109f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a0, pci_vendor_10a0, pci_ss_list_10a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a1, pci_vendor_10a1, pci_ss_list_10a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a2, pci_vendor_10a2, pci_ss_list_10a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a3, pci_vendor_10a3, pci_ss_list_10a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a4, pci_vendor_10a4, pci_ss_list_10a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a5, pci_vendor_10a5, pci_ss_list_10a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a6, pci_vendor_10a6, pci_ss_list_10a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a7, pci_vendor_10a7, pci_ss_list_10a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a8, pci_vendor_10a8, pci_ss_list_10a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10a9, pci_vendor_10a9, pci_ss_list_10a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10aa, pci_vendor_10aa, pci_ss_list_10aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ab, pci_vendor_10ab, pci_ss_list_10ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ac, pci_vendor_10ac, pci_ss_list_10ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ad, pci_vendor_10ad, pci_ss_list_10ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ae, pci_vendor_10ae, pci_ss_list_10ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10af, pci_vendor_10af, pci_ss_list_10af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b0, pci_vendor_10b0, pci_ss_list_10b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b1, pci_vendor_10b1, pci_ss_list_10b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b2, pci_vendor_10b2, pci_ss_list_10b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b3, pci_vendor_10b3, pci_ss_list_10b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b4, pci_vendor_10b4, pci_ss_list_10b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b5, pci_vendor_10b5, pci_ss_list_10b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b6, pci_vendor_10b6, pci_ss_list_10b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b7, pci_vendor_10b7, pci_ss_list_10b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10b8, pci_vendor_10b8, pci_ss_list_10b8}, +#endif + {0x10b9, pci_vendor_10b9, pci_ss_list_10b9}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ba, pci_vendor_10ba, pci_ss_list_10ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bb, pci_vendor_10bb, pci_ss_list_10bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bc, pci_vendor_10bc, pci_ss_list_10bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bd, pci_vendor_10bd, pci_ss_list_10bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10be, pci_vendor_10be, pci_ss_list_10be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10bf, pci_vendor_10bf, pci_ss_list_10bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c0, pci_vendor_10c0, pci_ss_list_10c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c1, pci_vendor_10c1, pci_ss_list_10c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c2, pci_vendor_10c2, pci_ss_list_10c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c3, pci_vendor_10c3, pci_ss_list_10c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c4, pci_vendor_10c4, pci_ss_list_10c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c5, pci_vendor_10c5, pci_ss_list_10c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c6, pci_vendor_10c6, pci_ss_list_10c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c7, pci_vendor_10c7, pci_ss_list_10c7}, +#endif + {0x10c8, pci_vendor_10c8, pci_ss_list_10c8}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10c9, pci_vendor_10c9, pci_ss_list_10c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ca, pci_vendor_10ca, pci_ss_list_10ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cb, pci_vendor_10cb, pci_ss_list_10cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cc, pci_vendor_10cc, pci_ss_list_10cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cd, pci_vendor_10cd, pci_ss_list_10cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ce, pci_vendor_10ce, pci_ss_list_10ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10cf, pci_vendor_10cf, pci_ss_list_10cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d0, pci_vendor_10d0, pci_ss_list_10d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d1, pci_vendor_10d1, pci_ss_list_10d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d2, pci_vendor_10d2, pci_ss_list_10d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d3, pci_vendor_10d3, pci_ss_list_10d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d4, pci_vendor_10d4, pci_ss_list_10d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d5, pci_vendor_10d5, pci_ss_list_10d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d6, pci_vendor_10d6, pci_ss_list_10d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d7, pci_vendor_10d7, pci_ss_list_10d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d8, pci_vendor_10d8, pci_ss_list_10d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10d9, pci_vendor_10d9, pci_ss_list_10d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10da, pci_vendor_10da, pci_ss_list_10da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10db, pci_vendor_10db, pci_ss_list_10db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10dc, pci_vendor_10dc, pci_ss_list_10dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10dd, pci_vendor_10dd, pci_ss_list_10dd}, +#endif + {0x10de, pci_vendor_10de, pci_ss_list_10de}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10df, pci_vendor_10df, pci_ss_list_10df}, +#endif + {0x10e0, pci_vendor_10e0, pci_ss_list_10e0}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e1, pci_vendor_10e1, pci_ss_list_10e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e2, pci_vendor_10e2, pci_ss_list_10e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e3, pci_vendor_10e3, pci_ss_list_10e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e4, pci_vendor_10e4, pci_ss_list_10e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e5, pci_vendor_10e5, pci_ss_list_10e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e6, pci_vendor_10e6, pci_ss_list_10e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e7, pci_vendor_10e7, pci_ss_list_10e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e8, pci_vendor_10e8, pci_ss_list_10e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10e9, pci_vendor_10e9, pci_ss_list_10e9}, +#endif + {0x10ea, pci_vendor_10ea, pci_ss_list_10ea}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10eb, pci_vendor_10eb, pci_ss_list_10eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ec, pci_vendor_10ec, pci_ss_list_10ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ed, pci_vendor_10ed, pci_ss_list_10ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ee, pci_vendor_10ee, pci_ss_list_10ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ef, pci_vendor_10ef, pci_ss_list_10ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f0, pci_vendor_10f0, pci_ss_list_10f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f1, pci_vendor_10f1, pci_ss_list_10f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f2, pci_vendor_10f2, pci_ss_list_10f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f3, pci_vendor_10f3, pci_ss_list_10f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f4, pci_vendor_10f4, pci_ss_list_10f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f5, pci_vendor_10f5, pci_ss_list_10f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f6, pci_vendor_10f6, pci_ss_list_10f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f7, pci_vendor_10f7, pci_ss_list_10f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f8, pci_vendor_10f8, pci_ss_list_10f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10f9, pci_vendor_10f9, pci_ss_list_10f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fa, pci_vendor_10fa, pci_ss_list_10fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fb, pci_vendor_10fb, pci_ss_list_10fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fc, pci_vendor_10fc, pci_ss_list_10fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fd, pci_vendor_10fd, pci_ss_list_10fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10fe, pci_vendor_10fe, pci_ss_list_10fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x10ff, pci_vendor_10ff, pci_ss_list_10ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1100, pci_vendor_1100, pci_ss_list_1100}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1101, pci_vendor_1101, pci_ss_list_1101}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1102, pci_vendor_1102, pci_ss_list_1102}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1103, pci_vendor_1103, pci_ss_list_1103}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1104, pci_vendor_1104, pci_ss_list_1104}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1105, pci_vendor_1105, pci_ss_list_1105}, +#endif + {0x1106, pci_vendor_1106, pci_ss_list_1106}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1107, pci_vendor_1107, pci_ss_list_1107}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1108, pci_vendor_1108, pci_ss_list_1108}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1109, pci_vendor_1109, pci_ss_list_1109}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110a, pci_vendor_110a, pci_ss_list_110a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110b, pci_vendor_110b, pci_ss_list_110b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110c, pci_vendor_110c, pci_ss_list_110c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110d, pci_vendor_110d, pci_ss_list_110d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110e, pci_vendor_110e, pci_ss_list_110e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x110f, pci_vendor_110f, pci_ss_list_110f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1110, pci_vendor_1110, pci_ss_list_1110}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1111, pci_vendor_1111, pci_ss_list_1111}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1112, pci_vendor_1112, pci_ss_list_1112}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1113, pci_vendor_1113, pci_ss_list_1113}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1114, pci_vendor_1114, pci_ss_list_1114}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1115, pci_vendor_1115, pci_ss_list_1115}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1116, pci_vendor_1116, pci_ss_list_1116}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1117, pci_vendor_1117, pci_ss_list_1117}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1118, pci_vendor_1118, pci_ss_list_1118}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1119, pci_vendor_1119, pci_ss_list_1119}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111a, pci_vendor_111a, pci_ss_list_111a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111b, pci_vendor_111b, pci_ss_list_111b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111c, pci_vendor_111c, pci_ss_list_111c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111d, pci_vendor_111d, pci_ss_list_111d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111e, pci_vendor_111e, pci_ss_list_111e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x111f, pci_vendor_111f, pci_ss_list_111f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1120, pci_vendor_1120, pci_ss_list_1120}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1121, pci_vendor_1121, pci_ss_list_1121}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1122, pci_vendor_1122, pci_ss_list_1122}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1123, pci_vendor_1123, pci_ss_list_1123}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1124, pci_vendor_1124, pci_ss_list_1124}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1125, pci_vendor_1125, pci_ss_list_1125}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1126, pci_vendor_1126, pci_ss_list_1126}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1127, pci_vendor_1127, pci_ss_list_1127}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1129, pci_vendor_1129, pci_ss_list_1129}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112a, pci_vendor_112a, pci_ss_list_112a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112b, pci_vendor_112b, pci_ss_list_112b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112c, pci_vendor_112c, pci_ss_list_112c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112d, pci_vendor_112d, pci_ss_list_112d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112e, pci_vendor_112e, pci_ss_list_112e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x112f, pci_vendor_112f, pci_ss_list_112f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1130, pci_vendor_1130, pci_ss_list_1130}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1131, pci_vendor_1131, pci_ss_list_1131}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1132, pci_vendor_1132, pci_ss_list_1132}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1133, pci_vendor_1133, pci_ss_list_1133}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1134, pci_vendor_1134, pci_ss_list_1134}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1135, pci_vendor_1135, pci_ss_list_1135}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1136, pci_vendor_1136, pci_ss_list_1136}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1137, pci_vendor_1137, pci_ss_list_1137}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1138, pci_vendor_1138, pci_ss_list_1138}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1139, pci_vendor_1139, pci_ss_list_1139}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113a, pci_vendor_113a, pci_ss_list_113a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113b, pci_vendor_113b, pci_ss_list_113b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113c, pci_vendor_113c, pci_ss_list_113c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113d, pci_vendor_113d, pci_ss_list_113d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113e, pci_vendor_113e, pci_ss_list_113e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x113f, pci_vendor_113f, pci_ss_list_113f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1140, pci_vendor_1140, pci_ss_list_1140}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1141, pci_vendor_1141, pci_ss_list_1141}, +#endif + {0x1142, pci_vendor_1142, pci_ss_list_1142}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1143, pci_vendor_1143, pci_ss_list_1143}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1144, pci_vendor_1144, pci_ss_list_1144}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1145, pci_vendor_1145, pci_ss_list_1145}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1146, pci_vendor_1146, pci_ss_list_1146}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1147, pci_vendor_1147, pci_ss_list_1147}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1148, pci_vendor_1148, pci_ss_list_1148}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1149, pci_vendor_1149, pci_ss_list_1149}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114a, pci_vendor_114a, pci_ss_list_114a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114b, pci_vendor_114b, pci_ss_list_114b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114c, pci_vendor_114c, pci_ss_list_114c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114d, pci_vendor_114d, pci_ss_list_114d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114e, pci_vendor_114e, pci_ss_list_114e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x114f, pci_vendor_114f, pci_ss_list_114f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1150, pci_vendor_1150, pci_ss_list_1150}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1151, pci_vendor_1151, pci_ss_list_1151}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1152, pci_vendor_1152, pci_ss_list_1152}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1153, pci_vendor_1153, pci_ss_list_1153}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1154, pci_vendor_1154, pci_ss_list_1154}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1155, pci_vendor_1155, pci_ss_list_1155}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1156, pci_vendor_1156, pci_ss_list_1156}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1157, pci_vendor_1157, pci_ss_list_1157}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1158, pci_vendor_1158, pci_ss_list_1158}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1159, pci_vendor_1159, pci_ss_list_1159}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115a, pci_vendor_115a, pci_ss_list_115a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115b, pci_vendor_115b, pci_ss_list_115b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115c, pci_vendor_115c, pci_ss_list_115c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115d, pci_vendor_115d, pci_ss_list_115d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115e, pci_vendor_115e, pci_ss_list_115e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x115f, pci_vendor_115f, pci_ss_list_115f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1160, pci_vendor_1160, pci_ss_list_1160}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1161, pci_vendor_1161, pci_ss_list_1161}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1162, pci_vendor_1162, pci_ss_list_1162}, +#endif + {0x1163, pci_vendor_1163, pci_ss_list_1163}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1164, pci_vendor_1164, pci_ss_list_1164}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1165, pci_vendor_1165, pci_ss_list_1165}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1166, pci_vendor_1166, pci_ss_list_1166}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1167, pci_vendor_1167, pci_ss_list_1167}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1168, pci_vendor_1168, pci_ss_list_1168}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1169, pci_vendor_1169, pci_ss_list_1169}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116a, pci_vendor_116a, pci_ss_list_116a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116b, pci_vendor_116b, pci_ss_list_116b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116c, pci_vendor_116c, pci_ss_list_116c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116d, pci_vendor_116d, pci_ss_list_116d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116e, pci_vendor_116e, pci_ss_list_116e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x116f, pci_vendor_116f, pci_ss_list_116f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1170, pci_vendor_1170, pci_ss_list_1170}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1171, pci_vendor_1171, pci_ss_list_1171}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1172, pci_vendor_1172, pci_ss_list_1172}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1173, pci_vendor_1173, pci_ss_list_1173}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1174, pci_vendor_1174, pci_ss_list_1174}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1175, pci_vendor_1175, pci_ss_list_1175}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1176, pci_vendor_1176, pci_ss_list_1176}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1177, pci_vendor_1177, pci_ss_list_1177}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1178, pci_vendor_1178, pci_ss_list_1178}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1179, pci_vendor_1179, pci_ss_list_1179}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117a, pci_vendor_117a, pci_ss_list_117a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117b, pci_vendor_117b, pci_ss_list_117b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117c, pci_vendor_117c, pci_ss_list_117c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117d, pci_vendor_117d, pci_ss_list_117d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117e, pci_vendor_117e, pci_ss_list_117e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x117f, pci_vendor_117f, pci_ss_list_117f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1180, pci_vendor_1180, pci_ss_list_1180}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1181, pci_vendor_1181, pci_ss_list_1181}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1183, pci_vendor_1183, pci_ss_list_1183}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1184, pci_vendor_1184, pci_ss_list_1184}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1185, pci_vendor_1185, pci_ss_list_1185}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1186, pci_vendor_1186, pci_ss_list_1186}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1187, pci_vendor_1187, pci_ss_list_1187}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1188, pci_vendor_1188, pci_ss_list_1188}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1189, pci_vendor_1189, pci_ss_list_1189}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118a, pci_vendor_118a, pci_ss_list_118a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118b, pci_vendor_118b, pci_ss_list_118b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118c, pci_vendor_118c, pci_ss_list_118c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118d, pci_vendor_118d, pci_ss_list_118d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118e, pci_vendor_118e, pci_ss_list_118e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x118f, pci_vendor_118f, pci_ss_list_118f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1190, pci_vendor_1190, pci_ss_list_1190}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1191, pci_vendor_1191, pci_ss_list_1191}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1192, pci_vendor_1192, pci_ss_list_1192}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1193, pci_vendor_1193, pci_ss_list_1193}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1194, pci_vendor_1194, pci_ss_list_1194}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1195, pci_vendor_1195, pci_ss_list_1195}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1196, pci_vendor_1196, pci_ss_list_1196}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1197, pci_vendor_1197, pci_ss_list_1197}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1198, pci_vendor_1198, pci_ss_list_1198}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1199, pci_vendor_1199, pci_ss_list_1199}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119a, pci_vendor_119a, pci_ss_list_119a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119b, pci_vendor_119b, pci_ss_list_119b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119c, pci_vendor_119c, pci_ss_list_119c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119d, pci_vendor_119d, pci_ss_list_119d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119e, pci_vendor_119e, pci_ss_list_119e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x119f, pci_vendor_119f, pci_ss_list_119f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a0, pci_vendor_11a0, pci_ss_list_11a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a1, pci_vendor_11a1, pci_ss_list_11a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a2, pci_vendor_11a2, pci_ss_list_11a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a3, pci_vendor_11a3, pci_ss_list_11a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a4, pci_vendor_11a4, pci_ss_list_11a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a5, pci_vendor_11a5, pci_ss_list_11a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a6, pci_vendor_11a6, pci_ss_list_11a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a7, pci_vendor_11a7, pci_ss_list_11a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a8, pci_vendor_11a8, pci_ss_list_11a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11a9, pci_vendor_11a9, pci_ss_list_11a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11aa, pci_vendor_11aa, pci_ss_list_11aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ab, pci_vendor_11ab, pci_ss_list_11ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ac, pci_vendor_11ac, pci_ss_list_11ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ad, pci_vendor_11ad, pci_ss_list_11ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ae, pci_vendor_11ae, pci_ss_list_11ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11af, pci_vendor_11af, pci_ss_list_11af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b0, pci_vendor_11b0, pci_ss_list_11b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b1, pci_vendor_11b1, pci_ss_list_11b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b2, pci_vendor_11b2, pci_ss_list_11b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b3, pci_vendor_11b3, pci_ss_list_11b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b4, pci_vendor_11b4, pci_ss_list_11b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b5, pci_vendor_11b5, pci_ss_list_11b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b6, pci_vendor_11b6, pci_ss_list_11b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b7, pci_vendor_11b7, pci_ss_list_11b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b8, pci_vendor_11b8, pci_ss_list_11b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11b9, pci_vendor_11b9, pci_ss_list_11b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ba, pci_vendor_11ba, pci_ss_list_11ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bb, pci_vendor_11bb, pci_ss_list_11bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bc, pci_vendor_11bc, pci_ss_list_11bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bd, pci_vendor_11bd, pci_ss_list_11bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11be, pci_vendor_11be, pci_ss_list_11be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11bf, pci_vendor_11bf, pci_ss_list_11bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c0, pci_vendor_11c0, pci_ss_list_11c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c1, pci_vendor_11c1, pci_ss_list_11c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c2, pci_vendor_11c2, pci_ss_list_11c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c3, pci_vendor_11c3, pci_ss_list_11c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c4, pci_vendor_11c4, pci_ss_list_11c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c5, pci_vendor_11c5, pci_ss_list_11c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c6, pci_vendor_11c6, pci_ss_list_11c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c7, pci_vendor_11c7, pci_ss_list_11c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c8, pci_vendor_11c8, pci_ss_list_11c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11c9, pci_vendor_11c9, pci_ss_list_11c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ca, pci_vendor_11ca, pci_ss_list_11ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cb, pci_vendor_11cb, pci_ss_list_11cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cc, pci_vendor_11cc, pci_ss_list_11cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cd, pci_vendor_11cd, pci_ss_list_11cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ce, pci_vendor_11ce, pci_ss_list_11ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11cf, pci_vendor_11cf, pci_ss_list_11cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d0, pci_vendor_11d0, pci_ss_list_11d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d1, pci_vendor_11d1, pci_ss_list_11d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d2, pci_vendor_11d2, pci_ss_list_11d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d3, pci_vendor_11d3, pci_ss_list_11d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d4, pci_vendor_11d4, pci_ss_list_11d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d5, pci_vendor_11d5, pci_ss_list_11d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d6, pci_vendor_11d6, pci_ss_list_11d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d7, pci_vendor_11d7, pci_ss_list_11d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d8, pci_vendor_11d8, pci_ss_list_11d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11d9, pci_vendor_11d9, pci_ss_list_11d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11da, pci_vendor_11da, pci_ss_list_11da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11db, pci_vendor_11db, pci_ss_list_11db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11dc, pci_vendor_11dc, pci_ss_list_11dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11dd, pci_vendor_11dd, pci_ss_list_11dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11de, pci_vendor_11de, pci_ss_list_11de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11df, pci_vendor_11df, pci_ss_list_11df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e0, pci_vendor_11e0, pci_ss_list_11e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e1, pci_vendor_11e1, pci_ss_list_11e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e2, pci_vendor_11e2, pci_ss_list_11e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e3, pci_vendor_11e3, pci_ss_list_11e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e4, pci_vendor_11e4, pci_ss_list_11e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e5, pci_vendor_11e5, pci_ss_list_11e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e6, pci_vendor_11e6, pci_ss_list_11e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e7, pci_vendor_11e7, pci_ss_list_11e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e8, pci_vendor_11e8, pci_ss_list_11e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11e9, pci_vendor_11e9, pci_ss_list_11e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ea, pci_vendor_11ea, pci_ss_list_11ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11eb, pci_vendor_11eb, pci_ss_list_11eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ec, pci_vendor_11ec, pci_ss_list_11ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ed, pci_vendor_11ed, pci_ss_list_11ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ee, pci_vendor_11ee, pci_ss_list_11ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ef, pci_vendor_11ef, pci_ss_list_11ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f0, pci_vendor_11f0, pci_ss_list_11f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f1, pci_vendor_11f1, pci_ss_list_11f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f2, pci_vendor_11f2, pci_ss_list_11f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f3, pci_vendor_11f3, pci_ss_list_11f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f4, pci_vendor_11f4, pci_ss_list_11f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f5, pci_vendor_11f5, pci_ss_list_11f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f6, pci_vendor_11f6, pci_ss_list_11f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f7, pci_vendor_11f7, pci_ss_list_11f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f8, pci_vendor_11f8, pci_ss_list_11f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11f9, pci_vendor_11f9, pci_ss_list_11f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fa, pci_vendor_11fa, pci_ss_list_11fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fb, pci_vendor_11fb, pci_ss_list_11fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fc, pci_vendor_11fc, pci_ss_list_11fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fd, pci_vendor_11fd, pci_ss_list_11fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11fe, pci_vendor_11fe, pci_ss_list_11fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x11ff, pci_vendor_11ff, pci_ss_list_11ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1200, pci_vendor_1200, pci_ss_list_1200}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1201, pci_vendor_1201, pci_ss_list_1201}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1202, pci_vendor_1202, pci_ss_list_1202}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1203, pci_vendor_1203, pci_ss_list_1203}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1204, pci_vendor_1204, pci_ss_list_1204}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1205, pci_vendor_1205, pci_ss_list_1205}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1206, pci_vendor_1206, pci_ss_list_1206}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1208, pci_vendor_1208, pci_ss_list_1208}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1209, pci_vendor_1209, pci_ss_list_1209}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120a, pci_vendor_120a, pci_ss_list_120a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120b, pci_vendor_120b, pci_ss_list_120b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120c, pci_vendor_120c, pci_ss_list_120c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120d, pci_vendor_120d, pci_ss_list_120d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120e, pci_vendor_120e, pci_ss_list_120e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x120f, pci_vendor_120f, pci_ss_list_120f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1210, pci_vendor_1210, pci_ss_list_1210}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1211, pci_vendor_1211, pci_ss_list_1211}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1212, pci_vendor_1212, pci_ss_list_1212}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1213, pci_vendor_1213, pci_ss_list_1213}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1214, pci_vendor_1214, pci_ss_list_1214}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1215, pci_vendor_1215, pci_ss_list_1215}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1216, pci_vendor_1216, pci_ss_list_1216}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1217, pci_vendor_1217, pci_ss_list_1217}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1218, pci_vendor_1218, pci_ss_list_1218}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1219, pci_vendor_1219, pci_ss_list_1219}, +#endif + {0x121a, pci_vendor_121a, pci_ss_list_121a}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121b, pci_vendor_121b, pci_ss_list_121b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121c, pci_vendor_121c, pci_ss_list_121c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121d, pci_vendor_121d, pci_ss_list_121d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121e, pci_vendor_121e, pci_ss_list_121e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x121f, pci_vendor_121f, pci_ss_list_121f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1220, pci_vendor_1220, pci_ss_list_1220}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1221, pci_vendor_1221, pci_ss_list_1221}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1222, pci_vendor_1222, pci_ss_list_1222}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1223, pci_vendor_1223, pci_ss_list_1223}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1224, pci_vendor_1224, pci_ss_list_1224}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1225, pci_vendor_1225, pci_ss_list_1225}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1227, pci_vendor_1227, pci_ss_list_1227}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1228, pci_vendor_1228, pci_ss_list_1228}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1229, pci_vendor_1229, pci_ss_list_1229}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122a, pci_vendor_122a, pci_ss_list_122a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122b, pci_vendor_122b, pci_ss_list_122b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122c, pci_vendor_122c, pci_ss_list_122c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122d, pci_vendor_122d, pci_ss_list_122d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122e, pci_vendor_122e, pci_ss_list_122e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x122f, pci_vendor_122f, pci_ss_list_122f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1230, pci_vendor_1230, pci_ss_list_1230}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1231, pci_vendor_1231, pci_ss_list_1231}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1232, pci_vendor_1232, pci_ss_list_1232}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1233, pci_vendor_1233, pci_ss_list_1233}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1234, pci_vendor_1234, pci_ss_list_1234}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1235, pci_vendor_1235, pci_ss_list_1235}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1236, pci_vendor_1236, pci_ss_list_1236}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1237, pci_vendor_1237, pci_ss_list_1237}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1238, pci_vendor_1238, pci_ss_list_1238}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1239, pci_vendor_1239, pci_ss_list_1239}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123a, pci_vendor_123a, pci_ss_list_123a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123b, pci_vendor_123b, pci_ss_list_123b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123c, pci_vendor_123c, pci_ss_list_123c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123d, pci_vendor_123d, pci_ss_list_123d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123e, pci_vendor_123e, pci_ss_list_123e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x123f, pci_vendor_123f, pci_ss_list_123f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1240, pci_vendor_1240, pci_ss_list_1240}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1241, pci_vendor_1241, pci_ss_list_1241}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1242, pci_vendor_1242, pci_ss_list_1242}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1243, pci_vendor_1243, pci_ss_list_1243}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1244, pci_vendor_1244, pci_ss_list_1244}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1245, pci_vendor_1245, pci_ss_list_1245}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1246, pci_vendor_1246, pci_ss_list_1246}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1247, pci_vendor_1247, pci_ss_list_1247}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1248, pci_vendor_1248, pci_ss_list_1248}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1249, pci_vendor_1249, pci_ss_list_1249}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124a, pci_vendor_124a, pci_ss_list_124a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124b, pci_vendor_124b, pci_ss_list_124b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124c, pci_vendor_124c, pci_ss_list_124c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124d, pci_vendor_124d, pci_ss_list_124d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124e, pci_vendor_124e, pci_ss_list_124e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x124f, pci_vendor_124f, pci_ss_list_124f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1250, pci_vendor_1250, pci_ss_list_1250}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1251, pci_vendor_1251, pci_ss_list_1251}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1253, pci_vendor_1253, pci_ss_list_1253}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1254, pci_vendor_1254, pci_ss_list_1254}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1255, pci_vendor_1255, pci_ss_list_1255}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1256, pci_vendor_1256, pci_ss_list_1256}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1257, pci_vendor_1257, pci_ss_list_1257}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1258, pci_vendor_1258, pci_ss_list_1258}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1259, pci_vendor_1259, pci_ss_list_1259}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125a, pci_vendor_125a, pci_ss_list_125a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125b, pci_vendor_125b, pci_ss_list_125b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125c, pci_vendor_125c, pci_ss_list_125c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125d, pci_vendor_125d, pci_ss_list_125d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125e, pci_vendor_125e, pci_ss_list_125e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x125f, pci_vendor_125f, pci_ss_list_125f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1260, pci_vendor_1260, pci_ss_list_1260}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1261, pci_vendor_1261, pci_ss_list_1261}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1262, pci_vendor_1262, pci_ss_list_1262}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1263, pci_vendor_1263, pci_ss_list_1263}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1264, pci_vendor_1264, pci_ss_list_1264}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1265, pci_vendor_1265, pci_ss_list_1265}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1266, pci_vendor_1266, pci_ss_list_1266}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1267, pci_vendor_1267, pci_ss_list_1267}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1268, pci_vendor_1268, pci_ss_list_1268}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1269, pci_vendor_1269, pci_ss_list_1269}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126a, pci_vendor_126a, pci_ss_list_126a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126b, pci_vendor_126b, pci_ss_list_126b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126c, pci_vendor_126c, pci_ss_list_126c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126d, pci_vendor_126d, pci_ss_list_126d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x126e, pci_vendor_126e, pci_ss_list_126e}, +#endif + {0x126f, pci_vendor_126f, pci_ss_list_126f}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1270, pci_vendor_1270, pci_ss_list_1270}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1271, pci_vendor_1271, pci_ss_list_1271}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1272, pci_vendor_1272, pci_ss_list_1272}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1273, pci_vendor_1273, pci_ss_list_1273}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1274, pci_vendor_1274, pci_ss_list_1274}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1275, pci_vendor_1275, pci_ss_list_1275}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1276, pci_vendor_1276, pci_ss_list_1276}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1277, pci_vendor_1277, pci_ss_list_1277}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1278, pci_vendor_1278, pci_ss_list_1278}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1279, pci_vendor_1279, pci_ss_list_1279}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127a, pci_vendor_127a, pci_ss_list_127a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127b, pci_vendor_127b, pci_ss_list_127b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127c, pci_vendor_127c, pci_ss_list_127c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127d, pci_vendor_127d, pci_ss_list_127d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127e, pci_vendor_127e, pci_ss_list_127e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x127f, pci_vendor_127f, pci_ss_list_127f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1280, pci_vendor_1280, pci_ss_list_1280}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1281, pci_vendor_1281, pci_ss_list_1281}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1282, pci_vendor_1282, pci_ss_list_1282}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1283, pci_vendor_1283, pci_ss_list_1283}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1284, pci_vendor_1284, pci_ss_list_1284}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1285, pci_vendor_1285, pci_ss_list_1285}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1286, pci_vendor_1286, pci_ss_list_1286}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1287, pci_vendor_1287, pci_ss_list_1287}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1288, pci_vendor_1288, pci_ss_list_1288}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1289, pci_vendor_1289, pci_ss_list_1289}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128a, pci_vendor_128a, pci_ss_list_128a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128b, pci_vendor_128b, pci_ss_list_128b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128c, pci_vendor_128c, pci_ss_list_128c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128d, pci_vendor_128d, pci_ss_list_128d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128e, pci_vendor_128e, pci_ss_list_128e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x128f, pci_vendor_128f, pci_ss_list_128f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1290, pci_vendor_1290, pci_ss_list_1290}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1291, pci_vendor_1291, pci_ss_list_1291}, +#endif + {0x1292, pci_vendor_1292, pci_ss_list_1292}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1293, pci_vendor_1293, pci_ss_list_1293}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1294, pci_vendor_1294, pci_ss_list_1294}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1295, pci_vendor_1295, pci_ss_list_1295}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1296, pci_vendor_1296, pci_ss_list_1296}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1297, pci_vendor_1297, pci_ss_list_1297}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1298, pci_vendor_1298, pci_ss_list_1298}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1299, pci_vendor_1299, pci_ss_list_1299}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129a, pci_vendor_129a, pci_ss_list_129a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129b, pci_vendor_129b, pci_ss_list_129b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129c, pci_vendor_129c, pci_ss_list_129c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129d, pci_vendor_129d, pci_ss_list_129d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129e, pci_vendor_129e, pci_ss_list_129e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x129f, pci_vendor_129f, pci_ss_list_129f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a0, pci_vendor_12a0, pci_ss_list_12a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a1, pci_vendor_12a1, pci_ss_list_12a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a2, pci_vendor_12a2, pci_ss_list_12a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a3, pci_vendor_12a3, pci_ss_list_12a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a4, pci_vendor_12a4, pci_ss_list_12a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a5, pci_vendor_12a5, pci_ss_list_12a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a6, pci_vendor_12a6, pci_ss_list_12a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a7, pci_vendor_12a7, pci_ss_list_12a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a8, pci_vendor_12a8, pci_ss_list_12a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12a9, pci_vendor_12a9, pci_ss_list_12a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12aa, pci_vendor_12aa, pci_ss_list_12aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ab, pci_vendor_12ab, pci_ss_list_12ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ac, pci_vendor_12ac, pci_ss_list_12ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ad, pci_vendor_12ad, pci_ss_list_12ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ae, pci_vendor_12ae, pci_ss_list_12ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12af, pci_vendor_12af, pci_ss_list_12af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b0, pci_vendor_12b0, pci_ss_list_12b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b1, pci_vendor_12b1, pci_ss_list_12b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b2, pci_vendor_12b2, pci_ss_list_12b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b3, pci_vendor_12b3, pci_ss_list_12b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b4, pci_vendor_12b4, pci_ss_list_12b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b5, pci_vendor_12b5, pci_ss_list_12b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b6, pci_vendor_12b6, pci_ss_list_12b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b7, pci_vendor_12b7, pci_ss_list_12b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b8, pci_vendor_12b8, pci_ss_list_12b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12b9, pci_vendor_12b9, pci_ss_list_12b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ba, pci_vendor_12ba, pci_ss_list_12ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bb, pci_vendor_12bb, pci_ss_list_12bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bc, pci_vendor_12bc, pci_ss_list_12bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bd, pci_vendor_12bd, pci_ss_list_12bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12be, pci_vendor_12be, pci_ss_list_12be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12bf, pci_vendor_12bf, pci_ss_list_12bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c0, pci_vendor_12c0, pci_ss_list_12c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c1, pci_vendor_12c1, pci_ss_list_12c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c2, pci_vendor_12c2, pci_ss_list_12c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c3, pci_vendor_12c3, pci_ss_list_12c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c4, pci_vendor_12c4, pci_ss_list_12c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c5, pci_vendor_12c5, pci_ss_list_12c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c6, pci_vendor_12c6, pci_ss_list_12c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c7, pci_vendor_12c7, pci_ss_list_12c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c8, pci_vendor_12c8, pci_ss_list_12c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12c9, pci_vendor_12c9, pci_ss_list_12c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ca, pci_vendor_12ca, pci_ss_list_12ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cb, pci_vendor_12cb, pci_ss_list_12cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cc, pci_vendor_12cc, pci_ss_list_12cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cd, pci_vendor_12cd, pci_ss_list_12cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ce, pci_vendor_12ce, pci_ss_list_12ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12cf, pci_vendor_12cf, pci_ss_list_12cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d0, pci_vendor_12d0, pci_ss_list_12d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d1, pci_vendor_12d1, pci_ss_list_12d1}, +#endif + {0x12d2, pci_vendor_12d2, pci_ss_list_12d2}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d3, pci_vendor_12d3, pci_ss_list_12d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d4, pci_vendor_12d4, pci_ss_list_12d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d5, pci_vendor_12d5, pci_ss_list_12d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d6, pci_vendor_12d6, pci_ss_list_12d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d7, pci_vendor_12d7, pci_ss_list_12d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d8, pci_vendor_12d8, pci_ss_list_12d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12d9, pci_vendor_12d9, pci_ss_list_12d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12da, pci_vendor_12da, pci_ss_list_12da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12db, pci_vendor_12db, pci_ss_list_12db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12dc, pci_vendor_12dc, pci_ss_list_12dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12dd, pci_vendor_12dd, pci_ss_list_12dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12de, pci_vendor_12de, pci_ss_list_12de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12df, pci_vendor_12df, pci_ss_list_12df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e0, pci_vendor_12e0, pci_ss_list_12e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e1, pci_vendor_12e1, pci_ss_list_12e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e2, pci_vendor_12e2, pci_ss_list_12e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e3, pci_vendor_12e3, pci_ss_list_12e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e4, pci_vendor_12e4, pci_ss_list_12e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e5, pci_vendor_12e5, pci_ss_list_12e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e6, pci_vendor_12e6, pci_ss_list_12e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e7, pci_vendor_12e7, pci_ss_list_12e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e8, pci_vendor_12e8, pci_ss_list_12e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12e9, pci_vendor_12e9, pci_ss_list_12e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ea, pci_vendor_12ea, pci_ss_list_12ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12eb, pci_vendor_12eb, pci_ss_list_12eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ec, pci_vendor_12ec, pci_ss_list_12ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ed, pci_vendor_12ed, pci_ss_list_12ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ee, pci_vendor_12ee, pci_ss_list_12ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ef, pci_vendor_12ef, pci_ss_list_12ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f0, pci_vendor_12f0, pci_ss_list_12f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f1, pci_vendor_12f1, pci_ss_list_12f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f2, pci_vendor_12f2, pci_ss_list_12f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f3, pci_vendor_12f3, pci_ss_list_12f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f4, pci_vendor_12f4, pci_ss_list_12f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f5, pci_vendor_12f5, pci_ss_list_12f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f6, pci_vendor_12f6, pci_ss_list_12f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f7, pci_vendor_12f7, pci_ss_list_12f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f8, pci_vendor_12f8, pci_ss_list_12f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12f9, pci_vendor_12f9, pci_ss_list_12f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fb, pci_vendor_12fb, pci_ss_list_12fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fc, pci_vendor_12fc, pci_ss_list_12fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fd, pci_vendor_12fd, pci_ss_list_12fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12fe, pci_vendor_12fe, pci_ss_list_12fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x12ff, pci_vendor_12ff, pci_ss_list_12ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1300, pci_vendor_1300, pci_ss_list_1300}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1302, pci_vendor_1302, pci_ss_list_1302}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1303, pci_vendor_1303, pci_ss_list_1303}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1304, pci_vendor_1304, pci_ss_list_1304}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1305, pci_vendor_1305, pci_ss_list_1305}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1306, pci_vendor_1306, pci_ss_list_1306}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1307, pci_vendor_1307, pci_ss_list_1307}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1308, pci_vendor_1308, pci_ss_list_1308}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1309, pci_vendor_1309, pci_ss_list_1309}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130a, pci_vendor_130a, pci_ss_list_130a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130b, pci_vendor_130b, pci_ss_list_130b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130c, pci_vendor_130c, pci_ss_list_130c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130d, pci_vendor_130d, pci_ss_list_130d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130e, pci_vendor_130e, pci_ss_list_130e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x130f, pci_vendor_130f, pci_ss_list_130f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1310, pci_vendor_1310, pci_ss_list_1310}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1311, pci_vendor_1311, pci_ss_list_1311}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1312, pci_vendor_1312, pci_ss_list_1312}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1313, pci_vendor_1313, pci_ss_list_1313}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1316, pci_vendor_1316, pci_ss_list_1316}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1317, pci_vendor_1317, pci_ss_list_1317}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1318, pci_vendor_1318, pci_ss_list_1318}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1319, pci_vendor_1319, pci_ss_list_1319}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131a, pci_vendor_131a, pci_ss_list_131a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131c, pci_vendor_131c, pci_ss_list_131c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131d, pci_vendor_131d, pci_ss_list_131d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131e, pci_vendor_131e, pci_ss_list_131e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x131f, pci_vendor_131f, pci_ss_list_131f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1320, pci_vendor_1320, pci_ss_list_1320}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1321, pci_vendor_1321, pci_ss_list_1321}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1322, pci_vendor_1322, pci_ss_list_1322}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1323, pci_vendor_1323, pci_ss_list_1323}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1324, pci_vendor_1324, pci_ss_list_1324}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1325, pci_vendor_1325, pci_ss_list_1325}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1326, pci_vendor_1326, pci_ss_list_1326}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1327, pci_vendor_1327, pci_ss_list_1327}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1328, pci_vendor_1328, pci_ss_list_1328}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1329, pci_vendor_1329, pci_ss_list_1329}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132a, pci_vendor_132a, pci_ss_list_132a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132b, pci_vendor_132b, pci_ss_list_132b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132c, pci_vendor_132c, pci_ss_list_132c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x132d, pci_vendor_132d, pci_ss_list_132d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1330, pci_vendor_1330, pci_ss_list_1330}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1331, pci_vendor_1331, pci_ss_list_1331}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1332, pci_vendor_1332, pci_ss_list_1332}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1334, pci_vendor_1334, pci_ss_list_1334}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1335, pci_vendor_1335, pci_ss_list_1335}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1337, pci_vendor_1337, pci_ss_list_1337}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1338, pci_vendor_1338, pci_ss_list_1338}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133a, pci_vendor_133a, pci_ss_list_133a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133b, pci_vendor_133b, pci_ss_list_133b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133c, pci_vendor_133c, pci_ss_list_133c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133d, pci_vendor_133d, pci_ss_list_133d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133e, pci_vendor_133e, pci_ss_list_133e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x133f, pci_vendor_133f, pci_ss_list_133f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1340, pci_vendor_1340, pci_ss_list_1340}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1341, pci_vendor_1341, pci_ss_list_1341}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1342, pci_vendor_1342, pci_ss_list_1342}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1343, pci_vendor_1343, pci_ss_list_1343}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1344, pci_vendor_1344, pci_ss_list_1344}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1345, pci_vendor_1345, pci_ss_list_1345}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1347, pci_vendor_1347, pci_ss_list_1347}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1349, pci_vendor_1349, pci_ss_list_1349}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134a, pci_vendor_134a, pci_ss_list_134a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134b, pci_vendor_134b, pci_ss_list_134b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134c, pci_vendor_134c, pci_ss_list_134c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134d, pci_vendor_134d, pci_ss_list_134d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134e, pci_vendor_134e, pci_ss_list_134e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x134f, pci_vendor_134f, pci_ss_list_134f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1350, pci_vendor_1350, pci_ss_list_1350}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1351, pci_vendor_1351, pci_ss_list_1351}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1353, pci_vendor_1353, pci_ss_list_1353}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1354, pci_vendor_1354, pci_ss_list_1354}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1355, pci_vendor_1355, pci_ss_list_1355}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1356, pci_vendor_1356, pci_ss_list_1356}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1359, pci_vendor_1359, pci_ss_list_1359}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135a, pci_vendor_135a, pci_ss_list_135a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135b, pci_vendor_135b, pci_ss_list_135b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135c, pci_vendor_135c, pci_ss_list_135c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135d, pci_vendor_135d, pci_ss_list_135d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135e, pci_vendor_135e, pci_ss_list_135e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x135f, pci_vendor_135f, pci_ss_list_135f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1360, pci_vendor_1360, pci_ss_list_1360}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1361, pci_vendor_1361, pci_ss_list_1361}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1362, pci_vendor_1362, pci_ss_list_1362}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1363, pci_vendor_1363, pci_ss_list_1363}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1364, pci_vendor_1364, pci_ss_list_1364}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1365, pci_vendor_1365, pci_ss_list_1365}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1366, pci_vendor_1366, pci_ss_list_1366}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1367, pci_vendor_1367, pci_ss_list_1367}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1368, pci_vendor_1368, pci_ss_list_1368}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1369, pci_vendor_1369, pci_ss_list_1369}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136a, pci_vendor_136a, pci_ss_list_136a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136b, pci_vendor_136b, pci_ss_list_136b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136c, pci_vendor_136c, pci_ss_list_136c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136d, pci_vendor_136d, pci_ss_list_136d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x136f, pci_vendor_136f, pci_ss_list_136f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1370, pci_vendor_1370, pci_ss_list_1370}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1371, pci_vendor_1371, pci_ss_list_1371}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1373, pci_vendor_1373, pci_ss_list_1373}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1374, pci_vendor_1374, pci_ss_list_1374}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1375, pci_vendor_1375, pci_ss_list_1375}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1376, pci_vendor_1376, pci_ss_list_1376}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1377, pci_vendor_1377, pci_ss_list_1377}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1378, pci_vendor_1378, pci_ss_list_1378}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1379, pci_vendor_1379, pci_ss_list_1379}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137a, pci_vendor_137a, pci_ss_list_137a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137b, pci_vendor_137b, pci_ss_list_137b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137c, pci_vendor_137c, pci_ss_list_137c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137d, pci_vendor_137d, pci_ss_list_137d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137e, pci_vendor_137e, pci_ss_list_137e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x137f, pci_vendor_137f, pci_ss_list_137f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1380, pci_vendor_1380, pci_ss_list_1380}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1381, pci_vendor_1381, pci_ss_list_1381}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1382, pci_vendor_1382, pci_ss_list_1382}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1383, pci_vendor_1383, pci_ss_list_1383}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1384, pci_vendor_1384, pci_ss_list_1384}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1385, pci_vendor_1385, pci_ss_list_1385}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1386, pci_vendor_1386, pci_ss_list_1386}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1387, pci_vendor_1387, pci_ss_list_1387}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1388, pci_vendor_1388, pci_ss_list_1388}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1389, pci_vendor_1389, pci_ss_list_1389}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138a, pci_vendor_138a, pci_ss_list_138a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138b, pci_vendor_138b, pci_ss_list_138b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138c, pci_vendor_138c, pci_ss_list_138c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138d, pci_vendor_138d, pci_ss_list_138d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138e, pci_vendor_138e, pci_ss_list_138e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x138f, pci_vendor_138f, pci_ss_list_138f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1390, pci_vendor_1390, pci_ss_list_1390}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1391, pci_vendor_1391, pci_ss_list_1391}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1392, pci_vendor_1392, pci_ss_list_1392}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1393, pci_vendor_1393, pci_ss_list_1393}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1394, pci_vendor_1394, pci_ss_list_1394}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1395, pci_vendor_1395, pci_ss_list_1395}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1396, pci_vendor_1396, pci_ss_list_1396}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1397, pci_vendor_1397, pci_ss_list_1397}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1398, pci_vendor_1398, pci_ss_list_1398}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1399, pci_vendor_1399, pci_ss_list_1399}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139a, pci_vendor_139a, pci_ss_list_139a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139b, pci_vendor_139b, pci_ss_list_139b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139c, pci_vendor_139c, pci_ss_list_139c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139d, pci_vendor_139d, pci_ss_list_139d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139e, pci_vendor_139e, pci_ss_list_139e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x139f, pci_vendor_139f, pci_ss_list_139f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a0, pci_vendor_13a0, pci_ss_list_13a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a1, pci_vendor_13a1, pci_ss_list_13a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a2, pci_vendor_13a2, pci_ss_list_13a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a3, pci_vendor_13a3, pci_ss_list_13a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a4, pci_vendor_13a4, pci_ss_list_13a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a5, pci_vendor_13a5, pci_ss_list_13a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a6, pci_vendor_13a6, pci_ss_list_13a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a7, pci_vendor_13a7, pci_ss_list_13a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a8, pci_vendor_13a8, pci_ss_list_13a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13a9, pci_vendor_13a9, pci_ss_list_13a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13aa, pci_vendor_13aa, pci_ss_list_13aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ab, pci_vendor_13ab, pci_ss_list_13ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ac, pci_vendor_13ac, pci_ss_list_13ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ad, pci_vendor_13ad, pci_ss_list_13ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ae, pci_vendor_13ae, pci_ss_list_13ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13af, pci_vendor_13af, pci_ss_list_13af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b0, pci_vendor_13b0, pci_ss_list_13b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b1, pci_vendor_13b1, pci_ss_list_13b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b2, pci_vendor_13b2, pci_ss_list_13b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b3, pci_vendor_13b3, pci_ss_list_13b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b4, pci_vendor_13b4, pci_ss_list_13b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b5, pci_vendor_13b5, pci_ss_list_13b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b6, pci_vendor_13b6, pci_ss_list_13b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b7, pci_vendor_13b7, pci_ss_list_13b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b8, pci_vendor_13b8, pci_ss_list_13b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13b9, pci_vendor_13b9, pci_ss_list_13b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ba, pci_vendor_13ba, pci_ss_list_13ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bb, pci_vendor_13bb, pci_ss_list_13bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bc, pci_vendor_13bc, pci_ss_list_13bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bd, pci_vendor_13bd, pci_ss_list_13bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13be, pci_vendor_13be, pci_ss_list_13be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13bf, pci_vendor_13bf, pci_ss_list_13bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c0, pci_vendor_13c0, pci_ss_list_13c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c1, pci_vendor_13c1, pci_ss_list_13c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c2, pci_vendor_13c2, pci_ss_list_13c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c3, pci_vendor_13c3, pci_ss_list_13c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c4, pci_vendor_13c4, pci_ss_list_13c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c5, pci_vendor_13c5, pci_ss_list_13c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c6, pci_vendor_13c6, pci_ss_list_13c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c7, pci_vendor_13c7, pci_ss_list_13c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c8, pci_vendor_13c8, pci_ss_list_13c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13c9, pci_vendor_13c9, pci_ss_list_13c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ca, pci_vendor_13ca, pci_ss_list_13ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cb, pci_vendor_13cb, pci_ss_list_13cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cc, pci_vendor_13cc, pci_ss_list_13cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cd, pci_vendor_13cd, pci_ss_list_13cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ce, pci_vendor_13ce, pci_ss_list_13ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13cf, pci_vendor_13cf, pci_ss_list_13cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d0, pci_vendor_13d0, pci_ss_list_13d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d1, pci_vendor_13d1, pci_ss_list_13d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d2, pci_vendor_13d2, pci_ss_list_13d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d3, pci_vendor_13d3, pci_ss_list_13d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d4, pci_vendor_13d4, pci_ss_list_13d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d5, pci_vendor_13d5, pci_ss_list_13d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d6, pci_vendor_13d6, pci_ss_list_13d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d7, pci_vendor_13d7, pci_ss_list_13d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d8, pci_vendor_13d8, pci_ss_list_13d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13d9, pci_vendor_13d9, pci_ss_list_13d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13da, pci_vendor_13da, pci_ss_list_13da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13db, pci_vendor_13db, pci_ss_list_13db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13dc, pci_vendor_13dc, pci_ss_list_13dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13dd, pci_vendor_13dd, pci_ss_list_13dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13de, pci_vendor_13de, pci_ss_list_13de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13df, pci_vendor_13df, pci_ss_list_13df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e0, pci_vendor_13e0, pci_ss_list_13e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e1, pci_vendor_13e1, pci_ss_list_13e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e2, pci_vendor_13e2, pci_ss_list_13e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e3, pci_vendor_13e3, pci_ss_list_13e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e4, pci_vendor_13e4, pci_ss_list_13e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e5, pci_vendor_13e5, pci_ss_list_13e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e6, pci_vendor_13e6, pci_ss_list_13e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e7, pci_vendor_13e7, pci_ss_list_13e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e8, pci_vendor_13e8, pci_ss_list_13e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13e9, pci_vendor_13e9, pci_ss_list_13e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ea, pci_vendor_13ea, pci_ss_list_13ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13eb, pci_vendor_13eb, pci_ss_list_13eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ec, pci_vendor_13ec, pci_ss_list_13ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ed, pci_vendor_13ed, pci_ss_list_13ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ee, pci_vendor_13ee, pci_ss_list_13ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ef, pci_vendor_13ef, pci_ss_list_13ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f0, pci_vendor_13f0, pci_ss_list_13f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f1, pci_vendor_13f1, pci_ss_list_13f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f2, pci_vendor_13f2, pci_ss_list_13f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f3, pci_vendor_13f3, pci_ss_list_13f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f4, pci_vendor_13f4, pci_ss_list_13f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f5, pci_vendor_13f5, pci_ss_list_13f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f6, pci_vendor_13f6, pci_ss_list_13f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f7, pci_vendor_13f7, pci_ss_list_13f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f8, pci_vendor_13f8, pci_ss_list_13f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13f9, pci_vendor_13f9, pci_ss_list_13f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fa, pci_vendor_13fa, pci_ss_list_13fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fb, pci_vendor_13fb, pci_ss_list_13fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fc, pci_vendor_13fc, pci_ss_list_13fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fd, pci_vendor_13fd, pci_ss_list_13fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13fe, pci_vendor_13fe, pci_ss_list_13fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x13ff, pci_vendor_13ff, pci_ss_list_13ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1400, pci_vendor_1400, pci_ss_list_1400}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1401, pci_vendor_1401, pci_ss_list_1401}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1402, pci_vendor_1402, pci_ss_list_1402}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1403, pci_vendor_1403, pci_ss_list_1403}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1404, pci_vendor_1404, pci_ss_list_1404}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1405, pci_vendor_1405, pci_ss_list_1405}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1406, pci_vendor_1406, pci_ss_list_1406}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1407, pci_vendor_1407, pci_ss_list_1407}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1408, pci_vendor_1408, pci_ss_list_1408}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1409, pci_vendor_1409, pci_ss_list_1409}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140a, pci_vendor_140a, pci_ss_list_140a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140b, pci_vendor_140b, pci_ss_list_140b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140c, pci_vendor_140c, pci_ss_list_140c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140d, pci_vendor_140d, pci_ss_list_140d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140e, pci_vendor_140e, pci_ss_list_140e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x140f, pci_vendor_140f, pci_ss_list_140f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1410, pci_vendor_1410, pci_ss_list_1410}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1411, pci_vendor_1411, pci_ss_list_1411}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1412, pci_vendor_1412, pci_ss_list_1412}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1413, pci_vendor_1413, pci_ss_list_1413}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1414, pci_vendor_1414, pci_ss_list_1414}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1415, pci_vendor_1415, pci_ss_list_1415}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1416, pci_vendor_1416, pci_ss_list_1416}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1417, pci_vendor_1417, pci_ss_list_1417}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1418, pci_vendor_1418, pci_ss_list_1418}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1419, pci_vendor_1419, pci_ss_list_1419}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141a, pci_vendor_141a, pci_ss_list_141a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141b, pci_vendor_141b, pci_ss_list_141b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141d, pci_vendor_141d, pci_ss_list_141d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141e, pci_vendor_141e, pci_ss_list_141e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x141f, pci_vendor_141f, pci_ss_list_141f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1420, pci_vendor_1420, pci_ss_list_1420}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1421, pci_vendor_1421, pci_ss_list_1421}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1422, pci_vendor_1422, pci_ss_list_1422}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1423, pci_vendor_1423, pci_ss_list_1423}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1424, pci_vendor_1424, pci_ss_list_1424}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1425, pci_vendor_1425, pci_ss_list_1425}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1426, pci_vendor_1426, pci_ss_list_1426}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1427, pci_vendor_1427, pci_ss_list_1427}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1428, pci_vendor_1428, pci_ss_list_1428}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1429, pci_vendor_1429, pci_ss_list_1429}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142a, pci_vendor_142a, pci_ss_list_142a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142b, pci_vendor_142b, pci_ss_list_142b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142c, pci_vendor_142c, pci_ss_list_142c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142d, pci_vendor_142d, pci_ss_list_142d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142e, pci_vendor_142e, pci_ss_list_142e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x142f, pci_vendor_142f, pci_ss_list_142f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1430, pci_vendor_1430, pci_ss_list_1430}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1431, pci_vendor_1431, pci_ss_list_1431}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1432, pci_vendor_1432, pci_ss_list_1432}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1433, pci_vendor_1433, pci_ss_list_1433}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1435, pci_vendor_1435, pci_ss_list_1435}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1436, pci_vendor_1436, pci_ss_list_1436}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1437, pci_vendor_1437, pci_ss_list_1437}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1438, pci_vendor_1438, pci_ss_list_1438}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1439, pci_vendor_1439, pci_ss_list_1439}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143a, pci_vendor_143a, pci_ss_list_143a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143b, pci_vendor_143b, pci_ss_list_143b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143c, pci_vendor_143c, pci_ss_list_143c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143d, pci_vendor_143d, pci_ss_list_143d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143e, pci_vendor_143e, pci_ss_list_143e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x143f, pci_vendor_143f, pci_ss_list_143f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1440, pci_vendor_1440, pci_ss_list_1440}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1441, pci_vendor_1441, pci_ss_list_1441}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1442, pci_vendor_1442, pci_ss_list_1442}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1443, pci_vendor_1443, pci_ss_list_1443}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1444, pci_vendor_1444, pci_ss_list_1444}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1445, pci_vendor_1445, pci_ss_list_1445}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1446, pci_vendor_1446, pci_ss_list_1446}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1447, pci_vendor_1447, pci_ss_list_1447}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1448, pci_vendor_1448, pci_ss_list_1448}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1449, pci_vendor_1449, pci_ss_list_1449}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144a, pci_vendor_144a, pci_ss_list_144a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144b, pci_vendor_144b, pci_ss_list_144b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144c, pci_vendor_144c, pci_ss_list_144c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144d, pci_vendor_144d, pci_ss_list_144d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144e, pci_vendor_144e, pci_ss_list_144e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x144f, pci_vendor_144f, pci_ss_list_144f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1450, pci_vendor_1450, pci_ss_list_1450}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1451, pci_vendor_1451, pci_ss_list_1451}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1453, pci_vendor_1453, pci_ss_list_1453}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1454, pci_vendor_1454, pci_ss_list_1454}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1455, pci_vendor_1455, pci_ss_list_1455}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1456, pci_vendor_1456, pci_ss_list_1456}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1457, pci_vendor_1457, pci_ss_list_1457}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1458, pci_vendor_1458, pci_ss_list_1458}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1459, pci_vendor_1459, pci_ss_list_1459}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145a, pci_vendor_145a, pci_ss_list_145a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145b, pci_vendor_145b, pci_ss_list_145b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145c, pci_vendor_145c, pci_ss_list_145c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145d, pci_vendor_145d, pci_ss_list_145d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145e, pci_vendor_145e, pci_ss_list_145e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x145f, pci_vendor_145f, pci_ss_list_145f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1460, pci_vendor_1460, pci_ss_list_1460}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1461, pci_vendor_1461, pci_ss_list_1461}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1462, pci_vendor_1462, pci_ss_list_1462}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1463, pci_vendor_1463, pci_ss_list_1463}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1464, pci_vendor_1464, pci_ss_list_1464}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1465, pci_vendor_1465, pci_ss_list_1465}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1466, pci_vendor_1466, pci_ss_list_1466}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1467, pci_vendor_1467, pci_ss_list_1467}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1468, pci_vendor_1468, pci_ss_list_1468}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1469, pci_vendor_1469, pci_ss_list_1469}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146a, pci_vendor_146a, pci_ss_list_146a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146b, pci_vendor_146b, pci_ss_list_146b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146c, pci_vendor_146c, pci_ss_list_146c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146d, pci_vendor_146d, pci_ss_list_146d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146e, pci_vendor_146e, pci_ss_list_146e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x146f, pci_vendor_146f, pci_ss_list_146f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1470, pci_vendor_1470, pci_ss_list_1470}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1471, pci_vendor_1471, pci_ss_list_1471}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1472, pci_vendor_1472, pci_ss_list_1472}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1473, pci_vendor_1473, pci_ss_list_1473}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1474, pci_vendor_1474, pci_ss_list_1474}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1475, pci_vendor_1475, pci_ss_list_1475}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1476, pci_vendor_1476, pci_ss_list_1476}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1477, pci_vendor_1477, pci_ss_list_1477}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1478, pci_vendor_1478, pci_ss_list_1478}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1479, pci_vendor_1479, pci_ss_list_1479}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147a, pci_vendor_147a, pci_ss_list_147a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147b, pci_vendor_147b, pci_ss_list_147b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147c, pci_vendor_147c, pci_ss_list_147c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147d, pci_vendor_147d, pci_ss_list_147d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147e, pci_vendor_147e, pci_ss_list_147e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x147f, pci_vendor_147f, pci_ss_list_147f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1480, pci_vendor_1480, pci_ss_list_1480}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1481, pci_vendor_1481, pci_ss_list_1481}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1482, pci_vendor_1482, pci_ss_list_1482}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1483, pci_vendor_1483, pci_ss_list_1483}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1484, pci_vendor_1484, pci_ss_list_1484}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1485, pci_vendor_1485, pci_ss_list_1485}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1486, pci_vendor_1486, pci_ss_list_1486}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1487, pci_vendor_1487, pci_ss_list_1487}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1488, pci_vendor_1488, pci_ss_list_1488}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1489, pci_vendor_1489, pci_ss_list_1489}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148a, pci_vendor_148a, pci_ss_list_148a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148b, pci_vendor_148b, pci_ss_list_148b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148c, pci_vendor_148c, pci_ss_list_148c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148d, pci_vendor_148d, pci_ss_list_148d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148e, pci_vendor_148e, pci_ss_list_148e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x148f, pci_vendor_148f, pci_ss_list_148f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1490, pci_vendor_1490, pci_ss_list_1490}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1491, pci_vendor_1491, pci_ss_list_1491}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1492, pci_vendor_1492, pci_ss_list_1492}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1493, pci_vendor_1493, pci_ss_list_1493}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1494, pci_vendor_1494, pci_ss_list_1494}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1495, pci_vendor_1495, pci_ss_list_1495}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1496, pci_vendor_1496, pci_ss_list_1496}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1497, pci_vendor_1497, pci_ss_list_1497}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1498, pci_vendor_1498, pci_ss_list_1498}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1499, pci_vendor_1499, pci_ss_list_1499}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149a, pci_vendor_149a, pci_ss_list_149a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149b, pci_vendor_149b, pci_ss_list_149b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149c, pci_vendor_149c, pci_ss_list_149c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149d, pci_vendor_149d, pci_ss_list_149d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149e, pci_vendor_149e, pci_ss_list_149e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x149f, pci_vendor_149f, pci_ss_list_149f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a0, pci_vendor_14a0, pci_ss_list_14a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a1, pci_vendor_14a1, pci_ss_list_14a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a2, pci_vendor_14a2, pci_ss_list_14a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a3, pci_vendor_14a3, pci_ss_list_14a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a4, pci_vendor_14a4, pci_ss_list_14a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a5, pci_vendor_14a5, pci_ss_list_14a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a6, pci_vendor_14a6, pci_ss_list_14a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a7, pci_vendor_14a7, pci_ss_list_14a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a8, pci_vendor_14a8, pci_ss_list_14a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14a9, pci_vendor_14a9, pci_ss_list_14a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14aa, pci_vendor_14aa, pci_ss_list_14aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ab, pci_vendor_14ab, pci_ss_list_14ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ac, pci_vendor_14ac, pci_ss_list_14ac}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ad, pci_vendor_14ad, pci_ss_list_14ad}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ae, pci_vendor_14ae, pci_ss_list_14ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14af, pci_vendor_14af, pci_ss_list_14af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b0, pci_vendor_14b0, pci_ss_list_14b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b1, pci_vendor_14b1, pci_ss_list_14b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b2, pci_vendor_14b2, pci_ss_list_14b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b3, pci_vendor_14b3, pci_ss_list_14b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b4, pci_vendor_14b4, pci_ss_list_14b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b5, pci_vendor_14b5, pci_ss_list_14b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b6, pci_vendor_14b6, pci_ss_list_14b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b7, pci_vendor_14b7, pci_ss_list_14b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b8, pci_vendor_14b8, pci_ss_list_14b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14b9, pci_vendor_14b9, pci_ss_list_14b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ba, pci_vendor_14ba, pci_ss_list_14ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bb, pci_vendor_14bb, pci_ss_list_14bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bc, pci_vendor_14bc, pci_ss_list_14bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bd, pci_vendor_14bd, pci_ss_list_14bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14be, pci_vendor_14be, pci_ss_list_14be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14bf, pci_vendor_14bf, pci_ss_list_14bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c0, pci_vendor_14c0, pci_ss_list_14c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c1, pci_vendor_14c1, pci_ss_list_14c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c2, pci_vendor_14c2, pci_ss_list_14c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c3, pci_vendor_14c3, pci_ss_list_14c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c4, pci_vendor_14c4, pci_ss_list_14c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c5, pci_vendor_14c5, pci_ss_list_14c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c6, pci_vendor_14c6, pci_ss_list_14c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c7, pci_vendor_14c7, pci_ss_list_14c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c8, pci_vendor_14c8, pci_ss_list_14c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14c9, pci_vendor_14c9, pci_ss_list_14c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ca, pci_vendor_14ca, pci_ss_list_14ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cb, pci_vendor_14cb, pci_ss_list_14cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cc, pci_vendor_14cc, pci_ss_list_14cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cd, pci_vendor_14cd, pci_ss_list_14cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ce, pci_vendor_14ce, pci_ss_list_14ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14cf, pci_vendor_14cf, pci_ss_list_14cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d0, pci_vendor_14d0, pci_ss_list_14d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d1, pci_vendor_14d1, pci_ss_list_14d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d2, pci_vendor_14d2, pci_ss_list_14d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d3, pci_vendor_14d3, pci_ss_list_14d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d4, pci_vendor_14d4, pci_ss_list_14d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d5, pci_vendor_14d5, pci_ss_list_14d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d6, pci_vendor_14d6, pci_ss_list_14d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d7, pci_vendor_14d7, pci_ss_list_14d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d8, pci_vendor_14d8, pci_ss_list_14d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14d9, pci_vendor_14d9, pci_ss_list_14d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14da, pci_vendor_14da, pci_ss_list_14da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14db, pci_vendor_14db, pci_ss_list_14db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14dc, pci_vendor_14dc, pci_ss_list_14dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14dd, pci_vendor_14dd, pci_ss_list_14dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14de, pci_vendor_14de, pci_ss_list_14de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14df, pci_vendor_14df, pci_ss_list_14df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e1, pci_vendor_14e1, pci_ss_list_14e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e2, pci_vendor_14e2, pci_ss_list_14e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e3, pci_vendor_14e3, pci_ss_list_14e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e4, pci_vendor_14e4, pci_ss_list_14e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e5, pci_vendor_14e5, pci_ss_list_14e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e6, pci_vendor_14e6, pci_ss_list_14e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e7, pci_vendor_14e7, pci_ss_list_14e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e8, pci_vendor_14e8, pci_ss_list_14e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14e9, pci_vendor_14e9, pci_ss_list_14e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ea, pci_vendor_14ea, pci_ss_list_14ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14eb, pci_vendor_14eb, pci_ss_list_14eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ec, pci_vendor_14ec, pci_ss_list_14ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ed, pci_vendor_14ed, pci_ss_list_14ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ee, pci_vendor_14ee, pci_ss_list_14ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ef, pci_vendor_14ef, pci_ss_list_14ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f0, pci_vendor_14f0, pci_ss_list_14f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f1, pci_vendor_14f1, pci_ss_list_14f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f2, pci_vendor_14f2, pci_ss_list_14f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f3, pci_vendor_14f3, pci_ss_list_14f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f4, pci_vendor_14f4, pci_ss_list_14f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f5, pci_vendor_14f5, pci_ss_list_14f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f6, pci_vendor_14f6, pci_ss_list_14f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f7, pci_vendor_14f7, pci_ss_list_14f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f8, pci_vendor_14f8, pci_ss_list_14f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14f9, pci_vendor_14f9, pci_ss_list_14f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fa, pci_vendor_14fa, pci_ss_list_14fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fb, pci_vendor_14fb, pci_ss_list_14fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fc, pci_vendor_14fc, pci_ss_list_14fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fd, pci_vendor_14fd, pci_ss_list_14fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14fe, pci_vendor_14fe, pci_ss_list_14fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x14ff, pci_vendor_14ff, pci_ss_list_14ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1500, pci_vendor_1500, pci_ss_list_1500}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1501, pci_vendor_1501, pci_ss_list_1501}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1502, pci_vendor_1502, pci_ss_list_1502}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1503, pci_vendor_1503, pci_ss_list_1503}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1504, pci_vendor_1504, pci_ss_list_1504}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1505, pci_vendor_1505, pci_ss_list_1505}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1506, pci_vendor_1506, pci_ss_list_1506}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1507, pci_vendor_1507, pci_ss_list_1507}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1508, pci_vendor_1508, pci_ss_list_1508}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1509, pci_vendor_1509, pci_ss_list_1509}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150a, pci_vendor_150a, pci_ss_list_150a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150b, pci_vendor_150b, pci_ss_list_150b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150c, pci_vendor_150c, pci_ss_list_150c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150d, pci_vendor_150d, pci_ss_list_150d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150e, pci_vendor_150e, pci_ss_list_150e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x150f, pci_vendor_150f, pci_ss_list_150f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1510, pci_vendor_1510, pci_ss_list_1510}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1511, pci_vendor_1511, pci_ss_list_1511}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1512, pci_vendor_1512, pci_ss_list_1512}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1513, pci_vendor_1513, pci_ss_list_1513}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1514, pci_vendor_1514, pci_ss_list_1514}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1515, pci_vendor_1515, pci_ss_list_1515}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1516, pci_vendor_1516, pci_ss_list_1516}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1517, pci_vendor_1517, pci_ss_list_1517}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1518, pci_vendor_1518, pci_ss_list_1518}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1519, pci_vendor_1519, pci_ss_list_1519}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151a, pci_vendor_151a, pci_ss_list_151a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151b, pci_vendor_151b, pci_ss_list_151b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151c, pci_vendor_151c, pci_ss_list_151c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151d, pci_vendor_151d, pci_ss_list_151d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151e, pci_vendor_151e, pci_ss_list_151e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x151f, pci_vendor_151f, pci_ss_list_151f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1520, pci_vendor_1520, pci_ss_list_1520}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1521, pci_vendor_1521, pci_ss_list_1521}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1522, pci_vendor_1522, pci_ss_list_1522}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1523, pci_vendor_1523, pci_ss_list_1523}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1524, pci_vendor_1524, pci_ss_list_1524}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1525, pci_vendor_1525, pci_ss_list_1525}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1526, pci_vendor_1526, pci_ss_list_1526}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1527, pci_vendor_1527, pci_ss_list_1527}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1528, pci_vendor_1528, pci_ss_list_1528}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1529, pci_vendor_1529, pci_ss_list_1529}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152a, pci_vendor_152a, pci_ss_list_152a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152b, pci_vendor_152b, pci_ss_list_152b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152c, pci_vendor_152c, pci_ss_list_152c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152d, pci_vendor_152d, pci_ss_list_152d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152e, pci_vendor_152e, pci_ss_list_152e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x152f, pci_vendor_152f, pci_ss_list_152f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1530, pci_vendor_1530, pci_ss_list_1530}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1531, pci_vendor_1531, pci_ss_list_1531}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1532, pci_vendor_1532, pci_ss_list_1532}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1533, pci_vendor_1533, pci_ss_list_1533}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1534, pci_vendor_1534, pci_ss_list_1534}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1535, pci_vendor_1535, pci_ss_list_1535}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1537, pci_vendor_1537, pci_ss_list_1537}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1538, pci_vendor_1538, pci_ss_list_1538}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1539, pci_vendor_1539, pci_ss_list_1539}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153a, pci_vendor_153a, pci_ss_list_153a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153b, pci_vendor_153b, pci_ss_list_153b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153c, pci_vendor_153c, pci_ss_list_153c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153d, pci_vendor_153d, pci_ss_list_153d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153e, pci_vendor_153e, pci_ss_list_153e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x153f, pci_vendor_153f, pci_ss_list_153f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1540, pci_vendor_1540, pci_ss_list_1540}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1541, pci_vendor_1541, pci_ss_list_1541}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1542, pci_vendor_1542, pci_ss_list_1542}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1543, pci_vendor_1543, pci_ss_list_1543}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1544, pci_vendor_1544, pci_ss_list_1544}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1545, pci_vendor_1545, pci_ss_list_1545}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1546, pci_vendor_1546, pci_ss_list_1546}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1547, pci_vendor_1547, pci_ss_list_1547}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1548, pci_vendor_1548, pci_ss_list_1548}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1549, pci_vendor_1549, pci_ss_list_1549}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154a, pci_vendor_154a, pci_ss_list_154a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154b, pci_vendor_154b, pci_ss_list_154b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154c, pci_vendor_154c, pci_ss_list_154c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154d, pci_vendor_154d, pci_ss_list_154d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154e, pci_vendor_154e, pci_ss_list_154e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x154f, pci_vendor_154f, pci_ss_list_154f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1550, pci_vendor_1550, pci_ss_list_1550}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1551, pci_vendor_1551, pci_ss_list_1551}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1552, pci_vendor_1552, pci_ss_list_1552}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1553, pci_vendor_1553, pci_ss_list_1553}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1554, pci_vendor_1554, pci_ss_list_1554}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1555, pci_vendor_1555, pci_ss_list_1555}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1556, pci_vendor_1556, pci_ss_list_1556}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1557, pci_vendor_1557, pci_ss_list_1557}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1558, pci_vendor_1558, pci_ss_list_1558}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1559, pci_vendor_1559, pci_ss_list_1559}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155a, pci_vendor_155a, pci_ss_list_155a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155b, pci_vendor_155b, pci_ss_list_155b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155c, pci_vendor_155c, pci_ss_list_155c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155d, pci_vendor_155d, pci_ss_list_155d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155e, pci_vendor_155e, pci_ss_list_155e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x155f, pci_vendor_155f, pci_ss_list_155f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1560, pci_vendor_1560, pci_ss_list_1560}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1561, pci_vendor_1561, pci_ss_list_1561}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1562, pci_vendor_1562, pci_ss_list_1562}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1563, pci_vendor_1563, pci_ss_list_1563}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1564, pci_vendor_1564, pci_ss_list_1564}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1565, pci_vendor_1565, pci_ss_list_1565}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1566, pci_vendor_1566, pci_ss_list_1566}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1567, pci_vendor_1567, pci_ss_list_1567}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1568, pci_vendor_1568, pci_ss_list_1568}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1569, pci_vendor_1569, pci_ss_list_1569}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156a, pci_vendor_156a, pci_ss_list_156a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156b, pci_vendor_156b, pci_ss_list_156b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156c, pci_vendor_156c, pci_ss_list_156c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156d, pci_vendor_156d, pci_ss_list_156d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156e, pci_vendor_156e, pci_ss_list_156e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x156f, pci_vendor_156f, pci_ss_list_156f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1570, pci_vendor_1570, pci_ss_list_1570}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1571, pci_vendor_1571, pci_ss_list_1571}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1572, pci_vendor_1572, pci_ss_list_1572}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1573, pci_vendor_1573, pci_ss_list_1573}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1574, pci_vendor_1574, pci_ss_list_1574}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1575, pci_vendor_1575, pci_ss_list_1575}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1576, pci_vendor_1576, pci_ss_list_1576}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1578, pci_vendor_1578, pci_ss_list_1578}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1579, pci_vendor_1579, pci_ss_list_1579}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157a, pci_vendor_157a, pci_ss_list_157a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157b, pci_vendor_157b, pci_ss_list_157b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157c, pci_vendor_157c, pci_ss_list_157c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157d, pci_vendor_157d, pci_ss_list_157d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157e, pci_vendor_157e, pci_ss_list_157e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x157f, pci_vendor_157f, pci_ss_list_157f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1580, pci_vendor_1580, pci_ss_list_1580}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1581, pci_vendor_1581, pci_ss_list_1581}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1582, pci_vendor_1582, pci_ss_list_1582}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1583, pci_vendor_1583, pci_ss_list_1583}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1584, pci_vendor_1584, pci_ss_list_1584}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1585, pci_vendor_1585, pci_ss_list_1585}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1586, pci_vendor_1586, pci_ss_list_1586}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1587, pci_vendor_1587, pci_ss_list_1587}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1588, pci_vendor_1588, pci_ss_list_1588}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1589, pci_vendor_1589, pci_ss_list_1589}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158a, pci_vendor_158a, pci_ss_list_158a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158b, pci_vendor_158b, pci_ss_list_158b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158c, pci_vendor_158c, pci_ss_list_158c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158d, pci_vendor_158d, pci_ss_list_158d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158e, pci_vendor_158e, pci_ss_list_158e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x158f, pci_vendor_158f, pci_ss_list_158f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1590, pci_vendor_1590, pci_ss_list_1590}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1591, pci_vendor_1591, pci_ss_list_1591}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1592, pci_vendor_1592, pci_ss_list_1592}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1593, pci_vendor_1593, pci_ss_list_1593}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1594, pci_vendor_1594, pci_ss_list_1594}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1595, pci_vendor_1595, pci_ss_list_1595}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1596, pci_vendor_1596, pci_ss_list_1596}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1597, pci_vendor_1597, pci_ss_list_1597}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1598, pci_vendor_1598, pci_ss_list_1598}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1599, pci_vendor_1599, pci_ss_list_1599}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159a, pci_vendor_159a, pci_ss_list_159a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159b, pci_vendor_159b, pci_ss_list_159b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159c, pci_vendor_159c, pci_ss_list_159c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159d, pci_vendor_159d, pci_ss_list_159d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159e, pci_vendor_159e, pci_ss_list_159e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x159f, pci_vendor_159f, pci_ss_list_159f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a0, pci_vendor_15a0, pci_ss_list_15a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a1, pci_vendor_15a1, pci_ss_list_15a1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a2, pci_vendor_15a2, pci_ss_list_15a2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a3, pci_vendor_15a3, pci_ss_list_15a3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a4, pci_vendor_15a4, pci_ss_list_15a4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a5, pci_vendor_15a5, pci_ss_list_15a5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a6, pci_vendor_15a6, pci_ss_list_15a6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a7, pci_vendor_15a7, pci_ss_list_15a7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15a8, pci_vendor_15a8, pci_ss_list_15a8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15aa, pci_vendor_15aa, pci_ss_list_15aa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ab, pci_vendor_15ab, pci_ss_list_15ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ac, pci_vendor_15ac, pci_ss_list_15ac}, +#endif + {0x15ad, pci_vendor_15ad, pci_ss_list_15ad}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ae, pci_vendor_15ae, pci_ss_list_15ae}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b0, pci_vendor_15b0, pci_ss_list_15b0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b1, pci_vendor_15b1, pci_ss_list_15b1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b2, pci_vendor_15b2, pci_ss_list_15b2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b3, pci_vendor_15b3, pci_ss_list_15b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b4, pci_vendor_15b4, pci_ss_list_15b4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b5, pci_vendor_15b5, pci_ss_list_15b5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b6, pci_vendor_15b6, pci_ss_list_15b6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b7, pci_vendor_15b7, pci_ss_list_15b7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b8, pci_vendor_15b8, pci_ss_list_15b8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15b9, pci_vendor_15b9, pci_ss_list_15b9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ba, pci_vendor_15ba, pci_ss_list_15ba}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bb, pci_vendor_15bb, pci_ss_list_15bb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bc, pci_vendor_15bc, pci_ss_list_15bc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bd, pci_vendor_15bd, pci_ss_list_15bd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15be, pci_vendor_15be, pci_ss_list_15be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15bf, pci_vendor_15bf, pci_ss_list_15bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c0, pci_vendor_15c0, pci_ss_list_15c0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c1, pci_vendor_15c1, pci_ss_list_15c1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c2, pci_vendor_15c2, pci_ss_list_15c2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c3, pci_vendor_15c3, pci_ss_list_15c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c4, pci_vendor_15c4, pci_ss_list_15c4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c5, pci_vendor_15c5, pci_ss_list_15c5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c6, pci_vendor_15c6, pci_ss_list_15c6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c7, pci_vendor_15c7, pci_ss_list_15c7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c8, pci_vendor_15c8, pci_ss_list_15c8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15c9, pci_vendor_15c9, pci_ss_list_15c9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ca, pci_vendor_15ca, pci_ss_list_15ca}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cb, pci_vendor_15cb, pci_ss_list_15cb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cc, pci_vendor_15cc, pci_ss_list_15cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cd, pci_vendor_15cd, pci_ss_list_15cd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ce, pci_vendor_15ce, pci_ss_list_15ce}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15cf, pci_vendor_15cf, pci_ss_list_15cf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d1, pci_vendor_15d1, pci_ss_list_15d1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d2, pci_vendor_15d2, pci_ss_list_15d2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d3, pci_vendor_15d3, pci_ss_list_15d3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d4, pci_vendor_15d4, pci_ss_list_15d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d5, pci_vendor_15d5, pci_ss_list_15d5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d6, pci_vendor_15d6, pci_ss_list_15d6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d7, pci_vendor_15d7, pci_ss_list_15d7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d8, pci_vendor_15d8, pci_ss_list_15d8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15d9, pci_vendor_15d9, pci_ss_list_15d9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15da, pci_vendor_15da, pci_ss_list_15da}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15db, pci_vendor_15db, pci_ss_list_15db}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15dc, pci_vendor_15dc, pci_ss_list_15dc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15dd, pci_vendor_15dd, pci_ss_list_15dd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15de, pci_vendor_15de, pci_ss_list_15de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15df, pci_vendor_15df, pci_ss_list_15df}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e0, pci_vendor_15e0, pci_ss_list_15e0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e1, pci_vendor_15e1, pci_ss_list_15e1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e2, pci_vendor_15e2, pci_ss_list_15e2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e3, pci_vendor_15e3, pci_ss_list_15e3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e4, pci_vendor_15e4, pci_ss_list_15e4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e5, pci_vendor_15e5, pci_ss_list_15e5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e6, pci_vendor_15e6, pci_ss_list_15e6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e7, pci_vendor_15e7, pci_ss_list_15e7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e8, pci_vendor_15e8, pci_ss_list_15e8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15e9, pci_vendor_15e9, pci_ss_list_15e9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ea, pci_vendor_15ea, pci_ss_list_15ea}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15eb, pci_vendor_15eb, pci_ss_list_15eb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ec, pci_vendor_15ec, pci_ss_list_15ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ed, pci_vendor_15ed, pci_ss_list_15ed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ee, pci_vendor_15ee, pci_ss_list_15ee}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ef, pci_vendor_15ef, pci_ss_list_15ef}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f0, pci_vendor_15f0, pci_ss_list_15f0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f1, pci_vendor_15f1, pci_ss_list_15f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f2, pci_vendor_15f2, pci_ss_list_15f2}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f3, pci_vendor_15f3, pci_ss_list_15f3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f4, pci_vendor_15f4, pci_ss_list_15f4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f5, pci_vendor_15f5, pci_ss_list_15f5}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f6, pci_vendor_15f6, pci_ss_list_15f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f7, pci_vendor_15f7, pci_ss_list_15f7}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f8, pci_vendor_15f8, pci_ss_list_15f8}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15f9, pci_vendor_15f9, pci_ss_list_15f9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fa, pci_vendor_15fa, pci_ss_list_15fa}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fb, pci_vendor_15fb, pci_ss_list_15fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fc, pci_vendor_15fc, pci_ss_list_15fc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fd, pci_vendor_15fd, pci_ss_list_15fd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15fe, pci_vendor_15fe, pci_ss_list_15fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x15ff, pci_vendor_15ff, pci_ss_list_15ff}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1600, pci_vendor_1600, pci_ss_list_1600}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1601, pci_vendor_1601, pci_ss_list_1601}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1602, pci_vendor_1602, pci_ss_list_1602}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1603, pci_vendor_1603, pci_ss_list_1603}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1604, pci_vendor_1604, pci_ss_list_1604}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1605, pci_vendor_1605, pci_ss_list_1605}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1606, pci_vendor_1606, pci_ss_list_1606}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1607, pci_vendor_1607, pci_ss_list_1607}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1608, pci_vendor_1608, pci_ss_list_1608}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1609, pci_vendor_1609, pci_ss_list_1609}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1612, pci_vendor_1612, pci_ss_list_1612}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1619, pci_vendor_1619, pci_ss_list_1619}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1629, pci_vendor_1629, pci_ss_list_1629}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1638, pci_vendor_1638, pci_ss_list_1638}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x163c, pci_vendor_163c, pci_ss_list_163c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1657, pci_vendor_1657, pci_ss_list_1657}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x165a, pci_vendor_165a, pci_ss_list_165a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x165d, pci_vendor_165d, pci_ss_list_165d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1661, pci_vendor_1661, pci_ss_list_1661}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1668, pci_vendor_1668, pci_ss_list_1668}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1681, pci_vendor_1681, pci_ss_list_1681}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16ab, pci_vendor_16ab, pci_ss_list_16ab}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16be, pci_vendor_16be, pci_ss_list_16be}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16ec, pci_vendor_16ec, pci_ss_list_16ec}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x16f6, pci_vendor_16f6, pci_ss_list_16f6}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1705, pci_vendor_1705, pci_ss_list_1705}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x170b, pci_vendor_170b, pci_ss_list_170b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x170c, pci_vendor_170c, pci_ss_list_170c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x172a, pci_vendor_172a, pci_ss_list_172a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1737, pci_vendor_1737, pci_ss_list_1737}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x173b, pci_vendor_173b, pci_ss_list_173b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1743, pci_vendor_1743, pci_ss_list_1743}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x174b, pci_vendor_174b, pci_ss_list_174b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x175e, pci_vendor_175e, pci_ss_list_175e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1787, pci_vendor_1787, pci_ss_list_1787}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1796, pci_vendor_1796, pci_ss_list_1796}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1799, pci_vendor_1799, pci_ss_list_1799}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x17af, pci_vendor_17af, pci_ss_list_17af}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x17cc, pci_vendor_17cc, pci_ss_list_17cc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1813, pci_vendor_1813, pci_ss_list_1813}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1851, pci_vendor_1851, pci_ss_list_1851}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1852, pci_vendor_1852, pci_ss_list_1852}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1888, pci_vendor_1888, pci_ss_list_1888}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1a08, pci_vendor_1a08, pci_ss_list_1a08}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1b13, pci_vendor_1b13, pci_ss_list_1b13}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1c1c, pci_vendor_1c1c, pci_ss_list_1c1c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1d44, pci_vendor_1d44, pci_ss_list_1d44}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x1de1, pci_vendor_1de1, pci_ss_list_1de1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2000, pci_vendor_2000, pci_ss_list_2000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2001, pci_vendor_2001, pci_ss_list_2001}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2003, pci_vendor_2003, pci_ss_list_2003}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2004, pci_vendor_2004, pci_ss_list_2004}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x21c3, pci_vendor_21c3, pci_ss_list_21c3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2348, pci_vendor_2348, pci_ss_list_2348}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2646, pci_vendor_2646, pci_ss_list_2646}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x270b, pci_vendor_270b, pci_ss_list_270b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x270f, pci_vendor_270f, pci_ss_list_270f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2711, pci_vendor_2711, pci_ss_list_2711}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x2a15, pci_vendor_2a15, pci_ss_list_2a15}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3000, pci_vendor_3000, pci_ss_list_3000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3142, pci_vendor_3142, pci_ss_list_3142}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3388, pci_vendor_3388, pci_ss_list_3388}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3411, pci_vendor_3411, pci_ss_list_3411}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x3513, pci_vendor_3513, pci_ss_list_3513}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x38ef, pci_vendor_38ef, pci_ss_list_38ef}, +#endif + {0x3d3d, pci_vendor_3d3d, pci_ss_list_3d3d}, + {0x4005, pci_vendor_4005, pci_ss_list_4005}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4033, pci_vendor_4033, pci_ss_list_4033}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4143, pci_vendor_4143, pci_ss_list_4143}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x416c, pci_vendor_416c, pci_ss_list_416c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4444, pci_vendor_4444, pci_ss_list_4444}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4468, pci_vendor_4468, pci_ss_list_4468}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4594, pci_vendor_4594, pci_ss_list_4594}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x45fb, pci_vendor_45fb, pci_ss_list_45fb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4680, pci_vendor_4680, pci_ss_list_4680}, +#endif + {0x4843, pci_vendor_4843, pci_ss_list_4843}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4916, pci_vendor_4916, pci_ss_list_4916}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4943, pci_vendor_4943, pci_ss_list_4943}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4978, pci_vendor_4978, pci_ss_list_4978}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4a14, pci_vendor_4a14, pci_ss_list_4a14}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4b10, pci_vendor_4b10, pci_ss_list_4b10}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4c48, pci_vendor_4c48, pci_ss_list_4c48}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4c53, pci_vendor_4c53, pci_ss_list_4c53}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4ca1, pci_vendor_4ca1, pci_ss_list_4ca1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4d51, pci_vendor_4d51, pci_ss_list_4d51}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4d54, pci_vendor_4d54, pci_ss_list_4d54}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x4ddc, pci_vendor_4ddc, pci_ss_list_4ddc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5046, pci_vendor_5046, pci_ss_list_5046}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5053, pci_vendor_5053, pci_ss_list_5053}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5136, pci_vendor_5136, pci_ss_list_5136}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5143, pci_vendor_5143, pci_ss_list_5143}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5145, pci_vendor_5145, pci_ss_list_5145}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5168, pci_vendor_5168, pci_ss_list_5168}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5301, pci_vendor_5301, pci_ss_list_5301}, +#endif + {0x5333, pci_vendor_5333, pci_ss_list_5333}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x544c, pci_vendor_544c, pci_ss_list_544c}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5455, pci_vendor_5455, pci_ss_list_5455}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5519, pci_vendor_5519, pci_ss_list_5519}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5544, pci_vendor_5544, pci_ss_list_5544}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5555, pci_vendor_5555, pci_ss_list_5555}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5654, pci_vendor_5654, pci_ss_list_5654}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x5700, pci_vendor_5700, pci_ss_list_5700}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6356, pci_vendor_6356, pci_ss_list_6356}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6374, pci_vendor_6374, pci_ss_list_6374}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6409, pci_vendor_6409, pci_ss_list_6409}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x6666, pci_vendor_6666, pci_ss_list_6666}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x7604, pci_vendor_7604, pci_ss_list_7604}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x7bde, pci_vendor_7bde, pci_ss_list_7bde}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x7fed, pci_vendor_7fed, pci_ss_list_7fed}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8008, pci_vendor_8008, pci_ss_list_8008}, +#endif + {0x8086, pci_vendor_8086, pci_ss_list_8086}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8800, pci_vendor_8800, pci_ss_list_8800}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8866, pci_vendor_8866, pci_ss_list_8866}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8888, pci_vendor_8888, pci_ss_list_8888}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8e0e, pci_vendor_8e0e, pci_ss_list_8e0e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x8e2e, pci_vendor_8e2e, pci_ss_list_8e2e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9004, pci_vendor_9004, pci_ss_list_9004}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9005, pci_vendor_9005, pci_ss_list_9005}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x907f, pci_vendor_907f, pci_ss_list_907f}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x919a, pci_vendor_919a, pci_ss_list_919a}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9412, pci_vendor_9412, pci_ss_list_9412}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9699, pci_vendor_9699, pci_ss_list_9699}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0x9710, pci_vendor_9710, pci_ss_list_9710}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa0a0, pci_vendor_a0a0, pci_ss_list_a0a0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa0f1, pci_vendor_a0f1, pci_ss_list_a0f1}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa200, pci_vendor_a200, pci_ss_list_a200}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa259, pci_vendor_a259, pci_ss_list_a259}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa25b, pci_vendor_a25b, pci_ss_list_a25b}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa304, pci_vendor_a304, pci_ss_list_a304}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xa727, pci_vendor_a727, pci_ss_list_a727}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xaa42, pci_vendor_aa42, pci_ss_list_aa42}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xac1e, pci_vendor_ac1e, pci_ss_list_ac1e}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xb1b3, pci_vendor_b1b3, pci_ss_list_b1b3}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xbd11, pci_vendor_bd11, pci_ss_list_bd11}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc001, pci_vendor_c001, pci_ss_list_c001}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc0a9, pci_vendor_c0a9, pci_ss_list_c0a9}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc0de, pci_vendor_c0de, pci_ss_list_c0de}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xc0fe, pci_vendor_c0fe, pci_ss_list_c0fe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xca50, pci_vendor_ca50, pci_ss_list_ca50}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xcafe, pci_vendor_cafe, pci_ss_list_cafe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xcccc, pci_vendor_cccc, pci_ss_list_cccc}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xcddd, pci_vendor_cddd, pci_ss_list_cddd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xd4d4, pci_vendor_d4d4, pci_ss_list_d4d4}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xd531, pci_vendor_d531, pci_ss_list_d531}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xd84d, pci_vendor_d84d, pci_ss_list_d84d}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xdead, pci_vendor_dead, pci_ss_list_dead}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xe000, pci_vendor_e000, pci_ss_list_e000}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xe159, pci_vendor_e159, pci_ss_list_e159}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xe4bf, pci_vendor_e4bf, pci_ss_list_e4bf}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xea01, pci_vendor_ea01, pci_ss_list_ea01}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xea60, pci_vendor_ea60, pci_ss_list_ea60}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xeabb, pci_vendor_eabb, pci_ss_list_eabb}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xeace, pci_vendor_eace, pci_ss_list_eace}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xec80, pci_vendor_ec80, pci_ss_list_ec80}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xecc0, pci_vendor_ecc0, pci_ss_list_ecc0}, +#endif + {0xedd8, pci_vendor_edd8, pci_ss_list_edd8}, +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xf1d0, pci_vendor_f1d0, pci_ss_list_f1d0}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfa57, pci_vendor_fa57, pci_ss_list_fa57}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfebd, pci_vendor_febd, pci_ss_list_febd}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfeda, pci_vendor_feda, pci_ss_list_feda}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xfffe, pci_vendor_fffe, pci_ss_list_fffe}, +#endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {0xffff, pci_vendor_ffff, pci_ss_list_ffff}, +#endif + {0x0000, NULL, NULL} +}; +#endif Index: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStr.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStr.h:1.1 --- /dev/null Thu Feb 27 12:33:05 2003 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStr.h Mon Jul 15 16:46:04 2002 @@ -0,0 +1,41 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStr.h,v 1.1 2002/07/15 20:46:04 dawes Exp $ */ + +/* + * Copyright © 2002 by The XFree86 Project, Inc + */ + +/* + * Structs used to hold the pre-parsed pci.ids data. These are private + * to the scanpci and pcidata modules. + */ + +#ifndef _XF86_PCISTR_H +#define _XF86_PCISTR_H + +typedef struct { + unsigned short VendorID; + unsigned short SubsystemID; + const char *SubsystemName; + unsigned short class; +} pciSubsystemInfo; + +typedef struct { + unsigned short DeviceID; + const char *DeviceName; + const pciSubsystemInfo **Subsystem; + unsigned short class; +} pciDeviceInfo; + +typedef struct { + unsigned short VendorID; + const char *VendorName; + const pciDeviceInfo **Device; +} pciVendorInfo; + +typedef struct { + unsigned short VendorID; + const char *VendorName; + const pciSubsystemInfo **Subsystem; +} pciVendorSubsysInfo; + +#endif /* _XF86_PCISTR_H */ Index: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c diff -u xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c:1.11 xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c:1.12 --- xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c:1.11 Wed Apr 5 14:13:58 2000 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c Mon Jul 15 16:46:04 2002 @@ -1,14 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c,v 1.11 2000/04/05 18:13:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c,v 1.12 2002/07/15 20:46:04 dawes Exp $ */ /* * Display the Subsystem Vendor Id and Subsystem Id in order to identify * the cards installed in this computer * - * Copyright 1995-2000 by The XFree86 Project, Inc. + * Copyright 1995-2002 by The XFree86 Project, Inc. * * A lot of this comes from Robin Cutshaw's scanpci * */ + +/* + * This file is used to build both the scanpci and pcidata modules. + * The interfaces have changed compared with XFree86 4.2.0 and earlier. + * The data is no longer exported directly. Lookup functions are provided. + * This means that the data format can change in the future without affecting + * the exported interfaces. + * + * The namespaces for pcidata and scanpci clash, so both modules can't be + * loaded at the same time. The X server should only load the scanpci module + * when run with the '-scanpci' flag. The main difference between the + * two modules is size. pcidata only holds the subset of data that is + * "interesting" to the X server. "Interesting" is determined by the + * PCI_VENDOR_* defines in ../common/xf86PciInfo.h. + */ + + /* XXX This is including a lot of stuff that modules should not include! */ #include "X.h" @@ -24,13 +41,15 @@ #else #include <xf86_ansic.h> #endif + +#ifndef PCIDATA +#define VENDOR_INCLUDE_NONVIDEO +#endif +#define INIT_SUBSYS_INFO +#define INIT_VENDOR_SUBSYS_INFO -#define INIT_PCI_CARD_INFO TRUE -#define DECLARE_CARD_DATASTRUCTURES TRUE -#define INIT_PCI_VENDOR_INFO TRUE -#define INIT_PCI_VENDOR_NAME_INFO TRUE -#define VENDOR_INCLUDE_NONVIDEO TRUE -#include "xf86PciInfo.h" +#include "xf86PciStr.h" +#include "xf86PciIds.h" #include "xf86ScanPci.h" /* @@ -47,13 +66,32 @@ #include "xf86Module.h" +#ifdef PCIDATA + +static XF86ModuleVersionInfo pciDataVersRec = { + "pcidata", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + NULL, + {0, 0, 0, 0} +}; + +XF86ModuleData pcidataModuleData = { &pciDataVersRec, NULL, NULL }; + +#else + static XF86ModuleVersionInfo scanPciVersRec = { "scanpci", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XF86_VERSION_CURRENT, - 0, 1, 0, + 1, 0, 0, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, NULL, @@ -62,179 +100,173 @@ XF86ModuleData scanpciModuleData = { &scanPciVersRec, NULL, NULL }; -#else +#endif /* PCIDATA */ #endif /* XFree86LOADER */ -void -xf86SetupScanPci(SymTabPtr *NameInfo, - pciVendorDeviceInfo **DeviceInfo, - pciVendorCardInfo **CardInfo) +/* Initialisation/Close hooks, in case they're ever needed. */ +Bool +ScanPciSetupPciIds(void) { - *CardInfo = xf86PCICardInfoData; - *DeviceInfo = xf86PCIVendorInfoData; - *NameInfo = xf86PCIVendorNameInfoData; + return TRUE; } - void -xf86DisplayPCICardInfo(int verbosity) +ScanPciClosePciIds(void) { - pciConfigPtr pcrp, *pcrpp; - int i = 0, j, k; - - xf86EnableIO(); - pcrpp = xf86scanpci(0); - - if (pcrpp == NULL) { - xf86MsgVerb(X_NONE,0,"No PCI info available\n"); - return; - } - xf86MsgVerb(X_NONE,0,"Probing for PCI devices (Bus:Device:Function)\n\n"); - while ((pcrp = pcrpp[i])) { - char *vendorname = NULL, *cardname = NULL; - char *chipvendorname = NULL, *chipname = NULL; - Bool noCard = FALSE; + return; +} - xf86MsgVerb(X_NONE,-verbosity, - "(%d:%d:%d) ", pcrp->busnum, pcrp->devnum, - pcrp->funcnum); +/* + * The return value is the number of strings found, or -1 for an error. + * Requested strings that aren't found are set to NULL. + */ - /* first let's look for the card itself, but only if information - * is available - */ - if ( pcrp->pci_subsys_vendor || pcrp->pci_subsys_card ) { - k = 0; - while (xf86PCIVendorNameInfoData[k].token) { - if (xf86PCIVendorNameInfoData[k].token == pcrp->pci_subsys_vendor) - vendorname = (char*)xf86PCIVendorNameInfoData[k].name; - k++; - } - k = 0; j = -1; - while(xf86PCICardInfoData[k].VendorID) { - if (xf86PCICardInfoData[k].VendorID == pcrp->pci_subsys_vendor) { - j = 0; - while (xf86PCICardInfoData[k].Device[j].CardName) { - if (xf86PCICardInfoData[k].Device[j].SubsystemID == - pcrp->pci_subsys_card) { - cardname = - xf86PCICardInfoData[k].Device[j].CardName; +int +ScanPciFindPciNamesByDevice(unsigned short vendor, unsigned short device, + unsigned short svendor, unsigned short subsys, + const char **vname, const char **dname, + const char **svname, const char **sname) +{ + int i, j, k; + const pciDeviceInfo **pDev; + const pciSubsystemInfo **pSub; + + /* It's an error to not provide the Vendor */ + if (vendor == NOVENDOR) + return -1; + + /* Initialise returns requested/provided to NULL */ + if (vname) + *vname = NULL; + if (device != NODEVICE && dname) + *dname = NULL; + if (svendor != NOVENDOR && svname) + *svname = NULL; + if (subsys != NOSUBSYS && sname) + *sname = NULL; + + for (i = 0; pciVendorInfoList[i].VendorName; i++) { + if (vendor == pciVendorInfoList[i].VendorID) { + if (vname) { + *vname = pciVendorInfoList[i].VendorName; + } + if (device == NODEVICE) { + return 1; + } + pDev = pciVendorInfoList[i].Device; + if (!pDev) { + return 1; + } + for (j = 0; pDev[j]; j++) { + if (device == pDev[j]->DeviceID) { + if (dname) { + *dname = pDev[j]->DeviceName; + } + if (svendor == NOVENDOR) { + return 2; + } + for (k = 0; pciVendorInfoList[k].VendorName; k++) { + if (svendor == pciVendorInfoList[k].VendorID) { + if (svname) { + *svname = pciVendorInfoList[k].VendorName; + } + if (subsys == NOSUBSYS) { + return 3; + } break; } - j++; + } + if (!pciVendorInfoList[k].VendorName) { + return 2; + } + pSub = pDev[j]->Subsystem; + if (!pSub) { + return 3; } - break; + for (k = 0; pSub[k]; k++) { + if (svendor == pSub[k]->VendorID && + subsys == pSub[k]->SubsystemID) { + if (sname) + *sname = pSub[k]->SubsystemName; + return 4; + } + } + /* No vendor/subsys match */ + return 3; } - k++; - } - if (vendorname) - xf86MsgVerb(X_NONE,-verbosity,"%s ", vendorname); - if (cardname) - xf86MsgVerb(X_NONE,-verbosity,"%s ", cardname); - if (vendorname && !cardname) { - if (pcrp->pci_subsys_card && (j >= 0)) - xf86MsgVerb(X_NONE,-verbosity,"unknown card (0x%04x) ", - pcrp->pci_subsys_card); - else - xf86MsgVerb(X_NONE,-verbosity,"card ", - pcrp->pci_subsys_card); } + /* No device match */ + return 1; } - if (!(cardname || vendorname)) { - /* - * we didn't find text representation of the information - * about the card - */ - if ( pcrp->pci_subsys_vendor || pcrp->pci_subsys_card ) { - /* - * if there was information and we just couldn't interpret - * it, print it out as unknown, anyway - */ - xf86MsgVerb(X_NONE,-verbosity, - "unknown card (0x%04x/0x%04x) ", - pcrp->pci_subsys_vendor, pcrp->pci_subsys_card); + } + /* No vendor match */ + return 0; +} + +Bool +ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys, + const char **svname, const char **sname) +{ + int i, j; + const pciSubsystemInfo **pSub; + + /* It's an error to not provide the Vendor */ + if (svendor == NOVENDOR) + return -1; + + /* Initialise returns requested/provided to NULL */ + if (svname) + *svname = NULL; + if (subsys != NOSUBSYS && sname) + *sname = NULL; + + for (i = 0; pciVendorSubsysInfoList[i].VendorName; i++) { + if (svendor == pciVendorSubsysInfoList[i].VendorID) { + if (svname) { + *svname = pciVendorSubsysInfoList[i].VendorName; } - else { - /* - * if there was no info to begin with, only print in - * verbose mode - */ - if (verbosity > 1) - xf86MsgVerb(X_NONE,-verbosity, - "unknown card (0x%04x/0x%04x) ", - pcrp->pci_subsys_vendor, pcrp->pci_subsys_card); - else - noCard = TRUE; + if (subsys == NOSUBSYS) { + return 1; } - } - /* now check for the chipset used */ - k = 0; - while (xf86PCIVendorNameInfoData[k].token) { - if (xf86PCIVendorNameInfoData[k].token == pcrp->pci_vendor) - chipvendorname = (char *)xf86PCIVendorNameInfoData[k].name; - k++; - } - k = 0; - while(xf86PCIVendorInfoData[k].VendorID) { - if (xf86PCIVendorInfoData[k].VendorID == pcrp->pci_vendor) { - j = 0; - while (xf86PCIVendorInfoData[k].Device[j].DeviceName) { - if (xf86PCIVendorInfoData[k].Device[j].DeviceID == - pcrp->pci_device) { - chipname = - xf86PCIVendorInfoData[k].Device[j].DeviceName; - break; + pSub = pciVendorSubsysInfoList[i].Subsystem; + if (!pSub) { + return 1; + } + for (j = 0; pSub[j]; j++) { + if (subsys == pSub[j]->SubsystemID) { + if (sname) { + *sname = pSub[j]->SubsystemName; } - j++; } - break; } - k++; + /* No subsys match */ + return 1; } - if (noCard) { - if (chipvendorname && chipname) - xf86MsgVerb(X_NONE,-verbosity,"%s %s", - chipvendorname,chipname); - else if (chipvendorname) - xf86MsgVerb(X_NONE,-verbosity, - "unknown chip (DeviceId 0x%04x) from %s", - pcrp->pci_device,chipvendorname); - else - xf86MsgVerb(X_NONE,-verbosity, - "unknown chipset(0x%04x/0x%04x)", - pcrp->pci_vendor,pcrp->pci_device); - xf86MsgVerb(X_NONE,-verbosity,"\n"); - } - else - { - if (chipvendorname && chipname) - xf86MsgVerb(X_NONE,-verbosity,"using a %s %s", - chipvendorname,chipname); - else if (chipvendorname) - xf86MsgVerb(X_NONE,-verbosity, - "using an unknown chip (DeviceId 0x%04x) from %s", - pcrp->pci_device,chipvendorname); - else - xf86MsgVerb(X_NONE,-verbosity, - "using an unknown chipset(0x%04x/0x%04x)", - pcrp->pci_vendor,pcrp->pci_device); - xf86MsgVerb(X_NONE,-verbosity,"\n"); - } - i++; } + /* No vendor match */ + return 0; } CARD32 -xf86FindPCIClassInCardList(unsigned short vendorID, unsigned short subsystemID) +ScanPciFindPciClassBySubsys(unsigned short vendor, unsigned short subsys) { - pciVendorCardInfo *cardInfo = xf86PCICardInfoData; - int i,j; - - for(i = 0; cardInfo[i].VendorID != 0;i++) { - if (cardInfo[i].VendorID == vendorID) { - for (j = 0; cardInfo[i].Device[j].SubsystemID != 0; j++) { - if (cardInfo[i].Device[j].SubsystemID == subsystemID) - return cardInfo[i].Device[j].class; + int i, j; + const pciSubsystemInfo **pSub; + + if (vendor == NOVENDOR || subsys == NOSUBSYS) + return 0; + + for (i = 0; pciVendorSubsysInfoList[i].VendorName; i++) { + if (vendor == pciVendorSubsysInfoList[i].VendorID) { + pSub = pciVendorSubsysInfoList[i].Subsystem; + if (!pSub) { + return 0; + } + for (j = 0; pSub[j]; j++) { + if (subsys == pSub[j]->SubsystemID) { + return pSub[j]->class; + } } break; } @@ -243,20 +275,115 @@ } CARD32 -xf86FindPCIClassInDeviceList(unsigned short vendorID, unsigned short deviceID) +ScanPciFindPciClassByDevice(unsigned short vendor, unsigned short device) { - pciVendorDeviceInfo *vendorInfo = xf86PCIVendorInfoData; - int i,j; + int i, j; + const pciDeviceInfo **pDev; - for(i = 0; vendorInfo[i].VendorID != 0;i++) { - if (vendorInfo[i].VendorID == vendorID) { - for (j = 0; vendorInfo[i].Device[j].DeviceID != 0; j++) { - if (vendorInfo[i].Device[j].DeviceID == deviceID) - return vendorInfo[i].Device[j].class; + if (vendor == NOVENDOR || device == NODEVICE) + return 0; + + for (i = 0; pciVendorInfoList[i].VendorName; i++) { + if (vendor == pciVendorInfoList[i].VendorID) { + pDev = pciVendorInfoList[i].Device; + if (!pDev) { + return 0; + } + for (j = 0; pDev[j]; j++) { + if (device == pDev[j]->DeviceID) { + return pDev[j]->class; + } } break; } } return 0; } + +#ifndef PCIDATA +void +ScanPciDisplayPCICardInfo(int verbosity) +{ + pciConfigPtr pcrp, *pcrpp; + int i; + + xf86EnableIO(); + pcrpp = xf86scanpci(0); + + if (pcrpp == NULL) { + xf86MsgVerb(X_NONE,0,"No PCI info available\n"); + return; + } + xf86MsgVerb(X_NONE,0,"Probing for PCI devices (Bus:Device:Function)\n\n"); + for (i = 0; (pcrp = pcrpp[i]); i++) { + const char *svendorname = NULL, *subsysname = NULL; + const char *vendorname = NULL, *devicename = NULL; + Bool noCard = FALSE; + const char *prefix1 = "", *prefix2 = ""; + + xf86MsgVerb(X_NONE, -verbosity, "(%d:%d:%d) ", + pcrp->busnum, pcrp->devnum, pcrp->funcnum); + + /* + * Lookup as much as we can about the device. + */ + if (pcrp->pci_subsys_vendor || pcrp->pci_subsys_card) { + ScanPciFindPciNamesByDevice(pcrp->pci_vendor, pcrp->pci_device, + NOVENDOR, NOSUBSYS, + &vendorname, &devicename, NULL, NULL); + } else { + ScanPciFindPciNamesByDevice(pcrp->pci_vendor, pcrp->pci_device, + pcrp->pci_subsys_vendor, + pcrp->pci_subsys_card, + &vendorname, &devicename, + &svendorname, &subsysname); + } + + if (svendorname) + xf86MsgVerb(X_NONE, -verbosity, "%s ", svendorname); + if (subsysname) + xf86MsgVerb(X_NONE, -verbosity, "%s ", subsysname); + if (svendorname && !subsysname) { + if (pcrp->pci_subsys_card && pcrp->pci_subsys_card != NOSUBSYS) { + xf86MsgVerb(X_NONE, -verbosity, "unknown card (0x%04x) ", + pcrp->pci_subsys_card); + } else { + xf86MsgVerb(X_NONE, -verbosity, "card "); + } + } + if (!svendorname && !subsysname) { + /* + * We didn't find a text representation of the information + * about the card. + */ + if (pcrp->pci_subsys_vendor || pcrp->pci_subsys_card) { + /* + * If there was information and we just couldn't interpret + * it, print it out as unknown, anyway. + */ + xf86MsgVerb(X_NONE, -verbosity, + "unknown card (0x%04x/0x%04x) ", + pcrp->pci_subsys_vendor, pcrp->pci_subsys_card); + } else + noCard = TRUE; + } + if (!noCard) { + prefix1 = "using a "; + prefix2 = "using an "; + } + if (vendorname && devicename) { + xf86MsgVerb(X_NONE, -verbosity,"%s%s %s\n", prefix1, vendorname, + devicename); + } else if (vendorname) { + xf86MsgVerb(X_NONE, -verbosity, + "%sunknown chip (DeviceId 0x%04x) from %s\n", + prefix2, pcrp->pci_device, vendorname); + } else { + xf86MsgVerb(X_NONE, -verbosity, + "%sunknown chipset(0x%04x/0x%04x)\n", + prefix2, pcrp->pci_vendor, pcrp->pci_device); + } + } +} +#endif Index: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h diff -u xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h:1.1 xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h:1.2 --- xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h:1.1 Tue Feb 8 08:13:33 2000 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h Mon Jul 15 16:46:04 2002 @@ -1,21 +1,21 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h,v 1.1 2000/02/08 13:13:33 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h,v 1.2 2002/07/15 20:46:04 dawes Exp $ */ + + #ifndef SCANPCI_H_ #define SCANPCI_H_ + +#include "xf86PciData.h" + +typedef void (*ScanPciDisplayCardInfoProcPtr)(int verbosity); + +/* + * Whoever loads this module needs to define these and initialise them + * after loading. + */ + +extern ScanPciDisplayCardInfoProcPtr xf86DisplayPCICardInfo; -#ifndef DECLARE_CARD_DATASTRUCTURES -#define DECLARE_CARD_DATASTRUCTURES -#endif -#include "xf86PciInfo.h" - -void -xf86SetupScanPci(SymTabPtr *NameInfo, - pciVendorDeviceInfo **DeviceInfo, - pciVendorCardInfo **CardInfo); -void xf86DisplayPCICardInfo(int); -CARD32 xf86FindPCIClassInCardList( - unsigned short vendorID, unsigned short subsystemID); -CARD32 xf86FindPCIClassInDeviceList( - unsigned short vendorID, unsigned short deviceID); +void ScanPciDisplayPCICardInfo(int verbosity); #endif Index: xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile diff -u xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile:1.1 Thu Apr 6 11:35:05 2000 +++ xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile Mon Jul 15 16:46:04 2002 @@ -1,23 +1,25 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile,v 1.1 2000/04/06 15:35:05 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/module/Imakefile,v 1.2 2002/07/15 20:46:04 dawes Exp $ #define IHaveModules #include <Server.tmpl> MODPATHDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" - INCLUDES = -I$(XF86SRC)/common -I$(XF86OSSRC) -I$(XF86OSSRC)/bus \ + INCLUDES = -I.. -I$(XF86SRC)/common -I$(XF86OSSRC) -I$(XF86OSSRC)/bus \ -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xi \ -I$(FONTLIBSRC)/include -I$(XF86PARSERSRC) \ - -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac -I.. + -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac SRCS = xf86ScanPci.c xf86PciData.c LinkSourceFile(xf86ScanPci.c,..) -LinkSourceFile(xf86PciData.c,..) +LinkFile(xf86PciData.c,../xf86ScanPci.c) ModuleObjectRule() + +SpecialCObjectRule(xf86PciData,NullParameter,-DPCIDATA) LibraryModuleTarget(scanpci,xf86ScanPci.o) Index: xc/programs/Xserver/hw/xfree86/sdk/Imakefile diff -u xc/programs/Xserver/hw/xfree86/sdk/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/sdk/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/sdk/Imakefile:1.1 Sat Aug 14 06:50:08 1999 +++ xc/programs/Xserver/hw/xfree86/sdk/Imakefile Thu Nov 14 16:01:20 2002 @@ -1,4 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/sdk/Imakefile,v 1.1 1999/08/14 10:50:08 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/sdk/Imakefile,v 1.2 2002/11/14 21:01:20 tsi Exp $ + +#include <lnxdoc.rules> CppScriptTarget(mkmf,mkmf.cpp,-DCONFIGDIRSPEC=-I$(CONFIGDIR),$(ICONFIGFILES)) Index: xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile diff -u xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile:1.3 Sat Aug 14 06:50:09 1999 +++ xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile Wed Oct 16 18:12:54 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile,v 1.3 1999/08/14 10:50:09 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/shadowfb/Imakefile,v 1.4 2002/10/16 22:12:54 alanh Exp $ #define IHaveModules #include <Server.tmpl> @@ -15,7 +15,8 @@ OBJS = shadow.o $(XFMODOBJ) INCLUDES = -I. -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ - -I$(XF86OSSRC) -I$(XF86COMSRC) -I$(XINCLUDESRC) -I$(FONTINCSRC) + -I$(XF86OSSRC) -I$(XF86COMSRC) -I$(XINCLUDESRC) -I$(FONTINCSRC) \ + -I../../../render -I$(EXTINCSRC) ModuleObjectRule() Index: xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c diff -u xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c:1.10 xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c:1.18 --- xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c:1.10 Tue Feb 8 08:13:33 2000 +++ xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c Fri Feb 21 10:06:19 2003 @@ -2,9 +2,11 @@ Copyright (C) 1999. The XFree86 Project Inc. Written by Mark Vojkovich (mvojkovi@ucsd.edu) + + Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com) */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c,v 1.10 2000/02/08 13:13:33 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/shadowfb/shadow.c,v 1.18 2003/02/21 15:06:19 eich Exp $ */ #include "X.h" #include "Xproto.h" @@ -22,6 +24,12 @@ #include "xf86str.h" #include "shadowfb.h" +#ifdef RENDER +# include "picturestr.h" +#endif + +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) static Bool ShadowCloseScreen (int i, ScreenPtr pScreen); static void ShadowRestoreAreas ( @@ -54,12 +62,29 @@ static Bool ShadowEnterVT(int index, int flags); static void ShadowLeaveVT(int index, int flags); -static void ShadowEnableDisableFBAccess(int index, Bool enable); +#ifdef RENDER +static void ShadowComposite( + CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height +); +#endif /* RENDER */ + typedef struct { ScrnInfoPtr pScrn; - RefreshAreaFuncPtr refresh; + RefreshAreaFuncPtr preRefresh; + RefreshAreaFuncPtr postRefresh; CloseScreenProcPtr CloseScreen; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; @@ -67,9 +92,11 @@ CreateGCProcPtr CreateGC; BackingStoreRestoreAreasProcPtr RestoreAreas; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; +#ifdef RENDER + CompositeProcPtr Composite; +#endif /* RENDER */ Bool (*EnterVT)(int, int); void (*LeaveVT)(int, int); - void (*EnableDisableFBAccess)(int, Bool); Bool vtSema; } ShadowScreenRec, *ShadowScreenPtr; @@ -144,14 +171,18 @@ Bool -ShadowFBInit ( +ShadowFBInit2 ( ScreenPtr pScreen, - RefreshAreaFuncPtr refreshArea + RefreshAreaFuncPtr preRefreshArea, + RefreshAreaFuncPtr postRefreshArea ){ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ShadowScreenPtr pPriv; +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +#endif /* RENDER */ - if(!refreshArea) return FALSE; + if(!preRefreshArea && !postRefreshArea) return FALSE; if (ShadowGeneration != serverGeneration) { if(((ShadowScreenIndex = AllocateScreenPrivateIndex ()) < 0) || @@ -169,7 +200,8 @@ pScreen->devPrivates[ShadowScreenIndex].ptr = (pointer)pPriv; pPriv->pScrn = pScrn; - pPriv->refresh = refreshArea; + pPriv->preRefresh = preRefreshArea; + pPriv->postRefresh = postRefreshArea; pPriv->vtSema = TRUE; pPriv->CloseScreen = pScreen->CloseScreen; @@ -182,7 +214,6 @@ pPriv->EnterVT = pScrn->EnterVT; pPriv->LeaveVT = pScrn->LeaveVT; - pPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess; pScreen->CloseScreen = ShadowCloseScreen; pScreen->PaintWindowBackground = ShadowPaintWindow; @@ -194,11 +225,25 @@ pScrn->EnterVT = ShadowEnterVT; pScrn->LeaveVT = ShadowLeaveVT; - pScrn->EnableDisableFBAccess = ShadowEnableDisableFBAccess; + +#ifdef RENDER + if(ps) { + pPriv->Composite = ps->Composite; + ps->Composite = ShadowComposite; + } +#endif /* RENDER */ return TRUE; } +Bool +ShadowFBInit ( + ScreenPtr pScreen, + RefreshAreaFuncPtr refreshArea +){ + return ShadowFBInit2(pScreen, NULL, refreshArea); +} + /**********************************************************/ static Bool @@ -206,17 +251,9 @@ { ScrnInfoPtr pScrn = xf86Screens[index]; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); - BoxRec box; if((*pPriv->EnterVT)(index, flags)) { pPriv->vtSema = TRUE; - - box.x1 = box.y1 = 0; - box.x2 = pScrn->pScreen->width; - box.y2 = pScrn->pScreen->height; - - (*pPriv->refresh)(pScrn, 1, &box); - return TRUE; } @@ -233,13 +270,6 @@ (*pPriv->LeaveVT)(index, flags); } -static void -ShadowEnableDisableFBAccess(int index, Bool enable) -{ - /* nothing happens here; nothing touches the real frame buffer */ -} - - /**********************************************************/ @@ -248,6 +278,9 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +#endif /* RENDER */ pScreen->CloseScreen = pPriv->CloseScreen; pScreen->PaintWindowBackground = pPriv->PaintWindowBackground; @@ -259,8 +292,13 @@ pScrn->EnterVT = pPriv->EnterVT; pScrn->LeaveVT = pPriv->LeaveVT; - pScrn->EnableDisableFBAccess = pPriv->EnableDisableFBAccess; +#ifdef RENDER + if(ps) { + ps->Composite = pPriv->Composite; + } +#endif /* RENDER */ + xfree((pointer)pPriv); return (*pScreen->CloseScreen) (i, pScreen); @@ -277,15 +315,19 @@ ){ ScreenPtr pScreen = pWin->drawable.pScreen; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - int num; + int num = 0; + + if(pPriv->vtSema && (num = REGION_NUM_RECTS(prgn))) + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); pScreen->BackingStoreFuncs.RestoreAreas = pPriv->RestoreAreas; (*pScreen->BackingStoreFuncs.RestoreAreas) ( pPixmap, prgn, xorg, yorg, pWin); pScreen->BackingStoreFuncs.RestoreAreas = ShadowRestoreAreas; - if(pPriv->vtSema && (num = REGION_NUM_RECTS(prgn))) - (*pPriv->refresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); + if(num && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); } @@ -297,7 +339,11 @@ ){ ScreenPtr pScreen = pWin->drawable.pScreen; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - int num; + int num = 0; + + if(pPriv->vtSema && (num = REGION_NUM_RECTS(prgn))) + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); if(what == PW_BACKGROUND) { pScreen->PaintWindowBackground = pPriv->PaintWindowBackground; @@ -309,8 +355,8 @@ pScreen->PaintWindowBorder = ShadowPaintWindow; } - if(pPriv->vtSema && (num = REGION_NUM_RECTS(prgn))) - (*pPriv->refresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); + if(num && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); } @@ -322,21 +368,34 @@ ){ ScreenPtr pScreen = pWin->drawable.pScreen; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - int num; + int num = 0; + RegionRec rgnDst; + if (pPriv->vtSema) { + REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0); + REGION_COPY(pWin->drawable.pScreen, &rgnDst, prgn); + + REGION_TRANSLATE(pWin->drawable.pScreen, &rgnDst, + pWin->drawable.x - ptOldOrg.x, + pWin->drawable.y - ptOldOrg.y); + REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, &rgnDst); + if ((num = REGION_NUM_RECTS(&rgnDst))) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, num, REGION_RECTS(&rgnDst)); + } else { + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); + } + } + pScreen->CopyWindow = pPriv->CopyWindow; (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn); pScreen->CopyWindow = ShadowCopyWindow; - - if (pPriv->vtSema) { - /* This is sortof cheating. We rely on the fact that - cfb translated prgn for us */ - - REGION_INTERSECT(pScreen, prgn, &pWin->borderClip, prgn); - if((num = REGION_NUM_RECTS(prgn))) - (*pPriv->refresh)(pPriv->pScrn, num, REGION_RECTS(prgn)); + + if (num) { + if (pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, num, REGION_RECTS(&rgnDst)); + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); } - } static Bool @@ -382,6 +441,51 @@ return retval; } +#ifdef RENDER +static void +ShadowComposite( + CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height +){ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); + PictureScreenPtr ps = GetPictureScreen(pScreen); + BoxRec box; + Bool boxNotEmpty = FALSE; + + box.x1 = pDst->pDrawable->x + xDst; + box.y1 = pDst->pDrawable->y + yDst; + box.x2 = box.x1 + width; + box.y2 = box.y1 + height; + + if (pPriv->vtSema + && pDst->pDrawable->type == DRAWABLE_WINDOW && BOX_NOT_EMPTY(box)) { + if (pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } + + ps->Composite = pPriv->Composite; + (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + ps->Composite = ShadowComposite; + + if (pPriv->postRefresh && boxNotEmpty) { + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + } +} +#endif /* RENDER */ + /**********************************************************/ static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr); @@ -515,6 +619,7 @@ int *pwidth = pwidthInit; int i = nInit; BoxRec box; + Bool boxNotEmpty = FALSE; box.x1 = ppt->x; box.x2 = box.x1 + *pwidth; @@ -522,7 +627,7 @@ while(--i) { ppt++; - pwidthInit++; + pwidth++; if(box.x1 > ppt->x) box.x1 = ppt->x; if(box.x2 < (ppt->x + *pwidth)) box.x2 = ppt->x + *pwidth; @@ -531,12 +636,18 @@ } box.y2++; + TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); + + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); } else (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); @@ -560,6 +671,7 @@ int *pwidth = pwidthInit; int i = nspans; BoxRec box; + Bool boxNotEmpty = FALSE; box.x1 = ppt->x; box.x2 = box.x1 + *pwidth; @@ -576,13 +688,19 @@ } box.y2++; + TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); + + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, pwidthInit, nspans, fSorted); - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); } else (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, pwidthInit, nspans, fSorted); @@ -600,23 +718,33 @@ int format, char *pImage ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - SHADOW_GC_OP_EPILOGUE(pGC); if(IS_VISIBLE(pDraw)) { - BoxRec box; - box.x1 = x + pDraw->x; box.x2 = box.x1 + w; box.y1 = y + pDraw->y; box.y2 = box.y1 + h; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, + leftPad, format, pImage); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); + } static RegionPtr @@ -629,24 +757,33 @@ int dstx, int dsty ){ RegionPtr ret; + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyArea)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - SHADOW_GC_OP_EPILOGUE(pGC); if(IS_VISIBLE(pDst)) { - BoxRec box; - box.x1 = dstx + pDst->x; box.x2 = box.x1 + width; box.y1 = dsty + pDst->y; box.y2 = box.y1 + height; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + ret = (*pGC->ops->CopyArea)(pSrc, pDst, + pGC, srcx, srcy, width, height, dstx, dsty); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); + return ret; } @@ -661,23 +798,32 @@ unsigned long bitPlane ){ RegionPtr ret; + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyPlane)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - SHADOW_GC_OP_EPILOGUE(pGC); if(IS_VISIBLE(pDst)) { - BoxRec box; - box.x1 = dstx + pDst->x; box.x2 = box.x1 + width; box.y1 = dsty + pDst->y; box.y2 = box.y1 + height; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + ret = (*pGC->ops->CopyPlane)(pSrc, pDst, + pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); return ret; } @@ -687,15 +833,17 @@ DrawablePtr pDraw, GCPtr pGC, int mode, - int npt, + int nptInit, xPoint *pptInit ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && npt) { - BoxRec box; + if(IS_VISIBLE(pDraw) && nptInit) { + xPoint *ppt = pptInit; + int npt = nptInit; box.x2 = box.x1 = pptInit->x; box.y2 = box.y1 = pptInit->y; @@ -703,20 +851,30 @@ /* this could be slow if the points were spread out */ while(--npt) { - pptInit++; - if(box.x1 > pptInit->x) box.x1 = pptInit->x; - else if(box.x2 < pptInit->x) box.x2 = pptInit->x; - if(box.y1 > pptInit->y) box.y1 = pptInit->y; - else if(box.y2 < pptInit->y) box.y2 = pptInit->y; + ppt++; + if(box.x1 > ppt->x) box.x1 = ppt->x; + else if(box.x2 < ppt->x) box.x2 = ppt->x; + if(box.y1 > ppt->y) box.y1 = ppt->y; + else if(box.y2 < ppt->y) box.y2 = ppt->y; } box.x2++; box.y2++; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->PolyPoint)(pDraw, pGC, mode, nptInit, pptInit); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } static void @@ -724,16 +882,17 @@ DrawablePtr pDraw, GCPtr pGC, int mode, - int npt, + int nptInit, DDXPointPtr pptInit ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - SHADOW_GC_OP_EPILOGUE(pGC); - - if(IS_VISIBLE(pDraw) && npt) { - BoxRec box; + if(IS_VISIBLE(pDraw) && nptInit) { + DDXPointPtr ppt = pptInit; + int npt = nptInit; int extra = pGC->lineWidth >> 1; box.x2 = box.x1 = pptInit->x; @@ -750,9 +909,9 @@ int x = box.x1; int y = box.y1; while(--npt) { - pptInit++; - x += pptInit->x; - y += pptInit->y; + ppt++; + x += ppt->x; + y += ppt->y; if(box.x1 > x) box.x1 = x; else if(box.x2 < x) box.x2 = x; if(box.y1 > y) box.y1 = y; @@ -760,11 +919,11 @@ } } else { while(--npt) { - pptInit++; - if(box.x1 > pptInit->x) box.x1 = pptInit->x; - else if(box.x2 < pptInit->x) box.x2 = pptInit->x; - if(box.y1 > pptInit->y) box.y1 = pptInit->y; - else if(box.y2 < pptInit->y) box.y2 = pptInit->y; + ppt++; + if(box.x1 > ppt->x) box.x1 = ppt->x; + else if(box.x2 < ppt->x) box.x2 = ppt->x; + if(box.y1 > ppt->y) box.y1 = ppt->y; + else if(box.y2 < ppt->y) box.y2 = ppt->y; } } @@ -779,25 +938,37 @@ } TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->Polylines)(pDraw, pGC, mode, nptInit, pptInit); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } static void ShadowPolySegment( DrawablePtr pDraw, GCPtr pGC, - int nseg, - xSegment *pSeg + int nsegInit, + xSegment *pSegInit ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && nseg) { - BoxRec box; + if(IS_VISIBLE(pDraw) && nsegInit) { int extra = pGC->lineWidth; + xSegment *pSeg = pSegInit; + int nseg = nsegInit; if(pGC->capStyle != CapProjecting) extra >>= 1; @@ -847,26 +1018,41 @@ } TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->PolySegment)(pDraw, pGC, nsegInit, pSegInit); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } static void ShadowPolyRectangle( DrawablePtr pDraw, GCPtr pGC, - int nRects, - xRectangle *pRects + int nRectsInit, + xRectangle *pRectsInit ){ + BoxRec box; + BoxPtr pBoxInit = NULL; + Bool boxNotEmpty = FALSE; + int num = 0; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyRectangle)(pDraw, pGC, nRects, pRects); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && nRects) { + if(IS_VISIBLE(pDraw) && nRectsInit) { + xRectangle *pRects = pRectsInit; + int nRects = nRectsInit; + if(nRects >= 32) { int extra = pGC->lineWidth >> 1; - BoxRec box; box.x1 = pRects->x; box.x2 = box.x1 + pRects->width; @@ -894,12 +1080,14 @@ box.y2++; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } else { - BoxPtr pbox, pBoxInit; + BoxPtr pbox; int offset1, offset2, offset3; - int num = 0; offset2 = pGC->lineWidth; if(!offset2) offset2 = 1; @@ -953,28 +1141,45 @@ pRects++; } - if(num) - (*pPriv->refresh)(pPriv->pScrn, num, pBoxInit); - - DEALLOCATE_LOCAL(pBoxInit); + if(num) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit); + } else { + DEALLOCATE_LOCAL(pBoxInit); + } } + } + + (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit); + + if(boxNotEmpty && pPriv->postRefresh) { + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + } else if(num) { + if(pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit); + DEALLOCATE_LOCAL(pBoxInit); } - } + + SHADOW_GC_OP_EPILOGUE(pGC); + +} static void ShadowPolyArc( DrawablePtr pDraw, GCPtr pGC, - int narcs, - xArc *parcs + int narcsInit, + xArc *parcsInit ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && narcs) { - int extra = pGC->lineWidth >> 1; - BoxRec box; + if(IS_VISIBLE(pDraw) && narcsInit) { + int narcs = narcsInit; + xArc *parcs = parcsInit; + int extra = pGC->lineWidth >> 1; box.x1 = parcs->x; box.x2 = box.x1 + parcs->width; @@ -1004,9 +1209,20 @@ box.y2++; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->PolyArc)(pDraw, pGC, narcsInit, parcsInit); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); + } static void @@ -1024,6 +1240,7 @@ DDXPointPtr ppt = pptInit; int i = count; BoxRec box; + Bool boxNotEmpty = FALSE; box.x2 = box.x1 = ppt->x; box.y2 = box.y1 = ppt->y; @@ -1053,11 +1270,17 @@ box.x2++; box.y2++; + TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } + (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit); - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); } else (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit); @@ -1076,6 +1299,7 @@ if(IS_VISIBLE(pDraw) && nRectsInit) { BoxRec box; + Bool boxNotEmpty = FALSE; xRectangle *pRects = pRectsInit; int nRects = nRectsInit; @@ -1097,11 +1321,17 @@ /* cfb messes with the pRectsInit so we have to do our calculations first */ + TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } + (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit); - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); } else (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit); @@ -1113,15 +1343,17 @@ ShadowPolyFillArc( DrawablePtr pDraw, GCPtr pGC, - int narcs, - xArc *parcs + int narcsInit, + xArc *parcsInit ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && narcs) { - BoxRec box; + if(IS_VISIBLE(pDraw) && narcsInit) { + xArc *parcs = parcsInit; + int narcs = narcsInit; box.x1 = parcs->x; box.x2 = box.x1 + parcs->width; @@ -1141,12 +1373,105 @@ } TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + (*pGC->ops->PolyFillArc)(pDraw, pGC, narcsInit, parcsInit); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } +static void +ShadowTextExtent(FontPtr pFont, int count, char* chars, + FontEncoding fontEncoding, BoxPtr box) +{ + unsigned long n, i; + int w; + CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ + + GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars, + fontEncoding, &n, charinfo); + w = 0; + for (i=0; i < n; i++) { + w += charinfo[i]->metrics.characterWidth; + } + if (i) { + w += charinfo[i - 1]->metrics.rightSideBearing; + } + + box->x1 = 0; + if (n) { + if (charinfo[0]->metrics.leftSideBearing < 0) { + box->x1 = charinfo[0]->metrics.leftSideBearing; + } + } + box->x2 = w; + box->y1 = -FONTMAXBOUNDS(pFont,ascent); + box->y2 = FONTMAXBOUNDS(pFont,descent); +} + + + +static void +ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y, + int count, char *chars, int wide) +{ + FontPtr pFont; + + pFont = pGC->font; + if (pFont->info.constantWidth) { + int ascent, descent, left, right = 0; + + ascent = MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent); + descent = MAX(pFont->info.fontDescent, pFont->info.maxbounds.descent); + left = pFont->info.maxbounds.leftSideBearing; + if (count > 0) { + right = (count - 1) * pFont->info.maxbounds.characterWidth; + } + right += pFont->info.maxbounds.rightSideBearing; + BB->x1 = + MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y - ascent, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + right, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + descent, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); + } else { + ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) + ? Linear16Bit : TwoD16Bit : Linear8Bit, BB); + BB->x1 = + MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y + BB->y1, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + BB->x2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + BB->y2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); + } +} + static int ShadowPolyText8( DrawablePtr pDraw, @@ -1157,34 +1482,30 @@ char *chars ){ int width; - + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - SHADOW_GC_OP_EPILOGUE(pGC); - - width -= x; - - if(IS_VISIBLE(pDraw) && (width > 0)) { - BoxRec box; - /* ugh */ - box.x1 = pDraw->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if(count > 1) { - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(IS_VISIBLE(pDraw)) { + ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0); + + TRIM_BOX(box, pGC); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - return (width + x); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); + + return width; } static int @@ -1197,34 +1518,30 @@ unsigned short *chars ){ int width; + BoxRec box; + Bool boxNotEmpty = FALSE; SHADOW_GC_OP_PROLOGUE(pGC); - width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - SHADOW_GC_OP_EPILOGUE(pGC); - width -= x; - - if(IS_VISIBLE(pDraw) && (width > 0)) { - BoxRec box; - - /* ugh */ - box.x1 = pDraw->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); + if(IS_VISIBLE(pDraw)) { + ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char*)chars, 1); + + TRIM_BOX(box, pGC); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } + } - if(count > 1) { - if(width > 0) box.x2 += width; - else box.x1 += width; - } + width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); - } + SHADOW_GC_OP_EPILOGUE(pGC); - return (width + x); + return width; } static void @@ -1236,13 +1553,12 @@ int count, char *chars ){ + BoxRec box; + Bool boxNotEmpty = FALSE; SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - SHADOW_GC_OP_EPILOGUE(pGC); if(IS_VISIBLE(pDraw) && count) { int top, bot, Min, Max; - BoxRec box; top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); @@ -1262,9 +1578,19 @@ box.y2 = pDraw->y + y + bot; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } static void ShadowImageText16( @@ -1275,13 +1601,12 @@ int count, unsigned short *chars ){ + BoxRec box; + Bool boxNotEmpty = FALSE; SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - SHADOW_GC_OP_EPILOGUE(pGC); if(IS_VISIBLE(pDraw) && count) { int top, bot, Min, Max; - BoxRec box; top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); @@ -1301,9 +1626,19 @@ box.y2 = pDraw->y + y + bot; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } @@ -1312,18 +1647,18 @@ DrawablePtr pDraw, GCPtr pGC, int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, + unsigned int nglyphInit, + CharInfoPtr *ppciInit, pointer pglyphBase ){ + BoxRec box; + Bool boxNotEmpty = FALSE; SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyph, - ppci, pglyphBase); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && nglyph) { + if(IS_VISIBLE(pDraw) && nglyphInit) { + CharInfoPtr *ppci = ppciInit; + unsigned int nglyph = nglyphInit; int top, bot, width = 0; - BoxRec box; top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); @@ -1351,9 +1686,20 @@ box.y2 = pDraw->y + y + bot; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyphInit, + ppciInit, pglyphBase); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } static void @@ -1361,17 +1707,18 @@ DrawablePtr pDraw, GCPtr pGC, int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, + unsigned int nglyphInit, + CharInfoPtr *ppciInit, pointer pglyphBase ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyph, - ppci, pglyphBase); - SHADOW_GC_OP_EPILOGUE(pGC); - if(IS_VISIBLE(pDraw) && nglyph) { - BoxRec box; + if(IS_VISIBLE(pDraw) && nglyphInit) { + CharInfoPtr *ppci = ppciInit; + unsigned int nglyph = nglyphInit; /* ugh */ box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing; @@ -1393,9 +1740,20 @@ box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyphInit, + ppciInit, pglyphBase); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } static void @@ -1405,22 +1763,31 @@ DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg ){ + BoxRec box; + Bool boxNotEmpty = FALSE; + SHADOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - SHADOW_GC_OP_EPILOGUE(pGC); if(IS_VISIBLE(pDraw)) { - BoxRec box; - box.x1 = xOrg + pDraw->x; box.x2 = box.x1 + dx; box.y1 = yOrg + pDraw->y; box.y2 = box.y1 + dy; TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - (*pPriv->refresh)(pPriv->pScrn, 1, &box); + if(BOX_NOT_EMPTY(box)) { + if(pPriv->preRefresh) + (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); + boxNotEmpty = TRUE; + } } + + (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); + + if(boxNotEmpty && pPriv->postRefresh) + (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); + + SHADOW_GC_OP_EPILOGUE(pGC); } Index: xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h diff -u xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h:1.2 xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h:1.4 --- xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h:1.2 Sat Sep 25 10:38:12 1999 +++ xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h Tue Feb 18 14:10:35 2003 @@ -1,16 +1,44 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h,v 1.2 1999/09/25 14:38:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/shadowfb/shadowfb.h,v 1.4 2003/02/18 19:10:35 alanh Exp $ */ #ifndef _SHADOWFB_H #define _SHADOWFB_H #include "xf86str.h" +/* + * User defined callback function. Passed a pointer to the ScrnInfo struct, + * the number of dirty rectangles, and a pointer to the first dirty rectangle + * in the array. + */ typedef void (*RefreshAreaFuncPtr)(ScrnInfoPtr, int, BoxPtr); +/* + * ShadowFBInit initializes the shadowfb subsystem. refreshArea is a pointer + * to a user supplied callback function. This function will be called after + * any operation that modifies the framebuffer. The newly dirtied rectangles + * are passed to the callback. + * + * Returns FALSE in the event of an error. + */ Bool ShadowFBInit ( ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea +); + +/* + * ShadowFBInit2 is a more featureful refinement of the original shadowfb. + * ShadowFBInit2 allows you to specify two callbacks, one to be called + * immediately before an operation that modifies the framebuffer, and another + * to be called immediately after. + * + * Returns FALSE in the event of an error + */ +Bool +ShadowFBInit2 ( + ScreenPtr pScreen, + RefreshAreaFuncPtr preRefreshArea, + RefreshAreaFuncPtr postRefreshArea ); #endif /* _SHADOWFB_H */ Index: xc/programs/Xserver/hw/xfree86/vbe/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/vbe/Imakefile:1.1 --- /dev/null Thu Feb 27 12:33:06 2003 +++ xc/programs/Xserver/hw/xfree86/vbe/Imakefile Mon Feb 17 12:06:45 2003 @@ -0,0 +1,36 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vbe/Imakefile,v 1.1 2003/02/17 17:06:45 dawes Exp $ + + +/* + * This directory should probably be moved up one level -- to xfree86/vbe. + */ + +#define IHaveModules +#include <Server.tmpl> + +#if DoLoadableServer +MODSRC = vbe_module.c +MODOBJ = vbe_module.o +#endif + +SRCS = vbe.c vbeModes.c $(MODSRC) +OBJS = vbe.o vbeModes.o $(MODOBJ) + +INCLUDES = -I. -I$(XF86COMSRC) -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \ + -I$(XF86SRC)/i2c + +DEFINES = + +ModuleObjectRule() + +LibraryModuleTarget(vbe, $(OBJS)) +InstallLibraryModule(vbe,$(MODULEDIR),.) + +DependTarget() + +InstallDriverSDKLibraryModule(vbe,$(DRIVERSDKMODULEDIR),.) + +InstallDriverSDKNonExecFile(vbe.h,$(DRIVERSDKINCLUDEDIR)) + Index: xc/programs/Xserver/hw/xfree86/vbe/vbe.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/vbe/vbe.c:1.1 --- /dev/null Thu Feb 27 12:33:06 2003 +++ xc/programs/Xserver/hw/xfree86/vbe/vbe.c Mon Feb 17 12:06:45 2003 @@ -0,0 +1,1072 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.c,v 1.1 2003/02/17 17:06:45 dawes Exp $ */ + +/* + * XFree86 vbe module + * Copyright 2000 Egbert Eich + * + * The mode query/save/set/restore functions from the vesa driver + * have been moved here. + * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) + * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + */ + +#include "xf86.h" +#include "xf86_ansic.h" +#include "vbe.h" +#include "Xarch.h" +#define DPMS_SERVER +#include "extensions/dpms.h" + +#define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x) + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +#define B_O16(x) (x) +#define B_O32(x) (x) +#else +#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) +#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ + | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) +#endif +#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) + +#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) +#define R16(v) ((v) & 0xffff) + +static unsigned char * vbeReadEDID(vbeInfoPtr pVbe); +static Bool vbeProbeDDC(vbeInfoPtr pVbe); + +const char *vbe_ddcSymbols[] = { + "xf86InterpretEDID", + NULL +}; + +static const char vbeVersionString[] = "VBE2"; + +vbeInfoPtr +VBEInit(xf86Int10InfoPtr pInt, int entityIndex) +{ + return VBEExtendedInit(pInt, entityIndex, 0); +} + +vbeInfoPtr +VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags) +{ + int RealOff; + pointer page = NULL; + ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex); + vbeControllerInfoPtr vbe = NULL; + Bool init_int10 = FALSE; + vbeInfoPtr vip = NULL; + int screen = pScrn->scrnIndex; + + if (!pInt) { + if (!xf86LoadSubModule(pScrn, "int10")) + goto error; + + xf86DrvMsg(screen,X_INFO,"initializing int10\n"); + pInt = xf86InitInt10(entityIndex); + if (!pInt) + goto error; + init_int10 = TRUE; + } + + page = xf86Int10AllocPages(pInt,1,&RealOff); + if (!page) goto error; + vbe = (vbeControllerInfoPtr) page; + memcpy(vbe->VbeSignature,vbeVersionString,4); + + pInt->ax = 0x4F00; + pInt->es = SEG_ADDR(RealOff); + pInt->di = SEG_OFF(RealOff); + pInt->num = 0x10; + + xf86ExecX86int10(pInt); + + if ((pInt->ax & 0xff) != 0x4f) { + xf86DrvMsgVerb(screen,X_INFO,3,"VESA BIOS not detected\n"); + goto error; + } + + switch (pInt->ax & 0xff00) { + case 0: + xf86DrvMsg(screen,X_INFO,"VESA BIOS detected\n"); + break; + case 0x100: + xf86DrvMsg(screen,X_INFO,"VESA BIOS function failed\n"); + goto error; + case 0x200: + xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported\n"); + goto error; + case 0x300: + xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported in current mode\n"); + goto error; + default: + xf86DrvMsg(screen,X_INFO,"Invalid\n"); + goto error; + } + + xf86DrvMsgVerb(screen, X_INFO, 4, + "VbeVersion is %d, OemStringPtr is 0x%08x,\n" + "\tOemVendorNamePtr is 0x%08x, OemProductNamePtr is 0x%08x,\n" + "\tOemProductRevPtr is 0x%08x\n", + vbe->VbeVersion, vbe->OemStringPtr, vbe->OemVendorNamePtr, + vbe->OemProductNamePtr, vbe->OemProductRevPtr); + + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Version %i.%i\n", + VERSION(vbe->VbeVersion)); + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Total Mem: %i kB\n", + vbe->TotalMem * 64); + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM: %s\n", + (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemStringPtr))); + + if (B_O16(vbe->VbeVersion) >= 0x200) { + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Software Rev: %i.%i\n", + VERSION(vbe->OemSoftwareRev)); + if (vbe->OemVendorNamePtr) + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Vendor: %s\n", + (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemVendorNamePtr))); + if (vbe->OemProductNamePtr) + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product: %s\n", + (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductNamePtr))); + if (vbe->OemProductRevPtr) + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product Rev: %s\n", + (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductRevPtr))); + } + vip = (vbeInfoPtr)xnfalloc(sizeof(vbeInfoRec)); + vip->version = B_O16(vbe->VbeVersion); + vip->pInt10 = pInt; + vip->ddc = DDC_UNCHECKED; + vip->memory = page; + vip->real_mode_base = RealOff; + vip->num_pages = 1; + vip->init_int10 = init_int10; + + return vip; + + error: + if (page) + xf86Int10FreePages(pInt, page, 1); + if (init_int10) + xf86FreeInt10(pInt); + return NULL; +} + +void +vbeFree(vbeInfoPtr pVbe) +{ + if (!pVbe) + return; + + xf86Int10FreePages(pVbe->pInt10,pVbe->memory,pVbe->num_pages); + /* If we have initalized int10 we ought to free it, too */ + if (pVbe->init_int10) + xf86FreeInt10(pVbe->pInt10); + xfree(pVbe); + return; +} + +static Bool +vbeProbeDDC(vbeInfoPtr pVbe) +{ + char *ddc_level; + int screen = pVbe->pInt10->scrnIndex; + + if (!pVbe || (pVbe->ddc == DDC_NONE)) + return FALSE; + if (pVbe->ddc != DDC_UNCHECKED) + return TRUE; + + pVbe->pInt10->ax = 0x4F15; + pVbe->pInt10->bx = 0; + pVbe->pInt10->cx = 0; + pVbe->pInt10->es = 0; + pVbe->pInt10->di = 0; + pVbe->pInt10->num = 0x10; + + xf86ExecX86int10(pVbe->pInt10); + + if ((pVbe->pInt10->ax & 0xff) != 0x4f) { + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC not supported\n"); + pVbe->ddc = DDC_NONE; + return FALSE; + } + + switch ((pVbe->pInt10->ax >> 8) & 0xff) { + case 0: + xf86DrvMsg(screen,X_INFO,"VESA VBE DDC supported\n"); + switch (pVbe->pInt10->bx & 0x3) { + case 0: + ddc_level = " none"; + pVbe->ddc = DDC_NONE; + break; + case 1: + ddc_level = " 1"; + pVbe->ddc = DDC_1; + break; + case 2: + ddc_level = " 2"; + pVbe->ddc = DDC_2; + break; + case 3: + ddc_level = " 1 + 2"; + pVbe->ddc = DDC_1_2; + break; + default: + ddc_level = ""; + pVbe->ddc = DDC_NONE; + break; + } + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level%s\n",ddc_level); + if (pVbe->pInt10->bx & 0x4) { + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Screen blanked" + "for data transfer\n"); + pVbe->ddc_blank = TRUE; + } else + pVbe->ddc_blank = FALSE; + + xf86DrvMsgVerb(screen,X_INFO,3, + "VESA VBE DDC transfer in appr. %x sec.\n", + (pVbe->pInt10->bx >> 8) & 0xff); + } + + return TRUE; +} + +typedef enum { + VBEOPT_NOVBE, + VBEOPT_NODDC +} VBEOpts; + +static const OptionInfoRec VBEOptions[] = { + { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE }, + { VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE }, +}; + +static unsigned char * +vbeReadEDID(vbeInfoPtr pVbe) +{ + int RealOff = pVbe->real_mode_base; + pointer page = pVbe->memory; + unsigned char *tmp = NULL; + Bool novbe = FALSE; + Bool noddc = FALSE; + int screen = pVbe->pInt10->scrnIndex; + OptionInfoPtr options; + + if (!page) return NULL; + + options = xnfalloc(sizeof(VBEOptions)); + (void)memcpy(options, VBEOptions, sizeof(VBEOptions)); + xf86ProcessOptions(screen, xf86Screens[screen]->options, options); + xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); + xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); + xfree(options); + if (novbe || noddc) return NULL; + + if (!vbeProbeDDC(pVbe)) goto error; + + memset(page,0,sizeof(vbeInfoPtr)); + strcpy(page,vbeVersionString); + + pVbe->pInt10->ax = 0x4F15; + pVbe->pInt10->bx = 0x01; + pVbe->pInt10->cx = 0; + pVbe->pInt10->dx = 0; + pVbe->pInt10->es = SEG_ADDR(RealOff); + pVbe->pInt10->di = SEG_OFF(RealOff); + pVbe->pInt10->num = 0x10; + + xf86ExecX86int10(pVbe->pInt10); + + if ((pVbe->pInt10->ax & 0xff) != 0x4f) { + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC invalid\n"); + goto error; + } + switch (pVbe->pInt10->ax & 0xff00) { + case 0x0: + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read successfully\n"); + tmp = (unsigned char *)xnfalloc(128); + memcpy(tmp,page,128); + break; + case 0x100: + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read failed\n"); + break; + default: + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC unkown failure %i\n", + pVbe->pInt10->ax & 0xff00); + break; + } + + error: + return tmp; +} + +xf86MonPtr +vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) +{ + xf86MonPtr pMonitor; + pointer pModule; + unsigned char *DDC_data = NULL; + + if (!pVbe) return NULL; + if (pVbe->version < 0x200) + return NULL; + + if (!(pModule = pDDCModule)) { + pModule = + xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc"); + if (!pModule) + return NULL; + + xf86LoaderReqSymLists(vbe_ddcSymbols, NULL); + } + + DDC_data = vbeReadEDID(pVbe); + + if (!DDC_data) + return NULL; + + pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data); + + if (!pDDCModule) + xf86UnloadSubModule(pModule); + return pMonitor; +} + + +VbeInfoBlock * +VBEGetVBEInfo(vbeInfoPtr pVbe) +{ + VbeInfoBlock *block = NULL; + int i, pStr, pModes; + char *str; + CARD16 major, minor, *modes; + + bzero(pVbe->memory, sizeof(VbeInfoBlock)); + + /* + Input: + AH := 4Fh Super VGA support + AL := 00h Return Super VGA information + ES:DI := Pointer to buffer + + Output: + AX := status + (All other registers are preserved) + */ + + ((char*)pVbe->memory)[0] = 'V'; + ((char*)pVbe->memory)[1] = 'B'; + ((char*)pVbe->memory)[2] = 'E'; + ((char*)pVbe->memory)[3] = '2'; + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f00; + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (NULL); + + block = xcalloc(sizeof(VbeInfoBlock), 1); + block->VESASignature[0] = ((char*)pVbe->memory)[0]; + block->VESASignature[1] = ((char*)pVbe->memory)[1]; + block->VESASignature[2] = ((char*)pVbe->memory)[2]; + block->VESASignature[3] = ((char*)pVbe->memory)[3]; + + block->VESAVersion = *(CARD16*)(((char*)pVbe->memory) + 4); + major = (unsigned)block->VESAVersion >> 8; + minor = block->VESAVersion & 0xff; + + pStr = *(CARD32*)(((char*)pVbe->memory) + 6); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OEMStringPtr = strdup(str); + + block->Capabilities[0] = ((char*)pVbe->memory)[10]; + block->Capabilities[1] = ((char*)pVbe->memory)[11]; + block->Capabilities[2] = ((char*)pVbe->memory)[12]; + block->Capabilities[3] = ((char*)pVbe->memory)[13]; + + pModes = *(CARD32*)(((char*)pVbe->memory) + 14); + modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); + i = 0; + while (modes[i] != 0xffff) + i++; + block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1); + memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); + block->VideoModePtr[i] = 0xffff; + + block->TotalMemory = *(CARD16*)(((char*)pVbe->memory) + 18); + + if (major < 2) + memcpy(&block->OemSoftwareRev, ((char*)pVbe->memory) + 20, 236); + else { + block->OemSoftwareRev = *(CARD16*)(((char*)pVbe->memory) + 20); + pStr = *(CARD32*)(((char*)pVbe->memory) + 22); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OemVendorNamePtr = strdup(str); + pStr = *(CARD32*)(((char*)pVbe->memory) + 26); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OemProductNamePtr = strdup(str); + pStr = *(CARD32*)(((char*)pVbe->memory) + 30); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OemProductRevPtr = strdup(str); + memcpy(&block->Reserved, ((char*)pVbe->memory) + 34, 222); + memcpy(&block->OemData, ((char*)pVbe->memory) + 256, 256); + } + + return (block); +} + +void +VBEFreeVBEInfo(VbeInfoBlock *block) +{ + xfree(block->OEMStringPtr); + xfree(block->VideoModePtr); + if (((unsigned)block->VESAVersion >> 8) >= 2) { + xfree(block->OemVendorNamePtr); + xfree(block->OemProductNamePtr); + xfree(block->OemProductRevPtr); + } + xfree(block); +} + +Bool +VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 02h Set Super VGA video mode + BX := Video mode + D0-D8 := Mode number + D9-D10 := Reserved (must be 0) + D11 := 0 Use current default refresh rate + := 1 Use user specified CRTC values for refresh rate + D12-13 Reserved for VBE/AF (must be 0) + D14 := 0 Use windowed frame buffer model + := 1 Use linear/flat frame buffer model + D15 := 0 Clear video memory + := 1 Don't clear video memory + ES:DI := Pointer to VbeCRTCInfoBlock structure + + Output: AX = Status + (All other registers are preserved) + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f02; + pVbe->pInt10->bx = mode; + if (block) { + pVbe->pInt10->bx |= 1 << 11; + memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock)); + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + } + + xf86ExecX86int10(pVbe->pInt10); + + return (R16(pVbe->pInt10->ax) == 0x4f); +} + +Bool +VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 03h Return current video mode + + Output: + AX := Status + BX := Current video mode + (All other registers are preserved) + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f03; + + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) == 0x4f) { + *mode = R16(pVbe->pInt10->bx); + + return (TRUE); + } + + return (FALSE); +} + +VbeModeInfoBlock * +VBEGetModeInfo(vbeInfoPtr pVbe, int mode) +{ + VbeModeInfoBlock *block = NULL; + + bzero(pVbe->memory, sizeof(VbeModeInfoBlock)); + + /* + Input: + AH := 4Fh Super VGA support + AL := 01h Return Super VGA mode information + CX := Super VGA video mode + (mode number must be one of those returned by Function 0) + ES:DI := Pointer to buffer + + Output: + AX := status + (All other registers are preserved) + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f01; + pVbe->pInt10->cx = mode; + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + xf86ExecX86int10(pVbe->pInt10); + if (R16(pVbe->pInt10->ax) != 0x4f) + return (NULL); + + block = xcalloc(sizeof(VbeModeInfoBlock), 1); + + block->ModeAttributes = *(CARD16*)pVbe->memory; + block->WinAAttributes = ((char*)pVbe->memory)[2]; + block->WinBAttributes = ((char*)pVbe->memory)[3]; + block->WinGranularity = *(CARD16*)(((char*)pVbe->memory) + 4); + block->WinSize = *(CARD16*)(((char*)pVbe->memory) + 6); + block->WinASegment = *(CARD16*)(((char*)pVbe->memory) + 8); + block->WinBSegment = *(CARD16*)(((char*)pVbe->memory) + 10); + block->WinFuncPtr = *(CARD32*)(((char*)pVbe->memory) + 12); + block->BytesPerScanline = *(CARD16*)(((char*)pVbe->memory) + 16); + + /* mandatory information for VBE 1.2 and above */ + block->XResolution = *(CARD16*)(((char*)pVbe->memory) + 18); + block->YResolution = *(CARD16*)(((char*)pVbe->memory) + 20); + block->XCharSize = ((char*)pVbe->memory)[22]; + block->YCharSize = ((char*)pVbe->memory)[23]; + block->NumberOfPlanes = ((char*)pVbe->memory)[24]; + block->BitsPerPixel = ((char*)pVbe->memory)[25]; + block->NumberOfBanks = ((char*)pVbe->memory)[26]; + block->MemoryModel = ((char*)pVbe->memory)[27]; + block->BankSize = ((char*)pVbe->memory)[28]; + block->NumberOfImages = ((char*)pVbe->memory)[29]; + block->Reserved = ((char*)pVbe->memory)[30]; + + /* Direct color fields (required for direct/6 and YUV/7 memory models) */ + block->RedMaskSize = ((char*)pVbe->memory)[31]; + block->RedFieldPosition = ((char*)pVbe->memory)[32]; + block->GreenMaskSize = ((char*)pVbe->memory)[33]; + block->GreenFieldPosition = ((char*)pVbe->memory)[34]; + block->BlueMaskSize = ((char*)pVbe->memory)[35]; + block->BlueFieldPosition = ((char*)pVbe->memory)[36]; + block->RsvdMaskSize = ((char*)pVbe->memory)[37]; + block->RsvdFieldPosition = ((char*)pVbe->memory)[38]; + block->DirectColorModeInfo = ((char*)pVbe->memory)[39]; + + /* Mandatory information for VBE 2.0 and above */ + if (pVbe->version >= 0x200) { + block->PhysBasePtr = *(CARD32*)(((char*)pVbe->memory) + 40); + block->Reserved32 = *(CARD32*)(((char*)pVbe->memory) + 44); + block->Reserved16 = *(CARD16*)(((char*)pVbe->memory) + 48); + + /* Mandatory information for VBE 3.0 and above */ + if (pVbe->version >= 0x300) { + block->LinBytesPerScanLine = *(CARD16*)(((char*)pVbe->memory) + 50); + block->BnkNumberOfImagePages = ((char*)pVbe->memory)[52]; + block->LinNumberOfImagePages = ((char*)pVbe->memory)[53]; + block->LinRedMaskSize = ((char*)pVbe->memory)[54]; + block->LinRedFieldPosition = ((char*)pVbe->memory)[55]; + block->LinGreenMaskSize = ((char*)pVbe->memory)[56]; + block->LinGreenFieldPosition = ((char*)pVbe->memory)[57]; + block->LinBlueMaskSize = ((char*)pVbe->memory)[58]; + block->LinBlueFieldPosition = ((char*)pVbe->memory)[59]; + block->LinRsvdMaskSize = ((char*)pVbe->memory)[60]; + block->LinRsvdFieldPosition = ((char*)pVbe->memory)[61]; + block->MaxPixelClock = *(CARD32*)(((char*)pVbe->memory) + 62); + memcpy(&block->Reserved2, ((char*)pVbe->memory) + 66, 188); + } + else + memcpy(&block->LinBytesPerScanLine, ((char*)pVbe->memory) + 50, 206); + } + else + memcpy(&block->PhysBasePtr, ((char*)pVbe->memory) + 40, 216); + + return (block); +} + +void +VBEFreeModeInfo(VbeModeInfoBlock *block) +{ + xfree(block); +} + +Bool +VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, + pointer *memory, int *size, int *real_mode_pages) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 04h Save/restore Super VGA video state + DL := 00h Return save/restore state buffer size + CX := Requested states + D0 = Save/restore video hardware state + D1 = Save/restore video BIOS data state + D2 = Save/restore video DAC state + D3 = Save/restore Super VGA state + + Output: + AX = Status + BX = Number of 64-byte blocks to hold the state buffer + (All other registers are preserved) + + + Input: + AH := 4Fh Super VGA support + AL := 04h Save/restore Super VGA video state + DL := 01h Save Super VGA video state + CX := Requested states (see above) + ES:BX := Pointer to buffer + + Output: + AX := Status + (All other registers are preserved) + + + Input: + AH := 4Fh Super VGA support + AL := 04h Save/restore Super VGA video state + DL := 02h Restore Super VGA video state + CX := Requested states (see above) + ES:BX := Pointer to buffer + + Output: + AX := Status + (All other registers are preserved) + */ + + if ((pVbe->version & 0xff00) > 0x100) { + int screen = pVbe->pInt10->scrnIndex; + if (function == MODE_QUERY || + (function == MODE_SAVE && !*memory)) { + /* Query amount of memory to save state */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f04; + pVbe->pInt10->dx = 0; + pVbe->pInt10->cx = 0x000f; + xf86ExecX86int10(pVbe->pInt10); + if (R16(pVbe->pInt10->ax) != 0x4f) + return (FALSE); + + if (function == MODE_SAVE) { + int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1; + if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, + real_mode_pages)) == NULL) { + xf86DrvMsg(screen, X_ERROR, + "Cannot allocate memory to save SVGA state.\n"); + return (FALSE); + } + } + *size = pVbe->pInt10->bx * 64; + } + + /* Save/Restore Super VGA state */ + if (function != MODE_QUERY) { + + if (!*memory) return FALSE; + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f04; + switch (function) { + case MODE_SAVE: + pVbe->pInt10->dx = 1; + break; + case MODE_RESTORE: + pVbe->pInt10->dx = 2; + break; + case MODE_QUERY: + return FALSE; + } + pVbe->pInt10->cx = 0x000f; + + pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); + pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); + xf86ExecX86int10(pVbe->pInt10); + return (R16(pVbe->pInt10->ax) == 0x4f); + + } + } + return TRUE; +} + +Bool +VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 05h + + Output: + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f05; + pVbe->pInt10->bx = window; + pVbe->pInt10->dx = iBank; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (FALSE); + + return (TRUE); +} + +Bool +VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, + int width, int *pixels, int *bytes, int *max) +{ + if (command < SCANWID_SET || command > SCANWID_GET_MAX) + return (FALSE); + + /* + Input: + AX := 4F06h VBE Set/Get Logical Scan Line Length + BL := 00h Set Scan Line Length in Pixels + := 01h Get Scan Line Length + := 02h Set Scan Line Length in Bytes + := 03h Get Maximum Scan Line Length + CX := If BL=00h Desired Width in Pixels + If BL=02h Desired Width in Bytes + (Ignored for Get Functions) + + Output: + AX := VBE Return Status + BX := Bytes Per Scan Line + CX := Actual Pixels Per Scan Line + (truncated to nearest complete pixel) + DX := Maximum Number of Scan Lines + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f06; + pVbe->pInt10->bx = command; + if (command == SCANWID_SET || command == SCANWID_SET_BYTES) + pVbe->pInt10->cx = width; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (FALSE); + + if (command == SCANWID_GET || command == SCANWID_GET_MAX) { + if (pixels) + *pixels = R16(pVbe->pInt10->cx); + if (bytes) + *bytes = R16(pVbe->pInt10->bx); + if (max) + *max = R16(pVbe->pInt10->dx); + } + + return (TRUE); +} + +Bool +VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) +{ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f07; + pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00; + pVbe->pInt10->cx = x; + pVbe->pInt10->dx = y; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (FALSE); + + return (TRUE); +} + +Bool +VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) +{ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f07; + pVbe->pInt10->bx = 0x01; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (FALSE); + + *x = pVbe->pInt10->cx; + *y = pVbe->pInt10->dx; + + return (TRUE); +} + +int +VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) +{ + /* + Input: + AX := 4F08h VBE Set/Get Palette Format + BL := 00h Set DAC Palette Format + := 01h Get DAC Palette Format + BH := Desired bits of color per primary + (Set DAC Palette Format only) + + Output: + AX := VBE Return Status + BH := Current number of bits of color per primary + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f08; + if (!bits) + pVbe->pInt10->bx = 0x01; + else + pVbe->pInt10->bx = (bits & 0x00ff) << 8; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (0); + + return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); +} + +CARD32 * +VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, + CARD32 *data, Bool secondary, Bool wait_retrace) +{ + /* + Input: + (16-bit) + AX := 4F09h VBE Load/Unload Palette Data + BL := 00h Set Palette Data + := 01h Get Palette Data + := 02h Set Secondary Palette Data + := 03h Get Secondary Palette Data + := 80h Set Palette Data during Vertical Retrace + CX := Number of palette registers to update (to a maximum of 256) + DX := First of the palette registers to update (start) + ES:DI := Table of palette values (see below for format) + + Output: + AX := VBE Return Status + + + Input: + (32-bit) + BL := 00h Set Palette Data + := 80h Set Palette Data during Vertical Retrace + CX := Number of palette registers to update (to a maximum of 256) + DX := First of the palette registers to update (start) + ES:EDI := Table of palette values (see below for format) + DS := Selector for memory mapped registers + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f09; + if (!secondary) + pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; + else + pVbe->pInt10->bx = set ? 2 : 3; + pVbe->pInt10->cx = num; + pVbe->pInt10->dx = first; + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + if (set) + memcpy(pVbe->memory, data, num * sizeof(CARD32)); + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (NULL); + + if (set) + return (data); + + data = xalloc(num * sizeof(CARD32)); + memcpy(data, pVbe->memory, num * sizeof(CARD32)); + + return (data); +} + +VBEpmi * +VBEGetVBEpmi(vbeInfoPtr pVbe) +{ + VBEpmi *pmi; + + /* + Input: + AH := 4Fh Super VGA support + AL := 0Ah Protected Mode Interface + BL := 00h Return Protected Mode Table + + Output: + AX := Status + ES := Real Mode Segment of Table + DI := Offset of Table + CX := Lenght of Table including protected mode code in bytes (for copying purposes) + (All other registers are preserved) + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f0a; + pVbe->pInt10->bx = 0; + pVbe->pInt10->di = 0; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (NULL); + + pmi = xalloc(sizeof(VBEpmi)); + pmi->seg_tbl = R16(pVbe->pInt10->es); + pmi->tbl_off = R16(pVbe->pInt10->di); + pmi->tbl_len = R16(pVbe->pInt10->cx); + + return (pmi); +} + +#if 0 +vbeModeInfoPtr +VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock *vbe) +{ + vbeModeInfoPtr ModeList = NULL; + + int i = 0; + while (vbe->VideoModePtr[i] != 0xffff) { + vbeModeInfoPtr m; + VbeModeInfoBlock *mode; + int id = vbe->VideoModePtr[i++]; + int bpp; + + if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) + continue; + + bpp = mode->BitsPerPixel; + + m = xnfcalloc(sizeof(vbeModeInfoRec),1); + m->width = mode->XResolution; + m->height = mode->YResolution; + m->bpp = bpp; + m->n = id; + m->next = ModeList; + + xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3, + "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", + m->n, m->width, m->height, m->bpp); + + ModeList = m; + + VBEFreeModeInfo(mode); + } + return ModeList; +} + +unsigned short +VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp) +{ + while (m) { + if (bpp == m->bpp + && mode->HDisplay == m->width + && mode->VDisplay == m->height) + return m->n; + m = m->next; + } + return 0; +} +#endif + +void +VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, + vbeSaveRestoreFunction function) +{ + Bool SaveSucc = FALSE; + + if (VBE_VERSION_MAJOR(pVbe->version) > 1 + && (function == MODE_SAVE || vbe_sr->pstate)) { + if (function == MODE_RESTORE) + memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize); + ErrorF("VBESaveRestore\n"); + if ((VBESaveRestore(pVbe,function, + (pointer)&vbe_sr->state, + &vbe_sr->stateSize,&vbe_sr->statePage))) { + if (function == MODE_SAVE) { + SaveSucc = TRUE; + vbe_sr->stateMode = -1; /* invalidate */ + /* don't rely on the memory not being touched */ + if (vbe_sr->pstate == NULL) + vbe_sr->pstate = xalloc(vbe_sr->stateSize); + memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize); + } + ErrorF("VBESaveRestore done with success\n"); + return; + } + ErrorF("VBESaveRestore done\n"); + } + + if (function == MODE_SAVE && !SaveSucc) + (void)VBEGetVBEMode(pVbe, &vbe_sr->stateMode); + + if (function == MODE_RESTORE && vbe_sr->stateMode != -1) + VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL); + +} + +int +VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) +{ + /* + Input: + AX := 4F0Bh VBE Get Pixel Clock + BL := 01h Get Pixel Clock + ECX := pixel clock in units of Hz + DX := mode number + + Output: + AX := VBE Return Status + ECX := Closest pixel clock + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f0b; + pVbe->pInt10->bx = 0x01; + pVbe->pInt10->cx = clock; + pVbe->pInt10->dx = mode; + xf86ExecX86int10(pVbe->pInt10); + + if (R16(pVbe->pInt10->ax) != 0x4f) + return (0); + + return (pVbe->pInt10->cx); +} + +Bool +VBEDPMSSet(vbeInfoPtr pVbe, int mode) +{ + /* + Input: + AX := 4F10h DPMS + BL := 01h Set Display Power State + BH := requested power state + + Output: + AX := VBE Return Status + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f10; + pVbe->pInt10->bx = 0x01; + switch (mode) { + case DPMSModeOn: + break; + case DPMSModeStandby: + pVbe->pInt10->bx |= 0x100; + break; + case DPMSModeSuspend: + pVbe->pInt10->bx |= 0x200; + break; + case DPMSModeOff: + pVbe->pInt10->bx |= 0x400; + break; + } + xf86ExecX86int10(pVbe->pInt10); + return (R16(pVbe->pInt10->ax) == 0x4f); +} + Index: xc/programs/Xserver/hw/xfree86/vbe/vbe.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/vbe/vbe.h:1.1 --- /dev/null Thu Feb 27 12:33:06 2003 +++ xc/programs/Xserver/hw/xfree86/vbe/vbe.h Mon Feb 17 12:06:45 2003 @@ -0,0 +1,328 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.h,v 1.1 2003/02/17 17:06:45 dawes Exp $ */ + +/* + * XFree86 vbe module + * Copyright 2000 Egbert Eich + * + * The mode query/save/set/restore functions from the vesa driver + * have been moved here. + * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) + * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + */ + +#ifndef _VBE_H +#define _VBE_H +#include "xf86int10.h" +#include "xf86DDC.h" + +typedef enum { + DDC_UNCHECKED, + DDC_NONE, + DDC_1, + DDC_2, + DDC_1_2 +} +ddc_lvl; + +typedef struct { + xf86Int10InfoPtr pInt10; + int version; + pointer memory; + int real_mode_base; + int num_pages; + Bool init_int10; + ddc_lvl ddc; + Bool ddc_blank; +} vbeInfoRec, *vbeInfoPtr; + +#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1) +#define VBE_VERSION_MINOR(x) (CARD8)(x) + +vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex); +vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags); +void vbeFree(vbeInfoPtr pVbe); +xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule); + +#pragma pack(1) + +typedef struct vbeControllerInfoBlock { + CARD8 VbeSignature[4]; + CARD16 VbeVersion; + CARD32 OemStringPtr; + CARD8 Capabilities[4]; + CARD32 VideoModePtr; + CARD16 TotalMem; + CARD16 OemSoftwareRev; + CARD32 OemVendorNamePtr; + CARD32 OemProductNamePtr; + CARD32 OemProductRevPtr; + CARD8 Scratch[222]; + CARD8 OemData[256]; +} vbeControllerInfoRec, *vbeControllerInfoPtr; + +#pragma pack() + +#ifndef __GNUC__ +#define __attribute__(a) +#endif + +typedef struct _VbeInfoBlock VbeInfoBlock; +typedef struct _VbeModeInfoBlock VbeModeInfoBlock; +typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; + +/* + * INT 0 + */ + +struct _VbeInfoBlock { + /* VESA 1.2 fields */ + CARD8 VESASignature[4]; /* VESA */ + CARD16 VESAVersion; /* Higher byte major, lower byte minor */ + /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ + CARD8 Capabilities[4]; /* Capabilities of the video environment */ + + /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ + + CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ + /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ + + /* VESA 2 fields */ + CARD16 OemSoftwareRev; /* VBE implementation Software revision */ + /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ + /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ + /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ + CARD8 Reserved[222]; /* Reserved for VBE implementation */ + CARD8 OemData[256]; /* Data Area for OEM Strings */ +} __attribute__((packed)); + +/* Return Super VGA Information */ +VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe); +void VBEFreeVBEInfo(VbeInfoBlock *block); + +/* + * INT 1 + */ + +struct _VbeModeInfoBlock { + CARD16 ModeAttributes; /* mode attributes */ + CARD8 WinAAttributes; /* window A attributes */ + CARD8 WinBAttributes; /* window B attributes */ + CARD16 WinGranularity; /* window granularity */ + CARD16 WinSize; /* window size */ + CARD16 WinASegment; /* window A start segment */ + CARD16 WinBSegment; /* window B start segment */ + CARD32 WinFuncPtr; /* real mode pointer to window function */ + CARD16 BytesPerScanline; /* bytes per scanline */ + + /* Mandatory information for VBE 1.2 and above */ + CARD16 XResolution; /* horizontal resolution in pixels or characters */ + CARD16 YResolution; /* vertical resolution in pixels or characters */ + CARD8 XCharSize; /* character cell width in pixels */ + CARD8 YCharSize; /* character cell height in pixels */ + CARD8 NumberOfPlanes; /* number of memory planes */ + CARD8 BitsPerPixel; /* bits per pixel */ + CARD8 NumberOfBanks; /* number of banks */ + CARD8 MemoryModel; /* memory model type */ + CARD8 BankSize; /* bank size in KB */ + CARD8 NumberOfImages; /* number of images */ + CARD8 Reserved; /* 1 */ /* reserved for page function */ + + /* Direct color fields (required for direct/6 and YUV/7 memory models) */ + CARD8 RedMaskSize; /* size of direct color red mask in bits */ + CARD8 RedFieldPosition; /* bit position of lsb of red mask */ + CARD8 GreenMaskSize; /* size of direct color green mask in bits */ + CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ + CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ + CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ + CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ + CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ + CARD8 DirectColorModeInfo; /* direct color mode attributes */ + + /* Mandatory information for VBE 2.0 and above */ + CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ + CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ + CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ + + /* Mandatory information for VBE 3.0 and above */ + CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ + CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ + CARD8 LinNumberOfImagePages; /* number of images for linear modes */ + CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ + CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ + CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ + CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ + CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ + CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ + CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ + CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ + CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ + CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ +} __attribute__((packed)); + +/* Return VBE Mode Information */ +VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode); +void VBEFreeModeInfo(VbeModeInfoBlock *block); + +/* + * INT2 + */ + +#define CRTC_DBLSCAN (1<<0) +#define CRTC_INTERLACE (1<<1) +#define CRTC_NHSYNC (1<<2) +#define CRTC_NVSYNC (1<<3) + +struct _VbeCRTCInfoBlock { + CARD16 HorizontalTotal; /* Horizontal total in pixels */ + CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ + CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ + CARD16 VerticalTotal; /* Vertical total in lines */ + CARD16 VerticalSyncStart; /* Vertical sync start in lines */ + CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ + CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ + CARD32 PixelClock; /* Pixel clock in units of Hz */ + CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ + CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ +} __attribute__((packed)); +/* VbeCRTCInfoBlock is in the VESA 3.0 specs */ + +Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *crtc); + +/* + * INT 3 + */ + +Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode); + +/* + * INT 4 + */ + +/* Save/Restore Super VGA video state */ +/* function values are (values stored in VESAPtr): + * 0 := query & allocate amount of memory to save state + * 1 := save state + * 2 := restore state + * + * function 0 called automatically if function 1 called without + * a previous call to function 0. + */ + +typedef enum { + MODE_QUERY, + MODE_SAVE, + MODE_RESTORE +} vbeSaveRestoreFunction; + +Bool +VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, + pointer *memory, int *size, int *real_mode_pages); + +/* + * INT 5 + */ + +Bool +VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window); + +/* + * INT 6 + */ + +typedef enum { + SCANWID_SET, + SCANWID_GET, + SCANWID_SET_BYTES, + SCANWID_GET_MAX +} vbeScanwidthCommand; + +#define VBESetLogicalScanline(pVbe, width) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, \ + width, NULL, NULL, NULL) +#define VBESetLogicalScanlineBytes(pVbe, width) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \ + NULL, NULL, NULL) +#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \ + pixels, bytes, max) +#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, \ + NULL, pixels, bytes, max) +Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, + vbeScanwidthCommand command, int width, + int *pixels, int *bytes, int *max); + +/* + * INT 7 + */ + +/* 16 bit code */ +Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace); +Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y); + +/* + * INT 8 + */ + +/* if bits is 0, then it is a GET */ +int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits); + +/* + * INT 9 + */ + +/* + * If getting a palette, the data argument is not used. It will return + * the data. + * If setting a palette, it will return the pointer received on success, + * NULL on failure. + */ +CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, + CARD32 *data, Bool secondary, Bool wait_retrace); +#define VBEFreePaletteData(data) xfree(data) + +/* + * INT A + */ + +typedef struct _VBEpmi { + int seg_tbl; + int tbl_off; + int tbl_len; +} VBEpmi; + +VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe); +#define VESAFreeVBEpmi(pmi) xfree(pmi) + +/* high level helper functions */ + +typedef struct _vbeModeInfoRec { + int width; + int height; + int bpp; + int n; + struct _vbeModeInfoRec *next; +} vbeModeInfoRec, *vbeModeInfoPtr; + +vbeModeInfoPtr VBEBuildVbeModeList(vbeInfoPtr pVbe, + VbeInfoBlock *vbe); + +unsigned short VBECalcVbeModeIndex(vbeModeInfoPtr m, + DisplayModePtr mode, int bpp); + +typedef struct { + CARD8 *state; + CARD8 *pstate; + int statePage; + int stateSize; + int stateMode; +} vbeSaveRestoreRec, *vbeSaveRestorePtr; + +void +VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, + vbeSaveRestoreFunction function); + +int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock); +Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode); + +#endif Index: xc/programs/Xserver/hw/xfree86/vbe/vbeModes.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/vbe/vbeModes.c:1.1 --- /dev/null Thu Feb 27 12:33:06 2003 +++ xc/programs/Xserver/hw/xfree86/vbe/vbeModes.c Mon Feb 17 12:06:45 2003 @@ -0,0 +1,477 @@ +#define DEBUG_VERB 2 +/* + * Copyright © 2002 David Dawes + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the author(s) shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from + * the author(s). + * + * Authors: David Dawes <dawes@xfree86.org> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbeModes.c,v 1.1 2003/02/17 17:06:45 dawes Exp $ + */ + +#include "xf86.h" +#include "xf86_ansic.h" +#include "vbe.h" +#include "vbeModes.h" + +static int +GetDepthFlag(vbeInfoPtr pVbe, int id) +{ + VbeModeInfoBlock *mode; + int bpp; + + if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) + return 0; + + if (VBE_MODE_USABLE(mode, 0)) { + int depth; + + if (VBE_MODE_COLOR(mode)) { + depth = mode->RedMaskSize + mode->GreenMaskSize + + mode->BlueMaskSize; + } else { + depth = 1; + } + bpp = mode->BitsPerPixel; + VBEFreeModeInfo(mode); + mode = NULL; + switch (depth) { + case 1: + return V_DEPTH_1; + case 4: + return V_DEPTH_4; + case 8: + return V_DEPTH_8; + case 15: + return V_DEPTH_15; + case 16: + return V_DEPTH_16; + case 24: + switch (bpp) { + case 24: + return V_DEPTH_24_24; + case 32: + return V_DEPTH_24_32; + } + } + } + if (mode) + VBEFreeModeInfo(mode); + return 0; +} + +/* + * Find supported mode depths. + */ +int +VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe, int *flags24, + int modeTypes) +{ + int i = 0; + int depths = 0; + + if (modeTypes & V_MODETYPE_VBE) { + while (vbe->VideoModePtr[i] != 0xffff) { + depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]); + } + } + + /* + * XXX This possibly only works with VBE 3.0 and later. + */ + if (modeTypes & V_MODETYPE_VGA) { + for (i = 0; i < 0x7F; i++) { + depths |= GetDepthFlag(pVbe, i); + } + } + + if (flags24) { + if (depths & V_DEPTH_24_24) + *flags24 |= Support24bppFb; + if (depths & V_DEPTH_24_32) + *flags24 |= Support32bppFb; + } + + return depths; +} + +static DisplayModePtr +CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe, int id, + int flags) +{ + CARD16 major, minor; + VbeModeInfoBlock *mode; + DisplayModePtr pMode, p; + VbeModeInfoData *data; + Bool modeOK = FALSE; + ModeStatus status = MODE_OK; + + major = (unsigned)(vbe->VESAVersion >> 8); + minor = vbe->VESAVersion & 0xff; + + if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) + return NULL; + + /* Does the mode match the depth/bpp? */ + /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */ + if (VBE_MODE_USABLE(mode, flags) && + ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) || + (mode->BitsPerPixel > 8 && + (mode->RedMaskSize + mode->GreenMaskSize + + mode->BlueMaskSize) == pScrn->depth && + mode->BitsPerPixel == pScrn->bitsPerPixel) || + (mode->BitsPerPixel == 15 && pScrn->depth == 15) || + (mode->BitsPerPixel <= 8 && + mode->BitsPerPixel == pScrn->bitsPerPixel))) { + modeOK = TRUE; + xf86ErrorFVerb(DEBUG_VERB, "*"); + } + + /* + * Check if there's a valid monitor mode that this one can be matched + * up with. The actual matching is done later. + */ + if (modeOK) { + Bool sizeMatch = FALSE; + modeOK = FALSE; + for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { + if ((p->HDisplay != mode->XResolution) || + (p->VDisplay != mode->YResolution) || + (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) + continue; + sizeMatch = TRUE; + /* XXX could support the various V_ flags */ + status = xf86CheckModeForMonitor(p, pScrn->monitor); + if (status == MODE_OK) { + modeOK = TRUE; + break; + } + } + if (sizeMatch && !modeOK) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using built-in mode \"%dx%d\" (%s)\n", + mode->XResolution, mode->YResolution, + xf86ModeStatusToString(status)); + } + } + + xf86ErrorFVerb(DEBUG_VERB, + "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, + " ModeAttributes: 0x%x\n", mode->ModeAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinAAttributes: 0x%x\n", mode->WinAAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinBAttributes: 0x%x\n", mode->WinBAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinGranularity: %d\n", mode->WinGranularity); + xf86ErrorFVerb(DEBUG_VERB, + " WinSize: %d\n", mode->WinSize); + xf86ErrorFVerb(DEBUG_VERB, + " WinASegment: 0x%x\n", mode->WinASegment); + xf86ErrorFVerb(DEBUG_VERB, + " WinBSegment: 0x%x\n", mode->WinBSegment); + xf86ErrorFVerb(DEBUG_VERB, + " WinFuncPtr: 0x%x\n", mode->WinFuncPtr); + xf86ErrorFVerb(DEBUG_VERB, + " BytesPerScanline: %d\n", mode->BytesPerScanline); + xf86ErrorFVerb(DEBUG_VERB, + " XResolution: %d\n", mode->XResolution); + xf86ErrorFVerb(DEBUG_VERB, + " YResolution: %d\n", mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, + " XCharSize: %d\n", mode->XCharSize); + xf86ErrorFVerb(DEBUG_VERB, + " YCharSize: %d\n", mode->YCharSize); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfPlanes: %d\n", mode->NumberOfPlanes); + xf86ErrorFVerb(DEBUG_VERB, + " BitsPerPixel: %d\n", mode->BitsPerPixel); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfBanks: %d\n", mode->NumberOfBanks); + xf86ErrorFVerb(DEBUG_VERB, + " MemoryModel: %d\n", mode->MemoryModel); + xf86ErrorFVerb(DEBUG_VERB, + " BankSize: %d\n", mode->BankSize); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfImages: %d\n", mode->NumberOfImages); + xf86ErrorFVerb(DEBUG_VERB, + " RedMaskSize: %d\n", mode->RedMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " RedFieldPosition: %d\n", mode->RedFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " GreenMaskSize: %d\n", mode->GreenMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " GreenFieldPosition: %d\n", mode->GreenFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " BlueMaskSize: %d\n", mode->BlueMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " BlueFieldPosition: %d\n", mode->BlueFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " RsvdMaskSize: %d\n", mode->RsvdMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); + if (major >= 2) { + xf86ErrorFVerb(DEBUG_VERB, + " PhysBasePtr: 0x%x\n", mode->PhysBasePtr); + if (major >= 3) { + xf86ErrorFVerb(DEBUG_VERB, + " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); + xf86ErrorFVerb(DEBUG_VERB, + " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); + xf86ErrorFVerb(DEBUG_VERB, + " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); + xf86ErrorFVerb(DEBUG_VERB, + " LinRedMaskSize: %d\n", mode->LinRedMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " MaxPixelClock: %d\n", mode->MaxPixelClock); + } + } + + if (!modeOK) { + VBEFreeModeInfo(mode); + return NULL; + } + pMode = xnfcalloc(sizeof(DisplayModeRec), 1); + + pMode->status = MODE_OK; + pMode->type = M_T_BUILTIN; + + /* for adjust frame */ + pMode->HDisplay = mode->XResolution; + pMode->VDisplay = mode->YResolution; + + data = xnfcalloc(sizeof(VbeModeInfoData), 1); + data->mode = id; + data->data = mode; + pMode->PrivSize = sizeof(VbeModeInfoData); + pMode->Private = (INT32*)data; + pMode->next = NULL; + return pMode; +} + +/* + * Check the available BIOS modes, and extract those that match the + * requirements into the modePool. Note: modePool is a NULL-terminated + * list. + */ + +DisplayModePtr +VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe, + int modeTypes) +{ + DisplayModePtr pMode, p = NULL, modePool = NULL; + int i = 0; + + if (modeTypes & V_MODETYPE_VBE) { + while (vbe->VideoModePtr[i] != 0xffff) { + int id = vbe->VideoModePtr[i++]; + + if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) { + ModeStatus status = MODE_OK; + + /* Check the mode against a specified virtual size (if any) */ + if (pScrn->display->virtualX > 0 && + pMode->HDisplay > pScrn->display->virtualX) { + status = MODE_VIRTUAL_X; + } + if (pScrn->display->virtualY > 0 && + pMode->VDisplay > pScrn->display->virtualY) { + status = MODE_VIRTUAL_Y; + } + if (status != MODE_OK) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%dx%d\" (%s)\n", + pMode->HDisplay, pMode->VDisplay, + xf86ModeStatusToString(status)); + } else { + if (p == NULL) { + modePool = pMode; + } else { + p->next = pMode; + } + pMode->prev = NULL; + p = pMode; + } + } + } + } + if (modeTypes & V_MODETYPE_VGA) { + for (i = 0; i < 0x7F; i++) { + if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) { + ModeStatus status = MODE_OK; + + /* Check the mode against a specified virtual size (if any) */ + if (pScrn->display->virtualX > 0 && + pMode->HDisplay > pScrn->display->virtualX) { + status = MODE_VIRTUAL_X; + } + if (pScrn->display->virtualY > 0 && + pMode->VDisplay > pScrn->display->virtualY) { + status = MODE_VIRTUAL_Y; + } + if (status != MODE_OK) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not using mode \"%dx%d\" (%s)\n", + pMode->HDisplay, pMode->VDisplay, + xf86ModeStatusToString(status)); + } else { + if (p == NULL) { + modePool = pMode; + } else { + p->next = pMode; + } + pMode->prev = NULL; + p = pMode; + } + } + } + } + return modePool; +} + +void +VBESetModeNames(DisplayModePtr pMode) +{ + if (!pMode) + return; + + do { + if (!pMode->name) { + /* Catch "bad" modes. */ + if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 || + pMode->VDisplay > 10000 || pMode->VDisplay < 0) { + pMode->name = strdup("BADMODE"); + } else { + pMode->name = xnfalloc(4 + 1 + 4 + 1); + sprintf(pMode->name, "%dx%d", pMode->HDisplay, pMode->VDisplay); + } + } + pMode = pMode->next; + } while (pMode); +} + +/* + * Go through the monitor modes and selecting the best set of + * parameters for each BIOS mode. Note: This is only supported in + * VBE version 3.0 or later. + */ +void +VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe) +{ + DisplayModePtr pMode; + VbeModeInfoData *data; + + pMode = pScrn->modes; + do { + DisplayModePtr p, best = NULL; + ModeStatus status; + + for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { + if ((p->HDisplay != pMode->HDisplay) || + (p->VDisplay != pMode->VDisplay) || + (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) + continue; + /* XXX could support the various V_ flags */ + status = xf86CheckModeForMonitor(p, pScrn->monitor); + if (status != MODE_OK) + continue; + if (!best || (p->Clock > best->Clock)) + best = p; + } + + if (best) { + int clock; + + data = (VbeModeInfoData*)pMode->Private; + pMode->HSync = (float)best->Clock * 1000.0 / best->HTotal + 0.5; + pMode->VRefresh = pMode->HSync / best->VTotal + 0.5; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Attempting to use %dHz refresh for mode \"%s\" (%x)\n", + (int)pMode->VRefresh, pMode->name, data->mode); + data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1); + data->block->HorizontalTotal = best->HTotal; + data->block->HorizontalSyncStart = best->HSyncStart; + data->block->HorizontalSyncEnd = best->HSyncEnd; + data->block->VerticalTotal = best->VTotal; + data->block->VerticalSyncStart = best->VSyncStart; + data->block->VerticalSyncEnd = best->VSyncEnd; + data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) | + ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0); + data->block->PixelClock = best->Clock * 1000; + /* XXX May not have this. */ + clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock); +#ifdef DEBUG + ErrorF("Setting clock %.2fMHz, closest is %.2fMHz\n", + (double)data->block->PixelClock / 1000000.0, + (double)clock / 1000000.0); +#endif + if (clock) + data->block->PixelClock = clock; + data->mode |= (1 << 11); + data->block->RefreshRate = ((double)(data->block->PixelClock) / + (double)(best->HTotal * best->VTotal)) * 100; + } + pMode = pMode->next; + } while (pMode != pScrn->modes); +} + +/* + * These wrappers are to allow (temporary) funtionality divergences. + */ +int +VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + char **modeNames, ClockRangePtr clockRanges, + int *linePitches, int minPitch, int maxPitch, int pitchInc, + int minHeight, int maxHeight, int virtualX, int virtualY, + int apertureSize, LookupModeFlags strategy) +{ + return xf86ValidateModes(scrp, availModes, modeNames, clockRanges, + linePitches, minPitch, maxPitch, pitchInc, + minHeight, maxHeight, virtualX, virtualY, + apertureSize, strategy); +} + +void +VBEPrintModes(ScrnInfoPtr scrp) +{ + xf86PrintModes(scrp); +} + Index: xc/programs/Xserver/hw/xfree86/vbe/vbeModes.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/vbe/vbeModes.h:1.1 --- /dev/null Thu Feb 27 12:33:06 2003 +++ xc/programs/Xserver/hw/xfree86/vbe/vbeModes.h Mon Feb 17 12:06:46 2003 @@ -0,0 +1,91 @@ +/* + * Copyright © 2002 David Dawes + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the author(s) shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from + * the author(s). + * + * Authors: David Dawes <dawes@xfree86.org> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbeModes.h,v 1.1 2003/02/17 17:06:46 dawes Exp $ + */ + +#ifndef _VBE_MODES_H + +/* + * This is intended to be stored in the DisplayModeRec's private area. + * It includes all the information necessary to VBE information. + */ +typedef struct _VbeModeInfoData { + int mode; + VbeModeInfoBlock *data; + VbeCRTCInfoBlock *block; +} VbeModeInfoData; + +#define V_DEPTH_1 0x001 +#define V_DEPTH_4 0x002 +#define V_DEPTH_8 0x004 +#define V_DEPTH_15 0x008 +#define V_DEPTH_16 0x010 +#define V_DEPTH_24_24 0x020 +#define V_DEPTH_24_32 0x040 +#define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32) +#define V_DEPTH_30 0x080 +#define V_DEPTH_32 0x100 + +#define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0) +#define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0) +#define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0) +#define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0) +#define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \ + ((m)->PhysBasePtr != 0)) + +#define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \ + (f & V_MODETYPE_BAD)) && \ + VBE_MODE_GRAPHICS(m) && \ + (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m)) + +#define V_MODETYPE_VBE 0x01 +#define V_MODETYPE_VGA 0x02 +#define V_MODETYPE_BAD 0x04 + +extern int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe, + int *flags24, int modeTypes); +extern DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, + VbeInfoBlock *vbe, int modeTypes); +extern void VBESetModeNames(DisplayModePtr pMode); +extern void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe); + + +/* + * Note: These are alternatives to the standard helpers. They should + * usually just wrap the standard helpers. + */ +extern int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + char **modeNames, ClockRangePtr clockRanges, + int *linePitches, int minPitch, int maxPitch, + int pitchInc, int minHeight, int maxHeight, + int virtualX, int virtualY, int apertureSize, + LookupModeFlags strategy); +extern void VBEPrintModes(ScrnInfoPtr scrp); + +#endif /* VBE_MODES_H */ Index: xc/programs/Xserver/hw/xfree86/vbe/vbe_module.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/vbe/vbe_module.c:1.1 --- /dev/null Thu Feb 27 12:33:06 2003 +++ xc/programs/Xserver/hw/xfree86/vbe/vbe_module.c Mon Feb 17 12:06:46 2003 @@ -0,0 +1,50 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe_module.c,v 1.1 2003/02/17 17:06:46 dawes Exp $ */ + +#include "xf86.h" +#include "xf86str.h" +#include "vbe.h" + +extern const char *vbe_ddcSymbols[]; + +#ifdef XFree86LOADER + +static MODULESETUPPROTO(vbeSetup); + +static XF86ModuleVersionInfo vbeVersRec = +{ + "vbe", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 1, 0, + ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_NONE, + {0,0,0,0} +}; + +XF86ModuleData vbeModuleData = { &vbeVersRec, vbeSetup, NULL }; + +static pointer +vbeSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + LoaderRefSymLists(vbe_ddcSymbols,NULL); + /* + * Tell the loader about symbols from other modules that this module + * might refer to. + */ + } + /* + * The return value must be non-NULL on success even though there + * is no TearDownProc. + */ + return (pointer)1; +} + +#endif + Index: xc/programs/Xserver/hw/xfree86/vgahw/Imakefile diff -u xc/programs/Xserver/hw/xfree86/vgahw/Imakefile:1.9 xc/programs/Xserver/hw/xfree86/vgahw/Imakefile:1.11 --- xc/programs/Xserver/hw/xfree86/vgahw/Imakefile:1.9 Sat Aug 14 06:50:10 1999 +++ xc/programs/Xserver/hw/xfree86/vgahw/Imakefile Thu Nov 14 16:01:21 2002 @@ -5,7 +5,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/Imakefile,v 1.9 1999/08/14 10:50:10 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/Imakefile,v 1.11 2002/11/14 21:01:21 tsi Exp $ #define IHaveModules #include <Server.tmpl> @@ -27,11 +27,7 @@ LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/llib-los.ln \ ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln -#if DirtyStartup -STARTUPDEFINES = -DDIRTY_STARTUP -#endif - - DEFINES = $(STARTUPDEFINES) + DEFINES = ModuleObjectRule() @@ -41,9 +37,7 @@ InstallLibraryModule(vgahw,$(MODULEDIR),.) -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKLibraryModule(vgahw,$(DRIVERSDKMODULEDIR),.) Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.53 xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.57 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.53 Tue Sep 18 17:23:23 2001 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c Mon Feb 24 16:29:36 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.53 2001/09/18 21:23:23 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.57 2003/02/24 21:29:36 tsi Exp $ */ /* * @@ -1439,11 +1439,13 @@ int i = (regp->CRTC[3] & 0x1F) | ((regp->CRTC[5] & 0x80) >> 2) | ExtBits; - if ((Flags & KGA_ENABLE_ON_ZERO) - && (i-- > (((mode->CrtcHBlankStart >> 3) - 1) + if (Flags & KGA_ENABLE_ON_ZERO) { + if ((i-- > (((mode->CrtcHBlankStart >> 3) - 1) & (0x3F | ExtBitMask))) && (mode->CrtcHBlankEnd == mode->CrtcHTotal)) i = 0; + } else if (Flags & KGA_BE_TOT_DEC) + i--; regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F); regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80); ExtBits = i & ExtBitMask; @@ -1476,14 +1478,17 @@ /* Null top overscan */ { int i = regp->CRTC[22] | ExtBits; - if ((Flags & KGA_ENABLE_ON_ZERO) - && ((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) + if (Flags & KGA_ENABLE_ON_ZERO) { + if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) || ((i > VBlankStart) && /* 8-bit case */ ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */ !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */ i = 0; else i = (i - 1); + } else if (Flags & KGA_BE_TOT_DEC) + i = (i - 1); + regp->CRTC[22] = i & 0xFF; ExtBits = i & 0xFF00; } @@ -1652,6 +1657,7 @@ { vgaRegPtr regp; vgaHWPtr hwp; + pciVideoPtr pvp; int i; /* @@ -1736,6 +1742,10 @@ /* Initialise the function pointers with the standard VGA versions */ vgaHWSetStdFuncs(hwp); + hwp->PIOOffset = scrp->domainIOBase; + if ((pvp = xf86GetPciInfoForEntity(scrp->entityList[0]))) + hwp->Tag = pciTag(pvp->bus, pvp->device, pvp->func); + return TRUE; } @@ -1786,8 +1796,8 @@ #ifdef DEBUG ErrorF("Mapping VGAMem\n"); #endif - hwp->Base = xf86MapVidMem(scr_index, VIDMEM_MMIO_32BIT, - hwp->MapPhys, hwp->MapSize); + hwp->Base = xf86MapDomainMemory(scr_index, VIDMEM_MMIO_32BIT, hwp->Tag, + hwp->MapPhys, hwp->MapSize); return hwp->Base != NULL; } @@ -1821,7 +1831,7 @@ hwp->IOBase = (hwp->readMiscOut(hwp) & 0x01) ? VGA_IOBASE_COLOR : VGA_IOBASE_MONO; xf86DrvMsgVerb(hwp->pScrn->scrnIndex, X_INFO, 3, - "vgaHWGetIOBase: hwp->IOBase is 0x%04x, hwp->PIOOffset is 0x%04x\n", + "vgaHWGetIOBase: hwp->IOBase is 0x%04x, hwp->PIOOffset is 0x%04lx\n", hwp->IOBase, hwp->PIOOffset); } @@ -1830,14 +1840,14 @@ vgaHWLock(vgaHWPtr hwp) { /* Protect CRTC[0-7] */ - hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) & ~0x80); + hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) | 0x80); } void vgaHWUnlock(vgaHWPtr hwp) { /* Unprotect CRTC[0-7] */ - hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) | 0x80); + hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) & ~0x80); } @@ -2009,4 +2019,3 @@ break; } } - Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.29 xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.31 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.29 Tue Dec 11 19:12:48 2001 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h Thu Apr 4 09:05:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h,v 1.29 2001/12/12 00:12:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h,v 1.31 2002/04/04 14:05:56 eich Exp $ */ /* @@ -21,6 +21,7 @@ #include "colormapst.h" #include "xf86str.h" +#include "xf86Pci.h" #include "xf86DDC.h" @@ -152,38 +153,25 @@ vgaHWWriteProcPtr writeDacData; vgaHWReadProcPtr readDacData; pointer ddc; - int PIOOffset; /* offset + vgareg + IOADDRESS PIOOffset; /* offset + vgareg = pioreg */ vgaHWReadProcPtr readEnable; vgaHWWriteProcPtr writeEnable; + PCITAG Tag; } vgaHWRec; /* Some macros that VGA drivers can use in their ChipProbe() function */ #define VGAHW_GET_IOBASE() ((inb(VGA_MISC_OUT_R) & 0x01) ? \ VGA_IOBASE_COLOR : VGA_IOBASE_MONO) -#define VGAHW_UNLOCK(base) do { \ - unsigned char tmp; \ - outb((base) + VGA_CRTC_INDEX_OFFSET, 0x11); \ - tmp = inb((base) + VGA_CRTC_DATA_OFFSET); \ - outb((base) + VGA_CRTC_DATA_OFFSET, \ - tmp | 0x80); \ - } while (0) -#define VGAHW_LOCK(base) do { \ - unsigned char tmp; \ - outb((base) + VGA_CRTC_INDEX_OFFSET, 0x11); \ - tmp = inb((base) + VGA_CRTC_DATA_OFFSET); \ - outb((base) + VGA_CRTC_DATA_OFFSET, \ - tmp & ~0x80); \ - } while (0) - #define OVERSCAN 0x11 /* Index of OverScan register */ /* Flags that define how overscan correction should take place */ #define KGA_FIX_OVERSCAN 1 /* overcan correction required */ #define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */ /* of next scanline/frame */ - +#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */ + /* to total - 1 */ #define BIT_PLANE 3 /* Which plane we write to in mono mode */ #define BITS_PER_GUN 6 #define COLORMAP_SIZE 256 @@ -191,10 +179,10 @@ #if defined(__powerpc__) #define DACDelay(hw) /* No legacy VGA support */ #else -#define DACDelay(hw) \ - do { \ - unsigned char temp = inb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ - temp = inb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ +#define DACDelay(hw) \ + do { \ + (void)inb((hw)->PIOOffset + (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ + (void)inb((hw)->PIOOffset + (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ } while (0) #endif Index: xc/programs/Xserver/hw/xfree86/xaa/xaa.h diff -u xc/programs/Xserver/hw/xfree86/xaa/xaa.h:1.36 xc/programs/Xserver/hw/xfree86/xaa/xaa.h:1.39 --- xc/programs/Xserver/hw/xfree86/xaa/xaa.h:1.36 Sun Jun 3 15:47:59 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaa.h Wed Oct 30 07:52:43 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaa.h,v 1.36 2001/06/03 19:47:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaa.h,v 1.39 2002/10/30 12:52:43 alanh Exp $ */ #ifndef _XAA_H #define _XAA_H @@ -15,7 +15,7 @@ 21 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 20 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 19 LINE_PATTERN_POWER_OF_2_ONLY -18 . +18 LINE_LIMIT_COORDS 17 . 16 . --------- ------- @@ -162,7 +162,8 @@ #define LINE_PATTERN_LSBFIRST_LSBJUSTIFIED 0x00400000 #define LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 0x00200000 #define LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 0x00100000 -#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000 +#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000 +#define LINE_LIMIT_COORDS 0x00040000 /* clipping flags */ #define HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND 0x00400000 @@ -1327,7 +1328,11 @@ #endif - + + /* these were added for 4.3.0 */ + BoxRec SolidLineLimits; + BoxRec DashedLineLimits; + } XAAInfoRec, *XAAInfoRecPtr; #define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE Index: xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c:1.7 xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c:1.8 --- xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c:1.7 Fri May 18 16:22:31 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c Mon Feb 17 11:08:29 2003 @@ -1,6 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c,v 1.7 2001/05/18 20:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c,v 1.8 2003/02/17 16:08:29 dawes Exp $ */ #include "Xmd.h" +CARD32 XAAReverseBitOrder(CARD32 v); CARD32 XAAReverseBitOrder(CARD32 v) Index: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c:1.2 xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c:1.3 --- xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c:1.2 Sat Jul 25 12:58:43 1998 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c Mon Feb 17 11:08:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c,v 1.2 1998/07/25 16:58:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyWin.c,v 1.3 2003/02/17 16:08:29 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -18,8 +18,6 @@ /* Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net). */ - -extern WindowPtr *WindowTable; void XAACopyWindow( Index: xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c:1.4 xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c:1.5 --- xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c:1.4 Sat Oct 27 23:34:04 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c Wed Sep 18 14:14:59 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c,v 1.4 2001/10/28 03:34:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c,v 1.5 2002/09/18 18:14:59 martin Exp $ */ #include "X.h" #include "misc.h" @@ -49,6 +49,58 @@ if(!nboxInit) return; + + if (infoRec->DashedLineFlags & LINE_LIMIT_COORDS) { + int minValX = infoRec->DashedLineLimits.x1; + int maxValX = infoRec->DashedLineLimits.x2; + int minValY = infoRec->DashedLineLimits.y1; + int maxValY = infoRec->DashedLineLimits.y2; +#ifdef POLYSEGMENT + int n = nseg; + xSegment *s = pSeg; + + while (n--) +#else + int n = npt; + int xorgtmp = xorg; + int yorgtmp = yorg; + + ppt = pptInit; + x2 = ppt->x + xorgtmp; + y2 = ppt->y + yorgtmp; + while (--n) +#endif + { +#ifdef POLYSEGMENT + x1 = s->x1 + xorg; + y1 = s->y1 + yorg; + x2 = s->x2 + xorg; + y2 = s->y2 + yorg; + s++; +#else + x1 = x2; + y1 = y2; + ++ppt; + if (mode == CoordModePrevious) { + xorgtmp = x1; + yorgtmp = y1; + } + x2 = ppt->x + xorgtmp; + y2 = ppt->y + yorgtmp; +#endif + if (x1 > maxValX || x1 < minValX || + x2 > maxValX || x2 < minValX || + y1 > maxValY || y1 < minValY || + y2 > maxValY || y2 < minValY) { +#ifdef POLYSEGMENT + XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg); +#else + XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit); +#endif + return; + } + } + } PatternLength = pGCPriv->DashLength; PatternOffset = pGC->dashOffset % PatternLength; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.32 xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.36 --- xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.32 Sun Jun 3 15:47:59 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c Sat Jan 11 22:55:51 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c,v 1.32 2001/06/03 19:47:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c,v 1.36 2003/01/12 03:55:51 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -13,7 +13,9 @@ #include "xf86fbman.h" #include "servermd.h" +#ifdef XFree86LOADER static const OptionInfoRec *XAAAvailableOptions(void *unused); +#endif /* * XAA Config options @@ -100,7 +102,7 @@ MODINFOSTRING1, MODINFOSTRING2, XF86_VERSION_CURRENT, - 1, 0, 0, + 1, 1, 0, ABI_CLASS_VIDEODRV, /* requires the video driver ABI */ ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, @@ -133,7 +135,6 @@ return (pointer)TRUE; } -#endif /*ARGSUSED*/ static const OptionInfoRec * @@ -141,6 +142,7 @@ { return (XAAOptions); } +#endif Bool XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) @@ -489,7 +491,7 @@ #ifndef __i386__ /* XAA makes some unaligned accesses when clipping is not available */ - #define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X) +# define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X) if(HaveImageWriteRect && ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) { @@ -886,7 +888,8 @@ } infoRec->WriteBitmapFlags = infoRec->ScanlineCPUToScreenColorExpandFillFlags; - } + } else + infoRec->WriteBitmap = NULL; /**** TE Glyphs ****/ @@ -993,7 +996,8 @@ } else if(HaveScanlineImageWriteRect) { infoRec->WritePixmap = XAAWritePixmapScanline; infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags; - } + } else + infoRec->WritePixmap = NULL; /**** ReadPixmap ****/ Index: xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c:1.5 xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c:1.6 --- xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c:1.5 Sat Oct 27 23:34:04 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c Wed Sep 18 14:15:00 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c,v 1.5 2001/10/28 03:34:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c,v 1.6 2002/09/18 18:15:00 martin Exp $ */ #include "X.h" #include "misc.h" @@ -45,6 +45,58 @@ if(!nboxInit) return; + + if (infoRec->SolidLineFlags & LINE_LIMIT_COORDS) { + int minValX = infoRec->SolidLineLimits.x1; + int maxValX = infoRec->SolidLineLimits.x2; + int minValY = infoRec->SolidLineLimits.y1; + int maxValY = infoRec->SolidLineLimits.y2; +#ifdef POLYSEGMENT + int n = nseg; + xSegment *s = pSeg; + + while (n--) +#else + int n = npt; + int xorgtmp = xorg; + int yorgtmp = yorg; + + ppt = pptInit; + x2 = ppt->x + xorgtmp; + y2 = ppt->y + yorgtmp; + while (--n) +#endif + { +#ifdef POLYSEGMENT + x1 = s->x1 + xorg; + y1 = s->y1 + yorg; + x2 = s->x2 + xorg; + y2 = s->y2 + yorg; + s++; +#else + x1 = x2; + y1 = y2; + ++ppt; + if (mode == CoordModePrevious) { + xorgtmp = x1; + yorgtmp = y1; + } + x2 = ppt->x + xorgtmp; + y2 = ppt->y + yorgtmp; +#endif + if (x1 > maxValX || x1 < minValX || + x2 > maxValX || x2 < minValX || + y1 > maxValY || y1 < minValY || + y2 > maxValY || y2 < minValY) { +#ifdef POLYSEGMENT + XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg); +#else + XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit); +#endif + return; + } + } + } (*infoRec->SetupForSolidLine)(infoRec->pScrn, pGC->fgPixel, pGC->alu, pGC->planemask); Index: xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c:1.13 xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c:1.14 --- xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c:1.13 Sat Oct 27 23:34:04 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c Mon Dec 9 23:18:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c,v 1.13 2001/10/28 03:34:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c,v 1.14 2002/12/10 04:18:20 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -20,8 +20,6 @@ #include "panoramiX.h" #include "panoramiXsrv.h" #endif - -extern WindowPtr *WindowTable; static void XAACopyWindow8_32( Index: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c:1.10 xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c:1.11 --- xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c:1.10 Sat Oct 27 23:34:04 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c Mon Feb 17 11:08:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c,v 1.10 2001/10/28 03:34:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c,v 1.11 2003/02/17 16:08:29 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -19,8 +19,6 @@ #include "panoramiX.h" #include "panoramiXsrv.h" #endif - -extern WindowPtr *WindowTable; void XAAPaintWindow( Index: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.14 xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.17 --- xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.14 Sun Jun 3 15:47:59 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c Mon Dec 9 23:17:21 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.14 2001/06/03 19:47:59 mvojkovi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.17 2002/12/10 04:17:21 dawes Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -207,6 +207,12 @@ IS_OFFSCREEN_PIXMAP(pSrc->pDrawable)) return FALSE; + if (pSrc->transform || (pMask && pMask->transform)) + return FALSE; + + if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap)) + return FALSE; + xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; xSrc += pSrc->pDrawable->x; @@ -231,7 +237,7 @@ (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat && !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) && (!(infoRec->WriteBitmapFlags & RGB_EQUAL) || - (red == green == blue))) + ((red == green) && (green == blue)))) { PixmapPtr pPix = (PixmapPtr)(pMask->pDrawable); int skipleft; @@ -425,8 +431,13 @@ !(*infoRec->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) - { - SYNC_CHECK(pDst->pDrawable); + { + if(pSrc->pDrawable->type == DRAWABLE_WINDOW || + pDst->pDrawable->type == DRAWABLE_WINDOW || + IS_OFFSCREEN_PIXMAP(pSrc->pDrawable) || + IS_OFFSCREEN_PIXMAP(pDst->pDrawable)) { + SYNC_CHECK(pDst->pDrawable); + } (*GetPictureScreen(pScreen)->Composite) (op, pSrc, pMask, @@ -495,7 +506,7 @@ XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format); - if((infoRec->WriteBitmapFlags & RGB_EQUAL) && !(red == green == blue)) + if((infoRec->WriteBitmapFlags & RGB_EQUAL) && !((red == green) && (green == blue))) return FALSE; x = pDst->pDrawable->x; @@ -617,7 +628,22 @@ return TRUE; } - return FALSE; + /* + * If it looks like we have a chance of being able to draw these + * glyphs with an accelerated Composite, do that now to avoid + * unneeded and costly syncs. + */ + if(maskFormat) { + if(!infoRec->CPUToScreenAlphaTextureFormats) + return FALSE; + } else { + if(!infoRec->CPUToScreenTextureFormats) + return FALSE; + } + + miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); + + return TRUE; } @@ -640,7 +666,12 @@ !(*infoRec->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs)) { - SYNC_CHECK(pDst->pDrawable); + if((pSrc->pDrawable->type == DRAWABLE_WINDOW) || + (pDst->pDrawable->type == DRAWABLE_WINDOW) || + IS_OFFSCREEN_PIXMAP(pSrc->pDrawable) || + IS_OFFSCREEN_PIXMAP(pDst->pDrawable)) { + SYNC_CHECK(pDst->pDrawable); + } (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); } Index: xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c:3.1 xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c:3.2 --- xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c:3.1 Tue Jun 20 01:08:49 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c Mon Feb 3 20:44:07 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c,v 3.1 2000/06/20 05:08:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaStateChange.c,v 3.2 2003/02/04 01:44:07 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -262,6 +262,17 @@ CopyWindowProcPtr CopyWindow; BackingStoreSaveAreasProcPtr SaveAreas; BackingStoreRestoreAreasProcPtr RestoreAreas; +#ifdef RENDER + Bool (*SetupForCPUToScreenAlphaTexture)(ScrnInfoPtr pScrn, int op, + CARD16 red, CARD16 green, + CARD16 blue, CARD16 alpha, + int alphaType, CARD8 *alphaPtr, + int alphaPitch, int width, + int height, int flags); + Bool (*SetupForCPUToScreenTexture)(ScrnInfoPtr pScrn, int op, int texType, + CARD8 *texPtr, int texPitch, + int width, int height, int flags); +#endif } XAAStateWrapRec, *XAAStateWrapPtr; static int XAAStateIndex = -1; @@ -1487,6 +1498,42 @@ x, y, pWin); } +#ifdef RENDER +static Bool XAAStateWrapSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, + int op, CARD16 red, + CARD16 green, + CARD16 blue, + CARD16 alpha, + int alphaType, + CARD8 *alphaPtr, + int alphaPitch, + int width, int height, + int flags) +{ + GET_STATEPRIV_PSCRN(pScrn); + STATE_CHECK_PSCRN(pScrn); + + return (*pStatePriv->SetupForCPUToScreenAlphaTexture)(pScrn, op, red, green, + blue, alpha, alphaType, + alphaPtr, alphaPitch, + width, height, flags); +} + +static Bool XAAStateWrapSetupForCPUToScreenTexture(ScrnInfoPtr pScrn, int op, + int texType, CARD8 *texPtr, + int texPitch, + int width, int height, + int flags) +{ + GET_STATEPRIV_PSCRN(pScrn); + STATE_CHECK_PSCRN(pScrn); + + return (*pStatePriv->SetupForCPUToScreenTexture)(pScrn, op, texType, texPtr, + texPitch, width, height, + flags); +} +#endif + /* Setup Function */ Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec) @@ -1623,6 +1670,8 @@ XAA_STATE_WRAP(CopyWindow); XAA_STATE_WRAP(SaveAreas); XAA_STATE_WRAP(RestoreAreas); - + XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture); + XAA_STATE_WRAP(SetupForCPUToScreenTexture); + return TRUE; } Index: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h diff -u xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.35 xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.36 --- xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.35 Thu Jul 19 14:50:16 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h Mon Feb 17 11:08:29 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.35 2001/07/19 18:50:16 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.36 2003/02/17 16:08:29 dawes Exp $ */ #ifndef _XAALOCAL_H #define _XAALOCAL_H @@ -1466,6 +1466,12 @@ void XAAComputeDash(GCPtr pGC); void XAAMoveDWORDS_FixedBase( + register CARD32* dest, + register CARD32* src, + register int dwords +); + +void XAAMoveDWORDS_FixedSrc( register CARD32* dest, register CARD32* src, register int dwords Index: xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile:1.5 Sat Aug 14 06:50:15 1999 +++ xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile Fri May 31 14:46:03 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile,v 1.5 1999/08/14 10:50:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/Imakefile,v 1.6 2002/05/31 18:46:03 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -109,9 +109,7 @@ InstallLibraryModule(xf1bpp,$(MODULEDIR),.) -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKLibraryModule(xf1bpp,$(DRIVERSDKMODULEDIR),.) Index: xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile:1.5 Sat Aug 14 06:50:16 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile Fri May 31 14:46:03 2002 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile,v 1.5 1999/08/14 10:50:16 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/Imakefile,v 1.6 2002/05/31 18:46:03 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -52,9 +52,7 @@ InstallLibraryModule(xf4bpp,$(MODULEDIR),.) -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKLibraryModule(xf4bpp,$(DRIVERSDKMODULEDIR),.) Index: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c:1.3 Sun Jun 6 04:48:55 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c,v 1.3 1999/06/06 08:48:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbbresd.c,v 1.4 2002/01/25 21:56:22 tsi Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium @@ -56,6 +56,7 @@ #include "maskbits.h" #include "miline.h" #include "wm3.h" +#include "xf86.h" /* Dashed bresenham line */ @@ -74,10 +75,11 @@ } void -xf4bppBresD(fgink, bgink, +xf4bppBresD(pDrawable, fgink, bgink, pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) +DrawablePtr pDrawable; int fgink, bgink; int *pdashIndex; /* current dash */ unsigned char *pDash; /* dash list */ @@ -94,6 +96,8 @@ int e2; int len; /* length of line */ { + IOADDRESS REGBASE = + xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300; register int yinc; /* increment to next scanline, in bytes */ register PixelType *addrl; register int e3 = e2-e1; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c:1.4 Sat Sep 25 10:38:15 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c,v 1.4 1999/09/25 14:38:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbfillarc.c,v 1.5 2003/02/18 21:29:59 tsi Exp $ */ /************************************************************ Copyright (c) 1989 X Consortium @@ -88,14 +88,14 @@ if (!slw) continue; xpos = xorg - x; - addrl = addrlt + (xpos >> 5); - if (((xpos & 0x1f) + slw) < 32) + addrl = addrlt + (xpos >> PWSH); + if (((xpos & PIM) + slw) < PPW) { maskpartialbits(xpos, slw, startmask); UPDRW(addrl,startmask); if (miFillArcLower(slw)) { - addrl = addrlb + (xpos >> 5); + addrl = addrlb + (xpos >> PWSH); UPDRW(addrl,startmask); } continue; @@ -115,7 +115,7 @@ } if (!miFillArcLower(slw)) continue; - addrl = addrlb + (xpos >> 5); + addrl = addrlb + (xpos >> PWSH); if (startmask) { UPDRW(addrl,startmask); addrl++; @@ -135,8 +135,8 @@ if (xr >= xl) \ { \ width = xr - xl + 1; \ - addrl = addr + (xl >> 5); \ - if (((xl & 0x1f) + width) < 32) \ + addrl = addr + (xl >> PWSH); \ + if (((xl & PIM) + width) < PPW) \ { \ maskpartialbits(xl, width, startmask); \ UPDRW(addrl,startmask); \ Index: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c:1.6 xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c:1.6 Tue May 15 06:19:43 2001 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.6 2001/05/15 10:19:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.7 2003/02/18 21:29:59 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -120,7 +120,7 @@ int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ - unsigned char *pglyphBase; /* start of array of glyphs */ + pointer pglyphBase; /* start of array of glyphs */ { ExtentInfoRec info; /* used by QueryGlyphExtents() */ xRectangle backrect;/* backing rectangle to paint. @@ -136,7 +136,7 @@ FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) { miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } else { - void (* oldFillArea)(); + ppcPrivGC *pPrivGC; int oldfillStyle, oldfg, oldalu; if (!(pGC->planemask & 0x0F)) @@ -149,36 +149,24 @@ backrect.width = info.overallWidth; backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + + pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr; + oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */ + oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */ + oldalu = pPrivGC->colorRrop.alu; /* GJA */ - oldFillArea = ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - FillArea; - oldfillStyle = ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.fillStyle; /* GJA */ - oldfg = ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.fgPixel; /* GJA */ - oldalu = ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.alu; /* GJA */ - - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - FillArea = xf4bppAreaFill; - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.fillStyle = FillSolid; /* GJA */ - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.fgPixel = pGC->bgPixel; /* GJA */ + pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */ + pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */ pGC->fgPixel = pGC->bgPixel; - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.alu = GXcopy; /* GJA */ + pPrivGC->colorRrop.alu = GXcopy; /* GJA */ pGC->alu = GXcopy; /* Required fields: - * colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel, FillArea + * colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel */ xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect); - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - FillArea = oldFillArea; - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.fgPixel = oldfg; /* GJA */ + pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */ pGC->fgPixel = oldfg; /* the faint-hearted can open their eyes now */ @@ -186,10 +174,8 @@ DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,&info)) - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.fillStyle = oldfillStyle; /* GJA */ - ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))-> - colorRrop.alu = oldalu; /* GJA */ + pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */ + pPrivGC->colorRrop.alu = oldalu; /* GJA */ pGC->alu = oldalu; } @@ -279,8 +265,8 @@ case rgnOUT: break; case rgnIN: - pdstBase = pdstBase + (widthDst * y) + (x >> 5); - xchar = x & 0x1f; + pdstBase = pdstBase + (widthDst * y) + (x >> PWSH); + xchar = x & PIM; while(nglyph--) { @@ -297,18 +283,18 @@ for left edge of glyph */ xoff = xchar + pci->metrics.leftSideBearing; - if (xoff > 31) + if (xoff > PIM) { pdst++; - xoff &= 0x1f; + xoff &= PIM; } else if (xoff < 0) { - xoff += 32; + xoff += PPW; pdst--; } - if ((xoff + w) <= 32) + if ((xoff + w) <= PPW) { /* glyph all in one longword */ maskpartialbits(xoff, w, startmask); @@ -325,7 +311,7 @@ { /* glyph crosses longword boundary */ maskPPWbits(xoff, w, startmask, endmask); - nFirst = 32 - xoff; + nFirst = PPW - xoff; while (h--) { getleftbits(pglyph, w, tmpSrc); @@ -339,14 +325,14 @@ /* update character origin */ x += pci->metrics.characterWidth; xchar += pci->metrics.characterWidth; - if (xchar > 31) + if (xchar > PLST) { - xchar -= 32; + xchar -= PPW; pdstBase++; } else if (xchar < 0) { - xchar += 32; + xchar += PPW; pdstBase--; } ppci++; @@ -371,9 +357,9 @@ if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS)))) return; - pdstBase = pdstBase + (widthDst * y) + (x >> 5); + pdstBase = pdstBase + (widthDst * y) + (x >> PWSH); xpos = x; - xchar = xpos & 0x1f; + xchar = xpos & PIM; for (i=0; i<nglyph; i++) { @@ -390,14 +376,14 @@ xpos += pci->metrics.characterWidth; xchar += pci->metrics.characterWidth; - if (xchar > 31) + if (xchar > PLST) { - xchar &= 0x1f; + xchar &= PIM; pdstBase++; } else if (xchar < 0) { - xchar += 32; + xchar += PPW; pdstBase--; } } @@ -468,18 +454,18 @@ (pci->metrics.leftSideBearing); getWidth = w + glyphCol; xoff = xchar + (leftEdge - ppos[i].xpos); - if (xoff > 31) + if (xoff > PLST) { - xoff &= 0x1f; + xoff &= PIM; pdst++; } else if (xoff < 0) { - xoff += 32; + xoff += PPW; pdst--; } - if ((xoff + w) <= 32) + if ((xoff + w) <= PPW) { maskpartialbits(xoff, w, startmask); while (h--) @@ -493,7 +479,7 @@ else { maskPPWbits(xoff, w, startmask, endmask); - nFirst = 32 - xoff; + nFirst = PPW - xoff; while (h--) { getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); Index: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c:1.3 Sun Jun 6 04:48:56 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c,v 1.3 1999/06/06 08:48:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbline.c,v 1.4 2002/01/25 21:56:22 tsi Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium @@ -688,7 +688,7 @@ unclippedlen++; dashIndexTmp = dashIndex; dashOffsetTmp = dashOffset; - xf4bppBresD (fgink, bgink, + xf4bppBresD (pDrawable, fgink, bgink, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp, isDoubleDash, addrl, nlwidth, @@ -696,7 +696,7 @@ e, e1, e2, unclippedlen); break; #else - xf4bppBresD (fgink, bgink, + xf4bppBresD (pDrawable, fgink, bgink, &dashIndex, pDash, numInDashList, &dashOffset, isDoubleDash, addrl, nlwidth, @@ -761,7 +761,7 @@ } else err = e; - xf4bppBresD (fgink, bgink, + xf4bppBresD (pDrawable, fgink, bgink, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp, isDoubleDash, addrl, nlwidth, Index: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c:1.4 Sat Sep 25 10:38:15 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c,v 1.4 1999/09/25 14:38:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbzerarc.c,v 1.5 2003/02/18 21:29:59 tsi Exp $ */ /************************************************************ @@ -71,19 +71,19 @@ #define PixelateWhite(addr,off) \ { \ - register int *tmpaddr = &((addr)[(off)>>5]); \ - UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & 0x1f))); \ + register int *tmpaddr = &((addr)[(off)>>PWSH]); \ + UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & PIM))); \ } #define PixelateBlack(addr,off) \ { \ - register int *tmpaddr = &((addr)[(off)>>5]); \ - UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & 0x1f)))); \ + register int *tmpaddr = &((addr)[(off)>>PWSH]); \ + UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & PIM)))); \ } #define Pixelate(base,off) \ { \ - paddr = base + ((off)>>5); \ - pmask = SCRRIGHT(LEFTMOST, (off) & 0x1f); \ + paddr = base + ((off)>>PWSH); \ + pmask = SCRRIGHT(LEFTMOST, (off) & PIM); \ UPDRW(paddr,(pixel & pmask)); \ } Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c:1.3 Sun Jun 6 04:48:57 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c,v 1.3 1999/06/06 08:48:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcArea.c,v 1.4 2003/02/18 21:29:59 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -36,7 +36,7 @@ #include "ibmTrace.h" void -xf4bppAreaFill( pWin, nboxes, pBox, pGC ) +xf4bppFillArea( pWin, nboxes, pBox, pGC ) register WindowPtr pWin ; register int nboxes ; register BoxPtr pBox ; @@ -47,22 +47,22 @@ unsigned long int fg, bg, pm ; int xSrc, ySrc ; PixmapPtr pPixmap ; +ppcPrivGC *pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr; -TRACE( ( "xf4bppAreaFill(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ; +TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ; -if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop - || !nboxes ) +if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes ) return ; xSrc = pGC->patOrg.x + pWin->drawable.x ; ySrc = pGC->patOrg.y + pWin->drawable.y ; -pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ; -fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fgPixel ; -bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.bgPixel ; +pm = pPrivGC->colorRrop.planemask ; +fg = pPrivGC->colorRrop.fgPixel ; +bg = pPrivGC->colorRrop.bgPixel ; nboxes++ ; -switch ( ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fillStyle ) { +switch ( pPrivGC->colorRrop.fillStyle ) { case FillTiled: for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ ) if ( ( w = pBox->x2 - ( x = pBox->x1 ) ) @@ -92,5 +92,4 @@ break ; } -return ; } Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c:1.4 Sat Sep 25 10:38:16 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c,v 1.4 1999/09/25 14:38:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcFillRct.c,v 1.5 2003/02/18 21:29:59 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -84,7 +84,7 @@ int xorg, yorg; mfbPrivGC *priv; /* int alu; */ - void (* pfn) (); +/* mfbFillAreaProcPtr pfn; */ /* PixmapPtr ppix; */ if (!(pGC->planemask & 0x0F)) /* GJA */ @@ -92,7 +92,7 @@ priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; /* alu = priv->ropFillArea; */ - pfn = priv->FillArea; +/* pfn = priv->FillArea; */ /* ppix = pGC->pRotatedPixmap; */ prgnClip = pGC->pCompositeClip; @@ -214,7 +214,8 @@ } } if (pboxClipped != pboxClippedBase) - (*pfn) (pDrawable,pboxClipped-pboxClippedBase, pboxClippedBase, pGC); + xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase, + pboxClippedBase, pGC); if (pboxClippedBase != stackRects) DEALLOCATE_LOCAL(pboxClippedBase); } Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c:1.7 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c:1.8 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c:1.7 Sat Oct 27 23:34:06 2001 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c,v 1.7 2001/10/28 03:34:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c,v 1.8 2003/02/18 21:29:59 tsi Exp $ */ /* Copyright (c) 1987 X Consortium @@ -96,7 +96,8 @@ xf4bppDestroyGC, xf4bppChangeClip, xf4bppDestroyClip, - xf4bppCopyClip + xf4bppCopyClip, + { NULL } }; @@ -105,7 +106,7 @@ 0, /* unsigned char ropOpStip */ 0, /* unsigned char ropFillArea */ {0, }, /* unsigned char unused[sizeof(long) - 3] */ - xf4bppAreaFill, /* void (* FillArea)() */ + NULL, /* mfbFillAreaProcPtr FillArea */ { VGA_ALLPLANES, /* unsigned long planemask */ 1, /* unsigned long fgPixel */ @@ -136,7 +137,7 @@ miPolyText16, /* int (* PolyText16)() */ miImageText8, /* void (* ImageText8)() */ miImageText16, /* void (* ImageText16)() */ - (void (*)())xf4bppImageGlyphBlt, /* GJA -- void (* ImageGlyphBlt)() */ + xf4bppImageGlyphBlt, /* GJA -- void (* ImageGlyphBlt)() */ miPolyGlyphBlt, /* GJA -- void (* PolyGlyphBlt)() */ miPushPixels, /* void (* PushPixels)() */ #ifdef NEED_LINEHELPER Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h:1.2 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h:1.3 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h:1.2 Sat Jul 25 12:59:34 1998 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h,v 1.2 1998/07/25 16:59:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGCstr.h,v 1.3 2003/02/18 21:29:59 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -46,6 +46,7 @@ /* $XConsortium: ppcGCstr.h /main/3 1996/02/21 17:57:42 kaleb $ */ #include "gc.h" +#include "mfb.h" typedef struct { unsigned long planemask ; @@ -67,7 +68,7 @@ unsigned char ropOpStip ; /* rop for opaque stipple */ unsigned char ropFillArea ; /* == alu, rop, or ropOpStip */ unsigned char unused[sizeof(long) - 3]; - void (* FillArea)() ; /* fills regions; look at the code */ + mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */ /* ----- END OF "DO-NOT-CHANGE" REGION ----- */ ppcReducedRrop colorRrop ; short lastDrawableType ; /* was last drawable a window or a pixmap? */ Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c:1.4 Tue Sep 26 11:57:21 2000 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c,v 1.4 2000/09/26 15:57:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcImg.c,v 1.5 2003/02/18 21:29:59 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -30,23 +30,6 @@ #include "scrnintstr.h" #include "servermd.h" -/* GETBITSPERPIXEL -- Find out how many bits per pixel are supported at - * this depth -- another helper function - */ -static int -GetBitsPerPixel -( - int depth -) -{ - register int i ; - - for ( i = screenInfo.numPixmapFormats ; i-- ; ) - if ( screenInfo.formats[i].depth == depth ) - return screenInfo.formats[i].bitsPerPixel ; - return 1 ; -} - /* Was MIGETIMAGE -- public entry for the GetImage Request * We're getting the image into a memory buffer. While we have to use GetSpans * to read a line from the device ( since we don't know what that looks like ) , @@ -73,6 +56,7 @@ unsigned long planeMask ; char * pdstLine ; { +#if 1 int depth, i, linelength, width ; DDXPointRec pt ; char *pbits ; @@ -81,11 +65,6 @@ GCPtr pGC ; char *pDst = pdstLine ; -#if 0 - miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ; - return; -#endif - depth = pDraw->depth ; if ( format == ZPixmap ) { linelength = PixmapBytePad( w, depth ) ; @@ -134,7 +113,6 @@ } } else +#endif miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ; - - return ; } Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c:1.3 Sun Jun 6 04:49:06 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c,v 1.3 1999/06/06 08:49:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaBitBlt.c,v 1.4 2002/01/25 21:56:22 tsi Exp $ */ /* GJA -- span move routines */ @@ -136,6 +136,7 @@ int writeplanes; /* planes */ int x0, y0, x1, y1, w, h; { + IOADDRESS REGBASE; int plane, bit; if ( !w || !h ) return; @@ -145,6 +146,9 @@ return; } + REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; + /* 0x7, not WMASK: it is hardware dependant */ if ( ((x0 - x1) & 0x7) || (alu != GXcopy) ) { /* Use slow copy */ @@ -405,6 +409,8 @@ int alu; int planes; { + IOADDRESS REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; int plane, bit; if ( ((x1 & WMASK) + w) <= WORDSZ ) { Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c:1.3 Sun Jun 6 04:49:06 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c,v 1.3 1999/06/06 08:49:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaGC.c,v 1.4 2003/02/18 21:29:59 tsi Exp $ */ /* Copyright (c) 1987 X Consortium @@ -83,7 +83,6 @@ register ppcPrivGCPtr devPriv ; { if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) { - devPriv->FillArea = mfbSolidInvertArea ; pGC->ops->CopyArea = miCopyArea ; pGC->ops->PolyFillRect = miPolyFillRect ; pGC->ops->PushPixels = miPushPixels ; @@ -92,7 +91,6 @@ pGC->ops->PolySegment = miPolySegment ; } else { - devPriv->FillArea = xf4bppAreaFill ; pGC->ops->CopyArea = xf4bppCopyArea ; pGC->ops->PolyFillRect = xf4bppPolyFillRect ; pGC->ops->PushPixels = miPushPixels ; /* GJA */ Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c:1.3 Sun Jun 6 04:49:07 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c,v 1.3 1999/06/06 08:49:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaImages.c,v 1.4 2002/01/25 21:56:22 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -46,6 +46,7 @@ const int alu ; const unsigned long int planes ; { +IOADDRESS REGBASE; register unsigned long int tmp ; register const unsigned char *src ; register volatile unsigned char *dst ; @@ -72,6 +73,9 @@ unsigned short ROP_value; #endif + REGBASE = 0x300 + + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase; + switch ( alu ) { case GXclear: /* 0x0 Zero 0 */ case GXinvert: /* 0xa NOT dst */ @@ -270,6 +274,7 @@ static unsigned long int read8Z ( + IOADDRESS REGBASE, register volatile unsigned char *screen_ptr ) { @@ -350,6 +355,7 @@ register unsigned char *data ; int RowIncrement ; { +IOADDRESS REGBASE; register unsigned long int tmp ; register volatile unsigned char *src ; volatile unsigned char *masterSrc ; @@ -371,10 +377,13 @@ if ( ( lx <= 0 ) || ( ly <= 0 ) ) return ; + REGBASE = 0x300 + + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase; + /* Setup VGA Registers */ #ifndef PC98_EGC SetVideoGraphicsIndex( Graphics_ModeIndex ) ; -tmpc = inb( 0x3CF ); +tmpc = inb( GraphicsDataRegister ); SetVideoGraphicsData( tmpc & ~0x8 ) ; /* Clear the bit */ SetVideoGraphicsIndex( Read_Map_SelectIndex ) ; #else @@ -393,7 +402,7 @@ if ( center_width < 0 ) { src = masterSrc; for ( ; ly-- ; ) { - tmp = read8Z( src ) >> ( skip << 2 ) ; + tmp = read8Z( REGBASE, src ) >> ( skip << 2 ) ; for ( dx = lx + 1 ; --dx ; ) { SINGLE_STEP ; } @@ -406,7 +415,7 @@ center_width = savCenterWidth, masterSrc += BYTES_PER_LINE(pWin) ) { src = masterSrc ; - tmp = read8Z( src ) ; src++; + tmp = read8Z( REGBASE, src ) ; src++; if ((dx = skip)) tmp >>= ( dx << 2 ) ; else @@ -429,13 +438,13 @@ /* Fall Through To End Of Inner Loop */ if ( center_width > 0 ) { - tmp = read8Z( src ) ; src++; + tmp = read8Z( REGBASE, src ) ; src++; center_width-- ; goto LoopTop ; } else if ( ( center_width == 0 ) && ( dx = ( - ignore ) & 07 ) ) { - tmp = read8Z( src ) ; src++; + tmp = read8Z( REGBASE, src ) ; src++; center_width-- ; goto BranchPoint ; /* Do Mod 8 edge */ } Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h:1.3 Sun Jun 6 04:49:07 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h,v 1.3 1999/06/06 08:49:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaReg.h,v 1.4 2002/01/25 21:56:22 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -35,7 +35,9 @@ SET_BYTE_REGISTER((RegGroup) + 1, Value)) /* There is a jumper on the ega to change this to 0x200 instead !! */ +#if 0 /* This is now a stack variable, as needed */ #define REGBASE 0x300 +#endif #define AttributeIndexRegister REGBASE + 0xC0 #define AttributeDataWriteRegister REGBASE + 0xC0 Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c:1.4 Tue Jul 31 20:44:56 2001 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c,v 1.4 2001/08/01 00:44:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c,v 1.5 2002/01/25 21:56:22 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -170,6 +170,7 @@ register int lx ; register const int ly ; /* MUST BE > 0 !! */ { +IOADDRESS REGBASE; register volatile unsigned char *dst ; register int tmp ; register int tmp2 ; @@ -242,6 +243,9 @@ if ( !( planes &= VGA_ALLPLANES ) ) return ; + +REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; /* * Set The Plane-Enable Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.4 Tue Jul 31 20:44:56 2001 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c Fri Jan 25 16:56:22 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c,v 1.4 2001/08/01 00:44:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c,v 1.5 2002/01/25 21:56:22 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -111,6 +111,8 @@ int yshift ) { +IOADDRESS REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; register volatile unsigned char *xDst ; register VideoAdapterObject tmp2 ; register int NeedValX ; @@ -283,6 +285,8 @@ int yshift ) { +IOADDRESS REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; register volatile unsigned char *xDst ; register VideoAdapterObject tmp2 ; register int NeedValX ; @@ -477,10 +481,13 @@ static void vgaSetMonoRegisters ( + DrawablePtr pDrawable, register unsigned long int plane_mask, register unsigned long int desiredState ) { +IOADDRESS REGBASE = + xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300; #ifndef PC98_EGC /* Setup VGA Registers */ /* @@ -632,7 +639,7 @@ #endif -vgaSetMonoRegisters( planes, regState ) ; +vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ; DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h, w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ; @@ -677,7 +684,7 @@ #endif -vgaSetMonoRegisters( planes, regState ) ; +vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ; /* Figure Bit Offsets & Source Address */ width = pStipple->drawable.width ; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c:1.3 Sun Jun 6 04:49:08 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c Fri Jan 25 16:56:23 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c,v 1.3 1999/06/06 08:49:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/wm3.c,v 1.4 2002/01/25 21:56:23 tsi Exp $ */ @@ -10,6 +10,7 @@ #include "OScompiler.h" #include "wm3.h" #include "vgaVideo.h" +#include "xf86.h" /* Ferraro is wrong. GJA */ #define COPY (0 << 3) @@ -22,6 +23,7 @@ GC *pGC; { #ifndef PC98_EGC + IOADDRESS REGBASE = xf86Screens[pGC->pScreen->myNum]->domainIOBase + 0x300; int post_invert = 0; int ALU; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.6 xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.8 --- xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.6 Thu Mar 8 12:12:17 2001 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h Tue Feb 18 16:29:59 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.6 2001/03/08 17:12:17 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.8 2003/02/18 21:29:59 tsi Exp $ */ #ifndef __XF4BPP_H__ @@ -14,7 +14,7 @@ #endif /* ppcArea.c */ -void xf4bppAreaFill( +void xf4bppFillArea( #if NeedFunctionPrototypes WindowPtr, int, @@ -627,7 +627,7 @@ int, unsigned int, CharInfoPtr *, - unsigned char * + pointer #endif ); @@ -732,6 +732,7 @@ /* mfbbresd.c */ void xf4bppBresD( #if NeedFunctionPrototypes + DrawablePtr, int, int, int *, unsigned char *, Index: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.20 xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.22 --- xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.20 Mon Jul 9 19:45:24 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile Wed Feb 26 15:08:03 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.20 2001/07/09 23:45:24 paulo Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.22 2003/02/26 20:08:03 dawes Exp $ XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic @@ -82,7 +82,7 @@ #if DoLoadableServer LOADERLIB = -L../loader -lxloader -L../dummylib -ldummy MODULEDEFINES = -DUSE_MODULES -INCLUDES = -I../common -I../loader -I$(XF86OSSRC) \ +INCLUDES = -I../common -I../scanpci -I../loader -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(FONTLIBSRC)/include #if !HasSnprintf @@ -96,11 +96,16 @@ CURSESDEFINES = -DHAS_NCURSES #endif +#if HasGlibc21Sigsetjmp +SETJMPDEFINES = -DHAS_GLIBC_SIGSETJMP=1 +#endif + XF86CONFIGFILE = XConfigFile XF86CONFIGDIR = XConfigDir DEFINES = -DXF86CONFIG=\"$(XF86CONFIGFILE)\" $(MODULEDEFINES) \ - $(CURSESDEFINES) -DPROJECT_ROOT=\"$(PROJECTROOT)\" \ + $(CURSESDEFINES) $(SETJMPDEFINES) \ + -DPROJECT_ROOT=\"$(PROJECTROOT)\" \ -DXF86CONFIGDIR=\"$(XF86CONFIGDIR)\" XFree86ConsoleDefines #if HasDlopen Index: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c:1.9 xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c:1.10 --- xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c:1.9 Fri Mar 2 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c Thu Dec 5 14:31:18 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.9 2001/03/02 22:39:27 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.10 2002/12/05 19:31:18 paulo Exp $ */ #include "config.h" @@ -96,21 +96,23 @@ { InitializeKeyboard(); - XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - if (xkb_info->xkb->ctrls == NULL) - xkb_info->xkb->ctrls = (XkbControlsPtr) - XtCalloc(1, sizeof(XkbControlsRec)); - - xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask | - XkbMouseKeysAccelMask; - xkb_info->xkb->ctrls->mk_delay = 40; - xkb_info->xkb->ctrls->mk_interval = 10; - xkb_info->xkb->ctrls->mk_time_to_max = 1000; - xkb_info->xkb->ctrls->mk_max_speed = 500; - xkb_info->xkb->ctrls->mk_curve = 0; - XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - (void)UpdateKeyboard(True); - CreateAccessXHelpDialog(); + if (xkb_info->xkb) { + XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb); + if (xkb_info->xkb->ctrls == NULL) + xkb_info->xkb->ctrls = (XkbControlsPtr) + XtCalloc(1, sizeof(XkbControlsRec)); + + xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask | + XkbMouseKeysAccelMask; + xkb_info->xkb->ctrls->mk_delay = 40; + xkb_info->xkb->ctrls->mk_interval = 10; + xkb_info->xkb->ctrls->mk_time_to_max = 1000; + xkb_info->xkb->ctrls->mk_max_speed = 500; + xkb_info->xkb->ctrls->mk_curve = 0; + XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); + (void)UpdateKeyboard(True); + CreateAccessXHelpDialog(); + } } void Index: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c:1.11 xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c:1.15 --- xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c:1.11 Sat Oct 27 23:34:06 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c Sat Feb 15 00:37:58 2003 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c,v 1.11 2001/10/28 03:34:06 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c,v 1.15 2003/02/15 05:37:58 paulo Exp $ */ #define CARDS_PRIVATE @@ -83,22 +83,21 @@ * Implementation */ #ifdef USE_MODULES -pciVendorDeviceInfo *xf86PCIVendorInfo; -SymTabPtr xf86PCIVendorNameInfo; +const pciVendorInfo *xf86PCIVendorInfo; #endif #ifdef USE_MODULES void InitializePciInfo(void) { - xf86PCIVendorInfo = xf86PCIVendorInfoData; - xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData; + xf86PCIVendorInfo = pciVendorInfoList; } void CheckChipsets(xf86cfgModuleOptions *opts, int *err) { - int i, j, ichk, ivnd, vendor = -1, device; + int i, j, ichk, ivnd = 0, vendor = -1, device; + const pciDeviceInfo **pDev; SymTabPtr chips = opts->chipsets; chipset_check *check = NULL; int num_check = 0; @@ -127,11 +126,13 @@ ++num_check; } - /* Search for vendor in xf86PCIVendorInfoData */ - for (ivnd = 0; xf86PCIVendorInfoData[ivnd].VendorID; ivnd++) - if (vendor == xf86PCIVendorInfoData[ivnd].VendorID) - break; - if (xf86PCIVendorInfoData[ivnd].VendorID) { + /* Search for vendor in xf86PCIVendorInfo */ + if (xf86PCIVendorInfo) { + for (ivnd = 0; xf86PCIVendorInfo[ivnd].VendorID; ivnd++) + if (vendor == xf86PCIVendorInfo[ivnd].VendorID) + break; + } + if (xf86PCIVendorInfo && xf86PCIVendorInfo[ivnd].VendorID) { check[ichk].valid_vendor = 1; check[ichk].ivendor = ivnd; } @@ -144,31 +145,33 @@ continue; } - if (check[ichk].chipsets == NULL) { - for (j = 0; xf86PCIVendorInfoData[ivnd].Device[j].DeviceName; j++) - ; - check[ichk].chipsets = (char*)XtCalloc(1, j); - } - for (j = 0; xf86PCIVendorInfoData[ivnd].Device[j].DeviceName; j++) { - if (device == xf86PCIVendorInfoData[ivnd].Device[j].DeviceID) { - if (strcmp(chips->name, xf86PCIVendorInfoData[ivnd].Device[j].DeviceName)) { - CheckMsg(CHECKER_NOMATCH_CHIPSET_STRINGS, + if (xf86PCIVendorInfo && + (pDev = xf86PCIVendorInfo[ivnd].Device) != NULL) { + if (check[ichk].chipsets == NULL) { + for (j = 0; pDev[j]; j++) + ; + check[ichk].chipsets = (char*)XtCalloc(1, j); + } + for (j = 0; pDev[j]; j++) { + if (device == pDev[j]->DeviceID) { + if (strcmp(chips->name, pDev[j]->DeviceName)) { + CheckMsg(CHECKER_NOMATCH_CHIPSET_STRINGS, "WARNING chipset strings don't match: \"%s\" \"%s\" (0x%x)\n", - chips->name, xf86PCIVendorInfoData[ivnd].Device[j].DeviceName, + chips->name, xf86PCIVendorInfo[ivnd].Device[j]->DeviceName, device); - ++*err; + ++*err; + } + break; } - break; } - } - if (!xf86PCIVendorInfoData[ivnd].Device[j].DeviceName) { - CheckMsg(CHECKER_CHIPSET_NOT_LISTED, + if (!pDev[j]) { + CheckMsg(CHECKER_CHIPSET_NOT_LISTED, "WARNING chipset \"%s\" (0x%x) not in list.\n", chips->name, device); - ++*err; + ++*err; + } + else + check[ichk].chipsets[j] = 1; } - else - check[ichk].chipsets[j] = 1; - ++chips; } @@ -179,11 +182,11 @@ ++*err; } for (j = 0; j < check[i].num_chipsets; j++) { - if (!check[i].chipsets[j]) { + if (xf86PCIVendorInfo && !check[i].chipsets[j]) { CheckMsg(CHECKER_CHIPSET_NOT_SUPPORTED, "NOTICE chipset \"%s\" (0x%x) not listed as supported.\n", - xf86PCIVendorInfoData[check[i].ivendor].Device[j].DeviceName, - xf86PCIVendorInfoData[check[i].ivendor].Device[j].DeviceID); + xf86PCIVendorInfo[check[i].ivendor].Device[j]->DeviceName, + xf86PCIVendorInfo[check[i].ivendor].Device[j]->DeviceID); } } XtFree(check[i].chipsets); @@ -203,6 +206,7 @@ _Xconst char *vendor, *device; CardsEntry *entry = NULL, *tmp; xf86cfgModuleOptions *opts = module_options; + const pciDeviceInfo **pDev; /* Only list cards that have a driver installed */ while (opts) { @@ -217,22 +221,21 @@ if (ivendor == 0) ivendor = opts->vendor; - for (i = 0; xf86PCIVendorInfoData[i].VendorID; i++) - if (ivendor == xf86PCIVendorInfoData[i].VendorID) - break; - if (xf86PCIVendorInfoData[i].VendorID) { - for (j = 0; xf86PCIVendorNameInfoData[j].name; j++) - if (xf86PCIVendorNameInfoData[j].token == ivendor) { - vendor = xf86PCIVendorNameInfoData[j].name; + if (xf86PCIVendorInfo) { + for (i = 0; xf86PCIVendorInfo[i].VendorName; i++) + if (ivendor == xf86PCIVendorInfo[i].VendorID) { + vendor = xf86PCIVendorInfo[i].VendorName; break; } - - for (j = 0; xf86PCIVendorInfoData[i].Device[j].DeviceName; j++) - if (idevice == xf86PCIVendorInfoData[i].Device[j].DeviceID) - break; - - if (xf86PCIVendorInfoData[i].Device[j].DeviceName) - device = xf86PCIVendorInfoData[i].Device[j].DeviceName; + if (xf86PCIVendorInfo[i].VendorName) { + if ((pDev = xf86PCIVendorInfo[i].Device)) { + for (j = 0; pDev[j]; j++) + if (idevice == pDev[j]->DeviceID) { + device = pDev[j]->DeviceName; + break; + } + } + } } /* Since frequently there is more than one driver for a Index: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h:1.2 xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h:1.3 --- xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h:1.2 Thu Jul 5 22:04:10 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h Mon Jul 15 16:46:04 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h,v 1.2 2001/07/06 02:04:10 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h,v 1.3 2002/07/15 20:46:04 dawes Exp $ */ #include <stdio.h> @@ -45,10 +45,8 @@ #ifdef CARDS_PRIVATE #include "loader.h" -#define SELF_CONTAINED_PCI_INFO -#define INIT_PCI_VENDOR_NAME_INFO -#define INIT_PCI_VENDOR_INFO -#include "xf86PciInfo.h" +#include "xf86PciStr.h" +#include "xf86PciIds.h" #endif /* CARDS_PRIVATE */ #endif /* USE_MODULES */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/config.c:1.7 xc/programs/Xserver/hw/xfree86/xf86cfg/config.c:1.8 --- xc/programs/Xserver/hw/xfree86/xf86cfg/config.c:1.7 Mon Oct 1 09:44:15 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/config.c Mon Oct 21 00:18:36 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c,v 1.7 2001/10/01 13:44:15 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c,v 1.8 2002/10/21 04:18:36 paulo Exp $ */ #include "config.h" @@ -116,8 +116,21 @@ /* Read initial configuration */ if ((filename = xf86openConfigFile(getuid() == 0 ? CONFPATH : USER_CONFPATH, XF86Config_path, NULL)) == NULL) { - fprintf(stderr, "Cannot open config file.\n"); - exit(1); + int length = XF86Config_path ? strlen(XF86Config_path) : -1; + + if (length > 2 && + XF86Config_path[length - 2] == '-' && + XF86Config_path[length - 1] == '4') { + XF86Config_path[length - 2] = '\0'; + filename = xf86openConfigFile(getuid() == 0 ? + CONFPATH : USER_CONFPATH, + XF86Config_path, NULL); + } + + if (filename == NULL) { + fprintf(stderr, "Cannot open config file.\n"); + exit(1); + } } XF86Config_path = (char *)filename; if ((XF86Config = xf86readConfigFile()) == NULL) { Index: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.15 xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.16 --- xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.15 Fri Aug 17 18:08:15 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/config.h Fri May 31 14:46:03 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.15 2001/08/17 22:08:15 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.16 2002/05/31 18:46:03 dawes Exp $ */ #include <X11/IntrinsicP.h> @@ -43,7 +43,7 @@ #include <stdarg.h> -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define strcasecmp stricmp #define setenv putenv #define PATH_MAX 260 Index: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.12 xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.14 --- xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.12 Sat Jul 7 20:44:33 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c Fri Feb 7 00:46:53 2003 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.12 2001/07/08 00:44:33 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.14 2003/02/07 05:46:53 paulo Exp $ */ #include "config.h" @@ -433,7 +433,7 @@ InitializeVidmodes(); if (save_config_mode != CONFIG_LAYOUT) - SetConfigModeCallback(topMenu, (XtPointer)save_config_mode, NULL); + SetConfigModeCallback(topMenu, (XtPointer)(long)save_config_mode, NULL); } /*ARGSUSED*/ @@ -1992,11 +1992,11 @@ /* width */ XtVaGetValues(node->data->monitor.width, XtNstring, &str, NULL, 0); - node->data->monitor.monitor->mon_width = atoi(str); + node->data->monitor.monitor->mon_width = strtoul(str, NULL, 0); /* height */ XtVaGetValues(node->data->monitor.height, XtNstring, &str, NULL, 0); - node->data->monitor.monitor->mon_height = atoi(str); + node->data->monitor.monitor->mon_height = strtoul(str, NULL, 0); /* hsync */ XtVaGetValues(node->data->monitor.hsync, XtNstring, &str, NULL, 0); @@ -2613,7 +2613,7 @@ /* videoRam */ XtVaGetValues(node->data->device.videoRam, XtNstring, &str, NULL, 0); - node->data->device.device->dev_videoram = atoi(str); + node->data->device.device->dev_videoram = strtoul(str, NULL, 0); /* textClockFreq */ XtVaGetValues(node->data->device.textClockFreq, XtNstring, &str, NULL, 0); @@ -2656,28 +2656,28 @@ /* chipId */ XtVaGetValues(node->data->device.chipId, XtNstring, &str, NULL, 0); if (*str) - node->data->device.device->dev_chipid = atoi(str); + node->data->device.device->dev_chipid = strtoul(str, NULL, 0); else node->data->device.device->dev_chipid = -1; /* chipRev */ XtVaGetValues(node->data->device.chipRev, XtNstring, &str, NULL, 0); if (*str) - node->data->device.device->dev_chiprev = atoi(str); + node->data->device.device->dev_chiprev = strtoul(str, NULL, 0); else node->data->device.device->dev_chiprev = -1; /* irq */ XtVaGetValues(node->data->device.irq, XtNstring, &str, NULL, 0); if (*str) - node->data->device.device->dev_irq = atoi(str); + node->data->device.device->dev_irq = strtoul(str, NULL, 0); else node->data->device.device->dev_irq = -1; /* screen */ XtVaGetValues(node->data->device.screen, XtNstring, &str, NULL, 0); if (*str) - node->data->device.device->dev_screen = atoi(str); + node->data->device.device->dev_screen = strtoul(str, NULL, 0); else node->data->device.device->dev_screen = -1; } @@ -2917,15 +2917,15 @@ /* defautDepth */ XtVaGetValues(node->data->screen.defaultDepth, XtNstring, &str, NULL, 0); - node->data->screen.screen->scrn_defaultdepth = atoi(str); + node->data->screen.screen->scrn_defaultdepth = strtoul(str, NULL, 0); /* defautBpp */ XtVaGetValues(node->data->screen.defaultBpp, XtNstring, &str, NULL, 0); - node->data->screen.screen->scrn_defaultbpp = atoi(str); + node->data->screen.screen->scrn_defaultbpp = strtoul(str, NULL, 0); /* defautFbBpp */ XtVaGetValues(node->data->screen.defaultFbBpp, XtNstring, &str, NULL, 0); - node->data->screen.screen->scrn_defaultfbbpp = atoi(str); + node->data->screen.screen->scrn_defaultfbbpp = strtoul(str, NULL, 0); /* XXX Monitor and Device should be changed to a menu interface */ @@ -3254,11 +3254,11 @@ /* depth */ XtVaGetValues(node->data->display.depth, XtNstring, &str, NULL, 0); - node->data->display.display->disp_depth = atoi(str); + node->data->display.display->disp_depth = strtoul(str, NULL, 0); /* bpp */ XtVaGetValues(node->data->display.bpp, XtNstring, &str, NULL, 0); - node->data->display.display->disp_bpp = atoi(str); + node->data->display.display->disp_bpp = strtoul(str, NULL, 0); /* visual */ XtVaGetValues(node->data->display.visual, XtNstring, &str, NULL, 0); @@ -3923,8 +3923,8 @@ XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL, 0); XtVaGetValues(node->data->adjacency.adjy, XtNstring, &y, NULL, 0); - adj->adj_x = atoi(x); - adj->adj_y = atoi(y); + adj->adj_x = strtol(x, NULL, 0); + adj->adj_y = strtol(y, NULL, 0); if (strcmp(XtName(w), "absolute") == 0) { XtVaSetValues(node->data->adjacency.button, XtNlabel, "", NULL, 0); @@ -4365,7 +4365,7 @@ /* group */ XtVaGetValues(node->data->dri.group, XtNstring, &str, NULL, 0); if (*str) - node->data->dri.dri->dri_group = atoi(str); + node->data->dri.dri->dri_group = strtoul(str, NULL, 0); else node->data->dri.dri->dri_group = -1; @@ -4488,11 +4488,11 @@ /* count */ XtVaGetValues(node->data->buffers.count, XtNstring, &str, NULL, 0); - node->data->buffers.buffers->buf_count = atoi(str); + node->data->buffers.buffers->buf_count = strtoul(str, NULL, 0); /* size */ XtVaGetValues(node->data->buffers.size, XtNstring, &str, NULL, 0); - node->data->buffers.buffers->buf_size = atoi(str); + node->data->buffers.buffers->buf_size = strtoul(str, NULL, 0); /* flags */ XtVaGetValues(node->data->buffers.flags, XtNstring, &str, NULL, 0); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.6 xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.6 Sat Oct 27 23:34:06 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/help.c Thu Jun 6 17:03:32 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.6 2001/10/28 03:34:06 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.7 2002/06/06 21:03:32 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -58,9 +58,6 @@ * Initialization */ static Widget shell, text; -extern Widget toplevel; -extern Display *DPY; -extern Atom wm_delete_window; static Bool popped_up = False; /* Index: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.33 xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.37 --- xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.33 Fri Nov 30 07:12:04 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c Mon Oct 21 00:18:36 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.33 2001/11/30 12:12:04 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.37 2002/10/21 04:18:36 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -298,9 +298,12 @@ startedx = startx(); if (XF86Config_path == NULL) - XF86Config_path = "XF86Config-4"; - if (XkbConfig_path == NULL) - XkbConfig_path = XkbConfigDir XkbConfigFile; + XF86Config_path = XtNewString("XF86Config-4"); + if (XkbConfig_path == NULL) { + XmuSnprintf(XkbConfig_path_static, sizeof(XkbConfig_path_static), + "%s/%s%s", XFree86Dir, XkbConfigDir, XkbConfigFile); + XkbConfig_path = XkbConfig_path_static; + } toplevel = XtAppInitialize(&appcon, "XF86Cfg", NULL, 0, &argc, argv, @@ -501,7 +504,7 @@ char path[PATH_MAX]; XmuSnprintf(path, sizeof(path), "%s/bin/twm", XFree86Dir); - execl(path, "twm", NULL); + execl(path, "twm", (void *)NULL); exit(-127); } break; case -1: @@ -597,7 +600,7 @@ XSetWMProtocols(DPY, XtWindow(shell_cf), &wm_delete_window, 1); XtSetArg(args[0], XtNlabel, &l); XtGetValues(dialog, args, 1); - label = XtMalloc(len = (strlen(l) + strlen(XF86CONFIG) + 1)); + label = XtMalloc(len = (strlen(l) + strlen(XF86CONFIG) + 2)); XmuSnprintf(label, len, "%s\n", XF86CONFIG); strcat(label, l); XtSetArg(args[0], XtNlabel, label); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.17 xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.22 --- xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.17 Fri Nov 30 07:12:04 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c Wed Jan 1 14:22:24 2003 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.17 2001/11/30 12:12:04 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.22 2003/01/01 19:22:24 paulo Exp $ */ #include "xf86config.h" @@ -134,23 +134,24 @@ xkb_infos[num_xkb_infos++] = xkb_info; xkb_info->conf = keyboard; + bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); while (timeout > 0) { xkb_info->xkb = XkbGetKeyboard(XtDisplay(configp), XkbGBN_AllComponentsMask, XkbUseCoreKbd); - if (xkb_info->xkb == NULL || xkb_info->xkb->geom == NULL) - sleep(timeout -= 1); + if (xkb_info->xkb == NULL) { + timeout -= 1; + sleep(1); + } else break; } if (timeout <= 0) { fprintf(stderr, "Couldn't get keyboard\n"); - exit(1); } - if (xkb_info->xkb->names->geometry == 0) + if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom && + xkb_info->xkb->names->geometry == 0) xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name; - - bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); } /* check for removed devices */ @@ -294,6 +295,7 @@ XtFree(option->opt_val); option->opt_val = XtNewString(rules); XtFree(option->opt_comment); + option->opt_comment = NULL; } else keyboard->inp_option_lst = @@ -305,6 +307,7 @@ XtFree(option->opt_val); option->opt_val = XtNewString(model); XtFree(option->opt_comment); + option->opt_comment = NULL; } else keyboard->inp_option_lst = @@ -451,11 +454,12 @@ xkb_infos = (XkbInfo**)XtCalloc(1, sizeof(XkbInfo*)); num_xkb_infos = 1; xkb_infos[0] = xkb_info; + bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); while (timeout > 0) { xkb_info->xkb = XkbGetKeyboard(DPY, XkbGBN_AllComponentsMask, XkbUseCoreKbd); - if (xkb_info->xkb == NULL || xkb_info->xkb->geom == NULL) { + if (xkb_info->xkb == NULL) { timeout -= 1; sleep(1); } @@ -464,13 +468,11 @@ } if (timeout <= 0) { fprintf(stderr, "Couldn't get keyboard\n"); - exit(1); } - if (xkb_info->xkb->names->geometry == 0) + if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom && + xkb_info->xkb->names->geometry == 0) xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name; - bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); - /* Load configuration */ XmuSnprintf(name, sizeof(name), "%s%s", XkbConfigDir, XkbConfigFile); file = fopen(name, "r"); @@ -565,6 +567,17 @@ xkb_info->defs.options = option->opt_val; else xkb_info->defs.options = NULL; + + if (xkb_info->xkb == NULL) { + /* Try again */ + XkbComponentNamesRec comps; + + bzero((char*)&comps, sizeof(XkbComponentNamesRec)); + XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps); + + xkb_info->xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps, + XkbGBN_AllComponentsMask, 0, 0); + } } static XF86XkbRulesDescInfo * @@ -857,8 +870,9 @@ fprintf(stderr, "Couldn't get keyboard\n"); return (False); } - if (xkb->names->geometry == 0) - xkb->names->geometry = xkb->geom->name; + if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom && + xkb_info->xkb->names->geometry == 0) + xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name; XkbFreeKeyboard(xkb_info->xkb, 0, False); @@ -1084,8 +1098,6 @@ { Arg args[1]; int i; - char *oldval = xkb_info->defs.options ? - XtNewString(xkb_info->defs.options) : XtNewString(""); for (i = 0; i < xkb_rules->option.nelem; i++) if (strcmp(XtName(w), xkb_rules->option.name[i]) == 0) @@ -1136,18 +1148,15 @@ if (options == NULL) options = XtNewString(""); - xkb_info->defs.options = *options ? options : NULL; + xkb_info->defs.options = options; if (!UpdateKeyboard(False)) { - XtFree(options); - xkb_info->defs.options = *oldval ? oldval : NULL; - } - else { - XtFree(oldval); - XtSetArg(args[0], XtNlabel, options); - XtSetValues(optionsb, args, 1); - XtSetArg(args[0], XtNtip, options); - XtSetValues(optionsb, args, 1); + *options = '\0'; + xkb_info->defs.options = NULL; } + XtSetArg(args[0], XtNlabel, options); + XtSetValues(optionsb, args, 1); + XtSetArg(args[0], XtNtip, options); + XtSetValues(optionsb, args, 1); } /*ARGSUSED*/ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.18 xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.19 --- xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.18 Sat Nov 3 15:32:31 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c Thu Jun 6 17:03:32 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.18 2001/11/03 20:32:31 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.19 2002/06/06 21:03:32 paulo Exp $ */ #include "config.h" @@ -54,7 +54,6 @@ static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList, XrmRepresentation*, XrmValue*, XPointer); -extern void CheckChipsets(xf86cfgModuleOptions*, int*); static sigjmp_buf jmp; int signal_caught; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c:1.8 xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c:1.14 --- xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c:1.8 Mon Dec 31 13:15:10 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c Wed Feb 26 15:08:03 2003 @@ -26,10 +26,19 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c,v 1.8 2001/12/31 18:15:10 herrb Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c,v 1.14 2003/02/26 20:08:03 dawes Exp $ */ #ifdef USE_MODULES +#include <setjmp.h> + +#ifndef HAS_GLIBC_SIGSETJMP +#if defined(setjmp) && \ + defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 +#define HAS_GLIBC_SIGSETJMP 1 +#endif +#endif + #define LOADER_PRIVATE #include "loader.h" @@ -54,6 +63,7 @@ void xf86AddInputDriver(InputDriverPtr, pointer, int); void xf86AddModuleInfo(ModuleInfoPtr, void*); Bool xf86LoaderCheckSymbol(const char*); +void xf86LoaderRefSymLists(const char **, ...); void xf86LoaderReqSymLists(const char **, ...); void xf86Msg(int, const char*, ...); void xf86PrintChipsets(const char*, const char*, SymTabPtr); @@ -64,8 +74,9 @@ int xf86MatchIsaInstances(const char*, SymTabPtr, pointer*, DriverPtr, pointer, GDevPtr*, int, int**); void *xf86LoadDrvSubModule(DriverPtr drv, const char*); void xf86DrvMsg(int, int, const char*, ...); +pciConfigPtr *xf86GetPciConfigInfo(void); +Bool xf86IsPrimaryPci(pcVideoPtr*); #endif -void *xf86GetPciConfigInfo(void); extern char *loaderPath, **loaderList, **ploaderList; xf86cfgModuleOptions *module_options; @@ -168,7 +179,7 @@ SYMFUNC(xf86memchr) SYMFUNC(xf86memcmp) SYMFUNC(xf86memcpy) -#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__) +#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__) || defined (__x86_64__) /* * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle * structure copies. This causes a problem both here and in shared @@ -262,8 +273,17 @@ SYMFUNC(xf86shmat) SYMFUNC(xf86shmdt) SYMFUNC(xf86shmctl) +#ifdef HAS_GLIBC_SIGSETJMP SYMFUNC(xf86setjmp) - SYMFUNC(xf86longjmp) + SYMFUNCALIAS("xf86setjmp1",__sigsetjmp) +#else + SYMFUNCALIAS("xf86setjmp",setjmp) + SYMFUNC(xf86setjmp1) +#endif + SYMFUNCALIAS("xf86longjmp",longjmp) + SYMFUNC(xf86getjmptype) + SYMFUNC(xf86setjmp1_arg2) + SYMFUNC(xf86setjmperror) SYMFUNC(xf86AddDriver) SYMFUNC(xf86ServerIsOnlyDetecting) @@ -271,6 +291,7 @@ SYMFUNC(xf86AddModuleInfo) SYMFUNC(xf86LoaderCheckSymbol) + SYMFUNC(xf86LoaderRefSymLists) SYMFUNC(xf86LoaderReqSymLists) SYMFUNC(xf86Msg) SYMFUNC(ErrorF) @@ -284,6 +305,7 @@ SYMFUNC(xf86LoadDrvSubModule) SYMFUNC(xf86DrvMsg) SYMFUNC(xf86GetPciConfigInfo) + SYMFUNC(xf86IsPrimaryPci) {0,0} }; @@ -301,6 +323,17 @@ SymTabPtr ctmp; int count; + /* XXX If the module is already in the list, then it means that + * it is now being properly loaded by xf86cfg and the "fake" entry + * added in xf86cfgLoaderInitList() isn't required anymore. + * Currently: + * ati and vmware are known to fail. */ + for (ptr = module_options; ptr; ptr = ptr->next) + if (strcmp(name, ptr->name) == 0) { + fprintf(stderr, "Module %s already in list!\n", name); + return; + } + ptr = XtNew(xf86cfgModuleOptions); ptr->name = XtNewString(name); ptr->type = module_type; @@ -386,6 +419,16 @@ } LoaderSetPath(loaderPath); loaderList = LoaderListDirs(subdirs, NULL); + + /* XXX Xf86cfg isn't able to provide enough wrapper functions + * to these drivers. Maybe the drivers could also be changed + * to work better when being loaded "just for testing" */ + if (type == VideoModule) { + module_type = VideoModule; + AddModuleOptions("vmware", NULL); + AddModuleOptions("ati", NULL); + module_type = NullModule; + } } void @@ -517,6 +560,11 @@ } void +xf86LoaderRefSymLists(const char **list0, ...) +{ +} + +void xf86LoaderReqSymLists(const char **list0, ...) { } @@ -559,7 +607,8 @@ GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities) { vendor = VendorID; - chips = chipsets; + if (chips == NULL) + chips = chipsets; *foundEntities = NULL; return (0); @@ -588,9 +637,15 @@ return (ret); } -void * +pciConfigPtr * xf86GetPciConfigInfo(void) { return (NULL); +} + +Bool +xf86IsPrimaryPci(pciVideoPtr pPci) +{ + return (True); } #endif Index: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c:1.7 xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c:1.10 --- xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c:1.7 Sun Apr 22 04:36:31 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c Sat Feb 15 00:37:58 2003 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.7 2001/04/22 08:36:31 herrb Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.10 2003/02/15 05:37:58 paulo Exp $ */ #include "xf86config.h" @@ -51,23 +51,39 @@ /* * Initialization */ -static char *protocols[] = { +static struct MouseProtocol { + char *name; + int type; +} protocols[] = { +#ifdef SCO + {"OsMouse", MTYPE_AUTOMOUSE}, +#endif #ifdef WSCONS_SUPPORT - "wsmouse", + {"wsmouse", MTYPE_AUTOMOUSE}, +#endif + {"Auto", MTYPE_AUTOMOUSE}, + {"SysMouse", MTYPE_SYSMOUSE}, + {"MouseSystems", MTYPE_MOUSESYS}, + {"BusMouse", MTYPE_BUSMOUSE}, + {"PS/2", MTYPE_PS_2}, + {"Microsoft", MTYPE_MICROSOFT}, +#ifndef __FreeBSD__ + {"ImPS/2", MTYPE_IMPS2}, + {"ExplorerPS/2", MTYPE_EXPPS2}, + {"GlidePointPS/2", MTYPE_GLIDEPOINTPS2}, + {"MouseManPlusPS/2", MTYPE_MMANPLUSPS2}, + {"NetMousePS/2", MTYPE_NETPS2}, + {"NetScrollPS/2", MTYPE_NETSCROLLPS2}, + {"ThinkingMousePS/2", MTYPE_THINKINGPS2}, #endif - "Auto", - "BusMouse", - "GlidePoint", - "IntelliMouse", - "Logitech", - "Microsoft", - "MMHitTab", - "MMSeries", - "MouseMan", - "MouseSystems", - "PS/2", - "SysMouse", - "ThinkingMouse", + {"AceCad", MTYPE_ACECAD}, + {"GlidePoint", MTYPE_GLIDEPOINT}, + {"IntelliMouse", MTYPE_IMSERIAL}, + {"Logitech", MTYPE_LOGITECH}, + {"MMHitTab", MTYPE_MMHIT}, + {"MMSeries", MTYPE_MMSERIES}, + {"MouseMan", MTYPE_LOGIMAN}, + {"ThinkingMouse", MTYPE_THINKING}, }; static Widget text; @@ -253,6 +269,7 @@ static void MouseApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) { + int i; XF86MiscMouseSettings mouse; XF86MiscGetMouseSettings(XtDisplay(w), &mouse); @@ -262,32 +279,12 @@ mouse.baudrate % 1200) mouse.baudrate = 1200; - if (strcmp(protocol, "BusMouse") == 0) - mouse.type = MTYPE_BUSMOUSE; - else if (strcmp(protocol, "GlidePoint") == 0) - mouse.type = MTYPE_GLIDEPOINT; - else if (strcmp(protocol, "IntelliMouse") == 0) - mouse.type = MTYPE_IMSERIAL; - else if (strcmp(protocol, "Logitech") == 0) - mouse.type = MTYPE_LOGITECH; - else if (strcmp(protocol, "Microsoft") == 0) - mouse.type = MTYPE_MICROSOFT; - else if (strcmp(protocol, "MMHitTab") == 0) - mouse.type = MTYPE_MMHIT; - else if (strcmp(protocol, "MMSeries") == 0) - mouse.type = MTYPE_MMSERIES; - else if (strcmp(protocol, "MouseMan") == 0) - mouse.type = MTYPE_LOGIMAN; - else if (strcmp(protocol, "MouseSystems") == 0) - mouse.type = MTYPE_MOUSESYS; - else if (strcmp(protocol, "PS/2") == 0) - mouse.type = MTYPE_PS_2; - else if (strcmp(protocol, "SysMouse") == 0) - mouse.type = MTYPE_SYSMOUSE; - else if (strcmp(protocol, "ThinkingMouse") == 0) - mouse.type = MTYPE_THINKING; - else - mouse.type = MTYPE_AUTOMOUSE; + mouse.type = MTYPE_AUTOMOUSE; + for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++) + if (strcmp(protocols[i].name, protocol) == 0) { + mouse.type = protocols[i].type; + break; + } mouse.emulate3buttons = emulate; mouse.flags |= MF_REOPEN; @@ -304,11 +301,18 @@ static int first = 1, ndevices; static Widget mouse_dp, listD, listP, emul3, apply; static char **devices; + static char *dirs[] = { + "/dev", +#ifdef __linux__ + "/dev/input" +#endif + }; static char *patterns[] = { #ifdef WSCONS_SUPPORT "wsmouse", #endif - "cua", + "cuaa", + "mice", "mouse", "ps", "sysmouse", @@ -321,6 +325,8 @@ Widget label, viewport; struct dirent *ent; DIR *dir; + char **list; + int count; first = 0; @@ -328,27 +334,29 @@ configp, NULL, 0); /* DEVICE */ - if ((dir = opendir("/dev")) != NULL) { - int i, len; - - (void)readdir(dir); - (void)readdir(dir); - while ((ent = readdir(dir)) != NULL) { - for (i = 0; i < sizeof(patterns) / sizeof(patterns[0]); i++) { - len = strlen(patterns[i]); - - if (strncmp(patterns[i], ent->d_name, len) == 0) { - len = strlen(ent->d_name) + 6; - - devices = (char**)XtRealloc((XtPointer)devices, - sizeof(char*) * ++ndevices); - devices[ndevices - 1] = XtMalloc(len); - XmuSnprintf(devices[ndevices - 1], len, "/dev/%s", - ent->d_name); + for (count = 0; count < sizeof(dirs) / sizeof(dirs[0]); count++) { + if ((dir = opendir(dirs[count])) != NULL) { + int i, len, xlen = strlen(dirs[count]) + 2; + + (void)readdir(dir); + (void)readdir(dir); + while ((ent = readdir(dir)) != NULL) { + for (i = 0; i < sizeof(patterns) / sizeof(patterns[0]); i++) { + len = strlen(patterns[i]); + + if (strncmp(patterns[i], ent->d_name, len) == 0) { + len = strlen(ent->d_name) + xlen; + + devices = (char**)XtRealloc((XtPointer)devices, + sizeof(char*) * ++ndevices); + devices[ndevices - 1] = XtMalloc(len); + XmuSnprintf(devices[ndevices - 1], len, "%s/%s", + dirs[count], ent->d_name); + } } } + closedir(dir); } - closedir(dir); } label = XtCreateManagedWidget("labelD", labelWidgetClass, @@ -373,11 +381,14 @@ viewport = XtCreateManagedWidget("viewportP", viewportWidgetClass, mouse_dp, NULL, 0); + list = (char**)XtMalloc(sizeof(char*) * + sizeof(protocols)/sizeof(protocols[0])); + for (count = 0; count < sizeof(protocols)/sizeof(protocols[0]); count++) + list[count] = XtNewString(protocols[count].name); listP = XtVaCreateManagedWidget("listP", listWidgetClass, viewport, - XtNlist, protocols, - XtNnumberStrings, - sizeof(protocols) / sizeof(protocols[0]), + XtNlist, list, + XtNnumberStrings, count, NULL, 0); XtAddCallback(listP, XtNcallback, MouseProtocolCallback, NULL); @@ -419,15 +430,15 @@ if (protocol != NULL) { for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++) - if (strcasecmp(protocol, protocols[i]) == 0) { - protocol = protocols[i]; + if (strcasecmp(protocol, protocols[i].name) == 0) { + protocol = protocols[i].name; XawListHighlight(listP, i); break; } } else { /* "Auto" is the default */ - protocol = protocols[0]; + protocol = protocols[0].name; XawListHighlight(listP, 0); } Index: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.10 xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.12 --- xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.10 Sat Oct 27 23:34:08 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c Mon Nov 18 00:24:18 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.10 2001/10/28 03:34:08 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.12 2002/11/18 05:24:18 paulo Exp $ */ #include "xf86config.h" @@ -72,6 +72,7 @@ "1600x1200", "1800x1400", "512x384", + "1400x1050", }; static char **modes; @@ -377,10 +378,13 @@ return; tmp = defmodes[unsel_index]; - if (down) - defmodes[unsel_index] = defmodes[++unsel_index]; - else - defmodes[unsel_index] = defmodes[--unsel_index]; + if (down) { + defmodes[unsel_index] = defmodes[unsel_index + 1]; + unsel_index++; + } else { + defmodes[unsel_index] = defmodes[unsel_index - 1]; + unsel_index--; + } defmodes[unsel_index] = tmp; XawListUnhighlight(listR); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.8 xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.9 --- xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.8 Sat Oct 27 23:34:08 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c Thu Jun 6 17:03:32 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.8 2001/10/28 03:34:08 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.9 2002/06/06 21:03:32 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -41,6 +41,7 @@ * Prototypes */ void ReshapeScreenWidget(xf86cfgScreen*); +static int qcmp_screen(_Xconst void*, _Xconst void*); /* * Initialization @@ -885,7 +886,7 @@ XtMapWidget(work); } -int +static int qcmp_screen(_Xconst void *a, _Xconst void *b) { xf86cfgScreen *s1, *s2; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c:1.7 xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c:1.8 --- xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c:1.7 Mon Jan 7 15:38:29 2002 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c Sat Oct 19 16:04:21 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.7 2002/01/07 20:38:29 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.8 2002/10/19 20:04:21 herrb Exp $ */ #include "config.h" @@ -110,7 +110,7 @@ else XmuSnprintf(path, sizeof(path), "%s/bin/XFree86", XFree86Dir); execl(path, "X", ":8", /*"+xinerama",*/ "+accessx","-allowMouseOpenFail", - "-xf86config", XF86Config_path, NULL); + "-xf86config", XF86Config_path, (void *)NULL); exit(-127); } break; case -1: Index: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c:1.2 xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c:1.3 --- xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c:1.2 Mon Oct 23 17:16:52 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c Sat Nov 9 06:12:53 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c,v 1.2 2000/10/23 21:16:52 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.c,v 1.3 2002/11/09 11:12:53 herrb Exp $ */ #include <stdio.h> @@ -62,12 +62,4 @@ return (retval); } -#else -char *Xstrdup(const char*); - -char * -Xstrdup(const char *s) -{ - return (strdup(s)); -} #endif /* !defined(USE_MODULES) */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.14 xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.22 --- xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.14 Wed Oct 31 17:50:30 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c Sun Feb 16 00:23:45 2003 @@ -26,13 +26,17 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.14 2001/10/31 22:50:30 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.22 2003/02/16 05:23:45 paulo Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifdef _SCO_DS +#include <curses.h> +#else #include <ncurses.h> +#endif #include <ctype.h> #include <X11/Xlib.h> #include <X11/extensions/XKBstr.h> @@ -288,14 +292,18 @@ if (newconfig) { if (XF86Config->conf_modules == NULL) { - static char *modules[] = {"xie", "pex5", "glx", "dri", "dbe", - "record", "extmod", "type1"}; + static char *modules[] = {"extmod", "glx", "dri", "dbe", + "record", "xtrap", "type1", "speedo"}; XF86LoadPtr load; int i; XF86Config->conf_modules = (XF86ConfModulePtr) XtCalloc(1, sizeof(XF86ConfModuleRec)); + XF86Config->conf_modules->mod_comment = + XtNewString("\t# Load \"freetype\"\n" + "\t# Load \"xtt\"\n"); + for (i = 0; i < sizeof(modules) / sizeof(modules[0]); i++) { load = (XF86LoadPtr)XtCalloc(1, sizeof(XF86LoadRec)); load->load_name = XtNewString(modules[i]); @@ -322,22 +330,35 @@ } static char *protocols[] = { +#ifdef SCO + "OsMouse", +#endif +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif "Auto", - "Microsoft", - "PS/2", + "SysMouse", + "MouseSystems", "BusMouse", + "PS/2", + "Microsoft", +#ifndef __FreeBSD__ + "ImPS/2", + "ExplorerPS/2", + "GlidePointPS/2", + "MouseManPlusPS/2", + "NetMousePS/2", + "NetScrollPS/2", + "ThinkingMousePS/2", +#endif + "AceCad", "GlidePoint", "IntelliMouse", "Logitech", "MMHitTab", "MMSeries", "MouseMan", - "MouseSystems", - "SysMouse", "ThinkingMouse", -#ifdef WSCONS_SUPPORT - "wsmouse", -#endif }; static int @@ -498,6 +519,8 @@ if (str == NULL) #ifdef WSCONS_SUPPORT str = "/dev/wsmouse"; +#elif defined(__FreeBSD__) + str = "/dev/sysmouse"; #else str = "/dev/mouse"; #endif @@ -1058,6 +1081,8 @@ "apm", "ark", "ati", + "r128", + "radeon", "chips", "cirrus", "cyrix", @@ -1069,16 +1094,18 @@ "imstt", "mga", "neomagic", - "r128", - "radeon", + "nv", "rendition", + "s3", "s3virge", + "savage", "siliconmotion", "sis", "tdfx", "tga", "trident", "tseng", + "vmware", "vga", "vesa", }; @@ -1090,7 +1117,7 @@ drivers = NULL; ndrivers = 0; while (opts) { - if (opts->chipsets) { + if (opts->type == VideoModule) { ++ndrivers; drivers = (char**)XtRealloc((XtPointer)drivers, ndrivers * sizeof(char*)); @@ -1332,6 +1359,7 @@ static char *modes[] = { "1600x1200", + "1400x1050", "1280x1024", "1280x960", "1152x864", @@ -1352,8 +1380,8 @@ XF86ConfScreenPtr *screens = NULL, screen = XF86Config->conf_screen_lst; char **list = NULL, *identifier = NULL; int nlist, def; - XF86ConfDevicePtr device; - XF86ConfMonitorPtr monitor; + XF86ConfDevicePtr device = NULL; + XF86ConfMonitorPtr monitor = NULL; XF86ConfDisplayPtr display; XF86ModePtr mode, ptr = NULL; char *checks; @@ -1538,8 +1566,13 @@ def = 4; else if (screen->scrn_defaultdepth == 24) def = 5; - else - def = 2; + else { + if (screen->scrn_device && screen->scrn_device->dev_driver && + strcmp(screen->scrn_device->dev_driver, "vga") == 0) + def = 1; /* 4bpp */ + else + def = 2; /* 8bpp */ + } ClearScreen(); refresh(); i = DialogMenu("Screen depth", @@ -1610,7 +1643,7 @@ } if (nlist == 0 && def == 0) - checks[6] = 1; /* 640x480 */ + checks[7] = 1; /* 640x480 */ list = (char**)XtRealloc((XtPointer)list, (nlist + sizeof(modes) / sizeof(modes[0])) * sizeof(char*)); for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++) @@ -2558,7 +2591,7 @@ int item_no, char **items, char *label1, char *label2, int choice) { int i, x, y, cur_x, cur_y, box_x, box_y, key = 0, button = 0, - scroll = 0, max_choice, nscroll, max_scroll, x1, x2, l1len, l2len; + scrlx = 0, max_choice, nscroll, max_scroll, x1, x2, l1len, l2len; WINDOW *dialog, *menu; max_choice = MIN(menu_height, item_no); @@ -2595,13 +2628,13 @@ item_x = 3; if (choice > menu_height) { - scroll = MIN(max_scroll, choice); - choice -= scroll; + scrlx = MIN(max_scroll, choice); + choice -= scrlx; } for (i = 0; i < max_choice; i++) - PaintItem(menu, items[i + scroll], i, i == choice); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintItem(menu, items[i + scrlx], i, i == choice); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); x = width / 2 - 11; @@ -2617,20 +2650,20 @@ if (menu_height > 1 && key == KEY_PPAGE) { if (!choice) { - if (scroll) { + if (scrlx) { /* Scroll menu down */ getyx(dialog, cur_y, cur_x); - nscroll = max_choice > scroll ? -scroll : -max_choice; + nscroll = max_choice > scrlx ? -scrlx : -max_choice; scrollok(menu, TRUE); wscrl(menu, nscroll); scrollok(menu, FALSE); - PaintItem(menu, items[i = scroll + nscroll], 0, TRUE); - for (++i; i <= scroll; i++) - PaintItem(menu, items[i], i - (scroll + nscroll), FALSE); - scroll += nscroll; - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintItem(menu, items[i = scrlx + nscroll], 0, TRUE); + for (++i; i <= scrlx; i++) + PaintItem(menu, items[i], i - (scrlx + nscroll), FALSE); + scrlx += nscroll; + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2640,21 +2673,21 @@ } else if (menu_height > 1 && key == KEY_NPAGE) { if (choice == max_choice - 1) { - if (scroll < max_scroll) { + if (scrlx < max_scroll) { /* Scroll menu up */ getyx(dialog, cur_y, cur_x); - nscroll = (scroll + max_choice > max_scroll ? - max_scroll : scroll + max_choice) - scroll; + nscroll = (scrlx + max_choice > max_scroll ? + max_scroll : scrlx + max_choice) - scrlx; scrollok(menu, TRUE); wscrl(menu, nscroll); scrollok(menu, FALSE); - scroll += nscroll; + scrlx += nscroll; for (i = 0; i < max_choice - 1; i++) - PaintItem(menu, items[i + scroll], i, FALSE); - PaintItem(menu, items[i + scroll], max_choice - 1, TRUE); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintItem(menu, items[i + scrlx], i, FALSE); + PaintItem(menu, items[i + scrlx], max_choice - 1, TRUE); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2664,18 +2697,18 @@ } else if (key == KEY_UP) { if (!choice) { - if (scroll) { + if (scrlx) { /* Scroll menu down */ getyx(dialog, cur_y, cur_x); if (menu_height > 1) { - PaintItem(menu, items[scroll], 0, FALSE); + PaintItem(menu, items[scrlx], 0, FALSE); scrollok(menu, TRUE); wscrl(menu, - 1); scrollok(menu, FALSE); } - scroll--; - PaintItem(menu, items[scroll], 0, TRUE); - PaintScroller(menu, scroll + choice, item_no, menu_height); + scrlx--; + PaintItem(menu, items[scrlx], 0, TRUE); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2686,18 +2719,18 @@ } else if (key == KEY_DOWN) { if (choice == max_choice - 1) { - if (scroll + choice < item_no - 1) { + if (scrlx + choice < item_no - 1) { /* Scroll menu up */ getyx(dialog, cur_y, cur_x); if (menu_height > 1) { - PaintItem(menu, items[scroll + max_choice - 1], max_choice - 1, FALSE); + PaintItem(menu, items[scrlx + max_choice - 1], max_choice - 1, FALSE); scrollok(menu, TRUE); scroll(menu); scrollok(menu, FALSE); } - scroll++; - PaintItem(menu, items[scroll + max_choice - 1], max_choice - 1, TRUE); - PaintScroller(menu, scroll + choice, item_no, menu_height); + scrlx++; + PaintItem(menu, items[scrlx + max_choice - 1], max_choice - 1, TRUE); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2709,11 +2742,11 @@ if (i != choice) { getyx(dialog, cur_y, cur_x); - PaintItem(menu, items[scroll + choice], choice, FALSE); + PaintItem(menu, items[scrlx + choice], choice, FALSE); choice = i; - PaintItem(menu, items[scroll + choice], choice, TRUE); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintItem(menu, items[scrlx + choice], choice, TRUE); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wmove(dialog, cur_y, cur_x); wrefresh(dialog); @@ -2740,32 +2773,32 @@ case '\r': case '\n': delwin(dialog); - return (!button ? scroll + choice : -1); + return (!button ? scrlx + choice : -1); default: - for (i = scroll + choice + 1; i < item_no; i++) + for (i = scrlx + choice + 1; i < item_no; i++) if (toupper(items[i][0]) == toupper(key)) break; if (i == item_no) { - for (i = 0; i < scroll + choice; i++) + for (i = 0; i < scrlx + choice; i++) if (toupper(items[i][0]) == toupper(key)) break; } getyx(dialog, cur_y, cur_x); - if (i < item_no && i != scroll + choice) { - if (i >= scroll && i < scroll + max_choice) { + if (i < item_no && i != scrlx + choice) { + if (i >= scrlx && i < scrlx + max_choice) { /* it is already visible */ - PaintItem(menu, items[scroll + choice], choice, FALSE); - choice = i - scroll; + PaintItem(menu, items[scrlx + choice], choice, FALSE); + choice = i - scrlx; } else { - scroll = MIN(i, max_scroll); - choice = i - scroll; + scrlx = MIN(i, max_scroll); + choice = i - scrlx; for (i = 0; i < max_choice; i++) if (i != choice) - PaintItem(menu, items[scroll + i], i, FALSE); + PaintItem(menu, items[scrlx + i], i, FALSE); } - PaintItem(menu, items[scroll + choice], choice, TRUE); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintItem(menu, items[scrlx + choice], choice, TRUE); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wmove(dialog, cur_y, cur_x); wrefresh(dialog); @@ -2811,7 +2844,7 @@ int item_no, char **items, char *label1, char *label2, char *checks) { int i, x, y, cur_x, cur_y, box_x, box_y, key = 0, button = 0, choice = 0, - scroll = 0, max_choice, nscroll, max_scroll, x1, x2, l1len, l2len; + scrlx = 0, max_choice, nscroll, max_scroll, x1, x2, l1len, l2len; WINDOW *dialog, *menu; max_choice = MIN(menu_height, item_no); @@ -2848,8 +2881,8 @@ item_x = 3; for (i = 0; i < max_choice; i++) - PaintCheckItem(menu, items[i + scroll], i, i == 0, checks[i + scroll]); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintCheckItem(menu, items[i + scrlx], i, i == 0, checks[i + scrlx]); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); x = width / 2 - 11; @@ -2865,21 +2898,21 @@ if (menu_height > 1 && key == KEY_PPAGE) { if (!choice) { - if (scroll) { + if (scrlx) { /* Scroll menu down */ getyx(dialog, cur_y, cur_x); - nscroll = max_choice > scroll ? -scroll : -max_choice; + nscroll = max_choice > scrlx ? -scrlx : -max_choice; scrollok(menu, TRUE); wscrl(menu, nscroll); scrollok(menu, FALSE); - i = scroll + nscroll; + i = scrlx + nscroll; PaintCheckItem(menu, items[i], 0, TRUE, checks[i]); - for (++i; i <= scroll; i++) - PaintCheckItem(menu, items[i], i - (scroll + nscroll), FALSE, checks[i]); - scroll += nscroll; - PaintScroller(menu, scroll + choice, item_no, menu_height); + for (++i; i <= scrlx; i++) + PaintCheckItem(menu, items[i], i - (scrlx + nscroll), FALSE, checks[i]); + scrlx += nscroll; + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2889,21 +2922,21 @@ } else if (menu_height > 1 && key == KEY_NPAGE) { if (choice == max_choice - 1) { - if (scroll < max_scroll) { + if (scrlx < max_scroll) { /* Scroll menu up */ getyx(dialog, cur_y, cur_x); - nscroll = (scroll + max_choice > max_scroll ? - max_scroll : scroll + max_choice) - scroll; + nscroll = (scrlx + max_choice > max_scroll ? + max_scroll : scrlx + max_choice) - scrlx; scrollok(menu, TRUE); wscrl(menu, nscroll); scrollok(menu, FALSE); - scroll += nscroll; + scrlx += nscroll; for (i = 0; i < max_choice - 1; i++) - PaintCheckItem(menu, items[i + scroll], i, FALSE, checks[i + scroll]); - PaintCheckItem(menu, items[i + scroll], max_choice - 1, TRUE, checks[i + scroll]); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintCheckItem(menu, items[i + scrlx], i, FALSE, checks[i + scrlx]); + PaintCheckItem(menu, items[i + scrlx], max_choice - 1, TRUE, checks[i + scrlx]); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2913,18 +2946,18 @@ } else if (key == KEY_UP) { if (!choice) { - if (scroll) { + if (scrlx) { /* Scroll menu down */ getyx(dialog, cur_y, cur_x); if (menu_height > 1) { - PaintCheckItem(menu, items[scroll], 0, FALSE, checks[scroll]); + PaintCheckItem(menu, items[scrlx], 0, FALSE, checks[scrlx]); scrollok(menu, TRUE); wscrl(menu, - 1); scrollok(menu, FALSE); } - scroll--; - PaintCheckItem(menu, items[scroll], 0, TRUE, checks[scroll]); - PaintScroller(menu, scroll + choice, item_no, menu_height); + scrlx--; + PaintCheckItem(menu, items[scrlx], 0, TRUE, checks[scrlx]); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2935,18 +2968,18 @@ } else if (key == KEY_DOWN) { if (choice == max_choice - 1) { - if (scroll + choice < item_no - 1) { + if (scrlx + choice < item_no - 1) { /* Scroll menu up */ getyx(dialog, cur_y, cur_x); if (menu_height > 1) { - PaintCheckItem(menu, items[scroll + max_choice - 1], max_choice - 1, FALSE, checks[scroll + max_choice - 1]); + PaintCheckItem(menu, items[scrlx + max_choice - 1], max_choice - 1, FALSE, checks[scrlx + max_choice - 1]); scrollok(menu, TRUE); scroll(menu); scrollok(menu, FALSE); } - scroll++; - PaintCheckItem(menu, items[scroll + max_choice - 1], max_choice - 1, TRUE, checks[scroll + max_choice - 1]); - PaintScroller(menu, scroll + choice, item_no, menu_height); + scrlx++; + PaintCheckItem(menu, items[scrlx + max_choice - 1], max_choice - 1, TRUE, checks[scrlx + max_choice - 1]); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wrefresh(dialog); continue; @@ -2958,11 +2991,11 @@ if (i != choice) { getyx(dialog, cur_y, cur_x); - PaintCheckItem(menu, items[scroll + choice], choice, FALSE, checks[scroll + choice]); + PaintCheckItem(menu, items[scrlx + choice], choice, FALSE, checks[scrlx + choice]); choice = i; - PaintCheckItem(menu, items[scroll + choice], choice, TRUE, checks[scroll + choice]); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintCheckItem(menu, items[scrlx + choice], choice, TRUE, checks[scrlx + choice]); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wmove(dialog, cur_y, cur_x); wrefresh(dialog); @@ -2987,8 +3020,8 @@ break; case ' ': getyx(dialog, cur_y, cur_x); - checks[scroll + choice] = !checks[scroll + choice]; - PaintCheckItem(menu, items[scroll + choice], choice, TRUE, checks[scroll + choice]); + checks[scrlx + choice] = !checks[scrlx + choice]; + PaintCheckItem(menu, items[scrlx + choice], choice, TRUE, checks[scrlx + choice]); wmove(dialog, cur_y, cur_x); wnoutrefresh(menu); wrefresh(dialog); @@ -2998,30 +3031,30 @@ delwin(dialog); return (!button ? 0 : -1); default: - for (i = scroll + choice + 1; i < item_no; i++) + for (i = scrlx + choice + 1; i < item_no; i++) if (toupper(items[i][0]) == toupper(key)) break; if (i == item_no) { - for (i = 0; i < scroll + choice; i++) + for (i = 0; i < scrlx + choice; i++) if (toupper(items[i][0]) == toupper(key)) break; } getyx(dialog, cur_y, cur_x); - if (i < item_no && i != scroll + choice) { - if (i >= scroll && i < scroll + max_choice) { + if (i < item_no && i != scrlx + choice) { + if (i >= scrlx && i < scrlx + max_choice) { /* it is already visible */ - PaintCheckItem(menu, items[scroll + choice], choice, FALSE, checks[scroll + choice]); - choice = i - scroll; + PaintCheckItem(menu, items[scrlx + choice], choice, FALSE, checks[scrlx + choice]); + choice = i - scrlx; } else { - scroll = MIN(i, max_scroll); - choice = i - scroll; + scrlx = MIN(i, max_scroll); + choice = i - scrlx; for (i = 0; i < max_choice; i++) if (i != choice) - PaintCheckItem(menu, items[scroll + i], i, FALSE, checks[scroll + i]); + PaintCheckItem(menu, items[scrlx + i], i, FALSE, checks[scrlx + i]); } - PaintCheckItem(menu, items[scroll + choice], choice, TRUE, checks[scroll + choice]); - PaintScroller(menu, scroll + choice, item_no, menu_height); + PaintCheckItem(menu, items[scrlx + choice], choice, TRUE, checks[scrlx + choice]); + PaintScroller(menu, scrlx + choice, item_no, menu_height); wnoutrefresh(menu); wmove(dialog, cur_y, cur_x); wrefresh(dialog); @@ -3052,7 +3085,7 @@ char *label1, char *label2, int def_button) { int i, x, y, box_y, box_x, box_width, len, - input_x = 0, scroll = 0, key = 0, button = -1, x1, x2, l1len, l2len; + input_x = 0, scrlx = 0, key = 0, button = -1, x1, x2, l1len, l2len; char instr[1024 + 1]; WINDOW *dialog; @@ -3092,10 +3125,10 @@ input_x = len = strlen(instr); if (input_x >= box_width) { - scroll = input_x - box_width + 1; + scrlx = input_x - box_width + 1; input_x = box_width - 1; for (i = 0; i < box_width - 1; i++) - waddch(dialog, instr[scroll + i]); + waddch(dialog, instr[scrlx + i]); } else waddstr(dialog, instr); @@ -3113,11 +3146,11 @@ case KEY_DOWN: break; case KEY_LEFT: - if (scroll && !input_x) { - --scroll; + if (scrlx && !input_x) { + --scrlx; wmove(dialog, box_y, box_x); for (i = 0; i < box_width; i++) - waddch(dialog, instr[scroll + input_x + i] ? instr[scroll + input_x + i] : ' '); + waddch(dialog, instr[scrlx + input_x + i] ? instr[scrlx + input_x + i] : ' '); wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); } @@ -3127,11 +3160,11 @@ } continue; case KEY_RIGHT: - if (input_x + scroll < len) { + if (input_x + scrlx < len) { if (input_x == box_width - 1) { - ++scroll; + ++scrlx; wmove(dialog, box_y, box_x); - for (i = scroll; i < scroll + box_width; i++) + for (i = scrlx; i < scrlx + box_width; i++) waddch(dialog, instr[i] ? instr[i] : ' '); wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); @@ -3144,28 +3177,28 @@ continue; case KEY_BACKSPACE: case 0177: - if (input_x || scroll) { + if (input_x || scrlx) { wattrset(dialog, dialog_attr); - if (scroll + input_x < len) - memmove(instr + scroll + input_x - 1, - instr + scroll + input_x, - len - (scroll + input_x)); + if (scrlx + input_x < len) + memmove(instr + scrlx + input_x - 1, + instr + scrlx + input_x, + len - (scrlx + input_x)); instr[--len] = '\0'; if (!input_x) { - scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); + scrlx = scrlx < box_width - 1 ? 0 : scrlx - (box_width - 1); wmove(dialog, box_y, box_x); for (i = 0; i < box_width; i++) - waddch(dialog, instr[scroll + input_x + i] ? instr[scroll + input_x + i] : ' '); - input_x = len - scroll; + waddch(dialog, instr[scrlx + input_x + i] ? instr[scrlx + input_x + i] : ' '); + input_x = len - scrlx; } else { wmove(dialog, box_y, --input_x + box_x); - for (i = scroll + input_x; i < len && - i < scroll + box_width; i++) + for (i = scrlx + input_x; i < len && + i < scrlx + box_width; i++) waddch(dialog, instr[i]); - if (i < scroll + box_width) + if (i < scrlx + box_width) waddch(dialog, ' '); } wmove(dialog, box_y, input_x + box_x); @@ -3175,8 +3208,8 @@ case KEY_HOME: case CONTROL_A: wmove(dialog, box_y, box_x); - if (scroll != 0) { - scroll = 0; + if (scrlx != 0) { + scrlx = 0; for (i = 0; i < box_width; i++) waddch(dialog, instr[i] ? instr[i] : ' '); } @@ -3185,15 +3218,15 @@ wrefresh(dialog); break; case CONTROL_D: - if (input_x + scroll < len) { - memmove(instr + scroll + input_x, - instr + scroll + input_x + 1, - len - (scroll + input_x)); + if (input_x + scrlx < len) { + memmove(instr + scrlx + input_x, + instr + scrlx + input_x + 1, + len - (scrlx + input_x)); instr[--len] = '\0'; - for (i = scroll + input_x; i < len && - i < scroll + box_width; i++) + for (i = scrlx + input_x; i < len && + i < scrlx + box_width; i++) waddch(dialog, instr[i]); - if (i < scroll + box_width) + if (i < scrlx + box_width) waddch(dialog, ' '); wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); @@ -3201,17 +3234,17 @@ break; case CONTROL_E: case KEY_END: - if (box_width + scroll < len) { + if (box_width + scrlx < len) { input_x = box_width - 1; - scroll = len - box_width + 1; + scrlx = len - box_width + 1; wmove(dialog, box_y, box_x); - for (i = scroll; i < scroll + box_width; i++) + for (i = scrlx; i < scrlx + box_width; i++) waddch(dialog, instr[i] ? instr[i] : ' '); wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); } else { - input_x = len - scroll; + input_x = len - scrlx; wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); } @@ -3220,34 +3253,34 @@ if (len) { for (i = input_x; i < box_width; i++) waddch(dialog, ' '); - for (i = scroll + input_x; i < len; i++) + for (i = scrlx + input_x; i < len; i++) instr[i] = '\0'; - len = scroll + input_x; + len = scrlx + input_x; wmove(dialog, box_y, box_x + input_x); wrefresh(dialog); } break; default: if (key < 0x100 && isprint(key)) { - if (scroll + input_x < sizeof(instr) - 1) { + if (scrlx + input_x < sizeof(instr) - 1) { wattrset(dialog, dialog_attr); - if (scroll + input_x < len) { - memmove(instr + scroll + input_x + 1, - instr + scroll + input_x, - len - (scroll + input_x)); + if (scrlx + input_x < len) { + memmove(instr + scrlx + input_x + 1, + instr + scrlx + input_x, + len - (scrlx + input_x)); } - instr[scroll + input_x] = key; + instr[scrlx + input_x] = key; instr[++len] = '\0'; if (input_x == box_width - 1) { - scroll++; + scrlx++; wmove(dialog, box_y, box_x); for (i = 0; i < box_width - 1; i++) - waddch(dialog, instr[scroll + i]); + waddch(dialog, instr[scrlx + i]); } else { wmove(dialog, box_y, input_x++ + box_x); - for (i = scroll + input_x - 1; i < len && - i < scroll + box_width; i++) + for (i = scrlx + input_x - 1; i < len && + i < scrlx + box_width; i++) waddch(dialog, instr[i]); wmove(dialog, box_y, input_x + box_x); } Index: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.7 xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.9 --- xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.7 Mon May 21 18:21:57 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man Mon Dec 30 09:34:02 2002 @@ -26,7 +26,7 @@ .\" .\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.7 2001/05/21 22:21:57 paulo Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.9 2002/12/30 14:34:02 herrb Exp $ .\" .TH xf86cfg 1 __vendorversion__ .SH NAME @@ -35,7 +35,7 @@ .B xf86cfg [-xf86config \fIXF86Config\fP] [-modulepath \fImoduledir\fP] [-fontpath \fIfontsdir\fP] [-toolkitoption ...] -.SH DESCRITPION +.SH DESCRIPTION .I Xf86cfg is a tool to configure \fIXFree86 4.0\fP, and can be used to either write the initial configuration file or make customizations to the current configuration. @@ -119,16 +119,16 @@ .I /usr/X11R6/etc/XF86Config Server configuration file .TP 8 -.I <XRoot>/lib/X11/XF86Config.\fIhostname\fP +.IR __projectroot__/lib/X11/XF86Config. hostname Server configuration file .TP 8 -.I <XRoot>/lib/X11/XF86Config +.I __projectroot__/lib/X11/XF86Config Server configuration file .TP 8 -.I <XRoot>/lib/X11/app-default/XF86Cfg +.I __projectroot__/lib/X11/app-default/XF86Cfg Specifies xf86cfg resources .TP 8 -.I <Xroot>/lib/X11/xkb/X0-config.keyboard +.I __projectroot__/lib/X11/xkb/X0-config.keyboard Keyboard specific configuration .SH "SEE ALSO" Index: xc/programs/Xserver/hw/xfree86/xf86config/Cards diff -u xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.78 xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.80 --- xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.78 Fri Jun 22 21:55:12 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/Cards Mon Nov 18 00:24:19 2002 @@ -18,7 +18,7 @@ # The majority of entries are just a binding of a model name to a # chipset/server and untested. # -# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.78 2001/06/23 01:55:12 paulo Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.80 2002/11/18 05:24:19 paulo Exp $ # VGA @@ -35,6 +35,212 @@ DRIVER vga UNSUPPORTED + +# # +# generic # +# # + +NAME ** Alliance Pro Motion (generic) [apm] +#CHIPSET apm +SERVER SVGA +DRIVER apm +LINE #Option "no_accel" + +NAME ** Ark Logic (generic) [ark] +#CHIPSET ark +SERVER SVGA +DRIVER ark + +NAME ** ATI (generic) [ati] +#CHIPSET ati +SERVER SVGA +DRIVER ati + +NAME ** ATI Rage 128 based (generic) [r128] +#CHIPSET r128 +SERVER SVGA +DRIVER r128 + +NAME ** ATI Radeon (generic) [radeon] +#CHIPSET radeon +SERVER SVGA +DRIVER radeon + +NAME ** Chips and Technologies (generic) [chips] +#CHIPSET chips +SERVER SVGA +DRIVER chips +LINE # Option "suspend_hack" +LINE # Option "STN" +LINE # Option "no_stretch" +LINE # Option "no_center" +LINE # Option "use_modeline" +LINE # Option "fix_panel_size" +LINE # videoram 512 +LINE # Option "noaccel" +LINE # Option "no_bitblt" +LINE # Option "xaa_no_color_exp" +LINE # Option "xaa_benchmark" +LINE # Option "hw_cursor" +LINE # Option "nolinear" +LINE # MemBase 0x03b00000 +LINE # Option "hw_clocks" +LINE # Textclockfreq 25.175 + +NAME ** Cirrus Logic (generic) [cirrus] +#CHIPSET cirrus +SERVER SVGA +DRIVER cirrus +LINE # MemBase 0x00e00000 # ISA card that maps to 14Mb +LINE # MemBase 0x04000000 # VLB card that maps to 64Mb +LINE # MemBase 0x80000000 # VLB card that maps to 2048Mb +LINE # MemBase 0x02000000 # VLB card that maps to 32Mb +LINE # Option "linear" +LINE # Option "fifo_conservative" + +NAME ** Cyrix MediaGX (generic) [cyrix] +#CHIPSET cyrix +SERVER SVGA +DRIVER cyrix + +NAME ** Linux framebuffer (generic) [fbdev] +#CHIPSET fbdev +SERVER SVGA +DRIVER fbdev + +NAME ** 3DLabs, TI (generic) [glint] +#CHIPSET glint +SERVER SVGA +DRIVER glint +LINE #Option "no_accel" + +NAME ** Number Nine I128 (generic) [i128] +#CHIPSET i128 +SERVER SVGA +DRIVER i128 + +NAME ** Intel i740 (generic) [i740] +#CHIPSET i740 +SERVER SVGA +DRIVER i740 + +NAME ** Intel i810 (generic) [i810] +#CHIPSET i810 +SERVER SVGA +DRIVER i810 + +NAME ** Matrox Graphics (generic) [mga] +#CHIPSET mga +SERVER SVGA +DRIVER mga +LINE # Option "mga_sdram" + +NAME ** NeoMagic (generic) [neomagic] +#CHIPSET neomagic +SERVER SVGA +DRIVER neomagic +LINE # Chipset "NM2160" +LINE # IOBase 0xfea00000 +LINE # MemBase 0xfd000000 +LINE # VideoRam 2048 +LINE # DacSpeed 90 +LINE # Option "linear" +LINE # Option "nolinear" +LINE # Option "sw_cursor" +LINE # Option "hw_cursor" +LINE # Option "no_accel" +LINE # Option "intern_disp" +LINE # Option "extern_disp" +LINE # Option "mmio" +LINE # Option "no_mmio" +LINE # Option "lcd_center" +LINE # Option "no_stretch" + +NAME ** NVIDIA (generic) [nv] +#CHIPSET nv +SERVER SVGA +DRIVER nv + +NAME ** Rendition (generic) [rendition] +#CHIPSET rendition +SERVER SVGA +DRIVER rendition +LINE # Option "sw_cursor" + +NAME ** S3 (not ViRGE or Savage) (generic) [s3] +#CHIPSET s3 +SERVER SVGA +DRIVER s3 + +NAME ** S3 ViRGE (generic) [s3virge] +#CHIPSET s3virge +SERVER SVGA +DRIVER s3virge +LINE # Option "xaa_benchmark" +LINE # Option "fifo_moderate" +LINE # Option "pci_burst_on" +LINE # Option "pci_retry" +LINE # Option "lcd_center" +LINE # Set_LCDClk <pixel_clock_for_LCD> + +NAME ** S3 Savage (generic) [savage] +#CHIPSET savage +SERVER SVGA +DRIVER savage + +NAME ** Silicon Motion (generic) [siliconmotion] +#CHIPSET siliconmotion +SERVER SVGA +DRIVER siliconmotion + +NAME ** SiS (generic) [sis] +#CHIPSET sis +SERVER SVGA +DRIVER sis +LINE # Option "no_accel" +LINE # Option "fifo_moderate" +LINE # Option "fifo_conserv" +LINE # Option "fifo_aggressive" +LINE # Option "no_BitBlt" +LINE # Option "fast_vram" +LINE # Option "pci_burst_on" +LINE # Option "xaa_benchmark" +LINE # Option "ext_eng_queue" + +NAME ** 3Dfx (generic) [tdfx] +#CHIPSET tdfx +SERVER SVGA +DRIVER tdfx + +NAME ** DEC TGA (generic) [tga] +#CHIPSET tga +SERVER SVGA +DRIVER tga + +NAME ** Trident (generic) [trident] +#CHIPSET trident +SERVER SVGA +DRIVER trident + +NAME ** Tseng Labs (generic) [tseng] +#CHIPSET tseng +SERVER SVGA +DRIVER tseng +LINE # Option "linear" +LINE # Option "noaccel" +LINE # Option "power_saver" +LINE # Option "fast_dram" +LINE # Option "pci_retry" +LINE # Option "hibit_high" +LINE # Option "hibit_low" +LINE # MemBase 0x3C00000 + +NAME ** VMWare guest OS (generic) [vmware] +#CHIPSET vmware +SERVER SVGA +DRIVER vmware + + #Chips & Technologies #untested @@ -2317,7 +2523,7 @@ LINE # Option "no_accel" # Use this if acceleration is causing problems LINE # Option "fifo_moderate" LINE # Option "fifo_conserv" -LINE # Option "fifo_aggresive" +LINE # Option "fifo_aggressive" NOCLOCKPROBE NAME SiS SG86C215 @@ -2329,7 +2535,7 @@ LINE # Option "no_BitBlt" # Use this if acceleration is causing problems LINE # Option "fifo_moderate" LINE # Option "fifo_conserv" -LINE # Option "fifo_aggresive" +LINE # Option "fifo_aggressive" NOCLOCKPROBE NAME SiS SG86C225 @@ -2339,7 +2545,7 @@ LINE # Option "no_accel" # Use this if acceleration is causing problems LINE # Option "fifo_moderate" LINE # Option "fifo_conserv" -LINE # Option "fifo_aggresive" +LINE # Option "fifo_aggressive" NOCLOCKPROBE NAME SiS 5597 @@ -2349,7 +2555,7 @@ LINE # Option "no_accel" # Use this if acceleration is causing problems LINE # Option "fifo_moderate" LINE # Option "fifo_conserv" -LINE # Option "fifo_aggresive" +LINE # Option "fifo_aggressive" LINE # Option "fast_vram" LINE # Option "pci_burst_on" LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!! @@ -2364,7 +2570,7 @@ LINE # Option "no_accel" # Use this if acceleration is causing problems LINE # Option "fifo_moderate" LINE # Option "fifo_conserv" -LINE # Option "fifo_aggresive" +LINE # Option "fifo_aggressive" LINE # Option "fast_vram" LINE # Option "pci_burst_on" LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!! @@ -2379,7 +2585,7 @@ LINE # Option "no_accel" # Use this if acceleration is causing problems LINE # Option "fifo_moderate" LINE # Option "fifo_conserv" -LINE # Option "fifo_aggresive" +LINE # Option "fifo_aggressive" LINE # Option "fast_vram" LINE # Option "pci_burst_on" LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!! Index: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf86config/Imakefile:3.13 xc/programs/Xserver/hw/xfree86/xf86config/Imakefile:3.14 --- xc/programs/Xserver/hw/xfree86/xf86config/Imakefile:3.13 Mon Apr 23 13:15:57 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/Imakefile Fri May 31 14:46:04 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.13 2001/04/23 17:15:57 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.14 2002/05/31 18:46:04 dawes Exp $ @@ -20,16 +20,11 @@ -DXCONFIGFILE=\"$(XCONFIGFILE)\" \ -DXVERSION="$(XVERS)" XFree86ConsoleDefines -#if !defined(OS2Architecture) AllTarget(ProgramTargetName(xf86config)) NormalProgramTarget(xf86config,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),NullParameter) InstallProgram(xf86config,$(BINDIR)) -#else -all:: -InstallNamedProg(xf86config.cmd,xf86config.cmd,$(BINDIR)) -#endif DependTarget() InstallNonExecFile(Cards,$(LIBDIR)) Index: xc/programs/Xserver/hw/xfree86/xf86config/cards.c diff -u xc/programs/Xserver/hw/xfree86/xf86config/cards.c:3.16 xc/programs/Xserver/hw/xfree86/xf86config/cards.c:3.17 --- xc/programs/Xserver/hw/xfree86/xf86config/cards.c:3.16 Wed Jul 25 11:05:09 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/cards.c Fri May 31 14:46:04 2002 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.c,v 3.16 2001/07/25 15:05:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.c,v 3.17 2002/05/31 18:46:04 dawes Exp $ */ /* * Functions to manipulate card database. @@ -54,7 +54,7 @@ { if (fgets(l, 128, f) == NULL) return -1; -#ifdef __EMX__ +#ifdef __UNIXOS2__ { char *p = strchr(l,'\r'); if (p) { @@ -107,7 +107,7 @@ int i, lineno; char filename[128]; -#ifndef __EMX__ +#ifndef __UNIXOS2__ strcpy(filename, CARD_DATABASE_FILE); #else strcpy(filename, (char*)__XOS2RedirRoot(CARD_DATABASE_FILE)); Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c diff -u xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.59 xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.69 --- xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.59 Sat Oct 27 23:34:09 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c Wed Feb 19 23:05:15 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.59 2001/10/28 03:34:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.69 2003/02/20 04:05:15 dawes Exp $ */ /* * This is a configuration program that will create a base XF86Config @@ -53,6 +53,7 @@ * of /usr/X11R6/lib/X11. * Add RAMDAC and Clockchip menu. * 27Mar99 Modified for XFree86 4.0 config file format + * 06Sep02 Write comment block about 'DontVTSwitch'. * * Possible enhancements: * - Add more standard mode timings (also applies to README.Config). Missing @@ -76,6 +77,22 @@ * New 'Configuration of XKB' section. * Author: Ivan Pascal The XFree86 Project. */ +/* + * Nov2002 + * Some enhancements: + * - Add new PS/2 mouse protocol. + * "IMPS/2","ExplorerPS/2","ThinkingMousePS/2","MouseManPlusPS/2", + * "GlidePointPS/2","NetMousePS/2" and "NetScrollPS/2". + * - Add mouse-speed setting for PS/2 mouse. + * - Fix seg.fault problem on Solaris. + * - Add modestring "1400x1050"(for ATI Mobile-Rage). + * - Add videomemory 8192, 16384, 32768, 65536, 131072 and 262144. + * - Load "speedo" module. + * - Ready to DRI. + * - Load xtt module instead of freetype module. + * - Add font path "/fonts/TrueType/" and "/fonts/freefont/". + * Chisato Yamauchi(cyamauch@phyas.aichi-edu.ac.jp) + */ /* $XConsortium: xf86config.c /main/21 1996/10/28 05:43:57 kaleb $ */ #include <stdlib.h> @@ -87,6 +104,13 @@ #include <sys/types.h> #include <sys/stat.h> +/* hv: fix a few EMX problems, will disappear with real UnixOS/2 */ +#ifdef __UNIXOS2__ +#define sync() /*nothing*/ +static int getuid() { return 0; } +#endif + + #include <X11/Xlib.h> #include <X11/extensions/XKBstr.h> #include <X11/extensions/XKBrules.h> @@ -107,13 +131,8 @@ * when the program is told to probe clocks (which can only happen for * root). */ -#ifndef __EMX__ #define TEMPORARY_XF86CONFIG_DIR_PREFIX "/tmp/.xf86config" #define TEMPORARY_XF86CONFIG_FILENAME "XF86Config.tmp" -#else -/* put in root dir, would have to find TMP dir first else */ -#define TEMPORARY_XF86CONFIG_FILENAME "\\XConfig.tmp" -#endif /* * Define this to have /etc/X11/XF86Config prompted for as the default @@ -133,15 +152,12 @@ #define MAX_CLOCKS_LINES 16 -/* (hv) make a number of filenames defines, because I want OS/2 to need just - * 8.3 names here - */ -#ifdef __EMX__ -#define DUMBCONFIG2 "\\dconfig.2" -#define DUMBCONFIG3 "\\dconfig.3" -#else #define DUMBCONFIG2 "dumbconfig.2" #define DUMBCONFIG3 "dumbconfig.3" +#ifndef __UNIXOS2__ +#define XSERVERNAME_FOR_PROBE "X" +#else +#define XSERVERNAME_FOR_PROBE "/usr/X11R6/bin/XFree86" #endif /* some more vars to make path names in texts more flexible. OS/2 users @@ -150,17 +166,10 @@ #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif -#ifndef __EMX__ #define TREEROOT PROJECTROOT #define TREEROOTLX TREEROOT "/lib/X11" #define TREEROOTCFG TREEROOT "/etc/X11" #define MODULEPATH TREEROOT "/lib/modules" -#else -#define TREEROOT "/XFree86" -#define TREEROOTLX TREEROOT "/lib/X11" -#define TREEROOTCFG TREEROOT "/lib/X11" -#define MODULEPATH TREEROOT "/lib/modules" -#endif #ifndef XCONFIGFILE #define XCONFIGFILE "XF86Config" @@ -297,7 +306,6 @@ static void createtmpdir(void) { -#ifndef __EMX__ /* length of prefix + 20 (digits in 2**64) + 1 (slash) + 1 */ temp_dir = Malloc(strlen(TEMPORARY_XF86CONFIG_DIR_PREFIX) + 22); sprintf(temp_dir, "%s%ld", TEMPORARY_XF86CONFIG_DIR_PREFIX, @@ -308,7 +316,6 @@ } /* append a slash */ strcat(temp_dir, "/"); -#endif } @@ -343,7 +350,8 @@ getstring(char *s) { char *cp; - fgets(s, 80, stdin); + if (fgets(s, 80, stdin) == NULL) + exit(1); cp = strchr(s, '\n'); if (cp) *cp=0; @@ -352,68 +360,134 @@ /* * Mouse configuration. * - * (hv) OS/2 (__EMX__) only has an OS supported mouse, so user has no options + * (hv) OS/2 (__UNIXOS2__) only has an OS supported mouse, so user has no options * the server will enable a third button automatically if there is one * We also do the same for QNX4, since we use the OS mouse drivers. */ -static char *mousetype_identifier[] = { - "Microsoft", - "MouseSystems", - "Busmouse", - "PS/2", - "Logitech", - "MouseMan", - "MMSeries", - "MMHitTab", - "IntelliMouse", -#if defined(__EMX__) || defined(QNX4) - "OSMOUSE", +int M_OSMOUSE, M_WSMOUSE, M_AUTO, + M_SYSMOUSE, M_MOUSESYSTEMS, M_PS2, + M_MICROSOFT, M_BUSMOUSE, M_IMPS2, + M_EXPLORER_PS2, M_GLIDEPOINT_PS2, M_MOUSEMANPLUS_PS2, + M_NETMOUSE_PS2, M_NETSCROLL_PS2, M_THINKINGMOUSE_PS2, + M_ACECAD, M_GLIDEPOINT, M_INTELLIMOUSE, + M_LOGITECH, M_MMHITTAB, M_MMSERIES, + M_MOUSEMAN, M_THINKINGMOUSE; + +struct { + char *name; + int *ident; + char *desc; +} mouse_info[] = { +#if defined(__UNIXOS2__) || defined(QNX4) +#define DEF_PROTO_STRING "OSMOUSE" + {"OSMOUSE", &M_OSMOUSE, + "OSMOUSE" + }, #endif #ifdef WSCONS_SUPPORT - "wsmouse", -#endif +#define WS_MOUSE_STRING "wsmouse" +#define DEF_PROTO_STRING WS_MOUSE_STRING + {WS_MOUSE_STRING, &M_WSMOUSE, + "wsmouse protocol" + }, +#endif +#ifndef DEF_PROTO_STRING +#define DEF_PROTO_STRING "Auto" +#endif + {"Auto", &M_AUTO, + "Auto detect" + }, + {"SysMouse", &M_SYSMOUSE, + "SysMouse" + }, +#define M_MOUSESYSTEMS_STRING "MouseSystems" + {M_MOUSESYSTEMS_STRING, &M_MOUSESYSTEMS, + "Mouse Systems (3-button protocol)" + }, + {"PS/2", &M_PS2, + "PS/2 Mouse" + }, +#define M_MICROSOFT_STRING "Microsoft" + {M_MICROSOFT_STRING, &M_MICROSOFT, + "Microsoft compatible (2-button protocol)" + }, + {"Busmouse", &M_BUSMOUSE, + "Bus Mouse" + }, +#ifndef __FreeBSD__ + {"IMPS/2", &M_IMPS2, + "IntelliMouse PS/2" + }, + {"ExplorerPS/2", &M_EXPLORER_PS2, + "Explorer PS/2" + }, + {"GlidePointPS/2", &M_GLIDEPOINT_PS2, + "GlidePoint PS/2" + }, + {"MouseManPlusPS/2", &M_MOUSEMANPLUS_PS2, + "MouseManPlus PS/2" + }, + {"NetMousePS/2", &M_NETMOUSE_PS2, + "NetMouse PS/2" + }, + {"NetScrollPS/2", &M_NETSCROLL_PS2, + "NetScroll PS/2" + }, + {"ThinkingMousePS/2", &M_THINKINGMOUSE_PS2, + "ThinkingMouse PS/2" + }, +#endif + {"AceCad", &M_ACECAD, + "AceCad" + }, + {"GlidePoint", &M_GLIDEPOINT, + "GlidePoint" + }, + {"IntelliMouse", &M_INTELLIMOUSE, + "Microsoft IntelliMouse" + }, + {"Logitech", &M_LOGITECH, + "Logitech Mouse (serial, old type, Logitech protocol)" + }, + {"MMHitTab", &M_MMHITTAB, + "MM HitTablet" + }, + {"MMSeries", &M_MMSERIES, + "MM Series" /* XXXX These descriptions should be improved. */ + }, + {"MouseMan", &M_MOUSEMAN, + "Logitech MouseMan (Microsoft compatible)" + }, + {"ThinkingMouse", &M_THINKINGMOUSE, + "ThinkingMouse" + }, }; -#ifndef __EMX__ +#ifndef __UNIXOS2__ static char *mouseintro_text = "First specify a mouse protocol type. Choose one from the following list:\n" "\n"; -static char *mousetype_name[] = { - "Microsoft compatible (2-button protocol)", - "Mouse Systems (3-button protocol)", - "Bus Mouse", - "PS/2 Mouse", - "Logitech Mouse (serial, old type, Logitech protocol)", - "Logitech MouseMan (Microsoft compatible)", - "MM Series", /* XXXX These descriptions should be improved. */ - "MM HitTablet", - "Microsoft IntelliMouse", -#ifdef WSCONS_SUPPORT - "wsmouse protocol", -#endif -}; - static char *mousedev_text = "Now give the full device name that the mouse is connected to, for example\n" "/dev/tty00. Just pressing enter will use the default, /dev/mouse.\n" #ifdef WSCONS_SUPPORT "On systems with wscons, the default is /dev/wsmouse.\n" #endif +#ifdef __FreeBSD__ +"On FreeBSD, the default is /dev/sysmouse.\n" +#endif "\n"; static char *mousecomment_text = -"If you have a two-button mouse, it is most likely of type 1, and if you have\n" -"a three-button mouse, it can probably support both protocol 1 and 2. There are\n" -"two main varieties of the latter type: mice with a switch to select the\n" -"protocol, and mice that default to 1 and require a button to be held at\n" -"boot-time to select protocol 2. Some mice can be convinced to do 2 by sending\n" -"a special sequence to the serial port (see the ClearDTR/ClearRTS options).\n" +"The recommended protocol is " DEF_PROTO_STRING ". If you have a very old mouse\n" +"or don't want OS support or auto detection, and you have a two-button\n" +"or three-button serial mouse, it is most likely of type " M_MICROSOFT_STRING ".\n" #ifdef WSCONS_SUPPORT "\n" -"If your system uses the wscons console driver, with a PS/2 type mouse, select\n" -"10.\n" +"If your system uses the wscons console driver, with a PS/2 type mouse,\n" +"select " WS_MOUSE_STRING ".\n" #endif "\n"; @@ -447,32 +521,41 @@ "You have selected a Logitech MouseMan type mouse. You might want to enable\n" "ChordMiddle which could cause the third button to work.\n"; -#endif /* !__EMX__ */ +#endif /* !__UNIXOS2__ */ static void mouse_configuration(void) { -#if !defined(__EMX__) && !defined(QNX4) - int i; +#if !defined(__UNIXOS2__) && !defined(QNX4) + int i, j; char s[80]; - printf("%s", mouseintro_text); - - for (i = 0; i < sizeof(mousetype_name)/sizeof(char *); i++) - printf("%2d. %s\n", i + 1, mousetype_name[i]); - - printf("\n"); - printf("%s", mousecomment_text); - - printf("Enter a protocol number: "); - getstring(s); - config_mousetype = atoi(s) - 1; - if (config_mousetype < 0) - config_mousetype = 0; +#define MOUSETYPE_COUNT sizeof(mouse_info)/sizeof(mouse_info[0]) + for (i = 0; i < MOUSETYPE_COUNT; i++) + *(mouse_info[i].ident) = i; + for (i=0;;) { + emptylines(); + printf("%s", mouseintro_text); + for (j = i; j < i + 14 && j < MOUSETYPE_COUNT; j++) + printf("%2d. %s\n", j + 1, mouse_info[j].name); + printf("\n"); + printf("%s", mousecomment_text); + printf("Enter a protocol number: "); + getstring(s); + if (strlen(s) == 0) { + i += 14; + if (i >= MOUSETYPE_COUNT) + i = 0; + continue; + } + config_mousetype = atoi(s) - 1; + if (config_mousetype >= 0 && config_mousetype < MOUSETYPE_COUNT) + break; + } printf("\n"); - if (config_mousetype == 4) { + if (config_mousetype == M_LOGITECH) { /* Logitech. */ printf("%s", logitechmousecomment_text); printf("\n"); @@ -480,14 +563,14 @@ printf("Are you sure it's really not a Microsoft compatible one? "); getstring(s); if (!answerisyes(s)) - config_mousetype = 0; + config_mousetype = M_MICROSOFT; printf("\n"); } config_chordmiddle = 0; - if (config_mousetype == 0 || config_mousetype == 5) { + if (config_mousetype == M_MICROSOFT || config_mousetype == M_MOUSEMAN) { /* Microsoft or MouseMan. */ - if (config_mousetype == 0) + if (config_mousetype == M_MICROSOFT) printf("%s", microsoftmousecomment_text); else printf("%s", mousemancomment_text); @@ -501,7 +584,7 @@ } config_cleardtrrts = 0; - if (config_mousetype == 1) { + if (config_mousetype == M_MOUSESYSTEMS) { /* Mouse Systems. */ printf("%s", mousesystemscomment_text); printf("\n"); @@ -513,20 +596,18 @@ printf("\n"); } - switch (config_mousetype) { - case 0 : /* Microsoft compatible */ + if (config_mousetype == M_MICROSOFT) { if (config_chordmiddle) printf("%s", threebuttonmousecomment_text); else printf("%s", twobuttonmousecomment_text); - break; - case 1 : /* Mouse Systems. */ - case 8 : /* IntelliMouse */ + } + else if (config_mousetype == M_MOUSESYSTEMS || + config_mousetype == M_INTELLIMOUSE) { printf("%s", threebuttonmousecomment_text); - break; - default : + } + else { printf("%s", unknownbuttonsmousecomment_text); - break; } printf("\n"); @@ -544,10 +625,12 @@ printf("Mouse device: "); getstring(s); if (strlen(s) == 0) -#ifndef WSCONS_SUPPORT - config_pointerdevice = "/dev/mouse"; -#else +#ifdef WSCONS_SUPPORT config_pointerdevice = "/dev/wsmouse"; +#elif defined(__FreeBSD__) + config_pointerdevice = "/dev/sysmouse"; +#else + config_pointerdevice = "/dev/mouse"; #endif else { config_pointerdevice = Malloc(strlen(s) + 1); @@ -555,9 +638,9 @@ } printf("\n"); -#else /* __EMX__ */ +#else /* __UNIXOS2__ */ /* set some reasonable defaults for OS/2 */ - config_mousetype = 9; + config_mousetype = M_OSMOUSE; config_chordmiddle = 0; config_cleardtrrts = 0; config_emulate3buttons = 0; @@ -566,7 +649,7 @@ #else config_pointerdevice = "QNXMOUSE"; #endif -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ } @@ -636,19 +719,27 @@ return; } - printf(xkbmodeltext); - for (i=0; i < rules->models.num_desc; i++) { - printf("%3d %-50s\n", i+1, rules->models.desc[i].desc); - } - - printf("\nEnter a number to choose the keyboard.\n\n"); - getstring(s); - if (strlen(s) == 0) - number = 0; - else { - i = atoi(s)-1; - number = (i < 0 || i > rules->models.num_desc) ? 0 : i; + number = -1; + for (i=0;;) { + emptylines(); + printf(xkbmodeltext); + for (j = i; j < i + 16 && j < rules->models.num_desc; j++) + printf("%3d %-50s\n", j+1, rules->models.desc[j].desc); + printf("\nEnter a number to choose the keyboard.\n\n"); + if (rules->models.num_desc >= 16) + printf("Press enter for the next page\n"); + getstring(s); + if (strlen(s) == 0) { + i += 16; + if (i > rules->models.num_desc) + i = 0; + continue; + } + number = atoi(s) - 1; + if (number >= 0 && number < rules->models.num_desc) + break; } + i = strlen(rules->models.desc[number].name) + 1; config_xkbmodel = Malloc(i); sprintf(config_xkbmodel,"%s", rules->models.desc[number].name); @@ -952,10 +1043,14 @@ for (;;) { int j; emptylines(); - for (j = i; j < i + 18 && j <= lastcard; j++) + for (j = i; j < i + 18 && j <= lastcard; j++) { + char *name = card[j].name, + *chipset = card[j].chipset; + printf("%3d %-50s%s\n", j, - card[j].name, - card[j].chipset); + name ? name : "-", + chipset ? chipset : "-"); + } printf("\n"); printf("Enter a number to choose the corresponding card definition.\n"); printf("Press enter for the next page, q to continue configuration.\n"); @@ -978,9 +1073,12 @@ * Look at the selected card. */ if (card_selected != -1) { + char *name = card[card_selected].name, + *chipset = card[card_selected].chipset; + printf("\nYour selected card definition:\n\n"); - printf("Identifier: %s\n", card[card_selected].name); - printf("Chipset: %s\n", card[card_selected].chipset); + printf("Identifier: %s\n", name ? name : "-"); + printf("Chipset: %s\n", chipset ? chipset : "-"); if (!card[card_selected].driver) card[card_selected].driver = "unknown"; printf("Driver: %s\n", card[card_selected].driver); @@ -1016,12 +1114,10 @@ "\n"; static char *videomemoryintro_text = -"You must indicate how much video memory you have. It is probably a good\n" -"idea to use the same approximate amount as that detected by the server you\n" -"intend to use. If you encounter problems that are due to the used server\n" -"not supporting the amount memory you have (e.g. ATI Mach64 is limited to\n" -"1024K with the SVGA server), specify the maximum amount supported by the\n" -"server.\n" +"It is probably a good idea to use the same approximate amount as that detected\n" +"by the server you intend to use. If you encounter problems that are due to the\n" +"used server not supporting the amount memory you have, specify the maximum\n" +"amount supported by the server.\n" "\n" "How much video memory do you have on your video card:\n" "\n"; @@ -1179,10 +1275,14 @@ "differently-sized virtual screen\n" "\n"; -static int videomemory[5] = { - 256, 512, 1024, 2048, 4096 +static int videomemory[] = { + 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144 }; +/* Is this required? */ +#if XFREE86_VERSION >= 400 +#define NU_MODESTRINGS 13 +#else #if XFREE86_VERSION >= 330 #define NU_MODESTRINGS 12 #else @@ -1192,6 +1292,7 @@ #define NU_MODESTRINGS 5 #endif #endif +#endif static char *modestring[NU_MODESTRINGS] = { "\"640x400\"", @@ -1210,6 +1311,9 @@ "\"1800x1400\"", "\"512x384\"" #endif +#if XFREE86_VERSION >= 400 + ,"\"1400x1050\"" +#endif }; #ifdef __EMX__ @@ -1263,18 +1367,16 @@ printf("%s", videomemoryintro_text); - for (i = 0; i < 5; i++) + for (i = 0; i < sizeof(videomemory) / sizeof(videomemory[0]); i++) printf("%2d %dK\n", i + 1, videomemory[i]); - printf(" 6 Other\n\n"); + printf("%2d Other\n\n", i + 1); printf("Enter your choice: "); getstring(s); printf("\n"); c = atoi(s) - 1; - if (c < 0) - c = 0; - if (c < 5) + if (c >= 0 && c < sizeof(videomemory) / sizeof(videomemory[0])) config_videomemory = videomemory[c]; else { printf("Amount of video memory in Kbytes: "); @@ -1338,9 +1440,10 @@ config_virtualy24bpp = 1024; } /* Add 1600x1280 */ - config_modesline8bpp = "\"640x480\" \"800x600\" \"1024x768\" \"1280x1024\""; - config_modesline16bpp = "\"640x480\" \"800x600\" \"1024x768\" \"1280x1024\""; - config_modesline24bpp = "\"640x480\" \"800x600\" \"1024x768\" \"1280x1024\""; + config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; + config_modesline16bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; + config_modesline24bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; + } else if (config_videomemory >= 2048) { @@ -1371,12 +1474,12 @@ config_virtualx24bpp = 1024; config_virtualy24bpp = 768; } - config_modesline8bpp = "\"640x480\" \"800x600\" \"1024x768\" \"1280x1024\""; - config_modesline16bpp = "\"640x480\" \"800x600\" \"1024x768\""; + config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; + config_modesline16bpp = "\"1024x768\" \"800x600\" \"640x480\""; if (config_videomemory >= 2048 + 256) - config_modesline24bpp = "\"640x480\" \"800x600\" \"1024x768\""; + config_modesline24bpp = "\"1024x768\" \"800x600\" \"640x480\""; else - config_modesline24bpp = "\"640x480\" \"800x600\""; + config_modesline24bpp = "\"800x600\" \"640x480\""; } else if (config_videomemory >= 1024) { @@ -1396,15 +1499,15 @@ config_virtualy16bpp = 600; /* it's small enough as it is. */ config_virtualx24bpp = 640; config_virtualy24bpp = 480; - config_modesline8bpp = "\"640x480\" \"800x600\" \"1024x768\""; - config_modesline16bpp = "\"640x480\" \"800x600\""; + config_modesline8bpp = "\"1024x768\" \"800x600\" \"640x480\""; + config_modesline16bpp = "\"800x600\" \"640x480\""; config_modesline24bpp = "\"640x480\""; } else if (config_videomemory >= 512) { config_virtualx8bpp = 800; config_virtualy8bpp = 600; - config_modesline8bpp = "\"640x480\" \"800x600\""; + config_modesline8bpp = "\"800x600\" \"640x480\""; config_modesline16bpp = "\"640x400\""; } else @@ -1802,10 +1905,14 @@ "\n" "# This loads the Type1 and FreeType font modules\n" " Load \"type1\"\n" -" Load \"freetype\"\n" +" Load \"speedo\"\n" +"# Load \"freetype\"\n" +"# Load \"xtt\"\n" "\n" "# This loads the GLX module\n" "# Load \"glx\"\n" +"# This loads the DRI module\n" +"# Load \"dri\"\n" "\n" "EndSection\n" "\n" @@ -1838,8 +1945,10 @@ "/fonts/misc/", "/fonts/75dpi/:unscaled", "/fonts/100dpi/:unscaled", - "/fonts/Type1/", "/fonts/Speedo/", + "/fonts/Type1/", + "/fonts/TrueType/", + "/fonts/freefont/", "/fonts/75dpi/", "/fonts/100dpi/", 0 /* end of fontpaths */ @@ -1866,6 +1975,12 @@ "\n" "# Option \"NoTrapSignals\"\n" "\n" +"# Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence\n" +"# (where n is 1 through 12). This allows clients to receive these key\n" +"# events.\n" +"\n" +"# Option \"DontVTSwitch\"\n" +"\n" "# Uncomment this to disable the <Crtl><Alt><BS> server abort sequence\n" "# This allows clients to receive this key event.\n" "\n" @@ -1911,6 +2026,7 @@ "\n" " Identifier \"Keyboard1\"\n" " Driver \"Keyboard\"\n" +"\n" "# For most OSs the protocol can be omitted (it defaults to \"Standard\").\n" "# When using XQUEUE (only for SVR3 and SVR4, but not Solaris),\n" "# uncomment the following line.\n" @@ -1974,6 +2090,10 @@ static char *pointersection_text2 = "\n" +"# Mouse-speed setting for PS/2 mouse.\n" +"\n" +"# Option \"Resolution\" \"256\"\n" +"\n" "# When using XQUEUE, comment out the above two lines, and uncomment\n" "# the following line.\n" "\n" @@ -2312,6 +2432,10 @@ " InputDevice \"Keyboard1\" \"CoreKeyboard\"\n" "\n" "EndSection\n" +"\n" +"# Section \"DRI\"\n" +"# Mode 0666\n" +"# EndSection\n" "\n"; static void @@ -2406,8 +2530,8 @@ */ fprintf(f, "%s", pointersection_text1); fprintf(f, " Option \"Protocol\" \"%s\"\n", - mousetype_identifier[config_mousetype]); -#if !defined(__EMX__) && !defined(QNX4) + mouse_info[config_mousetype].name); +#if !defined(__UNIXOS2__) && !defined(QNX4) fprintf(f, " Option \"Device\" \"%s\"\n", config_pointerdevice); #endif fprintf(f, "%s", pointersection_text2); @@ -2661,7 +2785,7 @@ "libraries, configuration files and a server that you want to use.\n" "\n"; -#ifndef __EMX__ +#ifndef __UNIXOS2__ static char *oldxfree86_text = "The directory '/usr/X386/bin' exists. You probably have an old version of\n" "XFree86 installed (XFree86 3.1 installs in '" TREEROOT "' instead of\n" @@ -2698,7 +2822,7 @@ printf("\n"); } -#ifndef __EMX__ +#ifndef __UNIXOS2__ ok = exists_dir("/usr/X386/bin"); if (!ok) return; @@ -2716,7 +2840,6 @@ configdir_check(void) { /* /etc/X11 may not exist on some systems */ -#ifndef __EMX__ if (getuid() == 0) { struct stat buf; if (stat("/etc/X11", &buf) == -1 && errno == ENOENT) @@ -2724,7 +2847,6 @@ if (stat(TREEROOTCFG, &buf) == -1 && errno == ENOENT) mkdir(TREEROOTCFG, 0777); } -#endif } Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man diff -u xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.5 xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.6 --- xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.5 Thu Nov 1 18:35:34 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man Sat Oct 12 12:06:44 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man,v 1.5 2001/11/01 23:35:34 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man,v 1.6 2002/10/12 16:06:44 herrb Exp $ .TH xf86config 1 __vendorversion__ .SH NAME xf86config \- generate an XF86Config file @@ -12,7 +12,9 @@ is system-dependent. For instance, on some systems, XF86Config-4 is used, and on OS/2, XConfig is used. .SH FILES -<xroot>/lib/X11/Cards Video cards database +.TP +.I __projectroot__/lib/X11/Cards +Video cards database .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), reconfig(1) .SH AUTHOR Index: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c diff -u xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c:1.7 xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c:1.8 --- xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c:1.7 Thu Jan 20 20:12:24 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c Mon Feb 17 11:08:30 2003 @@ -4,7 +4,7 @@ Written by Mark Vojkovich (mvojkovi@ucsd.edu) */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c,v 1.7 2000/01/21 01:12:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c,v 1.8 2003/02/17 16:08:30 dawes Exp $ */ #include "X.h" #include "Xmd.h" @@ -35,7 +35,6 @@ int cfb8_16ScreenPrivateIndex; static unsigned long cfb8_16Generation = 0; -extern WindowPtr *WindowTable; static PixmapPtr cfb8_16GetWindowPixmap(WindowPtr pWin); static void Index: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c diff -u xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c:1.3 xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c:1.3 Thu Feb 15 14:51:14 2001 +++ xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c Mon Feb 17 11:08:30 2003 @@ -4,7 +4,7 @@ Written by Mark Vojkovich (mvojkovi@ucsd.edu) */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c,v 1.3 2001/02/15 19:51:14 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c,v 1.4 2003/02/17 16:08:30 dawes Exp $ */ #include "X.h" #include "scrnintstr.h" @@ -21,8 +21,6 @@ /* We don't bother with cfb's fastBackground/Border so we don't need to use the Window privates */ - -extern WindowPtr *WindowTable; Bool Index: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c:1.6 xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c:1.6 Mon Feb 28 19:17:16 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c Mon Feb 17 11:08:30 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c,v 1.6 2000/02/29 00:17:16 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbwindow.c,v 1.7 2003/02/17 16:08:30 dawes Exp $ */ #include "X.h" @@ -17,8 +17,6 @@ /* We don't bother with cfb's fastBackground/Border so we don't need to use the Window privates */ - -extern WindowPtr *WindowTable; Bool Index: xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c:1.8 xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c:1.9 --- xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c:1.8 Sat Mar 25 15:14:43 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c Sun Feb 10 19:07:25 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c,v 1.8 2000/03/25 20:14:43 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c,v 1.9 2002/02/11 00:07:25 dawes Exp $ */ /* Copyright (C) 1998. The XFree86 Project Inc. @@ -311,6 +311,7 @@ pmap->red[pScrn->colorKey].refcnt = AllocPrivate; pmap->red[pScrn->colorKey].fShared = FALSE; + pmap->freeRed--; color.red = color.blue = color.green = 0; color.pixel = pScrn->colorKey; Index: xc/programs/Xserver/hw/xnest/Cursor.c diff -u xc/programs/Xserver/hw/xnest/Cursor.c:1.1.1.4 xc/programs/Xserver/hw/xnest/Cursor.c:1.3 --- xc/programs/Xserver/hw/xnest/Cursor.c:1.1.1.4 Tue Jan 16 17:43:42 2001 +++ xc/programs/Xserver/hw/xnest/Cursor.c Sat Nov 23 14:27:50 2002 @@ -12,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Cursor.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */ + #include "X.h" #include "Xproto.h" #include "screenint.h" @@ -26,7 +28,7 @@ #include "Display.h" #include "Screen.h" -#include "Cursor.h" +#include "XNCursor.h" #include "Visual.h" #include "Keyboard.h" #include "Args.h" Index: xc/programs/Xserver/hw/xnest/Cursor.h diff -u xc/programs/Xserver/hw/xnest/Cursor.h:1.1.1.2 xc/programs/Xserver/hw/xnest/Cursor.h:removed --- xc/programs/Xserver/hw/xnest/Cursor.h:1.1.1.2 Tue Jan 16 17:43:43 2001 +++ xc/programs/Xserver/hw/xnest/Cursor.h Thu Feb 27 12:33:53 2003 @@ -1,37 +0,0 @@ -/* $Xorg: Cursor.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ -/* - -Copyright 1993 by Davor Matic - -Permission to use, copy, modify, distribute, and sell this software -and its documentation for any purpose is hereby granted without fee, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTCURSOR_H -#define XNESTCURSOR_H - -typedef struct { - Cursor cursor; -} xnestPrivCursor; - -#define xnestCursorPriv(pCursor, pScreen) \ - ((xnestPrivCursor *)((pCursor)->devPriv[pScreen->myNum])) - -#define xnestCursor(pCursor, pScreen) \ - (xnestCursorPriv(pCursor, pScreen)->cursor) - -void xnestConstrainCursor(); -void xnestCursorLimits(); -Bool xnestDisplayCursor(); -Bool xnestRealizeCursor(); -Bool xnestUnrealizeCursor(); -void xnestRecolorCursor(); -Bool xnestSetCursorPosition(); - -#endif /* XNESTCURSOR_H */ Index: xc/programs/Xserver/hw/xnest/Drawable.h diff -u xc/programs/Xserver/hw/xnest/Drawable.h:1.1.1.3 xc/programs/Xserver/hw/xnest/Drawable.h:1.3 --- xc/programs/Xserver/hw/xnest/Drawable.h:1.1.1.3 Tue Jan 16 17:43:44 2001 +++ xc/programs/Xserver/hw/xnest/Drawable.h Sat Nov 23 14:27:50 2002 @@ -12,12 +12,13 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Drawable.h,v 1.3 2002/11/23 19:27:50 tsi Exp $ */ #ifndef XNESTDRAWABLE_H #define XNESTDRAWABLE_H #include "XNWindow.h" -#include "Pixmap.h" +#include "XNPixmap.h" #define xnestDrawable(pDrawable) \ ((pDrawable)->type == DRAWABLE_WINDOW ? \ Index: xc/programs/Xserver/hw/xnest/Imakefile diff -u xc/programs/Xserver/hw/xnest/Imakefile:3.23 xc/programs/Xserver/hw/xnest/Imakefile:3.27 --- xc/programs/Xserver/hw/xnest/Imakefile:3.23 Sun Sep 30 13:31:52 2001 +++ xc/programs/Xserver/hw/xnest/Imakefile Thu Jan 16 11:09:10 2003 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.23 2001/09/30 17:31:52 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.27 2003/01/16 16:09:10 eich Exp $ #include <Server.tmpl> @@ -57,10 +57,10 @@ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I../../mi -I../../include -I../../os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) + -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(LIBSRC) DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -DNO_HW_ONLY_EXTS \ - -UXFree86LOADER -UMITSHM + -UXFree86LOADER -UMITSHM all:: $(OBJS) Index: xc/programs/Xserver/hw/xnest/Init.c diff -u xc/programs/Xserver/hw/xnest/Init.c:3.23 xc/programs/Xserver/hw/xnest/Init.c:3.24 --- xc/programs/Xserver/hw/xnest/Init.c:3.23 Tue Jul 31 20:44:57 2001 +++ xc/programs/Xserver/hw/xnest/Init.c Tue Jan 14 21:34:14 2003 @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.23 2001/08/01 00:44:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.24 2003/01/15 02:34:14 torrey Exp $ */ #include "X.h" #include "Xproto.h" @@ -121,6 +121,22 @@ void DarwinHandleGUI(int argc, char *argv[]) { +} + +void GlxExtensionInit(); +void GlxWrapInitVisuals(void *procPtr); + +void +DarwinGlxExtensionInit() +{ + GlxExtensionInit(); +} + +void +DarwinGlxWrapInitVisuals( + void *procPtr) +{ + GlxWrapInitVisuals(procPtr); } #endif Index: xc/programs/Xserver/hw/xnest/Pixmap.c diff -u xc/programs/Xserver/hw/xnest/Pixmap.c:3.3 xc/programs/Xserver/hw/xnest/Pixmap.c:3.6 --- xc/programs/Xserver/hw/xnest/Pixmap.c:3.3 Sat Oct 27 23:34:11 2001 +++ xc/programs/Xserver/hw/xnest/Pixmap.c Fri Jan 10 08:29:40 2003 @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Pixmap.c,v 3.3 2001/10/28 03:34:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Pixmap.c,v 3.6 2003/01/10 13:29:40 eich Exp $ */ #include "X.h" #include "Xproto.h" @@ -28,8 +28,12 @@ #include "Display.h" #include "Screen.h" -#include "Pixmap.h" +#include "XNPixmap.h" +#ifdef PIXPRIV +int xnestPixmapPrivateIndex; +#endif + PixmapPtr xnestCreatePixmap(pScreen, width, height, depth) ScreenPtr pScreen; int width; @@ -38,7 +42,7 @@ { PixmapPtr pPixmap; - pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + sizeof(xnestPrivPixmap)); + pPixmap = AllocatePixmap(pScreen, sizeof(xnestPrivPixmap)); if (!pPixmap) return NullPixmap; pPixmap->drawable.type = DRAWABLE_PIXMAP; @@ -54,7 +58,12 @@ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->refcnt = 1; pPixmap->devKind = PixmapBytePad(width, depth); +#ifdef PIXPRIV + pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr = + (pointer)((char *)pPixmap + pScreen->totalPixmapSize); +#else pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1); +#endif if (width && height) xnestPixmapPriv(pPixmap)->pixmap = XCreatePixmap(xnestDisplay, Index: xc/programs/Xserver/hw/xnest/Pixmap.h diff -u xc/programs/Xserver/hw/xnest/Pixmap.h:1.1.1.2 xc/programs/Xserver/hw/xnest/Pixmap.h:removed --- xc/programs/Xserver/hw/xnest/Pixmap.h:1.1.1.2 Tue Jan 16 17:43:49 2001 +++ xc/programs/Xserver/hw/xnest/Pixmap.h Thu Feb 27 12:33:53 2003 @@ -1,34 +0,0 @@ -/* $Xorg: Pixmap.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ -/* - -Copyright 1993 by Davor Matic - -Permission to use, copy, modify, distribute, and sell this software -and its documentation for any purpose is hereby granted without fee, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTPIXMAP_H -#define XNESTPIXMAP_H - -typedef struct { - Pixmap pixmap; -} xnestPrivPixmap; - -#define xnestPixmapPriv(pPixmap) \ - ((xnestPrivPixmap *)((pPixmap)->devPrivate.ptr)) - -#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap) - -#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++) - -PixmapPtr xnestCreatePixmap(); -Bool xnestDestroyPixmap(); -RegionPtr xnestPixmapToRegion(); - -#endif /* XNESTPIXMAP_H */ Index: xc/programs/Xserver/hw/xnest/Screen.c diff -u xc/programs/Xserver/hw/xnest/Screen.c:3.9 xc/programs/Xserver/hw/xnest/Screen.c:3.11 --- xc/programs/Xserver/hw/xnest/Screen.c:3.9 Thu Mar 22 20:27:09 2001 +++ xc/programs/Xserver/hw/xnest/Screen.c Fri Jan 10 08:29:40 2003 @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.9 2001/03/23 01:27:09 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.11 2003/01/10 13:29:40 eich Exp $ */ #include "X.h" #include "Xproto.h" @@ -27,13 +27,12 @@ #include "Display.h" #include "Screen.h" -#include "Args.h" #include "XNGC.h" #include "GCOps.h" #include "Drawable.h" #include "XNFont.h" #include "Color.h" -#include "Cursor.h" +#include "XNCursor.h" #include "Visual.h" #include "Events.h" #include "Init.h" @@ -45,6 +44,10 @@ Window xnestDefaultWindows[MAXSCREENS]; Window xnestScreenSaverWindows[MAXSCREENS]; +#ifdef PIXPRIV +int xnestScreenGeneration = -1; +#endif + ScreenPtr xnestScreen(window) Window window; { @@ -144,6 +147,17 @@ sizeof(xnestPrivGC)))) return False; +#ifdef PIXPRIV + if (xnestScreenGeneration != serverGeneration) { + if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0) + return False; + xnestScreenGeneration = serverGeneration; + } + + if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex, + sizeof (xnestPrivPixmap))) + return False; +#endif visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec)); numVisuals = 0; Index: xc/programs/Xserver/hw/xnest/XNCursor.h diff -u /dev/null xc/programs/Xserver/hw/xnest/XNCursor.h:1.2 --- /dev/null Thu Feb 27 12:33:53 2003 +++ xc/programs/Xserver/hw/xnest/XNCursor.h Sat Nov 23 14:27:50 2002 @@ -0,0 +1,38 @@ +/* $Xorg: Cursor.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ +/* + +Copyright 1993 by Davor Matic + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. Davor Matic makes no representations about +the suitability of this software for any purpose. It is provided "as +is" without express or implied warranty. + +*/ +/* $XFree86: xc/programs/Xserver/hw/xnest/XNCursor.h,v 1.2 2002/11/23 19:27:50 tsi Exp $ */ + +#ifndef XNESTCURSOR_H +#define XNESTCURSOR_H + +typedef struct { + Cursor cursor; +} xnestPrivCursor; + +#define xnestCursorPriv(pCursor, pScreen) \ + ((xnestPrivCursor *)((pCursor)->devPriv[pScreen->myNum])) + +#define xnestCursor(pCursor, pScreen) \ + (xnestCursorPriv(pCursor, pScreen)->cursor) + +void xnestConstrainCursor(); +void xnestCursorLimits(); +Bool xnestDisplayCursor(); +Bool xnestRealizeCursor(); +Bool xnestUnrealizeCursor(); +void xnestRecolorCursor(); +Bool xnestSetCursorPosition(); + +#endif /* XNESTCURSOR_H */ Index: xc/programs/Xserver/hw/xnest/XNPixmap.h diff -u /dev/null xc/programs/Xserver/hw/xnest/XNPixmap.h:1.3 --- /dev/null Thu Feb 27 12:33:53 2003 +++ xc/programs/Xserver/hw/xnest/XNPixmap.h Fri Jan 10 08:29:40 2003 @@ -0,0 +1,44 @@ +/* $Xorg: Pixmap.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ +/* + +Copyright 1993 by Davor Matic + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. Davor Matic makes no representations about +the suitability of this software for any purpose. It is provided "as +is" without express or implied warranty. + +*/ +/* $XFree86: xc/programs/Xserver/hw/xnest/XNPixmap.h,v 1.3 2003/01/10 13:29:40 eich Exp $ */ + +#ifndef XNESTPIXMAP_H +#define XNESTPIXMAP_H + +#ifdef PIXPRIV +extern int xnestPixmapPrivateIndex; +#endif + +typedef struct { + Pixmap pixmap; +} xnestPrivPixmap; + +#ifdef PIXPRIV +#define xnestPixmapPriv(pPixmap) \ + ((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr)) +#else +#define xnestPixmapPriv(pPixmap) \ + ((xnestPrivPixmap *)((pPixmap)->devPrivate.ptr)) +#endif + +#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap) + +#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++) + +PixmapPtr xnestCreatePixmap(); +Bool xnestDestroyPixmap(); +RegionPtr xnestPixmapToRegion(); + +#endif /* XNESTPIXMAP_H */ Index: xc/programs/Xserver/hw/xnest/os2Stub.c diff -u xc/programs/Xserver/hw/xnest/os2Stub.c:3.0 xc/programs/Xserver/hw/xnest/os2Stub.c:3.1 --- xc/programs/Xserver/hw/xnest/os2Stub.c:3.0 Mon May 13 02:44:20 1996 +++ xc/programs/Xserver/hw/xnest/os2Stub.c Fri May 31 14:46:04 2002 @@ -26,12 +26,14 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xnest/os2Stub.c,v 3.0 1996/05/13 06:44:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/os2Stub.c,v 3.1 2002/05/31 18:46:04 dawes Exp $ */ /* This below implements select() for calls in xnest. It has been */ /* somewhat optimized for improved performance, but assumes a few */ /* things so it cannot be used as a general select. */ +#define I_NEED_OS2_H +#include "Xpoll.h" #include <stdio.h> #include <sys/select.h> #include <sys/errno.h> @@ -43,7 +45,6 @@ #undef BOOL #undef BYTE #include <os2.h> -#include "Xpoll.h" HEV hPipeSem; HMODULE hmod_so32dll; Index: xc/programs/Xserver/hw/xwin/Imakefile diff -u xc/programs/Xserver/hw/xwin/Imakefile:1.12 xc/programs/Xserver/hw/xwin/Imakefile:1.15 --- xc/programs/Xserver/hw/xwin/Imakefile:1.12 Sun Nov 11 17:45:57 2001 +++ xc/programs/Xserver/hw/xwin/Imakefile Wed Feb 12 10:01:38 2003 @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.12 2001/11/11 22:45:57 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.15 2003/02/12 15:01:38 alanh Exp $ #include <Server.tmpl> @@ -41,7 +41,26 @@ winlayer.c \ winerror.c \ winengine.c \ - wincreatewnd.c + wincreatewnd.c \ + winregistry.c \ + winconfig.c \ + winmsg.c \ + winmultiwindowwindow.c \ + winmultiwindowwm.c \ + winclipboardinit.c \ + winclipboardtextconv.c \ + winclipboardthread.c \ + winclipboardunicode.c \ + winclipboardwndproc.c \ + winclipboardxevents.c + +/* + * NOTE: The windialogs.rc file is compiled into windialogs.res. + * This compiled-resource file must be directly linked into XWin.exe + * by the commands in xc/programs/Xserver/Imakefile; it cannot be + * linked into libXwin.a because it will not be correctly positioned + * in the XWin.exe image for Windows to be able to find the resources. + */ OBJS = InitInput.o \ InitOutput.o \ @@ -75,7 +94,18 @@ winlayer.o \ winerror.o \ winengine.o \ - wincreatewnd.o + wincreatewnd.o \ + winregistry.o \ + winconfig.o \ + winmsg.o \ + winmultiwindowwindow.o \ + winmultiwindowwm.o \ + winclipboardinit.o \ + winclipboardtextconv.o \ + winclipboardthread.o \ + winclipboardunicode.o \ + winclipboardwndproc.o \ + winclipboardxevents.o INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ @@ -84,10 +114,18 @@ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I$(SERVERSRC)/render -I$(SERVERSRC)/randr -DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI +DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI \ + -DPROJECTROOT="\"$(PROJECTROOT)\"" LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) SpecialCObjectRule(stubs,$(ICONFIGFILES),$(EXT_DEFINES)) + + +/* + * Build the Windows resource file (contains the program icon, etc.) + */ + +ResourceObjectRule(XWin,,) NormalLibraryObjectRule() NormalLibraryTarget(Xwin,$(OBJS)) Index: xc/programs/Xserver/hw/xwin/InitInput.c diff -u xc/programs/Xserver/hw/xwin/InitInput.c:1.9 xc/programs/Xserver/hw/xwin/InitInput.c:1.12 --- xc/programs/Xserver/hw/xwin/InitInput.c:1.9 Fri Dec 14 14:59:52 2001 +++ xc/programs/Xserver/hw/xwin/InitInput.c Wed Feb 12 10:01:38 2003 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.9 2001/12/14 19:59:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.12 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -57,15 +57,15 @@ void ProcessInputEvents (void) { -#if CYGDEBUG - ErrorF ("ProcessInputEvents ()\n"); +#if 0 + ErrorF ("ProcessInputEvents\n"); #endif mieqProcessInputEvents (); miPointerUpdate (); -#if CYGDEBUG - ErrorF ("ProcessInputEvents () - returning\n"); +#if 0 + ErrorF ("ProcessInputEvents - returning\n"); #endif } @@ -86,7 +86,7 @@ DeviceIntPtr pMouse, pKeyboard; #if CYGDEBUG - ErrorF ("InitInput ()\n"); + ErrorF ("InitInput\n"); #endif pMouse = AddInputDevice (winMouseProc, TRUE); @@ -109,7 +109,8 @@ if (g_fdMessageQueue == -1) { - FatalError ("InitInput () - Failed opening /dev/windows\n"); + FatalError ("InitInput - Failed opening %s\n", + WIN_MSG_QUEUE_FNAME); } /* Add the message queue as a device to wait for in WaitForSomething */ @@ -117,7 +118,7 @@ } #if CYGDEBUG - ErrorF ("InitInput () - returning\n"); + ErrorF ("InitInput - returning\n"); #endif } @@ -127,21 +128,21 @@ XTestGenerateEvent (int dev_type, int keycode, int keystate, int mousex, int mousey) { - ErrorF ("XTestGenerateEvent ()\n"); + ErrorF ("XTestGenerateEvent\n"); } void XTestGetPointerPos (short *fmousex, short *fmousey) { - ErrorF ("XTestGetPointerPos ()\n"); + ErrorF ("XTestGetPointerPos\n"); } void XTestJumpPointer (int jx, int jy, int dev_type) { - ErrorF ("XTestJumpPointer ()\n"); + ErrorF ("XTestJumpPointer\n"); } #endif Index: xc/programs/Xserver/hw/xwin/InitOutput.c diff -u xc/programs/Xserver/hw/xwin/InitOutput.c:1.27 xc/programs/Xserver/hw/xwin/InitOutput.c:1.32 --- xc/programs/Xserver/hw/xwin/InitOutput.c:1.27 Fri Dec 14 14:59:53 2001 +++ xc/programs/Xserver/hw/xwin/InitOutput.c Wed Feb 12 10:01:38 2003 @@ -26,10 +26,16 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.27 2001/12/14 19:59:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.32 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" +#include "winconfig.h" + +/* + * General global variables + */ + int g_iNumScreens = 0; winScreenInfo g_ScreenInfo[MAXSCREENS]; int g_iLastScreen = -1; @@ -38,20 +44,59 @@ int g_iCmapPrivateIndex = -1; int g_iGCPrivateIndex = -1; int g_iPixmapPrivateIndex = -1; +int g_iWindowPrivateIndex = -1; unsigned long g_ulServerGeneration = 0; Bool g_fInitializedDefaultScreens = FALSE; FILE *g_pfLog = NULL; +DWORD g_dwEnginesSupported = 0; +HINSTANCE g_hInstance = 0; +HWND g_hDlgDepthChange = NULL; +Bool g_fCalledSetLocale = FALSE; + + +/* + * Global variables for dynamically loaded libraries and + * their function pointers + */ + +HMODULE g_hmodDirectDraw = NULL; +FARPROC g_fpDirectDrawCreate = NULL; +FARPROC g_fpDirectDrawCreateClipper = NULL; + +HMODULE g_hmodCommonControls = NULL; +FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)())NoopDDA; -extern void OsVendorVErrorF (const char *pszFormat, va_list va_args); + +/* Function prototypes */ + +#ifdef DDXOSVERRORF +void OsVendorVErrorF (const char *pszFormat, va_list va_args); +#endif + + +/* + * For the depth 24 pixmap we default to 32 bits per pixel, but + * we change this pixmap format later if we detect that the display + * is going to be running at 24 bits per pixel. + * + * FIXME: On second thought, don't DIBs only support 32 bits per pixel? + * DIBs are the underlying bitmap used for DirectDraw surfaces, so it + * seems that all pixmap formats with depth 24 would be 32 bits per pixel. + * Confirm whether depth 24 DIBs can have 24 bits per pixel, then remove/keep + * the bits per pixel adjustment and update this comment to reflect the + * situation. Harold Hunt - 2002/07/02 + */ static PixmapFormatRec g_PixmapFormats[] = { - { 1, 1, BITMAP_SCANLINE_PAD }, - { 4, 8, BITMAP_SCANLINE_PAD }, - { 8, 8, BITMAP_SCANLINE_PAD }, - { 15, 16, BITMAP_SCANLINE_PAD }, - { 16, 16, BITMAP_SCANLINE_PAD }, - { 24, 24, BITMAP_SCANLINE_PAD }, - { 32, 32, BITMAP_SCANLINE_PAD } + { 1, 1, BITMAP_SCANLINE_PAD }, + { 4, 8, BITMAP_SCANLINE_PAD }, + { 8, 8, BITMAP_SCANLINE_PAD }, + { 15, 16, BITMAP_SCANLINE_PAD }, + { 16, 16, BITMAP_SCANLINE_PAD }, + { 24, 32, BITMAP_SCANLINE_PAD }, +#ifdef RENDER + { 32, 32, BITMAP_SCANLINE_PAD } +#endif }; const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); @@ -71,10 +116,14 @@ ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); /* Get default width and height */ + /* + * NOTE: These defaults will cause the window to cover only + * the primary monitor in the case that we have multiple monitors. + */ dwWidth = GetSystemMetrics (SM_CXSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN); - ErrorF ("winInitializeDefaultScreens () - w %d h %d\n", dwWidth, dwHeight); + ErrorF ("winInitializeDefaultScreens - w %d h %d\n", dwWidth, dwHeight); /* Set a default DPI, if no parameter was passed */ if (monitorResolution == 0) @@ -85,10 +134,23 @@ g_ScreenInfo[i].dwScreen = i; g_ScreenInfo[i].dwWidth = dwWidth; g_ScreenInfo[i].dwHeight = dwHeight; - g_ScreenInfo[i].dwDepth = WIN_DEFAULT_DEPTH; + g_ScreenInfo[i].dwUserWidth = dwWidth; + g_ScreenInfo[i].dwUserHeight = dwHeight; + g_ScreenInfo[i].fUserGaveHeightAndWidth + = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH; + g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP; + g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES; + g_ScreenInfo[i].fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO; g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH; g_ScreenInfo[i].pfb = NULL; g_ScreenInfo[i].fFullScreen = FALSE; + g_ScreenInfo[i].fDecoration = TRUE; + g_ScreenInfo[i].fRootless = FALSE; + g_ScreenInfo[i].fMultiWindow = FALSE; + g_ScreenInfo[i].fMultipleMonitors = FALSE; + g_ScreenInfo[i].fClipboard = FALSE; + g_ScreenInfo[i].fLessPointer = FALSE; + g_ScreenInfo[i].fScrollbars = FALSE; g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) * 25.4; @@ -97,20 +159,13 @@ g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL; g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; g_ScreenInfo[i].fIgnoreInput = FALSE; + g_ScreenInfo[i].fExplicitScreen = FALSE; } /* Signal that the default screens have been initialized */ g_fInitializedDefaultScreens = TRUE; -} - -DWORD -winBitsPerPixel (DWORD dwDepth) -{ - if (dwDepth == 1) return 1; - else if (dwDepth <= 8) return 8; - else if (dwDepth <= 16) return 16; - else return 32; + ErrorF ("winInitializeDefaultScreens - Returning\n"); } @@ -119,7 +174,7 @@ ddxGiveUp() { #if CYGDEBUG - ErrorF ("ddxGiveUp ()\n"); + ErrorF ("ddxGiveUp\n"); #endif /* Close our handle to our message queue */ @@ -142,6 +197,26 @@ g_pfLog = NULL; } + /* + * At this point we aren't creating any new screens, so + * we are guaranteed to not need the DirectDraw functions. + */ + if (g_hmodDirectDraw != NULL) + { + FreeLibrary (g_hmodDirectDraw); + g_hmodDirectDraw = NULL; + g_fpDirectDrawCreate = NULL; + g_fpDirectDrawCreateClipper = NULL; + } + + /* Unload our TrackMouseEvent funtion pointer */ + if (g_hmodCommonControls != NULL) + { + FreeLibrary (g_hmodCommonControls); + g_hmodCommonControls = NULL; + g_fpTrackMouseEvent = (FARPROC) (void (*)())NoopDDA; + } + /* Tell Windows that we want to end the app */ PostQuitMessage (0); } @@ -152,7 +227,7 @@ AbortDDX (void) { #if CYGDEBUG - ErrorF ("AbortDDX ()\n"); + ErrorF ("AbortDDX\n"); #endif ddxGiveUp (); } @@ -173,6 +248,8 @@ /* Add a default screen if no screens were specified */ if (g_iNumScreens == 0) { + ErrorF ("OsVendorInit - Creating bogus screen 0\n"); + /* * We need to initialize default screens if no arguments * were processed. Otherwise, the default screens would @@ -187,6 +264,9 @@ */ g_iNumScreens = 1; g_iLastScreen = 0; + + /* We have to flag this as an explicit screen, even though it isn't */ + g_ScreenInfo[0].fExplicitScreen = TRUE; } } @@ -200,31 +280,77 @@ "\twith a DirectDraw engine.\n"); ErrorF ("-emulate3buttons [timeout]\n" - "\tEmulate 3 button mouse with an optional timeout in " - "milliseconds\n"); + "\tEmulate 3 button mouse with an optional timeout in\n" + "\tmilliseconds.\n"); ErrorF ("-engine engine_type_id\n" "\tOverride the server's automatically selected engine type:\n" "\t\t1 - Shadow GDI\n" "\t\t2 - Shadow DirectDraw\n" - "\t\t4 - Shadow DirectDraw4\n" + "\t\t4 - Shadow DirectDraw4 Non-Locking\n" "\t\t16 - Native GDI - experimental\n"); ErrorF ("-fullscreen\n" - "\tRun the server in fullscreen mode\n"); + "\tRun the server in fullscreen mode.\n"); ErrorF ("-refresh rate_in_Hz\n" "\tSpecify an optional refresh rate to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); - ErrorF ("-screen scr_num width height\n" - "\tSet screen scr_num's width and height\n"); + ErrorF ("-screen scr_num [width height]\n" + "\tEnable screen scr_num and optionally specify a width and\n" + "\theight for that screen.\n"); + + ErrorF ("-lesspointer\n" + "\tHide the windows mouse pointer when it is over an inactive\n" + "\tXFree86 window. This prevents ghost cursors appearing where\n" + "\tthe Windows cursor is drawn overtop of the X cursor\n"); + + ErrorF ("-nodecoration\n" + "\tDo not draw a window border, title bar, etc. Windowed\n" + "\tmode only.\n"); + + ErrorF ("-rootless\n" + "\tEXPERIMENTAL: Run the server in pseudo-rootless mode.\n"); + + ErrorF ("-multiwindow\n" + "\tEXPERIMENTAL: Run the server in multi-window mode.\n"); + + ErrorF ("-multiplemonitors\n" + "\tEXPERIMENTAL: Use the entire virtual screen if multiple\n" + "\tmonitors are present.\n"); + + ErrorF ("-clipboard\n" + "\tEXPERIMENTAL: Run the clipboard integration module.\n"); + + ErrorF ("-scrollbars\n" + "\tIn windowed mode, allow screens bigger than the Windows desktop.\n" + "\tMoreover, if the window has decorations, one can now resize\n" + "\tit.\n"); + + ErrorF ("-clipupdates num_boxes\n" + "\tUse a clipping region to constrain shadow update blits to\n" + "\tthe updated region when num_boxes, or more, are in the\n" + "\tupdated region. Currently supported only by `-engine 1'.\n"); + + ErrorF ("-emulatepseudo\n" + "\tCreate a depth 8 PseudoColor visual when running in\n" + "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n" + "\tdepths. The PseudoColor visual does not have correct colors,\n" + "\tand it may crash, but it at least allows you to run your\n" + "\tapplication in TrueColor modes.\n"); ErrorF ("-[no]unixkill\n" - "\tCtrl+Alt+Backspace exits the X Server\n"); + "\tCtrl+Alt+Backspace exits the X Server.\n"); ErrorF ("-[no]winkill\n" - "\tAlt+F4 exits the X Server\n"); + "\tAlt+F4 exits the X Server.\n"); + + ErrorF ("-xf86config\n" + "\tSpecify a configuration file.\n"); + + ErrorF ("-keyboard\n" + "\tSpecify a keyboard device from the configuration file.\n"); } @@ -247,13 +373,19 @@ * you should display the UseMsg () and return 0. */ +/* Check if enough arguments are given for the option */ +#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; } + +/* Compare the current option with the string. */ +#define IS_OPTION(name) (strcmp (argv[i], name) == 0) + int ddxProcessArgument (int argc, char *argv[], int i) { - static Bool beenHere = FALSE; + static Bool s_fBeenHere = FALSE; /* Initialize once */ - if (!beenHere) + if (!s_fBeenHere) { #ifdef DDXOSVERRORF /* @@ -266,38 +398,38 @@ if (g_pfLog == NULL) g_pfLog = fopen (WIN_LOG_FNAME, "w"); #endif - - beenHere = TRUE; - /* Detach from any console we are connected to */ - FreeConsole (); + s_fBeenHere = TRUE; /* * Initialize default screen settings. We have to do this before * OsVendorInit () gets called, otherwise we will overwrite * settings changed by parameters such as -fullscreen, etc. */ - ErrorF ("ddxProcessArgument () - Initializing default screens\n"); + ErrorF ("ddxProcessArgument - Initializing default screens\n"); winInitializeDefaultScreens (); - } + } #if CYGDEBUG - ErrorF ("ddxProcessArgument ()\n"); + ErrorF ("ddxProcessArgument - arg: %s\n", argv[i]); #endif /* - * Look for the '-screen scr_num width height' argument + * Look for the '-screen scr_num [width height]' argument */ if (strcmp (argv[i], "-screen") == 0) { int iArgsProcessed = 1; int nScreenNum; + int iWidth, iHeight; - ErrorF ("ddxProcessArgument () - screen - argc: %d i: %d\n", +#if CYGDEBUG + ErrorF ("ddxProcessArgument - screen - argc: %d i: %d\n", argc, i); +#endif /* Display the usage message if the argument is malformed */ - if (i + 2 >= argc) + if (i + 1 >= argc) { return 0; } @@ -308,44 +440,63 @@ /* Validate the specified screen number */ if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) { - ErrorF ("ddxProcessArgument () - Invalid screen number %d\n", + ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n", nScreenNum); UseMsg (); return 0; } /* Look for 'WxD' or 'W D' */ - if (2 == sscanf (argv[i + 2], "%dx%d", - (int *) &g_ScreenInfo[nScreenNum].dwWidth, - (int *) &g_ScreenInfo[nScreenNum].dwHeight)) + if (i + 2 < argc + && 2 == sscanf (argv[i + 2], "%dx%d", + (int *) &iWidth, + (int *) &iHeight)) { + ErrorF ("ddxProcessArgument - screen - Found ``WxD'' arg\n"); iArgsProcessed = 3; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; + g_ScreenInfo[nScreenNum].dwWidth = iWidth; + g_ScreenInfo[nScreenNum].dwHeight = iHeight; + g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; + g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; } else if (i + 3 < argc && 1 == sscanf (argv[i + 2], "%d", - (int *) &g_ScreenInfo[nScreenNum].dwWidth) + (int *) &iWidth) && 1 == sscanf (argv[i + 3], "%d", - (int *) &g_ScreenInfo[nScreenNum].dwHeight)) + (int *) &iHeight)) { + ErrorF ("ddxProcessArgument - screen - Found ``W D'' arg\n"); iArgsProcessed = 4; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; + g_ScreenInfo[nScreenNum].dwWidth = iWidth; + g_ScreenInfo[nScreenNum].dwHeight = iHeight; + g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; + g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; } else { - /* I see no height and width here */ - ErrorF ("ddxProcessArgument () - Invalid screen width and " - "height: %s\n", - argv[i + 2]); - return 0; + ErrorF ("ddxProcessArgument - screen - Did not find size arg. " + "dwWidth: %d dwHeight: %d\n", + g_ScreenInfo[nScreenNum].dwWidth, + g_ScreenInfo[nScreenNum].dwHeight); + iArgsProcessed = 2; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; } - /* Calculate the screen width and height in millimeters */ - g_ScreenInfo[nScreenNum].dwWidth_mm - = (g_ScreenInfo[nScreenNum].dwWidth - / monitorResolution) * 25.4; - g_ScreenInfo[nScreenNum].dwHeight_mm - = (g_ScreenInfo[nScreenNum].dwHeight - / monitorResolution) * 25.4; + if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth) + { + g_ScreenInfo[nScreenNum].dwWidth_mm + = (g_ScreenInfo[nScreenNum].dwWidth + / monitorResolution) * 25.4; + g_ScreenInfo[nScreenNum].dwHeight_mm + = (g_ScreenInfo[nScreenNum].dwHeight + / monitorResolution) * 25.4; + } + + /* Flag that this screen was explicity specified by the user */ + g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE; /* * Keep track of the last screen number seen, as parameters seen @@ -412,7 +563,7 @@ /* * Look for the '-fullscreen' argument */ - if (strcmp(argv[i], "-fullscreen") == 0) + if (strcmp (argv[i], "-fullscreen") == 0) { /* Is this parameter attached to a screen or is it global? */ if (-1 == g_iLastScreen) @@ -423,22 +574,223 @@ for (j = 0; j < MAXSCREENS; j++) { g_ScreenInfo[j].fFullScreen = TRUE; + + /* + * No scrollbars in fullscreen mode. Later, we may want to have + * a fullscreen with a bigger virtual screen? + */ + g_ScreenInfo[j].fScrollbars = FALSE; } } else { /* Parameter is for a single screen */ g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE; + + /* + * No scrollbars in fullscreen mode. Later, we may want to have + * a fullscreen with a bigger virtual screen? + */ + g_ScreenInfo[g_iLastScreen].fScrollbars = FALSE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-lesspointer' argument + */ + if (strcmp (argv[i], "-lesspointer") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fLessPointer = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fLessPointer = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-nodecoration' argument + */ + if (strcmp (argv[i], "-nodecoration") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fDecoration = FALSE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fDecoration = FALSE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-rootless' argument + */ + if (strcmp (argv[i], "-rootless") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fRootless = TRUE; + } } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fRootless = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-multiwindow' argument + */ + if (strcmp (argv[i], "-multiwindow") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fMultiWindow = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultiWindow = TRUE; + } /* Indicate that we have processed this argument */ return 1; } /* + * Look for the '-multiplemonitors' argument + */ + if (strcmp (argv[i], "-multiplemonitors") == 0 + || strcmp (argv[i], "-multimonitors") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fMultipleMonitors = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-scrollbars' argument + */ + if (strcmp (argv[i], "-scrollbars") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + /* No scrollbar in fullscreen mode */ + if (!g_ScreenInfo[j].fFullScreen) + g_ScreenInfo[j].fScrollbars = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + if (!g_ScreenInfo[g_iLastScreen].fFullScreen) + { + /* No scrollbar in fullscreen mode */ + g_ScreenInfo[g_iLastScreen].fScrollbars = TRUE; + } + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-clipboard' argument + */ + if (strcmp (argv[i], "-clipboard") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fClipboard = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fClipboard = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* * Look for the '-ignoreinput' argument */ - if (strcmp(argv[i], "-ignoreinput") == 0) + if (strcmp (argv[i], "-ignoreinput") == 0) { /* Is this parameter attached to a screen or is it global? */ if (-1 == g_iLastScreen) @@ -464,7 +816,7 @@ /* * Look for the '-emulate3buttons' argument */ - if (strcmp(argv[i], "-emulate3buttons") == 0) + if (strcmp (argv[i], "-emulate3buttons") == 0) { int iArgsProcessed = 1; int iE3BTimeout = WIN_DEFAULT_E3B_TIME; @@ -502,7 +854,7 @@ else { /* Parameter is for a single screen */ - g_ScreenInfo[g_iLastScreen].iE3BTimeout = TRUE; + g_ScreenInfo[g_iLastScreen].iE3BTimeout = iE3BTimeout; } /* Indicate that we have processed this argument */ @@ -514,7 +866,7 @@ */ if (strcmp (argv[i], "-depth") == 0) { - DWORD dwDepth = 0; + DWORD dwBPP = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) @@ -524,7 +876,7 @@ } /* Grab the argument */ - dwDepth = atoi (argv[i]); + dwBPP = atoi (argv[i]); /* Is this parameter attached to a screen or global? */ if (-1 == g_iLastScreen) @@ -534,13 +886,13 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_ScreenInfo[j].dwDepth = dwDepth; + g_ScreenInfo[j].dwBPP = dwBPP; } } else { /* Parameter is for a single screen */ - g_ScreenInfo[g_iLastScreen].dwDepth = dwDepth; + g_ScreenInfo[g_iLastScreen].dwBPP = dwBPP; } /* Indicate that we have processed the argument */ @@ -586,9 +938,73 @@ } /* + * Look for the '-clipupdates num_boxes' argument + */ + if (strcmp (argv[i], "-clipupdates") == 0) + { + DWORD dwNumBoxes = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + /* Grab the argument */ + dwNumBoxes = atoi (argv[i]); + + /* Is this parameter attached to a screen or global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].dwClipUpdatesNBoxes = dwNumBoxes; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].dwClipUpdatesNBoxes = dwNumBoxes; + } + + /* Indicate that we have processed the argument */ + return 2; + } + + /* + * Look for the '-emulatepseudo' argument + */ + if (strcmp (argv[i], "-emulatepseudo") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fEmulatePseudo = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fEmulatePseudo = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + /* * Look for the '-nowinkill' argument */ - if (strcmp(argv[i], "-nowinkill") == 0) + if (strcmp (argv[i], "-nowinkill") == 0) { /* Is this parameter attached to a screen or is it global? */ if (-1 == g_iLastScreen) @@ -614,7 +1030,7 @@ /* * Look for the '-winkill' argument */ - if (strcmp(argv[i], "-winkill") == 0) + if (strcmp (argv[i], "-winkill") == 0) { /* Is this parameter attached to a screen or is it global? */ if (-1 == g_iLastScreen) @@ -640,7 +1056,7 @@ /* * Look for the '-nounixkill' argument */ - if (strcmp(argv[i], "-nounixkill") == 0) + if (strcmp (argv[i], "-nounixkill") == 0) { /* Is this parameter attached to a screen or is it global? */ if (-1 == g_iLastScreen) @@ -666,7 +1082,7 @@ /* * Look for the '-unixkill' argument */ - if (strcmp(argv[i], "-unixkill") == 0) + if (strcmp (argv[i], "-unixkill") == 0) { /* Is this parameter attached to a screen or is it global? */ if (-1 == g_iLastScreen) @@ -689,6 +1105,46 @@ return 1; } + /* + * Look for the '-fp' argument + */ + if (IS_OPTION ("-fp")) + { + CHECK_ARGS (1); + g_cmdline.fontPath = argv[++i]; + return 0; /* Let DIX parse this again */ + } + + /* + * Look for the '-co' argument + */ + if (IS_OPTION ("-co")) + { + CHECK_ARGS (1); + g_cmdline.rgbPath = argv[++i]; + return 0; /* Let DIX parse this again */ + } + + /* + * Look for the '-xf86config' argument + */ + if (IS_OPTION ("-xf86config")) + { + CHECK_ARGS (1); + g_cmdline.configFile = argv[++i]; + return 2; + } + + /* + * Look for the '-keyboard' argument + */ + if (IS_OPTION ("-keyboard")) + { + CHECK_ARGS (1); + g_cmdline.keyboard = argv[++i]; + return 2; + } + return 0; } @@ -703,16 +1159,26 @@ /* See Porting Layer Definition - p. 20 */ -/* We use ddxProcessArgument, so we don't need to touch argc and argv */ +/* + * Do any global initialization, then initialize each screen. + * + * NOTE: We use ddxProcessArgument, so we don't need to touch argc and argv + */ + void InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) { int i; + int iMaxConsecutiveScreen = 0; #if CYGDEBUG - ErrorF ("InitOutput ()\n"); + ErrorF ("InitOutput\n"); #endif + /* Try to read the XF86Config-style configuration file */ + if (!winReadConfigfile ()) + ErrorF ("InitOutput - Error reading config file\n"); + /* Setup global screen info parameters */ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; @@ -726,12 +1192,70 @@ screenInfo->formats[i] = g_PixmapFormats[i]; } + /* Load pointers to DirectDraw functions */ + winGetDDProcAddresses (); + + /* Detect supported engines */ + winDetectSupportedEngines (); + + /* Load common controls library */ + g_hmodCommonControls = LoadLibraryEx ("comctl32.dll", NULL, 0); + + /* Load TrackMouseEvent function pointer */ + g_fpTrackMouseEvent = GetProcAddress (g_hmodCommonControls, + "_TrackMouseEvent"); + if (g_fpTrackMouseEvent == NULL) + { + ErrorF ("InitOutput - Could not get pointer to function\n" + "\t_TrackMouseEvent in comctl32.dll. Try installing\n" + "\tInternet Explorer 3.0 or greater if you have not\n" + "\talready.\n"); + + /* Free the library since we won't need it */ + FreeLibrary (g_hmodCommonControls); + g_hmodCommonControls = NULL; + + /* Set function pointer to point to no operation function */ + g_fpTrackMouseEvent = (FARPROC) (void (*)())NoopDDA; + } + + /* + * Check for a malformed set of -screen parameters. + * Examples of malformed parameters: + * XWin -screen 1 + * XWin -screen 0 -screen 2 + * XWin -screen 1 -screen 2 + */ + for (i = 0; i < MAXSCREENS; i++) + { + if (g_ScreenInfo[i].fExplicitScreen) + iMaxConsecutiveScreen = i + 1; + } + ErrorF ("InitOutput - g_iNumScreens: %d iMaxConsecutiveScreen: %d\n", + g_iNumScreens, iMaxConsecutiveScreen); + if (g_iNumScreens < iMaxConsecutiveScreen) + FatalError ("InitOutput - Malformed set of screen parameter(s). " + "Screens must be specified consecutively starting with " + "screen 0. That is, you cannot have only a screen 1, nor " + "could you have screen 0 and screen 2. You instead must have " + "screen 0, or screen 0 and screen 1, respectively. Of " + "you can specify as many screens as you want from 0 up to " + "%d.\n", MAXSCREENS - 1); + + /* Store the instance handle */ + g_hInstance = GetModuleHandle (NULL); + /* Initialize each screen */ for (i = 0; i < g_iNumScreens; i++) { + /* Initialize the screen */ if (-1 == AddScreen (winScreenInit, argc, argv)) { - FatalError ("Couldn't add screen %d", i); + FatalError ("InitOutput - Couldn't add screen %d", i); } } + +#if CYGDEBUG || YES + ErrorF ("InitOutput - Returning.\n"); +#endif } Index: xc/programs/Xserver/hw/xwin/XWin.man diff -u xc/programs/Xserver/hw/xwin/XWin.man:1.3 xc/programs/Xserver/hw/xwin/XWin.man:1.6 --- xc/programs/Xserver/hw/xwin/XWin.man:1.3 Tue Oct 23 04:32:05 2001 +++ xc/programs/Xserver/hw/xwin/XWin.man Thu Oct 17 04:18:21 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xwin/XWin.man,v 1.3 2001/10/23 08:32:05 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xwin/XWin.man,v 1.6 2002/10/17 08:18:21 alanh Exp $ .TH XWIN 1 __vendorversion__ .SH NAME XWin \- X Server for the Cygwin environment on Microsoft Windows @@ -47,6 +47,39 @@ Sets the display resolution for the X server to use on screen .I screen_number. .TP 8 +.B \-nodecoration +Draw the Cygwin/XFree86 window without a border or title bar. +.TP 8 +.B \-rootless +EXPERIMENTAL: Run Cygwin/XFree86 in pseduo-rootless mode. +.TP 8 +.B \-lesspointer +Hide the Windows mouse pointer when over an inactive XFree86 window +.TP 8 +.B \-scrollbars +In windowed mode, allow screens bigger than the Windows desktop. +Moreover, if the window has decorations, one can now resize it. +.TP 8 +.B "\-clipupdates \fInum_boxes\fP" +Specify an optional threshold, above which the boxes in a shadow +update operation will be collected into a GDI clipping region. The +clipping region is then used to do a single bit block transfer that is +constrained to the updated area by the clipping region. There is some +overhead involved in creating, installing, destroying, and removing +the clipping region, thus there may not be much benefit for a small +number of boxes (less than 10). It is even possible that this +functionality does not provide a benefit at any number of boxes; we +can only determine the usefullness of this feature through testing. +This parameter works in conjunction with engines 1, 2, and 4 (Shadow +GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking, +respectively). +.TP 8 +.B \-emulatepseudo +Create a depth 8 PseudoColor visual when running in depths 15, 16, 24, +or 32, collectively known as TrueColor depths. The PseudoColor visual +does not have correct colors, and it may crash, but it at least allows +you to run your PseudoColor application in TrueColor modes. +.TP 8 .B \-[no]unixkill Ctrl+Alt+Backspace exits the X Server .TP 8 @@ -72,20 +105,21 @@ The following members, in alphabetical order by last name, of the Cygwin/XFree86 Team contributed to the XFree86 4.1.0 release: .PP -Robert Collins +Robert Collins - Cygwin developer, miscellaneous .br Christopher Faylor - Management of hosting services, general programming guru .br Alexander Gottwald - AltGr handling for non-U.S. keyboards .br -Alan Hourihane - Developer, patch reviewer, general programming guru +Alan Hourihane - XFree86 developer, patch reviewer, general programming guru .br Pierre A Humblet - Debugging of socket-related crashes, developer .br -Harold L Hunt II - Lead developer, documentation, and website updates +Harold L Hunt II - Project leader, lead developer, documentation, +and website updates .br -Suhaib Siddiqi - Project lead +Suhaib Siddiqi - Originator of the project Index: xc/programs/Xserver/hw/xwin/XWin.rc diff -u /dev/null xc/programs/Xserver/hw/xwin/XWin.rc:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/XWin.rc Thu Oct 17 04:18:21 2002 @@ -0,0 +1,60 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/XWin.rc,v 1.1 2002/10/17 08:18:21 alanh Exp $ */ + +#include "resource.h" + + +/* + * Dialogs + */ + +DEPTH_CHANGE_BOX DIALOG DISCARDABLE 32, 32, 180, 100 +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +FONT 8, "MS Sans Serif" +CAPTION "Cygwin/XFree86" +BEGIN + DEFPUSHBUTTON "Dismiss", IDOK, 66, 80, 50, 14 + CTEXT "Cygwin/XFree86", IDC_STATIC, 40, 12, 100, 8 + CTEXT "Disruptive screen configuration change.", IDC_STATIC, 7, 40, 166, 8 + CTEXT "Restore previous resolution to use Cygwin/XFree86.", IDC_STATIC, 7, 52, 166, 8 +END + + +/* + * Menus + */ + + +/* + * Icons + */ + +IDI_XWIN ICON DISCARDABLE "X.ico" Index: xc/programs/Xserver/hw/xwin/resource.h diff -u /dev/null xc/programs/Xserver/hw/xwin/resource.h:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/resource.h Thu Oct 17 04:18:21 2002 @@ -0,0 +1,41 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/resource.h,v 1.1 2002/10/17 08:18:21 alanh Exp $ */ + +#include "winms.h" + + +/* + * Local defines + */ + +#define IDM_APP_ABOUT 40001 +#define IDC_STATIC -1 +#define IDI_XWIN 101 Index: xc/programs/Xserver/hw/xwin/win.h diff -u xc/programs/Xserver/hw/xwin/win.h:1.27 xc/programs/Xserver/hw/xwin/win.h:1.34 --- xc/programs/Xserver/hw/xwin/win.h:1.27 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/win.h Wed Feb 12 10:01:38 2003 @@ -29,49 +29,47 @@ * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II + * Kensuke Matsuzaki */ -/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.27 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.34 2003/02/12 15:01:38 alanh Exp $ */ #ifndef _WIN_H_ #define _WIN_H_ #ifndef NO -#define NO 0 +#define NO 0 #endif #ifndef YES -#define YES 1 +#define YES 1 #endif /* * Build toggles for experimental features */ -#define WIN_NATIVE_GDI_SUPPORT YES -#define WIN_LAYER_SUPPORT YES +#define WIN_NATIVE_GDI_SUPPORT YES +#define WIN_LAYER_SUPPORT NO +#define WIN_NEW_KEYBOARD_SUPPORT NO +#define WIN_EMULATE_PSEUDO_SUPPORT YES +#define WIN_UPDATE_STATS NO /* Turn debug messages on or off */ -#define CYGDEBUG NO +#define CYGDEBUG NO -/* Constant strings */ -#define WINDOW_CLASS "cygwin/xfree86" -#define WINDOW_TITLE "Cygwin/XFree86" -#define WIN_SCR_PROP "cyg_screen_prop" -#define WIN_MSG_QUEUE_FNAME "/dev/windows" -#define WIN_LOG_FNAME "/tmp/XWin.log" - #define NEED_EVENTS -#define WIN_DEFAULT_WIDTH 640 -#define WIN_DEFAULT_HEIGHT 480 -#define WIN_DEFAULT_DEPTH 0 -#define WIN_DEFAULT_WHITEPIXEL 255 -#define WIN_DEFAULT_BLACKPIXEL 0 -#define WIN_DEFAULT_LINEBIAS 0 -#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ -#define WIN_DEFAULT_DPI 75 -#define WIN_DEFAULT_REFRESH 0 -#define WIN_DEFAULT_WIN_KILL TRUE -#define WIN_DEFAULT_UNIX_KILL FALSE +#define WIN_DEFAULT_BPP 0 +#define WIN_DEFAULT_WHITEPIXEL 255 +#define WIN_DEFAULT_BLACKPIXEL 0 +#define WIN_DEFAULT_LINEBIAS 0 +#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ +#define WIN_DEFAULT_DPI 75 +#define WIN_DEFAULT_REFRESH 0 +#define WIN_DEFAULT_WIN_KILL TRUE +#define WIN_DEFAULT_UNIX_KILL FALSE +#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0 +#define WIN_DEFAULT_EMULATE_PSEUDO FALSE +#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE #define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */ #define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024) @@ -79,14 +77,20 @@ /* * Windows only supports 256 color palettes */ -#define WIN_NUM_PALETTE_ENTRIES 256 +#define WIN_NUM_PALETTE_ENTRIES 256 /* + * Number of times to call Restore in an attempt to restore the primary surface + */ +#define WIN_REGAIN_SURFACE_RETRIES 1 + +/* * Build a supported display depths mask by shifting one to the left * by the number of bits in the supported depth. */ -#define WIN_SUPPORTED_DEPTHS ( (1 << (32-1)) | (1 << (24-1)) \ - | (1 << (16-1)) | (1 << (15-1)) | (1 << (8-1))) +#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \ + | (1 << (16 - 1)) | (1 << (15 - 1)) \ + | (1 << ( 8 - 1))) #define WIN_CHECK_DEPTH YES #define WIN_E3B_OFF -1 @@ -106,14 +110,22 @@ #define KanaMapIndex Mod4MapIndex #define ScrollLockMapIndex Mod5MapIndex +#define WIN_MOD_LALT 0x00000001 +#define WIN_MOD_RALT 0x00000002 +#define WIN_MOD_LCONTROL 0x00000004 +#define WIN_MOD_RCONTROL 0x00000008 + #define WIN_24BPP_MASK_RED 0x00FF0000 #define WIN_24BPP_MASK_GREEN 0x0000FF00 #define WIN_24BPP_MASK_BLUE 0x000000FF +#define WIN_MAX_KEYS_PER_KEY 4 + #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <errno.h> +#include <pthread.h> #include <X11/XWDFile.h> @@ -171,6 +183,13 @@ #include "winms.h" +/* + * Multi-Window Window Manager header + */ + +#include "winwindow.h" + + /* Cygwin's winuser.h does not define VK_KANA as of 28Mar2001 */ /* NOTE: Cygwin's winuser.h was fixed shortly after 28Mar2001. */ #ifndef VK_KANA @@ -191,13 +210,13 @@ \ iLength = sprintf (NULL, str, ##__VA_ARGS__); \ \ - pszTemp = xalloc (iLength + 1); \ + pszTemp = malloc (iLength + 1); \ \ sprintf (pszTemp, str, ##__VA_ARGS__); \ \ MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ \ - xfree (pszTemp); \ + free (pszTemp); \ } #else #define DEBUG_MSG(str,...) @@ -259,24 +278,29 @@ typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap); typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr); + +typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr); + +typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr); -typedef Bool (*winHotKeyAltTabPtr)(ScreenPtr); /* - * Privates structures + * GC (graphics context) privates */ typedef struct { - DWORD dwDummy; -} winPrivWinRec, *winPrivWinPtr; - -typedef struct -{ HDC hdc; HDC hdcMem; } winPrivGCRec, *winPrivGCPtr; + +/* + * Pixmap privates + */ + typedef struct { HDC hdcSelected; @@ -286,6 +310,11 @@ BITMAPINFOHEADER *pbmih; } winPrivPixmapRec, *winPrivPixmapPtr; + +/* + * Colormap privates + */ + typedef struct { HPALETTE hPalette; @@ -294,43 +323,94 @@ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES]; } winPrivCmapRec, *winPrivCmapPtr; + +#if WIN_NEW_KEYBOARD_SUPPORT +/* + * Keyboard event structure + */ + +typedef struct +{ + DWORD dwXKeycodes[WIN_MAX_KEYS_PER_KEY]; + DWORD dwReleaseModifiers; +} winKeyEventsRec, *winKeyEventsPtr; + +#endif /* WIN_NEW_KEYBOARD_SUPPORT */ + +/* + * Screen information structure that we need before privates are available + * in the server startup sequence. + */ + typedef struct { ScreenPtr pScreen; + + /* Did the user specify a height and width? */ + Bool fUserGaveHeightAndWidth; + DWORD dwScreen; + DWORD dwUserWidth; + DWORD dwUserHeight; DWORD dwWidth; - DWORD dwPaddedWidth; DWORD dwHeight; DWORD dwWidth_mm; DWORD dwHeight_mm; - DWORD dwDepth; - DWORD dwRefreshRate; - DWORD dwStrideBytes; + DWORD dwPaddedWidth; + + /* + * dwStride is the number of whole pixels that occupy a scanline, + * including those pixels that are not displayed. This is basically + * a rounding up of the width. + */ DWORD dwStride; + + /* Offset of the screen in the window when using scrollbars */ + DWORD dwXOffset; + DWORD dwYOffset; + DWORD dwBPP; + DWORD dwDepth; + DWORD dwRefreshRate; char *pfb; XWDColor *pXWDCmap; XWDFileHeader *pXWDHeader; DWORD dwEngine; DWORD dwEnginePreferred; - DWORD dwEnginesSupported; + DWORD dwClipUpdatesNBoxes; + Bool fEmulatePseudo; Bool fFullScreen; + Bool fDecoration; + Bool fRootless; + Bool fMultiWindow; + Bool fMultipleMonitors; + Bool fClipboard; + Bool fLessPointer; + Bool fScrollbars; int iE3BTimeout; /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ Bool fUseWinKillKey; Bool fUseUnixKillKey; Bool fIgnoreInput; + + /* Did the user explicitly set this screen? */ + Bool fExplicitScreen; } winScreenInfo, *winScreenInfoPtr; -typedef struct + +/* + * Screen privates + */ + +typedef struct _winPrivScreenRec { winScreenInfoPtr pScreenInfo; Bool fEnabled; Bool fClosed; Bool fActive; - Bool fCursor; - + Bool fBadDepth; + int iDeltaZ; CloseScreenProcPtr CloseScreen; @@ -343,14 +423,24 @@ DWORD dwModeKeyStates; /* Clipboard support */ + pthread_t ptClipboardProc; + +#if 0 HWND hwndNextViewer; void *display; int window; +#endif + + /* Last width, height, and depth of the Windows display */ + DWORD dwLastWindowsWidth; + DWORD dwLastWindowsHeight; + DWORD dwLastWindowsBitsPixel; /* Layer support */ +#if WIN_LAYER_SUPPORT DWORD dwLayerKind; - DWORD dwOrigDepth; LayerPtr pLayer; +#endif /* Palette management */ ColormapPtr pcmapInstalled; @@ -390,6 +480,14 @@ /* Privates used by both shadow fb DirectDraw servers */ LPDIRECTDRAWCLIPPER pddcPrimary; + /* Privates used by multi-window server */ + pthread_t ptWMProc; + void *pWMInfo; + + /* Privates used for any module running in a seperate thread */ + pthread_mutex_t pmServerStarted; + Bool fServerStarted; + /* Engine specific functions */ winAllocateFBProcPtr pwinAllocateFB; winShadowUpdateProcPtr pwinShadowUpdate; @@ -406,9 +504,37 @@ winStoreColorsProcPtr pwinStoreColors; winCreateColormapProcPtr pwinCreateColormap; winDestroyColormapProcPtr pwinDestroyColormap; - winHotKeyAltTabPtr pwinHotKeyAltTab; -} winPrivScreenRec, *winPrivScreenPtr; + winHotKeyAltTabProcPtr pwinHotKeyAltTab; + winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; + winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; + + /* Window Procedures for Rootless mode */ + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + PositionWindowProcPtr PositionWindow; + ChangeWindowAttributesProcPtr ChangeWindowAttributes; + RealizeWindowProcPtr RealizeWindow; + UnrealizeWindowProcPtr UnrealizeWindow; + ValidateTreeProcPtr ValidateTree; + PostValidateTreeProcPtr PostValidateTree; + WindowExposuresProcPtr WindowExposures; + PaintWindowBackgroundProcPtr PaintWindowBackground; + PaintWindowBorderProcPtr PaintWindowBorder; + CopyWindowProcPtr CopyWindow; + ClearToBackgroundProcPtr ClearToBackground; + ClipNotifyProcPtr ClipNotify; + RestackWindowProcPtr RestackWindow; + ReparentWindowProcPtr ReparentWindow; +#ifdef SHAPE + SetShapeProcPtr SetShape; +#endif +} winPrivScreenRec; + +/* + * Extern declares for general global variables + */ + extern winScreenInfo g_ScreenInfo[]; extern miPointerScreenFuncRec g_winPointerCursorFuncs; extern DWORD g_dwEvents; @@ -417,10 +543,26 @@ extern int g_iCmapPrivateIndex; extern int g_iGCPrivateIndex; extern int g_iPixmapPrivateIndex; +extern int g_iWindowPrivateIndex; extern unsigned long g_ulServerGeneration; extern CARD32 g_c32LastInputEventTime; +extern DWORD g_dwEnginesSupported; +extern HINSTANCE g_hInstance; +extern HWND g_hDlgDepthChange; + + +/* + * Extern declares for dynamically loaded libraries and function pointers + */ + +extern HMODULE g_hmodDirectDraw; +extern FARPROC g_fpDirectDrawCreate; +extern FARPROC g_fpDirectDrawCreateClipper; +extern HMODULE g_hmodCommonControls; +extern FARPROC g_fpTrackMouseEvent; + /* * Screen privates macros */ @@ -480,11 +622,17 @@ /* * Window privates macros */ + +#define winGetWindowPriv(pWin) \ + ((winPrivWinPtr) (pWin)->devPrivates[g_iWindowPrivateIndex].ptr) -#define winGetWindowPrivate(_pWin) ((winPrivWin *)\ - (_pWin)->devPrivates[winWindowPrivateIndex].ptr) +#define winSetWindowPriv(pWin,v) \ + ((pWin)->devPrivates[g_iWindowPrivateIndex].ptr = (pointer) v) +#define winWindowPriv(pWin) \ + winPrivWinPtr pWinPriv = winGetWindowPriv(pWin) + /* * FIXME: Windows mouse wheel macro; should be in Cygwin w32api headers. * Has been fixed after May 05, 2001. Remove this section after the @@ -512,13 +660,6 @@ * BEGIN DDX and DIX Function Prototypes */ -/* - * InitOutput.c - */ - -DWORD -winBitsPerPixel (DWORD dwDepth); - /* * winallpriv.c @@ -554,6 +695,16 @@ /* + * winclipboardinit.c + */ + +Bool +winInitClipboard (pthread_t *ptClipboardProc, + pthread_mutex_t *ppmServerStarted, + DWORD dwScreen); + + +/* * wincmap.c */ @@ -610,6 +761,9 @@ * wincursor.c */ +void +winPointerWarpCursor (ScreenPtr pScreen, int x, int y); + Bool winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y); @@ -621,12 +775,15 @@ * winengine.c */ -Bool -winDetectSupportedEngines (ScreenPtr pScreen); +void +winDetectSupportedEngines (); Bool winSetEngine (ScreenPtr pScreen); +Bool +winGetDDProcAddresses (); + /* * winerror.c @@ -711,8 +868,13 @@ * winkeybd.c */ +#if WIN_NEW_KEYBOARD_SUPPORT +winKeyEventsRec +winTranslateKey (DWORD dwVirtualKey, DWORD dwKeyData); +#else void winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode); +#endif void winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap); @@ -740,16 +902,23 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam); void -winKeybdReleaseModifierKeys (); +winKeybdReleaseKeys (); void winSendKeyEvent (DWORD dwKey, Bool fDown); +#if WIN_NEW_KEYBOARD_SUPPORT +void +winProcessKeyEvent (DWORD dwVirtKey, DWORD dwKeyData); +#endif + /* * winlayer.c */ +#if WIN_LAYER_SUPPORT + LayerPtr winLayerCreate (ScreenPtr pScreen); @@ -759,17 +928,19 @@ int winLayerRemove (WindowPtr pWindow, pointer value); +#ifdef RANDR Bool winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations); Bool winRandRSetConfig (ScreenPtr pScreen, Rotation rotateKind, - RRScreenSizePtr pSize, - RRVisualGroupPtr pVisualGroup); + RRScreenSizePtr pSize); Bool winRandRInit (ScreenPtr pScreen); +#endif /* RANDR */ +#endif /* WIN_LAYER_SUPPORT */ /* @@ -1033,7 +1204,13 @@ Bool winDestroyColormapShadowDD (ColormapPtr pColormap); +Bool +winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen); + +Bool +winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen); + /* * winshadddnl.c */ @@ -1083,6 +1260,12 @@ Bool winDestroyColormapShadowDDNL (ColormapPtr pColormap); +Bool +winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen); + +Bool +winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen); + /* * winshadgdi.c @@ -1168,6 +1351,63 @@ Bool winMapWindowNativeGDI (WindowPtr pWindow); + +Bool +winCreateWindowPRootless (WindowPtr pWindow); + +Bool +winDestroyWindowPRootless (WindowPtr pWindow); + +Bool +winPositionWindowPRootless (WindowPtr pWindow, int x, int y); + +Bool +winChangeWindowAttributesPRootless (WindowPtr pWindow, unsigned long mask); + +Bool +winUnmapWindowPRootless (WindowPtr pWindow); + +Bool +winMapWindowPRootless (WindowPtr pWindow); + +#ifdef SHAPE +void +winSetShapePRootless (WindowPtr pWindow); +#endif + + +/* + * winmultiwindowwindow.c + */ + +Bool +winCreateWindowMultiWindow (WindowPtr pWindow); + +Bool +winDestroyWindowMultiWindow (WindowPtr pWindow); + +Bool +winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y); + +Bool +winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask); + +Bool +winUnmapWindowMultiWindow (WindowPtr pWindow); + +Bool +winMapWindowMultiWindow (WindowPtr pWindow); + +void +winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent); + +void +winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib); + +#ifdef SHAPE +void +winSetShapeMultiWindow (WindowPtr pWindow); +#endif /* Index: xc/programs/Xserver/hw/xwin/winallpriv.c diff -u xc/programs/Xserver/hw/xwin/winallpriv.c:1.8 xc/programs/Xserver/hw/xwin/winallpriv.c:1.12 --- xc/programs/Xserver/hw/xwin/winallpriv.c:1.8 Mon Oct 29 16:10:23 2001 +++ xc/programs/Xserver/hw/xwin/winallpriv.c Thu Oct 31 18:04:39 2002 @@ -28,7 +28,7 @@ * Authors: Keith Packard, MIT X Consortium * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.8 2001/10/29 21:10:23 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.12 2002/10/31 23:04:39 alanh Exp $ */ #include "win.h" @@ -48,7 +48,7 @@ winPrivScreenPtr pScreenPriv; #if CYGDEBUG - ErrorF ("winAllocateScreenPrivates () - g_ulServerGeneration: %d " + ErrorF ("winAllocateScreenPrivates - g_ulServerGeneration: %d " "serverGeneration: %d\n", g_ulServerGeneration, serverGeneration); #endif @@ -60,15 +60,16 @@ g_iScreenPrivateIndex = AllocateScreenPrivateIndex (); g_iGCPrivateIndex = AllocateGCPrivateIndex (); g_iPixmapPrivateIndex = AllocatePixmapPrivateIndex (); + g_iWindowPrivateIndex = AllocateWindowPrivateIndex (); g_ulServerGeneration = serverGeneration; } /* Allocate memory for the screen private structure */ - pScreenPriv = (winPrivScreenPtr) xalloc (sizeof (winPrivScreenRec)); + pScreenPriv = (winPrivScreenPtr) malloc (sizeof (winPrivScreenRec)); if (!pScreenPriv) { - ErrorF ("winAllocateScreenPrivates () - xalloc () failed\n"); + ErrorF ("winAllocateScreenPrivates - malloc () failed\n"); return FALSE; } @@ -77,7 +78,6 @@ /* Intialize private structure members */ pScreenPriv->fActive = TRUE; - pScreenPriv->fCursor = TRUE; /* Save the screen private pointer */ winSetScreenPriv (pScreen, pScreenPriv); @@ -86,7 +86,7 @@ if (!AllocateGCPrivate (pScreen, g_iGCPrivateIndex, sizeof (winPrivGCRec))) { - ErrorF ("winAllocatePrivates () - AllocateGCPrivate () failed\n"); + ErrorF ("winAllocatePrivates - AllocateGCPrivate () failed\n"); return FALSE; } @@ -94,10 +94,18 @@ if (!AllocatePixmapPrivate (pScreen, g_iPixmapPrivateIndex, sizeof (winPrivPixmapRec))) { - ErrorF ("winAllocatePrivates () - AllocatePixmapPrivates () failed\n"); + ErrorF ("winAllocatePrivates - AllocatePixmapPrivates () failed\n"); return FALSE; } + /* Reserve Window memory for our privates */ + if (!AllocateWindowPrivate (pScreen, g_iWindowPrivateIndex, + sizeof (winPrivWinRec))) + { + ErrorF ("winAllocatePrivates () - AllocateWindowPrivates () failed\n"); + return FALSE; + } + return TRUE; } @@ -112,7 +120,7 @@ winInitCmapPrivates (ColormapPtr pcmap) { #if CYGDEBUG - ErrorF ("winInitCmapPrivates ()\n"); + ErrorF ("winInitCmapPrivates\n"); #endif /* @@ -135,27 +143,27 @@ winAllocateCmapPrivates (ColormapPtr pCmap) { winPrivCmapPtr pCmapPriv; - static unsigned long ulPrivateGeneration = 0; + static unsigned long s_ulPrivateGeneration = 0; #if CYGDEBUG - ErrorF ("winAllocateCmapPrivates ()\n"); + ErrorF ("winAllocateCmapPrivates\n"); #endif /* Get a new privates index when the server generation changes */ - if (ulPrivateGeneration != serverGeneration) + if (s_ulPrivateGeneration != serverGeneration) { /* Get an index that we can store our privates at */ g_iCmapPrivateIndex = AllocateColormapPrivateIndex (winInitCmapPrivates); /* Save the new server generation */ - ulPrivateGeneration = serverGeneration; + s_ulPrivateGeneration = serverGeneration; } /* Allocate memory for our private structure */ - pCmapPriv = (winPrivCmapPtr) xalloc (sizeof (winPrivCmapRec)); + pCmapPriv = (winPrivCmapPtr) malloc (sizeof (winPrivCmapRec)); if (!pCmapPriv) { - ErrorF ("winAllocateCmapPrivates () - xalloc () failed\n"); + ErrorF ("winAllocateCmapPrivates - malloc () failed\n"); return FALSE; } @@ -166,7 +174,7 @@ winSetCmapPriv (pCmap, pCmapPriv); #if CYGDEBUG - ErrorF ("winAllocateCmapPrivates () - Returning\n"); + ErrorF ("winAllocateCmapPrivates - Returning\n"); #endif return TRUE; Index: xc/programs/Xserver/hw/xwin/winblock.c diff -u xc/programs/Xserver/hw/xwin/winblock.c:1.4 xc/programs/Xserver/hw/xwin/winblock.c:1.6 --- xc/programs/Xserver/hw/xwin/winblock.c:1.4 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winblock.c Wed Feb 12 10:01:38 2003 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.4 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.6 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -41,9 +41,36 @@ winScreenPriv((ScreenPtr)pBlockData); MSG msg; + /* Signal threaded modules to begin */ + if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) + { + int iReturn; + + ErrorF ("winBlockHandler - Releasing pmServerStarted\n"); + + /* Flag that modules are to be started */ + pScreenPriv->fServerStarted = TRUE; + + /* Unlock the mutex for threaded modules */ + iReturn = pthread_mutex_unlock (&pScreenPriv->pmServerStarted); + if (iReturn != 0) + { + ErrorF ("winBlockHandler - pthread_mutex_unlock () failed: %d\n", + iReturn); + goto winBlockHandler_ProcessMessages; + } + + ErrorF ("winBlockHandler - pthread_mutex_unlock () returned\n"); + } + +winBlockHandler_ProcessMessages: + /* Process all messages on our queue */ - while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { - DispatchMessage (&msg); + if (g_hDlgDepthChange == 0 || !IsDialogMessage (g_hDlgDepthChange, &msg)) + { + DispatchMessage (&msg); + } } } Index: xc/programs/Xserver/hw/xwin/winclipboard.h diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboard.h:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboard.h Wed Feb 12 10:01:38 2003 @@ -0,0 +1,158 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold Hunt + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboard.h,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + + +#ifndef _WINCLIPBOARD_H_ +#define _WINCLIPBOARD_H_ + +/* Standard library headers */ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/select.h> +#include <fcntl.h> +#include <setjmp.h> +#include <pthread.h> + +/* X headers */ +#include "X.h" +#include "Xatom.h" +/* NOTE: For some unknown reason, including Xproto.h solves + * tons of problems with including windows.h. Unknowns reasons + * are usually bad, so someone should investigate this. + */ +#include "Xproto.h" +#include "Xutil.h" +#include "Xlocale.h" + +/* Fixups to prevent collisions between Windows and X headers */ +#define ATOM DWORD + +/* Windows headers */ +#include <windows.h> + + +/* Clipboard module constants */ +#define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip" +#define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip" +#define WIN_MSG_QUEUE_FNAME "/dev/windows" +#define WIN_CONNECT_RETRIES 3 +#define WIN_CONNECT_DELAY 4 +#define WIN_JMP_OKAY 0 +#define WIN_JMP_ERROR_IO 2 + +/* + * Argument structure for Clipboard module main thread + */ + +typedef struct _ClipboardProcArgRec { + DWORD dwScreen; + pthread_mutex_t *ppmServerStarted; +} ClipboardProcArgRec, *ClipboardProcArgPtr; + + +/* + * References to external symbols + */ + +extern char *display; +extern void ErrorF (const char* /*f*/, ...); + + +/* + * winclipboardinit.c + */ + +Bool +winInitClipboard (pthread_t *ptClipboardProc, + pthread_mutex_t *ppmServerStarted, + DWORD dwScreen); + +HWND +winClipboardCreateMessagingWindow (); + + +/* + * winclipboardtextconv.c + */ + +void +winClipboardDOStoUNIX (char *pszData, int iLength); + +void +winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength); + + +/* + * winclipboardthread.c + */ + +void * +winClipboardProc (void *pArg); + + +/* + * winclipboardunicode.c + */ + +Bool +winClipboardDetectUnicodeSupport (); + + +/* + * winclipboardwndproc.c + */ + +BOOL +winClipboardFlushWindowsMessageQueue (HWND hwnd); + +LRESULT CALLBACK +winClipboardWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); + + +/* + * winclipboardxevents.c + */ + +Bool +winClipboardFlushXEvents (HWND hwnd, + Atom atomClipboard, + Atom atomLocalProperty, + Atom atomUTF8String, + Atom atomCompoundText, + Atom atomTargets, + Atom atomDeleteWindow, + int iWindow, + Display *pDisplay, + Bool fUnicodeSupport); +#endif Index: xc/programs/Xserver/hw/xwin/winclipboardinit.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboardinit.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboardinit.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,117 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboardinit.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "winclipboard.h" + + +/* + * Intialize the Clipboard module + */ + +Bool +winInitClipboard (pthread_t *ptClipboardProc, + pthread_mutex_t *ppmServerStarted, + DWORD dwScreen) +{ + ClipboardProcArgPtr pArg; + + ErrorF ("winInitClipboard ()\n"); + + /* Allocate the parameter structure */ + pArg = (ClipboardProcArgPtr) malloc (sizeof (ClipboardProcArgRec)); + if (pArg == NULL) + { + ErrorF ("winInitClipboard - malloc for ClipboardProcArgRec failed.\n"); + return FALSE; + } + + /* Setup the argument structure for the thread function */ + pArg->dwScreen = dwScreen; + pArg->ppmServerStarted = ppmServerStarted; + + /* Spawn a thread for the Clipboard module */ + if (pthread_create (ptClipboardProc, NULL, winClipboardProc, pArg)) + { + /* Bail if thread creation failed */ + ErrorF ("winInitClipboard - pthread_create failed.\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Create the Windows window that we use to recieve Windows messages + */ + +HWND +winClipboardCreateMessagingWindow () +{ + WNDCLASS wc; + HWND hwnd; + + /* Setup our window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winClipboardWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandle (NULL); + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS; + RegisterClass (&wc); + + /* Create the window */ + hwnd = CreateWindowExA (0, /* Extended styles */ + WIN_CLIPBOARD_WINDOW_CLASS,/* Class name */ + WIN_CLIPBOARD_WINDOW_TITLE,/* Window name */ + WS_OVERLAPPED, /* Not visible anyway */ + CW_USEDEFAULT, /* Horizontal position */ + CW_USEDEFAULT, /* Vertical position */ + CW_USEDEFAULT, /* Right edge */ + CW_USEDEFAULT, /* Bottom edge */ + (HWND) NULL, /* No parent or owner window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle (NULL),/* Instance handle */ + NULL); /* ScreenPrivates */ + assert (hwnd != NULL); + + /* I'm not sure, but we may need to call this to start message processing */ + ShowWindow (hwnd, SW_HIDE); + + /* Similarly, we may need a call to this even though we don't paint */ + UpdateWindow (hwnd); + + return hwnd; +} Index: xc/programs/Xserver/hw/xwin/winclipboardtextconv.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboardtextconv.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboardtextconv.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,153 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboardtextconv.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "win.h" +#include <stdio.h> +#include <stdlib.h> + + +/* + * Convert \r\n to \n + * + * NOTE: This was heavily inspired by, if not down right stolen from, + * Cygwin's winsup/cygwin/fhandler.cc/fhandler_base::read () + */ + +void +winClipboardDOStoUNIX (char *pszSrc, int iLength) +{ + char *pszDest = pszSrc; + char *pszEnd = pszSrc + iLength; + + /* Loop until the last character */ + while (pszSrc < pszEnd) + { + /* Copy the current source character to current destination character */ + *pszDest = *pszSrc; + + /* Advance to the next source character */ + pszSrc++; + + /* Don't advance the destination character if we need to drop an \r */ + if (*pszDest != '\r' || *pszSrc != '\n') + pszDest++; + } + + /* Move the terminating null */ + *pszDest = '\0'; +} + + +/* + * Convert \n to \r\n + */ + +void +winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength) +{ + int iNewlineCount = 0; + unsigned char *pszSrc = *ppszData; + unsigned char *pszEnd = pszSrc + iLength; + unsigned char *pszDest = NULL, *pszDestBegin = NULL; + +#if 0 + ErrorF ("UNIXtoDOS () - Original data:\n%s\n", *ppszData); +#endif + + /* Count \n characters without leading \r */ + while (pszSrc < pszEnd) + { + /* Skip ahead two character if found set of \r\n */ + if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') + { + pszSrc += 2; + continue; + } + + /* Increment the count if found naked \n */ + if (*pszSrc == '\n') + { + iNewlineCount++; + } + + pszSrc++; + } + + /* Return if no naked \n's */ + if (iNewlineCount == 0) + return; + + /* Allocate a new string */ + pszDestBegin = pszDest = malloc (iLength + iNewlineCount + 1); + + /* Set source pointer to beginning of data string */ + pszSrc = *ppszData; + + /* Loop through all characters in source string */ + while (pszSrc < pszEnd) + { + /* Copy line endings that are already valid */ + if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') + { + *pszDest = *pszSrc; + *(pszDest + 1) = *(pszSrc + 1); + pszDest += 2; + pszSrc += 2; + continue; + } + + /* Add \r to naked \n's */ + if (*pszSrc == '\n') + { + *pszDest = '\r'; + *(pszDest + 1) = *pszSrc; + pszDest += 2; + pszSrc += 1; + continue; + } + + /* Copy normal characters */ + *pszDest = *pszSrc; + pszSrc++; + pszDest++; + } + + /* Put terminating null at end of new string */ + *pszDest = '\0'; + + /* Swap string pointers */ + free (*ppszData); + *ppszData = pszDestBegin; + +#if 0 + ErrorF ("UNIXtoDOS () - Final string:\n%s\n", pszDestBegin); +#endif +} Index: xc/programs/Xserver/hw/xwin/winclipboardthread.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboardthread.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboardthread.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,463 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboardthread.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "winclipboard.h" + +/* + * References to external symbols + */ + +extern Bool g_fCalledSetLocale; + + +/* + * Global variables + */ + +static jmp_buf g_jmpEntry; + + +/* + * Local function prototypes + */ + +static int +winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr); + +static int +winClipboardIOErrorHandler (Display *pDisplay); + + +/* + * Main thread function + */ + +void * +winClipboardProc (void *pArg) +{ + Atom atomClipboard, atomClipboardManager; + Atom atomLocalProperty, atomCompoundText; + Atom atomUTF8String, atomTargets; + int iReturn; + HWND hwnd = NULL; + int iConnectionNumber; + int fdMessageQueue; + fd_set fdsRead; + int iMaxDescriptor; + Display *pDisplay; + Window iWindow; + Atom atomDeleteWindow; + Bool fReturn; + int iRetries; + Bool fUnicodeSupport; + char szDisplay[512]; + int i; + ClipboardProcArgPtr pProcArg = (ClipboardProcArgPtr) pArg; + + ErrorF ("winClipboardProc - Hello\n"); + + /* Check that argument pointer is not invalid */ + if (pArg == NULL) + { + ErrorF ("winClipboardProc - pArg is NULL, bailing.\n"); + pthread_exit (NULL); + } + + ErrorF ("winClipboardProc - Calling pthread_mutex_lock ()\n"); + + /* Grab our garbage mutex to satisfy pthread_cond_wait */ + iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted); + if (iReturn != 0) + { + ErrorF ("winClipboardProc - pthread_mutex_lock () failed: %d\n", + iReturn); + pthread_exit (NULL); + } + + ErrorF ("winClipboardProc - pthread_mutex_lock () returned.\n"); + + /* Do we have Unicode support? */ + fUnicodeSupport = winClipboardDetectUnicodeSupport (); + + /* Set the current locale? What does this do? */ + if (fUnicodeSupport && !g_fCalledSetLocale) + { + ErrorF ("winClipboardProc - Calling setlocale ()\n"); + if (!setlocale (LC_ALL, "")) + { + ErrorF ("winClipboardProc - setlocale () error\n"); + pthread_exit (NULL); + } + ErrorF ("winClipboardProc - setlocale () returned\n"); + + /* See if X supports the current locale */ + if (XSupportsLocale () == False) + { + ErrorF ("winClipboardProc - Locale not supported by X\n"); + pthread_exit (NULL); + } + } + + /* Flag that we have called setlocale */ + g_fCalledSetLocale = TRUE; + + /* Release the garbage mutex */ + pthread_mutex_unlock (pProcArg->ppmServerStarted); + + ErrorF ("winClipboardProc - pthread_mutex_unlock () returned.\n"); + + /* Allow multiple threads to access Xlib */ + if (XInitThreads () == 0) + { + ErrorF ("winClipboardProc - XInitThreads failed.\n"); + pthread_exit (NULL); + } + + ErrorF ("winClipboardProc - XInitThreads () returned.\n"); + + /* Set jump point for Error exits */ + iReturn = setjmp (g_jmpEntry); + + /* Check if we should continue operations */ + if (iReturn != WIN_JMP_ERROR_IO + && iReturn != WIN_JMP_OKAY) + { + /* setjmp returned an unknown value, exit */ + ErrorF ("winClipboardProc - setjmp returned: %d exiting\n", + iReturn); + pthread_exit (NULL); + } + else if (iReturn == WIN_JMP_ERROR_IO) + { + ErrorF ("winClipboardProc - setjmp returned and hwnd: %08x\n", hwnd); + } + + /* Initialize retry count */ + iRetries = 0; + +#if 0 + /* Setup the display connection string x */ + snprintf (szDisplay, 512, "127.0.0.1:%s.%d", display, pProcArg->dwScreen); +#else + /* Setup the display connection string x */ + snprintf (szDisplay, 512, ":%s.%d", display, pProcArg->dwScreen); +#endif + + /* Print the display connection string */ + ErrorF ("winClipboardProc - DISPLAY=%s\n", szDisplay); + + /* Open the X display */ + do + { + pDisplay = XOpenDisplay (szDisplay); + if (pDisplay == NULL) + { + ErrorF ("winClipboardProc - Could not open display, " + "try: %d, sleeping: %d\n", + iRetries + 1, WIN_CONNECT_DELAY); + ++iRetries; + sleep (WIN_CONNECT_DELAY); + continue; + } + else + break; + } + while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES); + + /* Make sure that the display opened */ + if (pDisplay == NULL) + { + ErrorF ("winClipboardProc - Failed opening the display, giving up\n"); + pthread_exit (NULL); + } + + ErrorF ("winClipboardProc - XOpenDisplay () returned and " + "successfully opened the display.\n"); + + /* Create Windows messaging window */ + hwnd = winClipboardCreateMessagingWindow (); + + /* Get our connection number */ + iConnectionNumber = ConnectionNumber (pDisplay); + + /* Open a file descriptor for the windows message queue */ + fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY); + if (fdMessageQueue == -1) + { + ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); + pthread_exit (NULL); + } + + /* Find max of our file descriptors */ + iMaxDescriptor = max (fdMessageQueue, iConnectionNumber) + 1; + + /* Select event types to watch */ + if (XSelectInput (pDisplay, + DefaultRootWindow (pDisplay), + SubstructureNotifyMask | + StructureNotifyMask | + PropertyChangeMask) == BadWindow) + ErrorF ("winClipboardProc - XSelectInput generated BadWindow " + "on RootWindow\n\n"); + + /* Create a messaging window */ + iWindow = XCreateSimpleWindow (pDisplay, + DefaultRootWindow (pDisplay), + 1, 1, + 500, 500, + 0, + BlackPixel (pDisplay, 0), + BlackPixel (pDisplay, 0)); + if (iWindow == 0) + { + ErrorF ("winClipboardProc - Could not create a window\n"); + pthread_exit (NULL); + } + + /* This looks like our only hope for getting a message before shutdown */ + /* Register for WM_DELETE_WINDOW message from window manager */ + atomDeleteWindow = XInternAtom (pDisplay, "WM_DELETE_WINDOW", False); + XSetWMProtocols (pDisplay, iWindow, &atomDeleteWindow, 1); + + /* Set error handler */ + XSetErrorHandler (winClipboardErrorHandler); + XSetIOErrorHandler (winClipboardIOErrorHandler); + + /* Create an atom for CLIPBOARD_MANAGER */ + atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False); + if (atomClipboardManager == None) + { + ErrorF ("winClipboardProc - Could not create CLIPBOARD_MANAGER atom\n"); + pthread_exit (NULL); + } + + /* Assert ownership of CLIPBOARD_MANAGER */ + iReturn = XSetSelectionOwner (pDisplay, atomClipboardManager, + iWindow, CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("winClipboardProc - Could not set CLIPBOARD_MANAGER owner\n"); + pthread_exit (NULL); + } + + /* Create an atom for CLIPBOARD */ + atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False); + if (atomClipboard == None) + { + ErrorF ("winClipboardProc - Could not create CLIPBOARD atom\n"); + pthread_exit (NULL); + } + + /* Assert ownership of CLIPBOARD */ + iReturn = XSetSelectionOwner (pDisplay, atomClipboard, + iWindow, CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n"); + pthread_exit (NULL); + } + + /* Assert ownership of PRIMARY */ + iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY, + iWindow, CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("winClipboardProc - Could not set PRIMARY owner\n"); + pthread_exit (NULL); + } + + /* Local property to hold pasted data */ + atomLocalProperty = XInternAtom (pDisplay, "CYGX_CUT_BUFFER", False); + if (atomLocalProperty == None) + { + ErrorF ("winClipboardProc - Could not create CYGX_CUT_BUFFER atom\n"); + pthread_exit (NULL); + } + + /* Create an atom for UTF8_STRING */ + atomUTF8String = XInternAtom (pDisplay, "UTF8_STRING", False); + if (atomUTF8String == None) + { + ErrorF ("winClipboardProc - Could not create UTF8_STRING atom\n"); + pthread_exit (NULL); + } + + /* Create an atom for COMPOUND_TEXT */ + atomCompoundText = XInternAtom (pDisplay, "COMPOUND_TEXT", False); + if (atomCompoundText == None) + { + ErrorF ("winClipboardProc - Could not create COMPOUND_TEXT atom\n"); + pthread_exit (NULL); + } + + /* Create an atom for TARGETS */ + atomTargets = XInternAtom (pDisplay, "TARGETS", False); + if (atomTargets == None) + { + ErrorF ("winClipboardProc - Could not create TARGETS atom\n"); + pthread_exit (NULL); + } + + /* Pre-flush X events */ + /* + * NOTE: Apparently you'll freeze if you don't do this, + * because there may be events in local data structures + * already. + */ + winClipboardFlushXEvents (hwnd, + atomClipboard, + atomLocalProperty, + atomUTF8String, + atomCompoundText, + atomTargets, + atomDeleteWindow, + iWindow, + pDisplay, + fUnicodeSupport); + + /* Pre-flush Windows messages */ + if (!winClipboardFlushWindowsMessageQueue (hwnd)) + return 0; + + /* Loop for X events */ + while (1) + { + /* Setup the file descriptor set */ + /* + * NOTE: You have to do this before every call to select + * because select modifies the mask to indicate + * which descriptors are ready. + */ + FD_ZERO (&fdsRead); + FD_SET (fdMessageQueue, &fdsRead); + FD_SET (iConnectionNumber, &fdsRead); + + /* Wait for a Windows event or an X event */ + iReturn = select (iMaxDescriptor, /* Highest fds number */ + &fdsRead, /* Read mask */ + NULL, /* No write mask */ + NULL, /* No exception mask */ + NULL); /* No timeout */ + if (iReturn <= 0) + { + ErrorF ("winClipboardProc - Call to select () failed: %d. " + "Bailing.\n", iReturn); + break; + } + + /* Branch on which descriptor became active */ + if (FD_ISSET (iConnectionNumber, &fdsRead)) + { + /* X event ready */ +#if 0 + ErrorF ("winClipboardProc - X event ready\n"); +#endif + + /* Process X events */ + /* Exit when we see that server is shutting down */ + fReturn = winClipboardFlushXEvents (hwnd, + atomClipboard, + atomLocalProperty, + atomUTF8String, + atomCompoundText, + atomTargets, + atomDeleteWindow, + iWindow, + pDisplay, + fUnicodeSupport); + if (!fReturn) + { + ErrorF ("winClipboardProc - Caught WM_DELETE_WINDOW - " + "shutting down\n"); + break; + } + } + + /* Check for Windows event ready */ + if (FD_ISSET (fdMessageQueue, &fdsRead)) + { + /* Windows event ready */ +#if 0 + ErrorF ("winClipboardProc - Windows event ready\n"); +#endif + + /* Process Windows messages */ + if (!winClipboardFlushWindowsMessageQueue (hwnd)) + break; + } + } + + return 0; +} + + +/* + * winClipboardErrorHandler - Our application specific error handler + */ + +static int +winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr) +{ + char pszErrorMsg[100]; + + XGetErrorText (pDisplay, + pErr->error_code, + pszErrorMsg, + sizeof (pszErrorMsg)); + ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n", pszErrorMsg); + + if (pErr->error_code==BadWindow + || pErr->error_code==BadMatch + || pErr->error_code==BadDrawable) + { + pthread_exit (NULL); + } + + pthread_exit (NULL); + + return 0; +} + + +/* + * winClipboardIOErrorHandler - Our application specific IO error handler + */ + +static int +winClipboardIOErrorHandler (Display *pDisplay) +{ + printf ("\nwinClipboardIOErrorHandler!\n\n"); + + /* Restart at the main entry point */ + longjmp (g_jmpEntry, WIN_JMP_ERROR_IO); + + return 0; +} Index: xc/programs/Xserver/hw/xwin/winclipboardunicode.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboardunicode.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboardunicode.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,68 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboardunicode.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "win.h" + + +/* + * Determine whether we suport Unicode or not. + * NOTE: Currently, just check if we are on an NT-based platform or not. + */ + +Bool +winClipboardDetectUnicodeSupport () +{ + Bool fReturn = FALSE; + OSVERSIONINFO osvi; + + /* Get operating system version information */ + ZeroMemory (&osvi, sizeof (osvi)); + osvi.dwOSVersionInfoSize = sizeof (osvi); + GetVersionEx (&osvi); + + /* Branch on platform ID */ + switch (osvi.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + /* Engine 4 is supported on NT only */ + ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n"); + fReturn = TRUE; + break; + + case VER_PLATFORM_WIN32_WINDOWS: + /* Engine 4 is supported on NT only */ + ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n"); + fReturn = FALSE; + break; + } + + return fReturn; +} Index: xc/programs/Xserver/hw/xwin/winclipboardwndproc.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboardwndproc.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboardwndproc.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,86 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboardwndproc.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "winclipboard.h" + + +/* + * Process a given Windows message + */ + +LRESULT CALLBACK +winClipboardWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + /* Branch on message type */ + switch (message) + { + case WM_DESTROY: + PostQuitMessage (0); + return 0; + + case WM_CREATE: +#if 0 + ErrorF ("WindowProc - WM_CREATE\n"); +#endif + return 0; + } + + /* Let Windows perform default processing for unhandled messages */ + return DefWindowProc (hwnd, message, wParam, lParam); +} + + +/* + * Process any pending Windows messages + */ + +BOOL +winClipboardFlushWindowsMessageQueue (HWND hwnd) +{ + MSG msg; + + /* Flush the messaging window queue */ + /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage, + * as this will filter out many non-window-specific messages that + * are sent to our thread, such as WM_QUIT. + */ + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) + { + /* Dispatch the message if not WM_QUIT */ + if (msg.message == WM_QUIT) + return FALSE; + else + DispatchMessage (&msg); + } + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/winclipboardxevents.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclipboardxevents.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winclipboardxevents.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,722 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboardxevents.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "winclipboard.h" + + +/* + * Process any pending X events + */ + +Bool +winClipboardFlushXEvents (HWND hwnd, + Atom atomClipboard, + Atom atomLocalProperty, + Atom atomUTF8String, + Atom atomCompoundText, + Atom atomTargets, + Atom atomDeleteWindow, + int iWindow, + Display *pDisplay, + Bool fUnicodeSupport) +{ + Atom atomReturnType; + int iReturnFormat; + unsigned long ulReturnItems; + XTextProperty xtpText; + XEvent event; + XSelectionEvent eventSelection; + unsigned long ulReturnBytesLeft; + unsigned char *pszReturnData = NULL; + char *pszGlobalData = NULL; + int iReturn; + HGLOBAL hGlobal; + Bool fReturn = TRUE; + XICCEncodingStyle xiccesStyle; + int iUTF8; + char *pszUTF8 = NULL; + char *pszTextList[2]; + int iCount; + char **ppszTextList = NULL; + wchar_t *pwszUnicodeStr = NULL; + int iUnicodeLen = 0; + + /* Process all pending events */ + while (XPending (pDisplay)) + { + /* Get the next event - will not block because one is ready */ + XNextEvent (pDisplay, &event); + + /* Branch on the event type */ + switch (event.type) + { + case ClientMessage: + if (event.xclient.data.l[0] == atomDeleteWindow) + { + ErrorF ("\nReceived WM_DELETE_WINDOW\n\n"); + fReturn = FALSE; + } + else + ErrorF ("\nUnknown ClientMessage\n\n"); + break; + + case SelectionClear: + /* Request the lost selection contents */ + iReturn = XConvertSelection (pDisplay, + event.xselectionclear.selection, + atomCompoundText, + atomLocalProperty, + iWindow, + CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("SelectionClear - XConvertSelection () failed\n"); + pthread_exit (NULL); + } + break; + + + /* + * SelectionRequest + */ + + case SelectionRequest: +#if 0 + char *pszAtomName = NULL + + ErrorF ("SelectionRequest - target %d\n", + event.xselectionrequest.target); + + pszAtomName = XGetAtomName (pDisplay, + event.xselectionrequest.target); + ErrorF ("SelectionRequest - Target atom name %s\n", pszAtomName); + XFree (pszAtomName); + pszAtomName = NULL; +#endif + + /* Abort if invalid target type */ + if (event.xselectionrequest.target != XA_STRING + && event.xselectionrequest.target != atomUTF8String + && event.xselectionrequest.target != atomCompoundText + && event.xselectionrequest.target != atomTargets) + { + /* Setup selection notify event */ + eventSelection.type = SelectionNotify; + eventSelection.send_event = True; + eventSelection.display = pDisplay; + eventSelection.requestor = event.xselectionrequest.requestor; + eventSelection.selection = event.xselectionrequest.selection; + eventSelection.target = event.xselectionrequest.target; + eventSelection.property = None; + eventSelection.time = event.xselectionrequest.time; + + /* Notify the requesting window that the operation is complete */ + iReturn = XSendEvent (pDisplay, + eventSelection.requestor, + False, + 0L, + (XEvent *) &eventSelection); + if (iReturn == BadValue || iReturn == BadWindow) + { + ErrorF ("SelectionRequest - XSendEvent () failed\n"); + pthread_exit (NULL); + } + + break; + } + + /* Handle targets type of request */ + if (event.xselectionrequest.target == atomTargets) + { + Atom atomTargetArr[4] = {atomTargets, + atomCompoundText, + atomUTF8String, + XA_STRING}; + + /* Try to change the property */ + iReturn = XChangeProperty (pDisplay, + event.xselectionrequest.requestor, + event.xselectionrequest.property, + event.xselectionrequest.target, + 8, + PropModeReplace, + (char *) atomTargetArr, + sizeof (atomTargetArr)); + if (iReturn == BadAlloc + || iReturn == BadAtom + || iReturn == BadMatch + || iReturn == BadValue + || iReturn == BadWindow) + { + ErrorF ("SelectionRequest - XChangeProperty failed: %d\n", + iReturn); + } + + /* Setup selection notify xevent */ + eventSelection.type = SelectionNotify; + eventSelection.send_event = True; + eventSelection.display = pDisplay; + eventSelection.requestor = event.xselectionrequest.requestor; + eventSelection.selection = event.xselectionrequest.selection; + eventSelection.target = event.xselectionrequest.target; + eventSelection.property = event.xselectionrequest.property; + eventSelection.time = event.xselectionrequest.time; + + /* + * Notify the requesting window that + * the operation has completed + */ + iReturn = XSendEvent (pDisplay, + eventSelection.requestor, + False, + 0L, + (XEvent *) &eventSelection); + if (iReturn == BadValue || iReturn == BadWindow) + { + ErrorF ("SelectionRequest - XSendEvent () failed\n"); + } + break; + } + + /* Access the clipboard */ + if (!OpenClipboard (hwnd)) + { + ErrorF ("SelectionRequest - OpenClipboard () failed: %08x\n", + GetLastError ()); + pthread_exit (NULL); + } + + /* Setup the string style */ + if (event.xselectionrequest.target == XA_STRING) + xiccesStyle = XStringStyle; + else if (event.xselectionrequest.target == atomUTF8String) + xiccesStyle = XUTF8StringStyle; + else if (event.xselectionrequest.target == atomCompoundText) + xiccesStyle = XCompoundTextStyle; + else + xiccesStyle = XStringStyle; + + /* + * FIXME: Can't pass CF_UNICODETEXT on Windows 95/98/Me + */ + + /* Get a pointer to the clipboard text */ + if (fUnicodeSupport) + hGlobal = GetClipboardData (CF_UNICODETEXT); + else + hGlobal = GetClipboardData (CF_TEXT); + if (!hGlobal) + { + ErrorF ("SelectionRequest - GetClipboardData () failed: %08x\n", + GetLastError ()); + pthread_exit (NULL); + } + pszGlobalData = (char *) GlobalLock (hGlobal); + + /* Convert the Unicode string to UTF8 (MBCS) */ + if (fUnicodeSupport) + { + iUTF8 = WideCharToMultiByte (CP_UTF8, + 0, + (LPCWSTR)pszGlobalData, + -1, + NULL, + 0, + NULL, + NULL); + pszUTF8 = (char *) malloc (iUTF8); /* Don't need +1 */ + WideCharToMultiByte (CP_UTF8, + 0, + (LPCWSTR)pszGlobalData, + -1, + pszUTF8, + iUTF8, + NULL, + NULL); + } + + /* Convert DOS string to UNIX string */ + if (fUnicodeSupport) + { + winClipboardDOStoUNIX (pszUTF8, strlen (pszUTF8)); + + /* Setup our text list */ + pszTextList[0] = pszUTF8; + pszTextList[1] = NULL; + + /* Initialize the text property */ + xtpText.value = NULL; + + /* Create the text property from the text list */ + iReturn = Xutf8TextListToTextProperty (pDisplay, + pszTextList, + 1, + xiccesStyle, + &xtpText); + if (iReturn == XNoMemory || iReturn == XLocaleNotSupported) + { + ErrorF ("SelectionRequest - Xutf8TextListToTextProperty " + "failed: %d\n", + iReturn); + exit(1); + } + + /* Free the UTF8 string */ + free (pszUTF8); + } + else + winClipboardDOStoUNIX (pszGlobalData, strlen (pszGlobalData)); + + /* + * FIXME: Pass pszGlobalData and strlen (pszGlobalData( + * on 1 byte, pass xtpText.value and xtpText.nitems + * on 2 byte. + */ + + /* Copy the clipboard text to the requesting window */ + if (fUnicodeSupport) + iReturn = XChangeProperty (pDisplay, + event.xselectionrequest.requestor, + event.xselectionrequest.property, + event.xselectionrequest.target, + 8, + PropModeReplace, + xtpText.value, + xtpText.nitems); + else + iReturn = XChangeProperty (pDisplay, + event.xselectionrequest.requestor, + event.xselectionrequest.property, + event.xselectionrequest.target, + 8, + PropModeReplace, + pszGlobalData, + strlen (pszGlobalData)); + if (iReturn == BadAlloc || iReturn == BadAtom + || iReturn == BadMatch || iReturn == BadValue + || iReturn == BadWindow) + { + ErrorF ("SelectionRequest - XChangeProperty failed: %d\n", + iReturn); + pthread_exit (NULL); + } + + /* Release the clipboard data */ + GlobalUnlock (hGlobal); + pszGlobalData = NULL; + CloseClipboard (); + + /* FIXME: Don't clean up on 1 byte. */ + if (fUnicodeSupport) + { + XFree (xtpText.value); + xtpText.value = NULL; + } + + /* Setup selection notify event */ + eventSelection.type = SelectionNotify; + eventSelection.send_event = True; + eventSelection.display = pDisplay; + eventSelection.requestor = event.xselectionrequest.requestor; + eventSelection.selection = event.xselectionrequest.selection; + eventSelection.target = event.xselectionrequest.target; + eventSelection.property = event.xselectionrequest.property; + eventSelection.time = event.xselectionrequest.time; + + /* Notify the requesting window that the operation has completed */ + iReturn = XSendEvent (pDisplay, + eventSelection.requestor, + False, + 0L, + (XEvent *) &eventSelection); + if (iReturn == BadValue || iReturn == BadWindow) + { + ErrorF ("SelectionRequest - XSendEvent () failed\n"); + pthread_exit (NULL); + } + break; + + + /* + * SelectionNotify + */ + + case SelectionNotify: +#if 0 + ErrorF ("SelectionNotify\n"); +#endif + { + char *pszAtomName; + + pszAtomName = XGetAtomName (pDisplay, + event.xselection.selection); + + ErrorF ("SelectionNotify - ATOM: %s\n", + pszAtomName); + + XFree (pszAtomName); + } + +#if 0 + /* + * TEMP: Bail if selection is anything other than CLIPBOARD + */ + + if (event.xselection.selection != atomClipboard) + break; +#endif + + /* + * + * What are we doing here? + * + */ + if (fUnicodeSupport) + { + if (event.xselection.property == None) + { + if(event.xselection.target == XA_STRING) + { +#if 0 + ErrorF ("SelectionNotify XA_STRING\n"); +#endif + return fReturn; + } + else if (event.xselection.target == atomUTF8String) + { + ErrorF ("SelectionNotify UTF8\n"); + iReturn = XConvertSelection (pDisplay, + event.xselection.selection, + XA_STRING, + atomLocalProperty, + iWindow, + CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("SelectionNotify - XConvertSelection () " + "failed\n"); + pthread_exit (NULL); + } + return fReturn; + } + else if (event.xselection.target == atomCompoundText) + { + ErrorF ("SelectionNotify CompoundText\n"); + iReturn = XConvertSelection (pDisplay, + event.xselection.selection, + atomUTF8String, + atomLocalProperty, + iWindow, + CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("SelectionNotify - XConvertSelection () " + "failed\n"); + pthread_exit (NULL); + } + return fReturn; + } + else + { + ErrorF("Unknown format\n"); + return fReturn; + } + } + } + + /* Retrieve the size of the stored data */ + if (fUnicodeSupport) + iReturn = XGetWindowProperty (pDisplay, + iWindow, + atomLocalProperty, + 0, + 0, /* Don't get data, just size */ + False, + AnyPropertyType, + &xtpText.encoding, + &xtpText.format, + &xtpText.nitems, + &ulReturnBytesLeft, + &xtpText.value); + else + iReturn = XGetWindowProperty (pDisplay, + iWindow, + atomLocalProperty, + 0, + 0, /* Don't get data, just size */ + False, + AnyPropertyType, + &atomReturnType, + &iReturnFormat, + &ulReturnItems, + &ulReturnBytesLeft, + &pszReturnData); + if (iReturn != Success) + { + ErrorF ("SelectionNotify - XGetWindowProperty () failed\n"); + pthread_exit (NULL); + } + +#if 0 + if (fUnicodeSupport) + ErrorF ("SelectionNotify - returned data %d left %d\n", + xtpText.nitems, ulReturnBytesLeft); + else + ErrorF ("SelectionNotify - returned data %d left %d\n", + ulReturnItems, ulReturnBytesLeft); +#endif + + /* Request the selection data */ + if (fUnicodeSupport) + iReturn = XGetWindowProperty (pDisplay, + iWindow, + atomLocalProperty, + 0, + ulReturnBytesLeft, + False, + AnyPropertyType, + &xtpText.encoding, + &xtpText.format, + &xtpText.nitems, + &ulReturnBytesLeft, + &xtpText.value); + else + iReturn = XGetWindowProperty (pDisplay, + iWindow, + atomLocalProperty, + 0, + ulReturnBytesLeft, + False, + AnyPropertyType, + &atomReturnType, + &iReturnFormat, + &ulReturnItems, + &ulReturnBytesLeft, + &pszReturnData); + if (iReturn != Success) + { + ErrorF ("SelectionNotify - XGetWindowProperty () failed\n"); + pthread_exit (NULL); + } + + if (fUnicodeSupport) + { +#if 0 + char *pszAtomName = NULL; + + ErrorF ("SelectionNotify - returned data %d left %d\n", + prop.nitems, ulReturnBytesLeft); + + pszAtomName = XGetAtomName(pDisplay, prop.encoding); + ErrorF ("Notify atom name %s\n", pszAtomName); + XFree (pszAtomName); + pszAtomName = NULL; +#endif + + /* Convert the text property to a text list */ + Xutf8TextPropertyToTextList (pDisplay, + &xtpText, + &ppszTextList, + &iCount); + if (iCount > 0) + { + pszReturnData = malloc (strlen (ppszTextList[0]) + 1); + strcpy (pszReturnData, ppszTextList[0]); + } + else + { + pszReturnData = malloc (1); + pszReturnData[0] = 0; + } + + /* Free the data returned from XGetWindowProperty */ + XFreeStringList (ppszTextList); + XFree (xtpText.value); + } + + /* Convert the X clipboard string to DOS format */ + winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData)); + + if (fUnicodeSupport) + { + /* Find out how much space needed to convert MBCS to Unicode */ + iUnicodeLen = MultiByteToWideChar (CP_UTF8, + 0, + pszReturnData, + -1, + NULL, + 0); + + /* Allocate memory for the Unicode string */ + pwszUnicodeStr + = (wchar_t*) malloc (sizeof (wchar_t) * (iUnicodeLen + 1)); + + /* Do the actual conversion */ + MultiByteToWideChar (CP_UTF8, + 0, + pszReturnData, + -1, + pwszUnicodeStr, + iUnicodeLen); + } + + /* Access the Windows clipboard */ + if (!OpenClipboard (hwnd)) + { + ErrorF ("OpenClipboard () failed: %08x\n", GetLastError ()); + pthread_exit (NULL); + } + + /* Take ownership of the Window clipboard */ + if (!EmptyClipboard ()) + { + ErrorF ("EmptyClipboard () failed: %08x\n", GetLastError ()); + pthread_exit (NULL); + } + + /* Allocate global memory for the X clipboard data */ + if (fUnicodeSupport) + hGlobal = GlobalAlloc (GMEM_MOVEABLE, + sizeof (wchar_t) * (iUnicodeLen + 1)); + else + hGlobal = GlobalAlloc (GMEM_MOVEABLE, strlen (pszReturnData) + 1); + + /* Obtain a pointer to the global memory */ + pszGlobalData = GlobalLock (hGlobal); + if (pszGlobalData == NULL) + { + ErrorF ("Could not lock global memory for clipboard transfer\n"); + pthread_exit (NULL); + } + + /* Copy the returned string into the global memory */ + if (fUnicodeSupport) + memcpy (pszGlobalData, + pwszUnicodeStr, + sizeof (wchar_t) * (iUnicodeLen + 1)); + else + strcpy (pszGlobalData, pszReturnData); + + /* Free the data returned from XGetWindowProperty */ + if (fUnicodeSupport) + { + free (pwszUnicodeStr); + pwszUnicodeStr = NULL; + } + else + { + XFree (pszReturnData); + pszReturnData = NULL; + } + + /* Release the pointer to the global memory */ + GlobalUnlock (hGlobal); + pszGlobalData = NULL; + + /* Push the selection data to the Windows clipboard */ + if (fUnicodeSupport) + SetClipboardData (CF_UNICODETEXT, hGlobal); + else + SetClipboardData (CF_TEXT, hGlobal); + + /* + * NOTE: Do not try to free pszGlobalData, it is owned by + * Windows after the call to SetClipboardData (). + */ + + /* Release the clipboard */ + if (!CloseClipboard ()) + { + ErrorF ("CloseClipboard () failed: %08x\n", GetLastError ()); + pthread_exit (NULL); + } + + /* Reassert ownership of the selection */ + iReturn = XSetSelectionOwner (pDisplay, + event.xselection.selection, + iWindow, CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + char *pszAtomName = NULL; + + pszAtomName = XGetAtomName (pDisplay, + event.xselection.selection); + ErrorF ("SelectionNotify - Could not reassert ownership " + "of selection ATOM: %s\n", pszAtomName); + XFree (pszAtomName); + pszAtomName = NULL; + pthread_exit (NULL); + } + else + { +#if 0 + char *pszAtomName = NULL; + + pszAtomName = XGetAtomName (pDisplay, + event.xselection.selection); + ErrorF ("SelectionNotify - Reasserted ownership of ATOM: %s\n", + pszAtomName); + XFree (pszAtomName); + pszAtomName = NULL; +#endif + } +#if 0 + /* Reassert ownership of the CLIPBOARD */ + iReturn = XSetSelectionOwner (pDisplay, + atomClipboard, + iWindow, CurrentTime); + if (iReturn == BadAtom || iReturn == BadWindow) + { + ErrorF ("Could not reassert ownership of selection\n"); + pthread_exit (NULL); + } +#endif + break; + +#if 0 + case CreateNotify: + ErrorF ("FlushXEvents - CreateNotify parent: %ld\twindow: %ld\n", + event.xcreatewindow.parent, event.xcreatewindow.window); + break; + + case DestroyNotify: + ErrorF ("FlushXEvents - DestroyNotify window: %ld\tevent: %ld\n", + event.xdestroywindow.window, event.xdestroywindow.event); + break; +#endif + + default: + break; + } + } + + return fReturn; +} Index: xc/programs/Xserver/hw/xwin/wincmap.c diff -u xc/programs/Xserver/hw/xwin/wincmap.c:1.8 xc/programs/Xserver/hw/xwin/wincmap.c:1.10 --- xc/programs/Xserver/hw/xwin/wincmap.c:1.8 Tue Jul 31 05:46:57 2001 +++ xc/programs/Xserver/hw/xwin/wincmap.c Thu Oct 17 04:18:22 2002 @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.8 2001/07/31 09:46:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.10 2002/10/17 08:18:22 alanh Exp $ */ #include "win.h" @@ -66,14 +66,14 @@ ColormapPtr oldpmap = pScreenPriv->pcmapInstalled; #if CYGDEBUG - ErrorF ("winInstallColormap ()\n"); + ErrorF ("winInstallColormap\n"); #endif /* Did the colormap actually change? */ if (pColormap != oldpmap) { #if CYGDEBUG - ErrorF ("winInstallColormap () - Colormap has changed, attempt " + ErrorF ("winInstallColormap - Colormap has changed, attempt " "to install.\n"); #endif @@ -91,7 +91,7 @@ /* Call the engine specific colormap install procedure */ if (!((*pScreenPriv->pwinInstallColormap) (pColormap))) { - ErrorF ("winInstallColormap () - Screen specific colormap install " + ErrorF ("winInstallColormap - Screen specific colormap install " "procedure failed. Continuing, but colors may be " "messed up from now on.\n"); } @@ -110,7 +110,7 @@ ColormapPtr curpmap = pScreenPriv->pcmapInstalled; #if CYGDEBUG - ErrorF ("winUninstallColormap ()\n"); + ErrorF ("winUninstallColormap\n"); #endif /* Is the colormap currently installed? */ @@ -152,7 +152,7 @@ #if CYGDEBUG if (ndef != 1) - ErrorF ("winStoreColors () - ndef: %d\n", + ErrorF ("winStoreColors - ndef: %d\n", ndef); #endif @@ -175,7 +175,7 @@ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue; #if CYGDEBUG - ErrorF ("winStoreColors () - nRed %d nGreen %d nBlue %d\n", + ErrorF ("winStoreColors - nRed %d nGreen %d nBlue %d\n", nRed, nGreen, nBlue); #endif } @@ -183,7 +183,7 @@ /* Call the engine specific store colors procedure */ if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs))) { - ErrorF ("winStoreColors () - Engine cpecific color storage procedure " + ErrorF ("winStoreColors - Engine cpecific color storage procedure " "failed. Continuing, but colors may be messed up from now " "on.\n"); } @@ -214,13 +214,13 @@ winScreenPriv(pScreen); #if CYGDEBUG - ErrorF ("winCreateColormap ()\n"); + ErrorF ("winCreateColormap\n"); #endif /* Allocate colormap privates */ if (!winAllocateCmapPrivates (pmap)) { - ErrorF ("winCreateColorma () - Couldn't allocate cmap privates\n"); + ErrorF ("winCreateColorma - Couldn't allocate cmap privates\n"); return FALSE; } @@ -246,7 +246,7 @@ /* Call the engine specific colormap initialization procedure */ if (!((*pScreenPriv->pwinCreateColormap) (pmap))) { - ErrorF ("winCreateColormap () - Engine specific colormap creation " + ErrorF ("winCreateColormap - Engine specific colormap creation " "procedure failed. Aborting.\n"); return FALSE; } @@ -265,17 +265,17 @@ /* Call the engine specific colormap destruction procedure */ if (!((*pScreenPriv->pwinDestroyColormap) (pColormap))) { - ErrorF ("winDestroyColormap () - Engine specific colormap destruction " + ErrorF ("winDestroyColormap - Engine specific colormap destruction " "procedure failed. Continuing, but it is possible that memory " "was leaked, or that colors will be messed up from now on.\n"); } /* Free the colormap privates */ - xfree (pCmapPriv); + free (pCmapPriv); winSetCmapPriv (pColormap, NULL); #if CYGDEBUG - ErrorF ("winDestroyColormap () - Returning\n"); + ErrorF ("winDestroyColormap - Returning\n"); #endif } @@ -284,13 +284,13 @@ winExpandDirectColors (ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) { - ErrorF ("\nwinExpandDirectColors ()\n"); + ErrorF ("\nwinExpandDirectColors\n"); return miExpandDirectColors (pmap, ndef, indefs, outdefs); } /* - * Load the palette used by the Shadow DIB + * Internal function to load the palette used by the Shadow DIB */ static @@ -311,12 +311,12 @@ rgbColors); if (uiColorsRetrieved == 0) { - ErrorF ("winGetPaletteDIB () - Could not retrieve screen color table\n"); + ErrorF ("winGetPaletteDIB - Could not retrieve screen color table\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winGetPaletteDIB () - Retrieved %d colors from DIB\n", + ErrorF ("winGetPaletteDIB - Retrieved %d colors from DIB\n", uiColorsRetrieved); #endif @@ -326,7 +326,7 @@ uiColorsRetrieved, rgbColors) == 0) { - ErrorF ("winGetPaletteDIB () - SetDIBColorTable () failed\n"); + ErrorF ("winGetPaletteDIB - SetDIBColorTable () failed\n"); return FALSE; } @@ -341,7 +341,7 @@ nBlue = rgbColors[i].rgbBlue << 8; #if CYGDEBUG - ErrorF ("winGetPaletteDIB () - Allocating a color: %d; "\ + ErrorF ("winGetPaletteDIB - Allocating a color: %d; " "%d %d %d\n", pixel, nRed, nGreen, nBlue); #endif @@ -354,7 +354,7 @@ &pixel, 0) != Success) { - ErrorF ("winGetPaletteDIB () - AllocColor () failed, pixel %d\n", + ErrorF ("winGetPaletteDIB - AllocColor () failed, pixel %d\n", i); return FALSE; } @@ -364,7 +364,7 @@ || nGreen != rgbColors[i].rgbGreen || nBlue != rgbColors[i].rgbBlue) { - ErrorF ("winGetPaletteDIB () - Got: %d; "\ + ErrorF ("winGetPaletteDIB - Got: %d; " "%d %d %d\n", pixel, nRed, nGreen, nBlue); } @@ -385,8 +385,9 @@ /* - * Load the standard system palette being used by GDI + * Internal function to load the standard system palette being used by GDI */ + static Bool winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap) @@ -402,7 +403,7 @@ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winGetPaletteDD () - Couldn't get a DC\n"); + ErrorF ("winGetPaletteDD - Couldn't get a DC\n"); return FALSE; } @@ -411,21 +412,21 @@ 0, 0, NULL); if (uiSystemPaletteEntries == 0) { - ErrorF ("winGetPaletteDD () - Unable to determine number of " + ErrorF ("winGetPaletteDD - Unable to determine number of " "system palette entries\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winGetPaletteDD () - uiSystemPaletteEntries %d\n", + ErrorF ("winGetPaletteDD - uiSystemPaletteEntries %d\n", uiSystemPaletteEntries); #endif /* Allocate palette entries structure */ - ppeColors = xalloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY)); + ppeColors = malloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY)); if (ppeColors == NULL) { - ErrorF ("winGetPaletteDD () - xalloc () for colormap failed\n"); + ErrorF ("winGetPaletteDD - malloc () for colormap failed\n"); return FALSE; } @@ -443,7 +444,7 @@ nGreen = ppeColors[i].peGreen << 8; nBlue = ppeColors[i].peBlue << 8; #if CYGDEBUG - ErrorF ("winGetPaletteDD () - Allocating a color: %d; "\ + ErrorF ("winGetPaletteDD - Allocating a color: %d; " "%d %d %d\n", pixel, nRed, nGreen, nBlue); #endif @@ -454,7 +455,7 @@ &pixel, 0) != Success) { - ErrorF ("winGetPaletteDD () - AllocColor () failed, pixel %d\n", + ErrorF ("winGetPaletteDD - AllocColor () failed, pixel %d\n", i); free (ppeColors); ppeColors = NULL; @@ -493,6 +494,7 @@ * Install the standard fb colormap, or the GDI colormap, * depending on the current screen depth. */ + Bool winCreateDefColormap (ScreenPtr pScreen) { @@ -504,13 +506,13 @@ Pixel wp, bp; #if CYGDEBUG - ErrorF ("winCreateDefColormap ()\n"); + ErrorF ("winCreateDefColormap\n"); #endif /* Use standard fb colormaps for non palettized color modes */ - if (pScreenInfo->dwDepth > 8) + if (pScreenInfo->dwBPP > 8) { - ErrorF ("winCreateDefColormap () - Deferring to " \ + ErrorF ("winCreateDefColormap - Deferring to " \ "fbCreateDefColormap ()\n"); return fbCreateDefColormap (pScreen); } @@ -526,7 +528,7 @@ */ #if CYGDEBUG - ErrorF ("winCreateDefColormap () - defColormap: %d\n", + ErrorF ("winCreateDefColormap - defColormap: %d\n", pScreen->defColormap); #endif @@ -538,17 +540,17 @@ (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0) != Success) { - ErrorF ("winCreateDefColormap () - CreateColormap failed\n"); + ErrorF ("winCreateDefColormap - CreateColormap failed\n"); return FALSE; } if (pcmap == NULL) { - ErrorF ("winCreateDefColormap () - Colormap could not be created\n"); + ErrorF ("winCreateDefColormap - Colormap could not be created\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winCreateDefColormap () - Created a colormap\n"); + ErrorF ("winCreateDefColormap - Created a colormap\n"); #endif /* Branch on the visual class */ @@ -560,7 +562,7 @@ /* Load the colors being used by the Shadow DIB */ if (!winGetPaletteDIB (pScreen, pcmap)) { - ErrorF ("winCreateDefColormap () - Couldn't get DIB colors\n"); + ErrorF ("winCreateDefColormap - Couldn't get DIB colors\n"); return FALSE; } } @@ -569,7 +571,7 @@ /* Load the colors from the default system palette */ if (!winGetPaletteDD (pScreen, pcmap)) { - ErrorF ("winCreateDefColormap () - Couldn't get colors " + ErrorF ("winCreateDefColormap - Couldn't get colors " "for DD\n"); return FALSE; } @@ -587,7 +589,7 @@ (AllocColor (pcmap, &zero, &zero, &zero, &bp, 0) != Success)) { - ErrorF ("winCreateDefColormap () - Couldn't allocate bp or wp\n"); + ErrorF ("winCreateDefColormap - Couldn't allocate bp or wp\n"); return FALSE; } @@ -622,7 +624,7 @@ (*pScreen->InstallColormap)(pcmap); #if CYGDEBUG - ErrorF ("winCreateDefColormap () - Returning\n"); + ErrorF ("winCreateDefColormap - Returning\n"); #endif return TRUE; Index: xc/programs/Xserver/hw/xwin/winconfig.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winconfig.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winconfig.c Thu Oct 17 04:18:22 2002 @@ -0,0 +1,949 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Alexander Gottwald + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winconfig.c,v 1.1 2002/10/17 08:18:22 alanh Exp $ */ + +#include "win.h" +#include "winconfig.h" +#include "winmsg.h" +#include "globals.h" + +#ifdef XKB +#define XKB_IN_SERVER +#include "XKBsrv.h" +#endif + +#ifndef CONFIGPATH +#define CONFIGPATH "%A," "%R," \ + "/etc/X11/%R," "%P/etc/X11/%R," \ + "%E," "%F," \ + "/etc/X11/%F," "%P/etc/X11/%F," \ + "%D/%X," \ + "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif + +XF86ConfigPtr g_xf86configptr = NULL; +WinCmdlineRec g_cmdline = { + NULL, /* configFile */ + NULL, /* fontPath */ + NULL, /* rgbPath */ + NULL, /* keyboard */ +#ifdef XKB + FALSE, /* noXkbExtension */ + NULL, /* xkbMap */ +#endif + NULL, /* screenname */ + NULL, /* mousename */ + FALSE, /* emulate3Buttons */ + 0 /* emulate3Timeout */ +}; + +winInfoRec g_winInfo = { + { /* keyboard */ + 0, /* leds */ + 500, /* delay */ + 30 /* rate */ +#ifdef XKB + } + , + { /* xkb */ + FALSE, /* disable */ + NULL, /* rules */ + NULL, /* model */ + NULL, /* layout */ + NULL, /* variant */ + NULL, /* options */ + NULL, /* initialMap */ + NULL, /* keymap */ + NULL, /* types */ + NULL, /* compat */ + NULL, /* keycodes */ + NULL, /* symbols */ + NULL /* geometry */ +#endif + } + , + { + FALSE, + 50} +}; + +serverLayoutRec g_winConfigLayout; + +static Bool ParseOptionValue (int scrnIndex, pointer options, + OptionInfoPtr p); +static Bool configLayout (serverLayoutPtr, XF86ConfLayoutPtr, char *); +static Bool configImpliedLayout (serverLayoutPtr, XF86ConfScreenPtr); +static Bool GetBoolValue (OptionInfoPtr p, const char *s); + +#define NULL_IF_EMPTY(x) (winNameCompare(x,"")?x:NULL) + + +Bool +winReadConfigfile () +{ + Bool retval = TRUE; + const char *filename; + + MessageType from = X_DEFAULT; + char *xf86ConfigFile = NULL; + + if (g_cmdline.configFile) + { + from = X_CMDLINE; + xf86ConfigFile = g_cmdline.configFile; + } + + /* Parse config file into data structure */ + + filename = xf86openConfigFile (CONFIGPATH, xf86ConfigFile, PROJECTROOT); + if (filename) + { + winMsg (from, "Using config file: \"%s\"\n", filename); + } + else + { + winMsg (X_ERROR, "Unable to locate/open config file"); + if (xf86ConfigFile) + ErrorF (": \"%s\"", xf86ConfigFile); + ErrorF ("\n"); + return FALSE; + } + if ((g_xf86configptr = xf86readConfigFile ()) == NULL) + { + winMsg (X_ERROR, "Problem parsing the config file\n"); + return FALSE; + } + xf86closeConfigFile (); + + winMsg (X_NONE, "Markers: "); + winMsg (X_PROBED, "probed, "); + winMsg (X_CONFIG, "from config file, "); + winMsg (X_DEFAULT, "default setting,\n "); + winMsg (X_CMDLINE, "from command line, "); + winMsg (X_NOTICE, "notice, "); + winMsg (X_INFO, "informational,\n "); + winMsg (X_WARNING, "warning, "); + winMsg (X_ERROR, "error, "); + winMsg (X_UNKNOWN, "unknown.\n"); + + /* set options from data structure */ + + if (g_xf86configptr->conf_layout_lst == NULL || g_cmdline.screenname != NULL) + { + if (g_cmdline.screenname == NULL) + { + winMsg (X_WARNING, + "No Layout section. Using the first Screen section.\n"); + } + if (!configImpliedLayout (&g_winConfigLayout, + g_xf86configptr->conf_screen_lst)) + { + winMsg (X_ERROR, "Unable to determine the screen layout\n"); + return FALSE; + } + } + else + { + /* Check if layout is given in the config file */ + if (g_xf86configptr->conf_flags != NULL) + { + char *dfltlayout = NULL; + pointer optlist = g_xf86configptr->conf_flags->flg_option_lst; + + if (optlist && winFindOption (optlist, "defaultserverlayout")) + dfltlayout = + winSetStrOption (optlist, "defaultserverlayout", NULL); + + if (!configLayout (&g_winConfigLayout, + g_xf86configptr->conf_layout_lst, + dfltlayout)) + { + winMsg (X_ERROR, "Unable to determine the screen layout\n"); + return FALSE; + } + } + else + { + if (!configLayout (&g_winConfigLayout, + g_xf86configptr->conf_layout_lst, + NULL)) + { + winMsg (X_ERROR, "Unable to determin the screen layout\n"); + return FALSE; + } + } + } + + /* setup special config files */ + winConfigFiles (); + return retval; +} + + +/* Set the keyboard configuration */ + +Bool +winConfigKeyboard (DeviceIntPtr pDevice) +{ + XF86ConfInputPtr kbd = NULL; + XF86ConfInputPtr input_list = NULL; + MessageType from = X_DEFAULT; + MessageType kbdfrom = X_CONFIG; + + /* Setup defaults */ +#ifdef XKB + g_winInfo.xkb.disable = FALSE; +# ifdef PC98 /* japanese */ /* not implemented */ + g_winInfo.xkb.rules = "xfree98"; + g_winInfo.xkb.model = "pc98"; + g_winInfo.xkb.layout = "nex/jp"; + g_winInfo.xkb.variant = NULL; + g_winInfo.xkb.options = NULL; +# else + g_winInfo.xkb.rules = "xfree86"; + g_winInfo.xkb.model = "pc101"; + g_winInfo.xkb.layout = "us"; + g_winInfo.xkb.variant = NULL; + g_winInfo.xkb.options = NULL; +# endif /* PC98 */ + g_winInfo.xkb.initialMap = NULL; + g_winInfo.xkb.keymap = NULL; + g_winInfo.xkb.types = NULL; + g_winInfo.xkb.compat = NULL; + g_winInfo.xkb.keycodes = NULL; + g_winInfo.xkb.symbols = NULL; + g_winInfo.xkb.geometry = NULL; +#endif /* XKB */ + + /* parse the configuration */ + + if (g_cmdline.keyboard) + kbdfrom = X_CMDLINE; + + /* + * Until the layout code is finished, I search for the keyboard + * device and configure the server with it. + */ + + if (g_xf86configptr != NULL) + input_list = g_xf86configptr->conf_input_lst; + + while (input_list != NULL) + { + if (winNameCompare (input_list->inp_driver, "keyboard") == 0) + { + /* Check if device name matches requested name */ + if (g_cmdline.keyboard && winNameCompare (input_list->inp_identifier, + g_cmdline.keyboard)) + continue; + kbd = input_list; + } + input_list = input_list->list.next; + } + + if (kbd != NULL) + { + if (kbd->inp_identifier) + winMsg (kbdfrom, "Using keyboard \"%s\" as primary keyboard\n", + kbd->inp_identifier); + +#ifdef XKB + from = X_DEFAULT; + if (g_cmdline.noXkbExtension) + { + from = X_CMDLINE; + g_winInfo.xkb.disable = TRUE; + } + else if (kbd->inp_option_lst) + { + int b = winSetBoolOption (kbd->inp_option_lst, "XkbDisable", FALSE); + if (b) + { + from = X_CONFIG; + g_winInfo.xkb.disable = TRUE; + } + } + if (g_winInfo.xkb.disable) + { + winMsg (from, "XkbExtension disabled\n"); + } + else + { + char *s; + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL))) + { + g_winInfo.xkb.rules = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: rules: \"%s\"\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL))) + { + g_winInfo.xkb.model = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: model: \"%s\"\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL))) + { + g_winInfo.xkb.layout = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: layout: \"%s\"\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL))) + { + g_winInfo.xkb.variant = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: variant: \"%s\"\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL))) + { + g_winInfo.xkb.options = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: options: \"%s\"\n", s); + } + + from = X_CMDLINE; + if (!XkbInitialMap) + { + s = + winSetStrOption (kbd->inp_option_lst, "XkbInitialMap", NULL); + if (s) + { + XkbInitialMap = NULL_IF_EMPTY (s); + from = X_CONFIG; + } + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbKeymap", NULL))) + { + g_winInfo.xkb.keymap = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: keymap: \"%s\" " + " (overrides other XKB settings)\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbCompat", NULL))) + { + g_winInfo.xkb.compat = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: compat: \"%s\"\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbTypes", NULL))) + { + g_winInfo.xkb.types = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: types: \"%s\"\n", s); + } + + if ( + (s = + winSetStrOption (kbd->inp_option_lst, "XkbKeycodes", NULL))) + { + g_winInfo.xkb.keycodes = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: keycodes: \"%s\"\n", s); + } + + if ( + (s = + winSetStrOption (kbd->inp_option_lst, "XkbGeometry", NULL))) + { + g_winInfo.xkb.geometry = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: geometry: \"%s\"\n", s); + } + + if ((s = winSetStrOption (kbd->inp_option_lst, "XkbSymbols", NULL))) + { + g_winInfo.xkb.symbols = NULL_IF_EMPTY (s); + winMsg (X_CONFIG, "XKB: symbols: \"%s\"\n", s); + } + } +#endif + } + else + { + winMsg (X_ERROR, "No primary keyboard configured\n"); + winMsg (X_DEFAULT, "Using compiletime defaults for keyboard\n"); + } + + return TRUE; +} + + +Bool +winConfigMouse (DeviceIntPtr pDevice) +{ + MessageType mousefrom = X_CONFIG; + XF86ConfInputPtr mouse = NULL; + XF86ConfInputPtr input_list = NULL; + + if (g_cmdline.mouse) + mousefrom = X_CMDLINE; + + if (g_xf86configptr != NULL) + input_list = g_xf86configptr->conf_input_lst; + + while (input_list != NULL) + { + if (winNameCompare (input_list->inp_driver, "mouse") == 0) + { + /* Check if device name matches requested name */ + if (g_cmdline.mouse && winNameCompare (input_list->inp_identifier, + g_cmdline.mouse)) + continue; + mouse = input_list; + } + input_list = input_list->list.next; + } + + if (mouse != NULL) + { + if (mouse->inp_identifier) + winMsg (mousefrom, "Using pointer \"%s\" as primary pointer\n", + mouse->inp_identifier); + + g_winInfo.pointer.emulate3Buttons = + winSetBoolOption (mouse->inp_option_lst, "Emulate3Buttons", FALSE); + if (g_cmdline.emulate3buttons) + g_winInfo.pointer.emulate3Buttons = g_cmdline.emulate3buttons; + + g_winInfo.pointer.emulate3Timeout = + winSetIntOption (mouse->inp_option_lst, "Emulate3Timeout", 50); + if (g_cmdline.emulate3timeout) + g_winInfo.pointer.emulate3Timeout = g_cmdline.emulate3timeout; + } + else + { + winMsg (X_ERROR, "No primary pointer configured\n"); + winMsg (X_DEFAULT, "Using compiletime defaults for pointer\n"); + } + + return TRUE; +} + + +Bool +winConfigFiles () +{ + MessageType from; + XF86ConfFilesPtr filesptr = NULL; + + /* set some shortcuts */ + if (g_xf86configptr != NULL) + { + filesptr = g_xf86configptr->conf_files; + } + + + /* Fontpath */ + from = X_DEFAULT; + + if (g_cmdline.fontPath) + { + from = X_CMDLINE; + defaultFontPath = g_cmdline.fontPath; + } + else if (filesptr != NULL && filesptr->file_fontpath) + { + from = X_CONFIG; + defaultFontPath = xstrdup (filesptr->file_fontpath); + } + winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath); + + /* RGBPath */ + from = X_DEFAULT; + if (g_cmdline.rgbPath) + { + from = X_CMDLINE; + rgbPath = g_cmdline.rgbPath; + } + else if (filesptr != NULL && filesptr->file_rgbpath) + { + from = X_CONFIG; + rgbPath = xstrdup (filesptr->file_rgbpath); + } + winMsg (from, "RgbPath set to \"%s\"\n", rgbPath); + + return TRUE; +} + + +Bool +winConfigOptions () +{ + return TRUE; +} + + +Bool +winConfigScreens () +{ + return TRUE; +} + + +char * +winSetStrOption (pointer optlist, const char *name, char *deflt) +{ + OptionInfoRec o; + + o.name = name; + o.type = OPTV_STRING; + if (ParseOptionValue (-1, optlist, &o)) + deflt = o.value.str; + if (deflt) + return xstrdup (deflt); + else + return NULL; +} + + +int +winSetBoolOption (pointer optlist, const char *name, int deflt) +{ + OptionInfoRec o; + + o.name = name; + o.type = OPTV_BOOLEAN; + if (ParseOptionValue (-1, optlist, &o)) + deflt = o.value.bool; + return deflt; +} + + +int +winSetIntOption (pointer optlist, const char *name, int deflt) +{ + OptionInfoRec o; + + o.name = name; + o.type = OPTV_INTEGER; + if (ParseOptionValue (-1, optlist, &o)) + deflt = o.value.num; + return deflt; +} + + +double +winSetRealOption (pointer optlist, const char *name, double deflt) +{ + OptionInfoRec o; + + o.name = name; + o.type = OPTV_REAL; + if (ParseOptionValue (-1, optlist, &o)) + deflt = o.value.realnum; + return deflt; +} + + +/* + * Compare two strings for equality. This is caseinsensitive and + * The characters '_', ' ' (space) and '\t' (tab) are treated as + * not existing. + */ + +int +winNameCompare (const char *s1, const char *s2) +{ + char c1, c2; + + if (!s1 || *s1 == 0) + { + if (!s2 || *s2 == 0) + return 0; + else + return 1; + } + + while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') + s1++; + while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') + s2++; + + c1 = (isupper (*s1) ? tolower (*s1) : *s1); + c2 = (isupper (*s2) ? tolower (*s2) : *s2); + + while (c1 == c2) + { + if (c1 == 0) + return 0; + s1++; + s2++; + + while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') + s1++; + while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') + s2++; + + c1 = (isupper (*s1) ? tolower (*s1) : *s1); + c2 = (isupper (*s2) ? tolower (*s2) : *s2); + } + return (c1 - c2); +} + + +/* + * Find the named option in the list. + * @return the pointer to the option record, or NULL if not found. + */ + +XF86OptionPtr +winFindOption (XF86OptionPtr list, const char *name) +{ + while (list) + { + if (winNameCompare (list->opt_name, name) == 0) + return list; + list = list->list.next; + } + return NULL; +} + + +/* + * Find the Value of an named option. + * @return The option value or NULL if not found. + */ + +char * +winFindOptionValue (XF86OptionPtr list, const char *name) +{ + list = winFindOption (list, name); + if (list) + { + if (list->opt_val) + return (list->opt_val); + else + return ""; + } + return (NULL); +} + + +/* + * Parse the option. + */ + +static Bool +ParseOptionValue (int scrnIndex, pointer options, OptionInfoPtr p) +{ + char *s, *end; + + if ((s = winFindOptionValue (options, p->name)) != NULL) + { + switch (p->type) + { + case OPTV_INTEGER: + if (*s == '\0') + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires an integer value\n", + p->name); + p->found = FALSE; + } + else + { + p->value.num = strtoul (s, &end, 0); + if (*end == '\0') + { + p->found = TRUE; + } + else + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires an integer value\n", + p->name); + p->found = FALSE; + } + } + break; + case OPTV_STRING: + if (*s == '\0') + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires an string value\n", p->name); + p->found = FALSE; + } + else + { + p->value.str = s; + p->found = TRUE; + } + break; + case OPTV_ANYSTR: + p->value.str = s; + p->found = TRUE; + break; + case OPTV_REAL: + if (*s == '\0') + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a floating point value\n", + p->name); + p->found = FALSE; + } + else + { + p->value.realnum = strtod (s, &end); + if (*end == '\0') + { + p->found = TRUE; + } + else + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a floating point value\n", + p->name); + p->found = FALSE; + } + } + break; + case OPTV_BOOLEAN: + if (GetBoolValue (p, s)) + { + p->found = TRUE; + } + else + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a boolean value\n", p->name); + p->found = FALSE; + } + break; + case OPTV_FREQ: + if (*s == '\0') + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a frequency value\n", + p->name); + p->found = FALSE; + } + else + { + double freq = strtod (s, &end); + int units = 0; + + if (end != s) + { + p->found = TRUE; + if (!winNameCompare (end, "Hz")) + units = 1; + else if (!winNameCompare (end, "kHz") || + !winNameCompare (end, "k")) + units = 1000; + else if (!winNameCompare (end, "MHz") || + !winNameCompare (end, "M")) + units = 1000000; + else + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a frequency value\n", + p->name); + p->found = FALSE; + } + if (p->found) + freq *= (double) units; + } + else + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a frequency value\n", + p->name); + p->found = FALSE; + } + if (p->found) + { + p->value.freq.freq = freq; + p->value.freq.units = units; + } + } + break; + case OPTV_NONE: + /* Should never get here */ + p->found = FALSE; + break; + } + if (p->found) + { + winDrvMsgVerb (scrnIndex, X_CONFIG, 2, "Option \"%s\"", p->name); + if (!(p->type == OPTV_BOOLEAN && *s == 0)) + { + winErrorFVerb (2, " \"%s\"", s); + } + winErrorFVerb (2, "\n"); + } + } + else if (p->type == OPTV_BOOLEAN) + { + /* Look for matches with options with or without a "No" prefix. */ + char *n, *newn; + OptionInfoRec opt; + + n = winNormalizeName (p->name); + if (!n) + { + p->found = FALSE; + return FALSE; + } + if (strncmp (n, "no", 2) == 0) + { + newn = n + 2; + } + else + { + free (n); + n = malloc (strlen (p->name) + 2 + 1); + if (!n) + { + p->found = FALSE; + return FALSE; + } + strcpy (n, "No"); + strcat (n, p->name); + newn = n; + } + if ((s = winFindOptionValue (options, newn)) != NULL) + { + if (GetBoolValue (&opt, s)) + { + p->value.bool = !opt.value.bool; + p->found = TRUE; + } + else + { + winDrvMsg (scrnIndex, X_WARNING, + "Option \"%s\" requires a boolean value\n", newn); + p->found = FALSE; + } + } + else + { + p->found = FALSE; + } + if (p->found) + { + winDrvMsgVerb (scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn); + if (*s != 0) + { + winErrorFVerb (2, " \"%s\"", s); + } + winErrorFVerb (2, "\n"); + } + free (n); + } + else + { + p->found = FALSE; + } + return p->found; +} + + +static Bool +configLayout (serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, + char *default_layout) +{ +#if 0 +#pragma warn UNIMPLEMENTED +#endif + return TRUE; +} + + +static Bool +configImpliedLayout (serverLayoutPtr servlayoutp, + XF86ConfScreenPtr conf_screen) +{ +#if 0 +#pragma warn UNIMPLEMENTED +#endif + return TRUE; +} + + +static Bool +GetBoolValue (OptionInfoPtr p, const char *s) +{ + if (*s == 0) + { + p->value.bool = TRUE; + } + else + { + if (winNameCompare (s, "1") == 0) + p->value.bool = TRUE; + else if (winNameCompare (s, "on") == 0) + p->value.bool = TRUE; + else if (winNameCompare (s, "true") == 0) + p->value.bool = TRUE; + else if (winNameCompare (s, "yes") == 0) + p->value.bool = TRUE; + else if (winNameCompare (s, "0") == 0) + p->value.bool = FALSE; + else if (winNameCompare (s, "off") == 0) + p->value.bool = FALSE; + else if (winNameCompare (s, "false") == 0) + p->value.bool = FALSE; + else if (winNameCompare (s, "no") == 0) + p->value.bool = FALSE; + } + return TRUE; +} + + +char * +winNormalizeName (const char *s) +{ + char *ret, *q; + const char *p; + + if (s == NULL) + return NULL; + + ret = malloc (strlen (s) + 1); + for (p = s, q = ret; *p != 0; p++) + { + switch (*p) + { + case '_': + case ' ': + case '\t': + continue; + default: + if (isupper (*p)) + *q++ = tolower (*p); + else + *q++ = *p; + } + } + *q = '\0'; + return ret; +} Index: xc/programs/Xserver/hw/xwin/winconfig.h diff -u /dev/null xc/programs/Xserver/hw/xwin/winconfig.h:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winconfig.h Thu Oct 17 04:18:22 2002 @@ -0,0 +1,332 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Alexander Gottwald + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winconfig.h,v 1.1 2002/10/17 08:18:22 alanh Exp $ */ +#ifndef __WIN_CONFIG_H__ +#define __WIN_CONFIG_H__ + +#include "win.h" +#include "../xfree86/parser/xf86Parser.h" + + +/* These are taken from hw/xfree86/common/xf86str.h */ + +typedef struct +{ + CARD32 red, green, blue; +} +rgb; + + +typedef struct +{ + float red, green, blue; +} +Gamma; + + +typedef struct +{ + char *identifier; + char *vendor; + char *board; + char *chipset; + char *ramdac; + char *driver; + struct _confscreenrec *myScreenSection; + Bool claimed; + Bool active; + Bool inUse; + int videoRam; + int textClockFreq; + pointer options; + int screen; /* For multi-CRTC cards */ +} +GDevRec, *GDevPtr; + + +typedef struct +{ + char *identifier; + char *driver; + pointer commonOptions; + pointer extraOptions; +} +IDevRec, *IDevPtr; + + +typedef struct +{ + int frameX0; + int frameY0; + int virtualX; + int virtualY; + int depth; + int fbbpp; + rgb weight; + rgb blackColour; + rgb whiteColour; + int defaultVisual; + char **modes; + pointer options; +} +DispRec, *DispPtr; + + +typedef struct _confxvportrec +{ + char *identifier; + pointer options; +} +confXvPortRec, *confXvPortPtr; + + +typedef struct _confxvadaptrec +{ + char *identifier; + int numports; + confXvPortPtr ports; + pointer options; +} +confXvAdaptorRec, *confXvAdaptorPtr; + + +typedef struct _confscreenrec +{ + char *id; + int screennum; + int defaultdepth; + int defaultbpp; + int defaultfbbpp; + GDevPtr device; + int numdisplays; + DispPtr displays; + int numxvadaptors; + confXvAdaptorPtr xvadaptors; + pointer options; +} +confScreenRec, *confScreenPtr; + + +typedef enum +{ + PosObsolete = -1, + PosAbsolute = 0, + PosRightOf, + PosLeftOf, + PosAbove, + PosBelow, + PosRelative +} +PositionType; + + +typedef struct _screenlayoutrec +{ + confScreenPtr screen; + char *topname; + confScreenPtr top; + char *bottomname; + confScreenPtr bottom; + char *leftname; + confScreenPtr left; + char *rightname; + confScreenPtr right; + PositionType where; + int x; + int y; + char *refname; + confScreenPtr refscreen; +} +screenLayoutRec, *screenLayoutPtr; + + +typedef struct _serverlayoutrec +{ + char *id; + screenLayoutPtr screens; + GDevPtr inactives; + IDevPtr inputs; + pointer options; +} +serverLayoutRec, *serverLayoutPtr; + + +/* + * winconfig.c + */ + +typedef struct +{ + /* Files */ + char *configFile; + char *fontPath; + char *rgbPath; + /* input devices - keyboard */ + char *keyboard; +#ifdef XKB + Bool noXkbExtension; + char *xkbMap; +#endif + /* layout */ + char *screenname; + /* mouse settings */ + char *mouse; + Bool emulate3buttons; + long emulate3timeout; +} +WinCmdlineRec, *WinCmdlinePtr; + + +extern WinCmdlineRec g_cmdline; + +extern XF86ConfigPtr g_xf86configptr; +extern serverLayoutRec g_winConfigLayout; + + +/* + * Function prototypes + */ + +Bool winReadConfigfile (void); +Bool winConfigFiles (void); +Bool winConfigOptions (void); +Bool winConfigScreens (void); +Bool winConfigKeyboard (DeviceIntPtr pDevice); +Bool winConfigMouse (DeviceIntPtr pDevice); + + +typedef struct +{ + double freq; + int units; +} +OptFrequency; + + +typedef union +{ + unsigned long num; + char *str; + double realnum; + Bool bool; + OptFrequency freq; +} +ValueUnion; + + +typedef enum +{ + OPTV_NONE = 0, + OPTV_INTEGER, + OPTV_STRING, /* a non-empty string */ + OPTV_ANYSTR, /* Any string, including an empty one */ + OPTV_REAL, + OPTV_BOOLEAN, + OPTV_FREQ +} +OptionValueType; + + +typedef enum +{ + OPTUNITS_HZ = 1, + OPTUNITS_KHZ, + OPTUNITS_MHZ +} +OptFreqUnits; + + +typedef struct +{ + int token; + const char *name; + OptionValueType type; + ValueUnion value; + Bool found; +} +OptionInfoRec, *OptionInfoPtr; + + +/* + * Function prototypes + */ + +char *winSetStrOption (pointer optlist, const char *name, char *deflt); +int winSetBoolOption (pointer optlist, const char *name, int deflt); +int winSetIntOption (pointer optlist, const char *name, int deflt); +double winSetRealOption (pointer optlist, const char *name, double deflt); + +XF86OptionPtr winFindOption (XF86OptionPtr list, const char *name); +char *winFindOptionValue (XF86OptionPtr list, const char *name); +int winNameCompare (const char *s1, const char *s2); +char *winNormalizeName (const char *s); + + +typedef struct +{ + struct + { + long leds; + long delay; + long rate; + } + keyboard; +#ifdef XKB + struct + { + Bool disable; + char *rules; + char *model; + char *layout; + char *variant; + char *options; + char *initialMap; + char *keymap; + char *types; + char *compat; + char *keycodes; + char *symbols; + char *geometry; + } + xkb; +#endif + struct + { + Bool emulate3Buttons; + long emulate3Timeout; + } + pointer; +} +winInfoRec, *winInfoPtr; + + +extern winInfoRec g_winInfo; + +#endif Index: xc/programs/Xserver/hw/xwin/wincreatewnd.c diff -u xc/programs/Xserver/hw/xwin/wincreatewnd.c:1.1 xc/programs/Xserver/hw/xwin/wincreatewnd.c:1.5 --- xc/programs/Xserver/hw/xwin/wincreatewnd.c:1.1 Sun Nov 11 18:07:40 2001 +++ xc/programs/Xserver/hw/xwin/wincreatewnd.c Wed Feb 12 10:01:38 2003 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wincreatewnd.c,v 1.1 2001/11/11 23:07:40 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincreatewnd.c,v 1.5 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" #include "shellapi.h" @@ -38,6 +38,9 @@ */ static Bool +winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo); + +static Bool winAdjustForAutoHide (RECT *prcWorkArea); @@ -56,7 +59,7 @@ WNDCLASS wc; #if CYGDEBUG - ErrorF ("winCreateBoundingWindowFullScreen ()\n"); + ErrorF ("winCreateBoundingWindowFullScreen\n"); #endif /* Setup our window class */ @@ -64,8 +67,8 @@ wc.lpfnWndProc = winWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = GetModuleHandle (NULL); - wc.hIcon = 0; + wc.hInstance = g_hInstance; + wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); wc.hCursor = 0; wc.hbrBackground = 0; wc.lpszMenuName = NULL; @@ -96,7 +99,7 @@ default: /* Hide the window */ - ShowWindow (*phwnd, SW_HIDE); + ShowWindow (*phwnd, SW_SHOWNORMAL); break; } @@ -119,19 +122,40 @@ { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - int iWidth = pScreenInfo->dwWidth; - int iHeight = pScreenInfo->dwHeight; + int iWidth = pScreenInfo->dwUserWidth; + int iHeight = pScreenInfo->dwUserHeight; HWND *phwnd = &pScreenPriv->hwndScreen; WNDCLASS wc; RECT rcClient, rcWorkArea; + DWORD dwWindowStyle; + + ErrorF ("winCreateBoundingWindowWindowed - User w: %d h: %d\n", + pScreenInfo->dwUserWidth, pScreenInfo->dwUserHeight); + ErrorF ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight); + + /* Set the common window style flags */ + dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; + + /* Decorated or undecorated window */ + if (pScreenInfo->fDecoration + && !pScreenInfo->fRootless + && !pScreenInfo->fMultiWindow) + { + dwWindowStyle |= WS_CAPTION; + if (pScreenInfo->fScrollbars) + dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX; + } + else + dwWindowStyle |= WS_POPUP; /* Setup our window class */ wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = GetModuleHandle (NULL); - wc.hIcon = 0; + wc.hInstance = g_hInstance; + wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wc.lpszMenuName = NULL; @@ -139,47 +163,115 @@ RegisterClass (&wc); /* Get size of work area */ - SystemParametersInfo (SPI_GETWORKAREA, 0, &rcWorkArea, 0); + winGetWorkArea (&rcWorkArea, pScreenInfo); /* Adjust for auto-hide taskbars */ winAdjustForAutoHide (&rcWorkArea); - /* Adjust the window width and height for border and title bars */ - iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); - iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME) - + GetSystemMetrics (SM_CYCAPTION); + /* Did the user specify a height and width? */ + if (pScreenInfo->fUserGaveHeightAndWidth) + { + /* User gave a desired height and width, try to accomodate */ +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed - User gave height " + "and width\n"); +#endif + + /* Adjust the window width and height for borders and title bar */ + if (pScreenInfo->fDecoration + && !pScreenInfo->fRootless + && !pScreenInfo->fMultiWindow) + { +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed - Window has decoration\n"); +#endif + /* Are we using scrollbars? */ + if (pScreenInfo->fScrollbars) + { +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed - Window has " + "scrollbars\n"); +#endif + + iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME); + iHeight += 2 * GetSystemMetrics (SM_CYSIZEFRAME) + + GetSystemMetrics (SM_CYCAPTION); + } + else + { +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed - Window does not have " + "scrollbars\n"); +#endif + + iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); + iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME) + + GetSystemMetrics (SM_CYCAPTION); + } + } + else + { + /* + * User gave a width and height but also said no decoration. + * In this case we have to ignore the requested width and height + * and instead use the largest possible window that we can. + */ + if (pScreenInfo->fMultipleMonitors) + { + iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + } + else + { + iWidth = GetSystemMetrics (SM_CXSCREEN); + iHeight = GetSystemMetrics (SM_CYSCREEN); + } + } + } + else + { + /* By default, we are creating a window that is as large as possible */ +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed - User did not give " + "height and width\n"); +#endif + /* Defaults are wrong if we have multiple monitors */ + if (pScreenInfo->fMultipleMonitors) + { + iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + } + } + + /* Clean up the scrollbars flag, if necessary */ + if ((!pScreenInfo->fDecoration + || pScreenInfo->fRootless + || pScreenInfo->fMultiWindow) + && pScreenInfo->fScrollbars) + { + /* We cannot have scrollbars if we do not have a window border */ + pScreenInfo->fScrollbars = FALSE; + } /* Trim window width to fit work area */ if (iWidth > (rcWorkArea.right - rcWorkArea.left)) - { - iWidth = rcWorkArea.right - rcWorkArea.left; - pScreenInfo->dwWidth = iWidth - - 2 * GetSystemMetrics (SM_CXFIXEDFRAME); - } + iWidth = rcWorkArea.right - rcWorkArea.left; /* Trim window height to fit work area */ if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) - { - iHeight = rcWorkArea.bottom - rcWorkArea.top; - pScreenInfo->dwHeight = iHeight - - 2 * GetSystemMetrics (SM_CYFIXEDFRAME) - - GetSystemMetrics (SM_CYCAPTION); - } + iHeight = rcWorkArea.bottom - rcWorkArea.top; #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed () - Adjusted width: %d "\ + ErrorF ("winCreateBoundingWindowWindowed - Adjusted width: %d "\ "height: %d\n", - pScreenInfo->dwWidth, pScreenInfo->dwHeight); + iWidth, iHeight); #endif /* Create the window */ *phwnd = CreateWindowExA (0, /* Extended styles */ WINDOW_CLASS, /* Class name */ WINDOW_TITLE, /* Window name */ - WS_OVERLAPPED - | WS_CAPTION - | WS_SYSMENU - | WS_MINIMIZEBOX, /* Almost OverlappedWindow */ + dwWindowStyle, rcWorkArea.left, /* Horizontal position */ rcWorkArea.top, /* Vertical position */ iWidth, /* Right edge */ @@ -190,52 +282,106 @@ pScreenPriv); /* ScreenPrivates */ if (*phwnd == NULL) { - ErrorF ("winCreateBoundingWindowWindowed () CreateWindowEx () failed\n"); + ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed () - CreateWindowEx () returned\n"); + ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n"); #endif /* Get the client area coordinates */ if (!GetClientRect (*phwnd, &rcClient)) { - ErrorF ("winCreateBoundingWindowWindowed () - GetClientRect () " + ErrorF ("winCreateBoundingWindowWindowed - GetClientRect () " "failed\n"); return FALSE; } - ErrorF ("winCreateBoundingWindowWindowed () - WindowClient "\ - "w %d h %d r %d l %d b %d t %d\n", + + ErrorF ("winCreateBoundingWindowWindowed - WindowClient " + "w %ld h %ld r %ld l %ld b %ld t %ld\n", rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, rcClient.right, rcClient.left, rcClient.bottom, rcClient.top); + + /* We adjust the visual size if the user did not specify it */ + if (!(pScreenInfo->fScrollbars && pScreenInfo->fUserGaveHeightAndWidth)) + { + /* + * User did not give a height and width with scrollbars enabled, + * so we will resize the underlying visual to be as large as + * the initial view port (page size). This way scrollbars will + * not appear until the user shrinks the window, if they ever do. + * + * NOTE: We have to store the viewport size here because + * the user may have an autohide taskbar, which would + * cause the viewport size to be one less in one dimension + * than the viewport size that we calculated by subtracting + * the size of the borders and caption. + */ + pScreenInfo->dwWidth = rcClient.right - rcClient.left; + pScreenInfo->dwHeight = rcClient.bottom - rcClient.top; + } +#if 0 /* - * Transform the client relative coords to screen relative coords. - * It is almost impossible to tell if the function has failed, thus - * we do not want to check for a return value of 0, as that could - * simply indicated that the window was positioned with the upper - * left corner at (0,0). + * NOTE: For the uninitiated, the page size is the number of pixels + * that we can display in the x or y direction at a time and the + * range is the total number of pixels in the x or y direction that we + * have available to display. In other words, the page size is the + * size of the window area minus the space the caption, borders, and + * scrollbars (if any) occupy, and the range is the size of the + * underlying X visual. Notice that, contrary to what some of the + * MSDN Library arcticles lead you to believe, the windows + * ``client area'' size does not include the scrollbars. In other words, + * the whole client area size that is reported to you is drawable by + * you; you do not have to subtract the size of the scrollbars from + * the client area size, and if you did it would result in the size + * of the scrollbars being double counted. */ - MapWindowPoints (*phwnd, - HWND_DESKTOP, - (LPPOINT)&rcClient, - 2); + + /* Setup scrollbar page and range, if scrollbars are enabled */ + if (pScreenInfo->fScrollbars) + { + SCROLLINFO si; + + /* Initialize the scrollbar info structure */ + si.cbSize = sizeof (si); + si.fMask = SIF_RANGE | SIF_PAGE; + si.nMin = 0; + + /* Setup the width range and page size */ + si.nMax = pScreenInfo->dwWidth - 1; + si.nPage = rcClient.right - rcClient.left; + ErrorF ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n", + si.nMax, si.nPage); + SetScrollInfo (*phwnd, SB_HORZ, &si, TRUE); + + /* Setup the height range and page size */ + si.nMax = pScreenInfo->dwHeight - 1; + si.nPage = rcClient.bottom - rcClient.top; + ErrorF ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n", + si.nMax, si.nPage); + SetScrollInfo (*phwnd, SB_VERT, &si, TRUE); + } +#endif /* Show the window */ - ShowWindow (*phwnd, SW_SHOW); + if (pScreenInfo->fMultiWindow) + ShowWindow (*phwnd, SW_SHOWMINNOACTIVE); + else + ShowWindow (*phwnd, SW_SHOWNORMAL); if (!UpdateWindow (*phwnd)) { - ErrorF ("winCreateBoundingWindowWindowed () - UpdateWindow () failed\n"); + ErrorF ("winCreateBoundingWindowWindowed - UpdateWindow () failed\n"); return FALSE; } /* Attempt to bring our window to the top of the display */ if (!BringWindowToTop (*phwnd)) { - ErrorF ("winCreateBoundingWindowWindowed () - BringWindowToTop () " + ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () " "failed\n"); return FALSE; } @@ -244,8 +390,79 @@ if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI) winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF)); - ErrorF ("winCreateBoundingWindowWindowed () - Returning\n"); + ErrorF ("winCreateBoundingWindowWindowed - Returning\n"); + return TRUE; +} + + +/* + * Find the work area of all attached monitors + */ + +static Bool +winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo) +{ + int iPrimaryWidth, iPrimaryHeight; + int iWidth, iHeight; + int iLeft, iTop; + int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight; + + /* SPI_GETWORKAREA only gets the work area of the primary screen. */ + SystemParametersInfo (SPI_GETWORKAREA, 0, prcWorkArea, 0); + + /* Bail out here if we aren't using multiple monitors */ + if (!pScreenInfo->fMultipleMonitors) + return TRUE; + + ErrorF ("winGetWorkArea - Original WorkArea: %d %d %d %d\n", + prcWorkArea->top, prcWorkArea->left, + prcWorkArea->bottom, prcWorkArea->right); + + /* Get size of full virtual screen */ + iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + + ErrorF ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight); + + /* Get origin of full virtual screen */ + iLeft = GetSystemMetrics (SM_XVIRTUALSCREEN); + iTop = GetSystemMetrics (SM_YVIRTUALSCREEN); + + ErrorF ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop); + + /* Get size of primary screen */ + iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN); + iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN); + + ErrorF ("winGetWorkArea - Primary screen is %d x %d\n", + iPrimaryWidth, iPrimaryHeight); + + /* Work out how much of the primary screen we aren't using */ + iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right - + prcWorkArea->left); + iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom + - prcWorkArea->top); + + /* Update the rectangle to include all monitors */ + if (iLeft < 0) + { + prcWorkArea->left = iLeft; + } + if (iTop < 0) + { + prcWorkArea->top = iTop; + } + prcWorkArea->right = prcWorkArea->left + iWidth - + iPrimaryNonWorkAreaWidth; + prcWorkArea->bottom = prcWorkArea->top + iHeight - + iPrimaryNonWorkAreaHeight; + + ErrorF ("winGetWorkArea - Adjusted WorkArea for multiple " + "monitors: %d %d %d %d\n", + prcWorkArea->top, prcWorkArea->left, + prcWorkArea->bottom, prcWorkArea->right); + return TRUE; } Index: xc/programs/Xserver/hw/xwin/wincursor.c diff -u xc/programs/Xserver/hw/xwin/wincursor.c:1.2 xc/programs/Xserver/hw/xwin/wincursor.c:1.5 --- xc/programs/Xserver/hw/xwin/wincursor.c:1.2 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/wincursor.c Fri Jul 5 05:19:26 2002 @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wincursor.c,v 1.2 2001/05/14 16:52:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincursor.c,v 1.5 2002/07/05 09:19:26 alanh Exp $ */ #include "win.h" @@ -38,13 +38,42 @@ { winCursorOffScreen, winCrossScreen, - miPointerWarpCursor + winPointerWarpCursor }; + +void +winPointerWarpCursor (ScreenPtr pScreen, int x, int y) +{ + winScreenPriv(pScreen); + RECT rcClient; + + /* Only update the Windows cursor position if we are active */ + if (pScreenPriv->hwndScreen == GetForegroundWindow ()) + { + /* Get the client area coordinates */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + + /* Translate the client area coords to screen coords */ + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, + 2); + + /* + * Update the Windows cursor position so that we don't + * immediately warp back to the current position. + */ + SetCursorPos (rcClient.left + x, rcClient.top + y); + } + + /* Call the mi warp procedure to do the actual warping in X. */ + miPointerWarpCursor (pScreen, x, y); +} + Bool winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y) { - ErrorF ("winCursorOffScreen () - hmm...\n"); return FALSE; } Index: xc/programs/Xserver/hw/xwin/winengine.c diff -u xc/programs/Xserver/hw/xwin/winengine.c:1.1 xc/programs/Xserver/hw/xwin/winengine.c:1.4 --- xc/programs/Xserver/hw/xwin/winengine.c:1.1 Sun Nov 11 18:07:40 2001 +++ xc/programs/Xserver/hw/xwin/winengine.c Wed Feb 12 10:01:38 2003 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winengine.c,v 1.1 2001/11/11 23:07:40 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winengine.c,v 1.4 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -37,19 +37,16 @@ * DirectDraw version and hardware */ -Bool -winDetectSupportedEngines (ScreenPtr pScreen) +void +winDetectSupportedEngines () { - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; OSVERSIONINFO osvi; - HMODULE hmodDirectDraw = NULL; /* Initialize the engine support flags */ - pScreenInfo->dwEnginesSupported = WIN_SERVER_SHADOW_GDI; + g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI; #if WIN_NATIVE_GDI_SUPPORT - pScreenInfo->dwEnginesSupported |= WIN_SERVER_NATIVE_GDI; + g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI; #endif /* Get operating system version information */ @@ -62,59 +59,51 @@ { case VER_PLATFORM_WIN32_NT: /* Engine 4 is supported on NT only */ - ErrorF ("winDetectSupportedEngines () - Windows NT/2000\n"); + ErrorF ("winDetectSupportedEngines - Windows NT/2000/XP\n"); break; case VER_PLATFORM_WIN32_WINDOWS: /* Engine 4 is supported on NT only */ - ErrorF ("winDetectSupportedEngines () - Windows 95/98/Me\n"); + ErrorF ("winDetectSupportedEngines - Windows 95/98/Me\n"); break; } - /* Determine if DirectDraw is installed */ - hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0); - /* Do we have DirectDraw? */ - if (hmodDirectDraw != NULL) + if (g_hmodDirectDraw != NULL) { - FARPROC fpDirectDrawCreate = NULL; LPDIRECTDRAW lpdd = NULL; LPDIRECTDRAW4 lpdd4 = NULL; HRESULT ddrval; - /* Try to get the DirectDrawCreate address */ - fpDirectDrawCreate = GetProcAddress (hmodDirectDraw, - "DirectDrawCreate"); - - /* Did the proc name exist? */ - if (fpDirectDrawCreate == NULL) + /* Was the DirectDrawCreate function found? */ + if (g_fpDirectDrawCreate == NULL) { /* No DirectDraw support */ - return TRUE; + return; } /* DirectDrawCreate exists, try to call it */ /* Create a DirectDraw object, store the address at lpdd */ - ddrval = (*fpDirectDrawCreate) (NULL, - (void**) &lpdd, - NULL); + ddrval = (*g_fpDirectDrawCreate) (NULL, + (void**) &lpdd, + NULL); if (FAILED (ddrval)) { /* No DirectDraw support */ - ErrorF ("winDetectSupportedEngines () - DirectDraw not installed\n"); - return TRUE; + ErrorF ("winDetectSupportedEngines - DirectDraw not installed\n"); + return; } else { /* We have DirectDraw */ - ErrorF ("winDetectSupportedEngines () - DirectDraw installed\n"); - pScreenInfo->dwEnginesSupported |= WIN_SERVER_SHADOW_DD; + ErrorF ("winDetectSupportedEngines - DirectDraw installed\n"); + g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD; /* Allow PrimaryDD engine if NT */ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { - pScreenInfo->dwEnginesSupported |= WIN_SERVER_PRIMARY_DD; - ErrorF ("winDetectSupportedEngines () - Allowing PrimaryDD\n"); + g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD; + ErrorF ("winDetectSupportedEngines - Allowing PrimaryDD\n"); } } @@ -125,8 +114,8 @@ if (SUCCEEDED (ddrval)) { /* We have DirectDraw4 */ - ErrorF ("winDetectSupportedEngines () - DirectDraw4 installed\n"); - pScreenInfo->dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL; + ErrorF ("winDetectSupportedEngines - DirectDraw4 installed\n"); + g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL; } /* Cleanup DirectDraw interfaces */ @@ -134,16 +123,10 @@ IDirectDraw_Release (lpdd4); if (lpdd != NULL) IDirectDraw_Release (lpdd); - - /* Unload the DirectDraw library */ - FreeLibrary (hmodDirectDraw); - hmodDirectDraw = NULL; } - - ErrorF ("winDetectSupportedEngines () - Returning, supported engines %08x\n", - pScreenInfo->dwEnginesSupported); - return TRUE; + ErrorF ("winDetectSupportedEngines - Returning, supported engines %08x\n", + g_dwEnginesSupported); } @@ -159,31 +142,31 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc; - DWORD dwDepth; + DWORD dwBPP; /* Get a DC */ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winSetEngine () - Couldn't get an HDC\n"); + ErrorF ("winSetEngine - Couldn't get an HDC\n"); return FALSE; } /* - * pScreenInfo->dwDepth may be 0 to indicate that the current screen + * pScreenInfo->dwBPP may be 0 to indicate that the current screen * depth is to be used. Thus, we must query for the current display * depth here. */ - dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* Release the DC */ ReleaseDC (NULL, hdc); hdc = NULL; /* ShadowGDI is the only engine that supports windowed PseudoColor */ - if (dwDepth == 8 && !pScreenInfo->fFullScreen) + if (dwBPP == 8 && !pScreenInfo->fFullScreen) { - ErrorF ("winSetEngine () - Windowed && PseudoColor => ShadowGDI\n"); + ErrorF ("winSetEngine - Windowed && PseudoColor => ShadowGDI\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; /* Set engine function pointers */ @@ -191,10 +174,21 @@ return TRUE; } + /* ShadowGDI is the only engine that supports Multi Window Mode */ + if (pScreenInfo->fMultiWindow) + { + ErrorF ("winSetEngine - Multi Window => ShadowGDI\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowGDI (pScreen); + return TRUE; + } + /* If the user's choice is supported, we'll use that */ - if (pScreenInfo->dwEnginesSupported & pScreenInfo->dwEnginePreferred) + if (g_dwEnginesSupported & pScreenInfo->dwEnginePreferred) { - ErrorF ("winSetEngine () - Using user's preference: %d\n", + ErrorF ("winSetEngine - Using user's preference: %d\n", pScreenInfo->dwEnginePreferred); pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred; @@ -217,15 +211,15 @@ winSetEngineFunctionsNativeGDI (pScreen); break; default: - FatalError ("winSetEngine () - Invalid engine type\n"); + FatalError ("winSetEngine - Invalid engine type\n"); } return TRUE; } /* ShadowDDNL has good performance, so why not */ - if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) + if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) { - ErrorF ("winSetEngine () - Using Shadow DirectDraw NonLocking\n"); + ErrorF ("winSetEngine - Using Shadow DirectDraw NonLocking\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL; /* Set engine function pointers */ @@ -234,9 +228,9 @@ } /* ShadowDD is next in line */ - if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_DD) + if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD) { - ErrorF ("winSetEngine () - Using Shadow DirectDraw\n"); + ErrorF ("winSetEngine - Using Shadow DirectDraw\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD; /* Set engine function pointers */ @@ -245,9 +239,9 @@ } /* ShadowGDI is next in line */ - if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_GDI) + if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI) { - ErrorF ("winSetEngine () - Using Shadow GDI DIB\n"); + ErrorF ("winSetEngine - Using Shadow GDI DIB\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; /* Set engine function pointers */ @@ -256,4 +250,60 @@ } return TRUE; +} + + +/* + * Get procedure addresses for DirectDrawCreate and DirectDrawCreateClipper + */ + +Bool +winGetDDProcAddresses () +{ + Bool fReturn = TRUE; + + /* Load the DirectDraw library */ + g_hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0); + if (g_hmodDirectDraw == NULL) + { + ErrorF ("winGetDDProcAddresses - Could not load ddraw.dll\n"); + fReturn = TRUE; + goto winGetDDProcAddresses_Exit; + } + + /* Try to get the DirectDrawCreate address */ + g_fpDirectDrawCreate = GetProcAddress (g_hmodDirectDraw, + "DirectDrawCreate"); + if (g_fpDirectDrawCreate == NULL) + { + ErrorF ("winGetDDProcAddresses - Could not get DirectDrawCreate " + "address\n"); + fReturn = TRUE; + goto winGetDDProcAddresses_Exit; + } + + /* Try to get the DirectDrawCreateClipper address */ + g_fpDirectDrawCreateClipper = GetProcAddress (g_hmodDirectDraw, + "DirectDrawCreateClipper"); + if (g_fpDirectDrawCreateClipper == NULL) + { + ErrorF ("winGetDDProcAddresses - Could not get " + "DirectDrawCreateClipper address\n"); + fReturn = FALSE; + goto winGetDDProcAddresses_Exit; + } + + /* + * Note: Do not unload ddraw.dll here. Do it in GiveUp + */ + + winGetDDProcAddresses_Exit: + /* Unload the DirectDraw library if we failed to initialize */ + if (!fReturn && g_hmodDirectDraw != NULL) + { + FreeLibrary (g_hmodDirectDraw); + g_hmodDirectDraw = NULL; + } + + return fReturn; } Index: xc/programs/Xserver/hw/xwin/winerror.c diff -u xc/programs/Xserver/hw/xwin/winerror.c:1.3 xc/programs/Xserver/hw/xwin/winerror.c:1.4 --- xc/programs/Xserver/hw/xwin/winerror.c:1.3 Tue Oct 23 18:22:47 2001 +++ xc/programs/Xserver/hw/xwin/winerror.c Wed Feb 12 10:01:38 2003 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winerror.c,v 1.3 2001/10/23 22:22:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winerror.c,v 1.4 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -37,14 +37,22 @@ void OsVendorVErrorF (const char *pszFormat, va_list va_args) { + static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER; + /* Check we opened the log file first */ if (g_pfLog == NULL) return; + /* Lock the printing mutex */ + pthread_mutex_lock (&s_pmPrinting); + /* Print the error message to a log file, could be stderr */ vfprintf (g_pfLog, pszFormat, va_args); /* Flush after every write, to make updates show up quickly */ fflush (g_pfLog); + + /* Unlock the printing mutex */ + pthread_mutex_unlock (&s_pmPrinting); } #endif Index: xc/programs/Xserver/hw/xwin/winkeybd.c diff -u xc/programs/Xserver/hw/xwin/winkeybd.c:1.8 xc/programs/Xserver/hw/xwin/winkeybd.c:1.12 --- xc/programs/Xserver/hw/xwin/winkeybd.c:1.8 Mon Nov 12 03:47:53 2001 +++ xc/programs/Xserver/hw/xwin/winkeybd.c Thu Oct 17 04:18:22 2002 @@ -30,13 +30,188 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.c,v 1.8 2001/11/12 08:47:53 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.c,v 1.12 2002/10/17 08:18:22 alanh Exp $ */ #include "win.h" - #include "winkeybd.h" +#include "winconfig.h" + +#ifdef XKB +#define XKB_IN_SERVER +#include "XKBsrv.h" +#endif + +static Bool g_winKeyState[NUM_KEYCODES]; + + +#if WIN_NEW_KEYBOARD_SUPPORT + +const unsigned int MaxKeysPerKey = 4; + +void +winProcessKeyEvent (DWORD dwVirtualKey, DWORD dwKeyData) +{ + Bool fDown = ((dwKeyData & 0x80000000) == 0); + winKeyEventsRec kerEvent; + int i; + + /* Get the key events */ + kerEvent = winTranslateKey (dwVirtualKey, dwKeyData); + + if (kerEvent.dwReleaseModifiers & WIN_MOD_LCONTROL) + winSendKeyEvent (XK_Control_L, FALSE); + if (kerEvent.dwReleaseModifiers & WIN_MOD_RCONTROL) + winSendKeyEvent (XK_Control_R, FALSE); + if (kerEvent.dwReleaseModifiers & WIN_MOD_LALT) + winSendKeyEvent (XK_Alt_L, FALSE); + if (kerEvent.dwReleaseModifiers & WIN_MOD_RALT) + winSendKeyEvent (XK_Alt_R, FALSE); + + for (i = 0; kerEvent.dwXKeycodes[i] != XK_VoidSymbol; ++i) + winSendKeyEvent (kerEvent.dwXKeycodes[i], fDown); + + if (kerEvent.dwReleaseModifiers & WIN_MOD_LCONTROL) + winSendKeyEvent (XK_Control_L, FALSE); + if (kerEvent.dwReleaseModifiers & WIN_MOD_RCONTROL) + winSendKeyEvent (XK_Control_R, TRUE); + if (kerEvent.dwReleaseModifiers & WIN_MOD_LALT) + winSendKeyEvent (XK_Alt_L, FALSE); + if (kerEvent.dwReleaseModifiers & WIN_MOD_RALT) + winSendKeyEvent (XK_Alt_R, TRUE); + +} + + +winKeyEventsRec +winTranslateKey (DWORD dwVirtualKey, DWORD dwKeyData) +{ + winKeyEventsRec kerEvents; + Bool fExtended = ((HIWORD (dwKeyData) & KF_EXTENDED) != 0); + int i; + DWORD dwNumEvents = 0; + BYTE bKeyboardState[256]; + int iReturn; + unsigned char cAscii[4]; + /* Remap extended modifiers to the right version of that key. */ + if (fExtended) + { + switch (dwVirtualKey) + { + case VK_MENU: + dwVirtualKey = VK_RMENU; + break; + + case VK_CONTROL: + dwVirtualKey = VK_RCONTROL; + break; + } + } + + /* Initialize the modifiers to release flag */ + kerEvents.dwReleaseModifiers = 0; + + /* Look up the current virtual key code in the translation table */ + for (i = 0; i < g_winKeymapEntries; ++i) + { + /* Did we find a mapping? */ + if (winKeymap[i].dwVirtualKey == dwVirtualKey) + { + /* Mapping found, we have at least one event now */ + kerEvents.dwXKeycodes[dwNumEvents] = winKeymap[i].dwXKey; + break; + } + } + + + /* Break out early, if we found the key in the translation table */ + if (dwNumEvents != 0) + { + /* Terminate the last of the key events with a void symbol */ + kerEvents.dwXKeycodes[dwNumEvents] = XK_VoidSymbol; + return kerEvents; + } + + /* Get the state of all keyboard keys */ + GetKeyboardState (bKeyboardState); + + /* Try to convert the key to ASCII */ + iReturn = ToAscii (dwVirtualKey, 0, bKeyboardState, (WORD *) cAscii, 0); + + /* + * Left Control and Alt pressed, combined with a valid result + * from ToAscii means that we have found the Windows version of AltGr. + */ + if ((bKeyboardState[VK_MENU] & 0x80) && (bKeyboardState[VK_CONTROL] & 0x80) + && (iReturn >= 1) + && (((cAscii[0] >= 32) && (cAscii[0] <= 126)) + || (cAscii[0] >= 160))) + { + /* These three calls will return 0 on Windows 95/98/Me */ + if ((GetKeyState (VK_LCONTROL) & KF_UP)) + kerEvents.dwReleaseModifiers |= WIN_MOD_LCONTROL; + if ((GetKeyState (VK_LMENU) & KF_UP)) + kerEvents.dwReleaseModifiers |= WIN_MOD_LALT; + if ((GetKeyState (VK_RMENU) & KF_UP)) + kerEvents.dwReleaseModifiers |= WIN_MOD_RALT; + + /* Windows 95/98/Me handling - pop all of them */ + if (kerEvents.dwReleaseModifiers == 0) + kerEvents.dwReleaseModifiers + = WIN_MOD_LCONTROL | WIN_MOD_LALT | WIN_MOD_RALT; + + /* Copy the string of character events */ + for (i = 0; i < iReturn; ++i) + kerEvents.dwXKeycodes[dwNumEvents++] = cAscii[i]; + } + + /* Handle non Ctrl+Alt cases*/ + if (dwNumEvents == 0) + { + bKeyboardState[VK_CONTROL] = 0; + bKeyboardState[VK_LCONTROL] = 0; + bKeyboardState[VK_RCONTROL] = 0; + + iReturn = ToAscii (dwVirtualKey, 0, bKeyboardState, (WORD *)cAscii, 0); + if (iReturn < 0) + { + switch (cAscii[0]) + { + case '`': + kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_grave; + break; + + case '\'': + kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_acute; + break; + + case '~': + kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_tilde; + break; + + case '^': + kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_circumflex; + break; + } + } + + /* Send what we've got if its a printable character */ + if (iReturn >= 1) + for (i = 0; i < iReturn; ++i) + kerEvents.dwXKeycodes[dwNumEvents++] = cAscii[i]; + } + + + /* Terminate the last of the key events with a void symbol */ + kerEvents.dwXKeycodes[dwNumEvents] = XK_VoidSymbol; + return kerEvents; +} + + +#else /* WIN_NEW_KEYBOARD_SUPPORT */ + + /* * Translate a Windows WM_[SYS]KEY(UP/DOWN) message * into an ASCII scan code. @@ -61,7 +236,9 @@ *piScanCode = LOBYTE (HIWORD (lParam)); } +#endif /* WIN_NEW_KEYBOARD_SUPPORT */ + /* * We call this function from winKeybdProc when we are * initializing the keyboard. @@ -71,18 +248,25 @@ winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap) { int i; - KeySym *pKeySym = map; + KeySym *pMap = map; + KeySym *pKeySym; + + /* + * Initialize all key states to up... which may not be true + * but it is close enough. + */ + ZeroMemory (g_winKeyState, sizeof (g_winKeyState[0]) * NUM_KEYCODES); /* MAP_LENGTH is defined in Xserver/include/input.h to be 256 */ for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = NoSymbol; /* make sure it is restored */ /* Loop through all valid entries in the key symbol table */ - for (i = MIN_KEYCODE; + for (pKeySym = pMap, i = MIN_KEYCODE; i < (MIN_KEYCODE + NUM_KEYCODES); i++, pKeySym += GLYPHS_PER_KEY) { - switch(*pKeySym) + switch (*pKeySym) { case XK_Shift_L: case XK_Shift_R: @@ -103,6 +287,7 @@ pModMap[i] = AltMask; break; +#if !WIN_NEW_KEYBOARD_SUPPORT case XK_Num_Lock: pModMap[i] = NumLockMask; break; @@ -116,6 +301,7 @@ case XK_Kana_Shift: pModMap[i] = KanaMask; break; +#endif /* alternate toggle for multinational support */ case XK_Mode_switch: @@ -124,7 +310,7 @@ } } - pKeySyms->map = (KeySym *) map; + pKeySyms->map = (KeySym *) pMap; pKeySyms->mapWidth = GLYPHS_PER_KEY; pKeySyms->minKeyCode = MIN_KEYCODE; pKeySyms->maxKeyCode = MAX_KEYCODE; @@ -137,11 +323,12 @@ pointer pCtrl, int iClass) { /* - * Window 95 and later ignore the parameters to Beep. - * Systems with sound cards will play the default sound event; - * systems without sound cards will play the standard system beep. + * We can't use Beep () here because it uses the PC speaker + * on NT/2000. MessageBeep (MB_OK) will play the default system + * sound on systems with a sound card or it will beep the PC speaker + * on systems that do not have a sound card. */ - Beep (0, 0); + MessageBeep (MB_OK); } @@ -164,16 +351,70 @@ KeySymsRec keySyms; CARD8 modMap[MAP_LENGTH]; DevicePtr pDevice = (DevicePtr) pDeviceInt; +#ifdef XKB + XkbComponentNamesRec names; +#endif switch (iState) { - case DEVICE_INIT: + case DEVICE_INIT: + winConfigKeyboard (pDeviceInt); + winGetKeyMappings (&keySyms, modMap); - InitKeyboardDeviceStruct (pDevice, - &keySyms, - modMap, - winKeybdBell, - winKeybdCtrl); + +#ifdef XKB + /* FIXME: Maybe we should use winGetKbdLeds () here? */ + defaultKeyboardControl.leds = g_winInfo.keyboard.leds; +#else + defaultKeyboardControl.leds = g_winInfo.keyboard.leds; +#endif + +#ifdef XKB + if (g_winInfo.xkb.disable) + { +#endif + InitKeyboardDeviceStruct (pDevice, + &keySyms, + modMap, + winKeybdBell, + winKeybdCtrl); +#ifdef XKB + } + else + { + + if (XkbInitialMap) + { + names.keymap = XkbInitialMap; + names.keycodes = NULL; + names.types = NULL; + names.compat = NULL; + names.symbols = NULL; + names.geometry = NULL; + } + else + { + names.keymap = g_winInfo.xkb.keymap; + names.keycodes = g_winInfo.xkb.keycodes; + names.types = g_winInfo.xkb.types; + names.compat = g_winInfo.xkb.compat; + names.symbols = g_winInfo.xkb.symbols; + names.geometry = g_winInfo.xkb.geometry; + } + + ErrorF("Rules = \"%s\" Model = \"%s\" Layout = \"%s\"" + " Variant = \"%s\" Options = \"%s\"\n", + g_winInfo.xkb.rules, g_winInfo.xkb.model, + g_winInfo.xkb.layout, g_winInfo.xkb.variant, + g_winInfo.xkb.options); + + XkbSetRulesDflts (g_winInfo.xkb.rules, g_winInfo.xkb.model, + g_winInfo.xkb.layout, g_winInfo.xkb.variant, + g_winInfo.xkb.options); + XkbInitKeyboardDeviceStruct (pDeviceInt, &names, &keySyms, + modMap, winKeybdBell, winKeybdCtrl); + } +#endif break; case DEVICE_ON: pDevice->on = TRUE; @@ -199,6 +440,7 @@ void winInitializeModeKeyStates (void) { +#if !WIN_NEW_KEYBOARD_SUPPORT /* Restore NumLock */ if (GetKeyState (VK_NUMLOCK) & 0x0001) { @@ -226,6 +468,7 @@ winSendKeyEvent (KEY_HKTG, TRUE); winSendKeyEvent (KEY_HKTG, FALSE); } +#endif } @@ -237,6 +480,7 @@ void winStoreModeKeyStates (ScreenPtr pScreen) { +#if !WIN_NEW_KEYBOARD_SUPPORT winScreenPriv(pScreen); /* Initialize all mode key states to off */ @@ -253,6 +497,7 @@ pScreenPriv->dwModeKeyStates |= (GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex; +#endif } @@ -265,6 +510,7 @@ void winRestoreModeKeyStates (ScreenPtr pScreen) { +#if !WIN_NEW_KEYBOARD_SUPPORT winScreenPriv(pScreen); DWORD dwKeyState; @@ -305,9 +551,11 @@ winSendKeyEvent (KEY_HKTG, TRUE); winSendKeyEvent (KEY_HKTG, FALSE); } +#endif } +#if !WIN_NEW_KEYBOARD_SUPPORT /* * Look for the lovely fake Control_L press/release generated by Windows * when AltGr is pressed/released on a non-U.S. keyboard. @@ -390,6 +638,7 @@ /* Not a fake control left press/release */ return FALSE; } +#endif /* WIN_NEW_KEYBOARD_SUPPORT */ /* @@ -397,8 +646,10 @@ */ void -winKeybdReleaseModifierKeys () +winKeybdReleaseKeys () { +#if !WIN_NEW_KEYBOARD_SUPPORT +#if 0 /* Old function that just pops modifiers */ /* Verify that the mi input system has been initialized */ if (g_fdMessageQueue == WIN_FD_INVALID) return; @@ -409,6 +660,20 @@ winSendKeyEvent (KEY_RCtrl, FALSE); winSendKeyEvent (KEY_ShiftL, FALSE); winSendKeyEvent (KEY_ShiftR, FALSE); +#else /* New function that pops all keys */ + int i; + + /* Verify that the mi input system has been initialized */ + if (g_fdMessageQueue == WIN_FD_INVALID) + return; + + /* Pop any pressed keys */ + for (i = 0; i < NUM_KEYCODES; ++i) + { + if (g_winKeyState[i]) winSendKeyEvent (i, FALSE); + } +#endif +#endif } @@ -422,6 +687,15 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) { xEvent xCurrentEvent; + + /* + * When alt-tabing between screens we can get phantom key up messages + * Here we only pass them through it we think we should! + */ + if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return; + + /* Update the keyState map */ + g_winKeyState[dwKey] = fDown; ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); Index: xc/programs/Xserver/hw/xwin/winkeybd.h diff -u xc/programs/Xserver/hw/xwin/winkeybd.h:1.1 xc/programs/Xserver/hw/xwin/winkeybd.h:1.3 --- xc/programs/Xserver/hw/xwin/winkeybd.h:1.1 Wed Sep 26 09:00:34 2001 +++ xc/programs/Xserver/hw/xwin/winkeybd.h Fri Jul 5 05:19:26 2002 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.h,v 1.1 2001/09/26 13:00:34 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.h,v 1.3 2002/07/05 09:19:26 alanh Exp $ */ /* * We need symbols for the scan codes of keys. @@ -42,6 +42,97 @@ */ #include "../xfree86/common/xf86Keymap.h" + +#if WIN_NEW_KEYBOARD_SUPPORT + +/* Define the keymap structure */ +typedef struct +{ + DWORD dwVirtualKey; + DWORD dwXKey; +} winKeymappingRec, *winKeymappingPtr; + +static const winKeymappingRec +winKeymap[] = { + {VK_BACK, XK_BackSpace}, + {VK_TAB, XK_Tab}, + {VK_CLEAR, XK_Clear}, + {VK_RETURN, XK_Return}, + {VK_LSHIFT, XK_Shift_L}, + {VK_RSHIFT, XK_Shift_R}, + {VK_SHIFT, XK_Shift_L}, + {VK_LCONTROL, XK_Control_L}, + {VK_RCONTROL, XK_Control_R}, + {VK_CONTROL, XK_Control_L}, + {VK_LMENU, XK_Alt_L}, + {VK_RMENU, XK_Alt_R}, + {VK_MENU, XK_Alt_L}, + {VK_PAUSE, XK_Pause}, + {VK_CAPITAL, XK_Caps_Lock}, + {VK_ESCAPE, XK_Escape}, + {VK_SPACE, XK_space}, + {VK_PRIOR, XK_Page_Up}, + {VK_NEXT, XK_Page_Down}, + {VK_END, XK_End}, + {VK_HOME, XK_Home}, + {VK_LEFT, XK_Left}, + {VK_UP, XK_Up}, + {VK_RIGHT, XK_Right}, + {VK_DOWN, XK_Down}, + {VK_SELECT, XK_Select}, + {VK_EXECUTE, XK_Execute}, + {VK_SNAPSHOT, XK_Print}, + {VK_INSERT, XK_Insert}, + {VK_DELETE, XK_Delete}, + {VK_HELP, XK_Help}, + {VK_NUMPAD0, XK_KP_0}, + {VK_NUMPAD1, XK_KP_1}, + {VK_NUMPAD2, XK_KP_2}, + {VK_NUMPAD3, XK_KP_3}, + {VK_NUMPAD4, XK_KP_4}, + {VK_NUMPAD5, XK_KP_5}, + {VK_NUMPAD6, XK_KP_6}, + {VK_NUMPAD7, XK_KP_7}, + {VK_NUMPAD8, XK_KP_8}, + {VK_NUMPAD9, XK_KP_9}, + {VK_MULTIPLY, XK_KP_Multiply}, + {VK_ADD, XK_KP_Add}, + {VK_SEPARATOR, XK_KP_Separator}, // often comma + {VK_SUBTRACT, XK_KP_Subtract}, + {VK_DECIMAL, XK_KP_Decimal}, + {VK_DIVIDE, XK_KP_Divide}, + {VK_F1, XK_F1}, + {VK_F2, XK_F2}, + {VK_F3, XK_F3}, + {VK_F4, XK_F4}, + {VK_F5, XK_F5}, + {VK_F6, XK_F6}, + {VK_F7, XK_F7}, + {VK_F8, XK_F8}, + {VK_F9, XK_F9}, + {VK_F10, XK_F10}, + {VK_F11, XK_F11}, + {VK_F12, XK_F12}, + {VK_F13, XK_F13}, + {VK_F14, XK_F14}, + {VK_F15, XK_F15}, + {VK_F16, XK_F16}, + {VK_F17, XK_F17}, + {VK_F18, XK_F18}, + {VK_F19, XK_F19}, + {VK_F20, XK_F20}, + {VK_F21, XK_F21}, + {VK_F22, XK_F22}, + {VK_F23, XK_F23}, + {VK_F24, XK_F24}, + {VK_NUMLOCK, XK_Num_Lock}, + {VK_SCROLL, XK_Scroll_Lock} +}; + +static int g_winKeymapEntries = sizeof (winKeymap) / sizeof (winKeymappingRec); + +#else /* WIN_NEW_KEYBOARD_SUPPORT */ + #define WIN_KEYMAP_COLS 3 const int @@ -63,7 +154,7 @@ /* 13 */ VK_RETURN, 0, KEY_KP_Enter, /* 14 */ 0, 0, 0, /* 15 */ 0, 0, 0, - /* 16 */ VK_SHIFT, 0, KEY_ShiftR, + /* 16 */ VK_SHIFT, KEY_ShiftL, KEY_ShiftR, /* 17 */ VK_CONTROL, 0, KEY_RCtrl, /* 18 */ VK_MENU, 0, KEY_AltLang, /* 19 */ VK_PAUSE, KEY_Pause, 0, @@ -304,3 +395,4 @@ /* 254 */ 0, 0, 0, /* 255 */ 0, 0, 0 }; +#endif /* WIN_NEW_KEYBOARD_SUPPORT */ Index: xc/programs/Xserver/hw/xwin/winlayer.c diff -u xc/programs/Xserver/hw/xwin/winlayer.c:1.6 xc/programs/Xserver/hw/xwin/winlayer.c:1.9 --- xc/programs/Xserver/hw/xwin/winlayer.c:1.6 Thu Aug 16 04:23:36 2001 +++ xc/programs/Xserver/hw/xwin/winlayer.c Thu Oct 31 18:04:39 2002 @@ -27,11 +27,11 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winlayer.c,v 1.6 2001/08/16 08:23:36 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winlayer.c,v 1.9 2002/10/31 23:04:39 alanh Exp $ */ #include "win.h" - +#if WIN_LAYER_SUPPORT /* * Create initial layer. Cygwin only needs one initial layer. */ @@ -44,8 +44,8 @@ PixmapPtr pPixmap = NULL; DWORD dwLayerKind; - ErrorF ("winLayerCreate () - dwDepth %d\n", - pScreenInfo->dwDepth); + ErrorF ("winLayerCreate - dwDepth: %d dwBPP %d\n", + pScreenInfo->dwDepth, pScreenInfo->dwBPP); /* We only need a single layer kind: shadow */ dwLayerKind = LAYER_SHADOW; @@ -53,7 +53,7 @@ return LayerCreate (pScreen, dwLayerKind, - pScreenInfo->dwDepth, + pScreenInfo->dwBPP, pPixmap, pScreenPriv->pwinShadowUpdate, NULL, /* No ShadowWindowProc */ @@ -61,7 +61,7 @@ 0); } -#ifdef RANDR + /* * Used as a function parameter to WalkTree. */ @@ -98,7 +98,7 @@ return WT_WALKCHILDREN; } - +#ifdef RANDR /* * Answer queries about the RandR features supported. */ @@ -109,8 +109,6 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; int n; - RRVisualGroupPtr pVisualGroup; - RRGroupOfVisualGroupPtr pGroupOfVisualGroup = NULL; Rotation rotateKind; RRScreenSizePtr pSize; @@ -119,52 +117,15 @@ /* Don't support rotations, yet */ *pRotations = RR_Rotate_0; /* | RR_Rotate_90 | RR_Rotate_180 | ... */ +#if 0 /* Check for something naughty. Don't know what exactly... */ for (n = 0; n < pScreen->numDepths; n++) if (pScreen->allowedDepths[n].numVids) break; if (n == pScreen->numDepths) - return FALSE; - - /* Create an RandR visual group */ - pVisualGroup = RRCreateVisualGroup (pScreen); - if (!pVisualGroup) return FALSE; +#endif - - /* Not sure what this does */ - if (!RRAddDepthToVisualGroup (pScreen, - pVisualGroup, - &pScreen->allowedDepths[n])) - { - RRDestroyVisualGroup (pScreen, pVisualGroup); - return FALSE; - } - - /* Register the RandR visual group */ - pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup); - if (!pVisualGroup) - return FALSE; - - pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, - pGroupOfVisualGroup); - - /* You have to be kidding */ - if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen, - pGroupOfVisualGroup, - pVisualGroup)) - { - RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - /* pVisualGroup left until screen closed */ - return FALSE; - } - - /* I can't afford a clue */ - pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, - pGroupOfVisualGroup); - if (!pGroupOfVisualGroup) - return FALSE; - /* * Register supported sizes. This can be called many times, but * we only support one size for now. @@ -173,14 +134,13 @@ pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwWidth_mm, - pScreenInfo->dwHeight_mm, - pGroupOfVisualGroup); + pScreenInfo->dwHeight_mm); /* Only one allowed rotation for now */ rotateKind = RR_Rotate_0; - + /* Tell RandR what the current config is */ - RRSetCurrentConfig (pScreen, rotateKind, pSize, pVisualGroup); + RRSetCurrentConfig (pScreen, rotateKind, pSize); return TRUE; } @@ -193,8 +153,7 @@ Bool winRandRSetConfig (ScreenPtr pScreen, Rotation rotateKind, - RRScreenSizePtr pSize, - RRVisualGroupPtr pVisualGroup) + RRScreenSizePtr pSize) { ErrorF ("winRandRSetConfig ()\n"); @@ -233,4 +192,5 @@ return TRUE; } +#endif #endif Index: xc/programs/Xserver/hw/xwin/winmisc.c diff -u xc/programs/Xserver/hw/xwin/winmisc.c:1.5 xc/programs/Xserver/hw/xwin/winmisc.c:1.6 --- xc/programs/Xserver/hw/xwin/winmisc.c:1.5 Sun Nov 11 17:45:57 2001 +++ xc/programs/Xserver/hw/xwin/winmisc.c Fri Jul 5 05:19:26 2002 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.5 2001/11/11 22:45:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.6 2002/07/05 09:19:26 alanh Exp $ */ #include "win.h" @@ -42,7 +42,7 @@ winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, unsigned short *pHeight, ScreenPtr pScreen) { - ErrorF ("winQueryBestSize()\n"); + ErrorF ("winQueryBestSizeNativeGDI\n"); } @@ -79,16 +79,16 @@ pScreenInfo->pfb = pbits; /* Update the screen pixmap */ - if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, - pScreen->width, - pScreen->height, - pScreen->rootDepth, - BitsPerPixel (pScreen->rootDepth), - PixmapBytePad (pScreenInfo->dwStride, - pScreenInfo->dwDepth), - pScreenInfo->pfb)) + if (!(*pScreen->ModifyPixmapHeader) (pScreen->devPrivate, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + BitsPerPixel (pScreen->rootDepth), + PixmapBytePad (pScreenInfo->dwStride, + pScreenInfo->dwBPP), + pScreenInfo->pfb)) { - FatalError ("winUpdateFramebufferPointer () - Failed modifying "\ + FatalError ("winUpdateFramebufferPointer - Failed modifying "\ "screen pixmap\n"); } Index: xc/programs/Xserver/hw/xwin/winmsg.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winmsg.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winmsg.c Thu Oct 17 04:18:22 2002 @@ -0,0 +1,119 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Alexander Gottwald + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmsg.c,v 1.1 2002/10/17 08:18:22 alanh Exp $ */ + +#include "win.h" +#include "winmsg.h" +#include <stdarg.h> + +#ifndef VERBOSE_LEVEL +#define VERBOSE_LEVEL 4 +#endif + + +void winVMsg (int, MessageType, int verb, const char *, va_list); + + +void +winVMsg (int scrnIndex, MessageType type, int verb, const char *format, + va_list ap) +{ + const char *prefix = NULL; + + if (verb && verb > VERBOSE_LEVEL) + return; + +#undef __msg +#define __msg(name,string) case name: prefix = string; break; +#undef _msg +#define _msg(name,string) __msg(name,string) + switch (type) + { + MESSAGE_STRINGS default:prefix = NULL; + break; + } +#undef __msg +#undef _msg + + if (prefix != NULL) + ErrorF ("%s ", prefix); + VErrorF (format, ap); +} + + +void +winDrvMsg (int scrnIndex, MessageType type, const char *format, ...) +{ + va_list ap; + va_start (ap, format); + winVMsg (scrnIndex, type, 0, format, ap); + va_end (ap); +} + + +void +winMsg (MessageType type, const char *format, ...) +{ + va_list ap; + va_start (ap, format); + winVMsg (0, type, 0, format, ap); + va_end (ap); +} + + +void +winDrvMsgVerb (int scrnIndex, MessageType type, int verb, const char *format, + ...) +{ + va_list ap; + va_start (ap, format); + winVMsg (scrnIndex, type, verb, format, ap); + va_end (ap); +} + + +void +winMsgVerb (MessageType type, int verb, const char *format, ...) +{ + va_list ap; + va_start (ap, format); + winVMsg (0, type, verb, format, ap); + va_end (ap); +} + + +void +winErrorFVerb (int verb, const char *format, ...) +{ + va_list ap; + va_start (ap, format); + winVMsg (0, X_NONE, verb, format, ap); + va_end (ap); +} Index: xc/programs/Xserver/hw/xwin/winmsg.h diff -u /dev/null xc/programs/Xserver/hw/xwin/winmsg.h:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winmsg.h Thu Oct 17 04:18:22 2002 @@ -0,0 +1,72 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Alexander Gottwald + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmsg.h,v 1.1 2002/10/17 08:18:22 alanh Exp $ */ + +#ifndef __WIN_MSG_H__ +#define __WIN_MSG_H__ + + +#define __msg_name(name,string) name +#define __msg(name,string) __msg_name(name,string) +#define _msg(name,string) __msg(name,string), + +#define MESSAGE_STRINGS \ + _msg(X_PROBED,"(--)" /* Value was probed */)\ + _msg(X_CONFIG,"(**)" /* Value was given in the config file */)\ + _msg(X_DEFAULT,"(==)" /* Value is a default */)\ + _msg(X_CMDLINE,"(++)" /* Value was given on the command line */)\ + _msg(X_NOTICE,"(!!)" /* Notice */) \ + _msg(X_ERROR,"(EE)" /* Error message */) \ + _msg(X_WARNING,"(WW)" /* Warning message */) \ + _msg(X_INFO,"(II)" /* Informational message */) \ + _msg(X_UNKNOWN,"(?""?)" /* Unknown, trigraph fix */) \ + _msg(X_NONE,NULL /* No prefix */) \ + __msg(X_NOT_IMPLEMENTED,"(NI)" /* Not implemented */) + +typedef enum +{ + MESSAGE_STRINGS +} +MessageType; + + +/* + * Function prototypes + */ + +void winDrvMsgVerb (int scrnIndex, + MessageType type, int verb, const char *format, ...); +void winDrvMsg (int scrnIndex, MessageType type, const char *format, ...); +void winMsgVerb (MessageType type, int verb, const char *format, ...); +void winMsg (MessageType type, const char *format, ...); + +void winErrorFVerb (int verb, const char *format, ...); + +#endif Index: xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c:1.1 --- /dev/null Thu Feb 27 12:33:54 2003 +++ xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,1574 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Kensuke Matsuzaki + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +#include "win.h" +#include "dixevents.h" + + +/* + * Prototypes for local functions + */ + +static void +winCreateWindowsWindow (WindowPtr pWin); + +static void +winDestroyWindowsWindow (WindowPtr pWin); + +static void +winUpdateWindowsWindow (WindowPtr pWin); + +static XID +winGetWindowID (WindowPtr pWin); + +static void +SendConfigureNotify (WindowPtr pWin); + +static +void +winUpdateRgn (WindowPtr pWindow); + +#ifdef SHAPE +static +void +winReshape (WindowPtr pWin); +#endif + + +/* + * Local globals + */ + +static UINT s_nIDPollingMouse = 2; + +#if 0 +static BOOL s_fMoveByX = FALSE; +#endif + + +/* + * Constant defines + */ + + +#define MOUSE_POLLING_INTERVAL 500 +#define WIN_MULTIWINDOW_SHAPE YES + +/* + * Macros + */ + +#define SubSend(pWin) \ + ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask) + +#define StrSend(pWin) \ + ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask) + +#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent)) + + +/* + * CreateWindow - See Porting Layer Definition - p. 37 + */ + +Bool +winCreateWindowMultiWindow (WindowPtr pWin) +{ + Bool fResult = TRUE; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winCreateWindowMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped CreateWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->CreateWindow) + fResult = winGetScreenPriv(pWin->drawable.pScreen)->CreateWindow (pWin); + + /* Initialize some privates values */ + pWinPriv->hRgn = NULL; + pWinPriv->hWnd = NULL; + pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen); + pWinPriv->fXKilled = FALSE; + + return fResult; +} + + +/* + * DestroyWindow - See Porting Layer Definition - p. 37 + */ + +Bool +winDestroyWindowMultiWindow (WindowPtr pWin) +{ + Bool fResult = TRUE; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winDestroyWindowMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped DestroyWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->DestroyWindow) + fResult = winGetScreenPriv(pWin->drawable.pScreen)->DestroyWindow (pWin); + + /* Flag that the window has been destroyed */ + pWinPriv->fXKilled = TRUE; + + /* Kill the MS Windows window associated with this window */ + winDestroyWindowsWindow (pWin); + + return fResult; +} + + +/* + * PositionWindow - See Porting Layer Definition - p. 37 + */ + +Bool +winPositionWindowMultiWindow (WindowPtr pWin, int x, int y) +{ + Bool fResult = TRUE; + int iX, iY, iWidth, iHeight, iBorder; + winWindowPriv(pWin); + HWND hWnd = pWinPriv->hWnd; + RECT rcNew; + RECT rcOld; +#if CYGMULTIWINDOW_DEBUG + RECT rcClient; + RECT *lpRc; +#endif + DWORD dwExStyle; + DWORD dwStyle; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winPositionWindowMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped PositionWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->PositionWindow) + fResult = winGetScreenPriv(pWin->drawable.pScreen)->PositionWindow (pWin, x, y); + + /* Bail out if the Windows window handle is bad */ + if (!hWnd) + return fResult; + + /* Get the Windows window style and extended style */ + dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE); + dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE); + + /* Get the width of the X window border */ + iBorder = wBorderWidth (pWin); + + /* Get the X and Y location of the X window */ + iX = pWin->drawable.x; + iY = pWin->drawable.y; + + /* Get the height and width of the X window */ + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Store the origin, height, and width in a rectangle structure */ + SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight); + +#if CYGMULTIWINDOW_DEBUG + lpRc = &rcNew; + ErrorF ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n", + GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom); +#endif + + /* + * Calculate the required size of the Windows window rectangle, + * given the size of the Windows window client area. + */ + AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle); + + /* Get a rectangle describing the old Windows window */ + GetWindowRect (hWnd, &rcOld); + +#if CYGMULTIWINDOW_DEBUG + /* Get a rectangle describing the Windows window client area */ + GetClientRect (hWnd, &rcClient); + + lpRc = &rcNew; + ErrorF ("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n", + GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom); + + lpRc = &rcOld; + ErrorF ("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n", + GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom); + + lpRc = &rcClient; + ErrorF ("(%d ms)rcClient (%d, %d)-(%d, %d)\n", + GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom); +#endif + + /* Check if the old rectangle and new rectangle are the same */ + if (!EqualRect (&rcNew, &rcOld)) + { +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winPositionWindowMultiWindow - Need to move\n"); +#endif + + /* Change the position and dimensions of the Windows window */ + MoveWindow (hWnd, + rcNew.left, rcNew.top, + rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, + TRUE); + } + else + { +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winPositionWindowMultiWindow - Not need to move\n"); +#endif + } + + return fResult; +} + + +/* + * ChangeWindowAttributes - See Porting Layer Definition - p. 37 + */ + +Bool +winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask) +{ + Bool fResult = TRUE; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped ChangeWindowAttributes function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->ChangeWindowAttributes) + fResult = winGetScreenPriv(pWin->drawable.pScreen)->ChangeWindowAttributes (pWin, mask); + + /* + * NOTE: We do not currently need to do anything here. + */ + + return fResult; +} + + +/* + * UnmapWindow - See Porting Layer Definition - p. 37 + * Also referred to as UnrealizeWindow + */ + +Bool +winUnmapWindowMultiWindow (WindowPtr pWin) +{ + Bool fResult = TRUE; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped UnrealizeWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->UnrealizeWindow) + fResult = winGetScreenPriv(pWin->drawable.pScreen)->UnrealizeWindow (pWin); + + /* Flag that the window has been killed */ + pWinPriv->fXKilled = TRUE; + + /* Destroy the Windows window associated with this X window */ + winDestroyWindowsWindow (pWin); + + return fResult; +} + + +/* + * MapWindow - See Porting Layer Definition - p. 37 + * Also referred to as RealizeWindow + */ + +Bool +winMapWindowMultiWindow (WindowPtr pWin) +{ + Bool fResult = TRUE; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winMapWindowMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped RealizeWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->RealizeWindow) + fResult = winGetScreenPriv(pWin->drawable.pScreen)->RealizeWindow (pWin); + + /* Flag that this window has not been destroyed */ + pWinPriv->fXKilled = FALSE; + + /* Refresh/redisplay the Windows window associated with this X window */ + winUpdateWindowsWindow (pWin); + +#if WIN_MULTIWINDOW_SHAPE + winReshape (pWin); + winUpdateRgn (pWin); +#endif + + return fResult; +} + + +/* + * ReparentWindow - See Porting Layer Definition - p. 42 + */ + +void +winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent) +{ +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winReparentMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped ReparentWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->ReparentWindow) + winGetScreenPriv(pWin->drawable.pScreen)->ReparentWindow (pWin, + pPriorParent); + + /* Update the Windows window associated with this X window */ + winUpdateWindowsWindow (pWin); +} + + +/* + * RestackWindow - Shuffle the z-order of a window + */ + +void +winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) +{ + WindowPtr pPrevWin; + UINT uFlags; + HWND hInsertAfter; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winRestackMultiWindow - %08x\n", pWin); +#endif + + /* Call any wrapped RestackWindow function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->RestackWindow) + winGetScreenPriv(pWin->drawable.pScreen)->RestackWindow (pWin, + pOldNextSib); + + /* Bail out if no window privates or window handle is invalid */ + if (!pWinPriv || !pWinPriv->hWnd) + return; + + /* Get a pointer to our previous sibling window */ + pPrevWin = pWin->prevSib; + + /* + * Look for a sibling window with + * valid privates and window handle + */ + while (pPrevWin + && !winGetWindowPriv(pPrevWin) + && !winGetWindowPriv(pPrevWin)->hWnd) + pPrevWin = pPrevWin->prevSib; + + /* Check if we found a valid sibling */ + if (pPrevWin) + { + /* Valid sibling - get handle to insert window after */ + hInsertAfter = winGetWindowPriv(pPrevWin)->hWnd; + uFlags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; + } + else + { + /* No valid sibling - make this window the top window */ + hInsertAfter = HWND_TOP; + uFlags = SWP_NOMOVE | SWP_NOSIZE; + } + + /* Perform the restacking operation in Windows */ + SetWindowPos (pWinPriv->hWnd, + hInsertAfter, + 0, 0, + 0, 0, + uFlags); +} + + +/* + * SetShape - See Porting Layer Definition - p. 42 + */ + +#ifdef SHAPE +void +winSetShapeMultiWindow (WindowPtr pWin) +{ +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winSetShapeMultiWindow - pWin: %08x\n", pWin); +#endif + + /* Call any wrapped SetShape function */ + if (winGetScreenPriv(pWin->drawable.pScreen)->SetShape) + winGetScreenPriv(pWin->drawable.pScreen)->SetShape (pWin); + + /* + * NOTE: We do not currently do anything here. + */ + +#if WIN_MULTIWINDOW_SHAPE + winReshape (pWin); + winUpdateRgn (pWin); +#endif + + return; +} +#endif + + +/* + * winUpdateRgn - Local function to update a Windows window region + */ + +static +void +winUpdateRgn (WindowPtr pWin) +{ +#if 1 + SetWindowRgn (winGetWindowPriv(pWin)->hWnd, + winGetWindowPriv(pWin)->hRgn, TRUE); +#endif +} + + +/* + * winReshape - Computes the composite clipping region for a window + */ + +#ifdef SHAPE +static +void +winReshape (WindowPtr pWin) +{ + int nRects; + ScreenPtr pScreen = pWin->drawable.pScreen; + RegionRec rrNewShape; + BoxPtr pShape, pRects, pEnd; + HRGN hRgn, hRgnRect; + winWindowPriv(pWin); + +#if CYGDEBUG + ErrorF ("winReshape ()\n"); +#endif + + /* Bail if the window is the root window */ + if (pWin->parent == NULL) + return; + + /* Bail if the window is not top level */ + if (pWin->parent->parent != NULL) + return; + + /* Bail if Windows window handle is invalid */ + if (pWinPriv->hWnd == NULL) + return; + + /* Free any existing window region stored in the window privates */ + if (pWinPriv->hRgn != NULL) + { + DeleteObject (pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + /* Bail if the window has no bounding region defined */ + if (!wBoundingShape (pWin)) + return; + + REGION_INIT(pScreen, &rrNewShape, NullBox, 0); + REGION_COPY(pScreen, &rrNewShape, wBoundingShape(pWin)); + REGION_TRANSLATE(pScreen, + &rrNewShape, + pWin->borderWidth, + pWin->borderWidth); + + nRects = REGION_NUM_RECTS(&rrNewShape); + pShape = REGION_RECTS(&rrNewShape); + + /* Don't do anything if there are no rectangles in the region */ + if (nRects > 0) + { + RECT rcClient; + RECT rcWindow; + int iOffsetX, iOffsetY; + + /* Get client rectangle */ + if (!GetClientRect (pWinPriv->hWnd, &rcClient)) + { + ErrorF ("winReshape - GetClientRect failed, bailing: %d\n", + GetLastError ()); + return; + } + + /* Translate client rectangle coords to screen coords */ + /* NOTE: Only transforms top and left members */ + ClientToScreen (pWinPriv->hWnd, (LPPOINT) &rcClient); + + /* Get window rectangle */ + if (!GetWindowRect (pWinPriv->hWnd, &rcWindow)) + { + ErrorF ("winReshape - GetWindowRect failed, bailing: %d\n", + GetLastError ()); + return; + } + + /* Calculate offset from window upper-left to client upper-left */ + iOffsetX = rcClient.left - rcWindow.left; + iOffsetY = rcClient.top - rcWindow.top; + + /* Create initial Windows region for title bar */ + /* FIXME: Mean, nasty, ugly hack!!! */ + hRgn = CreateRectRgn (0, 0, rcWindow.right, iOffsetY); + if (hRgn == NULL) + { + ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) " + "failed: %d\n", + 0, 0, rcWindow.right, iOffsetY, GetLastError ()); + } + + /* Loop through all rectangles in the X region */ + for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) + { + /* Create a Windows region for the X rectangle */ + hRgnRect = CreateRectRgn (pRects->x1 + iOffsetX - 1, + pRects->y1 + iOffsetY - 1, + pRects->x2 + iOffsetX - 1, + pRects->y2 + iOffsetY - 1); + if (hRgnRect == NULL) + { + ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) " + "failed: %d\n" + "\tx1: %d x2: %d xOff: %d y1: %d y2: %d yOff: %d\n", + pRects->x1 + iOffsetX - 1, + pRects->y1 + iOffsetY - 1, + pRects->x2 + iOffsetX - 1, + pRects->y2 + iOffsetY - 1, + GetLastError (), + pRects->x1, pRects->x2, iOffsetX, + pRects->y1, pRects->y2, iOffsetY); + } + + /* Merge the Windows region with the accumulated region */ + if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) + { + ErrorF ("winReshape - CombineRgn () failed: %d\n", + GetLastError ()); + } + + /* Delete the temporary Windows region */ + DeleteObject (hRgnRect); + } + + /* Save a handle to the composite region in the window privates */ + pWinPriv->hRgn = hRgn; + } + + REGION_UNINIT(pScreen, &rrNewShape); + + return; +} +#endif + + +/* + * winTopLevelWindowProc - Window procedure for all top-level Windows windows. + */ + +LRESULT CALLBACK +winTopLevelWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + POINT ptMouse; + HDC hdcUpdate; + PAINTSTRUCT ps; + WindowPtr pWin = NULL; + winPrivWinPtr pWinPriv = NULL; + ScreenPtr s_pScreen = NULL; + winPrivScreenPtr s_pScreenPriv = NULL; + winScreenInfo *s_pScreenInfo = NULL; + HWND hwndScreen = NULL; + DrawablePtr pDraw = NULL; + int iX, iY, iWidth, iHeight, iBorder; + winWMMessageRec wmMsg; + static Bool s_fTracking = FALSE; + static Bool s_fCursor = TRUE; + + /* Check if the Windows window property for our X window pointer is valid */ + if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL) + { + /* Our X window pointer is valid */ + + /* Get pointers to the drawable and the screen */ + pDraw = &pWin->drawable; + s_pScreen = pWin->drawable.pScreen; + + /* Get a pointer to our window privates */ + pWinPriv = winGetWindowPriv(pWin); + + /* Get pointers to our screen privates and screen info */ + s_pScreenPriv = pWinPriv->pScreenPriv; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + + /* Get the handle for our screen-sized window */ + /* NOTE: This will be going away at some point, right? Harold Hunt - 2003/01/15 */ + hwndScreen = s_pScreenPriv->hwndScreen; + + /* */ + wmMsg.msg = 0; + wmMsg.hwndWindow = hwnd; + wmMsg.iWindow = (Window)GetProp (hwnd, WIN_WID_PROP); + +#if 1 + wmMsg.iX = pWinPriv->iX; + wmMsg.iY = pWinPriv->iY; + wmMsg.iWidth = pWinPriv->iWidth; + wmMsg.iHeight = pWinPriv->iHeight; +#else + wmMsg.iX = pDraw.x; + wmMsg.iY = pDraw.y; + wmMsg.iWidth = pDraw.width; + wmMsg.iHeight = pDraw.height; +#endif + + +#if 0 + /* + * Print some debugging information + */ + + ErrorF ("hWnd %08X\n", hwnd); + ErrorF ("pWin %08X\n", pWin); + ErrorF ("pDraw %08X\n", pDraw); + ErrorF ("\ttype %08X\n", pWin->drawable.type); + ErrorF ("\tclass %08X\n", pWin->drawable.class); + ErrorF ("\tdepth %08X\n", pWin->drawable.depth); + ErrorF ("\tbitsPerPixel %08X\n", pWin->drawable.bitsPerPixel); + ErrorF ("\tid %08X\n", pWin->drawable.id); + ErrorF ("\tx %08X\n", pWin->drawable.x); + ErrorF ("\ty %08X\n", pWin->drawable.y); + ErrorF ("\twidth %08X\n", pWin->drawable.width); + ErrorF ("\thenght %08X\n", pWin->drawable.height); + ErrorF ("\tpScreen %08X\n", pWin->drawable.pScreen); + ErrorF ("\tserialNumber %08X\n", pWin->drawable.serialNumber); + ErrorF ("g_iWindowPrivateIndex %d\n", g_iWindowPrivateIndex); + ErrorF ("pWinPriv %08X\n", pWinPriv); + ErrorF ("s_pScreenPriv %08X\n", s_pScreenPriv); + ErrorF ("s_pScreenInfo %08X\n", s_pScreenInfo); + ErrorF ("hwndScreen %08X\n", hwndScreen); +#endif + } + + + + /* Branch on message type */ + switch (message) + { + case WM_CREATE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_CREATE\n"); +#endif + + /* */ + SetProp (hwnd, + WIN_WINDOW_PROP, + (HANDLE)((LPCREATESTRUCT) lParam)->lpCreateParams); + + /* */ + SetProp (hwnd, + WIN_WID_PROP, + (HANDLE)winGetWindowID (((LPCREATESTRUCT) lParam)->lpCreateParams)); + return 0; + + case WM_PAINT: + /* Only paint if our window handle is valid */ + if (hwndScreen == NULL) + break; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (hwnd, &ps); + +#if 0 + /* NOTE: Doesn't appear to be used - Harold Hunt - 2003/01/15 */ + /* Get the dimensions of the client area */ + GetClientRect (hwnd, &rcClient); +#endif + + /* Get the position and dimensions of the window */ + iBorder = wBorderWidth (pWin); + iX = pWin->drawable.x; + iY = pWin->drawable.y; + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Try to copy from the shadow buffer */ + if (!BitBlt (hdcUpdate, + 0, 0, + iWidth, iHeight, + s_pScreenPriv->hdcShadow, + iX, iY, + SRCCOPY)) + { + LPVOID lpMsgBuf; + + /* Display a fancy error message */ + FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError (), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, NULL); + + ErrorF ("winTopLevelWindowProc - BitBlt failed: %s\n", + (LPSTR)lpMsgBuf); + LocalFree (lpMsgBuf); + } + + /* EndPaint frees the DC */ + EndPaint (hwndScreen, &ps); + return 0; + + +#if 1 + case WM_MOUSEMOVE: + /* Unpack the client area mouse coordinates */ + ptMouse.x = GET_X_LPARAM(lParam); + ptMouse.y = GET_Y_LPARAM(lParam); + + /* Translate the client area mouse coordinates to screen coordinates */ + ClientToScreen (hwnd, &ptMouse); + + /* We can't do anything without privates */ + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* Has the mouse pointer crossed screens? */ + if (s_pScreen != miPointerCurrentScreen ()) + miPointerSetNewScreen (s_pScreenInfo->dwScreen, + ptMouse.x - s_pScreenInfo->dwXOffset, + ptMouse.y - s_pScreenInfo->dwYOffset); + + /* Are we tracking yet? */ + if (!s_fTracking) + { + TRACKMOUSEEVENT tme; + + /* Setup data structure */ + ZeroMemory (&tme, sizeof (tme)); + tme.cbSize = sizeof (tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = hwnd; + + /* Call the tracking function */ + if (!(*g_fpTrackMouseEvent) (&tme)) + ErrorF ("winTopLevelWindowProc - _TrackMouseEvent failed\n"); + + /* Flag that we are tracking now */ + s_fTracking = TRUE; + } + + /* Hide or show the Windows mouse cursor */ + if (s_fCursor) + { + /* Hide Windows cursor */ + s_fCursor = FALSE; + ShowCursor (FALSE); + KillTimer (hwnd, s_nIDPollingMouse); + } + + /* Deliver absolute cursor position to X Server */ + miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset, + ptMouse.y - s_pScreenInfo->dwYOffset, + g_c32LastInputEventTime = GetTickCount ()); + return 0; + + case WM_NCMOUSEMOVE: + /* + * We break instead of returning 0 since we need to call + * DefWindowProc to get the mouse cursor changes + * and min/max/close button highlighting in Windows XP. + * The Platform SDK says that you should return 0 if you + * process this message, but it fails to mention that you + * will give up any default functionality if you do return 0. + */ + + /* We can't do anything without privates */ + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* Non-client mouse movement, show Windows cursor */ + if (!s_fCursor) + { + s_fCursor = TRUE; + ShowCursor (TRUE); + SetTimer (hwnd, s_nIDPollingMouse, MOUSE_POLLING_INTERVAL, NULL); + } + break; + + case WM_MOUSELEAVE: + /* Mouse has left our client area */ + + /* Flag that we are no longer tracking */ + s_fTracking = FALSE; + + /* Show the mouse cursor, if necessary */ + if (!s_fCursor) + { + s_fCursor = TRUE; + ShowCursor (TRUE); + SetTimer (hwnd, s_nIDPollingMouse, MOUSE_POLLING_INTERVAL, NULL); + } + return 0; + + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); + + case WM_LBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); + + case WM_MBUTTONDBLCLK: + case WM_MBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); + + case WM_MBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); + + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); + + case WM_RBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); + +#else + + case WM_MOUSEMOVE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_MOUSEMOVE*\n"); +#endif + + /* Unpack the client area mouse coordinates */ + ptMouse.x = GET_X_LPARAM(lParam); + ptMouse.y = GET_Y_LPARAM(lParam); + + /* Translate the client area mouse coordinates to screen coordinates */ + ClientToScreen (hwnd, &ptMouse); + + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, MAKELONG(ptMouse.x, ptMouse.y)); + return 0; + + case WM_NCMOUSEMOVE: + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_MBUTTONDBLCLK: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_MOUSELEAVE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_*BUTTON*\n"); +#endif + + /* Pass the message to the root window */ + SendMessage(hwndScreen, message, wParam, MAKELONG(ptMouse.x, ptMouse.y)); + return 0; +#endif + + case WM_MOUSEWHEEL: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_MOUSEWHEEL\n"); +#endif + + /* Pass the message to the root window */ + SendMessage(hwndScreen, message, wParam, lParam); + return 0; + + case WM_SYSKEYDOWN: + case WM_SYSKEYUP: + case WM_SYSDEADCHAR: + case WM_KEYDOWN: + case WM_KEYUP: + case WM_DEADCHAR: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_*KEY*\n"); +#endif + + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, lParam); + return 0; + + case WM_HOTKEY: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_HOTKEY\n"); +#endif + + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, lParam); + return 0; + + +#if 1 + case WM_ACTIVATE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_ACTIVATE\n"); +#endif + + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, lParam); + + /* Bail if inactivating */ + if (LOWORD(wParam) == WA_INACTIVE) + return 0; + + /* Check if the current window is the active window in Windows */ + if (GetActiveWindow () == hwnd) + { + /* Tell our Window Manager thread to raise the window */ + wmMsg.msg = WM_WM_RAISE; + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + } + + /* Tell our Window Manager thread to activate the window */ + wmMsg.msg = WM_WM_ACTIVATE; + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + + return 0; + + case WM_ACTIVATEAPP: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_ACTIVATEAPP\n"); +#endif + + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, lParam); + return 0; +#endif + + + case WM_CLOSE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_CLOSE\n"); +#endif + /* Branch on if the window was killed in X already */ + if (pWinPriv->fXKilled) + { + /* Window was killed, go ahead and destroy the window */ + DestroyWindow (hwnd); + } + else + { + /* Tell our Window Manager thread to kill the window */ + wmMsg.msg = WM_WM_KILL; + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + } + return 0; + + case WM_DESTROY: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_DESTROY\n"); +#endif + + /* Branch on if the window was killed in X already */ + if (pWinPriv && !pWinPriv->fXKilled) + { + ErrorF ("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n"); + + /* Tell our Window Manager thread to kill the window */ + wmMsg.msg = WM_WM_KILL; + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_DESTROY\n"); +#endif + break; + + case WM_MOVE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_MOVE - %d ms\n", GetTickCount ()); +#endif + + /* Bail if Windows window is not actually moving */ + if (pWinPriv->iX == (short) LOWORD(lParam) + && pWinPriv->iY == (short) HIWORD(lParam)) + break; + + /* Get new position */ + pWinPriv->iX = (short) LOWORD(lParam); + pWinPriv->iY = (short) HIWORD(lParam); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\t(%d, %d)\n", pWinPriv->iX, pWinPriv->iY); +#endif + + /* Notify the X client that its window is moving */ + if (SubStrSend(pWin, pWin->parent)) + SendConfigureNotify (pWin); + + /* Tell X that the window is moving */ + (s_pScreen->MoveWindow) (pWin, + (int)(short) LOWORD(lParam) - wBorderWidth (pWin), + (int)(short) HIWORD(lParam) - wBorderWidth (pWin), + pWin->nextSib, + VTMove); + return 0; + + case WM_SHOWWINDOW: + /* Bail out if the window is being hidden */ + if (!wParam) + return 0; + + /* Tell X to map the window */ + MapWindow (pWin, wClient(pWin)); + + /* */ + if (!pWin->overrideRedirect) + { + DWORD dwExStyle; + DWORD dwStyle; + RECT rcNew; + int iDx, iDy; + + /* Flag that this window needs to be made active when clicked */ + SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); + + /* Get the standard and extended window style information */ + dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE); + dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE); + + /* */ + if (dwExStyle != WS_EX_APPWINDOW) + { + /* Setup a rectangle with the X window position and size */ + SetRect (&rcNew, + pWinPriv->iX, + pWinPriv->iY, + pWinPriv->iX + pWinPriv->iWidth, + pWinPriv->iY + pWinPriv->iHeight); + +#if 0 + ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n", + rcNew.left, rcNew.top, + rcNew.right, rcNew.bottom); +#endif + + /* */ + AdjustWindowRectEx (&rcNew, + WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW, + FALSE, + WS_EX_APPWINDOW); + + /* Calculate position deltas */ + iDx = pWinPriv->iX - rcNew.left; + iDy = pWinPriv->iY - rcNew.top; + + /* Calculate new rectangle */ + rcNew.left += iDx; + rcNew.right += iDx; + rcNew.top += iDy; + rcNew.bottom += iDy; + +#if 0 + ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n", + rcNew.left, rcNew.top, + rcNew.right, rcNew.bottom); +#endif + + /* Set the window extended style flags */ + SetWindowLongPtr (hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW); + + /* Set the window standard style flags */ + SetWindowLongPtr (hwnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW); + + /* Positon the Windows window */ + SetWindowPos (hwnd, HWND_TOP, + rcNew.left, rcNew.top, + rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, + SWP_NOMOVE | SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE); + + /* Bring the Window window to the foreground */ + SetForegroundWindow (hwnd); + } + } + + /* Setup the Window Manager message */ + wmMsg.msg = WM_WM_MAP; + wmMsg.iWidth = pWinPriv->iWidth; + wmMsg.iHeight = pWinPriv->iHeight; + + /* Tell our Window Manager thread to map the window */ + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + + /* Setup the Window Manager message */ + wmMsg.msg = WM_WM_RAISE; + + /* Tell our Window Manager thread to raise the window */ + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + return 0; + + case WM_SIZE: + /* see dix/window.c */ + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_SIZE - %d ms\n", GetTickCount ()); +#endif + + switch (wParam) + { + case SIZE_MINIMIZED: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tSIZE_MINIMIZED\n"); +#endif + + wmMsg.msg = WM_WM_LOWER; + + /* Tell our Window Manager thread to lower the window */ + winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + break; + + case SIZE_RESTORED: + case SIZE_MAXIMIZED: + if (pWinPriv->iWidth == (short) LOWORD(lParam) + && pWinPriv->iHeight == (short) HIWORD(lParam)) + break; + + /* Get the dimensions of the Windows window */ + pWinPriv->iWidth = (short) LOWORD(lParam); + pWinPriv->iHeight = (short) HIWORD(lParam); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\t(%d, %d)\n", pWinPriv->iWidth, pWinPriv->iHeight); +#endif + + /* Check if resize events are redirected */ + if ((pWin->eventMask | wOtherEventMasks (pWin)) & ResizeRedirectMask) + { + xEvent eventT; + + /* Setup the X event structure */ + eventT.u.u.type = ResizeRequest; + eventT.u.resizeRequest.window = pWin->drawable.id; + eventT.u.resizeRequest.width = pWinPriv->iWidth; + eventT.u.resizeRequest.height = pWinPriv->iHeight; + + /* */ + if (MaybeDeliverEventsToClient (pWin, &eventT, 1, + ResizeRedirectMask, + wClient(pWin)) == 1) + break; + } + + /* Notify the X client that its window is being resized */ + if (SubStrSend (pWin, pWin->parent)) + SendConfigureNotify (pWin); + + /* Tell the X server that the window is being resized */ + (s_pScreen->ResizeWindow) (pWin, + pWinPriv->iX - wBorderWidth (pWin), + pWinPriv->iY - wBorderWidth (pWin), + pWinPriv->iWidth, + pWinPriv->iHeight, + pWin->nextSib); + + /* Tell X to redraw the exposed portions of the window */ + { + RegionRec temp; + + /* Get the region describing the X window clip list */ + REGION_INIT(s_pScreen, &temp, NullBox, 0); + REGION_COPY(s_pScreen, &temp, &pWin->clipList); + + /* Expose the clipped region */ + (*s_pScreen->WindowExposures) (pWin, &temp, NullRegion); + + /* Free the region */ + REGION_UNINIT(s_pScreen, &temp); + } + break; + +#if 0 + case SIZE_MAXIMIZED: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tSIZE_MAXIMIZED\n"); +#endif + + /* Get the dimensions of the window */ + pWinPriv->iWidth = (int)(short) LOWORD(lParam); + pWinPriv->iHeight = (int)(short) HIWORD(lParam); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\t(%d, %d)\n", pWinPriv->iWidth, pWinPriv->iHeight); +#endif + + /* */ + if ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask) + { + xEvent eventT; + + eventT.u.u.type = ResizeRequest; + eventT.u.resizeRequest.window = pWin->drawable.id; + eventT.u.resizeRequest.width = pWinPriv->iWidth; + eventT.u.resizeRequest.height = pWinPriv->iHeight; + if (MaybeDeliverEventsToClient (pWin, &eventT, 1, + ResizeRedirectMask, + wClient(pWin)) == 1); + } + + + (s_pScreen->ResizeWindow) (pWin, + pWinPriv->iX - wBorderWidth (pWin), + pWinPriv->iY - wBorderWidth (pWin), + pWinPriv->iWidth, + pWinPriv->iHeight, + pWin->nextSib); + break; +#endif + + default: + break; + } + return 0; + + case WM_MOUSEACTIVATE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_MOUSEACTIVATE\n"); +#endif + + /* Check if this window needs to be made active when clicked */ + if (!GetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP)) + { +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_MOUSEACTIVATE - MA_NOACTIVATE\n"); +#endif + + /* */ + return MA_NOACTIVATE; + } + break; + + case WM_TIMER: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winTopLevelWindowProc - WM_TIMER - %d ms\n", GetTickCount ()); +#endif + + /* Branch on the type of timer event that fired */ + if (wParam == s_nIDPollingMouse) + { + POINT point; + + /* Get the current position of the mouse cursor */ + GetCursorPos (&point); + + /* Deliver absolute cursor position to X Server */ + miPointerAbsoluteCursor (point.x, point.y, + g_c32LastInputEventTime = GetTickCount ()); + } + else + { + ErrorF ("winTopLevelWindowProc - Unknown WM_TIMER\n"); + } + return 0; + + default: + break; + } + + return DefWindowProc (hwnd, message, wParam, lParam); +} + + +/* + * winCreateWindowsWindow - Create a Windows window associated with an X window + */ + +static void +winCreateWindowsWindow (WindowPtr pWin) +{ + int iX, iY; + int iWidth; + int iHeight; + int iBorder; + HWND hWnd; + WNDCLASS wc; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin); +#endif + + iBorder = wBorderWidth (pWin); + + iX = pWin->drawable.x; + iY = pWin->drawable.y; + + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Setup our window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winTopLevelWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = g_hInstance; + wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS_X; + RegisterClass (&wc); + + /* Create the window */ + hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */ + WINDOW_CLASS_X, /* Class name */ + WINDOW_TITLE_X, /* Window name */ + WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + iX, /* Horizontal position */ + iY, /* Vertical position */ + iWidth, /* Right edge */ + iHeight, /* Bottom edge */ + (HWND) NULL, /* No parent or owner window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle (NULL), /* Instance handle */ + pWin); /* ScreenPrivates */ + if (hWnd == NULL) + { + ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n", + GetLastError ()); + } + + pWinPriv->hWnd = hWnd; + + + SetProp (pWinPriv->hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin)); + + /* Flag that this Windows window handles its own activation */ + SetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0); +} + + +/* + * winDestroyWindowsWindow - Destroy a Windows window associated with an X window + */ + +static void +winDestroyWindowsWindow (WindowPtr pWin) +{ + MSG msg; + winWindowPriv(pWin); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winDestroyWindowsWindow\n"); +#endif + + + /* Bail out if the Windows window handle is invalid */ + if (pWinPriv->hWnd == NULL) + return; + + + SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, 0); + + DestroyWindow (pWinPriv->hWnd); + + pWinPriv->hWnd = NULL; + + /* Process all messages on our queue */ + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) + { + if (g_hDlgDepthChange == 0 || !IsDialogMessage (g_hDlgDepthChange, &msg)) + { + DispatchMessage (&msg); + } + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("-winDestroyWindowsWindow\n"); +#endif +} + + +/* + * winUpdateWindowsWindow - Redisplay/redraw a Windows window associated with an X window + */ + +static void +winUpdateWindowsWindow (WindowPtr pWin) +{ + winWindowPriv(pWin); + HWND hWnd = pWinPriv->hWnd; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winUpdateWindowsWindow\n"); +#endif + + /* Check if the Windows window's parents have been destroyed */ + if (pWin->parent != NULL + && pWin->parent->parent == NULL + && pWin->mapped) + { + /* Create the Windows window if it has been destroyed */ + if (hWnd == NULL) + { + winCreateWindowsWindow (pWin); + assert (pWinPriv->hWnd != NULL); + } + + /* Display the window without activating it */ + ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE); + + /* Send first paint message */ + UpdateWindow (pWinPriv->hWnd); + } + else if (hWnd != NULL) + { + /* Destroy the Windows window if its parents are destroyed */ + winDestroyWindowsWindow (pWin); + assert (pWinPriv->hWnd == NULL); + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("-winUpdateWindowsWindow\n"); +#endif +} + + + + + + + + +typedef struct { + pointer value; + XID id; +} WindowIDPairRec, *WindowIDPairPtr; + + + + + +/* + * winFindWindow - + */ + +static void +winFindWindow (pointer value, XID id, pointer cdata) +{ + WindowIDPairPtr wi = (WindowIDPairPtr)cdata; + + if (value == wi->value) + { + wi->id = id; + } +} + + +/* + * winGetWindowID - + */ + +static XID +winGetWindowID (WindowPtr pWin) +{ + WindowIDPairRec wi = {pWin, 0}; + ClientPtr c = wClient(pWin); + + /* */ + FindClientResourcesByType (c, RT_WINDOW, winFindWindow, &wi); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winGetWindowID - Window ID: %d\n", wi.id); +#endif + + return wi.id; +} + + +/* + * SendConfigureNotify - + */ + +static void +SendConfigureNotify(WindowPtr pWin) +{ + xEvent event; + winWindowPriv(pWin); + + event.u.u.type = ConfigureNotify; + event.u.configureNotify.window = pWin->drawable.id; + + if (pWin->nextSib) + event.u.configureNotify.aboveSibling = pWin->nextSib->drawable.id; + else + event.u.configureNotify.aboveSibling = None; + + event.u.configureNotify.x = pWinPriv->iX - wBorderWidth (pWin); + event.u.configureNotify.y = pWinPriv->iY - wBorderWidth (pWin); + + event.u.configureNotify.width = pWinPriv->iWidth; + event.u.configureNotify.height = pWinPriv->iHeight; + + event.u.configureNotify.borderWidth = wBorderWidth (pWin); + + event.u.configureNotify.override = pWin->overrideRedirect; + + /* */ + DeliverEvents (pWin, &event, 1, NullWindow); +} Index: xc/programs/Xserver/hw/xwin/winmultiwindowwm.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winmultiwindowwm.c:1.1 --- /dev/null Thu Feb 27 12:33:55 2003 +++ xc/programs/Xserver/hw/xwin/winmultiwindowwm.c Wed Feb 12 10:01:38 2003 @@ -0,0 +1,907 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Kensuke Matsuzaki + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmultiwindowwm.c,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + +/* X headers */ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/select.h> +#include <fcntl.h> +#include <setjmp.h> +#include <pthread.h> +#include <X11/X.h> +#include <X11/Xatom.h> +#include <X11/Xlib.h> +#include <X11/Xlocale.h> +#include <X11/Xproto.h> +#include <X11/Xutil.h> + +/* Fixups to prevent collisions between Windows and X headers */ +#define ATOM DWORD + +/* Windows headers */ +#include <windows.h> + +/* Local headers */ +#include "winwindow.h" + + +/* + * Constant defines + */ + +#define WIN_CONNECT_RETRIES 5 +#define WIN_CONNECT_DELAY 5 +#define WIN_MSG_QUEUE_FNAME "/dev/windows" +#define WM_WM_X_EVENT 1 +#define WIN_JMP_OKAY 0 +#define WIN_JMP_ERROR_IO 2 + + +/* + * Local structures + */ + +typedef struct _WMMsgNodeRec { + winWMMessageRec msg; + struct _WMMsgNodeRec *pNext; +} WMMsgNodeRec, *WMMsgNodePtr; + +typedef struct _WMMsgQueueRec { + struct _WMMsgNodeRec *pHead; + struct _WMMsgNodeRec *pTail; + pthread_mutex_t pmMutex; + pthread_cond_t pcNotEmpty; +} WMMsgQueueRec, *WMMsgQueuePtr; + +typedef struct _WMInfo { + Display *pDisplay; + WMMsgQueueRec wmMsgQueue; + Atom atmWmProtos; + Atom atmWmDelete; +} WMInfoRec, *WMInfoPtr; + +typedef struct _WMProcArgRec { + DWORD dwScreen; + WMInfoPtr pWMInfo; + pthread_mutex_t *ppmServerStarted; +} WMProcArgRec, *WMProcArgPtr; + + +/* + * References to external symbols + */ + +extern char *display; +extern void ErrorF (const char* /*f*/, ...); +extern Bool g_fCalledSetLocale; + + +/* + * Prototypes for local functions + */ + +static void +PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode); + +static WMMsgNodePtr +PopMessage (WMMsgQueuePtr pQueue); + +static Bool +InitQueue (WMMsgQueuePtr pQueue); + +static void +GetWindowName (Display * pDpy, Window iWin, char **ppName); + +static int +SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData); + +static void* +winMultiWindowWMProc (void* pArg); + +static Bool +FlushXEvents (WMInfoPtr pWMInfo); + +static int +winMultiWindowWMErrorHandler (Display *pDisp, XErrorEvent *e); + +static void +winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg); + +static int +winMutliWindowWMIOErrorHandler (Display *pDisplay); + + +/* + * Local globals + */ + +static int g_nQueueSize; +static jmp_buf g_jmpEntry; + + + +/* + * PushMessage - Push a message onto the queue + */ + +static void +PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode) +{ + + /* Lock the queue mutex */ + pthread_mutex_lock (&pQueue->pmMutex); + + pNode->pNext = NULL; + + if (pQueue->pTail != NULL) + { + pQueue->pTail->pNext = pNode; + } + pQueue->pTail = pNode; + + if (pQueue->pHead == NULL) + { + pQueue->pHead = pNode; + } + + +#if 0 + switch (pNode->msg.msg) + { + case WM_WM_MOVE: + ErrorF ("\tWM_WM_MOVE\n"); + break; + case WM_WM_RAISE: + ErrorF ("\tWM_WM_RAISE\n"); + break; + case WM_WM_LOWER: + ErrorF ("\tWM_WM_RAISE\n"); + break; + case WM_WM_MAP: + ErrorF ("\tWM_WM_MAP\n"); + break; + case WM_WM_UNMAP: + ErrorF ("\tWM_WM_UNMAP\n"); + break; + case WM_WM_KILL: + ErrorF ("\tWM_WM_KILL\n"); + break; + default: + ErrorF ("Unknown Message.\n"); + break; + } +#endif + + /* Increase the count of elements in the queue by one */ + ++g_nQueueSize; + + /* Release the queue mutex */ + pthread_mutex_unlock (&pQueue->pmMutex); + + /* Signal that the queue is not empty */ + pthread_cond_signal (&pQueue->pcNotEmpty); +} + + +#if 0 +/* + * QueueSize - Return the size of the queue + */ + +static int +QueueSize (WMMsgQueuePtr pQueue) +{ + WMMsgNodePtr pNode; + int nSize = 0; + + /* Loop through all elements in the queue */ + for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext) + ++nSize; + + return nSize; +} +#endif + + +/* + * PopMessage - + */ + +static WMMsgNodePtr +PopMessage (WMMsgQueuePtr pQueue) +{ + WMMsgNodePtr pNode; + + /* Lock the queue mutex */ + pthread_mutex_lock (&pQueue->pmMutex); + + /* Wait for --- */ + while (pQueue->pHead == NULL) + { + pthread_cond_wait (&pQueue->pcNotEmpty, &pQueue->pmMutex); + } + + pNode = pQueue->pHead; + if (pQueue->pHead != NULL) + { + pQueue->pHead = pQueue->pHead->pNext; + } + + if (pQueue->pTail == pNode) + { + pQueue->pTail = NULL; + } + + /* Drop the number of elements in the queue by one */ + --g_nQueueSize; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("Queue Size %d %d\n", g_nQueueSize, QueueSize(pQueue)); +#endif + + /* Release the queue mutex */ + pthread_mutex_unlock (&pQueue->pmMutex); + + return pNode; +} + + +#if 0 +/* + * HaveMessage - + */ + +static Bool +HaveMessage (WMMsgQueuePtr pQueue, UINT msg, Window iWindow) +{ + WMMsgNodePtr pNode; + + for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext) + { + if (pNode->msg.msg==msg && pNode->msg.iWindow==iWindow) + return True; + } + + return False; +} +#endif + + +/* + * InitQueue - Initialize the Window Manager message queue + */ + +static +Bool +InitQueue (WMMsgQueuePtr pQueue) +{ + /* Check if the pQueue pointer is NULL */ + if (pQueue == NULL) + { + ErrorF ("InitQueue - pQueue is NULL. Exiting.\n"); + return FALSE; + } + + /* Set the head and tail to NULL */ + pQueue->pHead = NULL; + pQueue->pTail = NULL; + + /* There are no elements initially */ + g_nQueueSize = 0; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("InitQueue - Queue Size %d %d\n", g_nQueueSize, QueueSize(pQueue)); +#endif + + ErrorF ("InitQueue - Calling pthread_mutex_init\n"); + + /* Create synchronization objects */ + pthread_mutex_init (&pQueue->pmMutex, NULL); + + ErrorF ("InitQueue - pthread_mutex_init returned\n"); + ErrorF ("InitQueue - Calling pthread_cond_init\n"); + + pthread_cond_init (&pQueue->pcNotEmpty, NULL); + + ErrorF ("InitQueue - pthread_cond_init returned\n"); + + return TRUE; +} + + +/* + * GetWindowName - + */ + +static void +GetWindowName (Display *pDisplay, Window iWin, char **ppName) +{ + int nResult, nNum; + char **ppList; + XTextProperty xtpName; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("GetWindowName\n"); +#endif + + /* Intialize ppName to NULL */ + *ppName = NULL; + + /* Try to get --- */ + nResult = XGetWMName (pDisplay, iWin, &xtpName); + if (!nResult || !xtpName.value || !xtpName.nitems) + { + ErrorF ("GetWindowName - XGetWMName failed. No name.\n"); + return; + } + + /* */ + if (xtpName.encoding == XA_STRING) + { + /* */ + if (xtpName.value) + { + *ppName = strdup ((char*)xtpName.value); + XFree (xtpName.value); + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("XA_STRING %s\n", *ppName); +#endif + } + else + { + XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum); + + /* */ + if (nNum && *ppList) + { + XFree (xtpName.value); + *ppName = strdup (*ppList); + XFreeStringList (ppList); + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("%s %s\n", XGetAtomName (pDisplay, xtpName.encoding), *ppName); +#endif + } + + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("-GetWindowName\n"); +#endif +} + + +/* + * Send a message to the X server from the WM thread + */ + +static int +SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData) +{ + XEvent e; + + /* Prepare the X event structure */ + e.type = ClientMessage; + e.xclient.window = iWin; + e.xclient.message_type = atmType; + e.xclient.format = 32; + e.xclient.data.l[0] = nData; + e.xclient.data.l[1] = CurrentTime; + + /* Send the event to X */ + return XSendEvent (pDisplay, iWin, False, NoEventMask, &e); +} + + +/* + * winMultiWindowWMProc + */ + +static void * +winMultiWindowWMProc (void *pArg) +{ + WMProcArgPtr pProcArg = (WMProcArgPtr)pArg; + WMInfoPtr pWMInfo = pProcArg->pWMInfo; + + /* Initialize the Window Manager */ + winInitMultiWindowWM (pWMInfo, pProcArg); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winMultiWindowWMProc ()\n"); +#endif + + /* Loop until we explicity break out */ + for (;;) + { + WMMsgNodePtr pNode; + + /* Pop a message off of our queue */ + pNode = PopMessage (&pWMInfo->wmMsgQueue); + if (pNode == NULL) + { + /* Bail if PopMessage returns without a message */ + /* NOTE: Remember that PopMessage is a blocking function. */ + ErrorF ("winMultiWindowWMProc - Queue is Empty?\n"); + pthread_exit (NULL); + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n", + GetTickCount (), (int)pNode->msg.msg, (int)pNode->msg.dwID); +#endif + + /* Branch on the message type */ + switch (pNode->msg.msg) + { +#if 0 + case WM_WM_MOVE: + ErrorF ("\tWM_WM_MOVE\n"); + break; + + case WM_WM_SIZE: + ErrorF ("\tWM_WM_SIZE\n"); + break; +#endif + + case WM_WM_RAISE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_RAISE\n"); +#endif + + /* Raise the window */ + XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow); + break; + + case WM_WM_LOWER: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_LOWER\n"); +#endif + + /* Lower the window */ + XLowerWindow (pWMInfo->pDisplay, pNode->msg.iWindow); + break; + + case WM_WM_MAP: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_MAP\n"); +#endif + { + XWindowAttributes attr; + char *pszName; +#if 0 + XWMHints *pHints; +#endif + + /* Get the window attributes */ + XGetWindowAttributes (pWMInfo->pDisplay, + pNode->msg.iWindow, + &attr); + if (!attr.override_redirect) + { + /* Set the Windows window name */ + GetWindowName(pWMInfo->pDisplay, pNode->msg.iWindow, &pszName); + SetWindowText (pNode->msg.hwndWindow, pszName); + free (pszName); + } + } + break; + + case WM_WM_UNMAP: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_UNMAP\n"); +#endif + + /* Unmap the window */ + XUnmapWindow(pWMInfo->pDisplay, pNode->msg.iWindow); + break; + + case WM_WM_KILL: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_KILL\n"); +#endif + { + int i, n, found = 0; + Atom *protocols; + + /* --- */ + if (XGetWMProtocols (pWMInfo->pDisplay, + pNode->msg.iWindow, + &protocols, + &n)) + { + for (i = 0; i < n; ++i) + if (protocols[i] == pWMInfo->atmWmDelete) + ++found; + + XFree (protocols); + } + + /* --- */ + if (found) + SendXMessage (pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmProtos, + pWMInfo->atmWmDelete); + else + XKillClient (pWMInfo->pDisplay, + pNode->msg.iWindow); + } + break; + + case WM_WM_ACTIVATE: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_ACTIVATE\n"); +#endif + + /* Set the input focus */ + XSetInputFocus (pWMInfo->pDisplay, + pNode->msg.iWindow, + RevertToPointerRoot, + CurrentTime); + break; + + case WM_WM_X_EVENT: + /* Process all X events in the Window Manager event queue */ + FlushXEvents (pWMInfo); + break; + + default: + ErrorF ("winMultiWindowWMProc - Unknown Message.\n"); + pthread_exit (NULL); + break; + } + + /* Free the retrieved message */ + free (pNode); + + /* Flush any pending events on our display */ + XFlush (pWMInfo->pDisplay); + } + + /* Free the condition variable */ + pthread_cond_destroy (&pWMInfo->wmMsgQueue.pcNotEmpty); + + /* Free the mutex variable */ + pthread_mutex_destroy (&pWMInfo->wmMsgQueue.pmMutex); + + /* Free the passed-in argument */ + free (pProcArg); + +#if CYGMULTIWINDOW_DEBUG + ErrorF("-winMultiWindowWMProc ()\n"); +#endif +} + + +/* + * FlushXEvents - Process any pending X events + */ + +static Bool +FlushXEvents (WMInfoPtr pWMInfo) +{ + XEvent event; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("FlushXEvents ()\n"); +#endif + + /* Process all pending events */ + while (XPending (pWMInfo->pDisplay)) + { + /* Get the next event - will not block because one is ready */ + XNextEvent (pWMInfo->pDisplay, &event); + +#if 0 + /* Branch on the event type */ + switch (event.type) + { + } +#endif + } + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("-FlushXEvents ()\n"); +#endif + + return True; +} + + +/* + * winMultiWindowWMErrorHandler - Our application specific error handler + */ + +static int +winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr) +{ + char pszErrorMsg[100]; + + if (pErr->request_code == X_ChangeWindowAttributes + && pErr->error_code == BadAccess) + { + ErrorF ("ChangeWindowAttributes BadAccess.\n"); + pthread_exit (NULL); + } + + XGetErrorText (pDisplay, + pErr->error_code, + pszErrorMsg, + sizeof (pszErrorMsg)); + ErrorF ("ERROR: %s\n", pszErrorMsg); + + if (pErr->error_code==BadWindow + || pErr->error_code==BadMatch + || pErr->error_code==BadDrawable) + { + pthread_exit (NULL); + } + + pthread_exit (NULL); + return 0; +} + + +/* + * winInitWM - Entry point for the X server to spawn + * the Window Manager thread. Called from + * winscrinit.c/winFinishScreenInitFB (). + */ + +Bool +winInitWM (void **ppWMInfo, + pthread_t *ptWMProc, + pthread_mutex_t *ppmServerStarted, + int dwScreen) +{ + WMProcArgPtr pArg = (WMProcArgPtr)malloc (sizeof(WMProcArgRec)); + WMInfoPtr pWMInfo = (WMInfoPtr)malloc (sizeof(WMInfoRec)); + + /* Bail if the input parameters are bad */ + if (pArg == NULL || pWMInfo == NULL) + { + ErrorF ("winInitWM - malloc fail.\n"); + return FALSE; + } + + /* Set a return pointer to the Window Manager info structure */ + *ppWMInfo = pWMInfo; + + /* Setup the argument structure for the thread function */ + pArg->dwScreen = dwScreen; + pArg->pWMInfo = pWMInfo; + pArg->ppmServerStarted = ppmServerStarted; + + /* Intialize the message queue */ + if (!InitQueue (&pWMInfo->wmMsgQueue)) + { + ErrorF ("winInitWM - InitQueue () failed.\n"); + return FALSE; + } + + /* Spawn a thread for the Window Manager */ + if (pthread_create (ptWMProc, NULL, winMultiWindowWMProc, pArg)) + { + /* Bail if thread creation failed */ + ErrorF ("winInitWM - pthread_create failed.\n"); + return FALSE; + } + +#if CYGDEBUG || YES + ErrorF ("winInitWM - Returning.\n"); +#endif + + return TRUE; +} + + +/* + * winInitMultiWindowWM - + */ + +Bool +winClipboardDetectUnicodeSupport (); + +static void +winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) +{ + int iRetries = 0; + char pszDisplay[512]; + int iReturn; + Bool fUnicodeSupport; + + ErrorF ("winInitMultiWindowWM - Hello\n"); + + /* Check that argument pointer is not invalid */ + if (pProcArg == NULL) + { + ErrorF ("winInitMultiWindowWM - pProcArg is NULL, bailing.\n"); + pthread_exit (NULL); + } + + ErrorF ("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n"); + + /* Grab our garbage mutex to satisfy pthread_cond_wait */ + iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted); + if (iReturn != 0) + { + ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d\n", + iReturn); + pthread_exit (NULL); + } + + ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n"); + + /* Do we have Unicode support? */ + fUnicodeSupport = winClipboardDetectUnicodeSupport (); + + /* Set the current locale? What does this do? */ + if (fUnicodeSupport && !g_fCalledSetLocale) + { + ErrorF ("winInitMultiWindowWM - Calling setlocale ()\n"); + if (!setlocale (LC_ALL, "")) + { + ErrorF ("winInitMultiWindowWM - setlocale () error\n"); + pthread_exit (NULL); + } + ErrorF ("winInitMultiWindowWM - setlocale () returned\n"); + + /* See if X supports the current locale */ + if (XSupportsLocale () == False) + { + ErrorF ("winInitMultiWindowWM - Locale not supported by X\n"); + pthread_exit (NULL); + } + } + + /* Flag that we have called setlocale */ + g_fCalledSetLocale = TRUE; + + /* Release the garbage mutex */ + pthread_mutex_unlock (pProcArg->ppmServerStarted); + + ErrorF ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n"); + + /* Allow multiple threads to access Xlib */ + if (XInitThreads () == 0) + { + ErrorF ("winInitMultiWindowWM - XInitThreads () failed.\n"); + pthread_exit (NULL); + } + + ErrorF ("winInitMultiWindowWM - XInitThreads () returned.\n"); + + /* Set jump point for Error exits */ + iReturn = setjmp (g_jmpEntry); + + /* Check if we should continue operations */ + if (iReturn != WIN_JMP_ERROR_IO + && iReturn != WIN_JMP_OKAY) + { + /* setjmp returned an unknown value, exit */ + ErrorF ("winInitMultiWindowWM - setjmp returned: %d exiting\n", + iReturn); + pthread_exit (NULL); + } + else if (iReturn == WIN_JMP_ERROR_IO) + { + ErrorF ("winInitMultiWindowWM - setjmp returned WIN_JMP_ERROR_IO\n"); + } + + /* Setup the display connection string x */ + snprintf (pszDisplay, 512, "127.0.0.1:%s.%d", display, pProcArg->dwScreen); + + /* Print the display connection string */ + ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); + + /* Open the X display */ + do + { + /* Try to open the display */ + pWMInfo->pDisplay = XOpenDisplay (pszDisplay); + if (pWMInfo->pDisplay == NULL) + { + ErrorF ("winInitMultiWindowWM - Could not open display, try: %d, " + "sleeping: %d\n\f", + iRetries + 1, WIN_CONNECT_DELAY); + ++iRetries; + sleep (WIN_CONNECT_DELAY); + continue; + } + else + break; + } + while (pWMInfo->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES); + + /* Make sure that the display opened */ + if (pWMInfo->pDisplay == NULL) + { + ErrorF ("winInitMultiWindowWM - Failed opening the display, " + "giving up.\n\f"); + pthread_exit (NULL); + } + + ErrorF ("winInitMultiWindowWM - XOpenDisplay () returned and " + "successfully opened the display.\n"); + + /* Install our error handler */ + XSetErrorHandler (winMultiWindowWMErrorHandler); + XSetIOErrorHandler (winMutliWindowWMIOErrorHandler); + + /* Create some atoms */ + pWMInfo->atmWmProtos = XInternAtom (pWMInfo->pDisplay, + "WM_PROTOCOLS", + False); + pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay, + "WM_DELETE_WINDOW", + False); +} + + +/* + * winSendMessageToWM - Send a message from the X thread to the WM thread + */ + +void +winSendMessageToWM (void *pWMInfo, winWMMessagePtr pMsg) +{ + WMMsgNodePtr pNode; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winSendMessageToWM ()\n"); +#endif + + pNode = (WMMsgNodePtr)malloc(sizeof(WMMsgNodeRec)); + if (pNode != NULL) + { + memcpy (&pNode->msg, pMsg, sizeof(winWMMessageRec)); + PushMessage (&((WMInfoPtr)pWMInfo)->wmMsgQueue, pNode); + } +} + + +/* + * winMutliWindowWMIOErrorHandler - Our application specific IO error handler + */ + +static int +winMutliWindowWMIOErrorHandler (Display *pDisplay) +{ + printf ("\nwinMutliWindowWMIOErrorHandler!\n\n"); + + /* Restart at the main entry point */ + longjmp (g_jmpEntry, WIN_JMP_ERROR_IO); + + return 0; +} Index: xc/programs/Xserver/hw/xwin/winnativegdi.c diff -u xc/programs/Xserver/hw/xwin/winnativegdi.c:1.11 xc/programs/Xserver/hw/xwin/winnativegdi.c:1.13 --- xc/programs/Xserver/hw/xwin/winnativegdi.c:1.11 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winnativegdi.c Thu Oct 17 04:18:22 2002 @@ -27,14 +27,14 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winnativegdi.c,v 1.11 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winnativegdi.c,v 1.13 2002/10/17 08:18:22 alanh Exp $ */ #include "win.h" Bool winAllocateFBNativeGDI (ScreenPtr pScreen) { - FatalError ("winAllocateFBNativeGDI ()\n"); + FatalError ("winAllocateFBNativeGDI\n"); return TRUE; } @@ -49,7 +49,7 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - ErrorF ("winCloseScreenNativeGDI () - Freeing screen resources\n"); + ErrorF ("winCloseScreenNativeGDI - Freeing screen resources\n"); /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; @@ -63,7 +63,7 @@ /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - ErrorF ("winCloseScreenNativeGDI () - Destroying window\n"); + ErrorF ("winCloseScreenNativeGDI - Destroying window\n"); /* Kill our window */ if (pScreenPriv->hwndScreen) @@ -76,9 +76,9 @@ pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ - xfree (pScreenPriv); + free (pScreenPriv); - ErrorF ("winCloseScreenNativeGDI () - Returning\n"); + ErrorF ("winCloseScreenNativeGDI - Returning\n"); return TRUE; } @@ -88,7 +88,7 @@ winShadowUpdateNativeGDI (ScreenPtr pScreen, shadowBufPtr pBuf) { - FatalError ("winShadowUpdateNativeGDI ()\n"); + FatalError ("winShadowUpdateNativeGDI\n"); return; } @@ -102,7 +102,6 @@ /* Set the bitsPerRGB and bit masks */ switch (pScreenInfo->dwDepth) { - case 32: case 24: pScreenPriv->dwBitsPerRGB = 8; pScreenPriv->dwRedMask = 0x00FF0000; @@ -132,19 +131,18 @@ break; default: - ErrorF ("winInitVisualsNativeGDI () - Unknown screen depth\n"); + ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); return FALSE; break; } /* Tell the user how many bits per RGB we are using */ - ErrorF ("winInitVisualsNativeGDI () - Using dwBitsPerRGB: %d\n", + ErrorF ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n", pScreenPriv->dwBitsPerRGB); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { - case 32: case 24: case 16: case 15: @@ -156,13 +154,13 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); return FALSE; } break; case 8: - ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, StaticColorMask, pScreenPriv->dwBitsPerRGB, @@ -171,18 +169,18 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); return FALSE; } break; default: - ErrorF ("winInitVisualsNativeGDI () - Unknown screen depth\n"); + ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); return FALSE; } #if 1 - ErrorF ("winInitVisualsNativeGDI () - Returning\n"); + ErrorF ("winInitVisualsNativeGDI - Returning\n"); #endif return TRUE; @@ -196,38 +194,38 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc = NULL; - DWORD dwDepth; + DWORD dwBPP; hdc = GetDC (NULL); /* We're in serious trouble if we can't get a DC */ if (hdc == NULL) { - ErrorF ("winAdjustVideoModeNativeGDI () - GetDC () failed\n"); + ErrorF ("winAdjustVideoModeNativeGDI - GetDC () failed\n"); return FALSE; } /* Query GDI for current display depth */ - dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* GDI cannot change the screen depth */ - if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) { /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeNativeGDI () - Using Windows display " - "depth of %d bits per pixel\n", dwDepth); + ErrorF ("winAdjustVideoModeNativeGDI - Using Windows display " + "depth of %d bits per pixel\n", dwBPP); /* Use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } - else if (dwDepth != pScreenInfo->dwDepth) + else if (dwBPP != pScreenInfo->dwBPP) { /* Warn user if GDI depth is different than -depth parameter */ - ErrorF ("winAdjustVideoModeNativeGDI () - Command line depth: %d, "\ - "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + ErrorF ("winAdjustVideoModeNativeGDI - Command line bpp: %d, "\ + "using bpp: %d\n", pScreenInfo->dwBPP, dwBPP); /* We'll use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } /* Release our DC */ @@ -290,17 +288,17 @@ || iHeight == 0 || iDepth == 0) { - ErrorF ("\nwinCreateDIBNativeGDI () - Invalid specs w %d h %d d %d\n\n", + ErrorF ("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n", iWidth, iHeight, iDepth); return NULL; } /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); if (pbmih == NULL) { - ErrorF ("winCreateDIBNativeGDI () - xalloc () failed\n"); + ErrorF ("winCreateDIBNativeGDI - malloc () failed\n"); return FALSE; } ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); @@ -336,7 +334,7 @@ 0); if (hBitmap == NULL) { - ErrorF ("winCreateDIBNativeGDI () - CreateDIBSection () failed\n"); + ErrorF ("winCreateDIBNativeGDI - CreateDIBSection () failed\n"); return NULL; } @@ -348,7 +346,7 @@ } else { - xfree (pbmih); + free (pbmih); pbmih = NULL; } @@ -367,7 +365,7 @@ Bool winRedrawScreenNativeGDI (ScreenPtr pScreen) { - FatalError ("winRedrawScreenNativeGDI ()\n"); + FatalError ("winRedrawScreenNativeGDI\n"); return TRUE; } @@ -375,7 +373,7 @@ Bool winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen) { - FatalError ("winRealizeInstalledPaletteNativeGDI ()\n"); + FatalError ("winRealizeInstalledPaletteNativeGDI\n"); return TRUE; } @@ -383,7 +381,7 @@ Bool winInstallColormapNativeGDI (ColormapPtr pColormap) { - FatalError ("winInstallColormapNativeGDI ()\n"); + FatalError ("winInstallColormapNativeGDI\n"); return TRUE; } @@ -393,7 +391,7 @@ int ndef, xColorItem *pdefs) { - FatalError ("winStoreColorsNativeGDI ()\n"); + FatalError ("winStoreColorsNativeGDI\n"); return TRUE; } @@ -401,7 +399,7 @@ Bool winCreateColormapNativeGDI (ColormapPtr pColormap) { - FatalError ("winCreateColormapNativeGDI ()\n"); + FatalError ("winCreateColormapNativeGDI\n"); return TRUE; } @@ -409,7 +407,7 @@ Bool winDestroyColormapNativeGDI (ColormapPtr pColormap) { - FatalError ("winDestroyColormapNativeGDI ()\n"); + FatalError ("winDestroyColormapNativeGDI\n"); return TRUE; } @@ -450,7 +448,7 @@ pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI; pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI; pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winpfbdd.c diff -u xc/programs/Xserver/hw/xwin/winpfbdd.c:1.14 xc/programs/Xserver/hw/xwin/winpfbdd.c:1.17 --- xc/programs/Xserver/hw/xwin/winpfbdd.c:1.14 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winpfbdd.c Thu Oct 17 04:18:22 2002 @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.14 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.17 2002/10/17 08:18:22 alanh Exp $ */ #include "win.h" @@ -49,8 +49,8 @@ DDSURFACEDESC *pddsdPrimary = NULL; DDSURFACEDESC *pddsdOffscreen = NULL; RECT rcClient; - - ErrorF ("winAllocateFBPrimaryDD ()\n"); + + ErrorF ("winAllocateFBPrimaryDD\n"); /* Get client area location in screen coords */ GetClientRect (pScreenPriv->hwndScreen, &rcClient); @@ -59,9 +59,9 @@ (LPPOINT)&rcClient, 2); /* Create a DirectDraw object, store the address at lpdd */ - ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); + ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL); if (ddrval != DD_OK) - FatalError ("winAllocateFBPrimaryDD () - Could not start DirectDraw\n"); + FatalError ("winAllocateFBPrimaryDD - Could not start DirectDraw\n"); /* Get a DirectDraw2 interface pointer */ ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, @@ -69,13 +69,13 @@ (LPVOID*) &pScreenPriv->pdd2); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Failed DD2 query: %08x\n", + ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n", ddrval); return FALSE; } - ErrorF ("winAllocateFBPrimaryDD () - Created and initialized DD\n"); + ErrorF ("winAllocateFBPrimaryDD - Created and initialized DD\n"); /* Are we windowed or fullscreen? */ if (pScreenInfo->fFullScreen) @@ -86,18 +86,18 @@ DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + FatalError ("winAllocateFBPrimaryDD - Could not set " "cooperative level\n"); /* Change the video mode to the mode requested */ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenInfo->dwDepth, + pScreenInfo->dwBPP, pScreenInfo->dwRefreshRate, 0); if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + FatalError ("winAllocateFBPrimaryDD - Could not set " "full screen display mode\n"); } else @@ -107,7 +107,7 @@ pScreenPriv->hwndScreen, DDSCL_NORMAL); if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + FatalError ("winAllocateFBPrimaryDD - Could not set " "cooperative level\n"); } @@ -123,16 +123,16 @@ &pScreenPriv->pddsPrimary, NULL); if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD () - Could not create primary "\ + FatalError ("winAllocateFBPrimaryDD - Could not create primary " "surface %08x\n", ddrval); - ErrorF ("winAllocateFBPrimaryDD () - Created primary\n"); + ErrorF ("winAllocateFBPrimaryDD - Created primary\n"); /* Allocate a DD surface description for our screen privates */ pddsdPrimary = pScreenPriv->pddsdPrimary - = xalloc (sizeof (DDSURFACEDESC)); + = malloc (sizeof (DDSURFACEDESC)); if (pddsdPrimary == NULL) - FatalError ("winAllocateFBPrimaryDD () - Could not allocate surface "\ + FatalError ("winAllocateFBPrimaryDD - Could not allocate surface " "description memory\n"); ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary)); pddsdPrimary->dwSize = sizeof (*pddsdPrimary); @@ -159,21 +159,21 @@ &pScreenPriv->pddsOffscreen, NULL); if (ddrval != DD_OK) - FatalError ("winAllocateFBPrimaryDD () - Could not create shadow "\ + FatalError ("winAllocateFBPrimaryDD - Could not create shadow " "surface\n"); - ErrorF ("winAllocateFBPrimaryDD () - Created offscreen\n"); + ErrorF ("winAllocateFBPrimaryDD - Created offscreen\n"); /* Allocate a DD surface description for our screen privates */ pddsdOffscreen = pScreenPriv->pddsdOffscreen - = xalloc (sizeof (DDSURFACEDESC)); + = malloc (sizeof (DDSURFACEDESC)); if (pddsdOffscreen == NULL) - FatalError ("winAllocateFBPrimaryDD () - Could not allocate surface "\ + FatalError ("winAllocateFBPrimaryDD - Could not allocate surface " "description memory\n"); ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen)); pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen); - ErrorF ("winAllocateFBPrimaryDD () - Locking primary\n"); + ErrorF ("winAllocateFBPrimaryDD - Locking primary\n"); /* Lock the primary surface */ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, @@ -182,28 +182,28 @@ DDLOCK_WAIT, NULL); if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL) - FatalError ("winAllocateFBPrimaryDD () - Could not lock "\ + FatalError ("winAllocateFBPrimaryDD - Could not lock " "primary surface\n"); - ErrorF ("winAllocateFBPrimaryDD () - Locked primary\n"); + ErrorF ("winAllocateFBPrimaryDD - Locked primary\n"); /* We don't know how to deal with anything other than RGB */ if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB)) - FatalError ("winAllocateFBPrimaryDD () - Color format other than RGB\n"); + FatalError ("winAllocateFBPrimaryDD - Color format other than RGB\n"); - /* Grab the pitch, and memory pointer from the surface desc */ - pScreenInfo->dwStrideBytes = pddsdPrimary->u1.lPitch; - pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) - / pScreenInfo->dwDepth; + /* Grab the pitch from the surface desc */ + pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8) + / pScreenInfo->dwBPP; + + /* Save the pointer to our surface memory */ pScreenInfo->pfb = pddsdPrimary->lpSurface; /* Grab the color depth and masks from the surface description */ - pScreenInfo->dwDepth = pddsdPrimary->ddpfPixelFormat.u1.dwRGBBitCount; pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask; pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask; - ErrorF ("winAllocateFBPrimaryDD () - Returning\n"); + ErrorF ("winAllocateFBPrimaryDD - Returning\n"); return TRUE; } @@ -222,7 +222,7 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; - ErrorF ("winCloseScreenPrimaryDD () - Freeing screen resources\n"); + ErrorF ("winCloseScreenPrimaryDD - Freeing screen resources\n"); /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; @@ -273,7 +273,7 @@ pScreenInfo->pfb = NULL; /* Free the screen privates for this screen */ - xfree ((pointer) pScreenPriv); + free ((pointer) pScreenPriv); return fReturn; } @@ -307,7 +307,7 @@ else pScreenPriv->dwBitsPerRGB = dwBlueBits; - ErrorF ("winInitVisualsPrimaryDD () - Masks: %08x %08x %08x bpRGB: %d\n", + ErrorF ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, @@ -316,7 +316,6 @@ /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { - case 32: case 24: case 16: case 15: @@ -328,7 +327,7 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsPrimaryDD () - " \ + ErrorF ("winInitVisualsPrimaryDD - " "miSetVisualTypesAndMasks failed\n"); return FALSE; } @@ -336,7 +335,7 @@ case 8: #if CYGDEBUG - ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); #endif /* CYGDEBUG */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, PseudoColorMask, @@ -346,71 +345,72 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsPrimaryDD () - "\ + ErrorF ("winInitVisualsPrimaryDD - " "miSetVisualTypesAndMasks failed\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winInitVisualsPrimaryDD () - Returned from "\ + ErrorF ("winInitVisualsPrimaryDD - Returned from " "miSetVisualTypesAndMasks\n"); #endif /* CYGDEBUG */ break; default: - ErrorF ("winInitVisualsPrimaryDD () - Unknown screen depth\n"); + ErrorF ("winInitVisualsPrimaryDD - Unknown screen depth\n"); return FALSE; } - ErrorF ("winInitVisualsPrimaryDD () - Returning\n"); + ErrorF ("winInitVisualsPrimaryDD - Returning\n"); return TRUE; } + Bool winAdjustVideoModePrimaryDD (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc = NULL; - DWORD dwDepth; + DWORD dwBPP; /* We're in serious trouble if we can't get a DC */ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winAdjustVideoModePrimaryDD () - GetDC failed\n"); + ErrorF ("winAdjustVideoModePrimaryDD - GetDC failed\n"); return FALSE; } /* Query GDI for current display depth */ - dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) { /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModePrimaryDD () - Using Windows display " - "depth of %d bits per pixel\n", dwDepth); + ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display " + "depth of %d bits per pixel\n", dwBPP); /* Use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } else if (pScreenInfo->fFullScreen - && pScreenInfo->dwDepth != dwDepth) + && pScreenInfo->dwBPP != dwBPP) { /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModePrimaryDD () - FullScreen, using command " - "line depth: %d\n", pScreenInfo->dwDepth); + ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command " + "line depth: %d\n", pScreenInfo->dwBPP); } - else if (dwDepth != pScreenInfo->dwDepth) + else if (dwBPP != pScreenInfo->dwBPP) { /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModePrimaryDD () - Windowed, command line " + ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line " "depth: %d, using depth: %d\n", - pScreenInfo->dwDepth, dwDepth); + pScreenInfo->dwBPP, dwBPP); /* We'll use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } /* Release our DC */ @@ -523,7 +523,7 @@ RECT rcClient, rcSrc; HRESULT ddrval = DD_OK; - ErrorF ("\nwinHotKeyAltTabPrimaryDD ()\n\n"); + ErrorF ("\nwinHotKeyAltTabPrimaryDD\n\n"); /* Alt+Tab was pressed, we will lose focus very soon */ pScreenPriv->fActive = FALSE; @@ -546,7 +546,7 @@ ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL); if (FAILED (ddrval)) - FatalError ("winHotKeyAltTabPrimaryDD () - Failed unlocking primary "\ + FatalError ("winHotKeyAltTabPrimaryDD - Failed unlocking primary " "surface\n"); } @@ -576,13 +576,13 @@ DDBLT_WAIT, NULL); if (FAILED (ddrval)) - FatalError ("winHotKeyAltTabPrimaryDD () - Failed blitting primary " + FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary " "surface to offscreen surface: %08x\n", ddrval); } else { - FatalError ("winHotKeyAltTabPrimaryDD() - Unknown error from " + FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from " "Blt: %08dx\n", ddrval); } @@ -594,7 +594,7 @@ NULL); if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL) - FatalError ("winHotKeyAltTabPrimaryDD () - Could not lock "\ + FatalError ("winHotKeyAltTabPrimaryDD - Could not lock " "offscreen surface\n"); /* Notify FB of the new memory pointer */ Index: xc/programs/Xserver/hw/xwin/winpixmap.c diff -u xc/programs/Xserver/hw/xwin/winpixmap.c:1.9 xc/programs/Xserver/hw/xwin/winpixmap.c:1.10 --- xc/programs/Xserver/hw/xwin/winpixmap.c:1.9 Thu Nov 1 07:19:42 2001 +++ xc/programs/Xserver/hw/xwin/winpixmap.c Thu Oct 17 04:18:24 2002 @@ -28,7 +28,7 @@ * Authors: drewry, september 1986 * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winpixmap.c,v 1.9 2001/11/01 12:19:42 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpixmap.c,v 1.10 2002/10/17 08:18:24 alanh Exp $ */ #include "win.h" @@ -138,12 +138,12 @@ /* Free the bitmap info header memory */ if (pPixmapPriv->pbmih != NULL) { - xfree (pPixmapPriv->pbmih); + free (pPixmapPriv->pbmih); pPixmapPriv->pbmih = NULL; } /* Free the pixmap memory */ - xfree (pPixmap); + free (pPixmap); pPixmap = NULL; return TRUE; Index: xc/programs/Xserver/hw/xwin/winregistry.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winregistry.c:1.1 --- /dev/null Thu Feb 27 12:33:55 2003 +++ xc/programs/Xserver/hw/xwin/winregistry.c Fri Jul 5 05:19:26 2002 @@ -0,0 +1,66 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winregistry.c,v 1.1 2002/07/05 09:19:26 alanh Exp $ */ + +#include "win.h" + + +DWORD +winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey) +{ + HKEY hkResult; + DWORD dwDisposition; + + RegCreateKeyEx (hkey, + pszRegistryKey, + 0, + '\0', + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hkResult, + &dwDisposition); + + if (dwDisposition == REG_CREATED_NEW_KEY) + { + ErrorF ("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey); + } + else if (dwDisposition == REG_OPENED_EXISTING_KEY) + { + ErrorF ("winGetRegistryDWORD - Opened existing key: %s\n", + pszRegistryKey); + } + + /* Free the registry key handle */ + RegCloseKey (hkResult); + hkResult = NULL; + + return 0; +} Index: xc/programs/Xserver/hw/xwin/winscrinit.c diff -u xc/programs/Xserver/hw/xwin/winscrinit.c:1.22 xc/programs/Xserver/hw/xwin/winscrinit.c:1.26 --- xc/programs/Xserver/hw/xwin/winscrinit.c:1.22 Sun Nov 11 17:45:57 2001 +++ xc/programs/Xserver/hw/xwin/winscrinit.c Wed Feb 12 10:01:38 2003 @@ -29,8 +29,9 @@ * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II + * Kensuke Matsuzaki */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.22 2001/11/11 22:45:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.26 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -48,16 +49,17 @@ { winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; winPrivScreenPtr pScreenPriv; - DEBUG_FN_NAME("winScreenInit"); - DEBUGVARS; - /*DEBUGPROC_MSG;*/ + HDC hdc; - DEBUG_MSG ("Hello"); +#if CYGDEBUG + ErrorF ("winScreenInit - dwWidth: %d dwHeight: %d\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight); +#endif /* Allocate privates for this screen */ if (!winAllocatePrivates (pScreen)) { - ErrorF ("winScreenInit () - Couldn't allocate screen privates\n"); + ErrorF ("winScreenInit - Couldn't allocate screen privates\n"); return FALSE; } @@ -68,67 +70,115 @@ pScreenInfo->pScreen = pScreen; /* Save a pointer to the screen info in the screen privates structure */ - /* This allows us to get back to the screen info from a sceen pointer */ + /* This allows us to get back to the screen info from a screen pointer */ pScreenPriv->pScreenInfo = pScreenInfo; - - /* Detect which engines are supported */ - winDetectSupportedEngines (pScreen); - /* Determine which engine to use */ + /* + * Determine which engine to use. + * + * NOTE: This is done once per screen because each screen possibly has + * a preferred engine specified on the command line. + */ if (!winSetEngine (pScreen)) { - ErrorF ("winScreenInit () - winSetEngine () failed\n"); + ErrorF ("winScreenInit - winSetEngine () failed\n"); return FALSE; } /* Adjust the video mode for our engine type */ if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) { - ErrorF ("winScreenInit () - winAdjustVideoMode () failed\n"); + ErrorF ("winScreenInit - winAdjustVideoMode () failed\n"); return FALSE; } /* Check for supported display depth */ - if (!(WIN_SUPPORTED_DEPTHS & (1 << (pScreenInfo->dwDepth - 1)))) + if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) { - ErrorF ("winScreenInit () - Unsupported display depth: %d\n" \ + ErrorF ("winScreenInit - Unsupported display depth: %d\n" \ "Change your Windows display depth to 15, 16, 24, or 32 bits " "per pixel.\n", - pScreenInfo->dwDepth); - ErrorF ("winScreenInit () - Supported depths: %08x\n", - WIN_SUPPORTED_DEPTHS); + pScreenInfo->dwBPP); + ErrorF ("winScreenInit - Supported depths: %08x\n", + WIN_SUPPORTED_BPPS); #if WIN_CHECK_DEPTH return FALSE; #endif } + /* + * Check that all monitors have the same display depth if we are using + * multiple monitors + */ + if (pScreenInfo->fMultipleMonitors + && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT)) + { + ErrorF ("winScreenInit - Monitors do not all have same pixel format / " + "display depth.\n" + "Using primary display only.\n"); + pScreenInfo->fMultipleMonitors = FALSE; + } + /* Create display window */ if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) { - ErrorF ("winScreenInitFB () - pwinCreateBoundingWindow () " + ErrorF ("winScreenInit - pwinCreateBoundingWindow () " "failed\n"); return FALSE; } - /* Set the padded screen width */ - pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, - pScreenInfo->dwDepth); + /* Get a device context */ + hdc = GetDC (pScreenPriv->hwndScreen); + + /* Store the initial height, width, and depth of the display */ + /* Are we using multiple monitors? */ + if (pScreenInfo->fMultipleMonitors) + { + pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + + /* + * In this case, some of the defaults set in + * winInitializeDefaultScreens () are not correct ... + */ + if (!pScreenInfo->fUserGaveHeightAndWidth) + { + pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth / + WIN_DEFAULT_DPI) * 25.4; + pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight / + WIN_DEFAULT_DPI) * 25.4; + } + } + else + { + pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); + pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); + } + + /* Save the original bits per pixel */ + pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL); + /* Release the device context */ + ReleaseDC (pScreenPriv->hwndScreen, hdc); + /* Clear the visuals list */ miClearVisualTypes (); - pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); - pScreenPriv->dwOrigDepth = pScreenInfo->dwDepth; + /* Set the padded screen width */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwBPP); /* Call the engine dependent screen initialization procedure */ if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) { - ErrorF ("winScreenInit () - winFinishScreenInit () failed\n"); + ErrorF ("winScreenInit - winFinishScreenInit () failed\n"); return FALSE; } #if CYGDEBUG || YES - ErrorF ("winScreenInit () - returning\n"); + ErrorF ("winScreenInit - returning\n"); #endif return TRUE; @@ -145,20 +195,37 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; VisualPtr pVisual = NULL; char *pbits = NULL; + int iReturn; +#if WIN_LAYER_SUPPORT pScreenPriv->dwLayerKind = LAYER_SHADOW; +#endif /* Create framebuffer */ if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) { - ErrorF ("winFinishScreenInitFB () - Could not allocate framebuffer\n"); + ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n"); return FALSE; } + /* + * Grab the number of bits that are used to represent color in each pixel. + */ + if (pScreenInfo->dwBPP == 8) + pScreenInfo->dwDepth = 8; + else + pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask) + + winCountBits (pScreenPriv->dwGreenMask) + + winCountBits (pScreenPriv->dwBlueMask); + + ErrorF ("winFinishScreenInitFB - Masks: %08x %08x %08x\n", + pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask); + /* Init visuals */ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { - ErrorF ("winFinishScreenInitFB () - winInitVisuals failed\n"); + ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n"); return FALSE; } @@ -176,7 +243,7 @@ pScreenInfo->dwStride, pScreenInfo->dwBPP)) { - ErrorF ("winFinishScreenInitFB () - fbSetupScreen failed\n"); + ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n"); return FALSE; } @@ -227,7 +294,7 @@ pScreenInfo->dwStride, pScreenInfo->dwBPP)) { - ErrorF ("winFinishScreenInitFB () - fbFinishScreenInit failed\n"); + ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n"); return FALSE; } @@ -250,7 +317,7 @@ /* Render extension initialization, calls miPictureInit */ if (!fbPictureInit (pScreen, NULL, 0)) { - ErrorF ("winFinishScreenInitFB () - fbPictureInit () failed\n"); + ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n"); return FALSE; } #endif @@ -259,21 +326,21 @@ /* KDrive does LayerStartInit right after fbPictureInit */ if (!LayerStartInit (pScreen)) { - ErrorF ("winFinishScreenInitFB () - LayerStartInit () failed\n"); + ErrorF ("winFinishScreenInitFB - LayerStartInit () failed\n"); return FALSE; } /* Not sure what we're adding to shadow, but add it anyway */ if (!shadowAdd (pScreen, 0, pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) { - ErrorF ("winFinishScreenInitFB () - shadowAdd () failed\n"); + ErrorF ("winFinishScreenInitFB - shadowAdd () failed\n"); return FALSE; } /* KDrive does LayerFinishInit right after LayerStartInit */ if (!LayerFinishInit (pScreen)) { - ErrorF ("winFinishScreenInitFB () - LayerFinishInit () failed\n"); + ErrorF ("winFinishScreenInitFB - LayerFinishInit () failed\n"); return FALSE; } @@ -281,7 +348,7 @@ pScreenPriv->pLayer = winLayerCreate (pScreen); if (!pScreenPriv->pLayer) { - ErrorF ("winFinishScreenInitFB () - winLayerCreate () failed\n"); + ErrorF ("winFinishScreenInitFB - winLayerCreate () failed\n"); return FALSE; } @@ -289,7 +356,7 @@ #ifdef RANDR if (pScreenInfo->dwDepth != 8 && !winRandRInit (pScreen)) { - ErrorF ("winFinishScreenInitFB () - winRandRInit () failed\n"); + ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n"); return FALSE; } #endif @@ -304,18 +371,18 @@ /* KDrive does miDCInitialize right after miInitializeBackingStore */ /* Setup the cursor routines */ #if CYGDEBUG - ErrorF ("winFinishScreenInitFB () - Calling miDCInitialize ()\n"); + ErrorF ("winFinishScreenInitFB - Calling miDCInitialize ()\n"); #endif miDCInitialize (pScreen, &g_winPointerCursorFuncs); /* KDrive does winCreateDefColormap right after miDCInitialize */ /* Create a default colormap */ #if CYGDEBUG - ErrorF ("winFinishScreenInitFB () - Calling winCreateDefColormap ()\n"); + ErrorF ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n"); #endif if (!winCreateDefColormap (pScreen)) { - ErrorF ("winFinishScreenInitFB () - Could not create colormap\n"); + ErrorF ("winFinishScreenInitFB - Could not create colormap\n"); return FALSE; } @@ -326,27 +393,162 @@ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) { #if CYGDEBUG - ErrorF ("winFinishScreenInitFB () - Calling shadowInit ()\n"); + ErrorF ("winFinishScreenInitFB - Calling shadowInit ()\n"); #endif if (!shadowInit (pScreen, pScreenPriv->pwinShadowUpdate, NULL)) { - ErrorF ("winFinishScreenInitFB () - shadowInit () failed\n"); + ErrorF ("winFinishScreenInitFB - shadowInit () failed\n"); return FALSE; } } #endif + + /* Handle pseudo-rootless mode */ + if (pScreenInfo->fRootless) + { + /* Define the WRAP macro temporarily for local use */ +#define WRAP(a) \ + if (pScreen->a) { \ + pScreenPriv->a = pScreen->a; \ + } else { \ + ErrorF("null screen fn " #a "\n"); \ + pScreenPriv->a = NULL; \ + } + + /* Save a pointer to each lower-level window procedure */ + WRAP(CreateWindow); + WRAP(DestroyWindow); + WRAP(RealizeWindow); + WRAP(UnrealizeWindow); + WRAP(PositionWindow); + WRAP(ChangeWindowAttributes); +#ifdef SHAPE + WRAP(SetShape); +#endif + + /* Assign pseudo-rootless window procedures to be top level procedures */ + pScreen->CreateWindow = winCreateWindowPRootless; + pScreen->DestroyWindow = winDestroyWindowPRootless; + pScreen->PositionWindow = winPositionWindowPRootless; + pScreen->ChangeWindowAttributes = winChangeWindowAttributesPRootless; + pScreen->RealizeWindow = winMapWindowPRootless; + pScreen->UnrealizeWindow = winUnmapWindowPRootless; +#ifdef SHAPE + pScreen->SetShape = winSetShapePRootless; +#endif + + /* Undefine the WRAP macro, as it is not needed elsewhere */ +#undef WRAP + } + /* Handle multi window mode */ + else if (pScreenInfo->fMultiWindow) + { + /* Define the WRAP macro temporarily for local use */ +#define WRAP(a) \ + if (pScreen->a) { \ + pScreenPriv->a = pScreen->a; \ + } else { \ + ErrorF("null screen fn " #a "\n"); \ + pScreenPriv->a = NULL; \ + } + + /* Save a pointer to each lower-level window procedure */ + WRAP(CreateWindow); + WRAP(DestroyWindow); + WRAP(RealizeWindow); + WRAP(UnrealizeWindow); + WRAP(PositionWindow); + WRAP(ChangeWindowAttributes); + WRAP(ReparentWindow); + WRAP(RestackWindow); +#ifdef SHAPE + WRAP(SetShape); +#endif + + /* Assign multi-window window procedures to be top level procedures */ + pScreen->CreateWindow = winCreateWindowMultiWindow; + pScreen->DestroyWindow = winDestroyWindowMultiWindow; + pScreen->PositionWindow = winPositionWindowMultiWindow; + pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow; + pScreen->RealizeWindow = winMapWindowMultiWindow; + pScreen->UnrealizeWindow = winUnmapWindowMultiWindow; + pScreen->ReparentWindow = winReparentWindowMultiWindow; + pScreen->RestackWindow = winRestackWindowMultiWindow; +#ifdef SHAPE + pScreen->SetShape = winSetShapeMultiWindow; +#endif + + /* Undefine the WRAP macro, as it is not needed elsewhere */ +#undef WRAP + } + /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; + /* Create a mutex for modules in seperate threads to wait for */ + iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL); + if (iReturn != 0) + { + ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n", + iReturn); + return FALSE; + } + + /* Own the mutex for modules in seperate threads */ + iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted); + if (iReturn != 0) + { + ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n", + iReturn); + return FALSE; + } + + /* Set the ServerStarted flag to false */ + pScreenPriv->fServerStarted = FALSE; + +#if CYGDEBUG || YES + if (pScreenInfo->fMultiWindow) + ErrorF ("winFinishScreenInitFB - Calling winInitWM.\n"); +#endif + + /* Initialize multi window mode */ + if (pScreenInfo->fMultiWindow + && !winInitWM (&pScreenPriv->pWMInfo, + &pScreenPriv->ptWMProc, + &pScreenPriv->pmServerStarted, + pScreenInfo->dwScreen)) + { + ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n"); + return FALSE; + } + +#if CYGDEBUG || YES + if (pScreenInfo->fClipboard) + ErrorF ("winFinishScreenInitFB - Calling winInitClipboard.\n"); +#endif + + /* Initialize the clipboard manager */ + if (pScreenInfo->fClipboard + && !winInitClipboard (&pScreenPriv->ptClipboardProc, + &pScreenPriv->pmServerStarted, + pScreenInfo->dwScreen)) + { + ErrorF ("winFinishScreenInitFB - winClipboardInit () failed.\n"); + return FALSE; + } + /* Tell the server that we are enabled */ pScreenPriv->fEnabled = TRUE; -#if CYGDEBUG - ErrorF ("winFinishScreenInitFB () - returning\n"); + /* Tell the server that we have a valid depth */ + pScreenPriv->fBadDepth = FALSE; + +#if CYGDEBUG || YES + ErrorF ("winFinishScreenInitFB - returning\n"); #endif return TRUE; @@ -387,12 +589,12 @@ /* Get device contexts for the screen and shadow bitmap */ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); if (pScreenPriv->hdcScreen == NULL) - FatalError ("winFinishScreenInitNativeGDI () - Couldn't get a DC\n"); + FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n"); /* Init visuals */ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { - ErrorF ("winFinishScreenInitNativeGDI () - pwinInitVisuals failed\n"); + ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n"); return FALSE; } @@ -402,7 +604,7 @@ ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8, TrueColor)) { - ErrorF ("winFinishScreenInitNativeGDI () - miInitVisuals () failed\n"); + ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n"); return FALSE; } @@ -414,11 +616,11 @@ NULL, /* No framebuffer */ pScreenInfo->dwWidth, pScreenInfo->dwHeight, monitorResolution, monitorResolution, - pScreenInfo->dwStride, + pScreenInfo->dwWidth, nRootDepth, nDepths, pDepths, rootVisual, nVisuals, pVisuals)) { - ErrorF ("winFinishScreenInitNativeGDI () - miScreenInit failed\n"); + ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n"); return FALSE; } @@ -477,7 +679,7 @@ /* Bitmap */ pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; - ErrorF ("winFinishScreenInitNativeGDI () - calling miDCInitialize\n"); + ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n"); /* Set the default white and black pixel positions */ pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0; @@ -485,19 +687,19 @@ /* Initialize the cursor */ if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) { - ErrorF ("winFinishScreenInitNativeGDI () - miDCInitialize failed\n"); + ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n"); return FALSE; } /* Create a default colormap */ if (!miCreateDefColormap (pScreen)) { - ErrorF ("winFinishScreenInitNativeGDI () - miCreateDefColormap () " + ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " "failed\n"); return FALSE; } - ErrorF ("winFinishScreenInitNativeGDI () - miCreateDefColormap () " + ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " "returned\n"); /* mi doesn't use a CloseScreen procedure, so no need to wrap */ @@ -506,7 +708,7 @@ /* Tell the server that we are enabled */ pScreenPriv->fEnabled = TRUE; - ErrorF ("winFinishScreenInitNativeGDI () - Successful addition of " + ErrorF ("winFinishScreenInitNativeGDI - Successful addition of " "screen %08x\n", pScreen); Index: xc/programs/Xserver/hw/xwin/winshaddd.c diff -u xc/programs/Xserver/hw/xwin/winshaddd.c:1.19 xc/programs/Xserver/hw/xwin/winshaddd.c:1.23 --- xc/programs/Xserver/hw/xwin/winshaddd.c:1.19 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winshaddd.c Wed Feb 12 10:01:38 2003 @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.19 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.23 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -52,13 +52,109 @@ DEFINE_GUID( IID_IDirectDraw2,0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); #endif /* IID_IDirectDraw2 */ + /* + * Create the primary surface and attach the clipper. + * Used for both the initial surface creation and during + * WM_DISPLAYCHANGE messages. + */ + +Bool +winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDD - Could not create primary " + "surface: %08x\n", ddrval); + return FALSE; + } + +#if CYGDEBUG + ErrorF ("winCreatePrimarySurfaceShadowDD - Created primary surface\n"); +#endif + + /* + * Attach a clipper to the primary surface that will clip our blits to our + * display window. + */ + ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDD - Primary attach clipper " + "failed: %08x\n", + ddrval); + return FALSE; + } + +#if CYGDEBUG + ErrorF ("winCreatePrimarySurfaceShadowDD - Attached clipper to " + "primary surface\n"); +#endif + + /* Everything was correct */ + return TRUE; +} + + +/* + * Detach the clipper and release the primary surface. + * Called from WM_DISPLAYCHANGE. + */ + +Bool +winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + ErrorF ("winReleasePrimarySurfaceShadowDD - Hello\n"); + + /* Release the primary surface and clipper, if they exist */ + if (pScreenPriv->pddsPrimary) + { + /* + * Detach the clipper from the primary surface. + * NOTE: We do this explicity for clarity. The Clipper is not released. + */ + IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, + NULL); + + ErrorF ("winReleasePrimarySurfaceShadowDD - Detached clipper\n"); + + /* Release the primary surface */ + IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + ErrorF ("winReleasePrimarySurfaceShadowDD - Released primary surface\n"); + + return TRUE; +} + + +/* * Create a DirectDraw surface for the shadow framebuffer; also create * a primary surface object so we can blit to the display. * * Install a DirectDraw clipper on our primary surface object * that clips our blits to the unobscured client area of our display window. */ + Bool winAllocateFBShadowDD (ScreenPtr pScreen) { @@ -67,47 +163,50 @@ HRESULT ddrval = DD_OK; DDSURFACEDESC ddsd; DDSURFACEDESC *pddsdShadow = NULL; - + #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD ()\n"); + ErrorF ("winAllocateFBShadowDD\n"); #endif /* Create a clipper */ - ddrval = DirectDrawCreateClipper (0, - &pScreenPriv->pddcPrimary, - NULL); + ddrval = (*g_fpDirectDrawCreateClipper) (0, + &pScreenPriv->pddcPrimary, + NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not create clipper: %08x\n", + ErrorF ("winAllocateFBShadowDD - Could not create clipper: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Created a clipper\n"); + ErrorF ("winAllocateFBShadowDD - Created a clipper\n"); #endif + /* Get a device context for the screen */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, 0, pScreenPriv->hwndScreen); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Clipper not attached to " + ErrorF ("winAllocateFBShadowDD - Clipper not attached to " "window: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Attached clipper to window\n"); + ErrorF ("winAllocateFBShadowDD - Attached clipper to window\n"); #endif /* Create a DirectDraw object, store the address at lpdd */ - ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); + ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not start DirectDraw: %08x\n", + ErrorF ("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n", ddrval); return FALSE; } @@ -122,12 +221,12 @@ (LPVOID*) &pScreenPriv->pdd2); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Failed DD2 query: %08x\n", + ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n", ddrval); return FALSE; } - /* FIXME: If we are full screen we don't need the clipper */ + /* Are we full screen? */ if (pScreenInfo->fFullScreen) { DDSURFACEDESC ddsdCurrent; @@ -141,7 +240,7 @@ | DDSCL_FULLSCREEN); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not set "\ + ErrorF ("winAllocateFBShadowDD - Could not set " "cooperative level: %08x\n", ddrval); return FALSE; @@ -161,7 +260,7 @@ &ddsdCurrent); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not get current " + ErrorF ("winAllocateFBShadowDD - Could not get current " "refresh rate: %08x. Continuing.\n", ddrval); dwRefreshRateCurrent = 0; @@ -186,28 +285,29 @@ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winAllocateFBShadowDD () - GetDC () failed\n"); + ErrorF ("winAllocateFBShadowDD - GetDC () failed\n"); return FALSE; } /* Only change the video mode when different than current mode */ - if (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) - || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) - || pScreenInfo->dwDepth != GetDeviceCaps (hdc, BITSPIXEL) - || pScreenInfo->dwRefreshRate != 0) + if (!pScreenInfo->fMultipleMonitors + && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) + || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) + || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL) + || pScreenInfo->dwRefreshRate != 0)) { - ErrorF ("winAllocateFBShadowDD () - Changing video mode\n"); + ErrorF ("winAllocateFBShadowDD - Changing video mode\n"); /* Change the video mode to the mode requested */ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenInfo->dwDepth, + pScreenInfo->dwBPP, pScreenInfo->dwRefreshRate, 0); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not set "\ + ErrorF ("winAllocateFBShadowDD - Could not set "\ "full screen display mode: %08x\n", ddrval); return FALSE; @@ -215,7 +315,7 @@ } else { - ErrorF ("winAllocateFBShadowDD () - Not changing video mode\n"); + ErrorF ("winAllocateFBShadowDD - Not changing video mode\n"); } /* Release our DC */ @@ -230,53 +330,21 @@ DDSCL_NORMAL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not set "\ + ErrorF ("winAllocateFBShadowDD - Could not set "\ "cooperative level: %08x\n", ddrval); return FALSE; } } - /* Describe the primary surface */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - /* Create the primary surface */ - ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, - &ddsd, - &pScreenPriv->pddsPrimary, - NULL); - if (FAILED (ddrval)) + if (!winCreatePrimarySurfaceShadowDD (pScreen)) { - ErrorF ("winAllocateFBShadowDD () - Could not create primary "\ - "surface: %08x\n", ddrval); - return FALSE; - } - -#if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Created primary\n"); -#endif - - /* - * Attach a clipper to the primary surface that will clip our blits to our - * display window. - */ - ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, - pScreenPriv->pddcPrimary); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD () - Primary attach clipper " - "failed: %08x\n", - ddrval); + ErrorF ("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD " + "failed\n"); return FALSE; } -#if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Attached clipper to primary surface\n"); -#endif - /* Describe the shadow surface to be created */ /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, * as drawing, locking, and unlocking take forever @@ -299,20 +367,20 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not create shadow "\ + ErrorF ("winAllocateFBShadowDD - Could not create shadow "\ "surface: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Created shadow\n"); + ErrorF ("winAllocateFBShadowDD - Created shadow\n"); #endif /* Allocate a DD surface description for our screen privates */ - pddsdShadow = pScreenPriv->pddsdShadow = xalloc (sizeof (DDSURFACEDESC)); + pddsdShadow = pScreenPriv->pddsdShadow = malloc (sizeof (DDSURFACEDESC)); if (pddsdShadow == NULL) { - ErrorF ("winAllocateFBShadowDD () - Could not allocate surface "\ + ErrorF ("winAllocateFBShadowDD - Could not allocate surface "\ "description memory\n"); return FALSE; } @@ -320,7 +388,7 @@ pddsdShadow->dwSize = sizeof (*pddsdShadow); #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Locking shadow\n"); + ErrorF ("winAllocateFBShadowDD - Locking shadow\n"); #endif /* Lock the shadow surface */ @@ -331,44 +399,46 @@ NULL); if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL) { - ErrorF ("winAllocateFBShadowDD () - Could not lock shadow "\ + ErrorF ("winAllocateFBShadowDD - Could not lock shadow "\ "surface: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Locked shadow\n"); + ErrorF ("winAllocateFBShadowDD - Locked shadow\n"); #endif /* We don't know how to deal with anything other than RGB */ if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) { - ErrorF ("winAllocateFBShadowDD () - Color format other than RGB\n"); + ErrorF ("winAllocateFBShadowDD - Color format other than RGB\n"); return FALSE; } - /* Grab the pitch, and memory pointer from the surface desc */ - pScreenInfo->dwStrideBytes = pddsdShadow->u1.lPitch; - pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) - / pScreenInfo->dwDepth; + /* Grab the pitch from the surface desc */ + pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8) + / pScreenInfo->dwBPP; + + /* Save the pointer to our surface memory */ pScreenInfo->pfb = pddsdShadow->lpSurface; /* Grab the color depth and masks from the surface description */ - pScreenInfo->dwDepth = pddsdShadow->ddpfPixelFormat.u1.dwRGBBitCount; pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask; pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; - + #if CYGDEBUG - ErrorF ("winAllocateFBShadowDD () - Returning\n"); + ErrorF ("winAllocateFBShadowDD - Returning\n"); #endif return TRUE; } + /* * Transfer the damaged regions of the shadow framebuffer to the display. */ + void winShadowUpdateDD (ScreenPtr pScreen, shadowBufPtr pBuf) @@ -377,52 +447,112 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; RegionPtr damage = &pBuf->damage; HRESULT ddrval = DD_OK; - RECT rcClient, rcDest, rcSrc; + RECT rcDest, rcSrc; + POINT ptOrigin; DWORD dwBox = REGION_NUM_RECTS (damage); BoxPtr pBox = REGION_RECTS (damage); + HRGN hrgnTemp = NULL, hrgnCombined = NULL; - /* Return immediately if the app is not active and we are fullscreen */ - if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + /* + * Return immediately if the app is not active + * and we are fullscreen, or if we have a bad display depth + */ + if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) + || pScreenPriv->fBadDepth) return; - /* Get location of display window's client area, in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, 2); + (LPPOINT)&ptOrigin, 1); /* Unlock the shadow surface, so we can blit */ ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); if (FAILED (ddrval)) { - ErrorF ("winShadowUpdateProcDD () - Unlock failed\n"); + ErrorF ("winShadowUpdateProcDD - Unlock failed\n"); return; } - /* Loop through all boxes in the damaged region */ - while (dwBox--) + /* + * Handle small regions with multiple blits, + * handle large regions by creating a clipping region and + * doing a single blit constrained to that clipping region. + */ + if (pScreenInfo->dwClipUpdatesNBoxes == 0 + || dwBox < pScreenInfo->dwClipUpdatesNBoxes) { - /* Assign damage box to source rectangle */ - rcSrc.left = pBox->x1; - rcSrc.top = pBox->y1; - rcSrc.right = pBox->x2; - rcSrc.bottom = pBox->y2; - - /* Calculate destination rectange */ - rcDest.left = rcClient.left + rcSrc.left; - rcDest.top = rcClient.top + rcSrc.top; - rcDest.right = rcClient.left + rcSrc.right; - rcDest.bottom = rcClient.top + rcSrc.bottom; + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectange */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Get a pointer to the next box */ + ++pBox; + } + } + else + { + BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage); - /* Blit the damaged areas */ + /* Compute a GDI region from the damaged region */ + hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + dwBox--; + pBox++; + while (dwBox--) + { + hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); + DeleteObject (hrgnTemp); + pBox++; + } + + /* Install the GDI region as a clipping region */ + SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); + DeleteObject (hrgnCombined); + hrgnCombined = NULL; + + /* Calculating a bounding box for the source is easy */ + rcSrc.left = pBoxExtents->x1; + rcSrc.top = pBoxExtents->y1; + rcSrc.right = pBoxExtents->x2; + rcSrc.bottom = pBoxExtents->y2; + + /* Calculating a bounding box for the destination is trickier */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Our Blt should be clipped to the invalidated region */ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, &rcDest, pScreenPriv->pddsShadow, &rcSrc, DDBLT_WAIT, NULL); - - /* Get a pointer to the next box */ - ++pBox; + + /* Reset the clip region */ + SelectClipRgn (pScreenPriv->hdcScreen, NULL); } /* Relock the shadow surface */ @@ -433,13 +563,20 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winShadowUpdateProcDD () - Lock failed\n"); + ErrorF ("winShadowUpdateProcDD - Lock failed\n"); return; } /* Has our memory pointer changed? */ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) { + ErrorF ("winShadowUpdateProcDD - Memory location of the shadow " + "surface has changed, trying to update the root window " + "pixmap header to point to the new address. If you get " + "this message and Cygwin/XFree86 freezes or crashes " + "after this message then send a problem report and your " + "/tmp/XWin.log file to cygwin-xfree@cygwin.com\n"); + /* Location of shadow framebuffer has changed */ pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; @@ -450,21 +587,23 @@ pScreen->rootDepth, BitsPerPixel (pScreen->rootDepth), PixmapBytePad (pScreenInfo->dwStride, - pScreenInfo->dwDepth), + pScreenInfo->dwBPP), pScreenInfo->pfb)) { - ErrorF ("winShadowUpdateProcDD () - Bits changed, could not "\ + ErrorF ("winShadowUpdateProcDD - Bits changed, could not " "notify fb.\n"); return; } } } + /* * Call the wrapped CloseScreen function. * * Free our resources and private structures. */ + Bool winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) { @@ -473,7 +612,7 @@ Bool fReturn; #if CYGDEBUG - ErrorF ("winCloseScreenShadowDD () - Freeing screen resources\n"); + ErrorF ("winCloseScreenShadowDD - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ @@ -484,6 +623,9 @@ pScreen->CloseScreen = pScreenPriv->CloseScreen; fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); @@ -495,6 +637,18 @@ pScreenPriv->pddsShadow = NULL; } + /* Detach the clipper from the primary surface and release the clipper. */ + if (pScreenPriv->pddcPrimary) + { + /* Detach the clipper */ + IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, + NULL); + + /* Release the clipper object */ + IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); + pScreenPriv->pddcPrimary = NULL; + } + /* Release the primary surface, if there is one */ if (pScreenPriv->pddsPrimary) { @@ -524,6 +678,9 @@ pScreenPriv->hwndScreen = NULL; } + /* Destroy the thread startup mutex */ + pthread_mutex_destroy (&pScreenPriv->pmServerStarted); + /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; @@ -531,11 +688,12 @@ pScreenInfo->pfb = NULL; /* Free the screen privates for this screen */ - xfree ((pointer) pScreenPriv); + free ((pointer) pScreenPriv); return fReturn; } + /* * Tell mi what sort of visuals we need. * @@ -543,6 +701,7 @@ * handle one format at a time, I believe. You may want * to verify that last sentence. */ + Bool winInitVisualsShadowDD (ScreenPtr pScreen) { @@ -565,20 +724,22 @@ else pScreenPriv->dwBitsPerRGB = dwBlueBits; - ErrorF ("winInitVisualsShadowDD () - Masks %08x %08x %08x BPRGB %d d %d\n", + ErrorF ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d " + "bpp %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, pScreenPriv->dwBitsPerRGB, - pScreenInfo->dwDepth); + pScreenInfo->dwDepth, + pScreenInfo->dwBPP); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { - case 32: case 24: case 16: case 15: +#if defined(XFree86Server) /* Create the real visual */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, TrueColorMask, @@ -588,13 +749,65 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks "\ - "failed\n"); + ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " + "failed for TrueColor\n"); + return FALSE; + } + +#if WIN_EMULATE_PSEUDO_SUPPORT + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!miSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + -1, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " + "failed for PseudoColor\n"); return FALSE; } +#endif +#else /* XFree86Server */ + /* Create the real visual */ + if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDD - fbSetVisualTypesAndMasks " + "failed for TrueColor\n"); + return FALSE; + } + +#if WIN_EMULATE_PSEUDO_SUPPORT + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!fbSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowDD - fbSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif +#endif /* XFree86Server */ break; case 8: +#if defined(XFree86Server) if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, pScreenInfo->fFullScreen ? PseudoColorMask : StaticColorMask, @@ -605,75 +818,94 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsShadowDD () - "\ - "miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } +#else /* XFree86Server */ + if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth, + pScreenInfo->fFullScreen + ? PseudoColorMask : StaticColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDD - fbSetVisualTypesAndMasks " + "failed\n"); return FALSE; } +#endif /* XFree86Server */ break; default: - ErrorF ("winInitVisualsDD () - Unknown screen depth\n"); + ErrorF ("winInitVisualsShadowDD - Unknown screen depth\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winInitVisualsShadowDD () - Returning\n"); + ErrorF ("winInitVisualsShadowDD - Returning\n"); #endif return TRUE; } + +/* + * Adjust the user proposed video mode + */ + Bool winAdjustVideoModeShadowDD (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc = NULL; - DWORD dwDepth; + DWORD dwBPP; /* We're in serious trouble if we can't get a DC */ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winAdjustVideoModeShadowDD () - GetDC () failed\n"); + ErrorF ("winAdjustVideoModeShadowDD - GetDC () failed\n"); return FALSE; } /* Query GDI for current display depth */ - dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) { /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowDD () - Using Windows display " - "depth of %d bits per pixel\n", dwDepth); + ErrorF ("winAdjustVideoModeShadowDD - Using Windows display " + "depth of %d bits per pixel\n", dwBPP); /* Use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } else if (pScreenInfo->fFullScreen - && pScreenInfo->dwDepth != dwDepth) + && pScreenInfo->dwBPP != dwBPP) { /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDD () - FullScreen, using command line " - "depth: %d\n", pScreenInfo->dwDepth); + ErrorF ("winAdjustVideoModeShadowDD - FullScreen, using command line " + "bpp: %d\n", pScreenInfo->dwBPP); } - else if (dwDepth != pScreenInfo->dwDepth) + else if (dwBPP != pScreenInfo->dwBPP) { /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDD () - Windowed, command line depth: " - "%d, using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + ErrorF ("winAdjustVideoModeShadowDD - Windowed, command line bpp: " + "%d, using bpp: %d\n", pScreenInfo->dwBPP, dwBPP); /* We'll use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwDepth + if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP >= WIN_DIB_MAXIMUM_SIZE) { - ErrorF ("winAdjustVideoModeShadowDD () - Requested DirectDraw surface " + ErrorF ("winAdjustVideoModeShadowDD - Requested DirectDraw surface " "will be larger than %d MB. The surface may fail to be " "allocated on Windows 95, 98, or Me, due to a %d MB limit in " "DIB size. This limit does not apply to Windows NT/2000, and " @@ -685,25 +917,31 @@ ReleaseDC (NULL, hdc); return TRUE; } + + +/* + * Blt exposed regions to the screen + */ -/* Blt exposed regions to the screen */ Bool winBltExposedRegionsShadowDD (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RECT rcClient, rcSrc; + RECT rcSrc, rcDest; + POINT ptOrigin; HDC hdcUpdate = NULL; PAINTSTRUCT ps; HRESULT ddrval = DD_OK; Bool fReturn = TRUE; Bool fLocked = TRUE; + int i; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); if (hdcUpdate == NULL) { - ErrorF ("winBltExposedRegionsShadowDD () - BeginPaint () returned " + ErrorF ("winBltExposedRegionsShadowDD - BeginPaint () returned " "a NULL device context handle. Aborting blit attempt.\n"); return FALSE; } @@ -721,39 +959,75 @@ fLocked = FALSE; } - /* Get client area in screen coords */ - fReturn = GetClientRect (pScreenPriv->hwndScreen, &rcClient); - if (!fReturn) - { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDD () - GetClientRect () failed\n"); - goto winBltExposedRegionsShadowDD_Exit; - } - - /* Map the client coords to screen coords */ + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, - 2); - + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; + /* Source can be enter shadow surface, as Blt should clip */ rcSrc.left = 0; rcSrc.top = 0; rcSrc.right = pScreenInfo->dwWidth; rcSrc.bottom = pScreenInfo->dwHeight; - /* Our Blt should be clipped to the invalidated region */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcClient, - pScreenPriv->pddsShadow, - &rcSrc, - DDBLT_WAIT, - NULL); - if (FAILED (ddrval)) + /* Try to regain the primary surface and blit again if we've lost it */ + for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDD () - Blt from shadow to primary " - " failed\n"); + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + /* Surface was lost */ + ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt " + "reported that the primary surface was lost, " + "trying to restore, retry: %d\n", i + 1); + + /* Try to restore the surface, once */ + ddrval = IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + ErrorF ("winBltExposedRegionsShadowDDNL - " + "IDirectDrawSurface2_Restore returned: "); + if (ddrval == DD_OK) + continue; + else if (ddrval == DDERR_WRONGMODE) + ErrorF ("DDERR_WRONGMODE\n"); + else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) + ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n"); + else if (ddrval == DDERR_UNSUPPORTED) + ErrorF ("DDERR_UNSUPPORTED\n"); + else if (ddrval == DDERR_INVALIDPARAMS) + ErrorF ("DDERR_INVALIDPARAMS\n"); + else if (ddrval == DDERR_INVALIDOBJECT) + ErrorF ("DDERR_INVALIDOBJECT\n"); + else + ErrorF ("unknown error: %08x\n", ddrval); + + /* Loop around to try the blit one more time */ + continue; + } + else if (FAILED (ddrval)) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt " + "failed, but surface not lost: %08x %d\n", ddrval, ddrval); + goto winBltExposedRegionsShadowDD_Exit; + } + else + { + /* Success, stop looping */ + break; + } } /* Relock the shadow surface */ @@ -765,7 +1039,7 @@ if (FAILED (ddrval)) { fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDD () - IDirectDrawSurface2_Lock " + ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock " "failed\n"); goto winBltExposedRegionsShadowDD_Exit; } @@ -807,6 +1081,11 @@ return fReturn; } + +/* + * Do any engine-specific appliation-activation processing + */ + Bool winActivateAppShadowDD (ScreenPtr pScreen) { @@ -819,8 +1098,7 @@ */ if (pScreenPriv != NULL && pScreenPriv->pddsPrimary != NULL - && pScreenPriv->fActive - ) + && pScreenPriv->fActive) { /* Primary surface was lost, restore it */ IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); @@ -840,13 +1118,19 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HRESULT ddrval = DD_OK; - RECT rcClient, rcSrc; + RECT rcSrc, rcDest; + POINT ptOrigin; - /* Get location of display window's client area, in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, 2); + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; /* Source can be entire shadow surface, as Blt should clip for us */ rcSrc.left = 0; @@ -856,14 +1140,14 @@ /* Redraw the whole window, to take account for the new colors */ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcClient, + &rcDest, pScreenPriv->pddsShadow, &rcSrc, DDBLT_WAIT, NULL); if (FAILED (ddrval)) { - ErrorF ("winRedrawScreenShadowDD () - IDirectDrawSurface_Blt () " + ErrorF ("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () " "failed: %08x\n", ddrval); } @@ -872,7 +1156,10 @@ } -/* Realize the currently installed colormap */ +/* + * Realize the currently installed colormap + */ + Bool winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen) { @@ -880,7 +1167,10 @@ } -/* Install the specified colormap */ +/* + * Install the specified colormap + */ + Bool winInstallColormapShadowDD (ColormapPtr pColormap) { @@ -894,7 +1184,7 @@ pCmapPriv->lpDDPalette); if (FAILED (ddrval)) { - ErrorF ("winInstallColormapShadowDD () - Failed installing the " + ErrorF ("winInstallColormapShadowDD - Failed installing the " "DirectDraw palette.\n"); return FALSE; } @@ -905,8 +1195,11 @@ return TRUE; } + +/* + * Store the specified colors in the specified colormap + */ -/* Store the specified colors in the specified colormap */ Bool winStoreColorsShadowDD (ColormapPtr pColormap, int ndef, @@ -915,7 +1208,7 @@ ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winCmapPriv(pColormap); - ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; HRESULT ddrval = DD_OK; /* Put the X colormap entries into the Windows logical palette */ @@ -927,7 +1220,7 @@ + pdefs[0].pixel); if (FAILED (ddrval)) { - ErrorF ("winStoreColorsShadowDDNL () - SetEntries () failed\n"); + ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed\n"); return FALSE; } @@ -939,15 +1232,18 @@ if (!winInstallColormapShadowDD (pColormap)) { - ErrorF ("winStoreColorsShadowDDNL () - Failed installing colormap\n"); + ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n"); return FALSE; } return TRUE; } + +/* + * Colormap initialization procedure + */ -/* Colormap initialization procedure */ Bool winCreateColormapShadowDD (ColormapPtr pColormap) { @@ -964,7 +1260,7 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winCreateColormapShadowDDNL () - CreatePalette failed\n"); + ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n"); return FALSE; } @@ -972,7 +1268,10 @@ } -/* Colormap destruction procedure */ +/* + * Colormap destruction procedure + */ + Bool winDestroyColormapShadowDD (ColormapPtr pColormap) { @@ -991,7 +1290,7 @@ if (pColormap->flags & IsDefault) { #if CYGDEBUG - ErrorF ("winDestroyColormapShadowDDNL () - Destroying default " + ErrorF ("winDestroyColormapShadowDDNL - Destroying default " "colormap\n"); #endif @@ -1005,7 +1304,7 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winDestroyColormapShadowDDNL () - Failed freeing the " + ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the " "default colormap DirectDraw palette.\n"); return FALSE; } @@ -1024,7 +1323,10 @@ } -/* Set engine specific functions */ +/* + * Set engine specific functions + */ + Bool winSetEngineFunctionsShadowDD (ScreenPtr pScreen) { @@ -1051,9 +1353,10 @@ pScreenPriv->pwinStoreColors = winStoreColorsShadowDD; pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD; pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD; + pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD; return TRUE; } - Index: xc/programs/Xserver/hw/xwin/winshadddnl.c diff -u xc/programs/Xserver/hw/xwin/winshadddnl.c:1.20 xc/programs/Xserver/hw/xwin/winshadddnl.c:1.24 --- xc/programs/Xserver/hw/xwin/winshadddnl.c:1.20 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winshadddnl.c Wed Feb 12 10:01:38 2003 @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.20 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.24 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" @@ -51,6 +51,101 @@ DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); #endif /* IID_IDirectDraw4 */ + +/* + * Create the primary surface and attach the clipper. + * Used for both the initial surface creation and during + * WM_DISPLAYCHANGE messages. + */ + +Bool +winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + HRESULT ddrval = DD_OK; + DDSURFACEDESC2 ddsd; + + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n"); + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, + &ddsd, + &pScreenPriv->pddsPrimary4, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create primary " + "surface: %08x\n", + ddrval); + return FALSE; + } + +#if 1 + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n"); +#endif + + /* Attach our clipper to our primary surface handle */ + ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper " + "failed: %08x\n", + ddrval); + return FALSE; + } + +#if 1 + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary " + "surface\n"); +#endif + + /* Everything was correct */ + return TRUE; +} + + +/* + * Detach the clipper and release the primary surface. + * Called from WM_DISPLAYCHANGE. + */ + +Bool +winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + ErrorF ("winReleasePrimarySurfaceShadowDDNL - Hello\n"); + + /* Release the primary surface and clipper, if they exist */ + if (pScreenPriv->pddsPrimary4) + { + /* + * Detach the clipper from the primary surface. + * NOTE: We do this explicity for clarity. The Clipper is not released. + */ + IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, + NULL); + + ErrorF ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n"); + + /* Release the primary surface */ + IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); + pScreenPriv->pddsPrimary4 = NULL; + } + + ErrorF ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n"); + + return TRUE; +} + + /* * Create a DirectDraw surface for the shadow framebuffer; also create * a primary surface object so we can blit to the display. @@ -58,27 +153,27 @@ * Install a DirectDraw clipper on our primary surface object * that clips our blits to the unobscured client area of our display window. */ + Bool winAllocateFBShadowDDNL (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HRESULT ddrval = DD_OK; - DDSURFACEDESC2 ddsdPrimary; DDSURFACEDESC2 ddsdShadow; char *lpSurface = NULL; DDPIXELFORMAT ddpfPrimary; #if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - w %d h %d d %d\n", + ErrorF ("winAllocateFBShadowDDNL - w %d h %d d %d\n", pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); #endif /* Allocate memory for our shadow surface */ - lpSurface = xalloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); + lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); if (lpSurface == NULL) { - ErrorF ("winAllocateFBShadowDDNL () - Could not allocate bits\n"); + ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n"); return FALSE; } @@ -89,50 +184,53 @@ ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); /* Create a clipper */ - ddrval = DirectDrawCreateClipper (0, - &pScreenPriv->pddcPrimary, - NULL); + ddrval = (*g_fpDirectDrawCreateClipper) (0, + &pScreenPriv->pddcPrimary, + NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not attach clipper: %08x\n", + ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Created a clipper\n"); + ErrorF ("winAllocateFBShadowDDNL - Created a clipper\n"); #endif + /* Get a device context for the screen */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, 0, pScreenPriv->hwndScreen); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Clipper not attached "\ + ErrorF ("winAllocateFBShadowDDNL - Clipper not attached " "to window: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Attached clipper to window\n"); + ErrorF ("winAllocateFBShadowDDNL - Attached clipper to window\n"); #endif /* Create a DirectDraw object, store the address at lpdd */ - ddrval = DirectDrawCreate (NULL, - (LPDIRECTDRAW*) &pScreenPriv->pdd, - NULL); + ddrval = (*g_fpDirectDrawCreate) (NULL, + (LPDIRECTDRAW*) &pScreenPriv->pdd, + NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not start " + ErrorF ("winAllocateFBShadowDDNL - Could not start " "DirectDraw: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Created and initialized DD\n"); + ErrorF ("winAllocateFBShadowDDNL - Created and initialized DD\n"); #endif /* Get a DirectDraw4 interface pointer */ @@ -141,13 +239,12 @@ (LPVOID*) &pScreenPriv->pdd4); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Failed DD4 query: %08x\n", + ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n", ddrval); return FALSE; } /* Are we full screen? */ - /* FIXME: If we are full screen we don't need the clipper */ if (pScreenInfo->fFullScreen) { DDSURFACEDESC2 ddsdCurrent; @@ -161,7 +258,7 @@ | DDSCL_FULLSCREEN); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + ErrorF ("winAllocateFBShadowDDNL - Could not set " "cooperative level: %08x\n", ddrval); return FALSE; @@ -181,7 +278,7 @@ &ddsdCurrent); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not get current " + ErrorF ("winAllocateFBShadowDDNL - Could not get current " "refresh rate: %08x. Continuing.\n", ddrval); dwRefreshRateCurrent = 0; @@ -206,28 +303,29 @@ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winAllocateFBShadowDDNL () - GetDC () failed\n"); + ErrorF ("winAllocateFBShadowDDNL - GetDC () failed\n"); return FALSE; } /* Only change the video mode when different than current mode */ - if (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) - || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) - || pScreenInfo->dwDepth != GetDeviceCaps (hdc, BITSPIXEL) - || pScreenInfo->dwRefreshRate != 0) + if (!pScreenInfo->fMultipleMonitors + && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) + || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) + || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL) + || pScreenInfo->dwRefreshRate != 0)) { - ErrorF ("winAllocateFBShadowDDNL () - Changing video mode\n"); + ErrorF ("winAllocateFBShadowDDNL - Changing video mode\n"); /* Change the video mode to the mode requested */ ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenInfo->dwDepth, + pScreenInfo->dwBPP, pScreenInfo->dwRefreshRate, 0); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + ErrorF ("winAllocateFBShadowDDNL - Could not set " "full screen display mode: %08x\n", ddrval); return FALSE; @@ -235,7 +333,7 @@ } else { - ErrorF ("winAllocateFBShadowDDNL () - Not changing video mode\n"); + ErrorF ("winAllocateFBShadowDDNL - Not changing video mode\n"); } /* Release our DC */ @@ -250,35 +348,20 @@ DDSCL_NORMAL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + ErrorF ("winAllocateFBShadowDDNL - Could not set " "cooperative level: %08x\n", ddrval); return FALSE; } } - /* Describe the primary surface */ - ZeroMemory (&ddsdPrimary, sizeof (ddsdPrimary)); - ddsdPrimary.dwSize = sizeof (ddsdPrimary); - ddsdPrimary.dwFlags = DDSD_CAPS; - ddsdPrimary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - /* Create the primary surface */ - ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, - &ddsdPrimary, - &pScreenPriv->pddsPrimary4, - NULL); - if (FAILED (ddrval)) + if (!winCreatePrimarySurfaceShadowDDNL (pScreen)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not create primary "\ - "surface: %08x\n", - ddrval); + ErrorF ("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL " + "failed\n"); return FALSE; } - -#if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Created primary\n"); -#endif /* Get primary surface's pixel format */ ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); @@ -287,35 +370,19 @@ &ddpfPrimary); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not get primary "\ + ErrorF ("winAllocateFBShadowDDNL - Could not get primary " "pixformat: %08x\n", ddrval); return FALSE; } #if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Primary masks: %08x %08x %08x "\ + ErrorF ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x " "dwRGBBitCount: %d\n", ddpfPrimary.u2.dwRBitMask, ddpfPrimary.u3.dwGBitMask, ddpfPrimary.u4.dwBBitMask, - ddpfPrimary.u.dwRGBBitCount); -#endif - - /* Attach our clipper to our primary surface handle */ - ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, - pScreenPriv->pddcPrimary); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL () - Primary attach clipper "\ - "failed: %08x\n", - ddrval); - return FALSE; - } - -#if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Attached clipper to primary "\ - "surface\n"); + ddpfPrimary.u1.dwRGBBitCount); #endif /* Describe the shadow surface to be created */ @@ -338,7 +405,7 @@ ddsdShadow.lpSurface = lpSurface; ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary; - ErrorF ("winAllocateFBShadowDDNL () - lPitch: %d\n", + ErrorF ("winAllocateFBShadowDDNL - lPitch: %d\n", pScreenInfo->dwPaddedWidth); /* Create the shadow surface */ @@ -348,38 +415,45 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not create shadow "\ + ErrorF ("winAllocateFBShadowDDNL - Could not create shadow " "surface: %08x\n", ddrval); return FALSE; } -#if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Created shadow pitch: %d\n", +#if CYGDEBUG || YES + ErrorF ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n", ddsdShadow.u1.lPitch); #endif + + /* Grab the pitch from the surface desc */ + pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8) + / pScreenInfo->dwBPP; + +#if CYGDEBUG || YES + ErrorF ("winAllocateFBShadowDDNL - Created shadow stride: %d\n", + pScreenInfo->dwStride); +#endif - /* Grab the pitch, and memory pointer from the surface desc */ - pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; - pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) - / pScreenInfo->dwDepth; + /* Save the pointer to our surface memory */ pScreenInfo->pfb = lpSurface; - /* Grab the color depth and masks from the surface description */ - pScreenInfo->dwDepth = ddsdShadow.u4.ddpfPixelFormat.u1.dwRGBBitCount; + /* Grab the masks from the surface description */ pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask; pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask; - + #if CYGDEBUG - ErrorF ("winAllocateFBShadowDDNL () - Returning\n"); + ErrorF ("winAllocateFBShadowDDNL - Returning\n"); #endif return TRUE; } + /* * Transfer the damaged regions of the shadow framebuffer to the display. */ + void winShadowUpdateDDNL (ScreenPtr pScreen, shadowBufPtr pBuf) @@ -388,58 +462,126 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; RegionPtr damage = &pBuf->damage; HRESULT ddrval = DD_OK; - RECT rcClient, rcDest, rcSrc; + RECT rcDest, rcSrc; + POINT ptOrigin; DWORD dwBox = REGION_NUM_RECTS (damage); BoxPtr pBox = REGION_RECTS (damage); + HRGN hrgnTemp = NULL, hrgnCombined = NULL; - /* Return immediately if the app is not active and we are fullscreen */ - if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + /* + * Return immediately if the app is not active + * and we are fullscreen, or if we have a bad display depth + */ + if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) + || pScreenPriv->fBadDepth) return; - /* Get location of display window's client area, in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, 2); + (LPPOINT)&ptOrigin, 1); - /* Loop through all boxes in the damaged region */ - while (dwBox--) + /* + * Handle small regions with multiple blits, + * handle large regions by creating a clipping region and + * doing a single blit constrained to that clipping region. + */ + if (pScreenInfo->dwClipUpdatesNBoxes == 0 + || dwBox < pScreenInfo->dwClipUpdatesNBoxes) { - /* Assign damage box to source rectangle */ - rcSrc.left = pBox->x1; - rcSrc.top = pBox->y1; - rcSrc.right = pBox->x2; - rcSrc.bottom = pBox->y2; - - /* Calculate destination rectangle */ - rcDest.left = rcClient.left + rcSrc.left; - rcDest.top = rcClient.top + rcSrc.top; - rcDest.right = rcClient.left + rcSrc.right; - rcDest.bottom = rcClient.top + rcSrc.bottom; + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectangle */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () " + "failed: %08x\n", + ddrval); + } + + /* Get a pointer to the next box */ + ++pBox; + } + } + else + { + BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage); + + /* Compute a GDI region from the damaged region */ + hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + dwBox--; + pBox++; + while (dwBox--) + { + hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); + DeleteObject (hrgnTemp); + pBox++; + } + + /* Install the GDI region as a clipping region */ + SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); + DeleteObject (hrgnCombined); + hrgnCombined = NULL; - /* Blit the damaged areas */ +#if CYGDEBUG + ErrorF ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n", + pBoxExtents->x1, pBoxExtents->y1, + pBoxExtents->x2, pBoxExtents->y2); +#endif + + /* Calculating a bounding box for the source is easy */ + rcSrc.left = pBoxExtents->x1; + rcSrc.top = pBoxExtents->y1; + rcSrc.right = pBoxExtents->x2; + rcSrc.bottom = pBoxExtents->y2; + + /* Calculating a bounding box for the destination is trickier */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Our Blt should be clipped to the invalidated region */ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, &rcDest, pScreenPriv->pddsShadow4, &rcSrc, DDBLT_WAIT, NULL); - if (FAILED (ddrval)) - { - ErrorF ("winShadowUpdateDDNL () - IDirectDrawSurface4_Blt () " - "failed: %08x\n", - ddrval); - } - /* Get a pointer to the next box */ - ++pBox; + /* Reset the clip region */ + SelectClipRgn (pScreenPriv->hdcScreen, NULL); } } + /* * Call the wrapped CloseScreen function. * * Free our resources and private structures. */ + Bool winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) { @@ -447,8 +589,8 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; -#if 1 - ErrorF ("winCloseScreenShadowDDNL () - Freeing screen resources\n"); +#if CYGDEBUG + ErrorF ("winCloseScreenShadowDDNL - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ @@ -459,6 +601,9 @@ pScreen->CloseScreen = pScreenPriv->CloseScreen; fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); @@ -466,11 +611,23 @@ if (pScreenPriv->pddsShadow4) { IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); - xfree (pScreenInfo->pfb); + free (pScreenInfo->pfb); pScreenInfo->pfb = NULL; pScreenPriv->pddsShadow4 = NULL; } + /* Detach the clipper from the primary surface and release the clipper. */ + if (pScreenPriv->pddcPrimary) + { + /* Detach the clipper */ + IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, + NULL); + + /* Release the clipper object */ + IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); + pScreenPriv->pddcPrimary = NULL; + } + /* Release the primary surface, if there is one */ if (pScreenPriv->pddsPrimary4) { @@ -500,15 +657,22 @@ pScreenPriv->hwndScreen = NULL; } + /* Destroy the thread startup mutex */ + pthread_mutex_destroy (&pScreenPriv->pmServerStarted); + /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + /* Free the screen privates for this screen */ - xfree ((pointer) pScreenPriv); + free ((pointer) pScreenPriv); return fReturn; } + /* * Tell mi what sort of visuals we need. * @@ -516,6 +680,7 @@ * handle one format at a time, I believe. You may want * to verify that last sentence. */ + Bool winInitVisualsShadowDDNL (ScreenPtr pScreen) { @@ -538,36 +703,90 @@ else pScreenPriv->dwBitsPerRGB = dwBlueBits; - ErrorF ("winInitVisualsShadowDDNL () - Masks %08x %08x %08x BPRGB %d d %d\n", + ErrorF ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d " + "bpp %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, pScreenPriv->dwBitsPerRGB, - pScreenInfo->dwDepth); + pScreenInfo->dwDepth, + pScreenInfo->dwBPP); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { - case 32: case 24: case 16: case 15: +#if defined(XFree86Server) /* Setup the real visual */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, TrueColorMask, + pScreenPriv->dwBitsPerRGB, + -1, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " + "failed for TrueColor\n"); + return FALSE; + } + +#if WIN_EMULATE_PSEUDO_SUPPORT + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!miSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + -1, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif +#else /* XFree86Server */ + /* Setup the real visual */ + if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, pScreenPriv->dwBitsPerRGB, - TrueColor, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsShadowDDNL () - "\ - "miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks " + "failed for TrueColor\n"); return FALSE; } + +#if WIN_EMULATE_PSEUDO_SUPPORT + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!fbSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif +#endif /* XFree86Server */ break; case 8: +#if defined(XFree86Server) if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, pScreenInfo->fFullScreen ? PseudoColorMask : StaticColorMask, @@ -578,76 +797,95 @@ pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsShadowDDNL () - "\ - "miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " + "failed\n"); return FALSE; } +#else /* XFree86Server */ + if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth, + pScreenInfo->fFullScreen + ? PseudoColorMask : StaticColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } +#endif /* XFree86Server */ break; default: - ErrorF ("winInitVisualsDDNL () - Unknown screen depth\n"); + ErrorF ("winInitVisualsShadowDDNL - Unknown screen depth\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winInitVisualsShadowDDNL () - Returning\n"); + ErrorF ("winInitVisualsShadowDDNL - Returning\n"); #endif return TRUE; } + +/* + * Adjust the user proposed video mode + */ + Bool winAdjustVideoModeShadowDDNL (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc = NULL; - DWORD dwDepth; + DWORD dwBPP; /* We're in serious trouble if we can't get a DC */ hdc = GetDC (NULL); if (hdc == NULL) { - ErrorF ("winAdjustVideoModeShadowDDNL () - GetDC () failed\n"); + ErrorF ("winAdjustVideoModeShadowDDNL - GetDC () failed\n"); return FALSE; } /* Query GDI for current display depth */ - dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) { /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowDDNL () - Using Windows display " - "depth of %d bits per pixel\n", dwDepth); + ErrorF ("winAdjustVideoModeShadowDDNL - Using Windows display " + "depth of %d bits per pixel\n", dwBPP); /* Use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } else if (pScreenInfo->fFullScreen - && pScreenInfo->dwDepth != dwDepth) + && pScreenInfo->dwBPP != dwBPP) { /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDDNL () - FullScreen, using command " - "line depth: %d\n", pScreenInfo->dwDepth); + ErrorF ("winAdjustVideoModeShadowDDNL - FullScreen, using command " + "line bpp: %d\n", pScreenInfo->dwBPP); } - else if (dwDepth != pScreenInfo->dwDepth) + else if (dwBPP != pScreenInfo->dwBPP) { /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDDNL () - Windowed, command line " - "depth: %d, using depth: %d\n", - pScreenInfo->dwDepth, dwDepth); + ErrorF ("winAdjustVideoModeShadowDDNL - Windowed, command line " + "bpp: %d, using bpp: %d\n", + pScreenInfo->dwBPP, dwBPP); /* We'll use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwDepth + if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP >= WIN_DIB_MAXIMUM_SIZE) { - ErrorF ("winAdjustVideoModeShadowDDNL () - Requested DirectDraw surface " + ErrorF ("winAdjustVideoModeShadowDDNL - Requested DirectDraw surface " "will be larger than %d MB. The surface may fail to be " "allocated on Windows 95, 98, or Me, due to a %d MB limit in " "DIB size. This limit does not apply to Windows NT/2000, and " @@ -660,63 +898,105 @@ return TRUE; } + + +/* + * Blt exposed regions to the screen + */ -/* Blt exposed regions to the screen */ Bool winBltExposedRegionsShadowDDNL (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RECT rcClient, rcSrc; + RECT rcSrc, rcDest; + POINT ptOrigin; HDC hdcUpdate; PAINTSTRUCT ps; HRESULT ddrval = DD_OK; Bool fReturn = TRUE; + int i; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); if (hdcUpdate == NULL) { fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDDNL () - BeginPaint () returned " + ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned " "a NULL device context handle. Aborting blit attempt.\n"); goto winBltExposedRegionsShadowDDNL_Exit; } - /* Get client area in screen coords */ - fReturn = GetClientRect (pScreenPriv->hwndScreen, &rcClient); - if (!fReturn) - { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDDNL () - GetClientRect () failed\n"); - goto winBltExposedRegionsShadowDDNL_Exit; - } + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; - /* Map the client coords to screen coords */ MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, - 2); - + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; + /* Source can be entire shadow surface, as Blt should clip for us */ rcSrc.left = 0; rcSrc.top = 0; rcSrc.right = pScreenInfo->dwWidth; rcSrc.bottom = pScreenInfo->dwHeight; - /* Our Blt should be clipped to the invalidated region */ - ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, - &rcClient, - pScreenPriv->pddsShadow4, - &rcSrc, - DDBLT_WAIT, - NULL); - if (FAILED (ddrval)) + /* Try to regain the primary surface and blit again if we've lost it */ + for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDDNL () - IDirectDrawSurface_Blt " - "failed: %08x %d\n", ddrval, ddrval); - goto winBltExposedRegionsShadowDDNL_Exit; + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + /* Surface was lost */ + ErrorF ("winBltExposedRegionsShadowDDNL - IDirectDrawSurface4_Blt " + "reported that the primary surface was lost, " + "trying to restore, retry: %d\n", i + 1); + + /* Try to restore the surface, once */ + + ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); + ErrorF ("winBltExposedRegionsShadowDDNL - " + "IDirectDrawSurface4_Restore returned: "); + if (ddrval == DD_OK) + continue; + else if (ddrval == DDERR_WRONGMODE) + ErrorF ("DDERR_WRONGMODE\n"); + else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) + ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n"); + else if (ddrval == DDERR_UNSUPPORTED) + ErrorF ("DDERR_UNSUPPORTED\n"); + else if (ddrval == DDERR_INVALIDPARAMS) + ErrorF ("DDERR_INVALIDPARAMS\n"); + else if (ddrval == DDERR_INVALIDOBJECT) + ErrorF ("DDERR_INVALIDOBJECT\n"); + else + ErrorF ("unknown error: %08x\n", ddrval); + + /* Loop around to try the blit one more time */ + continue; + } + else if (FAILED (ddrval)) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDDNL - IDirectDrawSurface4_Blt " + "failed, but surface not lost: %08x %d\n", ddrval, ddrval); + goto winBltExposedRegionsShadowDDNL_Exit; + } + else + { + /* Success, stop looping */ + break; + } } winBltExposedRegionsShadowDDNL_Exit: @@ -726,6 +1006,11 @@ return fReturn; } + +/* + * Do any engine-specific appliation-activation processing + */ + Bool winActivateAppShadowDDNL (ScreenPtr pScreen) { @@ -738,8 +1023,7 @@ */ if (pScreenPriv != NULL && pScreenPriv->pddsPrimary4 != NULL - && pScreenPriv->fActive - ) + && pScreenPriv->fActive) { /* Primary surface was lost, restore it */ IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); @@ -759,13 +1043,19 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HRESULT ddrval = DD_OK; - RECT rcClient, rcSrc; + RECT rcSrc, rcDest; + POINT ptOrigin; - /* Get location of display window's client area, in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, 2); + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; /* Source can be entire shadow surface, as Blt should clip for us */ rcSrc.left = 0; @@ -775,14 +1065,14 @@ /* Redraw the whole window, to take account for the new colors */ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, - &rcClient, + &rcDest, pScreenPriv->pddsShadow4, &rcSrc, DDBLT_WAIT, NULL); if (FAILED (ddrval)) { - ErrorF ("winRedrawScreenShadowDDNL () - IDirectDrawSurface4_Blt () " + ErrorF ("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () " "failed: %08x\n", ddrval); } @@ -791,14 +1081,21 @@ } -/* Realize the currently installed colormap */ +/* + * Realize the currently installed colormap + */ + Bool winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen) { return TRUE; } + -/* Install the specified colormap */ +/* + * Install the specified colormap + */ + Bool winInstallColormapShadowDDNL (ColormapPtr pColormap) { @@ -812,7 +1109,7 @@ pCmapPriv->lpDDPalette); if (FAILED (ddrval)) { - ErrorF ("winInstallColormapShadowDDNL () - Failed installing the " + ErrorF ("winInstallColormapShadowDDNL - Failed installing the " "DirectDraw palette.\n"); return FALSE; } @@ -824,7 +1121,10 @@ } -/* Store the specified colors in the specified colormap */ +/* + * Store the specified colors in the specified colormap + */ + Bool winStoreColorsShadowDDNL (ColormapPtr pColormap, int ndef, @@ -833,7 +1133,7 @@ ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winCmapPriv(pColormap); - ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; HRESULT ddrval = DD_OK; /* Put the X colormap entries into the Windows logical palette */ @@ -845,7 +1145,7 @@ + pdefs[0].pixel); if (FAILED (ddrval)) { - ErrorF ("winStoreColorsShadowDDNL () - SetEntries () failed\n"); + ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed\n"); return FALSE; } @@ -857,15 +1157,18 @@ if (!winInstallColormapShadowDDNL (pColormap)) { - ErrorF ("winStoreColorsShadowDDNL () - Failed installing colormap\n"); + ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n"); return FALSE; } return TRUE; } + +/* + * Colormap initialization procedure + */ -/* Colormap initialization procedure */ Bool winCreateColormapShadowDDNL (ColormapPtr pColormap) { @@ -882,15 +1185,18 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winCreateColormapShadowDDNL () - CreatePalette failed\n"); + ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n"); return FALSE; } return TRUE; } + +/* + * Colormap destruction procedure + */ -/* Colormap destruction procedure */ Bool winDestroyColormapShadowDDNL (ColormapPtr pColormap) { @@ -909,7 +1215,7 @@ if (pColormap->flags & IsDefault) { #if CYGDEBUG - ErrorF ("winDestroyColormapShadowDDNL () - Destroying default " + ErrorF ("winDestroyColormapShadowDDNL - Destroying default " "colormap\n"); #endif @@ -923,7 +1229,7 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winDestroyColormapShadowDDNL () - Failed freeing the " + ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the " "default colormap DirectDraw palette.\n"); return FALSE; } @@ -941,8 +1247,11 @@ return TRUE; } + +/* + * Set pointers to our engine specific functions + */ -/* Set pointers to our engine specific functions */ Bool winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) { @@ -969,7 +1278,9 @@ pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL; pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL; pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL; + pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winshadgdi.c diff -u xc/programs/Xserver/hw/xwin/winshadgdi.c:1.19 xc/programs/Xserver/hw/xwin/winshadgdi.c:1.22 --- xc/programs/Xserver/hw/xwin/winshadgdi.c:1.19 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winshadgdi.c Wed Feb 12 10:01:38 2003 @@ -27,10 +27,22 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.19 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.22 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" +/* + * Local function prototypes + */ + +BOOL CALLBACK +winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam); + + +/* + * Internal function to get the DIB format that is compatible with the screen + */ + static Bool winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih) @@ -45,7 +57,7 @@ hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1); if (hbmp == NULL) { - ErrorF ("winQueryScreenDIBFormat () - CreateCompatibleBitmap failed\n"); + ErrorF ("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n"); return FALSE; } @@ -61,7 +73,7 @@ (BITMAPINFO*) pbmih, DIB_RGB_COLORS)) { - ErrorF ("winQueryScreenDIBFormat () - First call to GetDIBits failed\n"); + ErrorF ("winQueryScreenDIBFormat - First call to GetDIBits failed\n"); DeleteObject (hbmp); return FALSE; } @@ -70,7 +82,7 @@ /* Get a pointer to bitfields */ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); - ErrorF ("winQueryScreenDIBFormat () - First call masks: %08x %08x %08x\n", + ErrorF ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n", pdw[0], pdw[1], pdw[2]); #endif @@ -82,7 +94,7 @@ (BITMAPINFO*)pbmih, DIB_RGB_COLORS)) { - ErrorF ("winQueryScreenDIBFormat () - Second call to GetDIBits "\ + ErrorF ("winQueryScreenDIBFormat - Second call to GetDIBits " "failed\n"); DeleteObject (hbmp); return FALSE; @@ -94,6 +106,11 @@ return TRUE; } + +/* + * Internal function to determine the GDI bits per rgb and bit masks + */ + static Bool winQueryRGBBitsAndMasks (ScreenPtr pScreen) @@ -122,6 +139,9 @@ if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES) * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24) { + ErrorF ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) " + "returned 24 for the screen. Using default 24bpp masks.\n"); + /* 8 bits per primary color */ pScreenPriv->dwBitsPerRGB = 8; @@ -134,11 +154,11 @@ } /* Allocate a bitmap header and color table */ - pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); if (pbmih == NULL) { - ErrorF ("winQueryRGBBitsAndMasks () - xalloc failed\n"); + ErrorF ("winQueryRGBBitsAndMasks - malloc failed\n"); return FALSE; } @@ -149,7 +169,7 @@ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); #if CYGDEBUG - ErrorF ("winQueryRGBBitsAndMasks () - Masks: %08x %08x %08x\n", + ErrorF ("winQueryRGBBitsAndMasks - Masks: %08x %08x %08x\n", pdw[0], pdw[1], pdw[2]); #endif @@ -173,27 +193,50 @@ } else { - ErrorF ("winQueryRGBBitsAndMasks () - winQueryScreenDIBFormat failed\n"); - xfree (pbmih); + ErrorF ("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n"); + free (pbmih); fReturn = FALSE; } /* Free memory */ - xfree (pbmih); + free (pbmih); return fReturn; } + + +/* + * Redraw all ---? + */ + +BOOL CALLBACK +winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam) +{ + char strClassName[100]; -/* Allocate a DIB for the shadow framebuffer GDI server */ + if (GetClassName (hwnd, strClassName, 100)) + { + if(strcmp (WINDOW_CLASS_X, strClassName) == 0) + { + InvalidateRect (hwnd, NULL, FALSE); + UpdateWindow (hwnd); + } + } + return TRUE; +} + + +/* + * Allocate a DIB for the shadow framebuffer GDI server + */ + Bool winAllocateFBShadowGDI (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; BITMAPINFOHEADER *pbmih = NULL; -#if CYGDEBUG DIBSECTION dibsection; -#endif Bool fReturn = TRUE; /* Get device contexts for the screen and shadow bitmap */ @@ -201,11 +244,11 @@ pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); if (pbmih == NULL) { - ErrorF ("winAllocateFBShadowGDI - xalloc () failed\n"); + ErrorF ("winAllocateFBShadowGDI - malloc () failed\n"); return FALSE; } @@ -216,6 +259,10 @@ pbmih->biWidth = pScreenInfo->dwWidth; pbmih->biHeight = -pScreenInfo->dwHeight; + ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d " + "depth: %d\n", + pbmih->biWidth, -pbmih->biHeight, pbmih->biBitCount); + /* Create a DI shadow bitmap with a bit pointer */ pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, (BITMAPINFO *) pbmih, @@ -225,24 +272,28 @@ 0); if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) { - ErrorF ("winAllocateFBShadowGDI () - CreateDIBSection failed\n"); + ErrorF ("winAllocateFBShadowGDI - CreateDIBSection failed\n"); return FALSE; } else { #if CYGDEBUG - ErrorF ("winAllocateFBShadowGDI () - Shadow buffer allocated\n"); + ErrorF ("winAllocateFBShadowGDI - Shadow buffer allocated\n"); #endif } -#if CYGDEBUG /* Get information about the bitmap that was allocated */ - GetObject (pScreenPriv->hbmpShadow, sizeof (dibsection), + GetObject (pScreenPriv->hbmpShadow, + sizeof (dibsection), &dibsection); +#if CYGDEBUG || YES /* Print information about bitmap allocated */ - ErrorF ("winAllocateFBShadowGDI () - Dibsection width: %d height: %d\n", - dibsection.dsBmih.biWidth, dibsection.dsBmih.biHeight); + ErrorF ("winAllocateFBShadowGDI - Dibsection width: %d height: %d " + "depth: %d size image: %d\n", + dibsection.dsBmih.biWidth, dibsection.dsBmih.biHeight, + dibsection.dsBmih.biBitCount, + dibsection.dsBmih.biSizeImage); #endif /* Select the shadow bitmap into the shadow DC */ @@ -250,7 +301,7 @@ pScreenPriv->hbmpShadow); #if CYGDEBUG - ErrorF ("winAllocateFBShadowGDI () - Attempting a shadow blit\n"); + ErrorF ("winAllocateFBShadowGDI - Attempting a shadow blit\n"); #endif /* Do a test blit from the shadow to the screen, I think */ @@ -263,25 +314,30 @@ if (fReturn) { #if CYGDEBUG - ErrorF ("winAllocateFBShadowGDI () - Shadow blit success\n"); + ErrorF ("winAllocateFBShadowGDI - Shadow blit success\n"); #endif } else { - ErrorF ("winAllocateFBShadowGDI () - Shadow blit failure\n"); + ErrorF ("winAllocateFBShadowGDI - Shadow blit failure\n"); return FALSE; } /* Set screeninfo stride */ - pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; - pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) - / pScreenInfo->dwDepth; - + pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage + / dibsection.dsBmih.biHeight) + * 8) / pScreenInfo->dwBPP; + +#if CYGDEBUG || YES + ErrorF ("winAllocateFBShadowGDI - Created shadow stride: %d\n", + pScreenInfo->dwStride); +#endif + /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwDepth + if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP >= WIN_DIB_MAXIMUM_SIZE) { - ErrorF ("winAdjustVideoModeShadowGDI () - Requested DIB (bitmap) " + ErrorF ("winAllocateFBShadowGDI - Requested DIB (bitmap) " "will be larger than %d MB. The surface may fail to be " "allocated on Windows 95, 98, or Me, due to a %d MB limit in " "DIB size. This limit does not apply to Windows NT/2000, and " @@ -289,10 +345,24 @@ WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); } + /* Determine our color masks */ + if (!winQueryRGBBitsAndMasks (pScreen)) + { + ErrorF ("winAllocateFBShadowGDI - winQueryRGBBitsAndMasks failed\n"); + return FALSE; + } + + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0); + return fReturn; } + -/* Blit the damaged regions of the shadow fb to the screen */ +/* + * Blit the damaged regions of the shadow fb to the screen + */ + void winShadowUpdateGDI (ScreenPtr pScreen, shadowBufPtr pBuf) @@ -303,38 +373,117 @@ DWORD dwBox = REGION_NUM_RECTS (damage); BoxPtr pBox = REGION_RECTS (damage); int x, y, w, h; + HRGN hrgnTemp = NULL, hrgnCombined = NULL; +#if WIN_UPDATE_STATS + static DWORD s_dwNonUnitRegions = 0; + static DWORD s_dwTotalUpdates = 0; + static DWORD s_dwTotalBoxes = 0; +#endif + + /* + * Return immediately if the app is not active + * and we are fullscreen, or if we have a bad display depth + */ + if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) + || pScreenPriv->fBadDepth) return; - /* Return immediately if the app is not active and we are fullscreen */ - if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; +#if WIN_UPDATE_STATS + ++s_dwTotalUpdates; + s_dwTotalBoxes += dwBox; - /* Loop through all boxes in the damaged region */ - while (dwBox--) + if (dwBox != 1) { - /* Calculate x offset, y offset, width, and height for - current damage box - */ - x = pBox->x1; - y = pBox->y1; - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; + ++s_dwNonUnitRegions; + ErrorF ("winShadowUpdatGDI - dwBox: %d\n", dwBox); + } + + if ((s_dwTotalUpdates % 100) == 0) + ErrorF ("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d " + "nu: %d tu: %d\n", + (s_dwNonUnitRegions * 100) / s_dwTotalUpdates, + s_dwTotalBoxes / s_dwTotalUpdates, + s_dwNonUnitRegions, s_dwTotalUpdates); +#endif /* WIN_UPDATE_STATS */ + /* + * Handle small regions with multiple blits, + * handle large regions by creating a clipping region and + * doing a single blit constrained to that clipping region. + */ + if (pScreenInfo->dwClipUpdatesNBoxes == 0 + || dwBox < pScreenInfo->dwClipUpdatesNBoxes) + { + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* + * Calculate x offset, y offset, width, and height for + * current damage box + */ + x = pBox->x1; + y = pBox->y1; + w = pBox->x2 - pBox->x1; + h = pBox->y2 - pBox->y1; + + BitBlt (pScreenPriv->hdcScreen, + x, y, + w, h, + pScreenPriv->hdcShadow, + x, y, + SRCCOPY); + + /* Get a pointer to the next box */ + ++pBox; + } + } + else + { + BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage); + + /* Compute a GDI region from the damaged region */ + hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + dwBox--; + pBox++; + while (dwBox--) + { + hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); + DeleteObject (hrgnTemp); + pBox++; + } + + /* Install the GDI region as a clipping region */ + SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); + DeleteObject (hrgnCombined); + hrgnCombined = NULL; + + /* + * Blit the shadow buffer to the screen, + * constrained to the clipping region. + */ BitBlt (pScreenPriv->hdcScreen, - x, y, - w, h, + pBoxExtents->x1, pBoxExtents->y1, + pBoxExtents->x2 - pBoxExtents->x1, + pBoxExtents->y2 - pBoxExtents->y1, pScreenPriv->hdcShadow, - x, y, + pBoxExtents->x1, pBoxExtents->y1, SRCCOPY); - /* Get a pointer to the next box */ - ++pBox; + /* Reset the clip region */ + SelectClipRgn (pScreenPriv->hdcScreen, NULL); } + + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0); } + /* See Porting Layer Definition - p. 33 */ /* * We wrap whatever CloseScreen procedure was specified by fb; * a pointer to said procedure is stored in our privates. */ + Bool winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) { @@ -343,7 +492,7 @@ Bool fReturn; #if CYGDEBUG - ErrorF ("winCloseScreenShadowGDI () - Freeing screen resources\n"); + ErrorF ("winCloseScreenShadowGDI - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ @@ -373,6 +522,9 @@ pScreenPriv->hwndScreen = NULL; } + /* Destroy the thread startup mutex */ + pthread_mutex_destroy (&pScreenPriv->pmServerStarted); + /* Invalidate our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; @@ -380,54 +532,111 @@ pScreenInfo->pfb = NULL; /* Free the screen privates for this screen */ - xfree ((pointer) pScreenPriv); + free ((pointer) pScreenPriv); return fReturn; } + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ + Bool winInitVisualsShadowGDI (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - /* Determine our color masks */ - if (!winQueryRGBBitsAndMasks (pScreen)) - { - ErrorF ("winInitVisualsShadowGDI () - winQueryRGBBitsAndMasks failed\n"); - return FALSE; - } - /* Display debugging information */ - ErrorF ("winInitVisualsGDI () - Masks %08x %08x %08x BPRGB %d d %d\n", + ErrorF ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d " + "bpp %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, pScreenPriv->dwBitsPerRGB, - pScreenInfo->dwDepth); + pScreenInfo->dwDepth, + pScreenInfo->dwBPP); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { - case 32: case 24: case 16: case 15: +#if defined(XFree86Server) /* Setup the real visual */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, TrueColorMask, pScreenPriv->dwBitsPerRGB, - TrueColor, + -1, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " + "failed\n"); return FALSE; } + +#if WIN_EMULATE_PSEUDO_SUPPORT + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!miSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + -1, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif +#else /* XFree86Server */ + /* Setup the real visual */ + if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowGDI - fbSetVisualTypesAndMasks " + "failed for TrueColor\n"); + return FALSE; + } + +#if WIN_EMULATE_PSEUDO_SUPPORT + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!fbSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowGDI - fbSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif +#endif /* XFree86Server */ break; case 8: +#if defined(XFree86Server) if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, PseudoColorMask, pScreenPriv->dwBitsPerRGB, @@ -435,63 +644,81 @@ pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } +#else /* XFree86Server */ + if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowGDI - fbSetVisualTypesAndMasks " + "failed\n"); return FALSE; } +#endif break; default: - ErrorF ("winInitVisualsGDI () - Unknown screen depth\n"); + ErrorF ("winInitVisualsShadowGDI - Unknown screen depth\n"); return FALSE; } #if CYGDEBUG - ErrorF ("winInitVisualsGDI () - Returning\n"); + ErrorF ("winInitVisualsShadowGDI - Returning\n"); #endif return TRUE; } + -/* Adjust the video mode */ +/* + * Adjust the proposed video mode + */ + Bool winAdjustVideoModeShadowGDI (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc; - DWORD dwDepth; + DWORD dwBPP; hdc = GetDC (NULL); /* We're in serious trouble if we can't get a DC */ if (hdc == NULL) { - ErrorF ("winAdjustVideoModeShadowGDI () - GetDC () failed\n"); + ErrorF ("winAdjustVideoModeShadowGDI - GetDC () failed\n"); return FALSE; } /* Query GDI for current display depth */ - dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* GDI cannot change the screen depth */ - if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) { /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowGDI () - Using Windows display " - "depth of %d bits per pixel\n", dwDepth); + ErrorF ("winAdjustVideoModeShadowGDI - Using Windows display " + "depth of %d bits per pixel\n", dwBPP); /* Use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } - else if (dwDepth != pScreenInfo->dwDepth) + else if (dwBPP != pScreenInfo->dwBPP) { /* Warn user if GDI depth is different than -depth parameter */ - ErrorF ("winAdjustVideoModeShadowGDI () - Command line depth: %d, "\ - "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + ErrorF ("winAdjustVideoModeShadowGDI - Command line bpp: %d, "\ + "using bpp: %d\n", pScreenInfo->dwBPP, dwBPP); /* We'll use GDI's depth */ - pScreenInfo->dwDepth = dwDepth; + pScreenInfo->dwBPP = dwBPP; } /* Release our DC */ @@ -501,7 +728,11 @@ return TRUE; } -/* Blt exposed regions to the screen */ + +/* + * Blt exposed regions to the screen + */ + Bool winBltExposedRegionsShadowGDI (ScreenPtr pScreen) { @@ -534,9 +765,17 @@ /* EndPaint frees the DC */ EndPaint (pScreenPriv->hwndScreen, &ps); + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0); + return TRUE; } + +/* + * Do any engine-specific appliation-activation processing + */ + Bool winActivateAppShadowGDI (ScreenPtr pScreen) { @@ -544,7 +783,7 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; #if CYGDEBUG - ErrorF ("winActivateAppShadowGDI ()\n"); + ErrorF ("winActivateAppShadowGDI\n"); #endif /* @@ -571,7 +810,7 @@ } #if CYGDEBUG - ErrorF ("winActivateAppShadowGDI () - Returning\n"); + ErrorF ("winActivateAppShadowGDI - Returning\n"); #endif return TRUE; @@ -596,9 +835,16 @@ 0, 0, SRCCOPY); + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0); return TRUE; } + +/* + * Realize the currently installed colormap + */ + Bool winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen) { @@ -606,14 +852,14 @@ winPrivCmapPtr pCmapPriv = NULL; #if CYGDEBUG - ErrorF ("winRealizeInstalledPaletteShadowGDI ()\n"); + ErrorF ("winRealizeInstalledPaletteShadowGDI\n"); #endif /* Don't do anything if there is not a colormap */ if (pScreenPriv->pcmapInstalled == NULL) { #if CYGDEBUG - ErrorF ("winRealizeInstalledPaletteShadowGDI () - No colormap " + ErrorF ("winRealizeInstalledPaletteShadowGDI - No colormap " "installed\n"); #endif return TRUE; @@ -624,7 +870,7 @@ /* Realize our palette for the screen */ if (RealizePalette (pScreenPriv->hdcScreen) == GDI_ERROR) { - ErrorF ("winRealizeInstalledPaletteShadowGDI () - RealizePalette () " + ErrorF ("winRealizeInstalledPaletteShadowGDI - RealizePalette () " "failed\n"); return FALSE; } @@ -635,7 +881,7 @@ WIN_NUM_PALETTE_ENTRIES, pCmapPriv->rgbColors) == 0) { - ErrorF ("winRealizeInstalledPaletteShadowGDI () - SetDIBColorTable () " + ErrorF ("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () " "failed\n"); return FALSE; } @@ -643,8 +889,11 @@ return TRUE; } + +/* + * Install the specified colormap + */ -/* Install the specified colormap */ Bool winInstallColormapShadowGDI (ColormapPtr pColormap) { @@ -660,14 +909,14 @@ pCmapPriv->hPalette, FALSE) == NULL) { - ErrorF ("winInstallColormapShadowGDI () - SelectPalette () failed\n"); + ErrorF ("winInstallColormapShadowGDI - SelectPalette () failed\n"); return FALSE; } /* Realize the palette */ if (GDI_ERROR == RealizePalette (pScreenPriv->hdcScreen)) { - ErrorF ("winInstallColormapShadowGDI () - RealizePalette () failed\n"); + ErrorF ("winInstallColormapShadowGDI - RealizePalette () failed\n"); return FALSE; } @@ -677,7 +926,7 @@ WIN_NUM_PALETTE_ENTRIES, pCmapPriv->rgbColors) == 0) { - ErrorF ("winInstallColormapShadowGDI () - SetDIBColorTable () failed\n"); + ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); return FALSE; } @@ -692,11 +941,17 @@ /* Save a pointer to the newly installed colormap */ pScreenPriv->pcmapInstalled = pColormap; + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0); + return TRUE; } + +/* + * Store the specified colors in the specified colormap + */ -/* Store the specified colors in the specified colormap */ Bool winStoreColorsShadowGDI (ColormapPtr pColormap, int ndef, @@ -713,7 +968,7 @@ ndef, pCmapPriv->peColors + pdefs[0].pixel) == 0) { - ErrorF ("winStoreColorsShadowGDI () - SetPaletteEntries () failed\n"); + ErrorF ("winStoreColorsShadowGDI - SetPaletteEntries () failed\n"); return FALSE; } @@ -726,7 +981,7 @@ /* Try to install the newly modified colormap */ if (!winInstallColormapShadowGDI (pColormap)) { - ErrorF ("winInstallColormapShadowGDI () - winInstallColormapShadowGDI " + ErrorF ("winInstallColormapShadowGDI - winInstallColormapShadowGDI " "failed\n"); return FALSE; } @@ -741,7 +996,7 @@ ndef, pCmapPriv->rgbColors + pdefs[0].pixel) == 0) { - ErrorF ("winInstallColormapShadowGDI () - SetDIBColorTable () failed\n"); + ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); return FALSE; } @@ -753,7 +1008,10 @@ } -/* Colormap initialization procedure */ +/* + * Colormap initialization procedure + */ + Bool winCreateColormapShadowGDI (ColormapPtr pColormap) { @@ -770,11 +1028,11 @@ dwEntriesMax = pVisual->ColormapEntries; /* Allocate a Windows logical color palette with max entries */ - lpPaletteNew = xalloc (sizeof (LOGPALETTE) + lpPaletteNew = malloc (sizeof (LOGPALETTE) + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); if (lpPaletteNew == NULL) { - ErrorF ("winCreateColormapShadowGDI () - Couldn't allocate palette " + ErrorF ("winCreateColormapShadowGDI - Couldn't allocate palette " "with %d entries\n", dwEntriesMax); return FALSE; @@ -792,7 +1050,7 @@ hpalNew = CreatePalette (lpPaletteNew); if (hpalNew == NULL) { - ErrorF ("winCreateColormapShadowGDI () - CreatePalette () failed\n"); + ErrorF ("winCreateColormapShadowGDI - CreatePalette () failed\n"); free (lpPaletteNew); return FALSE; } @@ -801,13 +1059,16 @@ pCmapPriv->hPalette = hpalNew; /* Free the palette initialization memory */ - xfree (lpPaletteNew); + free (lpPaletteNew); return TRUE; } -/* Colormap destruction procedure */ +/* + * Colormap destruction procedure + */ + Bool winDestroyColormapShadowGDI (ColormapPtr pColormap) { @@ -825,7 +1086,7 @@ if (pColormap->flags & IsDefault) { #if CYGDEBUG - ErrorF ("winDestroyColormapShadowGDI () - Destroying default " + ErrorF ("winDestroyColormapShadowGDI - Destroying default " "colormap\n"); #endif @@ -846,7 +1107,7 @@ /* Try to delete the logical palette */ if (DeleteObject (pCmapPriv->hPalette) == 0) { - ErrorF ("winDestroyColormap () - DeleteObject () failed\n"); + ErrorF ("winDestroyColormap - DeleteObject () failed\n"); return FALSE; } @@ -856,8 +1117,11 @@ return TRUE; } + +/* + * Set engine specific funtions + */ -/* Set engine specific funtions */ Bool winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) { @@ -884,7 +1148,11 @@ pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI; pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI; pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinCreatePrimarySurface + = (winCreatePrimarySurfaceProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinReleasePrimarySurface + = (winReleasePrimarySurfaceProcPtr) (void (*)())NoopDDA; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winwakeup.c diff -u xc/programs/Xserver/hw/xwin/winwakeup.c:1.5 xc/programs/Xserver/hw/xwin/winwakeup.c:1.6 --- xc/programs/Xserver/hw/xwin/winwakeup.c:1.5 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winwakeup.c Thu Oct 17 04:18:25 2002 @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.5 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.6 2002/10/17 08:18:25 alanh Exp $ */ #include "win.h" @@ -45,9 +45,12 @@ MSG msg; /* Process all messages on our queue */ - while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { - DispatchMessage (&msg); + if (g_hDlgDepthChange == 0 || !IsDialogMessage (g_hDlgDepthChange, &msg)) + { + DispatchMessage (&msg); + } } } Index: xc/programs/Xserver/hw/xwin/winwindow.c diff -u xc/programs/Xserver/hw/xwin/winwindow.c:1.2 xc/programs/Xserver/hw/xwin/winwindow.c:1.6 --- xc/programs/Xserver/hw/xwin/winwindow.c:1.2 Mon Jun 4 09:04:41 2001 +++ xc/programs/Xserver/hw/xwin/winwindow.c Wed Feb 12 10:01:38 2003 @@ -26,79 +26,438 @@ *from the XFree86 Project. * * Authors: Harold L Hunt II + * Kensuke Matsuzaki */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.6 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" +/* + * Prototypes for local functions + */ + +static int +winAddRgn (WindowPtr pWindow, pointer data); + +static +void +winUpdateRgn (WindowPtr pWindow); + +#ifdef SHAPE +static +void +winReshape (WindowPtr pWin); +#endif + + /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbCreateWindow() */ + Bool winCreateWindowNativeGDI (WindowPtr pWin) { - ErrorF ("winCreateWindow()\n"); + ErrorF ("winCreateWindowNativeGDI ()\n"); return TRUE; } + /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbDestroyWindow() */ + Bool winDestroyWindowNativeGDI (WindowPtr pWin) { - ErrorF ("winDestroyWindow()\n"); + ErrorF ("winDestroyWindowNativeGDI ()\n"); return TRUE; } + /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbPositionWindow() */ + Bool winPositionWindowNativeGDI (WindowPtr pWin, int x, int y) { - ErrorF ("winPositionWindow()\n"); + ErrorF ("winPositionWindowNativeGDI ()\n"); return TRUE; } + /* See Porting Layer Definition - p. 39 */ /* See mfb/mfbwindow.c - mfbCopyWindow() */ + void winCopyWindowNativeGDI (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { - ErrorF ("winCopyWindow()\n"); + ErrorF ("winCopyWindowNativeGDI ()\n"); } + /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ + Bool winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask) { - ErrorF ("winChangeWindowAttributes()\n"); + ErrorF ("winChangeWindowAttributesNativeGDI ()\n"); return TRUE; } + /* See Porting Layer Definition - p. 37 * Also referred to as UnrealizeWindow */ + Bool winUnmapWindowNativeGDI (WindowPtr pWindow) { - ErrorF ("winUnmapWindow()\n"); + ErrorF ("winUnmapWindowNativeGDI ()\n"); /* This functions is empty in the CFB, * we probably won't need to do anything */ return TRUE; } + /* See Porting Layer Definition - p. 37 * Also referred to as RealizeWindow */ + Bool winMapWindowNativeGDI (WindowPtr pWindow) { - ErrorF ("winMapWindow()\n"); + ErrorF ("winMapWindowNativeGDI ()\n"); /* This function is empty in the CFB, * we probably won't need to do anything */ return TRUE; + +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbCreateWindow() */ + +Bool +winCreateWindowPRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + winWindowPriv(pWin); + +#if CYGDEBUG + ErrorF ("winCreateWindowPRootless ()\n"); +#endif + + fResult = winGetScreenPriv(pWin->drawable.pScreen)->CreateWindow(pWin); + + pWinPriv->hRgn = NULL; + /*winUpdateRgn (pWin);*/ + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbDestroyWindow() */ + +Bool +winDestroyWindowPRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + winWindowPriv(pWin); + +#if CYGDEBUG + ErrorF ("winDestroyWindowPRootless ()\n"); +#endif + + fResult = winGetScreenPriv(pWin->drawable.pScreen)->DestroyWindow(pWin); + + if (pWinPriv->hRgn != NULL) + { + DeleteObject(pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + winUpdateRgn (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbPositionWindow() */ + +Bool +winPositionWindowPRootless (WindowPtr pWin, int x, int y) +{ + Bool fResult = FALSE; + +#if CYGDEBUG + ErrorF ("winPositionWindowPRootless ()\n"); +#endif + + fResult = winGetScreenPriv(pWin->drawable.pScreen)->PositionWindow(pWin, x, y); + + winUpdateRgn (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ + +Bool +winChangeWindowAttributesPRootless (WindowPtr pWin, unsigned long mask) +{ + Bool fResult = FALSE; + +#if CYGDEBUG + ErrorF ("winChangeWindowAttributesPRootless ()\n"); +#endif + + fResult = winGetScreenPriv(pWin->drawable.pScreen)->ChangeWindowAttributes(pWin, mask); + + winUpdateRgn (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 + * Also referred to as UnrealizeWindow + */ + +Bool +winUnmapWindowPRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + winWindowPriv(pWin); + +#if CYGDEBUG + ErrorF ("winUnmapWindowPRootless ()\n"); +#endif + + fResult = winGetScreenPriv(pWin->drawable.pScreen)->UnrealizeWindow(pWin); + + if (pWinPriv->hRgn != NULL) + { + DeleteObject(pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + winUpdateRgn (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 + * Also referred to as RealizeWindow + */ + +Bool +winMapWindowPRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + +#if CYGDEBUG + ErrorF ("winMapWindowPRootless ()\n"); +#endif + + fResult = winGetScreenPriv(pWin->drawable.pScreen)->RealizeWindow(pWin); + + winReshape (pWin); + + winUpdateRgn (pWin); + + return fResult; +} + + +#ifdef SHAPE +void +winSetShapePRootless (WindowPtr pWin) +{ +#if CYGDEBUG + ErrorF ("winSetShapePRootless ()\n"); +#endif + + winGetScreenPriv(pWin->drawable.pScreen)->SetShape(pWin); + + winReshape (pWin); + winUpdateRgn (pWin); + + return; +} +#endif + + +/* + * Local function for adding a region to the Windows window region + */ + +static +int +winAddRgn (WindowPtr pWin, pointer data) +{ + int iX, iY, iWidth, iHeight, iBorder; + HRGN hRgn = *(HRGN*)data; + HRGN hRgnWin; + winWindowPriv(pWin); + + /* If pWin is not Root */ + if (pWin->parent != NULL) + { +#if CYGDEBUG + ErrorF ("winAddRgn ()\n"); +#endif + if (pWin->mapped) + { + iBorder = wBorderWidth (pWin); + + iX = pWin->drawable.x - iBorder; + iY = pWin->drawable.y - iBorder; + + iWidth = pWin->drawable.width + iBorder * 2; + iHeight = pWin->drawable.height + iBorder * 2; + + hRgnWin = CreateRectRgn (0, 0, iWidth, iHeight); + + if (hRgnWin == NULL) + { + ErrorF ("winAddRgn - CreateRectRgn () failed\n"); + ErrorF (" Rect %d %d %d %d\n", + iX, iY, iX + iWidth, iY + iHeight); + } + + if (pWinPriv->hRgn) + { + if (CombineRgn (hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND) + == ERROR) + { + ErrorF ("winAddRgn - CombineRgn () failed\n"); + } + } + + OffsetRgn (hRgnWin, iX, iY); + + if (CombineRgn (hRgn, hRgn, hRgnWin, RGN_OR) == ERROR) + { + ErrorF ("winAddRgn - CombineRgn () failed\n"); + } + + DeleteObject (hRgnWin); + } + return WT_DONTWALKCHILDREN; + } + else + { + return WT_WALKCHILDREN; + } +} + + +/* + * Local function to update the Windows window's region + */ + +static +void +winUpdateRgn (WindowPtr pWin) +{ + HRGN hRgn = CreateRectRgn (0, 0, 0, 0); + + if (hRgn != NULL) + { + WalkTree (pWin->drawable.pScreen, winAddRgn, &hRgn); + SetWindowRgn (winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen, + hRgn, TRUE); + } + else + { + ErrorF ("winUpdateRgn - CreateRectRgn failed.\n"); + } +} + + +#ifdef SHAPE +static +void +winReshape (WindowPtr pWin) +{ + int nRects; + ScreenPtr pScreen = pWin->drawable.pScreen; + RegionRec rrNewShape; + BoxPtr pShape, pRects, pEnd; + HRGN hRgn, hRgnRect; + winWindowPriv(pWin); + +#if CYGDEBUG + ErrorF ("winReshape ()\n"); +#endif + + /* Bail if the window is the root window */ + if (pWin->parent == NULL) + return; + + /* Bail if the window is not top level */ + if (pWin->parent->parent != NULL) + return; + + /* Free any existing window region stored in the window privates */ + if (pWinPriv->hRgn != NULL) + { + DeleteObject (pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + /* Bail if the window has no bounding region defined */ + if (!wBoundingShape (pWin)) + return; + + REGION_INIT(pScreen, &rrNewShape, NullBox, 0); + REGION_COPY(pScreen, &rrNewShape, wBoundingShape(pWin)); + REGION_TRANSLATE(pScreen, &rrNewShape, pWin->borderWidth, + pWin->borderWidth); + + nRects = REGION_NUM_RECTS(&rrNewShape); + pShape = REGION_RECTS(&rrNewShape); + + if (nRects > 0) + { + /* Create initial empty Windows region */ + hRgn = CreateRectRgn (0, 0, 0, 0); + + /* Loop through all rectangles in the X region */ + for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) + { + /* Create a Windows region for the X rectangle */ + hRgnRect = CreateRectRgn (pRects->x1, pRects->y1, + pRects->x2, pRects->y2); + if (hRgnRect == NULL) + { + ErrorF("winReshape - CreateRectRgn() failed\n"); + } + + /* Merge the Windows region with the accumulated region */ + if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) + { + ErrorF("winReshape - CombineRgn() failed\n"); + } + + /* Delete the temporary Windows region */ + DeleteObject (hRgnRect); + } + + /* Save a handle to the composite region in the window privates */ + pWinPriv->hRgn = hRgn; + } + + REGION_UNINIT(pScreen, &rrNewShape); + + return; } +#endif Index: xc/programs/Xserver/hw/xwin/winwindow.h diff -u /dev/null xc/programs/Xserver/hw/xwin/winwindow.h:1.1 --- /dev/null Thu Feb 27 12:33:55 2003 +++ xc/programs/Xserver/hw/xwin/winwindow.h Wed Feb 12 10:01:38 2003 @@ -0,0 +1,118 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Kensuke Matsuzaki + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.h,v 1.1 2003/02/12 15:01:38 alanh Exp $ */ + + +#ifndef _WINWINDOW_H_ +#define _WINWINDOW_H_ + +#ifndef NO +#define NO 0 +#endif +#ifndef YES +#define YES 1 +#endif + +/* Constant strings */ +#define WINDOW_CLASS "cygwin/xfree86 rl" +#define WINDOW_TITLE "Cygwin/XFree86 rl" +#define WIN_SCR_PROP "cyg_screen_prop_rl" +#define WINDOW_CLASS_X "cygwin/xfree86 X rl" +#define WINDOW_TITLE_X "Cygwin/XFree86 X rl" +#define WIN_WINDOW_PROP "cyg_window_prop_rl" +#define WIN_MSG_QUEUE_FNAME "/dev/windows" +#define WIN_LOG_FNAME "/tmp/XWinrl.log" +#define WIN_WID_PROP "cyg_wid_prop_rl" +#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl" +#define CYGMULTIWINDOW_DEBUG NO + +typedef struct _winPrivScreenRec *winPrivScreenPtr; + +/* + * Window privates + */ + +typedef struct +{ + DWORD dwDummy; + HRGN hRgn; + HWND hWnd; + winPrivScreenPtr pScreenPriv; + int iX; + int iY; + int iWidth; + int iHeight; + Bool fXKilled; +} winPrivWinRec, *winPrivWinPtr; + +typedef struct _winWMMessageRec{ + DWORD dwID; + DWORD msg; + int iWindow; + HWND hwndWindow; + int iX, iY; + int iWidth, iHeight; +} winWMMessageRec, *winWMMessagePtr; + +/* + * winrootlesswm.c + */ +#define WM_WM_MOVE (WM_USER + 1) +#define WM_WM_SIZE (WM_USER + 2) +#define WM_WM_RAISE (WM_USER + 3) +#define WM_WM_LOWER (WM_USER + 4) +#define WM_WM_MAP (WM_USER + 5) +#define WM_WM_UNMAP (WM_USER + 6) +#define WM_WM_KILL (WM_USER + 7) +#define WM_WM_ACTIVATE (WM_USER + 8) + +#define WMMSG_MSG 10 + + +/* + * winmultiwindowwm.c + */ + +void +winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg); + +Bool +winInitWM (void **ppWMInfo, + pthread_t *ptWMProc, +#if 0 + pthread_cond_t *ppcServerStarted, +#endif + pthread_mutex_t *ppmServerStarted, +#if 0 + Bool *pfServerStarted, +#endif + int dwScreen); + +#endif Index: xc/programs/Xserver/hw/xwin/winwndproc.c diff -u xc/programs/Xserver/hw/xwin/winwndproc.c:1.19 xc/programs/Xserver/hw/xwin/winwndproc.c:1.24 --- xc/programs/Xserver/hw/xwin/winwndproc.c:1.19 Wed Nov 21 03:51:24 2001 +++ xc/programs/Xserver/hw/xwin/winwndproc.c Wed Feb 12 10:01:38 2003 @@ -29,12 +29,18 @@ * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II + * MATSUZAKI Kensuke */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.19 2001/11/21 08:51:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.24 2003/02/12 15:01:38 alanh Exp $ */ #include "win.h" +#include <commctrl.h> +BOOL CALLBACK +winChangeDepthDlgProc (HWND hDialog, UINT message, + WPARAM wParam, LPARAM lParam); + /* * Called by winWakeupHandler * Processes current Windows message @@ -44,46 +50,41 @@ winWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static winPrivScreenPtr pScreenPriv = NULL; - static winScreenInfo *pScreenInfo = NULL; - static ScreenPtr pScreen = NULL; - static HWND hwndLastMouse = NULL; - static unsigned long ulServerGeneration = 0; - winPrivScreenPtr pScreenPrivLast; + static winPrivScreenPtr s_pScreenPriv = NULL; + static winScreenInfo *s_pScreenInfo = NULL; + static ScreenPtr s_pScreen = NULL; + static HWND s_hwndLastPrivates = NULL; + static HINSTANCE s_hInstance; + static Bool s_fCursor = TRUE; + static Bool s_fTracking = FALSE; + static unsigned long s_ulServerGeneration = 0; int iScanCode; int i; - static HWND hwndLastPrivates = NULL; /* Watch for server regeneration */ - if (g_ulServerGeneration != ulServerGeneration) + if (g_ulServerGeneration != s_ulServerGeneration) { - /* - * Might as well declare that this window received - * the last mouse message - */ - hwndLastMouse = hwnd; - /* Store new server generation */ - ulServerGeneration = g_ulServerGeneration; + s_ulServerGeneration = g_ulServerGeneration; } /* Only retrieve new privates pointers if window handle is null or changed */ - if ((pScreenPriv == NULL || hwnd != hwndLastPrivates) - && (pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL) + if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates) + && (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL) { -#if CYGDEGUG - ErrorF ("winWindowProc () - Setting privates handle\n"); +#if CYGDEBUG + ErrorF ("winWindowProc - Setting privates handle\n"); #endif - pScreenInfo = pScreenPriv->pScreenInfo; - pScreen = pScreenInfo->pScreen; - hwndLastPrivates = hwnd; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + s_hwndLastPrivates = hwnd; } - else if (pScreenPriv == NULL) + else if (s_pScreenPriv == NULL) { /* For safety, handle case that should never happen */ - pScreenInfo = NULL; - pScreen = NULL; - hwndLastPrivates = NULL; + s_pScreenInfo = NULL; + s_pScreen = NULL; + s_hwndLastPrivates = NULL; } /* Branch on message type */ @@ -91,7 +92,7 @@ { case WM_CREATE: #if CYGDEBUG - ErrorF ("winWindowProc () - WM_CREATE\n"); + ErrorF ("winWindowProc - WM_CREATE\n"); #endif /* @@ -103,197 +104,692 @@ * it is processing. We use this to repaint exposed * areas of our display window. */ - pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams; - pScreenInfo = pScreenPriv->pScreenInfo; - pScreen = pScreenInfo->pScreen; - hwndLastPrivates = hwnd; - SetProp (hwnd, WIN_SCR_PROP, pScreenPriv); + s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams; + s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + s_hwndLastPrivates = hwnd; + SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv); /* Store the mode key states so restore doesn't try to restore them */ - winStoreModeKeyStates (pScreen); + winStoreModeKeyStates (s_pScreen); return 0; + case WM_DISPLAYCHANGE: + /* We cannot handle a display mode change during initialization */ + if (s_pScreenInfo == NULL) + FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display " + "mode changed while we were intializing. This is " + "very bad and unexpected. Exiting.\n"); + + /* + * We do not care about display changes with + * fullscreen DirectDraw engines, because those engines set + * their own mode when they become active. + */ + if (s_pScreenInfo->fFullScreen + && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL + || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD)) + { + /* + * Store the new display dimensions and depth. + * We do this here for future compatibility in case we + * ever allow switching from fullscreen to windowed mode. + */ + s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); + s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); + s_pScreenPriv->dwLastWindowsBitsPixel + = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL); + break; + } + + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, " + "new bpp: %d\n", + s_pScreenInfo->dwBPP, + s_pScreenPriv->dwLastWindowsBitsPixel, + wParam); + + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d " + "new height: %d\n", + LOWORD (lParam), HIWORD (lParam)); + + /* + * TrueColor --> TrueColor depth changes are disruptive for: + * Windowed: + * Shadow DirectDraw + * Shadow DirectDraw Non-Locking + * Primary DirectDraw + * + * TrueColor --> TrueColor depth changs are non-optimal for: + * Windowed: + * Shadow GDI + * + * FullScreen: + * Shadow GDI + * + * TrueColor --> PseudoColor or vice versa are disruptive for: + * Windowed: + * Shadow DirectDraw + * Shadow DirectDraw Non-Locking + * Primary DirectDraw + * Shadow GDI + */ + + /* + * Check for a disruptive change in depth. + * We can only display a message for a disruptive depth change, + * we cannot do anything to correct the situation. + */ + if ((s_pScreenInfo->dwBPP != wParam) + && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL + || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD)) + { + /* Cannot display the visual until the depth is restored */ + ErrorF ("winWindowProc - Disruptive change in depth\n"); + + /* Check if the dialog box already exists */ + if (g_hDlgDepthChange != NULL) + { + ErrorF ("winWindowProc - Dialog box already exists\n"); + + /* Dialog box already exists, just display it */ + ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT); + } + else + { + /* + * Display a notification to the user that the visual + * will not be displayed until the Windows display depth + * is restored to the original value. + */ + g_hDlgDepthChange = CreateDialogParam (s_hInstance, + "DEPTH_CHANGE_BOX", + hwnd, + winChangeDepthDlgProc, + (int) s_pScreenPriv); + + /* Show the dialog box */ + ShowWindow (g_hDlgDepthChange, SW_SHOW); + + ErrorF ("winWindowProc - DialogBox returned: %d\n", + g_hDlgDepthChange); + ErrorF ("winWindowProc - GetLastError: %d\n", GetLastError ()); + + /* Minimize the display window */ + ShowWindow (hwnd, SW_MINIMIZE); + + /* Flag that we have an invalid screen depth */ + s_pScreenPriv->fBadDepth = TRUE; + + /* + * TODO: Redisplay the dialog box if it is not + * currently displayed. + */ + } + } + else + { + /* Flag that we have a valid screen depth */ + s_pScreenPriv->fBadDepth = FALSE; + } + + /* + * Check for a change in display dimensions. + * We can simply recreate the same-sized primary surface when + * the display dimensions change. + */ + if (s_pScreenPriv->dwLastWindowsWidth != LOWORD (lParam) + || s_pScreenPriv->dwLastWindowsHeight != HIWORD (lParam)) + { + /* + * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface + * and CreatePrimarySurface function pointers to point + * to the no operation function, NoopDDA. This allows us + * to blindly call these functions, even if they are not + * relevant to the current engine (e.g., Shadow GDI). + */ + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n"); +#endif + + /* Release the old primary surface */ + (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Released " + "primary surface\n"); +#endif + + /* Create the new primary surface */ + (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Recreated " + "primary surface\n"); +#endif + } + else + { +#if CYGDEBUG + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not " + "change\n"); +#endif + } + + /* Store the new display dimensions and depth */ + s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); + s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); + s_pScreenPriv->dwLastWindowsBitsPixel + = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL); + break; + + case WM_SIZE: + { + SCROLLINFO si; + RECT rcWindow; + int iWidth, iHeight; + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_SIZE\n"); +#endif + + /* Break if we do not use scrollbars */ + if (!s_pScreenInfo->fScrollbars + || !s_pScreenInfo->fDecoration + || s_pScreenInfo->fRootless + || s_pScreenInfo->fMultiWindow + || s_pScreenInfo->fFullScreen) + break; + + /* No need to resize if we get minimized */ + if (wParam == SIZE_MINIMIZED) + return 0; + + /* + * Get the size of the whole window, including client area, + * scrollbars, and non-client area decorations (caption, borders). + * We do this because we need to check if the client area + * without scrollbars is large enough to display the whole visual. + * The new client area size passed by lParam already subtracts + * the size of the scrollbars if they are currently displayed. + * So checking is LOWORD(lParam) == visual_width and + * HIWORD(lParam) == visual_height will never tell us to hide + * the scrollbars because the client area would always be too small. + * GetClientRect returns the same sizes given by lParam, so we + * cannot use GetClientRect either. + */ + GetWindowRect (hwnd, &rcWindow); + iWidth = rcWindow.right - rcWindow.left; + iHeight = rcWindow.bottom - rcWindow.top; + + ErrorF ("winWindowProc - WM_SIZE - window w: %d h: %d, " + "new client area w: %d h: %d\n", + iWidth, iHeight, LOWORD (lParam), HIWORD (lParam)); + + /* Subtract the frame size from the window size. */ + iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME); + iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME) + + GetSystemMetrics (SM_CYCAPTION)); + + /* + * Update scrollbar page sizes. + * NOTE: If page size == range, then the scrollbar is + * automatically hidden. + */ + + /* Is the naked client area large enough to show the whole visual? */ + if (iWidth < s_pScreenInfo->dwWidth + || iHeight < s_pScreenInfo->dwHeight) + { + /* Client area too small to display visual, use scrollbars */ + iWidth -= GetSystemMetrics (SM_CXVSCROLL); + iHeight -= GetSystemMetrics (SM_CYHSCROLL); + } + + /* Set the horizontal scrollbar page size */ + si.cbSize = sizeof (si); + si.fMask = SIF_PAGE | SIF_RANGE; + si.nMin = 0; + si.nMax = s_pScreenInfo->dwWidth - 1; + si.nPage = iWidth; + SetScrollInfo (hwnd, SB_HORZ, &si, TRUE); + + /* Set the vertical scrollbar page size */ + si.cbSize = sizeof (si); + si.fMask = SIF_PAGE | SIF_RANGE; + si.nMin = 0; + si.nMax = s_pScreenInfo->dwHeight - 1; + si.nPage = iHeight; + SetScrollInfo (hwnd, SB_VERT, &si, TRUE); + + /* + * NOTE: Scrollbars may have moved if they were at the + * far right/bottom, so we query their current position. + */ + + /* Get the horizontal scrollbar position and set the offset */ + si.cbSize = sizeof (si); + si.fMask = SIF_POS; + GetScrollInfo (hwnd, SB_HORZ, &si); + s_pScreenInfo->dwXOffset = -si.nPos; + + /* Get the vertical scrollbar position and set the offset */ + si.cbSize = sizeof (si); + si.fMask = SIF_POS; + GetScrollInfo (hwnd, SB_VERT, &si); + s_pScreenInfo->dwYOffset = -si.nPos; + } + return 0; + + case WM_VSCROLL: + { + SCROLLINFO si; + int iVertPos; + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_VSCROLL\n"); +#endif + + /* Get vertical scroll bar info */ + si.cbSize = sizeof (si); + si.fMask = SIF_ALL; + GetScrollInfo (hwnd, SB_VERT, &si); + + /* Save the vertical position for comparison later */ + iVertPos = si.nPos; + + /* + * Don't forget: + * moving the scrollbar to the DOWN, scroll the content UP + */ + switch (LOWORD(wParam)) + { + case SB_TOP: + si.nPos = si.nMin; + break; + + case SB_BOTTOM: + si.nPos = si.nMax - si.nPage + 1; + break; + + case SB_LINEUP: + si.nPos -= 1; + break; + + case SB_LINEDOWN: + si.nPos += 1; + break; + + case SB_PAGEUP: + si.nPos -= si.nPage; + break; + + case SB_PAGEDOWN: + si.nPos += si.nPage; + break; + + case SB_THUMBTRACK: + si.nPos = si.nTrackPos; + break; + + default: + break; + } + + /* + * We retrieve the position after setting it, + * because Windows may adjust it. + */ + si.fMask = SIF_POS; + SetScrollInfo (hwnd, SB_VERT, &si, TRUE); + GetScrollInfo (hwnd, SB_VERT, &si); + + /* Scroll the window if the position has changed */ + if (si.nPos != iVertPos) + { + /* Save the new offset for bit block transfers, etc. */ + s_pScreenInfo->dwYOffset = -si.nPos; + + /* Change displayed region in the window */ + ScrollWindowEx (hwnd, + 0, + iVertPos - si.nPos, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + + /* Redraw the window contents */ + UpdateWindow (hwnd); + } + } + return 0; + + case WM_HSCROLL: + { + SCROLLINFO si; + int iHorzPos; + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_HSCROLL\n"); +#endif + + /* Get horizontal scroll bar info */ + si.cbSize = sizeof (si); + si.fMask = SIF_ALL; + GetScrollInfo (hwnd, SB_HORZ, &si); + + /* Save the horizontal position for comparison later */ + iHorzPos = si.nPos; + + /* + * Don't forget: + * moving the scrollbar to the RIGHT, scroll the content LEFT + */ + switch (LOWORD(wParam)) + { + case SB_LEFT: + si.nPos = si.nMin; + break; + + case SB_RIGHT: + si.nPos = si.nMax - si.nPage + 1; + break; + + case SB_LINELEFT: + si.nPos -= 1; + break; + + case SB_LINERIGHT: + si.nPos += 1; + break; + + case SB_PAGELEFT: + si.nPos -= si.nPage; + break; + + case SB_PAGERIGHT: + si.nPos += si.nPage; + break; + + case SB_THUMBTRACK: + si.nPos = si.nTrackPos; + break; + + default: + break; + } + + /* + * We retrieve the position after setting it, + * because Windows may adjust it. + */ + si.fMask = SIF_POS; + SetScrollInfo (hwnd, SB_HORZ, &si, TRUE); + GetScrollInfo (hwnd, SB_HORZ, &si); + + /* Scroll the window if the position has changed */ + if (si.nPos != iHorzPos) + { + /* Save the new offset for bit block transfers, etc. */ + s_pScreenInfo->dwXOffset = -si.nPos; + + /* Change displayed region in the window */ + ScrollWindowEx (hwnd, + iHorzPos - si.nPos, + 0, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + + /* Redraw the window contents */ + UpdateWindow (hwnd); + } + } + return 0; + + case WM_GETMINMAXINFO: + { + MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam; + int iCaptionHeight; + int iBorderHeight, iBorderWidth; + +#if CYGDEBUG + ErrorF ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n", + s_pScreenInfo); +#endif + + /* Can't do anything without screen info */ + if (s_pScreenInfo == NULL + || !s_pScreenInfo->fScrollbars + || s_pScreenInfo->fFullScreen + || !s_pScreenInfo->fDecoration + || s_pScreenInfo->fRootless + || s_pScreenInfo->fMultiWindow) + break; + + /* + * Here we can override the maximum tracking size, which + * is the largest size that can be assigned to our window + * via the sizing border. + */ + + /* + * FIXME: Do we only need to do this once, since our visual size + * does not change? Does Windows store this value statically + * once we have set it once? + */ + + /* Get the border and caption sizes */ + iCaptionHeight = GetSystemMetrics (SM_CYCAPTION); + iBorderWidth = 2 * GetSystemMetrics (SM_CXSIZEFRAME); + iBorderHeight = 2 * GetSystemMetrics (SM_CYSIZEFRAME); + + /* Allow the full visual to be displayed */ + pMinMaxInfo->ptMaxTrackSize.x + = s_pScreenInfo->dwWidth + iBorderWidth; + pMinMaxInfo->ptMaxTrackSize.y + = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight; + } + return 0; + + case WM_ERASEBKGND: +#if CYGDEBUG + ErrorF ("winWindowProc - WM_ERASEBKGND\n"); +#endif + /* + * Pretend that we did erase the background but we don't care, + * the application uses the full window estate. This avoids some + * flickering when resizing. + */ + return TRUE; + case WM_PAINT: #if CYGDEBUG - ErrorF ("winWindowProc () - WM_PAINT\n"); + ErrorF ("winWindowProc - WM_PAINT\n"); #endif /* Only paint if we have privates and the server is enabled */ - if (pScreenPriv == NULL - || !pScreenPriv->fEnabled - || (pScreenInfo->fFullScreen && !pScreenPriv->fActive)) + if (s_pScreenPriv == NULL + || !s_pScreenPriv->fEnabled + || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive) + || s_pScreenPriv->fBadDepth) { /* We don't want to paint */ break; } /* Break out here if we don't have a valid paint routine */ - if (pScreenPriv->pwinBltExposedRegions == NULL) + if (s_pScreenPriv->pwinBltExposedRegions == NULL) break; /* Call the engine dependent repainter */ - (*pScreenPriv->pwinBltExposedRegions) (pScreen); + (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen); return 0; case WM_PALETTECHANGED: { #if CYGDEBUG - ErrorF ("winWindowProc () WM_PALETTECHANGED\n"); + ErrorF ("winWindowProc - WM_PALETTECHANGED\n"); #endif - /* Don't process if we don't have privates or a colormap */ - if (pScreenPriv == NULL || pScreenPriv->pcmapInstalled == NULL) + /* + * Don't process if we don't have privates or a colormap, + * or if we have an invalid depth. + */ + if (s_pScreenPriv == NULL + || s_pScreenPriv->pcmapInstalled == NULL + || s_pScreenPriv->fBadDepth) break; /* Return if we caused the palette to change */ if ((HWND) wParam == hwnd) { /* Redraw the screen */ - (*pScreenPriv->pwinRedrawScreen) (pScreen); + (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); return 0; } /* Reinstall the windows palette */ - (*pScreenPriv->pwinRealizeInstalledPalette) (pScreen); + (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen); /* Redraw the screen */ - (*pScreenPriv->pwinRedrawScreen) (pScreen); + (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); return 0; } case WM_MOUSEMOVE: /* We can't do anything without privates */ - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - + /* Has the mouse pointer crossed screens? */ - if (pScreen != miPointerCurrentScreen ()) - miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); + if (s_pScreen != miPointerCurrentScreen ()) + miPointerSetNewScreen (s_pScreenInfo->dwScreen, + GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); - /* Sometimes we hide, sometimes we show */ - if (hwndLastMouse != NULL && hwndLastMouse != hwnd) + /* Are we tracking yet? */ + if (!s_fTracking) { - /* Cursor is now over NC area of another screen */ - pScreenPrivLast = GetProp (hwndLastMouse, WIN_SCR_PROP); - if (pScreenPrivLast == NULL) - { - ErrorF ("winWindowProc () - WM_MOUSEMOVE - Couldn't obtain " - "last screen privates\n"); - return 0; - } - - /* Show cursor if last screen is still hiding it */ - if (!pScreenPrivLast->fCursor) - { - pScreenPrivLast->fCursor = TRUE; - ShowCursor (TRUE); - } + TRACKMOUSEEVENT tme; + + /* Setup data structure */ + ZeroMemory (&tme, sizeof (tme)); + tme.cbSize = sizeof (tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = hwnd; + + /* Call the tracking function */ + if (!(*g_fpTrackMouseEvent) (&tme)) + ErrorF ("winWindowProc - _TrackMouseEvent failed\n"); - /* Hide cursor for our screen if we are not hiding it */ - if (pScreenPriv->fCursor) - { - pScreenPriv->fCursor = FALSE; - ShowCursor (FALSE); - } + /* Flag that we are tracking now */ + s_fTracking = TRUE; } - else if (pScreenPriv->fActive - && pScreenPriv->fCursor) + + /* Hide or show the Windows mouse cursor */ + if (s_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer)) { /* Hide Windows cursor */ - pScreenPriv->fCursor = FALSE; + s_fCursor = FALSE; ShowCursor (FALSE); } - else if (!pScreenPriv->fActive - && !pScreenPriv->fCursor) + else if (!s_fCursor && !s_pScreenPriv->fActive + && !s_pScreenInfo->fLessPointer) { /* Show Windows cursor */ - pScreenPriv->fCursor = TRUE; + s_fCursor = TRUE; ShowCursor (TRUE); } - + /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (GET_X_LPARAM(lParam), - GET_Y_LPARAM(lParam), + miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset, g_c32LastInputEventTime = GetTickCount ()); - - /* Store pointer to last window handle */ - hwndLastMouse = hwnd; return 0; case WM_NCMOUSEMOVE: + /* + * We break instead of returning 0 since we need to call + * DefWindowProc to get the mouse cursor changes + * and min/max/close button highlighting in Windows XP. + * The Platform SDK says that you should return 0 if you + * process this message, but it fails to mention that you + * will give up any default functionality if you do return 0. + */ + /* We can't do anything without privates */ - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - + /* Non-client mouse movement, show Windows cursor */ - if (hwndLastMouse != NULL && hwndLastMouse != hwnd) + if (!s_fCursor) { - /* Cursor is now over NC area of another screen */ - pScreenPrivLast = GetProp (hwndLastMouse, WIN_SCR_PROP); - if (pScreenPrivLast == NULL) - { - ErrorF ("winWindowProc () - WM_NCMOUSEMOVE - Couldn't obtain " - "last screen privates\n"); - return 0; - } + s_fCursor = TRUE; + ShowCursor (TRUE); + } + break; - /* Show cursor if last screen is still hiding it */ - if (!pScreenPrivLast->fCursor) - { - pScreenPrivLast->fCursor = TRUE; - ShowCursor (TRUE); - } + case WM_MOUSELEAVE: + /* Mouse has left our client area */ - /* Hide cursor for our screen if we are not hiding it */ - if (pScreenPriv->fCursor) - { - pScreenPriv->fCursor = FALSE; - ShowCursor (FALSE); - } - } - else if (!pScreenPriv->fCursor) + /* Flag that we are no longer tracking */ + s_fTracking = FALSE; + + /* Show the mouse cursor, if necessary */ + if (!s_fCursor) { - pScreenPriv->fCursor = TRUE; + s_fCursor = TRUE; ShowCursor (TRUE); } - - /* Store pointer to last window handle */ - hwndLastMouse = hwnd; return 0; case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseButtonsHandle (pScreen, ButtonPress, Button1, wParam); + if (s_pScreenInfo->fRootless) SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseButtonsHandle (pScreen, ButtonRelease, Button1, wParam); + if (s_pScreenInfo->fRootless) ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseButtonsHandle (pScreen, ButtonPress, Button2, wParam); + if (s_pScreenInfo->fRootless) SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseButtonsHandle (pScreen, ButtonRelease, Button2, wParam); + if (s_pScreenInfo->fRootless) ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseButtonsHandle (pScreen, ButtonPress, Button3, wParam); + if (s_pScreenInfo->fRootless) SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam); + if (s_pScreenInfo->fRootless) ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); case WM_TIMER: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Branch on the timer id */ @@ -302,46 +798,75 @@ case WIN_E3B_TIMER_ID: /* Send delayed button press */ winMouseButtonsSendEvent (ButtonPress, - pScreenPriv->iE3BCachedPress); + s_pScreenPriv->iE3BCachedPress); /* Kill this timer */ - KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); + KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); /* Clear screen privates flags */ - pScreenPriv->iE3BCachedPress = 0; + s_pScreenPriv->iE3BCachedPress = 0; break; } return 0; + case WM_CTLCOLORSCROLLBAR: + FatalError ("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not " + "supposed to get this message. Exiting.\n"); + return 0; + case WM_MOUSEWHEEL: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - return winMouseWheel (pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); +#if CYGDEBUG + ErrorF ("winWindowProc - WM_MOUSEWHEEL\n"); +#endif + winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); + break; case WM_SETFOCUS: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Restore the state of all mode keys */ - winRestoreModeKeyStates (pScreen); + winRestoreModeKeyStates (s_pScreen); return 0; case WM_KILLFOCUS: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Store the state of all mode keys */ - winStoreModeKeyStates (pScreen); + winStoreModeKeyStates (s_pScreen); - /* Release any pressed modifiers */ - winKeybdReleaseModifierKeys (); + /* Release any pressed keys */ + winKeybdReleaseKeys (); return 0; +#if WIN_NEW_KEYBOARD_SUPPORT case WM_SYSKEYDOWN: case WM_KEYDOWN: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + case WM_SYSKEYUP: + case WM_KEYUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + /* Don't process keys if we are not active */ + if (!s_pScreenPriv->fActive) + return 0; + + winProcessKeyEvent ((DWORD)wParam, (DWORD) lParam); + return 0; + + case WM_DEADCHAR: + case WM_SYSDEADCHAR: + return 0; + +#else /* WIN_NEW_KEYBOARD_SUPPORT */ + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + /* * FIXME: Catching Alt-F4 like this is really terrible. This should * be generalized to handle other Windows keyboard signals. Actually, @@ -351,9 +876,9 @@ * can remap certain actions to new key codes that do not conflict * with the X apps that they are using. Yeah, that'll take awhile. */ - if ((pScreenInfo->fUseWinKillKey && wParam == VK_F4 + if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000)) - || (pScreenInfo->fUseUnixKillKey && wParam == VK_BACK + || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK && (GetKeyState (VK_MENU) & 0x8000) && (GetKeyState (VK_CONTROL) & 0x8000))) { @@ -362,7 +887,7 @@ * user enters Alt + F4 and is surprised when the application * quits. */ - ErrorF ("winWindowProc () - Closekey hit, quitting\n"); + ErrorF ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n"); /* Tell our message queue to give up */ PostMessage (hwnd, WM_CLOSE, 0, 0); @@ -389,7 +914,7 @@ case WM_SYSKEYUP: case WM_KEYUP: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* @@ -408,22 +933,52 @@ winTranslateKey (wParam, lParam, &iScanCode); winSendKeyEvent (iScanCode, FALSE); return 0; +#endif /* WIN_NEW_KEYBOARD_SUPPORT */ case WM_HOTKEY: - if (pScreenPriv == NULL) + if (s_pScreenPriv == NULL) break; /* Call the engine-specific hot key handler */ - (*pScreenPriv->pwinHotKeyAltTab) (pScreen); + (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen); return 0; case WM_ACTIVATE: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL + || s_pScreenInfo->fIgnoreInput) break; + /* TODO: Override display of window when we have a bad depth */ + if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) + { + ErrorF ("winWindowProc - WM_ACTIVATE - Bad depth, trying " + "to override window activation\n"); + + /* Minimize the window */ + ShowWindow (hwnd, SW_MINIMIZE); + + /* Display dialog box */ + if (g_hDlgDepthChange != NULL) + { + /* Make the existing dialog box active */ + SetActiveWindow (g_hDlgDepthChange); + } + else + { + /* TODO: Recreate the dialog box and bring to the top */ + ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT); + } + + /* Don't do any other processing of this message */ + return 0; + } + + + #if CYGDEBUG - ErrorF ("winWindowProc () - WM_ACTIVATE\n"); + ErrorF ("winWindowProc - WM_ACTIVATE\n"); #endif + /* * Focus is being changed to another window. * The other window may or may not belong to @@ -431,88 +986,41 @@ */ /* Clear any lingering wheel delta */ - pScreenPriv->iDeltaZ = 0; + s_pScreenPriv->iDeltaZ = 0; - /* Have we changed X screens? */ - if ((LOWORD (wParam) == WA_ACTIVE || LOWORD (wParam) == WA_CLICKACTIVE) - && pScreenPriv->fEnabled && pScreen != miPointerCurrentScreen ()) - miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); - - /* Handle showing or hiding the mouse */ - if (hwndLastMouse != NULL && hwndLastMouse != hwnd) - { - /* - * Activation has transferred between screens. - * This section is processed by the screen receiving - * focus, as it is the only one that notices the difference - * between hwndLastMouse and hwnd. - */ - pScreenPrivLast = GetProp (hwndLastMouse, WIN_SCR_PROP); - if (pScreenPrivLast == NULL) - { - ErrorF ("winWindowProc () - WM_ACTIVATE - Couldn't obtain last " - "screen privates\n"); - return 0; - } - - /* Show cursor if last screen is still hiding it */ - if (!pScreenPrivLast->fCursor) - { - pScreenPrivLast->fCursor = TRUE; - ShowCursor (TRUE); - } - - /* Hide cursor for our screen if we are not hiding it */ - if (pScreenPriv->fCursor) - { - pScreenPriv->fCursor = FALSE; - ShowCursor (FALSE); - } - } - else if ((LOWORD(wParam) == WA_ACTIVE - || LOWORD(wParam) == WA_CLICKACTIVE) - && pScreenPriv->fCursor) - { - pScreenPriv->fCursor = FALSE; - ShowCursor (FALSE); - } - else if (LOWORD(wParam) == WA_INACTIVE - && !pScreenPriv->fCursor) + /* Reshow the Windows mouse cursor if we are being deactivated */ + if (LOWORD(wParam) == WA_INACTIVE + && !s_fCursor) { - pScreenPriv->fCursor = TRUE; + /* Show Windows cursor */ + s_fCursor = TRUE; ShowCursor (TRUE); } - - /* Store last active window handle */ - hwndLastMouse = hwnd; return 0; case WM_ACTIVATEAPP: - if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + if (s_pScreenPriv == NULL + || s_pScreenInfo->fIgnoreInput) break; #if CYGDEBUG - ErrorF ("winWindowProc () - WM_ACTIVATEAPP\n"); + ErrorF ("winWindowProc - WM_ACTIVATEAPP\n"); #endif + /* Activate or deactivate */ - pScreenPriv->fActive = wParam; + s_pScreenPriv->fActive = wParam; - /* Are we activating or deactivating? */ - if (pScreenPriv->fActive - && pScreenPriv->fCursor) - { - pScreenPriv->fCursor = FALSE; - ShowCursor (FALSE); - } - else if (!pScreenPriv->fActive - && !pScreenPriv->fCursor) + /* Reshow the Windows mouse cursor if we are being deactivated */ + if (!s_pScreenPriv->fActive + && !s_fCursor) { - pScreenPriv->fCursor = TRUE; + /* Show Windows cursor */ + s_fCursor = TRUE; ShowCursor (TRUE); } /* Call engine specific screen activation/deactivation function */ - (*pScreenPriv->pwinActivateApp) (pScreen); + (*s_pScreenPriv->pwinActivateApp) (s_pScreen); return 0; case WM_CLOSE: @@ -522,4 +1030,102 @@ } return DefWindowProc (hwnd, message, wParam, lParam); +} + + +/* + * Process messages for the dialog that is displayed for + * disruptive screen depth changes. + */ + +BOOL CALLBACK +winChangeDepthDlgProc (HWND hwndDialog, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static winPrivScreenPtr s_pScreenPriv = NULL; + static winScreenInfo *s_pScreenInfo = NULL; + static ScreenPtr s_pScreen = NULL; + +#if CYGDEBUG + ErrorF ("winChangeDepthDlgProc\n"); +#endif + + /* Branch on message type */ + switch (message) + { + case WM_INITDIALOG: +#if CYGDEBUG + ErrorF ("winChangeDepthDlgProc - WM_INITDIALOG\n"); +#endif + + /* Store pointers to private structures for future use */ + s_pScreenPriv = (winPrivScreenPtr) lParam; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + +#if CYGDEBUG + ErrorF ("winChangeDepthDlgProc - WM_INITDIALG - s_pScreenPriv: %08x, " + "s_pScreenInfo: %08x, s_pScreen: %08x\n", + s_pScreenPriv, s_pScreenInfo, s_pScreen); +#endif + +#if CYGDEBUG + ErrorF ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, " + "last bpp: %d\n", + s_pScreenInfo->dwBPP, + s_pScreenPriv->dwLastWindowsBitsPixel); +#endif + return TRUE; + + case WM_DISPLAYCHANGE: +#if CYGDEBUG + ErrorF ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, " + "last bpp: %d, new bpp: %d\n", + s_pScreenInfo->dwBPP, + s_pScreenPriv->dwLastWindowsBitsPixel, + wParam); +#endif + + /* Dismiss the dialog if the display returns to the original depth */ + if (wParam == s_pScreenInfo->dwBPP) + { + ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n"); + + /* Depth has been restored, dismiss dialog */ + DestroyWindow (g_hDlgDepthChange); + g_hDlgDepthChange = NULL; + + /* Flag that we have a valid screen depth */ + s_pScreenPriv->fBadDepth = FALSE; + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD (wParam)) + { + case IDOK: + case IDCANCEL: + ErrorF ("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); + + /* + * User dismissed the dialog, hide it until the + * display mode is restored. + */ + ShowWindow (g_hDlgDepthChange, SW_HIDE); + return TRUE; + } + break; + + case WM_CLOSE: + ErrorF ("winChangeDepthDlgProc - WM_CLOSE\n"); + + /* + * User dismissed the dialog, hide it until the + * display mode is restored. + */ + ShowWindow (g_hDlgDepthChange, SW_HIDE); + return TRUE; + } + + return FALSE; } Index: xc/programs/Xserver/include/cursor.h diff -u xc/programs/Xserver/include/cursor.h:1.3 xc/programs/Xserver/include/cursor.h:1.6 --- xc/programs/Xserver/include/cursor.h:1.3 Fri Dec 14 14:59:53 2001 +++ xc/programs/Xserver/include/cursor.h Mon Sep 16 21:15:14 2002 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/include/cursor.h,v 1.6 2002/09/17 01:15:14 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -54,6 +55,11 @@ #define NullCursor ((CursorPtr)NULL) +/* Provide support for alpha composited cursors */ +#ifdef RENDER +#define ARGB_CURSOR +#endif + typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; @@ -85,6 +91,21 @@ #endif ); +extern CursorPtr AllocCursorARGB( +#if NeedFunctionPrototypes + unsigned char* /*psrcbits*/, + unsigned char* /*pmaskbits*/, + CARD32* /*argb*/, + CursorMetricPtr /*cm*/, + unsigned /*foreRed*/, + unsigned /*foreGreen*/, + unsigned /*foreBlue*/, + unsigned /*backRed*/, + unsigned /*backGreen*/, + unsigned /*backBlue*/ +#endif +); + extern int AllocGlyphCursor( #if NeedFunctionPrototypes Font /*source*/, @@ -152,5 +173,13 @@ int * /*py*/ #endif ); + +#ifdef PANORAMIX +extern int XineramaGetCursorScreen( +#if NeedFunctionPrototypes + void +#endif +); +#endif /* PANORAMIX */ #endif /* CURSOR_H */ Index: xc/programs/Xserver/include/cursorstr.h diff -u xc/programs/Xserver/include/cursorstr.h:1.6 xc/programs/Xserver/include/cursorstr.h:1.9 --- xc/programs/Xserver/include/cursorstr.h:1.6 Fri Dec 14 14:59:54 2001 +++ xc/programs/Xserver/include/cursorstr.h Sat Jan 11 21:44:27 2003 @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.6 2001/12/14 19:59:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.9 2003/01/12 02:44:27 dawes Exp $ */ #ifndef CURSORSTRUCT_H #define CURSORSTRUCT_H @@ -66,6 +66,9 @@ unsigned short width, height, xhot, yhot; /* metrics */ int refcnt; /* can be shared */ pointer devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ +#ifdef ARGB_CURSOR + CARD32 *argb; /* full-color alpha blended */ +#endif } CursorBits, *CursorBitsPtr; typedef struct _Cursor { Index: xc/programs/Xserver/include/dix.h diff -u xc/programs/Xserver/include/dix.h:3.22 xc/programs/Xserver/include/dix.h:3.26 --- xc/programs/Xserver/include/dix.h:3.22 Fri Dec 14 14:59:54 2001 +++ xc/programs/Xserver/include/dix.h Sat Jan 11 21:44:27 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.22 2001/12/14 19:59:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.26 2003/01/12 02:44:27 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -504,9 +504,8 @@ ); extern void NoopDDA( -#if NeedVarargsPrototypes - void *, - ... +#if NeedFunctionPrototypes + void #endif ); @@ -569,6 +568,12 @@ ); extern void ProcessWorkQueue( +#if NeedFunctionPrototypes + void +#endif +); + +extern void ProcessWorkQueueZombies( #if NeedFunctionPrototypes void #endif Index: xc/programs/Xserver/include/dixstruct.h diff -u xc/programs/Xserver/include/dixstruct.h:3.16 xc/programs/Xserver/include/dixstruct.h:3.18 --- xc/programs/Xserver/include/dixstruct.h:3.16 Sat Oct 27 23:34:12 2001 +++ xc/programs/Xserver/include/dixstruct.h Sat Jan 11 21:44:27 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.16 2001/10/28 03:34:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.18 2003/01/12 02:44:27 dawes Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/Xserver/include/opaque.h diff -u xc/programs/Xserver/include/opaque.h:1.10 xc/programs/Xserver/include/opaque.h:1.11 --- xc/programs/Xserver/include/opaque.h:1.10 Fri Dec 14 14:59:55 2001 +++ xc/programs/Xserver/include/opaque.h Tue Oct 8 19:55:22 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.10 2001/12/14 19:59:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.11 2002/10/08 23:55:22 dawes Exp $ */ #ifndef OPAQUE_H #define OPAQUE_H @@ -75,6 +75,7 @@ extern Bool permitOldBugs; extern Bool defeatAccessControl; extern char* protNoListen; +extern Bool blackRoot; Index: xc/programs/Xserver/include/os.h diff -u xc/programs/Xserver/include/os.h:3.40 xc/programs/Xserver/include/os.h:3.43 --- xc/programs/Xserver/include/os.h:3.40 Fri Dec 14 14:59:55 2001 +++ xc/programs/Xserver/include/os.h Tue Dec 24 12:42:59 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/os.h,v 3.40 2001/12/14 19:59:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/os.h,v 3.43 2002/12/24 17:42:59 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -487,7 +487,8 @@ ... #endif ) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) __attribute((noreturn)) #endif ; @@ -570,7 +571,7 @@ #endif ); -#if !defined(WIN32) && !defined(__EMX__) +#if !defined(WIN32) && !defined(__UNIXOS2__) extern int System(char *); extern pointer Popen(char *, char *); extern int Pclose(pointer); @@ -638,6 +639,8 @@ ClientPtr /* client */ #endif ); + +extern int LocalClientCred(ClientPtr, int *, int *); extern int ChangeAccessControl( #if NeedFunctionPrototypes Index: xc/programs/Xserver/include/resource.h diff -u xc/programs/Xserver/include/resource.h:1.10 xc/programs/Xserver/include/resource.h:1.11 --- xc/programs/Xserver/include/resource.h:1.10 Fri Dec 14 14:59:56 2001 +++ xc/programs/Xserver/include/resource.h Wed Mar 6 16:14:04 2002 @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.10 2001/12/14 19:59:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.11 2002/03/06 21:14:04 mvojkovi Exp $ */ #ifndef RESOURCE_H #define RESOURCE_H 1 @@ -137,6 +137,15 @@ #endif ); +typedef void (*FindAllRes)( +#if NeedNestedPrototypes + pointer /*value*/, + XID /*id*/, + RESTYPE /*type*/, + pointer /*cdata*/ +#endif +); + typedef Bool (*FindComplexResType)( #if NeedNestedPrototypes pointer /*value*/, @@ -214,6 +223,14 @@ #endif ); +extern void FindAllClientResources( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + FindAllRes /*func*/, + pointer /*cdata*/ +#endif +); + extern void FreeClientNeverRetainResources( #if NeedFunctionPrototypes ClientPtr /*client*/ @@ -321,6 +338,14 @@ XID * /*pids*/ #endif ); + +extern RESTYPE lastResourceType; +extern RESTYPE TypeMask; + +#ifdef XResExtension +extern Atom *ResourceNames; +void RegisterResourceName(RESTYPE type, char* name); +#endif #endif /* RESOURCE_H */ Index: xc/programs/Xserver/include/servermd.h diff -u xc/programs/Xserver/include/servermd.h:3.51 xc/programs/Xserver/include/servermd.h:3.53 --- xc/programs/Xserver/include/servermd.h:3.51 Fri Dec 14 14:59:56 2001 +++ xc/programs/Xserver/include/servermd.h Fri May 31 14:46:04 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.51 2001/12/14 19:59:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.53 2002/05/31 18:46:04 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -403,6 +403,27 @@ #endif /* ia64 */ +#if defined(__x86_64__) || defined(x86_64) +# define IMAGE_BYTE_ORDER LSBFirst + +# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) +# define BITMAP_BIT_ORDER MSBFirst +# else +# define BITMAP_BIT_ORDER LSBFirst +# endif + +# if defined(XF86MONOVGA) || defined(XF86VGA16) +# define BITMAP_SCANLINE_UNIT 8 +# endif + +# define GLYPHPADBYTES 4 +# define GETLEFTBITS_ALIGNMENT 1 +# define LARGE_INSTRUCTION_CACHE +# define FAST_CONSTANT_OFFSET_MODE +/* ???? */ +# define FAST_UNALIGNED_READS +#endif /* x86_64 */ + #ifdef stellar #define IMAGE_BYTE_ORDER MSBFirst /* Values for the stellar only*/ @@ -436,7 +457,7 @@ #if (defined(SVR4) && defined(i386)) || \ defined(__alpha__) || defined(__alpha) || \ defined(__i386__) || \ - defined(__EMX__) || \ + defined(__UNIXOS2__) || \ defined(__OS2ELF__) || \ defined(__QNX__) || \ defined(__s390x__) || defined(__s390__) Index: xc/programs/Xserver/iplan2p4/Imakefile diff -u xc/programs/Xserver/iplan2p4/Imakefile:3.4 xc/programs/Xserver/iplan2p4/Imakefile:3.5 --- xc/programs/Xserver/iplan2p4/Imakefile:3.4 Sat Apr 17 05:08:48 1999 +++ xc/programs/Xserver/iplan2p4/Imakefile Fri May 31 14:46:05 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/iplan2p4/Imakefile,v 3.4 1999/04/17 09:08:48 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/iplan2p4/Imakefile,v 3.5 2002/05/31 18:46:05 dawes Exp $ XCOMM $XConsortium: Imakefile,v 5.41 93/09/06 18:37:23 rws Exp $ #include <Server.tmpl> @@ -116,6 +116,4 @@ ObjectFromSpecialSource(iplply1rctC,iplply1rct,-DRROP=GXcopy) ObjectFromSpecialSource(iplply1rctG,iplply1rct,-DRROP=GXset) -#ifndef OS2Architecture DependTarget() -#endif Index: xc/programs/Xserver/mfb/Imakefile diff -u xc/programs/Xserver/mfb/Imakefile:3.15 xc/programs/Xserver/mfb/Imakefile:3.17 --- xc/programs/Xserver/mfb/Imakefile:3.15 Wed Jan 17 17:37:01 2001 +++ xc/programs/Xserver/mfb/Imakefile Sat Jun 1 21:21:17 2002 @@ -3,18 +3,24 @@ -XCOMM $XFree86: xc/programs/Xserver/mfb/Imakefile,v 3.15 2001/01/17 22:37:01 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/mfb/Imakefile,v 3.17 2002/06/02 01:21:17 dawes Exp $ +#if DoLoadableServer +#if !BuildModuleInSubdir #define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + #include <Server.tmpl> -#ifdef XFree86Version -#if DoLoadableServer +#if defined(IHaveModules) XF86INCL = -I$(XF86COMSRC) -I$(XF86SRC) XFMODSRC = mfbmodule.c XFMODOBJ = mfbmodule.o #endif -#endif #if BuildLowMem DEFINES=-ULOWMEMFTPT @@ -47,15 +53,22 @@ mfbtewhite.o mfbteblack.o mfbmisc.o mfbbstore.o \ mfbplywhite.o mfbplyblack.o mfbplyinv.o $(XFMODOBJ) -INCLUDES = -I. -I../mi -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) $(XF86INCL) +INCLUDES = -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ + -I$(XINCLUDESRC) -I$(FONTINCSRC) $(XF86INCL) LINTDEFS = -DMFBPOLYGLYPHBLT=mfbPolyGlyphBltWhite \ -DMFBIMAGEGLYPHBLT=mfbImageGlyphBltWhite \ -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE -DOPEQ=MFB_OPEQ_WHITE -LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln ../mi/llib-lmi.ln +LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln \ + $(SERVERSRC)/mi/llib-lmi.ln +#ifdef IHaveModules ModuleObjectRule() LibraryModuleTarget(mfb,$(OBJS)) +#else +NormalLibraryObjectRule() +NormalLibraryTarget(mfb,$(OBJS)) +#endif LintLibraryTarget(mfb,$(SRCS1)) NormalLintTarget($(LINTDEFS) $(SRCS1)) @@ -104,12 +117,56 @@ SpecialCObjectRule(mfbpixmap,$(ICONFIGFILES),$(_NOOP_)) +#ifdef IHaveModules InstallLibraryModule(mfb,$(MODULEDIR),.) +#endif -#ifndef OS2Architecture DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) #endif InstallDriverSDKLibraryModule(mfb,$(DRIVERSDKMODULEDIR),.) InstallDriverSDKNonExecFile(mfb.h,$(DRIVERSDKINCLUDEDIR)) + + +#ifdef LinkDirectory +LinkSourceFile(maskbits.c,LinkDirectory) +LinkSourceFile(mfbbitblt.c,LinkDirectory) +LinkSourceFile(mfbblt.c,LinkDirectory) +LinkSourceFile(mfbbres.c,LinkDirectory) +LinkSourceFile(mfbbresd.c,LinkDirectory) +LinkSourceFile(mfbbstore.c,LinkDirectory) +LinkSourceFile(mfbclip.c,LinkDirectory) +LinkSourceFile(mfbcmap.c,LinkDirectory) +LinkSourceFile(mfbfillarc.c,LinkDirectory) +LinkSourceFile(mfbfillrct.c,LinkDirectory) +LinkSourceFile(mfbfillsp.c,LinkDirectory) +LinkSourceFile(mfbfont.c,LinkDirectory) +LinkSourceFile(mfbgc.c,LinkDirectory) +LinkSourceFile(mfbgetsp.c,LinkDirectory) +LinkSourceFile(mfbhrzvert.c,LinkDirectory) +LinkSourceFile(mfbimage.c,LinkDirectory) +LinkSourceFile(mfbimggblt.c,LinkDirectory) +LinkSourceFile(mfbline.c,LinkDirectory) +LinkSourceFile(mfbmisc.c,LinkDirectory) +LinkSourceFile(mfbmodule.c,LinkDirectory) +LinkSourceFile(mfbpixmap.c,LinkDirectory) +LinkSourceFile(mfbply1rct.c,LinkDirectory) +LinkSourceFile(mfbplygblt.c,LinkDirectory) +LinkSourceFile(mfbpntarea.c,LinkDirectory) +LinkSourceFile(mfbpntwin.c,LinkDirectory) +LinkSourceFile(mfbpolypnt.c,LinkDirectory) +LinkSourceFile(mfbpushpxl.c,LinkDirectory) +LinkSourceFile(mfbscrclse.c,LinkDirectory) +LinkSourceFile(mfbscrinit.c,LinkDirectory) +LinkSourceFile(mfbsetsp.c,LinkDirectory) +LinkSourceFile(mfbtegblt.c,LinkDirectory) +LinkSourceFile(mfbtile.c,LinkDirectory) +LinkSourceFile(mfbwindow.c,LinkDirectory) +LinkSourceFile(mfbzerarc.c,LinkDirectory) +#endif + Index: xc/programs/Xserver/mfb/maskbits.h diff -u xc/programs/Xserver/mfb/maskbits.h:3.8 xc/programs/Xserver/mfb/maskbits.h:3.9 --- xc/programs/Xserver/mfb/maskbits.h:3.8 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/maskbits.h Tue Feb 18 16:30:00 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/maskbits.h,v 3.8 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/maskbits.h,v 3.9 2003/02/18 21:30:00 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -523,7 +523,7 @@ #endif #if GETLEFTBITS_ALIGNMENT == 1 -#define getleftbits(psrc, w, dst) dst = *((CARD32 *) psrc) +#define getleftbits(psrc, w, dst) dst = *((CARD32 *)(pointer) psrc) #endif /* GETLEFTBITS_ALIGNMENT == 1 */ #if GETLEFTBITS_ALIGNMENT == 2 Index: xc/programs/Xserver/mfb/mfb.h diff -u xc/programs/Xserver/mfb/mfb.h:1.18 xc/programs/Xserver/mfb/mfb.h:1.19 --- xc/programs/Xserver/mfb/mfb.h:1.18 Fri Dec 14 15:00:04 2001 +++ xc/programs/Xserver/mfb/mfb.h Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.18 2001/12/14 20:00:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.19 2003/02/18 21:30:01 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -1040,21 +1040,22 @@ private field of GC */ +typedef void (*mfbFillAreaProcPtr)( +#if NeedNestedPrototypes + DrawablePtr /*pDraw*/, + int /*nbox*/, + BoxPtr /*pbox*/, + int /*alu*/, + PixmapPtr /*nop*/ +#endif + ); typedef struct { unsigned char rop; /* reduction of rasterop to 1 of 3 */ unsigned char ropOpStip; /* rop for opaque stipple */ unsigned char ropFillArea; /* == alu, rop, or ropOpStip */ unsigned char unused1[sizeof(long) - 3]; /* Alignment */ - void (* FillArea)( /* fills regions; look at the code */ -#if NeedNestedPrototypes - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*nop*/ -#endif - ); + mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */ } mfbPrivGC; typedef mfbPrivGC *mfbPrivGCPtr; #endif Index: xc/programs/Xserver/mfb/mfbcmap.c diff -u xc/programs/Xserver/mfb/mfbcmap.c:1.7 xc/programs/Xserver/mfb/mfbcmap.c:1.8 --- xc/programs/Xserver/mfb/mfbcmap.c:1.7 Fri Dec 14 15:00:06 2001 +++ xc/programs/Xserver/mfb/mfbcmap.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.7 2001/12/14 20:00:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.8 2003/02/18 21:30:01 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -51,6 +51,7 @@ #include "colormapst.h" #include "resource.h" #include "micmap.h" +#include "mfb.h" /* A monochrome frame buffer is a static gray colormap with two entries. * We have a "required list" of length 1. Because we can only support 1 Index: xc/programs/Xserver/mfb/mfbfillrct.c diff -u xc/programs/Xserver/mfb/mfbfillrct.c:1.5 xc/programs/Xserver/mfb/mfbfillrct.c:1.6 --- xc/programs/Xserver/mfb/mfbfillrct.c:1.5 Fri Dec 14 15:00:06 2001 +++ xc/programs/Xserver/mfb/mfbfillrct.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.5 2001/12/14 20:00:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.6 2003/02/18 21:30:01 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -60,7 +60,6 @@ #include "maskbits.h" #define MODEQ(a, b) ((a) %= (b)) -void mfbPaintOddSize(); /* filled rectangles. @@ -89,7 +88,7 @@ int xorg, yorg; mfbPrivGC *priv; int alu; - void (* pfn) (); + mfbFillAreaProcPtr pfn; PixmapPtr ppix; if (!(pGC->planemask & 1)) Index: xc/programs/Xserver/mfb/mfbgc.c diff -u xc/programs/Xserver/mfb/mfbgc.c:1.7 xc/programs/Xserver/mfb/mfbgc.c:1.8 --- xc/programs/Xserver/mfb/mfbgc.c:1.7 Fri Dec 14 15:00:07 2001 +++ xc/programs/Xserver/mfb/mfbgc.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.7 2001/12/14 20:00:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.8 2003/02/18 21:30:01 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -1218,7 +1218,7 @@ devPriv->FillArea = mfbSolidInvertArea; break; case RROP_NOP: - devPriv->FillArea = (void (*)())NoopDDA; + devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA; break; } } @@ -1236,7 +1236,7 @@ devPriv->FillArea = mfbStippleInvertArea; break; case RROP_NOP: - devPriv->FillArea = (void (*)())NoopDDA; + devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA; break; } } @@ -1349,7 +1349,7 @@ devPriv->FillArea = mfbSolidInvertArea; break; case RROP_NOP: - devPriv->FillArea = (void (*)())NoopDDA; + devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA; break; } } @@ -1367,7 +1367,7 @@ devPriv->FillArea = mfbStippleInvertArea; break; case RROP_NOP: - devPriv->FillArea = (void (*)())NoopDDA; + devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA; break; } } Index: xc/programs/Xserver/mfb/mfbgetsp.c diff -u xc/programs/Xserver/mfb/mfbgetsp.c:1.3 xc/programs/Xserver/mfb/mfbgetsp.c:1.4 --- xc/programs/Xserver/mfb/mfbgetsp.c:1.3 Fri Dec 14 15:00:08 2001 +++ xc/programs/Xserver/mfb/mfbgetsp.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbgetsp.c,v 1.3 2001/12/14 20:00:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbgetsp.c,v 1.4 2003/02/18 21:30:01 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -77,7 +77,7 @@ int nspans; /* number of scanlines to copy */ char *pchardstStart; /* where to put the bits */ { - PixelType *pdstStart = (PixelType *)pchardstStart; + PixelType *pdstStart = (PixelType *)(pointer)pchardstStart; register PixelType *pdst; /* where to put the bits */ register PixelType *psrc; /* where to get the bits */ register PixelType tmpSrc; /* scratch buffer for bits */ Index: xc/programs/Xserver/mfb/mfbimggblt.c diff -u xc/programs/Xserver/mfb/mfbimggblt.c:3.4 xc/programs/Xserver/mfb/mfbimggblt.c:3.5 --- xc/programs/Xserver/mfb/mfbimggblt.c:3.4 Fri Dec 14 15:00:08 2001 +++ xc/programs/Xserver/mfb/mfbimggblt.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.4 2001/12/14 20:00:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.5 2003/02/18 21:30:01 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -139,7 +139,8 @@ register PixelType endmask; register int nFirst;/* bits of glyph in current longword */ - void (* oldFillArea)(); + mfbPrivGC *pPrivGC; + mfbFillAreaProcPtr oldFillArea; /* we might temporarily usurp this field in devPriv */ @@ -181,23 +182,20 @@ but that is usually not a cheap thing to do. */ - oldFillArea = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea; + pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr; + oldFillArea = pPrivGC->FillArea; -/* pcc doesn't like this. why? - ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = - ((pGC->bgPixel & 1) ? mfbSolidWhiteArea : mfbSolidBlackArea); -*/ if (pGC->bgPixel & 1) - ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = mfbSolidWhiteArea; + pPrivGC->FillArea = mfbSolidWhiteArea; else - ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = mfbSolidBlackArea; + pPrivGC->FillArea = mfbSolidBlackArea; #ifndef LOWMEMFTPT mfbPolyFillRect(pDrawable, pGC, 1, &backrect); #else miPolyFillRect(pDrawable, pGC, 1, &backrect); #endif - ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = oldFillArea; + pPrivGC->FillArea = oldFillArea; /* the faint-hearted can open their eyes now */ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) Index: xc/programs/Xserver/mfb/mfbply1rct.c diff -u xc/programs/Xserver/mfb/mfbply1rct.c:1.7 xc/programs/Xserver/mfb/mfbply1rct.c:1.8 --- xc/programs/Xserver/mfb/mfbply1rct.c:1.7 Fri Dec 14 15:00:10 2001 +++ xc/programs/Xserver/mfb/mfbply1rct.c Sun Dec 8 23:10:57 2002 @@ -26,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.7 2001/12/14 20:00:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.8 2002/12/09 04:10:57 tsi Exp $ */ #include "X.h" @@ -62,6 +62,8 @@ MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn) DrawablePtr pDrawable; GCPtr pGC; + int shape; + int mode; int count; DDXPointPtr ptsIn; { Index: xc/programs/Xserver/mfb/mfbpushpxl.c diff -u xc/programs/Xserver/mfb/mfbpushpxl.c:1.5 xc/programs/Xserver/mfb/mfbpushpxl.c:1.7 --- xc/programs/Xserver/mfb/mfbpushpxl.c:1.5 Fri Dec 14 15:00:11 2001 +++ xc/programs/Xserver/mfb/mfbpushpxl.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.5 2001/12/14 20:00:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.7 2003/02/18 21:30:01 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -108,7 +108,7 @@ register BoxPtr pbox; int i; - if (!pGC->planemask & 1) return; + if (!(pGC->planemask & 1)) return; /* compute the reduced rop function */ alu = pGC->alu; @@ -179,7 +179,7 @@ for(h = 0; h < dy; h++) { - pw = (PixelType *) + pw = (PixelType *)(pointer) (((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind)); pwLineStart = pw; /* Process all words which are fully in the pixmap */ Index: xc/programs/Xserver/mfb/mfbscrclse.c diff -u xc/programs/Xserver/mfb/mfbscrclse.c:1.2 xc/programs/Xserver/mfb/mfbscrclse.c:1.4 --- xc/programs/Xserver/mfb/mfbscrclse.c:1.2 Fri Dec 14 15:00:12 2001 +++ xc/programs/Xserver/mfb/mfbscrclse.c Tue Feb 18 16:30:01 2003 @@ -45,12 +45,15 @@ SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/mfb/mfbscrclse.c,v 1.4 2003/02/18 21:30:01 tsi Exp $ */ +#include "mfb.h" #include "scrnintstr.h" /*ARGSUSED*/ Bool mfbCloseScreen(index, pScreen) + int index; register ScreenPtr pScreen; { xfree(pScreen->devPrivate); Index: xc/programs/Xserver/mfb/mfbscrinit.c diff -u xc/programs/Xserver/mfb/mfbscrinit.c:3.8 xc/programs/Xserver/mfb/mfbscrinit.c:3.9 --- xc/programs/Xserver/mfb/mfbscrinit.c:3.8 Fri Dec 14 15:00:12 2001 +++ xc/programs/Xserver/mfb/mfbscrinit.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.8 2001/12/14 20:00:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.9 2003/02/18 21:30:01 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -159,7 +159,7 @@ pScreen->InstallColormap = mfbInstallColormap; pScreen->UninstallColormap = mfbUninstallColormap; pScreen->ListInstalledColormaps = mfbListInstalledColormaps; - pScreen->StoreColors = (void (*)())NoopDDA; + pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA; pScreen->ResolveColor = mfbResolveColor; pScreen->BitmapToRegion = mfbPixmapToRegion; if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, Index: xc/programs/Xserver/mfb/mfbsetsp.c diff -u xc/programs/Xserver/mfb/mfbsetsp.c:1.6 xc/programs/Xserver/mfb/mfbsetsp.c:1.7 --- xc/programs/Xserver/mfb/mfbsetsp.c:1.6 Fri Dec 14 15:00:12 2001 +++ xc/programs/Xserver/mfb/mfbsetsp.c Tue Feb 18 16:30:01 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.6 2001/12/14 20:00:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.7 2003/02/18 21:30:01 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -159,7 +159,7 @@ int nspans; int fSorted; { - PixelType *psrc = (PixelType *)pcharsrc; + PixelType *psrc = (PixelType *)(pointer)pcharsrc; PixelType *pdstBase; /* start of dst bitmap */ int widthDst; /* width of bitmap in words */ register BoxPtr pbox, pboxLast, pboxTest; Index: xc/programs/Xserver/mfb/mfbtile.c diff -u xc/programs/Xserver/mfb/mfbtile.c:1.2 xc/programs/Xserver/mfb/mfbtile.c:1.3 --- xc/programs/Xserver/mfb/mfbtile.c:1.2 Fri Dec 14 15:00:13 2001 +++ xc/programs/Xserver/mfb/mfbtile.c Tue Feb 18 16:30:01 2003 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/mfb/mfbtile.c,v 1.3 2003/02/18 21:30:01 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -219,7 +220,7 @@ int alu; PixmapPtr ptile; { - void (*f)(), mfbTileAreaPPWCopy(), mfbTileAreaPPWGeneral(); + void (*f)(); if (alu == GXcopy) f = mfbTileAreaPPWCopy; Index: xc/programs/Xserver/mfb/mfbzerarc.c diff -u xc/programs/Xserver/mfb/mfbzerarc.c:3.6 xc/programs/Xserver/mfb/mfbzerarc.c:3.7 --- xc/programs/Xserver/mfb/mfbzerarc.c:3.6 Fri Dec 14 15:00:13 2001 +++ xc/programs/Xserver/mfb/mfbzerarc.c Thu Sep 26 21:57:47 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.6 2001/12/14 20:00:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.7 2002/09/27 01:57:47 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -218,7 +218,7 @@ int x2, y2; RegionPtr cclip; - if (!pGC->planemask & 1) + if (!(pGC->planemask & 1)) return; cclip = pGC->pCompositeClip; for (arc = parcs, i = narcs; --i >= 0; arc++) Index: xc/programs/Xserver/mfb/module/Imakefile diff -u /dev/null xc/programs/Xserver/mfb/module/Imakefile:1.1 --- /dev/null Thu Feb 27 12:33:57 2003 +++ xc/programs/Xserver/mfb/module/Imakefile Fri May 31 12:12:18 2002 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/mfb/module/Imakefile,v 1.1 2002/05/31 16:12:18 dawes Exp $ + +#define IHaveModules +#define LinkDirectory .. + +#include "../Imakefile" Index: xc/programs/Xserver/mi/Imakefile diff -u xc/programs/Xserver/mi/Imakefile:3.33 xc/programs/Xserver/mi/Imakefile:3.34 --- xc/programs/Xserver/mi/Imakefile:3.33 Mon Apr 23 12:17:12 2001 +++ xc/programs/Xserver/mi/Imakefile Wed May 22 17:38:31 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.33 2001/04/23 16:17:12 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.34 2002/05/22 21:38:31 herrb Exp $ #include <Server.tmpl> @@ -67,6 +67,9 @@ SpecialCObjectRule(miscrinit,$(ICONFIGFILES),$(EXT_DEFINES)) #ifdef ItsyCompilerBug SpecialCObjectRule(mipolycon,$(_NOOP_),-O0) +#endif +#if defined(OpenBSDArchitecture) && defined(Sparc64Architecture) +SpecialCObjectRule(mizerclip,NullParameter,-O0) #endif AllTarget($(EXTRAMIINITEXTOBJ)) Index: xc/programs/Xserver/mi/mibank.c diff -u xc/programs/Xserver/mi/mibank.c:1.12 xc/programs/Xserver/mi/mibank.c:1.13 --- xc/programs/Xserver/mi/mibank.c:1.12 Wed Jan 16 11:22:32 2002 +++ xc/programs/Xserver/mi/mibank.c Wed Jan 1 14:16:42 2003 @@ -1,5 +1,5 @@ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -44,7 +44,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.12 2002/01/16 16:22:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.13 2003/01/01 19:16:42 tsi Exp $ */ /* * This thing originated from an idea of Edwin Goei and his bank switching Index: xc/programs/Xserver/mi/mibank.h diff -u xc/programs/Xserver/mi/mibank.h:1.9 xc/programs/Xserver/mi/mibank.h:1.10 --- xc/programs/Xserver/mi/mibank.h:1.9 Wed Jan 16 11:22:32 2002 +++ xc/programs/Xserver/mi/mibank.h Wed Jan 1 14:16:42 2003 @@ -1,5 +1,5 @@ /* - * Copyright 1997 through 2002 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -20,7 +20,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.9 2002/01/16 16:22:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.10 2003/01/01 19:16:42 tsi Exp $ */ #ifndef __MIBANK_H__ #define __MIBANK_H__ 1 Index: xc/programs/Xserver/mi/micoord.h diff -u xc/programs/Xserver/mi/micoord.h:1.3 xc/programs/Xserver/mi/micoord.h:1.5 --- xc/programs/Xserver/mi/micoord.h:1.3 Sat Oct 27 23:34:15 2001 +++ xc/programs/Xserver/mi/micoord.h Wed May 22 17:38:31 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/micoord.h,v 1.3 2001/10/28 03:34:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/micoord.h,v 1.5 2002/05/22 21:38:31 herrb Exp $ */ /* * Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. * @@ -45,11 +45,12 @@ */ #if defined(mips) || \ - defined(sparc) || \ + defined(sparc) || defined(__sparc64__) || \ defined(__alpha) || defined(__alpha__) || \ defined(__i386__) || defined(i386) || \ defined(__ia64__) || defined(ia64) || \ - defined(__s390x__) || defined(__s390__) + defined(__s390x__) || defined(__s390__) || \ + defined(__x86_64__) || defined(x86_64) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) Index: xc/programs/Xserver/mi/midispcur.c diff -u xc/programs/Xserver/mi/midispcur.c:1.6 xc/programs/Xserver/mi/midispcur.c:1.9 --- xc/programs/Xserver/mi/midispcur.c:1.6 Fri Dec 14 15:00:21 2001 +++ xc/programs/Xserver/mi/midispcur.c Sun Dec 8 23:10:57 2002 @@ -30,7 +30,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.6 2001/12/14 20:00:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.9 2002/12/09 04:10:57 tsi Exp $ */ #define NEED_EVENTS # include "X.h" @@ -45,6 +45,9 @@ # include "mipointer.h" # include "misprite.h" # include "gcstruct.h" +#ifdef ARGB_CURSOR +# include "picturestr.h" +#endif /* per-screen private data */ @@ -60,12 +63,19 @@ GCPtr pPixSourceGC, pPixMaskGC; CloseScreenProcPtr CloseScreen; PixmapPtr pSave, pTemp; +#ifdef ARGB_CURSOR + PicturePtr pRootPicture; + PicturePtr pTempPicture; +#endif } miDCScreenRec, *miDCScreenPtr; /* per-cursor per-screen private data */ typedef struct { PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ +#ifdef ARGB_CURSOR + PicturePtr pPicture; +#endif } miDCCursorRec, *miDCCursorPtr; /* @@ -126,6 +136,10 @@ pScreenPriv->pMoveGC = pScreenPriv->pPixSourceGC = pScreenPriv->pPixMaskGC = NULL; +#ifdef ARGB_CURSOR + pScreenPriv->pRootPicture = NULL; + pScreenPriv->pTempPicture = NULL; +#endif pScreenPriv->pSave = pScreenPriv->pTemp = NULL; @@ -144,9 +158,11 @@ #define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0) #define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE) +#define tossPict(pict) (pict ? FreePicture (pict, 0) : 0) static Bool miDCCloseScreen (index, pScreen) + int index; ScreenPtr pScreen; { miDCScreenPtr pScreenPriv; @@ -162,6 +178,10 @@ tossGC (pScreenPriv->pPixMaskGC); tossPix (pScreenPriv->pSave); tossPix (pScreenPriv->pTemp); +#ifdef ARGB_CURSOR + tossPict (pScreenPriv->pRootPicture); + tossPict (pScreenPriv->pTempPicture); +#endif xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (index, pScreen); } @@ -176,6 +196,46 @@ return TRUE; } +#ifdef ARGB_CURSOR +#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win)) + +static VisualPtr +miDCGetWindowVisual (WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + VisualID vid = wVisual (pWin); + int i; + + for (i = 0; i < pScreen->numVisuals; i++) + if (pScreen->visuals[i].vid == vid) + return &pScreen->visuals[i]; + return 0; +} + +static PicturePtr +miDCMakePicture (PicturePtr *ppPicture, DrawablePtr pDraw, WindowPtr pWin) +{ + ScreenPtr pScreen = pDraw->pScreen; + VisualPtr pVisual; + PictFormatPtr pFormat; + XID subwindow_mode = IncludeInferiors; + PicturePtr pPicture; + int error; + + pVisual = miDCGetWindowVisual (pWin); + if (!pVisual) + return 0; + pFormat = PictureMatchVisual (pScreen, pDraw->depth, pVisual); + if (!pFormat) + return 0; + pPicture = CreatePicture (0, pDraw, pFormat, + CPSubwindowMode, &subwindow_mode, + serverClient, &error); + *ppPicture = pPicture; + return pPicture; +} +#endif + static miDCCursorPtr miDCRealize ( ScreenPtr pScreen, @@ -188,6 +248,55 @@ pPriv = (miDCCursorPtr) xalloc (sizeof (miDCCursorRec)); if (!pPriv) return (miDCCursorPtr)NULL; +#ifdef ARGB_CURSOR + if (pCursor->bits->argb) + { + PixmapPtr pPixmap; + PictFormatPtr pFormat; + int error; + + pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); + if (!pFormat) + { + xfree ((pointer) pPriv); + return (miDCCursorPtr)NULL; + } + + pPriv->sourceBits = 0; + pPriv->maskBits = 0; + pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, + pCursor->bits->height, 32); + if (!pPixmap) + { + xfree ((pointer) pPriv); + return (miDCCursorPtr)NULL; + } + pGC = GetScratchGC (32, pScreen); + if (!pGC) + { + (*pScreen->DestroyPixmap) (pPixmap); + xfree ((pointer) pPriv); + return (miDCCursorPtr)NULL; + } + ValidateGC (&pPixmap->drawable, pGC); + (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, + 0, 0, pCursor->bits->width, + pCursor->bits->height, + 0, ZPixmap, (char *) pCursor->bits->argb); + FreeScratchGC (pGC); + pPriv->pPicture = CreatePicture (0, &pPixmap->drawable, + pFormat, 0, 0, serverClient, &error); + (*pScreen->DestroyPixmap) (pPixmap); + if (!pPriv->pPicture) + { + xfree ((pointer) pPriv); + return (miDCCursorPtr)NULL; + } + pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; + return pPriv; + } + pPriv->pPicture = 0; +#endif pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); if (!pPriv->sourceBits) { @@ -250,8 +359,14 @@ pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (pPriv && (pCursor->bits->refcnt <= 1)) { - (*pScreen->DestroyPixmap) (pPriv->sourceBits); - (*pScreen->DestroyPixmap) (pPriv->maskBits); + if (pPriv->sourceBits) + (*pScreen->DestroyPixmap) (pPriv->sourceBits); + if (pPriv->maskBits) + (*pScreen->DestroyPixmap) (pPriv->maskBits); +#ifdef ARGB_CURSOR + if (pPriv->pPicture) + FreePicture (pPriv->pPicture, 0); +#endif xfree ((pointer) pPriv); pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; } @@ -312,6 +427,7 @@ return pGC; } + static Bool miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) ScreenPtr pScreen; @@ -332,18 +448,36 @@ } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pWin = WindowTable[pScreen->myNum]; - if (!EnsureGC(pScreenPriv->pSourceGC, pWin)) - return FALSE; - if (!EnsureGC(pScreenPriv->pMaskGC, pWin)) +#ifdef ARGB_CURSOR + if (pPriv->pPicture) { - FreeGC (pScreenPriv->pSourceGC, (GContext) 0); - pScreenPriv->pSourceGC = 0; - return FALSE; + if (!EnsurePicture(pScreenPriv->pRootPicture, &pWin->drawable, pWin)) + return FALSE; + CompositePicture (PictOpOver, + pPriv->pPicture, + NULL, + pScreenPriv->pRootPicture, + 0, 0, 0, 0, + x, y, + pCursor->bits->width, + pCursor->bits->height); } - miDCPutBits ((DrawablePtr)pWin, pPriv, - pScreenPriv->pSourceGC, pScreenPriv->pMaskGC, - x, y, pCursor->bits->width, pCursor->bits->height, - source, mask); + else +#endif + { + if (!EnsureGC(pScreenPriv->pSourceGC, pWin)) + return FALSE; + if (!EnsureGC(pScreenPriv->pMaskGC, pWin)) + { + FreeGC (pScreenPriv->pSourceGC, (GContext) 0); + pScreenPriv->pSourceGC = 0; + return FALSE; + } + miDCPutBits ((DrawablePtr)pWin, pPriv, + pScreenPriv->pSourceGC, pScreenPriv->pMaskGC, + x, y, pCursor->bits->width, pCursor->bits->height, + source, mask); + } return TRUE; } @@ -567,6 +701,13 @@ { if (pTemp) (*pScreen->DestroyPixmap) (pTemp); +#ifdef ARGB_CURSOR + if (pScreenPriv->pTempPicture) + { + FreePicture (pScreenPriv->pTempPicture, 0); + pScreenPriv->pTempPicture = 0; + } +#endif pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap) (pScreen, w, h, pScreenPriv->pSave->drawable.depth); if (!pTemp) @@ -591,24 +732,42 @@ /* * draw the cursor in the temporary pixmap */ - if (!pScreenPriv->pPixSourceGC) +#ifdef ARGB_CURSOR + if (pPriv->pPicture) { - pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); - if (!pScreenPriv->pPixSourceGC) + if (!EnsurePicture(pScreenPriv->pTempPicture, &pTemp->drawable, pWin)) return FALSE; + CompositePicture (PictOpOver, + pPriv->pPicture, + NULL, + pScreenPriv->pTempPicture, + 0, 0, 0, 0, + dx, dy, + pCursor->bits->width, + pCursor->bits->height); } - if (!pScreenPriv->pPixMaskGC) + else +#endif { - pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + if (!pScreenPriv->pPixSourceGC) + { + pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp, + GCGraphicsExposures, &gcval, &status); + if (!pScreenPriv->pPixSourceGC) + return FALSE; + } if (!pScreenPriv->pPixMaskGC) - return FALSE; + { + pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp, + GCGraphicsExposures, &gcval, &status); + if (!pScreenPriv->pPixMaskGC) + return FALSE; + } + miDCPutBits ((DrawablePtr)pTemp, pPriv, + pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC, + dx, dy, pCursor->bits->width, pCursor->bits->height, + source, mask); } - miDCPutBits ((DrawablePtr)pTemp, pPriv, - pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC, - dx, dy, pCursor->bits->width, pCursor->bits->height, - source, mask); /* * copy the temporary pixmap onto the screen Index: xc/programs/Xserver/mi/miinitext.c diff -u xc/programs/Xserver/mi/miinitext.c:3.63 xc/programs/Xserver/mi/miinitext.c:3.68 --- xc/programs/Xserver/mi/miinitext.c:3.63 Fri Dec 14 15:00:23 2001 +++ xc/programs/Xserver/mi/miinitext.c Tue Jan 14 21:34:14 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.63 2001/12/14 20:00:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.68 2003/01/15 02:34:14 torrey Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -76,26 +76,30 @@ #include "loaderProcs.h" #endif -#include <X11/Xlib.h> #ifdef MITSHM +#define _XSHM_SERVER_ #include "shmstr.h" #endif #ifdef XTEST +#define _XTEST_SERVER_ #include "XTest.h" #endif #ifdef XKB #include "XKB.h" #endif #ifdef LBX +#define _XLBX_SERVER_ #include "lbxstr.h" #endif #ifdef XPRINT #include "Print.h" #endif #ifdef XAPPGROUP +#define _XAG_SERVER_ #include "Xagstr.h" #endif #ifdef XCSECURITY +#define _SECURITY_SERVER #include "securstr.h" #endif #ifdef PANORAMIX @@ -104,6 +108,9 @@ #ifdef XF86BIGFONT #include "xf86bigfstr.h" #endif +#ifdef RES +#include "XResproto.h" +#endif /* FIXME: this whole block of externs should be from the appropriate headers */ #ifdef BEZIER @@ -198,8 +205,13 @@ extern void XFree86DGAExtensionInit(INITARGS); #endif #ifdef GLXEXT +#ifndef __DARWIN__ extern void GlxExtensionInit(INITARGS); extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); +#else +extern void DarwinGlxExtensionInit(INITARGS); +extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *); +#endif #endif #ifdef XF86DRI extern void XFree86DRIExtensionInit(INITARGS); @@ -222,6 +234,9 @@ #ifdef RANDR extern void RRExtensionInit(INITARGS); #endif +#ifdef RES +extern void ResExtensionInit(INITARGS); +#endif #ifndef XFree86LOADER @@ -340,9 +355,13 @@ #endif #ifdef GLXEXT #ifndef XPRINT /* we don't want Glx in the Xprint server */ +#ifndef __DARWIN__ GlxExtensionInit(); +#else + DarwinGlxExtensionInit(); #endif #endif +#endif #ifdef DPSEXT #ifndef XPRINT DPSExtensionInit(); @@ -354,6 +373,9 @@ #ifdef RANDR RRExtensionInit(); #endif +#ifdef RES + ResExtensionInit(); +#endif } void @@ -362,7 +384,11 @@ miResetInitVisuals(); #ifdef GLXEXT #ifndef XPRINT +#ifndef __DARWIN__ GlxWrapInitVisuals(&miInitVisualsProc); +#else + DarwinGlxWrapInitVisuals(&miInitVisualsProc); +#endif #endif #endif } @@ -421,6 +447,7 @@ { NULL, "FontCache", NULL, NULL }, { NULL, "RENDER", NULL, NULL }, { NULL, "RANDR", NULL, NULL }, + { NULL, "X-Resource", NULL, NULL }, { NULL, NULL, NULL, NULL } }; #endif Index: xc/programs/Xserver/mi/mioverlay.c diff -u xc/programs/Xserver/mi/mioverlay.c:3.12 xc/programs/Xserver/mi/mioverlay.c:3.14 --- xc/programs/Xserver/mi/mioverlay.c:3.12 Sat Nov 10 16:12:31 2001 +++ xc/programs/Xserver/mi/mioverlay.c Thu Oct 17 20:07:13 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mioverlay.c,v 3.12 2001/11/10 21:12:31 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mioverlay.c,v 3.14 2002/10/18 00:07:13 mvojkovi Exp $ */ #include "X.h" #include "scrnintstr.h" @@ -535,6 +535,8 @@ tChild->pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; + if (pScreen->ClipNotify) + (* pScreen->ClipNotify) (tChild->pWin, dx, dy); } if (tChild->valdata) { REGION_INIT(pScreen, &tChild->valdata->borderExposed, @@ -653,6 +655,9 @@ } pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; + + if (pScreen->ClipNotify) + (* pScreen->ClipNotify) (pParent, dx, dy); } @@ -1761,6 +1766,7 @@ RegionRec reg; RegionPtr pBSReg = NullRegion; ScreenPtr pScreen = pWin->drawable.pScreen; + miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); RegionPtr clipList; BoxPtr extents; int x1, y1, x2, y2; @@ -1776,7 +1782,8 @@ else y2 = y1 + (int) pWin->drawable.height - (int) y; - clipList = (pTree) ? &pTree->clipList : &pWin->clipList; + clipList = ((*pScreenPriv->InOverlay)(pWin)) ? &pWin->clipList : + &pTree->clipList; extents = REGION_EXTENTS(pScreen, clipList); Index: xc/programs/Xserver/mi/misprite.c diff -u xc/programs/Xserver/mi/misprite.c:3.10 xc/programs/Xserver/mi/misprite.c:3.11 --- xc/programs/Xserver/mi/misprite.c:3.10 Fri Dec 14 15:00:26 2001 +++ xc/programs/Xserver/mi/misprite.c Sun Dec 8 23:10:58 2002 @@ -30,7 +30,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.10 2001/12/14 20:00:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.11 2002/12/09 04:10:58 tsi Exp $ */ # include "X.h" # include "Xproto.h" @@ -432,6 +432,7 @@ static Bool miSpriteCloseScreen (i, pScreen) + int i; ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; @@ -1137,6 +1138,7 @@ int y; int w; int h; + int leftPad; int format; char *pBits; { @@ -2135,6 +2137,8 @@ miSpriteSetCursor (pScreen, pCursor, x, y) ScreenPtr pScreen; CursorPtr pCursor; + int x; + int y; { miSpriteScreenPtr pScreenPriv; Index: xc/programs/Xserver/miext/layer/Imakefile diff -u xc/programs/Xserver/miext/layer/Imakefile:1.1 xc/programs/Xserver/miext/layer/Imakefile:1.3 --- xc/programs/Xserver/miext/layer/Imakefile:1.1 Tue May 29 00:54:13 2001 +++ xc/programs/Xserver/miext/layer/Imakefile Fri Nov 8 17:19:42 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/miext/layer/Imakefile,v 1.1 2001/05/29 04:54:13 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/miext/layer/Imakefile,v 1.3 2002/11/08 22:19:42 keithp Exp $ XCOMM XCOMM @@ -7,20 +7,22 @@ #ifdef XFree86Version #if DoLoadableServer -XFMODSRC = shmodule.c -XFMODOBJ = shmodule.o +XFMODSRC = laymodule.c +XFMODOBJ = laymodule.o #endif #endif SRCS = layergc.c \ layerinit.c \ layerpict.c \ - layerwin.c + layerwin.c \ + $(XFMODSRC) OBJS = layergc.o \ layerinit.o \ layerpict.o \ - layerwin.o + layerwin.o \ + $(XFMODOBJ) INCLUDES = -I. -I../shadow -I../../mi -I../../fb -I../../include -I$(XINCLUDESRC) \ -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ @@ -36,9 +38,7 @@ InstallLibraryModule(layer,$(MODULEDIR),.) -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKLibraryModule(layer,$(DRIVERSDKMODULEDIR),.) InstallDriverSDKNonExecFile(layer.h,$(DRIVERSDKINCLUDEDIR)) Index: xc/programs/Xserver/miext/layer/layer.h diff -u xc/programs/Xserver/miext/layer/layer.h:1.4 xc/programs/Xserver/miext/layer/layer.h:1.5 --- xc/programs/Xserver/miext/layer/layer.h:1.4 Tue Jul 31 20:44:58 2001 +++ xc/programs/Xserver/miext/layer/layer.h Thu Oct 3 18:50:21 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/layer/layer.h,v 1.4 2001/08/01 00:44:58 tsi Exp $ + * $XFree86: xc/programs/Xserver/miext/layer/layer.h,v 1.5 2002/10/03 22:50:21 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -56,7 +56,7 @@ RegionRec region; /* valid set of pPixmap for drawing */ ShadowUpdateProc update; /* for shadow layers, update/window/closure values */ ShadowWindowProc window; - int rotate; + int randr; void *closure; } LayerRec; @@ -96,7 +96,7 @@ PixmapPtr pPixmap, ShadowUpdateProc update, ShadowWindowProc window, - int rotate, + int randr, void *closure); /* Index: xc/programs/Xserver/miext/layer/layerinit.c diff -u xc/programs/Xserver/miext/layer/layerinit.c:1.4 xc/programs/Xserver/miext/layer/layerinit.c:1.6 --- xc/programs/Xserver/miext/layer/layerinit.c:1.4 Sat Oct 27 23:34:16 2001 +++ xc/programs/Xserver/miext/layer/layerinit.c Fri Nov 8 17:19:42 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/layer/layerinit.c,v 1.4 2001/10/28 03:34:16 tsi Exp $ + * $XFree86: xc/programs/Xserver/miext/layer/layerinit.c,v 1.6 2002/11/08 22:19:42 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -144,6 +144,9 @@ pLayKind->PaintWindowBorder = pScreen->PaintWindowBorder; pLayKind->CopyWindow = pScreen->CopyWindow; + pLayKind->CreatePixmap = pScreen->CreatePixmap; + pLayKind->DestroyPixmap = pScreen->DestroyPixmap; + pLayKind->CreateGC = pScreen->CreateGC; #ifdef RENDER @@ -169,6 +172,9 @@ pScreen->PaintWindowBorder = pLayKinds->PaintWindowBorder; pScreen->CopyWindow = pLayKinds->CopyWindow; + pScreen->CreatePixmap = pLayKinds->CreatePixmap; + pScreen->DestroyPixmap = pLayKinds->DestroyPixmap; + pScreen->CreateGC = pLayKinds->CreateGC; #ifdef RENDER @@ -206,6 +212,9 @@ pScreen->PaintWindowBorder = layerPaintWindowBorder; pScreen->CopyWindow = layerCopyWindow; + pScreen->CreatePixmap = layerCreatePixmap; + pScreen->DestroyPixmap = layerDestroyPixmap; + pScreen->CreateGC = layerCreateGC; #ifdef RENDER @@ -230,7 +239,7 @@ PixmapPtr pPixmap, ShadowUpdateProc update, ShadowWindowProc window, - int rotate, + int randr, void *closure) { layerScrPriv(pScreen); @@ -254,7 +263,7 @@ pLay->pPixmap = pPixmap; pLay->update = update; pLay->window = window; - pLay->rotate = rotate; + pLay->randr = randr; pLay->closure = closure; if (pPixmap == LAYER_SCREEN_PIXMAP) pLay->freePixmap = FALSE; Index: xc/programs/Xserver/miext/layer/layerstr.h diff -u xc/programs/Xserver/miext/layer/layerstr.h:1.2 xc/programs/Xserver/miext/layer/layerstr.h:1.3 --- xc/programs/Xserver/miext/layer/layerstr.h:1.2 Mon Jun 4 05:45:41 2001 +++ xc/programs/Xserver/miext/layer/layerstr.h Fri Nov 8 17:19:42 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/layer/layerstr.h,v 1.2 2001/06/04 09:45:41 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/layer/layerstr.h,v 1.3 2002/11/08 22:19:42 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -68,6 +68,9 @@ PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; + CreatePixmapProcPtr CreatePixmap; + DestroyPixmapProcPtr DestroyPixmap; + CreateGCProcPtr CreateGC; CompositeProcPtr Composite; @@ -181,6 +184,12 @@ void layerCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); + +PixmapPtr +layerCreatePixmap (ScreenPtr pScreen, int width, int height, int depth); + +Bool +layerDestroyPixmap (PixmapPtr pPixmap); Bool layerCreateGC (GCPtr pGC); Index: xc/programs/Xserver/miext/layer/layerwin.c diff -u xc/programs/Xserver/miext/layer/layerwin.c:1.5 xc/programs/Xserver/miext/layer/layerwin.c:1.7 --- xc/programs/Xserver/miext/layer/layerwin.c:1.5 Sat Oct 27 23:34:16 2001 +++ xc/programs/Xserver/miext/layer/layerwin.c Fri Nov 8 17:19:42 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/layer/layerwin.c,v 1.5 2001/10/28 03:34:16 tsi Exp $ + * $XFree86: xc/programs/Xserver/miext/layer/layerwin.c,v 1.7 2002/11/08 22:19:42 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -55,15 +55,20 @@ Bool LayerCreatePixmap (ScreenPtr pScreen, LayerPtr pLayer) { + LayerKindPtr pKind = pLayer->pKind; + + LayerUnwrap (pScreen, pKind, CreatePixmap); /* XXX create full-screen sized layers all around */ pLayer->pPixmap = (*pScreen->CreatePixmap) (pScreen, pScreen->width, pScreen->height, pLayer->depth); + LayerWrap (pScreen, pKind, CreatePixmap, layerCreatePixmap); if (!pLayer->pPixmap) return FALSE; if (pLayer->pKind->kind == LAYER_SHADOW) { if (!shadowAdd (pScreen, pLayer->pPixmap, pLayer->update, - pLayer->window, pLayer->rotate, pLayer->closure)) + pLayer->window, pLayer->randr, + pLayer->closure)) return FALSE; } return TRUE; @@ -81,9 +86,15 @@ if (pLayer->pKind->kind == LAYER_SHADOW) shadowRemove (pScreen, pLayer->pPixmap); if (pLayer->freePixmap) + { + LayerKindPtr pKind = pLayer->pKind; + + LayerUnwrap (pScreen, pKind, DestroyPixmap); (*pScreen->DestroyPixmap) (pLayer->pPixmap); + LayerWrap (pScreen, pKind, DestroyPixmap, layerDestroyPixmap); + } + pLayer->pPixmap = 0; } - pLayer->pPixmap = 0; } /* @@ -433,5 +444,40 @@ dy = ptOldOrg.y - pWin->drawable.y; } LayerWindowDone (pWin, &loop); +} + +PixmapPtr +layerCreatePixmap (ScreenPtr pScreen, int width, int height, int depth) +{ + /* XXX assume the first layer can handle all pixmaps */ + layerScrPriv (pScreen); + LayerKindPtr pKind; + PixmapPtr pPixmap; + + pKind = &pLayScr->kinds[0]; + if (pLayScr->pLayers) + pKind = pLayScr->pLayers->pKind; + LayerUnwrap (pScreen, pKind, CreatePixmap); + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth); + LayerWrap (pScreen,pKind,CreatePixmap,layerCreatePixmap); + return pPixmap; +} + +Bool +layerDestroyPixmap (PixmapPtr pPixmap) +{ + /* XXX assume the first layer can handle all pixmaps */ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + layerScrPriv (pScreen); + LayerKindPtr pKind; + Bool ret; + + pKind = &pLayScr->kinds[0]; + if (pLayScr->pLayers) + pKind = pLayScr->pLayers->pKind; + LayerUnwrap (pScreen, pKind, DestroyPixmap); + ret = (*pScreen->DestroyPixmap) (pPixmap); + LayerWrap (pScreen,pKind,DestroyPixmap,layerDestroyPixmap); + return ret; } Index: xc/programs/Xserver/miext/layer/laymodule.c diff -u /dev/null xc/programs/Xserver/miext/layer/laymodule.c:1.1 --- /dev/null Thu Feb 27 12:33:59 2003 +++ xc/programs/Xserver/miext/layer/laymodule.c Fri Nov 8 17:19:55 2002 @@ -0,0 +1,56 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/laymodule.c,v 1.1 2002/11/08 22:19:55 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef XFree86LOADER + +#include "xf86Module.h" +#include "X.h" +#include "scrnintstr.h" +#include "windowstr.h" +#include "font.h" +#include "dixfontstr.h" +#include "fontstruct.h" +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "layer.h" + +static XF86ModuleVersionInfo VersRec = +{ + "layer", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_ANSIC, /* Only need the ansic layer */ + ABI_ANSIC_VERSION, + MOD_CLASS_NONE, + {0,0,0,0} /* signature, to be patched into the file by a tool */ +}; + +XF86ModuleData layerModuleData = { &VersRec, NULL, NULL }; + +#endif Index: xc/programs/Xserver/miext/shadow/Imakefile diff -u xc/programs/Xserver/miext/shadow/Imakefile:1.6 xc/programs/Xserver/miext/shadow/Imakefile:1.7 --- xc/programs/Xserver/miext/shadow/Imakefile:1.6 Fri Jul 20 15:25:02 2001 +++ xc/programs/Xserver/miext/shadow/Imakefile Fri May 31 14:46:05 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/miext/shadow/Imakefile,v 1.6 2001/07/20 19:25:02 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/miext/shadow/Imakefile,v 1.7 2002/05/31 18:46:05 dawes Exp $ XCOMM XCOMM @@ -60,9 +60,7 @@ InstallLibraryModule(shadow,$(MODULEDIR),.) -#ifndef OS2Architecture DependTarget() -#endif InstallDriverSDKLibraryModule(shadow,$(DRIVERSDKMODULEDIR),.) InstallDriverSDKNonExecFile(shadow.h,$(DRIVERSDKINCLUDEDIR)) Index: xc/programs/Xserver/miext/shadow/shadow.c diff -u xc/programs/Xserver/miext/shadow/shadow.c:1.10 xc/programs/Xserver/miext/shadow/shadow.c:1.13 --- xc/programs/Xserver/miext/shadow/shadow.c:1.10 Sat Oct 27 23:34:16 2001 +++ xc/programs/Xserver/miext/shadow/shadow.c Mon Dec 2 15:37:23 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shadow.c,v 1.10 2001/10/28 03:34:16 tsi Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shadow.c,v 1.13 2002/12/02 20:37:23 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -44,15 +44,17 @@ int shadowGCPrivateIndex; int shadowGeneration; -#define shadowGetGCPriv(pGC) ((shadowGCPrivPtr) (pGC)->devPrivates[shadowGCPrivateIndex].ptr) -#define shadowGCPriv(pGC) shadowGCPrivPtr pGCPriv = shadowGetGCPriv(pGC) +#define shadowGetGCPriv(pGC) \ + ((shadowGCPrivPtr) (pGC)->devPrivates[shadowGCPrivateIndex].ptr) +#define shadowGCPriv(pGC) \ + shadowGCPrivPtr pGCPriv = shadowGetGCPriv(pGC) -#define wrap(priv,real,mem,func) {\ +#define wrap(priv, real, mem, func) {\ priv->mem = real->mem; \ real->mem = func; \ } -#define unwrap(priv,real,mem) {\ +#define unwrap(priv, real, mem) {\ real->mem = priv->mem; \ } @@ -67,7 +69,7 @@ if (REGION_NOTEMPTY (pScreen, &pBuf->damage)) { REGION_INTERSECT (pScreen, &pBuf->damage, &pBuf->damage, - &WindowTable[pScreen->myNum]->borderSize); + &WindowTable[pScreen->myNum]->borderClip); (*pBuf->update) (pScreen, pBuf); REGION_EMPTY (pScreen, &pBuf->damage); } @@ -96,21 +98,24 @@ if (!pBuf) abort (); - - REGION_UNION (pWindow->drawable.pScreen, &pBuf->damage, &pBuf->damage, pRegion); + + REGION_INTERSECT(pWindow->drawable.pScreen, pRegion, pRegion, + &pWindow->borderClip); + REGION_UNION(pWindow->drawable.pScreen, &pBuf->damage, &pBuf->damage, + pRegion); #ifdef ALWAYS_DISPLAY shadowRedisplay (pWindow->drawable.pScreen); #endif } -static void +static void shadowDamageBox (WindowPtr pWindow, BoxPtr pBox) { RegionRec region; REGION_INIT (pWindow->drawable.pScreen, ®ion, pBox, 1); shadowDamageRegion (pWindow, ®ion); -} +} static void shadowDamageRect (WindowPtr pWindow, int x, int y, int w, int h) @@ -123,7 +128,7 @@ box.x2 = x + w; box.y1 = y; box.y2 = y + h; - shadowDamageBox (pWindow, &box); + shadowDamageBox (pWindow, &box); } static void shadowValidateGC(GCPtr, unsigned long, DrawablePtr); @@ -164,7 +169,7 @@ shadowWrapGC (GCPtr pGC) { shadowGCPriv(pGC); - + pGCPriv->ops = NULL; pGCPriv->funcs = pGC->funcs; pGC->funcs = &shadowGCFuncs; @@ -174,19 +179,19 @@ shadowUnwrapGC (GCPtr pGC) { shadowGCPriv(pGC); - + pGC->funcs = pGCPriv->funcs; if (pGCPriv->ops) pGC->ops = pGCPriv->ops; } -#define SHADOW_GC_OP_PROLOGUE(pGC,pDraw) \ +#define SHADOW_GC_OP_PROLOGUE(pGC, pDraw) \ shadowGCPriv(pGC); \ GCFuncs *oldFuncs = pGC->funcs; \ unwrap(pGCPriv, pGC, funcs); \ unwrap(pGCPriv, pGC, ops); \ - -#define SHADOW_GC_OP_EPILOGUE(pGC,pDraw) \ + +#define SHADOW_GC_OP_EPILOGUE(pGC, pDraw) \ wrap(pGCPriv, pGC, funcs, oldFuncs); \ wrap(pGCPriv, pGC, ops, &shadowGCOps) @@ -203,13 +208,13 @@ shadowValidateGC( GCPtr pGC, unsigned long changes, - DrawablePtr pDraw + DrawablePtr pDraw ){ SHADOW_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ValidateGC)(pGC, changes, pDraw); if(pDraw->type == DRAWABLE_WINDOW) pGCPriv->ops = pGC->ops; /* just so it's not NULL */ - else + else pGCPriv->ops = NULL; SHADOW_GC_FUNC_EPILOGUE (pGC); } @@ -234,7 +239,7 @@ static void shadowCopyGC ( - GCPtr pGCSrc, + GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst ){ @@ -248,7 +253,7 @@ GCPtr pGC, int type, pointer pvalue, - int nrects + int nrects ){ SHADOW_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); @@ -315,7 +320,7 @@ ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); shadowScrPriv(pScreen); - + unwrap (pScrPriv, ps, Composite); (*ps->Composite) (op, pSrc, @@ -389,12 +394,12 @@ shadowFillSpans( DrawablePtr pDraw, GC *pGC, - int nInit, - DDXPointPtr pptInit, - int *pwidthInit, - int fSorted + int nInit, + DDXPointPtr pptInit, + int *pwidthInit, + int fSorted ){ - SHADOW_GC_OP_PROLOGUE(pGC, pDraw); + SHADOW_GC_OP_PROLOGUE(pGC, pDraw); if(IS_VISIBLE(pDraw) && nInit) { DDXPointPtr ppt = pptInit; @@ -410,7 +415,7 @@ ppt++; pwidthInit++; if(box.x1 > ppt->x) box.x1 = ppt->x; - if(box.x2 < (ppt->x + *pwidth)) + if(box.x2 < (ppt->x + *pwidth)) box.x2 = ppt->x + *pwidth; if(box.y1 > ppt->y) box.y1 = ppt->y; else if(box.y2 < ppt->y) box.y2 = ppt->y; @@ -437,7 +442,7 @@ DDXPointPtr pptInit, int *pwidthInit, int nspans, - int fSorted + int fSorted ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); @@ -455,7 +460,7 @@ ppt++; pwidth++; if(box.x1 > ppt->x) box.x1 = ppt->x; - if(box.x2 < (ppt->x + *pwidth)) + if(box.x2 < (ppt->x + *pwidth)) box.x2 = ppt->x + *pwidth; if(box.y1 > ppt->y) box.y1 = ppt->y; else if(box.y2 < ppt->y) box.y2 = ppt->y; @@ -463,14 +468,14 @@ box.y2++; - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, + (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, pwidthInit, nspans, fSorted); TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); if(BOX_NOT_EMPTY(box)) shadowDamageBox ((WindowPtr) pDraw, &box); } else - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, + (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, pwidthInit, nspans, fSorted); SHADOW_GC_OP_EPILOGUE(pGC, pDraw); @@ -480,14 +485,14 @@ shadowPutImage( DrawablePtr pDraw, GCPtr pGC, - int depth, + int depth, int x, int y, int w, int h, int leftPad, int format, - char *pImage + char *pImage ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, + (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage); SHADOW_GC_OP_EPILOGUE(pGC, pDraw); @@ -512,7 +517,7 @@ GC *pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty + int dstx, int dsty ){ RegionPtr ret; SHADOW_GC_OP_PROLOGUE(pGC, pDst); @@ -544,7 +549,7 @@ int srcx, int srcy, int width, int height, int dstx, int dsty, - unsigned long bitPlane + unsigned long bitPlane ){ RegionPtr ret; SHADOW_GC_OP_PROLOGUE(pGC, pDst); @@ -574,7 +579,7 @@ GCPtr pGC, int mode, int npt, - xPoint *pptInit + xPoint *pptInit ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); @@ -609,9 +614,9 @@ shadowPolylines( DrawablePtr pDraw, GCPtr pGC, - int mode, - int npt, - DDXPointPtr pptInit + int mode, + int npt, + DDXPointPtr pptInit ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); @@ -670,12 +675,12 @@ } } -static void +static void shadowPolySegment( DrawablePtr pDraw, GCPtr pGC, int nseg, - xSegment *pSeg + xSegment *pSeg ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); @@ -685,7 +690,7 @@ BoxRec box; int extra = pGC->lineWidth; - if(pGC->capStyle != CapProjecting) + if(pGC->capStyle != CapProjecting) extra >>= 1; if(pSeg->x2 > pSeg->x1) { @@ -743,13 +748,13 @@ DrawablePtr pDraw, GCPtr pGC, int nRects, - xRectangle *pRects + xRectangle *pRects ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->PolyRectangle)(pDraw, pGC, nRects, pRects); SHADOW_GC_OP_EPILOGUE(pGC, pDraw); - if(IS_VISIBLE(pDraw) && nRects) + if(IS_VISIBLE(pDraw) && nRects) { BoxRec box; int offset1, offset2, offset3; @@ -759,12 +764,12 @@ offset1 = offset2 >> 1; offset3 = offset2 - offset1; - while(nRects--) + while(nRects--) { box.x1 = pRects->x - offset1; box.y1 = pRects->y - offset1; box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; + box.y2 = box.y1 + offset2; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); if(BOX_NOT_EMPTY(box)) shadowDamageBox ((WindowPtr) pDraw, &box); @@ -772,7 +777,7 @@ box.x1 = pRects->x - offset1; box.y1 = pRects->y + offset3; box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; + box.y2 = box.y1 + pRects->height - offset2; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); if(BOX_NOT_EMPTY(box)) shadowDamageBox ((WindowPtr) pDraw, &box); @@ -780,7 +785,7 @@ box.x1 = pRects->x + pRects->width - offset1; box.y1 = pRects->y + offset3; box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; + box.y2 = box.y1 + pRects->height - offset2; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); if(BOX_NOT_EMPTY(box)) shadowDamageBox ((WindowPtr) pDraw, &box); @@ -788,7 +793,7 @@ box.x1 = pRects->x - offset1; box.y1 = pRects->y + pRects->height - offset1; box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; + box.y2 = box.y1 + offset2; TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); if(BOX_NOT_EMPTY(box)) shadowDamageBox ((WindowPtr) pDraw, &box); @@ -803,7 +808,7 @@ DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc *parcs + xArc *parcs ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); @@ -853,7 +858,7 @@ int shape, int mode, int count, - DDXPointPtr pptInit + DDXPointPtr pptInit ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); @@ -902,12 +907,12 @@ } -static void +static void shadowPolyFillRect( DrawablePtr pDraw, GCPtr pGC, - int nRectsInit, - xRectangle *pRectsInit + int nRectsInit, + xRectangle *pRectsInit ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); @@ -951,7 +956,7 @@ DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc *parcs + xArc *parcs ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); @@ -988,10 +993,10 @@ shadowPolyText8( DrawablePtr pDraw, GCPtr pGC, - int x, + int x, int y, int count, - char *chars + char *chars ){ int width; @@ -1031,7 +1036,7 @@ int x, int y, int count, - unsigned short *chars + unsigned short *chars ){ int width; @@ -1068,10 +1073,10 @@ shadowImageText8( DrawablePtr pDraw, GCPtr pGC, - int x, + int x, int y, int count, - char *chars + char *chars ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); @@ -1086,13 +1091,13 @@ Min = count * FONTMINBOUNDS(pGC->font, characterWidth); if(Min > 0) Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); + Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); if(Max < 0) Max = 0; /* ugh */ box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + Max + + box.x2 = pDraw->x + x + Max + FONTMAXBOUNDS(pGC->font, rightSideBearing); box.y1 = pDraw->y + y - top; @@ -1110,7 +1115,7 @@ int x, int y, int count, - unsigned short *chars + unsigned short *chars ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); @@ -1125,13 +1130,13 @@ Min = count * FONTMINBOUNDS(pGC->font, characterWidth); if(Min > 0) Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); + Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); if(Max < 0) Max = 0; /* ugh */ box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + Max + + box.x2 = pDraw->x + x + Max + FONTMAXBOUNDS(pGC->font, rightSideBearing); box.y1 = pDraw->y + y - top; @@ -1151,10 +1156,10 @@ int x, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase + pointer pglyphBase ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyph, + (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyph, ppci, pglyphBase); SHADOW_GC_OP_EPILOGUE(pGC, pDraw); @@ -1167,21 +1172,21 @@ box.x1 = ppci[0]->metrics.leftSideBearing; if(box.x1 > 0) box.x1 = 0; - box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing - + box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing - ppci[nglyph - 1]->metrics.characterWidth; if(box.x2 < 0) box.x2 = 0; box.x2 += pDraw->x + x; box.x1 += pDraw->x + x; - + while(nglyph--) { width += (*ppci)->metrics.characterWidth; ppci++; } - if(width > 0) + if(width > 0) box.x2 += width; - else + else box.x1 += width; box.y1 = pDraw->y + y - top; @@ -1200,10 +1205,10 @@ int x, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase + pointer pglyphBase ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyph, + (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyph, ppci, pglyphBase); SHADOW_GC_OP_EPILOGUE(pGC, pDraw); @@ -1217,11 +1222,11 @@ if(nglyph > 1) { int width = 0; - while(--nglyph) { + while(--nglyph) { width += (*ppci)->metrics.characterWidth; ppci++; } - + if(width > 0) box.x2 += width; else box.x1 += width; } @@ -1240,7 +1245,7 @@ GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg + int dx, int dy, int xOrg, int yOrg ){ SHADOW_GC_OP_PROLOGUE(pGC, pDraw); (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); @@ -1265,11 +1270,11 @@ shadowPaintWindow( WindowPtr pWindow, RegionPtr prgn, - int what + int what ){ ScreenPtr pScreen = pWindow->drawable.pScreen; shadowScrPriv(pScreen); - + if(what == PW_BACKGROUND) { unwrap (pScrPriv, pScreen, PaintWindowBackground); (*pScreen->PaintWindowBackground) (pWindow, prgn, what); @@ -1283,11 +1288,11 @@ } -static void +static void shadowCopyWindow( WindowPtr pWindow, DDXPointRec ptOldOrg, - RegionPtr prgn + RegionPtr prgn ){ ScreenPtr pScreen = pWindow->drawable.pScreen; shadowScrPriv(pScreen); @@ -1299,15 +1304,15 @@ } GCOps shadowGCOps = { - shadowFillSpans, shadowSetSpans, - shadowPutImage, shadowCopyArea, - shadowCopyPlane, shadowPolyPoint, - shadowPolylines, shadowPolySegment, - shadowPolyRectangle, shadowPolyArc, - shadowFillPolygon, shadowPolyFillRect, - shadowPolyFillArc, shadowPolyText8, - shadowPolyText16, shadowImageText8, - shadowImageText16, shadowImageGlyphBlt, + shadowFillSpans, shadowSetSpans, + shadowPutImage, shadowCopyArea, + shadowCopyPlane, shadowPolyPoint, + shadowPolylines, shadowPolySegment, + shadowPolyRectangle, shadowPolyArc, + shadowFillPolygon, shadowPolyFillRect, + shadowPolyFillArc, shadowPolyText8, + shadowPolyText16, shadowImageText8, + shadowImageText16, shadowImageGlyphBlt, shadowPolyGlyphBlt, shadowPushPixels, #ifdef NEED_LINEHELPER NULL, @@ -1335,16 +1340,39 @@ (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); wrap (pScrPriv, pScreen, GetImage, shadowGetImage); } + +static void +shadowRestoreAreas (PixmapPtr pPixmap, + RegionPtr prgn, + int xorg, + int yorg, + WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + shadowScrPriv(pScreen); + + unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); + (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn, + xorg, yorg, pWin); + wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, + shadowRestoreAreas); + shadowDamageRegion (pWin, prgn); +} - static Bool shadowCloseScreen (int i, ScreenPtr pScreen) { shadowScrPriv(pScreen); + unwrap (pScrPriv, pScreen, CreateGC); + unwrap (pScrPriv, pScreen, PaintWindowBackground); + unwrap (pScrPriv, pScreen, PaintWindowBorder); + unwrap (pScrPriv, pScreen, CopyWindow); unwrap (pScrPriv, pScreen, CloseScreen); + unwrap (pScrPriv, pScreen, GetImage); + unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); xfree (pScrPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (i, pScreen); } Bool @@ -1354,7 +1382,7 @@ #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif - + if (shadowGeneration != serverGeneration) { shadowScrPrivateIndex = AllocateScreenPrivateIndex (); @@ -1375,13 +1403,15 @@ shadowWakeupHandler, (pointer) pScreen)) return FALSE; - + wrap (pScrPriv, pScreen, CreateGC, shadowCreateGC); wrap (pScrPriv, pScreen, PaintWindowBackground, shadowPaintWindow); wrap (pScrPriv, pScreen, PaintWindowBorder, shadowPaintWindow); wrap (pScrPriv, pScreen, CopyWindow, shadowCopyWindow); wrap (pScrPriv, pScreen, CloseScreen, shadowCloseScreen); wrap (pScrPriv, pScreen, GetImage, shadowGetImage); + wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, + shadowRestoreAreas); #ifdef RENDER if (ps) { wrap (pScrPriv, ps, Glyphs, shadowGlyphs); @@ -1399,7 +1429,7 @@ PixmapPtr pPixmap, ShadowUpdateProc update, ShadowWindowProc window, - int rotate, + int randr, void *closure) { shadowScrPriv(pScreen); @@ -1408,12 +1438,30 @@ pBuf = (shadowBufPtr) xalloc (sizeof (shadowBufRec)); if (!pBuf) return FALSE; + /* + * Map simple rotation values to bitmasks; fortunately, + * these are all unique + */ + switch (randr) { + case 0: + randr = SHADOW_ROTATE_0; + break; + case 90: + randr = SHADOW_ROTATE_90; + break; + case 180: + randr = SHADOW_ROTATE_180; + break; + case 270: + randr = SHADOW_ROTATE_270; + break; + } pBuf->pPixmap = pPixmap; pBuf->update = update; pBuf->window = window; REGION_INIT (pScreen, &pBuf->damage, NullBox, 0); pBuf->pNext = pScrPriv->pBuf; - pBuf->rotate = rotate; + pBuf->randr = randr; pBuf->closure = 0; pScrPriv->pBuf = pBuf; return TRUE; @@ -1469,8 +1517,8 @@ { if (!shadowSetup (pScreen)) return FALSE; - - if (!shadowAdd (pScreen, 0, update, window, 0, 0)) + + if (!shadowAdd (pScreen, 0, update, window, SHADOW_ROTATE_0, 0)) return FALSE; return TRUE; Index: xc/programs/Xserver/miext/shadow/shadow.h diff -u xc/programs/Xserver/miext/shadow/shadow.h:1.5 xc/programs/Xserver/miext/shadow/shadow.h:1.7 --- xc/programs/Xserver/miext/shadow/shadow.h:1.5 Fri Jul 20 15:25:02 2001 +++ xc/programs/Xserver/miext/shadow/shadow.h Mon Dec 2 15:37:24 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shadow.h,v 1.5 2001/07/20 19:25:02 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shadow.h,v 1.7 2002/12/02 20:37:24 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -25,14 +25,16 @@ #ifndef _SHADOW_H_ #define _SHADOW_H_ +#include "scrnintstr.h" + #ifdef RENDER #include "picturestr.h" #endif typedef struct _shadowBuf *shadowBufPtr; -typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, - shadowBufPtr pBuf); +typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, + shadowBufPtr pBuf); #define SHADOW_WINDOW_RELOCATE 1 #define SHADOW_WINDOW_READ 2 @@ -52,9 +54,20 @@ RegionRec damage; PixmapPtr pPixmap; void *closure; - int rotate; + int randr; } shadowBufRec; +/* Match defines from randr extension */ +#define SHADOW_ROTATE_0 1 +#define SHADOW_ROTATE_90 2 +#define SHADOW_ROTATE_180 4 +#define SHADOW_ROTATE_270 8 +#define SHADOW_ROTATE_ALL (SHADOW_ROTATE_0|SHADOW_ROTATE_90|\ + SHADOW_ROTATE_180|SHADOW_ROTATE_270) +#define SHADOW_REFLECT_X 16 +#define SHADOW_REFLECT_Y 32 +#define SHADOW_REFLECT_ALL (SHADOW_REFLECT_X|SHADOW_REFLECT_Y) + typedef struct _shadowScrPriv { PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; @@ -65,8 +78,9 @@ #ifdef RENDER CompositeProcPtr Composite; GlyphsProcPtr Glyphs; -#endif +#endif shadowBufPtr pBuf; + BSFuncRec BackingStoreFuncs; } shadowScrPrivRec, *shadowScrPrivPtr; extern int shadowScrPrivateIndex; @@ -76,13 +90,13 @@ Bool shadowSetup (ScreenPtr pScreen); - + Bool shadowAdd (ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update, ShadowWindowProc window, - int rotate, + int randr, void *closure); void @@ -90,7 +104,7 @@ shadowBufPtr shadowFindBuf (WindowPtr pWindow); - + Bool shadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); @@ -154,5 +168,5 @@ void shadowUnwrapGC (GCPtr pGC); - + #endif /* _SHADOW_H_ */ Index: xc/programs/Xserver/miext/shadow/shrotate.c diff -u xc/programs/Xserver/miext/shadow/shrotate.c:1.3 xc/programs/Xserver/miext/shadow/shrotate.c:1.5 --- xc/programs/Xserver/miext/shadow/shrotate.c:1.3 Sat Jul 21 00:13:26 2001 +++ xc/programs/Xserver/miext/shadow/shrotate.c Wed Oct 9 13:00:11 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shrotate.c,v 1.3 2001/07/21 04:13:26 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shrotate.c,v 1.5 2002/10/09 17:00:11 tsi Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -35,6 +35,16 @@ #include "shadow.h" #include "fb.h" +/* + * These indicate which way the source (shadow) is scanned when + * walking the screen in a particular direction + */ + +#define LEFT_TO_RIGHT 1 +#define RIGHT_TO_LEFT -1 +#define TOP_TO_BOTTOM 2 +#define BOTTOM_TO_TOP -2 + void shadowUpdateRotatePacked (ScreenPtr pScreen, shadowBufPtr pBuf) @@ -48,18 +58,23 @@ int shaBpp; int shaXoff, shaYoff; int box_x1, box_x2, box_y1, box_y2; - int sha_x1, sha_y1; - int scr_x1, scr_x2, scr_y1, scr_y2, scr_w, scr_h; + int sha_x1 = 0, sha_y1 = 0; + int scr_x1 = 0, scr_x2 = 0, scr_y1 = 0, scr_y2 = 0, scr_w, scr_h; int scr_x, scr_y; int w; int pixelsPerBits; int pixelsMask; - FbStride shaStepOverY, shaStepDownY, shaStepOverX, shaStepDownX; + FbStride shaStepOverY = 0, shaStepDownY = 0; + FbStride shaStepOverX = 0, shaStepDownX = 0; FbBits *shaLine, *sha; int shaHeight = pShadow->drawable.height; int shaWidth = pShadow->drawable.width; FbBits shaMask; int shaFirstShift, shaShift; + int o_x_dir; + int o_y_dir; + int x_dir; + int y_dir; fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); pixelsPerBits = (sizeof (FbBits) * 8) / shaBpp; @@ -68,33 +83,68 @@ /* * Compute rotation related constants to walk the shadow */ - switch (pBuf->rotate) { - case 0: + o_x_dir = LEFT_TO_RIGHT; + o_y_dir = TOP_TO_BOTTOM; + if (pBuf->randr & SHADOW_REFLECT_X) + o_x_dir = -o_x_dir; + if (pBuf->randr & SHADOW_REFLECT_Y) + o_y_dir = -o_y_dir; + switch (pBuf->randr & (SHADOW_ROTATE_ALL)) { + case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */ default: + x_dir = o_x_dir; + y_dir = o_y_dir; + break; + case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */ + x_dir = o_y_dir; + y_dir = -o_x_dir; + break; + case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */ + x_dir = -o_x_dir; + y_dir = -o_y_dir; + break; + case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */ + x_dir = -o_y_dir; + y_dir = o_x_dir; + break; + } + switch (x_dir) { + case LEFT_TO_RIGHT: shaStepOverX = shaBpp; - shaStepDownX = 0; shaStepOverY = 0; - shaStepDownY = shaStride; break; - case 90: + case TOP_TO_BOTTOM: shaStepOverX = 0; - shaStepDownX = -shaBpp; shaStepOverY = shaStride; - shaStepDownY = 0; break; - case 180: + case RIGHT_TO_LEFT: shaStepOverX = -shaBpp; - shaStepDownX = 0; shaStepOverY = 0; - shaStepDownY = -shaStride; break; - case 270: + case BOTTOM_TO_TOP: shaStepOverX = 0; - shaStepDownX = shaBpp; shaStepOverY = -shaStride; + break; + } + switch (y_dir) { + case TOP_TO_BOTTOM: + shaStepDownX = 0; + shaStepDownY = shaStride; + break; + case RIGHT_TO_LEFT: + shaStepDownX = -shaBpp; + shaStepDownY = 0; + break; + case BOTTOM_TO_TOP: + shaStepDownX = 0; + shaStepDownY = -shaStride; + break; + case LEFT_TO_RIGHT: + shaStepDownX = shaBpp; shaStepDownY = 0; break; } + while (nbox--) { box_x1 = pbox->x1; @@ -106,43 +156,56 @@ /* * Compute screen and shadow locations for this box */ - switch (pBuf->rotate) { - case 0: - default: + switch (x_dir) { + case LEFT_TO_RIGHT: scr_x1 = box_x1 & pixelsMask; scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; - scr_y1 = box_y1; - scr_y2 = box_y2; - sha_x1 = box_x1; - sha_y1 = box_y1; + sha_x1 = scr_x1; break; - case 90: + case TOP_TO_BOTTOM: scr_x1 = box_y1 & pixelsMask; scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; - scr_y1 = (shaWidth - box_x2); - scr_y2 = (shaWidth - box_x1); - sha_x1 = box_x2 - 1; sha_y1 = scr_x1; break; - case 180: + case RIGHT_TO_LEFT: scr_x1 = (shaWidth - box_x2) & pixelsMask; scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; - scr_y1 = shaHeight - box_y2; - scr_y2 = shaHeight - box_y1; sha_x1 = (shaWidth - scr_x1 - 1); - sha_y1 = box_y2 - 1; break; - case 270: + case BOTTOM_TO_TOP: scr_x1 = (shaHeight - box_y2) & pixelsMask; scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; + + sha_y1 = (shaHeight - scr_x1 - 1); + break; + } + switch (y_dir) { + case TOP_TO_BOTTOM: + scr_y1 = box_y1; + scr_y2 = box_y2; + + sha_y1 = scr_y1; + break; + case RIGHT_TO_LEFT: + scr_y1 = (shaWidth - box_x2); + scr_y2 = (shaWidth - box_x1); + + sha_x1 = box_x2 - 1; + break; + case BOTTOM_TO_TOP: + scr_y1 = shaHeight - box_y2; + scr_y2 = shaHeight - box_y1; + + sha_y1 = box_y2 - 1; + break; + case LEFT_TO_RIGHT: scr_y1 = box_x1; scr_y2 = box_x2; sha_x1 = box_x1; - sha_y1 = (shaHeight - scr_x1 - 1); break; } scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT; Index: xc/programs/Xserver/os/Imakefile diff -u xc/programs/Xserver/os/Imakefile:3.34 xc/programs/Xserver/os/Imakefile:3.38 --- xc/programs/Xserver/os/Imakefile:3.34 Sat Oct 27 23:34:16 2001 +++ xc/programs/Xserver/os/Imakefile Thu Nov 14 16:01:21 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.34 2001/10/28 03:34:16 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.38 2002/11/14 21:01:21 tsi Exp $ #include <Server.tmpl> @@ -57,6 +57,10 @@ SOCK_DEFINES = -DBSD44SOCKETS #endif +#if HasGetIfAddrs + IFADDRS_DEFINES = -DHAS_GETIFADDRS +#endif + #if BuildLBX LBX_SRCS = lbxio.c LBX_OBJS = lbxio.o @@ -65,10 +69,7 @@ LBX_OBJS = #endif -#if DDXOsColor -COLOR_SRCS= -COLOR_OBJS= -#else +#if !defined(DDXOsColor) COLOR_SRCS=oscolor.c COLOR_OBJS=oscolor.o #endif @@ -78,6 +79,10 @@ MALLOC_OBJS=xalloc.o #endif +#if HasGetpeereid +GETPEEREID_DEFINES = -DHAS_GETPEEREID +#endif + BOOTSTRAPCFLAGS = SRCS = WaitFor.c access.c connection.c io.c $(COLOR_SRCS) \ osinit.c utils.c auth.c mitauth.c secauth.c $(XDMAUTHSRCS) \ @@ -111,9 +116,9 @@ #endif DEFINES = -DXSERV_t -DTRANS_SERVER $(CONNECTION_FLAGS) $(MEM_DEFINES) \ $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) \ - $(KRB5_DEFINES) $(RGB_DEFINES) + $(KRB5_DEFINES) $(RGB_DEFINES) $(GETPEEREID_DEFINES) INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(SERVERSRC)/Xext -I$(FONTINCSRC) \ + -I$(SERVERSRC)/Xext -I$(FONTINCSRC) -I$(SERVERSRC)/render \ -I$(TOP)/lib/Xau -I../lbx Krb5Includes DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) \ $(TRANS_INCLUDES) $(CONNECTION_FLAGS) DependDefines @@ -138,7 +143,7 @@ ar x $(PWLIB) alloca.o #endif /* NEED_ALLOCA_FROM_LIBPW */ -SpecialCObjectRule(access,$(ICONFIGFILES),$(XDMCP_DEFINES) $(SOCK_DEFINES)) +SpecialCObjectRule(access,$(ICONFIGFILES),$(XDMCP_DEFINES) $(SOCK_DEFINES) $(IFADDRS_DEFINES)) SpecialCObjectRule(auth,$(ICONFIGFILES),$(XDMCP_DEFINES)) SpecialCObjectRule(xdmauth,$(ICONFIGFILES),$(XDMCP_DEFINES)) SpecialCObjectRule(xdmcp,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) Index: xc/programs/Xserver/os/WaitFor.c diff -u xc/programs/Xserver/os/WaitFor.c:3.37 xc/programs/Xserver/os/WaitFor.c:3.38 --- xc/programs/Xserver/os/WaitFor.c:3.37 Fri Dec 14 15:00:33 2001 +++ xc/programs/Xserver/os/WaitFor.c Fri May 31 14:46:05 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.37 2001/12/14 20:00:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.38 2002/05/31 18:46:05 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -65,7 +65,7 @@ #include "X.h" #include "misc.h" -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif #include "osdep.h" Index: xc/programs/Xserver/os/access.c diff -u xc/programs/Xserver/os/access.c:3.39 xc/programs/Xserver/os/access.c:3.42 --- xc/programs/Xserver/os/access.c:3.39 Mon Jan 7 15:38:29 2002 +++ xc/programs/Xserver/os/access.c Sun Jul 7 16:11:52 2002 @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/access.c,v 3.39 2002/01/07 20:38:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/access.c,v 3.42 2002/07/07 20:11:52 herrb Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -138,6 +138,10 @@ #endif #endif +#ifdef HAS_GETIFADDRS +#include <ifaddrs.h> +#endif + #endif /* WIN32 */ #ifndef PATH_MAX @@ -175,29 +179,17 @@ (length) == (host)->len &&\ !acmp (address, (host)->addr, length)) -static int ConvertAddr( -#if NeedFunctionPrototypes - struct sockaddr */*saddr*/, - int */*len*/, - pointer */*addr*/ -#endif -); - -static int CheckAddr( -#if NeedFunctionPrototypes - int /*family*/, - pointer /*pAddr*/, - unsigned /*length*/ -#endif -); - -static Bool NewHost( -#if NeedFunctionPrototypes - int /*family*/, - pointer /*addr*/, - int /*len*/ -#endif -); +static int ConvertAddr(struct sockaddr */*saddr*/, + int */*len*/, + pointer */*addr*/); + +static int CheckAddr(int /*family*/, + pointer /*pAddr*/, + unsigned /*length*/); + +static Bool NewHost(int /*family*/, + pointer /*addr*/, + int /*len*/); typedef struct _host { short family; @@ -580,16 +572,24 @@ #endif #endif +#ifdef DEF_SELF_DEBUG +#include <arpa/inet.h> +#endif + void DefineSelf (int fd) { +#ifndef HAS_GETIFADDRS char buf[2048], *cp, *cplim; struct ifconf ifc; + register struct ifreq *ifr; +#else + struct ifaddrs * ifap, *ifr; +#endif int len; unsigned char * addr; int family; register HOST *host; - register struct ifreq *ifr; #ifdef DNETCONN struct dn_naddr *dnaddr = getnodeadd(); @@ -619,7 +619,8 @@ } } } -#endif +#endif /* DNETCONN */ +#ifndef HAS_GETIFADDRS ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; if (ifioctl (fd, SIOCGIFCONF, (pointer) &ifc) < 0) @@ -629,7 +630,7 @@ #define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf #else #define IFC_IFC_REQ ifc.ifc_req -#endif +#endif /* ISC */ cplim = (char *) IFC_IFC_REQ + ifc.ifc_len; @@ -651,7 +652,7 @@ if (family == FamilyInternet) ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", ifr->ifr_name, addr[0], addr[1], addr[2], addr[3]); -#endif +#endif /* DEF_SELF_DEBUG */ for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) @@ -709,16 +710,84 @@ else continue; } -#endif +#endif /* SIOCGIFBRDADDR */ #ifdef DEF_SELF_DEBUG ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n", ifr->ifr_name, inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr)); -#endif +#endif /* DEF_SELF_DEBUG */ XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr); } -#endif +#endif /* XDMCP */ } +#else /* HAS_GETIFADDRS */ + if (getifaddrs(&ifap) < 0) { + ErrorF("Warning: getifaddrs returns %s\n", strerror(errno)); + return; + } + for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) { +#ifdef DNETCONN + if (ifr->ifa_addr.sa_family == AF_DECnet) + continue; +#endif /* DNETCONN */ + family = ConvertAddr(ifr->ifa_addr, &len, (pointer *)&addr); + if (family == -1 || family == FamilyLocal) + continue; +#ifdef DEF_SELF_DEBUG + if (family == FamilyInternet) + ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", + ifr->ifa_name, addr[0], addr[1], addr[2], addr[3]); +#endif /* DEF_SELF_DEBUG */ + for (host = selfhosts; + host != NULL && !addrEqual(family, addr, len, host); + host = host->next) + ; + if (host != NULL) + continue; + MakeHost(host, len); + if (host != NULL) { + host->family = family; + host->len = len; + acopy(addr, host->addr, len); + host->next = selfhosts; + selfhosts = host; + } +#ifdef XDMCP + { + struct sockaddr broad_addr; + /* + * If this isn't an Internet Address, don't register it. + */ + if (family != FamilyInternet) + continue; + /* + * ignore 'localhost' entries as they're not usefule + * on the other end of the wire + */ + if (len == 4 && + addr[0] == 127 && addr[1] == 0 && + addr[2] == 0 && addr[2] == 1) + continue; + XdmcpRegisterConnection(family, (char *)addr, len); + if ((ifr->ifa_flags & IFF_BROADCAST) && + (ifr->ifa_flags & IFF_UP)) + broad_addr = *ifr->ifa_broadaddr; + else + continue; +#ifdef DEF_SELF_DEBUG + ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n", + ifr->ifa_name, + inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr)); +#endif /* DEF_SELF_DEBUG */ + XdmcpRegisterBroadcastAddress((struct sockaddr_in *) + &broad_addr); + } +#endif /* XDMCP */ + + } /* for */ + freeifaddrs(ifap); +#endif /* HAS_GETIFADDRS */ + /* * add something of FamilyLocalHost */ @@ -818,21 +887,16 @@ validhosts = host->next; FreeHost (host); } -#ifndef __EMX__ #define ETC_HOST_PREFIX "/etc/X" #define ETC_HOST_SUFFIX ".hosts" -#else -#define ETC_HOST_PREFIX "/XFree86/lib/X11/X" -#define ETC_HOST_SUFFIX ".hosts" -#endif /* __EMX__ */ fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + strlen(display) + 1; if (fnamelen > sizeof(fname)) FatalError("Display name `%s' is too long\n", display); sprintf(fname, ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display); -#ifdef __EMX__ +#ifdef __UNIXOS2__ strcpy(fname, (char*)__XOS2RedirRoot(fname)); -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ if ((fd = fopen (fname, "r")) != 0) { @@ -842,7 +906,7 @@ continue; if ((ptr = strchr(ohostname, '\n')) != 0) *ptr = 0; -#ifdef __EMX__ +#ifdef __UNIXOS2__ if ((ptr = strchr(ohostname, '\r')) != 0) *ptr = 0; #endif @@ -1007,6 +1071,55 @@ return FALSE; } +/* + * Return the uid and gid of a connected local client + * or the uid/gid for nobody those ids cannot be determinded + * + * Used by XShm to test access rights to shared memory segments + */ +int +LocalClientCred(ClientPtr client, int *pUid, int *pGid) +{ + int fd; + XtransConnInfo ci; +#ifdef HAS_GETPEEREID + uid_t uid; + gid_t gid; +#elif defined(SO_PEERCRED) + struct ucred peercred; + socklen_t so_len = sizeof(peercred); +#endif + + if (client == NULL) + return -1; + ci = ((OsCommPtr)client->osPrivate)->trans_conn; + /* We can only determine peer credentials for Unix domain sockets */ + if (!_XSERVTransIsLocal(ci)) { + return -1; + } + fd = _XSERVTransGetConnectionNumber(ci); +#ifdef HAS_GETPEEREID + if (getpeereid(fd, &uid, &gid) == -1) + return -1; + if (pUid != NULL) + *pUid = uid; + if (pGid != NULL) + *pGid = gid; + return 0; +#elif defined(SO_PEERCRED) + if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1) + return -1; + if (pUid != NULL) + *pUid = peercred.uid; + if (pGid != NULL) + *pGid = peercred.gid; + return 0; +#else + /* No system call available to get the credentials of the peer */ + return -1; +#endif +} + static Bool AuthorizedClient(ClientPtr client) { @@ -1019,11 +1132,10 @@ * called from the dispatcher */ int -AddHost ( - ClientPtr client, - int family, - unsigned length, /* of bytes in pAddr */ - pointer pAddr) +AddHost (ClientPtr client, + int family, + unsigned length, /* of bytes in pAddr */ + pointer pAddr) { int len; @@ -1065,23 +1177,12 @@ } Bool -#if NeedFunctionPrototypes -ForEachHostInFamily ( - int family, - Bool (*func)( -#if NeedNestedPrototypes - unsigned char * /* addr */, - short /* len */, - pointer /* closure */ -#endif - ), - pointer closure) -#else -ForEachHostInFamily (family, func, closure) - int family; - Bool (*func)(); - pointer closure; -#endif +ForEachHostInFamily (int family, + Bool (*func)( + unsigned char * /* addr */, + short /* len */, + pointer /* closure */), + pointer closure) { HOST *host; @@ -1094,10 +1195,9 @@ /* Add a host to the access control list. This is the internal interface * called when starting or resetting the server */ static Bool -NewHost ( - int family, - pointer addr, - int len) +NewHost (int family, + pointer addr, + int len) { register HOST *host; Index: xc/programs/Xserver/os/auth.c diff -u xc/programs/Xserver/os/auth.c:1.10 xc/programs/Xserver/os/auth.c:1.12 --- xc/programs/Xserver/os/auth.c:1.10 Fri Dec 14 15:00:33 2001 +++ xc/programs/Xserver/os/auth.c Sun Dec 8 21:56:03 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.10 2001/12/14 20:00:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.12 2002/12/09 02:56:03 dawes Exp $ */ /* * authorization hooks for the server @@ -135,17 +135,17 @@ Xauth *auth; int i; int count = 0; -#if !defined(WIN32) && !defined(__EMX__) +#if !defined(WIN32) && !defined(__UNIXOS2__) char *buf; #endif ShouldLoadAuth = FALSE; if (!authorization_file) return 0; -#if !defined(WIN32) && !defined(__EMX__) +#if !defined(WIN32) && !defined(__UNIXOS2__) buf = xalloc (strlen(authorization_file) + 5); if (!buf) - return 0; + return -1; sprintf (buf, "cat %s", authorization_file); f = Popen (buf, "r"); xfree (buf); @@ -153,7 +153,7 @@ f = fopen (authorization_file, "r"); #endif if (!f) - return 0; + return -1; while ((auth = XauReadAuth (f)) != 0) { for (i = 0; i < NUM_AUTHORIZATION; i++) { @@ -169,8 +169,9 @@ XauDisposeAuth (auth); } -#if !defined(WIN32) && !defined(__EMX__) - Pclose (f); +#if !defined(WIN32) && !defined(__UNIXOS2__) + if (Pclose (f) != 0) + return -1; #else fclose (f); #endif @@ -205,6 +206,7 @@ int i; struct stat buf; static time_t lastmod = 0; + static Bool loaded = FALSE; if (!authorization_file || stat(authorization_file, &buf)) { @@ -220,9 +222,28 @@ } if (ShouldLoadAuth) { - if (LoadAuthorization()) + int loadauth = LoadAuthorization(); + + /* + * If the authorization file has at least one entry for this server, + * disable local host access. (loadauth > 0) + * + * If there are zero entries (either initially or when the + * authorization file is later reloaded), or if a valid + * authorization file was never loaded, enable local host access. + * (loadauth == 0 || !loaded) + * + * If the authorization file was loaded initially (with valid + * entries for this server), and reloading it later fails, don't + * change anything. (loadauth == -1 && loaded) + */ + + if (loadauth > 0) + { DisableLocalHost(); /* got at least one */ - else + loaded = TRUE; + } + else if (loadauth == 0 || !loaded) EnableLocalHost (); } if (name_length) { Index: xc/programs/Xserver/os/connection.c diff -u xc/programs/Xserver/os/connection.c:3.55 xc/programs/Xserver/os/connection.c:3.56 --- xc/programs/Xserver/os/connection.c:3.55 Fri Dec 14 15:00:33 2001 +++ xc/programs/Xserver/os/connection.c Fri May 31 14:46:05 2002 @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.55 2001/12/14 20:00:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.56 2002/05/31 18:46:05 dawes Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * @@ -101,7 +101,7 @@ #include <sys/ioctl.h> #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) extern __const__ int _nfiles; #endif @@ -118,7 +118,7 @@ # ifdef CSRG_BASED # include <sys/param.h> # endif -# ifndef __EMX__ +# ifndef __UNIXOS2__ # include <netinet/tcp.h> # endif # endif @@ -131,7 +131,7 @@ #include <server/ip/gen/inet.h> #endif -#if !defined(__EMX__) +#if !defined(__UNIXOS2__) #ifndef Lynx #include <sys/uio.h> #else @@ -257,7 +257,7 @@ #ifndef __CYGWIN__ -#ifndef __EMX__ +#ifndef __UNIXOS2__ #if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX) lastfdesc = sysconf(_SC_OPEN_MAX) - 1; @@ -273,7 +273,7 @@ lastfdesc = _NFILE - 1; #endif -#else /* __EMX__ */ +#else /* __UNIXOS2__ */ lastfdesc = _nfiles - 1; #endif Index: xc/programs/Xserver/os/io.c diff -u xc/programs/Xserver/os/io.c:3.32 xc/programs/Xserver/os/io.c:3.34 --- xc/programs/Xserver/os/io.c:3.32 Fri Dec 14 15:00:34 2001 +++ xc/programs/Xserver/os/io.c Fri May 31 14:46:05 2002 @@ -43,6 +43,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ******************************************************************/ /* $Xorg: io.c,v 1.6 2001/02/09 02:05:23 xorgcvs Exp $ */ /***************************************************************** @@ -52,8 +53,11 @@ * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/os/io.c,v 3.32 2001/12/14 20:00:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/io.c,v 3.34 2002/05/31 18:46:05 dawes Exp $ */ +#if 0 +#define DEBUG_COMMUNICATION +#endif #ifdef WIN32 #include <X11/Xwinsock.h> #endif @@ -61,7 +65,7 @@ #include <X11/Xtrans.h> #include "Xmd.h" #include <errno.h> -#if !defined(__EMX__) && !defined(WIN32) +#if !defined(__UNIXOS2__) && !defined(WIN32) #ifndef Lynx #include <sys/uio.h> #else @@ -89,7 +93,7 @@ /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ #if defined(EAGAIN) && defined(EWOULDBLOCK) #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) #else @@ -99,7 +103,7 @@ #define ETEST(err) (err == EWOULDBLOCK) #endif #endif -#else /* __EMX__ Writing to full pipes may return ENOSPC */ +#else /* __UNIXOS2__ Writing to full pipes may return ENOSPC */ #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK || err == ENOSPC) #endif @@ -503,6 +507,13 @@ } #endif client->requestBuffer = (pointer)oci->bufptr; +#ifdef DEBUG_COMMUNICATION + { + xReq *req = client->requestBuffer; + ErrorF("REQUEST: ClientIDX: %i, type: 0x%x data: 0x%x len: %i\n", + client->index,req->reqType,req->data,req->length); + } +#endif return needed; } @@ -911,9 +922,50 @@ OsCommPtr oc = (OsCommPtr)who->osPrivate; register ConnectionOutputPtr oco = oc->output; int padBytes; - +#ifdef DEBUG_COMMUNICATION + Bool multicount = FALSE; +#endif if (!count) return(0); +#ifdef DEBUG_COMMUNICATION + { + char info[128]; + xError *err; + xGenericReply *rep; + xEvent *ev; + + if (!who->replyBytesRemaining) { + switch(buf[0]) { + case X_Reply: + rep = (xGenericReply*)buf; + if (rep->sequenceNumber == who->sequence) { + snprintf(info,127,"Xreply: type: 0x%x data: 0x%x " + "len: %i seq#: 0x%x", rep->type, rep->data1, + rep->length, rep->sequenceNumber); + multicount = TRUE; + } + break; + case X_Error: + err = (xError*)buf; + snprintf(info,127,"Xerror: Code: 0x%x resID: 0x%x maj: 0x%x " + "min: %x", err->errorCode,err->resourceID, + err->minorCode,err->majorCode); + break; + default: + if ((buf[0] & 0x7f) == KeymapNotify) + snprintf(info,127,"KeymapNotifyEvent: %i",buf[0]); + else { + ev = (xEvent*)buf; + snprintf(info,127,"XEvent: type: 0x%x detail: 0x%x " + "seq#: 0x%x", ev->u.u.type, ev->u.u.detail, + ev->u.u.sequenceNumber); + } + } + ErrorF("REPLY: ClientIDX: %i %s\n",who->index, info); + } else + multicount = TRUE; + } +#endif if (!oco) { @@ -965,8 +1017,19 @@ replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft; CallCallbacks((&ReplyCallback), (pointer)&replyinfo); } - } - + } +#ifdef DEBUG_COMMUNICATION + else if (multicount) { + if (who->replyBytesRemaining) { + who->replyBytesRemaining -= (count + padBytes); + } else { + CARD32 replylen; + replylen = ((xGenericReply *)buf)->length; + who->replyBytesRemaining = + (replylen * 4) + SIZEOF(xReply) - count - padBytes; + } + } +#endif if (oco->count + count + padBytes > oco->size) { FD_CLR(oc->fd, &OutputPending); @@ -1039,7 +1102,7 @@ long remain = todo; /* amount to try this time, <= notWritten */ int i = 0; long len; - + /* You could be very general here and have "in" and "out" iovecs * and write a loop without using a macro, but what the heck. This * translates to: Index: xc/programs/Xserver/os/lbxio.c diff -u xc/programs/Xserver/os/lbxio.c:3.16 xc/programs/Xserver/os/lbxio.c:3.17 --- xc/programs/Xserver/os/lbxio.c:3.16 Fri Dec 14 15:00:34 2001 +++ xc/programs/Xserver/os/lbxio.c Fri May 31 14:46:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.16 2001/12/14 20:00:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.17 2002/05/31 18:46:06 dawes Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -55,7 +55,7 @@ #include <errno.h> #ifndef Lynx #include <sys/param.h> -#ifndef __EMX__ +#ifndef __UNIXOS2__ #include <sys/uio.h> #endif #else Index: xc/programs/Xserver/os/oscolor.c diff -u xc/programs/Xserver/os/oscolor.c:3.7 xc/programs/Xserver/os/oscolor.c:3.8 --- xc/programs/Xserver/os/oscolor.c:3.7 Fri Dec 14 15:00:35 2001 +++ xc/programs/Xserver/os/oscolor.c Fri May 31 14:46:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.7 2001/12/14 20:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.8 2002/05/31 18:46:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -225,7 +225,7 @@ if (!was_here) { -#ifndef __EMX__ +#ifndef __UNIXOS2__ path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5); strcpy(path, rgbPath); strcat(path, ".txt"); @@ -245,7 +245,7 @@ while(fgets(line, sizeof(line), rgb)) { lineno++; -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (sscanf(line,"%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4) #else if (sscanf(line,"%d %d %d %[^\n\r]\n", &red, &green, &blue, name) == 4) Index: xc/programs/Xserver/os/osdep.h diff -u xc/programs/Xserver/os/osdep.h:3.16 xc/programs/Xserver/os/osdep.h:3.17 --- xc/programs/Xserver/os/osdep.h:3.16 Fri Dec 14 15:00:35 2001 +++ xc/programs/Xserver/os/osdep.h Fri May 31 14:46:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.16 2001/12/14 20:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.17 2002/05/31 18:46:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -89,7 +89,7 @@ #if defined(NOFILE) && !defined(NOFILES_MAX) #define OPEN_MAX NOFILE #else -#ifndef __EMX__ +#ifndef __UNIXOS2__ #define OPEN_MAX NOFILES_MAX #else #define OPEN_MAX 256 Index: xc/programs/Xserver/os/osinit.c diff -u xc/programs/Xserver/os/osinit.c:3.25 xc/programs/Xserver/os/osinit.c:3.27 --- xc/programs/Xserver/os/osinit.c:3.25 Fri Dec 14 15:00:35 2001 +++ xc/programs/Xserver/os/osinit.c Mon Jun 17 04:04:18 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.25 2001/12/14 20:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.27 2002/06/17 08:04:18 alanh Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -110,7 +110,7 @@ #ifdef XFree86LOADER xf86WrapperInit(); #endif -#if !defined(SCO) +#if !defined(SCO) && !defined(__CYGWIN__) fclose(stdin); fclose(stdout); #endif @@ -138,7 +138,7 @@ dup2 (fileno (err), 2); fclose (err); } -#if defined(SYSV) || defined(SVR4) || defined(__EMX__) || defined(WIN32) || defined(__CYGWIN__) +#if defined(SYSV) || defined(SVR4) || defined(__UNIXOS2__) || defined(WIN32) || defined(__CYGWIN__) { static char buf[BUFSIZ]; setvbuf (stderr, buf, _IOLBF, BUFSIZ); Index: xc/programs/Xserver/os/utils.c diff -u xc/programs/Xserver/os/utils.c:3.81 xc/programs/Xserver/os/utils.c:3.85 --- xc/programs/Xserver/os/utils.c:3.81 Wed Jan 16 15:39:51 2002 +++ xc/programs/Xserver/os/utils.c Tue Dec 24 12:43:00 2002 @@ -49,7 +49,7 @@ OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.81 2002/01/16 20:39:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.85 2002/12/24 17:43:00 tsi Exp $ */ #ifdef __CYGWIN__ #include <stdlib.h> @@ -115,6 +115,10 @@ #include "security.h" #endif +#ifdef RENDER +#include "picture.h" +#endif + #define X_INCLUDE_NETDB_H #include <X11/Xos_r.h> @@ -189,23 +193,19 @@ * server at a time. This keeps the servers from stomping on each other * if the user forgets to give them different display numbers. */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ #define LOCK_DIR "/tmp" +#endif #define LOCK_TMP_PREFIX "/.tX" #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" -#else -#define LOCK_TMP_PREFIX "/xf86$" -#define LOCK_PREFIX "/xf86_" -#define LOCK_SUFFIX ".lck" -#endif #if defined(DGUX) #include <limits.h> #include <sys/param.h> #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define link rename #endif @@ -246,7 +246,7 @@ /* * Path names */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ tmppath = LOCK_DIR; #else /* OS/2 uses TMP directory, must also prepare for 8.3 names */ @@ -293,7 +293,7 @@ FatalError("Could not create lock file in %s\n", tmp); (void) sprintf(pid_str, "%10ld\n", (long)getpid()); (void) write(lfd, pid_str, 11); -#ifndef __EMX__ +#ifndef __UNIXOS2__ #ifndef USE_CHMOD (void) fchmod(lfd, 0444); #else @@ -378,9 +378,9 @@ if (!StillLocking){ -#ifdef __EMX__ +#ifdef __UNIXOS2__ (void) chmod(LockFile,S_IREAD|S_IWRITE); -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ (void) unlink(LockFile); } } @@ -425,7 +425,7 @@ errno = olderrno; } -#if __GNUC__ +#ifdef __GNUC__ static void AbortServer() __attribute__((noreturn)); #endif @@ -496,6 +496,7 @@ ErrorF("-audit int set audit trail level\n"); ErrorF("-auth file select authorization file\n"); ErrorF("bc enable bug compatibility\n"); + ErrorF("-br create root window with black background\n"); ErrorF("+bs enable any backing store support\n"); ErrorF("-bs disable any backing store support\n"); ErrorF("-c turns off key-click\n"); @@ -540,6 +541,9 @@ ErrorF("-nopn reject failure to listen on all ports\n"); ErrorF("-r turns off auto-repeat\n"); ErrorF("r turns on auto-repeat \n"); +#ifdef RENDER + ErrorF("-render [default|mono|gray|color] set render color alloc policy\n"); +#endif ErrorF("-s # screen-saver timeout (minutes)\n"); #ifdef XCSECURITY ErrorF("-sp file security policy file\n"); @@ -659,6 +663,8 @@ } else if ( strcmp( argv[i], "bc") == 0) permitOldBugs = TRUE; + else if ( strcmp( argv[i], "-br") == 0) + blackRoot = TRUE; else if ( strcmp( argv[i], "+bs") == 0) enableBackingStore = TRUE; else if ( strcmp( argv[i], "-bs") == 0) @@ -791,7 +797,7 @@ #ifdef SERVER_LOCK else if ( strcmp ( argv[i], "-nolock") == 0) { -#if !defined(WIN32) && !defined(__EMX__) && !defined(__CYGWIN__) +#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__) if (getuid() != 0) ErrorF("Warning: the -nolock option can only be used by root\n"); else @@ -960,6 +966,22 @@ UseMsg(); } #endif +#ifdef RENDER + else if ( strcmp( argv[i], "-render" ) == 0) + { + if (++i < argc) + { + int policy = PictureParseCmapPolicy (argv[i]); + + if (policy != PictureCmapPolicyInvalid) + PictureCmapPolicy = policy; + else + UseMsg (); + } + else + UseMsg (); + } +#endif else { ErrorF("Unrecognized option: %s\n", argv[i]); @@ -1068,7 +1090,7 @@ { int i; -#if !defined(WIN32) && !defined(__EMX__) && !defined(__CYGWIN__) +#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__) if (getuid() != geteuid()) return; #endif @@ -1590,7 +1612,7 @@ #endif } -#if !defined(WIN32) && !defined(__EMX__) +#if !defined(WIN32) && !defined(__UNIXOS2__) /* * "safer" versions of system(3), popen(3) and pclose(3) which give up * all privs before running a command. @@ -1760,7 +1782,7 @@ return pid == -1 ? -1 : pstat; } -#endif /* !WIN32 && !__EMX__ */ +#endif /* !WIN32 && !__UNIXOS2__ */ /* Index: xc/programs/Xserver/os/xalloc.c diff -u xc/programs/Xserver/os/xalloc.c:3.32 xc/programs/Xserver/os/xalloc.c:3.33 --- xc/programs/Xserver/os/xalloc.c:3.32 Wed Oct 10 15:06:37 2001 +++ xc/programs/Xserver/os/xalloc.c Thu Apr 4 09:05:57 2002 @@ -1,3 +1,4 @@ +#define FATALERRORS 1 /* Copyright (C) 1995 Pascal Haible. All Rights Reserved. @@ -25,7 +26,7 @@ Pascal Haible. */ -/* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.32 2001/10/10 19:06:37 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.33 2002/04/04 14:05:57 eich Exp $ */ /* Only used if INTERNAL_MALLOC is defined * - otherwise xalloc() in utils.c is used @@ -181,7 +182,8 @@ #if defined(__alpha__) || defined(__alpha) || \ defined(__ia64__) || defined(ia64) || \ defined(__sparc64__) || \ - defined(__s390x__) + defined(__s390x__) || \ + defined(__x86_64__) || defined(x86_64) #define MAGIC 0x1404196414071968 #define MAGIC_FREE 0x1506196615061966 #define MAGIC2 0x2515207525182079 Index: xc/programs/Xserver/os/xdmauth.c diff -u xc/programs/Xserver/os/xdmauth.c:1.6 xc/programs/Xserver/os/xdmauth.c:1.7 --- xc/programs/Xserver/os/xdmauth.c:1.6 Fri Dec 14 15:00:35 2001 +++ xc/programs/Xserver/os/xdmauth.c Tue Nov 5 00:50:34 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/xdmauth.c,v 1.6 2001/12/14 20:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/xdmauth.c,v 1.7 2002/11/05 05:50:34 keithp Exp $ */ /* * XDM-AUTHENTICATION-1 (XDMCP authentication) and @@ -349,6 +349,7 @@ switch (data_length) { case 16: /* auth from files is 16 bytes long */ +#ifdef XDMCP if (authFromXDMCP) { /* R5 xdm sent bogus authorization data in the accept packet, @@ -358,15 +359,18 @@ key_bits[0] = '\0'; } else +#endif { rho_bits = (unsigned char *) data; key_bits = (unsigned char *) (data + 8); } break; +#ifdef XDMCP case 8: /* auth from XDMCP is 8 bytes long */ rho_bits = rho.data; key_bits = (unsigned char *) data; break; +#endif default: return 0; } @@ -494,10 +498,12 @@ rho_bits = (XdmAuthKeyPtr) data; key_bits = (XdmAuthKeyPtr) (data + 8); break; +#ifdef XDMCP case 8: rho_bits = ρ key_bits = (XdmAuthKeyPtr) data; break; +#endif default: return 0; } Index: xc/programs/Xserver/os/xdmcp.c diff -u xc/programs/Xserver/os/xdmcp.c:3.20 xc/programs/Xserver/os/xdmcp.c:3.21 --- xc/programs/Xserver/os/xdmcp.c:3.20 Mon Nov 19 15:44:18 2001 +++ xc/programs/Xserver/os/xdmcp.c Mon Mar 11 11:22:28 2002 @@ -13,7 +13,7 @@ * without express or implied warranty. * */ -/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.20 2001/11/19 20:44:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.21 2002/03/11 16:22:28 keithp Exp $ */ #ifdef WIN32 /* avoid conflicting definitions */ @@ -660,34 +660,17 @@ pointer pReadmask) { fd_set *LastSelectMask = (fd_set*)pReadmask; - CARD32 millisToGo, wtMillis; - static struct timeval waittime; + CARD32 millisToGo; if (state == XDM_OFF) return; FD_SET(xdmcpSocket, LastSelectMask); if (timeOutTime == 0) return; - millisToGo = GetTimeInMillis(); - if (millisToGo < timeOutTime) - millisToGo = timeOutTime - millisToGo; - else + millisToGo = timeOutTime - GetTimeInMillis(); + if ((int) millisToGo < 0) millisToGo = 0; - if (*wt == NULL) - { - waittime.tv_sec = (millisToGo) / 1000; - waittime.tv_usec = 1000 * (millisToGo % 1000); - *wt = &waittime; - } - else - { - wtMillis = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000; - if (millisToGo < wtMillis) - { - (*wt)->tv_sec = (millisToGo) / 1000; - (*wt)->tv_usec = 1000 * (millisToGo % 1000); - } - } + AdjustWaitForDelay (wt, millisToGo); } /* @@ -726,7 +709,7 @@ if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION) timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000; } - else if (timeOutTime && GetTimeInMillis() >= timeOutTime) + else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0) { if (state == XDM_RUN_SESSION) { Index: xc/programs/Xserver/randr/Imakefile diff -u xc/programs/Xserver/randr/Imakefile:1.1 xc/programs/Xserver/randr/Imakefile:1.2 --- xc/programs/Xserver/randr/Imakefile:1.1 Tue May 22 23:29:44 2001 +++ xc/programs/Xserver/randr/Imakefile Sun Sep 29 19:39:45 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.2 2002/09/29 23:39:45 keithp Exp $ #include <Server.tmpl> SRCS = randr.c mirandr.c @@ -7,7 +7,7 @@ INCLUDES = -I../include -I../mi -I../../../include/fonts \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - -I$(FONTINCSRC) + -I$(FONTINCSRC) -I../render LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln NormalLibraryTarget(randr,$(OBJS)) Index: xc/programs/Xserver/randr/mirandr.c diff -u xc/programs/Xserver/randr/mirandr.c:1.5 xc/programs/Xserver/randr/mirandr.c:1.7 --- xc/programs/Xserver/randr/mirandr.c:1.5 Mon Jun 4 05:45:40 2001 +++ xc/programs/Xserver/randr/mirandr.c Mon Oct 14 14:01:42 2002 @@ -1,29 +1,30 @@ /* - * $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.5 2001/06/04 09:45:40 keithp Exp $ + * $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.7 2002/10/14 18:01:42 keithp Exp $ * - * Copyright © 2001 Compaq Computer Corporation + * Copyright © 2000, Compaq Computer Corporation, + * Copyright © 2002, Hewlett Packard, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Compaq not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Compaq makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. + * documentation, and that the name of Compaq or HP not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. HP makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. * - * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * Author: Jim Gettys, Compaq Computer Corporation + * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. */ + #include "scrnintstr.h" #include "mi.h" #include "randr.h" @@ -36,6 +37,7 @@ * can be displayed simultaneously. It further assumes that * only a single size is available. Hardware providing * additional capabilties should use different code. + * XXX what to do here.... */ Bool @@ -49,52 +51,23 @@ { if (pScreen->allowedDepths[i].numVids) { - RRVisualGroupPtr pVisualGroup; - - pVisualGroup = RRCreateVisualGroup (pScreen); - if (pVisualGroup) - { - RRGroupOfVisualGroupPtr pGroupOfVisualGroup; RRScreenSizePtr pSize; - if (!RRAddDepthToVisualGroup (pScreen, - pVisualGroup, - &pScreen->allowedDepths[i])) - { - RRDestroyVisualGroup (pScreen, pVisualGroup); - return FALSE; - } - pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup); - if (!pVisualGroup) - return FALSE; - - pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen); - - if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen, - pGroupOfVisualGroup, - pVisualGroup)) - { - RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - /* pVisualGroup left until screen closed */ - return FALSE; - } - pSize = RRRegisterSize (pScreen, pScreen->width, pScreen->height, pScreen->mmWidth, - pScreen->mmHeight, - pGroupOfVisualGroup); + pScreen->mmHeight); if (!pSize) return FALSE; if (!setConfig) { - RRSetCurrentConfig (pScreen, RR_Rotate_0, pSize, pVisualGroup); + RRSetCurrentConfig (pScreen, RR_Rotate_0, 0, pSize); setConfig = TRUE; } - } } } + return TRUE; } /* @@ -104,8 +77,8 @@ Bool miRRSetConfig (ScreenPtr pScreen, Rotation rotation, - RRScreenSizePtr pSize, - RRVisualGroupPtr pVisualGroup) + int rate, + RRScreenSizePtr pSize) { return TRUE; } Index: xc/programs/Xserver/randr/randr.c diff -u xc/programs/Xserver/randr/randr.c:1.12 xc/programs/Xserver/randr/randr.c:1.19 --- xc/programs/Xserver/randr/randr.c:1.12 Fri Jul 20 15:30:11 2001 +++ xc/programs/Xserver/randr/randr.c Fri Feb 7 22:52:30 2003 @@ -1,28 +1,30 @@ /* - * $XFree86: xc/programs/Xserver/randr/randr.c,v 1.12 2001/07/20 19:30:11 keithp Exp $ + * $XFree86: xc/programs/Xserver/randr/randr.c,v 1.19 2003/02/08 03:52:30 dawes Exp $ * - * Copyright © 2000 Compaq Computer Corporation, Inc. + * Copyright © 2000, Compaq Computer Corporation, + * Copyright © 2002, Hewlett Packard, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Compaq not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Compaq makes no representations about the + * documentation, and that the name of Compaq or HP not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. HP makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * - * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ + * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * Author: Jim Gettys, Compaq Computer Corporation, Inc. + * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. */ + #define NEED_REPLIES #define NEED_EVENTS #include "X.h" @@ -39,6 +41,8 @@ #include "randr.h" #include "randrproto.h" #include "randrstr.h" +#include "render.h" /* we share subpixel order information */ +#include "picturestr.h" #include "Xfuncproto.h" #ifdef EXTMODULE #include "xf86_ansic.h" @@ -66,6 +70,18 @@ static int RRErrBase; static int RREventBase; static RESTYPE ClientType, EventType; /* resource types for event masks */ +static int RRClientPrivateIndex; + +typedef struct _RRTimes { + TimeStamp setTime; + TimeStamp configTime; +} RRTimesRec, *RRTimesPtr; + +typedef struct _RRClient { + int major_version; + int minor_version; +/* RRTimesRec times[0]; */ +} RRClientRec, *RRClientPtr; /* * each window has a list of clients requesting @@ -82,15 +98,53 @@ ClientPtr client; WindowPtr window; XID clientResource; + int mask; } RREventRec; int rrPrivIndex = -1; +#define GetRRClient(pClient) ((RRClientPtr) (pClient)->devPrivates[RRClientPrivateIndex].ptr) +#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient) + +static Bool +RRClientKnowsRates (ClientPtr pClient) +{ + rrClientPriv(pClient); + + return (pRRClient->major_version > 1 || + (pRRClient->major_version == 1 && pRRClient->minor_version >= 1)); +} + +static void +RRClientCallback (CallbackListPtr *list, + pointer closure, + pointer data) +{ + NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; + ClientPtr pClient = clientinfo->client; + rrClientPriv(pClient); + RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1); + int i; + + pRRClient->major_version = 0; + pRRClient->minor_version = 0; + for (i = 0; i < screenInfo.numScreens; i++) + { + ScreenPtr pScreen = screenInfo.screens[i]; + rrScrPriv(pScreen); + + if (pScrPriv) + { + pTimes[i].setTime = pScrPriv->lastSetTime; + pTimes[i].configTime = pScrPriv->lastConfigTime; + } + } +} + static void RRResetProc (ExtensionEntry *extEntry) { } - static Bool RRCloseScreen (int i, ScreenPtr pScreen) @@ -100,18 +154,14 @@ unwrap (pScrPriv, pScreen, CloseScreen); if (pScrPriv->pSizes) xfree (pScrPriv->pSizes); - if (pScrPriv->pGroupsOfVisualGroups) - xfree (pScrPriv->pGroupsOfVisualGroups); - if (pScrPriv->pVisualGroups) - xfree (pScrPriv->pVisualGroups); xfree (pScrPriv); RRNScreens -= 1; /* ok, one fewer screen with RandR running */ return (*pScreen->CloseScreen) (i, pScreen); } static void -SRRScreenChangeNotifyEvent(from, to) - xRRScreenChangeNotifyEvent *from, *to; +SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from, + xRRScreenChangeNotifyEvent *to) { to->type = from->type; to->rotation = from->rotation; @@ -121,11 +171,11 @@ cpswapl(from->root, to->root); cpswapl(from->window, to->window); cpswaps(from->sizeID, to->sizeID); - cpswaps(from->visualGroupID, to->visualGroupID); cpswaps(from->widthInPixels, to->widthInPixels); cpswaps(from->heightInPixels, to->heightInPixels); cpswaps(from->widthInMillimeters, to->widthInMillimeters); cpswaps(from->heightInMillimeters, to->heightInMillimeters); + cpswaps(from->subpixelOrder, to->subpixelOrder); } Bool RRScreenInit(ScreenPtr pScreen) @@ -161,22 +211,13 @@ wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen); pScrPriv->rotations = RR_Rotate_0; - pScrPriv->swaps = 0; - pScrPriv->nVisualGroups = 0; - pScrPriv->nVisualGroupsInUse = 0; - pScrPriv->pVisualGroups = 0; - - pScrPriv->nGroupsOfVisualGroups = 0; - pScrPriv->nGroupsOfVisualGroupsInUse = 0; - pScrPriv->pGroupsOfVisualGroups = 0; pScrPriv->nSizes = 0; pScrPriv->nSizesInUse = 0; pScrPriv->pSizes = 0; pScrPriv->rotation = RR_Rotate_0; - pScrPriv->pSize = 0; - pScrPriv->pVisualGroup = 0; + pScrPriv->size = -1; RRNScreens += 1; /* keep count of screens that implement randr */ return TRUE; @@ -232,6 +273,14 @@ if (RRNScreens == 0) return; + RRClientPrivateIndex = AllocateClientPrivateIndex (); + if (!AllocateClientPrivate (RRClientPrivateIndex, + sizeof (RRClientRec) + + screenInfo.numScreens * sizeof (RRTimesRec))) + return; + if (!AddCallback (&ClientStateCallback, RRClientCallback, 0)) + return; + ClientType = CreateNewResourceType(RRFreeClient); if (!ClientType) return; @@ -260,7 +309,7 @@ xRRScreenChangeNotifyEvent se; ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); - RRScreenSizePtr pSize = pScrPriv->pSize; + RRScreenSizePtr pSize; WindowPtr pRoot = WindowTable[pScreen->myNum]; pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, EventType); @@ -271,12 +320,13 @@ se.rotation = (CARD8) pScrPriv->rotation; se.timestamp = pScrPriv->lastSetTime.milliseconds; se.configTimestamp = pScrPriv->lastConfigTime.milliseconds; - se.root = pRoot->drawable.id; + se.root = pRoot->drawable.id; se.window = pWin->drawable.id; - if (pSize) + se.subpixelOrder = PictureGetSubpixelOrder (pScreen); + if (pScrPriv->size >= 0) { + pSize = &pScrPriv->pSizes[pScrPriv->size]; se.sizeID = pSize->id; - se.visualGroupID = pScrPriv->pVisualGroup->id; se.widthInPixels = pSize->width; se.heightInPixels = pSize->height; se.widthInMillimeters = pSize->mmWidth; @@ -289,20 +339,19 @@ * forget to set the current configuration on GetInfo */ se.sizeID = 0xffff; - se.visualGroupID = 0xffff; se.widthInPixels = 0; se.heightInPixels = 0; se.widthInMillimeters = 0; se.heightInMillimeters = 0; } - for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { client = pRREvent->client; if (client == serverClient || client->clientGone) continue; se.sequenceNumber = client->sequence; - WriteEventsToClient (client, 1, (xEvent *) &se); + if(pRREvent->mask & RRScreenChangeNotifyMask) + WriteEventsToClient (client, 1, (xEvent *) &se); } return WT_WALKCHILDREN; } @@ -311,24 +360,23 @@ RRGetInfo (ScreenPtr pScreen) { rrScrPriv (pScreen); - int i, j; + int i, j, k, l; Bool changed; Rotation rotations; + RRScreenSizePtr pSize; + RRScreenRatePtr pRate; - for (i = 0; i < pScrPriv->nVisualGroups; i++) - { - pScrPriv->pVisualGroups[i].oldReferenced = pScrPriv->pVisualGroups[i].referenced; - pScrPriv->pVisualGroups[i].referenced = FALSE; - } - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - { - pScrPriv->pGroupsOfVisualGroups[i].oldReferenced = pScrPriv->pGroupsOfVisualGroups[i].referenced; - pScrPriv->pGroupsOfVisualGroups[i].referenced = FALSE; - } for (i = 0; i < pScrPriv->nSizes; i++) { - pScrPriv->pSizes[i].oldReferenced = pScrPriv->pSizes[i].referenced; - pScrPriv->pSizes[i].referenced = FALSE; + pSize = &pScrPriv->pSizes[i]; + pSize->oldReferenced = pSize->referenced; + pSize->referenced = FALSE; + for (k = 0; k < pSize->nRates; k++) + { + pRate = &pSize->pRates[k]; + pRate->oldReferenced = pRate->referenced; + pRate->referenced = FALSE; + } } if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations)) return FALSE; @@ -346,30 +394,23 @@ } j = 0; - for (i = 0; i < pScrPriv->nVisualGroups; i++) - { - if (pScrPriv->pVisualGroups[i].oldReferenced != pScrPriv->pVisualGroups[i].referenced) - changed = TRUE; - if (pScrPriv->pVisualGroups[i].referenced) - pScrPriv->pVisualGroups[i].id = j++; - } - pScrPriv->nVisualGroupsInUse = j; - j = 0; - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - { - if (pScrPriv->pGroupsOfVisualGroups[i].oldReferenced != pScrPriv->pGroupsOfVisualGroups[i].referenced) - changed = TRUE; - if (pScrPriv->pGroupsOfVisualGroups[i].referenced) - pScrPriv->pGroupsOfVisualGroups[i].id = j++; - } - pScrPriv->nGroupsOfVisualGroupsInUse = j; - j = 0; for (i = 0; i < pScrPriv->nSizes; i++) { - if (pScrPriv->pSizes[i].oldReferenced != pScrPriv->pSizes[i].referenced) + pSize = &pScrPriv->pSizes[i]; + if (pSize->oldReferenced != pSize->referenced) changed = TRUE; - if (pScrPriv->pSizes[i].referenced) - pScrPriv->pSizes[i].id = j++; + if (pSize->referenced) + pSize->id = j++; + l = 0; + for (k = 0; k < pSize->nRates; k++) + { + pRate = &pSize->pRates[k]; + if (pRate->oldReferenced != pRate->referenced) + changed = TRUE; + if (pRate->referenced) + l++; + } + pSize->nRatesInUse = l; } pScrPriv->nSizesInUse = j; if (changed) @@ -408,8 +449,11 @@ xRRQueryVersionReply rep; register int n; REQUEST(xRRQueryVersionReq); + rrClientPriv(client); REQUEST_SIZE_MATCH(xRRQueryVersionReq); + pRRClient->major_version = stuff->majorVersion; + pRRClient->minor_version = stuff->minorVersion; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -425,53 +469,6 @@ return (client->noClientException); } -static Bool -RRVisualGroupContains (RRVisualGroupPtr pVisualGroup, - VisualID visual) -{ - int i; - - for (i = 0; i < pVisualGroup->nvisuals; i++) - if (pVisualGroup->visuals[i]->vid == visual) - return TRUE; - return FALSE; -} - -static CARD16 -RRNumMatchingVisualGroups (ScreenPtr pScreen, - VisualID visual) -{ - rrScrPriv(pScreen); - int i; - CARD16 n = 0; - RRVisualGroupPtr pVisualGroup; - - for (i = 0; i < pScrPriv->nVisualGroups; i++) - { - pVisualGroup = &pScrPriv->pVisualGroups[i]; - if (pVisualGroup->referenced && RRVisualGroupContains (pVisualGroup, visual)) - n++; - } - return n; -} - -static void -RRGetMatchingVisualGroups (ScreenPtr pScreen, - VisualID visual, - VisualGroupID *pVisualGroupIDs) -{ - rrScrPriv(pScreen); - int i; - CARD16 n = 0; - RRVisualGroupPtr pVisualGroup; - - for (i = 0; i < pScrPriv->nVisualGroups; i++) - { - pVisualGroup = &pScrPriv->pVisualGroups[i]; - if (pVisualGroup->referenced && RRVisualGroupContains (pVisualGroup, visual)) - *pVisualGroupIDs++ = pVisualGroup->id; - } -} extern char *ConnectionInfo; @@ -537,6 +534,7 @@ pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); + rep.pad = 0; if (!pScrPriv) { rep.type = X_Reply; @@ -546,25 +544,21 @@ rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; rep.timestamp = currentTime.milliseconds; rep.configTimestamp = currentTime.milliseconds; - rep.nVisualGroups = 0; - rep.nGroupsOfVisualGroups = 0; rep.nSizes = 0; rep.sizeID = 0; - rep.visualGroupID = 0; rep.rotation = RR_Rotate_0; + rep.rate = 0; + rep.nrateEnts = 0; extra = 0; extraLen = 0; } else { int i, j; - int nGroupsOfVisualGroupsElements; - RRGroupOfVisualGroupPtr pGroupsOfVisualGroups; - int nVisualGroupElements; - RRVisualGroupPtr pVisualGroup; xScreenSizes *size; - CARD16 *data16; - CARD32 *data32; + CARD16 *rates; + CARD8 *data8; + Bool has_rate = RRClientKnowsRates (client); RRGetInfo (pScreen); @@ -575,47 +569,30 @@ rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; rep.timestamp = pScrPriv->lastSetTime.milliseconds; rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; - - rep.nVisualGroups = pScrPriv->nVisualGroupsInUse; rep.rotation = pScrPriv->rotation; rep.nSizes = pScrPriv->nSizesInUse; - rep.nGroupsOfVisualGroups = pScrPriv->nGroupsOfVisualGroupsInUse; - if (pScrPriv->pSize) - rep.sizeID = pScrPriv->pSize->id; - else - return BadImplementation; - if (pScrPriv->pVisualGroup) - rep.visualGroupID = pScrPriv->pVisualGroup->id; - else - return BadImplementation; - /* - * Count up the total number of spaces needed to transmit - * the groups of visual groups - */ - nGroupsOfVisualGroupsElements = 0; - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - { - pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[i]; - if (pGroupsOfVisualGroups->referenced) - nGroupsOfVisualGroupsElements += pGroupsOfVisualGroups->ngroups + 1; - } - /* - * Count up the total number of spaces needed to transmit - * the visual groups - */ - nVisualGroupElements = 0; - for (i = 0; i < pScrPriv->nVisualGroups; i++) + rep.rate = pScrPriv->rate; + rep.nrateEnts = 0; + if (has_rate) { - pVisualGroup = &pScrPriv->pVisualGroups[i]; - if (pVisualGroup->referenced) - nVisualGroupElements += pVisualGroup->nvisuals + 1; + for (i = 0; i < pScrPriv->nSizes; i++) + { + RRScreenSizePtr pSize = &pScrPriv->pSizes[i]; + if (pSize->referenced) + { + rep.nrateEnts += (1 + pSize->nRatesInUse); + } + } } - /* - * Allocate space for the extra information - */ + + if (pScrPriv->size >= 0) + rep.sizeID = pScrPriv->pSizes[pScrPriv->size].id; + else + return BadImplementation; + extraLen = (rep.nSizes * sizeof (xScreenSizes) + - nVisualGroupElements * sizeof (CARD32) + - nGroupsOfVisualGroupsElements * sizeof (CARD16)); + rep.nrateEnts * sizeof (CARD16)); + extra = (CARD8 *) xalloc (extraLen); if (!extra) return BadAlloc; @@ -623,67 +600,54 @@ * First comes the size information */ size = (xScreenSizes *) extra; + rates = (CARD16 *) (size + rep.nSizes); for (i = 0; i < pScrPriv->nSizes; i++) { - if (pScrPriv->pSizes[i].referenced) + RRScreenSizePtr pSize = &pScrPriv->pSizes[i]; + if (pSize->referenced) { - size->widthInPixels = pScrPriv->pSizes[i].width; - size->heightInPixels = pScrPriv->pSizes[i].height; - size->widthInMillimeters = pScrPriv->pSizes[i].mmWidth; - size->heightInMillimeters = pScrPriv->pSizes[i].mmHeight; - size->visualGroup = pScrPriv->pGroupsOfVisualGroups[pScrPriv->pSizes[i].groupOfVisualGroups].id; + size->widthInPixels = pSize->width; + size->heightInPixels = pSize->height; + size->widthInMillimeters = pSize->mmWidth; + size->heightInMillimeters = pSize->mmHeight; if (client->swapped) { swaps (&size->widthInPixels, n); swaps (&size->heightInPixels, n); swaps (&size->widthInMillimeters, n); swaps (&size->heightInMillimeters, n); - swaps (&size->visualGroup, n); } size++; - } - } - data32 = (CARD32 *) size; - /* - * Next comes the visual groups - */ - for (i = 0; i < pScrPriv->nVisualGroups; i++) - { - pVisualGroup = &pScrPriv->pVisualGroups[i]; - if (pVisualGroup->referenced) - { - *data32++ = pVisualGroup->nvisuals; - for (j = 0; j < pVisualGroup->nvisuals; j++) - *data32++ = pVisualGroup->visuals[j]->vid; - } - } - if (client->swapped) - SwapLongs (data32 - nVisualGroupElements, nVisualGroupElements); - /* - * Next comes the groups of visual groups - */ - data16 = (CARD16 *) data32; - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - { - pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[i]; - if (pGroupsOfVisualGroups->referenced) - { - *data16++ = (CARD16) pGroupsOfVisualGroups->ngroups; - for (j = 0; j < pGroupsOfVisualGroups->ngroups; j++) + if (has_rate) { - pVisualGroup = &pScrPriv->pVisualGroups[pGroupsOfVisualGroups->groups[j]]; - *data16++ = (CARD16) pVisualGroup->id; + *rates = pSize->nRatesInUse; + if (client->swapped) + { + swaps (rates, n); + } + rates++; + for (j = 0; j < pSize->nRates; j++) + { + RRScreenRatePtr pRate = &pSize->pRates[j]; + if (pRate->referenced) + { + *rates = pRate->rate; + if (client->swapped) + { + swaps (rates, n); + } + rates++; + } + } } } } - - if (client->swapped) - SwapShorts ((CARD16 *) data32, data16 - (CARD16 *) data32); - - if ((CARD8 *) data16 - (CARD8 *) extra != extraLen) + data8 = (CARD8 *) rates; + + if (data8 - (CARD8 *) extra != extraLen) FatalError ("RRGetScreenInfo bad extra len %d != %d\n", - (CARD8 *) data16 - (CARD8 *) extra, extraLen); - rep.length = extraLen >> 2; + data8 - (CARD8 *) extra, extraLen); + rep.length = (extraLen + 3) >> 2; } if (client->swapped) { swaps(&rep.sequenceNumber, n); @@ -691,14 +655,14 @@ swapl(&rep.timestamp, n); swaps(&rep.rotation, n); swaps(&rep.nSizes, n); - swaps(&rep.nVisualGroups, n); swaps(&rep.sizeID, n); - swaps(&rep.visualGroupID, n); + swaps(&rep.rate, n); + swaps(&rep.nrateEnts, n); } WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *)&rep); if (extraLen) { - WriteToClient (client, extraLen, extra); + WriteToClient (client, extraLen, (char *) extra); xfree (extra); } return (client->noClientException); @@ -716,15 +680,25 @@ TimeStamp configTime; TimeStamp time; RRScreenSizePtr pSize; - RRVisualGroupPtr pVisualGroup; - RRGroupOfVisualGroupPtr pGroupsOfVisualGroups; int i; Rotation rotation; + int rate; short oldWidth, oldHeight; + Bool has_rate; UpdateCurrentTime (); - REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); + if (RRClientKnowsRates (client)) + { + REQUEST_SIZE_MATCH (xRRSetScreenConfigReq); + has_rate = TRUE; + } + else + { + REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq); + has_rate = FALSE; + } + SECURITY_VERIFY_DRAWABLE(pDraw, stuff->drawable, client, SecurityWriteAccess); @@ -761,11 +735,14 @@ /* * Search for the requested size */ + pSize = 0; for (i = 0; i < pScrPriv->nSizes; i++) { pSize = &pScrPriv->pSizes[i]; if (pSize->referenced && pSize->id == stuff->sizeID) + { break; + } } if (i == pScrPriv->nSizes) { @@ -777,45 +754,12 @@ } /* - * Search for the requested visual group - */ - for (i = 0; i < pScrPriv->nVisualGroups; i++) - { - pVisualGroup = &pScrPriv->pVisualGroups[i]; - if (pVisualGroup->referenced && pVisualGroup->id == stuff->visualGroupID) - break; - } - if (i == pScrPriv->nVisualGroups) - { - /* - * Invalid group ID - */ - client->errorValue = stuff->visualGroupID; - return BadValue; - } - - /* - * Make sure visualgroup is supported by size - */ - pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[pSize->groupOfVisualGroups]; - for (i = 0; i < pGroupsOfVisualGroups->ngroups; i++) - { - if (pGroupsOfVisualGroups->groups[i] == pVisualGroup - pScrPriv->pVisualGroups) - break; - } - if (i == pGroupsOfVisualGroups->ngroups) - { - /* - * requested group not supported by requested size - */ - return BadMatch; - } - - /* * Validate requested rotation */ rotation = (Rotation) stuff->rotation; - switch (rotation) { + + /* test the rotation bits only! */ + switch (rotation & 0xf) { case RR_Rotate_0: case RR_Rotate_90: case RR_Rotate_180: @@ -828,13 +772,41 @@ client->errorValue = stuff->rotation; return BadValue; } - if (!(pScrPriv->rotations & rotation)) + + if ((~pScrPriv->rotations) & rotation) { /* - * requested rotation not supported by screen + * requested rotation or reflection not supported by screen */ + client->errorValue = stuff->rotation; return BadMatch; } + + /* + * Validate requested refresh + */ + if (has_rate) + rate = (int) stuff->rate; + else + rate = 0; + + if (rate) + { + for (i = 0; i < pSize->nRates; i++) + { + RRScreenRatePtr pRate = &pSize->pRates[i]; + if (pRate->referenced && pRate->rate == rate) + break; + } + if (i == pSize->nRates) + { + /* + * Invalid rate + */ + client->errorValue = rate; + return BadValue; + } + } /* * Make sure the requested set-time is not older than @@ -849,8 +821,8 @@ /* * call out to ddx routine to effect the change */ - if (!(*pScrPriv->rrSetConfig) (pScreen, rotation, - pSize, pVisualGroup)) + if (!(*pScrPriv->rrSetConfig) (pScreen, rotation, rate, + pSize)) { /* * unknown DDX failure, report to client @@ -862,7 +834,7 @@ /* * set current extension configuration pointers */ - RRSetCurrentConfig (pScreen, rotation, pSize, pVisualGroup); + RRSetCurrentConfig (pScreen, rotation, rate, pSize); /* * Deliver ScreenChangeNotify events whenever @@ -899,7 +871,7 @@ rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds; rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id; - + if (client->swapped) { swaps(&rep.sequenceNumber, n); @@ -914,70 +886,88 @@ } static int -ProcRRScreenChangeSelectInput (ClientPtr client) +ProcRRSelectInput (ClientPtr client) { - REQUEST(xRRScreenChangeSelectInputReq); + REQUEST(xRRSelectInputReq); + rrClientPriv(client); + RRTimesPtr pTimes; WindowPtr pWin; RREventPtr pRREvent, pNewRREvent, *pHead; XID clientResource; - REQUEST_SIZE_MATCH(xRRScreenChangeSelectInputReq); + REQUEST_SIZE_MATCH(xRRSelectInputReq); pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess); if (!pWin) return BadWindow; pHead = (RREventPtr *)SecurityLookupIDByType(client, - pWin->drawable.id, EventType, SecurityWriteAccess); - switch (stuff->enable) { - case xTrue: - if (pHead) { + pWin->drawable.id, EventType, + SecurityWriteAccess); + + if (stuff->enable & (RRScreenChangeNotifyMask)) + { + ScreenPtr pScreen = pWin->drawable.pScreen; + rrScrPriv (pScreen); + if (pHead) + { /* check for existing entry. */ - for (pRREvent = *pHead; - pRREvent; - pRREvent = pRREvent->next) - { + for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) if (pRREvent->client == client) return Success; - } } /* build the entry */ - pNewRREvent = (RREventPtr) - xalloc (sizeof (RREventRec)); - if (!pNewRREvent) + pNewRREvent = (RREventPtr) xalloc (sizeof (RREventRec)); + if (!pNewRREvent) return BadAlloc; - pNewRREvent->next = 0; - pNewRREvent->client = client; - pNewRREvent->window = pWin; - /* - * add a resource that will be deleted when - * the client goes away - */ - clientResource = FakeClientID (client->index); - pNewRREvent->clientResource = clientResource; - if (!AddResource (clientResource, ClientType, (pointer)pNewRREvent)) + pNewRREvent->next = 0; + pNewRREvent->client = client; + pNewRREvent->window = pWin; + pNewRREvent->mask = stuff->enable; + /* + * add a resource that will be deleted when + * the client goes away + */ + clientResource = FakeClientID (client->index); + pNewRREvent->clientResource = clientResource; + if (!AddResource (clientResource, ClientType, (pointer)pNewRREvent)) return BadAlloc; - /* - * create a resource to contain a pointer to the list - * of clients selecting input. This must be indirect as - * the list may be arbitrarily rearranged which cannot be - * done through the resource database. - */ - if (!pHead) - { + /* + * create a resource to contain a pointer to the list + * of clients selecting input. This must be indirect as + * the list may be arbitrarily rearranged which cannot be + * done through the resource database. + */ + if (!pHead) + { pHead = (RREventPtr *) xalloc (sizeof (RREventPtr)); if (!pHead || - !AddResource (pWin->drawable.id, EventType, (pointer)pHead)) + !AddResource (pWin->drawable.id, EventType, (pointer)pHead)) { - FreeResource (clientResource, RT_NONE); - return BadAlloc; + FreeResource (clientResource, RT_NONE); + return BadAlloc; } *pHead = 0; - } - pNewRREvent->next = *pHead; - *pHead = pNewRREvent; - break; - case xFalse: + } + pNewRREvent->next = *pHead; + *pHead = pNewRREvent; + /* + * Now see if the client needs an event + */ + if (pScrPriv) + { + pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; + if (CompareTimeStamps (pTimes->setTime, + pScrPriv->lastSetTime) != 0 || + CompareTimeStamps (pTimes->configTime, + pScrPriv->lastConfigTime) != 0) + { + TellChanged (pWin, (pointer) pScreen); + } + } + } + else if (stuff->enable == xFalse) + { /* delete the interest */ if (pHead) { pNewRREvent = 0; @@ -995,14 +985,16 @@ xfree (pRREvent); } } - break; - default: + } + else + { client->errorValue = stuff->enable; return BadValue; } return Success; } + static int ProcRRDispatch (ClientPtr client) { @@ -1011,12 +1003,12 @@ { case X_RRQueryVersion: return ProcRRQueryVersion(client); - case X_RRGetScreenInfo: - return ProcRRGetScreenInfo(client); case X_RRSetScreenConfig: return ProcRRSetScreenConfig(client); - case X_RRScreenChangeSelectInput: - return ProcRRScreenChangeSelectInput(client); + case X_RRSelectInput: + return ProcRRSelectInput(client); + case X_RRGetScreenInfo: + return ProcRRGetScreenInfo(client); default: return BadRequest; } @@ -1051,26 +1043,36 @@ register int n; REQUEST(xRRSetScreenConfigReq); + if (RRClientKnowsRates (client)) + { + REQUEST_SIZE_MATCH (xRRSetScreenConfigReq); + swaps (&stuff->rate, n); + } + else + { + REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq); + } + swaps(&stuff->length, n); swapl(&stuff->drawable, n); swapl(&stuff->timestamp, n); swaps(&stuff->sizeID, n); - swaps(&stuff->visualGroupID, n); swaps(&stuff->rotation, n); return ProcRRSetScreenConfig(client); } static int -SProcRRScreenChangeSelectInput (ClientPtr client) +SProcRRSelectInput (ClientPtr client) { register int n; - REQUEST(xRRScreenChangeSelectInputReq); + REQUEST(xRRSelectInputReq); swaps(&stuff->length, n); swapl(&stuff->window, n); - return ProcRRScreenChangeSelectInput(client); + return ProcRRSelectInput(client); } + static int SProcRRDispatch (ClientPtr client) { @@ -1079,252 +1081,19 @@ { case X_RRQueryVersion: return SProcRRQueryVersion(client); - case X_RRGetScreenInfo: - return SProcRRGetScreenInfo(client); case X_RRSetScreenConfig: return SProcRRSetScreenConfig(client); - case X_RRScreenChangeSelectInput: - return SProcRRScreenChangeSelectInput(client); + case X_RRSelectInput: + return SProcRRSelectInput(client); + case X_RRGetScreenInfo: + return SProcRRGetScreenInfo(client); default: return BadRequest; } } -/* - * Utility functions for creating the group of possible - * configurations - */ -RRVisualGroupPtr -RRCreateVisualGroup (ScreenPtr pScreen) -{ - RRVisualGroupPtr pVisualGroup; - - pVisualGroup = (RRVisualGroupPtr) xalloc (sizeof (RRVisualGroup)); - pVisualGroup->nvisuals = 0; - pVisualGroup->visuals = 0; - pVisualGroup->referenced = TRUE; - pVisualGroup->oldReferenced = FALSE; - return pVisualGroup; -} - -void -RRDestroyVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup) -{ -#ifdef RR_VALIDATE - int i; - rrScrPriv(pScreen); - - for (i = 0; i < pScrPriv->nVisualGroups; i++) - if (pVisualGroup == &pScrPriv->pVisualGroups[i]) - FatalError ("Freeing registered visual group"); -#endif - xfree (pVisualGroup->visuals); - xfree (pVisualGroup); -} - -Bool -RRAddVisualToVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup, - VisualPtr pVisual) -{ - VisualPtr *new; - - new = xrealloc (pVisualGroup->visuals, - (pVisualGroup->nvisuals + 1) * sizeof (VisualPtr)); - if (!new) - return FALSE; - (pVisualGroup->visuals = new)[pVisualGroup->nvisuals++] = pVisual; - return TRUE; -} - -Bool -RRAddDepthToVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup, - DepthPtr pDepth) -{ - int i; - int v; - - for (i = 0; i < pDepth->numVids; i++) - for (v = 0; v < pScreen->numVisuals; v++) - if (pScreen->visuals[v].vid == pDepth->vids[i]) - if (!RRAddVisualToVisualGroup (pScreen, pVisualGroup, - &pScreen->visuals[v])) - return FALSE; - return TRUE; -} - -/* - * Return true if a and b reference the same group of visuals - */ - static Bool -RRVisualGroupMatches (RRVisualGroupPtr a, - RRVisualGroupPtr b) -{ - int ai, bi; - - if (a->nvisuals != b->nvisuals) - return FALSE; - for (ai = 0; ai < a->nvisuals; ai++) - { - for (bi = 0; bi < b->nvisuals; bi++) - if (a->visuals[ai] == b->visuals[bi]) - break; - if (bi == b->nvisuals) - return FALSE; - } - return TRUE; -} - -RRVisualGroupPtr -RRRegisterVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup) -{ - rrScrPriv (pScreen); - int i; - RRVisualGroupPtr pNew; - - if (!pScrPriv) - { - RRDestroyVisualGroup (pScreen, pVisualGroup); - return 0; - } - for (i = 0; i < pScrPriv->nVisualGroups; i++) - if (RRVisualGroupMatches (pVisualGroup, - &pScrPriv->pVisualGroups[i])) - { - RRDestroyVisualGroup (pScreen, pVisualGroup); - pScrPriv->pVisualGroups[i].referenced = TRUE; - return &pScrPriv->pVisualGroups[i]; - } - pNew = xrealloc (pScrPriv->pVisualGroups, - (pScrPriv->nVisualGroups + 1) * sizeof (RRVisualGroup)); - if (!pNew) - { - RRDestroyVisualGroup (pScreen, pVisualGroup); - return 0; - } - pNew[pScrPriv->nVisualGroups++] = *pVisualGroup; - xfree (pVisualGroup); - pScrPriv->pVisualGroups = pNew; - return &pNew[pScrPriv->nVisualGroups-1]; -} - -RRGroupOfVisualGroupPtr -RRCreateGroupOfVisualGroup (ScreenPtr pScreen) -{ - RRGroupOfVisualGroupPtr pGroupOfVisualGroup; - - pGroupOfVisualGroup = (RRGroupOfVisualGroupPtr) xalloc (sizeof (RRGroupOfVisualGroup)); - pGroupOfVisualGroup->ngroups = 0; - pGroupOfVisualGroup->groups = 0; - pGroupOfVisualGroup->referenced = TRUE; - pGroupOfVisualGroup->oldReferenced = FALSE; - return pGroupOfVisualGroup; -} - -void -RRDestroyGroupOfVisualGroup (ScreenPtr pScreen, - RRGroupOfVisualGroupPtr pGroupOfVisualGroup) -{ -#ifdef RR_VALIDATE - int i; - rrScrPriv(pScreen); - - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - if (pGroupOfVisualGroup == &pScrPriv->pGroupsOfVisualGroups[i]) - FatalError ("Freeing registered visual group"); -#endif - xfree (pGroupOfVisualGroup->groups); - xfree (pGroupOfVisualGroup); -} - -Bool -RRAddVisualGroupToGroupOfVisualGroup (ScreenPtr pScreen, - RRGroupOfVisualGroupPtr pGroupOfVisualGroup, - RRVisualGroupPtr pVisualGroup) -{ - rrScrPriv(pScreen); - int *new; - -#ifdef RR_VALIDATE - int i; - for (i = 0; i < pScrPriv->nVisualGroups; i++) - if (pVisualGroup == &pScrPriv->pVisualGroups[i]) - break; - - if (i == pScrPriv->nVisualGroups) - FatalError ("Adding unregistered visual group"); -#endif - new = (int*) xrealloc (pGroupOfVisualGroup->groups, - (pGroupOfVisualGroup->ngroups + 1) * sizeof (int *)); - if (!new) - return FALSE; - (pGroupOfVisualGroup->groups = new)[pGroupOfVisualGroup->ngroups++] = pVisualGroup - pScrPriv->pVisualGroups; - return TRUE; -} - -/* - * Return true if a and b reference the same group of groups - */ - -static Bool -RRGroupOfVisualGroupMatches (RRGroupOfVisualGroupPtr a, - RRGroupOfVisualGroupPtr b) -{ - int ai, bi; - - if (a->ngroups != b->ngroups) - return FALSE; - for (ai = 0; ai < a->ngroups; ai++) - { - for (bi = 0; bi < b->ngroups; bi++) - if (a->groups[ai] == b->groups[bi]) - break; - if (bi == b->ngroups) - return FALSE; - } - return TRUE; -} - -RRGroupOfVisualGroupPtr -RRRegisterGroupOfVisualGroup (ScreenPtr pScreen, - RRGroupOfVisualGroupPtr pGroupOfVisualGroup) -{ - rrScrPriv (pScreen); - int i; - RRGroupOfVisualGroupPtr pNew; - - if (!pScrPriv) - { - RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - return 0; - } - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - if (RRGroupOfVisualGroupMatches (pGroupOfVisualGroup, - &pScrPriv->pGroupsOfVisualGroups[i])) - { - RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - pScrPriv->pGroupsOfVisualGroups[i].referenced = TRUE; - return &pScrPriv->pGroupsOfVisualGroups[i]; - } - pNew = xrealloc (pScrPriv->pGroupsOfVisualGroups, - (pScrPriv->nGroupsOfVisualGroups + 1) * sizeof (RRGroupOfVisualGroup)); - if (!pNew) - { - RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - return 0; - } - pNew[pScrPriv->nGroupsOfVisualGroups++] = *pGroupOfVisualGroup; - xfree (pGroupOfVisualGroup); - pScrPriv->pGroupsOfVisualGroups = pNew; - return &pNew[pScrPriv->nGroupsOfVisualGroups-1]; -} - -static Bool RRScreenSizeMatches (RRScreenSizePtr a, RRScreenSizePtr b) { @@ -1336,8 +1105,6 @@ return FALSE; if (a->mmHeight != b->mmHeight) return FALSE; - if (a->groupOfVisualGroups != b->groupOfVisualGroups) - return FALSE; return TRUE; } @@ -1346,31 +1113,23 @@ short width, short height, short mmWidth, - short mmHeight, - RRGroupOfVisualGroup *pGroupsOfVisualGroups) + short mmHeight) { rrScrPriv (pScreen); int i; - RRScreenSize tmp; - RRScreenSizePtr pNew; + RRScreenSize tmp; + RRScreenSizePtr pNew; if (!pScrPriv) return 0; -#ifdef RR_VALIDATE - for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) - if (pGroupsOfVisualGroups == &pScrPriv->pGroupsOfVisualGroups[i]) - break; - - if (i == pScrPriv->nGroupsOfVisualGroups) - FatalError ("Adding unregistered group of visual groups"); -#endif - tmp.width = width; tmp.height= height; tmp.mmWidth = mmWidth; tmp.mmHeight = mmHeight; - tmp.groupOfVisualGroups = pGroupsOfVisualGroups - pScrPriv->pGroupsOfVisualGroups; + tmp.pRates = 0; + tmp.nRates = 0; + tmp.nRatesInUse = 0; tmp.referenced = TRUE; tmp.oldReferenced = FALSE; for (i = 0; i < pScrPriv->nSizes; i++) @@ -1388,11 +1147,44 @@ return &pNew[pScrPriv->nSizes-1]; } +Bool RRRegisterRate (ScreenPtr pScreen, + RRScreenSizePtr pSize, + int rate) +{ + rrScrPriv(pScreen); + int i; + RRScreenRatePtr pNew, pRate; + + if (!pScrPriv) + return FALSE; + + for (i = 0; i < pSize->nRates; i++) + { + pRate = &pSize->pRates[i]; + if (pRate->rate == rate) + { + pRate->referenced = TRUE; + return TRUE; + } + } + + pNew = xrealloc (pSize->pRates, + (pSize->nRates + 1) * sizeof (RRScreenRate)); + if (!pNew) + return FALSE; + pRate = &pNew[pSize->nRates++]; + pRate->rate = rate; + pRate->referenced = TRUE; + pRate->oldReferenced = FALSE; + pSize->pRates = pNew; + return TRUE; +} + void RRSetCurrentConfig (ScreenPtr pScreen, Rotation rotation, - RRScreenSizePtr pSize, - RRVisualGroupPtr pVisualGroup) + int rate, + RRScreenSizePtr pSize) { rrScrPriv (pScreen); @@ -1400,6 +1192,6 @@ return; pScrPriv->rotation = rotation; - pScrPriv->pSize = pSize; - pScrPriv->pVisualGroup = pVisualGroup; + pScrPriv->size = pSize - pScrPriv->pSizes; + pScrPriv->rate = rate; } Index: xc/programs/Xserver/randr/randrstr.h diff -u xc/programs/Xserver/randr/randrstr.h:1.4 xc/programs/Xserver/randr/randrstr.h:1.7 --- xc/programs/Xserver/randr/randrstr.h:1.4 Sun Jun 3 17:52:44 2001 +++ xc/programs/Xserver/randr/randrstr.h Mon Oct 14 14:01:42 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/randr/randrstr.h,v 1.4 2001/06/03 21:52:44 keithp Exp $ + * $XFree86: xc/programs/Xserver/randr/randrstr.h,v 1.7 2002/10/14 18:01:42 keithp Exp $ * * Copyright © 2000 Compaq Computer Corporation * @@ -27,35 +27,27 @@ #include "randr.h" -typedef struct _rrVisualGroup { - int id; - int nvisuals; - VisualPtr *visuals; - Bool referenced; - Bool oldReferenced; -} RRVisualGroup, *RRVisualGroupPtr; - -typedef struct _rrGroupOfVisualGroup { - int id; - int ngroups; - int *groups; - Bool referenced; - Bool oldReferenced; -} RRGroupOfVisualGroup, *RRGroupOfVisualGroupPtr; +typedef struct _rrScreenRate { + int rate; + Bool referenced; + Bool oldReferenced; +} RRScreenRate, *RRScreenRatePtr; typedef struct _rrScreenSize { - int id; - short width, height; - short mmWidth, mmHeight; - int groupOfVisualGroups; - Bool referenced; - Bool oldReferenced; + int id; + short width, height; + short mmWidth, mmHeight; + RRScreenRatePtr pRates; + int nRates; + int nRatesInUse; + Bool referenced; + Bool oldReferenced; } RRScreenSize, *RRScreenSizePtr; typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen, Rotation rotation, - RRScreenSizePtr pSize, - RRVisualGroupPtr pVisualGroup); + int rate, + RRScreenSizePtr pSize); typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen); @@ -72,14 +64,7 @@ * Configuration information */ Rotation rotations; - int swaps; - int nVisualGroups; - int nVisualGroupsInUse; - RRVisualGroupPtr pVisualGroups; - int nGroupsOfVisualGroups; - int nGroupsOfVisualGroupsInUse; - RRGroupOfVisualGroupPtr pGroupsOfVisualGroups; int nSizes; int nSizesInUse; RRScreenSizePtr pSizes; @@ -88,9 +73,8 @@ * Current state */ Rotation rotation; - RRScreenSizePtr pSize; - RRVisualGroupPtr pVisualGroup; - + int size; + int rate; } rrScrPrivRec, *rrScrPrivPtr; extern int rrPrivIndex; @@ -98,52 +82,11 @@ #define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr) #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) #define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p)) - -/* - * First, create the visual groups and register them with the screen - */ -RRVisualGroupPtr -RRCreateVisualGroup (ScreenPtr pScreen); - -void -RRDestroyVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup); - -Bool -RRAddVisualToVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup, - VisualPtr pVisual); - -Bool -RRAddDepthToVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup, - DepthPtr pDepth); - -RRVisualGroupPtr -RRRegisterVisualGroup (ScreenPtr pScreen, - RRVisualGroupPtr pVisualGroup); -/* - * Next, create the group of visual groups and register that with the screen - */ -RRGroupOfVisualGroupPtr -RRCreateGroupOfVisualGroup (ScreenPtr pScreen); - +/* Initialize the extension */ void -RRDestroyGroupOfVisualGroup (ScreenPtr pScreen, - RRGroupOfVisualGroupPtr pGroupOfVisualGroup); - -Bool -RRAddVisualGroupToGroupOfVisualGroup (ScreenPtr pScreen, - RRGroupOfVisualGroupPtr pGroupOfVisualGroup, - RRVisualGroupPtr pVisualGroup); - - -RRGroupOfVisualGroupPtr -RRRegisterGroupOfVisualGroup (ScreenPtr pScreen, - RRGroupOfVisualGroupPtr pGroupOfVisualGroup); +RRExtensionInit (void); - /* * Then, register the specific size with the screen */ @@ -153,8 +96,11 @@ short width, short height, short mmWidth, - short mmHeight, - RRGroupOfVisualGroup *visualgroups); + short mmHeight); + +Bool RRRegisterRate (ScreenPtr pScreen, + RRScreenSizePtr pSize, + int rate); /* * Finally, set the current configuration of the screen @@ -163,17 +109,22 @@ void RRSetCurrentConfig (ScreenPtr pScreen, Rotation rotation, - RRScreenSizePtr pSize, - RRVisualGroupPtr pVisualGroup); + int rate, + RRScreenSizePtr pSize); +Bool RRScreenInit(ScreenPtr pScreen); + Bool miRandRInit (ScreenPtr pScreen); Bool +miRRGetInfo (ScreenPtr pScreen, Rotation *rotations); + +Bool miRRSetConfig (ScreenPtr pScreen, Rotation rotation, - RRScreenSizePtr size, - RRVisualGroupPtr pVisualGroup); + int rate, + RRScreenSizePtr size); Bool miRRGetScreenInfo (ScreenPtr pScreen); Index: xc/programs/Xserver/record/Imakefile diff -u xc/programs/Xserver/record/Imakefile:1.12 xc/programs/Xserver/record/Imakefile:1.13 --- xc/programs/Xserver/record/Imakefile:1.12 Fri Nov 2 18:29:34 2001 +++ xc/programs/Xserver/record/Imakefile Mon Sep 16 21:15:14 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.12 2001/11/02 23:29:34 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.13 2002/09/17 01:15:14 dawes Exp $ #if DoLoadableServer #define IHaveSubdirs @@ -16,7 +16,7 @@ #endif SRCS = record.c set.c OBJS = record.o set.o - INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) + INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext LINTLIBS = ../dix/llib-ldix.ln DEFINES = -DNDEBUG Index: xc/programs/Xserver/record/record.c diff -u xc/programs/Xserver/record/record.c:1.9 xc/programs/Xserver/record/record.c:1.10 --- xc/programs/Xserver/record/record.c:1.9 Fri Dec 14 15:00:37 2001 +++ xc/programs/Xserver/record/record.c Mon Sep 16 21:15:14 2002 @@ -32,7 +32,7 @@ and Jim Haggerty of Metheus. */ -/* $XFree86: xc/programs/Xserver/record/record.c,v 1.9 2001/12/14 20:00:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/record/record.c,v 1.10 2002/09/17 01:15:14 dawes Exp $ */ #define NEED_EVENTS #include "dixstruct.h" @@ -48,6 +48,13 @@ #include "xf86_ansic.h" #endif +#ifdef PANORAMIX +#include "globals.h" +#include "panoramiX.h" +#include "panoramiXsrv.h" +#include "cursor.h" +#endif + static RESTYPE RTContext; /* internal resource type for Record contexts */ static int RecordErrorBase; /* first Record error number */ @@ -870,11 +877,31 @@ { xEvent swappedEvent; xEvent *pEvToRecord = pev; +#ifdef PANORAMIX + xEvent shiftedEvent; + + if (!noPanoramiXExtension && + (pev->u.u.type == MotionNotify || + pev->u.u.type == ButtonPress || + pev->u.u.type == ButtonRelease || + pev->u.u.type == KeyPress || + pev->u.u.type == KeyRelease)) { + int scr = XineramaGetCursorScreen(); + memcpy(&shiftedEvent, pev, sizeof(xEvent)); + shiftedEvent.u.keyButtonPointer.rootX += + panoramiXdataPtr[scr].x - + panoramiXdataPtr[0].x; + shiftedEvent.u.keyButtonPointer.rootY += + panoramiXdataPtr[scr].y - + panoramiXdataPtr[0].y; + pEvToRecord = &shiftedEvent; + } +#endif /* PANORAMIX */ if (pContext->pRecordingClient->swapped) { - (*EventSwapVector[pev->u.u.type & 0177]) - (pev, &swappedEvent); + (*EventSwapVector[pEvToRecord->u.u.type & 0177]) + (pEvToRecord, &swappedEvent); pEvToRecord = &swappedEvent; } Index: xc/programs/Xserver/record/module/Imakefile diff -u xc/programs/Xserver/record/module/Imakefile:1.1 xc/programs/Xserver/record/module/Imakefile:1.2 --- xc/programs/Xserver/record/module/Imakefile:1.1 Wed Apr 5 14:14:03 2000 +++ xc/programs/Xserver/record/module/Imakefile Mon Sep 16 21:15:14 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/record/module/Imakefile,v 1.1 2000/04/05 18:14:03 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/record/module/Imakefile,v 1.2 2002/09/17 01:15:14 dawes Exp $ XCOMM XCOMM XCOMM $XConsortium: Imakefile /main/3 1996/09/28 17:15:43 rws $ @@ -13,7 +13,8 @@ SRCS = record.c set.c $(MSRCS) OBJS = record.o set.o $(MOBJS) - INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) + INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + -I$(SERVERSRC)/Xext LINTLIBS = ../../dix/llib-ldix.ln DEFINES = -DNDEBUG Index: xc/programs/Xserver/render/Imakefile diff -u xc/programs/Xserver/render/Imakefile:1.7 xc/programs/Xserver/render/Imakefile:1.10 --- xc/programs/Xserver/render/Imakefile:1.7 Wed Jul 18 06:15:02 2001 +++ xc/programs/Xserver/render/Imakefile Fri Nov 22 21:38:15 2002 @@ -1,19 +1,27 @@ -XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.7 2001/07/18 10:15:02 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 keithp Exp $ #include <Server.tmpl> - SRCS = glyph.c \ + SRCS = animcur.c \ + filter.c \ + glyph.c \ miglyph.c \ - miindex.c \ + miindex.c \ mipict.c \ mirect.c \ + mitrap.c \ + mitri.c \ picture.c \ render.c - OBJS = glyph.o \ + OBJS = animcur.o \ + filter.o \ + glyph.o \ miglyph.o \ - miindex.o \ + miindex.o \ mipict.o \ mirect.o \ + mitrap.o \ + mitri.o \ picture.o \ render.o Index: xc/programs/Xserver/render/animcur.c diff -u /dev/null xc/programs/Xserver/render/animcur.c:1.5 --- /dev/null Thu Feb 27 12:34:01 2003 +++ xc/programs/Xserver/render/animcur.c Sun Dec 22 10:07:12 2002 @@ -0,0 +1,400 @@ +/* + * $XFree86: xc/programs/Xserver/render/animcur.c,v 1.5 2002/12/22 15:07:12 tsi Exp $ + * + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Animated cursors for X. Not specific to Render in any way, but + * stuck there because Render has the other cool cursor extension. + * Besides, everyone has Render. + * + * Implemented as a simple layer over the core cursor code; it + * creates composite cursors out of a set of static cursors and + * delta times between each image. + */ + +#include "X.h" +#include "Xmd.h" +#include "servermd.h" +#include "scrnintstr.h" +#include "dixstruct.h" +#include "cursorstr.h" +#include "dixfontstr.h" +#include "opaque.h" +#include "picturestr.h" + +typedef struct _AnimCurElt { + CursorPtr pCursor; /* cursor to show */ + CARD32 delay; /* in ms */ +} AnimCurElt; + +typedef struct _AnimCur { + int nelt; /* number of elements in the elts array */ + AnimCurElt *elts; /* actually allocated right after the structure */ +} AnimCurRec, *AnimCurPtr; + +typedef struct _AnimScrPriv { + CursorPtr pCursor; + int elt; + CARD32 time; + + CloseScreenProcPtr CloseScreen; + + ScreenBlockHandlerProcPtr BlockHandler; + + CursorLimitsProcPtr CursorLimits; + DisplayCursorProcPtr DisplayCursor; + SetCursorPositionProcPtr SetCursorPosition; + RealizeCursorProcPtr RealizeCursor; + UnrealizeCursorProcPtr UnrealizeCursor; + RecolorCursorProcPtr RecolorCursor; +} AnimCurScreenRec, *AnimCurScreenPtr; + +typedef struct _AnimCurState { + CursorPtr pCursor; + ScreenPtr pScreen; + int elt; + CARD32 time; +} AnimCurStateRec, *AnimCurStatePtr; + +static AnimCurStateRec animCurState; + +static unsigned char empty[4]; + +static CursorBits animCursorBits = { + empty, empty, 2, 1, 1, 0, 0, 1 +}; + +int AnimCurScreenPrivateIndex = -1; +int AnimCurGeneration; + +#define IsAnimCur(c) ((c)->bits == &animCursorBits) +#define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) +#define GetAnimCurScreen(s) ((AnimCurScreenPtr) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr)) +#define GetAnimCurScreenIfSet(s) ((AnimCurScreenPrivateIndex != -1) ? GetAnimCurScreen(s) : NULL) +#define SetAnimCurScreen(s,p) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr = (pointer) (p)) + +#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) +#define Unwrap(as,s,elt) ((s)->elt = (as)->elt) + +static Bool +AnimCurDisplayCursor (ScreenPtr pScreen, + CursorPtr pCursor); + +static Bool +AnimCurSetCursorPosition (ScreenPtr pScreen, + int x, + int y, + Bool generateEvent); + +static Bool +AnimCurCloseScreen (int index, ScreenPtr pScreen) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + Bool ret; + + Unwrap(as, pScreen, CloseScreen); + + Unwrap(as, pScreen, BlockHandler); + + Unwrap(as, pScreen, CursorLimits); + Unwrap(as, pScreen, DisplayCursor); + Unwrap(as, pScreen, SetCursorPosition); + Unwrap(as, pScreen, RealizeCursor); + Unwrap(as, pScreen, UnrealizeCursor); + Unwrap(as, pScreen, RecolorCursor); + SetAnimCurScreen(pScreen,0); + ret = (*pScreen->CloseScreen) (index, pScreen); + xfree (as); + if (index == 0) + AnimCurScreenPrivateIndex = -1; + return ret; +} + +static void +AnimCurCursorLimits (ScreenPtr pScreen, + CursorPtr pCursor, + BoxPtr pHotBox, + BoxPtr pTopLeftBox) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + + Unwrap (as, pScreen, CursorLimits); + if (IsAnimCur(pCursor)) + { + AnimCurPtr ac = GetAnimCur(pCursor); + + (*pScreen->CursorLimits) (pScreen, ac->elts[0].pCursor, pHotBox, pTopLeftBox); + } + else + { + (*pScreen->CursorLimits) (pScreen, pCursor, pHotBox, pTopLeftBox); + } + Wrap (as, pScreen, CursorLimits, AnimCurCursorLimits); +} + +/* + * This has to be a screen block handler instead of a generic + * block handler so that it is well ordered with respect to the DRI + * block handler responsible for releasing the hardware to DRI clients + */ + +static void +AnimCurScreenBlockHandler (int screenNum, + pointer blockData, + pointer pTimeout, + pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + + if (pScreen == animCurState.pScreen) + { + CARD32 now = GetTimeInMillis (); + + if ((INT32) (now - animCurState.time) >= 0) + { + AnimCurPtr ac = GetAnimCur(animCurState.pCursor); + int elt = (animCurState.elt + 1) % ac->nelt; + DisplayCursorProcPtr DisplayCursor; + + /* + * Not a simple Unwrap/Wrap as this + * isn't called along the DisplayCursor + * wrapper chain. + */ + DisplayCursor = pScreen->DisplayCursor; + pScreen->DisplayCursor = as->DisplayCursor; + (void) (*pScreen->DisplayCursor) (pScreen, ac->elts[elt].pCursor); + as->DisplayCursor = pScreen->DisplayCursor; + pScreen->DisplayCursor = DisplayCursor; + + animCurState.elt = elt; + animCurState.time = now + ac->elts[elt].delay; + } + AdjustWaitForDelay (pTimeout, animCurState.time - now); + } + Unwrap (as, pScreen, BlockHandler); + (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); + Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler); +} + +static Bool +AnimCurDisplayCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + Bool ret; + + Unwrap (as, pScreen, DisplayCursor); + if (IsAnimCur(pCursor)) + { + if (pCursor != animCurState.pCursor) + { + AnimCurPtr ac = GetAnimCur(pCursor); + + ret = (*pScreen->DisplayCursor) (pScreen, ac->elts[0].pCursor); + if (ret) + { + animCurState.elt = 0; + animCurState.time = GetTimeInMillis () + ac->elts[0].delay; + animCurState.pCursor = pCursor; + animCurState.pScreen = pScreen; + } + } + else + ret = TRUE; + } + else + { + animCurState.pCursor = 0; + animCurState.pScreen = 0; + ret = (*pScreen->DisplayCursor) (pScreen, pCursor); + } + Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor); + return ret; +} + +static Bool +AnimCurSetCursorPosition (ScreenPtr pScreen, + int x, + int y, + Bool generateEvent) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + Bool ret; + + Unwrap (as, pScreen, SetCursorPosition); + if (animCurState.pCursor) + animCurState.pScreen = pScreen; + ret = (*pScreen->SetCursorPosition) (pScreen, x, y, generateEvent); + Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); + return ret; +} + +static Bool +AnimCurRealizeCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + Bool ret; + + Unwrap (as, pScreen, RealizeCursor); + if (IsAnimCur(pCursor)) + ret = TRUE; + else + ret = (*pScreen->RealizeCursor) (pScreen, pCursor); + Wrap (as, pScreen, RealizeCursor, AnimCurRealizeCursor); + return ret; +} + +static Bool +AnimCurUnrealizeCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + Bool ret; + + Unwrap (as, pScreen, UnrealizeCursor); + if (IsAnimCur(pCursor)) + { + AnimCurPtr ac = GetAnimCur(pCursor); + int i; + + if (pScreen->myNum == 0) + for (i = 0; i < ac->nelt; i++) + FreeCursor (ac->elts[i].pCursor, 0); + ret = TRUE; + } + else + ret = (*pScreen->UnrealizeCursor) (pScreen, pCursor); + Wrap (as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); + return ret; +} + +static void +AnimCurRecolorCursor (ScreenPtr pScreen, + CursorPtr pCursor, + Bool displayed) +{ + AnimCurScreenPtr as = GetAnimCurScreen(pScreen); + + Unwrap (as, pScreen, RecolorCursor); + if (IsAnimCur(pCursor)) + { + AnimCurPtr ac = GetAnimCur(pCursor); + int i; + + for (i = 0; i < ac->nelt; i++) + (*pScreen->RecolorCursor) (pScreen, ac->elts[i].pCursor, + displayed && + animCurState.elt == i); + } + else + (*pScreen->RecolorCursor) (pScreen, pCursor, displayed); + Wrap (as, pScreen, RecolorCursor, AnimCurRecolorCursor); +} + +Bool +AnimCurInit (ScreenPtr pScreen) +{ + AnimCurScreenPtr as; + + if (AnimCurGeneration != serverGeneration) + { + AnimCurScreenPrivateIndex = AllocateScreenPrivateIndex (); + if (AnimCurScreenPrivateIndex < 0) + return FALSE; + AnimCurGeneration = serverGeneration; + animCurState.pCursor = 0; + animCurState.pScreen = 0; + animCurState.elt = 0; + animCurState.time = 0; + } + as = (AnimCurScreenPtr) xalloc (sizeof (AnimCurScreenRec)); + if (!as) + return FALSE; + Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); + + Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); + + Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); + Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); + Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); + Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor); + Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); + Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor); + SetAnimCurScreen(pScreen,as); + return TRUE; +} + +int +AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor) +{ + CursorPtr pCursor; + int i; + AnimCurPtr ac; + AnimCurElt *ae; + + for (i = 0; i < screenInfo.numScreens; i++) + if (!GetAnimCurScreenIfSet (screenInfo.screens[i])) + return BadImplementation; + + for (i = 0; i < ncursor; i++) + if (IsAnimCur (cursors[i])) + return BadMatch; + + pCursor = (CursorPtr) xalloc (sizeof (CursorRec) + + sizeof (AnimCurRec) + + ncursor * sizeof (AnimCurElt)); + if (!pCursor) + return BadAlloc; + pCursor->bits = &animCursorBits; + animCursorBits.refcnt++; + pCursor->refcnt = 1; + + pCursor->foreRed = cursors[0]->foreRed; + pCursor->foreGreen = cursors[0]->foreGreen; + pCursor->foreBlue = cursors[0]->foreBlue; + + pCursor->backRed = cursors[0]->backRed; + pCursor->backGreen = cursors[0]->backGreen; + pCursor->backBlue = cursors[0]->backBlue; + + /* + * Fill in the AnimCurRec + */ + ac = GetAnimCur (pCursor); + ac->nelt = ncursor; + ac->elts = (AnimCurElt *) (ac + 1); + ae = ac->elts; + + for (i = 0; i < ncursor; i++) + { + cursors[i]->refcnt++; + ac->elts[i].pCursor = cursors[i]; + ac->elts[i].delay = deltas[i]; + } + + *ppCursor = pCursor; + return Success; +} Index: xc/programs/Xserver/render/filter.c diff -u /dev/null xc/programs/Xserver/render/filter.c:1.1 --- /dev/null Thu Feb 27 12:34:01 2003 +++ xc/programs/Xserver/render/filter.c Wed Sep 25 22:56:52 2002 @@ -0,0 +1,263 @@ +/* + * $XFree86: xc/programs/Xserver/render/filter.c,v 1.1 2002/09/26 02:56:52 keithp Exp $ + * + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "misc.h" +#include "scrnintstr.h" +#include "os.h" +#include "regionstr.h" +#include "validate.h" +#include "windowstr.h" +#include "input.h" +#include "resource.h" +#include "colormapst.h" +#include "cursorstr.h" +#include "dixstruct.h" +#include "gcstruct.h" +#include "servermd.h" +#include "picturestr.h" + +static char **filterNames; +static int nfilterNames; + +int +PictureGetFilterId (char *filter, int len, Bool makeit) +{ + int i; + char *name; + char **names; + + if (len < 0) + len = strlen (filter); + for (i = 0; i < nfilterNames; i++) + if (len == strlen (filterNames[i]) && + !strncmp (filterNames[i], filter, len)) + return i; + if (!makeit) + return -1; + name = xalloc (strlen (filter) + 1); + if (!name) + return -1; + strncpy (name, filter, len); + name[len] = '\0'; + if (filterNames) + names = xrealloc (filterNames, (nfilterNames + 1) * sizeof (char *)); + else + names = xalloc (sizeof (char *)); + if (!names) + { + xfree (name); + return -1; + } + filterNames = names; + i = nfilterNames++; + filterNames[i] = name; + return i; +} + +static Bool +PictureSetDefaultIds (void) +{ + /* careful here -- this list must match the #define values */ + + if (PictureGetFilterId (FilterNearest, -1, TRUE) != PictFilterNearest) + return FALSE; + if (PictureGetFilterId (FilterBilinear, -1, TRUE) != PictFilterBilinear) + return FALSE; + + if (PictureGetFilterId (FilterFast, -1, TRUE) != PictFilterFast) + return FALSE; + if (PictureGetFilterId (FilterGood, -1, TRUE) != PictFilterGood) + return FALSE; + if (PictureGetFilterId (FilterBest, -1, TRUE) != PictFilterBest) + return FALSE; + return TRUE; +} + +char * +PictureGetFilterName (int id) +{ + if (0 <= id && id < nfilterNames) + return filterNames[id]; + else + return 0; +} + +static void +PictureFreeFilterIds (void) +{ + int i; + + for (i = 0; i < nfilterNames; i++) + xfree (filterNames[i]); + xfree (filterNames); + nfilterNames = 0; + filterNames = 0; +} + +int +PictureAddFilter (ScreenPtr pScreen, char *filter, xFixed *params, int nparams) +{ + PictureScreenPtr ps = GetPictureScreen(pScreen); + int id = PictureGetFilterId (filter, -1, TRUE); + int i; + PictFilterPtr filters; + + if (id < 0) + return -1; + /* + * It's an error to attempt to reregister a filter + */ + for (i = 0; i < ps->nfilters; i++) + if (ps->filters[i].id == id) + return -1; + if (ps->filters) + filters = xrealloc (ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec)); + else + filters = xalloc (sizeof (PictFilterRec)); + if (!filters) + return -1; + ps->filters = filters; + i = ps->nfilters++; + ps->filters[i].name = PictureGetFilterName (id); + ps->filters[i].params = params; + ps->filters[i].nparams = nparams; + ps->filters[i].id = id; + return id; +} + +Bool +PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias) +{ + PictureScreenPtr ps = GetPictureScreen(pScreen); + int filter_id = PictureGetFilterId (filter, -1, FALSE); + int alias_id = PictureGetFilterId (alias, -1, TRUE); + int i; + + if (filter_id < 0 || alias_id < 0) + return FALSE; + for (i = 0; i < ps->nfilterAliases; i++) + if (ps->filterAliases[i].alias_id == alias_id) + break; + if (i == ps->nfilterAliases) + { + PictFilterAliasPtr aliases; + + if (ps->filterAliases) + aliases = xrealloc (ps->filterAliases, + (ps->nfilterAliases + 1) * + sizeof (PictFilterAliasRec)); + else + aliases = xalloc (sizeof (PictFilterAliasRec)); + if (!aliases) + return FALSE; + ps->filterAliases = aliases; + ps->filterAliases[i].alias = PictureGetFilterName (alias_id); + ps->filterAliases[i].alias_id = alias_id; + ps->nfilterAliases++; + } + ps->filterAliases[i].filter_id = filter_id; + return TRUE; +} + +PictFilterPtr +PictureFindFilter (ScreenPtr pScreen, char *name, int len) +{ + PictureScreenPtr ps = GetPictureScreen(pScreen); + int id = PictureGetFilterId (name, len, FALSE); + int i; + + if (id < 0) + return 0; + /* Check for an alias, allow them to recurse */ + for (i = 0; i < ps->nfilterAliases; i++) + if (ps->filterAliases[i].alias_id == id) + { + id = ps->filterAliases[i].filter_id; + i = 0; + } + /* find the filter */ + for (i = 0; i < ps->nfilters; i++) + if (ps->filters[i].id == id) + return &ps->filters[i]; + return 0; +} + +Bool +PictureSetDefaultFilters (ScreenPtr pScreen) +{ + if (!filterNames) + if (!PictureSetDefaultIds ()) + return FALSE; + if (PictureAddFilter (pScreen, FilterNearest, 0, 0) < 0) + return FALSE; + if (PictureAddFilter (pScreen, FilterBilinear, 0, 0) < 0) + return FALSE; + + if (!PictureSetFilterAlias (pScreen, FilterNearest, FilterFast)) + return FALSE; + if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterGood)) + return FALSE; + if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterBest)) + return FALSE; + return TRUE; +} + +void +PictureResetFilters (ScreenPtr pScreen) +{ + PictureScreenPtr ps = GetPictureScreen(pScreen); + + xfree (ps->filters); + xfree (ps->filterAliases); + PictureFreeFilterIds (); +} + +int +SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + PictFilterPtr pFilter = PictureFindFilter (pScreen, name, len); + xFixed *new_params; + int i; + + if (!pFilter) + return BadName; + if (nparams > pFilter->nparams) + return BadMatch; + if (pFilter->nparams != pPicture->filter_nparams) + { + new_params = xalloc (pFilter->nparams * sizeof (xFixed)); + if (!new_params) + return BadAlloc; + xfree (pPicture->filter_params); + pPicture->filter_params = new_params; + pPicture->filter_nparams = pFilter->nparams; + } + for (i = 0; i < nparams; i++) + pPicture->filter_params[i] = params[i]; + for (; i < pFilter->nparams; i++) + pPicture->filter_params[i] = pFilter->params[i]; + pPicture->filter = pFilter->id; + return Success; +} Index: xc/programs/Xserver/render/miindex.c diff -u xc/programs/Xserver/render/miindex.c:1.4 xc/programs/Xserver/render/miindex.c:1.8 --- xc/programs/Xserver/render/miindex.c:1.4 Tue Jul 31 17:06:56 2001 +++ xc/programs/Xserver/render/miindex.c Wed Nov 6 17:45:36 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/miindex.c,v 1.4 2001/07/31 21:06:56 alanh Exp $ + * $XFree86: xc/programs/Xserver/render/miindex.c,v 1.8 2002/11/06 22:45:36 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -34,71 +34,154 @@ #include "mipict.h" #include "colormapst.h" -Bool -miBuildRenderColormap (ColormapPtr pColormap, - int num, - Pixel *first, - Pixel *last) +#define NUM_CUBE_LEVELS 4 +#define NUM_GRAY_LEVELS 13 + +static Bool +miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump) { - int cube, ramp; int r, g, b; unsigned short red, green, blue; - Pixel pix; + Pixel pixel; + Bool used[MI_MAX_INDEXED]; + int needed; + int policy; + int cube, gray; + int i, n; - cube = 0; - if ((pColormap->pVisual->class | DynamicClass) == PseudoColor) + if (pColormap->mid != pColormap->pScreen->defColormap) + { + policy = PictureCmapPolicyAll; + } + else { - for (cube = 0; cube * cube * cube < num; cube++) - ; - cube--; - } - if (cube == 1) - cube = 0; - ramp = num - (cube * cube * cube); - *first = MI_MAX_INDEXED; - *last = 0; + int avail = pColormap->pVisual->ColormapEntries; + policy = PictureCmapPolicy; + if (policy == PictureCmapPolicyDefault) + { + if (avail >= 256 && (pColormap->pVisual->class|DynamicClass) == PseudoColor) + policy = PictureCmapPolicyColor; + else if (avail >= 64) + policy = PictureCmapPolicyGray; + else + policy = PictureCmapPolicyMono; + } + } + /* + * Make sure enough cells are free for the chosen policy + */ + for (;;) + { + switch (policy) { + case PictureCmapPolicyAll: + needed = 0; + break; + case PictureCmapPolicyColor: + needed = 71; + break; + case PictureCmapPolicyGray: + needed = 11; + break; + case PictureCmapPolicyMono: + default: + needed = 0; + break; + } + if (needed <= pColormap->freeRed) + break; + policy--; + } + + /* + * Compute size of cube and gray ramps + */ + cube = gray = 0; + switch (policy) { + case PictureCmapPolicyAll: + /* + * Allocate as big a cube as possible + */ + if ((pColormap->pVisual->class|DynamicClass) == PseudoColor) + { + for (cube = 1; cube * cube * cube < pColormap->pVisual->ColormapEntries; cube++) + ; + cube--; + if (cube == 1) + cube = 0; + } + else + cube = 0; + /* + * Figure out how many gray levels to use so that they + * line up neatly with the cube + */ + if (cube) + { + needed = pColormap->pVisual->ColormapEntries - (cube*cube*cube); + /* levels to fill in with */ + gray = needed / (cube - 1); + /* total levels */ + gray = (gray + 1) * (cube - 1) + 1; + } + else + gray = pColormap->pVisual->ColormapEntries; + break; + + case PictureCmapPolicyColor: + cube = NUM_CUBE_LEVELS; + /* fall through ... */ + case PictureCmapPolicyGray: + gray = NUM_GRAY_LEVELS; + break; + case PictureCmapPolicyMono: + default: + gray = 2; + break; + } + + memset (used, '\0', pColormap->pVisual->ColormapEntries * sizeof (Bool)); for (r = 0; r < cube; r++) for (g = 0; g < cube; g++) for (b = 0; b < cube; b++) { - red = r * 65535 / (cube - 1); - green = g * 65535 / (cube - 1); - blue = b * 65535 / (cube - 1); - if (AllocColor (pColormap, &red, &green, &blue, &pix, 0) != Success) + red = (r * 65535 + (cube-1)/2) / (cube - 1); + green = (g * 65535 + (cube-1)/2) / (cube - 1); + blue = (b * 65535 + (cube-1)/2) / (cube - 1); + if (AllocColor (pColormap, &red, &green, + &blue, &pixel, 0) != Success) return FALSE; - if (pix < *first) - *first = pix; - if (pix > *last) - *last = pix; + used[pixel] = TRUE; } - for (g = 0; g < ramp; g++) + for (g = 0; g < gray; g++) { - red = - green = - blue = g * 65535 / (ramp - 1); - if (AllocColor (pColormap, &red, &green, &blue, &pix, 0) != Success) + red = green = blue = (g * 65535 + (gray-1)/2) / (gray - 1); + if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success) return FALSE; - if (pix < *first) - *first = pix; - if (pix > *last) - *last = pix; + used[pixel] = TRUE; } + n = 0; + for (i = 0; i < pColormap->pVisual->ColormapEntries; i++) + if (used[i]) + pixels[n++] = i; + *nump = n; + return TRUE; } /* 0 <= red, green, blue < 32 */ static Pixel -FindBestColor (miIndexedPtr pIndexed, int first, int num, +FindBestColor (miIndexedPtr pIndexed, Pixel *pixels, int num, int red, int green, int blue) { - Pixel best = first; + Pixel best = pixels[0]; int bestDist = 1 << 30; int dist; int dr, dg, db; while (num--) { - CARD32 v = pIndexed->rgba[first]; + Pixel pixel = *pixels++; + CARD32 v = pIndexed->rgba[pixel]; dr = ((v >> 19) & 0x1f); dg = ((v >> 11) & 0x1f); @@ -110,18 +193,17 @@ if (dist < bestDist) { bestDist = dist; - best = first; + best = pixel; } - first++; } return best; } /* 0 <= gray < 32768 */ static Pixel -FindBestGray (miIndexedPtr pIndexed, int first, int num, int gray) +FindBestGray (miIndexedPtr pIndexed, Pixel *pixels, int num, int gray) { - Pixel best = first; + Pixel best = pixels[0]; int bestDist = 1 << 30; int dist; int dr; @@ -129,7 +211,8 @@ while (num--) { - CARD32 v = pIndexed->rgba[first]; + Pixel pixel = *pixels++; + CARD32 v = pIndexed->rgba[pixel]; r = v & 0xff; r = r | (r << 8); @@ -138,9 +221,8 @@ if (dist < bestDist) { bestDist = dist; - best = first; + best = pixel; } - first++; } return best; } @@ -149,57 +231,70 @@ miInitIndexed (ScreenPtr pScreen, PictFormatPtr pFormat) { + ColormapPtr pColormap = pFormat->index.pColormap; + VisualPtr pVisual = pColormap->pVisual; miIndexedPtr pIndexed; - int num; - Pixel first, last; - Pixel pix[MI_MAX_INDEXED]; + Pixel pixels[MI_MAX_INDEXED]; xrgb rgb[MI_MAX_INDEXED]; + int num; + int i; Pixel p, r, g, b; - if (pFormat->pVisual->ColormapEntries > MI_MAX_INDEXED) + if (pVisual->ColormapEntries > MI_MAX_INDEXED) return FALSE; + + if (pVisual->class & DynamicClass) + { + if (!miBuildRenderColormap (pColormap, pixels, &num)) + return FALSE; + } + else + { + num = pVisual->ColormapEntries; + for (p = 0; p < num; p++) + pixels[p] = p; + } + pIndexed = xalloc (sizeof (miIndexedRec)); if (!pIndexed) return FALSE; - num = pFormat->pVisual->ColormapEntries; - first = 0; - last = num - 1; - if (pFormat->pVisual->class & DynamicClass) + + pFormat->index.nvalues = num; + pFormat->index.pValues = xalloc (num * sizeof (xIndexValue)); + if (!pFormat->index.pValues) { - if (pFormat->pVisual->vid == pScreen->rootVisual) - { - if (num > 100) - num = num - 10; - else - num = num / 2; - } - if (!miBuildRenderColormap (pFormat->pColormap, num, &first, &last)) - { - xfree (pIndexed); - return FALSE; - } + xfree (pIndexed); + return FALSE; } + + /* * Build mapping from pixel value to ARGB */ - for (p = 0; p < pFormat->pVisual->ColormapEntries; p++) - pix[p] = p; - QueryColors (pFormat->pColormap, pFormat->pVisual->ColormapEntries, - pix, rgb); - for (p = 0; p < pFormat->pVisual->ColormapEntries; p++) + QueryColors (pColormap, num, pixels, rgb); + for (i = 0; i < num; i++) + { + p = pixels[i]; + pFormat->index.pValues[i].pixel = p; + pFormat->index.pValues[i].red = rgb[i].red; + pFormat->index.pValues[i].green = rgb[i].green; + pFormat->index.pValues[i].blue = rgb[i].blue; + pFormat->index.pValues[i].alpha = 0xffff; pIndexed->rgba[p] = (0xff000000 | - ((rgb[p].red & 0xff00) << 8) | - ((rgb[p].green & 0xff00) ) | - ((rgb[p].blue & 0xff00) >> 8)); + ((rgb[i].red & 0xff00) << 8) | + ((rgb[i].green & 0xff00) ) | + ((rgb[i].blue & 0xff00) >> 8)); + } + /* * Build mapping from RGB to pixel value. This could probably be * done a bit quicker... */ - switch (pFormat->pVisual->class | DynamicClass) { + switch (pVisual->class | DynamicClass) { case GrayScale: pIndexed->color = FALSE; for (r = 0; r < 32768; r++) - pIndexed->ent[r] = FindBestGray (pIndexed, first, last-first+1, r); + pIndexed->ent[r] = FindBestGray (pIndexed, pixels, num, r); break; case PseudoColor: pIndexed->color = TRUE; @@ -208,12 +303,13 @@ for (g = 0; g < 32; g++) for (b = 0; b < 32; b++) { - pIndexed->ent[p] = FindBestColor (pIndexed, first, last-first+1, r, g, b); + pIndexed->ent[p] = FindBestColor (pIndexed, pixels, num, + r, g, b); p++; } break; } - pFormat->indexed = pIndexed; + pFormat->index.devPrivate = pIndexed; return TRUE; } @@ -221,10 +317,15 @@ miCloseIndexed (ScreenPtr pScreen, PictFormatPtr pFormat) { - if (pFormat->indexed) + if (pFormat->index.devPrivate) + { + xfree (pFormat->index.devPrivate); + pFormat->index.devPrivate = 0; + } + if (pFormat->index.pValues) { - xfree (pFormat->indexed); - pFormat->indexed = 0; + xfree (pFormat->index.pValues); + pFormat->index.pValues = 0; } } @@ -234,7 +335,7 @@ int ndef, xColorItem *pdef) { - miIndexedPtr pIndexed = pFormat->indexed; + miIndexedPtr pIndexed = pFormat->index.devPrivate; if (pIndexed) { Index: xc/programs/Xserver/render/mipict.c diff -u xc/programs/Xserver/render/mipict.c:1.10 xc/programs/Xserver/render/mipict.c:1.14 --- xc/programs/Xserver/render/mipict.c:1.10 Thu Jul 19 00:42:10 2001 +++ xc/programs/Xserver/render/mipict.c Wed Nov 6 17:45:36 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.10 2001/07/19 04:42:10 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.14 2002/11/06 22:45:36 keithp Exp $ * * Copyright © 1999 Keith Packard * @@ -268,8 +268,8 @@ pRbox->y1 = BOUND(v); if (pRbox->y2 > (v = pCbox->y2 + dy)) pRbox->y2 = BOUND(v); - if (pRbox->x1 > pRbox->x2 || - pRbox->y1 > pRbox->y2) + if (pRbox->x1 >= pRbox->x2 || + pRbox->y1 >= pRbox->y2) { REGION_EMPTY(pScreen, pRegion); } @@ -290,6 +290,9 @@ int dx, int dy) { + /* XXX what to do with clipping from transformed pictures? */ + if (pPicture->transform) + return TRUE; if (pPicture->repeat) { if (pPicture->clientClipType != CT_NONE) @@ -338,6 +341,13 @@ v = yDst + height; pRegion->extents.y2 = BOUND(v); pRegion->data = 0; + /* Check for empty operation */ + if (pRegion->extents.x1 >= pRegion->extents.x2 || + pRegion->extents.y1 >= pRegion->extents.y2) + { + REGION_EMPTY (pDst->pDrawable->pScreen, pRegion); + return TRUE; + } /* clip against src */ if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { @@ -412,7 +422,7 @@ *pixel = r|g|b|a; break; case PictTypeIndexed: - pIndexed = (miIndexedPtr) (format->indexed); + pIndexed = (miIndexedPtr) (format->index.devPrivate); if (pIndexed->color) { r = color->red >> 11; @@ -462,7 +472,7 @@ color->alpha = miFillColor (r, Ones (format->direct.alphaMask)); break; case PictTypeIndexed: - pIndexed = (miIndexedPtr) (format->indexed); + pIndexed = (miIndexedPtr) (format->index.devPrivate); pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)]; r = (pixel >> 16) & 0xff; g = (pixel >> 8) & 0xff; @@ -492,5 +502,15 @@ ps->InitIndexed = miInitIndexed; ps->CloseIndexed = miCloseIndexed; ps->UpdateIndexed = miUpdateIndexed; + + /* MI rendering routines */ + ps->Composite = 0; /* requires DDX support */ + ps->Glyphs = miGlyphs; + ps->CompositeRects = miCompositeRects; + ps->Trapezoids = miTrapezoids; + ps->Triangles = miTriangles; + ps->TriStrip = miTriStrip; + ps->TriFan = miTriFan; + return TRUE; } Index: xc/programs/Xserver/render/mipict.h diff -u xc/programs/Xserver/render/mipict.h:1.8 xc/programs/Xserver/render/mipict.h:1.13 --- xc/programs/Xserver/render/mipict.h:1.8 Thu Jul 19 00:42:10 2001 +++ xc/programs/Xserver/render/mipict.h Wed Nov 6 17:45:36 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.8 2001/07/19 04:42:10 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.13 2002/11/06 22:45:36 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -46,22 +46,7 @@ #define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15]) #define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24)) -/* - * Standard NTSC luminance conversions: - * - * y = r * 0.299 + g * 0.587 + b * 0.114 - * - * Approximate this for a bit more speed: - * - * y = (r * 153 + g * 301 + b * 58) / 512 - * - * This gives 17 bits of luminance; to get 15 bits, lop the low two - */ - -#define miCvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \ - (((s) >> 8) & 0xff) * 301 + \ - (((s) ) & 0xff) * 58) >> 2) -#define miIndexToEntY24(mif,rgb24) ((mif)->ent[miCvtR8G8B8toY15(rgb24)]) +#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)]) int miCreatePicture (PicturePtr pPicture); @@ -145,6 +130,68 @@ xRenderColor *color, int nRect, xRectangle *rects); + +void +miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box); + +void +miTrapezoids (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntrap, + xTrapezoid *traps); + +void +miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds); + +void +miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds); + +void +miRasterizeTriangle (PicturePtr pMask, + xTriangle *tri, + int x_off, + int y_off); + +void +miTriangles (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntri, + xTriangle *tris); + +void +miTriStrip (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoint, + xPointFixed *points); + +void +miTriFan (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoint, + xPointFixed *points); + +PicturePtr +miCreateAlphaPicture (ScreenPtr pScreen, + PicturePtr pDst, + PictFormatPtr pPictFormat, + CARD16 width, + CARD16 height); Bool miInitIndexed (ScreenPtr pScreen, Index: xc/programs/Xserver/render/mitrap.c diff -u /dev/null xc/programs/Xserver/render/mitrap.c:1.9 --- /dev/null Thu Feb 27 12:34:01 2003 +++ xc/programs/Xserver/render/mitrap.c Tue Nov 5 18:39:16 2002 @@ -0,0 +1,196 @@ +/* + * $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.9 2002/11/05 23:39:16 keithp Exp $ + * + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "scrnintstr.h" +#include "gcstruct.h" +#include "pixmapstr.h" +#include "windowstr.h" +#include "servermd.h" +#include "mi.h" +#include "picturestr.h" +#include "mipict.h" + +PicturePtr +miCreateAlphaPicture (ScreenPtr pScreen, + PicturePtr pDst, + PictFormatPtr pPictFormat, + CARD16 width, + CARD16 height) +{ + PixmapPtr pPixmap; + PicturePtr pPicture; + GCPtr pGC; + int error; + xRectangle rect; + + if (width > 32767 || height > 32767) + return 0; + + if (!pPictFormat) + { + if (pDst->polyEdge == PolyEdgeSharp) + pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1); + else + pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8); + if (!pPictFormat) + return 0; + } + + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, + pPictFormat->depth); + if (!pPixmap) + return 0; + pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); + if (!pGC) + { + (*pScreen->DestroyPixmap) (pPixmap); + return 0; + } + ValidateGC (&pPixmap->drawable, pGC); + rect.x = 0; + rect.y = 0; + rect.width = width; + rect.height = height; + (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect); + FreeScratchGC (pGC); + pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat, + 0, 0, serverClient, &error); + (*pScreen->DestroyPixmap) (pPixmap); + return pPicture; +} + +static xFixed +miLineFixedX (xLineFixed *l, xFixed y, Bool ceil) +{ + xFixed dx = l->p2.x - l->p1.x; + xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; + xFixed dy = l->p2.y - l->p1.y; + if (ceil) + ex += (dy - 1); + return l->p1.x + (xFixed) (ex / dy); +} + +void +miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box) +{ + box->y1 = MAXSHORT; + box->y2 = MINSHORT; + box->x1 = MAXSHORT; + box->x2 = MINSHORT; + for (; ntrap; ntrap--, traps++) + { + INT16 x1, y1, x2, y2; + + if (!xTrapezoidValid(traps)) + continue; + y1 = xFixedToInt (traps->top); + if (y1 < box->y1) + box->y1 = y1; + + y2 = xFixedToInt (xFixedCeil (traps->bottom)); + if (y2 > box->y2) + box->y2 = y2; + + x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE), + miLineFixedX (&traps->left, traps->bottom, FALSE))); + if (x1 < box->x1) + box->x1 = x1; + + x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE), + miLineFixedX (&traps->right, traps->bottom, TRUE)))); + if (x2 > box->x2) + box->x2 = x2; + } +} + +void +miTrapezoids (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntrap, + xTrapezoid *traps) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + PicturePtr pPicture = 0; + BoxRec bounds; + INT16 xDst, yDst; + INT16 xRel, yRel; + + xDst = traps[0].left.p1.x >> 16; + yDst = traps[0].left.p1.y >> 16; + + if (maskFormat) + { + miTrapezoidBounds (ntrap, traps, &bounds); + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) + return; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + return; + } + for (; ntrap; ntrap--, traps++) + { + if (!xTrapezoidValid(traps)) + continue; + if (!maskFormat) + { + miTrapezoidBounds (1, traps, &bounds); + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) + continue; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + continue; + } + (*ps->RasterizeTrapezoid) (pPicture, traps, + -bounds.x1, -bounds.y1); + if (!maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } + } + if (maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } +} Index: xc/programs/Xserver/render/mitri.c diff -u /dev/null xc/programs/Xserver/render/mitri.c:1.6 --- /dev/null Thu Feb 27 12:34:01 2003 +++ xc/programs/Xserver/render/mitri.c Mon Aug 12 00:03:21 2002 @@ -0,0 +1,352 @@ +/* + * $XFree86: xc/programs/Xserver/render/mitri.c,v 1.6 2002/08/12 04:03:21 keithp Exp $ + * + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "scrnintstr.h" +#include "gcstruct.h" +#include "pixmapstr.h" +#include "windowstr.h" +#include "mi.h" +#include "picturestr.h" +#include "mipict.h" + +void +miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds) +{ + bounds->x1 = xFixedToInt (points->x); + bounds->x2 = xFixedToInt (xFixedCeil (points->x)); + bounds->y1 = xFixedToInt (points->y); + bounds->y2 = xFixedToInt (xFixedCeil (points->y)); + points++; + npoint--; + while (npoint-- > 0) + { + INT16 x1 = xFixedToInt (points->x); + INT16 x2 = xFixedToInt (xFixedCeil (points->x)); + INT16 y1 = xFixedToInt (points->y); + INT16 y2 = xFixedToInt (xFixedCeil (points->y)); + + if (x1 < bounds->x1) + bounds->x1 = x1; + else if (x2 > bounds->x2) + bounds->x2 = x2; + if (y1 < bounds->y1) + bounds->y1 = y1; + else if (y2 > bounds->y2) + bounds->y2 = y2; + points++; + } +} + +void +miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds) +{ + miPointFixedBounds (ntri * 3, (xPointFixed *) tris, bounds); +} + +void +miRasterizeTriangle (PicturePtr pPicture, + xTriangle *tri, + int x_off, + int y_off) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + xPointFixed *top, *left, *right, *t; + xTrapezoid trap[2]; + + top = &tri->p1; + left = &tri->p2; + right = &tri->p3; + if (left->y < top->y) { + t = left; left = top; top = t; + } + if (right->y < top->y) { + t = right; right = top; top = t; + } + if (right->x < left->x) { + t = right; right = left; left = t; + } + + /* + * Two cases: + * + * + + + * / \ / \ + * / \ / \ + * / + + \ + * / -- -- \ + * / -- -- \ + * / --- --- \ + * +-- --+ + */ + + trap[0].top = top->y; + + trap[0].left.p1.x = top->x; + trap[0].left.p1.y = trap[0].top; + trap[0].left.p2.x = left->x; + trap[0].left.p2.y = left->y; + + trap[0].right.p1 = trap[0].left.p1; + trap[0].right.p2.x = right->x; + trap[0].right.p2.y = right->y; + + if (right->y < left->y) + { + trap[0].bottom = trap[0].right.p2.y; + + trap[1].top = trap[0].bottom; + trap[1].bottom = trap[0].left.p2.y; + + trap[1].left = trap[0].left; + trap[1].right.p1 = trap[0].right.p2; + trap[1].right.p2 = trap[0].left.p2; + } + else + { + trap[0].bottom = trap[0].left.p2.y; + + trap[1].top = trap[0].bottom; + trap[1].bottom = trap[0].right.p2.y; + + trap[1].right = trap[0].right; + trap[1].left.p1 = trap[0].left.p2; + trap[1].left.p2 = trap[0].right.p2; + } + if (trap[0].top != trap[0].bottom) + (*ps->RasterizeTrapezoid) (pPicture, &trap[0], x_off, y_off); + if (trap[1].top != trap[1].bottom) + (*ps->RasterizeTrapezoid) (pPicture, &trap[1], x_off, y_off); +} + +void +miTriangles (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntri, + xTriangle *tris) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + BoxRec bounds; + PicturePtr pPicture = 0; + INT16 xDst, yDst; + INT16 xRel, yRel; + + xDst = tris[0].p1.x >> 16; + yDst = tris[0].p1.y >> 16; + + if (maskFormat) + { + miTriangleBounds (ntri, tris, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + return; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + return; + } + for (; ntri; ntri--, tris++) + { + if (!maskFormat) + { + miTriangleBounds (1, tris, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + continue; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + break; + } + miRasterizeTriangle (pPicture, tris, -bounds.x1, -bounds.y1); + if (!maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } + /* XXX adjust xSrc and ySrc */ + } + if (maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } +} + +void +miTriStrip (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoint, + xPointFixed *points) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + xTriangle tri; + BoxRec bounds; + PicturePtr pPicture = 0; + INT16 xDst, yDst; + INT16 xRel, yRel; + + xDst = points[0].x >> 16; + yDst = points[0].y >> 16; + + if (npoint < 3) + return; + if (maskFormat) + { + miPointFixedBounds (npoint, points, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + return; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + return; + } + for (; npoint >= 3; npoint--, points++) + { + tri.p1 = points[0]; + tri.p2 = points[1]; + tri.p3 = points[2]; + if (!maskFormat) + { + miTriangleBounds (1, &tri, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + continue; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + continue; + } + miRasterizeTriangle (pPicture, &tri, -bounds.x1, -bounds.y1); + if (!maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } + } + if (maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } +} + +void +miTriFan (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoint, + xPointFixed *points) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + xTriangle tri; + BoxRec bounds; + PicturePtr pPicture = 0; + xPointFixed *first; + INT16 xDst, yDst; + INT16 xRel, yRel; + + xDst = points[0].x >> 16; + yDst = points[0].y >> 16; + + if (npoint < 3) + return; + if (maskFormat) + { + miPointFixedBounds (npoint, points, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + return; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + return; + } + first = points++; + npoint--; + for (; npoint >= 2; npoint--, points++) + { + tri.p1 = *first; + tri.p2 = points[0]; + tri.p3 = points[1]; + if (!maskFormat) + { + miTriangleBounds (1, &tri, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + continue; + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!pPicture) + continue; + } + miRasterizeTriangle (pPicture, &tri, -bounds.x1, -bounds.y1); + if (!maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } + } + if (maskFormat) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + CompositePicture (op, pSrc, pPicture, pDst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + FreePicture (pPicture, 0); + } +} Index: xc/programs/Xserver/render/picture.c diff -u xc/programs/Xserver/render/picture.c:1.20 xc/programs/Xserver/render/picture.c:1.30 --- xc/programs/Xserver/render/picture.c:1.20 Wed Dec 12 23:35:41 2001 +++ xc/programs/Xserver/render/picture.c Sun Jan 26 11:40:43 2003 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.c,v 1.20 2001/12/13 04:35:41 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.c,v 1.30 2003/01/26 16:40:43 eich Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -44,6 +44,7 @@ RESTYPE PictureType; RESTYPE PictFormatType; RESTYPE GlyphSetType; +int PictureCmapPolicy = PictureCmapPolicyDefault; Bool PictureDestroyWindow (WindowPtr pWindow) @@ -56,7 +57,8 @@ while ((pPicture = GetPictureWindow(pWindow))) { SetPictureWindow(pWindow, pPicture->pNext); - FreeResource (pPicture->id, PictureType); + if (pPicture->id) + FreeResource (pPicture->id, PictureType); FreePicture ((pointer) pPicture, pPicture->id); } pScreen->DestroyWindow = ps->DestroyWindow; @@ -75,6 +77,7 @@ pScreen->CloseScreen = ps->CloseScreen; ret = (*pScreen->CloseScreen) (index, pScreen); + PictureResetFilters (pScreen); for (n = 0; n < ps->nformats; n++) if (ps->formats[n].type == PictTypeIndexed) (*ps->CloseIndexed) (pScreen, &ps->formats[n]); @@ -102,7 +105,8 @@ while (nformats--) { - if (format->pColormap == pColormap) + if (format->type == PictTypeIndexed && + format->index.pColormap == pColormap) { (*ps->UpdateIndexed) (pScreen, format, ndef, pdef); break; @@ -225,12 +229,12 @@ break; case StaticColor: case PseudoColor: - format = PICT_FORMAT (bpp, PICT_TYPE_COLOR, v, 0, 0, 0); + format = PICT_VISFORMAT (bpp, PICT_TYPE_COLOR, v); nformats = addFormat (formats, nformats, format, depth); break; case StaticGray: case GrayScale: - format = PICT_FORMAT (bpp, PICT_TYPE_GRAY, v, 0, 0, 0); + format = PICT_VISFORMAT (bpp, PICT_TYPE_GRAY, v); nformats = addFormat (formats, nformats, format, depth); break; } @@ -245,6 +249,14 @@ format = 0; switch (bpp) { case 16: + /* depth 12 formats */ + if (pDepth->depth >= 12) + { + nformats = addFormat (formats, nformats, + PICT_x4r4g4b4, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x4b4g4r4, pDepth->depth); + } /* depth 15 formats */ if (pDepth->depth >= 15) { @@ -264,6 +276,10 @@ PICT_r5g6b5, pDepth->depth); nformats = addFormat (formats, nformats, PICT_b5g6r5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_a4r4g4b4, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_a4b4g4r4, pDepth->depth); } break; case 24: @@ -351,10 +367,7 @@ case PICT_TYPE_COLOR: case PICT_TYPE_GRAY: pFormats[f].type = PictTypeIndexed; - pFormats[f].format = PICT_FORMAT(PICT_FORMAT_BPP(format), - PICT_FORMAT_TYPE(format), - 0, 0, 0, 0); - pFormats[f].pVisual = &pScreen->visuals[PICT_FORMAT_A(format)]; + pFormats[f].index.pVisual = &pScreen->visuals[PICT_FORMAT_VIS(format)]; break; } } @@ -375,16 +388,16 @@ nformat = ps->nformats; while (nformat--) { - if (format->type == PictTypeIndexed && !format->pColormap) + if (format->type == PictTypeIndexed && !format->index.pColormap) { - if (format->pVisual->vid == pScreen->rootVisual) - format->pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap, - RT_COLORMAP); + if (format->index.pVisual->vid == pScreen->rootVisual) + format->index.pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap, + RT_COLORMAP); else { if (CreateColormap (FakeClientID (0), pScreen, - format->pVisual, - &format->pColormap, AllocNone, + format->index.pVisual, + &format->index.pColormap, AllocNone, 0) != Success) { return FALSE; @@ -404,11 +417,37 @@ int s; for (s = 0; s < screenInfo.numScreens; s++) + { if (!PictureInitIndexedFormats (screenInfo.screens[s])) return FALSE; + (void) AnimCurInit (screenInfo.screens[s]); + } + + return TRUE; +} + +Bool +PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) +{ + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); + + if (!ps) + return FALSE; + ps->subpixel = subpixel; return TRUE; + } +int +PictureGetSubpixelOrder (ScreenPtr pScreen) +{ + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); + + if (!ps) + return SubPixelUnknown; + return ps->subpixel; +} + PictFormatPtr PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) { @@ -441,7 +480,7 @@ { if (type == PictTypeIndexed) { - if (format->pVisual == pVisual) + if (format->index.pVisual == pVisual) return format; } else @@ -482,6 +521,23 @@ return 0; } +int +PictureParseCmapPolicy (const char *name) +{ + if ( strcmp (name, "default" ) == 0) + return PictureCmapPolicyDefault; + else if ( strcmp (name, "mono" ) == 0) + return PictureCmapPolicyMono; + else if ( strcmp (name, "gray" ) == 0) + return PictureCmapPolicyGray; + else if ( strcmp (name, "color" ) == 0) + return PictureCmapPolicyColor; + else if ( strcmp (name, "all" ) == 0) + return PictureCmapPolicyAll; + else + return PictureCmapPolicyInvalid; +} + Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { @@ -505,6 +561,11 @@ return FALSE; PictureWindowPrivateIndex = AllocateWindowPrivateIndex(); PictureGeneration = serverGeneration; +#ifdef XResExtension + RegisterResourceName (PictureType, "PICTURE"); + RegisterResourceName (PictFormatType, "PICTFORMAT"); + RegisterResourceName (GlyphSetType, "GLYPHSET"); +#endif } if (!AllocateWindowPrivate (pScreen, PictureWindowPrivateIndex, 0)) return FALSE; @@ -524,7 +585,7 @@ } if (formats[n].type == PictTypeIndexed) { - if ((formats[n].pVisual->class | DynamicClass) == PseudoColor) + if ((formats[n].index.pVisual->class | DynamicClass) == PseudoColor) type = PICT_TYPE_COLOR; else type = PICT_TYPE_GRAY; @@ -570,6 +631,13 @@ ps->fallback = formats; ps->nformats = nformats; + ps->filters = 0; + ps->nfilters = 0; + ps->filterAliases = 0; + ps->nfilterAliases = 0; + + ps->subpixel = SubPixelUnknown; + ps->CloseScreen = pScreen->CloseScreen; ps->DestroyWindow = pScreen->DestroyWindow; ps->StoreColors = pScreen->StoreColors; @@ -577,6 +645,15 @@ pScreen->CloseScreen = PictureCloseScreen; pScreen->StoreColors = PictureStoreColors; + if (!PictureSetDefaultFilters (pScreen)) + { + PictureResetFilters (pScreen); + SetPictureScreen(pScreen, 0); + xfree (formats); + xfree (ps); + return FALSE; + } + return TRUE; } @@ -601,7 +678,13 @@ pPicture->clipOrigin.y = 0; pPicture->clientClip = 0; + pPicture->transform = 0; + pPicture->dither = None; + pPicture->filter = PictureGetFilterId (FilterNearest, -1, TRUE); + pPicture->filter_params = 0; + pPicture->filter_nparams = 0; + pPicture->serialNumber = GC_CHANGE_SERIAL_BIT; pPicture->stateChanges = (1 << (CPLastBit+1)) - 1; } @@ -943,6 +1026,40 @@ return result; } +int +SetPictureTransform (PicturePtr pPicture, + PictTransform *transform) +{ + static const PictTransform identity = { { + { xFixed1, 0x00000, 0x00000 }, + { 0x00000, xFixed1, 0x00000 }, + { 0x00000, 0x00000, xFixed1 }, + } }; + + if (transform && memcmp (transform, &identity, sizeof (PictTransform)) == 0) + transform = 0; + + if (transform) + { + if (!pPicture->transform) + { + pPicture->transform = (PictTransform *) xalloc (sizeof (PictTransform)); + if (!pPicture->transform) + return BadAlloc; + } + *pPicture->transform = *transform; + } + else + { + if (pPicture->transform) + { + xfree (pPicture->transform); + pPicture->transform = 0; + } + } + return Success; +} + static void ValidateOnePicture (PicturePtr pPicture) { @@ -978,6 +1095,9 @@ if (pPicture->alphaMap) FreePicture ((pointer) pPicture->alphaMap, (XID) 0); (*ps->DestroyPicture) (pPicture); + (*ps->DestroyPictureClip) (pPicture); + if (pPicture->transform) + xfree (pPicture->transform); if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; @@ -1073,4 +1193,113 @@ ValidatePicture (pDst); (*ps->CompositeRects) (op, pDst, color, nRect, rects); +} + +void +CompositeTrapezoids (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntrap, + xTrapezoid *traps) +{ + PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); + + ValidatePicture (pSrc); + ValidatePicture (pDst); + (*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps); +} + +void +CompositeTriangles (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntriangles, + xTriangle *triangles) +{ + PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); + + ValidatePicture (pSrc); + ValidatePicture (pDst); + (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles, triangles); +} + +void +CompositeTriStrip (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoints, + xPointFixed *points) +{ + PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); + + ValidatePicture (pSrc); + ValidatePicture (pDst); + (*ps->TriStrip) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points); +} + +void +CompositeTriFan (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoints, + xPointFixed *points) +{ + PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); + + ValidatePicture (pSrc); + ValidatePicture (pDst); + (*ps->TriFan) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points); +} + +typedef xFixed_32_32 xFixed_48_16; + +#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff) +#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31)) + +Bool +PictureTransformPoint (PictTransformPtr transform, + PictVectorPtr vector) +{ + PictVector result; + int i, j; + xFixed_32_32 partial; + xFixed_48_16 v; + + for (j = 0; j < 3; j++) + { + v = 0; + for (i = 0; i < 3; i++) + { + partial = ((xFixed_48_16) transform->matrix[j][i] * + (xFixed_48_16) vector->vector[i]); + v += partial >> 16; + } + if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) + return FALSE; + result.vector[j] = (xFixed) v; + } + if (!result.vector[2]) + return FALSE; + for (j = 0; j < 2; j++) + { + partial = (xFixed_48_16) result.vector[j] << 16; + v = partial / result.vector[2]; + if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) + return FALSE; + vector->vector[j] = (xFixed) v; + } + vector->vector[2] = xFixed1; + return TRUE; } Index: xc/programs/Xserver/render/picture.h diff -u xc/programs/Xserver/render/picture.h:1.7 xc/programs/Xserver/render/picture.h:1.18 --- xc/programs/Xserver/render/picture.h:1.7 Fri Aug 10 18:25:59 2001 +++ xc/programs/Xserver/render/picture.h Wed Nov 6 17:45:36 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.h,v 1.7 2001/08/10 22:25:59 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.h,v 1.18 2002/11/06 22:45:36 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -42,6 +42,13 @@ ((g) << 4) | \ ((b))) +/* + * gray/color formats use a visual index instead of argb + */ +#define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | \ + ((type) << 16) | \ + ((vi))) + #define PICT_FORMAT_BPP(f) (((f) >> 24) ) #define PICT_FORMAT_TYPE(f) (((f) >> 16) & 0xff) #define PICT_FORMAT_A(f) (((f) >> 12) & 0x0f) @@ -49,6 +56,7 @@ #define PICT_FORMAT_G(f) (((f) >> 4) & 0x0f) #define PICT_FORMAT_B(f) (((f) ) & 0x0f) #define PICT_FORMAT_RGB(f) (((f) ) & 0xfff) +#define PICT_FORMAT_VIS(f) (((f) ) & 0xffff) #define PICT_TYPE_OTHER 0 #define PICT_TYPE_A 1 @@ -77,6 +85,10 @@ #define PICT_x1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5) #define PICT_a1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5) #define PICT_x1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5) +#define PICT_a4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4) +#define PICT_x4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4) +#define PICT_a4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4) +#define PICT_x4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4) /* 8bpp formats */ #define PICT_a8 PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0) @@ -102,13 +114,115 @@ #define PICT_a1 PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0) #define PICT_g1 PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0) + +/* + * For dynamic indexed visuals (GrayScale and PseudoColor), these control the + * selection of colors allocated for drawing to Pictures. The default + * policy depends on the size of the colormap: + * + * Size Default Policy + * ---------------------------- + * < 64 PolicyMono + * < 256 PolicyGray + * 256 PolicyColor (only on PseudoColor) + * + * The actual allocation code lives in miindex.c, and so is + * austensibly server dependent, but that code does: + * + * PolicyMono Allocate no additional colors, use black and white + * PolicyGray Allocate 13 gray levels (11 cells used) + * PolicyColor Allocate a 4x4x4 cube and 13 gray levels (71 cells used) + * PolicyAll Allocate as big a cube as possible, fill with gray (all) + * + * Here's a picture to help understand how many colors are + * actually allocated (this is just the gray ramp): + * + * gray level + * all 0000 1555 2aaa 4000 5555 6aaa 8000 9555 aaaa bfff d555 eaaa ffff + * b/w 0000 ffff + * 4x4x4 5555 aaaa + * extra 1555 2aaa 4000 6aaa 8000 9555 bfff d555 eaaa + * + * The default colormap supplies two gray levels (black/white), the + * 4x4x4 cube allocates another two and nine more are allocated to fill + * in the 13 levels. When the 4x4x4 cube is not allocated, a total of + * 11 cells are allocated. + */ + +#define PictureCmapPolicyInvalid -1 +#define PictureCmapPolicyDefault 0 +#define PictureCmapPolicyMono 1 +#define PictureCmapPolicyGray 2 +#define PictureCmapPolicyColor 3 +#define PictureCmapPolicyAll 4 + +extern int PictureCmapPolicy; + +int PictureParseCmapPolicy (const char *name); + +/* Fixed point updates from Carl Worth, USC, Information Sciences Institute */ + +#ifdef WIN32 +typedef __int64 xFixed_32_32; +#else +# if defined(__alpha__) || defined(__alpha) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__sparc64__) || \ + defined(__s390x__) || \ + defined(x86_64) || defined (__x86_64__) +typedef long xFixed_32_32; +# else +# if defined(__GNUC__) && \ + ((__GNUC__ > 2) || \ + ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 7))) +__extension__ +# endif +typedef long long int xFixed_32_32; +# endif +#endif + +typedef CARD32 xFixed_1_31; +typedef CARD32 xFixed_1_16; +typedef INT32 xFixed_16_16; + +/* + * An unadorned "xFixed" is the same as xFixed_16_16, + * (since it's quite common in the code) + */ +typedef xFixed_16_16 xFixed; +#define XFIXED_BITS 16 + +#define xFixedToInt(f) (int) ((f) >> XFIXED_BITS) +#define IntToxFixed(i) ((xFixed) (i) << XFIXED_BITS) +#define xFixedE ((xFixed) 1) +#define xFixed1 (IntToxFixed(1)) +#define xFixed1MinusE (xFixed1 - xFixedE) +#define xFixedFrac(f) ((f) & xFixed1MinusE) +#define xFixedFloor(f) ((f) & ~xFixed1MinusE) +#define xFixedCeil(f) xFixedFloor((f) + xFixed1MinusE) + +#define xFixedFraction(f) ((f) & xFixed1MinusE) +#define xFixedMod2(f) ((f) & (xFixed1 | xFixed1MinusE)) + +/* whether 't' is a well defined not obviously empty trapezoid */ +#define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \ + (t)->right.p1.y != (t)->right.p2.y && \ + (int) ((t)->bottom - (t)->top) > 0) + +/* + * Standard NTSC luminance conversions: + * + * y = r * 0.299 + g * 0.587 + b * 0.114 + * + * Approximate this for a bit more speed: + * + * y = (r * 153 + g * 301 + b * 58) / 512 + * + * This gives 17 bits of luminance; to get 15 bits, lop the low two + */ -#define FixedToInt(f) (int) ((f) >> 8) -#define IntToFixed(i) ((Fixed) (i) << 8) -#define FixedE ((Fixed) 1) -#define Fixed1 (IntToFixed(1)) -#define Fixed1minusE (Fixed1 - FixedE) -#define FixedCeil(f) (((f) + Fixed1minusE) & ~Fixed1MinusE) -#define FixedFloor(f) ((f) & ~Fixed1MinusE) +#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \ + (((s) >> 8) & 0xff) * 301 + \ + (((s) ) & 0xff) * 58) >> 2) #endif /* _PICTURE_H_ */ Index: xc/programs/Xserver/render/picturestr.h diff -u xc/programs/Xserver/render/picturestr.h:1.16 xc/programs/Xserver/render/picturestr.h:1.22 --- xc/programs/Xserver/render/picturestr.h:1.16 Tue Jul 31 20:45:00 2001 +++ xc/programs/Xserver/render/picturestr.h Fri Nov 22 21:38:15 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.16 2001/08/01 00:45:00 tsi Exp $ + * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.22 2002/11/23 02:38:15 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -37,17 +37,31 @@ CARD16 alpha, alphaMask; } DirectFormatRec; +typedef struct _IndexFormat { + VisualPtr pVisual; + ColormapPtr pColormap; + int nvalues; + xIndexValue *pValues; + void *devPrivate; +} IndexFormatRec; + typedef struct _PictFormat { CARD32 id; CARD32 format; /* except bpp */ unsigned char type; unsigned char depth; DirectFormatRec direct; - void *indexed; /* opaque indexed conversion data */ - VisualPtr pVisual; /* for indexed formats */ - ColormapPtr pColormap; + IndexFormatRec index; } PictFormatRec; +typedef struct _PictVector { + xFixed vector[3]; +} PictVector, *PictVectorPtr; + +typedef struct _PictTransform { + xFixed matrix[3][3]; +} PictTransform, *PictTransformPtr; + typedef struct _Picture { DrawablePtr pDrawable; PictFormatPtr pFormat; @@ -80,8 +94,34 @@ RegionPtr pCompositeClip; DevUnion *devPrivates; + + PictTransform *transform; + + int filter; + xFixed *filter_params; + int filter_nparams; } PictureRec; +typedef struct { + char *name; + xFixed *params; + int nparams; + int id; +} PictFilterRec, *PictFilterPtr; + +#define PictFilterNearest 0 +#define PictFilterBilinear 1 + +#define PictFilterFast 2 +#define PictFilterGood 3 +#define PictFilterBest 4 + +typedef struct { + char *alias; + int alias_id; + int filter_id; +} PictFilterAliasRec, *PictFilterAliasPtr; + typedef int (*CreatePictureProcPtr) (PicturePtr pPicture); typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture, @@ -90,6 +130,16 @@ int n); typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture); +typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture, + PictTransform *transform); + +typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture, + int filter, + xFixed *params, + int nparams); + +typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture); + typedef void (*ChangePictureProcPtr) (PicturePtr pPicture, Mask mask); typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture, @@ -123,6 +173,47 @@ int nRect, xRectangle *rects); +typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask, + xTrapezoid *trap, + int x_off, + int y_off); + +typedef void (*TrapezoidsProcPtr) (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntrap, + xTrapezoid *traps); + +typedef void (*TrianglesProcPtr) (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntri, + xTriangle *tris); + +typedef void (*TriStripProcPtr) (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoint, + xPointFixed *points); + +typedef void (*TriFanProcPtr) (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoint, + xPointFixed *points); + typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat); @@ -164,6 +255,23 @@ CloseIndexedProcPtr CloseIndexed; UpdateIndexedProcPtr UpdateIndexed; + int subpixel; + + PictFilterPtr filters; + int nfilters; + PictFilterAliasPtr filterAliases; + int nfilterAliases; + + ChangePictureTransformProcPtr ChangePictureTransform; + ChangePictureFilterProcPtr ChangePictureFilter; + DestroyPictureFilterProcPtr DestroyPictureFilter; + + TrapezoidsProcPtr Trapezoids; + TrianglesProcPtr Triangles; + TriStripProcPtr TriStrip; + TriFanProcPtr TriFan; + + RasterizeTrapezoidProcPtr RasterizeTrapezoid; } PictureScreenRec, *PictureScreenPtr; extern int PictureScreenPrivateIndex; @@ -200,6 +308,18 @@ Bool PictureCloseScreen (int Index, ScreenPtr pScreen); +void +PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef); + +Bool +PictureInitIndexedFormats (ScreenPtr pScreen); + +Bool +PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel); + +int +PictureGetSubpixelOrder (ScreenPtr pScreen); + PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp); @@ -212,7 +332,31 @@ Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); +int +PictureGetFilterId (char *filter, int len, Bool makeit); + +char * +PictureGetFilterName (int id); + +int +PictureAddFilter (ScreenPtr pScreen, char *filter, xFixed *params, int nparams); + Bool +PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias); + +Bool +PictureSetDefaultFilters (ScreenPtr pScreen); + +void +PictureResetFilters (ScreenPtr pScreen); + +PictFilterPtr +PictureFindFilter (ScreenPtr pScreen, char *name, int len); + +int +SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams); + +Bool PictureFinishInit (void); void @@ -250,6 +394,10 @@ int nRect, xRectangle *rects); +int +SetPictureTransform (PicturePtr pPicture, + PictTransform *transform); + void ValidatePicture(PicturePtr pPicture); @@ -293,7 +441,57 @@ int nRect, xRectangle *rects); +void +CompositeTrapezoids (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntrap, + xTrapezoid *traps); + +void +CompositeTriangles (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int ntriangles, + xTriangle *triangles); + +void +CompositeTriStrip (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoints, + xPointFixed *points); + +void +CompositeTriFan (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int npoints, + xPointFixed *points); + +Bool +PictureTransformPoint (PictTransformPtr transform, + PictVectorPtr vector); + void RenderExtensionInit (void); + +Bool +AnimCurInit (ScreenPtr pScreen); + +int +AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor); #ifdef PANORAMIX void PanoramiXRenderInit (void); Index: xc/programs/Xserver/render/render.c diff -u xc/programs/Xserver/render/render.c:1.13 xc/programs/Xserver/render/render.c:1.26 --- xc/programs/Xserver/render/render.c:1.13 Wed Dec 12 23:35:41 2001 +++ xc/programs/Xserver/render/render.c Fri Feb 14 13:15:21 2003 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/render.c,v 1.13 2001/12/13 04:35:41 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/render.c,v 1.26 2003/02/14 18:15:21 dawes Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -42,6 +42,7 @@ #include "picturestr.h" #include "glyphstr.h" #include "Xfuncproto.h" +#include "cursorstr.h" #ifdef EXTMODULE #include "xf86_ansic.h" #endif @@ -71,6 +72,11 @@ static int ProcRenderFreeGlyphs (ClientPtr pClient); static int ProcRenderCompositeGlyphs (ClientPtr pClient); static int ProcRenderFillRectangles (ClientPtr pClient); +static int ProcRenderCreateCursor (ClientPtr pClient); +static int ProcRenderSetPictureTransform (ClientPtr pClient); +static int ProcRenderQueryFilters (ClientPtr pClient); +static int ProcRenderSetPictureFilter (ClientPtr pClient); +static int ProcRenderCreateAnimCursor (ClientPtr pClient); static int ProcRenderDispatch (ClientPtr pClient); @@ -99,12 +105,15 @@ static int SProcRenderFreeGlyphs (ClientPtr pClient); static int SProcRenderCompositeGlyphs (ClientPtr pClient); static int SProcRenderFillRectangles (ClientPtr pClient); +static int SProcRenderCreateCursor (ClientPtr pClient); +static int SProcRenderSetPictureTransform (ClientPtr pClient); +static int SProcRenderQueryFilters (ClientPtr pClient); +static int SProcRenderSetPictureFilter (ClientPtr pClient); +static int SProcRenderCreateAnimCursor (ClientPtr pClient); static int SProcRenderDispatch (ClientPtr pClient); -#define RenderNumRequests (X_RenderFillRectangles+1) - -int (*ProcRenderVector[RenderNumRequests])(ClientPtr) = { +int (*ProcRenderVector[RenderNumberRequests])(ClientPtr) = { ProcRenderQueryVersion, ProcRenderQueryPictFormats, ProcRenderQueryPictIndexValues, @@ -132,9 +141,14 @@ ProcRenderCompositeGlyphs, ProcRenderCompositeGlyphs, ProcRenderFillRectangles, + ProcRenderCreateCursor, + ProcRenderSetPictureTransform, + ProcRenderQueryFilters, + ProcRenderSetPictureFilter, + ProcRenderCreateAnimCursor, }; -int (*SProcRenderVector[RenderNumRequests])(ClientPtr) = { +int (*SProcRenderVector[RenderNumberRequests])(ClientPtr) = { SProcRenderQueryVersion, SProcRenderQueryPictFormats, SProcRenderQueryPictIndexValues, @@ -162,6 +176,11 @@ SProcRenderCompositeGlyphs, SProcRenderCompositeGlyphs, SProcRenderFillRectangles, + SProcRenderCreateCursor, + SProcRenderSetPictureTransform, + SProcRenderQueryFilters, + SProcRenderSetPictureFilter, + SProcRenderCreateAnimCursor, }; static void @@ -169,6 +188,27 @@ static CARD8 RenderReqCode; int RenderErrBase; +int RenderClientPrivateIndex; + +typedef struct _RenderClient { + int major_version; + int minor_version; +} RenderClientRec, *RenderClientPtr; + +#define GetRenderClient(pClient) ((RenderClientPtr) (pClient)->devPrivates[RenderClientPrivateIndex].ptr) + +static void +RenderClientCallback (CallbackListPtr *list, + pointer closure, + pointer data) +{ + NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; + ClientPtr pClient = clientinfo->client; + RenderClientPtr pRenderClient = GetRenderClient (pClient); + + pRenderClient->major_version = 0; + pRenderClient->minor_version = 0; +} void RenderExtensionInit (void) @@ -179,13 +219,20 @@ return; if (!PictureFinishInit ()) return; + RenderClientPrivateIndex = AllocateClientPrivateIndex (); + if (!AllocateClientPrivate (RenderClientPrivateIndex, + sizeof (RenderClientRec))) + return; + if (!AddCallback (&ClientStateCallback, RenderClientCallback, 0)) + return; + extEntry = AddExtension (RENDER_NAME, 0, RenderNumberErrors, ProcRenderDispatch, SProcRenderDispatch, RenderResetProc, StandardMinorOpcode); if (!extEntry) return; RenderReqCode = (CARD8) extEntry->base; - RenderErrBase = extEntry->errorBase; + RenderErrBase = extEntry->errorBase; } static void @@ -196,9 +243,13 @@ static int ProcRenderQueryVersion (ClientPtr client) { + RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryVersionReply rep; register int n; -/* REQUEST(xRenderQueryVersionReq); */ + REQUEST(xRenderQueryVersionReq); + + pRenderClient->major_version = stuff->majorVersion; + pRenderClient->minor_version = stuff->minorVersion; REQUEST_SIZE_MATCH(xRenderQueryVersionReq); rep.type = X_Reply; @@ -256,11 +307,13 @@ static int ProcRenderQueryPictFormats (ClientPtr client) { + RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryPictFormatsReply *reply; xPictScreen *pictScreen; xPictDepth *pictDepth; xPictVisual *pictVisual; xPictFormInfo *pictForm; + CARD32 *pictSubpixel; ScreenPtr pScreen; VisualPtr pVisual; DepthPtr pDepth; @@ -274,6 +327,7 @@ int s; int n; int numScreens; + int numSubpixel; /* REQUEST(xRenderQueryPictFormatsReq); */ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); @@ -306,11 +360,17 @@ if (ps) nformat += ps->nformats; } + if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6) + numSubpixel = 0; + else + numSubpixel = numScreens; + rlength = (sizeof (xRenderQueryPictFormatsReply) + nformat * sizeof (xPictFormInfo) + numScreens * sizeof (xPictScreen) + ndepth * sizeof (xPictDepth) + - nvisual * sizeof (xPictVisual)); + nvisual * sizeof (xPictVisual) + + numSubpixel * sizeof (CARD32)); reply = (xRenderQueryPictFormatsReply *) xalloc (rlength); if (!reply) return BadAlloc; @@ -321,6 +381,7 @@ reply->numScreens = numScreens; reply->numDepths = ndepth; reply->numVisuals = nvisual; + reply->numSubpixel = numSubpixel; pictForm = (xPictFormInfo *) (reply + 1); @@ -345,8 +406,8 @@ pictForm->direct.blueMask = pFormat->direct.blueMask; pictForm->direct.alpha = pFormat->direct.alpha; pictForm->direct.alphaMask = pFormat->direct.alphaMask; - if (pFormat->pColormap) - pictForm->colormap = pFormat->pColormap->mid; + if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) + pictForm->colormap = pFormat->index.pColormap->mid; else pictForm->colormap = None; if (client->swapped) @@ -419,6 +480,23 @@ } pictScreen = (xPictScreen *) pictDepth; } + pictSubpixel = (CARD32 *) pictScreen; + + for (s = 0; s < numSubpixel; s++) + { + pScreen = screenInfo.screens[s]; + ps = GetPictureScreenIfSet(pScreen); + if (ps) + *pictSubpixel = ps->subpixel; + else + *pictSubpixel = SubPixelUnknown; + if (client->swapped) + { + swapl (pictSubpixel, n); + } + ++pictSubpixel; + } + if (client->swapped) { swaps (&reply->sequenceNumber, n); @@ -427,6 +505,7 @@ swapl (&reply->numScreens, n); swapl (&reply->numDepths, n); swapl (&reply->numVisuals, n); + swapl (&reply->numSubpixel, n); } WriteToClient(client, rlength, (char *) reply); xfree (reply); @@ -436,7 +515,65 @@ static int ProcRenderQueryPictIndexValues (ClientPtr client) { - return BadImplementation; + PictFormatPtr pFormat; + int num; + int rlength; + int i, n; + REQUEST(xRenderQueryPictIndexValuesReq); + xRenderQueryPictIndexValuesReply *reply; + xIndexValue *values; + + REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); + + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, + stuff->format, + PictFormatType, + SecurityReadAccess); + + if (!pFormat) + { + client->errorValue = stuff->format; + return RenderErrBase + BadPictFormat; + } + if (pFormat->type != PictTypeIndexed) + { + client->errorValue = stuff->format; + return BadMatch; + } + num = pFormat->index.nvalues; + rlength = (sizeof (xRenderQueryPictIndexValuesReply) + + num * sizeof(xIndexValue)); + reply = (xRenderQueryPictIndexValuesReply *) xalloc (rlength); + if (!reply) + return BadAlloc; + + reply->type = X_Reply; + reply->sequenceNumber = client->sequence; + reply->length = (rlength - sizeof(xGenericReply)) >> 2; + reply->numIndexValues = num; + + values = (xIndexValue *) (reply + 1); + + memcpy (reply + 1, pFormat->index.pValues, num * sizeof (xIndexValue)); + + if (client->swapped) + { + for (i = 0; i < num; i++) + { + swapl (&values[i].pixel, n); + swaps (&values[i].red, n); + swaps (&values[i].green, n); + swaps (&values[i].blue, n); + swaps (&values[i].alpha, n); + } + swaps (&reply->sequenceNumber, n); + swapl (&reply->length, n); + swapl (&reply->numIndexValues, n); + } + + WriteToClient(client, rlength, (char *) reply); + xfree(reply); + return (client->noClientException); } static int @@ -563,6 +700,7 @@ PicturePtr pSrc, pMask, pDst; REQUEST(xRenderCompositeReq); + REQUEST_SIZE_MATCH(xRenderCompositeReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; @@ -601,25 +739,181 @@ static int ProcRenderTrapezoids (ClientPtr client) { - return BadImplementation; + int ntraps; + PicturePtr pSrc, pDst; + PictFormatPtr pFormat; + REQUEST(xRenderTrapezoidsReq); + + REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); + if (!PictOpValid (stuff->op)) + { + client->errorValue = stuff->op; + return BadValue; + } + VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + RenderErrBase + BadPicture); + VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + if (pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) + return BadMatch; + if (stuff->maskFormat) + { + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, + stuff->maskFormat, + PictFormatType, + SecurityReadAccess); + if (!pFormat) + { + client->errorValue = stuff->maskFormat; + return RenderErrBase + BadPictFormat; + } + } + else + pFormat = 0; + ntraps = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); + if (ntraps % sizeof (xTrapezoid)) + return BadLength; + ntraps /= sizeof (xTrapezoid); + if (ntraps) + CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat, + stuff->xSrc, stuff->ySrc, + ntraps, (xTrapezoid *) &stuff[1]); + return client->noClientException; } static int ProcRenderTriangles (ClientPtr client) { - return BadImplementation; + int ntris; + PicturePtr pSrc, pDst; + PictFormatPtr pFormat; + REQUEST(xRenderTrianglesReq); + + REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); + if (!PictOpValid (stuff->op)) + { + client->errorValue = stuff->op; + return BadValue; + } + VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + RenderErrBase + BadPicture); + VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + if (pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) + return BadMatch; + if (stuff->maskFormat) + { + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, + stuff->maskFormat, + PictFormatType, + SecurityReadAccess); + if (!pFormat) + { + client->errorValue = stuff->maskFormat; + return RenderErrBase + BadPictFormat; + } + } + else + pFormat = 0; + ntris = (client->req_len << 2) - sizeof (xRenderTrianglesReq); + if (ntris % sizeof (xTriangle)) + return BadLength; + ntris /= sizeof (xTriangle); + if (ntris) + CompositeTriangles (stuff->op, pSrc, pDst, pFormat, + stuff->xSrc, stuff->ySrc, + ntris, (xTriangle *) &stuff[1]); + return client->noClientException; } static int ProcRenderTriStrip (ClientPtr client) { - return BadImplementation; + int npoints; + PicturePtr pSrc, pDst; + PictFormatPtr pFormat; + REQUEST(xRenderTrianglesReq); + + REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); + if (!PictOpValid (stuff->op)) + { + client->errorValue = stuff->op; + return BadValue; + } + VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + RenderErrBase + BadPicture); + VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + if (pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) + return BadMatch; + if (stuff->maskFormat) + { + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, + stuff->maskFormat, + PictFormatType, + SecurityReadAccess); + if (!pFormat) + { + client->errorValue = stuff->maskFormat; + return RenderErrBase + BadPictFormat; + } + } + else + pFormat = 0; + npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq)); + if (npoints & 4) + return(BadLength); + npoints >>= 3; + if (npoints >= 3) + CompositeTriStrip (stuff->op, pSrc, pDst, pFormat, + stuff->xSrc, stuff->ySrc, + npoints, (xPointFixed *) &stuff[1]); + return client->noClientException; } static int ProcRenderTriFan (ClientPtr client) { - return BadImplementation; + int npoints; + PicturePtr pSrc, pDst; + PictFormatPtr pFormat; + REQUEST(xRenderTrianglesReq); + + REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); + if (!PictOpValid (stuff->op)) + { + client->errorValue = stuff->op; + return BadValue; + } + VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + RenderErrBase + BadPicture); + VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + if (pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) + return BadMatch; + if (stuff->maskFormat) + { + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, + stuff->maskFormat, + PictFormatType, + SecurityReadAccess); + if (!pFormat) + { + client->errorValue = stuff->maskFormat; + return RenderErrBase + BadPictFormat; + } + } + else + pFormat = 0; + npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq)); + if (npoints & 4) + return(BadLength); + npoints >>= 3; + if (npoints >= 3) + CompositeTriFan (stuff->op, pSrc, pDst, pFormat, + stuff->xSrc, stuff->ySrc, + npoints, (xPointFixed *) &stuff[1]); + return client->noClientException; } static int @@ -778,7 +1072,7 @@ return BadAlloc; } - remain = (stuff->length << 2) - sizeof (xRenderAddGlyphsReq); + remain = (client->req_len << 2) - sizeof (xRenderAddGlyphsReq); glyphs = glyphsBase; @@ -850,7 +1144,34 @@ static int ProcRenderFreeGlyphs (ClientPtr client) { - return BadImplementation; + REQUEST(xRenderFreeGlyphsReq); + GlyphSetPtr glyphSet; + int nglyph; + CARD32 *gids; + CARD32 glyph; + + REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); + glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, + stuff->glyphset, + GlyphSetType, + SecurityWriteAccess); + if (!glyphSet) + { + client->errorValue = stuff->glyphset; + return RenderErrBase + BadGlyphSet; + } + nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; + gids = (CARD32 *) (stuff + 1); + while (nglyph-- > 0) + { + glyph = *gids++; + if (!DeleteGlyph (glyphSet, glyph)) + { + client->errorValue = glyph; + return RenderErrBase + BadGlyph; + } + } + return client->noClientException; } static int @@ -920,7 +1241,7 @@ } buffer = (CARD8 *) (stuff + 1); - end = (CARD8 *) stuff + (stuff->length << 2); + end = (CARD8 *) stuff + (client->req_len << 2); nglyph = 0; nlist = 0; while (buffer + sizeof (xGlyphElt) < end) @@ -1049,6 +1370,7 @@ int things; REQUEST(xRenderFillRectanglesReq); + REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; @@ -1071,12 +1393,422 @@ return client->noClientException; } +static void +SetBit (unsigned char *line, int x, int bit) +{ + unsigned char mask; + + if (screenInfo.bitmapBitOrder == LSBFirst) + mask = (1 << (x & 7)); + else + mask = (0x80 >> (x & 7)); + /* XXX assumes byte order is host byte order */ + line += (x >> 3); + if (bit) + *line |= mask; + else + *line &= ~mask; +} + +#define DITHER_DIM 2 + +static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = { + { 1, 3, }, + { 4, 2, }, +}; + +#define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) + +static int +ProcRenderCreateCursor (ClientPtr client) +{ + REQUEST(xRenderCreateCursorReq); + PicturePtr pSrc; + ScreenPtr pScreen; + unsigned short width, height; + CARD32 *argbbits, *argb; + unsigned char *srcbits, *srcline; + unsigned char *mskbits, *mskline; + int stride; + int x, y; + int nbytes_mono; + CursorMetricRec cm; + CursorPtr pCursor; + CARD32 twocolor[3]; + int ncolor; + + REQUEST_SIZE_MATCH (xRenderCreateCursorReq); + LEGAL_NEW_RESOURCE(stuff->cid, client); + + VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + RenderErrBase + BadPicture); + pScreen = pSrc->pDrawable->pScreen; + width = pSrc->pDrawable->width; + height = pSrc->pDrawable->height; + if ( stuff->x > width + || stuff->y > height ) + return (BadMatch); + argbbits = xalloc (width * height * sizeof (CARD32)); + if (!argbbits) + return (BadAlloc); + + stride = BitmapBytePad(width); + nbytes_mono = stride*height; + srcbits = (unsigned char *)xalloc(nbytes_mono); + if (!srcbits) + { + xfree (argbbits); + return (BadAlloc); + } + mskbits = (unsigned char *)xalloc(nbytes_mono); + if (!mskbits) + { + xfree(argbbits); + xfree(srcbits); + return (BadAlloc); + } + bzero ((char *) mskbits, nbytes_mono); + bzero ((char *) srcbits, nbytes_mono); + + if (pSrc->format == PICT_a8r8g8b8) + { + (*pScreen->GetImage) (pSrc->pDrawable, + 0, 0, width, height, ZPixmap, + 0xffffffff, (pointer) argbbits); + } + else + { + PixmapPtr pPixmap; + PicturePtr pPicture; + PictFormatPtr pFormat; + int error; + + pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); + if (!pFormat) + { + xfree (argbbits); + xfree (srcbits); + xfree (mskbits); + return (BadImplementation); + } + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32); + if (!pPixmap) + { + xfree (argbbits); + xfree (srcbits); + xfree (mskbits); + return (BadAlloc); + } + pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0, + client, &error); + if (!pPicture); + { + xfree (argbbits); + xfree (srcbits); + xfree (mskbits); + return error; + } + (*pScreen->DestroyPixmap) (pPixmap); + CompositePicture (PictOpSrc, + pSrc, 0, pPicture, + 0, 0, 0, 0, 0, 0, width, height); + (*pScreen->GetImage) (pPicture->pDrawable, + 0, 0, width, height, ZPixmap, + 0xffffffff, (pointer) argbbits); + FreePicture (pPicture, 0); + } + /* + * Check whether the cursor can be directly supported by + * the core cursor code + */ + ncolor = 0; + argb = argbbits; + for (y = 0; ncolor <= 2 && y < height; y++) + { + for (x = 0; ncolor <= 2 && x < width; x++) + { + CARD32 p = *argb++; + CARD32 a = (p >> 24); + + if (a == 0) /* transparent */ + continue; + if (a == 0xff) /* opaque */ + { + int n; + for (n = 0; n < ncolor; n++) + if (p == twocolor[n]) + break; + if (n == ncolor) + twocolor[ncolor++] = p; + } + else + ncolor = 3; + } + } + + /* + * Convert argb image to two plane cursor + */ + srcline = srcbits; + mskline = mskbits; + argb = argbbits; + for (y = 0; y < height; y++) + { + for (x = 0; x < width; x++) + { + CARD32 p = *argb++; + + if (ncolor <= 2) + { + CARD32 a = ((p >> 24)); + + SetBit (mskline, x, a != 0); + SetBit (srcline, x, a != 0 && p == twocolor[0]); + } + else + { + CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255; + CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255; + CARD32 d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)]; + /* Set mask from dithered alpha value */ + SetBit(mskline, x, a > d); + /* Set src from dithered intensity value */ + SetBit(srcline, x, a > d && i <= d); + } + } + srcline += stride; + mskline += stride; + } + /* + * Dither to white and black if the cursor has more than two colors + */ + if (ncolor > 2) + { + twocolor[0] = 0xff000000; + twocolor[1] = 0xffffffff; + } + else + { + xfree (argbbits); + argbbits = 0; + } + +#define GetByte(p,s) (((p) >> (s)) & 0xff) +#define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8)) + + cm.width = width; + cm.height = height; + cm.xhot = stuff->x; + cm.yhot = stuff->y; + pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm, + GetColor(twocolor[0], 16), + GetColor(twocolor[0], 8), + GetColor(twocolor[0], 0), + GetColor(twocolor[1], 16), + GetColor(twocolor[1], 8), + GetColor(twocolor[1], 0)); + if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) + return (client->noClientException); + return BadAlloc; +} + +static int +ProcRenderSetPictureTransform (ClientPtr client) +{ + REQUEST(xRenderSetPictureTransformReq); + PicturePtr pPicture; + int result; + + REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); + VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); + if (client->noClientException != Success) + return(client->noClientException); + else + return(result); +} + +static int +ProcRenderQueryFilters (ClientPtr client) +{ + REQUEST (xRenderQueryFiltersReq); + DrawablePtr pDrawable; + xRenderQueryFiltersReply *reply; + int nbytesName; + int nnames; + ScreenPtr pScreen; + PictureScreenPtr ps; + int i, j; + int len; + int total_bytes; + INT16 *aliases; + char *names; + + REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); + SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, SecurityReadAccess); + + pScreen = pDrawable->pScreen; + nbytesName = 0; + nnames = 0; + ps = GetPictureScreenIfSet(pScreen); + if (ps) + { + for (i = 0; i < ps->nfilters; i++) + nbytesName += 1 + strlen (ps->filters[i].name); + for (i = 0; i < ps->nfilterAliases; i++) + nbytesName += 1 + strlen (ps->filterAliases[i].alias); + nnames = ps->nfilters + ps->nfilterAliases; + } + len = ((nnames + 1) >> 1) + ((nbytesName + 3) >> 2); + total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2); + reply = (xRenderQueryFiltersReply *) xalloc (total_bytes); + if (!reply) + return BadAlloc; + aliases = (INT16 *) (reply + 1); + names = (char *) (aliases + ((nnames + 1) & ~1)); + + reply->type = X_Reply; + reply->sequenceNumber = client->sequence; + reply->length = len; + reply->numAliases = nnames; + reply->numFilters = nnames; + if (ps) + { + + /* fill in alias values */ + for (i = 0; i < ps->nfilters; i++) + aliases[i] = FilterAliasNone; + for (i = 0; i < ps->nfilterAliases; i++) + { + for (j = 0; j < ps->nfilters; j++) + if (ps->filterAliases[i].filter_id == ps->filters[j].id) + break; + if (j == ps->nfilters) + { + for (j = 0; j < ps->nfilterAliases; j++) + if (ps->filterAliases[i].filter_id == + ps->filterAliases[j].alias_id) + { + break; + } + if (j == ps->nfilterAliases) + j = FilterAliasNone; + else + j = j + ps->nfilters; + } + aliases[i + ps->nfilters] = j; + } + + /* fill in filter names */ + for (i = 0; i < ps->nfilters; i++) + { + j = strlen (ps->filters[i].name); + *names++ = j; + strncpy (names, ps->filters[i].name, j); + names += j; + } + + /* fill in filter alias names */ + for (i = 0; i < ps->nfilterAliases; i++) + { + j = strlen (ps->filterAliases[i].alias); + *names++ = j; + strncpy (names, ps->filterAliases[i].alias, j); + names += j; + } + } + + if (client->swapped) + { + register int n; + + for (i = 0; i < reply->numAliases; i++) + { + swaps (&aliases[i], n); + } + swaps(&reply->sequenceNumber, n); + swapl(&reply->length, n); + swapl(&reply->numAliases, n); + swapl(&reply->numFilters, n); + } + WriteToClient(client, total_bytes, (char *) reply); + xfree (reply); + + return(client->noClientException); +} + +static int +ProcRenderSetPictureFilter (ClientPtr client) +{ + REQUEST (xRenderSetPictureFilterReq); + PicturePtr pPicture; + int result; + xFixed *params; + int nparams; + char *name; + + REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); + VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + name = (char *) (stuff + 1); + params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); + nparams = ((xFixed *) stuff + client->req_len) - params; + result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams); + return result; +} + static int +ProcRenderCreateAnimCursor (ClientPtr client) +{ + REQUEST(xRenderCreateAnimCursorReq); + CursorPtr *cursors; + CARD32 *deltas; + CursorPtr pCursor; + int ncursor; + xAnimCursorElt *elt; + int i; + int ret; + + REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq); + LEGAL_NEW_RESOURCE(stuff->cid, client); + if (client->req_len & 1) + return BadLength; + ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1; + cursors = xalloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32))); + if (!cursors) + return BadAlloc; + deltas = (CARD32 *) (cursors + ncursor); + elt = (xAnimCursorElt *) (stuff + 1); + for (i = 0; i < ncursor; i++) + { + cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, + RT_CURSOR, SecurityReadAccess); + if (!cursors[i]) + { + xfree (cursors); + client->errorValue = elt->cursor; + return BadCursor; + } + deltas[i] = elt->delay; + elt++; + } + ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor); + xfree (cursors); + if (ret != Success) + return ret; + + if (AddResource (stuff->cid, RT_CURSOR, (pointer)pCursor)) + return client->noClientException; + return BadAlloc; +} + +static int ProcRenderDispatch (ClientPtr client) { REQUEST(xReq); - if (stuff->data < RenderNumRequests) + if (stuff->data < RenderNumberRequests) return (*ProcRenderVector[stuff->data]) (client); else return BadRequest; @@ -1106,7 +1838,11 @@ static int SProcRenderQueryPictIndexValues (ClientPtr client) { - return BadImplementation; + register int n; + REQUEST(xRenderQueryPictIndexValuesReq); + swaps(&stuff->length, n); + swapl(&stuff->format, n); + return (*ProcRenderVector[stuff->renderReqType]) (client); } static int @@ -1204,25 +1940,69 @@ static int SProcRenderTrapezoids (ClientPtr client) { - return BadImplementation; + register int n; + REQUEST(xRenderTrapezoidsReq); + + REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); + swaps (&stuff->length, n); + swapl (&stuff->src, n); + swapl (&stuff->dst, n); + swapl (&stuff->maskFormat, n); + swaps (&stuff->xSrc, n); + swaps (&stuff->ySrc, n); + SwapRestL(stuff); + return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTriangles (ClientPtr client) { - return BadImplementation; + register int n; + REQUEST(xRenderTrianglesReq); + + REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); + swaps (&stuff->length, n); + swapl (&stuff->src, n); + swapl (&stuff->dst, n); + swapl (&stuff->maskFormat, n); + swaps (&stuff->xSrc, n); + swaps (&stuff->ySrc, n); + SwapRestL(stuff); + return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTriStrip (ClientPtr client) { - return BadImplementation; + register int n; + REQUEST(xRenderTriStripReq); + + REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); + swaps (&stuff->length, n); + swapl (&stuff->src, n); + swapl (&stuff->dst, n); + swapl (&stuff->maskFormat, n); + swaps (&stuff->xSrc, n); + swaps (&stuff->ySrc, n); + SwapRestL(stuff); + return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTriFan (ClientPtr client) { - return BadImplementation; + register int n; + REQUEST(xRenderTriFanReq); + + REQUEST_AT_LEAST_SIZE(xRenderTriFanReq); + swaps (&stuff->length, n); + swapl (&stuff->src, n); + swapl (&stuff->dst, n); + swapl (&stuff->maskFormat, n); + swaps (&stuff->xSrc, n); + swaps (&stuff->ySrc, n); + SwapRestL(stuff); + return (*ProcRenderVector[stuff->renderReqType]) (client); } static int @@ -1289,7 +2069,7 @@ swapl(&stuff->nglyphs, n); if (stuff->nglyphs & 0xe0000000) return BadLength; - end = (CARD8 *) stuff + (stuff->length << 2); + end = (CARD8 *) stuff + (client->req_len << 2); gids = (CARD32 *) (stuff + 1); gi = (xGlyphInfo *) (gids + stuff->nglyphs); if ((char *) end - (char *) (gids + stuff->nglyphs) < 0) @@ -1353,7 +2133,7 @@ swaps(&stuff->xSrc, n); swaps(&stuff->ySrc, n); buffer = (CARD8 *) (stuff + 1); - end = (CARD8 *) stuff + (stuff->length << 2); + end = (CARD8 *) stuff + (client->req_len << 2); while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; @@ -1401,8 +2181,9 @@ SProcRenderFillRectangles (ClientPtr client) { register int n; - REQUEST(xRenderFillRectanglesReq); + + REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); swaps(&stuff->length, n); swapl(&stuff->dst, n); swaps(&stuff->color.red, n); @@ -1414,11 +2195,85 @@ } static int +SProcRenderCreateCursor (ClientPtr client) +{ + register int n; + REQUEST(xRenderCreateCursorReq); + REQUEST_SIZE_MATCH (xRenderCreateCursorReq); + + swaps(&stuff->length, n); + swapl(&stuff->cid, n); + swapl(&stuff->src, n); + swaps(&stuff->x, n); + swaps(&stuff->y, n); + return (*ProcRenderVector[stuff->renderReqType]) (client); +} + +static int +SProcRenderSetPictureTransform (ClientPtr client) +{ + register int n; + REQUEST(xRenderSetPictureTransformReq); + REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); + + swaps(&stuff->length, n); + swapl(&stuff->picture, n); + swapl(&stuff->transform.matrix11, n); + swapl(&stuff->transform.matrix12, n); + swapl(&stuff->transform.matrix13, n); + swapl(&stuff->transform.matrix21, n); + swapl(&stuff->transform.matrix22, n); + swapl(&stuff->transform.matrix23, n); + swapl(&stuff->transform.matrix31, n); + swapl(&stuff->transform.matrix32, n); + swapl(&stuff->transform.matrix33, n); + return (*ProcRenderVector[stuff->renderReqType]) (client); +} + +static int +SProcRenderQueryFilters (ClientPtr client) +{ + register int n; + REQUEST (xRenderQueryFiltersReq); + REQUEST_SIZE_MATCH (xRenderQueryFiltersReq); + + swaps(&stuff->length, n); + swapl(&stuff->drawable, n); + return (*ProcRenderVector[stuff->renderReqType]) (client); +} + +static int +SProcRenderSetPictureFilter (ClientPtr client) +{ + register int n; + REQUEST (xRenderSetPictureFilterReq); + REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); + + swaps(&stuff->length, n); + swapl(&stuff->picture, n); + swaps(&stuff->nbytes, n); + return (*ProcRenderVector[stuff->renderReqType]) (client); +} + +static int +SProcRenderCreateAnimCursor (ClientPtr client) +{ + register int n; + REQUEST (xRenderCreateAnimCursorReq); + REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq); + + swaps(&stuff->length, n); + swapl(&stuff->cid, n); + SwapRestL(stuff); + return (*ProcRenderVector[stuff->renderReqType]) (client); +} + +static int SProcRenderDispatch (ClientPtr client) { REQUEST(xReq); - if (stuff->data < RenderNumRequests) + if (stuff->data < RenderNumberRequests) return (*SProcRenderVector[stuff->data]) (client); else return BadRequest; @@ -1444,8 +2299,7 @@ } \ } \ -int (*PanoramiXSaveRenderVector[RenderNumRequests])(ClientPtr); -extern int XineramaDeleteResource(pointer data, XID id); +int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr); unsigned long XRT_PICTURE; @@ -1623,8 +2477,8 @@ VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, RenderErrBase + BadPicture); - if (stuff->length << 2 >= (sizeof (xRenderCompositeGlyphsReq) + - sizeof (xGlyphElt))) + if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) + + sizeof (xGlyphElt))) { elt = (xGlyphElt *) (stuff + 1); origElt = *elt; @@ -1663,7 +2517,7 @@ REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, RenderErrBase + BadPicture); - extra_len = (stuff->length << 2) - sizeof (xRenderFillRectanglesReq); + extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq); if (extra_len && (extra = (char *) ALLOCATE_LOCAL (extra_len))) { @@ -1703,7 +2557,7 @@ int i; XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource); - for (i = 0; i < RenderNumRequests; i++) + for (i = 0; i < RenderNumberRequests; i++) PanoramiXSaveRenderVector[i] = ProcRenderVector[i]; /* * Stuff in Xinerama aware request processing hooks @@ -1723,7 +2577,7 @@ PanoramiXRenderReset (void) { int i; - for (i = 0; i < RenderNumRequests; i++) + for (i = 0; i < RenderNumberRequests; i++) ProcRenderVector[i] = PanoramiXSaveRenderVector[i]; } Index: xc/programs/Xserver/xkb/Imakefile diff -u xc/programs/Xserver/xkb/Imakefile:3.17 xc/programs/Xserver/xkb/Imakefile:3.21 --- xc/programs/Xserver/xkb/Imakefile:3.17 Mon Aug 27 13:41:01 2001 +++ xc/programs/Xserver/xkb/Imakefile Mon Dec 9 18:00:42 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/xkb/Imakefile,v 3.17 2001/08/27 17:41:01 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/xkb/Imakefile,v 3.21 2002/12/09 23:00:42 dawes Exp $ #define SGIHyperOpt #include <Server.tmpl> @@ -14,12 +14,8 @@ #if BuildXInputExt XKBXI_SRCS = xkbPrOtherEv.c -#ifdef OS2Architecture -XKBXI_OBJS = -#else XKBXI_OBJS = xkbPrOtherEv.o #endif -#endif #ifdef DfltDisableXKB XKB_DISABLE = -DXKB_DFLT_DISABLED=1 @@ -29,12 +25,17 @@ XKB_DDXDEFS = XkbServerDefines +#if XF86Server +XF86INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) + XF86_OBJS = xf86KillSrv.o xf86VT.o xf86Private.o +#endif + DDX_SRCS = ddxBeep.c ddxCtrls.c ddxFakeBtn.c ddxFakeMtn.c ddxInit.c \ ddxKeyClick.c ddxKillSrv.c ddxLEDs.c ddxVT.c ddxLoad.c \ - ddxList.c ddxConfig.c ddxDevBtn.c xkbconfig.c + ddxList.c ddxConfig.c ddxDevBtn.c ddxPrivate.c xkbconfig.c DDX_OBJS = ddxBeep.o ddxCtrls.o ddxFakeBtn.o ddxFakeMtn.o ddxInit.o \ ddxKeyClick.o ddxKillSrv.o ddxLEDs.o ddxVT.o ddxLoad.o \ - ddxList.o ddxConfig.o ddxDevBtn.o xkbconfig.o + ddxList.o ddxConfig.o ddxDevBtn.o ddxPrivate.o xkbconfig.o SRCS = xkb.c xkbUtils.c xkbEvents.c xkbAccessX.c xkbSwap.c \ xkbLEDs.c xkbInit.c xkbActions.c xkbPrKeyEv.c \ xkmread.c xkbtext.c xkbfmisc.c xkberrs.c xkbout.c maprules.c \ @@ -46,7 +47,7 @@ XKBMisc.o XKBMAlloc.o XKBAlloc.o XKBGAlloc.o \ $(XKBXI_OBJS) $(DDX_OBJS) INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ - -I$(SERVERSRC)/mi + -I$(SERVERSRC)/mi $(XF86INCLUDES) LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln DEFINES = -DXKB_IN_SERVER $(EXTRA_ALLOC_DEFINES) $(XKB_DDXDEFS) @@ -57,6 +58,13 @@ LintLibraryTarget(xkb,$(SRCS)) NormalLintTarget($(SRCS)) +#if XF86Server +ObjectFromSpecialSource(xf86KillSrv,ddxKillSrv,-DXF86DDXACTIONS) +ObjectFromSpecialSource(xf86VT,ddxVT,-DXF86DDXACTIONS) +ObjectFromSpecialSource(xf86Private,ddxPrivate,-DXF86DDXACTIONS) +AllTarget($(XF86_OBJS)) +#endif + SpecialCObjectRule(xkbInit,$(ICONFIGFILES),$(XKB_DEFINES)) LinkSourceFile(maprules.c,$(XKBFILELIBSRC)) @@ -72,8 +80,21 @@ LinkSourceFile(XKBAlloc.c,$(XLIBSRC)) LinkSourceFile(XKBGAlloc.c,$(XLIBSRC)) -#if UseConfDirForXkb && BuildLibraries +#if BuildLibraries +#if UseConfDirForXkb LinkConfDirectory(xkb,.,xkb,.) +ODIR = $(CONFDIR) +#else +ODIR = $(LIBDIR) +#endif +#ifdef VarDbDirectory +NDIR = $(VARDBDIR) +#else +NDIR = $(CONFDIR) +#endif +#if !UseConfDirForXkb || defined(VarDbDirectory) +LinkConfDirectoryLong(xkb,xkb,compiled,compiled,$(ODIR),$(NDIR)) +#endif #endif DependTarget() Index: xc/programs/Xserver/xkb/ddxBeep.c diff -u xc/programs/Xserver/xkb/ddxBeep.c:3.4 xc/programs/Xserver/xkb/ddxBeep.c:3.9 --- xc/programs/Xserver/xkb/ddxBeep.c:3.4 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/ddxBeep.c Thu Dec 5 16:59:00 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/ddxBeep.c,v 3.9 2002/12/05 21:59:00 paulo Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -59,7 +60,7 @@ #define HIGH_PITCH 2000 #define CLICK_PITCH 1500 -static unsigned long atomGeneration= -1; +static unsigned long atomGeneration= 0; static Atom featureOn; static Atom featureOff; static Atom featureChange; @@ -138,6 +139,10 @@ (strcmp(keyboard,"LK443") == 0)) doesPitch = 0; } +#else +#if defined(sun) + doesPitch = 0; +#endif #endif return; } @@ -317,7 +322,10 @@ next = SHORT_DELAY; break; } - if (duration>0) { + if (timer == NULL && duration>0) { + CARD32 starttime = GetTimeInMillis(); + CARD32 elapsedtime; + ctrl->bell_duration= duration; ctrl->bell_pitch= pitch; if (xkbInfo->beepCount==0) { @@ -330,6 +338,23 @@ ctrl->bell_duration= oldDuration; ctrl->bell_pitch= oldPitch; xkbInfo->beepCount++; + + /* Some DDX schedule the beep and return immediately, others don't + return until the beep is completed. We measure the time and if + it's less than the beep duration, make sure not to schedule the + next beep until after the current one finishes. */ + + elapsedtime = GetTimeInMillis(); + if (elapsedtime > starttime) { /* watch out for millisecond counter + overflow! */ + elapsedtime -= starttime; + } else { + elapsedtime = 0; + } + if (elapsedtime < duration) { + next += duration - elapsedtime; + } + } return next; } Index: xc/programs/Xserver/xkb/ddxConfig.c diff -u xc/programs/Xserver/xkb/ddxConfig.c:3.5 xc/programs/Xserver/xkb/ddxConfig.c:3.8 --- xc/programs/Xserver/xkb/ddxConfig.c:3.5 Thu Aug 23 10:33:25 2001 +++ xc/programs/Xserver/xkb/ddxConfig.c Fri Dec 20 15:18:35 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxConfig.c,v 3.5 2001/08/23 14:33:25 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxConfig.c,v 3.8 2002/12/20 20:18:35 paulo Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -142,7 +142,7 @@ sprintf(buf,"X%s-config%s%s",display,(dName[0]?".":""),dName); } #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ strcpy(buf,(char*)__XOS2RedirRoot(buf)); #endif #ifdef DEBUG @@ -193,24 +193,29 @@ XkbSetRulesUsed(defs); if (rtrn->keycodes!=NULL) { + if (names->keycodes) _XkbFree(names->keycodes); names->keycodes= rtrn->keycodes; rtrn->keycodes= NULL; } if (rtrn->geometry!=NULL) { + if (names->geometry) _XkbFree(names->geometry); names->geometry= rtrn->geometry; rtrn->geometry= NULL; } if (rtrn->symbols!=NULL) { if (rtrn->phys_symbols==NULL) rtrn->phys_symbols= _XkbDupString(names->symbols); + if (names->symbols) _XkbFree(names->symbols); names->symbols= rtrn->symbols; rtrn->symbols= NULL; } if (rtrn->types!=NULL) { + if (names->types) _XkbFree(names->types); names->types= rtrn->types; rtrn->types= NULL; } if (rtrn->compat!=NULL) { + if (names->compat) _XkbFree(names->compat); names->compat= rtrn->compat; rtrn->compat= NULL; } Index: xc/programs/Xserver/xkb/ddxKillSrv.c diff -u xc/programs/Xserver/xkb/ddxKillSrv.c:1.1.1.3 xc/programs/Xserver/xkb/ddxKillSrv.c:1.3 --- xc/programs/Xserver/xkb/ddxKillSrv.c:1.1.1.3 Tue Jan 16 17:45:02 2001 +++ xc/programs/Xserver/xkb/ddxKillSrv.c Sat Nov 23 14:27:50 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/ddxKillSrv.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -36,6 +37,10 @@ #include "XKBsrv.h" #include "XI.h" +#ifdef XF86DDXACTIONS +#include "xf86.h" +#endif + int #if NeedFunctionPrototypes XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) @@ -46,6 +51,10 @@ XkbAction *act; #endif { +#ifdef XF86DDXACTIONS + xf86ProcessActionEvent(ACTION_TERMINATE, NULL); +#else GiveUp(1); +#endif return 0; } Index: xc/programs/Xserver/xkb/ddxLoad.c diff -u xc/programs/Xserver/xkb/ddxLoad.c:3.28 xc/programs/Xserver/xkb/ddxLoad.c:3.30 --- xc/programs/Xserver/xkb/ddxLoad.c:3.28 Thu Aug 23 10:33:25 2001 +++ xc/programs/Xserver/xkb/ddxLoad.c Fri May 31 14:46:06 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.28 2001/08/23 14:33:25 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.30 2002/05/31 18:46:06 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -128,7 +128,7 @@ OutputDirectory(xkm_output_dir); if (XkbBaseDirectory!=NULL) { -#ifdef __EMX__ +#ifdef __UNIXOS2__ char *tmpbase = (char*)__XOS2RedirRoot(XkbBaseDirectory); int i; if (strlen(tmpbase)*2+(xkbDebugFlags>9?2:1) @@ -144,7 +144,7 @@ names->keymap); return False; } -#ifndef __EMX__ +#ifndef __UNIXOS2__ sprintf(cmd,"%s/xkbcomp -w %d -R%s -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm", XkbBaseDirectory, ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), @@ -224,7 +224,7 @@ #ifdef WIN32 char tmpname[32]; #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ char *tmpbase; int i; #endif @@ -245,7 +245,7 @@ strcpy(tmpname, "\\temp\\xkb_XXXXXX"); (void) mktemp(tmpname); #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ tmpbase = (char*)__XOS2RedirRoot(XkbBaseDirectory); #endif if (XkbBaseDirectory!=NULL) { @@ -259,7 +259,7 @@ return False; } #ifndef WIN32 -#ifndef __EMX__ +#ifndef __UNIXOS2__ sprintf(buf, "%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\"", XkbBaseDirectory, @@ -550,3 +550,5 @@ XkbRF_Free(rules,True); return complete; } + + Index: xc/programs/Xserver/xkb/ddxPrivate.c diff -u /dev/null xc/programs/Xserver/xkb/ddxPrivate.c:1.1 --- /dev/null Thu Feb 27 12:34:02 2003 +++ xc/programs/Xserver/xkb/ddxPrivate.c Tue Nov 19 23:49:02 2002 @@ -0,0 +1,46 @@ +/* $XFree86: xc/programs/Xserver/xkb/ddxPrivate.c,v 1.1 2002/11/20 04:49:02 dawes Exp $ */ + +#include <stdio.h> +#define NEED_EVENTS 1 +#include <X11/X.h> +#include "windowstr.h" +#define XKBSRV_NEED_FILE_FUNCS +#include "XKBsrv.h" + +#ifdef XF86DDXACTIONS +#include "xf86.h" +#endif + +int +#if NeedFunctionPrototypes +XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) +#else +XkbDDXPrivate(dev,key,act) + DeviceIntPtr dev; + KeyCode key; + XkbAction *act; +#endif +{ +#ifdef XF86DDXACTIONS + XkbMessageAction *msgact = &(act->msg); + char msgbuf[7]; + int x; + + if (msgact->type == XkbSA_XFree86Private) { + msgbuf[0]= msgact->flags; + for (x=0; x<5; x++) + msgbuf[x+1] = msgact->message[x]; + msgbuf[6]= '\0'; + if (_XkbStrCaseCmp(msgbuf, "-vmode")==0) + xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); + else if (_XkbStrCaseCmp(msgbuf, "+vmode")==0) + xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); + else if (_XkbStrCaseCmp(msgbuf, "ungrab")==0) + xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); + else if (_XkbStrCaseCmp(msgbuf, "clsgrb")==0) + xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); + } +#endif + return 0; +} + Index: xc/programs/Xserver/xkb/ddxVT.c diff -u xc/programs/Xserver/xkb/ddxVT.c:1.1.1.3 xc/programs/Xserver/xkb/ddxVT.c:1.3 --- xc/programs/Xserver/xkb/ddxVT.c:1.1.1.3 Tue Jan 16 17:45:04 2001 +++ xc/programs/Xserver/xkb/ddxVT.c Sat Nov 23 14:27:50 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/ddxVT.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -36,6 +37,10 @@ #include "XKBsrv.h" #include "XI.h" +#ifdef XF86DDXACTIONS +#include "xf86.h" +#endif + int #if NeedFunctionPrototypes XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act) @@ -46,5 +51,21 @@ XkbAction *act; #endif { +#ifdef XF86DDXACTIONS + { + int scrnnum = XkbSAScreen(&act->screen); + + if (act->screen.flags & XkbSA_SwitchApplication) { + if (act->screen.flags & XkbSA_SwitchAbsolute) + xf86ProcessActionEvent(ACTION_SWITCHSCREEN,(void *) &scrnnum); + else { + if (scrnnum < 0) + xf86ProcessActionEvent(ACTION_SWITCHSCREEN_PREV,NULL); + else + xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT,NULL); + } + } + } +#endif return 1; } Index: xc/programs/Xserver/xkb/xkb.c diff -u xc/programs/Xserver/xkb/xkb.c:3.15 xc/programs/Xserver/xkb/xkb.c:3.18 --- xc/programs/Xserver/xkb/xkb.c:3.15 Thu Aug 23 10:33:25 2001 +++ xc/programs/Xserver/xkb/xkb.c Fri Dec 20 15:18:35 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.15 2001/08/23 14:33:25 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.18 2002/12/20 20:18:35 paulo Exp $ */ #include <stdio.h> #include "X.h" @@ -4225,7 +4225,7 @@ names->phys_symbols= *tmp++; if (stuff->which&XkbTypesNameMask) names->types= *tmp++; - if (stuff->which&XkbCompatNameMask) + if (stuff->which&XkbCompatNameMask) names->compat= *tmp++; if ((stuff->which&XkbKeyTypeNamesMask)&&(stuff->nTypes>0)) { register unsigned i; @@ -5598,7 +5598,7 @@ /* all latin-1 alphanumerics, plus parens, minus, underscore, slash */ /* and wildcards */ static unsigned char componentSpecLegal[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff @@ -5606,7 +5606,7 @@ /* same as above but accepts percent, plus and bar too */ static unsigned char componentExprLegal[] = { - 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x83, + 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff @@ -6019,10 +6019,6 @@ dev->key->xkbInfo->desc= xkb; finfo.xkb= old_xkb; /* so it'll get freed automatically */ - if (dev->kbdfeed && dev->kbdfeed->xkb_sli) { - XkbFreeSrvLedInfo(dev->kbdfeed->xkb_sli); - dev->kbdfeed->xkb_sli= NULL; - } *xkb->ctrls= *old_xkb->ctrls; for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) { nG= XkbKeyNumGroups(xkb,i); @@ -6038,6 +6034,20 @@ memcpy(dev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1); XkbUpdateCoreDescription(dev,True); + + if (dev->kbdfeed && dev->kbdfeed->xkb_sli) { + XkbSrvLedInfoPtr old_sli; + XkbSrvLedInfoPtr sli; + old_sli = dev->kbdfeed->xkb_sli; + dev->kbdfeed->xkb_sli = NULL; + sli = XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,0); + if (sli) { + sli->explicitState = old_sli->explicitState; + sli->effectiveState = old_sli->effectiveState; + } + dev->kbdfeed->xkb_sli = sli; + XkbFreeSrvLedInfo(old_sli); + } nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.minKeyCode= finfo.xkb->min_key_code; Index: xc/programs/Xserver/xkb/xkbActions.c diff -u xc/programs/Xserver/xkb/xkbActions.c:3.7 xc/programs/Xserver/xkb/xkbActions.c:3.11 --- xc/programs/Xserver/xkb/xkbActions.c:3.7 Thu Aug 23 10:33:25 2001 +++ xc/programs/Xserver/xkb/xkbActions.c Thu Feb 13 10:36:48 2003 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.7 2001/08/23 14:33:25 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.11 2003/02/13 15:36:48 dawes Exp $ */ #include <stdio.h> #include <math.h> @@ -245,7 +245,6 @@ XkbAction * pAction; #endif { - if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; @@ -1019,6 +1018,69 @@ return 1; } +static int +#if NeedFunctionPrototypes +_XkbFilterSwitchScreen( XkbSrvInfoPtr xkbi, + XkbFilterPtr filter, + unsigned keycode, + XkbAction * pAction) +#else +_XkbFilterSwitchScreen(xkbi,filter,keycode,pAction) + XkbSrvInfoPtr xkbi; + XkbFilterPtr filter; + unsigned keycode; + XkbAction * pAction; +#endif +{ + if (filter->keycode==0) { /* initial press */ + DeviceIntPtr dev = xkbi->device; + filter->keycode = keycode; + filter->active = 1; + filter->filterOthers = 0; + filter->filter = _XkbFilterSwitchScreen; + AccessXCancelRepeatKey(xkbi, keycode); + XkbDDXSwitchScreen(dev,keycode,pAction); + return 0; + } + else if (filter->keycode==keycode) { + filter->active= 0; + return 0; + } + return 1; +} + +#ifdef XFree86Server +static int +#if NeedFunctionPrototypes +_XkbFilterXF86Private( XkbSrvInfoPtr xkbi, + XkbFilterPtr filter, + unsigned keycode, + XkbAction * pAction) +#else +_XkbFilterXF86Private(xkbi,filter,keycode,pAction) + XkbSrvInfoPtr xkbi; + XkbFilterPtr filter; + unsigned keycode; + XkbAction * pAction; +#endif +{ + if (filter->keycode==0) { /* initial press */ + DeviceIntPtr dev = xkbi->device; + filter->keycode = keycode; + filter->active = 1; + filter->filterOthers = 0; + filter->filter = _XkbFilterXF86Private; + XkbDDXPrivate(dev,keycode,pAction); + return 0; + } + else if (filter->keycode==keycode) { + filter->active= 0; + return 0; + } + return 1; +} +#endif + #ifdef XINPUT static int @@ -1247,7 +1309,8 @@ sendEvent= XkbDDXTerminateServer(dev,key,&act); break; case XkbSA_SwitchScreen: - sendEvent= XkbDDXSwitchScreen(dev,key,&act); + filter = _XkbNextFreeFilter(); + sendEvent=_XkbFilterSwitchScreen(xkbi,filter,key,&act); break; case XkbSA_SetControls: case XkbSA_LockControls: @@ -1267,6 +1330,12 @@ case XkbSA_LockDeviceBtn: filter = _XkbNextFreeFilter(); sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act); + break; +#endif +#ifdef XFree86Server + case XkbSA_XFree86Private: + filter = _XkbNextFreeFilter(); + sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act); break; #endif } Index: xc/programs/Xserver/xkb/xkbInit.c diff -u xc/programs/Xserver/xkb/xkbInit.c:3.21 xc/programs/Xserver/xkb/xkbInit.c:3.26 --- xc/programs/Xserver/xkb/xkbInit.c:3.21 Sat Oct 27 23:34:20 2001 +++ xc/programs/Xserver/xkb/xkbInit.c Sun Feb 9 01:29:20 2003 @@ -24,11 +24,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.21 2001/10/28 03:34:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.26 2003/02/09 06:29:20 paulo Exp $ */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> +#include <unistd.h> #include <math.h> #define NEED_EVENTS 1 #include <X11/X.h> @@ -701,31 +702,81 @@ rules= XkbGetRulesDflts(&defs); config= XkbDDXPreloadConfig(&rules,&defs,&cfgNames,dev); + /* + * The strings are duplicated because it is not guaranteed that + * they are allocated, or that they are allocated for every server + * generation. Eventually they will be freed at the end of this + * function. + */ + if (names->keymap) names->keymap = _XkbDupString(names->keymap); + if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes); + if (names->types) names->types = _XkbDupString(names->types); + if (names->compat) names->compat = _XkbDupString(names->compat); + if (names->geometry) names->geometry = _XkbDupString(names->geometry); + if (names->symbols) names->geometry = _XkbDupString(names->symbols); + if (defs.model && defs.layout && rules) { XkbComponentNamesRec rNames; bzero(&rNames,sizeof(XkbComponentNamesRec)); if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) { - if (rNames.keymap && !names->keymap) - names->keymap = rNames.keymap; - if (rNames.keycodes && !names->keycodes) - names->keycodes = rNames.keycodes; - if (rNames.types && !names->types) - names->types = rNames.types; - if (rNames.compat && !names->compat) - names->compat = rNames.compat; - if (rNames.symbols && !names->symbols) - names->symbols = rNames.symbols; - if (rNames.geometry && !names->geometry) - names->geometry = rNames.geometry; + if (rNames.keymap) { + if (!names->keymap) + names->keymap = rNames.keymap; + else _XkbFree(rNames.keymap); + } + if (rNames.keycodes) { + if (!names->keycodes) + names->keycodes = rNames.keycodes; + else + _XkbFree(rNames.keycodes); + } + if (rNames.types) { + if (!names->types) + names->types = rNames.types; + else _XkbFree(rNames.types); + } + if (rNames.compat) { + if (!names->compat) + names->compat = rNames.compat; + else _XkbFree(rNames.compat); + } + if (rNames.symbols) { + if (!names->symbols) + names->symbols = rNames.symbols; + else _XkbFree(rNames.symbols); + } + if (rNames.geometry) { + if (!names->geometry) + names->geometry = rNames.geometry; + else _XkbFree(rNames.geometry); + } XkbSetRulesUsed(&defs); } + } + if (cfgNames.keymap){ + if (names->keymap) _XkbFree(names->keymap); + names->keymap= cfgNames.keymap; + } + if (cfgNames.keycodes){ + if (names->keycodes) _XkbFree(names->keycodes); + names->keycodes= cfgNames.keycodes; + } + if (cfgNames.types) { + if (names->types) _XkbFree(names->types); + names->types= cfgNames.types; + } + if (cfgNames.compat) { + if (names->compat) _XkbFree(names->compat); + names->compat= cfgNames.compat; + } + if (cfgNames.symbols){ + if (names->symbols) _XkbFree(names->symbols); + names->symbols= cfgNames.symbols; + } + if (cfgNames.geometry) { + if (names->geometry) _XkbFree(names->geometry); + names->geometry= cfgNames.geometry; } - if (cfgNames.keymap) names->keymap= cfgNames.keymap; - if (cfgNames.keycodes) names->keycodes= cfgNames.keycodes; - if (cfgNames.types) names->types= cfgNames.types; - if (cfgNames.compat) names->compat= cfgNames.compat; - if (cfgNames.symbols) names->symbols= cfgNames.symbols; - if (cfgNames.geometry) names->geometry= cfgNames.geometry; if (names->keymap) { XkbComponentNamesRec tmpNames; @@ -785,6 +836,20 @@ _XkbFree(pSyms->map); pSyms->map= NULL; } + + if (names->keymap) _XkbFree(names->keymap); + names->keymap = NULL; + if (names->keycodes) _XkbFree(names->keycodes); + names->keycodes = NULL; + if (names->types) _XkbFree(names->types); + names->types = NULL; + if (names->compat) _XkbFree(names->compat); + names->compat = NULL; + if (names->geometry) _XkbFree(names->geometry); + names->geometry = NULL; + if (names->symbols) _XkbFree(names->symbols); + names->symbols = NULL; + return ok; } @@ -926,6 +991,28 @@ else if (strcmp(argv[i],"+kb")==0) { noXkbExtension= False; return 1; + } + else if (strncmp(argv[i], "-xkbdir", 7) == 0) { + if(++i < argc) { +#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__) + if (getuid() != geteuid()) { + ErrorF("-xkbdir is not available for setuid X servers\n"); + return -1; + } else +#endif + { + if (strlen(argv[i]) < PATH_MAX) { + XkbBaseDirectory= argv[i]; + return 2; + } else { + ErrorF("-xkbdir pathname too long\n"); + return -1; + } + } + } + else { + return -1; + } } else if (strncmp(argv[i], "-xkbmap", 7) == 0) { if(++i < argc) { Index: xc/programs/beforelight/b4light.c diff -u xc/programs/beforelight/b4light.c:3.5 xc/programs/beforelight/b4light.c:3.6 --- xc/programs/beforelight/b4light.c:3.5 Wed Jul 25 11:05:12 2001 +++ xc/programs/beforelight/b4light.c Mon Feb 17 18:43:25 2003 @@ -26,7 +26,7 @@ * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/beforelight/b4light.c,v 3.5 2001/07/25 15:05:12 dawes Exp $ */ +/* $XFree86: xc/programs/beforelight/b4light.c,v 3.6 2003/02/17 23:43:25 herrb Exp $ */ #include <X11/Xatom.h> #include <X11/Intrinsic.h> @@ -290,6 +290,11 @@ XID kill_id; Atom kill_type; int i; + int (*oldHandler)(); + Window r; + int x, y; + unsigned int w, h, b, d; + Status s; #if !defined(X_NOT_POSIX) srand((int)time((time_t *)NULL)); @@ -324,9 +329,17 @@ &wm_delete_window, 1); #endif - if (XScreenSaverGetRegistered (display, screen, &kill_id, &kill_type)) - XKillClient (display, kill_id); - + oldHandler = XSetErrorHandler (ignoreError); + if (XScreenSaverGetRegistered (display, screen, &kill_id, &kill_type)) { + s = XGetGeometry(display, kill_id, &r, &x, &y, &w, &h, &b, &d); + if (s == True && r == root && w == 1 && h == 1 && d == 1) { + /* Try to clean up existing saver & resources */ + XKillClient (display, kill_id); + XScreenSaverUnregister(display, screen); + } + } + XSync(display, FALSE); + XSetErrorHandler(oldHandler); XScreenSaverSelectInput (display, root, ScreenSaverNotifyMask); #ifdef NOTDEF cmap = XCreateColormap (display, root, DefaultVisual (display, screen), AllocNone); Index: xc/programs/bitmap/Bitmap-nocase.ad diff -u /dev/null xc/programs/bitmap/Bitmap-nocase.ad:1.1 --- /dev/null Thu Feb 27 12:34:04 2003 +++ xc/programs/bitmap/Bitmap-nocase.ad Wed May 29 17:37:42 2002 @@ -0,0 +1,233 @@ +! $Xorg: Bitmap.ad,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ +! +! $XFree86: xc/programs/bitmap/Bitmap-nocase.ad,v 1.1 2002/05/29 21:37:42 torrey Exp $ +! +! The App-defaults file for Bitmap for use on file systems +! that are not case sensitive. + +*TransientShell.allowShellResize: True +*shapeStyle: oval +*cursor: left_ptr +*pane.orientation: horizontal + +*Form*top: ChainTop +*Form*bottom: ChainTop +*Form*left: ChainLeft +*Form*right: ChainLeft + +*MenuButton.leftBitmap: menu12 +*form*width: 120 +*form*height: 15 + +*baseTranslations:#override\ + Ctrl<Key>c: do-quit()\n\ + <Key>q: do-quit()\n\ + Ctrl<Key>n: do-new()\n\ + Ctrl<Key>f: do-load()\n\ + Ctrl<Key>i: do-insert()\n\ + Ctrl<Key>s: do-save()\n\ + Ctrl<Key>w: do-save-as()\n\ + Ctrl<Key>r: do-resize()\n\ + Ctrl<Key>x: do-rescale()\n\ + Ctrl<Key>e: do-filename()\n\ + Ctrl<Key>b: do-basename()\n\ + Meta<Key>i: switch-image()\n\ + Meta<Key>g: switch-grid()\n\ + Meta<Key>d: switch-dashed()\n\ + Meta<Key>a: switch-axes()\n\ + Meta<Key>s: switch-stippled()\n\ + Meta<Key>p: switch-proportional()\n\ + Meta<Key>z: switch-zoom()\n\ + Meta<Key>c: do-cut()\n\ + Meta<Key>w: do-copy()\n\ + Meta<Key>y: do-paste() + + +*Toggle.translations: <EnterWindow>: highlight(WhenUnset)\n\ + <LeaveWindow>: unhighlight()\n\ + <Btn1Down>,<Btn1Up>: set() notify() + +*MenuButton.translations:<EnterWindow>: highlight()\n\ + <LeaveWindow>: reset()\n\ + Any<BtnDown>: reset() fix-menu() PopupMenu() + +*Dialog*baseTranslations:#override\ + <Key>Return: set-dialog-button(okay, yes, retry)\n\ + Ctrl<Key>g: set-dialog-button(cancel, abort) +*image*baseTranslations:#override\ + <Btn1Down>,<Btn1Up>: switch-image() +*image*width: 0 +*image*height: 0 +*image*Label.internalWidth: 0 +*image*Label.internalHeight: 0 +*image*normalImage.foreground: white +*image*normalImage.background: black +*image*invertedImage.foreground: black +*image*invertedImage.background: white + +*bitmap.cursor: tcross +*bitmap.dashes: Dashes +*bitmap.stipple: Stippler +*bitmap.stippled: on + +*TransientShell.width: 300 + +*input*icon: Term +*qsave*icon: Term +*error*icon: Excl +*Dialog.yes.label: Yes +*Dialog.no.label: No +*Dialog.okay.label: OK +*Dialog.abort.label: Abort +*Dialog.cancel.label: Cancel +*Dialog.retry.label: Retry + +*MenuButton.width: 58 + +*SimpleMenu.width: 0 +*SimpleMenu.height: 0 +*SimpleMenu.cursor: hand2 +*SimpleMenu.line.height: 0 + +*fileButton.label: File +*fileButton.menuName: fileMenu + +*editButton.label: Edit +*editButton.fromHoriz: fileButton +*editButton.menuName: editMenu + +*formy.status*top: ChainTop +*formy.status*bottom: ChainTop +*formy.status*left: ChainLeft +*formy.status*right: ChainRight +*status.fromHoriz: editButton +*status.borderWidth: 0 + +*SmeBSB.HorizontalMargins: 32 + +*fileMenu.new.label: New (Ctrl-N)... +*fileMenu.load.label: Load (Ctrl-F)... +*fileMenu.insert.label: Insert (Ctrl-I)... +*fileMenu.save.label: Save (Ctrl-S) +*fileMenu.saveAs.label: Save As (Ctrl-W)... +*fileMenu.resize.label: Resize (Ctrl-R)... +*fileMenu.rescale.label: Rescale (Ctrl-X)... +*fileMenu.filename.label: Filename (Ctrl-E)... +*fileMenu.basename.label: Basename (Ctrl-B)... +*fileMenu.quit.label: Quit (Ctrl-C, Q) + +*editMenu.image.label: Image (Meta-I) +*editMenu.grid.label: Grid (Meta-G) +*editMenu.dashed.label: Dashed (Meta-D) +*editMenu.axes.label: Axes (Meta-A) +*editMenu.stippled.label: Stippled (Meta-S) +*editMenu.proportional.label: Proportional (Meta-P) +*editMenu.zoom.label: Zoom (Meta-Z) +*editMenu.cut.label: Cut (Meta-C) +*editMenu.copy.label: Copy (Meta-W) +*editMenu.paste.label: Paste (Meta-Y, Ctrl-mb) + +*form.clear.label: Clear +*form.set.fromVert: clear +*form.set.label: Set +*form.invert.fromVert: set +*form.invert.label: Invert + +*form.mark.vertDistance: 10 +*form.mark.fromVert: invert +*form.mark.label: Mark +*form.unmark.fromVert: mark +*form.unmark.label: Unmark + +*form.copy.vertDistance: 10 +*form.copy.fromVert: unmark +*form.copy.radioGroup: mark +*form.copy.label: Copy +*form.move.fromVert: copy +*form.move.radioGroup: copy +*form.move.label: Move + +*form.flipHoriz.vertDistance: 10 +*form.flipHoriz.width: 36 +*form.flipHoriz.height: 36 +*form.flipHoriz.fromVert: move +*form.flipHoriz.bitmap: FlipHoriz +*form.up.vertDistance: 10 +*form.up.width: 36 +*form.up.height: 36 +*form.up.fromVert: move +*form.up.fromHoriz: flipHoriz +*form.up.bitmap: Up +*form.flipVert.vertDistance: 10 +*form.flipVert.width: 36 +*form.flipVert.height: 36 +*form.flipVert.fromVert: move +*form.flipVert.fromHoriz: up +*form.flipVert.bitmap: FlipVert +*form.left.width: 36 +*form.left.height: 36 +*form.left.fromVert: flipHoriz +*form.left.bitmap: Left +*form.fold.width: 36 +*form.fold.height: 36 +*form.fold.fromVert: up +*form.fold.fromHoriz: left +*form.fold.bitmap: Fold +*form.right.width: 36 +*form.right.height: 36 +*form.right.fromVert: flipVert +*form.right.fromHoriz: fold +*form.right.bitmap: Right +*form.rotateLeft.width: 36 +*form.rotateLeft.height: 36 +*form.rotateLeft.fromVert: left +*form.rotateLeft.bitmap: RotateLeft +*form.down.width: 36 +*form.down.height: 36 +*form.down.fromVert: fold +*form.down.fromHoriz: rotateLeft +*form.down.bitmap: Down +*form.rotateRight.width: 36 +*form.rotateRight.height: 36 +*form.rotateRight.fromVert: right +*form.rotateRight.fromHoriz: down +*form.rotateRight.bitmap: RotateRight + +*form.point.vertDistance: 10 +*form.point.fromVert: rotateLeft +*form.point.radioGroup: move +*form.point.label: Point +*form.curve.fromVert: point +*form.curve.radioGroup: point +*form.curve.label: Curve +*form.line.fromVert: curve +*form.line.radioGroup: curve +*form.line.label: Line +*form.rectangle.fromVert: line +*form.rectangle.radioGroup: line +*form.rectangle.label: Rectangle +*form.filledRectangle.fromVert: rectangle +*form.filledRectangle.radioGroup: rectangle +*form.filledRectangle.label: Filled Rectangle +*form.circle.fromVert: filledRectangle +*form.circle.radioGroup: filledRectangle +*form.circle.label: Circle +*form.filledCircle.fromVert: circle +*form.filledCircle.radioGroup: circle +*form.filledCircle.label: Filled Circle +*form.floodFill.fromVert: filledCircle +*form.floodFill.radioGroup: filledCircle +*form.floodFill.label: Flood Fill + +*form.setHotSpot.vertDistance: 10 +*form.setHotSpot.fromVert: floodFill +*form.setHotSpot.radioGroup: floodFill +*form.setHotSpot.label: Set Hot Spot +*form.clearHotSpot.fromVert: setHotSpot +*form.clearHotSpot.label: Clear Hot Spot + +*form.undo.vertDistance: 10 +*form.undo.fromVert: clearHotSpot +*form.undo.label: Undo + + Index: xc/programs/bitmap/Bitmap.c diff -u xc/programs/bitmap/Bitmap.c:1.5 xc/programs/bitmap/Bitmap.c:1.6 --- xc/programs/bitmap/Bitmap.c:1.5 Wed Dec 26 16:39:34 2001 +++ xc/programs/bitmap/Bitmap.c Mon Feb 18 16:43:17 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.5 2001/12/26 21:39:34 paulo Exp $ */ +/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.6 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -47,9 +47,6 @@ #include <stdio.h> #include <math.h> -#ifndef abs -#define abs(x) ((((int)(x)) > 0) ? (x) : -(x)) -#endif #define min(x, y) ((((int)(x)) < (int)(y)) ? (x) : (y)) #define max(x, y) ((((int)(x)) > (int)(y)) ? (x) : (y)) Index: xc/programs/bitmap/CutPaste.c diff -u xc/programs/bitmap/CutPaste.c:1.4 xc/programs/bitmap/CutPaste.c:1.5 --- xc/programs/bitmap/CutPaste.c:1.4 Fri Dec 14 15:00:40 2001 +++ xc/programs/bitmap/CutPaste.c Mon Feb 18 16:43:17 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.5 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -40,9 +40,6 @@ #include <stdio.h> #include <math.h> -#ifndef abs -#define abs(x) (((x) > 0) ? (x) : -(x)) -#endif #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) Index: xc/programs/bitmap/Handlers.c diff -u xc/programs/bitmap/Handlers.c:1.4 xc/programs/bitmap/Handlers.c:1.5 --- xc/programs/bitmap/Handlers.c:1.4 Fri Dec 14 15:00:41 2001 +++ xc/programs/bitmap/Handlers.c Mon Feb 18 16:43:17 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.4 2001/12/14 20:00:41 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.5 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -39,9 +39,6 @@ #include <stdio.h> #include <math.h> -#ifndef abs -#define abs(x) (((int)(x) > 0) ? (x) : -(x)) -#endif #define min(x, y) (((int)(x) < (int)(y)) ? (x) : (y)) #define max(x, y) (((int)(x) > (int)(y)) ? (x) : (y)) Index: xc/programs/bitmap/Imakefile diff -u xc/programs/bitmap/Imakefile:3.5 xc/programs/bitmap/Imakefile:3.7 --- xc/programs/bitmap/Imakefile:3.5 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Imakefile Fri May 31 14:46:07 2002 @@ -3,8 +3,9 @@ -XCOMM $XFree86: xc/programs/bitmap/Imakefile,v 3.5 2001/01/17 23:44:51 dawes Exp $ +XCOMM $XFree86: xc/programs/bitmap/Imakefile,v 3.7 2002/05/31 18:46:07 dawes Exp $ +#if CaseSensitiveFileSystem BUTTONPICTURES = \ Dashes \ Down \ @@ -19,7 +20,25 @@ Stipple \ Term \ Up +#else +LinkFile(Stippler,Stipple) +BUTTONPICTURES = \ + Dashes \ + Down \ + Excl \ + FlipHoriz \ + FlipVert \ + Fold \ + Left \ + Right \ + RotateLeft \ + RotateRight \ + Stippler \ + Term \ + Up +#endif + #if HasMkstemp MKTMP_DEFINES = -DHAS_MKSTEMP #endif @@ -34,7 +53,7 @@ OBJS2 = bmtoa.o SRCS3 = atobm.c OBJS3 = atobm.o - PROGRAMS = bitmap bmtoa atobm + PROGRAMS = ProgramTargetName(bitmap) ProgramTargetName(bmtoa) ProgramTargetName(atobm) ComplexProgramTarget_1(bitmap,$(LOCAL_LIBRARIES),MathLibrary) NormalProgramTarget(bmtoa,$(OBJS2),NullParameter,$(XMULIB),NullParameter) @@ -42,7 +61,11 @@ BuildIncludes($(BUTTONPICTURES),X11/bitmaps,../..) +#if CaseSensitiveFileSystem InstallAppDefaults(Bitmap) +#else +InstallAppDefaultsLong(Bitmap-nocase,Bitmap) +#endif InstallAppDefaultsLong(Bitmap-co,Bitmap-color) InstallMultipleDestFlags(install,$(BUTTONPICTURES),$(INCDIR)/X11/bitmaps,$(INSTINCFLAGS)) Index: xc/programs/bitmap/ReqMach.c diff -u xc/programs/bitmap/ReqMach.c:1.4 xc/programs/bitmap/ReqMach.c:1.5 --- xc/programs/bitmap/ReqMach.c:1.4 Fri Dec 14 15:00:41 2001 +++ xc/programs/bitmap/ReqMach.c Mon Feb 18 16:43:17 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.4 2001/12/14 20:00:41 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.5 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -40,13 +40,6 @@ #include <stdio.h> #include <math.h> - -#ifndef abs -#define abs(x) (((x) > 0) ? (x) : -(x)) -#endif -#define min(x, y) (((x) < (y)) ? (x) : (y)) -#define max(x, y) (((x) > (y)) ? (x) : (y)) - extern Boolean DEBUG; Index: xc/programs/bitmap/bitmap.man diff -u xc/programs/bitmap/bitmap.man:1.7 xc/programs/bitmap/bitmap.man:1.8 --- xc/programs/bitmap/bitmap.man:1.7 Fri Dec 14 15:00:41 2001 +++ xc/programs/bitmap/bitmap.man Sat Oct 12 12:06:44 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/bitmap/bitmap.man,v 1.7 2001/12/14 20:00:41 dawes Exp $ +.\" $XFree86: xc/programs/bitmap/bitmap.man,v 1.8 2002/10/12 16:06:44 herrb Exp $ .\" .TH BITMAP 1 __xorgversion__ .SH NAME @@ -609,9 +609,8 @@ This will cause bitmap to pick up the colors in the app-defaults color customization file: .sp 1 - <XRoot>/lib/X11/app-defaults/Bitmap-color + __apploaddir__/Bitmap-color .sp 1 -where <XRoot> refers to the root of the X11 install tree. .fi .SH BITMAP WIDGET Bitmap widget is a stand-alone widget for editing raster images. It Index: xc/programs/dpsexec/dpsexec.c diff -u xc/programs/dpsexec/dpsexec.c:1.6 xc/programs/dpsexec/dpsexec.c:1.7 --- xc/programs/dpsexec/dpsexec.c:1.6 Mon Jan 7 15:38:29 2002 +++ xc/programs/dpsexec/dpsexec.c Tue Mar 5 16:50:15 2002 @@ -34,13 +34,14 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/programs/dpsexec/dpsexec.c,v 1.6 2002/01/07 20:38:29 dawes Exp $ */ +/* $XFree86: xc/programs/dpsexec/dpsexec.c,v 1.7 2002/03/05 21:50:15 herrb Exp $ */ #include <errno.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <signal.h> +#include <unistd.h> #include <sys/time.h> #include <X11/X.h> #include <DPS/XDPS.h> Index: xc/programs/editres/Edit-col.ad diff -u xc/programs/editres/Edit-col.ad:1.3 xc/programs/editres/Edit-col.ad:1.4 --- xc/programs/editres/Edit-col.ad:1.3 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/Edit-col.ad Thu Jul 4 13:04:23 2002 @@ -1,15 +1,15 @@ ! $Xorg: Edit-col.ad,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ ! Here are some suggested resources if you are using a color workstation. ! They look pretty good on my display, your mileage may vary. -! $XFree86: xc/programs/editres/Edit-col.ad,v 1.3 2001/01/17 23:44:52 dawes Exp $ +! $XFree86: xc/programs/editres/Edit-col.ad,v 1.4 2002/07/04 17:04:23 paulo Exp $ #include "Editres" *flashColor: Yellow *Background: RoyalBlue4 -*Foreground: Azure -*BorderColor: LightCyan1 +!*Foreground: Azure +!*BorderColor: LightCyan1 *cursorColor: Azure *Tree.Background: Grey @@ -37,3 +37,55 @@ *resourceBox*valueLabel.Background: Grey *resourceBox*valueLabel.Foreground: White *resourceBox*Command.Foreground: Gold + + + +*displayList: foreground rgb:20/35/73;lines 1,-1,-1,-1,-1,1;foreground rgb:30/4e/ab;lines -1,0,0,0,0,-1 +*Foreground: Azure3 +*borderColor: rgb:1d/30/69 +*internalBorderColor: rgb:1d/30/69 + +*SmeLine.lineWidth: 1 +*SmeLine.foreground: rgb:1d/30/69 +*SimpleMenu.VerticalMargins: 2 +*SimpleMenu.HorizontalMargins: 2 +*SimpleMenu.?.HorizontalMargins:8 + +*MenuButton.displayList: +*MenuButton.borderWidth: 1 +*MenuButton.borderColor: RoyalBlue4 +*MenuButton.shapeStyle: rectangle +*MenuButton.leftBitmap: None +*MenuButton.translations: \ +<Enter>: set-values(1, background, "rgb:29/44/94", borderColor, "rgb:1d/30/69", displayList, "foreground rgb:20/35/73;lines 1,-1,-1,-1,-1,1;foreground rgb:30/4e/ab;lines -1,0,0,0,0,-1")\n\ +<Leave>: set-values(1, background, RoyalBlue4, borderColor, RoyalBlue4, displayList, "")\n\ +Any<BtnDown>: set-values(1, background, "rgb:23/3a/7d", displayList, "foreground rgb:30/4e/ab;lines 1,-1,-1,-1,-1,1;foreground rgb:20/35/73;lines -1,0,0,0,0,-1") PopupMenu() + +*List.displayList: +*List.background: rgb:23/3a/7d + +*Tree.displayList: + +*Label.displayList: +*Paned.?.displayList: foreground rgb:20/35/73;lines 1,-1,-1,-1,-1,1;foreground rgb:30/4e/ab;lines -1,0,0,0,0,-1 + +*Grip.foreground: rgb:30/4e/ab + +*Toggle.displayList:\ +foreground rgb:30/4e/ab;\ +lines 1,-1,-1,-1,-1,1;\ +lines -2,1,1,1,1,-2;\ +foreground rgb:20/35/73;\ +lines -1,0,0,0,0,-1;\ +lines 2,-2,-2,-2,-2,2 + +*Text.background: rgb:29/44/94 +*Text.?.background: rgb:29/44/94 +*Text.displayList: foreground rgb:30/4e/ab;lines 1,-1,-1,-1,-1,1;foreground rgb:20/35/73;lines -1,0,0,0,0,-1 + +*Scrollbar.foreground: rgb:2e/4c/a5 +*Scrollbar.background: rgb:23/3a/7d +*Scrollbar.thumb: black + +*Command.shapeStyle: rectangle +*Command.background: rgb:29/44/94 Index: xc/programs/editres/Editres.ad diff -u xc/programs/editres/Editres.ad:1.3 xc/programs/editres/Editres.ad:1.4 --- xc/programs/editres/Editres.ad:1.3 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/Editres.ad Thu Jul 4 13:04:23 2002 @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/editres/Editres.ad,v 1.3 2001/01/17 23:44:52 dawes Exp $ +! $XFree86: xc/programs/editres/Editres.ad,v 1.4 2002/07/04 17:04:23 paulo Exp $ ! ! The App-defaults file for Editres. @@ -144,7 +144,7 @@ ! Universal Resources for the Resource Box. *mainViewport*resourceLabel.font: \ --*-new century schoolbook-bold-r-*-*-15-*-*-*-*-*-*-* +-*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-* *allowShellResize: True *resourceLabel.allowResize: True *List.verticalList: True @@ -152,15 +152,16 @@ *star.Label: * *dot.Label: . *namesLabel.font: \ --*-new century schoolbook-bold-r-*-*-15-*-*-*-*-*-*-* +-*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-* *constraintLabel.font: \ --*-new century schoolbook-bold-r-*-*-15-*-*-*-*-*-*-* +-*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-* *valueLabel.BorderWidth: 0 *valueForm*preferredPaneSize: 40 *valueForm*min: 28 *valueText*editType: edit *valueText.Scroll: WhenNeeded -*valueText.width: 300 +*valueText.width: 297 +*setValuesPopup*resourceText.width: 297 *setFile.Label: Set Save File *save.Label: Save *apply.Label: Apply @@ -263,6 +264,14 @@ Ctrl<Key>q,<Key>Tab: insert-char() \n\ <Btn1Down>: select-start() SVActiveEntry(Value)\n\ <Key>Tab: SVActiveEntry(Resource) + +*Text.translations: #override \ + m<Key>I: no-op(r)\n\ + c<Key>S: no-op(r)\n\ + c<Key>R: no-op(r)\n\ + <Key>Escape: no-op() + +*fileDialog.?.Text.width: 280 ! New resource settings *normalViewport.min: 19 Index: xc/programs/editres/editres.man diff -u xc/programs/editres/editres.man:1.8 xc/programs/editres/editres.man:1.9 --- xc/programs/editres/editres.man:1.8 Fri Dec 14 15:00:42 2001 +++ xc/programs/editres/editres.man Sat Oct 12 12:06:44 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/editres/editres.man,v 1.8 2001/12/14 20:00:42 dawes Exp $ +.\" $XFree86: xc/programs/editres/editres.man,v 1.9 2002/10/12 16:06:44 herrb Exp $ .\" .TH EDITRES 1 __xorgversion__ .SH NAME @@ -424,7 +424,9 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -<XRoot>/lib/X11/app-defaults/Editres - specifies required resources +.TP +.I __apploaddir__/Editres +specifies required resources .SH SEE ALSO X(__miscmansuffix__), xrdb(1), Athena Widget Set .SH RESTRICTIONS Index: xc/programs/glxinfo/Imakefile diff -u xc/programs/glxinfo/Imakefile:1.4 xc/programs/glxinfo/Imakefile:1.8 --- xc/programs/glxinfo/Imakefile:1.4 Mon Apr 2 16:58:45 2001 +++ xc/programs/glxinfo/Imakefile Fri Nov 22 17:56:03 2002 @@ -1,8 +1,20 @@ -XCOMM $XFree86: xc/programs/glxinfo/Imakefile,v 1.4 2001/04/02 20:58:45 dawes Exp $ +XCOMM $XFree86: xc/programs/glxinfo/Imakefile,v 1.8 2002/11/22 22:56:03 tsi Exp $ #include <Threads.tmpl> + +#if BuildGLULibrary + DEPLIBS = $(DEPGLULIB) $(DEPGLXLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(GLULIB) $(GLXLIB) $(XLIB) + DEFINES = -DDO_GLU + +#else + + DEPLIBS = $(DEPGLXLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(GLXLIB) $(XLIB) + +#endif + SYS_LIBRARIES = MathLibrary SimpleProgramTarget(glxinfo) Index: xc/programs/glxinfo/glxinfo.c diff -u xc/programs/glxinfo/glxinfo.c:1.7 xc/programs/glxinfo/glxinfo.c:1.10 --- xc/programs/glxinfo/glxinfo.c:1.7 Fri Aug 17 09:27:57 2001 +++ xc/programs/glxinfo/glxinfo.c Tue Nov 19 23:43:50 2002 @@ -1,7 +1,6 @@ -/* Id: glxinfo.c,v 1.12 2001/03/23 21:41:44 brianp Exp $ */ /* - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -20,8 +19,9 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/glxinfo/glxinfo.c,v 1.7 2001/08/17 13:27:57 dawes Exp $ */ +/* $XFree86: xc/programs/glxinfo/glxinfo.c,v 1.10 2002/11/20 04:43:50 dawes Exp $ */ + /* * This program is a work-alike of the IRIX glxinfo program. * Command line options: @@ -29,12 +29,12 @@ * -v print verbose information * -display DisplayName specify the X display to interogate * -b only print ID of "best" visual on screen 0 + * -i use indirect rendering connection only + * -l print interesting OpenGL limits (added 5 Sep 2002) * * Brian Paul 26 January 2000 */ -#define DO_GLU - #include <X11/Xlib.h> #include <X11/Xutil.h> #include <GL/gl.h> @@ -51,6 +51,9 @@ #define GLX_NONE_EXT 0x8000 #endif +#ifndef GLX_TRANSPARENT_RGB +#define GLX_TRANSPARENT_RGB 0x8008 +#endif typedef enum { @@ -72,7 +75,12 @@ /* GL visual attribs */ int supportsGL; - int transparent; + int transparentType; + int transparentRedValue; + int transparentGreenValue; + int transparentBlueValue; + int transparentAlphaValue; + int transparentIndexValue; int bufferSize; int level; int rgba; @@ -147,8 +155,60 @@ } +static void +print_limits(void) +{ + struct token_name { + GLuint count; + GLenum token; + const char *name; + }; + static const struct token_name limits[] = { + { 1, GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH" }, + { 1, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH" }, + { 1, GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES" }, + { 1, GL_MAX_COLOR_MATRIX_STACK_DEPTH, "GL_MAX_COLOR_MATRIX_STACK_DEPTH" }, + { 1, GL_MAX_ELEMENTS_VERTICES, "GL_MAX_ELEMENTS_VERTICES" }, + { 1, GL_MAX_ELEMENTS_INDICES, "GL_MAX_ELEMENTS_INDICES" }, + { 1, GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER" }, + { 1, GL_MAX_LIGHTS, "GL_MAX_LIGHTS" }, + { 1, GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING" }, + { 1, GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH" }, + { 1, GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH" }, + { 1, GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE" }, + { 1, GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH" }, + { 1, GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH" }, + { 1, GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE" }, + { 1, GL_MAX_3D_TEXTURE_SIZE, "GL_MAX_3D_TEXTURE_SIZE" }, + { 1, GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB" }, + { 1, GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV" }, + { 1, GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB" }, + { 1, GL_MAX_TEXTURE_UNITS_ARB, "GL_MAX_TEXTURE_UNITS_ARB" }, + { 1, GL_MAX_TEXTURE_LOD_BIAS_EXT, "GL_MAX_TEXTURE_LOD_BIAS_EXT" }, + { 1, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT" }, + { 2, GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS" }, + { 2, GL_ALIASED_LINE_WIDTH_RANGE, "GL_ALIASED_LINE_WIDTH_RANGE" }, + { 2, GL_SMOOTH_LINE_WIDTH_RANGE, "GL_SMOOTH_LINE_WIDTH_RANGE" }, + { 2, GL_ALIASED_POINT_SIZE_RANGE, "GL_ALIASED_POINT_SIZE_RANGE" }, + { 2, GL_SMOOTH_POINT_SIZE_RANGE, "GL_SMOOTH_POINT_SIZE_RANGE" }, + { 0, (GLenum) 0, NULL } + }; + GLint i, max[2]; + printf("OpenGL limits:\n"); + for (i = 0; limits[i].count; i++) { + glGetIntegerv(limits[i].token, max); + if (glGetError() == GL_NONE) { + if (limits[i].count == 1) + printf(" %s = %d\n", limits[i].name, max[0]); + else /* XXX fix if we ever query something with more than 2 values */ + printf(" %s = %d, %d\n", limits[i].name, max[0], max[1]); + } + } +} + + static void -print_screen_info(Display *dpy, int scrnum) +print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) { Window win; int attribSingle[] = { @@ -192,7 +252,7 @@ 0, visinfo->depth, InputOutput, visinfo->visual, mask, &attr); - ctx = glXCreateContext( dpy, visinfo, NULL, True ); + ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect ); if (!ctx) { fprintf(stderr, "Error: glXCreateContext failed\n"); XDestroyWindow(dpy, win); @@ -218,7 +278,7 @@ const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS); #endif /* Strip the screen number from the display name, if present. */ - if (!(displayName = malloc(strlen(DisplayString(dpy)) + 1))) { + if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) { fprintf(stderr, "Error: malloc() failed\n"); exit(1); } @@ -247,6 +307,8 @@ printf("OpenGL version string: %s\n", glVersion); printf("OpenGL extensions:\n"); print_extension_list(glExtensions); + if (limits) + print_limits(); #ifdef DO_GLU printf("glu version: %s\n", gluVersion); printf("glu extensions:\n"); @@ -345,13 +407,30 @@ glXGetConfig(dpy, vInfo, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize); glXGetConfig(dpy, vInfo, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize); glXGetConfig(dpy, vInfo, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize); - - /* transparent pixel value not implemented yet */ - attribs->transparent = 0; - /* multisample tests not implemented yet */ - attribs->numSamples = 0; - attribs->numMultisample = 0; + /* get transparent pixel stuff */ + glXGetConfig(dpy, vInfo,GLX_TRANSPARENT_TYPE, &attribs->transparentType); + if (attribs->transparentType == GLX_TRANSPARENT_RGB) { + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue); + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue); + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue); + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue); + } + else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) { + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue); + } + + /* multisample attribs */ +#ifdef GLX_ARB_multisample + if (strstr("GLX_ARB_multisample", ext) == 0) { + glXGetConfig(dpy, vInfo, GLX_SAMPLE_BUFFERS_ARB, &attribs->numMultisample); + glXGetConfig(dpy, vInfo, GLX_SAMPLES_ARB, &attribs->numSamples); + } +#endif + else { + attribs->numSamples = 0; + attribs->numMultisample = 0; + } #if defined(GLX_EXT_visual_rating) if (ext && strstr(ext, "GLX_EXT_visual_rating")) { @@ -392,7 +471,15 @@ else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT) printf(" visualCaveat=Nonconformant\n"); #endif - printf(" %s\n", attribs->transparent ? "Transparent." : "Opaque."); + if (attribs->transparentType == GLX_NONE) { + printf(" Opaque.\n"); + } + else if (attribs->transparentType == GLX_TRANSPARENT_RGB) { + printf(" Transparent RGB: Red=%d Green=%d Blue=%d Alpha=%d\n",attribs->transparentRedValue,attribs->transparentGreenValue,attribs->transparentBlueValue,attribs->transparentAlphaValue); + } + else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) { + printf(" Transparent index=%d\n",attribs->transparentIndexValue); + } } @@ -408,7 +495,7 @@ static void print_visual_attribs_short(const struct visual_attribs *attribs) { - char *caveat; + char *caveat = NULL; #ifdef GLX_EXT_visual_rating if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0) caveat = "None"; @@ -426,7 +513,7 @@ attribs->id, attribs->depth, visual_class_abbrev(attribs->klass), - attribs->transparent, + attribs->transparentType != GLX_NONE, attribs->bufferSize, attribs->level, attribs->rgba ? "r" : "c", @@ -464,7 +551,7 @@ attribs->id, attribs->depth, visual_class_name(attribs->klass), - attribs->transparent, + attribs->transparentType != GLX_NONE, attribs->bufferSize, attribs->level, attribs->rgba ? "rgba" : "ci ", @@ -488,16 +575,16 @@ static void print_visual_info(Display *dpy, int scrnum, InfoMode mode) { - XVisualInfo template; + XVisualInfo theTemplate; XVisualInfo *visuals; int numVisuals; long mask; int i; /* get list of all visuals on this screen */ - template.screen = scrnum; + theTemplate.screen = scrnum; mask = VisualScreenMask; - visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals); + visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals); if (mode == Verbose) { for (i = 0; i < numVisuals; i++) { @@ -571,7 +658,7 @@ static int find_best_visual(Display *dpy, int scrnum) { - XVisualInfo template; + XVisualInfo theTemplate; XVisualInfo *visuals; int numVisuals; long mask; @@ -579,9 +666,9 @@ struct visual_attribs bestVis; /* get list of all visuals on this screen */ - template.screen = scrnum; + theTemplate.screen = scrnum; mask = VisualScreenMask; - visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals); + visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals); /* init bestVis with first visual info */ get_visual_attribs(dpy, &visuals[0], &bestVis); @@ -619,6 +706,20 @@ } +static void +usage(void) +{ + printf("Usage: glxinfo [-v] [-t] [-h] [-i] [-b] [-display <dname>]\n"); + printf("\t-v: Print visuals info in verbose form.\n"); + printf("\t-t: Print verbose table.\n"); + printf("\t-display <dname>: Print GLX visuals on specified server.\n"); + printf("\t-h: This information.\n"); + printf("\t-i: Force an indirect rendering context.\n"); + printf("\t-b: Find the 'best' visual and print it's number.\n"); + printf("\t-l: Print interesting OpenGL limits.\n"); +} + + int main(int argc, char *argv[]) { @@ -627,6 +728,8 @@ int numScreens, scrnum; InfoMode mode = Normal; GLboolean findBest = GL_FALSE; + GLboolean limits = GL_FALSE; + Bool allowDirect = True; int i; for (i = 1; i < argc; i++) { @@ -643,10 +746,20 @@ else if (strcmp(argv[i], "-b") == 0) { findBest = GL_TRUE; } + else if (strcmp(argv[i], "-i") == 0) { + allowDirect = False; + } + else if (strcmp(argv[i], "-l") == 0) { + limits = GL_TRUE; + } + else if (strcmp(argv[i], "-h") == 0) { + usage(); + return 0; + } else { - fprintf(stderr, "Usage: %s [-t] [-v] [-b] [-display <display>]\n", - argv[0]); - return -1; + printf("Unknown option `%s'\n", argv[i]); + usage(); + return 0; } } @@ -667,7 +780,7 @@ print_display_info(dpy); for (scrnum = 0; scrnum < numScreens; scrnum++) { mesa_hack(dpy, scrnum); - print_screen_info(dpy, scrnum); + print_screen_info(dpy, scrnum, allowDirect, limits); printf("\n"); print_visual_info(dpy, scrnum, mode); if (scrnum + 1 < numScreens) Index: xc/programs/glxinfo/glxinfo.man diff -u xc/programs/glxinfo/glxinfo.man:1.5 xc/programs/glxinfo/glxinfo.man:1.6 --- xc/programs/glxinfo/glxinfo.man:1.5 Fri Dec 14 15:00:47 2001 +++ xc/programs/glxinfo/glxinfo.man Mon Sep 30 18:28:04 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.5 2001/12/14 20:00:47 dawes Exp $ +.\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.6 2002/09/30 22:28:04 alanh Exp $ .\" .TH GLXINFO 1 __vendorversion__ .SH NAME @@ -56,6 +56,12 @@ .TP 8 .B \-b Print the ID of the "best" visual on screen 0. +.TP 8 +.B \-l +Print interesting OpenGL limits. +.TP 8 +.B \-i +Use indirect rendering connection only. .TP 8 .BI "\-display " "displayname" Specify the display to query. Index: xc/programs/iceauth/process.c diff -u xc/programs/iceauth/process.c:3.7 xc/programs/iceauth/process.c:3.8 --- xc/programs/iceauth/process.c:3.7 Fri Dec 14 15:00:49 2001 +++ xc/programs/iceauth/process.c Fri May 31 14:46:07 2002 @@ -28,7 +28,7 @@ * Modified into "iceauth" : Ralph Mor, X Consortium */ -/* $XFree86: xc/programs/iceauth/process.c,v 3.7 2001/12/14 20:00:49 dawes Exp $ */ +/* $XFree86: xc/programs/iceauth/process.c,v 3.8 2002/05/31 18:46:07 dawes Exp $ */ #include "iceauth.h" #include <ctype.h> @@ -715,7 +715,7 @@ ProgramName, temp_name); } else { (void) unlink (iceauth_filename); -#if defined(WIN32) || defined(__EMX__) +#if defined(WIN32) || defined(__UNIXOS2__) if (rename(temp_name, iceauth_filename) == -1) #else if (link (temp_name, iceauth_filename) == -1) Index: xc/programs/ico/ico.c diff -u xc/programs/ico/ico.c:1.5 xc/programs/ico/ico.c:1.9 --- xc/programs/ico/ico.c:1.5 Wed Aug 29 07:09:44 2001 +++ xc/programs/ico/ico.c Tue Dec 24 12:43:00 2002 @@ -46,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/ico/ico.c,v 1.5 2001/08/29 11:09:44 alanh Exp $ */ +/* $XFree86: xc/programs/ico/ico.c,v 1.9 2002/12/24 17:43:00 tsi Exp $ */ /****************************************************************************** * Description @@ -166,7 +166,7 @@ * any additional threads are created */ -const char *Primaries[] = { +char *Primaries[] = { "red", "green", "blue", "yellow", "cyan", "magenta" }; #define NumberPrimaries 6 @@ -211,7 +211,7 @@ const char *geom = NULL; /* -geometry: window geometry */ int useRoot = 0; /* -r */ int dash = 0; /* -d: dashed line pattern */ -const char **colornames; /* -colors (points into argv) */ +char **colornames; /* -colors (points into argv) */ #ifdef MULTIBUFFER int update_action = MultibufferUpdateActionBackground; #endif @@ -245,8 +245,9 @@ * Error handling *****************************************************************************/ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -void icoFatal () __attribute__((__noreturn__)); +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) +void icoFatal (const char *fmt, const char *a0) __attribute__((__noreturn__)); #endif void icoFatal(fmt,a0) @@ -265,9 +266,8 @@ * Memory allocation *****************************************************************************/ -char * -xalloc(nbytes) - unsigned int nbytes; +static char * +xalloc(unsigned int nbytes) { char *p; @@ -285,9 +285,8 @@ * Sleep a certain number of milliseconds *****************************************************************************/ -void -msleep(msecs) - unsigned int msecs; +static void +msleep(unsigned int msecs) { struct timeval timeout; @@ -304,9 +303,8 @@ * *m Formatted identity matrix *****************************************************************************/ -void -IdentMat(m) - Transform3D m; +static void +IdentMat(Transform3D m) { int i; int j; @@ -331,11 +329,8 @@ * *m Result matrix *****************************************************************************/ -void -ConcatMat(l, r, m) - const Transform3D l; - const Transform3D r; - Transform3D m; +static void +ConcatMat(Transform3D l, Transform3D r, Transform3D m) { int i; int j; @@ -365,11 +360,8 @@ * *m Formatted rotation matrix *****************************************************************************/ -void -FormatRotateMat(axis, angle, m) - char axis; - double angle; - Transform3D m; +static void +FormatRotateMat(char axis, double angle, Transform3D m) { double s, c; @@ -416,12 +408,8 @@ * *out array of transformed non-homogeneous output points *****************************************************************************/ -void -PartialNonHomTransform(n, m, in, out) - int n; - const Transform3D m; - const Point3D *in; - Point3D *out; +static void +PartialNonHomTransform(int n, Transform3D m, const Point3D *in, Point3D *out) { for (; n > 0; --n, ++in, ++out) { out->x = in->x * m[0][0] + in->y * m[1][0] + in->z * m[2][0]; @@ -438,10 +426,8 @@ * Xlib had some kind of XWindowAnyEvent and XCheckWindowEvent. -- Casantos. */ -Bool predicate(display, event, args) - Display * display; - XEvent * event; - XPointer args; +static Bool +predicate(Display *display, XEvent *event, XPointer args) { Window w = (Window) args; return event->xany.window == w; @@ -452,10 +438,8 @@ * Icosahedron animator. *****************************************************************************/ -void -icoClearArea(closure,x,y,w,h) - struct closure *closure; - int x,y,w,h; +static void +icoClearArea(struct closure *closure, int x, int y, int w, int h) { if (multibufext && dblbuf) return; @@ -474,11 +458,8 @@ /* Set up points, transforms, etc. */ -void -initPoly(closure, poly, icoW, icoH) - struct closure *closure; - const Polyinfo *poly; - int icoW, icoH; +static void +initPoly(struct closure *closure, const Polyinfo *poly, int icoW, int icoH) { Point3D *vertices = poly->v; int NV = poly->numverts; @@ -496,10 +477,8 @@ closure->ho2 = icoH / 2.0; } -void -setDrawBuf (closure, n) - struct closure *closure; - int n; +static void +setDrawBuf (struct closure *closure, int n) { XGCValues xgcv; unsigned long mask; @@ -522,13 +501,10 @@ XChangeGC(dpy, closure->gcontext, mask, &xgcv); } -void -setDisplayBuf(closure, n, firsttime) - struct closure *closure; - int n; - int firsttime; +static void +setDisplayBuf(struct closure *closure, int n, int firsttime) { -#if MULTIBUFFER +#ifdef MULTIBUFFER if (multibufext && dblbuf) { XmbufDisplayBuffers (dpy, 1, &closure->multibuffers[n], msleepcount, 0); if (!firsttime) @@ -541,11 +517,8 @@ XStoreColors(dpy,closure->cmap,closure->dpybuf->colors,closure->totalpixels); } -void -setBufColor(closure, n,color) - struct closure *closure; - int n; /* color index */ - XColor *color; /* color to set */ +static void +setBufColor(struct closure *closure, int n, XColor *color) { int i,j,cx; DBufInfo *b; @@ -576,13 +549,9 @@ * prevX, prevY position of previous bounding-box *****************************************************************************/ -void -drawPoly(closure, poly, gc, icoX, icoY, icoW, icoH, prevX, prevY) - struct closure *closure; - Polyinfo *poly; - GC gc; - int icoX, icoY, icoW, icoH; - int prevX, prevY; +static void +drawPoly(struct closure *closure, Polyinfo *poly, GC gc, + int icoX, int icoY, int icoW, int icoH, int prevX, int prevY) { int *f = poly->f; int NV = poly->numverts; @@ -740,11 +709,8 @@ msleep(msleepcount); } -void -initDBufs(closure, fg,bg,planesperbuf) - struct closure *closure; - int fg,bg; - int planesperbuf; +static void +initDBufs(struct closure *closure, int fg, int bg, int planesperbuf) { int i,j,jj,j0,j1,k,m,t; DBufInfo *b, *otherb; @@ -776,7 +742,7 @@ closure->plane_masks,closure->totalplanes, closure->pixels,1); /* allocate color planes */ if (t==0) { - icoFatal("can't allocate enough color planes"); + icoFatal("can't allocate enough color planes", NULL); } } @@ -827,11 +793,8 @@ } } -void -setBufColname(closure, n,colname) - struct closure *closure; - int n; - char *colname; +static void +setBufColname(struct closure *closure, int n, char *colname) { int t; XColor dcolor, color; @@ -845,9 +808,8 @@ /* function to create and run an ico window */ -void * -do_ico_window(closure) - struct closure *closure; +static void * +do_ico_window(void *ptr) { int fg, bg; XSetWindowAttributes xswa; @@ -865,6 +827,7 @@ KeySym ksym; Bool do_it = True; char buf[20]; + struct closure *closure = ptr; #ifdef MULTITHREAD int len; #endif @@ -874,7 +837,7 @@ #endif closure->cmap = XDefaultColormap(dpy,DefaultScreen(dpy)); if (!closure->cmap) { - icoFatal("no default colormap!"); + icoFatal("no default colormap!", NULL); } fg = WhitePixel(dpy, DefaultScreen(dpy)); @@ -957,7 +920,7 @@ printf("thread %x got Expose\n", xthread_self()); #endif if (XGetWindowAttributes(dpy,closure->draw_window,&xwa)==0) { - icoFatal("cannot get window attributes (size)"); + icoFatal("cannot get window attributes (size)", NULL); } closure->winW = xwa.width; closure->winH = xwa.height; @@ -994,7 +957,7 @@ 0, 0, closure->winW, closure->winH, 0, 0); closure->win = closure->multibuffers[1]; } else - icoFatal ("unable to obtain 2 buffers"); + icoFatal ("unable to obtain 2 buffers", NULL); } #endif /* MULTIBUFFER */ if (closure->win == None) closure->win = closure->draw_window; @@ -1149,8 +1112,8 @@ * box inside the window. Call DrawIco() to redraw the icosahedron. *****************************************************************************/ -void -giveObjHelp() +static void +giveObjHelp(void) { int i; Polyinfo *poly; @@ -1166,9 +1129,8 @@ } } -Polyinfo * -findpoly(name) - const char *name; +static Polyinfo * +findpoly(const char *name) { int i; Polyinfo *poly; @@ -1183,7 +1145,7 @@ int main(argc, argv) int argc; - const char **argv; + char **argv; { const char *display = NULL; #ifdef MULTIBUFFER @@ -1316,7 +1278,7 @@ } if (!dofaces && !doedges) - icoFatal("nothing to draw"); + icoFatal("nothing to draw", NULL); #ifdef MULTITHREAD XInitThreads(); Index: xc/programs/lbxproxy/di/atomcache.c diff -u xc/programs/lbxproxy/di/atomcache.c:1.6 xc/programs/lbxproxy/di/atomcache.c:1.7 --- xc/programs/lbxproxy/di/atomcache.c:1.6 Fri Dec 14 15:00:50 2001 +++ xc/programs/lbxproxy/di/atomcache.c Mon Oct 14 22:16:26 2002 @@ -46,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/atomcache.c,v 1.6 2001/12/14 20:00:50 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/atomcache.c,v 1.7 2002/10/15 02:16:26 dawes Exp $ */ /* * atom cache for LBX @@ -134,22 +134,35 @@ } static Bool -ResizeReverseMap(server) +ResizeReverseMap(server, atom) XServerPtr server; + Atom atom; { - if (server->reverseMapSize == 0) + int oldMapSize = 0; + + /* has the map already been initialized? */ + if (server->reverseMapSize <= 0) server->reverseMapSize = 1000; else + /* keep track of the map size before we resize it */ + oldMapSize = server->reverseMapSize; + + /* grow the map until it is big enough */ + while (server->reverseMapSize < atom) server->reverseMapSize *= 2; - server->reverseMap = (AtomListPtr *) xrealloc(server->reverseMap, + /* resize the map */ + server->reverseMap = (AtomListPtr *) xrealloc(server->reverseMap, server->reverseMapSize * sizeof(AtomListPtr)); - bzero((char *)server->reverseMap, - (server->reverseMapSize * sizeof(AtomListPtr))); if (!server->reverseMap) + /* memory allocation problem */ return FALSE; + /* zero out the new portion of the map */ + bzero((char *) (server->reverseMap + oldMapSize), + ((server->reverseMapSize - oldMapSize) * sizeof(AtomListPtr))); + return TRUE; } @@ -224,7 +237,7 @@ } } if (server->reverseMapSize <= a->atom) - ResizeReverseMap(server); + ResizeReverseMap(server, a->atom); server->reverseMap[a->atom] = a; return a->atom; } Index: xc/programs/lbxproxy/di/cmaputil.c diff -u xc/programs/lbxproxy/di/cmaputil.c:1.10 xc/programs/lbxproxy/di/cmaputil.c:1.11 --- xc/programs/lbxproxy/di/cmaputil.c:1.10 Fri Dec 14 15:00:50 2001 +++ xc/programs/lbxproxy/di/cmaputil.c Fri May 31 14:46:07 2002 @@ -48,7 +48,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/cmaputil.c,v 1.10 2001/12/14 20:00:50 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/cmaputil.c,v 1.11 2002/05/31 18:46:07 dawes Exp $ */ #include <stdio.h> #include "misc.h" @@ -244,7 +244,7 @@ return TRUE; if (!have_rgb_db) { -#ifdef __EMX__ +#ifdef __UNIXOS2__ rgbPath = (char*)__XOS2RedirRoot(rgbPath); #endif path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5); Index: xc/programs/lbxproxy/di/lbxfuncs.c diff -u xc/programs/lbxproxy/di/lbxfuncs.c:1.5 xc/programs/lbxproxy/di/lbxfuncs.c:1.6 --- xc/programs/lbxproxy/di/lbxfuncs.c:1.5 Sat Oct 27 23:34:22 2001 +++ xc/programs/lbxproxy/di/lbxfuncs.c Wed Sep 18 13:11:50 2002 @@ -22,7 +22,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/lbxfuncs.c,v 1.5 2001/10/28 03:34:22 tsi Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/lbxfuncs.c,v 1.6 2002/09/18 17:11:50 tsi Exp $ */ /* * top level LBX request & reply handling @@ -141,14 +141,14 @@ ClientPtr client; Bool success; int majorVer, minorVer; - char *cs; + void *cs; int cs_len; { xConnSetupPrefix reply; reply.success = success; if (!success) { - reply.lengthReason = strlen(cs); + reply.lengthReason = strlen((char *)cs); cs_len = reply.lengthReason + 3; } reply.majorVersion = majorVer; Index: xc/programs/lbxproxy/di/pm.c diff -u xc/programs/lbxproxy/di/pm.c:1.8 xc/programs/lbxproxy/di/pm.c:1.9 --- xc/programs/lbxproxy/di/pm.c:1.8 Fri Dec 14 15:00:52 2001 +++ xc/programs/lbxproxy/di/pm.c Mon Sep 16 14:06:20 2002 @@ -25,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/lbxproxy/di/pm.c,v 1.8 2001/12/14 20:00:52 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/pm.c,v 1.9 2002/09/16 18:06:20 eich Exp $ */ #include <ctype.h> #include <stdio.h> @@ -190,7 +190,7 @@ if ((PM_iceConn = IceOpenConnection ( pmAddr, NULL, 0, 0, sizeof(iceError), iceError)) == NULL) { - sprintf (errorString, + snprintf (errorString, sizeof(errorString), "Could not open ICE connection to proxy manager: %s", iceError); return 0; } @@ -203,7 +203,7 @@ if (setupstat != IceProtocolSetupSuccess) { IceCloseConnection (PM_iceConn); - sprintf (errorString, + snprintf (errorString,sizeof(errorString), "Could not initialize proxy management protocol: %s", iceError); return 0; Index: xc/programs/lbxproxy/di/utils.c diff -u xc/programs/lbxproxy/di/utils.c:1.13 xc/programs/lbxproxy/di/utils.c:1.15 --- xc/programs/lbxproxy/di/utils.c:1.13 Fri Dec 14 15:00:53 2001 +++ xc/programs/lbxproxy/di/utils.c Sun Dec 8 23:10:58 2002 @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/di/utils.c,v 1.13 2001/12/14 20:00:53 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/utils.c,v 1.15 2002/12/09 04:10:58 tsi Exp $ */ #include "lbx.h" #include <stdio.h> @@ -273,7 +273,7 @@ void ShowHelpAndExit (status) - + int status; { UseMsg (); exit (status); @@ -868,7 +868,7 @@ return FALSE; } -#ifdef __EMX__ +#ifdef __UNIXOS2__ /* This code is duplicated from XLibInt.c, because the same problems with * the drive letter as in clients also exist in the server * Unfortunately the standalone servers don't link against libX11 @@ -921,7 +921,7 @@ server->atom_control = NULL; min_keep_prop_size = DEF_KEEP_PROP_SIZE; -#ifdef __EMX__ +#ifdef __UNIXOS2__ atomsFile = (char*)__XOS2RedirRoot(atomsFile); #endif if (!(f = fopen (atomsFile, "r"))) { Index: xc/programs/lbxproxy/di/wire.c diff -u xc/programs/lbxproxy/di/wire.c:1.12 xc/programs/lbxproxy/di/wire.c:1.14 --- xc/programs/lbxproxy/di/wire.c:1.12 Fri Dec 14 15:00:53 2001 +++ xc/programs/lbxproxy/di/wire.c Thu Sep 19 09:22:03 2002 @@ -45,7 +45,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/wire.c,v 1.12 2001/12/14 20:00:53 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/wire.c,v 1.14 2002/09/19 13:22:03 tsi Exp $ */ #include "lbx.h" #include <stdio.h> @@ -1532,9 +1532,10 @@ return FALSE; } bzero(server, sizeof(XServerRec)); + if (!InitServer (dpy_name, i, server, &sequence)) { if (proxyMngr) { - (void) sprintf (proxy_address, + (void) snprintf (proxy_address, sizeof(proxy_address), "could not connect to server '%s'", dpy_name); SendGetProxyAddrReply( PM_iceConn, PM_Failure, NULL, proxy_address); @@ -1560,13 +1561,19 @@ #ifdef NEED_UTSNAME uname (&name); - (void) strcpy (my_host, name.nodename); + (void) snprintf(my_host,sizeof(my_host),"%s",name.nodename); #else - (void) gethostname (my_host, 250); + (void) gethostname (my_host,sizeof(my_host)); #endif } - (void) sprintf (proxy_address, "%s:%s", my_host, display); - + if (snprintf (proxy_address, sizeof(proxy_address) ,"%s:%s", my_host, + display) >= sizeof(proxy_address)) { + (void) snprintf (proxy_address, sizeof(proxy_address), + "display name too long"); + SendGetProxyAddrReply( PM_iceConn, PM_Failure, NULL, proxy_address); + return FALSE; + } + servers[i] = server; sc = AllocNewConnection(server->fd, -1, TRUE, NULL); Index: xc/programs/lbxproxy/os/Imakefile diff -u xc/programs/lbxproxy/os/Imakefile:1.8 xc/programs/lbxproxy/os/Imakefile:1.9 --- xc/programs/lbxproxy/os/Imakefile:1.8 Mon Apr 23 12:17:13 2001 +++ xc/programs/lbxproxy/os/Imakefile Wed Dec 4 05:28:08 2002 @@ -3,10 +3,19 @@ -XCOMM $XFree86: xc/programs/lbxproxy/os/Imakefile,v 1.8 2001/04/23 16:17:13 tsi Exp $ +XCOMM $XFree86: xc/programs/lbxproxy/os/Imakefile,v 1.9 2002/12/04 10:28:08 eich Exp $ #include <Server.tmpl> +#if !HasSnprintf + +SNPRINTF_SRC = snprintf.c +SNPRINTF_OBJ = snprintf.o + +LinkSourceFile(snprintf.c,$(LIBSRC)/misc) + +#endif + DEFINES = $(CONNECTION_FLAGS) $(RPC_DEFINES) \ AllocateLocalDefines ServerOSDefines $(SIGNAL_DEFINES) DEPEND_DEFINES = $(TRANS_INCLUDES) DependDefines @@ -14,9 +23,9 @@ INCLUDES = -I../include -I$(TOP)/include -I$(EXTINCSRC) \ -I../../../include/extensions - SRCS = connection.c io.c WaitFor.c osinit.c transport.c + SRCS = connection.c io.c WaitFor.c osinit.c transport.c $(SNPRINTF_SRC) - OBJS = connection.o io.o WaitFor.o osinit.o transport.o + OBJS = connection.o io.o WaitFor.o osinit.o transport.o $(SNPRINTF_OBJ) CONN_DEFINES = -DLBXPROXY_t -DTRANS_SERVER Index: xc/programs/lbxproxy/os/connection.c diff -u xc/programs/lbxproxy/os/connection.c:1.16 xc/programs/lbxproxy/os/connection.c:1.18 --- xc/programs/lbxproxy/os/connection.c:1.16 Fri Dec 14 15:00:57 2001 +++ xc/programs/lbxproxy/os/connection.c Sat Jul 6 05:59:17 2002 @@ -60,7 +60,7 @@ * socket ids aren't small nums (0 - 2^8) * *****************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/connection.c,v 1.16 2001/12/14 20:00:57 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/connection.c,v 1.18 2002/07/06 09:59:17 alanh Exp $ */ #include "misc.h" #include <X11/Xtrans.h> @@ -88,7 +88,7 @@ #if defined (TCPCONN) || defined(STREAMSCONN) # include <netinet/in.h> -# if !defined(hpux) && !defined(__CYGWIN__) +# if !defined(hpux) # ifdef apollo # ifndef NO_TCP_H # include <netinet/tcp.h> @@ -202,7 +202,7 @@ { lastfdesc = -1; -#ifndef __EMX__ +#ifndef __UNIXOS2__ #if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX) lastfdesc = sysconf(_SC_OPEN_MAX) - 1; @@ -218,7 +218,7 @@ lastfdesc = _NFILE - 1; #endif -#else /* __EMX__ */ +#else /* __UNIXOS2__ */ lastfdesc = 255; #endif Index: xc/programs/lbxproxy/os/osdep.h diff -u xc/programs/lbxproxy/os/osdep.h:1.10 xc/programs/lbxproxy/os/osdep.h:1.11 --- xc/programs/lbxproxy/os/osdep.h:1.10 Fri Dec 14 15:00:58 2001 +++ xc/programs/lbxproxy/os/osdep.h Fri May 31 14:46:08 2002 @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/osdep.h,v 1.10 2001/12/14 20:00:58 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/osdep.h,v 1.11 2002/05/31 18:46:08 dawes Exp $ */ #define BOTIMEOUT 200 /* in milliseconds */ #define BUFSIZE 4096 @@ -66,7 +66,7 @@ #endif #endif -#if defined(__EMX__) || defined(__QNX__) +#if defined(__UNIXOS2__) || defined(__QNX__) #define OPEN_MAX 256 #endif Index: xc/programs/luit/Imakefile diff -u xc/programs/luit/Imakefile:1.1 xc/programs/luit/Imakefile:1.2 --- xc/programs/luit/Imakefile:1.1 Thu Nov 1 22:06:43 2001 +++ xc/programs/luit/Imakefile Wed Oct 16 21:06:09 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/luit/Imakefile,v 1.1 2001/11/02 03:06:43 dawes Exp $ +XCOMM $XFree86: xc/programs/luit/Imakefile,v 1.2 2002/10/17 01:06:09 dawes Exp $ #ifndef LocaleAliasFile #define LocaleAliasFile \ @@ -10,9 +10,9 @@ SYS_LIBRARIES = MathLibrary GzipLibrary -SRCS = luit.c iso2022.c charset.c parser.c sys.c +SRCS = luit.c iso2022.c charset.c parser.c sys.c other.c -OBJS = luit.o iso2022.o charset.o parser.o sys.o +OBJS = luit.o iso2022.o charset.o parser.o sys.o other.o DEFINES = -DLOCALE_ALIAS_FILE=\"LocaleAliasFile\" Index: xc/programs/luit/charset.c diff -u xc/programs/luit/charset.c:1.1 xc/programs/luit/charset.c:1.7 --- xc/programs/luit/charset.c:1.1 Thu Nov 1 22:06:43 2001 +++ xc/programs/luit/charset.c Sun Feb 23 20:10:25 2003 @@ -19,12 +19,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/programs/luit/charset.c,v 1.7 2003/02/24 01:10:25 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <X11/fonts/fontenc.h> +#include "other.h" #include "charset.h" #include "parser.h" @@ -107,8 +109,15 @@ {"ISO 8859-7", T_96, 'F', "iso8859-7", 0x80, 0, 0}, {"ISO 8859-8", T_96, 'H', "iso8859-8", 0x80, 0, 0}, {"ISO 8859-9", T_96, 'M', "iso8859-9", 0x80, 0, 0}, + {"ISO 8859-10", T_96, 'V', "iso8859-10", 0x80, 0, 0}, + {"ISO 8859-11", T_96, 'T', "iso8859-11", 0x80, 0, 0}, + {"TIS 620", T_96, 'T', "iso8859-11", 0x80, 0, 0}, + {"ISO 8859-13", T_96, 'Y', "iso8859-13", 0x80, 0, 0}, + {"ISO 8859-14", T_96, '_', "iso8859-14", 0x80, 0, 0}, {"ISO 8859-15", T_96, 'b', "iso8859-15", 0x80, 0, 0}, + {"ISO 8859-16", T_96, 'f', "iso8859-16", 0x80, 0, 0}, {"KOI8-E", T_96, '@', "koi8-e", 0x80, 0, 0}, + {"TCVN", T_96, 'Z', "tcvn-0", 0x80, 0, 0}, {"GB 2312", T_9494, 'A', "gb2312.1980-0", 0x0000, 0, 0}, {"JIS X 0208", T_9494, 'B', "jisx0208.1990-0", 0x0000, 0, 0}, @@ -131,7 +140,20 @@ {0, 0, 0, 0, 0, 0, 0} }; - +typedef struct _OtherCharset { + char *name; + int (*init)(OtherStatePtr); + unsigned int (*mapping)(unsigned int, OtherStatePtr); + unsigned int (*reverse)(unsigned int, OtherStatePtr); + int (*stack)(unsigned char, OtherStatePtr); +} OtherCharsetRec, *OtherCharsetPtr; + +OtherCharsetRec otherCharsets[] = { + {"GBK", init_gbk, mapping_gbk, reverse_gbk, stack_gbk}, + {"UTF-8", init_utf8, mapping_utf8, reverse_utf8, stack_utf8}, + {"SJIS", init_sjis, mapping_sjis, reverse_sjis, stack_sjis}, + {0, 0, 0, 0, 0} +}; static int compare(char *s, char *t) @@ -236,7 +258,7 @@ if(!fc->name) return NULL; - + c = malloc(sizeof(CharsetRec)); if(c == NULL) return NULL; @@ -267,8 +289,53 @@ return c; } +static CharsetPtr +getOtherCharset(char *name) +{ + OtherCharsetPtr fc; + CharsetPtr c; + OtherStatePtr s; + + fc = otherCharsets; + while(fc->name) { + if(name && !compare(fc->name, name)) + break; + fc++; + } + + if(!fc->name) + return NULL; + + c = malloc(sizeof(CharsetRec)); + if(c == NULL) + return NULL; + + s = malloc(sizeof(OtherState)); + if(s == NULL) { + free(c); + return NULL; + } + + c->name = fc->name; + c->type = T_OTHER; + c->final = 0; + c->data = fc; + c->other_recode = fc->mapping; + c->other_reverse = fc->reverse; + c->other_stack = fc->stack; + c->other_aux = s; + + if(!fc->init(s)) { + c->type = T_FAILED; + return NULL; + } + + cacheCharset(c); + return c; +} + CharsetPtr -getUnknownCharset(type) +getUnknownCharset(int type) { switch(type) { case T_94: return &Unknown94Charset; @@ -311,29 +378,44 @@ if(c) return c; + c = getOtherCharset(name); + if(c) + return c; + return getUnknownCharset(T_94); } LocaleCharsetRec localeCharsets[] = { - { "C", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL}, - { "ISO8859-1", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL}, - { "ISO8859-2", 0, 2, "ASCII", NULL, "ISO 8859-2", NULL}, - { "ISO8859-3", 0, 2, "ASCII", NULL, "ISO 8859-3", NULL}, - { "ISO8859-4", 0, 2, "ASCII", NULL, "ISO 8859-4", NULL}, - { "ISO8859-5", 0, 2, "ASCII", NULL, "ISO 8859-5", NULL}, - { "ISO8859-6", 0, 2, "ASCII", NULL, "ISO 8859-6", NULL}, - { "ISO8859-7", 0, 2, "ASCII", NULL, "ISO 8859-7", NULL}, - { "ISO8859-8", 0, 2, "ASCII", NULL, "ISO 8859-8", NULL}, - { "ISO8859-9", 0, 2, "ASCII", NULL, "ISO 8859-9", NULL}, - { "ISO8859-15", 0, 2, "ASCII", NULL, "ISO 8859-15", NULL}, - { "KOI8-R", 0, 2, "ASCII", NULL, "KOI8-R", NULL}, - { "CP1251", 0, 2, "ASCII", NULL, "CP 1251", NULL}, - { "eucCN", 0, 1, "ASCII", "GB 2312", NULL, NULL}, - { "GB2312", 0, 1, "ASCII", "GB 2312", NULL, NULL}, - { "eucJP", 0, 1, "ASCII", "JIS X 0208", "JIS X 0201:GR", "JIS X 0212"}, - { "eucKR", 0, 1, "ASCII", "KSC 5601", NULL, NULL}, - { "eucCN", 0, 1, "ASCII", "GB 2312", NULL, NULL}, - { "Big5", 0, 1, "ASCII", "Big 5", NULL, NULL}, + { "C", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL, NULL}, + { "POSIX", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL, NULL}, + { "ISO8859-1", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL, NULL}, + { "ISO8859-2", 0, 2, "ASCII", NULL, "ISO 8859-2", NULL, NULL}, + { "ISO8859-3", 0, 2, "ASCII", NULL, "ISO 8859-3", NULL, NULL}, + { "ISO8859-4", 0, 2, "ASCII", NULL, "ISO 8859-4", NULL, NULL}, + { "ISO8859-5", 0, 2, "ASCII", NULL, "ISO 8859-5", NULL, NULL}, + { "ISO8859-6", 0, 2, "ASCII", NULL, "ISO 8859-6", NULL, NULL}, + { "ISO8859-7", 0, 2, "ASCII", NULL, "ISO 8859-7", NULL, NULL}, + { "ISO8859-8", 0, 2, "ASCII", NULL, "ISO 8859-8", NULL, NULL}, + { "ISO8859-9", 0, 2, "ASCII", NULL, "ISO 8859-9", NULL, NULL}, + { "ISO8859-10", 0, 2, "ASCII", NULL, "ISO 8859-10", NULL, NULL}, + { "ISO8859-11", 0, 2, "ASCII", NULL, "ISO 8859-11", NULL, NULL}, + { "TIS620", 0, 2, "ASCII", NULL, "ISO 8859-11", NULL, NULL}, + { "ISO8859-13", 0, 2, "ASCII", NULL, "ISO 8859-13", NULL, NULL}, + { "ISO8859-14", 0, 2, "ASCII", NULL, "ISO 8859-14", NULL, NULL}, + { "ISO8859-15", 0, 2, "ASCII", NULL, "ISO 8859-15", NULL, NULL}, + { "ISO8859-16", 0, 2, "ASCII", NULL, "ISO 8859-16", NULL, NULL}, + { "KOI8-R", 0, 2, "ASCII", NULL, "KOI8-R", NULL, NULL}, + { "CP1251", 0, 2, "ASCII", NULL, "CP 1251", NULL, NULL}, + { "TCVN", 0, 2, "ASCII", NULL, "TCVN", NULL, NULL}, + { "eucCN", 0, 1, "ASCII", "GB 2312", NULL, NULL, NULL}, + { "GB2312", 0, 1, "ASCII", "GB 2312", NULL, NULL, NULL}, + { "eucJP", 0, 1, "ASCII", "JIS X 0208", "JIS X 0201:GR", "JIS X 0212", NULL}, + { "eucKR", 0, 1, "ASCII", "KSC 5601", NULL, NULL, NULL}, + { "eucCN", 0, 1, "ASCII", "GB 2312", NULL, NULL, NULL}, + { "Big5", 0, 1, "ASCII", "Big 5", NULL, NULL, NULL}, + { "gbk", 0, 1, NULL, NULL, NULL, NULL, "GBK"}, + { "UTF-8", 0, 1, NULL, NULL, NULL, NULL, "UTF-8"}, + { "SJIS", 0, 1, NULL, NULL, NULL, NULL, "SJIS"}, { 0, 0, 0, 0, 0, 0, 0} }; @@ -344,6 +426,10 @@ FontencCharsetPtr q; printf("Known locale encodings:\n\n"); for(p = localeCharsets; p->name; p++) { + if(p->other) { + printf(" %s (non-ISO-2022 encoding)\n", p->other); + continue; + } printf(" %s: GL -> G%d, GR -> G%d", p->name, p->gl, p->gr); if(p->g0) printf(", G0: %s", p->g0); if(p->g1) printf(", G1: %s", p->g1); @@ -359,30 +445,34 @@ } int -getLocaleState(char *locale, +getLocaleState(char *locale, char *charset, int *gl_return, int *gr_return, CharsetPtr *g0_return, CharsetPtr *g1_return, - CharsetPtr *g2_return, CharsetPtr *g3_return) + CharsetPtr *g2_return, CharsetPtr *g3_return, + CharsetPtr *other_return) { - char *resolved, *charset; + char *resolved = 0; LocaleCharsetPtr p; - resolved = resolveLocale(locale); - if(!resolved) - return -1; - charset = strrchr(resolved, '.'); - if(charset) - charset++; - else - charset = resolved; + if(!charset) { + resolved = resolveLocale(locale); + if(!resolved) + return -1; + charset = strrchr(resolved, '.'); + if(charset) + charset++; + else + charset = resolved; + } for(p = localeCharsets; p->name; p++) { - if(!strcmp(p->name, charset)) + if(compare(p->name, charset) == 0) break; } if(p->name == NULL) { - free(resolved); + if (resolved != 0) + free(resolved); return -1; } @@ -392,7 +482,10 @@ *g1_return = getCharsetByName(p->g1); *g2_return = getCharsetByName(p->g2); *g3_return = getCharsetByName(p->g3); - + if(p->other) + *other_return = getCharsetByName(p->other); + else + *other_return = NULL; return 0; } Index: xc/programs/luit/charset.h diff -u xc/programs/luit/charset.h:1.1 xc/programs/luit/charset.h:1.4 --- xc/programs/luit/charset.h:1.1 Thu Nov 1 22:06:43 2001 +++ xc/programs/luit/charset.h Wed Oct 16 21:06:09 2002 @@ -19,6 +19,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/programs/luit/charset.h,v 1.4 2002/10/17 01:06:09 dawes Exp $ */ #define T_FAILED 0 #define T_94 1 @@ -28,6 +29,7 @@ #define T_9696 5 /* Big 5 */ #define T_94192 6 +#define T_OTHER 7 /* True for charsets that pass control chars unchanged, at least in the first byte */ @@ -40,6 +42,10 @@ unsigned int (*recode)(unsigned int, struct _Charset *self); int (*reverse)(unsigned int, struct _Charset *self); void *data; + int (*other_stack)(unsigned char c, OtherStatePtr aux); + OtherState *other_aux; + unsigned int (*other_recode)(unsigned int c, OtherStatePtr aux); + unsigned int (*other_reverse)(unsigned int c, OtherStatePtr aux); struct _Charset *next; } CharsetRec, *CharsetPtr; @@ -51,13 +57,15 @@ char *g1; char *g2; char *g3; + char *other; } LocaleCharsetRec, *LocaleCharsetPtr; CharsetPtr getUnknownCharset(int); CharsetPtr getCharset(unsigned char, int); CharsetPtr getCharsetByName(char*); void reportCharsets(void); -int getLocaleState(char *locale, +int getLocaleState(char *locale, char *charset, int *gl_return, int *gr_return, CharsetPtr *g0_return, CharsetPtr *g1_return, - CharsetPtr *g2_return, CharsetPtr *g3_return); + CharsetPtr *g2_return, CharsetPtr *g3_return, + CharsetPtr *other_return); Index: xc/programs/luit/iso2022.c diff -u xc/programs/luit/iso2022.c:1.3 xc/programs/luit/iso2022.c:1.9 --- xc/programs/luit/iso2022.c:1.3 Wed Dec 19 16:29:02 2001 +++ xc/programs/luit/iso2022.c Sun Dec 8 15:19:49 2002 @@ -19,20 +19,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/luit/iso2022.c,v 1.3 2001/12/19 21:29:02 dawes Exp $ */ +/* $XFree86: xc/programs/luit/iso2022.c,v 1.9 2002/12/08 20:19:49 dickey Exp $ */ #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <stdarg.h> +#include <string.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> - +#include <X11/fonts/fontenc.h> #include "luit.h" +#include "sys.h" +#include "other.h" #include "charset.h" #include "iso2022.h" -#include "sys.h" #define BUFFERED_INPUT_SIZE 4 unsigned char buffered_input[BUFFERED_INPUT_SIZE]; @@ -177,12 +179,12 @@ if(!is) return NULL; is->glp = is->grp = NULL; - G0(is) = G1(is) = G2(is) = G3(is) = NULL; + G0(is) = G1(is) = G2(is) = G3(is) = OTHER(is) = NULL; is->parserState = P_NORMAL; is->shiftState = S_NORMAL; - is->inputFlags = IF_EIGHTBIT | IF_SS; + is->inputFlags = IF_EIGHTBIT | IF_SS | IF_SSGR; is->outputFlags = OF_SS | OF_LS | OF_SELECT; is->buffered = NULL; @@ -196,6 +198,7 @@ free(is); return NULL; } + is->outbuf_count = 0; return is; } @@ -228,6 +231,10 @@ void reportIso2022(Iso2022Ptr i) { + if(OTHER(i) != NULL) { + fprintf(stderr, "%s, non-ISO-2022 encoding.\n", OTHER(i)->name); + return; + } fprintf(stderr, "G0 is %s, ", G0(i)->name); fprintf(stderr, "G1 is %s, ", G1(i)->name); fprintf(stderr, "G2 is %s, ", G2(i)->name); @@ -237,16 +244,21 @@ } int -initIso2022(char *locale, Iso2022Ptr i) +initIso2022(char *locale, char *charset, Iso2022Ptr i) { int gl = 0, gr = 2; - CharsetPtr g0 = NULL, g1 = NULL, g2 = NULL, g3 = NULL; + CharsetPtr g0 = NULL, g1 = NULL, g2 = NULL, g3 = NULL, other = NULL; int rc; - rc = getLocaleState(locale, &gl, &gr, &g0, &g1, &g2, &g3); - if(rc < 0) - ErrorF("Warning: couldn't find charset data for locale %s; " - "using ISO 8859-1.\n", locale); + rc = getLocaleState(locale, charset, &gl, &gr, &g0, &g1, &g2, &g3, &other); + if(rc < 0) { + if(charset) + ErrorF("Warning: couldn't find charset %s; " + "using ISO 8859-1.\n", charset); + else + ErrorF("Warning: couldn't find charset data for locale %s; " + "using ISO 8859-1.\n", locale); + } if(g0) G0(i) = g0; @@ -268,6 +280,11 @@ else G3(i) = getUnknownCharset(T_94); + if(other) + OTHER(i) = other; + else + OTHER(i) = NULL; + i->glp = &i->g[gl]; i->grp = &i->g[gr]; return 0; @@ -284,6 +301,8 @@ G2(d) = G2(s); if(G3(d) == NULL) G3(d) = G3(s); + if(OTHER(d) == NULL) + OTHER(d) = OTHER(s); if(d->glp == NULL) d->glp = &(d->g[identifyCharset(s, s->glp)]); if(d->grp == NULL) @@ -291,7 +310,7 @@ return 0; } -int +static int utf8Count(unsigned char c) { /* All return values must be less than BUFFERED_INPUT_SIZE */ @@ -403,6 +422,14 @@ #define WRITE_2(i) do \ {obuf[0]=((i)>>8)&0xFF; obuf[1]=(i)&0xFF; write(fd, obuf, 2);} \ while(0) +#define WRITE_3(i) do \ + {obuf[0]=((i)>>16)&0xFF; obuf[1]=((i)>>8)&0xFF; obuf[2]=(i)&0xFF; \ + write(fd, obuf, 3);} \ + while(0) +#define WRITE_4(i) do \ + {obuf[0]=((i)>>24)&0xFF; obuf[1]=((i)>>16)&0xFF; obuf[2]=((i)>>8)&0xFF; \ + obuf[3]=(i)&0xFF; write(fd, obuf, 4);} \ + while(0) #define WRITE_1_P_8bit(p, i) \ {obuf[0]=(p); obuf[1]=(i); write(fd, obuf, 2);} #define WRITE_1_P_7bit(p, i) \ @@ -431,11 +458,20 @@ while(0) if(codepoint < 0x20 || - (CHARSET_REGULAR(GR(is)) && + (OTHER(is) == NULL && CHARSET_REGULAR(GR(is)) && (codepoint >= 0x80 && codepoint < 0xA0))) { WRITE_1(codepoint); continue; } + if(OTHER(is) != NULL) { + unsigned int c; + c = OTHER(is)->other_reverse(codepoint, OTHER(is)->other_aux); + if(c>>24) WRITE_4(c); + else if (c>>16) WRITE_3(c); + else if (c>>8) WRITE_2(c); + else if (c) WRITE_1(c); + continue; + } i = (GL(is)->reverse)(codepoint, GL(is)); if(i >= 0) { switch(GL(is)->type) { @@ -452,7 +488,7 @@ } continue; } - if(is->inputFlags & IF_EIGHTBIT) { + if(is->inputFlags & IF_EIGHTBIT) { i = GR(is)->reverse(codepoint, GR(is)); if(i >= 0) { switch(GR(is)->type) { @@ -477,12 +513,28 @@ if(i >= 0) { switch(GR(is)->type) { case T_94: case T_96: case T_128: - if(i >= 0x20) + if(i >= 0x20) { + if((is->inputFlags & IF_EIGHTBIT) && + (is->inputFlags & IF_SSGR)) + i |= 0x80; WRITE_1_P(SS2, i); + } break; - case T_9494: case T_9696: case T_94192: - if(i >= 0x2020) + case T_9494: case T_9696: + if(i >= 0x2020) { + if((is->inputFlags & IF_EIGHTBIT) && + (is->inputFlags & IF_SSGR)) + i |= 0x8080; WRITE_2_P(SS2, i); + } + break; + case T_94192: + if(i >= 0x2020) { + if((is->inputFlags & IF_EIGHTBIT) && + (is->inputFlags & IF_SSGR)) + i |= 0x8000; + WRITE_2_P(SS2, i); + } break; default: abort(); @@ -492,21 +544,35 @@ } if(is->inputFlags & IF_SS) { i = G3(is)->reverse(codepoint, G3(is)); - if(i > 0) { switch(GR(is)->type) { case T_94: case T_96: case T_128: - if(i >= 0x20) + if(i >= 0x20) { + if((is->inputFlags & IF_EIGHTBIT) && + (is->inputFlags & IF_SSGR)) + i |= 0x80; WRITE_1_P(SS3, i); + } break; - case T_9494: case T_9696: case T_94192: - if(i >= 0x2020) + case T_9494: case T_9696: + if(i >= 0x2020) { + if((is->inputFlags & IF_EIGHTBIT) && + (is->inputFlags & IF_SSGR)) + i |= 0x8080; WRITE_2_P(SS3, i); + } break; + case T_94192: + if(i >= 0x2020) { + if((is->inputFlags & IF_EIGHTBIT) && + (is->inputFlags & IF_SSGR)) + i |= 0x8000; + WRITE_2_P(SS3, i); + } + break; default: abort(); } continue; - } } if(is->inputFlags & IF_LS) { i = GR(is)->reverse(codepoint, GR(is)); @@ -555,6 +621,13 @@ if(*s == ESC) { buffer(is, *s++); is->parserState = P_ESC; + } else if(OTHER(is) != NULL) { + int c = OTHER(is)->other_stack(*s, OTHER(is)->other_aux); + if(c >= 0) { + outbufUTF8(is, fd, OTHER(is)->other_recode(c, OTHER(is)->other_aux)); + is->shiftState = S_NORMAL; + } + s++; } else if(*s == CSI && CHARSET_REGULAR(GR(is))) { buffer(is, *s++); is->parserState = P_CSI; @@ -569,7 +642,7 @@ s++; } else { CharsetPtr charset; - unsigned char code; + unsigned char code = 0; if(*s <= 0x7F) { switch(is->shiftState) { case S_NORMAL: charset = GL(is); break; @@ -579,7 +652,12 @@ } code = *s; } else { - charset = GR(is); + switch(is->shiftState) { + case S_NORMAL: charset = GR(is); break; + case S_SS2: charset = G2(is); break; + case S_SS3: charset = G3(is); break; + default: abort(); + } code = *s - 0x80; } @@ -614,7 +692,7 @@ } else { /* buffered_ku */ CharsetPtr charset; unsigned char ku_code; - int code; + unsigned code = 0; if(is->buffered_ku <= 0x7F) { switch(is->shiftState) { case S_NORMAL: charset = GL(is); break; @@ -625,15 +703,16 @@ ku_code = is->buffered_ku; if(*s < 0x80) code = *s; - else - code = -1; } else { - charset = GR(is); + switch(is->shiftState) { + case S_NORMAL: charset = GR(is); break; + case S_SS2: charset = G2(is); break; + case S_SS3: charset = G3(is); break; + default: abort(); + } ku_code = is->buffered_ku - 0x80; if(*s >= 0x80) code = *s - 0x80; - else - code = -1; } switch(charset->type) { case T_94: Index: xc/programs/luit/iso2022.h diff -u xc/programs/luit/iso2022.h:1.1 xc/programs/luit/iso2022.h:1.5 --- xc/programs/luit/iso2022.h:1.1 Thu Nov 1 22:06:43 2001 +++ xc/programs/luit/iso2022.h Wed Oct 16 21:06:09 2002 @@ -19,6 +19,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/programs/luit/iso2022.h,v 1.5 2002/10/17 01:06:09 dawes Exp $ */ #define ESC 0x1B #define CSI 0x9B @@ -49,6 +50,7 @@ #define IF_SS 1 #define IF_LS 2 #define IF_EIGHTBIT 4 +#define IF_SSGR 8 #define OF_SS 1 #define OF_LS 2 @@ -58,6 +60,7 @@ typedef struct _Iso2022 { CharsetPtr *glp, *grp; CharsetPtr g[4]; + CharsetPtr other; int parserState; int shiftState; int inputFlags; @@ -76,12 +79,13 @@ #define G1(i) ((i)->g[1]) #define G2(i) ((i)->g[2]) #define G3(i) ((i)->g[3]) +#define OTHER(i) ((i)->other) #define BUFFER_SIZE 512 Iso2022Ptr allocIso2022(void); void destroyIso2022(Iso2022Ptr); -int initIso2022(char *locale, Iso2022Ptr); +int initIso2022(char *, char *, Iso2022Ptr); int mergeIso2022(Iso2022Ptr, Iso2022Ptr); void reportIso2022(Iso2022Ptr); void terminate(Iso2022Ptr, int); Index: xc/programs/luit/luit.c diff -u xc/programs/luit/luit.c:1.4 xc/programs/luit/luit.c:1.10 --- xc/programs/luit/luit.c:1.4 Wed Jan 9 11:14:19 2002 +++ xc/programs/luit/luit.c Sun Feb 23 20:10:25 2003 @@ -19,7 +19,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/luit/luit.c,v 1.4 2002/01/09 16:14:19 dawes Exp $ */ +/* $XFree86: xc/programs/luit/luit.c,v 1.10 2003/02/24 01:10:25 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -38,8 +38,10 @@ #include <stropts.h> #endif +#include <X11/fonts/fontenc.h> #include "luit.h" #include "sys.h" +#include "other.h" #include "charset.h" #include "iso2022.h" @@ -51,6 +53,7 @@ int olog = -1; int verbose = 0; int converter = 0; +int exitOnChild = 0; volatile int sigwinch_queued = 0; volatile int sigchld_queued = 0; @@ -87,18 +90,19 @@ " [ -gl gn ] [-gr gk] " "[ -g0 set ] [ -g1 set ] " "[ -g2 set ] [ -g3 set ]\n" - " [ +oss ] [ +ols ] [ +osl ] [ +ot ]\n" + " [ -encoding encoding ] " + "[ +oss ] [ +ols ] [ +osl ] [ +ot ]\n" " [ -kgl gn ] [-kgr gk] " "[ -kg0 set ] [ -kg1 set ] " "[ -kg2 set ] [ -kg3 set ]\n" - " [ -k7 ] [ +kss ] [ -kls ]\n" - " [ -c ] [ -ilog filename ] [ -olog filename ] [ -- ]\n" + " [ -k7 ] [ +kss ] [ +kssgr ] [ -kls ]\n" + " [ -c ] [ -x ] [ -ilog filename ] [ -olog filename ] [ -- ]\n" " [ program [ args ] ]\n"); } -int +static int parseOptions(int argc, char **argv) { int i = 1; @@ -135,6 +139,9 @@ } else if(!strcmp(argv[i], "+kss")) { inputState->inputFlags &= ~IF_SS; i++; + } else if(!strcmp(argv[1], "+kssgr")) { + inputState->inputFlags &= ~IF_SSGR; + i++; } else if(!strcmp(argv[i], "-kls")) { inputState->inputFlags |= IF_LS; i++; @@ -249,6 +256,9 @@ FatalError("-argv0 requires an argument\n"); child_argv0 = argv[i + 1]; i += 2; + } else if(!strcmp(argv[i], "-x")) { + exitOnChild = 1; + i++; } else if(!strcmp(argv[i], "-c")) { converter = 1; i++; @@ -270,6 +280,14 @@ exit(1); } i += 2; + } else if(!strcmp(argv[i], "-encoding")) { + int rc; + if(i + 1 >= argc) + FatalError("-encoding requires an argument\n"); + rc = initIso2022(NULL, argv[i + 1], outputState); + if(rc < 0) + FatalError("Couldn't init output state\n"); + i += 2; } else { FatalError("Unknown option %s\n", argv[i]); } @@ -277,7 +295,7 @@ return i; } -int +static int parseArgs(int argc, char **argv, char *argv0, char **path_return, char ***argv_return) { @@ -359,16 +377,20 @@ locale_name = setlocale(LC_CTYPE, NULL); } else { locale_name = getenv("LC_ALL"); - if(locale_name == NULL) + if(locale_name == NULL) { locale_name = getenv("LC_CTYPE"); + if(locale_name == NULL) { + locale_name = getenv("LANG"); + } + } } if(locale_name == NULL) { - ErrorF("Couln't get locale name -- using C"); + ErrorF("Couldn't get locale name -- using C\n"); locale_name = "C"; } - rc = initIso2022(locale_name, outputState); + rc = initIso2022(locale_name, NULL, outputState); if(rc < 0) FatalError("Couldn't init output state\n"); @@ -383,11 +405,11 @@ if(converter) return convert(0, 1); else - return condom(argc - i, argv + 1); + return condom(argc - i, argv + i); } static int -convert(ifd, ofd) +convert(int ifd, int ofd) { int rc, i; unsigned char buf[BUFFER_SIZE]; @@ -546,9 +568,8 @@ setWindowSize(0, pty); } - if(sigchld_queued) { - /* quitting now would be a race condition */ - } + if(sigchld_queued && exitOnChild) + break; if(rc > 0) { if(rc & 2) { Index: xc/programs/luit/luit.man diff -u xc/programs/luit/luit.man:1.2 xc/programs/luit/luit.man:1.7 --- xc/programs/luit/luit.man:1.2 Wed Dec 19 16:29:02 2001 +++ xc/programs/luit/luit.man Sun Feb 23 20:10:25 2003 @@ -1,7 +1,7 @@ +.\" $XFree86: xc/programs/luit/luit.man,v 1.7 2003/02/24 01:10:25 dawes Exp $ .TH LUIT 1 __vendorversion__ .SH NAME luit \- Locale and ISO\ 2022 support for Unicode terminals - .SH SYNOPSIS .B luit [ @@ -13,9 +13,7 @@ [ .I args ] ] - .SH DESCRIPTION - .B Luit is a filter that can be run between an arbitrary application and a UTF-8 terminal emulator. It will convert application output from the @@ -27,14 +25,18 @@ feature is discouraged: multilingual applications should be modified to directly generate UTF-8 instead. +.B Luit +is usually invoked transparently by the terminal emulator. For +information about running +.B luit +from the command line, see EXAMPLES below. .SH OPTIONS - .TP .B \-h Display some summary help and quit. .TP .B \-list -List the supported charsets and quit. +List the supported charsets and encodings, then quit. .TP .B \-v Be verbose. @@ -42,9 +44,21 @@ .B \-c Function as a simple converter from standard input to standard output. .TP +.B \-x +Exit as soon as the child dies. This may cause +.B luit +to loose data at the end of the child's output. +.TP .BI \-argv0 " name" Set the child's name (as passed in argv[0]). .TP +.BI \-encoding " encoding" +Set up +.B luit +to use +.I encoding +rather than the current locale's encoding. +.TP .B +oss Disable interpretation of single shifts in application output. .TP @@ -63,9 +77,14 @@ .B \-k7 Generate seven-bit characters for keyboard input. .TP -.B \+kss +.B +kss Disable generation of single-shifts for keyboard input. .TP +.B +kssgr +Use GL codes after a single shift for keyboard input. By default, GR +codes are generated after a single shift when generating eight-bit +keyboard input. +.TP .B \-kls Generate locking shifts (SO/SI) for keyboard input. .TP @@ -115,52 +134,55 @@ .TP .B \-\- End of options. - .SH EXAMPLES - The most typical use of .B luit is to adapt an instance of +.B XTerm +to the locale's encoding. Current versions of .B XTerm -in UTF-8 mode to the locale's encoding. For most locales, this -doesn't require using any flags: +invoke +.B luit +automatically when it is needed. If you are using an older release of +.BR XTerm , +or a different terminal emulator, you may invoke +.B luit +manually: .IP $ xterm \-u8 \-e luit .PP - -.B Luit -may also be used with applications that hard-wire an encoding that is -different from the one normally used on the system. In order to use -such applications, you will need to directly manipulate -.BR luit 's -ISO\ 2022 state: +If you are running in a UTF-8 locale but need to access a remote +machine that doesn't support UTF-8, +.B luit +can adapt the remote output to your terminal: .IP -$ xterm \-u8 \-e luit \-g2 'CP 1252' +$ LC_ALL=fr_FR luit ssh legacy-machine .PP -The -.B \-v -flag may be used in order to examine -.BR luit 's -initial state. - -Future versions of -.B XTerm -will automatically invoke +.B Luit +is also useful with applications that hard-wire an encoding that is +different from the one normally used on the system or want to use +legacy escape sequences for multilingual output. In particular, +versions of +.B Emacs +that do not speak UTF-8 well can use .B luit -when necessary. - +for multilingual output: +.IP +$ luit -encoding 'ISO 8859-1' emacs -nw +.PP +And then, in +.BR Emacs , +.IP +M-x set-terminal-coding-system RET iso-2022-8bit-ss2 RET +.PP .SH FILES - .TP .B __projectroot__/lib/X11/fonts/encodings/encodings.dir The system-wide encodings directory. - .TP .B __projectroot__/lib/X11/locale/locale.alias The file mapping locales to locale encodings. - .SH SECURITY - On systems with SVR4 (``Unix-98'') ptys (Linux version 2.2 and later, SVR4), .B luit @@ -182,7 +204,6 @@ .B Luit will refuse to run if it is installed setuid and the underlying system does not have POSIX saved ids. - .SH BUGS None of this complexity should be necessary. Stateless UTF-8 throughout the system is the way to go. @@ -191,12 +212,10 @@ Selecting alternate sets of control characters is not supported and will never be. - .SH SEE ALSO xterm(1), unicode(7), utf-8(7), charsets(7). .I Character Code Structure and Extension Techniques (ISO\ 2022, ECMA-35). .I Control Functions for Coded Character Sets (ISO\ 6429, ECMA-48). - .SH AUTHOR Luit was written by Juliusz Chroboczek <jch@xfree86.org> for the XFree86 project. Index: xc/programs/luit/other.c diff -u /dev/null xc/programs/luit/other.c:1.1 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/luit/other.c Wed Oct 16 21:06:09 2002 @@ -0,0 +1,246 @@ +/* +Copyright (c) 2002 by Tomohiro KUBOTA + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/* $XFree86: xc/programs/luit/other.c,v 1.1 2002/10/17 01:06:09 dawes Exp $ */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <X11/fonts/fontenc.h> +#include "other.h" +#include "charset.h" + +#ifndef NULL +#define NULL 0 +#endif + +#define EURO_10646 0x20AC + +int +init_gbk(OtherStatePtr s) +{ + s->gbk.mapping = + FontEncMapFind("gbk-0", FONT_ENCODING_UNICODE, -1, -1, NULL); + if(!s->gbk.mapping) return 0; + + s->gbk.reverse = FontMapReverse(s->gbk.mapping); + if(!s->gbk.reverse) return 0; + + s->gbk.buf = -1; + return 1; +} + +unsigned int +mapping_gbk(unsigned int n, OtherStatePtr s) +{ + unsigned int r; + if(n < 128) return n; + if(n == 128) return EURO_10646; + r = FontEncRecode(n, s->gbk.mapping); + return r; +} + +unsigned int +reverse_gbk(unsigned int n, OtherStatePtr s) +{ + if(n < 128) return n; + if(n == EURO_10646) return 128; + return s->gbk.reverse->reverse(n, s->gbk.reverse->data); +} + +int +stack_gbk(unsigned char c, OtherStatePtr s) +{ + if(s->gbk.buf < 0) { + if(c < 129) return c; + s->gbk.buf = c; + return -1; + } else { + int b; + if(c < 0x40 || c == 0x7F) { + s->gbk.buf = -1; + return c; + } + if(s->gbk.buf < 0xFF && c < 0xFF) + b = (s->gbk.buf << 8) + c; + else + b = -1; + s->gbk.buf = -1; + return b; + } +} + +int +init_utf8(OtherStatePtr s) +{ + s->utf8.buf_ptr = 0; + return 1; +} + +unsigned int +mapping_utf8(unsigned int n, OtherStatePtr s) +{ + return n; +} + +unsigned int +reverse_utf8(unsigned int n, OtherStatePtr s) +{ + if(n < 0x80) + return n; + if(n < 0x800) + return 0xC080 + ((n&0x7C0)<<2) + (n&0x3F); + if(n < 0x10000) + return 0xE08080 + ((n&0xF000)<<4) + ((n&0xFC0)<<2) + (n&0x3F); + return 0xF0808080 + ((n&0x1C0000)<<6) + ((n&0x3F000)<<4) + + ((n&0xFC0)<<2) + (n&0x3F); +} + +int +stack_utf8(unsigned char c, OtherStatePtr s) +{ + int u; + + if(c < 0x80) { + s->utf8.buf_ptr = 0; + return c; + } + if(s->utf8.buf_ptr == 0) { + if((c & 0x40) == 0) return -1; + s->utf8.buf[s->utf8.buf_ptr++] = c; + if((c & 0x60) == 0x40) s->utf8.len = 2; + else if((c & 0x70) == 0x60) s->utf8.len = 3; + else if((c & 0x78) == 0x70) s->utf8.len = 4; + else s->utf8.buf_ptr = 0; + return -1; + } + if((c & 0x40) != 0) { + s->utf8.buf_ptr = 0; + return -1; + } + s->utf8.buf[s->utf8.buf_ptr++] = c; + if(s->utf8.buf_ptr < s->utf8.len) return -1; + switch(s->utf8.len) { + case 2: + u = ((s->utf8.buf[0] & 0x1F) << 6) | (s->utf8.buf[1] & 0x3F); + s->utf8.buf_ptr = 0; + if(u < 0x80) return -1; else return u; + case 3: + u = ((s->utf8.buf[0] & 0x0F) << 12) + | ((s->utf8.buf[1] & 0x3F) << 6) + | (s->utf8.buf[2] & 0x3F); + s->utf8.buf_ptr = 0; + if(u < 0x800) return -1; else return u; + case 4: + u = ((s->utf8.buf[0] & 0x03) << 18) + | ((s->utf8.buf[1] & 0x3F) << 12) + | ((s->utf8.buf[2] & 0x3F) << 6) + | ((s->utf8.buf[3] & 0x3F)); + s->utf8.buf_ptr = 0; + if(u < 0x10000) return -1; else return u; + } + s->utf8.buf_ptr = 0; + return -1; +} + + +#define HALFWIDTH_10646 0xFF61 +#define YEN_SJIS 0x5C +#define YEN_10646 0x00A5 +#define OVERLINE_SJIS 0x7E +#define OVERLINE_10646 0x203E + +int +init_sjis(OtherStatePtr s) +{ + s->sjis.x0208mapping = + FontEncMapFind("jisx0208.1990-0", FONT_ENCODING_UNICODE, -1, -1, NULL); + if(!s->sjis.x0208mapping) return 0; + + s->sjis.x0208reverse = FontMapReverse(s->sjis.x0208mapping); + if(!s->sjis.x0208reverse) return 0; + + s->sjis.x0201mapping = + FontEncMapFind("jisx0201.1976-0", FONT_ENCODING_UNICODE, -1, -1, NULL); + if(!s->sjis.x0201mapping) return 0; + + s->sjis.x0201reverse = FontMapReverse(s->sjis.x0201mapping); + if(!s->sjis.x0201reverse) return 0; + + s->sjis.buf = -1; + return 1; +} + +unsigned int +mapping_sjis(unsigned int n, OtherStatePtr s) +{ + unsigned int j1, j2, s1, s2; + if(n == YEN_SJIS) return YEN_10646; + if(n == OVERLINE_SJIS) return OVERLINE_10646; + if(n < 0x80) return n; + if(n >= 0xA0 && n <= 0xDF) return FontEncRecode(n, s->sjis.x0201mapping); + s1 = ((n>>8)&0xFF); + s2 = (n&0xFF); + j1 = (s1 << 1) - (s1 <= 0x9F ? 0xE0 : 0x160) - (s2 < 0x9F ? 1 : 0); + j2 = s2 - 0x1F - (s2 >= 0x7F ? 1 : 0) - (s2 >= 0x9F ? 0x5E : 0); + return FontEncRecode((j1<<8) + j2, s->sjis.x0208mapping); +} + +unsigned int +reverse_sjis(unsigned int n, OtherStatePtr s) +{ + unsigned int j, j1, j2, s1, s2; + if(n == YEN_10646) return YEN_SJIS; + if(n == OVERLINE_10646) return OVERLINE_SJIS; + if(n < 0x80) return n; + if(n >= HALFWIDTH_10646) + return s->sjis.x0201reverse->reverse(n, s->sjis.x0201reverse->data); + j = s->sjis.x0208reverse->reverse(n, s->sjis.x0208reverse->data); + j1 = ((j>>8)&0xFF); + j2 = (j&0xFF); + s1 = ((j1 - 1) >> 1) + ((j1 <= 0x5E) ? 0x71 : 0xB1); + s2 = j2 + ((j1 & 1) ? ((j2 < 0x60) ? 0x1F : 0x20) : 0x7E); + return (s1<<8) + s2; +} + +int +stack_sjis(unsigned char c, OtherStatePtr s) +{ + if(s->sjis.buf < 0) { + if(c < 128 || (c >= 0xA0 && c <= 0xDF)) return c; + s->sjis.buf = c; + return -1; + } else { + int b; + if(c < 0x40 || c == 0x7F) { + s->sjis.buf = -1; + return c; + } + if(s->sjis.buf < 0xFF && c < 0xFF) + b = (s->sjis.buf << 8) + c; + else + b = -1; + s->sjis.buf = -1; + return b; + } +} + Index: xc/programs/luit/other.h diff -u /dev/null xc/programs/luit/other.h:1.1 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/luit/other.h Wed Oct 16 21:06:09 2002 @@ -0,0 +1,63 @@ +/* +Copyright (c) 2002 by Tomohiro KUBOTA + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/* $XFree86: xc/programs/luit/other.h,v 1.1 2002/10/17 01:06:09 dawes Exp $ */ + +typedef struct { + FontMapPtr mapping; + FontMapReversePtr reverse; + int buf; +} aux_gbk; + +typedef struct { + unsigned char buf[4]; + int buf_ptr, len; +} aux_utf8; + +typedef struct { + FontMapPtr x0208mapping; + FontMapPtr x0201mapping; + FontMapReversePtr x0208reverse; + FontMapReversePtr x0201reverse; + int buf; +} aux_sjis; + +typedef union { + aux_gbk gbk; + aux_utf8 utf8; + aux_sjis sjis; +} OtherState, *OtherStatePtr; + +int init_gbk(OtherStatePtr); +unsigned int mapping_gbk(unsigned int, OtherStatePtr); +unsigned int reverse_gbk(unsigned int, OtherStatePtr); +int stack_gbk(unsigned char, OtherStatePtr); + +int init_utf8(OtherStatePtr); +unsigned int mapping_utf8(unsigned int, OtherStatePtr); +unsigned int reverse_utf8(unsigned int, OtherStatePtr); +int stack_utf8(unsigned char, OtherStatePtr); + +int init_sjis(OtherStatePtr); +unsigned int mapping_sjis(unsigned int, OtherStatePtr); +unsigned int reverse_sjis(unsigned int, OtherStatePtr); +int stack_sjis(unsigned char, OtherStatePtr); + Index: xc/programs/luit/parser.c diff -u xc/programs/luit/parser.c:1.1 xc/programs/luit/parser.c:1.2 --- xc/programs/luit/parser.c:1.1 Thu Nov 1 22:06:43 2001 +++ xc/programs/luit/parser.c Wed Sep 18 13:11:50 2002 @@ -19,9 +19,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/programs/luit/parser.c,v 1.2 2002/09/18 17:11:50 tsi Exp $ */ #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "parser.h" Index: xc/programs/makepsres/makepsres.c diff -u xc/programs/makepsres/makepsres.c:1.5 xc/programs/makepsres/makepsres.c:1.7 --- xc/programs/makepsres/makepsres.c:1.5 Tue Jul 31 20:45:01 2001 +++ xc/programs/makepsres/makepsres.c Wed Sep 18 13:11:51 2002 @@ -35,7 +35,7 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/programs/makepsres/makepsres.c,v 1.5 2001/08/01 00:45:01 tsi Exp $ */ +/* $XFree86: xc/programs/makepsres/makepsres.c,v 1.7 2002/09/18 17:11:51 tsi Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -257,7 +257,8 @@ hash += *ch; return hash % HASHSIZE; } - hash += *ch++ + (*ch++ << 8); + hash += *ch++; + hash += (*ch++ << 8); } } @@ -2189,7 +2190,7 @@ (void) unlink (backupname); /* Ignore error */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (link (filename, backupname) != 0) { if (errno != ENOENT) { fprintf(stderr, "%s: Could not back up output file %s\n", Index: xc/programs/mkcfm/mkcfm.c diff -u xc/programs/mkcfm/mkcfm.c:1.11 xc/programs/mkcfm/mkcfm.c:1.12 --- xc/programs/mkcfm/mkcfm.c:1.11 Mon Aug 13 17:46:51 2001 +++ xc/programs/mkcfm/mkcfm.c Mon Dec 9 12:30:12 2002 @@ -16,7 +16,7 @@ * The Original Software is CID font code that was developed by Silicon * Graphics, Inc. */ -/* $XFree86: xc/programs/mkcfm/mkcfm.c,v 1.11 2001/08/13 21:46:51 dawes Exp $ */ +/* $XFree86: xc/programs/mkcfm/mkcfm.c,v 1.12 2002/12/09 17:30:12 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -221,6 +221,10 @@ void FontDefaultFormat(int *bit, int *byte, int *glyph, int *scan) { ; } + +Bool +FontFilePriorityRegisterRenderer(FontRendererPtr renderer, int priority) +{ return TRUE; } Bool FontFileRegisterRenderer(FontRendererPtr renderer) { return TRUE; } Index: xc/programs/mkfontdir/mkfontdir.c diff -u xc/programs/mkfontdir/mkfontdir.c:3.17 xc/programs/mkfontdir/mkfontdir.c:3.20 --- xc/programs/mkfontdir/mkfontdir.c:3.17 Mon Nov 26 14:33:48 2001 +++ xc/programs/mkfontdir/mkfontdir.c Tue Sep 24 17:01:06 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/mkfontdir/mkfontdir.c,v 3.17 2001/11/26 19:33:48 dawes Exp $ */ +/* $XFree86: xc/programs/mkfontdir/mkfontdir.c,v 3.20 2002/09/24 21:01:06 tsi Exp $ */ /*********************************************************** Copyright (c) 1988 X Consortium @@ -483,8 +483,9 @@ fclose(file); return BadFontPath; } - (void) sprintf(dir_format, "%%%ds %%%d[^\n]\n", - sizeof(file_name)-1, sizeof(font_name)-1); + (void) sprintf(dir_format, "%%%lds %%%ld[^\n]\n", + (unsigned long)sizeof(file_name) - 1, + (unsigned long)sizeof(font_name) - 1); while (fgets(dir_line, sizeof(dir_line), file) != NULL) { count = sscanf(dir_line, dir_format, file_name, font_name); if (count != 2) { Index: xc/programs/mkfontscale/Imakefile diff -u /dev/null xc/programs/mkfontscale/Imakefile:1.3 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/mkfontscale/Imakefile Fri Dec 13 23:41:12 2002 @@ -0,0 +1,21 @@ +XCOMM $XFree86: xc/programs/mkfontscale/Imakefile,v 1.3 2002/12/14 04:41:12 dawes Exp $ + +LOCAL_LIBRARIES = $(XFONTENCLIB) $(FREETYPE2LIB) + DEPLIBS = $(DEPXFONTENCLIB) $(DEPFREETYPE2LIB) + +SYS_LIBRARIES = MathLibrary GzipLibrary + +SRCS = mkfontscale.c list.c + +OBJS = mkfontscale.o list.o + +#if !HasSnprintf +SNPRINTF_DEFINES = -DNEED_SNPRINTF +SNPRINTF_INCLUDES = -I$(LIBSRC)/misc +#endif + +INCLUDES = $(FREETYPE2INCLUDES) $(SNPRINTF_INCLUDES) +DEFINES = $(FREETYPE2DEFINES) $(SNPRINTF_DEFINES) + +ComplexProgramTarget(mkfontscale) + Index: xc/programs/mkfontscale/data.h diff -u /dev/null xc/programs/mkfontscale/data.h:1.2 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/mkfontscale/data.h Wed Jan 29 17:09:40 2003 @@ -0,0 +1,91 @@ +/* + Copyright (c) 2002 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +/* $XFree86: xc/programs/mkfontscale/data.h,v 1.2 2003/01/29 22:09:40 dawes Exp $ */ + +/* Order is significant. For example, some B&H fonts are hinted by + URW++, and both strings appear in the notice. */ + +char *notice_foundries[][2] = + {{"Bigelow", "b&h"}, + {"Adobe", "adobe"}, + {"Bitstream", "bitsteam"}, + {"Monotype", "monotype"}, + {"Linotype", "linotype"}, + {"LINOTYPE-HELL", "linotype"}, + {"IBM", "ibm"}, + {"URW", "urw"}, + {"International Typeface Corporation", "itc"}, + {"Tiro Typeworks", "tiro"}, + {"XFree86", "xfree86"}, + {"Microsoft", "microsoft"}, + {"Omega", "omega"}, + {"Font21", "hwan"}, + {"HanYang System", "hanyang"}}; + +/* This table is partly taken from ttmkfdir by Joerg Pommnitz. */ + +/* It should not contain useless entries (such as UNKN) nor duplicate + entries for padding both with spaces and NULs. */ + +char *vendor_foundries[][2] = + {{"ADBE", "adobe"}, + {"AGFA", "agfa"}, + {"ALTS", "altsys"}, + {"APPL", "apple"}, + {"ARPH", "arphic"}, + {"ATEC", "alltype"}, + {"B&H", "b&h"}, + {"BITS", "bitstream"}, + {"CANO", "cannon"}, + {"DYNA", "dynalab"}, + {"EPSN", "epson"}, + {"FJ", "fujitsu"}, + {"IBM", "ibm"}, + {"ITC", "itc"}, + {"IMPR", "impress"}, + {"LARA", "larabiefonts"}, + {"LEAF", "interleaf"}, + {"LETR", "letraset"}, + {"LINO", "linotype"}, + {"MACR", "macromedia"}, + {"MONO", "monotype"}, + {"MS", "microsoft"}, + {"MT", "monotype"}, + {"NEC", "nec"}, + {"PARA", "paratype"}, + {"QMSI", "qms"}, + {"RICO", "ricoh"}, + {"URW", "urw"}, + {"Y&Y", "y&y"}}; + + + + + + + + + + + + + Index: xc/programs/mkfontscale/list.c diff -u /dev/null xc/programs/mkfontscale/list.c:1.3 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/mkfontscale/list.c Fri Dec 13 23:41:12 2002 @@ -0,0 +1,178 @@ +/* + Copyright (c) 2002 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +/* $XFree86: xc/programs/mkfontscale/list.c,v 1.3 2002/12/14 04:41:12 dawes Exp $ */ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include "list.h" + +#ifdef NEED_SNPRINTF +#undef SCOPE +#define SCOPE static +#include "snprintf.c" +#endif + +ListPtr +listCons(char *car, ListPtr cdr) +{ + ListPtr lcar = malloc(sizeof(ListRec)); + if(!lcar) + return NULL; + lcar -> value = car; + lcar -> next = cdr; + return lcar; +} + +ListPtr +listConsF(ListPtr cdr, char *f, ...) +{ + va_list args; + char *string; + { + int n, size = 20; + while(1) { + if(size > 4096) + return NULL; + string = malloc(size); + if(!string) + return NULL; + va_start(args, f); + n = vsnprintf(string, size, f, args); + va_end(args); + if(n >= 0 && n < size) + return listCons(string, cdr); + else if(n >= size) + size = n + 1; + else + size = size * 3 / 2 + 1; + free(string); + } + } +} + +int +listLength(ListPtr list) +{ + int n = 0; + while(list) { + n++; + list = list->next; + } + return n; +} + +ListPtr +appendList(ListPtr first, ListPtr second) +{ + ListPtr current; + + if(second == NULL) + return first; + + if(first == NULL) + return second; + + for(current = first; current->next; current = current->next) + ; + + current->next = second; + return first; +} + +ListPtr +makeList(char **a, int n, ListPtr old, int begin) +{ + ListPtr first, current, next; + int i; + + if(n == 0) + return old; + + first = malloc(sizeof(ListRec)); + if(!first) + return NULL; + + first->value = a[0]; + first->next = NULL; + + current = first; + for(i = 1; i < n; i++) { + next = malloc(sizeof(ListRec)); + if(!next) + return NULL; + next->value = a[i]; + next->next = NULL; + + current->next = next; + current = next; + } + if(begin) { + current->next = old; + return first; + } else { + return appendList(old, first); + } +} + +ListPtr +reverseList(ListPtr old) +{ + ListPtr new = NULL, current; + while(old) { + current = old; + old = old->next; + current->next = new; + new = current; + } + return new; +} + +void +destroyList(ListPtr old) +{ + ListPtr next; + if(!old) + return; + next = old->next; + while(old) { + free(old); + old = next; + next = old->next; + } +} + +void +deepDestroyList(ListPtr old) +{ + ListPtr next; + if(!old) + return; + next = old->next; + while(old) { + free(old->value); + free(old); + old = next; + next = old->next; + } +} + Index: xc/programs/mkfontscale/list.h diff -u /dev/null xc/programs/mkfontscale/list.h:1.1 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/mkfontscale/list.h Wed Jun 5 15:46:04 2002 @@ -0,0 +1,37 @@ +/* + Copyright (c) 2002 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +/* $XFree86: xc/programs/mkfontscale/list.h,v 1.1 2002/06/05 19:46:04 dawes Exp $ */ + +typedef struct _List { + char *value; + struct _List *next; +} ListRec, *ListPtr; + +ListPtr listCons(char *car, ListPtr cdr); +ListPtr listConsF(ListPtr cdr, char *f, ...); +int listLength(ListPtr list); +ListPtr appendList(ListPtr first, ListPtr second); +ListPtr makeList(char **a, int n, ListPtr old, int begin); +ListPtr reverseList(ListPtr old); +void destroyList(ListPtr old); +void deepDestroyList(ListPtr old); + Index: xc/programs/mkfontscale/mkfontscale.c diff -u /dev/null xc/programs/mkfontscale/mkfontscale.c:1.4 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/mkfontscale/mkfontscale.c Wed Feb 12 22:04:07 2003 @@ -0,0 +1,811 @@ +/* + Copyright (c) 2002 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +/* $XFree86: xc/programs/mkfontscale/mkfontscale.c,v 1.4 2003/02/13 03:04:07 dawes Exp $ */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <sys/types.h> +#include <dirent.h> + +#include <X11/fonts/fontenc.h> +#include <freetype/freetype.h> +#include <freetype/ftsnames.h> +#include <freetype/tttables.h> +#include <freetype/ttnameid.h> +#include <freetype/t1tables.h> + +#define CODE_IGNORED(c) ((c) < 0x20 || \ + ((c) >= 0x7F && (c) <= 0xA0) || \ + (c) == 0xAD) + +#include "list.h" +#include "data.h" + +char *encodings_array[] = + { "iso8859-1", "iso8859-2", "iso8859-3", "iso8859-4", "iso8859-5", + "iso8859-6", "iso8859-7", "iso8859-8", "iso8859-9", "iso8859-10", + "iso8859-11", "iso8859-12", "iso8859-13", "iso8859-14", "iso8859-15", + "koi8-r", "koi8-u", "koi8-e", + "adobe-standard", "adobe-symbol", "ibm-cp437", "microsoft-cp1252", + /* But not "adobe-dingbats", as it uses generic glyph names. */ + "jisx0201.1976-0", "jisx0208.1983-0", "jisx0208.1990-0", + "jisx0212.1190-0", "big5-0", "gb2312.1980-0", + "ksc5601.1987-0", "ksc5601.1992-3"}; + +char *extra_encodings_array[] = + { "iso10646-1", "adobe-fontspecific", "microsoft-symbol" }; + +ListPtr encodings, extra_encodings; + +#define countof(_a) (sizeof(_a)/sizeof((_a)[0])) + +int doDirectory(char*); +static int checkEncoding(FT_Face face, char *encoding_name); +static int checkExtraEncoding(FT_Face face, char *encoding_name, int found); +static int find_cmap(int type, int pid, int eid, FT_Face face); +static char* notice_foundry(char *notice); +static char* vendor_foundry(signed char *vendor); + +static FT_Library ft_library; +static float bigEncodingFuzz = 0.02; + +static void +usage(void) +{ + fprintf(stderr, + "mkfontscale [ -e encoding ] [ -f fuzz ] [ directory ]\n"); +} + +int +main(int argc, char **argv) +{ + int argn; + FT_Error ftrc; + + encodings = makeList(encodings_array, countof(encodings_array), NULL, 0); + + extra_encodings = makeList(extra_encodings_array, + countof(extra_encodings_array), + NULL, 0); + + argn = 1; + while(argn < argc) { + if(argv[argn][0] == '\0' || argv[argn][0] != '-') + break; + if(argv[argn][1] == '-') { + argn++; + break; + } else if(argv[argn][1] == 'e') { + if(argn >= argc - 1) { + usage(); + exit(1); + } + makeList(&argv[argn + 1], 1, encodings, 0); + argn += 2; + } else if(argv[argn][1] == 'f') { + if(argn >= argc - 1) { + usage(); + exit(1); + } + bigEncodingFuzz = atof(argv[argn + 1]) / 100.0; + argn += 2; + } else { + usage(); + exit(1); + } + } + + ftrc = FT_Init_FreeType(&ft_library); + if(ftrc) { + fprintf(stderr, "Could not initialise FreeType library: %d\n", ftrc); + exit(1); + } + + + if (argn == argc) + doDirectory("."); + else + while(argn < argc) { + doDirectory(argv[argn]); + argn++; + } + return 0; +} + +static int +getNameHelper(FT_Face face, int nid, int pid, int eid, + FT_SfntName *name_return) +{ + FT_SfntName name; + int n, i; + + n = FT_Get_Sfnt_Name_Count(face); + if(n <= 0) + return 0; + + for(i = 0; i < n; i++) { + if(FT_Get_Sfnt_Name(face, i, &name)) + continue; + if(name.name_id == nid && + name.platform_id == pid && + (eid < 0 || name.encoding_id == eid)) { + switch(name.platform_id) { + case TT_PLATFORM_APPLE_UNICODE: + case TT_PLATFORM_MACINTOSH: + if(name.language_id != TT_MAC_LANGID_ENGLISH) + continue; + break; + case TT_PLATFORM_MICROSOFT: + if(name.language_id != TT_MS_LANGID_ENGLISH_UNITED_STATES && + name.language_id != TT_MS_LANGID_ENGLISH_UNITED_KINGDOM) + continue; + break; + default: + continue; + } + if(name.string_len > 0) { + *name_return = name; + return 1; + } + } + } + return 0; +} + +static char * +getName(FT_Face face, int nid) +{ + FT_SfntName name; + char *string; + int i; + + if(getNameHelper(face, nid, + TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, &name) || + getNameHelper(face, nid, + TT_PLATFORM_APPLE_UNICODE, -1, &name)) { + string = malloc(name.string_len / 2 + 1); + if(string == NULL) { + fprintf(stderr, "Couldn't allocate name\n"); + exit(1); + } + for(i = 0; i < name.string_len / 2; i++) { + if(name.string[2 * i] != 0) + string[i] = '?'; + else + string[i] = name.string[2 * i + 1]; + } + string[i] = '\0'; + return string; + } + + /* Pretend that Apple Roman is ISO 8859-1. */ + if(getNameHelper(face, nid, TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, + &name)) { + string = malloc(name.string_len + 1); + if(string == NULL) { + fprintf(stderr, "Couldn't allocate name\n"); + exit(1); + } + memcpy(string, name.string, name.string_len); + string[name.string_len] = '\0'; + return string; + } + + return NULL; +} + +static char* +os2Weight(int weight) +{ + if(weight < 150) + return "thin"; + else if(weight < 250) + return "extralight"; + else if(weight < 350) + return "light"; + else if(weight < 450) + return "medium"; /* officially "normal" */ + else if(weight < 550) + return "medium"; + else if(weight < 650) + return "semibold"; + else if(weight < 750) + return "bold"; + else if(weight < 850) + return "extrabold"; + else + return "black"; +} + +static char* +os2Width(int width) +{ + if(width <= 1) + return "ultracondensed"; + else if(width <= 2) + return "extracondensed"; + else if(width <= 3) + return "condensed"; + else if(width <= 4) + return "semicondensed"; + else if(width <= 5) + return "normal"; + else if(width <= 6) + return "semiexpanded"; + else if(width <= 7) + return "expanded"; + else if(width <= 8) + return "extraexpanded"; + else + return "ultraexpanded"; +} + +static char* +t1Weight(char *weight) +{ + if(!weight) + return NULL; + if(strcmp(weight, "Regular") == 0) + return "medium"; + if(strcmp(weight, "Normal") == 0) + return "medium"; + if(strcmp(weight, "Medium") == 0) + return "medium"; + if(strcmp(weight, "Book") == 0) + return "medium"; + if(strcmp(weight, "Roman") == 0) /* Some URW++ fonts do that! */ + return "medium"; + if(strcmp(weight, "Demi") == 0) + return "semibold"; + if(strcmp(weight, "DemiBold") == 0) + return "semibold"; + else if(strcmp(weight, "Bold") == 0) + return "bold"; + else { + fprintf(stderr, "Unknown Type 1 weight \"%s\"\n", weight); + return NULL; + } +} + +static char* +strcat_reliable(char *a, char *b) +{ + char *c = malloc(strlen(a) + strlen(b) + 1); + if(c == NULL) + return NULL; + strcpy(c, a); + strcat(c, b); + return c; +} + +static int +unsafe(char c) +{ + return + c < 0x20 || c > 0x7E || + c == '[' || c == ']' || c == '(' || c == ')' || c == '\\' || c == '-'; +} + +static char * +safe(char* s) +{ + int i, len, safe_flag = 1; + char *t; + + i = 0; + while(s[i] != '\0') { + if(unsafe(s[i])) + safe_flag = 0; + i++; + } + + if(safe_flag) return s; + + len = i; + t = malloc(len + 1); + if(t == NULL) { + perror("Couldn't allocate string"); + exit(1); + } + + for(i = 0; i < len; i++) { + if(unsafe(s[i])) + t[i] = ' '; + else + t[i] = s[i]; + } + t[i] = '\0'; + return t; +} + +int +doDirectory(char *dirname_given) +{ + char *dirname, *fontscale_name, *filename; + FILE *fontscale; + DIR *dirp; + struct dirent *entry; + FT_Error ftrc; + FT_Face face; + TT_Header *head; + TT_HoriHeader *hhea; + TT_OS2 *os2; + TT_Postscript *post; + PS_FontInfoRec *t1info, t1info_rec; + char *foundry, *family, *weight, *slant, *sWidth, *adstyle, + *spacing, *full_name; + ListPtr encoding, entries = NULL; + int i, found, rc; + + i = strlen(dirname_given); + if(i == 0) + dirname = strcat_reliable(".", "/"); + else if(dirname_given[i - 1] != '/') + dirname = strcat_reliable(dirname_given, "/"); + else + dirname = strcat_reliable(dirname_given, ""); + fontscale_name = strcat_reliable(dirname, "fonts.scale"); + + dirp = opendir(dirname); + if(dirp == NULL) { + fprintf(stderr, "%s: ", dirname); + perror("opendir"); + return 0; + } + + fontscale = fopen(fontscale_name, "w"); + if(fontscale == NULL) { + fprintf(stderr, "%s: ", fontscale_name); + perror("fopen(w)"); + return 0; + } + + for(;;) { + entry = readdir(dirp); + if(entry == NULL) + break; + filename = strcat_reliable(dirname, entry->d_name); + ftrc = FT_New_Face(ft_library, filename, 0, &face); + if(ftrc) + continue; + + if((face->face_flags & FT_FACE_FLAG_SCALABLE) == 0) + continue; + + found = 0; + + foundry = NULL; + family = NULL; + weight = NULL; + slant = NULL; + sWidth = NULL; + adstyle = NULL; + spacing = NULL; + full_name = NULL; + + head = FT_Get_Sfnt_Table(face, ft_sfnt_head); + hhea = FT_Get_Sfnt_Table(face, ft_sfnt_hhea); + os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); + post = FT_Get_Sfnt_Table(face, ft_sfnt_post); + + rc = FT_Get_PS_Font_Info(face, &t1info_rec); + if(rc == 0) + t1info = &t1info_rec; + else + t1info = NULL; + + if(!family) + family = getName(face, TT_NAME_ID_FONT_FAMILY); + if(!family) + family = getName(face, TT_NAME_ID_FULL_NAME); + if(!family) + family = getName(face, TT_NAME_ID_PS_NAME); + + if(!full_name) + full_name = getName(face, TT_NAME_ID_FULL_NAME); + if(!full_name) + full_name = getName(face, TT_NAME_ID_PS_NAME); + + if(os2 && os2->version != 0xFFFF) { + if(!weight) + weight = os2Weight(os2->usWeightClass); + if(!sWidth) + sWidth = os2Width(os2->usWidthClass); + if(!foundry) + foundry = vendor_foundry(os2->achVendID); + if(!slant) + slant = os2->fsSelection & 1 ? "i" : "r"; + } + + if(post) { + if(!spacing) { + if(post->isFixedPitch) { + if(hhea->min_Left_Side_Bearing >= 0 && + hhea->xMax_Extent <= hhea->advance_Width_Max) { + spacing = "c"; + } else { + spacing = "m"; + } + } else { + spacing = "p"; + } + } + } + + if(t1info) { + if(!family) + family = t1info->family_name; + if(!family) + family = t1info->full_name; + if(!full_name) + full_name = t1info->full_name; + if(!foundry) + foundry = notice_foundry(t1info->notice); + if(!weight) + weight = t1Weight(t1info->weight); + if(!spacing) + spacing = t1info->is_fixed_pitch ? "m" : "p"; + if(!slant) { + /* Bitstream fonts have positive italic angle. */ + slant = + t1info->italic_angle <= -4 || t1info->italic_angle >= 4 ? + "i" : "r"; + } + } + + if(head) { + if(!slant) + slant = head->Mac_Style & 2 ? "i" : "r"; + if(!weight) + weight = head->Mac_Style & 1 ? "bold" : "medium"; + } + + if(!slant) { + fprintf(stderr, "Couldn't determine slant for %s\n", filename); + slant = "r"; + } + + if(!weight) { + fprintf(stderr, "Couldn't determine weight for %s\n", filename); + weight = "medium"; + } + + if(!foundry) { + char *notice; + notice = getName(face, TT_NAME_ID_TRADEMARK); + if(notice) { + foundry = notice_foundry(notice); + } + if(!foundry) { + notice = getName(face, TT_NAME_ID_MANUFACTURER); + if(notice) { + foundry = notice_foundry(notice); + } + } + } + + if(strcmp(slant, "i") == 0) { + if(strstr(full_name, "Oblique")) + slant = "o"; + if(strstr(full_name, "Slanted")) + slant = "o"; + } + + if(!foundry) foundry = "misc"; + if(!family) { + fprintf(stderr, "Couldn't get family name for %s\n", filename); + family = entry->d_name; + } + + if(!weight) weight = "medium"; + if(!slant) slant = "r"; + if(!sWidth) sWidth = "normal"; + if(!adstyle) adstyle = ""; + if(!spacing) spacing = "p"; + + /* Yes, it's a memory leak. */ + foundry = safe(foundry); + family = safe(family); + + for(encoding = encodings; encoding; encoding = encoding->next) + if(checkEncoding(face, encoding->value)) { + found = 1; + entries = listConsF(entries, + "%s -%s-%s-%s-%s-%s-%s-0-0-0-0-%s-0-%s", + entry->d_name, + foundry, family, + weight, slant, sWidth, adstyle, spacing, + encoding->value); + } + for(encoding = extra_encodings; encoding; encoding = encoding->next) + if(checkExtraEncoding(face, encoding->value, found)) { + /* Do not set found! */ + entries = listConsF(entries, + "%s -%s-%s-%s-%s-%s-%s-0-0-0-0-%s-0-%s", + entry->d_name, + foundry, family, + weight, slant, sWidth, adstyle, spacing, + encoding->value); + } + free(filename); + } + entries = reverseList(entries); + fprintf(fontscale, "%d\n", listLength(entries)); + while(entries) { + fprintf(fontscale, "%s\n", entries->value); + entries = entries->next; + } + deepDestroyList(entries); + fclose(fontscale); + free(fontscale_name); + free(dirname); + return 1; +} + +static int +checkEncoding(FT_Face face, char *encoding_name) +{ + FontEncPtr encoding; + FontMapPtr mapping; + int i, j, c, koi8; + char *n; + + encoding = FontEncFind(encoding_name, NULL); + if(!encoding) + return 0; + + /* An encoding is ``small'' if one of the following is true: + - it uses PostScript glyph names; + - it is linear and has no more than 256 codepoints; or + - it is a matrix encoding and has no more than one column. + + For small encodings, we require perfect coverage except for + CODE_IGNORED and KOI-8 linedrawing glyphs. + + For large encodings, we require coverage up to bigEncodingFuzz. */ + + + if(FT_Has_PS_Glyph_Names(face)) { + for(mapping = encoding->mappings; mapping; mapping = mapping->next) { + if(mapping->type == FONT_ENCODING_POSTSCRIPT) { + if(encoding->row_size > 0) { + for(i = encoding->first; i < encoding->size; i++) { + for(j = encoding->first_col; + j < encoding->row_size; + j++) { + n = FontEncName((i<<8) | j, mapping); + if(n && FT_Get_Name_Index(face, n) == 0) { + return 0; + } + } + } + return 1; + } else { + for(i = encoding->first; i < encoding->size; i++) { + n = FontEncName(i, mapping); + if(n && FT_Get_Name_Index(face, n) == 0) { + return 0; + } + } + return 1; + } + } + } + } + + for(mapping = encoding->mappings; mapping; mapping = mapping->next) { + if(find_cmap(mapping->type, mapping->pid, mapping->eid, face)) { + int total = 0, failed = 0; + if(encoding->row_size > 0) { + int estimate = + (encoding->size - encoding->first) * + (encoding->row_size - encoding->first_col); + for(i = encoding->first; i < encoding->size; i++) { + for(j = encoding->first_col; + j < encoding->row_size; + j++) { + c = FontEncRecode((i<<8) | j, mapping); + if(CODE_IGNORED(c)) { + continue; + } else { + if(FT_Get_Char_Index(face, c) == 0) { + failed++; + } + total++; + if((encoding->size <= 1 && failed > 0) || + ((float)failed >= bigEncodingFuzz * estimate)) { + return 0; + } + } + } + } + if((float)failed >= total * bigEncodingFuzz) + return 0; + else + return 1; + } else { + int estimate = encoding->size - encoding->first; + /* For the KOI8 encodings, ignore the lack of + linedrawing characters */ + if(strncmp(encoding->name, "koi8-", 5) == 0) + koi8 = 1; + else + koi8 = 0; + for(i = encoding->first; i < encoding->size; i++) { + c = FontEncRecode(i, mapping); + if(CODE_IGNORED(c) || + (koi8 && i >= 0x80 && i < 0xA0)) { + continue; + } else { + if(FT_Get_Char_Index(face, c) == 0) { + failed++; + } + total++; + if((encoding->size <= 256 && failed > 0) || + ((float)failed >= bigEncodingFuzz * estimate)) { + return 0; + } + } + } + if((float)failed >= total * bigEncodingFuzz) + return 0; + else + return 1; + } + } + } + return 0; +} + +static int +find_cmap(int type, int pid, int eid, FT_Face face) +{ + int i, n, rc; + FT_CharMap cmap = NULL; + + n = face->num_charmaps; + + switch(type) { + case FONT_ENCODING_TRUETYPE: /* specific cmap */ + for(i=0; i<n; i++) { + cmap = face->charmaps[i]; + if(cmap->platform_id == pid && cmap->encoding_id == eid) { + rc = FT_Set_Charmap(face, cmap); + if(rc == 0) + return 1; + } + } + break; + case FONT_ENCODING_UNICODE: /* any Unicode cmap */ + /* prefer Microsoft Unicode */ + for(i=0; i<n; i++) { + cmap = face->charmaps[i]; + if(cmap->platform_id == TT_PLATFORM_MICROSOFT && + cmap->encoding_id == TT_MS_ID_UNICODE_CS) { + rc = FT_Set_Charmap(face, cmap); + if(rc == 0) + return 1; + } + } + break; + /* Try Apple Unicode */ + for(i=0; i<n; i++) { + cmap = face->charmaps[i]; + if(cmap->platform_id == TT_PLATFORM_APPLE_UNICODE) { + rc = FT_Set_Charmap(face, cmap); + if(rc == 0) + return 1; + } + } + /* ISO Unicode? */ + for(i=0; i<n; i++) { + cmap = face->charmaps[i]; + if(cmap->platform_id == TT_PLATFORM_ISO) { + rc = FT_Set_Charmap(face, cmap); + if(rc == 0) + return 1; + } + } + break; + default: + return 0; + } + return 0; +} + +static int +checkExtraEncoding(FT_Face face, char *encoding_name, int found) +{ + int c; + + if(strcasecmp(encoding_name, "iso10646-1") == 0) { + if(find_cmap(FONT_ENCODING_UNICODE, -1, -1, face)) { + int found = 0; + /* Export as Unicode if there are at least 15 BMP + characters that are not a space or ignored. */ + for(c = 0x21; c < 0x10000; c++) { + if(CODE_IGNORED(c)) + continue; + if(FT_Get_Char_Index(face, c) > 0) + found++; + if(found >= 15) + return 1; + } + return 0; + } else + return 0; + } else if(strcasecmp(encoding_name, "microsoft-symbol") == 0) { + if(find_cmap(FONT_ENCODING_TRUETYPE, + TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, + face)) + return 1; + else + return 0; + } else if(strcasecmp(encoding_name, "adobe-fontspecific") == 0) { + if(!found) { + if(FT_Has_PS_Glyph_Names(face)) + return 1; + else + return 0; + } else + return 0; + } else { + fprintf(stderr, "Unknown extra encoding %s\n", encoding_name); + return 0; + } +} + +static char* +notice_foundry(char *notice) +{ + int i; + for(i = 0; i < countof(notice_foundries); i++) + if(notice && strstr(notice, notice_foundries[i][0])) + return notice_foundries[i][1]; + return NULL; +} + +static int +vendor_match(signed char *vendor, char *vendor_string) +{ + /* vendor is not necessarily NUL-terminated. */ + int i, len; + len = strlen(vendor_string); + if(memcmp(vendor, vendor_string, len) != 0) + return 0; + for(i = len; i < 4; i++) + if(vendor[i] != ' ' && vendor[i] != '\0') + return 0; + return 1; +} + +static char* +vendor_foundry(signed char *vendor) +{ + int i; + for(i = 0; i < countof(vendor_foundries); i++) + if(vendor_match(vendor, vendor_foundries[i][0])) + return vendor_foundries[i][1]; + return NULL; +} Index: xc/programs/mkfontscale/mkfontscale.man diff -u /dev/null xc/programs/mkfontscale/mkfontscale.man:1.2 --- /dev/null Thu Feb 27 12:34:08 2003 +++ xc/programs/mkfontscale/mkfontscale.man Thu Sep 26 21:55:07 2002 @@ -0,0 +1,67 @@ +.\" $XFree86: xc/programs/mkfontscale/mkfontscale.man,v 1.2 2002/09/27 01:55:07 dawes Exp $ +.\" +.TH MKFONTSCALE 1 __vendorversion__ +.SH NAME +mkfontscale \- create an index of scalable font files for X + +.SH SYNOPSIS +.B mkfontscale +[ +.B \-e +.I encoding +] \|.\|.\|. [ +.B \-f +.I fuzz +] [ +.B \-\- +] [ +.I directory +] \|.\|.\|. + +.SH DESCRIPTION +For each directory argument, +.I mkfontscale +reads all of the scalable font files in the directory. For every font +file found, an X11 font name (XLFD) is generated, and is written +together with the file name to a file +.B fonts.scale +in the directory. + +The resulting +.B fonts.scale +file should be checked and possibly manually edited before being used +as input for the +.BR mkfontdir (1) +program. + +.SH OPTIONS + +.TP +.BI \-e " encoding" +add +.I encoding +to the list of encodings searched for. +.TP +.BI \-f " fuzz" +set the fraction of characters that may be missing in large encodings to +.I fuzz +percent. Defaults to 2%. +.TP +.B \-\- +end of options. + +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), mkfontdir(1), ttmkfdir(1), xfs(1), xset(1) + +.SH NOTES +.B Mkfontscale +will overwrite any +.B fonts.scale +file even if it has been hand-edited. + +.SH AUTHOR +.B Mkfontscale +was written by Juliusz Chroboczek <jch@xfree86.org> for the XFree86 +project. The functionality of this program was inspired by the +.B ttmkfdir +utility by Joerg Pommnitz. Index: xc/programs/oclock/oclock.man diff -u xc/programs/oclock/oclock.man:1.8 xc/programs/oclock/oclock.man:1.9 --- xc/programs/oclock/oclock.man:1.8 Fri Dec 14 15:01:00 2001 +++ xc/programs/oclock/oclock.man Sat Oct 12 12:06:45 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/oclock/oclock.man,v 1.8 2001/12/14 20:01:00 dawes Exp $ +.\" $XFree86: xc/programs/oclock/oclock.man,v 1.9 2002/10/12 16:06:45 herrb Exp $ .\" .TH OCLOCK 1 __xorgversion__ .SH NAME @@ -86,7 +86,7 @@ .br This will cause oclock to pick up the colors in the app-defaults color customization file: -<XRoot>/lib/X11/app-defaults/Clock-color. +__projectroot__/lib/X11/app-defaults/Clock-color. Below are the default colors: .sp 1 Clock*Background: grey Index: xc/programs/proxymngr/Imakefile diff -u xc/programs/proxymngr/Imakefile:1.11 xc/programs/proxymngr/Imakefile:1.12 --- xc/programs/proxymngr/Imakefile:1.11 Mon Oct 8 12:36:49 2001 +++ xc/programs/proxymngr/Imakefile Fri May 31 14:46:08 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/proxymngr/Imakefile,v 1.11 2001/10/08 16:36:49 alanh Exp $ +XCOMM $XFree86: xc/programs/proxymngr/Imakefile,v 1.12 2002/05/31 18:46:08 dawes Exp $ DEFINES = StrcasecmpDefines @@ -16,13 +16,13 @@ OBJS1 = main.o pmdb.o config.o - PROGRAMS = proxymngr + PROGRAMS = ProgramTargetName(proxymngr) LBXPROXY = $(BINDIR)/lbxproxy SITE_CONFIG = -DLBXPROXY=$(LBXPROXY) -AllTarget(pmconfig ProgramTargetName(proxymngr)) +AllTarget(pmconfig) LinkConfDirectory(proxymngr,.,proxymngr,.) Index: xc/programs/proxymngr/proxymngr.man diff -u xc/programs/proxymngr/proxymngr.man:1.7 xc/programs/proxymngr/proxymngr.man:1.8 --- xc/programs/proxymngr/proxymngr.man:1.7 Fri Dec 14 15:01:02 2001 +++ xc/programs/proxymngr/proxymngr.man Wed Feb 19 22:27:32 2003 @@ -24,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/proxymngr/proxymngr.man,v 1.7 2001/12/14 20:01:02 dawes Exp $ +.\" $XFree86: xc/programs/proxymngr/proxymngr.man,v 1.8 2003/02/20 03:27:32 dawes Exp $ .\" .TH PROXYMNGR 1 __xorgversion__ .SH NAME @@ -76,7 +76,9 @@ .PP The proxy manager maintains a local configuration file describing the proxy services available. This configuration file is installed -in /usr/X11R6.4/lib/X11/proxymngr/pmconfig during the installation +in +.I __projectroot__/lib/X11/proxymngr/pmconfig +during the installation of proxymngr. The location of the configuration file can be overwritten using the \fB\-config\fP command line option. .PP @@ -128,7 +130,7 @@ ! or ! <serviceName> unmanaged <proxyAddress> ! -lbx managed /usr/X11R6.4/bin/lbxproxy +lbx managed __projectroot__/bin/lbxproxy ! ! substitute site-specific info xfwp unmanaged firewall:4444 Index: xc/programs/rgb/rgb.c diff -u xc/programs/rgb/rgb.c:3.8 xc/programs/rgb/rgb.c:3.9 --- xc/programs/rgb/rgb.c:3.8 Fri Dec 14 15:01:03 2001 +++ xc/programs/rgb/rgb.c Wed Oct 9 12:56:47 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/rgb/rgb.c,v 3.8 2001/12/14 20:01:03 dawes Exp $ */ +/* $XFree86: xc/programs/rgb/rgb.c,v 3.9 2002/10/09 16:56:47 tsi Exp $ */ /* reads from standard input lines of the form: @@ -49,6 +49,7 @@ #undef NULL #include <stdio.h> +#include <stdlib.h> #include <X11/Xos.h> #include "rgb.h" #include "site.h" Index: xc/programs/rgb/showrgb.c diff -u xc/programs/rgb/showrgb.c:3.8 xc/programs/rgb/showrgb.c:3.9 --- xc/programs/rgb/showrgb.c:3.8 Fri Dec 14 15:01:04 2001 +++ xc/programs/rgb/showrgb.c Fri May 31 14:46:08 2002 @@ -26,7 +26,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/rgb/showrgb.c,v 3.8 2001/12/14 20:01:04 dawes Exp $ */ +/* $XFree86: xc/programs/rgb/showrgb.c,v 3.9 2002/05/31 18:46:08 dawes Exp $ */ #ifndef USE_RGB_TXT #ifdef NDBM @@ -130,7 +130,7 @@ int lineno = 0; int red, green, blue; -#ifdef __EMX__ +#ifdef __UNIXOS2__ char *root = (char*)getenv("X11ROOT"); sprintf(line,"%s%s.txt",root,filename); path = (char *)malloc(strlen(line) + 1); @@ -150,7 +150,7 @@ while(fgets(line, sizeof(line), rgb)) { lineno++; -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (sscanf(line, "%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4) { #else if (sscanf(line, "%d %d %d %[^\n\r]\n", &red, &green, &blue, name) == 4) { Index: xc/programs/rgb/showrgb.man diff -u xc/programs/rgb/showrgb.man:1.7 xc/programs/rgb/showrgb.man:1.8 --- xc/programs/rgb/showrgb.man:1.7 Fri Dec 14 15:01:04 2001 +++ xc/programs/rgb/showrgb.man Sat Oct 12 12:06:45 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/rgb/showrgb.man,v 1.7 2001/12/14 20:01:04 dawes Exp $ +.\" $XFree86: xc/programs/rgb/showrgb.man,v 1.8 2002/10/12 16:06:45 herrb Exp $ .\" .TH SHOWRGB 1 __xorgversion__ .SH NAME @@ -44,5 +44,5 @@ the \fI.pag\fP or \fI.dir\fP suffix. .SH FILES .TP 20 -<XRoot>/lib/X11/rgb +.I __projectroot__/lib/X11/rgb default database. Index: xc/programs/rstart/Imakefile diff -u xc/programs/rstart/Imakefile:3.10 xc/programs/rstart/Imakefile:3.11 --- xc/programs/rstart/Imakefile:3.10 Wed Jan 17 18:45:03 2001 +++ xc/programs/rstart/Imakefile Fri May 31 14:46:08 2002 @@ -3,7 +3,7 @@ XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/programs/rstart/Imakefile,v 3.10 2001/01/17 23:45:03 dawes Exp $ +XCOMM $XFree86: xc/programs/rstart/Imakefile,v 3.11 2002/05/31 18:46:08 dawes Exp $ XCOMM XCOMM Copyright (c) 1993 Quarterdeck Office Systems XCOMM @@ -31,19 +31,11 @@ XCOMM the next time... SERVERNAME=rstartd -#ifndef OS2Architecture SSERVERNAME=$(SERVERNAME) RSERVERNAME=$(SERVERNAME).real SSERVERSRC=server.cpp OS= CLIENTNAME=rstart -#else -SSERVERNAME=$(SERVERNAME).cmd -RSERVERNAME=$(SERVERNAME) -SSERVERSRC=server.os2 -OS=-DOS2 -CLIENTNAME=rstart.cmd -#endif MYLIBDIR=$(LIBDIR)/rstart ENVPREFIX=RSTART Index: xc/programs/rstart/rstartd.man diff -u xc/programs/rstart/rstartd.man:1.6 xc/programs/rstart/rstartd.man:1.7 --- xc/programs/rstart/rstartd.man:1.6 Sat Jan 27 13:21:05 2001 +++ xc/programs/rstart/rstartd.man Sat Oct 12 12:06:45 2002 @@ -19,7 +19,7 @@ .\" REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\" $XFree86: xc/programs/rstart/rstartd.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" $XFree86: xc/programs/rstart/rstartd.man,v 1.7 2002/10/12 16:06:45 herrb Exp $ .\" .hy 0 \" I hate hyphenation. .de EX \"Begin example @@ -58,8 +58,8 @@ is to read. Normally, \fIrstartd\fP is a shell script that invokes \fIrstartd.real\fP with the \fB-c\fP switch, allowing local configuration of the location of the configuration file. If \fIrstartd.real\fP is started -without the -c option, it reads <XRoot>/lib/X11/rstart/config, where -<XRoot> refers to the root of the X11 install tree. +without the -c option, it reads +.IR __projectroot__/lib/X11/rstart/config . .SH INSTALLATION It is critical to successful interoperation of the Remote Start protocol that \fIrstartd\fP be installed in a directory which is in the "default" @@ -100,7 +100,7 @@ The context name is converted to lower case. .PP \fIRstartd\fP will read the global config file for that context, default name -<XRoot>/lib/X11/rstart/contexts/<name>, if any. +__projectroot__/lib/X11/rstart/contexts/<name>, if any. .PP It will then read the user's config file for that context, default name $HOME/.rstart.contexts/<name>, if any. @@ -139,9 +139,9 @@ Generic commands are searched for in several places: (defaults) .EX 0 per-user per-context directory ($HOME/.rstart.commands/<context>) -global per-context directory (<XRoot>/lib/X11/rstart/commands/<context>) +global per-context directory (__projectroot__/lib/X11/rstart/commands/<context>) per-user all-contexts directory ($HOME/.rstart.commands) -global all-contexts directory (<XRoot>/lib/X11/rstart/commands) +global all-contexts directory (__projectroot__/lib/X11/rstart/commands) .EE (Yes, this means you can't have an all-contexts generic command with the same name as a context. It didn't seem like a big deal.) Index: xc/programs/scripts/Imakefile diff -u xc/programs/scripts/Imakefile:3.1 xc/programs/scripts/Imakefile:3.2 --- xc/programs/scripts/Imakefile:3.1 Wed Jan 17 18:45:04 2001 +++ xc/programs/scripts/Imakefile Fri May 31 14:46:09 2002 @@ -3,11 +3,9 @@ -XCOMM $XFree86: xc/programs/scripts/Imakefile,v 3.1 2001/01/17 23:45:04 dawes Exp $ +XCOMM $XFree86: xc/programs/scripts/Imakefile,v 3.2 2002/05/31 18:46:09 dawes Exp $ all:: -#ifndef OS2Architecture InstallNamedProg(xon.sh,xon,$(BINDIR)) InstallManPage(xon,$(MANDIR)) -#endif Index: xc/programs/scripts/xon.sh diff -u xc/programs/scripts/xon.sh:1.5 xc/programs/scripts/xon.sh:1.7 --- xc/programs/scripts/xon.sh:1.5 Mon Jan 7 17:00:32 2002 +++ xc/programs/scripts/xon.sh Wed Nov 20 00:00:00 2002 @@ -1,5 +1,6 @@ #!/bin/sh # $Xorg: xon.sh,v 1.4 2000/12/20 16:50:07 pookie Exp $ +# $XFree86: xc/programs/scripts/xon.sh,v 1.7 2002/11/20 05:00:00 dawes Exp $ # start up xterm (or any other X command) on the specified host # Usage: xon host [arguments] [command] @@ -47,7 +48,11 @@ :*) case `uname` in Linux*) - fullname=`hostname -f` + if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then + fullname=`hostname -f` + else + fullname=`hostname` + fi ;; *) fullname=`uname -n` Index: xc/programs/setxkbmap/setxkbmap.c diff -u xc/programs/setxkbmap/setxkbmap.c:3.6 xc/programs/setxkbmap/setxkbmap.c:3.7 --- xc/programs/setxkbmap/setxkbmap.c:3.6 Fri Aug 17 11:39:50 2001 +++ xc/programs/setxkbmap/setxkbmap.c Sun Jan 19 23:15:08 2003 @@ -23,7 +23,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/setxkbmap/setxkbmap.c,v 3.6 2001/08/17 15:39:50 dawes Exp $ */ +/* $XFree86: xc/programs/setxkbmap/setxkbmap.c,v 3.7 2003/01/20 04:15:08 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -81,7 +81,7 @@ #define NUM_STRING_VALS 13 /***====================================================================***/ - +Bool print= False; Bool synch= False; int verbose= 5; @@ -153,6 +153,7 @@ Bool applyConfig ( char * name ); Bool applyRules ( void ); Bool applyComponentNames ( void ); +void printKeymap( void ); /***====================================================================***/ @@ -224,6 +225,7 @@ MSG("-layout <name> Specifies layout used to choose component names\n"); MSG("-model <name> Specifies model used to choose component names\n"); MSG("-option <name> Adds an option used to choose component names\n"); + MSG("-print Print a complete xkb_keymap description and exit\n"); MSG("-rules <name> Name of rules file to use\n"); MSG("-symbols <name> Specifies symbols component name\n"); MSG("-synch Synchronize request w/X server\n"); @@ -402,6 +404,8 @@ ok= addToList(&szOptions,&numOptions,&options,argv[++i]); } } + else if (streq(argv[i],"-print")) + print= True; else if (streq(argv[i],"-rules")) ok= setOptString(&i,argc,argv,RULES_NDX,FROM_CMD_LINE); else if (streq(argv[i],"-symbols")) @@ -847,6 +851,27 @@ return ret; } +void +#if NeedFunctionPrototypes +printKeymap(void) +#else +printKeymap() +#endif +{ + MSG("xkb_keymap {\n"); + if (svValue[KEYCODES_NDX]) + MSG1("\txkb_keycodes { include \"%s\"\t};\n",svValue[KEYCODES_NDX]); + if (svValue[TYPES_NDX]) + MSG1("\txkb_types { include \"%s\"\t};\n",svValue[TYPES_NDX]); + if (svValue[COMPAT_NDX]) + MSG1("\txkb_compat { include \"%s\"\t};\n",svValue[COMPAT_NDX]); + if (svValue[SYMBOLS_NDX]) + MSG1("\txkb_symbols { include \"%s\"\t};\n",svValue[SYMBOLS_NDX]); + if (svValue[GEOMETRY_NDX]) + MSG1("\txkb_geometry { include \"%s\"\t};\n",svValue[GEOMETRY_NDX]); + MSG("};\n"); +} + Bool #if NeedFunctionPrototypes applyComponentNames(void) @@ -871,7 +896,7 @@ MSG("Trying to build keymap using the following components:\n"); dumpNames(False,True); } - if (dpy) { + if (dpy && !print) { XkbComponentNamesRec cmdNames; cmdNames.types= svValue[TYPES_NDX]; cmdNames.compat= svValue[COMPAT_NDX]; @@ -892,6 +917,9 @@ VMSG(0,"Error updating the XKB names property\n"); } } + } + if (print) { + printKeymap(); } return True; } Index: xc/programs/setxkbmap/setxkbmap.man diff -u xc/programs/setxkbmap/setxkbmap.man:3.4 xc/programs/setxkbmap/setxkbmap.man:3.6 --- xc/programs/setxkbmap/setxkbmap.man:3.4 Wed Feb 28 19:56:55 2001 +++ xc/programs/setxkbmap/setxkbmap.man Sun Jan 19 23:15:08 2003 @@ -1,5 +1,5 @@ .\" -.\" $XFree86: xc/programs/setxkbmap/setxkbmap.man,v 3.4 2001/03/01 00:56:55 dawes Exp $ +.\" $XFree86: xc/programs/setxkbmap/setxkbmap.man,v 3.6 2003/01/20 04:15:08 dawes Exp $ .\" .TH SETXKBMAP 1 __xorgversion__ .SH NAME @@ -23,7 +23,7 @@ .P An XKB keymap is constructed from a number of components which are compiled only as needed. The source for all of the components can be found in -<XRoot>/lib/X11/xkb. +.IR __projectroot__/lib/X11/xkb . .SH OPTIONS .TP 8 .B \-help @@ -63,10 +63,16 @@ the keyboard description; multiple options may be specified, one per \fI-option\fP flag. Note that .B setxkbmap -summarize options specified in command -line with options setted before (saved in root window properties). If you -want only specified options will be setted use \fI-option\fP flag with -empty argument first. +summarize options specified in the command +line with options was set before (saved in root window properties). If you +want only specified options will be set use the \fI-option\fP flag with +an empty argument first. +.TP 8 +.B \-print +With this option the \fBsetxkbmap\fP just prints component names in a format +acceptable by an \fBxkbcomp\fP (an XKB keymap compiler) and exits. The option +can be used for tests instead of a verbose option and in case when one need +to run both the \fBsetxkbmap\fP and the \fBxkbcomp\fP in chain (see below). .TP 8 .B \-rules \fIfile\fP Specifies the name of the rules file used to resolve the request layout @@ -87,9 +93,28 @@ Specifies which variant of the keyboard layout should be used to determine the components which make up the keyboard description. Only one variant may be specified on the command line. +.SH USING WITH xkbcomp +If you have an Xserver and a client shell running on differnt computers and +XKB configuration files sets on those machines are different you can get +problems specifying a keyboard map by model, layout, options names. +The thing is the \fBsetxkbcomp\fP converts these names to names of XKB +configuration files according to files that are on the client side computer. +Then it sends the file names to the server where the \fBxkbcomp\fP has to +compose a complete keyboard map using files which the server has. +Thus if the sets of files differ significantly the names that the +\fBsetxkbmap\fP generates can be unacceptable on the server side. You can +solve this problem running the \fBxkbcomp\fP on the client side too. +With the \fI-print\fP option \fBsetxkbmap\fP just prints the files names +in an appropriate format to its stdout and this output can be piped +directly to the \fBxkbcomp\fP input. For example, a command + +\fBsetxkbmap us -print | xkbcomp - $DISPLAY\fP + +makes both step on the same (client) machine and loads a keyboard map into +the server. .ig .SH SEE ALSO keyboards(1) .. .SH FILES -.I <XRoot>/lib/X11/xkb +.I __projectroot__/lib/X11/xkb Index: xc/programs/twm/Imakefile diff -u xc/programs/twm/Imakefile:3.12 xc/programs/twm/Imakefile:3.14 --- xc/programs/twm/Imakefile:3.12 Wed Jan 17 18:45:05 2001 +++ xc/programs/twm/Imakefile Tue Oct 8 16:54:04 2002 @@ -3,18 +3,14 @@ -XCOMM $XFree86: xc/programs/twm/Imakefile,v 3.12 2001/01/17 23:45:05 dawes Exp $ +XCOMM $XFree86: xc/programs/twm/Imakefile,v 3.14 2002/10/08 20:54:04 keithp Exp $ #if HasMkstemp MKTMP_DEFINES = -DHAS_MKSTEMP #endif YFLAGS = -d DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) XkbClientDepLibs $(DEPXLIB) -#ifndef OS2Architecture LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) XkbClientLibs $(XLIB) -#else -LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) XkbClientLibs $(XLIB) $(LEXLIB) -#endif LINTLIBS = $(LINTXMU) $(LINTXTOOLLIB) $(LINTXLIB) DEFINES = $(SIGNAL_DEFINES) $(MKTMP_DEFINES) XkbClientDefines @@ -28,11 +24,7 @@ all:: -#ifndef OS2Architecture SpecialCObjectRule(parse,$(_NOOP_),'-DSYSTEM_INIT_FILE="'$(TWMDIR)'/system.twmrc"') -#else -SpecialCObjectRule(parse,$(_NOOP_),-DSYSTEM_INIT_FILE=\"$(TWMDIR)/system.twmrc\") -#endif #if !HasPutenv SpecialCObjectRule(util,$(_NOOP_),-DNOPUTENV XkbClientDefines) #endif Index: xc/programs/twm/add_window.c diff -u xc/programs/twm/add_window.c:1.10 xc/programs/twm/add_window.c:1.12 --- xc/programs/twm/add_window.c:1.10 Fri Dec 14 15:01:06 2001 +++ xc/programs/twm/add_window.c Tue Dec 10 17:28:07 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/add_window.c,v 1.10 2001/12/14 20:01:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/add_window.c,v 1.12 2002/12/10 22:28:07 tsi Exp $ */ /*****************************************************************************/ /* @@ -203,7 +203,7 @@ XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr); if (!I18N_FetchName(dpy, tmp_win->w, &name)) - name = NULL; + name = NULL; tmp_win->class = NoClass; XGetClassHint(dpy, tmp_win->w, &tmp_win->class); FetchWmProtocols (tmp_win); @@ -1223,6 +1223,7 @@ void ComputeWindowTitleOffsets (tmp_win, width, squeeze) TwmWindow *tmp_win; + int width; Bool squeeze; { tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width); Index: xc/programs/twm/gram.y diff -u xc/programs/twm/gram.y:3.6 xc/programs/twm/gram.y:3.9 --- xc/programs/twm/gram.y:3.6 Fri Dec 14 15:01:07 2001 +++ xc/programs/twm/gram.y Mon Oct 21 09:33:05 2002 @@ -60,7 +60,7 @@ * 11-Nov-90 Dave Sternlicht Adding SaveColors * 10-Oct-90 David M. Sternlicht Storing saved colors on root * - * $XFree86: xc/programs/twm/gram.y,v 3.6 2001/12/14 20:01:07 dawes Exp $ + * $XFree86: xc/programs/twm/gram.y,v 3.9 2002/10/21 13:33:05 alanh Exp $ * ***********************************************************************/ @@ -124,7 +124,7 @@ %type <ptr> string %type <num> pixmap_list cursor_list color_list save_color_list stmt %type <num> win_color_list iconm_list win_list icon_list function menu -%type <num> noarg sarg error narg squeeze +%type <num> noarg sarg error narg squeeze color_entry %type <num> action button number signed_number full fullkey %start twmrc @@ -458,7 +458,7 @@ ParseError = 1; } } - win_color_list + win_color_list { /* No action */; } | CKEYWORD string { if (!do_color_keyword ($1, color, $2)) { twmrc_error_prefix(); @@ -654,6 +654,7 @@ RemoveDQuote(ptr); $$ = ptr; } + ; number : NUMBER { $$ = $1; } ; Index: xc/programs/twm/icons.c diff -u xc/programs/twm/icons.c:1.6 xc/programs/twm/icons.c:1.7 --- xc/programs/twm/icons.c:1.6 Fri Dec 14 15:01:08 2001 +++ xc/programs/twm/icons.c Tue Dec 10 17:29:54 2002 @@ -22,7 +22,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ -/* $XFree86: xc/programs/twm/icons.c,v 1.6 2001/12/14 20:01:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/icons.c,v 1.7 2002/12/10 22:29:54 tsi Exp $ */ /********************************************************************** * @@ -280,6 +280,7 @@ AddIconRegion(geom, grav1, grav2, stepx, stepy) char *geom; int grav1, grav2; +int stepx, stepy; { IconRegion *ir; int mask; Index: xc/programs/twm/list.c diff -u xc/programs/twm/list.c:1.5 xc/programs/twm/list.c:1.8 --- xc/programs/twm/list.c:1.5 Fri Dec 14 15:01:08 2001 +++ xc/programs/twm/list.c Tue Sep 24 17:00:27 2002 @@ -48,7 +48,7 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/list.c,v 1.5 2001/12/14 20:01:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/list.c,v 1.8 2002/09/24 21:00:27 tsi Exp $ */ /********************************************************************** @@ -108,8 +108,8 @@ if (nptr == NULL) { twmrc_error_prefix(); - fprintf (stderr, "unable to allocate %d bytes for name_list\n", - sizeof(name_list)); + fprintf (stderr, "unable to allocate %ld bytes for name_list\n", + (unsigned long)sizeof(name_list)); Done(0); } Index: xc/programs/twm/menus.c diff -u xc/programs/twm/menus.c:1.12 xc/programs/twm/menus.c:1.16 --- xc/programs/twm/menus.c:1.12 Fri Dec 14 15:01:09 2001 +++ xc/programs/twm/menus.c Sat Oct 19 16:04:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/menus.c,v 1.12 2001/12/14 20:01:09 dawes Exp $ */ +/* $XFree86: xc/programs/twm/menus.c,v 1.16 2002/10/19 20:04:20 herrb Exp $ */ /*****************************************************************************/ /* @@ -238,8 +238,8 @@ if (!tb) { fprintf (stderr, - "%s: unable to allocate %d bytes for title button\n", - ProgramName, sizeof(TitleButton)); + "%s: unable to allocate %ld bytes for title button\n", + ProgramName, (unsigned long)sizeof(TitleButton)); return 0; } @@ -2315,7 +2315,7 @@ } break; case F_STARTWM: - execlp("/bin/sh", "sh", "-c", action, NULL); + execlp("/bin/sh", "sh", "-c", action, (void *)NULL); fprintf (stderr, "%s: unable to start: %s\n", ProgramName, *Argv); break; Index: xc/programs/twm/parse.c diff -u xc/programs/twm/parse.c:1.12 xc/programs/twm/parse.c:1.16 --- xc/programs/twm/parse.c:1.12 Fri Dec 14 15:01:09 2001 +++ xc/programs/twm/parse.c Tue Dec 10 17:29:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/parse.c,v 1.12 2001/12/14 20:01:09 dawes Exp $ */ +/* $XFree86: xc/programs/twm/parse.c,v 1.16 2002/12/10 22:29:55 tsi Exp $ */ /*****************************************************************************/ /* @@ -325,6 +325,7 @@ void TwmOutput(c) + int c; { putchar(c); } @@ -1144,8 +1145,8 @@ if (!sinfo) { twmrc_error_prefix(); - fprintf (stderr, "unable to allocate %d bytes for squeeze info\n", - sizeof(SqueezeInfo)); + fprintf (stderr, "unable to allocate %ld bytes for squeeze info\n", + (unsigned long)sizeof(SqueezeInfo)); return; } sinfo->justify = justify; Index: xc/programs/twm/twm.man diff -u xc/programs/twm/twm.man:1.9 xc/programs/twm/twm.man:1.10 --- xc/programs/twm/twm.man:1.9 Fri Dec 14 15:01:10 2001 +++ xc/programs/twm/twm.man Sat Oct 12 12:06:46 2002 @@ -25,7 +25,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/twm/twm.man,v 1.9 2001/12/14 20:01:10 dawes Exp $ +.\" $XFree86: xc/programs/twm/twm.man,v 1.10 2002/10/12 16:06:46 herrb Exp $ .\" .de EX \"Begin example .ne 5 @@ -136,12 +136,11 @@ .B "$HOME/.twmrc" This is the usual name for an individual user's startup file. .TP 8 -.B "<XRoot>/lib/X11/twm/system.twmrc" +.B __projectroot__/lib/X11/twm/system.twmrc If neither of the preceding files are found, \fItwm\fP will look in this file for a default configuration. This is often tailored by the site administrator to -provide convenient menus or familiar bindings for novice users. <XRoot> -refers to the root of the X11 install tree. +provide convenient menus or familiar bindings for novice users. .PP If no startup files are found, \fItwm\fP will use the built-in defaults described above. The only resource used by \fItwm\fP is @@ -333,7 +332,8 @@ .EE where \fIcursorname\fP is one of the cursor names listed below, and \fIstring\fP is the name of a glyph as found in the file -<XRoot>/include/X11/cursorfont.h (without the ``XC_'' prefix). +.I __projectroot__/include/X11/cursorfont.h +(without the ``XC_'' prefix). If the cursor is to be defined from bitmap files, the following syntax is used instead: .EX 0 @@ -1257,9 +1257,9 @@ .SH FILES .PP .nf - $HOME/.twmrc.<screen number> - $HOME/.twmrc - <XRoot>/lib/X11/twm/system.twmrc +.I $HOME/.twmrc.<screen number> +.I $HOME/.twmrc +.I __projectroot__/lib/X11/twm/system.twmrc .fi .SH "ENVIRONMENT VARIABLES" .IP "DISPLAY" 8 Index: xc/programs/twm/util.c diff -u xc/programs/twm/util.c:1.10 xc/programs/twm/util.c:1.13 --- xc/programs/twm/util.c:1.10 Fri Dec 14 15:01:11 2001 +++ xc/programs/twm/util.c Tue Sep 24 17:00:28 2002 @@ -48,7 +48,7 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/util.c,v 1.10 2001/12/14 20:01:11 dawes Exp $ */ +/* $XFree86: xc/programs/twm/util.c,v 1.13 2002/09/24 21:00:28 tsi Exp $ */ /*********************************************************************** @@ -295,8 +295,9 @@ newname = (char *) malloc (HomeLen + strlen(name) + 2); if (!newname) { fprintf (stderr, - "%s: unable to allocate %d bytes to expand filename %s/%s\n", - ProgramName, HomeLen + strlen(name) + 2, Home, &name[1]); + "%s: unable to allocate %ld bytes to expand filename %s/%s\n", + ProgramName, HomeLen + (unsigned long)strlen(name) + 2, + Home, &name[1]); } else { (void) sprintf (newname, "%s/%s", Home, &name[1]); } @@ -447,8 +448,8 @@ if (!sc) { /* no existing, allocate new */ sc = (StdCmap *) malloc (sizeof (StdCmap)); if (!sc) { - fprintf (stderr, "%s: unable to allocate %d bytes for StdCmap\n", - ProgramName, sizeof (StdCmap)); + fprintf (stderr, "%s: unable to allocate %ld bytes for StdCmap\n", + ProgramName, (unsigned long)sizeof (StdCmap)); return; } } Index: xc/programs/x11perf/Imakefile diff -u xc/programs/x11perf/Imakefile:3.6 xc/programs/x11perf/Imakefile:3.10 --- xc/programs/x11perf/Imakefile:3.6 Tue May 1 13:23:27 2001 +++ xc/programs/x11perf/Imakefile Thu Nov 14 16:01:21 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/x11perf/Imakefile,v 3.6 2001/05/01 17:23:27 alanh Exp $ +XCOMM $XFree86: xc/programs/x11perf/Imakefile,v 3.10 2002/11/14 21:01:21 tsi Exp $ #ifndef X11perfcompLib #define X11perfcompLib $(LIBDIR)/x11perfcomp @@ -12,12 +12,20 @@ #if HasShm SHMDEFS = -DMITSHM #endif +#if BuildRenderLibrary + XRENDERDEFS = -DXRENDER + XRENDERDEPS = $(DEPXRENDERLIB) + XRENDERLIBS = $(XRENDERLIB) + XRENDERINCS = $(XRENDERINCLUDES) +#endif #if BuildXftLibrary XFTDEFS = -DXFT XFTDEPS = XftClientDepLibs $(DEPXRENDERLIB) XFTLIBS = XftClientLibs $(XRENDERLIB) + XFTINCS = $(XFTINCLUDES) #endif - DEFINES = $(SIGNAL_DEFINES) $(SHMDEFS) $(XFTDEFS) + DEFINES = $(SIGNAL_DEFINES) $(SHMDEFS) $(XFTDEFS) $(XRENDERDEFS) + INCLUDES = $(XFTINCS) $(XRENDERINCS) PERFLIB = X11perfcompLib HEADERS = x11perf.h bitmaps.h SRCS = x11perf.c bitmaps.c do_tests.c \ @@ -32,15 +40,16 @@ do_dots.o do_windows.o do_movewin.o do_text.o \ do_blt.o do_arcs.o \ do_tris.o do_complex.o do_traps.o -LOCAL_LIBRARIES = $(XFTLIBS) $(XMUULIB) $(XLIB) - DEPLIBS = $(XFTDEPS) $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XFTLIBS) $(XRENDERLIBS) $(XMUULIB) $(XLIB) + DEPLIBS = $(XFTDEPS) $(XRENDERDEPS) $(DEPXMUULIB) $(DEPXLIB) SYS_LIBRARIES = MathLibrary +#ifdef cygwinArchitecture #if UseCygIPC EXTRA_LIBRARIES = -lcygipc #endif +#endif -#ifndef OS2Architecture ComplexProgramTarget(x11perf) all:: x11perfcomp @@ -54,7 +63,3 @@ InstallNamedProg(Xmark.sh,Xmark,$(BINDIR)) InstallManPage(Xmark,$(MANDIR)) InstallManPageLong(x11pcomp,$(MANDIR),x11perfcomp) -#else -all:: - -#endif Index: xc/programs/x11perf/do_complex.c diff -u xc/programs/x11perf/do_complex.c:1.8 xc/programs/x11perf/do_complex.c:1.9 --- xc/programs/x11perf/do_complex.c:1.8 Wed Jul 25 11:05:16 2001 +++ xc/programs/x11perf/do_complex.c Fri May 31 14:46:09 2002 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_complex.c,v 1.8 2001/07/25 15:05:16 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/do_complex.c,v 1.9 2002/05/31 18:46:09 dawes Exp $ */ #include "x11perf.h" @@ -31,7 +31,7 @@ static GC pgc; #include <math.h> -#if defined(QNX4) || defined(__CYGWIN__) +#if defined(QNX4) || defined(__CYGWIN__) || defined(__UNIXOS2__) #define PI 3.14159265358979323846 #else #define PI M_PI Index: xc/programs/x11perf/do_tests.c diff -u xc/programs/x11perf/do_tests.c:1.7 xc/programs/x11perf/do_tests.c:1.10 --- xc/programs/x11perf/do_tests.c:1.7 Wed Jan 17 18:45:12 2001 +++ xc/programs/x11perf/do_tests.c Mon May 13 02:23:35 2002 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_tests.c,v 1.7 2001/01/17 23:45:12 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/do_tests.c,v 1.10 2002/05/13 06:23:35 keithp Exp $ */ #include "x11perf.h" @@ -790,6 +790,40 @@ InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "escherknot", NULL, FillTiled}}, +#ifdef XRENDER + {"-aatrap1", "Fill 1x1 aa trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 1 }}, + {"-aatrap10", "Fill 10x10 aa trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 10 }}, + {"-aatrap100", "Fill 100x100 aa trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 100 }}, + {"-aatrap300", "Fill 300x300 aa trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 300 }}, + {"-addaatrap1", "Fill 1x1 aa pre-added trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 1, "add" }}, + {"-addaatrap10", "Fill 10x10 aa pre-added trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 10, "add" }}, + {"-addaatrap100", "Fill 100x100 aa pre-added trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 100, "add" }}, + {"-addaatrap300", "Fill 300x300 aa pre-added trapezoid", NULL, + InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, + V1_5FEATURE, NONROP, 0, + {POLY, 300, "add" }}, +#endif {"-complex10", "Fill 10-pixel/side complex polygon", NULL, InitComplexPoly, DoComplexPoly, NullProc, EndComplexPoly, V1_2ONLY, ROP, 0, @@ -942,6 +976,42 @@ InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=true:rgba=rgb:pixelsize=12", NULL}}, + {"-caa10text", "Char in 80-char aa core line (Charter 10)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {80, 10, "charter:antialias=true:render=false:rgba=0:pixelsize=10", NULL}}, + {"-caa24text", "Char in 30-char aa core line (Charter 24)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {30, 24, "charter:antialias=true:render=false:rgba=0:pixelsize=24", NULL}}, + {"-caaftext", "Char in 80-char aa core line (Courier 12)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {80, 12, "courier:antialias=true:render=false:rgba=0:pixelsize=12", NULL}}, + {"-ca10text", "Char in 80-char a core line (Charter 10)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {80, 10, "charter:antialias=false:render=false:rgba=0:pixelsize=10", NULL}}, + {"-ca24text", "Char in 30-char a core line (Charter 24)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {30, 24, "charter:antialias=false:render=false:rgba=0:pixelsize=24", NULL}}, + {"-caftext", "Char in 80-char a core line (Courier 12)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {80, 12, "courier:antialias=false:render=false:rgba=0:pixelsize=12", NULL}}, + {"-rgb10text", "Char in 80-char rgb core line (Charter 10)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {80, 10, "charter:antialias=true:render=false:rgba=rgb:pixelsize=10", NULL}}, + {"-rgb24text", "Char in 30-char rgb core line (Charter 24)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {30, 24, "charter:antialias=true:render=false:rgba=rgb:pixelsize=24", NULL}}, + {"-rgbftext", "Char in 80-char rgb core line (Courier 12)", NULL, + InitAAText, DoAAText, ClearTextWin, EndAAText, + V1_5FEATURE, NONROP, 0, + {80, 12, "courier:antialias=true:render=false:rgba=rgb:pixelsize=12", NULL}}, #endif {"-scroll10", "Scroll 10x10 pixels", NULL, InitScroll, DoScroll, MidScroll, EndScroll, Index: xc/programs/x11perf/do_text.c diff -u xc/programs/x11perf/do_text.c:1.7 xc/programs/x11perf/do_text.c:1.9 --- xc/programs/x11perf/do_text.c:1.7 Wed Jan 17 18:45:12 2001 +++ xc/programs/x11perf/do_text.c Wed Dec 4 05:28:08 2002 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_text.c,v 1.7 2001/01/17 23:45:12 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/do_text.c,v 1.9 2002/12/04 10:28:08 eich Exp $ */ #include "x11perf.h" #include <stdio.h> @@ -422,21 +422,13 @@ return 0; } - if (aafont->core) - { - printf ("FreeType font '%s' not available, benchmark omitted\n", - p->font); - XftFontClose (xp->d, aafont); - return 0; - } - aadraw = XftDrawCreate (xp->d, xp->w, - DefaultVisual (xp->d, DefaultScreen (xp->d)), - DefaultColormap (xp->d, DefaultScreen (xp->d))); + xp->vinfo.visual, + xp->cmap); if (!aadraw) { - printf ("Render extension not supported in window\n"); + printf ("Cannot create XftDraw object\n"); XftFontClose (xp->d, aafont); return 0; } @@ -445,8 +437,8 @@ color.blue = 0; color.alpha = 0xffff; if (!XftColorAllocValue (xp->d, - DefaultVisual (xp->d, DefaultScreen (xp->d)), - DefaultColormap (xp->d, DefaultScreen (xp->d)), + xp->vinfo.visual, + xp->cmap, &color, &aacolor)) { printf ("Cannot allocate black\n"); @@ -514,8 +506,8 @@ XftDrawDestroy (aadraw); XftFontClose (xp->d, aafont); XftColorFree (xp->d, - DefaultVisual (xp->d, DefaultScreen (xp->d)), - DefaultColormap (xp->d, DefaultScreen (xp->d)), + xp->vinfo.visual, + xp->cmap, &aacolor); } Index: xc/programs/x11perf/do_traps.c diff -u xc/programs/x11perf/do_traps.c:1.5 xc/programs/x11perf/do_traps.c:1.9 --- xc/programs/x11perf/do_traps.c:1.5 Wed Jan 17 18:45:12 2001 +++ xc/programs/x11perf/do_traps.c Wed Dec 4 05:28:08 2002 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_traps.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/do_traps.c,v 1.9 2002/12/04 10:28:08 eich Exp $ */ #include "x11perf.h" #include "bitmaps.h" @@ -106,3 +106,144 @@ free(points); } +#ifdef XRENDER +#include <X11/extensions/Xrender.h> +#include <X11/Xft/Xft.h> + +static XTrapezoid *traps; +static XftDraw *aadraw; +static XftColor aablack, aawhite; +static XRenderPictFormat *maskFormat; + +int +InitFixedTrapezoids(XParms xp, Parms p, int reps) +{ + int i, numTraps; + int rows; + int x, y; + int size, skew; + XTrapezoid *curTrap; + XRenderColor color; + + pgc = xp->fggc; + + size = p->special; + numTraps = p->objects; + traps = (XTrapezoid *)malloc(numTraps * sizeof(XTrapezoid)); + curTrap = traps; + x = size; + y = 0; + rows = 0; + skew = size; + aadraw = XftDrawCreate (xp->d, xp->w, + xp->vinfo.visual, + xp->cmap); + if (p->font && !strcmp (p->font, "add")) + { + XRenderPictFormat templ; + templ.type = PictTypeDirect; + templ.depth = 8; + templ.direct.alpha = 0; + templ.direct.alphaMask = 0xff; + maskFormat = XRenderFindFormat (xp->d, + PictFormatType | + PictFormatDepth | + PictFormatAlpha | + PictFormatAlphaMask, + &templ, + 0); + } + else + maskFormat = 0; + color.red = 0; + color.green = 0; + color.blue = 0; + color.alpha = 0xffff; + if (!XftColorAllocValue (xp->d, + xp->vinfo.visual, + xp->cmap, + &color, &aablack)) + { + XftDrawDestroy (aadraw); + aadraw = 0; + return 0; + } + color.red = 0xffff; + color.green = 0xffff; + color.blue = 0xffff; + color.alpha = 0xffff; + if (!XftColorAllocValue (xp->d, + xp->vinfo.visual, + xp->cmap, + &color, &aawhite)) + { + XftDrawDestroy (aadraw); + aadraw = 0; + return 0; + } + + for (i = 0; i != p->objects; i++, curTrap ++) { + curTrap->top = XDoubleToFixed (y); + curTrap->bottom = XDoubleToFixed (y + size); + curTrap->left.p1.x = XDoubleToFixed (x - skew); + curTrap->left.p1.y = XDoubleToFixed (y); + curTrap->left.p2.x = XDoubleToFixed (x + skew - size); + curTrap->left.p2.y = XDoubleToFixed (y + size); + + curTrap->right.p1.x = XDoubleToFixed (x - skew + size); + curTrap->right.p1.y = XDoubleToFixed (y); + curTrap->right.p2.x = XDoubleToFixed (x + skew); + curTrap->right.p2.y = XDoubleToFixed (y + size); + + skew--; + if (skew < 0) skew = size; + + y += size; + rows++; + if (y + size > HEIGHT || rows == MAXROWS) { + rows = 0; + y = 0; + x += 2 * size; + if (x + size > WIDTH) { + x = size; + } + } + } + + + SetFillStyle(xp, p); + return reps; +} + +void +DoFixedTrapezoids(XParms xp, Parms p, int reps) +{ + int i; + XTrapezoid *curTrap; + Picture white, black, src, dst; + + white = XftDrawSrcPicture (aadraw, &aawhite); + black = XftDrawSrcPicture (aadraw, &aablack); + dst = XftDrawPicture (aadraw); + + src = black; + for (i = 0; i != reps; i++) { + curTrap = traps; + XRenderCompositeTrapezoids (xp->d, PictOpOver, src, dst, maskFormat, + 0, 0, traps, p->objects); + if (src == black) + src = white; + else + src = black; + CheckAbort (); + } +} + +void +EndFixedTrapezoids (XParms xp, Parms p) +{ + free (traps); + XftDrawDestroy (aadraw); +} + +#endif /* XRENDER */ Index: xc/programs/x11perf/x11pcomp.cpp diff -u xc/programs/x11perf/x11pcomp.cpp:1.4 xc/programs/x11perf/x11pcomp.cpp:1.5 --- xc/programs/x11perf/x11pcomp.cpp:1.4 Fri May 18 19:35:33 2001 +++ xc/programs/x11perf/x11pcomp.cpp Mon Nov 25 09:05:05 2002 @@ -1,6 +1,6 @@ XCOMM! /bin/sh XCOMM -XCOMM $XFree86: xc/programs/x11perf/x11pcomp.cpp,v 1.4 2001/05/18 23:35:33 dawes Exp $ +XCOMM $XFree86: xc/programs/x11perf/x11pcomp.cpp,v 1.5 2002/11/25 14:05:05 eich Exp $ XCOMM XCOMM Collects multiple outputs of x11perf. Just feed it a list of files, each XCOMM containing the output from an x11perf run, and this shell will extract the @@ -25,9 +25,10 @@ export PATH set -e -tmp=`pwd`/_rates.$$ +tmp=${TMPDIR-/tmp}/rates.$$ trap "rm -rf $tmp" 0 1 2 15 -mkdir $tmp $tmp/rates +mkdir $tmp || exit 1 +mkdir $tmp/rates ratio= allfiles= XCOMM Include relative rates in output? Report only relative rates? Index: xc/programs/x11perf/x11perf.c diff -u xc/programs/x11perf/x11perf.c:3.7 xc/programs/x11perf/x11perf.c:3.8 --- xc/programs/x11perf/x11perf.c:3.7 Tue Nov 6 11:11:38 2001 +++ xc/programs/x11perf/x11perf.c Wed Dec 4 05:28:08 2002 @@ -21,7 +21,7 @@ SOFTWARE. ****************************************************************************/ -/* $XFree86: xc/programs/x11perf/x11perf.c,v 3.7 2001/11/06 16:11:38 alanh Exp $ */ +/* $XFree86: xc/programs/x11perf/x11perf.c,v 3.8 2002/12/04 10:28:08 eich Exp $ */ #include <stdio.h> #include <ctype.h> @@ -1165,7 +1165,8 @@ XInstallColormap(xparms.d, cmap); } } - + xparms.cmap = cmap; + printf("x11perf - X11 performance program, version %s\n", xparms.version & VERSION1_5 ? "1.5" : xparms.version & VERSION1_4 ? "1.4" : Index: xc/programs/x11perf/x11perf.h diff -u xc/programs/x11perf/x11perf.h:3.4 xc/programs/x11perf/x11perf.h:3.6 --- xc/programs/x11perf/x11perf.h:3.4 Wed Jul 25 11:05:16 2001 +++ xc/programs/x11perf/x11perf.h Wed Dec 4 05:28:08 2002 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/x11perf.h,v 3.4 2001/07/25 15:05:16 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/x11perf.h,v 3.6 2002/12/04 10:28:08 eich Exp $ */ #ifndef VMS #include <X11/Xlib.h> @@ -89,6 +89,7 @@ Bool save_under; int backing_store; unsigned long planemask; + Colormap cmap; } XParmRec, *XParms; typedef int (*InitProc)(XParms xp, Parms p, int reps); @@ -261,6 +262,11 @@ extern int InitTrapezoids ( XParms xp, Parms p, int reps ); extern void DoTrapezoids ( XParms xp, Parms p, int reps ); extern void EndTrapezoids ( XParms xp, Parms p ); +#ifdef XRENDER +extern int InitFixedTrapezoids ( XParms xp, Parms p, int reps ); +extern void DoFixedTrapezoids ( XParms xp, Parms p, int reps ); +extern void EndFixedTrapezoids ( XParms xp, Parms p ); +#endif /* do_tris.c */ extern int InitTriangles ( XParms xp, Parms p, int reps ); Index: xc/programs/xauth/process.c diff -u xc/programs/xauth/process.c:3.12 xc/programs/xauth/process.c:3.18 --- xc/programs/xauth/process.c:3.12 Fri Dec 14 15:01:15 2001 +++ xc/programs/xauth/process.c Wed Feb 12 21:50:22 2003 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xauth/process.c,v 3.12 2001/12/14 20:01:15 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/process.c,v 3.18 2003/02/13 02:50:22 dawes Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -764,6 +764,11 @@ n = strlen (authfilename); xauth_filename = malloc (n + 1); if (xauth_filename) strcpy (xauth_filename, authfilename); + else { + fprintf(stderr,"cannot allocate memory\n"); + return -1; + } + xauth_modified = False; if (verbose) { @@ -802,16 +807,20 @@ */ for (list = xauth_head; list; list = list->next) { if (list->auth->name_length == 18 - && strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) == 0) - { - XauWriteAuth (fp, list->auth); + && strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) == 0) { + if (!XauWriteAuth(fp, list->auth)) { + (void) fclose(fp); + return -1; + } } } for (list = xauth_head; list; list = list->next) { if (list->auth->name_length != 18 - || strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) != 0) - { - XauWriteAuth (fp, list->auth); + || strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) != 0) { + if (!XauWriteAuth(fp, list->auth)) { + (void) fclose(fp); + return -1; + } } } @@ -859,7 +868,7 @@ ProgramName, temp_name); } else { (void) unlink (xauth_filename); -#if defined(WIN32) || defined(__EMX__) +#if defined(WIN32) || defined(__UNIXOS2__) if (rename(temp_name, xauth_filename) == -1) #else if (link (temp_name, xauth_filename) == -1) @@ -1453,8 +1462,8 @@ auth = (Xauth *) malloc (sizeof (Xauth)); if (!auth) { prefix (inputfilename, lineno); - fprintf (stderr, "unable to allocate %d bytes for Xauth structure\n", - sizeof (Xauth)); + fprintf (stderr, "unable to allocate %ld bytes for Xauth structure\n", + (unsigned long)sizeof (Xauth)); free (key); return 1; } @@ -1490,8 +1499,8 @@ list = (AuthList *) malloc (sizeof (AuthList)); if (!list) { prefix (inputfilename, lineno); - fprintf (stderr, "unable to allocate %d bytes for auth list\n", - sizeof (AuthList)); + fprintf (stderr, "unable to allocate %ld bytes for auth list\n", + (unsigned long)sizeof (AuthList)); free (auth); free (key); free (auth->name); Index: xc/programs/xcalc/XCalc-col.ad diff -u xc/programs/xcalc/XCalc-col.ad:1.1 xc/programs/xcalc/XCalc-col.ad:1.2 --- xc/programs/xcalc/XCalc-col.ad:1.1 Sat Feb 12 22:26:18 2000 +++ xc/programs/xcalc/XCalc-col.ad Mon Oct 21 00:18:35 2002 @@ -1,40 +1,102 @@ #include "XCalc" -XCalc*ti.Command.background: gray50 -XCalc*ti.Command.foreground: white +XCalc*ti.backgroundPixmap: gray3?foreground=gray70&background=gray85 +XCalc*ti.bevel.background: gray80 +XCalc*ti.bevel.displayList: foreground gray90;lines -1,0,0,0,0,-1;lines 3,-4,-4,-4,-4,3 -XCalc*ti.button20.background: black -XCalc*ti.button20.foreground: white -XCalc*ti.button25.background: black -XCalc*ti.button25.foreground: white -XCalc*ti.button30.background: black -XCalc*ti.button30.foreground: white -XCalc*ti.button35.background: black -XCalc*ti.button35.foreground: white -XCalc*ti.button40.background: black -XCalc*ti.button40.foreground: white - -XCalc*ti.button22.background: white -XCalc*ti.button22.foreground: black -XCalc*ti.button23.background: white -XCalc*ti.button23.foreground: black -XCalc*ti.button24.background: white -XCalc*ti.button24.foreground: black -XCalc*ti.button27.background: white -XCalc*ti.button27.foreground: black -XCalc*ti.button28.background: white -XCalc*ti.button28.foreground: black -XCalc*ti.button29.background: white -XCalc*ti.button29.foreground: black -XCalc*ti.button32.background: white -XCalc*ti.button32.foreground: black -XCalc*ti.button33.background: white -XCalc*ti.button33.foreground: black -XCalc*ti.button34.background: white -XCalc*ti.button34.foreground: black -XCalc*ti.button37.background: white -XCalc*ti.button37.foreground: black -XCalc*ti.button38.background: white -XCalc*ti.button38.foreground: black -XCalc*ti.button39.background: white -XCalc*ti.button39.foreground: black +XCalc*ti.bevel.borderColor: gray60 +XCalc*ti.bevel.borderWidth: 1 +XCalc*ti.bevel.vertDistance: 4 +XCalc*ti.bevel.defaultDistance: 4 +XCalc*ti.bevel.screen.vertDistance: 4 +XCalc*ti.bevel.screen.horizDistance: 4 +XCalc*ti.bevel.screen*left: chainLeft +XCalc*ti.bevel.screen*right: chainRight +XCalc*ti.bevel.screen*top: chainTop +XCalc*ti.bevel.screen*bottom: chainBottom +XCalc*ti.bevel.screen*background: rgb:9/a/9 +XCalc*ti.bevel.screen.borderColor: gray50 +XCalc*ti.bevel.screen*LCD.foreground: gray20 +XCalc*ti.bevel.screen*INV.vertDistance: 2 + +XCalc*ti.Command.shapeStyle: roundedRectangle +XCalc*ti.Command.displayList: foreground rgb:a/b/c;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 + +XCalc*ti.Command.borderColor: rgb:8/9/a +XCalc*ti.Command.background: rgb:c/d/e +XCalc*ti.Command.foreground: gray5 + +XCalc*ti.button20.foreground: gray5 +XCalc*ti.button20.background: rgb:e/d/c +XCalc*ti.button20.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button20.borderColor: rgb:9/8/7 + +XCalc*ti.button25.foreground: gray5 +XCalc*ti.button25.background: rgb:e/d/c +XCalc*ti.button25.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button25.borderColor: rgb:9/8/7 + +XCalc*ti.button30.foreground: gray5 +XCalc*ti.button30.background: rgb:e/d/c +XCalc*ti.button30.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button30.borderColor: rgb:9/8/7 + +XCalc*ti.button35.foreground: gray5 +XCalc*ti.button35.background: rgb:e/d/c +XCalc*ti.button35.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button35.borderColor: rgb:9/8/7 + +XCalc*ti.button40.foreground: gray5 +XCalc*ti.button40.background: rgb:e/d/c +XCalc*ti.button40.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button40.borderColor: rgb:9/8/7 + + + +XCalc*ti.button22.background: gray95 +XCalc*ti.button22.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button22.borderColor: gray65 + +XCalc*ti.button23.background: gray95 +XCalc*ti.button23.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button23.borderColor: gray65 + +XCalc*ti.button24.background: gray95 +XCalc*ti.button24.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button24.borderColor: gray65 + +XCalc*ti.button27.background: gray95 +XCalc*ti.button27.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button27.borderColor: gray65 + +XCalc*ti.button28.background: gray95 +XCalc*ti.button28.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button28.borderColor: gray65 + +XCalc*ti.button29.background: gray95 +XCalc*ti.button29.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button29.borderColor: gray65 + +XCalc*ti.button32.background: gray95 +XCalc*ti.button32.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button32.borderColor: gray65 + +XCalc*ti.button33.background: gray95 +XCalc*ti.button33.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button33.borderColor: gray65 + +XCalc*ti.button34.background: gray95 +XCalc*ti.button34.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button34.borderColor: gray65 + +XCalc*ti.button37.background: gray95 +XCalc*ti.button37.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button37.borderColor: gray65 + +XCalc*ti.button38.background: gray95 +XCalc*ti.button38.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button38.borderColor: gray65 + +XCalc*ti.button39.background: gray95 +XCalc*ti.button39.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 +XCalc*ti.button39.borderColor: gray65 Index: xc/programs/xcalc/xcalc.man diff -u xc/programs/xcalc/xcalc.man:1.3 xc/programs/xcalc/xcalc.man:1.4 --- xc/programs/xcalc/xcalc.man:1.3 Sat Jan 27 13:21:08 2001 +++ xc/programs/xcalc/xcalc.man Sat Oct 12 12:06:46 2002 @@ -25,7 +25,7 @@ .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" -.\" $XFree86: xc/programs/xcalc/xcalc.man,v 1.3 2001/01/27 18:21:08 dawes Exp $ +.\" $XFree86: xc/programs/xcalc/xcalc.man,v 1.4 2002/10/12 16:06:46 herrb Exp $ .\" .de EX \"Begin example .ne 5 @@ -419,7 +419,7 @@ .br This will cause xcalc to pick up the colors in the app-defaults color customization file: -<XRoot>/lib/X11/app-defaults/XCalc-color. +.IR __apploaddir__/XCalc-color . .fi .SH "SEE ALSO" X(__miscmansuffix__), xrdb(1), the Athena Widget Set Index: xc/programs/xclipboard/Imakefile diff -u xc/programs/xclipboard/Imakefile:1.1.1.3 xc/programs/xclipboard/Imakefile:1.3 --- xc/programs/xclipboard/Imakefile:1.1.1.3 Tue Jan 16 17:47:44 2001 +++ xc/programs/xclipboard/Imakefile Sun Jun 30 22:26:00 2002 @@ -1,9 +1,14 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/xclipboard/Imakefile,v 1.3 2002/07/01 02:26:00 tsi Exp $ + SRCS1 = xclipboard.c OBJS1 = xclipboard.o SRCS2 = xcutsel.c OBJS2 = xcutsel.o - PROGRAMS = xclipboard xcutsel + PROGRAMS = ProgramTargetName(xclipboard) ProgramTargetName(xcutsel) DEPLIBS = XkbClientDepLibs XawClientDepLibs LOCAL_LIBRARIES = XkbClientLibs XawClientLibs DEFINES = XkbClientDefines Index: xc/programs/xclipboard/xclipboard.man diff -u xc/programs/xclipboard/xclipboard.man:1.8 xc/programs/xclipboard/xclipboard.man:1.9 --- xc/programs/xclipboard/xclipboard.man:1.8 Fri Dec 14 15:01:16 2001 +++ xc/programs/xclipboard/xclipboard.man Sat Oct 12 12:06:46 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xclipboard/xclipboard.man,v 1.8 2001/12/14 20:01:16 dawes Exp $ +.\" $XFree86: xc/programs/xclipboard/xclipboard.man,v 1.9 2002/10/12 16:06:46 herrb Exp $ .\" .TH XCLIPBOARD 1 __xorgversion__ .SH NAME @@ -142,7 +142,9 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -<XRoot>/lib/X11/app-defaults/XClipboard - specifies required resources +.TP +.I __apploaddir__/XClipboard +specifies required resources .SH AUTHOR Ralph R. Swick, DEC/MIT Project Athena .br Index: xc/programs/xclock/Clock.c diff -u xc/programs/xclock/Clock.c:3.11 xc/programs/xclock/Clock.c:3.24 --- xc/programs/xclock/Clock.c:3.11 Fri Dec 14 15:01:16 2001 +++ xc/programs/xclock/Clock.c Mon Oct 21 09:33:07 2002 @@ -46,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/Clock.c,v 3.11 2001/12/14 20:01:16 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/Clock.c,v 3.24 2002/10/21 13:33:07 alanh Exp $ */ #include <X11/Xlib.h> #include <X11/StringDefs.h> @@ -70,6 +70,7 @@ #define PI 3.14159265358979 #define TWOPI (2. * PI) +#define MINOR_TICK_FRACT 95 #define SECOND_HAND_FRACT 90 #define MINUTE_HAND_FRACT 70 #define HOUR_HAND_FRACT 40 @@ -96,8 +97,10 @@ goffset(height), XtRImmediate, (XtPointer) 0}, {XtNupdate, XtCInterval, XtRInt, sizeof(int), offset(update), XtRImmediate, (XtPointer) 60 }, +#ifndef XRENDER {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(fgpixel), XtRString, XtDefaultForeground}, +#endif {XtNhand, XtCForeground, XtRPixel, sizeof(Pixel), offset(Hdpixel), XtRString, XtDefaultForeground}, {XtNhighlight, XtCForeground, XtRPixel, sizeof(Pixel), @@ -106,8 +109,12 @@ offset(utime), XtRImmediate, (XtPointer) FALSE}, {XtNanalog, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(analog), XtRImmediate, (XtPointer) TRUE}, + {XtNtwentyfour, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(twentyfour), XtRImmediate, (XtPointer) TRUE}, {XtNbrief, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(brief), XtRImmediate, (XtPointer) FALSE}, + {XtNstrftime, XtCString, XtRString, sizeof(String), + offset(strftime), XtRString, ""}, {XtNchime, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(chime), XtRImmediate, (XtPointer) FALSE }, {XtNpadding, XtCMargin, XtRInt, sizeof(int), @@ -116,6 +123,28 @@ offset(font), XtRString, XtDefaultFont}, {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), offset (backing_store), XtRString, "default"}, +#ifdef XRENDER + {XtNrender, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(render), XtRImmediate, (XtPointer) TRUE }, + {XtNbuffer, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(buffer), XtRImmediate, (XtPointer) TRUE }, + {XtNsharp, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(sharp), XtRImmediate, (XtPointer) FALSE }, + {XtNforeground, XtCForeground, XtRXftColor, sizeof(XftColor), + offset(fg_color), XtRString, XtDefaultForeground}, + {XtNhourColor, XtCForeground, XtRXftColor, sizeof(XftColor), + offset(hour_color), XtRString, "rgba:7f/00/00/c0"}, + {XtNminuteColor, XtCForeground, XtRXftColor, sizeof(XftColor), + offset(min_color), XtRString, "rgba:00/7f/7f/c0"}, + {XtNsecondColor, XtCForeground, XtRXftColor, sizeof(XftColor), + offset(sec_color), XtRString, "rgba:00/00/ff/80"}, + {XtNmajorColor, XtCForeground, XtRXftColor, sizeof(XftColor), + offset(major_color), XtRString, "rgba:7f/00/00/c0"}, + {XtNminorColor, XtCForeground, XtRXftColor, sizeof(XftColor), + offset(minor_color), XtRString, "rgba:00/7f/7f/c0"}, + {XtNface, XtCFace, XtRXftFont, sizeof (XftFont *), + offset (face), XtRString, ""}, +#endif }; #undef offset @@ -140,7 +169,7 @@ Dimension offset, int tick_units ); static void SetSeg ( ClockWidget w, int x1, int y1, int x2, int y2 ); static void DrawClockFace ( ClockWidget w ); -static int round ( double x ); +static int clock_round ( double x ); static Boolean SetValues ( Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args ); @@ -161,7 +190,7 @@ /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, + /* compress_exposure */ XtExposeCompressMaximal, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, @@ -195,11 +224,193 @@ * ****************************************************************/ +#ifdef XRENDER +XtConvertArgRec xftColorConvertArgs[] = { + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)}, + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), + sizeof(Colormap)} +}; + +#define donestr(type, value, tstr) \ + { \ + if (toVal->addr != NULL) { \ + if (toVal->size < sizeof(type)) { \ + toVal->size = sizeof(type); \ + XtDisplayStringConversionWarning(dpy, \ + (char*) fromVal->addr, tstr); \ + return False; \ + } \ + *(type*)(toVal->addr) = (value); \ + } \ + else { \ + static type static_val; \ + static_val = (value); \ + toVal->addr = (XPointer)&static_val; \ + } \ + toVal->size = sizeof(type); \ + return True; \ + } + +static void +XmuFreeXftColor (XtAppContext app, XrmValuePtr toVal, XtPointer closure, + XrmValuePtr args, Cardinal *num_args) +{ + Screen *screen; + Colormap colormap; + XftColor *color; + + if (*num_args != 2) + { + XtAppErrorMsg (app, + "freeXftColor", "wrongParameters", + "XtToolkitError", + "Freeing an XftColor requires screen and colormap arguments", + (String *) NULL, (Cardinal *)NULL); + return; + } + + screen = *((Screen **) args[0].addr); + colormap = *((Colormap *) args[1].addr); + color = (XftColor *) toVal->addr; + XftColorFree (DisplayOfScreen (screen), + DefaultVisual (DisplayOfScreen (screen), + XScreenNumberOfScreen (screen)), + colormap, color); +} + +static Boolean +XmuCvtStringToXftColor(Display *dpy, + XrmValue *args, Cardinal *num_args, + XrmValue *fromVal, XrmValue *toVal, + XtPointer *converter_data) +{ + char *spec; + XRenderColor renderColor; + XftColor xftColor; + Screen *screen; + Colormap colormap; + + if (*num_args != 2) + { + XtAppErrorMsg (XtDisplayToApplicationContext (dpy), + "cvtStringToXftColor", "wrongParameters", + "XtToolkitError", + "String to render color conversion needs screen and colormap arguments", + (String *) NULL, (Cardinal *)NULL); + return False; + } + + screen = *((Screen **) args[0].addr); + colormap = *((Colormap *) args[1].addr); + + spec = (char *) fromVal->addr; + if (strcasecmp (spec, XtDefaultForeground) == 0) + { + renderColor.red = 0; + renderColor.green = 0; + renderColor.blue = 0; + renderColor.alpha = 0xffff; + } + else if (strcasecmp (spec, XtDefaultBackground) == 0) + { + renderColor.red = 0xffff; + renderColor.green = 0xffff; + renderColor.blue = 0xffff; + renderColor.alpha = 0xffff; + } + else if (!XRenderParseColor (dpy, spec, &renderColor)) + return False; + if (!XftColorAllocValue (dpy, + DefaultVisual (dpy, + XScreenNumberOfScreen (screen)), + colormap, + &renderColor, + &xftColor)) + return False; + + donestr (XftColor, xftColor, XtRXftColor); +} + +static void +XmuFreeXftFont (XtAppContext app, XrmValuePtr toVal, XtPointer closure, + XrmValuePtr args, Cardinal *num_args) +{ + Screen *screen; + XftFont *font; + + if (*num_args != 1) + { + XtAppErrorMsg (app, + "freeXftFont", "wrongParameters", + "XtToolkitError", + "Freeing an XftFont requires screen argument", + (String *) NULL, (Cardinal *)NULL); + return; + } + + screen = *((Screen **) args[0].addr); + font = *((XftFont **) toVal->addr); + if (font) + XftFontClose (DisplayOfScreen (screen), font); +} + +static Boolean +XmuCvtStringToXftFont(Display *dpy, + XrmValue *args, Cardinal *num_args, + XrmValue *fromVal, XrmValue *toVal, + XtPointer *converter_data) +{ + char *name; + XftFont *font; + Screen *screen; + + if (*num_args != 1) + { + XtAppErrorMsg (XtDisplayToApplicationContext (dpy), + "cvtStringToXftFont", "wrongParameters", + "XtToolkitError", + "String to XftFont conversion needs screen argument", + (String *) NULL, (Cardinal *)NULL); + return False; + } + + screen = *((Screen **) args[0].addr); + name = (char *) fromVal->addr; + + font = XftFontOpenName (dpy, + XScreenNumberOfScreen (screen), + name); + if (font) + { + donestr (XftFont *, font, XtRXftFont); + } + XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRXftFont); + return False; +} + +XtConvertArgRec xftFontConvertArgs[] = { + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)}, +}; + +#endif + static void ClassInitialize(void) { XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0 ); +#ifdef XRENDER + XtSetTypeConverter (XtRString, XtRXftColor, + XmuCvtStringToXftColor, + xftColorConvertArgs, XtNumber(xftColorConvertArgs), + XtCacheByDisplay, XmuFreeXftColor); + XtSetTypeConverter (XtRString, XtRXftFont, + XmuCvtStringToXftFont, + xftFontConvertArgs, XtNumber(xftFontConvertArgs), + XtCacheByDisplay, XmuFreeXftFont); +#endif } static char * @@ -207,9 +418,21 @@ { if (w->clock.brief) { - static char brief[5]; - sprintf (brief, "%02d:%02d", tm->tm_hour, tm->tm_min); - return brief; + if (w->clock.twentyfour) + { + static char brief[6]; + sprintf (brief, "%02d:%02d", tm->tm_hour, tm->tm_min); + return brief; + } + else + { + static char brief[9]; + int hour = tm->tm_hour % 12; + if (!hour) hour = 12; + sprintf (brief, "%02d:%02d %cM", hour, tm->tm_min, + tm->tm_hour >= 12 ? 'P' : 'A'); + return brief; + } } else if (w->clock.utime) { @@ -218,8 +441,25 @@ tsec = time(NULL); sprintf (utime, "%10lu seconds since Epoch", (unsigned long)tsec); return utime; + } else if (*w->clock.strftime) { + /*Note: this code is probably excessively paranoid + about buffer overflow. The extra size 10 padding + is also meant as a further guard against programmer + error, although it is a little controversial*/ + static char ctime[STRFTIME_BUFF_SIZE+10]; + ctime[0] = ctime[STRFTIME_BUFF_SIZE] = '\0'; + strftime (ctime, STRFTIME_BUFF_SIZE-1,w->clock.strftime, tm); + ctime[STRFTIME_BUFF_SIZE-1] = '\0'; + return ctime; } - return asctime (tm); + else if (w->clock.twentyfour) + return asctime (tm); + else + { + static char long12[28]; + strftime(long12, sizeof long12, "%a %b %d %I:%M:%S %p %Y", tm); + return long12; + } } /* ARGSUSED */ @@ -250,17 +490,31 @@ w->clock.font = XQueryFont( XtDisplay(w), XGContextFromGC( DefaultGCOfScreen(XtScreen(w))) ); +#ifdef XRENDER + if (w->clock.render) + { + XGlyphInfo extents; + XftTextExtents8 (XtDisplay (w), w->clock.face, + (FcChar8 *) str, strlen (str), &extents); + min_width = extents.xOff + 2 * w->clock.padding; + min_height = w->clock.face->ascent + w->clock.face->descent + + 2 * w->clock.padding; + } + else +#endif + { min_width = XTextWidth(w->clock.font, str, strlen(str)) + 2 * w->clock.padding; min_height = w->clock.font->ascent + w->clock.font->descent + 2 * w->clock.padding; + } } if (w->core.width == 0) w->core.width = min_width; if (w->core.height == 0) w->core.height = min_height; - myXGCV.foreground = w->clock.fgpixel; + myXGCV.foreground = ClockFgPixel (w); myXGCV.background = w->core.background_pixel; if (w->clock.font != NULL) myXGCV.font = w->clock.font->fid; @@ -269,8 +523,9 @@ myXGCV.line_width = 0; w->clock.myGC = XtGetGC((Widget)w, valuemask, &myXGCV); - valuemask = GCForeground | GCLineWidth ; + valuemask = GCForeground | GCLineWidth | GCGraphicsExposures; myXGCV.foreground = w->core.background_pixel; + myXGCV.graphics_exposures = False; w->clock.EraseGC = XtGetGC((Widget)w, valuemask, &myXGCV); myXGCV.foreground = w->clock.Hipixel; @@ -285,8 +540,394 @@ w->clock.show_second_hand = (w->clock.update <= SECOND_HAND_TIME); w->clock.numseg = 0; w->clock.interval_id = 0; + memset (&w->clock.otm, '\0', sizeof (w->clock.otm)); +#ifdef XRENDER + { + int major, minor; + + if (XRenderQueryVersion (XtDisplay (w), &major, &minor) && + (major > 0 || + (major == 0 && minor >= 4))) + { + w->clock.can_polygon = True; + } + else + w->clock.can_polygon = False; + } + w->clock.pixmap = 0; + w->clock.draw = 0; + w->clock.damage.x = 0; + w->clock.damage.y = 0; + w->clock.damage.height = 0; + w->clock.damage.width = 0; +#endif +} + +#if XRENDER +static void +RenderPrepare (ClockWidget w, XftColor *color) +{ + if (!w->clock.draw) + { + Drawable d = XtWindow (w); + if (w->clock.buffer) + { + if (!w->clock.pixmap) + { + Arg arg[1]; + w->clock.pixmap = XCreatePixmap (XtDisplay (w), d, + w->core.width, + w->core.height, + w->core.depth); + arg[0].name = XtNbackgroundPixmap; + arg[0].value = 0; + XtSetValues ((Widget) w, arg, 1); + } + d = w->clock.pixmap; + } + + w->clock.draw = XftDrawCreate (XtDisplay (w), d, + DefaultVisual (XtDisplay (w), + DefaultScreen(XtDisplay (w))), + w->core.colormap); + w->clock.picture = XftDrawPicture (w->clock.draw); + } + if (color) + w->clock.fill_picture = XftDrawSrcPicture (w->clock.draw, color); +} + +static void +RenderClip (ClockWidget w) +{ + Region r; + Drawable d; + + RenderPrepare (w, 0); + if (w->clock.buffer) + d = w->clock.pixmap; + else + d = XtWindow (w); + XFillRectangle (XtDisplay (w), d, w->clock.EraseGC, + w->clock.damage.x, + w->clock.damage.y, + w->clock.damage.width, + w->clock.damage.height); + r = XCreateRegion (); + XUnionRectWithRegion (&w->clock.damage, + r, r); + XftDrawSetClip (w->clock.draw, r); + XDestroyRegion (r); +} + +static void +RenderTextBounds (ClockWidget w, char *str, int off, int len, + XRectangle *bounds, int *xp, int *yp) +{ + XGlyphInfo head, tail; + int x, y; + + XftTextExtents8 (XtDisplay (w), w->clock.face, (FcChar8 *) str, + off, &head); + XftTextExtents8 (XtDisplay (w), w->clock.face, (FcChar8 *) str + off, + len - off, &tail); + /* + * Compute position of tail + */ + x = w->clock.padding + head.xOff; + y = w->clock.face->ascent + w->clock.padding + head.yOff; + /* + * Compute bounds of tail, pad a bit as the bounds aren't exact + */ + bounds->x = x - tail.x - 1; + bounds->y = y - tail.y - 1; + bounds->width = tail.width + 2; + bounds->height = tail.height + 2; + if (xp) *xp = x; + if (yp) *yp = y; +} + +static void +RenderUpdateRectBounds (XRectangle *damage, XRectangle *bounds) +{ + int x1 = bounds->x; + int y1 = bounds->y; + int x2 = bounds->x + bounds->width; + int y2 = bounds->y + bounds->height; + int d_x1 = damage->x; + int d_y1 = damage->y; + int d_x2 = damage->x + damage->width; + int d_y2 = damage->y + damage->height; + + if (x1 == x2) + { + x1 = d_x1; + x2 = d_x2; + } + else + { + if (d_x1 < x1) x1 = d_x1; + if (d_x2 > x2) x2 = d_x2; + } + if (y1 == y2) + { + y1 = d_y1; + y2 = d_y2; + } + else + { + if (d_y1 < y1) y1 = d_y1; + if (d_y2 > y2) y2 = d_y2; + } + + bounds->x = x1; + bounds->y = y1; + bounds->width = x2 - x1; + bounds->height = y2 - y1; +} + +static Boolean +RenderRectIn (XRectangle *rect, XRectangle *bounds) +{ + int x1 = bounds->x; + int y1 = bounds->y; + int x2 = bounds->x + bounds->width; + int y2 = bounds->y + bounds->height; + int r_x1 = rect->x; + int r_y1 = rect->y; + int r_x2 = rect->x + rect->width; + int r_y2 = rect->y + rect->height; + + return r_x1 < x2 && x1 < r_x2 && r_y1 < y2 && y1 < r_y2; +} + +#define LINE_WIDTH 0.01 +#include <math.h> + +#define XCoord(x,w) ((x) * (w)->clock.x_scale + (w)->clock.x_off) +#define YCoord(y,w) ((y) * (w)->clock.y_scale + (w)->clock.y_off) + +static void +RenderUpdateBounds (XPointDouble *points, int npoints, XRectangle *bounds) +{ + int x1 = bounds->x; + int y1 = bounds->y; + int x2 = bounds->x + bounds->width; + int y2 = bounds->y + bounds->height; + + while (npoints--) + { + int r_x1 = points[0].x; + int r_y1 = points[0].y; + int r_x2 = points[0].x + 1; + int r_y2 = points[0].y + 1; + + if (x1 == x2) + x2 = x1 = r_x1; + if (y1 == y2) + y2 = y1 = r_y1; + if (r_x1 < x1) x1 = r_x1; + if (r_y1 < y1) y1 = r_y1; + if (r_x2 > x2) x2 = r_x2; + if (r_y2 > y2) y2 = r_y2; + points++; + } + bounds->x = x1; + bounds->y = y1; + bounds->width = x2 - x1; + bounds->height = y2 - y1; +} + +static Boolean +RenderCheckBounds (XPointDouble *points, int npoints, XRectangle *bounds) +{ + int x1 = bounds->x; + int y1 = bounds->y; + int x2 = bounds->x + bounds->width; + int y2 = bounds->y + bounds->height; + + while (npoints--) + { + if (x1 <= points->x && points->x <= x2 && + y1 <= points->y && points->y <= y2) + return True; + points++; + } + return False; +} + +static void +RenderUpdate (ClockWidget w) +{ + if (w->clock.buffer && w->clock.pixmap) + { + XCopyArea (XtDisplay (w), w->clock.pixmap, + XtWindow (w), w->clock.EraseGC, + w->clock.damage.x, w->clock.damage.y, + w->clock.damage.width, w->clock.damage.height, + w->clock.damage.x, w->clock.damage.y); + } +} + +static void +RenderResetBounds (XRectangle *bounds) +{ + bounds->x = 0; + bounds->y = 0; + bounds->width = 0; + bounds->height = 0; +} + +static void +RenderLine (ClockWidget w, XDouble x1, XDouble y1, XDouble x2, XDouble y2, + XftColor *color, + Boolean draw) +{ + XPointDouble poly[4]; + XDouble dx = (x2 - x1); + XDouble dy = (y2 - y1); + XDouble len = sqrt (dx*dx + dy*dy); + XDouble ldx = (LINE_WIDTH/2.0) * dy / len; + XDouble ldy = (LINE_WIDTH/2.0) * dx / len; + + poly[0].x = XCoord (x1 + ldx, w); + poly[0].y = YCoord (y1 - ldy, w); + + poly[1].x = XCoord (x2 + ldx, w); + poly[1].y = YCoord (y2 - ldy, w); + + poly[2].x = XCoord (x2 - ldx, w); + poly[2].y = YCoord (y2 + ldy, w); + + poly[3].x = XCoord (x1 - ldx, w); + poly[3].y = YCoord (y1 + ldy, w); + + RenderUpdateBounds (poly, 4, &w->clock.damage); + if (draw) + { + if (RenderCheckBounds (poly, 4, &w->clock.damage)) + { + RenderPrepare (w, color); + XRenderCompositeDoublePoly (XtDisplay (w), + PictOpOver, + w->clock.fill_picture, + w->clock.picture, + w->clock.mask_format, + 0, 0, 0, 0, poly, 4, EvenOddRule); + } + } + else + RenderUpdateBounds (poly, 4, &w->clock.damage); +} + +static void +RenderRotate (ClockWidget w, XPointDouble *out, double x, double y, double s, double c) +{ + out->x = XCoord (x * c - y * s, w); + out->y = YCoord (y * c + x * s, w); +} + +static void +RenderHand (ClockWidget w, int tick_units, int size, XftColor *color, + Boolean draw) +{ + double c, s; + XPointDouble poly[3]; + double outer_x; + double inner_y; + + ClockAngle (tick_units, &c, &s); + s = -s; + + /* compute raw positions */ + outer_x = size / 100.0; + inner_y = HAND_WIDTH_FRACT / 100.0; + + /* rotate them into position */ + RenderRotate (w, &poly[0], outer_x, 0.0, s, c); + RenderRotate (w, &poly[1], -inner_y, inner_y, s, c); + RenderRotate (w, &poly[2], -inner_y, -inner_y, s, c); + + if (draw) + { + if (RenderCheckBounds (poly, 3, &w->clock.damage)) + { + RenderPrepare (w, color); + XRenderCompositeDoublePoly (XtDisplay (w), + PictOpOver, + w->clock.fill_picture, + w->clock.picture, + w->clock.mask_format, + 0, 0, 0, 0, poly, 3, EvenOddRule); + } + } + RenderUpdateBounds (poly, 3, &w->clock.damage); +} + +static void +RenderHands (ClockWidget w, struct tm *tm, Boolean draw) +{ + RenderHand (w, tm->tm_hour * 300 + tm->tm_min*5, HOUR_HAND_FRACT, &w->clock.hour_color, draw); + RenderHand (w, tm->tm_min * 60 + tm->tm_sec, MINUTE_HAND_FRACT, &w->clock.min_color, draw); +} + +static void +RenderSec (ClockWidget w, struct tm *tm, Boolean draw) +{ + double c, s; + XPointDouble poly[10]; + double inner_x, middle_x, outer_x, far_x; + double middle_y; + double line_y; + + ClockAngle (tm->tm_sec * 60, &c, &s); + + s = -s; + + /* + * Compute raw positions + */ + line_y = LINE_WIDTH; + inner_x = (MINUTE_HAND_FRACT / 100.0); + middle_x = ((SECOND_HAND_FRACT + MINUTE_HAND_FRACT) / 200.0); + outer_x = (SECOND_HAND_FRACT / 100.0); + far_x = (MINOR_TICK_FRACT / 100.0); + middle_y = (SECOND_WIDTH_FRACT / 100.0); + + /* + * Rotate them into position + */ + RenderRotate (w, &poly[0], -line_y, line_y, s, c); + RenderRotate (w, &poly[1], inner_x, line_y, s, c); + RenderRotate (w, &poly[2], middle_x, middle_y, s, c); + RenderRotate (w, &poly[3], outer_x, line_y, s, c); + RenderRotate (w, &poly[4], far_x, line_y, s, c); + RenderRotate (w, &poly[5], far_x, -line_y, s, c); + RenderRotate (w, &poly[6], outer_x, -line_y, s, c); + RenderRotate (w, &poly[7], middle_x, -middle_y, s, c); + RenderRotate (w, &poly[8], inner_x, -line_y, s, c); + RenderRotate (w, &poly[9], -line_y, -line_y, s, c); + + if (draw) + { + if (RenderCheckBounds (poly, 10, &w->clock.damage)) + { + RenderPrepare (w, &w->clock.sec_color); + XRenderCompositeDoublePoly (XtDisplay (w), + PictOpOver, + w->clock.fill_picture, + w->clock.picture, + w->clock.mask_format, + 0, 0, 0, 0, poly, 10, EvenOddRule); + } + } + else + { + RenderUpdateBounds (poly, 10, &w->clock.damage); + } } +#endif + static void Realize(Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs) { @@ -313,6 +954,12 @@ { ClockWidget w = (ClockWidget) gw; if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id); +#ifdef RENDER + if (w->clock.picture) + XRenderFreePicture (dpy, w->clock.picture); + if (w->clock.fill_picture) + XRenderFreePicture (dpy, w->clock.fill_picture); +#endif XtReleaseGC (gw, w->clock.myGC); XtReleaseGC (gw, w->clock.HighGC); XtReleaseGC (gw, w->clock.HandGC); @@ -338,6 +985,23 @@ w->clock.centerX = w->core.width / 2; w->clock.centerY = w->core.height / 2; } +#ifdef XRENDER + w->clock.x_scale = 0.45 * w->core.width; + w->clock.y_scale = 0.45 * w->core.height; + w->clock.x_off = 0.5 * w->core.width; + w->clock.y_off = 0.5 * w->core.height; + if (w->clock.pixmap) + { + XFreePixmap (XtDisplay (w), w->clock.pixmap); + w->clock.pixmap = 0; + if (w->clock.draw) + { + XftDrawDestroy (w->clock.draw); + w->clock.draw = 0; + } + w->clock.picture = 0; + } +#endif } /* ARGSUSED */ @@ -346,10 +1010,21 @@ { ClockWidget w = (ClockWidget) gw; if (w->clock.analog) { - if (w->clock.numseg != 0) - erase_hands (w, (struct tm *) 0); - DrawClockFace(w); +#ifdef XRENDER + if (w->clock.render && w->clock.can_polygon) + XClipBox (region, &w->clock.damage); + else +#endif + { + if (w->clock.numseg != 0) + erase_hands (w, (struct tm *) 0); + DrawClockFace(w); + } } else { +#ifdef XRENDER + if (w->clock.render) + XClipBox (region, &w->clock.damage); +#endif w->clock.prev_time_string[0] = '\0'; } clock_tic((XtPointer)w, (XtIntervalId)0); @@ -409,8 +1084,41 @@ prev_len = strlen (w->clock.prev_time_string); for (i = 0; ((i < len) && (i < prev_len) && (w->clock.prev_time_string[i] == time_ptr[i])); i++); - strcpy (w->clock.prev_time_string+i, time_ptr+i); +#ifdef XRENDER + if (w->clock.render) + { + XRectangle old_tail, new_tail, head; + int x, y; + + RenderTextBounds (w, w->clock.prev_time_string, i, prev_len, + &old_tail, 0, 0); + RenderUpdateRectBounds (&old_tail, &w->clock.damage); + RenderTextBounds (w, time_ptr, i, len, + &new_tail, 0, 0); + RenderUpdateRectBounds (&new_tail, &w->clock.damage); + + while (i) + { + RenderTextBounds (w, time_ptr, 0, i, &head, 0, 0); + if (!RenderRectIn (&head, &w->clock.damage)) + break; + i--; + } + RenderTextBounds (w, time_ptr, i, len, &new_tail, &x, &y); + RenderClip (w); + RenderPrepare (w, 0); + XftDrawString8 (w->clock.draw, + &w->clock.fg_color, + w->clock.face, + x, y, + (FcChar8 *) time_ptr + i, len - i); + RenderUpdate (w); + RenderResetBounds (&w->clock.damage); + } + else +#endif + { XDrawImageString (dpy, win, w->clock.myGC, (1+w->clock.padding + XTextWidth (w->clock.font, time_ptr, i)), @@ -424,6 +1132,8 @@ if (clear_from < (int)w->core.width) XFillRectangle (dpy, win, w->clock.EraseGC, clear_from, 0, w->core.width - clear_from, w->core.height); + } + strcpy (w->clock.prev_time_string+i, time_ptr+i); } else { /* * The second (or minute) hand is sec (or min) @@ -439,6 +1149,45 @@ if(tm.tm_hour >= 12) tm.tm_hour -= 12; +#ifdef XRENDER + if (w->clock.render && w->clock.can_polygon) + { + w->clock.mask_format = XRenderFindStandardFormat (XtDisplay (w), + w->clock.sharp ? + PictStandardA1 : + PictStandardA8); + /* + * Compute repaint area + */ + if (tm.tm_min != w->clock.otm.tm_min || + tm.tm_hour != w->clock.otm.tm_hour || + tm.tm_sec != w->clock.otm.tm_sec) + { + RenderHands (w, &w->clock.otm, False); + RenderHands (w, &tm, False); + } + if (w->clock.show_second_hand && + tm.tm_sec != w->clock.otm.tm_sec) + { + RenderSec (w, &w->clock.otm, False); + RenderSec (w, &tm, False); + } + if (w->clock.damage.width && + w->clock.damage.height) + { + RenderClip (w); + DrawClockFace (w); + RenderHands (w, &tm, True); + if (w->clock.show_second_hand == TRUE) + RenderSec (w, &tm, True); + } + w->clock.otm = tm; + RenderUpdate (w); + RenderResetBounds (&w->clock.damage); + return; + } +#endif + erase_hands (w, &tm); if (w->clock.numseg == 0 || @@ -454,7 +1203,7 @@ */ DrawHand(w, w->clock.minute_hand_length, w->clock.hand_width, - tm.tm_min * 12 + tm.tm_min * 60 ); if(w->clock.Hdpixel != w->core.background_pixel) XFillPolygon( dpy, @@ -469,7 +1218,7 @@ w->clock.hour = w->clock.segbuffptr; DrawHand(w, w->clock.hour_hand_length, w->clock.hand_width, - tm.tm_hour * 60 + tm.tm_min + tm.tm_hour * 300 + tm.tm_min * 5 ); if(w->clock.Hdpixel != w->core.background_pixel) { XFillPolygon(dpy, @@ -492,7 +1241,7 @@ w->clock.second_hand_length - 2, w->clock.second_hand_width, w->clock.minute_hand_length + 2, - tm.tm_sec * 12 + tm.tm_sec * 60 ); if(w->clock.Hdpixel != w->core.background_pixel) XFillPolygon( dpy, @@ -569,33 +1318,122 @@ } static float const Sines[] = { -.000000, .008727, .017452, .026177, .034899, .043619, .052336, .061049, -.069756, .078459, .087156, .095846, .104528, .113203, .121869, .130526, -.139173, .147809, .156434, .165048, .173648, .182236, .190809, .199368, -.207912, .216440, .224951, .233445, .241922, .250380, .258819, .267238, -.275637, .284015, .292372, .300706, .309017, .317305, .325568, .333807, -.342020, .350207, .358368, .366501, .374607, .382683, .390731, .398749, -.406737, .414693, .422618, .430511, .438371, .446198, .453990, .461749, -.469472, .477159, .484810, .492424, .500000, .507538, .515038, .522499, -.529919, .537300, .544639, .551937, .559193, .566406, .573576, .580703, -.587785, .594823, .601815, .608761, .615661, .622515, .629320, .636078, -.642788, .649448, .656059, .662620, .669131, .675590, .681998, .688355, -.694658, .700909, .707107 +0.000000, 0.001745, 0.003490, 0.005235, 0.006981, 0.008726, 0.010471, 0.012217, +0.013962, 0.015707, 0.017452, 0.019197, 0.020942, 0.022687, 0.024432, 0.026176, +0.027921, 0.029666, 0.031410, 0.033155, 0.034899, 0.036643, 0.038387, 0.040131, +0.041875, 0.043619, 0.045362, 0.047106, 0.048849, 0.050592, 0.052335, 0.054078, +0.055821, 0.057564, 0.059306, 0.061048, 0.062790, 0.064532, 0.066273, 0.068015, +0.069756, 0.071497, 0.073238, 0.074978, 0.076719, 0.078459, 0.080198, 0.081938, +0.083677, 0.085416, 0.087155, 0.088894, 0.090632, 0.092370, 0.094108, 0.095845, +0.097582, 0.099319, 0.101056, 0.102792, 0.104528, 0.106264, 0.107999, 0.109734, +0.111468, 0.113203, 0.114937, 0.116670, 0.118403, 0.120136, 0.121869, 0.123601, +0.125333, 0.127064, 0.128795, 0.130526, 0.132256, 0.133986, 0.135715, 0.137444, +0.139173, 0.140901, 0.142628, 0.144356, 0.146083, 0.147809, 0.149535, 0.151260, +0.152985, 0.154710, 0.156434, 0.158158, 0.159881, 0.161603, 0.163325, 0.165047, +0.166768, 0.168489, 0.170209, 0.171929, 0.173648, 0.175366, 0.177084, 0.178802, +0.180519, 0.182235, 0.183951, 0.185666, 0.187381, 0.189095, 0.190808, 0.192521, +0.194234, 0.195946, 0.197657, 0.199367, 0.201077, 0.202787, 0.204496, 0.206204, +0.207911, 0.209618, 0.211324, 0.213030, 0.214735, 0.216439, 0.218143, 0.219846, +0.221548, 0.223250, 0.224951, 0.226651, 0.228350, 0.230049, 0.231747, 0.233445, +0.235142, 0.236838, 0.238533, 0.240228, 0.241921, 0.243615, 0.245307, 0.246999, +0.248689, 0.250380, 0.252069, 0.253757, 0.255445, 0.257132, 0.258819, 0.260504, +0.262189, 0.263873, 0.265556, 0.267238, 0.268919, 0.270600, 0.272280, 0.273959, +0.275637, 0.277314, 0.278991, 0.280666, 0.282341, 0.284015, 0.285688, 0.287360, +0.289031, 0.290702, 0.292371, 0.294040, 0.295708, 0.297374, 0.299040, 0.300705, +0.302369, 0.304033, 0.305695, 0.307356, 0.309016, 0.310676, 0.312334, 0.313992, +0.315649, 0.317304, 0.318959, 0.320612, 0.322265, 0.323917, 0.325568, 0.327217, +0.328866, 0.330514, 0.332161, 0.333806, 0.335451, 0.337095, 0.338737, 0.340379, +0.342020, 0.343659, 0.345298, 0.346935, 0.348572, 0.350207, 0.351841, 0.353474, +0.355106, 0.356737, 0.358367, 0.359996, 0.361624, 0.363251, 0.364876, 0.366501, +0.368124, 0.369746, 0.371367, 0.372987, 0.374606, 0.376224, 0.377840, 0.379456, +0.381070, 0.382683, 0.384295, 0.385906, 0.387515, 0.389123, 0.390731, 0.392337, +0.393941, 0.395545, 0.397147, 0.398749, 0.400349, 0.401947, 0.403545, 0.405141, +0.406736, 0.408330, 0.409923, 0.411514, 0.413104, 0.414693, 0.416280, 0.417867, +0.419452, 0.421035, 0.422618, 0.424199, 0.425779, 0.427357, 0.428935, 0.430511, +0.432085, 0.433659, 0.435231, 0.436801, 0.438371, 0.439939, 0.441505, 0.443071, +0.444635, 0.446197, 0.447759, 0.449318, 0.450877, 0.452434, 0.453990, 0.455544, +0.457097, 0.458649, 0.460199, 0.461748, 0.463296, 0.464842, 0.466386, 0.467929, +0.469471, 0.471011, 0.472550, 0.474088, 0.475624, 0.477158, 0.478691, 0.480223, +0.481753, 0.483282, 0.484809, 0.486335, 0.487859, 0.489382, 0.490903, 0.492423, +0.493941, 0.495458, 0.496973, 0.498487, 0.499999, 0.501510, 0.503019, 0.504527, +0.506033, 0.507538, 0.509041, 0.510542, 0.512042, 0.513541, 0.515038, 0.516533, +0.518027, 0.519519, 0.521009, 0.522498, 0.523985, 0.525471, 0.526955, 0.528438, +0.529919, 0.531398, 0.532876, 0.534352, 0.535826, 0.537299, 0.538770, 0.540240, +0.541708, 0.543174, 0.544639, 0.546101, 0.547563, 0.549022, 0.550480, 0.551936, +0.553391, 0.554844, 0.556295, 0.557745, 0.559192, 0.560638, 0.562083, 0.563526, +0.564967, 0.566406, 0.567843, 0.569279, 0.570713, 0.572145, 0.573576, 0.575005, +0.576432, 0.577857, 0.579281, 0.580702, 0.582122, 0.583541, 0.584957, 0.586372, +0.587785, 0.589196, 0.590605, 0.592013, 0.593418, 0.594822, 0.596224, 0.597625, +0.599023, 0.600420, 0.601815, 0.603207, 0.604599, 0.605988, 0.607375, 0.608761, +0.610145, 0.611527, 0.612907, 0.614285, 0.615661, 0.617035, 0.618408, 0.619779, +0.621147, 0.622514, 0.623879, 0.625242, 0.626603, 0.627963, 0.629320, 0.630675, +0.632029, 0.633380, 0.634730, 0.636078, 0.637423, 0.638767, 0.640109, 0.641449, +0.642787, 0.644123, 0.645457, 0.646789, 0.648119, 0.649448, 0.650774, 0.652098, +0.653420, 0.654740, 0.656059, 0.657375, 0.658689, 0.660001, 0.661311, 0.662620, +0.663926, 0.665230, 0.666532, 0.667832, 0.669130, 0.670426, 0.671720, 0.673012, +0.674302, 0.675590, 0.676875, 0.678159, 0.679441, 0.680720, 0.681998, 0.683273, +0.684547, 0.685818, 0.687087, 0.688354, 0.689619, 0.690882, 0.692143, 0.693401, +0.694658, 0.695912, 0.697165, 0.698415, 0.699663, 0.700909, 0.702153, 0.703394, +0.704634, 0.705871, 0.707106, }; - static float const Cosines[] = { -1.00000, .999962, .999848, .999657, .999391, .999048, .998630, .998135, -.997564, .996917, .996195, .995396, .994522, .993572, .992546, .991445, -.990268, .989016, .987688, .986286, .984808, .983255, .981627, .979925, -.978148, .976296, .974370, .972370, .970296, .968148, .965926, .963630, -.961262, .958820, .956305, .953717, .951057, .948324, .945519, .942641, -.939693, .936672, .933580, .930418, .927184, .923880, .920505, .917060, -.913545, .909961, .906308, .902585, .898794, .894934, .891007, .887011, -.882948, .878817, .874620, .870356, .866025, .861629, .857167, .852640, -.848048, .843391, .838671, .833886, .829038, .824126, .819152, .814116, -.809017, .803857, .798636, .793353, .788011, .782608, .777146, .771625, -.766044, .760406, .754710, .748956, .743145, .737277, .731354, .725374, -.719340, .713250, .707107 +1.000000, 0.999998, 0.999993, 0.999986, 0.999975, 0.999961, 0.999945, 0.999925, +0.999902, 0.999876, 0.999847, 0.999815, 0.999780, 0.999742, 0.999701, 0.999657, +0.999610, 0.999559, 0.999506, 0.999450, 0.999390, 0.999328, 0.999262, 0.999194, +0.999122, 0.999048, 0.998970, 0.998889, 0.998806, 0.998719, 0.998629, 0.998536, +0.998440, 0.998341, 0.998239, 0.998134, 0.998026, 0.997915, 0.997801, 0.997684, +0.997564, 0.997440, 0.997314, 0.997185, 0.997052, 0.996917, 0.996778, 0.996637, +0.996492, 0.996345, 0.996194, 0.996041, 0.995884, 0.995724, 0.995561, 0.995396, +0.995227, 0.995055, 0.994880, 0.994702, 0.994521, 0.994337, 0.994150, 0.993960, +0.993767, 0.993571, 0.993372, 0.993170, 0.992965, 0.992757, 0.992546, 0.992331, +0.992114, 0.991894, 0.991671, 0.991444, 0.991215, 0.990983, 0.990747, 0.990509, +0.990268, 0.990023, 0.989776, 0.989525, 0.989272, 0.989015, 0.988756, 0.988493, +0.988228, 0.987959, 0.987688, 0.987413, 0.987136, 0.986855, 0.986572, 0.986285, +0.985996, 0.985703, 0.985407, 0.985109, 0.984807, 0.984503, 0.984195, 0.983885, +0.983571, 0.983254, 0.982935, 0.982612, 0.982287, 0.981958, 0.981627, 0.981292, +0.980955, 0.980614, 0.980271, 0.979924, 0.979575, 0.979222, 0.978867, 0.978508, +0.978147, 0.977783, 0.977415, 0.977045, 0.976672, 0.976296, 0.975916, 0.975534, +0.975149, 0.974761, 0.974370, 0.973975, 0.973578, 0.973178, 0.972775, 0.972369, +0.971961, 0.971549, 0.971134, 0.970716, 0.970295, 0.969872, 0.969445, 0.969015, +0.968583, 0.968147, 0.967709, 0.967267, 0.966823, 0.966376, 0.965925, 0.965472, +0.965016, 0.964557, 0.964095, 0.963630, 0.963162, 0.962691, 0.962217, 0.961741, +0.961261, 0.960779, 0.960293, 0.959805, 0.959313, 0.958819, 0.958322, 0.957822, +0.957319, 0.956813, 0.956304, 0.955793, 0.955278, 0.954760, 0.954240, 0.953716, +0.953190, 0.952661, 0.952129, 0.951594, 0.951056, 0.950515, 0.949972, 0.949425, +0.948876, 0.948323, 0.947768, 0.947210, 0.946649, 0.946085, 0.945518, 0.944948, +0.944376, 0.943800, 0.943222, 0.942641, 0.942057, 0.941470, 0.940880, 0.940288, +0.939692, 0.939094, 0.938493, 0.937888, 0.937281, 0.936672, 0.936059, 0.935444, +0.934825, 0.934204, 0.933580, 0.932953, 0.932323, 0.931691, 0.931055, 0.930417, +0.929776, 0.929132, 0.928485, 0.927836, 0.927183, 0.926528, 0.925870, 0.925209, +0.924546, 0.923879, 0.923210, 0.922538, 0.921863, 0.921185, 0.920504, 0.919821, +0.919135, 0.918446, 0.917754, 0.917060, 0.916362, 0.915662, 0.914959, 0.914253, +0.913545, 0.912834, 0.912120, 0.911403, 0.910683, 0.909961, 0.909236, 0.908508, +0.907777, 0.907044, 0.906307, 0.905568, 0.904827, 0.904082, 0.903335, 0.902585, +0.901832, 0.901077, 0.900318, 0.899557, 0.898794, 0.898027, 0.897258, 0.896486, +0.895711, 0.894934, 0.894154, 0.893371, 0.892585, 0.891797, 0.891006, 0.890212, +0.889416, 0.888617, 0.887815, 0.887010, 0.886203, 0.885393, 0.884580, 0.883765, +0.882947, 0.882126, 0.881303, 0.880477, 0.879648, 0.878817, 0.877982, 0.877146, +0.876306, 0.875464, 0.874619, 0.873772, 0.872922, 0.872069, 0.871213, 0.870355, +0.869494, 0.868631, 0.867765, 0.866896, 0.866025, 0.865151, 0.864274, 0.863395, +0.862513, 0.861629, 0.860742, 0.859852, 0.858959, 0.858064, 0.857167, 0.856267, +0.855364, 0.854458, 0.853550, 0.852640, 0.851726, 0.850811, 0.849892, 0.848971, +0.848048, 0.847121, 0.846193, 0.845261, 0.844327, 0.843391, 0.842452, 0.841510, +0.840566, 0.839619, 0.838670, 0.837718, 0.836764, 0.835807, 0.834847, 0.833885, +0.832921, 0.831954, 0.830984, 0.830012, 0.829037, 0.828060, 0.827080, 0.826098, +0.825113, 0.824126, 0.823136, 0.822144, 0.821149, 0.820151, 0.819152, 0.818149, +0.817144, 0.816137, 0.815127, 0.814115, 0.813100, 0.812083, 0.811063, 0.810041, +0.809016, 0.807989, 0.806960, 0.805928, 0.804893, 0.803856, 0.802817, 0.801775, +0.800731, 0.799684, 0.798635, 0.797583, 0.796529, 0.795473, 0.794414, 0.793353, +0.792289, 0.791223, 0.790155, 0.789084, 0.788010, 0.786935, 0.785856, 0.784776, +0.783693, 0.782608, 0.781520, 0.780430, 0.779337, 0.778243, 0.777145, 0.776046, +0.774944, 0.773840, 0.772733, 0.771624, 0.770513, 0.769399, 0.768283, 0.767165, +0.766044, 0.764921, 0.763796, 0.762668, 0.761538, 0.760405, 0.759271, 0.758134, +0.756995, 0.755853, 0.754709, 0.753563, 0.752414, 0.751264, 0.750111, 0.748955, +0.747798, 0.746638, 0.745475, 0.744311, 0.743144, 0.741975, 0.740804, 0.739631, +0.738455, 0.737277, 0.736097, 0.734914, 0.733729, 0.732542, 0.731353, 0.730162, +0.728968, 0.727772, 0.726574, 0.725374, 0.724171, 0.722967, 0.721760, 0.720551, +0.719339, 0.718126, 0.716910, 0.715692, 0.714472, 0.713250, 0.712026, 0.710799, +0.709570, 0.708339, 0.707106, }; static void @@ -603,10 +1441,10 @@ { int reduced, upper; - reduced = tick_units % 90; - upper = tick_units / 90; + reduced = tick_units % 450; + upper = tick_units / 450; if (upper & 1) - reduced = 90 - reduced; + reduced = 450 - reduced; if ((upper + 1) & 2) { *sinp = Cosines[reduced]; *cosp = Sines[reduced]; @@ -697,14 +1535,14 @@ wc = width * cosangle; ws = width * sinangle; SetSeg(w, - x = w->clock.centerX + round(length * sinangle), - y = w->clock.centerY - round(length * cosangle), - x1 = w->clock.centerX - round(ws + wc), - y1 = w->clock.centerY + round(wc - ws)); /* 1 ---- 2 */ + x = w->clock.centerX + clock_round(length * sinangle), + y = w->clock.centerY - clock_round(length * cosangle), + x1 = w->clock.centerX - clock_round(ws + wc), + y1 = w->clock.centerY + clock_round(wc - ws)); /* 1 ---- 2 */ /* 2 */ SetSeg(w, x1, y1, - x2 = w->clock.centerX - round(ws - wc), - y2 = w->clock.centerY + round(wc + ws)); /* 2 ----- 3 */ + x2 = w->clock.centerX - clock_round(ws - wc), + y2 = w->clock.centerY + clock_round(wc + ws)); /* 2 ----- 3 */ SetSeg(w, x2, y2, x, y); /* 3 ----- 1(4) */ } @@ -765,14 +1603,14 @@ ws = width * sinangle; /*1 ---- 2 */ SetSeg(w, - x = w->clock.centerX + round(length * sinangle), - y = w->clock.centerY - round(length * cosangle), - w->clock.centerX + round(ms - wc), - w->clock.centerY - round(mc + ws) ); - SetSeg(w, w->clock.centerX + round(offset *sinangle), - w->clock.centerY - round(offset * cosangle), /* 2-----3 */ - w->clock.centerX + round(ms + wc), - w->clock.centerY - round(mc - ws)); + x = w->clock.centerX + clock_round(length * sinangle), + y = w->clock.centerY - clock_round(length * cosangle), + w->clock.centerX + clock_round(ms - wc), + w->clock.centerY - clock_round(mc + ws) ); + SetSeg(w, w->clock.centerX + clock_round(offset *sinangle), + w->clock.centerY - clock_round(offset * cosangle), /* 2-----3 */ + w->clock.centerX + clock_round(ms + wc), + w->clock.centerY - clock_round(mc - ws)); w->clock.segbuffptr->x = x; w->clock.segbuffptr++->y = y; w->clock.numseg ++; @@ -801,10 +1639,43 @@ w->clock.segbuffptr = w->clock.segbuff; w->clock.numseg = 0; for (i = 0; i < 60; i++) + { +#ifdef XRENDER + if (w->clock.render && w->clock.can_polygon) + { + double s, c; + XDouble x1, y1, x2, y2; + XftColor *color; + ClockAngle (i * 60, &s, &c); + x1 = c; + y1 = s; + if (i % 5) + { + x2 = c * (MINOR_TICK_FRACT / 100.0); + y2 = s * (MINOR_TICK_FRACT / 100.0); + color = &w->clock.minor_color; + } + else + { + x2 = c * (SECOND_HAND_FRACT / 100.0); + y2 = s * (SECOND_HAND_FRACT / 100.0); + color = &w->clock.major_color; + } + RenderLine (w, x1, y1, x2, y2, color, True); + } + else +#endif + { DrawLine(w, ( (i % 5) == 0 ? w->clock.second_hand_length : (w->clock.radius - delta) ), - w->clock.radius, i * 12); + w->clock.radius, i * 60); + } + } +#ifdef XRENDER + if (w->clock.render && w->clock.can_polygon) + return; +#endif /* * Go ahead and draw it. */ @@ -817,11 +1688,23 @@ } static int -round(double x) +clock_round(double x) { return(x >= 0.0 ? (int)(x + .5) : (int)(x - .5)); } +#ifdef XRENDER +static Boolean +sameColor (XftColor *old, XftColor *new) +{ + if (old->color.red != new->color.red) return False; + if (old->color.green != new->color.green) return False; + if (old->color.blue != new->color.blue) return False; + if (old->color.alpha != new->color.alpha) return False; + return True; +} +#endif + /* ARGSUSED */ static Boolean SetValues(Widget gcurrent, Widget grequest, Widget gnew, @@ -846,6 +1729,8 @@ clock_tic, (XtPointer)gnew); new->clock.show_second_hand =(new->clock.update <= SECOND_HAND_TIME); + if (new->clock.show_second_hand != current->clock.show_second_hand) + redisplay = TRUE; } if (new->clock.padding != current->clock.padding) @@ -857,10 +1742,10 @@ if (new->clock.font != current->clock.font) redisplay = TRUE; - if ((new->clock.fgpixel != current->clock.fgpixel) + if ((ClockFgPixel(new) != ClockFgPixel (current)) || (new->core.background_pixel != current->core.background_pixel)) { valuemask = GCForeground | GCBackground | GCFont | GCLineWidth; - myXGCV.foreground = new->clock.fgpixel; + myXGCV.foreground = ClockFgPixel (new); myXGCV.background = new->core.background_pixel; myXGCV.font = new->clock.font->fid; myXGCV.line_width = 0; @@ -888,14 +1773,43 @@ } if (new->core.background_pixel != current->core.background_pixel) { - valuemask = GCForeground | GCLineWidth; + valuemask = GCForeground | GCLineWidth | GCGraphicsExposures; myXGCV.foreground = new->core.background_pixel; myXGCV.line_width = 0; + myXGCV.graphics_exposures = False; XtReleaseGC (gcurrent, current->clock.EraseGC); new->clock.EraseGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV); redisplay = TRUE; } - +#ifdef XRENDER + if (new->clock.face != current->clock.face) + redisplay = TRUE; + if (!sameColor (&new->clock.hour_color, ¤t->clock.fg_color) || + !sameColor (&new->clock.hour_color, ¤t->clock.hour_color) || + !sameColor (&new->clock.min_color, ¤t->clock.min_color) || + !sameColor (&new->clock.sec_color, ¤t->clock.sec_color) || + !sameColor (&new->clock.major_color, ¤t->clock.major_color) || + !sameColor (&new->clock.minor_color, ¤t->clock.minor_color)) + redisplay = True; + if (new->clock.sharp != current->clock.sharp) + redisplay = True; + if (new->clock.render != current->clock.render) + redisplay = True; + if (new->clock.buffer != current->clock.buffer) + { + if (new->clock.pixmap) + { + XFreePixmap (XtDisplay (new), new->clock.pixmap); + new->clock.pixmap = 0; + } + if (new->clock.draw) + { + XftDrawDestroy (new->clock.draw); + new->clock.draw = 0; + } + new->clock.picture = 0; + } +#endif return (redisplay); } Index: xc/programs/xclock/Clock.h diff -u xc/programs/xclock/Clock.h:1.6 xc/programs/xclock/Clock.h:1.12 --- xc/programs/xclock/Clock.h:1.6 Fri Dec 14 15:01:17 2001 +++ xc/programs/xclock/Clock.h Mon Oct 21 09:33:07 2002 @@ -49,7 +49,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/Clock.h,v 1.6 2001/12/14 20:01:17 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/Clock.h,v 1.12 2002/10/21 13:33:07 alanh Exp $ */ #ifndef _XawClock_h #define _XawClock_h @@ -66,6 +66,7 @@ Name Class RepType Default Value ---- ----- ------- ------------- + twentyfour Boolean Boolean True analog Boolean Boolean True background Background Pixel white backingStore BackingStore BackingStore default @@ -94,12 +95,19 @@ #define XtNhand "hands" + /* Boolean: 24-hour if TRUE */ +#define XtNtwentyfour "twentyfour" + /* Boolean: digital if FALSE */ #define XtNanalog "analog" /* Boolean: only hour/minute if TRUE */ #define XtNbrief "brief" + /* String: will be used as format arg to + "strftime" if not empty string */ +#define XtNstrftime "strftime" + /* Boolean: show seconds since Epoch if TRUE */ #define XtNutime "utime" @@ -108,6 +116,29 @@ /* Int: amount of space around outside of clock */ #define XtNpadding "padding" + + /* Boolean: use Render extension if TRUE */ +#define XtNrender "render" + + /* Boolean: use backing pixmap for double buffering */ +#define XtNbuffer "buffer" + + /* RenderColor: colors for various clock elements */ +#define XtNhourColor "hourColor" +#define XtNminuteColor "minuteColor" +#define XtNsecondColor "secondColor" +#define XtNmajorColor "majorColor" +#define XtNminorColor "minorColor" + +#define XtRXftColor "XftColor" + +#define XtNface "face" +#define XtCFace "Face" +#define XtRXftFont "XftFont" + + /* Boolean: use sharp rendering for Render polygons */ +#define XtNsharp "sharp" +#define XtCSharp "Sharp" typedef struct _ClockRec *ClockWidget; /* completely defined in ClockPrivate.h */ typedef struct _ClockClassRec *ClockWidgetClass; /* completely defined in ClockPrivate.h */ Index: xc/programs/xclock/ClockP.h diff -u xc/programs/xclock/ClockP.h:1.6 xc/programs/xclock/ClockP.h:1.12 --- xc/programs/xclock/ClockP.h:1.6 Fri Dec 14 15:01:17 2001 +++ xc/programs/xclock/ClockP.h Mon Oct 21 09:33:08 2002 @@ -49,7 +49,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/ClockP.h,v 1.6 2001/12/14 20:01:17 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/ClockP.h,v 1.12 2002/10/21 13:33:08 alanh Exp $ */ #ifndef _XawClockP_h #define _XawClockP_h @@ -57,13 +57,21 @@ #include <X11/Xos.h> /* Needed for struct tm. */ #include "Clock.h" #include <X11/Xaw/SimpleP.h> +#ifdef XRENDER +#include <X11/Xft/Xft.h> +#include <X11/extensions/Xrender.h> +#endif #define SEG_BUFF_SIZE 128 #define ASCII_TIME_BUFLEN 32 /* big enough for 26 plus slop */ +#define STRFTIME_BUFF_SIZE 100 /* buffer for "strftime" option */ + /* New fields for the clock widget instance record */ typedef struct { +#ifndef RENDER Pixel fgpixel; /* color index for text */ +#endif Pixel Hipixel; /* color index for Highlighting */ Pixel Hdpixel; /* color index for hands */ XFontStruct *font; /* font for text */ @@ -79,7 +87,9 @@ Boolean beeped; Boolean analog; Boolean brief; + Boolean twentyfour; Boolean utime; + String strftime; Boolean show_second_hand; Dimension second_hand_length; Dimension minute_hand_length; @@ -96,7 +106,37 @@ struct tm otm ; XtIntervalId interval_id; char prev_time_string[ASCII_TIME_BUFLEN]; +#ifdef XRENDER + XftColor fg_color; + XftColor hour_color; + XftColor min_color; + XftColor sec_color; + XftColor major_color; + XftColor minor_color; + XftFont *face; + XRenderPictFormat *mask_format; + + Boolean render; + Boolean sharp; + Boolean can_polygon; + Boolean buffer; + XftDraw *draw; + Picture picture; + Picture fill_picture; + Pixmap pixmap; + XRectangle damage; + XDouble x_scale; + XDouble x_off; + XDouble y_scale; + XDouble y_off; +#endif } ClockPart; + +#ifdef XRENDER +#define ClockFgPixel(c) ((c)->clock.fg_color.pixel) +#else +#define ClockFgPixel(c) ((c)->clock.fgpixel) +#endif /* Full instance record declaration */ typedef struct _ClockRec { Index: xc/programs/xclock/Imakefile diff -u xc/programs/xclock/Imakefile:1.1.1.3 xc/programs/xclock/Imakefile:1.4 --- xc/programs/xclock/Imakefile:1.1.1.3 Tue Jan 16 17:47:49 2001 +++ xc/programs/xclock/Imakefile Sun Jun 30 22:26:00 2002 @@ -1,10 +1,26 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ - DEPLIBS = XkbClientDepLibs XawClientDepLibs -LOCAL_LIBRARIES = XkbClientLibs XawClientLibs + + + +XCOMM $XFree86: xc/programs/xclock/Imakefile,v 1.4 2002/07/01 02:26:00 tsi Exp $ + +#ifndef XClockUseRender +#define XClockUseRender BuildRenderLibrary +#endif + +#if XClockUseRender + XRENDERDEFS = -DXRENDER + XRENDERDEPS = XftClientDepLibs $(DEPXFTLIB) $(DEPXRENDERLIB) + XRENDERLIBS = XftClientLibs $(XRENDERLIB) -lm + XRENDERINCS = $(XFTINCLUDES) $(XRENDERINCLUDES) +#endif + DEPLIBS = $(XRENDERDEPS) XkbClientDepLibs XawClientDepLibs +LOCAL_LIBRARIES = $(XRENDERLIBS) XkbClientLibs XawClientLibs SRCS = xclock.c Clock.c OBJS = xclock.o Clock.o HEADERS = ClockP.h Clock.h - DEFINES = XkbClientDefines + INCLUDES = $(XRENDERINCS) + DEFINES = $(XRENDERDEFS) XkbClientDefines ComplexProgramTarget(xclock) InstallAppDefaults(XClock) Index: xc/programs/xclock/xclock.c diff -u xc/programs/xclock/xclock.c:1.9 xc/programs/xclock/xclock.c:1.16 --- xc/programs/xclock/xclock.c:1.9 Fri Dec 14 15:01:18 2001 +++ xc/programs/xclock/xclock.c Mon Oct 21 09:33:08 2002 @@ -2,6 +2,8 @@ /* * xclock -- Hacked from Tony Della Fera's much hacked clock program. + * + * "-strftime" option added by George Belotsky, Open Light Software Inc. */ /* @@ -27,7 +29,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xclock/xclock.c,v 1.9 2001/12/14 20:01:18 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/xclock.c,v 1.16 2002/10/21 13:33:08 alanh Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -59,8 +61,17 @@ {"-d", "*clock.analog", XrmoptionNoArg, "FALSE"}, {"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"}, {"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"}, -{"-brief", "*clock.brief", XrmoptionNoArg, "TRUE"}, -{"-utime", "*clock.utime", XrmoptionNoArg, "TRUE"}, +{"-twelve", "*clock.twentyfour", XrmoptionNoArg, "FALSE"}, +{"-twentyfour", "*clock.twentyfour", XrmoptionNoArg, "TRUE"}, +{"-brief", "*clock.brief", XrmoptionNoArg, "TRUE"}, +{"-utime", "*clock.utime", XrmoptionNoArg, "TRUE"}, +{"-strftime", "*clock.strftime", XrmoptionSepArg, NULL}, +#ifdef XRENDER +{"-face", "*clock.face", XrmoptionSepArg, NULL}, +{"-render", "*clock.render", XrmoptionNoArg, "TRUE"}, +{"-norender", "*clock.render", XrmoptionNoArg, "FALSE"}, +{"-sharp", "*clock.sharp", XrmoptionNoArg, "TRUE"}, +#endif }; static void quit ( Widget w, XEvent *event, String *params, @@ -78,12 +89,15 @@ static void Syntax(char *call) { - (void) printf ("Usage: %s [-analog] [-bw <pixels>] [-digital] [-brief] [-utime]\n", call); + (void) printf ("Usage: %s [-analog] [-bw <pixels>] [-digital] [-brief] [-utime] [-strftime <fmt-str>]\n", call); (void) printf (" [-fg <color>] [-bg <color>] [-hd <color>]\n"); (void) printf (" [-hl <color>] [-bd <color>]\n"); (void) printf (" [-fn <font_name>] [-help] [-padding <pixels>]\n"); (void) printf (" [-rv] [-update <seconds>] [-display displayname]\n"); - (void) printf (" [-geometry geom]\n\n"); +#ifdef XRENDER + (void) printf (" [-render] [-face <face name>] [-sharp]\n"); +#endif + (void) printf (" [-geometry geom] [-twelve] [-twentyfour]\n\n"); exit(1); } @@ -136,7 +150,6 @@ if (argc != 1) Syntax(argv[0]); XtAddCallback(toplevel, XtNdieCallback, die, NULL); XtAddCallback(toplevel, XtNsaveCallback, save, NULL); - XtAppAddActions (app_con, xclock_actions, XtNumber(xclock_actions)); /* @@ -148,12 +161,14 @@ XtSetArg(arg, XtNiconPixmap, &icon_pixmap); XtGetValues(toplevel, &arg, ONE); + if (icon_pixmap == None) { arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)clock_bits, clock_width, clock_height); XtSetValues (toplevel, &arg, ONE); } + XtSetArg(arg, XtNiconMask, &icon_pixmap); XtGetValues(toplevel, &arg, ONE); if (icon_pixmap == None) { Index: xc/programs/xclock/xclock.man diff -u xc/programs/xclock/xclock.man:1.10 xc/programs/xclock/xclock.man:1.13 --- xc/programs/xclock/xclock.man:1.10 Fri Dec 14 15:01:18 2001 +++ xc/programs/xclock/xclock.man Mon Oct 21 09:33:08 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xclock/xclock.man,v 1.10 2001/12/14 20:01:18 dawes Exp $ +.\" $XFree86: xc/programs/xclock/xclock.man,v 1.13 2002/10/21 13:33:08 alanh Exp $ .\" .TH XCLOCK 1 __xorgversion__ .SH NAME @@ -33,6 +33,7 @@ \fBxclock\fP [ \fB\-help\fP ] [ \fB\-analog\fP ] [ \fB\-digital\fP ] [ \fB\-brief\fP ] [ \fB\-chime\fP ] [ \fB\-hd\fP \fIcolor\fP ] [ \fB\-hl\fP \fIcolor\fP ] [ \fB\-update\fP \fIseconds\fP ] +[ \fB\-strftime\fP \fIformat\fP ] [ \fB\-padding\fP \fInumber\fP ] .SH DESCRIPTION The @@ -64,6 +65,18 @@ the Epoch (in format '970012340 seconds since Epoch' instead of a standard 24-hour time. .TP 8 +.B \-strftime \fIformat\fP +This option allows an strftime(3) format string to be specified for the +digital clock's display. +.TP 8 +.B \-twelve +This option indicates that a digital clock should display the time in +twelve hour format. +.TP 8 +.B \-twentyfour +This option indicates that a digital clock should display the time in +twenty-four hour format. This is the default when a digital clock is used. +.TP 8 .B \-chime This option indicates that the clock should chime once on the half hour and twice on the hour. @@ -127,6 +140,10 @@ Specifies whether or not an analog clock should be used instead of a digital one. The default is True. .TP 8 +.B twentyfour (\fPclass\fB Boolean) +Specifies whether or not a digital clock should display the time in +twenty-four hour format. The default is True. +.TP 8 .B chime (\fPclass\fB Boolean) Specifies whether or not a bell should be rung on the hour and half hour. .TP 8 @@ -160,7 +177,9 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -<XRoot>/lib/X11/app-defaults/XClock - specifies required resources +.TP +.I __apploaddir__/XClock +specifies required resources .SH "SEE ALSO" X(__miscmansuffix__), xrdb(1), time(3C) .SH BUGS Index: xc/programs/xconsole/xconsole.c diff -u xc/programs/xconsole/xconsole.c:3.29 xc/programs/xconsole/xconsole.c:3.31 --- xc/programs/xconsole/xconsole.c:3.29 Fri Dec 14 15:01:19 2001 +++ xc/programs/xconsole/xconsole.c Tue Oct 15 22:27:40 2002 @@ -26,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.29 2001/12/14 20:01:19 dawes Exp $ */ +/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.31 2002/10/16 02:27:40 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -45,10 +45,9 @@ #include <X11/Xaw/Paned.h> #include <X11/Xaw/Box.h> -extern char *_XawTextGetSTRING(TextWidget ctx, XawTextPosition left, - XawTextPosition right); +extern char *_XawTextGetSTRING(TextWidget ctx, XawTextPosition left, + XawTextPosition right); - #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <sys/stat.h> @@ -73,22 +72,25 @@ static void TextReplace(Widget w, int start, int end, XawTextBlock *block); static void TextAppend(Widget w, char *s, int len); static void TextInsert(Widget w, char *s, int len); +static Bool ExceededMaxLines(Widget w); +static void ScrollLine(Widget w); -static Widget top, text; +static Widget top, text; static XtInputId input_id; + +static FILE *input; +static Boolean regularFile = FALSE; -static FILE *input; -static Boolean regularFile = FALSE; +static Boolean notified; +static Boolean iconified; -static Boolean notified; -static Boolean iconified; +static Atom wm_delete_window; +static Atom mit_console; -static Atom wm_delete_window; -static Atom mit_console; -#define MIT_CONSOLE_LEN 12 +#define MIT_CONSOLE_LEN 12 #define MIT_CONSOLE "MIT_CONSOLE_" -static char mit_console_name[255 + MIT_CONSOLE_LEN + 1] = MIT_CONSOLE; +static char mit_console_name[255 + MIT_CONSOLE_LEN + 1] = MIT_CONSOLE; static struct _app_resources { char *file; @@ -97,6 +99,7 @@ Boolean daemon; Boolean verbose; Boolean exitOnFail; + int saveLines; } app_resources; #define Offset(field) XtOffsetOf(struct _app_resources, field) @@ -114,44 +117,45 @@ Offset (verbose),XtRImmediate, (XtPointer)False}, {"exitOnFail", "ExitOnFail", XtRBoolean, sizeof (Boolean), Offset (exitOnFail),XtRImmediate, (XtPointer)False}, + {"saveLines", "SaveLines", XtRInt, sizeof (int), + Offset (saveLines), XtRImmediate, (XtPointer) 0 }, }; #undef Offset static XrmOptionDescRec options[] = { - {"-file", "*file", XrmoptionSepArg, NULL}, - {"-notify", "*notify", XrmoptionNoArg, "TRUE"}, - {"-nonotify", "*notify", XrmoptionNoArg, "FALSE"}, - {"-daemon", "*daemon", XrmoptionNoArg, "TRUE"}, - {"-verbose", "*verbose", XrmoptionNoArg, "TRUE"}, - {"-exitOnFail", "*exitOnFail", XrmoptionNoArg, "TRUE"}, + {"-file", "*file", XrmoptionSepArg, NULL}, + {"-notify", "*notify", XrmoptionNoArg, "TRUE"}, + {"-nonotify", "*notify", XrmoptionNoArg, "FALSE"}, + {"-daemon", "*daemon", XrmoptionNoArg, "TRUE"}, + {"-verbose", "*verbose", XrmoptionNoArg, "TRUE"}, + {"-exitOnFail", "*exitOnFail", XrmoptionNoArg, "TRUE"}, + {"-saveLines", "*saveLines", XrmoptionSepArg, NULL}, }; #ifdef ultrix #define USE_FILE -#define FILE_NAME "/dev/xcons" +#define FILE_NAME "/dev/xcons" #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define USE_FILE -#define FILE_NAME "/dev/console$" +#define FILE_NAME "/dev/console$" #define INCL_DOSFILEMGR #define INCL_DOSDEVIOCTL #include <os2.h> #endif - - #ifndef USE_FILE -#include <sys/ioctl.h> +#include <sys/ioctl.h> #ifdef hpux -#include <termios.h> +#include <termios.h> #endif #ifdef SVR4 -#include <termios.h> -#include <sys/stropts.h> /* for I_PUSH */ +#include <termios.h> +#include <sys/stropts.h> /* for I_PUSH */ #ifdef sun -#include <sys/strredir.h> +#include <sys/strredir.h> #endif #endif @@ -181,7 +185,7 @@ { int fd; if ((fd = open("/dev/con", O_RDONLY)) >= 0) - newconsole(fd); + newconsole(fd); } #endif @@ -194,7 +198,7 @@ if (!strcmp (app_resources.file, "console")) { /* must be owner and have read/write permission */ -#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx) && !defined(__EMX__) +#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx) && !defined(__UNIXOS2__) struct stat sbuf; if (!stat("/dev/console", &sbuf) && @@ -203,20 +207,19 @@ #endif { #ifdef USE_FILE - input = fopen (FILE_NAME, "r"); - -#ifdef __EMX__ - if (input) + input = fopen (FILE_NAME, "r"); +#ifdef __UNIXOS2__ + if (input) { ULONG arg = 1,arglen; APIRET rc; - if ((rc=DosDevIOCtl(fileno(input), 0x76,0x4d, + if ((rc=DosDevIOCtl(fileno(input), 0x76,0x4d, &arg, sizeof(arg), &arglen, - NULL, 0, NULL)) != 0) + NULL, 0, NULL)) != 0) { fclose(input); input = 0; - } + } } #endif #endif @@ -238,7 +241,7 @@ } #else if (newconsole(tty_fd) < 0) - perror("newconsole"); + perror("newconsole"); else { input = fdopen (pty_fd, "r"); @@ -268,7 +271,7 @@ struct stat sbuf; regularFile = FALSE; - if (access(app_resources.file, R_OK) == 0) + if (access(app_resources.file, R_OK) == 0) { input = fopen (app_resources.file, "r"); if (input) @@ -299,7 +302,8 @@ static void CloseConsole (void) { - if (input) { + if (input) + { XtRemoveInput (input_id); fclose (input); } @@ -377,15 +381,16 @@ XtSetArg (arglist[0], XtNiconName, &oldName); XtGetValues (top, arglist, 1); oldlen = strlen (oldName); - if (oldlen >= 2) { - newName = malloc (oldlen - 1); - if (!newName) + if (oldlen >= 2) + { + newName = malloc (oldlen - 1); + if (!newName) return; - strncpy (newName, oldName, oldlen - 2); + strncpy (newName, oldName, oldlen - 2); newName[oldlen - 2] = '\0'; - XtSetArg (arglist[0], XtNiconName, newName); - XtSetValues (top, arglist, 1); - free (newName); + XtSetArg (arglist[0], XtNiconName, newName); + XtSetValues (top, arglist, 1); + free (newName); } notified = False; } @@ -413,10 +418,10 @@ } static XtActionsRec actions[] = { - { "Quit", Quit }, - { "Iconified", Iconified }, - { "Deiconified", Deiconified }, - { "Clear", Clear }, + { "Quit", Quit }, + { "Iconified", Iconified }, + { "Deiconified", Deiconified }, + { "Clear", Clear }, }; static void @@ -455,7 +460,7 @@ sleep(1); return; } - + fclose (input); XtRemoveInput (*id); @@ -473,18 +478,20 @@ stripNonprint (buffer); n = strlen (buffer); } + TextAppend ((Widget) text, buffer, n); } static Boolean -ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, +ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) { Display* d = XtDisplay(w); XSelectionRequestEvent* req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); - if (*target == XA_TARGETS(d)) { + if (*target == XA_TARGETS(d)) + { Atom* targetP; Atom* std_targets; unsigned long std_length; @@ -509,46 +516,46 @@ if (*target == XA_LIST_LENGTH(d) || *target == XA_LENGTH(d)) { - long * temp; - - temp = (long *) XtMalloc(sizeof(long)); - if (*target == XA_LIST_LENGTH(d)) - *temp = 1L; - else /* *target == XA_LENGTH(d) */ - *temp = (long) TextLength (text); - - *value = (XtPointer) temp; - *type = XA_INTEGER; - *length = 1L; - *format = 32; - return True; + long * temp; + + temp = (long *) XtMalloc(sizeof(long)); + if (*target == XA_LIST_LENGTH(d)) + *temp = 1L; + else /* *target == XA_LENGTH(d) */ + *temp = (long) TextLength (text); + + *value = (XtPointer) temp; + *type = XA_INTEGER; + *length = 1L; + *format = 32; + return True; } - + if (*target == XA_CHARACTER_POSITION(d)) { - long * temp; - - temp = (long *) XtMalloc(2 * sizeof(long)); - temp[0] = (long) 0; - temp[1] = TextLength (text); - *value = (XtPointer) temp; - *type = XA_SPAN(d); - *length = 2L; - *format = 32; - return True; + long * temp; + + temp = (long *) XtMalloc(2 * sizeof(long)); + temp[0] = (long) 0; + temp[1] = TextLength (text); + *value = (XtPointer) temp; + *type = XA_SPAN(d); + *length = 2L; + *format = 32; + return True; } - + if (*target == XA_STRING || *target == XA_TEXT(d) || *target == XA_COMPOUND_TEXT(d)) { - if (*target == XA_COMPOUND_TEXT(d)) + if (*target == XA_COMPOUND_TEXT(d)) *type = *target; - else + else *type = XA_STRING; *length = TextLength (text); - *value = (XtPointer)_XawTextGetSTRING((TextWidget) text, 0, *length); - *format = 8; + *value = (XtPointer)_XawTextGetSTRING((TextWidget) text, 0, *length); + *format = 8; /* * Drop our connection to the file; the new console program * will open as soon as it receives the selection contents; there @@ -558,9 +565,9 @@ * worse */ CloseConsole (); - return True; + return True; } - + if (XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer *)value, length, format)) return True; @@ -576,7 +583,7 @@ /*ARGSUSED*/ static void -InsertSelection(Widget w, XtPointer client_data, Atom *selection, Atom *type, +InsertSelection(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { if (*type != XT_CONVERT_FAIL) @@ -600,10 +607,10 @@ if (app_resources.daemon) if (fork ()) exit (0); XtAddActions (actions, XtNumber (actions)); - + text = XtCreateManagedWidget ("text", asciiTextWidgetClass, top, NULL, 0); - + XtRealizeWidget (top); num_args = 0; XtSetArg(arglist[num_args], XtNiconic, &iconified); num_args++; @@ -639,12 +646,12 @@ return 0; } -static long +static long TextLength(Widget w) { return XawTextSourceScan (XawTextGetSource (w), (XawTextPosition) 0, - XawstAll, XawsdRight, 1, TRUE); + XawstAll, XawsdRight, 1, TRUE); } static void @@ -676,9 +683,18 @@ block.firstPos = 0; block.length = len; block.format = FMT8BIT; - TextReplace (w, last, last, &block); + /* + * If saveLines is 1, just replace the entire contents of the widget + * each time, so the test in ExceededMaxLines() isn't fooled. + */ + if (app_resources.saveLines == 1) + TextReplace (w, 0, last, &block); + else + TextReplace (w, last, last, &block); if (current == last) XawTextSetInsertionPoint (w, last + block.length); + if (ExceededMaxLines(w)) + ScrollLine(w); } static void @@ -695,10 +711,60 @@ TextReplace (w, 0, 0, &block); if (current == 0) XawTextSetInsertionPoint (w, len); + if (ExceededMaxLines(w)) + ScrollLine(w); } +static Bool +ExceededMaxLines(Widget w) +{ + XawTextPosition end_of_last_line; + Bool retval = False; + + if (app_resources.saveLines > 0) + { + /* + * XawTextSourceScan() will return the end of the widget if it cannot + * find what it is searching for. + */ + end_of_last_line = XawTextSourceScan (XawTextGetSource (w), + (XawTextPosition) 0, + XawstEOL, XawsdRight, + app_resources.saveLines, TRUE); + if (TextLength(w) > end_of_last_line) + retval = True; + else + retval = False; + } + else + retval = False; + return retval; +} + +static void +ScrollLine(Widget w) +{ + XawTextPosition firstnewline; + XawTextBlock block; + + /* + * This is pretty inefficient but should work well enough unless the + * console device is getting totally spammed. Generally, new lines + * only come in one at a time anyway. + */ + firstnewline = XawTextSourceScan (XawTextGetSource (w), + (XawTextPosition) 0, + XawstEOL, XawsdRight, 1, TRUE); + block.ptr = ""; + block.firstPos = 0; + block.length = 0; + block.format = FMT8BIT; + TextReplace (w, 0, firstnewline, &block); +} + #ifdef USE_PTY -/* This function opens up a pty master and stuffs it's value into pty. +/* + * This function opens up a pty master and stuffs its value into pty. * If it finds one, it returns a value of 0. If it does not find one, * it returns a value of !0. This routine is designed to be re-entrant, * so that if a pty master is found and later, we find that the slave @@ -710,13 +776,13 @@ get_pty(int *pty, int *tty, char *ttydev, char *ptydev) { #ifdef SVR4 - if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) { + if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) return 1; - } grantpt(*pty); unlockpt(*pty); strcpy(ttydev, (char *)ptsname(*pty)); - if ((*tty = open(ttydev, O_RDWR)) >= 0) { + if ((*tty = open(ttydev, O_RDWR)) >= 0) + { (void)ioctl(*tty, I_PUSH, "ttcompat"); return 0; } @@ -736,12 +802,14 @@ struct stat fstat_buf; *pty = open ("/dev/ptc", O_RDWR); - if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0) { + if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0) + { return(1); } sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev)); sprintf (ptydev, "/dev/ptyq%d", minor(fstat_buf.st_rdev)); - if ((*tty = open (ttydev, O_RDWR)) >= 0) { + if ((*tty = open (ttydev, O_RDWR)) >= 0) + { /* got one! */ return(0); } @@ -755,7 +823,8 @@ if ((*pty = open (ptydev, O_RDWR)) >= 0 && (*tty = open (ttydev, O_RDWR)) >= 0) { - /* We need to set things up for our next entry + /* + * We need to set things up for our next entry * into this function! */ (void) devindex++; @@ -766,7 +835,7 @@ } #else /* !CRAY */ #ifdef sgi - { + { char *slave; slave = _getpty (pty, O_RDWR, 0622, 0); if ((*tty = open (slave, O_RDWR)) != -1) @@ -785,7 +854,8 @@ if ((*pty = open (ptydev, O_RDWR)) >= 0 && (*tty = open (ttydev, O_RDWR)) >= 0) { - /* We need to set things up for our next entry + /* + * We need to set things up for our next entry * into this function! */ (void) devindex++; @@ -803,7 +873,8 @@ #endif /* umips && SYSTYPE_SYSV */ #endif /* USE_GET_PSEUDOTTY */ #endif /* SVR4 */ - /* We were unable to allocate a pty master! Return an error + /* + * We were unable to allocate a pty master! Return an error * condition and let our caller terminate cleanly. */ return(1); @@ -836,46 +907,53 @@ static FILE * osm_pipe(void) { - int tty; - char ttydev[64]; - - if (access(OSM_DEVICE, R_OK) < 0) return NULL; - if ((tty = open("/dev/ptmx", O_RDWR)) < 0) return NULL; - - grantpt(tty); - unlockpt(tty); - strcpy(ttydev, (char *)ptsname(tty)); - - if ((child_pid = fork()) == 0) { - int pty, osm, nbytes, skip; - char cbuf[128]; + int tty; + char ttydev[64]; - skip = 0; + if (access(OSM_DEVICE, R_OK) < 0) + return NULL; + if ((tty = open("/dev/ptmx", O_RDWR)) < 0) + return NULL; + + grantpt(tty); + unlockpt(tty); + strcpy(ttydev, (char *)ptsname(tty)); + + if ((child_pid = fork()) == 0) + { + int pty, osm, nbytes, skip; + char cbuf[128]; + + skip = 0; #ifndef NO_READAHEAD - osm = open(OSM_DEVICE, O_RDONLY); - if (osm >= 0) { - while ((nbytes = read(osm, cbuf, sizeof(cbuf))) > 0) - skip += nbytes; - close(osm); - } -#endif - pty = open(ttydev, O_RDWR); - if (pty < 0) exit(1); - osm = open(OSM_DEVICE, O_RDONLY); - if (osm < 0) exit(1); - for (nbytes = 0; skip > 0 && nbytes >= 0; skip -= nbytes) { - nbytes = skip; - if (nbytes > sizeof(cbuf)) - nbytes = sizeof(cbuf); - nbytes = read(osm, cbuf, nbytes); - } - while ((nbytes = read(osm, cbuf, sizeof(cbuf))) >= 0) - write(pty, cbuf, nbytes); - exit(0); - } - signal(SIGHUP, KillChild); - signal(SIGINT, KillChild); - signal(SIGTERM, KillChild); - return fdopen(tty, "r"); + osm = open(OSM_DEVICE, O_RDONLY); + if (osm >= 0) + { + while ((nbytes = read(osm, cbuf, sizeof(cbuf))) > 0) + skip += nbytes; + close(osm); + } +#endif + pty = open(ttydev, O_RDWR); + if (pty < 0) + exit(1); + osm = open(OSM_DEVICE, O_RDONLY); + if (osm < 0) + exit(1); + for (nbytes = 0; skip > 0 && nbytes >= 0; skip -= nbytes) + { + nbytes = skip; + if (nbytes > sizeof(cbuf)) + nbytes = sizeof(cbuf); + nbytes = read(osm, cbuf, nbytes); + } + while ((nbytes = read(osm, cbuf, sizeof(cbuf))) >= 0) + write(pty, cbuf, nbytes); + exit(0); + } + signal(SIGHUP, KillChild); + signal(SIGINT, KillChild); + signal(SIGTERM, KillChild); + return fdopen(tty, "r"); } #endif /* USE_OSM */ Index: xc/programs/xconsole/xconsole.man diff -u xc/programs/xconsole/xconsole.man:1.8 xc/programs/xconsole/xconsole.man:1.10 --- xc/programs/xconsole/xconsole.man:1.8 Fri Dec 14 15:01:19 2001 +++ xc/programs/xconsole/xconsole.man Tue Oct 15 22:27:40 2002 @@ -1,44 +1,44 @@ .\" $Xorg: xconsole.man,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group -.\" +.\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. -.\" +.\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE .\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of The Open Group shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the +.\" +.\" Except as contained in this notice, the name of The Open Group shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the .\" The Open Group. .\" -.\" $XFree86: xc/programs/xconsole/xconsole.man,v 1.8 2001/12/14 20:01:19 dawes Exp $ +.\" $XFree86: xc/programs/xconsole/xconsole.man,v 1.10 2002/10/16 02:27:40 dawes Exp $ .\" .TH XCONSOLE 1 __xorgversion__ .SH NAME xconsole \- monitor system console messages with X .SH SYNOPSIS .ta 8n -\fBxconsole\fP [-\fItoolkitoption\fP ...] [-file \fIfile-name\fP] +\fBxconsole\fP [-\fItoolkitoption\fP ...] [-file \fIfile-name\fP] [-notify] [-stripNonprint] [-daemon] [-verbose] [-exitOnFail] .SH DESCRIPTION The -.I xconsole +.I xconsole program displays messages which are usually sent to /dev/console. .SH OPTIONS .I Xconsole -accepts all of the standard X Toolkit command line options along with the +accepts all of the standard X Toolkit command line options along with the additional options listed below: .TP 8 .B \-file \fIfile-name\fP @@ -64,12 +64,27 @@ When set, this option directs .I xconsole to exit when it is unable to redirect the console output. +.TP 8 +.B \-saveLines \fIcount\fP +When set, +.I xconsole +only preserves +.I count +lines of message history instead of growing the text buffer without bound +(a +.I count +of zero \- the default \- is treated as placing no limit on the history). .SH X DEFAULTS -This program uses the +This program uses the .I Athena Text widget, look in the .I Athena Widget Set documentation for controlling it. +.PP +.I Xconsole +otherwise accepts resources of the same names as the command-line options +(without the leading dash). "file" is a string type, "saveLines" an +integer, and the remaining options are booleans. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxconsole\fR. In the notation below, @@ -77,8 +92,8 @@ is given first, followed by the widget instance name. .sp .nf -.TA .5i -.ta .5i +.TA .5i +.ta .5i XConsole xconsole XConsole text .fi @@ -93,7 +108,9 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -<XRoot>/lib/X11/app-defaults/XConsole - specifies required resources +.TP +.I __apploaddir__/XConsole +specifies required resources .SH "SEE ALSO" X(__miscmansuffix__), xrdb(1), Athena Text widget .SH AUTHOR Index: xc/programs/xcursorgen/Imakefile diff -u /dev/null xc/programs/xcursorgen/Imakefile:1.7 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/Imakefile Mon Dec 23 06:05:23 2002 @@ -0,0 +1,37 @@ +XCOMM $XFree86: xc/programs/xcursorgen/Imakefile,v 1.7 2002/12/23 11:05:23 herrb Exp $ +#define IHaveSubdirs +#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" + + SUBDIRS = redglass whiteglass handhelds + DEFAULT_THEME = DefaultCursorTheme + ICONDIR = $(LIBDIR)/icons + THEMEDIR = $(ICONDIR)/default + INCLUDES = $(LIBPNGINC) + DEPLIBS = $(DEPXLIB) +LOCAL_LIBRARIES = $(XCURSORLIB) $(XRENDERLIB) $(XLIB) $(LIBPNGLIB) \ + MathLibrary GzipLibrary + SRCS = xcursorgen.c + OBJS = xcursorgen.o + +ComplexProgramTarget(xcursorgen) +LinkBuildBinary(ProgramTargetName(xcursorgen)) + +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) + +/* + * Create an index.theme file that references the + * default theme + */ + +all:: index.theme + +index.theme:: Imakefile + echo '[Icon Theme]' > index.theme + echo 'Inherits=$(DEFAULT_THEME)' >> index.theme + +clean:: + $(RM) index.theme + +InstallTarget(install,index.theme,$(INSTDATAFLAGS),$(THEMEDIR)) + Index: xc/programs/xcursorgen/xcursorgen.c diff -u /dev/null xc/programs/xcursorgen/xcursorgen.c:1.8 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/xcursorgen.c Fri Nov 22 21:33:20 2002 @@ -0,0 +1,413 @@ +/* $XFree86: xc/programs/xcursorgen/xcursorgen.c,v 1.8 2002/11/23 02:33:20 keithp Exp $ */ +/* + * xcursorgen.c + * + * Copyright (C) 2002 Manish Singh + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Manish Singh not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Manish Singh makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * MANISH SINGH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xcursor/Xcursor.h> + +#include <png.h> + +#define VERSION_STR "0.1" + +struct flist +{ + int size; + int xhot, yhot; + char *pngfile; + int delay; + struct flist *next; +}; + +static void +usage (char *name) +{ + fprintf (stderr, "usage: %s [-Vh] [--version] [--help] [-p <dir>] [--prefix <dir>] [CONFIG [OUT]]\n", + name); + + fprintf (stderr, "Generate an Xcursor file from a series of PNG images\n"); + fprintf (stderr, "\n"); + fprintf (stderr, " -V, --version display the version number and exit\n"); + fprintf (stderr, " -?, --help display this message and exit\n"); + fprintf (stderr, " -p, --prefix <dir> find cursor images in <dir>\n"); + fprintf (stderr, "\n"); + fprintf (stderr, "With no CONFIG, or when CONFIG is -, read standard input. " + "Same with OUT and\n"); + fprintf (stderr, "standard output.\n"); +} + +static int +read_config_file (char *config, struct flist **list) +{ + FILE *fp; + char line[4096], pngfile[4000]; + int size, xhot, yhot, delay; + struct flist *start = NULL, *end = NULL, *curr; + int count = 0; + + if (strcmp (config, "-") != 0) + { + fp = fopen (config, "r"); + if (!fp) + { + *list = NULL; + return 0; + } + } + else + fp = stdin; + + while (fgets (line, sizeof (line), fp) != NULL) + { + if (line[0] == '#') + continue; + + switch (sscanf (line, "%d %d %d %3999s %d", &size, &xhot, &yhot, pngfile, &delay)) + { + case 4: + delay = 50; + break; + case 5: + break; + default: + { + fprintf (stderr, "Bad config file data!\n"); + fclose (fp); + return 0; + } + } + + curr = malloc (sizeof (struct flist)); + + curr->size = size; + curr->xhot = xhot; + curr->yhot = yhot; + + curr->delay = delay; + + curr->pngfile = malloc (strlen (pngfile) + 1); + strcpy (curr->pngfile, pngfile); + + curr->next = NULL; + + if (start) + { + end->next = curr; + end = curr; + } + else + { + start = curr; + end = curr; + } + + count++; + } + + fclose (fp); + + *list = start; + return count; +} + +static void +premultiply_data (png_structp png, png_row_infop row_info, png_bytep data) +{ + int i; + + for (i = 0; i < row_info->rowbytes; i += 4) + { + unsigned char *base = &data[i]; + unsigned char blue = base[0]; + unsigned char green = base[1]; + unsigned char red = base[2]; + unsigned char alpha = base[3]; + XcursorPixel p; + + red = (unsigned) red * (unsigned) alpha / 255; + green = (unsigned) green * (unsigned) alpha / 255; + blue = (unsigned) blue * (unsigned) alpha / 255; + p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0); + memcpy (base, &p, sizeof (XcursorPixel)); + } +} + +static XcursorImage * +load_image (struct flist *list, char *prefix) +{ + XcursorImage *image; + png_structp png; + png_infop info; + png_bytepp rows; + FILE *fp; + int i; + png_uint_32 width, height; + int depth, color, interlace; + char *file; + + png = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (png == NULL) + return NULL; + + info = png_create_info_struct (png); + if (info == NULL) + { + png_destroy_read_struct (&png, NULL, NULL); + return NULL; + } + + if (setjmp (png->jmpbuf)) + { + png_destroy_read_struct (&png, &info, NULL); + return NULL; + } + + if (prefix) + { + file = malloc (strlen (prefix) + 1 + strlen (list->pngfile) + 1); + strcpy (file, prefix); + strcat (file, "/"); + strcat (file, list->pngfile); + } + else + file = list->pngfile; + fp = fopen (file, "rb"); + if (prefix) + free (file); + + if (fp == NULL) + { + png_destroy_read_struct (&png, &info, NULL); + return NULL; + } + + png_init_io (png, fp); + png_read_info (png, info); + png_get_IHDR (png, info, &width, &height, &depth, &color, &interlace, + NULL, NULL); + + /* TODO: More needs to be done here maybe */ + + if (color == PNG_COLOR_TYPE_PALETTE && depth <= 8) + png_set_expand (png); + + if (color == PNG_COLOR_TYPE_GRAY && depth < 8) + png_set_expand (png); + + if (png_get_valid (png, info, PNG_INFO_tRNS)) + png_set_expand (png); + + if (depth == 16) + png_set_strip_16 (png); + + if (depth < 8) + png_set_packing (png); + + if (color == PNG_COLOR_TYPE_GRAY || color == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_gray_to_rgb (png); + + if (interlace != PNG_INTERLACE_NONE) + png_set_interlace_handling (png); + + png_set_bgr (png); + png_set_filler (png, 255, PNG_FILLER_AFTER); + + png_set_read_user_transform_fn (png, premultiply_data); + + png_read_update_info (png, info); + + image = XcursorImageCreate (width, height); + + image->size = list->size; + image->xhot = list->xhot; + image->yhot = list->yhot; + image->delay = list->delay; + + rows = malloc (sizeof (png_bytep) * height); + + for (i = 0; i < height; i++) + rows[i] = (png_bytep) (image->pixels + i * width); + + png_read_image (png, rows); + png_read_end (png, info); + + free (rows); + fclose (fp); + png_destroy_read_struct (&png, &info, NULL); + + return image; +} + +static int +write_cursors (int count, struct flist *list, char *filename, char *prefix) +{ + XcursorImages *cimages; + XcursorImage *image; + int i; + FILE *fp; + int ret; + + if (strcmp (filename, "-") != 0) + { + fp = fopen (filename, "wb"); + if (!fp) + return 1; + } + else + fp = stdout; + + cimages = XcursorImagesCreate (count); + + cimages->nimage = count; + + for (i = 0; i < count; i++, list = list->next) + { + image = load_image (list, prefix); + if (image == NULL) + { + fprintf (stderr, "PNG error while reading %s!\n", list->pngfile); + return 1; + } + + cimages->images[i] = image; + } + + ret = XcursorFileSaveImages (fp, cimages); + + fclose (fp); + + return ret ? 0 : 1; +} + +static int +check_image (char *image) +{ + unsigned int width, height; + unsigned char *data; + int x_hot, y_hot; + XImage ximage; + unsigned char hash[XCURSOR_BITMAP_HASH_SIZE]; + int i; + + if (XReadBitmapFileData (image, &width, &height, &data, &x_hot, &y_hot) != BitmapSuccess) + { + fprintf (stderr, "Can't open bitmap file \"%s\"\n", image); + return 1; + } + ximage.height = height; + ximage.width = width; + ximage.depth = 1; + ximage.bits_per_pixel = 1; + ximage.xoffset = 0; + ximage.format = XYPixmap; + ximage.data = (char *)data; + ximage.byte_order = LSBFirst; + ximage.bitmap_unit = 8; + ximage.bitmap_bit_order = LSBFirst; + ximage.bitmap_pad = 8; + ximage.bytes_per_line = (width+7)/8; + XcursorImageHash (&ximage, hash); + printf ("%s: ", image); + for (i = 0; i < XCURSOR_BITMAP_HASH_SIZE; i++) + printf ("%02x", hash[i]); + printf ("\n"); + return 0; +} + +int +main (int argc, char *argv[]) +{ + struct flist *list; + int count; + char *in = 0, *out = 0; + char *prefix = 0; + int i; + + for (i = 1; i < argc; i++) + { + if (strcmp (argv[i], "-V") == 0 || strcmp (argv[i], "--version") == 0) + { + printf ("xcursorgen version %s\n", VERSION_STR); + return 0; + } + + if (strcmp (argv[i], "-?") == 0 || strcmp (argv[i], "--help") == 0) + { + usage (argv[0]); + return 0; + } + if (strcmp (argv[i], "-image") == 0) + { + int i = 2; + int ret = 0; + while (argv[i]) + { + if (check_image (argv[i])) + ret = i; + i++; + } + return ret; + } + if (strcmp (argv[i], "-p") == 0 || strcmp (argv[i], "--prefix") == 0) + { + i++; + if (argv[i] == 0) + { + usage (argv[0]); + return 1; + } + prefix = argv[i]; + continue; + } + + if (!in) + in = argv[i]; + else if (!out) + out = argv[i]; + else + { + usage (argv[0]); + return 1; + } + } + + if (!in) + in = "-"; + if (!out) + out = "-"; + + count = read_config_file (in, &list); + if (count == 0) + { + fprintf (stderr, "Error reading config file!\n"); + return 1; + } + + return write_cursors (count, list, out, prefix); +} Index: xc/programs/xcursorgen/xcursorgen.man diff -u /dev/null xc/programs/xcursorgen/xcursorgen.man:1.2 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/xcursorgen.man Fri Jan 3 21:59:18 2003 @@ -0,0 +1,47 @@ +.\" +.\" Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and its +.\" documentation for any purpose is hereby granted without fee, provided that +.\" the above copyright notice appear in all copies and that both that +.\" copyright notice and this permission notice appear in supporting +.\" documentation, and that the name of Keith Packard not be used in +.\" advertising or publicity pertaining to distribution of the software without +.\" specific, written prior permission. Keith Packard makes no +.\" representations about the suitability of this software for any purpose. It +.\" is provided "as is" without express or implied warranty. +.\" +.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +.\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +.\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +.\" PERFORMANCE OF THIS SOFTWARE. +.\" +.\" +.\" $XFree86: xc/programs/xcursorgen/xcursorgen.man,v 1.2 2003/01/04 02:59:18 dawes Exp $ +.\" +.TH XCURSORGEN 1 __vendorversion__ +.SH NAME +xcursorgen \- create an X cursor file from a collection of PNG images +.SH SYNOPSIS +.B "xcursorgen" +.RI [ config-file ] +.RI [ output-file ] +.SH DESCRIPTION +Xcursorgen reads the config-file to find the list of cursor images along +with their hotspot and nominal size information. Xcursorgen converts all of +the images to Xcursor format and writes them to the output-file. +.P +Each line in the config file is of the form: +.br +<size> <xhot> <yhot> <filename> <ms-delay> +.br +.P +Multiple images with the same <size> are used to create animated cursors, +the <ms-delay> value on each line indicates how long each image should be +displayed before switching to the next. <ms-delay> can be elided for static +cursors. +.SH "SEE ALSO" +Xcursor(3x) Index: xc/programs/xcursorgen/handhelds/Imakefile diff -u /dev/null xc/programs/xcursorgen/handhelds/Imakefile:1.4 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/Imakefile Sun Feb 9 19:57:25 2003 @@ -0,0 +1,126 @@ +XCOMM $XFree86: xc/programs/xcursorgen/handhelds/Imakefile,v 1.4 2003/02/10 00:57:25 tsi Exp $ + +#define CursorSources(name) $(PNGDIR)/name-16.png + +ICONDIR=$(LIBDIR)/icons +THEME=handhelds +PNGDIR=../redglass +THEMEDIR=$(ICONDIR)/$(THEME)/cursors + +#define CursorTarget(name) @@\ +all:: name @@\ + @@\ +name: name.cfg CursorSources(name) @@\ + $(XCURSORGEN) -p $(PNGDIR) name.cfg name @@\ + @@\ +clean:: @@\ + $(RM) name @@\ + @@\ +InstallTarget(install,name,$(INSTDATFLAGS),$(THEMEDIR)) + + +#define CursorLinkTarget(dst,src) @@\ +all:: dst @@\ + @@\ +dst: src @@\ + RemoveFile(dst) @@\ + $(LN) src dst @@\ + @@\ +clean:: @@\ + $(RM) dst @@\ + @@\ +install.link:: $(DESTDIR)$(THEMEDIR)/src @@\ + RemoveFile($(DESTDIR)$(THEMEDIR)/dst) @@\ + (set -x; cd $(DESTDIR)$(THEMEDIR) && $(LN) src dst) + +CursorTarget(X_cursor) +CursorLinkTarget(arrow,right_ptr) +CursorTarget(based_arrow_down) +CursorTarget(based_arrow_up) +/* CursorTarget(boat) */ +/* CursorTarget(bogosity) */ +CursorTarget(bottom_left_corner) +CursorTarget(bottom_right_corner) +CursorTarget(bottom_side) +CursorTarget(bottom_tee) +/* CursorTarget(box_spiral) */ +CursorTarget(center_ptr) +CursorTarget(circle) +/* CursorTarget(clock) */ +/* CursorTarget(coffee_mug) */ +CursorTarget(cross) +CursorLinkTarget(cross_reverse,cross) +CursorLinkTarget(crosshair,cross) +CursorTarget(dot) +CursorTarget(dotbox) +CursorTarget(double_arrow) +CursorLinkTarget(draft_large,right_ptr) +CursorLinkTarget(draft_small,right_ptr) +CursorTarget(draped_box) +/* CursorTarget(exchange) */ +CursorTarget(fleur) +/* CursorTarget(gobbler) */ +CursorTarget(gumby) +/* CursorTarget(hand1) */ +CursorTarget(hand2) +/* CursorTarget(heart) */ +/* CursorTarget(icon) */ +/* CursorTarget(iron_cross) */ +CursorTarget(left_ptr) +CursorTarget(left_ptr_watch) +CursorTarget(left_side) +CursorTarget(left_tee) +/* CursorTarget(left_button) */ +CursorTarget(ll_angle) +/* CursorTarget(lr_angle) */ /* need */ +/* CursorTarget(man) */ +/* CursorTarget(middlebutton) */ +/* CursorTarget(mouse) */ +CursorTarget(pencil) +/* CursorTarget(pirate) */ +CursorLinkTarget(plus,cross) +/* CursorTarget(question_arrow) */ +CursorTarget(right_ptr) +CursorTarget(right_side) +CursorTarget(right_tee) +/* CursorTarget(rightbutton) */ +/* CursorTarget(rtl_logo) */ +/* CursorTarget(sailboat) */ +/* CursorTarget(sb_down_arrow) */ /* need */ +CursorTarget(sb_h_double_arrow) +/* CursorTarget(sb_left_arrow) */ /* need */ +CursorTarget(sb_right_arrow) +CursorTarget(sb_up_arrow) +CursorTarget(sb_v_double_arrow) +CursorTarget(shuttle) +/* CursorTarget(sizing) */ /* need? */ +/* CursorTarget(spider) */ +/* CursorTarget(spraycan) */ +/* CursorTarget(star) */ +/* CursorTarget(target) */ /* need */ +CursorLinkTarget(tcross,cross) +CursorLinkTarget(top_left_arrow,left_ptr) +CursorTarget(top_left_corner) +CursorTarget(top_right_corner) +CursorTarget(top_side) +CursorTarget(top_tee) +/* CursorTarget(trek) */ +/* CursorTarget(ul_angle) */ /* need */ +/* CursorTarget(umbrella) */ +/* CursorTarget(ur_angle) */ /* need */ +CursorTarget(watch) +CursorTarget(xterm) + +/* + * Application specific cursors for Mozilla + */ +/* moz_alias 0876e1c15ff2fc01f906f1c363074c0f (left_ptr with small arrow) */ +/* moz_copy 08ffe1cb5fe6fc01f906f1c063814ccf (left_ptr with plus) */ +/* moz_hand_grabbing 208530c400c041818281048008011002 (closed hand) */ +/* moz_hand_grab 5aca4d189052212118709018842178c0 (open hand) */ +/* moz_menu 08ffe1e65f80fcfdf9fff11263e74c48 (left_ptr with menu) */ +/* moz_question_arrow 5c6cd98b3f3ebcb1f9c7f1c204630408 (left_ptr with ?) */ +/* moz_spinning (left_ptr with watch) */ +CursorLinkTarget(08e8e1c95fe2fc01f976f1e063a24ccd,left_ptr_watch) + +install:: install.link Index: xc/programs/xcursorgen/handhelds/X_cursor.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/X_cursor.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/X_cursor.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 6 6 X_cursor-16.png Index: xc/programs/xcursorgen/handhelds/based_arrow_down.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/based_arrow_down.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/based_arrow_down.cfg Wed Jan 8 11:03:47 2003 @@ -0,0 +1 @@ +12 6 10 based_arrow_down-16.png Index: xc/programs/xcursorgen/handhelds/based_arrow_up.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/based_arrow_up.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/based_arrow_up.cfg Wed Jan 8 11:03:47 2003 @@ -0,0 +1 @@ +12 6 2 based_arrow_up-16.png Index: xc/programs/xcursorgen/handhelds/bottom_left_corner.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/bottom_left_corner.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/bottom_left_corner.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 2 10 bottom_left_corner-16.png Index: xc/programs/xcursorgen/handhelds/bottom_right_corner.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/bottom_right_corner.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/bottom_right_corner.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 10 10 bottom_right_corner-16.png Index: xc/programs/xcursorgen/handhelds/bottom_side.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/bottom_side.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/bottom_side.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 6 12 bottom_side-16.png Index: xc/programs/xcursorgen/handhelds/bottom_tee.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/bottom_tee.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/bottom_tee.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 6 12 bottom_tee-16.png Index: xc/programs/xcursorgen/handhelds/center_ptr.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/center_ptr.cfg:1.1 --- /dev/null Thu Feb 27 12:34:19 2003 +++ xc/programs/xcursorgen/handhelds/center_ptr.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 5 2 center_ptr-16.png Index: xc/programs/xcursorgen/handhelds/circle.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/circle.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/circle.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 5 5 circle-16.png Index: xc/programs/xcursorgen/handhelds/cross.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/cross.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/cross.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 5 5 cross-16.png Index: xc/programs/xcursorgen/handhelds/dot.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/dot.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/dot.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 6 6 dot-16.png Index: xc/programs/xcursorgen/handhelds/dotbox.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/dotbox.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/dotbox.cfg Wed Jan 8 11:03:47 2003 @@ -0,0 +1 @@ +12 5 5 dotbox-16.png Index: xc/programs/xcursorgen/handhelds/double_arrow.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/double_arrow.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/double_arrow.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 6 7 double_arrow-16.png Index: xc/programs/xcursorgen/handhelds/draped_box.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/draped_box.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/draped_box.cfg Mon Oct 21 14:36:45 2002 @@ -0,0 +1 @@ +12 5 5 draped_box-16.png Index: xc/programs/xcursorgen/handhelds/fleur.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/fleur.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/fleur.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 8 7 fleur-16.png Index: xc/programs/xcursorgen/handhelds/gumby.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/gumby.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/gumby.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 15 3 gumby-16.png Index: xc/programs/xcursorgen/handhelds/hand2.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/hand2.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/hand2.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 2 8 hand2-16.png Index: xc/programs/xcursorgen/handhelds/left_ptr.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/left_ptr.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/left_ptr.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 1 1 left_ptr-16.png Index: xc/programs/xcursorgen/handhelds/left_ptr_watch.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/left_ptr_watch.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/left_ptr_watch.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 1 1 left_ptr_watch-16.png Index: xc/programs/xcursorgen/handhelds/left_side.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/left_side.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/left_side.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 1 6 left_side-16.png Index: xc/programs/xcursorgen/handhelds/left_tee.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/left_tee.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/left_tee.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 1 6 left_tee-16.png Index: xc/programs/xcursorgen/handhelds/ll_angle.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/ll_angle.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/ll_angle.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 2 10 ll_angle-16.png Index: xc/programs/xcursorgen/handhelds/pencil.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/pencil.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/pencil.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 2 14 pencil-16.png Index: xc/programs/xcursorgen/handhelds/right_ptr.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/right_ptr.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/right_ptr.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 4 1 right_ptr-16.png Index: xc/programs/xcursorgen/handhelds/right_side.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/right_side.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/right_side.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 11 5 right_side-16.png Index: xc/programs/xcursorgen/handhelds/right_tee.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/right_tee.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/right_tee.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 10 5 right_tee-16.png Index: xc/programs/xcursorgen/handhelds/sb_h_double_arrow.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/sb_h_double_arrow.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/sb_h_double_arrow.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 8 7 sb_h_double_arrow-16.png Index: xc/programs/xcursorgen/handhelds/sb_right_arrow.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/sb_right_arrow.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/sb_right_arrow.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 10 4 sb_right_arrow-16.png Index: xc/programs/xcursorgen/handhelds/sb_up_arrow.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/sb_up_arrow.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/sb_up_arrow.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 8 2 sb_up_arrow-16.png Index: xc/programs/xcursorgen/handhelds/sb_v_double_arrow.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/sb_v_double_arrow.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/sb_v_double_arrow.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 8 7 sb_v_double_arrow-16.png Index: xc/programs/xcursorgen/handhelds/shuttle.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/shuttle.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/shuttle.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 10 2 shuttle-16.png Index: xc/programs/xcursorgen/handhelds/top_left_corner.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/top_left_corner.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/top_left_corner.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 2 2 top_left_corner-16.png Index: xc/programs/xcursorgen/handhelds/top_right_corner.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/top_right_corner.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/top_right_corner.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 10 2 top_right_corner-16.png Index: xc/programs/xcursorgen/handhelds/top_side.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/top_side.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/top_side.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 6 1 top_side-16.png Index: xc/programs/xcursorgen/handhelds/top_tee.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/top_tee.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/top_tee.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 6 1 top_tee-16.png Index: xc/programs/xcursorgen/handhelds/watch.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/watch.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/watch.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 7 4 watch-16.png Index: xc/programs/xcursorgen/handhelds/xterm.cfg diff -u /dev/null xc/programs/xcursorgen/handhelds/xterm.cfg:1.1 --- /dev/null Thu Feb 27 12:34:20 2003 +++ xc/programs/xcursorgen/handhelds/xterm.cfg Mon Oct 21 14:36:46 2002 @@ -0,0 +1 @@ +12 3 6 xterm-16.png Index: xc/programs/xditview/DviP.h diff -u xc/programs/xditview/DviP.h:1.4 xc/programs/xditview/DviP.h:1.5 --- xc/programs/xditview/DviP.h:1.4 Tue Jul 31 20:45:03 2001 +++ xc/programs/xditview/DviP.h Thu Jun 20 13:40:44 2002 @@ -1,7 +1,7 @@ /* * $XConsortium: DviP.h,v 1.10 92/02/11 01:27:15 keith Exp $ */ -/* $XFree86: xc/programs/xditview/DviP.h,v 1.4 2001/08/01 00:45:03 tsi Exp $ */ +/* $XFree86: xc/programs/xditview/DviP.h,v 1.5 2002/06/20 17:40:44 keithp Exp $ */ /* * DviP.h - Private definitions for Dvi widget @@ -234,8 +234,9 @@ #define ToX(dw,device) ((int) ((device) * (dw)->dvi.scale + 0.5)) #define ToDevice(dw,x) ((int) ((x) / (dw)->dvi.scale + 0.5)) -#define FontSizeInPixels(dw,size) ((int) ((size) * (dw)->dvi.screen_resolution / ((dw)->dvi.size_scale * 72))) -#define FontSizeInDevice(dw,size) ((int) ((size) * (dw)->dvi.device_resolution / ((dw)->dvi.size_scale * 72))) +#define SizeScale(dw) ((dw)->dvi.size_scale ? (dw)->dvi.size_scale : 4) +#define FontSizeInPixels(dw,size) ((int) ((size) * (dw)->dvi.screen_resolution / (SizeScale(dw) * 72))) +#define FontSizeInDevice(dw,size) ((int) ((size) * (dw)->dvi.device_resolution / (SizeScale(dw) * 72))) /* * Full widget declaration Index: xc/programs/xditview/Imakefile diff -u xc/programs/xditview/Imakefile:1.3 xc/programs/xditview/Imakefile:1.5 --- xc/programs/xditview/Imakefile:1.3 Sun Dec 3 00:20:53 2000 +++ xc/programs/xditview/Imakefile Thu Apr 4 09:05:58 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xditview/Imakefile,v 1.3 2000/12/03 05:20:53 keithp Exp $ +XCOMM $XFree86: xc/programs/xditview/Imakefile,v 1.5 2002/04/04 14:05:58 eich Exp $ #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -11,12 +11,13 @@ DEPFONTLIBS = XftClientDepLibs FONTLIBS = XftClientLibs FONTDEFS = -DUSE_XFT + INCLUDES = $(XFTINCLUDES) #endif #if HasMkstemp TEMPDEFS = -DHAS_MKSTEMP #endif DEPLIBS = XawClientDepLibs $(DEPFONTLIBS) -LOCAL_LIBRARIES = XawClientLibs $(FONTLIBS) +LOCAL_LIBRARIES = $(FONTLIBS) XawClientLibs SYS_LIBRARIES = MathLibrary DEFINES = $(TEMPDEFS) $(FONTDEFS) BITMAPS = ldblarrow rdblarrow Index: xc/programs/xditview/font.c diff -u xc/programs/xditview/font.c:1.5 xc/programs/xditview/font.c:1.6 --- xc/programs/xditview/font.c:1.5 Mon Aug 27 19:35:12 2001 +++ xc/programs/xditview/font.c Wed Jun 19 16:09:19 2002 @@ -3,7 +3,7 @@ * * map dvi fonts to X fonts */ -/* $XFree86: xc/programs/xditview/font.c,v 1.5 2001/08/27 23:35:12 dawes Exp $ */ +/* $XFree86: xc/programs/xditview/font.c,v 1.6 2002/06/19 20:09:19 keithp Exp $ */ #include <X11/Xos.h> #include <X11/IntrinsicP.h> @@ -420,8 +420,12 @@ pat, &result); XftPatternDestroy (pat); if (match) + { fs->font = XftFontOpenPattern (XtDisplay (dw), match); + if (!fs->font) + XftPatternDestroy (match); + } else fs->font = 0; #else Index: xc/programs/xdm/Imakefile diff -u xc/programs/xdm/Imakefile:3.45 xc/programs/xdm/Imakefile:3.52 --- xc/programs/xdm/Imakefile:3.45 Wed Aug 29 13:11:56 2001 +++ xc/programs/xdm/Imakefile Sat Dec 7 15:31:04 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xdm/Imakefile,v 3.45 2001/08/29 17:11:56 alanh Exp $ +XCOMM $XFree86: xc/programs/xdm/Imakefile,v 3.52 2002/12/07 20:31:04 herrb Exp $ #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -13,7 +13,7 @@ #endif #ifndef SharedLibXdmGreet -#define SharedLibXdmGreet (defined(AlphaArchitecture) || SystemV4) +#define SharedLibXdmGreet (HasSharedLibraries && (defined(AlphaArchitecture) || SystemV4)) #endif #ifndef BuildBoth @@ -131,6 +131,12 @@ FRAGILE_DEFINES = -DFRAGILE_DEV_MEM #endif +#if defined(NetBSDArchitecture) && \ + ((OSMajorVersion > 1) || \ + (OSMajorVersion == 1 && OSMinorVersion > 3)) +RANDOM_DEFINES = -DDEV_RANDOM=\"/dev/urandom\" +#endif + #ifdef OpenBSDArchitecture RANDOM_DEFINES = -DARC4_RANDOM #endif @@ -153,6 +159,11 @@ PROCTITLE_DEFINES = -DHAS_SETPROCTITLE #endif +#if !HasSnprintf +SNPRINTFSRCS = snprintf.c +SNPRINTFOBJS = snprintf.o +#endif + SYS_LIBRARIES = $(SYS_LIBRARIES1) $(SYS_LIBRARIES2) $(SYS_LIBRARIES3) XDMCONFIGDIR = XdmConfigurationSubdirectory @@ -170,13 +181,15 @@ session.c socket.c streams.c util.c xdmcp.c \ mitauth.c \ genauth.c access.c choose.c \ - $(XDMAUTHSRCS) $(RPCSRCS) $(KRB5SRCS) $(GREETSRCS) + $(XDMAUTHSRCS) $(RPCSRCS) $(KRB5SRCS) $(GREETSRCS) \ + $(SNPRINTFSRCS) OBJS1 = auth.o daemon.o server.o dpylist.o dm.o error.o file.o \ netaddr.o reset.o resource.o protodpy.o policy.o \ session.o socket.o streams.o util.o xdmcp.o \ mitauth.o \ genauth.o access.o choose.o \ - $(XDMAUTHOBJS) $(RPCOBJS) $(KRB5OBJS) $(GREETOBJS) + $(XDMAUTHOBJS) $(RPCOBJS) $(KRB5OBJS) $(GREETOBJS) \ + $(SNPRINTFOBJS) SRCS2 = xdmshell.c OBJS2 = xdmshell.o #if BuildChooser @@ -203,12 +216,12 @@ mitauth.o \ genauth.o access.o choose.o \ $(XDMAUTHOBJS) $(RPCOBJS) $(KRB5OBJS) $(GREETSHADOWOBJS) - XDM_SHADOW = xdm-shadow + XDM_SHADOW = ProgramTargetName(xdm-shadow) #endif #if BuildChooser - CHOOSER = chooser + CHOOSER = ProgramTargetName(chooser) #endif - PROGRAMS = xdm xdmshell sessreg $(CHOOSER) $(XDM_SHADOW) + PROGRAMS = ProgramTargetName(xdm) ProgramTargetName(xdmshell) ProgramTargetName(sessreg) $(CHOOSER) $(XDM_SHADOW) OSMAJORVERSION = OSMajorVersion OSMINORVERSION = OSMinorVersion @@ -235,7 +248,6 @@ DEF_USER_PATH = DefaultUserPath /* no leading spaces or imake will */ DEF_SYSTEM_PATH = DefaultSystemPath /* indent as rule */ BOURNE_SHELL = DefaultSystemShell -#ifndef OS2Architecture RES_DEFINES = '-DDEF_SERVER_LINE=":0 local $(DEF_SERVER) :0"' \ '-DXRDB_PROGRAM="$(BINDIR)/xrdb"' \ '-DDEF_SESSION="$(BINDIR)/xterm -ls"' \ @@ -247,7 +259,6 @@ '-DDEF_CHOOSER="$(XDMDIR)/chooser"' \ '-DDEF_AUTH_DIR="$(XDMDIR)"' \ '-DDEF_GREETER_LIB="$(XDMDIR)/libXdmGreet.so"' -#endif ComplexProgramTarget_1(xdm,$(LOCAL_LIBRARIES),NullParameter) LinkConfDirectory(xdm,.,xdm,.) @@ -294,6 +305,10 @@ ObjectFromSpecialSource(sessionsh,session,-DUSESHADOW) #endif #endif /* !SharedLibXdmGreet */ + +#if !HasSnprintf +LinkSourceFile(snprintf.c,$(LIBSRC)/misc) +#endif #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) Index: xc/programs/xdm/access.c diff -u xc/programs/xdm/access.c:3.8 xc/programs/xdm/access.c:3.10 --- xc/programs/xdm/access.c:3.8 Fri Dec 14 15:01:19 2001 +++ xc/programs/xdm/access.c Tue Dec 10 18:36:43 2002 @@ -26,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/access.c,v 3.8 2001/12/14 20:01:19 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/access.c,v 3.10 2002/12/10 23:36:43 tsi Exp $ */ /* * Access control for XDMCP - keep a database of allowable display addresses @@ -179,7 +179,7 @@ return NULL; } quoted = FALSE; - for (;;) { + for (;wordp - wordBuffer < sizeof(wordBuffer)-2;) { c = getc (file); switch (c) { case '#': @@ -222,6 +222,7 @@ } quoted = FALSE; } + return NULL; } static HostEntry * Index: xc/programs/xdm/auth.c diff -u xc/programs/xdm/auth.c:3.24 xc/programs/xdm/auth.c:3.27 --- xc/programs/xdm/auth.c:3.24 Fri Dec 14 15:01:19 2001 +++ xc/programs/xdm/auth.c Tue Dec 10 17:37:17 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.24 2001/12/14 20:01:19 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.27 2002/12/10 22:37:17 tsi Exp $ */ /* * xdm - display manager daemon @@ -99,7 +99,7 @@ #endif #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define link rename int chown(int a,int b,int c) {} #include <io.h> @@ -670,11 +670,11 @@ struct utsname name; uname(&name); - strcpy(displayname, name.nodename); + snprintf(displayname, sizeof(displayname), "%s", name.nodename); } writeAddr (FamilyLocal, strlen (displayname), displayname, file, auth); - strcpy(tmp_displayname, displayname); + snprintf(tmp_displayname, sizeof(tmp_displayname), "%s", displayname); #endif #if (!defined(NEED_UTSNAME) || defined (hpux)) @@ -1084,10 +1084,7 @@ home = getEnv (verify->userEnviron, "HOME"); lockStatus = LOCK_ERROR; if (home) { - strcpy (home_name, home); - if (home[strlen(home) - 1] != '/') - strcat (home_name, "/"); - strcat (home_name, ".Xauthority"); + snprintf (home_name, sizeof(home_name), "%s/.Xauthority", home); Debug ("XauLockAuth %s\n", home_name); lockStatus = XauLockAuth (home_name, 1, 2, 10); Debug ("Lock is %d\n", lockStatus); @@ -1103,7 +1100,7 @@ } } if (lockStatus != LOCK_SUCCESS) { - sprintf (backup_name, "%s/.XauthXXXXXX", d->userAuthDir); + snprintf (backup_name, sizeof(backup_name), "%s/.XauthXXXXXX", d->userAuthDir); (void) mktemp (backup_name); lockStatus = XauLockAuth (backup_name, 1, 2, 10); Debug ("backup lock is %d\n", lockStatus); @@ -1227,10 +1224,7 @@ if (!home) return; Debug ("RemoveUserAuthorization\n"); - strcpy (name, home); - if (home[strlen(home) - 1] != '/') - strcat (name, "/"); - strcat (name, ".Xauthority"); + snprintf(name, sizeof(name), "%s/.Xauthority", home); Debug ("XauLockAuth %s\n", name); lockStatus = XauLockAuth (name, 1, 2, 10); Debug ("Lock is %d\n", lockStatus); Index: xc/programs/xdm/daemon.c diff -u xc/programs/xdm/daemon.c:3.17 xc/programs/xdm/daemon.c:3.20 --- xc/programs/xdm/daemon.c:3.17 Fri Dec 14 15:01:21 2001 +++ xc/programs/xdm/daemon.c Wed Dec 4 11:53:39 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/daemon.c,v 3.17 2001/12/14 20:01:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/daemon.c,v 3.20 2002/12/04 16:53:39 tsi Exp $ */ /* * xdm - display manager daemon @@ -34,28 +34,35 @@ */ #include <X11/Xos.h> +#include <sys/types.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> -#if defined(SVR4) || defined(USG) -#include <termios.h> -#else -#include <sys/ioctl.h> +#ifndef __GLIBC__ +# if defined(__osf__) || \ + defined(__GNU__) || \ + defined(__CYGWIN__) || \ + defined(linux) +# define setpgrp setpgid +# endif #endif -#if defined(__osf__) || defined(linux) || defined(__GNU__) || defined(__CYGWIN__) -#define setpgrp setpgid + +#if defined(SVR4) || defined(USG) || defined(__GLIBC__) +# include <termios.h> +#else +# include <sys/ioctl.h> #endif #ifdef hpux -#include <sys/ptyio.h> +# include <sys/ptyio.h> #endif -#include <errno.h> -#include <sys/types.h> + #ifdef X_NOT_POSIX -#define Pid_t int +# define Pid_t int #else -#define Pid_t pid_t +# define Pid_t pid_t #endif -#include <stdlib.h> - #include "dm.h" #include "dm_error.h" @@ -63,9 +70,6 @@ BecomeOrphan (void) { Pid_t child_id; -#ifndef CSRG_BASED - int stat; -#endif /* * fork so that the process goes into the background automatically. Also @@ -76,34 +80,36 @@ * killed when the init script that's running xdm exits. */ - child_id = fork(); + child_id = fork (); switch (child_id) { case 0: /* child */ break; case -1: /* error */ - LogError("daemon fork failed, errno = %d\n", errno); + LogError ("daemon fork failed, errno = %d\n", errno); break; - default: + default: { /* parent */ -#ifndef CSRG_BASED +#if defined(CSRG_BASED) || defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) || defined(__GLIBC__) #if defined(SVR4) || defined(__QNXNTO__) - stat = setpgid(child_id, child_id); - /* This gets error EPERM. Why? */ -#else -#if defined(SYSV) - stat = 0; /* don't know how to set child's process group */ -#else - stat = setpgrp(child_id, child_id); - if (stat != 0) - LogError("setting process grp for daemon failed, errno = %d\n", - errno); -#endif -#endif -#endif /* !CSRG_BASED */ + /* This gets error EPERM. Why? */ + int stat = setpgid(child_id, child_id); +#elif defined(SYSV) + /* don't know how to set child's process group */ + int stat = 0; +#elif defined(__GLIBC__) + int stat = setpgrp (); +#else + int stat = setpgrp (child_id, child_id); +#endif + if (stat != 0) + LogError ("setting process group for daemon failed: %s\n", + strerror(errno)); +#endif /* ! (CSRG_BASED || SYSV || SVR4 || __QNXNTO__ || __GLIBC__) */ + } exit (0); } } @@ -111,41 +117,44 @@ void BecomeDaemon (void) { -#ifndef CSRG_BASED - register int i; - /* * Close standard file descriptors and get rid of controlling tty */ -#if defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) - setpgrp (); + /* If our C library has the daemon() function, just use it. */ +#if defined(__GLIBC__) || defined(CSRG_BASED) + daemon (0, 0); #else - setpgrp (0, getpid()); -#endif + int i; + +# if defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) + setpgrp (); +# else + setpgrp (0, getpid ()); +# endif - close (0); + close (0); close (1); close (2); -#ifndef __EMX__ -#if !((defined(SYSV) || defined(SVR4)) && defined(i386)) && !defined(__CYGWIN__) +# if !defined(__UNIXOS2__) && !defined(__CYGWIN__) +# if !((defined(SYSV) || defined(SVR4)) && defined(i386)) if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ -#if defined(USG) && defined(TCCLRCTTY) +# if defined(USG) && defined(TCCLRCTTY) int zero = 0; (void) ioctl (i, TCCLRCTTY, &zero); -#else -#if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) +# else +# if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) int zero = 0; (void) ioctl (i, TIOCTTY, &zero); -#else +# else (void) ioctl (i, TIOCNOTTY, (char *) 0); /* detach, BSD style */ -#endif -#endif +# endif +# endif (void) close (i); } -#endif /* !((SYSV || SVR4) && i386) */ -#endif /* !__EMX__ */ +# endif /* !((SYSV || SVR4) && i386) */ +# endif /* !__UNIXOS2__ && !__CYGWIN__*/ /* * Set up the standard file descriptors. @@ -153,7 +162,5 @@ (void) open ("/", O_RDONLY); /* root inode already in core */ (void) dup2 (0, 1); (void) dup2 (0, 2); -#else - daemon (0, 0); -#endif /* CSRG_BASED */ +#endif } Index: xc/programs/xdm/dm.c diff -u xc/programs/xdm/dm.c:3.19 xc/programs/xdm/dm.c:3.21 --- xc/programs/xdm/dm.c:3.19 Fri Dec 14 15:01:21 2001 +++ xc/programs/xdm/dm.c Sat Dec 7 15:31:04 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.c,v 3.19 2001/12/14 20:01:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.21 2002/12/07 20:31:04 herrb Exp $ */ /* * xdm - display manager daemon @@ -153,7 +153,8 @@ if (nofork_session == 0) { /* Clean up any old Authorization files */ - sprintf(cmdbuf, "/bin/rm -f %s/authdir/authfiles/A*", authDir); + /* AUD: all good? */ + snprintf(cmdbuf, sizeof(cmdbuf), "/bin/rm -f %s/authdir/authfiles/A*", authDir); system(cmdbuf); } @@ -409,7 +410,7 @@ int pid; struct display *d; waitType status; -#if !defined(X_NOT_POSIX) && !defined(__EMX__) +#if !defined(X_NOT_POSIX) && !defined(__UNIXOS2__) sigset_t mask, omask; #else int omask; Index: xc/programs/xdm/dm.h diff -u xc/programs/xdm/dm.h:3.28 xc/programs/xdm/dm.h:3.29 --- xc/programs/xdm/dm.h:3.28 Mon Jan 14 17:49:45 2002 +++ xc/programs/xdm/dm.h Fri May 31 14:46:10 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.h,v 3.28 2002/01/14 22:49:45 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.29 2002/05/31 18:46:10 dawes Exp $ */ /* * xdm - display manager daemon @@ -483,8 +483,8 @@ #define SIGVAL void #endif -#if defined(X_NOT_POSIX) || defined(__EMX__) || defined(__NetBSD__) && defined(__sparc__) -#if defined(SYSV) || defined(__EMX__) +#if defined(X_NOT_POSIX) || defined(__UNIXOS2__) || defined(__NetBSD__) && defined(__sparc__) +#if defined(SYSV) || defined(__UNIXOS2__) #define SIGNALS_RESET_WHEN_CAUGHT #define UNRELIABLE_SIGNALS #endif Index: xc/programs/xdm/error.c diff -u xc/programs/xdm/error.c:1.5 xc/programs/xdm/error.c:1.7 --- xc/programs/xdm/error.c:1.5 Fri Dec 14 15:01:21 2001 +++ xc/programs/xdm/error.c Wed Oct 9 12:38:20 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/error.c,v 1.5 2001/12/14 20:01:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/error.c,v 1.7 2002/10/09 16:38:20 tsi Exp $ */ /* * xdm - display manager daemon @@ -44,42 +44,52 @@ # include "dm.h" # include "dm_error.h" +#define WRITES(fd, buf) write(fd, buf, strlen(buf)) + void LogInfo(char * fmt, ...) { - fprintf (stderr, "xdm info (pid %ld): ", (long)getpid()); + char buf[1024]; + + snprintf(buf, sizeof buf, "xdm info (pid %ld): ", (long)getpid()); + WRITES(STDERR_FILENO, buf); { va_list args; va_start(args, fmt); - vfprintf (stderr, fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); } - fflush (stderr); + WRITES(STDERR_FILENO, buf); } -void LogError ( - char * fmt, ...) +void LogError (char * fmt, ...) { - fprintf (stderr, "xdm error (pid %ld): ", (long)getpid()); + char buf[1024]; + + snprintf (buf, sizeof buf, "xdm error (pid %ld): ", (long)getpid()); + WRITES(STDERR_FILENO, buf); { va_list args; va_start(args, fmt); - vfprintf (stderr, fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); } - fflush (stderr); + WRITES(STDERR_FILENO, buf); } void LogPanic (char * fmt, ...) { - fprintf (stderr, "xdm panic (pid %ld): ", (long)getpid()); + char buf[1024]; + + snprintf (buf, sizeof buf, "xdm panic (pid %ld): ", (long)getpid()); + WRITES(STDERR_FILENO, buf); { va_list args; va_start(args, fmt); - vfprintf (stderr, fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); } - fflush (stderr); - exit (1); + WRITES(STDERR_FILENO, buf); + _exit (1); } void LogOutOfMem (char * fmt, ...) @@ -107,13 +117,15 @@ void Debug (char * fmt, ...) { + char buf[1024]; + if (debugLevel > 0) { va_list args; va_start(args, fmt); - vprintf (fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); - fflush (stdout); + WRITES(STDOUT_FILENO, buf); } } Index: xc/programs/xdm/genauth.c diff -u xc/programs/xdm/genauth.c:3.13 xc/programs/xdm/genauth.c:3.15 --- xc/programs/xdm/genauth.c:3.13 Fri Dec 14 15:01:22 2001 +++ xc/programs/xdm/genauth.c Sun Oct 6 14:12:29 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.13 2001/12/14 20:01:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.15 2002/10/06 18:12:29 herrb Exp $ */ /* * xdm - display manager daemon @@ -120,7 +120,7 @@ _XdmcpWrapperToOddParity(sum, key); -#elif DEV_RANDOM +#elif defined(DEV_RANDOM) int fd; unsigned char tmpkey[8]; @@ -187,7 +187,7 @@ } #else { -#ifndef __EMX__ +#ifndef __UNIXOS2__ long time (); #endif Index: xc/programs/xdm/policy.c diff -u xc/programs/xdm/policy.c:3.7 xc/programs/xdm/policy.c:3.8 --- xc/programs/xdm/policy.c:3.7 Thu Dec 27 15:01:56 2001 +++ xc/programs/xdm/policy.c Sat Dec 7 15:31:04 2002 @@ -33,7 +33,7 @@ * * policy.c. Implement site-dependent policy for XDMCP connections */ -/* $XFree86: xc/programs/xdm/policy.c,v 3.7 2001/12/27 20:01:56 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/policy.c,v 3.8 2002/12/07 20:31:04 herrb Exp $ */ # include "dm.h" # include "dm_auth.h" @@ -142,13 +142,13 @@ char *s = NULL; while(!(s = fgets(statusBuf, 256, fd)) && errno == EINTR) ; - if(s) + if (s && strlen(statusBuf) > 0) statusBuf[strlen(statusBuf)-1] = 0; /* chop newline */ else - sprintf (statusBuf, "Willing, but %s failed",willing); + snprintf (statusBuf, sizeof(statusBuf), "Willing, but %s failed",willing); } else - sprintf (statusBuf, "Willing, but %s failed",willing); + snprintf (statusBuf, sizeof(statusBuf), "Willing, but %s failed",willing); if (fd) pclose(fd); } else Index: xc/programs/xdm/resource.c diff -u xc/programs/xdm/resource.c:3.7 xc/programs/xdm/resource.c:3.10 --- xc/programs/xdm/resource.c:3.7 Fri Dec 14 15:01:23 2001 +++ xc/programs/xdm/resource.c Sat Dec 7 15:31:04 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/resource.c,v 3.7 2001/12/14 20:01:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/resource.c,v 3.10 2002/12/07 20:31:04 herrb Exp $ */ /* * xdm - display manager daemon @@ -72,7 +72,6 @@ * parameters set util/imake.includes/site.def (or *.macros in that directory * if it is server-specific). DO NOT CHANGE THESE DEFINITIONS! */ -#ifndef __EMX__ #ifndef DEF_SERVER_LINE #define DEF_SERVER_LINE ":0 local /usr/bin/X11/X :0" #endif @@ -120,68 +119,15 @@ #define DEF_ACCESS_FILE "" #endif #ifndef DEF_RANDOM_FILE -#define DEF_RANDOM_FILE "/dev/mem" +# ifdef linux +# define DEF_RANDOM_FILE "/dev/urandom" +# else +# define DEF_RANDOM_FILE "/dev/mem" +# endif #endif #ifndef DEF_GREETER_LIB -#define DEF_GREETER_LIB "/X11/lib/X11/xdm/libXdmGreet.so" +#define DEF_GREETER_LIB "/usr/lib/X11/xdm/libXdmGreet.so" #endif -#else -/* unfortunately I have to declare all of them, because there is a limit - * in argument size in OS/2 - * but everything needs to be fixed again - */ -#define DEF_SERVER_LINE ":0 local /XFree86/bin/X :0" -#ifndef XRDB_PROGRAM -#define XRDB_PROGRAM "/XFree86/bin/xrdb" -#endif -#ifndef DEF_SESSION -#define DEF_SESSION "/XFree86/bin/xterm -ls" -#endif -#ifndef DEF_USER_PATH -#define DEF_USER_PATH "c:\\os2;c:\\os2\apps;\\XFree86\\bin" -#endif -#ifndef DEF_SYSTEM_PATH -#define DEF_SYSTEM_PATH "c:\\os2;c:\\os2\apps;\\XFree86\\bin" -#endif -#ifndef DEF_SYSTEM_SHELL -#define DEF_SYSTEM_SHELL "sh" -#endif -#ifndef DEF_FAILSAFE_CLIENT -#define DEF_FAILSAFE_CLIENT "/XFree86/bin/xterm" -#endif -#ifndef DEF_XDM_CONFIG -#define DEF_XDM_CONFIG "/XFree86/lib/X11/xdm/xdm-config" -#endif -#ifndef DEF_CHOOSER -#define DEF_CHOOSER "/XFree86/lib/X11/xdm/chooser" -#endif -#ifndef DEF_AUTH_NAME -#ifdef HASXDMAUTH -#define DEF_AUTH_NAME "XDM-AUTHORIZATION-1 MIT-MAGIC-COOKIE-1" -#else -#define DEF_AUTH_NAME "MIT-MAGIC-COOKIE-1" -#endif -#endif -#ifndef DEF_AUTH_DIR -#define DEF_AUTH_DIR "/XFree86/lib/X11/xdm" -#endif -#ifndef DEF_USER_AUTH_DIR -#define DEF_USER_AUTH_DIR "/tmp" -#endif -#ifndef DEF_KEY_FILE -#define DEF_KEY_FILE "" -#endif -#ifndef DEF_ACCESS_FILE -#define DEF_ACCESS_FILE "" -#endif -#ifndef DEF_RANDOM_FILE -#define DEF_RANDOM_FILE "" -#endif -#ifndef DEF_GREETER_LIB -#define DEF_GREETER_LIB "/XFree86/lib/X11/xdm/libXdmGreet.so" -#endif - -#endif /* __EMX__ */ #define DEF_UDP_PORT "177" /* registered XDMCP port, dont change */ @@ -476,8 +422,8 @@ char name[1024], class[1024]; for (i = 0; i < NUM_DM_RESOURCES; i++) { - sprintf (name, "DisplayManager.%s", DmResources[i].name); - sprintf (class, "DisplayManager.%s", DmResources[i].class); + snprintf (name, sizeof(name), "DisplayManager.%s", DmResources[i].name); + snprintf (class, sizeof(class), "DisplayManager.%s", DmResources[i].class); GetResource (name, class, DmResources[i].type, (char **) DmResources[i].dm_value, DmResources[i].default_value); @@ -517,9 +463,9 @@ CleanUpName (d->name, dpyName, sizeof (dpyName)); CleanUpName (d->class ? d->class : d->name, dpyClass, sizeof (dpyClass)); for (i = 0; i < numResources; i++) { - sprintf (name, "DisplayManager.%s.%s", + snprintf (name, sizeof(name), "DisplayManager.%s.%s", dpyName, resources[i].name); - sprintf (class, "DisplayManager.%s.%s", + snprintf (class, sizeof(class), "DisplayManager.%s.%s", dpyClass, resources[i].class); GetResource (name, class, resources[i].type, (char **) (((char *) d) + resources[i].offset), Index: xc/programs/xdm/sessreg.c diff -u xc/programs/xdm/sessreg.c:3.18 xc/programs/xdm/sessreg.c:3.19 --- xc/programs/xdm/sessreg.c:3.18 Fri Dec 14 15:01:24 2001 +++ xc/programs/xdm/sessreg.c Sat Dec 7 15:31:04 2002 @@ -30,7 +30,7 @@ * by Andreas Stolcke <stolcke@icsi.berkeley.edu> */ -/* $XFree86: xc/programs/xdm/sessreg.c,v 3.18 2001/12/14 20:01:24 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/sessreg.c,v 3.19 2002/12/07 20:31:04 herrb Exp $ */ /* * sessreg @@ -426,7 +426,8 @@ char *pos; /* remove screen number from the display name */ - strcpy(disp_name, host_name ? host_name : tty_line); + memset(disp_name, 0, sizeof(disp_name)); + strncpy(disp_name, host_name ? host_name : tty_line, sizeof(disp_name)-1); pos = strrchr(disp_name, ':'); if (pos) { pos = strchr(pos, '.'); Index: xc/programs/xdm/util.c diff -u xc/programs/xdm/util.c:3.19 xc/programs/xdm/util.c:3.20 --- xc/programs/xdm/util.c:3.19 Fri Dec 14 15:01:24 2001 +++ xc/programs/xdm/util.c Fri May 31 14:46:10 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/util.c,v 3.19 2001/12/14 20:01:24 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/util.c,v 3.20 2002/05/31 18:46:10 dawes Exp $ */ /* * xdm - display manager daemon @@ -278,7 +278,7 @@ SIGVAL (*Signal (int sig, SIGFUNC handler))(int) { -#if !defined(X_NOT_POSIX) && !defined(__EMX__) +#if !defined(X_NOT_POSIX) && !defined(__UNIXOS2__) struct sigaction sigact, osigact; sigact.sa_handler = handler; sigemptyset(&sigact.sa_mask); Index: xc/programs/xdm/xdm.man diff -u xc/programs/xdm/xdm.man:3.21 xc/programs/xdm/xdm.man:3.22 --- xc/programs/xdm/xdm.man:3.21 Fri Dec 14 15:01:25 2001 +++ xc/programs/xdm/xdm.man Sat Oct 12 12:06:47 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.21 2001/12/14 20:01:25 dawes Exp $ +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.22 2002/10/12 16:06:47 herrb Exp $ .\" .TH XDM 1 __xorgversion__ .SH NAME @@ -144,7 +144,7 @@ At the end of the session, the \fIXreset\fP script is run to clean up, the X server is reset, and the cycle starts over. .PP -The file \fI/usr/X11R6/lib/X11/xdm/xdm-errors\fP will contain error +The file \fI__projectroot__/lib/X11/xdm/xdm-errors\fP will contain error messages from .I xdm and anything output to stderr by \fIXsetup, Xstartup, Xsession\fP @@ -163,7 +163,7 @@ Names the configuration file, which specifies resources to control the behavior of .I xdm. -.I <XRoot>/lib/X11/xdm/xdm-config +.I __projectroot__/lib/X11/xdm/xdm-config is the default. See the section \fBConfiguration File\fP. .IP "\fB\-nodaemon\fP" @@ -305,7 +305,7 @@ This names a directory under which .I xdm stores authorization files while initializing the session. The -default value is \fI<XRoot>/lib/X11/xdm.\fP +default value is \fI__projectroot__/lib/X11/xdm.\fP Can be overridden for specific displays by DisplayManager.\fIDISPLAY\fP.authFile. .IP \fBDisplayManager.autoRescan\fP @@ -351,7 +351,8 @@ The default is \fI/dev/mem\fP. .IP \fBDisplayManager.greeterLib\fP On systems that support a dynamically-loadable greeter library, the -name of the library. Default is \fI<XRoot>/lib/X11/xdm/libXdmGreet.so\fP. +name of the library. The default is +\fI__projectroot__/lib/X11/xdm/libXdmGreet.so\fP. .IP \fBDisplayManager.choiceTimeout\fP Number of seconds to wait for display to respond after user has selected a host from the chooser. If the display sends an XDMCP @@ -383,17 +384,17 @@ which describes the various resources that are appropriate to place in this file. There is no default value for this resource, but -\fI<XRoot>/lib/X11/xdm/Xresources\fP +\fI__projectroot__/lib/X11/xdm/Xresources\fP is the conventional name. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.chooser\fP" Specifies the program run to offer a host menu for Indirect queries redirected to the special host name CHOOSER. -\fI<XRoot>/lib/X11/xdm/chooser\fP is the default. +\fI__projectroot__/lib/X11/xdm/chooser\fP is the default. See the sections \fBXDMCP Access Control\fP and \fBChooser\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.xrdb\fP" Specifies the program used to load the resources. By default, .I xdm -uses \fI<XRoot>/bin/xrdb\fP. +uses \fI__projectroot__/bin/xrdb\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.cpp\fP" This specifies the name of the C preprocessor which is used by \fIxrdb\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.setup\fP" @@ -411,7 +412,7 @@ See the section \fBStartup Program.\fP .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.session\fP" This specifies the session to be executed (not running as root). -By default, \fI<XRoot>/bin/xterm\fP is +By default, \fI__projectroot__/bin/xterm\fP is run. The conventional name is \fIXsession\fP. See the section .B "Session Program." @@ -474,7 +475,7 @@ be a colon separated list of directories; see .IR sh (1) for a full description. -``:/bin:/usr/bin:/usr/X11R6/bin:/usr/ucb'' +``:/bin:/usr/bin:__projectroot__/bin:/usr/ucb'' is a common setting. The default value can be specified at build time in the X system configuration file with DefaultUserPath. @@ -483,7 +484,7 @@ sets the PATH environment variable for the startup and reset scripts to the value of this resource. The default for this resource is specified at build time by the DefaultSystemPath entry in the system configuration file; -``/etc:/bin:/usr/bin:/usr/X11R6/bin:/usr/ucb'' is a common choice. +``/etc:/bin:/usr/bin:__projectroot__/bin:/usr/ucb'' is a common choice. Note the absence of ``.'' from this entry. This is a good practice to follow for root; it avoids many common Trojan Horse system penetration schemes. @@ -497,7 +498,7 @@ will fall back to this program. This program is executed with no arguments, but executes using the same environment variables as the session would have had (see the section \fBSession Program\fP). -By default, \fI<XRoot>/bin/xterm\fP is used. +By default, \fI__projectroot__/bin/xterm\fP is used. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.grabServer\fP" .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.grabTimeout\fP" To improve security, @@ -576,10 +577,8 @@ First, the .I xdm configuration file should be set up. -Make a directory (usually \fI<XRoot>/lib/X11/xdm\fP, where <XRoot> -refers to the root of the X11 install tree) to contain all of the relevant -files. In the examples that follow, we use /usr/X11R6 as the value of -<XRoot>. +Make a directory (usually \fI__projectroot__/lib/X11/xdm\fP) to contain all +of the relevant files. .LP Here is a reasonable configuration file, which could be named \fIxdm-config\fP: @@ -587,12 +586,12 @@ .ta .5i 4i - DisplayManager.servers: /usr/X11R6/lib/X11/xdm/Xservers - DisplayManager.errorLogFile: /usr/X11R6/lib/X11/xdm/xdm-errors - DisplayManager*resources: /usr/X11R6/lib/X11/xdm/Xresources - DisplayManager*startup: /usr/X11R6/lib/X11/xdm/Xstartup - DisplayManager*session: /usr/X11R6/lib/X11/xdm/Xsession - DisplayManager.pidFile: /usr/X11R6/lib/X11/xdm/xdm-pid + DisplayManager.servers: __projectroot__/lib/X11/xdm/Xservers + DisplayManager.errorLogFile: __projectroot__/lib/X11/xdm/xdm-errors + DisplayManager*resources: __projectroot__/lib/X11/xdm/Xresources + DisplayManager*startup: __projectroot__/lib/X11/xdm/Xstartup + DisplayManager*session: __projectroot__/lib/X11/xdm/Xsession + DisplayManager.pidFile: __projectroot__/lib/X11/xdm/xdm-pid DisplayManager._0.authorize: true DisplayManager*authorize: false @@ -745,7 +744,7 @@ be: .nf - :0 Digital-QV local /usr/X11R6/bin/X :0 + :0 Digital-QV local __projectroot__/bin/X :0 .fi The display types are: @@ -760,8 +759,8 @@ The display name must be something that can be passed in the \fB\-display\fP option to an X program. This string is used to generate the display-specific resource names, so be careful to match the -names (e.g., use ``:0 Sun-CG3 local /usr/X11R6/bin/X :0'' instead of -``localhost:0 Sun-CG3 local /usr/X11R6/bin/X :0'' +names (e.g., use ``:0 Sun-CG3 local __projectroot__/bin/X :0'' instead of +``localhost:0 Sun-CG3 local __projectroot__/bin/X :0'' if your other resources are specified as ``DisplayManager._0.session''). The display class portion is also used in the display-specific resources, as the class of the resource. This is @@ -847,7 +846,7 @@ \& #!/bin/sh \& # Xsetup_0 \- setup script for one workstation - xcmsdb < /usr/X11R6/lib/monitors/alex.0 + xcmsdb < __projectroot__/lib/monitors/alex.0 xconsole\0\-geometry\0480x130\-0\-0\0\-notify\0\-verbose\0\-exitOnFail & .fi @@ -1044,8 +1043,8 @@ xmessage\0\-file /etc/nologin\0\-timeout 30\0\-center exit 1 fi - sessreg\0\-a\0\-l $DISPLAY\0\-x /usr/X11R6/lib/xdm/Xservers $LOGNAME - /usr/X11R6/lib/xdm/GiveConsole + sessreg\0\-a\0\-l $DISPLAY\0\-x __projectroot__/lib/xdm/Xservers $LOGNAME + __projectroot__/lib/xdm/GiveConsole exit 0 .fi .SH "SESSION PROGRAM" @@ -1158,8 +1157,8 @@ \& # \& # This program is run as root after the session ends \& # - sessreg\0\-d\0\-l $DISPLAY\0\-x /usr/X11R6/lib/xdm/Xservers $LOGNAME - /usr/X11R6/lib/xdm/TakeConsole + sessreg\0\-d\0\-l $DISPLAY\0\-x __projectroot__/lib/xdm/Xservers $LOGNAME + __projectroot__/lib/xdm/TakeConsole exit 0 .fi .SH "CONTROLLING THE SERVER" @@ -1231,7 +1230,7 @@ .nf .ta .5i - xdm \-server ":0 SUN-3/60CG4 local /usr/X11R6/bin/X :0" + xdm \-server ":0 SUN-3/60CG4 local __projectroot__/bin/X :0" .fi .PP @@ -1262,31 +1261,29 @@ .I xinit. .SH FILES .TP 20 -.I <XRoot>/lib/X11/xdm/xdm-config +.I __projectroot__/lib/X11/xdm/xdm-config the default configuration file .TP 20 .I $HOME/.Xauthority user authorization file where \fIxdm\fP stores keys for clients to read .TP 20 -.I <XRoot>/lib/X11/xdm/chooser +.I __projectroot__/lib/X11/xdm/chooser the default chooser .TP 20 -.I <XRoot>/bin/xrdb +.I __projectroot__/bin/xrdb the default resource database loader .TP 20 -.I <XRoot>/bin/X +.I __projectroot__/bin/X the default server .TP 20 -.I <XRoot>/bin/xterm +.I __projectroot__/bin/xterm the default session program and failsafe client .TP 20 -.I <XRoot>/lib/X11/xdm/A<display>\-<suffix> +.I __projectroot__/lib/X11/xdm/A<display>\-<suffix> the default place for authorization files .TP 20 .I /tmp/K5C<display> Kerberos credentials cache -.LP -Note: <XRoot> refers to the root of the X11 install tree. .SH "SEE ALSO" .IR X (__miscmansuffix__), .IR xinit (1), Index: xc/programs/xdm/xdmcp.c diff -u xc/programs/xdm/xdmcp.c:3.19 xc/programs/xdm/xdmcp.c:3.21 --- xc/programs/xdm/xdmcp.c:3.19 Fri Dec 14 15:01:25 2001 +++ xc/programs/xdm/xdmcp.c Tue Dec 10 17:37:17 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.19 2001/12/14 20:01:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.21 2002/12/10 22:37:17 tsi Exp $ */ /* * xdm - display manager daemon @@ -1152,16 +1152,29 @@ { case FamilyInternet: { - struct hostent *hostent; + struct hostent *hostent = NULL; char dotted[20]; - char *local_name; + char *local_name = ""; hostent = gethostbyaddr ((char *)connectionAddress->data, connectionAddress->length, AF_INET); + + if (hostent) { + /* check for DNS spoofing */ + char *s = strdup(hostent->h_name); /* fscking non-reentrancy of getXXX() */ + if ((hostent = gethostbyname(s))) { + if (memcmp((char*)connectionAddress->data, hostent->h_addr, + hostent->h_length) != 0) { + LogError("Possible DNS spoof attempt."); + hostent = NULL; /* so it enters next if() */ + } else { + local_name = hostent->h_name; + } + } + free(s); + } - if (hostent) - local_name = hostent->h_name; - else { + if (!hostent) { /* can't get name, so use emergency fallback */ sprintf(dotted, "%d.%d.%d.%d", connectionAddress->data[0], @@ -1185,7 +1198,7 @@ break; } return name; -} + } #if 0 static int @@ -1280,4 +1293,3 @@ #endif #endif /* XDMCP */ - Index: xc/programs/xdm/config/Imakefile diff -u xc/programs/xdm/config/Imakefile:1.9 xc/programs/xdm/config/Imakefile:1.12 --- xc/programs/xdm/config/Imakefile:1.9 Sun Nov 25 07:49:19 2001 +++ xc/programs/xdm/config/Imakefile Sat Dec 7 15:20:16 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xdm/config/Imakefile,v 1.9 2001/11/25 12:49:19 herrb Exp $ +XCOMM $XFree86: xc/programs/xdm/config/Imakefile,v 1.12 2002/12/07 20:20:16 herrb Exp $ SERVERSTYPE = XdmServersType @@ -13,6 +13,10 @@ DEFAULTVT=vt05 #endif +#if defined(LinuxDistribution) && (LinuxDistribution == LinuxDebian) +DEFAULTVT=vt7 +#endif + #ifndef XdmPixmap # define XdmPixmap XFree86.xpm # define XdmbwPixmap XFree86bw.xpm @@ -28,7 +32,7 @@ XDMPIDDIR = $(XDMDIR) #endif -#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) +#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || defined(FreeBSDArchitecture) SU = "su -m" #else SU = su Index: xc/programs/xdm/config/Xres.cpp diff -u xc/programs/xdm/config/Xres.cpp:1.4 xc/programs/xdm/config/Xres.cpp:1.6 --- xc/programs/xdm/config/Xres.cpp:1.4 Mon Jan 22 17:32:34 2001 +++ xc/programs/xdm/config/Xres.cpp Fri Jan 3 22:11:31 2003 @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.4 2001/01/22 22:32:34 dawes Exp $ +! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.6 2003/01/04 03:11:31 dawes Exp $ ! #define BS \ /* cpp can be trickier than m4 */ #define NLBS \n\ /* don't remove these comments */ @@ -14,7 +14,7 @@ <Key>Left: move-backward-character()NLBS <Key>Right: move-forward-character()NLBS <Key>Home: move-to-begining()NLBS - <Key>End: move-to-end()NLBS\ + <Key>End: move-to-end()NLBS Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()NLBS <Key>KP_Enter: set-session-argument() finish-field()NLBS Ctrl<Key>Return: set-session-argument(failsafe) finish-field()NLBS @@ -30,13 +30,13 @@ #ifdef XPM /**/#if WIDTH > 800 xlogin*greetFont: -adobe-helvetica-bold-o-normal--24-240-75-75-p-138-iso8859-1 -xlogin*font: -adobe-helvetica-medium-r-normal--18-180-75-75-p-103-iso8859-1 +xlogin*font: -adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1 xlogin*promptFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 xlogin*failFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 /**/#else xlogin*greetFont: -adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso8859-1 -xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-69-iso8859-1 -xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-69-iso8859-1 +xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1 +xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1 xlogin*failFont: -adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859-1 /**/#endif #endif /* XPM */ Index: xc/programs/xdm/config/xdm-conf.cpp diff -u xc/programs/xdm/config/xdm-conf.cpp:1.9 xc/programs/xdm/config/xdm-conf.cpp:1.10 --- xc/programs/xdm/config/xdm-conf.cpp:1.9 Sun Nov 25 07:49:19 2001 +++ xc/programs/xdm/config/xdm-conf.cpp Sat Nov 30 14:11:32 2002 @@ -3,19 +3,18 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.9 2001/11/25 12:49:19 herrb Exp $ +! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.10 2002/11/30 19:11:32 herrb Exp $ ! -DisplayManager.errorLogFile: XDMLOGDIR/xdm-errors -DisplayManager.pidFile: XDMPIDDIR/xdm-pid +DisplayManager.errorLogFile: XDMLOGDIR/xdm.log +DisplayManager.pidFile: XDMPIDDIR/xdm.pid DisplayManager.keyFile: XDMDIR/xdm-keys DisplayManager.servers: XDMDIR/Xservers DisplayManager.accessFile: XDMDIR/Xaccess DisplayManager.willing: SU nobody -c XDMDIR/Xwilling ! All displays should use authorization, but we cannot be sure -! X terminals will be configured that way, so by default -! use authorization only for local displays :0, :1, etc. -DisplayManager._0.authorize: true -DisplayManager._1.authorize: true +! X terminals may not be configured that way, so they will require +! individual resource settings. +DisplayManager*authorize: true ! The following three resources set up display :0 as the console. DisplayManager._0.setup: XDMDIR/Xsetup_0 DisplayManager._0.startup: XDMDIR/GiveConsole @@ -25,8 +24,7 @@ DisplayManager*session: XDMDIR/Xsession DisplayManager*authComplain: true #ifdef XPM -! this is a new line Caolan, 9312811@ul.ie -DisplayManager*loginmoveInterval: 10 +DisplayManager*loginmoveInterval: 10 #endif /* XPM */ ! SECURITY: do not listen for XDMCP or Chooser requests ! Comment out this line if you want to manage X terminals with xdm Index: xc/programs/xdm/greeter/Imakefile diff -u xc/programs/xdm/greeter/Imakefile:1.6 xc/programs/xdm/greeter/Imakefile:1.7 --- xc/programs/xdm/greeter/Imakefile:1.6 Thu Mar 29 21:15:24 2001 +++ xc/programs/xdm/greeter/Imakefile Sat Nov 30 13:59:35 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xdm/greeter/Imakefile,v 1.6 2001/03/30 02:15:24 keithp Exp $ +XCOMM $XFree86: xc/programs/xdm/greeter/Imakefile,v 1.7 2002/11/30 18:59:35 herrb Exp $ #define DoNormalLib NO #define DoSharedLib YES @@ -81,8 +81,6 @@ DEFINES = $(GREETER_DEFINES) $(XDMAUTH_DEFINES) $(RPC_DEFINES) \ $(KRBIV_DEFINES) $(KRB5_DEFINES) $(PWD_DEFINES) $(PAM_DEFINES) \ $(XKB_CLIENT_DEFINES) - -SHLIBDIR = $(XDMDIR) SRCS = greet.c verify.c Login.c OBJS = greet.o verify.o Login.o Index: xc/programs/xdm/greeter/Login.c diff -u xc/programs/xdm/greeter/Login.c:3.15 xc/programs/xdm/greeter/Login.c:3.16 --- xc/programs/xdm/greeter/Login.c:3.15 Wed Jan 2 18:24:04 2002 +++ xc/programs/xdm/greeter/Login.c Sun Oct 6 16:42:16 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.15 2002/01/02 23:24:04 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.16 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon @@ -969,8 +969,8 @@ #endif /* XPM */ len = NAME_LEN - strlen(ctx->login.data.name) - 2; case GET_PASSWD: - if (len + (int)strlen(ctx->login.data.passwd) >= NAME_LEN - 1) - len = NAME_LEN - strlen(ctx->login.data.passwd) - 2; + if (len + (int)strlen(ctx->login.data.passwd) >= PASSWORD_LEN - 1) + len = PASSWORD_LEN - strlen(ctx->login.data.passwd) - 2; } #ifndef XPM if (len == 0) @@ -1255,7 +1255,7 @@ { LoginWidget w = (LoginWidget)gw; bzero (w->login.data.name, NAME_LEN); - bzero (w->login.data.passwd, NAME_LEN); + bzero (w->login.data.passwd, PASSWORD_LEN); XtReleaseGC(gw, w->login.textGC); XtReleaseGC(gw, w->login.bgGC); XtReleaseGC(gw, w->login.xorGC); Index: xc/programs/xdm/greeter/Login.h diff -u xc/programs/xdm/greeter/Login.h:3.6 xc/programs/xdm/greeter/Login.h:3.7 --- xc/programs/xdm/greeter/Login.h:3.6 Fri Dec 14 15:01:28 2001 +++ xc/programs/xdm/greeter/Login.h Sun Oct 6 16:42:16 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.6 2001/12/14 20:01:28 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.7 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon @@ -114,10 +114,17 @@ /* notifyDone interface definition */ +#ifndef __OpenBSD__ #define NAME_LEN 32 +#define PASSWORD_LEN 32 +#else +#include <pwd.h> +#define NAME_LEN (_PW_NAME_LEN + 2) +#define PASSWORD_LEN (_PASSWORD_LEN + 2) +#endif typedef struct _LoginData { - char name[NAME_LEN], passwd[NAME_LEN]; + char name[NAME_LEN], passwd[PASSWORD_LEN]; } LoginData; # define NOTIFY_OK 0 Index: xc/programs/xdm/greeter/greet.c diff -u xc/programs/xdm/greeter/greet.c:3.15 xc/programs/xdm/greeter/greet.c:3.16 --- xc/programs/xdm/greeter/greet.c:3.15 Fri Dec 14 15:01:29 2001 +++ xc/programs/xdm/greeter/greet.c Sun Oct 6 16:42:16 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.15 2001/12/14 20:01:29 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.16 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon @@ -147,7 +147,7 @@ case NOTIFY_OK: strcpy (name, data->name); strcpy (password, data->passwd); - bzero (data->passwd, NAME_LEN); + bzero (data->passwd, PASSWORD_LEN); code = 0; done = 1; break; Index: xc/programs/xdm/greeter/verify.c diff -u xc/programs/xdm/greeter/verify.c:3.21 xc/programs/xdm/greeter/verify.c:3.24 --- xc/programs/xdm/greeter/verify.c:3.21 Fri Dec 14 15:01:29 2001 +++ xc/programs/xdm/greeter/verify.c Mon Nov 25 20:16:09 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.21 2001/12/14 20:01:29 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.24 2002/11/26 01:16:09 dawes Exp $ */ /* * xdm - display manager daemon @@ -37,12 +37,13 @@ * typical unix verification routine. */ -# include "dm.h" -# include "dm_error.h" +#include "dm.h" +#include "dm_error.h" -# include <pwd.h> +#include <pwd.h> #ifdef USE_PAM # include <security/pam_appl.h> +# include <stdlib.h> #else # ifdef USESHADOW # include <shadow.h> @@ -78,7 +79,6 @@ #ifdef KERBEROS #include <sys/param.h> #include <kerberosIV/krb.h> -#include <kerberosIV/kafs.h> static char krbtkfile[MAXPATHLEN]; #endif @@ -123,13 +123,10 @@ void *appdata_ptr) { int count = 0, replies = 0; struct pam_response *reply = NULL; - size_t size = sizeof(struct pam_response); -#define GET_MEM \ - if (reply) realloc(reply, size); \ - else reply = (struct pam_response*)malloc(size); \ - if (!reply) return PAM_CONV_ERR; \ - size += sizeof(struct pam_response) +#define PAM_RESPONSE_SIZE sizeof(struct pam_response) + size_t size = PAM_RESPONSE_SIZE; + #define COPY_STRING(s) (s) ? strdup(s) : (char*)NULL for (count = 0; count < num_msg; count++) { @@ -139,7 +136,19 @@ return PAM_CONV_ERR; case PAM_PROMPT_ECHO_OFF: /* wants password */ - GET_MEM; + if (reply) { + reply = realloc(reply, size); + bzero(reply + size - PAM_RESPONSE_SIZE, PAM_RESPONSE_SIZE); + } else { + reply = (struct pam_response*)malloc(size); + bzero(reply, size); + } + + if (!reply) + return PAM_CONV_ERR; + + size += PAM_RESPONSE_SIZE; + reply[replies].resp_retcode = PAM_SUCCESS; reply[replies].resp = COPY_STRING(PAM_password); /* PAM frees resp */ @@ -155,7 +164,6 @@ } #undef COPY_STRING -#undef GET_MEM if (reply) *resp = reply; return PAM_SUCCESS; } @@ -223,7 +231,8 @@ /* Build path of the auth script and call it */ snprintf(path, sizeof(path), _PATH_AUTHPROG "%s", style); - auth_call(as, path, style, "-s", "response", greet->name, NULL); + auth_call(as, path, style, "-s", "response", greet->name, + (void *)NULL); authok = auth_getstate(as); if ((authok & AUTH_ALLOW) == 0) { @@ -305,7 +314,7 @@ return 0; } else { #ifdef linux - if (p->pw_passwd[0] == '!' || p->pw_passwd[0] == '*') { + if (!strcmp(p->pw_passwd, "!") || !strcmp(p->pw_passwd, "*")) { Debug ("The account is locked, no login allowed.\n"); bzero(greet->password, strlen(greet->password)); return 0; Index: xc/programs/xdpyinfo/xdpyinfo.c diff -u xc/programs/xdpyinfo/xdpyinfo.c:3.27 xc/programs/xdpyinfo/xdpyinfo.c:3.28 --- xc/programs/xdpyinfo/xdpyinfo.c:3.27 Wed Jan 16 15:30:19 2002 +++ xc/programs/xdpyinfo/xdpyinfo.c Wed Sep 25 22:56:51 2002 @@ -29,7 +29,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.27 2002/01/16 20:30:19 dawes Exp $ */ +/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.28 2002/09/26 02:56:51 keithp Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -945,6 +945,10 @@ XVisualInfo *vip; /* retured info */ int nvi; /* number of elements returned */ int ndepths = 0, *depths = NULL; +#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 + XFilters *filters; + int f; +#endif if (!XRenderQueryVersion (dpy, &major, &minor)) return 0; @@ -978,7 +982,33 @@ nvi = 0; viproto.screen = i; vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); - printf (" Screen %d\n", i); + printf (" Screen %d", i); +#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 + switch (XRenderQuerySubpixelOrder (dpy, i)) { + case SubPixelUnknown: printf (" (sub-pixel order Unknown)"); break; + case SubPixelHorizontalRGB: printf (" (sub-pixel order Horizontal RGB)"); break; + case SubPixelHorizontalBGR: printf (" (sub-pixel order Horizontal BGR)"); break; + case SubPixelVerticalRGB: printf (" (sub-pixel order Vertical RGB)"); break; + case SubPixelVerticalBGR: printf (" (sub-pixel order Vertical BGR)"); break; + case SubPixelNone: printf (" (sub-pixel order None)"); break; + } + printf ("\n"); + filters = XRenderQueryFilters (dpy, RootWindow (dpy, i)); + if (filters) + { + printf (" filters: "); + for (f = 0; f < filters->nfilter; f++) + { + printf ("%s", filters->filter[f]); + if (f < filters->nalias && filters->alias[f] != FilterAliasNone) + printf ("(%s)", filters->filter[filters->alias[f]]); + if (f < filters->nfilter - 1) + printf (", "); + } + XFree (filters); + } +#endif + printf ("\n"); for (j = 0; j < nvi; j++) { printf (" visual format:\n"); Index: xc/programs/xedit/Imakefile diff -u xc/programs/xedit/Imakefile:1.17 xc/programs/xedit/Imakefile:1.24 --- xc/programs/xedit/Imakefile:1.17 Fri Jan 4 14:24:10 2002 +++ xc/programs/xedit/Imakefile Tue Oct 1 10:31:46 2002 @@ -1,6 +1,7 @@ XCOMM $XConsortium: Imakefile,v 1.17 93/08/17 20:49:32 rws Exp $ -XCOMM $XFree86: xc/programs/xedit/Imakefile,v 1.17 2002/01/04 19:24:10 paulo Exp $ +XCOMM $XFree86: xc/programs/xedit/Imakefile,v 1.24 2002/10/01 14:31:46 alanh Exp $ +#ifndef OS2Architecture #include "lisp/lisp.cf" #if BuildSharedLispModules @@ -13,9 +14,13 @@ #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" SUBDIRS = lisp + LISPLIBS = -Llisp -llisp -Llisp/mp -lmp -Llisp/re -lre + LISP_SRC = lisp.c + LISP_OBJ = lisp.o +#endif DEPLIBS = XawClientDepLibs $(SUBDIRS) -LOCAL_LIBRARIES = XawClientLibs -Llisp -llisp $(DLLIB) +LOCAL_LIBRARIES = $(LISPLIBS) XawClientLibs $(DLLIB) SYS_LIBRARIES = MathLibrary #if defined(LynxOSArchitecture) || defined(SVR3Architecture) || defined(LinuxArchitecture) RP_SRCS = realpath.c @@ -31,11 +36,12 @@ SYS_OBJS = $(RP_OBJS) $(STRCCMP_OBJS) SYS_DEFINES = $(RP_DEFINES) $(STRCCMP_DEFINES) DEFINES = $(SIGNAL_DEFINES) $(SYS_DEFINES) + INCLUDES = -I. -Ilisp/re -I- $(MISC_INCLUDES) SRCS = xedit.c commands.c util.c $(SYS_SRCS) ispell.c options.c \ - hook.c c-mode.c lisp.c proto.c + hook.c $(LISP_SRC) OBJS = xedit.o commands.o util.o $(SYS_OBJS) ispell.o options.o \ - hook.o c-mode.o lisp.o proto.o + hook.o $(LISP_OBJ) #ifdef IHaveSubdirs ForceSubdirs($(SUBDIRS)) Index: xc/programs/xedit/Xedit-color.ad diff -u xc/programs/xedit/Xedit-color.ad:1.6 xc/programs/xedit/Xedit-color.ad:1.15 --- xc/programs/xedit/Xedit-color.ad:1.6 Sat Aug 28 05:01:20 1999 +++ xc/programs/xedit/Xedit-color.ad Tue Nov 12 23:35:45 2002 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xedit/Xedit-color.ad,v 1.6 1999/08/28 09:01:20 dawes Exp $ +! $XFree86: xc/programs/xedit/Xedit-color.ad,v 1.15 2002/11/13 04:35:45 paulo Exp $ #include "Xedit" @@ -6,37 +6,57 @@ *foreground: gray15 *borderColor: gray40 *Command.highlightThickness: 1 -*Command.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray60 +*Command.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *Command.foreground: gray20 *Command.displayList:\ -foreground gray60;\ -lines +2,-2,-2,-2,-2,+2;\ +foreground gray92;\ +line 1,0,-2,0;\ foreground gray95;\ -lines -3,+1,+1,+1,+1,-3;\ -foreground gray78;\ -points -2,+1,+1,-2 +line 2,1,-3,1;\ +foreground gray74;\ +segments 3,-3,-4,-3, 2,-4,-3,-4, 1,-6,-2,-6;\ +point -1,-1;\ +foreground gray80;\ +line 0,0,0,-1;\ +point -1,0 *Command.translations: #override \ -<Btn1Down>: declare(1, $set, 1) set-values(1, foreground, gray20, background, rgb:d/5/5) set()\n\ -Button1<Leave>: reset() declare(1, $set, 0) set-values(1, foreground, gray20, background, gray70)\n\ -<Btn1Up>: set-values($set, foreground, gray70, background, gray20) notify() unset() +<Btn1Down>: set-values(1, foreground, gray20, background, rgb:d/5/5) set()\n\ +Button1<Leave>: reset() set-values(1, foreground, gray20, background, gray70)\n\ +<Btn1Up>: notify() unset() *Toggle.foreground: gray30 -*Toggle.background: gray85 -*Toggle.borderColor: gray70 +*Toggle.background: gray82 +*Toggle.borderColor: gray90 *Toggle.displayList:\ -foreground gray50;\ -lines +2,-2,-2,-2,-2,+2;\ -foreground gray60;\ -lines -2,+1,+1,+1,+1,-2 +foreground gray75;\ +segments 0,1,0,-2,-1,1,-1,-2;\ +foreground gray80;\ +segments 0,0,-1,0,0,-1,-1,-1;\ +points 1,1,1,-2,-2,1, -2,-2 -*bc_label.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray60 +*bc_label.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 +*bc_label.displayList:\ +foreground gray92;\ +line 1,0,-2,0;\ +foreground gray95;\ +line 2,1,-3,1;\ +foreground gray74;\ +segments 3,-2,-4,-2, 2,-3,-3,-3, 1,-5,-2,-5 *bc_label.foreground: gray20 -*formWindow.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray60 + +*formWindow.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 +*formWindow.displayList:\ +foreground gray92;\ +line 1,0,-2,0;\ +foreground gray95;\ +line 2,1,-3,1;\ +foreground gray74;\ +segments 3,-2,-4,-2, 2,-3,-3,-3, 1,-5,-2,-5 *formWindow*backgroundPixmap: ParentRelative *formWindow*foreground: gray20 *formWindow*background: gray74 -*formWindow.labelWindow.background: gray78 +*formWindow.labelWindow.background: gray80 *formWindow.labelWindow.displayList:\ line-style onoffdash;\ foreground gray30;\ @@ -46,7 +66,14 @@ fill-rect 4,3,15,14 *dirlabel.foreground: gray20 -*dirlabel.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray60 +*dirlabel.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 +*dirlabel.displayList:\ +foreground gray92;\ +line 1,0,-2,0;\ +foreground gray95;\ +line 2,1,-3,1;\ +foreground gray74;\ +segments 3,-2,-4,-2, 2,-3,-3,-3, 1,-5,-2,-5 *dirwindow.background: gray96 *internalBorderColor: gray40 @@ -55,17 +82,23 @@ *Text.background: gray96 *Text.?.background: gray96 *Text*cursorColor: rgb:d/5/5 +*Text.displayList:\ +foreground white;\ +line 1,-1,-2,-1;\ +foreground gray88;\ +line 1,0,-2,0 *Scrollbar.foreground: rgb:a/5/5 *Scrollbar.background: gray60 *Text.Scrollbar.background: gray60 -*Scrollbar.backgroundPixmap: gradient:horizontal?dimension=14&start=gray80&end=gray40 -*hScrollbar.backgroundPixmap: gradient:vertical?dimension=14&start=gray40&end=gray80 -*Scrollbar.displayList:\ +*Scrollbar.backgroundPixmap: gradient:horizontal?dimension=14&start=gray70&end=gray85 +*hScrollbar.backgroundPixmap: gradient:vertical?dimension=14&start=gray85&end=gray70 +*hScrollbar.displayList:\ foreground gray85;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground gray30;\ -lines -1,+0,+0,+0,+0,-1 +segments 1,-1,-2,-1,1,0,-2,0 +*vScrollbar.displayList:\ +foreground gray85;\ +segments 0,1,0,-2,-1,1,-1,-2 *Scrollbar.thumb: vlines2 *hScrollbar.thumb: hlines2 @@ -92,7 +125,8 @@ *TransientShell.Form.backgroundPixmap: ParentRelative *TransientShell.Form.Label.backgroundPixmap: ParentRelative -*ispell*Scrollbar.borderColor: gray60 +*ispell*Scrollbar.borderColor: gray50 +*ispell*Scrollbar.displayList: *ispell*List.background: gray96 *ispell*word.background: gray96 *ispell*word.backgroundPixmap: XtUnspecifiedPixmap @@ -133,7 +167,7 @@ draw-rect +1,+1,-2,-2 *ispell*options.MenuButton.borderColor: gray70 *ispell*options.MenuButton.background: gray78 -*ispell*options.MenuButton.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray60 +*ispell*options.MenuButton.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *ispell*options.MenuButton.displayList:\ foreground gray60;\ lines +2,-2,-2,-2,-2,+2;\ @@ -148,24 +182,14 @@ *tip.rightMargin: 7 *tip.bottomMargin: 3 *tip.displayList:\ -foreground rgb:f/f/3;\ +foreground rgb:f/e/8;\ fill-rect 1,1,-2,-2;\ -foreground rgb:d/d/1;\ +foreground rgb:d/c/6;\ draw-segments 0,1,0,-3,1,-2,-3,-2,-2,-3,-2,1,-3,0,1,0;\ -foreground rgb:a/a/0;\ +foreground rgb:a/8/4;\ draw-lines 2,-1, -2,-1, -1,-2, -1,2 -*editModes.C.auto: True -*editModes.C.properties:\ -default?foreground=black&font=*courier-medium-r*12*,\ -keyword?foreground=gray12&font=*courier-bold-r*12*,\ -preprocessor?foreground=green4&font=*courier-medium-r*12*,\ -comment?foreground=SlateBlue3&font=*courier-medium-o*12*,\ -string?foreground=RoyalBlue2&font=*lucidatypewriter-medium-r*12*,\ -constant?foreground=VioletRed3&font=*lucidatypewriter-medium-r*12*,\ -octal?foreground=OrangeRed3&font=*courier-bold-r*12*&overstrike,\ -hexa?foreground=OrangeRed3&font=*courier-bold-r*12*&underline,\ -integer?foreground=OrangeRed3&font=*courier-bold-r*12*,\ -float?foreground=OrangeRed3&font=*courier-bold-r*12*&overstrike&underline,\ -punctuation?foreground=gray12&font=*courier-bold-r*12*,\ -error?foreground=yellow&background=red&font=*new century schoolbook-bold*25* +*grip.foreground: gray10 +*grip.displayList:\ +foreground gray80;\ +points 0,0,0,-1,-1,-1,-1,0 Index: xc/programs/xedit/Xedit-sample diff -u xc/programs/xedit/Xedit-sample:1.8 xc/programs/xedit/Xedit-sample:1.10 --- xc/programs/xedit/Xedit-sample:1.8 Sun Jul 11 04:49:31 1999 +++ xc/programs/xedit/Xedit-sample Fri Nov 8 03:00:55 2002 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xedit/Xedit-sample,v 1.8 1999/07/11 08:49:31 dawes Exp $ +! $XFree86: xc/programs/xedit/Xedit-sample,v 1.10 2002/11/08 08:00:55 paulo Exp $ Xedit*insertFile*text.width: 150 Xedit*search*searchText.width: 192 Index: xc/programs/xedit/Xedit.ad diff -u xc/programs/xedit/Xedit.ad:1.20 xc/programs/xedit/Xedit.ad:1.24 --- xc/programs/xedit/Xedit.ad:1.20 Fri Aug 31 11:00:11 2001 +++ xc/programs/xedit/Xedit.ad Sun Nov 10 18:21:56 2002 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xedit/Xedit.ad,v 1.20 2001/08/31 15:00:11 paulo Exp $ +! $XFree86: xc/programs/xedit/Xedit.ad,v 1.24 2002/11/10 23:21:56 paulo Exp $ *geometry: 590x440 *input: TRUE @@ -132,20 +132,6 @@ *editMenu.modeMenuItem.leftBitmap: menu12 *editMenu.modeMenuItem.label: Edit Mode *editModes.none.label: Plain/None -*editModes.C.label: C/C++ -*editModes.C.properties:\ -keyword?font=*courier-bold-r*12*,\ -preprocessor?font=*courier-medium-r*12*,\ -comment?font=*courier-medium-o*12*,\ -string?font=*lucidatypewriter-medium-r*12*,\ -constant?font=*lucidatypewriter-medium-r*12*,\ -octal?font=*courier-bold-r*12*&overstrike,\ -hexa?font=*courier-bold-r*12*&underline,\ -integer?font=*courier-bold-r*12*,\ -float?font=*courier-bold-r*12*&overstrike&underline,\ -punctuation?font=*courier-bold-r*12*,\ -error?foreground=white&background=black&font=*new century schoolbook-bold*25*,\ -default?font=*courier-medium-r*12* *TransientShell*Text.translations: #override \ c<Key>S: no-op(r)\n\ @@ -164,7 +150,8 @@ *baseTranslations: #override \ <Ctrl>X,<Ctrl>C:quit()\n\ <Ctrl>X,<Ctrl>S:save-file()\n\ -<Ctrl>X,<Ctrl>F:find-file() +<Ctrl>X,<Ctrl>F:find-file()\n\ +<Key>Escape: line-edit() *messageWindow.Translations: #override \ <Ctrl>X,<Ctrl>C:quit()\n\ Index: xc/programs/xedit/c-mode.c diff -u xc/programs/xedit/c-mode.c:1.10 xc/programs/xedit/c-mode.c:removed --- xc/programs/xedit/c-mode.c:1.10 Sun Dec 2 10:02:31 2001 +++ xc/programs/xedit/c-mode.c Thu Feb 27 12:34:54 2003 @@ -1,916 +0,0 @@ -/* - * Copyright (c) 1999 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - * - * Author: Paulo César Pereira de Andrade - */ - -/* $XFree86: xc/programs/xedit/c-mode.c,v 1.10 2001/12/02 15:02:31 paulo Exp $ */ - -#include "xedit.h" -#include <X11/IntrinsicP.h> -#include <X11/Xaw/TextSinkP.h> -#include <X11/Xaw/TextSrcP.h> -#include <X11/Xmu/Xmu.h> -#include <stdlib.h> /* for bsearch() */ -#include <ctype.h> - -#define C_Peek(parser) ((parser)->next) - -/* - * Types - */ -typedef struct _C_ParserEnt C_ParserEnt; -struct _C_ParserEnt { - XawTextPosition position; - Cardinal length; - XrmQuark identifier; - C_ParserEnt *next; -}; - -typedef struct _C_Parser { - Widget source; - XawTextBlock block; - XawTextPosition position, offset, start, end, - update_from, update_to, clear_from, clear_to, last; - C_ParserEnt *ent; - XrmQuark quark; - int i, ch, next; - Bool interactive; -} C_Parser; - -/* - * Prototypes - */ -void C_ModeStart(Widget); -void C_ModeEnd(Widget); -static void C_ModeInit(void); -static Bool C_IsKeyword(char*); -static int C_Get(C_Parser*); -static void C_Commit(C_Parser*); -static int C_Parse1(C_Parser*); -static int C_Parse2(C_Parser*); -static int C_Parse3(C_Parser*); -static int C_Parse4(C_Parser*); -static void C_ParseCallback(Widget, XtPointer, XtPointer); - -/* - * Initialization - */ -static XrmQuark - Qkeyword, - Qpreprocessor, - Qcomment, - Qstring, - Qconstant, - Qoctal, - Qhexa, - Qinteger, - Qfloat, - Qpunctuation, - Qdefault, - Qerror; - -static char *keywords[] = { - "asm", - "auto", - "break", - "case", - "catch", - "char", - "class", - "const", - "continue", - "default", - "delete", - "do", - "double", - "else", - "enum", - "extern", - "float", - "for", - "friend", - "goto", - "if", - "inline", - "int", - "long", - "new", - "operator", - "private", - "protected", - "public", - "register", - "return", - "short", - "signed", - "sizeof", - "static", - "struct", - "switch", - "template", - "this", - "throw", - "try", - "typedef", - "union", - "unsigned", - "virtual", - "void", - "volatile", - "while" -}; - -/* - * Implementation - */ -void -C_ModeStart(Widget src) -{ - C_Parser parser; - - C_ModeInit(); - - /* initialize parser state */ - parser.source = src; - parser.position = XawTextSourceRead(parser.source, 0, - &parser.block, 4096); - parser.offset = -1; - parser.quark = NULLQUARK; - parser.i = 0; - if (parser.block.length == 0) - parser.ch = parser.next = EOF; - else - (void)C_Get(&parser); - parser.interactive = False; - parser.last = XawTextSourceScan(src, 0, XawstAll, XawsdRight, 1, 1); - - while (C_Parse1(&parser) != EOF) - ; - - /* add callbacks for interactive changes */ - XtAddCallback(src, XtNpropertyCallback, C_ParseCallback, NULL); -} - -void -C_ModeEnd(Widget src) -{ - XtRemoveCallback(src, XtNpropertyCallback, C_ParseCallback, NULL); -} - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif -#ifndef ABS -#define ABS(a) ((a) > 0 ? (a) : -(a)) -#endif - -static XawTextPosition -C_ParseSearch(Widget w, XawTextPosition from, XawTextPosition to, char *ptr) -{ - XawTextBlock block; - char *match = ptr; - - if (!ptr || !*ptr || from >= to) - return (XawTextSearchError); - - while (from < to) { - int i; - - from = XawTextSourceRead(w, from, &block, to - from); - for (i = 0; i < block.length; i++) { - if (block.ptr[i] == *match) { - if (*++match == '\0') - return (block.firstPos + i - (match - ptr)); - } - else - match = ptr; - } - } - - return (XawTextSearchError); -} - -/* find start/end pair of a preprocessor directive */ -static void -C_ParsePreprocessor(Widget w, XawTextAnchor *anchor, XawTextEntity *entity, - XawTextPosition *left_return, XawTextPosition *right_return) -{ - XawTextPosition left, right, ltmp, rtmp; - char *ptr; - XawTextBlock block; - - left = anchor->position + entity->offset; - right = left + entity->length; - - (void)XawTextSourceRead(w, left, &block, 1); - if (block.length != 1 || block.ptr[0] != '#') - ltmp = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 1, False); - else - ltmp = left; - - /* left is resolved */ - left = MIN(left, ltmp); - - ptr = "\\\n"; - rtmp = left + 1; - /*CONSTCOND*/ - while (True) { - ltmp = XawTextSourceScan(w, rtmp, XawstEOL, XawsdRight, 1, True); - if ((rtmp = C_ParseSearch(w, rtmp, ltmp, ptr)) == - XawTextSearchError || ltmp < rtmp + 2) { - rtmp = ltmp; - break; - } - rtmp += 2; - } - - ptr = "/*"; - if ((ltmp = C_ParseSearch(w, left, rtmp, ptr)) != - XawTextSearchError && ltmp < rtmp) { - block.ptr = "*/"; - if ((ltmp = XawTextSourceSearch(w, ltmp + 2, XawsdRight, &block)) == - XawTextSearchError) - rtmp = XawTextSourceScan(w, 0, XawstAll, XawsdRight, 1, 1); - else - rtmp = MAX(ltmp + 2, rtmp); - - ptr = "\\\n"; - /*CONSTCOND*/ - while (True) { - ltmp = XawTextSourceScan(w, rtmp, XawstEOL, XawsdRight, 1, True); - if ((rtmp = C_ParseSearch(w, rtmp, ltmp, ptr)) == - XawTextSearchError || ltmp < rtmp + 2) { - rtmp = ltmp; - break; - } - rtmp += 2; - } - } - right = MAX(right, rtmp); - - *left_return = left; - *right_return = right; -} - -/* better to have a public interface to things like this... */ -static void -C_ParseNeedsUpdating(Widget w, XawTextPosition from, XawTextPosition to) -{ - TextSrcObject src = (TextSrcObject)w; - int i; - - for (i = 0; i < src->textSrc.num_text; i++) - _XawTextNeedsUpdating((TextWidget)(src->textSrc.text[i]), from, to); -} - -static void -C_ParseCallback(Widget w, XtPointer client_data, XtPointer call_data) -{ - XawTextPropertyInfo *info = (XawTextPropertyInfo*)call_data; - XawTextAnchor *anchor; - XawTextEntity *entity, *eprev; - XawTextPosition left, right, last, rtmp, ltmp, pleft, pright; - XawTextPosition position = info->left; - XawTextBlock block; - - block.firstPos = 0; - block.format = FMT8BIT; - - rtmp = ltmp = position; - left = 0; - right = last = XawTextSourceScan(w, 0, XawstAll, XawsdRight, 1, 1); - - if ((anchor = XawTextSourceFindAnchor(w, position)) != NULL) { - XawTextEntity *prep = NULL; - -previous_anchor: - entity = eprev = anchor->entities; - while (entity) { - if (anchor->position + entity->offset + entity->length >= position) { - if (eprev && eprev->property == Qpreprocessor) { - prep = eprev; - C_ParsePreprocessor(w, anchor, eprev, &pleft, &pright); - ltmp = MIN(ltmp, pleft); - rtmp = MAX(rtmp, pright); - } - else if (entity && entity->property == Qpreprocessor) { - prep = entity; - C_ParsePreprocessor(w, anchor, entity, &pleft, &pright); - ltmp = MIN(ltmp, pleft); - rtmp = MAX(rtmp, pright); - } - break; - } - eprev = entity; - entity = entity->next; - } - if (eprev == NULL || - anchor->position + eprev->offset + eprev->length >= position) { - if ((anchor = XawTextSourcePrevAnchor(w, anchor)) != NULL) - goto previous_anchor; - if (anchor == NULL || eprev == NULL) { - ltmp = 0; - if ((anchor = XawTextSourceFindAnchor(w, 0)) != NULL) - eprev = anchor->entities; - } - } - if (anchor && eprev) { - left = anchor->position + eprev->offset + eprev->length; - if (eprev->property == Qerror) - left -= eprev->length; - if ((entity = eprev->next) == NULL) { - if ((anchor = XawTextSourceNextAnchor(w, anchor)) != NULL) { - entity = anchor->entities; - if (entity && entity->property == Qpreprocessor) { - C_ParsePreprocessor(w, anchor, entity, &pleft, &pright); - ltmp = MIN(ltmp, pleft); - rtmp = MAX(rtmp, pright); - } - } - } - if (entity && (entity = entity->next) == NULL) { - if ((anchor = XawTextSourceNextAnchor(w, anchor)) != NULL) - entity = anchor->entities; - if (entity && entity->property == Qpreprocessor && - entity != prep) { - C_ParsePreprocessor(w, anchor, entity, &pleft, &pright); - ltmp = MIN(ltmp, pleft); - rtmp = MAX(rtmp, pright); - } - } - if (entity && (entity = entity->next) == NULL) { - if ((anchor = XawTextSourceNextAnchor(w, anchor)) != NULL) - entity = anchor->entities; - } - if (anchor && entity) { - int count = 0; - - if (entity->property == Qpreprocessor && entity != prep) { - C_ParsePreprocessor(w, anchor, entity, &pleft, &pright); - ltmp = MIN(ltmp, pleft); - rtmp = MAX(rtmp, pright); - } - right = anchor->position + entity->offset; - while (entity && count++ < 3) { - if (entity->property == Qerror) { - right = anchor->position + entity->offset + entity->length; - count = 0; - } - if ((entity = entity->next) == NULL && - (anchor = XawTextSourceNextAnchor(w, anchor)) != NULL) - entity = anchor->entities; - } - } - } - } - - left = MAX(0, MIN(ltmp, left)); - right = MIN(last, MAX(right, rtmp)); - - if (left < right) { - C_Parser parser; - C_ParserEnt *ent, *nent; - XawTextAnchor *kanc; - XawTextEntity *kent; - XawTextPosition kfrom = 0, kto = 0; - int delta = info->block->length - (info->right - info->left); - - if (XawTextSourceAnchorAndEntity(w, position - 1, - &kanc, &kent) == False) - kent = NULL; - else { - kfrom = kanc->position + kent->offset; - kto = kfrom + kent->length; - } - - parser.position = XawTextSourceRead(parser.source = w, left, - &parser.block, 4096); - parser.offset = left - 1; - ltmp = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 1, False); - if (ltmp == left || - XawTextSourceScan(w, XawTextSourceScan(w, ltmp, XawstWhiteSpace, - XawsdRight, 1, False), - XawstWhiteSpace, XawsdLeft, 1, False) == left) - parser.quark = NULLQUARK; - else - parser.quark = Qdefault; - parser.i = 0; - if (parser.block.length == 0) - parser.ch = parser.next = EOF; - else - (void)C_Get(&parser); - parser.interactive = True; - parser.clear_from = left; - parser.clear_to = right; - parser.update_from = last; - parser.update_to = 0; - parser.ent = NULL; - parser.last = last; - - while (C_Parse1(&parser) != EOF) - if (parser.offset > MAX(right, parser.update_to)) - break; - - if (parser.update_from > info->left) - parser.update_from -= delta; - if (parser.update_to > info->left) - parser.update_to -= delta; - XawTextSourceClearEntities(parser.source, parser.clear_from, - parser.clear_to); - C_ParseNeedsUpdating(parser.source, parser.update_from, - parser.update_to); - - ent = parser.ent; - while (ent) { - nent = ent->next; - XawTextSourceAddEntity(parser.source, 0, 0, NULL, ent->position, - ent->length, ent->identifier); - XtFree((XtPointer)ent); - ent = nent; - } - - if (kent) { - if (XawTextSourceAnchorAndEntity(w, kfrom, &kanc, &kent) == False || - kanc->position + kent->offset != kfrom || - kfrom + kent->length != kto) { - if (kfrom > info->left) - kfrom -= delta; - if (kto > info->left) - kto -= delta; - C_ParseNeedsUpdating(parser.source, kfrom, kto); - } - } - } -} - -static int -bcmp_keywords(_Xconst void *left, _Xconst void *right) -{ - return (strcmp((char*)left, *(char**)right)); -} - -static Bool -C_IsKeyword(char *str) -{ - return (bsearch(str, keywords, sizeof(keywords) / sizeof(keywords[0]), - sizeof(char*), bcmp_keywords) != NULL); -} - -static int -C_Get(C_Parser *parser) -{ - if (parser->ch == EOF) - return (EOF); - if (parser->i >= parser->block.length) { - parser->i = 0; - parser->position = XawTextSourceRead(parser->source, parser->position, - &parser->block, 4096); - } - parser->ch = parser->next; - if (parser->block.length == 0) - parser->next = EOF; - else - parser->next = (unsigned char)parser->block.ptr[parser->i++]; - parser->offset++; - - return (parser->ch); -} - -static void -C_Commit(C_Parser *parser) -{ - XawTextPosition position; - int length; - - position = parser->start; - length = parser->end - parser->start; - if (position < 0) { - length += position; - position = 0; - } - if (position + length > parser->last + 1) - length -= (position + length) - parser->last + 1; - - if (parser->quark != Qdefault && parser->quark != NULLQUARK && length > 0) { - XrmQuark quark = parser->quark; - - parser->quark = Qdefault; - - if (parser->interactive) { - XawTextAnchor *anchor; - XawTextEntity *entity; - C_ParserEnt *ent = XtNew(C_ParserEnt); - - ent->position = position; - ent->length = length; - ent->identifier = quark; - ent->next = parser->ent; - parser->ent = ent; - - if (position < parser->clear_from) - parser->clear_from = position; - if (position + length > parser->clear_to) - parser->clear_to = position + length; - - if (XawTextSourceAnchorAndEntity(parser->source, position, - &anchor, &entity) == False || - anchor->position + entity->offset != position || - entity->length != length || - entity->property != quark) { - if (position < parser->update_from) - parser->update_from = position; - if (position + length > parser->update_to) - parser->update_to = position + length; - } - } - else - XawTextSourceAddEntity(parser->source, 0, 0, NULL, position, length, - quark); - } -} - -/* comments */ -static int -C_Parse4(C_Parser *parser) -{ - int ch; - - for (;;) { - if ((ch = C_Get(parser)) == '/') { - switch (C_Peek(parser)) { - case '/': { - XrmQuark quark = parser->quark; - - parser->end = parser->offset - 1; - C_Commit(parser); - parser->quark = Qcomment; - parser->start = parser->end; - while ((ch = C_Peek(parser)) != '\n' && ch != EOF) - (void)C_Get(parser); - if (quark != Qpreprocessor && ch != EOF) - (void)C_Get(parser); - parser->end = parser->offset; - C_Commit(parser); - if (quark == Qpreprocessor) { - parser->start = parser->end; - parser->quark = quark; - } - else - parser->quark = NULLQUARK; - } break; - case '*': { - XrmQuark quark = parser->quark; - - parser->end = parser->offset - 1; - C_Commit(parser); - parser->quark = Qcomment; - parser->start = parser->end; - while ((ch = C_Get(parser)) != EOF) - if (ch == '*' && C_Peek(parser) == '/') - break; - if (ch != EOF) - ch = C_Get(parser); - parser->end = parser->offset; - C_Commit(parser); - - parser->start = parser->end; - parser->quark = quark; - } break; - default: - return (ch); - } - } - else - return (ch); - } - /*NOTREACHED*/ -} - -/* identifiers, preprocessor and blanks */ -static int -C_Parse3(C_Parser *parser) -{ - for (;;) { - int ch = C_Parse4(parser); - - if (ch >= 'a' && ch <= 'w') { - char buf[32]; - int sz = 0; - - parser->end = parser->offset - 1; - C_Commit(parser); - parser->start = parser->end; - buf[sz++] = ch; - while ((ch = C_Peek(parser)) != EOF && ch >= 'a' && ch <= 'z' && - sz + 1 < sizeof(buf)) - buf[sz++] = C_Get(parser); - buf[sz] = '\0'; - if (!isalnum(ch) && ch != '_' && C_IsKeyword(buf)) { - parser->quark = Qkeyword; - parser->end = parser->offset; - C_Commit(parser); - parser->quark = Qdefault; - parser->start = parser->end; - } - else if (isalnum(ch) || ch == '_') - while ((ch = C_Peek(parser)) != EOF && - (isalnum(ch) || ch == '_')) - (void)C_Get(parser); - parser->quark = Qdefault; - continue; - } - else if (ch == '_' || isalpha(ch)) { - parser->end = parser->offset - 1; - C_Commit(parser); - parser->quark = Qdefault; - while ((ch = C_Peek(parser)) != EOF && - (isalnum(ch) || ch == '_')) - (void)C_Get(parser); - continue; - } - - switch (ch) { - case '\'': - case '"': { - char value = ch; - - parser->end = parser->offset - 1; - C_Commit(parser); - parser->start = parser->end; - parser->quark = ch == '\'' ? Qconstant : Qstring; - while ((ch = C_Get(parser)) != value && ch != '\n' && ch != EOF) - if (ch == '\\') - (void)C_Get(parser); - parser->end = parser->offset; - C_Commit(parser); - if (ch != value) { - parser->start = parser->end; - parser->quark = Qerror; - while ((ch = C_Peek(parser)) != '\n' && ch != EOF) - (void)C_Get(parser); - } - } break; - case '#': - parser->end = parser->offset - 1; - C_Commit(parser); - if (parser->quark != NULLQUARK) - parser->quark = Qerror; - else - parser->quark = Qpreprocessor; - parser->start = parser->end; - if (parser->quark == Qerror) { - while ((ch = C_Peek(parser)) != '\n' && ch != EOF) - (void)C_Get(parser); - } - else { - while ((ch = C_Parse4(parser)) != '\n' && ch != EOF) { - if (ch == '\\') - (void)C_Get(parser); - else if (ch == '"' || ch == '\'') { - int c; - - while ((c = C_Peek(parser)) != '\n' && c != EOF) { - (void)C_Get(parser); - if (c == '\\') - (void)C_Get(parser); - else if (c == ch) - break; - } - } - } - } - parser->end = parser->offset; - C_Commit(parser); - parser->quark = NULLQUARK; - break; - default: - return (ch); - } - } - /*NOTREACHED*/ -} - -static int -C_Parse2Fail(C_Parser *parser) -{ - int ch; - - parser->quark = Qerror; - while ((isalnum(ch = C_Peek(parser)) || ch == '_') && ch != EOF) - (void)C_Get(parser); - - parser->end = parser->offset; - C_Commit(parser); - parser->start = parser->end; - - return (C_Parse3(parser)); -} - -/* numbers */ -static int -C_Parse2(C_Parser *parser) -{ - int ch = C_Parse3(parser); - int L = 0; - Bool dot = False, E = False, U = False, F = False, sign = False, - octal = False, real = False, hexa = False, first = True, did_get = False; - - for (;;) { - switch (ch) { - case '+': - case '-': - if (!E || sign || hexa || octal) - goto check_first; - sign = True; - break; - case '.': - if (dot || E || L || U || F || hexa) - return (C_Parse2Fail(parser)); - if (first && !isdigit(C_Peek(parser))) - return ('.'); - octal = hexa = False; - dot = real = True; - break; - case 'e': - case 'E': - if (!hexa && E) - return (C_Parse2Fail(parser)); - else if (!hexa) - E = real = True; - break; - case 'a': case 'A': case 'b': case 'B': case 'c': case 'C': - case 'd': case 'D': - if (dot || E || !hexa) - return (C_Parse2Fail(parser)); - break; - case 'l': case 'L': - if (L > 1) - return (C_Parse2Fail(parser)); - ++L; - break; - case 'f': case 'F': - if (F) - return (C_Parse2Fail(parser)); - if (!hexa) - F = real = True; - break; - case 'u': case 'U': - if (U || real) - return (C_Parse2Fail(parser)); - U = True; - break; - case 'x': case 'X': - if (L || U || E || sign || hexa || !octal) - return (C_Parse2Fail(parser)); - octal = False; - hexa = True; - (void)C_Get(parser); - did_get = True; - if (!isdigit(C_Peek(parser))) { - switch (tolower(C_Peek(parser))) { - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': - break; - default: - return (C_Parse2Fail(parser)); - } - } - break; - case '0': - if (L || U) - return (C_Parse2Fail(parser)); - if (first) - octal = True; - break; - case '1': case '2': case '3': case '4': case '5': case '6': - case '7': - if (L || U) - return (C_Parse2Fail(parser)); - break; - case '8': case '9': - if (L || U || octal) - return (C_Parse2Fail(parser)); - break; - default: - check_first: - if (isalpha(ch) || ch == '_') - return (C_Parse2Fail(parser)); - if (!first) { - parser->end = parser->offset; - if (octal && parser->end - parser->start > (1 + L + U)) - parser->quark = Qoctal; - else if (hexa) - parser->quark = Qhexa; - else if (real || E) - parser->quark = Qfloat; - else - parser->quark = Qinteger; - C_Commit(parser); - parser->start = parser->end; - } - return (first ? ch : C_Parse3(parser)); - } - if (first) { - parser->end = parser->offset - 1; - C_Commit(parser); - parser->start = parser->end; - first = False; - } - else { - if (did_get == False) - (void)C_Get(parser); - did_get = False; - } - ch = C_Peek(parser); - } - /*NOTREACHED*/ -} - -/* punctuations */ -static int -C_Parse1(C_Parser *parser) -{ - int ch; - - for (;;) { - switch (ch = C_Parse2(parser)) { - case '/': case '*': case '+': case '-': case ':': case ';': - case '=': case '(': case ')': case '<': case '>': case ',': - case '&': case '.': case '!': case '{': case '}': case '[': - case ']': case '%': case '|': case '^': case '~': case '?': - if (parser->quark != Qpunctuation) { - parser->end = parser->offset - 1; - C_Commit(parser); - parser->quark = Qpunctuation; - parser->start = parser->end; - } - return (ch); - case EOF: - parser->end = parser->offset - 1; - C_Commit(parser); - return (EOF); - default: - parser->end = parser->offset - 1; - C_Commit(parser); - if (ch == '\n') - parser->quark = NULLQUARK; - else if (ch == ' ' || ch == '\t') - parser->quark = parser->quark == NULLQUARK ? NULLQUARK : Qdefault; - else - parser->quark = Qerror; - parser->start = parser->end; - return (ch); - } - } -} - -void -C_ModeInit(void) -{ - static int initialized; - - if (initialized) - return; - - Qkeyword = XrmPermStringToQuark("keyword"); - Qpreprocessor = XrmPermStringToQuark("preprocessor"); - Qcomment = XrmPermStringToQuark("comment"); - Qstring = XrmPermStringToQuark("string"); - Qconstant = XrmPermStringToQuark("constant"); - Qoctal = XrmPermStringToQuark("octal"); - Qhexa = XrmPermStringToQuark("hexa"); - Qinteger = XrmPermStringToQuark("integer"); - Qfloat = XrmPermStringToQuark("float"); - Qpunctuation = XrmPermStringToQuark("punctuation"); - Qdefault = XrmPermStringToQuark("default"); - Qerror = XrmPermStringToQuark("error"); - - initialized = True; -} Index: xc/programs/xedit/commands.c diff -u xc/programs/xedit/commands.c:1.25 xc/programs/xedit/commands.c:1.29 --- xc/programs/xedit/commands.c:1.25 Wed Sep 5 13:43:25 2001 +++ xc/programs/xedit/commands.c Tue Nov 5 01:57:05 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/commands.c,v 1.25 2001/09/05 17:43:25 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/commands.c,v 1.29 2002/11/05 06:57:05 paulo Exp $ */ #include <X11/Xfuncs.h> #include <X11/Xos.h> @@ -126,7 +126,9 @@ } } if(!source_changed) { +#ifndef __UNIXOS2__ XeditLispCleanUp(); +#endif exit(0); } @@ -332,8 +334,9 @@ item->flags = EXISTS_BIT; } else { - if (!item) - item = flist.itens[0]; + item = flist.itens[0]; + XtRemoveCallback(scratch, XtNcallback, SourceChanged, + (XtPointer)item); item->source = scratch = XtVaCreateWidget("textSource", international ? multiSrcObjectClass : asciiSrcObjectClass, @@ -618,13 +621,16 @@ XawTextReplace(filenamewindow, 0, end, &block); XawTextSetInsertionPoint(filenamewindow, end); XtSetKeyboardFocus(topwindow, filenamewindow); + line_edit = False; } /*ARGSUSED*/ void LoadFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (ReallyDoLoad(GetString(filenamewindow), ResolveName(NULL))) { + if (line_edit) + LineEdit(textwindow); + else if (ReallyDoLoad(GetString(filenamewindow), ResolveName(NULL))) { SwitchDirWindow(False); XtSetKeyboardFocus(topwindow, textwindow); } @@ -637,7 +643,6 @@ Arg args[1]; xedit_flist_item *item; - Feep(); XtSetKeyboardFocus(topwindow, textwindow); item = FindTextSource(XawTextGetSource(textwindow), NULL); @@ -651,6 +656,8 @@ if (XtIsManaged(XtParent(dirwindow))) SwitchDirWindow(False); + + line_edit = False; } static int @@ -681,6 +688,10 @@ Feep(); return; } + else if (line_edit) { + Feep(); + line_edit = 0; + } { XawTextPosition pos = XawTextGetInsertionPoint(w); @@ -815,8 +826,10 @@ strncpy(pptr, ent->d_name, bytes); pptr[bytes] = '\0'; - if (stat(path, &st) != 0) /* Probably a broken symbolic link */ - is_dir = False; + if (stat(path, &st) != 0) + /* Should check errno, may be a broken symbolic link + * a directory with r-- permission, etc */ + continue; else if (first || show_matches != SM_NEVER) { is_dir = S_ISDIR(st.st_mode); } @@ -983,13 +996,14 @@ d_namlen = strlen(ent->d_name); strncpy(pptr, ent->d_name, bytes); pptr[bytes] = '\0'; - if (stat(path, &st) == 0) { - isdir = S_ISDIR(st.st_mode); - } + if (stat(path, &st) != 0) + /* Should check errno, may be a broken symbolic link + * a directory with r-- permission, etc */ + continue; else - isdir = False; /* Probably a broken symbolic link */ + isdir = S_ISDIR(st.st_mode); - entries = (char **)XtRealloc((char*)entries, sizeof(char**) + entries = (char **)XtRealloc((char*)entries, sizeof(char*) * (n_entries + 1)); if (isdir) { entries[n_entries] = XtMalloc(d_namlen + 2); @@ -1006,6 +1020,12 @@ XtSetArg(args[1], XtNnumberStrings, &n_list); XtGetValues(dirwindow, args, 2); + if (n_entries == 0) { + entries = (char**)XtMalloc(sizeof(char*) * 2); + /* Directory has read but not execute permission? */ + entries[n_entries++] = XtNewString("./"); + entries[n_entries++] = XtNewString("../"); + } qsort(entries, n_entries, sizeof(char*), compar); XtSetArg(args[0], XtNlist, entries); XtSetArg(args[1], XtNnumberStrings, n_entries); @@ -1018,7 +1038,10 @@ } *pptr = '\0'; - label = ResolveName(path); + if ((label = ResolveName(path)) == NULL) { + Feep(); + label = path; + } XtSetArg(args[0], XtNlabel, label); XtSetValues(dirlabel, args, 1); Index: xc/programs/xedit/hook.c diff -u xc/programs/xedit/hook.c:1.4 xc/programs/xedit/hook.c:1.10 --- xc/programs/xedit/hook.c:1.4 Wed Jul 25 11:05:20 2001 +++ xc/programs/xedit/hook.c Wed Jan 8 22:36:29 2003 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/hook.c,v 1.4 2001/07/25 15:05:20 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/hook.c,v 1.10 2003/01/09 03:36:29 paulo Exp $ */ /* * This file is intended to be used to add all the necessary hooks to xedit @@ -38,6 +38,7 @@ */ #include "xedit.h" +#include "re.h" #include <stdlib.h> #include <string.h> #include <ctype.h> @@ -51,6 +52,45 @@ struct _ReplaceList *next; } ReplaceList; +typedef enum { + SubstituteDisabled, + SubstituteAsk, + SubstituteNo, + SubstituteYes +} SubstitutionState; + +typedef struct _EditInfo { + /* Xedit regex data */ + re_cod regex; + re_mat mats[10]; + + /* Last command entered */ + char command[128]; + + /* String and flags used to compile regex */ + char pattern[64]; + int flags; + + /* Substitution buffer */ + char subst[64]; + int soff, slen, sref; + + /* For interactive substitution */ + int callback; + Widget widget; + char *text_line; + SubstitutionState state; + XawTextPosition from, to, start, end, first, last; + + /* Use if need to allocate a buffer to pass the entire line to reexec */ + char *line; + long lsize; + + /* Buffer to prepare replacement, if needs to expand backreferences */ + char *buffer; + long bsize; +} EditInfo; + /* * Prototypes */ @@ -61,11 +101,16 @@ static void AutoReplace(Widget, XEvent*); static void AutoReplaceCallback(Widget, XtPointer, XtPointer); +static void SubstituteHook(Widget w, String action, XEvent *event); +static void SubstituteCallback(Widget, XtPointer, XtPointer); + /* * Initialization */ #define STRTBLSZ 11 static ReplaceList *replace_list[STRTBLSZ]; +static EditInfo einfo; +extern Widget scratch; /* * Implementation @@ -76,8 +121,8 @@ static Bool first_time = True; if (first_time) { - if (StartAutoReplace()) - (void)XtAppAddActionHook(app, ActionHook, NULL); + StartAutoReplace(); + (void)XtAppAddActionHook(app, ActionHook, NULL); first_time = False; return (True); @@ -91,6 +136,7 @@ String *params, Cardinal *num_params) { AutoReplaceHook(w, action, event); + SubstituteHook(w, action, event); } /*** auto replace ***/ @@ -100,6 +146,7 @@ Cardinal length; XawTextPosition left, right; Bool replace; + Bool enabled; } auto_replace; static void @@ -107,7 +154,7 @@ { static Bool multiply; - if (w != textwindow) + if (w != textwindow || !auto_replace.enabled) return; if (auto_replace.widget != textwindow) { @@ -194,7 +241,7 @@ XtFree(left); XtFree(right); - return (count > 0); + return (auto_replace.enabled = count > 0); } static char * @@ -333,4 +380,855 @@ if (block.ptr != buffer) XtFree(block.ptr); +} + +/*ARGUSED*/ +void +LineEditAction(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XawTextBlock block; + + if (international) + /* XXX FIXME */ + return; + + block.firstPos = 0; + block.format = FMT8BIT; + block.ptr = einfo.command; + block.length = strlen(einfo.command); + + XawTextReplace(filenamewindow, 0, + XawTextLastPosition(filenamewindow), &block); + XtSetKeyboardFocus(topwindow, filenamewindow); + line_edit = True; +} + +#define LSCAN(from, count, include) \ + XawTextSourceScan(source, from, XawstEOL, XawsdLeft, count, include) +#define RSCAN(from, count, include) \ + XawTextSourceScan(source, from, XawstEOL, XawsdRight, count, include) +void +LineEdit(Widget w) +{ + /* Global usage variables */ + XawTextPosition from, to, first, last, position, length, redisplay; + int replace, compile, ecode, nth, flags, count, etype; + char *command, *line, buffer[128]; + XawTextBlock block; + Widget source; + XawTextScanDirection direction; + xedit_flist_item *item; + + /* Variables used while parsing command */ + int state, action, offset, icase, confirm; + long lfrom, lto, lfinc, ltinc, number; + char *ptr, *pstart, *pend, *rstart, *rend, *tmp; + + /* Variables used in the search/replace loop */ + int len; + XawTextPosition adjust = 0; + + command = GetString(filenamewindow); + length = strlen(command); + if (length >= sizeof(einfo.command)) { + Feep(); + return; + } + + item = FindTextSource(XawTextGetSource(w), NULL); + source = item->source; + position = XawTextGetInsertionPoint(w); + first = XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True); + last = XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True); + compile = redisplay = nth = count = confirm = 0; + direction = XawsdRight; + flags = RE_STARTEND; + + /* Error types */ +#define T_NONE 0 +#define T_OPTION 1 +#define T_ICASE 2 +#define T_COMMAND 3 +#define T_REPLACE 4 +#define T_SEARCH 5 +#define T_BACKSLASH 6 +#define T_DIRECTION 7 +#define T_COMMA 8 +#define T_OFFSET 9 +#define T_INCREMENT 10 +#define T_NUMBER 11 +#define T_UNFINISHED 12 +#define T_RANGE 13 +#define T_BACKREF 14 +#define T_EDIT 15 + etype = T_NONE; + +#define FAIL(code) { etype = code; goto fail; } + + /* Value for the line value, anything else is the line number */ +#define L_FIRST -1 +#define L_CURRENT -2 +#define L_LAST -3 + lfrom = L_FIRST; + lto = L_LAST; + + /* Parsing states */ +#define E_FINC 0 +#define E_FROM 1 +#define E_COMMA 2 +#define E_TINC 3 +#define E_TO 4 +#define E_COMMAND 5 +#define E_REGEX 6 +#define E_SUBST 7 +#define E_OPTIONS 8 + state = E_FROM; /* Beginning interpretation */ + + /* Known commands */ +#define A_SEARCH 0 +#define A_REPLACE 1 + action = A_SEARCH; + + /* Flag to replace all occurrences */ +#define O_ALL -1 + + number = 1; + lfinc = ltinc = 0; + icase = offset = 0; + pstart = pend = rstart = rend = NULL; + + if (einfo.state != SubstituteDisabled) { + if (einfo.widget != w || strcmp(einfo.command, command)) { + einfo.widget = w; + einfo.state = SubstituteAsk; + } + else { + XawTextPosition s_start, s_end; + + XawTextGetSelectionPos(w, &s_start, &s_end); + if (s_start != einfo.start || s_end != einfo.end) + einfo.state = SubstituteAsk; + confirm = replace = 1; + from = einfo.from; + to = einfo.to; + first = einfo.first; + last = einfo.last; + goto confirm_label; + } + } + + /* Remember last command */ + strcpy(einfo.command, command); + + /* Loop parsing command */ + for (ptr = einfo.command; *ptr;) { + switch (*ptr++) { + case 'c': + if (state != E_OPTIONS && + state != E_COMMAND && + state != E_REGEX) + FAIL(T_OPTION) + confirm = 1; + break; + case 'g': + if (state != E_OPTIONS && + state != E_COMMAND && + state != E_REGEX) + FAIL(T_OPTION) + offset = O_ALL; + break; + case 'i': + if (state != E_OPTIONS && + state != E_COMMAND && + state != E_REGEX && + state != E_FROM) + FAIL(T_ICASE) + icase = 1; + break; + case 's': + if (state == E_FROM) + lfrom = lto = L_CURRENT; + else if (state == E_COMMA) { + lto = L_CURRENT; + ltinc = lfinc; + } + else if (state == E_TO) + lto = L_LAST; + else if (state == E_FINC) { + ltinc = lfinc; + lto = L_CURRENT; + } + else if (state != E_COMMAND && state != E_TINC) + FAIL(T_COMMAND) + action = A_REPLACE; + state = E_REGEX; + break; + case '?': + if (action == A_REPLACE) + FAIL(T_REPLACE) + case '/': + if (state == E_TINC) + state = action == A_REPLACE ? E_REGEX : E_FROM; + else if (state == E_COMMA || state == E_FINC) { + lto = L_LAST; + state = E_FROM; + } + else if (state == E_TO) { + if (ltinc == 0) + lto = L_LAST; + state = E_FROM; + } + else if (state == E_COMMAND) + state = E_FROM; + else if (state != E_REGEX && + state != E_SUBST && + state != E_FROM) + FAIL(T_SEARCH) + if (state != E_SUBST) + direction = ptr[-1] == '/' ? XawsdRight : XawsdLeft; + for (tmp = ptr; *tmp; tmp++) { + if (*tmp == '\\') { + if (*++tmp == '\0') + FAIL(T_BACKSLASH) + } + else if (*tmp == ptr[-1]) + break; + } + if (state == E_REGEX) { + if (*tmp != ptr[-1]) + FAIL(T_DIRECTION) + pstart = ptr; + pend = ptr = tmp; + state = E_SUBST; + } + else if (state == E_FROM) { + pstart = ptr; + pend = ptr = tmp; + state = E_OPTIONS; + if (*ptr) + ++ptr; + } + else { /* E_SUBST */ + rstart = ptr; + rend = tmp; + state = E_OPTIONS; + ptr = tmp; + if (*ptr) + ++ptr; + } + break; + case ',': + if (state == E_FROM) + lfrom = L_FIRST; + else if (state == E_FINC) + lfrom = L_CURRENT; + else if (state != E_COMMA) + FAIL(T_COMMA) + state = E_TO; + break; + case '%': + if (state == E_FROM) { + lfrom = L_FIRST; + lto = L_LAST; + state = E_COMMAND; + } + else + FAIL(T_OFFSET) + break; + case '$': + if (state != E_TO) + FAIL(T_OFFSET) + lto = L_LAST; + state = E_COMMAND; + break; + case '.': + if (state == E_FROM) { + lfrom = L_CURRENT; + state = E_COMMA; + } + else if (state == E_TO) { + lto = L_CURRENT; + state = E_COMMAND; + } + else + FAIL(T_OFFSET) + break; + case '+': + if (state == E_FROM) { + lfinc = 1; + lfrom = L_CURRENT; + state = E_FINC; + } + else if (state == E_TO) { + ltinc = 1; + lto = L_CURRENT; + state = E_TINC; + } + else + FAIL(T_INCREMENT) + break; + case '-': case '^': + if (state == E_FROM) { + lfinc = -1; + lfrom = L_CURRENT; + state = E_FINC; + } + else if (state == E_TO) { + ltinc = -1; + lto = L_CURRENT; + state = E_TINC; + } + else + FAIL(T_INCREMENT) + number = -1; + break; + case ';': + if (state != E_FROM) + FAIL(T_OFFSET) + lfrom = L_CURRENT; + lto = L_LAST; + state = E_COMMAND; + break; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + number = number * (ptr[-1] - '0'); + while (isdigit(*ptr)) + number = number * 10 + (*ptr++ - '0'); + if (state == E_FROM) { + lfrom = number; + state = E_COMMA; + } + else if (state == E_FINC) { + lfinc = number; + state = E_COMMA; + } + else if (state == E_TO) { + lto = number; + state = E_COMMAND; + } + else if (state == E_TINC) { + ltinc = number; + state = E_COMMAND; + } + else if (state == E_OPTIONS && action == A_REPLACE) + offset = number - 1; + else + FAIL(T_NUMBER) + number = 1; + break; + case '\0': + if (state == E_OPTIONS) + break; + default: + FAIL(T_UNFINISHED) + } + } + + replace = action == A_REPLACE; + + switch (lfrom) { + case L_FIRST: + from = first; + break; + case L_LAST: + from = LSCAN(last, 1, False); + break; + case L_CURRENT: + if (lfinc <= 0) + from = LSCAN(position, -lfinc + 1, False); + else { + from = RSCAN(position, lfinc + 1, False); + from = LSCAN(from, 1, False); + } + break; + default: + from = RSCAN(first, lfrom, False); + from = LSCAN(from, 1, False); + break; + } + /* Just requesting to go to the numbered line */ + if (state == E_COMMA || state == E_FINC) { + XawTextSetInsertionPoint(w, from); + return; + } + + length = pend - pstart; + if (pstart == NULL || (replace && rstart == NULL) || + length >= sizeof(einfo.pattern) - 1) + FAIL(T_UNFINISHED) + + /* Need to (re)compile regular expression pattern? */ + if ((!!(einfo.flags & RE_ICASE) ^ icase) || + strlen(einfo.pattern) < length || + strncmp(pstart, einfo.pattern, length)) { + compile = 1; + memcpy(einfo.pattern, pstart, length); + einfo.pattern[length] = '\0'; + einfo.flags = icase ? RE_ICASE : 0; + } + + /* Check range of lines to operate on */ + switch (lto) { + case L_FIRST: + to = RSCAN(first, 1, True); + break; + case L_LAST: + to = last; + break; + case L_CURRENT: + if (ltinc < 0) { + to = LSCAN(position, -ltinc + 1, True); + to = RSCAN(to, 2, True); + } + else + to = RSCAN(position, ltinc + 1, True); + break; + default: + to = RSCAN(first, lto, True); + break; + } + if (from >= to) + FAIL(T_RANGE) + + /* Set first and last position allowed to search/replace */ + first = from; + last = to; + + /* Check bounds to work on */ + if (replace) { + int i, csubst; + + /* Check number of required match results and remove/parse backslashes */ + memcpy(einfo.subst, rstart, einfo.slen = rend - rstart); + einfo.sref = 0; + einfo.soff = offset; + for (i = 0; i < einfo.slen - 1; i++) { + if (einfo.subst[i] == '\\') { + csubst = -1; + switch (einfo.subst[i + 1]) { + case '0': csubst = '\0'; break; + case 'a': csubst = '\b'; break; + case 'b': csubst = '\b'; break; + case 'f': csubst = '\f'; break; + case 'n': csubst = '\n'; break; + case 'r': csubst = '\r'; break; + case 't': csubst = '\t'; break; + case 'v': csubst = '\v'; break; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + ++i; + if (einfo.subst[i] - '0' > einfo.sref) + einfo.sref = einfo.subst[i] - '0'; + break; + default: + csubst = einfo.subst[i + 1]; + break; + } + if (csubst >= 0) { + memmove(einfo.subst + i, einfo.subst + i + 1, + einfo.slen - i); + einfo.subst[i] = csubst; + --einfo.slen; + ++i; + csubst = -1; + } + } + } + } + else if (einfo.widget != w) { + /* Just a flag for backward search */ + einfo.from = last; + einfo.widget = w; + } + + /* Compile pattern if required */ + if (compile) { + refree(&einfo.regex); + if ((ecode = recomp(&einfo.regex, einfo.pattern, einfo.flags)) != 0) + goto print; + } + + if (!replace && position >= first && position <= last) { + from = position; + /* The backwards repetition currently is only backwards when + * changing lines, so remember from where started, to also + * search in the first line. */ + if (LSCAN(from, 1, False) == from) { + if (direction == XawsdLeft) + einfo.from = from; + } + else + flags |= RE_NOTBOL; + } + to = RSCAN(from, 1, True); + + if (confirm) { + if (!replace) + FAIL(T_UNFINISHED) + einfo.widget = w; + einfo.state = SubstituteAsk; + einfo.from = from; + einfo.to = to; + einfo.first = first; + einfo.last = last; + } + else + einfo.state = SubstituteDisabled; + +confirm_label: + if (replace) { + redisplay = 1; + XawTextDisableRedisplay(w); + } + + for (;;) { + if (confirm && einfo.state != SubstituteAsk) { + /* Restore state from previous call */ + ecode = 0; + nth = einfo.soff; + /* einfo.mats should not have changed */ + if (einfo.state == SubstituteYes) { + einfo.state = SubstituteAsk; + line = einfo.text_line; + goto substitute_label; + } + else { + ++nth; + einfo.state = SubstituteAsk; + from = einfo.from = einfo.end; + goto no_substitute_label; + } + } + + /* Read or use a line of text inplace */ + position = from; + length = to - from; + XawTextSourceRead(source, position, &block, to - position); + if (block.length >= length) + line = block.ptr; + else { + if (length > einfo.lsize) { + einfo.line = XtRealloc(einfo.line, to - from); + einfo.lsize = to - from; + } + memcpy(einfo.line, block.ptr, block.length); + length = block.length; + for (position += length; position < to; position += length) { + XawTextSourceRead(source, position, &block, to - position); + memcpy(einfo.line + length, block.ptr, block.length); + length += block.length; + } + line = einfo.line; + } + + /* Execute expression */ + einfo.mats[0].rm_so = 0; + einfo.mats[0].rm_eo = to - from - !(from == to || to == last); + ecode = reexec(&einfo.regex, line, + einfo.sref + 1, &einfo.mats[0], flags); + + if (replace && einfo.mats[0].rm_so == einfo.mats[0].rm_eo) + /* Ignore empty matches */ + ecode = RE_NOMATCH; + + if (ecode == 0 && confirm && + (einfo.soff == O_ALL || nth == einfo.soff)) { + einfo.end = from + einfo.mats[0].rm_eo; + einfo.start = from + einfo.mats[0].rm_so; + XawTextSetInsertionPoint(w, einfo.end); + XawTextSetSelection(w, einfo.start, einfo.end); + + einfo.state = SubstituteAsk; + einfo.from = from; + einfo.to = to; + einfo.first = first; + einfo.last = last; + einfo.text_line = line; + break; + } + +substitute_label: + if (ecode == 0) { + from += einfo.mats[0].rm_so; + len = einfo.mats[0].rm_eo - einfo.mats[0].rm_so; + + /* Found match */ + if (replace) { + /* If not replacing all ocurrences, or if not + * at the correct offset */ + if (einfo.soff != O_ALL && nth < einfo.soff) { + from += len; + ++nth; + continue; + } + + /* Do the substitution */ + block.firstPos = 0; + block.format = FMT8BIT; + if (einfo.sref) { + /* Hard way */ + int i, ref, xlen; + + for (i = length = 0; i < einfo.slen; i++) { + if (length + 2 >= einfo.bsize) { + einfo.bsize = einfo.bsize + 1024; + einfo.buffer = XtRealloc(einfo.buffer, einfo.bsize); + } + if (einfo.subst[i] == '\\') { + ++i; + if (einfo.subst[i] >= '1' && einfo.subst[i] <= '9') { + ref = einfo.subst[i] - '0'; + xlen = einfo.mats[ref].rm_eo - + einfo.mats[ref].rm_so; + if (xlen < 0) + /* Oops, something went wrong... */ + FAIL(T_BACKREF) + if (length + xlen >= einfo.bsize) { + einfo.bsize += xlen + 1024 - (xlen % 1024); + einfo.buffer = XtRealloc(einfo.buffer, + einfo.bsize); + } + memcpy(einfo.buffer + length, + line + einfo.mats[ref].rm_so, xlen); + length += xlen; + } + else { + einfo.buffer[length++] = einfo.subst[i - 1]; + einfo.buffer[length++] = einfo.subst[i]; + } + } + else + einfo.buffer[length++] = einfo.subst[i]; + } + block.ptr = einfo.buffer; + block.length = length; + } + else { + block.ptr = einfo.subst; + block.length = length = einfo.slen; + } + adjust = length - len; + if (XawTextReplace(w, from, from + len, &block) != XawEditDone) + FAIL(T_EDIT) + last += adjust; + to += adjust; + from += length; + +no_substitute_label: + if (einfo.soff != O_ALL) { + nth = 0; + to = RSCAN(from, 1, True); + from = LSCAN(to, 1, False); + if (to == last) { + XawTextSetInsertionPoint(w, from); + break; + } + } + else + flags |= RE_NOTBOL; + } + else { + XawTextSetInsertionPoint(w, from + len); + XawTextSetSelection(w, from, from + len); + break; + } + } + else if (ecode == RE_NOMATCH) { + nth = 0; + + /* Try again in the next/previous line */ + if (direction == XawsdLeft) { + from = LSCAN(to - 1, 1 + (from != to), False); + if (einfo.from <= first) { + Feep(); + if (++count > 1) { + XawTextSetInsertionPoint(w, position); + XawTextUnsetSelection(w); + break; + } + from = LSCAN(last, 1, False); + } + to = RSCAN(from, 1, True); + /* Can use einfo.from because replace is only done forward */ + einfo.from = from; + } + else { + if (to >= last) { + Feep(); + if (replace || ++count > 1) { + XawTextSetInsertionPoint(w, position); + XawTextUnsetSelection(w); + einfo.state = SubstituteDisabled; + confirm = 0; + break; + } + to = first; + } + from = LSCAN(to + 1, 1, False); + to = RSCAN(from, 1, True); + } + + /* Reset flags now */ + flags = RE_STARTEND; + } + else + goto print; + } + + if (redisplay) + XawTextEnableRedisplay(w); + /* If replacing not interatively return to the edit window after finished */ + if (replace && !confirm) { + Arg args[1]; + + XtSetKeyboardFocus(topwindow, textwindow); + if (item->source != scratch) + XtSetArg(args[0], XtNstring, item->name); + else + XtSetArg(args[0], XtNstring, NULL); + XtSetValues(filenamewindow, args, 1); + } + return; + +print: + if (redisplay) + XawTextEnableRedisplay(w); + + strcpy(buffer, "Regex error: "); + length = 13; + reerror(ecode, &einfo.regex, + buffer + length, sizeof(buffer) - length - 2); + strcat(buffer, "\n"); + XeditPrintf(buffer); + refree(&einfo.regex); + einfo.state = SubstituteDisabled; + Feep(); + return; + + +fail: + if (etype != T_NONE) { + switch (etype) { + case T_OPTION: + ptr = "Option needs a command"; + break; + case T_ICASE: + ptr = "Icase needs an command defined or none for search"; + break; + case T_COMMAND: + ptr = "Command incorrectly specified"; + break; + case T_REPLACE: + ptr = "Can only search backwards"; + break; + case T_SEARCH: + ptr = "Badly placed search/replace specifier"; + break; + case T_BACKSLASH: + ptr = "A single backslash cannot be the last command character"; + break; + case T_DIRECTION: + ptr = "Regular expression must be separeted by / or ? not both"; + break; + case T_COMMA: + ptr = "Badly placed comma"; + break; + case T_OFFSET: + ptr = "Badly placed line offset specifier"; + break; + case T_INCREMENT: + ptr = "Badly placed line offset increment specifier"; + break; + case T_NUMBER: + ptr = "Numeric argument not expected"; + break; + case T_UNFINISHED: + ptr = "Unfinished command"; + break; + case T_RANGE: + ptr = "Bad line range"; + break; + case T_BACKREF: + /* This may be an internal re error, but most likely the + * user asked for something like "s/re0(re1)re2/\2/" */ + ptr = "Bad backreference"; + break; + case T_EDIT: + ptr = "Failed to replace text"; + break; + default: + ptr = "Unknown error"; + break; + } + XmuSnprintf(buffer, sizeof(buffer), "Error: %s.\n", ptr); + XeditPrintf(buffer); + } + if (redisplay) + XawTextEnableRedisplay(w); + einfo.state = SubstituteDisabled; + Feep(); +} + +static void +SubstituteHook(Widget w, String action, XEvent *event) +{ + if (w != filenamewindow) + return; + + if (line_edit && einfo.state == SubstituteAsk) { + if (strcmp(action, "newline") == 0 || + strcmp(action, "load-file") == 0) + einfo.state = SubstituteAsk; + else if (strcmp(action, "insert-char") == 0) { + static XComposeStatus compose = {NULL, 0}; + KeySym keysym; + char mb[sizeof(wchar_t)]; + + if (XLookupString((XKeyEvent*)event, mb, sizeof(mb), + &keysym, &compose) == 1) { + if (*mb == 'y' || *mb == 'Y') + einfo.state = SubstituteYes; + else if (*mb == 'n' || *mb == 'N') + einfo.state = SubstituteNo; + else + einfo.state = SubstituteDisabled; + + if (einfo.state != SubstituteDisabled) { + einfo.callback = 1; + XtAddCallback(filenamewindow, XtNpositionCallback, + SubstituteCallback, NULL); + } + } + } + else if (strcmp(action, "cancel-find-file") == 0) + einfo.state = SubstituteDisabled; + } + if (einfo.state == SubstituteDisabled && einfo.callback) { + einfo.callback = 0; + XtRemoveCallback(filenamewindow, XtNpositionCallback, + SubstituteCallback, NULL); + } +} + +/*ARGSUSED*/ +static void +SubstituteCallback(Widget w, XtPointer client_data, XtPointer call_data) +{ + XawTextBlock block; + + einfo.callback = 0; + XtRemoveCallback(filenamewindow, XtNpositionCallback, + SubstituteCallback, NULL); + + block.firstPos = 0; + block.format = FMT8BIT; + block.ptr = einfo.command; + block.length = strlen(einfo.command); + + XawTextReplace(filenamewindow, 0, + XawTextLastPosition(filenamewindow), &block); + + LineEdit(einfo.widget); } Index: xc/programs/xedit/ispell.c diff -u xc/programs/xedit/ispell.c:1.17 xc/programs/xedit/ispell.c:1.19 --- xc/programs/xedit/ispell.c:1.17 Mon Dec 3 16:04:40 2001 +++ xc/programs/xedit/ispell.c Sat Oct 19 16:04:20 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/ispell.c,v 1.17 2001/12/03 21:04:40 herrb Exp $ */ +/* $XFree86: xc/programs/xedit/ispell.c,v 1.19 2002/10/19 20:04:20 herrb Exp $ */ #include "xedit.h" #include <stdlib.h> @@ -1347,7 +1347,7 @@ close(ispell.ofd[1]); close(ispell.ifd[0]); close(ispell.ifd[1]); - execl("/bin/sh", "sh", "-c", command, NULL); + execl("/bin/sh", "sh", "-c", command, (void *)NULL); exit(-127); } else if (ispell.pid < 0) { Index: xc/programs/xedit/lisp.c diff -u xc/programs/xedit/lisp.c:1.3 xc/programs/xedit/lisp.c:1.20 --- xc/programs/xedit/lisp.c:1.3 Tue Sep 11 02:42:54 2001 +++ xc/programs/xedit/lisp.c Wed Dec 4 00:27:56 2002 @@ -27,64 +27,61 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp.c,v 1.3 2001/09/11 06:42:54 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp.c,v 1.20 2002/12/04 05:27:56 paulo Exp $ */ #include "xedit.h" #include "lisp/lisp.h" +#include "lisp/xedit.h" #include <unistd.h> -#include <fcntl.h> -#include <ctype.h> -#include <errno.h> #include <locale.h> -#include <signal.h> -#include <sys/wait.h> +#include <ctype.h> + +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/SimpleMenu.h> /* * Prototypes */ -static void XeditLispInitialize(void); -static void XeditRunLisp(void); -static void LispInputCallback(XtPointer, int*, XtInputId*); -static void LispErrorInputCallback(XtPointer, int*, XtInputId*); -static void XeditDoLispEval(Widget, XEvent*, String*, Cardinal*); -static int XeditCheckLispChild(void); +static void XeditDoLispEval(Widget); +static void EditModeCallback(Widget, XtPointer, XtPointer); /* * Initialization */ -static struct { - int pid; - int ifd[2]; - int ofd[2]; - int efd[2]; - XtInputId id; - XtInputId eid; - XtAppContext appcon; - Widget output; - Bool expect; - Bool running; -} lisp; - -extern XtAppContext appcon; +static int lisp_initialized; extern Widget scratch; +static Widget edit_mode_menu, edit_mode_entry, edit_mode_none; /* * Implementation */ void +XeditLispInitialize(void) +{ + setlocale(LC_NUMERIC, "C"); + lisp_initialized = 1; + LispBegin(); + LispXeditInitialize(); +} + +void +XeditLispCleanUp(void) +{ + LispEnd(); +} + +void XeditLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) { - lisp.output = messwidget; - XeditDoLispEval(w, event, params, num_params); + XeditDoLispEval(messwidget); } void XeditPrintLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (XawTextGetSource(textwindow) == scratch) { - lisp.output = textwindow; + if (XawTextGetSource(w) == scratch) { XtCallActionProc(w, "newline", event, params, *num_params); - XeditDoLispEval(w, event, params, num_params); + XeditDoLispEval(w); } else XtCallActionProc(w, "newline-and-indent", event, params, *num_params); @@ -93,52 +90,48 @@ void XeditKeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params) { - (void)XeditCheckLispChild(); - if (lisp.running) { - kill(lisp.pid, SIGINT); - lisp.running = False; - - /* redisplay */ - XtUnmapWidget(XtParent(messwidget)); - XtMapWidget(XtParent(messwidget)); - } XtCallActionProc(w, "keyboard-reset", event, params, *num_params); } +void +SetTextProperties(xedit_flist_item *item) +{ + if (lisp_initialized) { + Widget source = XawTextGetSource(textwindow); + XawTextPosition top = XawTextTopPosition(textwindow); + + if (source != item->source) + XawTextSetSource(textwindow, item->source, 0); + XeditLispSetEditMode(item, NULL); + if (source != item->source) + XawTextSetSource(textwindow, source, top); + } +} + +void +UnsetTextProperties(xedit_flist_item *item) +{ + XeditLispUnsetEditMode(item); +} + static void -XeditDoLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) +XeditDoLispEval(Widget output) { Widget src; XawTextBlock block; XawTextPosition position, end; - XtInputMask mask; - int gotchars = 0; - - XeditLispInitialize(); - - if (XtClass(w) != asciiTextWidgetClass) { - Feep(); - return; - } /* get lisp expression */ - if ((position = XawTextGetInsertionPoint(w)) == 0) { - Feep(); - return; - } - end = position; + src = XawTextGetSource(textwindow); + position = XawTextGetInsertionPoint(textwindow); --position; - - src = XawTextGetSource(w); while (position >= 0) { (void)XawTextSourceRead(src, position, &block, 1); - if (!isspace(block.ptr[0])) { - ++gotchars; + if (!isspace(block.ptr[0])) break; - } - --gotchars; --position; } + end = position + 1; if (block.ptr[0] != ')') { while (position >= 0) { @@ -146,18 +139,13 @@ if (isspace(block.ptr[0]) || block.ptr[0] == '(' || block.ptr[0] == ')' || - block.ptr[0] == '\'') + block.ptr[0] == '"' || + block.ptr[0] == '|') break; - ++gotchars; --position; } - ++position; - if (position == end || gotchars <= 0) { - Feep(); - return; - } - if (block.ptr[0] == '\'' && position > 0) - --position; + if (!isspace(block.ptr[0])) + ++position; } else { /* XXX note that embedded '(' and ')' will confuse this code */ @@ -189,208 +177,98 @@ --level; last = position; } while (level); - /* check for quoted expression */ - if (position) { + /* check for extra characters */ + while (position > 0) { (void)XawTextSourceRead(src, position - 1, &block, 1); - if (block.ptr[0] == '\'') - --position; + if (block.length != 1 || + isspace(block.ptr[0]) || + block.ptr[0] == ')' || + block.ptr[0] == '"' || + block.ptr[0] == '|') + break; + --position; } } - - while (position < end) { - (void)XawTextSourceRead(src, position, &block, end - position); - write(lisp.ofd[1], block.ptr, block.length); - position += block.length; - } - write(lisp.ofd[1], "\n", 1); - lisp.running = lisp.expect = True; - /* block waiting for lisp process to finish, need to block or - * user won't know if it is stalled. - */ - while (lisp.running) { - mask = XtAppPending(lisp.appcon); - if (mask & XtIMAlternateInput) - XtAppProcessEvent(lisp.appcon, XtIMAlternateInput); - else if (mask & XtIMXEvent) { - /* only keyboard events allowed */ - XEvent key; - - XtAppNextEvent(lisp.appcon, &key); - if (key.type == KeyPress || - key.type == KeyRelease) { - /* XXX Ctrl<G> harcoded */ - if (key.xkey.state & ControlMask) { - char buffer[2]; - - XLookupString((XKeyEvent*)&key, &buffer[0], - sizeof(buffer), NULL, NULL); - if (*buffer == '\a') - XtDispatchEvent(&key); - } - } - } - if (XeditCheckLispChild()) - break; - } + if (position < 0 || position >= end) + Feep(); + else + XeditLispExecute(output, position, end); } void -XeditLispCleanUp(void) +CreateEditModePopup(Widget parent) { - if (lisp.pid) { - kill(lisp.pid, SIGTERM); - lisp.pid = 0; + int i; + Widget sme; + static char *editModes = "editModes"; + + XtVaCreateManagedWidget("modeMenuItem", smeBSBObjectClass, parent, + XtNmenuName, editModes, NULL); + edit_mode_menu = XtCreatePopupShell(editModes, simpleMenuWidgetClass, + parent, NULL, 0); + XtRealizeWidget(edit_mode_menu); + + edit_mode_none = XtCreateManagedWidget("none", smeBSBObjectClass, + edit_mode_menu, NULL, 0); + XtAddCallback(edit_mode_none, XtNcallback, EditModeCallback, NULL); + + for (i = 0; i < num_mode_infos; i++) { + sme = XtVaCreateManagedWidget("mode", smeBSBObjectClass, edit_mode_menu, + XtNlabel, mode_infos[i].desc, NULL); + XtAddCallback(sme, XtNcallback, EditModeCallback, + (XtPointer)(mode_infos + i)); + mode_infos[i].sme = sme; } } -static void -XeditLispInitialize(void) -{ - if (lisp.pid) - return; - - pipe(lisp.ifd); - pipe(lisp.ofd); - pipe(lisp.efd); - - if ((lisp.pid = fork()) == 0) { - setlocale(LC_NUMERIC, "C"); - close(0); - close(1); - close(2); - dup2(lisp.ofd[0], 0); - dup2(lisp.ifd[1], 1); - dup2(lisp.efd[1], 2); - close(lisp.ifd[0]); - close(lisp.ifd[1]); - close(lisp.ofd[0]); - close(lisp.ofd[1]); - close(lisp.efd[0]); - close(lisp.efd[1]); - XeditRunLisp(); - exit(0); - } - else if (lisp.pid < 0) { - fprintf(stderr, "Cannot fork\n"); - exit(1); - } - - lisp.appcon = XtWidgetToApplicationContext(topwindow); - lisp.id = XtAppAddInput(lisp.appcon, lisp.ifd[0], - (XtPointer)XtInputReadMask, - LispInputCallback, NULL); - fcntl(lisp.ifd[0], F_SETFL, O_NONBLOCK); - lisp.eid = XtAppAddInput(lisp.appcon, lisp.efd[0], - (XtPointer)XtInputReadMask, - LispErrorInputCallback, NULL); - fcntl(lisp.efd[0], F_SETFL, O_NONBLOCK); -} - -static void -LispInputCallback(XtPointer closure, int *source, XtInputId *id) +void +SetEditModeMenu(void) { - int len; - char str[8192]; - - len = read(lisp.ifd[0], str, sizeof(str) - 1); - if (len && len < PROTOMAXSIZE && *str == PROTOPREFFIX) { - char *res = NULL; - - str[len] = '\0'; - len = 0; - lisp.expect = 0; - - if (XeditProto(str + 1, &res) == False) { - if (res) - XeditPrintf(res); - } - else { - write(lisp.ofd[1], res, strlen(res)); - write(lisp.ofd[1], "\n", 1); - } - } - if (len > 0) { - if (lisp.output == messwidget) { - str[len] = '\0'; - XeditPrintf(str); - } - else { - XawTextBlock block; - XawTextPosition pos = XawTextGetInsertionPoint(lisp.output); - - block.firstPos = 0; - block.format = FMT8BIT; - block.length = len; - block.ptr = str; - XawTextReplace(lisp.output, pos, pos, &block); - pos += len; - XawTextSetInsertionPoint(lisp.output, pos); + int i; + Widget old_entry = edit_mode_entry, new_entry = edit_mode_none; + xedit_flist_item *item = FindTextSource(XawTextGetSource(textwindow), NULL); + + for (i = 0; i < num_mode_infos; i++) { + if (item->xldata && item->xldata->syntax && + mode_infos[i].syntax == item->xldata->syntax) { + new_entry = mode_infos[i].sme; + break; } - lisp.expect = 0; - } - /* If anything was printed, than it is not busy anymore */ - lisp.running = 0; - XeditCheckLispChild(); -} - -static void -LispErrorInputCallback(XtPointer closure, int *source, XtInputId *id) -{ - int len; - char str[1024]; - - Feep(); - len = read(lisp.efd[0], str, sizeof(str) - 1); - if (len > 0) { - str[len] = '\0'; - XeditPrintf(str); } - /* If anything was printed, than it is not busy anymore */ - lisp.running = 0; - XeditCheckLispChild(); -} - -static int -XeditCheckLispChild(void) -{ - int status; - - if (lisp.pid) { - waitpid(lisp.pid, &status, WNOHANG); - if (WIFEXITED(status) || errno == ECHILD) { - Feep(); - /* redisplay */ - XtUnmapWidget(XtParent(messwidget)); - XtMapWidget(XtParent(messwidget)); - - XeditPrintf("Warning: lisp child process exited.\n"); - lisp.pid = 0; - XtRemoveInput(lisp.id); - XtRemoveInput(lisp.eid); - close(lisp.ifd[0]); - close(lisp.ifd[1]); - close(lisp.ofd[0]); - close(lisp.ofd[1]); - close(lisp.efd[0]); - close(lisp.efd[1]); - lisp.running = lisp.expect = 0; - return (1); - } + if (old_entry != new_entry) { + if (old_entry) + XtVaSetValues(old_entry, XtNleftBitmap, None, NULL); + XtVaSetValues(new_entry, XtNleftBitmap, flist.pixmap, NULL); + edit_mode_entry = new_entry; } - - return (0); } static void -XeditRunLisp(void) +EditModeCallback(Widget w, XtPointer client_data, XtPointer call_data) { - LispMac *mac = LispBegin(0, NULL); - - LispSetPrompt(mac, NULL); - LispExecute(mac, "(require \"fun\")\n"); - LispMachine(mac); + Widget source = XawTextGetSource(textwindow); + EditModeInfo *info = (EditModeInfo*)client_data; + xedit_flist_item *item = FindTextSource(source, NULL); + + /* If no edit mode selected and selecting the plain/none mode */ + if ((info == NULL && + (item->xldata == NULL || item->xldata->syntax == NULL)) || + /* if selecting the current mode */ + (info && item && item->xldata && info->syntax && + info->syntax == item->xldata->syntax)) + return; - LispEnd(mac); + XawTextSourceClearEntities(source, + XawTextSourceScan(source, 0, XawsdLeft, + XawstAll, 1, True), + XawTextSourceScan(source, 0, XawsdRight, + XawstAll, 1, True)); + XeditLispUnsetEditMode(item); + if (info) + XeditLispSetEditMode(item, info->symbol); + else + item->properties = NULL; + UpdateTextProperties(1); } Index: xc/programs/xedit/options.c diff -u xc/programs/xedit/options.c:1.11 xc/programs/xedit/options.c:1.14 --- xc/programs/xedit/options.c:1.11 Fri Aug 31 15:00:03 2001 +++ xc/programs/xedit/options.c Sun Nov 10 18:21:56 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/options.c,v 1.11 2001/08/31 19:00:03 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/options.c,v 1.14 2002/11/10 23:21:56 paulo Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -37,35 +37,14 @@ #include <X11/Xaw/SimpleMenu.h> /* - * Types - */ -typedef struct _property_info { - Boolean automatic; - char *ext_res, *prop_res; - char **extensions; - int num_extensions; - XawTextPropertyList *properties; - void (*SetMode)(Widget); - void (*UnsetMode)(Widget); -} property_info; - -/* * Prototypes */ static void SetColumns(Widget, XEvent*, String*, Cardinal*); static void ChangeField(Widget, XEvent*, String*, Cardinal*); static void EditCallback(Widget, XtPointer, XtPointer); -static void ModeCallback(Widget, XtPointer, XtPointer); static void PopupColumnsCallback(Widget, XtPointer, XtPointer); static void CreateColumnsShell(void); static void ProcessColumnsCallback(Widget, XtPointer, XtPointer); -static void DoSetTextProperties(xedit_flist_item*, property_info*); - -/* - * externs in c-mode.c - */ -extern void C_ModeStart(Widget); -extern void C_ModeEnd(Widget); /* * Initialization @@ -73,7 +52,7 @@ extern Widget texts[3]; static Widget edit_popup, wrap_popup, justify_popup, scroll_popup, - columns_shell, left_text, right_text, mode_popup; + columns_shell, left_text, right_text; static XFontStruct *fonts[3]; static Pixel foregrounds[3], backgrounds[3]; @@ -83,32 +62,6 @@ {"change-field", ChangeField}, }; -#define C_MODE 0 -static property_info property_list[] = { - { - /* C */ - False, /* automatic */ - NULL, /* ext_res */ - NULL, /* prop_res */ - NULL, /* extensions */ - 0, /* num_extensions */ - NULL, /* properties */ - C_ModeStart, /* SetMode */ - C_ModeEnd /* UnsetMode */ - }, -}; - -#define Offset(field) XtOffsetOf(struct _property_info, field) -static XtResource C_resources[] = { - {"auto", "Auto", XtRBoolean, sizeof(Boolean), - Offset(automatic), XtRImmediate, (XtPointer)True}, - {"extensions", "Extensions", XtRString, sizeof(char*), - Offset(ext_res), XtRString, "c,h,cc,C"}, - {"properties", "Properties", XtRString, sizeof(char*), - Offset(prop_res), XtRString, "error?background=black&foreground=white"}, -}; -#undef Offset - #define WRAP_NEVER 1 #define WRAP_LINE 2 #define WRAP_WORD 3 @@ -122,7 +75,7 @@ static Widget autoFill, wrapNever, wrapLine, wrapWord, justifyLeft, justifyRight, justifyCenter, justifyFull, - breakColumns, scrollVert, scrollHoriz, modeNone, modeC; + breakColumns, scrollVert, scrollHoriz; void CreateEditPopup(void) @@ -191,42 +144,8 @@ scrollHoriz = XtCreateManagedWidget("horizontal", smeBSBObjectClass, scroll_popup, NULL, 0); XtAddCallback(scrollHoriz, XtNcallback, EditCallback, (XtPointer)SCROLL_HORIZ); - - if (international == False) { - char *list, *str; - - mode_popup = XtCreatePopupShell("editModes", simpleMenuWidgetClass, - edit_popup, NULL, 0); - XtRealizeWidget(mode_popup); - - XtSetArg(args[0], XtNmenuName, "editModes"); - XtCreateManagedWidget("modeMenuItem", smeBSBObjectClass, edit_popup, args, 1); - - modeNone = XtCreateManagedWidget("none", smeBSBObjectClass, - mode_popup, NULL, 0); - XtAddCallback(modeNone, XtNcallback, ModeCallback, (XtPointer)NULL); - modeC = XtCreateManagedWidget("C", smeBSBObjectClass, - mode_popup, NULL, 0); - XtGetApplicationResources(modeC, (XtPointer)&property_list[C_MODE], - C_resources, XtNumber(C_resources), NULL, 0); - property_list[C_MODE].properties = - XawTextSinkConvertPropertyList("C", property_list[C_MODE].prop_res, - topwindow->core.screen, - topwindow->core.colormap, - topwindow->core.depth); - list = XtNewString(property_list[C_MODE].ext_res); - for (str = strtok(list, " \t,"); str; str = strtok(NULL, " \t,")) { - property_list[C_MODE].extensions = - (char**)XtRealloc((XtPointer)property_list[C_MODE].extensions, - (property_list[C_MODE].num_extensions + 1) * - sizeof(char*)); - property_list[C_MODE].extensions - [property_list[C_MODE].num_extensions++] = XtNewString(str); - } - XtFree(list); - XtAddCallback(modeC, XtNcallback, ModeCallback, (XtPointer)&property_list[C_MODE]); - } + CreateEditModePopup(edit_popup); } void @@ -239,7 +158,6 @@ XawTextJustifyMode justify; XawTextScrollMode vscroll, hscroll; short left, right; - XawTextPropertyList *prop; num_args = 0; XtSetArg(args[num_args], XtNwrap, &wrap_mode); ++num_args; @@ -251,11 +169,6 @@ XtSetArg(args[num_args], XtNscrollHorizontal, &hscroll); ++num_args; XtGetValues(textwindow, args, num_args); - if (international == False) { - XtSetArg(args[0], XawNtextProperties, &prop); - XtGetValues(XawTextGetSink(textwindow), args, 1); - } - if (flist.pixmap) { XtSetArg(args[0], XtNleftBitmap, None); XtSetArg(args[1], XtNleftBitmap, flist.pixmap); @@ -314,17 +227,6 @@ XtSetValues(scrollHoriz, &args[0], 1); else XtSetValues(scrollHoriz, &args[1], 1); - - if (international == False) { - if (prop == NULL) { - XtSetValues(modeNone, &args[1], 1); - XtSetValues(modeC, &args[0], 1); - } - else if (prop == property_list[C_MODE].properties) { - XtSetValues(modeNone, &args[0], 1); - XtSetValues(modeC, &args[1], 1); - } - } } if (!auto_fill) { XtSetSensitive(wrapNever, True); @@ -348,6 +250,8 @@ XtSetSensitive(justifyFull, left < right); XtSetSensitive(breakColumns, True); } + + SetEditModeMenu(); } /*ARGSUSED*/ @@ -563,46 +467,9 @@ focus == left_text ? right_text : left_text); } -/*ARGSUSED*/ -static void -ModeCallback(Widget sme, XtPointer client_data, XtPointer call_data) -{ - DoSetTextProperties(FindTextSource(XawTextGetSource(textwindow), NULL), - (property_info*)client_data); -} - void -SetTextProperties(xedit_flist_item *item, Bool force) +UpdateTextProperties(int force) { - int i, j; - char *ext = strrchr(item->name, '.'); - property_info *info = NULL; - - if (!ext || !*ext) { - DoSetTextProperties(item, NULL); - return; - } - - ++ext; - - for (i = 0; i < sizeof(property_list) / sizeof(property_list[0]); i++) { - info = &property_list[i]; - for (j = 0; j < info->num_extensions; j++) - if (strcmp(info->extensions[j], ext) == 0) - break; - if (j < info->num_extensions) - break; - } - - if (i >= sizeof(property_list) / sizeof(property_list[0]) || - (!force && info->automatic == False)) - info = NULL; - DoSetTextProperties(item, info); -} - -void -UpdateTextProperties(void) -{ Arg args[4]; Cardinal num_args; xedit_flist_item *item; @@ -630,7 +497,7 @@ XtSetArg(args[0], XawNtextProperties, &prop); XtGetValues(sink, args, 1); - if (item == NULL || prop == item->properties) + if (item == NULL || (!force && prop == item->properties)) continue; XtSetArg(args[0], XawNtextProperties, item->properties); @@ -642,49 +509,16 @@ } XtSetValues(sink, args, num_args); + if (text == textwindow) { + XtSetArg(args[0], XtNdisplayCaret, False); + XtSetValues(text, args, 1); + } _XawTextBuildLineTable((TextWidget)text, XawTextTopPosition(text), True); XawTextDisplay(text); + if (text == textwindow) { + XtSetArg(args[0], XtNdisplayCaret, True); + XtSetValues(text, args, 1); + } } -} - -static void -DoSetTextProperties(xedit_flist_item *item, property_info *info) -{ - XawTextPropertyList *prop; - Widget source; - Arg args[1]; - int idx, i; - - for (idx = 0; idx < 3; idx++) - if (texts[idx] == textwindow) - break; - - source = item->source; - - XtSetArg(args[0], XawNtextProperties, &prop); - XtGetValues(XawTextGetSink(texts[idx]), args, 1); - - XawTextSourceClearEntities(source, 0, - XawTextSourceScan(source, 0, XawstAll, - XawsdRight, 1, True)); - - if (prop) { - for (i = 0; i < sizeof(property_list) / sizeof(property_list[0]); i++) - if (property_list[i].properties == prop) { - (property_list[i].UnsetMode)(source); - break; - } - } - - item->properties = info ? info->properties : NULL; - - XtSetArg(args[0], XawNtextProperties, item->properties); - XtSetValues(XawTextGetSink(textwindow), args, 1); - if (info) - (info->SetMode)(source); - XtSetArg(args[0], XawNtextProperties, prop); - XtSetValues(XawTextGetSink(textwindow), args, 1); - - UpdateTextProperties(); } Index: xc/programs/xedit/proto.c diff -u xc/programs/xedit/proto.c:1.4 xc/programs/xedit/proto.c:removed --- xc/programs/xedit/proto.c:1.4 Sat Oct 27 23:34:28 2001 +++ xc/programs/xedit/proto.c Thu Feb 27 12:34:55 2003 @@ -1,1051 +0,0 @@ -/* $XFree86: xc/programs/xedit/proto.c,v 1.4 2001/10/28 03:34:28 tsi Exp $ */ - -#include "xedit.h" -#include <stdlib.h> -#include <ctype.h> - -#define BUFFERFMT "\"<#0x%lx-BUFFER>\"" - -/* - * Types - */ -typedef struct _XeditReqTrans XeditReqTrans; -typedef struct _XeditReqArgs XeditReqArgs; -typedef union _XeditReqArg XeditReqArg; -typedef struct _XeditReqInfo XeditReqInfo; -typedef Bool (*XeditReqFun)(XeditReqInfo*, XeditReqArgs*, char**); - -struct _XeditReqTrans { - char *req; - XeditReqFun fun; - char *args_desc; -}; - -union _XeditReqArg { - long integer; - char *string; - xedit_flist_item *item; -}; - -struct _XeditReqArgs { - XeditReqArg *args; - int num_args; -}; - -struct _XeditReqInfo { - Widget text; - Widget source; - Widget sink; -}; - -/* - * Prototypes - */ -static xedit_flist_item *StringToFlistItem(char*); -static Bool PointMin(XeditReqInfo*, XeditReqArgs*, char**); -static Bool PointMax(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetPoint(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetPoint(XeditReqInfo*, XeditReqArgs*, char**); -static Bool Insert(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetForeground(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetForeground(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetBackground(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetBackground(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetFont(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetFont(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetWrapMode(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetWrapMode(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetAutoFill(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetAutoFill(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetLeftColumn(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetLeftColumn(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetRightColumn(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetRightColumn(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetJustification(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetJustification(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetVertScrollbar(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetVertScrollbar(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetHorizScrollbar(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetHorizScrollbar(XeditReqInfo*, XeditReqArgs*, char**); -static Bool CreateBuffer(XeditReqInfo*, XeditReqArgs*, char**); -static Bool RemoveBuffer(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetCurrentBuffer(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetCurrentBuffer(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetOtherBuffer(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetOtherBuffer(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetBufferName(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetBufferName(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetBufferFileName(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetBufferFileName(XeditReqInfo*, XeditReqArgs*, char**); - -/* todo */ -#if 0 -static Bool GetForegroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetForegroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetBackgroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetBackgroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); -static Bool GetFontSet(XeditReqInfo*, XeditReqArgs*, char**); -static Bool SetFontSet(XeditReqInfo*, XeditReqArgs*, char**); -#endif - -/* - * Initialization - */ -static XeditReqTrans trans[] = { -/* nil: means nothing, i.e. NULL - * (b)uffer buffer representation - * (i)nteger: number - * (s)tring: any text, enclosed in "'s - */ - - /* input = string: buffer-name - * output = string: buffer-identifier */ - {"create-buffer", CreateBuffer, "s"}, - - /* input = nil - * output = string: converter value, one of "true" and "false" */ - {"get-auto-fill", GetAutoFill}, - - /* input = nil - * output = string: background color */ - {"get-background", GetBackground}, - - /* input = string: buffer-identifier - * output = string: buffer-file-name */ - {"get-buffer-filename", GetBufferFileName, "b"}, - - /* input = string: buffer-identifier - * output = string: buffer-name */ - {"get-buffer-name", GetBufferName, "b"}, - - /* input = nil - * output = string: buffer-identifier */ - {"get-current-buffer", GetCurrentBuffer}, - - /* input = nil - * output = string: font name */ - {"get-font", GetFont}, - - /* input = nil - * output = string: foreground color */ - {"get-foreground", GetForeground}, - - /* input = nil - * output = string: one of "always" and "never" */ - {"get-horiz-scrollbar", GetHorizScrollbar}, - - /* input = nil - * output = string: one of "left", "right", "center" and "full" */ - {"get-justification", GetJustification}, - - /* input = nil - * output = integer: left colum, used only if AutoFill is true */ - {"get-left-column", GetLeftColumn}, - - /* input = nil - * output = string: buffer-identifier */ - {"get-other-buffer", GetOtherBuffer}, - - /* input = nil - * output = integer: current cursor position */ - {"get-point", GetPoint}, - - /* input = nil - * output = integer: right colum, used only if AutoFill is true */ - {"get-right-column", GetRightColumn}, - - /* input = nil - * output = string: one of "always" and "never" */ - {"get-vert-scrollbar", GetVertScrollbar}, - - /* input = nil - * output = string: converter value, one of "never", "line" and "word" */ - {"get-wrap-mode", GetWrapMode}, - - /* input = string: text to be inserted - * output = nil */ - {"insert", Insert, "s"}, - - /* input = nil - * output = integer: largest visible cursor position */ - {"point-max", PointMax}, - - /* input = nil - * output = integer: smallest visible cursor position */ - {"point-min", PointMin}, - - /* input = string: buffer-identifier - * output = nil - */ - {"remove-buffer", RemoveBuffer, "b"}, - - /* input = string: converter value, one of "true" and "false" - * output = nil */ - {"set-auto-fill", SetAutoFill, "s"}, - - /* input = string: background color - * output = nil */ - {"set-background", SetBackground, "s"}, - - /* input = string list: buffer-identifier and new buffer-name - * output = nil */ - {"set-buffer-name", SetBufferName, "bs"}, - - /* input = string list: buffer-identifier and new buffer-file-name - * output = nil */ - {"set-buffer-filename", SetBufferFileName, "bs"}, - - /* input = string: buffer-identifier - * output = nil */ - {"set-current-buffer", SetCurrentBuffer, "b"}, - - /* input = string: font name - * output = nil */ - {"set-font", SetFont, "s"}, - - /* input = string: foreground color - * output = nil */ - {"set-foreground", SetForeground, "s"}, - - /* input = string: one of "always" and "never" - * output = nil */ - {"set-horiz-scrollbar", SetHorizScrollbar, "s"}, - - /* input = string: one of "left", "right", "center" and "full" - * output = nil */ - {"set-justification", SetJustification, "s"}, - - /* input = integer: left colum, used only if AutoFill is true - * output = nil */ - {"set-left-column", SetLeftColumn, "i"}, - - /* input = string: buffer-identifier - * output = nil */ - {"set-other-buffer", SetOtherBuffer, "b"}, - - /* input = integer: cursor position - * output = nil */ - {"set-point", SetPoint, "i"}, - - /* input = integer: right colum, used only if AutoFill is true - * output = nil */ - {"set-right-column", SetRightColumn, "i"}, - - /* input = string: one of "always" and "never" - * output = nil */ - {"set-vert-scrollbar", SetVertScrollbar, "s"}, - - /* input = string: converter value, one of "never", "line" and "word" - * output = nil */ - {"set-wrap-mode", SetWrapMode, "s"}, -}; - -static char *TooFewArguments = "%s: too few arguments, near %s"; -static char *TooManyArguments = "%s: too many arguments, near %s"; -static char *ExpectingInteger = "%s: expecting integer, near %s"; -static char *ExpectingString = "%s: expecting string, near %s"; -static char *ErrorParsingString = "%s: error parsing string, near %s"; -static char *BadBuffer = "%s: bad buffer spec or buffer does not exist, %s"; -static char buffer[512]; - -/* - * Implementation - */ -static int -compar(_Xconst void *left, _Xconst void *right) -{ - return (strcmp((char*)left, ((XeditReqTrans*)right)->req)); -} - -Bool -XeditProto(char *input, char **result) -{ -#define FMT(s) fmt = s; goto proto_error - XeditReqTrans *req; - XeditReqArgs args; - XeditReqInfo info; - char fun[64], *ptr, *str, *desc, *fmt; - int i, len; - - *result = "NIL"; - - /* get function name */ - ptr = input; - while (*ptr && isspace(*ptr)) /* whitespaces */ - ++ptr; - str = ptr; - while (*ptr && !isspace(*ptr)) /* function name */ - ++ptr; - len = ptr - str; - if (len > sizeof(fun) - 1) - len = sizeof(fun) - 1; - strncpy(fun, str, len); - fun[len] = '\0'; - - /* skip whitespaces */ - while (*ptr && isspace(*ptr)) - ++ptr; - - req = bsearch(fun, trans, sizeof(trans) / sizeof(trans[0]), - sizeof(XeditReqTrans), compar); - - if (req) { - char *val; - Bool retval; - - /* parse arguments */ - args.args = NULL; - args.num_args = 0; - - desc = req->args_desc; - if (desc == NULL && *ptr) { - FMT(TooManyArguments); - } - - while (1) { - /* find next argument */ - while (*ptr && isspace(*ptr)) - ++ptr; - if (*ptr == '\0') - break; - str = ptr; - /* string argument */ - if (*desc == 's') { - unsigned char c; - - if (*ptr != '"') { - FMT(ExpectingString); - } - - val = NULL; - len = 0; - ++ptr; - while (*ptr && *ptr != '"') { - if (*ptr == '\0') { - FMT(ErrorParsingString); - } - if (*ptr == '\\') { - ++ptr; - switch (*ptr) { - case 'a': - c = '\a'; - break; - case 'f': - c = '\f'; - break; - case 'n': - c = '\n'; - break; - case 'r': - c = '\r'; - break; - case 'x': - c = 0; - for (i = 0; i < 2; i++) { - int dig = -1; - - if (isdigit(*ptr)) - dig = *ptr - '0'; - else if (*ptr >= 'a' && *ptr <= 'f') - dig = *ptr - 'a' + 10; - else if (*ptr >= 'A' && *ptr <= 'F') - dig = *ptr - 'A' + 10; - if (dig < 0) { - FMT(ErrorParsingString); - } - c = c * 16 + dig; - } - break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - c = *ptr - '0'; - for (i = 0; i < 2; i++) { - ++ptr; - if (!isdigit(*ptr) || *ptr > '7') { - FMT(ErrorParsingString); - } - c = c * 8 + (*ptr - '0'); - } - break; - case '\0': - FMT(ErrorParsingString); - default: - c = *ptr; - break; - } - } - else - c = *ptr; - if ((len % 16) == 0) - val = XtRealloc(val, len + 16); - val[len++] = c; - ++ptr; - } - ++ptr; - val[len] = '\0'; - args.args = (XeditReqArg*) - XtRealloc((XtPointer)args.args, sizeof(XeditReqArg) * - (args.num_args + 1)); - args.args[args.num_args++].string = val; - } - else if (*desc == 'i') { - char *end; - double number; - - while (*ptr && !isspace(*ptr)) - ++ptr; - number = strtod(str, &end); - if (end != ptr || (long)number != number) { - FMT(ExpectingInteger); - } - args.args = (XeditReqArg*) - XtRealloc((XtPointer)args.args, sizeof(XeditReqArg) * - (args.num_args + 1)); - args.args[args.num_args++].integer = (long)number; - } - else if (*desc == 'b') { - xedit_flist_item *item; - - while (*ptr && !isspace(*ptr)) - ++ptr; - len = ptr - str; - strncpy(buffer, ptr, sizeof(buffer)); - buffer[len] = '\0'; - - item = StringToFlistItem(buffer); - if (item == NULL) { - FMT(BadBuffer); - } - args.args = (XeditReqArg*) - XtRealloc((XtPointer)args.args, sizeof(XeditReqArg) * - (args.num_args + 1)); - args.args[args.num_args++].item = item; - } - else if (*desc == '\0') { - FMT(TooManyArguments); - } - ++desc; - } - - if (desc && *desc) { - FMT(TooFewArguments); - } - - info.text = textwindow; - info.source = XawTextGetSource(textwindow); - info.sink = XawTextGetSink(textwindow); - retval = (req->fun)(&info, &args, result); - if (req->args_desc) { - for (ptr = req->args_desc, i = 0; *ptr; ptr++, i++) { - if (*ptr == 's') - XtFree(args.args[i].string); - } - XtFree((XtPointer)args.args); - } - - return (retval); - -proto_error: - XmuSnprintf(buffer, sizeof(buffer), fmt, fun, ptr); - XeditPrintf(buffer); - *result = input; - if (req->args_desc) { - for (ptr = req->args_desc, i = 0; *ptr; ptr++, i++) { - if (*ptr == 's') - XtFree(args.args[i].string); - } - XtFree((XtPointer)args.args); - } - return (False); - } - - XmuSnprintf(buffer, sizeof(buffer), "unknown request %s", fun); - XeditPrintf(buffer); - *result = input; - - return (False); -} - -static xedit_flist_item * -StringToFlistItem(char *string) -{ - int i; - xedit_flist_item *item; - - if (sscanf(string, BUFFERFMT, (long*)(&item)) != 1) - return (NULL); - - for (i = 0; i < flist.num_itens; i++) - if (flist.itens[i] == item) - return (item); - - return (NULL); -} - -/*ARGSUSED*/ -static Bool -PointMin(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextPosition point = XawTextSourceScan(info->source, 0, - XawstAll, XawsdLeft, 1, True); - - XmuSnprintf(buffer, sizeof(buffer), "%ld", point); - *result = buffer; - - return (True); -} - -/*ARGSUSED*/ -static Bool -PointMax(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextPosition point = XawTextSourceScan(info->source, 0, - XawstAll, XawsdRight, 1, True); - - XmuSnprintf(buffer, sizeof(buffer), "%ld", point); - *result = buffer; - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetPoint(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextPosition point = XawTextGetInsertionPoint(info->text); - - XmuSnprintf(buffer, sizeof(buffer), "%ld", point); - *result = buffer; - - return (True); -} - -static Bool -SetPoint(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextPosition point = args->args[0].integer; - - XawTextSetInsertionPoint(info->text, point); - - return (True); -} - -static Bool -Insert(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextPosition point = XawTextGetInsertionPoint(info->text); - XawTextBlock block; - - block.firstPos = 0; - block.format = FMT8BIT; - block.length = strlen(args->args[0].string); - block.ptr = args->args[0].string; - XawTextReplace(info->text, point, point, &block); - XawTextSetInsertionPoint(info->text, point + block.length); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetForeground(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - Pixel pixel; - Arg arg[1]; - XrmValue from, to; - - from.size = sizeof(pixel); - from.addr = (XtPointer)&pixel; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNforeground, &pixel); - XtGetValues(info->sink, arg, 1); - XtConvertAndStore(info->sink, XtRPixel, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetForeground(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - Pixel pixel; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(pixel); - to.addr = (XtPointer)&pixel; - - XtConvertAndStore(info->sink, XtRString, &from, XtRPixel, &to); - XtSetArg(arg[0], XtNforeground, pixel); - XtSetValues(info->text, arg, 1); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetBackground(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - Pixel pixel; - Arg arg[1]; - XrmValue from, to; - - from.size = sizeof(pixel); - from.addr = (XtPointer)&pixel; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNbackground, &pixel); - XtGetValues(info->sink, arg, 1); - XtConvertAndStore(info->text, XtRPixel, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetBackground(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Pixel pixel; - Arg arg[1]; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(pixel); - to.addr = (XtPointer)&pixel; - - XtConvertAndStore(info->sink, XtRString, &from, XtRPixel, &to); - XtSetArg(arg[0], XtNbackground, pixel); - XtSetValues(info->text, arg, 1); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetFont(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - XFontStruct *font; - Arg arg[1]; - XrmValue from, to; - - from.size = sizeof(font); - from.addr = (XtPointer)&font; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNfont, &font); - XtGetValues(info->sink, arg, 1); - XtConvertAndStore(info->text, XtRFontStruct, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetFont(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XFontStruct *font; - Arg arg[1]; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(font); - to.addr = (XtPointer)&font; - - XtConvertAndStore(info->sink, XtRString, &from, XtRFontStruct, &to); - XtSetArg(arg[0], XtNfont, font); - XtSetValues(info->text, arg, 1); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetWrapMode(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - XawTextWrapMode wrap; - Arg arg[1]; - XrmValue from, to; - - from.size = sizeof(wrap); - from.addr = (XtPointer)&wrap; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNwrap, &wrap); - XtGetValues(info->text, arg, 1); - XtConvertAndStore(info->text, XtRWrapMode, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetWrapMode(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextWrapMode wrap; - Arg arg[1]; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(wrap); - to.addr = (XtPointer)&wrap; - - XtConvertAndStore(info->text, XtRString, &from, XtRWrapMode, &to); - XtSetArg(arg[0], XtNwrap, wrap); - XtSetValues(info->text, arg, 1); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetAutoFill(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - Boolean fill; - Arg arg[1]; - XrmValue from, to; - - from.size = sizeof(fill); - from.addr = (XtPointer)&fill; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNautoFill, &fill); - XtGetValues(info->text, arg, 1); - XtConvertAndStore(info->text, XtRBoolean, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetAutoFill(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Boolean fill; - Arg arg[1]; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(fill); - to.addr = (XtPointer)&fill; - - XtConvertAndStore(info->text, XtRString, &from, XtRBoolean, &to); - XtSetArg(arg[0], XtNautoFill, fill); - XtSetValues(info->text, arg, 1); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetLeftColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - short left; - - XtSetArg(arg[0], XtNleftColumn, &left); - XtGetValues(info->text, arg, 1); - XmuSnprintf(buffer, sizeof(buffer), "%d", left); - *result = buffer; - - return (True); -} - -static Bool -SetLeftColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - int left; - - left = args->args[0].integer; - XtSetArg(arg[0], XtNleftColumn, left); - XtSetValues(info->text, arg, 1); - - return (True); -} - -/*ARGSUSED*/ -static Bool -GetRightColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - short right; - - XtSetArg(arg[0], XtNrightColumn, &right); - XtGetValues(info->text, arg, 1); - XmuSnprintf(buffer, sizeof(buffer), "%d", right); - *result = buffer; - - return (True); -} - -static Bool -SetRightColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - int right; - - right = args->args[0].integer; - XtSetArg(arg[0], XtNrightColumn, right); - XtSetValues(info->text, arg, 1); - - return (True); -} - -static Bool -GetJustification(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - XawTextJustifyMode justify; - Arg arg[1]; - XrmValue from, to; - - from.size = sizeof(justify); - from.addr = (XtPointer)&justify; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNjustifyMode, &justify); - XtGetValues(info->text, arg, 1); - XtConvertAndStore(info->text, XtRJustifyMode, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetJustification(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XawTextJustifyMode justify; - Arg arg[1]; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(justify); - to.addr = (XtPointer)&justify; - - XtConvertAndStore(info->text, XtRString, &from, XtRJustifyMode, &to); - XtSetArg(arg[0], XtNjustifyMode, justify); - XtVaSetValues(info->text, arg, 1); - - return (True); -} - -static Bool -GetVertScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - Arg arg[1]; - XawTextScrollMode scroll; - XrmValue from, to; - - from.size = sizeof(scroll); - from.addr = (XtPointer)&scroll; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNscrollVertical, &scroll); - XtGetValues(info->text, arg, 1); - XtConvertAndStore(info->text, XtRScrollMode, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetVertScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - XawTextScrollMode scroll; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(scroll); - to.addr = (XtPointer)&scroll; - - XtConvertAndStore(info->text, XtRString, &from, XtRScrollMode, &to); - XtSetArg(arg[0], XtNscrollVertical, scroll); - XtSetValues(info->text, arg, 1); - - return (True); -} - -static Bool -GetHorizScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - char *str; - Arg arg[1]; - XawTextScrollMode scroll; - XrmValue from, to; - - from.size = sizeof(scroll); - from.addr = (XtPointer)&scroll; - to.size = 0; - to.addr = NULL; - - XtSetArg(arg[0], XtNscrollHorizontal, &scroll); - XtGetValues(info->text, arg, 1); - XtConvertAndStore(info->text, XtRScrollMode, &from, XtRString, &to); - str = to.addr; - XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); - *result = buffer; - - return (True); -} - -static Bool -SetHorizScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Arg arg[1]; - XawTextScrollMode scroll; - XrmValue from, to; - - from.size = strlen(args->args[0].string) + 1; - from.addr = (XtPointer)args->args[0].string; - to.size = sizeof(scroll); - to.addr = (XtPointer)&scroll; - - XtConvertAndStore(info->text, XtRString, &from, XtRScrollMode, &to); - XtSetArg(arg[0], XtNscrollHorizontal, scroll); - XtSetValues(info->text, arg, 1); - - return (True); -} - -static Bool -CreateBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - Widget source; - xedit_flist_item *item; - - source = XtVaCreateWidget("textSource", international ? - multiSrcObjectClass : asciiSrcObjectClass, - topwindow, - XtNeditType, XawtextEdit, - NULL, NULL); - - item = AddTextSource(source, args->args[0].string, NULL, 0, 0); - XmuSnprintf(buffer, sizeof(buffer), BUFFERFMT, item); - *result = buffer; - - return (True); -} - -static Bool -RemoveBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - KillTextSource(args->args[0].item); - - return (True); -} - -static Bool -GetCurrentBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - xedit_flist_item *item = flist.current; - - if (item == NULL) - /* this is probably an error */ - return (True); - - XmuSnprintf(buffer, sizeof(buffer), BUFFERFMT, item); - *result = buffer; - - return (True); -} - -static Bool -SetCurrentBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - SwitchTextSource(args->args[0].item); - - return (True); -} - -static Bool -GetOtherBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - xedit_flist_item *item = flist.other; - - if (item == NULL) - /* this is not an error */ - return (True); - - XmuSnprintf(buffer, sizeof(buffer), BUFFERFMT, item); - *result = buffer; - return (True); -} - -static Bool -SetOtherBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - flist.other = args->args[0].item; - - return (True); -} - -static Bool -GetBufferName(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - *result = args->args[0].item->name; - - return (True); -} - -static Bool -SetBufferName(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XtFree(args->args[0].item->name); - args->args[0].item->name = XtNewString(args->args[0].string); - - return (True); -} - -static Bool -GetBufferFileName(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - *result = args->args[0].item->filename; - - return (True); -} - -/* this probably should not be allowed */ -static Bool -SetBufferFileName(XeditReqInfo *info, XeditReqArgs *args, char **result) -{ - XtFree(args->args[0].item->name); - args->args[0].item->filename = XtNewString(args->args[0].string); - - return (True); -} Index: xc/programs/xedit/realpath.c diff -u xc/programs/xedit/realpath.c:1.4 xc/programs/xedit/realpath.c:1.6 --- xc/programs/xedit/realpath.c:1.4 Sat Feb 12 15:45:45 2000 +++ xc/programs/xedit/realpath.c Sat Feb 9 21:50:05 2002 @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $XFree86: xc/programs/xedit/realpath.c,v 1.4 2000/02/12 20:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/realpath.c,v 1.6 2002/02/10 02:50:05 paulo Exp $ */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94"; @@ -49,7 +49,9 @@ #include <string.h> #include <unistd.h> +#ifndef LISP #include "xedit.h" +#endif #if defined(__Lynx__) #define NO_FCHDIR Index: xc/programs/xedit/strcasecmp.c diff -u xc/programs/xedit/strcasecmp.c:1.1 xc/programs/xedit/strcasecmp.c:1.3 --- xc/programs/xedit/strcasecmp.c:1.1 Sun Jun 13 22:38:07 1999 +++ xc/programs/xedit/strcasecmp.c Sat Feb 9 21:50:05 2002 @@ -1,9 +1,11 @@ -/* $XFree86: xc/programs/xedit/strcasecmp.c,v 1.1 1999/06/14 02:38:07 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/strcasecmp.c,v 1.3 2002/02/10 02:50:05 paulo Exp $ */ #include <ctype.h> #include <sys/types.h> +#ifndef LISP #include "xedit.h" +#endif /* Just like the BSD version. It assumes that tolower() is ANSI-compliant */ Index: xc/programs/xedit/util.c diff -u xc/programs/xedit/util.c:1.18 xc/programs/xedit/util.c:1.25 --- xc/programs/xedit/util.c:1.18 Tue Sep 11 02:42:54 2001 +++ xc/programs/xedit/util.c Wed Dec 4 00:27:56 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/util.c,v 1.18 2001/09/11 06:42:54 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/util.c,v 1.25 2002/12/04 05:27:56 paulo Exp $ */ #include <stdio.h> #include <stdlib.h> /* for realpath() */ @@ -63,18 +63,18 @@ void XeditPrintf(char *str) { - XawTextBlock text; - static XawTextPosition pos = 0; + XawTextBlock text; + XawTextPosition pos = XawTextSourceScan(XawTextGetSource(messwidget), + 0, XawstAll, XawsdRight, 1, True); + + text.length = strlen(str); + text.ptr = str; + text.firstPos = 0; + text.format = FMT8BIT; - text.length = strlen(str); - text.ptr = str; - text.firstPos = 0; - text.format = FMT8BIT; + XawTextReplace(messwidget, pos, pos, &text); - XawTextReplace( messwidget, pos, pos, &text); - - pos += text.length; - XawTextSetInsertionPoint(messwidget, pos); + XawTextSetInsertionPoint(messwidget, pos + text.length); } Widget @@ -186,6 +186,7 @@ item->display_position = item->insert_position = 0; item->mode = 0; item->properties = NULL; + item->xldata = NULL; flist.itens = (xedit_flist_item**) XtRealloc((char*)flist.itens, sizeof(xedit_flist_item*) @@ -213,7 +214,7 @@ XtAddCallback(item->sme, XtNcallback, SwitchSourceCallback, (XtPointer)item); - SetTextProperties(item, False); + SetTextProperties(item); return (item); } @@ -272,7 +273,7 @@ XawTextDisableRedisplay(texts[i]); XtSetValues(texts[i], targs, tnum_args); - UpdateTextProperties(); + UpdateTextProperties(0); _XawTextShowPosition((TextWidget)texts[i]); XawTextEnableRedisplay(texts[i]); @@ -287,6 +288,7 @@ } } + UnsetTextProperties(item); XtFree(item->name); XtFree(item->filename); XtDestroyWidget(item->sme); @@ -405,7 +407,7 @@ ++num_args; XtSetValues(textwindow, args, num_args); - UpdateTextProperties(); + UpdateTextProperties(0); _XawTextShowPosition((TextWidget)textwindow); XawTextEnableRedisplay(textwindow); @@ -420,16 +422,15 @@ XtSetValues(filenamewindow, args, num_args); } +/* XXX sizeof(name) must match argument size for realpath */ +static char name[BUFSIZ]; char * ResolveName(char *filename) { - /* XXX sizeof(name) must match argument size for realpath */ - static char name[BUFSIZ]; - if (filename == NULL) filename = GetString(filenamewindow); -#ifndef __EMX__ +#ifndef __UNIXOS2__ return (realpath(filename, name)); #else return filename; @@ -582,7 +583,7 @@ wrapmodes[WindowIndex(texts[current ? idx : uidx])]); XtSetValues(texts[0], args, num_args); - UpdateTextProperties(); + UpdateTextProperties(0); } labelwindow = labels[0]; @@ -783,7 +784,7 @@ ++num_args; XtSetValues(ntext, args, num_args); - UpdateTextProperties(); + UpdateTextProperties(0); _XawTextShowPosition((TextWidget)textwindow); _XawTextShowPosition((TextWidget)ntext); @@ -878,14 +879,18 @@ } dir = ResolveName(path); - strncpy(path, dir, sizeof(path) - 2); - path[sizeof(path) - 2] = '\0'; - if (*path && path[strlen(path) - 1] != '/') - strcat(path, "/"); + if (dir != NULL) { + strncpy(path, dir, sizeof(path) - 2); + path[sizeof(path) - 2] = '\0'; + if (*path && path[strlen(path) - 1] != '/') + strcat(path, "/"); - XtSetArg(args[0], XtNlabel, ""); - XtSetValues(dirlabel, args, 1); + XtSetArg(args[0], XtNlabel, ""); + XtSetValues(dirlabel, args, 1); - SwitchDirWindow(True); - DirWindowCB(dirwindow, path, NULL); + SwitchDirWindow(True); + DirWindowCB(dirwindow, path, NULL); + } + else + Feep(); } Index: xc/programs/xedit/xedit.c diff -u xc/programs/xedit/xedit.c:1.13 xc/programs/xedit/xedit.c:1.18 --- xc/programs/xedit/xedit.c:1.13 Tue Sep 11 02:42:54 2001 +++ xc/programs/xedit/xedit.c Sun Nov 10 18:21:57 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/xedit.c,v 1.13 2001/09/11 06:42:54 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/xedit.c,v 1.18 2002/11/10 23:21:57 paulo Exp $ */ #include <X11/IntrinsicP.h> #include "xedit.h" @@ -52,10 +52,13 @@ {"xedit-focus", XeditFocus}, {"other-window", OtherWindow}, {"switch-source", SwitchSource}, -{"ispell", IspellAction}, +#ifndef __UNIXOS2__ {"lisp-eval", XeditLispEval}, {"xedit-print-lisp-eval", XeditPrintLispEval}, -{"xedit-keyboard-reset",XeditKeyboardReset} +{"xedit-keyboard-reset",XeditKeyboardReset}, +#endif +{"ispell", IspellAction}, +{"line-edit", LineEditAction} }; #define DEF_HINT_INTERVAL 300 /* in seconds, 5 minutes */ @@ -69,6 +72,7 @@ Widget scratch, hpane, vpanes[2], labels[3], texts[3], forms[3], positions[3]; Widget options_popup, dirlabel, dirwindow; Boolean international; +Boolean line_edit; XawTextWrapMode wrapmodes[3]; extern void ResetSourceChanged(xedit_flist_item*); @@ -142,6 +146,10 @@ } XtRealizeWidget(topwindow); +#ifndef __UNIXOS2__ + XeditLispInitialize(); +#endif + options_popup = XtCreatePopupShell("optionsMenu", simpleMenuWidgetClass, topwindow, NULL, 0); XtRealizeWidget(options_popup); @@ -154,6 +162,9 @@ False); (void) XSetWMProtocols (XtDisplay(topwindow), XtWindow(topwindow), &wm_delete_window, 1); + + /* This first call is just to save the default font and colors */ + UpdateTextProperties(0); if (argc > 1) { Boolean exists; Index: xc/programs/xedit/xedit.h diff -u xc/programs/xedit/xedit.h:1.13 xc/programs/xedit/xedit.h:1.18 --- xc/programs/xedit/xedit.h:1.13 Tue Sep 11 02:42:54 2001 +++ xc/programs/xedit/xedit.h Sun Nov 10 18:21:57 2002 @@ -26,7 +26,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/xedit.h,v 1.13 2001/09/11 06:42:54 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/xedit.h,v 1.18 2002/11/10 23:21:57 paulo Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> @@ -60,6 +60,8 @@ typedef enum {NO_READ, READ_OK, WRITE_OK} FileAccess; +typedef struct _XeditLispData XeditLispData; + #define CHANGED_BIT 0x01 #define EXISTS_BIT 0x02 #define WRAP_BIT 0x10 @@ -73,6 +75,7 @@ int mode; XawTextPropertyList *properties; XawTextWrapMode wrap; + XeditLispData *xldata; } xedit_flist_item; extern struct _xedit_flist { @@ -98,13 +101,12 @@ extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget; extern Widget dirlabel, dirwindow; extern Boolean international; +extern Boolean line_edit; /* externals in xedit.c */ - void Feep(void); /* externals in util.c */ - void XeditPrintf(char*); Widget MakeCommandButton(Widget, char*, XtCallbackProc); Widget MakeStringBox(Widget, String, String); @@ -125,7 +127,6 @@ void DirWindow(Widget, XEvent*, String*, Cardinal*); /* externs in commands.c */ - void DoQuit(Widget, XtPointer, XtPointer); void QuitAction(Widget, XEvent*, String*, Cardinal*); void DoSave(Widget, XtPointer, XtPointer); @@ -140,30 +141,29 @@ void SourceChanged(Widget, XtPointer, XtPointer); /* externs in ispell.c */ - void IspellAction(Widget, XEvent*, String*, Cardinal*); void IspellCallback(Widget, XtPointer, XtPointer); /* externs in options.c */ - void CreateEditPopup(void); void SetEditMenu(void); -void SetTextProperties(xedit_flist_item*, Bool); -void UpdateTextProperties(void); +void UpdateTextProperties(int); /* externs in hook.c */ Bool StartHooks(XtAppContext); +void LineEditAction(Widget, XEvent*, String*, Cardinal*); +void LineEdit(Widget); /* externs in lisp.c */ +void XeditLispInitialize(void); void XeditLispEval(Widget, XEvent*, String*, Cardinal*); void XeditPrintLispEval(Widget, XEvent*, String*, Cardinal*); void XeditKeyboardReset(Widget, XEvent*, String*, Cardinal*); void XeditLispCleanUp(void); - -/* externs in proto.c */ -#define PROTOPREFFIX '\033' -#define PROTOMAXSIZE 1024 -Bool XeditProto(char*, char**); +void SetTextProperties(xedit_flist_item*); +void UnsetTextProperties(xedit_flist_item*); +void CreateEditModePopup(Widget); +void SetEditModeMenu(void); /* externs for system replacement functions */ #ifdef NEED_STRCASECMP Index: xc/programs/xedit/xedit.man diff -u xc/programs/xedit/xedit.man:1.15 xc/programs/xedit/xedit.man:1.18 --- xc/programs/xedit/xedit.man:1.15 Sat Jan 27 13:21:11 2001 +++ xc/programs/xedit/xedit.man Sat Oct 12 12:06:48 2002 @@ -25,7 +25,7 @@ .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" -.\" $XFree86: xc/programs/xedit/xedit.man,v 1.15 2001/01/27 18:21:11 dawes Exp $ +.\" $XFree86: xc/programs/xedit/xedit.man,v 1.18 2002/10/12 16:06:48 herrb Exp $ .\" .TH XEDIT 1 __vendorversion__ .SH NAME @@ -97,6 +97,7 @@ Ctrl-y Unkill Meta-Shift Backspace Kill Previous Word Ctrl-z Scroll One Line Up Meta-z Scroll One Line Down Ctrl-_ Undo +Escape Line Edit Mode .sp In addition, the pointer may be used to cut and paste text: .ta .5i 2.0i @@ -111,6 +112,120 @@ Button 3 Up End Selection (cut) .fi .sp + +.SH LINE EDIT MODE +.I Line edit mode +enables several shortcut commands for searching and replacing text in a +xedit buffer. +.I Line edit mode +commands have the format: +.br +.nf + + [\fIline-number\fP[,\fIline-number\fP]]\fIcommand\fP[\fIparameters\fP] + +.fi +.I Line number +may be specified as: +.TP 8 +\&. +The current text line. +.TP 8 +$ +The last line of the file. +.TP 8 +number +The literal line \fInumber\fP. +.TP 8 +- or ^ +The previous line. Equivalent to \fI-1\fP. +.TP 8 +-number or ^number +The current line minus \fInumber\fP. +.TP 8 ++ +The next line. Equivalent to \fI+1\fP. +.TP 8 ++number +The current line plus \fInumber\fP. +.TP 8 +, or % +From the first to the last line. Equivalent to \fI1,$\fP. +.TP 8 +; +From the current to the last line. Equivalent to \fI.,$\fP. + +.PP +.I Command +may be specified as: +.TP 8 +s +Substitute text in the specified lines. +.TP 8 +/re/ +Search forward for the regular expression pattern \fIre\fP. +.TP 8 +?re? +Search backward for the regular expression pattern \fIre\fP. + +.PP +.I Parameters +may be specified as: +.TP 8 +/re/ +Works as a parameter to \fIi\fP or as a command. +.TP 8 +/re/text/ +Search forward for \fIre\fP and substitute by \fItext\fP. + +.PP +.I Options +may follow or be parameters, known values are: +.TP 8 +i +Case insensitive search. +.TP 8 +g +\fIGlobal\fP match when replacing text. Unless specified, only the nth, +that defaults to 1, match will be replaced. +.TP 8 +c +\fIConfirm\fP before replacing text. +.TP 8 +number +Replace only the occurrence referenced by \fInumber\fP. +.PP + +Commands accept some variations, examples: +.br +.nf + /pattern/i + i/pattern/ + i/pattern +.fi +Search forward for \fIpattern\fP. +.br +.nf + + ,sc/pattern/text + ,sc/pattern/text/ + ,s/pattern/text/c +.fi +Search the entire buffer and ask confirmation to replace \fIpattern\fP +with \fItext\fP. +.br +.nf + + ,s/pattern/text/number +.fi +Replace the match \fInumber\fP in the text line. If not specified, +defaults to the first occurrence. + +.PP +When searching for text, type <Return> to go to the next match. +When interactively replacing text, type \fIy\fP or \fIY\fP to accept the +change, and \fIn\fP or \fIN\fP to ignore it and go to the next match. + .SH COMMANDS .IP Quit 8 Quits the current editing session. If any changes have not been saved, @@ -304,7 +419,7 @@ stored in the RESOURCE_MANAGER property. .SH FILES .TP 20 -.I <XRoot>/lib/X11/app-defaults/Xedit +.I __apploaddir__/Xedit specifies required resources .SH "SEE ALSO" .IR X (__miscmansuffix__), Index: xc/programs/xedit/lisp/Imakefile diff -u xc/programs/xedit/lisp/Imakefile:1.10 xc/programs/xedit/lisp/Imakefile:1.22 --- xc/programs/xedit/lisp/Imakefile:1.10 Fri Jan 4 14:24:10 2002 +++ xc/programs/xedit/lisp/Imakefile Fri Dec 13 23:41:13 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/xedit/lisp/Imakefile,v 1.10 2002/01/04 19:24:10 paulo Exp $ +XCOMM $XFree86: xc/programs/xedit/lisp/Imakefile,v 1.22 2002/12/14 04:41:13 dawes Exp $ #include "lisp.cf" #include "lisp.rules" @@ -13,12 +13,37 @@ #define LibHeaders NO #if !HasSnprintf -SNPRINTF_DEFS = -DNEED_SNPRINTF +#ifndef UseInstalled +LinkSourceFile(snprintf.c, $(LIBSRC)/misc) #endif + SNPRINTF_SRCS = snprintf.c + SNPRINTF_OBJS = snprintf.o +#endif -#if !HasSnprintf - MISC_INCLUDES = -I$(LIBSRC)/misc +#if defined(LynxOSArchitecture) || defined(SVR3Architecture) || defined(LinuxArchitecture) +#ifndef UseInstalled +LinkSourceFile(realpath.c, $(TOP)/programs/xedit) +#endif + RP_SRCS = realpath.c + RP_OBJS = realpath.o + RP_DEFINES = -DNEED_REALPATH +#endif +#if !HasStrcasecmp +#ifndef UseInstalled +LinkSourceFile(strcasecmp.c, $(TOP)/programs/xedit) #endif + STRCCMP_SRCS = strcasecmp.c + STRCCMP_OBJS = strcasecmp.o +STRCCMP_DEFINES = -DNEED_STRCASECMP +#endif +#if !HasSetenv + SETENV_SRCS = env.c + SETENV_OBJS = env.o + SETENV_DEFINES = -DNEED_SETENV +#endif + SYS_SRCS = $(RP_SRCS) $(STRCCMP_SRCS) $(SETENV_SRCS) $(SNPRINTF_SRCS) + SYS_OBJS = $(RP_OBJS) $(STRCCMP_OBJS) $(SETENV_OBJS) $(SNPRINTF_OBJS) + SYS_DEFINES = $(RP_DEFINES) $(STRCCMP_DEFINES) $(SETENV_DEFINES) #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -28,28 +53,50 @@ SAMPSRC = lsp.c SAMPOBJ = lsp.o -SUBDIRS = modules +SUBDIRS = mp re modules -SRCS =\ +SRCS = $(SYS_SRCS) \ + bytecode.c \ core.c \ debugger.c \ format.c \ + hash.c \ helper.c \ + io.c \ lisp.c \ + math.c \ + package.c \ + pathname.c \ + read.c \ + regex.c \ + require.c \ string.c \ struct.c \ - require.c \ - time.c -OBJS =\ + stream.c \ + time.c \ + write.c \ + xedit.c +OBJS = $(SYS_OBJS) \ + bytecode.o \ core.o \ debugger.o \ format.o \ + hash.o \ helper.o \ + io.o \ lisp.o \ + math.o \ + package.o \ + pathname.o \ + read.o \ + regex.o \ + require.o \ string.o \ struct.o \ - require.o \ - time.o + stream.o \ + time.o \ + write.o \ + xedit.o #include <Library.tmpl> @@ -59,19 +106,20 @@ CCOPTIONS = -fpic DLLIB = DlLibrary LOCAL_LDFLAGS = -Xlinker -E -DEFINES = -DSHARED_MODULES -DLISPDIR='"$(LISPDIR)"' $(SNPRINTF_DEFS) -#else -DEFINES = -DLISPDIR='"$(LISPDIR)"' $(SNPRINTF_DEFS) +SHARED_DEFINES = -DSHARED_MODULES #endif - - INCLUDES = $(MISC_INCLUDES) -LOCAL_LIBRARIES = -L. -llisp -lm $(DLLIB) - -NormalProgramTarget($(SAMP),$(SAMPOBJ),,$(LOCAL_LIBRARIES),) -DependTarget() + DEFINES = -DLISP $(SHARED_DEFINES) -DLISPDIR='"$(LISPDIR)"' \ + $(SNPRINTF_DEFS) $(SYS_DEFINES) $(SIGNAL_DEFINES) + DEPLIBS = mp re + INCLUDES = -I. -Imp -Ire -I- $(MISC_INCLUDES) +LOCAL_LIBRARIES = -L. -llisp -Lmp -lmp -Lre -lre -lm $(DLLIB) #ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) +ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif + +DependTarget() + +NormalProgramTarget($(SAMP),$(SAMPOBJ),$(DEPLIBS),$(LOCAL_LIBRARIES),) Index: xc/programs/xedit/lisp/README diff -u xc/programs/xedit/lisp/README:1.5 xc/programs/xedit/lisp/README:1.13 --- xc/programs/xedit/lisp/README:1.5 Wed Oct 17 23:15:21 2001 +++ xc/programs/xedit/lisp/README Sun Dec 15 22:59:27 2002 @@ -1,31 +1,32 @@ -$XFree86: xc/programs/xedit/lisp/README,v 1.5 2001/10/18 03:15:21 paulo Exp $ +$XFree86: xc/programs/xedit/lisp/README,v 1.13 2002/12/16 03:59:27 paulo Exp $ LAST UPDATED: $Date: 2001/10/03 07:46:02 $ SUMMARY - This is a small lisp interpreter for xedit. In the current implementation, -it is just reading from stdin and writing to stdout/stderr. The code in xedit -just wraps these and read/write from a pipe to the lisp interpreter. This -is expected to change at some time, so that it should be possible to manage -the xedit text buffers from lisp code. - - It has a very simple method for loading shared modules, slightly based on -the XFree86 loader code, that is currently disabled by default. To enable it, -edit lisp.cf and change BuildSharedLispModules to YES. - - Assuming you have built it with BuildSharedLispModules enabled, you can build -a small test application can be built in this directory running "make lsp". -Two lisp programs are available in the test directory. To test the programs -run "./lsp hello.lsp" or "./lsp widgets.lsp". + This is a small lisp interpreter for xedit. It implements a subset of +Common Lisp and the xedit package implements several of the basic Emacs +lisp functions. + +(shared modules not broken, but needs a redesign for better performance, + but won't be made available in the default build probably for a long time, + it would be really better to generate the interface dinamically, and/or just + link agains't the required libraries and use a ffi interface) ++------------------------------------------------------------------------ +| It has a very simple method for loading shared modules, slightly based on +| the XFree86 loader code, that is currently disabled by default. To enable it, +| edit lisp.cf and change BuildSharedLispModules to YES. +| +| Assuming you have built it with BuildSharedLispModules enabled, you can build +| a small test application can be built in this directory running "make lsp". +| Two lisp programs are available in the test directory. To test the programs +| run "./lsp test/hello.lsp" or "./lsp test/widgets.lsp". ++------------------------------------------------------------------------ - Currently, it should be used as an helper and/or a small calculator embeded + Currently, it should be used as an helper and/or a small calculator embedded in xedit. For the future it should be possible to write entire interfaces -in the xedit text buffers. The code is expected to be very stable, and by -using it, xedit should not crash in any way (actually, it can't, as the -lisp is running in a separate process). The lisp process is started once the -first eval is called. +in the xedit text buffers. USAGE SUMMARY @@ -39,185 +40,150 @@ stop whatever it was processing and jump to the toplevel, to wait for more input. -Note that C-j currently will only work in the *scratch* buffer. +Note that C-j will only work in the *scratch* buffer. - IMPLEMENTATION SUMMARY + NOTES - The interpreter is expected to be a subset of Common Lisp, and is not -expected to invent any new features or interfaces, just become more and -more compatible with Common Lisp. The only non Common Lisp features, currently -is/are: - - o It has some Emacs Lisp functions, that should be removed and replaced with - the Common Lisp equivalent ones. - - - The currently implemented function names are in table.gperf. There are also -functions in modules/fun.lsp, that are inplicitly loaded by xedit and the -sample program lsp. - - - BUGS - - If (print) is called with a circular list as argument, the lisp interpreter -will crash. A code for circular list detection was written, but removed as -it was buggy. - The (gc) code was slightly changed to avoid circular lists, but the code -is not correct, so (gc) may need to be called several times to get deep enough -on some more complex data structures, and free it. But calling (gc) explicitly -is not required, as it will be called every time there are not enough available -cells. - - - WHY? - - I have used Emacs for a long time, and since I was working as volunteer to -make of Xaw a better user interface, xedit seemed to need some work. For at -least 3 years now, I don't use any other text editor than xedit, unless I -need for some reason to work on the text console (like when debugging the -xserver or xfs). - - The lisp code was mostly written for some years, but not incorporated in -xedit. Since the Lisp language is unlikely to change from day to night, it -can be safely incorporated in xedit. Contrarily to this is an html -viewer/editor to xedit I have been writing for some years. I wish I could add -it to Xaw/xedit soon, but unfortunately it is still unstable, and not -functional. - - - NOTE - - The lisp interpreter is mean't to be usable without xedit and without Xaw. -The xedit text buffer interface, when done will be just a module. - If you want to test the current implementation, subject to changes, as it -is only for testing, create a file named "xedit.lsp", with the contents: --- -;; (provide "xedit") - -(defun point () - (format t "get-point~%") - (read) ;; current point -) - -(defun point-min () - (format t "point-min~%") - (read) ;; minimal point value -) - -(defun point-max () - (format t "point-max~%") - (read) ;; maximal point value -) - -(defun goto-char (point) - (format t "set-point ~D~%" point) - (read) ;; nil return value - point -) - -(defun insert (str) - (format t "insert ~S~%" str) - (read) ;; nil return value -) - -(defun get-background-color () - (format t "get-background~%") - (read) ;; current background color -) - -(defun set-background-color (color) - (format t "set-background ~S~%" color) - (read) ;; nil return value -) - -(defun get-font () - (format t "get-font~%") - (read) ;; current font -) - -(defun set-font (font) - (format t "set-font ~S~%" font) - (read) ;; nil return value -) - -(defun get-foreground-color () - (format t "get-foreground~%") - (read) ;; current foreground color -) - -(defun set-foreground-color (color) - (format t "set-foreground ~S~%" color) - (read) ;; nil return value -) - -(defun other-buffer () - (format t "get-other-buffer~%") - (read) ;; value of other buffer -) --- -Note that it is printing a literal ESC. - After creating the file xedit.lsp, at the *scratch* buffer, type -(load "xedit.lsp") and press Ctrl+J. After that, you should be able to use -the defined functions. Try this: -(set-background-color "PeachPuff") -(set-foreground-color "Red3") -(goto-char (point-min)) - - - DEBUGGER - - There is a, currently, very simple debugger implement in the interpreter. -To use the debugger, run the lsp sample program as "./lsp -d", and optionally -pass a second parameter, for the file to be interpreted. Once the debugger -prompt is visible, type "help" for a summary of options. To leave the debugger -type "continue". - Note that the debugger is still very simple, it won't work from xedit, and -won't drop to the debugger on "fatal errors". It allows adding breakpoints to -functions and watchpoints to variables. Support for changing data and going to -the debugger on fatal errors should be added soon. - - - STRUCTURE IMPLEMENTATION OVERVIEW - - Assuming structure person is created as: - (defstruct person age first-name last-name) - The interpreter will gc protect the arguments in the list DEF defined as - (person age first-name last-name), and create the special atoms: - make-person with structure property DEF function STRUCT_CONSTRUCTOR - person-p with structure property DEF function STRUCT_CHECK - person-age with structure property DEF function 0 - person-first-name with structure property DEF function 1 - person-last-name with structure property DEF function 2 - When an accessor function is called, as in: - (person-age (make-person :age 30)) - The evaluator will internally translate the code to: - (xedit::struct-access 'person-age (xedit::make-struct 'make-person :age 30)) - The function xedit::struct-access will fetch the structure property -from the atom person-age to determine the offset, and also make sure it's -argument is of type person. The function xedit::make-struct only checks that -the structure property is set to the atom person, and that the age field is -a person field name. - It is possible to override the setf method for structures, but a suitable -one is constructed, for example: - (setf (person-first-name some-person) 'MARIA) - Internally, it will be evaluated as this definition where provided: - (defsetf person-first-name (struct) (value) - `(xedit::struct-store 'person-first-name ,struct ,value)) - And the code executed is: - (xedit::struct-store 'person-first-name some-person 'MARIA) - Type checking is also done with a single function, as the code: - (person-p some-person) - Is internally translated to: - (xedit::struct-type 'person-p some-person) - The current structure implementation, like almost everything in the -interpreter is very simple, and calling any of the xedit::* functions -explicitly is unsupported. - Structure redefinition is supported, but not encouraged, and you should -do it only when sure no instances of the previous definition exists, previous -access method functions are only removed if the new definition has a field -with the same name, and calling the new methods on old objects will generate -errors. + The improvements to xedit including the several possibilites to extend +the editor using Lisp are expected to allow making of xedit a versatile +text editor for programming, but there is code being (slowly) developed +that should also make it useable as a small word processor, for things +like WYSIWYG html, etc. + The xedit development is being done very slowly, maybe it will get +somewhere someday, but it is a pet/hobby project, there is no intention +of making of it an end user editor (the idea is to make it an useful +development tool). + In some aspects the development is trying to mimic several Emacs +features, but there is no intention of competition (if xedit ever get +something better than Emacs, I hope that it serves as a motivation to +make of Emacs an even better editor), actually it is expected to explore +different areas and use alternate solutions for the implementation. + Most work in a computer is done in a text editor and the more the editor +can help the user the better. + + +(debugger is broken and very slow, no prevision for fixing it, but is + expected to work correctly for interpreted only code) ++------------------------------------------------------------------------ +| DEBUGGER +| +| There is a, currently, very simple debugger implement in the interpreter. +| The debugger is now optional, and off by default. To make it available, +| you need to recompile with -DDEBUGGER. +| To use the debugger, run the lsp sample program as "./lsp -d", and optionally +| pass a second parameter, for the file to be interpreted. Once the debugger +| prompt is visible, type "help" for a summary of options. To leave the debugger +| type "continue". +| Note that the debugger is still very simple, it won't work from xedit, and +| won't drop to the debugger on "fatal errors". It allows adding breakpoints to +| functions and watchpoints to variables. Support for changing data and going to +| the debugger on fatal errors should be added at some time. ++------------------------------------------------------------------------ + + + COMPILER + + Now there is a very simple bytecode compiler. It is far from finished, but +for simple code can show significant better performance. + There is not yet an interface to compile entire files and no interface to +store the generated bytecode in disk. There is an interface to bytecode +compile toplevel forms as a LAMBDA NIL, but it is not yet exported. + If your code needs to call GO/RETURN/RETURN-FROM as the result of an EVAL, +it must jump to code in the interpreter, after compiling all calls to +GO/RETURN/RETURN-FROM are just stack adjusting and jumps in the bytecode. +CATCH/THROW and UNWIND-PROTECT are running as interpreted code for now, so it +is safe to use these, but code in such blocks is not compiled/optimized +(not even macro expansion is done, as it understands that while not compiled, +everything is candidate to redefinition at any time). + To compile the code, just write a function, and compile it, example: + + (defun fact (n) + (if (< n 2) + 1 + (* n (fact (1- n))) + ) + ) + FACT + + (compile 'fact) + FACT + NIL + NIL + + (disassemble 'fact) + Function FACT: + 1 required argument: N + 0 optional arguments + 0 keyword parameters + No rest argument + + Bytecode header: + 1 element used in the stack + 2 elements used in the builtin stack + 0 elements used in the protected stack + Constant 0 = 1 + Constant 1 = (2) + Symbol 0 = N + Builtin 0 = * + Builtin 1 = 1- + Builtin 2 = < + + Initial stack: + 0 = N + + Bytecode stream: + 0 LOAD&PUSH (0) + 2 LOADCON&PUSH [1] ; (2) + 4 CALL 2 [2] ; < + 7 JUMPNIL 8 + 10 LOADCON [0] ; 1 + 12 NOOP + 13 JUMP 19 + 16 LOAD&PUSH (0) + 18 LOAD&PUSH (0) + 20 CALL 1 [1] ; 1- + 23 LET* [0] ; N + 25 LETREC 1 + 27 UNLET 1 + 29 BCONS1 + 30 CALL 1 [0] ; * + 33 RETURN + FACT + + + There are several optimizations that should be done at some time, I don't +think adding NOOP opcodes will help everywhere to make aligned memory reads +of shorts and ints. + It should have explicitly visible registers, not the abstraction of "the +current value", so the code generator can choose register allocation for +loop control variables, commonly used variables, etc, for example. Jumps +should have 3 types: byte relative, 2 bytes relative and 4 bytes relative. +For now there is only 2 byte relative jumps, byte relative jumps +can show a significant performance increase, but they are disable until +it is decided how inlined functions will work, if it just updates the bytecode +header and cut&past the bytecode, jumps must be updated, and some jumps +may not fit anymore in a byte. + + + OPTIMIZATION + + There are plenty of possibilities to make the interpreter run faster. Some +optimizations that can make it run quite faster in certain cases are: + o Better object memory layout and gc. The current memory allocation code + is very bad, it try to keep 3 times more free objects than the currently + used number, this can consume a lot of memory. The reason is to reduce + the gc time cost so that it will in average miss only one in every 4 + collect tries. + o Implement real vectors, currently they are just a list, so it cannot + just deference a given index, and gc time is very long also. + o Most lists are never changed once created, it could somehow add an index + field in the cons cell, so that NTH/NTHCDR/LENGTH like code could just + deference the correct object, instead of traversing the CDR of every + cons. This would probably require implementing lists as vectors, while + making it easy to deference would make life harder when deleting/inserting + sublists in a list. It should also better be done in a way that does + not require a lot of objects allocated linearly. HELPING Index: xc/programs/xedit/lisp/TODO diff -u /dev/null xc/programs/xedit/lisp/TODO:1.9 --- /dev/null Thu Feb 27 12:34:55 2003 +++ xc/programs/xedit/lisp/TODO Sun Dec 15 22:59:27 2002 @@ -0,0 +1,81 @@ +$XFree86: xc/programs/xedit/lisp/TODO,v 1.9 2002/12/16 03:59:27 paulo Exp $ + +LAST UPDATED: $Date$ + + Small todo list + +o Change function/macro body to know if a &key or &optional argument was not + provided, and initialize to the default value in the function, for + interpreted and builtin functions it is better done before the function is + called, but for bytecode it is better in the function. +o Following the previous idea, change function definitions in the format: + (defun afun (a &aux b (c (some-code))) ...) + to + (defun afun (a) (let* ((b (c (some-code)))) ...)) + This can significatively reduce bytecode size, and also simplify function + calls. +o Optimize text redisplay in Xaw, instead of allocating a copy of the buffer + for the paint-list, should use the text in place, and only allocate small + buffers when required, i.e. displaying control characters, etc. +o Add an interface to create new object types dinamically. +o Add a special string object to simplify and avoid too many copies of + portions of the text buffers. This special string should be read-only + and not gc-collected. +o Make the bytecode compiler smarter to detect some constructs like: + (builtin-or-bytecode-function-call arg1 arg2 (return)) + this will not properly restore the internal stacks. + +o When an Init function is present in every file, call LispAddBuiltin from + that initialization function. +o Cleanup the code, make it optional to build some uncommon features (as well + as the entire interpreter?). Implement more functions directly in lisp. +o Finish an "specification" for loadable modules. Write a FFI interface. + Without the possibility of using already existing libraries, the interpreter + won't be too much useful due to a poor library. It is very desirable to + "auto-generate" directly from C header files the interface to the lisp + code, and from that, dlload a shared library. In some cases, it is required + to link statically with a new interpreter binary, make it easy. +o Implement a better string type. That should support characters larger than + 8 bits, and that should allow embeded nuls. +o Implement a richer set of math functions. This, if properly done can be + made a loadable module. +o Optmize mathimp.c, comparing a double with a bignum should never cause an + error. Implement mp?_initsetXXX functions? +o Finish missing features in read.c, and simplify it. +o (close) probably should not send a signal when closing a pipe. +o Implement "real" vectors, they exist to make access to field elements + at constant time, implementing vectors as lists may be very slow. +o Use float and double as floating points formats. +o Implement support for vectors of "atomic" types. Vectors of floats would + be useful for example if a OpenGL binding is done. +o Implement a multiple precision floating point format. Either a 128 bits + (or configurable length?) IEEE 754 like number, or some format using + ratios, a epsilon for rouding, rounding modes, exact/inexact flag, a good + amount of guard digits, etc. +o Write more functions and optimization for bignums. Try to make the code + as reusable as possible, either by other software or at least by the + different number types. +o Instead of using mathimp.c for a large amount of functions, implement a + "generic number" type and implement the calculations directly in the + mp library. +o Add more missing Common Lisp features, like &allow-other-keys for function + definitions, the missing structure features, CLOS etc. +o Fix the Postgresql module, make it compile everywhere. +o Add support for multi-threaded applications? +o Make it possible to know if a object has only one reference, this is + required to make "inplace" changes of variables. Very useful for things + like (incf) and (decf), and also when dealing with bignums. +o Maybe have a freelist for objects depending on the type. Bignums can be + reused, and having some large ones expecting to be freed by the gc can + consume a lot of memory. +o Internationalization. Support ',' in floats? Correctly treat characters + for {up,down}-casing. +o Synch the Xaw text code for supporting tables, text alignment/paragraphs, + etc, and add bindings to the interpreter. Add support for incremental + changes of those properties, currently it is "read-only". +o Write some type of "hyperlinks", this is the only feature missing to even + allow writting a web browser inside xedit. +o Write some "demos" (maybe a file manager or a simple mail reader) using the + Xt/Xaw bindings (needs modules working in all systems). +o Remove all calls to the macros GCDisable and GCEnable. This is unsafe + and should be removed. Index: xc/programs/xedit/lisp/bytecode.c diff -u /dev/null xc/programs/xedit/lisp/bytecode.c:1.15 --- /dev/null Thu Feb 27 12:34:55 2003 +++ xc/programs/xedit/lisp/bytecode.c Tue Jan 28 22:05:53 2003 @@ -0,0 +1,3707 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/bytecode.c,v 1.15 2003/01/29 03:05:53 paulo Exp $ */ + + +/* +somethings TODO: + + o Write code for allowing storing the bytecode on disk. Basically + write a section of the bytecode with the package name of the symbol + pointers, and after that, the symbols used. At load time just put + the pointers in the bytecode. Constants can be stored as the string + representation. Probably just storing the gc protected code as a + string is enough to rebuild it. + + o Write code to store tags of BLOCK/CATCH and setjump buffer stacks, + and, only keep track of this if non byte-compiled code is called, + as after byte-compilation RETURN and THROW are just jumps. + + o Remove not reliable "optmization code" code from Com_XXX functions + and do it later, removing dead code, tests with a constant argument, + etc, in the "link time". Frequently joining sequential opcodes to a + compound version. + + o Write an optimizer to do code transformation. + + o Write code to know when variables can be changed in place, this + can save a huge time in loop counters. + + o Write code for fast garbage collection of objects that can be + safely collected. + + o Cleanup of interpreted code. Having bytecode mean that the interpreter + now is better having a clean and small code. If speed is important, + it should be byte compiled. + + o Limit the stacks length. So that instead of using an index, use the + pointer where an object value should be read/stored as the stack address + would not change during the program execution. + + o Optimize jump to jump. Common in code like: + (IF test + (GO somewhere) + (GO elsewhere) + ) + (GO there) + that generates a bytecode like: + <code to evaluate test> + JUMPNIL :NIL-RESULT + :T-RESULT + JUMP :SOMEWHERE + JUMP :END-OF-IF ;; <- this is not required, or even + :NIL-RESULT ;; better, notice the jump after + JUMP :ELSEWHERE ;; the if and transform it into + :END-OF-IF ;; a JUMP :THERE (assuming there + JUMP :THERE ;; (was no jump in the T code). + + o Optimize variables that are known to not change it's value, i.e. pseudo + constants. Loading the value of a constant should be faster than loading + the current value of a variable; the constant table could fit in the + processor cache line and needs less calculation to find the object address. + + o Fix some known problems, like when calling return or return-from while + building the argument list to a builtin function, or inline of recursive + functions. + */ + + +#include "bytecode.h" +#include "write.h" + +#define SYMBOL_KEYWORD -1 /* A keyword, load as constant */ +#define SYMBOL_CONSTANT -2 /* Defined as constant at compile time */ +#define SYMBOL_UNBOUND -3 /* Not a local variable */ + +#define NEW_TREE(type) CompileNewTree(com, type) + +/* If in tagbody, ignore anything that is not code */ +#define IN_TAGBODY() (com->block->type == LispBlockBody && \ + com->level == com->tagbody) +#define FORM_ENTER() ++com->level +#define FORM_LEAVE() --com->level + +#define COMPILE_FAILURE(message) \ + LispMessage("COMPILE: %s", message); \ + longjmp(com->jmp, 1) + +/* + * Types + */ +typedef struct _CodeTree CodeTree; +typedef struct _CodeBlock CodeBlock; + +typedef enum { + CodeTreeBytecode, + CodeTreeLabel, + CodeTreeGo, + CodeTreeJump, + CodeTreeJumpIf, + CodeTreeCond, + CodeTreeBlock, + CodeTreeReturn +} CodeTreeType; + +struct _CodeTree { + CodeTreeType type; + + /* Resolved when linking, may be adjusted while optimizing */ + long offset; + + LispByteOpcode code; + + union { + signed char signed_char; + signed short signed_short; + signed int signed_int; + LispAtom *atom; + LispObj *object; + CodeTree *tree; + CodeBlock *block; + struct { + unsigned char num_arguments; + LispBuiltin *builtin; + signed short offset; /* Used if opcode is XBC_CALL_SET */ + } builtin; + struct { + unsigned char num_arguments; + LispObj *name; + LispObj *lambda; + } call; + struct { + unsigned char num_arguments; + LispObj *code; + } bytecall; + struct { + short offset; + LispAtom *name; + } let; + struct { + LispAtom *symbol; + LispAtom *name; + } let_sym; + struct { + LispObj *object; + LispAtom *name; + } let_con; + struct { + signed short load; + signed short set; + } load_set; + struct { + LispObj *object; + signed short offset; + } load_con_set; + struct { + LispObj *car; + LispObj *cdr; + } cons; + struct { + short offset; + LispObj *definition; + } struc; + } data; + + CodeTree *next; + CodeTree *group; + CodeBlock *block; +}; + +struct _CodeBlock { + LispBlockType type; + LispObj *tag; + + struct { + LispObj **labels; + CodeTree **codes; /* Filled at link time */ + int length; + int space; + } tagbody; + + struct { + LispAtom **symbols; /* Identifiers of variables in a block */ + int *flags; /* Information about usage of the variable */ + int length; + } variables; + + int bind; /* Used in case of RETURN from LET */ + int level; /* Nesting level block was created */ + + CodeTree *tree, *tail; + CodeBlock *prev; /* Linked list as a stack */ + CodeTree *parent; /* Back reference */ +}; + +struct _LispCom { + unsigned char *bytecode; /* Bytecode generated so far */ + long length; + + CodeBlock *block, *toplevel; + + int tagbody; /* Inside a tagbody block? */ + int level; /* Nesting level */ + int macro; /* Expanding a macro? */ + + int lex; + + int warnings; + + LispObj *form, *plist; + + jmp_buf jmp; /* Used if compilation cannot be finished */ + + struct { + int cstack; /* Current number of objects in forms evaluation */ + int cbstack; + int cpstack; + int stack; /* max number of objects will be loaded in stack */ + int bstack; + int pstack; + } stack; + + struct { + /* Constant table */ + LispObj **constants; + int num_constants; + /* Symbol table */ + LispAtom **symbols; + int num_symbols; + /* Builtin table */ + LispBuiltin **builtins; + int num_builtins; + /* Bytecode table */ + LispObj **bytecodes; + int num_bytecodes; + } table; +}; + +/* + * Prototypes + */ +static LispObj *MakeBytecodeObject(LispCom*, LispObj*, LispObj*); + +static CodeTree *CompileNewTree(LispCom*, CodeTreeType); +static void CompileFreeState(LispCom*); +static void CompileFreeBlock(CodeBlock*); +static void CompileFreeTree(CodeTree*); + +static void CompileIniBlock(LispCom*, LispBlockType, LispObj*); +static void CompileFiniBlock(LispCom*); + +static void com_BytecodeChar(LispCom*, LispByteOpcode, char); +static void com_BytecodeShort(LispCom*, LispByteOpcode, short); +static void com_BytecodeObject(LispCom*, LispByteOpcode, LispObj*); +static void com_BytecodeCons(LispCom*, LispByteOpcode, LispObj*, LispObj*); + +static void com_BytecodeAtom(LispCom*, LispByteOpcode, LispAtom*); + +static void com_Bytecode(LispCom*, LispByteOpcode); + +static void com_Load(LispCom*, short); +static void com_LoadLet(LispCom*, short, LispAtom*); +static void com_LoadPush(LispCom*, short); + +static void com_Let(LispCom*, LispAtom*); + +static void com_Bind(LispCom*, short); +static void com_Unbind(LispCom*, short); + +static void com_LoadSym(LispCom*, LispAtom*); +static void com_LoadSymLet(LispCom*, LispAtom*, LispAtom*); +static void com_LoadSymPush(LispCom*, LispAtom*); + +static void com_LoadCon(LispCom*, LispObj*); +static void com_LoadConLet(LispCom*, LispObj*, LispAtom*); +static void com_LoadConPush(LispCom*, LispObj*); + +static void com_Set(LispCom*, short); +static void com_SetSym(LispCom*, LispAtom*); + +static void com_Struct(LispCom*, short, LispObj*); +static void com_Structp(LispCom*, LispObj*); + +static void com_Call(LispCom*, unsigned char, LispBuiltin*); +static void com_Bytecall(LispCom*, unsigned char, LispObj*); +static void com_Funcall(LispCom*, LispObj*, LispObj*); + +static void CompileStackEnter(LispCom*, int, int); +static void CompileStackLeave(LispCom*, int, int); + +static void LinkBytecode(LispCom*); + +static LispObj *ExecuteBytecode(unsigned char*); + + +/* Defined in lisp.c */ +void LispMoreStack(void); +void LispMoreEnvironment(void); +void LispMoreGlobals(LispPackage*); +LispObj *LispEvalBackquote(LispObj*, int); +void LispSetAtomObjectProperty(LispAtom*, LispObj*); + +/* + * Initialization + */ +extern int pagesize; + +LispObj x_cons[8]; +static LispObj *cons, *cons1, *cons2, *cons3, *cons4, *cons5, *cons6, *cons7; + +/* + * Implementation + */ +#include "compile.c" + +void +LispBytecodeInit(void) +{ + cons = &x_cons[7]; + cons->type = LispCons_t; + CDR(cons) = NIL; + cons1 = &x_cons[6]; + cons1->type = LispCons_t; + CDR(cons1) = cons; + cons2 = &x_cons[5]; + cons2->type = LispCons_t; + CDR(cons2) = cons1; + cons3 = &x_cons[4]; + cons3->type = LispCons_t; + CDR(cons3) = cons2; + cons4 = &x_cons[3]; + cons4->type = LispCons_t; + CDR(cons4) = cons3; + cons5 = &x_cons[2]; + cons5->type = LispCons_t; + CDR(cons5) = cons4; + cons6 = &x_cons[1]; + cons6->type = LispCons_t; + CDR(cons6) = cons5; + cons7 = &x_cons[0]; + cons7->type = LispCons_t; + CDR(cons7) = cons6; +} + +LispObj * +Lisp_Compile(LispBuiltin *builtin) +/* + compile name &optional definition + */ +{ + GC_ENTER(); + LispObj *result, *warnings_p, *failure_p; + + LispObj *name, *definition; + + definition = ARGUMENT(1); + name = ARGUMENT(0); + + result = name; + warnings_p = NIL; + failure_p = T; + + if (name != NIL) { + LispAtom *atom; + + CHECK_SYMBOL(name); + atom = name->data.atom; + if (atom->a_builtin || atom->a_compiled) + goto finished_compilation; + else if (atom->a_function) { + LispCom com; + int failed, *pfailed; + int lex, base, *plex, *pbase; + LispArgList *alist; + LispObj *lambda, *form, *arguments, **parguments; + LispObj **presult, **pwarnings_p, **pfailure_p, **pform; + + lambda = atom->property->fun.function; + if (definition != UNSPEC || lambda->funtype != LispFunction) + /* XXX TODO replace definition etc. */ + goto finished_compilation; + alist = atom->property->alist; + + memset(&com, 0, sizeof(LispCom)); + com.toplevel = com.block = LispCalloc(1, sizeof(CodeBlock)); + com.block->type = LispBlockClosure; + com.block->tag = name; + + /* Create a fake argument list to avoid yet another flag + * for ComCall. The value does not matter, just the fact + * that the symbol will be bound or not in the implicit + * PROGN of the function body. */ + base = alist->num_arguments - alist->auxs.num_symbols; + if (base) { + LispObj *argument; + int i, sforms; + + for (i = sforms = 0; i < alist->optionals.num_symbols; i++) + if (alist->optionals.sforms[i]) + ++sforms; + + arguments = form = NIL; + i = sforms + + alist->normals.num_symbols + alist->optionals.num_symbols; + + if (i) { + arguments = form = CONS(NIL, NIL); + GC_PROTECT(arguments); + for (--i; i > 0; i--) { + RPLACD(form, CONS(NIL, NIL)); + form = CDR(form); + } + } + + for (i = 0; i < alist->keys.num_symbols; i++) { + /* key symbol */ + if (alist->keys.keys[i]) + argument = QUOTE(alist->keys.keys[i]); + else + argument = alist->keys.symbols[i]; + + /* add key */ + if (arguments == NIL) { + arguments = form = CONS(argument, NIL); + GC_PROTECT(arguments); + } + else { + RPLACD(form, CONS(argument, NIL)); + form = CDR(form); + } + + /* add value */ + RPLACD(form, CONS(NIL, NIL)); + form = CDR(form); + + if (alist->keys.sforms[i]) { + RPLACD(form, CONS(NIL, NIL)); + form = CDR(form); + } + } + + if (alist->rest) { + if (arguments == NIL) { + arguments = form = CONS(NIL, NIL); + GC_PROTECT(arguments); + } + else { + RPLACD(form, CONS(NIL, NIL)); + form = CDR(form); + } + } + } + else + arguments = NIL; + + form = CONS(lambda->data.lambda.code, NIL); + GC_PROTECT(form); + com.form = form; + com.plist = CONS(NIL, NIL); + GC_PROTECT(com.plist); + + pfailed = &failed; + plex = &lex; + pbase = &base; + pform = &form; + presult = &result; + pwarnings_p = &warnings_p; + pfailure_p = &failure_p; + parguments = &arguments; + failed = 1; + if (setjmp(com.jmp) == 0) { + /* Save interpreter state */ + lex = com.lex = lisp__data.env.lex; + base = ComCall(&com, alist, name, arguments, 1, 0, 1); + + /* Generate code tree */ + lisp__data.env.lex = base; + ComProgn(&com, CAR(form)); + failed = 0; + } + + /* Restore interpreter state */ + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = base; + + if (!failed) { + failure_p = NIL; + result = MakeBytecodeObject(&com, name, + lambda->data.lambda.data); + LispSetAtomCompiledProperty(atom, result); + result = name; + } + if (com.warnings) + warnings_p = FIXNUM(com.warnings); + goto finished_compilation; + } + else + goto undefined_function; + } + +undefined_function: + LispDestroy("%s: the function %s is undefined", + STRFUN(builtin), STROBJ(name)); + +finished_compilation: + RETURN(0) = warnings_p; + RETURN(1) = failure_p; + RETURN_COUNT = 2; + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Disassemble(LispBuiltin *builtin) +/* + disassemble function + */ +{ + int macro; + char buffer[128]; + LispAtom *atom; + LispArgList *alist; + LispBuiltin *xbuiltin; + LispObj *name, *lambda, *bytecode; + + LispObj *function; + + function = ARGUMENT(0); + + macro = 0; + alist = NULL; + xbuiltin = NULL; + name = bytecode = NULL; + + switch (OBJECT_TYPE(function)) { + case LispAtom_t: + name = function; + atom = function->data.atom; + alist = atom->property->alist; + if (atom->a_builtin) { + xbuiltin = atom->property->fun.builtin; + macro = xbuiltin->type == LispMacro; + } + else if (atom->a_compiled) + bytecode = atom->property->fun.function; + else if (atom->a_function) { + lambda = atom->property->fun.function; + macro = lambda->funtype == LispMacro; + } + else if (atom->a_defstruct && + atom->property->structure.function != STRUCT_NAME) { + if (atom->property->structure.function == STRUCT_CONSTRUCTOR) + atom = Omake_struct->data.atom; + else if (atom->property->structure.function == STRUCT_CHECK) + atom = Ostruct_type->data.atom; + else + atom = Ostruct_access->data.atom; + xbuiltin = atom->property->fun.builtin; + } + else + LispDestroy("%s: the function %s is not defined", + STRFUN(builtin), STROBJ(function)); + break; + case LispBytecode_t: + name = Olambda; + bytecode = function; + break; + case LispLambda_t: + name = Olambda; + alist = (LispArgList*)function->data.lambda.name->data.opaque.data; + break; + case LispCons_t: + if (CAR(function) == Olambda) { + function = EVAL(function); + if (OBJECT_TYPE(function) == LispLambda_t) { + name = Olambda; + alist = (LispArgList*) + function->data.lambda.name->data.opaque.data; + break; + } + } + default: + LispDestroy("%s: %s is not a function", + STRFUN(builtin), STROBJ(function)); + break; + } + + if (xbuiltin) { + LispWriteStr(NIL, "Builtin ", 8); + if (macro) + LispWriteStr(NIL, "macro ", 6); + else + LispWriteStr(NIL, "function ", 9); + } + else if (macro) + LispWriteStr(NIL, "Macro ", 6); + else + LispWriteStr(NIL, "Function ", 9); + LispWriteObject(NIL, name); + LispWriteStr(NIL, ":\n", 2); + + if (alist) { + int i; + + sprintf(buffer, "%d required argument%s", + alist->normals.num_symbols, + alist->normals.num_symbols != 1 ? "s" : ""); + LispWriteStr(NIL, buffer, strlen(buffer)); + for (i = 0; i < alist->normals.num_symbols; i++) { + LispWriteChar(NIL, i ? ',' : ':'); + LispWriteChar(NIL, ' '); + LispWriteStr(NIL, ATOMID(alist->normals.symbols[i]), + strlen(ATOMID(alist->normals.symbols[i]))); + } + LispWriteChar(NIL, '\n'); + + sprintf(buffer, "%d optional argument%s", + alist->optionals.num_symbols, + alist->optionals.num_symbols != 1 ? "s" : ""); + LispWriteStr(NIL, buffer, strlen(buffer)); + for (i = 0; i < alist->optionals.num_symbols; i++) { + LispWriteChar(NIL, i ? ',' : ':'); + LispWriteChar(NIL, ' '); + LispWriteStr(NIL, ATOMID(alist->optionals.symbols[i]), + strlen(ATOMID(alist->optionals.symbols[i]))); + } + LispWriteChar(NIL, '\n'); + + sprintf(buffer, "%d keyword parameter%s", + alist->keys.num_symbols, + alist->keys.num_symbols != 1 ? "s" : ""); + LispWriteStr(NIL, buffer, strlen(buffer)); + for (i = 0; i < alist->keys.num_symbols; i++) { + LispWriteChar(NIL, i ? ',' : ':'); + LispWriteChar(NIL, ' '); + LispWriteObject(NIL, alist->keys.symbols[i]); + } + LispWriteChar(NIL, '\n'); + + if (alist->rest) { + LispWriteStr(NIL, "Rest argument: ", 15); + LispWriteStr(NIL, ATOMID(alist->rest), + strlen(ATOMID(alist->rest))); + LispWriteChar(NIL, '\n'); + } + else + LispWriteStr(NIL, "No rest argument\n", 17); + } + + if (bytecode) { + char *ptr; + int *offsets[4]; + int i, done, j, sym0, sym1, con0, con1, bui0, byt0, strd, strf; + LispObj **constants; + LispAtom **symbols; + LispBuiltin **builtins; + unsigned char **codes; + LispObj **names; + short stack, num_constants, num_symbols, num_builtins, num_bytecodes; + unsigned char *base, *stream = bytecode->data.bytecode.bytecode->code; + + LispWriteStr(NIL, "\nBytecode header:\n", 18); + + /* Header information */ + stack = *(short*)stream; + stream += sizeof(short); + sprintf(buffer, "%d element%s used in the stack\n", + stack, stack != 1 ? "s" : ""); + LispWriteStr(NIL, buffer, strlen(buffer)); + stack = *(short*)stream; + stream += sizeof(short); + sprintf(buffer, "%d element%s used in the builtin stack\n", + stack, stack != 1 ? "s" : ""); + LispWriteStr(NIL, buffer, strlen(buffer)); + stack = *(short*)stream; + stream += sizeof(short); + sprintf(buffer, "%d element%s used in the protected stack\n", + stack, stack != 1 ? "s" : ""); + LispWriteStr(NIL, buffer, strlen(buffer)); + + num_constants = *(short*)stream; + stream += sizeof(short); + num_symbols = *(short*)stream; + stream += sizeof(short); + num_builtins = *(short*)stream; + stream += sizeof(short); + num_bytecodes = *(short*)stream; + stream += sizeof(short); + + constants = (LispObj**)stream; + stream += num_constants * sizeof(LispObj*); + symbols = (LispAtom**)stream; + stream += num_symbols * sizeof(LispAtom*); + builtins = (LispBuiltin**)stream; + stream += num_builtins * sizeof(LispBuiltin*); + codes = (unsigned char**)stream; + stream += num_bytecodes * sizeof(unsigned char*); + names = (LispObj**)stream; + stream += num_bytecodes * sizeof(LispObj*); + + for (i = 0; i < num_constants; i++) { + sprintf(buffer, "Constant %d = %s\n", i, STROBJ(constants[i])); + LispWriteStr(NIL, buffer, strlen(buffer)); + } + +/* Macro XSTRING avoids some noisy in the output, if it were defined as + * #define XSTRING(object) object ? STROBJ(object) : #<UNBOUND> + * and called as XSTRING(atom->object) + * it would also print the package name were the symbol was first defined, + * but for local variables, only the symbol string is important. */ +#define XSTRING(string) string ? string : "#<UNBOUND>" + + for (i = 0; i < num_symbols; i++) { + sprintf(buffer, "Symbol %d = %s\n", + i, XSTRING(symbols[i]->string)); + LispWriteStr(NIL, buffer, strlen(buffer)); + } + for (i = 0; i < num_builtins; i++) { + sprintf(buffer, "Builtin %d = %s\n", + i, STROBJ(builtins[i]->symbol)); + LispWriteStr(NIL, buffer, strlen(buffer)); + } + for (i = 0; i < num_bytecodes; i++) { + sprintf(buffer, "Bytecode %d = %s\n", + i, STROBJ(names[i])); + LispWriteStr(NIL, buffer, strlen(buffer)); + } + + /* Make readability slightly easier printing the names of local + * variables where it's offset is known, i.e. function arguments. */ + if (alist) { + if (alist->num_arguments == 0) + LispWriteStr(NIL, "\nNo initial stack\n", 18); + else { + int len1, len2; + + j = 0; + LispWriteStr(NIL, "\nInitial stack:\n", 16); + + for (i = 0; i < alist->normals.num_symbols; i++, j++) { + sprintf(buffer, "%d = ", j); + LispWriteStr(NIL, buffer, strlen(buffer)); + ptr = alist->normals.symbols[i]->data.atom->string; + LispWriteStr(NIL, ptr, strlen(ptr)); + LispWriteChar(NIL, '\n'); + } + + for (i = 0; i < alist->optionals.num_symbols; i++, j++) { + sprintf(buffer, "%d = ", j); + LispWriteStr(NIL, buffer, strlen(buffer)); + ptr = alist->optionals.symbols[i]->data.atom->string; + LispWriteStr(NIL, ptr, strlen(ptr)); + LispWriteChar(NIL, '\n'); + if (alist->optionals.sforms[i]) { + sprintf(buffer, "%d = ", j); + len1 = strlen(buffer); + LispWriteStr(NIL, buffer, len1); + ptr = alist->optionals.sforms[i]->data.atom->string; + len2 = strlen(ptr); + LispWriteStr(NIL, ptr, len2); + LispWriteChars(NIL, ' ', 28 - (len1 + len2)); + LispWriteStr(NIL, "; sform\n", 9); + j++; + } + } + + for (i = 0; i < alist->keys.num_symbols; i++, j++) { + sprintf(buffer, "%d = ", j); + len1 = strlen(buffer); + LispWriteStr(NIL, buffer, len1); + if (alist->keys.keys[i]) { + ptr = alist->keys.keys[i]->data.atom->string; + len2 = strlen(ptr); + LispWriteStr(NIL, ptr, strlen(ptr)); + LispWriteChars(NIL, ' ', 28 - (len1 + len2)); + LispWriteStr(NIL, "; special key", 14); + } + else { + ptr = alist->keys.symbols[i]->data.atom->string; + LispWriteStr(NIL, ptr, strlen(ptr)); + } + LispWriteChar(NIL, '\n'); + if (alist->keys.sforms[i]) { + sprintf(buffer, "%d = ", j); + len1 = strlen(buffer); + LispWriteStr(NIL, buffer, len1); + ptr = alist->keys.sforms[i]->data.atom->string; + len2 = strlen(ptr); + LispWriteStr(NIL, ptr, len2); + LispWriteChars(NIL, ' ', 28 - (len1 + len2)); + LispWriteStr(NIL, "; sform\n", 9); + j++; + } + } + + if (alist->rest) { + sprintf(buffer, "%d = ", j); + len1 = strlen(buffer); + LispWriteStr(NIL, buffer, len1); + ptr = alist->rest->data.atom->string; + len2 = strlen(ptr); + LispWriteStr(NIL, ptr, len2); + LispWriteChar(NIL, '\n'); + j++; + } + + for (i = 0; i < alist->auxs.num_symbols; i++, j++) { + sprintf(buffer, "%d = ", j); + len1 = strlen(buffer); + LispWriteStr(NIL, buffer, len1); + ptr = alist->auxs.symbols[i]->data.atom->string; + len2 = strlen(ptr); + LispWriteStr(NIL, ptr, len2); + LispWriteChars(NIL, ' ', 28 - (len1 + len2)); + LispWriteStr(NIL, "; aux\n", 7); + } + } + } + + LispWriteStr(NIL, "\nBytecode stream:\n", 18); + + base = stream; + for (done = j = 0; !done; j = 0) { + sym0 = sym1 = con0 = con1 = bui0 = byt0 = strd = strf = -1; + sprintf(buffer, "%4ld ", (long)(stream - base)); + ptr = buffer + strlen(buffer); + switch (*stream++) { + case XBC_NOOP: strcpy(ptr, "NOOP"); break; + case XBC_PRED: + strcpy(ptr, "PRED:"); + ptr += strlen(ptr); + goto predicate; + case XBC_INV: strcpy(ptr, "INV"); break; + case XBC_NIL: strcpy(ptr, "NIL"); break; + case XBC_T: strcpy(ptr, "T"); break; + case XBC_CAR: strcpy(ptr, "CAR"); break; + case XBC_CDR: strcpy(ptr, "CDR"); break; + case XBC_RPLACA:strcpy(ptr, "RPLACA"); break; + case XBC_RPLACD:strcpy(ptr, "RPLACD"); break; + case XBC_EQ: strcpy(ptr, "EQ"); break; + case XBC_EQL: strcpy(ptr, "EQL"); break; + case XBC_EQUAL: strcpy(ptr, "EQUAL"); break; + case XBC_EQUALP:strcpy(ptr, "EQUALP"); break; + case XBC_LENGTH:strcpy(ptr, "LENGTH"); break; + case XBC_LAST: strcpy(ptr, "LAST"); break; + case XBC_NTHCDR:strcpy(ptr, "NTHCDR"); break; + case XBC_PUSH: strcpy(ptr, "PUSH"); break; + case XBC_CAR_PUSH: + strcpy(ptr, "CAR&PUSH"); + break; + case XBC_CDR_PUSH: + strcpy(ptr, "CDR&PUSH"); + break; + case XBC_PUSH_NIL: + strcpy(ptr, "PUSH NIL"); + break; + case XBC_PUSH_UNSPEC: + strcpy(ptr, "PUSH #<UNSPEC>"); + break; + case XBC_PUSH_T: + strcpy(ptr, "PUSH T"); + break; + case XBC_PUSH_NIL_N: + strcpy(ptr, "PUSH NIL "); + ptr += strlen(ptr); + sprintf(ptr, "%d", (int)(*stream++)); + break; + case XBC_PUSH_UNSPEC_N: + strcpy(ptr, "PUSH #<UNSPEC> "); + ptr += strlen(ptr); + sprintf(ptr, "%d", (int)(*stream++)); + break; + case XBC_LET: + strcpy(ptr, "LET"); +/* update sym0 */ +symbol: + offsets[j++] = &sym0; +/* update <offsets> - print [byte] */ +offset: + ptr += strlen(ptr); + i = *stream++; + *(offsets[j - 1]) = i; + sprintf(ptr, " [%d]", i); + break; + case XBC_LETX: + strcpy(ptr, "LET*"); + goto symbol; + case XBC_LET_NIL: + strcpy(ptr, "LET NIL"); + goto symbol; + case XBC_LETX_NIL: + strcpy(ptr, "LET* NIL"); + goto symbol; + case XBC_LETBIND: + strcpy(ptr, "LETBIND"); +/* print byte */ +value: + ptr += strlen(ptr); + sprintf(ptr, " %d", (int)(*stream++)); + break; + case XBC_UNLET:strcpy(ptr, "UNLET"); goto value; + case XBC_LOAD: + strcpy(ptr, "LOAD"); +/* print (byte) */ +reference: + ptr += strlen(ptr); + i = *stream++; + sprintf(ptr, " (%d)", i); + break; + case XBC_LOAD_CAR: + strcpy(ptr, "LOAD&CAR"); + goto reference; + case XBC_LOAD_CDR: + strcpy(ptr, "LOAD&CDR"); + goto reference; + case XBC_LOAD_CAR_STORE: + strcpy(ptr, "LOAD&CAR&STORE"); + goto reference; + case XBC_LOAD_CDR_STORE: + strcpy(ptr, "LOAD&CDR&STORE"); + goto reference; + case XBC_LOAD_LET: + strcpy(ptr, "LOAD&LET"); +load_let: + offsets[j++] = &sym0; + i = *stream++; + ptr += strlen(ptr); + sprintf(ptr, " (%d)", i); + goto offset; + case XBC_LOAD_LETX: + strcpy(ptr, "LOAD&LET*"); + goto load_let; + case XBC_STRUCT: + strcpy(ptr, "STRUCT"); + offsets[j++] = &strf; + offsets[j++] = &strd; +/* update <offsets> - print [byte] - update <offsets> - print [byte] */ +offset_offset: + ptr += strlen(ptr); + i = *stream++; + *(offsets[j - 2]) = i; + sprintf(ptr, " [%d]", i); + goto offset; + case XBC_LOAD_PUSH: + strcpy(ptr, "LOAD&PUSH"); + goto reference; + case XBC_LOADCON: + strcpy(ptr, "LOADCON"); +constant: + offsets[j++] = &con0; + goto offset; + case XBC_LOADCON_SET: + strcpy(ptr, "LOADCON&SET"); + offsets[j++] = &con0; +/* update <offsets> - print [byte] - print (byte) */ +offset_reference: + i = *stream++; + *(offsets[j - 1]) = i; + ptr += strlen(ptr); + sprintf(ptr, " [%d]", i); + goto reference; + case XBC_STRUCTP: + strcpy(ptr, "STRUCTP"); + offsets[j++] = &strd; + goto offset; + case XBC_LOADCON_LET: + strcpy(ptr, "LOADCON&LET"); +loadcon_let: + offsets[j++] = &con0; + offsets[j++] = &sym0; + goto offset_offset; + case XBC_LOADCON_LETX: + strcpy(ptr, "LOADCON&LET*"); + goto loadcon_let; + case XBC_LOADCON_PUSH: + strcpy(ptr, "LOADCON&PUSH"); + goto constant; + case XBC_LOADSYM: + strcpy(ptr, "LOADSYM"); + goto symbol; + case XBC_LOADSYM_LET: + strcpy(ptr, "LOADSYM&LET"); +loadsym_let: + offsets[j++] = &sym0; + offsets[j++] = &sym1; + goto offset_offset; + case XBC_LOADSYM_LETX: + strcpy(ptr, "LOADSYM&LET*"); + goto loadsym_let; + case XBC_LOADSYM_PUSH: + strcpy(ptr, "LOADSYM&PUSH"); + goto symbol; + case XBC_LOAD_SET: + strcpy(ptr, "LOAD&SET"); +/* print (byte) - print (byte) */ +reference_reference: + ptr += strlen(ptr); + i = *stream++; + sprintf(ptr, " (%d)", i); + goto reference; + case XBC_LOAD_CAR_SET: + strcpy(ptr, "LOAD&CAR&SET"); + goto reference_reference; + case XBC_LOAD_CDR_SET: + strcpy(ptr, "LOAD&CDR&SET"); + goto reference_reference; + case XBC_CAR_SET: + strcpy(ptr, "CAR&SET"); + goto reference; + case XBC_CDR_SET: + strcpy(ptr, "CDR&SET"); + goto reference; + case XBC_SET: + strcpy(ptr, "SET"); + goto reference; + case XBC_SETSYM: + strcpy(ptr, "SETSYM"); + goto symbol; + case XBC_SET_NIL: + strcpy(ptr, "SET NIL"); + goto reference; + case XBC_CALL: + strcpy(ptr, "CALL"); + ptr += strlen(ptr); + sprintf(ptr, " %d", (int)(*stream++)); + offsets[j++] = &bui0; + goto offset; + case XBC_CALL_SET: + strcpy(ptr, "CALL&SET"); + ptr += strlen(ptr); + sprintf(ptr, " %d", (int)(*stream++)); + offsets[j++] = &bui0; + goto offset_reference; + case XBC_BYTECALL: + strcpy(ptr, "BYTECALL"); + ptr += strlen(ptr); + sprintf(ptr, " %d", (int)(*stream++)); + offsets[j++] = &byt0; + goto offset; + case XBC_FUNCALL: + strcpy(ptr, "FUNCALL"); +constant_constant: + offsets[j++] = &con0; + offsets[j++] = &con1; + goto offset_offset; + case XBC_CCONS: + strcpy(ptr, "CCONS"); + goto constant_constant; + case XBC_CSTAR: strcpy(ptr, "CSTAR"); break; + case XBC_CFINI: strcpy(ptr, "CFINI"); break; + case XBC_LSTAR: strcpy(ptr, "LSTAR"); break; + case XBC_LCONS: strcpy(ptr, "LCONS"); break; + case XBC_LFINI: strcpy(ptr, "LFINI"); break; + case XBC_BCONS: strcpy(ptr, "BCONS"); break; + case XBC_BCONS1: case XBC_BCONS2: case XBC_BCONS3: + case XBC_BCONS4: case XBC_BCONS5: case XBC_BCONS6: + case XBC_BCONS7: + strcpy(ptr, "BCONS"); + ptr += strlen(ptr); + sprintf(ptr, "%d", (int)(stream[-1] - XBC_BCONS)); + break; + case XBC_JUMP: + strcpy(ptr, "JUMP"); +integer: + ptr += strlen(ptr); + sprintf(ptr, " %d", *(signed short*)stream); + stream += sizeof(short); + break; + case XBC_JUMPT: + strcpy(ptr, "JUMPT"); + goto integer; + case XBC_JUMPNIL: + strcpy(ptr, "JUMPNIL"); + goto integer; + case XBC_LETREC: + strcpy(ptr, "LETREC"); + ptr += strlen(ptr); + sprintf(ptr, " %d", (int)*stream++); + break; + case XBC_RETURN: + strcpy(ptr, "RETURN"); + done = 1; + break; + } + i = ptr - buffer + strlen(ptr); + LispWriteStr(NIL, buffer, i); + if (j) { + + /* Pad */ + LispWriteChars(NIL, ' ', 28 - i); + LispWriteChar(NIL, ';'); + + ptr = buffer; + + /* Structure */ + if (strf >= 0) { + /* strd is valid if strf set */ + LispObj *fields = constants[strd]; + + for (; strf >= 0; strf--) + fields = CDR(fields); + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, CAR(fields)->data.atom->string); + ptr += strlen(ptr); + } + if (strd >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, STROBJ(CAR(constants[strd]))); + ptr += strlen(ptr); + } + + /* Constants */ + if (con0 >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, STROBJ(constants[con0])); + ptr += strlen(ptr); + if (con1 >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, STROBJ(constants[con1])); + ptr += strlen(ptr); + } + } + + /* Builtin */ + if (bui0 >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, STROBJ(builtins[bui0]->symbol)); + ptr += strlen(ptr); + } + + /* Bytecode */ + if (byt0 >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, STROBJ(names[byt0])); + ptr += strlen(ptr); + } + + /* Symbols */ + if (sym0 >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, XSTRING(symbols[sym0]->string)); + ptr += strlen(ptr); + if (sym1 >= 0) { + strcpy(ptr, " "); ptr += 2; + strcpy(ptr, XSTRING(symbols[sym1]->string)); + ptr += strlen(ptr); + } + } + + i = ptr - buffer; + LispWriteStr(NIL, buffer, i); + } + LispWriteChar(NIL, '\n'); + continue; +predicate: + switch (*stream++) { + case XBP_CONSP: strcpy(ptr, "CONSP"); break; + case XBP_LISTP: strcpy(ptr, "LISTP"); break; + case XBP_NUMBERP: strcpy(ptr, "NUMBERP"); break; + } + LispWriteStr(NIL, buffer, ptr - buffer + strlen(ptr)); + LispWriteChar(NIL, '\n'); + } +#undef XSTRING + } + + return (function); +} + + + +LispObj * +LispCompileForm(LispObj *form) +{ + GC_ENTER(); + int failed, *pfailed; + LispCom com; + LispObj *code, **pform; + + if (!CONSP(form)) + /* Incorrect call or NIL */ + return (form); + + memset(&com, 0, sizeof(LispCom)); + + com.toplevel = com.block = LispCalloc(1, sizeof(CodeBlock)); + com.block->type = LispBlockNone; + com.lex = lisp__data.env.lex; + + com.plist = CONS(NIL, NIL); + GC_PROTECT(com.plist); + + pfailed = &failed; + pform = &form; + failed = 1; + if (setjmp(com.jmp) == 0) { + for (code = form; CONSP(form); form = CDR(form)) { + com.form = form; + ComEval(&com, CAR(form)); + } + failed = 0; + } + GC_LEAVE(); + + return (failed ? NIL : MakeBytecodeObject(&com, NIL, NIL)); +} + +LispObj * +LispExecuteBytecode(LispObj *object) +{ + if (!BYTECODEP(object)) + return (EVAL(object)); + + return (ExecuteBytecode(object->data.bytecode.bytecode->code)); +} + +static LispObj * +MakeBytecodeObject(LispCom *com, LispObj *name, LispObj *plist) +{ + LispObj *object; + LispBytecode *bytecode; + + GC_ENTER(); + unsigned char *stream; + short i, num_constants; + LispObj **constants, *code, *cons, *prev; + + /* Resolve dependencies, optimize and create byte stream */ + LinkBytecode(com); + + object = LispNew(NIL, NIL); + GC_PROTECT(object); + bytecode = LispMalloc(sizeof(LispBytecode)); + bytecode->code = com->bytecode; + bytecode->length = com->length; + + + stream = bytecode->code; + + /* Skip stack information */ + stream += sizeof(short) * 3; + + /* Get information */ + num_constants = *(short*)stream; + stream += sizeof(short) * 4; + constants = (LispObj**)stream; + + GC_PROTECT(plist); + code = cons = prev = NIL; + for (i = 0; i < num_constants; i++) { + if (POINTERP(constants[i]) && !XSYMBOLP(constants[i])) { + if (code == NIL) { + code = cons = prev = CONS(constants[i], NIL); + GC_PROTECT(code); + } + else { + RPLACD(cons, CONS(constants[i], NIL)); + prev = cons; + cons = CDR(cons); + } + } + } + + /* Protect this in case the function is redefined */ + for (i = 0; i < com->table.num_bytecodes; i++) { + if (code == NIL) { + code = cons = prev = CONS(com->table.bytecodes[i], NIL); + GC_PROTECT(code); + } + else { + RPLACD(cons, CONS(com->table.bytecodes[i], NIL)); + prev = cons; + cons = CDR(cons); + } + } + + /* Free everything, but the LispCom structure and the generated bytecode */ + CompileFreeState(com); + + /* Allocate the minimum required number of cons cells to protect objects */ + if (!CONSP(code)) + code = plist; + else if (CONSP(plist)) { + if (code == cons) + RPLACD(code, plist); + else + RPLACD(cons, plist); + } + else { + if (code == cons) + code = CAR(code); + else + CDR(prev) = CAR(cons); + } + + object->data.bytecode.bytecode = bytecode; + /* Byte code references this object, so it cannot be garbage collected */ + object->data.bytecode.code = code; + object->data.bytecode.name = name; + object->type = LispBytecode_t; + + LispMused(bytecode); + LispMused(bytecode->code); + GC_LEAVE(); + + return (object); +} + +static void +CompileFreeTree(CodeTree *tree) +{ + if (tree->type == CodeTreeBlock) + CompileFreeBlock(tree->data.block); + LispFree(tree); +} + +static void +CompileFreeBlock(CodeBlock *block) +{ + CodeTree *tree = block->tree, *next; + + while (tree) { + next = tree->next; + CompileFreeTree(tree); + tree = next; + } + if (block->type == LispBlockBody) { + LispFree(block->tagbody.labels); + LispFree(block->tagbody.codes); + } + LispFree(block->variables.symbols); + LispFree(block->variables.flags); + LispFree(block); +} + +static void +CompileFreeState(LispCom *com) +{ + CompileFreeBlock(com->block); + LispFree(com->table.constants); + LispFree(com->table.symbols); + LispFree(com->table.builtins); + LispFree(com->table.bytecodes); +} + +/* XXX Put a breakpoint here when changing the macro expansion code. + * No opcodes should be generated during macro expansion. */ +static CodeTree * +CompileNewTree(LispCom *com, CodeTreeType type) +{ + CodeTree *tree = LispMalloc(sizeof(CodeTree)); + + tree->type = type; + tree->next = NULL; + tree->block = com->block; + if (com->block->tree == NULL) + com->block->tree = tree; + else + com->block->tail->next = tree; + com->block->tail = tree; + + return (tree); +} + +static void +CompileIniBlock(LispCom *com, LispBlockType type, LispObj *tag) +{ + CodeTree *tree = NEW_TREE(CodeTreeBlock); + CodeBlock *block = LispCalloc(1, sizeof(CodeBlock)); + + tree->data.block = block; + + block->type = type; + block->tag = tag; + block->prev = com->block; + block->parent = tree; + block->level = com->level; + com->block = block; + + if (type == LispBlockBody) + com->tagbody = com->level; +} + +static void +CompileFiniBlock(LispCom *com) +{ + com->block = com->block->prev; + if (com->block && com->block->type == LispBlockBody) + com->tagbody = com->block->level; +} + +static void +com_BytecodeChar(LispCom *com, LispByteOpcode code, char value) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = code; + tree->data.signed_char = value; +} + +static void +com_BytecodeShort(LispCom *com, LispByteOpcode code, short value) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = code; + tree->data.signed_short = value; +} + +static void +com_BytecodeAtom(LispCom *com, LispByteOpcode code, LispAtom *atom) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = code; + tree->data.atom = atom; +} + +static void +com_BytecodeObject(LispCom *com, LispByteOpcode code, LispObj *object) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = code; + tree->data.object = object; +} + +static void +com_BytecodeCons(LispCom *com, LispByteOpcode code, LispObj *car, LispObj *cdr) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = code; + tree->data.cons.car = car; + tree->data.cons.cdr = cdr; +} + +static void +com_Bytecode(LispCom *com, LispByteOpcode code) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = code; +} + +static void +com_Load(LispCom *com, short offset) +{ + com_BytecodeShort(com, XBC_LOAD, offset); +} + +static void +com_LoadLet(LispCom *com, short offset, LispAtom *name) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = XBC_LOAD_LET; + tree->data.let.offset = offset; + tree->data.let.name = name; +} + +static void +com_LoadPush(LispCom *com, short offset) +{ + com_BytecodeShort(com, XBC_LOAD_PUSH, offset); +} + +static void +com_Let(LispCom *com, LispAtom *name) +{ + com_BytecodeAtom(com, XBC_LET, name); +} + +static void +com_Bind(LispCom *com, short count) +{ + if (count) + com_BytecodeShort(com, XBC_LETBIND, count); +} + +static void +com_Unbind(LispCom *com, short count) +{ + if (count) + com_BytecodeShort(com, XBC_UNLET, count); +} + +static void +com_LoadSym(LispCom *com, LispAtom *atom) +{ + com_BytecodeAtom(com, XBC_LOADSYM, atom); +} + +static void +com_LoadSymLet(LispCom *com, LispAtom *symbol, LispAtom *name) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = XBC_LOADSYM_LET; + tree->data.let_sym.symbol = symbol; + tree->data.let_sym.name = name; +} + +static void +com_LoadSymPush(LispCom *com, LispAtom *name) +{ + com_BytecodeAtom(com, XBC_LOADSYM_PUSH, name); +} + +static void +com_LoadCon(LispCom *com, LispObj *constant) +{ + if (constant == NIL) + com_Bytecode(com, XBC_NIL); + else if (constant == T) + com_Bytecode(com, XBC_T); + else if (constant == UNSPEC) { + COMPILE_FAILURE("internal error: loading #<UNSPEC>"); + } + else + com_BytecodeObject(com, XBC_LOADCON, constant); +} + +static void +com_LoadConLet(LispCom *com, LispObj *constant, LispAtom *name) +{ + if (constant == NIL) + com_BytecodeAtom(com, XBC_LET_NIL, name); + else { + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = XBC_LOADCON_LET; + tree->data.let_con.object = constant; + tree->data.let_con.name = name; + } +} + +static void +com_LoadConPush(LispCom *com, LispObj *constant) +{ + if (constant == NIL) + com_Bytecode(com, XBC_PUSH_NIL); + else if (constant == T) + com_Bytecode(com, XBC_PUSH_T); + else if (constant == UNSPEC) + com_Bytecode(com, XBC_PUSH_UNSPEC); + else + com_BytecodeObject(com, XBC_LOADCON_PUSH, constant); +} + +static void +com_Set(LispCom *com, short offset) +{ + com_BytecodeShort(com, XBC_SET, offset); +} + +static void +com_SetSym(LispCom *com, LispAtom *symbol) +{ + com_BytecodeAtom(com, XBC_SETSYM, symbol); +} + +static void +com_Struct(LispCom *com, short offset, LispObj *definition) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = XBC_STRUCT; + tree->data.struc.offset = offset; + tree->data.struc.definition = definition; +} + +static void +com_Structp(LispCom *com, LispObj *definition) +{ + com_BytecodeObject(com, XBC_STRUCTP, definition); +} + +static void +com_Call(LispCom *com, unsigned char num_arguments, LispBuiltin *builtin) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = XBC_CALL; + tree->data.builtin.num_arguments = num_arguments; + tree->data.builtin.builtin = builtin; +} + +static void +com_Bytecall(LispCom *com, unsigned char num_arguments, LispObj *code) +{ + CodeTree *tree = NEW_TREE(CodeTreeBytecode); + + tree->code = XBC_BYTECALL; + tree->data.bytecall.num_arguments = num_arguments; + tree->data.bytecall.code = code; +} + +static void +com_Funcall(LispCom *com, LispObj *function, LispObj *arguments) +{ + com_BytecodeCons(com, XBC_FUNCALL, function, arguments); +} + +static void +CompileStackEnter(LispCom *com, int count, int builtin) +{ + if (!com->macro) { + if (builtin) { + com->stack.cbstack += count; + if (com->stack.bstack < com->stack.cbstack) + com->stack.bstack = com->stack.cbstack; + } + else { + com->stack.cstack += count; + if (com->stack.stack < com->stack.cstack) + com->stack.stack = com->stack.cstack; + } + } +} + +static void +CompileStackLeave(LispCom *com, int count, int builtin) +{ + if (!com->macro) { + if (builtin) + com->stack.cbstack -= count; + else + com->stack.cstack -= count; + } +} + +static void +LinkWarnUnused(LispCom *com, CodeBlock *block) +{ + int i; + CodeTree *tree; + + for (tree = block->tree; tree; tree = tree->next) { + if (tree->type == CodeTreeBlock) + LinkWarnUnused(com, tree->data.block); + } + + for (i = 0; i < block->variables.length; i++) + if (!(block->variables.flags[i] & (VARIABLE_USED | VARIABLE_ARGUMENT))) { + ++com->warnings; + LispWarning("the variable %s is unused", + block->variables.symbols[i]->string); + } +} + +#define INTERNAL_ERROR_STRING "COMPILE: internal error #%d" +#define INTERNAL_ERROR(value) LispDestroy(INTERNAL_ERROR_STRING, value) +static long +LinkBuildOffsets(LispCom *com, CodeTree *tree, long offset) +{ + for (; tree; tree = tree->next) { + tree->offset = offset; + switch (tree->type) { + case CodeTreeBytecode: + switch (tree->code) { + case XBC_NOOP: + INTERNAL_ERROR(__LINE__); + break; + + /* byte */ + case XBC_BCONS: + case XBC_BCONS1: + case XBC_BCONS2: + case XBC_BCONS3: + case XBC_BCONS4: + case XBC_BCONS5: + case XBC_BCONS6: + case XBC_BCONS7: + case XBC_INV: + case XBC_NIL: + case XBC_T: + case XBC_PUSH: + case XBC_CAR_PUSH: + case XBC_CDR_PUSH: + case XBC_PUSH_NIL: + case XBC_PUSH_UNSPEC: + case XBC_PUSH_T: + case XBC_LSTAR: + case XBC_LCONS: + case XBC_LFINI: + case XBC_RETURN: + case XBC_CSTAR: + case XBC_CFINI: + case XBC_CAR: + case XBC_CDR: + case XBC_RPLACA: + case XBC_RPLACD: + case XBC_EQ: + case XBC_EQL: + case XBC_EQUAL: + case XBC_EQUALP: + case XBC_LENGTH: + case XBC_LAST: + case XBC_NTHCDR: + ++offset; + break; + + /* byte + byte */ + case XBC_PUSH_NIL_N: + case XBC_PUSH_UNSPEC_N: + case XBC_PRED: + case XBC_LETREC: + case XBC_LOAD_PUSH: + case XBC_CAR_SET: + case XBC_CDR_SET: + case XBC_SET: + case XBC_SET_NIL: + case XBC_LETBIND: + case XBC_UNLET: + case XBC_LOAD: + case XBC_LOAD_CAR: + case XBC_LOAD_CDR: + case XBC_LOAD_CAR_STORE: + case XBC_LOAD_CDR_STORE: + case XBC_LET: + case XBC_LETX: + case XBC_LET_NIL: + case XBC_LETX_NIL: + case XBC_STRUCTP: + case XBC_SETSYM: + case XBC_LOADCON_PUSH: + case XBC_LOADSYM_PUSH: + case XBC_LOADCON: + case XBC_LOADSYM: + offset += 2; + break; + + /* byte + byte + byte */ + case XBC_CALL: + case XBC_BYTECALL: + case XBC_LOAD_SET: + case XBC_LOAD_CAR_SET: + case XBC_LOAD_CDR_SET: + case XBC_LOADCON_SET: + case XBC_LOAD_LET: + case XBC_LOAD_LETX: + case XBC_STRUCT: + case XBC_LOADCON_LET: + case XBC_LOADCON_LETX: + case XBC_LOADSYM_LET: + case XBC_LOADSYM_LETX: + case XBC_CCONS: + case XBC_FUNCALL: + offset += 3; + break; + + /* byte + short */ + case XBC_JUMP: + case XBC_JUMPT: + case XBC_JUMPNIL: + /* XXX this is likely a jump to random address here */ + INTERNAL_ERROR(__LINE__); + offset += sizeof(short) + 1; + break; + + /* byte + byte + byte + byte */ + case XBC_CALL_SET: + offset += 4; + break; + } + break; + case CodeTreeLabel: + /* Labels are not loaded */ + break; + case CodeTreeJump: + case CodeTreeJumpIf: + case CodeTreeCond: + /* If not the point where the conditional block finishes */ + if (tree->code != XBC_NOOP) + /* Reserve space for the jump opcode */ + offset += sizeof(short) + 1; + break; + case CodeTreeGo: + case CodeTreeReturn: + /* Reserve space for the jump opcode */ + offset += sizeof(short) + 1; + break; + case CodeTreeBlock: + offset = LinkBuildOffsets(com, tree->data.block->tree, offset); + break; + } + } + + return (offset); +} + +static void +LinkDoOptimize_0(LispCom *com, CodeBlock *block) +{ + CodeTree *tree, *prev, *next; + + /* Remove redundant or join opcodes that can be joined. Do it here + * because some of these are hard to detect earlier, and/or would + * require a lot of duplicated code or more time. */ + tree = prev = block->tree; + while (tree) { + next = tree->next; + + /* LET -> LET* */ + if (next && + next->type == CodeTreeBytecode && + next->code == XBC_LETBIND && + next->data.signed_short == 1) { + switch (tree->code) { + case XBC_LET: + tree->code = XBC_LETX; + goto remove_next_label; + case XBC_LET_NIL: + tree->code = XBC_LETX_NIL; + goto remove_next_label; + case XBC_LOAD_LET: + tree->code = XBC_LOAD_LETX; + goto remove_next_label; + case XBC_LOADCON_LET: + tree->code = XBC_LOADCON_LETX; + goto remove_next_label; + case XBC_LOADSYM_LET: + tree->code = XBC_LOADSYM_LETX; + goto remove_next_label; + default: + break; + } + } + + switch (tree->type) { + case CodeTreeBytecode: + switch (tree->code) { + case XBC_LOADCON: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_LET: + next->code = XBC_LOADCON_LET; + next->data.let_con.name = + next->data.atom; + next->data.let_con.object = + tree->data.object; + goto remove_label; + case XBC_PUSH: + next->code = XBC_LOADCON_PUSH; + next->data.object = tree->data.object; + goto remove_label; + case XBC_CAR: + if (tree->data.object != NIL) { + if (!CONSP(tree->data.object)) + LispDestroy("CAR: %s is not a list", + STROBJ( + tree->data.object)); + next->code = XBC_LOADCON; + next->data.object = + CAR(tree->data.object); + } + goto remove_label; + case XBC_CDR: + if (tree->data.object != NIL) { + if (!CONSP(tree->data.object)) + LispDestroy("CAR: %s is not a list", + STROBJ( + tree->data.object)); + next->code = XBC_LOADCON; + next->data.object = + CDR(tree->data.object); + } + goto remove_label; + case XBC_SET: + next->code = XBC_LOADCON_SET; + next->data.load_con_set.offset = + next->data.signed_short; + next->data.load_con_set.object = + tree->data.object; + goto remove_label; + default: + break; + } + } + break; + case XBC_LOADSYM: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_LET: + next->code = XBC_LOADSYM_LET; + next->data.let_sym.name = + next->data.atom; + next->data.let_sym.symbol = + tree->data.atom; + goto remove_label; + case XBC_PUSH: + next->code = XBC_LOADSYM_PUSH; + next->data.atom = tree->data.atom; + goto remove_label; + default: + break; + } + } + break; + case XBC_LOAD: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_SET: + next->code = XBC_LOAD_SET; + next->data.load_set.set = + next->data.signed_short; + next->data.load_set.load = + tree->data.signed_short; + goto remove_label; + /* TODO add XBC_LOAD_SETSYM */ + case XBC_CAR: + next->code = XBC_LOAD_CAR; + next->data.signed_short = + tree->data.signed_short; + goto remove_label; + case XBC_CDR: + next->code = XBC_LOAD_CDR; + next->data.signed_short = + tree->data.signed_short; + goto remove_label; + case XBC_PUSH: + tree->code = XBC_LOAD_PUSH; + goto remove_next_label; + case XBC_LET: + next->code = XBC_LOAD_LET; + next->data.let.name = next->data.atom; + next->data.let.offset = + tree->data.signed_short; + goto remove_label; + default: + break; + } + } + break; + case XBC_LOAD_CAR: + if (next && next->type == CodeTreeBytecode && + next->code == XBC_SET) { + if (next->data.signed_short == + tree->data.signed_short) + next->code = XBC_LOAD_CAR_STORE; + else { + next->code = XBC_LOAD_CAR_SET; + next->data.load_set.set = + next->data.signed_short; + next->data.load_set.load = + tree->data.signed_short; + } + goto remove_label; + } + break; + case XBC_LOAD_CDR: + if (next && next->type == CodeTreeBytecode && + next->code == XBC_SET) { + if (next->data.signed_short == + tree->data.signed_short) + next->code = XBC_LOAD_CDR_STORE; + else { + next->code = XBC_LOAD_CDR_SET; + next->data.load_set.set = + next->data.signed_short; + next->data.load_set.load = + tree->data.signed_short; + } + goto remove_label; + } + break; + case XBC_CALL: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_SET: + next->code = XBC_CALL_SET; + next->data.builtin.offset = + next->data.signed_short; + next->data.builtin.num_arguments = + tree->data.builtin.num_arguments; + next->data.builtin.builtin = + tree->data.builtin.builtin; + goto remove_label; + /* TODO add XBC_CALL_SETSYM */ + default: + break; + } + } + break; + case XBC_CAR: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_SET: + next->code = XBC_CAR_SET; + goto remove_label; + /* TODO add XBC_CAR_SETSYM */ + case XBC_PUSH: + next->code = XBC_CAR_PUSH; + goto remove_label; + default: + break; + } + } + break; + case XBC_CDR: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_SET: + next->code = XBC_CDR_SET; + goto remove_label; + /* TODO add XBC_CDR_SETSYM */ + case XBC_PUSH: + next->code = XBC_CDR_PUSH; + goto remove_label; + default: + break; + } + } + break; + case XBC_NIL: + if (next && next->type == CodeTreeBytecode) { + switch (next->code) { + case XBC_SET: + next->code = XBC_SET_NIL; + goto remove_label; + /* TODO add XBC_SETSYM_NIL */ + default: + break; + } + } + break; + case XBC_PUSH_NIL: + if (next && next->type == CodeTreeBytecode && + next->code == XBC_PUSH_NIL) { + next->code = XBC_PUSH_NIL_N; + next->data.signed_char = 2; + goto remove_label; + } + break; + case XBC_PUSH_NIL_N: + if (next && next->type == CodeTreeBytecode && + next->code == XBC_PUSH_NIL) { + next->code = XBC_PUSH_NIL_N; + next->data.signed_char = tree->data.signed_char + 1; + goto remove_label; + } + break; + case XBC_PUSH_UNSPEC: + if (next && next->type == CodeTreeBytecode && + next->code == XBC_PUSH_UNSPEC) { + next->code = XBC_PUSH_UNSPEC_N; + next->data.signed_char = 2; + goto remove_label; + } + break; + case XBC_PUSH_UNSPEC_N: + if (next && next->type == CodeTreeBytecode && + next->code == XBC_PUSH_UNSPEC) { + next->code = XBC_PUSH_UNSPEC_N; + next->data.signed_char = tree->data.signed_char + 1; + goto remove_label; + } + break; + default: + break; + } + break; + case CodeTreeBlock: + LinkDoOptimize_0(com, tree->data.block); + break; + default: + break; + } + goto update_label; +remove_label: + if (tree == block->tree) { + block->tree = prev = next; + if (tree == block->tail) + block->tail = tree; + } + else + prev->next = next; + CompileFreeTree(tree); + tree = next; + continue; +remove_next_label: + tree->next = next->next; + CompileFreeTree(next); + continue; +update_label: + prev = tree; + tree = tree->next; + } +} + +static void +LinkOptimize_0(LispCom *com) +{ + /* Recursive */ + LinkDoOptimize_0(com, com->block); +} + +static void +LinkResolveLabels(LispCom *com, CodeBlock *block) +{ + int i; + CodeTree *tree = block->tree; + + for (; tree; tree = tree->next) { + if (tree->type == CodeTreeBlock) + LinkResolveLabels(com, tree->data.block); + else if (tree->type == CodeTreeLabel) { + for (i = 0; i < block->tagbody.length; i++) + if (tree->data.object == block->tagbody.labels[i]) { + block->tagbody.codes[i] = tree; + break; + } + } + } +} + +static void +LinkResolveJumps(LispCom *com, CodeBlock *block) +{ + int i; + CodeBlock *body = block; + CodeTree *ptr, *tree = block->tree; + + /* Check if there is a tagbody. Error checking already done */ + while (body && body->type != LispBlockBody) + body = body->prev; + + for (; tree; tree = tree->next) { + switch (tree->type) { + case CodeTreeBytecode: + case CodeTreeLabel: + break; + + case CodeTreeBlock: + LinkResolveJumps(com, tree->data.block); + break; + + case CodeTreeGo: + for (i = 0; i < body->tagbody.length; i++) + if (tree->data.object == body->tagbody.labels[i]) + break; + if (i == body->tagbody.length) + LispDestroy("COMPILE: no visible tag %s to GO", + STROBJ(tree->data.object)); + /* Now the jump code is known */ + tree->data.tree = body->tagbody.codes[i]; + break; + + case CodeTreeCond: + if (tree->code == XBC_JUMPNIL) + /* If test is NIL, go to next test */ + tree->data.tree = tree->group->next; + else if (tree->code == XBC_JUMPT) { + /* After executing code, test was T */ + for (ptr = tree->group; + ptr->code != XBC_NOOP; + ptr = ptr->group) + ; + tree->data.tree = ptr; + } + break; + + case CodeTreeJumpIf: + if (tree->code != XBC_NOOP) { + for (ptr = tree->group; + ptr->code != XBC_NOOP; + ptr = ptr->group) { + if (ptr->type == CodeTreeJump) { + /* ELSE code of IF */ + ptr = ptr->next; + /* Skip inconditional jump node */ + break; + } + } + tree->data.tree = ptr; + } + break; + + case CodeTreeJump: + if (tree->code != XBC_NOOP) + tree->data.tree = tree->group; + break; + + case CodeTreeReturn: + /* One bytecode is guaranteed to exist in the code tree */ + if (tree->data.block->parent == NULL) + /* Returning from the function or toplevel form */ + tree->data.tree = tree->data.block->tail; + else { + for (;;) { + ptr = tree->data.block->parent->next; + if (ptr) { + tree->data.tree = ptr; + break; + } + else + /* Move one BLOCK up */ + tree->data.block = tree->data.block->prev; + } + } + break; + } + } +} + +static long +LinkPad(long offset, long adjust, int preffix, int datalen) +{ + /* If byte or aligned data */ + if (datalen <= preffix || ((offset + adjust + preffix) % datalen) == 0) + return (adjust); + + return (adjust + (datalen - ((offset + adjust + preffix) % datalen))); +} + +static long +LinkFixupOffsets(LispCom *com, CodeTree *tree, long adjust) +{ + for (; tree; tree = tree->next) { + switch (tree->type) { + case CodeTreeBytecode: + switch (tree->code) { + /* byte + short */ + case XBC_JUMP: + case XBC_JUMPT: + case XBC_JUMPNIL: + adjust = LinkPad(tree->offset, adjust, 1, + sizeof(short)); + /*FALLTROUGH*/ + default: + tree->offset += adjust; + break; + } + break; + case CodeTreeLabel: + /* Labels are not loaded, just adjust offset */ + tree->offset += adjust; + break; + case CodeTreeJump: + case CodeTreeCond: + case CodeTreeJumpIf: + /* If an opcode will be generated. */ + if (tree->code != XBC_NOOP) + adjust = LinkPad(tree->offset, adjust, 1, sizeof(short)); + tree->offset += adjust; + break; + case CodeTreeGo: + case CodeTreeReturn: + adjust = LinkPad(tree->offset, adjust, 1, sizeof(short)); + tree->offset += adjust; + break; + case CodeTreeBlock: + adjust = LinkFixupOffsets(com, tree->data.block->tree, adjust); + break; + } + } + + return (adjust); +} + +static void +LinkSkipPadding(LispCom *com, CodeTree *tree) +{ + int found; + CodeTree *ptr; + + /* Recurse to adjust forward jumps or jumps to the start of the block */ + for (ptr = tree; ptr; ptr = ptr->next) { + if (ptr->type == CodeTreeBlock) { + LinkSkipPadding(com, ptr->data.block->tree); + ptr->offset = ptr->data.block->tree->offset; + } + } + + /* Adjust the nodes offsets */ + for (; tree; tree = tree->next) { + switch (tree->type) { + case CodeTreeBytecode: + case CodeTreeBlock: + case CodeTreeGo: + case CodeTreeReturn: + break; + case CodeTreeJump: + case CodeTreeCond: + case CodeTreeJumpIf: + if (tree->code != XBC_NOOP) + /* If code will be generated */ + break; + case CodeTreeLabel: + /* This should be done in reversed order, but to avoid + * the requirement of a prev pointer, do the job in a + * harder way here. */ + for (found = 0, ptr = tree->next; ptr; ptr = ptr->next) { + switch (ptr->type) { + case CodeTreeBytecode: + case CodeTreeBlock: + case CodeTreeGo: + case CodeTreeReturn: + found = 1; + break; + case CodeTreeJump: + case CodeTreeCond: + case CodeTreeJumpIf: + if (ptr->code != XBC_NOOP) + found = 1; + break; + case CodeTreeLabel: + break; + } + if (found) + break; + } + if (found) + tree->offset = ptr->offset; + break; + } + } +} + +static void +LinkCalculateJump(LispCom *com, CodeTree *tree, LispByteOpcode code) +{ + long jumpto, offset, distance; + + tree->type = CodeTreeBytecode; + /* After the opcode */ + offset = tree->offset + 1; + jumpto = tree->data.tree->offset; + /* Effective distance */ + distance = jumpto - offset; + tree->code = code; + if (distance < -32768 || distance > 32767) { + COMPILE_FAILURE("jump too long"); + } + tree->data.signed_int = distance; +} + +static void +LinkFixupJumps(LispCom *com, CodeTree *tree) +{ + for (; tree; tree = tree->next) { + switch (tree->type) { + case CodeTreeBytecode: + case CodeTreeLabel: + break; + case CodeTreeCond: + if (tree->code == XBC_JUMPNIL) + /* Go to next test if NIL */ + LinkCalculateJump(com, tree, XBC_JUMPNIL); + else if (tree->code == XBC_JUMPT) + /* After executing T code */ + LinkCalculateJump(com, tree, XBC_JUMP); + break; + case CodeTreeJumpIf: + if (tree->code != XBC_NOOP) + LinkCalculateJump(com, tree, tree->code); + break; + case CodeTreeGo: + /* Inconditional jump */ + LinkCalculateJump(com, tree, XBC_JUMP); + break; + case CodeTreeReturn: + /* Inconditional jump */ + if (tree->data.tree != tree) + /* If need to skip something */ + LinkCalculateJump(com, tree, XBC_JUMP); + break; + case CodeTreeBlock: + LinkFixupJumps(com, tree->data.block->tree); + break; + case CodeTreeJump: + if (tree->code != XBC_NOOP) + LinkCalculateJump(com, tree, tree->code); + } + } +} + +static void +LinkBuildTableSymbol(LispCom *com, LispAtom *symbol) +{ + if (BuildTablePointer(symbol, (void***)&com->table.symbols, + &com->table.num_symbols) > 0xff) { + COMPILE_FAILURE("more than 256 symbols"); + } +} + +static void +LinkBuildTableConstant(LispCom *com, LispObj *constant) +{ + if (BuildTablePointer(constant, (void***)&com->table.constants, + &com->table.num_constants) > 0xff) { + COMPILE_FAILURE("more than 256 constants"); + } +} + +static void +LinkBuildTableBuiltin(LispCom *com, LispBuiltin *builtin) +{ + if (BuildTablePointer(builtin, (void***)&com->table.builtins, + &com->table.num_builtins) > 0xff) { + COMPILE_FAILURE("more than 256 functions"); + } +} + +static void +LinkBuildTableBytecode(LispCom *com, LispObj *bytecode) +{ + if (BuildTablePointer(bytecode, (void***)&com->table.bytecodes, + &com->table.num_bytecodes) > 0xff) { + COMPILE_FAILURE("more than 256 bytecode functions"); + } +} + +static void +LinkBuildTables(LispCom *com, CodeBlock *block) +{ + CodeTree *tree; + + for (tree = block->tree; tree; tree = tree->next) { + switch (tree->type) { + case CodeTreeBytecode: + switch (tree->code) { + case XBC_LET: + case XBC_LETX: + case XBC_LET_NIL: + case XBC_LETX_NIL: + case XBC_SETSYM: + case XBC_LOADSYM: + case XBC_LOADSYM_PUSH: + LinkBuildTableSymbol(com, tree->data.atom); + break; + case XBC_STRUCTP: + case XBC_LOADCON: + case XBC_LOADCON_PUSH: + LinkBuildTableConstant(com, tree->data.object); + break; + case XBC_LOADCON_SET: + LinkBuildTableConstant(com, tree->data.load_con_set.object); + break; + case XBC_CALL: + case XBC_CALL_SET: + LinkBuildTableBuiltin(com, tree->data.builtin.builtin); + break; + case XBC_BYTECALL: + LinkBuildTableBytecode(com, tree->data.bytecall.code); + break; + case XBC_LOAD_LET: + case XBC_LOAD_LETX: + LinkBuildTableSymbol(com, tree->data.let.name); + break; + case XBC_STRUCT: + LinkBuildTableConstant(com, tree->data.struc.definition); + break; + case XBC_LOADSYM_LET: + case XBC_LOADSYM_LETX: + LinkBuildTableSymbol(com, tree->data.let_sym.symbol); + LinkBuildTableSymbol(com, tree->data.let_sym.name); + break; + case XBC_LOADCON_LET: + case XBC_LOADCON_LETX: + LinkBuildTableConstant(com, tree->data.let_con.object); + LinkBuildTableSymbol(com, tree->data.let_con.name); + break; + case XBC_CCONS: + case XBC_FUNCALL: + LinkBuildTableConstant(com, tree->data.cons.car); + LinkBuildTableConstant(com, tree->data.cons.cdr); + break; + default: + break; + } + break; + case CodeTreeBlock: + LinkBuildTables(com, tree->data.block); + break; + default: + break; + } + } +} + +static long +LinkEmmitBytecode(LispCom *com, CodeTree *tree, + unsigned char *bytecode, long offset) +{ + short i; + + for (; tree; tree = tree->next) { + /* Fill padding */ + while (offset < tree->offset) + bytecode[offset++] = XBC_NOOP; + + switch (tree->type) { + case CodeTreeBytecode: + bytecode[offset++] = tree->code; + switch (tree->code) { + /* Noop should not enter the CodeTree */ + case XBC_NOOP: + INTERNAL_ERROR(__LINE__); + break; + + /* byte */ + case XBC_BCONS: + case XBC_BCONS1: + case XBC_BCONS2: + case XBC_BCONS3: + case XBC_BCONS4: + case XBC_BCONS5: + case XBC_BCONS6: + case XBC_BCONS7: + case XBC_INV: + case XBC_NIL: + case XBC_T: + case XBC_PUSH_NIL: + case XBC_PUSH_UNSPEC: + case XBC_PUSH_T: + case XBC_CAR_PUSH: + case XBC_CDR_PUSH: + case XBC_PUSH: + case XBC_LSTAR: + case XBC_LCONS: + case XBC_LFINI: + case XBC_RETURN: + case XBC_CSTAR: + case XBC_CFINI: + case XBC_CAR: + case XBC_CDR: + case XBC_RPLACA: + case XBC_RPLACD: + case XBC_EQ: + case XBC_EQL: + case XBC_EQUAL: + case XBC_EQUALP: + case XBC_LENGTH: + case XBC_LAST: + case XBC_NTHCDR: + break; + + /* byte + byte */ + case XBC_LETREC: + case XBC_PRED: + case XBC_PUSH_NIL_N: + case XBC_PUSH_UNSPEC_N: + bytecode[offset++] = tree->data.signed_char; + break; + + /* byte + byte */ + case XBC_CAR_SET: + case XBC_CDR_SET: + case XBC_SET: + case XBC_SET_NIL: + case XBC_LETBIND: + case XBC_UNLET: + case XBC_LOAD_PUSH: + case XBC_LOAD: + case XBC_LOAD_CAR: + case XBC_LOAD_CDR: + case XBC_LOAD_CAR_STORE: + case XBC_LOAD_CDR_STORE: + bytecode[offset++] = tree->data.signed_short; + break; + + /* byte + byte + byte */ + case XBC_LOAD_SET: + case XBC_LOAD_CAR_SET: + case XBC_LOAD_CDR_SET: + bytecode[offset++] = tree->data.load_set.load; + bytecode[offset++] = tree->data.load_set.set; + break; + + /* byte + short */ + case XBC_JUMP: + case XBC_JUMPT: + case XBC_JUMPNIL: + *(short*)(bytecode + offset) = tree->data.signed_int; + offset += sizeof(short); + break; + + /* byte + byte */ + case XBC_LET: + case XBC_LETX: + case XBC_LET_NIL: + case XBC_LETX_NIL: + case XBC_SETSYM: + case XBC_LOADSYM: + case XBC_LOADSYM_PUSH: + i = FindIndex(tree->data.atom, + (void**)com->table.symbols, + com->table.num_symbols); + bytecode[offset++] = i; + break; + + /* byte + byte */ + case XBC_STRUCTP: + case XBC_LOADCON: + case XBC_LOADCON_PUSH: + i = FindIndex(tree->data.object, + (void**)com->table.constants, + com->table.num_constants); + bytecode[offset++] = i; + break; + + /* byte + byte + byte */ + case XBC_LOADCON_SET: + i = FindIndex(tree->data.load_con_set.object, + (void**)com->table.constants, + com->table.num_constants); + bytecode[offset++] = i; + bytecode[offset++] = tree->data.load_con_set.offset; + break; + + /* byte + byte + byte */ + case XBC_CALL: + bytecode[offset++] = tree->data.builtin.num_arguments; + i = FindIndex(tree->data.builtin.builtin, + (void**)com->table.builtins, + com->table.num_builtins); + bytecode[offset++] = i; + break; + + /* byte + byte + byte */ + case XBC_BYTECALL: + bytecode[offset++] = tree->data.bytecall.num_arguments; + i = FindIndex(tree->data.bytecall.code, + (void**)com->table.bytecodes, + com->table.num_bytecodes); + bytecode[offset++] = i; + break; + + /* byte + byte + byte + byte */ + case XBC_CALL_SET: + bytecode[offset++] = tree->data.builtin.num_arguments; + i = FindIndex(tree->data.builtin.builtin, + (void**)com->table.builtins, + com->table.num_builtins); + bytecode[offset++] = i; + bytecode[offset++] = tree->data.builtin.offset; + break; + + /* byte + byte + byte */ + case XBC_LOAD_LET: + case XBC_LOAD_LETX: + bytecode[offset++] = tree->data.let.offset; + i = FindIndex(tree->data.let.name, + (void**)com->table.symbols, + com->table.num_symbols); + bytecode[offset++] = i; + break; + + /* byte + byte + byte */ + case XBC_STRUCT: + bytecode[offset++] = tree->data.struc.offset; + i = FindIndex(tree->data.struc.definition, + (void**)com->table.constants, + com->table.num_constants); + bytecode[offset++] = i; + break; + + /* byte + byte + byte */ + case XBC_LOADSYM_LET: + case XBC_LOADSYM_LETX: + i = FindIndex(tree->data.let_sym.symbol, + (void**)com->table.symbols, + com->table.num_symbols); + bytecode[offset++] = i; + i = FindIndex(tree->data.let_sym.name, + (void**)com->table.symbols, + com->table.num_symbols); + bytecode[offset++] = i; + break; + + /* byte + byte + byte */ + case XBC_LOADCON_LET: + case XBC_LOADCON_LETX: + i = FindIndex(tree->data.let_con.object, + (void**)com->table.constants, + com->table.num_constants); + bytecode[offset++] = i; + i = FindIndex(tree->data.let_con.name, + (void**)com->table.symbols, + com->table.num_symbols); + bytecode[offset++] = i; + break; + + /* byte + byte + byte */ + case XBC_CCONS: + case XBC_FUNCALL: + i = FindIndex(tree->data.cons.car, + (void**)com->table.constants, + com->table.num_constants); + bytecode[offset++] = i; + i = FindIndex(tree->data.cons.cdr, + (void**)com->table.constants, + com->table.num_constants); + bytecode[offset++] = i; + break; + } + break; + case CodeTreeLabel: + /* Labels are not loaded */ + break; + case CodeTreeCond: + case CodeTreeJump: + case CodeTreeJumpIf: + if (tree->code != XBC_NOOP) + INTERNAL_ERROR(__LINE__); + break; + case CodeTreeGo: + INTERNAL_ERROR(__LINE__); + break; + case CodeTreeReturn: + if (tree->data.tree != tree) + INTERNAL_ERROR(__LINE__); + break; + case CodeTreeBlock: + offset = LinkEmmitBytecode(com, tree->data.block->tree, + bytecode, offset); + break; + } + } + + return (offset); +} + +static void +LinkBytecode(LispCom *com) +{ + long offset, count; + unsigned char **codes; + LispObj **names; + + /* Close bytecode */ + com_Bytecode(com, XBC_RETURN); + + /* The only usage of this information for now, and still may generate + * false positives because arguments to unamed functions are not being + * parsed as well as arguments to yet undefined function/maros. + * XXX should also add declaim/declare to let the code specify that + * the argument is unused */ + LinkWarnUnused(com, com->block); + + /* First level optimization */ + LinkOptimize_0(com); + + /* Resolve tagbody labels */ + LinkResolveLabels(com, com->block); + + /* Resolve any pending jumps */ + LinkResolveJumps(com, com->block); + + /* Calculate unpadded offsets */ + LinkBuildOffsets(com, com->block->tree, 0); + + /* Do padding for aligned memory reads */ + LinkFixupOffsets(com, com->block->tree, 0); + + /* Jumps normally are to a node that does not generate code, + * and due to padding, the jump may go to a address with a + * XBC_NOOP, so adjust the jump to the next useful opcode. */ + LinkSkipPadding(com, com->block->tree); + + /* Now addresses are known */ + LinkFixupJumps(com, com->block->tree); + + /* Build symbol, constant and builtin tables */ + LinkBuildTables(com, com->block); + + /* Stack info */ + com->length = sizeof(short) * 3; + /* Tables info */ + com->length += sizeof(short) * 4; + com->length += com->table.num_constants * sizeof(LispObj*); + com->length += com->table.num_symbols * sizeof(LispAtom*); + com->length += com->table.num_builtins * sizeof(LispBuiltin*); + com->length += com->table.num_bytecodes * sizeof(unsigned char*); + com->length += com->table.num_bytecodes * sizeof(LispObj*); + + /* Allocate space for the bytecode stream */ + com->length += com->block->tail->offset + 1; + com->bytecode = LispMalloc(com->length); + + /* Add header */ + offset = 0; + *(short*)(com->bytecode + offset) = com->stack.stack; + offset += sizeof(short); + *(short*)(com->bytecode + offset) = com->stack.bstack; + offset += sizeof(short); + *(short*)(com->bytecode + offset) = com->stack.pstack; + offset += sizeof(short); + + *(short*)(com->bytecode + offset) = com->table.num_constants; + offset += sizeof(short); + *(short*)(com->bytecode + offset) = com->table.num_symbols; + offset += sizeof(short); + *(short*)(com->bytecode + offset) = com->table.num_builtins; + offset += sizeof(short); + *(short*)(com->bytecode + offset) = com->table.num_bytecodes; + offset += sizeof(short); + + count = sizeof(LispObj*) * com->table.num_constants; + memcpy(com->bytecode + offset, com->table.constants, count); + offset += count; + count = sizeof(LispAtom*) * com->table.num_symbols; + memcpy(com->bytecode + offset, com->table.symbols, count); + offset += count; + count = sizeof(LispBuiltin*) * com->table.num_builtins; + memcpy(com->bytecode + offset, com->table.builtins, count); + offset += count; + + /* Store bytecode information */ + for (count = 0, codes = (unsigned char**)(com->bytecode + offset); + count < com->table.num_bytecodes; count++, codes++) + *codes = com->table.bytecodes[count]->data.bytecode.bytecode->code; + offset += com->table.num_bytecodes * sizeof(unsigned char*); + /* Store names, only useful for disassemble but may also be used + * to check if a function was redefined, and the bytecode is referencing + * the older version, the current version can be checked looking at + * <name>->data.atom */ + for (count = 0, names = (LispObj**)(com->bytecode + offset); + count < com->table.num_bytecodes; count++, names++) + *names = com->table.bytecodes[count]->data.bytecode.name; + offset += com->table.num_bytecodes * sizeof(LispObj*); + + /* Generate it */ + LinkEmmitBytecode(com, com->block->tree, com->bytecode + offset, 0); +} + +static LispObj * +ExecuteBytecode(register unsigned char *stream) +{ + register LispObj *reg0; + register LispAtom *atom; + register short offset; + LispObj *reg1; + LispBuiltin *builtin; + LispObj *lambda; + LispObj *arguments; + unsigned char *bytecode; + + LispObj **constants; + LispAtom **symbols; + LispBuiltin **builtins; + unsigned char **codes; + short num_constants, num_symbols, num_builtins, num_codes; + + int lex, len; + + /* To control gc protected slots */ + int phead, pbase; + + long fixnum = 0; + +#if defined(__GNUC__) && !defined(ANSI_SOURCE) +#define ALLOW_GOTO_ADDRESS +#endif + +#ifdef ALLOW_GOTO_ADDRESS +#define JUMP_ADDRESS(label) &&label + static const void *opcode_labels[] = { + JUMP_ADDRESS(XBC_NOOP), + JUMP_ADDRESS(XBC_INV), + JUMP_ADDRESS(XBC_NIL), + JUMP_ADDRESS(XBC_T), + JUMP_ADDRESS(XBC_PRED), + JUMP_ADDRESS(XBC_CAR), + JUMP_ADDRESS(XBC_CDR), + JUMP_ADDRESS(XBC_CAR_SET), + JUMP_ADDRESS(XBC_CDR_SET), + JUMP_ADDRESS(XBC_RPLACA), + JUMP_ADDRESS(XBC_RPLACD), + JUMP_ADDRESS(XBC_EQ), + JUMP_ADDRESS(XBC_EQL), + JUMP_ADDRESS(XBC_EQUAL), + JUMP_ADDRESS(XBC_EQUALP), + JUMP_ADDRESS(XBC_LENGTH), + JUMP_ADDRESS(XBC_LAST), + JUMP_ADDRESS(XBC_NTHCDR), + JUMP_ADDRESS(XBC_CAR_PUSH), + JUMP_ADDRESS(XBC_CDR_PUSH), + JUMP_ADDRESS(XBC_PUSH), + JUMP_ADDRESS(XBC_PUSH_NIL), + JUMP_ADDRESS(XBC_PUSH_UNSPEC), + JUMP_ADDRESS(XBC_PUSH_T), + JUMP_ADDRESS(XBC_PUSH_NIL_N), + JUMP_ADDRESS(XBC_PUSH_UNSPEC_N), + JUMP_ADDRESS(XBC_LET), + JUMP_ADDRESS(XBC_LETX), + JUMP_ADDRESS(XBC_LET_NIL), + JUMP_ADDRESS(XBC_LETX_NIL), + JUMP_ADDRESS(XBC_LETBIND), + JUMP_ADDRESS(XBC_UNLET), + JUMP_ADDRESS(XBC_LOAD), + JUMP_ADDRESS(XBC_LOAD_LET), + JUMP_ADDRESS(XBC_LOAD_LETX), + JUMP_ADDRESS(XBC_LOAD_PUSH), + JUMP_ADDRESS(XBC_LOADCON), + JUMP_ADDRESS(XBC_LOADCON_LET), + JUMP_ADDRESS(XBC_LOADCON_LETX), + JUMP_ADDRESS(XBC_LOADCON_PUSH), + JUMP_ADDRESS(XBC_LOAD_CAR), + JUMP_ADDRESS(XBC_LOAD_CDR), + JUMP_ADDRESS(XBC_LOAD_CAR_STORE), + JUMP_ADDRESS(XBC_LOAD_CDR_STORE), + JUMP_ADDRESS(XBC_LOADCON_SET), + JUMP_ADDRESS(XBC_LOADSYM), + JUMP_ADDRESS(XBC_LOADSYM_LET), + JUMP_ADDRESS(XBC_LOADSYM_LETX), + JUMP_ADDRESS(XBC_LOADSYM_PUSH), + JUMP_ADDRESS(XBC_LOAD_SET), + JUMP_ADDRESS(XBC_LOAD_CAR_SET), + JUMP_ADDRESS(XBC_LOAD_CDR_SET), + JUMP_ADDRESS(XBC_SET), + JUMP_ADDRESS(XBC_SETSYM), + JUMP_ADDRESS(XBC_SET_NIL), + JUMP_ADDRESS(XBC_CALL), + JUMP_ADDRESS(XBC_CALL_SET), + JUMP_ADDRESS(XBC_BYTECALL), + JUMP_ADDRESS(XBC_FUNCALL), + JUMP_ADDRESS(XBC_LETREC), + JUMP_ADDRESS(XBC_BCONS), + JUMP_ADDRESS(XBC_BCONS1), + JUMP_ADDRESS(XBC_BCONS2), + JUMP_ADDRESS(XBC_BCONS3), + JUMP_ADDRESS(XBC_BCONS4), + JUMP_ADDRESS(XBC_BCONS5), + JUMP_ADDRESS(XBC_BCONS6), + JUMP_ADDRESS(XBC_BCONS7), + JUMP_ADDRESS(XBC_CCONS), + JUMP_ADDRESS(XBC_CSTAR), + JUMP_ADDRESS(XBC_CFINI), + JUMP_ADDRESS(XBC_LSTAR), + JUMP_ADDRESS(XBC_LCONS), + JUMP_ADDRESS(XBC_LFINI), + JUMP_ADDRESS(XBC_JUMP), + JUMP_ADDRESS(XBC_JUMPT), + JUMP_ADDRESS(XBC_JUMPNIL), + JUMP_ADDRESS(XBC_STRUCT), + JUMP_ADDRESS(XBC_STRUCTP), + JUMP_ADDRESS(XBC_RETURN) + }; + static const void *predicate_opcode_labels[] = { + JUMP_ADDRESS(XBP_CONSP), + JUMP_ADDRESS(XBP_LISTP), + JUMP_ADDRESS(XBP_NUMBERP) + }; +#endif + + reg0 = NIL; + + bytecode = stream; + pbase = lisp__data.protect.length; + + /* stack */ + offset = *(short*)stream; + stream += sizeof(short); + if (lisp__data.env.length + offset > lisp__data.env.space) { + do + LispMoreEnvironment(); + while (lisp__data.env.length + offset >= lisp__data.env.space); + } + /* builtin stack */ + offset = *(short*)stream; + stream += sizeof(short); + if (lisp__data.stack.length + offset >= lisp__data.stack.space) { + do + LispMoreStack(); + while (lisp__data.stack.length + offset >= lisp__data.stack.space); + } + /* protect stack */ + phead = *(short*)stream; + stream += sizeof(short); + if (lisp__data.protect.length + phead > lisp__data.protect.space) { + do + LispMoreProtects(); + while (lisp__data.protect.length + phead >= lisp__data.protect.space); + } + + num_constants = *(short*)stream; + stream += sizeof(short); + num_symbols = *(short*)stream; + stream += sizeof(short); + num_builtins = *(short*)stream; + stream += sizeof(short); + num_codes = *(short*)stream; + stream += sizeof(short); + + constants = (LispObj**)stream; + stream += num_constants * sizeof(LispObj*); + symbols = (LispAtom**)stream; + stream += num_symbols * sizeof(LispAtom*); + builtins = (LispBuiltin**)stream; + stream += num_builtins * sizeof(LispBuiltin*); + codes = (unsigned char**)stream; + stream += num_codes * (sizeof(unsigned char*) + sizeof(LispObj*)); + + for (; phead > 0; phead--) + lisp__data.protect.objects[lisp__data.protect.length++] = NIL; + phead = pbase; + +#ifdef ALLOW_GOTO_ADDRESS +#define OPCODE_LABEL(label) label +#define NEXT_OPCODE() goto *opcode_labels[*stream++] +#define GOTO_PREDICATE() goto *predicate_opcode_labels[*stream++] +#else +#define OPCODE_LABEL(label) case label +#define NEXT_OPCODE() goto next_opcode +#define GOTO_PREDICATE() goto predicate_label + for (;;) { +next_opcode: + switch (*stream++) { +#endif /* ALLOW_GOTO_ADDRESS */ + +OPCODE_LABEL(XBC_NOOP): + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_PRED): + GOTO_PREDICATE(); + +OPCODE_LABEL(XBC_INV): + reg0 = reg0 == NIL ? T : NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_NIL): + reg0 = NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_T): + reg0 = T; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_CAR): +car: + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CAR: %s is not a list", STROBJ(reg0)); + reg0 = CAR(reg0); + } + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_CDR): +cdr: + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CDR: %s is not a list", STROBJ(reg0)); + reg0 = CDR(reg0); + } + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_RPLACA): + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + if (!CONSP(reg1)) + LispDestroy("RPLACA: %s is not a cons", STROBJ(reg1)); + RPLACA(reg1, reg0); + reg0 = reg1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_RPLACD): + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + if (!CONSP(reg1)) + LispDestroy("RPLACD: %s is not a cons", STROBJ(reg1)); + RPLACD(reg1, reg0); + reg0 = reg1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS): + CAR(cons) = reg0; + lisp__data.stack.values[lisp__data.stack.length++] = cons; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS1): + offset = lisp__data.stack.length - 1; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[offset]; + lisp__data.stack.values[offset] = cons1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS2): + offset = lisp__data.stack.length; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[--offset]; + CAR(cons2) = lisp__data.stack.values[--offset]; + lisp__data.stack.values[offset] = cons2; + lisp__data.stack.length = offset + 1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS3): + offset = lisp__data.stack.length; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[--offset]; + CAR(cons2) = lisp__data.stack.values[--offset]; + CAR(cons3) = lisp__data.stack.values[--offset]; + lisp__data.stack.values[offset] = cons3; + lisp__data.stack.length = offset + 1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS4): + offset = lisp__data.stack.length; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[--offset]; + CAR(cons2) = lisp__data.stack.values[--offset]; + CAR(cons3) = lisp__data.stack.values[--offset]; + CAR(cons4) = lisp__data.stack.values[--offset]; + lisp__data.stack.values[offset] = cons4; + lisp__data.stack.length = offset + 1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS5): + offset = lisp__data.stack.length; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[--offset]; + CAR(cons2) = lisp__data.stack.values[--offset]; + CAR(cons3) = lisp__data.stack.values[--offset]; + CAR(cons4) = lisp__data.stack.values[--offset]; + CAR(cons5) = lisp__data.stack.values[--offset]; + lisp__data.stack.values[offset] = cons5; + lisp__data.stack.length = offset + 1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS6): + offset = lisp__data.stack.length; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[--offset]; + CAR(cons2) = lisp__data.stack.values[--offset]; + CAR(cons3) = lisp__data.stack.values[--offset]; + CAR(cons4) = lisp__data.stack.values[--offset]; + CAR(cons5) = lisp__data.stack.values[--offset]; + CAR(cons6) = lisp__data.stack.values[--offset]; + lisp__data.stack.values[offset] = cons6; + lisp__data.stack.length = offset + 1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_BCONS7): + offset = lisp__data.stack.length; + CAR(cons) = reg0; + CAR(cons1) = lisp__data.stack.values[--offset]; + CAR(cons2) = lisp__data.stack.values[--offset]; + CAR(cons3) = lisp__data.stack.values[--offset]; + CAR(cons4) = lisp__data.stack.values[--offset]; + CAR(cons5) = lisp__data.stack.values[--offset]; + CAR(cons6) = lisp__data.stack.values[--offset]; + CAR(cons7) = lisp__data.stack.values[--offset]; + lisp__data.stack.values[offset] = cons7; + lisp__data.stack.length = offset + 1; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_EQ): + reg0 = reg0 == lisp__data.stack.values[--lisp__data.stack.length] ? T : NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_EQL): + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + reg0 = XEQL(reg1, reg0); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_EQUAL): + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + reg0 = XEQUAL(reg1, reg0); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_EQUALP): + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + reg0 = XEQUALP(reg1, reg0); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LENGTH): + reg0 = FIXNUM(LispLength(reg0)); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LAST): + { + long length; + + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + if (CONSP(reg1)) { + if (reg0 != NIL) { + if (!FIXNUMP(reg0) || (fixnum = FIXNUM_VALUE(reg0)) < 0) + LispDestroy("LAST: %s is not a positive fixnum", + STROBJ(reg0)); + } + else + fixnum = 1; + reg0 = reg1; + for (reg0 = reg1, length = 0; + CONSP(reg0); + reg0 = CDR(reg0), length++) + ; + for (length -= fixnum, reg0 = reg1; length > 0; length--) + reg0 = CDR(reg0); + } + else + reg0 = reg1; + } NEXT_OPCODE(); + +OPCODE_LABEL(XBC_NTHCDR): + reg1 = lisp__data.stack.values[--lisp__data.stack.length]; + if (!FIXNUMP(reg1) || (fixnum = FIXNUM_VALUE(reg1)) < 0) + LispDestroy("NTHCDR: %s is not a positive fixnum", + STROBJ(reg1)); + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("NTHCDR: %s is not a list", STROBJ(reg0)); + for (; fixnum > 0; fixnum--) { + if (!CONSP(reg0)) + break; + reg0 = CDR(reg0); + } + } + NEXT_OPCODE(); + + /* Push to builtin stack */ +OPCODE_LABEL(XBC_CAR_PUSH): + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CAR: %s is not a list", STROBJ(reg0)); + reg0 = CAR(reg0); + } + goto push_builtin; + +OPCODE_LABEL(XBC_CDR_PUSH): + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CDR: %s is not a list", STROBJ(reg0)); + reg0 = CDR(reg0); + } + /*FALLTROUGH*/ + +OPCODE_LABEL(XBC_PUSH): +push_builtin: + lisp__data.stack.values[lisp__data.stack.length++] = reg0; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_PUSH_NIL): + lisp__data.stack.values[lisp__data.stack.length++] = NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_PUSH_UNSPEC): + lisp__data.stack.values[lisp__data.stack.length++] = UNSPEC; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_PUSH_T): + lisp__data.stack.values[lisp__data.stack.length++] = T; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_PUSH_NIL_N): + for (offset = *stream++; offset > 0; offset--) + lisp__data.stack.values[lisp__data.stack.length++] = NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_PUSH_UNSPEC_N): + for (offset = *stream++; offset > 0; offset--) + lisp__data.stack.values[lisp__data.stack.length++] = UNSPEC; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LET): +let_argument: + /* The global object value is not changed, so it does not + * matter if it is a constant symbol. An error would be + * generated if it was declared as constant at the time of + * bytecode generation. Check can be done looking at the + * atom->constant field. */ + atom = symbols[*stream++]; + atom->offset = lisp__data.env.length; + lisp__data.env.names[lisp__data.env.length] = atom->string; + lisp__data.env.values[lisp__data.env.length++] = reg0; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LETX): +letx_argument: + atom = symbols[*stream++]; + atom->offset = lisp__data.env.length; + lisp__data.env.names[lisp__data.env.length] = atom->string; + lisp__data.env.values[lisp__data.env.length++] = reg0; + lisp__data.env.head++; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LET_NIL): + atom = symbols[*stream++]; + atom->offset = lisp__data.env.length; + lisp__data.env.names[lisp__data.env.length] = atom->string; + lisp__data.env.values[lisp__data.env.length++] = NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LETX_NIL): + atom = symbols[*stream++]; + atom->offset = lisp__data.env.length; + lisp__data.env.names[lisp__data.env.length] = atom->string; + lisp__data.env.values[lisp__data.env.length++] = NIL; + lisp__data.env.head++; + NEXT_OPCODE(); + + /* Bind locally added variables to a block */ +OPCODE_LABEL(XBC_LETBIND): + offset = *stream++; + lisp__data.env.head += offset; + NEXT_OPCODE(); + + /* Unbind locally added variables to a block */ +OPCODE_LABEL(XBC_UNLET): + offset = *stream++; + lisp__data.env.head -= offset; + lisp__data.env.length -= offset; + NEXT_OPCODE(); + + /* Load value from stack */ +OPCODE_LABEL(XBC_LOAD): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LOAD_CAR): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + goto car; + +OPCODE_LABEL(XBC_LOAD_CDR): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + goto cdr; + +OPCODE_LABEL(XBC_LOAD_CAR_STORE): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CAR: %s is not a list", STROBJ(reg0)); + reg0 = CAR(reg0); + lisp__data.env.values[lisp__data.env.lex + offset] = reg0; + } + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LOAD_CDR_STORE): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CDR: %s is not a list", STROBJ(reg0)); + reg0 = CDR(reg0); + lisp__data.env.values[lisp__data.env.lex + offset] = reg0; + } + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LOAD_LET): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + goto let_argument; + +OPCODE_LABEL(XBC_LOAD_LETX): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + goto letx_argument; + +OPCODE_LABEL(XBC_LOAD_PUSH): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + lisp__data.stack.values[lisp__data.stack.length++] = reg0; + NEXT_OPCODE(); + + /* Load pointer to constant */ +OPCODE_LABEL(XBC_LOADCON): + reg0 = constants[*stream++]; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LOADCON_LET): + reg0 = constants[*stream++]; + goto let_argument; + +OPCODE_LABEL(XBC_LOADCON_LETX): + reg0 = constants[*stream++]; + goto letx_argument; + +OPCODE_LABEL(XBC_LOADCON_PUSH): + reg0 = constants[*stream++]; + lisp__data.stack.values[lisp__data.stack.length++] = reg0; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LOADCON_SET): + reg0 = constants[*stream++]; + offset = *stream++; + lisp__data.env.values[lisp__data.env.lex + offset] = reg0; + NEXT_OPCODE(); + + /* Change value of local variable */ +OPCODE_LABEL(XBC_CAR_SET): +car_set: + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CAR: %s is not a list", STROBJ(reg0)); + reg0 = CAR(reg0); + } + goto set_local_variable; + +OPCODE_LABEL(XBC_CDR_SET): +cdr_set: + if (reg0 != NIL) { + if (!CONSP(reg0)) + LispDestroy("CDR: %s is not a list", STROBJ(reg0)); + reg0 = CDR(reg0); + } + goto set_local_variable; + +OPCODE_LABEL(XBC_LOAD_CAR_SET): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + goto car_set; + +OPCODE_LABEL(XBC_LOAD_CDR_SET): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + goto cdr_set; + +OPCODE_LABEL(XBC_LOAD_SET): + offset = *stream++; + reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; + /*FALLTROUGH*/ + +OPCODE_LABEL(XBC_SET): +set_local_variable: + offset = *stream++; + lisp__data.env.values[lisp__data.env.lex + offset] = reg0; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_SET_NIL): + offset = *stream++; + lisp__data.env.values[lisp__data.env.lex + offset] = NIL; + NEXT_OPCODE(); + + /* Change value of a global/special variable */ +OPCODE_LABEL(XBC_SETSYM): + atom = symbols[*stream++]; + if (atom->dyn) { + /* atom->dyn and atom->constant are exclusive, no + * need to check if variable declared as constant. */ + if (atom->offset < lisp__data.env.head && + lisp__data.env.names[atom->offset] == atom->string) + lisp__data.env.values[atom->offset] = reg0; + else { + if (atom->watch) + LispSetAtomObjectProperty(atom, reg0); + else + SETVALUE(atom, reg0); + } + } + else if (atom->a_object) { + if (atom->constant) + LispDestroy("EVAL: %s is a constant", + STROBJ(atom->object)); + else if (atom->watch) + LispSetAtomObjectProperty(atom, reg0); + else + SETVALUE(atom, reg0); + } + else { + /* Create new global variable */ + LispPackage *pack; + + LispWarning("the variable %s was not declared", + atom->string); + LispSetAtomObjectProperty(atom, reg0); + pack = atom->package->data.package.package; + if (pack->glb.length >= pack->glb.space) + LispMoreGlobals(pack); + pack->glb.pairs[pack->glb.length++] = atom->object; + } + NEXT_OPCODE(); + +/* Resolve symbol value at runtime */ +#define LOAD_SYMBOL_VALUE() \ + atom = symbols[*stream++]; \ + if (atom->dyn) { \ + if (atom->offset < lisp__data.env.head && \ + lisp__data.env.names[atom->offset] == atom->string) \ + reg0 = lisp__data.env.values[atom->offset]; \ + else { \ + reg0 = atom->property->value; \ + if (reg0 == UNBOUND) \ + LispDestroy("EVAL: the symbol %s is unbound", \ + STROBJ(atom->object)); \ + } \ + } \ + else { \ + if (atom->a_object) \ + reg0 = atom->property->value; \ + else \ + LispDestroy("EVAL: the symbol %s is unbound", \ + STROBJ(atom->object)); \ + } + +OPCODE_LABEL(XBC_LOADSYM): + LOAD_SYMBOL_VALUE(); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LOADSYM_LET): + LOAD_SYMBOL_VALUE(); + goto let_argument; + +OPCODE_LABEL(XBC_LOADSYM_LETX): + LOAD_SYMBOL_VALUE(); + goto letx_argument; + +OPCODE_LABEL(XBC_LOADSYM_PUSH): + LOAD_SYMBOL_VALUE(); + lisp__data.stack.values[lisp__data.stack.length++] = reg0; + NEXT_OPCODE(); + + /* Builtin function */ +OPCODE_LABEL(XBC_CALL): + offset = *stream++; + lisp__data.stack.base = lisp__data.stack.length - offset; + builtin = builtins[*stream++]; + if (builtin->multiple_values) { + RETURN_COUNT = 0; + reg0 = builtin->function(builtin); + } + else { + reg0 = builtin->function(builtin); + RETURN_COUNT = 0; + } + lisp__data.stack.length -= offset; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_CALL_SET): + offset = *stream++; + lisp__data.stack.base = lisp__data.stack.length - offset; + builtin = builtins[*stream++]; + if (builtin->multiple_values) { + RETURN_COUNT = 0; + reg0 = builtin->function(builtin); + } + else { + reg0 = builtin->function(builtin); + RETURN_COUNT = 0; + } + lisp__data.stack.length -= offset; + offset = *stream++; + lisp__data.env.values[lisp__data.env.lex + offset] = reg0; + NEXT_OPCODE(); + + /* Bytecode call */ +OPCODE_LABEL(XBC_BYTECALL): + lex = lisp__data.env.lex; + offset = *stream++; + lisp__data.env.head = lisp__data.env.length; + len = lisp__data.env.lex = lisp__data.env.length - offset; + reg0 = ExecuteBytecode(codes[*stream++]); + lisp__data.env.length = lisp__data.env.head = len; + lisp__data.env.lex = lex; + NEXT_OPCODE(); + + /* Unimplemented function/macro call */ +OPCODE_LABEL(XBC_FUNCALL): + lambda = constants[*stream++]; + arguments = constants[*stream++]; + reg0 = LispFuncall(lambda, arguments, 1); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_JUMP): + stream += *(signed short*)stream; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_JUMPT): + if (reg0 != NIL) + stream += *(signed short*)stream; + else + /* skip jump relative offset */ + stream += sizeof(signed short); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_JUMPNIL): + if (reg0 == NIL) + stream += *(signed short*)stream; + else + /* skip jump relative offset */ + stream += sizeof(signed short); + NEXT_OPCODE(); + + /* Build CONS of two constant arguments */ +OPCODE_LABEL(XBC_CCONS): + reg0 = constants[*stream++]; + reg1 = constants[*stream++]; + reg0 = CONS(reg0, reg1); + NEXT_OPCODE(); + + /* Start CONS */ +OPCODE_LABEL(XBC_CSTAR): + /* This the CAR of the CONS */ + lisp__data.protect.objects[phead++] = reg0; + NEXT_OPCODE(); + + /* Finish CONS */ +OPCODE_LABEL(XBC_CFINI): + reg0 = CONS(lisp__data.protect.objects[--phead], reg0); + NEXT_OPCODE(); + + /* Start building list */ +OPCODE_LABEL(XBC_LSTAR): + reg1 = CONS(reg0, NIL); + /* Start of list stored here */ + lisp__data.protect.objects[phead++] = reg1; + /* Tail of list stored here */ + lisp__data.protect.objects[phead++] = reg1; + NEXT_OPCODE(); + + /* Add to list */ +OPCODE_LABEL(XBC_LCONS): + reg1 = lisp__data.protect.objects[phead - 2]; + RPLACD(reg1, CONS(reg0, NIL)); + lisp__data.protect.objects[phead - 2] = CDR(reg1); + NEXT_OPCODE(); + + /* Finish list */ +OPCODE_LABEL(XBC_LFINI): + phead -= 2; + reg0 = lisp__data.protect.objects[phead + 1]; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_STRUCT): + offset = *stream++; + reg1 = constants[*stream++]; + if (!STRUCTP(reg0) || reg0->data.struc.def != reg1) { + char *name = ATOMID(CAR(reg1)); + + for (reg1 = CDR(reg1); offset; offset--) + reg1 = CDR(reg1); + LispDestroy("%s-%s: %s is not a %s", + name, ATOMID(CAR(reg1)), STROBJ(reg0), name); + } + for (reg0 = reg0->data.struc.fields; offset; offset--) + reg0 = CDR(reg0); + reg0 = CAR(reg0); + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_STRUCTP): + reg1 = constants[*stream++]; + reg0 = STRUCTP(reg0) && reg0->data.struc.def == reg1 ? T : NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_LETREC): + /* XXX could/should optimize, shouldn't need to parse + * the bytecode header again */ + lex = lisp__data.env.lex; + offset = *stream++; + lisp__data.env.head = lisp__data.env.length; + len = lisp__data.env.lex = lisp__data.env.length - offset; + reg0 = ExecuteBytecode(bytecode); + lisp__data.env.length = lisp__data.env.head = len; + lisp__data.env.lex = lex; + NEXT_OPCODE(); + +OPCODE_LABEL(XBC_RETURN): + lisp__data.protect.length = pbase; + return (reg0); + +#ifndef ALLOW_GOTO_ADDRESS + } /* end of switch */ + +predicate_label: + switch (*stream++) { +#endif + +OPCODE_LABEL(XBP_CONSP): + reg0 = CONSP(reg0) ? T : NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBP_LISTP): + reg0 = LISTP(reg0) ? T : NIL; + NEXT_OPCODE(); + +OPCODE_LABEL(XBP_NUMBERP): + reg0 = NUMBERP(reg0) ? T : NIL; + NEXT_OPCODE(); + +#ifndef ALLOW_GOTO_ADDRESS + } /* end of switch */ + } +#endif + + /*NOTREACHED*/ + return (reg0); +} Index: xc/programs/xedit/lisp/bytecode.h diff -u /dev/null xc/programs/xedit/lisp/bytecode.h:1.5 --- /dev/null Thu Feb 27 12:34:56 2003 +++ xc/programs/xedit/lisp/bytecode.h Sat Nov 23 03:26:48 2002 @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/bytecode.h,v 1.5 2002/11/23 08:26:48 paulo Exp $ */ + +#include "private.h" + +#ifndef Lisp_Bytecode_h +#define Lisp_Bytecode_h + +/* Number of arguments for &REST functions with no side effects, + * i.e. does not need to allocate new cells to build argument list. + * If this value is changed, it is also required to add more + * XBC_BCONS? opcodes and change ExecuteBytecode() */ +#define MAX_BCONS 8 + +typedef enum { + XBP_CONSP, + XBP_LISTP, + XBP_NUMBERP +} LispBytePredicate; + +typedef enum { + XBC_NOOP, + + XBC_INV, /* If NIL loaded, change to T else to NIL */ + XBC_NIL, /* Load NIL */ + XBC_T, /* Load T */ + + XBC_PRED, /* Preffix for predicate test */ + /* Followed by byte indicating test */ + + XBC_CAR, /* Set loaded value to it's car */ + XBC_CDR, /* Set loaded value to it's cdr */ + + XBC_CAR_SET, /* Set local variable to CAR or CDR of loaded value */ + XBC_CDR_SET, + /* Offset of local variable follows */ + + /* Sets C[AD]R of top of builtin stack with + * loaded value and pop builtin stack */ + XBC_RPLACA, + XBC_RPLACD, + + /* Push only one argument in builtin stack, and call directly + * LispObjectCompare without the need of pushing the second arguument */ + XBC_EQ, + XBC_EQL, + XBC_EQUAL, + XBC_EQUALP, + + XBC_LENGTH, + XBC_LAST, + XBC_NTHCDR, + + XBC_CAR_PUSH, /* Pushes CAR or CDR of loaded value to builtin stack */ + XBC_CDR_PUSH, + + XBC_PUSH, /* Push argument in builtin stack */ + XBC_PUSH_NIL, /* Pushes NIL in builtin stack */ + XBC_PUSH_UNSPEC, /* Pushes #<UNSPEC> in builtin stack */ + XBC_PUSH_T, /* Pushes T in builtin stack */ + XBC_PUSH_NIL_N, /* Pushes NIL in the builtin stack N times */ + XBC_PUSH_UNSPEC_N, /* Pushes #<UNSPEC> in the builtin stack N times */ + + + /* The builtin stack base is saved when entering the bytecode + * interpreter, and the bytecode does not reenter from builtin + * functions, yet, so there is no need, for XBC_BSAVE and + * XBC_BREST instructions */ + + XBC_LET, /* Push loaded value to stack */ + XBC_LETX, /* Push loaded value to stack and bind */ + /* Next byte(s) are the symbol offset */ + XBC_LET_NIL, /* Push loaded value to stack */ + XBC_LETX_NIL, /* Push loaded value to stack and bind */ + /* Next byte(s) are the symbol offset */ + + XBC_LETBIND, /* Bind locally added variables */ + /* Followed by number of symbols to bind */ + + XBC_UNLET, /* Unbind locally binded variables */ + /* Followed by number of symbols to unbind */ + + XBC_LOAD, /* Load argument already from the stack */ + /* Followed by offset follows the opcode */ + XBC_LOAD_LET, /* Load argument and push */ + XBC_LOAD_LETX, /* Load argument, push and bind */ + /* Followed by a short and the atom to be bound */ + XBC_LOAD_PUSH, + + XBC_LOADCON, /* Load a literal constant */ + /* Next bytes are the constant object */ + XBC_LOADCON_LET, /* Load a literal constant and push */ + XBC_LOADCON_LETX, /* Load a literal constant, push and bind */ + /* Followed by object constant and symbol to be bound */ + XBC_LOADCON_PUSH, + + /* Load CAR or CDR of local variable */ + XBC_LOAD_CAR, + XBC_LOAD_CDR, + + /* Change local variable value to it's CAR or CDR */ + XBC_LOAD_CAR_STORE, + XBC_LOAD_CDR_STORE, + + XBC_LOADCON_SET, + /* Followed by constant offset and local variable offset */ + + XBC_LOADSYM, /* Load object symbol value */ + /* The object atom pointer follows de opcode */ + XBC_LOADSYM_LET, /* Load object symbol value and push */ + XBC_LOADSYM_LETX, /* Load object symbol value, push and bind */ + /* The symbol atom name and bounded atom name to be bound follows */ + XBC_LOADSYM_PUSH, + + XBC_LOAD_SET, /* Set value of local variable to the value of another */ + /* Followed by two shorts */ + XBC_LOAD_CAR_SET, /* Like LOAD_SET, but apply CAR or CDR in the value */ + XBC_LOAD_CDR_SET, + + XBC_SET, /* Change value of local variable */ + /* A short integer with relative offset follows opcode */ + XBC_SETSYM, /* Change value of symbol */ + /* The atom symbol pointer follows opcode */ + + XBC_SET_NIL, /* Like XBC_SET but sets the local variable to NIL */ + + XBC_CALL, /* Call builtin function */ + /* 1 byte follows telling how many arguments to use */ + /* LispBuiltin pointer follows opcode */ + + XBC_CALL_SET, + /* Like BCALL, but also followed by an short index of local variable */ + + XBC_BYTECALL, /* Call bytecode */ + /* 1 byte for number of arguments */ + /* 1 byte for index in bytecode table */ + + XBC_FUNCALL, + /* Opcode followed by function and arguments objects, to + * be evaluated at run time, as it was not resolved at + * bytecode generation time (or is not implemented in + * the bytecode compiler) */ + + + XBC_LETREC, /* Recursive function call */ + /* 1 byte follows telling how many arguments the funtion receives */ + + /* Helper for math functions. Uses a preallocated CONS, + * setting it's CAR to the loaded value, and in the same step + * pushes the CONS to the builtin stack */ + XBC_BCONS, + /* Like BCONS but it is a list of 2 arguments, first argument + * is saved on the stack, replace with list of 2 arguments */ + XBC_BCONS1, + /* Like BCONS1 but it is a list of 3 arguments, first arguments + * are saved on the stack, replace with list of first stack + * argument with list or 3 arguments, and pop stack */ + XBC_BCONS2, + XBC_BCONS3, + XBC_BCONS4, + XBC_BCONS5, + XBC_BCONS6, + XBC_BCONS7, + + /* Build a CONS */ + XBC_CCONS, /* Make CONS of two constants */ + /* Constants follow opcode */ + XBC_CSTAR, /* Save the CAR of the CONS */ + XBC_CFINI, /* Loaded value is the CDR */ + + /* These are to help in interactively building lists */ + XBC_LSTAR, /* Start building a list in the gc protected stack */ + XBC_LCONS, /* Add loaded object to list */ + XBC_LFINI, /* List is finished */ + + /* Inconditional jumps */ + XBC_JUMP, /* Jump relative to following signed int */ + + /* Conditional jumps, if true */ + XBC_JUMPT, /* Jump relative to following signed int */ + + /* Conditional jumps, if false */ + XBC_JUMPNIL, /* Jump relative to following signed int */ + + /* Structure field access and type check */ + XBC_STRUCT, + XBC_STRUCTP, + + XBC_RETURN /* Resume bytecode execution */ +} LispByteOpcode; + + +struct _LispBytecode { + unsigned char *code; /* Bytecode data */ + long length; /* length of bytecode stream */ +}; + +/* + * Prototypes + */ +void LispBytecodeInit(void); + +LispObj *Lisp_Compile(LispBuiltin*); +LispObj *Lisp_Disassemble(LispBuiltin*); + +LispObj *LispCompileForm(LispObj*); +LispObj *LispExecuteBytecode(LispObj*); + +void Com_And(LispCom*, LispBuiltin*); +void Com_Block(LispCom*, LispBuiltin*); +void Com_C_r(LispCom*, LispBuiltin*); +void Com_Cond(LispCom*, LispBuiltin*); +void Com_Cons(LispCom*, LispBuiltin*); +void Com_Consp(LispCom*, LispBuiltin*); +void Com_Dolist(LispCom*, LispBuiltin*); +void Com_Eq(LispCom*, LispBuiltin*); +void Com_Go(LispCom*, LispBuiltin*); +void Com_If(LispCom*, LispBuiltin*); +void Com_Last(LispCom*, LispBuiltin*); +void Com_Length(LispCom*, LispBuiltin*); +void Com_Let(LispCom*, LispBuiltin*); +void Com_Letx(LispCom*, LispBuiltin*); +void Com_Listp(LispCom*, LispBuiltin*); +void Com_Loop(LispCom*, LispBuiltin*); +void Com_Nthcdr(LispCom*, LispBuiltin*); +void Com_Null(LispCom*, LispBuiltin*); +void Com_Numberp(LispCom*, LispBuiltin*); +void Com_Or(LispCom*, LispBuiltin*); +void Com_Progn(LispCom*, LispBuiltin*); +void Com_Return(LispCom*, LispBuiltin*); +void Com_ReturnFrom(LispCom*, LispBuiltin*); +void Com_Rplac_(LispCom*, LispBuiltin*); +void Com_Setq(LispCom*, LispBuiltin*); +void Com_Tagbody(LispCom*, LispBuiltin*); +void Com_Unless(LispCom*, LispBuiltin*); +void Com_Until(LispCom*, LispBuiltin*); +void Com_When(LispCom*, LispBuiltin*); +void Com_While(LispCom*, LispBuiltin*); + +#endif /* Lisp_Bytecode_h */ Index: xc/programs/xedit/lisp/compile.c diff -u /dev/null xc/programs/xedit/lisp/compile.c:1.14 --- /dev/null Thu Feb 27 12:34:56 2003 +++ xc/programs/xedit/lisp/compile.c Wed Jan 29 21:46:25 2003 @@ -0,0 +1,2225 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/compile.c,v 1.14 2003/01/30 02:46:25 paulo Exp $ */ + +#define VARIABLE_USED 0x0001 +#define VARIABLE_ARGUMENT 0x0002 + +/* + * Prototypes + */ +static void ComPredicate(LispCom*, LispBuiltin*, LispBytePredicate); +static void ComReturnFrom(LispCom*, LispBuiltin*, int); + +static int ComConstantp(LispCom*, LispObj*); +static void ComAddVariable(LispCom*, LispObj*, LispObj*); +static int ComGetVariable(LispCom*, LispObj*); +static void ComVariableSetFlag(LispCom*, LispAtom*, int); +#define COM_VARIABLE_USED(atom) \ + ComVariableSetFlag(com, atom, VARIABLE_USED) +#define COM_VARIABLE_ARGUMENT(atom) \ + ComVariableSetFlag(com, atom, VARIABLE_ARGUMENT) + +static int FindIndex(void*, void**, int); +static int compare(const void*, const void*); +static int BuildTablePointer(void*, void***, int*); + +static void ComLabel(LispCom*, LispObj*); +static void ComPush(LispCom*, LispObj*, LispObj*, int, int, int); +static int ComCall(LispCom*, LispArgList*, LispObj*, LispObj*, int, int, int); +static void ComFuncall(LispCom*, LispObj*, LispObj*, int); +static void ComProgn(LispCom*, LispObj*); +static void ComEval(LispCom*, LispObj*); + +static void ComRecursiveCall(LispCom*, LispArgList*, LispObj*, LispObj*); +static void ComInlineCall(LispCom*, LispArgList*, LispObj*, LispObj*, LispObj*); + +static void ComMacroBackquote(LispCom*, LispObj*); +static void ComMacroCall(LispCom*, LispArgList*, LispObj*, LispObj*, LispObj*); +static LispObj *ComMacroExpandBackquote(LispCom*, LispObj*); +static LispObj *ComMacroExpand(LispCom*, LispObj*); +static LispObj *ComMacroExpandFuncall(LispCom*, LispObj*, LispObj*); +static LispObj *ComMacroExpandEval(LispCom*, LispObj*); + +/* + * Implementation + */ +void +Com_And(LispCom *com, LispBuiltin *builtin) +/* + and &rest args + */ +{ + LispObj *args; + + args = ARGUMENT(0); + + if (CONSP(args)) { + /* Evaluate first argument */ + ComEval(com, CAR(args)); + args = CDR(args); + + /* If more than one argument, create jump list */ + if (CONSP(args)) { + CodeTree *tree = NULL, *group; + + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPNIL; + + for (; CONSP(args); args = CDR(args)) { + ComEval(com, CAR(args)); + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_JUMPNIL; + group->group = tree; + group = tree; + } + /* Finish form the last CodeTree code is changed to sign the + * end of the AND list */ + group->code = XBC_NOOP; + if (group) + group->group = tree; + } + } + else + /* Identity of AND is T */ + com_Bytecode(com, XBC_T); +} + +void +Com_Block(LispCom *com, LispBuiltin *builtin) +/* + block name &rest body + */ +{ + + LispObj *name, *body; + + body = ARGUMENT(1); + name = ARGUMENT(0); + + if (name != NIL && name != T && !SYMBOLP(name)) + LispDestroy("%s: %s cannot name a block", + STRFUN(builtin), STROBJ(name)); + if (CONSP(body)) { + CompileIniBlock(com, LispBlockTag, name); + ComProgn(com, body); + CompileFiniBlock(com); + } + else + /* Just load NIL without starting an empty block */ + com_Bytecode(com, XBC_NIL); +} + +void +Com_C_r(LispCom *com, LispBuiltin *builtin) +/* + c[ad]{1,4}r list + */ +{ + LispObj *list; + char *desc; + + list = ARGUMENT(0); + + desc = STRFUN(builtin); + if (*desc == 'F') /* FIRST */ + desc = "CAR"; + else if (*desc == 'R') /* REST */ + desc = "CDR"; + + /* Check if it is a list of constants */ + while (desc[1] != 'R') + desc++; + ComEval(com, list); + while (*desc != 'C') { + com_Bytecode(com, *desc == 'A' ? XBC_CAR : XBC_CDR); + --desc; + } +} + +void +Com_Cond(LispCom *com, LispBuiltin *builtin) +/* + cond &rest body + */ +{ + int count; + LispObj *code, *body; + CodeTree *group, *tree; + + body = ARGUMENT(0); + + count = 0; + group = NULL; + if (CONSP(body)) { + for (; CONSP(body); body = CDR(body)) { + code = CAR(body); + CHECK_CONS(code); + ++count; + ComEval(com, CAR(code)); + tree = NEW_TREE(CodeTreeCond); + if (group) + group->group = tree; + tree->code = XBC_JUMPNIL; + group = tree; + /* The code to execute if the test is true */ + ComProgn(com, CDR(code)); + /* Add a node signaling the end of the PROGN code */ + tree = NEW_TREE(CodeTreeCond); + tree->code = XBC_JUMPT; + if (group) + group->group = tree; + group = tree; + } + } + if (!count) + com_Bytecode(com, XBC_NIL); + else + /* Where to jump after T progn */ + group->code = XBC_NOOP; +} + +void +Com_Cons(LispCom *com, LispBuiltin *builtin) +/* + cons car cdr + */ +{ + LispObj *car, *cdr; + + cdr = ARGUMENT(1); + car = ARGUMENT(0); + + if (ComConstantp(com, car) && ComConstantp(com, cdr)) + com_BytecodeCons(com, XBC_CCONS, car, cdr); + else { + ++com->stack.cpstack; + if (com->stack.pstack < com->stack.cpstack) + com->stack.pstack = com->stack.cpstack; + ComEval(com, car); + com_Bytecode(com, XBC_CSTAR); + ComEval(com, cdr); + com_Bytecode(com, XBC_CFINI); + --com->stack.cpstack; + } +} + +void +Com_Consp(LispCom *com, LispBuiltin *builtin) +/* + consp object + */ +{ + ComPredicate(com, builtin, XBP_CONSP); +} + +void +Com_Dolist(LispCom *com, LispBuiltin *builtin) +/* + dolist init &rest body + */ +{ + int unbound, item; + LispObj *symbol, *list, *result; + LispObj *init, *body; + CodeTree *group, *tree; + + body = ARGUMENT(1); + init = ARGUMENT(0); + + CHECK_CONS(init); + symbol = CAR(init); + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + init = CDR(init); + if (CONSP(init)) { + list = CAR(init); + init = CDR(init); + } + else + list = NIL; + if (CONSP(init)) { + result = CAR(init); + if (CONSP(CDR(init))) + LispDestroy("%s: too many arguments %s", + STRFUN(builtin), STROBJ(CDR(init))); + } + else + result = NIL; + + /* Generate code for the body of the form. + * The generated code uses two objects unavailable to user code, + * in the format: + * (block NIL + * (let ((? list) (item NIL)) + * (tagbody + * . ; the DOT object as a label + * (when (consp list) + * (setq item (car ?)) + * @body ; code to be executed + * (setq ? (cdr ?)) + * (go .) + * ) + * ) + * (setq item nil) + * result + * ) + * ) + */ + + /* XXX All of the logic below should be simplified at some time + * by adding more opcodes for compound operations ... */ + + /* Relative offsets the locally added variables will have at run time */ + unbound = lisp__data.env.length - lisp__data.env.lex; + item = unbound + 1; + + /* Start BLOCK NIL */ + FORM_ENTER(); + CompileIniBlock(com, LispBlockTag, NIL); + + /* Add the <?> variable */ + ComPush(com, UNBOUND, list, 1, 0, 0); + /* Add the <item> variable */ + ComPush(com, symbol, NIL, 0, 0, 0); + /* Stack length is increased */ + CompileStackEnter(com, 2, 0); + /* Bind variables */ + com_Bind(com, 2); + com->block->bind += 2; + lisp__data.env.head += 2; + + /* Remember that iteration variable is used even if it not referenced */ + COM_VARIABLE_USED(symbol->data.atom); + + /* Initialize the TAGBODY */ + FORM_ENTER(); + CompileIniBlock(com, LispBlockBody, NIL); + + /* Create the <.> label */ + ComLabel(com, DOT); + + /* Load <?> variable */ + com_BytecodeShort(com, XBC_LOAD, unbound); + /* Check if <?> is a list */ + com_BytecodeChar(com, XBC_PRED, XBP_CONSP); + + /* Start WHEN block */ + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPNIL; + /* Load <?> again */ + com_BytecodeShort(com, XBC_LOAD, unbound); + /* Get CAR of <?> */ + com_Bytecode(com, XBC_CAR); + /* Store it in <item> */ + com_BytecodeShort(com, XBC_SET, item); + /* Execute @BODY */ + ComProgn(com, body); + + /* Load <?> again */ + com_BytecodeShort(com, XBC_LOAD, unbound); + /* Get CDR of <?> */ + com_Bytecode(com, XBC_CDR); + /* Change value of <?> */ + com_BytecodeShort(com, XBC_SET, unbound); + + /* GO back to <.> */ + tree = NEW_TREE(CodeTreeGo); + tree->data.object = DOT; + + /* Finish WHEN block */ + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_NOOP; + group->group = tree; + + /* Finish the TAGBODY */ + CompileFiniBlock(com); + FORM_LEAVE(); + + /* Set <item> to NIL, in case result references it... + * Loaded value is NIL as the CONSP predicate */ + com_BytecodeShort(com, XBC_SET, item); + + /* Evaluate <result> */ + ComEval(com, result); + + /* Unbind variables */ + lisp__data.env.head -= 2; + lisp__data.env.length -= 2; + com->block->bind -= 2; + com_Unbind(com, 2); + /* Stack length is reduced. */ + CompileStackLeave(com, 2, 0); + + /* Finish BLOCK NIL */ + CompileFiniBlock(com); + FORM_LEAVE(); +} + +void +Com_Eq(LispCom *com, LispBuiltin *builtin) +/* + eq left right + eql left right + equal left right + equalp left right + */ +{ + LispObj *left, *right; + LispByteOpcode code; + char *name; + + right = ARGUMENT(1); + left = ARGUMENT(0); + + CompileStackEnter(com, 1, 1); + /* Just like preparing to call a builtin function */ + ComEval(com, left); + com_Bytecode(com, XBC_PUSH); + /* The second argument is now loaded */ + ComEval(com, right); + + /* Compare arguments and restore builtin stack */ + name = STRFUN(builtin); + switch (name[3]) { + case 'L': + code = XBC_EQL; + break; + case 'U': + code = name[5] == 'P' ? XBC_EQUALP : XBC_EQUAL; + break; + default: + code = XBC_EQ; + break; + } + com_Bytecode(com, code); + + CompileStackLeave(com, 1, 1); +} + +void +Com_Go(LispCom *com, LispBuiltin *builtin) +/* + go tag + */ +{ + int bind; + LispObj *tag; + CodeTree *tree; + CodeBlock *block; + + tag = ARGUMENT(0); + + block = com->block; + bind = block->bind; + + while (block) { + if (block->type == LispBlockClosure || block->type == LispBlockBody) + break; + block = block->prev; + if (block) + bind += block->bind; + } + + if (!block || block->type != LispBlockBody) + LispDestroy("%s called not within a block", STRFUN(builtin)); + + /* Unbind any local variables */ + com_Unbind(com, bind); + tree = NEW_TREE(CodeTreeGo); + tree->data.object = tag; +} + +void +Com_If(LispCom *com, LispBuiltin *builtin) +/* + if test then &optional else + */ +{ + CodeTree *group, *tree; + LispObj *test, *then, *oelse; + + oelse = ARGUMENT(2); + then = ARGUMENT(1); + test = ARGUMENT(0); + + /* Build code to execute test */ + ComEval(com, test); + + /* Add jump node to use if test is NIL */ + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPNIL; + + /* Build T code */ + ComEval(com, then); + + if (oelse != UNSPEC) { + /* Remember start of NIL code */ + tree = NEW_TREE(CodeTreeJump); + tree->code = XBC_JUMP; + group->group = tree; + group = tree; + /* Build NIL code */ + ComEval(com, oelse); + } + + /* Remember jump of T code */ + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_NOOP; + group->group = tree; +} + +void +Com_Last(LispCom *com, LispBuiltin *builtin) +/* + last list &optional count + */ +{ + LispObj *list, *count; + + count = ARGUMENT(1); + list = ARGUMENT(0); + + ComEval(com, list); + CompileStackEnter(com, 1, 1); + com_Bytecode(com, XBC_PUSH); + if (count == UNSPEC) + count = FIXNUM(1); + ComEval(com, count); + CompileStackLeave(com, 1, 1); + com_Bytecode(com, XBC_LAST); +} + +void +Com_Length(LispCom *com, LispBuiltin *builtin) +/* + length sequence + */ +{ + LispObj *sequence; + + sequence = ARGUMENT(0); + + ComEval(com, sequence); + com_Bytecode(com, XBC_LENGTH); +} + +void +Com_Let(LispCom *com, LispBuiltin *builtin) +/* + let init &rest body + */ +{ + int count; + LispObj *symbol, *value, *pair; + + LispObj *init, *body; + + body = ARGUMENT(1); + init = ARGUMENT(0); + + if (init == NIL) { + /* If no local variables */ + ComProgn(com, body); + return; + } + CHECK_CONS(init); + + /* Could optimize if the body is empty and the + * init form is known to have no side effects */ + + for (count = 0; CONSP(init); init = CDR(init), count++) { + pair = CAR(init); + if (CONSP(pair)) { + symbol = CAR(pair); + pair = CDR(pair); + if (CONSP(pair)) { + value = CAR(pair); + if (CDR(pair) != NIL) + LispDestroy("%s: too much arguments to initialize %s", + STRFUN(builtin), STROBJ(symbol)); + } + else + value = NIL; + } + else { + symbol = pair; + value = NIL; + } + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + + /* Add the variable */ + ComPush(com, symbol, value, 1, 0, 0); + } + + /* Stack length is increased */ + CompileStackEnter(com, count, 0); + /* Bind the added variables */ + com_Bind(com, count); + com->block->bind += count; + lisp__data.env.head += count; + /* Generate code for the body of the form */ + ComProgn(com, body); + /* Unbind the added variables */ + lisp__data.env.head -= count; + lisp__data.env.length -= count; + com->block->bind -= count; + com_Unbind(com, count); + /* Stack length is reduced. */ + CompileStackLeave(com, count, 0); +} + +void +Com_Letx(LispCom *com, LispBuiltin *builtin) +/* + let* init &rest body + */ +{ + int count; + LispObj *symbol, *value, *pair; + + LispObj *init, *body; + + body = ARGUMENT(1); + init = ARGUMENT(0); + + if (init == NIL) { + /* If no local variables */ + ComProgn(com, body); + return; + } + CHECK_CONS(body); + + /* Could optimize if the body is empty and the + * init form is known to have no side effects */ + + for (count = 0; CONSP(init); init = CDR(init), count++) { + pair = CAR(init); + if (CONSP(pair)) { + symbol = CAR(pair); + pair = CDR(pair); + if (CONSP(pair)) { + value = CAR(pair); + if (CDR(pair) != NIL) + LispDestroy("%s: too much arguments to initialize %s", + STRFUN(builtin), STROBJ(symbol)); + } + else + value = NIL; + } + else { + symbol = pair; + value = NIL; + } + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + + /* LET* is identical to &AUX arguments, just bind the symbol */ + ComPush(com, symbol, value, 1, 0, 0); + /* Every added variable is binded */ + com_Bind(com, 1); + /* Must be binded at compile time also */ + ++lisp__data.env.head; + ++com->block->bind; + } + + /* Generate code for the body of the form */ + CompileStackEnter(com, count, 0); + ComProgn(com, body); + com_Unbind(com, count); + com->block->bind -= count; + lisp__data.env.head -= count; + lisp__data.env.length -= count; + CompileStackLeave(com, count, 0); +} + +void +Com_Listp(LispCom *com, LispBuiltin *builtin) +/* + listp object + */ +{ + ComPredicate(com, builtin, XBP_LISTP); +} + +void +Com_Loop(LispCom *com, LispBuiltin *builtin) +/* + loop &rest body + */ +{ + CodeTree *tree, *group; + LispObj *body; + + body = ARGUMENT(0); + + /* Start NIL block */ + CompileIniBlock(com, LispBlockTag, NIL); + + /* Insert node to mark LOOP start */ + tree = NEW_TREE(CodeTreeJump); + tree->code = XBC_NOOP; + + /* Execute @BODY */ + if (CONSP(body)) + ComProgn(com, body); + else + /* XXX bytecode.c code require that blocks have at least one opcode */ + com_Bytecode(com, XBC_NIL); + + /* Insert node to jump of start of LOOP */ + group = NEW_TREE(CodeTreeJump); + group->code = XBC_JUMP; + group->group = tree; + + /* Finish NIL block */ + CompileFiniBlock(com); +} + +void +Com_Nthcdr(LispCom *com, LispBuiltin *builtin) +/* + nthcdr index list + */ +{ + LispObj *oindex, *list; + + list = ARGUMENT(1); + oindex = ARGUMENT(0); + + ComEval(com, oindex); + CompileStackEnter(com, 1, 1); + com_Bytecode(com, XBC_PUSH); + ComEval(com, list); + CompileStackLeave(com, 1, 1); + com_Bytecode(com, XBC_NTHCDR); +} + +void +Com_Null(LispCom *com, LispBuiltin *builtin) +/* + null list + */ +{ + LispObj *list; + + list = ARGUMENT(0); + + if (list == NIL) + com_Bytecode(com, XBC_T); + else if (ComConstantp(com, list)) + com_Bytecode(com, XBC_NIL); + else { + ComEval(com, list); + com_Bytecode(com, XBC_INV); + } +} + +void +Com_Numberp(LispCom *com, LispBuiltin *builtin) +/* + numberp object + */ +{ + ComPredicate(com, builtin, XBP_NUMBERP); +} + +void +Com_Or(LispCom *com, LispBuiltin *builtin) +/* + or &rest args + */ +{ + LispObj *args; + + args = ARGUMENT(0); + + if (CONSP(args)) { + /* Evaluate first argument */ + ComEval(com, CAR(args)); + args = CDR(args); + + /* If more than one argument, create jump list */ + if (CONSP(args)) { + CodeTree *tree = NULL, *group; + + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPT; + + for (; CONSP(args); args = CDR(args)) { + ComEval(com, CAR(args)); + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_JUMPT; + group->group = tree; + group = tree; + } + /* Finish form the last CodeTree code is changed to sign the + * end of the AND list */ + group->code = XBC_NOOP; + group->group = tree; + } + } + else + /* Identity of OR is NIL */ + com_Bytecode(com, XBC_NIL); +} + +void +Com_Progn(LispCom *com, LispBuiltin *builtin) +/* + progn &rest body + */ +{ + LispObj *body; + + body = ARGUMENT(0); + + ComProgn(com, body); +} + +void +Com_Return(LispCom *com, LispBuiltin *builtin) +/* + return &optional result + */ +{ + ComReturnFrom(com, builtin, 0); +} + +void +Com_ReturnFrom(LispCom *com, LispBuiltin *builtin) +/* + return-from name &optional result + */ +{ + ComReturnFrom(com, builtin, 1); +} + +void +Com_Rplac_(LispCom *com, LispBuiltin *builtin) +/* + rplac[ad] place value + */ +{ + LispObj *place, *value; + + value = ARGUMENT(1); + place = ARGUMENT(0); + + CompileStackEnter(com, 1, 1); + ComEval(com, place); + com_Bytecode(com, XBC_PUSH); + ComEval(com, value); + com_Bytecode(com, STRFUN(builtin)[5] == 'A' ? XBC_RPLACA : XBC_RPLACD); + CompileStackLeave(com, 1, 1); +} + +void +Com_Setq(LispCom *com, LispBuiltin *builtin) +/* + setq &rest form + */ +{ + int offset; + LispObj *form, *symbol, *value; + + form = ARGUMENT(0); + + for (; CONSP(form); form = CDR(form)) { + symbol = CAR(form); + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + form = CDR(form); + if (!CONSP(form)) + LispDestroy("%s: odd number of arguments", STRFUN(builtin)); + value = CAR(form); + /* Generate code to load value */ + ComEval(com, value); + offset = ComGetVariable(com, symbol); + if (offset >= 0) + com_Set(com, offset); + else + com_SetSym(com, symbol->data.atom); + } +} + +void +Com_Tagbody(LispCom *com, LispBuiltin *builtin) +/* + tagbody &rest body + */ +{ + LispObj *body; + + body = ARGUMENT(0); + + if (CONSP(body)) { + CompileIniBlock(com, LispBlockBody, NIL); + ComProgn(com, body); + /* Tagbody returns NIL */ + com_Bytecode(com, XBC_NIL); + CompileFiniBlock(com); + } + else + /* Tagbody always returns NIL */ + com_Bytecode(com, XBC_NIL); +} + +void +Com_Unless(LispCom *com, LispBuiltin *builtin) +/* + unless test &rest body + */ +{ + CodeTree *group, *tree; + LispObj *test, *body; + + body = ARGUMENT(1); + test = ARGUMENT(0); + + /* Generate code to evaluate test */ + ComEval(com, test); + /* Add node after test */ + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPT; + /* Generate NIL code */ + ComProgn(com, body); + /* Insert node to know where to jump if test is T */ + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_NOOP; + group->group = tree; +} + +void +Com_Until(LispCom *com, LispBuiltin *builtin) +/* + until test &rest body + */ +{ + CodeTree *tree, *group, *ltree, *lgroup; + LispObj *test, *body; + + body = ARGUMENT(1); + test = ARGUMENT(0); + + /* Insert node to mark LOOP start */ + ltree = NEW_TREE(CodeTreeJump); + ltree->code = XBC_NOOP; + + /* Build code for test */ + ComEval(com, test); + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPT; + + /* Execute @BODY */ + ComProgn(com, body); + + /* Insert node to jump to test again */ + lgroup = NEW_TREE(CodeTreeJump); + lgroup->code = XBC_JUMP; + lgroup->group = ltree; + + /* Insert node to know where to jump if test is T */ + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_NOOP; + group->group = tree; +} + +void +Com_When(LispCom *com, LispBuiltin *builtin) +/* + when test &rest body + */ +{ + CodeTree *group, *tree; + LispObj *test, *body; + + body = ARGUMENT(1); + test = ARGUMENT(0); + + /* Generate code to evaluate test */ + ComEval(com, test); + /* Add node after test */ + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPNIL; + /* Generate T code */ + ComProgn(com, body); + /* Insert node to know where to jump if test is NIL */ + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_NOOP; + group->group = tree; +} + +void +Com_While(LispCom *com, LispBuiltin *builtin) +/* + while test &rest body + */ +{ + CodeTree *tree, *group, *ltree, *lgroup; + LispObj *test, *body; + + body = ARGUMENT(1); + test = ARGUMENT(0); + + /* Insert node to mark LOOP start */ + ltree = NEW_TREE(CodeTreeJump); + ltree->code = XBC_NOOP; + + /* Build code for test */ + ComEval(com, test); + group = NEW_TREE(CodeTreeJumpIf); + group->code = XBC_JUMPNIL; + + /* Execute @BODY */ + ComProgn(com, body); + + /* Insert node to jump to test again */ + lgroup = NEW_TREE(CodeTreeJump); + lgroup->code = XBC_JUMP; + lgroup->group = ltree; + + /* Insert node to know where to jump if test is NIL */ + tree = NEW_TREE(CodeTreeJumpIf); + tree->code = XBC_NOOP; + group->group = tree; +} + + +/*********************************************************************** + * Com_XXX helper functions + ***********************************************************************/ +static void +ComPredicate(LispCom *com, LispBuiltin *builtin, LispBytePredicate predicate) +{ + LispObj *object; + + object = ARGUMENT(0); + + if (ComConstantp(com, object)) { + switch (predicate) { + case XBP_CONSP: + com_Bytecode(com, CONSP(object) ? XBC_T : XBC_NIL); + break; + case XBP_LISTP: + com_Bytecode(com, CONSP(object) || object == NIL ? + XBC_T : XBC_NIL); + break; + case XBP_NUMBERP: + com_Bytecode(com, NUMBERP(object) ? XBC_T : XBC_NIL); + break; + } + } + else { + ComEval(com, object); + com_BytecodeChar(com, XBC_PRED, predicate); + } +} + +/* XXX Could receive an argument telling if is the last statement in the + * block(s), i.e. if a jump opcode should be generated or just the + * evaluation of the returned value. Probably this is better done in + * an optimization step. */ +static void +ComReturnFrom(LispCom *com, LispBuiltin *builtin, int from) +{ + int bind; + CodeTree *tree; + LispObj *name, *result; + CodeBlock *block = com->block; + + if (from) { + result = ARGUMENT(1); + name = ARGUMENT(0); + } + else { + result = ARGUMENT(0); + name = NIL; + } + if (result == UNSPEC) + result = NIL; + + bind = block->bind; + while (block) { + if (block->type == LispBlockClosure) + /* A function call */ + break; + else if (block->type == LispBlockTag && block->tag == name) + break; + block = block->prev; + if (block) + bind += block->bind; + } + + if (!block || block->tag != name) + LispDestroy("%s: no visible %s block", STRFUN(builtin), STROBJ(name)); + + /* Generate code to load result */ + ComEval(com, result); + + /* Check for added variables that the jump is skiping the unbind opcode */ + com_Unbind(com, bind); + + tree = NEW_TREE(CodeTreeReturn); + tree->data.block = block; +} + +/*********************************************************************** + * Helper functions + ***********************************************************************/ +static int +ComConstantp(LispCom *com, LispObj *object) +{ + switch (OBJECT_TYPE(object)) { + case LispAtom_t: + /* Keywords are guaranteed to evaluate to itself */ + if (object->data.atom->package == lisp__data.keyword) + break; + return (0); + + /* Function call */ + case LispCons_t: + + /* Need macro expansion, these are special abstract objects */ + case LispQuote_t: + case LispBackquote_t: + case LispComma_t: + case LispFunctionQuote_t: + return (0); + + /* Anything else is a literal constant */ + default: + break; + } + + return (1); +} + +static int +FindIndex(void *item, void **table, int length) +{ + long cmp; + int left, right, i; + + left = 0; + right = length - 1; + while (left <= right) { + i = (left + right) >> 1; + cmp = (char*)item - (char*)table[i]; + if (cmp == 0) + return (i); + else if (cmp < 0) + right = i - 1; + else + left = i + 1; + } + + return (-1); +} + +static int +compare(const void *left, const void *right) +{ + long cmp = *(char**)left - *(char**)right; + + return (cmp < 0 ? -1 : 1); +} + +static int +BuildTablePointer(void *pointer, void ***pointers, int *num_pointers) +{ + int i; + + if ((i = FindIndex(pointer, *pointers, *num_pointers)) < 0) { + *pointers = LispRealloc(*pointers, + sizeof(void*) * (*num_pointers + 1)); + (*pointers)[*num_pointers] = pointer; + if (++*num_pointers > 1) + qsort(*pointers, *num_pointers, sizeof(void*), compare); + i = FindIndex(pointer, *pointers, *num_pointers); + } + + return (i); +} + +static void +ComAddVariable(LispCom *com, LispObj *symbol, LispObj *value) +{ + LispAtom *atom = symbol->data.atom; + + if (atom && atom->string && !com->macro) { + int i, length = com->block->variables.length; + + i = BuildTablePointer(atom, (void***)&com->block->variables.symbols, + &com->block->variables.length); + + if (com->block->variables.length != length) { + com->block->variables.flags = + LispRealloc(com->block->variables.flags, + com->block->variables.length * sizeof(int)); + + /* Variable was inserted in the middle of the list */ + if (i < length) + memmove(com->block->variables.flags + i + 1, + com->block->variables.flags + i, + (length - i) * sizeof(int)); + + com->block->variables.flags[i] = 0; + } + } + + LispAddVar(symbol, value); +} + +static int +ComGetVariable(LispCom *com, LispObj *symbol) +{ + LispAtom *name; + int i, base, offset; + Atom_id id; + + name = symbol->data.atom; + if (name->constant) { + if (name->package == lisp__data.keyword) + /* Just load <symbol> from the byte stream, keywords are + * guaranteed to evaluate to itself. */ + return (SYMBOL_KEYWORD); + return (SYMBOL_CONSTANT); + } + + offset = name->offset; + id = name->string; + base = lisp__data.env.lex; + i = lisp__data.env.head - 1; + + /* If variable is local */ + if (offset <= i && offset >= com->lex && lisp__data.env.names[offset] == id) { + COM_VARIABLE_USED(name); + /* Relative offset */ + return (offset - base); + } + + /* name->offset may have been changed in a macro expansion */ + for (; i >= com->lex; i--) + if (lisp__data.env.names[i] == id) { + name->offset = i; + COM_VARIABLE_USED(name); + return (i - base); + } + + if (!name->a_object) { + ++com->warnings; + LispWarning("variable %s is neither declared nor bound", + name->string); + } + + /* Not found, resolve <symbol> at run time */ + return (SYMBOL_UNBOUND); +} + +static void +ComVariableSetFlag(LispCom *com, LispAtom *atom, int flag) +{ + int i; + CodeBlock *block = com->block; + + while (block) { + i = FindIndex(atom, (void**)block->variables.symbols, + block->variables.length); + if (i >= 0) { + block->variables.flags[i] |= flag; + /* Descend block list if an argument to function being called + * has the same name as a bound variable in the current function. + */ + if ((flag & VARIABLE_ARGUMENT) || + !(block->variables.flags[i] & VARIABLE_ARGUMENT)) + break; + } + block = block->prev; + } +} + +/*********************************************************************** + * Bytecode compiler functions + ***********************************************************************/ +static void +ComLabel(LispCom *com, LispObj *label) +{ + int i; + CodeTree *tree; + + for (i = 0; i < com->block->tagbody.length; i++) + if (label == com->block->tagbody.labels[i]) + LispDestroy("TAGBODY: tag %s specified more than once", + STROBJ(label)); + + if (com->block->tagbody.length >= com->block->tagbody.space) { + com->block->tagbody.labels = + LispRealloc(com->block->tagbody.labels, + sizeof(LispObj*) * (com->block->tagbody.space + 8)); + /* Reserve space, will be used at link time when + * resolving GO jumps. */ + com->block->tagbody.codes = + LispRealloc(com->block->tagbody.codes, + sizeof(CodeTree*) * (com->block->tagbody.space + 8)); + com->block->tagbody.space += 8; + } + + com->block->tagbody.labels[com->block->tagbody.length++] = label; + tree = NEW_TREE(CodeTreeLabel); + tree->data.object = label; +} + +static void +ComPush(LispCom *com, LispObj *symbol, LispObj *value, + int eval, int builtin, int compile) +{ + /* If <compile> is set, it is pushing an argument to one of + * Com_XXX functions. */ + if (compile) { + if (builtin) + lisp__data.stack.values[lisp__data.stack.length++] = value; + else + ComAddVariable(com, symbol, value); + return; + } + + /* If <com->macro> is set, it is expanding a macro, just add the local + * variable <symbol> bounded to <value>, so that it will be available + * when calling the interpreter to expand the macro. */ + else if (com->macro) { + ComAddVariable(com, symbol, value); + return; + } + + /* If <eval> is set, it must generate the opcodes to evaluate <value>. + * If <value> is a constant, just generate the opcodes to load it. */ + else if (eval && !ComConstantp(com, value)) { + switch (OBJECT_TYPE(value)) { + case LispAtom_t: { + int offset = ComGetVariable(com, value); + + if (offset >= 0) { + /* Load <value> from user stack at the relative offset */ + if (builtin) + com_LoadPush(com, offset); + else + com_LoadLet(com, offset, symbol->data.atom); + } + /* ComConstantp() does not return true for this, as the + * current value must be computed. */ + else if (offset == SYMBOL_CONSTANT) { + value = value->data.atom->property->value; + if (builtin) + com_LoadConPush(com, value); + else + com_LoadConLet(com, value, symbol->data.atom); + } + else { + /* Load value bound to <value> at run time */ + if (builtin) + com_LoadSymPush(com, value->data.atom); + else + com_LoadSymLet(com, value->data.atom, + symbol->data.atom); + } + } break; + + default: + /* Generate code to evaluate <value> */ + ComEval(com, value); + if (builtin) + com_Bytecode(com, XBC_PUSH); + else + com_Let(com, symbol->data.atom); + break; + } + + /* Remember <symbol> will be bound, <value> only matters for + * the Com_XXX functions */ + if (builtin) + lisp__data.stack.values[lisp__data.stack.length++] = value; + else + ComAddVariable(com, symbol, value); + return; + } + + if (builtin) { + /* Load <value> as a constant in builtin stack */ + com_LoadConPush(com, value); + lisp__data.stack.values[lisp__data.stack.length++] = value; + } + else { + /* Load <value> as a constant in stack */ + com_LoadConLet(com, value, symbol->data.atom); + /* Remember <symbol> will be bound */ + ComAddVariable(com, symbol, value); + } +} + +/* This function does almost the same job as LispMakeEnvironment, but + * it is not optimized for speed, as it is not building argument lists + * to user code, but to Com_XXX functions, or helping in generating the + * opcodes to load arguments at bytecode run time. */ +static int +ComCall(LispCom *com, LispArgList *alist, + LispObj *name, LispObj *values, + int eval, int builtin, int compile) +{ + char *desc; + int i, count, base; + LispObj **symbols, **defaults, **sforms; + + if (builtin) { + base = lisp__data.stack.length; + /* This should never be executed, but make the check for safety */ + if (base + alist->num_arguments > lisp__data.stack.space) { + do + LispMoreStack(); + while (base + alist->num_arguments > lisp__data.stack.space); + } + } + else + base = lisp__data.env.length; + + desc = alist->description; + switch (*desc++) { + case '.': + goto normal_label; + case 'o': + goto optional_label; + case 'k': + goto key_label; + case 'r': + goto rest_label; + case 'a': + goto aux_label; + default: + goto done_label; + } + + + /* Normal arguments */ +normal_label: + i = 0; + symbols = alist->normals.symbols; + count = alist->normals.num_symbols; + for (; i < count && CONSP(values); i++, values = CDR(values)) { + ComPush(com, symbols[i], CAR(values), eval, builtin, compile); + if (!builtin && !com->macro) + COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); + } + if (i < count) + LispDestroy("%s: too few arguments", STROBJ(name)); + + switch (*desc++) { + case 'o': + goto optional_label; + case 'k': + goto key_label; + case 'r': + goto rest_label; + case 'a': + goto aux_label; + default: + goto done_label; + } + + + /* &OPTIONAL */ +optional_label: + i = 0; + count = alist->optionals.num_symbols; + symbols = alist->optionals.symbols; + defaults = alist->optionals.defaults; + sforms = alist->optionals.sforms; + for (; i < count && CONSP(values); i++, values = CDR(values)) { + ComPush(com, symbols[i], CAR(values), eval, builtin, compile); + if (!builtin && !com->macro) + COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); + if (sforms[i]) { + ComPush(com, sforms[i], T, 0, builtin, compile); + if (!builtin && !com->macro) + COM_VARIABLE_ARGUMENT(sforms[i]->data.atom); + } + } + for (; i < count; i++) { + if (!builtin) { + int lex = com->lex; + int head = lisp__data.env.head; + + com->lex = base; + lisp__data.env.head = lisp__data.env.length; + /* default arguments are evaluated for macros */ + ComPush(com, symbols[i], defaults[i], 1, 0, compile); + if (!com->macro) + COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); + lisp__data.env.head = head; + com->lex = lex; + } + else + ComPush(com, symbols[i], defaults[i], eval, 1, compile); + if (sforms[i]) { + ComPush(com, sforms[i], NIL, 0, builtin, compile); + if (!builtin && !com->macro) + COM_VARIABLE_ARGUMENT(sforms[i]->data.atom); + } + } + + switch (*desc++) { + case 'k': + goto key_label; + case 'r': + goto rest_label; + case 'a': + goto aux_label; + default: + goto done_label; + } + + + /* &KEY */ +key_label: + { + int varset; + LispObj *val, *karg, **keys; + + count = alist->keys.num_symbols; + symbols = alist->keys.symbols; + defaults = alist->keys.defaults; + sforms = alist->keys.sforms; + keys = alist->keys.keys; + + /* Check if arguments are correctly specified */ + for (karg = values; CONSP(karg); karg = CDR(karg)) { + val = CAR(karg); + if (KEYWORDP(val)) { + for (i = 0; i < alist->keys.num_symbols; i++) + if (!keys[i] && symbols[i] == val) + break; + } + + else if (!builtin && + QUOTEP(val) && SYMBOLP(val->data.quote)) { + for (i = 0; i < alist->keys.num_symbols; i++) + if (keys[i] && ATOMID(keys[i]) == ATOMID(val->data.quote)) + break; + } + + else + /* Just make the error test true */ + i = alist->keys.num_symbols; + + if (i == alist->keys.num_symbols) { + /* If not in argument specification list... */ + char function_name[36]; + + strcpy(function_name, STROBJ(name)); + LispDestroy("%s: invalid keyword %s", + function_name, STROBJ(val)); + } + + karg = CDR(karg); + if (!CONSP(karg)) + LispDestroy("%s: &KEY needs arguments as pairs", + STROBJ(name)); + } + + /* Add variables */ + for (i = 0; i < alist->keys.num_symbols; i++) { + val = defaults[i]; + varset = 0; + if (!builtin && keys[i]) { + Atom_id atom = ATOMID(keys[i]); + + /* Special keyword specification, need to compare ATOMID + * and keyword specification must be a quoted object */ + for (karg = values; CONSP(karg); karg = CDR(karg)) { + val = CAR(karg); + if (QUOTEP(val) && atom == ATOMID(val->data.quote)) { + val = CADR(karg); + varset = 1; + break; + } + karg = CDR(karg); + } + } + + else { + /* Normal keyword specification, can compare object pointers, + * as they point to the same object in the keyword package */ + for (karg = values; CONSP(karg); karg = CDR(karg)) { + /* Don't check if argument is a valid keyword or + * special quoted keyword */ + if (symbols[i] == CAR(karg)) { + val = CADR(karg); + varset = 1; + break; + } + karg = CDR(karg); + } + } + + /* Add the variable to environment */ + if (varset) { + ComPush(com, symbols[i], val, eval, builtin, compile); + if (sforms[i]) + ComPush(com, sforms[i], T, 0, builtin, compile); + } + else { + /* default arguments are evaluated for macros */ + if (!builtin) { + int lex = com->lex; + int head = lisp__data.env.head; + + com->lex = base; + lisp__data.env.head = lisp__data.env.length; + ComPush(com, symbols[i], val, eval, 0, compile); + lisp__data.env.head = head; + com->lex = lex; + } + else + ComPush(com, symbols[i], val, eval, builtin, compile); + if (sforms[i]) + ComPush(com, sforms[i], NIL, 0, builtin, compile); + } + if (!builtin && !com->macro) { + COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); + if (sforms[i]) + COM_VARIABLE_ARGUMENT(sforms[i]->data.atom); + } + } + } + + if (*desc == 'a') { + /* &KEY uses all remaining arguments */ + values = NIL; + goto aux_label; + } + goto finished_label; + + + /* &REST */ +rest_label: + if (!eval || !CONSP(values) || (compile && !builtin)) + ComPush(com, alist->rest, values, eval, builtin, compile); + else { + char *string; + LispObj *list, *car = NIL; + int count, constantp; + + /* Count number of arguments and check if it is a list of constants */ + for (count = 0, constantp = 1, list = values; + CONSP(list); + list = CDR(list), count++) { + car = CAR(list); + if (!ComConstantp(com, car)) + constantp = 0; + } + + string = builtin ? ATOMID(name) : NULL; + /* XXX FIXME should have a flag indicating if function call + * change the &REST arguments even if it is a constant list + * (or if the returned value may be changed). */ + if (string && (count < MAX_BCONS || constantp) && + strcmp(string, "LIST") && + strcmp(string, "APPLY") && /* XXX depends on function argument */ + strcmp(string, "VECTOR") && + /* Append does not copy the last/single list */ + (strcmp(string, "APPEND") || !CONSP(car))) { + if (constantp) { + /* If the builtin function changes the &REST parameters, must + * define a Com_XXX function for it. */ + ComPush(com, alist->rest, values, 0, builtin, compile); + } + else { + CompileStackEnter(com, count - 1, 1); + for (; CONSP(CDR(values)); values = CDR(values)) { + /* Evaluate this argument */ + ComEval(com, CAR(values)); + /* Save result in builtin stack */ + com_Bytecode(com, XBC_PUSH); + } + CompileStackLeave(com, count - 1, 1); + /* The last argument is not saved in the stack */ + ComEval(com, CAR(values)); + values = NIL; + com_Bytecode(com, XBC_BCONS + (count - 1)); + } + } + else { + /* Allocate a fresh list of cons */ + + /* Generate code to load object */ + ComEval(com, CAR(values)); + + com->stack.cpstack += 2; + if (com->stack.pstack < com->stack.cpstack) + com->stack.pstack = com->stack.cpstack; + /* Start building a gc protected list, with the loaded value */ + com_Bytecode(com, XBC_LSTAR); + + for (values = CDR(values); CONSP(values); values = CDR(values)) { + /* Generate code to load object */ + ComEval(com, CAR(values)); + + /* Add loaded value to gc protected list */ + com_Bytecode(com, XBC_LCONS); + } + + /* Finish gc protected list */ + com_Bytecode(com, XBC_LFINI); + + /* Push loaded value */ + if (builtin) + com_Bytecode(com, XBC_PUSH); + else { + com_Let(com, alist->rest->data.atom); + + /* Remember this symbol will be bound */ + ComAddVariable(com, alist->rest, values); + } + com->stack.cpstack -= 2; + } + } + if (!builtin && !com->macro) + COM_VARIABLE_ARGUMENT(alist->rest->data.atom); + if (*desc != 'a') + goto finished_label; + + + /* &AUX */ +aux_label: + i = 0; + count = alist->auxs.num_symbols; + symbols = alist->auxs.symbols; + defaults = alist->auxs.initials; + if (!builtin && !compile) { + int lex = com->lex; + + com->lex = base; + lisp__data.env.head = lisp__data.env.length; + for (; i < count; i++) { + ComPush(com, symbols[i], defaults[i], 1, 0, 0); + if (!com->macro) + COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); + ++lisp__data.env.head; + } + com->lex = lex; + } + else { + for (; i < count; i++) { + ComPush(com, symbols[i], defaults[i], eval, builtin, compile); + if (!builtin && !com->macro) + COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); + } + } + +done_label: + if (CONSP(values)) + LispDestroy("%s: too many arguments", STROBJ(name)); + +finished_label: + if (builtin) + lisp__data.stack.base = base; + else + lisp__data.env.head = lisp__data.env.length; + + return (base); +} + +static void +ComFuncall(LispCom *com, LispObj *function, LispObj *arguments, int eval) +{ + int base, compile; + LispAtom *atom; + LispArgList *alist; + LispBuiltin *builtin; + LispObj *lambda; + + switch (OBJECT_TYPE(function)) { + case LispFunction_t: + function = function->data.atom->object; + case LispAtom_t: + atom = function->data.atom; + alist = atom->property->alist; + + if (atom->a_builtin) { + builtin = atom->property->fun.builtin; + compile = builtin->compile != NULL; + + /* If one of: + * o expanding a macro + * o calling a builtin special form + * o builtin function is a macro + * don't evaluate arguments. */ + if (com->macro || compile || builtin->type == LispMacro) + eval = 0; + + if (!com->macro && builtin->type == LispMacro) { + /* Set flag of variable used, in case variable is only + * used as a builtin macro argument. */ + LispObj *obj; + + for (obj = arguments; CONSP(obj); obj = CDR(obj)) { + if (SYMBOLP(CAR(obj))) + COM_VARIABLE_USED(CAR(obj)->data.atom); + } + } + + FORM_ENTER(); + if (!compile && !com->macro) + CompileStackEnter(com, alist->num_arguments, 1); + + /* Build argument list in the interpreter stacks */ + base = ComCall(com, alist, function, arguments, + eval, 1, compile); + + /* If <compile> is set, it is a special form */ + if (compile) + builtin->compile(com, builtin); + + /* Else, generate opcodes to call builtin function */ + else { + com_Call(com, alist->num_arguments, builtin); + CompileStackLeave(com, alist->num_arguments, 1); + } + lisp__data.stack.base = lisp__data.stack.length = base; + FORM_LEAVE(); + } + else if (atom->a_function) { + int macro; + + lambda = atom->property->fun.function; + macro = lambda->funtype == LispMacro; + + /* If <macro> is set, expand macro */ + if (macro) + ComMacroCall(com, alist, function, lambda, arguments); + + else { + if (com->toplevel->type == LispBlockClosure && + com->toplevel->tag == function) + ComRecursiveCall(com, alist, function, arguments); + else { +#if 0 + ComInlineCall(com, alist, function, arguments, + lambda->data.lambda.code); +#else + com_Funcall(com, function, arguments); +#endif + } + } + } + else if (atom->a_defstruct && + atom->property->structure.function != STRUCT_NAME && + atom->property->structure.function != STRUCT_CONSTRUCTOR) { + LispObj *definition = atom->property->structure.definition; + + if (!CONSP(arguments) || CONSP(CDR(arguments))) + LispDestroy("%s: too %s arguments", atom->string, + CONSP(arguments) ? "many" : "few"); + + ComEval(com, CAR(arguments)); + if (atom->property->structure.function == STRUCT_CHECK) + com_Structp(com, definition); + else + com_Struct(com, + atom->property->structure.function, definition); + } + else if (atom->a_compiled) { + FORM_ENTER(); + CompileStackEnter(com, alist->num_arguments, 0); + + /* Build argument list in the interpreter stacks */ + base = ComCall(com, alist, function, arguments, 1, 0, 0); + com_Bytecall(com, alist->num_arguments, + atom->property->fun.function); + CompileStackLeave(com, alist->num_arguments, 0); + lisp__data.env.head = lisp__data.env.length = base; + FORM_LEAVE(); + } + else { + /* Not yet defined function/macro. */ + ++com->warnings; + LispWarning("call to undefined function %s", atom->string); + com_Funcall(com, function, arguments); + } + break; + + case LispLambda_t: + lambda = function->data.lambda.code; + alist = (LispArgList*)function->data.lambda.name->data.opaque.data; + ComInlineCall(com, alist, NIL, arguments, lambda->data.lambda.code); + break; + + case LispCons_t: + if (CAR(function) == Olambda) { + function = EVAL(function); + if (LAMBDAP(function)) { + GC_ENTER(); + + GC_PROTECT(function); + lambda = function->data.lambda.code; + alist = (LispArgList*)function->data.lambda.name->data.opaque.data; + ComInlineCall(com, alist, NIL, arguments, lambda->data.lambda.code); + GC_LEAVE(); + break; + } + } + + default: + /* XXX If bytecode objects are made available, should + * handle it here. */ + LispDestroy("EVAL: %s is invalid as a function", + STROBJ(function)); + /*NOTREACHED*/ + break; + } +} + +/* Generate opcodes for an implicit PROGN */ +static void +ComProgn(LispCom *com, LispObj *code) +{ + if (CONSP(code)) { + for (; CONSP(code); code = CDR(code)) + ComEval(com, CAR(code)); + } + else + /* If no code to execute, empty PROGN returns NIL */ + com_Bytecode(com, XBC_NIL); +} + +/* Generate opcodes to evaluate <object>. */ +static void +ComEval(LispCom *com, LispObj *object) +{ + int offset; + LispObj *form; + + switch (OBJECT_TYPE(object)) { + case LispAtom_t: + if (IN_TAGBODY()) + ComLabel(com, object); + else { + offset = ComGetVariable(com, object); + if (offset >= 0) + /* Load from user stack at relative offset */ + com_Load(com, offset); + else if (offset == SYMBOL_KEYWORD) + com_LoadCon(com, object); + else if (offset == SYMBOL_CONSTANT) + /* Symbol defined as constant, just load it's value */ + com_LoadCon(com, LispGetVar(object)); + else + /* Load value bound to symbol at run time */ + com_LoadSym(com, object->data.atom); + } + break; + + case LispCons_t: { + /* Macro expansion may be done in the object form */ + form = com->form; + com->form = object; + ComFuncall(com, CAR(object), CDR(object), 1); + com->form = form; + } break; + + case LispQuote_t: + com_LoadCon(com, object->data.quote); + break; + + case LispBackquote_t: + /* Macro expansion is stored in the current value of com->form */ + ComMacroBackquote(com, object); + break; + + case LispComma_t: + LispDestroy("EVAL: comma outside of backquote"); + break; + + case LispFunctionQuote_t: + object = object->data.quote; + if (SYMBOLP(object)) + object = LispSymbolFunction(object); + else if (CONSP(object) && CAR(object) == Olambda) { + /* object will only be associated with bytecode later, + * so, make sure it is protected until compilation finishes */ + object = EVAL(object); + RPLACD(com->plist, CONS(CAR(com->plist), CDR(com->plist))); + RPLACA(com->plist, object); + } + else + LispDestroy("FUNCTION: %s is not a function", STROBJ(object)); + com_LoadCon(com, object); + break; + + case LispFixnum_t: + if (IN_TAGBODY()) { + ComLabel(com, object); + break; + } + /*FALLTROUGH*/ + + default: + /* Constant object */ + com_LoadCon(com, object); + break; + } +} + +/*********************************************************************** + * Lambda expansion helper functions + ***********************************************************************/ +static void +ComRecursiveCall(LispCom *com, LispArgList *alist, + LispObj *name, LispObj *arguments) +{ + int base, lex; + + /* Save state */ + lex = lisp__data.env.lex; + + FORM_ENTER(); + + /* Generate code to push function arguments in the stack */ + base = ComCall(com, alist, name, arguments, 1, 0, 0); + + /* Stack will grow this amount */ + CompileStackEnter(com, alist->num_arguments, 0); + +#if 0 + /* Make the variables available at run time */ + com_Bind(com, alist->num_arguments); + com->block->bind += alist->num_arguments; +#endif + + com_BytecodeChar(com, XBC_LETREC, alist->num_arguments); + +#if 0 + /* The variables are now unbound */ + com_Unbind(com, alist->num_arguments); + com->block->bind -= alist->num_arguments; +#endif + + /* Stack length is reduced */ + CompileStackLeave(com, alist->num_arguments, 0); + FORM_LEAVE(); + + /* Restore state */ + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = base; +} + +static void +ComInlineCall(LispCom *com, LispArgList *alist, + LispObj *name, LispObj *arguments, LispObj *lambda) +{ + int base, lex; + + /* Save state */ + lex = lisp__data.env.lex; + + FORM_ENTER(); + /* Start the inline function block */ + CompileIniBlock(com, LispBlockClosure, name); + + /* Generate code to push function arguments in the stack */ + base = ComCall(com, alist, name, arguments, 1, 0, 0); + + /* Stack will grow this amount */ + CompileStackEnter(com, alist->num_arguments, 0); + + /* Make the variables available at run time */ + com_Bind(com, alist->num_arguments); + com->block->bind += alist->num_arguments; + + /* Expand the lambda list */ + ComProgn(com, lambda); + + /* The variables are now unbound */ + com_Unbind(com, alist->num_arguments); + com->block->bind -= alist->num_arguments; + + /* Stack length is reduced */ + CompileStackLeave(com, alist->num_arguments, 0); + + /* Finish the inline function block */ + CompileFiniBlock(com); + FORM_LEAVE(); + + /* Restore state */ + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = base; +} + +/*********************************************************************** + * Macro expansion helper functions. + ***********************************************************************/ +static LispObj * +ComMacroExpandBackquote(LispCom *com, LispObj *object) +{ + return (LispEvalBackquote(object->data.quote, 1)); +} + +static LispObj * +ComMacroExpandFuncall(LispCom *com, LispObj *function, LispObj *arguments) +{ + return (LispFuncall(function, arguments, 1)); +} + +static LispObj * +ComMacroExpandEval(LispCom *com, LispObj *object) +{ + LispObj *result; + + switch (OBJECT_TYPE(object)) { + case LispAtom_t: + result = LispGetVar(object); + + /* Macro expansion requires bounded symbols */ + if (result == NULL) + LispDestroy("EVAL: the variable %s is unbound", + STROBJ(object)); + break; + + case LispCons_t: + result = ComMacroExpandFuncall(com, CAR(object), CDR(object)); + break; + + case LispQuote_t: + result = object->data.quote; + break; + + case LispBackquote_t: + result = ComMacroExpandBackquote(com, object); + break; + + case LispComma_t: + LispDestroy("EVAL: comma outside of backquote"); + + case LispFunctionQuote_t: + result = EVAL(object); + break; + + default: + result = object; + break; + } + + return (result); +} + +static LispObj * +ComMacroExpand(LispCom *com, LispObj *lambda) +{ + LispObj *result, **presult = &result, **plambda; + int jumped, *pjumped = &jumped, backquote, *pbackquote = &backquote; + LispBlock *block; + + int interpreter_lex, interpreter_head, interpreter_base; + + /* Save interpreter state */ + interpreter_base = lisp__data.stack.length; + interpreter_head = lisp__data.env.length; + interpreter_lex = lisp__data.env.lex; + + /* Use the variables */ + plambda = λ + *presult = NIL; + *pjumped = 1; + *pbackquote = !CONSP(lambda); + + block = LispBeginBlock(NIL, LispBlockProtect); + if (setjmp(block->jmp) == 0) { + if (!backquote) { + for (; CONSP(lambda); lambda = CDR(lambda)) + result = ComMacroExpandEval(com, CAR(lambda)); + } + else + result = ComMacroExpandBackquote(com, lambda); + + *pjumped = 0; + } + LispEndBlock(block); + + /* If tried to jump out of the macro expansion block */ + if (!lisp__data.destroyed && jumped) + LispDestroy("*** EVAL: bad jump in macro expansion"); + + /* Macro expansion did something wrong */ + if (lisp__data.destroyed) { + LispMessage("*** EVAL: aborting macro expansion"); + LispDestroy("."); + } + + /* Restore interpreter state */ + lisp__data.env.lex = interpreter_lex; + lisp__data.stack.length = interpreter_base; + lisp__data.env.head = lisp__data.env.length = interpreter_head; + + return (result); +} + +static void +ComMacroCall(LispCom *com, LispArgList *alist, + LispObj *name, LispObj *lambda, LispObj *arguments) +{ + int base; + LispObj *body; + + ++com->macro; + base = ComCall(com, alist, name, arguments, 0, 0, 0); + body = lambda->data.lambda.code; + body = ComMacroExpand(com, body); + --com->macro; + lisp__data.env.head = lisp__data.env.length = base; + + /* Macro is expanded, store the result */ + CAR(com->form) = body; + ComEval(com, body); +} + +static void +ComMacroBackquote(LispCom *com, LispObj *lambda) +{ + LispObj *body; + + ++com->macro; + body = ComMacroExpand(com, lambda); + --com->macro; + + /* Macro is expanded, store the result */ + CAR(com->form) = body; + + com_LoadCon(com, body); +} Index: xc/programs/xedit/lisp/core.c diff -u xc/programs/xedit/lisp/core.c:1.17 xc/programs/xedit/lisp/core.c:1.69 --- xc/programs/xedit/lisp/core.c:1.17 Sun Oct 28 09:18:49 2001 +++ xc/programs/xedit/lisp/core.c Thu Dec 19 23:32:45 2002 @@ -27,2552 +27,7014 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/core.c,v 1.17 2001/10/28 14:18:49 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/core.c,v 1.69 2002/12/20 04:32:45 paulo Exp $ */ +#include "io.h" #include "core.h" #include "format.h" #include "helper.h" +#include "package.h" #include "private.h" +#include "write.h" /* + * Types + */ +typedef struct _SeqInfo { + LispType type; + union { + LispObj *list; + LispObj **vector; + unsigned char *string; + } data; +} SeqInfo; + +#define SETSEQ(seq, object) \ + switch (seq.type = XOBJECT_TYPE(object)) { \ + case LispString_t: \ + seq.data.string = (unsigned char*)THESTR(object); \ + break; \ + case LispCons_t: \ + seq.data.list = object; \ + break; \ + default: \ + seq.data.list = object->data.array.list; \ + break; \ + } + +#ifdef NEED_SETENV +extern int setenv(const char *name, const char *value, int overwrite); +extern void unsetenv(const char *name); +#endif + +/* * Prototypes + */ +#define NONE 0 + +#define REMOVE 1 +#define SUBSTITUTE 2 +#define DELETE 3 +#define NSUBSTITUTE 4 + +#define ASSOC 1 +#define MEMBER 2 + +#define FIND 1 +#define POSITION 2 + +#define IF 1 +#define IFNOT 2 + +#define UNION 1 +#define INTERSECTION 2 +#define SETDIFFERENCE 3 +#define SETEXCLUSIVEOR 4 +#define SUBSETP 5 +#define NSETDIFFERENCE 6 +#define NINTERSECTION 7 +#define NUNION 8 +#define NSETEXCLUSIVEOR 9 + +#define COPY_LIST 1 +#define COPY_ALIST 2 +#define COPY_TREE 3 + +#define EVERY 1 +#define SOME 2 +#define NOTEVERY 3 +#define NOTANY 4 + +/* Call directly LispObjectCompare() if possible */ +#define FCODE(predicate) \ + predicate == Oeql ? FEQL : \ + predicate == Oequal ? FEQUAL : \ + predicate == Oeq ? FEQ : \ + predicate == Oequalp ? FEQUALP : 0 +#define FCOMPARE(predicate, left, right, code) \ + code == FEQ ? left == right : \ + code ? LispObjectCompare(left, right, code) != NIL : \ + APPLY2(predicate, left, right) != NIL + +#define FUNCTION_CHECK(predicate) \ + if (FUNCTIONP(predicate)) \ + predicate = (predicate)->data.atom->object + +#define CHECK_TEST_0() \ + if (test != UNSPEC && test_not != UNSPEC) \ + LispDestroy("%s: specify either :TEST or :TEST-NOT", \ + STRFUN(builtin)) + +#define CHECK_TEST() \ + CHECK_TEST_0(); \ + if (test_not == UNSPEC) { \ + if (test == UNSPEC) \ + lambda = Oeql; \ + else \ + lambda = test; \ + expect = 1; \ + } \ + else { \ + lambda = test_not; \ + expect = 0; \ + } \ + FUNCTION_CHECK(lambda); \ + code = FCODE(lambda) + + +static LispObj *LispAdjoin(LispBuiltin*, + LispObj*, LispObj*, LispObj*, LispObj*, LispObj*); +static LispObj *LispAssocOrMember(LispBuiltin*, int, int); +static LispObj *LispEverySomeAnyNot(LispBuiltin*, int); +static LispObj *LispFindOrPosition(LispBuiltin*, int, int); +static LispObj *LispDeleteOrRemoveDuplicates(LispBuiltin*, int); +static LispObj *LispDeleteRemoveXSubstitute(LispBuiltin*, int, int); +static LispObj *LispListSet(LispBuiltin*, int); +static LispObj *LispMapc(LispBuiltin*, int); +static LispObj *LispMapl(LispBuiltin*, int); +static LispObj *LispMapnconc(LispObj*); +extern LispObj *LispRunSetf(LispArgList*, LispObj*, LispObj*, LispObj*); +extern LispObj *LispRunSetfMacro(LispAtom*, LispObj*, LispObj*); +static LispObj *LispMergeSort(LispObj*, LispObj*, LispObj*, int); +static LispObj *LispXReverse(LispBuiltin*, int); +static LispObj *LispCopyList(LispBuiltin*, LispObj*, int); +static LispObj *LispValuesList(LispBuiltin*, int); +static LispObj *LispTreeEqual(LispObj*, LispObj*, LispObj*, int); +static LispDocType_t LispDocumentationType(LispBuiltin*, LispObj*); + +extern void LispSetAtomObjectProperty(LispAtom*, LispObj*); + +/* + * Initialization */ -extern LispObj *LispRunSetf(LispMac*, LispObj*, LispObj*, LispObj*); +LispObj *Oeq, *Oeql, *Oequal, *Oequalp, *Omake_array, + *Kinitial_contents, *Osetf, *Ootherwise, *Oquote; +LispObj *Ogensym_counter; +Atom_id Svariable, Sstructure, Stype, Ssetf; + /* * Implementation */ -LispObj * -Lisp_Mul(LispMac *mac, LispObj *list, char *fname) +void +LispCoreInit(void) { - double result = 1.0; + Oeq = STATIC_ATOM("EQ"); + Oeql = STATIC_ATOM("EQL"); + Oequal = STATIC_ATOM("EQUAL"); + Oequalp = STATIC_ATOM("EQUALP"); + Omake_array = STATIC_ATOM("MAKE-ARRAY"); + Kinitial_contents = KEYWORD("INITIAL-CONTENTS"); + Osetf = STATIC_ATOM("SETF"); + Ootherwise = STATIC_ATOM("OTHERWISE"); + LispExportSymbol(Ootherwise); + Oquote = STATIC_ATOM("QUOTE"); + LispExportSymbol(Oquote); + + Svariable = GETATOMID("VARIABLE"); + Sstructure = GETATOMID("STRUCTURE"); + Stype = GETATOMID("TYPE"); + + /* Create as a constant so that only the C code should change the value */ + Ogensym_counter = STATIC_ATOM("*GENSYM-COUNTER*"); + LispDefconstant(Ogensym_counter, FIXNUM(0), NIL); + LispExportSymbol(Ogensym_counter); - for (; list != NIL; list = CDR(list)) { - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - result *= NUMBER_VALUE(CAR(list)); - } - return (REAL(result)); + Ssetf = ATOMID(Osetf); } LispObj * -Lisp_Plus(LispMac *mac, LispObj *list, char *fname) +Lisp_Acons(LispBuiltin *builtin) +/* + acons key datum alist + */ { - double result = 0.0; + LispObj *key, *datum, *alist; - for (; list != NIL; list = CDR(list)) { - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - result += NUMBER_VALUE(CAR(list)); - } - return (REAL(result)); + alist = ARGUMENT(2); + datum = ARGUMENT(1); + key = ARGUMENT(0); + + return (CONS(CONS(key, datum), alist)); } -LispObj * -Lisp_Minus(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispAdjoin(LispBuiltin*builtin, LispObj *item, LispObj *list, + LispObj *key, LispObj *test, LispObj *test_not) { - double result; + GC_ENTER(); + int code, expect, value; + LispObj *lambda, *compare, *object; - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - result = NUMBER_VALUE(CAR(list)); - list = CDR(list); - if (list == NIL) - return (REAL(-result)); - for (; list != NIL; list = CDR(list)) { - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - result -= NUMBER_VALUE(CAR(list)); + CHECK_LIST(list); + CHECK_TEST(); + + if (key != UNSPEC) { + item = APPLY1(key, item); + /* Result is not guaranteed to be gc protected */ + GC_PROTECT(item); } - return (REAL(result)); -} -LispObj * -Lisp_Div(LispMac *mac, LispObj *list, char *fname) -{ - double result; + /* Check if item is not already in place */ + for (object = list; CONSP(object); object = CDR(object)) { + compare = CAR(object); + if (key != UNSPEC) { + compare = APPLY1(key, compare); + GC_PROTECT(compare); + value = FCOMPARE(lambda, item, compare, code); + /* Unprotect compare... */ + --lisp__data.protect.length; + } + else + value = FCOMPARE(lambda, item, compare, code); - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - result = NUMBER_VALUE(CAR(list)); - list = CDR(list); - if (list == NIL) { - if (result == 0.0) - LispDestroy(mac, "divide by 0, at %s", fname); - return (REAL(1.0 / result)); - } - for (; list != NIL; list = CDR(list)) { - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - if (NUMBER_VALUE(CAR(list))) - LispDestroy(mac, "divide by 0, at %s", fname); - result /= NUMBER_VALUE(CAR(list)); + if (value == expect) { + /* Item is already in list */ + GC_LEAVE(); + + return (list); + } } - return (REAL(result)); -} + GC_LEAVE(); -LispObj * -Lisp_OnePlus(LispMac *mac, LispObj *list, char *fname) -{ - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - return (REAL(NUMBER_VALUE(CAR(list)) + 1.0)); + return (CONS(item, list)); } LispObj * -Lisp_OneMinus(LispMac *mac, LispObj *list, char *fname) +Lisp_Adjoin(LispBuiltin *builtin) +/* + adjoin item list &key key test test-not + */ { - if (!NUMBER_P(CAR(list))) - LispDestroy(mac, ExpectingNumberAt, fname); - return (REAL(NUMBER_VALUE(CAR(list)) - 1.0)); -} + LispObj *item, *list, *key, *test, *test_not; -LispObj * -Lisp_Less(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispBoolCond(mac, list, fname, LESS)); -} + test_not = ARGUMENT(4); + test = ARGUMENT(3); + key = ARGUMENT(2); + list = ARGUMENT(1); + item = ARGUMENT(0); -LispObj * -Lisp_LessEqual(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispBoolCond(mac, list, fname, LESS_EQUAL)); + return (LispAdjoin(builtin, item, list, key, test, test_not)); } LispObj * -Lisp_Equal_(LispMac *mac, LispObj *list, char *fname) +Lisp_Append(LispBuiltin *builtin) +/* + append &rest lists + */ { - return (_LispBoolCond(mac, list, fname, EQUAL)); -} + GC_ENTER(); + LispObj *result, *cons, *list; -LispObj * -Lisp_Greater(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispBoolCond(mac, list, fname, GREATER)); -} + LispObj *lists; -LispObj * -Lisp_GreaterEqual(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispBoolCond(mac, list, fname, GREATER_EQUAL)); -} + lists = ARGUMENT(0); -LispObj * -Lisp_NotEqual(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispBoolCond(mac, list, fname, NOT_EQUAL)); + /* no arguments */ + if (!CONSP(lists)) + return (NIL); + + /* skip initial nil lists */ + for (; CONSP(CDR(lists)) && CAR(lists) == NIL; lists = CDR(lists)) + ; + + /* last argument is not copied (even if it is the single argument) */ + if (!CONSP(CDR(lists))) + return (CAR(lists)); + + /* make sure result is a list */ + list = CAR(lists); + CHECK_CONS(list); + result = cons = CONS(CAR(list), NIL); + GC_PROTECT(result); + for (list = CDR(list); CONSP(list); list = CDR(list)) { + RPLACD(cons, CONS(CAR(list), NIL)); + cons = CDR(cons); + } + lists = CDR(lists); + + /* copy intermediate lists */ + for (; CONSP(CDR(lists)); lists = CDR(lists)) { + list = CAR(lists); + if (list == NIL) + continue; + /* intermediate elements must be lists */ + CHECK_CONS(list); + for (; CONSP(list); list = CDR(list)) { + RPLACD(cons, CONS(CAR(list), NIL)); + cons = CDR(cons); + } + } + + /* add last element */ + RPLACD(cons, CAR(lists)); + + GC_LEAVE(); + + return (result); } LispObj * -Lisp_Aref(LispMac *mac, LispObj *list, char *fname) +Lisp_Aref(LispBuiltin *builtin) +/* + aref array &rest subscripts + */ { long c, count, idx, seq; - LispObj *ary = CAR(list), *dim = CDR(list), *obj; + LispObj *obj, *dim; + + LispObj *array, *subscripts; + + subscripts = ARGUMENT(1); + array = ARGUMENT(0); - if (ary->type != LispArray_t) - LispDestroy(mac, "%s is not an array, at %s", - LispStrObj(mac, ary), fname); - - for (count = 0, list = dim, obj = ary->data.array.dim; list != NIL; - count++, list = CDR(list), obj = CDR(obj)) { - if (count >= ary->data.array.rank) - LispDestroy(mac, "too many subscripts %s, at %s", - LispStrObj(mac, dim), fname); - if (!INDEX_P(CAR(list)) || - NUMBER_VALUE(CAR(list)) >= NUMBER_VALUE(CAR(obj))) - LispDestroy(mac, "%s is out of range or a bad index, at %s", - LispStrObj(mac, CAR(list)), fname); - } - if (count < ary->data.array.rank) - LispDestroy(mac, "too few subscripts %s, at %s", - LispStrObj(mac, dim), fname); + /* accept strings also */ + if (STRINGP(array) && CONSP(subscripts) && CDR(subscripts) == NIL) { + long offset, length = STRLEN(array); - for (count = seq = 0, list = dim; list != NIL; list = CDR(list), seq++) { - for (idx = 0, obj = ary->data.array.dim; idx < seq; obj = CDR(obj), ++idx) + CHECK_INDEX(CAR(subscripts)); + offset = FIXNUM_VALUE(CAR(subscripts)); + + if (offset >= length) + LispDestroy("%s: index %ld too large for sequence length %ld", + STRFUN(builtin), offset, length); + + return (SCHAR(THESTR(array)[offset])); + } + + CHECK_ARRAY(array); + + for (count = 0, dim = subscripts, obj = array->data.array.dim; CONSP(dim); + count++, dim = CDR(dim), obj = CDR(obj)) { + if (count >= array->data.array.rank) + LispDestroy("%s: too many subscripts %s", + STRFUN(builtin), STROBJ(subscripts)); + if (!INDEXP(CAR(dim)) || + FIXNUM_VALUE(CAR(dim)) >= FIXNUM_VALUE(CAR(obj))) + LispDestroy("%s: %s is out of range or a bad index", + STRFUN(builtin), STROBJ(CAR(dim))); + } + if (count < array->data.array.rank) + LispDestroy("%s: too few subscripts %s", + STRFUN(builtin), STROBJ(subscripts)); + + for (count = seq = 0, dim = subscripts; CONSP(dim); dim = CDR(dim), seq++) { + for (idx = 0, obj = array->data.array.dim; idx < seq; + obj = CDR(obj), ++idx) ; for (c = 1, obj = CDR(obj); obj != NIL; obj = CDR(obj)) - c *= NUMBER_VALUE(CAR(obj)); - count += c * NUMBER_VALUE(CAR(list)); + c *= FIXNUM_VALUE(CAR(obj)); + count += c * FIXNUM_VALUE(CAR(dim)); } - for (ary = ary->data.array.list; count > 0; ary = CDR(ary), count--) + for (array = array->data.array.list; count > 0; array = CDR(array), count--) ; - return (CAR(ary)); + return (CAR(array)); } -LispObj * -Lisp_Assoc(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispAssocOrMember(LispBuiltin *builtin, int function, int comparison) +/* + assoc item list &key test test-not key + assoc-if predicate list &key key + assoc-if-not predicate list &key key + member item list &key test test-not key + member-if predicate list &key key + member-if-not predicate list &key key + */ { - LispObj *cmp, *obj, *res = NIL; + int code = 0, expect, value; + LispObj *lambda, *result, *compare; + + LispObj *item, *list, *test, *test_not, *key; + + if (comparison == NONE) { + key = ARGUMENT(4); + test_not = ARGUMENT(3); + test = ARGUMENT(2); + list = ARGUMENT(1); + item = ARGUMENT(0); + lambda = NIL; + } + else { + key = ARGUMENT(2); + list = ARGUMENT(1); + lambda = ARGUMENT(0); + test = test_not = UNSPEC; + item = NIL; + } - cmp = CAR(list); - list = CDR(list); if (list == NIL) return (NIL); + CHECK_CONS(list); + + /* Resolve compare function, and expected result of comparison */ + if (comparison == NONE) { + CHECK_TEST(); + } + else + expect = comparison == IFNOT ? 0 : 1; + + result = NIL; + for (; CONSP(list); list = CDR(list)) { + compare = CAR(list); + if (function == ASSOC) { + if (!CONSP(compare)) + continue; + compare = CAR(compare); + } + if (key != UNSPEC) + compare = APPLY1(key, compare); - for (list = CAR(list); list != NIL; list = CDR(list)) { - if (list->type != LispCons_t || (obj = CAR(list))->type != LispCons_t) - LispDestroy(mac, ExpectingListAt, fname); - else if (_LispEqual(mac, cmp, CAR(obj)) == T) { - res = obj; + if (comparison == NONE) + value = FCOMPARE(lambda, item, compare, code); + else + value = APPLY1(lambda, compare) != NIL; + if (value == expect) { + result = list; + if (function == ASSOC) + result = CAR(result); break; } } + if (function == MEMBER) { + CHECK_LIST(list); + } - return (res); + return (result); } LispObj * -Lisp_And(LispMac *mac, LispObj *list, char *fname) +Lisp_Assoc(LispBuiltin *builtin) +/* + assoc item list &key test test-not key + */ { - LispObj *res = T; + return (LispAssocOrMember(builtin, ASSOC, NONE)); +} - for (; list != NIL; list = CDR(list)) { - if ((res = EVAL(CAR(list))) == NIL) - break; - } - return (res); +LispObj * +Lisp_AssocIf(LispBuiltin *builtin) +/* + assoc-if predicate list &key key + */ +{ + return (LispAssocOrMember(builtin, ASSOC, IF)); } LispObj * -Lisp_Append(LispMac *mac, LispObj *list, char *fname) +Lisp_AssocIfNot(LispBuiltin *builtin) +/* + assoc-if-not predicate list &key key + */ { - LispObj *res, *obj, *cdr, *cons, *frm; + return (LispAssocOrMember(builtin, ASSOC, IFNOT)); +} - if (list == NIL) - return (NIL); - else if (CDR(list) == NIL) - return (EVAL(CAR(list))); +LispObj * +Lisp_And(LispBuiltin *builtin) +/* + and &rest args + */ +{ + LispObj *result = T, *args; - frm = FRM; - res = cdr = NIL; + args = ARGUMENT(0); - for (; list != NIL; list = CDR(list)) { - if ((obj = EVAL(CAR(list))) == NIL) - continue; - if (obj->type != LispCons_t) { - if (CDR(list) != NIL) - LispDestroy(mac, ExpectingListAt, fname); - } - GCProtect(); - if (res == NIL) { - if (obj->type != LispCons_t) { - /* is last argument, as previous check didn't fail */ - res = obj; - GCUProtect(); - break; - } - res = cdr = CONS(CAR(obj), CDR(obj)); - FRM = CONS(res, FRM); - } - else { - if (CDR(cdr)->type == LispCons_t) { - cons = CDR(cdr); - while (CDR(cons)->type == LispCons_t) { - CDR(cdr) = CONS(CAR(cons), CDR(cons)); - cons = CDR(cons); - cdr = CDR(cdr); - } - CDR(cdr) = CONS(CAR(CDR(cdr)), obj); - } - else - CDR(cdr) = obj; - cdr = CDR(cdr); - } - GCUProtect(); + for (; CONSP(args); args = CDR(args)) { + result = EVAL(CAR(args)); + if (result == NIL) + break; } - FRM = frm; - return (res); + return (result); } LispObj * -Lisp_Apply(LispMac *mac, LispObj *list, char *fname) +Lisp_Apply(LispBuiltin *builtin) +/* + apply function arg &rest more-args + */ { - LispObj *obj, *eval, *cdr, *frm = FRM; + GC_ENTER(); + LispObj *result, *arguments; - eval = EVAL(CAR(list)); - if (!SYMBOL_P(eval) && eval->type != LispLambda_t) - LispDestroy(mac, "%s is not a valid function name, at %s", - LispStrObj(mac, eval), fname); - obj = NIL; - /* link eval to FRM to protect from GC */ - GCProtect(); - eval = cdr = CONS(eval, NIL); - FRM = CONS(eval, FRM); - GCUProtect(); - for (list = CDR(list); list != NIL; list = CDR(list)) { - obj = EVAL(CAR(list)); - if (CDR(list) != NIL) { - CDR(cdr) = CONS(obj, NIL); - cdr = CDR(cdr); - } - else - CDR(cdr) = obj; + LispObj *function, *arg, *more_args; + + more_args = ARGUMENT(2); + arg = ARGUMENT(1); + function = ARGUMENT(0); + + if (more_args == NIL) { + CHECK_LIST(arg); + arguments = arg; + for (; CONSP(arg); arg = CDR(arg)) + ; + CHECK_LIST(arg); } - if (obj != NIL && (obj->type != LispCons_t || CDR(obj)->type != LispCons_t)) - LispDestroy(mac, "last apply argument must be a list"); - /* Need to quote back to avoid double evaluation */ - while (obj != NIL) { - CAR(obj) = QUOTE(CAR(obj)); - obj = CDR(obj); + else { + LispObj *cons; + + CHECK_CONS(more_args); + arguments = cons = CONS(arg, NIL); + GC_PROTECT(arguments); + for (arg = CDR(more_args); + CONSP(arg); + more_args = arg, arg = CDR(arg)) { + RPLACD(cons, CONS(CAR(more_args), NIL)); + cons = CDR(cons); + } + more_args = CAR(more_args); + if (more_args != NIL) { + for (arg = more_args; CONSP(arg); arg = CDR(arg)) + ; + CHECK_LIST(arg); + RPLACD(cons, more_args); + } } - frm = FRM; + result = APPLY(function, arguments); + GC_LEAVE(); - return (EVAL(eval)); + return (result); } LispObj * -Lisp_Atom(LispMac *mac, LispObj *list, char *fname) +Lisp_Atom(LispBuiltin *builtin) +/* + atom object + */ { - LispObj *res; + LispObj *object; - if (list == NIL) - res = T; - else - switch (CAR(list)->type) { - case LispCons_t: - res = NIL; - break; - default: - res = T; - break; - } - return (res); + object = ARGUMENT(0); + + return (CONSP(object) ? NIL : T); } LispObj * -Lisp_Block(LispMac *mac, LispObj *list, char *fname) +Lisp_Block(LispBuiltin *builtin) +/* + block name &rest body + */ { int did_jump, *pdid_jump = &did_jump; - LispObj *res, **pres = &res; + LispObj *res, **pres = &res, **pbody; LispBlock *block; + + LispObj *name, *body; - if (CAR(list) != NIL && CAR(list) != T && !SYMBOL_P(CAR(list))) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, CAR(list)), fname); + body = ARGUMENT(1); + name = ARGUMENT(0); + if (!SYMBOLP(name) && name != NIL && name != T) + LispDestroy("%s: %s cannot name a block", + STRFUN(builtin), STROBJ(name)); + + pbody = &body; *pres = NIL; *pdid_jump = 1; - block = LispBeginBlock(mac, CAR(list), LispBlockTag); + block = LispBeginBlock(name, LispBlockTag); if (setjmp(block->jmp) == 0) { - *pres = Lisp_Progn(mac, CDR(list), fname); + for (; CONSP(body); body = CDR(body)) + res = EVAL(CAR(body)); *pdid_jump = 0; } - LispEndBlock(mac, block); + LispEndBlock(block); if (*pdid_jump) - *pres = mac->block.block_ret; + *pres = lisp__data.block.block_ret; - return (*pres); + return (res); } LispObj * -Lisp_Butlast(LispMac *mac, LispObj *list, char *fname) +Lisp_Boundp(LispBuiltin *builtin) +/* + boundp symbol + */ { - LispObj *res, *obj, *cdr; - int nlist; - - if ((obj = CAR(list))->type != LispCons_t) - LispDestroy(mac, "%s is not a list, at %s", - LispStrObj(mac, obj), fname); - cdr = NIL; - nlist = 0; - while (obj->type == LispCons_t) { - ++nlist; - obj = CDR(obj); - } - --nlist; - obj = CDR(list); - if (obj != NIL) { - obj = CAR(obj); - if (INDEX_P(obj)) { - int pos = NUMBER_VALUE(obj); - - if (pos == 0) { - res = CAR(list); - if (CDR(res)->type != LispCons_t) - /* CL compatible return value */ - return (CONS(CAR(res), NIL)); - return (res); - } - else { - if (pos > nlist) - return (NIL); - nlist -= pos - 1; - } - } - else - LispDestroy(mac, "%s is a invalid index, at %s", - LispStrObj(mac, obj), fname); + LispAtom *atom; + + LispObj *symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + + atom = symbol->data.atom; + if (atom->package == lisp__data.keyword || + (atom->a_object && atom->property->value != UNBOUND)) + return (T); + + return (NIL); +} + +LispObj * +Lisp_Butlast(LispBuiltin *builtin) +/* + butlast list &optional count + */ +{ + GC_ENTER(); + long length, count; + LispObj *result, *cons, *list, *ocount; + + ocount = ARGUMENT(1); + list = ARGUMENT(0); + + CHECK_LIST(list); + if (ocount == UNSPEC) + count = 1; + else { + CHECK_INDEX(ocount); + count = FIXNUM_VALUE(ocount); } + length = LispLength(list); - GCProtect(); /* just disable GC, no EVAL's below */ - res = NIL; - list = CAR(list); - for (; nlist > 0; list = CDR(list), nlist--) { - obj = CAR(list); - if (res == NIL) - res = cdr = CONS(obj, NIL); - else { - CDR(cdr) = CONS(obj, NIL); - cdr = CDR(cdr); - } + if (count == 0) + return (list); + else if (count >= length) + return (NIL); + + length -= count + 1; + result = cons = CONS(CAR(list), NIL); + GC_PROTECT(result); + for (list = CDR(list); length > 0; list = CDR(list), length--) { + RPLACD(cons, CONS(CAR(list), NIL)); + cons = CDR(cons); } - GCUProtect(); + GC_LEAVE(); - return (res); + return (result); } LispObj * -Lisp_Car(LispMac *mac, LispObj *list, char *fname) +Lisp_Nbutlast(LispBuiltin *builtin) +/* + nbutlast list &optional count + */ { - LispObj *res = NIL; + long length, count; + LispObj *result, *list, *ocount; - switch (CAR(list)->type) { - case LispNil_t: - return (NIL); - break; - case LispCons_t: - res = CAR(CAR(list)); - break; - default: - LispDestroy(mac, ExpectingListAt, fname); - /*NOTREACHED*/ + ocount = ARGUMENT(1); + list = ARGUMENT(0); + + CHECK_LIST(list); + if (ocount == UNSPEC) + count = 1; + else { + CHECK_INDEX(ocount); + count = FIXNUM_VALUE(ocount); } + length = LispLength(list); - return (res); + if (count == 0) + return (list); + else if (count >= length) + return (NIL); + + length -= count + 1; + result = list; + for (; length > 0; list = CDR(list), length--) + ; + RPLACD(list, NIL); + + return (result); } LispObj * -Lisp_Case(LispMac *mac, LispObj *list, char *fname) +Lisp_Car(LispBuiltin *builtin) +/* + car list + */ { - static char *other = "OTHERWISE"; - LispObj *key, *res; + LispObj *list, *result = NULL; - res = NIL; - key = EVAL(CAR(list)); + list = ARGUMENT(0); - for (list = CDR(list); list != NIL; list = CDR(list)) { - if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "expecting list, at %s", fname); - else if (CAR(CAR(list)) == T) { - if (CDR(list) != NIL) - LispDestroy(mac, "T must be the last clause, at %s", fname); - res = CDR(CAR(list)); - break; - } - else if (SYMBOL_P(CAR(CAR(list))) && - strcmp(other, STRPTR(CAR(CAR(list)))) == 0) { - if (CDR(list) != NIL) - LispDestroy(mac, "%s must be the last clause, at %s", - other, fname); - res = CDR(CAR(list)); + if (list == NIL) + result = NIL; + else { + CHECK_CONS(list); + result = CAR(list); + } + + return (result); +} + +LispObj * +Lisp_Case(LispBuiltin *builtin) +/* + case keyform &rest body + */ +{ + LispObj *result, *code, *keyform, *body, *form; + + body = ARGUMENT(1); + keyform = ARGUMENT(0); + + result = NIL; + keyform = EVAL(keyform); + + for (; CONSP(body); body = CDR(body)) { + code = CAR(body); + CHECK_CONS(code); + + form = CAR(code); + if (form == T || form == Ootherwise) { + if (CONSP(CDR(body))) + LispDestroy("%s: %s must be the last clause", + STRFUN(builtin), STROBJ(CAR(code))); + result = CDR(code); break; } - else if (CAR(CAR(list))->type == LispCons_t) { - LispObj *keylist = CAR(CAR(list)); - - for (; keylist->type == LispCons_t; keylist = CDR(keylist)) - if (_LispEqual(mac, key, CAR(keylist)) == T) { - res = CDR(CAR(list)); + else if (CONSP(form)) { + for (; CONSP(form); form = CDR(form)) + if (XEQL(keyform, CAR(form)) == T) { + result = CDR(code); break; } - if (keylist->type == LispCons_t) /* if found match */ + if (CONSP(form)) /* if found match */ break; } - else if (_LispEqual(mac, key, CAR(CAR(list))) == T) { - res = CDR(CAR(list)); + else if (XEQL(keyform, form) == T) { + result = CDR(code); break; } } + + for (body = result; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); - return (res->type == LispCons_t ? Lisp_Progn(mac, res, fname) : NIL); + return (result); } LispObj * -Lisp_Catch(LispMac *mac, LispObj *list, char *fname) +Lisp_Catch(LispBuiltin *builtin) +/* + catch tag &rest body + */ { int did_jump, *pdid_jump = &did_jump; LispObj *res, **pres = &res; LispBlock *block; + LispObj *tag, *body, **pbody; + + body = ARGUMENT(1); + tag = ARGUMENT(0); + + pbody = &body; *pres = NIL; *pdid_jump = 1; - block = LispBeginBlock(mac, CAR(list), LispBlockCatch); + block = LispBeginBlock(tag, LispBlockCatch); if (setjmp(block->jmp) == 0) { - *pres = Lisp_Progn(mac, CDR(list), fname); + for (; CONSP(body); body = CDR(body)) + res = EVAL(CAR(body)); *pdid_jump = 0; } - LispEndBlock(mac, block); + LispEndBlock(block); if (*pdid_jump) - *pres = mac->block.block_ret; + *pres = lisp__data.block.block_ret; - return (*pres); + return (res); } LispObj * -Lisp_Coerce(LispMac *mac, LispObj *list, char *fname) +Lisp_Coerce(LispBuiltin *builtin) +/* + coerce object result-type + */ { - LispObj *from, *to, *res = NIL; - LispType type = LispNil_t; - - from = CAR(list); - to = CAR(CDR(list)); - if (to == NIL) - LispDestroy(mac, "cannot convert %s to nil, at %s", - LispStrObj(mac, from), fname); - else if (to == T) - return (from); - else if (!SYMBOL_P(to)) - LispDestroy(mac, "bad argument %s, at %s", LispStrObj(mac, to), fname); - else { - if (strcmp(STRPTR(to), "ATOM") == 0 || strcmp(STRPTR(to), "SYMBOL") == 0) - type = LispAtom_t; - else if (strcmp(STRPTR(to), "REAL") == 0) - type = LispReal_t; - else if (strcmp(STRPTR(to), "CONS") == 0) - type = LispCons_t; - else if (strcmp(STRPTR(to), "STRING") == 0) - type = LispString_t; - else if (strcmp(STRPTR(to), "CHARACTER") == 0) - type = LispCharacter_t; - else if (strcmp(STRPTR(to), "OPAQUE") == 0) - type = LispOpaque_t; - else - LispDestroy(mac, "invalid type specification %s, at %s", - STRPTR(to), fname); - } + LispObj *object, *result_type; - if (from->type == LispOpaque_t) { - switch (type) { - case LispAtom_t: - res = ATOM(from->data.opaque.data); - break; - case LispString_t: - res = STRING(from->data.opaque.data); - break; - case LispCharacter_t: - res = CHAR((int)from->data.opaque.data); - break; - case LispReal_t: - res = REAL((double)((int)from->data.opaque.data)); - break; - case LispOpaque_t: - res = OPAQUE(from->data.opaque.data, 0); - break; - default: - LispDestroy(mac, "cannot convert %s to %s, at %s", - LispStrObj(mac, from), STRPTR(to), fname); - } - } - else if (from->type != type) { - if (type == LispString_t) - res = Lisp_String(mac, CONS(from, NIL), fname); - else if (type == LispCharacter_t) - res = Lisp_Character(mac, CONS(from, NIL), fname); - else - LispDestroy(mac, "cannot convert %s to %s, at %s", - LispStrObj(mac, from), STRPTR(to), fname); - } - else - res = from; + result_type = ARGUMENT(1); + object = ARGUMENT(0); - return (res); + return (LispCoerce(builtin, object, result_type)); } LispObj * -Lisp_Cdr(LispMac *mac, LispObj *list, char *fname) +Lisp_Cdr(LispBuiltin *builtin) +/* + cdr list + */ { - LispObj *res = NIL; + LispObj *list, *result = NULL; - switch (CAR(list)->type) { - case LispNil_t: - return (NIL); - break; - case LispCons_t: - res = CDR(CAR(list)); - break; - default: - LispDestroy(mac, ExpectingListAt, fname); - /*NOTREACHED*/ + list = ARGUMENT(0); + + if (list == NIL) + result = NIL; + else { + CHECK_CONS(list); + result = CDR(list); } - return (res); + return (result); } LispObj * -Lisp_Cond(LispMac *mac, LispObj *list, char *fname) +Lisp_C_r(LispBuiltin *builtin) +/* + c[ad]{2,4}r list + */ { - LispObj *eval, *res = NIL; + char *desc; - for (; list != NIL; list = CDR(list)) { - eval = CAR(list); - if (eval->type != LispCons_t) - LispDestroy(mac, "%s is a illegal clause for %s", - LispStrObj(mac, eval), fname); - res = EVAL(CAR(eval)); - if (res->type == LispNil_t) - continue; - for (eval = CDR(eval); eval != NIL; eval = CDR(eval)) - res = EVAL(CAR(eval)); - break; + LispObj *list, *result = NULL; + + list = ARGUMENT(0); + + result = list; + desc = STRFUN(builtin); + while (desc[1] != 'R') + ++desc; + while (*desc != 'C') { + if (result == NIL) + break; + CHECK_CONS(result); + result = *desc == 'A' ? CAR(result) : CDR(result); + --desc; } - return (res); + return (result); } LispObj * -Lisp_Cons(LispMac *mac, LispObj *list, char *fname) +Lisp_Cond(LispBuiltin *builtin) +/* + cond &rest body + */ { - return (CONS(CAR(list), CAR(CDR(list)))); -} + LispObj *result, *code, *body; -LispObj * -Lisp_Decf(LispMac *mac, LispObj *list, char *fname) -{ - double dval; - LispObj *sym = CAR(list), *num = EVAL(sym), - *obj = CDR(list) == NIL ? NIL : CAR(CDR(list)), *val; + body = ARGUMENT(0); - if (!NUMBER_P(num)) - LispDestroy(mac, "expecting number, at %s", fname); - if (obj != NIL) { - obj = EVAL(obj); - if (!NUMBER_P(obj)) - LispDestroy(mac, "expecting number, at %s", fname); + result = NIL; + for (; CONSP(body); body = CDR(body)) { + code = CAR(body); + + CHECK_CONS(code); + result = EVAL(CAR(code)); + if (result == NIL) + continue; + for (code = CDR(code); CONSP(code); code = CDR(code)) + result = EVAL(CAR(code)); + break; } + + return (result); +} - dval = NUMBER_VALUE(num) - (obj != NIL ? NUMBER_VALUE(obj) : 1.0); - val = REAL(dval); +static LispObj * +LispCopyList(LispBuiltin *builtin, LispObj *list, int function) +{ + GC_ENTER(); + LispObj *result, *cons; - if (!SYMBOL_P(sym)) { - /* a bit more complicated, but still faster than - * (setf place (- place 1)) - * in most cases, could directly change num, but that would cause - * side effects, like: - * (setq n '(1)) => 1 - * (setq m (car n)) => 1 - * (decf (car n)) => 0 - * m => 0 - * this should not happen. - * - * incf uses the same logic - */ - LispObj *frm = FRM; + if (list == NIL) + return (list); + CHECK_CONS(list); - obj = CONS(sym, CONS(val, NIL)); - FRM = CONS(obj, FRM); /* protect setf arguments */ - num = Lisp_Setf(mac, obj, fname); - frm = FRM; + result = cons = CONS(NIL, NIL); + GC_PROTECT(result); + if (CONSP(CAR(list))) { + switch (function) { + case COPY_LIST: + RPLACA(result, CAR(list)); + break; + case COPY_ALIST: + RPLACA(result, CONS(CAR(CAR(list)), CDR(CAR(list)))); + break; + case COPY_TREE: + RPLACA(result, LispCopyList(builtin, CAR(list), COPY_TREE)); + break; + } } - else { - if (obj != NIL) - num = _LispSet(mac, sym, val, fname, 0); + else + RPLACA(result, CAR(list)); + + for (list = CDR(list); CONSP(list); list = CDR(list)) { + CDR(cons) = CONS(NIL, NIL); + cons = CDR(cons); + if (CONSP(CAR(list))) { + switch (function) { + case COPY_LIST: + RPLACA(cons, CAR(list)); + break; + case COPY_ALIST: + RPLACA(cons, CONS(CAR(CAR(list)), CDR(CAR(list)))); + break; + case COPY_TREE: + RPLACA(cons, LispCopyList(builtin, CAR(list), COPY_TREE)); + break; + } + } else - num = _LispSet(mac, sym, val, fname, 0); + RPLACA(cons, CAR(list)); } + /* in case list is dotted */ + RPLACD(cons, list); + GC_LEAVE(); - return (num); + return (result); } LispObj * -Lisp_Defmacro(LispMac *mac, LispObj *list, char *fname) +Lisp_CopyAlist(LispBuiltin *builtin) +/* + copy-alist list + */ { - return (_LispDefLambda(mac, list, LispMacro)); + LispObj *list; + + list = ARGUMENT(0); + + return (LispCopyList(builtin, list, COPY_ALIST)); } LispObj * -Lisp_Defun(LispMac *mac, LispObj *list, char *fname) +Lisp_CopyList(LispBuiltin *builtin) +/* + copy-list list + */ { - return (_LispDefLambda(mac, list, LispFunction)); + LispObj *list; + + list = ARGUMENT(0); + + return (LispCopyList(builtin, list, COPY_LIST)); } LispObj * -Lisp_Defsetf(LispMac *mac, LispObj *list, char *fname) +Lisp_CopyTree(LispBuiltin *builtin) +/* + copy-tree list + */ { - if (CDR(CDR(list)) == NIL) { - LispObj *nam, *val; - - nam = CAR(list); - list = CDR(list); - val = CAR(list); - if (!SYMBOL_P(nam) || !SYMBOL_P(val)) - LispDestroy(mac, "syntax error at %s %s", fname, - LispStrObj(mac, nam)); - - LispSetAtomSetfProperty(mac, nam->data.atom, val); + LispObj *list; - return (nam); - } + list = ARGUMENT(0); - return (_LispDefLambda(mac, list, LispSetf)); + return (LispCopyList(builtin, list, COPY_TREE)); } LispObj * -Lisp_Do(LispMac *mac, LispObj *list, char *fname) +Lisp_Cons(LispBuiltin *builtin) +/* + cons car cdr + */ { - return (_LispDo(mac, list, fname, 0)); + LispObj *car, *cdr; + + cdr = ARGUMENT(1); + car = ARGUMENT(0); + + return (CONS(car, cdr)); } LispObj * -Lisp_DoP(LispMac *mac, LispObj *list, char *fname) +Lisp_Consp(LispBuiltin *builtin) +/* + consp object + */ { - return (_LispDo(mac, list, fname, 1)); + LispObj *object; + + object = ARGUMENT(0); + + return (CONSP(object) ? T : NIL); } LispObj * -Lisp_DoList(LispMac *mac, LispObj *list, char *fname) +Lisp_Constantp(LispBuiltin *builtin) +/* + constantp form &optional environment + */ { - return (_LispDoListTimes(mac, list, fname, 0)); + LispObj *form, *environment; + + environment = ARGUMENT(1); + form = ARGUMENT(0); + + /* not all self-evaluating objects are considered constants */ + if (!POINTERP(form) || + NUMBERP(form) || + XQUOTEP(form) || + (XCONSP(form) && CAR(form) == Oquote) || + (XSYMBOLP(form) && form->data.atom->constant) || + XSTRINGP(form) || + XARRAYP(form)) + return (T); + + return (NIL); } LispObj * -Lisp_DoTimes(LispMac *mac, LispObj *list, char *fname) +Lisp_Defconstant(LispBuiltin *builtin) +/* + defconstant name initial-value &optional documentation + */ { - return (_LispDoListTimes(mac, list, fname, 1)); + LispObj *name, *initial_value, *documentation; + + documentation = ARGUMENT(2); + initial_value = ARGUMENT(1); + name = ARGUMENT(0); + + CHECK_SYMBOL(name); + if (documentation != UNSPEC) { + CHECK_STRING(documentation); + } + else + documentation = NIL; + LispDefconstant(name, EVAL(initial_value), documentation); + + return (name); } LispObj * -Lisp_Elt(LispMac *mac, LispObj *list, char *fname) +Lisp_Defmacro(LispBuiltin *builtin) +/* + defmacro name lambda-list &rest body + */ { - int len, pos; - LispObj *seq = CAR(list), *opos = CAR(CDR(list)), *res; + LispArgList *alist; - /* if not a sequence, Lisp_Length will see it */ - len = Lisp_Length(mac, list, fname)->data.real; + LispObj *lambda, *name, *lambda_list, *body; - if (!INDEX_P(opos) || NUMBER_VALUE(opos) >= len) - LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, opos), fname); - pos = NUMBER_VALUE(opos); + body = ARGUMENT(2); + lambda_list = ARGUMENT(1); + name = ARGUMENT(0); - if (STRING_P(seq)) - res = CHAR(*(unsigned char*)(STRPTR(seq) + pos)); - else { - if (seq->type == LispArray_t) - seq = seq->data.array.list; + CHECK_SYMBOL(name); + alist = LispCheckArguments(LispMacro, lambda_list, ATOMID(name), 0); - for (; pos > 0; pos--, seq = CDR(seq)) - ; - res = CAR(seq); + if (CONSP(body) && STRINGP(CAR(body))) { + LispAddDocumentation(name, CAR(body), LispDocFunction); + body = CDR(body); } - return (res); -} + lambda_list = LispListProtectedArguments(alist); + lambda = LispNewLambda(name, body, lambda_list, LispMacro); -LispObj * -Lisp_Equal(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispEqual(mac, CAR(list), CAR(CDR(list)))); -} + if (name->data.atom->a_builtin || name->data.atom->a_compiled) { + if (name->data.atom->a_builtin) { + ERROR_CHECK_SPECIAL_FORM(name->data.atom); + } + /* redefining these may cause surprises if bytecode + * compiled functions references them */ + LispWarning("%s: %s is being redefined", STRFUN(builtin), ATOMID(name)); -LispObj * -Lisp_Error(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *str; + LispRemAtomBuiltinProperty(name->data.atom); + } - str = Lisp_Format(mac, CONS(NIL, list), fname); - LispDestroy(mac, "%s", STRPTR(str)); - /*NOTREACHED*/ + LispSetAtomFunctionProperty(name->data.atom, lambda, alist); + LispUseArgList(alist); - return (NIL); + return (name); } LispObj * -Lisp_Eval(LispMac *mac, LispObj *list, char *fname) +Lisp_Defun(LispBuiltin *builtin) +/* + defun name lambda-list &rest body + */ { - return (EVAL(CAR(list))); -} + LispArgList *alist; -LispObj * -Lisp_Evenp(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *obj = CAR(list); + LispObj *lambda, *name, *lambda_list, *body; - if (!INTEGER_P(obj)) - LispDestroy(mac, "expecting integer, at %s", fname); + body = ARGUMENT(2); + lambda_list = ARGUMENT(1); + name = ARGUMENT(0); - return ((int)NUMBER_VALUE(obj) % 2 ? NIL : T); -} + CHECK_SYMBOL(name); + alist = LispCheckArguments(LispFunction, lambda_list, ATOMID(name), 0); -LispObj * -Lisp_FMakunbound(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *atom; + if (CONSP(body) && STRINGP(CAR(body))) { + LispAddDocumentation(name, CAR(body), LispDocFunction); + body = CDR(body); + } - if (!SYMBOL_P(CAR(list))) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, CAR(list)), fname); - atom = CAR(list); + lambda_list = LispListProtectedArguments(alist); + lambda = LispNewLambda(name, body, lambda_list, LispFunction); - if (atom->data.atom->property) { - if (atom->data.atom->property->function) - LispRemAtomFunctionProperty(mac, atom->data.atom); - else if (atom->data.atom->property->builtin) - /* not a smart move, just looses a fast function, - * and gains no extra memory... */ - LispRemAtomBuiltinProperty(mac, atom->data.atom); + if (name->data.atom->a_builtin || name->data.atom->a_compiled) { + if (name->data.atom->a_builtin) { + ERROR_CHECK_SPECIAL_FORM(name->data.atom); + } + /* redefining these may cause surprises if bytecode + * compiled functions references them */ + LispWarning("%s: %s is being redefined", STRFUN(builtin), ATOMID(name)); + + LispRemAtomBuiltinProperty(name->data.atom); } + LispSetAtomFunctionProperty(name->data.atom, lambda, alist); + LispUseArgList(alist); - return (atom); + return (name); } LispObj * -Lisp_Funcall(LispMac *mac, LispObj *list, char *fname) +Lisp_Defsetf(LispBuiltin *builtin) +/* + defsetf function lambda-list &rest body + */ { - LispObj *fun = EVAL(CAR(list)); + LispArgList *alist; + LispObj *obj; + LispObj *lambda, *function, *lambda_list, *store, *body; - return (EVAL(CONS(fun, CDR(list)))); -} + body = ARGUMENT(2); + lambda_list = ARGUMENT(1); + function = ARGUMENT(0); -LispObj * -Lisp_Get(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *sym, *key, *res; + CHECK_SYMBOL(function); - if ((sym = CAR(list))->type != LispAtom_t) - LispDestroy(mac, "expecting symbol, at %s", fname); - list = CDR(list); - key = CAR(list); + if (body == NIL || (CONSP(body) && STRINGP(CAR(body)))) { + if (!SYMBOLP(lambda_list)) + LispDestroy("%s: syntax error %s %s", + STRFUN(builtin), STROBJ(function), STROBJ(lambda_list)); + if (body != NIL) + LispAddDocumentation(function, CAR(body), LispDocSetf); - res = LispGetAtomProperty(mac, sym->data.atom, key); + LispSetAtomSetfProperty(function->data.atom, lambda_list, NULL); - if (res != NIL) - res = CAR(res); - else { - list = CDR(list); - if (list == NIL) - res = NIL; - else - res = CAR(list); + return (function); } - return (res); + alist = LispCheckArguments(LispSetf, lambda_list, ATOMID(function), 0); + + store = CAR(body); + if (!CONSP(store)) + LispDestroy("%s: %s is a bad store value", + STRFUN(builtin), STROBJ(store)); + for (obj = store; CONSP(obj); obj = CDR(obj)) { + CHECK_SYMBOL(CAR(obj)); + } + + body = CDR(body); + if (CONSP(body) && STRINGP(CAR(body))) { + LispAddDocumentation(function, CAR(body), LispDocSetf); + body = CDR(body); + } + + lambda = LispNewLambda(function, body, store, LispSetf); + LispSetAtomSetfProperty(function->data.atom, lambda, alist); + LispUseArgList(alist); + + return (function); } LispObj * -Lisp_Gc(LispMac *mac, LispObj *list, char *fname) +Lisp_Defparameter(LispBuiltin *builtin) +/* + defparameter name initial-value &optional documentation + */ { - LispGC(mac, NIL, NIL); + LispObj *name, *initial_value, *documentation; + + documentation = ARGUMENT(2); + initial_value = ARGUMENT(1); + name = ARGUMENT(0); + + CHECK_SYMBOL(name); + if (documentation != UNSPEC) { + CHECK_STRING(documentation); + } + else + documentation = NIL; - return (list == NIL || CAR(list)->type == LispNil_t ? NIL : T); + LispProclaimSpecial(name, EVAL(initial_value), documentation); + + return (name); } LispObj * -Lisp_Go(LispMac *mac, LispObj *list, char *fname) +Lisp_Defvar(LispBuiltin *builtin) +/* + defvar name &optional initial-value documentation + */ { - unsigned blevel = mac->block.block_level; - LispObj *tag = CAR(list); + LispObj *name, *initial_value, *documentation; - if (tag != NIL && tag != T && !SYMBOL_P(tag) && !NUMBER_P(tag)) - goto cannot_go; + documentation = ARGUMENT(2); + initial_value = ARGUMENT(1); + name = ARGUMENT(0); + + CHECK_SYMBOL(name); + if (documentation != UNSPEC) { + CHECK_STRING(documentation); + } + else + documentation = NIL; - while (blevel) { - LispBlock *block = mac->block.block[--blevel]; + LispProclaimSpecial(name, + initial_value != UNSPEC ? EVAL(initial_value) : NULL, + documentation); - if (block->type == LispBlockClosure) - /* if reached a function call */ - break; - if (block->type == LispBlockBody) { - mac->block.block_ret = tag; - LispBlockUnwind(mac); - longjmp(block->jmp, 1); - } - } + return (name); +} -cannot_go: - LispDestroy(mac, "cannot go to %s, at %s", LispStrObj(mac, tag), fname); +LispObj * +Lisp_Delete(LispBuiltin *builtin) +/* + delete item sequence &key from-end test test-not start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, DELETE, NONE)); +} - /*NOTREACHED*/ - return (NIL); +LispObj * +Lisp_DeleteIf(LispBuiltin *builtin) +/* + delete-if predicate sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, DELETE, IF)); } LispObj * -Lisp_Incf(LispMac *mac, LispObj *list, char *fname) +Lisp_DeleteIfNot(LispBuiltin *builtin) +/* + delete-if-not predicate sequence &key from-end start end count key + */ { - double dval; - LispObj *sym = CAR(list), *num = EVAL(sym), - *obj = CDR(list) == NIL ? NIL : CAR(CDR(list)), *val; + return (LispDeleteRemoveXSubstitute(builtin, DELETE, IFNOT)); +} - if (!NUMBER_P(num)) - LispDestroy(mac, "expecting number, at %s", fname); - if (obj != NIL) { - obj = EVAL(obj); - if (!NUMBER_P(obj)) - LispDestroy(mac, "expecting number, at %s", fname); - } +LispObj * +Lisp_DeleteDuplicates(LispBuiltin *builtin) +/* + delete-duplicates sequence &key from-end test test-not start end key + */ +{ + return (LispDeleteOrRemoveDuplicates(builtin, DELETE)); +} + +LispObj * +Lisp_Do(LispBuiltin *builtin) +/* + do init test &rest body + */ +{ + return (LispDo(builtin, 0)); +} - dval = NUMBER_VALUE(num) + (obj != NIL ? NUMBER_VALUE(obj) : 1.0); - val = REAL(dval); +LispObj * +Lisp_DoP(LispBuiltin *builtin) +/* + do* init test &rest body + */ +{ + return (LispDo(builtin, 1)); +} - if (!SYMBOL_P(sym)) { - LispObj *frm = FRM; +static LispDocType_t +LispDocumentationType(LispBuiltin *builtin, LispObj *type) +{ + Atom_id atom; + LispDocType_t doc_type = LispDocVariable; - obj = CONS(sym, CONS(val, NIL)); - FRM = CONS(obj, FRM); /* protect setf arguments */ - num = Lisp_Setf(mac, obj, fname); - frm = FRM; - } + CHECK_SYMBOL(type); + atom = ATOMID(type); + + if (atom == Svariable) + doc_type = LispDocVariable; + else if (atom == Sfunction) + doc_type = LispDocFunction; + else if (atom == Sstructure) + doc_type = LispDocStructure; + else if (atom == Stype) + doc_type = LispDocType; + else if (atom == Ssetf) + doc_type = LispDocSetf; else { - if (obj != NIL) - num = _LispSet(mac, sym, val, fname, 0); - else - num = _LispSet(mac, sym, val, fname, 0); + LispDestroy("%s: unknown documentation type %s", + STRFUN(builtin), STROBJ(type)); + /*NOTREACHED*/ } - return (num); + return (doc_type); } LispObj * -Lisp_If(LispMac *mac, LispObj *list, char *fname) +Lisp_Documentation(LispBuiltin *builtin) +/* + documentation symbol type + */ { - LispObj *cond, *res; + LispObj *symbol, *type; - cond = EVAL(CAR(list)); - list = CDR(list); - if (cond != NIL) - res = EVAL(CAR(list)); - else { - if (CDR(list) == NIL) - res = NIL; - else - res = EVAL(CAR(CDR(list))); - } + type = ARGUMENT(1); + symbol = ARGUMENT(0); - return (res); + CHECK_SYMBOL(symbol); + /* type is checked in LispDocumentationType() */ + + return (LispGetDocumentation(symbol, LispDocumentationType(builtin, type))); } LispObj * -Lisp_Integerp(LispMac *mac, LispObj *list, char *fname) +Lisp_DoList(LispBuiltin *builtin) { - return (INTEGER_P(CAR(list)) ? T : NIL); + return (LispDoListTimes(builtin, 0)); } LispObj * -Lisp_Lambda(LispMac *mac, LispObj *list, char *fname) +Lisp_DoTimes(LispBuiltin *builtin) { - return (_LispDefLambda(mac, list, LispLambda)); + return (LispDoListTimes(builtin, 1)); } LispObj * -Lisp_Last(LispMac *mac, LispObj *list, char *fname) +Lisp_Elt(LispBuiltin *builtin) +/* + elt sequence index + svref sequence index + */ { - LispObj *seq, *obj; - int nseq, count; + long offset, length; + LispObj *result, *sequence, *oindex; - if ((seq = CAR(list)) == NIL) - return (seq); - else if (seq->type != LispCons_t) - LispDestroy(mac, ExpectingListAt, fname); + oindex = ARGUMENT(1); + sequence = ARGUMENT(0); - if (CDR(list) != NIL) { - obj = CAR(CDR(list)); - if (!INDEX_P(obj)) - LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, obj), fname); - count = NUMBER_VALUE(obj); - } - else - count = 1; + length = LispLength(sequence); - for (nseq = 0, obj = seq; obj->type == LispCons_t; nseq++, obj = CDR(obj)) - ; + CHECK_INDEX(oindex); + offset = FIXNUM_VALUE(oindex); - count = nseq - count; + if (offset >= length) + LispDestroy("%s: index %ld too large for sequence length %ld", + STRFUN(builtin), offset, length); - if (count > nseq) - return (NIL); - else if (count <= 0) - return (seq); + if (STRINGP(sequence)) + result = SCHAR(THESTR(sequence)[offset]); + else { + if (ARRAYP(sequence)) + sequence = sequence->data.array.list; - for (; count > 0; count--, seq = CDR(seq)) - ; + for (; offset > 0; offset--, sequence = CDR(sequence)) + ; + result = CAR(sequence); + } - return (seq); + return (result); } LispObj * -Lisp_Length(LispMac *mac, LispObj *list, char *fname) +Lisp_Endp(LispBuiltin *builtin) +/* + endp object + */ { - LispObj *obj; - int length = 0; + LispObj *object; - obj = CAR(list); - switch (obj->type) { - case LispNil_t: - break; - case LispString_t: - length = strlen(STRPTR(obj)); - break; - case LispArray_t: - if (obj->data.array.rank != 1) - goto notseq; - obj = obj->data.array.list; - /*FALLTROUGH*/ - case LispCons_t: - while (obj->type == LispCons_t) { - ++length; - obj = CDR(obj); - } - break; - default: -notseq: - LispDestroy(mac, "%s is not a sequence, at %s", - LispStrObj(mac, obj), fname); - /*NOTREACHED*/ - } + object = ARGUMENT(0); - return (REAL(length)); + if (object == NIL) + return (T); + CHECK_CONS(object); + + return (NIL); } LispObj * -Lisp_Let(LispMac *mac, LispObj *list, char *fname) +Lisp_Eq(LispBuiltin *builtin) +/* + eq left right + */ { - return (LispEnvRun(mac, list, Lisp_Progn, fname, 0)); + LispObj *left, *right; + + right = ARGUMENT(1); + left = ARGUMENT(0); + + return (XEQ(left, right)); } LispObj * -Lisp_LetP(LispMac *mac, LispObj *list, char *fname) +Lisp_Eql(LispBuiltin *builtin) +/* + eql left right + */ { - return (LispEnvRun(mac, list, Lisp_Progn, fname, 1)); + LispObj *left, *right; + + right = ARGUMENT(1); + left = ARGUMENT(0); + + return (XEQL(left, right)); } LispObj * -Lisp_List(LispMac *mac, LispObj *list, char *fname) +Lisp_Equal(LispBuiltin *builtin) +/* + equal left right + */ { - return (list); + LispObj *left, *right; + + right = ARGUMENT(1); + left = ARGUMENT(0); + + return (XEQUAL(left, right)); } LispObj * -Lisp_ListP(LispMac *mac, LispObj *list, char *fname) +Lisp_Equalp(LispBuiltin *builtin) +/* + equalp left right + */ { - LispObj *res, *cdr, *obj; + LispObj *left, *right; - obj = EVAL(CAR(list)); - if (CDR(list) == NIL) - return (obj); - - GCProtect(); /* just disable GC, no EVAL's below */ - res = NIL; - cdr = obj; - for (list = CDR(list); list != NIL; list = CDR(list)) { - obj = EVAL(CAR(list)); - if (res == NIL) - res = cdr = CONS(cdr, obj); - else { - CDR(cdr) = CONS(CDR(cdr), obj); - cdr = CDR(cdr); - } - } - GCUProtect(); + right = ARGUMENT(1); + left = ARGUMENT(0); - return (res); + return (XEQUALP(left, right)); } LispObj * -Lisp_Listp(LispMac *mac, LispObj *list, char *fname) +Lisp_Error(LispBuiltin *builtin) +/* + error control-string &rest arguments + */ { - switch (CAR(list)->type) { - case LispNil_t: - case LispCons_t: - return (T); - default: - return (NIL); - } + LispObj *string, *arglist; + + LispObj *control_string, *arguments; + + arguments = ARGUMENT(1); + control_string = ARGUMENT(0); + + arglist = CONS(NIL, CONS(control_string, arguments)); + GC_PROTECT(arglist); + string = APPLY(Oformat, arglist); + LispDestroy("%s", THESTR(string)); /*NOTREACHED*/ + + /* No need to call GC_ENTER() and GC_LEAVE() macros */ + return (NIL); } LispObj * -Lisp_Loop(LispMac *mac, LispObj *list, char *fname) +Lisp_Eval(LispBuiltin *builtin) +/* + eval form + */ { - LispObj *obj, *res; - LispBlock *block; + int lex; + LispObj *form, *result; - res = NIL; - block = LispBeginBlock(mac, NIL, LispBlockTag); - if (setjmp(block->jmp) == 0) { - for (;;) - for (obj = list; obj != NIL; obj = CDR(obj)) - (void)EVAL(CAR(obj)); - } - LispEndBlock(mac, block); - res = mac->block.block_ret; + form = ARGUMENT(0); - return (res); + /* make sure eval form will not access local variables */ + lex = lisp__data.env.lex; + lisp__data.env.lex = lisp__data.env.length; + result = EVAL(form); + lisp__data.env.lex = lex; + + return (result); } -LispObj * -Lisp_Makearray(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispEverySomeAnyNot(LispBuiltin *builtin, int function) +/* + every predicate sequence &rest more-sequences + some predicate sequence &rest more-sequences + notevery predicate sequence &rest more-sequences + notany predicate sequence &rest more-sequences + */ { - LispType type = LispNil_t; - long rank = 0, count = 1, zero, offset, c; - LispObj *ary = NIL, *dim = NIL, *init, *typ, *cont, *disp, *off, *obj; - - if (NUMBER_P(CAR(list))) { - if (!INDEX_P(CAR(list))) - LispDestroy(mac, "%s is a bad array dimension, at %s", - LispStrObj(mac, CAR(list)), fname); - else - dim = CONS(CAR(list), NIL); - rank = 1; - count = NUMBER_VALUE(CAR(list)); + GC_ENTER(); + long i, j, length, count; + LispObj *result, *list, *item, *arguments, *acons, *value; + SeqInfo stk[8], *seqs; + + LispObj *predicate, *sequence, *more_sequences; + + more_sequences = ARGUMENT(2); + sequence = ARGUMENT(1); + predicate = ARGUMENT(0); + + count = 1; + length = LispLength(sequence); + for (list = more_sequences; CONSP(list); list = CDR(list), count++) { + i = LispLength(CAR(list)); + if (i < length) + length = i; } - else if (CAR(list)->type == LispCons_t) { - dim = CAR(list); + + result = function == EVERY || function == NOTANY ? T : NIL; + + /* if at least one sequence has length zero */ + if (length == 0) + return (result); + + if (count > sizeof(stk) / sizeof(stk[0])) + seqs = LispMalloc(count * sizeof(SeqInfo)); + else + seqs = &stk[0]; - for (obj = dim, rank = 0; obj != NIL; obj = CDR(obj), ++rank) { - if (obj->type != LispCons_t || !INDEX_P(CAR(obj))) - LispDestroy(mac, "%s is a bad array dimension, at %s", - LispStrObj(mac, dim), fname); - count *= NUMBER_VALUE(CAR(obj)); + /* build information about sequences */ + SETSEQ(seqs[0], sequence); + for (i = 1, list = more_sequences; CONSP(list); list = CDR(list), i++) { + item = CAR(list); + SETSEQ(seqs[i], item); + } + + /* prepare argument list */ + arguments = acons = CONS(NIL, NIL); + GC_PROTECT(arguments); + for (i = 1; i < count; i++) { + RPLACD(acons, CONS(NIL, NIL)); + acons = CDR(acons); + } + + /* loop applying predicate in sequence elements */ + for (i = 0; i < length; i++) { + + /* build argument list */ + for (acons = arguments, j = 0; j < count; acons = CDR(acons), j++) { + if (seqs[j].type == LispString_t) + item = SCHAR(*seqs[j].data.string++); + else { + item = CAR(seqs[j].data.list); + seqs[j].data.list = CDR(seqs[j].data.list); + } + RPLACA(acons, item); } - } - offset = -1; - LispGetKeys(mac, fname, - "INITIAL-ELEMENT:ELEMENT-TYPE:INITIAL-CONTENTS" - ":DISPLACED-TO:DISPLACED-INDEX-OFFSET", - CDR(list), &init, &typ, &cont, &disp, &off); + /* apply predicate */ + value = APPLY(predicate, arguments); - /* check element-type */ - if (typ != NIL) { - if (typ == T) - type = LispTrue_t; - else if (!SYMBOL_P(typ)) - LispDestroy(mac, "unsupported element type %s, at %s", - LispStrObj(mac, typ), fname); + /* check if needs to terminate loop */ + if (value == NIL) { + if (function == EVERY) { + result = NIL; + break; + } + if (function == NOTEVERY) { + result = T; + break; + } + } else { - if (strcmp(STRPTR(typ), "ATOM") == 0) - type = LispAtom_t; - else if (strcmp(STRPTR(typ), "REAL") == 0) - type = LispReal_t; - else if (strcmp(STRPTR(typ), "STRING") == 0) - type = LispString_t; - else if (strcmp(STRPTR(typ), "LIST") == 0) - type = LispCons_t; - else if (strcmp(STRPTR(typ), "OPAQUE") == 0) - type = LispOpaque_t; - else - LispDestroy(mac, "unsupported element type %s, at %s", - STRPTR(typ), fname); + if (function == SOME) { + result = value; + break; + } + if (function == NOTANY) { + result = NIL; + break; + } } } - /* check initial-contents */ - if (cont != NIL && cont->type != LispCons_t) - LispDestroy(mac, "%s is not a list, at %s", - LispStrObj(mac, cont), fname); + GC_LEAVE(); + if (seqs != &stk[0]) + LispFree(seqs); - /* check displaced-to */ - if (disp != NIL && disp->type != LispArray_t) - LispDestroy(mac, "%s is not an array, at %s", - LispStrObj(mac, disp), fname); + return (result); +} - /* check displaced-index-offset */ - if (off != NIL) { - if (!INDEX_P(off)) - LispDestroy(mac, "%s is a bad :DISPLACED-INDEX-OFFSET, at %s", - LispStrObj(mac, off), fname); - offset = (int)NUMBER_VALUE(off); - } - - c = 0; - if (init != NIL) - ++c; - if (cont != NIL) - ++c; - if (disp != NIL || offset >= 0) - ++c; - if (c > 1) - LispDestroy(mac, "more than one initialization specified, at %s", - fname); - - zero = count == 0; - if (disp != NIL) { - if (offset < 0) - offset = 0; - for (c = 1, obj = disp->data.array.dim; obj != NIL; obj = CDR(obj)) - c *= (int)NUMBER_VALUE(CAR(obj)); - if (c < count + offset) - LispDestroy(mac, "array-total-size + displaced-index-offset " - "exceeds total size, at %s", fname); - for (c = 0, ary = disp->data.array.list; c < offset; c++) - ary = CDR(ary); - } - else if (cont != NIL) { - if (rank == 1) { - for (ary = cont, c = 0; c < count; ary = CDR(ary), ++c) - if (ary->type != LispCons_t) - LispDestroy(mac, "bad argument or size %s, at %s", - LispStrObj(mac, ary), fname); - if (ary != NIL) - LispDestroy(mac, "bad argument or size %s, at %s", - LispStrObj(mac, ary), fname); - ary = cont; - } - else { - LispObj *err = NIL; - /* check if list matches */ - int i, j, k, *dims, *loop; - - /* create iteration variables */ - dims = LispMalloc(mac, sizeof(int) * rank); - loop = LispCalloc(mac, 1, sizeof(int) * (rank - 1)); - for (i = 0, obj = dim; obj != NIL; i++, obj = CDR(obj)) - dims[i] = (int)NUMBER_VALUE(CAR(obj)); - - /* check if list matches specified dimensions */ - while (loop[0] < dims[0]) { - for (obj = cont, i = 0; i < rank - 1; i++) { - for (j = 0; j < loop[i]; j++) - obj = CDR(obj); - err = obj; - if ((obj = CAR(obj))->type != LispCons_t) - goto make_array_error; - err = obj; - } - --i; - for (;;) { - ++loop[i]; - if (i && loop[i] >= dims[i]) - loop[i] = 0; - else - break; - --i; - } - for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { - if (obj->type != LispCons_t) - goto make_array_error; - } - if (obj == NIL) - continue; -make_array_error: - LispFree(mac, dims); - LispFree(mac, loop); - LispDestroy(mac, "bad argument or size %s, at %s", - LispStrObj(mac, err), fname); - } - - /* list is correct, use it to fill initial values */ - - /* reset loop */ - memset(loop, 0, sizeof(int) * (rank - 1)); - - GCProtect(); - /* fill array with supplied values */ - while (loop[0] < dims[0]) { - for (obj = cont, i = 0; i < rank - 1; i++) { - for (j = 0; j < loop[i]; j++) - obj = CDR(obj); - obj = CAR(obj); - } - --i; - for (;;) { - ++loop[i]; - if (i && loop[i] >= dims[i]) - loop[i] = 0; - else - break; - --i; - } - for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { - if (ary == NIL) - ary = CONS(CAR(obj), NIL); - else { - CDR(ary) = CONS(CAR(ary), CDR(ary)); - CAR(ary) = CAR(obj); - } - } - } - LispFree(mac, dims); - LispFree(mac, loop); - ary = LispReverse(ary); - GCUProtect(); - } - } - else { - GCProtect(); - /* allocate array */ - if (count) { - --count; - ary = CONS(init, NIL); - while (count) { - CDR(ary) = CONS(CAR(ary), CDR(ary)); - CAR(ary) = init; - count--; - } - } - GCUProtect(); - } - - if (type == LispNil_t) - type = LispTrue_t; - obj = LispNew(mac, ary, dim); - obj->type = LispArray_t; - obj->data.array.list = ary; - obj->data.array.dim = dim; - obj->data.array.rank = rank; - obj->data.array.type = type; /* XXX ignored */ - obj->data.array.zero = zero; - - return (obj); -} - LispObj * -Lisp_Makelist(LispMac *mac, LispObj *list, char *fname) +Lisp_Every(LispBuiltin *builtin) +/* + every predicate sequence &rest more-sequences + */ { - int count; - LispObj *res, *data, *tail; - - if (!INDEX_P(CAR(list))) - LispDestroy(mac, "%s is not a positive integer, at %s", - LispStrObj(mac, CAR(list)), fname); - - count = NUMBER_VALUE(CAR(list)); - LispGetKeys(mac, fname, "INITIAL-ELEMENT", CDR(list), &data); - - GCProtect(); - res = tail = CONS(data, data); - for (; count > 1; count--) - res = CONS(data, res); - CDR(tail) = NIL; - GCUProtect(); - - return (res); + return (LispEverySomeAnyNot(builtin, EVERY)); } LispObj * -Lisp_Makunbound(LispMac *mac, LispObj *list, char *fname) +Lisp_Some(LispBuiltin *builtin) +/* + some predicate sequence &rest more-sequences + */ { - if (!SYMBOL_P(CAR(list))) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, CAR(list)), fname); - - LispUnsetVar(mac, CAR(list)); - - return (CAR(list)); + return (LispEverySomeAnyNot(builtin, SOME)); } LispObj * -Lisp_Mapcar(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *obj, *eval, *res, *cdres, *car, *cdr, *ptr, *fun, *frm = FRM; - int i, level; - - fun = EVAL(CAR(list)); - if (!SYMBOL_P(fun) && fun->type != LispLambda_t) - LispDestroy(mac, "%s is not a valid function name, at %s", - LispStrObj(mac, fun), fname); - cdres = NIL; - for (level = 0, res = NIL; ; level++) { - LispObj *tfrm = FRM; - - eval = cdr = CONS(fun, NIL); - FRM = CONS(eval, FRM); /* protect eval, as there is n EVAL's below */ - for (ptr = CDR(list); ptr != NIL; ptr = CDR(ptr)) { - car = EVAL(CAR(ptr)); - if (car->type != LispCons_t) - goto mapcar_done; - for (i = 0, obj = car; i < level; i++) { - if ((obj = CDR(obj)) == NIL) - goto mapcar_done; - } - /* quote back to avoid double eval */ - GCProtect(); - car = QUOTE(CAR(obj)); - CDR(cdr) = CONS(car, NIL); - cdr = CDR(cdr); - GCUProtect(); - } - obj = EVAL(eval); - FRM = tfrm; - if (res == NIL) { - GCProtect(); - res = cdres = CONS(obj, NIL); - FRM = CONS(res, FRM); /* protect res linking to FRM */ - GCUProtect(); - } - else { - CDR(cdres) = CONS(obj, NIL); - cdres = CDR(cdres); - } - } - - FRM = frm; /* no need for GC protection now */ - - /* to be CL compatible */ -mapcar_done: - return (res); +Lisp_Notevery(LispBuiltin *builtin) +/* + notevery predicate sequence &rest more-sequences + */ +{ + return (LispEverySomeAnyNot(builtin, NOTEVERY)); } LispObj * -Lisp_Max(LispMac *mac, LispObj *list, char *fname) +Lisp_Notany(LispBuiltin *builtin) +/* + notany predicate sequence &rest more-sequences + */ { - return (_LispMinMax(mac, list, fname, 1)); + return (LispEverySomeAnyNot(builtin, NOTANY)); } LispObj * -Lisp_Member(LispMac *mac, LispObj *list, char *fname) +Lisp_Fboundp(LispBuiltin *builtin) +/* + fboundp symbol + */ { - LispObj *obj = CAR(list), *res = NIL; + LispAtom *atom; - list = CAR(CDR(list)); - if (list->type == LispNil_t) - return (NIL); - else if (list->type != LispCons_t) - LispDestroy(mac, ExpectingListAt, fname); + LispObj *symbol = ARGUMENT(0); - for (; list != NIL; list = CDR(list)) - if (_LispEqual(mac, obj, CAR(list)) == T) { - res = list; - break; - } + CHECK_SYMBOL(symbol); - return (res); -} + atom = symbol->data.atom; + if (atom->a_function || atom->a_builtin || atom->a_compiled) + return (T); -LispObj * -Lisp_Min(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispMinMax(mac, list, fname, 0)); + return (NIL); } LispObj * -Lisp_Minusp(LispMac *mac, LispObj *list, char *fname) +Lisp_Find(LispBuiltin *builtin) +/* + find item sequence &key from-end test test-not start end key + */ { - LispObj *obj = CAR(list); - - if (!NUMBER_P(obj)) - LispDestroy(mac, "expecting number, at %s", fname); - - return (NUMBER_VALUE(obj) < 0.0 ? T : NIL); + return (LispFindOrPosition(builtin, FIND, NONE)); } LispObj * -Lisp_Nth(LispMac *mac, LispObj *list, char *fname) +Lisp_FindIf(LispBuiltin *builtin) +/* + find-if predicate sequence &key from-end start end key + */ { - return (_LispNth(mac, list, fname, 0)); + return (LispFindOrPosition(builtin, FIND, IF)); } LispObj * -Lisp_Nthcdr(LispMac *mac, LispObj *list, char *fname) +Lisp_FindIfNot(LispBuiltin *builtin) +/* + find-if-not predicate sequence &key from-end start end key + */ { - return (_LispNth(mac, list, fname, 1)); + return (LispFindOrPosition(builtin, FIND, IFNOT)); } LispObj * -Lisp_Null(LispMac *mac, LispObj *list, char *fname) +Lisp_Fill(LispBuiltin *builtin) +/* + fill sequence item &key start end + */ { - LispObj *res = NIL; + long i, start, end, length; - if (list != NIL && CAR(list)->type == LispNil_t) - res = T; - return (res); -} + LispObj *sequence, *item, *ostart, *oend; -LispObj * -Lisp_Numberp(LispMac *mac, LispObj *list, char *fname) -{ - return (NUMBER_P(CAR(list)) ? T : NIL); -} + oend = ARGUMENT(3); + ostart = ARGUMENT(2); + item = ARGUMENT(1); + sequence = ARGUMENT(0); + + LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, + &start, &end, &length); + + if (STRINGP(sequence)) { + int ch; + char *string = THESTR(sequence); + + CHECK_STRING_WRITABLE(sequence); + CHECK_SCHAR(item); + ch = SCHAR_VALUE(item); + for (i = start; i < end; i++) + string[i] = ch; + } + else { + LispObj *list; -LispObj * -Lisp_Oddp(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *obj = CAR(list); + if (CONSP(sequence)) + list = sequence; + else + list = sequence->data.array.list; - if (!INTEGER_P(obj)) - LispDestroy(mac, "expecting integer, at %s", fname); + for (i = 0; i < start; i++, list = CDR(list)) + ; + for (; i < end; i++, list = CDR(list)) + RPLACA(list, item); + } - return ((int)NUMBER_VALUE(obj) % 2 ? T : NIL); + return (sequence); } LispObj * -Lisp_Or(LispMac *mac, LispObj *list, char *fname) +Lisp_Fmakunbound(LispBuiltin *builtin) +/* + fmkaunbound symbol + */ { - LispObj *res = NIL; + LispObj *symbol; - for (; list != NIL; list = CDR(list)) { - if ((res = EVAL(CAR(list))) != NIL) - break; - } - return (res); + symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + if (symbol->data.atom->a_function) + LispRemAtomFunctionProperty(symbol->data.atom); + else if (symbol->data.atom->a_builtin) + LispRemAtomBuiltinProperty(symbol->data.atom); + else if (symbol->data.atom->a_compiled) + LispRemAtomCompiledProperty(symbol->data.atom); + + return (symbol); } LispObj * -Lisp_Plusp(LispMac *mac, LispObj *list, char *fname) +Lisp_Funcall(LispBuiltin *builtin) +/* + funcall function &rest arguments + */ { - LispObj *obj = CAR(list); + LispObj *result; - if (!NUMBER_P(obj)) - LispDestroy(mac, "expecting number, at %s", fname); + LispObj *function, *arguments; - return (NUMBER_VALUE(obj) > 0.0 ? T : NIL); + arguments = ARGUMENT(1); + function = ARGUMENT(0); + + result = APPLY(function, arguments); + + return (result); } LispObj * -Lisp_Prin1(LispMac *mac, LispObj *list, char *fname) +Lisp_Functionp(LispBuiltin *builtin) +/* + functionp object + */ { - LispObj *obj = CAR(list), *stream; + LispObj *object; - list = CDR(list); - if (list == NIL || CAR(list) == NIL) - stream = NIL; - else - stream = CAR(list); - - LispPrint(mac, obj, stream, 0); + object = ARGUMENT(0); - return (obj); + return (FUNCTIONP(object) || LAMBDAP(object) ? T : NIL); } LispObj * -Lisp_Princ(LispMac *mac, LispObj *list, char *fname) +Lisp_Get(LispBuiltin *builtin) +/* + get symbol indicator &optional default + */ { - int princ = mac->princ; - LispObj *obj = CAR(list), *stream; + LispObj *result; - list = CDR(list); - if (list == NIL || CAR(list) == NIL) - stream = NIL; - else - stream = CAR(list); + LispObj *symbol, *indicator, *defalt; - mac->princ = 1; - LispPrint(mac, obj, stream, 0); - mac->princ = princ; + defalt = ARGUMENT(2); + indicator = ARGUMENT(1); + symbol = ARGUMENT(0); - return (obj); -} + CHECK_SYMBOL(symbol); -LispObj * -Lisp_Print(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *obj = CAR(list), *stream; + result = LispGetAtomProperty(symbol->data.atom, indicator); - list = CDR(list); - if (list == NIL || CAR(list) == NIL) - stream = NIL; + if (result != NIL) + result = CAR(result); else - stream = CAR(list); + result = defalt == UNSPEC ? NIL : defalt; - LispPrint(mac, obj, stream, 1); - - return (obj); + return (result); } +/* + * ext::getenv + */ LispObj * -Lisp_Prog1(LispMac *mac, LispObj *list, char *fname) +Lisp_Getenv(LispBuiltin *builtin) +/* + getenv name + */ { - LispObj *frm, *res = EVAL(CAR(list)); + char *value; - frm = FRM; - FRM = CONS(res, FRM); - for (list = CDR(list); list != NIL; list = CDR(list)) - (void)EVAL(CAR(list)); - FRM = frm; + LispObj *name; - return (res); + name = ARGUMENT(0); + + CHECK_STRING(name); + value = getenv(THESTR(name)); + + return (value ? STRING(value) : NIL); } LispObj * -Lisp_Prog2(LispMac *mac, LispObj *list, char *fname) +Lisp_Gc(LispBuiltin *builtin) +/* + gc &optional car cdr + */ { - LispObj *frm, *res; + LispObj *car, *cdr; - (void)EVAL(CAR(list)); - list = CDR(list); - res = EVAL(CAR(list)); - frm = FRM; - FRM = CONS(res, FRM); - for (list = CDR(list); list != NIL; list = CDR(list)) - (void)EVAL(CAR(list)); - FRM = frm; + cdr = ARGUMENT(1); + car = ARGUMENT(0); - return (res); + LispGC(car, cdr); + + return (NIL); } LispObj * -Lisp_Progn(LispMac *mac, LispObj *list, char *fname) +Lisp_Gensym(LispBuiltin *builtin) +/* + gensym &optional arg + */ { - LispObj *res = NIL; + char *preffix = "G", name[132]; + long counter = LONGINT_VALUE(Ogensym_counter->data.atom->property->value); + LispObj *symbol; + + LispObj *arg; + + arg = ARGUMENT(0); + if (arg != UNSPEC) { + if (STRINGP(arg)) + preffix = THESTR(arg); + else { + CHECK_INDEX(arg); + counter = FIXNUM_VALUE(arg); + } + } + snprintf(name, sizeof(name), "%s%ld", preffix, counter); + if (strlen(name) >= 128) + LispDestroy("%s: name %s too long", STRFUN(builtin), name); + Ogensym_counter->data.atom->property->value = INTEGER(counter + 1); - for (; list != NIL; list = CDR(list)) - res = EVAL(CAR(list)); + symbol = UNINTERNED_ATOM(name); + symbol->data.atom->unreadable = !LispCheckAtomString(name); - return (res); + return (symbol); } LispObj * -Lisp_Progv(LispMac *mac, LispObj *list, char *fname) +Lisp_Go(LispBuiltin *builtin) +/* + go tag + */ { - LispObj *old_frm, *old_env, *res, *cons = NIL, *valist = NIL; - LispObj *syms, *values, *body; + unsigned blevel = lisp__data.block.block_level; - old_frm = FRM; + LispObj *tag; - /* get symbol names */ - syms = EVAL(CAR(list)); - GCProtect(); - FRM = CONS(syms, FRM); - GCUProtect(); + tag = ARGUMENT(0); - /* get symbol values */ - list = CDR(list); - values = EVAL(CAR(list)); - GCProtect(); - FRM = CONS(values, FRM); - GCUProtect(); - list = CDR(list); - - /* the body to be executed */ - body = list; - - /* fill variable list */ - for (; syms->type == LispCons_t; syms = CDR(syms)) { - if (values->type != LispCons_t) - break; - if (!SYMBOL_P(CAR(syms))) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, CAR(syms)), fname); - if (valist == NIL) { - GCProtect(); - valist = cons = CONS(CONS(CAR(syms), CAR(values)), NIL); - FRM = CONS(valist, FRM); - GCUProtect(); - } - else { - CDR(cons) = CONS(CONS(CAR(syms), CAR(values)), NIL); - cons = CDR(cons); + while (blevel) { + LispBlock *block = lisp__data.block.block[--blevel]; + + if (block->type == LispBlockClosure) + /* if reached a function call */ + break; + if (block->type == LispBlockBody) { + lisp__data.block.block_ret = tag; + LispBlockUnwind(block); + BLOCKJUMP(block); } - values = CDR(values); - } + } - /* add variables */ - old_env = ENV; - for (; valist != NIL; valist = CDR(valist)) { - cons = CAR(valist); - LispAddVar(mac, CAR(cons), CDR(cons)); - } + LispDestroy("%s: no visible tagbody for %s", + STRFUN(builtin), STROBJ(tag)); + /*NOTREACHED*/ + return (NIL); +} - res = Lisp_Progn(mac, body, fname); +LispObj * +Lisp_If(LispBuiltin *builtin) +/* + if test then &optional else + */ +{ + LispObj *result, *test, *then, *oelse; - ENV = old_env; - FRM = old_frm; + oelse = ARGUMENT(2); + then = ARGUMENT(1); + test = ARGUMENT(0); + + test = EVAL(test); + if (test != NIL) + result = EVAL(then); + else if (oelse != UNSPEC) + result = EVAL(oelse); + else + result = NIL; - return (res); + return (result); } LispObj * -Lisp_Provide(LispMac *mac, LispObj *list, char *fname) +Lisp_IgnoreErrors(LispBuiltin *builtin) +/* + ignore-erros &rest body + */ { - LispObj *feat = CAR(list), *obj; - - if (!STRING_P(feat) && !SYMBOL_P(feat)) - LispDestroy(mac, "cannot provide %s", LispStrObj(mac, feat)); + LispObj *result, **presult, **pbody; + int i, jumped, *pjumped; + LispBlock *block; - for (obj = MOD; obj != NIL; obj = CDR(obj)) { - if (STRPTR(CAR(obj)) == STRPTR(feat)) - return (feat); - } + /* interpreter state */ + GC_ENTER(); + int stack, lex, length; + + /* memory allocation */ + int mem_level; + void **mem; + + LispObj *body; + + body = ARGUMENT(0); + + /* Save environment information */ + stack = lisp__data.stack.length; + lex = lisp__data.env.lex; + length = lisp__data.env.length; + + /* Save memory allocation information */ + mem_level = lisp__data.mem.level; + mem = LispMalloc(mem_level * sizeof(void*)); + memcpy(mem, lisp__data.mem.mem, mem_level * sizeof(void*)); + + ++lisp__data.ignore_errors; + presult = &result; + pjumped = &jumped; + pbody = &body; + result = NIL; + jumped = 1; + block = LispBeginBlock(NIL, LispBlockProtect); + if (setjmp(block->jmp) == 0) { + for (; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + jumped = 0; + } + LispEndBlock(block); + if (!lisp__data.destroyed && jumped) + result = lisp__data.block.block_ret; + + if (lisp__data.destroyed) { + /* Restore environment */ + lisp__data.stack.length = stack; + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = length; + GC_LEAVE(); + + /* Check for possible leaks due to ignoring errors */ + for (i = 0; i < mem_level; i++) { + if (lisp__data.mem.mem[i] && mem[i] != lisp__data.mem.mem[i]) + LispFree(lisp__data.mem.mem[i]); + } + for (; i < lisp__data.mem.level; i++) { + if (lisp__data.mem.mem[i]) + LispFree(lisp__data.mem.mem[i]); + } - if (MOD == NIL) - MOD = CONS(feat, NIL); - else { - CDR(MOD) = CONS(CAR(MOD), CDR(MOD)); - CAR(MOD) = feat; + lisp__data.destroyed = 0; + result = NIL; + RETURN_COUNT = 1; + RETURN(0) = lisp__data.error_condition; } + LispFree(mem); + --lisp__data.ignore_errors; - return (feat); + return (result); } LispObj * -Lisp_Quit(LispMac *mac, LispObj *list, char *fname) +Lisp_Intersection(LispBuiltin *builtin) +/* + intersection list1 list2 &key test test-not key + */ { - int status = 0; - - if (list != NIL) { - if (!INTEGER_P(CAR(list))) - LispDestroy(mac, "bad exit status argument %s, at %s", - LispStrObj(mac, CAR(list)), fname); - status = (int)NUMBER_VALUE(CAR(list)); - } - - exit(status); + return (LispListSet(builtin, INTERSECTION)); } LispObj * -Lisp_Quote(LispMac *mac, LispObj *list, char *fname) +Lisp_Nintersection(LispBuiltin *builtin) +/* + nintersection list1 list2 &key test test-not key + */ { - return (CAR(list)); + return (LispListSet(builtin, NINTERSECTION)); } -/* XXX needs to be extended to accept parameters */ LispObj * -Lisp_Read(LispMac *mac, LispObj *list, char *fname) +Lisp_Keywordp(LispBuiltin *builtin) +/* + keywordp object + */ { - LispObj *obj; + LispObj *object; - obj = LispRun(mac); - if (obj == EOLIST) - LispDestroy(mac, "object cannot start with #\\)"); + object = ARGUMENT(0); - return (obj); + return (KEYWORDP(object) ? T : NIL); } -/* Destructively replaces seq1 elements with seq2 elements - * (replace sequence1 sequence2 &key :start1 :end1 :start2 :end2) - */ LispObj * -Lisp_Replace(LispMac *mac, LispObj *list, char *fname) +Lisp_Lambda(LispBuiltin *builtin) +/* + lambda lambda-list &rest body + */ { - int len, len1, len2, start1, end1, start2, end2; - LispObj *seq1, *seq2, *ostart1, *oend1, *ostart2, *oend2; + GC_ENTER(); + LispObj *name; + LispArgList *alist; - seq1 = CAR(list); - len1 = Lisp_Length(mac, list, fname)->data.real; + LispObj *lambda, *lambda_list, *body; - list = CDR(list); - seq2 = CAR(list); - len2 = Lisp_Length(mac, list, fname)->data.real; + body = ARGUMENT(1); + lambda_list = ARGUMENT(0); - list = CDR(list); - LispGetKeys(mac, fname, "START1:END1:START2:END2", list, - &ostart1, &oend1, &ostart2, &oend2); - - if (ostart1 == NIL) - start1 = 0; - else if (INDEX_P(ostart1)) - goto replace_not_integer; - else - start1 = NUMBER_VALUE(ostart1); - if (oend1 == NIL) - end1 = len1; - else if (INDEX_P(oend1)) - goto replace_not_integer; - else - end1 = NUMBER_VALUE(oend1); + alist = LispCheckArguments(LispLambda, lambda_list, Snil, 0); - if (ostart2 == NIL) - start2 = 0; - else if (INDEX_P(ostart2)) - goto replace_not_integer; - else - start2 = NUMBER_VALUE(ostart2); - if (oend2 == NIL) - end2 = len2; - else if (INDEX_P(oend2)) - goto replace_not_integer; - else - end2 = NUMBER_VALUE(oend2); + name = OPAQUE(alist, LispArgList_t); + lambda_list = LispListProtectedArguments(alist); + GC_PROTECT(name); + GC_PROTECT(lambda_list); + lambda = LispNewLambda(name, body, lambda_list, LispLambda); + LispUseArgList(alist); + GC_LEAVE(); - if (start1 == end1 || start2 == end2) - goto replace_done; + return (lambda); +} - if (start1 > end1 || end1 > len1 || start2 > end2 || end2 > len2) - goto replace_out_of_range; +LispObj * +Lisp_Last(LispBuiltin *builtin) +/* + last list &optional count + */ +{ + long count, length; + LispObj *list, *ocount; - len = end1 - start1; - if (len > end2 - start2) - len = end2 - start2; + ocount = ARGUMENT(1); + list = ARGUMENT(0); - if (STRING_P(seq1)) { - char *string; + if (!CONSP(list)) + return (list); - if (!STRING_P(seq2)) - goto replace_type_mismatch; + length = LispLength(list); - string = LispStrdup(mac, STRPTR(seq1)); - strncpy(string + start1, STRPTR(seq2) + start2, len); - seq1->data.atom = LispDoGetAtom(mac, string, 0, 0); - LispFree(mac, string); - } + if (ocount == UNSPEC) + count = 1; else { - int i; - LispObj *from, *to; + CHECK_INDEX(ocount); + count = FIXNUM_VALUE(ocount); + } - if (seq1->type == LispArray_t) - seq1 = seq1->data.array.list; - if (seq2->type == LispArray_t) - seq2 = seq2->data.array.list; + if (count >= length) + return (list); - /* adjust pointers */ - for (i = 0, from = seq2; i < start2; i++, from = CDR(from)) - ; - for (i = 0, to = seq1; i < start1; i++, to = CDR(to)) + length -= count; + for (; length > 0; length--) + list = CDR(list); + + return (list); +} + +LispObj * +Lisp_Length(LispBuiltin *builtin) +/* + length sequence + */ +{ + LispObj *sequence; + + sequence = ARGUMENT(0); + + return (FIXNUM(LispLength(sequence))); +} + +LispObj * +Lisp_Let(LispBuiltin *builtin) +/* + let init &rest body + */ +{ + GC_ENTER(); + int head = lisp__data.env.length; + LispObj *init, *body, *pair, *result, *list, *cons = NIL; + + body = ARGUMENT(1); + init = ARGUMENT(0); + + CHECK_LIST(init); + for (list = NIL; CONSP(init); init = CDR(init)) { + LispObj *symbol, *value; + + pair = CAR(init); + if (SYMBOLP(pair)) { + symbol = pair; + value = NIL; + } + else { + CHECK_CONS(pair); + symbol = CAR(pair); + CHECK_SYMBOL(symbol); + pair = CDR(pair); + if (CONSP(pair)) { + value = CAR(pair); + if (CDR(pair) != NIL) + LispDestroy("%s: too much arguments to initialize %s", + STRFUN(builtin), STROBJ(symbol)); + value = EVAL(value); + } + else + value = NIL; + } + pair = CONS(symbol, value); + if (list == NIL) { + list = cons = CONS(pair, NIL); + GC_PROTECT(list); + } + else { + RPLACD(cons, CONS(pair, NIL)); + cons = CDR(cons); + } + } + /* Add variables */ + for (; CONSP(list); list = CDR(list)) { + pair = CAR(list); + CHECK_CONSTANT(CAR(pair)); + LispAddVar(CAR(pair), CDR(pair)); + ++lisp__data.env.head; + } + /* Values of symbols are now protected */ + GC_LEAVE(); + + /* execute body */ + for (result = NIL; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + + lisp__data.env.head = lisp__data.env.length = head; + + return (result); +} + +LispObj * +Lisp_LetP(LispBuiltin *builtin) +/* + let* init &rest body + */ +{ + int head = lisp__data.env.length; + LispObj *init, *body, *pair, *result; + + body = ARGUMENT(1); + init = ARGUMENT(0); + + CHECK_LIST(init); + for (; CONSP(init); init = CDR(init)) { + LispObj *symbol, *value; + + pair = CAR(init); + if (SYMBOLP(pair)) { + symbol = pair; + value = NIL; + } + else { + CHECK_CONS(pair); + symbol = CAR(pair); + CHECK_SYMBOL(symbol); + pair = CDR(pair); + if (CONSP(pair)) { + value = CAR(pair); + if (CDR(pair) != NIL) + LispDestroy("%s: too much arguments to initialize %s", + STRFUN(builtin), STROBJ(symbol)); + value = EVAL(value); + } + else + value = NIL; + } + + CHECK_CONSTANT(symbol); + LispAddVar(symbol, value); + ++lisp__data.env.head; + } + + /* execute body */ + for (result = NIL; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + + lisp__data.env.head = lisp__data.env.length = head; + + return (result); +} + +LispObj * +Lisp_List(LispBuiltin *builtin) +/* + list &rest args + */ +{ + LispObj *args; + + args = ARGUMENT(0); + + return (args); +} + +LispObj * +Lisp_ListP(LispBuiltin *builtin) +/* + list* object &rest more-objects + */ +{ + GC_ENTER(); + LispObj *result, *cons; + + LispObj *object, *more_objects; + + more_objects = ARGUMENT(1); + object = ARGUMENT(0); + + if (!CONSP(more_objects)) + return (object); + + result = cons = CONS(object, CAR(more_objects)); + GC_PROTECT(result); + for (more_objects = CDR(more_objects); CONSP(more_objects); + more_objects = CDR(more_objects)) { + object = CAR(more_objects); + RPLACD(cons, CONS(CDR(cons), object)); + cons = CDR(cons); + } + GC_LEAVE(); + + return (result); +} + +/* "classic" list-length */ +LispObj * +Lisp_ListLength(LispBuiltin *builtin) +/* + list-length list + */ +{ + long length; + LispObj *fast, *slow; + + LispObj *list; + + list = ARGUMENT(0); + + CHECK_LIST(list); + for (fast = slow = list, length = 0; + CONSP(slow); + slow = CDR(slow), length += 2) { + if (fast == NIL) + break; + CHECK_CONS(fast); + fast = CDR(fast); + if (fast == NIL) { + ++length; + break; + } + CHECK_CONS(fast); + fast = CDR(fast); + if (slow == fast) + /* circular list */ + return (NIL); + } + + return (FIXNUM(length)); +} + +LispObj * +Lisp_Listp(LispBuiltin *builtin) +/* + listp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (object == NIL || CONSP(object) ? T : NIL); +} + +static LispObj * +LispListSet(LispBuiltin *builtin, int function) +/* + intersection list1 list2 &key test test-not key + nintersection list1 list2 &key test test-not key + set-difference list1 list2 &key test test-not key + nset-difference list1 list2 &key test test-not key + set-exclusive-or list1 list2 &key test test-not key + nset-exclusive-or list1 list2 &key test test-not key + subsetp list1 list2 &key test test-not key + union list1 list2 &key test test-not key + nunion list1 list2 &key test test-not key + */ +{ + GC_ENTER(); + int code, expect, value, inplace, check_list2, + intersection, setdifference, xunion, setexclusiveor; + LispObj *lambda, *result, *cmp, *cmp1, *cmp2, + *item, *clist1, *clist2, *cons, *cdr; + + LispObj *list1, *list2, *test, *test_not, *key; + + key = ARGUMENT(4); + test_not = ARGUMENT(3); + test = ARGUMENT(2); + list2 = ARGUMENT(1); + list1 = ARGUMENT(0); + + /* Check if arguments are valid lists */ + CHECK_LIST(list1); + CHECK_LIST(list2); + + setdifference = intersection = xunion = setexclusiveor = inplace = 0; + switch (function) { + case NSETDIFFERENCE: + inplace = 1; + case SETDIFFERENCE: + setdifference = 1; + break; + case NINTERSECTION: + inplace = 1; + case INTERSECTION: + intersection = 1; + break; + case NUNION: + inplace = 1; + case UNION: + xunion = 1; + break; + case NSETEXCLUSIVEOR: + inplace = 1; + case SETEXCLUSIVEOR: + setexclusiveor = 1; + break; + } + + /* Check for fast return */ + if (list1 == NIL) + return (setdifference || intersection ? + NIL : function == SUBSETP ? T : list2); + if (list2 == NIL) + return (intersection || xunion || function == SUBSETP ? NIL : list1); + + CHECK_TEST(); + clist1 = cdr = NIL; + + /* Make a copy of list2 with the key predicate applied */ + if (key != UNSPEC) { + result = cons = CONS(APPLY1(key, CAR(list2)), NIL); + GC_PROTECT(result); + for (cmp2 = CDR(list2); CONSP(cmp2); cmp2 = CDR(cmp2)) { + item = APPLY1(key, CAR(cmp2)); + RPLACD(cons, CONS(APPLY1(key, CAR(cmp2)), NIL)); + cons = CDR(cons); + } + /* check if list2 is a proper list */ + CHECK_LIST(cmp2); + clist2 = result; + check_list2 = 0; + } + else { + clist2 = list2; + check_list2 = 1; + } + result = cons = NIL; + + /* Compare elements of lists + * Logic: + * UNION + * 1) Walk list1 and if CAR(list1) not in list2, add it to result + * 2) Add list2 to result + * INTERSECTION + * 1) Walk list1 and if CAR(list1) in list2, add it to result + * SET-DIFFERENCE + * 1) Walk list1 and if CAR(list1) not in list2, add it to result + * SET-EXCLUSIVE-OR + * 1) Walk list1 and if CAR(list1) not in list2, add it to result + * 2) Walk list2 and if CAR(list2) not in list1, add it to result + * SUBSETP + * 1) Walk list1 and if CAR(list1) not in list2, return NIL + * 2) Return T + */ + value = 0; + for (cmp1 = list1; CONSP(cmp1); cmp1 = CDR(cmp1)) { + item = CAR(cmp1); + + /* Apply key predicate if required */ + if (key != UNSPEC) { + cmp = APPLY1(key, item); + if (setexclusiveor) { + if (clist1 == NIL) { + clist1 = cdr = CONS(cmp, NIL); + GC_PROTECT(clist1); + } + else { + RPLACD(cdr, CONS(cmp, NIL)); + cdr = CDR(cdr); + } + } + } + else + cmp = item; + + /* Compare against list2 */ + for (cmp2 = clist2; CONSP(cmp2); cmp2 = CDR(cmp2)) { + value = FCOMPARE(lambda, cmp, CAR(cmp2), code); + if (value == expect) + break; + } + if (check_list2 && value != expect) { + /* check if list2 is a proper list */ + CHECK_LIST(cmp2); + check_list2 = 0; + } + + if (function == SUBSETP) { + /* Element of list1 not in list2? */ + if (value != expect) { + GC_LEAVE(); + + return (NIL); + } + } + /* If need to add item to result */ + else if (((setdifference || xunion || setexclusiveor) && + value != expect) || + (intersection && value == expect)) { + if (inplace) { + if (result == NIL) + result = cons = cmp1; + else { + if (setexclusiveor) { + /* don't remove elements yet, will need + * to check agains't list2 later */ + for (cmp2 = cons; CDR(cmp2) != cmp1; cmp2 = CDR(cmp2)) + ; + if (cmp2 != cons) { + RPLACD(cmp2, list1); + list1 = cmp2; + } + } + RPLACD(cons, cmp1); + cons = cmp1; + } + } + else { + if (result == NIL) { + result = cons = CONS(item, NIL); + GC_PROTECT(result); + } + else { + RPLACD(cons, CONS(item, NIL)); + cons = CDR(cons); + } + } + } + } + /* check if list1 is a proper list */ + CHECK_LIST(cmp1); + + if (function == SUBSETP) { + GC_LEAVE(); + + return (T); + } + else if (xunion) { + /* Add list2 to tail of result */ + if (result == NIL) + result = list2; + else + RPLACD(cons, list2); + } + else if (setexclusiveor) { + LispObj *result2, *cons2; + + result2 = cons2 = NIL; + for (cmp2 = list2; CONSP(cmp2); cmp2 = CDR(cmp2)) { + item = CAR(cmp2); + + if (key != UNSPEC) { + cmp = CAR(clist2); + /* XXX changing clist2 */ + clist2 = CDR(clist2); + cmp1 = clist1; + } + else { + cmp = item; + cmp1 = list1; + } + + /* Compare against list1 */ + for (; CONSP(cmp1); cmp1 = CDR(cmp1)) { + value = FCOMPARE(lambda, cmp, CAR(cmp1), code); + if (value == expect) + break; + } + + if (value != expect) { + if (inplace) { + if (result2 == NIL) + result2 = cons2 = cmp2; + else { + RPLACD(cons2, cmp2); + cons2 = cmp2; + } + } + else { + if (result == NIL) { + result = cons = CONS(item, NIL); + GC_PROTECT(result); + } + else { + RPLACD(cons, CONS(item, NIL)); + cons = CDR(cons); + } + } + } + } + if (inplace) { + if (CONSP(cons2)) + RPLACD(cons2, NIL); + if (result == NIL) + result = result2; + else + RPLACD(cons, result2); + } + } + else if ((function == NSETDIFFERENCE || function == NINTERSECTION) && + CONSP(cons)) + RPLACD(cons, NIL); + + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Loop(LispBuiltin *builtin) +/* + loop &rest body + */ +{ + LispObj *code, *result; + LispBlock *block; + + LispObj *body; + + body = ARGUMENT(0); + + result = NIL; + block = LispBeginBlock(NIL, LispBlockTag); + if (setjmp(block->jmp) == 0) { + for (;;) + for (code = body; CONSP(code); code = CDR(code)) + (void)EVAL(CAR(code)); + } + LispEndBlock(block); + result = lisp__data.block.block_ret; + + return (result); +} + +/* XXX This function is broken, needs a review + (being delayed until true array/vectors be implemented) */ +LispObj * +Lisp_MakeArray(LispBuiltin *builtin) +/* + make-array dimensions &key element-type initial-element initial-contents + adjustable fill-pointer displaced-to + displaced-index-offset + */ +{ + long rank = 0, count = 1, offset, zero, c; + LispObj *obj, *dim, *array; + LispType type; + + LispObj *dimensions, *element_type, *initial_element, *initial_contents, + *adjustable, *fill_pointer, *displaced_to, + *displaced_index_offset; + + dim = array = NIL; + type = LispNil_t; + + displaced_index_offset = ARGUMENT(7); + displaced_to = ARGUMENT(6); + fill_pointer = ARGUMENT(5); + adjustable = ARGUMENT(4); + initial_contents = ARGUMENT(3); + initial_element = ARGUMENT(2); + element_type = ARGUMENT(1); + dimensions = ARGUMENT(0); + + if (INDEXP(dimensions)) { + dim = CONS(dimensions, NIL); + rank = 1; + count = FIXNUM_VALUE(dimensions); + } + else if (CONSP(dimensions)) { + dim = dimensions; + + for (rank = 0; CONSP(dim); rank++, dim = CDR(dim)) { + obj = CAR(dim); + CHECK_INDEX(obj); + count *= FIXNUM_VALUE(obj); + } + dim = dimensions; + } + else if (dimensions == NIL) { + dim = NIL; + rank = count = 0; + } + else + LispDestroy("%s: %s is a bad array dimension", + STRFUN(builtin), STROBJ(dimensions)); + + /* check element-type */ + if (element_type != UNSPEC) { + if (element_type == T) + type = LispNil_t; + else if (!SYMBOLP(element_type)) + LispDestroy("%s: unsupported element type %s", + STRFUN(builtin), STROBJ(element_type)); + else { + Atom_id atom = ATOMID(element_type); + + if (atom == Satom) + type = LispAtom_t; + else if (atom == Sinteger) + type = LispInteger_t; + else if (atom == Scharacter) + type = LispSChar_t; + else if (atom == Sstring) + type = LispString_t; + else if (atom == Slist) + type = LispCons_t; + else if (atom == Sopaque) + type = LispOpaque_t; + else + LispDestroy("%s: unsupported element type %s", + STRFUN(builtin), ATOMID(element_type)); + } + } + + /* check initial-contents */ + if (rank) { + CHECK_LIST(initial_contents); + } + + /* check displaced-to */ + if (displaced_to != UNSPEC) { + CHECK_ARRAY(displaced_to); + } + + /* check displaced-index-offset */ + offset = -1; + if (displaced_index_offset != UNSPEC) { + CHECK_INDEX(displaced_index_offset); + offset = FIXNUM_VALUE(displaced_index_offset); + } + + c = 0; + if (initial_element != UNSPEC) + ++c; + if (initial_contents != UNSPEC) + ++c; + if (displaced_to != UNSPEC || offset >= 0) + ++c; + if (c > 1) + LispDestroy("%s: more than one initialization specified", + STRFUN(builtin)); + if (initial_element == UNSPEC) + initial_element = NIL; + + zero = count == 0; + if (displaced_to != UNSPEC) { + CHECK_ARRAY(displaced_to); + if (offset < 0) + offset = 0; + for (c = 1, obj = displaced_to->data.array.dim; obj != NIL; + obj = CDR(obj)) + c *= FIXNUM_VALUE(CAR(obj)); + if (c < count + offset) + LispDestroy("%s: array-total-size + displaced-index-offset " + "exceeds total size", STRFUN(builtin)); + for (c = 0, array = displaced_to->data.array.list; c < offset; c++) + array = CDR(array); + } + else if (initial_contents != UNSPEC) { + CHECK_CONS(initial_contents); + if (rank == 0) + array = initial_contents; + else if (rank == 1) { + for (array = initial_contents, c = 0; c < count; + array = CDR(array), c++) + if (!CONSP(array)) + LispDestroy("%s: bad argument or size %s", + STRFUN(builtin), STROBJ(array)); + if (array != NIL) + LispDestroy("%s: bad argument or size %s", + STRFUN(builtin), STROBJ(array)); + array = initial_contents; + } + else { + LispObj *err = NIL; + /* check if list matches */ + int i, j, k, *dims, *loop; + + /* create iteration variables */ + dims = LispMalloc(sizeof(int) * rank); + loop = LispCalloc(1, sizeof(int) * (rank - 1)); + for (i = 0, obj = dim; CONSP(obj); i++, obj = CDR(obj)) + dims[i] = FIXNUM_VALUE(CAR(obj)); + + /* check if list matches specified dimensions */ + while (loop[0] < dims[0]) { + for (obj = initial_contents, i = 0; i < rank - 1; i++) { + for (j = 0; j < loop[i]; j++) + obj = CDR(obj); + err = obj; + if (!CONSP(obj = CAR(obj))) + goto make_array_error; + err = obj; + } + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { + if (!CONSP(obj)) + goto make_array_error; + } + if (obj == NIL) + continue; +make_array_error: + LispFree(dims); + LispFree(loop); + LispDestroy("%s: bad argument or size %s", + STRFUN(builtin), STROBJ(err)); + } + + /* list is correct, use it to fill initial values */ + + /* reset loop */ + memset(loop, 0, sizeof(int) * (rank - 1)); + + GCDisable(); + /* fill array with supplied values */ + array = NIL; + while (loop[0] < dims[0]) { + for (obj = initial_contents, i = 0; i < rank - 1; i++) { + for (j = 0; j < loop[i]; j++) + obj = CDR(obj); + obj = CAR(obj); + } + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { + if (array == NIL) + array = CONS(CAR(obj), NIL); + else { + RPLACD(array, CONS(CAR(array), CDR(array))); + RPLACA(array, CAR(obj)); + } + } + } + LispFree(dims); + LispFree(loop); + array = LispReverse(array); + GCEnable(); + } + } + else { + GCDisable(); + /* allocate array */ + if (count) { + --count; + array = CONS(initial_element, NIL); + while (count) { + RPLACD(array, CONS(CAR(array), CDR(array))); + RPLACA(array, initial_element); + count--; + } + } + GCEnable(); + } + + obj = LispNew(array, dim); + obj->type = LispArray_t; + obj->data.array.list = array; + obj->data.array.dim = dim; + obj->data.array.rank = rank; + obj->data.array.type = type; + obj->data.array.zero = zero; + + return (obj); +} + +LispObj * +Lisp_MakeList(LispBuiltin *builtin) +/* + make-list size &key initial-element + */ +{ + GC_ENTER(); + long count; + LispObj *result, *cons; + + LispObj *size, *initial_element; + + initial_element = ARGUMENT(1); + size = ARGUMENT(0); + + CHECK_INDEX(size); + count = FIXNUM_VALUE(size); + + if (count == 0) + return (NIL); + if (initial_element == UNSPEC) + initial_element = NIL; + + result = cons = CONS(initial_element, NIL); + GC_PROTECT(result); + for (; count > 1; count--) { + RPLACD(cons, CONS(initial_element, NIL)); + cons = CDR(cons); + } + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_MakeSymbol(LispBuiltin *builtin) +/* + make-symbol name + */ +{ + LispObj *name, *symbol; + + name = ARGUMENT(0); + CHECK_STRING(name); + + symbol = UNINTERNED_ATOM(THESTR(name)); + symbol->data.atom->unreadable = !LispCheckAtomString(THESTR(name)); + + return (symbol); +} + +LispObj * +Lisp_Makunbound(LispBuiltin *builtin) +/* + makunbound symbol + */ +{ + LispObj *symbol; + + symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + LispUnsetVar(symbol); + + return (symbol); +} + +LispObj * +Lisp_Mapc(LispBuiltin *builtin) +/* + mapc function list &rest more-lists + */ +{ + return (LispMapc(builtin, 0)); +} + +LispObj * +Lisp_Mapcar(LispBuiltin *builtin) +/* + mapcar function list &rest more-lists + */ +{ + return (LispMapc(builtin, 1)); +} + +/* Like nconc but ignore non list arguments */ +LispObj * +LispMapnconc(LispObj *list) +{ + LispObj *result = NIL; + + if (CONSP(list)) { + LispObj *cons, *head, *tail; + + cons = NIL; + for (; CONSP(CDR(list)); list = CDR(list)) { + head = CAR(list); + if (CONSP(head)) { + for (tail = head; CONSP(CDR(tail)); tail = CDR(tail)) + ; + if (cons != NIL) + RPLACD(cons, head); + else + result = head; + cons = tail; + } + } + head = CAR(list); + if (CONSP(head)) { + if (cons != NIL) + RPLACD(cons, head); + else + result = head; + } + } + + return (result); +} + +LispObj * +Lisp_Mapcan(LispBuiltin *builtin) +/* + mapcan function list &rest more-lists + */ +{ + return (LispMapnconc(LispMapc(builtin, 1))); +} + +static LispObj * +LispMapc(LispBuiltin *builtin, int mapcar) +{ + GC_ENTER(); + long i, offset, count, length; + LispObj *result = NIL, *cons, *arguments, *acons, *rest, *alist, *value; + LispObj *stk[8], **cdrs; + + LispObj *function, *list, *more_lists; + + more_lists = ARGUMENT(2); + list = ARGUMENT(1); + function = ARGUMENT(0); + + /* Result will be no longer than this */ + for (length = 0, alist = list; CONSP(alist); length++, alist = CDR(alist)) + ; + + /* If first argument is not a list... */ + if (length == 0) + return (NIL); + + /* At least one argument will be passed to function, count how many + * extra arguments will be used, and calculate result length. */ + count = 0; + for (rest = more_lists; CONSP(rest); rest = CDR(rest), count++) { + + /* Check if extra list is really a list, and if it is smaller + * than the first list */ + for (i = 0, alist = CAR(rest); + i < length && CONSP(alist); + i++, alist = CDR(alist)) + ; + + /* If it is not a true list */ + if (i == 0) + return (NIL); + + /* If it is smaller than the currently calculated result length */ + if (i < length) + length = i; + } + + if (mapcar) { + /* Initialize gc protected object cells for resulting list */ + result = cons = CONS(NIL, NIL); + GC_PROTECT(result); + } + else + result = cons = list; + + if (count >= sizeof(stk) / sizeof(stk[0])) + cdrs = LispMalloc(count * sizeof(LispObj*)); + else + cdrs = &stk[0]; + for (i = 0, rest = more_lists; i < count; i++, rest = CDR(rest)) + cdrs[i] = CAR(rest); + + /* Initialize gc protected object cells for argument list */ + arguments = acons = CONS(NIL, NIL); + GC_PROTECT(arguments); + + /* Allocate space for extra arguments */ + for (i = 0; i < count; i++) { + RPLACD(acons, CONS(NIL, NIL)); + acons = CDR(acons); + } + + /* For every element of the list that will be used */ + for (offset = 0;; list = CDR(list)) { + acons = arguments; + + /* Add first argument */ + RPLACA(acons, CAR(list)); + acons = CDR(acons); + + /* For every extra list argument */ + for (i = 0; i < count; i++) { + alist = cdrs[i]; + cdrs[i] = CDR(cdrs[i]); + + /* Add element to argument list */ + RPLACA(acons, CAR(alist)); + acons = CDR(acons); + } + + value = APPLY(function, arguments); + + if (mapcar) { + /* Store result */ + RPLACA(cons, value); + + /* Allocate new result cell */ + if (++offset < length) { + RPLACD(cons, CONS(NIL, NIL)); + cons = CDR(cons); + } + else + break; + } + else if (++offset >= length) + break; + } + + /* Unprotect argument and result list */ + GC_LEAVE(); + if (cdrs != &stk[0]) + LispFree(cdrs); + + return (result); +} + +static LispObj * +LispMapl(LispBuiltin *builtin, int maplist) +{ + GC_ENTER(); + long i, offset, count, length; + LispObj *result = NIL, *cons, *arguments, *acons, *rest, *alist, *value; + LispObj *stk[8], **cdrs; + + LispObj *function, *list, *more_lists; + + more_lists = ARGUMENT(2); + list = ARGUMENT(1); + function = ARGUMENT(0); + + /* count is the number of lists, length is the length of the result */ + for (length = 0, alist = list; CONSP(alist); length++, alist = CDR(alist)) + ; + + /* first argument is not a list */ + if (length == 0) + return (NIL); + + /* check remaining arguments */ + for (count = 0, rest = more_lists; CONSP(rest); rest = CDR(rest), count++) { + for (i = 0, alist = CAR(rest); + i < length && CONSP(alist); + i++, alist = CDR(alist)) + ; + /* argument is not a list */ + if (i == 0) + return (NIL); + /* result will have the length of the smallest list */ + if (i < length) + length = i; + } + + /* result will be a list */ + if (maplist) { + result = cons = CONS(NIL, NIL); + GC_PROTECT(result); + } + else + result = cons = list; + + if (count >= sizeof(stk) / sizeof(stk[0])) + cdrs = LispMalloc(count * sizeof(LispObj*)); + else + cdrs = &stk[0]; + for (i = 0, rest = more_lists; i < count; i++, rest = CDR(rest)) + cdrs[i] = CAR(rest); + + /* initialize argument list */ + arguments = acons = CONS(NIL, NIL); + GC_PROTECT(arguments); + for (i = 0; i < count; i++) { + RPLACD(acons, CONS(NIL, NIL)); + acons = CDR(acons); + } + + /* for every used list element */ + for (offset = 0;; list = CDR(list)) { + acons = arguments; + + /* first argument */ + RPLACA(acons, list); + acons = CDR(acons); + + /* for every extra list */ + for (i = 0; i < count; i++) { + RPLACA(acons, cdrs[i]); + cdrs[i] = CDR(cdrs[i]); + acons = CDR(acons); + } + + value = APPLY(function, arguments); + + if (maplist) { + /* store result */ + RPLACA(cons, value); + + /* allocate new cell */ + if (++offset < length) { + RPLACD(cons, CONS(NIL, NIL)); + cons = CDR(cons); + } + else + break; + } + else if (++offset >= length) + break; + } + + GC_LEAVE(); + if (cdrs != &stk[0]) + LispFree(cdrs); + + return (result); +} + +LispObj * +Lisp_Mapl(LispBuiltin *builtin) +/* + mapl function list &rest more-lists + */ +{ + return (LispMapl(builtin, 0)); +} + +LispObj * +Lisp_Maplist(LispBuiltin *builtin) +/* + maplist function list &rest more-lists + */ +{ + return (LispMapl(builtin, 1)); +} + +LispObj * +Lisp_Mapcon(LispBuiltin *builtin) +/* + mapcon function list &rest more-lists + */ +{ + return (LispMapnconc(LispMapl(builtin, 1))); +} + +LispObj * +Lisp_Member(LispBuiltin *builtin) +/* + member item list &key test test-not key + */ +{ + int code, expect; + LispObj *compare, *lambda; + LispObj *item, *list, *test, *test_not, *key; + + key = ARGUMENT(4); + test_not = ARGUMENT(3); + test = ARGUMENT(2); + list = ARGUMENT(1); + item = ARGUMENT(0); + + if (list == NIL) + return (NIL); + CHECK_CONS(list); + + CHECK_TEST(); + if (key == UNSPEC) { + if (code == FEQ) { + for (; CONSP(list); list = CDR(list)) + if (item == CAR(list)) + return (list); + } + else { + for (; CONSP(list); list = CDR(list)) + if (FCOMPARE(lambda, item, CAR(list), code) == expect) + return (list); + } + } + else { + if (code == FEQ) { + for (; CONSP(list); list = CDR(list)) + if (item == APPLY1(key, CAR(list))) + return (list); + } + else { + for (; CONSP(list); list = CDR(list)) { + compare = APPLY1(key, CAR(list)); + if (FCOMPARE(lambda, item, compare, code) == expect) + return (list); + } + } + } + /* check if is a proper list */ + CHECK_LIST(list); + + return (NIL); +} + +LispObj * +Lisp_MemberIf(LispBuiltin *builtin) +/* + member-if predicate list &key key + */ +{ + return (LispAssocOrMember(builtin, MEMBER, IF)); +} + +LispObj * +Lisp_MemberIfNot(LispBuiltin *builtin) +/* + member-if-not predicate list &key key + */ +{ + return (LispAssocOrMember(builtin, MEMBER, IFNOT)); +} + +LispObj * +Lisp_MultipleValueBind(LispBuiltin *builtin) +/* + multiple-value-bind symbols values &rest body + */ +{ + int i, head = lisp__data.env.length; + LispObj *result, *symbol, *value; + + LispObj *symbols, *values, *body; + + body = ARGUMENT(2); + values = ARGUMENT(1); + symbols = ARGUMENT(0); + + result = EVAL(values); + for (i = -1; CONSP(symbols); symbols = CDR(symbols), i++) { + symbol = CAR(symbols); + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + if (i >= 0 && i < RETURN_COUNT) + value = RETURN(i); + else if (i < 0) + value = result; + else + value = NIL; + LispAddVar(symbol, value); + ++lisp__data.env.head; + } + + /* Execute code with binded variables (if any) */ + for (result = NIL; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + + lisp__data.env.head = lisp__data.env.length = head; + + return (result); +} + +LispObj * +Lisp_MultipleValueCall(LispBuiltin *builtin) +/* + multiple-value-call function &rest form + */ +{ + GC_ENTER(); + int i; + LispObj *arguments, *cons, *result; + + LispObj *function, *form; + + form = ARGUMENT(1); + function = ARGUMENT(0); + + /* build argument list */ + arguments = cons = NIL; + for (; CONSP(form); form = CDR(form)) { + RETURN_COUNT = 0; + result = EVAL(CAR(form)); + if (RETURN_COUNT >= 0) { + if (arguments == NIL) { + arguments = cons = CONS(result, NIL); + GC_PROTECT(arguments); + } + else { + RPLACD(cons, CONS(result, NIL)); + cons = CDR(cons); + } + for (i = 0; i < RETURN_COUNT; i++) { + RPLACD(cons, CONS(RETURN(i), NIL)); + cons = CDR(cons); + } + } + } + + /* apply function */ + if (POINTERP(function) && !XSYMBOLP(function) && !XFUNCTIONP(function)) { + function = EVAL(function); + GC_PROTECT(function); + } + result = APPLY(function, arguments); + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_MultipleValueProg1(LispBuiltin *builtin) +/* + multiple-value-prog1 first-form &rest form + */ +{ + GC_ENTER(); + int i, count; + LispObj *values, *cons; + + LispObj *first_form, *form; + + form = ARGUMENT(1); + first_form = ARGUMENT(0); + + values = EVAL(first_form); + if (!CONSP(form)) + return (values); + + cons = NIL; + count = RETURN_COUNT; + if (count < 0) + values = NIL; + else if (count == 0) { + GC_PROTECT(values); + } + else { + values = cons = CONS(values, NIL); + GC_PROTECT(values); + for (i = 0; i < count; i++) { + RPLACD(cons, CONS(RETURN(i), NIL)); + cons = CDR(cons); + } + } + + for (; CONSP(form); form = CDR(form)) + EVAL(CAR(form)); + + RETURN_COUNT = count; + if (count > 0) { + for (i = 0, cons = CDR(values); CONSP(cons); cons = CDR(cons), i++) + RETURN(i) = CAR(cons); + values = CAR(values); + } + GC_LEAVE(); + + return (values); +} + +LispObj * +Lisp_MultipleValueList(LispBuiltin *builtin) +/* + multiple-value-list form + */ +{ + int i; + GC_ENTER(); + LispObj *form, *result, *cons; + + form = ARGUMENT(0); + + result = EVAL(form); + + if (RETURN_COUNT < 0) + return (NIL); + + result = cons = CONS(result, NIL); + GC_PROTECT(result); + for (i = 0; i < RETURN_COUNT; i++) { + RPLACD(cons, CONS(RETURN(i), NIL)); + cons = CDR(cons); + } + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_MultipleValueSetq(LispBuiltin *builtin) +/* + multiple-value-setq symbols form + */ +{ + int i; + LispObj *result, *symbol, *value; + + LispObj *symbols, *form; + + form = ARGUMENT(1); + symbols = ARGUMENT(0); + + CHECK_LIST(symbols); + result = EVAL(form); + if (CONSP(symbols)) { + symbol = CAR(symbols); + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + LispSetVar(symbol, result); + symbols = CDR(symbols); + } + for (i = 0; CONSP(symbols); symbols = CDR(symbols), i++) { + symbol = CAR(symbols); + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + if (i < RETURN_COUNT && RETURN_COUNT > 0) + value = RETURN(i); + else + value = NIL; + LispSetVar(symbol, value); + } + + return (result); +} + +LispObj * +Lisp_Nconc(LispBuiltin *builtin) +/* + nconc &rest lists + */ +{ + LispObj *list, *lists, *cons, *head, *tail; + + lists = ARGUMENT(0); + + /* skip any initial empty lists */ + for (; CONSP(lists); lists = CDR(lists)) + if (CAR(lists) != NIL) + break; + + /* don't check if a proper list */ + if (!CONSP(lists)) + return (lists); + + /* setup to concatenate lists */ + list = CAR(lists); + CHECK_CONS(list); + for (cons = list; CONSP(CDR(cons)); cons = CDR(cons)) + ; + + /* if only two lists */ + lists = CDR(lists); + if (!CONSP(lists)) { + RPLACD(cons, lists); + + return (list); + } + + /* concatenate */ + for (; CONSP(CDR(lists)); lists = CDR(lists)) { + head = CAR(lists); + if (head == NIL) + continue; + CHECK_CONS(head); + for (tail = head; CONSP(CDR(tail)); tail = CDR(tail)) + ; + RPLACD(cons, head); + cons = tail; + } + /* add last list */ + RPLACD(cons, CAR(lists)); + + return (list); +} + +LispObj * +Lisp_Nreverse(LispBuiltin *builtin) +/* + nreverse sequence + */ +{ + return (LispXReverse(builtin, 1)); +} + +LispObj * +Lisp_NsetDifference(LispBuiltin *builtin) +/* + nset-difference list1 list2 &key test test-not key + */ +{ + return (LispListSet(builtin, NSETDIFFERENCE)); +} + +LispObj * +Lisp_Nsubstitute(LispBuiltin *builtin) +/* + nsubstitute newitem olditem sequence &key from-end test test-not start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, NSUBSTITUTE, NONE)); +} + +LispObj * +Lisp_NsubstituteIf(LispBuiltin *builtin) +/* + nsubstitute-if newitem test sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, NSUBSTITUTE, IF)); +} + +LispObj * +Lisp_NsubstituteIfNot(LispBuiltin *builtin) +/* + nsubstitute-if-not newitem test sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, NSUBSTITUTE, IFNOT)); +} + +LispObj * +Lisp_Nth(LispBuiltin *builtin) +/* + nth index list + */ +{ + long position; + LispObj *oindex, *list; + + list = ARGUMENT(1); + oindex = ARGUMENT(0); + + CHECK_INDEX(oindex); + position = FIXNUM_VALUE(oindex); + + if (list == NIL) + return (NIL); + + CHECK_CONS(list); + for (; position > 0; position--) { + if (!CONSP(list)) + return (NIL); + list = CDR(list); + } + + return (CONSP(list) ? CAR(list) : NIL); +} + +LispObj * +Lisp_Nthcdr(LispBuiltin *builtin) +/* + nthcdr index list + */ +{ + long position; + LispObj *oindex, *list; + + list = ARGUMENT(1); + oindex = ARGUMENT(0); + + CHECK_INDEX(oindex); + position = FIXNUM_VALUE(oindex); + + if (list == NIL) + return (NIL); + CHECK_CONS(list); + + for (; position > 0; position--) { + if (!CONSP(list)) + return (NIL); + list = CDR(list); + } + + return (list); +} + +LispObj * +Lisp_NthValue(LispBuiltin *builtin) +/* + nth-value index form + */ +{ + long i; + LispObj *oindex, *form, *result; + + form = ARGUMENT(1); + oindex = ARGUMENT(0); + + oindex = EVAL(oindex); + CHECK_INDEX(oindex); + i = FIXNUM_VALUE(oindex) - 1; + + result = EVAL(form); + if (RETURN_COUNT < 0 || i >= RETURN_COUNT) + result = NIL; + else if (i >= 0) + result = RETURN(i); + + return (result); +} + +LispObj * +Lisp_Null(LispBuiltin *builtin) +/* + null list + */ +{ + LispObj *list; + + list = ARGUMENT(0); + + return (list == NIL ? T : NIL); +} + +LispObj * +Lisp_Or(LispBuiltin *builtin) +/* + or &rest args + */ +{ + LispObj *result = NIL, *args; + + args = ARGUMENT(0); + + for (; CONSP(args); args = CDR(args)) { + result = EVAL(CAR(args)); + if (result != NIL) + break; + } + + return (result); +} + +LispObj * +Lisp_Pairlis(LispBuiltin *builtin) +/* + pairlis key data &optional alist + */ +{ + LispObj *result, *cons; + + LispObj *key, *data, *alist; + + alist = ARGUMENT(2); + data = ARGUMENT(1); + key = ARGUMENT(0); + + if (CONSP(key) && CONSP(data)) { + GC_ENTER(); + + result = cons = CONS(CONS(CAR(key), CAR(data)), NIL); + GC_PROTECT(result); + key = CDR(key); + data = CDR(data); + for (; CONSP(key) && CONSP(data); key = CDR(key), data = CDR(data)) { + RPLACD(cons, CONS(CONS(CAR(key), CAR(data)), NIL)); + cons = CDR(cons); + } + if (CONSP(key) || CONSP(data)) + LispDestroy("%s: different length lists", STRFUN(builtin)); + GC_LEAVE(); + if (alist != UNSPEC) + RPLACD(cons, alist); + } + else + result = alist == UNSPEC ? NIL : alist; + + return (result); +} + +static LispObj * +LispFindOrPosition(LispBuiltin *builtin, + int function, int comparison) +/* + find item sequence &key from-end test test-not start end key + find-if predicate sequence &key from-end start end key + find-if-not predicate sequence &key from-end start end key + position item sequence &key from-end test test-not start end key + position-if predicate sequence &key from-end start end key + position-if-not predicate sequence &key from-end start end key + */ +{ + int code = 0, istring, expect, value; + char *string = NULL; + long offset = -1, start, end, length, i = comparison == NONE ? 7 : 5; + LispObj *cmp, *element, **objects = NULL; + + LispObj *item, *predicate, *sequence, *from_end, + *test, *test_not, *ostart, *oend, *key; + + key = ARGUMENT(i); --i; + oend = ARGUMENT(i); --i; + ostart = ARGUMENT(i); --i; + if (comparison == NONE) { + test_not = ARGUMENT(i); --i; + test = ARGUMENT(i); --i; + } + else + test_not = test = UNSPEC; + from_end = ARGUMENT(i); --i; + if (from_end == UNSPEC) + from_end = NIL; + sequence = ARGUMENT(i); --i; + if (comparison == NONE) { + item = ARGUMENT(i); + predicate = Oeql; + } + else { + predicate = ARGUMENT(i); + item = NIL; + } + + LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, + &start, &end, &length); + + if (sequence == NIL) + return (NIL); + + /* Cannot specify both :test and :test-not */ + if (test != UNSPEC && test_not != UNSPEC) + LispDestroy("%s: specify either :TEST or :TEST-NOT", STRFUN(builtin)); + + expect = 1; + if (comparison == NONE) { + if (test != UNSPEC) + predicate = test; + else if (test_not != UNSPEC) { + predicate = test_not; + expect = 0; + } + FUNCTION_CHECK(predicate); + code = FCODE(predicate); + } + + cmp = element = NIL; + istring = STRINGP(sequence); + if (istring) + string = THESTR(sequence); + else { + if (!CONSP(sequence)) + sequence = sequence->data.array.list; + for (i = 0; i < start; i++) + sequence = CDR(sequence); + } + + if ((length = end - start) == 0) + return (NIL); + + if (from_end != NIL && !istring) { + objects = LispMalloc(sizeof(LispObj*) * length); + for (i = length - 1; i >= 0; i--, sequence = CDR(sequence)) + objects[i] = CAR(sequence); + } + + for (i = 0; i < length; i++) { + if (istring) + element = SCHAR(string[from_end == NIL ? i + start : end - i - 1]); + else + element = from_end == NIL ? CAR(sequence) : objects[i]; + + if (key != UNSPEC) + cmp = APPLY1(key, element); + else + cmp = element; + + /* Update list */ + if (!istring && from_end == NIL) + sequence = CDR(sequence); + + if (comparison == NONE) + value = FCOMPARE(predicate, item, cmp, code); + else + value = APPLY1(predicate, cmp) != NIL; + + if ((!value && + (comparison == IFNOT || + (comparison == NONE && !expect))) || + (value && + (comparison == IF || + (comparison == NONE && expect)))) { + offset = from_end == NIL ? i + start : end - i - 1; + break; + } + } + + if (from_end != NIL && !istring) + LispFree(objects); + + return (offset == -1 ? NIL : function == FIND ? element : FIXNUM(offset)); +} + +LispObj * +Lisp_Pop(LispBuiltin *builtin) +/* + pop place + */ +{ + LispObj *result, *value; + + LispObj *place; + + place = ARGUMENT(0); + + if (SYMBOLP(place)) { + result = LispGetVar(place); + if (result == NULL) + LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); + CHECK_CONSTANT(place); + if (result != NIL) { + CHECK_CONS(result); + value = CDR(result); + result = CAR(result); + } + else + value = NIL; + LispSetVar(place, value); + } + else { + GC_ENTER(); + LispObj quote; + + result = EVAL(place); + if (result != NIL) { + CHECK_CONS(result); + value = CDR(result); + GC_PROTECT(value); + result = CAR(result); + } + else + value = NIL; + quote.type = LispQuote_t; + quote.data.quote = value; + APPLY2(Osetf, place, "e); + GC_LEAVE(); + } + + return (result); +} + +LispObj * +Lisp_Position(LispBuiltin *builtin) +/* + position item sequence &key from-end test test-not start end key + */ +{ + return (LispFindOrPosition(builtin, POSITION, NONE)); +} + +LispObj * +Lisp_PositionIf(LispBuiltin *builtin) +/* + position-if predicate sequence &key from-end start end key + */ +{ + return (LispFindOrPosition(builtin, POSITION, IF)); +} + +LispObj * +Lisp_PositionIfNot(LispBuiltin *builtin) +/* + position-if-not predicate sequence &key from-end start end key + */ +{ + return (LispFindOrPosition(builtin, POSITION, IFNOT)); +} + +LispObj * +Lisp_Proclaim(LispBuiltin *builtin) +/* + proclaim declaration + */ +{ + LispObj *arguments, *object; + char *operation; + + LispObj *declaration; + + declaration = ARGUMENT(0); + + CHECK_CONS(declaration); + + arguments = declaration; + object = CAR(arguments); + CHECK_SYMBOL(object); + + operation = ATOMID(object); + if (strcmp(operation, "SPECIAL") == 0) { + for (arguments = CDR(arguments); CONSP(arguments); + arguments = CDR(arguments)) { + object = CAR(arguments); + CHECK_SYMBOL(object); + LispProclaimSpecial(object, NULL, NIL); + } + } + else if (strcmp(operation, "TYPE") == 0) { + /* XXX no type checking yet, but should be added */ + } + /* else do nothing */ + + return (NIL); +} + +LispObj * +Lisp_Prog1(LispBuiltin *builtin) +/* + prog1 first &rest body + */ +{ + GC_ENTER(); + LispObj *result; + + LispObj *first, *body; + + body = ARGUMENT(1); + first = ARGUMENT(0); + + result = EVAL(first); + + GC_PROTECT(result); + for (; CONSP(body); body = CDR(body)) + (void)EVAL(CAR(body)); + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Prog2(LispBuiltin *builtin) +/* + prog2 first second &rest body + */ +{ + GC_ENTER(); + LispObj *result; + + LispObj *first, *second, *body; + + body = ARGUMENT(2); + second = ARGUMENT(1); + first = ARGUMENT(0); + + (void)EVAL(first); + result = EVAL(second); + GC_PROTECT(result); + for (; CONSP(body); body = CDR(body)) + (void)EVAL(CAR(body)); + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Progn(LispBuiltin *builtin) +/* + progn &rest body + */ +{ + LispObj *result = NIL; + + LispObj *body; + + body = ARGUMENT(0); + + for (; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + + return (result); +} + +/* + * This does what I believe is the expected behaviour (or at least + * acceptable for the the interpreter), if the code being executed + * ever tries to change/bind a progv symbol, the symbol state will + * be restored when exiting the progv block, so, code like: + * (progv '(*x*) '(1) (defvar *x* 10)) + * when exiting the block, will have *x* unbound, and not a dynamic + * symbol; if it was already bound, will have the old value. + * Symbols already dynamic can be freely changed, even unbounded in + * the progv block. + */ +LispObj * +Lisp_Progv(LispBuiltin *builtin) +/* + progv symbols values &rest body + */ +{ + GC_ENTER(); + int head = lisp__data.env.length, i, count, ostk[32], *offsets; + LispObj *result, *list, *symbol, *value, **presult, **psymbols, **pbody; + int jumped, *pjumped, *pcount, **poffsets; + char fstk[32], *flags, **pflags; + LispBlock *block; + LispAtom *atom; + + LispObj *symbols, *values, *body; + + /* Possible states */ +#define DYNAMIC_SYMBOL 1 +#define GLOBAL_SYMBOL 2 +#define UNBOUND_SYMBOL 3 + + body = ARGUMENT(2); + values = ARGUMENT(1); + symbols = ARGUMENT(0); + + /* get symbol names */ + symbols = EVAL(symbols); + GC_PROTECT(symbols); + + /* get symbol values */ + values = EVAL(values); + GC_PROTECT(values); + + /* use variables */ + pbody = &body; + psymbols = &symbols; + presult = &result; + pjumped = &jumped; + poffsets = &offsets; + pcount = &count; + pflags = &flags; + + /* count/check symbols and allocate space to remember symbol state */ + for (count = 0, list = symbols; CONSP(list); count++, list = CDR(list)) { + symbol = CAR(list); + CHECK_SYMBOL(symbol); + CHECK_CONSTANT(symbol); + } + if (count > sizeof(fstk)) { + flags = LispMalloc(count); + offsets = LispMalloc(count * sizeof(int)); + } + else { + flags = &fstk[0]; + offsets = &ostk[0]; + } + + /* store flags and save old value if required */ + for (i = 0, list = symbols; i < count; i++, list = CDR(list)) { + atom = CAR(list)->data.atom; + if (atom->dyn) + flags[i] = DYNAMIC_SYMBOL; + else if (atom->a_object) { + flags[i] = GLOBAL_SYMBOL; + offsets[i] = lisp__data.protect.length; + GC_PROTECT(atom->property->value); + } + else + flags[i] = UNBOUND_SYMBOL; + } + + /* bind the symbols */ + for (i = 0, list = symbols; i < count; i++, list = CDR(list)) { + symbol = CAR(list); + atom = symbol->data.atom; + if (CONSP(values)) { + value = CAR(values); + values = CDR(values); + } + else + value = NIL; + if (flags[i] != DYNAMIC_SYMBOL) { + if (!atom->a_object) + LispSetAtomObjectProperty(atom, value); + else + SETVALUE(atom, value); + } + else + LispAddVar(symbol, value); + } + /* bind dynamic symbols */ + lisp__data.env.head = lisp__data.env.length; + + jumped = 0; + result = NIL; + block = LispBeginBlock(NIL, LispBlockProtect); + if (setjmp(block->jmp) == 0) { + for (; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + } + + /* restore symbols */ + for (i = 0, list = symbols; i < count; i++, list = CDR(list)) { + symbol = CAR(list); + atom = symbol->data.atom; + if (flags[i] != DYNAMIC_SYMBOL) { + if (flags[i] == UNBOUND_SYMBOL) + LispUnsetVar(symbol); + else { + /* restore global symbol value */ + LispSetAtomObjectProperty(atom, lisp__data.protect.objects + [offsets[i]]); + atom->dyn = 0; + } + } + } + /* unbind dynamic symbols */ + lisp__data.env.head = lisp__data.env.length = head; + GC_LEAVE(); + + if (count > sizeof(fstk)) { + LispFree(flags); + LispFree(offsets); + } + + LispEndBlock(block); + if (!lisp__data.destroyed) { + if (jumped) + result = lisp__data.block.block_ret; + } + else { + /* check if there is an unwind-protect block */ + LispBlockUnwind(NULL); + + /* no unwind-protect block, return to the toplevel */ + LispDestroy("."); + } + + return (result); +} + +LispObj * +Lisp_Provide(LispBuiltin *builtin) +/* + provide module + */ +{ + LispObj *module, *obj; + + module = ARGUMENT(0); + + CHECK_STRING(module); + for (obj = MOD; obj != NIL; obj = CDR(obj)) { + if (STRLEN(CAR(obj)) == STRLEN(module) && + memcmp(THESTR(CAR(obj)), THESTR(module), STRLEN(module)) == 0) + return (module); + } + + if (MOD == NIL) + MOD = CONS(module, NIL); + else { + RPLACD(MOD, CONS(CAR(MOD), CDR(MOD))); + RPLACA(MOD, module); + } + + LispSetVar(lisp__data.modules, MOD); + + return (MOD); +} + +LispObj * +Lisp_Push(LispBuiltin *builtin) +/* + push item place + */ +{ + LispObj *result, *list; + + LispObj *item, *place; + + place = ARGUMENT(1); + item = ARGUMENT(0); + + item = EVAL(item); + + if (SYMBOLP(place)) { + list = LispGetVar(place); + if (list == NULL) + LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); + CHECK_CONSTANT(place); + LispSetVar(place, result = CONS(item, list)); + } + else { + GC_ENTER(); + LispObj quote; + + list = EVAL(place); + result = CONS(item, list); + GC_PROTECT(result); + quote.type = LispQuote_t; + quote.data.quote = result; + APPLY2(Osetf, place, "e); + GC_LEAVE(); + } + + return (result); +} + +LispObj * +Lisp_Pushnew(LispBuiltin *builtin) +/* + pushnew item place &key key test test-not + */ +{ + GC_ENTER(); + LispObj *result, *list; + + LispObj *item, *place, *key, *test, *test_not; + + test_not = ARGUMENT(4); + test = ARGUMENT(3); + key = ARGUMENT(2); + place = ARGUMENT(1); + item = ARGUMENT(0); + + /* Evaluate place */ + if (SYMBOLP(place)) { + list = LispGetVar(place); + if (list == NULL) + LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); + /* Do error checking now. */ + CHECK_CONSTANT(place); + } + else + /* It is possible that list is not gc protected? */ + list = EVAL(place); + + item = EVAL(item); + GC_PROTECT(item); + if (key != UNSPEC) { + key = EVAL(key); + GC_PROTECT(key); + } + if (test != UNSPEC) { + test = EVAL(test); + GC_PROTECT(test); + } + else if (test_not != UNSPEC) { + test_not = EVAL(test_not); + GC_PROTECT(test_not); + } + + result = LispAdjoin(builtin, item, list, key, test, test_not); + + /* Item already in list */ + if (result == list) { + GC_LEAVE(); + + return (result); + } + + if (SYMBOLP(place)) { + CHECK_CONSTANT(place); + LispSetVar(place, result); + } + else { + LispObj quote; + + GC_PROTECT(result); + quote.type = LispQuote_t; + quote.data.quote = result; + APPLY2(Osetf, place, "e); + } + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Quit(LispBuiltin *builtin) +/* + quit &optional status + */ +{ + int status = 0; + LispObj *ostatus; + + ostatus = ARGUMENT(0); + + if (FIXNUMP(ostatus)) + status = (int)FIXNUM_VALUE(ostatus); + else if (ostatus != UNSPEC) + LispDestroy("%s: bad exit status argument %s", + STRFUN(builtin), STROBJ(ostatus)); + + exit(status); +} + +LispObj * +Lisp_Quote(LispBuiltin *builtin) +/* + quote object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (object); +} + +LispObj * +Lisp_Replace(LispBuiltin *builtin) +/* + replace sequence1 sequence2 &key start1 end1 start2 end2 + */ +{ + long length, length1, length2, start1, end1, start2, end2; + LispObj *sequence1, *sequence2, *ostart1, *oend1, *ostart2, *oend2; + + oend2 = ARGUMENT(5); + ostart2 = ARGUMENT(4); + oend1 = ARGUMENT(3); + ostart1 = ARGUMENT(2); + sequence2 = ARGUMENT(1); + sequence1 = ARGUMENT(0); + + LispCheckSequenceStartEnd(builtin, sequence1, ostart1, oend1, + &start1, &end1, &length1); + LispCheckSequenceStartEnd(builtin, sequence2, ostart2, oend2, + &start2, &end2, &length2); + + if (start1 == end1 || start2 == end2) + return (sequence1); + + length = end1 - start1; + if (length > end2 - start2) + length = end2 - start2; + + if (STRINGP(sequence1)) { + CHECK_STRING_WRITABLE(sequence1); + if (!STRINGP(sequence2)) + LispDestroy("%s: cannot store %s in %s", + STRFUN(builtin), STROBJ(sequence2), THESTR(sequence1)); + + memmove(THESTR(sequence1) + start1, THESTR(sequence2) + start2, length); + } + else { + int i; + LispObj *from, *to; + + if (ARRAYP(sequence1)) + sequence1 = sequence1->data.array.list; + if (ARRAYP(sequence2)) + sequence2 = sequence2->data.array.list; + + /* adjust pointers */ + for (i = 0, from = sequence2; i < start2; i++, from = CDR(from)) ; + for (i = 0, to = sequence1; i < start1; i++, to = CDR(to)) + ; + + /* copy data */ + for (i = 0; i < length; i++, from = CDR(from), to = CDR(to)) + RPLACA(to, CAR(from)); + } + + return (sequence1); +} + +static LispObj * +LispDeleteOrRemoveDuplicates(LispBuiltin *builtin, int function) +/* + delete-duplicates sequence &key from-end test test-not start end key + remove-duplicates sequence &key from-end test test-not start end key + */ +{ + GC_ENTER(); + int code, expect, value = 0; + long i, j, start, end, length, count; + LispObj *lambda, *result, *cons, *compare; + + LispObj *sequence, *from_end, *test, *test_not, *ostart, *oend, *key; + + key = ARGUMENT(6); + oend = ARGUMENT(5); + ostart = ARGUMENT(4); + test_not = ARGUMENT(3); + test = ARGUMENT(2); + from_end = ARGUMENT(1); + if (from_end == UNSPEC) + from_end = NIL; + sequence = ARGUMENT(0); + + LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, + &start, &end, &length); + + /* Check if need to do something */ + if (start == end) + return (sequence); + + CHECK_TEST(); + + /* Initialize */ + count = 0; + + result = cons = NIL; + if (STRINGP(sequence)) { + char *ptr, *string, *buffer = LispMalloc(length + 1); + + /* Use same code, update start/end offsets */ + if (from_end != NIL) { + i = length - start; + start = length - end; + end = i; + } + + if (from_end == NIL) + string = THESTR(sequence); + else { + /* Make a reversed copy of the sequence */ + string = LispMalloc(length + 1); + for (ptr = THESTR(sequence) + length - 1, i = 0; i < length; i++) + string[i] = *ptr--; + string[i] = '\0'; + } + + ptr = buffer; + /* Copy leading bytes */ + for (i = 0; i < start; i++) + *ptr++ = string[i]; + + compare = SCHAR(string[i]); + if (key != UNSPEC) + compare = APPLY1(key, compare); + result = cons = CONS(compare, NIL); + GC_PROTECT(result); + for (++i; i < end; i++) { + compare = SCHAR(string[i]); + if (key != UNSPEC) + compare = APPLY1(key, compare); + RPLACD(cons, CONS(compare, NIL)); + cons = CDR(cons); + } + + for (i = start; i < end; i++, result = CDR(result)) { + compare = CAR(result); + for (j = i + 1, cons = CDR(result); j < end; j++, cons = CDR(cons)) { + value = FCOMPARE(lambda, compare, CAR(cons), code); + if (value == expect) + break; + } + if (value != expect) + *ptr++ = string[i]; + else + ++count; + } + + if (count) { + /* Copy ending bytes */ + for (; i <= length; i++) /* Also copy the ending nul */ + *ptr++ = string[i]; + + if (from_end == NIL) + ptr = buffer; + else { + for (i = 0, ptr = buffer + strlen(buffer); + ptr > buffer; + i++) + string[i] = *--ptr; + string[i] = '\0'; + ptr = string; + LispFree(buffer); + } + if (function == REMOVE) + result = STRING2(ptr); + else { + CHECK_STRING_WRITABLE(sequence); + result = sequence; + free(THESTR(result)); + THESTR(result) = ptr; + LispMused(ptr); + } + } + else { + result = sequence; + if (from_end != NIL) + LispFree(string); + } + } + else { + long xlength = end - start; + LispObj *list, *object, **kobjects = NULL, **xobjects; + LispObj **objects = LispMalloc(sizeof(LispObj*) * xlength); + + if (!CONSP(sequence)) + object = sequence->data.array.list; + else + object = sequence; + list = object; + + for (i = 0; i < start; i++) + object = CDR(object); + + /* Put data in a vector */ + if (from_end == NIL) { + for (i = 0; i < xlength; i++, object = CDR(object)) + objects[i] = CAR(object); + } + else { + for (i = xlength - 1; i >= 0; i--, object = CDR(object)) + objects[i] = CAR(object); + } + + /* Apply key predicate if required */ + if (key != UNSPEC) { + kobjects = LispMalloc(sizeof(LispObj*) * xlength); + for (i = 0; i < xlength; i++) { + kobjects[i] = APPLY1(key, objects[i]); + GC_PROTECT(kobjects[i]); + } + xobjects = kobjects; + } + else + xobjects = objects; + + /* Check if needs to remove something */ + for (i = 0; i < xlength; i++) { + compare = xobjects[i]; + for (j = i + 1; j < xlength; j++) { + value = FCOMPARE(lambda, compare, xobjects[j], code); + if (value == expect) { + objects[i] = NULL; + ++count; + break; + } + } + } + + if (count) { + /* Create/set result list */ + object = list; + + if (start) { + /* Skip first elements of resulting list */ + if (function == REMOVE) { + result = cons = CONS(CAR(object), NIL); + GC_PROTECT(result); + for (i = 1, object = CDR(object); + i < start; + i++, object = CDR(object)) { + RPLACD(cons, CONS(CAR(object), NIL)); + cons = CDR(cons); + } + } + else { + result = cons = object; + for (i = 1; i < start; i++, cons = CDR(cons)) + ; + } + } + else if (function == DELETE) + result = list; + + /* Skip initial removed elements */ + if (function == REMOVE) { + for (i = 0; objects[i] == NULL && i < xlength; i++) + ; + } + else + i = 0; + + if (i < xlength) { + int xstart, xlimit, xinc; + + if (from_end == NIL) { + xstart = i; + xlimit = xlength; + xinc = 1; + } + else { + xstart = xlength - 1; + xlimit = i - 1; + xinc = -1; + } + + if (function == REMOVE) { + for (i = xstart; i != xlimit; i += xinc) { + if (objects[i] != NULL) { + if (result == NIL) { + result = cons = CONS(objects[i], NIL); + GC_PROTECT(result); + } + else { + RPLACD(cons, CONS(objects[i], NIL)); + cons = CDR(cons); + } + } + } + } + else { + /* Delete duplicates */ + for (i = xstart; i != xlimit; i += xinc) { + if (objects[i] == NULL) { + if (cons == NIL) { + if (CONSP(CDR(result))) { + RPLACA(result, CADR(result)); + RPLACD(result, CDDR(result)); + } + else { + RPLACA(result, CDR(result)); + RPLACD(result, NIL); + } + } + else { + if (CONSP(CDR(cons))) + RPLACD(cons, CDDR(cons)); + else + RPLACD(cons, NIL); + } + } + else { + if (cons == NIL) + cons = result; + else + cons = CDR(cons); + } + } + } + } + if (end < length && function == REMOVE) { + for (i = start; i < end; i++, object = CDR(object)) + ; + if (result == NIL) { + result = cons = CONS(CAR(object), NIL); + GC_PROTECT(result); + ++i; + object = CDR(object); + } + for (; i < length; i++, object = CDR(object)) { + RPLACD(cons, CONS(CAR(object), NIL)); + cons = CDR(cons); + } + } + } + else + result = sequence; + LispFree(objects); + if (key != UNSPEC) + LispFree(kobjects); + + if (count && !CONSP(sequence)) { + if (function == REMOVE) + result = VECTOR(result); + else { + length = FIXNUM_VALUE(CAR(sequence->data.array.dim)) - count; + CAR(sequence->data.array.dim) = FIXNUM(length); + result = sequence; + } + } + } + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_RemoveDuplicates(LispBuiltin *builtin) +/* + remove-duplicates sequence &key from-end test test-not start end key + */ +{ + return (LispDeleteOrRemoveDuplicates(builtin, REMOVE)); +} + +static LispObj * +LispDeleteRemoveXSubstitute(LispBuiltin *builtin, + int function, int comparison) +/* + delete item sequence &key from-end test test-not start end count key + delete-if predicate sequence &key from-end start end count key + delete-if-not predicate sequence &key from-end start end count key + remove item sequence &key from-end test test-not start end count key + remove-if predicate sequence &key from-end start end count key + remove-if-not predicate sequence &key from-end start end count key + substitute newitem olditem sequence &key from-end test test-not start end count key + substitute-if newitem test sequence &key from-end start end count key + substitute-if-not newitem test sequence &key from-end start end count key + nsubstitute newitem olditem sequence &key from-end test test-not start end count key + nsubstitute-if newitem test sequence &key from-end start end count key + nsubstitute-if-not newitem test sequence &key from-end start end count key + */ +{ + GC_ENTER(); + int code, expect, value, inplace, substitute; + long i, j, start, end, length, copy, count, xstart, xend, xinc, xlength; + + LispObj *result, *compare; + + LispObj *item, *newitem, *lambda, *sequence, *from_end, + *test, *test_not, *ostart, *oend, *ocount, *key; + + substitute = function == SUBSTITUTE || function == NSUBSTITUTE; + if (!substitute) + i = comparison == NONE ? 8 : 6; + else /* substitute */ + i = comparison == NONE ? 9 : 7; + + /* Get function arguments */ + key = ARGUMENT(i); --i; + ocount = ARGUMENT(i); --i; + oend = ARGUMENT(i); --i; + ostart = ARGUMENT(i); --i; + if (comparison == NONE) { + test_not = ARGUMENT(i); --i; + test = ARGUMENT(i); --i; + } + else + test_not = test = UNSPEC; + from_end = ARGUMENT(i); --i; + if (from_end == UNSPEC) + from_end = NIL; + sequence = ARGUMENT(i); --i; + if (comparison != NONE) { + lambda = ARGUMENT(i); --i; + if (substitute) + newitem = ARGUMENT(0); + else + newitem = NIL; + item = NIL; + } + else { + lambda = NIL; + if (substitute) { + item = ARGUMENT(1); + newitem = ARGUMENT(0); + } + else { + item = ARGUMENT(0); + newitem = NIL; + } + } + + /* Check if argument is a valid sequence, and if start/end + * are correctly specified. */ + LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, + &start, &end, &length); + + /* Check count argument */ + if (ocount == UNSPEC) { + count = length; + /* Doesn't matter, but left to right should be slightly faster */ + from_end = NIL; + } + else { + CHECK_INDEX(ocount); + count = FIXNUM_VALUE(ocount); + } + + /* Check if need to do something */ + if (start == end || count == 0) + return (sequence); + + CHECK_TEST_0(); + + /* Resolve comparison function, and expected result of comparison */ + if (comparison == NONE) { + if (test_not == UNSPEC) { + if (test == UNSPEC) + lambda = Oeql; + else + lambda = test; + expect = 1; + } + else { + lambda = test_not; + expect = 0; + } + FUNCTION_CHECK(lambda); + } + else + expect = comparison == IFNOT ? 0 : 1; + + /* Check for fast path to comparison function */ + code = FCODE(lambda); + + /* Initialize for loop */ + copy = count; + result = sequence; + inplace = function == DELETE || function == NSUBSTITUTE; + xlength = end - start; + + /* String is easier */ + if (STRINGP(sequence)) { + char *buffer, *string; + + if (comparison == NONE) { + CHECK_SCHAR(item); + } + if (substitute) { + CHECK_SCHAR(newitem); + } + + if (from_end == NIL) { + xstart = start; + xend = end; + xinc = 1; + } + else { + xstart = end - 1; + xend = start - 1; + xinc = -1; + } + + string = THESTR(sequence); + buffer = LispMalloc(length + 1); + + /* Copy leading bytes, if any */ + for (i = 0; i < start; i++) + buffer[i] = string[i]; + + for (j = xstart; i != xend && count > 0; i += xinc) { + compare = SCHAR(string[i]); + if (key != UNSPEC) { + compare = APPLY1(key, compare); + /* Value returned by the key predicate may not be protected */ + GC_PROTECT(compare); + if (comparison == NONE) + value = FCOMPARE(lambda, item, compare, code); + else + value = APPLY1(lambda, compare) != NIL; + /* Unprotect value returned by the key predicate */ + GC_LEAVE(); + } + else { + if (comparison == NONE) + value = FCOMPARE(lambda, item, compare, code); + else + value = APPLY1(lambda, compare) != NIL; + } + + if (value != expect) { + buffer[j] = string[i]; + j += xinc; + } + else { + if (substitute) { + buffer[j] = SCHAR_VALUE(newitem); + j += xinc; + } + else + --count; + } + } + + if (count != copy && from_end != NIL) + memmove(buffer + start, buffer + copy - count, count); + + /* Copy remaining bytes, if any */ + for (; i < length; i++, j++) + buffer[j] = string[i]; + buffer[j] = '\0'; + + xlength = length - (copy - count); + if (inplace) { + CHECK_STRING_WRITABLE(sequence); + /* result is a pointer to sequence */ + LispFree(THESTR(sequence)); + LispMused(buffer); + THESTR(sequence) = buffer; + STRLEN(sequence) = xlength; + } + else + result = LSTRING2(buffer, xlength); + } + + /* If inplace, need to update CAR and CDR of sequence */ + else { + LispObj *list, *object; + LispObj **objects = LispMalloc(sizeof(LispObj*) * xlength); + + if (!CONSP(sequence)) + list = sequence->data.array.list; + else + list = sequence; + + /* Put data in a vector */ + for (i = 0, object = list; i < start; i++) + object = CDR(object); + + for (i = 0; i < xlength; i++, object = CDR(object)) + objects[i] = CAR(object); + + if (from_end == NIL) { + xstart = 0; + xend = xlength; + xinc = 1; + } + else { + xstart = xlength - 1; + xend = -1; + xinc = -1; + } + + /* Check if needs to remove something */ + for (i = xstart; i != xend && count > 0; i += xinc) { + compare = objects[i]; + if (key != UNSPEC) { + compare = APPLY1(key, compare); + GC_PROTECT(compare); + if (comparison == NONE) + value = FCOMPARE(lambda, item, compare, code); + else + value = APPLY1(lambda, compare) != NIL; + GC_LEAVE(); + } + else { + if (comparison == NONE) + value = FCOMPARE(lambda, item, compare, code); + else + value = APPLY1(lambda, compare) != NIL; + } + if (value == expect) { + if (substitute) + objects[i] = newitem; + else + objects[i] = NULL; + --count; + } + } + + if (copy != count) { + LispObj *cons = NIL; + + i = 0; + object = list; + if (inplace) { + /* While result is NIL, skip initial elements of sequence */ + result = start ? list : NIL; + + /* Skip initial elements, if any */ + for (; i < start; i++, cons = object, object = CDR(object)) + ; + } + /* Copy initial elements, if any */ + else { + result = NIL; + if (start) { + result = cons = CONS(CAR(list), NIL); + GC_PROTECT(result); + for (++i, object = CDR(list); + i < start; + i++, object = CDR(object)) { + RPLACD(cons, CONS(CAR(object), NIL)); + cons = CDR(cons); + } + } + } + + /* Skip initial removed elements, if any */ + for (i = 0; objects[i] == NULL && i < xlength; i++) + ; + + for (i = 0; i < xlength; i++, object = CDR(object)) { + if (objects[i]) { + if (inplace) { + if (result == NIL) + result = cons = object; + else { + RPLACD(cons, object); + cons = CDR(cons); + } + if (function == NSUBSTITUTE) + RPLACA(cons, objects[i]); + } + else { + if (result == NIL) { + result = cons = CONS(objects[i], NIL); + GC_PROTECT(result); + } + else { + RPLACD(cons, CONS(objects[i], NIL)); + cons = CDR(cons); + } + } + } + } + + if (inplace) { + if (result == NIL) + result = object; + else + RPLACD(cons, object); + + if (!CONSP(sequence)) { + result = sequence; + CAR(result)->data.array.dim = + FIXNUM(length - (copy - count)); + } + } + else if (end < length) { + i = end; + /* Copy ending elements, if any */ + if (result == NIL) { + result = cons = CONS(CAR(object), NIL); + GC_PROTECT(result); + object = CDR(object); + i++; + } + for (; i < length; i++, object = CDR(object)) { + RPLACD(cons, CONS(CAR(object), NIL)); + cons = CDR(cons); + } + } + } + + /* Release comparison vector */ + LispFree(objects); + } + + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Remove(LispBuiltin *builtin) +/* + remove item sequence &key from-end test test-not start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, REMOVE, NONE)); +} + +LispObj * +Lisp_RemoveIf(LispBuiltin *builtin) +/* + remove-if predicate sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, REMOVE, IF)); +} + +LispObj * +Lisp_RemoveIfNot(LispBuiltin *builtin) +/* + remove-if-not predicate sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, REMOVE, IFNOT)); +} + +LispObj * +Lisp_Remprop(LispBuiltin *builtin) +/* + remprop symbol indicator + */ +{ + LispObj *symbol, *indicator; + + indicator = ARGUMENT(1); + symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + + return (LispRemAtomProperty(symbol->data.atom, indicator)); +} + +LispObj * +Lisp_Return(LispBuiltin *builtin) +/* + return &optional result + */ +{ + unsigned blevel = lisp__data.block.block_level; + + LispObj *result; + + result = ARGUMENT(0); + + while (blevel) { + LispBlock *block = lisp__data.block.block[--blevel]; + + if (block->type == LispBlockClosure) + /* if reached a function call */ + break; + if (block->type == LispBlockTag && block->tag == NIL) { + lisp__data.block.block_ret = result == UNSPEC ? NIL : EVAL(result); + LispBlockUnwind(block); + BLOCKJUMP(block); + } + } + LispDestroy("%s: no visible NIL block", STRFUN(builtin)); + + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +Lisp_ReturnFrom(LispBuiltin *builtin) +/* + return-from name &optional result + */ +{ + unsigned blevel = lisp__data.block.block_level; + + LispObj *name, *result; + + result = ARGUMENT(1); + name = ARGUMENT(0); + + if (name != NIL && name != T && !SYMBOLP(name)) + LispDestroy("%s: %s is not a valid block name", + STRFUN(builtin), STROBJ(name)); + + while (blevel) { + LispBlock *block = lisp__data.block.block[--blevel]; + + if (name == block->tag && + (block->type == LispBlockTag || block->type == LispBlockClosure)) { + lisp__data.block.block_ret = result == UNSPEC ? NIL : EVAL(result); + LispBlockUnwind(block); + BLOCKJUMP(block); + } + if (block->type == LispBlockClosure) + /* can use return-from only in the current function */ + break; + } + LispDestroy("%s: no visible block named %s", + STRFUN(builtin), STROBJ(name)); + + /*NOTREACHED*/ + return (NIL); +} + +static LispObj * +LispXReverse(LispBuiltin *builtin, int inplace) +/* + nreverse sequence + reverse sequence + */ +{ + long length; + LispObj *list, *result = NIL; + + LispObj *sequence; + + sequence = ARGUMENT(0); + + /* Do error checking for arrays and object type. */ + length = LispLength(sequence); + if (length <= 1) + return (sequence); + + switch (XOBJECT_TYPE(sequence)) { + case LispString_t: { + long i; + char *from, *to; + + from = THESTR(sequence) + length - 1; + if (inplace) { + char temp; + + CHECK_STRING_WRITABLE(sequence); + to = THESTR(sequence); + for (i = 0; i < length / 2; i++) { + temp = to[i]; + to[i] = from[-i]; + from[-i] = temp; + } + result = sequence; + } + else { + to = LispMalloc(length + 1); + to[length] = '\0'; + for (i = 0; i < length; i++) + to[i] = from[-i]; + result = STRING2(to); + } + } return (result); + case LispCons_t: + if (inplace) { + long i, j; + LispObj *temp; + + /* For large lists this can be very slow, but for small + * amounts of data, this avoid allocating a buffer to + * to store the CAR of the sequence. This is only done + * to not destroy the contents of a variable. + */ + for (i = 0, list = sequence; + i < (length + 1) / 2; + i++, list = CDR(list)) + ; + length /= 2; + for (i = 0; i < length; i++, list = CDR(list)) { + for (j = length - i - 1, result = sequence; + j > 0; + j--, result = CDR(result)) + ; + temp = CAR(list); + RPLACA(list, CAR(result)); + RPLACA(result, temp); + } + return (sequence); + } + list = sequence; + break; + case LispArray_t: + if (inplace) { + sequence->data.array.list = + LispReverse(sequence->data.array.list); + return (sequence); + } + list = sequence->data.array.list; + break; + default: /* LispNil_t */ + return (result); + } + + { + GC_ENTER(); + LispObj *cons; + + result = cons = CONS(CAR(list), NIL); + GC_PROTECT(result); + for (list = CDR(list); CONSP(list); list = CDR(list)) { + RPLACD(cons, CONS(CAR(list), NIL)); + cons = CDR(cons); + } + result = LispReverse(result); + + GC_LEAVE(); + } + + if (ARRAYP(sequence)) { + list = result; + + result = LispNew(list, NIL); + result->type = LispArray_t; + result->data.array.list = list; + result->data.array.dim = sequence->data.array.dim; + result->data.array.rank = sequence->data.array.rank; + result->data.array.type = sequence->data.array.type; + result->data.array.zero = sequence->data.array.zero; + } + + return (result); +} + +LispObj * +Lisp_Reverse(LispBuiltin *builtin) +/* + reverse sequence + */ +{ + return (LispXReverse(builtin, 0)); +} + +LispObj * +Lisp_Rplaca(LispBuiltin *builtin) +/* + rplaca place value + */ +{ + LispObj *place, *value; + + value = ARGUMENT(1); + place = ARGUMENT(0); + + CHECK_CONS(place); + RPLACA(place, value); + + return (place); +} + +LispObj * +Lisp_Rplacd(LispBuiltin *builtin) +/* + rplacd place value + */ +{ + LispObj *place, *value; + + value = ARGUMENT(1); + place = ARGUMENT(0); + + CHECK_CONS(place); + RPLACD(place, value); + + return (place); +} + +LispObj * +Lisp_Search(LispBuiltin *builtin) +/* + search sequence1 sequence2 &key from-end test test-not key start1 start2 end1 end2 + */ +{ + int code = 0, expect, value; + long start1, start2, end1, end2, length1, length2, off1, off2, offset = -1; + LispObj *cmp1, *cmp2, *list1 = NIL, *lambda; + SeqInfo seq1, seq2; + + LispObj *sequence1, *sequence2, *from_end, *test, *test_not, + *key, *ostart1, *ostart2, *oend1, *oend2; + + oend2 = ARGUMENT(9); + oend1 = ARGUMENT(8); + ostart2 = ARGUMENT(7); + ostart1 = ARGUMENT(6); + key = ARGUMENT(5); + test_not = ARGUMENT(4); + test = ARGUMENT(3); + from_end = ARGUMENT(2); + sequence2 = ARGUMENT(1); + sequence1 = ARGUMENT(0); + + LispCheckSequenceStartEnd(builtin, sequence1, ostart1, oend1, + &start1, &end1, &length1); + LispCheckSequenceStartEnd(builtin, sequence2, ostart2, oend2, + &start2, &end2, &length2); + + /* Check for special conditions */ + if (start1 == end1) + return (FIXNUM(end2)); + else if (start2 == end2) + return (start1 == end1 ? FIXNUM(start2) : NIL); + + CHECK_TEST(); + + if (from_end == UNSPEC) + from_end = NIL; + + SETSEQ(seq1, sequence1); + SETSEQ(seq2, sequence2); + + length1 = end1 - start1; + length2 = end2 - start2; + + /* update start of sequences */ + if (start1) { + if (seq1.type == LispString_t) + seq1.data.string += start1; + else { + for (cmp1 = seq1.data.list; start1; cmp1 = CDR(cmp1), --start1) + ; + seq1.data.list = cmp1; + } + end1 = length1; + } + if (start2) { + if (seq2.type == LispString_t) + seq2.data.string += start2; + else { + for (cmp2 = seq2.data.list; start2; cmp2 = CDR(cmp2), --start2) + ; + seq2.data.list = cmp2; + } + end2 = length2; + } + + /* easier case */ + if (from_end == NIL) { + LispObj *list2 = NIL; + + /* while a match is possible */ + while (end2 - start2 >= length1) { + + /* prepare to search */ + off1 = 0; + off2 = start2; + if (seq1.type != LispString_t) + list1 = seq1.data.list; + if (seq2.type != LispString_t) + list2 = seq2.data.list; + + /* for every element that must match in sequence1 */ + while (off1 < length1) { + if (seq1.type == LispString_t) + cmp1 = SCHAR(seq1.data.string[off1]); + else + cmp1 = CAR(list1); + if (seq2.type == LispString_t) + cmp2 = SCHAR(seq2.data.string[off2]); + else + cmp2 = CAR(list2); + if (key != UNSPEC) { + cmp1 = APPLY1(key, cmp1); + cmp2 = APPLY1(key, cmp2); + } + + /* compare elements */ + value = FCOMPARE(lambda, cmp1, cmp2, code); + if (value != expect) + break; + + /* update offsets/sequence pointers */ + ++off1; + ++off2; + if (seq1.type != LispString_t) + list1 = CDR(list1); + if (seq2.type != LispString_t) + list2 = CDR(list2); + } + + /* if everything matched */ + if (off1 == end1) { + offset = off2 - length1; + break; + } + + /* update offset/sequence2 pointer */ + ++start2; + if (seq2.type != LispString_t) + seq2.data.list = CDR(seq2.data.list); + } + } + else { + /* allocate vector if required, only list2 requires it. + * list1 can be traversed forward */ + if (seq2.type != LispString_t) { + cmp2 = seq2.data.list; + seq2.data.vector = LispMalloc(sizeof(LispObj*) * length2); + for (off2 = 0; off2 < end2; off2++, cmp2 = CDR(cmp2)) + seq2.data.vector[off2] = CAR(cmp2); + } + + /* while a match is possible */ + while (end2 >= length1) { + + /* prepare to search */ + off1 = 0; + off2 = end2 - length1; + if (seq1.type != LispString_t) + list1 = seq1.data.list; + + /* for every element that must match in sequence1 */ + while (off1 < end1) { + if (seq1.type == LispString_t) + cmp1 = SCHAR(seq1.data.string[off1]); + else + cmp1 = CAR(list1); + if (seq2.type == LispString_t) + cmp2 = SCHAR(seq2.data.string[off2]); + else + cmp2 = seq2.data.vector[off2]; + if (key != UNSPEC) { + cmp1 = APPLY1(key, cmp1); + cmp2 = APPLY1(key, cmp2); + } + + /* Compare elements */ + value = FCOMPARE(lambda, cmp1, cmp2, code); + if (value != expect) + break; + + /* Update offsets */ + ++off1; + ++off2; + if (seq1.type != LispString_t) + list1 = CDR(list1); + } + + /* If all elements matched */ + if (off1 == end1) { + offset = off2 - length1; + break; + } + + /* Update offset */ + --end2; + } + + if (seq2.type != LispString_t) + LispFree(seq2.data.vector); + } + + return (offset == -1 ? NIL : FIXNUM(offset)); +} + +/* + * ext::getenv + */ +LispObj * +Lisp_Setenv(LispBuiltin *builtin) +/* + setenv name value &optional overwrite + */ +{ + char *name, *value; + + LispObj *oname, *ovalue, *overwrite; + + overwrite = ARGUMENT(2); + ovalue = ARGUMENT(1); + oname = ARGUMENT(0); + + CHECK_STRING(oname); + name = THESTR(oname); + + CHECK_STRING(ovalue); + value = THESTR(ovalue); + + setenv(name, value, overwrite != UNSPEC && overwrite != NIL); + value = getenv(name); + + return (value ? STRING(value) : NIL); +} + +LispObj * +Lisp_Set(LispBuiltin *builtin) +/* + set symbol value + */ +{ + LispAtom *atom; + LispObj *symbol, *value; + + value = ARGUMENT(1); + symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + atom = symbol->data.atom; + if (atom->dyn) + LispSetVar(symbol, value); + else if (atom->watch || !atom->a_object) + LispSetAtomObjectProperty(atom, value); + else { + CHECK_CONSTANT(symbol); + SETVALUE(atom, value); + } + + return (value); +} + +LispObj * +Lisp_SetDifference(LispBuiltin *builtin) +/* + set-difference list1 list2 &key test test-not key + */ +{ + return (LispListSet(builtin, SETDIFFERENCE)); +} + +LispObj * +Lisp_SetExclusiveOr(LispBuiltin *builtin) +/* + set-exclusive-or list1 list2 &key test test-not key + */ +{ + return (LispListSet(builtin, SETEXCLUSIVEOR)); +} + +LispObj * +Lisp_NsetExclusiveOr(LispBuiltin *builtin) +/* + nset-exclusive-or list1 list2 &key test test-not key + */ +{ + return (LispListSet(builtin, NSETEXCLUSIVEOR)); +} + +LispObj * +Lisp_SetQ(LispBuiltin *builtin) +/* + setq &rest form + */ +{ + LispObj *result, *variable, *form; + + form = ARGUMENT(0); + + result = NIL; + for (; CONSP(form); form = CDR(form)) { + variable = CAR(form); + CHECK_SYMBOL(variable); + CHECK_CONSTANT(variable); + form = CDR(form); + if (!CONSP(form)) + LispDestroy("%s: odd number of arguments", STRFUN(builtin)); + result = EVAL(CAR(form)); + LispSetVar(variable, result); + } + + return (result); +} + +LispObj * +Lisp_Psetq(LispBuiltin *builtin) +/* + psetq &rest form + */ +{ + GC_ENTER(); + int base = gc__protect; + LispObj *value, *symbol, *list, *form; + + form = ARGUMENT(0); + + /* parallel setq, first pass evaluate values and basic error checking */ + for (list = form; CONSP(list); list = CDR(list)) { + symbol = CAR(list); + CHECK_SYMBOL(symbol); + list = CDR(list); + if (!CONSP(list)) + LispDestroy("%s: odd number of arguments", STRFUN(builtin)); + value = EVAL(CAR(list)); + GC_PROTECT(value); + } + + /* second pass, assign values */ + for (; CONSP(form); form = CDDR(form)) { + symbol = CAR(form); + CHECK_CONSTANT(symbol); + LispSetVar(symbol, lisp__data.protect.objects[base++]); + } + GC_LEAVE(); + + return (NIL); +} + +LispObj * +Lisp_Setf(LispBuiltin *builtin) +/* + setf &rest form + */ +{ + LispAtom *atom; + LispObj *setf, *place, *value, *result = NIL, *data; + + LispObj *form; + + form = ARGUMENT(0); - /* copy data */ - for (i = 0; i < len; i++, from = CDR(from), to = CDR(to)) - CAR(to) = CAR(from); + for (; CONSP(form); form = CDR(form)) { + place = CAR(form); + form = CDR(form); + if (!CONSP(form)) + LispDestroy("%s: odd number of arguments", STRFUN(builtin)); + value = CAR(form); + + if (!POINTERP(place)) + goto invalid_place; + if (XSYMBOLP(place)) { + CHECK_CONSTANT(place); + result = EVAL(value); + (void)LispSetVar(place, result); + } + else if (XCONSP(place)) { + /* it really should not be required to protect any object + * evaluated here, but is done for safety in case one of + * the evaluated forms returns data not gc protected, what + * could cause surprises if the object is garbage collected + * before finishing setf. */ + GC_ENTER(); + + setf = CAR(place); + if (!SYMBOLP(setf)) + goto invalid_place; + if (!CONSP(CDR(place))) + goto invalid_place; + + value = EVAL(value); + GC_PROTECT(value); + + atom = setf->data.atom; + if (atom->a_defsetf == 0) { + if (atom->a_defstruct && + atom->property->structure.function >= 0) { + /* Use a default setf method for the structure field, as + * if this definition have been done + * (defsetf THE-STRUCT-FIELD (struct) (value) + * `(lisp::struct-store 'THE-STRUCT-FIELD ,struct ,value)) + */ + place = CDR(place); + data = CAR(place); + if (CONSP(CDR(place))) + goto invalid_place; + data = EVAL(data); + GC_PROTECT(data); + result = APPLY3(Ostruct_store, setf, data, value); + GC_LEAVE(); + continue; + } + /* Must also expand macros */ + else if (atom->a_function && + atom->property->fun.function->funtype == LispMacro) { + result = LispRunSetfMacro(atom, CDR(place), value); + continue; + } + goto invalid_place; + } + + place = CDR(place); + setf = setf->data.atom->property->setf; + if (SYMBOLP(setf)) { + LispObj *arguments, *cons; + + if (!CONSP(CDR(place))) { + arguments = EVAL(CAR(place)); + GC_PROTECT(arguments); + result = APPLY2(setf, arguments, value); + } + else if (!CONSP(CDDR(place))) { + arguments = EVAL(CAR(place)); + GC_PROTECT(arguments); + cons = EVAL(CADR(place)); + GC_PROTECT(cons); + result = APPLY3(setf, arguments, cons, value); + } + else { + arguments = cons = CONS(EVAL(CAR(place)), NIL); + GC_PROTECT(arguments); + for (place = CDR(place); CONSP(place); place = CDR(place)) { + RPLACD(cons, CONS(EVAL(CAR(place)), NIL)); + cons = CDR(cons); + } + RPLACD(cons, CONS(value, NIL)); + result = APPLY(setf, arguments); + } + } + else + result = LispRunSetf(atom->property->salist, setf, place, value); + GC_LEAVE(); + } + else + goto invalid_place; } + + return (result); +invalid_place: + LispDestroy("%s: %s is an invalid place", STRFUN(builtin), STROBJ(place)); + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +Lisp_Psetf(LispBuiltin *builtin) +/* + psetf &rest form + */ +{ + int base; + GC_ENTER(); + LispAtom *atom; + LispObj *setf, *place = NIL, *value, *data; - goto replace_done; + LispObj *form; -replace_not_integer: - LispDestroy(mac, "expecting a positive integer, at %s", fname); + form = ARGUMENT(0); -replace_out_of_range: - LispDestroy(mac, "index out of range, at %s", fname); + /* parallel setf, first pass evaluate values and basic error checking */ + base = gc__protect; + for (setf = form; CONSP(setf); setf = CDR(setf)) { + if (!POINTERP(CAR(setf))) + goto invalid_place; + setf = CDR(setf); + if (!CONSP(setf)) + LispDestroy("%s: odd number of arguments", STRFUN(builtin)); + value = EVAL(CAR(setf)); + GC_PROTECT(value); + } + + /* second pass, assign values */ + for (; CONSP(form); form = CDDR(form)) { + place = CAR(form); + value = lisp__data.protect.objects[base++]; + + if (XSYMBOLP(place)) { + CHECK_CONSTANT(place); + (void)LispSetVar(place, value); + } + else if (XCONSP(place)) { + LispObj *arguments, *cons; + int xbase = lisp__data.protect.length; + + setf = CAR(place); + if (!SYMBOLP(setf)) + goto invalid_place; + if (!CONSP(CDR(place))) + goto invalid_place; + + atom = setf->data.atom; + if (atom->a_defsetf == 0) { + if (atom->a_defstruct && + atom->property->structure.function >= 0) { + place = CDR(place); + data = CAR(place); + if (CONSP(CDR(place))) + goto invalid_place; + data = EVAL(data); + GC_PROTECT(data); + (void)APPLY3(Ostruct_store, setf, data, value); + lisp__data.protect.length = xbase; + continue; + } + else if (atom->a_function && + atom->property->fun.function->funtype == LispMacro) { + (void)LispRunSetfMacro(atom, CDR(place), value); + lisp__data.protect.length = xbase; + continue; + } + goto invalid_place; + } -replace_type_mismatch: - LispDestroy(mac, "sequences type don't match, at %s", fname); + place = CDR(place); + setf = setf->data.atom->property->setf; + if (SYMBOLP(setf)) { + if (!CONSP(CDR(place))) { + arguments = EVAL(CAR(place)); + GC_PROTECT(arguments); + (void)APPLY2(setf, arguments, value); + } + else if (!CONSP(CDDR(place))) { + arguments = EVAL(CAR(place)); + GC_PROTECT(arguments); + cons = EVAL(CADR(place)); + GC_PROTECT(cons); + (void)APPLY3(setf, arguments, cons, value); + } + else { + arguments = cons = CONS(EVAL(CAR(place)), NIL); + GC_PROTECT(arguments); + for (place = CDR(place); CONSP(place); place = CDR(place)) { + RPLACD(cons, CONS(EVAL(CAR(place)), NIL)); + cons = CDR(cons); + } + RPLACD(cons, CONS(value, NIL)); + (void)APPLY(setf, arguments); + } + lisp__data.protect.length = xbase; + } + else + (void)LispRunSetf(atom->property->salist, setf, place, value); + } + else + goto invalid_place; + } + GC_LEAVE(); -replace_done: - return (seq1); + return (NIL); +invalid_place: + LispDestroy("%s: %s is an invalid place", STRFUN(builtin), STROBJ(place)); + /*NOTREACHED*/ + return (NIL); } LispObj * -Lisp_Return(LispMac *mac, LispObj *list, char *fname) +Lisp_Sleep(LispBuiltin *builtin) +/* + sleep seconds + */ { - unsigned blevel = mac->block.block_level; + long sec, msec; + double value, dsec; - while (blevel) { - LispBlock *block = mac->block.block[--blevel]; + LispObj *seconds; - if (block->type == LispBlockClosure) - /* if reached a function call */ + seconds = ARGUMENT(0); + + value = -1.0; + switch (OBJECT_TYPE(seconds)) { + case LispFixnum_t: + value = FIXNUM_VALUE(seconds); + break; + case LispDFloat_t: + value = DFLOAT_VALUE(seconds); + break; + default: break; - if (block->type == LispBlockTag && block->tag.type == LispNil_t) { - mac->block.block_ret = list == NIL ? NIL : EVAL(CAR(list)); - LispBlockUnwind(mac); - longjmp(block->jmp, 1); + } + + if (value < 0.0 || value > MOST_POSITIVE_FIXNUM) + LispDestroy("%s: %s is not a positive fixnum", + STRFUN(builtin), STROBJ(seconds)); + + msec = modf(value, &dsec) * 1e6; + sec = dsec; + + if (sec) + sleep(sec); + if (msec) + usleep(msec); + + return (NIL); +} + +/* + * This function is called recursively, but the contents of "list2" are + * kept gc protected until it returns to LispSort. This is required partly + * because the "gc protection logic" protects an object, not the contents + * of the c pointer. + */ +static LispObj * +LispMergeSort(LispObj *list, LispObj *predicate, LispObj *key, int code) +{ + int protect; + LispObj *list1, *list2, *left, *right, *result, *cons; + + /* Check if list length is larger than 1 */ + if (!CONSP(list) || !CONSP(CDR(list))) + return (list); + + list1 = list2 = list; + for (;;) { + list = CDR(list); + if (!CONSP(list)) + break; + list = CDR(list); + if (!CONSP(list)) + break; + list2 = CDR(list2); + } + cons = list2; + list2 = CDR(list2); + RPLACD(cons, NIL); + + protect = 0; + if (lisp__data.protect.length + 2 >= lisp__data.protect.space) + LispMoreProtects(); + lisp__data.protect.objects[lisp__data.protect.length++] = list2; + list1 = LispMergeSort(list1, predicate, key, code); + list2 = LispMergeSort(list2, predicate, key, code); + + left = CAR(list1); + right = CAR(list2); + if (key != UNSPEC) { + protect = lisp__data.protect.length; + left = APPLY1(key, left); + lisp__data.protect.objects[protect] = left; + right = APPLY1(key, right); + lisp__data.protect.objects[protect + 1] = right; + } + + result = NIL; + for (;;) { + if ((FCOMPARE(predicate, left, right, code)) == 0 && + (FCOMPARE(predicate, right, left, code)) == 1) { + /* right is "smaller" */ + if (result == NIL) + result = list2; + else + RPLACD(cons, list2); + cons = list2; + list2 = CDR(list2); + if (!CONSP(list2)) { + RPLACD(cons, list1); + break; + } + right = CAR(list2); + if (key != UNSPEC) { + right = APPLY1(key, right); + lisp__data.protect.objects[protect + 1] = right; + } + } + else { + /* left is "smaller" */ + if (result == NIL) + result = list1; + else + RPLACD(cons, list1); + cons = list1; + list1 = CDR(list1); + if (!CONSP(list1)) { + RPLACD(cons, list2); + break; + } + left = CAR(list1); + if (key != UNSPEC) { + left = APPLY1(key, left); + lisp__data.protect.objects[protect] = left; + } } } - LispDestroy(mac, "no visible NIL block, at %s", fname); - /*NOTREACHED*/ + if (key != UNSPEC) + lisp__data.protect.length = protect; + + return (result); +} + +/* XXX The first version made a copy of the list and then adjusted + * the CARs of the list. To minimize GC time now it is now doing + * the sort inplace. So, instead of writing just (sort variable) + * now it is required to write (setq variable (sort variable)) + * if the variable should always keep all elements. + */ +LispObj * +Lisp_Sort(LispBuiltin *builtin) +/* + sort sequence predicate &key key + */ +{ + GC_ENTER(); + int istring, code; + long length; + char *string; + + LispObj *list, *work, *cons = NULL; + + LispObj *sequence, *predicate, *key; + + key = ARGUMENT(2); + predicate = ARGUMENT(1); + sequence = ARGUMENT(0); + + length = LispLength(sequence); + if (length < 2) + return (sequence); + + list = sequence; + istring = XSTRINGP(sequence); + if (istring) { + CHECK_STRING_WRITABLE(sequence); + /* Convert string to list */ + string = THESTR(sequence); + work = cons = CONS(SCHAR(string[0]), NIL); + GC_PROTECT(work); + for (++string; *string; ++string) { + RPLACD(cons, CONS(SCHAR(*string), NIL)); + cons = CDR(cons); + } + } + else if (ARRAYP(list)) + work = list->data.array.list; + else + work = list; + + FUNCTION_CHECK(predicate); + code = FCODE(predicate); + work = LispMergeSort(work, predicate, key, code); + + if (istring) { + /* Convert list to string */ + string = THESTR(sequence); + for (; CONSP(work); ++string, work = CDR(work)) + *string = SCHAR_VALUE(CAR(work)); + } + else if (ARRAYP(list)) + list->data.array.list = work; + else + sequence = work; + GC_LEAVE(); + + return (sequence); +} + +LispObj * +Lisp_Subseq(LispBuiltin *builtin) +/* + subseq sequence start &optional end + */ +{ + long start, end, length, seqlength; + + LispObj *sequence, *ostart, *oend, *result; + + oend = ARGUMENT(2); + ostart = ARGUMENT(1); + sequence = ARGUMENT(0); + + LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, + &start, &end, &length); + + seqlength = end - start; + + if (sequence == NIL) + result = NIL; + else if (XSTRINGP(sequence)) { + char *string = LispMalloc(seqlength + 1); + + memcpy(string, THESTR(sequence) + start, seqlength); + string[seqlength] = '\0'; + result = STRING2(string); + } + else { + GC_ENTER(); + LispObj *object; + + if (end > start) { + /* list or array */ + int count; + LispObj *cons; + + if (ARRAYP(sequence)) + object = sequence->data.array.list; + else + object = sequence; + /* goto first element to copy */ + for (count = 0; count < start; count++, object = CDR(object)) + ; + result = cons = CONS(CAR(object), NIL); + GC_PROTECT(result); + for (++count, object = CDR(object); count < end; count++, + object = CDR(object)) { + RPLACD(cons, CONS(CAR(object), NIL)); + cons = CDR(cons); + } + } + else + result = NIL; + + if (ARRAYP(sequence)) { + object = LispNew(NIL, NIL); + GC_PROTECT(object); + object->type = LispArray_t; + object->data.array.list = result; + object->data.array.dim = CONS(FIXNUM(seqlength), NIL); + object->data.array.rank = 1; + object->data.array.type = sequence->data.array.type; + object->data.array.zero = length == 0; + result = object; + } + GC_LEAVE(); + } + + return (result); +} + +LispObj * +Lisp_Subsetp(LispBuiltin *builtin) +/* + subsetp list1 list2 &key test test-not key + */ +{ + return (LispListSet(builtin, SUBSETP)); +} + + +LispObj * +Lisp_Substitute(LispBuiltin *builtin) +/* + substitute newitem olditem sequence &key from-end test test-not start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, SUBSTITUTE, NONE)); +} + +LispObj * +Lisp_SubstituteIf(LispBuiltin *builtin) +/* + substitute-if newitem test sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, SUBSTITUTE, IF)); +} + +LispObj * +Lisp_SubstituteIfNot(LispBuiltin *builtin) +/* + substitute-if-not newitem test sequence &key from-end start end count key + */ +{ + return (LispDeleteRemoveXSubstitute(builtin, SUBSTITUTE, IFNOT)); +} + +LispObj * +Lisp_Symbolp(LispBuiltin *builtin) +/* + symbolp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (SYMBOLP(object) ? T : NIL); +} + +LispObj * +Lisp_SymbolFunction(LispBuiltin *builtin) +/* + symbol-function symbol + */ +{ + LispObj *symbol; + + symbol = ARGUMENT(0); + CHECK_SYMBOL(symbol); + + return (LispSymbolFunction(symbol)); +} + +LispObj * +Lisp_SymbolName(LispBuiltin *builtin) +/* + symbol-name symbol + */ +{ + LispObj *symbol; + + symbol = ARGUMENT(0); + CHECK_SYMBOL(symbol); + + return (LispSymbolName(symbol)); +} + +LispObj * +Lisp_SymbolPackage(LispBuiltin *builtin) +/* + symbol-package symbol + */ +{ + LispObj *symbol; + + symbol = ARGUMENT(0); + CHECK_SYMBOL(symbol); + + symbol = symbol->data.atom->package; + + return (symbol ? symbol : NIL); +} + +LispObj * +Lisp_SymbolPlist(LispBuiltin *builtin) +/* + symbol-plist symbol + */ +{ + LispObj *symbol; + + symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + + return (symbol->data.atom->a_property ? + symbol->data.atom->property->properties : NIL); +} + +LispObj * +Lisp_SymbolValue(LispBuiltin *builtin) +/* + symbol-value symbol + */ +{ + LispAtom *atom; + LispObj *symbol; + + symbol = ARGUMENT(0); + + CHECK_SYMBOL(symbol); + atom = symbol->data.atom; + if (!atom->a_object || atom->property->value == UNBOUND) { + if (atom->package == lisp__data.keyword) + return (symbol); + LispDestroy("%s: the symbol %s has no value", + STRFUN(builtin), STROBJ(symbol)); + } + + return (atom->dyn ? LispGetVar(symbol) : atom->property->value); +} + +LispObj * +Lisp_Tagbody(LispBuiltin *builtin) +/* + tagbody &rest body + */ +{ + GC_ENTER(); + int stack, lex, length; + LispObj *list, *body, *ptr, *tag, *labels, *map, + **p_list, **p_body, **p_labels; + LispBlock *block; + + body = ARGUMENT(0); + + /* Save environment information */ + stack = lisp__data.stack.length; + lex = lisp__data.env.lex; + length = lisp__data.env.length; + + /* Since the body may be large, and the code may iterate several + * thousand times, it is not a bad idea to avoid checking all + * elements of the body to verify if it is a tag. */ + for (labels = map = NIL, ptr = body; CONSP(ptr); ptr = CDR(ptr)) { + tag = CAR(ptr); + switch (OBJECT_TYPE(tag)) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + /* Don't allow duplicated labels */ + for (list = labels; CONSP(list); list = CDDR(list)) { + if (CAR(list) == tag) + LispDestroy("%s: tag %s specified more than once", + STRFUN(builtin), STROBJ(tag)); + } + if (labels == NIL) { + labels = CONS(tag, CONS(NIL, NIL)); + map = CDR(labels); + GC_PROTECT(labels); + } + else { + RPLACD(map, CONS(tag, CONS(NIL, NIL))); + map = CDDR(map); + } + break; + case LispCons_t: + /* Restart point for tag */ + if (map != NIL && CAR(map) == NIL) + RPLACA(map, ptr); + break; + default: + break; + } + } + /* Check for consecutive labels without code between them */ + for (ptr = labels; CONSP(ptr); ptr = CDDR(ptr)) { + if (CADR(ptr) == NIL) { + for (map = CDDR(ptr); CONSP(map); map = CDDR(map)) { + if (CADR(map) != NIL) { + RPLACA(CDR(ptr), CADR(map)); + break; + } + } + } + } + + /* Initialize */ + list = body; + p_list = &list; + p_body = &body; + p_labels = &labels; + block = LispBeginBlock(NIL, LispBlockBody); + + /* Loop */ + if (setjmp(block->jmp) != 0) { + /* Restore environment */ + lisp__data.stack.length = stack; + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = length; + + tag = lisp__data.block.block_ret; + for (ptr = labels; CONSP(ptr); ptr = CDDR(ptr)) { + map = CAR(ptr); + if (map == tag) + break; + } + + if (!CONSP(ptr)) + LispDestroy("%s: no such tag %s", STRFUN(builtin), STROBJ(tag)); + + *p_body = CADR(ptr); + } + + /* Execute code */ + for (; CONSP(body); body = CDR(body)) { + LispObj *form = CAR(body); + + if (CONSP(form)) + EVAL(form); + } + /* If got here, (go) not called, else, labels will be candidate to gc + * when GC_LEAVE() be called by the code in the bottom of the stack. */ + GC_LEAVE(); + + /* Finished */ + LispEndBlock(block); + + /* Always return NIL */ + return (NIL); +} + +LispObj * +Lisp_The(LispBuiltin *builtin) +/* + the value-type form + */ +{ + LispObj *value_type, *form; - return (NIL); + form = ARGUMENT(1); + value_type = ARGUMENT(0); + + form = EVAL(form); + + return (LispCoerce(builtin, form, value_type)); } LispObj * -Lisp_ReturnFrom(LispMac *mac, LispObj *list, char *fname) +Lisp_Throw(LispBuiltin *builtin) +/* + throw tag result + */ { - LispObj *tag = CAR(list); - unsigned blevel = mac->block.block_level; + unsigned blevel = lisp__data.block.block_level; + + LispObj *tag, *result; + + result = ARGUMENT(1); + tag = ARGUMENT(0); - if (tag != NIL && tag != T && !SYMBOL_P(tag)) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, tag), fname); + tag = EVAL(tag); - list = CDR(list); + if (blevel == 0) + LispDestroy("%s: not within a block", STRFUN(builtin)); + while (blevel) { - int jmp = 1; - LispBlock *block = mac->block.block[--blevel]; + LispBlock *block = lisp__data.block.block[--blevel]; - if (tag->type == block->tag.type) { - switch (tag->type) { - case LispNil_t: - case LispTrue_t: - break; - case LispAtom_t: - jmp = tag->data.atom == block->tag.data.atom; - break; - default: - /* only atom, nil or t can be used */ - jmp = 0; - break; - } - } - if (block->type != LispBlockTag && block->type != LispBlockClosure) - break; - if (jmp) { - mac->block.block_ret = list == NIL ? NIL : EVAL(CAR(list)); - LispBlockUnwind(mac); - longjmp(block->jmp, 1); + if (block->type == LispBlockCatch && tag == block->tag) { + lisp__data.block.block_ret = EVAL(result); + LispBlockUnwind(block); + BLOCKJUMP(block); } - if (block->type != LispBlockTag) - /* can use return-from only in the current function */ - break; } - LispDestroy(mac, "no visible block named %s, at %s", - LispStrObj(mac, tag), fname); - /*NOTREACHED*/ + LispDestroy("%s: %s is not a valid tag", STRFUN(builtin), STROBJ(tag)); + /*NOTREACHED*/ return (NIL); } -LispObj * -Lisp_Reverse(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispTreeEqual(LispObj *left, LispObj *right, LispObj *test, int expect) { - LispObj *res; + LispObj *cmp_left, *cmp_right; - switch (CAR(list)->type) { - case LispNil_t: + if ((OBJECT_TYPE(left)) ^ (OBJECT_TYPE(right))) + return (NIL); + if (CONSP(left)) { + for (; CONSP(left) && CONSP(right); + left = CDR(left), right = CDR(right)) { + cmp_left = CAR(left); + cmp_right = CAR(right); + if ((OBJECT_TYPE(cmp_left)) ^ (OBJECT_TYPE(cmp_right))) + return (NIL); + if (CONSP(cmp_left)) { + if (LispTreeEqual(cmp_left, cmp_right, test, expect) == NIL) + return (NIL); + } + else { + if (POINTERP(cmp_left) && + (XQUOTEP(cmp_left) || XBACKQUOTEP(cmp_left))) { + cmp_left = cmp_left->data.quote; + cmp_right = cmp_right->data.quote; + } + else if (COMMAP(cmp_left)) { + cmp_left = cmp_left->data.comma.eval; + cmp_right = cmp_right->data.comma.eval; + } + if ((APPLY2(test, cmp_left, cmp_right) != NIL) != expect) + return (NIL); + } + } + if ((OBJECT_TYPE(left)) ^ (OBJECT_TYPE(right))) return (NIL); - break; - case LispCons_t: - break; - default: - LispDestroy(mac, ExpectingListAt, fname); - /*NOTREACHED*/ } - GCProtect(); - res = NIL; - list = CAR(list); - while (list->type == LispCons_t && list != NIL) { - res = CONS(CAR(list), res); - list = CDR(list); + if (POINTERP(left) && (XQUOTEP(left) || XBACKQUOTEP(left))) { + left = left->data.quote; + right = right->data.quote; + } + else if (COMMAP(left)) { + left = left->data.comma.eval; + right = right->data.comma.eval; } - GCUProtect(); - return (res); + return ((APPLY2(test, left, right) != NIL) == expect ? T : NIL); } LispObj * -Lisp_Rplaca(LispMac *mac, LispObj *list, char *fname) +Lisp_TreeEqual(LispBuiltin *builtin) +/* + tree-equal tree-1 tree-2 &key test test-not + */ { - if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "%s is not of type cons, at %s", - LispStrObj(mac, CAR(list)), fname); + int expect; + LispObj *compare; + + LispObj *tree_1, *tree_2, *test, *test_not; - CAR(CAR(list)) = CAR(CDR(list)); + test_not = ARGUMENT(3); + test = ARGUMENT(2); + tree_2 = ARGUMENT(1); + tree_1 = ARGUMENT(0); + + CHECK_TEST_0(); + if (test_not != UNSPEC) { + expect = 0; + compare = test_not; + } + else { + if (test == UNSPEC) + test = Oeql; + expect = 1; + compare = test; + } - return (CAR(list)); + return (LispTreeEqual(tree_1, tree_2, compare, expect)); } LispObj * -Lisp_Rplacd(LispMac *mac, LispObj *list, char *fname) +Lisp_Typep(LispBuiltin *builtin) +/* + typep object type + */ { - if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "%s is not of type cons, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *result = NULL; + + LispObj *object, *type; - CDR(CAR(list)) = CAR(CDR(list)); + type = ARGUMENT(1); + object = ARGUMENT(0); + + if (SYMBOLP(type)) { + Atom_id atom = ATOMID(type); + + if (OBJECT_TYPE(object) == LispStruct_t) + result = ATOMID(CAR(object->data.struc.def)) == atom ? T : NIL; + else if (type->data.atom->a_defstruct && + type->data.atom->property->structure.function == STRUCT_NAME) + result = NIL; + else if (atom == Snil) + result = object == NIL ? T : NIL; + else if (atom == St) + result = object == T ? T : NIL; + else if (atom == Satom) + result = !CONSP(object) ? T : NIL; + else if (atom == Ssymbol) + result = SYMBOLP(object) || object == NIL || object == T ? T : NIL; + else if (atom == Sinteger) + result = INTEGERP(object) ? T : NIL; + else if (atom == Srational) + result = RATIONALP(object) ? T : NIL; + else if (atom == Scons || atom == Slist) + result = CONSP(object) ? T : NIL; + else if (atom == Sstring) + result = STRINGP(object) ? T : NIL; + else if (atom == Scharacter) + result = SCHARP(object) ? T : NIL; + else if (atom == Scomplex) + result = COMPLEXP(object) ? T : NIL; + else if (atom == Svector || atom == Sarray) + result = ARRAYP(object) ? T : NIL; + else if (atom == Skeyword) + result = KEYWORDP(object) ? T : NIL; + else if (atom == Sfunction) + result = LAMBDAP(object) ? T : NIL; + else if (atom == Spathname) + result = PATHNAMEP(object) ? T : NIL; + else if (atom == Sopaque) + result = OPAQUEP(object) ? T : NIL; + } + else if (CONSP(type)) { + if (OBJECT_TYPE(object) == LispStruct_t && + SYMBOLP(CAR(type)) && ATOMID(CAR(type)) == Sstruct && + SYMBOLP(CAR(CDR(type))) && CDR(CDR(type)) == NIL) { + result = ATOMID(CAR(object->data.struc.def)) == + ATOMID(CAR(CDR(type))) ? T : NIL; + } + } + else if (type == NIL) + result = object == NIL ? T : NIL; + else if (type == T) + result = object == T ? T : NIL; + if (result == NULL) + LispDestroy("%s: bad type specification %s", + STRFUN(builtin), STROBJ(type)); - return (CAR(list)); + return (result); } LispObj * -Lisp_Set(LispMac *mac, LispObj *list, char *fname) +Lisp_Union(LispBuiltin *builtin) +/* + union list1 list2 &key test test-not key + */ { - int count; - LispObj *var, *val, *res = NIL; - /* res always set, is minimum args is 2 */ - - for (count = 0, var = list; var != NIL; count++, var = CDR(var)) - ; - if (count & 1) - LispDestroy(mac, "odd number of arguments, at %s", fname); - - for (var = CAR(list), val = CAR(CDR(list)); list != NIL; - list = CDR(CDR(list))) - res = _LispSet(mac, CAR(list), CAR(CDR(list)), fname, 0); - - return (res); + return (LispListSet(builtin, UNION)); } LispObj * -Lisp_SetQ(LispMac *mac, LispObj *list, char *fname) +Lisp_Nunion(LispBuiltin *builtin) +/* + nunion list1 list2 &key test test-not key + */ { - int count; - LispObj *var, *val, *res = NIL; - /* res always set, is minimum args is 2 */ - - for (count = 0, var = list; var != NIL; count++, var = CDR(var)) - ; - if (count & 1) - LispDestroy(mac, "odd number of arguments, at %s", fname); - - for (var = CAR(list), val = CAR(CDR(list)); list != NIL; - list = CDR(CDR(list))) - res = _LispSet(mac, CAR(list), CAR(CDR(list)), fname, 1); - - return (res); + return (LispListSet(builtin, NUNION)); } LispObj * -Lisp_Setf(LispMac *mac, LispObj *list, char *fname) +Lisp_Unless(LispBuiltin *builtin) +/* + unless test &rest body + */ { - int count; - LispAtom *atom; - LispObj *place, *setf, *res = NIL; - - for (count = 0, place = list; place != NIL; count++, place = CDR(place)) - ; - if (count & 1) - LispDestroy(mac, "odd number of arguments, at %s", fname); + LispObj *result, *test, *body; - for (place = CAR(list), list = CDR(list); - ; place = CAR(list), list = CDR(list)) { - /* if a variable, just work like setq */ - if (SYMBOL_P(place)) - res = _LispSet(mac, place, CAR(list), fname, 1); - else if (place->type == LispCons_t) { - int struc_access = 0; - - /* the default setf method for structures is generated here - * (cannot be done in EVAL as SETF is a macro), and the - * code executed is as if this definition were supplied: - * (defsetf THE-STRUCT-FIELD (struct) (value) - * `(xedit::struct-store 'THE-STRUCT-FIELD ,struct ,value)) - */ + body = ARGUMENT(1); + test = ARGUMENT(0); - setf = CAR(place); - if (!SYMBOL_P(setf) || setf->data.atom->property == NULL) - LispDestroy(mac, "%s is a invalid %s place", - LispStrObj(mac, place), fname); - - atom = setf->data.atom; + result = NIL; + test = EVAL(test); + RETURN_COUNT = 0; + if (test == NIL) { + for (; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + } - if (atom->property->defsetf == 0) { - if (atom->property->defstruct && - atom->property->structure.function >= 0) { - /* user didn't provide any special defsetf */ - setf = ATOM("XEDIT::STRUCT-STORE"); - struc_access = 1; - } - else - LispDestroy(mac, "%s is a invalid %s place", - LispStrObj(mac, place), fname); - } - else - setf = setf->data.atom->property->setf; + return (result); +} - if (SYMBOL_P(setf)) { - /* just change function call, and append value to arguments */ - LispObj *cod, *cdr, *obj, *frm = FRM; - - GCProtect(); - cod = cdr = CONS(setf, NIL); - FRM = CONS(cod, FRM); - GCUProtect(); - - if (struc_access) { - /* using builtin setf method for structure field */ - CDR(cdr) = CONS(QUOTE(CAR(place)), NIL); - cdr = CDR(cdr); - } +/* + * ext::until + */ +LispObj * +Lisp_Until(LispBuiltin *builtin) +/* + until test &rest body + */ +{ + LispObj *result, *test, *body, *prog; - for (obj = CDR(place); obj != NIL; obj = CDR(obj)) { - CDR(cdr) = CONS(CAR(obj), NIL); - cdr = CDR(cdr); - } - CDR(cdr) = CONS(CAR(list), NIL); - res = EVAL(cod); - frm = FRM; - } - else - res = LispRunSetf(mac, setf, place, CAR(list)); + body = ARGUMENT(1); + test = ARGUMENT(0); + result = NIL; + for (;;) { + if ((result = EVAL(test)) == NIL) { + for (prog = body; CONSP(prog); prog = CDR(prog)) + (void)EVAL(CAR(prog)); } else - LispDestroy(mac, "%s is not a %s place", - LispStrObj(mac, place), fname); - - if ((list = CDR(list)) == NIL) break; } - return (res); + return (result); } LispObj * -Lisp_Stringp(LispMac *mac, LispObj *list, char *fname) +Lisp_UnwindProtect(LispBuiltin *builtin) +/* + unwind-protect protect &rest cleanup + */ { - return (STRING_P(CAR(list)) ? T : NIL); -} + LispObj *result, **presult = &result; + int did_jump, *pdid_jump = &did_jump, destroyed; + LispBlock *block; -LispObj * -Lisp_Subseq(LispMac *mac, LispObj *list, char *fname) -{ - int start, end, length, sublen; - LispObj *seq, *ostart, *oend, *res; + LispObj *protect, *cleanup, **pcleanup = &cleanup; - seq = CAR(list); - if (seq != NIL && seq->type != LispCons_t && - !STRING_P(seq) && seq->type != LispArray_t) - LispDestroy(mac, "%s is not a sequence, at %s", - LispStrObj(mac, seq), fname); - length = Lisp_Length(mac, list, fname)->data.real; + cleanup = ARGUMENT(1); + protect = ARGUMENT(0); - list = CDR(list); - ostart = CAR(list); - list = CDR(list); - oend = list == NIL ? NIL : CAR(list); - if (!INDEX_P(ostart) || (oend != NIL && !INDEX_P(oend))) - LispDestroy(mac, "expecting positive integer, at %s", fname); + /* run protected code */ + *presult = NIL; + *pdid_jump = 1; + block = LispBeginBlock(NIL, LispBlockProtect); + if (setjmp(block->jmp) == 0) { + *presult = EVAL(protect); + *pdid_jump = 0; + } + LispEndBlock(block); + if (!lisp__data.destroyed && *pdid_jump) + *presult = lisp__data.block.block_ret; - start = NUMBER_VALUE(ostart); + destroyed = lisp__data.destroyed; + lisp__data.destroyed = 0; - if (oend != NIL) - end = NUMBER_VALUE(oend); - else - end = length; + /* run cleanup, unprotected code */ + if (CONSP(*pcleanup)) + for (; CONSP(cleanup); cleanup = CDR(cleanup)) + (void)EVAL(CAR(cleanup)); - if (start > end || end > length) - LispDestroy(mac, "bad index, at %s", fname); + if (destroyed) { + /* in case there is another unwind-protect */ + LispBlockUnwind(NULL); + /* if not, just return to the toplevel */ + lisp__data.destroyed = 1; + LispDestroy("."); + } - sublen = end - start; + return (result); +} - if (seq == NIL) - res = NIL; - else if (STRING_P(seq)) { - char *str = LispMalloc(mac, sublen + 1); +static LispObj * +LispValuesList(LispBuiltin *builtin, int check_list) +{ + long i, count; + LispObj *result; - strncpy(str, STRPTR(seq) + start, sublen); - str[sublen] = '\0'; - res = STRING(str); - LispFree(mac, str); - } - else { - LispObj *obj; + LispObj *list; - GCProtect(); - if (end > start) { - /* list or array */ - int count; - LispObj *cdr; + list = ARGUMENT(0); - if (seq->type == LispArray_t) - obj = seq->data.array.list; - else - obj = seq; - /* goto first element to copy */ - for (count = 0; count < start; count++, obj = CDR(obj)) - ; - res = cdr = CONS(CAR(obj), NIL); - for (++count, obj = CDR(obj); count < end; count++, obj = CDR(obj)) { - CDR(cdr) = CONS(CAR(obj), NIL); - cdr = CDR(cdr); - } - } - else - res = NIL; - - if (seq->type == LispArray_t) { - obj = LispNew(mac, res, NIL); - obj->type = LispArray_t; - obj->data.array.list = res; - obj->data.array.dim = CONS(REAL(sublen), NIL); - obj->data.array.rank = 1; - obj->data.array.type = seq->data.array.type; - obj->data.array.zero = length == 0; - res = obj; + count = LispLength(list) - 1; + + if (count >= 0) { + result = CAR(list); + if ((RETURN_CHECK(count)) != count) + LispDestroy("%s: too many values", STRFUN(builtin)); + RETURN_COUNT = count; + for (i = 0, list = CDR(list); count && CONSP(list); + count--, i++, list = CDR(list)) + RETURN(i) = CAR(list); + if (check_list) { + CHECK_LIST(list); } - GCUProtect(); } + else { + RETURN_COUNT = -1; + result = NIL; + } - return (res); + return (result); } LispObj * -Lisp_Symbolp(LispMac *mac, LispObj *list, char *fname) +Lisp_Values(LispBuiltin *builtin) +/* + values &rest objects + */ { - switch (CAR(list)->type) { - case LispNil_t: - case LispTrue_t: - case LispAtom_t: - case LispLambda_t: - return (T); - default: - return (NIL); - } - /*NOTREACHED*/ + return (LispValuesList(builtin, 0)); } LispObj * -Lisp_SymbolPlist(LispMac *mac, LispObj *list, char *fname) +Lisp_ValuesList(LispBuiltin *builtin) +/* + values-list list + */ { - LispObj *sym = CAR(list); - - if (sym == NIL || sym == T) - return (sym); - else if (!SYMBOL_P(sym)) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, sym), fname); - - return (sym->data.atom->property && sym->data.atom->property->property ? - sym->data.atom->property->properties : NIL); + return (LispValuesList(builtin, 1)); } LispObj * -Lisp_Tagbody(LispMac *mac, LispObj *list, char *fname) +Lisp_Vector(LispBuiltin *builtin) +/* + vector &rest objects + */ { - int did_jump, *pdid_jump = &did_jump, body_jump, *pbody_jump = &body_jump; - LispObj * volatile body; - LispObj *res, **pres = &res; - LispBlock *block, *body_block; - - for (body = list; body != NIL; body = CDR(body)) - if (body->type == LispCons_t) - break; - - if (body == NIL) - return (NIL); - - *pdid_jump = 1; - *pres = NIL; - block = LispBeginBlock(mac, NIL, LispBlockTag); - if (setjmp(block->jmp) == 0) { - body = list; - while (1) { - *pbody_jump = 1; - body_block = LispBeginBlock(mac, NIL, LispBlockBody); - if (setjmp(body_block->jmp) == 0) { - for (; body != NIL; body = CDR(body)) { - if (CAR(body)->type == LispCons_t) - *pres = EVAL(CAR(body)); - } - *pbody_jump = 0; - } - LispEndBlock(mac, body_block); - if (*pbody_jump) { - int found = 0; - LispObj *ptr, *tag; - - tag = mac->block.block_ret; - for (ptr = body; ptr != NIL; ptr = CDR(ptr)) { - if (CAR(ptr)->type == tag->type && - ((CAR(ptr) == NIL && tag->type == LispNil_t) || - (CAR(ptr) == T && tag->type == LispTrue_t) || - (NUMBER_P(ptr) && NUMBER_P(tag) && - NUMBER_VALUE(ptr) == NUMBER_VALUE(tag)) || - (SYMBOL_P(CAR(ptr)) && SYMBOL_P(tag) && - CAR(ptr)->data.atom == tag->data.atom))) { - found = 1; - break; - } - } - if (ptr == NIL) { - for (ptr = list; ptr != body; ptr = CDR(ptr)) { - if (CAR(ptr)->type == tag->type && - ((CAR(ptr) == NIL && tag->type == LispNil_t) || - (CAR(ptr) == T && tag->type == LispTrue_t) || - (NUMBER_P(ptr) && NUMBER_P(tag) && - NUMBER_VALUE(ptr) == NUMBER_VALUE(tag)) || - (SYMBOL_P(CAR(ptr)) && SYMBOL_P(tag) && - CAR(ptr)->data.atom == tag->data.atom))) { - found = 1; - break; - } - } - } - /* XXX no search for duplicated tags, if there are - * duplicated tags, will just search the body for the tag, - * if the end of the list is reached, search again from - * beginning. This is (I believe) allowable for an interpreter, - * but if (byte) compiled code is to be generated, duplicated - * tags must not be allowed. */ - if ((body = ptr) == NIL) - LispDestroy(mac, "no such tag %s, at %s", - LispStrObj(mac, tag), fname); - - /* search for start of code */ - for (body = CDR(body); body != NIL; body = CDR(body)) { - if (CAR(body)->type == LispCons_t) - break; - } + LispObj *objects; - /* just jumped to the bottom of the code body */ - if (body == NIL) - break; - } - else - /* 'go' not called */ - break; - *pdid_jump = 1; - } - *pdid_jump = 0; - } - LispEndBlock(mac, block); - if (*pdid_jump) - *pres = mac->block.block_ret; + objects = ARGUMENT(0); - return (*pres); + return (VECTOR(objects)); } LispObj * -Lisp_Terpri(LispMac *mac, LispObj *list, char *fname) +Lisp_When(LispBuiltin *builtin) +/* + when test &rest body + */ { - LispObj *stream = NIL; + LispObj *result, *test, *body; - if (list == NIL || CAR(list) == NIL) - stream = NIL; - else if (CAR(list)->type != LispStream_t) - LispDestroy(mac, "%s is not a stream, at %s", - LispStrObj(mac, CAR(list)), fname); - else - stream = CAR(list); - LispPrintf(mac, stream, "\n"); - mac->newline = 1; - mac->column = 0; - fflush(lisp_stdout); + body = ARGUMENT(1); + test = ARGUMENT(0); - return (NIL); + result = NIL; + test = EVAL(test); + RETURN_COUNT = 0; + if (test != NIL) { + for (; CONSP(body); body = CDR(body)) + result = EVAL(CAR(body)); + } + + return (result); } +/* + * ext::while + */ LispObj * -Lisp_Throw(LispMac *mac, LispObj *list, char *fname) +Lisp_While(LispBuiltin *builtin) +/* + while test &rest body + */ { - LispObj *tag = EVAL(CAR(list)); - unsigned blevel = mac->block.block_level; - - if (blevel == 0) - LispDestroy(mac, "%s called not within a block", fname); + LispObj *result, *test, *body, *prog; - while (blevel) { - int jmp = 1; - LispBlock *block = mac->block.block[--blevel]; + body = ARGUMENT(1); + test = ARGUMENT(0); - if (block->type == LispBlockCatch && tag->type == block->tag.type) { - switch(tag->type) { - case LispNil_t: - case LispTrue_t: - break; - case LispAtom_t: - case LispString_t: - jmp = tag->data.atom == block->tag.data.atom; - break; - case LispCharacter_t: - case LispInteger_t: - jmp = tag->data.integer == block->tag.data.integer; - break; - case LispReal_t: - jmp = tag->data.real == block->tag.data.real; - break; - default: - jmp = memcmp(tag, &(block->tag), sizeof(LispObj)) == 0; - break; - } - if (jmp) { - mac->block.block_ret = EVAL(CAR(CDR(list))); - LispBlockUnwind(mac); - longjmp(block->jmp, 1); - } + result = NIL; + for (;;) { + if (EVAL(test) != NIL) { + for (prog = body; CONSP(prog); prog = CDR(prog)) + (void)EVAL(CAR(prog)); } + else + break; } - LispDestroy(mac, "%s is not a tag to %s", LispStrObj(mac, tag), fname); - /*NOTREACHED*/ return (NIL); } +/* + * ext::unsetenv + */ LispObj * -Lisp_Typep(LispMac *mac, LispObj *list, char *fname) +Lisp_Unsetenv(LispBuiltin *builtin) +/* + unsetenv name + */ { - LispType type = LispStruct_t; - LispObj *obj; - char *atom = NULL; + char *name; - obj = CAR(CDR(list)); - if (obj == NIL || obj == T) - return (obj); - else if (!SYMBOL_P(obj)) - LispDestroy(mac, "%s is a bad type specification, at %s", - LispStrObj(mac, obj), fname); - else { - atom = STRPTR(obj); - if (strcmp(atom, "ATOM") == 0) - type = LispAtom_t; - else if (strcmp(atom, "REAL") == 0) - type = LispReal_t; - else if (strcmp(atom, "LIST") == 0) - type = LispCons_t; - else if (strcmp(atom, "STRING") == 0) - type = LispString_t; - else if (strcmp(atom, "OPAQUE") == 0) - type = LispOpaque_t; - } + LispObj *oname; - obj = CAR(list); - if (type != LispStruct_t && obj->type == type) - return (T); - else if (obj->type == LispStruct_t) - return (STRPTR(CAR(obj->data.struc.def)) == atom ? T : NIL); + oname = ARGUMENT(0); + + CHECK_STRING(oname); + name = THESTR(oname); + + unsetenv(name); return (NIL); } LispObj * -Lisp_Unless(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditEltStore(LispBuiltin *builtin) +/* + lisp::elt-store sequence index value + */ { - return (_LispWhenUnless(mac, list, 0)); -} + int length, offset; -LispObj * -Lisp_UnwindProtect(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *prot = CAR(list), *res, **pres = &res; - int did_jump, *pdid_jump = &did_jump; - LispBlock *block; + LispObj *sequence, *oindex, *value; - /* run protected code */ - *pres = NIL; - *pdid_jump = 1; - block = LispBeginBlock(mac, NIL, LispBlockProtect); - if (setjmp(block->jmp) == 0) { - *pres = EVAL(prot); - *pdid_jump = 0; + value = ARGUMENT(2); + oindex = ARGUMENT(1); + sequence = ARGUMENT(0); + + CHECK_INDEX(oindex); + offset = FIXNUM_VALUE(oindex); + length = LispLength(sequence); + + if (offset >= length) + LispDestroy("%s: index %d too large for sequence length %d", + STRFUN(builtin), offset, length); + + if (STRINGP(sequence)) { + int ch; + + CHECK_STRING_WRITABLE(sequence); + CHECK_SCHAR(value); + ch = SCHAR_VALUE(value); + if (ch < 0 || ch > 255) + LispDestroy("%s: cannot represent character %d", + STRFUN(builtin), ch); + THESTR(sequence)[offset] = ch; } - LispEndBlock(mac, block); - if (!mac->destroyed && *pdid_jump) - *pres = mac->block.block_ret; + else { + if (ARRAYP(sequence)) + sequence = sequence->data.array.list; - /* run cleanup, unprotected code */ - if (CDR(list) != NIL) - res = Lisp_Progn(mac, CDR(list), fname); - else if (mac->destroyed) - /* no cleanup code */ - LispDestroy(mac, NULL); /* special handling if mac->destroyed */ + for (; offset > 0; offset--, sequence = CDR(sequence)) + ; + RPLACA(sequence, value); + } - return (res); + return (value); } LispObj * -Lisp_Vector(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditPut(LispBuiltin *builtin) +/* + lisp::put symbol indicator value + */ { - int count; - LispObj *dim, *ary = list, *obj; + LispObj *symbol, *indicator, *value; - for (count = 0; list != NIL; count++, list = CDR(list)) - ; - dim = CONS(REAL((double)count), NIL); + value = ARGUMENT(2); + indicator = ARGUMENT(1); + symbol = ARGUMENT(0); - obj = LispNew(mac, ary, dim); /* no need to gc protect, as dim is argument*/ - obj->type = LispArray_t; - obj->data.array.list = ary; - obj->data.array.dim = dim; - obj->data.array.rank = 1; - obj->data.array.type = LispTrue_t; - obj->data.array.zero = count == 0; + CHECK_SYMBOL(symbol); - return (obj); + return (CAR(LispPutAtomProperty(symbol->data.atom, indicator, value))); } LispObj * -Lisp_When(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditSetSymbolPlist(LispBuiltin *builtin) +/* + lisp::set-symbol-plist symbol list + */ { - return (_LispWhenUnless(mac, list, 1)); -} + LispObj *symbol, *list; -LispObj * -Lisp_Until(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispWhileUntil(mac, list, 0)); -} + list = ARGUMENT(1); + symbol = ARGUMENT(0); -LispObj * -Lisp_While(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispWhileUntil(mac, list, 1)); + CHECK_SYMBOL(symbol); + + return (LispReplaceAtomPropertyList(symbol->data.atom, list)); } -/* helper functions for setf - * DONT explicitly call these functions. Non standard functions - */ LispObj * -Lisp_XeditEltStore(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditVectorStore(LispBuiltin *builtin) +/* + lisp::vector-store array &rest values + */ { - int len, pos; - LispObj *seq, *opos, *value; - - seq = CAR(list); - /* if not a sequence, Lisp_Length will see it */ - len = Lisp_Length(mac, list, fname)->data.real; - - list = CDR(list); - opos = CAR(list); - if (!INDEX_P(opos) || NUMBER_VALUE(opos) >= len) - LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, opos), fname); - pos = NUMBER_VALUE(opos); - - list = CDR(list); - value = CAR(list); - if (STRING_P(seq)) { - int c; - char *string; + LispObj *value, *list, *object; + long rank, count, sequence, offset, accum; - if (value->type != LispCharacter_t) - LispDestroy(mac, "%s is not a character, at %s", - LispStrObj(mac, value), fname); + LispObj *array, *values; - c = value->data.integer; - if (c < 0 || c > 255) - LispDestroy(mac, "cannot represent character %d, at %s", c, fname); + values = ARGUMENT(1); + array = ARGUMENT(0); - string = LispStrdup(mac, STRPTR(seq)); - string[pos] = c; - - seq->data.atom = LispDoGetAtom(mac, string, 0, 0); - LispFree(mac, string); + /* check for errors */ + for (rank = 0, list = values; + CONSP(list) && CONSP(CDR(list)); + list = CDR(list), rank++) { + CHECK_INDEX(CAR(values)); } - else { - if (seq->type == LispArray_t) - seq = seq->data.array.list; + + if (rank == 0) + LispDestroy("%s: too few subscripts", STRFUN(builtin)); + value = CAR(list); - for (; pos > 0; pos--, seq = CDR(seq)) + if (STRINGP(array) && rank == 1) { + long ch; + long length = STRLEN(array); + long offset = FIXNUM_VALUE(CAR(values)); + + CHECK_SCHAR(value); + CHECK_STRING_WRITABLE(array); + ch = SCHAR_VALUE(value); + if (offset >= length) + LispDestroy("%s: index %ld too large for sequence length %ld", + STRFUN(builtin), offset, length); + + if (ch < 0 || ch > 255) + LispDestroy("%s: cannot represent character %ld", + STRFUN(builtin), ch); + THESTR(array)[offset] = ch; + + return (value); + } + + CHECK_ARRAY(array); + if (rank != array->data.array.rank) + LispDestroy("%s: too %s subscripts", STRFUN(builtin), + rank < array->data.array.rank ? "few" : "many"); + + for (list = values, object = array->data.array.dim; + CONSP(CDR(list)); + list = CDR(list), object = CDR(object)) { + if (FIXNUM_VALUE(CAR(list)) >= FIXNUM_VALUE(CAR(object))) + LispDestroy("%s: %ld is out of range, index %ld", + STRFUN(builtin), + FIXNUM_VALUE(CAR(list)), + FIXNUM_VALUE(CAR(object))); + } + + for (count = sequence = 0, list = values; + CONSP(CDR(list)); + list = CDR(list), sequence++) { + for (offset = 0, object = array->data.array.dim; + offset < sequence; object = CDR(object), offset++) ; - CAR(seq) = value; + for (accum = 1, object = CDR(object); CONSP(object); + object = CDR(object)) + accum *= FIXNUM_VALUE(CAR(object)); + count += accum * FIXNUM_VALUE(CAR(list)); } - return (value); -} - -LispObj * -Lisp_XeditPut(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *sym, *key, *val; + for (array = array->data.array.list; count > 0; array = CDR(array), count--) + ; - if ((sym = CAR(list))->type != LispAtom_t) - LispDestroy(mac, "expecting symbol, at %s", fname); - list = CDR(list); - key = CAR(list); - list = CDR(list); - val = CAR(list); + RPLACA(array, value); - return (CAR(LispPutAtomProperty(mac, sym->data.atom, key, val))); + return (value); } LispObj * -Lisp_XeditVectorStore(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditDocumentationStore(LispBuiltin *builtin) +/* + lisp::documentation-store symbol type string + */ { - long c, count, idx, seq; - LispObj *ary = CAR(list), *dim = CDR(list), *obj; - - if (ary->type != LispArray_t) - LispDestroy(mac, "%s is not an array, at %s", - LispStrObj(mac, ary), fname); - - for (count = 0, list = dim, obj = ary->data.array.dim; CDR(list) != NIL; - count++, list = CDR(list), obj = CDR(obj)) { - if (count >= ary->data.array.rank) - LispDestroy(mac, "too many subscripts %s, at %s", - LispStrObj(mac, dim), fname); - if (!INDEX_P(CAR(list)) || - NUMBER_VALUE(CAR(list)) >= NUMBER_VALUE(CAR(obj))) - LispDestroy(mac, "%s is out of range or a bad index, at %s", - LispStrObj(mac, CAR(list)), fname); - } - if (count < ary->data.array.rank) - LispDestroy(mac, "too few subscripts %s, at %s", - LispStrObj(mac, dim), fname); - - for (count = seq = 0, list = dim; CDR(list) != NIL; - list = CDR(list), seq++) { - for (idx = 0, obj = ary->data.array.dim; idx < seq; obj = CDR(obj), ++idx) - ; - for (c = 1, obj = CDR(obj); obj != NIL; obj = CDR(obj)) - c *= NUMBER_VALUE(CAR(obj)); - count += c * NUMBER_VALUE(CAR(list)); - } + LispDocType_t doc_type; - for (ary = ary->data.array.list; count > 0; ary = CDR(ary), count--) - ; + LispObj *symbol, *type, *string; - CAR(ary) = CAR(list); + string = ARGUMENT(2); + type = ARGUMENT(1); + symbol = ARGUMENT(0); - return (CAR(list)); -} + CHECK_SYMBOL(symbol); -LispObj * -Lisp_Zerop(LispMac *mac, LispObj *list, char *fname) -{ - LispObj *obj = CAR(list); + /* type is checked in LispDocumentationType() */ + doc_type = LispDocumentationType(builtin, type); - if (!NUMBER_P(obj)) - LispDestroy(mac, "expecting number, at %s", fname); + if (string == NIL) + /* allow explicitly releasing memory used for documentation */ + LispRemDocumentation(symbol, doc_type); + else { + CHECK_STRING(string); + LispAddDocumentation(symbol, string, doc_type); + } - return (NUMBER_VALUE(obj) == 0 ? T : NIL); + return (string); } Index: xc/programs/xedit/lisp/core.h diff -u xc/programs/xedit/lisp/core.h:1.7 xc/programs/xedit/lisp/core.h:1.35 --- xc/programs/xedit/lisp/core.h:1.7 Fri Oct 19 20:19:34 2001 +++ xc/programs/xedit/lisp/core.h Thu Dec 19 23:32:46 2002 @@ -27,122 +27,195 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/core.h,v 1.7 2001/10/20 00:19:34 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/core.h,v 1.35 2002/12/20 04:32:46 paulo Exp $ */ #ifndef Lisp_core_h #define Lisp_core_h #include "internal.h" -LispObj *Lisp_Mul(LispMac*, LispObj*, char*); /* * */ -LispObj *Lisp_Plus(LispMac*, LispObj*, char*); /* + */ -LispObj *Lisp_Minus(LispMac*, LispObj*, char*); /* - */ -LispObj *Lisp_Div(LispMac*, LispObj*, char*); /* / */ -LispObj *Lisp_OnePlus(LispMac*, LispObj*, char*); /* 1+ */ -LispObj *Lisp_OneMinus(LispMac*, LispObj*, char*); /* 1- */ -LispObj *Lisp_Less(LispMac*, LispObj*, char*); /* < */ -LispObj *Lisp_LessEqual(LispMac*, LispObj*, char*); /* <= */ -LispObj *Lisp_Equal_(LispMac*, LispObj*, char*); /* = */ -LispObj *Lisp_Greater(LispMac*, LispObj*, char*); /* > */ -LispObj *Lisp_GreaterEqual(LispMac*, LispObj*, char*); /* >= */ -LispObj *Lisp_NotEqual(LispMac*, LispObj*, char*); /* /= */ -LispObj *Lisp_Aref(LispMac*, LispObj*, char*); /* aref */ -LispObj *Lisp_Assoc(LispMac*, LispObj*, char*); /* assoc */ -LispObj *Lisp_And(LispMac*, LispObj*, char*); /* and */ -LispObj *Lisp_Append(LispMac*, LispObj*, char*); /* append */ -LispObj *Lisp_Apply(LispMac*, LispObj*, char*); /* apply */ -LispObj *Lisp_Atom(LispMac*, LispObj*, char*); /* attom */ -LispObj *Lisp_Block(LispMac*, LispObj*, char*); /* block */ -LispObj *Lisp_Butlast(LispMac*, LispObj*, char*); /* butlast */ -LispObj *Lisp_Car(LispMac*, LispObj*, char*); /* car */ -LispObj *Lisp_Case(LispMac*, LispObj*, char*); /* case */ -LispObj *Lisp_Catch(LispMac*, LispObj*, char*); /* catch */ -LispObj *Lisp_Cdr(LispMac*, LispObj*, char*); /* cdr */ -LispObj *Lisp_Coerce(LispMac*, LispObj*, char*); /* coerce */ -LispObj *Lisp_Cond(LispMac*, LispObj*, char*); /* cond */ -LispObj *Lisp_Cons(LispMac*, LispObj*, char*); /* cons */ -LispObj *Lisp_Decf(LispMac*, LispObj*, char*); /* decf */ -LispObj *Lisp_Defmacro(LispMac*, LispObj*, char*); /* defmacro */ -LispObj *Lisp_Defun(LispMac*, LispObj*, char*); /* defun */ -LispObj *Lisp_Defsetf(LispMac*, LispObj*, char*); /* defsetf */ -LispObj *Lisp_Do(LispMac*, LispObj*, char*); /* do */ -LispObj *Lisp_DoP(LispMac*, LispObj*, char*); /* do* */ -LispObj *Lisp_DoList(LispMac*, LispObj*, char*); /* dolist */ -LispObj *Lisp_DoTimes(LispMac*, LispObj*, char*); /* dotimes */ -LispObj *Lisp_Elt(LispMac*, LispObj*, char*); /* elt */ -LispObj *Lisp_Equal(LispMac*, LispObj*, char*); /* equal */ -LispObj *Lisp_Error(LispMac*, LispObj*, char*); /* error */ -LispObj *Lisp_Eval(LispMac*, LispObj*, char*); /* eval */ -LispObj *Lisp_Evenp(LispMac*, LispObj*, char*); /* evenp */ -LispObj *Lisp_FMakunbound(LispMac*, LispObj*, char*); /* fmakunbound */ -LispObj *Lisp_Funcall(LispMac*, LispObj*, char*); /* funcall */ -LispObj *Lisp_Gc(LispMac*, LispObj*, char*); /* gc */ -LispObj *Lisp_Get(LispMac*, LispObj*, char*); /* get */ -LispObj *Lisp_Go(LispMac*, LispObj*, char*); /* go */ -LispObj *Lisp_If(LispMac*, LispObj*, char*); /* if */ -LispObj *Lisp_Incf(LispMac*, LispObj*, char*); /* incf */ -LispObj *Lisp_Integerp(LispMac*, LispObj*, char*); /* integerp */ -LispObj *Lisp_Lambda(LispMac*, LispObj*, char*); /* lambda */ -LispObj *Lisp_Last(LispMac*, LispObj*, char*); /* last */ -LispObj *Lisp_Length(LispMac*, LispObj*, char*); /* length */ -LispObj *Lisp_Let(LispMac*, LispObj*, char*); /* let */ -LispObj *Lisp_LetP(LispMac*, LispObj*, char*); /* let* */ -LispObj *Lisp_List(LispMac*, LispObj*, char*); /* list */ -LispObj *Lisp_ListP(LispMac*, LispObj*, char*); /* list* */ -LispObj *Lisp_Listp(LispMac*, LispObj*, char*); /* listp */ -LispObj *Lisp_Loop(LispMac*, LispObj*, char*); /* loop */ -LispObj *Lisp_Makearray(LispMac*, LispObj*, char*); /* make-array */ -LispObj *Lisp_Makelist(LispMac*, LispObj*, char*); /* make-list */ -LispObj *Lisp_Makunbound(LispMac*, LispObj*, char*); /* makunbound */ -LispObj *Lisp_Mapcar(LispMac*, LispObj*, char*); /* mapcar */ -LispObj *Lisp_Max(LispMac*, LispObj*, char*); /* max */ -LispObj *Lisp_Member(LispMac*, LispObj*, char*); /* member */ -LispObj *Lisp_Min(LispMac*, LispObj*, char*); /* min */ -LispObj *Lisp_Minusp(LispMac*, LispObj*, char*); /* minusp */ -LispObj *Lisp_Nth(LispMac*, LispObj*, char*); /* nth */ -LispObj *Lisp_Nthcdr(LispMac*, LispObj*, char*); /* nthcdr */ -LispObj *Lisp_Null(LispMac*, LispObj*, char*); /* null */ -LispObj *Lisp_Numberp(LispMac*, LispObj*, char*); /* numberp */ -LispObj *Lisp_Oddp(LispMac*, LispObj*, char*); /* oddp */ -LispObj *Lisp_Or(LispMac*, LispObj*, char*); /* or */ -LispObj *Lisp_Plusp(LispMac*, LispObj*, char*); /* plusp */ -LispObj *Lisp_Prin1(LispMac*, LispObj*, char*); /* prin1 */ -LispObj *Lisp_Princ(LispMac*, LispObj*, char*); /* princ */ -LispObj *Lisp_Print(LispMac*, LispObj*, char*); /* print */ -LispObj *Lisp_Prog1(LispMac*, LispObj*, char*); /* prog1 */ -LispObj *Lisp_Prog2(LispMac*, LispObj*, char*); /* prog2 */ -LispObj *Lisp_Progn(LispMac*, LispObj*, char*); /* progn */ -LispObj *Lisp_Progv(LispMac*, LispObj*, char*); /* progv */ -LispObj *Lisp_Provide(LispMac*, LispObj*, char*); /* provide */ -LispObj *Lisp_Quit(LispMac*, LispObj*, char*); /* quit */ -LispObj *Lisp_Quote(LispMac*, LispObj*, char*); /* quote */ -LispObj *Lisp_Read(LispMac*, LispObj*, char*); /* read */ -LispObj *Lisp_Replace(LispMac*, LispObj*, char*); /* replace */ -LispObj *Lisp_Return(LispMac*, LispObj*, char*); /* return */ -LispObj *Lisp_ReturnFrom(LispMac*, LispObj*, char*); /* return-from */ -LispObj *Lisp_Reverse(LispMac*, LispObj*, char*); /* reverse */ -LispObj *Lisp_Rplaca(LispMac*, LispObj*, char*); /* rplaca */ -LispObj *Lisp_Rplacd(LispMac*, LispObj*, char*); /* rplaca */ -LispObj *Lisp_Set(LispMac*, LispObj*, char*); /* set */ -LispObj *Lisp_Setf(LispMac*, LispObj*, char*); /* setf */ -LispObj *Lisp_SetQ(LispMac*, LispObj*, char*); /* setq */ -LispObj *Lisp_Stringp(LispMac*, LispObj*, char*); /* stringp */ -LispObj *Lisp_Subseq(LispMac*, LispObj*, char*); /* subseq */ -LispObj *Lisp_Symbolp(LispMac*, LispObj*, char*); /* symbolp */ -LispObj *Lisp_SymbolPlist(LispMac*, LispObj*, char*); /* symbol-plist */ -LispObj *Lisp_Tagbody(LispMac*, LispObj*, char*); /* tagbody */ -LispObj *Lisp_Terpri(LispMac*, LispObj*, char*); /* terpri */ -LispObj *Lisp_Throw(LispMac*, LispObj*, char*); /* throw */ -LispObj *Lisp_Typep(LispMac*, LispObj*, char*); /* typep */ -LispObj *Lisp_Unless(LispMac*, LispObj*, char*); /* unless */ -LispObj *Lisp_Until(LispMac*, LispObj*, char*); /* until */ -LispObj *Lisp_UnwindProtect(LispMac*, LispObj*, char*); /* unwind-protect */ -LispObj *Lisp_Vector(LispMac*, LispObj*, char*); /* vector */ -LispObj *Lisp_When(LispMac*, LispObj*, char*); /* when */ -LispObj *Lisp_While(LispMac*, LispObj*, char*); /* while */ -LispObj *Lisp_XeditEltStore(LispMac*, LispObj*, char*); /* xedit::elt-store */ -LispObj *Lisp_XeditPut(LispMac*, LispObj*, char*); /* xedit::put */ -LispObj *Lisp_XeditVectorStore(LispMac*, LispObj*, char*); /* xedit::vector-store */ -LispObj *Lisp_Zerop(LispMac*, LispObj*, char*); /* zerop */ +void LispCoreInit(void); -#endif /* Lisp_core_h */ +LispObj *Lisp_Acons(LispBuiltin*); +LispObj *Lisp_Adjoin(LispBuiltin*); +LispObj *Lisp_Append(LispBuiltin*); +LispObj *Lisp_And(LispBuiltin*); +LispObj *Lisp_Aref(LispBuiltin*); +LispObj *Lisp_Assoc(LispBuiltin*); +LispObj *Lisp_AssocIf(LispBuiltin*); +LispObj *Lisp_AssocIfNot(LispBuiltin*); +LispObj *Lisp_Apply(LispBuiltin*); +LispObj *Lisp_Atom(LispBuiltin*); +LispObj *Lisp_Block(LispBuiltin*); +LispObj *Lisp_Boundp(LispBuiltin*); +LispObj *Lisp_Butlast(LispBuiltin*); +LispObj *Lisp_Nbutlast(LispBuiltin*); +LispObj *Lisp_Car(LispBuiltin*); +LispObj *Lisp_Case(LispBuiltin*); +LispObj *Lisp_Catch(LispBuiltin*); +LispObj *Lisp_Cdr(LispBuiltin*); +LispObj *Lisp_C_r(LispBuiltin*); +LispObj *Lisp_Coerce(LispBuiltin*); +LispObj *Lisp_Cond(LispBuiltin*); +LispObj *Lisp_Cons(LispBuiltin*); +LispObj *Lisp_Consp(LispBuiltin*); +LispObj *Lisp_Constantp(LispBuiltin*); +LispObj *Lisp_CopyAlist(LispBuiltin*); +LispObj *Lisp_CopyList(LispBuiltin*); +LispObj *Lisp_CopyTree(LispBuiltin*); +LispObj *Lisp_Defconstant(LispBuiltin*); +LispObj *Lisp_Defmacro(LispBuiltin*); +LispObj *Lisp_Defun(LispBuiltin*); +LispObj *Lisp_Defsetf(LispBuiltin*); +LispObj *Lisp_Defparameter(LispBuiltin*); +LispObj *Lisp_Defvar(LispBuiltin*); +LispObj *Lisp_Delete(LispBuiltin*); +LispObj *Lisp_DeleteDuplicates(LispBuiltin*); +LispObj *Lisp_DeleteIf(LispBuiltin*); +LispObj *Lisp_DeleteIfNot(LispBuiltin*); +LispObj *Lisp_Do(LispBuiltin*); +LispObj *Lisp_DoP(LispBuiltin*); +LispObj *Lisp_Documentation(LispBuiltin*); +LispObj *Lisp_DoList(LispBuiltin*); +LispObj *Lisp_DoTimes(LispBuiltin*); +LispObj *Lisp_Elt(LispBuiltin*); +LispObj *Lisp_Endp(LispBuiltin*); +LispObj *Lisp_Eq(LispBuiltin*); +LispObj *Lisp_Eql(LispBuiltin*); +LispObj *Lisp_Equal(LispBuiltin*); +LispObj *Lisp_Equalp(LispBuiltin*); +LispObj *Lisp_Error(LispBuiltin*); +LispObj *Lisp_Eval(LispBuiltin*); +LispObj *Lisp_Every(LispBuiltin*); +LispObj *Lisp_Some(LispBuiltin*); +LispObj *Lisp_Notevery(LispBuiltin*); +LispObj *Lisp_Notany(LispBuiltin*); +LispObj *Lisp_Fboundp(LispBuiltin*); +LispObj *Lisp_Find(LispBuiltin*); +LispObj *Lisp_FindIf(LispBuiltin*); +LispObj *Lisp_FindIfNot(LispBuiltin*); +LispObj *Lisp_Fill(LispBuiltin*); +LispObj *Lisp_Fmakunbound(LispBuiltin*); +LispObj *Lisp_Functionp(LispBuiltin*); +LispObj *Lisp_Funcall(LispBuiltin*); +LispObj *Lisp_Gc(LispBuiltin*); +LispObj *Lisp_Gensym(LispBuiltin*); +LispObj *Lisp_Get(LispBuiltin*); +LispObj *Lisp_Getenv(LispBuiltin*); +LispObj *Lisp_Go(LispBuiltin*); +LispObj *Lisp_If(LispBuiltin*); +LispObj *Lisp_IgnoreErrors(LispBuiltin*); +LispObj *Lisp_Intersection(LispBuiltin*); +LispObj *Lisp_Nintersection(LispBuiltin*); +LispObj *Lisp_Keywordp(LispBuiltin*); +LispObj *Lisp_Lambda(LispBuiltin*); +LispObj *Lisp_Last(LispBuiltin*); +LispObj *Lisp_Let(LispBuiltin*); +LispObj *Lisp_Length(LispBuiltin*); +LispObj *Lisp_LetP(LispBuiltin*); +LispObj *Lisp_List(LispBuiltin*); +LispObj *Lisp_ListLength(LispBuiltin*); +LispObj *Lisp_ListP(LispBuiltin*); +LispObj *Lisp_Listp(LispBuiltin*); +LispObj *Lisp_Loop(LispBuiltin*); +LispObj *Lisp_MakeArray(LispBuiltin*); +LispObj *Lisp_MakeList(LispBuiltin*); +LispObj *Lisp_MakeSymbol(LispBuiltin*); +LispObj *Lisp_Makunbound(LispBuiltin*); +LispObj *Lisp_Mapc(LispBuiltin*); +LispObj *Lisp_Mapcar(LispBuiltin*); +LispObj *Lisp_Mapcan(LispBuiltin*); +LispObj *Lisp_Mapl(LispBuiltin*); +LispObj *Lisp_Maplist(LispBuiltin*); +LispObj *Lisp_Mapcon(LispBuiltin*); +LispObj *Lisp_Member(LispBuiltin*); +LispObj *Lisp_MemberIf(LispBuiltin*); +LispObj *Lisp_MemberIfNot(LispBuiltin*); +LispObj *Lisp_MultipleValueBind(LispBuiltin*); +LispObj *Lisp_MultipleValueCall(LispBuiltin*); +LispObj *Lisp_MultipleValueProg1(LispBuiltin*); +LispObj *Lisp_MultipleValueList(LispBuiltin*); +LispObj *Lisp_MultipleValueSetq(LispBuiltin*); +LispObj *Lisp_Nconc(LispBuiltin*); +LispObj *Lisp_Nreverse(LispBuiltin*); +LispObj *Lisp_NsetDifference(LispBuiltin*); +LispObj *Lisp_Nsubstitute(LispBuiltin*); +LispObj *Lisp_NsubstituteIf(LispBuiltin*); +LispObj *Lisp_NsubstituteIfNot(LispBuiltin*); +LispObj *Lisp_Nth(LispBuiltin*); +LispObj *Lisp_Nthcdr(LispBuiltin*); +LispObj *Lisp_NthValue(LispBuiltin*); +LispObj *Lisp_Null(LispBuiltin*); +LispObj *Lisp_Or(LispBuiltin*); +LispObj *Lisp_Pairlis(LispBuiltin*); +LispObj *Lisp_Pop(LispBuiltin*); +LispObj *Lisp_Position(LispBuiltin*); +LispObj *Lisp_PositionIf(LispBuiltin*); +LispObj *Lisp_PositionIfNot(LispBuiltin*); +LispObj *Lisp_Proclaim(LispBuiltin*); +LispObj *Lisp_Prog1(LispBuiltin*); +LispObj *Lisp_Prog2(LispBuiltin*); +LispObj *Lisp_Progn(LispBuiltin*); +LispObj *Lisp_Progv(LispBuiltin*); +LispObj *Lisp_Provide(LispBuiltin*); +LispObj *Lisp_Push(LispBuiltin*); +LispObj *Lisp_Pushnew(LispBuiltin*); +LispObj *Lisp_Quit(LispBuiltin*); +LispObj *Lisp_Quote(LispBuiltin*); +LispObj *Lisp_Remove(LispBuiltin*); +LispObj *Lisp_RemoveDuplicates(LispBuiltin*); +LispObj *Lisp_RemoveIf(LispBuiltin*); +LispObj *Lisp_RemoveIfNot(LispBuiltin*); +LispObj *Lisp_Remprop(LispBuiltin*); +LispObj *Lisp_Replace(LispBuiltin*); +LispObj *Lisp_Return(LispBuiltin*); +LispObj *Lisp_ReturnFrom(LispBuiltin*); +LispObj *Lisp_Reverse(LispBuiltin*); +LispObj *Lisp_Rplaca(LispBuiltin*); +LispObj *Lisp_Rplacd(LispBuiltin*); +LispObj *Lisp_Search(LispBuiltin*); +LispObj *Lisp_Setenv(LispBuiltin*); +LispObj *Lisp_Set(LispBuiltin*); +LispObj *Lisp_SetDifference(LispBuiltin*); +LispObj *Lisp_SetExclusiveOr(LispBuiltin*); +LispObj *Lisp_NsetExclusiveOr(LispBuiltin*); +LispObj *Lisp_Setf(LispBuiltin*); +LispObj *Lisp_Psetf(LispBuiltin*); +LispObj *Lisp_SetQ(LispBuiltin*); +LispObj *Lisp_Psetq(LispBuiltin*); +LispObj *Lisp_Sleep(LispBuiltin*); +LispObj *Lisp_Sort(LispBuiltin*); +LispObj *Lisp_Subseq(LispBuiltin*); +LispObj *Lisp_Subsetp(LispBuiltin*); +LispObj *Lisp_Substitute(LispBuiltin*); +LispObj *Lisp_SubstituteIf(LispBuiltin*); +LispObj *Lisp_SubstituteIfNot(LispBuiltin*); +LispObj *Lisp_Symbolp(LispBuiltin*); +LispObj *Lisp_SymbolFunction(LispBuiltin*); +LispObj *Lisp_SymbolName(LispBuiltin*); +LispObj *Lisp_SymbolPackage(LispBuiltin*); +LispObj *Lisp_SymbolPlist(LispBuiltin*); +LispObj *Lisp_SymbolValue(LispBuiltin*); +LispObj *Lisp_Tagbody(LispBuiltin*); +LispObj *Lisp_Throw(LispBuiltin*); +LispObj *Lisp_The(LispBuiltin*); +LispObj *Lisp_TreeEqual(LispBuiltin*); +LispObj *Lisp_Typep(LispBuiltin*); +LispObj *Lisp_Union(LispBuiltin*); +LispObj *Lisp_Nunion(LispBuiltin*); +LispObj *Lisp_Unless(LispBuiltin*); +LispObj *Lisp_Until(LispBuiltin*); +LispObj *Lisp_Unsetenv(LispBuiltin*); +LispObj *Lisp_UnwindProtect(LispBuiltin*); +LispObj *Lisp_Values(LispBuiltin*); +LispObj *Lisp_ValuesList(LispBuiltin*); +LispObj *Lisp_Vector(LispBuiltin*); +LispObj *Lisp_When(LispBuiltin*); +LispObj *Lisp_While(LispBuiltin*); +LispObj *Lisp_XeditEltStore(LispBuiltin*); +LispObj *Lisp_XeditPut(LispBuiltin*); +LispObj *Lisp_XeditSetSymbolPlist(LispBuiltin*); +LispObj *Lisp_XeditVectorStore(LispBuiltin*); +LispObj *Lisp_XeditDocumentationStore(LispBuiltin*); + +#endif Index: xc/programs/xedit/lisp/debugger.c diff -u xc/programs/xedit/lisp/debugger.c:1.11 xc/programs/xedit/lisp/debugger.c:1.24 --- xc/programs/xedit/lisp/debugger.c:1.11 Sat Oct 27 23:34:29 2001 +++ xc/programs/xedit/lisp/debugger.c Tue Nov 12 01:05:07 2002 @@ -27,11 +27,14 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/debugger.c,v 1.11 2001/10/28 03:34:29 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/debugger.c,v 1.24 2002/11/12 06:05:07 paulo Exp $ */ #include <ctype.h> +#include "io.h" #include "debugger.h" +#include "write.h" +#ifdef DEBUGGER #define DebuggerHelp 0 #define DebuggerAbort 1 #define DebuggerBacktrace 2 @@ -39,16 +42,14 @@ #define DebuggerFinish 4 #define DebuggerFrame 5 #define DebuggerNext 6 -#define DebuggerNexti 7 -#define DebuggerPrint 8 -#define DebuggerStep 9 -#define DebuggerStepi 10 -#define DebuggerBreak 11 -#define DebuggerDelete 12 -#define DebuggerDown 13 -#define DebuggerUp 14 -#define DebuggerInfo 15 -#define DebuggerWatch 16 +#define DebuggerPrint 7 +#define DebuggerStep 8 +#define DebuggerBreak 9 +#define DebuggerDelete 10 +#define DebuggerDown 11 +#define DebuggerUp 12 +#define DebuggerInfo 13 +#define DebuggerWatch 14 #define DebuggerInfoBreakpoints 0 #define DebuggerInfoBacktrace 1 @@ -56,7 +57,8 @@ /* * Prototypes */ -static void LispDebuggerCommand(LispMac*, LispObj *obj); +static char *format_integer(int); +static void LispDebuggerCommand(LispObj *obj); /* * Initialization @@ -80,14 +82,10 @@ {"info", DebuggerInfo}, {"n", DebuggerNext}, {"next", DebuggerNext}, - {"ni", DebuggerNexti}, - {"nexti", DebuggerNexti}, {"print", DebuggerPrint}, {"run", DebuggerContinue}, {"s", DebuggerStep}, {"step", DebuggerStep}, - {"si", DebuggerStepi}, - {"stepi", DebuggerStepi}, {"up", DebuggerUp}, {"watch", DebuggerWatch}, }; @@ -115,11 +113,9 @@ frame - Set environment to selected frame.\n\ info - Prints information about the debugger state.\n\ n, next - Evaluate next form.\n\ -nexti, ni - Evaluate next form, including variables.\n\ print - Print value of variable name argument.\n\ run - Continue execution.\n\ s, step - Evaluate next form, stopping on any subforms.\n\ -si, stepi - Evaluate next form including variables, stopping on subforms.\n\ up - Set environment to frame that called the current one.\n\ \n\ Commands may be abbreviated.\n"; @@ -136,30 +132,31 @@ /* Debugger variables layout (if you change it, update description): * * DBG - * is a macro for mac->dbglist + * is a macro for lisp__data.dbglist * is a NIL terminated list * every element is a list in the format (NOT NIL terminated): - * (list* NAM ARG ENV LEX) + * (list* NAM ARG ENV HED LEX) * where * NAM is an ATOM for the function/macro name * or NIL for lambda expressions * ARG is NAM arguments (a LIST) - * ENV is the contents of the global ENV (a LIST) - * LEX is the contents of the global LEX (a LIST) - * new elements are added to the beggining of the list + * ENV is the value of lisp__data.stack.base (a FIXNUM) + * LEN is the value of lisp__data.env.length (a FIXNUM) + * LEX is the value of lisp__data.env.lex (a FIXNUM) + * new elements are added to the beggining of the DBG list * * BRK - * is macro for mac->brklist + * is macro for lisp__data.brklist * is a NIL terminated list * every element is a list in the format (NIL terminated): * (list NAM IDX TYP HIT VAR VAL FRM) * where * NAM is an ATOM for the name of the object at * wich the breakpoint was added - * IDX is a REAL, the breakpoint number + * IDX is a FIXNUM, the breakpoint number * must be stored, as breakpoints may be deleted - * TYP is a REAL that must be an integer of enum LispBreakType - * HIT is a REAL, with the number of times this breakpoint was + * TYP is a FIXNUM that must be an integer of enum LispBreakType + * HIT is a FIXNUM, with the number of times this breakpoint was * hitted. * VAR variable to watch a SYMBOL (not needed for breakpoints) * VAL value of watched variable (not needed for breakpoints) @@ -172,50 +169,52 @@ * Implementation */ void -LispDebugger(LispMac *mac, LispDebugCall call, LispObj *name, LispObj *arg) +LispDebugger(LispDebugCall call, LispObj *name, LispObj *arg) { int force = 0; LispObj *obj, *prev; switch (call) { case LispDebugCallBegin: - ++mac->debug_level; - GCProtect(); - DBG = CONS(CONS(name, CONS(arg, CONS(ENV, LEX))), DBG); - GCUProtect(); + ++lisp__data.debug_level; + GCDisable(); + DBG = CONS(CONS(name, CONS(arg, CONS(FIXNUM(lisp__data.stack.base), + CONS(FIXNUM(lisp__data.env.length), + FIXNUM(lisp__data.env.lex))))), DBG); + GCEnable(); for (obj = BRK; obj != NIL; obj = CDR(obj)) - if (STRPTR(CAR(CAR(obj))) == STRPTR(name) && - CAR(CDR(CDR(CAR(obj))))->data.real == LispDebugBreakFunction) + if (ATOMID(CAR(CAR(obj))) == ATOMID(name) && + FIXNUM_VALUE(CAR(CDR(CDR(CAR(obj))))) == + LispDebugBreakFunction) break; if (obj != NIL) { - if (!mac->newline) - fputc('\n', lisp_stdout); - fprintf(lisp_stdout, "BREAK #"); - LispPrintObj(mac, NIL, CAR(CDR(CAR(obj))), 1); - fprintf(lisp_stdout, "> ("); - LispPrintObj(mac, NIL, CAR(CAR(DBG)), 1); - fputc(' ', lisp_stdout); - LispPrintObj(mac, NIL, CAR(CDR(CAR(DBG))), 0); - fprintf(lisp_stdout, ")\n"); + long counter; + + /* if not at a fresh line */ + if (LispGetColumn(NIL)) + LispFputc(Stdout, '\n'); + LispFputs(Stdout, "BREAK #"); + LispWriteObject(NIL, CAR(CDR(CAR(obj)))); + LispFputs(Stdout, "> ("); + LispWriteObject(NIL, CAR(CAR(DBG))); + LispFputc(Stdout, ' '); + LispWriteObject(NIL, CAR(CDR(CAR(DBG)))); + LispFputs(Stdout, ")\n"); force = 1; /* update hits counter */ - CAR(CDR(CDR(CDR(CAR(obj)))))->data.real += 1.0; + counter = FIXNUM_VALUE(CAR(CDR(CDR(CDR(CAR(obj)))))); + CAR(CDR(CDR(CDR(CAR(obj))))) FIXNUM(counter + 1); } break; case LispDebugCallEnd: DBG = CDR(DBG); - if (mac->debug_level < mac->debug_step) - mac->debug_step = mac->debug_level; - --mac->debug_level; + if (lisp__data.debug_level < lisp__data.debug_step) + lisp__data.debug_step = lisp__data.debug_level; + --lisp__data.debug_level; break; case LispDebugCallFatal: - LispDebuggerCommand(mac, NIL); + LispDebuggerCommand(NIL); return; - case LispDebugCallBegini: - case LispDebugCallEndi: - if (mac->debug != LispDebugNexti && mac->debug != LispDebugStepi) - return; - break; case LispDebugCallWatch: break; } @@ -224,18 +223,21 @@ if (call == LispDebugCallEnd || call == LispDebugCallWatch) { watch_again: for (prev = obj = BRK; obj != NIL; prev = obj, obj = CDR(obj)) { - if (CAR(CDR(CDR(CAR(obj))))->data.real == LispDebugBreakVariable) { + if (FIXNUM_VALUE(CAR(CDR(CDR(CAR(obj))))) == + LispDebugBreakVariable) { /* the variable */ LispObj *wat = CAR(CDR(CDR(CDR(CDR(CAR(obj)))))); - LispObj *sym = LispGetVarCons(mac, CAAR(obj)); + void *sym = LispGetVarAddr(CAAR(obj)); LispObj *frm = CAR(CDR(CDR(CDR(CDR(CDR(CDR(CAR(obj)))))))); - if ((sym == NULL && mac->debug_level <= 0) || - (sym != wat && frm->data.real > mac->debug_level)) { - fprintf(lisp_stdout, "WATCH #%g> %s deleted. Variable does " - "not exist anymore.\n", - CAR(CDR(CAR(obj)))->data.real, - STRPTR(CAR(CAR(obj)))); + if ((sym == NULL && lisp__data.debug_level <= 0) || + (sym != wat->data.opaque.data && + FIXNUM_VALUE(frm) > lisp__data.debug_level)) { + LispFputs(Stdout, "WATCH #"); + LispFputs(Stdout, format_integer(FIXNUM_VALUE(CAR(CDR(CAR(obj)))))); + LispFputs(Stdout, "> "); + LispFputs(Stdout, STRPTR(CAR(CAR(obj)))); + LispFputs(Stdout, " deleted. Variable does not exist anymore.\n"); /* force debugger to stop */ force = 1; if (obj == prev) { @@ -243,28 +245,35 @@ goto watch_again; } else - CDR(prev) = CDR(obj); + RPLACD(prev, CDR(obj)); obj = prev; } else { /* current value */ - LispObj *cur = CDR(wat); + LispObj *cur = *(LispObj**)wat->data.opaque.data; /* last value */ LispObj *val = CAR(CDR(CDR(CDR(CDR(CDR(CAR(obj))))))); - if (_LispEqual(mac, val, cur) == NIL) { - fprintf(lisp_stdout, "WATCH #%g> %s\n", - CAR(CDR(CAR(obj)))->data.real, - STRPTR(CAR(CAR(obj)))); - fprintf(lisp_stdout, "OLD: "); - LispPrintObj(mac, NIL, val, 1); - fprintf(lisp_stdout, "\nNEW: "); - LispPrintObj(mac, NIL, cur, 1); - fputc('\n', lisp_stdout); + if (XEQUAL(val, cur) == NIL) { + long counter; + LispFputs(Stdout, "WATCH #"); + LispFputs(Stdout, format_integer(FIXNUM_VALUE(CAR(CDR(CAR(obj)))))); + LispFputs(Stdout, "> "); + LispFputs(Stdout, STRPTR(CAR(CAR(obj)))); + LispFputc(Stdout, '\n'); + + LispFputs(Stdout, "OLD: "); + LispWriteObject(NIL, val); + + LispFputs(Stdout, "\nNEW: "); + LispWriteObject(NIL, cur); + LispFputc(Stdout, '\n'); + /* update current value */ CAR(CDR(CDR(CDR(CDR(CDR(CAR(obj))))))) = cur; /* update hits counter */ - CAR(CDR(CDR(CDR(CAR(obj)))))->data.real += 1.0; + counter = FIXNUM_VALUE(CAR(CDR(CDR(CDR(CAR(obj)))))); + CAR(CDR(CDR(CDR(CAR(obj))))) = FIXNUM(counter + 1); /* force debugger to stop */ force = 1; } @@ -278,110 +287,80 @@ return; } - switch (mac->debug) { + switch (lisp__data.debug) { case LispDebugUnspec: - LispDebuggerCommand(mac, NIL); + LispDebuggerCommand(NIL); goto debugger_done; case LispDebugRun: if (force) - LispDebuggerCommand(mac, NIL); + LispDebuggerCommand(NIL); goto debugger_done; case LispDebugFinish: if (!force && - (call != LispDebugCallEnd || mac->debug_level != mac->debug_step)) + (call != LispDebugCallEnd || + lisp__data.debug_level != lisp__data.debug_step)) goto debugger_done; break; case LispDebugNext: if (call == LispDebugCallBegin) { - if (!force && mac->debug_level != mac->debug_step) + if (!force && lisp__data.debug_level != lisp__data.debug_step) goto debugger_done; } else if (call == LispDebugCallEnd) { - if (!force && mac->debug_level >= mac->debug_step) + if (!force && lisp__data.debug_level >= lisp__data.debug_step) goto debugger_done; } break; case LispDebugStep: break; - case LispDebugNexti: - if (call == LispDebugCallBegini) { - if (!force && mac->debug_level != mac->debug_step) - goto debugger_done; - } - else if (call == LispDebugCallEndi) { - if (!force && mac->debug_level >= mac->debug_step) - goto debugger_done; - } - break; - case LispDebugStepi: - break; } if (call == LispDebugCallBegin) { - if (!mac->newline) - fputc('\n', lisp_stdout); - fprintf(lisp_stdout, "#%d> ", mac->debug_level); - - fputc('(', lisp_stdout); - LispPrintObj(mac, NIL, CAR(CAR(DBG)), 1); - fputc(' ', lisp_stdout); - LispPrintObj(mac, NIL, CAR(CDR(CAR(DBG))), 0); - fprintf(lisp_stdout, ")\n"); - LispDebuggerCommand(mac, NIL); + LispFputc(Stdout, '#'); + LispFputs(Stdout, format_integer(lisp__data.debug_level)); + LispFputs(Stdout, "> ("); + LispWriteObject(NIL, CAR(CAR(DBG))); + LispFputc(Stdout, ' '); + LispWriteObject(NIL, CAR(CDR(CAR(DBG)))); + LispFputs(Stdout, ")\n"); + LispDebuggerCommand(NIL); } else if (call == LispDebugCallEnd) { - if (!mac->newline) - fputc('\n', lisp_stdout); - fprintf(lisp_stdout, "#%d= ", mac->debug_level + 1); - - LispPrintObj(mac, NIL, arg, 1); - fputc('\n', lisp_stdout); - LispDebuggerCommand(mac, NIL); - } - else if (call == LispDebugCallBegini) { - if (!mac->newline) - fputc('\n', lisp_stdout); - fprintf(lisp_stdout, "#%d+> ", mac->debug_level + 1); - - LispPrintObj(mac, NIL, arg, 1); - fputc('\n', lisp_stdout); - LispDebuggerCommand(mac, arg); + LispFputc(Stdout, '#'); + LispFputs(Stdout, format_integer(lisp__data.debug_level + 1)); + LispFputs(Stdout, "= "); + LispWriteObject(NIL, arg); + LispFputc(Stdout, '\n'); + LispDebuggerCommand(NIL); } - else if (call == LispDebugCallEndi) { - if (!mac->newline) - fputc('\n', lisp_stdout); - fprintf(lisp_stdout, "#%d+= ", mac->debug_level + 1); - - LispPrintObj(mac, NIL, arg, 1); - fputc('\n', lisp_stdout); - mac->newline = 1; - LispDebuggerCommand(mac, arg); - } else if (force) - LispDebuggerCommand(mac, arg); + LispDebuggerCommand(arg); debugger_done: return; } static void -LispDebuggerCommand(LispMac *mac, LispObj *args) +LispDebuggerCommand(LispObj *args) { - LispObj *obj, *frm, *curframe, - *old_frm = FRM, *old_env = ENV, *old_lex = LEX; + LispObj *obj, *frm, *curframe; int i = 0, frame, matches, action = -1, subaction = 0; char *cmd, *arg, *ptr, line[256]; + + int envbase = lisp__data.stack.base, + envlen = lisp__data.env.length, + envlex = lisp__data.env.lex; - frame = mac->debug_level; + frame = lisp__data.debug_level; curframe = CAR(DBG); line[0] = '\0'; arg = line; for (;;) { - fprintf(lisp_stdout, "%s", DBGPROMPT); - fflush(lisp_stdout); - if (fgets(line, sizeof(line), lisp_stdin) == NULL) { - fputc('\n', lisp_stdout); + LispFputs(Stdout, DBGPROMPT); + LispFflush(Stdout); + if (LispFgets(Stdin, line, sizeof(line)) == NULL) { + LispFputc(Stdout, '\n'); return; } /* get command */ @@ -413,17 +392,13 @@ if (*cmd == '\0') { if (action < 0) { - if (mac->debug == LispDebugFinish) + if (lisp__data.debug == LispDebugFinish) action = DebuggerFinish; - else if (mac->debug == LispDebugNext) + else if (lisp__data.debug == LispDebugNext) action = DebuggerNext; - else if (mac->debug == LispDebugStep) + else if (lisp__data.debug == LispDebugStep) action = DebuggerStep; - else if (mac->debug == LispDebugNexti) - action = DebuggerNexti; - else if (mac->debug == LispDebugStepi) - action = DebuggerStepi; - else if (mac->debug == LispDebugRun) + else if (lisp__data.debug == LispDebugRun) action = DebuggerContinue; else continue; @@ -449,24 +424,26 @@ } } if (matches == 0) { - fprintf(lisp_stdout, "* Command unknown: %s. " - "Type help for help.\n", cmd); + LispFputs(Stdout, "* Command unknown: "); + LispFputs(Stdout, cmd); + LispFputs(Stdout, ". Type help for help.\n"); continue; } else if (matches > 1) { - fprintf(lisp_stdout, "* Command is ambiguous: %s. " - "Type help for help.\n", cmd); + LispFputs(Stdout, "* Command is ambiguous: "); + LispFputs(Stdout, cmd); + LispFputs(Stdout, ". Type help for help.\n"); continue; } } switch (action) { case DebuggerHelp: - fprintf(lisp_stdout, debugger_help); + LispFputs(Stdout, debugger_help); break; case DebuggerInfo: if (*arg == '\0') { - fprintf(lisp_stdout, debugger_info_help); + LispFputs(Stdout, debugger_info_help); break; } @@ -490,44 +467,45 @@ } } if (matches == 0) { - fprintf(lisp_stdout, "* Command unknown: %s. " - "Type info for help.\n", arg); + LispFputs(Stdout, "* Command unknown: "); + LispFputs(Stdout, arg); + LispFputs(Stdout, ". Type info for help.\n"); continue; } else if (matches > 1) { - fprintf(lisp_stdout, "* Command is ambiguous: %s. " - "Type info for help.\n", arg); + LispFputs(Stdout, "* Command is ambiguous: "); + LispFputs(Stdout, arg); + LispFputs(Stdout, ". Type info for help.\n"); continue; } switch (subaction) { case DebuggerInfoBreakpoints: - fprintf(lisp_stdout, "Num\tHits\tType\t\tWhat\n"); + LispFputs(Stdout, "Num\tHits\tType\t\tWhat\n"); for (obj = BRK; obj != NIL; obj = CDR(obj)) { /* breakpoint number */ - fputc('#', lisp_stdout); - LispPrintObj(mac, NIL, CAR(CDR(CAR(obj))), 1); + LispFputc(Stdout, '#'); + LispWriteObject(NIL, CAR(CDR(CAR(obj)))); /* number of hits */ - fprintf(lisp_stdout, "\t"); - LispPrintObj(mac, NIL, - CAR(CDR(CDR(CDR(CAR(obj))))), 1); + LispFputc(Stdout, '\t'); + LispWriteObject(NIL, CAR(CDR(CDR(CDR(CAR(obj)))))); /* breakpoint type */ - fprintf(lisp_stdout, "\t"); - switch ((int)CAR(CDR(CDR(CAR(obj))))->data.real) { + LispFputc(Stdout, '\t'); + switch ((int)FIXNUM_VALUE(CAR(CDR(CDR(CAR(obj)))))) { case LispDebugBreakFunction: - fprintf(lisp_stdout, "Function"); + LispFputs(Stdout, "Function"); break; case LispDebugBreakVariable: - fprintf(lisp_stdout, "Variable"); + LispFputs(Stdout, "Variable"); break; } /* breakpoint object */ - fprintf(lisp_stdout, "\t"); - LispPrintObj(mac, NIL, CAR(CAR(obj)), 1); - fputc('\n', lisp_stdout); + LispFputc(Stdout, '\t'); + LispWriteObject(NIL, CAR(CAR(obj))); + LispFputc(Stdout, '\n'); } break; case DebuggerInfoBacktrace: @@ -535,18 +513,19 @@ } break; case DebuggerAbort: - /* Almost the same code as LispDestroy */ - while (mac->mem.mem_level) - free(mac->mem.mem[--mac->mem.mem_level]); - - LispTopLevel(mac); - if (mac->st) { - mac->cp = &(mac->st[strlen(mac->st)]); - mac->tok = 0; - } - mac->column = 0; - mac->newline = 1; - siglongjmp(mac->jmp, 1);/* don't need to restore environment */ + while (lisp__data.mem.level) { + --lisp__data.mem.level; + if (lisp__data.mem.mem[lisp__data.mem.level]) + free(lisp__data.mem.mem[lisp__data.mem.level]); + } + lisp__data.mem.index = 0; + LispTopLevel(); + if (!lisp__data.running) { + LispMessage("*** Fatal: nowhere to longjmp."); + abort(); + } + /* don't need to restore environment */ + siglongjmp(lisp__data.jmp, 1); /*NOTREACHED*/ break; case DebuggerBreak: @@ -559,29 +538,31 @@ if (!*arg || *ptr || strchr(arg, '(') || strchr(arg, '(') || strchr(arg, ';')) { - fprintf(lisp_stdout, "* Bad function name " - "'%s' specified.\n", arg); + LispFputs(Stdout, "* Bad function name '"); + LispFputs(Stdout, arg); + LispFputs(Stdout, "' specified.\n"); } else { for (obj = frm = BRK; obj != NIL; frm = obj, obj = CDR(obj)) ; - i = mac->debug_break; - ++mac->debug_break; - GCProtect(); - obj = CONS(ATOM2(arg), - CONS(REAL(i), - CONS(REAL(LispDebugBreakFunction), - CONS(REAL(0), NIL)))); + i = lisp__data.debug_break; + ++lisp__data.debug_break; + GCDisable(); + obj = CONS(ATOM(arg), + CONS(FIXNUM(i), + CONS(FIXNUM(LispDebugBreakFunction), + CONS(FIXNUM(0), NIL)))); if (BRK == NIL) BRK = CONS(obj, NIL); else - CDR(frm) = CONS(obj, NIL); - GCUProtect(); + RPLACD(frm, CONS(obj, NIL)); + GCEnable(); } break; case DebuggerWatch: { + void *sym; int vframe; - LispObj *sym, *val, *atom; + LispObj *val, *atom; /* make variable name uppercase, an ATOM */ ptr = arg; @@ -589,71 +570,68 @@ *ptr = toupper(*ptr); ++ptr; } - atom = ATOM2(arg); - val = LispGetVar(mac, atom); + atom = ATOM(arg); + val = LispGetVar(atom); if (val == NULL) { - fprintf(lisp_stdout, "* No variable named '%s' " - "in the selected frame.\n", arg); + LispFputs(Stdout, "* No variable named '"); + LispFputs(Stdout, arg); + LispFputs(Stdout, "' in the selected frame.\n"); break; } /* variable is available at the current frame */ - sym = LispGetVarCons(mac, atom); + sym = LispGetVarAddr(atom); /* find the lowest frame where the variable is visible */ vframe = 0; - if (frame) { + if (frame > 0) { for (; vframe < frame; vframe++) { - for (frm = DBG, i = mac->debug_level; i > vframe; + for (frm = DBG, i = lisp__data.debug_level; i > vframe; frm = CDR(frm), i--) ; obj = CAR(frm); - if (FRM == old_frm) { - /* if first time selecting a new frame */ - GCProtect(); - FRM = CONS(ENV, old_frm); - GCUProtect(); - } - ENV = CAR(CDR(CDR(obj))); - LEX = CDR(CDR(CDR(obj))); + lisp__data.stack.base = FIXNUM_VALUE(CAR(CDR(CDR(obj)))); + lisp__data.env.length = FIXNUM_VALUE(CAR(CDR(CDR(CDR(obj))))); + lisp__data.env.lex = FIXNUM_VALUE(CDR(CDR(CDR(CDR(obj))))); - if (LispGetVarCons(mac, atom) == sym) + if (LispGetVarAddr(atom) == sym) /* got variable initial frame */ break; } vframe = i; if (vframe != frame) { /* restore environment */ - for (frm = DBG, i = mac->debug_level; i > frame; + for (frm = DBG, i = lisp__data.debug_level; i > frame; frm = CDR(frm), i--) ; obj = CAR(frm); - ENV = CAR(CDR(CDR(obj))); - LEX = CDR(CDR(CDR(obj))); + lisp__data.stack.base = FIXNUM_VALUE(CAR(CDR(CDR(obj)))); + lisp__data.env.length = FIXNUM_VALUE(CAR(CDR(CDR(CDR(obj))))); + lisp__data.env.lex = FIXNUM_VALUE(CDR(CDR(CDR(CDR(obj))))); } } - i = mac->debug_break; - ++mac->debug_break; + i = lisp__data.debug_break; + ++lisp__data.debug_break; for (obj = frm = BRK; obj != NIL; frm = obj, obj = CDR(obj)) ; - GCProtect(); - obj = CONS(atom, /* NAM */ - CONS(REAL(i), /* IDX */ - CONS(REAL(LispDebugBreakVariable), /* TYP */ - CONS(REAL(0), /* HIT */ - CONS(sym, /* VAR */ - CONS(val, /* VAL */ - CONS(REAL(vframe),/* FRM */ + GCDisable(); + obj = CONS(atom, /* NAM */ + CONS(FIXNUM(i), /* IDX */ + CONS(FIXNUM(LispDebugBreakVariable), /* TYP */ + CONS(FIXNUM(0), /* HIT */ + CONS(OPAQUE(sym, 0), /* VAR */ + CONS(val, /* VAL */ + CONS(FIXNUM(vframe),/* FRM */ NIL))))))); /* add watchpoint */ if (BRK == NIL) BRK = CONS(obj, NIL); else - CDR(frm) = CONS(obj, NIL); - GCUProtect(); + RPLACD(frm, CONS(obj, NIL)); + GCEnable(); } break; case DebuggerDelete: if (*arg == 0) { @@ -662,12 +640,11 @@ for (;;) { int ch; - fprintf(lisp_stdout, "* Delete all breakpoints? " - "(y or n) "); - fflush(lisp_stdout); - if ((ch = fgetc(lisp_stdin)) == '\n') + LispFputs(Stdout, "* Delete all breakpoints? (y or n) "); + LispFflush(Stdout); + if ((ch = LispFgetc(Stdin)) == '\n') continue; - while ((i = fgetc(lisp_stdin)) != '\n' && i != EOF) + while ((i = LispFgetc(Stdin)) != '\n' && i != EOF) ; if (tolower(ch) == 'n') break; @@ -685,24 +662,26 @@ ++ptr; if (*ptr && !isspace(*ptr)) { *ptr = '\0'; - fprintf(lisp_stdout, "* Bad breakpoint number " - "'%s' specified.\n", arg); + LispFputs(Stdout, "* Bad breakpoint number '"); + LispFputs(Stdout, arg); + LispFputs(Stdout, "' specified.\n"); break; } i = atoi(arg); for (obj = frm = BRK; frm != NIL; obj = frm, frm = CDR(frm)) - if (CAR(CDR(CAR(frm)))->data.real == i) + if (FIXNUM_VALUE(CAR(CDR(CAR(frm)))) == i) break; if (frm == NIL) { - fprintf(lisp_stdout, "* No breakpoint number " - "%d available.\n", i); + LispFputs(Stdout, "* No breakpoint number "); + LispFputs(Stdout, arg); + LispFputs(Stdout, " available.\n"); break; } if (obj == frm) BRK = CDR(BRK); else - CDR(obj) = CDR(frm); + RPLACD(obj, CDR(frm)); while (*ptr && isspace(*ptr)) ++ptr; arg = ptr; @@ -720,20 +699,22 @@ ++ptr; } if (*ptr) { - fprintf(lisp_stdout, "* Frame identifier must " + LispFputs(Stdout, "* Frame identifier must " "be a positive number.\n"); break; } } else goto debugger_print_frame; - if (i >= 0 && i <= mac->debug_level) + if (i >= 0 && i <= lisp__data.debug_level) goto debugger_new_frame; - fprintf(lisp_stdout, "* No such frame %d.\n", i); + LispFputs(Stdout, "* No such frame "); + LispFputs(Stdout, format_integer(i)); + LispFputs(Stdout, ".\n"); break; case DebuggerDown: - if (frame + 1 > mac->debug_level) { - fprintf(lisp_stdout, "* Cannot go down.\n"); + if (frame + 1 > lisp__data.debug_level) { + LispFputs(Stdout, "* Cannot go down.\n"); break; } i = frame + 1; @@ -741,7 +722,7 @@ break; case DebuggerUp: if (frame == 0) { - fprintf(lisp_stdout, "* Cannot go up.\n"); + LispFputs(Stdout, "* Cannot go up.\n"); break; } i = frame - 1; @@ -753,69 +734,56 @@ *ptr = toupper(*ptr); ++ptr; } - obj = LispGetVar(mac, ATOM2(arg)); - if (obj) { - LispPrintObj(mac, NIL, obj, 1); - fputc('\n', lisp_stdout); + obj = LispGetVar(ATOM(arg)); + if (obj != NULL) { + LispWriteObject(NIL, obj); + LispFputc(Stdout, '\n'); } - else - fprintf(lisp_stdout, "* No variable named '%s' " - "in the selected frame.\n", arg); + else { + LispFputs(Stdout, "* No variable named '"); + LispFputs(Stdout, arg); + LispFputs(Stdout, "' in the selected frame.\n"); + } break; case DebuggerBacktrace: debugger_print_backtrace: if (DBG == NIL) { - fprintf(lisp_stdout, "* No stack.\n"); + LispFputs(Stdout, "* No stack.\n"); break; } DBG = LispReverse(DBG); for (obj = DBG, i = 0; obj != NIL; obj = CDR(obj), i++) { frm = CAR(obj); - fprintf(lisp_stdout, "#%d> (", i); - LispPrintObj(mac, NIL, CAR(frm), 1); - fputc(' ', lisp_stdout); - LispPrintObj(mac, NIL, CAR(CDR(frm)), 0); - fprintf(lisp_stdout, ")\n"); + LispFputc(Stdout, '#'); + LispFputs(Stdout, format_integer(i)); + LispFputs(Stdout, "> ("); + LispWriteObject(NIL, CAR(frm)); + LispFputc(Stdout, ' '); + LispWriteObject(NIL, CAR(CDR(frm))); + LispFputs(Stdout, ")\n"); } DBG = LispReverse(DBG); - if (mac->debug == LispDebugNexti || - mac->debug == LispDebugStepi) { - fprintf(lisp_stdout, "#%d+> ", i); - LispPrintObj(mac, NIL, args, 1); - fputc('\n', lisp_stdout); - } break; case DebuggerContinue: - mac->debug = LispDebugRun; + lisp__data.debug = LispDebugRun; goto debugger_command_done; case DebuggerFinish: - if (mac->debug != LispDebugFinish) { - mac->debug_step = mac->debug_level - 2; - mac->debug = LispDebugFinish; + if (lisp__data.debug != LispDebugFinish) { + lisp__data.debug_step = lisp__data.debug_level - 2; + lisp__data.debug = LispDebugFinish; } else - mac->debug_step = mac->debug_level - 1; + lisp__data.debug_step = lisp__data.debug_level - 1; goto debugger_command_done; case DebuggerNext: - if (mac->debug != LispDebugNext && - mac->debug != LispDebugNexti) { - mac->debug = LispDebugNext; - mac->debug_step = mac->debug_level + 1; - } - goto debugger_command_done; - case DebuggerNexti: - if (mac->debug != LispDebugNext && - mac->debug != LispDebugNexti) { - mac->debug = LispDebugNexti; - mac->debug_step = mac->debug_level + 1; + if (lisp__data.debug != LispDebugNext) { + lisp__data.debug = LispDebugNext; + lisp__data.debug_step = lisp__data.debug_level + 1; } goto debugger_command_done; case DebuggerStep: - mac->debug = LispDebugStep; + lisp__data.debug = LispDebugStep; goto debugger_command_done; - case DebuggerStepi: - mac->debug = LispDebugStepi; - goto debugger_command_done; } continue; @@ -823,31 +791,38 @@ /* goto here with i as the new frame value, after error checking */ if (i != frame) { frame = i; - for (frm = DBG, i = mac->debug_level; i > frame; frm = CDR(frm), i--) + for (frm = DBG, i = lisp__data.debug_level; + i > frame; frm = CDR(frm), i--) ; curframe = CAR(frm); - - if (FRM == old_frm) { - /* if first time selecting a new frame */ - GCProtect(); - FRM = CONS(ENV, old_frm); - GCUProtect(); - } - ENV = CAR(CDR(CDR(curframe))); - LEX = CDR(CDR(CDR(curframe))); + lisp__data.stack.base = FIXNUM_VALUE(CAR(CDR(CDR(curframe)))); + lisp__data.env.length = FIXNUM_VALUE(CAR(CDR(CDR(CDR(curframe))))); + lisp__data.env.lex = FIXNUM_VALUE(CDR(CDR(CDR(CDR(curframe))))); } debugger_print_frame: - fprintf(lisp_stdout, "#%d> (", frame); - LispPrintObj(mac, NIL, CAR(curframe), 1); - fputc(' ', lisp_stdout); - LispPrintObj(mac, NIL, CAR(CDR(curframe)), 0); - fprintf(lisp_stdout, ")\n"); - - + LispFputc(Stdout, '#'); + LispFputs(Stdout, format_integer(frame)); + LispFputs(Stdout, "> ("); + LispWriteObject(NIL, CAR(curframe)); + LispFputc(Stdout, ' '); + LispWriteObject(NIL, CAR(CDR(curframe))); + LispFputs(Stdout, ")\n"); } debugger_command_done: - FRM = old_frm; - ENV = old_env; - LEX = old_lex; + lisp__data.stack.base = envbase; + lisp__data.env.length = envlen; + lisp__data.env.lex = envlex; } + +static char * +format_integer(int integer) +{ + static char buffer[16]; + + sprintf(buffer, "%d", integer); + + return (buffer); +} + +#endif /* DEBUGGER */ Index: xc/programs/xedit/lisp/debugger.h diff -u xc/programs/xedit/lisp/debugger.h:1.4 xc/programs/xedit/lisp/debugger.h:1.7 --- xc/programs/xedit/lisp/debugger.h:1.4 Wed Oct 10 03:02:51 2001 +++ xc/programs/xedit/lisp/debugger.h Fri Nov 8 03:00:56 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/debugger.h,v 1.4 2001/10/10 07:02:51 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/debugger.h,v 1.7 2002/11/08 08:00:56 paulo Exp $ */ #ifndef Lisp_debugger_h #define Lisp_debugger_h @@ -36,6 +36,7 @@ * Definitions */ #define DBGPROMPT "DEBUG> " +#ifdef DEBUGGER /* * Types @@ -45,16 +46,12 @@ LispDebugRun, /* just run, until breakpoint or error */ LispDebugFinish, /* evaluates until selected form is finished */ LispDebugNext, /* evaluate form */ - LispDebugStep, /* evaluate form, and step on subforms */ - LispDebugNexti, /* Like next, but includes variables evaluation */ - LispDebugStepi /* Like step, but includes variables evaluation */ + LispDebugStep /* evaluate form, and step on subforms */ } LispDebugState; typedef enum _LispDebugCall { LispDebugCallBegin, LispDebugCallEnd, - LispDebugCallBegini, - LispDebugCallEndi, LispDebugCallFatal, LispDebugCallWatch /* just remove watched variables that lost context */ } LispDebugCall; @@ -69,6 +66,7 @@ /* * Prototypes */ -void LispDebugger(LispMac*, LispDebugCall, LispObj*, LispObj*); +void LispDebugger(LispDebugCall, LispObj*, LispObj*); +#endif /* DEBUGGER */ #endif /* Lisp_debugger_h */ Index: xc/programs/xedit/lisp/env.c diff -u /dev/null xc/programs/xedit/lisp/env.c:1.1 --- /dev/null Thu Feb 27 12:34:57 2003 +++ xc/programs/xedit/lisp/env.c Mon Mar 4 22:52:34 2002 @@ -0,0 +1,151 @@ +/* + * Provide setenv() and unsetenv() on platforms that don't have them. + * From FreeBSD's libc. + */ + +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $XFree86: xc/programs/xedit/lisp/env.c,v 1.1 2002/03/05 03:52:34 dawes Exp $ */ + + +#include <stdlib.h> +#include <stddef.h> +#include <string.h> + +extern char **environ; + +extern int setenv(const char *name, const char *value, int overwrite); +extern void unsetenv(const char *name); + +static char * +findenv(const char *name, int *offset) +{ + int len, i; + const char *np; + char **p, *cp; + + if (name == NULL || environ == NULL) + return NULL; + + for (np = name; *np && *np != '='; ++np) + continue; + len = np - name; + for (p = environ; (cp = *p) != NULL; ++p) { + for (np = name, i = len; i && *cp; i--) + if (*cp++ != *np++) + break; + if (i == 0 && *cp++ == '=') { + *offset = p - environ; + return cp; + } + } + return NULL; +} + +/* + * setenv -- + * Set the value of the environmental variable "name" to be + * "value". If overwrite is set, replace any current value. + */ + +int +setenv(const char *name, const char *value, int overwrite) +{ + static char **alloced; /* if allocated space before */ + char *c; + int l_value, offset; + + if (*value == '=') /* no '=' in value */ + ++value; + l_value = strlen(value); + if ((c = findenv(name, &offset))) { /* find if already exists */ + if (!overwrite) + return 0; + if (strlen(c) >= l_value) { /* old larger; copy over */ + while ((*c++ = *value++)) + ; + return 0; + } + } else { /* create new slot */ + int cnt; + char **p; + + for (p = environ, cnt = 0; *p; ++p, ++cnt) + ; + if (alloced == environ) { /* just increase size */ + p = (char **)realloc((char *)environ, + sizeof(char *) * (cnt + 2)); + if (!p) + return -1; + alloced = environ = p; + } else { /* get new space */ + /* copy old entries into it */ + p = malloc(sizeof(char *) * (cnt + 2)); + if (!p) + return -1; + memcpy(p, environ, cnt * sizeof(char *)); + alloced = environ = p; + } + environ[cnt + 1] = NULL; + offset = cnt; + } + for (c = (char *)name; *c && *c != '='; ++c) /* no '=' in name */ + ; + if (!(environ[offset] = /* name + '=' + value */ + malloc((int)(c - name) + l_value + 2))) + return -1; + for (c = environ[offset]; (*c = *name++) && *c != '='; ++c) + ; + for (*c++ = '='; (*c++ = *value++); ) + ; + return 0; +} + +/* + * unsetenv(name) -- + * Delete environmental variable "name". + */ + +void +unsetenv(const char *name) +{ + char **p; + int offset; + + while (findenv(name, &offset)) /* if set multiple times */ + for (p = &environ[offset];; ++p) + if (!(*p = *(p + 1))) + break; +} + Index: xc/programs/xedit/lisp/format.c diff -u xc/programs/xedit/lisp/format.c:1.11 xc/programs/xedit/lisp/format.c:1.28 --- xc/programs/xedit/lisp/format.c:1.11 Sat Oct 27 23:34:29 2001 +++ xc/programs/xedit/lisp/format.c Sat Nov 30 18:13:11 2002 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001 by The XFree86 Project, Inc. + * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,2005 +27,2095 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/format.c,v 1.11 2001/10/28 03:34:29 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/format.c,v 1.28 2002/11/30 23:13:11 paulo Exp $ */ +#include "io.h" +#include "write.h" #include "format.h" #include <ctype.h> -#include <math.h> +#define MAXFMT 8 +#define NOERROR 0 + +/* parse error codes */ +#define PARSE_2MANYPARM 1 /* too many directive parameters */ +#define PARSE_2MANYATS 2 /* more than one @ in directive */ +#define PARSE_2MANYCOLS 3 /* more than one : in directive */ +#define PARSE_NOARGSLEFT 4 /* no arguments left to format */ +#define PARSE_BADFMTARG 5 /* argument is not an integer or char */ +#define PARSE_BADDIRECTIVE 6 /* unknown format directive */ +#define PARSE_BADINTEGER 7 /* bad integer representation */ + +/* merge error codes */ +#define MERGE_2MANY 1 /* too many parameters to directive */ +#define MERGE_NOCHAR 2 /* parameter must be a character */ +#define MERGE_NOINT 3 /* parameter must be an integer */ + +/* generic error codes */ +#define GENERIC_RADIX 1 /* radix not in range 2-36 */ +#define GENERIC_NEGATIVE 2 /* parameter is negative */ +#define GENERIC_BADSTRING 3 /* argument is not a string */ +#define GENERIC_BADLIST 4 /* argument is not a list */ + +#define IF_SPECIFIED(arg) (arg).specified ? &((arg).value) : NULL + +#define UPANDOUT_NORMAL 1 +#define UPANDOUT_COLLON 2 +#define UPANDOUT_HASH 4 /* only useful inside a ~{ iteration + * forces loop finalization. */ + +#define ITERATION_NORMAL 1 +#define ITERATION_LAST 2 + +/* + * Types + */ +/* parameter to format */ +typedef struct { + unsigned int achar : 1; /* value was specified as a character */ + unsigned int specified : 1; /* set if value was specified */ + unsigned int offset : 30; /* offset in format string, for error printing */ + int value; +} FmtArg; + +/* information about format parameters */ +typedef struct { + unsigned int atsign : 1; /* @ specified */ + unsigned int collon : 1; /* : specified */ + unsigned int command : 8; /* the format command */ + unsigned int count : 4; /* number of arguments processed */ + unsigned int offset : 10; /* offset in format string, for error printing */ + char *base, *format; + FmtArg arguments[MAXFMT]; +} FmtArgs; + +/* used for combining default format parameter values */ +typedef struct { + int achar; + int value; +} FmtDef; + +/* number of default format parameter values and defaults */ +typedef struct { + int count; + FmtDef defaults[MAXFMT]; +} FmtDefs; + +/* used on recursive calls to LispFormat */ +typedef struct { + FmtArgs args; + LispObj *base_arguments; /* pointer to first format argument */ + int total_arguments; /* number of objects in base_arguments */ + char **format; /* if need to update format string pointer */ + LispObj **object; /* CAR(arguments), for plural check */ + LispObj **arguments; /* current element of base_arguments */ + int *num_arguments; /* number of arguments after arguments */ + int upandout; /* information for recursive calls */ + int iteration; /* only set if in ~:{... or ~:@{ and in the + * last argument list, hint for upandout */ +} FmtInfo; + +/* + * Prototypes + */ +static void merge_arguments(FmtArgs*, FmtDefs*, int*); +static char *parse_arguments(char*, FmtArgs*, int*, LispObj**, int*); +static void merge_error(FmtArgs*, int); +static void parse_error(FmtArgs*, int); +static void generic_error(FmtArgs*, int); +static void format_error(FmtArgs*, char*); + +static int format_object(LispObj*, LispObj*); + +static void format_ascii(LispObj*, LispObj*, FmtArgs*); +static void format_in_radix(LispObj*, LispObj*, int, FmtArgs*); +static void format_radix_special(LispObj*, LispObj*, FmtArgs*); +static void format_roman(LispObj*, LispObj*, FmtArgs*); +static void format_english(LispObj*, LispObj*, FmtArgs*); +static void format_character(LispObj*, LispObj*, FmtArgs*); +static void format_fixed_float(LispObj*, LispObj*, FmtArgs*); +static void format_exponential_float(LispObj*, LispObj*, FmtArgs*); +static void format_general_float(LispObj*, LispObj*, FmtArgs*); +static void format_dollar_float(LispObj*, LispObj*, FmtArgs*); +static void format_tabulate(LispObj*, FmtArgs*); + +static void format_goto(FmtInfo*); +static void format_indirection(LispObj*, LispObj*, FmtInfo*); + +static void list_formats(FmtInfo*, int, char**, char***, int*, int*, int*, int*); +static void free_formats(char**, int); + +static void format_case_conversion(LispObj*, FmtInfo*); +static void format_conditional(LispObj*, FmtInfo*); +static void format_iterate(LispObj*, FmtInfo*); +static void format_justify(LispObj*, FmtInfo*); + +static void LispFormat(LispObj*, FmtInfo*); + /* * Initialization */ -static char *BadArgument = "bad argument to directive, at %s"; -/* not very descriptive... */ +static FmtDefs AsciiDefs = { + 4, + { + {0, 0}, /* mincol */ + {0, 1}, /* colinc */ + {0, 0}, /* minpad */ + {1, ' '}, /* padchar */ + }, +}; + +static FmtDefs IntegerDefs = { + 4, + { + {0, 0}, /* mincol */ + {1, ' '}, /* padchar */ + {1, ','}, /* commachar */ + {0, 3}, /* commainterval */ + }, +}; + +static FmtDefs RadixDefs = { + 5, + { + {0, 10}, /* radix */ + {0, 0}, /* mincol */ + {1, ' '}, /* padchar */ + {1, ','}, /* commachar */ + {0, 3}, /* commainterval */ + }, +}; + +static FmtDefs NoneDefs = { + 0, +}; + +static FmtDefs FixedFloatDefs = { + 5, + { + {0, 0}, /* w */ + {0, 16}, /* d */ + {0, 0}, /* k */ + {1, '\0'}, /* overflowchar */ + {1, ' '}, /* padchar */ + }, +}; + +static FmtDefs ExponentialFloatDefs = { + 7, + { + {0, 0}, /* w */ + {0, 16}, /* d */ + {0, 0}, /* e */ + {0, 1}, /* k */ + {1, '\0'}, /* overflowchar */ + {1, ' '}, /* padchar */ + {1, 'E'}, /* exponentchar */ + /* XXX if/when more than one float format, + * should default to object type */ + }, +}; + +static FmtDefs DollarFloatDefs = { + 4, + { + {0, 2}, /* d */ + {0, 1}, /* n */ + {0, 0}, /* w */ + {1, ' '}, /* padchar */ + }, +}; + +static FmtDefs OneDefs = { + 1, + { + {0, 1}, + }, +}; + +static FmtDefs TabulateDefs = { + 2, + { + {0, 0}, /* colnum */ + {0, 1}, /* colinc */ + }, +}; -extern char *LispCharNames[]; +extern LispObj *Oprint_escape; /* * Implementation */ -LispObj * -Lisp_Format(LispMac *mac, LispObj *list, char *fname) +static void +merge_arguments(FmtArgs *arguments, FmtDefs *defaults, int *code) { - int len, princ = mac->princ, newline = mac->newline, tmp, nindirection = 0; - int num_args, cur_arg, iteration = -1; - char *fmt, stk[1024], **indirection = NULL, *ptr, *str = NULL; - LispObj *stream, *format, *arguments, *arg, *plural, *obj, *ilist, *sargs, - *alist; - unsigned char *uptr; - - sargs = NIL; /* place to temporarily save arguments, num_args and cur_arg */ - stream = CAR(list); - list = CDR(list); - if ((format = CAR(list))->type != LispString_t) - LispDestroy(mac, "expecting string, at %s", fname); - list = CDR(list); - arg = arguments = list; - - /* count number of arguments */ - for (num_args = cur_arg = 0; arg->type == LispCons_t; arg = CDR(arg)) - ++num_args; - arg = arguments; - - if (stream == NIL) { - stream = LispNew(mac, NIL, NIL); - stream->type = LispStream_t; - stream->data.stream.source.str = NULL; - stream->data.stream.size = 0; - stream->data.stream.idx = 0; + int count; + FmtDef *defaul; + FmtArg *argument; + + defaul = &(defaults->defaults[0]); + argument = &(arguments->arguments[0]); + for (count = 0; count < defaults->count; count++, argument++, defaul++) { + if (count >= arguments->count) + argument->specified = 0; + if (argument->specified) { + if (argument->achar != defaul->achar) { + *code = defaul->achar ? MERGE_NOCHAR : MERGE_NOINT; + arguments->offset = argument->offset; + return; + } + } + else { + argument->specified = 0; + argument->achar = defaul->achar; + argument->value = defaul->value; + } } - else if (stream == T) - stream = NIL; - else if (stream->type != LispStream_t) - LispDestroy(mac, "%s is not a stream, at %s", - LispStrObj(mac, stream), fname); - - /* ilist is used to store the previous/original stream and a description - * of the formating directive. - */ - ilist = CONS(CONS(NIL, stream), NIL); - /* alist is used to store saved data, to allow temporarily saving - * arguments or data when processing complex directives. - */ - alist = NIL; - - plural = NIL; - len = 0; - fmt = STRPTR(format); - while (1) { - if (*fmt == '\0') { - if (iteration >= 0 && STRPTR(CAR(CAR(ilist)))[0] == '{') { - int done = 0; - - if (iteration != 0 && --iteration == 0) { - iteration = -1; - done = 1; - } - fmt = indirection[(int)CAR(alist)->data.real + 1]; - if (STRPTR(CAR(CAR(ilist)))[1] == '@') { - /* using normal arguments */ - if (STRPTR(CAR(CAR(ilist)))[2] == ':') { - if (CDR(CAR(alist))->type == LispCons_t) { - CAR(alist) = CDR(CAR(alist)); - plural = NIL; - arg = CAR(CAR(alist)); - if (arg->type != LispCons_t) - LispDestroy(mac, BadArgument, fname); - arguments = obj = arg; - for (num_args = cur_arg = 0; obj->type == LispCons_t; - obj = CDR(obj)) - ++num_args; - } - else if (CDR(CAR(alist)) != NIL) - goto not_enough_args; - else - done = 1; /* no more arguments */ - } - else if (arg == NIL) - done = 1; + + /* check if extra arguments were provided */ + if (arguments->count > defaults->count) + *code = MERGE_2MANY; +} + +/* the pointer arguments may be null, useful when just testing/parsing + * the directive parameters */ +static char * +parse_arguments(char *format, FmtArgs *arguments, + int *num_objects, LispObj **objects, int *code) +{ + int test; + char *ptr; + FmtArg *argument; + unsigned int tmpcmd = 0; + + /* initialize */ + test = objects == NULL || code == NULL || num_objects == NULL; + ptr = format; + argument = &(arguments->arguments[0]); + arguments->atsign = arguments->collon = arguments->command = 0; + + /* parse format parameters */ + for (arguments->count = 0;; arguments->count++) { + arguments->offset = ptr - format + 1; + if (arguments->count >= MAXFMT) { + if (!test) + *code = PARSE_2MANYPARM; + return (ptr); + } + if (*ptr == '\'') { /* character parameter value */ + ++ptr; /* skip ' */ + argument->achar = argument->specified = 1; + argument->value = *ptr++; + } + else if (*ptr == ',') { /* use default parameter value */ + argument->achar = 0; + argument->specified = 0; + /* don't increment ptr, will be incremented below */ + } + else if (*ptr == '#') { /* number of arguments is value */ + ++ptr; /* skip # */ + argument->achar = 0; + argument->specified = 1; + if (!test) + argument->value = *num_objects; + } + else if (*ptr == 'v' || + *ptr == 'V') { /* format object argument is value */ + LispObj *object; + + ++ptr; /* skip V */ + if (!test) { + if (!CONSP(*objects)) { + *code = PARSE_NOARGSLEFT; + return (ptr); + } + object = CAR((*objects)); + if (FIXNUMP(object)) { + argument->achar = 0; + argument->specified = 1; + argument->value = FIXNUM_VALUE(object); + } + else if (SCHARP(object)) { + argument->achar = argument->specified = 1; + argument->value = SCHAR_VALUE(object); } else { - if (STRPTR(CAR(CAR(ilist)))[1] == ':') { - if (CDR(CAR(CAR(alist)))->type == LispCons_t) { - CAR(CAR(alist)) = CDR(CAR(CAR(alist))); - arg = CAR(CAR(CAR(alist))); - if (arg->type != LispCons_t) - LispDestroy(mac, BadArgument, fname); - arguments = obj = arg; - for (num_args = cur_arg = 0; obj->type == LispCons_t; - obj = CDR(obj)) - ++num_args; - } - else if (CDR(CAR(CAR(alist))) != NIL) - goto not_enough_args; - else - done = 1; - } - else if (arg->type != LispCons_t) { - arg = CAR(ilist); - done = 1; - } - if (arg->type != LispCons_t) - done = 1; /* no more arguments */ + *code = PARSE_BADFMTARG; + return (ptr); } - if (done) { - iteration = -1; - nindirection = (int)CAR(alist)->data.real; - fmt = indirection[nindirection]; - if (STRPTR(CAR(CAR(ilist)))[1] == ':' || - STRPTR(CAR(CAR(ilist)))[2] == ':') { - arg = CDR(CDR(CAR(ilist))); - plural = NIL; - arguments = CAR(CAR(sargs)); - num_args = (int)CAR(CDR(CAR(sargs)))->data.real; - cur_arg = (int)CDR(CDR(CAR(sargs)))->data.real; - sargs = CDR(sargs); - } - ilist = CDR(ilist); - alist = CDR(alist); - stream = CDR(CAR(ilist)); - } + *objects = CDR(*objects); + --*num_objects; } - else if (nindirection) - fmt = indirection[--nindirection]; - else - break; - continue; } - if (*fmt == '~') { - char *end; - int radix = 10, mincol = 0, minpad = 0, colinc = 1, padchar = ' '; - int argc, nargs[7], defs[7], padidx, isradix, isprinc, ise; - int atsign = 0, collon = 0; - int w = 0, d = 1, e = 1, k = 0, n = 1, overidx, overflowchar = 0, - expidx, exponentchar = 'E', colnum = 1, hash = -1; - - if (len) { - stk[len] = '\0'; - mac->column += LispPrintf(mac, stream, "%s", stk); - len = 0; - } - ++fmt; - argc = 0; - padidx = overidx = expidx = -1; /* minimal error check */ - while (1) { - if (*fmt == ',') { /* use default value */ - ++fmt; - defs[argc] = 1; - } - else if (*fmt == '-' || *fmt == '+' || - isdigit(*fmt)) { /* mincol specified */ - nargs[argc] = strtol(fmt, &end, 10); - defs[argc] = 0; - fmt = end; - if (*fmt == ',') /* more args */ - ++fmt; - } - else if (*fmt == '\'') { /* use default value */ - ++fmt; - if (overidx != 1) - expidx = argc; - else { - overidx = padidx; - padidx = argc; + else if (isdigit(*ptr) || + *ptr == '-' || *ptr == '+') { /* integer parameter value */ + int sign; + + argument->achar = 0; + argument->specified = 1; + if (!isdigit(*ptr)) { + sign = *ptr++ == '-'; + } + else + sign = 0; + if (!test && !isdigit(*ptr)) { + *code = PARSE_BADINTEGER; + return (ptr); + } + argument->value = *ptr++ - '0'; + while (isdigit(*ptr)) { + argument->value = (argument->value * 10) + (*ptr++ - '0'); + if (argument->value > 65536) { + if (!test) { + *code = PARSE_BADINTEGER; + return (ptr); } - if (!*fmt) - goto error_parsing; - nargs[argc] = *fmt++; - defs[argc] = 0; - if (*fmt == ',') /* more args */ - ++fmt; - } - else if (*fmt == ':') { - ++fmt; - collon = 1; - continue; } - else if (*fmt == '@') { - ++fmt; - atsign = 1; - continue; + } + if (sign) + argument->value = -argument->value; + } + else /* no more arguments to format */ + break; + + if (*ptr == ',') + ++ptr; + + /* remember offset of format parameter, for better error printing */ + argument->offset = arguments->offset; + argument++; + } + + /* check for extra flags */ + for (;;) { + if (*ptr == '@') { /* check for special parameter atsign */ + if (arguments->atsign) { + if (!test) { + *code = PARSE_2MANYATS; + return (ptr); } - else if (*fmt == '#') { - nargs[argc] = num_args - cur_arg; - ++fmt; - hash = argc; - defs[argc] = 0; - if (*fmt == ',') /* more args */ - ++fmt; + } + ++ptr; + ++arguments->offset; + arguments->atsign = 1; + } + else if (*ptr == ':') { /* check for special parameter collon */ + if (arguments->collon) { + if (!test) { + *code = PARSE_2MANYCOLS; + return (ptr); } - else - break; - if (++argc > sizeof(nargs) / sizeof(nargs[0])) - LispDestroy(mac, "too many arguments to directive, at %s", - fname); - } - - switch (*fmt) { - case 'a': /* Ascii */ - case 'A': /* ~mincol,colinc,minpad,padcharA */ - isprinc = 1; - goto print_object; - case 'b': /* Binary */ - case 'B': /* ~mincol,padchar,commacharB */ - isradix = 0; - radix = 2; - goto print_number; - case 'w': /* Write */ - case 'W': /* XXX must output identically to write */ - case 's': /* S-expression */ - case 'S': /* ~mincol,colinc,minpad,padcharS */ - isprinc = 0; - goto print_object; - case 'd': /* Decimal */ - case 'D': /* ~mincol,padcharD */ - isradix = 0; - radix = 10; - goto print_number; - case 'o': /* Octal */ - case 'O': /* ~mincol,padchar,commacharB */ - isradix = 0; - radix = 8; - goto print_number; - case 'x': /* Hexadecimal */ - case 'X': /* ~mincol,padchar,commacharB */ - isradix = 0; - radix = 16; - goto print_number; - case 'r': /* Radix */ - case 'R': /* ~radix,mincol,padchar,commacharR */ - isradix = 1; - goto print_number; - case 'p': /* Plural */ - case 'P': - mac->newline = 0; - if (collon) { - if (plural != NIL) - arg = plural; - else - plural = arg; - if (plural->type != LispCons_t) - goto not_enough_args; - } - else { - if (arg->type != LispCons_t) - goto not_enough_args; - plural = arg; - } - if (!NUMBER_P(CAR(plural)) || - NUMBER_VALUE(CAR(plural)) != 1) { - if (atsign) - mac->column += LispPrintf(mac, stream, "ies"); - else - mac->column += LispPrintf(mac, stream, "s"); - } - else { - if (atsign) - mac->column += LispPrintf(mac, stream, "y"); - } - break; - case 'c': /* Character */ - case 'C': - if (arg->type != LispCons_t) - goto not_enough_args; - if (CAR(arg)->type != LispCharacter_t) - LispDestroy(mac, "expecting character, at %s", fname); - mac->newline = atsign || collon || - CAR(arg)->data.integer != '\n'; - if (atsign && !collon) - mac->column += LispPrintf(mac, stream, "#\\"); - if ((atsign || collon) && - (CAR(arg)->data.integer <= ' ' || - CAR(arg)->data.integer == 0177)) - mac->column += - LispPrintf(mac, stream, "%s", - CAR(arg)->data.integer == 0177 ? - "Rubout" : - LispCharNames[CAR(arg)->data.integer]); - else - mac->column += LispPrintf(mac, stream, "%c", - CAR(arg)->data.integer); - break; - case 'f': /* Floating-point */ - case 'F': /* ~w,d,k,overflowchar,padcharF */ - ise = 0; - goto print_float_number; - case 'e': /* Exponential floating-point */ - case 'E': /* ~w,d,e,k,overflowchar,padchar,exponentcharE */ - ise = 1; - goto print_float_number; - case 'g': /* General floating-point */ - case 'G': /* ~w,d,e,k,overflowchar,padchar,exponentcharG */ - ise = 1; - goto print_float_number; - case '$': /* Dollars floating-point */ - /* ~d,n,w,padchar$ */ - ise = 0; - goto print_float_number; - case '&': - if (mac->newline) - len = -1; - case '%': - if (argc && !defs[0]) - len += nargs[0]; - else - len += 1; - if (padidx >= 0) - LispDestroy(mac, BadArgument, fname); - if (len > 0) { - mac->newline = 1; - mac->column = 0; - } - while (len > 0) { - LispPrintf(mac, stream, "\n"); - --len; - } - len = 0; - ++fmt; - /* no arguments used */ - continue; - case '~': - if (argc && !defs[0]) - len = nargs[0]; - else - len = 1; - if (padidx >= 0) - LispDestroy(mac, BadArgument, fname); - while (len) { - mac->column += LispPrintf(mac, stream, "~"); - --len; - } - ++fmt; - /* no arguments used */ - continue; - case '|': - if (argc && !defs[0]) - len = nargs[0]; - else - len = 1; - if (padidx >= 0) - LispDestroy(mac, BadArgument, fname); - if (len > 0) { - mac->newline = 1; - mac->column = 0; - } - while (len) { - LispPrintf(mac, stream, "\f"); - --len; - } - ++fmt; - /* no arguments used */ - continue; - case '\n': - ++fmt; - while (*fmt && isspace(*fmt)) { - if (collon) /* if collon, don't ignore following - * whitespaces, just the leading newline - */ - mac->column += LispPrintf(mac, stream, "%c", *fmt); - ++fmt; - } - /* no arguments used */ - continue; - case 't': /* Tabulate */ - case 'T': /* ~colnum,colincT */ - if (argc && !defs[0]) - colnum = nargs[0]; - if (argc > 1 && !defs[1]) - colinc = nargs[1]; - if (!atsign) { - if (mac->column < colnum) { - /* output spaces until mac->column == colnum */ - while (mac->column < colnum) - mac->column += - LispPrintf(mac, stream, "%c", ' '); - } - else { - /* output colinc spaces */ - while (colinc > 0) { - mac->column += - LispPrintf(mac, stream, "%c", ' '); - --colinc; - } - } - } - else { - /* relative tabulation, use colnum as colrel */ - while (colnum > 0) { - /* outputs colrel spaces */ - mac->column += LispPrintf(mac, stream, "%c", ' '); - --colnum; - } - if (colinc > 0) { - /* outputs spaces until mac->column is - * multiple of colinc */ - while (mac->column % colinc) - mac->column += - LispPrintf(mac, stream, "%c", ' '); - } - } - ++fmt; - /* no arguments used */ - continue; - case '*': /* ignore/jump to argument */ - len = 1; - if (argc && !defs[0]) - len = nargs[0]; - - if (len < 0 || argc > 1) - LispDestroy(mac, BadArgument, fname); - - if (!collon && !atsign) { - /* forward */ - if (arg->type != LispCons_t) - goto not_enough_args; - while (len) { - plural = arg; - if ((arg = CDR(arg)) == NIL) - break; - ++cur_arg; - --len; - } - } - else { - /* count how many arguments processed */ - for (tmp = 0, plural = arguments; plural != arg; - tmp++, plural = CDR(plural)) - ; - tmp -= len; - plural = NIL; - arg = arguments; - cur_arg = 0; - - if (!atsign) /* backwards, else goto argument */ - len = tmp; - if (len > 0) - for (tmp = 0; tmp < len; - tmp++, plural = arg, arg = CDR(arg)) - cur_arg++; - } - len = 0; - ++fmt; - /* no arguments used */ - continue; - case '?': /* Indirection */ - if (atsign) { - /* cannot be implemented calling Lisp_Format - * recursively, as we don't know how many arguments - * will be (un)consumed */ - - if (arg->type != LispCons_t) - goto not_enough_args; - if (!STRING_P(CAR(arg))) - LispDestroy(mac, "expecting string, at %s", fname); - indirection = LispRealloc(mac, indirection, - sizeof(char*) * - (nindirection + 1)); - indirection[nindirection++] = ++fmt; - fmt = STRPTR(CAR(arg)); - plural = arg; - arg = CDR(arg); - ++cur_arg; - /* don't increment fmt */ - continue; - } - else { - LispObj *fmt, *lst; + } + ++ptr; + ++arguments->offset; + arguments->collon = 1; + } + else /* next value is format command */ + break; + } - if (arg->type != LispCons_t) - goto not_enough_args; - fmt = CAR(arg); - arg = CDR(arg); - ++cur_arg; - if (arg->type != LispCons_t) - goto not_enough_args; - lst = CAR(arg); - GCProtect(); - Lisp_Format(mac, CONS(stream, CONS(fmt, lst)), fname); - GCUProtect(); - } - break; + if (!test) + *code = NOERROR; + arguments->command = *ptr++; + tmpcmd = arguments->command; + if (islower(tmpcmd)) + arguments->command = toupper(tmpcmd); + ++arguments->offset; - /* Here start the "complex" format directives */ - case '(': /* Case-conversion start */ - if (argc) - LispDestroy(mac, BadArgument, fname); - /* format the data in a temporary stream */ - GCProtect(); - obj = LispNew(mac, NIL, NIL); - obj->type = LispStream_t; - obj->data.stream.source.str = NULL; - obj->data.stream.size = 0; - obj->data.stream.idx = 0; - stk[len++] = '('; - if (atsign) - stk[len++] = '@'; - if (collon) - stk[len++] = ':'; - stk[len] = '\0'; - ilist = CONS(CONS(STRING(stk), obj), ilist); - alist = CONS(NIL, alist); - GCUProtect(); - stream = obj; - len = 0; - ++fmt; - /* no arguments used */ - continue; - case ')': /* Case-conversion end */ - if (argc) - LispDestroy(mac, BadArgument, fname); - if (CAR(CAR(ilist)) == NIL || - STRPTR(CAR(CAR(ilist)))[0] != '(') - LispDestroy(mac, "mismatched ~), at %s", fname); - /* remember if atsign and/or collon was set */ - strcpy(stk, STRPTR(CAR(CAR(ilist)))); - len = 1; - if (stk[len] == '@') { - atsign = 1; - ++len; - } - else - atsign = 0; - if (stk[len] == ':') - collon = 1; - else - collon = 0; + return (ptr); +} - if ((uptr = stream->data.stream.source.str) != NULL) { - if (atsign && collon) { /* uppercase everything */ - while (*uptr) { - *uptr = toupper(*uptr); - ++uptr; - } - } - else if (atsign) { /* capitalizes the first word */ - while (*uptr && !isalpha(*uptr)) - ++uptr; - if (*uptr) { - *uptr = toupper(*uptr); - ++uptr; - } - while (*uptr) { - *uptr = tolower(*uptr); - ++uptr; - } - } - else if (collon) { /* capitalizes all words */ - while (*uptr) { - while (*uptr && !isalpha(*uptr)) - ++uptr; - if (*uptr) { - *uptr = toupper(*uptr); - ++uptr; - } - while (*uptr && isalpha(*uptr)) { - *uptr = tolower(*uptr); - ++uptr; - } - } - } - else { /* lowercase everything */ - while (*uptr) { - *uptr = tolower(*uptr); - ++uptr; - } - } - uptr = stream->data.stream.source.str; - } - ilist = CDR(ilist); - alist = CDR(alist); - stream = CDR(CAR(ilist)); - if (uptr) - mac->column += LispPrintf(mac, stream, "%s", uptr); - len = 0; - ++fmt; - /* no arguments used */ - continue; - case '[': { /* Conditional-expression start */ - char *end, **fields; - int field, nfields, obrack, oless, def; - int done = 0, scollon = 0; - - if (argc > 1) - LispDestroy(mac, BadArgument, fname); - - def = field = -1; - obrack = 1; - fields = NULL; - nfields = oless = 0; - /* split fields as strings, to allow easier processing */ - ptr = str = fmt + 1; - while (!done) { - switch (*ptr) { - case '~': - scollon = 0; - end = ptr; /* "maybe" end */ - ++ptr; - while (*ptr) { - if (*ptr == ',' || *ptr == '@' || - *ptr == '#' || *ptr == '+' || - *ptr == '-' || isdigit(*ptr)) - ++ptr; - else if (*ptr == '\'') { - ++ptr; - if (!*ptr) - goto error_parsing; - ++ptr; - } - else if (*ptr == ':') { - scollon = 1; - ++ptr; - } - else /* a directive was found */ - break; - } - if (*ptr == '<') - ++oless; - else if (*ptr == '>') - --oless; /* don't check if smaller than - * zero. this may be a condition - * that will never be evaluated - */ - else if (*ptr == '[') - ++obrack; - else if (*ptr == ']' || *ptr == ';') { - if (obrack == 1 && *ptr == ']') - done = 1; - if (oless <= 0 && obrack == 1) { - fields = LispRealloc(mac, fields, - sizeof(char*) * - (nfields + 1)); - len = end - str; - fields[nfields] = LispMalloc(mac, len + 1); - strncpy(fields[nfields], str, len); - fields[nfields][len] = '\0'; - if (scollon) - def = nfields + 1; - ++nfields; - str = ptr + 1; - } - if (*ptr == ']') - --obrack; - } - ++ptr; - break; - case '\0': - goto error_parsing; - default: - ++ptr; - break; - } - } - fmt = ptr; +static void +parse_error(FmtArgs *args, int code) +{ + static char *errors[] = { + NULL, + "too many parameters to directive", + "too many @ parameters", + "too many : parameters", + "no arguments left to format", + "argument is not a fixnum integer or a character", + "unknown format directive", + "parameter is not a fixnum integer", + }; - if (collon) { - if (arg->type != LispCons_t) - goto not_enough_args; - if (CAR(arg) == NIL) { - if (nfields && fields[0][0]) - field = 0; - } - else if (nfields > 1 && fields[1][0]) - field = 1; - /* don't update plural, just consume argument */ - arg = CDR(arg); - ++cur_arg; - } - else if (atsign) { - if (arg->type != LispCons_t) - goto not_enough_args; - if (CAR(arg) == NIL) { - plural = arg; - arg = CDR(arg); - ++cur_arg; - } - else if (nfields && fields[0][0]) - field = 0; - } - else if (argc && !defs[0]) { - if (nargs[0] < nfields) - field = nargs[0]; - else if (def >= 0) - field = def; - } - else { - if (arg->type != LispCons_t) - goto not_enough_args; - if (!INTEGER_P(CAR(arg))) - LispDestroy(mac, "%s is not an index, at %s", - LispStrObj(mac, CAR(arg)), fname); - if (NUMBER_VALUE(CAR(arg)) < nfields && - NUMBER_VALUE(CAR(arg)) >= 0) - field = NUMBER_VALUE(CAR(arg)); - else if (def >= 0) - field = def; - plural = arg; - arg = CDR(arg); - ++cur_arg; - } - if (field >= 0 && field < nfields) { - indirection = LispRealloc(mac, indirection, - sizeof(char*) * - (nindirection + 1)); - indirection[nindirection++] = fmt; - GCProtect(); - fmt = STRPTR(STRING(fields[field])); - GCUProtect(); - } - while (--nfields >= 0) - LispFree(mac, fields[nfields]); - LispFree(mac, fields); - len = 0; - /* if any argument used, already updated arg */ - } continue; - case ']': /* Conditional-expression end */ - LispDestroy(mac, "mismatched ~], at %s", fname); - case '{': { /* Iteration start */ - int op = 1, scollon = 0, done = 0; - char *end; - - if (argc > 1) - LispDestroy(mac, BadArgument, fname); - - /* how many iterations, 0 means until all arguments are - * consumed */ - iteration = 0; - if (argc && !defs[0]) - iteration = nargs[0]; - - ptr = str = ++fmt; - while (!done) { - switch (*ptr) { - case '~': - scollon = 0; - end = ptr; /* "maybe" end */ - ++ptr; - while (*ptr) { - if (*ptr == ',' || *ptr == '@' || - *ptr == '#' || *ptr == '+' || - *ptr == '-' || isdigit(*ptr)) - ++ptr; - else if (*ptr == '\'') { - ++ptr; - if (!*ptr) - goto error_parsing; - ++ptr; - } - else if (*ptr == ':') { - scollon = 1; - ++ptr; - } - else /* a directive was found */ - break; - } - if (*ptr == '{') - ++op; - else if (*ptr == '}') { - if (--op == 0) { - char *st = str; - - len = end - str; - str = LispMalloc(mac, len + 1); - strncpy(str, st, len); - str[len] = '\0'; - done = 1; - ++ptr; - continue; /* i.e. break the loop */ - } - } - ++ptr; - break; - case '\0': - goto error_parsing; - default: - ++ptr; - break; - } - } - if (iteration == -1 && (!argc || !defs[0])) - iteration = scollon; /* iterate at least once, if scollon */ - else if (iteration <= 0 && scollon) - iteration = 1; - if (iteration < 0 || - (iteration == 0 && argc && !defs[0])) { - /* if no iterations were requested */ - if (!atsign) { - /* consume one element even if no iterations */ - if (arg->type != LispCons_t) - goto not_enough_args; - plural = arg; - arg = CDR(arg); - ++cur_arg; - fmt = ptr; - iteration = -1; - LispFree(mac, str); - /* don't need to do anything more... */ - continue; - } - else if (arg->type != LispCons_t) { - /* no arguments left, don't even start iteration */ - fmt = ptr; - iteration = -1; - LispFree(mac, str); - continue; - } - } + format_error(args, errors[code]); +} - if (!atsign) { /* need to check for errors later */ - if (arg->type != LispCons_t) - LispDestroy(mac, BadArgument, fname); - if (collon && CAR(arg)->type != LispCons_t) - LispDestroy(mac, BadArgument, fname); - } +static void +merge_error(FmtArgs *args, int code) +{ + static char *errors[] = { + NULL, + "too many parameters to directive", + "argument must be a character", + "argument must be a fixnum integer", + }; - end = ptr; - /* if got here, than no errors detected so far */ - if (!*str) { - /* if string is empty, use next argument as control - * string */ - LispFree(mac, str); - if (arg->type != LispCons_t) - goto not_enough_args; - else if (!STRING_P(CAR(arg))) - LispDestroy(mac, "expecting string, at %s", fname); - ptr = STRPTR(CAR(arg)); - plural = arg; - arg = CDR(arg); - ++cur_arg; - } - else { - GCProtect(); - ptr = STRPTR(STRING(str)); - LispFree(mac, str); - GCUProtect(); - } + format_error(args, errors[code]); +} - len = 0; - stk[len++] = '{'; - if (atsign) - stk[len++] = '@'; - if (collon) - stk[len++] = ':'; - stk[len] = '\0'; - GCProtect(); - ilist = CONS(CONS(STRING(stk), stream), ilist); - alist = CONS(REAL((double)nindirection), alist); - if (!atsign) { - CAR(alist) = collon ? - CONS(CAR(arg), CDR(arg)) : CDR(arg); - plural = NIL; - arg = collon ? CAR(CAR(arg)) : CAR(arg); - sargs = CONS(CONS(arguments, - CONS(REAL((double)num_args), - REAL((double)cur_arg))), sargs); - arguments = obj = arg; - for (num_args = cur_arg = 0; obj->type == LispCons_t; - obj = CDR(obj)) - ++num_args; - } - else if (collon && arg->type == LispCons_t) { - CAR(alist) = arg; - plural = NIL; - arg = CAR(arg); - sargs = CONS(CONS(arguments, - CONS(REAL((double)num_args), - REAL((double)cur_arg))), sargs); - arguments = obj = arg; - for (num_args = cur_arg = 0; obj->type == LispCons_t; - obj = CDR(obj)) - ++num_args; - } - GCUProtect(); - indirection = LispRealloc(mac, indirection, - sizeof(char*) * - (nindirection + 2)); - indirection[nindirection++] = end; - indirection[nindirection++] = ptr; - len = 0; - fmt = ptr; - } continue; - case '}': /* Iteration end */ - LispDestroy(mac, "mismatched ~}, at %s", fname); - case '<': /* Justification start */ - len = 0; - stk[len++] = '<'; - if (atsign) - stk[len++] = '@'; - if (collon) - stk[len++] = ':'; - stk[len] = '\0'; - if (argc && !defs[0]) - mincol = nargs[0]; - if (argc > 1 && !defs[1]) - colinc = nargs[1]; - if (argc > 2 && !defs[2]) - minpad = nargs[2]; - if (argc > 3 && !defs[3]) - padchar = nargs[3]; - if (argc > 4 || (padidx != -1 && padidx != 3)) - LispDestroy(mac, BadArgument, fname); - GCProtect(); - obj = LispNew(mac, NIL, NIL); - obj->type = LispStream_t; - obj->data.stream.source.str = NULL; - obj->data.stream.size = 0; - obj->data.stream.idx = 0; - stream = obj; - ilist = CONS(CONS(STRING(stk), obj), ilist); - alist = CONS(CONS(NIL, CONS(obj, NIL)), alist); - obj = CONS(REAL((double)mincol), - CONS(REAL((double)colinc), - CONS(REAL((double)minpad), - CONS(REAL((double)padchar), - CONS(NIL, - CONS(NIL, - REAL((double)mac->column))))))); - /* chars after and line width, - * i.e. defaults for first - * parameter, if any. - */ - CAR(CAR(alist)) = obj; - GCUProtect(); - len = 0; - ++fmt; - /* no arguments used */ - continue; - case ';': /* separator for ~[ and ~<, in this code, - * only used for ~< */ - if (!STRING_P(CAR(CAR(ilist))) || - STRPTR(CAR(CAR(ilist)))[0] != '<') - LispDestroy(mac, "~; not allowed here, at %s", fname); - - GCProtect(); - if (collon && CDR(CDR(CAR(alist))) == NIL) { - double dtmp; - - if (argc && !defs[0]) { /* chars after */ - dtmp = nargs[0]; - CAR(CDR(CDR(CDR(CDR(CAR(CAR(alist))))))) = - REAL(dtmp); - } - if (argc > 1 && !defs[1]) { /* line width */ - dtmp = nargs[1]; - CAR(CDR(CDR(CDR(CDR(CDR(CAR(CAR(alist)))))))) = - REAL(dtmp); - } - } - obj = LispNew(mac, NIL, NIL); - obj->type = LispStream_t; - obj->data.stream.source.str = NULL; - obj->data.stream.size = 0; - obj->data.stream.idx = 0; - CDR(CAR(alist)) = CONS(obj, CDR(CAR(alist))); - stream = CDR(CAR(ilist)) = obj; - GCUProtect(); - ++fmt; - /* no arguments used */ - continue; - case '>': { /* Justification end */ - double left, inc; - int bytes, count, pos; - LispObj *charsafter, *linewidth, *pad, *otmp; - - if (argc) - LispDestroy(mac, BadArgument, fname); - if (CAR(CAR(ilist)) == NIL || - STRPTR(CAR(CAR(ilist)))[0] != '<') - LispDestroy(mac, "mismatched ~>, at %s", fname); - - /* remember if atsign and/or collon was set */ - strcpy(stk, STRPTR(CAR(CAR(ilist)))); - len = 1; - if (stk[len] == '@') { - atsign = 1; - ++len; - } - else - atsign = 0; - if (stk[len] == ':') - collon = 1; - else - collon = 0; +static void +generic_error(FmtArgs *args, int code) +{ + static char *errors[] = { + NULL, + "radix must be in the range 2 to 36, inclusive", + "parameter must be positive", + "argument must be a string", + "argument must be a list", + }; - /* restore parameters */ - obj = CAR(CAR(alist)); - mincol = (int)CAR(obj)->data.real; - colinc = (int)CAR(CDR(obj))->data.real; - minpad = (int)CAR(CDR(CDR(obj)))->data.real; - padchar = (int)CAR(CDR(CDR(CDR(obj))))->data.real; - charsafter = CAR(CDR(CDR(CDR(CDR(obj))))); - linewidth = CAR(CDR(CDR(CDR(CDR(CDR(obj)))))); - mac->column = (int)CDR(CDR(CDR(CDR(CDR(CDR(obj))))))-> - data.real; - - /* if use default for either charsafter or linewidth */ - GCProtect(); - if (charsafter != NIL && linewidth == NIL) - linewidth = REAL(72.0); - else if (charsafter == NIL && linewidth != NIL) - charsafter = REAL(0.0); - GCUProtect(); - - /* count number of fields and set pad variable */ - for (argc = bytes = 0, pad = obj = CDR(CAR(alist)); - obj != NIL; argc++, pad = obj, obj = CDR(obj)) { - if (CAR(obj)->data.stream.source.str) - bytes += strlen((char*) - CAR(obj)->data.stream.source.str); - } - if (charsafter == NIL) - pad = NIL; - else if (pad != NIL) - --argc; - - obj = LispReverse(CDR(CAR(alist))); - if (pad != NIL) { - obj = CDR(obj); - pad = CAR(pad); - if (pad->data.stream.source.str) - str = (char*)pad->data.stream.source.str; - else - str = ""; - bytes -= strlen(str); - } + format_error(args, errors[code]); +} - /* first, adds minpad, if any to strings */ - if (minpad) { - for (otmp = pad || collon ? obj : CDR(obj), tmp = 1; - otmp != NIL; - otmp = CDR(otmp), tmp++) { - len = CAR(obj)->data.stream.source.str ? - strlen((char*) - CAR(obj)->data.stream.source.str) : 0; - len += minpad + 1; - if (len > CAR(obj)->data.stream.size) { - ptr = realloc(CAR(obj)->data.stream.source.str, - len); - if (ptr == NULL) - LispDestroy(mac, "out of memory"); - CAR(obj)->data.stream.source.str = - (unsigned char*)ptr; - CAR(obj)->data.stream.size = len; - } - else - ptr = (char*)CAR(obj)->data.stream.source.str; - CAR(obj)->data.stream.idx = len; - if (len > minpad + 1 && (tmp < argc || !atsign)) - memmove(ptr + minpad, ptr, len - minpad); - if (tmp == argc && atsign) { /* right pad */ - int tlen = len; - - for (len -= minpad + 1; len < tlen; len++) - ptr[len] = padchar; - } - else { - len = minpad; - while (--len >= 0) - ptr[len] = padchar; - } - bytes += minpad; - } - } +static void +format_error(FmtArgs *args, char *str) +{ + char *message; + int errorlen, formatlen; - /* adjust mincol */ - if (colinc > 0) { - while (bytes > mincol) - mincol += colinc; - } - else if (mincol < bytes) - mincol = bytes; + /* number of bytes of format to be printed */ + formatlen = (args->format - args->base) + args->offset; - left = mincol - bytes; - if (left < 0) - left = 0; - if (argc > 1) { - if (collon ^ atsign) - inc = left / (double)argc; - else if (collon) - inc = left / (double)(argc + 1); - else - inc = left / (double)(argc - 1); - } - else - inc = left; + /* length of specific error message */ + errorlen = strlen(str) + 1; /* plus '\n' */ - ilist = CDR(ilist); - alist = CDR(alist); - stream = CDR(CAR(ilist)); - /* format strings in the output stream */ - for (tmp = pos = 0; obj != NIL; tmp++, obj = CDR(obj)) { - if (CAR(obj)->data.stream.source.str) - ptr = (char*)CAR(obj)->data.stream.source.str; - else - ptr = ""; - count = len = strlen(ptr); - if (pad != NIL && - mac->column + len + charsafter->data.real > - linewidth->data.real) { - char *nl; - - mac->column += LispPrintf(mac, stream, "%s", str); - if ((nl = strrchr(str, '\n')) != NULL) { - mac->column = 0; - ++nl; - while (*nl++) - ++mac->column; - } - } + /* XXX allocate string with LispMalloc, + * so that it will be freed in LispTopLevel */ + message = LispMalloc(formatlen + errorlen + 1); - if (tmp + 1 == argc) { - if (!atsign || collon) { - if (atsign) { - count += (int)(left / 2.0); - left -= (int)(left / 2.0); - } - else { - count += (int)left; - left -= (int)left; - } - } - else if (!atsign) { - count += (int)left; - left -= (int)left; - } - } - else if (tmp != 0 || collon) { - double dleft = left; + sprintf(message, "%s\n", str); + memcpy(message + errorlen, args->base, formatlen); + message[errorlen + formatlen] = '\0'; - left -= inc; - count += dleft - left; - if ((int)(left + 0.5) != (int)left) - ++count; - } + LispDestroy("FORMAT: %s", message); +} - while (len < count) { - mac->column += LispPrintf(mac, stream, - "%c", padchar); - ++len; - } - mac->column += LispPrintf(mac, stream, "%s", ptr); - } +static int +format_object(LispObj *stream, LispObj *object) +{ + int length; - while (left > 0.0) { - mac->column += LispPrintf(mac, stream, "%c", padchar); - left -= 1.0; - } + length = LispWriteObject(stream, object); - len = 0; - ++fmt; - /* no arguments used */ - } continue; - case '^': /* Up and out */ - if (argc > 3 || padidx != -1) - LispDestroy(mac, BadArgument, fname); - tmp = -1; - if (argc && !defs[0]) /* terminate if tmp == 0 */ - tmp = nargs[0]; - if (argc > 1 && !defs[1]) /* terminate if tmp == len */ - len = nargs[1]; - if (argc > 2 && !defs[2]) { /* if tmp <= len <= nargs[2] */ - if (tmp <= len && len <= nargs[2]) - tmp = 0; - else - tmp = 1; - } - if (argc == 2) - tmp = (len == tmp) ? 0 : 1; - len = 0; - - if (CAR(CAR(ilist)) != NIL && - STRPTR(CAR(CAR(ilist)))[0] == '{' && collon) { - /* needs special handling */ - LispObj *next = T; - - if (STRPTR(CAR(CAR(ilist)))[1] == '@' && - STRPTR(CAR(CAR(ilist)))[2] == ':') - next = CDR(CAR(alist)); - else if (STRPTR(CAR(CAR(ilist)))[1] == ':') - next = CDR(CAR(CAR(alist))); - - if (hash != -1 || next == NIL) { - if (next == NIL || - (hash != -1 && arg->type != LispCons_t)) { - while (*fmt) - ++fmt; - } - else - ++fmt; - if ((hash != -1 && arg->type != LispCons_t)) - iteration = 1; /* force finalization */ - continue; - } - } + return (length); +} - if (tmp == 0 || (tmp == -1 && arg->type != LispCons_t)) { - if (CAR(CAR(ilist)) != NIL) { - if (STRPTR(CAR(CAR(ilist)))[0] == '{') { - if (collon) { - /* passed the test above */ - ++fmt; - continue; - } - while (*fmt) - ++fmt; - } - else if (STRPTR(CAR(CAR(ilist)))[0] == '(') - fmt = "~)"; /* make the loop find - * the end... */ - else if (STRPTR(CAR(CAR(ilist)))[0] == '<') { - /* need to remove the last stream, to - * format correctly */ - if (CDR(CAR(alist)) != NIL) - /* don't need to update stream */ - CDR(CAR(alist)) = CDR(CDR(CAR(alist))); - fmt = "~>"; - } - } - else - goto format_done; - } - else - ++fmt; - /* no arguments used */ - continue; - default: - LispDestroy(mac, "unknown directive ~%c, at %s", - *fmt, fname); - } - ++fmt; - plural = arg; - arg = CDR(arg); - ++cur_arg; - continue; - -print_number: - mac->newline = 0; - if (arg->type != LispCons_t) - goto not_enough_args; - /* if not an integer */ - if (!INTEGER_P(CAR(arg))) { - /* print just as 'A' */ - isprinc = 1; - goto print_object; - } - else { - int sign; - long num = (long)NUMBER_VALUE(CAR(arg)); - - len = 0; - if ((sign = num < 0) != 0) - num = -num; - - /* check for radix */ - if (isradix) { - if (argc == 0 || defs[0]) { - radix = 0; - ++len; - goto print_number_args; - } - radix = nargs[0]; - ++len; - } - if (radix < 2 || radix > 32) - LispDestroy(mac, "radix must be in the range 2 to 32," - " at %s", fname); - -print_number_args: - /* get print arguments */ - if (len < argc && !defs[len]) - mincol = nargs[len]; - ++len; - if (len < argc && !defs[len]) - padchar = nargs[len]; - - if (padidx >= 0 && padidx != len) - LispDestroy(mac, BadArgument, fname); - - if (radix) { - len = 0; - do { - int val; - - val = num % radix; - num -= val; - num /= radix; - if (len) - memmove(stk + 1, stk, len); - *stk = val < 10 ? val + '0' : (val - 10) + 'A'; - ++len; - } while (num); - if (sign || atsign) { - memmove(stk + 1, stk, len); - *stk = sign ? '-' : '+'; - ++len; - } - } - else if (atsign) { /* roman */ - long num = (long)NUMBER_VALUE(CAR(arg)); +static void +format_ascii(LispObj *stream, LispObj *object, FmtArgs *args) +{ + GC_ENTER(); + LispObj *string = NIL; + int length = 0, + atsign = args->atsign, + collon = args->collon, + mincol = args->arguments[0].value, + colinc = args->arguments[1].value, + minpad = args->arguments[2].value, + padchar = args->arguments[3].value; + + /* check/correct arguments */ + if (mincol < 0) + mincol = 0; + if (colinc < 0) + colinc = 1; + if (minpad < 0) + minpad = 0; + /* XXX pachar can be the null character? */ + + if (object == NIL) + length = collon ? 2 : 3; /* () or NIL */ + + /* left padding */ + if (atsign) { + /* if length not yet known */ + if (object == NIL) { + string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + GC_PROTECT(string); + length = LispWriteObject(string, object); + } - if ((double)num != NUMBER_VALUE(CAR(arg)) || - num <= 0 || num > (3999 + (collon ? 1000 : 0))) - LispDestroy(mac, BadArgument, fname); - - /* if collon, print in old roman format */ - len = 0; - while (num > 1000) { - stk[len++] = 'M'; - num -= 1000; - } - if (!collon) { - if (num >= 900) { - strcpy(stk + len, "CM"); - len += 2, - num -= 900; - } - else if (num < 500 && num >= 400) { - strcpy(stk + len, "CD"); - len += 2; - num -= 400; - } - } - if (num >= 500) { - stk[len++] = 'D'; - num -= 500; - } - while (num >= 100) { - stk[len++] = 'C'; - num -= 100; - } + /* output minpad characters at left */ + if (minpad) { + length += minpad; + LispWriteChars(stream, padchar, minpad); + } - if (!collon) { - if (num >= 90) { - strcpy(stk + len, "XC"); - len += 2, - num -= 90; - } - else if (num < 50 && num >= 40) { - strcpy(stk + len, "XL"); - len += 2; - num -= 40; - } - } - if (num >= 50) { - stk[len++] = 'L'; - num -= 50; - } - while (num >= 10) { - stk[len++] = 'X'; - num -= 10; - } + if (colinc) { + /* puts colinc spaces at a time, + * until at least mincol chars out */ + while (length < mincol) { + LispWriteChars(stream, padchar, colinc); + length += colinc; + } + } + } - if (!collon) { - if (num == 9) { - strcpy(stk + len, "IX"); - len += 2, - num -= 9; - } - else if (num == 4) { - strcpy(stk + len, "IV"); - len += 2; - num -= 4; - } - } - if (num >= 5) { - stk[len++] = 'V'; - num -= 5; - } - while (num) { - stk[len++] = 'I'; - num -= 1; - } - } - else { /* english */ - len = 0; -#define SIGNLEN 6 /* strlen("minus ") */ - if (sign) { - strcpy(stk, "minus "); - len += SIGNLEN; - } - else if (num == 0) { - if (collon) { - strcpy(stk, "zeroth"); - len += 6; /*123456*/ - } - else { - strcpy(stk, "zero"); - len += 4; /*1234*/ - } - } - while (1) { - char *d, *h, *t; - int l, count = 0; - long val = num; - static char *ds[] = { - "", "one", "two", "three", - "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", - "twelve", "thirteen", "fourteen", "fifteen", - "sixteen", "seventeen", "eighteen", "nineteen" - }; - static char *dsth[] = { - "", "first", "second", - "third", "fourth", "fifth", - "sixth", "seventh", "eighth", - "ninth", "tenth", "eleventh", - "twelfth", "thirteenth", "fourteenth", - "fifteenth", "sixteenth", "seventeenth", - "eighteenth", "nineteenth" - }; - static char *hs[] = { - "", "", "twenty", "thirty", "forty", - "fifty", "sixty", "seventy", "eighty", "ninety" - }; - static char *hsth[] = { - "", "", "twentieth", "thirtieth", - "fortieth", "fiftieth", "sixtieth", "seventieth", - "eightieth", "ninetieth" - }; - static char *ts[] = { - "", "thousand", "million", "billion", "trillion" - }; - static char *tsth[] = { - "", "thousandth", "millionth", "billionth", - "trillionth" - }; - - while (val >= 1000) { - val /= 1000; - ++count; - } - if (count > sizeof(ts) / sizeof(ts[0])) - LispDestroy(mac, "format is too large, at %s", - fname); - - t = ds[val / 100]; - if (collon && !count && (val % 10) == 0) - h = hsth[(val % 100) / 10]; - else - h = hs[(val % 100) / 10]; + if (object == NIL) { + if (collon) + LispWriteStr(stream, "()", 2); + else + LispWriteStr(stream, Snil, 3); + } + else { + /* if string is not NIL, atsign was specified + * and object printed to string */ + if (string == NIL) + length = format_object(stream, object); + else { + int size; + char *str = LispGetSstring(SSTREAMP(string), &size); - if (collon && !count) - d = *h ? dsth[val % 10] : dsth[val % 20]; - else - d = *h ? ds[val % 10] : ds[val % 20]; + LispWriteStr(stream, str, size); + } + } - if (((!sign && len) || len > SIGNLEN) && - (*t || *h || *d)) { - if (!collon || count || *h || *t) { - strcpy(stk + len, ", "); - len += 2; - } - else { - strcpy(stk + len, " "); - ++len; - } - } - if (*t) { - if (collon && !count && (val % 100) == 0) - l = sprintf(stk + len, "%s hundredth", t); - else - l = sprintf(stk + len, "%s hundred", t); - len += l; - } - if (*h) { - if (*t) { - if (collon && !count) { - strcpy(stk + len, " "); - ++len; - } - else { - strcpy(stk + len, " and "); - len += 5; /*12345*/ - } - } - l = sprintf(stk + len, "%s", h); - len += l; - } - if (*d) { - if (*h) { - strcpy(stk + len, "-"); - ++len; - } - else if (*t) { - if (collon && !count) { - strcpy(stk + len, " "); - ++len; - } - else { - strcpy(stk + len, " and "); - len += 5; /*12345*/ - } - } - l = sprintf(stk + len, "%s", d); - len += l; - } - if (!count) - break; - else - tmp = count; - if (count > 1) { - val *= 1000; - while (--count) - val *= 1000; - num -= val; - } - else - num %= 1000; + /* right padding */ + if (!atsign) { + /* output minpad characters at left */ + if (minpad) { + length += minpad; + LispWriteChars(stream, padchar, minpad); + } + if (colinc) { + /* puts colinc spaces at a time, + * until at least mincol chars out */ + while (length < mincol) { + LispWriteChars(stream, padchar, colinc); + length += colinc; + } + } + } - if (collon && num == 0 && !*t && !*h) - l = sprintf(stk + len, " %s", tsth[tmp]); - else - l = sprintf(stk + len, " %s", ts[tmp]); - len += l; + GC_LEAVE(); +} - if (num == 0) - break; - } - } +/* assumes radix is 0 or in range 2 - 36 */ +static void +format_in_radix(LispObj *stream, LispObj *object, int radix, FmtArgs *args) +{ + if (INTEGERP(object)) { + int i, check, atsign, collon, mincol, padchar, commachar, commainterval; - stk[len] = '\0'; - while (mincol > len) { - mac->column += LispPrintf(mac, stream, "%c", padchar); - --mincol; - } - mac->column += LispPrintf(mac, stream, "%s", stk); - len = 0; + i = check = (radix == 0); + atsign = args->atsign; + collon = args->collon; + if (radix == 0) { + radix = args->arguments[0].value; + if (radix < 2 || radix > 36) { + args->offset = args->arguments[0].offset; + generic_error(args, GENERIC_RADIX); } - ++fmt; - plural = arg; - arg = CDR(arg); - ++cur_arg; - continue; - -print_float_number: - mac->newline = 0; - if (arg->type != LispCons_t) - goto not_enough_args; - if (CAR(arg)->type != LispReal_t) { - /* print just as 'A' */ - isprinc = 1; - goto print_object; - } - else { - double num = CAR(arg)->data.real; - char sprint[1024]; - int l, sign, ee = 0, expt = 0, elen = 1, kset = 0, dset = 0, - eset = 0; - - /* get print arguments */ - l = 0; - if (*fmt == '$') { - if (argc && !defs[l]) { - d = nargs[l]; - dset = 1; - } - else - d = 2; /* defaults to 2 for '$' */ - ++l; - if (argc > l && !defs[l]) - n = nargs[l]; - ++l; - if (argc > l && !defs[l]) - w = nargs[l]; - ++l; - if (argc > l && !defs[l]) - padchar = nargs[l]; - if (argc > 4 || d < 0 || n < 0 || - (argc > 2 && !defs[2] && w < 2) || - (padidx != -1 && (padidx != 3))) - LispDestroy(mac, BadArgument, fname); - kset = 1; - } - else { - if (argc && !defs[l]) - w = nargs[l]; - ++l; - if (argc > l && !defs[l]) { - d = nargs[l]; - dset = 1; - } - ++l; - if (ise) { - if (argc > l && !defs[l]) { - e = nargs[l]; - eset = 1; - } - ++l; - } - if (argc > l && !defs[l]) { - k = nargs[l]; - kset = 1; - } - ++l; - if (argc > l && !defs[l]) - overflowchar = nargs[l]; - ++l; - if (argc > l && !defs[l]) - padchar = nargs[l]; - ++l; - if (argc > l && !defs[l]) - exponentchar = nargs[l]; - - if (overidx == -1 && padidx != -1) { - overidx = padidx; - padidx = -1; - } - if ((argc > 2 && !defs[2] && w < 2) || - (argc > 1 && !defs[1] && d < 0) || - (overidx != -1 && (overidx != 3 + ise)) || - (padidx != -1 && (padidx != 4 + ise))) - LispDestroy(mac, BadArgument, fname); - } + } + mincol = args->arguments[i++].value; + padchar = args->arguments[i++].value; + commachar = args->arguments[i++].value; + commainterval = args->arguments[i++].value; - sign = num < 0.0; - if (sign) - num = -num; - - if (toupper(*fmt) == 'G') { - double dtmp = 10.0; - int ww, dd, n = 0, q; - - /* decide if print as ~F or ~E - */ - if (num == 0.0) - q = 1; - else { - l = sprintf(stk, "%f", num); - while (l > 1 && stk[l - 1] == '0') - --l; - q = l + (sign || atsign); - } + LispFormatInteger(stream, object, radix, atsign, collon, + mincol, padchar, commachar, commainterval); + } + else + format_object(stream, object); +} - if (num >= 10.0) - for (n = 1; dtmp <= num; n++, dtmp *= 10.0) - ; - else - for (dtmp /= 10.0, n = 1; dtmp >= num; n--, dtmp /= 10.0) - ; +static void +format_radix_special(LispObj *stream, LispObj *object, FmtArgs *args) +{ + if (FIXNUMP(object)) { + if (args->atsign) + format_roman(stream, object, args); + else + format_english(stream, object, args); + } + else + format_object(stream, object); +} - if (w) - ww = w - ((e ? e : 2) + 2); - else - ww = 0; - if (!dset) { - d = n > 7 ? 7 : n; - if (d < q) - d = q; - } - dd = d - n; +static void +format_roman(LispObj *stream, LispObj *object, FmtArgs *args) +{ + long value = 0; + int cando, new_roman = args->collon == 0; - if (d >= dd && dd >= 0) { - dset = kset = 1; - w = ww; - d = dd; - k = 0; - ise = 0; - /* add that amount of pads after number, - * to "emulate" ~ee,@T */ - ee = eset ? e + 2 : 4; - } - } + if (FIXNUMP(object)) { + value = FIXNUM_VALUE(object); + if (new_roman) + cando = value >= 1 && value <= 3999; + else + cando = value >= 1 && value <= 4999; + } + else + cando = 0; - if (ise) { - if (k > 0 && d) { - if ((d -= (k - 1)) < 0) - LispDestroy(mac, BadArgument, fname); - } - else if (k < 0 && -k > d) - LispDestroy(mac, BadArgument, fname); - } + if (cando) + LispFormatRomanInteger(stream, value, new_roman); + else + format_object(stream, object); +} - len = 0; - if (*fmt != '$') { - if (sign) - stk[len++] = '-'; - else if (atsign) - stk[len++] = '+'; - } +static void +format_english(LispObj *stream, LispObj *object, FmtArgs *args) +{ + int cando; + long number = 0; - /* adjust scale factor/exponent */ - l = k; - while (l > 0) { - --l; - --expt; - num *= 10.0; - } - while (l < 0) { - ++l; - ++expt; - num /= 10.0; - } - if (ise) { - if (!kset) - k = 1; - if (num > 1.0) { - l = sprintf(sprint, "%1.1f", num); - while (l > 1 && sprint[--l] != '.') - ; - } - else { - int pos; - char sprint2[1024]; - - if (dset) { - sprintf(sprint2, "%%1.%df", d); - l = sprintf(sprint, sprint2, num); - } - else - l = sprintf(sprint, "%f", num); - for (pos = 0; sprint[pos] && sprint[pos] != '.'; pos++) - ; - if (sprint[pos]) { - for (l = 0, pos++; sprint[pos] == '0'; pos++, l--) - ; - if (!sprint[pos]) - l = k; - } - else - l = k; - } - while (l > k) { - --l; - num /= 10.0; - ++expt; - } - while (l < k) { - ++l; - num *= 10.0; - --expt; - } - } + if (FIXNUMP(object)) { + number = FIXNUM_VALUE(object); + cando = number >= -999999999 && number <= 999999999; + } + else + cando = 0; - if (!dset) { - int left = 20; - double integral, fractional; - - fractional = modf(num, &integral); - if (w) { - l = sprintf(sprint, "%f", integral); - while (l > 1 && sprint[l - 1] == '0') - --l; - if (l && sprint[l - 1] == '.') - --l; - left = w - l - 1 - sign; - } - l = sprintf(sprint, "%f", fractional); - while (l && sprint[l - 1] == '0') - --l; - l -= 2 + (w && sign); - if (l > left) - l = left; - sprintf(sprint, "%%1.%df", l > 0 ? l : 0); - } - else - sprintf(sprint, "%%1.%df", d); - l = sprintf(stk + len, sprint, num); - - len += l; - if (ise) { - l = sprintf(stk + len, "%c%c", exponentchar, - expt < 0 ? '-' : '+'); - len += l; - if (e) - sprintf(sprint, "%%0%dd", e); - else - strcpy(sprint, "%d"); - l = sprintf(stk + len, sprint, expt < 0 ? -expt : expt); - len += l; - elen = l + 2; /* sign and exponentchar */ - } + if (cando) + LispFormatEnglishInteger(stream, number, args->collon); + else + format_object(stream, object); +} - /* adjust width */ - l = len; - if (ise) - len -= elen; - - /* find '.' in string */ - for (tmp = 0; tmp < len; tmp++) - if (stk[tmp] == '.') - break; +static void +format_character(LispObj *stream, LispObj *object, FmtArgs *args) +{ + if (SCHARP(object)) + LispFormatCharacter(stream, object, args->atsign, args->collon); + else + format_object(stream, object); +} - if (tmp == len) { - /* '.' not found */ - memmove(stk + len + 1 + d, stk + len, l - tmp); - stk[tmp] = '.'; - len = tmp + 1; - for (tmp = 0; tmp < d; len++, tmp++) - stk[len] = '0'; - len = l + 1 + d; - } - else if (dset) { - int tmp2; +static void +format_fixed_float(LispObj *stream, LispObj *object, FmtArgs *args) +{ + if (FLOATP(object)) + LispFormatFixedFloat(stream, object, args->atsign, + args->arguments[0].value, + IF_SPECIFIED(args->arguments[1]), + args->arguments[2].value, + args->arguments[3].value, + args->arguments[4].value); + else + format_object(stream, object); +} - ++tmp; - tmp2 = tmp; - /* correct exponent string */ - if (ise) - memmove(stk + tmp + d, stk + l - elen, elen); - /* pad with '0' chars if required */ - for (tmp = len; tmp < l - elen; tmp++) - stk[tmp] = '0'; - len = tmp2 + d + (ise ? elen : 0); - } +static void +format_exponential_float(LispObj *stream, LispObj *object, FmtArgs *args) +{ + if (FLOATP(object)) + LispFormatExponentialFloat(stream, object, args->atsign, + args->arguments[0].value, + IF_SPECIFIED(args->arguments[1]), + args->arguments[2].value, + args->arguments[3].value, + args->arguments[4].value, + args->arguments[5].value, + args->arguments[6].value); + else + format_object(stream, object); +} - /* '$' does not have an overflowchar parameter */ - if (w && *fmt != '$') { - if (len > w && num < 1) { - int inc = sign || atsign; - - /* cut the leading '0' */ - memmove(stk + inc, stk + inc + 1, len - inc - 1); - --len; - } - if (((ise && elen - 2 > e) || len > w) && overflowchar) { - for (len = 0; len < w; len++) - stk[len] = overflowchar; - } - } +static void +format_general_float(LispObj *stream, LispObj *object, FmtArgs *args) +{ + if (FLOATP(object)) + LispFormatGeneralFloat(stream, object, args->atsign, + args->arguments[0].value, + IF_SPECIFIED(args->arguments[1]), + args->arguments[2].value, + args->arguments[3].value, + args->arguments[4].value, + args->arguments[5].value, + args->arguments[6].value); + else + format_object(stream, object); +} - l = len; - stk[len] = '\0'; - if (*fmt == '$') { - if (collon) { - if (sign) - mac->column += LispPrintf(mac, stream, "%c", '-'); - else if (atsign) - mac->column += LispPrintf(mac, stream, "%c", '+'); - } - /* make sure not too much padchars are printed */ - if (len < n + d + 1) - len = n + d + 1 + (sign || atsign); - } +static void +format_dollar_float(LispObj *stream, LispObj *object, FmtArgs *args) +{ + if (FLOATP(object)) + LispFormatDollarFloat(stream, object, + args->atsign, args->collon, + args->arguments[0].value, + args->arguments[1].value, + args->arguments[2].value, + args->arguments[3].value); + else + format_object(stream, object); +} - while (len < w) { - mac->column += LispPrintf(mac, stream, "%c", padchar); - ++len; - } +static void +format_tabulate(LispObj *stream, FmtArgs *args) +{ + int atsign = args->atsign, + colnum = args->arguments[0].value, + colinc = args->arguments[1].value, + column; + + column = LispGetColumn(stream); + + if (atsign) { + /* relative tabulation */ + if (colnum > 0) { + LispWriteChars(stream, ' ', colnum); + column += colnum; + } + /* tabulate until at a multiple of colinc */ + if (colinc > 0) + LispWriteChars(stream, ' ', colinc - (column % colinc)); + } + else { + /* if colinc not specified, just move to given column */ + if (colinc <= 0) + LispWriteChars(stream, ' ', column - colnum); + else { + /* always output at least colinc spaces */ + do { + LispWriteChars(stream, ' ', colinc); + colnum -= colinc; + } while (colnum > column); + } + } +} - if (*fmt == '$') { - if (!collon) { - if (sign) - mac->column += LispPrintf(mac, stream, "%c", '-'); - else if (atsign) - mac->column += LispPrintf(mac, stream, "%c", '+'); - } - for (tmp = 0; tmp < l; tmp++) - if (stk[tmp] == '.') - break; - if (tmp < l) - --tmp; - while (tmp < n) { - mac->column += LispPrintf(mac, stream, "%c", '0'); - ++tmp; - } - } - mac->column += LispPrintf(mac, stream, "%s", stk); - while (ee > 0) { - /* not padchar, but real spaces. - * Note that this is only executed if ~G decided to - * print the number in ~F format. This is a ~ee,@T - * emulation */ - mac->column += LispPrintf(mac, stream, "%c", ' '); - --ee; - } - len = 0; +static void +format_goto(FmtInfo *info) +{ + int count, num_arguments; + LispObj *object, *arguments; + + /* number of arguments to ignore or goto offset */ + count = info->args.arguments[0].value; + if (count < 0) + generic_error(&(info->args), GENERIC_NEGATIVE); + + if (info->args.atsign) { + /* absolute goto */ + + /* if not specified, defaults to zero */ + if (!(info->args.arguments[0].specified)) + count = 0; + + /* if offset too large */ + if (count > info->total_arguments) + parse_error(&(info->args), PARSE_NOARGSLEFT); + else if (count != info->total_arguments - *(info->num_arguments)) { + /* calculate new parameters */ + object = NIL; + arguments = info->base_arguments; + num_arguments = info->total_arguments - count; + + for (; count > 0; count--, arguments = CDR(arguments)) + object = CAR(arguments); + + /* update format information */ + *(info->object) = object; + *(info->arguments) = arguments; + *(info->num_arguments) = num_arguments; + } + } + else if (count) { + /* relative goto, ignore or go back count arguments */ + + /* prepare to update parameters */ + arguments = *(info->arguments); + num_arguments = *(info->num_arguments); + + /* go back count arguments? */ + if (info->args.collon) + count = -count; + + num_arguments -= count; + + if (count > 0) { + if (count > *(info->num_arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + + object = *(info->object); + for (; count > 0; count--, arguments = CDR(arguments)) + object = CAR(arguments); + } + else { /* count < 0 */ + if (info->total_arguments + count - *(info->num_arguments) < 0) + parse_error(&(info->args), PARSE_NOARGSLEFT); + + object = NIL; + arguments = info->base_arguments; + for (count = 0; count < info->total_arguments - num_arguments; + count++, arguments = CDR(arguments)) + object = CAR(arguments); + } + + /* update format parameters */ + *(info->object) = object; + *(info->arguments) = arguments; + *(info->num_arguments) = num_arguments; + } +} + +static void +format_indirection(LispObj *stream, LispObj *format, FmtInfo *info) +{ + char *string; + LispObj *object; + FmtInfo indirect_info; + + if (!STRINGP(format)) + generic_error(&(info->args), GENERIC_BADSTRING); + string = THESTR(format); + + /* most information is the same */ + memcpy(&indirect_info, info, sizeof(FmtInfo)); + + /* set new format string */ + indirect_info.args.base = indirect_info.args.format = string; + indirect_info.format = &string; + + if (info->args.atsign) { + /* use current arguments */ + + /* do the indirect format */ + LispFormat(stream, &indirect_info); + } + else { + /* next argument is the recursive call arguments */ + + int num_arguments; + + /* it is valid to not have a list following string, as string may + * not have format directives */ + if (CONSP(*(indirect_info.arguments))) + object = CAR(*(indirect_info.arguments)); + else + object = NIL; + + if (!LISTP(object) || !CONSP(*(info->arguments))) + generic_error(&(info->args), GENERIC_BADLIST); + + /* update information now */ + *(info->object) = object; + *(info->arguments) = CDR(*(info->arguments)); + *(info->num_arguments) -= 1; + + /* set arguments for recursive call */ + indirect_info.base_arguments = object; + indirect_info.arguments = &object; + for (num_arguments = 0; CONSP(object); object = CDR(object)) + ++num_arguments; + + /* note that indirect_info.arguments is a pointer to "object", + * keep it pointing to the correct object */ + object = indirect_info.base_arguments; + indirect_info.total_arguments = num_arguments; + indirect_info.num_arguments = &num_arguments; + + /* do the indirect format */ + LispFormat(stream, &indirect_info); + } +} + +/* update pointers to a list of format strings: + * for '(' and '{' only one list is required + * for '[' and '<' more than one may be returned + * has_default is only meaningful for '[' and '<' + * comma_width and line_width are only meaningful to '<', and + * only valid if has_default set + * if the string is finished prematurely, LispDestroy is called + * format_ptr is updated to the correct pointer in the "main" format string + */ +static void +list_formats(FmtInfo *info, int command, char **format_ptr, + char ***format_list, int *format_count, int *has_default, + int *comma_width, int *line_width) +{ + /* instead of processing the directives recursively, just separate the + * input formats in separate strings, then see if one of then need to + * be used */ + FmtArgs args; + int counters[] = { 0, 0, 0, 0}; + /* '[', '(', '{', '<' */ + char *format, *next_format, *start, **formats; + int num_formats, format_index, separator, add_format; + + /* initialize */ + formats = NULL; + num_formats = format_index = 0; + if (has_default != NULL) + *has_default = 0; + if (comma_width != NULL) + *comma_width = 0; + if (line_width != NULL) + *line_width = 0; + format = start = next_format = *format_ptr; + switch (command) { + case '[': counters[0] = 1; format_index = 0; break; + case '(': counters[1] = 1; format_index = 1; break; + case '{': counters[2] = 1; format_index = 2; break; + case '<': counters[3] = 1; format_index = 3; break; + } + +#define LIST_FORMATS_ADD 1 +#define LIST_FORMATS_DONE 2 + + /* fill list of format options to conditional */ + while (*format) { + if (*format == '~') { + separator = add_format = 0; + args.format = format + 1; + next_format = parse_arguments(format + 1, &args, NULL, NULL, NULL); + switch (args.command) { + case '[': ++counters[0]; break; + case ']': --counters[0]; break; + case '(': ++counters[1]; break; + case ')': --counters[1]; break; + case '{': ++counters[2]; break; + case '}': --counters[2]; break; + case '<': ++counters[3]; break; + case '>': --counters[3]; break; + case ';': separator = 1; break; } - ++fmt; - plural = arg; - arg = CDR(arg); - ++cur_arg; - continue; - -print_object: - mac->newline = 0; - if (arg->type != LispCons_t) - goto not_enough_args; - - if (padidx >= 0 && padidx != 3) - LispDestroy(mac, BadArgument, fname); - - /* get print arguments */ - if (argc && !defs[0]) - mincol = nargs[0]; - if (argc > 1 && !defs[1]) - colinc = nargs[1]; - if (argc > 2 && !defs[2]) - minpad = nargs[2]; - if (argc > 3 && !defs[3]) - padchar = nargs[3]; - - if (atsign) { - int justsize = mac->justsize; - - mac->justsize = 1; - len = LispPrintObj(mac, stream, CAR(arg), 1); - mac->justsize = justsize; - while (len < mincol) { - mac->column += LispPrintf(mac, stream, "%c", padchar); - ++len; + + /* check if a new format string must be added */ + if (separator && counters[format_index] == 1 && + (command == '[' || command == '<')) + add_format = LIST_FORMATS_ADD; + else if (counters[format_index] == 0) + add_format = LIST_FORMATS_DONE; + + if (add_format) { + int length = format - start; + + formats = LispRealloc(formats, + (num_formats + 1) * sizeof(char*)); + + formats[num_formats] = LispMalloc(length + 1); + strncpy(formats[num_formats], start, length); + formats[num_formats][length] = '\0'; + ++num_formats; + /* loop finished? */ + if (add_format == LIST_FORMATS_DONE) + break; + else if (command == '[' && has_default != NULL) + /* will be set only for the last parameter, what is + * expected, just don't warn about it in the incorrect + * place */ + *has_default = args.collon != 0; + else if (command == '<' && num_formats == 1) { + /* if the first parameter to '<', there may be overrides + * to comma-width and line-width */ + if (args.collon && has_default != NULL) { + *has_default = 1; + if (comma_width != NULL && + args.arguments[0].specified && + !args.arguments[0].achar) + *comma_width = args.arguments[0].value; + if (line_width != NULL && + args.arguments[1].specified && + !args.arguments[1].achar) + *line_width = args.arguments[1].value; + } } + start = next_format; } + format = next_format; + } + else + ++format; + } - if (isprinc) - mac->princ = 1; - if (collon && toupper(*fmt) == 'A' && CAR(arg) == NIL) - len = LispPrintf(mac, stream, "%s", "()"); - else - len = LispPrintObj(mac, stream, CAR(arg), 1); - mac->column += len; /* XXX maybe should look if the object has - * newlines, and adjust mac->column in - * that case */ - if (!atsign) { - while (len < mincol) { - mac->column += LispPrintf(mac, stream, "%c", padchar); - ++len; + /* check if format string did not finish prematurely */ + if (counters[format_index] != 0) { + char error_message[64]; + + sprintf(error_message, "expecting ~%c", command); + format_error(&(info->args), error_message); + } + + /* update pointers */ + *format_list = formats; + *format_count = num_formats; + *format_ptr = next_format; +} + +static void +free_formats(char **formats, int num_formats) +{ + if (num_formats) { + while (--num_formats >= 0) + LispFree(formats[num_formats]); + LispFree(formats); + } +} + +static void +format_case_conversion(LispObj *stream, FmtInfo *info) +{ + GC_ENTER(); + LispObj *string; + FmtInfo case_info; + char *str, *ptr; + char *format, *next_format, **formats; + int atsign, collon, num_formats, length; + + atsign = info->args.atsign; + collon = info->args.collon; + + /* output to a string, before case conversion */ + string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + GC_PROTECT(string); + + /* most information is the same */ + memcpy(&case_info, info, sizeof(FmtInfo)); + + /* list formats */ + next_format = *(info->format); + list_formats(info, '(', &next_format, &formats, &num_formats, + NULL, NULL, NULL); + + /* set new format string */ + format = formats[0]; + case_info.args.base = case_info.args.format = format; + case_info.format = &format; + + /* format text to string */ + LispFormat(string, &case_info); + + str = ptr = LispGetSstring(SSTREAMP(string), &length); + + /* do case conversion */ + if (!atsign && !collon) { + /* convert all upercase to lowercase */ + for (; *ptr; ptr++) { + if (isupper(*ptr)) + *ptr = tolower(*ptr); + } + } + else if (atsign && collon) { + /* convert all lowercase to upercase */ + for (; *ptr; ptr++) { + if (islower(*ptr)) + *ptr = toupper(*ptr); + } + } + else { + int upper = 1; + + /* skip non-alphanumeric characters */ + for (; *ptr; ptr++) + if (isalnum(*ptr)) + break; + + /* capitalize words */ + for (; *ptr; ptr++) { + if (isalnum(*ptr)) { + if (upper) { + if (islower(*ptr)) + *ptr = toupper(*ptr); + upper = 0; } + else if (isupper(*ptr)) + *ptr = tolower(*ptr); } - if (isprinc) - mac->princ = princ; - len = 0; - ++fmt; - plural = arg; - arg = CDR(arg); - ++cur_arg; - continue; - -not_enough_args: - LispDestroy(mac, "no arguments left, at %s", fname); -error_parsing: - LispDestroy(mac, "error parsing directive, at %s", fname); + else + upper = collon; + /* if collon, capitalize all words, else just first word */ } + } + + /* output case converted string */ + LispWriteStr(stream, str, length); + + /* temporary string stream is not necessary anymore */ + GC_LEAVE(); + + /* free temporary memory */ + free_formats(formats, num_formats); + + /* this information always updated */ + *(info->format) = next_format; +} + +static void +format_conditional(LispObj *stream, FmtInfo *info) +{ + LispObj *object, *arguments; + char *format, *next_format, **formats; + int choice, num_formats, has_default, num_arguments; + + /* save information that may change */ + object = *(info->object); + arguments = *(info->arguments); + num_arguments = *(info->num_arguments); + + /* initialize */ + choice = -1; + next_format = *(info->format); + + /* list formats */ + list_formats(info, '[', + &next_format, &formats, &num_formats, &has_default, NULL, NULL); + + /* ~:[false;true] */ + if (info->args.collon) { + /* one argument always consumed */ + if (!CONSP(arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + choice = object == NIL ? 0 : 1; + } + /* ~@[true] */ + else if (info->args.atsign) { + /* argument consumed only if nil, but one must be available */ + if (!CONSP(arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + if (CAR(arguments) != NIL) + choice = 0; else { - mac->newline = 0; - if (len + 1 < sizeof(stk)) - stk[len++] = *fmt; - else { - stk[len] = '\0'; - mac->column += LispPrintf(mac, stream, "%s", stk); - len = 0; - } - } - ++fmt; - } -format_done: - if (len) { - stk[len] = '\0'; - mac->column += LispPrintf(mac, stream, "%s", stk); - } - - if (stream != NIL && (stream->data.stream.size >= 0 || - stream->data.stream.source.fp != lisp_stdout)) - mac->newline = newline; - else - fflush(lisp_stdout); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + } + } + /* ~n[...~] */ + else if (info->args.arguments[0].specified) + /* no arguments consumed */ + choice = info->args.arguments[0].value; + /* ~[...~] */ + else { + /* one argument consumed, it is the index in the available formats */ + if (!CONSP(arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + /* no error if it isn't a number? */ + if (FIXNUMP(object)) + choice = FIXNUM_VALUE(object); + } + + /* update anything that may have changed */ + *(info->object) = object; + *(info->arguments) = arguments; + *(info->num_arguments) = num_arguments; + + /* if choice is out of range check if there is a default choice */ + if (has_default && (choice < 0 || choice >= num_formats)) + choice = num_formats - 1; + + /* if one of the formats must be parsed */ + if (choice >= 0 && choice < num_formats) { + FmtInfo conditional_info; + + /* most information is the same */ + memcpy(&conditional_info, info, sizeof(FmtInfo)); + + /* set new format string */ + format = formats[choice]; + conditional_info.args.base = conditional_info.args.format = format; + conditional_info.format = &format; + + /* do the conditional format */ + LispFormat(stream, &conditional_info); + } - LispFree(mac, indirection); + /* free temporary memory */ + free_formats(formats, num_formats); + + /* this information always updated */ + *(info->format) = next_format; +} + +static void +format_iterate(LispObj *stream, FmtInfo *info) +{ + FmtInfo iterate_info; + LispObj *object, *arguments, *iarguments, *iobject; + char *format, *next_format, *loop_format, **formats; + int num_arguments, iterate, iterate_max, has_max, has_min, inum_arguments, + num_formats; + + /* save information that may change */ + object = *(info->object); + arguments = *(info->arguments); + num_arguments = *(info->num_arguments); + + /* initialize */ + iterate = has_min = 0; + next_format = *(info->format); + + /* if has_max set, iterate at most iterate_max times */ + has_max = info->args.arguments[0].specified; + iterate_max = info->args.arguments[0].value; + + /* list formats */ + list_formats(info, '{', &next_format, &formats, &num_formats, + NULL, NULL, NULL); + loop_format = formats[0]; + + /* most information is the same */ + memcpy(&iterate_info, info, sizeof(FmtInfo)); + + /* ~{...~} */ + if (!info->args.atsign && !info->args.collon) { + /* next argument is the argument list for the iteration */ + + /* fetch argument list, must exist */ + if (!CONSP(arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + iarguments = object = CAR(arguments); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + + inum_arguments = 0; + if (CONSP(object)) { + /* count arguments to format */ + for (iobject = object; CONSP(iobject); iobject = CDR(iobject)) + ++inum_arguments; + } + else if (object != NIL) + generic_error(&(info->args), GENERIC_BADLIST); - if (CAR(CAR(ilist)) != NIL) { - char c; + iobject = NIL; - switch (STRPTR(CAR(CAR(ilist)))[0]) { - case '(': - c = ')'; + /* set new arguments to recursive calls */ + iarguments = object; + iterate_info.base_arguments = iarguments; + iterate_info.total_arguments = inum_arguments; + iterate_info.object = &iobject; + iterate_info.arguments = &iarguments; + iterate_info.num_arguments = &inum_arguments; + + /* iterate */ + for (;; iterate++) { + /* if maximum iterations done or all arguments consumed */ + if (has_max && iterate > iterate_max) break; - case '{': - c = '}'; + else if (inum_arguments == 0 && (!has_min || iterate > 0)) break; - case '<': - c = '>'; + + format = loop_format; + + /* set new format string */ + iterate_info.args.base = iterate_info.args.format = format; + iterate_info.format = &format; + + /* information for possible ~^, in this case ~:^ is a noop */ + iterate_info.iteration = ITERATION_NORMAL; + + /* do the format */ + LispFormat(stream, &iterate_info); + + /* check for forced loop break */ + if (iterate_info.upandout & UPANDOUT_HASH) + break; + } + } + /* ~:@{...~} */ + else if (info->args.atsign && info->args.collon) { + /* every following argument is the argument list for the iteration */ + + /* iterate */ + for (;; iterate++) { + /* if maximum iterations done or all arguments consumed */ + if (has_max && iterate > iterate_max) break; - default: - c = '?'; + else if (num_arguments == 0 && (!has_min || iterate > 0)) break; + + /* fetch argument list, must exist */ + if (!CONSP(arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + iarguments = object = CAR(arguments); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + + inum_arguments = 0; + if (CONSP(object)) { + /* count arguments to format */ + for (iobject = object; CONSP(iobject); iobject = CDR(iobject)) + ++inum_arguments; + } + else if (object != NIL) + generic_error(&(info->args), GENERIC_BADLIST); + + iobject = NIL; + + /* set new arguments to recursive calls */ + iarguments = object; + iterate_info.base_arguments = iarguments; + iterate_info.total_arguments = inum_arguments; + iterate_info.object = &iobject; + iterate_info.arguments = &iarguments; + iterate_info.num_arguments = &inum_arguments; + + format = loop_format; + + /* set new format string */ + iterate_info.args.base = iterate_info.args.format = format; + iterate_info.format = &format; + + /* information for possible ~^ */ + iterate_info.iteration = + num_arguments > 0 ? ITERATION_NORMAL : ITERATION_LAST; + + /* do the format */ + LispFormat(stream, &iterate_info); + + /* check for forced loop break */ + if (iterate_info.upandout & UPANDOUT_HASH) + break; + } + } + /* ~:{...~} */ + else if (info->args.collon) { + /* next argument is a list of lists */ + + LispObj *sarguments, *sobject; + int snum_arguments; + + /* fetch argument list, must exist */ + if (!CONSP(arguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + sarguments = object = CAR(arguments); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + + snum_arguments = 0; + if (CONSP(object)) { + /* count arguments to format */ + for (sobject = object; CONSP(sobject); sobject = CDR(sobject)) + ++snum_arguments; + } + else + generic_error(&(info->args), GENERIC_BADLIST); + + /* iterate */ + for (;; iterate++) { + /* if maximum iterations done or all arguments consumed */ + if (has_max && iterate > iterate_max) + break; + else if (snum_arguments == 0 && (!has_min || iterate > 0)) + break; + + /* fetch argument list, must exist */ + if (!CONSP(sarguments)) + parse_error(&(info->args), PARSE_NOARGSLEFT); + iarguments = sobject = CAR(sarguments); + sobject = CAR(sarguments); + sarguments = CDR(sarguments); + --snum_arguments; + + inum_arguments = 0; + if (CONSP(object)) { + /* count arguments to format */ + for (iobject = sobject; CONSP(iobject); iobject = CDR(iobject)) + ++inum_arguments; + } + else if (sobject != NIL) + generic_error(&(info->args), GENERIC_BADLIST); + + iobject = NIL; + + /* set new arguments to recursive calls */ + iarguments = sobject; + iterate_info.base_arguments = iarguments; + iterate_info.total_arguments = inum_arguments; + iterate_info.object = &iobject; + iterate_info.arguments = &iarguments; + iterate_info.num_arguments = &inum_arguments; + + format = loop_format; + + /* set new format string */ + iterate_info.args.base = iterate_info.args.format = format; + iterate_info.format = &format; + + /* information for possible ~^ */ + iterate_info.iteration = + snum_arguments > 0 ? ITERATION_NORMAL : ITERATION_LAST; + + /* do the format */ + LispFormat(stream, &iterate_info); + + /* check for forced loop break */ + if (iterate_info.upandout & UPANDOUT_HASH) + break; + } + } + /* ~@{...~} */ + else if (info->args.atsign) { + /* current argument list is used */ + + /* set new arguments to recursive calls */ + iterate_info.base_arguments = info->base_arguments; + iterate_info.total_arguments = info->total_arguments; + iterate_info.object = &object; + iterate_info.arguments = &arguments; + iterate_info.num_arguments = &num_arguments; + + for (;; iterate++) { + /* if maximum iterations done or all arguments consumed */ + if (has_max && iterate > iterate_max) + break; + else if (num_arguments == 0 && (!has_min || iterate > 0)) + break; + + format = loop_format; + + /* set new format string */ + iterate_info.args.base = iterate_info.args.format = format; + iterate_info.format = &format; + + /* information for possible ~^, in this case ~:^ is a noop */ + iterate_info.iteration = ITERATION_NORMAL; + + /* do the format */ + LispFormat(stream, &iterate_info); + + /* check for forced loop break */ + if (iterate_info.upandout & UPANDOUT_HASH) + break; + } + } + + /* free temporary memory */ + free_formats(formats, num_formats); + + /* update anything that may have changed */ + *(info->object) = object; + *(info->arguments) = arguments; + *(info->num_arguments) = num_arguments; + + /* this information always updated */ + *(info->format) = next_format; +} + +static void +format_justify(LispObj *stream, FmtInfo *info) +{ + GC_ENTER(); + FmtInfo justify_info; + char **formats, *format, *next_format, *str; + LispObj *string, *strings = NIL, *cons; + int atsign = info->args.atsign, + collon = info->args.collon, + mincol = info->args.arguments[0].value, + colinc = info->args.arguments[1].value, + minpad = info->args.arguments[2].value, + padchar = info->args.arguments[3].value; + int i, k, total_length, length, padding, num_formats, has_default, + comma_width, line_width, size, extra; + + next_format = *(info->format); + + /* list formats */ + list_formats(info, '<', &next_format, &formats, &num_formats, + &has_default, &comma_width, &line_width); + + /* initialize list of strings streams */ + if (num_formats) { + string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + strings = cons = CONS(string, NIL); + GC_PROTECT(strings); + for (i = 1; i < num_formats; i++) { + string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + RPLACD(cons, CONS(string, NIL)); + cons = CDR(cons); + } + } + + /* most information is the same */ + memcpy(&justify_info, info, sizeof(FmtInfo)); + + /* loop formating strings */ + for (i = 0, cons = strings; i < num_formats; i++, cons = CDR(cons)) { + /* set new format string */ + format = formats[i]; + justify_info.args.base = justify_info.args.format = format; + justify_info.format = &format; + + /* format string, maybe consuming arguments */ + LispFormat(CAR(cons), &justify_info); + + /* if format was aborted, it is discarded */ + if (justify_info.upandout) + RPLACA(cons, NIL); + /* check if the entire "main" iteration must be aborted */ + if (justify_info.upandout & UPANDOUT_COLLON) { + for (cons = CDR(cons); i < num_formats; i++, cons = CDR(cons)) + RPLACA(cons, NIL); + break; + } + } + + /* free temporary format strings */ + free_formats(formats, num_formats); + + /* remove aborted formats */ + /* first remove leading discarded formats */ + if (CAR(strings) == NIL) { + while (CAR(strings) == NIL) { + strings = CDR(strings); + --num_formats; + } + /* keep strings gc protected, discarding first entries */ + lisp__data.protect.objects[gc__protect] = strings; + } + /* now remove intermediary discarded formats */ + cons = strings; + while (CONSP(cons)) { + if (CONSP(CDR(cons)) && CAR(CDR(cons)) == NIL) { + RPLACD(cons, CDR(CDR(cons))); + --num_formats; } - LispDestroy(mac, "expecting ~%c, at %s", c, fname); + else + cons = CDR(cons); } - if (stream != NIL && stream->data.stream.size >= 0) { - if (stream->data.stream.source.str == NULL) - return (STRING("")); - return (STRING((char*)stream->data.stream.source.str)); + /* calculate total length required for output */ + if (has_default) + cons = CDR(strings); /* if has_defaults, strings is surely a list */ + else + cons = strings; + for (total_length = 0; CONSP(cons); cons = CDR(cons)) + total_length += SSTREAMP(CAR(cons))->length; + + /* initialize pointer to string streams */ + if (has_default) + cons = CDR(strings); + else + cons = strings; + + /* check if padding will need to be printed */ + extra = 0; + padding = mincol - total_length; + if (padding < 0) + k = padding = 0; + else { + int num_fields = num_formats - (has_default != 0); + + if (num_fields > 1) { + /* check if padding is distributed in num_fields or + * num_fields - 1 steps */ + if (!collon) + --num_fields; + } + + if (num_fields) + k = padding / num_fields; + else + k = padding; + + if (k <= 0) + k = colinc; + else if (colinc) + k = k + (k % colinc); + extra = mincol - (num_fields * k + total_length); + if (extra < 0) + extra = 0; + } + if (padding && k < minpad) { + k = minpad; + if (colinc) + k = k + (k % colinc); } + + /* first check for the special case of only one string being justified */ + if (num_formats - has_default == 1) { + if (has_default && line_width > 0 && comma_width >= 0 && + total_length + comma_width > line_width) { + str = LispGetSstring(SSTREAMP(CAR(strings)), &size); + LispWriteStr(stream, str, size); + } + string = has_default ? CAR(CDR(strings)) : CAR(strings); + /* check if need left padding */ + if (k && !atsign) { + LispWriteChars(stream, padchar, k); + k = 0; + } + /* check for centralizing text */ + else if (k && atsign && collon) { + LispWriteChars(stream, padchar, k / 2 + ((k / 2) & 1)); + k -= k / 2; + } + str = LispGetSstring(SSTREAMP(string), &size); + LispWriteStr(stream, str, size); + /* if any padding remaining */ + if (k) + LispWriteChars(stream, padchar, k); + } + else { + LispObj *result; + int last, spaces_before, padout; + + /* if has default, need to check output length */ + if (has_default && line_width > 0 && comma_width >= 0) { + result = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + GC_PROTECT(result); + } + /* else write directly to stream */ + else + result = stream; + + /* loop printing justified text */ + /* padout controls padding for cases where padding is + * is separated in n-1 chunks, where n is the number of + * formatted strings. + */ + for (i = padout = 0; CONSP(cons); i++, cons = CDR(cons), --extra) { + string = CAR(cons); + last = !CONSP(CDR(cons)); + + spaces_before = (i != 0 || collon) && (!last || !atsign); + + if (!spaces_before) { + /* check for special case */ + if (last && atsign && collon && padding > 0) { + int spaces; + + spaces = minpad > colinc ? minpad : colinc; + LispWriteChars(result, padchar, spaces + (extra > 0)); + k -= spaces; + } + str = LispGetSstring(SSTREAMP(string), &size); + LispWriteStr(result, str, size); + padout = 0; + } + if (!padout) + LispWriteChars(result, padchar, k + (extra > 0)); + padout = k; + /* if not first string, or if left padding specified */ + if (spaces_before) { + str = LispGetSstring(SSTREAMP(string), &size); + LispWriteStr(result, str, size); + padout = 0; + } + padding -= k; + } + + if (has_default && line_width > 0 && comma_width >= 0) { + length = SSTREAMP(result)->length + LispGetColumn(stream); + + /* if current line is too large */ + if (has_default && length + comma_width > line_width) { + str = LispGetSstring(SSTREAMP(CAR(strings)), &size); + LispWriteStr(stream, str, size); + } + + /* write result to stream */ + str = LispGetSstring(SSTREAMP(result), &size); + LispWriteStr(stream, str, size); + } + } + + /* unprotect string streams from GC */ + GC_LEAVE(); + + /* this information always updated */ + *(info->format) = next_format; +} + +static void +LispFormat(LispObj *stream, FmtInfo *info) +{ + FmtArgs *args; + FmtDefs *defs = NULL; + LispObj *object, *arguments; + char stk[256], *format, *next_format; + int length, num_arguments, code, need_update, need_argument, hash, head; + + /* arguments that will be updated on function exit */ + format = *(info->format); + object = *(info->object); + arguments = *(info->arguments); + num_arguments = *(info->num_arguments); + + /* initialize */ + length = 0; + args = &(info->args); + info->upandout = 0; + + while (*format) { + if (*format == '~') { + /* flush non formatted characters */ + if (length) { + LispWriteStr(stream, stk, length); + length = 0; + } + + need_argument = need_update = hash = 0; + + /* parse parameters */ + args->format = format + 1; + next_format = parse_arguments(format + 1, args, &num_arguments, + &arguments, &code); + if (code != NOERROR) + parse_error(args, code); + + /* check parameters */ + switch (args->command) { + case 'A': case 'S': + defs = &AsciiDefs; + break; + case 'B': case 'O': case 'D': case 'X': + defs = &IntegerDefs; + break; + case 'R': + defs = &RadixDefs; + break; + case 'P': case 'C': + defs = &NoneDefs; + break; + case 'F': + defs = &FixedFloatDefs; + break; + case 'E': case 'G': + defs = &ExponentialFloatDefs; + break; + case '$': + defs = &DollarFloatDefs; + break; + case '%': case '&': case '|': case '~': case '\n': + defs = &OneDefs; + break; + case 'T': + defs = &TabulateDefs; + break; + case '*': + defs = &OneDefs; + break; + case '?': case '(': + defs = &NoneDefs; + break; + case ')': + /* this is never seen, processed in format_case_conversion */ + format_error(args, "no match for directive ~)"); + case '[': + defs = &OneDefs; + break; + case ']': + /* this is never seen, processed in format_conditional */ + format_error(args, "no match for directive ~]"); + case '{': + defs = &OneDefs; + break; + case '}': + /* this is never seen, processed in format_iterate */ + format_error(args, "no match for directive ~}"); + case '<': + defs = &AsciiDefs; + break; + case '>': + /* this is never seen, processed in format_justify */ + format_error(args, "no match for directive ~>"); + case ';': + /* this is never seen here */ + format_error(args, "misplaced directive ~;"); + case '#': + /* special handling for ~#^ */ + if (*next_format == '^') { + ++next_format; + hash = 1; + defs = &NoneDefs; + args->command = '^'; + break; + } + parse_error(args, PARSE_BADDIRECTIVE); + case '^': + defs = &NoneDefs; + break; + default: + parse_error(args, PARSE_BADDIRECTIVE); + break; + } + merge_arguments(args, defs, &code); + if (code != NOERROR) + merge_error(args, code); + + /* check if an argument is required by directive */ + switch (args->command) { + case 'A': case 'S': + case 'B': case 'O': case 'D': case 'X': case 'R': + need_argument = 1; + break; + case 'P': + /* if collon specified, plural is the last print argument */ + need_argument = !args->collon; + break; + case 'C': + need_argument = 1; + break; + case 'F': case 'E': case 'G': case '$': + need_argument = 1; + break; + case '%': case '&': case '|': case '~': case '\n': + break; + case 'T': + break; + case '*': /* check arguments below */ + need_update = 1; + break; + case '?': + need_argument = need_update = 1; + break; + case '(': case '[': case '{': case '<': + need_update = 1; + break; + case '^': + break; + } + if (need_argument) { + if (!CONSP(arguments)) + parse_error(args, PARSE_NOARGSLEFT); + object = CAR(arguments); + arguments = CDR(arguments); + --num_arguments; + } + + /* will do recursive calls that change info */ + if (need_update) { + *(info->format) = next_format; + *(info->object) = object; + *(info->arguments) = arguments; + *(info->num_arguments) = num_arguments; + } + + /* everything seens fine, print the format directive */ + switch (args->command) { + case 'A': + head = lisp__data.env.length; + LispAddVar(Oprint_escape, NIL); + ++lisp__data.env.head; + format_ascii(stream, object, args); + lisp__data.env.head = lisp__data.env.length = head; + break; + case 'S': + head = lisp__data.env.length; + LispAddVar(Oprint_escape, T); + ++lisp__data.env.head; + format_ascii(stream, object, args); + lisp__data.env.head = lisp__data.env.length = head; + break; + case 'B': + format_in_radix(stream, object, 2, args); + break; + case 'O': + format_in_radix(stream, object, 8, args); + break; + case 'D': + format_in_radix(stream, object, 10, args); + break; + case 'X': + format_in_radix(stream, object, 16, args); + break; + case 'R': + /* if a single argument specified */ + if (args->count) + format_in_radix(stream, object, 0, args); + else + format_radix_special(stream, object, args); + break; + case 'P': + if (args->atsign) { + if (FIXNUMP(object) && FIXNUM_VALUE(object) == 1) + LispWriteChar(stream, 'y'); + else + LispWriteStr(stream, "ies", 3); + } + else if (!FIXNUMP(object) || FIXNUM_VALUE(object) != 1) + LispWriteChar(stream, 's'); + break; + case 'C': + format_character(stream, object, args); + break; + case 'F': + format_fixed_float(stream, object, args); + break; + case 'E': + format_exponential_float(stream, object, args); + break; + case 'G': + format_general_float(stream, object, args); + break; + case '$': + format_dollar_float(stream, object, args); + break; + case '&': + if (LispGetColumn(stream) == 0) + --args->arguments[0].value; + case '%': + LispWriteChars(stream, '\n', args->arguments[0].value); + break; + case '|': + LispWriteChars(stream, '\f', args->arguments[0].value); + break; + case '~': + LispWriteChars(stream, '~', args->arguments[0].value); + break; + case '\n': + if (!args->collon) { + if (args->atsign) + LispWriteChar(stream, '\n'); + /* ignore newline and following spaces */ + while (*next_format && isspace(*next_format)) + ++next_format; + } + break; + case 'T': + format_tabulate(stream, args); + break; + case '*': + format_goto(info); + break; + case '?': + format_indirection(stream, object, info); + need_update = 1; + break; + case '(': + format_case_conversion(stream, info); + /* next_format if far from what is set now */ + next_format = *(info->format); + break; + case '[': + format_conditional(stream, info); + /* next_format if far from what is set now */ + next_format = *(info->format); + break; + case '{': + format_iterate(stream, info); + /* next_format if far from what is set now */ + next_format = *(info->format); + break; + case '<': + format_justify(stream, info); + /* next_format if far from what is set now */ + next_format = *(info->format); + break; + case '^': + if (args->collon) { + if (hash && num_arguments == 0) { + info->upandout = UPANDOUT_HASH; + goto format_up_and_out; + } + if (info->iteration && + info->iteration == ITERATION_NORMAL) + /* not exactly an error, but in this case, + * command is ignored */ + break; + info->upandout = UPANDOUT_COLLON; + goto format_up_and_out; + } + else if (num_arguments == 0) { + info->upandout = UPANDOUT_NORMAL; + goto format_up_and_out; + } + break; + } + + if (need_update) { + object = *(info->object); + arguments = *(info->arguments); + num_arguments = *(info->num_arguments); + } + + format = next_format; + } + else { + if (length >= sizeof(stk)) { + LispWriteStr(stream, stk, length); + length = 0; + } + stk[length++] = *format++; + } + } + + /* flush any peding output */ + if (length) + LispWriteStr(stream, stk, length); + +format_up_and_out: + /* update for recursive call */ + *(info->format) = format; + *(info->object) = object; + *(info->arguments) = arguments; + *(info->num_arguments) = num_arguments; +} + +LispObj * +Lisp_Format(LispBuiltin *builtin) +/* + format destination control-string &rest arguments + */ +{ + GC_ENTER(); + FmtInfo info; + LispObj *object; + char *control_string; + int num_arguments; + + LispObj *stream, *format, *arguments; + + arguments = ARGUMENT(2); + format = ARGUMENT(1); + stream = ARGUMENT(0); + + /* check format and stream */ + CHECK_STRING(format); + if (stream == NIL) { /* return a string */ + stream = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + GC_PROTECT(stream); + } + else if (stream == T || /* print directly to *standard-output* */ + stream == STANDARD_OUTPUT) + stream = NIL; + else { + CHECK_STREAM(stream); + if (!stream->data.stream.writable) + LispDestroy("%s: stream %s is not writable", + STRFUN(builtin), STROBJ(stream)); + } + + /* count number of arguments */ + for (object = arguments, num_arguments = 0; CONSP(object); + object = CDR(object), num_arguments++) + ; + + /* initialize plural/argument info */ + object = NIL; + + /* the format string */ + control_string = THESTR(format); + + /* arguments to recursive calls */ + info.args.base = control_string; + info.base_arguments = arguments; + info.total_arguments = num_arguments; + info.format = &control_string; + info.object = &object; + info.arguments = &arguments; + info.num_arguments = &num_arguments; + info.iteration = 0; + + /* format arguments */ + LispFormat(stream, &info); + + /* if printing to stdout */ + if (stream == NIL) + LispFflush(Stdout); + /* else if printing to string-stream, return a string */ + else if (stream->data.stream.type == LispStreamString) { + int length; + char *string; + + string = LispGetSstring(SSTREAMP(stream), &length); + stream = LSTRING(string, length); + } + + GC_LEAVE(); return (stream); } Index: xc/programs/xedit/lisp/format.h diff -u xc/programs/xedit/lisp/format.h:1.1 xc/programs/xedit/lisp/format.h:1.3 --- xc/programs/xedit/lisp/format.h:1.1 Sun Sep 9 19:03:47 2001 +++ xc/programs/xedit/lisp/format.h Fri Nov 8 03:00:56 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/format.h,v 1.1 2001/09/09 23:03:47 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/format.h,v 1.3 2002/11/08 08:00:56 paulo Exp $ */ #ifndef Lisp_format_h #define Lisp_format_h @@ -37,6 +37,6 @@ /* * Prototypes */ -LispObj *Lisp_Format(LispMac*, LispObj*, char*); /* format */ +LispObj *Lisp_Format(LispBuiltin*); #endif /* Lisp_format_h */ Index: xc/programs/xedit/lisp/hash.c diff -u /dev/null xc/programs/xedit/lisp/hash.c:1.4 --- /dev/null Thu Feb 27 12:34:57 2003 +++ xc/programs/xedit/lisp/hash.c Sat Nov 23 03:26:48 2002 @@ -0,0 +1,657 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/hash.c,v 1.4 2002/11/23 08:26:48 paulo Exp $ */ + +#include "hash.h" + +/* A simple hash-table implementation + * TODO: implement SXHASH and WITH-HASH-TABLE-ITERATOR + * May need a rewrite for better performance, and will + * need a rewrite if images/bytecode saved on disk. + */ + +#define GET_HASH 1 +#define PUT_HASH 2 +#define REM_HASH 3 + +/* + * Prototypes + */ +static unsigned long LispHashKey(LispObj*, int); +static LispObj *LispHash(LispBuiltin*, int); +static void LispRehash(LispHashTable*); +static void LispFreeHashEntries(LispHashEntry*, long); + +/* + * Initialization + */ +extern LispObj *Oeq, *Oeql, *Oequal, *Oequalp; + +/* Hash tables will have one of these sizes, unless the user + * specified a very large size */ +static long some_primes[] = { + 5, 11, 17, 23, + 31, 47, 71, 97, + 139, 199, 307, 401, + 607, 809, 1213, 1619, + 2437, 3251, 4889, 6521 +}; + +/* + * Implementation + */ +static unsigned long +LispHashKey(LispObj *object, int function) +{ + mpi *bigi; + char *string; + long i, length; + unsigned long key = ((unsigned long)object) >> 4; + + /* Must be the same object for EQ */ + if (function == FEQ) + goto hash_key_done; + + if (function == FEQUALP) { + switch (OBJECT_TYPE(object)) { + case LispSChar_t: + key = (unsigned long)toupper(SCHAR_VALUE(object)); + goto hash_key_done; + case LispString_t: + string = THESTR(object); + length = STRLEN(object); + if (length > 32) + length = 32; + for (i = 0, key = 0; i < length; i++) + key = (key << 1) ^ toupper(string[i]); + goto hash_key_done; + default: + break; + } + } + + /* Function is EQL, EQUAL or EQUALP */ + switch (OBJECT_TYPE(object)) { + case LispFixnum_t: + case LispSChar_t: + key = (unsigned long)FIXNUM_VALUE(object); + goto hash_key_done; + case LispInteger_t: + key = (unsigned long)INT_VALUE(object); + goto hash_key_done; + case LispRatio_t: + key = (object->data.ratio.numerator << 16) ^ + object->data.ratio.denominator; + goto hash_key_done; + case LispDFloat_t: + key = (unsigned long)DFLOAT_VALUE(object); + break; + case LispComplex_t: + key = (LispHashKey(object->data.complex.imag, function) << 16) ^ + LispHashKey(object->data.complex.real, function); + goto hash_key_done; + case LispBignum_t: + bigi = object->data.mp.integer; + length = bigi->size; + if (length > 8) + length = 8; + key = bigi->sign; + for (i = 0; i < length; i++) + key = (key << 8) ^ bigi->digs[i]; + goto hash_key_done; + case LispBigratio_t: + bigi = mpr_num(object->data.mp.ratio); + length = bigi->size; + if (length > 4) + length = 4; + key = bigi->sign; + for (i = 0; i < length; i++) + key = (key << 4) ^ bigi->digs[i]; + bigi = mpr_den(object->data.mp.ratio); + length = bigi->size; + if (length > 4) + length = 4; + for (i = 0; i < length; i++) + key = (key << 4) ^ bigi->digs[i]; + goto hash_key_done; + default: + break; + } + + /* Anything else must be the same object for EQL */ + if (function == FEQL) + goto hash_key_done; + + switch (OBJECT_TYPE(object)) { + case LispString_t: + string = THESTR(object); + length = STRLEN(object); + if (length > 32) + length = 32; + for (i = 0, key = 0; i < length; i++) + key = (key << 1) ^ string[i]; + break; + case LispCons_t: + key = (LispHashKey(CAR(object), function) << 16) ^ + LispHashKey(CDR(object), function); + break; + case LispQuote_t: + case LispBackquote_t: + case LispPathname_t: + key = LispHashKey(object->data.pathname, function); + break; + case LispRegex_t: + key = LispHashKey(object->data.regex.pattern, function); + break; + default: + break; + } + +hash_key_done: + return (key); +} + +static LispObj * +LispHash(LispBuiltin *builtin, int code) +{ + LispHashEntry *entry; + LispHashTable *hash; + unsigned long key; + LispObj *result; + int found; + long i; + + LispObj *okey, *hash_table, *value; + + if (code == REM_HASH) + value = NIL; + else { + value = ARGUMENT(2); + if (value == UNSPEC) + value = NIL; + } + hash_table = ARGUMENT(1); + okey = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + /* get hash entry */ + hash = hash_table->data.hash.table; + key = LispHashKey(okey, hash->function) % hash->num_entries; + entry = hash->entries + key; + + /* search entry in the hash table */ + if (entry->count == 0) + i = 0; + else { + if (hash->function == FEQ) { + for (i = entry->cache; i >= 0; i--) { + if (entry->keys[i] == okey) + goto found_key; + } + for (i = entry->cache + 1; i < entry->count; i++) { + if (entry->keys[i] == okey) + break; + } + } + else { + for (i = entry->cache; i >= 0; i--) { + if (LispObjectCompare(entry->keys[i], okey, + hash->function) == T) + goto found_key; + } + for (i = entry->cache + 1; i < entry->count; i++) { + if (LispObjectCompare(entry->keys[i], okey, + hash->function) == T) + break; + } + } + } + +found_key: + result = value; + if ((found = i < entry->count) == 0) + i = entry->count; + + switch (code) { + case GET_HASH: + RETURN_COUNT = 1; + if (found) { + RETURN(0) = T; + entry->cache = i; + result = entry->values[i]; + } + else + RETURN(0) = NIL; + break; + case PUT_HASH: + entry->cache = i; + if (found) + /* Just replace current entry */ + entry->values[i] = value; + else { + if ((i % 4) == 0) { + LispObj **keys, **values; + + keys = realloc(entry->keys, sizeof(LispObj*) * (i + 4)); + if (keys == NULL) + LispDestroy("out of memory"); + values = realloc(entry->values, sizeof(LispObj*) * (i + 4)); + if (values == NULL) { + free(keys); + LispDestroy("out of memory"); + } + entry->keys = keys; + entry->values = values; + } + entry->keys[i] = okey; + entry->values[i] = value; + ++entry->count; + ++hash->count; + if (hash->count > hash->rehash_threshold * hash->num_entries) + LispRehash(hash); + } + break; + case REM_HASH: + if (found) { + result = T; + --entry->count; + --hash->count; + if (i < entry->count) { + memmove(entry->keys + i, entry->keys + i + 1, + (entry->count - i) * sizeof(LispObj*)); + memmove(entry->values + i, entry->values + i + 1, + (entry->count - i) * sizeof(LispObj*)); + } + if (entry->cache && entry->cache == entry->count) + --entry->cache; + } + break; + } + + return (result); +} + +static void +LispRehash(LispHashTable *hash) +{ + unsigned long key; + LispHashEntry *entries, *nentry, *entry, *last; + long i, size = hash->num_entries * hash->rehash_size; + + for (i = 0; i < sizeof(some_primes) / sizeof(some_primes[0]); i++) + if (some_primes[i] >= size) { + size = some_primes[i]; + break; + } + + entries = calloc(1, sizeof(LispHashEntry) * size); + if (entries == NULL) + goto out_of_memory; + + for (entry = hash->entries, last = entry + hash->num_entries; + entry < last; entry++) { + for (i = 0; i < entry->count; i++) { + key = LispHashKey(entry->keys[i], hash->function) % size; + nentry = entries + key; + if ((nentry->count % 4) == 0) { + LispObj **keys, **values; + + keys = realloc(nentry->keys, sizeof(LispObj*) * (i + 4)); + if (keys == NULL) + goto out_of_memory; + values = realloc(nentry->values, sizeof(LispObj*) * (i + 4)); + if (values == NULL) { + free(keys); + goto out_of_memory; + } + nentry->keys = keys; + nentry->values = values; + } + nentry->keys[nentry->count] = entry->keys[i]; + nentry->values[nentry->count] = entry->values[i]; + ++nentry->count; + + } + } + LispFreeHashEntries(hash->entries, hash->num_entries); + hash->entries = entries; + hash->num_entries = size; + return; + +out_of_memory: + if (entries) + LispFreeHashEntries(entries, size); + LispDestroy("out of memory"); +} + +static void +LispFreeHashEntries(LispHashEntry *entries, long num_entries) +{ + LispHashEntry *entry, *last; + + for (entry = entries, last = entry + num_entries; entry < last; entry++) { + free(entry->keys); + free(entry->values); + } + free(entries); +} + +void +LispFreeHashTable(LispHashTable *hash) +{ + LispFreeHashEntries(hash->entries, hash->num_entries); + free(hash); +} + +LispObj * +Lisp_Clrhash(LispBuiltin *builtin) +/* + clrhash hash-table + */ +{ + LispHashTable *hash; + LispHashEntry *entry, *last; + + LispObj *hash_table = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + hash = hash_table->data.hash.table; + for (entry = hash->entries, last = entry + hash->num_entries; + entry < last; entry++) { + free(entry->keys); + free(entry->values); + entry->keys = entry->values = NULL; + entry->count = entry->cache = 0; + } + hash->count = 0; + + return (hash_table); +} + +LispObj * +Lisp_Gethash(LispBuiltin *builtin) +/* + gethash key hash-table &optional default + */ +{ + return (LispHash(builtin, GET_HASH)); +} + +LispObj * +Lisp_HashTableP(LispBuiltin *builtin) +/* + hash-table-p object + */ +{ + LispObj *object = ARGUMENT(0); + + return (HASHTABLEP(object) ? T : NIL); +} + +LispObj * +Lisp_HashTableCount(LispBuiltin *builtin) +/* + hash-table-count hash-table + */ +{ + LispObj *hash_table = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + return (FIXNUM(hash_table->data.hash.table->count)); +} + +LispObj * +Lisp_HashTableRehashSize(LispBuiltin *builtin) +/* + hash-table-rehash-size hash-table + */ +{ + LispObj *hash_table = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + return (DFLOAT(hash_table->data.hash.table->rehash_size)); +} + +LispObj * +Lisp_HashTableRehashThreshold(LispBuiltin *builtin) +/* + hash-table-rehash-threshold hash-table + */ +{ + LispObj *hash_table = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + return (DFLOAT(hash_table->data.hash.table->rehash_threshold)); +} + +LispObj * +Lisp_HashTableSize(LispBuiltin *builtin) +/* + hash-table-size hash-table + */ +{ + LispObj *hash_table = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + return (FIXNUM(hash_table->data.hash.table->num_entries)); +} + +LispObj * +Lisp_HashTableTest(LispBuiltin *builtin) +/* + hash-table-test hash-table + */ +{ + LispObj *hash_table = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + return (hash_table->data.hash.test); +} + +LispObj * +Lisp_Maphash(LispBuiltin *builtin) +/* + maphash function hash-table + */ +{ + long i; + LispHashEntry *entry, *last; + + LispObj *function, *hash_table; + + hash_table = ARGUMENT(1); + function = ARGUMENT(0); + + CHECK_HASHTABLE(hash_table); + + for (entry = hash_table->data.hash.table->entries, + last = entry + hash_table->data.hash.table->num_entries; + entry < last; entry++) { + for (i = 0; i < entry->count; i++) + APPLY2(function, entry->keys[i], entry->values[i]); + } + + return (NIL); +} + +LispObj * +Lisp_MakeHashTable(LispBuiltin *builtin) +/* + make-hash-table &key test size rehash-size rehash-threshold initial-contents + */ +{ + int function = FEQL; + unsigned long i, isize, xsize; + double drsize, drthreshold; + LispHashTable *hash_table; + LispObj *cons, *result; + + LispObj *test, *size, *rehash_size, *rehash_threshold, *initial_contents; + + initial_contents = ARGUMENT(4); + rehash_threshold = ARGUMENT(3); + rehash_size = ARGUMENT(2); + size = ARGUMENT(1); + test = ARGUMENT(0); + + if (test != UNSPEC) { + if (test == Oeq) + function = FEQ; + else if (test == Oeql) + function = FEQL; + else if (test == Oequal) + function = FEQUAL; + else if (test == Oequalp) + function = FEQUALP; + else + LispDestroy("%s: :TEST must be EQ, EQL, EQUAL, " + "or EQUALP, not %s", STRFUN(builtin), STROBJ(test)); + } + else + test = Oeql; + + if (size != UNSPEC) { + CHECK_INDEX(size); + isize = FIXNUM_VALUE(size); + } + else + isize = 1; + + if (rehash_size != UNSPEC) { + CHECK_DFLOAT(rehash_size); + if (DFLOAT_VALUE(rehash_size) <= 1.0) + LispDestroy("%s: :REHASH-SIZE must a float > 1, not %s", + STRFUN(builtin), STROBJ(rehash_size)); + drsize = DFLOAT_VALUE(rehash_size); + } + else + drsize = 1.5; + + if (rehash_threshold != UNSPEC) { + CHECK_DFLOAT(rehash_threshold); + if (DFLOAT_VALUE(rehash_threshold) < 0.0 || + DFLOAT_VALUE(rehash_threshold) > 1.0) + LispDestroy("%s: :REHASH-THRESHOLD must a float " + "in the range 0.0 - 1.0, not %s", + STRFUN(builtin), STROBJ(rehash_threshold)); + drthreshold = DFLOAT_VALUE(rehash_threshold); + } + else + drthreshold = 0.75; + + if (initial_contents == UNSPEC) + initial_contents = NIL; + CHECK_LIST(initial_contents); + for (xsize = 0, cons = initial_contents; + CONSP(cons); + xsize++, cons = CDR(cons)) + CHECK_CONS(CAR(cons)); + + if (xsize > isize) + isize = xsize; + + for (i = 0; i < sizeof(some_primes) / sizeof(some_primes[0]); i++) + if (some_primes[i] >= isize) { + isize = some_primes[i]; + break; + } + + hash_table = LispMalloc(sizeof(LispHashTable)); + hash_table->entries = LispCalloc(1, sizeof(LispHashEntry) * isize); + hash_table->num_entries = isize; + hash_table->count = 0; + hash_table->function = function; + hash_table->rehash_size = drsize; + hash_table->rehash_threshold = drthreshold; + + result = LispNew(NIL, NIL); + result->type = LispHashTable_t; + result->data.hash.table = hash_table; + result->data.hash.test = test; + + LispMused(hash_table); + LispMused(hash_table->entries); + + if (initial_contents != UNSPEC) { + unsigned long key; + LispHashEntry *entry; + + for (cons = initial_contents; CONSP(cons); cons = CDR(cons)) { + key = LispHashKey(CAAR(cons), function) % isize; + entry = hash_table->entries + key; + + if ((entry->count % 4) == 0) { + LispObj **keys, **values; + + keys = realloc(entry->keys, sizeof(LispObj*) * (i + 4)); + if (keys == NULL) + LispDestroy("out of memory"); + values = realloc(entry->values, sizeof(LispObj*) * (i + 4)); + if (values == NULL) { + free(keys); + LispDestroy("out of memory"); + } + entry->keys = keys; + entry->values = values; + } + entry->keys[entry->count] = CAAR(cons); + entry->values[entry->count] = CDAR(cons); + ++entry->count; + } + hash_table->count = xsize; + } + + return (result); +} + +LispObj * +Lisp_Remhash(LispBuiltin *builtin) +/* + remhash key hash-table + */ +{ + return (LispHash(builtin, REM_HASH)); +} + +LispObj * +Lisp_XeditPuthash(LispBuiltin *builtin) +/* + lisp::puthash key hash-table value + */ +{ + return (LispHash(builtin, PUT_HASH)); +} Index: xc/programs/xedit/lisp/hash.h diff -u /dev/null xc/programs/xedit/lisp/hash.h:1.2 --- /dev/null Thu Feb 27 12:34:57 2003 +++ xc/programs/xedit/lisp/hash.h Fri Nov 8 03:00:56 2002 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/hash.h,v 1.2 2002/11/08 08:00:56 paulo Exp $ */ + +#ifndef Lisp_hash_h +#define Lisp_hash_h + +#include "private.h" + +typedef struct _LispHashEntry { + LispObj **keys; + LispObj **values; + long cache; + long count; +} LispHashEntry; + +struct _LispHashTable { + LispHashEntry *entries; + long num_entries; + long count; + int function; /* Function is EQ, EQL, EQUAL, or EQUALP */ + double rehash_size; + double rehash_threshold; +}; + +/* + * Prototypes + */ +void LispFreeHashTable(LispHashTable*); + +LispObj *Lisp_Clrhash(LispBuiltin*); +LispObj *Lisp_Gethash(LispBuiltin*); +LispObj *Lisp_HashTableCount(LispBuiltin*); +LispObj *Lisp_HashTableP(LispBuiltin*); +LispObj *Lisp_HashTableRehashSize(LispBuiltin*); +LispObj *Lisp_HashTableRehashThreshold(LispBuiltin*); +LispObj *Lisp_HashTableSize(LispBuiltin*); +LispObj *Lisp_HashTableTest(LispBuiltin*); +LispObj *Lisp_Maphash(LispBuiltin*); +LispObj *Lisp_MakeHashTable(LispBuiltin*); +LispObj *Lisp_Remhash(LispBuiltin*); +LispObj *Lisp_XeditPuthash(LispBuiltin*); + +#endif /* Lisp_hash_h */ Index: xc/programs/xedit/lisp/helper.c diff -u xc/programs/xedit/lisp/helper.c:1.15 xc/programs/xedit/lisp/helper.c:1.47 --- xc/programs/xedit/lisp/helper.c:1.15 Sat Oct 27 23:34:29 2001 +++ xc/programs/xedit/lisp/helper.c Mon Nov 25 23:06:28 2002 @@ -27,923 +27,1098 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/helper.c,v 1.15 2001/10/28 03:34:29 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/helper.c,v 1.47 2002/11/26 04:06:28 paulo Exp $ */ #include "helper.h" +#include "pathname.h" +#include "package.h" +#include "read.h" +#include "stream.h" +#include "write.h" +#include "hash.h" #include <ctype.h> +#include <fcntl.h> +#include <errno.h> +#include <math.h> +#include <sys/stat.h> /* * Prototypes */ -static LispObj *_LispReallyDo(LispMac*, LispObj*, char*, int); -static LispObj *_LispReallyDoListTimes(LispMac*, LispObj*, char*, int); -extern int LispGet(LispMac*); -extern int LispUnget(LispMac*); +static LispObj *LispReallyDo(LispBuiltin*, int); +static LispObj *LispReallyDoListTimes(LispBuiltin*, int); +/* in math.c */ +extern LispObj *LispFloatCoerce(LispBuiltin*, LispObj*); + /* * Implementation */ LispObj * -_LispEqual(LispMac *mac, LispObj *left, LispObj *right) +LispObjectCompare(LispObj *left, LispObj *right, int function) { - LispObj *res = NIL; + LispType ltype, rtype; + LispObj *result = left == right ? T : NIL; - if (left->type == right->type) { - switch (left->type) { - case LispNil_t: - case LispTrue_t: - res = T; + /* If left and right are the same object, or if function is EQ */ + if (result == T || function == FEQ) + return (result); + + ltype = OBJECT_TYPE(left); + rtype = OBJECT_TYPE(right); + + /* Equalp requires that numeric objects be compared by value, and + * strings or characters comparison be case insenstive */ + if (function == FEQUALP) { + switch (ltype) { + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + case LispDFloat_t: + case LispRatio_t: + case LispBigratio_t: + case LispComplex_t: + switch (rtype) { + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + case LispDFloat_t: + case LispRatio_t: + case LispBigratio_t: + case LispComplex_t: + result = APPLY2(Oequal_, left, right); + break; + default: + break; + } + goto compare_done; + case LispSChar_t: + if (rtype == LispSChar_t && + toupper(SCHAR_VALUE(left)) == toupper(SCHAR_VALUE(right))) + result = T; + goto compare_done; + case LispString_t: + if (rtype == LispString_t && STRLEN(left) == STRLEN(right)) { + long i = STRLEN(left); + char *sl = THESTR(left), *sr = THESTR(right); + + for (--i; i >= 0; i--) + if (toupper(sl[i]) != toupper(sr[i])) + break; + if (i < 0) + result = T; + } + goto compare_done; + case LispArray_t: + if (rtype == LispArray_t && + left->data.array.type == right->data.array.type && + left->data.array.rank == right->data.array.rank && + LispObjectCompare(left->data.array.dim, + right->data.array.dim, + FEQUAL) != NIL) { + LispObj *llist = left->data.array.list, + *rlist = right->data.array.list; + + for (; CONSP(llist); llist = CDR(llist), rlist = CDR(rlist)) + if (LispObjectCompare(CAR(llist), CAR(rlist), + FEQUALP) == NIL) + break; + if (!CONSP(llist)) + result = T; + } + goto compare_done; + case LispStruct_t: + if (rtype == LispStruct_t && + left->data.struc.def == right->data.struc.def) { + LispObj *lfield = left->data.struc.fields, + *rfield = right->data.struc.fields; + + for (; CONSP(lfield); + lfield = CDR(lfield), rfield = CDR(rfield)) { + if (LispObjectCompare(CAR(lfield), CAR(rfield), + FEQUALP) != T) + break; + } + if (!CONSP(lfield)) + result = T; + } + goto compare_done; + case LispHashTable_t: + if (rtype == LispHashTable_t && + left->data.hash.table->count == + right->data.hash.table->count && + left->data.hash.test == right->data.hash.test) { + unsigned long i; + LispObj *test = left->data.hash.test; + LispHashEntry *lentry = left->data.hash.table->entries, + *llast = lentry + + left->data.hash.table->num_entries, + *rentry = right->data.hash.table->entries; + + for (; lentry < llast; lentry++, rentry++) { + if (lentry->count != rentry->count) + break; + for (i = 0; i < lentry->count; i++) { + if (APPLY2(test, + lentry->keys[i], + rentry->keys[i]) == NIL || + LispObjectCompare(lentry->values[i], + rentry->values[i], + FEQUALP) == NIL) + break; + } + if (i < lentry->count) + break; + } + if (lentry == llast) + result = T; + } + goto compare_done; + default: break; - case LispReal_t: - if (left->data.real == right->data.real) - res = T; + } + } + + /* Function is EQL or EQUAL, or EQUALP on arguments with the same rules */ + if (ltype == rtype) { + switch (ltype) { + case LispFixnum_t: + case LispSChar_t: + if (FIXNUM_VALUE(left) == FIXNUM_VALUE(right)) + result = T; break; - case LispCharacter_t: case LispInteger_t: - if (left->data.integer == right->data.integer) - res = T; + if (INT_VALUE(left) == INT_VALUE(right)) + result = T; break; - case LispAtom_t: + case LispDFloat_t: + if (DFLOAT_VALUE(left) == DFLOAT_VALUE(right)) + result = T; + break; + case LispRatio_t: + if (left->data.ratio.numerator == + right->data.ratio.numerator && + left->data.ratio.denominator == + right->data.ratio.denominator) + result = T; + break; + case LispComplex_t: + if (LispObjectCompare(left->data.complex.real, + right->data.complex.real, + function) == T && + LispObjectCompare(left->data.complex.imag, + right->data.complex.imag, + function) == T) + result = T; + break; + case LispBignum_t: + if (mpi_cmp(left->data.mp.integer, right->data.mp.integer) == 0) + result = T; + break; + case LispBigratio_t: + if (mpr_cmp(left->data.mp.ratio, right->data.mp.ratio) == 0) + result = T; + break; + default: + break; + } + + /* Next types must be the same object for EQL */ + if (function == FEQL) + goto compare_done; + + switch (ltype) { case LispString_t: - if (STRPTR(left) == STRPTR(right)) - res = T; + if (STRLEN(left) == STRLEN(right) && + memcmp(THESTR(left), THESTR(right), STRLEN(left)) == 0) + result = T; break; case LispCons_t: - if (_LispEqual(mac, CAR(left), CAR(right)) == T && - _LispEqual(mac, CDR(left), CDR(right)) == T) - res = T; + if (LispObjectCompare(CAR(left), CAR(right), function) == T && + LispObjectCompare(CDR(left), CDR(right), function) == T) + result = T; break; case LispQuote_t: - res = _LispEqual(mac, left->data.quote, right->data.quote); + case LispBackquote_t: + case LispPathname_t: + result = LispObjectCompare(left->data.pathname, + right->data.pathname, function); break; case LispLambda_t: - res = _LispEqual(mac, left->data.lambda.name, - right->data.lambda.name); + result = LispObjectCompare(left->data.lambda.name, + right->data.lambda.name, + function); break; case LispOpaque_t: if (left->data.opaque.data == right->data.opaque.data) - res = T; + result = T; break; + case LispRegex_t: + /* If the regexs are guaranteed to generate the same matches */ + if (left->data.regex.options == right->data.regex.options) + result = LispObjectCompare(left->data.regex.pattern, + right->data.regex.pattern, + function); + break; default: - if (left == right) - res = T; break; } } - return (res); +compare_done: + return (result); } -LispObj * -_LispNth(LispMac *mac, LispObj *list, char *name, int cdr) +void +LispCheckSequenceStartEnd(LispBuiltin *builtin, + LispObj *sequence, LispObj *start, LispObj *end, + long *pstart, long *pend, long *plength) { - int count, maxpos; - LispObj *nth = CAR(list), *seq = CDR(list), *setf = list; + /* Calculate length of sequence and check it's type */ + *plength = LispLength(sequence); - if (!INDEX_P(nth)) - LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, nth), name); - if (seq->type != LispCons_t) - LispDestroy(mac, "%s is not of type list, at %s", - LispStrObj(mac, seq), name); - maxpos = NUMBER_VALUE(nth); - for (count = 0, seq = CAR(seq); - count < maxpos && seq->type == LispCons_t; - ++count, setf = seq, seq = CDR(seq)) - ; + /* Check start argument */ + if (start == UNSPEC || start == NIL) + *pstart = 0; + else { + CHECK_INDEX(start); + *pstart = FIXNUM_VALUE(start); + } - if (count == maxpos) - return (cdr || seq == NIL ? seq : CAR(seq)); + /* Check end argument */ + if (end == UNSPEC || end == NIL) + *pend = *plength; + else { + CHECK_INDEX(end); + *pend = FIXNUM_VALUE(end); + } - return (NIL); + /* Check start argument */ + if (*pstart > *pend) + LispDestroy("%s: :START %ld is larger than :END %ld", + STRFUN(builtin), *pstart, *pend); + + /* Check end argument */ + if (*pend > *plength) + LispDestroy("%s: :END %ld is larger then sequence length %ld", + STRFUN(builtin), *pend, *plength); } -LispObj * -_LispFindPlace(LispMac *mac, LispObj *list, LispObj *ref) +long +LispLength(LispObj *sequence) { - LispObj *place; + long length; - for (; list->type == LispCons_t; list = CDR(list)) { - if (CAR(list) == ref) - return (list); - else if (CDR(list) == ref) - return (list); - else if ((place = _LispFindPlace(mac, CAR(list), ref)) != NULL) - return (place); + if (sequence == NIL) + return (0); + switch (OBJECT_TYPE(sequence)) { + case LispString_t: + length = STRLEN(sequence); + break; + case LispArray_t: + if (sequence->data.array.rank != 1) + goto not_a_sequence; + sequence = sequence->data.array.list; + /*FALLTROUGH*/ + case LispCons_t: + for (length = 0; + CONSP(sequence); + length++, sequence = CDR(sequence)) + ; + break; + default: +not_a_sequence: + LispDestroy("LENGTH: %s is not a sequence", STROBJ(sequence)); + /*NOTREACHED*/ + length = 0; } - return (NULL); + return (length); } LispObj * -_LispMinMax(LispMac *mac, LispObj *list, char *name, int max) +LispCharacterCoerce(LispBuiltin *builtin, LispObj *object) { - double real, val; - LispObj *obj; - - obj = EVAL(CAR(list)); - if (!NUMBER_P(obj)) - LispDestroy(mac, ExpectingNumberAt, name); - real = NUMBER_VALUE(obj); - for (list = CDR(list); list != NIL; list = CDR(list)) { - obj = EVAL(CAR(list)); - if (!NUMBER_P(obj)) - LispDestroy(mac, ExpectingNumberAt, name); - val = NUMBER_VALUE(obj); - if ((max && val > real) || (!max && val < real)) - real = val; - } - - return (REAL(real)); + if (SCHARP(object)) + return (object); + else if (STRINGP(object) && STRLEN(object) == 1) + return (SCHAR(THESTR(object)[0])); + else if (SYMBOLP(object) && ATOMID(object)[1] == '\0') + return (SCHAR(ATOMID(object)[0])); + else if (INDEXP(object)) { + int c = FIXNUM_VALUE(object); + + if (c <= 0xff) + return (SCHAR(c)); + } + else if (object == T) + return (SCHAR('T')); + + LispDestroy("%s: cannot convert %s to character", + STRFUN(builtin), STROBJ(object)); + /*NOTREACHED*/ + return (NIL); } LispObj * -_LispBoolCond(LispMac *mac, LispObj *list, char *name, int op) +LispStringCoerce(LispBuiltin *builtin, LispObj *object) { - LispObj *obj; - double value, val; - int cond; - - cond = 1; - obj = op == NOT_EQUAL ? CAR(list) : EVAL(CAR(list)); - if (!NUMBER_P(obj)) - LispDestroy(mac, ExpectingNumberAt, name); - value = NUMBER_VALUE(obj); - - /* special handling, as (/= 3 6 5 2) => T, but (/= 3 3 5 3) => NIL - * all elements must be different to be True - * Also, for NOT_EQUAL, arguments must be evaluated before calling - * this function. - */ - if (op == NOT_EQUAL) { - LispObj *cmp; - - list = CDR(list); - if (list == NIL) - return (T); - - /* check if numbers first */ - for (obj = list; obj != NIL; obj = CDR(obj)) - if (CAR(obj)->type != LispReal_t) - LispDestroy(mac, ExpectingNumberAt, name); - - do { - for (cmp = list; cmp != NIL; cmp = CDR(cmp)) { - obj = CAR(cmp); - if (value == NUMBER_VALUE(obj)) - return (NIL); - } - value = NUMBER_VALUE(CAR(list)); - list = CDR(list); - } while (list != NIL); - return (T); - } - - for (list = CDR(list); list != NIL; list = CDR(list)) { - obj = EVAL(CAR(list)); - if (!NUMBER_P(obj)) - LispDestroy(mac, ExpectingNumberAt, name); - val = NUMBER_VALUE(obj); - switch (op) { - case LESS: - if (value >= val) - cond = 0; - break; - case LESS_EQUAL: - if (value > val) - cond = 0; - break; - case EQUAL: - if (value != val) - cond = 0; - break; - case GREATER: - if (value <= val) - cond = 0; - break; - case GREATER_EQUAL: - if (value < val) - cond = 0; - break; - } - if (!cond) - break; - value = val; - } - return (cond ? T : NIL); + if (STRINGP(object)) + return (object); + else if (SYMBOLP(object)) + return (LispSymbolName(object)); + else if (SCHARP(object)) { + char string[1]; + + string[0] = SCHAR_VALUE(object); + return (LSTRING(string, 1)); + } + else if (object == NIL) + return (LSTRING(Snil, 3)); + else if (object == T) + return (LSTRING(St, 1)); + else + LispDestroy("%s: cannot convert %s to string", + STRFUN(builtin), STROBJ(object)); + /*NOTREACHED*/ + return (NIL); } LispObj * -_LispCharBoolCond(LispMac *mac, LispObj *list, char *name, int op, int cas) +LispCoerce(LispBuiltin *builtin, + LispObj *object, LispObj *result_type) { - LispObj *obj; - long value, comp; - int cond; - - cond = 1; - obj = op == NOT_EQUAL ? CAR(list) : EVAL(CAR(list)); - if (obj->type != LispCharacter_t) - LispDestroy(mac, "expecting character, at %s", name); - value = obj->data.integer; - if (cas) - value = toupper(value); - - if (op == NOT_EQUAL) { - LispObj *cmp; - - list = CDR(list); - if (list == NIL) - return (T); - - for (obj = list; obj != NIL; obj = CDR(obj)) - if (CAR(obj)->type != LispCharacter_t) - LispDestroy(mac, "expecting character, at %s", name); - - do { - for (cmp = list; cmp != NIL; cmp = CDR(cmp)) { - obj = CAR(cmp); - comp = obj->data.integer; - if (cas) - comp = toupper(comp); - if (value == comp) - return (NIL); - } - value = CAR(list)->data.integer; - if (cas) - value = toupper(value); - list = CDR(list); - } while (list != NIL); - return (T); - } - - for (list = CDR(list); list != NIL; list = CDR(list)) { - obj = EVAL(CAR(list)); - if (obj->type != LispCharacter_t) - LispDestroy(mac, "expecting character, at %s", name); - comp = obj->data.integer; - if (cas) - comp = toupper(comp); - switch (op) { - case LESS: - if (value >= comp) - cond = 0; - break; - case LESS_EQUAL: - if (value > comp) - cond = 0; - break; - case EQUAL: - if (value != comp) - cond = 0; - break; - case GREATER: - if (value <= comp) - cond = 0; - break; - case GREATER_EQUAL: - if (value < comp) - cond = 0; + LispObj *result = NIL; + LispType type = LispNil_t; + + if (result_type == NIL) + /* not even NIL can be converted to NIL? */ + LispDestroy("%s: cannot convert %s to NIL", + STRFUN(builtin), STROBJ(object)); + + else if (result_type == T) + /* no conversion */ + return (object); + + else if (!SYMBOLP(result_type)) + /* only know about simple types */ + LispDestroy("%s: bad argument %s", + STRFUN(builtin), STROBJ(result_type)); + + else { + /* check all known types */ + + Atom_id atom = ATOMID(result_type); + + if (atom == Satom) { + if (CONSP(object)) + goto coerce_fail; + return (object); + } + /* only convert ATOM to SYMBOL */ + + if (atom == Sfloat) + type = LispDFloat_t; + else if (atom == Sinteger) + type = LispInteger_t; + else if (atom == Scons || atom == Slist) { + if (object == NIL) + return (object); + type = LispCons_t; + } + else if (atom == Sstring) + type = LispString_t; + else if (atom == Scharacter) + type = LispSChar_t; + else if (atom == Scomplex) + type = LispComplex_t; + else if (atom == Svector || atom == Sarray) + type = LispArray_t; + else if (atom == Sopaque) + type = LispOpaque_t; + else if (atom == Srational) + type = LispRatio_t; + else if (atom == Spathname) + type = LispPathname_t; + else + LispDestroy("%s: invalid type specification %s", + STRFUN(builtin), ATOMID(result_type)); + } + + if (OBJECT_TYPE(object) == LispOpaque_t) { + switch (type) { + case LispAtom_t: + result = ATOM(object->data.opaque.data); + break; + case LispString_t: + result = STRING(object->data.opaque.data); break; + case LispSChar_t: + result = SCHAR((unsigned long)object->data.opaque.data); + break; + case LispDFloat_t: + result = DFLOAT((double)((long)object->data.opaque.data)); + break; + case LispInteger_t: + result = INTEGER(((long)object->data.opaque.data)); + break; + case LispOpaque_t: + result = OPAQUE(object->data.opaque.data, 0); + break; + default: + goto coerce_fail; + break; } - if (!cond) - break; - value = obj->data.integer; - if (cas) - value = toupper(value); } - return (cond ? T : NIL); -} -LispObj * -_LispDefLambda(LispMac *mac, LispObj *list, LispFunType type) -{ - LispObj *name = NIL, *args, *code, *obj = NIL, *fun, *sto; - static char *types[4] = {"LAMBDA", "FUNCTION", "MACRO", "SETF-METHOD"}; - static char *fnames[4] = {"LAMBDA", "DEFUN", "DEFMACRO", "DEFSETF"}; - int num_args, rest, optional, key; - - /* name */ - if (type != LispLambda) { - if ((name = CAR(list))->type != LispAtom_t) - LispDestroy(mac, "%s cannot be a %s name, at %s", - LispStrObj(mac, name), types[type], fnames[type]); - list = CDR(list); - } - - /* args */ - args = CAR(list); - num_args = rest = optional = key = 0; - - if (args->type == LispCons_t) { - for (obj = args; obj != NIL; obj = CDR(obj), ++num_args) - if (CAR(obj)->type == LispCons_t && (key || optional)) { - /* is this a default value? */ - if (!SYMBOL_P(CAR(CAR(obj)))) - LispDestroy(mac, "%s cannot be a %s argument name, at %s %s", - LispStrObj(mac, CAR(CAR(obj))), types[type], - fnames[type], - type == LispLambda ? "..." : STRPTR(name)); - else if (CDR(CAR(obj)) != NIL && - (CDR(CAR(obj))->type != LispCons_t || - CDR(CDR(CAR(obj))) != NIL)) - LispDestroy(mac, "bad argument specification %s, at %s %s", - LispStrObj(mac, CAR(obj)), types[type], - fnames[type], - type == LispLambda ? "..." : STRPTR(name)); - } - else if (!SYMBOL_P(CAR(obj)) || - STRPTR(CAR(obj))[0] == ':') - LispDestroy(mac, "%s cannot be a %s argument name, at %s %s", - LispStrObj(mac, CAR(obj)), types[type], fnames[type], - type == LispLambda ? "..." : STRPTR(name)); - else if (STRPTR(CAR(obj))[0] == '&') { - if (strcmp(STRPTR(CAR(obj)) + 1, "REST") == 0) { - if (rest || CDR(obj) == NIL || CDR(CDR(obj)) != NIL) - LispDestroy(mac, "syntax error parsing &REST," - " at %s %s", fnames[type], - type == LispLambda ? - "..." : STRPTR(name)); - rest = 1; - } - else if (strcmp(STRPTR(CAR(obj)) + 1, "KEY") == 0) { - if (rest) - LispDestroy(mac, "&KEY not allowed after &REST," - " at %s %s", fnames[type], - type == LispLambda ? - "..." : STRPTR(name)); - if (key || optional || CDR(obj) == NIL) - LispDestroy(mac, "syntax error parsing &KEY," - " at %s %s", fnames[type], - type == LispLambda ? - "..." : STRPTR(name)); - key = 1; + else if (OBJECT_TYPE(object) != type) { + switch (type) { + case LispInteger_t: + if (INTEGERP(object)) + result = object; + else if (DFLOATP(object)) { + if ((long)DFLOAT_VALUE(object) == DFLOAT_VALUE(object)) + result = INTEGER((long)DFLOAT_VALUE(object)); + else { + mpi *integer = LispMalloc(sizeof(mpi)); + + mpi_init(integer); + mpi_setd(integer, DFLOAT_VALUE(object)); + if (mpi_getd(integer) != DFLOAT_VALUE(object)) { + mpi_clear(integer); + LispFree(integer); + goto coerce_fail; + } + result = BIGNUM(integer); + } } - else if (strcmp(STRPTR(CAR(obj)) + 1, "OPTIONAL") == 0) { - if (rest) - LispDestroy(mac, "&OPTIONAL not allowed after &REST," - " at %s %s", fnames[type], - type == LispLambda ? - "..." : STRPTR(name)); - if (key || optional || CDR(obj) == NIL) - LispDestroy(mac, "syntax error parsing &OPTIONAL," - " at %s %s", fnames[type], - type == LispLambda ? - "..." : STRPTR(name)); - optional = 1; + else + goto coerce_fail; + break; + case LispRatio_t: + if (DFLOATP(object)) { + mpr *ratio = LispMalloc(sizeof(mpr)); + + mpr_init(ratio); + mpr_setd(ratio, DFLOAT_VALUE(object)); + if (mpr_fiti(ratio)) { + result = RATIO(mpi_geti(mpr_num(ratio)), + mpi_geti(mpr_den(ratio))); + mpr_clear(ratio); + LispFree(ratio); + } + else + result = BIGRATIO(ratio); } + else if (RATIONALP(object)) + result = object; else - LispDestroy(mac, "%s not allowed %at %s %s", - STRPTR(CAR(obj)), fnames[type], - type == LispLambda ? "..." : STRPTR(name)); - } - } - else if (args != NIL) - LispDestroy(mac, "%s cannot be a %s argument list, at %s %s", - LispStrObj(mac, args), types[type], fnames[type], - type == LispLambda ? "..." : STRPTR(name)); - - if (type == LispSetf) { - list = CDR(list); - sto = CAR(list); - if (sto->type != LispCons_t) - LispDestroy(mac, "%s is a bad store value, at %s", - LispStrObj(mac, sto), fnames[type]); - for (obj = CAR(sto); obj->type == LispCons_t; obj = CDR(obj)) - if (!SYMBOL_P(CAR(obj)) || STRPTR(CAR(obj))[0] == ':') - LispDestroy(mac, "%s cannot be a variable name, at %s", - LispStrObj(mac, CAR(obj)), fnames[type]); - args = CONS(args, sto); - } - - /* code */ - code = CDR(list); - - GCProtect(); - fun = LispNewLambda(mac, name, args, code, num_args, type, - key, optional, rest); - GCUProtect(); - - if (type == LispSetf) - LispSetAtomSetfProperty(mac, name->data.atom, fun); - else if (type != LispLambda) { - if (name->data.atom->property) { - if ((name->data.atom->property->function || - name->data.atom->property->builtin)) - fprintf(lisp_stderr, "*** Warning: %s is being redefined\n", - STRPTR(name)); - - if (name->data.atom->property->builtin) - LispRemAtomBuiltinProperty(mac, name->data.atom); + goto coerce_fail; + break; + case LispDFloat_t: + result = LispFloatCoerce(builtin, object); + break; + case LispComplex_t: + if (NUMBERP(object)) + result = object; + else + goto coerce_fail; + break; + case LispString_t: + if (object == NIL) + result = STRING(""); + else + result = LispStringCoerce(builtin, object); + break; + case LispSChar_t: + result = LispCharacterCoerce(builtin, object); + break; + case LispArray_t: + if (LISTP(object)) + result = VECTOR(object); + else + goto coerce_fail; + break; + case LispCons_t: + if (ARRAYP(object) && object->data.array.rank == 1) + result = object->data.array.list; + else + goto coerce_fail; + break; + case LispPathname_t: + result = APPLY1(Oparse_namestring, object); + break; + default: + goto coerce_fail; } - LispSetAtomFunctionProperty(mac, name->data.atom, fun); } + else + result = object; - return (type != LispLambda ? name : fun); + return (result); + +coerce_fail: + LispDestroy("%s: cannot convert %s to %s", + STRFUN(builtin), STROBJ(object), ATOMID(result_type)); + /* NOTREACHED */ + return (NIL); } static LispObj * -_LispReallyDo(LispMac *mac, LispObj *list, char *fname, int refs) +LispReallyDo(LispBuiltin *builtin, int refs) +/* + do init test &rest body + do* init test &rest body + */ { - LispObj *old_frm, *old_env, *env, *res, *args, *test, *body, *obj; - - env = res = NIL; - old_frm = FRM; - old_env = ENV; - args = CAR(list); - test = CAR(CDR(list)); - body = CDR(CDR(list)); - - if (test->type != LispCons_t) - LispDestroy(mac, "end test condition must be a list, at %s", - LispStrObj(mac, args), fname); - - /* Add variables */ - if (args != NIL && args->type != LispCons_t) - LispDestroy(mac, "%s is not of type list, at %s", - LispStrObj(mac, args), fname); - - for (obj = args; obj != NIL; obj = CDR(obj)) { - LispObj *var, *val, *step; - - var = val = NIL; - step = NULL; - list = CAR(obj); - if (SYMBOL_P(list)) - var = list; - else if (list->type != LispCons_t) - LispDestroy(mac, "%s is not of type list, at %s", - LispStrObj(mac, list), fname); - else { - if ((var = CAR(list))->type != LispAtom_t) - LispDestroy(mac, "%s is invalid as a variable name, at %s", - LispStrObj(mac, var), fname); - if ((list = CDR(list)) != NIL) { - val = EVAL(CAR(list)); - if ((list = CDR(list)) != NIL) - step = CAR(list); - } + GC_ENTER(); + int stack, lex, head; + LispObj *list, *symbol, *value, *values, *cons; + + LispObj *init, *test, *body; + + body = ARGUMENT(2); + test = ARGUMENT(1); + init = ARGUMENT(0); + + if (!CONSP(test)) + LispDestroy("%s: end test condition must be a list, not %s", + STRFUN(builtin), STROBJ(init)); + + CHECK_LIST(init); + + /* Save state */ + stack = lisp__data.stack.length; + lex = lisp__data.env.lex; + head = lisp__data.env.length; + + values = cons = NIL; + for (list = init; CONSP(list); list = CDR(list)) { + symbol = CAR(list); + if (!SYMBOLP(symbol)) { + CHECK_CONS(symbol); + value = CDR(symbol); + symbol = CAR(symbol); + CHECK_SYMBOL(symbol); + CHECK_CONS(value); + value = EVAL(CAR(value)); } - GCProtect(); - if (step) - list = CONS(var, CONS(val, CONS(step, NIL))); else - list = CONS(var, CONS(val, NIL)); - if (env == NIL) { - env = CONS(list, NIL); - FRM = CONS(env, FRM); + value = NIL; + + CHECK_CONSTANT(symbol); + + LispAddVar(symbol, value); + + /* Bind variable now */ + if (refs) { + ++lisp__data.env.head; } else { - CDR(env) = CONS(CAR(env), CDR(env)); - CAR(env) = list; - } - GCUProtect(); - if (refs) - LispAddVar(mac, var, val); - } - - /* Need to update CAR(FRM) or will run loop without gc protection! */ - env = CAR(FRM) = LispReverse(env); - if (!refs) { - for (obj = env; obj != NIL; obj = CDR(obj)) { - list = CAR(obj); - LispAddVar(mac, CAR(list), CAR(CDR(list))); + if (values == NIL) { + values = cons = CONS(NIL, NIL); + GC_PROTECT(values); + } + else { + RPLACD(cons, CONS(NIL, NIL)); + cons = CDR(cons); + } } } + if (!refs) + lisp__data.env.head = lisp__data.env.length; - /* Execute iterations */ for (;;) { - if (EVAL(CAR(test)) != NIL) { - if (CDR(test) != NIL) - res = EVAL(CAR(CDR(test))); + if (EVAL(CAR(test)) != NIL) break; + + /* TODO Run this code in an implicit tagbody */ + for (list = body; CONSP(list); list = CDR(list)) + (void)EVAL(CAR(list)); + + /* Error checking already done in the initialization */ + for (list = init, cons = values; CONSP(list); list = CDR(list)) { + symbol = CAR(list); + if (CONSP(symbol)) { + value = CDDR(symbol); + symbol = CAR(symbol); + if (CONSP(value)) + value = EVAL(CAR(value)); + else + value = NIL; + } + else + value = NIL; + + if (refs) + LispSetVar(symbol, value); + else { + RPLACA(cons, value); + cons = CDR(cons); + } } - (void)Lisp_Progn(mac, body, fname); - /* Update variables */ - for (obj = env; obj != NIL; obj = CDR(obj)) { - list = CAR(obj); - if (CDR(CDR(list)) != NIL) - LispSetVar(mac, CAR(list), - EVAL(CAR(CDR(CDR(list))))); + if (!refs) { + for (list = init, cons = values; + CONSP(list); + list = CDR(list), cons = CDR(cons)) { + symbol = CAR(list); + if (CONSP(symbol)) { + if (CONSP(CDR(symbol))) + LispSetVar(CAR(symbol), CAR(cons)); + } + } } } - ENV = old_env; - FRM = old_frm; + if (CONSP(CDR(test))) + value = EVAL(CADR(test)); + else + value = NIL; + + /* Restore state */ + lisp__data.stack.length = stack; + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = head; + GC_LEAVE(); - return (res); + return (value); } LispObj * -_LispDo(LispMac *mac, LispObj *list, char *fname, int refs) +LispDo(LispBuiltin *builtin, int refs) +/* + do init test &rest body + do* init test &rest body + */ { - int did_jump, *pdid_jump = &did_jump; - LispObj *res, **pres = &res; + int jumped, *pjumped; + LispObj *result, **presult; LispBlock *block; - *pres = NIL; - *pdid_jump = 1; - block = LispBeginBlock(mac, NIL, LispBlockTag); + jumped = 1; + result = NIL; + presult = &result; + pjumped = &jumped; + block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { - *pres = _LispReallyDo(mac, list, fname, refs); - *pdid_jump = 0; + result = LispReallyDo(builtin, refs); + jumped = 0; } - LispEndBlock(mac, block); - if (*pdid_jump) - *pres = mac->block.block_ret; + LispEndBlock(block); + if (jumped) + result = lisp__data.block.block_ret; - return (*pres); + return (result); } static LispObj * -_LispReallyDoListTimes(LispMac *mac, LispObj *list, char *fname, int times) +LispReallyDoListTimes(LispBuiltin *builtin, int times) +/* + dolist init &rest body + dotimes init &rest body + */ { - double count = 0.0; - LispObj *var, *val = NIL, *res = NIL, *body, *old_frm, *old_env; + GC_ENTER(); + int head = lisp__data.env.length; + long count = 0, end = 0; + LispObj *symbol, *value = NIL, *result = NIL, *init, *body, *object; + + body = ARGUMENT(1); + init = ARGUMENT(0); /* Parse arguments */ - if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "expecting list, at %s", fname); - body = CDR(list); - list = CAR(list); - if ((var = CAR(list))->type != LispAtom_t) - LispDestroy(mac, "%s is invalid as a variable name, at %s", - LispStrObj(mac, var), fname); - list = CDR(list); - - /* Save environment */ - old_frm = FRM; - old_env = ENV; - - if (list == NIL) { - if (!times) - val = res = NIL; - else - LispDestroy(mac, "NIL is not a number, at %s", fname); + CHECK_CONS(init); + symbol = CAR(init); + CHECK_SYMBOL(symbol); + init = CDR(init); + + if (init == NIL) { + if (times) + LispDestroy("%s: NIL is not a number", STRFUN(builtin)); } else { - if (list->type == LispCons_t) { - val = CAR(list); - list = CDR(list); - if (list == NIL) - res = NIL; - else if (list->type == LispCons_t) - res = CAR(list); - else - LispDestroy(mac, "expecting list, at %s", fname); + CHECK_CONS(init); + value = CAR(init); + init = CDR(init); + if (init != NIL) { + CHECK_CONS(init); + result = CAR(init); } - else - LispDestroy(mac, "%s is not a list, at %s", - LispStrObj(mac, val), fname); - val = EVAL(val); + value = EVAL(value); - if (times && (!INTEGER_P(val))) - LispDestroy(mac, "%s is not an integer, at %s", - LispStrObj(mac, val), fname); - else if (!times && (val != NIL && val->type != LispCons_t)) - LispDestroy(mac, "%s is not a list, at %s", - LispStrObj(mac, val), fname); + if (times) { + CHECK_INDEX(value); + end = FIXNUM_VALUE(value); + } + else { + CHECK_LIST(value); + /* Protect iteration control from gc */ + GC_PROTECT(value); + } } - /* Protect iteration control from gc */ - FRM = CONS(val, FRM); + /* The variable is only bound inside the loop, so it is safe to optimize + * it out if there is no code to execute. But the result form may reference + * the bound variable. */ + if (!CONSP(body)) { + if (times) + count = end; + else + value = NIL; + } /* Initialize counter */ + CHECK_CONSTANT(symbol); if (times) - LispAddVar(mac, var, REAL(count)); + LispAddVar(symbol, FIXNUM(count)); else - LispAddVar(mac, var, CAR(val)); + LispAddVar(symbol, CONSP(value) ? CAR(value) : value); + ++lisp__data.env.head; + if (!CONSP(body) || (times && count >= end) || (!times && !CONSP(value))) + goto loop_done; + /* Execute iterations */ for (;;) { - /* Check loop */ + for (object = body; CONSP(object); object = CDR(object)) + (void)EVAL(CAR(object)); + + /* Update symbols and check exit condition */ if (times) { - if ((count += 1.0) > NUMBER_VALUE(val)) + ++count; + LispSetVar(symbol, FIXNUM(count)); + if (count >= end) break; } - else if (val == NIL) - break; - - (void)Lisp_Progn(mac, body, fname); - - /* Update variables */ - if (times) - LispSetVar(mac, var, REAL(count)); else { - val = CDR(val); - if (val == NIL) + value = CDR(value); + if (!CONSP(value)) { + LispSetVar(symbol, NIL); break; - else if (val->type != LispCons_t) - LispDestroy(mac, "true list required, at %s", fname); - LispSetVar(mac, var, CAR(val)); + } + LispSetVar(symbol, CAR(value)); } } - ENV = old_env; - FRM = old_frm; +loop_done: + result = EVAL(result); + lisp__data.env.head = lisp__data.env.length = head; + GC_LEAVE(); - return (res == NIL ? NIL : EVAL(res)); + return (result); } LispObj * -_LispDoListTimes(LispMac *mac, LispObj *list, char *fname, int times) +LispDoListTimes(LispBuiltin *builtin, int times) +/* + dolist init &rest body + dotimes init &rest body + */ { int did_jump, *pdid_jump = &did_jump; - LispObj *res, **pres = &res; + LispObj *result, **presult = &result; LispBlock *block; - *pres = NIL; + *presult = NIL; *pdid_jump = 1; - block = LispBeginBlock(mac, NIL, LispBlockTag); + block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { - *pres = _LispReallyDoListTimes(mac, list, fname, times); - *pdid_jump = 0; + result = LispReallyDoListTimes(builtin, times); + did_jump = 0; } - LispEndBlock(mac, block); - if (*pdid_jump) - *pres = mac->block.block_ret; - - return (*pres); -} - -LispObj * -_LispSet(LispMac *mac, LispObj *var, LispObj *val, char *fname, int eval) -{ - char *name; + LispEndBlock(block); + if (did_jump) + result = lisp__data.block.block_ret; - if (!SYMBOL_P(var)) - LispDestroy(mac, "%s is not a symbol, at %s", - LispStrObj(mac, var), fname); - - name = STRPTR(var); - if (isdigit(name[0]) || name[0] == '(' || name[0] == ')' - || name[0] == ';' || name[0] == '\'' || name[0] == '#') - LispDestroy(mac, "bad name %s, at %s", name, fname); - if (eval) - val = EVAL(val); - - return (LispSetVar(mac, var, val)); + return (result); } LispObj * -_LispWhenUnless(LispMac *mac, LispObj *list, int op) +LispLoadFile(LispObj *filename, int verbose, int print, int ifdoesnotexist) { - LispObj *obj, *res = NIL; + LispObj *stream, *cod, *obj, *result; + int ch; - obj = EVAL(CAR(list)); - if ((obj->type == LispNil_t) ^ op) { - for (obj = CDR(list); obj != NIL; obj = CDR(obj)) - res = EVAL(CAR(obj)); - } - return (res); -} + LispObj *savepackage; + LispPackage *savepack; -LispObj * -_LispWhileUntil(LispMac *mac, LispObj *list, int op) -{ - LispObj *obj, *res = NIL; + if (verbose) + LispMessage("; Loading %s", THESTR(filename)); - /*CONSTCOND*/ - while (1) { - obj = EVAL(CAR(list)); - if ((obj->type == LispNil_t) ^ op) { - for (obj = CDR(list); obj != NIL; obj = CDR(obj)) - res = EVAL(CAR(obj)); - } - else - break; + if (ifdoesnotexist) { + GC_ENTER(); + result = CONS(filename, CONS(Kif_does_not_exist, CONS(Kerror, NIL))); + GC_PROTECT(result); + stream = APPLY(Oopen, result); + GC_LEAVE(); } - return (res); -} + else + stream = APPLY1(Oopen, filename); -LispObj * -_LispLoadFile(LispMac *mac, char *filename, char *fname, - int verbose, int print, int ifdoesnotexist) -{ - LispObj *obj, *res = NIL; - FILE *fp; - int ch, level; - - if ((fp = fopen(filename, "r")) == NULL) { - if (ifdoesnotexist) - LispDestroy(mac, "cannot open %s, at %s", filename, fname); + if (stream == NIL) return (NIL); - } - if (verbose) - fprintf(lisp_stderr, "; Loading %s\n", filename); - - if (mac->stream.stream_level + 1 >= mac->stream.stream_size) { - LispStream *stream = (LispStream*) - realloc(mac->stream.stream, sizeof(LispStream) * - (mac->stream.stream_size + 1)); - - if (stream == NULL) { - fclose(fp); - LispDestroy(mac, "out of memory"); - } - - mac->stream.stream = stream; - ++mac->stream.stream_size; - } - mac->stream.stream[mac->stream.stream_level].fp = mac->fp; - mac->stream.stream[mac->stream.stream_level].st = mac->st; - mac->stream.stream[mac->stream.stream_level].cp = mac->cp; - mac->stream.stream[mac->stream.stream_level].tok = mac->tok; - ++mac->stream.stream_level; - memset(mac->stream.stream + mac->stream.stream_level, 0, sizeof(LispStream)); - mac->stream.stream[mac->stream.stream_level].fp = fp; - mac->fp = fp; - mac->st = mac->cp = NULL; - mac->tok = 0; - - level = mac->level; - mac->level = 0; - - ch = LispGet(mac); + result = NIL; + LispPushInput(stream); + ch = LispGet(); if (ch != '#') - LispUnget(mac); - else if (LispGet(mac) == '!') { + LispUnget(ch); + else if ((ch = LispGet()) == '!') { for (;;) { - ch = LispGet(mac); + ch = LispGet(); if (ch == '\n' || ch == EOF) break; } } else { - LispUnget(mac); - LispUnget(mac); + LispUnget(ch); + LispUnget('#'); } + /* Save package environment */ + savepackage = PACKAGE; + savepack = lisp__data.pack; + + cod = COD; + /*CONSTCOND*/ while (1) { - if ((obj = LispRun(mac)) != NULL) { - if (obj == EOLIST) - LispDestroy(mac, "object cannot start with #\\)"); - res = EVAL(obj); - if (print) - LispPrint(mac, res, NIL, 1); + if ((obj = LispRead()) != NULL) { + result = EVAL(obj); + COD = cod; + if (print) { + int i; + + if (RETURN_COUNT >= 0) + LispPrint(result, NIL, 1); + for (i = 0; i < RETURN_COUNT; i++) + LispPrint(RETURN(i), NIL, 1); + } } - if (mac->tok == EOF) + if (lisp__data.eof) break; } - mac->level = level; - free(mac->st); - --mac->stream.stream_level; - - mac->fp = mac->stream.stream[mac->stream.stream_level].fp; - mac->st = mac->stream.stream[mac->stream.stream_level].st; - mac->cp = mac->stream.stream[mac->stream.stream_level].cp; - mac->tok = mac->stream.stream[mac->stream.stream_level].tok; + LispPopInput(stream); - return (res); -} + /* Restore package environment */ + PACKAGE = savepackage; + lisp__data.pack = savepack; -void -_LispGetStringArgs(LispMac *mac, LispObj *list, char *fname, - char **string1, char **string2, - int *start1, int *end1, int *start2, int *end2) -{ - int len1, len2; - LispObj *lstring1, *lstring2, *lstart1, *lend1, *lstart2, *lend2; - - lstring1 = CAR(list); - list = CDR(list); - lstring2 = CAR(list); - if ((!STRING_P(lstring1) && !SYMBOL_P(lstring1)) || - (!STRING_P(lstring2) && !SYMBOL_P(lstring2))) - LispDestroy(mac, "expecting string, at %s", fname); - - *string1 = STRPTR(lstring1); - *string2 = STRPTR(lstring2); - - LispGetKeys(mac, fname, "START1:END1:START2:END2", CDR(list), - &lstart1, &lend1, &lstart2, &lend2); - - if ((lstart1 != NIL && !INDEX_P(lstart1)) || - (lend1 != NIL && !INDEX_P(lend1)) || - (lstart2 != NIL && !INDEX_P(lstart2)) || - (lend2 != NIL && !INDEX_P(lend2))) - LispDestroy(mac, "expecting positive integer, at %s", fname); - - len1 = strlen(*string1); - *start1 = lstart1 == NIL ? 0 : NUMBER_VALUE(lstart1); - *end1 = lend1 == NIL ? len1 : NUMBER_VALUE(lend1); - len2 = strlen(*string2); - *start2 = lstart2 == NIL ? 0 : NUMBER_VALUE(lstart2); - *end2 = lend2 == NIL ? len2 : NUMBER_VALUE(lend2); + APPLY1(Oclose, stream); - if (*start1 > *end1 || *end1 > len1 || *start2 > *end2 || *end2 > len2) - LispDestroy(mac, "bad string index, at %s", fname); + return (T); } void -_LispGetStringCaseArgs(LispMac *mac, LispObj *list, char *fname, - char **string, int *start, int *end) +LispGetStringArgs(LispBuiltin *builtin, + char **string1, char **string2, + long *start1, long *end1, long *start2, long *end2) { - int len; - LispObj *lstring, *lstart, *lend; + long length1, length2; + LispObj *ostring1, *ostring2, *ostart1, *oend1, *ostart2, *oend2; - lstring = CAR(list); - if (!STRING_P(lstring) && !SYMBOL_P(lstring)) - LispDestroy(mac, "expecting string, at %s", fname); + oend2 = ARGUMENT(5); + ostart2 = ARGUMENT(4); + oend1 = ARGUMENT(3); + ostart1 = ARGUMENT(2); + ostring2 = ARGUMENT(1); + ostring1 = ARGUMENT(0); + + CHECK_STRING(ostring1); + *string1 = THESTR(ostring1); + length1 = STRLEN(ostring1); + + CHECK_STRING(ostring2); + *string2 = THESTR(ostring2); + length2 = STRLEN(ostring2); - *string = STRPTR(lstring); - - LispGetKeys(mac, fname, "START:END", CDR(list), &lstart, &lend); + if (ostart1 == UNSPEC) + *start1 = 0; + else { + CHECK_INDEX(ostart1); + *start1 = FIXNUM_VALUE(ostart1); + } + if (oend1 == UNSPEC) + *end1 = length1; + else { + CHECK_INDEX(oend1); + *end1 = FIXNUM_VALUE(oend1); + } - if ((lstart != NIL && !INDEX_P(lstart)) || - (lend != NIL && !INDEX_P(lend))) - LispDestroy(mac, "expecting positive integer, at %s", fname); + if (ostart2 == UNSPEC) + *start2 = 0; + else { + CHECK_INDEX(ostart2); + *start2 = FIXNUM_VALUE(ostart2); + } - len = strlen(*string); - *start = lstart == NIL ? 0 : NUMBER_VALUE(lstart); - *end = lend == NIL ? len : NUMBER_VALUE(lend); + if (oend2 == UNSPEC) + *end2 = length2; + else { + CHECK_INDEX(oend2); + *end2 = FIXNUM_VALUE(oend2); + } - if (*start > *end || *end > len) - LispDestroy(mac, "bad string index, at %s", fname); + if (*start1 > *end1) + LispDestroy("%s: :START1 %ld larger than :END1 %ld", + STRFUN(builtin), *start1, *end1); + if (*start2 > *end2) + LispDestroy("%s: :START2 %ld larger than :END2 %ld", + STRFUN(builtin), *start2, *end2); + if (*end1 > length1) + LispDestroy("%s: :END1 %ld larger than string length %ld", + STRFUN(builtin), *end1, length1); + if (*end2 > length2) + LispDestroy("%s: :END2 %ld larger than string length %ld", + STRFUN(builtin), *end2, length2); } LispObj * -_LispStringDoTrim(LispMac *mac, LispObj *list, char *fname, int left, int right) +LispPathnameField(int field, int string) { - char *str; - int start, end, sstart, send, len; - LispObj *chars, *string; - - chars = CAR(list); - if (!STRING_P(chars) && chars->type != LispCons_t) - LispDestroy(mac, "%s is not a sequence, at %s", - LispStrObj(mac, chars), fname); - string = CAR(CDR(list)); - if (!STRING_P(string) && !SYMBOL_P(string)) - LispDestroy(mac, "expecting string, at %s", fname); - - sstart = start = 0; - send = end = strlen(STRPTR(string)); - - if (STRING_P(chars)) { - char *cmp; - - if (left) { - for (str = STRPTR(string); *str; str++) { - for (cmp = STRPTR(chars); *cmp; cmp++) - if (*str == *cmp) - break; - if (*cmp == '\0') - break; - ++start; + int offset = field; + LispObj *pathname, *result, *object; + + pathname = ARGUMENT(0); + + if (PATHNAMEP(pathname)) + pathname = APPLY1(Oparse_namestring, pathname); + + result = pathname->data.pathname; + while (offset) { + result = CDR(result); + --offset; + } + object = result; + result = CAR(result); + + if (string) { + if (!STRINGP(result)) { + if (result == NIL) + result = STRING(""); + else if (field == PATH_DIRECTORY) { + char *name = THESTR(CAR(pathname->data.pathname)), *ptr; + + ptr = strrchr(name, PATH_SEP); + if (ptr) { + int length = ptr - name + 1; + char data[PATH_MAX]; + + if (length > PATH_MAX - 1) + length = PATH_MAX - 1; + strncpy(data, name, length); + data[length] = '\0'; + result = STRING(data); + } + else + result = STRING(""); } + else + result = Kunspecific; } - if (right) { - for (str = STRPTR(string) + end - 1; end > 0; str--) { - for (cmp = STRPTR(chars); *cmp; cmp++) - if (*str == *cmp) - break; - if (*cmp == '\0') - break; - --end; + else if (field == PATH_NAME) { + object = CAR(CDR(object)); + if (STRINGP(object)) { + int length; + char name[PATH_MAX + 1]; + + strcpy(name, THESTR(result)); + length = STRLEN(result); + if (length + 1 < sizeof(name)) { + name[length++] = PATH_TYPESEP; + name[length] = '\0'; + } + if (STRLEN(object) + length < sizeof(name)) + strcpy(name + length, THESTR(object)); + /* else LispDestroy ... */ + result = STRING(name); } } } - else { - LispObj *obj; - if (left) { - for (str = STRPTR(string); *str; str++) { - for (obj = chars; obj != NIL; obj = CDR(obj)) - /* Should really ignore non character input ? */ - if (CAR(obj)->type == LispCharacter_t && - *str == CAR(obj)->data.integer) - break; - if (obj == NIL) - break; - ++start; - } - } - if (right) { - for (str = STRPTR(string) + end - 1; end > 0; str--) { - for (obj = chars; obj != NIL; obj = CDR(obj)) - /* Should really ignore non character input ? */ - if (CAR(obj)->type == LispCharacter_t && - *str == CAR(obj)->data.integer) - break; - if (obj == NIL) - break; - --end; - } + return (result); +} + +LispObj * +LispProbeFile(LispBuiltin *builtin, int probe) +{ + GC_ENTER(); + LispObj *result; + char *name = NULL, resolved[PATH_MAX + 1]; + struct stat st; + + LispObj *pathname; + + pathname = ARGUMENT(0); + + if (!POINTERP(pathname)) + goto bad_pathname; + + if (XSTRINGP(pathname)) + name = THESTR(pathname); + else if (XPATHNAMEP(pathname)) + name = THESTR(CAR(pathname->data.pathname)); + else if (STREAMP(pathname) && pathname->data.stream.type == LispStreamFile) + name = THESTR(CAR(pathname->data.stream.pathname->data.pathname)); + + if (realpath(name, &resolved[0]) == NULL || + stat(resolved, &st)) { + if (probe) + return (NIL); + LispDestroy("%s: realpath(\"%s\"): %s", + STRFUN(builtin), name, strerror(errno)); + } + + if (S_ISDIR(st.st_mode)) { + int length = strlen(resolved); + + if (!length || resolved[length - 1] != PATH_SEP) { + resolved[length++] = PATH_SEP; + resolved[length] = '\0'; } } - if (sstart == start && send == end) - return (string); + result = STRING(resolved); + GC_PROTECT(result); + result = APPLY1(Oparse_namestring, result); + GC_LEAVE(); + + return (result); + +bad_pathname: + LispDestroy("%s: bad pathname %s", STRFUN(builtin), STROBJ(pathname)); + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +LispWriteString_(LispBuiltin *builtin, int newline) +/* + write-line string &optional output-stream &key start end + write-string string &optional output-stream &key start end + */ +{ + char *text; + long start, end, length; - len = end - start; - str = LispMalloc(mac, len + 1); - strncpy(str, STRPTR(string) + start, len); - str[len] = '\0'; + LispObj *string, *output_stream, *ostart, *oend; - string = STRING(str); - LispFree(mac, str); + oend = ARGUMENT(3); + ostart = ARGUMENT(2); + output_stream = ARGUMENT(1); + string = ARGUMENT(0); + + CHECK_STRING(string); + LispCheckSequenceStartEnd(builtin, string, ostart, oend, + &start, &end, &length); + if (output_stream == UNSPEC) + output_stream = NIL; + text = THESTR(string); + if (end > start) + LispWriteStr(output_stream, text + start, end - start); + if (newline) + LispWriteChar(output_stream, '\n'); return (string); } Index: xc/programs/xedit/lisp/helper.h diff -u xc/programs/xedit/lisp/helper.h:1.3 xc/programs/xedit/lisp/helper.h:1.15 --- xc/programs/xedit/lisp/helper.h:1.3 Mon Oct 15 03:05:52 2001 +++ xc/programs/xedit/lisp/helper.h Sun Nov 24 21:35:30 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/helper.h,v 1.3 2001/10/15 07:05:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/helper.h,v 1.15 2002/11/25 02:35:30 paulo Exp $ */ #ifndef Lisp_helper_h #define Lisp_helper_h @@ -35,156 +35,81 @@ #include "private.h" /* - * Defines - */ -#define LESS 0 -#define LESS_EQUAL 1 -#define EQUAL 2 -#define GREATER 3 -#define GREATER_EQUAL 4 -#define NOT_EQUAL 5 - -/* * Prototypes - */ -/* - (do ({(var [init [step]])}*) - (end-test {result}*) - {declaration}* {tag | statement}*) - (do* ({(var [init [step]])}*) - (end-test {result}*) - {declaration}* {tag | statement}*) - */ -LispObj *_LispDo(LispMac*, LispObj*, char*, int); - -/* - (dolist (var listform [resultform]) - {declaration}* {tag | statement}*) - (dotimes (var countform [resultform]) - {declaration}* {tag | statement}*) - */ -LispObj *_LispDoListTimes(LispMac*, LispObj*, char*, int); - -/* - (equal x y) - * called directly by several functions */ -LispObj *_LispEqual(LispMac*, LispObj*, LispObj*); - -/* - (nth n list) - (nthcdr n list) - */ -LispObj *_LispNth(LispMac*, LispObj*, char*, int); - -/* When no <setf-place> is set, this function searchs for the one */ -LispObj *_LispFindPlace(LispMac*, LispObj*, LispObj*); - -/* - (min number &rest more-numbers) - (max number &rest more-numbers) - */ -LispObj *_LispMinMax(LispMac*, LispObj*, char*, int); - -/* - (< number &rest more-numbers) - (<= number &rest more-numbers) - (= number &rest more-numbers) - (> number &rest more-numbers) - (>= number &rest more-numbers) - */ -LispObj *_LispBoolCond(LispMac*, LispObj*, char*, int); - -/* - (char< character &rest more-characters) - (char<= character &rest more-characters) - (char= character &rest more-characters) - (char> character &rest more-characters) - (char>= character &rest more-characters) - (char/= character &rest more-characters) - (char-equal character &rest more-characters) - (char-not-equal character &rest more-characters) - (char-lessp character &rest more-characters) - (char-greaterp character &rest more-characters) - (char-not-lessp character &rest more-characters) - (char-not-greaterp character &rest more-characters) - */ -LispObj *_LispCharBoolCond(LispMac*, LispObj*, char*, int, int); - -/* - (defmacro name lambda-list [[ {declaration}* | doc-string ]] {form}*) - (defun name lambda-list [[ {declaration}* | doc-string ]] {form}*) - (lambda lambda-list {declaration | doc-string}* {form}*) - * doc-string not yet implemented - */ -LispObj *_LispDefLambda(LispMac*, LispObj*, LispFunType); - -/* - (set symbol value) - (setq {var form}*) - * used also by setf when creating a new symbol - * XXX current setq implementation expects only 2 arguments - */ -LispObj *_LispSet(LispMac*, LispObj*, LispObj*, char*, int); - -/* - (when test {form}*) - (unless test {form}*) - */ -LispObj *_LispWhenUnless(LispMac*, LispObj*, int); - -/* - (while test {form}*) - (until test {form}*) - * XXX emacs identical code, should be rewritten to be just a test - * condition of (loop) - */ -LispObj *_LispWhileUntil(LispMac*, LispObj*, int); - -/* - * Load and execute a file. Used by (load) and (require) */ -LispObj *_LispLoadFile(LispMac*, char*, char*, int, int, int); - -/* - (string= string1 string2 &key :start1 :end1 :start2 :end2) - (string< string1 string2 &key :start1 :end1 :start2 :end2) - (string> string1 string2 &key :start1 :end1 :start2 :end2) - (string<= string1 string2 &key :start1 :end1 :start2 :end2) - (string>= string1 string2 &key :start1 :end1 :start2 :end2) - (string/= string1 string2 &key :start1 :end1 :start2 :end2) - (string-equal string1 string2 &key :start1 :end1 :start2 :end2) - (string-lessp string1 string2 &key :start1 :end1 :start2 :end2) - (string-greaterp string1 string2 &key :start1 :end1 :start2 :end2) - (string-not-lessp string1 string2 &key :start1 :end1 :start2 :end2) - (string-not-greaterp string1 string2 &key :start1 :end1 :start2 :end2) - (string-not-equal string1 string2 &key :start1 :end1 :start2 :end2) +void LispCheckSequenceStartEnd(LispBuiltin*, LispObj*, + LispObj*, LispObj*, long*, long*, long*); +long LispLength(LispObj*); +LispObj *LispCharacterCoerce(LispBuiltin*, LispObj*); +LispObj *LispStringCoerce(LispBuiltin*, LispObj*); +LispObj *LispCoerce(LispBuiltin*, LispObj*, LispObj*); + +/* + do init test &rest body + do* init test &rest body + */ +LispObj *LispDo(LispBuiltin*, int); + +/* + dolist init &rest body + dotimes init &rest body + */ +LispObj *LispDoListTimes(LispBuiltin*, int); + +#define FEQ 1 +#define FEQL 2 +#define FEQUAL 3 +#define FEQUALP 4 +LispObj *LispObjectCompare(LispObj*, LispObj*, int); +#define XEQ(x, y) LispObjectCompare(x, y, FEQ) +#define XEQL(x, y) LispObjectCompare(x, y, FEQL) +#define XEQUAL(x, y) LispObjectCompare(x, y, FEQUAL) +#define XEQUALP(x, y) LispObjectCompare(x, y, FEQUALP) + +LispObj *LispLoadFile(LispObj*, int, int, int); + +/* + string= string1 string2 &key start1 end1 start2 end2 + string< string1 string2 &key start1 end1 start2 end2 + string> string1 string2 &key start1 end1 start2 end2 + string<= string1 string2 &key start1 end1 start2 end2 + string>= string1 string2 &key start1 end1 start2 end2 + string/= string1 string2 &key start1 end1 start2 end2 + string-equal string1 string2 &key start1 end1 start2 end2 + string-lessp string1 string2 &key start1 end1 start2 end2 + string-greaterp string1 string2 &key start1 end1 start2 end2 + string-not-lessp string1 string2 &key start1 end1 start2 end2 + string-not-greaterp string1 string2 &key start1 end1 start2 end2 + string-not-equal string1 string2 &key start1 end1 start2 end2 */ -void _LispGetStringArgs(LispMac*, LispObj*, char*, +void LispGetStringArgs(LispBuiltin*, char**, /* string1 */ char**, /* string2 */ - int*, /* start1 */ - int*, /* end1 */ - int*, /* start2 */ - int*); /* end2 */ + long*, /* start1 */ + long*, /* end1 */ + long*, /* start2 */ + long*); /* end2 */ /* - (string-trim character-bag string) - (string-left-trim character-bag string) - (string-right-trim character-bag string) -*/ -LispObj *_LispStringDoTrim(LispMac*, LispObj*, char*, int, int); + pathname-host pathname + pathname-device pathname + pathname-directory pathname + pathname-name pathname + pathname-type pathname + pathname-version pathname + */ +LispObj *LispPathnameField(int, int); /* - (string-upcase string &key :start :end) - (string-downcase string &key :start :end) - (string-capitalize string &key :start :end) -*/ -void _LispGetStringCaseArgs(LispMac*, LispObj*, char*, char**, int*, int*); + truename pathname + probe-file pathname + */ +LispObj *LispProbeFile(LispBuiltin*, int); /* - * Initialization + write-string string &optional output-stream &key start end + write-line string &optional output-stream &key start end */ -extern char *ExpectingListAt; -extern char *ExpectingNumberAt; +LispObj *LispWriteString_(LispBuiltin*, int); #endif /* Lisp_helper_h */ Index: xc/programs/xedit/lisp/internal.h diff -u xc/programs/xedit/lisp/internal.h:1.11 xc/programs/xedit/lisp/internal.h:1.49 --- xc/programs/xedit/lisp/internal.h:1.11 Fri Oct 19 20:19:34 2001 +++ xc/programs/xedit/lisp/internal.h Tue Dec 10 23:44:27 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.11 2001/10/20 00:19:34 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.49 2002/12/11 04:44:27 paulo Exp $ */ #ifndef Lisp_internal_h #define Lisp_internal_h @@ -35,54 +35,442 @@ #include <stdio.h> #include "lisp.h" +#include "mp.h" +#include "re.h" + /* * Defines */ +typedef struct _LispMac LispMac; + +#define STREAM_READ 0x01 +#define STREAM_WRITE 0x02 +#define STREAM_BINARY 0x20 + +#define RPLACA(cons, object) (CAR(cons) = object) +#define RPLACD(cons, object) (CDR(cons) = object) + #define CAR(list) ((list)->data.cons.car) #define CAAR(list) ((list)->data.cons.car->data.cons.car) #define CADR(list) ((list)->data.cons.cdr->data.cons.car) #define CDR(list) ((list)->data.cons.cdr) #define CDAR(list) ((list)->data.cons.car->data.cons.cdr) -#define CONS(car, cdr) LispNewCons(mac, car, cdr) -#define EVAL(list) LispEval(mac, list) -#define ATOM(atom) LispNewAtom(mac, atom) -#define ATOM2(atom) LispNewAtom(mac, LispGetString(mac, atom)) -#define QUOTE(quote) LispNewQuote(mac, quote) -#define BACKQUOTE(bquote) LispNewBackquote(mac, bquote) -#define COMMA(comma, at) LispNewComma(mac, comma, at) -#define REAL(num) LispNewReal(mac, num) -#define STRING(str) LispNewString(mac, str) -#define CHAR(c) LispNewCharacter(mac, c) -#define INTEGER(i) LispNewInteger(mac, i) -#define OPAQUE(data, type) LispNewOpaque(mac, (void*)((long)data), type) +#define CDDR(list) ((list)->data.cons.cdr->data.cons.cdr) +#define CONS(car, cdr) LispNewCons(car, cdr) +#define EVAL(list) LispEval(list) +#define APPLY(fun, args) LispFuncall(fun, args, 0) +#define APPLY1(fun, arg) LispApply1(fun, arg) +#define APPLY2(fun, arg1, arg2) LispApply2(fun, arg1, arg2) +#define APPLY3(f, a1, a2, a3) LispApply3(f, a1, a2, a3) +#define EXECUTE(string) LispExecute(string) +#define SYMBOL(atom) LispNewSymbol(atom) +#define ATOM(string) LispNewAtom(string, 1) +#define UNINTERNED_ATOM(string) LispNewAtom(string, 0) +#define FUNCTION(symbol) LispNewFunction(symbol) +#define FUNCTION_QUOTE(symbol) LispNewFunctionQuote(symbol) + + /* atom string is a static variable */ +#define ATOM2(string) LispNewSymbol(LispGetPermAtom(string)) + + /* make a gc never released variable with a static string argument */ +#define STATIC_ATOM(string) LispNewStaticAtom(string) + +#define STRING(str) LispNewString(str, strlen(str), 0) +#define LSTRING(str, size) LispNewString(str, size, 0) + + /* string must be from the LispXXX allocation functions, + * and LispMused not yet called on it */ +#define STRING2(str) LispNewString(str, strlen(str), 1) +#define LSTRING2(str, size) LispNewString(str, size, 1) + +#define VECTOR(objects) LispNewVector(objects) + + /* STRINGSTREAM2 and LSTRINGSTREAM2 require that the + * string be allocated from the LispXXX allocation functions, + * and LispMused not yet called on it */ +#define STRINGSTREAM(str, flag) \ + LispNewStringStream(str, flag, strlen(str), 0) +#define STRINGSTREAM2(str, flag) \ + LispNewStringStream(str, flag, strlen(str), 1) +#define LSTRINGSTREAM(str, flag, length) \ + LispNewStringStream(str, flag, length, 0) +#define LSTRINGSTREAM2(str, flag, length) \ + LispNewStringStream(str, flag, length, 1) + +#define FILESTREAM(file, path, flag) \ + LispNewFileStream(file, path, flag) +#define PIPESTREAM(file, path, flag) \ + LispNewPipeStream(file, path, flag) + #define CHECKO(obj, typ) \ - (obj)->type == LispOpaque_t && \ - ((obj)->data.opaque.type == typ || (obj)->data.opaque.type == 0) -#define PROTECT(key, list) LispProtect(mac, key, list) -#define UPROTECT(key, list) LispUProtect(mac, key, list) + ((obj)->type == LispOpaque_t && \ + ((obj)->data.opaque.type == typ || (obj)->data.opaque.type == 0)) +#define PROTECT(key, list) LispProtect(key, list) +#define UPROTECT(key, list) LispUProtect(key, list) + +/* create a new unique static atom string */ +#define GETATOMID(string) LispGetAtomString(string, 1) + +#define GCDisable() ++gcpro +#define GCEnable() --gcpro + + +/* pointer to something unique to all atoms with the same print representation */ +#define ATOMID(object) (object)->data.atom->string + + + +#define NIL_BIT 0x01 +#define FIXNUM_BIT 0x02 +#define FIXNUM_MASK 0x03 +#define SCHAR_BIT 0x04 +#define SCHAR_MASK 0x05 +#define BIT_COUNT 4 +#define BIT_MASK 0x0f +#define POINTERP(object) \ + (((unsigned long)(object) & NIL_BIT) == 0) + +#define MOST_POSITIVE_FIXNUM ((1L << (sizeof(long) * 8 - 5)) - 1) +#define MOST_NEGATIVE_FIXNUM (-1L << (sizeof(long) * 8 - 5)) + +#define SCHAR(value) \ + ((LispObj*)(((long)(value) << BIT_COUNT) | SCHAR_MASK)) +#define SCHAR_VALUE(object) FIXNUM_VALUE(object) +#define SCHARP(object) \ + (((unsigned long)(object) & BIT_MASK) == SCHAR_MASK) +#define CHECK_SCHAR(object) \ + if (!SCHARP(object)) \ + LispDestroy("%s: %s is not a character", \ + STRFUN(builtin), STROBJ(object)) + +#define XOBJECT_TYPE(object) ((object)->type) +#define OBJECT_TYPE(object) \ + (POINTERP(object) ? XOBJECT_TYPE(object) : (long)(object) & BIT_MASK) + + +#define NIL (LispObj*)0x00000001 +#define T (LispObj*)0x00000011 +#define DOT (LispObj*)0x00000021 +/* unmatched ')' */ +#define EOLIST (LispObj*)0x00000031 +#define READLABEL_MASK 0x00000041 +/* unspecified argument */ +#define UNSPEC (LispObj*)0x00000051 +#define INVALIDP(object) \ + ((object) == NULL || (object) == EOLIST || (object) == DOT) + + +/* cons */ +#define XCONSP(object) ((object)->type == LispCons_t) +#define CONSP(object) (POINTERP(object) && XCONSP(object)) +#define CHECK_CONS(object) \ + if (!CONSP(object)) \ + LispDestroy("%s: %s is not of type cons", \ + STRFUN(builtin), STROBJ(object)) +#define LISTP(object) (object == NIL || CONSP(object)) +#define CHECK_LIST(object) \ + if (!LISTP(object)) \ + LispDestroy("%s: %s is not a list", \ + STRFUN(builtin), STROBJ(object)) + +/* fixnum */ +#define FIXNUM(value) \ + ((LispObj*)(((long)(value) << BIT_COUNT) | FIXNUM_MASK)) +#define FIXNUM_VALUE(object) ((long)(object) >> BIT_COUNT) +#define FIXNUMP(object) \ + (((unsigned long)(object) & BIT_MASK) == FIXNUM_MASK) +#define CHECK_FIXNUM(object) \ + if (!FIXNUMP(object)) \ + LispDestroy("%s: %s is not a fixnum", \ + STRFUN(builtin), STROBJ(object)) +#define INDEXP(object) \ + (FIXNUMP(object) && FIXNUM_VALUE(object) >= 0) +#define CHECK_INDEX(object) \ + if (!INDEXP(object)) \ + LispDestroy("%s: %s is not a positive fixnum", \ + STRFUN(builtin), STROBJ(object)) + + +/* long int integer */ +#define XINTP(object) ((object)->type == LispInteger_t) +#define INTP(objet) (POINTERP(object) && XINTP(object)) +#define INT_VALUE(object) (object)->data.integer + + +/* values that fit in a machine long int but not in a fixnum */ +#define LONGINTP(object) \ + (POINTERP(object) ? XINTP(object) : FIXNUMP(object)) +#define LONGINT_VALUE(object) \ + (POINTERP(object) ? INT_VALUE(object) : FIXNUM_VALUE(object)) +#define CHECK_LONGINT(object) \ + if (!LONGINTP(object)) \ + LispDestroy("%s: %s is not an integer", \ + STRFUN(builtin), STROBJ(object)) + + +/* bignum */ +#define XBIGNUMP(object) ((object)->type == LispBignum_t) +#define BIGNUMP(object) (POINTERP(object) && XBIGNUMP(object)) +#define BIGNUM(object) LispNewBignum(object) + + +/* generic integer */ +#define INTEGER(integer) LispNewInteger(integer) +#define INTEGERP(object) \ + (POINTERP(object) ? XINTP(object) || XBIGNUMP(object) : FIXNUMP(object)) +#define CHECK_INTEGER(object) \ + if (!INTEGERP(object)) \ + LispDestroy("%s: %s is not an integer", \ + STRFUN(builtin), STROBJ(object)) + + +/* ratio */ +#define XRATIOP(object) ((object)->type == LispRatio_t) +#define RATIOP(object) (POINTERP(object) && XRATIOP(object)) +#define RATIO(num, den) LispNewRatio(num, den) + + +/* bigratio */ +#define XBIGRATIOP(object) ((object)->type == LispBigratio_t) +#define BIGRATIOP(object) (POINTERP(object) && XBIGRATIOP(object)) +#define BIGRATIO(ratio) LispNewBigratio(ratio) + + +/* generic rational */ +#define RATIONALP(object) \ + (POINTERP(object) ? XINTP(object) || XRATIOP(object) || \ + XBIGNUMP(object) || XBIGRATIOP(object) : \ + FIXNUMP(object)) + + +/* double float */ +#define XDFLOATP(object) ((object)->type == LispDFloat_t) +#define DFLOATP(object) (POINTERP(object) && XDFLOATP(object)) +#define DFLOAT_VALUE(object) (object)->data.dfloat +#define CHECK_DFLOAT(object) \ + if (!DFLOATP(object)) \ + LispDestroy("%s: %s is not a float number", \ + STRFUN(builtin), STROBJ(object)) +#define DFLOAT(value) LispNewDFloat(value) + + +/* generic float - currently only double float supported */ +#define FLOATP(object) DFLOATP(object) + + +/* real number */ +#define REALP(object) \ + (POINTERP(object) ? XINTP(object) || XDFLOATP(object) || \ + XRATIOP(object) || XBIGNUMP(object) || \ + XBIGRATIOP(object) : \ + FIXNUMP(object)) +#define CHECK_REAL(object) \ + if (!REALP(object)) \ + LispDestroy("%s: %s is not a real number", \ + STRFUN(builtin), STROBJ(object)) + + +/* complex */ +#define XCOMPLEXP(object) ((object)->type == LispComplex_t) +#define COMPLEXP(object) (POINTERP(object) && XCOMPLEXP(object)) +#define COMPLEX(real, imag) LispNewComplex(real, imag) + + +/* generic number */ +#define NUMBERP(object) \ + (POINTERP(object) ? XINTP(object) || XDFLOATP(object) || \ + XRATIOP(object) || XBIGNUMP(object) || \ + XBIGRATIOP(object) || XCOMPLEXP(object) : \ + FIXNUMP(object)) +#define CHECK_NUMBER(object) \ + if (!NUMBERP(object)) \ + LispDestroy("%s: %s is not a number", \ + STRFUN(builtin), STROBJ(object)) + + +/* symbol */ +#define XSYMBOLP(object) ((object)->type == LispAtom_t) +#define SYMBOLP(object) (POINTERP(object) && XSYMBOLP(object)) +#define CHECK_SYMBOL(object) \ + if (!SYMBOLP(object)) \ + LispDestroy("%s: %s is not a symbol", \ + STRFUN(builtin), STROBJ(object)) + + +/* keyword */ +#define XKEYWORDP(object) \ + ((object)->data.atom->package == lisp__data.keyword) +#define KEYWORDP(object) \ + (POINTERP(object) && XSYMBOLP(object) && XKEYWORDP(object)) +#define KEYWORD(string) LispNewKeyword(string) +#define CHECK_KEYWORD(object) \ + if (!KEYWORDP(object)) \ + LispDestroy("%s: %s is not a keyword", \ + STRFUN(builtin), STROBJ(object)) +#define CHECK_CONSTANT(object) \ + if ((object)->data.atom->constant) \ + LispDestroy("%s: %s is a constant", \ + STRFUN(builtin), STROBJ(object)) + +#define SETVALUE(atom, object) ((atom)->property->value = object) + + +/* function */ +#define XFUNCTIONP(object) ((object)->type == LispFunction_t) +#define FUNCTIONP(object) (POINTERP(object) && XFUNCTIONP(object)) + + +/* lambda */ +#define XLAMBDAP(object) ((object)->type == LispLambda_t) +#define LAMBDAP(object) (POINTERP(object) && XLAMBDAP(object)) + + +/* string - currently only simple 8 bit characters */ +#define XSTRINGP(object) ((object)->type == LispString_t) +#define STRINGP(object) (POINTERP(object) && XSTRINGP(object)) +#define THESTR(object) (object)->data.string.string +#define STRLEN(object) (object)->data.string.length +#define CHECK_STRING(object) \ + if (!STRINGP(object)) \ + LispDestroy("%s: %s is not a string", \ + STRFUN(builtin), STROBJ(object)) +#define CHECK_STRING_WRITABLE(object) \ + if (!object->data.string.writable) \ + LispDestroy("%s: %s is readonly", \ + STRFUN(builtin), STROBJ(object)) + + +/* array/vector */ +#define XARRAYP(object) ((object)->type == LispArray_t) +#define ARRAYP(object) (POINTERP(object) && XARRAYP(object)) +#define CHECK_ARRAY(object) \ + if (!ARRAYP(object)) \ + LispDestroy("%s: %s is not an array", \ + STRFUN(builtin), STROBJ(object)) + + +/* quote */ +#define XQUOTEP(object) ((object)->type == LispQuote_t) +#define QUOTEP(object) (POINTERP(object) && XQUOTEP(object)) +#define QUOTE(object) LispNewQuote(object) + +#define XBACKQUOTEP(object) ((object)->type == LispBackquote_t) +#define BACKQUOTEP(object) (POINTERP(object) && XBACKQUOTEP(object)) +#define BACKQUOTE(object) LispNewBackquote(object) + +#define XCOMMAP(object) ((object)->type == LispComma_t) +#define COMMAP(object) (POINTERP(object) && XCOMMAP(object)) +#define COMMA(object, at) LispNewComma(object, at) + + +/* package */ +#define XPACKAGEP(object) ((object)->type == LispPackage_t) +#define PACKAGEP(object) (POINTERP(object) && XPACKAGEP(object)) + + +/* pathname */ +#define XPATHNAMEP(object) ((object)->type == LispPathname_t) +#define PATHNAMEP(object) (POINTERP(object) && XPATHNAMEP(object)) +#define PATHNAME(object) LispNewPathname(object) +#define CHECK_PATHNAME(object) \ + if (!PATHNAMEP(object)) \ + LispDestroy("%s: %s is not a pathname", \ + STRFUN(builtin), STROBJ(object)) + + +/* stream */ +#define XSTREAMP(object) ((object)->type == LispStream_t) +#define STREAMP(object) (POINTERP(object) && XSTREAMP(object)) +#define CHECK_STREAM(object) \ + if (!STREAMP(object)) \ + LispDestroy("%s: %s is not a stream", \ + STRFUN(builtin), STROBJ(object)) + + +/* hastable */ +#define XHASHTABLEP(object) ((object)->type == LispHashTable_t) +#define HASHTABLEP(object) (POINTERP(object) && XHASHTABLEP(object)) +#define CHECK_HASHTABLE(object) \ + if (!HASHTABLEP(object)) \ + LispDestroy("%s: %s is not a hash-table", \ + STRFUN(builtin), STROBJ(object)) + + +/* regex */ +#define XREGEXP(object) ((object)->type == LispRegex_t) +#define REGEXP(object) (POINTERP(object) && XREGEXP(object)) +#define CHECK_REGEX(object) \ + if (!REGEXP(object)) \ + LispDestroy("%s: %s is not a regexp", \ + STRFUN(builtin), STROBJ(object)) + + +/* bytecode */ +#define XBYTECODEP(object) ((object)->type == LispBytecode_t) +#define BYTECODEP(object) (POINTERP(object) && XBYTECODEP(object)) + + +/* opaque */ +#define XOPAQUEP(object) ((object)->type == LispOpaque_t) +#define OPAQUEP(object) (POINTERP(object) && XOPAQUEP(object)) +#define OPAQUE(data, type) LispNewOpaque((void*)((long)data), type) + + + +#define SSTREAMP(str) ((str)->data.stream.source.string) + +#define FSTREAMP(str) ((str)->data.stream.source.file) + +#define PSTREAMP(str) ((str)->data.stream.source.program) +#define PIDPSTREAMP(str) ((str)->data.stream.source.program->pid) +#define IPSTREAMP(str) ((str)->data.stream.source.program->input) +#define OPSTREAMP(str) ((str)->data.stream.source.program->output) +#define EPSTREAMP(str) \ + FSTREAMP((str)->data.stream.source.program->errorp) + +#define LispFileno(file) ((file)->descriptor) + +#define STRFUN(builtin) ATOMID(builtin->symbol) +#define STROBJ(obj) LispStrObj(obj) + +/* fetch builtin function/macro argument value + */ +#define ARGUMENT(index) \ + lisp__data.stack.values[lisp__data.stack.base + (index)] + +#define RETURN(index) lisp__data.returns.values[(index)] +#define RETURN_COUNT lisp__data.returns.count +#define RETURN_CHECK(value) \ + value < MULTIPLE_VALUES_LIMIT ? \ + value : MULTIPLE_VALUES_LIMIT + +#define GC_ENTER() int gc__protect = lisp__data.protect.length + +#define GC_PROTECT(object) \ + if (lisp__data.protect.length >= lisp__data.protect.space) \ + LispMoreProtects(); \ + lisp__data.protect.objects[lisp__data.protect.length++] = object -#define GCProtect() ++gcpro -#define GCUProtect() --gcpro +#define GC_LEAVE() lisp__data.protect.length = gc__protect -#define STRPTR(obj) (obj)->data.atom->string -#define NUMBER_P(obj) \ - ((obj)->type == LispReal_t || (obj)->type == LispInteger_t) +#define ERROR_CHECK_SPECIAL_FORM(atom) \ + if (atom->property->fun.builtin->compile) \ + LispDestroy("%s: the special form %s cannot be redefined", \ + STRFUN(builtin), atom->string) -/* assumes NUMBER_P is true */ -#define NUMBER_VALUE(obj) \ - (obj->type == LispReal_t ? obj->data.real : obj->data.integer) -#define INTEGER_P(obj) \ - ((obj)->type == LispInteger_t || \ - ((obj)->type == LispReal_t && (long)(obj)->data.real == (obj)->data.real)) -/* positive integer */ -#define INDEX_P(obj) (INTEGER_P(obj) && NUMBER_VALUE(obj) >= 0) +#define CONSTANTP(object) \ + (!POINTERP(object) || \ + XOBJECT_TYPE(object) < LispAtom_t || \ + (XSYMBOLP(object) && XKEYWORDP(object))) -#define SYMBOL_P(obj) ((obj)->type == LispAtom_t) -#define STRING_P(obj) ((obj)->type == LispString_t) +/* slightly faster test, since keywords are very uncommon as eval arguments */ +#define NCONSTANTP(object) \ + (OBJECT_TYPE(object) >= LispAtom_t) + /* * Types */ @@ -90,24 +478,53 @@ typedef struct _LispAtom LispAtom; typedef struct _LispBuiltin LispBuiltin; typedef struct _LispModuleData LispModuleData; +typedef struct _LispFile LispFile; +typedef struct _LispString LispString; +typedef struct _LispPackage LispPackage; +typedef struct _LispBytecode LispBytecode; +typedef struct _LispHashTable LispHashTable; + +/* Bytecode compiler data */ +typedef struct _LispCom LispCom; + +typedef char *Atom_id; typedef enum _LispType { - LispNil_t, - LispTrue_t, + /* objects encoded in the LispObj pointer */ + LispNil_t = 1, + LispFixnum_t = 3, + LispSChar_t = 5, + + /* objects that have a structure */ + LispInteger_t = 16, + LispDFloat_t, + LispString_t, + LispRatio_t, + LispOpaque_t, + + /* simple access for marking */ + LispBignum_t, + LispBigratio_t, + LispAtom_t, - LispInteger_t, - LispReal_t, + LispFunction_t, + LispFunctionQuote_t, + + LispLambda_t, + + LispComplex_t, LispCons_t, LispQuote_t, - LispCharacter_t, - LispString_t, - LispLambda_t, LispArray_t, LispStruct_t, LispStream_t, - LispOpaque_t, LispBackquote_t, - LispComma_t + LispComma_t, + LispPathname_t, + LispPackage_t, + LispRegex_t, + LispBytecode_t, + LispHashTable_t } LispType; typedef enum _LispFunType { @@ -117,35 +534,64 @@ LispSetf } LispFunType; +typedef enum _LispStreamType { + LispStreamString, + LispStreamFile, + LispStreamStandard, + LispStreamPipe +} LispStreamType; + +typedef struct { + int pid; /* process id of program */ + LispFile *input; /* if READABLE: stdout of program */ + LispFile *output; /* if WRITABLE: stdin of program */ + LispObj *errorp; /* ALWAYS (ONLY) READABLE: stderr of program */ +} LispPipe; + struct _LispObj { LispType type : 6; unsigned int mark : 1; /* gc protected */ - unsigned int dirty : 1; unsigned int prot: 1; /* protection for constant/unamed variables */ + LispFunType funtype : 4; /* this is subject to change in the future */ union { LispAtom *atom; + struct { + char *string; + long length; + int writable : 1; + } string; long integer; - double real; + double dfloat; LispObj *quote; + LispObj *pathname; /* don't use quote generic name, + * to avoid confusing code */ struct { + long numerator; + long denominator; + } ratio; + union { + mpi *integer; + mpr *ratio; + } mp; + struct { + LispObj *real; + LispObj *imag; + } complex; + struct { LispObj *car; LispObj *cdr; } cons; struct { LispObj *name; LispObj *code; - unsigned int num_args : 12; - LispFunType type : 4; - unsigned int key : 1; - unsigned int optional : 1; - unsigned int rest : 1; + LispObj *data; /* extra data to protect */ } lambda; struct { LispObj *list; /* stored as a linear list */ LispObj *dim; /* dimensions of array */ unsigned int rank : 8; /* i.e. array-rank-limit => 256 */ unsigned int type : 7; /* converted to LispType, if not - * Lisp{Nil,True}_t only accepts given + * Lisp_Nil_t only accepts given * type in array fields */ unsigned int zero : 1; /* at least one of the dimensions * is zero */ @@ -156,11 +602,14 @@ } struc; struct { union { - FILE *fp; - unsigned char *str; + LispFile *file; + LispPipe *program; + LispString *string; } source; - int size; /* if smaller than zero, use source.fp */ - int idx; /* index in string */ + LispObj *pathname; + LispStreamType type : 6; + int readable : 1; + int writable : 1; } stream; struct { void *data; @@ -170,20 +619,52 @@ LispObj *eval; int atlist; } comma; + struct { + LispObj *name; + LispObj *nicknames; + LispPackage *package; + } package; + struct { + re_cod *regex; + LispObj *pattern; /* regex string */ + int options; /* regex compile flags */ + } regex; + struct { + LispBytecode *bytecode; + LispObj *code; /* object used to generate bytecode */ + LispObj *name; /* name of function, or NIL */ + } bytecode; + struct { + LispHashTable *table; + LispObj *test; + } hash; } data; }; +typedef LispObj *(*LispFunPtr)(LispBuiltin*); +typedef void (*LispComPtr)(LispCom*, LispBuiltin*); + struct _LispBuiltin { - char *name; - LispObj *(*fn)(LispMac*, LispObj*, char*); - int eval : 1; - int min_args : 15; - int max_args : 15; + /* these fields must be set */ + LispFunType type; + LispFunPtr function; + char *declaration; + + /* this field is optional, set if the function returns multiple values */ + int multiple_values; + + /* this field is also optional, set if the function should not be exported */ + int internal; + + /* this optional field points to a function of the bytecode compiler */ + LispComPtr compile; + + /* this field is set at runtime */ + LispObj *symbol; }; -typedef LispObj *(*LispFunPtr)(LispMac*, LispObj*, char*); -typedef int (*LispLoadModule)(LispMac*); -typedef int (*LispUnloadModule)(LispMac*); +typedef int (*LispLoadModule)(void); +typedef int (*LispUnloadModule)(void); #define LISP_MODULE_VERSION 1 struct _LispModuleData { @@ -195,73 +676,109 @@ /* * Prototypes */ -LispObj *LispEval(LispMac*, LispObj*); - -LispObj *LispNew(LispMac*, LispObj*, LispObj*); -LispObj *LispNewAtom(LispMac*, char*); -LispObj *LispNewReal(LispMac*, double); -LispObj *LispNewString(LispMac*, char*); -LispObj *LispNewCharacter(LispMac*, long); -LispObj *LispNewInteger(LispMac*, long); -LispObj *LispNewQuote(LispMac*, LispObj*); -LispObj *LispNewBackquote(LispMac*, LispObj*); -LispObj *LispNewComma(LispMac*, LispObj*, int); -LispObj *LispNewCons(LispMac*, LispObj*, LispObj*); -LispObj *LispNewSymbol(LispMac*, char*, LispObj*); -LispObj *LispNewLambda(LispMac*, LispObj*, LispObj*, LispObj*, - int, LispFunType, int, int, int); -LispObj *LispNewStruct(LispMac*, LispObj*, LispObj*); -LispObj *LispNewOpaque(LispMac*, void*, int); +LispObj *LispEval(LispObj*); +LispObj *LispFuncall(LispObj*, LispObj*, int); +LispObj *LispApply1(LispObj*, LispObj*); +LispObj *LispApply2(LispObj*, LispObj*, LispObj*); +LispObj *LispApply3(LispObj*, LispObj*, LispObj*, LispObj*); + +LispObj *LispNew(LispObj*, LispObj*); +LispObj *LispNewSymbol(LispAtom*); +LispObj *LispNewAtom(char*, int); +LispObj *LispNewFunction(LispObj*); +LispObj *LispNewFunctionQuote(LispObj*); +LispObj *LispNewStaticAtom(char*); +LispObj *LispNewDFloat(double); +LispObj *LispNewString(char*, long, int); +LispObj *LispNewInteger(long); +LispObj *LispNewRatio(long, long); +LispObj *LispNewVector(LispObj*); +LispObj *LispNewQuote(LispObj*); +LispObj *LispNewBackquote(LispObj*); +LispObj *LispNewComma(LispObj*, int); +LispObj *LispNewCons(LispObj*, LispObj*); +LispObj *LispNewLambda(LispObj*, LispObj*, LispObj*, LispFunType); +LispObj *LispNewStruct(LispObj*, LispObj*); +LispObj *LispNewComplex(LispObj*, LispObj*); +LispObj *LispNewOpaque(void*, int); +LispObj *LispNewKeyword(char*); +LispObj *LispNewPathname(LispObj*); +LispObj *LispNewStringStream(char*, int, long, int); +LispObj *LispNewFileStream(LispFile*, LispObj*, int); +LispObj *LispNewPipeStream(LispPipe*, LispObj*, int); +LispObj *LispNewBignum(mpi*); +LispObj *LispNewBigratio(mpr*); -char *LispGetString(LispMac*, char*); +LispAtom *LispGetAtom(char*); /* This function does not allocate a copy of it's argument, but the argument * itself. The argument string should never change. */ -char *LispGetPermString(LispMac*, char*); +LispAtom *LispGetPermAtom(char*); -void *LispMalloc(LispMac*, unsigned); -void *LispCalloc(LispMac*, unsigned, unsigned); -void *LispRealloc(LispMac*, void*, unsigned); -char *LispStrdup(LispMac*, char*); -void LispFree(LispMac*, void*); +void *LispMalloc(size_t); +void *LispCalloc(size_t, size_t); +void *LispRealloc(void*, size_t); +char *LispStrdup(char*); +void LispFree(void*); /* LispMused means memory is now safe from LispDestroy, and should not be * freed in case of an error */ -void LispMused(LispMac*, void*); +void LispMused(void*); -void LispGC(LispMac*, LispObj*, LispObj*); +void LispGC(LispObj*, LispObj*); -char *LispStrObj(LispMac*, LispObj*); +char *LispStrObj(LispObj*); -void LispDestroy(LispMac *mac, char *fmt, ...); +#ifdef __GNUC__ +#define PRINTF_FORMAT __attribute__ ((format (printf, 1, 2))) +#else +#define PRINTF_FORMAT /**/ +#endif +void LispDestroy(char *fmt, ...) PRINTF_FORMAT; + /* continuable error */ +void LispContinuable(char *fmt, ...) PRINTF_FORMAT; +void LispMessage(char *fmt, ...) PRINTF_FORMAT; +void LispWarning(char *fmt, ...) PRINTF_FORMAT; +#undef PRINTF_FORMAT -LispObj *LispSetVariable(LispMac*, LispObj*, LispObj*, char*, int); +LispObj *LispSetVariable(LispObj*, LispObj*, char*, int); -int LispRegisterOpaqueType(LispMac*, char*); +int LispRegisterOpaqueType(char*); -int LispPrintf(LispMac*, LispObj*, char*, ...); -int LispPrintString(LispMac*, LispObj*, char*); -int LispPrintObj(LispMac*, LispObj*, LispObj*, int); +int LispPrintString(LispObj*, char*); -void LispProtect(LispMac*, LispObj*, LispObj*); -void LispUProtect(LispMac*, LispObj*, LispObj*); +void LispProtect(LispObj*, LispObj*); +void LispUProtect(LispObj*, LispObj*); -/* search argument list for the specified keys. - * example: LispGetKeys(mac, fname, "START:END", list, &start, &end); - * note that the separator for key names is the ':' character. - * values not present in the argument list get the default value of NIL, - * values specified more than once get only the first specification, - * and if an unknown is on the argument list, a fatal error happens. */ -void LispGetKeys(LispMac*, char*, char*, LispObj*, ...); - /* this function should be called when a module is loaded, and is called * when loading the interpreter */ -void LispAddBuiltinFunction(LispMac*, LispBuiltin*); +void LispAddBuiltinFunction(LispBuiltin*); /* * Initialization */ -extern LispObj *NIL, *T; +extern LispObj *UNBOUND; extern int gcpro; -extern FILE *lisp_stdin, *lisp_stdout, *lisp_stderr; + +extern LispObj *Okey, *Orest, *Ooptional, *Oaux, *Olambda; +extern Atom_id Snil, St, Skey, Srest, Soptional, Saux; +extern Atom_id Sand, Sor, Snot; +extern Atom_id Satom, Ssymbol, Sinteger, Scharacter, Sstring, Slist, + Scons, Svector, Sarray, Sstruct, Skeyword, Sfunction, Spathname, + Srational, Sfloat, Scomplex, Sopaque, Sdefault; + +extern LispObj *Ocomplex, *Oformat, *Kunspecific; + +extern LispObj *Omake_array, *Kinitial_contents, *Osetf; +extern Atom_id Svariable, Sstructure, Stype, Ssetf; + +extern Atom_id Smake_struct, Sstruct_access, Sstruct_store, Sstruct_type; +extern LispObj *Omake_struct, *Ostruct_access, *Ostruct_store, *Ostruct_type; + +extern LispObj *Oparse_namestring, *Kerror, *Kabsolute, *Krelative, *Oopen, + *Oclose, *Kif_does_not_exist; + +extern LispObj *Oequal_; + +extern LispFile *Stdout, *Stdin, *Stderr; #endif /* Lisp_internal_h */ Index: xc/programs/xedit/lisp/io.c diff -u /dev/null xc/programs/xedit/lisp/io.c:1.16 --- /dev/null Thu Feb 27 12:34:57 2003 +++ xc/programs/xedit/lisp/io.c Sun Dec 15 22:59:27 2002 @@ -0,0 +1,709 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/io.c,v 1.16 2002/12/16 03:59:27 paulo Exp $ */ + +#include "io.h" +#include <errno.h> +#include <fcntl.h> +#include <stdarg.h> +#include <sys/types.h> +#include <sys/stat.h> + +/* Match the FILE_XXX flags */ +#define READ_BIT 0x01 +#define WRITE_BIT 0x02 +#define APPEND_BIT 0x04 +#define BUFFERED_BIT 0x08 +#define UNBUFFERED_BIT 0x10 +#define BINARY_BIT 0x20 + +/* + * Prototypes + */ +static int calculate_line(void*, int); +static int calculate_column(void*, int, int); + +/* + * Initialization + */ +extern int pagesize; + +/* + * Implementation + */ +int +LispGet(void) +{ + int ch = EOF; + LispUngetInfo *unget = lisp__data.unget[lisp__data.iunget]; + + if (unget->offset) + ch = ((unsigned char*)unget->buffer)[--unget->offset]; + else if (SINPUT->data.stream.readable) { + LispFile *file = NULL; + + switch (SINPUT->data.stream.type) { + case LispStreamStandard: + case LispStreamFile: + file = FSTREAMP(SINPUT); + break; + case LispStreamPipe: + file = IPSTREAMP(SINPUT); + break; + case LispStreamString: + ch = LispSgetc(SSTREAMP(SINPUT)); + break; + default: + ch = EOF; + break; + } + if (file != NULL) { + if (file->nonblock) { + if (fcntl(file->descriptor, F_SETFL, 0) < 0) + LispDestroy("fcntl: %s", strerror(errno)); + file->nonblock = 0; + } + ch = LispFgetc(file); + } + } + else + LispDestroy("cannot read from *STANDARD-INPUT*"); + + if (ch == EOF) + lisp__data.eof = 1; + + return (ch); +} + +int +LispUnget(int ch) +{ + LispUngetInfo *unget = lisp__data.unget[lisp__data.iunget]; + + if (unget->offset == sizeof(unget->buffer)) { + LispWarning("character %c lost at LispUnget()", unget->buffer[0]); + memmove(unget->buffer, unget->buffer + 1, unget->offset - 1); + unget->buffer[unget->offset - 1] = ch; + } + else + unget->buffer[unget->offset++] = ch; + + return (ch); +} + +void +LispPushInput(LispObj *stream) +{ + if (!STREAMP(stream) || !stream->data.stream.readable) + LispDestroy("bad stream at PUSH-INPUT"); + lisp__data.input_list = CONS(stream, lisp__data.input_list); + SINPUT = stream; + if (lisp__data.iunget + 1 == lisp__data.nunget) { + LispUngetInfo **info = + realloc(lisp__data.unget, + sizeof(LispUngetInfo) * (lisp__data.nunget + 1)); + + if (!info || + (info[lisp__data.nunget] = + calloc(1, sizeof(LispUngetInfo))) == NULL) + LispDestroy("out of memory"); + lisp__data.unget = info; + ++lisp__data.nunget; + } + ++lisp__data.iunget; + memset(lisp__data.unget[lisp__data.iunget], '\0', sizeof(LispUngetInfo)); + lisp__data.eof = 0; +} + +void +LispPopInput(LispObj *stream) +{ + if (!CONSP(lisp__data.input_list) || stream != CAR(lisp__data.input_list)) + LispDestroy("bad stream at POP-INPUT"); + lisp__data.input_list = CDR(lisp__data.input_list); + SINPUT = CONSP(lisp__data.input_list) ? + CAR(lisp__data.input_list) : lisp__data.input_list; + --lisp__data.iunget; + lisp__data.eof = 0; +} + +/* + * Low level functions + */ +static int +calculate_line(void *data, int size) +{ + int line = 0; + char *str, *ptr; + + for (str = (char*)data, ptr = (char*)data + size; str < ptr; str++) + if (*ptr == '\n') + ++line; + + return (line); +} + +static int +calculate_column(void *data, int size, int column) +{ + char *str, *ptr; + + /* search for newline in data */ + for (str = (char*)data, ptr = (char*)data + size - 1; ptr >= str; ptr--) + if (*ptr == '\n') + break; + + /* newline found */ + if (ptr >= str) + return (size - (ptr - str) - 1); + + /* newline not found */ + return (column + size); +} + +LispFile * +LispFdopen(int descriptor, int mode) +{ + LispFile *file = calloc(1, sizeof(LispFile)); + + if (file) { + struct stat st; + + file->descriptor = descriptor; + file->readable = (mode & READ_BIT) != 0; + file->writable = (mode & WRITE_BIT) != 0; + + if (fstat(descriptor, &st) == 0) + file->regular = S_ISREG(st.st_mode); + else + file->regular = 0; + + file->buffered = (mode & BUFFERED_BIT) != 0; + if ((mode & UNBUFFERED_BIT) == 0) + file->buffered = file->regular; + + if (file->buffered) { + file->buffer = malloc(pagesize); + if (file->buffer == NULL) + file->buffered = 0; + } + file->line = 1; + file->binary = (mode & BINARY_BIT) != 0; + file->io_write = write; + } + + return (file); +} + +LispFile * +LispFopen(char *path, int mode) +{ + LispFile *file; + int descriptor; + int flags = O_NOCTTY; + + /* check read/write attributes */ + if ((mode & (READ_BIT | WRITE_BIT)) == (READ_BIT | WRITE_BIT)) + flags |= O_RDWR; + else if (mode & READ_BIT) + flags |= O_RDONLY; + else if (mode & WRITE_BIT) + flags |= O_WRONLY; + + /* create if does not exist */ + if (mode & WRITE_BIT) { + flags |= O_CREAT; + + /* append if exists? */ + if (mode & APPEND_BIT) + flags |= O_APPEND; + else + flags |= O_TRUNC; + } + + /* open file */ + descriptor = open(path, flags, 0666); + if (descriptor < 0) + return (NULL); + + /* initialize LispFile structure */ + file = LispFdopen(descriptor, mode); + if (file == NULL) + close(descriptor); + + return (file); +} + +void +LispFclose(LispFile *file) +{ + /* flush any pending output */ + LispFflush(file); + /* cleanup */ + close(file->descriptor); + if (file->buffer) + free(file->buffer); + free(file); +} + +io_write_fn +LispSetFileWrite(LispFile *file, io_write_fn new_write) +{ + io_write_fn old_write = file->io_write; + + file->io_write = new_write; + + return (old_write); +} + +int +LispFflush(LispFile *file) +{ + if (file->writable && file->length) { + int length = (*file->io_write)(file->descriptor, + file->buffer, file->length); + + if (length > 0) { + if (file->length > length) + memmove(file->buffer, file->buffer + length, + file->length - length); + file->length -= length; + } + return (length); + } + + return (0); +} + +int +LispFungetc(LispFile *file, int ch) +{ + if (file->readable) { + file->available = 1; + file->unget = ch; + /* this should never happen */ + if (ch == '\n' && !file->binary) + --file->line; + } + + return (ch); +} + +int +LispFgetc(LispFile *file) +{ + int ch; + + if (file->readable) { + unsigned char c; + + if (file->available) { + ch = file->unget; + file->available = 0; + } + else if (file->buffered) { + if (file->writable) { + LispFflush(file); + if (read(file->descriptor, &c, 1) == 1) + ch = c; + else + ch = EOF; + } + else { + if (file->offset < file->length) + ch = ((unsigned char*)file->buffer)[file->offset++]; + else { + int length = read(file->descriptor, + file->buffer, pagesize); + + if (length >= 0) + file->length = length; + else + file->length = 0; + file->offset = 0; + if (file->length) + ch = ((unsigned char*)file->buffer)[file->offset++]; + else + ch = EOF; + } + } + } + else if (read(file->descriptor, &c, 1) == 1) + ch = c; + else + ch = EOF; + } + else + ch = EOF; + + if (ch == '\n' && !file->binary) + ++file->line; + + return (ch); +} + +int +LispFputc(LispFile *file, int ch) +{ + if (file->writable) { + unsigned char c = ch; + + if (file->buffered) { + if (file->length + 1 >= pagesize) + LispFflush(file); + file->buffer[file->length++] = c; + } + else if ((*file->io_write)(file->descriptor, &c, 1) != 1) + ch = EOF; + + if (!file->binary) { + /* update column number */ + if (ch == '\n') + file->column = 0; + else + ++file->column; + } + } + + return (ch); +} + +int +LispSgetc(LispString *string) +{ + int ch; + + if (string->input >= string->length) + return (EOF); /* EOF reading from string */ + + ch = ((unsigned char*)string->string)[string->input++]; + if (ch == '\n' && !string->binary) + ++string->line; + + return (ch); +} + +int +LispSputc(LispString *string, int ch) +{ + if (string->output + 1 >= string->space) { + if (string->fixed) + return (EOF); + else { + char *tmp = realloc(string->string, string->space + pagesize); + + if (tmp == NULL) + return (EOF); + string->string = tmp; + string->space += pagesize; + } + } + + string->string[string->output++] = ch; + if (string->length < string->output) + string->length = string->output; + + /* update column number */ + if (!string->binary) { + if (ch == '\n') + string->column = 0; + else + ++string->column; + } + + return (ch); +} + +char * +LispFgets(LispFile *file, char *string, int size) +{ + int ch, offset = 0; + + if (size < 1) + return (string); + + for (;;) { + if (offset + 1 >= size) + break; + if ((ch = LispFgetc(file)) == EOF) + break; + string[offset++] = ch; + /* line number is calculated in LispFgetc */ + if (ch == '\n') + break; + } + string[offset] = '\0'; + + return (offset ? string : NULL); +} + +int +LispFputs(LispFile *file, char *buffer) +{ + return (LispFwrite(file, buffer, strlen(buffer))); +} + +int +LispSputs(LispString *string, char *buffer) +{ + return (LispSwrite(string, buffer, strlen(buffer))); +} + +int +LispFread(LispFile *file, void *data, int size) +{ + int bytes, length; + char *buffer; + + if (!file->readable) + return (EOF); + + if (size <= 0) + return (size); + + length = 0; + buffer = (char*)data; + + /* check if there is an unget character */ + if (file->available) { + *buffer++ = file->unget; + file->available = 0; + if (--size == 0) { + if (file->unget == '\n' && !file->binary) + ++file->line; + + return (1); + } + + length = 1; + } + + if (file->buffered) { + void *base_data = (char*)data - length; + + if (file->writable) { + LispFflush(file); + bytes = read(file->descriptor, buffer, size); + if (bytes < 0) + bytes = 0; + if (!file->binary) + file->line += calculate_line(base_data, length + bytes); + + return (length + bytes); + } + + /* read anything that is in the buffer */ + if (file->offset < file->length) { + bytes = file->length - file->offset; + if (bytes > size) + bytes = size; + memcpy(buffer, file->buffer + file->offset, bytes); + buffer += bytes; + file->offset += bytes; + size -= bytes; + } + + /* if there is still something to read */ + if (size) { + bytes = read(file->descriptor, buffer, size); + if (bytes < 0) + bytes = 0; + + length += bytes; + } + + if (!file->binary) + file->line += calculate_line(base_data, length); + + return (length); + } + + bytes = read(file->descriptor, buffer, size); + if (bytes < 0) + bytes = 0; + if (!file->binary) + file->line += calculate_line(buffer - length, length + bytes); + + return (length + bytes); +} + +int +LispFwrite(LispFile *file, void *data, int size) +{ + if (!file->writable || size < 0) + return (EOF); + + if (!file->binary) + file->column = calculate_column(data, size, file->column); + + if (file->buffered) { + int length, bytes; + char *buffer = (char*)data; + + length = 0; + if (size + file->length > pagesize) { + /* fill remaining space in buffer and flush */ + bytes = pagesize - file->length; + memcpy(file->buffer + file->length, buffer, bytes); + file->length += bytes; + LispFflush(file); + + /* check if all data was written */ + if (file->length) + return (pagesize - file->length); + + length = bytes; + buffer += bytes; + size -= bytes; + } + + while (size > pagesize) { + /* write multiple of pagesize */ + bytes = (*file->io_write)(file->descriptor, buffer, + size - (size % pagesize)); + if (bytes <= 0) + return (length); + + length += bytes; + buffer += bytes; + size -= bytes; + } + + if (size) { + /* keep remaining data in buffer */ + switch (size) { + case 8: + file->buffer[file->length++] = *buffer++; + case 7: + file->buffer[file->length++] = *buffer++; + case 6: + file->buffer[file->length++] = *buffer++; + case 5: + file->buffer[file->length++] = *buffer++; + case 4: + file->buffer[file->length++] = *buffer++; + case 3: + file->buffer[file->length++] = *buffer++; + case 2: + file->buffer[file->length++] = *buffer++; + case 1: + file->buffer[file->length++] = *buffer++; + break; + default: + memcpy(file->buffer + file->length, buffer, size); + file->length += size; + break; + } + length += size; + } + + return (length); + } + + return ((*file->io_write)(file->descriptor, data, size)); +} + +int +LispSwrite(LispString *string, void *data, int size) +{ + if (size < 0) + return (EOF); + + if (string->output + size >= string->space) { + if (string->fixed) { + /* leave space for a ending nul character */ + size = string->space - string->output - 1; + + if (size <= 0) + return (-1); + } + else { + char *tmp = realloc(string->string, string->space + + (size / pagesize) * pagesize + pagesize); + + if (tmp == NULL) + return (-1); + + string->string = tmp; + string->space += pagesize; + } + } + memcpy(string->string + string->output, data, size); + string->output += size; + if (string->length < string->output) + string->length = string->output; + + if (!string->binary) + string->column = calculate_column(data, size, string->column); + + return (size); +} + +char * +LispGetSstring(LispString *string, int *length) +{ + if (string->string == NULL || string->length <= 0) { + *length = 0; + + return (""); + } + *length = string->length; + if (string->string[string->length -1] != '\0') { + if (string->length < string->space) + string->string[string->length] = '\0'; + else if (string->fixed && string->space) + string->string[string->space - 1] = '\0'; + else { + char *tmp = realloc(string->string, string->space + pagesize); + + if (tmp == NULL) + string->string[string->space - 1] = '\0'; + else { + string->string = tmp; + string->space += pagesize; + string->string[string->length] = '\0'; + } + } + } + + return (string->string); +} + +int +LispRename(char *from, char *to) +{ + return (rename(from, to)); +} + +int +LispUnlink(char *name) +{ + return (unlink(name)); +} Index: xc/programs/xedit/lisp/io.h diff -u /dev/null xc/programs/xedit/lisp/io.h:1.8 --- /dev/null Thu Feb 27 12:34:57 2003 +++ xc/programs/xedit/lisp/io.h Thu Dec 5 22:25:27 2002 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/io.h,v 1.8 2002/12/06 03:25:27 paulo Exp $ */ + +#ifndef Lisp_io_h +#define Lisp_io_h + +#include "private.h" + +#define FILE_READ 0x01 +#define FILE_WRITE 0x02 +#define FILE_IO 0x03 +#define FILE_APPEND 0x06 /* append mode, write bit also set */ +#define FILE_BUFFERED 0x08 /* force buffered mode */ +#define FILE_UNBUFFERED 0x10 /* force unbuffered mode */ +#define FILE_BINARY 0x20 + +/* + * Types + */ +typedef ssize_t (*io_write_fn)(int, const void*, size_t); + +struct _LispFile { + char *buffer; + int line; /* input line number */ + int column; /* output column number */ + int descriptor; + int length; /* number of bytes used */ + int offset; /* read/write offset */ + int unget : 8; /* unread char */ + int readable : 1; + int writable : 1; + int regular : 1; /* regular file */ + int buffered : 1; + int available : 1; /* unget field holds a char */ + int nonblock : 1; /* in nonblock mode */ + int binary : 1; /* if set, don't calculate column/line-number */ + io_write_fn io_write; +}; + +struct _LispString { + char *string; + int line; /* input line number */ + int column; /* output column number */ + int space; /* number of bytes alocated */ + int length; /* number of bytes used */ + int input; /* input offset, for read operations */ + int output; /* output offset, for write operations */ + int fixed : 1; /* if set, don't try to reallocate string */ + int binary : 1; /* if set, don't calculate column/line-number */ +}; + +/* + * Prototypes + */ + /* higher level functions */ +int LispGet(void); +int LispUnget(int); +void LispPushInput(LispObj*); +void LispPopInput(LispObj*); + + /* functions that read/write using the LispFile structure */ +LispFile *LispFdopen(int, int); +LispFile *LispFopen(char*, int); +void LispFclose(LispFile*); +int LispFflush(LispFile*); +int LispFungetc(LispFile*, int); +int LispFgetc(LispFile*); +int LispFputc(LispFile*, int); +char *LispFgets(LispFile*, char*, int); +int LispFputs(LispFile*, char*); +int LispFread(LispFile*, void*, int); +int LispFwrite(LispFile*, void*, int); +int LispRename(char*, char*); +int LispUnlink(char*); + + /* io wrappers */ +io_write_fn LispSetFileWrite(LispFile*, io_write_fn); + + /* functions that read/write using the LispString structure */ +int LispSgetc(LispString*); +int LispSputc(LispString*, int); +int LispSputs(LispString*, char*); +int LispSwrite(LispString*, void*, int); + +char *LispGetSstring(LispString*, int*); + +#endif /* Lisp_io_h */ Index: xc/programs/xedit/lisp/lisp.c diff -u xc/programs/xedit/lisp/lisp.c:1.27 xc/programs/xedit/lisp/lisp.c:1.85 --- xc/programs/xedit/lisp/lisp.c:1.27 Wed Jan 9 23:29:18 2002 +++ xc/programs/xedit/lisp/lisp.c Tue Jan 28 22:05:53 2003 @@ -27,16 +27,19 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.27 2002/01/10 04:29:18 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.85 2003/01/29 03:05:53 paulo Exp $ */ #include <stdlib.h> #include <string.h> -#ifdef sun /* Don't ask.... */ +#ifdef sun #include <strings.h> #endif #include <ctype.h> +#include <errno.h> +#include <fcntl.h> #include <stdarg.h> #include <signal.h> +#include <sys/wait.h> #ifndef X_NOT_POSIX #include <unistd.h> /* for sysconf(), and getpagesize() */ @@ -64,270 +67,574 @@ #define HAS_SC_PAGESIZE #endif -#include "private.h" +#include "bytecode.h" +#include "read.h" #include "format.h" +#include "math.h" +#include "hash.h" +#include "package.h" +#include "pathname.h" +#include "regex.h" #include "require.h" +#include "stream.h" #include "struct.h" #include "time.h" +#include "write.h" +#include <math.h> +typedef struct { + LispObj **objects; + LispObj *freeobj; + int nsegs; + int nobjs; + int nfree; +} LispObjSeg; + /* * Prototypes */ +static void Lisp__GC(LispObj*, LispObj*); +static LispObj *Lisp__New(LispObj*, LispObj*); + /* run a user function, to be called only by LispEval */ -LispObj *LispRunFunMac(LispMac*, LispObj*, LispObj*); +static LispObj *LispRunFunMac(LispObj*, LispObj*, int, int); + /* expands and executes a setf method, to be called only by Lisp_Setf */ -LispObj *LispRunSetf(LispMac*, LispObj*, LispObj*, LispObj*); +LispObj *LispRunSetf(LispArgList*, LispObj*, LispObj*, LispObj*); +LispObj *LispRunSetfMacro(LispAtom*, LispObj*, LispObj*); -/* build argument list, assigning defaults and/or positioning &key arguments - * return value is gc protected, and should be called only by - * LispEval and LispRunSetf - */ -static LispObj *LispBuildArguments(LispMac*, LispObj*, LispObj*, - char*, int); +/* increases storage size for environment */ +void LispMoreEnvironment(void); -/* build argument list for builtin functions or functions that don't have - * any of the &some-name special parameters. - * return value is gc protected, and should be called only by - * LispEval and LispRunSetf - */ -static LispObj *LispBuildSimpleArguments(LispMac*, LispObj*, - char*, int, int, int); +/* increases storage size for stack of builtin arguments */ +void LispMoreStack(void); + +/* increases storage size for global variables */ +void LispMoreGlobals(LispPackage*); + +#ifdef __GNUC__ +static INLINE LispObj *LispDoGetVar(LispObj*); +#endif +static INLINE void LispDoAddVar(LispObj*, LispObj*); -int LispGet(LispMac*); -int LispUnget(LispMac*); -static int LispSkipComment(LispMac*); -static int LispSkipWhiteSpace(LispMac*); -static char *LispIntToOpaqueType(LispMac*, int); -static LispObj *LispEvalBackquote(LispMac*, LispObj*); +/* Helper for importing symbol(s) functions, + * Search for the specified object in the current package */ +static INLINE LispObj *LispGetVarPack(LispObj*); -static LispProperty *LispAllocAtomProperty(LispMac*); +/* create environment for function call */ +static int LispMakeEnvironment(LispArgList*, LispObj*, LispObj*, int, int); - /* if no properties remaining, free atom->property, - * and this way, make string candidate to gc */ -static void LispCheckAtomProperty(LispMac*, LispAtom*); + /* if not already in keyword package, move atom to keyword package */ +static LispObj *LispCheckKeyword(LispObj*); -static LispObj *LispDoGetAtomProperty(LispMac*, LispAtom*, LispObj*, int); + /* builtin backquote parsing */ +static LispObj *LispEvalBackquoteObject(LispObj*, int, int); + /* used also by the bytecode compiler */ +LispObj *LispEvalBackquote(LispObj*, int); + /* create or change object property */ +void LispSetAtomObjectProperty(LispAtom*, LispObj*); + /* remove object property */ +static void LispRemAtomObjectProperty(LispAtom*); -void LispSnprint(LispMac*, LispObj*, char*, int); -void LispSnprintObj(LispMac*, LispObj*, char**, int*, int); + /* allocates a new LispProperty for the given atom */ +static void LispAllocAtomProperty(LispAtom*); + /* Increment reference count of atom property */ +static void LispIncrementAtomReference(LispAtom*); + /* Decrement reference count of atom property */ +static void LispDecrementAtomReference(LispAtom*); + /* Removes all atom properties */ +static void LispRemAtomAllProperties(LispAtom*); -void LispCheckMemLevel(LispMac*); +static LispObj *LispAtomPropertyFunction(LispAtom*, LispObj*, int); -void LispAllocSeg(LispMac*); -void LispMark(LispObj*); +static INLINE void LispCheckMemLevel(void); +void LispAllocSeg(LispObjSeg*, int); +static INLINE void LispMark(LispObj*); + +/* functions, macros, setf methods, and structure definitions */ +static INLINE void LispProt(LispObj*); + +static LispObj *LispCheckNeedProtect(LispObj*); + +static #ifdef SIGNALRETURNSINT -int LispAbortSignal(int); -int LispFPESignal(int); +int #else -void LispAbortSignal(int); -void LispFPESignal(int); +void #endif - -static int GetPageSize(void); +LispSignalHandler(int); /* * Initialization */ -static LispObj lispnil = {LispNil_t}; -static LispObj lispt = {LispTrue_t}; -static LispObj lispdot = {LispAtom_t}; -LispObj *NIL = &lispnil, *T = &lispt; -static LispObj *DOT = &lispdot; -static LispObj **objseg, *freeobj = &lispnil; -static int pagesize, segsize, numseg; -static int nfree, nobjs; -int gcpro; - -char *ExpectingListAt = "expecting list, at %s"; -char *ExpectingNumberAt = "expecting number, at %s"; -FILE *lisp_stdin, *lisp_stdout, *lisp_stderr; - -char *LispCharNames[] = { -"Null", "Soh", "Stx", "Etx", -"Eot", "Enq", "Ack", "Bel", -"Backspace", "Tab", "Newline", "Vt", -"Page", "Return", "So", "Si", -"Dle", "Dc1", "Dc2", "Dc3", -"Dc4", "Nak", "Syn", "Etb", -"Can", "Em", "Sub", "Escape", -"Fs", "Gs", "Rs", "Us", -"Space" -}; +LispMac lisp__data; + +static LispObj lispunbound = {LispNil_t}; +LispObj *UNBOUND = &lispunbound; +static volatile int lisp__disable_int; +static volatile int lisp__interrupted; + +LispObj *Okey, *Orest, *Ooptional, *Oaux, *Olambda; + +Atom_id Snil, St; +Atom_id Saux, Skey, Soptional, Srest; +Atom_id Satom, Ssymbol, Sinteger, Scharacter, Sstring, Slist, + Scons, Svector, Sarray, Sstruct, Skeyword, Sfunction, Spathname, + Srational, Sfloat, Scomplex, Sopaque, Sdefault; + +LispObj *Oformat, *Kunspecific; +LispObj *Oexpand_setf_method; + +static LispProperty noproperty; +LispProperty *NOPROPERTY = &noproperty; +static int segsize, minfree; +int pagesize, gcpro; + +static LispObjSeg objseg = {NULL, NIL}; +static LispObjSeg atomseg = {NULL, NIL}; + +int LispArgList_t; + +LispFile *Stdout, *Stdin, *Stderr; + static LispBuiltin lispbuiltins[] = { - {"*", Lisp_Mul, 1, 0, 0,}, - {"+", Lisp_Plus, 1, 0, 0,}, - {"-", Lisp_Minus, 1, 1, 0,}, - {"/", Lisp_Div, 1, 1, 0,}, - {"1+", Lisp_OnePlus, 1, 1, 1,}, - {"1-", Lisp_OneMinus, 1, 1, 1,}, - {"<", Lisp_Less, 0, 1, 0,}, - {"<=", Lisp_LessEqual, 0, 1, 0,}, - {"=", Lisp_Equal_, 0, 1, 0,}, - {">", Lisp_Greater, 0, 1, 0,}, - {">=", Lisp_GreaterEqual, 0, 1, 0,}, - {"/=", Lisp_NotEqual, 1, 1, 0,}, - {"APPEND", Lisp_Append, 0, 0, 0,}, - {"APPLY", Lisp_Apply, 0, 2, 0,}, - {"AND", Lisp_And, 0, 0, 0,}, - {"AREF", Lisp_Aref, 1, 2, 0,}, - {"ASSOC", Lisp_Assoc, 1, 2, 2,}, - {"ATOM", Lisp_Atom, 1, 0, 1,}, - {"BLOCK", Lisp_Block, 0, 1, 0,}, - {"BUTLAST", Lisp_Butlast, 1, 1, 2,}, - {"CAR", Lisp_Car, 1, 1, 1,}, - {"CASE", Lisp_Case, 0, 1, 0,}, - {"CATCH", Lisp_Catch, 0, 1, 0,}, - {"CDR", Lisp_Cdr, 1, 1, 1,}, - {"CHAR", Lisp_Char, 1, 2, 2,}, - {"SCHAR", Lisp_Char, 1, 2, 2,}, - {"CHAR<", Lisp_CharLess, 0, 1, 0,}, - {"CHAR<=", Lisp_CharLessEqual, 0, 1, 0,}, - {"CHAR=", Lisp_CharEqual_, 0, 1, 0,}, - {"CHAR>", Lisp_CharGreater, 0, 1, 0,}, - {"CHAR>=", Lisp_CharGreaterEqual, 0, 1, 0,}, - {"CHAR/=", Lisp_CharNotEqual_, 1, 1, 0,}, - {"CHAR-LESSP", Lisp_CharLessp, 0, 1, 0,}, - {"CHAR-NOT-GREATERP", Lisp_CharNotGreaterp, 0, 1, 0,}, - {"CHAR-EQUAL", Lisp_CharEqual, 0, 1, 0,}, - {"CHAR-GREATERP", Lisp_CharGreaterp, 0, 1, 0,}, - {"CHAR-NOT-LESSP", Lisp_CharNotLessp, 0, 1, 0,}, - {"CHAR-NOT-EQUAL", Lisp_CharNotEqual, 1, 1, 0,}, - {"CHAR-DOWNCASE", Lisp_CharDowncase, 1, 1, 1,}, - {"CHAR-INT", Lisp_CharInt, 1, 1, 1,}, - {"CHAR-UPCASE", Lisp_CharUpcase, 1, 1, 1,}, - {"CHARACTER", Lisp_Character, 1, 1, 1,}, - {"COERCE", Lisp_Coerce, 1, 2, 2,}, - {"COND", Lisp_Cond, 0, 0, 0,}, - {"CONS", Lisp_Cons, 1, 2, 2,}, - {"DECF", Lisp_Decf, 0, 1, 2,}, - {"DEFMACRO", Lisp_Defmacro, 0, 2, 0,}, - {"DEFSTRUCT", Lisp_Defstruct, 0, 1, 0,}, - {"DEFUN", Lisp_Defun, 0, 2, 0,}, - {"DEFSETF", Lisp_Defsetf, 0, 2, 0,}, - {"DO", Lisp_Do, 0, 2, 0,}, - {"DO*", Lisp_DoP, 0, 2, 0,}, - {"DOLIST", Lisp_DoList, 0, 1, 0,}, - {"DOTIMES", Lisp_DoTimes, 0, 1, 0,}, - {"ELT", Lisp_Elt, 1, 2, 2,}, - {"ENDP", Lisp_Null, 1, 1, 1,}, - {"EQUAL", Lisp_Equal, 1, 2, 2,}, - {"ERROR", Lisp_Error, 1, 1, 0,}, - {"EVAL", Lisp_Eval, 1, 1, 1,}, - {"EVENP", Lisp_Evenp, 1, 1, 1,}, - {"FIRST", Lisp_Car, 1, 1, 1,}, - {"FMAKUNBOUND", Lisp_FMakunbound, 1, 1, 1,}, - {"FORMAT", Lisp_Format, 1, 2, 0,}, - {"FUNCALL", Lisp_Funcall, 0, 1, 0,}, - {"GC", Lisp_Gc, 1, 0, 0,}, - {"GET", Lisp_Get, 1, 2, 3,}, - {"GO", Lisp_Go, 0, 1, 1,}, - {"IF", Lisp_If, 0, 2, 3,}, - {"INCF", Lisp_Incf, 0, 1, 2,}, - {"INT-CHAR", Lisp_IntChar, 1, 1, 1,}, - {"INTEGERP", Lisp_Integerp, 1, 1, 1,}, - {"LAST", Lisp_Last, 1, 1, 0,}, - {"LAMBDA", Lisp_Lambda, 0, 1, 0,}, - {"LENGTH", Lisp_Length, 1, 1, 1,}, - {"LET", Lisp_Let, 0, 1, 0,}, - {"LET*", Lisp_LetP, 0, 1, 0,}, - {"LIST", Lisp_List, 1, 0, 0,}, - {"LIST*", Lisp_ListP, 0, 1, 0,}, - {"LISTP", Lisp_Listp, 1, 1, 1,}, - {"LOAD", Lisp_Load, 1, 1, 0,}, - {"LOOP", Lisp_Loop, 0, 0, 0,}, - {"MAKE-ARRAY", Lisp_Makearray, 1, 1, 0,}, - {"MAKE-LIST", Lisp_Makelist, 1, 1, 3,}, - {"MAKUNBOUND", Lisp_Makunbound, 1, 1, 1,}, - {"MAPCAR", Lisp_Mapcar, 0, 2, 0,}, - {"MAX", Lisp_Max, 0, 1, 0,}, - {"MEMBER", Lisp_Member, 1, 2, 2,}, - {"MIN", Lisp_Min, 0, 1, 0,}, - {"MINUSP", Lisp_Minusp, 1, 1, 1,}, - {"NOT", Lisp_Null, 1, 0, 1,}, - {"NTH", Lisp_Nth, 1, 2, 2,}, - {"NTHCDR", Lisp_Nthcdr, 1, 2, 2,}, - {"NULL", Lisp_Null, 1, 0, 1,}, - {"NUMBERP", Lisp_Numberp, 1, 1, 1,}, - {"ODDP", Lisp_Oddp, 1, 1, 1,}, - {"OR", Lisp_Or, 0, 0, 0,}, - {"PLUSP", Lisp_Plusp, 1, 1, 1,}, - {"PRIN1", Lisp_Prin1, 1, 1, 2,}, - {"PRINC", Lisp_Princ, 1, 1, 2,}, - {"PRINT", Lisp_Print, 1, 1, 2,}, - {"PROG1", Lisp_Prog1, 0, 1, 0,}, - {"PROG2", Lisp_Prog2, 0, 2, 0,}, - {"PROGN", Lisp_Progn, 0, 0, 0,}, - {"PROGV", Lisp_Progv, 0, 2, 0,}, - {"PROVIDE", Lisp_Provide, 1, 1, 1,}, - {"QUIT", Lisp_Quit, 1, 0, 1,}, - {"QUOTE", Lisp_Quote, 0, 1, 1,}, - {"READ", Lisp_Read, 1, 0, 0,}, - {"REPLACE", Lisp_Replace, 1, 2, 10,}, - {"READ-FROM-STRING", Lisp_ReadFromString, 1, 1, 9,}, - {"REQUIRE", Lisp_Require, 1, 1, 2,}, - {"REST", Lisp_Cdr, 1, 1, 1,}, - {"RETURN", Lisp_Return, 0, 0, 1,}, - {"RETURN-FROM", Lisp_ReturnFrom, 0, 1, 2,}, - {"REVERSE", Lisp_Reverse, 1, 1, 1,}, - {"RPLACA", Lisp_Rplaca, 1, 2, 2,}, - {"RPLACD", Lisp_Rplacd, 1, 2, 2,}, - {"SET", Lisp_Set, 1, 2, 0,}, - {"SETF", Lisp_Setf, 0, 2, 0,}, - {"SETQ", Lisp_SetQ, 0, 2, 0,}, - {"STRING", Lisp_String, 1, 1, 1,}, - {"STRINGP", Lisp_Stringp, 1, 1, 1,}, - {"STRING=", Lisp_StringEqual_, 1, 2, 11,}, - {"STRING<", Lisp_StringLess, 1, 2, 11,}, - {"STRING>", Lisp_StringGreater, 1, 2, 11,}, - {"STRING<=", Lisp_StringLessEqual, 1, 2, 11,}, - {"STRING>=", Lisp_StringGreaterEqual, 1, 2, 11,}, - {"STRING/=", Lisp_StringNotEqual_, 1, 2, 11,}, - {"STRING-EQUAL", Lisp_StringEqual, 1, 2, 11,}, - {"STRING-GREATERP", Lisp_StringGreaterp, 1, 2, 11,}, - {"STRING-NOT-EQUAL", Lisp_StringNotEqual, 1, 2, 11,}, - {"STRING-NOT-GREATERP", Lisp_StringNotGreaterp, 1, 2, 11,}, - {"STRING-NOT-LESSP", Lisp_StringNotLessp, 1, 2, 11,}, - {"STRING-LESSP", Lisp_StringLessp, 1, 2, 11,}, - {"STRING-TRIM", Lisp_StringTrim, 1, 2, 2,}, - {"STRING-LEFT-TRIM", Lisp_StringLeftTrim, 1, 2, 2,}, - {"STRING-RIGHT-TRIM", Lisp_StringRightTrim, 1, 2, 2,}, - {"STRING-UPCASE", Lisp_StringUpcase, 1, 1, 5,}, - {"STRING-DOWNCASE", Lisp_StringDowncase, 1, 1, 5,}, - {"STRING-CAPITALIZE", Lisp_StringCapitalize, 1, 1, 5,}, - {"SUBSEQ", Lisp_Subseq, 1, 2, 3,}, - {"SYMBOLP", Lisp_Symbolp, 1, 1, 1,}, - {"SYMBOL-PLIST", Lisp_SymbolPlist, 1, 1, 1,}, - {"TAGBODY", Lisp_Tagbody, 0, 0, 0,}, - {"TERPRI", Lisp_Terpri, 1, 0, 1,}, - {"TYPEP", Lisp_Typep, 1, 2, 2,}, - {"THROW", Lisp_Throw, 0, 2, 2,}, - {"TIME", Lisp_Time, 0, 1, 1,}, - {"UNLESS", Lisp_Unless, 0, 1, 0,}, - {"UNTIL", Lisp_Until, 0, 1, 0,}, - {"UNWIND-PROTECT", Lisp_UnwindProtect, 0, 1, 0,}, - {"VECTOR", Lisp_Vector, 1, 0, 0,}, - {"WHEN", Lisp_When, 0, 1, 0,}, - {"WHILE", Lisp_While, 0, 1, 0,}, - {"XEDIT::CHAR-STORE", Lisp_XeditCharStore, 1, 3, 3,}, - {"XEDIT::ELT-STORE", Lisp_XeditEltStore, 1, 3, 3,}, - {"XEDIT::MAKE-STRUCT", Lisp_XeditMakeStruct, 1, 1, 0,}, - {"XEDIT::PUT", Lisp_XeditPut, 1, 3, 3,}, - {"XEDIT::STRUCT-ACCESS", Lisp_XeditStructAccess, 1, 2, 2,}, - {"XEDIT::STRUCT-TYPE", Lisp_XeditStructType, 1, 2, 2,}, - {"XEDIT::STRUCT-STORE", Lisp_XeditStructStore, 1, 3, 3,}, - {"XEDIT::VECTOR-STORE", Lisp_XeditVectorStore, 1, 3, 0,}, - {"ZEROP", Lisp_Zerop, 1, 1, 1,}, + {LispFunction, Lisp_Mul, "* &rest numbers"}, + {LispFunction, Lisp_Plus, "+ &rest numbers"}, + {LispFunction, Lisp_Minus, "- number &rest more-numbers"}, + {LispFunction, Lisp_Div, "/ number &rest more-numbers"}, + {LispFunction, Lisp_OnePlus, "1+ number"}, + {LispFunction, Lisp_OneMinus, "1- number"}, + {LispFunction, Lisp_Less, "< number &rest more-numbers"}, + {LispFunction, Lisp_LessEqual, "<= number &rest more-numbers"}, + {LispFunction, Lisp_Equal_, "= number &rest more-numbers"}, + {LispFunction, Lisp_Greater, "> number &rest more-numbers"}, + {LispFunction, Lisp_GreaterEqual, ">= number &rest more-numbers"}, + {LispFunction, Lisp_NotEqual, "/= number &rest more-numbers"}, + {LispFunction, Lisp_Max, "max number &rest more-numbers"}, + {LispFunction, Lisp_Min, "min number &rest more-numbers"}, + {LispFunction, Lisp_Abs, "abs number"}, + {LispFunction, Lisp_Acons, "acons key datum alist"}, + {LispFunction, Lisp_Adjoin, "adjoin item list &key key test test-not"}, + {LispFunction, Lisp_AlphaCharP, "alpha-char-p char"}, + {LispMacro, Lisp_And, "and &rest args", 1, 0, Com_And}, + {LispFunction, Lisp_Append, "append &rest lists"}, + {LispFunction, Lisp_Apply, "apply function arg &rest more-args", 1}, + {LispFunction, Lisp_Aref, "aref array &rest subscripts"}, + {LispFunction, Lisp_Assoc, "assoc item list &key test test-not key"}, + {LispFunction, Lisp_AssocIf, "assoc-if predicate list &key key"}, + {LispFunction, Lisp_AssocIfNot, "assoc-if-not predicate list &key key"}, + {LispFunction, Lisp_Atom, "atom object"}, + {LispMacro, Lisp_Block, "block name &rest body", 1, 0, Com_Block}, + {LispFunction, Lisp_BothCaseP, "both-case-p character"}, + {LispFunction, Lisp_Boundp, "boundp symbol"}, + {LispFunction, Lisp_Butlast, "butlast list &optional count"}, + {LispFunction, Lisp_Nbutlast, "nbutlast list &optional count"}, + {LispFunction, Lisp_Car, "car list", 0, 0, Com_C_r}, + {LispFunction, Lisp_Car, "first list", 0, 0, Com_C_r}, + {LispMacro, Lisp_Case, "case keyform &rest body"}, + {LispMacro, Lisp_Catch, "catch tag &rest body", 1}, + {LispFunction, Lisp_Cdr, "cdr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_Cdr, "rest list", 0, 0, Com_C_r}, + {LispFunction, Lisp_Ceiling, "ceiling number &optional divisor", 1}, + {LispFunction, Lisp_Fceiling, "fceiling number &optional divisor", 1}, + {LispFunction, Lisp_Char, "char string index"}, + {LispFunction, Lisp_Char, "schar simple-string index"}, + {LispFunction, Lisp_CharLess, "char< character &rest more-characters"}, + {LispFunction, Lisp_CharLessEqual, "char<= character &rest more-characters"}, + {LispFunction, Lisp_CharEqual_, "char= character &rest more-characters"}, + {LispFunction, Lisp_CharGreater, "char> character &rest more-characters"}, + {LispFunction, Lisp_CharGreaterEqual, "char>= character &rest more-characters"}, + {LispFunction, Lisp_CharNotEqual_, "char/= character &rest more-characters"}, + {LispFunction, Lisp_CharLessp, "char-lessp character &rest more-characters"}, + {LispFunction, Lisp_CharNotGreaterp, "char-not-greaterp character &rest more-characters"}, + {LispFunction, Lisp_CharEqual, "char-equal character &rest more-characters"}, + {LispFunction, Lisp_CharGreaterp, "char-greaterp character &rest more-characters"}, + {LispFunction, Lisp_CharNotLessp, "char-not-lessp character &rest more-characters"}, + {LispFunction, Lisp_CharNotEqual, "char-not-equal character &rest more-characters"}, + {LispFunction, Lisp_CharDowncase, "char-downcase character"}, + {LispFunction, Lisp_CharInt, "char-code character"}, + {LispFunction, Lisp_CharInt, "char-int character"}, + {LispFunction, Lisp_CharUpcase, "char-upcase character"}, + {LispFunction, Lisp_Character, "character object"}, + {LispFunction, Lisp_Characterp, "characterp object"}, + {LispFunction, Lisp_Clrhash, "clrhash hash-table"}, + {LispFunction, Lisp_IntChar, "code-char integer"}, + {LispFunction, Lisp_Coerce, "coerce object result-type"}, + {LispFunction, Lisp_Compile, "compile name &optional definition", 1}, + {LispFunction, Lisp_Complex, "complex realpart &optional imagpart"}, + {LispMacro, Lisp_Cond, "cond &rest body", 0, 0, Com_Cond}, + {LispFunction, Lisp_Cons, "cons car cdr", 0, 0, Com_Cons}, + {LispFunction, Lisp_Consp, "consp object", 0, 0, Com_Consp}, + {LispFunction, Lisp_Constantp, "constantp form &optional environment"}, + {LispFunction, Lisp_Conjugate, "conjugate number"}, + {LispFunction, Lisp_Complexp, "complexp object"}, + {LispFunction, Lisp_CopyAlist, "copy-alist list"}, + {LispFunction, Lisp_CopyList, "copy-list list"}, + {LispFunction, Lisp_CopyTree, "copy-tree list"}, + {LispFunction, Lisp_Close, "close stream &key abort"}, + {LispFunction, Lisp_C_r, "caar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cddr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caaar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cadar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caddr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdaar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cddar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdddr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caaaar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caaadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caadar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caaddr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cadaar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cadadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "caddar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cadddr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdaaar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdaadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdadar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdaddr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cddaar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cddadr list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cdddar list", 0, 0, Com_C_r}, + {LispFunction, Lisp_C_r, "cddddr list", 0, 0, Com_C_r}, + {LispMacro, Lisp_Decf, "decf place &optional delta"}, + {LispMacro, Lisp_Defconstant, "defconstant name initial-value &optional documentation"}, + {LispMacro, Lisp_Defmacro, "defmacro name lambda-list &rest body"}, + {LispMacro, Lisp_Defstruct, "defstruct name &rest description"}, + {LispMacro, Lisp_Defun, "defun name lambda-list &rest body"}, + {LispMacro, Lisp_Defsetf, "defsetf function lambda-list &rest body"}, + {LispMacro, Lisp_Defparameter, "defparameter name initial-value &optional documentation"}, + {LispMacro, Lisp_Defvar, "defvar name &optional initial-value documentation"}, + {LispFunction, Lisp_Delete, "delete item sequence &key from-end test test-not start end count key"}, + {LispFunction, Lisp_DeleteDuplicates, "delete-duplicates sequence &key from-end test test-not start end key"}, + {LispFunction, Lisp_DeleteIf, "delete-if predicate sequence &key from-end start end count key"}, + {LispFunction, Lisp_DeleteIfNot, "delete-if-not predicate sequence &key from-end start end count key"}, + {LispFunction, Lisp_DeleteFile, "delete-file filename"}, + {LispFunction, Lisp_Denominator, "denominator rational"}, + {LispFunction, Lisp_DigitChar, "digit-char weight &optional radix"}, + {LispFunction, Lisp_DigitCharP, "digit-char-p character &optional radix"}, + {LispFunction, Lisp_Directory, "directory pathname &key all if-cannot-read"}, + {LispFunction, Lisp_DirectoryNamestring, "directory-namestring pathname"}, + {LispFunction, Lisp_Disassemble, "disassemble function"}, + {LispMacro, Lisp_Do, "do init test &rest body"}, + {LispMacro, Lisp_DoP, "do* init test &rest body"}, + {LispFunction, Lisp_Documentation, "documentation symbol type"}, + {LispMacro, Lisp_DoList, "dolist init &rest body", 0, 0, Com_Dolist}, + {LispMacro, Lisp_DoTimes, "dotimes init &rest body"}, + {LispMacro, Lisp_DoAllSymbols, "do-all-symbols init &rest body"}, + {LispMacro, Lisp_DoExternalSymbols, "do-external-symbols init &rest body"}, + {LispMacro, Lisp_DoSymbols, "do-symbols init &rest body"}, + {LispFunction, Lisp_Elt, "elt sequence index"}, + {LispFunction, Lisp_Endp, "endp object"}, + {LispFunction, Lisp_EnoughNamestring, "enough-namestring pathname &optional defaults"}, + {LispFunction, Lisp_Eq, "eq left right", 0, 0, Com_Eq}, + {LispFunction, Lisp_Eql, "eql left right", 0, 0, Com_Eq}, + {LispFunction, Lisp_Equal, "equal left right", 0, 0, Com_Eq}, + {LispFunction, Lisp_Equalp, "equalp left right", 0, 0, Com_Eq}, + {LispFunction, Lisp_Error, "error control-string &rest arguments"}, + {LispFunction, Lisp_Evenp, "evenp integer"}, + {LispFunction, Lisp_Export, "export symbols &optional package"}, + {LispFunction, Lisp_Eval, "eval form"}, + {LispFunction, Lisp_Every, "every predicate sequence &rest more-sequences"}, + {LispFunction, Lisp_Some, "some predicate sequence &rest more-sequences"}, + {LispFunction, Lisp_Notevery, "notevery predicate sequence &rest more-sequences"}, + {LispFunction, Lisp_Notany, "notany predicate sequence &rest more-sequences"}, + {LispFunction, Lisp_Fboundp, "fboundp symbol"}, + {LispFunction, Lisp_Find, "find item sequence &key from-end test test-not start end key"}, + {LispFunction, Lisp_FindIf, "find-if predicate sequence &key from-end start end key"}, + {LispFunction, Lisp_FindIfNot, "find-if-not predicate sequence &key from-end start end key"}, + {LispFunction, Lisp_FileNamestring, "file-namestring pathname"}, + {LispFunction, Lisp_Fill, "fill sequence item &key start end"}, + {LispFunction, Lisp_FindAllSymbols, "find-all-symbols string-or-symbol"}, + {LispFunction, Lisp_FindSymbol, "find-symbol string &optional package", 1}, + {LispFunction, Lisp_FindPackage, "find-package name"}, + {LispFunction, Lisp_Float, "float number &optional other"}, + {LispFunction, Lisp_Floatp, "floatp object"}, + {LispFunction, Lisp_Floor, "floor number &optional divisor", 1}, + {LispFunction, Lisp_Ffloor, "ffloor number &optional divisor", 1}, + {LispFunction, Lisp_Fmakunbound, "fmakunbound symbol"}, + {LispFunction, Lisp_Format, "format destination control-string &rest arguments"}, + {LispFunction, Lisp_FreshLine, "fresh-line &optional output-stream"}, + {LispFunction, Lisp_Funcall, "funcall function &rest arguments", 1}, + {LispFunction, Lisp_Functionp, "functionp object"}, + {LispFunction, Lisp_Gc, "gc &optional car cdr"}, + {LispFunction, Lisp_Gcd, "gcd &rest integers"}, + {LispFunction, Lisp_Gensym, "gensym &optional arg"}, + {LispFunction, Lisp_Get, "get symbol indicator &optional default"}, + {LispFunction, Lisp_Gethash, "gethash key hash-table &optional default", 1}, + {LispMacro, Lisp_Go, "go tag", 0, 0, Com_Go}, + {LispFunction, Lisp_GraphicCharP, "graphic-char-p char"}, + {LispFunction, Lisp_HashTableP, "hash-table-p object"}, + {LispFunction, Lisp_HashTableCount, "hash-table-count hash-table"}, + {LispFunction, Lisp_HashTableRehashSize, "hash-table-rehash-size hash-table"}, + {LispFunction, Lisp_HashTableRehashThreshold, "hash-table-rehash-threshold hash-table"}, + {LispFunction, Lisp_HashTableSize, "hash-table-size hash-table"}, + {LispFunction, Lisp_HashTableTest, "hash-table-test hash-table"}, + {LispFunction, Lisp_HostNamestring, "host-namestring pathname"}, + {LispMacro, Lisp_If, "if test then &optional else", 0, 0, Com_If}, + {LispMacro, Lisp_IgnoreErrors, "ignore-errors &rest body", 1}, + {LispFunction, Lisp_Imagpart, "imagpart number"}, + {LispMacro, Lisp_InPackage, "in-package name"}, + {LispMacro, Lisp_Incf, "incf place &optional delta"}, + {LispFunction, Lisp_Import, "import symbols &optional package"}, + {LispFunction, Lisp_InputStreamP, "input-stream-p stream"}, + {LispFunction, Lisp_IntChar, "int-char integer"}, + {LispFunction, Lisp_Integerp, "integerp object"}, + {LispFunction, Lisp_Intern, "intern string &optional package", 1}, + {LispFunction, Lisp_Intersection, "intersection list1 list2 &key test test-not key"}, + {LispFunction, Lisp_Nintersection, "nintersection list1 list2 &key test test-not key"}, + {LispFunction, Lisp_Isqrt, "isqrt natural"}, + {LispFunction, Lisp_Keywordp, "keywordp object"}, + {LispFunction, Lisp_Last, "last list &optional count", 0, 0, Com_Last}, + {LispMacro, Lisp_Lambda, "lambda lambda-list &rest body"}, + {LispFunction, Lisp_Lcm, "lcm &rest integers"}, + {LispFunction, Lisp_Length, "length sequence", 0, 0, Com_Length}, + {LispMacro, Lisp_Let, "let init &rest body", 1, 0, Com_Let}, + {LispMacro, Lisp_LetP, "let* init &rest body", 1, 0, Com_Letx}, + {LispFunction, Lisp_ListP, "list* object &rest more-objects"}, + {LispFunction, Lisp_ListAllPackages, "list-all-packages"}, + {LispFunction, Lisp_List, "list &rest args"}, + {LispFunction, Lisp_ListLength, "list-length list"}, + {LispFunction, Lisp_Listp, "listp object", 0, 0, Com_Listp}, + {LispFunction, Lisp_Listen, "listen &optional input-stream"}, + {LispFunction, Lisp_Load, "load filename &key verbose print if-does-not-exist"}, + {LispFunction, Lisp_Logand, "logand &rest integers"}, + {LispFunction, Lisp_Logeqv, "logeqv &rest integers"}, + {LispFunction, Lisp_Logior, "logior &rest integers"}, + {LispFunction, Lisp_Lognot, "lognot integer"}, + {LispFunction, Lisp_Logxor, "logxor &rest integers"}, + {LispMacro, Lisp_Loop, "loop &rest body", 0, 0, Com_Loop}, + {LispFunction, Lisp_LowerCaseP, "lower-case-p character"}, + {LispFunction, Lisp_MakeArray, "make-array dimensions &key element-type initial-element initial-contents adjustable fill-pointer displaced-to displaced-index-offset"}, + {LispFunction, Lisp_MakeHashTable, "make-hash-table &key test size rehash-size rehash-threshold initial-contents"}, + {LispFunction, Lisp_MakeList, "make-list size &key initial-element"}, + {LispFunction, Lisp_MakePackage, "make-package package-name &key nicknames use"}, + {LispFunction, Lisp_MakePathname, "make-pathname &key host device directory name type version defaults"}, + {LispFunction, Lisp_MakeString, "make-string size &key initial-element element-type"}, + {LispFunction, Lisp_MakeSymbol, "make-symbol name"}, + {LispFunction, Lisp_MakeStringInputStream, "make-string-input-stream string &optional start end"}, + {LispFunction, Lisp_MakeStringOutputStream, "make-string-output-stream &key element-type"}, + {LispFunction, Lisp_GetOutputStreamString, "get-output-stream-string string-output-stream"}, + {LispFunction, Lisp_Makunbound, "makunbound symbol"}, + {LispFunction, Lisp_Mapc, "mapc function list &rest more-lists"}, + {LispFunction, Lisp_Mapcar, "mapcar function list &rest more-lists"}, + {LispFunction, Lisp_Mapcan, "mapcan function list &rest more-lists"}, + {LispFunction, Lisp_Maphash, "maphash function hash-table"}, + {LispFunction, Lisp_Mapl, "mapl function list &rest more-lists"}, + {LispFunction, Lisp_Maplist, "maplist function list &rest more-lists"}, + {LispFunction, Lisp_Mapcon, "mapcon function list &rest more-lists"}, + {LispFunction, Lisp_Member, "member item list &key test test-not key"}, + {LispFunction, Lisp_MemberIf, "member-if predicate list &key key"}, + {LispFunction, Lisp_MemberIfNot, "member-if-not predicate list &key key"}, + {LispFunction, Lisp_Minusp, "minusp number"}, + {LispFunction, Lisp_Mod, "mod number divisor"}, + {LispMacro, Lisp_MultipleValueBind, "multiple-value-bind symbols values &rest body"}, + {LispMacro, Lisp_MultipleValueCall, "multiple-value-call function &rest form", 1}, + {LispMacro, Lisp_MultipleValueProg1, "multiple-value-prog1 first-form &rest form", 1}, + {LispMacro, Lisp_MultipleValueList, "multiple-value-list form"}, + {LispMacro, Lisp_MultipleValueSetq, "multiple-value-setq symbols form"}, + {LispFunction, Lisp_Nconc, "nconc &rest lists"}, + {LispFunction, Lisp_Nreverse, "nreverse sequence"}, + {LispFunction, Lisp_NsetDifference, "nset-difference list1 list2 &key test test-not key"}, + {LispFunction, Lisp_Nsubstitute, "nsubstitute newitem olditem sequence &key from-end test test-not start end count key"}, + {LispFunction, Lisp_NsubstituteIf, "nsubstitute-if newitem test sequence &key from-end start end count key"}, + {LispFunction, Lisp_NsubstituteIfNot, "nsubstitute-if-not newitem test sequence &key from-end start end count key"}, + {LispFunction, Lisp_Nth, "nth index list"}, + {LispFunction, Lisp_Nthcdr, "nthcdr index list", 0, 0, Com_Nthcdr}, + {LispMacro, Lisp_NthValue, "nth-value index form"}, + {LispFunction, Lisp_Numerator, "numerator rational"}, + {LispFunction, Lisp_Namestring, "namestring pathname"}, + {LispFunction, Lisp_Null, "not arg", 0, 0, Com_Null}, + {LispFunction, Lisp_Null, "null list", 0, 0, Com_Null}, + {LispFunction, Lisp_Numberp, "numberp object", 0, 0, Com_Numberp}, + {LispFunction, Lisp_Oddp, "oddp integer"}, + {LispFunction, Lisp_Open, "open filename &key direction element-type if-exists if-does-not-exist external-format"}, + {LispFunction, Lisp_OpenStreamP, "open-stream-p stream"}, + {LispMacro, Lisp_Or, "or &rest args", 1, 0, Com_Or}, + {LispFunction, Lisp_OutputStreamP, "output-stream-p stream"}, + {LispFunction, Lisp_Packagep, "packagep object"}, + {LispFunction, Lisp_PackageName, "package-name package"}, + {LispFunction, Lisp_PackageNicknames, "package-nicknames package"}, + {LispFunction, Lisp_PackageUseList, "package-use-list package"}, + {LispFunction, Lisp_PackageUsedByList, "package-used-by-list package"}, + {LispFunction, Lisp_Pairlis, "pairlis key data &optional alist"}, + {LispFunction, Lisp_ParseInteger, "parse-integer string &key start end radix junk-allowed", 1}, + {LispFunction, Lisp_ParseNamestring, "parse-namestring object &optional host defaults &key start end junk-allowed", 1}, + {LispFunction, Lisp_PathnameHost, "pathname-host pathname"}, + {LispFunction, Lisp_PathnameDevice, "pathname-device pathname"}, + {LispFunction, Lisp_PathnameDirectory, "pathname-directory pathname"}, + {LispFunction, Lisp_PathnameName, "pathname-name pathname"}, + {LispFunction, Lisp_PathnameType, "pathname-type pathname"}, + {LispFunction, Lisp_PathnameVersion, "pathname-version pathname"}, + {LispFunction, Lisp_Pathnamep, "pathnamep object"}, + {LispFunction, Lisp_Plusp, "plusp number"}, + {LispMacro, Lisp_Pop, "pop place"}, + {LispFunction, Lisp_Position, "position item sequence &key from-end test test-not start end key"}, + {LispFunction, Lisp_PositionIf, "position-if predicate sequence &key from-end start end key"}, + {LispFunction, Lisp_PositionIfNot, "position-if-not predicate sequence &key from-end start end key"}, + {LispFunction, Lisp_Prin1, "prin1 object &optional output-stream"}, + {LispFunction, Lisp_Princ, "princ object &optional output-stream"}, + {LispFunction, Lisp_Print, "print object &optional output-stream"}, + {LispFunction, Lisp_ProbeFile, "probe-file pathname"}, + {LispFunction, Lisp_Proclaim, "proclaim declaration"}, + {LispMacro, Lisp_Prog1, "prog1 first &rest body"}, + {LispMacro, Lisp_Prog2, "prog2 first second &rest body"}, + {LispMacro, Lisp_Progn, "progn &rest body", 1, 0, Com_Progn}, + {LispMacro, Lisp_Progv, "progv symbols values &rest body", 1}, + {LispFunction, Lisp_Provide, "provide module"}, + {LispMacro, Lisp_Push, "push item place"}, + {LispMacro, Lisp_Pushnew, "pushnew item place &key key test test-not"}, + {LispFunction, Lisp_Quit, "quit &optional status"}, + {LispMacro, Lisp_Quote, "quote object"}, + {LispFunction, Lisp_Rational, "rational number"}, + {LispFunction, Lisp_Rationalp, "rationalp object"}, + {LispFunction, Lisp_Read, "read &optional input-stream eof-error-p eof-value recursive-p"}, + {LispFunction, Lisp_ReadChar, "read-char &optional input-stream eof-error-p eof-value recursive-p"}, + {LispFunction, Lisp_ReadCharNoHang, "read-char-no-hang &optional input-stream eof-error-p eof-value recursive-p"}, + {LispFunction, Lisp_ReadLine, "read-line &optional input-stream eof-error-p eof-value recursive-p", 1}, + {LispFunction, Lisp_Realpart, "realpart number"}, + {LispFunction, Lisp_Replace, "replace sequence1 sequence2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_ReadFromString, "read-from-string string &optional eof-error-p eof-value &key start end preserve-whitespace", 1}, + {LispFunction, Lisp_Require, "require module &optional pathname"}, + {LispFunction, Lisp_Rem, "rem number divisor"}, + {LispFunction, Lisp_Remhash, "remhash key hash-table"}, + {LispFunction, Lisp_Remove, "remove item sequence &key from-end test test-not start end count key"}, + {LispFunction, Lisp_RemoveDuplicates, "remove-duplicates sequence &key from-end test test-not start end key"}, + {LispFunction, Lisp_RemoveIf, "remove-if predicate sequence &key from-end start end count key"}, + {LispFunction, Lisp_RemoveIfNot, "remove-if-not predicate sequence &key from-end start end count key"}, + {LispFunction, Lisp_Remprop, "remprop symbol indicator"}, + {LispFunction, Lisp_RenameFile, "rename-file filename new-name", 1}, + {LispMacro, Lisp_Return, "return &optional result", 1, 0, Com_Return}, + {LispMacro, Lisp_ReturnFrom, "return-from name &optional result", 1, 0, Com_ReturnFrom}, + {LispFunction, Lisp_Reverse, "reverse sequence"}, + {LispFunction, Lisp_Round, "round number &optional divisor", 1}, + {LispFunction, Lisp_Fround, "fround number &optional divisor", 1}, + {LispFunction, Lisp_Rplaca, "rplaca place value", 0, 0, Com_Rplac_}, + {LispFunction, Lisp_Rplacd, "rplacd place value", 0, 0, Com_Rplac_}, + {LispFunction, Lisp_Search, "search sequence1 sequence2 &key from-end test test-not key start1 start2 end1 end2"}, + {LispFunction, Lisp_Set, "set symbol value"}, + {LispFunction, Lisp_SetDifference, "set-difference list1 list2 &key test test-not key"}, + {LispFunction, Lisp_SetExclusiveOr, "set-exclusive-or list1 list2 &key test test-not key"}, + {LispFunction, Lisp_NsetExclusiveOr, "nset-exclusive-or list1 list2 &key test test-not key"}, + {LispMacro, Lisp_Setf, "setf &rest form"}, + {LispMacro, Lisp_Psetf, "psetf &rest form"}, + {LispMacro, Lisp_SetQ, "setq &rest form", 0, 0, Com_Setq}, + {LispMacro, Lisp_Psetq, "psetq &rest form"}, + {LispFunction, Lisp_Sleep, "sleep seconds"}, + {LispFunction, Lisp_Sort, "sort sequence predicate &key key"}, + {LispFunction, Lisp_Sqrt, "sqrt number"}, + {LispFunction, Lisp_Elt, "svref sequence index"}, + {LispFunction, Lisp_Sort, "stable-sort sequence predicate &key key"}, + {LispFunction, Lisp_Streamp, "streamp object"}, + {LispFunction, Lisp_String, "string object"}, + {LispFunction, Lisp_Stringp, "stringp object"}, + {LispFunction, Lisp_StringEqual_, "string= string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringLess, "string< string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringGreater, "string> string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringLessEqual, "string<= string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringGreaterEqual, "string>= string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringNotEqual_, "string/= string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringConcat, "string-concat &rest strings"}, + {LispFunction, Lisp_StringEqual, "string-equal string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringGreaterp, "string-greaterp string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringNotEqual, "string-not-equal string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringNotGreaterp, "string-not-greaterp string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringNotLessp, "string-not-lessp string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringLessp, "string-lessp string1 string2 &key start1 end1 start2 end2"}, + {LispFunction, Lisp_StringTrim, "string-trim character-bag string"}, + {LispFunction, Lisp_StringLeftTrim, "string-left-trim character-bag string"}, + {LispFunction, Lisp_StringRightTrim, "string-right-trim character-bag string"}, + {LispFunction, Lisp_StringUpcase, "string-upcase string &key start end"}, + {LispFunction, Lisp_NstringUpcase, "nstring-upcase string &key start end"}, + {LispFunction, Lisp_StringDowncase, "string-downcase string &key start end"}, + {LispFunction, Lisp_NstringDowncase, "nstring-downcase string &key start end"}, + {LispFunction, Lisp_StringCapitalize, "string-capitalize string &key start end"}, + {LispFunction, Lisp_NstringCapitalize, "nstring-capitalize string &key start end"}, + {LispFunction, Lisp_Subseq, "subseq sequence start &optional end"}, + {LispFunction, Lisp_Subsetp, "subsetp list1 list2 &key test test-not key"}, + {LispFunction, Lisp_Substitute, "substitute newitem olditem sequence &key from-end test test-not start end count key"}, + {LispFunction, Lisp_SubstituteIf, "substitute-if newitem test sequence &key from-end start end count key"}, + {LispFunction, Lisp_SubstituteIfNot, "substitute-if-not newitem test sequence &key from-end start end count key"}, + {LispFunction, Lisp_SymbolFunction, "symbol-function symbol"}, + {LispFunction, Lisp_SymbolName, "symbol-name symbol"}, + {LispFunction, Lisp_Symbolp, "symbolp object"}, + {LispFunction, Lisp_SymbolPlist, "symbol-plist symbol"}, + {LispFunction, Lisp_SymbolPackage, "symbol-package symbol"}, + {LispFunction, Lisp_SymbolValue, "symbol-value symbol"}, + {LispMacro, Lisp_Tagbody, "tagbody &rest body", 0, 0, Com_Tagbody}, + {LispFunction, Lisp_Terpri, "terpri &optional output-stream"}, + {LispFunction, Lisp_Typep, "typep object type"}, + {LispMacro, Lisp_The, "the value-type form"}, + {LispMacro, Lisp_Throw, "throw tag result", 1}, + {LispMacro, Lisp_Time, "time form"}, + {LispFunction, Lisp_Truename, "truename pathname"}, + {LispFunction, Lisp_TreeEqual, "tree-equal tree-1 tree-2 &key test test-not"}, + {LispFunction, Lisp_Truncate, "truncate number &optional divisor", 1}, + {LispFunction, Lisp_Ftruncate, "ftruncate number &optional divisor", 1}, + {LispFunction, Lisp_Unexport, "unexport symbols &optional package"}, + {LispFunction, Lisp_Union, "union list1 list2 &key test test-not key"}, + {LispFunction, Lisp_Nunion, "nunion list1 list2 &key test test-not key"}, + {LispMacro, Lisp_Unless, "unless test &rest body", 1, 0, Com_Unless}, + {LispFunction, Lisp_UserHomedirPathname, "user-homedir-pathname &optional host"}, + {LispMacro, Lisp_UnwindProtect, "unwind-protect protect &rest cleanup"}, + {LispFunction, Lisp_UpperCaseP, "upper-case-p character"}, + {LispFunction, Lisp_Values, "values &rest objects", 1}, + {LispFunction, Lisp_ValuesList, "values-list list", 1}, + {LispFunction, Lisp_Vector, "vector &rest objects"}, + {LispMacro, Lisp_When, "when test &rest body", 1, 0, Com_When}, + {LispFunction, Lisp_Write, " write object &key case circle escape length level lines pretty readably right-margin stream"}, + {LispFunction, Lisp_WriteChar, "write-char string &optional output-stream"}, + {LispFunction, Lisp_WriteLine, "write-line string &optional output-stream &key start end"}, + {LispFunction, Lisp_WriteString, "write-string string &optional output-stream &key start end"}, + {LispFunction, Lisp_XeditCharStore, "lisp::char-store string index value", 0, 1}, + {LispFunction, Lisp_XeditEltStore, "lisp::elt-store sequence index value", 0, 1}, + {LispFunction, Lisp_XeditMakeStruct, "lisp::make-struct atom &rest init", 0, 1}, + {LispFunction, Lisp_XeditPut, " lisp::put symbol indicator value", 0, 1}, + {LispFunction, Lisp_XeditPuthash, "lisp::puthash key hash-table value", 0, 1}, + {LispFunction, Lisp_XeditSetSymbolPlist, "lisp::set-symbol-plist symbol list", 0, 1}, + {LispFunction, Lisp_XeditStructAccess, "lisp::struct-access atom struct", 0, 1}, + {LispFunction, Lisp_XeditStructType, "lisp::struct-type atom struct", 0, 1}, + {LispFunction, Lisp_XeditStructStore, "lisp::struct-store atom struct value", 0, 1}, + {LispFunction, Lisp_XeditVectorStore, "lisp::vector-store array &rest values", 0, 1}, + {LispFunction, Lisp_XeditDocumentationStore, "lisp::documentation-store symbol type string", 0, 1}, + {LispFunction, Lisp_Zerop, "zerop number"}, }; +static LispBuiltin extbuiltins[] = { + {LispFunction, Lisp_Getenv, "getenv name"}, + {LispFunction, Lisp_MakePipe, "make-pipe command-line &key direction element-type external-format"}, + {LispFunction, Lisp_PipeBroken, "pipe-broken pipe-stream"}, + {LispFunction, Lisp_PipeErrorStream, "pipe-error-stream pipe-stream"}, + {LispFunction, Lisp_PipeInputDescriptor, "pipe-input-descriptor pipe-stream"}, + {LispFunction, Lisp_PipeErrorDescriptor, "pipe-error-descriptor pipe-stream"}, + {LispFunction, Lisp_Recomp, "re-comp pattern &key nospec icase nosub newline"}, + {LispFunction, Lisp_Reexec, "re-exec regex string &key count start end notbol noteol"}, + {LispFunction, Lisp_Rep, "re-p object"}, + {LispFunction, Lisp_Setenv, "setenv name value &optional overwrite"}, + {LispFunction, Lisp_Unsetenv, "unsetenv name"}, + {LispFunction, Lisp_NstringTrim, "nstring-trim character-bag string"}, + {LispFunction, Lisp_NstringLeftTrim, "nstring-left-trim character-bag string"}, + {LispFunction, Lisp_NstringRightTrim, "nstring-right-trim character-bag string"}, + {LispMacro, Lisp_Until, "until test &rest body", 0, 0, Com_Until}, + {LispMacro, Lisp_While, "while test &rest body", 0, 0, Com_While}, +}; + +/* byte code function argument list for functions that don't change it's + * &REST argument list. */ +extern LispObj x_cons[8]; + /* * Implementation */ static int -GetPageSize(void) +LispGetPageSize(void) { static int pagesize = -1; @@ -355,234 +662,431 @@ pagesize = PAGE_SIZE; #endif - if (pagesize == -1) - pagesize = 0; + if (pagesize < sizeof(LispObj) * 16) + pagesize = sizeof(LispObj) * 16; /* need a reasonable sane size */ return pagesize; } void -LispDestroy(LispMac *mac, char *fmt, ...) +LispDestroy(char *fmt, ...) { - if (!mac->destroyed) { - va_list ap; + static char Error[] = "*** "; - if (!mac->newline) - fputc('\n', lisp_stderr); - fprintf(lisp_stderr, "%s", "*** Error: "); + if (!lisp__data.destroyed) { + char string[128]; + va_list ap; va_start(ap, fmt); - vfprintf(lisp_stderr, fmt, ap); + vsnprintf(string, sizeof(string), fmt, ap); va_end(ap); - fputc('\n', lisp_stderr); - fflush(lisp_stderr); - - mac->column = 0; - mac->newline = 1; + if (!lisp__data.ignore_errors) { + if (Stderr->column) + LispFputc(Stderr, '\n'); + LispFputs(Stderr, Error); + LispFputs(Stderr, string); + LispFputc(Stderr, '\n'); + LispFflush(Stderr); + } + else + lisp__data.error_condition = STRING(string); - if (mac->debugging) { - LispDebugger(mac, LispDebugCallWatch, NIL, NIL); - LispDebugger(mac, LispDebugCallFatal, NIL, NIL); +#ifdef DEBUGGER + if (lisp__data.debugging) { + LispDebugger(LispDebugCallWatch, NIL, NIL); + LispDebugger(LispDebugCallFatal, NIL, NIL); } +#endif - mac->destroyed = 1; - LispBlockUnwind(mac); - if (mac->errexit) + lisp__data.destroyed = 1; + LispBlockUnwind(NULL); + if (lisp__data.errexit) exit(1); } - if (mac->debugging) { +#ifdef DEBUGGER + if (lisp__data.debugging) { /* when stack variables could be changed, this must be also changed! */ - mac->debug_level = -1; - mac->debug = LispDebugUnspec; + lisp__data.debug_level = -1; + lisp__data.debug = LispDebugUnspec; } - - while (mac->mem.mem_level) - free(mac->mem.mem[--mac->mem.mem_level]); +#endif - /* panic */ - LispTopLevel(mac); - if (mac->st) { - mac->cp = &(mac->st[strlen(mac->st)]); - mac->tok = 0; + while (lisp__data.mem.level) { + --lisp__data.mem.level; + if (lisp__data.mem.mem[lisp__data.mem.level]) + free(lisp__data.mem.mem[lisp__data.mem.level]); } + lisp__data.mem.index = 0; - if (!mac->running) { - fprintf(lisp_stderr, "*** Fatal: nowhere to longjmp.\n"); + /* If the package was changed and an error happened */ + PACKAGE = lisp__data.savepackage; + lisp__data.pack = lisp__data.savepack; + + LispTopLevel(); + + if (!lisp__data.running) { + static char Fatal[] = "*** Fatal: nowhere to longjmp.\n"; + + LispFputs(Stderr, Fatal); + LispFflush(Stderr); abort(); } + + siglongjmp(lisp__data.jmp, 1); +} + +void +LispContinuable(char *fmt, ...) +{ + va_list ap; + char string[128]; + static char Error[] = "*** Error: "; + + if (Stderr->column) + LispFputc(Stderr, '\n'); + LispFputs(Stderr, Error); + va_start(ap, fmt); + vsnprintf(string, sizeof(string), fmt, ap); + va_end(ap); + LispFputs(Stderr, string); + LispFputc(Stderr, '\n'); + LispFputs(Stderr, "Type 'continue' if you want to proceed: "); + LispFflush(Stderr); + + /* NOTE: does not check if stdin is a tty */ + if (LispFgets(Stdin, string, sizeof(string)) && + strcmp(string, "continue\n") == 0) + return; + + LispDestroy("aborted on continuable error"); +} + +void +LispMessage(char *fmt, ...) +{ + va_list ap; + char string[128]; + + if (Stderr->column) + LispFputc(Stderr, '\n'); + va_start(ap, fmt); + vsnprintf(string, sizeof(string), fmt, ap); + va_end(ap); + LispFputs(Stderr, string); + LispFputc(Stderr, '\n'); + LispFflush(Stderr); +} + +void +LispWarning(char *fmt, ...) +{ + va_list ap; + char string[128]; + static char Warning[] = "*** Warning: "; - siglongjmp(mac->jmp, 1); + if (Stderr->column) + LispFputc(Stderr, '\n'); + LispFputs(Stderr, Warning); + va_start(ap, fmt); + vsnprintf(string, sizeof(string), fmt, ap); + va_end(ap); + LispFputs(Stderr, string); + LispFputc(Stderr, '\n'); + LispFflush(Stderr); } void -LispTopLevel(LispMac *mac) +LispTopLevel(void) { - ENV = GLB; - LEX = COD = FRM = NIL; - if (mac->debugging) { + int count; + + COD = NIL; +#ifdef DEBUGGER + if (lisp__data.debugging) { DBG = NIL; - if (mac->debug == LispDebugFinish) - mac->debug = LispDebugUnspec; - mac->debug_level = -1; - mac->debug_step = 0; + if (lisp__data.debug == LispDebugFinish) + lisp__data.debug = LispDebugUnspec; + lisp__data.debug_level = -1; + lisp__data.debug_step = 0; } +#endif gcpro = 0; - mac->block.block_level = 0; - if (mac->block.block_size) { - while (mac->block.block_size) - free(mac->block.block[--mac->block.block_size]); - free(mac->block.block); - mac->block.block = NULL; - } - - mac->destroyed = 0; - mac->princ = mac->justsize = 0; - if (mac->stream.stream_level) { - free(mac->st); - if (mac->stream.stream[mac->stream.stream_level].fp) - fclose(mac->stream.stream[mac->stream.stream_level].fp); - --mac->stream.stream_level; - while (mac->stream.stream_level) { - if (mac->stream.stream[mac->stream.stream_level].fp) - fclose(mac->stream.stream[mac->stream.stream_level].fp); - free(mac->stream.stream[mac->stream.stream_level].st); - --mac->stream.stream_level; - } - mac->fp = mac->stream.stream[0].fp; - mac->st = mac->stream.stream[0].st; - mac->cp = mac->stream.stream[0].cp; - mac->tok = mac->stream.stream[0].tok; - } - if (mac->mem.mem_level) { - fprintf(lisp_stderr, "*** Warning: %d raw memory pointer(s) left. " - "Probably a leak.\n", mac->mem.mem_level); - mac->mem.mem_level = 0; + lisp__data.block.block_level = 0; + if (lisp__data.block.block_size) { + while (lisp__data.block.block_size) + free(lisp__data.block.block[--lisp__data.block.block_size]); + free(lisp__data.block.block); + lisp__data.block.block = NULL; + } + + lisp__data.destroyed = lisp__data.ignore_errors = 0; + + if (CONSP(lisp__data.input_list)) { + LispUngetInfo **info, *unget = lisp__data.unget[0]; + + while (CONSP(lisp__data.input_list)) + lisp__data.input_list = CDR(lisp__data.input_list); + SINPUT = lisp__data.input_list; + while (lisp__data.nunget > 1) + free(lisp__data.unget[--lisp__data.nunget]); + if ((info = realloc(lisp__data.unget, sizeof(LispUngetInfo*))) != NULL) + lisp__data.unget = info; + lisp__data.unget[0] = unget; + lisp__data.iunget = 0; + lisp__data.eof = 0; + } + + for (count = 0; lisp__data.mem.level;) { + --lisp__data.mem.level; + if (lisp__data.mem.mem[lisp__data.mem.level]) { + ++count; +#if 0 + printf("LEAK: %p\n", lisp__data.mem.mem[lisp__data.mem.level]); +#endif + } } + lisp__data.mem.index = 0; + if (count) + LispWarning("%d raw memory pointer(s) left. Probably a leak.", count); + + lisp__data.stack.base = lisp__data.stack.length = + lisp__data.env.lex = lisp__data.env.length = lisp__data.env.head = 0; + RETURN_COUNT = 0; + lisp__data.protect.length = 0; + + lisp__data.savepackage = PACKAGE; + lisp__data.savepack = lisp__data.pack; - fflush(lisp_stdout); - fflush(lisp_stderr); + lisp__disable_int = lisp__interrupted = 0; } void -LispGC(LispMac *mac, LispObj *car, LispObj *cdr) +LispGC(LispObj *car, LispObj *cdr) +{ + Lisp__GC(car, cdr); +} + +static void +Lisp__GC(LispObj *car, LispObj *cdr) { - LispObj *entry; + register LispObj *entry, *last, *freeobj, **pentry, **eentry; + register int nfree; unsigned i, j; - LispAtom *atom, *patom, *natom; -#ifdef DEBUG + LispAtom *atom; struct timeval start, end; +#ifdef DEBUG long sec, msec; - int count = nfree; - int strings_free = 0; + int count = objseg.nfree; +#else + long msec; #endif if (gcpro) return; + DISABLE_INTERRUPTS(); + + nfree = 0; + freeobj = NIL; + + ++lisp__data.gc.count; + #ifdef DEBUG - fprintf(lisp_stderr, "gc: "); gettimeofday(&start, NULL); +#else + if (lisp__data.gc.timebits) + gettimeofday(&start, NULL); #endif + + /* Need to measure timings again to check if it is not better/faster + * to just mark these fields as any other data, as the interface was + * changed to properly handle circular lists in the function body itself. + */ + if (lisp__data.gc.immutablebits) { + for (j = 0; j < objseg.nsegs; j++) { + for (entry = objseg.objects[j], last = entry + segsize; + entry < last; entry++) + entry->prot = 0; + } + } + + /* Protect all packages */ + for (entry = PACK; CONSP(entry); entry = CDR(entry)) { + LispObj *package = CAR(entry); + LispPackage *pack = package->data.package.package; + + /* Protect cons cell */ + entry->mark = 1; + + /* Protect the package cell */ + package->mark = 1; + + /* Protect package name */ + package->data.package.name->mark = 1; + + /* Protect package nicknames */ + LispMark(package->data.package.nicknames); + + /* Protect global symbols */ + for (pentry = pack->glb.pairs, eentry = pentry + pack->glb.length; + pentry < eentry; pentry++) + LispMark((*pentry)->data.atom->property->value); + + /* Traverse atom list, protecting properties, and function/structure + * definitions if lisp__data.gc.immutablebits set */ + for (i = 0; i < STRTBLSZ; i++) { + atom = pack->atoms[i]; + while (atom) { + if (atom->property != NOPROPERTY) { + if (atom->a_property) + LispMark(atom->property->properties); + if (lisp__data.gc.immutablebits) { + if (atom->a_function || atom->a_compiled) + LispProt(atom->property->fun.function); + if (atom->a_defsetf) + LispProt(atom->property->setf); + if (atom->a_defstruct) + LispProt(atom->property->structure.definition); + } + } + atom = atom->next; + } + } + } + + /* protect environment */ + for (pentry = lisp__data.env.values, + eentry = pentry + lisp__data.env.length; + pentry < eentry; pentry++) + LispMark(*pentry); + + /* protect multiple return values */ + for (pentry = lisp__data.returns.values, + eentry = pentry + lisp__data.returns.count; + pentry < eentry; pentry++) + LispMark(*pentry); + + /* protect stack of arguments to builtin functions */ + for (pentry = lisp__data.stack.values, + eentry = pentry + lisp__data.stack.length; + pentry < eentry; pentry++) + LispMark(*pentry); - LispMark(MOD); - LispMark(GLB); - LispMark(ENV); + /* protect temporary data used by builtin functions */ + for (pentry = lisp__data.protect.objects, + eentry = pentry + lisp__data.protect.length; + pentry < eentry; pentry++) + LispMark(*pentry); + + for (i = 0; i < sizeof(x_cons) / sizeof(x_cons[0]); i++) + x_cons[i].mark = 0; + LispMark(COD); - LispMark(FRM); - LispMark(RUN[0]); - LispMark(RUN[1]); - LispMark(RUN[2]); - LispMark(RES[0]); - LispMark(RES[1]); - LispMark(RES[2]); +#ifdef DEBUGGER LispMark(DBG); LispMark(BRK); +#endif LispMark(PRO); + LispMark(lisp__data.input_list); + LispMark(lisp__data.output_list); LispMark(car); LispMark(cdr); - - /* Make all strings candidate to be released */ - for (i = 0; i < STRTBLSZ; i++) { - atom = mac->strs[i]; - while (atom) { - atom->mark = LispNil_t; - if (atom->property) { - if (atom->property->property) - LispMark(atom->property->properties); - if (atom->property->function) - LispMark(atom->property->fun.function); - if (atom->property->defsetf) - LispMark(atom->property->setf); - if (atom->property->defstruct) - LispMark(atom->property->structure.definition); - } - atom = atom->next; - } - } - for (j = 0; j < numseg; j++) - for (i = 0, entry = objseg[j]; i < segsize; i++, entry++) { + for (j = 0; j < objseg.nsegs; j++) { + for (entry = objseg.objects[j], last = entry + segsize; + entry < last; entry++) { if (entry->prot) - entry->dirty = entry->mark = LispTrue_t; + continue; else if (entry->mark) - entry->mark = LispNil_t; - else if (entry->dirty) { - if (entry->type == LispStream_t) { - if (entry->data.stream.size < 0) - fclose(entry->data.stream.source.fp); - else - free(entry->data.stream.source.str); - } - CAR(entry) = NIL; - CDR(entry) = freeobj; - freeobj = entry; - entry->dirty = LispNil_t; - ++nfree; - } - } - - /* Needs a new pass because of the 'prot' field of cells. */ - for (j = 0; j < numseg; j++) - for (i = 0, entry = objseg[j]; i < segsize; i++, entry++) { - if (entry->dirty || entry->mark) { - switch (entry->type) { - case LispAtom_t: + entry->mark = 0; + else { + switch (XOBJECT_TYPE(entry)) { case LispString_t: - entry->data.atom->mark = LispTrue_t; + free(THESTR(entry)); + entry->type = LispCons_t; + break; + case LispStream_t: + switch (entry->data.stream.type) { + case LispStreamString: + free(SSTREAMP(entry)->string); + free(SSTREAMP(entry)); + break; + case LispStreamFile: + if (FSTREAMP(entry)) + LispFclose(FSTREAMP(entry)); + break; + case LispStreamPipe: + /* XXX may need special handling if child hangs */ + if (PSTREAMP(entry)) { + if (IPSTREAMP(entry)) + LispFclose(IPSTREAMP(entry)); + if (OPSTREAMP(entry)) + LispFclose(OPSTREAMP(entry)); + /* don't bother with error stream, will also + * freed in this GC call, maybe just out + * of order */ + if (PIDPSTREAMP(entry) > 0) { + kill(PIDPSTREAMP(entry), SIGTERM); + waitpid(PIDPSTREAMP(entry), NULL, 0); + } + free(PSTREAMP(entry)); + } + break; + default: + break; + } + entry->type = LispCons_t; + break; + case LispBignum_t: + mpi_clear(entry->data.mp.integer); + free(entry->data.mp.integer); + entry->type = LispCons_t; + break; + case LispBigratio_t: + mpr_clear(entry->data.mp.ratio); + free(entry->data.mp.ratio); + entry->type = LispCons_t; + break; + case LispLambda_t: + if (!SYMBOLP(entry->data.lambda.name)) + LispFreeArgList((LispArgList*) + entry->data.lambda.name->data.opaque.data); + entry->type = LispCons_t; + break; + case LispRegex_t: + refree(entry->data.regex.regex); + free(entry->data.regex.regex); + entry->type = LispCons_t; + break; + case LispBytecode_t: + free(entry->data.bytecode.bytecode->code); + free(entry->data.bytecode.bytecode); + entry->type = LispCons_t; + break; + case LispHashTable_t: + LispFreeHashTable(entry->data.hash.table); + entry->type = LispCons_t; break; + case LispCons_t: + break; default: + entry->type = LispCons_t; break; } + CDR(entry) = freeobj; + freeobj = entry; + ++nfree; } } - - /* Free unused strings */ - for (i = 0; i < STRTBLSZ; i++) { - patom = atom = mac->strs[i]; - while (atom) { - natom = atom->next; - if (!atom->property && - !atom->prot && atom->mark == LispNil_t) { - /* it is not required to call LispFree here */ - if (!atom->prot) - free(atom->string); - free(atom); - if (patom == atom) - patom = mac->strs[i] = natom; - else - patom->next = natom; -#ifdef DEBUG - ++strings_free; -#endif - } - else - patom = atom; - atom = natom; - } } + objseg.nfree = nfree; + objseg.freeobj = freeobj; + + lisp__data.gc.immutablebits = 0; + #ifdef DEBUG gettimeofday(&end, NULL); sec = end.tv_sec - start.tv_sec; @@ -590,97 +1094,153 @@ if (msec < 0) { --sec; msec += 1000000; + } + LispMessage("gc: " + "%ld sec, %ld msec, " + "%d recovered, %d free, %d protected, %d total", + sec, msec, + objseg.nfree - count, objseg.nfree, + objseg.nobjs - objseg.nfree, objseg.nobjs); +#else + if (lisp__data.gc.timebits) { + gettimeofday(&end, NULL); + if ((msec = end.tv_usec - start.tv_usec) < 0) + msec += 1000000; + lisp__data.gc.gctime += msec; } - fprintf(lisp_stderr, "%ld sec, %ld msec, ", sec, msec); - fprintf(lisp_stderr, "%d recovered, %d free, %d protected, %d total\n", nfree - count, nfree, nobjs - nfree, nobjs); - fprintf(lisp_stderr, "%d string(s) freed\n", strings_free); #endif + + ENABLE_INTERRUPTS(); } -void -LispCheckMemLevel(LispMac *mac) +static INLINE void +LispCheckMemLevel(void) { - if (mac->mem.mem_level + 1 >= mac->mem.mem_size) { - void **ptr = (void**)realloc(mac->mem.mem, - (mac->mem.mem_size + 16) * sizeof(void*)); + int i; + + /* Check for a free slot before the end. */ + for (i = lisp__data.mem.index; i < lisp__data.mem.level; i++) + if (lisp__data.mem.mem[i] == NULL) { + lisp__data.mem.index = i; + return; + } + + /* Check for a free slot in the beginning */ + for (i = 0; i < lisp__data.mem.index; i++) + if (lisp__data.mem.mem[i] == NULL) { + lisp__data.mem.index = i; + return; + } + + lisp__data.mem.index = lisp__data.mem.level; + ++lisp__data.mem.level; + if (lisp__data.mem.index < lisp__data.mem.space) + /* There is free space to store pointer. */ + return; + else { + void **ptr = (void**)realloc(lisp__data.mem.mem, + (lisp__data.mem.space + 16) * + sizeof(void*)); if (ptr == NULL) - LispDestroy(mac, "out of memory"); - mac->mem.mem = ptr; - mac->mem.mem_size += 16; + LispDestroy("out of memory"); + lisp__data.mem.mem = ptr; + lisp__data.mem.space += 16; } } void -LispMused(LispMac *mac, void *pointer) +LispMused(void *pointer) { int i; + + DISABLE_INTERRUPTS(); + for (i = lisp__data.mem.index; i >= 0; i--) + if (lisp__data.mem.mem[i] == pointer) { + lisp__data.mem.mem[i] = NULL; + lisp__data.mem.index = i; + goto mused_done; + } - for (i = 0; i < mac->mem.mem_level; i++) - if (mac->mem.mem[i] == pointer) { - --mac->mem.mem_level; - if (mac->mem.mem_level > i) - memmove(mac->mem.mem + i, mac->mem.mem + i + 1, - sizeof(void*) * (mac->mem.mem_level - i)); + for (i = lisp__data.mem.level - 1; i > lisp__data.mem.index; i--) + if (lisp__data.mem.mem[i] == pointer) { + lisp__data.mem.mem[i] = NULL; + lisp__data.mem.index = i; break; } + +mused_done: + ENABLE_INTERRUPTS(); } void * -LispMalloc(LispMac *mac, unsigned size) +LispMalloc(size_t size) { void *pointer; - LispCheckMemLevel(mac); + DISABLE_INTERRUPTS(); + LispCheckMemLevel(); if ((pointer = malloc(size)) == NULL) - LispDestroy(mac, "out of memory, couldn't allocate %u bytes", size); + LispDestroy("out of memory, couldn't allocate %lu bytes", + (unsigned long)size); - mac->mem.mem[mac->mem.mem_level++] = pointer; + lisp__data.mem.mem[lisp__data.mem.index] = pointer; + ENABLE_INTERRUPTS(); return (pointer); } void * -LispCalloc(LispMac *mac, unsigned nmemb, unsigned size) +LispCalloc(size_t nmemb, size_t size) { void *pointer; - LispCheckMemLevel(mac); + DISABLE_INTERRUPTS(); + LispCheckMemLevel(); if ((pointer = calloc(nmemb, size)) == NULL) - LispDestroy(mac, "out of memory, couldn't allocate %u bytes", size); + LispDestroy("out of memory, couldn't allocate %lu bytes", + (unsigned long)size); - mac->mem.mem[mac->mem.mem_level++] = pointer; + lisp__data.mem.mem[lisp__data.mem.index] = pointer; + ENABLE_INTERRUPTS(); return (pointer); } void * -LispRealloc(LispMac *mac, void *pointer, unsigned size) +LispRealloc(void *pointer, size_t size) { void *ptr; int i; - for (i = 0; i < mac->mem.mem_level; i++) - if (mac->mem.mem[i] == pointer) - break; - if (i == mac->mem.mem_level) - LispCheckMemLevel(mac); + DISABLE_INTERRUPTS(); + if (pointer != NULL) { + for (i = lisp__data.mem.index; i >= 0; i--) + if (lisp__data.mem.mem[i] == pointer) + goto index_found; + + for (i = lisp__data.mem.index + 1; i < lisp__data.mem.level; i++) + if (lisp__data.mem.mem[i] == pointer) + goto index_found; + + } + LispCheckMemLevel(); + i = lisp__data.mem.index; +index_found: if ((ptr = realloc(pointer, size)) == NULL) - LispDestroy(mac, "out of memory, couldn't realloc"); + LispDestroy("out of memory, couldn't realloc"); - if (i == mac->mem.mem_level) - mac->mem.mem[mac->mem.mem_level++] = ptr; - else - mac->mem.mem[i] = ptr; + lisp__data.mem.mem[i] = ptr; + ENABLE_INTERRUPTS(); return (ptr); } char * -LispStrdup(LispMac *mac, char *str) +LispStrdup(char *str) { - char *ptr = LispMalloc(mac, strlen(str) + 1); + char *ptr = LispMalloc(strlen(str) + 1); strcpy(ptr, str); @@ -688,461 +1248,1340 @@ } void -LispFree(LispMac *mac, void *pointer) +LispFree(void *pointer) { int i; - for (i = 0; i < mac->mem.mem_level; i++) - if (mac->mem.mem[i] == pointer) - break; + DISABLE_INTERRUPTS(); + for (i = lisp__data.mem.index; i >= 0; i--) + if (lisp__data.mem.mem[i] == pointer) { + lisp__data.mem.mem[i] = NULL; + lisp__data.mem.index = i; + goto free_done; + } - /* If the memory was allocated on a previous form, just free it */ - if (i < mac->mem.mem_level) { - memmove(mac->mem.mem + i, mac->mem.mem + i + 1, - sizeof(void*) * (mac->mem.mem_level - i - 1)); - --mac->mem.mem_level; - } + for (i = lisp__data.mem.level - 1; i > lisp__data.mem.index; i--) + if (lisp__data.mem.mem[i] == pointer) { + lisp__data.mem.mem[i] = NULL; + lisp__data.mem.index = i; + break; + } +free_done: free(pointer); + ENABLE_INTERRUPTS(); } LispObj * -LispSetVariable(LispMac *mac, LispObj *var, LispObj *val, char *fname, int eval) +LispSetVariable(LispObj *var, LispObj *val, char *fname, int eval) { - return (_LispSet(mac, var, val, fname, eval)); + if (!SYMBOLP(var)) + LispDestroy("%s: %s is not a symbol", fname, STROBJ(var)); + if (eval) + val = EVAL(val); + + return (LispSetVar(var, val)); } int -LispRegisterOpaqueType(LispMac *mac, char *desc) +LispRegisterOpaqueType(char *desc) { LispOpaque *opaque; - int ii = 0; - char *pp = desc; + int ii = STRHASH(desc); - while (*pp) - ii = (ii << 1) ^ *pp++; - if (ii < 0) - ii = -ii; - ii %= STRTBLSZ; - for (opaque = mac->opqs[ii]; opaque; opaque = opaque->next) + for (opaque = lisp__data.opqs[ii]; opaque; opaque = opaque->next) if (strcmp(opaque->desc, desc) == 0) return (opaque->type); - opaque = (LispOpaque*)LispMalloc(mac, sizeof(LispOpaque)); - opaque->desc = LispDoGetAtom(mac, desc, 1, 0)->string; - opaque->next = mac->opqs[ii]; - mac->opqs[ii] = opaque; - LispMused(mac, opaque); + opaque = (LispOpaque*)LispMalloc(sizeof(LispOpaque)); + opaque->desc = LispStrdup(desc); + opaque->next = lisp__data.opqs[ii]; + lisp__data.opqs[ii] = opaque; + LispMused(opaque->desc); + LispMused(opaque); - return (opaque->type = ++mac->opaque); + return (opaque->type = ++lisp__data.opaque); } -static char * -LispIntToOpaqueType(LispMac *mac, int type) +char * +LispIntToOpaqueType(int type) { int i; LispOpaque *opaque; if (type) { for (i = 0; i < STRTBLSZ; i++) { - opaque = mac->opqs[i]; + opaque = lisp__data.opqs[i]; while (opaque) { if (opaque->type == type) return (opaque->desc); opaque = opaque->next; } } - LispDestroy(mac, "Opaque type %d not registered", type); + LispDestroy("Opaque type %d not registered", type); } - return ("NIL"); + return (Snil); } -LispAtom * -LispDoGetAtom(LispMac *mac, char *str, int prot, int perm) +int +LispDoHashString(char *string) { - LispAtom *atom; - int ii = 0; - char *pp = str; + char *pp; + int ii, count; - while (*pp) - ii = (ii << 1) ^ *pp++; + for (pp = string, ii = count = 0; *pp && count < 32; pp++, count++) + ii = (ii << 1) ^ *pp; if (ii < 0) ii = -ii; - ii %= STRTBLSZ; - for (atom = mac->strs[ii]; atom; atom = atom->next) - if (strcmp(atom->string, str) == 0) { - if (prot && !atom->prot) - atom->prot = 1; - return (atom); - } - atom = (LispAtom*)LispMalloc(mac, sizeof(LispAtom)); + + return (ii % STRTBLSZ); +} + +char * +LispGetAtomString(char *string, int perm) +{ + LispStringHash *entry; + int ii = STRHASH(string); + + for (entry = lisp__data.strings[ii]; entry != NULL; entry = entry->next) + if (strcmp(entry->string, string) == 0) + return (entry->string); + + entry = (LispStringHash*)LispCalloc(1, sizeof(LispStringHash)); if (perm) - atom->string = str; + entry->string = string; else - atom->string = LispStrdup(mac, str); - LispMused(mac, atom); + entry->string = LispStrdup(string); + LispMused(entry); if (!perm) - LispMused(mac, atom->string); - atom->property = NULL; - atom->next = mac->strs[ii]; - mac->strs[ii] = atom; - atom->dirty = 1; - atom->mark = 0; - atom->prot = !!prot; + LispMused(entry->string); + entry->next = lisp__data.strings[ii]; + lisp__data.strings[ii] = entry; + + return (entry->string); +} + +LispAtom * +LispDoGetAtom(char *str, int perm) +{ + LispAtom *atom; + int ii = STRHASH(str); + + for (atom = lisp__data.pack->atoms[ii]; atom; atom = atom->next) + if (strcmp(atom->string, str) == 0) + return (atom); + + atom = (LispAtom*)LispCalloc(1, sizeof(LispAtom)); + atom->string = LispGetAtomString(str, perm); + LispMused(atom); + atom->next = lisp__data.pack->atoms[ii]; + lisp__data.pack->atoms[ii] = atom; + atom->property = NOPROPERTY; return (atom); } -static LispProperty * -LispAllocAtomProperty(LispMac *mac) +static void +LispAllocAtomProperty(LispAtom *atom) { - LispProperty *prop = LispCalloc(mac, 1, sizeof(LispProperty)); + LispProperty *property; + + if (atom->property != NOPROPERTY) + LispDestroy("internal error at ALLOC-ATOM-PROPERTY"); + + property = LispCalloc(1, sizeof(LispProperty)); + LispMused(property); + atom->property = property; + property->package = lisp__data.pack; + if (atom->package == NULL) + atom->package = PACKAGE; + + LispIncrementAtomReference(atom); +} - return (prop); +static void +LispIncrementAtomReference(LispAtom *atom) +{ + if (atom->property != NOPROPERTY) + /* if atom->property is NOPROPERTY, this is an unbound symbol */ + ++atom->property->refcount; } +/* Assumes atom property is not NOPROPERTY */ static void -LispCheckAtomProperty(LispMac *mac, LispAtom *atom) +LispDecrementAtomReference(LispAtom *atom) { - if (atom->property) { - LispProperty *prop = atom->property; + if (atom->property == NOPROPERTY) + /* if atom->property is NOPROPERTY, this is an unbound symbol */ + return; - if (prop->object && prop->value == NULL) - prop->object = 0; - if ((prop->function || prop->builtin) && prop->fun.function == NULL) - prop->function = prop->builtin = 0; - if (prop->property && prop->properties == NULL) - prop->property = 0; - if (prop->defsetf && prop->setf == NULL) - prop->defsetf = 0; - if (prop->defstruct && prop->structure.definition == NULL) - prop->defstruct = 0; + --atom->property->refcount; + + if (atom->property->refcount < 0) + LispDestroy("internal error at DECREMENT-ATOM-REFERENCE"); + + if (atom->property->refcount == 0) { + LispRemAtomAllProperties(atom); + free(atom->property); + atom->property = NOPROPERTY; + } +} - if (prop->object == 0 && prop->function == 0 && prop->builtin == 0 && - prop->properties == 0 && prop->defsetf == 0 && - prop->defstruct == 0) { - LispFree(mac, atom->property); - atom->property = NULL; +static void +LispRemAtomAllProperties(LispAtom *atom) +{ + if (atom->property != NOPROPERTY) { + if (atom->a_object) + LispRemAtomObjectProperty(atom); + if (atom->a_function) { + lisp__data.gc.immutablebits = 1; + LispRemAtomFunctionProperty(atom); + } + else if (atom->a_compiled) { + lisp__data.gc.immutablebits = 1; + LispRemAtomCompiledProperty(atom); + } + else if (atom->a_builtin) { + lisp__data.gc.immutablebits = 1; + LispRemAtomBuiltinProperty(atom); + } + if (atom->a_defsetf) { + lisp__data.gc.immutablebits = 1; + LispRemAtomSetfProperty(atom); + } + if (atom->a_defstruct) { + lisp__data.gc.immutablebits = 1; + LispRemAtomStructProperty(atom); } } } void -LispSetAtomObjectProperty(LispMac *mac, LispAtom *atom, LispObj *object) +LispSetAtomObjectProperty(LispAtom *atom, LispObj *object) { - LispProperty *prop = atom->property; - - if (prop == NULL) - prop = LispAllocAtomProperty(mac); + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); + else if (atom->watch) { + if (atom->object == lisp__data.package) { + if (!PACKAGEP(object)) + LispDestroy("Symbol %s must be a package, not %s", + ATOMID(lisp__data.package), STROBJ(object)); + lisp__data.pack = object->data.package.package; + } + } - prop->object = 1; - prop->value = object; + atom->a_object = 1; + SETVALUE(atom, object); +} - if (atom->property == NULL) { - LispMused(mac, prop); - atom->property = prop; +static void +LispRemAtomObjectProperty(LispAtom *atom) +{ + if (atom->a_object) { + atom->a_object = 0; + atom->property->value = NULL; } } void -LispRemAtomObjectProperty(LispMac *mac, LispAtom *atom) +LispSetAtomCompiledProperty(LispAtom *atom, LispObj *bytecode) { - if (atom->property && atom->property->value) { - atom->property->value = NULL; - LispCheckAtomProperty(mac, atom); + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); + + lisp__data.gc.immutablebits = 1; + if (atom->a_builtin) { + atom->a_builtin = 0; + LispFreeArgList(atom->property->alist); } else - LispDestroy(mac, "internal error at INTERNAL:REMOVE-OBJECT-PROPERTY"); + atom->a_function = 0; + atom->a_compiled = 1; + atom->property->fun.function = bytecode; } void -LispSetAtomFunctionProperty(LispMac *mac, LispAtom *atom, LispObj *function) +LispRemAtomCompiledProperty(LispAtom *atom) { - if (atom->property == NULL) { - atom->property = LispAllocAtomProperty(mac); - LispMused(mac, atom->property); + if (atom->a_compiled) { + lisp__data.gc.immutablebits = 1; + atom->property->fun.function = NULL; + atom->a_compiled = 0; + LispFreeArgList(atom->property->alist); + atom->property->alist = NULL; } +} - if (atom->property->fun.function == NULL) - atom->property->function = 1; - else - atom->property->builtin = 0; /* just make sure it is unset */ +void +LispSetAtomFunctionProperty(LispAtom *atom, LispObj *function, + LispArgList *alist) +{ + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); + lisp__data.gc.immutablebits = 1; + if (atom->a_function == 0 && atom->a_builtin == 0 && atom->a_compiled == 0) + atom->a_function = 1; + else { + if (atom->a_builtin) { + atom->a_builtin = 0; + LispFreeArgList(atom->property->alist); + } + else + atom->a_compiled = 0; + atom->a_function = 1; + } + atom->property->fun.function = function; + atom->property->alist = alist; } void -LispRemAtomFunctionProperty(LispMac *mac, LispAtom *atom) +LispRemAtomFunctionProperty(LispAtom *atom) { - if (atom->property && atom->property->fun.function) { + if (atom->a_function) { + lisp__data.gc.immutablebits = 1; atom->property->fun.function = NULL; - LispCheckAtomProperty(mac, atom); + atom->a_function = 0; + LispFreeArgList(atom->property->alist); + atom->property->alist = NULL; } - else - LispDestroy(mac, "internal error at INTERNAL:REMOVE-FUNCTION-PROPERTY"); } void -LispSetAtomBuiltinProperty(LispMac *mac, LispAtom *atom, LispBuiltin *builtin) +LispSetAtomBuiltinProperty(LispAtom *atom, LispBuiltin *builtin, + LispArgList *alist) { - if (atom->property == NULL) { - atom->property = LispAllocAtomProperty(mac); - LispMused(mac, atom->property); - } + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); - if (atom->property->fun.function == NULL) - atom->property->builtin = 1; - else - atom->property->function = 0; /* just make sure it is unset */ + lisp__data.gc.immutablebits = 1; + if (atom->a_builtin == 0 && atom->a_function == 0) + atom->a_builtin = 1; + else { + if (atom->a_function) { + atom->a_function = 0; + LispFreeArgList(atom->property->alist); + } + } atom->property->fun.builtin = builtin; + atom->property->alist = alist; } void -LispRemAtomBuiltinProperty(LispMac *mac, LispAtom *atom) +LispRemAtomBuiltinProperty(LispAtom *atom) { - if (atom->property && atom->property->fun.builtin) { + if (atom->a_builtin) { + lisp__data.gc.immutablebits = 1; atom->property->fun.function = NULL; - LispCheckAtomProperty(mac, atom); + atom->a_builtin = 0; + LispFreeArgList(atom->property->alist); + atom->property->alist = NULL; } - else - LispDestroy(mac, "internal error at INTERNAL:REMOVE-BUILTIN-PROPERTY"); } void -LispSetAtomSetfProperty(LispMac *mac, LispAtom *atom, LispObj *setf) +LispSetAtomSetfProperty(LispAtom *atom, LispObj *setf, LispArgList *alist) { - LispProperty *prop = atom->property; + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); - if (prop == NULL) - prop = LispAllocAtomProperty(mac); - - prop->defsetf = 1; - prop->setf = setf; - - if (atom->property == NULL) { - LispMused(mac, prop); - atom->property = prop; - } + lisp__data.gc.immutablebits = 1; + if (atom->a_defsetf) + LispFreeArgList(atom->property->salist); + + atom->a_defsetf = 1; + atom->property->setf = setf; + atom->property->salist = alist; } void -LispRemAtomSetfProperty(LispMac *mac, LispAtom *atom) +LispRemAtomSetfProperty(LispAtom *atom) { - if (atom->property && atom->property->setf) { + if (atom->a_defsetf) { + lisp__data.gc.immutablebits = 1; atom->property->setf = NULL; - LispCheckAtomProperty(mac, atom); + atom->a_defsetf = 0; + LispFreeArgList(atom->property->salist); + atom->property->salist = NULL; } - else - LispDestroy(mac, "internal error at INTERNAL:REMOVE-SETF-PROPERTY"); } void -LispSetAtomStructProperty(LispMac *mac, LispAtom *atom, LispObj *def, int fun) +LispSetAtomStructProperty(LispAtom *atom, LispObj *def, int fun) { - LispProperty *prop = atom->property; - - if (prop == NULL) - prop = LispAllocAtomProperty(mac); - - prop->defstruct = 1; - prop->structure.definition = def; - prop->structure.function = fun; - - if (atom->property == NULL) { - LispMused(mac, prop); - atom->property = prop; - } + if (fun > 0xff) + /* Not suported by the bytecode compiler... */ + LispDestroy("SET-ATOM-STRUCT-PROPERTY: " + "more than 256 fields not supported"); + + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); + + lisp__data.gc.immutablebits = 1; + atom->a_defstruct = 1; + atom->property->structure.definition = def; + atom->property->structure.function = fun; } void -LispRemAtomStructProperty(LispMac *mac, LispAtom *atom) +LispRemAtomStructProperty(LispAtom *atom) { - if (atom->property && atom->property->defstruct) { + if (atom->a_defstruct) { + lisp__data.gc.immutablebits = 1; atom->property->structure.definition = NULL; - LispCheckAtomProperty(mac, atom); + atom->a_defstruct = 0; } - else - LispDestroy(mac, "internal error at INTERNAL:REMOVE-STRUCTURE-PROPERTY"); } -char * -LispGetString(LispMac *mac, char *str) +LispAtom * +LispGetAtom(char *str) { - return (LispDoGetAtom(mac, str, 0, 0)->string); + return (LispDoGetAtom(str, 0)); } -char * -LispGetPermString(LispMac *mac, char *str) +LispAtom * +LispGetPermAtom(char *str) { - return (LispDoGetAtom(mac, str, 1, 1)->string); + return (LispDoGetAtom(str, 1)); } +#define GET_PROPERTY 0 +#define ADD_PROPERTY 1 +#define REM_PROPERTY 2 static LispObj * -LispDoGetAtomProperty(LispMac *mac, LispAtom *atom, LispObj *key, int add) +LispAtomPropertyFunction(LispAtom *atom, LispObj *key, int function) { - LispObj *obj, *res = NULL; - LispProperty *prop = atom->property; - - if (prop == NULL && add) - prop = LispAllocAtomProperty(mac); + LispObj *list = NIL, *result = NIL; - if (add && prop->properties == NULL) { - prop->property = 1; - prop->properties = NIL; + if (function == ADD_PROPERTY) { + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); + if (atom->property->properties == NULL) { + atom->a_property = 1; + atom->property->properties = NIL; + } } + + if (atom->a_property) { + LispObj *base; - if (prop && prop->property) { - for (obj = prop->properties; obj != NIL; obj = CDR(CDR(obj))) { - if (_LispEqual(mac, key, CAR(obj)) == T) { - res = CDR(obj); + for (base = list = atom->property->properties; + CONSP(list); + list = CDR(list)) { + if (key == CAR(list)) { + result = CDR(list); break; } + base = list; + list = CDR(list); + if (!CONSP(list)) + LispDestroy("%s: %s has an odd property list length", + STROBJ(atom->object), + function == REM_PROPERTY ? "REMPROP" : "GET"); + } + if (CONSP(list) && function == REM_PROPERTY) { + if (!CONSP(CDR(list))) + LispDestroy("REMPROP: %s has an odd property list length", + STROBJ(atom->object)); + if (base == list) + atom->property->properties = CDDR(list); + else + RPLACD(CDR(base), CDDR(list)); } } - else - obj = NIL; - if (obj == NIL) { - if (add) { - prop->properties = CONS(key, CONS(NIL, prop->properties)); - res = CDR(prop->properties); + if (!CONSP(list)) { + if (function == ADD_PROPERTY) { + atom->property->properties = + CONS(key, CONS(NIL, atom->property->properties)); + result = CDR(atom->property->properties); } - else - res = NIL; } + else if (function == REM_PROPERTY) + result = T; - if (atom->property == NULL && add) { - LispMused(mac, prop); - atom->property = prop; - } + return (result); +} - return (res); +LispObj * +LispGetAtomProperty(LispAtom *atom, LispObj *key) +{ + return (LispAtomPropertyFunction(atom, key, GET_PROPERTY)); +} + +LispObj * +LispPutAtomProperty(LispAtom *atom, LispObj *key, LispObj *value) +{ + LispObj *result = LispAtomPropertyFunction(atom, key, ADD_PROPERTY); + + RPLACA(result, value); + + return (result); } LispObj * -LispGetAtomProperty(LispMac *mac, LispAtom *atom, LispObj *key) +LispRemAtomProperty(LispAtom *atom, LispObj *key) { - return (LispDoGetAtomProperty(mac, atom, key, 0)); + return (LispAtomPropertyFunction(atom, key, REM_PROPERTY)); } LispObj * -LispPutAtomProperty(LispMac *mac, LispAtom *atom, LispObj *key, LispObj *val) +LispReplaceAtomPropertyList(LispAtom *atom, LispObj *list) { - LispObj *res = LispDoGetAtomProperty(mac, atom, key, 1); + if (atom->property == NOPROPERTY) + LispAllocAtomProperty(atom); + if (atom->property->properties == NULL) + atom->a_property = 1; + atom->property->properties = list; + + return (list); +} +#undef GET_PROPERTY +#undef ADD_PROPERTY +#undef REM_PROPERTY - CAR(res) = val; - return (res); +/* Used to make sure that when defining a function like: + * (defun my-function (... &key key1 key2 key3 ...) + * key1, key2, and key3 will be in the keyword package + */ +static LispObj * +LispCheckKeyword(LispObj *keyword) +{ + if (KEYWORDP(keyword)) + return (keyword); + + return (KEYWORD(ATOMID(keyword))); +} + +void +LispUseArgList(LispArgList *alist) +{ + if (alist->normals.num_symbols) + LispMused(alist->normals.symbols); + if (alist->optionals.num_symbols) { + LispMused(alist->optionals.symbols); + LispMused(alist->optionals.defaults); + LispMused(alist->optionals.sforms); + } + if (alist->keys.num_symbols) { + LispMused(alist->keys.symbols); + LispMused(alist->keys.defaults); + LispMused(alist->keys.sforms); + LispMused(alist->keys.keys); + } + if (alist->auxs.num_symbols) { + LispMused(alist->auxs.symbols); + LispMused(alist->auxs.initials); + } + LispMused(alist); +} + +void +LispFreeArgList(LispArgList *alist) +{ + if (alist->normals.num_symbols) + LispFree(alist->normals.symbols); + if (alist->optionals.num_symbols) { + LispFree(alist->optionals.symbols); + LispFree(alist->optionals.defaults); + LispFree(alist->optionals.sforms); + } + if (alist->keys.num_symbols) { + LispFree(alist->keys.symbols); + LispFree(alist->keys.defaults); + LispFree(alist->keys.sforms); + LispFree(alist->keys.keys); + } + if (alist->auxs.num_symbols) { + LispFree(alist->auxs.symbols); + LispFree(alist->auxs.initials); + } + LispFree(alist); +} + +static LispObj * +LispCheckNeedProtect(LispObj *object) +{ + if (object) { + switch (OBJECT_TYPE(object)) { + case LispNil_t: + case LispAtom_t: + case LispFunction_t: + case LispFixnum_t: + case LispSChar_t: + return (NULL); + default: + return (object); + } + } + return (NULL); +} + +LispObj * +LispListProtectedArguments(LispArgList *alist) +{ + int i; + GC_ENTER(); + LispObj *arguments, *cons, *obj, *prev; + + arguments = cons = prev = NIL; + for (i = 0; i < alist->optionals.num_symbols; i++) { + if ((obj = LispCheckNeedProtect(alist->optionals.defaults[i])) != NULL) { + if (arguments == NIL) { + arguments = cons = prev = CONS(obj, NIL); + GC_PROTECT(arguments); + } + else { + RPLACD(cons, CONS(obj, NIL)); + prev = cons; + cons = CDR(cons); + } + } + } + for (i = 0; i < alist->keys.num_symbols; i++) { + if ((obj = LispCheckNeedProtect(alist->keys.defaults[i])) != NULL) { + if (arguments == NIL) { + arguments = cons = prev = CONS(obj, NIL); + GC_PROTECT(arguments); + } + else { + RPLACD(cons, CONS(obj, NIL)); + prev = cons; + cons = CDR(cons); + } + } + } + for (i = 0; i < alist->auxs.num_symbols; i++) { + if ((obj = LispCheckNeedProtect(alist->auxs.initials[i])) != NULL) { + if (arguments == NIL) { + arguments = cons = prev = CONS(obj, NIL); + GC_PROTECT(arguments); + } + else { + RPLACD(cons, CONS(obj, NIL)); + prev = cons; + cons = CDR(cons); + } + } + } + GC_LEAVE(); + + /* Don't add a NIL cell at the end, to save some space */ + if (arguments != NIL) { + if (arguments == cons) + arguments = CAR(cons); + else + CDR(prev) = CAR(cons); + } + + return (arguments); +} + +LispArgList * +LispCheckArguments(LispFunType type, LispObj *list, char *name, int builtin) +{ + static char *types[4] = {"LAMBDA-LIST", "FUNCTION", "MACRO", "SETF-METHOD"}; + static char *fnames[4] = {"LAMBDA", "DEFUN", "DEFMACRO", "DEFSETF"}; +#define IKEY 0 +#define IOPTIONAL 1 +#define IREST 2 +#define IAUX 3 + static char *keys[4] = {"&KEY", "&OPTIONAL", "&REST", "&AUX"}; + int rest, optional, key, aux, count; + LispArgList *alist; + LispObj *spec, *sform, *defval, *default_value; + char description[8], *desc; + +/* If LispRealloc fails, the previous memory will be released + * in LispTopLevel, unless LispMused was called on the pointer */ +#define REALLOC_OBJECTS(pointer, count) \ + pointer = LispRealloc(pointer, (count) * sizeof(LispObj*)) + + alist = LispCalloc(1, sizeof(LispArgList)); + if (!CONSP(list)) { + if (list != NIL) + LispDestroy("%s %s: %s cannot be a %s argument list", + fnames[type], name, STROBJ(list), types[type]); + alist->description = GETATOMID(""); + + return (alist); + } + + default_value = builtin ? UNSPEC : NIL; + + description[0] = '\0'; + desc = description; + rest = optional = key = aux = 0; + for (; CONSP(list); list = CDR(list)) { + spec = CAR(list); + + if (CONSP(spec)) { + if (builtin) + LispDestroy("builtin function argument cannot have default value"); + if (aux) { + if (!SYMBOLP(CAR(spec)) || + (CDR(spec) != NIL && CDDR(spec) != NIL)) + LispDestroy("%s %s: bad &AUX argument %s", + fnames[type], name, STROBJ(spec)); + defval = CDR(spec) != NIL ? CADR(spec) : NIL; + count = alist->auxs.num_symbols; + REALLOC_OBJECTS(alist->auxs.symbols, count + 1); + REALLOC_OBJECTS(alist->auxs.initials, count + 1); + alist->auxs.symbols[count] = CAR(spec); + alist->auxs.initials[count] = defval; + ++alist->auxs.num_symbols; + if (count == 0) + *desc++ = 'a'; + ++alist->num_arguments; + } + else if (rest) + LispDestroy("%s %s: syntax error parsing %s", + fnames[type], name, keys[IREST]); + else if (key) { + LispObj *akey = CAR(spec); + + defval = default_value; + sform = NULL; + if (CONSP(akey)) { + /* check for special case, as in: + * (defun a (&key ((key name) 'default-value)) name) + * (a 'key 'test) => TEST + * (a) => DEFAULT-VALUE + */ + if (!SYMBOLP(CAR(akey)) || !CONSP(CDR(akey)) || + !SYMBOLP(CADR(akey)) || CDDR(akey) != NIL || + (CDR(spec) != NIL && CDDR(spec) != NIL)) + LispDestroy("%s %s: bad special &KEY %s", + fnames[type], name, STROBJ(spec)); + if (CDR(spec) != NIL) + defval = CADR(spec); + spec = CADR(akey); + akey = CAR(akey); + } + else { + akey = NULL; + + if (!SYMBOLP(CAR(spec))) + LispDestroy("%s %s: %s cannot be a %s argument name", + fnames[type], name, + STROBJ(CAR(spec)), types[type]); + /* check if default value provided, and optionally a `svar' */ + else if (CDR(spec) != NIL && (!CONSP(CDR(spec)) || + (CDDR(spec) != NIL && + (!SYMBOLP(CAR(CDDR(spec))) || + CDR(CDDR(spec)) != NIL)))) + LispDestroy("%s %s: bad argument specification %s", + fnames[type], name, STROBJ(spec)); + if (CONSP(CDR(spec))) { + defval = CADR(spec); + if (CONSP(CDDR(spec))) + sform = CAR(CDDR(spec)); + } + /* Add to keyword package, and set the keyword in the + * argument list, so that a function argument keyword + * will reference the same object, and make comparison + * simpler. */ + spec = LispCheckKeyword(CAR(spec)); + } + + count = alist->keys.num_symbols; + REALLOC_OBJECTS(alist->keys.keys, count + 1); + REALLOC_OBJECTS(alist->keys.defaults, count + 1); + REALLOC_OBJECTS(alist->keys.sforms, count + 1); + REALLOC_OBJECTS(alist->keys.symbols, count + 1); + alist->keys.symbols[count] = spec; + alist->keys.defaults[count] = defval; + alist->keys.sforms[count] = sform; + alist->keys.keys[count] = akey; + ++alist->keys.num_symbols; + if (count == 0) + *desc++ = 'k'; + alist->num_arguments += 1 + (sform != NULL); + } + else if (optional) { + defval = default_value; + sform = NULL; + + if (!SYMBOLP(CAR(spec))) + LispDestroy("%s %s: %s cannot be a %s argument name", + fnames[type], name, + STROBJ(CAR(spec)), types[type]); + /* check if default value provided, and optionally a `svar' */ + else if (CDR(spec) != NIL && (!CONSP(CDR(spec)) || + (CDDR(spec) != NIL && + (!SYMBOLP(CAR(CDDR(spec))) || + CDR(CDDR(spec)) != NIL)))) + LispDestroy("%s %s: bad argument specification %s", + fnames[type], name, STROBJ(spec)); + if (CONSP(CDR(spec))) { + defval = CADR(spec); + if (CONSP(CDDR(spec))) + sform = CAR(CDDR(spec)); + } + spec = CAR(spec); + + count = alist->optionals.num_symbols; + REALLOC_OBJECTS(alist->optionals.symbols, count + 1); + REALLOC_OBJECTS(alist->optionals.defaults, count + 1); + REALLOC_OBJECTS(alist->optionals.sforms, count + 1); + alist->optionals.symbols[count] = spec; + alist->optionals.defaults[count] = defval; + alist->optionals.sforms[count] = sform; + ++alist->optionals.num_symbols; + if (count == 0) + *desc++ = 'o'; + alist->num_arguments += 1 + (sform != NULL); + } + + /* Normal arguments cannot have default value */ + else + LispDestroy("%s %s: syntax error parsing %s", + fnames[type], name, STROBJ(spec)); + } + + /* spec must be an atom, excluding keywords */ + else if (!SYMBOLP(spec) || KEYWORDP(spec)) + LispDestroy("%s %s: %s cannot be a %s argument", + fnames[type], name, STROBJ(spec), types[type]); + else { + Atom_id atom = ATOMID(spec); + + if (atom[0] == '&') { + if (atom == Srest) { + if (rest || aux || CDR(list) == NIL || !SYMBOLP(CADR(list)) + /* only &aux allowed after &rest */ + || (CDDR(list) != NIL && !SYMBOLP(CAR(CDDR(list))) && + ATOMID(CAR(CDDR(list))) != Saux)) + LispDestroy("%s %s: syntax error parsing %s", + fnames[type], name, ATOMID(spec)); + if (key) + LispDestroy("%s %s: %s not allowed after %s", + fnames[type], name, keys[IREST], keys[IKEY]); + rest = 1; + continue; + } + + else if (atom == Skey) { + if (rest || aux) + LispDestroy("%s %s: %s not allowed after %s", + fnames[type], name, ATOMID(spec), + rest ? keys[IREST] : keys[IAUX]); + key = 1; + continue; + } + + else if (atom == Soptional) { + if (rest || optional || aux || key) + LispDestroy("%s %s: %s not allowed after %s", + fnames[type], name, ATOMID(spec), + rest ? keys[IREST] : + optional ? + keys[IOPTIONAL] : + aux ? keys[IAUX] : keys[IKEY]); + optional = 1; + continue; + } + + else if (atom == Saux) { + /* &AUX must be the last keyword parameter */ + if (aux) + LispDestroy("%s %s: syntax error parsing %s", + fnames[type], name, ATOMID(spec)); + else if (builtin) + LispDestroy("builtin function cannot have &AUX arguments"); + aux = 1; + continue; + } + + /* Untill more lambda-list keywords supported, don't allow + * argument names starting with the '&' character */ + else + LispDestroy("%s %s: %s not allowed/implemented", + fnames[type], name, ATOMID(spec)); + } + + /* Add argument to alist */ + if (aux) { + count = alist->auxs.num_symbols; + REALLOC_OBJECTS(alist->auxs.symbols, count + 1); + REALLOC_OBJECTS(alist->auxs.initials, count + 1); + alist->auxs.symbols[count] = spec; + alist->auxs.initials[count] = default_value; + ++alist->auxs.num_symbols; + if (count == 0) + *desc++ = 'a'; + ++alist->num_arguments; + } + else if (rest) { + alist->rest = spec; + *desc++ = 'r'; + ++alist->num_arguments; + } + else if (key) { + /* Add to keyword package, and set the keyword in the + * argument list, so that a function argument keyword + * will reference the same object, and make comparison + * simpler. */ + spec = LispCheckKeyword(spec); + count = alist->keys.num_symbols; + REALLOC_OBJECTS(alist->keys.keys, count + 1); + REALLOC_OBJECTS(alist->keys.defaults, count + 1); + REALLOC_OBJECTS(alist->keys.sforms, count + 1); + REALLOC_OBJECTS(alist->keys.symbols, count + 1); + alist->keys.symbols[count] = spec; + alist->keys.defaults[count] = default_value; + alist->keys.sforms[count] = NULL; + alist->keys.keys[count] = NULL; + ++alist->keys.num_symbols; + if (count == 0) + *desc++ = 'k'; + ++alist->num_arguments; + } + else if (optional) { + count = alist->optionals.num_symbols; + REALLOC_OBJECTS(alist->optionals.symbols, count + 1); + REALLOC_OBJECTS(alist->optionals.defaults, count + 1); + REALLOC_OBJECTS(alist->optionals.sforms, count + 1); + alist->optionals.symbols[count] = spec; + alist->optionals.defaults[count] = default_value; + alist->optionals.sforms[count] = NULL; + ++alist->optionals.num_symbols; + if (count == 0) + *desc++ = 'o'; + ++alist->num_arguments; + } + else { + count = alist->normals.num_symbols; + REALLOC_OBJECTS(alist->normals.symbols, count + 1); + alist->normals.symbols[count] = spec; + ++alist->normals.num_symbols; + if (count == 0) + *desc++ = '.'; + ++alist->num_arguments; + } + } + } + + /* Check for dotted argument list */ + if (list != NIL) + LispDestroy("%s %s: %s cannot end %s arguments", + fnames[type], name, STROBJ(list), types[type]); + + *desc = '\0'; + alist->description = LispGetAtomString(description, 0); + + return (alist); } void -LispAddBuiltinFunction(LispMac *mac, LispBuiltin *builtin) +LispAddBuiltinFunction(LispBuiltin *builtin) { - LispAtom *atom = LispDoGetAtom(mac, builtin->name, 0, 1); + static LispObj stream; + static LispString string; + static int first = 1; + LispObj *name, *obj, *list, *cons, *code; + LispAtom *atom; + LispArgList *alist; + int length = lisp__data.protect.length; + + if (first) { + stream.type = LispStream_t; + stream.data.stream.source.string = &string; + stream.data.stream.pathname = NIL; + stream.data.stream.type = LispStreamString; + stream.data.stream.readable = 1; + stream.data.stream.writable = 0; + string.output = 0; + first = 0; + } + string.string = builtin->declaration; + string.length = strlen(builtin->declaration); + string.input = 0; - LispSetAtomBuiltinProperty(mac, atom, builtin); + code = COD; + LispPushInput(&stream); + name = LispRead(); + list = cons = CONS(name, NIL); + if (length + 1 >= lisp__data.protect.space) + LispMoreProtects(); + lisp__data.protect.objects[lisp__data.protect.length++] = list; + while ((obj = LispRead()) != NULL) { + RPLACD(cons, CONS(obj, NIL)); + cons = CDR(cons); + } + LispPopInput(&stream); + + atom = name->data.atom; + alist = LispCheckArguments(builtin->type, CDR(list), atom->string, 1); + builtin->symbol = CAR(list); + LispSetAtomBuiltinProperty(atom, builtin, alist); + LispUseArgList(alist); + + /* Make function a extern symbol, unless told to not do so */ + if (!builtin->internal) + LispExportSymbol(name); + + lisp__data.protect.length = length; + COD = code; /* LispRead protect data in COD */ } void -LispAllocSeg(LispMac *mac) +LispAllocSeg(LispObjSeg *seg, int cellcount) { - unsigned i; + unsigned int i; LispObj **list, *obj; - if ((obj = (LispObj*)calloc(1, sizeof(LispObj) * segsize)) == NULL) - LispDestroy(mac, "out of memory"); - if ((list = (LispObj**)realloc(objseg, - sizeof(LispObj*) * (numseg + 1))) == NULL) { - free(obj); - LispDestroy(mac, "out of memory"); - } - objseg = list; - objseg[numseg] = obj; - - nfree += segsize; - nobjs += segsize; - for (i = 0; i < segsize - 1; i++, obj++) { - CAR(obj) = NIL; - CDR(obj) = obj + 1; - } - CAR(obj) = NIL; - CDR(obj) = freeobj; - freeobj = objseg[numseg]; - ++numseg; + DISABLE_INTERRUPTS(); + while (seg->nfree < cellcount) { + if ((obj = (LispObj*)calloc(1, sizeof(LispObj) * segsize)) == NULL) { + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); + } + if ((list = (LispObj**)realloc(seg->objects, + sizeof(LispObj*) * (seg->nsegs + 1))) == NULL) { + free(obj); + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); + } + seg->objects = list; + seg->objects[seg->nsegs] = obj; + + seg->nfree += segsize; + seg->nobjs += segsize; + for (i = 1; i < segsize; i++, obj++) { + /* Objects of type cons are the most used, save some time + * by not setting it's type in LispNewCons. */ + obj->type = LispCons_t; + CDR(obj) = obj + 1; + } + obj->type = LispCons_t; + CDR(obj) = seg->freeobj; + seg->freeobj = seg->objects[seg->nsegs]; + ++seg->nsegs; + } #ifdef DEBUG - fprintf(lisp_stdout, "gc: %d cell(s) allocated at %d segment(s)\n", nobjs, numseg); + LispMessage("gc: %d cell(s) allocated at %d segment(s)", + seg->nobjs, seg->nsegs); #endif + ENABLE_INTERRUPTS(); } -void -LispMark(LispObj *obj) +static INLINE void +LispMark(register LispObj *object) { - if (obj->mark) - return; - - switch (obj->type) { +mark_again: + switch (OBJECT_TYPE(object)) { case LispNil_t: - if (obj == NIL) - return; + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + return; + case LispLambda_t: + if (OPAQUEP(object->data.lambda.name)) + object->data.lambda.name->mark = 1; + object->mark = 1; + LispMark(object->data.lambda.data); + object = object->data.lambda.code; + goto mark_cons; + case LispQuote_t: + case LispBackquote_t: + case LispFunctionQuote_t: + object->mark = 1; + object = object->data.quote; + goto mark_again; + case LispPathname_t: + object->mark = 1; + object = object->data.pathname; + goto mark_again; + case LispComma_t: + object->mark = 1; + object = object->data.comma.eval; + goto mark_again; + case LispComplex_t: + if (POINTERP(object->data.complex.real)) + object->data.complex.real->mark = 1; + if (POINTERP(object->data.complex.imag)) + object->data.complex.imag->mark = 1; break; - case LispTrue_t: - if (obj == T) + case LispCons_t: +mark_cons: + for (; CONSP(object) && !object->mark; object = CDR(object)) { + object->mark = 1; + switch (OBJECT_TYPE(CAR(object))) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispPackage_t: /* protected in gc */ + break; + case LispInteger_t: + case LispDFloat_t: + case LispString_t: + case LispRatio_t: + case LispOpaque_t: + case LispBignum_t: + case LispBigratio_t: + CAR(object)->mark = 1; + break; + default: + LispMark(CAR(object)); + break; + } + } + if (POINTERP(object) && !object->mark) + goto mark_again; + return; + case LispArray_t: + LispMark(object->data.array.list); + object->mark = 1; + object = object->data.array.dim; + goto mark_cons; + case LispStruct_t: + object->mark = 1; + object = object->data.struc.fields; + goto mark_cons; + case LispStream_t: +mark_stream: + LispMark(object->data.stream.pathname); + if (object->data.stream.type == LispStreamPipe) { + object->mark = 1; + object = object->data.stream.source.program->errorp; + goto mark_stream; + } + break; + case LispRegex_t: + object->data.regex.pattern->mark = 1; + break; + case LispBytecode_t: + object->mark = 1; + object = object->data.bytecode.code; + goto mark_again; + case LispHashTable_t: { + unsigned long i; + LispHashEntry *entry = object->data.hash.table->entries, + *last = entry + object->data.hash.table->num_entries; + + if (object->mark) return; + object->mark = 1; + for (; entry < last; entry++) { + for (i = 0; i < entry->count; i++) { + switch (OBJECT_TYPE(entry->keys[i])) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + case LispPackage_t: + break; + case LispInteger_t: + case LispDFloat_t: + case LispString_t: + case LispRatio_t: + case LispOpaque_t: + case LispBignum_t: + case LispBigratio_t: + entry->keys[i]->mark = 1; + break; + default: + LispMark(entry->keys[i]); + break; + } + switch (OBJECT_TYPE(entry->values[i])) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + case LispPackage_t: + break; + case LispInteger_t: + case LispDFloat_t: + case LispString_t: + case LispRatio_t: + case LispOpaque_t: + case LispBignum_t: + case LispBigratio_t: + entry->values[i]->mark = 1; + break; + default: + LispMark(entry->values[i]); + break; + } + } + } + } return; + default: break; + } + object->mark = 1; +} + +static INLINE void +LispProt(register LispObj *object) +{ +prot_again: + switch (OBJECT_TYPE(object)) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + return; case LispLambda_t: - LispMark(obj->data.lambda.name); - LispMark(obj->data.lambda.code); - break; + if (OPAQUEP(object->data.lambda.name)) + object->data.lambda.name->prot = 1; + object->prot = 1; + LispProt(object->data.lambda.data); + object = object->data.lambda.code; + goto prot_cons; case LispQuote_t: case LispBackquote_t: - LispMark(obj->data.quote); - break; + case LispFunctionQuote_t: + object->prot = 1; + object = object->data.quote; + goto prot_again; + case LispPathname_t: + object->prot = 1; + object = object->data.pathname; + goto prot_again; case LispComma_t: - LispMark(obj->data.comma.eval); + object->prot = 1; + object = object->data.comma.eval; + goto prot_again; + case LispComplex_t: + if (POINTERP(object->data.complex.real)) + object->data.complex.real->prot = 1; + if (POINTERP(object->data.complex.imag)) + object->data.complex.imag->prot = 1; break; case LispCons_t: - /* circular list on car */ - if (CAR(obj) == obj) { - obj->mark = LispTrue_t; - obj = CDR(obj); - } - for (; obj->type == LispCons_t && obj->mark == LispNil_t; - obj = CDR(obj)) { - LispMark(CAR(obj)); - obj->mark = LispTrue_t; +prot_cons: + for (; CONSP(object) && !object->prot; object = CDR(object)) { + object->prot = 1; + switch (OBJECT_TYPE(CAR(object))) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + case LispPackage_t: /* protected in gc */ + break; + case LispInteger_t: + case LispDFloat_t: + case LispString_t: + case LispRatio_t: + case LispOpaque_t: + case LispBignum_t: + case LispBigratio_t: + CAR(object)->prot = 1; + break; + default: + LispProt(CAR(object)); + break; + } } - if (obj->type != LispCons_t) - LispMark(obj); + if (POINTERP(object) && !object->prot) + goto prot_again; return; case LispArray_t: - LispMark(obj->data.array.list); - LispMark(obj->data.array.dim); - break; + LispProt(object->data.array.list); + object->prot = 1; + object = object->data.array.dim; + goto prot_cons; case LispStruct_t: - /* def is protected when protecting STR */ - LispMark(obj->data.struc.fields); - break; + object->prot = 1; + object = object->data.struc.fields; + goto prot_cons; + case LispStream_t: +prot_stream: + LispProt(object->data.stream.pathname); + if (object->data.stream.type == LispStreamPipe) { + object->prot = 1; + object = object->data.stream.source.program->errorp; + goto prot_stream; + } + break; + case LispRegex_t: + object->data.regex.pattern->prot = 1; + break; + case LispBytecode_t: + object->prot = 1; + object = object->data.bytecode.code; + goto prot_again; + case LispHashTable_t: { + unsigned long i; + LispHashEntry *entry = object->data.hash.table->entries, + *last = entry + object->data.hash.table->num_entries; + + if (object->prot) + return; + object->prot = 1; + for (; entry < last; entry++) { + for (i = 0; i < entry->count; i++) { + switch (OBJECT_TYPE(entry->keys[i])) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + case LispPackage_t: + break; + case LispInteger_t: + case LispDFloat_t: + case LispString_t: + case LispRatio_t: + case LispOpaque_t: + case LispBignum_t: + case LispBigratio_t: + entry->keys[i]->prot = 1; + break; + default: + LispProt(entry->keys[i]); + break; + } + switch (OBJECT_TYPE(entry->values[i])) { + case LispNil_t: + case LispAtom_t: + case LispFixnum_t: + case LispSChar_t: + case LispFunction_t: + case LispPackage_t: + break; + case LispInteger_t: + case LispDFloat_t: + case LispString_t: + case LispRatio_t: + case LispOpaque_t: + case LispBignum_t: + case LispBigratio_t: + entry->values[i]->prot = 1; + break; + default: + LispProt(entry->values[i]); + break; + } + } + } + } return; default: break; } - obj->mark = LispTrue_t; + object->prot = 1; } -/* It is better to keep the prot field unused for now. It should be - * be set only once, and thus, only used for constants. - * It was being used to protect arguments to Xt callbacks, but since - * Xt widgets can be destroyed, and arguments may be shared, it is - * required to have a "key" associated with every protected object/list. - */ void -LispProtect(LispMac *mac, LispObj *key, LispObj *list) +LispProtect(LispObj *key, LispObj *list) { PRO = CONS(CONS(key, list), PRO); } void -LispUProtect(LispMac *mac, LispObj *key, LispObj *list) +LispUProtect(LispObj *key, LispObj *list) { LispObj *prev, *obj; @@ -1155,2414 +2594,2914 @@ return; } - LispDestroy(mac, "no match for (%s %s), at INTERNAL:UPROTECT", - LispStrObj(mac, key), LispStrObj(mac, list)); + LispDestroy("no match for %s, at UPROTECT", STROBJ(key)); } -int -LispGet(LispMac *mac) +static LispObj * +Lisp__New(LispObj *car, LispObj *cdr) { - int ch; - - if (mac->tok == EOF) - return (EOF); - - if (mac->cp) - ch = *mac->cp; - else - ch = 0; - - if (!ch) { - if (mac->fp) { - char *ret; - char *code = malloc(1024); - int len; - - if (code) { - ret = fgets(code, 1024, mac->fp); - len = ret ? strlen(code) : -1; - } - else - len = -1; - if (len <= 0) { - free(code); - return (mac->tok = EOF); - } - if (mac->level == 0 || !mac->st) { - if (mac->st) - free(mac->st); - mac->st = mac->cp = code; - } - else { - char *tmp = realloc(mac->st, (len = strlen(mac->st)) + strlen(code) + 1); + int cellcount; + LispObj *obj; - if (!tmp) { - free(mac->st); - mac->st = NULL; - return (mac->tok = EOF); - } - mac->cp = &tmp[len]; - mac->st = tmp; - strcpy(mac->cp, code); - free(code); - } - return (LispGet(mac)); - } - else - return (mac->tok = EOF); - } + Lisp__GC(car, cdr); +#if 0 + lisp__data.gc.average = (objseg.nfree + lisp__data.gc.average) >> 1; + if (lisp__data.gc.average < minfree) { + if (lisp__data.gc.expandbits < 6) + ++lisp__data.gc.expandbits; + } + else if (lisp__data.gc.expandbits) + --lisp__data.gc.expandbits; + /* For 32 bit computers, where sizeof(LispObj) == 16, + * minfree is set to 1024, and expandbits limited to 6, + * the maximum extra memory requested here should be 1Mb + */ + cellcount = minfree << lisp__data.gc.expandbits; +#else + /* Try to keep at least 3 times more free cells than the de number + * of used cells in the freelist, to amenize the cost of the gc time, + * in the, currently, very simple gc strategy code. */ + cellcount = (objseg.nobjs - objseg.nfree) * 3; + cellcount = cellcount + (minfree - (cellcount % minfree)); +#endif - ++mac->cp; - if (ch == '\n' && mac->interactive && mac->fp == lisp_stdin) { - mac->newline = 1; - mac->column = 0; - } + if (objseg.freeobj == NIL || objseg.nfree < cellcount) + LispAllocSeg(&objseg, cellcount); - return (mac->tok = ch); -} + obj = objseg.freeobj; + objseg.freeobj = CDR(obj); -int -LispUnget(LispMac *mac) -{ - if (mac->cp > mac->st) { - --mac->cp; - return (1); - } - return (0); + return (obj); } LispObj * -LispNew(LispMac *mac, LispObj *car, LispObj *cdr) +LispNew(LispObj *car, LispObj *cdr) { - LispObj *obj; - - if (nfree < (segsize >> 2)) { - /* changed if test from - * if (freeobj == NIL) - * to - * if (nfree < (segsize >> 2)) - * this is required, because since gc can be disabled, it is possible - * to enter loops where code will fill exactly segsize objects, and - * gc protect just before allocating a new object. - * An example code that would generate such problem is: - * (setq n 1e6) - * (loop (if (<= n 0) (return n) (setf n (- n 1)))) - */ - LispGC(mac, car, cdr); - if (freeobj == NIL) - LispAllocSeg(mac); - else if (nfree < (segsize >> 2)) { - /* allocates new segment anyway, to avoid too much calls to gc */ - obj = freeobj; - while (CDR(freeobj) != NIL) - freeobj = CDR(freeobj); - cdr = freeobj; - freeobj = NIL; - LispAllocSeg(mac); - CDR(cdr) = objseg[numseg - 1]; - freeobj = obj; - } - } + LispObj *obj = objseg.freeobj; - obj = freeobj; - freeobj = CDR(obj); - - obj->dirty = LispTrue_t; - obj->prot = LispNil_t; - --nfree; + if (obj == NIL) + obj = Lisp__New(car, cdr); + else + objseg.freeobj = CDR(obj); return (obj); } LispObj * -LispNewAtom(LispMac *mac, char *str) +LispNewAtom(char *str, int intern) { - char *ptr = str; - LispObj *atom = LispNew(mac, NIL, NIL); + LispObj *object; + LispAtom *atom = LispDoGetAtom(str, 0); - /* store atoms as uppercase */ - while (*ptr) { - if (toupper(*ptr) != *ptr) { - unsigned char *tmp; + if (atom->object) { + if (intern && atom->package == NULL) + atom->package = PACKAGE; - ptr = LispStrdup(mac, str); - for (tmp = (unsigned char*)ptr; *tmp; tmp++) - *tmp = toupper(*tmp); - break; - } - ++ptr; + return (atom->object); } - if (*ptr == '\0') - ptr = str; - atom->type = LispAtom_t; - atom->data.atom = LispDoGetAtom(mac, ptr, 0, 0); - if (ptr != str) - LispFree(mac, ptr); + if (atomseg.freeobj == NIL) + LispAllocSeg(&atomseg, pagesize); + object = atomseg.freeobj; + atomseg.freeobj = CDR(object); + --atomseg.nfree; - return (atom); + object->type = LispAtom_t; + object->data.atom = atom; + atom->object = object; + if (intern) + atom->package = PACKAGE; + + return (object); } LispObj * -LispNewReal(LispMac *mac, double value) +LispNewStaticAtom(char *str) { - LispObj *real = LispNew(mac, NIL, NIL); + LispObj *object; + LispAtom *atom = LispDoGetAtom(str, 1); - real->type = LispReal_t; - real->data.real = value; + object = LispNewSymbol(atom); - return (real); + return (object); } LispObj * -LispNewString(LispMac *mac, char *str) +LispNewSymbol(LispAtom *atom) { - LispObj *string = LispNew(mac, NIL, NIL); + if (atom->object) { + if (atom->package == NULL) + atom->package = PACKAGE; - string->type = LispString_t; - string->data.atom = LispDoGetAtom(mac, str, 0, 0); + return (atom->object); + } + else { + LispObj *symbol; - return (string); + if (atomseg.freeobj == NIL) + LispAllocSeg(&atomseg, pagesize); + symbol = atomseg.freeobj; + atomseg.freeobj = CDR(symbol); + --atomseg.nfree; + + symbol->type = LispAtom_t; + symbol->data.atom = atom; + atom->object = symbol; + atom->package = PACKAGE; + + return (symbol); + } } +/* function representation is created on demand and never released, + * even if the function is undefined and never defined again */ LispObj * -LispNewCharacter(LispMac *mac, long c) +LispNewFunction(LispObj *symbol) { - LispObj *character = LispNew(mac, NIL, NIL); + LispObj *function; - character->type = LispCharacter_t; - character->data.integer = c; + if (symbol->data.atom->function) + return (symbol->data.atom->function); - return (character); + if (symbol->data.atom->package == NULL) + symbol->data.atom->package = PACKAGE; + + if (atomseg.freeobj == NIL) + LispAllocSeg(&atomseg, pagesize); + function = atomseg.freeobj; + atomseg.freeobj = CDR(function); + --atomseg.nfree; + + function->type = LispFunction_t; + function->data.atom = symbol->data.atom; + symbol->data.atom->function = function; + + return (function); } +/* symbol name representation is created on demand and never released */ LispObj * -LispNewInteger(LispMac *mac, long i) +LispSymbolName(LispObj *symbol) { - LispObj *integer = LispNew(mac, NIL, NIL); + LispObj *name; + LispAtom *atom = symbol->data.atom; - integer->type = LispInteger_t; - integer->data.integer = i; + if (atom->name) + return (atom->name); - return (integer); + if (atomseg.freeobj == NIL) + LispAllocSeg(&atomseg, pagesize); + name = atomseg.freeobj; + atomseg.freeobj = CDR(name); + --atomseg.nfree; + + name->type = LispString_t; + THESTR(name) = atom->string; + STRLEN(name) = strlen(atom->string); + name->data.string.writable = 0; + atom->name = name; + + return (name); } LispObj * -LispNewQuote(LispMac *mac, LispObj *obj) +LispNewFunctionQuote(LispObj *object) { - LispObj *quote = LispNew(mac, obj, NIL); + LispObj *quote = LispNew(object, NIL); - quote->type = LispQuote_t; - quote->data.quote = obj; + quote->type = LispFunctionQuote_t; + quote->data.quote = object; return (quote); } LispObj * -LispNewBackquote(LispMac *mac, LispObj *obj) +LispNewDFloat(double value) { - LispObj *backquote = LispNew(mac, obj, NIL); + LispObj *dfloat = objseg.freeobj; - backquote->type = LispBackquote_t; - backquote->data.quote = obj; + if (dfloat == NIL) + dfloat = Lisp__New(NIL, NIL); + else + objseg.freeobj = CDR(dfloat); - return (backquote); + dfloat->type = LispDFloat_t; + dfloat->data.dfloat = value; + + return (dfloat); } LispObj * -LispNewComma(LispMac *mac, LispObj *obj, int atlist) +LispNewString(char *str, long length, int alloced) { - LispObj *comma = LispNew(mac, obj, NIL); + char *cstring; + LispObj *string = objseg.freeobj; - comma->type = LispComma_t; - comma->data.comma.eval = obj; - comma->data.comma.atlist = atlist; + if (string == NIL) + string = Lisp__New(NIL, NIL); + else + objseg.freeobj = CDR(string); - return (comma); + if (alloced) + cstring = str; + else { + cstring = LispMalloc(length + 1); + memcpy(cstring, str, length); + cstring[length] = '\0'; + } + LispMused(cstring); + string->type = LispString_t; + THESTR(string) = cstring; + STRLEN(string) = length; + string->data.string.writable = 1; + + return (string); } LispObj * -LispNewCons(LispMac *mac, LispObj *car, LispObj *cdr) +LispNewComplex(LispObj *realpart, LispObj *imagpart) { - LispObj *cons = LispNew(mac, car, cdr); + LispObj *complexp = objseg.freeobj; - cons->type = LispCons_t; - CAR(cons) = car; - CDR(cons) = cdr; + if (complexp == NIL) + complexp = Lisp__New(realpart, imagpart); + else + objseg.freeobj = CDR(complexp); - return (cons); + complexp->type = LispComplex_t; + complexp->data.complex.real = realpart; + complexp->data.complex.imag = imagpart; + + return (complexp); } LispObj * -LispNewLambda(LispMac *mac, LispObj *name, LispObj *args, LispObj *code, - int num_args, LispFunType type, int key, int optional, int rest) +LispNewInteger(long integer) { - LispObj *fun = LispNew(mac, args, code); + if (integer > MOST_POSITIVE_FIXNUM || integer < MOST_NEGATIVE_FIXNUM) { + LispObj *object = objseg.freeobj; - fun->type = LispLambda_t; - fun->data.lambda.name = name; - GCProtect(); - fun->data.lambda.code = CONS(args, code); - GCUProtect(); - fun->data.lambda.num_args = num_args; - fun->data.lambda.type = type; - fun->data.lambda.key = key; - fun->data.lambda.optional = optional; - fun->data.lambda.rest = rest; + if (object == NIL) + object = Lisp__New(NIL, NIL); + else + objseg.freeobj = CDR(object); - return (fun); + object->type = LispInteger_t; + object->data.integer = integer; + + return (object); + } + return (FIXNUM(integer)); } LispObj * -LispNewStruct(LispMac *mac, LispObj *fields, LispObj *def) +LispNewRatio(long num, long den) { - LispObj *struc = LispNew(mac, fields, def); + LispObj *ratio = objseg.freeobj; - struc->type = LispStruct_t; - struc->data.struc.fields = fields; - struc->data.struc.def = def; + if (ratio == NIL) + ratio = Lisp__New(NIL, NIL); + else + objseg.freeobj = CDR(ratio); - return (struc); + ratio->type = LispRatio_t; + ratio->data.ratio.numerator = num; + ratio->data.ratio.denominator = den; + + return (ratio); } LispObj * -LispNewOpaque(LispMac *mac, void *data, int type) +LispNewVector(LispObj *objects) { - LispObj *opaque = LispNew(mac, NIL, NIL); + GC_ENTER(); + long count; + LispObj *array, *dimension; - opaque->type = LispOpaque_t; - opaque->data.opaque.data = data; - opaque->data.opaque.type = type; + for (count = 0, array = objects; CONSP(array); count++, array = CDR(array)) + ; - return (opaque); + GC_PROTECT(objects); + dimension = CONS(FIXNUM(count), NIL); + array = LispNew(objects, dimension); + array->type = LispArray_t; + array->data.array.list = objects; + array->data.array.dim = dimension; + array->data.array.rank = 1; + array->data.array.type = LispNil_t; + array->data.array.zero = count == 0; + GC_LEAVE(); + + return (array); } LispObj * -LispGetVar(LispMac *mac, LispObj *atom) +LispNewQuote(LispObj *object) { - LispObj *env; - LispAtom *name = atom->data.atom; - /* XXX no type checking for maximal speed, - * if got here, atom must be of an ATOM */ + LispObj *quote = LispNew(object, NIL); - if (ENV != GLB) { - for (env = ENV; env != LEX; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CDAR(env)); + quote->type = LispQuote_t; + quote->data.quote = object; - if (LEX != NIL) { - for (env = GLB; env != NIL; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CDAR(env)); - } - return (NULL); - } - - /* atom->property is only set for global variables */ - return (name->property ? name->property->value : NULL); + return (quote); } LispObj * -LispGetVarCons(LispMac *mac, LispObj *atom) +LispNewBackquote(LispObj *object) { - LispObj *env; - LispAtom *name = atom->data.atom; - /* XXX no type checking for maximal speed, - * if got here, atom must be an ATOM */ - - for (env = ENV; env != LEX; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CAR(env)); + LispObj *backquote = LispNew(object, NIL); - if (LEX != NIL) { - for (env = GLB; env != NIL; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CAR(env)); - } + backquote->type = LispBackquote_t; + backquote->data.quote = object; - /* if returns NULL, variable is unbound */ - return (NULL); + return (backquote); } -/* Only removes global variables. To be called by makunbound - * Local variables are unbounded once their block is closed anyway. - */ -void -LispUnsetVar(LispMac *mac, LispObj *atom) +LispObj * +LispNewComma(LispObj *object, int atlist) { - LispObj *env, *prv; - LispAtom *name = atom->data.atom; - /* XXX no type checking for maximal speed, - * if got here, atom must be an ATOM */ + LispObj *comma = LispNew(object, NIL); - for (prv = env = GLB; env != NIL; prv = env, env = CDR(env)) - if (CAAR(env)->data.atom == name) { - if (env == GLB) - GLB = CDR(GLB); - else - CDR(prv) = CDR(env); - if (env == ENV) - ENV = CDR(ENV); - LispRemAtomObjectProperty(mac, name); - break; - } + comma->type = LispComma_t; + comma->data.comma.eval = object; + comma->data.comma.atlist = atlist; + + return (comma); } LispObj * -LispAddVar(LispMac *mac, LispObj *atom, LispObj *obj) +LispNewCons(LispObj *car, LispObj *cdr) { - LispObj *env; - LispAtom *name = atom->data.atom; - /* XXX no type checking for maximal speed, - * if got here, atom must be an ATOM */ + LispObj *cons = objseg.freeobj; - if (LEX != NIL) { - for (env = ENV; env != LEX; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CDAR(env) = obj); - } - else { - for (env = ENV; env != GLB; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CDAR(env) = obj); - } + if (cons == NIL) + cons = Lisp__New(car, cdr); + else + objseg.freeobj = CDR(cons); - GCProtect(); - ENV = CONS(CONS(atom, obj), ENV); - GCUProtect(); + CAR(cons) = car; + CDR(cons) = cdr; - return (obj); + return (cons); } LispObj * -LispSetVar(LispMac *mac, LispObj *atom, LispObj *obj) +LispNewLambda(LispObj *name, LispObj *code, LispObj *data, LispFunType type) { - LispObj *env; - LispAtom *name = atom->data.atom; - /* XXX no type checking for maximal speed, - * if got here, atom must be an ATOM */ + LispObj *fun = LispNew(data, code); - for (env = ENV; env != GLB; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CDAR(env) = obj); - - for (env = GLB; env != NIL; env = CDR(env)) - if (CAAR(env)->data.atom == name) - return (CDAR(env) = CAAR(env)->data.atom->property->value = obj); - - GCProtect(); - LispSetAtomObjectProperty(mac, name, obj); - if (GLB == NIL) - ENV = GLB = CONS(CONS(atom, obj), NIL); - else { - CDR(GLB) = CONS(CAR(GLB), CDR(GLB)); - CAR(GLB) = CONS(atom, obj); - } - GCUProtect(); + fun->type = LispLambda_t; + fun->funtype = type; + fun->data.lambda.name = name; + fun->data.lambda.code = code; + fun->data.lambda.data = data; - return (obj); + return (fun); } LispObj * -LispReverse(LispObj *list) +LispNewStruct(LispObj *fields, LispObj *def) { - LispObj *tmp, *res = NIL; + LispObj *struc = LispNew(fields, def); - while (list != NIL) { - tmp = CDR(list); - CDR(list) = res; - res = list; - list = tmp; - } + struc->type = LispStruct_t; + struc->data.struc.fields = fields; + struc->data.struc.def = def; - return (res); + return (struc); } LispObj * -LispEnvRun(LispMac *mac, LispObj *args, LispFunPtr fn, char *fname, int refs) +LispNewOpaque(void *data, int type) { - LispObj *old_frm, *old_env, *env, *res, *list, *pair; + LispObj *opaque = LispNew(NIL, NIL); - old_frm = FRM; - old_env = ENV; - env = CAR(args); - list = NIL; - - if (env != NIL) { - if (env->type != LispCons_t) - LispDestroy(mac, "%s is not of type list, at %s", - LispStrObj(mac, env), fname); - } - - for (; env != NIL; env = CDR(env)) { - LispObj *var = NIL, *val = NIL; - - pair = CAR(env); - if (SYMBOL_P(pair)) { - var = pair; - val = NIL; - } - else if (pair->type == LispCons_t) { - var = CAR(pair); - if (!SYMBOL_P(var)) - LispDestroy(mac, "%s is invalid as a variable name, at %s", - LispStrObj(mac, var), fname); - pair = CDR(pair); - if (pair == NIL) - val = NIL; - else { - val = CAR(pair); - if (CDR(pair) != NIL) - LispDestroy(mac, "too much arguments to initialize %s, at %s", - STRPTR(var), fname); - } - } - else - LispDestroy(mac, "%s is not of type list, at %s", - LispStrObj(mac, pair), fname); - val = EVAL(val); - if (!refs) { - GCProtect(); - pair = CONS(var, val); - if (list == NIL) { - list = CONS(pair, NIL); - FRM = CONS(list, FRM); - } - else { - CDR(list) = CONS(CAR(list), CDR(list)); - CAR(list) = pair; - } - GCUProtect(); - } - else - LispAddVar(mac, var, val); - } + opaque->type = LispOpaque_t; + opaque->data.opaque.data = data; + opaque->data.opaque.type = type; - if (!refs && list != NIL) { - /* Need to update CAR(FRM) or will run function without gc protection! */ - list = CAR(FRM) = LispReverse(list); - for (; list != NIL; list = CDR(list)) { - pair = CAR(list); - LispAddVar(mac, CAR(pair), CDR(pair)); - } - } + return (opaque); +} + +/* string argument must be static, or allocated */ +LispObj * +LispNewKeyword(char *string) +{ + LispObj *keyword; - res = fn(mac, CDR(args), fname); + if (PACKAGE != lisp__data.keyword) { + LispObj *savepackage; + LispPackage *savepack; - ENV = old_env; - FRM = old_frm; + /* Save package environment */ + savepackage = PACKAGE; + savepack = lisp__data.pack; - return (res); -} + /* Change package environment */ + PACKAGE = lisp__data.keyword; + lisp__data.pack = lisp__data.key; -LispBlock * -LispBeginBlock(LispMac *mac, LispObj *tag, LispBlockType type) -{ - unsigned blevel = mac->block.block_level + 1; - LispBlock *block = NULL; + /* Create symbol in keyword package */ + keyword = LispNewStaticAtom(string); - if (blevel > mac->block.block_size) { - LispBlock **blk = realloc(mac->block.block, - sizeof(LispBlock*) * (blevel + 1)); - - if (blk == NULL) - LispDestroy(mac, "out of memory"); - else if ((block = malloc(sizeof(LispBlock))) == NULL) - LispDestroy(mac, "out of memory"); - mac->block.block = blk; - mac->block.block[mac->block.block_size] = block; - mac->block.block_size = blevel; + /* Restore package environment */ + PACKAGE = savepackage; + lisp__data.pack = savepack; } - block = mac->block.block[mac->block.block_level]; - if (type == LispBlockCatch) - tag = EVAL(tag); - block->type = type; - memcpy(&(block->tag), tag, sizeof(LispObj)); + else + /* Just create symbol in keyword package */ + keyword = LispNewStaticAtom(string); - block->level = mac->level; - block->block_level = mac->block.block_level; + /* Export keyword symbol */ + LispExportSymbol(keyword); - mac->block.block_level = blevel; + /* All keywords are constants */ + keyword->data.atom->constant = 1; - if (mac->debugging) { - block->debug_level = mac->debug_level; - block->debug_step = mac->debug_step; - } + /* XXX maybe should bound the keyword to itself, but that would + * require allocating a LispProperty structure for every keyword */ - return (block); + return (keyword); } -void -LispEndBlock(LispMac *mac, LispBlock *block) +LispObj * +LispNewPathname(LispObj *obj) { - mac->level = block->level; - mac->block.block_level = block->block_level; + LispObj *path = LispNew(obj, NIL); - if (mac->debugging) { - if (mac->debug_level >= block->debug_level) { - while (mac->debug_level > block->debug_level) { - DBG = CDR(DBG); - --mac->debug_level; - } - } - else - LispDestroy(mac, "this should never happen: " - "mac->debug_level < block->debug_level"); - mac->debug_step = block->debug_step; - } + path->type = LispPathname_t; + path->data.pathname = obj; + + return (path); } -void -LispBlockUnwind(LispMac *mac) +LispObj * +LispNewStringStream(char *string, int flags, long length, int alloced) { - LispBlock *block; - int blevel = mac->block.block_level; + LispObj *stream = LispNew(NIL, NIL); - while (blevel > 0) { - block = mac->block.block[--blevel]; - if (block->type == LispBlockProtect) - longjmp(block->jmp, 1); + SSTREAMP(stream) = LispCalloc(1, sizeof(LispString)); + if (alloced) + SSTREAMP(stream)->string = string; + else { + SSTREAMP(stream)->string = LispMalloc(length + 1); + memcpy(SSTREAMP(stream)->string, string, length); + SSTREAMP(stream)->string[length] = '\0'; } + + stream->type = LispStream_t; + + SSTREAMP(stream)->length = length; + LispMused(SSTREAMP(stream)); + LispMused(SSTREAMP(stream)->string); + stream->data.stream.type = LispStreamString; + stream->data.stream.readable = (flags & STREAM_READ) != 0; + stream->data.stream.writable = (flags & STREAM_WRITE) != 0; + SSTREAMP(stream)->space = length + 1; + + stream->data.stream.pathname = NIL; + + return (stream); } -static int -LispSkipComment(LispMac *mac) +LispObj * +LispNewFileStream(LispFile *file, LispObj *path, int flags) { - int ch; + LispObj *stream = LispNew(NIL, NIL); - /*CONSTCOND*/ - while (1) { - while (ch = LispGet(mac), ch != '\n' && ch != EOF) - ; - if (ch == EOF) - return (0); - while (ch = LispGet(mac), isspace(ch) && ch != EOF) - ; - if (ch == EOF) - return (0); - if (ch != ';') { - LispUnget(mac); - return (1); - } - } - /*NOTREACHED*/ + stream->type = LispStream_t; + FSTREAMP(stream) = file; + stream->data.stream.pathname = path; + stream->data.stream.type = LispStreamFile; + stream->data.stream.readable = (flags & STREAM_READ) != 0; + stream->data.stream.writable = (flags & STREAM_WRITE) != 0; + + return (stream); } -static int -LispSkipWhiteSpace(LispMac *mac) +LispObj * +LispNewPipeStream(LispPipe *program, LispObj *path, int flags) { - int ch; + LispObj *stream = LispNew(NIL, NIL); - while (ch = LispGet(mac), isspace(ch) && ch != EOF) - ; - if (ch == ';') { - if (!LispSkipComment(mac)) - return (EOF); - return (LispGet(mac)); - } - else if (ch == '#') { - /* multiline comment */ - if (LispGet(mac) == '|') { - int comm = 1; /* comments may nest */ - - while (1) { - ch = LispGet(mac); - if (ch == '|' && LispGet(mac) == '#') { - if (--comm == 0) - return (LispSkipWhiteSpace(mac)); - } - else if (ch == '#' && LispGet(mac) == '|') - ++comm; - else if (ch == EOF) - return (EOF); - } - } - else - LispUnget(mac); - } - return (ch); + stream->type = LispStream_t; + PSTREAMP(stream) = program; + stream->data.stream.pathname = path; + stream->data.stream.type = LispStreamPipe; + stream->data.stream.readable = (flags & STREAM_READ) != 0; + stream->data.stream.writable = (flags & STREAM_WRITE) != 0; + + return (stream); } -void -LispGetKeys(LispMac *mac, char *fname, char *spec, LispObj *list, ...) +LispObj * +LispNewStandardStream(LispFile *file, LispObj *description, int flags) { - va_list ap; - int nargs, ncvt; - LispObj *obj, **arg; - char *ptr, *end, *str; - - /* count how many arguments specified and check arguments */ - for (obj = list, nargs = 0; obj != NIL; obj = CDR(obj)) { - if (!SYMBOL_P(CAR(obj)) || STRPTR(CAR(obj))[0] != ':') - LispDestroy(mac, "&KEY needs arguments as pairs, at %s", fname); - else if (CDR(obj) == NIL) - LispDestroy(mac, "expecting %s value, at %s", - STRPTR(CAR(obj)), fname); - obj = CDR(obj); - ++nargs; - } - - va_start(ap, list); - for (ncvt = 0, ptr = spec, end = strchr(spec, ':'); end; - ptr = end + 1, end = strchr(ptr, ':')) { - arg = (LispObj**)va_arg(ap, LispObj**); - *arg = NULL; /* to know if it was found */ - - for (obj = list; obj != NIL; obj = CDR(obj)) { - str = STRPTR(CAR(obj)) + 1; - obj = CDR(obj); - if (strncmp(str, ptr, end - ptr) == 0) { - *arg = CAR(obj); - ++ncvt; - break; - } - } - if (*arg == NULL) - *arg = NIL; - } - if (ptr) { - /* last or unique argument */ - arg = (LispObj**)va_arg(ap, LispObj**); - *arg = NULL; /* to know if it was found */ - - for (obj = list; obj != NIL; obj = CDR(obj)) { - str = STRPTR(CAR(obj)) + 1; - obj = CDR(obj); - if (strcmp(str, ptr) == 0) { - *arg = CAR(obj); - ++ncvt; - break; - } - } - if (*arg == NULL) - *arg = NIL; - } - va_end(ap); - - /* if got here, arguments are correctly specified as pairs */ - if (ncvt < nargs) { - /* Possible error. If argument value specified more than once, it is - * not triggered as an error, but if an incorrect argument name was - * specified, it is a fatal error (probably a typo in the code) */ - - for (obj = list; obj != NIL; obj = CDR(CDR(obj))) { - int match = 0; - - for (ptr = spec, end = strchr(ptr, ':'); end; - ptr = end + 1, end = strchr(ptr, ':')) - if (strncmp(STRPTR(CAR(obj)) + 1, ptr, end - ptr) == 0) { - match = 1; - break; - } + LispObj *stream = LispNew(NIL, NIL); - if (!match && ptr && strcmp(STRPTR(CAR(obj)) + 1, ptr) == 0) - match = 1; + stream->type = LispStream_t; + FSTREAMP(stream) = file; + stream->data.stream.pathname = description; + stream->data.stream.type = LispStreamStandard; + stream->data.stream.readable = (flags & STREAM_READ) != 0; + stream->data.stream.writable = (flags & STREAM_WRITE) != 0; - if (!match) - LispDestroy(mac, "%s is not an argument to %s", - STRPTR(CAR(obj)), fname); - } - } + return (stream); } LispObj * -LispRun(LispMac *mac) +LispNewBignum(mpi *bignum) { - static char *DOTMSG = "illegal end of dotted list"; - static char *QUOTMSG = "illegal quoted object"; - int ch, len, dquote = 0, escape = 0, size, dot = 0, hash = 0; - LispObj *res, *obj, *cons, *code, *frm; - char stk[1024], *str; + LispObj *integer = LispNew(NIL, NIL); - code = COD; - frm = FRM; - switch (ch = LispSkipWhiteSpace(mac)) { - case '(': - if (LispSkipWhiteSpace(mac) == ')') { - res = NIL; - break; - } - (void)LispUnget(mac); - res = cons = CONS(NIL, NIL); - if (COD == NIL) - COD = res; - else - FRM = CONS(res, FRM); - if ((CAR(cons) = LispRun(mac)) == DOT) - LispDestroy(mac, "illegal start of dotted list"); - while ((obj = LispRun(mac)) != EOLIST) { - if (obj == NULL) - goto endofinput; - if (obj == DOT) { - if (dot) - LispDestroy(mac, DOTMSG); - dot = 1; - } - else { - if (dot) { - if (++dot > 2) - LispDestroy(mac, DOTMSG); - CDR(cons) = obj; - } - else { - CDR(cons) = CONS(obj, NIL); - cons = CDR(cons); - } - } - } - if (dot == 1) - LispDestroy(mac, DOTMSG); - break; - case ')': - return (EOLIST); - case EOF: - return (NULL); - case '\'': - if ((obj = LispRun(mac)) == NULL || obj == EOLIST) - LispDestroy(mac, QUOTMSG); - res = QUOTE(obj); - break; - case '`': - if ((obj = LispRun(mac)) == NULL || obj == EOLIST) - LispDestroy(mac, QUOTMSG); - res = BACKQUOTE(obj); - break; - case ',': { - int atlist = LispGet(mac); - - if (atlist == EOF) - goto endofinput; - else if (atlist != '@') - LispUnget(mac); - if ((obj = LispRun(mac)) == NULL || obj == EOLIST) - LispDestroy(mac, QUOTMSG); - res = COMMA(obj, atlist == '@'); - } break; - case '#': - hash = 1; - ch = LispGet(mac); - if (ch == EOF) - goto endofinput; - else if (ch != '\\') - LispDestroy(mac, "syntax error at #"); - ch = '#'; - goto string_label; - case '"': - dquote = 1; - escape = 1; - goto string_label; - default: -string_label: - len = 0; - size = sizeof(stk); - str = stk; - while (ch != EOF && ((dquote || (hash && len < 2)) || - (!isspace(ch) && (ch != ')' && ch != '(' && ch != ';')))) { - if (len >= size - 1) { - char *tmp; + integer->type = LispBignum_t; + integer->data.mp.integer = bignum; + LispMused(bignum->digs); + LispMused(bignum); - if (str == stk) - tmp = (char*)LispMalloc(mac, size + 1024); - else - tmp = (char*)LispRealloc(mac, str, size + 1024); - str = tmp; - size += 1024; - } + return (integer); +} - if (ch == '\\') - escape = !escape; +LispObj * +LispNewBigratio(mpr *bigratio) +{ + LispObj *ratio = LispNew(NIL, NIL); - if (dquote) { - if (!escape) { - if (ch == '"') - break; - str[len++] = ch; - } - } - else if (hash) { - if (!escape) - str[len++] = ch; - } - else if (!escape) - str[len++] = toupper(ch); - ch = LispGet(mac); - if (escape) - escape = 0; - } - str[len] = '\0'; - if (ch == '(' || ch == ')' || ch == ';') - LispUnget(mac); - if (dquote) - res = STRING(str); - else if (isdigit(str[0]) || - ((str[0] == '-' || str[0] == '.' || str[0] == '+') && - isdigit(str[1]))) { - double value; - char *cp; - - value = strtod(str, &cp); - if (cp && *cp) - res = ATOM(str); - else - res = REAL(value); - } - else if (hash) { - long c = 0; + ratio->type = LispBigratio_t; + ratio->data.mp.ratio = bigratio; + LispMused(mpr_num(bigratio)->digs); + LispMused(mpr_den(bigratio)->digs); + LispMused(bigratio); - if (len == 1) - LispDestroy(mac, "syntax error at #"); - else if (len > 2) { - if (len == 6 && (str[1] == 'u' || str[1] == 'U')) { - char *end; - - c = strtoul(str + 2, &end, 16); - if (!*end) - goto gotchar; - } - for (c = 0; c <= ' '; c++) - if (strcasecmp(LispCharNames[c], str + 1) == 0) - break; - if (c > ' ') { - /* extra or special cases */ - if (strcasecmp(str + 1, "Rubout") == 0) - c = 0177; - else if (strcasecmp(str + 1, "Nul") == 0) - c = 0; - else if (strcasecmp(str + 1, "Bs") == 0) - c = 010; - else if (strcasecmp(str + 1, "Ht") == 0) - c = 011; - else if (strcasecmp(str + 1, "Lf") == 0) - c = 012; - else if (strcasecmp(str + 1, "Ff") == 0) - c = 014; - else if (strcasecmp(str + 1, "Cr") == 0) - c = 015; - else if (strcasecmp(str + 1, "Esc") == 0) - c = 033; - else if (strcasecmp(str + 1, "Del") == 0) - c = 0177; - else if (strcasecmp(str + 1, "Linefeed") == 0) - c = 012; - else if (strcasecmp(str + 1, "Delete") == 0) - c = 0177; - else - LispDestroy(mac, "no character named \"%s\"", - str + 1); - } - } - else - c = *(unsigned char*)(str + 1); -gotchar: - res = CHAR(c); - } - else { - if (!len || strcmp(str, "NIL") == 0) - res = NIL; - else if (strcmp(str, "T") == 0) - res = T; - else if (strcmp(str, ".") == 0) - res = DOT; - else - res = ATOM(str); - } - if (str != stk) - LispFree(mac, str); - break; - } + return (ratio); +} - if (code == NIL) - COD = res; - FRM = frm; +/* name must be of type LispString_t */ +LispObj * +LispNewPackage(LispObj *name, LispObj *nicknames) +{ + LispObj *package = LispNew(name, nicknames); + LispPackage *pack = LispCalloc(1, sizeof(LispPackage)); - return (res); + package->type = LispPackage_t; + package->data.package.name = name; + package->data.package.nicknames = nicknames; + package->data.package.package = pack; -endofinput: - LispDestroy(mac, "unexpected end of input"); - /*NOTREACHED*/ + LispMused(pack); - return (NIL); + return (package); } LispObj * -LispEvalBackquote(LispMac *mac, LispObj *arg) +LispSymbolFunction(LispObj *symbol) { - LispObj *res = NIL, *frm = FRM; - - if (arg->type == LispComma_t) { - if (arg->data.comma.atlist) - LispDestroy(mac, ",@ only allowed on lists"); - else if (arg->data.comma.eval->type == LispComma_t) - res = arg->data.comma.eval; - else - /* just evaluate it */ - res = EVAL(arg->data.comma.eval); - } - else if (arg->type == LispCons_t) { - LispObj *obj, *cdr = NIL, *ptr; - /* create new form, evaluating any commas inside */ - - res = NIL; - for (ptr = arg; ; ptr = CDR(ptr)) { - int atcons = 1, atlist = 0; - - if (ptr->type != LispCons_t) { - atcons = 0; - obj = ptr; - } - else - obj = CAR(ptr); - if (obj->type == LispComma_t) { - atlist = obj->data.comma.atlist; - if (obj->data.comma.eval->type == LispComma_t) { - if (atlist) - LispDestroy(mac, ",@ only allowed on lists"); - obj = obj->data.comma.eval; - } - else - obj = EVAL(obj->data.comma.eval); - } - else if (obj->type == LispBackquote_t) - obj = LispEvalBackquote(mac, obj->data.quote); - else if (obj->type == LispCons_t) - obj = LispEvalBackquote(mac, obj); - /* else do nothing */ - - if (res == NIL) { - if (frm != FRM) - /* just free a cons, in case of code like: - * (setq c nil d '(1 2 3)) - * `(,@c ,@d) - */ - FRM = frm; + LispAtom *atom = symbol->data.atom; - /* link to FRM to protect from gc, - * actually, should protect with COD, but this would - * require EVAL to also save/restore COD, causing - * a bit slower EVAL time. - */ - GCProtect(); - if (!atlist) { - if (atcons) - /* easier case */ - res = cdr = CONS(obj, NIL); - else - res = cdr = obj; - } - else { - /* add list contents */ - if (obj->type != LispCons_t) - res = cdr = obj; - else { - res = cdr = CONS(CAR(obj), NIL); - for (obj = CDR(obj); obj->type == LispCons_t; - obj = CDR(obj)) { - CDR(cdr) = CONS(CAR(obj), NIL); - cdr = CDR(cdr); - } - if (obj != NIL) { - CDR(cdr) = obj; - cdr = CDR(cdr); - } - } - } - FRM = CONS(res, FRM); - GCUProtect(); - } - else { - if (cdr->type != LispCons_t) - LispDestroy(mac, "cannot append to %s", - LispStrObj(mac, cdr)); - if (!atlist) { - if (atcons) { - CDR(cdr) = CONS(obj, NIL); - cdr = CDR(cdr); - } - else { - CDR(cdr) = obj; - cdr = obj; - } - } - else { - if (obj->type != LispCons_t) { - CDR(cdr) = obj; - if (obj != NIL) - cdr = obj; - } - else { - for (; obj->type == LispCons_t; obj = CDR(obj)) { - CDR(cdr) = CONS(CAR(obj), NIL); - cdr = CDR(cdr); - } - if (obj != NIL) { - CDR(cdr) = obj; - cdr = CDR(cdr); - } - } - } - } - if (ptr->type != LispCons_t) - break; - } - } - else if (arg->type == LispBackquote_t) - res = BACKQUOTE(LispEvalBackquote(mac, arg->data.quote)); + if ((atom->a_builtin && + atom->property->fun.builtin->type == LispFunction) || + (atom->a_function && + atom->property->fun.function->funtype == LispFunction) || + (atom->a_defstruct && + atom->property->structure.function != STRUCT_NAME) || + /* XXX currently bytecode is only generated for functions */ + atom->a_compiled) + symbol = FUNCTION(symbol); else - /* 'obj == `obj */ - res = arg; + LispDestroy("SYMBOL-FUNCTION: %s is not a function", STROBJ(symbol)); - return (res); + return (symbol); } -static LispObj * -LispBuildArguments(LispMac *mac, LispObj *desc, LispObj *values, - char *fname, int macro) + +static INLINE LispObj * +LispGetVarPack(LispObj *symbol) { - int rest, optional, key; - LispObj *args = NIL, *list = desc, *res, *cdr = NIL, *arg, *keyword = NIL; + int ii; + char *string; + LispAtom *atom; + LispProperty *property; - /* build argument list */ - while (list != NIL) { - if (STRPTR(CAR(list))[0] != '&') { - if (args == NIL) { - GCProtect(); - args = cdr = CONS(list, NIL); - FRM = CONS(args, FRM); - GCUProtect(); - } - else { - CDR(cdr) = CONS(list, NIL); - cdr = CDR(cdr); - } - } - list = CDR(list); - } + string = ATOMID(symbol); + property = symbol->data.atom->property; + ii = STRHASH(string); - /* fill argument list */ - list = desc; - rest = optional = key = 0; - cdr = values; - arg = args; - while (list != NIL) { - if (STRPTR(CAR(list))[0] == '&') { - if (strcmp(STRPTR(CAR(list)) + 1, "KEY") == 0) - key = 1; - else if (strcmp(STRPTR(CAR(list)) + 1, "REST") == 0) { - rest = 1; - break; - } - else /* "OPTIONAL" */ - optional = 1; - } - else { - if (cdr == NIL) { - if (key || optional) - break; - else - LispDestroy(mac, "too few arguments to %s", fname); - } - else { - if (key) { - if (!SYMBOL_P(CAR(cdr)) || STRPTR(CAR(cdr))[0] != ':') - LispDestroy(mac, "&KEY needs arguments as pairs, at %s", - fname); - else if (CDR(cdr) == NIL) - LispDestroy(mac, "expecting %s value, at %s", - STRPTR(CAR(cdr)), fname); - keyword = CAR(cdr); - cdr = CDR(cdr); - } - if (macro) - res = CAR(cdr); - else - res = EVAL(CAR(cdr)); - if (key) { - LispObj *atmp, *cmp, *ltmp = desc; - - for (; ltmp != NIL; ltmp = CDR(ltmp)) { - if ((cmp = CAR(ltmp))->type == LispCons_t) - cmp = CAR(cmp); - else if (STRPTR(cmp)[0] == '&') - continue; - if (strcmp(STRPTR(cmp), STRPTR(keyword) + 1) == 0) - break; - } - if (ltmp == NIL) - LispDestroy(mac, "%s is not an argument to %s", - STRPTR(keyword), fname); - for (atmp = args; atmp != NIL; atmp = CDR(atmp)) - if (CAR(atmp) == ltmp) { - CAR(atmp) = res; - break; - } - /* else, silently ignore setting argument - * more than once? */ - } - else - CAR(arg) = res; - cdr = CDR(cdr); - } - arg = CDR(arg); - } - list = CDR(list); - } - if (rest) { - res = CAR(cdr); - if (!macro) - res = EVAL(res); - CAR(arg) = CONS(res, NIL); - arg = CAR(arg); - cdr = CDR(cdr); - while (cdr->type == LispCons_t) { - res = CAR(cdr); - if (!macro) - res = EVAL(res); - CDR(arg) = CONS(res, NIL); - arg = CDR(arg); - cdr = CDR(cdr); - } - } - else if (cdr != NIL) - LispDestroy(mac, "too many arguments to %s", fname); - - /* set to NIL or default any unspecified arguments */ - if (key || optional) { - arg = args; - list = desc; - - for (; list != NIL; list = CDR(list)) - if (STRPTR(CAR(list))[0] != '&') { - if (CAR(arg) == list) { - if (CAR(list)->type == LispCons_t && - CDR(CAR(list))->type == LispCons_t) { - if (macro) - CAR(arg) = CAR(CDR(CAR(list))); - else - CAR(arg) = EVAL(CAR(CDR(CAR(list)))); - } - else - CAR(arg) = NIL; - } - arg = CDR(arg); - } + atom = lisp__data.pack->atoms[ii]; + while (atom) { + if (strcmp(atom->string, string) == 0) + return (atom->object); + + atom = atom->next; } - return (args); + /* Symbol not found, just import it */ + return (NULL); } -/* if max_args == 0, then any number of arguments accepted, - * if min_args < 0 then, if max_args == 0, no args are accepted */ -static LispObj * -LispBuildSimpleArguments(LispMac *mac, LispObj *values, char *fname, - int min_args, int max_args, int macro) +/* package must be of type LispPackage_t */ +void +LispUsePackage(LispObj *package) { - int num_objs = 0; - LispObj *res, *args = NIL, *cdr = values; + unsigned i; + LispAtom *atom; + LispPackage *pack; + LispObj **pentry, **eentry; - while (cdr->type == LispCons_t) { - ++num_objs; - cdr = CDR(cdr); - } - if (num_objs < min_args) - LispDestroy(mac, "too few arguments to %s", fname); - else if ((max_args || min_args < 0) && num_objs > max_args) - LispDestroy(mac, "too many arguments to %s", fname); + /* Already using its own symbols... */ + if (package == PACKAGE) + return; - if (macro) - args = values; - else if (num_objs) { - LispObj *arg = values; + /* Check if package not already in use-package list */ + for (pentry = lisp__data.pack->use.pairs, + eentry = pentry + lisp__data.pack->use.length; + pentry < eentry; pentry++) + if (*pentry == package) + return; - res = EVAL(CAR(arg)); - GCProtect(); - args = cdr = CONS(res, NIL); - FRM = CONS(args, FRM); - GCUProtect(); - arg = CDR(arg); - while (arg->type == LispCons_t) { - CDR(cdr) = CONS(EVAL(CAR(arg)), NIL); - cdr = CDR(cdr); - arg = CDR(arg); - } - } + /* Remember this package is in the use-package list */ + if (lisp__data.pack->use.length + 1 >= lisp__data.pack->use.space) { + LispObj **pairs = realloc(lisp__data.pack->use.pairs, + (lisp__data.pack->use.space + 1) * + sizeof(LispObj*)); - return (args); -} + if (pairs == NULL) + LispDestroy("out of memory"); -LispObj * -LispEval(LispMac *mac, LispObj *obj) -{ - char *strname = NULL; - LispObj *name = NIL, *fun, *cons = NIL, *frm, *res, *car; - LispBuiltin *fn; + lisp__data.pack->use.pairs = pairs; + ++lisp__data.pack->use.space; + } + lisp__data.pack->use.pairs[lisp__data.pack->use.length++] = package; - if (!obj) - LispDestroy(mac, "internal error, at INTERNAL:EVAL"); + /* Import all extern symbols from package */ + pack = package->data.package.package; - switch (obj->type) { - case LispAtom_t: - strname = STRPTR(obj); - if (mac->debugging) - LispDebugger(mac, LispDebugCallBegini, NIL, obj); - if (strname[0] != ':' && (obj = LispGetVar(mac, obj)) == NULL) - LispDestroy(mac, "the variable %s is unbound", strname); - if (mac->debugging) - LispDebugger(mac, LispDebugCallEndi, NIL, obj); - return (obj); - case LispQuote_t: - if (mac->debugging) { - LispDebugger(mac, LispDebugCallBegini, NIL, obj); - LispDebugger(mac, LispDebugCallEndi, NIL, obj->data.quote); + /* Traverse atom list, searching for extern symbols */ + for (i = 0; i < STRTBLSZ; i++) { + atom = pack->atoms[i]; + while (atom) { + if (atom->ext) + LispImportSymbol(atom->object); + atom = atom->next; + } + } +} + +/* symbol must be of type LispAtom_t */ +void +LispImportSymbol(LispObj *symbol) +{ + int increment; + LispAtom *atom; + LispObj *current; + + current = LispGetVarPack(symbol); + if (current == NULL || current->data.atom->property == NOPROPERTY) { + /* No conflicts */ + + if (symbol->data.atom->a_object) { + /* If it is a bounded variable */ + if (lisp__data.pack->glb.length + 1 >= lisp__data.pack->glb.space) + LispMoreGlobals(lisp__data.pack); + lisp__data.pack->glb.pairs[lisp__data.pack->glb.length++] = symbol; + } + + /* Create copy of atom in current package */ + atom = LispDoGetAtom(ATOMID(symbol), 0); + /* Need to create a copy because if anything new is atached to the + * property, the current package is the owner, not the previous one. */ + + /* And reference the same properties */ + atom->property = symbol->data.atom->property; + + increment = 1; + } + else if (current->data.atom->property != symbol->data.atom->property) { + /* Symbol already exists in the current package, + * but does not reference the same variable */ + LispContinuable("Symbol %s already defined in package %s. Redefine?", + ATOMID(symbol), THESTR(PACKAGE->data.package.name)); + + atom = current->data.atom; + + /* Continued from error, redefine variable */ + LispDecrementAtomReference(atom); + atom->property = symbol->data.atom->property; + + atom->a_object = atom->a_function = atom->a_builtin = + atom->a_property = atom->a_defsetf = atom->a_defstruct = 0; + + increment = 1; + } + else { + /* Symbol is already available in the current package, just update */ + atom = current->data.atom; + + increment = 0; + } + + /* If importing an important system variable */ + atom->watch = symbol->data.atom->watch; + + /* Update constant flag */ + atom->constant = symbol->data.atom->constant; + + /* Set home-package and unique-atom associated with symbol */ + atom->package = symbol->data.atom->package; + atom->object = symbol->data.atom->object; + + if (symbol->data.atom->a_object) + atom->a_object = 1; + if (symbol->data.atom->a_function) + atom->a_function = 1; + else if (symbol->data.atom->a_builtin) + atom->a_builtin = 1; + else if (symbol->data.atom->a_compiled) + atom->a_compiled = 1; + if (symbol->data.atom->a_property) + atom->a_property = 1; + if (symbol->data.atom->a_defsetf) + atom->a_defsetf = 1; + if (symbol->data.atom->a_defstruct) + atom->a_defstruct = 1; + + if (increment) + /* Increase reference count, more than one package using the symbol */ + LispIncrementAtomReference(symbol->data.atom); +} + +/* symbol must be of type LispAtom_t */ +void +LispExportSymbol(LispObj *symbol) +{ + /* This does not automatically export symbols to another package using + * the symbols of the current package */ + symbol->data.atom->ext = 1; +} + +#ifdef __GNUC__ +LispObj * +LispGetVar(LispObj *atom) +{ + return (LispDoGetVar(atom)); +} + +static INLINE LispObj * +LispDoGetVar(LispObj *atom) +#else +#define LispDoGetVar LispGetVar +LispObj * +LispGetVar(LispObj *atom) +#endif +{ + LispAtom *name; + int i, base, offset; + Atom_id id; + + name = atom->data.atom; + if (name->constant && name->package == lisp__data.keyword) + return (atom); + + /* XXX offset should be stored elsewhere, it is unique, like the string + * pointer. Unless a multi-thread interface is implemented (where + * multiple stacks would be required, the offset value should be + * stored with the string, so that a few cpu cicles could be saved + * by initializing the value to -1, and only searching for the symbol + * binding if it is not -1, and if no binding is found, because the + * lexical scope was left, reset offset to -1. */ + offset = name->offset; + id = name->string; + base = lisp__data.env.lex; + i = lisp__data.env.head - 1; + + if (offset <= i && (offset >= base || name->dyn) && + lisp__data.env.names[offset] == id) + return (lisp__data.env.values[offset]); + + for (; i >= base; i--) + if (lisp__data.env.names[i] == id) { + name->offset = i; + + return (lisp__data.env.values[i]); + } + + if (name->dyn) { + /* Keep searching as maybe a rebound dynamic variable */ + for (; i >= 0; i--) + if (lisp__data.env.names[i] == id) { + name->offset = i; + + return (lisp__data.env.values[i]); + } + + if (name->a_object) { + /* Check for a symbol defined as special, but not yet bound. */ + if (name->property->value == UNBOUND) + return (NULL); + + return (name->property->value); + } + } + + return (name->a_object ? name->property->value : NULL); +} + +#ifdef DEBUGGER +/* Same code as LispDoGetVar, but returns the address of the pointer to + * the object value. Used only by the debugger */ +void * +LispGetVarAddr(LispObj *atom) +{ + LispAtom *name; + int i, base; + Atom_id id; + + name = atom->data.atom; + if (name->constant && name->package == lisp__data.keyword) + return (&atom); + + id = name->string; + + i = lisp__data.env.head - 1; + for (base = lisp__data.env.lex; i >= base; i--) + if (lisp__data.env.names[i] == id) + return (&(lisp__data.env.values[i])); + + if (name->dyn) { + for (; i >= 0; i--) + if (lisp__data.env.names[i] == id) + return (&(lisp__data.env.values[i])); + + if (name->a_object) { + /* Check for a symbol defined as special, but not yet bound */ + if (name->property->value == UNBOUND) + return (NULL); + + return (&(name->property->value)); + } + } + + return (name->a_object ? &(name->property->value) : NULL); +} +#endif + +/* Only removes global variables. To be called by makunbound + * Local variables are unbounded once their block is closed anyway. + */ +void +LispUnsetVar(LispObj *atom) +{ + LispAtom *name = atom->data.atom; + + if (name->package) { + int i; + LispPackage *pack = name->package->data.package.package; + + for (i = pack->glb.length - 1; i > 0; i--) + if (pack->glb.pairs[i] == atom) { + LispRemAtomObjectProperty(name); + --pack->glb.length; + if (i < pack->glb.length) + memmove(pack->glb.pairs + i, pack->glb.pairs + i + 1, + sizeof(LispObj*) * (pack->glb.length - i)); + + /* unset hint about dynamically binded variable */ + if (name->dyn) + name->dyn = 0; + break; } - return (obj->data.quote); - case LispBackquote_t: - return LispEvalBackquote(mac, obj->data.quote); - case LispComma_t: - LispDestroy(mac, "illegal comma outside of backquote"); - case LispCons_t: - cons = obj; - break; - case LispNil_t: - case LispTrue_t: - case LispReal_t: - case LispString_t: - case LispOpaque_t: - default: - /* don't {step,next}i on literals */ + } +} + +LispObj * +LispAddVar(LispObj *atom, LispObj *obj) +{ + if (lisp__data.env.length >= lisp__data.env.space) + LispMoreEnvironment(); + + LispDoAddVar(atom, obj); + + return (obj); +} + +static INLINE void +LispDoAddVar(LispObj *symbol, LispObj *value) +{ + LispAtom *atom = symbol->data.atom; + + atom->offset = lisp__data.env.length; + lisp__data.env.values[lisp__data.env.length] = value; + lisp__data.env.names[lisp__data.env.length++] = atom->string; +} + +LispObj * +LispSetVar(LispObj *atom, LispObj *obj) +{ + LispPackage *pack; + LispAtom *name; + int i, base, offset; + Atom_id id; + + name = atom->data.atom; + offset = name->offset; + id = name->string; + base = lisp__data.env.lex; + i = lisp__data.env.head - 1; + + if (offset <= i && (offset >= base || name->dyn) && + lisp__data.env.names[offset] == id) + return (lisp__data.env.values[offset] = obj); + + for (; i >= base; i--) + if (lisp__data.env.names[i] == id) { + name->offset = i; + + return (lisp__data.env.values[i] = obj); + } + + if (name->dyn) { + for (; i >= 0; i--) + if (lisp__data.env.names[i] == id) + return (lisp__data.env.values[i] = obj); + + if (name->watch) { + LispSetAtomObjectProperty(name, obj); + return (obj); + } + + return (SETVALUE(name, obj)); } - car = CAR(cons); - fun = NIL; - switch (car->type) { - case LispAtom_t: - name = car; - strname = STRPTR(name); - break; - case LispLambda_t: - name = NIL; - strname = "NIL"; - fun = car; + + if (name->a_object) { + if (name->watch) { + LispSetAtomObjectProperty(name, obj); + + return (obj); + } + + return (SETVALUE(name, obj)); + } + + LispSetAtomObjectProperty(name, obj); + + pack = name->package->data.package.package; + if (pack->glb.length >= pack->glb.space) + LispMoreGlobals(pack); + + pack->glb.pairs[pack->glb.length++] = atom; + + return (obj); +} + +void +LispProclaimSpecial(LispObj *atom, LispObj *value, LispObj *doc) +{ + int i = 0, dyn, glb; + LispAtom *name; + LispPackage *pack; + + glb = 0; + name = atom->data.atom; + pack = name->package->data.package.package; + dyn = name->dyn; + + if (!dyn) { + /* Note: don't check if a local variable already is using the symbol */ + for (i = pack->glb.length - 1; i >= 0; i--) + if (pack->glb.pairs[i] == atom) { + glb = 1; + break; + } + } + + if (dyn) { + if (name->property->value == UNBOUND && value) + /* if variable was just made special, but not bounded */ + LispSetAtomObjectProperty(name, value); + } + else if (glb) + /* Already a global variable, but not marked as special. + * Set hint about dynamically binded variable. */ + name->dyn = 1; + else { + /* create new special variable */ + LispSetAtomObjectProperty(name, value ? value : UNBOUND); + + if (pack->glb.length >= pack->glb.space) + LispMoreGlobals(pack); + + pack->glb.pairs[pack->glb.length] = atom; + ++pack->glb.length; + /* set hint about possibly dynamically binded variable */ + name->dyn = 1; + } + + if (doc != NIL) + LispAddDocumentation(atom, doc, LispDocVariable); +} + +void +LispDefconstant(LispObj *atom, LispObj *value, LispObj *doc) +{ + int i; + LispAtom *name = atom->data.atom; + LispPackage *pack = name->package->data.package.package; + + /* Unset hint about dynamically binded variable, if set. */ + name->dyn = 0; + + /* Check if variable is bounded as a global variable */ + for (i = pack->glb.length - 1; i >= 0; i--) + if (pack->glb.pairs[i] == atom) break; - default: - LispDestroy(mac, "%s is invalid as a function, at INTERNAL:EVAL", - LispStrObj(mac, car)); - /*NOTREACHED*/ + + if (i < 0) { + /* Not a global variable */ + if (pack->glb.length >= pack->glb.space) + LispMoreGlobals(pack); + + pack->glb.pairs[pack->glb.length] = atom; + ++pack->glb.length; } - ++mac->level; - frm = FRM; + /* If already a constant variable */ + if (name->constant && name->a_object && name->property->value != value) + LispWarning("constant %s is being redefined", STROBJ(atom)); + else + name->constant = 1; - if (mac->debugging) - LispDebugger(mac, LispDebugCallBegin, name, CDR(cons)); + /* Set constant value */ + LispSetAtomObjectProperty(name, value); - if (fun == NIL && name->data.atom->property) { - LispAtom *atom = name->data.atom; + if (doc != NIL) + LispAddDocumentation(atom, doc, LispDocVariable); +} - if (atom->property->builtin) { - LispObj *args; - - fn = atom->property->fun.builtin; - args = LispBuildSimpleArguments(mac, CDR(cons), strname, - fn->min_args, fn->max_args, - !fn->eval); - - res = fn->fn(mac, args, strname); - if (mac->debugging) - LispDebugger(mac, LispDebugCallEnd, name, res); - FRM = frm; - --mac->level; - - return (res); - } - - if (atom->property->function) - fun = name->data.atom->property->fun.function; - else if (atom->property->defstruct) { - LispObj *args; - int min_args, max_args; - - /* Expands call to xedit::struct-* functions. - * Besides this is a implementation dependent trick, - * I believe it is better than another implementation I wrote, - * were I added a LispBuiltin for every access function, and - * also a defsetf. This new way is hacky, but uses plenty less - * memory, and is probably faster. - * Maybe these atoms should be store in LispMac, for faster - * access. - */ - - if (atom->property->structure.function == STRUCT_CONSTRUCTOR) - atom = ATOM("XEDIT::MAKE-STRUCT")->data.atom; - else if (atom->property->structure.function == STRUCT_CHECK) - atom = ATOM("XEDIT::STRUCT-TYPE")->data.atom; - else - atom = ATOM("XEDIT::STRUCT-ACCESS")->data.atom; +void +LispAddDocumentation(LispObj *symbol, LispObj *documentation, LispDocType_t type) +{ + int length; + char *string; + LispAtom *atom; + LispObj *object; + + if (!SYMBOLP(symbol) || !STRINGP(documentation)) + LispDestroy("DOCUMENTATION: invalid argument"); + + atom = symbol->data.atom; + if (atom->documentation[type]) + LispRemDocumentation(symbol, type); + + /* allocate documentation in atomseg */ + if (atomseg.freeobj == NIL) + LispAllocSeg(&atomseg, pagesize); + length = STRLEN(documentation); + string = LispMalloc(length); + memcpy(string, THESTR(documentation), length); + string[length] = '\0'; + object = atomseg.freeobj; + atomseg.freeobj = CDR(object); + --atomseg.nfree; + + object->type = LispString_t; + THESTR(object) = string; + STRLEN(object) = length; + object->data.string.writable = 0; + atom->documentation[type] = object; + LispMused(string); +} + +void +LispRemDocumentation(LispObj *symbol, LispDocType_t type) +{ + LispAtom *atom; + + if (!SYMBOLP(symbol)) + LispDestroy("DOCUMENTATION: invalid argument"); + + atom = symbol->data.atom; + if (atom->documentation[type]) { + /* reclaim object to atomseg */ + free(THESTR(atom->documentation[type])); + CDR(atom->documentation[type]) = atomseg.freeobj; + atomseg.freeobj = atom->documentation[type]; + atom->documentation[type] = NULL; + ++atomseg.nfree; + } +} - fn = atom->property->fun.builtin; - min_args = fn->min_args > 0 ? fn->min_args - 1 : fn->min_args; - max_args = fn->max_args > 0 ? fn->max_args - 1 : fn->max_args; - args = LispBuildSimpleArguments(mac, CDR(cons), strname, - min_args, max_args, !fn->eval); +LispObj * +LispGetDocumentation(LispObj *symbol, LispDocType_t type) +{ + LispAtom *atom; + + if (!SYMBOLP(symbol)) + LispDestroy("DOCUMENTATION: invalid argument"); + + atom = symbol->data.atom; + + return (atom->documentation[type] ? atom->documentation[type] : NIL); +} + +LispObj * +LispReverse(LispObj *list) +{ + LispObj *tmp, *res = NIL; + + while (list != NIL) { + tmp = CDR(list); + CDR(list) = res; + res = list; + list = tmp; + } + + return (res); +} + +LispBlock * +LispBeginBlock(LispObj *tag, LispBlockType type) +{ + LispBlock *block; + unsigned blevel = lisp__data.block.block_level + 1; + + if (blevel > lisp__data.block.block_size) { + LispBlock **blk; + + if (blevel > MAX_STACK_DEPTH) + LispDestroy("stack overflow"); - GCProtect(); - args = CONS(name, args); - FRM = CONS(args, FRM); - GCUProtect(); + DISABLE_INTERRUPTS(); + blk = realloc(lisp__data.block.block, sizeof(LispBlock*) * (blevel + 1)); - res = fn->fn(mac, args, strname); - if (mac->debugging) - LispDebugger(mac, LispDebugCallEnd, name, res); - FRM = frm; - --mac->level; + block = NULL; + if (blk == NULL || (block = malloc(sizeof(LispBlock))) == NULL) { + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); + } + lisp__data.block.block = blk; + lisp__data.block.block[lisp__data.block.block_size] = block; + lisp__data.block.block_size = blevel; + ENABLE_INTERRUPTS(); + } + block = lisp__data.block.block[lisp__data.block.block_level]; + if (type == LispBlockCatch && !CONSTANTP(tag)) { + tag = EVAL(tag); + lisp__data.protect.objects[lisp__data.protect.length++] = tag; + } + block->type = type; + block->tag = tag; + block->stack = lisp__data.stack.length; + block->protect = lisp__data.protect.length; + block->block_level = lisp__data.block.block_level; + + lisp__data.block.block_level = blevel; + +#ifdef DEBUGGER + if (lisp__data.debugging) { + block->debug_level = lisp__data.debug_level; + block->debug_step = lisp__data.debug_step; + } +#endif - return (res); + return (block); +} + +void +LispEndBlock(LispBlock *block) +{ + lisp__data.protect.length = block->protect; + lisp__data.block.block_level = block->block_level; + +#ifdef DEBUGGER + if (lisp__data.debugging) { + if (lisp__data.debug_level >= block->debug_level) { + while (lisp__data.debug_level > block->debug_level) { + DBG = CDR(DBG); + --lisp__data.debug_level; + } } + lisp__data.debug_step = block->debug_step; } +#endif +} - if (fun != NIL) { - LispObj *args = NIL; +void +LispBlockUnwind(LispBlock *block) +{ + LispBlock *unwind; + int blevel = lisp__data.block.block_level; - if (!fun->data.lambda.key && !fun->data.lambda.optional && - !fun->data.lambda.rest) - args = LispBuildSimpleArguments(mac, CDR(cons), strname, - -1, fun->data.lambda.num_args, - fun->data.lambda.type == LispMacro); - else - args = LispBuildArguments(mac, CAR(fun->data.lambda.code), - CDR(cons), strname, - fun->data.lambda.type == LispMacro); + while (blevel > 0) { + unwind = lisp__data.block.block[--blevel]; + if (unwind->type == LispBlockProtect) { + BLOCKJUMP(unwind); + } + if (unwind == block) + /* jump above unwind block */ + break; + } +} + +static LispObj * +LispEvalBackquoteObject(LispObj *argument, int list, int quote) +{ + LispObj *result = argument, *object; - res = LispRunFunMac(mac, fun, args); - if (mac->debugging) - LispDebugger(mac, LispDebugCallEnd, fun->data.lambda.name, res); - FRM = frm; - --mac->level; + if (!POINTERP(argument)) + return (argument); - return (res); + else if (XCOMMAP(argument)) { + /* argument may need to be evaluated */ + + int atlist; + + if (!list && argument->data.comma.atlist) + /* cannot append, not in a list */ + LispDestroy("EVAL: ,@ only allowed on lists"); + + --quote; + if (quote < 0) + LispDestroy("EVAL: comma outside of backquote"); + + result = object = argument->data.comma.eval; + atlist = COMMAP(object) && object->data.comma.atlist; + + if (POINTERP(result) && (XCOMMAP(result) || XBACKQUOTEP(result))) + /* nested commas, reduce 1 level, or backquote, + * don't call LispEval or quote argument will be reset */ + result = LispEvalBackquoteObject(object, 0, quote); + + else if (quote == 0) + /* just evaluate it */ + result = EVAL(result); + + if (quote != 0) + result = result == object ? argument : COMMA(result, atlist); } - LispDestroy(mac, "the function %s is not defined", strname); - /*NOTREACHED*/ + else if (XBACKQUOTEP(argument)) { + object = argument->data.quote; - return (NIL); + result = LispEvalBackquote(object, quote + 1); + if (quote) + result = result == object ? argument : BACKQUOTE(result); + } + + else if (XQUOTEP(argument) && POINTERP(argument->data.quote) && + (XCOMMAP(argument->data.quote) || + XBACKQUOTEP(argument->data.quote) || + XCONSP(argument->data.quote))) { + /* ensures `',sym to be the same as `(quote ,sym) */ + object = argument->data.quote; + + result = LispEvalBackquote(argument->data.quote, quote); + result = result == object ? argument : QUOTE(result); + } + + return (result); } LispObj * -LispRunFunMac(LispMac *mac, LispObj *fun, LispObj *list) +LispEvalBackquote(LispObj *argument, int quote) { - volatile LispFunType type = fun->data.lambda.type; - LispObj *old_env, *old_lex, *args, *code, *res, *frm; + int protect; + LispObj *result, *object, *cons, *cdr; - old_env = ENV; - old_lex = LEX; + if (!CONSP(argument)) + return (LispEvalBackquoteObject(argument, 0, quote)); - args = CAR(fun->data.lambda.code); - code = CDR(fun->data.lambda.code); + result = cdr = NIL; + protect = lisp__data.protect.length; - LEX = ENV; + /* always generate a new list for the result, even if nothing + * is evaluated. It is not expected to use backqoutes when + * not required. */ - for (; args != NIL; args = CDR(args)) { - if (CAR(args)->type == LispCons_t) { - LispAddVar(mac, CAR(CAR(args)), CAR(list)); - list = CDR(list); + /* reserve a GC protected slot for the result */ + if (protect + 1 >= lisp__data.protect.space) + LispMoreProtects(); + lisp__data.protect.objects[lisp__data.protect.length++] = NIL; + + for (cons = argument; ; cons = CDR(cons)) { + /* if false, last argument, and if cons is not NIL, a dotted list */ + int list = CONSP(cons), insert; + + if (list) + object = CAR(cons); + else + object = cons; + + if (COMMAP(object)) + /* need to insert list elements in result, not just cons it? */ + insert = object->data.comma.atlist; + else + insert = 0; + + /* evaluate object, if required */ + if (CONSP(object)) + object = LispEvalBackquote(object, quote); + else + object = LispEvalBackquoteObject(object, insert, quote); + + if (result == NIL) { + /* if starting result list */ + if (!insert) { + if (list) + result = cdr = CONS(object, NIL); + else + result = cdr = object; + /* gc protect result */ + lisp__data.protect.objects[protect] = result; + } + else { + if (!CONSP(object)) { + result = cdr = object; + /* gc protect result */ + lisp__data.protect.objects[protect] = result; + } + else { + result = cdr = CONS(CAR(object), NIL); + /* gc protect result */ + lisp__data.protect.objects[protect] = result; + + /* add remaining elements to result */ + for (object = CDR(object); + CONSP(object); + object = CDR(object)) { + RPLACD(cdr, CONS(CAR(object), NIL)); + cdr = CDR(cdr); + } + if (object != NIL) { + /* object was a dotted list */ + RPLACD(cdr, object); + cdr = CDR(cdr); + } + } + } } - else if (STRPTR(CAR(args))[0] != '&') { - LispAddVar(mac, CAR(args), CAR(list)); - list = CDR(list); + else { + if (!CONSP(cdr)) + LispDestroy("EVAL: cannot append to %s", STROBJ(cdr)); + + if (!insert) { + if (list) { + RPLACD(cdr, CONS(object, NIL)); + cdr = CDR(cdr); + } + else { + RPLACD(cdr, object); + cdr = object; + } + } + else { + if (!CONSP(object)) { + RPLACD(cdr, object); + /* if object is NIL, it is a empty list appended, not + * creating a dotted list. */ + if (object != NIL) + cdr = object; + } + else { + for (; CONSP(object); object = CDR(object)) { + RPLACD(cdr, CONS(CAR(object), NIL)); + cdr = CDR(cdr); + } + if (object != NIL) { + /* object was a dotted list */ + RPLACD(cdr, object); + cdr = CDR(cdr); + } + } + } } + + /* if last argument list element processed */ + if (!list) + break; } + + lisp__data.protect.length = protect; + + return (result); +} + +void +LispMoreEnvironment(void) +{ + Atom_id *names; + LispObj **values; + + DISABLE_INTERRUPTS(); + names = realloc(lisp__data.env.names, + (lisp__data.env.space + 256) * sizeof(Atom_id)); + if (names != NULL) { + values = realloc(lisp__data.env.values, + (lisp__data.env.space + 256) * sizeof(LispObj*)); + if (values != NULL) { + lisp__data.env.names = names; + lisp__data.env.values = values; + lisp__data.env.space += 256; + ENABLE_INTERRUPTS(); + return; + } + else + free(names); + } + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); +} + +void +LispMoreStack(void) +{ + LispObj **values; + + DISABLE_INTERRUPTS(); + values = realloc(lisp__data.stack.values, + (lisp__data.stack.space + 256) * sizeof(LispObj*)); + if (values == NULL) { + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); + } + lisp__data.stack.values = values; + lisp__data.stack.space += 256; + ENABLE_INTERRUPTS(); +} + +void +LispMoreGlobals(LispPackage *pack) +{ + LispObj **pairs; + + DISABLE_INTERRUPTS(); + pairs = realloc(pack->glb.pairs, + (pack->glb.space + 256) * sizeof(LispObj*)); + if (pairs == NULL) { + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); + } + pack->glb.pairs = pairs; + pack->glb.space += 256; + ENABLE_INTERRUPTS(); +} + +void +LispMoreProtects(void) +{ + LispObj **objects; + + DISABLE_INTERRUPTS(); + objects = realloc(lisp__data.protect.objects, + (lisp__data.protect.space + 256) * sizeof(LispObj*)); + if (objects == NULL) { + ENABLE_INTERRUPTS(); + LispDestroy("out of memory"); + } + lisp__data.protect.objects = objects; + lisp__data.protect.space += 256; + ENABLE_INTERRUPTS(); +} + +static int +LispMakeEnvironment(LispArgList *alist, LispObj *values, + LispObj *name, int eval, int builtin) +{ + char *desc; + int i, count, base; + LispObj **symbols, **defaults, **sforms; + +#define BUILTIN_ARGUMENT(value) \ + lisp__data.stack.values[lisp__data.stack.length++] = value + +/* If the index value is from register variables, this + * can save some cpu time. Useful for normal arguments + * that are the most common, and thus the ones that + * consume more time in LispMakeEnvironment. */ +#define BUILTIN_NO_EVAL_ARGUMENT(index, value) \ + lisp__data.stack.values[index] = value + +#define NORMAL_ARGUMENT(symbol, value) \ + LispDoAddVar(symbol, value) + + if (builtin) { + base = lisp__data.stack.length; + if (base + alist->num_arguments > lisp__data.stack.space) { + do + LispMoreStack(); + while (base + alist->num_arguments > lisp__data.stack.space); + } + } + else { + base = lisp__data.env.length; + if (base + alist->num_arguments > lisp__data.env.space) { + do + LispMoreEnvironment(); + while (base + alist->num_arguments > lisp__data.env.space); + } + } + + desc = alist->description; + switch (*desc++) { + case '.': + goto normal_label; + case 'o': + goto optional_label; + case 'k': + goto key_label; + case 'r': + goto rest_label; + case 'a': + goto aux_label; + default: + goto done_label; + } + + + /* Code below is done in several almost identical loops, to avoid + * checking the value of the arguments eval and builtin too much times */ + + + /* Normal arguments */ +normal_label: + i = 0; + count = alist->normals.num_symbols; + if (builtin) { + if (eval) { + for (; i < count && CONSP(values); i++, values = CDR(values)) { + BUILTIN_ARGUMENT(EVAL(CAR(values))); + } + } + else { + for (; i < count && CONSP(values); i++, values = CDR(values)) { + BUILTIN_NO_EVAL_ARGUMENT(base + i, CAR(values)); + } + /* macro BUILTIN_NO_EVAL_ARGUMENT does not update + * lisp__data.stack.length, as there is no risk of GC while + * adding the arguments. */ + lisp__data.stack.length += i; + } + } + else { + symbols = alist->normals.symbols; + if (eval) { + for (; i < count && CONSP(values); i++, values = CDR(values)) { + NORMAL_ARGUMENT(symbols[i], EVAL(CAR(values))); + } + } + else { + for (; i < count && CONSP(values); i++, values = CDR(values)) { + NORMAL_ARGUMENT(symbols[i], CAR(values)); + } + } + } + if (i < count) + LispDestroy("%s: too few arguments", STROBJ(name)); + + switch (*desc++) { + case 'o': + goto optional_label; + case 'k': + goto key_label; + case 'r': + goto rest_label; + case 'a': + goto aux_label; + default: + goto done_label; + } + + /* &OPTIONAL */ +optional_label: + i = 0; + count = alist->optionals.num_symbols; + defaults = alist->optionals.defaults; + sforms = alist->optionals.sforms; + if (builtin) { + if (eval) { + for (; i < count && CONSP(values); i++, values = CDR(values)) + BUILTIN_ARGUMENT(EVAL(CAR(values))); + for (; i < count; i++) + BUILTIN_ARGUMENT(UNSPEC); + } + else { + for (; i < count && CONSP(values); i++, values = CDR(values)) + BUILTIN_ARGUMENT(CAR(values)); + for (; i < count; i++) + BUILTIN_ARGUMENT(UNSPEC); + } + } + else { + symbols = alist->optionals.symbols; + if (eval) { + for (; i < count && CONSP(values); i++, values = CDR(values)) { + NORMAL_ARGUMENT(symbols[i], EVAL(CAR(values))); + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], T); + } + } + } + else { + for (; i < count && CONSP(values); i++, values = CDR(values)) { + NORMAL_ARGUMENT(symbols[i], CAR(values)); + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], T); + } + } + } + + /* default arguments are evaluated for macros */ + for (; i < count; i++) { + if (!CONSTANTP(defaults[i])) { + int head = lisp__data.env.head; + int lex = lisp__data.env.lex; + + lisp__data.env.lex = base; + lisp__data.env.head = lisp__data.env.length; + NORMAL_ARGUMENT(symbols[i], EVAL(defaults[i])); + lisp__data.env.head = head; + lisp__data.env.lex = lex; + } + else { + NORMAL_ARGUMENT(symbols[i], defaults[i]); + } + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], NIL); + } + } + } + switch (*desc++) { + case 'k': + goto key_label; + case 'r': + goto rest_label; + case 'a': + goto aux_label; + default: + goto done_label; + } + + /* &KEY */ +key_label: + { + int argc, nused; + LispObj *val, *karg, **keys; + + /* Count number of remaining arguments */ + for (karg = values, argc = 0; CONSP(karg); karg = CDR(karg), argc++) { + karg = CDR(karg); + if (!CONSP(karg)) + LispDestroy("%s: &KEY needs arguments as pairs", + STROBJ(name)); + } + + + /* OPTIMIZATION: + * Builtin functions require that the keyword be in the keyword package. + * User functions don't need the arguments being pushed in the stack + * in the declared order (bytecode expects it...). + * XXX Error checking should be done elsewhere, code may be looping + * and doing error check here may consume too much cpu time. + * XXX Would also be good to already have the arguments specified in + * the correct order. + */ + + + nused = 0; + val = NIL; + count = alist->keys.num_symbols; + symbols = alist->keys.symbols; + defaults = alist->keys.defaults; + sforms = alist->keys.sforms; + if (builtin) { + + /* Arguments must be created in the declared order */ + i = 0; + if (eval) { + for (; i < count; i++) { + for (karg = values; CONSP(karg); karg = CDDR(karg)) { + /* This is only true if both point to the + * same symbol in the keyword package. */ + if (symbols[i] == CAR(karg)) { + if (karg == values) + values = CDDR(values); + ++nused; + BUILTIN_ARGUMENT(EVAL(CADR(karg))); + goto keyword_builtin_eval_used_label; + } + } + BUILTIN_ARGUMENT(UNSPEC); +keyword_builtin_eval_used_label:; + } + } + else { + for (; i < count; i++) { + for (karg = values; CONSP(karg); karg = CDDR(karg)) { + if (symbols[i] == CAR(karg)) { + if (karg == values) + values = CDDR(values); + ++nused; + BUILTIN_ARGUMENT(CADR(karg)); + goto keyword_builtin_used_label; + } + } + BUILTIN_ARGUMENT(UNSPEC); +keyword_builtin_used_label:; + } + } + + if (argc != nused) { + /* Argument(s) may be incorrectly specified, or specified + * twice (what is not an error). */ + for (karg = values; CONSP(karg); karg = CDDR(karg)) { + val = CAR(karg); + if (KEYWORDP(val)) { + for (i = 0; i < count; i++) + if (symbols[i] == val) + break; + } + else + /* Just make the error test true */ + i = count; + + if (i == count) + goto invalid_keyword_label; + } + } + } + +#if 0 + else { + /* The base offset of the atom in the stack, to check for + * keywords specified twice. */ + LispObj *symbol; + int offset = lisp__data.env.length; + + keys = alist->keys.keys; + for (karg = values; CONSP(karg); karg = CDDR(karg)) { + symbol = CAR(karg); + if (SYMBOLP(symbol)) { + /* Must be a keyword, but even if it is a keyword, may + * be a typo, so assume it is correct. If it is not + * in the argument list, it is an error. */ + for (i = 0; i < count; i++) { + if (!keys[i] && symbols[i] == symbol) { + LispAtom *atom = symbol->data.atom; + + /* Symbol found in the argument list. */ + if (atom->offset >= offset && + atom->offset < offset + nused && + lisp__data.env.names[atom->offset] == + atom->string) + /* Specified more than once... */ + goto keyword_duplicated_label; + break; + } + } + } + else { + Atom_id id; + + if (!QUOTEP(symbol) || !SYMBOLP(val = symbol->data.quote)) { + /* Bad argument. */ + val = symbol; + goto invalid_keyword_label; + } + + id = ATOMID(val); + for (i = 0; i < count; i++) { + if (keys[i] && ATOMID(keys[i]) == id) { + LispAtom *atom = val->data.atom; + + /* Symbol found in the argument list. */ + if (atom->offset >= offset && + atom->offset < offset + nused && + lisp__data.env.names[atom->offset] == + atom->string) + /* Specified more than once... */ + goto keyword_duplicated_label; + break; + } + } + } + if (i == count) { + /* Argument specification not found. */ + val = symbol; + goto invalid_keyword_label; + } + ++nused; + if (eval) { + NORMAL_ARGUMENT(symbols[i], EVAL(CADR(karg))); + } + else { + NORMAL_ARGUMENT(symbols[i], CADR(karg)); + } + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], T); + } +keyword_duplicated_label:; + } + + /* Add variables that were not specified in the function call. */ + if (nused < count) { + int j; + + for (i = 0; i < count; i++) { + Atom_id id = ATOMID(symbols[i]); + + for (j = offset + nused - 1; j >= offset; j--) { + if (lisp__data.env.names[j] == id) + break; + } + + if (j < offset) { + /* Argument not specified. Use default value */ + + /* default arguments are evaluated for macros */ + if (!CONSTANTP(defaults[i])) { + int head = lisp__data.env.head; + int lex = lisp__data.env.lex; + + lisp__data.env.lex = base; + lisp__data.env.head = lisp__data.env.length; + NORMAL_ARGUMENT(symbols[i], EVAL(defaults[i])); + lisp__data.env.head = head; + lisp__data.env.lex = lex; + } + else { + NORMAL_ARGUMENT(symbols[i], defaults[i]); + } + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], NIL); + } + } + } + } + } +#else + else { + int varset; + + sforms = alist->keys.sforms; + keys = alist->keys.keys; + + /* Add variables */ + for (i = 0; i < alist->keys.num_symbols; i++) { + val = defaults[i]; + varset = 0; + if (keys[i]) { + Atom_id atom = ATOMID(keys[i]); + + /* Special keyword specification, need to compare ATOMID + * and keyword specification must be a quoted object */ + for (karg = values; CONSP(karg); karg = CDR(karg)) { + val = CAR(karg); + if (QUOTEP(val) && atom == ATOMID(val->data.quote)) { + val = CADR(karg); + varset = 1; + ++nused; + break; + } + karg = CDR(karg); + } + } + + else { + /* Normal keyword specification, can compare object pointers, + * as they point to the same object in the keyword package */ + for (karg = values; CONSP(karg); karg = CDR(karg)) { + /* Don't check if argument is a valid keyword or + * special quoted keyword */ + if (symbols[i] == CAR(karg)) { + val = CADR(karg); + varset = 1; + ++nused; + break; + } + karg = CDR(karg); + } + } + + /* Add the variable to environment */ + if (varset) { + NORMAL_ARGUMENT(symbols[i], eval ? EVAL(val) : val); + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], T); + } + } + else { + /* default arguments are evaluated for macros */ + if (!CONSTANTP(val)) { + int head = lisp__data.env.head; + int lex = lisp__data.env.lex; + + lisp__data.env.lex = base; + lisp__data.env.head = lisp__data.env.length; + NORMAL_ARGUMENT(symbols[i], EVAL(val)); + lisp__data.env.head = head; + lisp__data.env.lex = lex; + } + else { + NORMAL_ARGUMENT(symbols[i], val); + } + if (sforms[i]) { + NORMAL_ARGUMENT(sforms[i], NIL); + } + } + } + + if (argc != nused) { + /* Argument(s) may be incorrectly specified, or specified + * twice (what is not an error). */ + for (karg = values; CONSP(karg); karg = CDDR(karg)) { + val = CAR(karg); + if (KEYWORDP(val)) { + for (i = 0; i < count; i++) + if (symbols[i] == val) + break; + } + else if (QUOTEP(val) && SYMBOLP(val->data.quote)) { + Atom_id atom = ATOMID(val->data.quote); + + for (i = 0; i < count; i++) + if (ATOMID(keys[i]) == atom) + break; + } + else + /* Just make the error test true */ + i = count; + + if (i == count) + goto invalid_keyword_label; + } + } + } +#endif + goto check_aux_label; - if (type != LispMacro) { - int did_jump = 1, *pdid_jump = &did_jump; - LispObj **pres = &res; - LispBlock *block = - LispBeginBlock(mac, fun->data.lambda.name, LispBlockClosure); - char *strname = type == LispLambda ? - "#<LAMBDA>" : STRPTR(fun->data.lambda.name), **pstrname = &strname; +invalid_keyword_label: + { + /* If not in argument specification list... */ + char function_name[36]; - *pres = NIL; - if (setjmp(block->jmp) == 0) { - *pres = Lisp_Progn(mac, code, *pstrname); - *pdid_jump = 0; + strcpy(function_name, STROBJ(name)); + LispDestroy("%s: %s is an invalid keyword", + function_name, STROBJ(val)); } - LispEndBlock(mac, block); - if (*pdid_jump) - *pres = mac->block.block_ret; } - else - res = Lisp_Progn(mac, code, STRPTR(fun->data.lambda.name)); - LEX = old_lex; - ENV = old_env; - - /* res is not gc protected, link to FRM */ - if (type == LispMacro) { - frm = FRM; - FRM = CONS(res, FRM); - res = EVAL(res); - FRM = frm; +check_aux_label: + if (*desc == 'a') { + /* &KEY uses all remaining arguments */ + values = NIL; + goto aux_label; } - - return (res); -} - -LispObj * -LispRunSetf(LispMac *mac, LispObj *setf, LispObj *place, LispObj *value) -{ - static char *fname = "INTERNAL:EXPAND-SETF"; - LispObj *old_env, *old_lex, *args, *desc, *sto, *code, *exp, *res; - - desc = CAAR(setf->data.lambda.code); - - if (setf->data.lambda.key || setf->data.lambda.optional || - setf->data.lambda.rest) - args = LispBuildArguments(mac, desc, CDR(place), fname, 1); - else - args = LispBuildSimpleArguments(mac, CDR(place), fname, -1, - setf->data.lambda.num_args, 1); + goto finished_label; - /* if no errors so far, evaluate setf parameter before setting - * setting new environment */ - value = QUOTE(EVAL(value)); - - old_env = ENV; - old_lex = LEX; - sto = CDAR(setf->data.lambda.code); - code = CDR(setf->data.lambda.code); - LEX = ENV; - - /* create new environment */ - - /* bind store value first, so gc does not need to be disabled. - * Currently, only first store argument used */ - LispAddVar(mac, CAR(sto), value); - - for (; desc != NIL; desc = CDR(desc)) { - if (CAR(desc)->type == LispCons_t) { - LispAddVar(mac, CAR(CAR(desc)), CAR(args)); - args = CDR(args); - } - else if (STRPTR(CAR(desc))[0] != '&') { - LispAddVar(mac, CAR(desc), CAR(args)); - args = CDR(args); + /* &REST */ +rest_label: + if (!CONSP(values)) { + if (builtin) { + BUILTIN_ARGUMENT(values); } + else { + NORMAL_ARGUMENT(alist->rest, values); + } + values = NIL; } - - /* build expansion macro */ - exp = Lisp_Progn(mac, code, STRPTR(setf->data.lambda.name)); + /* always allocate a new list, don't know if it will be retained */ + else if (eval) { + LispObj *cons; - /* restore enviroment */ - LEX = old_lex; - ENV = old_env; + cons = CONS(EVAL(CAR(values)), NIL); + if (builtin) { + BUILTIN_ARGUMENT(cons); + } + else { + NORMAL_ARGUMENT(alist->rest, cons); + } + values = CDR(values); + for (; CONSP(values); values = CDR(values)) { + RPLACD(cons, CONS(EVAL(CAR(values)), NIL)); + cons = CDR(cons); + } + } + else { + LispObj *cons; - /* protect expansion, and executes it */ - GCProtect(); - old_env = FRM; - FRM = CONS(exp, FRM); - GCUProtect(); - res = EVAL(exp); - FRM = old_env; + cons = CONS(CAR(values), NIL); + if (builtin) { + BUILTIN_ARGUMENT(cons); + } + else { + NORMAL_ARGUMENT(alist->rest, cons); + } + values = CDR(values); + for (; CONSP(values); values = CDR(values)) { + RPLACD(cons, CONS(CAR(values), NIL)); + cons = CDR(cons); + } + } + if (*desc != 'a') + goto finished_label; + + /* &AUX */ +aux_label: + i = 0; + count = alist->auxs.num_symbols; + defaults = alist->auxs.initials; + symbols = alist->auxs.symbols; + { + int lex = lisp__data.env.lex; + + lisp__data.env.lex = base; + lisp__data.env.head = lisp__data.env.length; + for (; i < count; i++) { + NORMAL_ARGUMENT(symbols[i], EVAL(defaults[i])); + ++lisp__data.env.head; + } + lisp__data.env.lex = lex; + } + +done_label: + if (CONSP(values)) + LispDestroy("%s: too many arguments", STROBJ(name)); + +finished_label: + if (builtin) + lisp__data.stack.base = base; + else { + lisp__data.env.head = lisp__data.env.length; + } +#undef BULTIN_ARGUMENT +#undef NORMAL_ARGUMENT +#undef BUILTIN_NO_EVAL_ARGUMENT - return (res); + return (base); } -void -LispSnprintObj(LispMac *mac, LispObj *obj, char **str, int *len, int paren) +LispObj * +LispFuncall(LispObj *function, LispObj *arguments, int eval) { - int sz; + LispAtom *atom; + LispArgList *alist; + LispBuiltin *builtin; + LispObj *lambda, *result; + int macro, base; + +#ifdef DEBUGGER + if (lisp__data.debugging) + LispDebugger(LispDebugCallBegin, function, arguments); +#endif - if (*len < 1) - return; - switch (obj->type) { - case LispNil_t: - sz = snprintf(*str, *len, "NIL"); - *len -= sz; - *str += sz; - break; - case LispTrue_t: - sz = snprintf(*str, *len, "T"); - *len -= sz; - *str += sz; - break; - case LispOpaque_t: - sz = snprintf(*str, *len, "#0x%08x-%s", (int)obj->data.opaque.data, - LispIntToOpaqueType(mac, obj->data.opaque.type)); - *len -= sz; - *str += sz; - break; + switch (OBJECT_TYPE(function)) { + case LispFunction_t: + function = function->data.atom->object; case LispAtom_t: - sz = snprintf(*str, *len, "%s", STRPTR(obj)); - *len -= sz; - *str += sz; - break; - case LispString_t: - sz = snprintf(*str, *len, "\"%s\"", STRPTR(obj)); - *len -= sz; - *str += sz; - break; - case LispCharacter_t: - sz = snprintf(*str, *len, "#\\"); - if ((*len -= sz) <= 0) - return; - *str += sz; - if (obj->data.integer >= 0 && obj->data.integer <= ' ') - sz = snprintf(*str, *len, "%s", - LispCharNames[obj->data.integer]); - else if (obj->data.integer == 0177) - sz = snprintf(*str, *len, "Rubout"); - else if (obj->data.integer > 0xff) - sz = snprintf(*str, *len, "U%04X", (int)obj->data.integer); - else - sz = snprintf(*str, *len, "%c", (int)obj->data.integer); - *str += sz; - *len -= sz; - break; - case LispReal_t: - sz = snprintf(*str, *len, "%g", obj->data.real); - *len -= sz; - *str += sz; - break; - case LispInteger_t: - sz = snprintf(*str, *len, "%ld", obj->data.integer); - *len -= sz; - *str += sz; - break; - case LispCons_t: { - LispObj *car, *cdr; - - car = CAR(obj); - cdr = CDR(obj); - if (!cdr || cdr->type == LispNil_t) { - if (paren) { - sz = snprintf(*str, *len, "("); - if ((*len -= sz) <= 0) - return; - *str += sz; - } - LispSnprintObj(mac, car, str, len, car->type == LispCons_t); - if (*len <= 0) - return; - if (paren) { - sz = snprintf(*str, *len, ")"); - if ((*len -= sz) <= 0) - return; - *str += sz; + atom = function->data.atom; + if (atom->a_builtin) { + builtin = atom->property->fun.builtin; + + if (eval) + eval = builtin->type != LispMacro; + base = LispMakeEnvironment(atom->property->alist, + arguments, function, eval, 1); + if (builtin->multiple_values) { + RETURN_COUNT = 0; + result = builtin->function(builtin); + } + else { + result = builtin->function(builtin); + RETURN_COUNT = 0; } + lisp__data.stack.base = lisp__data.stack.length = base; } - else { - if (paren) { - sz = snprintf(*str, *len, "("); - if ((*len -= sz) <= 0) - return; - *str += sz; - } - LispSnprintObj(mac, car, str, len, car->type == LispCons_t); - if (*len <= 0) - return; - if (cdr->type != LispCons_t) { - sz = snprintf(*str, *len, " . "); - if ((*len -= sz) <= 0) - return; - *str += sz; - LispSnprintObj(mac, cdr, str, len, 0); + else if (atom->a_compiled) { + int lex = lisp__data.env.lex; + lambda = atom->property->fun.function; + alist = atom->property->alist; + + base = LispMakeEnvironment(alist, arguments, function, eval, 0); + lisp__data.env.lex = base; + result = LispExecuteBytecode(lambda); + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = base; + } + else if (atom->a_function) { + lambda = atom->property->fun.function; + macro = lambda->funtype == LispMacro; + alist = atom->property->alist; + + lambda = lambda->data.lambda.code; + if (eval) + eval = !macro; + base = LispMakeEnvironment(alist, arguments, function, eval, 0); + result = LispRunFunMac(function, lambda, macro, base); + } + else if (atom->a_defstruct && + atom->property->structure.function != STRUCT_NAME) { + LispObj cons; + + if (atom->property->structure.function == STRUCT_CONSTRUCTOR) + atom = Omake_struct->data.atom; + else if (atom->property->structure.function == STRUCT_CHECK) + atom = Ostruct_type->data.atom; + else + atom = Ostruct_access->data.atom; + builtin = atom->property->fun.builtin; + + cons.type = LispCons_t; + cons.data.cons.cdr = arguments; + if (eval) { + LispObj quote; + + quote.type = LispQuote_t; + quote.data.quote = function; + cons.data.cons.car = "e; + base = LispMakeEnvironment(atom->property->alist, + &cons, function, 1, 1); } else { - sz = snprintf(*str, *len, " "); - if ((*len -= sz) <= 0) - return; - *str += sz; - LispSnprintObj(mac, cdr, str, len, car->type != LispCons_t && - cdr->type != LispCons_t); - if (*len <= 0) - return; - } - if (paren) { - sz = snprintf(*str, *len, ")"); - *len -= sz; - *str += sz; + cons.data.cons.car = function; + base = LispMakeEnvironment(atom->property->alist, + &cons, function, 0, 1); } + result = builtin->function(builtin); + RETURN_COUNT = 0; + lisp__data.stack.length = base; } - } break; - case LispQuote_t: - sz = snprintf(*str, *len, "'"); - *len -= sz; - *str += sz; - LispSnprintObj(mac, obj->data.quote, str, len, 1); - break; - case LispBackquote_t: - sz = snprintf(*str, *len, "`"); - *len -= sz; - *str += sz; - LispSnprintObj(mac, obj->data.quote, str, len, 1); + else { + LispDestroy("EVAL: the function %s is not defined", + STROBJ(function)); + /*NOTREACHED*/ + result = NIL; + } break; - case LispComma_t: - if (obj->data.comma.atlist) - sz = snprintf(*str, *len, ",@"); - else - sz = snprintf(*str, *len, ","); - *len -= sz; - *str += sz; - LispSnprintObj(mac, obj->data.comma.eval, str, len, 1); + case LispLambda_t: + lambda = function->data.lambda.code; + alist = (LispArgList*)function->data.lambda.name->data.opaque.data; + base = LispMakeEnvironment(alist, arguments, function, eval, 0); + result = LispRunFunMac(function, lambda, 0, base); break; - case LispArray_t: - if (obj->data.array.rank == 1) - sz = snprintf(*str, *len, "#("); - else - sz = snprintf(*str, *len, "#%dA(", obj->data.array.rank); - if ((*len -= sz) <= 0) - return; - *str += sz; - if (!obj->data.array.zero) { - if (obj->data.array.rank == 1) { - LispObj *ary; - long count; - - for (ary = obj->data.array.dim, count = 1; - ary != NIL; ary = CDR(ary)) - count *= (int)NUMBER_VALUE(CAR(ary)); - for (ary = obj->data.array.list; count > 0; - ary = CDR(ary), count--) { - LispSnprintObj(mac, CAR(ary), str, len, 0); - if (*len <= 0) - return; - if (count - 1 > 0) { - sz = snprintf(*str, *len, " "); - if ((*len -= sz) <= 0) - return; - *str += sz; - } - } - } - else { - LispObj *ary; - int i, k, rank, *dims, *loop; - - rank = obj->data.array.rank; - dims = LispMalloc(mac, sizeof(int) * rank); - loop = LispCalloc(mac, 1, sizeof(int) * (rank - 1)); - - /* fill dim */ - for (i = 0, ary = obj->data.array.dim; ary != NIL; - i++, ary = CDR(ary)) - dims[i] = (int)NUMBER_VALUE(CAR(ary)); - - i = 0; - ary = obj->data.array.list; - while (loop[0] < dims[0]) { - for (; i < rank - 1; i++) { - sz = snprintf(*str, *len, "("); - if ((*len -= sz) <= 0) - goto snprint_array_done; - *str += sz; - } - --i; - for (;;) { - ++loop[i]; - if (i && loop[i] >= dims[i]) - loop[i] = 0; - else - break; - --i; - } - for (k = 0; k < dims[rank - 1] - 1; k++, ary = CDR(ary)) { - LispSnprintObj(mac, CAR(ary), str, len, 0); - if (*len <= 0) - goto snprint_array_done; - sz = snprintf(*str, *len, " "); - if ((*len -= sz) <= 0) - goto snprint_array_done; - *str += sz; - } - LispSnprintObj(mac, CAR(ary), str, len, 1); - if (*len <= 0) - goto snprint_array_done; - ary = CDR(ary); - for (k = rank - 1; k > i; k--) { - sz = snprintf(*str, *len, ")"); - if ((*len -= sz) <= 0) - goto snprint_array_done; - *str += sz; - } - if (loop[0] < dims[0]) { - sz = snprintf(*str, *len, " "); - if ((*len -= sz) <= 0) - goto snprint_array_done; - *str += sz; - } - } - -snprint_array_done: - LispFree(mac, dims); - LispFree(mac, loop); + case LispCons_t: + if (CAR(function) == Olambda) { + function = EVAL(function); + if (LAMBDAP(function)) { + GC_ENTER(); + + GC_PROTECT(function); + lambda = function->data.lambda.code; + alist = (LispArgList*)function->data.lambda.name->data.opaque.data; + base = LispMakeEnvironment(alist, arguments, NIL, eval, 0); + result = LispRunFunMac(NIL, lambda, 0, base); + GC_LEAVE(); + break; } } - sz = snprintf(*str, *len, ")"); - *len -= sz; - *str += sz; + default: + LispDestroy("EVAL: %s is invalid as a function", + STROBJ(function)); + /*NOTREACHED*/ + result = NIL; break; - case LispStruct_t: { - LispObj *def = obj->data.struc.def; - LispObj *field = obj->data.struc.fields; + } - sz = snprintf(*str, *len, "S#(%s", STRPTR(CAR(def))); - if ((*len -= sz) <= 0) - return; - *str += sz; - def = CDR(def); - for (; def != NIL; def = CDR(def), field = CDR(field)) { - sz = snprintf(*str, *len, " :%s ", SYMBOL_P(CAR(def)) ? - STRPTR(CAR(def)) : STRPTR(CAR(CAR(def)))); - if ((*len -= sz) <= 0) - return; - *str += sz; - LispSnprintObj(mac, CAR(field), str, len, 1); - if (*len <= 0) - return; - } - sz = snprintf(*str, *len, ")"); - *len -= sz; - *str += sz; - } break; +#ifdef DEBUGGER + if (lisp__data.debugging) + LispDebugger(LispDebugCallEnd, function, result); +#endif + + return (result); +} + +LispObj * +LispEval(LispObj *object) +{ + LispObj *result; + + switch (OBJECT_TYPE(object)) { + case LispAtom_t: + if ((result = LispDoGetVar(object)) == NULL) + LispDestroy("EVAL: the variable %s is unbound", STROBJ(object)); + break; + case LispCons_t: + result = LispFuncall(CAR(object), CDR(object), 1); + break; + case LispQuote_t: + result = object->data.quote; + break; + case LispFunctionQuote_t: + result = object->data.quote; + if (SYMBOLP(result)) + result = LispSymbolFunction(result); + else if (CONSP(result) && CAR(result) == Olambda) + result = EVAL(result); + else + LispDestroy("FUNCTION: %s is not a function", STROBJ(result)); + break; + case LispBackquote_t: + result = LispEvalBackquote(object->data.quote, 1); + break; + case LispComma_t: + LispDestroy("EVAL: comma outside of backquote"); default: + result = object; break; } + + return (result); } -char * -LispStrObj(LispMac *mac, LispObj *obj) +LispObj * +LispApply1(LispObj *function, LispObj *argument) { - static char string[12]; + LispObj arguments; - LispSnprint(mac, obj, string, sizeof(string) - 1); - return (string); + arguments.type = LispCons_t; + arguments.data.cons.car = argument; + arguments.data.cons.cdr = NIL; + + return (LispFuncall(function, &arguments, 0)); } -void -LispSnprint(LispMac *mac, LispObj *obj, char *str, int len) +LispObj * +LispApply2(LispObj *function, LispObj *argument1, LispObj *argument2) { - char *s = str; - int l = len; + LispObj arguments, cdr; - if (!obj || !str || len <= 0) - LispDestroy(mac, "internal error, at INTERNAL:SPRINT"); - LispSnprintObj(mac, obj, &str, &len, 1); - if (len <= 0) { - /* this is a internal function, so I assume that str has enough space */ - if (*s == '(') - strcpy(s + l - 5, "...)"); - else - strcpy(s + l - 4, "..."); - } + arguments.type = cdr.type = LispCons_t; + arguments.data.cons.car = argument1; + arguments.data.cons.cdr = &cdr; + cdr.data.cons.car = argument2; + cdr.data.cons.cdr = NIL; + + return (LispFuncall(function, &arguments, 0)); } -/* assumes string is writable, escapes " as \" and \ as \\ */ -int -LispPrintString(LispMac *mac, LispObj *stream, char *str) +LispObj * +LispApply3(LispObj *function, LispObj *arg1, LispObj *arg2, LispObj *arg3) { - int len, ch; - char *prt, *ptr, *pquote, *pslash; + LispObj arguments, car, cdr; - if (!mac->princ) { - len = LispPrintf(mac, stream, "%c", '"'); - for (prt = str, pquote = strchr(prt, '"'), pslash = strchr(prt, '\\'); - pquote || pslash; - prt = ptr, pquote = pquote ? strchr(prt, '"') : NULL, - pslash = pslash ? strchr(prt, '\\') : NULL) { - if (pquote && pslash) - ptr = pquote < pslash ? pquote : pslash; - else - ptr = pquote ? pquote : pslash; - ch = ptr == pquote ? '"' : '\\'; - *ptr = '\0'; - len += LispPrintf(mac, stream, "%s", prt); - len += LispPrintf(mac, stream, "%c%c", '\\', ch); - *ptr = ch; - ++ptr; - } - len += LispPrintf(mac, stream, "%s", prt); - len += LispPrintf(mac, stream, "%c", '"'); - } - else - len = LispPrintf(mac, stream, "%s", str); + arguments.type = car.type = cdr.type = LispCons_t; + arguments.data.cons.car = arg1; + arguments.data.cons.cdr = &car; + car.data.cons.car = arg2; + car.data.cons.cdr = &cdr; + cdr.data.cons.car = arg3; + cdr.data.cons.cdr = NIL; - return (len); + return (LispFuncall(function, &arguments, 0)); } -int -LispPrintf(LispMac *mac, LispObj *stream, char *fmt, ...) +static LispObj * +LispRunFunMac(LispObj *name, LispObj *code, int macro, int base) { - int size; - va_list ap; - FILE *fp = NULL; + LispObj *result = NIL; - if (stream == NIL) - fp = lisp_stdout; - else if (stream->data.stream.size < 0) - fp = stream->data.stream.source.fp; + if (!macro) { + int lex = lisp__data.env.lex; + int did_jump = 1, *pdid_jump; + LispObj **pcode, **presult; + LispBlock *block; - va_start(ap, fmt); - if (fp && !mac->justsize) - size = vfprintf(fp, fmt, ap); + block = LispBeginBlock(name, LispBlockClosure); + lisp__data.env.lex = base; + if (setjmp(block->jmp) == 0) { + for (pcode = &code, presult = &result, pdid_jump = &did_jump; + CONSP(code); code = CDR(code)) + result = EVAL(CAR(code)); + did_jump = 0; + } + LispEndBlock(block); + if (did_jump) + result = lisp__data.block.block_ret; + lisp__data.env.lex = lex; + lisp__data.env.head = lisp__data.env.length = base; + } else { - int n; - unsigned char stk[1024], *ptr = stk; + GC_ENTER(); - size = sizeof(stk); - n = vsnprintf((char*)stk, size, fmt, ap); - if (n < 0 || n >= size) { - while (1) { - char *tmp; - - va_end(ap); - if (n > size) - size = n + 1; - else - size *= 2; - if ((tmp = realloc(ptr, size)) == NULL) { - free(ptr); - LispDestroy(mac, "out of memory"); - } - va_start(ap, fmt); - n = vsnprintf((char*)ptr, size, fmt, ap); - if (n >= 0 && n < size) - break; - } - } - size = strlen((char*)ptr); + for (; CONSP(code); code = CDR(code)) + result = EVAL(CAR(code)); + /* FIXME this does not work if macro has &aux variables, + * but there are several other missing features, like + * destructuring and more lambda list keywords still missing. + * TODO later. + */ + lisp__data.env.head = lisp__data.env.length = base; - if (!mac->justsize) { - while (stream->data.stream.idx + size >= stream->data.stream.size) { - unsigned char *tmp = realloc(stream->data.stream.source.str, - stream->data.stream.size + pagesize); - - if (tmp == NULL) { - if (ptr != stk) - free(ptr); - LispDestroy(mac, "out of memory"); - } - stream->data.stream.source.str = tmp; - stream->data.stream.size += pagesize; - } - strcpy((char*)stream->data.stream.source.str + - stream->data.stream.idx, (char*)ptr); - stream->data.stream.idx += size; - } - if (ptr != stk) - free(ptr); + GC_PROTECT(result); + result = EVAL(result); + GC_LEAVE(); } - va_end(ap); - return (size); + return (result); } -int -LispPrintObj(LispMac *mac, LispObj *stream, LispObj *obj, int paren) +LispObj * +LispRunSetf(LispArgList *alist, LispObj *setf, LispObj *place, LispObj *value) { - int len = 0; + GC_ENTER(); + LispObj *store, *code, *expression, *result, quote; + int base; + + code = setf->data.lambda.code; + store = setf->data.lambda.data; + + quote.type = LispQuote_t; + quote.data.quote = value; + LispDoAddVar(CAR(store), "e); + ++lisp__data.env.head; + base = LispMakeEnvironment(alist, place, Oexpand_setf_method, 0, 0); - switch (obj->type) { - case LispNil_t: - len += LispPrintf(mac, stream, "NIL"); - break; - case LispTrue_t: - len += LispPrintf(mac, stream, "T"); - break; - case LispOpaque_t: - len += LispPrintf(mac, stream, "#0x%08x-%s", - (int)obj->data.opaque.data, - LispIntToOpaqueType(mac, obj->data.opaque.type)); - break; - case LispAtom_t: - len += LispPrintf(mac, stream, "%s", STRPTR(obj)); - break; - case LispString_t: - len += LispPrintString(mac, stream, STRPTR(obj)); - break; - case LispCharacter_t: - if (!mac->princ) - len += LispPrintf(mac, stream, "#\\"); - if (obj->data.integer >= 0 && obj->data.integer <= ' ') - len += LispPrintf(mac, stream, "%s", - LispCharNames[obj->data.integer]); - else if (obj->data.integer == 0177) - len += LispPrintf(mac, stream, "Rubout"); - else if (obj->data.integer > 0xff) - len += LispPrintf(mac, stream, "U%04X", (int)obj->data.integer); - else - len += LispPrintf(mac, stream, "%c", obj->data.integer); - break; - case LispReal_t: - len += LispPrintf(mac, stream, "%g", obj->data.real); - break; - case LispInteger_t: - len += LispPrintf(mac, stream, "%ld", obj->data.integer); - break; - case LispCons_t: { - LispObj *car, *cdr; - - car = CAR(obj); - cdr = CDR(obj); - if (!cdr || cdr->type == LispNil_t) { - if (paren) - len += LispPrintf(mac, stream, "("); - len += LispPrintObj(mac, stream, car, car->type == LispCons_t); - if (paren) - len += LispPrintf(mac, stream, ")"); - } - else { - if (paren) - len += LispPrintf(mac, stream, "("); - LispPrintObj(mac, stream, car, car->type == LispCons_t); - if (cdr->type != LispCons_t) { - len += LispPrintf(mac, stream, " . "); - len += LispPrintObj(mac, stream, cdr, 0); - } - else { - len += LispPrintf(mac, stream, " "); - len += LispPrintObj(mac, stream, cdr, - car->type != LispCons_t && - cdr->type != LispCons_t); - } - if (paren) - len += LispPrintf(mac, stream, ")"); - } - } break; - case LispQuote_t: - len += LispPrintf(mac, stream, "'"); - len += LispPrintObj(mac, stream, obj->data.quote, 1); - break; - case LispBackquote_t: - len += LispPrintf(mac, stream, "`"); - len += LispPrintObj(mac, stream, obj->data.quote, 1); - break; - case LispComma_t: - if (obj->data.comma.atlist) - len += LispPrintf(mac, stream, ",@"); - else - len += LispPrintf(mac, stream, ","); - len += LispPrintObj(mac, stream, obj->data.comma.eval, 1); - break; - case LispArray_t: - if (obj->data.array.rank == 1) - len += LispPrintf(mac, stream, "#("); - else - len += LispPrintf(mac, stream, "#%dA(", obj->data.array.rank); + /* build expansion macro */ + expression = NIL; + for (; CONSP(code); code = CDR(code)) + expression = EVAL(CAR(code)); - if (!obj->data.array.zero) { - if (obj->data.array.rank == 1) { - LispObj *ary; - long count; - - for (ary = obj->data.array.dim, count = 1; - ary != NIL; ary = CDR(ary)) - count *= (int)NUMBER_VALUE(CAR(ary)); - for (ary = obj->data.array.list; count > 0; - ary = CDR(ary), count--) { - len += LispPrintObj(mac, stream, CAR(ary), 0); - if (count - 1 > 0) - len += LispPrintf(mac, stream, " "); - } - } - else { - LispObj *ary; - int i, k, rank, *dims, *loop; + /* Minus 1 to pop the added variable */ + lisp__data.env.head = lisp__data.env.length = base - 1; - rank = obj->data.array.rank; - dims = LispMalloc(mac, sizeof(int) * rank); - loop = LispCalloc(mac, 1, sizeof(int) * (rank - 1)); - - /* fill dim */ - for (i = 0, ary = obj->data.array.dim; ary != NIL; - i++, ary = CDR(ary)) - dims[i] = (int)NUMBER_VALUE(CAR(ary)); - - i = 0; - ary = obj->data.array.list; - while (loop[0] < dims[0]) { - for (; i < rank - 1; i++) - len += LispPrintf(mac, stream, "("); - --i; - for (;;) { - ++loop[i]; - if (i && loop[i] >= dims[i]) - loop[i] = 0; - else - break; - --i; - } - for (k = 0; k < dims[rank - 1] - 1; k++, ary = CDR(ary)) { - len += LispPrintObj(mac, stream, CAR(ary), 1); - len += LispPrintf(mac, stream, " "); - } - len += LispPrintObj(mac, stream, CAR(ary), 0); - ary = CDR(ary); - for (k = rank - 1; k > i; k--) - len += LispPrintf(mac, stream, ")"); - if (loop[0] < dims[0]) - len += LispPrintf(mac, stream, " "); - } - LispFree(mac, dims); - LispFree(mac, loop); - } - } - len += LispPrintf(mac, stream, ")"); - break; - case LispStruct_t: { - LispObj *def = obj->data.struc.def; - LispObj *field = obj->data.struc.fields; - - len += LispPrintf(mac, stream, "S#(%s", STRPTR(CAR(def))); - def = CDR(def); - for (; def != NIL; def = CDR(def), field = CDR(field)) { - len += LispPrintf(mac, stream, " :%s ", - SYMBOL_P(CAR(def)) ? - STRPTR(CAR(def)) : - STRPTR(CAR(CAR(def)))); - len += LispPrintObj(mac, stream, CAR(field), 1); - } - len += LispPrintf(mac, stream, ")"); - } break; - case LispLambda_t: - switch (obj->data.lambda.type) { - case LispLambda: - len += LispPrintf(mac, stream, "#<LAMBDA "); - break; - case LispFunction: - len += LispPrintf(mac, stream, "#<FUNCTION %s ", - STRPTR(obj->data.lambda.name)); - break; - case LispMacro: - len += LispPrintf(mac, stream, "#<MACRO %s ", - STRPTR(obj->data.lambda.name)); - break; - case LispSetf: - len += LispPrintf(mac, stream, "#<SETF %s ", - STRPTR(obj->data.lambda.name)); - break; - } - len += LispPrintObj(mac, stream, obj->data.lambda.code, 1); - len += LispPrintf(mac, stream, ">"); - break; - case LispStream_t: - if (obj->data.stream.size < 0) - len += LispPrintf(mac, stream, "#<STREAM 0x%8x>", - (int)obj->data.stream.source.fp); - else - len += LispPrintString(mac, stream, - obj->data.stream.source.str ? - (char*)obj->data.stream.source.str : ""); - break; + /* protect expansion, and executes it */ + GC_PROTECT(expression); + result = EVAL(expression); + GC_LEAVE(); + + return (result); +} + +LispObj * +LispRunSetfMacro(LispAtom *atom, LispObj *arguments, LispObj *value) +{ + int base; + GC_ENTER(); + LispObj *place, *body, *result, quote; + + place = NIL; + base = LispMakeEnvironment(atom->property->alist, + arguments, atom->object, 0, 0); + body = atom->property->fun.function->data.lambda.code; + + /* expand macro body */ + for (; CONSP(body); body = CDR(body)) + place = EVAL(CAR(body)); + + /* protect expansion */ + GC_PROTECT(place); + + /* restore environment */ + lisp__data.env.head = lisp__data.env.length = base; + + /* value is already evaluated */ + quote.type = LispQuote_t; + quote.data.quote = value; + + /* call setf again */ + result = APPLY2(Osetf, place, "e); + + GC_LEAVE(); + + return (result); +} + +char * +LispStrObj(LispObj *object) +{ + static int first = 1; + static char buffer[34]; + static LispObj stream; + static LispString string; + + if (first) { + stream.type = LispStream_t; + stream.data.stream.source.string = &string; + stream.data.stream.pathname = NIL; + stream.data.stream.type = LispStreamString; + stream.data.stream.readable = 0; + stream.data.stream.writable = 1; + + string.string = buffer; + string.fixed = 1; + string.space = sizeof(buffer) - 1; + first = 0; + } + + string.length = string.output = 0; + + LispWriteObject(&stream, object); + + /* make sure string is nul terminated */ + string.string[string.length] = '\0'; + if (string.length >= 32) { + if (buffer[0] == '(') + strcpy(buffer + 27, "...)"); + else + strcpy(buffer + 28, "..."); } - return (len); + return (buffer); } void -LispPrint(LispMac *mac, LispObj *obj, LispObj *stream, int newline) +LispPrint(LispObj *object, LispObj *stream, int newline) { - if (!obj || !stream) - LispDestroy(mac, "internal error, at INTERNAL:PRINT"); - if (stream != NIL && stream->type != LispStream_t) - LispDestroy(mac, "%s is not a stream", LispStrObj(mac, stream)); - if (newline && !mac->newline) { - LispPrintf(mac, stream, "\n"); - mac->column = 0; + if (stream != NIL && !STREAMP(stream)) { + LispDestroy("PRINT: %s is not a stream", STROBJ(stream)); } - /* XXX maybe should check for newlines in object */ - mac->column = LispPrintObj(mac, stream, obj, 1); - mac->newline = 0; - fflush(lisp_stdout); + if (newline && LispGetColumn(stream)) + LispWriteChar(stream, '\n'); + LispWriteObject(stream, object); + if (stream == NIL || (stream->data.stream.type == LispStreamStandard && + stream->data.stream.source.file == Stdout)) + LispFflush(Stdout); } void -LispUpdateResults(LispMac *mac, LispObj *cod, LispObj *res) +LispUpdateResults(LispObj *cod, LispObj *res) { - GCProtect(); - LispSetVar(mac, RUN[2], LispGetVar(mac, RUN[1])); - LispSetVar(mac, RUN[1], LispGetVar(mac, RUN[0])); - LispSetVar(mac, RUN[0], cod); - - LispSetVar(mac, RES[2], LispGetVar(mac, RES[1])); - LispSetVar(mac, RES[1], LispGetVar(mac, RES[0])); - LispSetVar(mac, RES[0], res); - GCUProtect(); + LispSetVar(RUN[2], LispGetVar(RUN[1])); + LispSetVar(RUN[1], LispGetVar(RUN[0])); + LispSetVar(RUN[0], cod); + + LispSetVar(RES[2], LispGetVar(RES[1])); + LispSetVar(RES[1], LispGetVar(RES[0])); + LispSetVar(RES[0], res); } -/* Needs a rewrite to either allow only one LispMac per process or some - * smarter error handling */ -static LispMac *global_mac = NULL; - #ifdef SIGNALRETURNSINT int -LispAbortSignal(int signum) +#else +void +#endif +LispSignalHandler(int signum) { - if (global_mac != NULL) - LispDestroy(global_mac, "aborted"); + LispSignal(signum); +#ifdef SIGNALRETURNSINT + return (0); +#endif } -int -LispFPESignal(int signum) +void +LispSignal(int signum) { - if (global_mac != NULL) - LispDestroy(global_mac, "Floating point exception"); + char *errstr; + char buffer[32]; + + if (lisp__disable_int) { + lisp__interrupted = signum; + return; + } + switch (signum) { + case SIGINT: + errstr = "interrupted"; + break; + case SIGFPE: + errstr = "floating point exception"; + break; + default: + sprintf(buffer, "signal %d received", signum); + errstr = buffer; + break; + } + LispDestroy(errstr); } -#else + void -LispAbortSignal(int signum) +LispDisableInterrupts(void) { - if (global_mac != NULL) - LispDestroy(global_mac, "aborted"); + ++lisp__disable_int; } void -LispFPESignal(int signum) +LispEnableInterrupts(void) { - if (global_mac != NULL) - LispDestroy(global_mac, "Floating point exception"); + --lisp__disable_int; + if (lisp__disable_int <= 0 && lisp__interrupted) + LispSignal(lisp__interrupted); } -#endif void -LispMachine(LispMac *mac) +LispMachine(void) { LispObj *cod, *obj; - LispTopLevel(mac); + lisp__data.sigint = signal(SIGINT, LispSignalHandler); + lisp__data.sigfpe = signal(SIGFPE, LispSignalHandler); + /*CONSTCOND*/ while (1) { - mac->sigint = signal(SIGINT, LispAbortSignal); - mac->sigfpe = signal(SIGFPE, LispFPESignal); - global_mac = mac; - if (sigsetjmp(mac->jmp, 1) == 0) { - mac->running = 1; - if (mac->interactive && mac->prompt) { - fprintf(lisp_stdout, "%s", mac->prompt); - fflush(lisp_stdout); - } - mac->level = 0; - if ((cod = LispRun(mac)) != NULL) { - if (cod == EOLIST) - LispDestroy(mac, "object cannot start with #\\)"); + if (sigsetjmp(lisp__data.jmp, 1) == 0) { + lisp__data.running = 1; + if (lisp__data.interactive && lisp__data.prompt) { + LispFputs(Stdout, lisp__data.prompt); + LispFflush(Stdout); + } + if ((cod = LispRead()) != NULL) { obj = EVAL(cod); - if (mac->interactive) { - LispPrint(mac, obj, NIL, 1); - LispUpdateResults(mac, cod, obj); - if (!mac->newline) { - LispPrintf(mac, NIL, "\n"); - mac->newline = 1; - mac->column = 0; + if (lisp__data.interactive) { + if (RETURN_COUNT >= 0) + LispPrint(obj, NIL, 1); + if (RETURN_COUNT > 0) { + int i; + + for (i = 0; i < RETURN_COUNT; i++) + LispPrint(RETURN(i), NIL, 1); } + LispUpdateResults(cod, obj); + if (LispGetColumn(NIL)) + LispWriteChar(NIL, '\n'); } } - signal(SIGINT, mac->sigint); - signal(SIGFPE, mac->sigfpe); - global_mac = NULL; - LispTopLevel(mac); - if (mac->tok == EOF) - break; - continue; + LispTopLevel(); } - signal(SIGINT, mac->sigint); - signal(SIGFPE, mac->sigfpe); - global_mac = NULL; + if (lisp__data.eof) + break; } - mac->running = 0; + + signal(SIGINT, lisp__data.sigint); + signal(SIGFPE, lisp__data.sigfpe); + + lisp__data.running = 0; } -void -LispExecute(LispMac *mac, char *str) +void * +LispExecute(char *str) { - int level, running = mac->running; - LispObj *obj; + static LispObj stream; + static LispString string; + static int first = 1; - if (str == NULL || *str == '\0') - return; + int running = lisp__data.running; + LispObj *result, *cod, *obj, **presult = &result; - if (mac->stream.stream_level + 1 >= mac->stream.stream_size) { - LispStream *stream = (LispStream*) - realloc(mac->stream.stream, sizeof(LispStream) * - (mac->stream.stream_size + 1)); + if (str == NULL || *str == '\0') + return (NIL); - if (stream == NULL) { - fprintf(lisp_stderr, "out of memory"); - return; - } + *presult = NIL; - mac->stream.stream = stream; - ++mac->stream.stream_size; + if (first) { + stream.type = LispStream_t; + stream.data.stream.source.string = &string; + stream.data.stream.pathname = NIL; + stream.data.stream.type = LispStreamString; + stream.data.stream.readable = 1; + stream.data.stream.writable = 0; + string.output = 0; + first = 0; + } + string.string = str; + string.length = strlen(str); + string.input = 0; + + LispPushInput(&stream); + if (!running) { + lisp__data.running = 1; + if (sigsetjmp(lisp__data.jmp, 1) != 0) + return (NULL); } - mac->stream.stream[mac->stream.stream_level].fp = mac->fp; - mac->stream.stream[mac->stream.stream_level].st = mac->st; - mac->stream.stream[mac->stream.stream_level].cp = mac->cp; - mac->stream.stream[mac->stream.stream_level].tok = mac->tok; - ++mac->stream.stream_level; - memset(mac->stream.stream + mac->stream.stream_level, 0, sizeof(LispStream)); - mac->stream.stream[mac->stream.stream_level].fp = NULL; - mac->fp = NULL; - mac->st = mac->cp = LispStrdup(mac, str); - mac->tok = 0; - - level = mac->level; - mac->level = 0; - - if (running || sigsetjmp(mac->jmp, 1) == 0) { - if (!running) - mac->running = 1; - - /*CONSTCOND*/ - while (1) { - if ((obj = LispRun(mac)) != NULL) { - if (obj == EOLIST) - LispDestroy(mac, "object cannot start with #\\)"); - GCProtect(); - (void)EVAL(obj); - GCUProtect(); - } - if (mac->tok == EOF) - break; + + cod = COD; + /*CONSTCOND*/ + while (1) { + if ((obj = LispRead()) != NULL) { + result = EVAL(obj); + COD = cod; } + if (lisp__data.eof) + break; + } + LispPopInput(&stream); - LispFree(mac, mac->st); - mac->level = level; - --mac->stream.stream_level; + lisp__data.running = running; - mac->fp = mac->stream.stream[mac->stream.stream_level].fp; - mac->st = mac->stream.stream[mac->stream.stream_level].st; - mac->cp = mac->stream.stream[mac->stream.stream_level].cp; - mac->tok = mac->stream.stream[mac->stream.stream_level].tok; - } - mac->running = running; + return (result); } -LispMac * -LispBegin(int argc, char *argv[]) +void +LispBegin(void) { int i; + LispAtom *atom; char results[4]; - char *fname = "INTERNAL:BEGIN"; - LispMac *mac = malloc(sizeof(LispMac)); + LispObj *object, *path, *ext; - if (mac == NULL) - return (NULL); - - if (lisp_stdin == NULL) - lisp_stdin = fdopen(0, "r"); - if (lisp_stdout == NULL) - lisp_stdout = fdopen(1, "w"); - if (lisp_stderr == NULL) - lisp_stderr = fdopen(2, "w"); - - pagesize = GetPageSize(); + pagesize = LispGetPageSize(); segsize = pagesize / sizeof(LispObj); - bzero((char*)mac, sizeof(LispMac)); - MOD = ENV = GLB = LEX = COD = FRM = DBG = BRK = PRO = NIL; - LispAllocSeg(mac); - - /* initialize stream management */ - mac->stream.stream = (LispStream*)calloc(1, sizeof(LispStream)); - if (argc > 1) { - i = 1; - - if (strcmp(argv[1], "-d") == 0) { - mac->debugging = 1; - mac->debug_level = -1; - ++i; - } - if (i < argc && - (mac->stream.stream[0].fp = mac->fp = fopen(argv[i], "r")) == NULL) { - fprintf(lisp_stderr, "Cannot open %s.\n", argv[i]); - exit(1); - } - } - if (mac->fp == NULL) { - mac->stream.stream[0].fp = mac->fp = lisp_stdin; - mac->interactive = 1; - } - else { - int ch = LispGet(mac); - if (ch != '#') - LispUnget(mac); - else if (LispGet(mac) == '!') { - for (;;) { - ch = LispGet(mac); - if (ch == '\n' || ch == EOF) - break; - } - } - else { - LispUnget(mac); - LispUnget(mac); - } - } - mac->stream.stream_size = 1; + /* Initialize memory management */ + lisp__data.mem.mem = (void**)calloc(lisp__data.mem.space = 16, + sizeof(void*)); + lisp__data.mem.index = lisp__data.mem.level = 0; + + /* Allow LispGetVar to check ATOMID() of unbound symbols */ + UNBOUND->data.atom = (LispAtom*)LispCalloc(1, sizeof(LispAtom)); + LispMused(UNBOUND->data.atom); + noproperty.value = UNBOUND; + + if (Stdin == NULL) + Stdin = LispFdopen(0, FILE_READ); + if (Stdout == NULL) + Stdout = LispFdopen(1, FILE_WRITE | FILE_BUFFERED); + if (Stderr == NULL) + Stderr = LispFdopen(2, FILE_WRITE); + + /* minimum number of free cells after GC + * if sizeof(LispObj) == 16, than a minfree of 1024 would try to keep + * at least 16Kb of free cells. + */ + minfree = 1024; + + MOD = COD = PRO = NIL; +#ifdef DEBUGGER + DBG = BRK = NIL; +#endif - /* initialize memory management */ - mac->mem.mem = (void**)calloc(mac->mem.mem_size = 16, sizeof(void*)); - mac->mem.mem_level = 0; + /* allocate initial object cells */ + LispAllocSeg(&objseg, minfree); + LispAllocSeg(&atomseg, pagesize); + lisp__data.gc.average = segsize; + + /* Don't allow gc in initialization */ + GCDisable(); + + /* Initialize package system, the current package is LISP. Order of + * initialization is very important here */ + lisp__data.lisp = LispNewPackage(STRING("LISP"), + CONS(STRING("COMMON-LISP"), NIL)); + + /* Make LISP package the current one */ + lisp__data.pack = lisp__data.savepack = + lisp__data.lisp->data.package.package; + + /* Allocate space in LISP package */ + LispMoreGlobals(lisp__data.pack); + + /* Allocate space for multiple value return values */ + lisp__data.returns.values = malloc(MULTIPLE_VALUES_LIMIT * + (sizeof(LispObj*))); + + /* Create the first atom, do it "by hand" because macro "PACKAGE" + * cannot yet be used. */ + atom = LispGetPermAtom("*PACKAGE*"); + lisp__data.package = atomseg.freeobj; + atomseg.freeobj = CDR(atomseg.freeobj); + --atomseg.nfree; + lisp__data.package->type = LispAtom_t; + lisp__data.package->data.atom = atom; + atom->object = lisp__data.package; + atom->package = lisp__data.lisp; + + /* Set package list, to be used by (gc) and (list-all-packages) */ + PACK = CONS(lisp__data.lisp, NIL); + + /* Make *PACKAGE* a special variable */ + LispProclaimSpecial(lisp__data.package, lisp__data.lisp, NIL); + + /* Value of macro "PACKAGE" is now properly available */ + + /* Changing *PACKAGE* is like calling (in-package) */ + lisp__data.package->data.atom->watch = 1; + + /* And available to other packages */ + LispExportSymbol(lisp__data.package); + + /* Initialize stacks */ + LispMoreEnvironment(); + LispMoreStack(); + + /* Create the KEYWORD package */ + Skeyword = GETATOMID("KEYWORD"); + object = LispNewPackage(STRING(Skeyword), + CONS(STRING(""), NIL)); + + /* Update list of packages */ + PACK = CONS(object, PACK); + + /* Allow easy access to the keyword package */ + lisp__data.keyword = object; + lisp__data.key = object->data.package.package; + + /* Initialize some static important symbols */ + Olambda = STATIC_ATOM("LAMBDA"); + LispExportSymbol(Olambda); + Okey = STATIC_ATOM("&KEY"); + LispExportSymbol(Okey); + Orest = STATIC_ATOM("&REST"); + LispExportSymbol(Orest); + Ooptional = STATIC_ATOM("&OPTIONAL"); + LispExportSymbol(Ooptional); + Oaux = STATIC_ATOM("&AUX"); + LispExportSymbol(Oaux); + Kunspecific = KEYWORD("UNSPECIFIC"); + Oformat = STATIC_ATOM("FORMAT"); + Oexpand_setf_method = STATIC_ATOM("EXPAND-SETF-METHOD"); + + Omake_struct = STATIC_ATOM("MAKE-STRUCT"); + Ostruct_access = STATIC_ATOM("STRUCT-ACCESS"); + Ostruct_store = STATIC_ATOM("STRUCT-STORE"); + Ostruct_type = STATIC_ATOM("STRUCT-TYPE"); + Smake_struct = ATOMID(Omake_struct); + Sstruct_access = ATOMID(Ostruct_access); + Sstruct_store = ATOMID(Ostruct_store); + Sstruct_type = ATOMID(Ostruct_type); + + /* Initialize some static atom ids */ + Snil = GETATOMID("NIL"); + St = GETATOMID("T"); + Saux = ATOMID(Oaux); + Skey = ATOMID(Okey); + Soptional = ATOMID(Ooptional); + Srest = ATOMID(Orest); + Sand = GETATOMID("AND"); + Sor = GETATOMID("OR"); + Snot = GETATOMID("NOT"); + Satom = GETATOMID("ATOM"); + Ssymbol = GETATOMID("SYMBOL"); + Sinteger = GETATOMID("INTEGER"); + Scharacter = GETATOMID("CHARACTER"); + Sstring = GETATOMID("STRING"); + Slist = GETATOMID("LIST"); + Scons = GETATOMID("CONS"); + Svector = GETATOMID("VECTOR"); + Sarray = GETATOMID("ARRAY"); + Sstruct = GETATOMID("STRUCT"); + Sfunction = GETATOMID("FUNCTION"); + Spathname = GETATOMID("PATHNAME"); + Srational = GETATOMID("RATIONAL"); + Sfloat = GETATOMID("FLOAT"); + Scomplex = GETATOMID("COMPLEX"); + Sopaque = GETATOMID("OPAQUE"); + Sdefault = GETATOMID("DEFAULT"); + + LispArgList_t = LispRegisterOpaqueType("LispArgList*"); + + lisp__data.unget = malloc(sizeof(LispUngetInfo*)); + lisp__data.unget[0] = calloc(1, sizeof(LispUngetInfo)); + lisp__data.nunget = 1; + + lisp__data.standard_input = ATOM2("*STANDARD-INPUT*"); + SINPUT = STANDARDSTREAM(Stdin, lisp__data.standard_input, STREAM_READ); + lisp__data.interactive = 1; + LispProclaimSpecial(lisp__data.standard_input, + lisp__data.input_list = SINPUT, NIL); + LispExportSymbol(lisp__data.standard_input); + + lisp__data.standard_output = ATOM2("*STANDARD-OUTPUT*"); + SOUTPUT = STANDARDSTREAM(Stdout, lisp__data.standard_output, STREAM_WRITE); + LispProclaimSpecial(lisp__data.standard_output, + lisp__data.output_list = SOUTPUT, NIL); + LispExportSymbol(lisp__data.standard_output); + + object = ATOM2("*STANDARD-ERROR*"); + lisp__data.error_stream = STANDARDSTREAM(Stderr, object, STREAM_WRITE); + LispProclaimSpecial(object, lisp__data.error_stream, NIL); + LispExportSymbol(object); + + lisp__data.modules = ATOM2("*MODULES*"); + LispProclaimSpecial(lisp__data.modules, MOD, NIL); + LispExportSymbol(lisp__data.modules); + + object = CONS(KEYWORD("UNIX"), CONS(KEYWORD("XEDIT"), NIL)); + lisp__data.features = ATOM2("*FEATURES*"); + LispProclaimSpecial(lisp__data.features, object, NIL); + LispExportSymbol(lisp__data.features); + + object = ATOM2("MULTIPLE-VALUES-LIMIT"); + LispDefconstant(object, FIXNUM(MULTIPLE_VALUES_LIMIT + 1), NIL); + LispExportSymbol(object); + + /* Reenable gc */ + GCEnable(); + + LispBytecodeInit(); + LispPackageInit(); + LispCoreInit(); + LispMathInit(); + LispPathnameInit(); + LispStreamInit(); + LispRegexInit(); + LispWriteInit(); - mac->prompt = "> "; - mac->newline = 1; - mac->column = 0; + lisp__data.prompt = isatty(0) ? "> " : NULL; - mac->errexit = !mac->interactive; + lisp__data.errexit = !lisp__data.interactive; - if (mac->interactive) { + if (lisp__data.interactive) { /* add +, ++, +++, *, **, and *** */ for (i = 0; i < 3; i++) { results[i] = '+'; results[i + 1] = '\0'; - RUN[i] = ATOM2(results); - _LispSet(mac, RUN[i], NIL, fname, 0); + RUN[i] = ATOM(results); + LispSetVar(RUN[i], NIL); + LispExportSymbol(RUN[i]); } for (i = 0; i < 3; i++) { results[i] = '*'; results[i + 1] = '\0'; - RES[i] = ATOM2(results); - _LispSet(mac, RES[i], NIL, fname, 0); + RES[i] = ATOM(results); + LispSetVar(RES[i], NIL); + LispExportSymbol(RES[i]); } } else RUN[0] = RUN[1] = RUN[2] = RES[0] = RES[1] = RES[2] = NIL; + /* Add LISP builtin functions */ for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) - LispAddBuiltinFunction(mac, &lispbuiltins[i]); + LispAddBuiltinFunction(&lispbuiltins[i]); - return (mac); + EXECUTE("(require \"lisp\")"); + + object = ATOM2("*DEFAULT-PATHNAME-DEFAULTS*"); +#ifdef LISPDIR + { + int length; + char *pathname = LISPDIR; + + length = strlen(pathname); + if (length && pathname[length - 1] != '/') { + pathname = LispMalloc(length + 2); + + strcpy(pathname, LISPDIR); + strcpy(pathname + length, "/"); + path = LSTRING2(pathname, length + 1); + } + else + path = LSTRING(pathname, length); + } +#else + path = STRING(""); +#endif + GCDisable(); + LispProclaimSpecial(object, APPLY1(Oparse_namestring, path), NIL); + LispExportSymbol(object); + GCEnable(); + + /* Create and make EXT the current package */ + PACKAGE = ext = LispNewPackage(STRING("EXT"), NIL); + lisp__data.pack = lisp__data.savepack = PACKAGE->data.package.package; + + /* Update list of packages */ + PACK = CONS(ext, PACK); + + /* Import LISP external symbols in EXT package */ + LispUsePackage(lisp__data.lisp); + + /* Add EXT non standard builtin functions */ + for (i = 0; i < sizeof(extbuiltins) / sizeof(extbuiltins[0]); i++) + LispAddBuiltinFunction(&extbuiltins[i]); + + /* Create and make USER the current package */ + GCDisable(); + PACKAGE = LispNewPackage(STRING("USER"), + CONS(STRING("COMMON-LISP-USER"), NIL)); + GCEnable(); + lisp__data.pack = lisp__data.savepack = PACKAGE->data.package.package; + + /* Update list of packages */ + PACK = CONS(PACKAGE, PACK); + + /* USER package inherits all LISP external symbols */ + LispUsePackage(lisp__data.lisp); + /* And all EXT external symbols */ + LispUsePackage(ext); + + LispTopLevel(); } void -LispEnd(LispMac *mac) +LispEnd() { - if (mac->fp != lisp_stdin) - fclose(mac->fp); + /* XXX needs to free all used memory, not just close file descriptors */ } void -LispSetPrompt(LispMac *mac, char *prompt) +LispSetPrompt(char *prompt) { - mac->prompt = prompt; + lisp__data.prompt = prompt; } void -LispSetInteractive(LispMac *mac, int interactive) +LispSetInteractive(int interactive) { - mac->interactive = !!interactive; + lisp__data.interactive = !!interactive; } void -LispSetExitOnError(LispMac *mac, int errexit) +LispSetExitOnError(int errexit) { - mac->errexit = !!errexit; + lisp__data.errexit = !!errexit; } void -LispDebug(LispMac *mac, int enable) +LispDebug(int enable) { - mac->debugging = !!enable; + lisp__data.debugging = !!enable; +#ifdef DEBUGGER /* assumes we are at the toplevel */ DBG = BRK = NIL; - mac->debug_level = -1; - mac->debug_step = 0; + lisp__data.debug_level = -1; + lisp__data.debug_step = 0; +#endif } Index: xc/programs/xedit/lisp/lisp.cf diff -u xc/programs/xedit/lisp/lisp.cf:1.4 xc/programs/xedit/lisp/lisp.cf:1.6 --- xc/programs/xedit/lisp/lisp.cf:1.4 Sat Oct 27 23:34:31 2001 +++ xc/programs/xedit/lisp/lisp.cf Fri Nov 8 03:00:57 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/xedit/lisp/lisp.cf,v 1.4 2001/10/28 03:34:31 tsi Exp $ +XCOMM $XFree86: xc/programs/xedit/lisp/lisp.cf,v 1.6 2002/11/08 08:00:57 paulo Exp $ #if 0 #ifndef BuildSharedLispModules Index: xc/programs/xedit/lisp/lisp.h diff -u xc/programs/xedit/lisp/lisp.h:1.2 xc/programs/xedit/lisp/lisp.h:1.5 --- xc/programs/xedit/lisp/lisp.h:1.2 Wed Oct 3 03:46:02 2001 +++ xc/programs/xedit/lisp/lisp.h Fri Nov 8 03:00:57 2002 @@ -27,20 +27,18 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/lisp.h,v 1.2 2001/10/03 07:46:02 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/lisp.h,v 1.5 2002/11/08 08:00:57 paulo Exp $ */ #ifndef Lisp_lisp_h #define Lisp_lisp_h -typedef struct _LispMac LispMac; - -LispMac *LispBegin(int argc, char *argv[]); -void LispEnd(LispMac*); -void LispExecute(LispMac*, char*); -void LispMachine(LispMac*); -void LispSetPrompt(LispMac*, char*); -void LispSetInteractive(LispMac*, int); -void LispSetExitOnError(LispMac*, int); -void LispDebug(LispMac*, int); /* argument is boolean to enable/disable */ +void LispBegin(void); +void LispEnd(void); +void *LispExecute(char*); +void LispMachine(void); +void LispSetPrompt(char*); +void LispSetInteractive(int); +void LispSetExitOnError(int); +void LispDebug(int); /* argument is boolean to enable/disable */ #endif /* Lisp_lisp_h */ Index: xc/programs/xedit/lisp/lisp.rules diff -u xc/programs/xedit/lisp/lisp.rules:1.9 xc/programs/xedit/lisp/lisp.rules:1.11 --- xc/programs/xedit/lisp/lisp.rules:1.9 Sat Oct 27 23:34:31 2001 +++ xc/programs/xedit/lisp/lisp.rules Fri Nov 8 03:00:57 2002 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/xedit/lisp/lisp.rules,v 1.9 2001/10/28 03:34:31 tsi Exp $ +XCOMM $XFree86: xc/programs/xedit/lisp/lisp.rules,v 1.11 2002/11/08 08:00:57 paulo Exp $ #ifndef LispModuleTarget #define LispModuleTarget(module,liblist,options) @@\ Index: xc/programs/xedit/lisp/lsp.c diff -u xc/programs/xedit/lisp/lsp.c:1.1 xc/programs/xedit/lisp/lsp.c:1.7 --- xc/programs/xedit/lisp/lsp.c:1.1 Fri Aug 31 11:00:14 2001 +++ xc/programs/xedit/lisp/lsp.c Sat Nov 23 03:26:49 2002 @@ -27,19 +27,53 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/lsp.c,v 1.1 2001/08/31 15:00:14 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/lsp.c,v 1.7 2002/11/23 08:26:49 paulo Exp $ */ +#include <stdio.h> +#include <string.h> #include "lisp.h" +#ifdef NEED_STRCASECMP +int strcasecmp(const char *s1, const char *s2); +int strncasecmp(const char *s1, const char *s2, size_t n); +#endif +#ifdef NEED_REALPATH +#include <sys/param.h> +#if defined(ISC) +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif +#endif +char *realpath(const char *pathname, char resolvedname[MAXPATHLEN]); +#endif + int main(int argc, char *argv[]) { - LispMac *mac = LispBegin(argc, argv); + int i; + + LispBegin(); + + i = 1; + if (argc > 1 && strcmp(argv[1], "-d") == 0) { + LispDebug(1); + ++i; + } + + if (i < argc) { + char buffer[2048]; - LispExecute(mac, "(require \"fun\")\n"); - LispMachine(mac); + for (; i < argc; i++) { + snprintf(buffer, sizeof(buffer), + "(load \"%s\" :if-does-not-exist :error)", + argv[i]); + LispExecute(buffer); + } + } + else + LispMachine(); - LispEnd(mac); + LispEnd(); return (0); } Index: xc/programs/xedit/lisp/math.c diff -u /dev/null xc/programs/xedit/lisp/math.c:1.22 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/math.c Sat Nov 23 16:41:52 2002 @@ -0,0 +1,1473 @@ +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/math.c,v 1.22 2002/11/23 21:41:52 paulo Exp $ */ + +#include "math.h" +#include "private.h" + +/* + * Prototypes + */ +static LispObj *LispDivide(LispBuiltin*, int, int); + +/* + * Initialization + */ +static LispObj *obj_zero, *obj_one; +LispObj *Ocomplex, *Oequal_; + +LispObj *Oshort_float, *Osingle_float, *Odouble_float, *Olong_float; + +Atom_id Sdefault_float_format; + +/* + * Implementation + */ +#include "mathimp.c" + +void +LispMathInit(void) +{ + LispObj *object, *result; + + mp_set_malloc(LispMalloc); + mp_set_calloc(LispCalloc); + mp_set_realloc(LispRealloc); + mp_set_free(LispFree); + + number_init(); + obj_zero = FIXNUM(0); + obj_one = FIXNUM(1); + + Oequal_ = STATIC_ATOM("="); + Ocomplex = STATIC_ATOM(Scomplex); + Oshort_float = STATIC_ATOM("SHORT-FLOAT"); + LispExportSymbol(Oshort_float); + Osingle_float = STATIC_ATOM("SINGLE-FLOAT"); + LispExportSymbol(Osingle_float); + Odouble_float = STATIC_ATOM("DOUBLE-FLOAT"); + LispExportSymbol(Odouble_float); + Olong_float = STATIC_ATOM("LONG-FLOAT"); + LispExportSymbol(Olong_float); + + object = STATIC_ATOM("*DEFAULT-FLOAT-FORMAT*"); + LispProclaimSpecial(object, Odouble_float, NIL); + LispExportSymbol(object); + Sdefault_float_format = ATOMID(object); + + object = STATIC_ATOM("PI"); + result = number_pi(); + LispProclaimSpecial(object, result, NIL); + LispExportSymbol(object); + + object = STATIC_ATOM("MOST-POSITIVE-FIXNUM"); + LispDefconstant(object, FIXNUM(MOST_POSITIVE_FIXNUM), NIL); + LispExportSymbol(object); + + object = STATIC_ATOM("MOST-NEGATIVE-FIXNUM"); + LispDefconstant(object, FIXNUM(MOST_NEGATIVE_FIXNUM), NIL); + LispExportSymbol(object); +} + +LispObj * +Lisp_Mul(LispBuiltin *builtin) +/* + * &rest numbers + */ +{ + n_number num; + LispObj *number, *numbers; + + numbers = ARGUMENT(0); + + if (CONSP(numbers)) { + number = CAR(numbers); + + numbers = CDR(numbers); + if (!CONSP(numbers)) { + CHECK_NUMBER(number); + return (number); + } + } + else + return (FIXNUM(1)); + + set_number_object(&num, number); + do { + mul_number_object(&num, CAR(numbers)); + numbers = CDR(numbers); + } while (CONSP(numbers)); + + return (make_number_object(&num)); +} + +LispObj * +Lisp_Plus(LispBuiltin *builtin) +/* + + &rest numbers + */ +{ + n_number num; + LispObj *number, *numbers; + + numbers = ARGUMENT(0); + + if (CONSP(numbers)) { + number = CAR(numbers); + + numbers = CDR(numbers); + if (!CONSP(numbers)) { + CHECK_NUMBER(number); + return (number); + } + } + else + return (FIXNUM(0)); + + set_number_object(&num, number); + do { + add_number_object(&num, CAR(numbers)); + numbers = CDR(numbers); + } while (CONSP(numbers)); + + return (make_number_object(&num)); +} + +LispObj * +Lisp_Minus(LispBuiltin *builtin) +/* + - number &rest more_numbers + */ +{ + n_number num; + LispObj *number, *more_numbers; + + more_numbers = ARGUMENT(1); + number = ARGUMENT(0); + + set_number_object(&num, number); + if (!CONSP(more_numbers)) { + neg_number(&num); + + return (make_number_object(&num)); + } + do { + sub_number_object(&num, CAR(more_numbers)); + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + + return (make_number_object(&num)); +} + +LispObj * +Lisp_Div(LispBuiltin *builtin) +/* + / number &rest more_numbers + */ +{ + n_number num; + LispObj *number, *more_numbers; + + more_numbers = ARGUMENT(1); + number = ARGUMENT(0); + + if (CONSP(more_numbers)) + set_number_object(&num, number); + else { + num.complex = 0; + num.real.type = N_FIXNUM; + num.real.data.fixnum = 1; + goto div_one_argument; + } + + for (;;) { + number = CAR(more_numbers); + more_numbers = CDR(more_numbers); + +div_one_argument: + div_number_object(&num, number); + if (!CONSP(more_numbers)) + break; + } + + return (make_number_object(&num)); +} + +LispObj * +Lisp_OnePlus(LispBuiltin *builtin) +/* + 1+ number + */ +{ + n_number num; + LispObj *number; + + number = ARGUMENT(0); + num.complex = 0; + num.real.type = N_FIXNUM; + num.real.data.fixnum = 1; + add_number_object(&num, number); + + return (make_number_object(&num)); +} + +LispObj * +Lisp_OneMinus(LispBuiltin *builtin) +/* + 1- number + */ +{ + n_number num; + LispObj *number; + + number = ARGUMENT(0); + num.complex = 0; + num.real.type = N_FIXNUM; + num.real.data.fixnum = -1; + add_number_object(&num, number); + + return (make_number_object(&num)); +} + +LispObj * +Lisp_Less(LispBuiltin *builtin) +/* + < number &rest more-numbers + */ +{ + LispObj *compare, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + compare = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(compare, number, 1) >= 0) + return (NIL); + compare = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(compare); + } + + return (T); +} + +LispObj * +Lisp_LessEqual(LispBuiltin *builtin) +/* + <= number &rest more-numbers + */ +{ + LispObj *compare, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + compare = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(compare, number, 1) > 0) + return (NIL); + compare = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(compare); + } + + return (T); +} + +LispObj * +Lisp_Equal_(LispBuiltin *builtin) +/* + = number &rest more-numbers + */ +{ + LispObj *compare, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + compare = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(compare, number, 0) != 0) + return (NIL); + compare = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(compare); + } + + return (T); +} + +LispObj * +Lisp_Greater(LispBuiltin *builtin) +/* + > number &rest more-numbers + */ +{ + LispObj *compare, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + compare = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(compare, number, 1) <= 0) + return (NIL); + compare = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(compare); + } + + return (T); +} + +LispObj * +Lisp_GreaterEqual(LispBuiltin *builtin) +/* + >= number &rest more-numbers + */ +{ + LispObj *compare, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + compare = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(compare, number, 1) < 0) + return (NIL); + compare = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(compare); + } + + return (T); +} + +LispObj * +Lisp_NotEqual(LispBuiltin *builtin) +/* + /= number &rest more-numbers + */ +{ + LispObj *object, *compare, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + number = ARGUMENT(0); + + if (!CONSP(more_numbers)) { + CHECK_REAL(number); + + return (T); + } + + /* compare all numbers */ + while (1) { + compare = number; + for (object = more_numbers; CONSP(object); object = CDR(object)) { + number = CAR(object); + + if (cmp_object_object(compare, number, 0) == 0) + return (NIL); + } + if (CONSP(more_numbers)) { + number = CAR(more_numbers); + more_numbers = CDR(more_numbers); + } + else + break; + } + + return (T); +} + +LispObj * +Lisp_Min(LispBuiltin *builtin) +/* + min number &rest more-numbers + */ +{ + LispObj *result, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + result = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(result, number, 1) > 0) + result = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(result); + } + + return (result); +} + +LispObj * +Lisp_Max(LispBuiltin *builtin) +/* + max number &rest more-numbers + */ +{ + LispObj *result, *number, *more_numbers; + + more_numbers = ARGUMENT(1); + result = ARGUMENT(0); + + if (CONSP(more_numbers)) { + do { + number = CAR(more_numbers); + if (cmp_object_object(result, number, 1) < 0) + result = number; + more_numbers = CDR(more_numbers); + } while (CONSP(more_numbers)); + } + else { + CHECK_REAL(result); + } + + return (result); +} + +LispObj * +Lisp_Abs(LispBuiltin *builtin) +/* + abs number + */ +{ + LispObj *result, *number; + + result = number = ARGUMENT(0); + + switch (OBJECT_TYPE(number)) { + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + case LispDFloat_t: + case LispRatio_t: + case LispBigratio_t: + if (cmp_real_object(&zero, number) > 0) { + n_real real; + + set_real_object(&real, number); + neg_real(&real); + result = make_real_object(&real); + } + break; + case LispComplex_t: { + n_number num; + + set_number_object(&num, number); + abs_number(&num); + result = make_number_object(&num); + } break; + default: + fatal_builtin_object_error(builtin, number, NOT_A_NUMBER); + break; + } + + return (result); +} + +LispObj * +Lisp_Complex(LispBuiltin *builtin) +/* + complex realpart &optional imagpart + */ +{ + LispObj *realpart, *imagpart; + + imagpart = ARGUMENT(1); + realpart = ARGUMENT(0); + + CHECK_REAL(realpart); + + if (imagpart == UNSPEC) + return (realpart); + else { + CHECK_REAL(imagpart); + } + if (!FLOATP(imagpart) && cmp_real_object(&zero, imagpart) == 0) + return (realpart); + + return (COMPLEX(realpart, imagpart)); +} + +LispObj * +Lisp_Complexp(LispBuiltin *builtin) +/* + complexp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (COMPLEXP(object) ? T : NIL); +} + +LispObj * +Lisp_Conjugate(LispBuiltin *builtin) +/* + conjugate number + */ +{ + n_number num; + LispObj *number, *realpart, *imagpart; + + number = ARGUMENT(0); + + CHECK_NUMBER(number); + + if (REALP(number)) + return (number); + + realpart = OCXR(number); + num.complex = 0; + num.real.type = N_FIXNUM; + num.real.data.fixnum = -1; + mul_number_object(&num, OCXI(number)); + imagpart = make_number_object(&num); + + return (COMPLEX(realpart, imagpart)); +} + +LispObj * +Lisp_Decf(LispBuiltin *builtin) +/* + decf place &optional delta + */ +{ + n_number num; + LispObj *place, *delta, *number; + + delta = ARGUMENT(1); + place = ARGUMENT(0); + + if (SYMBOLP(place)) { + number = LispGetVar(place); + if (number == NULL) + LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); + } + else + number = EVAL(place); + + if (delta != UNSPEC) { + LispObj *operand; + + operand = EVAL(delta); + set_number_object(&num, number); + sub_number_object(&num, operand); + number = make_number_object(&num); + } + else { + num.complex = 0; + num.real.type = N_FIXNUM; + num.real.data.fixnum = -1; + add_number_object(&num, number); + number = make_number_object(&num); + } + + if (SYMBOLP(place)) { + CHECK_CONSTANT(place); + LispSetVar(place, number); + } + else { + GC_ENTER(); + + GC_PROTECT(number); + (void)APPLY2(Osetf, place, number); + GC_LEAVE(); + } + + return (number); +} + +LispObj * +Lisp_Denominator(LispBuiltin *builtin) +/* + denominator rational + */ +{ + LispObj *result, *rational; + + rational = ARGUMENT(0); + + switch (OBJECT_TYPE(rational)) { + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + result = FIXNUM(1); + break; + case LispRatio_t: + result = INTEGER(OFRD(rational)); + break; + case LispBigratio_t: + if (mpi_fiti(OBRD(rational))) + result = INTEGER(mpi_geti(OBRD(rational))); + else { + mpi *den = XALLOC(mpi); + + mpi_init(den); + mpi_set(den, OBRD(rational)); + result = BIGNUM(den); + } + break; + default: + LispDestroy("%s: %s is not a rational number", + STRFUN(builtin), STROBJ(rational)); + /*NOTREACHED*/ + result = NIL; + } + + return (result); +} + +LispObj * +Lisp_Evenp(LispBuiltin *builtin) +/* + evenp integer + */ +{ + LispObj *result, *integer; + + integer = ARGUMENT(0); + + switch (OBJECT_TYPE(integer)) { + case LispFixnum_t: + result = FIXNUM_VALUE(integer) % 2 ? NIL : T; + break; + case LispInteger_t: + result = INT_VALUE(integer) % 2 ? NIL : T; + break; + case LispBignum_t: + result = mpi_remi(OBI(integer), 2) ? NIL : T; + break; + default: + fatal_builtin_object_error(builtin, integer, NOT_AN_INTEGER); + /*NOTREACHED*/ + result = NIL; + } + + return (result); +} + +/* only one float format */ +LispObj * +Lisp_Float(LispBuiltin *builtin) +/* + float number &optional other + */ +{ + LispObj *number, *other; + + other = ARGUMENT(1); + number = ARGUMENT(0); + + if (other != UNSPEC) { + CHECK_DFLOAT(other); + } + + return (LispFloatCoerce(builtin, number)); +} + +LispObj * +LispFloatCoerce(LispBuiltin *builtin, LispObj *number) +{ + double value; + + switch (OBJECT_TYPE(number)) { + case LispFixnum_t: + value = FIXNUM_VALUE(number); + break; + case LispInteger_t: + value = INT_VALUE(number); + break; + case LispBignum_t: + value = mpi_getd(OBI(number)); + break; + case LispDFloat_t: + return (number); + case LispRatio_t: + value = (double)OFRN(number) / (double)OFRD(number); + break; + case LispBigratio_t: + value = mpr_getd(OBR(number)); + break; + default: + value = 0.0; + fatal_builtin_object_error(builtin, number, NOT_A_REAL_NUMBER); + break; + } + + if (!finite(value)) + fatal_error(FLOATING_POINT_OVERFLOW); + + return (DFLOAT(value)); +} + +LispObj * +Lisp_Floatp(LispBuiltin *builtin) +/* + floatp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (FLOATP(object) ? T : NIL); +} + +LispObj * +Lisp_Gcd(LispBuiltin *builtin) +/* + gcd &rest integers + */ +{ + n_real real; + LispObj *integers, *integer, *operand; + + integers = ARGUMENT(0); + + if (!CONSP(integers)) + return (FIXNUM(0)); + + integer = CAR(integers); + + CHECK_INTEGER(integer); + set_real_object(&real, integer); + integers = CDR(integers); + + for (; CONSP(integers); integers = CDR(integers)) { + operand = CAR(integers); + gcd_real_object(&real, operand); + } + abs_real(&real); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Imagpart(LispBuiltin *builtin) +/* + imagpart number + */ +{ + LispObj *number; + + number = ARGUMENT(0); + + if (COMPLEXP(number)) + return (OCXI(number)); + else { + CHECK_REAL(number); + } + + return (FIXNUM(0)); +} + +LispObj * +Lisp_Incf(LispBuiltin *builtin) +/* + incf place &optional delta + */ +{ + n_number num; + LispObj *place, *delta, *number; + + delta = ARGUMENT(1); + place = ARGUMENT(0); + + if (SYMBOLP(place)) { + number = LispGetVar(place); + if (number == NULL) + LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); + } + else + number = EVAL(place); + + if (delta != UNSPEC) { + LispObj *operand; + + operand = EVAL(delta); + set_number_object(&num, number); + add_number_object(&num, operand); + number = make_number_object(&num); + } + else { + num.complex = 0; + num.real.type = N_FIXNUM; + num.real.data.fixnum = 1; + add_number_object(&num, number); + number = make_number_object(&num); + } + + if (SYMBOLP(place)) { + CHECK_CONSTANT(place); + LispSetVar(place, number); + } + else { + GC_ENTER(); + + GC_PROTECT(number); + (void)APPLY2(Osetf, place, number); + GC_LEAVE(); + } + + return (number); +} + +LispObj * +Lisp_Integerp(LispBuiltin *builtin) +/* + integerp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (INTEGERP(object) ? T : NIL); +} + +LispObj * +Lisp_Isqrt(LispBuiltin *builtin) +/* + isqrt natural + */ +{ + LispObj *natural, *result; + + natural = ARGUMENT(0); + + if (cmp_object_object(natural, obj_zero, 1) < 0) + goto not_a_natural_number; + + switch (OBJECT_TYPE(natural)) { + case LispFixnum_t: + result = FIXNUM((long)floor(sqrt(FIXNUM_VALUE(natural)))); + break; + case LispInteger_t: + result = INTEGER((long)floor(sqrt(INT_VALUE(natural)))); + break; + case LispBignum_t: { + mpi *bigi; + + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_sqrt(bigi, OBI(natural)); + if (mpi_fiti(bigi)) { + result = INTEGER(mpi_geti(bigi)); + mpi_clear(bigi); + XFREE(bigi); + } + else + result = BIGNUM(bigi); + } break; + default: + goto not_a_natural_number; + } + + return (result); + +not_a_natural_number: + LispDestroy("%s: %s is not a natural number", + STRFUN(builtin), STROBJ(natural)); + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +Lisp_Lcm(LispBuiltin *builtin) +/* + lcm &rest integers + */ +{ + n_real real, gcd; + LispObj *integers, *operand; + + integers = ARGUMENT(0); + + if (!CONSP(integers)) + return (FIXNUM(1)); + + operand = CAR(integers); + + CHECK_INTEGER(operand); + set_real_object(&real, operand); + integers = CDR(integers); + + gcd.type = N_FIXNUM; + gcd.data.fixnum = 0; + + for (; CONSP(integers); integers = CDR(integers)) { + operand = CAR(integers); + + if (real.type == N_FIXNUM && real.data.fixnum == 0) + break; + + /* calculate gcd before changing integer */ + clear_real(&gcd); + set_real_real(&gcd, &real); + gcd_real_object(&gcd, operand); + + /* calculate lcm */ + mul_real_object(&real, operand); + div_real_real(&real, &gcd); + } + clear_real(&gcd); + abs_real(&real); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Logand(LispBuiltin *builtin) +/* + logand &rest integers + */ +{ + n_real real; + + LispObj *integers; + + integers = ARGUMENT(0); + + real.type = N_FIXNUM; + real.data.fixnum = -1; + + for (; CONSP(integers); integers = CDR(integers)) + and_real_object(&real, CAR(integers)); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Logeqv(LispBuiltin *builtin) +/* + logeqv &rest integers + */ +{ + n_real real; + + LispObj *integers; + + integers = ARGUMENT(0); + + real.type = N_FIXNUM; + real.data.fixnum = -1; + + for (; CONSP(integers); integers = CDR(integers)) + eqv_real_object(&real, CAR(integers)); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Logior(LispBuiltin *builtin) +/* + logior &rest integers + */ +{ + n_real real; + + LispObj *integers; + + integers = ARGUMENT(0); + + real.type = N_FIXNUM; + real.data.fixnum = 0; + + for (; CONSP(integers); integers = CDR(integers)) + ior_real_object(&real, CAR(integers)); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Lognot(LispBuiltin *builtin) +/* + lognot integer + */ +{ + n_real real; + + LispObj *integer; + + integer = ARGUMENT(0); + + CHECK_INTEGER(integer); + + set_real_object(&real, integer); + not_real(&real); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Logxor(LispBuiltin *builtin) +/* + logxor &rest integers + */ +{ + n_real real; + + LispObj *integers; + + integers = ARGUMENT(0); + + real.type = N_FIXNUM; + real.data.fixnum = 0; + + for (; CONSP(integers); integers = CDR(integers)) + xor_real_object(&real, CAR(integers)); + + return (make_real_object(&real)); +} + +LispObj * +Lisp_Minusp(LispBuiltin *builtin) +/* + minusp number + */ +{ + LispObj *number; + + number = ARGUMENT(0); + + CHECK_REAL(number); + + return (cmp_real_object(&zero, number) > 0 ? T : NIL); +} + +LispObj * +Lisp_Mod(LispBuiltin *builtin) +/* + mod number divisor + */ +{ + LispObj *result; + + LispObj *number, *divisor; + + divisor = ARGUMENT(1); + number = ARGUMENT(0); + + if (INTEGERP(number) && INTEGERP(divisor)) { + n_real real; + + set_real_object(&real, number); + mod_real_object(&real, divisor); + result = make_real_object(&real); + } + else { + n_number num; + + set_number_object(&num, number); + divide_number_object(&num, divisor, NDIVIDE_FLOOR, 0); + result = make_real_object(&(num.imag)); + clear_real(&(num.real)); + } + + return (result); +} + +LispObj * +Lisp_Numberp(LispBuiltin *builtin) +/* + numberp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (NUMBERP(object) ? T : NIL); +} + +LispObj * +Lisp_Numerator(LispBuiltin *builtin) +/* + numerator rational + */ +{ + LispObj *result, *rational; + + rational = ARGUMENT(0); + + switch (OBJECT_TYPE(rational)) { + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + result = rational; + break; + case LispRatio_t: + result = INTEGER(OFRN(rational)); + break; + case LispBigratio_t: + if (mpi_fiti(OBRN(rational))) + result = INTEGER(mpi_geti(OBRN(rational))); + else { + mpi *num = XALLOC(mpi); + + mpi_init(num); + mpi_set(num, OBRN(rational)); + result = BIGNUM(num); + } + break; + default: + LispDestroy("%s: %s is not a rational number", + STRFUN(builtin), STROBJ(rational)); + /*NOTREACHED*/ + result = NIL; + } + + return (result); +} + +LispObj * +Lisp_Oddp(LispBuiltin *builtin) +/* + oddp integer + */ +{ + LispObj *result, *integer; + + integer = ARGUMENT(0); + + switch (OBJECT_TYPE(integer)) { + case LispFixnum_t: + result = FIXNUM_VALUE(integer) % 2 ? T : NIL; + break; + case LispInteger_t: + result = INT_VALUE(integer) % 2 ? T : NIL; + break; + case LispBignum_t: + result = mpi_remi(OBI(integer), 2) ? T : NIL; + break; + default: + fatal_builtin_object_error(builtin, integer, NOT_AN_INTEGER); + /*NOTREACHED*/ + result = NIL; + } + + return (result); +} + +LispObj * +Lisp_Plusp(LispBuiltin *builtin) +/* + plusp number + */ +{ + LispObj *number; + + number = ARGUMENT(0); + + CHECK_REAL(number); + + return (cmp_real_object(&zero, number) < 0 ? T : NIL); +} + +LispObj * +Lisp_Rational(LispBuiltin *builtin) +/* + rational number + */ +{ + LispObj *number; + + number = ARGUMENT(0); + + if (DFLOATP(number)) { + double numerator = ODF(number); + + if ((long)numerator == numerator) + number = INTEGER(numerator); + else { + n_real real; + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_setd(bigr, numerator); + real.type = N_BIGRATIO; + real.data.bigratio = bigr; + rbr_canonicalize(&real); + number = make_real_object(&real); + } + } + else { + CHECK_REAL(number); + } + + return (number); +} + +LispObj * +Lisp_Rationalp(LispBuiltin *builtin) +/* + rationalp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (RATIONALP(object) ? T : NIL); +} + +LispObj * +Lisp_Realpart(LispBuiltin *builtin) +/* + realpart number + */ +{ + LispObj *number; + + number = ARGUMENT(0); + + if (COMPLEXP(number)) + return (OCXR(number)); + else { + CHECK_REAL(number); + } + + return (number); +} + +LispObj * +Lisp_Rem(LispBuiltin *builtin) +/* + rem number divisor + */ +{ + LispObj *result; + + LispObj *number, *divisor; + + divisor = ARGUMENT(1); + number = ARGUMENT(0); + + if (INTEGERP(number) && INTEGERP(divisor)) { + n_real real; + + set_real_object(&real, number); + rem_real_object(&real, divisor); + result = make_real_object(&real); + } + else { + n_number num; + + set_number_object(&num, number); + divide_number_object(&num, divisor, NDIVIDE_TRUNC, 0); + result = make_real_object(&(num.imag)); + clear_real(&(num.real)); + } + + return (result); +} + +LispObj * +Lisp_Sqrt(LispBuiltin *builtin) +/* + sqrt number + */ +{ + n_number num; + LispObj *number; + + number = ARGUMENT(0); + + set_number_object(&num, number); + sqrt_number(&num); + + return (make_number_object(&num)); +} + +LispObj * +Lisp_Zerop(LispBuiltin *builtin) +/* + zerop number + */ +{ + LispObj *result, *number; + + number = ARGUMENT(0); + + switch (OBJECT_TYPE(number)) { + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + case LispDFloat_t: + case LispRatio_t: + case LispBigratio_t: + result = cmp_real_object(&zero, number) == 0 ? T : NIL; + break; + case LispComplex_t: + result = cmp_real_object(&zero, OCXR(number)) == 0 && + cmp_real_object(&zero, OCXI(number)) == 0 ? T : NIL; + break; + default: + fatal_builtin_object_error(builtin, number, NOT_A_NUMBER); + /*NOTREACHED*/ + result = NIL; + } + + return (result); +} + +static LispObj * +LispDivide(LispBuiltin *builtin, int fun, int flo) +{ + n_number num; + LispObj *number, *divisor; + + divisor = ARGUMENT(1); + number = ARGUMENT(0); + + RETURN_COUNT = 1; + + if (cmp_real_object(&zero, number) == 0) { + if (divisor != NIL) { + CHECK_REAL(divisor); + } + + return (RETURN(0) = obj_zero); + } + + if (divisor == UNSPEC) + divisor = obj_one; + + set_number_object(&num, number); + if (num.complex) + fatal_builtin_object_error(builtin, divisor, NOT_A_REAL_NUMBER); + + divide_number_object(&num, divisor, fun, flo); + RETURN(0) = make_real_object(&(num.imag)); + + return (make_real_object(&(num.real))); +} + +LispObj * +Lisp_Ceiling(LispBuiltin *builtin) +/* + ceiling number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_CEIL, 0)); +} + +LispObj * +Lisp_Fceiling(LispBuiltin *builtin) +/* + fceiling number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_CEIL, 1)); +} + +LispObj * +Lisp_Floor(LispBuiltin *builtin) +/* + floor number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_FLOOR, 0)); +} + +LispObj * +Lisp_Ffloor(LispBuiltin *builtin) +/* + ffloor number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_FLOOR, 1)); +} + +LispObj * +Lisp_Round(LispBuiltin *builtin) +/* + round number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_ROUND, 0)); +} + +LispObj * +Lisp_Fround(LispBuiltin *builtin) +/* + fround number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_ROUND, 1)); +} + +LispObj * +Lisp_Truncate(LispBuiltin *builtin) +/* + truncate number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_TRUNC, 0)); +} + +LispObj * +Lisp_Ftruncate(LispBuiltin *builtin) +/* + ftruncate number &optional divisor + */ +{ + return (LispDivide(builtin, NDIVIDE_TRUNC, 1)); +} Index: xc/programs/xedit/lisp/math.h diff -u /dev/null xc/programs/xedit/lisp/math.h:1.6 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/math.h Fri Nov 8 03:00:57 2002 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/math.h,v 1.6 2002/11/08 08:00:57 paulo Exp $ */ + +#ifndef Lisp_math_h +#define Lisp_math_h + +#include "internal.h" +#include "mp.h" + +void LispMathInit(void); +LispObj *LispFloatCoerce(LispBuiltin*, LispObj*); + +LispObj *Lisp_Mul(LispBuiltin*); +LispObj *Lisp_Plus(LispBuiltin*); +LispObj *Lisp_Minus(LispBuiltin*); +LispObj *Lisp_Div(LispBuiltin*); +LispObj *Lisp_OnePlus(LispBuiltin*); +LispObj *Lisp_OneMinus(LispBuiltin*); +LispObj *Lisp_Less(LispBuiltin*); +LispObj *Lisp_LessEqual(LispBuiltin*); +LispObj *Lisp_Equal_(LispBuiltin*); +LispObj *Lisp_Greater(LispBuiltin*); +LispObj *Lisp_GreaterEqual(LispBuiltin*); +LispObj *Lisp_NotEqual(LispBuiltin*); +LispObj *Lisp_Max(LispBuiltin*); +LispObj *Lisp_Min(LispBuiltin*); +LispObj *Lisp_Mod(LispBuiltin*); +LispObj *Lisp_Abs(LispBuiltin*); +LispObj *Lisp_Complex(LispBuiltin*); +LispObj *Lisp_Complexp(LispBuiltin*); +LispObj *Lisp_Conjugate(LispBuiltin*); +LispObj *Lisp_Decf(LispBuiltin*); +LispObj *Lisp_Denominator(LispBuiltin*); +LispObj *Lisp_Evenp(LispBuiltin*); +LispObj *Lisp_Float(LispBuiltin*); +LispObj *Lisp_Floatp(LispBuiltin*); +LispObj *Lisp_Gcd(LispBuiltin*); +LispObj *Lisp_Imagpart(LispBuiltin*); +LispObj *Lisp_Incf(LispBuiltin*); +LispObj *Lisp_Integerp(LispBuiltin*); +LispObj *Lisp_Isqrt(LispBuiltin*); +LispObj *Lisp_Lcm(LispBuiltin*); +LispObj *Lisp_Logand(LispBuiltin*); +LispObj *Lisp_Logeqv(LispBuiltin*); +LispObj *Lisp_Logior(LispBuiltin*); +LispObj *Lisp_Lognot(LispBuiltin*); +LispObj *Lisp_Logxor(LispBuiltin*); +LispObj *Lisp_Minusp(LispBuiltin*); +LispObj *Lisp_Numberp(LispBuiltin*); +LispObj *Lisp_Numerator(LispBuiltin*); +LispObj *Lisp_Oddp(LispBuiltin*); +LispObj *Lisp_Plusp(LispBuiltin*); +LispObj *Lisp_Rational(LispBuiltin*); +#if 0 +LispObj *Lisp_Rationalize(LispBuiltin*); +#endif +LispObj *Lisp_Rationalp(LispBuiltin*); +LispObj *Lisp_Realpart(LispBuiltin*); +LispObj *Lisp_Rem(LispBuiltin*); +LispObj *Lisp_Sqrt(LispBuiltin*); +LispObj *Lisp_Zerop(LispBuiltin*); +LispObj *Lisp_Ceiling(LispBuiltin*); +LispObj *Lisp_Fceiling(LispBuiltin*); +LispObj *Lisp_Floor(LispBuiltin*); +LispObj *Lisp_Ffloor(LispBuiltin*); +LispObj *Lisp_Round(LispBuiltin*); +LispObj *Lisp_Fround(LispBuiltin*); +LispObj *Lisp_Truncate(LispBuiltin*); +LispObj *Lisp_Ftruncate(LispBuiltin*); + + +#endif /* Lisp_math_h */ Index: xc/programs/xedit/lisp/mathimp.c diff -u /dev/null xc/programs/xedit/lisp/mathimp.c:1.14 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/mathimp.c Wed Jan 29 21:46:25 2003 @@ -0,0 +1,5225 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/mathimp.c,v 1.14 2003/01/30 02:46:25 paulo Exp $ */ + + +/* + * Defines + */ +#ifdef __GNUC__ +#define CONST __attribute__ ((__const__)) +#else +#define CONST /**/ +#endif + +/* mask for checking overflow on long operations */ +#ifdef LONG64 +#define FI_MASK 0x4000000000000000L +#define LONGSBITS 63 +#else +#define FI_MASK 0x40000000L +#define LONGSBITS 31 +#endif + +#define N_FIXNUM 1 +#define N_BIGNUM 2 +#define N_FLONUM 3 +#define N_FIXRATIO 4 +#define N_BIGRATIO 5 + +#define NOP_ADD 1 +#define NOP_SUB 2 +#define NOP_MUL 3 +#define NOP_DIV 4 + +#define NDIVIDE_CEIL 1 +#define NDIVIDE_FLOOR 2 +#define NDIVIDE_ROUND 3 +#define NDIVIDE_TRUNC 4 + +/* real part from number */ +#define NREAL(num) &((num)->real) +#define NRTYPE(num) (num)->real.type +#define NRFI(num) (num)->real.data.fixnum +#define NRBI(num) (num)->real.data.bignum +#define NRFF(num) (num)->real.data.flonum +#define NRFRN(Num) (Num)->real.data.fixratio.num +#define NRFRD(num) (num)->real.data.fixratio.den +#define NRBR(num) (num)->real.data.bigratio +#define NRBRN(num) mpr_num(NRBR(num)) +#define NRBRD(num) mpr_den(NRBR(num)) + +#define NRCLEAR_BI(num) mpi_clear(NRBI(num)); XFREE(NRBI(num)) +#define NRCLEAR_BR(num) mpr_clear(NRBR(num)); XFREE(NRBR(num)) + +/* imag part from number */ +#define NIMAG(num) &((num)->imag) +#define NITYPE(num) (num)->imag.type +#define NIFI(num) (num)->imag.data.fixnum +#define NIBI(num) (num)->imag.data.bignum +#define NIFF(num) (num)->imag.data.flonum +#define NIFRN(Num) (Num)->imag.data.fixratio.num +#define NIFRD(num) (num)->imag.data.fixratio.den +#define NIBR(num) (num)->imag.data.bigratio +#define NIBRN(obj) mpr_num(NIBR(obj)) +#define NIBRD(obj) mpr_den(NIBR(obj)) + +/* real number fields */ +#define RTYPE(real) (real)->type +#define RFI(real) (real)->data.fixnum +#define RBI(real) (real)->data.bignum +#define RFF(real) (real)->data.flonum +#define RFRN(real) (real)->data.fixratio.num +#define RFRD(real) (real)->data.fixratio.den +#define RBR(real) (real)->data.bigratio +#define RBRN(real) mpr_num(RBR(real)) +#define RBRD(real) mpr_den(RBR(real)) + +#define RINTEGERP(real) \ + (RTYPE(real) == N_FIXNUM || RTYPE(real) == N_BIGNUM) + +#define RCLEAR_BI(real) mpi_clear(RBI(real)); XFREE(RBI(real)) +#define RCLEAR_BR(real) mpr_clear(RBR(real)); XFREE(RBR(real)) + +/* numeric value from lisp object */ +#define OFI(object) FIXNUM_VALUE(object) +#define OII(object) INT_VALUE(object) +#define OBI(object) (object)->data.mp.integer +#define ODF(object) DFLOAT_VALUE(object) +#define OFRN(object) (object)->data.ratio.numerator +#define OFRD(object) (object)->data.ratio.denominator +#define OBR(object) (object)->data.mp.ratio +#define OBRN(object) mpr_num(OBR(object)) +#define OBRD(object) mpr_den(OBR(object)) +#define OCXR(object) (object)->data.complex.real +#define OCXI(object) (object)->data.complex.imag + +#define XALLOC(type) LispMalloc(sizeof(type)) +#define XFREE(ptr) LispFree(ptr) + + +/* + * Types + */ +typedef struct _n_real { + char type; + union { + long fixnum; + mpi *bignum; + double flonum; + struct { + long num; + long den; + } fixratio; + mpr *bigratio; + } data; +} n_real; + +typedef struct _n_number { + char complex; + n_real real; + n_real imag; +} n_number; + + +/* + * Prototypes + */ +static void number_init(void); +static LispObj *number_pi(void); + +static void set_real_real(n_real*, n_real*); +static void set_real_object(n_real*, LispObj*); +static void set_number_object(n_number*, LispObj*); +static void clear_real(n_real*); +static void clear_number(n_number*); + +static LispObj *make_real_object(n_real*); +static LispObj *make_number_object(n_number*); + +static void fatal_error(int); +static void fatal_object_error(LispObj*, int); +static void fatal_builtin_object_error(LispBuiltin*, LispObj*, int); + +static double bi_getd(mpi*); +static double br_getd(mpr*); + +/* add */ +static void add_real_object(n_real*, LispObj*); +static void add_number_object(n_number*, LispObj*); + +/* sub */ +static void sub_real_object(n_real*, LispObj*); +static void sub_number_object(n_number*, LispObj*); + +/* mul */ +static void mul_real_object(n_real*, LispObj*); +static void mul_number_object(n_number*, LispObj*); + +/* div */ +static void div_real_object(n_real*, LispObj*); +static void div_number_object(n_number*, LispObj*); + +/* compare */ +static int cmp_real_real(n_real*, n_real*); +static int cmp_real_object(n_real*, LispObj*); +#if 0 /* not used */ +static int cmp_number_object(n_number*, LispObj*); +#endif +static int cmp_object_object(LispObj*, LispObj*, int); + +/* fixnum */ +static INLINE int fi_fi_add_overflow(long, long) CONST; +static INLINE int fi_fi_sub_overflow(long, long) CONST; +static INLINE int fi_fi_mul_overflow(long, long) CONST; + +/* bignum */ +static void rbi_canonicalize(n_real*); + +/* ratio */ +static void rfr_canonicalize(n_real*); +static void rbr_canonicalize(n_real*); + +/* complex */ +static void ncx_canonicalize(n_number*); + +/* abs */ +static void abs_real(n_real*); +static void abs_number(n_number*); +static void nabs_cx(n_number*); +static INLINE void rabs_fi(n_real*); +static INLINE void rabs_bi(n_real*); +static INLINE void rabs_ff(n_real*); +static INLINE void rabs_fr(n_real*); +static INLINE void rabs_br(n_real*); + +/* neg */ +static void neg_real(n_real*); +static void neg_number(n_number*); +static void rneg_fi(n_real*); +static INLINE void rneg_bi(n_real*); +static INLINE void rneg_ff(n_real*); +static INLINE void rneg_fr(n_real*); +static INLINE void rneg_br(n_real*); + +/* sqrt */ +static void sqrt_real(n_real*); +static void sqrt_number(n_number*); +static void rsqrt_xi(n_real*); +static void rsqrt_xr(n_real*); +static void rsqrt_ff(n_real*); +static void nsqrt_cx(n_number*); +static void nsqrt_xi(n_number*); +static void nsqrt_ff(n_number*); +static void nsqrt_xr(n_number*); + +/* mod */ +static void mod_real_real(n_real*, n_real*); +static void mod_real_object(n_real*, LispObj*); +static void rmod_fi_fi(n_real*, long); +static void rmod_fi_bi(n_real*, mpi*); +static void rmod_bi_fi(n_real*, long); +static void rmod_bi_bi(n_real*, mpi*); + +/* rem */ +static void rem_real_object(n_real*, LispObj*); +static void rrem_fi_fi(n_real*, long); +static void rrem_fi_bi(n_real*, mpi*); +static void rrem_bi_fi(n_real*, long); +static void rrem_bi_bi(n_real*, mpi*); + +/* gcd */ +static void gcd_real_object(n_real*, LispObj*); + +/* and */ +static void and_real_object(n_real*, LispObj*); + +/* eqv */ +static void eqv_real_object(n_real*, LispObj*); + +/* ior */ +static void ior_real_object(n_real*, LispObj*); + +/* not */ +static void not_real(n_real*); + +/* xor */ +static void xor_real_object(n_real*, LispObj*); + +/* divide */ +static void divide_number_object(n_number*, LispObj*, int, int); +static void ndivide_xi_xi(n_number*, LispObj*, int, int); +static void ndivide_flonum(n_number*, double, double, int, int); +static void ndivide_xi_xr(n_number*, LispObj*, int, int); +static void ndivide_xr_xi(n_number*, LispObj*, int, int); +static void ndivide_xr_xr(n_number*, LispObj*, int, int); + +/* real complex */ +static void nadd_re_cx(n_number*, LispObj*); +static void nsub_re_cx(n_number*, LispObj*); +static void nmul_re_cx(n_number*, LispObj*); +static void ndiv_re_cx(n_number*, LispObj*); + +/* complex real */ +static void nadd_cx_re(n_number*, LispObj*); +static void nsub_cx_re(n_number*, LispObj*); +static void nmul_cx_re(n_number*, LispObj*); +static void ndiv_cx_re(n_number*, LispObj*); + +/* complex complex */ +static void nadd_cx_cx(n_number*, LispObj*); +static void nsub_cx_cx(n_number*, LispObj*); +static void nmul_cx_cx(n_number*, LispObj*); +static void ndiv_cx_cx(n_number*, LispObj*); +static int cmp_cx_cx(LispObj*, LispObj*); + +/* flonum flonum */ +static void radd_flonum(n_real*, double, double); +static void rsub_flonum(n_real*, double, double); +static void rmul_flonum(n_real*, double, double); +static void rdiv_flonum(n_real*, double, double); +static int cmp_flonum(double, double); + +/* fixnum fixnum */ +static void rop_fi_fi_bi(n_real*, long, int); +static INLINE void radd_fi_fi(n_real*, long); +static INLINE void rsub_fi_fi(n_real*, long); +static INLINE void rmul_fi_fi(n_real*, long); +static INLINE void rdiv_fi_fi(n_real*, long); +static INLINE int cmp_fi_fi(long, long); +static void ndivide_fi_fi(n_number*, long, int, int); + +/* fixnum bignum */ +static void rop_fi_bi_xi(n_real*, mpi*, int); +static INLINE void radd_fi_bi(n_real*, mpi*); +static INLINE void rsub_fi_bi(n_real*, mpi*); +static INLINE void rmul_fi_bi(n_real*, mpi*); +static void rdiv_fi_bi(n_real*, mpi*); +static INLINE int cmp_fi_bi(long, mpi*); + +/* fixnum fixratio */ +static void rop_fi_fr_as_xr(n_real*, long, long, int); +static void rop_fi_fr_md_xr(n_real*, long, long, int); +static INLINE void radd_fi_fr(n_real*, long, long); +static INLINE void rsub_fi_fr(n_real*, long, long); +static INLINE void rmul_fi_fr(n_real*, long, long); +static INLINE void rdiv_fi_fr(n_real*, long, long); +static INLINE int cmp_fi_fr(long, long, long); + +/* fixnum bigratio */ +static void rop_fi_br_as_xr(n_real*, mpr*, int); +static void rop_fi_br_md_xr(n_real*, mpr*, int); +static INLINE void radd_fi_br(n_real*, mpr*); +static INLINE void rsub_fi_br(n_real*, mpr*); +static INLINE void rmul_fi_br(n_real*, mpr*); +static INLINE void rdiv_fi_br(n_real*, mpr*); +static INLINE int cmp_fi_br(long, mpr*); + +/* bignum fixnum */ +static INLINE void radd_bi_fi(n_real*, long); +static INLINE void rsub_bi_fi(n_real*, long); +static INLINE void rmul_bi_fi(n_real*, long); +static void rdiv_bi_fi(n_real*, long); +static INLINE int cmp_bi_fi(mpi*, long); + +/* bignum bignum */ +static INLINE void radd_bi_bi(n_real*, mpi*); +static INLINE void rsub_bi_bi(n_real*, mpi*); +static INLINE void rmul_bi_bi(n_real*, mpi*); +static void rdiv_bi_bi(n_real*, mpi*); +static INLINE int cmp_bi_bi(mpi*, mpi*); + +/* bignum fixratio */ +static void rop_bi_fr_as_xr(n_real*, long, long, int); +static void rop_bi_fr_md_xr(n_real*, long, long, int); +static INLINE void radd_bi_fr(n_real*, long, long); +static INLINE void rsub_bi_fr(n_real*, long, long); +static INLINE void rmul_bi_fr(n_real*, long, long); +static INLINE void rdiv_bi_fr(n_real*, long, long); +static int cmp_bi_fr(mpi*, long, long); + +/* bignum bigratio */ +static void rop_bi_br_as_xr(n_real*, mpr*, int); +static void rop_bi_br_md_xr(n_real*, mpr*, int); +static INLINE void radd_bi_br(n_real*, mpr*); +static INLINE void rsub_bi_br(n_real*, mpr*); +static INLINE void rmul_bi_br(n_real*, mpr*); +static INLINE void rdiv_bi_br(n_real*, mpr*); +static int cmp_bi_br(mpi*, mpr*); + +/* fixratio fixnum */ +static void rop_fr_fi_as_xr(n_real*, long, int); +static void rop_fr_fi_md_xr(n_real*, long, int); +static INLINE void radd_fr_fi(n_real*, long); +static INLINE void rsub_fr_fi(n_real*, long); +static INLINE void rmul_fr_fi(n_real*, long); +static INLINE void rdiv_fr_fi(n_real*, long); +static INLINE int cmp_fr_fi(long, long, long); + +/* fixratio bignum */ +static void rop_fr_bi_as_xr(n_real*, mpi*, int); +static void rop_fr_bi_md_xr(n_real*, mpi*, int); +static INLINE void radd_fr_bi(n_real*, mpi*); +static INLINE void rsub_fr_bi(n_real*, mpi*); +static INLINE void rmul_fr_bi(n_real*, mpi*); +static INLINE void rdiv_fr_bi(n_real*, mpi*); +static int cmp_fr_bi(long, long, mpi*); + +/* fixratio fixratio */ +static void rop_fr_fr_as_xr(n_real*, long, long, int); +static void rop_fr_fr_md_xr(n_real*, long, long, int); +static INLINE void radd_fr_fr(n_real*, long, long); +static INLINE void rsub_fr_fr(n_real*, long, long); +static INLINE void rmul_fr_fr(n_real*, long, long); +static INLINE void rdiv_fr_fr(n_real*, long, long); +static INLINE int cmp_fr_fr(long, long, long, long); + +/* fixratio bigratio */ +static void rop_fr_br_asmd_xr(n_real*, mpr*, int); +static INLINE void radd_fr_br(n_real*, mpr*); +static INLINE void rsub_fr_br(n_real*, mpr*); +static INLINE void rmul_fr_br(n_real*, mpr*); +static INLINE void rdiv_fr_br(n_real*, mpr*); +static int cmp_fr_br(long, long, mpr*); + +/* bigratio fixnum */ +static void rop_br_fi_asmd_xr(n_real*, long, int); +static INLINE void radd_br_fi(n_real*, long); +static INLINE void rsub_br_fi(n_real*, long); +static INLINE void rmul_br_fi(n_real*, long); +static INLINE void rdiv_br_fi(n_real*, long); +static int cmp_br_fi(mpr*, long); + +/* bigratio bignum */ +static void rop_br_bi_as_xr(n_real*, mpi*, int); +static INLINE void radd_br_bi(n_real*, mpi*); +static INLINE void rsub_br_bi(n_real*, mpi*); +static INLINE void rmul_br_bi(n_real*, mpi*); +static INLINE void rdiv_br_bi(n_real*, mpi*); +static int cmp_br_bi(mpr*, mpi*); + +/* bigratio fixratio */ +static void rop_br_fr_asmd_xr(n_real*, long, long, int); +static INLINE void radd_br_fr(n_real*, long, long); +static INLINE void rsub_br_fr(n_real*, long, long); +static INLINE void rmul_br_fr(n_real*, long, long); +static INLINE void rdiv_br_fr(n_real*, long, long); +static int cmp_br_fr(mpr*, long, long); + +/* bigratio bigratio */ +static INLINE void radd_br_br(n_real*, mpr*); +static INLINE void rsub_br_br(n_real*, mpr*); +static INLINE void rmul_br_br(n_real*, mpr*); +static INLINE void rdiv_br_br(n_real*, mpr*); +static INLINE int cmp_br_br(mpr*, mpr*); + +/* + * Initialization + */ +static n_real zero, one, two; + +static char *fatal_error_strings[] = { +#define DIVIDE_BY_ZERO 0 + "divide by zero", +#define FLOATING_POINT_OVERFLOW 1 + "floating point overflow", +#define FLOATING_POINT_EXCEPTION 2 + "floating point exception" +}; + +static char *fatal_object_error_strings[] = { +#define NOT_A_NUMBER 0 + "is not a number", +#define NOT_A_REAL_NUMBER 1 + "is not a real number", +#define NOT_AN_INTEGER 2 + "is not an integer" +}; + +/* + * Implementation + */ +static void +fatal_error(int num) +{ + LispDestroy(fatal_error_strings[num]); +} + +static void +fatal_object_error(LispObj *obj, int num) +{ + LispDestroy("%s %s", STROBJ(obj), fatal_object_error_strings[num]); +} + +static void +fatal_builtin_object_error(LispBuiltin *builtin, LispObj *obj, int num) +{ + LispDestroy("%s: %s %s", STRFUN(builtin), STROBJ(obj), + fatal_object_error_strings[num]); +} + +static void +number_init(void) +{ + zero.type = one.type = two.type = N_FIXNUM; + zero.data.fixnum = 0; + one.data.fixnum = 1; + two.data.fixnum = 2; +} + +static double +bi_getd(mpi *bignum) +{ + double value = mpi_getd(bignum); + + if (!finite(value)) + fatal_error(FLOATING_POINT_EXCEPTION); + + return (value); +} + +static double +br_getd(mpr *bigratio) +{ + double value = mpr_getd(bigratio); + + if (!finite(value)) + fatal_error(FLOATING_POINT_EXCEPTION); + + return (value); +} + +static LispObj * +number_pi(void) +{ + LispObj *result; +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + result = DFLOAT(M_PI); + + return (result); +} + +static void +set_real_real(n_real *real, n_real *val) +{ + switch (RTYPE(real) = RTYPE(val)) { + case N_FIXNUM: + RFI(real) = RFI(val); + break; + case N_BIGNUM: + RBI(real) = XALLOC(mpi); + mpi_init(RBI(real)); + mpi_set(RBI(real), RBI(val)); + break; + case N_FLONUM: + RFF(real) = RFF(val); + break; + case N_FIXRATIO: + RFRN(real) = RFRN(val); + RFRD(real) = RFRD(val); + break; + case N_BIGRATIO: + RBR(real) = XALLOC(mpr); + mpr_init(RBR(real)); + mpr_set(RBR(real), RBR(val)); + break; + } +} + +static void +set_real_object(n_real *real, LispObj *obj) +{ + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + RTYPE(real) = N_FIXNUM; + RFI(real) = OFI(obj); + break; + case LispInteger_t: + RTYPE(real) = N_FIXNUM; + RFI(real) = OII(obj); + break; + case LispBignum_t: + RTYPE(real) = N_BIGNUM; + RBI(real) = XALLOC(mpi); + mpi_init(RBI(real)); + mpi_set(RBI(real), OBI(obj)); + break; + case LispDFloat_t: + RTYPE(real) = N_FLONUM; + RFF(real) = ODF(obj); + break; + case LispRatio_t: + RTYPE(real) = N_FIXRATIO; + RFRN(real) = OFRN(obj); + RFRD(real) = OFRD(obj); + break; + case LispBigratio_t: + RTYPE(real) = N_BIGRATIO; + RBR(real) = XALLOC(mpr); + mpr_init(RBR(real)); + mpr_set(RBR(real), OBR(obj)); + break; + default: + fatal_object_error(obj, NOT_A_REAL_NUMBER); + break; + } +} + +static void +set_number_object(n_number *num, LispObj *obj) +{ + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + num->complex = 0; + NRTYPE(num) = N_FIXNUM; + NRFI(num) = OFI(obj); + break; + case LispInteger_t: + num->complex = 0; + NRTYPE(num) = N_FIXNUM; + NRFI(num) = OII(obj); + break; + case LispBignum_t: + num->complex = 0; + NRTYPE(num) = N_BIGNUM; + NRBI(num) = XALLOC(mpi); + mpi_init(NRBI(num)); + mpi_set(NRBI(num), OBI(obj)); + break; + case LispDFloat_t: + num->complex = 0; + NRTYPE(num) = N_FLONUM; + NRFF(num) = ODF(obj); + break; + case LispRatio_t: + num->complex = 0; + NRTYPE(num) = N_FIXRATIO; + NRFRN(num) = OFRN(obj); + NRFRD(num) = OFRD(obj); + break; + case LispBigratio_t: + num->complex = 0; + NRTYPE(num) = N_BIGRATIO; + NRBR(num) = XALLOC(mpr); + mpr_init(NRBR(num)); + mpr_set(NRBR(num), OBR(obj)); + break; + case LispComplex_t: + num->complex = 1; + set_real_object(NREAL(num), OCXR(obj)); + set_real_object(NIMAG(num), OCXI(obj)); + break; + default: + fatal_object_error(obj, NOT_A_NUMBER); + break; + } +} + +static void +clear_real(n_real *real) +{ + if (RTYPE(real) == N_BIGNUM) { + mpi_clear(RBI(real)); + XFREE(RBI(real)); + } + else if (RTYPE(real) == N_BIGRATIO) { + mpr_clear(RBR(real)); + XFREE(RBR(real)); + } +} + +static void +clear_number(n_number *num) +{ + clear_real(NREAL(num)); + if (num->complex) + clear_real(NIMAG(num)); +} + +static LispObj * +make_real_object(n_real *real) +{ + LispObj *obj; + + switch (RTYPE(real)) { + case N_FIXNUM: + if (RFI(real) > MOST_POSITIVE_FIXNUM || + RFI(real) < MOST_NEGATIVE_FIXNUM) { + obj = LispNew(NIL, NIL); + obj->type = LispInteger_t; + OII(obj) = RFI(real); + } + else + obj = FIXNUM(RFI(real)); + break; + case N_BIGNUM: + obj = BIGNUM(RBI(real)); + break; + case N_FLONUM: + obj = DFLOAT(RFF(real)); + break; + case N_FIXRATIO: + obj = LispNew(NIL, NIL); + obj->type = LispRatio_t; + OFRN(obj) = RFRN(real); + OFRD(obj) = RFRD(real); + break; + case N_BIGRATIO: + obj = BIGRATIO(RBR(real)); + break; + default: + obj = NIL; + break; + } + + return (obj); +} + +static LispObj * +make_number_object(n_number *num) +{ + LispObj *obj; + + if (num->complex) { + GC_ENTER(); + + obj = LispNew(NIL, NIL); + GC_PROTECT(obj); + OCXI(obj) = NIL; + obj->type = LispComplex_t; + OCXR(obj) = make_real_object(NREAL(num)); + OCXI(obj) = make_real_object(NIMAG(num)); + GC_LEAVE(); + } + else { + switch (NRTYPE(num)) { + case N_FIXNUM: + if (NRFI(num) > MOST_POSITIVE_FIXNUM || + NRFI(num) < MOST_NEGATIVE_FIXNUM) { + obj = LispNew(NIL, NIL); + obj->type = LispInteger_t; + OII(obj) = NRFI(num); + } + else + obj = FIXNUM(NRFI(num)); + break; + case N_BIGNUM: + obj = BIGNUM(NRBI(num)); + break; + case N_FLONUM: + obj = DFLOAT(NRFF(num)); + break; + case N_FIXRATIO: + obj = LispNew(NIL, NIL); + obj->type = LispRatio_t; + OFRN(obj) = NRFRN(num); + OFRD(obj) = NRFRD(num); + break; + case N_BIGRATIO: + obj = BIGRATIO(NRBR(num)); + break; + default: + obj = NIL; + break; + } + } + + return (obj); +} + +#define DEFOP_REAL_REAL(OP) \ +OP##_real_real(n_real *real, n_real *val) \ +{ \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + switch (RTYPE(val)) { \ + case N_FIXNUM: \ + r##OP##_fi_fi(real, RFI(val)); \ + break; \ + case N_BIGNUM: \ + r##OP##_fi_bi(real, RBI(val)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, (double)RFI(real), RFF(val)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fi_fr(real, RFRN(val), RFRD(val)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_fi_br(real, RBR(val)); \ + break; \ + } \ + break; \ + case N_BIGNUM: \ + switch (RTYPE(val)) { \ + case N_FIXNUM: \ + r##OP##_bi_fi(real, RFI(val)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_bi(real, RBI(val)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, bi_getd(RBI(real)), RFF(val)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_bi_fr(real, RFRN(val), RFRD(val)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_bi_br(real, RBR(val)); \ + break; \ + } \ + break; \ + case N_FLONUM: \ + switch (RTYPE(val)) { \ + case N_FIXNUM: \ + r##OP##_flonum(real, RFF(real), (double)RFI(val)); \ + break; \ + case N_BIGNUM: \ + r##OP##_flonum(real, RFF(real), bi_getd(RBI(val))); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), RFF(val)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_flonum(real, RFF(real), \ + (double)RFRN(val) / (double)RFRD(val));\ + break; \ + case N_BIGRATIO: \ + r##OP##_flonum(real, RFF(real), br_getd(RBR(val))); \ + break; \ + } \ + break; \ + case N_FIXRATIO: \ + switch (RTYPE(val)) { \ + case N_FIXNUM: \ + r##OP##_fr_fi(real, RFI(val)); \ + break; \ + case N_BIGNUM: \ + r##OP##_fr_bi(real, RBI(val)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, \ + (double)RFRN(real) / (double)RFRD(real),\ + RFF(val)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fr(real, RFRN(val), RFRD(val)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_fr_br(real, RBR(val)); \ + break; \ + } \ + break; \ + case N_BIGRATIO: \ + switch (RTYPE(val)) { \ + case N_FIXNUM: \ + r##OP##_br_fi(real, RFI(val)); \ + break; \ + case N_BIGNUM: \ + r##OP##_br_bi(real, RBI(val)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, br_getd(RBR(real)), RFF(val)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_br_fr(real, RFRN(val), RFRD(val)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_br(real, RBR(val)); \ + break; \ + } \ + break; \ + } \ +} + +static void +DEFOP_REAL_REAL(add) + +static void +DEFOP_REAL_REAL(sub) + +static void +DEFOP_REAL_REAL(div) + +static void +DEFOP_REAL_REAL(mul) + + +#define DEFOP_REAL_OBJECT(OP) \ +OP##_real_object(n_real *real, LispObj *obj) \ +{ \ + switch (OBJECT_TYPE(obj)) { \ + case LispFixnum_t: \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + r##OP##_fi_fi(real, OFI(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_fi(real, OFI(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), (double)OFI(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fi(real, OFI(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_fi(real, OFI(obj)); \ + break; \ + } \ + break; \ + case LispInteger_t: \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + r##OP##_fi_fi(real, OII(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_fi(real, OII(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), (double)OII(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fi(real, OII(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_fi(real, OII(obj)); \ + break; \ + } \ + break; \ + case LispBignum_t: \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + r##OP##_fi_bi(real, OBI(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_bi(real, OBI(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), bi_getd(OBI(obj))); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_bi(real, OBI(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_bi(real, OBI(obj)); \ + break; \ + } \ + break; \ + case LispDFloat_t: \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + r##OP##_flonum(real, (double)RFI(real), ODF(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_flonum(real, bi_getd(RBI(real)), ODF(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), ODF(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_flonum(real, \ + (double)RFRN(real) / (double)RFRD(real),\ + ODF(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_flonum(real, br_getd(RBR(real)), ODF(obj)); \ + break; \ + } \ + break; \ + case LispRatio_t: \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + r##OP##_fi_fr(real, OFRN(obj), OFRD(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_fr(real, OFRN(obj), OFRD(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), \ + (double)OFRN(obj) / (double)OFRD(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fr(real, OFRN(obj), OFRD(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_fr(real, OFRN(obj), OFRD(obj)); \ + break; \ + } \ + break; \ + case LispBigratio_t: \ + switch (RTYPE(real)) { \ + case N_FIXNUM: \ + r##OP##_fi_br(real, OBR(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_br(real, OBR(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(real, RFF(real), br_getd(OBR(obj))); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_br(real, OBR(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_br(real, OBR(obj)); \ + break; \ + } \ + break; \ + default: \ + fatal_object_error(obj, NOT_A_REAL_NUMBER); \ + break; \ + } \ +} + +static void +DEFOP_REAL_OBJECT(add) + +static void +DEFOP_REAL_OBJECT(sub) + +static void +DEFOP_REAL_OBJECT(div) + +static void +DEFOP_REAL_OBJECT(mul) + + +#define DEFOP_NUMBER_OBJECT(OP) \ +OP##_number_object(n_number *num, LispObj *obj) \ +{ \ + if (num->complex) { \ + switch (OBJECT_TYPE(obj)) { \ + case LispFixnum_t: \ + case LispInteger_t: \ + case LispBignum_t: \ + case LispDFloat_t: \ + case LispRatio_t: \ + case LispBigratio_t: \ + n##OP##_cx_re(num, obj); \ + break; \ + case LispComplex_t: \ + n##OP##_cx_cx(num, obj); \ + break; \ + default: \ + fatal_object_error(obj, NOT_A_NUMBER); \ + break; \ + } \ + } \ + else { \ + switch (OBJECT_TYPE(obj)) { \ + case LispFixnum_t: \ + switch (NRTYPE(num)) { \ + case N_FIXNUM: \ + r##OP##_fi_fi(NREAL(num), OFI(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_fi(NREAL(num), OFI(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(NREAL(num), NRFF(num), \ + (double)OFI(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fi(NREAL(num), OFI(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_fi(NREAL(num), OFI(obj)); \ + break; \ + } \ + break; \ + case LispInteger_t: \ + switch (NRTYPE(num)) { \ + case N_FIXNUM: \ + r##OP##_fi_fi(NREAL(num), OII(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_fi(NREAL(num), OII(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(NREAL(num), NRFF(num), \ + (double)OII(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fi(NREAL(num), OII(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_fi(NREAL(num), OII(obj)); \ + break; \ + } \ + break; \ + case LispBignum_t: \ + switch (NRTYPE(num)) { \ + case N_FIXNUM: \ + r##OP##_fi_bi(NREAL(num), OBI(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_bi(NREAL(num), OBI(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(NREAL(num), NRFF(num), \ + bi_getd(OBI(obj))); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_bi(NREAL(num), OBI(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_bi(NREAL(num), OBI(obj)); \ + break; \ + } \ + break; \ + case LispDFloat_t: \ + switch (NRTYPE(num)) { \ + case N_FIXNUM: \ + r##OP##_flonum(NREAL(num), (double)NRFI(num), \ + ODF(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_flonum(NREAL(num), bi_getd(NRBI(num)), \ + ODF(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(NREAL(num), NRFF(num), ODF(obj));\ + break; \ + case N_FIXRATIO: \ + r##OP##_flonum(NREAL(num), \ + (double)NRFRN(num) / \ + (double)NRFRD(num), \ + ODF(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_flonum(NREAL(num), br_getd(NRBR(num)), \ + ODF(obj)); \ + break; \ + } \ + break; \ + case LispRatio_t: \ + switch (NRTYPE(num)) { \ + case N_FIXNUM: \ + r##OP##_fi_fr(NREAL(num), OFRN(obj), OFRD(obj));\ + break; \ + case N_BIGNUM: \ + r##OP##_bi_fr(NREAL(num), OFRN(obj), OFRD(obj));\ + break; \ + case N_FLONUM: \ + r##OP##_flonum(NREAL(num), NRFF(num), \ + (double)OFRN(obj) / \ + (double)OFRD(obj)); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_fr(NREAL(num), OFRN(obj), OFRD(obj));\ + break; \ + case N_BIGRATIO: \ + r##OP##_br_fr(NREAL(num), OFRN(obj), OFRD(obj));\ + break; \ + } \ + break; \ + case LispBigratio_t: \ + switch (NRTYPE(num)) { \ + case N_FIXNUM: \ + r##OP##_fi_br(NREAL(num), OBR(obj)); \ + break; \ + case N_BIGNUM: \ + r##OP##_bi_br(NREAL(num), OBR(obj)); \ + break; \ + case N_FLONUM: \ + r##OP##_flonum(NREAL(num), NRFF(num), \ + br_getd(OBR(obj))); \ + break; \ + case N_FIXRATIO: \ + r##OP##_fr_br(NREAL(num), OBR(obj)); \ + break; \ + case N_BIGRATIO: \ + r##OP##_br_br(NREAL(num), OBR(obj)); \ + break; \ + } \ + break; \ + case LispComplex_t: \ + n##OP##_re_cx(num, obj); \ + break; \ + default: \ + fatal_object_error(obj, NOT_A_NUMBER); \ + break; \ + } \ + } \ +} + +static void +DEFOP_NUMBER_OBJECT(add) + +static void +DEFOP_NUMBER_OBJECT(sub) + +static void +DEFOP_NUMBER_OBJECT(div) + +static void +DEFOP_NUMBER_OBJECT(mul) + + +/************************************************************************ + * ABS + ************************************************************************/ +static void +abs_real(n_real *real) +{ + switch (RTYPE(real)) { + case N_FIXNUM: rabs_fi(real); break; + case N_BIGNUM: rabs_bi(real); break; + case N_FLONUM: rabs_ff(real); break; + case N_FIXRATIO: rabs_fr(real); break; + case N_BIGRATIO: rabs_br(real); break; + } +} + +static void +abs_number(n_number *num) +{ + if (num->complex) + nabs_cx(num); + else { + switch (NRTYPE(num)) { + case N_FIXNUM: rabs_fi(NREAL(num)); break; + case N_BIGNUM: rabs_bi(NREAL(num)); break; + case N_FLONUM: rabs_ff(NREAL(num)); break; + case N_FIXRATIO: rabs_fr(NREAL(num)); break; + case N_BIGRATIO: rabs_br(NREAL(num)); break; + } + } +} + +static void +nabs_cx(n_number *num) +{ + n_real temp; + + abs_real(NREAL(num)); + abs_real(NIMAG(num)); + + if (cmp_real_real(NREAL(num), NIMAG(num)) < 0) { + memcpy(&temp, NIMAG(num), sizeof(n_real)); + memcpy(NIMAG(num), NREAL(num), sizeof(n_real)); + memcpy(NREAL(num), &temp, sizeof(n_real)); + } + + if (cmp_real_real(NIMAG(num), &zero) == 0) { + num->complex = 0; + if (NITYPE(num) == N_FLONUM) { + /* change number type */ + temp.type = N_FLONUM; + temp.data.flonum = 1.0; + mul_real_real(NREAL(num), &temp); + } + else + clear_real(NIMAG(num)); + } + else { + div_real_real(NIMAG(num), NREAL(num)); + set_real_real(&temp, NIMAG(num)); + mul_real_real(NIMAG(num), &temp); + clear_real(&temp); + + add_real_real(NIMAG(num), &one); + sqrt_real(NIMAG(num)); + + mul_real_real(NIMAG(num), NREAL(num)); + clear_real(NREAL(num)); + memcpy(NREAL(num), NIMAG(num), sizeof(n_real)); + num->complex = 0; + } +} + +static INLINE void +rabs_fi(n_real *real) +{ + if (RFI(real) < 0) + rneg_fi(real); +} + +static INLINE void +rabs_bi(n_real *real) +{ + if (mpi_cmpi(RBI(real), 0) < 0) + mpi_neg(RBI(real), RBI(real)); +} + +static INLINE void +rabs_ff(n_real *real) +{ + if (RFF(real) < 0.0) + RFF(real) = -RFF(real); +} + +static INLINE void +rabs_fr(n_real *real) +{ + if (RFRN(real) < 0) + rneg_fr(real); +} + +static INLINE void +rabs_br(n_real *real) +{ + if (mpi_cmpi(RBRN(real), 0) < 0) + mpi_neg(RBRN(real), RBRN(real)); +} + + +/************************************************************************ + * NEG + ************************************************************************/ +static void +neg_real(n_real *real) +{ + switch (RTYPE(real)) { + case N_FIXNUM: rneg_fi(real); break; + case N_BIGNUM: rneg_bi(real); break; + case N_FLONUM: rneg_ff(real); break; + case N_FIXRATIO: rneg_fr(real); break; + case N_BIGRATIO: rneg_br(real); break; + } +} + +static void +neg_number(n_number *num) +{ + if (num->complex) { + neg_real(NREAL(num)); + neg_real(NIMAG(num)); + } + else { + switch (NRTYPE(num)) { + case N_FIXNUM: rneg_fi(NREAL(num)); break; + case N_BIGNUM: rneg_bi(NREAL(num)); break; + case N_FLONUM: rneg_ff(NREAL(num)); break; + case N_FIXRATIO: rneg_fr(NREAL(num)); break; + case N_BIGRATIO: rneg_br(NREAL(num)); break; + } + } +} + +static void +rneg_fi(n_real *real) +{ + if (RFI(real) == MINSLONG) { + mpi *bigi = XALLOC(mpi); + + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_neg(bigi, bigi); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + } + else + RFI(real) = -RFI(real); +} + +static INLINE void +rneg_bi(n_real *real) +{ + mpi_neg(RBI(real), RBI(real)); +} + +static INLINE void +rneg_ff(n_real *real) +{ + RFF(real) = -RFF(real); +} + +static void +rneg_fr(n_real *real) +{ + if (RFRN(real) == MINSLONG) { + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, RFRN(real), RFRD(real)); + mpi_neg(mpr_num(bigr), mpr_num(bigr)); + RTYPE(real) = N_BIGRATIO; + RBR(real) = bigr; + } + else + RFRN(real) = -RFRN(real); +} + +static INLINE void +rneg_br(n_real *real) +{ + mpi_neg(RBRN(real), RBRN(real)); +} + + +/************************************************************************ + * SQRT + ************************************************************************/ +static void +sqrt_real(n_real *real) +{ + switch (RTYPE(real)) { + case N_FIXNUM: + case N_BIGNUM: + rsqrt_xi(real); + break; + case N_FLONUM: + rsqrt_ff(real); + break; + case N_FIXRATIO: + case N_BIGRATIO: + rsqrt_xr(real); + break; + } +} + +static void +sqrt_number(n_number *num) +{ + if (num->complex) + nsqrt_cx(num); + else { + switch (NRTYPE(num)) { + case N_FIXNUM: + case N_BIGNUM: + nsqrt_xi(num); + break; + case N_FLONUM: + nsqrt_ff(num); + break; + case N_FIXRATIO: + case N_BIGRATIO: + nsqrt_xr(num); + break; + } + } +} + +static void +rsqrt_xi(n_real *real) +{ + int exact; + mpi bignum; + + if (cmp_real_real(real, &zero) < 0) + fatal_error(FLOATING_POINT_EXCEPTION); + + mpi_init(&bignum); + if (RTYPE(real) == N_BIGNUM) + exact = mpi_sqrt(&bignum, RBI(real)); + else { + mpi tmp; + + mpi_init(&tmp); + mpi_seti(&tmp, RFI(real)); + exact = mpi_sqrt(&bignum, &tmp); + mpi_clear(&tmp); + } + if (exact) { + if (RTYPE(real) == N_BIGNUM) { + mpi_set(RBI(real), &bignum); + rbi_canonicalize(real); + } + else + RFI(real) = mpi_geti(&bignum); + } + else { + double value; + + if (RTYPE(real) == N_BIGNUM) { + value = bi_getd(RBI(real)); + RCLEAR_BI(real); + } + else + value = (double)RFI(real); + + value = sqrt(value); + RTYPE(real) = N_FLONUM; + RFF(real) = value; + } + mpi_clear(&bignum); +} + +static void +rsqrt_xr(n_real *real) +{ + n_real num, den; + + if (cmp_real_real(real, &zero) < 0) + fatal_error(FLOATING_POINT_EXCEPTION); + + if (RTYPE(real) == N_FIXRATIO) { + num.type = den.type = N_FIXNUM; + num.data.fixnum = RFRN(real); + den.data.fixnum = RFRD(real); + } + else { + mpi *bignum; + + if (mpi_fiti(RBRN(real))) { + num.type = N_FIXNUM; + num.data.fixnum = mpi_geti(RBRN(real)); + } + else { + bignum = XALLOC(mpi); + mpi_init(bignum); + mpi_set(bignum, RBRN(real)); + num.type = N_BIGNUM; + num.data.bignum = bignum; + } + + if (mpi_fiti(RBRD(real))) { + den.type = N_FIXNUM; + den.data.fixnum = mpi_geti(RBRD(real)); + } + else { + bignum = XALLOC(mpi); + mpi_init(bignum); + mpi_set(bignum, RBRD(real)); + den.type = N_BIGNUM; + den.data.bignum = bignum; + } + } + + rsqrt_xi(&num); + rsqrt_xi(&den); + + clear_real(real); + memcpy(real, &num, sizeof(n_real)); + div_real_real(real, &den); + clear_real(&den); +} + +static void +rsqrt_ff(n_real *real) +{ + if (RFF(real) < 0.0) + fatal_error(FLOATING_POINT_EXCEPTION); + RFF(real) = sqrt(RFF(real)); +} + + +static void +nsqrt_cx(n_number *num) +{ + n_number mag; + n_real *real, *imag; + + real = &(mag.real); + imag = &(mag.imag); + set_real_real(real, NREAL(num)); + set_real_real(imag, NIMAG(num)); + mag.complex = 1; + + nabs_cx(&mag); /* this will free the imag part data */ + if (cmp_real_real(real, &zero) == 0) { + clear_number(num); + memcpy(NREAL(num), real, sizeof(n_real)); + clear_real(real); + num->complex = 0; + return; + } + else if (cmp_real_real(NREAL(num), &zero) > 0) { + /* R = sqrt((mag + Ra) / 2) */ + add_real_real(NREAL(num), real); + clear_real(real); + div_real_real(NREAL(num), &two); + sqrt_real(NREAL(num)); + + /* I = Ia / R / 2 */ + div_real_real(NIMAG(num), NREAL(num)); + div_real_real(NIMAG(num), &two); + } + else { + /* remember old imag part */ + memcpy(imag, NIMAG(num), sizeof(n_real)); + + /* I = sqrt((mag - Ra) / 2) */ + memcpy(NIMAG(num), real, sizeof(n_real)); + sub_real_real(NIMAG(num), NREAL(num)); + div_real_real(NIMAG(num), &two); + sqrt_real(NIMAG(num)); + if (cmp_real_real(imag, &zero) < 0) + neg_real(NIMAG(num)); + + /* R = Ia / I / 2 */ + clear_real(NREAL(num)); + /* start with old imag part */ + memcpy(NREAL(num), imag, sizeof(n_real)); + div_real_real(NREAL(num), NIMAG(num)); + div_real_real(NREAL(num), &two); + } + + ncx_canonicalize(num); +} + +static void +nsqrt_xi(n_number *num) +{ + if (cmp_real_real(NREAL(num), &zero) < 0) { + memcpy(NIMAG(num), NREAL(num), sizeof(n_real)); + neg_real(NIMAG(num)); + rsqrt_xi(NIMAG(num)); + NRTYPE(num) = N_FIXNUM; + NRFI(num) = 0; + num->complex = 1; + } + else + rsqrt_xi(NREAL(num)); +} + +static void +nsqrt_ff(n_number *num) +{ + double value; + + if (NRFF(num) < 0.0) { + value = sqrt(-NRFF(num)); + + NITYPE(num) = N_FLONUM; + NIFF(num) = value; + NRTYPE(num) = N_FIXNUM; + NRFI(num) = 0; + num->complex = 1; + } + else { + value = sqrt(NRFF(num)); + NRFF(num) = value; + } +} + +static void +nsqrt_xr(n_number *num) +{ + if (cmp_real_real(NREAL(num), &zero) < 0) { + memcpy(NIMAG(num), NREAL(num), sizeof(n_real)); + neg_real(NIMAG(num)); + rsqrt_xr(NIMAG(num)); + NRTYPE(num) = N_FIXNUM; + NRFI(num) = 0; + num->complex = 1; + } + else + rsqrt_xr(NREAL(num)); +} + + +/************************************************************************ + * MOD + ************************************************************************/ +static void +mod_real_real(n_real *real, n_real *val) +{ + /* Assume both operands are integers */ + switch (RTYPE(real)) { + case N_FIXNUM: + switch (RTYPE(val)) { + case N_FIXNUM: + rmod_fi_fi(real, RFI(val)); + break; + case N_BIGNUM: + rmod_fi_bi(real, RBI(val)); + break; + } + break; + case N_BIGNUM: + switch (RTYPE(val)) { + case N_FIXNUM: + rmod_bi_fi(real, RFI(val)); + break; + case N_BIGNUM: + rmod_bi_bi(real, RBI(val)); + break; + } + break; + } +} + +static void +mod_real_object(n_real *real, LispObj *obj) +{ + switch (RTYPE(real)) { + case N_FIXNUM: + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + rmod_fi_fi(real, OFI(obj)); + return; + case LispInteger_t: + rmod_fi_fi(real, OII(obj)); + return; + case LispBignum_t: + rmod_fi_bi(real, OBI(obj)); + return; + default: + break; + } + break; + case N_BIGNUM: + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + rmod_bi_fi(real, OFI(obj)); + return; + case LispInteger_t: + rmod_bi_fi(real, OII(obj)); + return; + case LispBignum_t: + rmod_bi_bi(real, OBI(obj)); + return; + default: + break; + } + break; + /* Assume the n_real object is an integer */ + } + fatal_object_error(obj, NOT_AN_INTEGER); +} + +static void +rmod_fi_fi(n_real *real, long fi) +{ + if (fi == 0) + fatal_error(DIVIDE_BY_ZERO); + + if ((RFI(real) < 0) ^ (fi < 0)) + RFI(real) = (RFI(real) % fi) + fi; + else if (RFI(real) == MINSLONG || fi == MINSLONG) { + mpi bignum; + + mpi_init(&bignum); + mpi_seti(&bignum, RFI(real)); + RFI(real) = mpi_modi(&bignum, fi); + mpi_clear(&bignum); + } + else + RFI(real) = RFI(real) % fi; +} + +static void +rmod_fi_bi(n_real *real, mpi *bignum) +{ + mpi *bigi; + + if (mpi_cmpi(bignum, 0) == 0) + fatal_error(DIVIDE_BY_ZERO); + + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_mod(bigi, bigi, bignum); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + rbi_canonicalize(real); +} + +static void +rmod_bi_fi(n_real *real, long fi) +{ + mpi iop; + + if (fi == 0) + fatal_error(DIVIDE_BY_ZERO); + + mpi_init(&iop); + mpi_seti(&iop, fi); + mpi_mod(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); +} + +static void +rmod_bi_bi(n_real *real, mpi *bignum) +{ + if (mpi_cmpi(bignum, 0) == 0) + fatal_error(DIVIDE_BY_ZERO); + + mpi_mod(RBI(real), RBI(real), bignum); + rbi_canonicalize(real); +} + +/************************************************************************ + * REM + ************************************************************************/ +static void +rem_real_object(n_real *real, LispObj *obj) +{ + switch (RTYPE(real)) { + case N_FIXNUM: + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + rrem_fi_fi(real, OFI(obj)); + return; + case LispInteger_t: + rrem_fi_fi(real, OII(obj)); + return; + case LispBignum_t: + rrem_fi_bi(real, OBI(obj)); + return; + default: + break; + } + break; + case N_BIGNUM: + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + rrem_bi_fi(real, OFI(obj)); + return; + case LispInteger_t: + rrem_bi_fi(real, OII(obj)); + return; + case LispBignum_t: + rrem_bi_bi(real, OBI(obj)); + return; + default: + break; + } + break; + /* Assume the n_real object is an integer */ + } + fatal_object_error(obj, NOT_AN_INTEGER); +} + +static void +rrem_fi_fi(n_real *real, long fi) +{ + if (fi == 0) + fatal_error(DIVIDE_BY_ZERO); + + if (RFI(real) == MINSLONG || fi == MINSLONG) { + mpi bignum; + + mpi_init(&bignum); + mpi_seti(&bignum, RFI(real)); + RFI(real) = mpi_remi(&bignum, fi); + mpi_clear(&bignum); + } + else + RFI(real) = RFI(real) % fi; +} + +static void +rrem_fi_bi(n_real *real, mpi *bignum) +{ + mpi *bigi; + + if (mpi_cmpi(bignum, 0) == 0) + fatal_error(DIVIDE_BY_ZERO); + + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_rem(bigi, bigi, bignum); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + rbi_canonicalize(real); +} + +static void +rrem_bi_fi(n_real *real, long fi) +{ + mpi iop; + + if (fi == 0) + fatal_error(DIVIDE_BY_ZERO); + + mpi_init(&iop); + mpi_seti(&iop, fi); + mpi_rem(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); +} + +static void +rrem_bi_bi(n_real *real, mpi *bignum) +{ + if (mpi_cmpi(bignum, 0) == 0) + fatal_error(DIVIDE_BY_ZERO); + + mpi_rem(RBI(real), RBI(real), bignum); + rbi_canonicalize(real); +} + + +/************************************************************************ + * GCD + ************************************************************************/ +static void +gcd_real_object(n_real *real, LispObj *obj) +{ + if (!INTEGERP(obj)) + fatal_object_error(obj, NOT_AN_INTEGER); + + /* check for zero operand */ + if (cmp_real_real(real, &zero) == 0) + set_real_object(real, obj); + else if (cmp_real_object(&zero, obj) != 0) { + n_real rest, temp; + + set_real_object(&rest, obj); + for (;;) { + mod_real_real(&rest, real); + if (cmp_real_real(&rest, &zero) == 0) + break; + memcpy(&temp, real, sizeof(n_real)); + memcpy(real, &rest, sizeof(n_real)); + memcpy(&rest, &temp, sizeof(n_real)); + } + clear_real(&rest); + } +} + +/************************************************************************ + * AND + ************************************************************************/ +static void +and_real_object(n_real *real, LispObj *obj) +{ + mpi *bigi, iop; + + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) &= OFI(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OFI(obj)); + mpi_and(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispInteger_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) &= OII(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OII(obj)); + mpi_and(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispBignum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_and(bigi, bigi, OBI(obj)); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + rbi_canonicalize(real); + break; + case N_BIGNUM: + mpi_and(RBI(real), RBI(real), OBI(obj)); + rbi_canonicalize(real); + break; + } + break; + default: + fatal_object_error(obj, NOT_AN_INTEGER); + break; + } +} + + +/************************************************************************ + * EQV + ************************************************************************/ +static void +eqv_real_object(n_real *real, LispObj *obj) +{ + mpi *bigi, iop; + + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) ^= ~OFI(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OFI(obj)); + mpi_com(&iop, &iop); + mpi_xor(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispInteger_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) ^= ~OII(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OII(obj)); + mpi_com(&iop, &iop); + mpi_xor(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispBignum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_com(bigi, bigi); + mpi_xor(bigi, bigi, OBI(obj)); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + rbi_canonicalize(real); + break; + case N_BIGNUM: + mpi_com(RBI(real), RBI(real)); + mpi_xor(RBI(real), RBI(real), OBI(obj)); + rbi_canonicalize(real); + break; + } + break; + default: + fatal_object_error(obj, NOT_AN_INTEGER); + break; + } +} + + +/************************************************************************ + * IOR + ************************************************************************/ +static void +ior_real_object(n_real *real, LispObj *obj) +{ + mpi *bigi, iop; + + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) |= OFI(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OFI(obj)); + mpi_ior(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispInteger_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) |= OII(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OII(obj)); + mpi_ior(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispBignum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_ior(bigi, bigi, OBI(obj)); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + rbi_canonicalize(real); + break; + case N_BIGNUM: + mpi_ior(RBI(real), RBI(real), OBI(obj)); + rbi_canonicalize(real); + break; + } + break; + default: + fatal_object_error(obj, NOT_AN_INTEGER); + break; + } +} + + +/************************************************************************ + * NOT + ************************************************************************/ +static void +not_real(n_real *real) +{ + if (RTYPE(real) == N_FIXNUM) + RFI(real) = ~RFI(real); + else { + mpi_com(RBI(real), RBI(real)); + rbi_canonicalize(real); + } +} + +/************************************************************************ + * XOR + ************************************************************************/ +static void +xor_real_object(n_real *real, LispObj *obj) +{ + mpi *bigi, iop; + + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) ^= OFI(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OFI(obj)); + mpi_xor(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispInteger_t: + switch (RTYPE(real)) { + case N_FIXNUM: + RFI(real) ^= OII(obj); + break; + case N_BIGNUM: + mpi_init(&iop); + mpi_seti(&iop, OII(obj)); + mpi_xor(RBI(real), RBI(real), &iop); + mpi_clear(&iop); + rbi_canonicalize(real); + break; + } + break; + case LispBignum_t: + switch (RTYPE(real)) { + case N_FIXNUM: + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + mpi_xor(bigi, bigi, OBI(obj)); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + rbi_canonicalize(real); + break; + case N_BIGNUM: + mpi_xor(RBI(real), RBI(real), OBI(obj)); + rbi_canonicalize(real); + break; + } + break; + default: + fatal_object_error(obj, NOT_AN_INTEGER); + break; + } +} + + +/************************************************************************ + * DIVIDE + ************************************************************************/ +static void +divide_number_object(n_number *num, LispObj *obj, int fun, int flo) +{ + switch (OBJECT_TYPE(obj)) { + case LispFixnum_t: + switch (NRTYPE(num)) { + case N_FIXNUM: + ndivide_fi_fi(num, OFI(obj), fun, flo); + break; + case N_BIGNUM: + ndivide_xi_xi(num, obj, fun, flo); + break; + case N_FLONUM: + ndivide_flonum(num, NRFF(num), (double)OFI(obj), fun, flo); + break; + case N_FIXRATIO: + case N_BIGRATIO: + ndivide_xr_xi(num, obj, fun, flo); + break; + } + break; + case LispInteger_t: + switch (NRTYPE(num)) { + case N_FIXNUM: + ndivide_fi_fi(num, OII(obj), fun, flo); + break; + case N_BIGNUM: + ndivide_xi_xi(num, obj, fun, flo); + break; + case N_FLONUM: + ndivide_flonum(num, NRFF(num), (double)OII(obj), fun, flo); + break; + case N_FIXRATIO: + case N_BIGRATIO: + ndivide_xr_xi(num, obj, fun, flo); + break; + } + break; + case LispBignum_t: + switch (NRTYPE(num)) { + case N_FIXNUM: + case N_BIGNUM: + ndivide_xi_xi(num, obj, fun, flo); + break; + case N_FLONUM: + ndivide_flonum(num, NRFF(num), bi_getd(OBI(obj)), + fun, flo); + break; + case N_FIXRATIO: + case N_BIGRATIO: + ndivide_xr_xi(num, obj, fun, flo); + break; + } + break; + case LispDFloat_t: + switch (NRTYPE(num)) { + case N_FIXNUM: + ndivide_flonum(num, (double)NRFI(num), ODF(obj), + fun, flo); + break; + case N_BIGNUM: + ndivide_flonum(num, bi_getd(NRBI(num)), ODF(obj), + fun, flo); + break; + case N_FLONUM: + ndivide_flonum(num, NRFF(num), ODF(obj), fun, flo); + break; + case N_FIXRATIO: + ndivide_flonum(num, + (double)NRFRN(num) / (double)NRFRD(num), + ODF(obj), fun, flo); + break; + case N_BIGRATIO: + ndivide_flonum(num, br_getd(NRBR(num)), ODF(obj), + fun, flo); + break; + } + break; + case LispRatio_t: + switch (NRTYPE(num)) { + case N_FIXNUM: + case N_BIGNUM: + ndivide_xi_xr(num, obj, fun, flo); + break; + case N_FLONUM: + ndivide_flonum(num, NRFF(num), + (double)OFRN(obj) / (double)OFRD(obj), + fun, flo); + break; + case N_FIXRATIO: + case N_BIGRATIO: + ndivide_xr_xr(num, obj, fun, flo); + break; + } + break; + case LispBigratio_t: + switch (NRTYPE(num)) { + case N_FIXNUM: + case N_BIGNUM: + ndivide_xi_xr(num, obj, fun, flo); + break; + case N_FLONUM: + ndivide_flonum(num, NRFF(num), br_getd(OBR(obj)), + fun, flo); + break; + case N_FIXRATIO: + case N_BIGRATIO: + ndivide_xr_xr(num, obj, fun, flo); + break; + } + break; + default: + fatal_object_error(obj, NOT_A_REAL_NUMBER); + break; + } +} + + +/************************************************************************ + * COMPARE + ************************************************************************/ +static int +cmp_real_real(n_real *op1, n_real *op2) +{ + switch (RTYPE(op1)) { + case N_FIXNUM: + switch (RTYPE(op2)) { + case N_FIXNUM: + return (cmp_fi_fi(RFI(op1), RFI(op2))); + case N_BIGNUM: + return (cmp_fi_bi(RFI(op1), RBI(op2))); + case N_FLONUM: + return (cmp_flonum((double)RFI(op1), RFF(op2))); + case N_FIXRATIO: + return (cmp_fi_fr(RFI(op1), RFRN(op2), RFRD(op2))); + case N_BIGRATIO: + return (cmp_fi_br(RFI(op1), RBR(op2))); + } + break; + case N_BIGNUM: + switch (RTYPE(op2)) { + case N_FIXNUM: + return (cmp_bi_fi(RBI(op1), RFI(op2))); + case N_BIGNUM: + return (cmp_bi_bi(RBI(op1), RBI(op2))); + case N_FLONUM: + return (cmp_flonum(bi_getd(RBI(op1)), RFF(op2))); + case N_FIXRATIO: + return (cmp_bi_fr(RBI(op1), RFRN(op2), RFRD(op2))); + case N_BIGRATIO: + return (cmp_bi_br(RBI(op1), RBR(op2))); + } + break; + case N_FLONUM: + switch (RTYPE(op2)) { + case N_FIXNUM: + return (cmp_flonum(RFF(op1), (double)RFI(op2))); + case N_BIGNUM: + return (cmp_flonum(RFF(op1), bi_getd(RBI(op2)))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), RFF(op2))); + case N_FIXRATIO: + return (cmp_flonum(RFF(op1), + (double)RFRN(op2) / (double)RFRD(op2))); + case N_BIGRATIO: + return (cmp_flonum(RFF(op1), br_getd(RBR(op2)))); + } + break; + case N_FIXRATIO: + switch (RTYPE(op2)) { + case N_FIXNUM: + return (cmp_fr_fi(RFRN(op1), RFRD(op1), RFI(op2))); + case N_BIGNUM: + return (cmp_fr_bi(RFRN(op1), RFRD(op1), RBI(op2))); + case N_FLONUM: + return (cmp_flonum((double)RFRN(op1) / (double)RFRD(op1), + RFF(op2))); + case N_FIXRATIO: + return (cmp_fr_fr(RFRN(op1), RFRD(op1), + RFRN(op2), RFRD(op2))); + case N_BIGRATIO: + return (cmp_fr_br(RFRN(op1), RFRD(op1), RBR(op2))); + } + break; + case N_BIGRATIO: + switch (RTYPE(op2)) { + case N_FIXNUM: + return (cmp_br_fi(RBR(op1), RFI(op2))); + case N_BIGNUM: + return (cmp_br_bi(RBR(op1), RBI(op2))); + case N_FLONUM: + return (cmp_flonum(br_getd(RBR(op1)), RFF(op2))); + case N_FIXRATIO: + return (cmp_br_fr(RBR(op1), RFRN(op2), RFRD(op2))); + case N_BIGRATIO: + return (cmp_br_br(RBR(op1), RBR(op2))); + } + } + + return (0); +} + +static int +cmp_real_object(n_real *op1, LispObj *op2) +{ + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + switch (RTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_fi(RFI(op1), OFI(op2))); + case N_BIGNUM: + return (cmp_bi_fi(RBI(op1), OFI(op2))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), (double)OFI(op2))); + case N_FIXRATIO: + return (cmp_fr_fi(RFRD(op1), RFRN(op1), OFI(op2))); + case N_BIGRATIO: + return (cmp_br_fi(RBR(op1), OFI(op2))); + } + break; + case LispInteger_t: + switch (RTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_fi(RFI(op1), OII(op2))); + case N_BIGNUM: + return (cmp_bi_fi(RBI(op1), OII(op2))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), (double)OII(op2))); + case N_FIXRATIO: + return (cmp_fr_fi(RFRD(op1), RFRN(op1), OII(op2))); + case N_BIGRATIO: + return (cmp_br_fi(RBR(op1), OII(op2))); + } + break; + case LispBignum_t: + switch (RTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_bi(RFI(op1), OBI(op2))); + case N_BIGNUM: + return (cmp_bi_bi(RBI(op1), OBI(op2))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), bi_getd(OBI(op2)))); + case N_FIXRATIO: + return (cmp_fr_bi(RFRD(op1), RFRN(op1), OBI(op2))); + case N_BIGRATIO: + return (cmp_br_bi(RBR(op1), OBI(op2))); + } + break; + case LispDFloat_t: + switch (RTYPE(op1)) { + case N_FIXNUM: + return (cmp_flonum((double)RFI(op1), ODF(op2))); + case N_BIGNUM: + return (cmp_flonum(bi_getd(RBI(op1)), ODF(op2))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), ODF(op2))); + case N_FIXRATIO: + return (cmp_flonum((double)RFRN(op1) / (double)RFRD(op1), + ODF(op2))); + case N_BIGRATIO: + return (cmp_flonum(br_getd(RBR(op1)), ODF(op2))); + } + break; + case LispRatio_t: + switch (RTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_fr(RFI(op1), OFRN(op2), OFRD(op2))); + case N_BIGNUM: + return (cmp_bi_fr(RBI(op1), OFRN(op2), OFRD(op2))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), + (double)OFRN(op2) / (double)OFRD(op2))); + case N_FIXRATIO: + return (cmp_fr_fr(RFRN(op1), RFRD(op1), + OFRN(op2), OFRD(op2))); + case N_BIGRATIO: + return (cmp_br_fr(RBR(op1), OFRN(op2), OFRD(op2))); + } + break; + case LispBigratio_t: + switch (RTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_br(RFI(op1), OBR(op2))); + case N_BIGNUM: + return (cmp_bi_br(RBI(op1), OBR(op2))); + case N_FLONUM: + return (cmp_flonum(RFF(op1), br_getd(OBR(op2)))); + case N_FIXRATIO: + return (cmp_fr_br(RFRN(op1), RFRD(op1), OBR(op2))); + case N_BIGRATIO: + return (cmp_br_br(RBR(op1), OBR(op2))); + } + break; + default: + fatal_object_error(op2, NOT_A_REAL_NUMBER); + break; + } + + return (0); +} + +#if 0 /* not used */ +static int +cmp_number_object(n_number *op1, LispObj *op2) +{ + if (op1->complex) { + if (OBJECT_TYPE(op2) == LispComplex_t) { + if (cmp_real_object(NREAL(op1), OCXR(op2)) == 0) + return (cmp_real_object(NIMAG(op1), OCXI(op2))); + return (1); + } + else if (cmp_real_real(NIMAG(op1), &zero) == 0) + return (cmp_real_object(NREAL(op1), op2)); + else + return (1); + } + else { + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + switch (NRTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_fi(NRFI(op1), OFI(op2))); + case N_BIGNUM: + return (cmp_bi_fi(NRBI(op1), OFI(op2))); + case N_FLONUM: + return (cmp_flonum(NRFF(op1), (double)OFI(op2))); + case N_FIXRATIO: + return (cmp_fr_fi(NRFRD(op1), NRFRN(op1), OFI(op2))); + case N_BIGRATIO: + return (cmp_br_fi(NRBR(op1), OFI(op2))); + } + break; + case LispInteger_t: + switch (NRTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_fi(NRFI(op1), OII(op2))); + case N_BIGNUM: + return (cmp_bi_fi(NRBI(op1), OII(op2))); + case N_FLONUM: + return (cmp_flonum(NRFF(op1), (double)OII(op2))); + case N_FIXRATIO: + return (cmp_fr_fi(NRFRD(op1), NRFRN(op1), OII(op2))); + case N_BIGRATIO: + return (cmp_br_fi(NRBR(op1), OII(op2))); + } + break; + case LispBignum_t: + switch (NRTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_bi(NRFI(op1), OBI(op2))); + case N_BIGNUM: + return (cmp_bi_bi(NRBI(op1), OBI(op2))); + case N_FLONUM: + return (cmp_flonum(NRFF(op1), bi_getd(OBI(op2)))); + case N_FIXRATIO: + return (cmp_fr_bi(NRFRD(op1), NRFRN(op1), OBI(op2))); + case N_BIGRATIO: + return (cmp_br_bi(NRBR(op1), OBI(op2))); + } + break; + case LispDFloat_t: + switch (NRTYPE(op1)) { + case N_FIXNUM: + return (cmp_flonum((double)NRFI(op1), ODF(op2))); + case N_BIGNUM: + return (cmp_flonum(bi_getd(NRBI(op1)), ODF(op2))); + case N_FLONUM: + return (cmp_flonum(NRFF(op1), ODF(op2))); + case N_FIXRATIO: + return (cmp_flonum((double)NRFRN(op1) / + (double)NRFRD(op1), + ODF(op2))); + case N_BIGRATIO: + return (cmp_flonum(br_getd(NRBR(op1)), ODF(op2))); + } + break; + case LispRatio_t: + switch (NRTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_fr(NRFI(op1), OFRN(op2), OFRD(op2))); + case N_BIGNUM: + return (cmp_bi_fr(NRBI(op1), OFRN(op2), OFRD(op2))); + case N_FLONUM: + return (cmp_flonum(NRFF(op1), + (double)OFRN(op2) / (double)OFRD(op2))); + case N_FIXRATIO: + return (cmp_fr_fr(NRFRN(op1), NRFRD(op1), + OFRN(op2), OFRD(op2))); + case N_BIGRATIO: + return (cmp_br_fr(NRBR(op1), OFRN(op2), OFRD(op2))); + } + break; + case LispBigratio_t: + switch (NRTYPE(op1)) { + case N_FIXNUM: + return (cmp_fi_br(NRFI(op1), OBR(op2))); + case N_BIGNUM: + return (cmp_bi_br(NRBI(op1), OBR(op2))); + case N_FLONUM: + return (cmp_flonum(NRFF(op1), br_getd(OBR(op2)))); + case N_FIXRATIO: + return (cmp_fr_br(NRFRN(op1), NRFRD(op1), OBR(op2))); + case N_BIGRATIO: + return (cmp_br_br(NRBR(op1), OBR(op2))); + } + break; + case LispComplex_t: + if (cmp_real_object(&zero, OCXI(op2)) == 0) + return (cmp_real_object(NREAL(op1), OCXR(op2))); + return (1); + default: + fatal_object_error(op2, NOT_A_NUMBER); + break; + } + } + + return (0); +} +#endif + +static int +cmp_object_object(LispObj *op1, LispObj *op2, int real) +{ + if (OBJECT_TYPE(op1) == LispComplex_t) { + if (real) + fatal_object_error(op1, NOT_A_REAL_NUMBER); + if (OBJECT_TYPE(op2) == LispComplex_t) + return (cmp_cx_cx(op1, op2)); + else if (cmp_real_object(&zero, OCXI(op1)) == 0) + return (cmp_object_object(OCXR(op1), op2, real)); + return (1); + } + else if (OBJECT_TYPE(op2) == LispComplex_t) { + if (real) + fatal_object_error(op1, NOT_A_REAL_NUMBER); + if (cmp_real_object(&zero, OCXI(op2)) == 0) + return (cmp_object_object(op1, OCXR(op2), real)); + return (1); + } + else { + switch (OBJECT_TYPE(op1)) { + case LispFixnum_t: + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + return (cmp_fi_fi(OFI(op1), OFI(op2))); + case LispInteger_t: + return (cmp_fi_fi(OFI(op1), OII(op2))); + case LispBignum_t: + return (cmp_fi_bi(OFI(op1), OBI(op2))); + case LispDFloat_t: + return (cmp_flonum((double)OFI(op1), ODF(op2))); + case LispRatio_t: + return (cmp_fi_fr(OFI(op1), + OFRN(op2), OFRD(op2))); + case LispBigratio_t: + return (cmp_fi_br(OFI(op1), OBR(op2))); + default: + break; + } + break; + case LispInteger_t: + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + return (cmp_fi_fi(OII(op1), OFI(op2))); + case LispInteger_t: + return (cmp_fi_fi(OII(op1), OII(op2))); + case LispBignum_t: + return (cmp_fi_bi(OII(op1), OBI(op2))); + case LispDFloat_t: + return (cmp_flonum((double)OII(op1), ODF(op2))); + case LispRatio_t: + return (cmp_fi_fr(OII(op1), + OFRN(op2), OFRD(op2))); + case LispBigratio_t: + return (cmp_fi_br(OII(op1), OBR(op2))); + default: + break; + } + break; + case LispBignum_t: + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + return (cmp_bi_fi(OBI(op1), OFI(op2))); + case LispInteger_t: + return (cmp_bi_fi(OBI(op1), OII(op2))); + case LispBignum_t: + return (cmp_bi_bi(OBI(op1), OBI(op2))); + case LispDFloat_t: + return (cmp_flonum(bi_getd(OBI(op1)), ODF(op2))); + case LispRatio_t: + return (cmp_bi_fr(OBI(op1), + OFRN(op2), OFRD(op2))); + case LispBigratio_t: + return (cmp_bi_br(OBI(op1), OBR(op2))); + default: + break; + } + break; + case LispDFloat_t: + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + return (cmp_flonum(ODF(op1), (double)OFI(op2))); + case LispInteger_t: + return (cmp_flonum(ODF(op1), (double)OII(op2))); + case LispBignum_t: + return (cmp_flonum(ODF(op1), bi_getd(OBI(op2)))); + case LispDFloat_t: + return (cmp_flonum(ODF(op1), ODF(op2))); + break; + case LispRatio_t: + return (cmp_flonum(ODF(op1), + (double)OFRN(op2) / + (double)OFRD(op2))); + case LispBigratio_t: + return (cmp_flonum(ODF(op1), br_getd(OBR(op2)))); + default: + break; + } + break; + case LispRatio_t: + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + return (cmp_fr_fi(OFRN(op1), OFRD(op1), OFI(op2))); + case LispInteger_t: + return (cmp_fr_fi(OFRN(op1), OFRD(op1), OII(op2))); + case LispBignum_t: + return (cmp_fr_bi(OFRN(op1), OFRD(op1), OBI(op2))); + case LispDFloat_t: + return (cmp_flonum((double)OFRN(op1) / + (double)OFRD(op1), + ODF(op2))); + case LispRatio_t: + return (cmp_fr_fr(OFRN(op1), OFRD(op1), + OFRN(op2), OFRD(op2))); + case LispBigratio_t: + return (cmp_fr_br(OFRN(op1), OFRD(op1), OBR(op2))); + default: + break; + } + break; + case LispBigratio_t: + switch (OBJECT_TYPE(op2)) { + case LispFixnum_t: + return (cmp_br_fi(OBR(op1), OFI(op2))); + case LispInteger_t: + return (cmp_br_fi(OBR(op1), OII(op2))); + case LispBignum_t: + return (cmp_br_bi(OBR(op1), OBI(op2))); + case LispDFloat_t: + return (cmp_flonum(br_getd(OBR(op1)), ODF(op2))); + case LispRatio_t: + return (cmp_br_fr(OBR(op1), OFRN(op2), OFRD(op2))); + case LispBigratio_t: + return (cmp_br_br(OBR(op1), OBR(op2))); + default: + break; + } + break; + default: + fatal_object_error(op1, NOT_A_NUMBER); + break; + } + } + + fatal_object_error(op2, NOT_A_NUMBER); + return (0); +} + + +/************************************************************************ + * FIXNUM + ************************************************************************/ +/* + * check if op1 + op2 will overflow + */ +static INLINE int +fi_fi_add_overflow(long op1, long op2) +{ + long op = op1 + op2; + + return (op1 > 0 ? op2 > op : op2 < op); +} + +/* + * check if op1 - op2 will overflow + */ +static INLINE int +fi_fi_sub_overflow(long op1, long op2) +{ + long op = op1 - op2; + + return (((op1 < 0) ^ (op2 < 0)) && ((op < 0) ^ (op1 < 0))); +} + +/* + * check if op1 * op2 will overflow + */ +static INLINE int +fi_fi_mul_overflow(long op1, long op2) +{ +#ifndef LONG64 + double op = (double)op1 * (double)op2; + + return (op > 2147483647.0 || op < -2147483648.0); +#else + int shift, sign; + long mask; + + if (op1 == 0 || op1 == 1 || op2 == 0 || op2 == 1) + return (0); + + if (op1 == MINSLONG || op2 == MINSLONG) + return (1); + + sign = (op1 < 0) ^ (op2 < 0); + + if (op1 < 0) + op1 = -op1; + if (op2 < 0) + op2 = -op2; + + for (shift = 0, mask = FI_MASK; shift < LONGSBITS; shift++, mask >>= 1) + if (op1 & mask) + break; + ++shift; + for (mask = FI_MASK; shift < LONGSBITS; shift++, mask >>= 1) + if (op2 & mask) + break; + + return (shift < LONGSBITS); +#endif +} + + +/************************************************************************ + * BIGNUM + ************************************************************************/ +static void +rbi_canonicalize(n_real *real) +{ + if (mpi_fiti(RBI(real))) { + long fi = mpi_geti(RBI(real)); + + RTYPE(real) = N_FIXNUM; + mpi_clear(RBI(real)); + XFREE(RBI(real)); + RFI(real) = fi; + } +} + + +/************************************************************************ + * RATIO + ************************************************************************/ +static void +rfr_canonicalize(n_real *real) +{ + long num, numerator, den, denominator, rest; + + num = numerator = RFRN(real); + den = denominator = RFRD(real); + if (denominator == 0) + fatal_error(DIVIDE_BY_ZERO); + + if (num == MINSLONG || den == MINSLONG) { + mpr *bigratio = XALLOC(mpr); + + mpr_init(bigratio); + mpr_seti(bigratio, num, den); + RTYPE(real) = N_BIGRATIO; + RBR(real) = bigratio; + rbr_canonicalize(real); + return; + } + + if (num < 0) + num = -num; + else if (num == 0) { + RFI(real) = 0; + RTYPE(real) = N_FIXNUM; + return; + } + for (;;) { + if ((rest = den % num) == 0) + break; + den = num; + num = rest; + } + if (den != 1) { + denominator /= num; + numerator /= num; + } + if (denominator < 0) { + numerator = -numerator; + denominator = -denominator; + } + if (denominator == 1) { + RTYPE(real) = N_FIXNUM; + RFI(real) = numerator; + } + else { + RFRN(real) = numerator; + RFRD(real) = denominator; + } +} + +static void +rbr_canonicalize(n_real *real) +{ + int fitnum, fitden; + long numerator, denominator; + + mpr_canonicalize(RBR(real)); + fitnum = mpi_fiti(RBRN(real)); + fitden = mpi_fiti(RBRD(real)); + if (fitnum && fitden) { + numerator = mpi_geti(RBRN(real)); + denominator = mpi_geti(RBRD(real)); + mpr_clear(RBR(real)); + XFREE(RBR(real)); + if (numerator == 0) { + RFI(real) = 0; + RTYPE(real) = N_FIXNUM; + } + else if (denominator == 1) { + RTYPE(real) = N_FIXNUM; + RFI(real) = numerator; + } + else { + RTYPE(real) = N_FIXRATIO; + RFRN(real) = numerator; + RFRD(real) = denominator; + } + } + else if (fitden) { + denominator = mpi_geti(RBRD(real)); + if (denominator == 1) { + mpi *bigi = XALLOC(mpi); + + mpi_init(bigi); + mpi_set(bigi, RBRN(real)); + mpr_clear(RBR(real)); + XFREE(RBR(real)); + RTYPE(real) = N_BIGNUM; + RBI(real) = bigi; + } + else if (denominator == 0) + fatal_error(DIVIDE_BY_ZERO); + } +} + + +/************************************************************************ + * COMPLEX + ************************************************************************/ +static void +ncx_canonicalize(n_number *num) +{ + if (NITYPE(num) == N_FIXNUM && NIFI(num) == 0) + num->complex = 0; +} + + +/************************************************************************ + * DIVIDE + ************************************************************************/ +#define NDIVIDE_NOP 0 +#define NDIVIDE_ADD 1 +#define NDIVIDE_SUB 2 +static void +ndivide_fi_fi(n_number *num, long div, int fun, int flo) +{ + long quo, rem; + + if (NRFI(num) == MINSLONG || div == MINSLONG) { + LispObj integer; + mpi *bignum = XALLOC(mpi); + + mpi_init(bignum); + mpi_seti(bignum, NRFI(num)); + NRBI(num) = bignum; + NRTYPE(num) = N_BIGNUM; + integer.type = LispInteger_t; + integer.data.integer = div; + ndivide_xi_xi(num, &integer, fun, flo); + return; + } + else { + quo = NRFI(num) / div; + rem = NRFI(num) % div; + } + + switch (fun) { + case NDIVIDE_CEIL: + if ((rem < 0 && div < 0) || (rem > 0 && div > 0)) { + ++quo; + rem -= div; + } + break; + case NDIVIDE_FLOOR: + if ((rem < 0 && div > 0) || (rem > 0 && div < 0)) { + --quo; + rem += div; + } + break; + case NDIVIDE_ROUND: + if (div > 0) { + if (rem > 0) { + if (rem >= (div + 1) / 2) { + ++quo; + rem -= div; + } + } + else { + if (rem <= (-div - 1) / 2) { + --quo; + rem += div; + } + } + } + else { + if (rem > 0) { + if (rem >= (-div + 1) / 2) { + --quo; + rem += div; + } + } + else { + if (rem <= (div - 1) / 2) { + ++quo; + rem -= div; + } + } + } + break; + } + + NITYPE(num) = N_FIXNUM; + NIFI(num) = rem; + if (flo) { + NRTYPE(num) = N_FLONUM; + NRFF(num) = (double)quo; + } + else + NRFI(num) = quo; +} + +static void +ndivide_xi_xi(n_number *num, LispObj *div, int fun, int flo) +{ + LispType type = OBJECT_TYPE(div); + int state = NDIVIDE_NOP, dsign, rsign; + mpi *quo, *rem; + + quo = XALLOC(mpi); + mpi_init(quo); + if (NRTYPE(num) == N_FIXNUM) + mpi_seti(quo, NRFI(num)); + else + mpi_set(quo, NRBI(num)); + + rem = XALLOC(mpi); + mpi_init(rem); + + switch (type) { + case LispFixnum_t: + mpi_seti(rem, OFI(div)); + break; + case LispInteger_t: + mpi_seti(rem, OII(div)); + break; + default: + mpi_set(rem, OBI(div)); + } + + dsign = mpi_sgn(rem); + + mpi_divqr(quo, rem, quo, rem); + rsign = mpi_sgn(rem); + + switch (fun) { + case NDIVIDE_CEIL: + if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) + state = NDIVIDE_ADD; + break; + case NDIVIDE_FLOOR: + if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) + state = NDIVIDE_SUB; + break; + case NDIVIDE_ROUND: { + mpi test; + + mpi_init(&test); + switch (type) { + case LispFixnum_t: + mpi_seti(&test, OFI(div)); + break; + case LispInteger_t: + mpi_seti(&test, OII(div)); + break; + default: + mpi_set(&test, OBI(div)); + } + if (dsign > 0) { + if (rsign > 0) { + mpi_addi(&test, &test, 1); + mpi_divi(&test, &test, 2); + if (mpi_cmp(rem, &test) >= 0) + state = NDIVIDE_ADD; + } + else { + mpi_neg(&test, &test); + mpi_subi(&test, &test, 1); + mpi_divi(&test, &test, 2); + if (mpi_cmp(rem, &test) <= 0) + state = NDIVIDE_SUB; + } + } + else { + if (rsign > 0) { + mpi_neg(&test, &test); + mpi_addi(&test, &test, 1); + mpi_divi(&test, &test, 2); + if (mpi_cmp(rem, &test) >= 0) + state = NDIVIDE_SUB; + } + else { + mpi_subi(&test, &test, 1); + mpi_divi(&test, &test, 2); + if (mpi_cmp(rem, &test) <= 0) + state = NDIVIDE_ADD; + } + } + mpi_clear(&test); + } break; + } + + if (state == NDIVIDE_ADD) { + mpi_addi(quo, quo, 1); + switch (type) { + case LispFixnum_t: + mpi_subi(rem, rem, OFI(div)); + break; + case LispInteger_t: + mpi_subi(rem, rem, OII(div)); + break; + default: + mpi_sub(rem, rem, OBI(div)); + } + } + else if (state == NDIVIDE_SUB) { + mpi_subi(quo, quo, 1); + switch (type) { + case LispFixnum_t: + mpi_addi(rem, rem, OFI(div)); + break; + case LispInteger_t: + mpi_addi(rem, rem, OII(div)); + break; + default: + mpi_add(rem, rem, OBI(div)); + } + } + + if (mpi_fiti(rem)) { + NITYPE(num) = N_FIXNUM; + NIFI(num) = mpi_geti(rem); + mpi_clear(rem); + XFREE(rem); + } + else { + NITYPE(num) = N_BIGNUM; + NIBI(num) = rem; + } + + clear_real(NREAL(num)); + + if (flo) { + double dval = bi_getd(quo); + + mpi_clear(quo); + XFREE(quo); + NRTYPE(num) = N_FLONUM; + NRFF(num) = dval; + } + else { + NRTYPE(num) = N_BIGNUM; + NRBI(num) = quo; + rbi_canonicalize(NREAL(num)); + } +} + +static void +ndivide_flonum(n_number *number, double num, double div, int fun, int flo) +{ + double quo, rem, modp, tmp; + + modp = modf(num / div, &quo); + rem = num - quo * div; + + switch (fun) { + case NDIVIDE_CEIL: + if ((rem < 0.0 && div < 0.0) || (rem > 0.0 && div > 0.0)) { + quo += 1.0; + rem -= div; + } + break; + case NDIVIDE_FLOOR: + if ((rem < 0.0 && div > 0.0) || (rem > 0.0 && div < 0.0)) { + quo -= 1.0; + rem += div; + } + break; + case NDIVIDE_ROUND: + if (fabs(modp) != 0.5 || modf(quo * 0.5, &tmp) != 0.0) { + if (div > 0.0) { + if (rem > 0.0) { + if (rem >= div * 0.5) { + quo += 1.0; + rem -= div; + } + } + else { + if (rem <= div * -0.5) { + quo -= 1.0; + rem += div; + } + } + } + else { + if (rem > 0.0) { + if (rem >= div * -0.5) { + quo -= 1.0; + rem += div; + } + } + else { + if (rem <= div * 0.5) { + quo += 1.0; + rem -= div; + } + } + } + } + break; + } + if (!finite(quo) || !finite(rem)) + fatal_error(FLOATING_POINT_OVERFLOW); + + NITYPE(number) = N_FLONUM; + NIFF(number) = rem; + + clear_real(NREAL(number)); + + if (flo) { + NRTYPE(number) = N_FLONUM; + NRFF(number) = quo; + } + else { + if ((long)quo == quo) { + NRTYPE(number) = N_FIXNUM; + NRFI(number) = (long)quo; + } + else { + mpi *bigi = XALLOC(mpi); + + mpi_init(bigi); + mpi_setd(bigi, quo); + NRBI(number) = bigi; + NRTYPE(number) = N_BIGNUM; + } + } +} + +static void +ndivide_xi_xr(n_number *num, LispObj *div, int fun, int flo) +{ + int state = NDIVIDE_NOP, dsign, rsign; + mpi *quo; + mpr *rem; + + quo = XALLOC(mpi); + mpi_init(quo); + if (NRTYPE(num) == N_FIXNUM) + mpi_seti(quo, NRFI(num)); + else + mpi_set(quo, NRBI(num)); + + rem = XALLOC(mpr); + mpr_init(rem); + + if (XOBJECT_TYPE(div) == LispRatio_t) + mpr_seti(rem, OFRN(div), OFRD(div)); + else + mpr_set(rem, OBR(div)); + dsign = mpi_sgn(mpr_num(rem)); + mpi_mul(quo, quo, mpr_den(rem)); + + mpi_divqr(quo, mpr_num(rem), quo, mpr_num(rem)); + mpr_canonicalize(rem); + + rsign = mpi_sgn(mpr_num(rem)); + if (mpr_fiti(rem)) { + if (mpi_geti(mpr_den(rem)) == 1) { + NITYPE(num) = N_FIXNUM; + NIFI(num) = mpi_geti(mpr_num(rem)); + } + else { + NITYPE(num) = N_FIXRATIO; + NIFRN(num) = mpi_geti(mpr_num(rem)); + NIFRD(num) = mpi_geti(mpr_den(rem)); + } + mpr_clear(rem); + XFREE(rem); + } + else { + if (mpi_fiti(mpr_den(rem)) && mpi_geti(mpr_den(rem)) == 1) { + NITYPE(num) = N_BIGNUM; + NIBI(num) = mpr_num(rem); + mpi_clear(mpr_den(rem)); + XFREE(rem); + } + else { + NITYPE(num) = N_BIGRATIO; + NIBR(num) = rem; + } + } + + switch (fun) { + case NDIVIDE_CEIL: + if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) + state = NDIVIDE_ADD; + break; + case NDIVIDE_FLOOR: + if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) + state = NDIVIDE_SUB; + break; + case NDIVIDE_ROUND: { + n_real cmp; + + set_real_object(&cmp, div); + div_real_real(&cmp, &two); + if (dsign > 0) { + if (rsign > 0) { + if (cmp_real_real(NIMAG(num), &cmp) >= 0) + state = NDIVIDE_ADD; + } + else { + neg_real(&cmp); + if (cmp_real_real(NIMAG(num), &cmp) <= 0) + state = NDIVIDE_SUB; + } + } + else { + if (rsign > 0) { + neg_real(&cmp); + if (cmp_real_real(NIMAG(num), &cmp) >= 0) + state = NDIVIDE_SUB; + } + else { + if (cmp_real_real(NIMAG(num), &cmp) <= 0) + state = NDIVIDE_ADD; + } + } + clear_real(&cmp); + } break; + } + + if (state == NDIVIDE_ADD) { + mpi_addi(quo, quo, 1); + sub_real_object(NIMAG(num), div); + } + else if (state == NDIVIDE_SUB) { + mpi_subi(quo, quo, 1); + add_real_object(NIMAG(num), div); + } + + clear_real(NREAL(num)); + + if (flo) { + double dval = bi_getd(quo); + + mpi_clear(quo); + XFREE(quo); + NRTYPE(num) = N_FLONUM; + NRFF(num) = dval; + } + else { + NRBI(num) = quo; + NRTYPE(num) = N_BIGNUM; + rbi_canonicalize(NREAL(num)); + } +} + +static void +ndivide_xr_xi(n_number *num, LispObj *div, int fun, int flo) +{ + LispType type = OBJECT_TYPE(div); + int state = NDIVIDE_NOP, dsign, rsign; + mpi *quo; + mpr *rem; + + quo = XALLOC(mpi); + mpi_init(quo); + switch (type) { + case LispFixnum_t: + dsign = OFI(div) < 0 ? -1 : OFI(div) > 0 ? 1 : 0; + mpi_seti(quo, OFI(div)); + break; + case LispInteger_t: + dsign = OII(div) < 0 ? -1 : OII(div) > 0 ? 1 : 0; + mpi_seti(quo, OII(div)); + break; + default: + dsign = mpi_sgn(OBI(div)); + mpi_set(quo, OBI(div)); + break; + } + + rem = XALLOC(mpr); + mpr_init(rem); + if (NRTYPE(num) == N_FIXRATIO) { + mpr_seti(rem, NRFRN(num), NRFRD(num)); + mpi_muli(quo, quo, NRFRD(num)); + } + else { + mpr_set(rem, NRBR(num)); + mpi_mul(quo, quo, NRBRD(num)); + } + mpi_divqr(quo, mpr_num(rem), mpr_num(rem), quo); + mpr_canonicalize(rem); + + rsign = mpi_sgn(mpr_num(rem)); + if (mpr_fiti(rem)) { + NITYPE(num) = N_FIXRATIO; + NIFRN(num) = mpi_geti(mpr_num(rem)); + NIFRD(num) = mpi_geti(mpr_den(rem)); + mpr_clear(rem); + XFREE(rem); + } + else { + NITYPE(num) = N_BIGRATIO; + NIBR(num) = rem; + } + + switch (fun) { + case NDIVIDE_CEIL: + if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) + state = NDIVIDE_ADD; + break; + case NDIVIDE_FLOOR: + if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) + state = NDIVIDE_SUB; + break; + case NDIVIDE_ROUND: { + n_real cmp; + + set_real_object(&cmp, div); + div_real_real(&cmp, &two); + if (dsign > 0) { + if (rsign > 0) { + if (cmp_real_real(NIMAG(num), &cmp) >= 0) + state = NDIVIDE_ADD; + } + else { + neg_real(&cmp); + if (cmp_real_real(NIMAG(num), &cmp) <= 0) + state = NDIVIDE_SUB; + } + } + else { + if (rsign > 0) { + neg_real(&cmp); + if (cmp_real_real(NIMAG(num), &cmp) >= 0) + state = NDIVIDE_SUB; + } + else { + if (cmp_real_real(NIMAG(num), &cmp) <= 0) + state = NDIVIDE_ADD; + } + } + clear_real(&cmp); + } break; + } + + if (state == NDIVIDE_ADD) { + mpi_addi(quo, quo, 1); + sub_real_object(NIMAG(num), div); + } + else if (state == NDIVIDE_SUB) { + mpi_subi(quo, quo, 1); + add_real_object(NIMAG(num), div); + } + + clear_real(NREAL(num)); + + if (flo) { + double dval = bi_getd(quo); + + mpi_clear(quo); + XFREE(quo); + NRTYPE(num) = N_FLONUM; + NRFF(num) = dval; + } + else { + NRBI(num) = quo; + NRTYPE(num) = N_BIGNUM; + rbi_canonicalize(NREAL(num)); + } +} + +static void +ndivide_xr_xr(n_number *num, LispObj *div, int fun, int flo) +{ + int state = NDIVIDE_NOP, dsign, rsign, modp; + mpr *bigr; + mpi *bigi; + + bigr = XALLOC(mpr); + mpr_init(bigr); + if (NRTYPE(num) == N_FIXRATIO) + mpr_seti(bigr, NRFRN(num), NRFRD(num)); + else + mpr_set(bigr, NRBR(num)); + + NITYPE(num) = N_BIGRATIO; + NIBR(num) = bigr; + + if (OBJECT_TYPE(div) == LispRatio_t) { + dsign = OFRN(div) < 0 ? -1 : OFRN(div) > 0 ? 1 : 0; + mpi_muli(mpr_num(bigr), mpr_num(bigr), OFRD(div)); + mpi_muli(mpr_den(bigr), mpr_den(bigr), OFRN(div)); + } + else { + dsign = mpi_sgn(OBRN(div)); + mpr_div(bigr, bigr, OBR(div)); + } + modp = mpi_fiti(mpr_den(bigr)) && mpi_geti(mpr_den(bigr)) == 2; + + bigi = XALLOC(mpi); + mpi_init(bigi); + mpi_divqr(bigi, mpr_num(bigr), mpr_num(bigr), mpr_den(bigr)); + + if (OBJECT_TYPE(div) == LispRatio_t) + mpi_seti(mpr_den(bigr), OFRD(div)); + else + mpi_set(mpr_den(bigr), OBRD(div)); + if (NRTYPE(num) == N_FIXRATIO) + mpi_muli(mpr_den(bigr), mpr_den(bigr), NRFRD(num)); + else + mpi_mul(mpr_den(bigr), mpr_den(bigr), NRBRD(num)); + + clear_real(NREAL(num)); + NRTYPE(num) = N_BIGNUM; + NRBI(num) = bigi; + + rbr_canonicalize(NIMAG(num)); + rsign = cmp_real_real(NIMAG(num), &zero); + + switch (fun) { + case NDIVIDE_CEIL: + if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) + state = NDIVIDE_ADD; + break; + case NDIVIDE_FLOOR: + if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) + state = NDIVIDE_SUB; + break; + case NDIVIDE_ROUND: + if (!modp || (bigi->digs[0] & 1) == 1) { + n_real cmp; + + set_real_object(&cmp, div); + div_real_real(&cmp, &two); + if (dsign > 0) { + if (rsign > 0) { + if (cmp_real_real(NIMAG(num), &cmp) >= 0) + state = NDIVIDE_ADD; + } + else { + neg_real(&cmp); + if (cmp_real_real(NIMAG(num), &cmp) <= 0) + state = NDIVIDE_SUB; + } + } + else { + if (rsign > 0) { + neg_real(&cmp); + if (cmp_real_real(NIMAG(num), &cmp) >= 0) + state = NDIVIDE_SUB; + } + else { + if (cmp_real_real(NIMAG(num), &cmp) <= 0) + state = NDIVIDE_ADD; + } + } + clear_real(&cmp); + } + break; + } + + if (state == NDIVIDE_ADD) { + add_real_real(NREAL(num), &one); + sub_real_object(NIMAG(num), div); + } + else if (state == NDIVIDE_SUB) { + sub_real_real(NREAL(num), &one); + add_real_object(NIMAG(num), div); + } + + if (NRTYPE(num) == N_BIGNUM) { + if (flo) { + double dval = bi_getd(bigi); + + mpi_clear(bigi); + XFREE(bigi); + NRTYPE(num) = N_FLONUM; + NRFF(num) = dval; + } + else + rbi_canonicalize(NREAL(num)); + } + else if (flo) { + NRTYPE(num) = N_FLONUM; + NRFF(num) = (double)NRFI(num); + } +} + + +/************************************************************************ + * REAL COMPLEX + ************************************************************************/ +static void +nadd_re_cx(n_number *num, LispObj *comp) +{ +/* + Ra+Rb Ib + */ + /* Ra+Rb */ + add_real_object(NREAL(num), OCXR(comp)); + + /* Ib */ + set_real_object(NIMAG(num), OCXI(comp)); + + num->complex = 1; + + ncx_canonicalize(num); +} + +static void +nsub_re_cx(n_number *num, LispObj *comp) +{ +/* + Ra-Rb -Ib + */ + /* Ra-Rb */ + sub_real_object(NREAL(num), OCXR(comp)); + + /* -Ib */ + NITYPE(num) = N_FIXNUM; + NIFI(num) = -1; + mul_real_object(NIMAG(num), OCXI(comp)); + + num->complex = 1; + + ncx_canonicalize(num); +} + +static void +nmul_re_cx(n_number *num, LispObj *comp) +{ +/* + Ra*Rb Ra*Ib + */ + /* copy before change */ + set_real_real(NIMAG(num), NREAL(num)); + + /* Ra*Rb */ + mul_real_object(NREAL(num), OCXR(comp)); + + /* Ra*Ib */ + mul_real_object(NIMAG(num), OCXI(comp)); + + num->complex = 1; + + ncx_canonicalize(num); +} + +static void +ndiv_re_cx(n_number *num, LispObj *comp) +{ +/* + Ra*Rb -Ib*Ra + ----------- ----------- + Rb*Rb+Ib*Ib Rb*Rb+Ib*Ib + */ + n_real div, temp; + + /* Rb*Rb */ + set_real_object(&div, OCXR(comp)); + mul_real_object(&div, OCXR(comp)); + + /* Ib*Ib */ + set_real_object(&temp, OCXI(comp)); + mul_real_object(&temp, OCXI(comp)); + + /* Rb*Rb+Ib*Ib */ + add_real_real(&div, &temp); + clear_real(&temp); + + /* -Ib*Ra */ + NITYPE(num) = N_FIXNUM; + NIFI(num) = -1; + mul_real_object(NIMAG(num), OCXI(comp)); + mul_real_real(NIMAG(num), NREAL(num)); + + /* Ra*Rb */ + mul_real_object(NREAL(num), OCXR(comp)); + + div_real_real(NREAL(num), &div); + div_real_real(NIMAG(num), &div); + clear_real(&div); + + num->complex = 1; + + ncx_canonicalize(num); +} + + +/************************************************************************ + * COMPLEX REAL + ************************************************************************/ +static void +nadd_cx_re(n_number *num, LispObj *re) +{ +/* + Ra+Rb Ia + */ + add_real_object(NREAL(num), re); + + ncx_canonicalize(num); +} + +static void +nsub_cx_re(n_number *num, LispObj *re) +{ +/* + Ra-Rb Ia + */ + sub_real_object(NREAL(num), re); + + ncx_canonicalize(num); +} + +static void +nmul_cx_re(n_number *num, LispObj *re) +{ +/* + Ra*Rb Ia*Rb + */ + mul_real_object(NREAL(num), re); + mul_real_object(NIMAG(num), re); + + ncx_canonicalize(num); +} + +static void +ndiv_cx_re(n_number *num, LispObj *re) +{ +/* + Ra/Rb Ia/Rb + */ + div_real_object(NREAL(num), re); + div_real_object(NIMAG(num), re); + + ncx_canonicalize(num); +} + + +/************************************************************************ + * COMPLEX COMPLEX + ************************************************************************/ +static void +nadd_cx_cx(n_number *num, LispObj *comp) +{ +/* + Ra+Rb Ia+Ib + */ + add_real_object(NREAL(num), OCXR(comp)); + add_real_object(NIMAG(num), OCXI(comp)); + + ncx_canonicalize(num); +} + +static void +nsub_cx_cx(n_number *num, LispObj *comp) +{ +/* + Ra-Rb Ia-Ib + */ + sub_real_object(NREAL(num), OCXR(comp)); + sub_real_object(NIMAG(num), OCXI(comp)); + + ncx_canonicalize(num); +} + +static void +nmul_cx_cx(n_number *num, LispObj *comp) +{ +/* + Ra*Rb-Ia*Ib Ra*Ib+Ia*Rb + */ + n_real IaIb, RaIb; + + set_real_real(&IaIb, NIMAG(num)); + mul_real_object(&IaIb, OCXI(comp)); + + set_real_real(&RaIb, NREAL(num)); + mul_real_object(&RaIb, OCXI(comp)); + + /* Ra*Rb-Ia*Ib */ + mul_real_object(NREAL(num), OCXR(comp)); + sub_real_real(NREAL(num), &IaIb); + clear_real(&IaIb); + + /* Ra*Ib+Ia*Rb */ + mul_real_object(NIMAG(num), OCXR(comp)); + add_real_real(NIMAG(num), &RaIb); + clear_real(&RaIb); + + ncx_canonicalize(num); +} + +static void +ndiv_cx_cx(n_number *num, LispObj *comp) +{ +/* + Ra*Rb+Ia*Ib Ia*Rb-Ib*Ra + ----------- ----------- + Rb*Rb+Ib*Ib Rb*Rb+Ib*Ib + */ + n_real temp1, temp2; + + /* IaIb */ + set_real_real(&temp1, NIMAG(num)); + mul_real_object(&temp1, OCXI(comp)); + + /* IbRa */ + set_real_real(&temp2, NREAL(num)); + mul_real_object(&temp2, OCXI(comp)); + + /* Ra*Rb+Ia*Ib */ + mul_real_object(NREAL(num), OCXR(comp)); + add_real_real(NREAL(num), &temp1); + clear_real(&temp1); + + /* Ia*Rb-Ib*Ra */ + mul_real_object(NIMAG(num), OCXR(comp)); + sub_real_real(NIMAG(num), &temp2); + clear_real(&temp2); + + + /* Rb*Rb */ + set_real_object(&temp1, OCXR(comp)); + mul_real_object(&temp1, OCXR(comp)); + + /* Ib*Ib */ + set_real_object(&temp2, OCXI(comp)); + mul_real_object(&temp2, OCXI(comp)); + + /* Rb*Rb+Ib*Ib */ + add_real_real(&temp1, &temp2); + clear_real(&temp2); + + div_real_real(NREAL(num), &temp1); + div_real_real(NIMAG(num), &temp1); + clear_real(&temp1); + + ncx_canonicalize(num); +} + +static int +cmp_cx_cx(LispObj *op1, LispObj *op2) +{ + int cmp; + + cmp = cmp_object_object(OCXR(op1), OCXR(op2), 1); + if (cmp == 0) + cmp = cmp_object_object(OCXI(op1), OCXI(op2), 1); + + return (cmp); +} + + +/************************************************************************ + * FLONUM FLONUM + ************************************************************************/ +static void +radd_flonum(n_real *real, double op1, double op2) +{ + double value = op1 + op2; + + if (!finite(value)) + fatal_error(FLOATING_POINT_OVERFLOW); + switch (RTYPE(real)) { + case N_FIXNUM: + case N_FIXRATIO: + RTYPE(real) = N_FLONUM; + break; + case N_BIGNUM: + RCLEAR_BI(real); + RTYPE(real) = N_FLONUM; + break; + case N_BIGRATIO: + RCLEAR_BR(real); + RTYPE(real) = N_FLONUM; + break; + } + RFF(real) = value; +} + +static void +rsub_flonum(n_real *real, double op1, double op2) +{ + double value = op1 - op2; + + if (!finite(value)) + fatal_error(FLOATING_POINT_OVERFLOW); + switch (RTYPE(real)) { + case N_FIXNUM: + case N_FIXRATIO: + RTYPE(real) = N_FLONUM; + break; + case N_BIGNUM: + RCLEAR_BI(real); + RTYPE(real) = N_FLONUM; + break; + case N_BIGRATIO: + RCLEAR_BR(real); + RTYPE(real) = N_FLONUM; + break; + } + RFF(real) = value; +} + +static void +rmul_flonum(n_real *real, double op1, double op2) +{ + double value = op1 * op2; + + if (!finite(value)) + fatal_error(FLOATING_POINT_OVERFLOW); + switch (RTYPE(real)) { + case N_FIXNUM: + case N_FIXRATIO: + RTYPE(real) = N_FLONUM; + break; + case N_BIGNUM: + RCLEAR_BI(real); + RTYPE(real) = N_FLONUM; + break; + case N_BIGRATIO: + RCLEAR_BR(real); + RTYPE(real) = N_FLONUM; + break; + } + RFF(real) = value; +} + +static void +rdiv_flonum(n_real *real, double op1, double op2) +{ + double value; + + if (op2 == 0.0) + fatal_error(DIVIDE_BY_ZERO); + value = op1 / op2; + if (!finite(value)) + fatal_error(FLOATING_POINT_OVERFLOW); + switch (RTYPE(real)) { + case N_FIXNUM: + case N_FIXRATIO: + RTYPE(real) = N_FLONUM; + break; + case N_BIGNUM: + RCLEAR_BI(real); + RTYPE(real) = N_FLONUM; + break; + case N_BIGRATIO: + RCLEAR_BR(real); + RTYPE(real) = N_FLONUM; + break; + } + RFF(real) = value; +} + +static int +cmp_flonum(double op1, double op2) +{ + double value = op1 - op2; + + if (!finite(value)) + fatal_error(FLOATING_POINT_OVERFLOW); + + return (value > 0.0 ? 1 : value < 0.0 ? -1 : 0); +} + + +/************************************************************************ + * FIXNUM FIXNUM + ************************************************************************/ +static void +rop_fi_fi_bi(n_real *real, long fi, int op) +{ + mpi *bigi = XALLOC(mpi); + + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + if (op == NOP_ADD) + mpi_addi(bigi, bigi, fi); + else if (op == NOP_SUB) + mpi_subi(bigi, bigi, fi); + else + mpi_muli(bigi, bigi, fi); + RBI(real) = bigi; + RTYPE(real) = N_BIGNUM; +} + +static INLINE void +radd_fi_fi(n_real *real, long fi) +{ + if (!fi_fi_add_overflow(RFI(real), fi)) + RFI(real) += fi; + else + rop_fi_fi_bi(real, fi, NOP_ADD); +} + +static INLINE void +rsub_fi_fi(n_real *real, long fi) +{ + if (!fi_fi_sub_overflow(RFI(real), fi)) + RFI(real) -= fi; + else + rop_fi_fi_bi(real, fi, NOP_SUB); +} + +static INLINE void +rmul_fi_fi(n_real *real, long fi) +{ + if (!fi_fi_mul_overflow(RFI(real), fi)) + RFI(real) *= fi; + else + rop_fi_fi_bi(real, fi, NOP_MUL); +} + +static INLINE void +rdiv_fi_fi(n_real *real, long fi) +{ + RTYPE(real) = N_FIXRATIO; + RFRN(real) = RFI(real); + RFRD(real) = fi; + rfr_canonicalize(real); +} + +static INLINE int +cmp_fi_fi(long op1, long op2) +{ + if (op1 > op2) + return (1); + else if (op1 < op2) + return (-1); + + return (0); +} + + +/************************************************************************ + * FIXNUM BIGNUM + ************************************************************************/ +static void +rop_fi_bi_xi(n_real *real, mpi *bi, int nop) +{ + mpi *bigi = XALLOC(mpi); + + mpi_init(bigi); + mpi_seti(bigi, RFI(real)); + if (nop == NOP_ADD) + mpi_add(bigi, bigi, bi); + else if (nop == NOP_SUB) + mpi_sub(bigi, bigi, bi); + else + mpi_mul(bigi, bigi, bi); + + if (mpi_fiti(bigi)) { + RFI(real) = mpi_geti(bigi); + mpi_clear(bigi); + XFREE(bigi); + } + else { + RBI(real) = bigi; + RTYPE(real) = N_BIGNUM; + } +} + +static INLINE void +radd_fi_bi(n_real *real, mpi *bi) +{ + rop_fi_bi_xi(real, bi, NOP_ADD); +} + +static INLINE void +rsub_fi_bi(n_real *real, mpi *bi) +{ + rop_fi_bi_xi(real, bi, NOP_SUB); +} + +static INLINE void +rmul_fi_bi(n_real *real, mpi *bi) +{ + rop_fi_bi_xi(real, bi, NOP_MUL); +} + +static void +rdiv_fi_bi(n_real *real, mpi *bi) +{ + mpr *bigr; + + if (mpi_cmpi(bi, 0) == 0) + fatal_error(DIVIDE_BY_ZERO); + + bigr = XALLOC(mpr); + mpr_init(bigr); + mpi_seti(mpr_num(bigr), RFI(real)); + mpi_set(mpr_den(bigr), bi); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE int +cmp_fi_bi(long fixnum, mpi *bignum) +{ + return (-mpi_cmpi(bignum, fixnum)); +} + + +/************************************************************************ + * FIXNUM FIXRATIO + ************************************************************************/ +static void +rop_fi_fr_as_xr(n_real *real, long num, long den, int nop) +{ + int fit; + long value = 0, op = RFI(real); + + fit = !fi_fi_mul_overflow(op, den); + if (fit) { + value = op * den; + if (nop == NOP_ADD) + fit = !fi_fi_add_overflow(value, num); + else + fit = !fi_fi_sub_overflow(value, num); + } + if (fit) { + if (nop == NOP_ADD) + RFRN(real) = value + num; + else + RFRN(real) = value - num; + RFRD(real) = den; + RTYPE(real) = N_FIXRATIO; + rfr_canonicalize(real); + } + else { + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpi_init(&iop); + mpi_seti(&iop, op); + mpi_muli(&iop, &iop, den); + + mpr_init(bigr); + mpr_seti(bigr, num, den); + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); + else + mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); + mpi_clear(&iop); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); + } +} + +static void +rop_fi_fr_md_xr(n_real *real, long num, long den, int nop) +{ + int fit; + long op = RFI(real); + + if (nop == NOP_MUL) + fit = !fi_fi_mul_overflow(op, num); + else + fit = !fi_fi_mul_overflow(op, den); + if (fit) { + if (nop == NOP_MUL) { + RFRN(real) = op * num; + RFRD(real) = den; + } + else { + RFRN(real) = op * den; + RFRD(real) = num; + } + RTYPE(real) = N_FIXRATIO; + rfr_canonicalize(real); + } + else { + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpi_init(&iop); + mpi_seti(&iop, op); + + mpr_init(bigr); + if (nop == NOP_MUL) + mpr_seti(bigr, num, den); + else + mpr_seti(bigr, den, num); + mpi_mul(mpr_num(bigr), mpr_num(bigr), &iop); + mpi_clear(&iop); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); + } +} + +static INLINE void +radd_fi_fr(n_real *real, long num, long den) +{ + rop_fi_fr_as_xr(real, num, den, NOP_ADD); +} + +static INLINE void +rsub_fi_fr(n_real *real, long num, long den) +{ + rop_fi_fr_as_xr(real, num, den, NOP_SUB); +} + +static INLINE void +rmul_fi_fr(n_real *real, long num, long den) +{ + rop_fi_fr_md_xr(real, num, den, NOP_MUL); +} + +static INLINE void +rdiv_fi_fr(n_real *real, long num, long den) +{ + rop_fi_fr_md_xr(real, num, den, NOP_DIV); +} + +static INLINE int +cmp_fi_fr(long fi, long num, long den) +{ + return (cmp_flonum((double)fi, (double)num / (double)den)); +} + + +/************************************************************************ + * FIXNUM BIGRATIO + ************************************************************************/ +static void +rop_fi_br_as_xr(n_real *real, mpr *ratio, int nop) +{ + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpi_init(&iop); + mpi_seti(&iop, RFI(real)); + + mpr_init(bigr); + mpr_set(bigr, ratio); + + mpi_mul(&iop, &iop, mpr_den(ratio)); + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); + else + mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); + + mpi_clear(&iop); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static void +rop_fi_br_md_xr(n_real *real, mpr *ratio, int nop) +{ + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpi_init(&iop); + mpi_seti(&iop, RFI(real)); + + mpr_init(bigr); + if (nop == NOP_MUL) + mpr_set(bigr, ratio); + else + mpr_inv(bigr, ratio); + + mpi_mul(mpr_num(bigr), &iop, mpr_num(bigr)); + + mpi_clear(&iop); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE void +radd_fi_br(n_real *real, mpr *ratio) +{ + rop_fi_br_as_xr(real, ratio, NOP_ADD); +} + +static INLINE void +rsub_fi_br(n_real *real, mpr *ratio) +{ + rop_fi_br_as_xr(real, ratio, NOP_SUB); +} + +static INLINE void +rmul_fi_br(n_real *real, mpr *ratio) +{ + rop_fi_br_md_xr(real, ratio, NOP_MUL); +} + +static INLINE void +rdiv_fi_br(n_real *real, mpr *ratio) +{ + rop_fi_br_md_xr(real, ratio, NOP_DIV); +} + +static INLINE int +cmp_fi_br(long op1, mpr *op2) +{ + return (-mpr_cmpi(op2, op1)); +} + + +/************************************************************************ + * BIGNUM FIXNUM + ************************************************************************/ +static INLINE void +radd_bi_fi(n_real *real, long fi) +{ + mpi_addi(RBI(real), RBI(real), fi); + rbi_canonicalize(real); +} + +static INLINE void +rsub_bi_fi(n_real *real, long fi) +{ + mpi_subi(RBI(real), RBI(real), fi); + rbi_canonicalize(real); +} + +static INLINE void +rmul_bi_fi(n_real *real, long fi) +{ + mpi_muli(RBI(real), RBI(real), fi); + rbi_canonicalize(real); +} + +static void +rdiv_bi_fi(n_real *real, long fi) +{ + mpr *bigr; + + if (RFI(real) == 0) + fatal_error(DIVIDE_BY_ZERO); + + bigr = XALLOC(mpr); + mpr_init(bigr); + mpi_set(mpr_num(bigr), RBI(real)); + mpi_seti(mpr_den(bigr), fi); + RCLEAR_BI(real); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE int +cmp_bi_fi(mpi *bignum, long fi) +{ + return (mpi_cmpi(bignum, fi)); +} + + +/************************************************************************ + * BIGNUM BIGNUM + ************************************************************************/ +static INLINE void +radd_bi_bi(n_real *real, mpi *bignum) +{ + mpi_add(RBI(real), RBI(real), bignum); + rbi_canonicalize(real); +} + +static INLINE void +rsub_bi_bi(n_real *real, mpi *bignum) +{ + mpi_sub(RBI(real), RBI(real), bignum); + rbi_canonicalize(real); +} + +static INLINE void +rmul_bi_bi(n_real *real, mpi *bignum) +{ + mpi_mul(RBI(real), RBI(real), bignum); + rbi_canonicalize(real); +} + +static void +rdiv_bi_bi(n_real *real, mpi *bignum) +{ + mpr *bigr; + + if (mpi_cmpi(bignum, 0) == 0) + fatal_error(DIVIDE_BY_ZERO); + + bigr = XALLOC(mpr); + mpr_init(bigr); + mpi_set(mpr_num(bigr), RBI(real)); + mpi_set(mpr_den(bigr), bignum); + RCLEAR_BI(real); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE int +cmp_bi_bi(mpi *op1, mpi *op2) +{ + return (mpi_cmp(op1, op2)); +} + + +/************************************************************************ + * BIGNUM FIXRATIO + ************************************************************************/ +static void +rop_bi_fr_as_xr(n_real *real, long num, long den, int nop) +{ + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpi_init(&iop); + mpi_set(&iop, RBI(real)); + mpi_muli(&iop, &iop, den); + + mpr_init(bigr); + mpr_seti(bigr, num, den); + + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); + else + mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); + mpi_clear(&iop); + + RCLEAR_BI(real); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE void +rop_bi_fr_md_xr(n_real *real, long num, long den, int nop) +{ + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + + mpr_seti(bigr, num, den); + + if (nop == NOP_MUL) + mpi_mul(mpr_num(bigr), RBI(real), mpr_num(bigr)); + else { + mpi_mul(mpr_den(bigr), RBI(real), mpr_den(bigr)); + mpr_inv(bigr, bigr); + } + + RCLEAR_BI(real); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE void +radd_bi_fr(n_real *real, long num, long den) +{ + rop_bi_fr_as_xr(real, num, den, NOP_ADD); +} + +static INLINE void +rsub_bi_fr(n_real *real, long num, long den) +{ + rop_bi_fr_as_xr(real, num, den, NOP_SUB); +} + +static INLINE void +rmul_bi_fr(n_real *real, long num, long den) +{ + rop_bi_fr_md_xr(real, num, den, NOP_MUL); +} + +static INLINE void +rdiv_bi_fr(n_real *real, long num, long den) +{ + rop_bi_fr_md_xr(real, num, den, NOP_DIV); +} + +static int +cmp_bi_fr(mpi *bignum, long num, long den) +{ + int cmp; + mpr cmp1, cmp2; + + mpr_init(&cmp1); + mpi_set(mpr_num(&cmp1), bignum); + mpi_seti(mpr_den(&cmp1), 1); + + mpr_init(&cmp2); + mpr_seti(&cmp2, num, den); + + cmp = mpr_cmp(&cmp1, &cmp2); + mpr_clear(&cmp1); + mpr_clear(&cmp2); + + return (cmp); +} + + +/************************************************************************ + * BIGNUM BIGRATIO + ************************************************************************/ +static void +rop_bi_br_as_xr(n_real *real, mpr *bigratio, int nop) +{ + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpi_init(&iop); + mpi_set(&iop, RBI(real)); + mpr_init(bigr); + mpr_set(bigr, bigratio); + + mpi_mul(&iop, &iop, mpr_den(bigratio)); + + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); + else + mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); + mpi_clear(&iop); + + RCLEAR_BI(real); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static void +rop_bi_br_md_xr(n_real *real, mpr *bigratio, int nop) +{ + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + if (nop == NOP_MUL) + mpr_set(bigr, bigratio); + else + mpr_inv(bigr, bigratio); + + mpi_mul(mpr_num(bigr), RBI(real), mpr_num(bigr)); + + RCLEAR_BI(real); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE void +radd_bi_br(n_real *real, mpr *bigratio) +{ + rop_bi_br_as_xr(real, bigratio, NOP_ADD); +} + +static INLINE void +rsub_bi_br(n_real *real, mpr *bigratio) +{ + rop_bi_br_as_xr(real, bigratio, NOP_SUB); +} + +static INLINE void +rmul_bi_br(n_real *real, mpr *bigratio) +{ + rop_bi_br_md_xr(real, bigratio, NOP_MUL); +} + +static INLINE void +rdiv_bi_br(n_real *real, mpr *bigratio) +{ + rop_bi_br_md_xr(real, bigratio, NOP_DIV); +} + +static int +cmp_bi_br(mpi *bignum, mpr *bigratio) +{ + int cmp; + mpr cmp1; + + mpr_init(&cmp1); + mpi_set(mpr_num(&cmp1), bignum); + mpi_seti(mpr_den(&cmp1), 1); + + cmp = mpr_cmp(&cmp1, bigratio); + mpr_clear(&cmp1); + + return (cmp); +} + + +/************************************************************************ + * FIXRATIO FIXNUM + ************************************************************************/ +static void +rop_fr_fi_as_xr(n_real *real, long op, int nop) +{ + int fit; + long value = 0, num = RFRN(real), den = RFRD(real); + + fit = !fi_fi_mul_overflow(op, den); + + if (fit) { + value = op * den; + if (nop == NOP_ADD) + fit = !fi_fi_add_overflow(value, num); + else + fit = !fi_fi_sub_overflow(value, num); + } + if (fit) { + if (nop == NOP_ADD) + RFRN(real) = num + value; + else + RFRN(real) = num - value; + rfr_canonicalize(real); + } + else { + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, num, den); + mpi_init(&iop); + mpi_seti(&iop, op); + mpi_muli(&iop, &iop, den); + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), mpr_num(bigr), &iop); + else + mpi_sub(mpr_num(bigr), mpr_num(bigr), &iop); + mpi_clear(&iop); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); + } +} + +static void +rop_fr_fi_md_xr(n_real *real, long op, int nop) +{ + long num = RFRN(real), den = RFRD(real); + + if (nop == NOP_MUL) { + if (!fi_fi_mul_overflow(op, num)) { + RFRN(real) = op * num; + rfr_canonicalize(real); + return; + } + } + else if (!fi_fi_mul_overflow(op, den)) { + RFRD(real) = op * den; + rfr_canonicalize(real); + return; + } + + { + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, num, den); + if (nop == NOP_MUL) + mpr_muli(bigr, bigr, op); + else + mpr_divi(bigr, bigr, op); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); + } +} + +static INLINE void +radd_fr_fi(n_real *real, long op) +{ + rop_fr_fi_as_xr(real, op, NOP_ADD); +} + +static INLINE void +rsub_fr_fi(n_real *real, long op) +{ + rop_fr_fi_as_xr(real, op, NOP_SUB); +} + +static INLINE void +rmul_fr_fi(n_real *real, long op) +{ + rop_fr_fi_md_xr(real, op, NOP_MUL); +} + +static INLINE void +rdiv_fr_fi(n_real *real, long op) +{ + rop_fr_fi_md_xr(real, op, NOP_DIV); +} + +static INLINE int +cmp_fr_fi(long num, long den, long fixnum) +{ + return (cmp_flonum((double)num / (double)den, (double)fixnum)); +} + + +/************************************************************************ + * FIXRATIO BIGNUM + ************************************************************************/ +static void +rop_fr_bi_as_xr(n_real *real, mpi *bignum, int nop) +{ + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, RFRN(real), RFRD(real)); + + mpi_init(&iop); + mpi_set(&iop, bignum); + mpi_muli(&iop, &iop, RFRD(real)); + + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), mpr_num(bigr), &iop); + else + mpi_sub(mpr_num(bigr), mpr_num(bigr), &iop); + mpi_clear(&iop); + + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static void +rop_fr_bi_md_xr(n_real *real, mpi *bignum, int nop) +{ + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, RFRN(real), RFRD(real)); + + if (nop == NOP_MUL) + mpi_mul(mpr_num(bigr), mpr_num(bigr), bignum); + else + mpi_mul(mpr_den(bigr), mpr_den(bigr), bignum); + + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE void +radd_fr_bi(n_real *real, mpi *bignum) +{ + rop_fr_bi_as_xr(real, bignum, NOP_ADD); +} + +static INLINE void +rsub_fr_bi(n_real *real, mpi *bignum) +{ + rop_fr_bi_as_xr(real, bignum, NOP_SUB); +} + +static INLINE void +rmul_fr_bi(n_real *real, mpi *bignum) +{ + rop_fr_bi_md_xr(real, bignum, NOP_MUL); +} + +static INLINE void +rdiv_fr_bi(n_real *real, mpi *bignum) +{ + rop_fr_bi_md_xr(real, bignum, NOP_DIV); +} + +static int +cmp_fr_bi(long num, long den, mpi *bignum) +{ + int cmp; + mpr cmp1, cmp2; + + mpr_init(&cmp1); + mpr_seti(&cmp1, num, den); + + mpr_init(&cmp2); + mpi_set(mpr_num(&cmp2), bignum); + mpi_seti(mpr_den(&cmp2), 1); + + cmp = mpr_cmp(&cmp1, &cmp2); + mpr_clear(&cmp1); + mpr_clear(&cmp2); + + return (cmp); +} + + +/************************************************************************ + * FIXRATIO FIXRATIO + ************************************************************************/ +static void +rop_fr_fr_as_xr(n_real *real, long num2, long den2, int nop) +{ + int fit; + long num1 = RFRN(real), den1 = RFRD(real), num = 0, den = 0; + + fit = !fi_fi_mul_overflow(num1, den2); + if (fit) { + num = num1 * den2; + fit = !fi_fi_mul_overflow(num2, den1); + if (fit) { + den = num2 * den1; + if (nop == NOP_ADD) { + if ((fit = !fi_fi_add_overflow(num, den)) != 0) + num += den; + } + else if ((fit = !fi_fi_sub_overflow(num, den)) != 0) + num -= den; + if (fit) { + fit = !fi_fi_mul_overflow(den1, den2); + if (fit) + den = den1 * den2; + } + } + } + if (fit) { + RFRN(real) = num; + RFRD(real) = den; + rfr_canonicalize(real); + } + else { + mpi iop; + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, num1, den1); + mpi_muli(mpr_den(bigr), mpr_den(bigr), den2); + mpi_init(&iop); + mpi_seti(&iop, num2); + mpi_muli(&iop, &iop, den1); + mpi_muli(mpr_num(bigr), mpr_num(bigr), den2); + if (nop == NOP_ADD) + mpi_add(mpr_num(bigr), mpr_num(bigr), &iop); + else + mpi_sub(mpr_num(bigr), mpr_num(bigr), &iop); + mpi_clear(&iop); + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); + } +} + +static void +rop_fr_fr_md_xr(n_real *real, long num2, long den2, int nop) +{ + int fit; + long num1 = RFRN(real), den1 = RFRD(real), num = 0, den = 0; + + if (nop == NOP_MUL) { + fit = !fi_fi_mul_overflow(num1, num2) && !fi_fi_mul_overflow(den1, den2); + if (fit) { + num = num1 * num2; + den = den1 * den2; + } + } + else { + fit = !fi_fi_mul_overflow(num1, den2) && !fi_fi_mul_overflow(den1, num2); + if (fit) { + num = num1 * den2; + den = den1 * num2; + } + } + + if (fit) { + RFRN(real) = num; + RFRD(real) = den; + rfr_canonicalize(real); + } + else { + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + + if (nop == NOP_MUL) { + mpr_seti(bigr, num1, den1); + mpi_muli(mpr_num(bigr), mpr_num(bigr), num2); + mpi_muli(mpr_den(bigr), mpr_den(bigr), den2); + } + else { + mpr_seti(bigr, num1, num2); + mpi_muli(mpr_num(bigr), mpr_num(bigr), den2); + mpi_muli(mpr_den(bigr), mpr_den(bigr), den1); + } + + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); + } +} + +static INLINE void +radd_fr_fr(n_real *real, long num, long den) +{ + rop_fr_fr_as_xr(real, num, den, NOP_ADD); +} + +static INLINE void +rsub_fr_fr(n_real *real, long num, long den) +{ + rop_fr_fr_as_xr(real, num, den, NOP_SUB); +} + +static INLINE void +rmul_fr_fr(n_real *real, long num, long den) +{ + rop_fr_fr_md_xr(real, num, den, NOP_MUL); +} + +static INLINE void +rdiv_fr_fr(n_real *real, long num, long den) +{ + rop_fr_fr_md_xr(real, num, den, NOP_DIV); +} + +static INLINE int +cmp_fr_fr(long num1, long den1, long num2, long den2) +{ + return (cmp_flonum((double)num1 / (double)den1, + (double)num2 / (double)den2)); +} + + +/************************************************************************ + * FIXRATIO BIGRATIO + ************************************************************************/ +static void +rop_fr_br_asmd_xr(n_real *real, mpr *bigratio, int nop) +{ + mpr *bigr = XALLOC(mpr); + + mpr_init(bigr); + mpr_seti(bigr, RFRN(real), RFRD(real)); + + switch (nop) { + case NOP_ADD: + mpr_add(bigr, bigr, bigratio); + break; + case NOP_SUB: + mpr_sub(bigr, bigr, bigratio); + break; + case NOP_MUL: + mpr_mul(bigr, bigr, bigratio); + break; + default: + mpr_div(bigr, bigr, bigratio); + break; + } + + RBR(real) = bigr; + RTYPE(real) = N_BIGRATIO; + rbr_canonicalize(real); +} + +static INLINE void +radd_fr_br(n_real *real, mpr *bigratio) +{ + rop_fr_br_asmd_xr(real, bigratio, NOP_ADD); +} + +static INLINE void +rsub_fr_br(n_real *real, mpr *bigratio) +{ + rop_fr_br_asmd_xr(real, bigratio, NOP_SUB); +} + +static INLINE void +rmul_fr_br(n_real *real, mpr *bigratio) +{ + rop_fr_br_asmd_xr(real, bigratio, NOP_MUL); +} + +static INLINE void +rdiv_fr_br(n_real *real, mpr *bigratio) +{ + rop_fr_br_asmd_xr(real, bigratio, NOP_DIV); +} + +static int +cmp_fr_br(long num, long den, mpr *bigratio) +{ + int cmp; + mpr cmp1; + + mpr_init(&cmp1); + mpr_seti(&cmp1, num, den); + + cmp = mpr_cmp(&cmp1, bigratio); + mpr_clear(&cmp1); + + return (cmp); +} + + +/************************************************************************ + * BIGRATIO FIXNUM + ************************************************************************/ +static void +rop_br_fi_asmd_xr(n_real *real, long fixnum, int nop) +{ + mpr *bigratio = RBR(real); + + switch (nop) { + case NOP_ADD: + mpr_addi(bigratio, bigratio, fixnum); + break; + case NOP_SUB: + mpr_subi(bigratio, bigratio, fixnum); + break; + case NOP_MUL: + mpr_muli(bigratio, bigratio, fixnum); + break; + default: + if (fixnum == 0) + fatal_error(DIVIDE_BY_ZERO); + mpr_divi(bigratio, bigratio, fixnum); + break; + } + rbr_canonicalize(real); +} + +static INLINE void +radd_br_fi(n_real *real, long fixnum) +{ + rop_br_fi_asmd_xr(real, fixnum, NOP_ADD); +} + +static INLINE void +rsub_br_fi(n_real *real, long fixnum) +{ + rop_br_fi_asmd_xr(real, fixnum, NOP_SUB); +} + +static INLINE void +rmul_br_fi(n_real *real, long fixnum) +{ + rop_br_fi_asmd_xr(real, fixnum, NOP_MUL); +} + +static INLINE void +rdiv_br_fi(n_real *real, long fixnum) +{ + rop_br_fi_asmd_xr(real, fixnum, NOP_DIV); +} + +static int +cmp_br_fi(mpr *bigratio, long fixnum) +{ + int cmp; + mpr cmp2; + + mpr_init(&cmp2); + mpr_seti(&cmp2, fixnum, 1); + cmp = mpr_cmp(bigratio, &cmp2); + mpr_clear(&cmp2); + + return (cmp); +} + + +/************************************************************************ + * BIGRATIO BIGNUM + ************************************************************************/ +static void +rop_br_bi_as_xr(n_real *real, mpi *bignum, int nop) +{ + mpi iop; + + mpi_init(&iop); + mpi_set(&iop, bignum); + + mpi_mul(&iop, &iop, RBRD(real)); + if (nop == NOP_ADD) + mpi_add(RBRN(real), RBRN(real), &iop); + else + mpi_sub(RBRN(real), RBRN(real), &iop); + mpi_clear(&iop); + rbr_canonicalize(real); +} + +static INLINE void +radd_br_bi(n_real *real, mpi *bignum) +{ + rop_br_bi_as_xr(real, bignum, NOP_ADD); +} + +static INLINE void +rsub_br_bi(n_real *real, mpi *bignum) +{ + rop_br_bi_as_xr(real, bignum, NOP_SUB); +} + +static INLINE void +rmul_br_bi(n_real *real, mpi *bignum) +{ + mpi_mul(RBRN(real), RBRN(real), bignum); + rbr_canonicalize(real); +} + +static INLINE void +rdiv_br_bi(n_real *real, mpi *bignum) +{ + mpi_mul(RBRD(real), RBRD(real), bignum); + rbr_canonicalize(real); +} + +static int +cmp_br_bi(mpr *bigratio, mpi *bignum) +{ + int cmp; + mpr cmp1; + + mpr_init(&cmp1); + mpi_set(mpr_num(&cmp1), bignum); + mpi_seti(mpr_den(&cmp1), 1); + + cmp = mpr_cmp(bigratio, &cmp1); + mpr_clear(&cmp1); + + return (cmp); +} + + +/************************************************************************ + * BIGRATIO FIXRATIO + ************************************************************************/ +static void +rop_br_fr_asmd_xr(n_real *real, long num, long den, int nop) +{ + mpr *bigratio = RBR(real), rop; + + mpr_init(&rop); + mpr_seti(&rop, num, den); + switch (nop) { + case NOP_ADD: + mpr_add(bigratio, bigratio, &rop); + break; + case NOP_SUB: + mpr_sub(bigratio, bigratio, &rop); + break; + case NOP_MUL: + mpr_mul(bigratio, bigratio, &rop); + break; + default: + mpr_div(bigratio, bigratio, &rop); + break; + } + mpr_clear(&rop); + rbr_canonicalize(real); +} + +static INLINE void +radd_br_fr(n_real *real, long num, long den) +{ + rop_br_fr_asmd_xr(real, num, den, NOP_ADD); +} + +static INLINE void +rsub_br_fr(n_real *real, long num, long den) +{ + rop_br_fr_asmd_xr(real, num, den, NOP_SUB); +} + +static INLINE void +rmul_br_fr(n_real *real, long num, long den) +{ + rop_br_fr_asmd_xr(real, num, den, NOP_MUL); +} + +static INLINE void +rdiv_br_fr(n_real *real, long num, long den) +{ + rop_br_fr_asmd_xr(real, num, den, NOP_DIV); +} + +static int +cmp_br_fr(mpr *bigratio, long num, long den) +{ + int cmp; + mpr cmp2; + + mpr_init(&cmp2); + mpr_seti(&cmp2, num, den); + cmp = mpr_cmp(bigratio, &cmp2); + mpr_clear(&cmp2); + + return (cmp); +} + + +/************************************************************************ + * BIGRATIO BIGRATIO + ************************************************************************/ +static INLINE void +radd_br_br(n_real *real, mpr *bigratio) +{ + mpr_add(RBR(real), RBR(real), bigratio); + rbr_canonicalize(real); +} + +static INLINE void +rsub_br_br(n_real *real, mpr *bigratio) +{ + mpr_sub(RBR(real), RBR(real), bigratio); + rbr_canonicalize(real); +} + +static INLINE void +rmul_br_br(n_real *real, mpr *bigratio) +{ + mpr_mul(RBR(real), RBR(real), bigratio); + rbr_canonicalize(real); +} + +static INLINE void +rdiv_br_br(n_real *real, mpr *bigratio) +{ + mpr_div(RBR(real), RBR(real), bigratio); + rbr_canonicalize(real); +} + +static INLINE int +cmp_br_br(mpr *op1, mpr *op2) +{ + return (mpr_cmp(op1, op2)); +} Index: xc/programs/xedit/lisp/package.c diff -u /dev/null xc/programs/xedit/lisp/package.c:1.20 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/package.c Sat Nov 30 18:13:12 2002 @@ -0,0 +1,865 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/package.c,v 1.20 2002/11/30 23:13:12 paulo Exp $ */ + +#include "package.h" +#include "private.h" + +/* + * Prototypes + */ +static int LispDoSymbol(LispObj*, LispAtom*, int, int); +static LispObj *LispReallyDoSymbols(LispBuiltin*, int, int); +static LispObj *LispDoSymbols(LispBuiltin*, int, int); +static LispObj *LispFindSymbol(LispBuiltin*, int); +static LispObj *LispFindPackageOrDie(LispBuiltin*, LispObj*); +static void LispDoExport(LispBuiltin*, LispObj*, LispObj*, int); +static void LispDoImport(LispBuiltin*, LispObj*); + +/* + * Initialization + */ +extern LispProperty *NOPROPERTY; +static LispObj *Kinternal, *Kexternal, *Kinherited; + +/* + * Implementation + */ +void +LispPackageInit(void) +{ + Kinternal = KEYWORD("INTERNAL"); + Kexternal = KEYWORD("EXTERNAL"); + Kinherited = KEYWORD("INHERITED"); +} + +LispObj * +LispFindPackageFromString(char *string) +{ + LispObj *list, *package, *nick; + + for (list = PACK; CONSP(list); list = CDR(list)) { + package = CAR(list); + if (strcmp(THESTR(package->data.package.name), string) == 0) + return (package); + for (nick = package->data.package.nicknames; + CONSP(nick); nick = CDR(nick)) + if (strcmp(THESTR(CAR(nick)), string) == 0) + return (package); + } + + return (NIL); +} + +LispObj * +LispFindPackage(LispObj *name) +{ + char *string = NULL; + + if (PACKAGEP(name)) + return (name); + + if (SYMBOLP(name)) + string = ATOMID(name); + else if (STRINGP(name)) + string = THESTR(name); + else + LispDestroy("FIND-PACKAGE: %s is not a string or symbol", STROBJ(name)); + + return (LispFindPackageFromString(string)); +} + +int +LispCheckAtomString(char *string) +{ + char *ptr; + + if (*string == '\0') + return (0); + + for (ptr = string; *ptr; ptr++) { + if (islower(*ptr) || strchr("\"\\;#()`'|:", *ptr) || + ((ptr == string || ptr[1] == '\0') && strchr(".,@", *ptr))) + return (0); + } + + return (1); +} + +/* This function is used to avoid some namespace polution caused by the + * way builtin functions are created, all function name arguments enter + * the current package, but most of them do not have a property */ +static int +LispDoSymbol(LispObj *package, LispAtom *atom, int if_extern, int all_packages) +{ + int dosymbol; + + /* condition 1: atom package is current package */ + dosymbol = !all_packages || atom->package == package; + if (dosymbol) { + /* condition 2: intern and extern symbols or symbol is extern */ + dosymbol = !if_extern || atom->ext; + if (dosymbol) { + /* condition 3: atom has properties or is in + * the current package */ + dosymbol = atom->property != NOPROPERTY || + package == lisp__data.keyword || + package == PACKAGE; + } + } + + return (dosymbol); +} + +static LispObj * +LispFindPackageOrDie(LispBuiltin *builtin, LispObj *name) +{ + LispObj *package; + + package = LispFindPackage(name); + + if (package == NIL) + LispDestroy("%s: package %s is not available", + STRFUN(builtin), STROBJ(name)); + + return (package); +} + +/* package must be of type LispPackage_t, symbol type is checked + bypass lisp.c:LispExportSymbol() */ +static void +LispDoExport(LispBuiltin *builtin, + LispObj *package, LispObj *symbol, int export) +{ + CHECK_SYMBOL(symbol); + if (!export) { + if (package == lisp__data.keyword || + symbol->data.atom->package == lisp__data.keyword) + LispDestroy("%s: symbol %s cannot be unexported", + STRFUN(builtin), STROBJ(symbol)); + } + + if (package == PACKAGE) + symbol->data.atom->ext = export ? 1 : 0; + else { + int i; + char *string; + LispAtom *atom; + LispPackage *pack; + + string = ATOMID(symbol); + pack = package->data.package.package; + i = STRHASH(string); + atom = pack->atoms[i]; + while (atom) { + if (strcmp(atom->string, string) == 0) { + atom->ext = export ? 1 : 0; + return; + } + + atom = atom->next; + } + + LispDestroy("%s: the symbol %s is not available in package %s", + STRFUN(builtin), STROBJ(symbol), + THESTR(package->data.package.name)); + } +} + +static void +LispDoImport(LispBuiltin *builtin, LispObj *symbol) +{ + CHECK_SYMBOL(symbol); + LispImportSymbol(symbol); +} + +static LispObj * +LispReallyDoSymbols(LispBuiltin *builtin, int only_externs, int all_symbols) +{ + int i, head = lisp__data.env.length; + LispPackage *pack = NULL; + LispAtom *atom, *next_atom; + LispObj *variable, *package = NULL, *list, *code, *result_form; + + LispObj *init, *body; + + body = ARGUMENT(1); + init = ARGUMENT(0); + + /* Prepare for loop */ + CHECK_CONS(init); + variable = CAR(init); + CHECK_SYMBOL(variable); + + if (!all_symbols) { + /* if all_symbols, a package name is not specified in the init form */ + + init = CDR(init); + if (!CONSP(init)) + LispDestroy("%s: missing package name", STRFUN(builtin)); + + /* Evaluate package specification */ + package = EVAL(CAR(init)); + if (!PACKAGEP(package)) + package = LispFindPackageOrDie(builtin, package); + + pack = package->data.package.package; + } + + result_form = NIL; + + init = CDR(init); + if (CONSP(init)) + result_form = init; + + /* Initialize iteration variable */ + CHECK_CONSTANT(variable); + LispAddVar(variable, NIL); + ++lisp__data.env.head; + + for (list = PACK; CONSP(list); list = CDR(list)) { + if (all_symbols) { + package = CAR(list); + pack = package->data.package.package; + } + + /* Traverse the symbol list, executing body */ + for (i = 0; i < STRTBLSZ; i++) { + atom = pack->atoms[i]; + while (atom) { + /* Save pointer to next atom. If variable is removed, + * predicatable result is only guaranteed if the bound + * variable is removed. */ + next_atom = atom->next; + + if (LispDoSymbol(package, atom, only_externs, all_symbols)) { + LispSetVar(variable, atom->object); + for (code = body; CONSP(code); code = CDR(code)) + EVAL(CAR(code)); + } + + atom = next_atom; + } + } + + if (!all_symbols) + break; + } + + /* Variable is still bound */ + for (code = result_form; CONSP(code); code = CDR(code)) + EVAL(CAR(code)); + + lisp__data.env.head = lisp__data.env.length = head; + + return (NIL); +} + +static LispObj * +LispDoSymbols(LispBuiltin *builtin, int only_externs, int all_symbols) +{ + int did_jump, *pdid_jump = &did_jump; + LispObj *result, **presult = &result; + LispBlock *block; + + *presult = NIL; + *pdid_jump = 1; + block = LispBeginBlock(NIL, LispBlockTag); + if (setjmp(block->jmp) == 0) { + *presult = LispReallyDoSymbols(builtin, only_externs, all_symbols); + *pdid_jump = 0; + } + LispEndBlock(block); + if (*pdid_jump) + *presult = lisp__data.block.block_ret; + + return (*presult); +} + +LispObj * +LispFindSymbol(LispBuiltin *builtin, int intern) +{ + int i; + char *ptr; + LispAtom *atom; + LispObj *symbol; + LispPackage *pack; + + LispObj *string, *package; + + package = ARGUMENT(1); + string = ARGUMENT(0); + + CHECK_STRING(string); + if (package != UNSPEC) + package = LispFindPackageOrDie(builtin, package); + else + package = PACKAGE; + + /* If got here, package is a LispPackage_t */ + pack = package->data.package.package; + + /* Search symbol in specified package */ + ptr = THESTR(string); + + RETURN_COUNT = 1; + + symbol = NULL; + /* Fix for current behaviour where NIL and T aren't symbols... */ + if (STRLEN(string) == 3 && memcmp(ptr, "NIL", 3) == 0) + symbol = NIL; + else if (STRLEN(string) == 1 && ptr[0] == 'T') + symbol = T; + if (symbol) { + RETURN(0) = NIL; + return (symbol); + } + + i = STRHASH(ptr); + atom = pack->atoms[i]; + while (atom) { + if (strcmp(atom->string, ptr) == 0) { + symbol = atom->object; + break; + } + atom = atom->next; + } + + if (symbol == NULL || symbol->data.atom->package == NULL) { + RETURN(0) = NIL; + if (intern) { + /* symbol does not exist in the specified package, create a new + * internal symbol */ + + if (package == PACKAGE) + symbol = ATOM(ptr); + else { + LispPackage *savepack; + LispObj *savepackage; + + /* Save package environment */ + savepackage = PACKAGE; + savepack = lisp__data.pack; + + /* Change package environment */ + PACKAGE = package; + lisp__data.pack = package->data.package.package; + + symbol = ATOM(ptr); + + /* Restore package environment */ + PACKAGE = savepackage; + lisp__data.pack = savepack; + } + + symbol->data.atom->unreadable = !LispCheckAtomString(ptr); + /* If symbol being create in the keyword package, make it external */ + if (package == lisp__data.keyword) + symbol->data.atom->ext = symbol->data.atom->constant = 1; + } + else + symbol = NIL; + } + else { + if (symbol->data.atom->package == package) + RETURN(0) = symbol->data.atom->ext ? Kexternal : Kinternal; + else + RETURN(0) = Kinherited; + } + + return (symbol); +} + + +LispObj * +Lisp_DoAllSymbols(LispBuiltin *builtin) +/* + do-all-symbols init &rest body + */ +{ + return (LispDoSymbols(builtin, 0, 1)); +} + +LispObj * +Lisp_DoExternalSymbols(LispBuiltin *builtin) +/* + do-external-symbols init &rest body + */ +{ + return (LispDoSymbols(builtin, 1, 0)); +} + +LispObj * +Lisp_DoSymbols(LispBuiltin *builtin) +/* + do-symbols init &rest body + */ +{ + return (LispDoSymbols(builtin, 0, 0)); +} + +LispObj * +Lisp_FindAllSymbols(LispBuiltin *builtin) +/* + find-all-symbols string-or-symbol + */ +{ + GC_ENTER(); + char *string = NULL; + LispAtom *atom; + LispPackage *pack; + LispObj *list, *package, *result; + int i; + + LispObj *string_or_symbol; + + string_or_symbol = ARGUMENT(0); + + if (STRINGP(string_or_symbol)) + string = THESTR(string_or_symbol); + else if (SYMBOLP(string_or_symbol)) + string = ATOMID(string_or_symbol); + else + LispDestroy("%s: %s is not a string or symbol", + STRFUN(builtin), STROBJ(string_or_symbol)); + + result = NIL; + i = STRHASH(string); + + /* Traverse all packages, searching for symbols matching specified string */ + for (list = PACK; CONSP(list); list = CDR(list)) { + package = CAR(list); + pack = package->data.package.package; + + atom = pack->atoms[i]; + while (atom) { + if (strcmp(atom->string, string) == 0 && + LispDoSymbol(package, atom, 0, 1)) { + /* Return only one pointer to a matching symbol */ + + if (result == NIL) { + result = CONS(atom->object, NIL); + GC_PROTECT(result); + } + else { + /* Put symbols defined first in the + * beginning of the result list */ + RPLACD(result, CONS(CAR(result), CDR(result))); + RPLACA(result, atom->object); + } + } + atom = atom->next; + } + } + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_FindSymbol(LispBuiltin *builtin) +/* + find-symbol string &optional package + */ +{ + return (LispFindSymbol(builtin, 0)); +} + +LispObj * +Lisp_FindPackage(LispBuiltin *builtin) +/* + find-package name + */ +{ + LispObj *name; + + name = ARGUMENT(0); + + return (LispFindPackage(name)); +} + +LispObj * +Lisp_Export(LispBuiltin *builtin) +/* + export symbols &optional package + */ +{ + LispObj *list; + + LispObj *symbols, *package; + + package = ARGUMENT(1); + symbols = ARGUMENT(0); + + /* If specified, make sure package is available */ + if (package != UNSPEC) + package = LispFindPackageOrDie(builtin, package); + else + package = PACKAGE; + + /* Export symbols */ + if (CONSP(symbols)) { + for (list = symbols; CONSP(list); list = CDR(list)) + LispDoExport(builtin, package, CAR(list), 1); + } + else + LispDoExport(builtin, package, symbols, 1); + + return (T); +} + +LispObj * +Lisp_Import(LispBuiltin *builtin) +/* + import symbols &optional package + */ +{ + int restore_package; + LispPackage *savepack = NULL; + LispObj *list, *savepackage = NULL; + + LispObj *symbols, *package; + + package = ARGUMENT(1); + symbols = ARGUMENT(0); + + /* If specified, make sure package is available */ + if (package != UNSPEC) + package = LispFindPackageOrDie(builtin, package); + else + package = PACKAGE; + + restore_package = package != PACKAGE; + if (restore_package) { + /* Save package environment */ + savepackage = PACKAGE; + savepack = lisp__data.pack; + + /* Change package environment */ + PACKAGE = package; + lisp__data.pack = package->data.package.package; + } + + /* Export symbols */ + if (CONSP(symbols)) { + for (list = symbols; CONSP(list); list = CDR(list)) + LispDoImport(builtin, CAR(list)); + } + else + LispDoImport(builtin, symbols); + + if (restore_package) { + /* Restore package environment */ + PACKAGE = savepackage; + lisp__data.pack = savepack; + } + + return (T); +} + +LispObj * +Lisp_InPackage(LispBuiltin *builtin) +/* + in-package name + */ +{ + LispObj *package; + + LispObj *name; + + name = ARGUMENT(0); + + package = LispFindPackageOrDie(builtin, name); + + /* Update pointer to package symbol table */ + lisp__data.pack = package->data.package.package; + PACKAGE = package; + + return (package); +} + +LispObj * +Lisp_Intern(LispBuiltin *builtin) +/* + intern string &optional package + */ +{ + return (LispFindSymbol(builtin, 1)); +} + +LispObj * +Lisp_ListAllPackages(LispBuiltin *builtin) +/* + list-all-packages + */ +{ + /* Maybe this should be read-only or a copy of the package list. + * But, if properly implemented, it should be possible to (rplaca) + * this variable from lisp code with no problems. Don't do it at home. */ + + return (PACK); +} + +LispObj * +Lisp_MakePackage(LispBuiltin *builtin) +/* + make-package package-name &key nicknames use + */ +{ + GC_ENTER(); + LispObj *list, *package, *nicks, *cons, *savepackage; + + LispObj *package_name, *nicknames, *use; + + use = ARGUMENT(2); + nicknames = ARGUMENT(1); + package_name = ARGUMENT(0); + + /* Check if package already exists */ + package = LispFindPackage(package_name); + if (package != NIL) + /* FIXME: this should be a correctable error */ + LispDestroy("%s: package %s already defined", + STRFUN(builtin), STROBJ(package_name)); + + /* Error checks done, package_name is either a symbol or string */ + if (!XSTRINGP(package_name)) + package_name = STRING(ATOMID(package_name)); + + GC_PROTECT(package_name); + + /* Check nicknames */ + nicks = cons = NIL; + for (list = nicknames; CONSP(list); list = CDR(list)) { + package = LispFindPackage(CAR(list)); + if (package != NIL) + /* FIXME: this should be a correctable error */ + LispDestroy("%s: nickname %s matches package %s", + STRFUN(builtin), STROBJ(CAR(list)), + THESTR(package->data.package.name)); + /* Store all nicknames as strings */ + package = CAR(list); + if (!XSTRINGP(package)) + package = STRING(ATOMID(package)); + if (nicks == NIL) { + nicks = cons = CONS(package, NIL); + GC_PROTECT(nicks); + } + else { + RPLACD(cons, CONS(package, NIL)); + cons = CDR(cons); + } + } + + /* Check use list */ + for (list = use; CONSP(list); list = CDR(list)) + (void)LispFindPackageOrDie(builtin, CAR(list)); + + /* No errors, create new package */ + package = LispNewPackage(package_name, nicks); + + /* Update list of packages */ + PACK = CONS(package, PACK); + + /* No need for gc protection anymore */ + GC_LEAVE(); + + /* Import symbols from use list */ + savepackage = PACKAGE; + + /* Update pointer to package symbol table */ + lisp__data.pack = package->data.package.package; + PACKAGE = package; + + if (use != UNSPEC) { + for (list = use; CONSP(list); list = CDR(list)) + LispUsePackage(LispFindPackage(CAR(list))); + } + else + LispUsePackage(lisp__data.lisp); + + /* Restore pointer to package symbol table */ + lisp__data.pack = savepackage->data.package.package; + PACKAGE = savepackage; + + return (package); +} + +LispObj * +Lisp_Packagep(LispBuiltin *builtin) +/* + packagep object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (PACKAGEP(object) ? T : NIL); +} + +LispObj * +Lisp_PackageName(LispBuiltin *builtin) +/* + package-name package + */ +{ + LispObj *package; + + package = ARGUMENT(0); + + package = LispFindPackageOrDie(builtin, package); + + return (package->data.package.name); +} + +LispObj * +Lisp_PackageNicknames(LispBuiltin *builtin) +/* + package-nicknames package + */ +{ + LispObj *package; + + package = ARGUMENT(0); + + package = LispFindPackageOrDie(builtin, package); + + return (package->data.package.nicknames); +} + +LispObj * +Lisp_PackageUseList(LispBuiltin *builtin) +/* + package-use-list package + */ +{ + /* If the variable returned by this function is expected to be changeable, + * need to change the layout of the LispPackage structure. */ + + LispPackage *pack; + LispObj *package, *use, *cons; + + package = ARGUMENT(0); + + package = LispFindPackageOrDie(builtin, package); + + use = cons = NIL; + pack = package->data.package.package; + + if (pack->use.length) { + GC_ENTER(); + int i = pack->use.length - 1; + + use = cons = CONS(pack->use.pairs[i], NIL); + GC_PROTECT(use); + for (--i; i >= 0; i--) { + RPLACD(cons, CONS(pack->use.pairs[i], NIL)); + cons = CDR(cons); + } + GC_LEAVE(); + } + + return (use); +} + +LispObj * +Lisp_PackageUsedByList(LispBuiltin *builtin) +/* + package-used-by-list package + */ +{ + GC_ENTER(); + int i; + LispPackage *pack; + LispObj *package, *other, *used, *cons, *list; + + package = ARGUMENT(0); + + package = LispFindPackageOrDie(builtin, package); + + used = cons = NIL; + + for (list = PACK; CONSP(list); list = CDR(list)) { + other = CAR(list); + if (package == other) + /* Surely package uses itself */ + continue; + + pack = other->data.package.package; + + for (i = 0; i < pack->use.length; i++) { + if (pack->use.pairs[i] == package) { + if (used == NIL) { + used = cons = CONS(other, NIL); + GC_PROTECT(used); + } + else { + RPLACD(cons, CONS(other, NIL)); + cons = CDR(cons); + } + } + } + } + + GC_LEAVE(); + + return (used); +} + +LispObj * +Lisp_Unexport(LispBuiltin *builtin) +/* + unexport symbols &optional package + */ +{ + LispObj *list; + + LispObj *symbols, *package; + + package = ARGUMENT(1); + symbols = ARGUMENT(0); + + /* If specified, make sure package is available */ + if (package != UNSPEC) + package = LispFindPackageOrDie(builtin, package); + else + package = PACKAGE; + + /* Export symbols */ + if (CONSP(symbols)) { + for (list = symbols; CONSP(list); list = CDR(list)) + LispDoExport(builtin, package, CAR(list), 0); + } + else + LispDoExport(builtin, package, symbols, 0); + + return (T); +} Index: xc/programs/xedit/lisp/package.h diff -u /dev/null xc/programs/xedit/lisp/package.h:1.7 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/package.h Mon Nov 25 23:06:28 2002 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/package.h,v 1.7 2002/11/26 04:06:28 paulo Exp $ */ + +#ifndef Lisp_package_h +#define Lisp_package_h + +#include "internal.h" + +void LispPackageInit(void); +LispObj *LispFindPackage(LispObj*); +LispObj *LispFindPackageFromString(char*); +/* returns 1 if string can safely be read back */ +int LispCheckAtomString(char*); + +LispObj *Lisp_DoAllSymbols(LispBuiltin*); +LispObj *Lisp_DoExternalSymbols(LispBuiltin*); +LispObj *Lisp_DoSymbols(LispBuiltin*); +LispObj *Lisp_FindAllSymbols(LispBuiltin*); +LispObj *Lisp_FindPackage(LispBuiltin*); +LispObj *Lisp_FindSymbol(LispBuiltin*); +LispObj *Lisp_Export(LispBuiltin*); +LispObj *Lisp_Import(LispBuiltin*); +LispObj *Lisp_InPackage(LispBuiltin*); +LispObj *Lisp_Intern(LispBuiltin*); +LispObj *Lisp_ListAllPackages(LispBuiltin*); +LispObj *Lisp_MakePackage(LispBuiltin*); +LispObj *Lisp_Packagep(LispBuiltin*); +LispObj *Lisp_PackageName(LispBuiltin*); +LispObj *Lisp_PackageNicknames(LispBuiltin*); +LispObj *Lisp_PackageUseList(LispBuiltin*); +LispObj *Lisp_PackageUsedByList(LispBuiltin*); +LispObj *Lisp_Unexport(LispBuiltin*); + +#endif /* Lisp_package_h */ Index: xc/programs/xedit/lisp/pathname.c diff -u /dev/null xc/programs/xedit/lisp/pathname.c:1.17 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/pathname.c Mon Dec 23 19:25:39 2002 @@ -0,0 +1,1096 @@ +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/pathname.c,v 1.17 2002/12/24 00:25:39 dawes Exp $ */ + +#include <stdio.h> /* including dirent.h first may cause problems */ +#include <sys/types.h> +#include <dirent.h> +#include <errno.h> +#include <sys/stat.h> +#include "pathname.h" +#include "private.h" + +#define NOREAD_SKIP 0 +#define NOREAD_ERROR 1 + +/* + * Initialization + */ +LispObj *Oparse_namestring, *Kerror, *Kabsolute, *Krelative, *Kskip; + +/* + * Implementation + */ +void +LispPathnameInit(void) +{ + Kerror = KEYWORD("ERROR"); + Oparse_namestring = STATIC_ATOM("PARSE-NAMESTRING"); + Kabsolute = KEYWORD("ABSOLUTE"); + Krelative = KEYWORD("RELATIVE"); +} + +static int +glob_match(char *cmp1, char *cmp2) +/* + * Note: this code was written from scratch, and may generate incorrect + * results for very complex glob masks. + */ +{ + for (;;) { + while (*cmp1 && *cmp1 == *cmp2) { + ++cmp1; + ++cmp2; + } + if (*cmp2) { + if (*cmp1 == '*') { + while (*cmp1 == '*') + ++cmp1; + if (*cmp1) { + int count = 0, settmp = 1; + char *tmp = cmp2, *sav2; + + while (*cmp1 && *cmp1 == '?') { + ++cmp1; + ++count; + } + + /* need to recurse here to make sure + * all cases are tested. + */ + while (*cmp2 && *cmp2 != *cmp1) + ++cmp2; + if (!*cmp1 && cmp2 - tmp < count) + return (0); + sav2 = cmp2; + + /* if recursive calls fails, make sure all '?' + * following '*' are processed */ + while (*sav2 && sav2 - tmp < count) + ++sav2; + + for (; *cmp2;) { + if (settmp) /* repeated letters: *?o? => boot, root */ + tmp = cmp2; + else + settmp = 1; + while (*cmp2 && *cmp2 != *cmp1) + ++cmp2; + if (cmp2 - tmp < count) { + if (*cmp2) + ++cmp2; + settmp = 0; + continue; + } + if (*cmp2) { + if (glob_match(cmp1, cmp2)) + return (1); + ++cmp2; + } + } + cmp2 = sav2; + } + else { + while (*cmp2) + ++cmp2; + break; + } + } + else if (*cmp1 == '?') { + while (*cmp1 == '?' && *cmp2) { + ++cmp1; + ++cmp2; + } + continue; + } + else + break; + } + else { + while (*cmp1 == '*') + ++cmp1; + break; + } + } + + return (*cmp1 == '\0' && *cmp2 == '\0'); +} + +/* + * Since directory is a function to be extended by the implementation, + * current extensions are: + * all => list files and directories + * it is an error to call + * (directory "<pathname-spec>/" :all t) + * if non nil, it is like the shell command + * echo <pathname-spec>, but normally, not in the + * same order, as the code does not sort the result. + * !=nil => list files and directories + * (default) nil => list only files, or only directories if + * <pathname-spec> ends with PATH_SEP char. + * if-cannot-read => if opendir fails on a directory + * :error => generate an error + * (default) :skip => skip search in this directory + */ +LispObj * +Lisp_Directory(LispBuiltin *builtin) +/* + directory pathname &key all if-cannot-read + */ +{ + GC_ENTER(); + DIR *dir; + struct stat st; + struct dirent *ent; + int length, listdirs, i, ndirs, nmatches; + char name[PATH_MAX + 1], path[PATH_MAX + 2], directory[PATH_MAX + 2]; + char *sep, *base, *ptr, **dirs, **matches, + dot[] = {'.', PATH_SEP, '\0'}, + dotdot[] = {'.', '.', PATH_SEP, '\0'}; + int cannot_read; + + LispObj *pathname, *all, *if_cannot_read, *result, *cons, *object; + + if_cannot_read = ARGUMENT(2); + all = ARGUMENT(1); + pathname = ARGUMENT(0); + result = NIL; + + cons = NIL; + + if (if_cannot_read != UNSPEC) { + if (!KEYWORDP(if_cannot_read) || + (if_cannot_read != Kskip && + if_cannot_read != Kerror)) + LispDestroy("%s: bad :IF-CANNOT-READ %s", + STRFUN(builtin), STROBJ(if_cannot_read)); + if (if_cannot_read != Kskip) + cannot_read = NOREAD_SKIP; + else + cannot_read = NOREAD_ERROR; + } + else + cannot_read = NOREAD_SKIP; + + if (PATHNAMEP(pathname)) + pathname = CAR(pathname->data.pathname); + else if (STREAMP(pathname) && pathname->data.stream.type == LispStreamFile) + pathname = CAR(pathname->data.stream.pathname->data.pathname); + else if (!STRINGP(pathname)) + LispDestroy("%s: %s is not a pathname", + STRFUN(builtin), STROBJ(pathname)); + + strncpy(name, THESTR(pathname), sizeof(name) - 1); + name[sizeof(name) - 1] = '\0'; + length = strlen(name); + if (length < STRLEN(pathname)) + LispDestroy("%s: pathname too long %s", + STRFUN(builtin), name); + + if (length == 0) { + if (getcwd(path, sizeof(path) - 2) == NULL) + LispDestroy("%s: getcwd(): %s", STRFUN(builtin), strerror(errno)); + length = strlen(path); + if (!length || path[length - 1] != PATH_SEP) { + path[length++] = PATH_SEP; + path[length] = '\0'; + } + result = APPLY1(Oparse_namestring, LSTRING(path, length)); + GC_LEAVE(); + + return (result); + } + + if (name[length - 1] == PATH_SEP) { + listdirs = 1; + if (length > 1) { + --length; + name[length] = '\0'; + } + } + else + listdirs = 0; + + if (name[0] != PATH_SEP) { + if (getcwd(path, sizeof(path) - 2) == NULL) + LispDestroy("%s: getcwd(): %s", STRFUN(builtin), strerror(errno)); + length = strlen(path); + if (!length || path[length - 1] != PATH_SEP) { + path[length++] = PATH_SEP; + path[length] = '\0'; + } + } + else + path[0] = '\0'; + + result = NIL; + + /* list intermediate directories */ + matches = NULL; + nmatches = 0; + dirs = LispMalloc(sizeof(char*)); + ndirs = 1; + if (snprintf(directory, sizeof(directory), "%s%s%c", + path, name, PATH_SEP) > PATH_MAX) + LispDestroy("%s: pathname too long %s", STRFUN(builtin), directory); + + /* Remove ../ */ + sep = directory; + for (sep = strstr(sep, dotdot); sep; sep = strstr(sep, dotdot)) { + if (sep <= directory + 1) + strcpy(directory, sep + 2); + else if (sep[-1] == PATH_SEP) { + for (base = sep - 2; base > directory; base--) + if (*base == PATH_SEP) + break; + strcpy(base, sep + 2); + sep = base; + } + else + ++sep; + } + + /* Remove "./" */ + sep = directory; + for (sep = strstr(sep, dot); sep; sep = strstr(sep, dot)) { + if (sep == directory || sep[-1] == PATH_SEP) + strcpy(sep, sep + 2); + else + ++sep; + } + + /* This will happen when there are too many '../' in the path */ + if (directory[1] == '\0') { + directory[1] = PATH_SEP; + directory[2] = '\0'; + } + + base = directory; + sep = strchr(base + 1, PATH_SEP); + dirs[0] = LispMalloc(2); + dirs[0][0] = PATH_SEP; + dirs[0][1] = '\0'; + + for (base = directory + 1, sep = strchr(base, PATH_SEP); ; + base = sep + 1, sep = strchr(base, PATH_SEP)) { + *sep = '\0'; + if (sep[1] == '\0') + sep = NULL; + length = strlen(base); + if (length == 0) { + if (sep) + *sep = PATH_SEP; + else + break; + continue; + } + + for (i = 0; i < ndirs; i++) { + length = strlen(dirs[i]); + if (length > 1) + dirs[i][length - 1] = '\0'; /* remove trailing / */ + if ((dir = opendir(dirs[i])) != NULL) { + (void)readdir(dir); /* "." */ + (void)readdir(dir); /* ".." */ + if (length > 1) + dirs[i][length - 1] = PATH_SEP; /* add trailing / again */ + + snprintf(path, sizeof(path), "%s", dirs[i]); + length = strlen(path); + ptr = path + length; + + while ((ent = readdir(dir)) != NULL) { + int isdir; + unsigned d_namlen = strlen(ent->d_name); + + if (length + d_namlen + 2 < sizeof(path)) + strcpy(ptr, ent->d_name); + else { + closedir(dir); + LispDestroy("%s: pathname too long %s", + STRFUN(builtin), dirs[i]); + } + + if (stat(path, &st) != 0) + isdir = 0; + else + isdir = S_ISDIR(st.st_mode); + + if (all != UNSPEC || ((isdir && (listdirs || sep)) || + (!listdirs && !sep && !isdir))) { + if (glob_match(base, ent->d_name)) { + if (isdir) { + length = strlen(ptr); + ptr[length++] = PATH_SEP; + ptr[length] = '\0'; + } + /* XXX won't closedir on memory allocation failure! */ + matches = LispRealloc(matches, sizeof(char*) * + nmatches + 1); + matches[nmatches++] = LispStrdup(ptr); + } + } + } + closedir(dir); + + if (nmatches == 0) { + if (sep || !listdirs || *base) { + LispFree(dirs[i]); + if (i + 1 < ndirs) + memmove(dirs + i, dirs + i + 1, + sizeof(char*) * (ndirs - (i + 1))); + --ndirs; + --i; /* XXX playing with for loop */ + } + } + else { + int j; + + length = strlen(dirs[i]); + if (nmatches > 1) { + dirs = LispRealloc(dirs, sizeof(char*) * + (ndirs + nmatches)); + if (i + 1 < ndirs) + memmove(dirs + i + nmatches, dirs + i + 1, + sizeof(char*) * (ndirs - (i + 1))); + } + for (j = 1; j < nmatches; j++) { + dirs[i + j] = LispMalloc(length + + strlen(matches[j]) + 1); + sprintf(dirs[i + j], "%s%s", dirs[i], matches[j]); + } + dirs[i] = LispRealloc(dirs[i], + length + strlen(matches[0]) + 1); + strcpy(dirs[i] + length, matches[0]); + i += nmatches - 1; /* XXX playing with for loop */ + ndirs += nmatches - 1; + + for (j = 0; j < nmatches; j++) + LispFree(matches[j]); + LispFree(matches); + matches = NULL; + nmatches = 0; + } + } + else { + if (cannot_read == NOREAD_ERROR) + LispDestroy("%s: opendir(%s): %s", + STRFUN(builtin), dirs[i], strerror(errno)); + else { + LispFree(dirs[i]); + if (i + 1 < ndirs) + memmove(dirs + i, dirs + i + 1, + sizeof(char*) * (ndirs - (i + 1))); + --ndirs; + --i; /* XXX playing with for loop */ + } + } + } + if (sep) + *sep = PATH_SEP; + else + break; + } + + for (i = 0; i < ndirs; i++) { + object = APPLY1(Oparse_namestring, STRING2(dirs[i])); + if (result == NIL) { + result = cons = CONS(object, NIL); + GC_PROTECT(result); + } + else { + RPLACD(cons, CONS(object, NIL)); + cons = CDR(cons); + } + } + LispFree(dirs); + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_ParseNamestring(LispBuiltin *builtin) +/* + parse-namestring object &optional host defaults &key start end junk-allowed + */ +{ + GC_ENTER(); + LispObj *result; + + LispObj *object, *host, *defaults, *ostart, *oend, *junk_allowed; + + junk_allowed = ARGUMENT(5); + oend = ARGUMENT(4); + ostart = ARGUMENT(3); + defaults = ARGUMENT(2); + host = ARGUMENT(1); + object = ARGUMENT(0); + + if (host == UNSPEC) + host = NIL; + if (defaults == UNSPEC) + defaults = NIL; + + RETURN_COUNT = 1; + if (STREAMP(object)) { + if (object->data.stream.type == LispStreamFile) + object = object->data.stream.pathname; + /* else just check for JUNK-ALLOWED... */ + } + if (PATHNAMEP(object)) { + RETURN(0) = FIXNUM(0); + return (object); + } + + if (host != NIL) { + CHECK_STRING(host); + } + if (defaults != NIL) { + if (!PATHNAMEP(defaults)) { + defaults = APPLY1(Oparse_namestring, defaults); + GC_PROTECT(defaults); + } + } + + result = NIL; + if (STRINGP(object)) { + LispObj *cons, *cdr; + char *name = THESTR(object), *ptr, *str, data[PATH_MAX + 1], + string[PATH_MAX + 1], *namestr, *typestr, *send; + long start, end, length, alength, namelen, typelen; + + LispCheckSequenceStartEnd(builtin, object, ostart, oend, + &start, &end, &length); + alength = end - start; + + if (alength > sizeof(data) - 1) + LispDestroy("%s: string %s too large", + STRFUN(builtin), STROBJ(object)); + memcpy(data, name + start, alength); +#ifndef KEEP_EXTRA_PATH_SEP + ptr = data; + send = ptr + alength; + while (ptr < send) { + if (*ptr++ == PATH_SEP) { + for (str = ptr; str < send && *str == PATH_SEP; str++) + ; + if (str - ptr) { + memmove(ptr, str, alength - (str - data)); + alength -= str - ptr; + send -= str - ptr; + } + } + } +#endif + data[alength] = '\0'; + memcpy(string, data, alength + 1); + + if (PATHNAMEP(defaults)) + defaults = defaults->data.pathname; + + /* string name */ + result = cons = CONS(NIL, NIL); + GC_PROTECT(result); + + /* host */ + if (defaults != NIL) + defaults = CDR(defaults); + cdr = defaults == NIL ? NIL : CAR(defaults); + RPLACD(cons, CONS(cdr, NIL)); + cons = CDR(cons); + + /* device */ + if (defaults != NIL) + defaults = CDR(defaults); + cdr = defaults == NIL ? NIL : CAR(defaults); + RPLACD(cons, CONS(cdr, NIL)); + cons = CDR(cons); + + /* directory */ + if (defaults != NIL) + defaults = CDR(defaults); + if (*data == PATH_SEP) + cdr = CONS(Kabsolute, NIL); + else + cdr = CONS(Krelative, NIL); + RPLACD(cons, CONS(cdr, NIL)); + cons = CDR(cons); + /* directory components */ + ptr = data; + send = data + alength; + if (*ptr == PATH_SEP) + ++ptr; + for (str = ptr; str < send; str++) { + if (*str == PATH_SEP) + break; + } + while (str < send) { + *str++ = '\0'; + if (str - ptr > NAME_MAX) + LispDestroy("%s: directory name too long %s", + STRFUN(builtin), ptr); + RPLACD(cdr, CONS(LSTRING(ptr, str - ptr - 1), NIL)); + cdr = CDR(cdr); + for (ptr = str; str < send; str++) { + if (*str == PATH_SEP) + break; + } + } + if (str - ptr > NAME_MAX) + LispDestroy("%s: file name too long %s", STRFUN(builtin), ptr); + if (CAAR(cons) == Krelative && + defaults != NIL && CAAR(defaults) == Kabsolute) { + /* defaults specify directory and pathname doesn't */ + char *tstring; + long dlength, tlength; + LispObj *dir = CDAR(defaults); + + for (dlength = 1; CONSP(dir); dir = CDR(dir)) + dlength += STRLEN(CAR(dir)) + 1; + if (alength + dlength < PATH_MAX) { + memmove(data + dlength, data, alength + 1); + memmove(string + dlength, string, alength + 1); + alength += dlength; + ptr += dlength; + send += dlength; + CAAR(cons) = Kabsolute; + for (dir = CDAR(defaults), cdr = CAR(cons); + CONSP(dir); + dir = CDR(dir)) { + RPLACD(cdr, CONS(CAR(dir), CDR(cdr))); + cdr = CDR(cdr); + } + dir = CDAR(defaults); + data[0] = string[0] = PATH_SEP; + for (dlength = 1; CONSP(dir); dir = CDR(dir)) { + tstring = THESTR(CAR(dir)); + tlength = STRLEN(CAR(dir)); + memcpy(data + dlength, tstring, tlength); + memcpy(string + dlength, tstring, tlength); + dlength += tlength; + data[dlength] = string[dlength] = PATH_SEP; + ++dlength; + } + } + } + + /* name */ + if (defaults != NIL) + defaults = CDR(defaults); + cdr = defaults == NIL ? NIL : CAR(defaults); + for (typelen = 0, str = ptr; str < send; str++) { + if (*str == PATH_TYPESEP) { + typelen = 1; + break; + } + } + if (*ptr) + cdr = LSTRING(ptr, str - ptr); + if (STRINGP(cdr)) { + namestr = THESTR(cdr); + namelen = STRLEN(cdr); + } + else { + namestr = ""; + namelen = 0; + } + RPLACD(cons, CONS(cdr, NIL)); + cons = CDR(cons); + + /* type */ + if (defaults != NIL) + defaults = CDR(defaults); + cdr = defaults == NIL ? NIL : CAR(defaults); + ptr = str + typelen; + if (*ptr) + cdr = LSTRING(ptr, send - ptr); + if (STRINGP(cdr)) { + typestr = THESTR(cdr); + typelen = STRLEN(cdr); + } + else { + typestr = ""; + typelen = 0; + } + RPLACD(cons, CONS(cdr, NIL)); + cons = CDR(cons); + + /* version */ + if (defaults != NIL) + defaults = CDR(defaults); + cdr = defaults == NIL ? NIL : CAR(defaults); + RPLACD(cons, CONS(cdr, NIL)); + + /* string representation, must be done here to use defaults */ + for (ptr = string + alength; ptr >= string; ptr--) { + if (*ptr == PATH_SEP) + break; + } + if (ptr >= string) + ++ptr; + else + ptr = string; + *ptr = '\0'; + + length = ptr - string; + + alength = namelen; + if (alength) { + if (length + alength + 2 > sizeof(string)) + alength = sizeof(string) - length - 2; + memcpy(string + length, namestr, alength); + length += alength; + } + + alength = typelen; + if (alength) { + if (length + 2 < sizeof(string)) + string[length++] = PATH_TYPESEP; + if (length + alength + 2 > sizeof(string)) + alength = sizeof(string) - length - 2; + memcpy(string + length, typestr, alength); + length += alength; + } + string[length] = '\0'; + + RPLACA(result, LSTRING(string, length)); + RETURN(0) = FIXNUM(end); + + result = PATHNAME(result); + } + else if (junk_allowed == UNSPEC || junk_allowed == NIL) + LispDestroy("%s: bad argument %s", STRFUN(builtin), STROBJ(object)); + else + RETURN(0) = NIL; + + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_MakePathname(LispBuiltin *builtin) +/* + make-pathname &key host device directory name type version defaults + */ +{ + GC_ENTER(); + int length, alength; + char *string, pathname[PATH_MAX + 1]; + LispObj *result, *cdr, *cons; + + LispObj *host, *device, *directory, *name, *type, *version, *defaults; + + defaults = ARGUMENT(6); + version = ARGUMENT(5); + type = ARGUMENT(4); + name = ARGUMENT(3); + directory = ARGUMENT(2); + device = ARGUMENT(1); + host = ARGUMENT(0); + + if (host != UNSPEC) { + CHECK_STRING(host); + } + if (device != UNSPEC) { + CHECK_STRING(device); + } + + if (directory != UNSPEC) { + LispObj *dir; + + CHECK_CONS(directory); + dir = CAR(directory); + CHECK_KEYWORD(dir); + if (dir != Kabsolute && dir != Krelative) + LispDestroy("%s: directory type %s unknown", + STRFUN(builtin), STROBJ(dir)); + } + + if (name != UNSPEC) { + CHECK_STRING(name); + } + if (type != UNSPEC) { + CHECK_STRING(type); + } + + if (version != UNSPEC && version != NIL) { + switch (OBJECT_TYPE(version)) { + case LispFixnum_t: + if (FIXNUM_VALUE(version) >= 0) + goto version_ok; + case LispInteger_t: + if (INT_VALUE(version) >= 0) + goto version_ok; + break; + case LispDFloat_t: + if (DFLOAT_VALUE(version) >= 0.0) + goto version_ok; + break; + default: + break; + } + LispDestroy("%s: %s is not a positive real number", + STRFUN(builtin), STROBJ(version)); + } +version_ok: + + if (defaults != UNSPEC && !PATHNAMEP(defaults) && + (host == UNSPEC || device == UNSPEC || directory == UNSPEC || + name == UNSPEC || type == UNSPEC || version == UNSPEC)) { + defaults = APPLY1(Oparse_namestring, defaults); + GC_PROTECT(defaults); + } + + if (defaults != UNSPEC) { + defaults = defaults->data.pathname; + defaults = CDR(defaults); /* host */ + if (host == UNSPEC) + host = CAR(defaults); + defaults = CDR(defaults); /* device */ + if (device == UNSPEC) + device = CAR(defaults); + defaults = CDR(defaults); /* directory */ + if (directory == UNSPEC) + directory = CAR(defaults); + defaults = CDR(defaults); /* name */ + if (name == UNSPEC) + name = CAR(defaults); + defaults = CDR(defaults); /* type */ + if (type == UNSPEC) + type = CAR(defaults); + defaults = CDR(defaults); /* version */ + if (version == UNSPEC) + version = CAR(defaults); + } + + /* string representation */ + length = 0; + if (CONSP(directory)) { + if (CAR(directory) == Kabsolute) + pathname[length++] = PATH_SEP; + + for (cdr = CDR(directory); CONSP(cdr); cdr = CDR(cdr)) { + CHECK_STRING(CAR(cdr)); + string = THESTR(CAR(cdr)); + alength = STRLEN(CAR(cdr)); + if (alength > NAME_MAX) + LispDestroy("%s: directory name too long %s", + STRFUN(builtin), string); + if (length + alength + 2 > sizeof(pathname)) + alength = sizeof(pathname) - length - 2; + memcpy(pathname + length, string, alength); + length += alength; + pathname[length++] = PATH_SEP; + } + } + if (STRINGP(name)) { + int xlength = 0; + + if (STRINGP(type)) + xlength = STRLEN(type) + 1; + + string = THESTR(name); + alength = STRLEN(name); + if (alength + xlength > NAME_MAX) + LispDestroy("%s: file name too long %s", + STRFUN(builtin), string); + if (length + alength + 2 > sizeof(pathname)) + alength = sizeof(pathname) - length - 2; + memcpy(pathname + length, string, alength); + length += alength; + } + if (STRINGP(type)) { + if (length + 2 < sizeof(pathname)) + pathname[length++] = PATH_TYPESEP; + string = THESTR(type); + alength = STRLEN(type); + if (length + alength + 2 > sizeof(pathname)) + alength = sizeof(pathname) - length - 2; + memcpy(pathname + length, string, alength); + length += alength; + } + pathname[length] = '\0'; + result = cons = CONS(LSTRING(pathname, length), NIL); + GC_PROTECT(result); + + /* host */ + RPLACD(cons, CONS(host == UNSPEC ? NIL : host, NIL)); + cons = CDR(cons); + + /* device */ + RPLACD(cons, CONS(device == UNSPEC ? NIL : device, NIL)); + cons = CDR(cons); + + /* directory */ + if (directory == UNSPEC) + cdr = CONS(Krelative, NIL); + else + cdr = directory; + RPLACD(cons, CONS(cdr, NIL)); + cons = CDR(cons); + + /* name */ + RPLACD(cons, CONS(name == UNSPEC ? NIL : name, NIL)); + cons = CDR(cons); + + /* type */ + RPLACD(cons, CONS(type == UNSPEC ? NIL : type, NIL)); + cons = CDR(cons); + + /* version */ + RPLACD(cons, CONS(version == UNSPEC ? NIL : version, NIL)); + + GC_LEAVE(); + + return (PATHNAME(result)); +} + +LispObj * +Lisp_PathnameHost(LispBuiltin *builtin) +/* + pathname-host pathname + */ +{ + return (LispPathnameField(PATH_HOST, 0)); +} + +LispObj * +Lisp_PathnameDevice(LispBuiltin *builtin) +/* + pathname-device pathname + */ +{ + return (LispPathnameField(PATH_DEVICE, 0)); +} + +LispObj * +Lisp_PathnameDirectory(LispBuiltin *builtin) +/* + pathname-device pathname + */ +{ + return (LispPathnameField(PATH_DIRECTORY, 0)); +} + +LispObj * +Lisp_PathnameName(LispBuiltin *builtin) +/* + pathname-name pathname + */ +{ + return (LispPathnameField(PATH_NAME, 0)); +} + +LispObj * +Lisp_PathnameType(LispBuiltin *builtin) +/* + pathname-type pathname + */ +{ + return (LispPathnameField(PATH_TYPE, 0)); +} + +LispObj * +Lisp_PathnameVersion(LispBuiltin *builtin) +/* + pathname-version pathname + */ +{ + return (LispPathnameField(PATH_VERSION, 0)); +} + +LispObj * +Lisp_FileNamestring(LispBuiltin *builtin) +/* + file-namestring pathname + */ +{ + return (LispPathnameField(PATH_NAME, 1)); +} + +LispObj * +Lisp_DirectoryNamestring(LispBuiltin *builtin) +/* + directory-namestring pathname + */ +{ + return (LispPathnameField(PATH_DIRECTORY, 1)); +} + +LispObj * +Lisp_EnoughNamestring(LispBuiltin *builtin) +/* + enough-pathname pathname &optional defaults + */ +{ + LispObj *pathname, *defaults; + + defaults = ARGUMENT(1); + pathname = ARGUMENT(0); + + if (defaults != UNSPEC && defaults != NIL) { + char *ppathname, *pdefaults, *pp, *pd; + + if (!STRINGP(pathname)) { + if (PATHNAMEP(pathname)) + pathname = CAR(pathname->data.pathname); + else if (STREAMP(pathname) && + pathname->data.stream.type == LispStreamFile) + pathname = CAR(pathname->data.stream.pathname->data.pathname); + else + LispDestroy("%s: bad PATHNAME %s", + STRFUN(builtin), STROBJ(pathname)); + } + + if (!STRINGP(defaults)) { + if (PATHNAMEP(defaults)) + defaults = CAR(defaults->data.pathname); + else if (STREAMP(defaults) && + defaults->data.stream.type == LispStreamFile) + defaults = CAR(defaults->data.stream.pathname->data.pathname); + else + LispDestroy("%s: bad DEFAULTS %s", + STRFUN(builtin), STROBJ(defaults)); + } + + ppathname = pp = THESTR(pathname); + pdefaults = pd = THESTR(defaults); + while (*ppathname && *pdefaults && *ppathname == *pdefaults) { + ppathname++; + pdefaults++; + } + if (*pdefaults == '\0' && pdefaults > pd) + --pdefaults; + if (*ppathname && *pdefaults && *pdefaults != PATH_SEP) { + --ppathname; + while (*ppathname != PATH_SEP && ppathname > pp) + --ppathname; + if (*ppathname == PATH_SEP) + ++ppathname; + } + + return (STRING(ppathname)); + } + else { + if (STRINGP(pathname)) + return (pathname); + else if (PATHNAMEP(pathname)) + return (CAR(pathname->data.pathname)); + else if (STREAMP(pathname)) { + if (pathname->data.stream.type == LispStreamFile) + return (CAR(pathname->data.stream.pathname->data.pathname)); + } + } + LispDestroy("%s: bad PATHNAME %s", STRFUN(builtin), STROBJ(pathname)); + + return (NIL); +} + +LispObj * +Lisp_Namestring(LispBuiltin *builtin) +/* + namestring pathname + */ +{ + return (LispPathnameField(PATH_STRING, 1)); +} + +LispObj * +Lisp_HostNamestring(LispBuiltin *builtin) +/* + host-namestring pathname + */ +{ + return (LispPathnameField(PATH_HOST, 1)); +} + +LispObj * +Lisp_Pathnamep(LispBuiltin *builtin) +/* + pathnamep object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (PATHNAMEP(object) ? T : NIL); +} + +/* XXX only checks if host is a string and only checks the HOME enviroment + * variable */ +LispObj * +Lisp_UserHomedirPathname(LispBuiltin *builtin) +/* + user-homedir-pathname &optional host + */ +{ + GC_ENTER(); + int length; + char *home = getenv("HOME"), data[PATH_MAX + 1]; + LispObj *result; + + LispObj *host; + + host = ARGUMENT(0); + + if (host != UNSPEC && !STRINGP(host)) + LispDestroy("%s: bad hostname %s", STRFUN(builtin), STROBJ(host)); + + length = 0; + if (home) { + length = strlen(home); + strncpy(data, home, length); + if (length && home[length - 1] != PATH_SEP) + data[length++] = PATH_SEP; + } + data[length] = '\0'; + + result = LSTRING(data, length); + GC_PROTECT(result); + result = APPLY1(Oparse_namestring, result); + GC_LEAVE(); + + return (result); +} + +LispObj * +Lisp_Truename(LispBuiltin *builtin) +{ + return (LispProbeFile(builtin, 0)); +} + +LispObj * +Lisp_ProbeFile(LispBuiltin *builtin) +{ + return (LispProbeFile(builtin, 1)); +} Index: xc/programs/xedit/lisp/pathname.h diff -u /dev/null xc/programs/xedit/lisp/pathname.h:1.4 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/pathname.h Fri Nov 8 03:00:57 2002 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/pathname.h,v 1.4 2002/11/08 08:00:57 paulo Exp $ */ + +#ifndef Lisp_pathname_h +#define Lisp_pathname_h + +#include "internal.h" + +#define PATH_SEP '/' +#define PATH_TYPESEP '.' + +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + +#ifndef NAME_MAX +#define NAME_MAX 256 +#endif + + +#define PATH_STRING 0 +#define PATH_HOST 1 +#define PATH_DEVICE 2 +#define PATH_DIRECTORY 3 +#define PATH_NAME 4 +#define PATH_TYPE 5 +#define PATH_VERSION 6 + +void LispPathnameInit(void); + +LispObj *Lisp_Directory(LispBuiltin*); +LispObj *Lisp_Namestring(LispBuiltin*); +LispObj *Lisp_FileNamestring(LispBuiltin*); +LispObj *Lisp_DirectoryNamestring(LispBuiltin*); +LispObj *Lisp_EnoughNamestring(LispBuiltin*); +LispObj *Lisp_HostNamestring(LispBuiltin*); +LispObj *Lisp_MakePathname(LispBuiltin*); +LispObj *Lisp_Pathnamep(LispBuiltin*); +LispObj *Lisp_ParseNamestring(LispBuiltin*); +LispObj *Lisp_PathnameHost(LispBuiltin*); +LispObj *Lisp_PathnameDevice(LispBuiltin*); +LispObj *Lisp_PathnameDirectory(LispBuiltin*); +LispObj *Lisp_PathnameName(LispBuiltin*); +LispObj *Lisp_PathnameType(LispBuiltin*); +LispObj *Lisp_PathnameVersion(LispBuiltin*); +LispObj *Lisp_Truename(LispBuiltin*); +LispObj *Lisp_ProbeFile(LispBuiltin*); +LispObj *Lisp_UserHomedirPathname(LispBuiltin*); + +#endif /* Lisp_pathname_h */ Index: xc/programs/xedit/lisp/private.h diff -u xc/programs/xedit/lisp/private.h:1.15 xc/programs/xedit/lisp/private.h:1.39 --- xc/programs/xedit/lisp/private.h:1.15 Fri Oct 19 20:19:35 2001 +++ xc/programs/xedit/lisp/private.h Thu Dec 19 23:32:46 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/private.h,v 1.15 2001/10/20 00:19:35 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/private.h,v 1.39 2002/12/20 04:32:46 paulo Exp $ */ #ifndef Lisp_private_h #define Lisp_private_h @@ -41,7 +41,9 @@ #include "internal.h" #include "core.h" +#ifdef DEBUGGER #include "debugger.h" +#endif #include "helper.h" #include "string.h" #include "struct.h" @@ -49,21 +51,32 @@ /* * Defines */ -#define STRTBLSZ 23 - -#define MOD mac->modlist -#define GLB mac->glblist -#define ENV mac->envlist -#define LEX mac->lexlist -#define COD mac->codlist -#define FRM mac->frmlist -#define RUN mac->runlist -#define RES mac->reslist -#define DBG mac->dbglist -#define BRK mac->brklist -#define PRO mac->prolist - -#define EOLIST (LispObj*)1 /* end-of-list ")" found in LispRun */ +#define STRTBLSZ 23 +#define MULTIPLE_VALUES_LIMIT 127 +#define MAX_STACK_DEPTH 16384 + +#define FEATURES \ + lisp__data.features->data.atom->a_object ? \ + lisp__data.features->data.atom->property->value : \ + NIL +#define PACK lisp__data.packlist +#define PACKAGE lisp__data.package->data.atom->property->value +#define MOD lisp__data.modlist +#define COD lisp__data.codlist +#define RUN lisp__data.runlist +#define RES lisp__data.reslist +#define DBG lisp__data.dbglist +#define BRK lisp__data.brklist +#define PRO lisp__data.prolist + +#define SINPUT lisp__data.input +#define SOUTPUT lisp__data.output +#define STANDARD_INPUT \ + lisp__data.standard_input->data.atom->property->value +#define STANDARD_OUTPUT \ + lisp__data.standard_output->data.atom->property->value +#define STANDARDSTREAM(file, desc, flags) \ + LispNewStandardStream(file, desc, flags) /* * Types @@ -73,39 +86,97 @@ typedef struct _LispOpaque LispOpaque; typedef struct _LispModule LispModule; typedef struct _LispProperty LispProperty; - -struct _LispStream { - FILE *fp; - char *st; - char *cp; - int tok; -}; - -/* Possible values to attach to a LispAtom include: - * a generic LispObject for global variable value - * a function definition - * a pointer to a builtin function definition - * the atom properties list, read with (get), set with (setf (get ...) ...) - * a setf expansion macro or function replacement name - * a structure definition +typedef struct _LispObjList LispObjList; +typedef struct _LispStringHash LispStringHash; +typedef struct _LispCharInfo LispCharInfo; + + +/* Normal function/macro arguments */ +typedef struct _LispNormalArgs { + int num_symbols; + LispObj **symbols; /* symbol names */ +} LispNormalArgs; + +/* &optional function/macro arguments */ +typedef struct _LispOptionalArgs { + int num_symbols; + LispObj **symbols; /* symbol names */ + LispObj **defaults; /* default values, when unspecifed */ + LispObj **sforms; /* T if variable specified, NIL otherwise */ +} LispOptionalArgs; + +/* &key function/macro arguments */ +typedef struct _LispKeyArgs { + int num_symbols; + LispObj **symbols; /* symbol names */ + LispObj **defaults; /* default values */ + LispObj **sforms; /* T if variable specified, NIL otherwise */ + LispObj **keys; /* key names, for special keywords */ +} LispKeyArgs; + +/* &aux function/macro arguments */ +typedef struct _LispAuxArgs { + int num_symbols; + LispObj **symbols; /* symbol names */ + LispObj **initials; /* initial values */ +} LispAuxArgs; + +/* characters in the field description have the format: + * '.' normals has a list of normal arguments + * 'o' optionals has a list of &optional arguments + * 'k' keys has a list of &key arguments + * 'r' rest is a valid pointer to a &rest symbol + * 'a' auxs has a list of &aux arguments */ +typedef struct _LispArgList { + LispNormalArgs normals; + LispOptionalArgs optionals; + LispKeyArgs keys; + LispObj *rest; + LispAuxArgs auxs; + int num_arguments; + char *description; +} LispArgList; + +typedef enum _LispDocType_t { + LispDocVariable, + LispDocFunction, + LispDocStructure, + LispDocType, + LispDocSetf +} LispDocType_t; + struct _LispProperty { - unsigned int object : 1; - unsigned int function : 1; - unsigned int builtin : 1; - unsigned int property : 1; - unsigned int defsetf : 1; - unsigned int defstruct : 1; + /* may be used by multiple packages */ + unsigned int refcount; + + /* package where the property was created */ + LispPackage *package; + + /* value of variable attached to symbol */ LispObj *value; + union { + /* function attached to symbol */ LispObj *function; + /* builtin function attached to symbol*/ LispBuiltin *builtin; - } fun; /* cannot have both, a builtin and user function attached, - * virtually, builtin and user function are the same */ + } fun; + /* function/macro argument list description */ + LispArgList *alist; + + /* symbol properties list */ LispObj *properties; + + /* setf method */ LispObj *setf; + /* setf argument list description */ + LispArgList *salist; + + /* structure information */ struct { LispObj *definition; +#define STRUCT_NAME -3 #define STRUCT_CHECK -2 #define STRUCT_CONSTRUCTOR -1 int function; /* if >= 0, it is a structure field index */ @@ -113,12 +184,58 @@ }; struct _LispAtom { - unsigned int mark : 1; /* gc protected */ - unsigned int dirty : 1; - unsigned int prot : 1; /* never released */ + /* hint: dynamically binded variable */ + unsigned int dyn : 1; + + /* Property has useful data in value field */ + unsigned int a_object : 1; + /* Property has useful data in fun.function field */ + unsigned int a_function : 1; + /* Property has useful data in fun.builtin field */ + unsigned int a_builtin : 1; + /* Property has useful data in fun.function field */ + unsigned int a_compiled : 1; + /* Property has useful data in properties field */ + unsigned int a_property : 1; + /* Property has useful data in setf field */ + unsigned int a_defsetf : 1; + /* Property has useful data in defstruct field */ + unsigned int a_defstruct : 1; + + /* Symbol is extern */ + unsigned int ext : 1; + + /* Symbol must be quoted with '|' to be allow reading back */ + unsigned int unreadable : 1; + + /* Symbol value may need special handling when changed */ + unsigned int watch : 1; + + /* Symbol value is constant, cannot be changed */ + unsigned int constant : 1; + char *string; + LispObj *object; /* backpointer to object ATOM */ + int offset; /* in the environment list */ + LispObj *package; /* package home of symbol */ + LispObj *function; /* symbol function */ + LispObj *name; /* symbol string */ LispProperty *property; struct _LispAtom *next; + + LispObj *documentation[5]; +}; + +struct _LispObjList { + LispObj **pairs; /* name0 ... nameN */ + int length; /* number of objects */ + int space; /* space allocated in field pairs */ +}; + +struct _LispPackage { + LispObjList glb; /* global symbols in package */ + LispObjList use; /* inherited packages */ + LispAtom *atoms[STRTBLSZ]; /* atoms in this package */ }; struct _LispOpaque { @@ -127,7 +244,15 @@ LispOpaque *next; }; +/* These strings are never released, they are used to avoid + * the need of strcmp() on two symbol names, just compare pointers */ +struct _LispStringHash { + char *string; + LispStringHash *next; +}; + typedef enum _LispBlockType { + LispBlockNone, /* no block */ LispBlockTag, /* may become "invisible" */ LispBlockCatch, /* can be used to jump across function calls */ LispBlockClosure, /* hides blocks of type LispBlockTag bellow it */ @@ -137,12 +262,15 @@ struct _LispBlock { LispBlockType type; - LispObj tag; + LispObj *tag; jmp_buf jmp; - int level; + int stack; + int protect; int block_level; +#ifdef DEBUGGER int debug_level; int debug_step; +#endif }; struct _LispModule { @@ -151,52 +279,111 @@ LispModuleData *data; }; +typedef struct _LispUngetInfo { + char buffer[16]; + int offset; +} LispUngetInfo; + struct _LispMac { - FILE *fp; - char *st; - char *cp; - int tok; - int level; - int princ; /* don't quote strings? */ - int justsize; /* just calculate size of output, - * needed to calculate formatted output */ - int newline; /* at a newline in the output */ - int column; /* column number in the output */ - int interactive; - int errexit; - LispAtom *strs[STRTBLSZ]; - LispOpaque *opqs[STRTBLSZ]; - int opaque; - sigjmp_buf jmp; + /* stack for builtin function arguments */ + struct { + LispObj **values; + int base; /* base of arguments to function */ + int length; + int space; + } stack; + + /* environment */ + struct { + LispObj **values; + Atom_id *names; + int lex; /* until where variables are visible */ + int head; /* top of environment */ + int length; /* number of used pairs */ + int space; /* number of objects in pairs */ + } env; + struct { - unsigned stream_level; - unsigned stream_size; - LispStream *stream; - } stream; + LispObj **values; + int count; + } returns; + struct { - unsigned block_level; - unsigned block_size; + LispObj **objects; + int length; + int space; + } protect; + + LispObj *package; /* package object */ + LispPackage *pack; /* pointer to lisp__data.package->data.package.package */ + + /* fast access to the KEYWORD package */ + LispObj *keyword; + LispPackage *key; + + /* the LISP package */ + LispObj *lisp; + + /* only used if the package was changed, but an error generated + * before returning to the toplevel */ + LispObj *savepackage; + LispPackage *savepack; + + struct { + int block_level; + int block_size; LispObj *block_ret; LispBlock **block; } block; + + sigjmp_buf jmp; + + struct { + unsigned int expandbits : 3; /* code doesn't look like reusing cells + * so try to have a larger number of + * free cells */ + unsigned int immutablebits : 1; /* need to reset immutable bits */ + unsigned int timebits : 1; /* update gctime counter */ + unsigned int count; + long gctime; + int average; /* of cells freed after gc calls */ + } gc; + + LispStringHash *strings[STRTBLSZ]; + LispOpaque *opqs[STRTBLSZ]; + int opaque; + + LispObj *standard_input, *input, *input_list; + LispObj *standard_output, *output, *output_list; + LispObj *error_stream; + LispUngetInfo **unget; + int iunget, nunget; + int eof; + + int interactive; + int errexit; + struct { - unsigned mem_level; - unsigned mem_size; + int index; + int level; + int space; void **mem; } mem; /* memory from Lisp*Alloc, to be release in error */ LispModule *module; + LispObj *modules; char *prompt; + LispObj *features; + LispObj *modlist; /* module list */ - LispObj *glblist; /* global variables */ - LispObj *envlist; /* alive variables */ - LispObj *lexlist; /* lexical instead of dynamic scope */ + LispObj *packlist; /* list of packages */ LispObj *codlist; /* current code */ - LispObj *frmlist; /* input data */ LispObj *runlist[3]; /* +, ++, and +++ */ LispObj *reslist[3]; /* *, **, and *** */ +#ifdef DEBUGGER LispObj *dbglist; /* debug information */ LispObj *brklist; /* breakpoints information */ +#endif LispObj *prolist; /* protect objects list */ #ifdef SIGNALRETURNSINT @@ -210,70 +397,140 @@ int destroyed; /* reached LispDestroy, used by unwind-protect */ int running; /* there is somewhere to siglongjmp */ + int ignore_errors; /* inside a ignore-errors block */ + LispObj *error_condition; /* actually, a string */ + int debugging; /* debugger enabled? */ - int debug_level; /* almost always the same as mac->level */ +#ifdef DEBUGGER + int debug_level; /* almost always the same as lisp__data.level */ int debug_step; /* control for stoping and printing output */ int debug_break; /* next breakpoint number */ LispDebugState debug; +#endif }; +struct _LispCharInfo { + char **names; +}; + + /* * Prototypes */ -LispObj *LispEnvRun(LispMac*, LispObj*, LispFunPtr, char*, int); -LispObj *LispGetVar(LispMac*, LispObj*); -LispObj *LispGetVarCons(LispMac*, LispObj*); /* used by debugger */ -LispObj *LispAddVar(LispMac*, LispObj*, LispObj*); -LispObj *LispSetVar(LispMac*, LispObj*, LispObj*); -void LispUnsetVar(LispMac*, LispObj*); +void LispUseArgList(LispArgList*); +void LispFreeArgList(LispArgList*); +LispArgList *LispCheckArguments(LispFunType, LispObj*, char*, int); +LispObj *LispListProtectedArguments(LispArgList*); + +LispObj *LispGetDoc(LispObj*); +LispObj *LispGetVar(LispObj*); +#ifdef DEBUGGER +void *LispGetVarAddr(LispObj*); /* used by debugger */ +#endif +LispObj *LispAddVar(LispObj*, LispObj*); +LispObj *LispSetVar(LispObj*, LispObj*); +void LispUnsetVar(LispObj*); + + /* only used at initialization time */ +LispObj *LispNewStandardStream(LispFile*, LispObj*, int); + + /* create a new package */ +LispObj *LispNewPackage(LispObj*, LispObj*); + /* add package to use-list of current, and imports all extern symbols */ +void LispUsePackage(LispObj*); + /* make symbol extern in the current package */ +void LispExportSymbol(LispObj*); + /* imports symbol to current package */ +void LispImportSymbol(LispObj*); + + /* always returns the same string */ +char *LispGetAtomString(char*, int); /* destructive fast reverse, note that don't receive a LispMac* argument */ LispObj *LispReverse(LispObj *list); -/* reads an expression from the selected stream */ -LispObj *LispRun(LispMac*); - -#if 0 -/* generated by gperf */ -extern struct _LispBuiltin *LispFindBuiltin(const char*, unsigned int); -#endif +char *LispIntToOpaqueType(int); /* (print) */ -void LispPrint(LispMac*, LispObj*, LispObj*, int); +void LispPrint(LispObj*, LispObj*, int); -LispBlock *LispBeginBlock(LispMac*, LispObj*, LispBlockType); -void LispEndBlock(LispMac*, LispBlock*); +LispBlock *LispBeginBlock(LispObj*, LispBlockType); +#define BLOCKJUMP(block) \ + lisp__data.stack.length = (block)->stack; \ + lisp__data.protect.length = (block)->protect; \ + longjmp((block)->jmp, 1) +void LispEndBlock(LispBlock*); /* if unwind-protect active, jump to cleanup code, else do nothing */ -void LispBlockUnwind(LispMac*); +void LispBlockUnwind(LispBlock*); -void LispUpdateResults(LispMac*, LispObj*, LispObj*); -void LispTopLevel(LispMac*); +void LispUpdateResults(LispObj*, LispObj*); +void LispTopLevel(void); -LispAtom *LispDoGetAtom(LispMac*, char *str, int, int); +#define STRHASH(string) LispDoHashString(string) +int LispDoHashString(char*); +LispAtom *LispDoGetAtom(char *str, int); /* get value from atom's property list */ -LispObj *LispGetAtomProperty(LispMac*, LispAtom*, LispObj*); +LispObj *LispGetAtomProperty(LispAtom*, LispObj*); /* put value in atom's property list */ -LispObj *LispPutAtomProperty(LispMac*, LispAtom*, LispObj*, LispObj*); - - /* create or change object property */ -void LispSetAtomObjectProperty(LispMac*, LispAtom*, LispObj*); - /* remove object property */ -void LispRemAtomObjectProperty(LispMac*, LispAtom*); +LispObj *LispPutAtomProperty(LispAtom*, LispObj*, LispObj*); + /* remove value from atom's property list */ +LispObj *LispRemAtomProperty(LispAtom*, LispObj*); + /* replace atom's property list */ +LispObj *LispReplaceAtomPropertyList(LispAtom*, LispObj*); + + /* returns function associated with symbol */ +LispObj *LispSymbolFunction(LispObj*); + /* returns symbol string name */ +LispObj *LispSymbolName(LispObj*); + + /* define byte compiled function, or replace definition */ +void LispSetAtomCompiledProperty(LispAtom*, LispObj*); + /* remove byte compiled function property */ +void LispRemAtomCompiledProperty(LispAtom*); /* define function, or replace function definition */ -void LispSetAtomFunctionProperty(LispMac*, LispAtom*, LispObj*); +void LispSetAtomFunctionProperty(LispAtom*, LispObj*, LispArgList*); /* remove function property */ -void LispRemAtomFunctionProperty(LispMac*, LispAtom*); +void LispRemAtomFunctionProperty(LispAtom*); /* define builtin, or replace builtin definition */ -void LispSetAtomBuiltinProperty(LispMac*, LispAtom*, LispBuiltin*); +void LispSetAtomBuiltinProperty(LispAtom*, LispBuiltin*, LispArgList*); /* remove builtin property */ -void LispRemAtomBuiltinProperty(LispMac*, LispAtom*); +void LispRemAtomBuiltinProperty(LispAtom*); /* define setf macro, or replace current definition */ -void LispSetAtomSetfProperty(LispMac*, LispAtom*, LispObj*); +void LispSetAtomSetfProperty(LispAtom*, LispObj*, LispArgList*); /* remove setf macro */ -void LispRemAtomSetfProperty(LispMac*, LispAtom*); +void LispRemAtomSetfProperty(LispAtom*); /* create or change structure property */ -void LispSetAtomStructProperty(LispMac*, LispAtom*, LispObj*, int); +void LispSetAtomStructProperty(LispAtom*, LispObj*, int); /* remove structure property */ -void LispRemAtomStructProperty(LispMac*, LispAtom*); +void LispRemAtomStructProperty(LispAtom*); + +void LispProclaimSpecial(LispObj*, LispObj*, LispObj*); +void LispDefconstant(LispObj*, LispObj*, LispObj*); + +void LispAddDocumentation(LispObj*, LispObj*, LispDocType_t); +void LispRemDocumentation(LispObj*, LispDocType_t); +LispObj *LispGetDocumentation(LispObj*, LispDocType_t); + +/* increases storage for functions returning multiple values */ +void LispMoreReturns(void); + +/* increases storage for temporarily protected data */ +void LispMoreProtects(void); + +/* Initialization */ +extern int LispArgList_t; +extern LispCharInfo LispChars[256]; + +/* This function will return if the interpreter cannot be stopped */ +extern void LispSignal(int); + +void LispDisableInterrupts(void); +void LispEnableInterrupts(void); +#define DISABLE_INTERRUPTS() LispDisableInterrupts() +#define ENABLE_INTERRUPTS() LispEnableInterrupts() + +/* Value returned by LispBegin, used everywhere in the code. + * Only one interpreter instance allowed. */ +extern LispMac lisp__data; #endif /* Lisp_private_h */ Index: xc/programs/xedit/lisp/read.c diff -u /dev/null xc/programs/xedit/lisp/read.c:1.34 --- /dev/null Thu Feb 27 12:34:58 2003 +++ xc/programs/xedit/lisp/read.c Sun Jan 12 22:57:58 2003 @@ -0,0 +1,2058 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/read.c,v 1.34 2003/01/13 03:57:58 paulo Exp $ */ + +#include <errno.h> +#include "read.h" +#include "package.h" +#include "write.h" +#include <fcntl.h> +#include <stdarg.h> + +/* This should be visible only in read.c, but if an error is generated, + * the current code in write.c will print it as #<ERROR> */ +#define LABEL_BIT_COUNT 8 +#define LABEL_BIT_MASK 0xff +#define MAX_LABEL_VALUE ((1L << (sizeof(long) * 8 - 9)) - 1) +#define READLABEL(label) \ + (LispObj*)(((label) << LABEL_BIT_COUNT) | READLABEL_MASK) +#define READLABELP(object) \ + (((unsigned long)(object) & LABEL_BIT_MASK) == READLABEL_MASK) +#define READLABEL_VALUE(object) \ + ((long)(object) >> LABEL_BIT_COUNT) + +#define READ_ENTER() \ + LispObj *read__stream = SINPUT; \ + int read__line = LispGetLine(read__stream) +#define READ_ERROR0(format) \ + LispReadError(read__stream, read__line, format) +#define READ_ERROR1(format, arg1) \ + LispReadError(read__stream, read__line, format, arg1) +#define READ_ERROR2(format, arg1, arg2) \ + LispReadError(read__stream, read__line, format, arg1, arg2) + +#define READ_ERROR_EOF() READ_ERROR0("unexpected end of input") +#define READ_ERROR_FIXNUM() READ_ERROR0("number is not a fixnum") +#define READ_ERROR_INVARG() READ_ERROR0("invalid argument") + +/* + * Types + */ +typedef struct _object_info { + long label; /* the read label of this object */ + LispObj *object; /* the resulting object */ + long num_circles; /* references to object before it was completely read */ +} object_info; + +typedef struct _read_info { + int level; /* level of open parentheses */ + + int nodot; /* flag set when reading a "special" list */ + + int discard; /* flag used when reading an unavailable feature */ + + long circle_count; /* if non zero, must resolve some labels */ + + /* information for #<number>= and #<number># */ + object_info *objects; + long num_objects; + + /* could use only the objects field as all circular data is known, + * but check every object so that circular/shared references generated + * by evaluations would not cause an infinite loop at read time */ + LispObj **circles; + long num_circles; +} read_info; + +/* + * Protypes + */ +static LispObj *LispReadChar(LispBuiltin*, int); + +static int LispGetLine(LispObj*); +#ifdef __GNUC__ +#define PRINTF_FORMAT __attribute__ ((format (printf, 3, 4))) +#else +#define PRINTF_FORMAT /**/ +#endif +static void LispReadError(LispObj*, int, char*, ...); +#undef PRINTF_FORMAT +static void LispReadFixCircle(LispObj*, read_info*); +static LispObj *LispReadLabelCircle(LispObj*, read_info*); +static int LispReadCheckCircle(LispObj*, read_info*); +static LispObj *LispDoRead(read_info*); +static int LispSkipWhiteSpace(void); +static LispObj *LispReadList(read_info*); +static LispObj *LispReadQuote(read_info*); +static LispObj *LispReadBackquote(read_info*); +static LispObj *LispReadCommaquote(read_info*); +static LispObj *LispReadObject(int, read_info*); +static LispObj *LispParseAtom(char*, char*, int, int, LispObj*, int); +static LispObj *LispParseNumber(char*, int, LispObj*, int); +static int StringInRadix(char*, int, int); +static int AtomSeparator(int, int, int); +static LispObj *LispReadVector(read_info*); +static LispObj *LispReadMacro(read_info*); +static LispObj *LispReadFunction(read_info*); +static LispObj *LispReadRational(int, read_info*); +static LispObj *LispReadCharacter(read_info*); +static void LispSkipComment(void); +static LispObj *LispReadEval(read_info*); +static LispObj *LispReadComplex(read_info*); +static LispObj *LispReadPathname(read_info*); +static LispObj *LispReadStruct(read_info*); +static LispObj *LispReadMacroArg(read_info*); +static LispObj *LispReadArray(long, read_info*); +static LispObj *LispReadFeature(int, read_info*); +static LispObj *LispEvalFeature(LispObj*); + +/* + * Initialization + */ +static char *Char_Nul[] = {"Null", "Nul", NULL}; +static char *Char_Soh[] = {"Soh", NULL}; +static char *Char_Stx[] = {"Stx", NULL}; +static char *Char_Etx[] = {"Etx", NULL}; +static char *Char_Eot[] = {"Eot", NULL}; +static char *Char_Enq[] = {"Enq", NULL}; +static char *Char_Ack[] = {"Ack", NULL}; +static char *Char_Bel[] = {"Bell", "Bel", NULL}; +static char *Char_Bs[] = {"Backspace", "Bs", NULL}; +static char *Char_Tab[] = {"Tab", NULL}; +static char *Char_Nl[] = {"Newline", "Nl", "Lf", "Linefeed", NULL}; +static char *Char_Vt[] = {"Vt", NULL}; +static char *Char_Np[] = {"Page", "Np", NULL}; +static char *Char_Cr[] = {"Return", "Cr", NULL}; +static char *Char_Ff[] = {"So", "Ff", NULL}; +static char *Char_Si[] = {"Si", NULL}; +static char *Char_Dle[] = {"Dle", NULL}; +static char *Char_Dc1[] = {"Dc1", NULL}; +static char *Char_Dc2[] = {"Dc2", NULL}; +static char *Char_Dc3[] = {"Dc3", NULL}; +static char *Char_Dc4[] = {"Dc4", NULL}; +static char *Char_Nak[] = {"Nak", NULL}; +static char *Char_Syn[] = {"Syn", NULL}; +static char *Char_Etb[] = {"Etb", NULL}; +static char *Char_Can[] = {"Can", NULL}; +static char *Char_Em[] = {"Em", NULL}; +static char *Char_Sub[] = {"Sub", NULL}; +static char *Char_Esc[] = {"Escape", "Esc", NULL}; +static char *Char_Fs[] = {"Fs", NULL}; +static char *Char_Gs[] = {"Gs", NULL}; +static char *Char_Rs[] = {"Rs", NULL}; +static char *Char_Us[] = {"Us", NULL}; +static char *Char_Sp[] = {"Space", "Sp", NULL}; +static char *Char_Del[] = {"Rubout", "Del", "Delete", NULL}; + +LispCharInfo LispChars[256] = { + {Char_Nul}, + {Char_Soh}, + {Char_Stx}, + {Char_Etx}, + {Char_Eot}, + {Char_Enq}, + {Char_Ack}, + {Char_Bel}, + {Char_Bs}, + {Char_Tab}, + {Char_Nl}, + {Char_Vt}, + {Char_Np}, + {Char_Cr}, + {Char_Ff}, + {Char_Si}, + {Char_Dle}, + {Char_Dc1}, + {Char_Dc2}, + {Char_Dc3}, + {Char_Dc4}, + {Char_Nak}, + {Char_Syn}, + {Char_Etb}, + {Char_Can}, + {Char_Em}, + {Char_Sub}, + {Char_Esc}, + {Char_Fs}, + {Char_Gs}, + {Char_Rs}, + {Char_Us}, + {Char_Sp}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {Char_Del}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} + +}; + +Atom_id Sand, Sor, Snot; + + +/* + * Implementation + */ +LispObj * +Lisp_Read(LispBuiltin *builtin) +/* + read &optional input-stream eof-error-p eof-value recursive-p + */ +{ + LispObj *result; + + LispObj *input_stream, *eof_error_p, *eof_value, *recursive_p; + + recursive_p = ARGUMENT(3); + eof_value = ARGUMENT(2); + eof_error_p = ARGUMENT(1); + input_stream = ARGUMENT(0); + + if (input_stream == UNSPEC) + input_stream = NIL; + else if (input_stream != NIL) { + CHECK_STREAM(input_stream); + else if (!input_stream->data.stream.readable) + LispDestroy("%s: stream %s is not readable", + STRFUN(builtin), STROBJ(input_stream)); + LispPushInput(input_stream); + } + else if (CONSP(lisp__data.input_list)) { + input_stream = STANDARD_INPUT; + LispPushInput(input_stream); + } + + if (eof_value == UNSPEC) + eof_value = NIL; + + result = LispRead(); + if (input_stream != NIL) + LispPopInput(input_stream); + + if (result == NULL) { + if (eof_error_p != NIL) + LispDestroy("%s: EOF reading stream %s", + STRFUN(builtin), STROBJ(input_stream)); + else + result = eof_value; + } + + return (result); +} + +static LispObj * +LispReadChar(LispBuiltin *builtin, int nohang) +{ + int character; + LispObj *result; + + LispObj *input_stream, *eof_error_p, *eof_value, *recursive_p; + + recursive_p = ARGUMENT(3); + eof_value = ARGUMENT(2); + eof_error_p = ARGUMENT(1); + input_stream = ARGUMENT(0); + + if (input_stream == UNSPEC) + input_stream = NIL; + else if (input_stream != NIL) { + CHECK_STREAM(input_stream); + } + else + input_stream = lisp__data.input; + + if (eof_value == UNSPEC) + eof_value = NIL; + + result = NIL; + character = EOF; + + if (input_stream->data.stream.readable) { + LispFile *file = NULL; + + switch (input_stream->data.stream.type) { + case LispStreamStandard: + case LispStreamFile: + file = FSTREAMP(input_stream); + break; + case LispStreamPipe: + file = IPSTREAMP(input_stream); + break; + case LispStreamString: + character = LispSgetc(SSTREAMP(input_stream)); + break; + default: + break; + } + if (file != NULL) { + if (file->available || file->offset < file->length) + character = LispFgetc(file); + else { + if (nohang && !file->nonblock) { + if (fcntl(file->descriptor, F_SETFL, O_NONBLOCK) < 0) + LispDestroy("%s: fcntl(%d): %s", + STRFUN(builtin), file->descriptor, + strerror(errno)); + file->nonblock = 1; + } + else if (!nohang && file->nonblock) { + if (fcntl(file->descriptor, F_SETFL, 0) < 0) + LispDestroy("%s: fcntl(%d): %s", + STRFUN(builtin), file->descriptor, + strerror(errno)); + file->nonblock = 0; + } + if (nohang) { + unsigned char ch; + + if (read(file->descriptor, &ch, 1) == 1) + character = ch; + else if (errno == EAGAIN) + return (NIL); /* XXX no character available */ + else + character = EOF; + } + else + character = LispFgetc(file); + } + } + } + else + LispDestroy("%s: stream %s is unreadable", + STRFUN(builtin), STROBJ(input_stream)); + + if (character == EOF) { + if (eof_error_p != NIL) + LispDestroy("%s: EOF reading stream %s", + STRFUN(builtin), STROBJ(input_stream)); + + return (eof_value); + } + + return (SCHAR(character)); +} + +LispObj * +Lisp_ReadChar(LispBuiltin *builtin) +/* + read-char &optional input-stream eof-error-p eof-value recursive-p + */ +{ + return (LispReadChar(builtin, 0)); +} + +LispObj * +Lisp_ReadCharNoHang(LispBuiltin *builtin) +/* + read-char-no-hang &optional input-stream eof-error-p eof-value recursive-p + */ +{ + return (LispReadChar(builtin, 1)); +} + +LispObj * +Lisp_ReadLine(LispBuiltin *builtin) +/* + read-line &optional input-stream eof-error-p eof-value recursive-p + */ +{ + char *string; + int ch, length; + LispObj *result, *status = NIL; + + LispObj *input_stream, *eof_error_p, *eof_value, *recursive_p; + + recursive_p = ARGUMENT(3); + eof_value = ARGUMENT(2); + eof_error_p = ARGUMENT(1); + input_stream = ARGUMENT(0); + + if (input_stream == UNSPEC) + input_stream = NIL; + else if (input_stream == NIL) + input_stream = STANDARD_INPUT; + else { + CHECK_STREAM(input_stream); + } + + if (eof_value == UNSPEC) + eof_value = NIL; + + result = NIL; + string = NULL; + length = 0; + + if (!input_stream->data.stream.readable) + LispDestroy("%s: stream %s is unreadable", + STRFUN(builtin), STROBJ(input_stream)); + if (input_stream->data.stream.type == LispStreamString) { + char *start, *end, *ptr; + + if (SSTREAMP(input_stream)->input >= + SSTREAMP(input_stream)->length) { + if (eof_error_p != NIL) + LispDestroy("%s: EOS found reading %s", + STRFUN(builtin), STROBJ(input_stream)); + + status = T; + result = eof_value; + goto read_line_done; + } + + start = SSTREAMP(input_stream)->string + + SSTREAMP(input_stream)->input; + end = SSTREAMP(input_stream)->string + + SSTREAMP(input_stream)->length; + /* Search for a newline */ + for (ptr = start; *ptr != '\n' && ptr < end; ptr++) + ; + if (ptr == end) + status = T; + else if (!SSTREAMP(input_stream)->binary) + ++SSTREAMP(input_stream)->line; + length = ptr - start; + string = LispMalloc(length + 1); + memcpy(string, start, length); + string[length] = '\0'; + result = LSTRING2(string, length); + /* macro LSTRING2 does not make a copy of it's arguments, and + * calls LispMused on it. */ + SSTREAMP(input_stream)->input += length + (status == NIL); + } + else /*if (input_stream->data.stream.type == LispStreamFile || + input_stream->data.stream.type == LispStreamStandard || + input_stream->data.stream.type == LispStreamPipe)*/ { + LispFile *file; + + if (input_stream->data.stream.type == LispStreamPipe) + file = IPSTREAMP(input_stream); + else + file = FSTREAMP(input_stream); + + if (file->nonblock) { + if (fcntl(file->descriptor, F_SETFL, 0) < 0) + LispDestroy("%s: fcntl: %s", + STRFUN(builtin), strerror(errno)); + file->nonblock = 0; + } + + while (1) { + ch = LispFgetc(file); + if (ch == EOF) { + if (length) + break; + if (eof_error_p != NIL) + LispDestroy("%s: EOF found reading %s", + STRFUN(builtin), STROBJ(input_stream)); + if (string) + LispFree(string); + + status = T; + result = eof_value; + goto read_line_done; + } + else if (ch == '\n') + break; + else if ((length % 64) == 0) + string = LispRealloc(string, length + 64); + string[length++] = ch; + } + if (string) { + if ((length % 64) == 0) + string = LispRealloc(string, length + 1); + string[length] = '\0'; + result = LSTRING2(string, length); + } + else + result = STRING(""); + } + +read_line_done: + RETURN(0) = status; + RETURN_COUNT = 1; + + return (result); +} + +LispObj * +LispRead(void) +{ + READ_ENTER(); + read_info info; + LispObj *result, *code = COD; + + info.level = info.nodot = info.discard = 0; + info.circle_count = 0; + info.objects = NULL; + info.num_objects = 0; + + result = LispDoRead(&info); + + /* fix circular/shared lists, note that this is done when returning to + * the toplevel, so, if some circular/shared reference was evaluated, + * it should have generated an expected error */ + if (info.num_objects) { + if (info.circle_count) { + info.circles = NULL; + info.num_circles = 0; + LispReadFixCircle(result, &info); + if (info.num_circles) + LispFree(info.circles); + } + LispFree(info.objects); + } + + if (result == EOLIST) + READ_ERROR0("object cannot start with #\\)"); + else if (result == DOT) + READ_ERROR0("dot allowed only on lists"); + + if (result != NULL && POINTERP(result)) { + if (code == NIL) + COD = result; + else + COD = CONS(COD, result); + } + + return (result); +} + +static int +LispGetLine(LispObj *stream) +{ + int line = -1; + + if (STREAMP(stream)) { + switch (stream->data.stream.type) { + case LispStreamStandard: + case LispStreamFile: + if (!FSTREAMP(stream)->binary) + line = FSTREAMP(stream)->line; + break; + case LispStreamPipe: + if (!IPSTREAMP(stream)->binary) + line = IPSTREAMP(stream)->line; + break; + case LispStreamString: + if (!SSTREAMP(stream)->binary) + line = SSTREAMP(stream)->line; + break; + default: + break; + } + } + else if (stream == NIL && !Stdin->binary) + line = Stdin->line; + + return (line); +} + +static void +LispReadError(LispObj *stream, int line, char *fmt, ...) +{ + char string[128], *buffer_string; + LispObj *buffer = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); + int length; + va_list ap; + + va_start(ap, fmt); + vsnprintf(string, sizeof(string), fmt, ap); + va_end(ap); + + LispFwrite(Stderr, "*** Reading ", 12); + LispWriteObject(buffer, stream); + buffer_string = LispGetSstring(SSTREAMP(buffer), &length); + LispFwrite(Stderr, buffer_string, length); + LispFwrite(Stderr, " at line ", 9); + if (line < 0) + LispFwrite(Stderr, "?\n", 2); + else { + char str[32]; + + sprintf(str, "%d\n", line); + LispFputs(Stderr, str); + } + + LispDestroy("READ: %s", string); +} + +static void +LispReadFixCircle(LispObj *object, read_info *info) +{ + LispObj *cons; + +fix_again: + switch (OBJECT_TYPE(object)) { + case LispCons_t: + for (cons = object; + CONSP(object); + cons = object, object = CDR(object)) { + if (READLABELP(CAR(object))) + CAR(object) = LispReadLabelCircle(CAR(object), info); + else if (LispReadCheckCircle(object, info)) + return; + else + LispReadFixCircle(CAR(object), info); + } + if (READLABELP(object)) + CDR(cons) = LispReadLabelCircle(object, info); + else + goto fix_again; + break; + case LispArray_t: + if (READLABELP(object->data.array.list)) + object->data.array.list = + LispReadLabelCircle(object->data.array.list, info); + else if (!LispReadCheckCircle(object, info)) { + object = object->data.array.list; + goto fix_again; + } + break; + case LispStruct_t: + if (READLABELP(object->data.struc.fields)) + object->data.struc.fields = + LispReadLabelCircle(object->data.struc.fields, info); + else if (!LispReadCheckCircle(object, info)) { + object = object->data.struc.fields; + goto fix_again; + } + break; + case LispQuote_t: + case LispBackquote_t: + case LispFunctionQuote_t: + if (READLABELP(object->data.quote)) + object->data.quote = + LispReadLabelCircle(object->data.quote, info); + else { + object = object->data.quote; + goto fix_again; + } + break; + case LispComma_t: + if (READLABELP(object->data.comma.eval)) + object->data.comma.eval = + LispReadLabelCircle(object->data.comma.eval, info); + else { + object = object->data.comma.eval; + goto fix_again; + } + break; + case LispLambda_t: + if (READLABELP(object->data.lambda.code)) + object->data.lambda.code = + LispReadLabelCircle(object->data.lambda.code, info); + else if (!LispReadCheckCircle(object, info)) { + object = object->data.lambda.code; + goto fix_again; + } + break; + default: + break; + } +} + +static LispObj * +LispReadLabelCircle(LispObj *label, read_info *info) +{ + long i, value = READLABEL_VALUE(label); + + for (i = 0; i < info->num_objects; i++) + if (info->objects[i].label == value) + return (info->objects[i].object); + + LispDestroy("READ: internal error"); + /*NOTREACHED*/ + return (label); +} + +static int +LispReadCheckCircle(LispObj *object, read_info *info) +{ + long i; + + for (i = 0; i < info->num_circles; i++) + if (info->circles[i] == object) + return (1); + + if ((info->num_circles % 16) == 0) + info->circles = LispRealloc(info->circles, sizeof(LispObj*) * + (info->num_circles + 16)); + info->circles[info->num_circles++] = object; + + return (0); +} + +static LispObj * +LispDoRead(read_info *info) +{ + LispObj *object; + int ch = LispSkipWhiteSpace(); + + switch (ch) { + case '(': + object = LispReadList(info); + break; + case ')': + for (ch = LispGet(); ch != EOF && ch != '\n'; ch = LispGet()) { + if (!isspace(ch)) { + LispUnget(ch); + break; + } + } + return (EOLIST); + case EOF: + return (NULL); + case '\'': + object = LispReadQuote(info); + break; + case '`': + object = LispReadBackquote(info); + break; + case ',': + object = LispReadCommaquote(info); + break; + case '#': + object = LispReadMacro(info); + break; + default: + LispUnget(ch); + object = LispReadObject(0, info); + break; + } + + return (object); +} + +static LispObj * +LispReadMacro(read_info *info) +{ + READ_ENTER(); + LispObj *result = NULL; + int ch = LispGet(); + + switch (ch) { + case '(': + result = LispReadVector(info); + break; + case '\'': + result = LispReadFunction(info); + break; + case 'b': + case 'B': + result = LispReadRational(2, info); + break; + case 'o': + case 'O': + result = LispReadRational(8, info); + break; + case 'x': + case 'X': + result = LispReadRational(16, info); + break; + case '\\': + result = LispReadCharacter(info); + break; + case '|': + LispSkipComment(); + result = LispDoRead(info); + break; + case '.': /* eval when compiling */ + case ',': /* eval when loading */ + result = LispReadEval(info); + break; + case 'c': + case 'C': + result = LispReadComplex(info); + break; + case 'p': + case 'P': + result = LispReadPathname(info); + break; + case 's': + case 'S': + result = LispReadStruct(info); + break; + case '+': + result = LispReadFeature(1, info); + break; + case '-': + result = LispReadFeature(0, info); + break; + case ':': + /* Uninterned symbol */ + result = LispReadObject(1, info); + break; + default: + if (isdigit(ch)) { + LispUnget(ch); + result = LispReadMacroArg(info); + } + else if (!info->discard) + READ_ERROR1("undefined dispatch macro character #%c", ch); + break; + } + + return (result); +} + +static LispObj * +LispReadMacroArg(read_info *info) +{ + READ_ENTER(); + LispObj *result = NIL; + long i, integer; + int ch; + + /* skip leading zeros */ + while (ch = LispGet(), ch != EOF && isdigit(ch) && ch == '0') + ; + + if (ch == EOF) + READ_ERROR_EOF(); + + /* if ch is not a number the argument was zero */ + if (isdigit(ch)) { + char stk[32], *str; + int len = 1; + + stk[0] = ch; + for (;;) { + ch = LispGet(); + if (!isdigit(ch)) + break; + if (len + 1 >= sizeof(stk)) + READ_ERROR_FIXNUM(); + stk[len++] = ch; + } + stk[len] = '\0'; + errno = 0; + integer = strtol(stk, &str, 10); + /* number is positive because sign is not processed here */ + if (*str || errno == ERANGE || integer > MOST_POSITIVE_FIXNUM) + READ_ERROR_FIXNUM(); + } + else + integer = 0; + + switch (ch) { + case 'a': + case 'A': + if (integer == 1) { + /* LispReadArray and LispReadList expect + * the '(' being already read */ + if ((ch = LispSkipWhiteSpace()) != '(') { + if (info->discard) + return (ch == EOF ? NULL : NIL); + READ_ERROR0("bad array specification"); + } + result = LispReadVector(info); + } + else + result = LispReadArray(integer, info); + break; + case 'r': + case 'R': + result = LispReadRational(integer, info); + break; + case '=': + if (integer > MAX_LABEL_VALUE) + READ_ERROR_FIXNUM(); + if (!info->discard) { + long num_objects = info->num_objects; + + /* check for duplicated label */ + for (i = 0; i < info->num_objects; i++) { + if (info->objects[i].label == integer) + READ_ERROR1("label #%ld# defined more than once", + integer); + } + info->objects = LispRealloc(info->objects, + sizeof(object_info) * + (num_objects + 1)); + /* if this label is referenced it is a shared/circular object */ + info->objects[num_objects].label = integer; + info->objects[num_objects].object = NULL; + info->objects[num_objects].num_circles = 0; + ++info->num_objects; + result = LispDoRead(info); + if (READLABELP(result) && READLABEL_VALUE(result) == integer) + READ_ERROR2("incorrect syntax #%ld= #%ld#", + integer, integer); + /* any reference to it now is not shared/circular */ + info->objects[num_objects].object = result; + } + else + result = LispDoRead(info); + break; + case '#': + if (integer > MAX_LABEL_VALUE) + READ_ERROR_FIXNUM(); + if (!info->discard) { + /* search object */ + for (i = 0; i < info->num_objects; i++) { + if (info->objects[i].label == integer) { + result = info->objects[i].object; + if (result == NULL) { + ++info->objects[i].num_circles; + ++info->circle_count; + result = READLABEL(integer); + } + break; + } + } + if (i == info->num_objects) + READ_ERROR1("undefined label #%ld#", integer); + } + break; + default: + if (!info->discard) + READ_ERROR1("undefined dispatch macro character #%c", ch); + break; + } + + return (result); +} + +static int +LispSkipWhiteSpace(void) +{ + int ch; + + for (;;) { + while (ch = LispGet(), isspace(ch) && ch != EOF) + ; + if (ch == ';') { + while (ch = LispGet(), ch != '\n' && ch != EOF) + ; + if (ch == EOF) + return (EOF); + } + else + break; + } + + return (ch); +} + +/* any data in the format '(' FORM ')' is read here */ +static LispObj * +LispReadList(read_info *info) +{ + READ_ENTER(); + GC_ENTER(); + LispObj *result, *cons, *object; + int dot = 0; + + ++info->level; + /* check for () */ + object = LispDoRead(info); + if (object == EOLIST) { + --info->level; + + return (NIL); + } + + if (object == DOT) + READ_ERROR0("illegal start of dotted list"); + + result = cons = CONS(object, NIL); + + /* make sure GC will not release data being read */ + GC_PROTECT(result); + + while ((object = LispDoRead(info)) != EOLIST) { + if (object == NULL) + READ_ERROR_EOF(); + if (object == DOT) { + if (info->nodot == info->level) + READ_ERROR0("dotted list not allowed"); + /* this is a dotted list */ + if (dot) + READ_ERROR0("more than one . in list"); + dot = 1; + } + else { + if (dot) { + /* only one object after a dot */ + if (++dot > 2) + READ_ERROR0("more than one object after . in list"); + RPLACD(cons, object); + } + else { + RPLACD(cons, CONS(object, NIL)); + cons = CDR(cons); + } + } + } + + /* this will happen if last list element was a dot */ + if (dot == 1) + READ_ERROR0("illegal end of dotted list"); + + --info->level; + GC_LEAVE(); + + return (result); +} + +static LispObj * +LispReadQuote(read_info *info) +{ + READ_ENTER(); + LispObj *quote = LispDoRead(info), *result; + + if (INVALIDP(quote)) + READ_ERROR_INVARG(); + + result = QUOTE(quote); + + return (result); +} + +static LispObj * +LispReadBackquote(read_info *info) +{ + READ_ENTER(); + LispObj *backquote = LispDoRead(info), *result; + + if (INVALIDP(backquote)) + READ_ERROR_INVARG(); + + result = BACKQUOTE(backquote); + + return (result); +} + +static LispObj * +LispReadCommaquote(read_info *info) +{ + READ_ENTER(); + LispObj *comma, *result; + int atlist = LispGet(); + + if (atlist == EOF) + READ_ERROR_EOF(); + else if (atlist != '@' && atlist != '.') + LispUnget(atlist); + + comma = LispDoRead(info); + if (comma == DOT) { + atlist = '@'; + comma = LispDoRead(info); + } + if (INVALIDP(comma)) + READ_ERROR_INVARG(); + + result = COMMA(comma, atlist == '@' || atlist == '.'); + + return (result); +} + +/* + * Read anything that is not readily identifiable by it's first character + * and also put the code for reading atoms, numbers and strings together. + */ +static LispObj * +LispReadObject(int unintern, read_info *info) +{ + READ_ENTER(); + LispObj *object; + char stk[128], *string, *package, *symbol; + int ch, length, backslash, size, quote, unreadable, collon; + + package = symbol = string = stk; + size = sizeof(stk); + backslash = quote = unreadable = collon = 0; + length = 0; + + ch = LispGet(); + if (unintern && (ch == ':' || ch == '"')) + READ_ERROR0("syntax error after #:"); + else if (ch == '"' || ch == '|') + quote = ch; + else if (ch == '\\') { + unreadable = backslash = 1; + string[length++] = ch; + } + else if (ch == ':') { + collon = 1; + string[length++] = ch; + symbol = string + 1; + } + else if (ch) { + if (islower(ch)) + ch = toupper(ch); + string[length++] = ch; + } + else + unreadable = 1; + + /* read remaining data */ + for (; ch;) { + ch = LispGet(); + + if (ch == EOF) { + if (quote) { + /* if quote, file ended with an open quoted object */ + if (string != stk) + LispFree(string); + return (NULL); + } + break; + } + else if (ch == '\0') + break; + + if (ch == '\\') { + backslash = !backslash; + if (quote == '"') { + /* only remove backslashs from strings */ + if (backslash) + continue; + } + else + unreadable = 1; + } + else if (backslash) + backslash = 0; + else if (ch == quote) + break; + else if (!quote && !backslash) { + if (islower(ch)) + ch = toupper(ch); + else if (isspace(ch)) + break; + else if (AtomSeparator(ch, 0, 0)) { + LispUnget(ch); + break; + } + else if (ch == ':') { + if (collon == 0 || + (collon == (1 - unintern) && symbol == string + length)) { + ++collon; + symbol = string + length + 1; + } + else + READ_ERROR0("too many collons"); + } + } + + if (length + 2 >= size) { + if (string == stk) { + size = 1024; + string = LispMalloc(size); + strcpy(string, stk); + } + else { + size += 1024; + string = LispRealloc(string, size); + } + symbol = string + (symbol - package); + package = string; + } + string[length++] = ch; + } + + if (info->discard) { + if (string != stk) + LispFree(string); + + return (ch == EOF ? NULL : NIL); + } + + string[length] = '\0'; + + if (unintern) { + if (length == 0) + READ_ERROR0("syntax error after #:"); + object = UNINTERNED_ATOM(string); + } + + else if (quote == '"') + object = LSTRING(string, length); + + else if (quote == '|' || (unreadable && !collon)) { + /* Set unreadable field, this atom needs quoting to be read back */ + object = ATOM(string); + object->data.atom->unreadable = 1; + } + + else if (collon) { + /* Package specified in object name */ + symbol[-1] = '\0'; + if (collon > 1) + symbol[-2] = '\0'; + object = LispParseAtom(package, symbol, + collon == 2, unreadable, + read__stream, read__line); + } + + /* Check some common symbols */ + else if (length == 1 && string[0] == 'T') + /* The T */ + object = T; + + else if (length == 1 && string[0] == '.') + /* The dot */ + object = DOT; + + else if (length == 3 && + string[0] == 'N' && string[1] == 'I' && string[2] == 'L') + /* The NIL */ + object = NIL; + + else if (isdigit(string[0]) || string[0] == '.' || + ((string[0] == '-' || string[0] == '+') && string[1])) + /* Looks like a number */ + object = LispParseNumber(string, 10, read__stream, read__line); + + else + /* A normal atom */ + object = ATOM(string); + + if (string != stk) + LispFree(string); + + return (object); +} + +static LispObj * +LispParseAtom(char *package, char *symbol, int intern, int unreadable, + LispObj *read__stream, int read__line) +{ + LispObj *object = NULL, *thepackage = NULL; + LispPackage *pack = NULL; + + if (!unreadable) { + /* Until NIL and T be treated as normal symbols */ + if (symbol[0] == 'N' && symbol[1] == 'I' && + symbol[2] == 'L' && symbol[3] == '\0') + return (NIL); + if (symbol[0] == 'T' && symbol[1] == '\0') + return (T); + unreadable = !LispCheckAtomString(symbol); + } + + /* If package is empty, it is a keyword */ + if (package[0] == '\0') { + thepackage = lisp__data.keyword; + pack = lisp__data.key; + } + + else { + /* Else, search it in the package list */ + thepackage = LispFindPackageFromString(package); + + if (thepackage == NIL) + READ_ERROR1("the package %s is not available", package); + + pack = thepackage->data.package.package; + } + + if (pack == lisp__data.pack && intern) { + /* Redundant package specification, since requesting a + * intern symbol, create it if does not exist */ + + object = ATOM(symbol); + if (unreadable) + object->data.atom->unreadable = 1; + } + + else if (intern || pack == lisp__data.key) { + /* Symbol is created, or just fetched from the specified package */ + + LispPackage *savepack; + LispObj *savepackage = PACKAGE; + + /* Remember curent package */ + savepack = lisp__data.pack; + + /* Temporarily set another package */ + lisp__data.pack = pack; + PACKAGE = thepackage; + + /* Get the object pointer */ + if (pack == lisp__data.key) + object = KEYWORD(LispDoGetAtom(symbol, 0)->string); + else + object = ATOM(symbol); + if (unreadable) + object->data.atom->unreadable = 1; + + /* Restore current package */ + lisp__data.pack = savepack; + PACKAGE = savepackage; + } + + else { + /* Symbol must exist (and be extern) in the specified package */ + + int i; + LispAtom *atom; + + i = STRHASH(symbol); + atom = pack->atoms[i]; + while (atom) { + if (strcmp(atom->string, symbol) == 0) { + object = atom->object; + break; + } + + atom = atom->next; + } + + /* No object found */ + if (object == NULL || object->data.atom->ext == 0) + READ_ERROR2("no extern symbol %s in package %s", symbol, package); + } + + return (object); +} + +static LispObj * +LispParseNumber(char *str, int radix, LispObj *read__stream, int read__line) +{ + int len; + long integer; + double dfloat; + char *ratio, *ptr; + LispObj *number; + mpi *bignum; + mpr *bigratio; + + if (radix < 2 || radix > 36) + READ_ERROR1("radix %d is not in the range 2 to 36", radix); + + if (*str == '\0') + return (NULL); + + ratio = strchr(str, '/'); + if (ratio) { + /* check if looks like a correctly specified ratio */ + if (ratio[1] == '\0' || strchr(ratio + 1, '/') != NULL) + return (ATOM(str)); + + /* ratio must point to an integer in radix base */ + *ratio++ = '\0'; + } + else if (radix == 10) { + int dot = 0; + int type = 0; + + /* check if it is a floating point number */ + ptr = str; + if (*ptr == '-' || *ptr == '+') + ++ptr; + else if (*ptr == '.') { + dot = 1; + ++ptr; + } + while (*ptr) { + if (*ptr == '.') { + if (dot) + return (ATOM(str)); + /* ignore it if last char is a dot */ + if (ptr[1] == '\0') { + *ptr = '\0'; + break; + } + dot = 1; + } + else if (!isdigit(*ptr)) + break; + ++ptr; + } + + switch (*ptr) { + case '\0': + if (dot) /* if dot, it is default float */ + type = 'E'; + break; + case 'E': case 'S': case 'F': case 'D': case 'L': + type = *ptr; + *ptr = 'E'; + break; + default: + return (ATOM(str)); /* syntax error */ + } + + /* if type set, it is not an integer specification */ + if (type) { + if (*ptr) { + int itype = *ptr; + char *ptype = ptr; + + ++ptr; + if (*ptr == '+' || *ptr == '-') + ++ptr; + while (*ptr && isdigit(*ptr)) + ++ptr; + if (*ptr) { + *ptype = itype; + + return (ATOM(str)); + } + } + + dfloat = strtod(str, NULL); + if (!finite(dfloat)) + READ_ERROR0("floating point overflow"); + + return (DFLOAT(dfloat)); + } + } + + /* check if correctly specified in the given radix */ + len = strlen(str) - 1; + if (!ratio && radix != 10 && str[len] == '.') + str[len] = '\0'; + + if (ratio || radix != 10) { + if (!StringInRadix(str, radix, 1)) { + if (ratio) + ratio[-1] = '/'; + return (ATOM(str)); + } + if (ratio && !StringInRadix(ratio, radix, 0)) { + ratio[-1] = '/'; + return (ATOM(str)); + } + } + + bignum = NULL; + bigratio = NULL; + + errno = 0; + integer = strtol(str, NULL, radix); + + /* if does not fit in a long */ + if (errno == ERANGE && + ((*str == '-' && integer == LONG_MIN) || + (*str != '-' && integer == LONG_MAX))) { + bignum = LispMalloc(sizeof(mpi)); + mpi_init(bignum); + mpi_setstr(bignum, str, radix); + } + + + if (ratio && integer != 0) { + long denominator; + + errno = 0; + denominator = strtol(ratio, NULL, radix); + if (denominator == 0) + READ_ERROR0("divide by zero"); + + if (bignum == NULL) { + if (integer == MINSLONG || + (denominator == LONG_MAX && errno == ERANGE)) { + bigratio = LispMalloc(sizeof(mpr)); + mpr_init(bigratio); + mpi_seti(mpr_num(bigratio), integer); + mpi_setstr(mpr_den(bigratio), ratio, radix); + } + } + else { + bigratio = LispMalloc(sizeof(mpr)); + mpr_init(bigratio); + mpi_set(mpr_num(bigratio), bignum); + mpi_clear(bignum); + LispFree(bignum); + mpi_setstr(mpr_den(bigratio), ratio, radix); + } + + if (bigratio) { + mpr_canonicalize(bigratio); + if (mpi_fiti(mpr_num(bigratio)) && + mpi_fiti(mpr_den(bigratio))) { + integer = mpi_geti(mpr_num(bigratio)); + denominator = mpi_geti(mpr_den(bigratio)); + mpr_clear(bigratio); + LispFree(bigratio); + if (denominator == 1) + number = INTEGER(integer); + else + number = RATIO(integer, denominator); + } + else + number = BIGRATIO(bigratio); + } + else { + long num = integer, den = denominator, rest; + + if (num < 0) + num = -num; + for (;;) { + if ((rest = den % num) == 0) + break; + den = num; + num = rest; + } + if (den != 1) { + denominator /= num; + integer /= num; + } + if (denominator < 0) { + integer = -integer; + denominator = -denominator; + } + if (denominator == 1) + number = INTEGER(integer); + else + number = RATIO(integer, denominator); + } + } + else if (bignum) + number = BIGNUM(bignum); + else + number = INTEGER(integer); + + return (number); +} + +static int +StringInRadix(char *str, int radix, int skip_sign) +{ + if (skip_sign && (*str == '-' || *str == '+')) + ++str; + while (*str) { + if (*str >= '0' && *str <= '9') { + if (*str - '0' >= radix) + return (0); + } + else if (*str >= 'A' && *str <= 'Z') { + if (radix <= 10 || *str - 'A' + 10 >= radix) + return (0); + } + else + return (0); + str++; + } + + return (1); +} + +static int +AtomSeparator(int ch, int check_space, int check_backslash) +{ + if (check_space && isspace(ch)) + return (1); + if (check_backslash && ch == '\\') + return (1); + return (strchr("(),\";'`#|,", ch) != NULL); +} + +static LispObj * +LispReadVector(read_info *info) +{ + LispObj *objects; + int nodot = info->nodot; + + info->nodot = info->level + 1; + objects = LispReadList(info); + info->nodot = nodot; + + if (info->discard) + return (objects); + + return (VECTOR(objects)); +} + +static LispObj * +LispReadFunction(read_info *info) +{ + READ_ENTER(); + int nodot = info->nodot; + LispObj *function; + + info->nodot = info->level + 1; + function = LispDoRead(info); + info->nodot = nodot; + + if (info->discard) + return (function); + + if (INVALIDP(function)) + READ_ERROR_INVARG(); + else if (CONSP(function)) { + if (CAR(function) != Olambda) + READ_ERROR_INVARG(); + + return (FUNCTION_QUOTE(function)); + } + else if (!SYMBOLP(function)) + READ_ERROR_INVARG(); + + return (FUNCTION_QUOTE(function)); +} + +static LispObj * +LispReadRational(int radix, read_info *info) +{ + READ_ENTER(); + LispObj *number; + int ch, len, size; + char stk[128], *str; + + len = 0; + str = stk; + size = sizeof(stk); + + for (;;) { + ch = LispGet(); + if (ch == EOF || isspace(ch)) + break; + else if (AtomSeparator(ch, 0, 1)) { + LispUnget(ch); + break; + } + else if (islower(ch)) + ch = toupper(ch); + if ((ch < '0' || ch > '9') && (ch < 'A' || ch > 'Z') && + ch != '+' && ch != '-' && ch != '/') { + if (str != stk) + LispFree(str); + if (!info->discard) + READ_ERROR1("bad character %c for rational number", ch); + } + if (len + 1 >= size) { + if (str == stk) { + size = 512; + str = LispMalloc(size); + strcpy(str + 1, stk + 1); + } + else { + size += 512; + str = LispRealloc(str, size); + } + } + str[len++] = ch; + } + + if (info->discard) { + if (str != stk) + LispFree(str); + + return (ch == EOF ? NULL : NIL); + } + + str[len] = '\0'; + + number = LispParseNumber(str, radix, read__stream, read__line); + if (str != stk) + LispFree(str); + + if (!RATIONALP(number)) + READ_ERROR0("bad rational number specification"); + + return (number); +} + +static LispObj * +LispReadCharacter(read_info *info) +{ + READ_ENTER(); + long c; + int ch, len; + char stk[64]; + + ch = LispGet(); + if (ch == EOF) + return (NULL); + + stk[0] = ch; + len = 1; + + for (;;) { + ch = LispGet(); + if (ch == EOF) + break; + else if (ch != '-' && !isalnum(ch)) { + LispUnget(ch); + break; + } + if (len + 1 < sizeof(stk)) + stk[len++] = ch; + } + if (len > 1) { + char **names; + int found = 0; + stk[len] = '\0'; + + for (c = ch = 0; ch <= ' ' && !found; ch++) { + for (names = LispChars[ch].names; *names; names++) + if (strcasecmp(*names, stk) == 0) { + c = ch; + found = 1; + break; + } + } + if (!found) { + for (names = LispChars[0177].names; *names; names++) + if (strcasecmp(*names, stk) == 0) { + c = 0177; + found = 1; + break; + } + } + + if (!found) { + if (info->discard) + return (NIL); + READ_ERROR1("unkwnown character %s", stk); + } + } + else + c = stk[0]; + + return (SCHAR(c)); +} + +static void +LispSkipComment(void) +{ + READ_ENTER(); + int ch, comm = 1; + + for (;;) { + ch = LispGet(); + if (ch == '#') { + ch = LispGet(); + if (ch == '|') + ++comm; + continue; + } + while (ch == '|') { + ch = LispGet(); + if (ch == '#' && --comm == 0) + return; + } + if (ch == EOF) + READ_ERROR_EOF(); + } +} + +static LispObj * +LispReadEval(read_info *info) +{ + READ_ENTER(); + int nodot = info->nodot; + LispObj *code; + + info->nodot = info->level + 1; + code = LispDoRead(info); + info->nodot = nodot; + + if (info->discard) + return (code); + + if (INVALIDP(code)) + READ_ERROR_INVARG(); + + return (EVAL(code)); +} + +static LispObj * +LispReadComplex(read_info *info) +{ + READ_ENTER(); + GC_ENTER(); + int nodot = info->nodot; + LispObj *number, *arguments; + + info->nodot = info->level + 1; + arguments = LispDoRead(info); + info->nodot = nodot; + + /* form read */ + if (info->discard) + return (arguments); + + if (INVALIDP(arguments) || !CONSP(arguments)) + READ_ERROR_INVARG(); + + GC_PROTECT(arguments); + number = APPLY(Ocomplex, arguments); + GC_LEAVE(); + + return (number); +} + +static LispObj * +LispReadPathname(read_info *info) +{ + READ_ENTER(); + GC_ENTER(); + int nodot = info->nodot; + LispObj *path, *arguments; + + info->nodot = info->level + 1; + arguments = LispDoRead(info); + info->nodot = nodot; + + /* form read */ + if (info->discard) + return (arguments); + + if (INVALIDP(arguments)) + READ_ERROR_INVARG(); + + GC_PROTECT(arguments); + path = APPLY1(Oparse_namestring, arguments); + GC_LEAVE(); + + return (path); +} + +static LispObj * +LispReadStruct(read_info *info) +{ + READ_ENTER(); + GC_ENTER(); + int len, nodot = info->nodot; + char stk[128], *str; + LispObj *struc, *fields; + + info->nodot = info->level + 1; + fields = LispDoRead(info); + info->nodot = nodot; + + /* form read */ + if (info->discard) + return (fields); + + if (INVALIDP(fields) || !CONSP(fields) || !SYMBOLP(CAR(fields))) + READ_ERROR_INVARG(); + + GC_PROTECT(fields); + + len = strlen(ATOMID(CAR(fields))); + /* MAKE- */ + if (len + 6 > sizeof(stk)) + str = LispMalloc(len + 6); + else + str = stk; + sprintf(str, "MAKE-%s", ATOMID(CAR(fields))); + RPLACA(fields, ATOM(str)); + if (str != stk) + LispFree(str); + struc = APPLY(Omake_struct, fields); + GC_LEAVE(); + + return (struc); +} + +/* XXX This is broken, needs a rewritten as soon as true vector/arrays be + * implemented. */ +static LispObj * +LispReadArray(long dimensions, read_info *info) +{ + READ_ENTER(); + GC_ENTER(); + long count; + int nodot = info->nodot; + LispObj *arguments, *initial, *dim, *cons, *array, *data; + + info->nodot = info->level + 1; + data = LispDoRead(info); + info->nodot = nodot; + + /* form read */ + if (info->discard) + return (data); + + if (INVALIDP(data)) + READ_ERROR_INVARG(); + + initial = Kinitial_contents; + + dim = cons = NIL; + if (dimensions) { + LispObj *array; + + for (count = 0, array = data; count < dimensions; count++) { + long length; + LispObj *item; + + if (!CONSP(array)) + READ_ERROR0("bad array for given dimension"); + item = array; + array = CAR(array); + + for (length = 0; CONSP(item); item = CDR(item), length++) + ; + + if (dim == NIL) { + dim = cons = CONS(FIXNUM(length), NIL); + GC_PROTECT(dim); + } + else { + RPLACD(cons, CONS(FIXNUM(length), NIL)); + cons = CDR(cons); + } + } + } + + arguments = CONS(dim, CONS(initial, CONS(data, NIL))); + GC_PROTECT(arguments); + array = APPLY(Omake_array, arguments); + GC_LEAVE(); + + return (array); +} + +static LispObj * +LispReadFeature(int with, read_info *info) +{ + READ_ENTER(); + LispObj *status; + LispObj *feature = LispDoRead(info); + + /* form read */ + if (info->discard) + return (feature); + + if (INVALIDP(feature)) + READ_ERROR_INVARG(); + + /* paranoia check, features must be a list, possibly empty */ + if (!CONSP(FEATURES) && FEATURES != NIL) + READ_ERROR1("%s is not a list", STROBJ(FEATURES)); + + status = LispEvalFeature(feature); + + if (with) { + if (status == T) + return (LispDoRead(info)); + + /* need to use the field discard because the following expression + * may be #.FORM or #,FORM or any other form that may generate + * side effects */ + info->discard = 1; + LispDoRead(info); + info->discard = 0; + + return (LispDoRead(info)); + } + + if (status == NIL) + return (LispDoRead(info)); + + info->discard = 1; + LispDoRead(info); + info->discard = 0; + + return (LispDoRead(info)); +} + +/* + * A very simple eval loop with AND, NOT, and OR functions for testing + * the available features. + */ +static LispObj * +LispEvalFeature(LispObj *feature) +{ + READ_ENTER(); + Atom_id test; + LispObj *object; + + if (CONSP(feature)) { + LispObj *function = CAR(feature), *arguments = CDR(feature); + + if (!SYMBOLP(function)) + READ_ERROR1("bad feature test function %s", STROBJ(function)); + if (!CONSP(arguments)) + READ_ERROR1("bad feature test arguments %s", STROBJ(arguments)); + test = ATOMID(function); + if (test == Sand) { + for (; CONSP(arguments); arguments = CDR(arguments)) { + if (LispEvalFeature(CAR(arguments)) == NIL) + return (NIL); + } + return (T); + } + else if (test == Sor) { + for (; CONSP(arguments); arguments = CDR(arguments)) { + if (LispEvalFeature(CAR(arguments)) == T) + return (T); + } + return (NIL); + } + else if (test == Snot) { + if (CONSP(CDR(arguments))) + READ_ERROR0("too many arguments to NOT"); + + return (LispEvalFeature(CAR(arguments)) == NIL ? T : NIL); + } + else + READ_ERROR1("unimplemented feature test function %s", test); + } + + if (KEYWORDP(feature)) + feature = feature->data.quote; + else if (!SYMBOLP(feature)) + READ_ERROR1("bad feature specification %s", STROBJ(feature)); + + test = ATOMID(feature); + + for (object = FEATURES; CONSP(object); object = CDR(object)) { + /* paranoia check, elements in the feature list must ge keywords */ + if (!KEYWORDP(CAR(object))) + READ_ERROR1("%s is not a keyword", STROBJ(CAR(object))); + if (ATOMID(CAR(object)) == test) + return (T); + } + + /* unknown feature */ + return (NIL); +} Index: xc/programs/xedit/lisp/read.h diff -u /dev/null xc/programs/xedit/lisp/read.h:1.3 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/read.h Fri Nov 15 02:01:30 2002 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/read.h,v 1.3 2002/11/15 07:01:30 paulo Exp $ */ + +#ifndef Lisp_read_h +#define Lisp_read_h + +#include "io.h" + +/* + * Prototypes + */ +LispObj *LispRead(void); + +LispObj *Lisp_Read(LispBuiltin*); +LispObj *Lisp_ReadChar(LispBuiltin*); +LispObj *Lisp_ReadCharNoHang(LispBuiltin*); +LispObj *Lisp_ReadLine(LispBuiltin*); + +#endif /* Lisp_read_h */ Index: xc/programs/xedit/lisp/regex.c diff -u /dev/null xc/programs/xedit/lisp/regex.c:1.10 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/regex.c Tue Dec 10 23:44:28 2002 @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/regex.c,v 1.10 2002/12/11 04:44:28 paulo Exp $ */ + +#include "regex.h" +#include "private.h" +#include "helper.h" + +/* + * Prototypes + */ +static re_cod *LispRecomp(LispBuiltin*, char*, int); + +/* + * Initialization + */ +LispObj *Knomatch; + +/* + * Implementation + */ +static re_cod * +LispRecomp(LispBuiltin *builtin, char *pattern, int cflags) +{ + int code; + re_cod *regex = LispMalloc(sizeof(re_cod)); + + if ((code = recomp(regex, pattern, cflags)) != 0) { + char buffer[256]; + + reerror(code, regex, buffer, sizeof(buffer)); + refree(regex); + LispFree(regex); + LispDestroy("%s: recomp(\"%s\"): %s", STRFUN(builtin), pattern, buffer); + } + + return (regex); +} + +void +LispRegexInit(void) +{ + Knomatch = KEYWORD("NOMATCH"); +} + +LispObj * +Lisp_Recomp(LispBuiltin *builtin) +/* + re-comp pattern &key nospec icase nosub newline + */ +{ + re_cod *regex; + int cflags = 0; + + LispObj *result; + + LispObj *pattern, *nospec, *icase, *nosub, *newline; + + newline = ARGUMENT(4); + nosub = ARGUMENT(3); + icase = ARGUMENT(2); + nospec = ARGUMENT(1); + pattern = ARGUMENT(0); + + /* Don't generate an error if it is already a compiled regex. */ + if (REGEXP(pattern)) + return (pattern); + + CHECK_STRING(pattern); + + if (nospec != UNSPEC && nospec != NIL) + cflags |= RE_NOSPEC; + if (icase != UNSPEC && icase != NIL) + cflags |= RE_ICASE; + if (nosub != UNSPEC && nosub != NIL) + cflags |= RE_NOSUB; + if (newline != UNSPEC && newline != NIL) + cflags |= RE_NEWLINE; + + regex = LispRecomp(builtin, THESTR(pattern), cflags); + result = LispNew(pattern, NIL); + result->type = LispRegex_t; + result->data.regex.regex = regex; + result->data.regex.pattern = pattern; + result->data.regex.options = cflags; + LispMused(regex); + + return (result); +} + +LispObj * +Lisp_Reexec(LispBuiltin *builtin) +/* + re-exec regex string &key count start end notbol noteol + */ +{ + size_t nmatch; + re_mat match[10]; + long start, end, length; + int code, cflags, eflags; + char *string; + LispObj *result; + re_cod *regexp; + + LispObj *regex, *ostring, *count, *ostart, *oend, *notbol, *noteol; + + noteol = ARGUMENT(6); + notbol = ARGUMENT(5); + oend = ARGUMENT(4); + ostart = ARGUMENT(3); + count = ARGUMENT(2); + ostring = ARGUMENT(1); + regex = ARGUMENT(0); + + if (STRINGP(regex)) + regexp = LispRecomp(builtin, THESTR(regex), cflags = 0); + else { + CHECK_REGEX(regex); + regexp = regex->data.regex.regex; + cflags = regex->data.regex.options; + } + + CHECK_STRING(ostring); + + if (count == UNSPEC) + nmatch = 1; + else { + CHECK_INDEX(count); + nmatch = FIXNUM_VALUE(count); + if (nmatch > 10) + LispDestroy("%s: COUNT cannot be larger than 10", STRFUN(builtin)); + } + if (nmatch && (cflags & RE_NOSUB)) + nmatch = 1; + + eflags = RE_STARTEND; + if (notbol != UNSPEC && notbol != NIL) + eflags |= RE_NOTBOL; + if (noteol != UNSPEC && noteol != NIL) + eflags |= RE_NOTEOL; + + string = THESTR(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &length); + + match[0].rm_so = start; + match[0].rm_eo = end; + code = reexec(regexp, string, nmatch, &match[0], eflags); + + if (code == 0) { + if (nmatch && match[0].rm_eo >= match[0].rm_so) { + result = CONS(CONS(FIXNUM(match[0].rm_so), + FIXNUM(match[0].rm_eo)), NIL); + if (nmatch > 1 && match[1].rm_eo >= match[1].rm_so) { + int i; + GC_ENTER(); + LispObj *cons = result; + + GC_PROTECT(result); + for (i = 1; + i < nmatch && match[i].rm_eo >= match[i].rm_so; + i++) { + RPLACD(cons, CONS(CONS(FIXNUM(match[i].rm_so), + FIXNUM(match[i].rm_eo)), NIL)); + cons = CDR(cons); + } + GC_LEAVE(); + } + } + else + result = NIL; + } + else + result = Knomatch; + + /* Maybe shoud cache compiled regex, but better the caller do it */ + if (!XREGEXP(regex)) { + refree(regexp); + LispFree(regexp); + } + + return (result); +} + +LispObj * +Lisp_Rep(LispBuiltin *builtin) +/* + re-p object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (REGEXP(object) ? T : NIL); +} Index: xc/programs/xedit/lisp/regex.h diff -u /dev/null xc/programs/xedit/lisp/regex.h:1.3 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/regex.h Fri Nov 8 03:00:57 2002 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/regex.h,v 1.3 2002/11/08 08:00:57 paulo Exp $ */ + +#ifndef Lisp_regex_h +#define Lisp_regex_h + +#include "internal.h" + +/* + * Prototypes + */ +void LispRegexInit(void); + +LispObj *Lisp_Recomp(LispBuiltin*); +LispObj *Lisp_Reexec(LispBuiltin*); +LispObj *Lisp_Rep(LispBuiltin*); + +#endif /* Lisp_regex_h */ Index: xc/programs/xedit/lisp/require.c diff -u xc/programs/xedit/lisp/require.c:1.7 xc/programs/xedit/lisp/require.c:1.16 --- xc/programs/xedit/lisp/require.c:1.7 Wed Oct 17 23:15:22 2001 +++ xc/programs/xedit/lisp/require.c Sat Nov 23 03:26:50 2002 @@ -27,59 +27,70 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/require.c,v 1.7 2001/10/18 03:15:22 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/require.c,v 1.16 2002/11/23 08:26:50 paulo Exp $ */ #include "require.h" /* - * Initialization - */ -static char *BadArgumentAt = "bad argument %s, at %s"; - -/* * Implementation */ LispObj * -Lisp_Load(LispMac *mac, LispObj *list, char *fname) +Lisp_Load(LispBuiltin *builtin) +/* + load filename &key verbose print if-does-not-exist + */ { - LispObj *file = CAR(list), *verbose, *print, *ifdoesnotexist; - - if (!STRING_P(file)) - LispDestroy(mac, BadArgumentAt, LispStrObj(mac, file), fname); + LispObj *filename, *verbose, *print, *if_does_not_exist; - LispGetKeys(mac, fname, "VERBOSE:PRINT:IF-DOES-NOT-EXIST", CDR(list), - &verbose, &print, &ifdoesnotexist); + if_does_not_exist = ARGUMENT(3); + print = ARGUMENT(2); + verbose = ARGUMENT(1); + filename = ARGUMENT(0); + + if (PATHNAMEP(filename)) + filename = CAR(filename->data.pathname); + else { + CHECK_STRING(filename); + } - return (_LispLoadFile(mac, STRPTR(file), fname, - verbose != NIL, print != NIL, ifdoesnotexist != NIL)); + return (LispLoadFile(filename, + verbose != UNSPEC && verbose != NIL, + print != UNSPEC && print != NIL, + if_does_not_exist != UNSPEC && + if_does_not_exist != NIL)); } LispObj * -Lisp_Require(LispMac *mac, LispObj *list, char *fname) +Lisp_Require(LispBuiltin *builtin) +/* + require module &optional pathname + */ { - LispObj *feat = CAR(list), *nam, *obj; char filename[1024], *ext; int len; - if (!STRING_P(feat) && !SYMBOL_P(feat)) - LispDestroy(mac, BadArgumentAt, LispStrObj(mac, feat), fname); + LispObj *obj, *module, *pathname; - if (CDR(list) != NIL) { - nam = CAR(CDR(list)); + pathname = ARGUMENT(1); + module = ARGUMENT(0); - if (!STRING_P(nam)) - LispDestroy(mac, "%s is not of type string, at %s", - LispStrObj(mac, nam), fname); + CHECK_STRING(module); + if (pathname != UNSPEC) { + if (PATHNAMEP(pathname)) + pathname = CAR(pathname->data.pathname); + else { + CHECK_STRING(pathname); + } } else - nam = feat; + pathname = module; - for (obj = MOD; obj != NIL; obj = CDR(obj)) { - if (STRPTR(CAR(obj)) == STRPTR(feat)) - return (feat); + for (obj = MOD; CONSP(obj); obj = CDR(obj)) { + if (strcmp(THESTR(CAR(obj)), THESTR(module)) == 0) + return (module); } - if (STRPTR(nam)[0] != '/') { + if (THESTR(pathname)[0] != '/') { #ifdef LISPDIR snprintf(filename, sizeof(filename), "%s", LISPDIR); #else @@ -95,48 +106,54 @@ ++len; } - snprintf(filename + len, sizeof(filename) - len - 5, "%s", STRPTR(nam)); + snprintf(filename + len, sizeof(filename) - len - 5, "%s", THESTR(pathname)); ext = filename + strlen(filename); #ifdef SHARED_MODULES strcpy(ext, ".so"); if (access(filename, R_OK) == 0) { - LispModule *module; + LispModule *lisp_module; char data[64]; int len; - if (mac->module == NULL) { + if (lisp__data.module == NULL) { /* export our own symbols */ if (dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL) == NULL) - LispDestroy(mac, dlerror()); + LispDestroy(mac, "%s: ", STRFUN(builtin), dlerror()); } -#if 0 - if (mac->interactive) - fprintf(lisp_stderr, "; Loading %s\n", filename); -#endif - module = (LispModule*)LispMalloc(mac, sizeof(LispModule)); - if ((module->handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL)) == NULL) - LispDestroy(mac, dlerror()); - snprintf(data, sizeof(data), "%sLispModuleData", STRPTR(nam)); - if ((module->data = (LispModuleData*)dlsym(module->handle, data)) == NULL) { - dlclose(module->handle); - LispDestroy(mac, "cannot find LispModuleData for %s", - LispStrObj(mac, feat)); + lisp_module = (LispModule*)LispMalloc(sizeof(LispModule)); + if ((lisp_module->handle = + dlopen(filename, RTLD_LAZY | RTLD_GLOBAL)) == NULL) + LispDestroy(mac, "%s: dlopen: %s", STRFUN(builtin), dlerror()); + snprintf(data, sizeof(data), "%sLispModuleData", THESTR(module)); + if ((lisp_module->data = + (LispModuleData*)dlsym(lisp_module->handle, data)) == NULL) { + dlclose(lisp_module->handle); + LispDestroy("%s: cannot find LispModuleData for %s", + STRFUN(builtin), STROBJ(module)); + } + LispMused(lisp_module); + lisp_module->next = lisp__data.module; + lisp__data.module = lisp_module; + if (lisp_module->data->load) + (lisp_module->data->load)(); + + if (MOD == NIL) + MOD = CONS(module, NIL); + else { + RPLACD(MOD, CONS(CAR(MOD), CDR(MOD))); + RPLACA(MOD, module); } - LispMused(mac, module); - module->next = mac->module; - mac->module = module; - if (module->data->load) - (module->data->load)(mac); + LispSetVar(lisp__data.modules, MOD); - return (Lisp_Provide(mac, CONS(feat, NIL), "PROVIDE")); + return (module); } #endif strcpy(ext, ".lsp"); - (void)_LispLoadFile(mac, filename, fname, 0, 0, 0); + (void)LispLoadFile(STRING(filename), 0, 0, 0); - return (feat); + return (module); } Index: xc/programs/xedit/lisp/require.h diff -u xc/programs/xedit/lisp/require.h:1.2 xc/programs/xedit/lisp/require.h:1.4 --- xc/programs/xedit/lisp/require.h:1.2 Mon Oct 15 03:05:52 2001 +++ xc/programs/xedit/lisp/require.h Fri Nov 8 03:00:57 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/require.h,v 1.2 2001/10/15 07:05:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/require.h,v 1.4 2002/11/08 08:00:57 paulo Exp $ */ #ifndef Lisp_require_h #define Lisp_require_h @@ -38,7 +38,7 @@ #include <dlfcn.h> #endif -LispObj *Lisp_Load(LispMac*, LispObj*, char*); /* load */ -LispObj *Lisp_Require(LispMac*, LispObj*, char*); /* require */ +LispObj *Lisp_Load(LispBuiltin*); +LispObj *Lisp_Require(LispBuiltin*); #endif /* Lisp_require_h */ Index: xc/programs/xedit/lisp/stream.c diff -u /dev/null xc/programs/xedit/lisp/stream.c:1.21 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/stream.c Mon Dec 9 22:59:03 2002 @@ -0,0 +1,866 @@ +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/stream.c,v 1.21 2002/12/10 03:59:03 paulo Exp $ */ + +#include "read.h" +#include "stream.h" +#include "pathname.h" +#include "write.h" +#include "private.h" +#include <errno.h> +#include <fcntl.h> +#include <signal.h> +#include <string.h> +#include <sys/wait.h> + +/* + * Initialization + */ +#define DIR_PROBE 0 +#define DIR_INPUT 1 +#define DIR_OUTPUT 2 +#define DIR_IO 3 + +#define EXT_NIL 0 +#define EXT_ERROR 1 +#define EXT_NEW_VERSION 2 +#define EXT_RENAME 3 +#define EXT_RENAME_DELETE 4 +#define EXT_OVERWRITE 5 +#define EXT_APPEND 6 +#define EXT_SUPERSEDE 7 + +#define NOEXT_NIL 0 +#define NOEXT_ERROR 1 +#define NOEXT_CREATE 2 +#define NOEXT_NOTHING 3 + +extern char **environ; + +LispObj *Oopen, *Oclose, *Otruename; + +LispObj *Kif_does_not_exist, *Kprobe, *Kinput, *Koutput, *Kio, + *Knew_version, *Krename, *Krename_and_delete, *Koverwrite, + *Kappend, *Ksupersede, *Kcreate; + +/* + * Implementation + */ +void +LispStreamInit(void) +{ + Oopen = STATIC_ATOM("OPEN"); + Oclose = STATIC_ATOM("CLOSE"); + Otruename = STATIC_ATOM("TRUENAME"); + + Kif_does_not_exist = KEYWORD("IF-DOES-NOT-EXIST"); + Kprobe = KEYWORD("PROBE"); + Kinput = KEYWORD("INPUT"); + Koutput = KEYWORD("OUTPUT"); + Kio = KEYWORD("IO"); + Knew_version = KEYWORD("NEW-VERSION"); + Krename = KEYWORD("RENAME"); + Krename_and_delete = KEYWORD("RENAME-AND-DELETE"); + Koverwrite = KEYWORD("OVERWRITE"); + Kappend = KEYWORD("APPEND"); + Ksupersede = KEYWORD("SUPERSEDE"); + Kcreate = KEYWORD("CREATE"); +} + +LispObj * +Lisp_DeleteFile(LispBuiltin *builtin) +/* + delete-file filename + */ +{ + GC_ENTER(); + LispObj *filename; + + filename = ARGUMENT(0); + + if (STRINGP(filename)) { + filename = APPLY1(Oparse_namestring, filename); + GC_PROTECT(filename); + } + else if (STREAMP(filename)) { + if (filename->data.stream.type != LispStreamFile) + LispDestroy("%s: %s is not a FILE-STREAM", + STRFUN(builtin), STROBJ(filename)); + filename = filename->data.stream.pathname; + } + else { + CHECK_PATHNAME(filename); + } + GC_LEAVE(); + + return (LispUnlink(THESTR(CAR(filename->data.pathname))) ? NIL : T); +} + +LispObj * +Lisp_RenameFile(LispBuiltin *builtin) +/* + rename-file filename new-name + */ +{ + int code; + GC_ENTER(); + char *from, *to; + LispObj *old_truename, *new_truename; + + LispObj *filename, *new_name; + + new_name = ARGUMENT(1); + filename = ARGUMENT(0); + + if (STRINGP(filename)) { + filename = APPLY1(Oparse_namestring, filename); + GC_PROTECT(filename); + } + else if (STREAMP(filename)) { + if (filename->data.stream.type != LispStreamFile) + LispDestroy("%s: %s is not a FILE-STREAM", + STRFUN(builtin), STROBJ(filename)); + filename = filename->data.stream.pathname; + } + else { + CHECK_PATHNAME(filename); + } + old_truename = APPLY1(Otruename, filename); + GC_PROTECT(old_truename); + + if (STRINGP(new_name)) { + new_name = APPLY3(Oparse_namestring, new_name, NIL, filename); + GC_PROTECT(new_name); + } + else { + CHECK_PATHNAME(new_name); + } + + from = THESTR(CAR(filename->data.pathname)); + to = THESTR(CAR(new_name->data.pathname)); + code = LispRename(from, to); + if (code) + LispDestroy("%s: rename(%s, %s): %s", + STRFUN(builtin), from, to, strerror(errno)); + GC_LEAVE(); + + new_truename = APPLY1(Otruename, new_name); + RETURN_COUNT = 2; + RETURN(0) = old_truename; + RETURN(1) = new_truename; + + return (new_name); +} + +LispObj * +Lisp_Streamp(LispBuiltin *builtin) +/* + streamp object + */ +{ + LispObj *object; + + object = ARGUMENT(0); + + return (STREAMP(object) ? T : NIL); +} + +LispObj * +Lisp_InputStreamP(LispBuiltin *builtin) +/* + input-stream-p stream + */ +{ + LispObj *stream; + + stream = ARGUMENT(0); + + CHECK_STREAM(stream); + + return (stream->data.stream.readable ? T : NIL); +} + +LispObj * +Lisp_OpenStreamP(LispBuiltin *builtin) +/* + open-stream-p stream + */ +{ + LispObj *stream; + + stream = ARGUMENT(0); + + CHECK_STREAM(stream); + + return (stream->data.stream.readable || stream->data.stream.writable ? + T : NIL); +} + +LispObj * +Lisp_OutputStreamP(LispBuiltin *builtin) +/* + output-stream-p stream + */ +{ + LispObj *stream; + + stream = ARGUMENT(0); + + CHECK_STREAM(stream); + + return (stream->data.stream.writable ? T : NIL); +} + +LispObj * +Lisp_Open(LispBuiltin *builtin) +/* + open filename &key direction element-type if-exists if-does-not-exist external-format + */ +{ + GC_ENTER(); + char *string; + LispObj *stream = NIL; + int mode, flags, direction, exist, noexist, file_exist; + LispFile *file; + + LispObj *filename, *odirection, *element_type, *if_exists, + *if_does_not_exist, *external_format; + + external_format = ARGUMENT(5); + if_does_not_exist = ARGUMENT(4); + if_exists = ARGUMENT(3); + element_type = ARGUMENT(2); + odirection = ARGUMENT(1); + filename = ARGUMENT(0); + + if (STRINGP(filename)) { + filename = APPLY1(Oparse_namestring, filename); + GC_PROTECT(filename); + } + else if (STREAMP(filename)) { + if (filename->data.stream.type != LispStreamFile) + LispDestroy("%s: %s is not a FILE-STREAM", + STRFUN(builtin), STROBJ(filename)); + filename = filename->data.stream.pathname; + } + else { + CHECK_PATHNAME(filename); + } + + if (odirection != UNSPEC) { + direction = -1; + if (KEYWORDP(odirection)) { + if (odirection == Kprobe) + direction = DIR_PROBE; + else if (odirection == Kinput) + direction = DIR_INPUT; + else if (odirection == Koutput) + direction = DIR_OUTPUT; + else if (odirection == Kio) + direction = DIR_IO; + } + if (direction == -1) + LispDestroy("%s: bad :DIRECTION %s", + STRFUN(builtin), STROBJ(odirection)); + } + else + direction = DIR_INPUT; + + if (element_type != UNSPEC) { + /* just check argument... */ + if (SYMBOLP(element_type) && + ATOMID(element_type) == Scharacter) + ; /* do nothing */ + else if (KEYWORDP(element_type) && + ATOMID(element_type) == Sdefault) + ; /* do nothing */ + else + LispDestroy("%s: only :%s and %s supported for :ELEMENT-TYPE, not %s", + STRFUN(builtin), Sdefault, Scharacter, STROBJ(element_type)); + } + + if (if_exists != UNSPEC) { + exist = -1; + if (if_exists == NIL) + exist = EXT_NIL; + else if (KEYWORDP(if_exists)) { + if (if_exists == Kerror) + exist = EXT_ERROR; + else if (if_exists == Knew_version) + exist = EXT_NEW_VERSION; + else if (if_exists == Krename) + exist = EXT_RENAME; + else if (if_exists == Krename_and_delete) + exist = EXT_RENAME_DELETE; + else if (if_exists == Koverwrite) + exist = EXT_OVERWRITE; + else if (if_exists == Kappend) + exist = EXT_APPEND; + else if (if_exists == Ksupersede) + exist = EXT_SUPERSEDE; + } + if (exist == -1) + LispDestroy("%s: bad :IF-EXISTS %s", + STRFUN(builtin), STROBJ(if_exists)); + } + else + exist = EXT_ERROR; + + if (if_does_not_exist != UNSPEC) { + noexist = -1; + if (if_does_not_exist == NIL) + noexist = NOEXT_NIL; + if (KEYWORDP(if_does_not_exist)) { + if (if_does_not_exist == Kerror) + noexist = NOEXT_ERROR; + else if (if_does_not_exist == Kcreate) + noexist = NOEXT_CREATE; + } + if (noexist == -1) + LispDestroy("%s: bad :IF-DOES-NO-EXISTS %s", + STRFUN(builtin), STROBJ(if_does_not_exist)); + } + else + noexist = direction != DIR_INPUT ? NOEXT_NOTHING : NOEXT_ERROR; + + if (external_format != UNSPEC) { + /* just check argument... */ + if (SYMBOLP(external_format) && + ATOMID(external_format) == Scharacter) + ; /* do nothing */ + else if (KEYWORDP(external_format) && + ATOMID(external_format) == Sdefault) + ; /* do nothing */ + else + LispDestroy("%s: only :%s and %s supported for :EXTERNAL-FORMAT, not %s", + STRFUN(builtin), Sdefault, Scharacter, STROBJ(external_format)); + } + + /* string representation of pathname */ + string = THESTR(CAR(filename->data.pathname)); + mode = 0; + + file_exist = access(string, F_OK) == 0; + if (file_exist) { + if (exist == EXT_NIL) { + GC_LEAVE(); + return (NIL); + } + } + else { + if (noexist == NOEXT_NIL) { + GC_LEAVE(); + return (NIL); + } + if (noexist == NOEXT_ERROR) + LispDestroy("%s: file %s does not exist", + STRFUN(builtin), STROBJ(CAR(filename->data.quote))); + else if (noexist == NOEXT_CREATE) { + LispFile *tmp = LispFopen(string, FILE_WRITE); + + if (tmp) + LispFclose(tmp); + else + LispDestroy("%s: cannot create file %s", + STRFUN(builtin), + STROBJ(CAR(filename->data.quote))); + } + } + + if (direction == DIR_OUTPUT || direction == DIR_IO) { + if (file_exist) { + if (exist == EXT_ERROR) + LispDestroy("%s: file %s already exists", + STRFUN(builtin), STROBJ(CAR(filename->data.quote))); + if (exist == EXT_RENAME) { + /* Add an ending '~' at the end of the backup file */ + char tmp[PATH_MAX + 1]; + + strcpy(tmp, string); + if (strlen(tmp) + 1 > PATH_MAX) + LispDestroy("%s: backup name for %s too long", + STRFUN(builtin), + STROBJ(CAR(filename->data.quote))); + strcat(tmp, "~"); + if (rename(string, tmp)) + LispDestroy("%s: rename: %s", + STRFUN(builtin), strerror(errno)); + mode |= FILE_WRITE; + } + else if (exist == EXT_OVERWRITE) + mode |= FILE_WRITE; + else if (exist == EXT_APPEND) + mode |= FILE_APPEND; + } + else + mode |= FILE_WRITE; + if (direction == DIR_IO) + mode |= FILE_IO; + } + else + mode |= FILE_READ; + + file = LispFopen(string, mode); + if (file == NULL) + LispDestroy("%s: open: %s", STRFUN(builtin), strerror(errno)); + + flags = 0; + if (direction == DIR_PROBE) { + LispFclose(file); + file = NULL; + } + else { + if (direction == DIR_INPUT || direction == DIR_IO) + flags |= STREAM_READ; + if (direction == DIR_OUTPUT || direction == DIR_IO) + flags |= STREAM_WRITE; + } + stream = FILESTREAM(file, filename, flags); + GC_LEAVE(); + + return (stream); +} + +LispObj * +Lisp_Close(LispBuiltin *builtin) +/* + close stream &key abort + */ +{ + LispObj *stream, *oabort; + + oabort = ARGUMENT(1); + stream = ARGUMENT(0); + + CHECK_STREAM(stream); + + if (stream->data.stream.readable || stream->data.stream.writable) { + stream->data.stream.readable = stream->data.stream.writable = 0; + if (stream->data.stream.type == LispStreamFile) { + LispFclose(stream->data.stream.source.file); + stream->data.stream.source.file = NULL; + } + else if (stream->data.stream.type == LispStreamPipe) { + if (IPSTREAMP(stream)) { + LispFclose(IPSTREAMP(stream)); + IPSTREAMP(stream) = NULL; + } + if (OPSTREAMP(stream)) { + LispFclose(OPSTREAMP(stream)); + OPSTREAMP(stream) = NULL; + } + if (EPSTREAMP(stream)) { + LispFclose(EPSTREAMP(stream)); + EPSTREAMP(stream) = NULL; + } + if (PIDPSTREAMP(stream) > 0) { + kill(PIDPSTREAMP(stream), + oabort == UNSPEC || oabort == NIL ? SIGTERM : SIGKILL); + waitpid(PIDPSTREAMP(stream), NULL, 0); + } + } + return (T); + } + + return (NIL); +} + +LispObj * +Lisp_Listen(LispBuiltin *builtin) +/* + listen &optional input-stream + */ +{ + LispFile *file = NULL; + LispObj *result = NIL; + + LispObj *stream; + + stream = ARGUMENT(0); + + if (stream == UNSPEC) + stream = NIL; + else if (stream != NIL) { + CHECK_STREAM(stream); + } + else + stream = lisp__data.standard_input; + + if (stream->data.stream.readable) { + switch (stream->data.stream.type) { + case LispStreamString: + if (SSTREAMP(stream)->input < SSTREAMP(stream)->length) + result = T; + break; + case LispStreamFile: + file = FSTREAMP(stream); + break; + case LispStreamStandard: + file = FSTREAMP(stream); + break; + case LispStreamPipe: + file = IPSTREAMP(stream); + break; + } + + if (file != NULL) { + if (file->available || file->offset < file->length) + result = T; + else { + unsigned char c; + + if (!file->nonblock) { + if (fcntl(file->descriptor, F_SETFL, O_NONBLOCK) < 0) + LispDestroy("%s: fcntl: %s", + STRFUN(builtin), strerror(errno)); + file->nonblock = 1; + } + if (read(file->descriptor, &c, 1) == 1) { + LispFungetc(file, c); + result = T; + } + } + } + } + + return (result); +} + +LispObj * +Lisp_MakeStringInputStream(LispBuiltin *builtin) +/* + make-string-input-stream string &optional start end + */ +{ + char *string; + long start, end, length; + + LispObj *ostring, *ostart, *oend, *result; + + oend = ARGUMENT(2); + ostart = ARGUMENT(1); + ostring = ARGUMENT(0); + + start = end = 0; + CHECK_STRING(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &length); + string = THESTR(ostring); + + if (end - start != length) + length = end - start; + result = LSTRINGSTREAM(string + start, STREAM_READ, length); + + return (result); +} + +LispObj * +Lisp_MakeStringOutputStream(LispBuiltin *builtin) +/* + make-string-output-stream &key element-type + */ +{ + LispObj *element_type; + + element_type = ARGUMENT(0); + + if (element_type != UNSPEC) { + /* just check argument... */ + if (SYMBOLP(element_type) && ATOMID(element_type) == Scharacter) + ; /* do nothing */ + else if (KEYWORDP(element_type) && + ATOMID(element_type) == Sdefault) + ; /* do nothing */ + else + LispDestroy("%s: only :%s and %s supported for :ELEMENT-TYPE, not %s", + STRFUN(builtin), Sdefault, Scharacter, STROBJ(element_type)); + } + + return (LSTRINGSTREAM("", STREAM_WRITE, 1)); +} + +LispObj * +Lisp_GetOutputStreamString(LispBuiltin *builtin) +/* + get-output-stream-string string-output-stream + */ +{ + int length; + char *string; + LispObj *string_output_stream, *result; + + string_output_stream = ARGUMENT(0); + + if (!STREAMP(string_output_stream) || + string_output_stream->data.stream.type != LispStreamString || + string_output_stream->data.stream.readable || + !string_output_stream->data.stream.writable) + LispDestroy("%s: %s is not an output string stream", + STRFUN(builtin), STROBJ(string_output_stream)); + + string = LispGetSstring(SSTREAMP(string_output_stream), &length); + result = LSTRING(string, length); + + /* reset string */ + SSTREAMP(string_output_stream)->output = + SSTREAMP(string_output_stream)->length = + SSTREAMP(string_output_stream)->column = 0; + + return (result); +} + + +/* XXX Non standard functions below + */ +LispObj * +Lisp_MakePipe(LispBuiltin *builtin) +/* + make-pipe command-line &key :direction :element-type :external-format + */ +{ + char *string; + LispObj *stream = NIL; + int flags, direction; + LispFile *error_file; + LispPipe *program; + int ifd[2]; + int ofd[2]; + int efd[2]; + char *argv[4]; + + LispObj *command_line, *odirection, *element_type, *external_format; + + external_format = ARGUMENT(3); + element_type = ARGUMENT(2); + odirection = ARGUMENT(1); + command_line = ARGUMENT(0); + + if (PATHNAMEP(command_line)) + command_line = CAR(command_line->data.quote); + else if (!STRINGP(command_line)) + LispDestroy("%s: %s is a bad pathname", + STRFUN(builtin), STROBJ(command_line)); + + if (odirection != UNSPEC) { + direction = -1; + if (KEYWORDP(odirection)) { + if (odirection == Kprobe) + direction = DIR_PROBE; + else if (odirection == Kinput) + direction = DIR_INPUT; + else if (odirection == Koutput) + direction = DIR_OUTPUT; + else if (odirection == Kio) + direction = DIR_IO; + } + if (direction == -1) + LispDestroy("%s: bad :DIRECTION %s", + STRFUN(builtin), STROBJ(odirection)); + } + else + direction = DIR_INPUT; + + if (element_type != UNSPEC) { + /* just check argument... */ + if (SYMBOLP(element_type) && ATOMID(element_type) == Scharacter) + ; /* do nothing */ + else if (KEYWORDP(element_type) && ATOMID(element_type) == Sdefault) + ; /* do nothing */ + else + LispDestroy("%s: only :%s and %s supported for :ELEMENT-TYPE, not %s", + STRFUN(builtin), Sdefault, Scharacter, STROBJ(element_type)); + } + + if (external_format != UNSPEC) { + /* just check argument... */ + if (SYMBOLP(external_format) && ATOMID(external_format) == Scharacter) + ; /* do nothing */ + else if (KEYWORDP(external_format) && + ATOMID(external_format) == Sdefault) + ; /* do nothing */ + else + LispDestroy("%s: only :%s and %s supported for :EXTERNAL-FORMAT, not %s", + STRFUN(builtin), Sdefault, Scharacter, STROBJ(external_format)); + } + + string = THESTR(command_line); + program = LispMalloc(sizeof(LispPipe)); + if (direction != DIR_PROBE) { + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = string; + argv[3] = NULL; + pipe(ifd); + pipe(ofd); + pipe(efd); + if ((program->pid = fork()) == 0) { + close(0); + close(1); + close(2); + dup2(ofd[0], 0); + dup2(ifd[1], 1); + dup2(efd[1], 2); + close(ifd[0]); + close(ifd[1]); + close(ofd[0]); + close(ofd[1]); + close(efd[0]); + close(efd[1]); + execve("/bin/sh", argv, environ); + exit(-1); + } + else if (program->pid < 0) + LispDestroy("%s: fork: %s", STRFUN(builtin), strerror(errno)); + + program->input = LispFdopen(ifd[0], FILE_READ | FILE_UNBUFFERED); + close(ifd[1]); + program->output = LispFdopen(ofd[1], FILE_WRITE | FILE_UNBUFFERED); + close(ofd[0]); + error_file = LispFdopen(efd[0], FILE_READ | FILE_UNBUFFERED); + close(efd[1]); + } + else { + program->pid = -1; + program->input = program->output = error_file = NULL; + } + + flags = direction == DIR_PROBE ? 0 : STREAM_READ; + program->errorp = FILESTREAM(error_file, command_line, flags); + + flags = 0; + if (direction != DIR_PROBE) { + if (direction == DIR_INPUT || direction == DIR_IO) + flags |= STREAM_READ; + if (direction == DIR_OUTPUT || direction == DIR_IO) + flags |= STREAM_WRITE; + } + stream = PIPESTREAM(program, command_line, flags); + LispMused(program); + + return (stream); +} + +/* Helper function, primarily for use with the xt module + */ +LispObj * +Lisp_PipeBroken(LispBuiltin *builtin) +/* + pipe-broken pipe-stream + */ +{ + int pid, status, retval; + LispObj *result = NIL; + + LispObj *pipe_stream; + + pipe_stream = ARGUMENT(0); + + if (!STREAMP(pipe_stream) || + pipe_stream->data.stream.type != LispStreamPipe) + LispDestroy("%s: %s is not a pipe stream", + STRFUN(builtin), STROBJ(pipe_stream)); + + if ((pid = PIDPSTREAMP(pipe_stream)) > 0) { + retval = waitpid(pid, &status, WNOHANG | WUNTRACED); + if (retval == pid || (retval == -1 && errno == ECHILD)) + result = T; + } + + return (result); +} + +/* + Helper function, so that it is not required to redirect error output + */ +LispObj * +Lisp_PipeErrorStream(LispBuiltin *builtin) +/* + pipe-error-stream pipe-stream + */ +{ + LispObj *pipe_stream; + + pipe_stream = ARGUMENT(0); + + if (!STREAMP(pipe_stream) || + pipe_stream->data.stream.type != LispStreamPipe) + LispDestroy("%s: %s is not a pipe stream", + STRFUN(builtin), STROBJ(pipe_stream)); + + return (pipe_stream->data.stream.source.program->errorp); +} + +/* + Helper function, primarily for use with the xt module + */ +LispObj * +Lisp_PipeInputDescriptor(LispBuiltin *builtin) +/* + pipe-input-descriptor pipe-stream + */ +{ + LispObj *pipe_stream; + + pipe_stream = ARGUMENT(0); + + if (!STREAMP(pipe_stream) || + pipe_stream->data.stream.type != LispStreamPipe) + LispDestroy("%s: %s is not a pipe stream", + STRFUN(builtin), STROBJ(pipe_stream)); + if (!IPSTREAMP(pipe_stream)) + LispDestroy("%s: pipe %s is unreadable", + STRFUN(builtin), STROBJ(pipe_stream)); + + return (INTEGER(LispFileno(IPSTREAMP(pipe_stream)))); +} + +/* + Helper function, primarily for use with the xt module + */ +LispObj * +Lisp_PipeErrorDescriptor(LispBuiltin *builtin) +/* + pipe-error-descriptor pipe-stream + */ +{ + LispObj *pipe_stream; + + pipe_stream = ARGUMENT(0); + + if (!STREAMP(pipe_stream) || + pipe_stream->data.stream.type != LispStreamPipe) + LispDestroy("%s: %s is not a pipe stream", + STRFUN(builtin), STROBJ(pipe_stream)); + if (!EPSTREAMP(pipe_stream)) + LispDestroy("%s: pipe %s is closed", + STRFUN(builtin), STROBJ(pipe_stream)); + + return (INTEGER(LispFileno(EPSTREAMP(pipe_stream)))); +} Index: xc/programs/xedit/lisp/stream.h diff -u /dev/null xc/programs/xedit/lisp/stream.h:1.8 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/stream.h Thu Dec 5 22:25:27 2002 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/stream.h,v 1.8 2002/12/06 03:25:27 paulo Exp $ */ + +#ifndef Lisp_stream_h +#define Lisp_stream_h + +#include "io.h" +#include "internal.h" + +void LispStreamInit(void); + +LispObj *Lisp_DeleteFile(LispBuiltin*); +LispObj *Lisp_RenameFile(LispBuiltin*); +LispObj *Lisp_InputStreamP(LispBuiltin*); +LispObj *Lisp_OpenStreamP(LispBuiltin*); +LispObj *Lisp_OutputStreamP(LispBuiltin*); +LispObj *Lisp_Open(LispBuiltin*); +LispObj *Lisp_MakePipe(LispBuiltin*); +LispObj *Lisp_PipeBroken(LispBuiltin*); +LispObj *Lisp_PipeErrorStream(LispBuiltin*); +LispObj *Lisp_PipeInputDescriptor(LispBuiltin*); +LispObj *Lisp_PipeErrorDescriptor(LispBuiltin*); +LispObj *Lisp_Close(LispBuiltin*); +LispObj *Lisp_Listen(LispBuiltin*); +LispObj *Lisp_Streamp(LispBuiltin*); +LispObj *Lisp_MakeStringInputStream(LispBuiltin*); +LispObj *Lisp_MakeStringOutputStream(LispBuiltin*); +LispObj *Lisp_GetOutputStreamString(LispBuiltin*); + +#endif /* Lisp_stream_h */ Index: xc/programs/xedit/lisp/string.c diff -u xc/programs/xedit/lisp/string.c:1.3 xc/programs/xedit/lisp/string.c:1.22 --- xc/programs/xedit/lisp/string.c:1.3 Sat Oct 27 23:34:31 2001 +++ xc/programs/xedit/lisp/string.c Wed Dec 4 00:27:58 2002 @@ -27,757 +27,1357 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/string.c,v 1.3 2001/10/28 03:34:31 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/string.c,v 1.22 2002/12/04 05:27:58 paulo Exp $ */ +#include "helper.h" +#include "read.h" #include "string.h" #include "private.h" #include <ctype.h> -LispObj * -Lisp_Char(LispMac *mac, LispObj *list, char *fname) -{ - int c, pos; - LispObj *str = CAR(list), *idx = CAR(CDR(list)); - - if (!STRING_P(str)) - LispDestroy(mac, "%s is not a string, at %s", - LispStrObj(mac, str), fname); - if (!NUMBER_P(idx)) - LispDestroy(mac, "%s is not a number, at %s", - LispStrObj(mac, str), fname); - - if (INDEX_P(idx)) - LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, idx), fname); - - if ((pos = NUMBER_VALUE(idx)) >= strlen(STRPTR(str))) - LispDestroy(mac, "index %d is too large, at %s", pos, fname); - - c = *(unsigned char*)(STRPTR(str) + pos); +#define CHAR_LESS 1 +#define CHAR_LESS_EQUAL 2 +#define CHAR_EQUAL 3 +#define CHAR_GREATER_EQUAL 4 +#define CHAR_GREATER 5 +#define CHAR_NOT_EQUAL 6 + +#define CHAR_ALPHAP 1 +#define CHAR_DOWNCASE 2 +#define CHAR_UPCASE 3 +#define CHAR_INT 4 +#define CHAR_BOTHP 5 +#define CHAR_UPPERP 6 +#define CHAR_LOWERP 7 +#define CHAR_GRAPHICP 8 + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif - return (CHAR(c)); -} +/* + * Prototypes + */ +static LispObj *LispCharCompare(LispBuiltin*, int, int); +static LispObj *LispStringCompare(LispBuiltin*, int, int); +static LispObj *LispCharOp(LispBuiltin*, int); +static LispObj *LispStringTrim(LispBuiltin*, int, int, int); +static LispObj *LispStringUpcase(LispBuiltin*, int); +static LispObj *LispStringDowncase(LispBuiltin*, int); +static LispObj *LispStringCapitalize(LispBuiltin*, int); -/* helper function for setf - * DONT explicitly call. Non standard function +/* + * Implementation */ -LispObj * -Lisp_XeditCharStore(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispCharCompare(LispBuiltin *builtin, int operation, int ignore_case) { - char *string; - int c, pos, len; - LispObj *str, *idx, *value; + LispObj *object; + int cmp, value, next_value; - str = CAR(list); - if (!STRING_P(str)) - LispDestroy(mac, "%s is not a string, at %s", - LispStrObj(mac, str), fname); - list = CDR(list); - idx = CAR(list); - if (idx->type != LispReal_t) - LispDestroy(mac, "%s is not a number, at %s", - LispStrObj(mac, str), fname); - if (!INDEX_P(idx)) - LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, idx), fname); - if ((pos = NUMBER_VALUE(idx)) >= (len = strlen(STRPTR(str)))) - LispDestroy(mac, "index %d is too large, at %s", pos, fname); - list = CDR(list); - value = CAR(list); - if (value->type != LispCharacter_t) - LispDestroy(mac, "%s is not a character, at %s", - LispStrObj(mac, value), fname); + LispObj *character, *more_characters; - c = value->data.integer; + more_characters = ARGUMENT(1); + character = ARGUMENT(0); + + CHECK_SCHAR(character); + value = SCHAR_VALUE(character); + if (ignore_case && islower(value)) + value = toupper(value); + + if (!CONSP(more_characters)) + return (T); + + /* First check if all parameters are characters */ + for (object = more_characters; CONSP(object); object = CDR(object)) + CHECK_SCHAR(CAR(object)); + + /* All characters in list must be different */ + if (operation == CHAR_NOT_EQUAL) { + /* Compare all characters */ + do { + for (object = more_characters; CONSP(object); object = CDR(object)) { + character = CAR(object); + next_value = SCHAR_VALUE(character); + if (ignore_case && islower(next_value)) + next_value = toupper(next_value); + if (value == next_value) + return (NIL); + } + value = SCHAR_VALUE(CAR(more_characters)); + if (ignore_case && islower(value)) + value = toupper(value); + more_characters = CDR(more_characters); + } while (CONSP(more_characters)); - if (c < 0 || c > 255) - LispDestroy(mac, "cannot represent character %d, at %s", c, fname); + return (T); + } - string = LispStrdup(mac, STRPTR(str)); - string[pos] = c; + /* Linearly compare characters */ + for (; CONSP(more_characters); more_characters = CDR(more_characters)) { + character = CAR(more_characters); + next_value = SCHAR_VALUE(character); + if (ignore_case && islower(next_value)) + next_value = toupper(next_value); + + switch (operation) { + case CHAR_LESS: cmp = value < next_value; break; + case CHAR_LESS_EQUAL: cmp = value <= next_value; break; + case CHAR_EQUAL: cmp = value == next_value; break; + case CHAR_GREATER_EQUAL: cmp = value >= next_value; break; + case CHAR_GREATER: cmp = value > next_value; break; + default: cmp = 0; break; + } - str->data.atom = LispDoGetAtom(mac, string, 0, 0); - LispFree(mac, string); + if (!cmp) + return (NIL); + value = next_value; + } - return (value); + return (T); } LispObj * -Lisp_CharLess(LispMac *mac, LispObj *list, char *fname) +Lisp_CharLess(LispBuiltin *builtin) +/* + char< character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, LESS, 0)); + return (LispCharCompare(builtin, CHAR_LESS, 0)); } LispObj * -Lisp_CharLessEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_CharLessEqual(LispBuiltin *builtin) +/* + char<= character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, LESS_EQUAL, 0)); + return (LispCharCompare(builtin, CHAR_LESS_EQUAL, 0)); } LispObj * -Lisp_CharEqual_(LispMac *mac, LispObj *list, char *fname) +Lisp_CharEqual_(LispBuiltin *builtin) +/* + char= character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, EQUAL, 0)); + return (LispCharCompare(builtin, CHAR_EQUAL, 0)); } LispObj * -Lisp_CharGreater(LispMac *mac, LispObj *list, char *fname) +Lisp_CharGreater(LispBuiltin *builtin) +/* + char> character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, GREATER, 0)); + return (LispCharCompare(builtin, CHAR_GREATER, 0)); } LispObj * -Lisp_CharGreaterEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_CharGreaterEqual(LispBuiltin *builtin) +/* + char>= character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, GREATER_EQUAL, 0)); + return (LispCharCompare(builtin, CHAR_GREATER_EQUAL, 0)); } LispObj * -Lisp_CharNotEqual_(LispMac *mac, LispObj *list, char *fname) +Lisp_CharNotEqual_(LispBuiltin *builtin) +/* + char/= character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, NOT_EQUAL, 0)); + return (LispCharCompare(builtin, CHAR_NOT_EQUAL, 0)); } LispObj * -Lisp_CharLessp(LispMac *mac, LispObj *list, char *fname) +Lisp_CharLessp(LispBuiltin *builtin) +/* + char-lessp character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, LESS, 1)); + return (LispCharCompare(builtin, CHAR_LESS, 1)); } LispObj * -Lisp_CharNotGreaterp(LispMac *mac, LispObj *list, char *fname) +Lisp_CharNotGreaterp(LispBuiltin *builtin) +/* + char-not-greaterp character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, LESS_EQUAL, 1)); + return (LispCharCompare(builtin, CHAR_LESS_EQUAL, 1)); } LispObj * -Lisp_CharEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_CharEqual(LispBuiltin *builtin) +/* + char-equalp character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, EQUAL, 1)); + return (LispCharCompare(builtin, CHAR_EQUAL, 1)); } LispObj * -Lisp_CharGreaterp(LispMac *mac, LispObj *list, char *fname) +Lisp_CharGreaterp(LispBuiltin *builtin) +/* + char-greaterp character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, GREATER, 1)); + return (LispCharCompare(builtin, CHAR_GREATER, 1)); } LispObj * -Lisp_CharNotLessp(LispMac *mac, LispObj *list, char *fname) +Lisp_CharNotLessp(LispBuiltin *builtin) +/* + char-not-lessp &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, GREATER_EQUAL, 1)); + return (LispCharCompare(builtin, CHAR_GREATER_EQUAL, 1)); } LispObj * -Lisp_CharNotEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_CharNotEqual(LispBuiltin *builtin) +/* + char-not-equal character &rest more-characters + */ { - return (_LispCharBoolCond(mac, list, fname, NOT_EQUAL, 1)); + return (LispCharCompare(builtin, CHAR_NOT_EQUAL, 1)); } -LispObj * -Lisp_Character(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispCharOp(LispBuiltin *builtin, int operation) { - LispObj *obj = CAR(list); + int value; + LispObj *result, *character; - if (obj->type == LispCharacter_t) - return (obj); - else if ((SYMBOL_P(obj) || STRING_P(obj)) && - STRPTR(obj)[1] == '\0') - return (CHAR((unsigned char)STRPTR(obj)[0])); - else if (INDEX_P(obj)) { - int c = NUMBER_VALUE(obj); + character = ARGUMENT(0); + CHECK_SCHAR(character); + value = (int)SCHAR_VALUE(character); - if (c <= 0xffff) - return (CHAR(c)); + switch (operation) { + case CHAR_ALPHAP: + result = isalpha(value) ? T : NIL; + break; + case CHAR_DOWNCASE: + result = SCHAR(tolower(value)); + break; + case CHAR_UPCASE: + result = SCHAR(toupper(value)); + break; + case CHAR_INT: + result = FIXNUM(value); + break; + case CHAR_BOTHP: + result = isupper(value) || islower(value) ? T : NIL; + break; + case CHAR_UPPERP: + result = isupper(value) ? T : NIL; + break; + case CHAR_LOWERP: + result = islower(value) ? T : NIL; + break; + case CHAR_GRAPHICP: + result = value == ' ' || isgraph(value) ? T : NIL; + break; + default: + result = NIL; + break; } - - LispDestroy(mac, "cannot convert %s to character, at %s", - LispStrObj(mac, obj), fname); - /*NOTREACHED*/ - return (NIL); + return (result); } LispObj * -Lisp_CharDowncase(LispMac *mac, LispObj *list, char *fname) +Lisp_AlphaCharP(LispBuiltin *builtin) +/* + alpha-char-p char + */ { - int c; - LispObj *obj = CAR(list); - - if (obj->type != LispCharacter_t) - LispDestroy(mac, "%s is not a character, at %s", - LispStrObj(mac, obj), fname); - - c = tolower((int)obj->data.integer); - if (c == obj->data.integer) - return (obj); - - return (CHAR(c)); + return (LispCharOp(builtin, CHAR_ALPHAP)); } LispObj * -Lisp_CharInt(LispMac *mac, LispObj *list, char *fname) +Lisp_CharDowncase(LispBuiltin *builtin) +/* + char-downcase character + */ { - LispObj *obj = CAR(list); - - if (obj->type != LispCharacter_t) - LispDestroy(mac, "%s is not a character, at %s", - LispStrObj(mac, obj), fname); - - return (REAL(obj->data.integer)); + return (LispCharOp(builtin, CHAR_DOWNCASE)); } LispObj * -Lisp_CharUpcase(LispMac *mac, LispObj *list, char *fname) +Lisp_CharInt(LispBuiltin *builtin) +/* + char-int character + char-code character + */ { - int c; - LispObj *obj = CAR(list); - - if (obj->type != LispCharacter_t) - LispDestroy(mac, "%s is not a character, at %s", - LispStrObj(mac, obj), fname); - - c = toupper((int)obj->data.integer); - if (c == obj->data.integer) - return (obj); - - return (CHAR(c)); + return (LispCharOp(builtin, CHAR_INT)); } LispObj * -Lisp_IntChar(LispMac *mac, LispObj *list, char *fname) +Lisp_CharUpcase(LispBuiltin *builtin) +/* + char-upcase character + */ { - long character = 0; - LispObj *obj = CAR(list); - - if (INTEGER_P(obj)) - character = NUMBER_VALUE(obj); - else - LispDestroy(mac, "cannot convert %s to character, at %s", - LispStrObj(mac, obj), fname); + return (LispCharOp(builtin, CHAR_UPCASE)); +} - return (character >= 0 && character < 0xffff ? CHAR(character) : NIL); +LispObj * +Lisp_BothCaseP(LispBuiltin *builtin) +/* + both-case-p character + */ +{ + return (LispCharOp(builtin, CHAR_BOTHP)); } LispObj * -Lisp_String(LispMac *mac, LispObj *list, char *fname) +Lisp_UpperCaseP(LispBuiltin *builtin) +/* + upper-case-p character + */ { - LispObj *obj = CAR(list); + return (LispCharOp(builtin, CHAR_UPPERP)); +} - if (STRING_P(obj)) - return (obj); - else if (SYMBOL_P(obj)) - return (STRING(STRPTR(obj))); - else if (obj->type == LispCharacter_t) { - char string[2]; +LispObj * +Lisp_LowerCaseP(LispBuiltin *builtin) +/* + upper-case-p character + */ +{ + return (LispCharOp(builtin, CHAR_LOWERP)); +} - string[0] = obj->data.integer; - string[1] = '\0'; - return (STRING(string)); - } - else - LispDestroy(mac, "expecting string, symbol or character, at %s", fname); - /*NOTREACHED*/ - return (NIL); +LispObj * +Lisp_GraphicCharP(LispBuiltin *builtin) +/* + graphic-char-p char + */ +{ + return (LispCharOp(builtin, CHAR_GRAPHICP)); } LispObj * -Lisp_ReadFromString(LispMac *mac, LispObj *list, char *fname) +Lisp_Char(LispBuiltin *builtin) +/* + char string index + schar simple-string index + */ { - char *str; - int level, length, start, end; - LispObj *res, *eof_error, *eof_value, *ostart, *oend, *preserve; - - if (!STRING_P(CAR(list))) - LispDestroy(mac, "expecting string, at %s", fname); - str = STRPTR(CAR(list)); - - length = strlen(str); - eof_error = eof_value = ostart = oend = preserve = NIL; - - list = CDR(list); - if (list != NIL) { - eof_error = CAR(list); - list = CDR(list); - if (list != NIL) { - eof_value = CAR(list); - list = CDR(list); - if (list != NIL) - LispGetKeys(mac, fname, "START:END:PRESERVE-WHITESPACE", list, - &ostart, &oend, &preserve); - } - } + char *string; + long offset, length; - if (ostart == NIL) - start = 0; - else { - if (!INDEX_P(ostart)) - LispDestroy(mac, "expecting positive integer, at %s", fname); - start = NUMBER_VALUE(ostart); - } - if (oend == NIL) - end = length; - else { - if (!INDEX_P(oend)) - LispDestroy(mac, "expecting positive integer, at %s", fname); - end = NUMBER_VALUE(oend); - } - if (start >= end || end > length) - LispDestroy(mac, "bad string index or length, at %s", fname); - - if (mac->stream.stream_level + 1 >= mac->stream.stream_size) { - LispStream *stream = (LispStream*) - realloc(mac->stream.stream, sizeof(LispStream) * - (mac->stream.stream_size + 1)); + LispObj *ostring, *oindex; - if (stream == NULL) { - fprintf(lisp_stderr, "out of memory"); - return (NIL); - } + oindex = ARGUMENT(1); + ostring = ARGUMENT(0); - mac->stream.stream = stream; - ++mac->stream.stream_size; - } - mac->stream.stream[mac->stream.stream_level].fp = mac->fp; - mac->stream.stream[mac->stream.stream_level].st = mac->st; - mac->stream.stream[mac->stream.stream_level].cp = mac->cp; - mac->stream.stream[mac->stream.stream_level].tok = mac->tok; - ++mac->stream.stream_level; - memset(mac->stream.stream + mac->stream.stream_level, 0, sizeof(LispStream)); - mac->stream.stream[mac->stream.stream_level].fp = NULL; - mac->fp = NULL; - length = end - start; - mac->st = mac->cp = LispMalloc(mac, length + 1); - strncpy(mac->st, str + start, length); - mac->st[length] = '\0'; - mac->tok = 0; + CHECK_STRING(ostring); + CHECK_INDEX(oindex); + offset = FIXNUM_VALUE(oindex); + string = THESTR(ostring); + length = STRLEN(ostring); - level = mac->level; - mac->level = 0; + if (offset >= length) + LispDestroy("%s: index %ld too large for string length %ld", + STRFUN(builtin), offset, length); - res = LispRun(mac); + return (SCHAR(string[offset])); +} - LispFree(mac, mac->st); - mac->level = level; - --mac->stream.stream_level; +/* helper function for setf + * DONT explicitly call. Non standard function + */ +LispObj * +Lisp_XeditCharStore(LispBuiltin *builtin) +/* + xedit::char-store string index value + */ +{ + int character; + long offset, length; + LispObj *ostring, *oindex, *ovalue; - mac->fp = mac->stream.stream[mac->stream.stream_level].fp; - mac->st = mac->stream.stream[mac->stream.stream_level].st; - mac->cp = mac->stream.stream[mac->stream.stream_level].cp; - mac->tok = mac->stream.stream[mac->stream.stream_level].tok; + ovalue = ARGUMENT(2); + oindex = ARGUMENT(1); + ostring = ARGUMENT(0); - if (res == EOLIST) - LispDestroy(mac, "object cannot start with #\\)"); - if (res == NULL) - LispDestroy(mac, "unexpected end of input, at %s", fname); + CHECK_STRING(ostring); + CHECK_INDEX(oindex); + length = STRLEN(ostring); + offset = FIXNUM_VALUE(oindex); + if (offset >= length) + LispDestroy("%s: index %ld too large for string length %ld", + STRFUN(builtin), offset, length); + CHECK_SCHAR(ovalue); + CHECK_STRING_WRITABLE(ostring); - return (res); -} + character = SCHAR_VALUE(ovalue); -LispObj * -Lisp_StringTrim(LispMac *mac, LispObj *list, char *fname) -{ - return (_LispStringDoTrim(mac, list, fname, 1, 1)); + if (character < 0 || character > 255) + LispDestroy("%s: cannot represent character %d", + STRFUN(builtin), character); + + THESTR(ostring)[offset] = character; + + return (ovalue); } LispObj * -Lisp_StringLeftTrim(LispMac *mac, LispObj *list, char *fname) +Lisp_Character(LispBuiltin *builtin) +/* + character object + */ { - return (_LispStringDoTrim(mac, list, fname, 1, 0)); + LispObj *object; + + object = ARGUMENT(0); + + return (LispCharacterCoerce(builtin, object)); } LispObj * -Lisp_StringRightTrim(LispMac *mac, LispObj *list, char *fname) +Lisp_Characterp(LispBuiltin *builtin) +/* + characterp object + */ { - return (_LispStringDoTrim(mac, list, fname, 0, 1)); + LispObj *object; + + object = ARGUMENT(0); + + return (SCHARP(object) ? T : NIL); } LispObj * -Lisp_StringEqual_(LispMac *mac, LispObj *list, char *fname) +Lisp_DigitChar(LispBuiltin *builtin) +/* + digit-char weight &optional radix + */ { - char *string1, *string2; - int start1, end1, start2, end2, len; + long radix = 10, weight; + LispObj *oweight, *oradix, *result = NIL; - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + oradix = ARGUMENT(1); + oweight = ARGUMENT(0); - len = end1 - start1; + CHECK_FIXNUM(oweight); + weight = FIXNUM_VALUE(oweight); - if (len != (end2 - start2) || - strncmp(string1 + start1, string2 + start2, len)) - return (NIL); + if (oradix != UNSPEC) { + CHECK_INDEX(oradix); + radix = FIXNUM_VALUE(oradix); + } + if (radix < 2 || radix > 36) + LispDestroy("%s: radix must be >= 2 and <= 36, not %ld", + STRFUN(builtin), radix); + + if (weight >= 0 && weight < radix) { + if (weight < 9) + weight += '0'; + else + weight += 'A' - 10; + result = SCHAR(weight); + } - return (T); + return (result); } -/* Note, most functions bellow also compare with the ending '\0'. - * This is expected, to avoid an extra if */ LispObj * -Lisp_StringLess(LispMac *mac, LispObj *list, char *fname) +Lisp_DigitCharP(LispBuiltin *builtin) +/* + digit-char-p character &optional radix + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2; - - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); - - string1 += start1; - string2 += start2; + long radix = 10, character; + LispObj *ochar, *oradix, *result = NIL; - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) - if (*string1 < *string2) - return (REAL(c1)); - else if (*string1 != *string2) - break; + oradix = ARGUMENT(1); + ochar = ARGUMENT(0); - return (NIL); + CHECK_SCHAR(ochar); + character = SCHAR_VALUE(ochar); + if (oradix != UNSPEC) { + CHECK_INDEX(oradix); + radix = FIXNUM_VALUE(oradix); + } + if (radix < 2 || radix > 36) + LispDestroy("%s: radix must be >= 2 and <= 36, not %ld", + STRFUN(builtin), radix); + + if (character >= '0' && character <= '9') + character -= '0'; + else if (character >= 'A' && character <= 'Z') + character -= 'A' - 10; + else if (character >= 'a' && character <= 'z') + character -= 'a' - 10; + if (character < radix) + result = FIXNUM(character); + + return (result); } LispObj * -Lisp_StringGreater(LispMac *mac, LispObj *list, char *fname) +Lisp_IntChar(LispBuiltin *builtin) +/* + int-char integer + code-char integer + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2; + long character = 0; + LispObj *integer; - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + integer = ARGUMENT(0); - string1 += start1; - string2 += start2; - - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) - if (*string1 > *string2) - return (REAL(c1)); - else if (*string1 != *string2) - break; + CHECK_FIXNUM(integer); + character = FIXNUM_VALUE(integer); - return (NIL); + return (character >= 0 && character < 0xff ? SCHAR(character) : NIL); } +/* XXX ignoring element-type */ LispObj * -Lisp_StringLessEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_MakeString(LispBuiltin *builtin) +/* + make-string size &key initial-element element-type + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2; + long length; + char *string, initial; - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + LispObj *size, *initial_element, *element_type; - string1 += start1; - string2 += start2; + element_type = ARGUMENT(2); + initial_element = ARGUMENT(1); + size = ARGUMENT(0); + + CHECK_INDEX(size); + length = FIXNUM_VALUE(size); + if (initial_element != UNSPEC) { + CHECK_SCHAR(initial_element); + initial = SCHAR_VALUE(initial_element); + } + else + initial = 0; - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) - if (*string1 < *string2) - return (REAL(c1)); - else if (*string1 != *string2) - return (NIL); - else if (!*string1) - break; + string = LispMalloc(length + 1); + memset(string, initial, length); + string[length] = '\0'; - return (REAL(c1)); + return (LSTRING2(string, length)); } LispObj * -Lisp_StringGreaterEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_ParseInteger(LispBuiltin *builtin) +/* + parse-integer string &key start end radix junk-allowed + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2; - - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + GC_ENTER(); + char *ptr, *string; + int character, junk, sign, overflow; + long i, start, end, radix, length, integer, check; + LispObj *result; + + LispObj *ostring, *ostart, *oend, *oradix, *junk_allowed; + + junk_allowed = ARGUMENT(4); + oradix = ARGUMENT(3); + oend = ARGUMENT(2); + ostart = ARGUMENT(1); + ostring = ARGUMENT(0); + + start = end = radix = 0; + result = NIL; + + CHECK_STRING(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &length); + string = THESTR(ostring); + if (radix < 2 || radix > 36) + LispDestroy("%s: :RADIX %ld must be in the range 2 to 36", + STRFUN(builtin), radix); + + integer = check = 0; + ptr = string + start; + sign = overflow = 0; + + /* Skip leading white spaces */ + for (i = start; i < end && *ptr && isspace(*ptr); ptr++, i++) + ; + + /* Check for sign specification */ + if (i < end && (*ptr == '-' || *ptr == '+')) { + sign = *ptr == '-'; + ++ptr; + ++i; + } - string1 += start1; - string2 += start2; + for (junk = 0; i < end; i++, ptr++) { + character = *ptr; + if (islower(character)) + character = toupper(character); + if (character >= '0' && character <= '9') { + if (character - '0' >= radix) + junk = 1; + else { + check = integer; + integer = integer * radix + character - '0'; + } + } + else if (character >= 'A' && character <= 'Z') { + if (character - 'A' + 10 >= radix) + junk = 1; + else { + check = integer; + integer = integer * radix + character - 'A' + 10; + } + } + else { + if (isspace(character)) + break; + junk = 1; + } - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) - if (*string1 > *string2) - return (REAL(c1)); - else if (*string1 != *string2) - return (NIL); - else if (!*string1) + if (junk) break; + + if (!overflow && check > integer) + overflow = 1; + /* keep looping just to count read bytes */ + } - return (REAL(c1)); + if (!junk) + /* Skip white spaces */ + for (; i < end && *ptr && isspace(*ptr); ptr++, i++) + ; + + if ((junk || ptr == string) && + (junk_allowed == UNSPEC || junk_allowed == NIL)) + LispDestroy("%s: %s has a bad integer representation", + STRFUN(builtin), STROBJ(ostring)); + else if (ptr == string) + result = NIL; + else if (overflow) { + mpi *bigi = LispMalloc(sizeof(mpi)); + char *str; + + length = end - start + sign; + str = LispMalloc(length + 1); + + strncpy(str, string - sign, length + sign); + str[length + sign] = '\0'; + mpi_init(bigi); + mpi_setstr(bigi, str, radix); + LispFree(str); + result = BIGNUM(bigi); + } + else + result = INTEGER(sign ? -integer : integer); + + GC_PROTECT(result); + RETURN(0) = FIXNUM(i); + RETURN_COUNT = 1; + GC_LEAVE(); + + return (result); } LispObj * -Lisp_StringNotEqual_(LispMac *mac, LispObj *list, char *fname) +Lisp_String(LispBuiltin *builtin) +/* + string object + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2; + LispObj *object; - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + object = ARGUMENT(0); - string1 += start1; - string2 += start2; + return (LispStringCoerce(builtin, object)); +} - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) - if (*string1 != *string2) - return (REAL(c1)); +LispObj * +Lisp_Stringp(LispBuiltin *builtin) +/* + stringp object + */ +{ + LispObj *object; - return (NIL); + object = ARGUMENT(0); + + return (STRINGP(object) ? T : NIL); } +/* XXX preserve-whitespace is being ignored */ LispObj * -Lisp_StringEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_ReadFromString(LispBuiltin *builtin) +/* + read-from-string string &optional eof-error-p eof-value &key start end preserve-whitespace + */ { - char *string1, *string2; - int start1, end1, start2, end2, len; + GC_ENTER(); + char *string; + LispObj *stream, *result; + long length, start, end, bytes_read; - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + LispObj *ostring, *eof_error_p, *eof_value, + *ostart, *oend, *preserve_white_space; - len = end1 - start1; + preserve_white_space = ARGUMENT(5); + oend = ARGUMENT(4); + ostart = ARGUMENT(3); + eof_value = ARGUMENT(2); + eof_error_p = ARGUMENT(1); + ostring = ARGUMENT(0); + + CHECK_STRING(ostring); + string = THESTR(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &length); + + if (start > 0 || end < length) + length = end - start; + stream = LSTRINGSTREAM(string + start, STREAM_READ, length); + + if (eof_value == UNSPEC) + eof_value = NIL; + + LispPushInput(stream); + result = LispRead(); + /* stream->data.stream.source.string->input is + * the offset of the last byte read in string */ + bytes_read = stream->data.stream.source.string->input; + LispPopInput(stream); + + if (result == NULL) { + if (eof_error_p == NIL) + result = eof_value; + else + LispDestroy("%s: unexpected end of input", STRFUN(builtin)); + } - if (len != (end2 - start2) || - strncasecmp(string1 + start1, string2 + start2, len)) - return (NIL); + GC_PROTECT(result); + RETURN(0) = FIXNUM(start + bytes_read); + RETURN_COUNT = 1; + GC_LEAVE(); + + return (result); +} + +static LispObj * +LispStringTrim(LispBuiltin *builtin, int left, int right, int inplace) +/* + string-{,left-,right-}trim character-bag string +*/ +{ + unsigned char *string; + long start, end, length; + + LispObj *ochars, *ostring; + + ostring = ARGUMENT(1); + ochars = ARGUMENT(0); + + if (!POINTERP(ochars) || !(XSTRINGP(ochars) || XCONSP(ochars))) { + if (ARRAYP(ochars) && ochars->data.array.rank == 1) + ochars = ochars->data.array.list; + else + LispDestroy("%s: %s is not a sequence", + STRFUN(builtin), STROBJ(ochars)); + } + CHECK_STRING(ostring); - return (T); -} + string = (unsigned char*)THESTR(ostring); + length = STRLEN(ostring); -LispObj * -Lisp_StringLessp(LispMac *mac, LispObj *list, char *fname) -{ - char *string1, *string2; - int start1, end1, start2, end2, c1, c2, ch1, ch2; + start = 0; + end = length; + + if (XSTRINGP(ochars)) { + unsigned char *chars = (unsigned char*)THESTR(ochars); + long i, clength = STRLEN(ochars); + + if (left) { + for (; start < end; start++) { + for (i = 0; i < clength; i++) + if (string[start] == chars[i]) + break; + if (i >= clength) + break; + } + } + if (right) { + for (--end; end >= 0; end--) { + for (i = 0; i < clength; i++) + if (string[end] == chars[i]) + break; + if (i >= clength) + break; + } + ++end; + } + } + else { + LispObj *ochar, *list; + + if (left) { + for (; start < end; start++) { + for (list = ochars; CONSP(list); list = CDR(list)) { + ochar = CAR(list); + if (SCHARP(ochar) && string[start] == SCHAR_VALUE(ochar)) + break; + } + if (!CONSP(list)) + break; + } + } + if (right) { + for (--end; end >= 0; end--) { + for (list = ochars; CONSP(list); list = CDR(list)) { + ochar = CAR(list); + if (SCHARP(ochar) && string[end] == SCHAR_VALUE(ochar)) + break; + } + if (!CONSP(list)) + break; + } + ++end; + } + } - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + if (start == 0 && end == length) + return (ostring); - string1 += start1; - string2 += start2; + length = end - start; - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) { - ch1 = toupper(*string1); - ch2 = toupper(*string2); - if (ch1 < ch2) - return (REAL(c1)); - else if (ch1 != ch2) - break; + if (inplace) { + CHECK_STRING_WRITABLE(ostring); + memmove(string, string + start, length); + string[length] = '\0'; + STRLEN(ostring) = length; + } + else { + string = LispMalloc(length + 1); + memcpy(string, THESTR(ostring) + start, length); + string[length] = '\0'; + ostring = LSTRING2((char*)string, length); } - return (NIL); + return (ostring); } LispObj * -Lisp_StringGreaterp(LispMac *mac, LispObj *list, char *fname) +Lisp_StringTrim(LispBuiltin *builtin) +/* + string-trim character-bag string + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2, ch1, ch2; + return (LispStringTrim(builtin, 1, 1, 0)); +} - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); +LispObj * +Lisp_NstringTrim(LispBuiltin *builtin) +/* + ext::nstring-trim character-bag string + */ +{ + return (LispStringTrim(builtin, 1, 1, 1)); +} - string1 += start1; - string2 += start2; +LispObj * +Lisp_StringLeftTrim(LispBuiltin *builtin) +/* + string-left-trim character-bag string + */ +{ + return (LispStringTrim(builtin, 1, 0, 0)); +} - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) { - ch1 = toupper(*string1); - ch2 = toupper(*string2); - if (ch1 > ch2) - return (REAL(c1)); - else if (ch1 != ch2) - break; - } +LispObj * +Lisp_NstringLeftTrim(LispBuiltin *builtin) +/* + ext::nstring-left-trim character-bag string + */ +{ + return (LispStringTrim(builtin, 1, 0, 1)); +} - return (NIL); +LispObj * +Lisp_StringRightTrim(LispBuiltin *builtin) +/* + string-right-trim character-bag string + */ +{ + return (LispStringTrim(builtin, 0, 1, 0)); } LispObj * -Lisp_StringNotGreaterp(LispMac *mac, LispObj *list, char *fname) +Lisp_NstringRightTrim(LispBuiltin *builtin) +/* + ext::nstring-right-trim character-bag string + */ +{ + return (LispStringTrim(builtin, 0, 1, 1)); +} + +static LispObj * +LispStringCompare(LispBuiltin *builtin, int function, int ignore_case) { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2, ch1, ch2; + int cmp1, cmp2; + LispObj *fixnum; + unsigned char *string1, *string2; + long start1, end1, start2, end2, offset, length; - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); + LispGetStringArgs(builtin, (char**)&string1, (char**)&string2, + &start1, &end1, &start2, &end2); string1 += start1; string2 += start2; + + if (function == CHAR_EQUAL) { + length = end1 - start1; - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) { - ch1 = toupper(*string1); - ch2 = toupper(*string2); - if (ch1 < ch2) - return (REAL(c1)); - else if (ch1 != ch2) + if (length != (end2 - start2)) return (NIL); - else if (!*string1) - break; + + if (!ignore_case) + return (memcmp(string1, string2, length) ? NIL : T); + + for (; length; length--, string1++, string2++) + if (toupper(*string1) != toupper(*string2)) + return (NIL); + return (T); } - return (REAL(c1)); + end1 -= start1; + end2 -= start2; + length = MIN(end1, end2); + for (offset = 0; + offset < length; + string1++, string2++, offset++, start1++, start2++) { + cmp1 = *string1; + cmp2 = *string2; + if (ignore_case) { + cmp1 = toupper(cmp1); + cmp2 = toupper(cmp2); + } + if (cmp1 != cmp2) { + fixnum = FIXNUM(start1); + switch (function) { + case CHAR_LESS: + return ((cmp1 < cmp2) ? fixnum : NIL); + case CHAR_LESS_EQUAL: + return ((cmp1 <= cmp2) ? fixnum : NIL); + case CHAR_NOT_EQUAL: + return (fixnum); + case CHAR_GREATER_EQUAL: + return ((cmp1 >= cmp2) ? fixnum : NIL); + case CHAR_GREATER: + return ((cmp1 > cmp2) ? fixnum : NIL); + } + } + } + + fixnum = FIXNUM(start1); + switch (function) { + case CHAR_LESS: + return (start1 >= end1 && start2 < end2 ? fixnum : NIL); + case CHAR_LESS_EQUAL: + return (start1 >= end1 ? fixnum : NIL); + case CHAR_NOT_EQUAL: + return (start1 >= end1 && start2 >= end2 ? NIL : fixnum); + case CHAR_GREATER_EQUAL: + return (start2 >= end2 ? fixnum : NIL); + case CHAR_GREATER: + return (start2 >= end2 && start1 < end1 ? fixnum : NIL); + } + + return (NIL); } LispObj * -Lisp_StringNotLessp(LispMac *mac, LispObj *list, char *fname) +Lisp_StringEqual_(LispBuiltin *builtin) +/* + string= string1 string2 &key start1 end1 start2 end2 + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2, ch1, ch2; + return (LispStringCompare(builtin, CHAR_EQUAL, 0)); +} - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); +LispObj * +Lisp_StringLess(LispBuiltin *builtin) +/* + string< string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_LESS, 0)); +} - string1 += start1; - string2 += start2; +LispObj * +Lisp_StringGreater(LispBuiltin *builtin) +/* + string> string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_GREATER, 0)); +} - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) { - ch1 = toupper(*string1); - ch2 = toupper(*string2); - if (ch1 > ch2) - return (REAL(c1)); - else if (ch1 != ch2) - return (NIL); - else if (!*string1) - break; - } +LispObj * +Lisp_StringLessEqual(LispBuiltin *builtin) +/* + string<= string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_LESS_EQUAL, 0)); +} - return (REAL(c1)); +LispObj * +Lisp_StringGreaterEqual(LispBuiltin *builtin) +/* + string>= string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_GREATER_EQUAL, 0)); } LispObj * -Lisp_StringNotEqual(LispMac *mac, LispObj *list, char *fname) +Lisp_StringNotEqual_(LispBuiltin *builtin) +/* + string/= string1 string2 &key start1 end1 start2 end2 + */ { - char *string1, *string2; - int start1, end1, start2, end2, c1, c2; + return (LispStringCompare(builtin, CHAR_NOT_EQUAL, 0)); +} - _LispGetStringArgs(mac, list, fname, &string1, &string2, - &start1, &end1, &start2, &end2); +LispObj * +Lisp_StringEqual(LispBuiltin *builtin) +/* + string-equal string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_EQUAL, 1)); +} - string1 += start1; - string2 += start2; +LispObj * +Lisp_StringLessp(LispBuiltin *builtin) +/* + string-lessp string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_LESS, 1)); +} - for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; - c1++, c2++, string1++, string2++) - if (toupper(*string1) != toupper(*string2)) - return (REAL(c1)); +LispObj * +Lisp_StringGreaterp(LispBuiltin *builtin) +/* + string-greaterp string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_GREATER, 1)); +} - return (NIL); +LispObj * +Lisp_StringNotGreaterp(LispBuiltin *builtin) +/* + string-not-greaterp string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_LESS_EQUAL, 1)); +} + +LispObj * +Lisp_StringNotLessp(LispBuiltin *builtin) +/* + string-not-lessp string1 string2 &key start1 end1 start2 end2 + */ +{ + return (LispStringCompare(builtin, CHAR_GREATER_EQUAL, 1)); } LispObj * -Lisp_StringUpcase(LispMac *mac, LispObj *list, char *fname) +Lisp_StringNotEqual(LispBuiltin *builtin) +/* + string-not-equal string1 string2 &key start1 end1 start2 end2 + */ { - LispObj *res; - char *string, *str; - int start, end, c, done; + return (LispStringCompare(builtin, CHAR_NOT_EQUAL, 1)); +} - _LispGetStringCaseArgs(mac, list, fname, &string, &start, &end); +LispObj * +LispStringUpcase(LispBuiltin *builtin, int inplace) +/* + string-upcase string &key start end + nstring-upcase string &key start end + */ +{ + LispObj *result; + char *string, *newstring; + long start, end, length, offset; + + LispObj *ostring, *ostart, *oend; + + oend = ARGUMENT(2); + ostart = ARGUMENT(1); + ostring = ARGUMENT(0); + CHECK_STRING(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &offset); + result = ostring; + string = THESTR(ostring); + length = STRLEN(ostring); /* first check if something need to be done */ - for (done = 1, c = start; c < end; c++) - if (string[c] != toupper(string[c])) { - done = 0; + for (offset = start; offset < end; offset++) + if (string[offset] != toupper(string[offset])) break; - } - if (done) - return (CAR(list)); + if (offset >= end) + return (result); - /* upcase a copy of argument */ - str = LispStrdup(mac, string); - for (c = start; c < end; c++) - str[c] = toupper(str[c]); + if (inplace) { + CHECK_STRING_WRITABLE(ostring); + newstring = string; + } + else { + /* upcase a copy of argument */ + newstring = LispMalloc(length + 1); + if (offset) + memcpy(newstring, string, offset); + if (length > end) + memcpy(newstring + end, string + end, length - end); + newstring[length] = '\0'; + } - res = STRING(str); - LispFree(mac, str); + for (; offset < end; offset++) + newstring[offset] = toupper(string[offset]); - return (res); + if (!inplace) + result = LSTRING2(newstring, length); + + return (result); } LispObj * -Lisp_StringDowncase(LispMac *mac, LispObj *list, char *fname) +Lisp_StringUpcase(LispBuiltin *builtin) +/* + string-upcase string &key start end + */ { - LispObj *res; - char *string, *str; - int start, end, c, done; + return (LispStringUpcase(builtin, 0)); +} + +LispObj * +Lisp_NstringUpcase(LispBuiltin *builtin) +/* + nstring-upcase string &key start end + */ +{ + return (LispStringUpcase(builtin, 1)); +} - _LispGetStringCaseArgs(mac, list, fname, &string, &start, &end); +LispObj * +LispStringDowncase(LispBuiltin *builtin, int inplace) +/* + string-downcase string &key start end + nstring-downcase string &key start end + */ +{ + LispObj *result; + char *string, *newstring; + long start, end, length, offset; + + LispObj *ostring, *ostart, *oend; + + oend = ARGUMENT(2); + ostart = ARGUMENT(1); + ostring = ARGUMENT(0); + CHECK_STRING(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &offset); + result = ostring; + string = THESTR(ostring); + length = STRLEN(ostring); /* first check if something need to be done */ - for (done = 1, c = start; c < end; c++) - if (string[c] != tolower(string[c])) { - done = 0; + for (offset = start; offset < end; offset++) + if (string[offset] != tolower(string[offset])) break; - } - if (done) - return (CAR(list)); + if (offset >= end) + return (result); - /* downcase a copy of argument */ - str = LispStrdup(mac, string); - for (c = start; c < end; c++) - str[c] = tolower(str[c]); + if (inplace) { + CHECK_STRING_WRITABLE(ostring); + newstring = string; + } + else { + /* downcase a copy of argument */ + newstring = LispMalloc(length + 1); + if (offset) + memcpy(newstring, string, offset); + if (length > end) + memcpy(newstring + end, string + end, length - end); + newstring[length] = '\0'; + } + for (; offset < end; offset++) + newstring[offset] = tolower(string[offset]); - res = STRING(str); - LispFree(mac, str); + if (!inplace) + result = LSTRING2(newstring, length); - return (res); + return (result); } LispObj * -Lisp_StringCapitalize(LispMac *mac, LispObj *list, char *fname) +Lisp_StringDowncase(LispBuiltin *builtin) +/* + string-downcase string &key start end + */ { - LispObj *res; - char *string, *str; - int start, end, c, done, up; + return (LispStringDowncase(builtin, 0)); +} - _LispGetStringCaseArgs(mac, list, fname, &string, &start, &end); +LispObj * +Lisp_NstringDowncase(LispBuiltin *builtin) +/* + nstring-downcase string &key start end + */ +{ + return (LispStringDowncase(builtin, 1)); +} +LispObj * +LispStringCapitalize(LispBuiltin *builtin, int inplace) +/* + string-capitalize string &key start end + nstring-capitalize string &key start end + */ +{ + LispObj *result; + char *string, *newstring; + long start, end, length, offset, upcase; + + LispObj *ostring, *ostart, *oend; + + oend = ARGUMENT(2); + ostart = ARGUMENT(1); + ostring = ARGUMENT(0); + CHECK_STRING(ostring); + LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, + &start, &end, &offset); + result = ostring; + string = THESTR(ostring); + length = STRLEN(ostring); + /* first check if something need to be done */ - for (done = up = 1, c = start; c < end; c++) { - if (up) { - if (!isalpha(string[c])) + for (upcase = 1, offset = start; offset < end; offset++) { + if (upcase) { + if (!isalnum(string[offset])) continue; - if (string[c] != toupper(string[c])) { - done = 0; + if (string[offset] != toupper(string[offset])) break; - } - up = 0; + upcase = 0; } else { - if (isalpha(string[c])) { - if (string[c] != tolower(string[c])) { - done = 0; + if (isalnum(string[offset])) { + if (string[offset] != tolower(string[offset])) break; - } } else - up = 1; + upcase = 1; } } - if (done) - return (CAR(list)); + if (offset >= end) + return (result); - /* capitalize a copy of argument */ - str = LispStrdup(mac, string); - for (up = 1, c = start; c < end; c++) { - if (up) { - if (!isalpha(str[c])) + if (inplace) { + CHECK_STRING_WRITABLE(ostring); + newstring = string; + } + else { + /* capitalize a copy of argument */ + newstring = LispMalloc(length + 1); + memcpy(newstring, string, length); + newstring[length] = '\0'; + } + for (; offset < end; offset++) { + if (upcase) { + if (!isalnum(string[offset])) continue; - str[c] = toupper(str[c]); - up = 0; + newstring[offset] = toupper(string[offset]); + upcase = 0; } else { - if (isalpha(string[c])) - str[c] = tolower(str[c]); + if (isalnum(newstring[offset])) + newstring[offset] = tolower(string[offset]); else - up = 1; + upcase = 1; } } + + if (!inplace) + result = LSTRING2(newstring, length); + + return (result); +} + +LispObj * +Lisp_StringCapitalize(LispBuiltin *builtin) +/* + string-capitalize string &key start end + */ +{ + return (LispStringCapitalize(builtin, 0)); +} + +LispObj * +Lisp_NstringCapitalize(LispBuiltin *builtin) +/* + nstring-capitalize string &key start end + */ +{ + return (LispStringCapitalize(builtin, 1)); +} + +LispObj * +Lisp_StringConcat(LispBuiltin *builtin) +/* + string-concat &rest strings + */ +{ + char *buffer; + long size, length; + LispObj *object, *string; + + LispObj *strings; + + strings = ARGUMENT(0); + + if (strings == NIL) + return (STRING("")); + + for (length = 1, object = strings; CONSP(object); object = CDR(object)) { + string = CAR(object); + CHECK_STRING(string); + length += STRLEN(string); + } - res = STRING(str); - LispFree(mac, str); + buffer = LispMalloc(length); + + for (length = 0, object = strings; CONSP(object); object = CDR(object)) { + string = CAR(object); + size = STRLEN(string); + memcpy(buffer + length, THESTR(string), size); + length += size; + } + buffer[length] = '\0'; + object = LSTRING2(buffer, length); - return (res); + return (object); } Index: xc/programs/xedit/lisp/string.h diff -u xc/programs/xedit/lisp/string.h:1.2 xc/programs/xedit/lisp/string.h:1.11 --- xc/programs/xedit/lisp/string.h:1.2 Wed Oct 17 23:15:22 2001 +++ xc/programs/xedit/lisp/string.h Sun Nov 24 21:35:30 2002 @@ -27,51 +27,69 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/string.h,v 1.2 2001/10/18 03:15:22 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/string.h,v 1.11 2002/11/25 02:35:30 paulo Exp $ */ #ifndef Lisp_string_h #define Lisp_string_h #include "internal.h" -LispObj *Lisp_Char(LispMac*, LispObj*, char*); /* char */ -LispObj *Lisp_CharLess(LispMac*, LispObj*, char*); /* char< */ -LispObj *Lisp_CharLessEqual(LispMac*, LispObj*, char*); /* char<= */ -LispObj *Lisp_CharEqual_(LispMac*, LispObj*, char*); /* char= */ -LispObj *Lisp_CharGreater(LispMac*, LispObj*, char*); /* char> */ -LispObj *Lisp_CharGreaterEqual(LispMac*, LispObj*, char*); /* char>= */ -LispObj *Lisp_CharNotEqual_(LispMac*, LispObj*, char*); /* char/= */ -LispObj *Lisp_CharLessp(LispMac*, LispObj*, char*); /* char-lessp */ -LispObj *Lisp_CharNotGreaterp(LispMac*, LispObj*, char*); /* char-not-greaterp */ -LispObj *Lisp_CharEqual(LispMac*, LispObj*, char*); /* char-equal */ -LispObj *Lisp_CharGreaterp(LispMac*, LispObj*, char*); /* char-greaterp */ -LispObj *Lisp_CharNotLessp(LispMac*, LispObj*, char*); /* char-not-lessp */ -LispObj *Lisp_CharNotEqual(LispMac*, LispObj*, char*); /* char-not-equal */ -LispObj *Lisp_Character(LispMac*, LispObj*, char*); /* character */ -LispObj *Lisp_CharDowncase(LispMac*, LispObj*, char*); /* char-downcase */ -LispObj *Lisp_CharInt(LispMac*, LispObj*, char*); /* char-int */ -LispObj *Lisp_CharUpcase(LispMac*, LispObj*, char*); /* char-upcase */ -LispObj *Lisp_IntChar(LispMac*, LispObj*, char*); /* int-char */ -LispObj *Lisp_ReadFromString(LispMac*, LispObj*, char*); /* read-from-string */ -LispObj *Lisp_String(LispMac*, LispObj*, char*); /* string */ -LispObj *Lisp_StringTrim(LispMac*, LispObj*, char*); /* string-trim */ -LispObj *Lisp_StringLeftTrim(LispMac*, LispObj*, char*); /* string-left-trim */ -LispObj *Lisp_StringRightTrim(LispMac*, LispObj*, char*); /* string-right-trim */ -LispObj *Lisp_StringEqual_(LispMac*, LispObj*, char*); /* string= */ -LispObj *Lisp_StringLess(LispMac*, LispObj*, char*); /* string< */ -LispObj *Lisp_StringGreater(LispMac*, LispObj*, char*); /* string> */ -LispObj *Lisp_StringLessEqual(LispMac*, LispObj*, char*); /* string<= */ -LispObj *Lisp_StringGreaterEqual(LispMac*, LispObj*, char*);/* string>= */ -LispObj *Lisp_StringNotEqual_(LispMac*, LispObj*, char*); /* string/= */ -LispObj *Lisp_StringEqual(LispMac*, LispObj*, char*); /* string-equal */ -LispObj *Lisp_StringGreaterp(LispMac*, LispObj*, char*); /* string-greaterp */ -LispObj *Lisp_StringLessp(LispMac*, LispObj*, char*); /* string-lessp */ -LispObj *Lisp_StringNotLessp(LispMac*, LispObj*, char*); /* string-not-lessp */ -LispObj *Lisp_StringNotGreaterp(LispMac*, LispObj*, char*); /* string-not-greaterp */ -LispObj *Lisp_StringNotEqual(LispMac*, LispObj*, char*); /* string-not-equal */ -LispObj *Lisp_StringUpcase(LispMac*, LispObj*, char*); /* string-upcase */ -LispObj *Lisp_StringDowncase(LispMac*, LispObj*, char*); /* string-downcase */ -LispObj *Lisp_StringCapitalize(LispMac*, LispObj*, char*); /* string-capitalize */ -LispObj *Lisp_XeditCharStore(LispMac*, LispObj*, char*); /* xedit::char-store */ +LispObj *Lisp_AlphaCharP(LispBuiltin*); +LispObj *Lisp_BothCaseP(LispBuiltin*); +LispObj *Lisp_Char(LispBuiltin*); +LispObj *Lisp_CharLess(LispBuiltin*); +LispObj *Lisp_CharLessEqual(LispBuiltin*); +LispObj *Lisp_CharEqual_(LispBuiltin*); +LispObj *Lisp_CharGreater(LispBuiltin*); +LispObj *Lisp_CharGreaterEqual(LispBuiltin*); +LispObj *Lisp_CharNotEqual_(LispBuiltin*); +LispObj *Lisp_CharLessp(LispBuiltin*); +LispObj *Lisp_CharNotGreaterp(LispBuiltin*); +LispObj *Lisp_CharEqual(LispBuiltin*); +LispObj *Lisp_CharGreaterp(LispBuiltin*); +LispObj *Lisp_CharNotLessp(LispBuiltin*); +LispObj *Lisp_CharNotEqual(LispBuiltin*); +LispObj *Lisp_Character(LispBuiltin*); +LispObj *Lisp_Characterp(LispBuiltin*); +LispObj *Lisp_CharDowncase(LispBuiltin*); +LispObj *Lisp_CharInt(LispBuiltin*); +LispObj *Lisp_CharUpcase(LispBuiltin*); +LispObj *Lisp_DigitChar(LispBuiltin*); +LispObj *Lisp_DigitCharP(LispBuiltin*); +LispObj *Lisp_IntChar(LispBuiltin*); +LispObj *Lisp_GraphicCharP(LispBuiltin*); +LispObj *Lisp_LowerCaseP(LispBuiltin*); +LispObj *Lisp_MakeString(LispBuiltin*); +LispObj *Lisp_ParseInteger(LispBuiltin*); +LispObj *Lisp_ReadFromString(LispBuiltin*); +LispObj *Lisp_String(LispBuiltin*); +LispObj *Lisp_Stringp(LispBuiltin*); +LispObj *Lisp_StringTrim(LispBuiltin*); +LispObj *Lisp_StringLeftTrim(LispBuiltin*); +LispObj *Lisp_StringRightTrim(LispBuiltin*); +LispObj *Lisp_NstringTrim(LispBuiltin*); +LispObj *Lisp_NstringLeftTrim(LispBuiltin*); +LispObj *Lisp_NstringRightTrim(LispBuiltin*); +LispObj *Lisp_StringEqual_(LispBuiltin*); +LispObj *Lisp_StringLess(LispBuiltin*); +LispObj *Lisp_StringGreater(LispBuiltin*); +LispObj *Lisp_StringLessEqual(LispBuiltin*); +LispObj *Lisp_StringGreaterEqual(LispBuiltin*); +LispObj *Lisp_StringNotEqual_(LispBuiltin*); +LispObj *Lisp_StringEqual(LispBuiltin*); +LispObj *Lisp_StringGreaterp(LispBuiltin*); +LispObj *Lisp_StringLessp(LispBuiltin*); +LispObj *Lisp_StringNotLessp(LispBuiltin*); +LispObj *Lisp_StringNotGreaterp(LispBuiltin*); +LispObj *Lisp_StringNotEqual(LispBuiltin*); +LispObj *Lisp_NstringUpcase(LispBuiltin*); +LispObj *Lisp_StringUpcase(LispBuiltin*); +LispObj *Lisp_StringDowncase(LispBuiltin*); +LispObj *Lisp_NstringDowncase(LispBuiltin*); +LispObj *Lisp_StringCapitalize(LispBuiltin*); +LispObj *Lisp_NstringCapitalize(LispBuiltin*); +LispObj *Lisp_StringConcat(LispBuiltin*); +LispObj *Lisp_UpperCaseP(LispBuiltin*); +LispObj *Lisp_XeditCharStore(LispBuiltin*); -#endif /* Lisp_String_h */ +#endif /* Lisp_string_h */ Index: xc/programs/xedit/lisp/struct.c diff -u xc/programs/xedit/lisp/struct.c:1.5 xc/programs/xedit/lisp/struct.c:1.22 --- xc/programs/xedit/lisp/struct.c:1.5 Sat Oct 27 23:34:31 2001 +++ xc/programs/xedit/lisp/struct.c Sat Nov 23 03:26:50 2002 @@ -27,244 +27,344 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/struct.c,v 1.5 2001/10/28 03:34:31 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/struct.c,v 1.22 2002/11/23 08:26:50 paulo Exp $ */ #include "struct.h" /* + * Prototypes + */ +static LispObj *LispStructAccessOrStore(LispBuiltin*, int); + +/* + * Initialization + */ +LispObj *Omake_struct, *Ostruct_access, *Ostruct_store, *Ostruct_type; + +Atom_id Smake_struct, Sstruct_access, Sstruct_store, Sstruct_type; + +/* * Implementation */ LispObj * -Lisp_Defstruct(LispMac *mac, LispObj *list, char *fname) +Lisp_Defstruct(LispBuiltin *builtin) +/* + defstruct name &rest description + */ { + int intern; LispAtom *atom; - int i, sz, len, slen; + int i, size, length, slength; char *name, *strname, *sname; - LispObj *str = list, *obj; + LispObj *list, *cons, *object, *definition, *documentation; + + LispObj *oname, *description; + + description = ARGUMENT(1); + oname = ARGUMENT(0); + + CHECK_SYMBOL(oname); + + strname = ATOMID(oname); + length = strlen(strname); + + /* MAKE- */ + size = length + 6; + name = LispMalloc(size); + + sprintf(name, "MAKE-%s", strname); + atom = (object = ATOM(name))->data.atom; - /* get structure name */ - if (!SYMBOL_P(CAR(list)) || - /* reserved name(s) */ - strcmp(STRPTR(CAR(list)), "ARRAY") == 0) - LispDestroy(mac, "%s cannot be a structure name, at %s", - LispStrObj(mac, CAR(list)), fname); + if (atom->a_builtin) + LispDestroy("%s: %s cannot be a structure name", + STRFUN(builtin), STROBJ(oname)); - strname = STRPTR(CAR(list)); - len = strlen(strname); + intern = !atom->ext; + if (CONSP(description) && STRINGP(CAR(description))) { + documentation = CAR(description); + description = CDR(description); + } + else + documentation = NIL; + /* get structure fields and default values */ - for (list = CDR(list); list != NIL; list = CDR(list)) { - if ((!SYMBOL_P(CAR(list)) && - /* if not field name, with NIL as default value */ - (CAR(list)->type != LispCons_t || - !SYMBOL_P(CAR(CAR(list))))) || - /* and not a pair, with field name and default value */ - STRPTR(CAR(list))[0] == ':' || - /* and it is a valid field name */ - strcmp(STRPTR(CAR(list)), "P") == 0) + for (list = description; CONSP(list); list = CDR(list)) { + object = CAR(list); + + cons = list; + if (CONSP(object)) { + if ((CONSP(CDR(object)) && CDR(CDR(object)) != NIL) || + (!CONSP(CDR(object)) && CDR(object) != NIL)) + LispDestroy("%s: bad initialization %s", + STRFUN(builtin), STROBJ(object)); + cons = object; + object = CAR(object); + } + if (!SYMBOLP(object) || strcmp(ATOMID(object), "P") == 0) /* p is invalid as a field name due to `type'-p */ - LispDestroy(mac, "%s cannot be a field for %s, at %s", - LispStrObj(mac, CAR(list)), STRPTR(CAR(str)), fname); + LispDestroy("%s: %s cannot be a field for %s", + STRFUN(builtin), STROBJ(object), ATOMID(oname)); + + if (!KEYWORDP(object)) + CAR(cons) = KEYWORD(ATOMID(object)); /* check for repeated field names */ - for (obj = CDR(str); obj != list; obj = CDR(obj)) { - if (STRPTR(CAR(obj)) == STRPTR(CAR(list))) - LispDestroy(mac, "only one slot named :%s allowed, at %s", - LispStrObj(mac, CAR(obj)), fname); + for (object = description; object != list; object = CDR(object)) { + LispObj *left = CAR(object), *right = CAR(list); + + if (CONSP(left)) + left = CAR(left); + if (CONSP(right)) + right = CAR(right); + + if (ATOMID(left) == ATOMID(right)) + LispDestroy("%s: only one slot named %s allowed", + STRFUN(builtin), STROBJ(left)); } } - - /* XXX any memory allocation failure below should be a fatal error */ - /* MAKE- */ - sz = len + 6; - name = LispMalloc(mac, sz); + /* atom should not have been modified */ + definition = CONS(oname, description); + LispSetAtomStructProperty(atom, definition, STRUCT_CONSTRUCTOR); + if (!intern) + LispExportSymbol(object); + + atom = oname->data.atom; + if (atom->a_defstruct) + LispWarning("%s: structure %s is being redefined", + STRFUN(builtin), strname); + LispSetAtomStructProperty(atom, definition, STRUCT_NAME); - sprintf(name, "MAKE-%s", strname); - atom = ATOM(name)->data.atom; - LispSetAtomStructProperty(mac, atom, str, STRUCT_CONSTRUCTOR); - sprintf(name, "%s-P", strname); - atom = ATOM(name)->data.atom; - LispSetAtomStructProperty(mac, atom, str, STRUCT_CHECK); - - for (i = 0, list = CDR(str); list != NIL; i++, list = CDR(list)) { - sname = STRPTR(CAR(list)); - slen = strlen(sname); - if (len + slen + 2 > sz) { - sz = len + slen + 2; - name = LispRealloc(mac, name, sz); + atom = (object = ATOM(name))->data.atom; + LispSetAtomStructProperty(atom, definition, STRUCT_CHECK); + if (!intern) + LispExportSymbol(object); + + for (i = 0, list = description; CONSP(list); i++, list = CDR(list)) { + if (CONSP(CAR(list))) + sname = ATOMID(CAR(CAR(list))); + else + sname = ATOMID(CAR(list)); + slength = strlen(sname); + if (length + slength + 2 > size) { + size = length + slength + 2; + name = LispRealloc(name, size); } sprintf(name, "%s-%s", strname, sname); - atom = ATOM(name)->data.atom; - LispSetAtomStructProperty(mac, atom, str, i); + atom = (object = ATOM(name))->data.atom; + LispSetAtomStructProperty(atom, definition, i); + if (!intern) + LispExportSymbol(object); } - LispFree(mac, name); + LispFree(name); - atom = CAR(str)->data.atom; - if (atom->property && atom->property->defstruct) - fprintf(lisp_stderr, "*** Warning: structure %s is being redefined\n", - strname); + if (documentation != NIL) + LispAddDocumentation(oname, documentation, LispDocStructure); - return (CAR(str)); + return (oname); } /* helper functions * DONT explicitly call them. Non standard functions. */ LispObj * -Lisp_XeditMakeStruct(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditMakeStruct(LispBuiltin *builtin) +/* + lisp::make-struct atom &rest init + */ { - int count; + int nfld, ncvt, length = lisp__data.protect.length; LispAtom *atom = NULL; - LispObj *obj, *str = CAR(list), *fld, *nam, *val, *frm; - if (!SYMBOL_P(str) || - (atom = str->data.atom)->property == NULL || - atom->property->defstruct == 0 || - atom->property->structure.function != STRUCT_CONSTRUCTOR) - LispDestroy(mac, "invalid arguments, at %s", fname); - str = atom->property->structure.definition; - - fld = NIL; - frm = FRM; - - /* create structure fields, using default initial values */ - for (obj = CDR(str); obj != NIL; obj = CDR(obj)) { - if (SYMBOL_P(CAR(obj))) - val = NIL; - else - val = EVAL(CAR(CDR(CAR(obj)))); + LispObj *definition, *object, *field, *fields, *value = NIL, *cons, *list; + LispObj *struc, *init; - if (fld == NIL) { - GCProtect(); - fld = CONS(val, NIL); - FRM = CONS(fld, FRM); /* GC protect fld linking to FRM */ - GCUProtect(); - } - else { - CDR(fld) = CONS(CAR(fld), CDR(fld)); - CAR(fld) = val; - } + init = ARGUMENT(1); + struc = ARGUMENT(0); + + field = cons = NIL; + if (!POINTERP(struc) || + !(XSYMBOLP(struc) || XFUNCTIONP(struc)) || + (atom = struc->data.atom)->a_defstruct == 0 || + atom->property->structure.function != STRUCT_CONSTRUCTOR) + LispDestroy("%s: invalid constructor %s", + STRFUN(builtin), STROBJ(struc)); + definition = atom->property->structure.definition; + + ncvt = nfld = 0; + fields = NIL; + + /* check for errors in argument list */ + for (list = init, nfld = 0; CONSP(list); list = CDR(list)) { + CHECK_KEYWORD(CAR(list)); + if (!CONSP(CDR(list))) + LispDestroy("%s: values must be provided as pairs", + ATOMID(struc)); + nfld++; + list = CDR(list); } - fld = CAR(FRM) = LispReverse(fld); - for (list = CDR(list); list != NIL; list = CDR(list)) { - if ((nam = EVAL(CAR(list)))->type != LispAtom_t || - STRPTR(nam)[0] != ':') - LispDestroy(mac, "%s is a illegal field for %s", - LispStrObj(mac, nam), fname); - - /* check if field name is a valid field name */ - for (count = 0, obj = CDR(str); obj != NIL; ++count, obj = CDR(obj)) { - if ((SYMBOL_P(CAR(obj)) && - strcmp(STRPTR(CAR(obj)), STRPTR(nam) + 1) == 0) || - (CAR(obj)->type == LispCons_t && - strcmp(STRPTR(CAR(CAR(obj))), STRPTR(nam) + 1) == 0)) - break; + /* create structure, CAR(definition) is structure name */ + for (list = CDR(definition); CONSP(list); list = CDR(list)) { + Atom_id id; + LispObj *defvalue = NIL; + + ++nfld; + field = CAR(list); + if (CONSP(field)) { + /* if default value provided */ + if (CONSP(CDR(field))) + defvalue = CAR(CDR(field)); + field = CAR(field); } + id = ATOMID(field); - /* check if structure has named field */ - if (obj == NIL) - LispDestroy(mac, ":%s is not a %s field, at %s", - STRPTR(nam), STRPTR(CAR(str)), fname); + for (object = init; CONSP(object); object = CDR(object)) { + /* field is a keyword, test above checked it */ + field = CAR(object); + if (id == ATOMID(field)) { + /* value provided */ + value = CAR(CDR(object)); + ncvt++; + break; + } + object = CDR(object); + } - /* value supplied? */ - if ((list = CDR(list)) == NIL) - LispDestroy(mac, "expecting value for field, at %s", fname); + /* if no initialization given */ + if (!CONSP(object)) { + /* if default value in structure definition */ + if (defvalue != NIL) + value = EVAL(defvalue); + else + value = NIL; + } - /* set structure field value */ - for (obj = fld; count; obj = CDR(obj)) - --count; - if (obj->prot == LispNil_t) { - CAR(obj) = CAR(list); - /* set value only if the first time */ - obj->prot = LispTrue_t; + if (fields == NIL) { + fields = cons = CONS(value, NIL); + if (length + 1 >= lisp__data.protect.space) + LispMoreProtects(); + lisp__data.protect.objects[lisp__data.protect.length++] = fields; + } + else { + RPLACD(cons, CONS(value, NIL)); + cons = CDR(cons); } } - /* clean protect flag */ - for (obj = fld; obj != NIL; obj = CDR(obj)) - obj->prot = LispNil_t; + /* if not enough arguments were converted, need to check because + * it is acceptable to set a field more than once, but in that case, + * only the first value will be used. */ + if (nfld > ncvt) { + for (list = init; CONSP(list); list = CDR(list)) { + Atom_id id = ATOMID(CAR(list)); + + for (object = CDR(definition); CONSP(object); + object = CDR(object)) { + field = CAR(object); + if (CONSP(field)) + field = CAR(field); + if (ATOMID(field) == id) + break; + } + if (!CONSP(object)) + LispDestroy("%s: %s is not a field for %s", + ATOMID(struc), STROBJ(CAR(list)), + ATOMID(CAR(definition))); + list = CDR(list); + } + } - FRM = frm; /* GC Uprotect fld */ + lisp__data.protect.length = length; - return (STRUCT(fld, str)); + return (STRUCT(fields, definition)); } -LispObj * -Lisp_XeditStructAccess(LispMac *mac, LispObj *list, char *fname) +static LispObj * +LispStructAccessOrStore(LispBuiltin *builtin, int store) +/* + lisp::struct-access atom struct + lisp::struct-store atom struct value + */ { - int len = 0; - LispAtom *atom = NULL; - LispObj *str = CAR(list), *obj = CAR(CDR(list)); + long offset; + LispAtom *atom; + LispObj *definition, *list; - if (!SYMBOL_P(str) || - (atom = str->data.atom)->property == NULL || - atom->property->defstruct == 0 || - (len = atom->property->structure.function) < 0) - LispDestroy(mac, "invalid arguments, at %s", fname); - str = atom->property->structure.definition; + LispObj *name, *struc, *value = NIL; + + if (store) + value = ARGUMENT(2); + struc = ARGUMENT(1); + name = ARGUMENT(0); + + if (!POINTERP(name) || + !(XSYMBOLP(name) || XFUNCTIONP(name)) || + (atom = name->data.atom)->a_defstruct == 0 || + (offset = atom->property->structure.function) < 0) { + LispDestroy("%s: invalid argument %s", + STRFUN(builtin), STROBJ(name)); + /*NOTREACHED*/ + offset = 0; + atom = NULL; + } + definition = atom->property->structure.definition; /* check if the object is of the required type */ - if (obj->type != LispStruct_t || obj->data.struc.def != str) - LispDestroy(mac, "%s is not a %s", - LispStrObj(mac, obj), STRPTR(CAR(str))); + if (!STRUCTP(struc) || struc->data.struc.def != definition) + LispDestroy("%s: %s is not a %s", + ATOMID(name), STROBJ(struc), ATOMID(CAR(definition))); - for (obj = CAR(obj); len; obj = CDR(obj)) - --len; + for (list = struc->data.struc.fields; offset; list = CDR(list), offset--) + ; - return (CAR(obj)); + return (store ? RPLACA(list, value) : CAR(list)); } LispObj * -Lisp_XeditStructStore(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditStructAccess(LispBuiltin *builtin) +/* + lisp::struct-access atom struct + */ { - int len = 0; - LispAtom *atom = NULL; - LispObj *strdef, *str, *value; - - strdef = CAR(list); - list = CDR(list); - str = CAR(list); - list = CDR(list); - value = CAR(list); - - if (!SYMBOL_P(strdef) || - (atom = strdef->data.atom)->property == NULL || - atom->property->defstruct == 0 || - (len = atom->property->structure.function) < 0) - LispDestroy(mac, "invalid arguments, at %s", fname); - strdef = atom->property->structure.definition; - - /* check if the object is of the required type */ - if (str->type != LispStruct_t || str->data.struc.def != strdef) - LispDestroy(mac, "%s is not a %s", - LispStrObj(mac, str), - STRPTR(CAR(strdef))); - - for (str = CAR(str); len; str = CDR(str)) - --len; + return (LispStructAccessOrStore(builtin, 0)); +} - return (CAR(str) = value); +LispObj * +Lisp_XeditStructStore(LispBuiltin *builtin) +/* + lisp::struct-store atom struct value + */ +{ + return (LispStructAccessOrStore(builtin, 1)); } LispObj * -Lisp_XeditStructType(LispMac *mac, LispObj *list, char *fname) +Lisp_XeditStructType(LispBuiltin *builtin) +/* + lisp::struct-type atom struct + */ { LispAtom *atom = NULL; - LispObj *str = CAR(list), *obj = CAR(CDR(list)); + + LispObj *definition, *struc, *name; + + struc = ARGUMENT(1); + name = ARGUMENT(0); - if (!SYMBOL_P(str) || - (atom = str->data.atom)->property == NULL || - atom->property->defstruct == 0 || - atom->property->structure.function != STRUCT_CHECK) - LispDestroy(mac, "invalid arguments, at %s", fname); - str = atom->property->structure.definition; + if (!POINTERP(name) || + !(XSYMBOLP(name) || XFUNCTIONP(name)) || + (atom = name->data.atom)->a_defstruct == 0 || + (atom->property->structure.function != STRUCT_CHECK)) + LispDestroy("%s: invalid argument %s", + STRFUN(builtin), STROBJ(name)); + definition = atom->property->structure.definition; /* check if the object is of the required type */ - if (obj->type == LispStruct_t && obj->data.struc.def == str) + if (STRUCTP(struc) && struc->data.struc.def == definition) return (T); return (NIL); Index: xc/programs/xedit/lisp/struct.h diff -u xc/programs/xedit/lisp/struct.h:1.2 xc/programs/xedit/lisp/struct.h:1.6 --- xc/programs/xedit/lisp/struct.h:1.2 Wed Oct 17 23:15:23 2001 +++ xc/programs/xedit/lisp/struct.h Sun Nov 10 11:29:07 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/struct.h,v 1.2 2001/10/18 03:15:23 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/struct.h,v 1.6 2002/11/10 16:29:07 paulo Exp $ */ #ifndef Lisp_struct_h #define Lisp_struct_h @@ -37,15 +37,17 @@ /* * Defines */ -#define STRUCT(fields, def) LispNewStruct(mac, fields, def) +#define XSTRUCTP(object) ((object)->type == LispStruct_t) +#define STRUCTP(object) (POINTERP(object) && XSTRUCTP(object)) +#define STRUCT(fields, def) LispNewStruct(fields, def) /* * Prototypes */ -LispObj *Lisp_Defstruct(LispMac*, LispObj*, char*); /* defstruct */ -LispObj *Lisp_XeditMakeStruct(LispMac*, LispObj*, char*); /* xedit::make-struct */ -LispObj *Lisp_XeditStructAccess(LispMac*, LispObj*, char*);/* xedit::struct-access */ -LispObj *Lisp_XeditStructStore(LispMac*, LispObj*, char*); /* xedit::struct-store */ -LispObj *Lisp_XeditStructType(LispMac*, LispObj*, char*); /* xedit::struct-type */ +LispObj *Lisp_Defstruct(LispBuiltin*); +LispObj *Lisp_XeditMakeStruct(LispBuiltin*); +LispObj *Lisp_XeditStructAccess(LispBuiltin*); +LispObj *Lisp_XeditStructStore(LispBuiltin*); +LispObj *Lisp_XeditStructType(LispBuiltin*); #endif /* Lisp_struct_h */ Index: xc/programs/xedit/lisp/time.c diff -u xc/programs/xedit/lisp/time.c:1.2 xc/programs/xedit/lisp/time.c:1.7 --- xc/programs/xedit/lisp/time.c:1.2 Sun Sep 9 19:03:47 2001 +++ xc/programs/xedit/lisp/time.c Fri Nov 8 03:00:57 2002 @@ -27,21 +27,30 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/time.c,v 1.2 2001/09/09 23:03:47 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/time.c,v 1.7 2002/11/08 08:00:57 paulo Exp $ */ #include "time.h" +#include "bytecode.h" /* * Implementation */ LispObj * -Lisp_Time(LispMac *mac, LispObj *list, char *fname) +Lisp_Time(LispBuiltin *builtin) +/* + time form + */ { struct itimerval real, virt, prof; + unsigned long count; long sec, usec; - LispObj *res; + LispObj *result; #define MONTH 60 * 60 * 31 + LispObj *form; + + form = ARGUMENT(0); + real.it_value.tv_sec = virt.it_value.tv_sec = prof.it_value.tv_sec = @@ -63,8 +72,19 @@ getitimer(ITIMER_VIRTUAL, &virt); getitimer(ITIMER_PROF, &prof); - res = EVAL(CAR(list)); + lisp__data.gc.gctime = 0; + lisp__data.gc.timebits = 1; + count = lisp__data.gc.count; + +#if 0 + form = CONS(form, NIL); + COD = CONS(form, COD); + result = LispExecuteBytecode(LispCompileForm(form)); +#else + result = EVAL(form); +#endif + getitimer(ITIMER_REAL, &real); getitimer(ITIMER_VIRTUAL, &virt); getitimer(ITIMER_PROF, &prof); @@ -75,7 +95,7 @@ --sec; usec += 1000000; } - fprintf(lisp_stderr, "Real time : %g sec\n", sec + usec / 1000000.0); + LispMessage("Real time : %g sec", sec + usec / 1000000.0); sec = virt.it_interval.tv_sec - virt.it_value.tv_sec; usec = virt.it_interval.tv_usec - virt.it_value.tv_usec + 10000; @@ -83,7 +103,7 @@ --sec; usec += 1000000; } - fprintf(lisp_stderr, "Virtual time: %g sec\n", sec + usec / 1000000.0); + LispMessage("Virtual time: %g sec", sec + usec / 1000000.0); sec = prof.it_interval.tv_sec - prof.it_value.tv_sec; usec = prof.it_interval.tv_usec - prof.it_value.tv_usec + 10000; @@ -91,7 +111,7 @@ --sec; usec += 1000000; } - fprintf(lisp_stderr, "Profile time: %g sec\n", sec + usec / 1000000.0); + LispMessage("Profile time: %g sec", sec + usec / 1000000.0); real.it_value.tv_sec = virt.it_value.tv_sec = @@ -109,6 +129,10 @@ setitimer(ITIMER_REAL, &real, NULL); setitimer(ITIMER_VIRTUAL, &virt, NULL); setitimer(ITIMER_PROF, &prof, NULL); + + LispMessage("GC: %ld times, %g sec", + lisp__data.gc.count - count, lisp__data.gc.gctime / 1000000.0); + lisp__data.gc.timebits = 0; - return (res); + return (result); } Index: xc/programs/xedit/lisp/time.h diff -u xc/programs/xedit/lisp/time.h:1.1 xc/programs/xedit/lisp/time.h:1.3 --- xc/programs/xedit/lisp/time.h:1.1 Fri Aug 31 11:00:14 2001 +++ xc/programs/xedit/lisp/time.h Fri Nov 8 03:00:57 2002 @@ -27,13 +27,13 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/time.h,v 1.1 2001/08/31 15:00:14 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/time.h,v 1.3 2002/11/08 08:00:57 paulo Exp $ */ #ifndef Lisp_time_h #define Lisp_time_h #include "private.h" -LispObj *Lisp_Time(LispMac*, LispObj*, char*); /* time */ +LispObj *Lisp_Time(LispBuiltin*); #endif /* Lisp_time_h */ Index: xc/programs/xedit/lisp/write.c diff -u /dev/null xc/programs/xedit/lisp/write.c:1.30 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/write.c Wed Dec 4 13:43:19 2002 @@ -0,0 +1,2411 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/write.c,v 1.30 2002/12/04 18:43:19 paulo Exp $ */ + +#include "write.h" +#include "hash.h" +#include <math.h> +#include <ctype.h> + +#define FLOAT_PREC 17 + +#define UPCASE 0 +#define DOWNCASE 1 +#define CAPITALIZE 2 + +#define INCDEPTH() \ + if (++info->depth > MAX_STACK_DEPTH / 2) \ + LispDestroy("stack overflow") +#define DECDEPTH() --info->depth + +/* + * Types + */ +typedef struct _circle_info { + long circle_nth; /* nth circular list */ + LispObj *object; /* the circular object */ +} circle_info; + +typedef struct _write_info { + long depth; + long level; /* current level */ + long length; /* current length */ + long print_level; /* *print-level* when started printing */ + long print_length; /* *print-length* when started printing */ + + int print_escape; + int print_case; + + long circle_count; + /* used while building circle info */ + LispObj **objects; + long num_objects; + /* the circular lists */ + circle_info *circles; + long num_circles; +} write_info; + +/* + * Prototypes + */ +static void check_stream(LispObj*, LispFile**, LispString**, int); +static void parse_double(char*, int*, double, int); +static int float_string_inc(char*, int); +static void format_integer(char*, long, int); +static int LispWriteCPointer(LispObj*, void*); +static int LispWriteCString(LispObj*, char*, long, write_info*); +static int LispDoFormatExponentialFloat(LispObj*, LispObj*, + int, int, int*, int, int, + int, int, int, int); + +static int LispWriteInteger(LispObj*, LispObj*); +static int LispWriteCharacter(LispObj*, LispObj*, write_info*); +static int LispWriteString(LispObj*, LispObj*, write_info*); +static int LispWriteFloat(LispObj*, LispObj*); +static int LispWriteAtom(LispObj*, LispObj*, write_info*); +static int LispDoWriteAtom(LispObj*, char*, int, int); +static int LispWriteList(LispObj*, LispObj*, write_info*, int); +static int LispWriteArray(LispObj*, LispObj*, write_info*); +static int LispWriteStruct(LispObj*, LispObj*, write_info*); +static int LispDoWriteObject(LispObj*, LispObj*, write_info*, int); +static void LispBuildCircle(LispObj*, write_info*); +static void LispDoBuildCircle(LispObj*, write_info*); +static long LispCheckCircle(LispObj*, write_info*); +static int LispPrintCircle(LispObj*, LispObj*, long, int*, write_info*); +static int LispWriteAlist(LispObj*, LispArgList*, write_info*); + +/* + * Initialization + */ +LispObj *Oprint_level, *Oprint_length, *Oprint_circle, + *Oprint_escape, *Oprint_case; +LispObj *Kupcase, *Kdowncase, *Kcapitalize; + +/* + * Implementation + */ +void +LispWriteInit(void) +{ + Oprint_level = STATIC_ATOM("*PRINT-LEVEL*"); + LispProclaimSpecial(Oprint_level, NIL, NIL); + LispExportSymbol(Oprint_level); + + Oprint_length = STATIC_ATOM("*PRINT-LENGTH*"); + LispProclaimSpecial(Oprint_length, NIL, NIL); + LispExportSymbol(Oprint_length); + + Oprint_circle = STATIC_ATOM("*PRINT-CIRCLE*"); + LispProclaimSpecial(Oprint_circle, T, NIL); + LispExportSymbol(Oprint_circle); + + Oprint_escape = STATIC_ATOM("*PRINT-ESCAPE*"); + LispProclaimSpecial(Oprint_escape, T, NIL); + LispExportSymbol(Oprint_escape); + + Kupcase = KEYWORD("UPCASE"); + Kdowncase = KEYWORD("DOWNCASE"); + Kcapitalize = KEYWORD("CAPITALIZE"); + Oprint_case = STATIC_ATOM("*PRINT-CASE*"); + LispProclaimSpecial(Oprint_case, Kupcase, NIL); + LispExportSymbol(Oprint_case); +} + +LispObj * +Lisp_FreshLine(LispBuiltin *builtin) +/* + fresh-line &optional output-stream + */ +{ + LispObj *output_stream; + + output_stream = ARGUMENT(0); + + if (output_stream == UNSPEC) + output_stream = NIL; + else if (output_stream != NIL) { + CHECK_STREAM(output_stream); + } + if (LispGetColumn(output_stream)) { + LispWriteChar(output_stream, '\n'); + if (output_stream == NIL || + (output_stream->data.stream.type == LispStreamStandard && + output_stream->data.stream.source.file == Stdout)) + LispFflush(Stdout); + return (T); + } + + return (NIL); +} + +LispObj * +Lisp_Prin1(LispBuiltin *builtin) +/* + prin1 object &optional output-stream + */ +{ + LispObj *object, *output_stream; + + output_stream = ARGUMENT(1); + object = ARGUMENT(0); + + if (output_stream == UNSPEC) + output_stream = NIL; + LispPrint(object, output_stream, 0); + + return (object); +} + +LispObj * +Lisp_Princ(LispBuiltin *builtin) +/* + princ object &optional output-stream + */ +{ + int head; + LispObj *object, *output_stream; + + output_stream = ARGUMENT(1); + object = ARGUMENT(0); + + if (output_stream == UNSPEC) + output_stream = NIL; + head = lisp__data.env.length; + LispAddVar(Oprint_escape, NIL); + ++lisp__data.env.head; + LispPrint(object, output_stream, 0); + lisp__data.env.head = lisp__data.env.length = head; + + return (object); +} + +LispObj * +Lisp_Print(LispBuiltin *builtin) +/* + print object &optional output-stream + */ +{ + LispObj *object, *output_stream; + + output_stream = ARGUMENT(1); + object = ARGUMENT(0); + + if (output_stream == UNSPEC) + output_stream = NIL; + LispWriteChar(output_stream, '\n'); + LispPrint(object, output_stream, 0); + LispWriteChar(output_stream, ' '); + + return (object); +} + +LispObj * +Lisp_Terpri(LispBuiltin *builtin) +/* + terpri &optional output-stream + */ +{ + LispObj *output_stream; + + output_stream = ARGUMENT(0); + + if (output_stream == UNSPEC) + output_stream = NIL; + else if (output_stream != NIL) { + CHECK_STREAM(output_stream); + } + LispWriteChar(output_stream, '\n'); + if (output_stream == NIL || + (output_stream->data.stream.type == LispStreamStandard && + output_stream->data.stream.source.file == Stdout)) + LispFflush(Stdout); + + return (NIL); +} + +LispObj * +Lisp_Write(LispBuiltin *builtin) +/* + write object &key case circle escape length level lines pretty readably right-margin stream + */ +{ + int head = lisp__data.env.length; + + LispObj *object, *ocase, *circle, *escape, *length, *level, + *lines, *pretty, *readably, *right_margin, *stream; + + stream = ARGUMENT(10); + right_margin = ARGUMENT(9); /* yet unused */ + readably = ARGUMENT(8); /* yet unused */ + pretty = ARGUMENT(7); /* yet unused */ + lines = ARGUMENT(6); /* yet unused */ + level = ARGUMENT(5); + length = ARGUMENT(4); + escape = ARGUMENT(3); + circle = ARGUMENT(2); + ocase = ARGUMENT(1); + object = ARGUMENT(0); + + if (stream == UNSPEC) + stream = NIL; + else if (stream != NIL) { + CHECK_STREAM(stream); + } + + /* prepare the printer environment */ + if (circle != UNSPEC) + LispAddVar(Oprint_circle, circle); + if (length != UNSPEC) + LispAddVar(Oprint_length, length); + if (level != UNSPEC) + LispAddVar(Oprint_level, level); + if (ocase != UNSPEC) + LispAddVar(Oprint_case, ocase); + if (escape != UNSPEC) + LispAddVar(Oprint_escape, escape); + + lisp__data.env.head = lisp__data.env.length; + + (void)LispWriteObject(stream, object); + + lisp__data.env.head = lisp__data.env.length = head; + + return (object); +} + +LispObj * +Lisp_WriteChar(LispBuiltin *builtin) +/* + write-char character &optional output-stream + */ +{ + int ch; + + LispObj *character, *output_stream; + + output_stream = ARGUMENT(1); + character = ARGUMENT(0); + + if (output_stream == UNSPEC) + output_stream = NIL; + CHECK_SCHAR(character); + ch = SCHAR_VALUE(character); + + LispWriteChar(output_stream, ch); + + return (character); +} + +LispObj * +Lisp_WriteLine(LispBuiltin *builtin) +/* + write-line string &optional output-stream &key start end + */ +{ + return (LispWriteString_(builtin, 1)); +} + +LispObj * +Lisp_WriteString(LispBuiltin *builtin) +/* + write-string string &optional output-stream &key start end + */ +{ + return (LispWriteString_(builtin, 0)); +} + + +int +LispWriteObject(LispObj *stream, LispObj *object) +{ + write_info info; + int bytes; + LispObj *level, *length, *circle, *oescape, *ocase; + + /* current state */ + info.depth = info.level = info.length = 0; + + /* maximum level to descend */ + level = LispGetVar(Oprint_level); + if (level && INDEXP(level)) + info.print_level = FIXNUM_VALUE(level); + else + info.print_level = -1; + + /* maximum list length */ + length = LispGetVar(Oprint_length); + if (length && INDEXP(length)) + info.print_length = FIXNUM_VALUE(length); + else + info.print_length = -1; + + /* detect circular/shared objects? */ + circle = LispGetVar(Oprint_circle); + info.circle_count = 0; + info.objects = NULL; + info.num_objects = 0; + info.circles = NULL; + info.num_circles = 0; + if (circle && circle != NIL) { + LispBuildCircle(object, &info); + /* free this data now */ + if (info.num_objects) { + LispFree(info.objects); + info.num_objects = 0; + } + } + + /* escape characters and strings? */ + oescape = LispGetVar(Oprint_escape); + if (oescape != NULL) + info.print_escape = oescape == NIL; + else + info.print_escape = -1; + + /* don't use the default case printing? */ + ocase = LispGetVar(Oprint_case); + if (ocase == Kdowncase) + info.print_case = DOWNCASE; + else if (ocase == Kcapitalize) + info.print_case = CAPITALIZE; + else + info.print_case = UPCASE; + + bytes = LispDoWriteObject(stream, object, &info, 1); + if (circle && circle != NIL && info.num_circles) + LispFree(info.circles); + + return (bytes); +} + +static void +LispBuildCircle(LispObj *object, write_info *info) +{ + LispObj *list; + + switch (OBJECT_TYPE(object)) { + case LispCons_t: + LispDoBuildCircle(object, info); + break; + case LispArray_t: + /* Currently arrays are implemented as lists, but only + * the elements could/should be circular */ + if (LispCheckCircle(object, info) >= 0) + return; + LispDoBuildCircle(object, info); + for (list = object->data.array.list; + CONSP(list); list = CDR(list)) + LispBuildCircle(CAR(list), info); + break; + case LispStruct_t: + /* Like arrays, structs are currently implemented as lists, + * but only the elements could/should be circular */ + if (LispCheckCircle(object, info) >= 0) + return; + LispDoBuildCircle(object, info); + for (list = object->data.struc.fields; + CONSP(list); list = CDR(list)) + LispBuildCircle(CAR(list), info); + break; + case LispQuote_t: + case LispBackquote_t: + case LispFunctionQuote_t: + LispDoBuildCircle(object, info); + LispBuildCircle(object->data.quote, info); + break; + case LispComma_t: + LispDoBuildCircle(object, info); + LispBuildCircle(object->data.comma.eval, info); + break; + case LispLambda_t: + /* Circularity in a function body should fail elsewhere... */ + if (LispCheckCircle(object, info) >= 0) + return; + LispDoBuildCircle(object, info); + LispBuildCircle(object->data.lambda.code, info); + break; + default: + break; + } +} + +static void +LispDoBuildCircle(LispObj *object, write_info *info) +{ + long i; + + if (LispCheckCircle(object, info) >= 0) + return; + + for (i = 0; i < info->num_objects; i++) + if (info->objects[i] == object) { + /* circularity found */ + info->circles = LispRealloc(info->circles, sizeof(circle_info) * + (info->num_circles + 1)); + info->circles[info->num_circles].circle_nth = 0; + info->circles[info->num_circles].object = object; + ++info->num_circles; + return; + } + + /* object pointer not yet recorded */ + if ((i % 16) == 0) + info->objects = LispRealloc(info->objects, sizeof(LispObj*) * + (info->num_objects + 16)); + info->objects[info->num_objects++] = object; + + if (CONSP(object)) { + if (CONSP(CAR(object))) + LispDoBuildCircle(CAR(object), info); + else + LispBuildCircle(CAR(object), info); + if (CONSP(CDR(object))) + LispDoBuildCircle(CDR(object), info); + else + LispBuildCircle(CDR(object), info); + } +} + +static long +LispCheckCircle(LispObj *object, write_info *info) +{ + long i; + + for (i = 0; i < info->num_circles; i++) + if (info->circles[i].object == object) + return (i); + + return (-1); +} + +static int +LispPrintCircle(LispObj *stream, LispObj *object, long circle, + int *length, write_info *info) +{ + char stk[32]; + + if (!info->circles[circle].circle_nth) { + sprintf(stk, "#%ld=", ++info->circle_count); + *length += LispWriteStr(stream, stk, strlen(stk)); + info->circles[circle].circle_nth = info->circle_count; + + return (1); + } + sprintf(stk, "#%ld#", info->circles[circle].circle_nth); + *length += LispWriteStr(stream, stk, strlen(stk)); + + return (0); +} + +static int +LispWriteAlist(LispObj *stream, LispArgList *alist, write_info *info) +{ + char *name; + int i, length = 0, need_space = 0; + +#define WRITE_ATOM(object) \ + name = ATOMID(object); \ + length += LispDoWriteAtom(stream, name, strlen(name), \ + info->print_case) +#define WRITE_STRING(string) \ + length += LispDoWriteAtom(stream, string, strlen(string), \ + info->print_case) +#define WRITE_OBJECT(object) \ + length += LispDoWriteObject(stream, object, info, 1) +#define WRITE_OPAREN() \ + length += LispWriteChar(stream, '(') +#define WRITE_SPACE() \ + length += LispWriteChar(stream, ' ') +#define WRITE_CPAREN() \ + length += LispWriteChar(stream, ')') + + WRITE_OPAREN(); + for (i = 0; i < alist->normals.num_symbols; i++) { + WRITE_ATOM(alist->normals.symbols[i]); + if (i + 1 < alist->normals.num_symbols) + WRITE_SPACE(); + else + need_space = 1; + } + if (alist->optionals.num_symbols) { + if (need_space) + WRITE_SPACE(); + WRITE_STRING(Soptional); + WRITE_SPACE(); + for (i = 0; i < alist->optionals.num_symbols; i++) { + WRITE_OPAREN(); + WRITE_ATOM(alist->optionals.symbols[i]); + WRITE_SPACE(); + WRITE_OBJECT(alist->optionals.defaults[i]); + if (alist->optionals.sforms[i]) { + WRITE_SPACE(); + WRITE_ATOM(alist->optionals.sforms[i]); + } + WRITE_CPAREN(); + if (i + 1 < alist->optionals.num_symbols) + WRITE_SPACE(); + } + need_space = 1; + } + if (alist->keys.num_symbols) { + if (need_space) + WRITE_SPACE(); + length += LispDoWriteAtom(stream, Skey, 4, info->print_case); + WRITE_SPACE(); + for (i = 0; i < alist->keys.num_symbols; i++) { + WRITE_OPAREN(); + if (alist->keys.keys[i]) { + WRITE_OPAREN(); + WRITE_ATOM(alist->keys.keys[i]); + WRITE_SPACE(); + } + WRITE_ATOM(alist->keys.symbols[i]); + if (alist->keys.keys[i]) + WRITE_CPAREN(); + WRITE_SPACE(); + WRITE_OBJECT(alist->keys.defaults[i]); + if (alist->keys.sforms[i]) { + WRITE_SPACE(); + WRITE_ATOM(alist->keys.sforms[i]); + } + WRITE_CPAREN(); + if (i + 1 < alist->keys.num_symbols) + WRITE_SPACE(); + } + need_space = 1; + } + if (alist->rest) { + if (need_space) + WRITE_SPACE(); + WRITE_STRING(Srest); + WRITE_SPACE(); + WRITE_ATOM(alist->rest); + need_space = 1; + } + if (alist->auxs.num_symbols) { + if (need_space) + WRITE_SPACE(); + WRITE_STRING(Saux); + WRITE_SPACE(); + for (i = 0; i < alist->auxs.num_symbols; i++) { + WRITE_OPAREN(); + WRITE_ATOM(alist->auxs.symbols[i]); + WRITE_SPACE(); + WRITE_OBJECT(alist->auxs.initials[i]); + WRITE_CPAREN(); + if (i + 1 < alist->auxs.num_symbols) + WRITE_SPACE(); + } + } + WRITE_CPAREN(); + +#undef WRITE_ATOM +#undef WRITE_STRING +#undef WRITE_OBJECT +#undef WRITE_OPAREN +#undef WRITE_SPACE +#undef WRITE_CPAREN + + return (length); +} + +static void +check_stream(LispObj *stream, + LispFile **file, LispString **string, int check_writable) +{ + /* NIL is UNIX stdout, *STANDARD-OUTPUT* may not be UNIX stdout */ + if (stream == NIL) { + *file = Stdout; + *string = NULL; + } + else { + if (!STREAMP(stream)) + LispDestroy("%s is not a stream", STROBJ(stream)); + if (check_writable && !stream->data.stream.writable) + LispDestroy("%s is not writable", STROBJ(stream)); + else if (stream->data.stream.type == LispStreamString) { + *string = SSTREAMP(stream); + *file = NULL; + } + else { + if (stream->data.stream.type == LispStreamPipe) + *file = OPSTREAMP(stream); + else + *file = stream->data.stream.source.file; + *string = NULL; + } + } +} + +/* Assumes buffer has enough storage, 64 bytes should be more than enough */ +static void +parse_double(char *buffer, int *exponent, double value, int d) +{ + char stk[64], fmt[32], *ptr, *fract = NULL; + int positive = value >= 0.0; + +parse_double_again: + if (d >= 8) { + double dcheck; + int icheck, count; + + /* this should to do the correct rounding */ + for (count = 2; count >= 0; count--) { + icheck = d <= 0 ? 0 : d > FLOAT_PREC ? FLOAT_PREC - count : d - count; + sprintf(fmt, "%%.%de", icheck); + sprintf(stk, fmt, value); + if (count) { + /* if the value read back is the same formatted */ + sscanf(stk, "%lf", &dcheck); + if (dcheck == value) + break; + } + } + } + else { + sprintf(fmt, "%%.%de", d <= 0 ? 0 : d > FLOAT_PREC ? FLOAT_PREC : d); + sprintf(stk, fmt, value); + } + + /* this "should" never fail */ + ptr = strchr(stk, 'e'); + if (ptr) { + *ptr++ = '\0'; + *exponent = atoi(ptr); + } + else + *exponent = 0; + + /* find start of number representation */ + for (ptr = stk; *ptr && !isdigit(*ptr); ptr++) + ; + + /* check if did not trim any significant digit, + * this may happen because '%.e' puts only one digit before the '.' */ + if (d > 0 && d < FLOAT_PREC && fabs(value) >= 10.0 && + strlen(ptr) - 1 - !positive <= *exponent) { + d += *exponent - (strlen(ptr) - 1 - !positive) + 1; + goto parse_double_again; + } + + /* this "should" never fail */ + fract = strchr(ptr, '.'); + if (fract) + *fract++ = '\0'; + + /* store number representation in buffer */ + *buffer = positive ? '+' : '-'; + strcpy(buffer + 1, ptr); + if (fract) + strcpy(buffer + strlen(buffer), fract); +} + +static void +format_integer(char *buffer, long value, int radix) +{ + if (radix == 10) + sprintf(buffer, "%ld", value); + else if (radix == 16) + sprintf(buffer, "%lx", value); + else if (radix == 8) + sprintf(buffer, "%lo", value); + else { + /* use bignum routine to convert number to string */ + mpi integer; + + mpi_init(&integer); + mpi_seti(&integer, value); + mpi_getstr(buffer, &integer, radix); + mpi_clear(&integer); + } +} + +static int +LispWriteCPointer(LispObj *stream, void *data) +{ + char stk[32]; + +#ifdef LONG64 + sprintf(stk, "0x%016lx", (long)data); +#else + sprintf(stk, "0x%08lx", (long)data); +#endif + + return (LispWriteStr(stream, stk, strlen(stk))); +} + +static int +LispWriteCString(LispObj *stream, char *string, long length, write_info *info) +{ + int result; + + if (!info->print_escape) { + char *base, *ptr, *end; + + result = LispWriteChar(stream, '"'); + for (base = ptr = string, end = string + length; ptr < end; ptr++) { + if (*ptr == '\\' || *ptr == '"') { + result += LispWriteStr(stream, base, ptr - base); + result += LispWriteChar(stream, '\\'); + result += LispWriteChar(stream, *ptr); + base = ptr + 1; + } + } + result += LispWriteStr(stream, base, end - base); + result += LispWriteChar(stream, '"'); + } + else + result = LispWriteStr(stream, string, length); + + return (result); +} + +static int +LispWriteList(LispObj *stream, LispObj *object, write_info *info, int paren) +{ + int length = 0; + long circle = 0; + + INCDEPTH(); + if (info->print_level < 0 || info->level <= info->print_level) { + LispObj *car, *cdr; + long print_length = info->length; + + if (info->circles && (circle = LispCheckCircle(object, info)) >= 0) { + if (!paren) { + length += LispWriteStr(stream, ". ", 2); + paren = 1; + } + if (LispPrintCircle(stream, object, circle, &length, info) == 0) { + DECDEPTH(); + + return (length); + } + } + + car = CAR(object); + cdr = CDR(object); + + if (cdr == NIL) { + if (paren) + length += LispWriteChar(stream, '('); + if (info->print_length < 0 || info->length < info->print_length) { + info->length = 0; + length += LispDoWriteObject(stream, car, info, 1); + info->length = print_length + 1; + } + else + length += LispWriteStr(stream, "...", 3); + if (paren) + length += LispWriteChar(stream, ')'); + } + else { + if (paren) + length += LispWriteChar(stream, '('); + if (info->print_length < 0 || info->length < info->print_length) { + info->length = 0; + length += LispDoWriteObject(stream, car, info, 1); + info->length = print_length + 1; + if (!CONSP(cdr)) { + length += LispWriteStr(stream, " . ", 3); + info->length = 0; + length += LispDoWriteObject(stream, cdr, info, 0); + } + else { + length += LispWriteChar(stream, ' '); + if (info->print_length < 0 || + info->length < info->print_length) + length += LispWriteList(stream, cdr, info, 0); + else + length += LispWriteStr(stream, "...", 3); + } + } + else + length += LispWriteStr(stream, "...", 3); + if (paren) + length += LispWriteChar(stream, ')'); + } + info->length = print_length; + } + else + length += LispWriteChar(stream, '#'); + DECDEPTH(); + + return (length); +} + +static int +LispDoWriteObject(LispObj *stream, LispObj *object, write_info *info, int paren) +{ + long print_level; + int length = 0; + char stk[64], *string = NULL; + +write_again: + switch (OBJECT_TYPE(object)) { + case LispNil_t: + if (object == NIL) + string = Snil; + else if (object == T) + string = St; + else if (object == DOT) + string = "#<DOT>"; + else if (object == UNSPEC) + string = "#<UNSPEC>"; + else if (object == UNBOUND) + string = "#<UNBOUND>"; + else + string = "#<ERROR>"; + length += LispDoWriteAtom(stream, string, strlen(string), + info->print_case); + break; + case LispOpaque_t: { + char *desc = LispIntToOpaqueType(object->data.opaque.type); + + length += LispWriteChar(stream, '#'); + length += LispWriteCPointer(stream, object->data.opaque.data); + length += LispWriteStr(stream, desc, strlen(desc)); + } break; + case LispAtom_t: + length += LispWriteAtom(stream, object, info); + break; + case LispFunction_t: + if (object->data.atom->a_function) { + object = object->data.atom->property->fun.function; + goto write_lambda; + } + length += LispWriteStr(stream, "#<", 2); + if (object->data.atom->a_compiled) + LispDoWriteAtom(stream, "COMPILED", 8, info->print_case); + else if (object->data.atom->a_builtin) + LispDoWriteAtom(stream, "BUILTIN", 7, info->print_case); + /* XXX the function does not exist anymore */ + /* FIXME not sure if I want this fixed... */ + else + LispDoWriteAtom(stream, "UNBOUND", 7, info->print_case); + LispDoWriteAtom(stream, "-FUNCTION", 9, info->print_case); + length += LispWriteChar(stream, ' '); + length += LispWriteAtom(stream, object->data.atom->object, info); + length += LispWriteChar(stream, '>'); + break; + case LispString_t: + length += LispWriteString(stream, object, info); + break; + case LispSChar_t: + length += LispWriteCharacter(stream, object, info); + break; + case LispDFloat_t: + length += LispWriteFloat(stream, object); + break; + case LispFixnum_t: + case LispInteger_t: + case LispBignum_t: + length += LispWriteInteger(stream, object); + break; + case LispRatio_t: + format_integer(stk, object->data.ratio.numerator, 10); + length += LispWriteStr(stream, stk, strlen(stk)); + length += LispWriteChar(stream, '/'); + format_integer(stk, object->data.ratio.denominator, 10); + length += LispWriteStr(stream, stk, strlen(stk)); + break; + case LispBigratio_t: { + int sz; + char *ptr; + + sz = mpi_getsize(mpr_num(object->data.mp.ratio), 10) + 1 + + mpi_getsize(mpr_den(object->data.mp.ratio), 10) + 1 + + (mpi_sgn(mpr_num(object->data.mp.ratio)) < 0); + if (sz > sizeof(stk)) + ptr = LispMalloc(sz); + else + ptr = stk; + mpr_getstr(ptr, object->data.mp.ratio, 10); + length += LispWriteStr(stream, ptr, sz - 1); + if (ptr != stk) + LispFree(ptr); + } break; + case LispComplex_t: + length += LispWriteStr(stream, "#C(", 3); + length += LispDoWriteObject(stream, + object->data.complex.real, info, 0); + length += LispWriteChar(stream, ' '); + length += LispDoWriteObject(stream, + object->data.complex.imag, info, 0); + length += LispWriteChar(stream, ')'); + break; + case LispCons_t: + print_level = info->level; + ++info->level; + length += LispWriteList(stream, object, info, paren); + info->level = print_level; + break; + case LispQuote_t: + length += LispWriteChar(stream, '\''); + paren = 1; + object = object->data.quote; + goto write_again; + case LispBackquote_t: + length += LispWriteChar(stream, '`'); + paren = 1; + object = object->data.quote; + goto write_again; + case LispComma_t: + if (object->data.comma.atlist) + length += LispWriteStr(stream, ",@", 2); + else + length += LispWriteChar(stream, ','); + paren = 1; + object = object->data.comma.eval; + goto write_again; + break; + case LispFunctionQuote_t: + length += LispWriteStr(stream, "#'", 2); + paren = 1; + object = object->data.quote; + goto write_again; + case LispArray_t: + length += LispWriteArray(stream, object, info); + break; + case LispStruct_t: + length += LispWriteStruct(stream, object, info); + break; + case LispLambda_t: + write_lambda: + switch (object->funtype) { + case LispLambda: + string = "#<LAMBDA "; + break; + case LispFunction: + string = "#<FUNCTION "; + break; + case LispMacro: + string = "#<MACRO "; + break; + case LispSetf: + string = "#<SETF "; + break; + } + length += LispDoWriteAtom(stream, string, strlen(string), + info->print_case); + if (object->funtype != LispLambda) { + length += LispWriteAtom(stream, object->data.lambda.name, info); + length += LispWriteChar(stream, ' '); + length += LispWriteAlist(stream, object->data.lambda.name + ->data.atom->property->alist, info); + } + else { + length += LispDoWriteAtom(stream, Snil, 3, info->print_case); + length += LispWriteChar(stream, ' '); + length += LispWriteAlist(stream, (LispArgList*)object-> + data.lambda.name->data.opaque.data, + info); + } + length += LispWriteChar(stream, ' '); + length += LispDoWriteObject(stream, + object->data.lambda.code, info, 0); + length += LispWriteChar(stream, '>'); + break; + case LispStream_t: + length += LispWriteStr(stream, "#<", 2); + if (object->data.stream.type == LispStreamFile) + string = "FILE-STREAM "; + else if (object->data.stream.type == LispStreamString) + string = "STRING-STREAM "; + else if (object->data.stream.type == LispStreamStandard) + string = "STANDARD-STREAM "; + else if (object->data.stream.type == LispStreamPipe) + string = "PIPE-STREAM "; + length += LispDoWriteAtom(stream, string, strlen(string), + info->print_case); + + if (!object->data.stream.readable && !object->data.stream.writable) + length += LispDoWriteAtom(stream, "CLOSED", + 6, info->print_case); + else { + if (object->data.stream.readable) + length += LispDoWriteAtom(stream, "READ", + 4, info->print_case); + if (object->data.stream.writable) { + if (object->data.stream.readable) + length += LispWriteChar(stream, '-'); + length += LispDoWriteAtom(stream, "WRITE", + 5, info->print_case); + } + } + if (object->data.stream.type != LispStreamString) { + length += LispWriteChar(stream, ' '); + length += LispDoWriteObject(stream, + object->data.stream.pathname, + info, 1); + /* same address/size for pipes */ + length += LispWriteChar(stream, ' '); + length += LispWriteCPointer(stream, + object->data.stream.source.file); + if (object->data.stream.readable && + object->data.stream.type == LispStreamFile && + !object->data.stream.source.file->binary) { + length += LispWriteStr(stream, " @", 2); + format_integer(stk, object->data.stream.source.file->line, 10); + length += LispWriteStr(stream, stk, strlen(stk)); + } + } + length += LispWriteChar(stream, '>'); + break; + case LispPathname_t: + length += LispWriteStr(stream, "#P", 2); + paren = 1; + object = CAR(object->data.quote); + goto write_again; + case LispPackage_t: + length += LispDoWriteAtom(stream, "#<PACKAGE ", + 10, info->print_case); + length += LispWriteStr(stream, + THESTR(object->data.package.name), + STRLEN(object->data.package.name)); + length += LispWriteChar(stream, '>'); + break; + case LispRegex_t: + length += LispDoWriteAtom(stream, "#<REGEX ", + 8, info->print_case); + length += LispDoWriteObject(stream, + object->data.regex.pattern, info, 1); + if (object->data.regex.options & RE_NOSPEC) + length += LispDoWriteAtom(stream, " :NOSPEC", + 8, info->print_case); + if (object->data.regex.options & RE_ICASE) + length += LispDoWriteAtom(stream, " :ICASE", + 7, info->print_case); + if (object->data.regex.options & RE_NOSUB) + length += LispDoWriteAtom(stream, " :NOSUB", + 7, info->print_case); + if (object->data.regex.options & RE_NEWLINE) + length += LispDoWriteAtom(stream, " :NEWLINE", + 9, info->print_case); + length += LispWriteChar(stream, '>'); + break; + case LispBytecode_t: + length += LispDoWriteAtom(stream, "#<BYTECODE ", + 11, info->print_case); + length += LispWriteCPointer(stream, + object->data.bytecode.bytecode); + length += LispWriteChar(stream, '>'); + break; + case LispHashTable_t: + length += LispDoWriteAtom(stream, "#<HASH-TABLE ", + 13, info->print_case); + length += LispWriteAtom(stream, object->data.hash.test, info); + snprintf(stk, sizeof(stk), " %g %g", + object->data.hash.table->rehash_size, + object->data.hash.table->rehash_threshold); + length += LispWriteStr(stream, stk, strlen(stk)); + snprintf(stk, sizeof(stk), " %ld/%ld>", + object->data.hash.table->count, + object->data.hash.table->num_entries); + length += LispWriteStr(stream, stk, strlen(stk)); + break; + } + + return (length); +} + +/* return current column number in stream */ +int +LispGetColumn(LispObj *stream) +{ + LispFile *file; + LispString *string; + + check_stream(stream, &file, &string, 0); + if (file != NULL) + return (file->column); + return (string->column); +} + +/* write a character to stream */ +int +LispWriteChar(LispObj *stream, int character) +{ + LispFile *file; + LispString *string; + + check_stream(stream, &file, &string, 1); + if (file != NULL) + return (LispFputc(file, character)); + + return (LispSputc(string, character)); +} + +/* write a character count times to stream */ +int +LispWriteChars(LispObj *stream, int character, int count) +{ + int length = 0; + + if (count > 0) { + char stk[64]; + LispFile *file; + LispString *string; + + check_stream(stream, &file, &string, 1); + if (count >= sizeof(stk)) { + memset(stk, character, sizeof(stk)); + for (; count >= sizeof(stk); count -= sizeof(stk)) { + if (file != NULL) + length += LispFwrite(file, stk, sizeof(stk)); + else + length += LispSwrite(string, stk, sizeof(stk)); + } + } + else + memset(stk, character, count); + + if (count) { + if (file != NULL) + length += LispFwrite(file, stk, count); + else + length += LispSwrite(string, stk, count); + } + } + + return (length); +} + +/* write a string to stream */ +int +LispWriteStr(LispObj *stream, char *buffer, long length) +{ + LispFile *file; + LispString *string; + + check_stream(stream, &file, &string, 1); + if (file != NULL) + return (LispFwrite(file, buffer, length)); + return (LispSwrite(string, buffer, length)); +} + +static int +LispDoWriteAtom(LispObj *stream, char *string, int length, int print_case) +{ + int bytes = 0, cap = 0; + char buffer[128], *ptr; + + switch (print_case) { + case DOWNCASE: + for (ptr = buffer; length > 0; length--, string++) { + if (isupper(*string)) + *ptr = tolower(*string); + else + *ptr = *string; + ++ptr; + if (ptr - buffer >= sizeof(buffer)) { + bytes += LispWriteStr(stream, buffer, ptr - buffer); + ptr = buffer; + } + } + if (ptr > buffer) + bytes += LispWriteStr(stream, buffer, ptr - buffer); + break; + case CAPITALIZE: + for (ptr = buffer; length > 0; length--, string++) { + if (isalnum(*string)) { + if (cap && isupper(*string)) + *ptr = tolower(*string); + else + *ptr = *string; + cap = 1; + } + else { + *ptr = *string; + cap = 0; + } + ++ptr; + if (ptr - buffer >= sizeof(buffer)) { + bytes += LispWriteStr(stream, buffer, ptr - buffer); + ptr = buffer; + } + } + if (ptr > buffer) + bytes += LispWriteStr(stream, buffer, ptr - buffer); + break; + default: + /* Strings are already stored upcase/quoted */ + bytes += LispWriteStr(stream, string, length); + break; + } + + return (bytes); +} + +static int +LispWriteAtom(LispObj *stream, LispObj *object, write_info *info) +{ + int length = 0; + LispAtom *atom = object->data.atom; + Atom_id id = atom->string; + + if (atom->package != PACKAGE) { + if (atom->package == lisp__data.keyword) + length += LispWriteChar(stream, ':'); + else if (atom->package == NULL) + length += LispWriteStr(stream, "#:", 2); + else { + /* Check if the symbol is visible */ + int i, visible = 0; + + if (atom->ext) { + for (i = lisp__data.pack->use.length - 1; i >= 0; i--) { + if (lisp__data.pack->use.pairs[i] == atom->package) { + visible = 1; + break; + } + } + } + + if (!visible) { + /* XXX this assumes that package names are always "readable" */ + length += + LispDoWriteAtom(stream, + THESTR(atom->package->data.package.name), + STRLEN(atom->package->data.package.name), + info->print_case); + length += LispWriteChar(stream, ':'); + if (!atom->ext) + length += LispWriteChar(stream, ':'); + } + } + } + if (atom->unreadable) + length += LispWriteChar(stream, '|'); + length += LispDoWriteAtom(stream, id, strlen(id), + atom->unreadable ? UPCASE : info->print_case); + if (atom->unreadable) + length += LispWriteChar(stream, '|'); + + return (length); +} + +static int +LispWriteInteger(LispObj *stream, LispObj *object) +{ + return (LispFormatInteger(stream, object, 10, 0, 0, 0, 0, 0, 0)); +} + +static int +LispWriteCharacter(LispObj *stream, LispObj *object, write_info *info) +{ + return (LispFormatCharacter(stream, object, !info->print_escape, 0)); +} + +static int +LispWriteString(LispObj *stream, LispObj *object, write_info *info) +{ + return (LispWriteCString(stream, THESTR(object), STRLEN(object), info)); +} + +static int +LispWriteFloat(LispObj *stream, LispObj *object) +{ + double value = DFLOAT_VALUE(object); + + if (value == 0.0 || (fabs(value) < 1.0E7 && fabs(value) > 1.0E-4)) + return (LispFormatFixedFloat(stream, object, 0, 0, NULL, 0, 0, 0)); + + return (LispDoFormatExponentialFloat(stream, object, 0, 0, NULL, + 0, 1, 0, ' ', 'E', 0)); +} + +static int +LispWriteArray(LispObj *stream, LispObj *object, write_info *info) +{ + int length = 0; + long print_level = info->level, circle; + + if (info->circles && (circle = LispCheckCircle(object, info)) >= 0 && + LispPrintCircle(stream, object, circle, &length, info) == 0) + return (length); + + if (object->data.array.rank == 0) { + length += LispWriteStr(stream, "#0A", 3); + length += LispDoWriteObject(stream, object->data.array.list, info, 1); + return (length); + } + + INCDEPTH(); + ++info->level; + if (info->print_level < 0 || info->level <= info->print_level) { + if (object->data.array.rank == 1) + length += LispWriteStr(stream, "#(", 2); + else { + char stk[32]; + + format_integer(stk, object->data.array.rank, 10); + length += LispWriteChar(stream, '#'); + length += LispWriteStr(stream, stk, strlen(stk)); + length += LispWriteStr(stream, "A(", 2); + } + + if (!object->data.array.zero) { + long print_length = info->length, local_length = 0; + + if (object->data.array.rank == 1) { + LispObj *ary; + long count; + + for (ary = object->data.array.dim, count = 1; + ary != NIL; ary = CDR(ary)) + count *= FIXNUM_VALUE(CAR(ary)); + for (ary = object->data.array.list; count > 0; + ary = CDR(ary), count--) { + if (info->print_length < 0 || + ++local_length <= info->print_length) { + info->length = 0; + length += LispDoWriteObject(stream, CAR(ary), info, 1); + } + else { + length += LispWriteStr(stream, "...", 3); + break; + } + if (count - 1 > 0) + length += LispWriteChar(stream, ' '); + } + } + else { + LispObj *ary; + int i, k, rank, *dims, *loop; + + rank = object->data.array.rank; + dims = LispMalloc(sizeof(int) * rank); + loop = LispCalloc(1, sizeof(int) * (rank - 1)); + + /* fill dim */ + for (i = 0, ary = object->data.array.dim; ary != NIL; + i++, ary = CDR(ary)) + dims[i] = FIXNUM_VALUE(CAR(ary)); + + i = 0; + ary = object->data.array.list; + while (loop[0] < dims[0]) { + if (info->print_length < 0 || + local_length < info->print_length) { + for (; i < rank - 1; i++) + length += LispWriteChar(stream, '('); + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1] - 1; + k++, ary = CDR(ary)) { + if (info->print_length < 0 || + k < info->print_length) { + ++local_length; + info->length = 0; + length += LispDoWriteObject(stream, + CAR(ary), info, 1); + length += LispWriteChar(stream, ' '); + } + } + if (info->print_length < 0 || k < info->print_length) { + ++local_length; + info->length = 0; + length += LispDoWriteObject(stream, + CAR(ary), info, 0); + } + else + length += LispWriteStr(stream, "...", 3); + for (k = rank - 1; k > i; k--) + length += LispWriteChar(stream, ')'); + if (loop[0] < dims[0]) + length += LispWriteChar(stream, ' '); + ary = CDR(ary); + } + else { + ++local_length; + length += LispWriteStr(stream, "...)", 4); + for (; local_length < dims[0] - 1; local_length++) + length += LispWriteStr(stream, " ...)", 5); + if (local_length <= dims[0]) + length += LispWriteStr(stream, " ...", 4); + break; + } + } + LispFree(dims); + LispFree(loop); + } + info->length = print_length; + } + length += LispWriteChar(stream, ')'); + } + else + length += LispWriteChar(stream, '#'); + info->level = print_level; + DECDEPTH(); + + return (length); +} + +static int +LispWriteStruct(LispObj *stream, LispObj *object, write_info *info) +{ + int length; + long circle; + LispObj *symbol; + LispObj *def = object->data.struc.def; + LispObj *field = object->data.struc.fields; + + if (info->circles && (circle = LispCheckCircle(object, info)) >= 0 && + LispPrintCircle(stream, object, circle, &length, info) == 0) + return (length); + + INCDEPTH(); + length = LispWriteStr(stream, "#S(", 3); + symbol = SYMBOLP(CAR(def)) ? CAR(def) : CAAR(def); + length += LispWriteAtom(stream, symbol, info); + def = CDR(def); + for (; def != NIL; def = CDR(def), field = CDR(field)) { + length += LispWriteChar(stream, ' '); + symbol = SYMBOLP(CAR(def)) ? CAR(def) : CAAR(def); + length += LispWriteAtom(stream, symbol, info); + length += LispWriteChar(stream, ' '); + length += LispDoWriteObject(stream, CAR(field), info, 1); + } + length += LispWriteChar(stream, ')'); + DECDEPTH(); + + return (length); +} + +int +LispFormatInteger(LispObj *stream, LispObj *object, int radix, + int atsign, int collon, int mincol, + int padchar, int commachar, int commainterval) +{ + char stk[128], *str = stk; + int i, length, sign, intervals; + + if (LONGINTP(object)) + format_integer(stk, LONGINT_VALUE(object), radix); + else { + if (mpi_getsize(object->data.mp.integer, radix) >= sizeof(stk)) + str = mpi_getstr(NULL, object->data.mp.integer, radix); + else + mpi_getstr(str, object->data.mp.integer, radix); + } + + sign = *str == '-'; + length = strlen(str); + + /* if collon, update length for the number of commachars to be printed */ + if (collon && commainterval > 0 && commachar) { + intervals = length / commainterval; + length += intervals; + } + else + intervals = 0; + + /* if sign must be printed, and number is positive */ + if (atsign && !sign) + ++length; + + /* if need padding */ + if (padchar && mincol > length) + LispWriteChars(stream, padchar, mincol - length); + + /* if need to print number sign */ + if (sign || atsign) + LispWriteChar(stream, sign ? '-' : '+'); + + /* if need to print commas to separate groups of numbers */ + if (intervals) { + int j; + char *ptr; + + i = (length - atsign) - intervals; + j = i % commainterval; + /* make the loop below easier */ + if (j == 0) + j = commainterval; + i -= j; + ptr = str + sign; + for (; j > 0; j--, ptr++) + LispWriteChar(stream, *ptr); + for (; i > 0; i -= commainterval) { + LispWriteChar(stream, commachar); + for (j = 0; j < commainterval; j++, ptr++) + LispWriteChar(stream, *ptr); + } + } + /* else, just print the string */ + else + LispWriteStr(stream, str + sign, length - sign); + + /* if number required more than sizeof(stk) bytes */ + if (str != stk) + LispFree(str); + + return (length); +} + +int +LispFormatRomanInteger(LispObj *stream, long value, int new_roman) +{ + char stk[32]; + int length; + + length = 0; + while (value > 1000) { + stk[length++] = 'M'; + value -= 1000; + } + if (new_roman) { + if (value >= 900) { + strcpy(stk + length, "CM"); + length += 2, + value -= 900; + } + else if (value < 500 && value >= 400) { + strcpy(stk + length, "CD"); + length += 2; + value -= 400; + } + } + if (value >= 500) { + stk[length++] = 'D'; + value -= 500; + } + while (value >= 100) { + stk[length++] = 'C'; + value -= 100; + } + if (new_roman) { + if (value >= 90) { + strcpy(stk + length, "XC"); + length += 2, + value -= 90; + } + else if (value < 50 && value >= 40) { + strcpy(stk + length, "XL"); + length += 2; + value -= 40; + } + } + if (value >= 50) { + stk[length++] = 'L'; + value -= 50; + } + while (value >= 10) { + stk[length++] = 'X'; + value -= 10; + } + if (new_roman) { + if (value == 9) { + strcpy(stk + length, "IX"); + length += 2, + value -= 9; + } + else if (value == 4) { + strcpy(stk + length, "IV"); + length += 2; + value -= 4; + } + } + if (value >= 5) { + stk[length++] = 'V'; + value -= 5; + } + while (value) { + stk[length++] = 'I'; + --value; + } + + stk[length] = '\0'; + + return (LispWriteStr(stream, stk, length)); +} + +int +LispFormatEnglishInteger(LispObj *stream, long number, int ordinal) +{ + static char *ds[] = { + "", "one", "two", "three", "four", + "five", "six", "seven", "eight", "nine", + "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" + }; + static char *dsth[] = { + "", "first", "second", "third", "fourth", + "fifth", "sixth", "seventh", "eighth", "ninth", + "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", + "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth" + }; + static char *hs[] = { + "", "", "twenty", "thirty", "forty", + "fifty", "sixty", "seventy", "eighty", "ninety" + }; + static char *hsth[] = { + "", "", "twentieth", "thirtieth", "fortieth", + "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth" + }; + static char *ts[] = { + "", "thousand", "million" + }; + static char *tsth[] = { + "", "thousandth", "millionth" + }; + char stk[256]; + int length, sign; + + sign = number < 0; + if (sign) + number = -number; + length = 0; + +#define SIGNLEN 6 /* strlen("minus ") */ + if (sign) { + strcpy(stk, "minus "); + length += SIGNLEN; + } + else if (number == 0) { + if (ordinal) { + strcpy(stk, "zeroth"); + length += 6; /* strlen("zeroth") */ + } + else { + strcpy(stk, "zero"); + length += 4; /* strlen("zero") */ + } + } + for (;;) { + int count, temp; + char *t, *h, *d; + long value = number; + + for (count = 0; value >= 1000; value /= 1000, count++) + ; + + t = ds[value / 100]; + if (ordinal && !count && (value % 10) == 0) + h = hsth[(value % 100) / 10]; + else + h = hs[(value % 100) / 10]; + + if (ordinal && !count) + d = *h ? dsth[value % 10] : dsth[value % 20]; + else + d = *h ? ds[value % 10] : ds[value % 20]; + + if (((!sign && length) || length > SIGNLEN) && (*t || *h || *d)) { + if (!ordinal || count || *h || *t) { + strcpy(stk + length, ", "); + length += 2; + } + else { + strcpy(stk + length, " "); + ++length; + } + } + + if (*t) { + if (ordinal && !count && (value % 100) == 0) + temp = sprintf(stk + length, "%s hundredth", t); + else + temp = sprintf(stk + length, "%s hundred", t); + length += temp; + } + + if (*h) { + if (*t) { + if (ordinal && !count) { + strcpy(stk + length, " "); + ++length; + } + else { + strcpy(stk + length, " and "); + length += 5; /* strlen(" and ") */ + } + } + strcpy(stk + length, h); + length += strlen(h); + } + + if (*d) { + if (*h) { + strcpy(stk + length, "-"); + ++length; + } + else if (*t) { + if (ordinal && !count) { + strcpy(stk + length, " "); + ++length; + } + else { + strcpy(stk + length, " and "); + length += 5; /* strlen(" and ") */ + } + } + strcpy(stk + length, d); + length += strlen(d); + } + + if (!count) + break; + else + temp = count; + + if (count > 1) { + value *= 1000; + while (--count) + value *= 1000; + number -= value; + } + else + number %= 1000; + + if (ordinal && number == 0 && !*t && !*h) + temp = sprintf(stk + length, " %s", tsth[temp]); + else + temp = sprintf(stk + length, " %s", ts[temp]); + length += temp; + + if (!number) + break; + } + + return (LispWriteStr(stream, stk, length)); +} + +int +LispFormatCharacter(LispObj *stream, LispObj *object, + int atsign, int collon) +{ + int length = 0; + int ch = SCHAR_VALUE(object); + + if (atsign && !collon) + length += LispWriteStr(stream, "#\\", 2); + if ((atsign || collon) && (ch <= ' ' || ch == 0177)) { + char *name = LispChars[ch].names[0]; + + length += LispWriteStr(stream, name, strlen(name)); + } + else + length += LispWriteChar(stream, ch); + + return (length); +} + +/* returns 1 if string size must grow, done inplace */ +static int +float_string_inc(char *buffer, int offset) +{ + int i; + + for (i = offset; i >= 0; i--) { + if (buffer[i] == '9') + buffer[i] = '0'; + else if (buffer[i] != '.') { + ++buffer[i]; + break; + } + } + if (i < 0) { + int length = strlen(buffer); + + /* string size must change */ + memmove(buffer + 1, buffer, length + 1); + buffer[0] = '1'; + + return (1); + } + + return (0); +} + +int +LispFormatFixedFloat(LispObj *stream, LispObj *object, + int atsign, int w, int *pd, int k, int overflowchar, + int padchar) +{ + char buffer[512], stk[64]; + int sign, exponent, length, offset, d = pd ? *pd : FLOAT_PREC, again; + double value = DFLOAT_VALUE(object); + + if (value == 0.0) { + exponent = k = 0; + strcpy(stk, "+0"); + } + else + /* calculate format parameters, adjusting scale factor */ + parse_double(stk, &exponent, value, d + 1 + k); + + /* make sure k won't cause overflow */ + if (k > 128) + k = 128; + else if (k < -128) + k = -128; + + /* make sure d won't cause overflow */ + if (d > 128) + d = 128; + else if (d < -128) + d = -128; + + /* adjust scale factor, exponent is used as an index in stk */ + exponent += k + 1; + + /* how many bytes in float representation */ + length = strlen(stk) - 1; + + /* need to print a sign? */ + sign = atsign || (stk[0] == '-'); + + /* format number, cannot overflow, as control variables were checked */ + offset = 0; + if (sign) + buffer[offset++] = stk[0]; + if (exponent > 0) { + if (exponent > length) { + memcpy(buffer + offset, stk + 1, length); + memset(buffer + offset + length, '0', exponent - length); + } + else + memcpy(buffer + offset, stk + 1, exponent); + offset += exponent; + buffer[offset++] = '.'; + if (length > exponent) { + memcpy(buffer + offset, stk + 1 + exponent, length - exponent); + offset += length - exponent; + } + else + buffer[offset++] = '0'; + } + else { + buffer[offset++] = '0'; + buffer[offset++] = '.'; + while (exponent < 0) { + buffer[offset++] = '0'; + exponent++; + } + memcpy(buffer + offset, stk + 1, length); + offset += length; + } + buffer[offset] = '\0'; + + again = 0; +fixed_float_check_again: + /* make sure only d digits are printed after decimal point */ + if (d > 0) { + char *dptr = strchr(buffer, '.'); + + length = strlen(dptr) - 1; + /* check if need to remove excess digits */ + if (length > d) { + int digit; + + offset = (dptr - buffer) + 1 + d; + digit = buffer[offset]; + + /* remove extra digits */ + buffer[offset] = '\0'; + + /* check if need to round */ + if (!again && offset > 1 && isdigit(digit) && digit >= '5' && + isdigit(buffer[offset - 1]) && + float_string_inc(buffer, offset - 1)) + ++offset; + } + /* check if need to add extra zero digits to fill space */ + else if (length < d) { + offset += d - length; + for (++length; length <= d; length++) + dptr[length] = '0'; + dptr[length] = '\0'; + } + } + else { + /* no digits after decimal point */ + int digit, inc = 0; + char *dptr = strchr(buffer, '.') + 1; + + digit = *dptr; + if (!again && digit >= '5' && dptr >= buffer + 2 && isdigit(dptr[-2])) + inc = float_string_inc(buffer, dptr - buffer - 2); + + offset = (dptr - buffer) + inc; + buffer[offset] = '\0'; + } + + /* if d was not specified, remove any extra zeros */ + if (pd == NULL) { + while (offset > 2 && buffer[offset - 2] != '.' && + buffer[offset - 1] == '0') + --offset; + buffer[offset] = '\0'; + } + + if (w > 0 && offset > w) { + /* first check if can remove extra fractional digits */ + if (pd == NULL) { + char *ptr = strchr(buffer, '.') + 1; + + if (ptr - buffer < w) { + d = w - (ptr - buffer); + goto fixed_float_check_again; + } + } + + /* remove leading "zero" to save space */ + if ((!sign && buffer[0] == '0') || (sign && buffer[1] == '0')) { + /* ending nul also copied */ + memmove(buffer + sign, buffer + sign + 1, offset); + --offset; + } + /* remove leading '+' to "save" space */ + if (offset > w && buffer[0] == '+') { + /* ending nul also copied */ + memmove(buffer, buffer + 1, offset); + --offset; + } + } + + /* if cannot represent number in given width */ + if (overflowchar && offset > w) { + again = 1; + goto fixed_float_overflow; + } + + length = 0; + /* print padding if required */ + if (w > offset) + length += LispWriteChars(stream, padchar, w - offset); + + /* print float number representation */ + return (LispWriteStr(stream, buffer, offset) + length); + +fixed_float_overflow: + return (LispWriteChars(stream, overflowchar, w)); +} + +int +LispFormatExponentialFloat(LispObj *stream, LispObj *object, + int atsign, int w, int *pd, int e, int k, + int overflowchar, int padchar, int exponentchar) +{ + return (LispDoFormatExponentialFloat(stream, object, atsign, w, + pd, e, k, overflowchar, padchar, + exponentchar, 1)); +} + +int +LispDoFormatExponentialFloat(LispObj *stream, LispObj *object, + int atsign, int w, int *pd, int e, int k, + int overflowchar, int padchar, int exponentchar, + int format) +{ + char buffer[512], stk[64]; + int sign, exponent, length, offset, d = pd ? *pd : FLOAT_PREC; + double value = DFLOAT_VALUE(object); + + if (value == 0.0) { + exponent = 0; + k = 1; + strcpy(stk, "+0"); + } + else + /* calculate format parameters, adjusting scale factor */ + parse_double(stk, &exponent, value, d + k - 1); + + /* set e to a value that won't overflow */ + if (e > 16) + e = 16; + + /* set k to a value that won't overflow */ + if (k > 128) + k = 128; + else if (k < -128) + k = -128; + + /* set d to a value that won't overflow */ + if (d > 128) + d = 128; + else if (d < -128) + d = -128; + + /* how many bytes in float representation */ + length = strlen(stk) - 1; + + /* need to print a sign? */ + sign = atsign || (stk[0] == '-'); + + /* adjust number of digits after decimal point */ + if (k > 0) + d -= k - 1; + + /* adjust exponent, based on scale factor */ + exponent -= k - 1; + + /* format number, cannot overflow, as control variables were checked */ + offset = 0; + if (sign) + buffer[offset++] = stk[0]; + if (k > 0) { + if (k > length) { + memcpy(buffer + offset, stk + 1, length); + offset += length; + } + else { + memcpy(buffer + offset, stk + 1, k); + offset += k; + } + buffer[offset++] = '.'; + if (length > k) { + memcpy(buffer + offset, stk + 1 + k, length - k); + offset += length - k; + } + else + buffer[offset++] = '0'; + } + else { + int tmp = k; + + buffer[offset++] = '0'; + buffer[offset++] = '.'; + while (tmp < 0) { + buffer[offset++] = '0'; + tmp++; + } + memcpy(buffer + offset, stk + 1, length); + offset += length; + } + + /* if format, then always add a sign to exponent */ + buffer[offset++] = exponentchar; + if (format || exponent < 0) + buffer[offset++] = exponent < 0 ? '-' : '+'; + + /* XXX destroy stk contents */ + sprintf(stk, "%%0%dd", e); + /* format scale factor*/ + length = sprintf(buffer + offset, stk, + exponent < 0 ? -exponent : exponent); + /* check for overflow in exponent */ + if (length > e && overflowchar) + goto exponential_float_overflow; + offset += length; + + /* make sure only d digits are printed after decimal point */ + if (d > 0) { + int currd; + char *dptr = strchr(buffer, '.'), + *eptr = strchr(dptr, exponentchar); + + currd = eptr - dptr - 1; + length = strlen(eptr); + + /* check if need to remove excess digits */ + if (currd > d) { + int digit, dpos; + + dpos = offset = (dptr - buffer) + 1 + d; + digit = buffer[offset]; + + memmove(buffer + offset, eptr, length + 1); + /* also copy ending nul character */ + + /* adjust offset to length of total string */ + offset += length; + + /* check if need to round */ + if (dpos > 1 && isdigit(digit) && digit >= '5' && + isdigit(buffer[dpos - 1]) && + float_string_inc(buffer, dpos - 1)) + ++offset; + } + /* check if need to add extra zero digits to fill space */ + else if (pd && currd < d) { + memmove(eptr + d - currd, eptr, length + 1); + /* also copy ending nul character */ + + offset += d - currd; + for (++currd; currd <= d; currd++) + dptr[currd] = '0'; + } + /* check if need to remove zeros */ + else if (pd == NULL) { + int zeros = 1; + + while (eptr[-zeros] == '0') + ++zeros; + if (eptr[-zeros] == '.') + --zeros; + if (zeros > 1) { + memmove(eptr - zeros + 1, eptr, length + 1); + offset -= zeros - 1; + } + } + } + else { + /* no digits after decimal point */ + int digit, inc = 0; + char *dptr = strchr(buffer, '.'), + *eptr = strchr(dptr, exponentchar); + + digit = dptr[1]; + + offset = (dptr - buffer) + 1; + length = strlen(eptr); + memmove(buffer + offset, eptr, length + 1); + /* also copy ending nul character */ + + if (digit >= '5' && dptr >= buffer + 2 && + isdigit(dptr[-2])) + inc = float_string_inc(buffer, dptr - buffer - 2); + + /* adjust offset to length of total string */ + offset += length + inc; + } + + if (w > 0 && offset > w) { + /* remove leading "zero" to save space */ + if ((!sign && buffer[0] == '0') || (sign && buffer[1] == '0')) { + /* ending nul also copied */ + memmove(buffer + sign, buffer + sign + 1, offset); + --offset; + } + /* remove leading '+' to "save" space */ + if (offset > w && buffer[0] == '+') { + /* ending nul also copied */ + memmove(buffer, buffer + 1, offset); + --offset; + } + } + + /* if cannot represent number in given width */ + if (overflowchar && offset > w) + goto exponential_float_overflow; + + length = 0; + /* print padding if required */ + if (w > offset) + length += LispWriteChars(stream, padchar, w - offset); + + /* print float number representation */ + return (LispWriteStr(stream, buffer, offset) + length); + +exponential_float_overflow: + return (LispWriteChars(stream, overflowchar, w)); +} + +int +LispFormatGeneralFloat(LispObj *stream, LispObj *object, + int atsign, int w, int *pd, int e, int k, + int overflowchar, int padchar, int exponentchar) +{ + char stk[64]; + int length, exponent, n, dd, ee, ww, d = pd ? *pd : FLOAT_PREC; + double value = DFLOAT_VALUE(object); + + if (value == 0.0) { + exponent = 0; + n = 0; + d = 1; + strcpy(stk, "+0"); + } + else { + /* calculate format parameters, adjusting scale factor */ + parse_double(stk, &exponent, value, d + k - 1); + n = exponent + 1; + } + + /* Let ee equal e+2, or 4 if e is omitted. */ + if (e) + ee = e + 2; + else + ee = 4; + + /* Let ww equal w-ee, or nil if w is omitted. */ + if (w) + ww = w - ee; + else + ww = 0; + + dd = d - n; + if (d >= dd && dd >= 0) { + length = LispFormatFixedFloat(stream, object, atsign, ww, + &dd, 0, overflowchar, padchar); + + /* ~ee@T */ + length += LispWriteChars(stream, padchar, ee); + } + else + length = LispFormatExponentialFloat(stream, object, atsign, + w, pd, e, k, overflowchar, + padchar, exponentchar); + + return (length); +} + +int +LispFormatDollarFloat(LispObj *stream, LispObj *object, + int atsign, int collon, int d, int n, int w, int padchar) +{ + char buffer[512], stk[64]; + int sign, exponent, length, offset; + double value = DFLOAT_VALUE(object); + + if (value == 0.0) { + exponent = 0; + strcpy(stk, "+0"); + } + else + /* calculate format parameters, adjusting scale factor */ + parse_double(stk, &exponent, value, d == 0 ? FLOAT_PREC : d + 1); + + /* set d to a "sane" value */ + if (d > 128) + d = 128; + + /* set n to a "sane" value */ + if (n > 128) + n = 128; + + /* use exponent as index in stk */ + ++exponent; + + /* don't put sign in buffer, + * if collon specified, must go before padding */ + sign = atsign || (stk[0] == '-'); + + offset = 0; + + /* pad with zeros if required */ + if (exponent > 0) + n -= exponent; + while (n > 0) { + buffer[offset++] = '0'; + n--; + } + + /* how many bytes in float representation */ + length = strlen(stk) - 1; + + if (exponent > 0) { + if (exponent > length) { + memcpy(buffer + offset, stk + 1, length); + memset(buffer + offset + length, '0', exponent - length); + } + else + memcpy(buffer + offset, stk + 1, exponent); + offset += exponent; + buffer[offset++] = '.'; + if (length > exponent) { + memcpy(buffer + offset, stk + 1 + exponent, length - exponent); + offset += length - exponent; + } + else + buffer[offset++] = '0'; + } + else { + if (n > 0) + buffer[offset++] = '0'; + buffer[offset++] = '.'; + while (exponent < 0) { + buffer[offset++] = '0'; + exponent++; + } + memcpy(buffer + offset, stk + 1, length); + offset += length; + } + buffer[offset] = '\0'; + + /* make sure only d digits are printed after decimal point */ + if (d > 0) { + char *dptr = strchr(buffer, '.'); + + length = strlen(dptr) - 1; + /* check if need to remove excess digits */ + if (length > d) { + int digit; + + offset = (dptr - buffer) + 1 + d; + digit = buffer[offset]; + + /* remove extra digits */ + buffer[offset] = '\0'; + + /* check if need to round */ + if (offset > 1 && isdigit(digit) && digit >= '5' && + isdigit(buffer[offset - 1]) && + float_string_inc(buffer, offset - 1)) + ++offset; + } + /* check if need to add extra zero digits to fill space */ + else if (length < d) { + offset += d - length; + for (++length; length <= d; length++) + dptr[length] = '0'; + dptr[length] = '\0'; + } + } + else { + /* no digits after decimal point */ + int digit, inc = 0; + char *dptr = strchr(buffer, '.') + 1; + + digit = *dptr; + if (digit >= '5' && dptr >= buffer + 2 && isdigit(dptr[-2])) + inc = float_string_inc(buffer, dptr - buffer - 2); + + offset = (dptr - buffer) + inc; + buffer[offset] = '\0'; + } + + length = 0; + if (sign) { + ++offset; + if (atsign && collon) + length += LispWriteChar(stream, value >= 0.0 ? '+' : '-'); + } + + /* print padding if required */ + if (w > offset) + length += LispWriteChars(stream, padchar, w - offset); + + if (atsign && !collon) + length += LispWriteChar(stream, value >= 0.0 ? '+' : '-'); + + /* print float number representation */ + return (LispWriteStr(stream, buffer, offset) + length); +} Index: xc/programs/xedit/lisp/write.h diff -u /dev/null xc/programs/xedit/lisp/write.h:1.9 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/write.h Wed Dec 4 00:27:59 2002 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/write.h,v 1.9 2002/12/04 05:27:59 paulo Exp $ */ + +#ifndef Lisp_write_h +#define Lisp_write_h + +#include "io.h" + +/* + * Prototypes + */ +void LispWriteInit(void); + +LispObj *Lisp_FreshLine(LispBuiltin*); +LispObj *Lisp_Prin1(LispBuiltin*); +LispObj *Lisp_Princ(LispBuiltin*); +LispObj *Lisp_Print(LispBuiltin*); +LispObj *Lisp_Terpri(LispBuiltin*); +LispObj *Lisp_Write(LispBuiltin*); +LispObj *Lisp_WriteChar(LispBuiltin*); +LispObj *Lisp_WriteLine(LispBuiltin*); +LispObj *Lisp_WriteString(LispBuiltin*); + +int LispGetColumn(LispObj*); + +int LispWriteChar(LispObj*, int); +int LispWriteChars(LispObj*, int, int); +int LispWriteStr(LispObj*, char*, long); + + /* write any lisp object to stream */ +int LispWriteObject(LispObj*, LispObj*); + +/* formatted output */ + /* object must be an integer */ +int LispFormatInteger(LispObj*, LispObj*, int, int, int, int, int, int, int); + /* must be in range 1 to 3999 for new roman, 1 to 4999 for old roman */ +int LispFormatRomanInteger(LispObj*, long, int); + /* must be in range -9999999 to 9999999 */ +int LispFormatEnglishInteger(LispObj*, long, int); + /* object must be a character */ +int LispFormatCharacter(LispObj*, LispObj*, int, int); + /* object must be a float */ +int LispFormatFixedFloat(LispObj*, LispObj*, int, int, int*, int, int, int); + /* object must be a float */ +int LispFormatExponentialFloat(LispObj*, LispObj*, + int, int, int*, int, int, int, int, int); + /* object must be a float */ +int LispFormatGeneralFloat(LispObj*, LispObj*, int, + int, int*, int, int, int, int, int); +int LispFormatDollarFloat(LispObj*, LispObj*, int, int, int, int, int, int); + +#endif /* Lisp_write_h */ Index: xc/programs/xedit/lisp/xedit.c diff -u /dev/null xc/programs/xedit/lisp/xedit.c:1.24 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/xedit.c Sun Jan 12 22:57:59 2003 @@ -0,0 +1,1636 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/xedit.c,v 1.24 2003/01/13 03:57:59 paulo Exp $ */ + +#include "../xedit.h" +#include <X11/Xaw/TextSrcP.h> /* Needs some private definitions */ +#include <X11/Xaw/TextSinkP.h> /* Also needs private definitions... */ +#include <X11/Xmu/Xmu.h> +#define XEDIT_LISP_PRIVATE +#include "xedit.h" +#include <signal.h> + +/* Initialize to enter lisp */ +#define LISP_SETUP() \ + int lisp__running = lisp__data.running + +/* XXX Maybe should use ualarm or better, setitimer, but one + * second seens good enough to check for interrupts */ + +#define ENABLE_SIGALRM() \ + old_sigalrm = signal(SIGALRM, SigalrmHandler); \ + alarm(1) + +#define DISABLE_SIGALRM() \ + alarm(0); \ + signal(SIGALRM, old_sigalrm) + +/* Enter lisp */ +#define LISP_ENTER() \ + if (!lisp__running) { \ + lisp__data.running = 1; \ + XFlush(XtDisplay(textwindow)); \ + ENABLE_SIGALRM(); \ + if (sigsetjmp(lisp__data.jmp, 1) != 0) { \ + DISABLE_SIGALRM(); \ + lisp__data.running = 0; \ + return; \ + } \ + } + +/* Leave lisp */ +#define LISP_LEAVE() \ + if (!lisp__running) { \ + DISABLE_SIGALRM(); \ + LispTopLevel(); \ + lisp__data.running = 0; \ + } + +/* + * Types + */ +typedef struct { + XawTextPosition left, right; + XrmQuark property; +} EntityInfo; + +/* + * Prototypes + */ +static Bool ControlGPredicate(Display*, XEvent*, XPointer); +static ssize_t WriteToStdout(int, const void*, size_t); +static ssize_t WriteToStderr(int, const void*, size_t); +static ssize_t WrapWrite(Widget, const void*, size_t); +static void XeditUpdateModeInfos(void); +static void XeditPrint(Widget, LispObj*, int); +static void XeditInteractiveCallback(Widget, XtPointer, XtPointer); +static void XeditIndentationCallback(Widget, XtPointer, XtPointer); +static LispObj *XeditCharAt(LispBuiltin*, int); +static LispObj *XeditSearch(LispBuiltin*, XawTextScanDirection); + +/* + * Initialization + */ +#ifdef SIGNALRETURNSINT +static int (*old_sigalrm)(int); +#else +static void (*old_sigalrm)(int); +#endif + +EditModeInfo *mode_infos; +Cardinal num_mode_infos; + +static LispObj *Oauto_modes, *Oauto_mode, *Osyntax_highlight, *Osyntable_indent; + +/* Just to make calling interactive reparse easier */ +static LispObj interactive_arguments[4]; + +static LispObj *justify_modes[4]; +static LispObj *wrap_modes[3]; +static LispObj *scan_types[5]; +static LispObj *scan_directions[2]; +static LispObj execute_stream; +static LispString execute_string; +static LispObj result_stream; +static LispString result_string; +static XawTextPropertyList **property_lists; +static Cardinal num_property_lists; + +/* Some hacks to (at lest try to) avoid problems reentering Xlib while + * testing for user interrupts */ +static volatile int disable_timeout, request_timeout; + +extern int pagesize; + +static LispBuiltin xeditbuiltins[] = { + {LispFunction, Xedit_AddEntity, "add-entity offset length identifier"}, + {LispFunction, Xedit_AutoFill, "auto-fill &optional value"}, + {LispFunction, Xedit_Background, "background &optional color"}, + {LispFunction, Xedit_CharAfter, "char-after &optional offset"}, + {LispFunction, Xedit_CharBefore, "char-before &optional offset"}, + {LispFunction, Xedit_ClearEntities, "clear-entities left right"}, + {LispFunction, Xedit_ConvertPropertyList, "convert-property-list name definition"}, + {LispFunction, Xedit_Font, "font &optional font"}, + {LispFunction, Xedit_Foreground, "foreground &optional color"}, + {LispFunction, Xedit_GotoChar, "goto-char offset"}, + {LispFunction, Xedit_HorizontalScrollbar, "horizontal-scrollbar &optional state"}, + {LispFunction, Xedit_Insert, "insert text"}, + {LispFunction, Xedit_Justification, "justification &optional value"}, + {LispFunction, Xedit_LeftColumn, "left-column &optional left"}, + {LispFunction, Xedit_Point, "point"}, + {LispFunction, Xedit_PointMax, "point-max"}, + {LispFunction, Xedit_PointMin, "point-min"}, + {LispFunction, Xedit_PropertyList, "property-list &optional value"}, + {LispFunction, Xedit_ReadText, "read-text offset length"}, + {LispFunction, Xedit_ReplaceText, "replace-text left right text"}, + {LispFunction, Xedit_RightColumn, "right-column &optional right"}, + {LispFunction, Xedit_Scan, "scan offset type direction &key count include"}, + {LispFunction, Xedit_SearchBackward, "search-backward string &optional offset ignore-case"}, + {LispFunction, Xedit_SearchForward, "search-forward string &optional offset ignore-case"}, + {LispFunction, Xedit_VerticalScrollbar, "vertical-scrollbar &optional state"}, + {LispFunction, Xedit_WrapMode, "wrap-mode &optional value"}, + + /* This should be available from elsewhere at some time... */ + {LispFunction, Xedit_XrmStringToQuark, "xrm-string-to-quark string"}, +}; + +/* + * Implementation + */ +/*ARGUSED*/ +static Bool +ControlGPredicate(Display *display, XEvent *event, XPointer arguments) +{ + char buffer[2]; + + return ((event->type == KeyPress || event->type == KeyRelease) && + (event->xkey.state & ControlMask) && + XLookupString(&(event->xkey), buffer, sizeof(buffer), NULL, NULL) && + buffer[0] == '\a'); +} + +/*ARGSUSED*/ +static +#ifdef SIGNALRETURNSINT +int +#else +void +#endif +SigalrmHandler(int signum) +{ + XEvent event; + + if (disable_timeout) { + request_timeout = 1; + return; + } + + /* Check if user pressed C-g */ + if (XCheckIfEvent(XtDisplay(textwindow), &event, ControlGPredicate, NULL)) { + XPutBackEvent(XtDisplay(textwindow), &event); + alarm(0); + /* Tell a signal was received, print message for SIGINT */ + LispSignal(SIGINT); + } + else + alarm(1); +#ifdef SIGNALRETURNSINT + return (0); +#endif +} + +static ssize_t +WrapWrite(Widget output, const void *buffer, size_t nbytes) +{ + XawTextBlock block; + XawTextPosition position; + + disable_timeout = 1; + position = XawTextGetInsertionPoint(output); + block.firstPos = 0; + block.format = FMT8BIT; + block.length = nbytes; + block.ptr = (String)buffer; + XawTextReplace(output, position, position, &block); + XawTextSetInsertionPoint(output, position + block.length); + disable_timeout = 0; + + if (request_timeout) { + XFlush(XtDisplay(output)); + request_timeout = 0; + SigalrmHandler(SIGALRM); + } + + return ((ssize_t)nbytes); +} + +static ssize_t +WriteToStdout(int fd, const void *buffer, size_t nbytes) +{ + return (WrapWrite(textwindow, buffer, nbytes)); +} + +static ssize_t +WriteToStderr(int fd, const void *buffer, size_t nbytes) +{ + return (WrapWrite(messwidget, buffer, nbytes)); +} + +void +LispXeditInitialize(void) +{ + int i; + char *string; + LispObj *xedit, *list, *savepackage; + + LispSetFileWrite(Stdout, WriteToStdout); + LispSetFileWrite(Stderr, WriteToStderr); + + justify_modes[0] = KEYWORD("LEFT"); + justify_modes[1] = KEYWORD("RIGHT"); + justify_modes[2] = KEYWORD("CENTER"); + justify_modes[3] = KEYWORD("FULL"); + + wrap_modes[0] = KEYWORD("NEVER"); + wrap_modes[1] = KEYWORD("LINE"); + wrap_modes[2] = KEYWORD("WORD"); + + scan_types[0] = KEYWORD("POSITIONS"); + scan_types[1] = KEYWORD("WHITE-SPACE"); + scan_types[2] = KEYWORD("EOL"); + scan_types[3] = KEYWORD("PARAGRAPH"); + scan_types[4] = KEYWORD("ALL"); + scan_types[5] = KEYWORD("ALPHA-NUMERIC"); + + scan_directions[0] = justify_modes[0]; + scan_directions[1] = justify_modes[1]; + + /* Remember value of current package */ + savepackage = PACKAGE; + + /* Create the XEDIT package */ + xedit = LispNewPackage(STRING("XEDIT"), NIL); + + /* Update list of packages */ + PACK = CONS(xedit, PACK); + + /* Temporarily switch to the XEDIT package */ + lisp__data.pack = lisp__data.savepack = xedit->data.package.package; + PACKAGE = xedit; + + /* Add XEDIT builtin functions */ + for (i = 0; i < sizeof(xeditbuiltins) / sizeof(xeditbuiltins[0]); i++) + LispAddBuiltinFunction(&xeditbuiltins[i]); + + /* Create these objects in the xedit package */ + Oauto_modes = STATIC_ATOM("*AUTO-MODES*"); + Oauto_mode = STATIC_ATOM("AUTO-MODE"); + Osyntax_highlight = STATIC_ATOM("SYNTAX-HIGHLIGHT"); + Osyntable_indent = STATIC_ATOM("SYNTABLE-INDENT"); + + /* Import symbols from the LISP and EXT packages */ + for (list = PACK; CONSP(list); list = CDR(list)) { + string = THESTR(CAR(list)->data.package.name); + if (strcmp(string, "LISP") == 0 || strcmp(string, "EXT") == 0) + LispUsePackage(CAR(list)); + } + + /* Restore previous package */ + lisp__data.pack = savepackage->data.package.package; + PACKAGE = savepackage; + + /* Initialize helper static objects used when executing expressions */ + execute_stream.type = LispStream_t; + execute_stream.data.stream.source.string = &execute_string; + execute_stream.data.stream.pathname = NIL; + execute_stream.data.stream.type = LispStreamString; + execute_stream.data.stream.readable = 1; + execute_stream.data.stream.writable = 0; + execute_string.output = 0; + result_stream.type = LispStream_t; + result_stream.data.stream.source.string = &result_string; + result_stream.data.stream.pathname = NIL; + result_stream.data.stream.type = LispStreamString; + result_stream.data.stream.readable = 0; + result_stream.data.stream.writable = 1; + result_string.string = XtMalloc(pagesize); + result_string.space = pagesize; + + /* Initialize interactive edition function arguments */ + /* first argument is syntax table */ + interactive_arguments[0].type = LispCons_t; + interactive_arguments[0].data.cons.cdr = &interactive_arguments[1]; + /* second argument is where to start reparsing */ + interactive_arguments[1].type = LispCons_t; + interactive_arguments[1].data.cons.cdr = &interactive_arguments[2]; + /* third argument is where to stop reparsing */ + interactive_arguments[2].type = LispCons_t; + interactive_arguments[2].data.cons.cdr = &interactive_arguments[3]; + /* fourth argument is interactive flag */ + interactive_arguments[3].type = LispCons_t; + interactive_arguments[3].data.cons.car = T; + interactive_arguments[3].data.cons.cdr = NIL; + + /* Load extra functions and data type definitions */ + EXECUTE("(require \"xedit\")"); + + + /* + * This assumes that the *auto-modes* variable is a list where every + * item has the format: + * (regexp string-desc load-file-desc . symbol-name) + * Minimal error checking is done. + */ + + if (Oauto_modes->data.atom->a_object) { + LispObj *desc, *modes = Oauto_modes->data.atom->property->value; + + for (; CONSP(modes); modes = CDR(modes)) { + list = CAR(modes); + + desc = NIL; + for (i = 0; i < 3 && CONSP(list); i++, list = CDR(list)) { + if (i == 1) + desc = CAR(list); + } + if (i == 3 && STRINGP(desc)) { + mode_infos = (EditModeInfo*) + XtRealloc((XtPointer)mode_infos, sizeof(EditModeInfo) * + (num_mode_infos + 1)); + mode_infos[num_mode_infos].desc = XtNewString(THESTR(desc)); + mode_infos[num_mode_infos].symbol = list; + mode_infos[num_mode_infos].syntax = NULL; + ++num_mode_infos; + } + } + } +} + +static void +XeditUpdateModeInfos(void) +{ + int i; + + for (i = 0; i < num_mode_infos; i++) { + if (mode_infos[i].symbol && + mode_infos[i].syntax == NULL && + XSYMBOLP(mode_infos[i].symbol) && + mode_infos[i].symbol->data.atom->a_object) + mode_infos[i].syntax = + mode_infos[i].symbol->data.atom->property->value; + } +} + +void +XeditLispExecute(Widget output, XawTextPosition left, XawTextPosition right) +{ + GC_ENTER(); + LISP_SETUP(); + int alloced, return_count; + XawTextBlock block; + XawTextPosition position; + char *string, *ptr; + LispObj *result, *code, *_cod, *returns; + + LISP_ENTER(); + + position = left; + XawTextSourceRead(XawTextGetSource(textwindow), left, &block, right - left); + if (block.length < right - left) { + alloced = 1; + string = ptr = LispMalloc(right - left); + memcpy(ptr, block.ptr, block.length); + position = left + block.length; + ptr += block.length; + for (; position < right;) { + XawTextSourceRead(XawTextGetSource(textwindow), + position, &block, right - position); + memcpy(ptr, block.ptr, block.length); + position += block.length; + ptr += block.length; + } + } + else { + alloced = 0; + string = block.ptr; + } + + execute_string.string = string; + execute_string.length = right - left; + execute_string.input = 0; + LispPushInput(&execute_stream); + _cod = COD; + result = NIL; + if ((code = LispRead()) != NULL) + result = EVAL(code); + COD = _cod; + LispPopInput(&execute_stream); + + returns = NIL; + if (RETURN_COUNT > 0) { + GC_PROTECT(result); + returns = _cod = CONS(RETURN(0), NIL); + GC_PROTECT(returns); + for (return_count = 1; return_count < RETURN_COUNT; return_count++) { + RPLACD(_cod, CONS(RETURN(return_count), NIL)); + _cod = CDR(_cod); + } + } + LispFflush(Stdout); + LispUpdateResults(code, result); + if (RETURN_COUNT >= 0) { + XeditPrint(output, result, 1); + for (; CONSP(returns); returns = CDR(returns)) + XeditPrint(output, CAR(returns), 0); + } + + if (alloced) + LispFree(string); + GC_LEAVE(); + + LISP_LEAVE(); +} + +static void +XeditPrint(Widget output, LispObj *object, int newline) +{ + XawTextBlock block; + XawTextPosition position; + + result_string.length = result_string.output = 0; + if (newline) { + position = XawTextGetInsertionPoint(output); + if (position != XawTextSourceScan(XawTextGetSource(output), + position, XawstEOL, + XawsdLeft, 1, False)) + LispSputc(&result_string, '\n'); + } + LispWriteObject(&result_stream, object); + LispSputc(&result_string, '\n'); + + position = XawTextGetInsertionPoint(output); + block.firstPos = 0; + block.format = FMT8BIT; + block.length = result_string.length; + block.ptr = result_string.string; + XawTextReplace(output, position, position, &block); + XawTextSetInsertionPoint(output, position + block.length); +} + +/* + * This function is defined here to avoid exporting all the lisp interfaces + * to the core xedit code. + */ +void +XeditLispSetEditMode(xedit_flist_item *item, LispObj *symbol) +{ + GC_ENTER(); + LISP_SETUP(); + LispObj *syntax, *name; + + item->xldata = (XeditLispData*)XtCalloc(1, sizeof(XeditLispData)); + + LISP_ENTER(); + + /* Create an object that represents the buffer filename. + * Note that the entire path is passed to the auto-mode + * function, so that directory names may be also be used + * when determining a file type. */ + name = STRING(item->filename); + GC_PROTECT(name); + + /* Call the AUTO-MODE function to check if there is a + * syntax definition for the file being loaded */ + if (symbol == NULL) + syntax = APPLY1(Oauto_mode, name); + else + syntax = APPLY2(Oauto_mode, name, symbol); + + /* Don't need the name object anymore */ + GC_LEAVE(); + + if (syntax != NIL) { + Arg arg[1]; + LispObj arguments; + XawTextPropertyList *property_list; + + item->xldata->syntax = syntax; + + /* Apply the syntax highlight to the current buffer */ + arguments.type = LispCons_t; + arguments.data.cons.car = syntax; + arguments.data.cons.cdr = NIL; + LispFuncall(Osyntax_highlight, &arguments, 1); + + /* The previous call added the property list to the widget, + * remember it when switching sources. */ + XtSetArg(arg[0], XawNtextProperties, &property_list); + XtGetValues(XawTextGetSink(textwindow), arg, 1); + item->properties = property_list; + + /* Add callback for interactive changes */ + XtAddCallback(item->source, XtNpropertyCallback, + XeditInteractiveCallback, item->xldata); + + /* Update information as a new file may have been loaded */ + XeditUpdateModeInfos(); + } + else + item->properties = NULL; + + LISP_LEAVE(); +} + +void +XeditLispUnsetEditMode(xedit_flist_item *item) +{ + if (item->xldata) { + XtRemoveCallback(item->source, XtNpropertyCallback, + XeditInteractiveCallback, item->xldata); + XtFree((XtPointer)item->xldata); + item->xldata = NULL; + } +} + +#define MAX_INFOS 32 +/* + * This callback tries to do it's best in generating correct output while + * also doing minimal work/redrawing of the screen. It probably will fail + * for some syntax-definitions, or will just not properly repaint the + * screen. In the later case, just press Ctrl+L. + * There isn't yet any command to force reparsing of some regions, and if + * the parser becomes confused, you may need to go to a line, press a space + * and undo, just to force it to reparse the line, and possibly some extra + * lines until the parser thinks the display is in sync. + * Sometimes it will repaint a lot more of text than what is being requested + * by this callback, this should be fixed at some time, as for certain cases + * it is also required some redesign in the Xaw interface. + */ +static void +XeditInteractiveCallback(Widget w, XtPointer client_data, XtPointer call_data) +{ + LISP_SETUP(); + XeditLispData *data = (XeditLispData*)client_data; + LispObj *syntax = data->syntax; + XawTextPropertyInfo *info = (XawTextPropertyInfo*)call_data; + LispObj *result, *syntable; + XawTextAnchor *anchor; + XawTextEntity *entity; + XawTextPosition first, last, left, right, begin, next, tmp, position; + int i, j, indent; + TextSrcObject src = (TextSrcObject)w; + EntityInfo oinfo[MAX_INFOS], ninfo[MAX_INFOS]; + XrmQuark props[MAX_INFOS]; + int num_oinfo, num_ninfo, num_props; + XmuScanline *clip, *oclip, *nclip; + XmuSegment segment, *seg; + + if (data->disable_highlight) + return; + + LISP_ENTER(); + + first = XawTextSourceScan(w, 0, XawstAll, XawsdLeft, 1, True); + last = XawTextSourceScan(w, 0, XawstAll, XawsdRight, 1, True); + + left = info->left; + right = left + info->block->length; + + /* For now, only call the indent hook if a single character was typed */ + indent = (info->right == left) && (right == left + 1); + + /* Always reparse full lines */ + left = begin = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 1, False); + right = next = XawTextSourceScan(w, right, XawstEOL, XawsdRight, 1, False); + + + /* Check properties in the modified text. If a complex nested syntax + * table was parsed, the newline has it's default property, so, while + * the newline has a property, backup a line to make sure everything is + * properly parsed. + * Maybe should limit the number of backuped lines, but if the parsing + * becomes noticeable slow, better to rethink the syntax definition. */ + while (left > first) { + position = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 1, True); + if (XawTextSourceAnchorAndEntity(w, position, &anchor, &entity)) + left = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 2, False); + else + break; + } + + /* While the newline after the right position has a "hidden" property, + * keep incrementing a line to be reparsed. */ + while (right < last) { + if (XawTextSourceAnchorAndEntity(w, right, &anchor, &entity)) + right = XawTextSourceScan(w, right, XawstEOL, XawsdRight, 2, False); + else + break; + } + +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#define STORE_STATE(count, info, from, to) \ + (count) = 0; \ + if ((anchor = XawTextSourceFindAnchor(w, (from))) != NULL) { \ + entity = anchor->entities; \ + /* Find first entity in the region to parse */ \ + while (entity && \ + anchor->position + entity->offset + entity->length <= \ + (from)) \ + entity = entity->next; \ + /* Loop storing information */ \ + while (entity && \ + (position = anchor->position + entity->offset) < (to)) { \ + (info)[(count)].left = MAX(position, (from)); \ + position += entity->length; \ + (info)[(count)].right = MIN(position, (to)); \ + (info)[(count)].property = entity->property; \ + /* If the changes are so complex, user need press Ctrl+L */ \ + if (++(count) >= MAX_INFOS) \ + break; \ + if ((entity = entity->next) == NULL && \ + (anchor = XawTextSourceNextAnchor(w, anchor)) != NULL) \ + entity = anchor->entities; \ + } \ + } + + /* Remember old state */ + STORE_STATE(num_oinfo, oinfo, begin, right); + + /* Reparse the lines in the modified/edited range of text */ + interactive_arguments[0].data.cons.car = syntax; + interactive_arguments[1].data.cons.car = FIXNUM(left); + interactive_arguments[2].data.cons.car = FIXNUM(right); + result = APPLY(Osyntax_highlight, &interactive_arguments[0]); + /* Indent table is the second return value */ + if (RETURN_COUNT) + syntable = RETURN(0); + else + syntable = NIL; + + /* This normally is the same value as right, but the parser may have + * continued when the syntax table stack did not finish. */ + if (FIXNUMP(result)) + right = FIXNUM_VALUE(result); + + LISP_LEAVE(); + + /* Check what have changed */ + STORE_STATE(num_ninfo, ninfo, begin, right); + + /* Initialize to redraw everything. */ + clip = XmuNewScanline(0, begin, right); + +#define CLIP_MASK(mask, from, to) \ + if ((from) < (to)) { \ + segment.x1 = (from); \ + segment.x2 = (to); \ + XmuScanlineOrSegment((mask), &segment); \ + } + + oclip = XmuNewScanline(0, 0, 0); + nclip = XmuNewScanline(0, 0, 0); + +#define CLIP_DEFAULT(mask, from, info, num_info) \ + for (tmp = (from), i = 0; i < (num_info); i++) { \ + CLIP_MASK((mask), tmp, (info)[i].left); \ + tmp = (info)[i].right; \ + } + + /* First generate masks of regions with the default property */ + CLIP_DEFAULT(oclip, begin, oinfo, num_oinfo); + CLIP_DEFAULT(nclip, begin, ninfo, num_ninfo); + + /* Store unchanged region in oclip */ + XmuScanlineAnd(oclip, nclip); + + /* Don't need to redraw the region in oclip */ + XmuScanlineXor(clip, oclip); + +#define LIST_PROPERTIES(prop, num_prop, info, num_info) \ + (num_prop) = 0; \ + for (i = 0; i < (num_info); i++) { \ + for (j = 0; j < (num_prop); j++) \ + if ((prop)[j] == (info)[i].property) \ + break; \ + if (j == (num_prop)) \ + (prop)[(num_prop)++] = (info)[i].property; \ + } + + /* Prepare to generate masks of regions of text with defined properties */ + LIST_PROPERTIES(props, num_props, oinfo, num_oinfo); + +#define CLIP_PROPERTY(mask, prop, info, num_info) \ + for (j = 0; j < (num_info); j++) { \ + if ((info)[j].property == (prop)) { \ + CLIP_MASK((mask), (info)[j].left, (info)[j].right); \ + } \ + } + + /* Only care about the old properties, new ones need to be redrawn */ + for (i = 0; i < num_props; i++) { + XrmQuark property = props[i]; + + /* Reset oclip and nclip */ + XmuScanlineXor(oclip, oclip); + XmuScanlineXor(nclip, nclip); + + /* Generate masks */ + CLIP_PROPERTY(oclip, property, oinfo, num_oinfo); + CLIP_PROPERTY(nclip, property, ninfo, num_ninfo); + + /* Store unchanged region in oclip */ + XmuScanlineAnd(oclip, nclip); + + /* Don't need to redraw the region in oclip */ + XmuScanlineXor(clip, oclip); + XmuOptimizeScanline(clip); + } + + XmuDestroyScanline(oclip); + XmuDestroyScanline(nclip); + + /* Tell Xaw that need update some regions */ + for (seg = clip->segment; seg; seg = seg->next) { + for (i = 0; i < src->textSrc.num_text; i++) + /* This really should have an exported interface... */ + _XawTextNeedsUpdating((TextWidget)(src->textSrc.text[i]), + seg->x1, seg->x2 + (seg->x2 > next)); + } + XmuDestroyScanline(clip); + + data->syntable = syntable; + /* XXX check lisp__running to know if at the toplevel parsing state */ + if (indent && syntable != NIL && !lisp__running && + /* Doing an undo, probably will need an exported interface for this + * case. Should not change the text now. */ + (!src->textSrc.enable_undo || !src->textSrc.undo_state)) + XtAddCallback(textwindow, XtNpositionCallback, + XeditIndentationCallback, data); +} + +/* + * This callback is called if the syntax table where the cursor is located + * defines an indentation function. + */ +static void +XeditIndentationCallback(Widget w, XtPointer client_data, XtPointer call_data) +{ + LISP_SETUP(); + LispObj *indentp; + XeditLispData *data = (XeditLispData*)client_data; + + data->disable_highlight = True; + XtRemoveCallback(w, XtNpositionCallback, XeditIndentationCallback, data); + + LISP_ENTER(); + + /* Get pointer to indentation function */ + indentp = APPLY1(Osyntable_indent, data->syntable); + + /* Execute indentation function */ + if (indentp != NIL) + APPLY2(indentp, data->syntax, data->syntable); + + data->disable_highlight = False; + + LISP_LEAVE(); +} + +/************************************************************************ + * Builtin functions + ************************************************************************/ +LispObj * +Xedit_AddEntity(LispBuiltin *builtin) +/* + add-entity offset length identifier + */ +{ + LispObj *offset, *length, *identifier; + + identifier = ARGUMENT(2); + length = ARGUMENT(1); + offset = ARGUMENT(0); + + CHECK_INDEX(offset); + CHECK_INDEX(length); + CHECK_LONGINT(identifier); + + return (XawTextSourceAddEntity(XawTextGetSource(textwindow), 0, 0, NULL, + FIXNUM_VALUE(offset), FIXNUM_VALUE(length), + LONGINT_VALUE(identifier)) ? T : NIL); +} + +LispObj * +Xedit_AutoFill(LispBuiltin *builtin) +/* + auto-fill &optional value + */ +{ + Arg arg[1]; + Boolean state; + + LispObj *value; + + value = ARGUMENT(0); + + if (value != UNSPEC) { + XtSetArg(arg[0], XtNautoFill, value == NIL ? False : True); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNautoFill, &state); + XtGetValues(textwindow, arg, 1); + value = state ? T : NIL; + } + + return (value); +} + +LispObj * +Xedit_Background(LispBuiltin *builtin) +/* + background &optional color + */ +{ + Pixel pixel; + Arg arg[1]; + XrmValue from, to; + + LispObj *color; + + color = ARGUMENT(0); + + if (color != UNSPEC) { + CHECK_STRING(color); + + from.size = STRLEN(color); + from.addr = (XtPointer)THESTR(color); + to.size = sizeof(Pixel); + to.addr = (XtPointer)&pixel; + + if (!XtConvertAndStore(XawTextGetSink(textwindow), + XtRString, &from, XtRPixel, &to)) + LispDestroy("cannot convert %s to Pixel", STROBJ(color)); + + XtSetArg(arg[0], XtNbackground, pixel); + XtSetValues(textwindow, arg, 1); + } + else { + from.size = sizeof(Pixel); + from.addr = (XtPointer)&pixel; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNbackground, &pixel); + XtGetValues(XawTextGetSink(textwindow), arg, 1); + /* This cannot fail */ + XtConvertAndStore(textwindow, XtRPixel, &from, XtRString, &to); + + color = STRING(to.addr); + } + + return (color); +} + +static LispObj * +XeditCharAt(LispBuiltin *builtin, int before) +{ + Widget source = XawTextGetSource(textwindow); + XawTextPosition first, point, last; + XawTextBlock block; + + LispObj *offset; + + offset = ARGUMENT(0); + if (offset != UNSPEC) { + CHECK_INDEX(offset); + } + + first = XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True); + if (FIXNUMP(offset)) + point = FIXNUM_VALUE(offset); + else + point = XawTextGetInsertionPoint(textwindow); + if (before && point > first) { + XawTextPosition position = + XawTextSourceScan(source, point, XawstPositions, XawsdLeft, 1, True); + + if (position < point) + point = position; + else + return (NIL); + } + last = XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True); + + if (point < first || point > last) + return (NIL); + + XawTextSourceRead(source, point, &block, 1); + + return (block.length ? SCHAR(*(unsigned char*)block.ptr) : NIL); +} + +LispObj * +Xedit_CharAfter(LispBuiltin *builtin) +/* + char-after &optional offset + */ +{ + return (XeditCharAt(builtin, 0)); +} + +LispObj * +Xedit_CharBefore(LispBuiltin *builtin) +/* + char-before &optional offset + */ +{ + return (XeditCharAt(builtin, 1)); +} + +LispObj * +Xedit_ClearEntities(LispBuiltin *builtin) +/* + clear-entities left right + */ +{ + LispObj *left, *right; + + right = ARGUMENT(1); + left = ARGUMENT(0); + + CHECK_INDEX(left); + CHECK_INDEX(right); + + XawTextSourceClearEntities(XawTextGetSource(textwindow), + FIXNUM_VALUE(left), FIXNUM_VALUE(right)); + + return (T); +} + +LispObj * +Xedit_ConvertPropertyList(LispBuiltin *builtin) +/* + convert-property-list name definition + */ +{ + LispObj *result; + XawTextPropertyList *property_list; + + LispObj *name, *definition; + + definition = ARGUMENT(1); + name = ARGUMENT(0); + + CHECK_STRING(name); + CHECK_STRING(definition); + + result = NIL; + property_list = XawTextSinkConvertPropertyList(THESTR(name), + THESTR(definition), + topwindow->core.screen, + topwindow->core.colormap, + topwindow->core.depth); + + if (property_list) { + Cardinal i; + + for (i = 0; i < num_property_lists; i++) + /* Check if a new property list was created */ + if (property_lists[i]->identifier == property_list->identifier) + break; + + /* Remember this pointer when asked back for it */ + if (i == num_property_lists) { + property_lists = (XawTextPropertyList**) + XtRealloc((XtPointer)property_lists, + sizeof(XawTextPropertyList) * + (num_property_lists + 1)); + property_lists[num_property_lists++] = property_list; + } + result = INTEGER(property_list->identifier); + } + + return (result); +} + +LispObj * +Xedit_Font(LispBuiltin *builtin) +/* + font &optional font + */ +{ + XFontStruct *font_struct; + Arg arg[1]; + XrmValue from, to; + + LispObj *font; + + font = ARGUMENT(0); + + if (font != UNSPEC) { + CHECK_STRING(font); + + from.size = STRLEN(font); + from.addr = (XtPointer)THESTR(font); + to.size = sizeof(XFontStruct*); + to.addr = (XtPointer)&font_struct; + + if (!XtConvertAndStore(textwindow, XtRString, &from, XtRFontStruct, &to)) + LispDestroy("cannot convert %s to FontStruct", STROBJ(font)); + + XtSetArg(arg[0], XtNfont, font_struct); + XtSetValues(textwindow, arg, 1); + } + else { + from.size = sizeof(XFontStruct*); + from.addr = (XtPointer)&font_struct; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNfont, &font_struct); + XtGetValues(XawTextGetSink(textwindow), arg, 1); + /* This cannot fail */ + XtConvertAndStore(textwindow, XtRFontStruct, &from, XtRString, &to); + + font = STRING(to.addr); + } + + return (font); +} + +LispObj * +Xedit_Foreground(LispBuiltin *builtin) +/* + foreground &optional color + */ +{ + Pixel pixel; + Arg arg[1]; + XrmValue from, to; + + LispObj *color; + + color = ARGUMENT(0); + + if (color != UNSPEC) { + CHECK_STRING(color); + + from.size = STRLEN(color); + from.addr = (XtPointer)THESTR(color); + to.size = sizeof(Pixel); + to.addr = (XtPointer)&pixel; + + if (!XtConvertAndStore(XawTextGetSink(textwindow), + XtRString, &from, XtRPixel, &to)) + LispDestroy("cannot convert %s to Pixel", STROBJ(color)); + + XtSetArg(arg[0], XtNforeground, pixel); + XtSetValues(textwindow, arg, 1); + } + else { + from.size = sizeof(Pixel); + from.addr = (XtPointer)&pixel; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNforeground, &pixel); + XtGetValues(XawTextGetSink(textwindow), arg, 1); + /* This cannot fail */ + XtConvertAndStore(textwindow, XtRPixel, &from, XtRString, &to); + + color = STRING(to.addr); + } + + return (color); +} + +LispObj * +Xedit_GotoChar(LispBuiltin *builtin) +/* + goto-char offset + */ +{ + LispObj *offset; + XawTextPosition point; + + offset = ARGUMENT(0); + + CHECK_INDEX(offset); + XawTextSetInsertionPoint(textwindow, FIXNUM_VALUE(offset)); + point = XawTextGetInsertionPoint(textwindow); + if (point != FIXNUM_VALUE(offset)) + offset = FIXNUM(point); + + return (offset); +} + +LispObj * +Xedit_HorizontalScrollbar(LispBuiltin *builtin) +/* + horizontal-scrollbar &optional state + */ +{ + Arg arg[1]; + XawTextScrollMode scroll; + + LispObj *state; + + state = ARGUMENT(0); + + if (state != UNSPEC) { + scroll = state == NIL ? XawtextScrollNever : XawtextScrollAlways; + XtSetArg(arg[0], XtNscrollHorizontal, scroll); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNscrollHorizontal, &scroll); + XtGetValues(textwindow, arg, 1); + state = scroll == XawtextScrollAlways ? T : NIL; + } + + return (state); +} + +LispObj * +Xedit_Insert(LispBuiltin *builtin) +/* + insert text + */ +{ + XawTextPosition point = XawTextGetInsertionPoint(textwindow); + XawTextBlock block; + + LispObj *text; + + text = ARGUMENT(0); + + CHECK_STRING(text); + + block.firstPos = 0; + block.format = FMT8BIT; + block.length = STRLEN(text); + block.ptr = THESTR(text); + XawTextReplace(textwindow, point, point, &block); + XawTextSetInsertionPoint(textwindow, point + block.length); + + return (text); +} + +LispObj * +Xedit_Justification(LispBuiltin *builtin) +/* + justification &optional value + */ +{ + int i; + Arg arg[1]; + XawTextJustifyMode justify; + + LispObj *value; + + value = ARGUMENT(0); + + if (value != UNSPEC) { + for (i = 0; i < 4; i++) + if (value == justify_modes[i]) + break; + if (i >= 4) + LispDestroy("%s: argument must be " + ":LEFT, :RIGHT, :CENTER, or :FULL, not %s", + STRFUN(builtin), STROBJ(value)); + XtSetArg(arg[0], XtNjustifyMode, (XawTextJustifyMode)i); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNjustifyMode, &justify); + XtGetValues(textwindow, arg, 1); + i = (int)justify; + if (i <= 0 || i >= 4) + i = 0; + value = justify_modes[i]; + } + + return (value); +} + +LispObj * +Xedit_LeftColumn(LispBuiltin *builtin) +/* + left-column &optional left + */ +{ + short left; + Arg arg[1]; + + LispObj *oleft; + + oleft = ARGUMENT(0); + + if (oleft != UNSPEC) { + CHECK_INDEX(oleft); + if (FIXNUM_VALUE(oleft) >= 32767) + left = 32767; + else + left = FIXNUM_VALUE(oleft); + + XtSetArg(arg[0], XtNleftColumn, left); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNleftColumn, &left); + XtGetValues(textwindow, arg, 1); + + oleft = FIXNUM((long)left); + } + + return (oleft); +} + +LispObj * +Xedit_Point(LispBuiltin *builtin) +/* + point + */ +{ + return (FIXNUM(XawTextGetInsertionPoint(textwindow))); +} + +LispObj * +Xedit_PointMax(LispBuiltin *builtin) +/* + point-max + */ +{ + return (FIXNUM(XawTextSourceScan(XawTextGetSource(textwindow), 0, + XawstAll, XawsdRight, 1, True))); +} + +LispObj * +Xedit_PointMin(LispBuiltin *builtin) +/* + point-min + */ +{ + return (FIXNUM(XawTextSourceScan(XawTextGetSource(textwindow), 0, + XawstAll, XawsdLeft, 1, True))); +} + +LispObj * +Xedit_PropertyList(LispBuiltin *builtin) +/* + property-list &optional value + */ +{ + Arg arg[1]; + XawTextPropertyList *property_list; + + LispObj *value; + + value = ARGUMENT(0); + + if (value != UNSPEC) { + Cardinal i; + XrmQuark quark; + + CHECK_LONGINT(value); + property_list = NULL; + quark = LONGINT_VALUE(value); + for (i = 0; i < num_property_lists; i++) + if (property_lists[i]->identifier == quark) { + property_list = property_lists[i]; + break; + } + + if (property_list) { + XtSetArg(arg[0], XawNtextProperties, property_list); + XtSetValues(XawTextGetSink(textwindow), arg, 1); + } + else + /* Maybe should generate an error here */ + value = NIL; + } + else { + XtSetArg(arg[0], XawNtextProperties, &property_list); + XtGetValues(XawTextGetSink(textwindow), arg, 1); + if (property_list) + value = INTEGER(property_list->identifier); + } + + return (value); +} + +LispObj * +Xedit_ReadText(LispBuiltin *builtin) +/* + read-text offset length + */ +{ + XawTextPosition last = XawTextSourceScan(XawTextGetSource(textwindow), 0, + XawstAll, XawsdRight, 1, True); + XawTextPosition from, to, len; + XawTextBlock block; + char *string, *ptr; + + LispObj *offset, *length; + + length = ARGUMENT(1); + offset = ARGUMENT(0); + + CHECK_INDEX(offset); + CHECK_INDEX(length); + + from = FIXNUM_VALUE(offset); + to = from + FIXNUM_VALUE(length); + if (from > last) + from = last; + if (to > last) + to = last; + + if (from == to) + return (STRING("")); + + len = to - from; + string = LispMalloc(len); + + for (ptr = string; from < to;) { + XawTextSourceRead(XawTextGetSource(textwindow), from, &block, to - from); + memcpy(ptr, block.ptr, block.length); + ptr += block.length; + from += block.length; + } + + return (LSTRING2(string, len)); +} + +LispObj * +Xedit_ReplaceText(LispBuiltin *builtin) +/* + replace-text left right text + */ +{ + XawTextPosition last = XawTextSourceScan(XawTextGetSource(textwindow), 0, + XawstAll, XawsdRight, 1, True); + XawTextPosition left, right; + XawTextBlock block; + + LispObj *oleft, *oright, *text; + + text = ARGUMENT(2); + oright = ARGUMENT(1); + oleft = ARGUMENT(0); + + CHECK_INDEX(oleft); + CHECK_INDEX(oright); + CHECK_STRING(text); + + left = FIXNUM_VALUE(oleft); + right = FIXNUM_VALUE(oright); + if (left > last) + left = last; + if (left > right) + right = left; + else if (right > last) + right = last; + + block.firstPos = 0; + block.format = FMT8BIT; + block.length = STRLEN(text); + block.ptr = THESTR(text); + XawTextReplace(textwindow, left, right, &block); + + return (text); +} + +LispObj * +Xedit_RightColumn(LispBuiltin *builtin) +/* + right-column &optional right + */ +{ + short right; + Arg arg[1]; + + LispObj *oright; + + oright = ARGUMENT(0); + + if (oright != UNSPEC) { + CHECK_INDEX(oright); + if (FIXNUM_VALUE(oright) >= 32767) + right = 32767; + else + right = FIXNUM_VALUE(oright); + + XtSetArg(arg[0], XtNrightColumn, right); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNrightColumn, &right); + XtGetValues(textwindow, arg, 1); + + oright = FIXNUM(right); + } + + return (oright); +} + +LispObj * +Xedit_Scan(LispBuiltin *builtin) +/* + scan offset type direction &key count include + */ +{ + int i; + XawTextPosition offset; + XawTextScanType type; + XawTextScanDirection direction; + int count; + + LispObj *ooffset, *otype, *odirection, *ocount, *include; + + include = ARGUMENT(4); + if (include == UNSPEC) + include = NIL; + ocount = ARGUMENT(3); + odirection = ARGUMENT(2); + otype = ARGUMENT(1); + ooffset = ARGUMENT(0); + + CHECK_INDEX(ooffset); + offset = FIXNUM_VALUE(ooffset); + + for (i = 0; i < 2; i++) + if (odirection == scan_directions[i]) + break; + if (i >= 2) + LispDestroy("%s: direction must be " + ":LEFT or :RIGHT, not %s", + STRFUN(builtin), STROBJ(odirection)); + direction = (XawTextScanDirection)i; + + for (i = 0; i < 5; i++) + if (otype == scan_types[i]) + break; + if (i >= 5) + LispDestroy("%s: direction must be " + ":POSITIONS, :WHITE-SPACE, :EOL, " + ":PARAGRAPH, :ALL, or :ALPHA-NUMERIC, not %s", + STRFUN(builtin), STROBJ(otype)); + type = (XawTextScanType)i; + + if (ocount == UNSPEC) + count = 1; + else { + CHECK_INDEX(ocount); + count = FIXNUM_VALUE(ocount); + } + + offset = XawTextSourceScan(XawTextGetSource(textwindow), + offset, type, direction, count, + include != NIL); + + return (FIXNUM(offset)); +} + +static LispObj * +XeditSearch(LispBuiltin *builtin, XawTextScanDirection direction) +{ + XawTextBlock block; + XawTextPosition position; + + LispObj *string, *offset, *ignore_case; + + ignore_case = ARGUMENT(2); + offset = ARGUMENT(1); + string = ARGUMENT(0); + + CHECK_STRING(string); + if (offset != UNSPEC) { + CHECK_INDEX(offset); + position = FIXNUM_VALUE(offset); + } + else + position = XawTextGetInsertionPoint(textwindow); + + block.firstPos = (ignore_case != UNSPEC && ignore_case != NIL) ? 1 : 0; + block.format = FMT8BIT; + block.length = STRLEN(string); + block.ptr = THESTR(string); + position = XawTextSourceSearch(XawTextGetSource(textwindow), + position, direction, &block); + + return (position != XawTextSearchError ? FIXNUM(position) : NIL); +} + + +LispObj * +Xedit_SearchBackward(LispBuiltin *builtin) +/* + search-backward string &optional offset ignore-case + */ +{ + return (XeditSearch(builtin, XawsdLeft)); +} + +LispObj * +Xedit_SearchForward(LispBuiltin *builtin) +/* + search-forward string &optional offset ignore-case + */ +{ + return (XeditSearch(builtin, XawsdRight)); +} + +LispObj * +Xedit_VerticalScrollbar(LispBuiltin *builtin) +/* + vertical-scrollbar &optional state + */ +{ + Arg arg[1]; + XawTextScrollMode scroll; + + LispObj *state; + + state = ARGUMENT(0); + + if (state != UNSPEC) { + scroll = state == NIL ? XawtextScrollNever : XawtextScrollAlways; + XtSetArg(arg[0], XtNscrollVertical, scroll); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNscrollVertical, &scroll); + XtGetValues(textwindow, arg, 1); + state = scroll == XawtextScrollAlways ? T : NIL; + } + + return (state); +} + +LispObj * +Xedit_WrapMode(LispBuiltin *builtin) +/* + wrap-mode &optional value + */ +{ + int i; + Arg arg[1]; + XawTextWrapMode wrap; + + LispObj *value; + + value = ARGUMENT(0); + + if (value != UNSPEC) { + for (i = 0; i < 3; i++) + if (value == wrap_modes[i]) + break; + if (i >= 3) + LispDestroy("%s: argument must be " + ":NEVER, :LINE, or :WORD, not %s", + STRFUN(builtin), STROBJ(value)); + XtSetArg(arg[0], XtNwrap, (XawTextWrapMode)i); + XtSetValues(textwindow, arg, 1); + } + else { + XtSetArg(arg[0], XtNwrap, &wrap); + XtGetValues(textwindow, arg, 1); + i = (int)wrap; + if (i <= 0 || i >= 3) + i = 0; + value = wrap_modes[i]; + } + + return (value); +} + +LispObj * +Xedit_XrmStringToQuark(LispBuiltin *builtin) +/* + xrm-string-to-quark string + */ +{ + LispObj *string; + + string = ARGUMENT(0); + + CHECK_STRING(string); + + return (INTEGER(XrmStringToQuark(THESTR(string)))); +} Index: xc/programs/xedit/lisp/xedit.h diff -u /dev/null xc/programs/xedit/lisp/xedit.h:1.5 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/xedit.h Sun Nov 10 18:22:00 2002 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/xedit.h,v 1.5 2002/11/10 23:22:00 paulo Exp $ */ + +#ifndef Lisp_xedit_h +#define Lisp_xedit_h + +#ifdef XEDIT_LISP_PRIVATE +#include "private.h" +#include "io.h" +#include "read.h" +#include "write.h" + +LispObj *Xedit_AddEntity(LispBuiltin*); +LispObj *Xedit_AutoFill(LispBuiltin*); +LispObj *Xedit_Background(LispBuiltin*); +LispObj *Xedit_CharAfter(LispBuiltin*); +LispObj *Xedit_CharBefore(LispBuiltin*); +LispObj *Xedit_ClearEntities(LispBuiltin*); +LispObj *Xedit_ConvertPropertyList(LispBuiltin*); +LispObj *Xedit_Font(LispBuiltin*); +LispObj *Xedit_Foreground(LispBuiltin*); +LispObj *Xedit_GotoChar(LispBuiltin*); +LispObj *Xedit_HorizontalScrollbar(LispBuiltin*); +LispObj *Xedit_Insert(LispBuiltin*); +LispObj *Xedit_Justification(LispBuiltin*); +LispObj *Xedit_LeftColumn(LispBuiltin*); +LispObj *Xedit_Point(LispBuiltin*); +LispObj *Xedit_PointMax(LispBuiltin*); +LispObj *Xedit_PointMin(LispBuiltin*); +LispObj *Xedit_PropertyList(LispBuiltin*); +LispObj *Xedit_ReadText(LispBuiltin*); +LispObj *Xedit_ReplaceText(LispBuiltin*); +LispObj *Xedit_RightColumn(LispBuiltin*); +LispObj *Xedit_Scan(LispBuiltin*); +LispObj *Xedit_SearchBackward(LispBuiltin*); +LispObj *Xedit_SearchForward(LispBuiltin*); +LispObj *Xedit_VerticalScrollbar(LispBuiltin*); +LispObj *Xedit_WrapMode(LispBuiltin*); +LispObj *Xedit_XrmStringToQuark(LispBuiltin*); +#else +#define LispObj void +#endif /* XEDIT_LISP_PRIVATE */ + +typedef struct _EditModeInfo { + char *desc; /* Mode description */ + Widget sme; /* Menu entry */ + LispObj *symbol; /* Symbol holding syntax data */ + LispObj *syntax; /* The syntax definition */ +} EditModeInfo; + +/* Typedef'ed to XeditLispData in ../xedit.h */ +struct _XeditLispData { + LispObj *syntax; /* Syntax definition */ + LispObj *syntable; /* Syntax-table the cursor is located */ + int disable_highlight; /* Working in the buffer */ +}; + +void LispXeditInitialize(void); +void XeditLispExecute(Widget, XawTextPosition, XawTextPosition); +void XeditLispSetEditMode(xedit_flist_item*, LispObj*); +void XeditLispUnsetEditMode(xedit_flist_item*); + +extern EditModeInfo *mode_infos; +extern Cardinal num_mode_infos; + +#endif /* Lisp_xedit_h */ Index: xc/programs/xedit/lisp/modules/Imakefile diff -u xc/programs/xedit/lisp/modules/Imakefile:1.6 xc/programs/xedit/lisp/modules/Imakefile:1.13 --- xc/programs/xedit/lisp/modules/Imakefile:1.6 Sat Oct 27 23:34:31 2001 +++ xc/programs/xedit/lisp/modules/Imakefile Thu Jan 16 01:25:49 2003 @@ -1,20 +1,33 @@ -XCOMM $XFree86: xc/programs/xedit/lisp/modules/Imakefile,v 1.6 2001/10/28 03:34:31 tsi Exp $ +XCOMM $XFree86: xc/programs/xedit/lisp/modules/Imakefile,v 1.13 2003/01/16 06:25:49 paulo Exp $ #include "../lisp.cf" #include "../lisp.rules" -INCLUDES = -I.. -I$(XINCLUDESRC) +INCLUDES = -I.. -I../mp -I$(XINCLUDESRC) -I- #if BuildSharedLispModules -LispModuleTarget(x11, $(XLIB),) -LispModuleTarget(xt, $(XTOOLLIB) $(XLIB),) -LispModuleTarget(xaw, $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB),) -LispModuleTarget(psql, -lpq, -I/usr/include/pgsql) +LispModuleTarget(x11, $(XLIB) $(LOCAL_LIBRARIES),) +LispModuleTarget(xt, $(XTOOLLIB) $(XLIB) $(LOCAL_LIBRARIES),) +LispModuleTarget(xaw, $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LOCAL_LIBRARIES),) InstallMultipleFlags(x11.so,$(LISPDIR),$(INSTINCFLAGS)) InstallMultipleFlags(xt.so,$(LISPDIR),$(INSTINCFLAGS)) InstallMultipleFlags(xaw.so,$(LISPDIR),$(INSTINCFLAGS)) -InstallMultipleFlags(psql.so,$(LISPDIR),$(INSTINCFLAGS)) #endif -InstallMultipleFlags(fun.lsp,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(lisp.lsp,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(xedit.lsp,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(syntax.lsp,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(indent.lsp,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/c.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/html.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/imake.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/lisp.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/make.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/man.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/rpm.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/sgml.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/sh.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/xconf.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/xlog.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) +InstallMultipleFlags(progmodes/xrdb.lsp,$(LISPDIR)/progmodes,$(INSTINCFLAGS)) Index: xc/programs/xedit/lisp/modules/fun.lsp diff -u xc/programs/xedit/lisp/modules/fun.lsp:1.5 xc/programs/xedit/lisp/modules/fun.lsp:removed --- xc/programs/xedit/lisp/modules/fun.lsp:1.5 Fri Oct 19 20:19:36 2001 +++ xc/programs/xedit/lisp/modules/fun.lsp Thu Feb 27 12:34:59 2003 @@ -1,150 +0,0 @@ -;; -;; Copyright (c) 2001 by The XFree86 Project, Inc. -;; -;; Permission is hereby granted, free of charge, to any person obtaining a -;; copy of this software and associated documentation files (the "Software"), -;; to deal in the Software without restriction, including without limitation -;; the rights to use, copy, modify, merge, publish, distribute, sublicense, -;; and/or sell copies of the Software, and to permit persons to whom the -;; Software is furnished to do so, subject to the following conditions: -;; -;; The above copyright notice and this permission notice shall be included in -;; all copies or substantial portions of the Software. -;; -;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -;; SOFTWARE. -;; -;; Except as contained in this notice, the name of the XFree86 Project shall -;; not be used in advertising or otherwise to promote the sale, use or other -;; dealings in this Software without prior written authorization from the -;; XFree86 Project. -;; -;; Author: Paulo César Pereira de Andrade -;; -;; -;; $XFree86: xc/programs/xedit/lisp/modules/fun.lsp,v 1.5 2001/10/20 00:19:36 paulo Exp $ -;; -(provide "fun") - -(defun caar (a) (car (car a))) -(defun cadr (a) (nth 1 a)) -(defun cdar (a) (cdr (car a))) -(defun cddr (a) (nthcdr 2 a)) -(defun caaar (a) (car (car (car a)))) -(defun caadr (a) (car (car (cdr a)))) -(defun cadar (a) (car (cdr (car a)))) -(defun caddr (a) (nth 2 a)) -(defun cdaar (a) (cdr (car (car a)))) -(defun cdadr (a) (cdr (car (cdr a)))) -(defun cddar (a) (cdr (cdr (car a)))) -(defun cdddr (a) (nthcdr 3 a)) -(defun caaaar (a) (car (car (car (car a))))) -(defun caaadr (a) (car (car (car (cdr a))))) -(defun caadar (a) (car (car (cdr (car a))))) -(defun caaddr (a) (car (car (cdr (cdr a))))) -(defun cadaar (a) (car (cdr (car (car a))))) -(defun cadadr (a) (car (cdr (car (cdr a))))) -(defun caddar (a) (car (cdr (cdr (car a))))) -(defun cadddr (a) (nth 3 a)) -(defun cdaaar (a) (cdr (car (car (car a))))) -(defun cdaadr (a) (cdr (car (car (cdr a))))) -(defun cdadar (a) (cdr (car (cdr (car a))))) -(defun cdaddr (a) (cdr (car (cdr (cdr a))))) -(defun cddaar (a) (cdr (cdr (car (car a))))) -(defun cddadr (a) (cdr (cdr (car (cdr a))))) -(defun cdddar (a) (cdr (cdr (cdr (car a))))) -(defun cddddr (a) (nthcdr 4 a)) - -(defun second (a) (nth 1 a)) -(defun third (a) (nth 2 a)) -(defun fourth (a) (nth 3 a)) -(defun fifth (a) (nth 4 a)) -(defun sixth (a) (nth 5 a)) -(defun seventh (a) (nth 6 a)) -(defun eighth (a) (nth 7 a)) -(defun ninth (a) (nth 8 a)) -(defun tenth (a) (nth 9 a)) - -(defun copy-seq (sequence) (subseq sequence 0)) - -(defmacro push (object place) - (list 'setf place (list 'cons object place))) - -(defmacro pop (place) - (list 'prog1 (list 'car place) (list 'setf place (list 'cdr place)))) - -(defmacro prog (init &rest body) - `(block nil (let ,init (tagbody ,@body)))) - -(defmacro prog* (init &rest body) - `(block nil (let* ,init (tagbody ,@body)))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; setf -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defsetf car (list) (value) `(progn (rplaca ,list ,value) ,value)) -(defsetf cdr (list) (value) `(progn (rplacd ,list ,value) ,value)) - -(defsetf caar (list) (value) `(progn (rplaca (car ,list) ,value) ,value)) -(defsetf cadr (list) (value) `(progn (rplaca (cdr ,list) ,value) ,value)) -(defsetf cdar (list) (value) `(progn (rplacd (car ,list) ,value) ,value)) -(defsetf cddr (list) (value) `(progn (rplacd (cdr ,list) ,value) ,value)) -(defsetf caaar (list) (value) `(progn (rplaca (caar ,list) ,value) ,value)) -(defsetf caadr (list) (value) `(progn (rplaca (cadr ,list) ,value) ,value)) -(defsetf cadar (list) (value) `(progn (rplaca (cdar ,list) ,value) ,value)) -(defsetf caddr (list) (value) `(progn (rplaca (cddr ,list) ,value) ,value)) -(defsetf cdaar (list) (value) `(progn (rplacd (caar ,list) ,value) ,value)) -(defsetf cdadr (list) (value) `(progn (rplacd (cadr ,list) ,value) ,value)) -(defsetf cddar (list) (value) `(progn (rplacd (cdar ,list) ,value) ,value)) -(defsetf cdddr (list) (value) `(progn (rplacd (cddr ,list) ,value) ,value)) -(defsetf caaaar (list) (value) `(progn (rplaca (caaar ,list) ,value) ,value)) -(defsetf caaadr (list) (value) `(progn (rplaca (caadr ,list) ,value) ,value)) -(defsetf caadar (list) (value) `(progn (rplaca (cadar ,list) ,value) ,value)) -(defsetf caaddr (list) (value) `(progn (rplaca (caddr ,list) ,value) ,value)) -(defsetf cadaar (list) (value) `(progn (rplaca (cdaar ,list) ,value) ,value)) -(defsetf cadadr (list) (value) `(progn (rplaca (cdadr ,list) ,value) ,value)) -(defsetf caddar (list) (value) `(progn (rplaca (cddar ,list) ,value) ,value)) -(defsetf cadddr (list) (value) `(progn (rplaca (cdddr ,list) ,value) ,value)) -(defsetf cdaaar (list) (value) `(progn (rplacd (caaar ,list) ,value) ,value)) -(defsetf cdaadr (list) (value) `(progn (rplacd (caadr ,list) ,value) ,value)) -(defsetf cdadar (list) (value) `(progn (rplacd (cadar ,list) ,value) ,value)) -(defsetf cdaddr (list) (value) `(progn (rplacd (caddr ,list) ,value) ,value)) -(defsetf cddaar (list) (value) `(progn (rplacd (cdaar ,list) ,value) ,value)) -(defsetf cddadr (list) (value) `(progn (rplacd (cdadr ,list) ,value) ,value)) -(defsetf cdddar (list) (value) `(progn (rplacd (cddar ,list) ,value) ,value)) -(defsetf cddddr (list) (value) `(progn (rplacd (cdddr ,list) ,value) ,value)) - -(defsetf first (list) (value) `(progn (rplaca ,list ,value) ,value)) -(defsetf second (list) (value) `(progn (rplaca (nthcdr 1 ,list) ,value) ,value)) -(defsetf third (list) (value) `(progn (rplaca (nthcdr 2 ,list) ,value) ,value)) -(defsetf fourth (list) (value) `(progn (rplaca (nthcdr 3 ,list) ,value) ,value)) -(defsetf fifth (list) (value) `(progn (rplaca (nthcdr 4 ,list) ,value) ,value)) -(defsetf sixth (list) (value) `(progn (rplaca (nthcdr 5 ,list) ,value) ,value)) -(defsetf seventh (list) (value) `(progn (rplaca (nthcdr 6 ,list) ,value) ,value)) -(defsetf eighth (list) (value) `(progn (rplaca (nthcdr 7 ,list) ,value) ,value)) -(defsetf ninth (list) (value) `(progn (rplaca (nthcdr 8 ,list) ,value) ,value)) -(defsetf tenth (list) (value) `(progn (rplaca (nthcdr 9 ,list) ,value) ,value)) - -(defsetf rest (list) (value) `(progn (rplacd ,list ,value) ,value)) - -(defun xedit::nth-store (index list value) - (rplaca (nthcdr index list) value) value) -(defsetf nth xedit::nth-store) - -(defsetf aref (array &rest indices) (value) - `(xedit::vector-store ,array ,@indices ,value)) - -(defsetf get (symbol key &optional default) (value) - `(xedit::put ,symbol ,key ,value)) - -(defsetf char xedit::char-store) -(defsetf schar xedit::char-store) -(defsetf elt xedit::elt-store) - -(defsetf subseq (sequence start &optional end) (value) - `(progn (replace ,sequence ,value :start1 ,start :end1 ,end) ,value)) Index: xc/programs/xedit/lisp/modules/indent.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/indent.lsp:1.7 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/modules/indent.lsp Tue Jan 28 22:05:53 2003 @@ -0,0 +1,1420 @@ +; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/indent.lsp,v 1.7 2003/01/29 03:05:53 paulo Exp $ +;; + +(provide "indent") +(require "xedit") +(in-package "XEDIT") + +(defconstant indent-spaces '(#\Tab #\Space)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; The final indentation function. +;; Parameters: +;; indent +;; Number of spaces to insert +;; offset +;; Offset to where indentation should be added +;; no-tabs +;; If set, tabs aren't inserted +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun indent-text (indent offset &optional no-tabs + &aux start line length index current tabs spaces string + barrier base result (point (point)) + ) + + ;; Initialize + (setq + start (scan offset :eol :left) + line (read-text start (- offset start)) + length (length line) + index (1- length) + current 0 + base 0 + ) + + (and (minusp indent) (setq indent 0)) + + ;; Skip any spaces after offset, "paranoia check" + (while (member (char-after offset) indent-spaces) + (incf offset) + ) + + ;; Check if there are only spaces before `offset' and the line `start' + (while (and (>= index 0) (member (char line index) indent-spaces)) + (decf index) + ) + + ;; `index' will be zero if there are only spaces in the `line' + (setq barrier (+ start (incf index))) + + ;; Calculate `base' unmodifiable indentation, if any + (dotimes (i index) + (if (char= (char line i) #\Tab) + (incf base (- 8 (rem base 8))) + (incf base) + ) + ) + + ;; If any non blank character would need to be deleted + (and (> base indent) (return-from indent-text nil)) + + ;; Calculate `current' indentation + (setq current base) + (while (< index length) + (if (char= (char line index) #\Tab) + (incf current (- 8 (rem current 8))) + (incf current) + ) + (incf index) + ) + + ;; Maybe could also "optimize" the indentation even if it is already + ;; correct, removing spaces "inside" tabs. + (when (/= indent current) + (if no-tabs + (setq + length (- indent base) + result (+ barrier length) + string (make-string length :initial-element #\Space) + ) + (progn + (multiple-value-setq (tabs spaces) (floor (- indent base) 8)) + (setq + length (+ tabs spaces) + result (+ barrier length) + string (make-string length :initial-element #\Tab) + ) + (fill string #\Space :start tabs) + ) + ) + + (replace-text barrier offset string) + (and (>= offset point) (>= point barrier) (goto-char result)) + ) +) +(compile 'indent-text) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Helper function, returns indentation of a given offset +;; If `align' is set, stop once a non blank character is seen, that +;; is, use `offset' only as a line identifier +;; If `resolve' is set, it means that the offset is just a hint, it +;; maybe anywhere in the line +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun offset-indentation (offset &key resolve align + &aux + char + line + (start (scan offset :eol :left)) + (indent 0)) + (if resolve + (loop + (if (characterp (setq char (char-after start))) + (if (char= char #\Tab) + (incf indent (- 8 (rem indent 8))) + ;; Not a tab, check if is a space + (if (char= char #\Space) + (incf indent) + ;; Not a tab neither a space + (return indent) + ) + ) + ;; EOF found + (return indent) + ) + ;; Increment offset to check next character + (incf start) + ) + (progn + (setq line (read-text start (- offset start))) + (dotimes (i (length line) indent) + (if (char= (setq char (char line i)) #\Tab) + (incf indent (- 8 (rem indent 8))) + (progn + (or align (member char indent-spaces) + (return indent) + ) + (incf indent) + ) + ) + ) + ) + ) +) +(compile 'offset-indentation) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; A default/fallback indentation function, just copy indentation +;; of previous line. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun default-indent (syntax syntable) + (let + ( + (offset (scan (point) :eol :left)) + start + left + right + ) + + syntable ;; XXX hack to not generate warning about unused + ;; variable, should be temporary (until unused + ;; variables can be declared as such) + + (if + (or + ;; if indentation is disabled + (and + (hash-table-p (syntax-options syntax)) + (gethash :disable-indent (syntax-options syntax)) + ) + ;; or if not at the start of a new line + (> (scan offset :eol :right) offset) + ) + (return-from default-indent) + ) + + (setq left offset) + (loop + (setq + start left + left (scan start :eol :left :count 2) + right (scan left :eol :right) + ) + ;; if start of file reached + (and (>= left start) (return)) + (when + (setq + start + (position-if-not + #'(lambda (char) (member char indent-spaces)) + (read-text left (- right left)) + ) + ) + + ;; indent the current line + (indent-text (offset-indentation (+ left start) :align t) offset) + (return) + ) + ) + ) +) +(compile 'default-indent) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Helper function +;; Clear line before cursor if it is empty +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun indent-clear-empty-line (&aux left offset right line index) + (setq + offset (scan (point) :eol :left) + left (scan offset :eol :left :count 2) + right (scan left :eol :right) + ) + + ;; If not at the first line in the file and line is not already empty + (when (and (/= offset left) (/= left right)) + (setq + line (read-text left (- right left)) + index (1- (length line)) + ) + (while (and (>= index 0) (member (char line index) indent-spaces)) + (decf index) + ) + ;; If line was only spaces + (and (minusp index) (replace-text left right "")) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Macro to be called whenever an indentation rule decides that +;; the parser is done. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indent-macro-terminate (&optional result) + `(return-from ind-terminate-block ,result) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Like indent-terminate, but "rejects" the input for the current line +;; and terminates the loop. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indent-macro-reject (&optional result) + `(progn + (setq ind-state ind-prev-state) + (return-from ind-terminate-block ,result) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Like indent-reject, but "rejects" anything before the current token +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indent-macro-reject-left (&optional result) + `(progn + (setq ind-state ind-matches) + (return-from ind-terminate-block ,result) + ) +) + + +(defstruct indtoken + regex ;; a string, character or regex + token ;; the resulting token, nil or a keyword + begin ;; begin a new table + switch ;; switch to another table + ;; begin and switch fields are used like the ones for the syntax highlight + ;; syntoken structure. + label ;; filed at compile time + code ;; code to execute when it matches +) + +(defstruct indtable + label ;; a keyword, name of the table + tokens ;; list of indtoken structures + tables ;; list of indtable structures + augments ;; augment list +) + +(defstruct indaugment + labels ;; list of keywords labeling tables +) + +(defstruct indinit + variables ;; list of variables and optional initialization + ;; Format of variables must be suitable to LET*, example of call: + ;; (indinit + ;; var1 ;; initialized to NIL + ;; (var2 (afun)) ;; initialized to the value returned by AFUN + ;; ) +) + +(defstruct indreduce + token ;; reduced token + rules ;; list of rules + label ;; unique label associated with rule, this + ;; field is automatically filled in the + ;; compilation process. this field exists + ;; to allow several indreduce definitions + ;; that result in the same token + check ;; FORM evaluated, if T apply reduce rule + code ;; PROGN to be called when a rule matches +) + +;; NOTE, unlike "reduce" rules, "resolve" rules cannot be duplicated +(defstruct indresolve + match ;; the matched token (or a list of tokens) + code ;; PROGN to apply for this token +) + +(defstruct indent + reduces ;; list of indreduce structures + tables ;; list of indtable structures + inits ;; initialization list + resolves ;; list of indresolve structures + token-code ;; code to execute when a token matches + check-code ;; code to execute before applying a reduce rule + reduce-code ;; code to execute after reduce rule + resolve-code ;; code to execute when matching a token +) + +(defmacro defindent (variable label &rest lists) + `(if (boundp ',variable) + ,variable + (progn + (proclaim '(special ,variable)) + (setq ,variable (compile-indent-table ,label ,@lists)) + ) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Create an indent token. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indtoken (pattern token + &key icase nospec begin switch code (nosub t)) + (setq pattern (re-comp (eval pattern) :icase icase :nospec nospec :nosub nosub)) + (when (consp (re-exec pattern "" :notbol t :noteol t)) + (error "INDTOKEN: regex ~A matches empty string" pattern) + ) + + ;; result of macro, return token structure + (make-indtoken + :regex pattern + :token token + :begin begin + :switch switch + :code code + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Create an indentation table. Basically a list of indentation tokens. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun indtable (label &rest definitions) + ;; check for simple errors + (unless (keywordp label) + (error "INDTABLE: ~A is not a keyword" label) + ) + (dolist (item definitions) + (unless + (or + (atom item) + (indtoken-p item) + (indtable-p item) + (indaugment-p item) + ) + (error "INDTABLE: invalid indent table argument ~A" item) + ) + ) + + ;; return indent table structure + (make-indtable + :label label + :tokens (remove-if-not #'indtoken-p definitions) + :tables (remove-if-not #'indtable-p definitions) + :augments (remove-if-not #'indaugment-p definitions) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Add identifier to list of augment tables. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun indaugment (&rest keywords) + (dolist (keyword keywords) + (unless (keywordp keyword) + (error "INDAUGMENT: bad indent table label ~A" keyword) + ) + ) + + ;; return augment list structure + (make-indaugment :labels keywords) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Add variables to initialization list +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indinit (&rest variables) + (make-indinit :variables variables) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Create a "reduction rule" +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indreduce (token check rules &rest code &aux nullp consp) + ;; check for simple errors + (unless (or (keywordp token) (null token)) + (error "INDREDUCE: ~A is not a keyword" token) + ) + (dolist (rule rules) + (or (listp rule) (error "INDREDUCE: invalid indent rule ~A" rule)) + ;; XXX This test is not enough, maybe should add some sort of + ;; runtime check to avoid circularity. + (and (eq token (car rule)) (null (cdr rule)) + (error "INDREDUCE: ~A reduces to ~A" token) + ) + (dolist (item rule) + (and (or nullp consp) (not (keywordp item)) + (error "INDREDUCE: a keyword must special pattern") + ) + (if (consp item) + (progn + (unless + (or + (and + (eq (car item) 'not) + (keywordp (cadr item)) + (null (cddr item)) + ) + (and + (eq (car item) 'or) + (null (member-if-not #'keywordp (cdr item))) + ) + ) + (error "INDREDUCE: syntax error parsing ~A" item) + ) + (setq consp t) + ) + (progn + (setq nullp (null item) consp nil) + (unless (or (keywordp item) nullp (eq item t)) + (error "INDREDUCE: ~A is not a keyword" item) + ) + ) + ) + ) +; (and consp +; (error "INDREDUCE: pattern must be followed by keyword") +; ) + ) + + ;; result of macro, return indent reduce structure + (make-indreduce + :token token + :check check + :rules (remove-if #'null rules) + :code code + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Create a "resolve rule" +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indresolve (match &rest code) + ;; check for simple errors + (if (consp match) + (dolist (token match) + (or (keywordp token) (error "INDRESOLVE: ~A is not a keyword" token)) + ) + (or (keywordp match) (error "INDRESOLVE: ~A is not a keyword" match)) + ) + + ;; result of macro, return indent resolve structure + (make-indresolve + :match match + :code code + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Helper function for compile-indent-table. Returns a list of all +;; tables and tokens for a given table, including tokens and tables +;; of children. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun list-indtable-elements (table &aux result sub-result) + (setq result (cons (indtable-tokens table) (indtable-tables table))) + (dolist (child (indtable-tables table)) + (setq sub-result (list-indtable-elements child)) + (rplaca result (append (car result) (car sub-result))) + (rplacd result (append (cdr result) (cdr sub-result))) + ) + ;; Return pair of all nested tokens and tables + result +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; First pass adding augumented tokens to a table, done in two passes +;; to respect inheritance order. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-indent-augment-list (table table-list &aux labels augment tokens) + + ;; Create a list of all augment tables. + (dolist (augment (indtable-augments table)) + (setq labels (append labels (indaugment-labels augment))) + ) + + ;; Remove duplicates and references to "itself", without warnings? + (setq + labels + (remove (indtable-label table) (remove-duplicates labels :from-end t)) + ) + + ;; Check if the specified indent tables exists! + (dolist (label labels) + (unless + (setq augment (car (member label table-list :key #'indtable-label))) + (error "COMPILE-INDENT-AUGMENT-LIST: Cannot augment ~A in ~A" + label + (indtable-label table) + ) + ) + + ;; Increase list of tokens. + (setq tokens (append tokens (indtable-tokens augment))) + ) + + ;; Store the tokens in the augment list. They will be added + ;; to the indent table in the second pass. + (setf (indtable-augments table) tokens) + + ;; Recurse on every child table. + (dolist (child (indtable-tables table)) + (compile-indent-augment-list child table-list) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Last pass adding augmented tokens to a table. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun link-indent-augment-list (table) + (setf + (indtable-tokens table) + (remove-duplicates + (nconc (indtable-tokens table) (indtable-augments table)) + :key #'indtoken-regex + :test #'equal + :from-end t + ) + + ;; Don't need to keep this list anymore. + (indtable-augments table) + () + ) + + (dolist (child (indtable-tables table)) + (link-indent-augment-list child) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Compile the indent reduction rules +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-indent-reduces (reduces + &aux need label check rules reduce + check-code reduce-code) + (dolist (item reduces) + (setq + label (indreduce-label item) + check (indreduce-check item) + rules (indreduce-rules item) + reduce (indreduce-code item) + need (and + rules + (not label) + (or + reduce + (null check) + (not (constantp check)) + ) + ) + ) + (when need + (and (null label) (setq label (intern (string (gensym)) 'keyword))) + + (setf (indreduce-label item) label) + + (and + (or (null check) + (not (constantp check)) + ) + (setq + check (list (list 'eq '*ind-label* label) check) + check-code (nconc check-code (list check)) + ) + ) + + (and reduce + (setq + reduce (cons (list 'eq '*ind-label* label) reduce) + reduce-code (nconc reduce-code (list reduce)) + ) + ) + ) + ) + + ;; XXX Instead of using COND, could/should use CASE + ;; TODO Implement a smart CASE in the bytecode compiler, if + ;; possible, should generate a hashtable, or a table + ;; of indexes (for example when all elements in the cases + ;; are characters) and then jump directly to the code. + (if check-code + (setq check-code (cons 'cond (nconc check-code '((t t))))) + (setq check-code t) + ) + (and reduce-code (setq reduce-code (cons 'cond reduce-code))) + + (values check-code reduce-code) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Compile the indent resolve code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-indent-resolves (resolves &aux match resolve resolve-code) + (and + (/= + (length resolves) + (length (remove-duplicates resolves :key #'indresolve-match)) + ) + ;; XXX Could do a more complete job and tell what is wrong... + (error "COMPILE-INDENT-RESOLVES: duplicated labels") + ) + + (dolist (item resolves) + (when (setq resolve (indresolve-code item)) + (setq + match + (indresolve-match item) + + resolve + (cons + (if (listp match) + (list 'member '*ind-token* `',match :test `#'eq) + (list 'eq '*ind-token* match) + ) + resolve + ) + + resolve-code + (nconc resolve-code (list resolve)) + ) + ) + ) + + (and resolve-code (cons 'cond resolve-code)) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Create an indentation table +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-indent-table (name &rest lists + &aux main elements switches begins tables symbols + label code token-code check-code reduce-code + (inits (remove-if-not #'indinit-p lists)) + (reduces (remove-if-not #'indreduce-p lists)) + (resolves (remove-if-not #'indresolve-p lists)) + ) + (setq + lists (delete-if + #'(lambda (object) + (or + (indinit-p object) + (indreduce-p object) + (indresolve-p object) + ) + ) + lists) + main (apply #'indtable name lists) + elements (list-indtable-elements main) + switches (remove-if #'null (car elements) :key #'indtoken-switch) + begins (remove-if #'null (car elements) :key #'indtoken-begin) + tables (cons main (cdr elements)) + ) + + ;; Check for typos in the keywords, or for not defined indent tables. + (dolist (item (mapcar #'indtoken-switch switches)) + (unless + (or (and (integerp item) (minusp item)) + (member item tables :key #'indtable-label) + ) + (error "COMPILE-INDENT-TABLE: SWITCH ~A cannot be matched" item) + ) + ) + (dolist (item (mapcar #'indtoken-begin begins)) + (unless (member item tables :key #'indtable-label) + (error "COMPILE-INDENT-TABLE: BEGIN ~A cannot be matched" item) + ) + ) + + ;; Build augment list. + (compile-indent-augment-list main tables) + (link-indent-augment-list main) + + ;; Change switch and begin fields to point to the indent table + (dolist (item switches) + (if (keywordp (indtoken-switch item)) + (setf + (indtoken-switch item) + (car (member (indtoken-switch item) tables :key #'indtable-label)) + ) + ) + ) + (dolist (item begins) + (setf + (indtoken-begin item) + (car (member (indtoken-begin item) tables :key #'indtable-label)) + ) + ) + + ;; Build initialization list + (dolist (init inits) + (setq symbols (nconc symbols (indinit-variables init))) + ) + + ;; Build token code + (dolist (item (car elements)) + (when (setq code (indtoken-code item)) + (setf + label + (intern (string (gensym)) 'keyword) + + (indtoken-label item) + label + + code + (list (list 'eq '*ind-label* label) code) + + token-code + (nconc token-code (list code)) + ) + ) + ) + + (multiple-value-setq + (check-code reduce-code) + (compile-indent-reduces reduces) + ) + + (make-indent + :tables tables + :inits symbols + :reduces reduces + :resolves resolves + :token-code (and token-code (cons 'cond token-code)) + :check-code check-code + :reduce-code reduce-code + :resolve-code (compile-indent-resolves resolves) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Search rule-pattern in match-pattern +;; Returns offset of match, and it's length, if any +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun indent-search-rule (rule-pattern match-pattern + &aux start rule rulep matchp test offset length) + (if (member-if-not #'keywordp rule-pattern) + ;; rule has wildcards + (progn + (setq + rulep rule-pattern + matchp match-pattern + start match-pattern + ) + (loop + (setq rule (car rulep)) + (cond + ;; Special pattern + ((consp rule) + (if (eq (car rule) 'not) + (progn + (setq + test (cadr rule) + rulep (cdr rulep) + rule (car rulep) + ) + (while + (and + ;; something to match + matchp + ;; NOT match is true + (not (eq (car matchp) test)) + ;; next match is not true + (not (eq (car matchp) rule)) + ) + (setq matchp (cdr matchp)) + ) + (if (eq (car matchp) rule) + ;; rule matched + (setq + matchp (cdr matchp) + rulep (cdr rulep) + ) + ;; failed + (setq + rulep rule-pattern + matchp (cdr start) + start matchp + ) + ) + ) + ;; (eq (car rule) 'or) + (progn + (if (member (car matchp) (cdr rule) :test #'eq) + (setq rulep (cdr rulep) matchp (cdr matchp)) + ;; failed + (progn + ;; end of match found! + (and (null matchp) (return)) + ;; reset search + (setq + rulep rule-pattern + matchp (cdr start) + start matchp + ) + ) + ) + ) + ) + ) + + ;; Skip until end of match-pattern or rule is found + ((null rule) + (setq rulep (cdr rulep)) + ;; If matches everything + (if (null rulep) + (progn (setq matchp nil) (return)) + ;; If next token cannot be matched + (unless + (setq + matchp + (member (car rulep) matchp :test #'eq) + ) + (setq rulep rule-pattern) + (return) + ) + ) + (setq rulep (cdr rulep) matchp (cdr matchp)) + ) + + ;; Matched + ((eq rule t) + ;; If there isn't a rule to skip + (and (null matchp) (return)) + (setq rulep (cdr rulep) matchp (cdr matchp)) + ) + + ;; Matched + ((eq rule (car matchp)) + (setq rulep (cdr rulep) matchp (cdr matchp)) + ) + + ;; No match + (t + ;; end of match found! + (and (null matchp) (return)) + ;; reset search + (setq + rulep rule-pattern + matchp (cdr start) + start matchp + ) + ) + ) + + ;; if everything matched + (or rulep (return)) + ) + + ;; All rules matched + (unless rulep + ;; Calculate offset and length of match + (setq offset 0 length 0) + (until (eq match-pattern start) + (setq + offset (1+ offset) + match-pattern (cdr match-pattern) + ) + ) + (until (eq match-pattern matchp) + (setq + length (1+ length) + match-pattern (cdr match-pattern) + ) + ) + ) + ) + ;; no wildcards + (and (setq offset (search rule-pattern match-pattern :test #'eq)) + (setq length (length rule-pattern)) + ) + ) + + (values offset length) +) +(compile 'indent-search-rule) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Indentation parser +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro indent-macro (ind-definition ind-offset &optional ind-no-tabs) + `(prog* + ( + ;; Current indentation table + (ind-table (car (indent-tables ,ind-definition))) + + ;; The parser rules + (ind-reduces (indent-reduces ,ind-definition)) + + ;; Token list for the table + (ind-tokens (indtable-tokens ind-table)) + + ;; Stack of nested tables/states + ind-stack + + ;; indentation to be used + (*indent* 0) + + ;; offset to apply indentation + *offset* + + ;; Number of lines read + (*ind-lines* 1) + + ;; Matched token + *ind-token* + + ;; list of tokens after current match, should not be changed + *ind-token-list* + + ;; label associated with rule + *ind-label* + + ;; offset of match + *ind-offset* + + ;; length of match + *ind-length* + + ;; insert position + (*ind-point* (point)) + + (ind-from (scan ,ind-offset :eol :left)) + (ind-to ,ind-offset) + (ind-line (read-text ind-from (- ind-to ind-from))) + + ;; start of current line + (*ind-start* ind-from) + + ;; State information + ind-state + + ;; For use with (indent-macro-reject) + ind-prev-state + + ;; Matches for the current line + ind-matches + + ;; Matched tokens not yet used + ind-cache + + ;; Pattern being tested + ind-token + + ;; Used when searching for a regex + ind-match + + ;; Table to change + ind-change + + ;; Length of ind-line + (ind-length (length ind-line)) + + ;; Don't parse after this offset + (ind-end ind-length) + + ;; Temporary variables used during loops + ind-left + ind-right + ind-tleft + ind-tright + + ;; Set when start of file is found + ind-startp + + ;; Flag for regex search + (ind-noteol (< ind-to (scan ind-from :eol :right))) + + ;; Initialization variables expanded here + ,@(indent-inits (eval ind-definition)) + ) + + ;; Initial input already read + (go :ind-loop) + +;------------------------------------------------------------------------ +; Read a text line +:ind-read + (setq + ind-to ind-from + ind-from (scan ind-from :eol :left :count 2) + ) + ;; If start of file reached + (and (= ind-to ind-from) (setq ind-startp t) (go :ind-process)) + + (setq + *ind-lines* (1+ *ind-lines*) + ind-to (scan ind-from :eol :right) + ind-line (read-text ind-from (- ind-to ind-from)) + ind-length (length ind-line) + ind-end ind-length + ind-noteol nil + ind-cache nil + ind-prev-state ind-state + ) + +;------------------------------------------------------------------------ +; Loop parsing backwards +:ind-loop + (setq ind-matches nil) + (dolist (token ind-tokens) + ;; Prepare to loop + (setq + ind-token (indtoken-regex token) + ind-left 0 + ) + ;; While the pattern matches + (loop + (setq ind-right ind-left) + (if + (consp + (setq + ind-match + (re-exec + ind-token + ind-line + :start ind-left + :end ind-end + :notbol (> ind-left 0) + :noteol ind-noteol + ) + ) + ) + + ;; Remember about match + (setq + ind-match (car ind-match) + ind-left (cdr ind-match) + ind-matches (cons (cons token ind-match) ind-matches) + ) + + ;; No match + (return) + ) + ;; matched an empty string + (and (= ind-left ind-right) (incf ind-left)) + + ;; matched a single eol or bol + (and (>= ind-left ind-end) (return)) + ) + ) + + ;; Add new matches to cache + (when ind-matches + (setq + ind-cache + (stable-sort + (nconc (nreverse ind-matches) ind-cache) #'< :key #'cadr + ) + ) + ) + + ;; If nothing in the cache + (or ind-cache (go :ind-process)) + + (setq + ind-left (cadar ind-cache) + ind-right (cddar ind-cache) + ind-matches (cdr ind-cache) + ) + + ;; If only one element in the cache + (or ind-matches (go :ind-parse)) + + (setq + ind-tleft (cadar ind-matches) + ind-tright (cddar ind-matches) + ) + + ;; Remove overlaps + (loop + (if (or (>= ind-tleft ind-right) (<= ind-tright ind-left)) + ;; No overlap + (progn + (setq + ind-left ind-tleft + ind-right ind-tright + ind-matches (cdr ind-matches) + ) + ;; If everything checked + (or ind-matches (return)) + ) + ;; Overlap found + (progn + (if (consp (cdr ind-matches)) + ;; There are yet items to be checked + (progn + (rplaca ind-matches (cadr ind-matches)) + (rplacd ind-matches (cddr ind-matches)) + ) + ;; Last item + (progn + (rplacd (last ind-cache 2) nil) + (return) + ) + ) + ) + ) + + ;; Prepare for next check + (setq + ind-tleft (cadar ind-matches) + ind-tright (cddar ind-matches) + ) + ) + +;------------------------------------------------------------------------ +; Process the matched tokens +:ind-parse + (setq ind-cache (nreverse ind-cache)) + +:ind-parse-loop + (or (setq ind-match (car ind-cache)) (go :ind-process)) + + (setq + ind-cache (cdr ind-cache) + ind-token (car ind-match) + ) + + (or (member ind-token ind-tokens :test #'eq) + (go :ind-parse-loop) + ) + + ;; If a state should be added + (when (setq ind-change (indtoken-token ind-token)) + (setq + ind-left (cadr ind-match) + ind-right (cddr ind-match) + + *ind-offset* + (+ ind-from ind-left) + + *ind-length* + (- ind-right ind-left) + + ind-state + (cons + (cons ind-change (cons *ind-offset* *ind-length*)) + ind-state + ) + + *ind-label* + (indtoken-label ind-token) + ) + + ;; Expand token code + ,(indent-token-code (eval ind-definition)) + ) + + ;; Check if needs to switch to another table + (when (setq ind-change (indtoken-switch ind-token)) + ;; Need to switch to a previous table + (if (integerp ind-change) + ;; Relative switch + (while (and ind-stack (minusp ind-change)) + (setq + ind-table (pop ind-stack) + ind-change (1+ ind-change) + ) + ) + ;; Search table in the stack + (until + (or + (null ind-stack) + (eq + (setq ind-table (pop ind-stack)) + ind-change + ) + ) + ) + ) + + ;; If no match or stack became empty + (and (null ind-table) + (setq + ind-table + (car (indent-tables ,ind-definition)) + ) + ) + ) + + ;; Check if needs to start a new table + ;; XXX use ind-tleft to reduce number of local variables + (when (setq ind-tleft (indtoken-begin ind-token)) + (setq + ind-change ind-tleft + ind-stack (cons ind-table ind-stack) + ind-table ind-change + ) + ) + + ;; If current "indent pattern table" changed + (when ind-change + (setq + ind-tokens (indtable-tokens ind-table) + ind-cache (nreverse ind-cache) + ind-end (cadr ind-match) + ind-noteol (> ind-length ind-end) + ) + (go :ind-loop) + ) + + (and ind-cache (go :ind-parse-loop)) + +;------------------------------------------------------------------------ +; Everything checked, process result +:ind-process + + ;; If stack is not empty, don't apply rules + (and ind-stack (not ind-startp) (go :ind-read)) + + (block ind-terminate-block + (setq ind-cache nil ind-tleft 0 ind-change (mapcar #'car ind-state)) + (dolist (entry ind-reduces) + (setq + *ind-token* (indreduce-token entry) + *ind-label* (indreduce-label entry) + ) + (dolist (rule (indreduce-rules entry)) + (loop + ;; Check if reduction can be applied + (or + (multiple-value-setq + (ind-match ind-length) + (indent-search-rule rule ind-change) + ) + (return) + ) + + (setq + ;; First element matched + ind-matches (nthcdr ind-match ind-state) + + ;; Offset of match + *ind-offset* (cadar ind-matches) + + *ind-token-list* (nthcdr ind-match ind-change) + + ;; Length of match, note that *ind-length* + ;; Will be transformed to zero bellow if + ;; the rule is deleting entries. + *ind-length* + (if (> ind-length 1) + (progn + (setq + ;; XXX using ind-tright, to reduce + ;; number of local variables... + ind-tright + (nth (1- ind-length) ind-matches) + + ind-right + (+ (cadr ind-tright) + (cddr ind-tright) + ) + ) + (- ind-right *ind-offset*) + ) + (cddar ind-matches) + ) + ) + + ;; XXX using ind-tleft as a counter, to reduce + ;; number of used variables... + (and (>= (incf ind-tleft) 1000) + ;; Should never apply so many reduce rules on + ;; every iteration, if needs to, something is + ;; wrong in the indentation definition... + (error "~D INDREDUCE iterations, ~ + now checking (~A ~A)" + ind-tleft *ind-token* rule + ) + ) + + ;; Check if should apply the reduction + (or + ;; Expand check code + ,(indent-check-code (eval ind-definition)) + (return) + ) + + (if (null *ind-token*) + ;; Remove match + (progn + (setq *ind-length* 0) + (if (= ind-match 0) + ;; Matched the first entry + (setq + ind-state + (nthcdr ind-length ind-matches) + ) + (progn + (setq + ind-matches + (nthcdr (1- ind-match) ind-state) + ) + (rplacd + ind-matches + (nthcdr (1+ ind-length) ind-matches) + ) + ) + ) + ) + + ;; Substitute/simplify + (progn + (rplaca (car ind-matches) *ind-token*) + (when (> ind-length 1) + (rplacd (cdar ind-matches) *ind-length*) + (rplacd + ind-matches + (nthcdr ind-length ind-matches) + ) + ) + ) + ) + (setq + ind-cache t + ind-change (mapcar #'car ind-state) + ) + + ;; Expand reduce code + ,(indent-reduce-code (eval ind-definition)) + ) + ) + ) + + ;; ind-cache will be T if at least one change was done + (and ind-cache (go :ind-process)) + + ;; Start of file reached + (or ind-startp (go :ind-read)) + + ) ;; end of ind-terminate-block + + + (block ind-terminate-block + (setq *ind-token-list* (mapcar #'car ind-state)) + (dolist (item ind-state) + (setq + *ind-token* (car item) + *ind-offset* (cadr item) + *ind-length* (cddr item) + ) + ;; Expand resolve code + ,(indent-resolve-code (eval ind-definition)) + (setq *ind-token-list* (cdr *ind-token-list*)) + ) + ) + + (and (integerp *indent*) + (integerp *offset*) + (indent-text *indent* *offset* ,ind-no-tabs) + ) + ) +) Index: xc/programs/xedit/lisp/modules/lisp.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/lisp.lsp:1.10 --- /dev/null Thu Feb 27 12:34:59 2003 +++ xc/programs/xedit/lisp/modules/lisp.lsp Thu Dec 19 23:32:47 2002 @@ -0,0 +1,174 @@ +;; +;; Copyright (c) 2001 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/lisp.lsp,v 1.10 2002/12/20 04:32:47 paulo Exp $ +;; +(provide "lisp") + +(in-package "LISP") + +(export '( + second third fourth fifth sixth seventh eighth ninth tenth + pathname merge-pathnames + logtest signum + alphanumericp copy-seq push pop prog prog* + with-open-file with-output-to-string +)) + +(defun second (a) (nth 1 a)) +(defun third (a) (nth 2 a)) +(defun fourth (a) (nth 3 a)) +(defun fifth (a) (nth 4 a)) +(defun sixth (a) (nth 5 a)) +(defun seventh (a) (nth 6 a)) +(defun eighth (a) (nth 7 a)) +(defun ninth (a) (nth 8 a)) +(defun tenth (a) (nth 9 a)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; pathnames +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun pathname (filename) + (values (parse-namestring filename))) + +(defun merge-pathnames (pathname &optional defaults default-version) + (if (null default-version) + (parse-namestring pathname nil defaults) + (parse-namestring pathname nil + (make-pathname :defaults defaults :version default-version)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; math +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun logtest (integer1 integer2) + (not (zerop (logand integer1 integer2)))) + +(defun signum (number) + (if (zerop number) number (/ number (abs number)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; misc functions/macros +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun alphanumericp (char) + (or (alpha-char-p char) (not (null (digit-char-p char))))) + +(defun copy-seq (sequence) + (subseq sequence 0)) + +(defmacro prog (init &rest body) + `(block nil (let ,init (tagbody ,@body)))) + +(defmacro prog* (init &rest body) + `(block nil (let* ,init (tagbody ,@body)))) + +(defmacro with-open-file (file &rest body) + `(let ((,(car file) (open ,@(cdr file)))) + (unwind-protect + (progn ,@body) + (if ,(car file) (close ,(car file)))))) + +(defmacro with-output-to-string (stream &rest body) + `(let ((,(car stream) (make-string-output-stream))) + (unwind-protect + (progn ,@body (get-output-stream-string ,(car stream))) + (and ,(car stream) (close ,(car stream)))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; setf +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defsetf car (list) (value) `(progn (rplaca ,list ,value) ,value)) +(defsetf cdr (list) (value) `(progn (rplacd ,list ,value) ,value)) + +(defsetf caar (list) (value) `(progn (rplaca (car ,list) ,value) ,value)) +(defsetf cadr (list) (value) `(progn (rplaca (cdr ,list) ,value) ,value)) +(defsetf cdar (list) (value) `(progn (rplacd (car ,list) ,value) ,value)) +(defsetf cddr (list) (value) `(progn (rplacd (cdr ,list) ,value) ,value)) +(defsetf caaar (list) (value) `(progn (rplaca (caar ,list) ,value) ,value)) +(defsetf caadr (list) (value) `(progn (rplaca (cadr ,list) ,value) ,value)) +(defsetf cadar (list) (value) `(progn (rplaca (cdar ,list) ,value) ,value)) +(defsetf caddr (list) (value) `(progn (rplaca (cddr ,list) ,value) ,value)) +(defsetf cdaar (list) (value) `(progn (rplacd (caar ,list) ,value) ,value)) +(defsetf cdadr (list) (value) `(progn (rplacd (cadr ,list) ,value) ,value)) +(defsetf cddar (list) (value) `(progn (rplacd (cdar ,list) ,value) ,value)) +(defsetf cdddr (list) (value) `(progn (rplacd (cddr ,list) ,value) ,value)) +(defsetf caaaar (list) (value) `(progn (rplaca (caaar ,list) ,value) ,value)) +(defsetf caaadr (list) (value) `(progn (rplaca (caadr ,list) ,value) ,value)) +(defsetf caadar (list) (value) `(progn (rplaca (cadar ,list) ,value) ,value)) +(defsetf caaddr (list) (value) `(progn (rplaca (caddr ,list) ,value) ,value)) +(defsetf cadaar (list) (value) `(progn (rplaca (cdaar ,list) ,value) ,value)) +(defsetf cadadr (list) (value) `(progn (rplaca (cdadr ,list) ,value) ,value)) +(defsetf caddar (list) (value) `(progn (rplaca (cddar ,list) ,value) ,value)) +(defsetf cadddr (list) (value) `(progn (rplaca (cdddr ,list) ,value) ,value)) +(defsetf cdaaar (list) (value) `(progn (rplacd (caaar ,list) ,value) ,value)) +(defsetf cdaadr (list) (value) `(progn (rplacd (caadr ,list) ,value) ,value)) +(defsetf cdadar (list) (value) `(progn (rplacd (cadar ,list) ,value) ,value)) +(defsetf cdaddr (list) (value) `(progn (rplacd (caddr ,list) ,value) ,value)) +(defsetf cddaar (list) (value) `(progn (rplacd (cdaar ,list) ,value) ,value)) +(defsetf cddadr (list) (value) `(progn (rplacd (cdadr ,list) ,value) ,value)) +(defsetf cdddar (list) (value) `(progn (rplacd (cddar ,list) ,value) ,value)) +(defsetf cddddr (list) (value) `(progn (rplacd (cdddr ,list) ,value) ,value)) + +(defsetf first (list) (value) `(progn (rplaca ,list ,value) ,value)) +(defsetf second (list) (value) `(progn (rplaca (nthcdr 1 ,list) ,value) ,value)) +(defsetf third (list) (value) `(progn (rplaca (nthcdr 2 ,list) ,value) ,value)) +(defsetf fourth (list) (value) `(progn (rplaca (nthcdr 3 ,list) ,value) ,value)) +(defsetf fifth (list) (value) `(progn (rplaca (nthcdr 4 ,list) ,value) ,value)) +(defsetf sixth (list) (value) `(progn (rplaca (nthcdr 5 ,list) ,value) ,value)) +(defsetf seventh (list) (value) `(progn (rplaca (nthcdr 6 ,list) ,value) ,value)) +(defsetf eighth (list) (value) `(progn (rplaca (nthcdr 7 ,list) ,value) ,value)) +(defsetf ninth (list) (value) `(progn (rplaca (nthcdr 8 ,list) ,value) ,value)) +(defsetf tenth (list) (value) `(progn (rplaca (nthcdr 9 ,list) ,value) ,value)) + +(defsetf rest (list) (value) `(progn (rplacd ,list ,value) ,value)) + +(defun lisp::nth-store (index list value) + (rplaca (nthcdr index list) value) value) +(defsetf nth lisp::nth-store) + +(defsetf aref (array &rest indices) (value) + `(lisp::vector-store ,array ,@indices ,value)) + +(defsetf get (symbol key &optional default) (value) + `(lisp::put ,symbol ,key ,value)) + +(defsetf symbol-plist lisp::set-symbol-plist) + +(defsetf gethash (key hash-table &optional default) (value) + `(lisp::puthash ,key ,hash-table ,value)) + +(defsetf char lisp::char-store) +(defsetf schar lisp::char-store) +(defsetf elt lisp::elt-store) +(defsetf svref lisp::elt-store) +(defsetf documentation lisp::documentation-store) + +(defsetf symbol-value set) + +(defsetf subseq (sequence start &optional end) (value) + `(progn (replace ,sequence ,value :start1 ,start :end1 ,end) ,value)) Index: xc/programs/xedit/lisp/modules/psql.c diff -u xc/programs/xedit/lisp/modules/psql.c:1.3 xc/programs/xedit/lisp/modules/psql.c:1.12 --- xc/programs/xedit/lisp/modules/psql.c:1.3 Mon Oct 15 11:36:51 2001 +++ xc/programs/xedit/lisp/modules/psql.c Sat Nov 23 03:26:52 2002 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/psql.c,v 1.3 2001/10/15 15:36:51 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/psql.c,v 1.12 2002/11/23 08:26:52 paulo Exp $ */ #include <stdlib.h> #include <libpq-fe.h> @@ -35,70 +35,72 @@ #include <postgres.h> #include <utils/geo_decls.h> #include "internal.h" +#include "private.h" /* * Prototypes */ -int psqlLoadModule(LispMac *mac); +int psqlLoadModule(void); -LispObj *Lisp_PQbackendPID(LispMac*, LispObj*, char*); -LispObj *Lisp_PQclear(LispMac*, LispObj*, char*); -LispObj *Lisp_PQconsumeInput(LispMac*, LispObj*, char*); -LispObj *Lisp_PQdb(LispMac*, LispObj*, char*); -LispObj *Lisp_PQerrorMessage(LispMac*, LispObj*, char*); -LispObj *Lisp_PQexec(LispMac*, LispObj*, char*); -LispObj *Lisp_PQfinish(LispMac*, LispObj*, char*); -LispObj *Lisp_PQfname(LispMac*, LispObj*, char*); -LispObj *Lisp_PQfnumber(LispMac*, LispObj*, char*); -LispObj *Lisp_PQfsize(LispMac*, LispObj*, char*); -LispObj *Lisp_PQftype(LispMac*, LispObj*, char*); -LispObj *Lisp_PQgetlength(LispMac*, LispObj*, char*); -LispObj *Lisp_PQgetvalue(LispMac*, LispObj*, char*); -LispObj *Lisp_PQhost(LispMac*, LispObj*, char*); -LispObj *Lisp_PQnfields(LispMac*, LispObj*, char*); -LispObj *Lisp_PQnotifies(LispMac*, LispObj*, char*); -LispObj *Lisp_PQntuples(LispMac*, LispObj*, char*); -LispObj *Lisp_PQoptions(LispMac*, LispObj*, char*); -LispObj *Lisp_PQpass(LispMac*, LispObj*, char*); -LispObj *Lisp_PQport(LispMac*, LispObj*, char*); -LispObj *Lisp_PQresultStatus(LispMac*, LispObj*, char*); -LispObj *Lisp_PQsetdb(LispMac*, LispObj*, char*); -LispObj *Lisp_PQsocket(LispMac*, LispObj*, char*); -LispObj *Lisp_PQstatus(LispMac*, LispObj*, char*); -LispObj *Lisp_PQtty(LispMac*, LispObj*, char*); -LispObj *Lisp_PQuser(LispMac*, LispObj*, char*); +LispObj *Lisp_PQbackendPID(LispBuiltin*); +LispObj *Lisp_PQclear(LispBuiltin*); +LispObj *Lisp_PQconsumeInput(LispBuiltin*); +LispObj *Lisp_PQdb(LispBuiltin*); +LispObj *Lisp_PQerrorMessage(LispBuiltin*); +LispObj *Lisp_PQexec(LispBuiltin*); +LispObj *Lisp_PQfinish(LispBuiltin*); +LispObj *Lisp_PQfname(LispBuiltin*); +LispObj *Lisp_PQfnumber(LispBuiltin*); +LispObj *Lisp_PQfsize(LispBuiltin*); +LispObj *Lisp_PQftype(LispBuiltin*); +LispObj *Lisp_PQgetlength(LispBuiltin*); +LispObj *Lisp_PQgetvalue(LispBuiltin*); +LispObj *Lisp_PQhost(LispBuiltin*); +LispObj *Lisp_PQnfields(LispBuiltin*); +LispObj *Lisp_PQnotifies(LispBuiltin*); +LispObj *Lisp_PQntuples(LispBuiltin*); +LispObj *Lisp_PQoptions(LispBuiltin*); +LispObj *Lisp_PQpass(LispBuiltin*); +LispObj *Lisp_PQport(LispBuiltin*); +LispObj *Lisp_PQresultStatus(LispBuiltin*); +LispObj *Lisp_PQsetdb(LispBuiltin*); +LispObj *Lisp_PQsetdbLogin(LispBuiltin*); +LispObj *Lisp_PQsocket(LispBuiltin*); +LispObj *Lisp_PQstatus(LispBuiltin*); +LispObj *Lisp_PQtty(LispBuiltin*); +LispObj *Lisp_PQuser(LispBuiltin*); /* * Initialization */ static LispBuiltin lispbuiltins[] = { - {"PQ-BACKEND-PID", Lisp_PQbackendPID, 1, 1, 1,}, - {"PQ-CLEAR", Lisp_PQclear, 1, 1, 1,}, - {"PQ-CONSUME-INPUT", Lisp_PQconsumeInput, 1, 1, 1,}, - {"PQ-DB", Lisp_PQdb, 1, 1, 1,}, - {"PQ-ERROR-MESSAGE", Lisp_PQerrorMessage, 1, 1, 1,}, - {"PQ-EXEC", Lisp_PQexec, 1, 2, 2,}, - {"PQ-FINISH", Lisp_PQfinish, 1, 1, 1,}, - {"PQ-FNAME", Lisp_PQfname, 1, 2, 2,}, - {"PQ-FNUMBER", Lisp_PQfnumber, 1, 2, 2,}, - {"PQ-FSIZE", Lisp_PQfsize, 1, 2, 2,}, - {"PQ-FTYPE", Lisp_PQftype, 1, 2, 2,}, - {"PQ-GETLENGTH", Lisp_PQgetlength, 1, 3, 3,}, - {"PQ-GETVALUE", Lisp_PQgetvalue, 1, 3, 4,}, - {"PQ-HOST", Lisp_PQhost, 1, 1, 1,}, - {"PQ-NFIELDS", Lisp_PQnfields, 1, 1, 1,}, - {"PQ-NOTIFIES", Lisp_PQnotifies, 1, 1, 1,}, - {"PQ-NTUPLES", Lisp_PQntuples, 1, 1, 1,}, - {"PQ-OPTIONS", Lisp_PQoptions, 1, 1, 1,}, - {"PQ-PASS", Lisp_PQpass, 1, 1, 1,}, - {"PQ-PORT", Lisp_PQport, 1, 1, 1,}, - {"PQ-RESULT-STATUS", Lisp_PQresultStatus, 1, 1, 1,}, - {"PQ-SETDB", Lisp_PQsetdb, 1, 5, 5,}, - {"PQ-SETDB-LOGIN", Lisp_PQsetdb, 1, 7, 7,}, - {"PQ-SOCKET", Lisp_PQsocket, 1, 1, 1,}, - {"PQ-STATUS", Lisp_PQstatus, 1, 1, 1,}, - {"PQ-TTY", Lisp_PQtty, 1, 1, 1,}, - {"PQ-USER", Lisp_PQuser, 1, 1, 1,}, + {LispFunction, Lisp_PQbackendPID, "pq-backend-pid connection"}, + {LispFunction, Lisp_PQclear, "pq-clear result"}, + {LispFunction, Lisp_PQconsumeInput, "pq-consume-input connection"}, + {LispFunction, Lisp_PQdb, "pq-db connection"}, + {LispFunction, Lisp_PQerrorMessage, "pq-error-message connection"}, + {LispFunction, Lisp_PQexec, "pq-exec connection query"}, + {LispFunction, Lisp_PQfinish, "pq-finish connection"}, + {LispFunction, Lisp_PQfname, "pq-fname result field-number"}, + {LispFunction, Lisp_PQfnumber, "pq-fnumber result field-name"}, + {LispFunction, Lisp_PQfsize, "pq-fsize result field-number"}, + {LispFunction, Lisp_PQftype, "pq-ftype result field-number"}, + {LispFunction, Lisp_PQgetlength, "pq-getlength result tupple field-number"}, + {LispFunction, Lisp_PQgetvalue, "pq-getvalue result tupple field-number &optional type"}, + {LispFunction, Lisp_PQhost, "pq-host connection"}, + {LispFunction, Lisp_PQnfields, "pq-nfields result"}, + {LispFunction, Lisp_PQnotifies, "pq-notifies connection"}, + {LispFunction, Lisp_PQntuples, "pq-ntuples result"}, + {LispFunction, Lisp_PQoptions, "pq-options connection"}, + {LispFunction, Lisp_PQpass, "pq-pass connection"}, + {LispFunction, Lisp_PQport, "pq-port connection"}, + {LispFunction, Lisp_PQresultStatus, "pq-result-status result"}, + {LispFunction, Lisp_PQsetdb, "pq-setdb host port options tty dbname"}, + {LispFunction, Lisp_PQsetdbLogin, "pq-setdb-login host port options tty dbname login password"}, + {LispFunction, Lisp_PQsocket, "pq-socket connection"}, + {LispFunction, Lisp_PQstatus, "pq-status connection"}, + {LispFunction, Lisp_PQtty, "pq-tty connection"}, + {LispFunction, Lisp_PQuser, "pq-user connection"}, }; LispModuleData psqlLispModuleData = { @@ -112,352 +114,429 @@ * Implementation */ int -psqlLoadModule(LispMac *mac) +psqlLoadModule(void) { int i; - char *fname = "INTERNAL:PSQL-LOAD-MODULE"; + char *fname = "PSQL-LOAD-MODULE"; - PGconn_t = LispRegisterOpaqueType(mac, "PGconn*"); - PGresult_t = LispRegisterOpaqueType(mac, "PGresult*"); - GCProtect(); + PGconn_t = LispRegisterOpaqueType("PGconn*"); + PGresult_t = LispRegisterOpaqueType("PGresult*"); + GCDisable(); /* NOTE: Implemented just enough to make programming examples * (and my needs) work. * Completing this is an exercise to the reader, or may be implemented * when/if required. */ - LispExecute(mac, - "(DEFSTRUCT PG-NOTIFY RELNAME BE-PID)\n" + LispExecute("(DEFSTRUCT PG-NOTIFY RELNAME BE-PID)\n" "(DEFSTRUCT PG-POINT X Y)\n" "(DEFSTRUCT PG-BOX HIGH LOW)\n" "(DEFSTRUCT PG-POLYGON SIZE NUM-POINTS BOUNDBOX POINTS)\n"); /* enum ConnStatusType */ - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-OK"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-OK"), REAL(CONNECTION_OK), fname, 0); - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-BAD"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-BAD"), REAL(CONNECTION_BAD), fname, 0); - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-STARTED"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-STARTED"), REAL(CONNECTION_STARTED), fname, 0); - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-MADE"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-MADE"), REAL(CONNECTION_MADE), fname, 0); - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-AWAITING-RESPONSE"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-AWAITING-RESPONSE"), REAL(CONNECTION_AWAITING_RESPONSE), fname, 0); - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-AUTH-OK"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-AUTH-OK"), REAL(CONNECTION_AUTH_OK), fname, 0); - (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-SETENV"), + (void)LispSetVariable(ATOM2("PG-CONNECTION-SETENV"), REAL(CONNECTION_SETENV), fname, 0); /* enum ExecStatusType */ - (void)LispSetVariable(mac, ATOM2("PGRES-EMPTY-QUERY"), + (void)LispSetVariable(ATOM2("PGRES-EMPTY-QUERY"), REAL(PGRES_EMPTY_QUERY), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-COMMAND-OK"), + (void)LispSetVariable(ATOM2("PGRES-COMMAND-OK"), REAL(PGRES_COMMAND_OK), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-TUPLES-OK"), + (void)LispSetVariable(ATOM2("PGRES-TUPLES-OK"), REAL(PGRES_TUPLES_OK), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-COPY-OUT"), + (void)LispSetVariable(ATOM2("PGRES-COPY-OUT"), REAL(PGRES_COPY_OUT), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-COPY-IN"), + (void)LispSetVariable(ATOM2("PGRES-COPY-IN"), REAL(PGRES_COPY_IN), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-BAD-RESPONSE"), + (void)LispSetVariable(ATOM2("PGRES-BAD-RESPONSE"), REAL(PGRES_BAD_RESPONSE), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-NONFATAL-ERROR"), + (void)LispSetVariable(ATOM2("PGRES-NONFATAL-ERROR"), REAL(PGRES_NONFATAL_ERROR), fname, 0); - (void)LispSetVariable(mac, ATOM2("PGRES-FATAL-ERROR"), + (void)LispSetVariable(ATOM2("PGRES-FATAL-ERROR"), REAL(PGRES_FATAL_ERROR), fname, 0); - GCUProtect(); + GCEnable(); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) - LispAddBuiltinFunction(mac, &lispbuiltins[i]); + LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } LispObj * -Lisp_PQbackendPID(LispMac *mac, LispObj *list, char *fname) +Lisp_PQbackendPID(LispBuiltin *builtin) +/* + pq-backend-pid connection + */ { int pid; PGconn *conn; + + LispObj *connection; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + connection = ARGUMENT(0); - conn = (PGconn*)(CAR(list)->data.opaque.data); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + pid = PQbackendPID(conn); - return (REAL(pid)); + return (INTEGER(pid)); } LispObj * -Lisp_PQclear(LispMac *mac, LispObj *list, char *fname) +Lisp_PQclear(LispBuiltin *builtin) +/* + pq-clear result + */ { PGresult *res; + + LispObj *result; + + result = ARGUMENT(0); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); - res = (PGresult*)(CAR(list)->data.opaque.data); PQclear(res); return (NIL); } LispObj * -Lisp_PQconsumeInput(LispMac *mac, LispObj *list, char *fname) +Lisp_PQconsumeInput(LispBuiltin *builtin) +/* + pq-consume-input connection + */ { int result; PGconn *conn; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *connection; - conn = (PGconn*)(CAR(list)->data.opaque.data); + connection = ARGUMENT(0); + + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + result = PQconsumeInput(conn); - return (REAL(result)); + return (INTEGER(result)); } LispObj * -Lisp_PQdb(LispMac *mac, LispObj *list, char *fname) +Lisp_PQdb(LispBuiltin *builtin) +/* + pq-db connection + */ { - char *str; + char *string; PGconn *conn; + + LispObj *connection; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + connection = ARGUMENT(0); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQdb(conn); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - return (str ? STRING(str) : NIL); + string = PQdb(conn); + + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQerrorMessage(LispMac *mac, LispObj *list, char *fname) +Lisp_PQerrorMessage(LispBuiltin *builtin) { - char *str; + char *string; PGconn *conn; + + LispObj *connection; + + connection = ARGUMENT(0); - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQerrorMessage(conn); + string = PQerrorMessage(conn); - return (str ? STRING(str) : NIL); + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQexec(LispMac *mac, LispObj *list, char *fname) +Lisp_PQexec(LispBuiltin *builtin) +/* + pq-exec connection query + */ { PGconn *conn; PGresult *res; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *connection, *query; - conn = (PGconn*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispString_t) - LispDestroy(mac, "expecting string, at %s", fname); + query = ARGUMENT(1); + connection = ARGUMENT(0); - res = PQexec(conn, STRPTR(CAR(list))); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + CHECK_STRING(query); + res = PQexec(conn, THESTR(query)); + return (res ? OPAQUE(res, PGresult_t) : NIL); } LispObj * -Lisp_PQfinish(LispMac *mac, LispObj *list, char *fname) +Lisp_PQfinish(LispBuiltin *builtin) +/* + pq-finish connection + */ { PGconn *conn; + + LispObj *connection; + + connection = ARGUMENT(0); - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - conn = (PGconn*)(CAR(list)->data.opaque.data); PQfinish(conn); return (NIL); } LispObj * -Lisp_PQfname(LispMac *mac, LispObj *list, char *fname) +Lisp_PQfname(LispBuiltin *builtin) +/* + pq-fname result field-number + */ { - char *str; + char *string; int field; PGresult *res; + + LispObj *result, *field_number; + + field_number = ARGUMENT(1); + result = ARGUMENT(0); + + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - res = (PGresult*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - field = (int)CAR(list)->data.real; + CHECK_INDEX(field_number); + field = FIXNUM_VALUE(field_number); - str = PQfname(res, field); + string = PQfname(res, field); - return (str ? STRING(str) : NIL); + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQfnumber(LispMac *mac, LispObj *list, char *fname) +Lisp_PQfnumber(LispBuiltin *builtin) +/* + pq-fnumber result field-name + */ { - int num; + int number; + int field; PGresult *res; + + LispObj *result, *field_name; + + field_name = ARGUMENT(1); + result = ARGUMENT(0); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - res = (PGresult*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispString_t) - LispDestroy(mac, "expecting string, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); - num = PQfnumber(res, STRPTR(CAR(list))); + CHECK_STRING(field_name); + number = PQfnumber(res, THESTR(field_name)); - return (REAL(num)); + return (INTEGER(number)); } LispObj * -Lisp_PQfsize(LispMac *mac, LispObj *list, char *fname) +Lisp_PQfsize(LispBuiltin *builtin) +/* + pq-fsize result field-number + */ { int size, field; PGresult *res; + + LispObj *result, *field_number; + + field_number = ARGUMENT(1); + result = ARGUMENT(0); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - res = (PGresult*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - field = (int)CAR(list)->data.real; + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); + CHECK_INDEX(field_number); + field = FIXNUM_VALUE(field_number); + size = PQfsize(res, field); - return (REAL(size)); + return (INTEGER(size)); } LispObj * -Lisp_PQftype(LispMac *mac, LispObj *list, char *fname) +Lisp_PQftype(LispBuiltin *builtin) { Oid oid; int field; PGresult *res; + + LispObj *result, *field_number; + + field_number = ARGUMENT(1); + result = ARGUMENT(0); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - res = (PGresult*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - field = (int)CAR(list)->data.real; + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); + CHECK_INDEX(field_number); + field = FIXNUM_VALUE(field_number); + oid = PQftype(res, field); - return (REAL(oid)); + return (INTEGER(oid)); } LispObj * -Lisp_PQgetlength(LispMac *mac, LispObj *list, char *fname) +Lisp_PQgetlength(LispBuiltin *builtin) +/* + pq-getlength result tupple field-number + */ { PGresult *res; - int tuple, field, len; + int tuple, field, length; + + LispObj *result, *otupple, *field_number; + + field_number = ARGUMENT(2); + otupple = ARGUMENT(1); + result = ARGUMENT(0); + + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); + + CHECK_INDEX(otupple); + tuple = FIXNUM_VALUE(otupple); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - res = (PGresult*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - tuple = (int)CAR(list)->data.real; - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - field = (int)CAR(list)->data.real; + CHECK_INDEX(field_number); + field = FIXNUM_VALUE(field_number); - len = PQgetlength(res, tuple, field); + length = PQgetlength(res, tuple, field); - return (REAL(len)); + return (INTEGER(length)); } -/* (pq-getvalue connection tuple field &optional type-specifier) */ LispObj * -Lisp_PQgetvalue(LispMac *mac, LispObj *list, char *fname) +Lisp_PQgetvalue(LispBuiltin *builtin) +/* + pq-getvalue result tuple field &optional type-specifier + */ { - char *str; + char *string; double real = 0.0; PGresult *res; - int tuple, field, isreal = 0; + int tuple, field, isint = 0, isreal = 0, integer; - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - res = (PGresult*)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - tuple = (int)CAR(list)->data.real; - list = CDR(list); - if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || - (int)CAR(list)->data.real != CAR(list)->data.real) - LispDestroy(mac, "expecting positive integer, at %s", fname); - field = (int)CAR(list)->data.real; - - str = PQgetvalue(res, tuple, field); - - list = CDR(list); - if (list != NIL) { - if (CAR(list)->type != LispAtom_t) - LispDestroy(mac, "expecting atom, at %s"); - if (strcmp(STRPTR(CAR(list)), "INT16") == 0) { - real = *(short*)str; - isreal = 1; + LispObj *result, *otupple, *field_number, *type; + + type = ARGUMENT(3); + field_number = ARGUMENT(2); + otupple = ARGUMENT(1); + result = ARGUMENT(0); + + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); + + CHECK_INDEX(otupple); + tuple = FIXNUM_VALUE(otupple); + + CHECK_INDEX(field_number); + field = FIXNUM_VALUE(field_number); + + string = PQgetvalue(res, tuple, field); + + if (type != UNSPEC) { + char *typestring; + + CHECK_SYMBOL(type); + typestring = ATOMID(type); + + if (strcmp(typestring, "INT16") == 0) { + integer = *(short*)string; + isint = 1; goto simple_type; } - else if (strcmp(STRPTR(CAR(list)), "INT32") == 0) { - real = *(int*)str; - isreal = 1; + else if (strcmp(typestring, "INT32") == 0) { + integer = *(int*)string; + isint = 1; goto simple_type; } - else if (strcmp(STRPTR(CAR(list)), "FLOAT") == 0) { - real = *(float*)str; + else if (strcmp(typestring, "FLOAT") == 0) { + real = *(float*)string; isreal = 1; goto simple_type; } - else if (strcmp(STRPTR(CAR(list)), "REAL") == 0) { - real = *(double*)str; + else if (strcmp(typestring, "REAL") == 0) { + real = *(double*)string; isreal = 1; goto simple_type; } - else if (strcmp(STRPTR(CAR(list)), "PG-POLYGON") == 0) + else if (strcmp(typestring, "PG-POLYGON") == 0) goto polygon_type; - else if (strcmp(STRPTR(CAR(list)), "STRING") != 0) - LispDestroy(mac, "unknown type specifier %s, at %s", - STRPTR(CAR(list)), fname); + else if (strcmp(typestring, "STRING") != 0) + LispDestroy("%s: unknown type %s", + STRFUN(builtin), typestring); } simple_type: - return (isreal ? REAL(real) : (str ? STRING(str) : NIL)); + return (isint ? INTEGER(integer) : isreal ? DFLOAT(real) : + (string ? STRING(string) : NIL)); polygon_type: { @@ -466,293 +545,439 @@ int i, size; size = PQgetlength(res, tuple, field); - polygon = (POLYGON*)(str - sizeof(int)); + polygon = (POLYGON*)(string - sizeof(int)); - GCProtect(); + GCDisable(); /* get polygon->boundbox */ cdr = EVAL(CONS(ATOM("MAKE-PG-POINT"), - CONS(ATOM(":X"), + CONS(KEYWORD("X"), CONS(REAL(polygon->boundbox.high.x), - CONS(ATOM(":Y"), + CONS(KEYWORD("Y"), CONS(REAL(polygon->boundbox.high.y), NIL)))))); obj = EVAL(CONS(ATOM("MAKE-PG-POINT"), - CONS(ATOM(":X"), + CONS(KEYWORD("X"), CONS(REAL(polygon->boundbox.low.x), - CONS(ATOM(":Y"), + CONS(KEYWORD("Y"), CONS(REAL(polygon->boundbox.low.y), NIL)))))); box = EVAL(CONS(ATOM("MAKE-PG-BOX"), - CONS(ATOM(":HIGH"), + CONS(KEYWORD("HIGH"), CONS(cdr, - CONS(ATOM(":LOW"), + CONS(KEYWORD("LOW"), CONS(obj, NIL)))))); /* get polygon->p values */ for (i = 0; i < polygon->npts; i++) { obj = EVAL(CONS(ATOM("MAKE-PG-POINT"), - CONS(ATOM(":X"), + CONS(KEYWORD("X"), CONS(REAL(polygon->p[i].x), - CONS(ATOM(":Y"), + CONS(KEYWORD("Y"), CONS(REAL(polygon->p[i].y), NIL)))))); if (i == 0) p = cdr = CONS(obj, NIL); else { - CDR(cdr) = CONS(obj, NIL); + RPLACD(cdr, CONS(obj, NIL)); cdr = CDR(cdr); } } /* make result */ poly = EVAL(CONS(ATOM("MAKE-PG-POLYGON"), - CONS(ATOM(":SIZE"), + CONS(KEYWORD("SIZE"), CONS(REAL(size), - CONS(ATOM(":NUM-POINTS"), + CONS(KEYWORD("NUM-POINTS"), CONS(REAL(polygon->npts), - CONS(ATOM(":BOUNDBOX"), + CONS(KEYWORD("BOUNDBOX"), CONS(box, - CONS(ATOM(":POINTS"), + CONS(KEYWORD("POINTS"), CONS(QUOTE(p), NIL)))))))))); - GCUProtect(); + GCEnable(); return (poly); } } LispObj * -Lisp_PQhost(LispMac *mac, LispObj *list, char *fname) +Lisp_PQhost(LispBuiltin *builtin) +/* + pq-host connection + */ { - char *str; + char *string; PGconn *conn; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *connection; - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQhost(conn); + connection = ARGUMENT(0); - return (str ? STRING(str) : NIL); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + + string = PQhost(conn); + + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQnfields(LispMac *mac, LispObj *list, char *fname) +Lisp_PQnfields(LispBuiltin *builtin) +/* + pq-nfields result + */ { int nfields; PGresult *res; + + LispObj *result; - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); + result = ARGUMENT(0); - res = (PGresult*)(CAR(list)->data.opaque.data); + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); + nfields = PQnfields(res); - return (REAL(nfields)); + return (INTEGER(nfields)); } LispObj * -Lisp_PQnotifies(LispMac *mac, LispObj *list, char *fname) +Lisp_PQnotifies(LispBuiltin *builtin) +/* + pq-notifies connection + */ { - LispObj *res, *code, *frm = FRM; + LispObj *result, *code, *cod = COD; PGconn *conn; PGnotify *notifies; + + LispObj *connection; + + connection = ARGUMENT(0); - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - conn = (PGconn*)(CAR(list)->data.opaque.data); if ((notifies = PQnotifies(conn)) == NULL) return (NIL); - GCProtect(); + GCDisable(); code = CONS(ATOM("MAKE-PG-NOTIFY"), - CONS(ATOM(":RELNAME"), + CONS(KEYWORD("RELNAME"), CONS(STRING(notifies->relname), - CONS(ATOM(":BE-PID"), + CONS(KEYWORD("BE-PID"), CONS(REAL(notifies->be_pid), NIL))))); - FRM = CONS(code, FRM); - GCUProtect(); - res = EVAL(code); - FRM = frm; + COD = CONS(code, COD); + GCEnable(); + result = EVAL(code); + COD = cod; free(notifies); - return (res); + return (result); } LispObj * -Lisp_PQntuples(LispMac *mac, LispObj *list, char *fname) +Lisp_PQntuples(LispBuiltin *builtin) +/* + pq-ntuples result + */ { int ntuples; PGresult *res; + + LispObj *result; + + result = ARGUMENT(0); - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); - res = (PGresult*)(CAR(list)->data.opaque.data); ntuples = PQntuples(res); - return (REAL(ntuples)); + return (INTEGER(ntuples)); } LispObj * -Lisp_PQoptions(LispMac *mac, LispObj *list, char *fname) +Lisp_PQoptions(LispBuiltin *builtin) +/* + pq-options connection + */ { - char *str; + char *string; PGconn *conn; + + LispObj *connection; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + connection = ARGUMENT(0); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQoptions(conn); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - return (str ? STRING(str) : NIL); + string = PQoptions(conn); + + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQpass(LispMac *mac, LispObj *list, char *fname) +Lisp_PQpass(LispBuiltin *builtin) +/* + pq-pass connection + */ { - char *str; + char *string; PGconn *conn; + + LispObj *connection; + + connection = ARGUMENT(0); - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQpass(conn); + string = PQpass(conn); - return (str ? STRING(str) : NIL); + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQport(LispMac *mac, LispObj *list, char *fname) +Lisp_PQport(LispBuiltin *builtin) +/* + pq-port connection + */ { - char *str; + char *string; PGconn *conn; + + LispObj *connection; + + connection = ARGUMENT(0); + + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + + string = PQport(conn); + + return (string ? STRING(string) : NIL); +} + +LispObj * +Lisp_PQresultStatus(LispBuiltin *builtin) +/* + pq-result-status result + */ +{ + int status; + PGresult *res; + + LispObj *result; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + result = ARGUMENT(0); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQport(conn); + if (!CHECKO(result, PGresult_t)) + LispDestroy("%s: cannot convert %s to PGresult*", + STRFUN(builtin), STROBJ(result)); + res = (PGresult*)(result->data.opaque.data); - return (str ? STRING(str) : NIL); + status = PQresultStatus(res); + + return (INTEGER(status)); } LispObj * -Lisp_PQsetdb(LispMac *mac, LispObj *list, char *fname) +LispPQsetdb(LispBuiltin *builtin, int loginp) +/* + pq-setdb host port options tty dbname + pq-setdb-login host port options tty dbname login password + */ { PGconn *conn; - LispObj *obj; - char *host, *port, *options, *tty, *dbname, *login, *pass; + char *host, *port, *options, *tty, *dbname, *login, *password; + + LispObj *ohost, *oport, *ooptions, *otty, *odbname, *ologin, *opassword; + + if (loginp) { + opassword = ARGUMENT(6); + ologin = ARGUMENT(5); + } + else + opassword = ologin = NIL; + odbname = ARGUMENT(4); + otty = ARGUMENT(3); + ooptions = ARGUMENT(2); + oport = ARGUMENT(1); + ohost = ARGUMENT(0); + + if (ohost != NIL) { + CHECK_STRING(ohost); + host = THESTR(ohost); + } + else + host = NULL; + + if (oport != NIL) { + CHECK_STRING(oport); + port = THESTR(oport); + } + else + port = NULL; + + if (ooptions != NIL) { + CHECK_STRING(ooptions); + options = THESTR(ooptions); + } + else + options = NULL; + + if (otty != NIL) { + CHECK_STRING(otty); + tty = THESTR(otty); + } + else + tty = NULL; - for (obj = list; obj != NIL; obj = CDR(obj)) - if (CAR(obj) != NIL && CAR(obj)->type != LispString_t) - LispDestroy(mac, "expecting string, at %s", fname); + if (odbname != NIL) { + CHECK_STRING(odbname); + dbname = THESTR(odbname); + } + else + dbname = NULL; + + if (ologin != NIL) { + CHECK_STRING(ologin); + login = THESTR(ologin); + } + else + login = NULL; - host = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); - list = CDR(list); - port = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); - list = CDR(list); - options = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); - list = CDR(list); - tty = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); - list = CDR(list); - dbname = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); - list = CDR(list); - if (list != NIL) { - login = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); - list = CDR(list); - pass = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + if (opassword != NIL) { + CHECK_STRING(opassword); + password = THESTR(opassword); } else - login = pass = NULL; + password = NULL; - conn = PQsetdbLogin(host, port, options, tty, dbname, login, pass); + conn = PQsetdbLogin(host, port, options, tty, dbname, login, password); return (conn ? OPAQUE(conn, PGconn_t) : NIL); } LispObj * -Lisp_PQresultStatus(LispMac *mac, LispObj *list, char *fname) +Lisp_PQsetdb(LispBuiltin *builtin) +/* + pq-setdb host port options tty dbname + */ { - int status; - PGresult *res; - - if (!CHECKO(CAR(list), PGresult_t)) - LispDestroy(mac, "cannot convert %s to PGresult*, at %s", - LispStrObj(mac, CAR(list)), fname); - - res = (PGresult*)(CAR(list)->data.opaque.data); - status = PQresultStatus(res); + return (LispPQsetdb(builtin, 0)); +} - return (REAL(status)); +LispObj * +Lisp_PQsetdbLogin(LispBuiltin *builtin) +/* + pq-setdb-login host port options tty dbname login password + */ +{ + return (LispPQsetdb(builtin, 1)); } LispObj * -Lisp_PQsocket(LispMac *mac, LispObj *list, char *fname) +Lisp_PQsocket(LispBuiltin *builtin) +/* + pq-socket connection + */ { int sock; PGconn *conn; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *connection; - conn = (PGconn*)(CAR(list)->data.opaque.data); + connection = ARGUMENT(0); + + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + sock = PQsocket(conn); - return (REAL(sock)); + return (INTEGER(sock)); } LispObj * -Lisp_PQstatus(LispMac *mac, LispObj *list, char *fname) +Lisp_PQstatus(LispBuiltin *builtin) +/* + pq-status connection + */ { int status; PGconn *conn; + + LispObj *connection; - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + connection = ARGUMENT(0); - conn = (PGconn*)(CAR(list)->data.opaque.data); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); + status = PQstatus(conn); - return (REAL(status)); + return (INTEGER(status)); } LispObj * -Lisp_PQtty(LispMac *mac, LispObj *list, char *fname) +Lisp_PQtty(LispBuiltin *builtin) +/* + pq-tty connection + */ { - char *str; + char *string; PGconn *conn; + + LispObj *connection; + + connection = ARGUMENT(0); - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQtty(conn); + string = PQtty(conn); - return (str ? STRING(str) : NIL); + return (string ? STRING(string) : NIL); } LispObj * -Lisp_PQuser(LispMac *mac, LispObj *list, char *fname) +Lisp_PQuser(LispBuiltin *builtin) +/* + pq-user connection + */ { - char *str; + char *string; PGconn *conn; + + LispObj *connection; + + connection = ARGUMENT(0); - if (!CHECKO(CAR(list), PGconn_t)) - LispDestroy(mac, "cannot convert %s to PGconn*, at %s", - LispStrObj(mac, CAR(list)), fname); + if (!CHECKO(connection, PGconn_t)) + LispDestroy("%s: cannot convert %s to PGconn*", + STRFUN(builtin), STROBJ(connection)); + conn = (PGconn*)(connection->data.opaque.data); - conn = (PGconn*)(CAR(list)->data.opaque.data); - str = PQuser(conn); + string = PQuser(conn); - return (str ? STRING(str) : NIL); + return (string ? STRING(string) : NIL); } Index: xc/programs/xedit/lisp/modules/syntax.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/syntax.lsp:1.11 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/syntax.lsp Wed Jan 15 22:50:46 2003 @@ -0,0 +1,1452 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/syntax.lsp,v 1.11 2003/01/16 03:50:46 paulo Exp $ +;; + +(provide "syntax") +(require "xedit") +(in-package "XEDIT") + +(defvar *syntax-symbols* '( + syntax-highlight defsyntax defsynprop synprop-p syntax-p + syntable syntoken synaugment + *prop-default* *prop-keyword* *prop-number* *prop-string* + *prop-constant* *prop-comment* *prop-preprocessor* + *prop-punctuation* *prop-error* *prop-annotation* +)) +(export *syntax-symbols*) +(in-package "USER") +(dolist (symbol xedit::*syntax-symbols*) + (import symbol) +) +(in-package "XEDIT") +(makunbound '*syntax-symbols*) + +#| +TODO: +o Add a command to match without increment the offset in the input, this + may be useful for example in a case like: + some-table + match "<" + switch -1 + match "<" <- the table already eated this, so it won't be matched. + This must be carefully checked at compile time, such instruction should + be in a token that returns or starts a new one, and even then, may need + runtime check to make sure it won't enter an infinite loop. +o Allow combining properties, this is supported in Xaw, and could allow some + very interesting effects for complex documents. +o Maybe have an separated function/loop for tables that don't have tokens + that start/switch to another table, and/or have the contained attribute set. + This could allow running considerably faster. +o Do a better handling of interactive edition for tokens that start and end + with the same pattern, as an example strings, if the user types '"', it + will parse up to the end of the file, "inverting" all strings. +o Allow generic code to be run once a match is found, such code could handle + some defined variables and take decisions based on the parser state. This + should be detected at compile time, to maybe run a different parser for + such syntax tables, due to the extra time building the environment to + call the code. This would be useful to "really" parse documents with + complex syntax, for example, a man page source file. +o Add command to change current default property without initializing a new + state. +o Fix problems matching EOL. Since EOL is an empty string match, if there + is a rule to match only EOL, but some other rule matches up to the end + of the input, the match to EOL will not be recognized. Currently the only + way to handle this is to have a nested table that always returns once a + match is found, so that it will restart the match loop code even if the + input is at EOL. + One possible solution would be to add the ending newline to the input, + and then instead of matching "$", should match "\\n". +o XXX Usage of the variable newline-property must be reviewed in function + syntax-highlight, if the text property has a background attribute, + visual effect will look "strange", will paint a square with the + background attribute at the end of every line in the matched text. +|# + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Some annotations to later write documentation for the module... +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +#| + The current interface logic should be easy to understand for people +that have written lex scanners before. It has some extended semantics, +that could be translated to stacked BEGIN() statements in lex, but +currently does not have rules for matches in the format RE/TRAILING, as +well as code attached to rules (the biggest difference) and/or things +like REJECT and unput(). Also, at least currently, it is *really* quite +slower than lex. + + MATCHING RULES + -------------- + When two tokens are matched at the same input offset, the longest +token is used, if the length is the same, the first definition is +used. For example: + token1 => int + token2 => [A-Za-z]+ + input => integer + Token1 matches "int" and token2 matches "integer", but since token2 is +longer, it is used. But in the case: + token1 => int + token2 => [A-Za-z]+ + input => int + Both, token1 and token2 match "int", since token1 is defined first, it +is used. +|# + + +;; Initialize some default properties that may be shared in syntax +;; highlight definitions. Use of these default properties is encouraged, +;; so that "tokens" will be shown identically when editing program +;; sources in different programming languages. +(defsynprop *prop-default* + "default" + :font "*courier-medium-r*12*" + :foreground "black") + +(defsynprop *prop-keyword* + "keyword" + :font "*courier-bold-r*12*" + :foreground "gray12") + +(defsynprop *prop-number* + "number" + :font "*courier-bold-r*12*" + :foreground "OrangeRed3") + +(defsynprop *prop-string* + "string" + :font "*lucidatypewriter-medium-r*12*" + :foreground "RoyalBlue2") + +(defsynprop *prop-constant* + "constant" + :font "*lucidatypewriter-medium-r*12*" + :foreground "VioletRed3") + +(defsynprop *prop-comment* + "comment" + :font "*courier-medium-o*12*" + :foreground "SlateBlue3") + +(defsynprop *prop-preprocessor* + "preprocessor" + :font "*courier-medium-r*12*" + :foreground "green4") + +(defsynprop *prop-punctuation* + "punctuation" + :font "*courier-bold-r*12*" + :foreground "gray12") + +;; Control characters, not always errors... +(defsynprop *prop-control* + "control" + :font "*courier-bold-r*12*" + :foreground "yellow2" + :background "red3") + +(defsynprop *prop-error* + "error" + :font "*new century schoolbook-bold*24*" + :foreground "yellow" + :background "red") + +(defsynprop *prop-annotation* + "annotation" + :font "*courier-medium-r*12*" + :foreground "black" + :background "PaleGreen") + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; The "main" definition of the syntax highlight coding interface. +;; Creates a "special" variable with the given name, associating to +;; it an already compiled syntax table. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro defsyntax (variable label property indent options &rest lists) + `(if (boundp ',variable) + ,variable + (progn + (proclaim '(special ,variable)) + (setq ,variable + (compile-syntax-table + (string ',variable) ,options + (syntable ,label ,property ,indent ,@lists) + ) + ) + ) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Just a wrapper to create a hash-table and bound it to a symbol. +;; Example of call: +;; (defsynoptions *my-syntax-options* +;; (:indent . 8) +;; (:indent-option-1 . 1) +;; (:indent-option-2 . 2) +;; ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro defsynoptions (variable &rest options) + `(if (boundp ',variable) + ,variable + (progn + (proclaim '(special ,variable)) + (setq ,variable (make-hash-table :initial-contents ',options)) + ) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; These definitions should be "private". +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defstruct syntoken + regex ;; A compiled regexp. + property ;; NIL for default, or a synprop structure. + contained ;; Only used when switch/begin is not NIL. Values: + ;; NIL -> just switch to or begin new + ;; syntax table. + ;; (not NIL) -> apply syntoken property + ;; (or default one) to matched + ;; text *after* switching to or + ;; beginning a new syntax table. + switch ;; Values for switch are: + ;; NIL -> do nothing + ;; A keyword -> switch to the syntax table + ;; identified by the keyword. + ;; A negative integer -> Pop the stack + ;; -<swich-value> times. + ;; A common value is -1, + ;; to switch to the previous + ;; state, but some times + ;; it is desired to return + ;; two or more times in + ;; in the stack. + ;; NOTE: This is actually a jump, the stack is + ;; popped until the named syntax table is found, + ;; if the stack becomes empty, a new state is + ;; implicitly created. + begin ;; NIL or a keyword (like switch), but instead of + ;; popping the stack, it pushes the current syntax + ;; table to the stack and sets a new current one. +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Just a wrapper to make-syntoken. +;; TODO: Add support for structure constructors. +;; XXX: Note that the NOSUB only works with the xedit regex, it +;; will still return the match offsets, but will ignore subexpressions, +;; that is, parenthesis are used only for grouping. +;; TODO: Create a new version of the re-exec call that returns +;; offsets in the format (<from> . <to>) and not +;; ((<from0> . <to0>) ... (<fromN> . <toN>)). Only the global result +;; is expected/used, so there is no reason to allocate more than one +;; cons cell per call. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun syntoken (pattern + &key icase nospec property contained switch begin (nosub t) + &aux + (regex + (re-comp pattern :icase icase :nospec nospec :nosub nosub) + ) + check) + + ;; Don't allow a regex that matches the null string enter the + ;; syntax table list. + (if (consp (setq check (re-exec regex "" :noteol t :notbol t))) +#+xedit (error "SYNTOKEN: regex matches empty string ~S" regex) +#-xedit () + ) + + (make-syntoken + :regex regex + :property property + :contained contained + :switch switch + :begin begin + ) +) + + +;; This structure is defined only to do some type checking, it just +;; holds a list of keywords. +(defstruct synaugment + labels ;; List of keywords labeling syntax tables. +) + +(defstruct syntable + label ;; A keyword naming this syntax table. + property ;; NIL or a default synprop structure. + indent ;; Indentation function for the syntax table. + tokens ;; A list of syntoken structures. + tables ;; A list of syntable structures. + augments ;; A list of synaugment structures, used only + ;; at "compile time", so that a table can be + ;; used before it's definition. + bol ;; One of the tokens match the empty string at + ;; the start of a line (loop optimization hint). + ;; Field filled at "link" time. + eol ;; Same comments as bol, but in this case, for + ;; the empty string at the end of a line. +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Just call make-syntable, but sorts the elements by type, allowing +;; a cleaner code when defining the syntax highlight rules. +;; XXX Same comments as for syntoken about the use of a constructor for +;; structures. TODO: when/if clos is implemented in the interpreter. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun syntable (label default-property indent &rest definitions) + + ;; Check for possible errors in the arguments. + (unless (keywordp label) + (error "SYNTABLE: ~A is not a keyword" label) + ) + (unless + (or + (null default-property) + (synprop-p default-property) + ) + (error "SYNTABLE: ~A is an invalid text property" + default-property + ) + ) + + ;; Don't allow unknown data in the definition list. + ;; XXX typecase should be added to the interpreter, and since + ;; the code is traversing the entire list, it could build + ;; now the arguments to make-syntable. + (dolist (item definitions) + (unless + (or + + ;; Allow NIL in the definition list, so that one + ;; can put conditionals in the syntax definition, + ;; and if the conditional is false, fill the slot + ;; with a NIL value. + (atom item) + (syntoken-p item) + (syntable-p item) + (synaugment-p item) + ) + (error "SYNTABLE: invalid syntax table argument ~A" item) + ) + ) + + ;; Build the syntax table. + (make-syntable + :label label + :property default-property + :indent indent + :tokens (remove-if-not #'syntoken-p definitions) + :tables (remove-if-not #'syntable-p definitions) + :augments (remove-if-not #'synaugment-p definitions) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Just to do a "preliminary" error checking, every element must be a +;; a keyword, and also check for reserved names. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun synaugment (&rest keywords) + (dolist (keyword keywords) + (unless (keywordp keyword) + (error "SYNAUGMENT: bad syntax table label ~A" keyword) + ) + ) + (make-synaugment :labels keywords) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Recursive compile utility function. +;; Returns a cons in the format: +;; car => List of all syntoken structures +;; (including child tables). +;; cdr => List of all child syntable structures. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun list-syntable-elements (table &aux result sub-result) + (setq + result + (cons + (syntable-tokens table) + (syntable-tables table)) + ) + + ;; For every child syntax table. + (dolist (child (syntable-tables table)) + + ;; Recursively call list-syntable-elements. + (setq sub-result (list-syntable-elements child)) + + (rplaca result (append (car result) (car sub-result))) + (rplacd result (append (cdr result) (cdr sub-result))) + ) + + ;; Return the pair of nested tokens and tables. + result +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Append tokens of the augment list to the tokens of the specified +;; syntax table. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-syntax-augment-list (table table-list + &aux labels augment tokens) + + ;; Create a list of all augment tables. + (dolist (augment (syntable-augments table)) + (setq labels (append labels (synaugment-labels augment))) + ) + + ;; Remove duplicates and references to "itself", + ;; without warnings? + (setq + labels + (remove + (syntable-label table) + (remove-duplicates labels :from-end t) + ) + ) + + ;; Check if the specified syntax tables exists! + (dolist (label labels) + (unless + (setq + augment + (car (member label table-list :key #'syntable-label)) + ) + (error "COMPILE-SYNTAX-AUGMENT-LIST: Cannot augment ~A in ~A" + label + (syntable-label table) + ) + ) + + ;; Increase list of tokens. + (setq tokens (append tokens (syntable-tokens augment))) + ) + + ;; Store the tokens in the augment list. They will be added + ;; to the syntax table in the second pass. + (setf (syntable-augments table) tokens) + + ;; Recurse on every child table. + (dolist (child (syntable-tables table)) + (compile-syntax-augment-list child table-list) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Just add the augmented tokens to the token list, recursing on +;; every child syntax table. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun link-syntax-augment-table (table) + (setf + (syntable-tokens table) + ;; When augmenting a table, duplicated tokens or different tokens + ;; that use the same regex pattern should be common. + (remove-duplicates + (nconc (syntable-tokens table) (syntable-augments table)) + :key #'syntoken-regex + :test #'equal + :from-end t + ) + + ;; Don't need to keep this list anymore. + (syntable-augments table) + () + ) + + ;; Check if one of the tokens match the empty string at the + ;; start or end of a text line. XXX The fields bol and eol + ;; are expected to be initialized to NIL. + (dolist (token (syntable-tokens table)) + (when (consp (re-exec (syntoken-regex token) "" :noteol t)) + (setf (syntable-bol table) t) + (return) + ) + ) + (dolist (token (syntable-tokens table)) + (when (consp (re-exec (syntoken-regex token) "" :notbol t)) + (setf (syntable-eol table) t) + (return) + ) + ) + + (dolist (child (syntable-tables table)) + (link-syntax-augment-table child) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; "Compile" the main structure of the syntax highlight code. +;; Variables "switches" and "begins" are used only for error checking. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-syntax-table (name options main-table &aux syntax elements + switches begins tables properties) + (unless (stringp name) + (error "COMPILE-SYNTAX-TABLE: ~A is not a string" name) + ) + + (setq + elements + (list-syntable-elements main-table) + + switches + (remove-if + #'null + (car elements) + :key #'syntoken-switch + ) + + begins + (remove-if-not + #'keywordp + (car elements) + :key #'syntoken-begin + ) + + ;; The "main-table" isn't in the list, because + ;; list-syntable-elements includes only the child tables; + ;; this is done to avoid the need of removing duplicates here. + tables + (cons main-table (cdr elements)) + ) + + ;; Check for typos in the keywords, or for not defined syntax tables. + (dolist (item (mapcar #'syntoken-switch switches)) + (unless + (or + (and + (integerp item) + (minusp item) + ) + (member item tables :key #'syntable-label) + ) + (error "COMPILE-SYNTAX-TABLE: SWITCH ~A cannot be matched" + item + ) + ) + ) + (dolist (item (mapcar #'syntoken-begin begins)) + (unless (member item tables :key #'syntable-label) + (error "COMPILE-SYNTAX-TABLE: BEGIN ~A cannot be matched" + item + ) + ) + ) + + ;; Create a list of all properties used by the syntax. + (setq + properties + (delete-duplicates + + ;; Remove explicitly set to "default" properties. + (remove nil + + (append + + ;; List all properties in the syntoken list. + (mapcar + #'syntoken-property + (car elements) + ) + + ;; List all properties in the syntable list. + (mapcar + #'syntable-property + tables + ) + ) + ) + :test #'string= + :key #'synprop-name + ) + ) + + ;; Provide a default property if none specified. + (unless + (member + "default" + properties + :test #'string= + :key #'synprop-name + ) + (setq properties (append (list *prop-default*) properties)) + ) + + + ;; Now that a list of all nested syntax tables is known, compile the + ;; augment list. Note that even the main-table can be augmented to + ;; include tokens of one of it's children. + + ;; Adding the tokens of the augment tables must be done in + ;; two passes, or it may cause surprises due to "inherited" + ;; tokens, as the augment table was processed first, and + ;; increased it's token list. + (compile-syntax-augment-list main-table tables) + + ;; Now just append the augmented tokens to the table's token list. + (link-syntax-augment-table main-table) + + ;; Change all syntoken switch and begin fields to point to the + ;; syntable. + (dolist (item switches) + (if (keywordp (syntoken-switch item)) + ;; A switch may be relative, check if a keyword + ;; was specified. + (setf + (syntoken-switch item) + (car + (member + (syntoken-switch item) + tables + :key #'syntable-label + ) + ) + ) + ) + ) + (dolist (item begins) + (setf + (syntoken-begin item) + (car + (member + (syntoken-begin item) + tables + :key #'syntable-label + ) + ) + ) + ) + + ;; Don't need to add a entity for default properties + (dolist (item (car elements)) + (and + (syntoken-property item) + (string= (synprop-name (syntoken-property item)) "default") + (setf (syntoken-property item) ()) + ) + ) + (dolist (item tables) + (and + (syntable-property item) + (string= (synprop-name (syntable-property item)) "default") + (setf (syntable-property item) ()) + ) + ) + + (setq syntax + (make-syntax + :name name + :options options + :labels tables + :quark + (compile-syntax-property-list + name + properties + ) + :token-count + (length (car elements)) + ) + ) + + ;; Ready to run! +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Loop applying the specifed syntax table to the text. +;; XXX This function needs a review. Should compile the regex patterns +;; with newline sensitive match (and scan the entire file), and keep a +;; cache of matched tokens (that may be at a very longer offset), and, +;; when the match is removed from the cache, readd the token to the +;; token-list; if the token does not match, it will not be in the cache, +;; but should be removed from the token-list. If properly implemented, it +;; should be somewhat like 4 times faster, but I would not be surprised +;; if it becames even faster. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun syntax-highlight (*syntax* + &optional + (*from* (point-min)) + (*to* (point-max)) + interactive + &aux +#+debug (*line-number* 0) + stream + indent-table + ) + + ;; Make sure the property list is in use. + ;; The interactive flag is only set after loading the file. + (or interactive + (property-list (syntax-quark *syntax*)) + ) + +#+debug + (setq *from* 0 *to* 0) + +#-debug + (and (>= *from* *to*) (return-from syntax-highlight (values *from* nil))) + + ;; Remove any existing properties from the text. + (clear-entities *from* (1+ *to*)) + + (setq stream +#-debug (make-string-input-stream (read-text *from* (- *to* *from*))) +#+debug *standard-input* + ) + + (prog* + ( + ;; Used to check if end of file found but syntax stack did + ;; not finish. + (point-max (point-max)) + + ;; Used in interactive mode, to return the syntax table + ;; where the cursor is located. + (point (point)) + + ;; The current stack of states. + stack + + ;; The current syntable. + (syntax-table (car (syntax-labels *syntax*))) + + ;; The current syntable's default property. + (default-property (syntable-property syntax-table)) + + ;; Add this property to newlines as a hint to the interactive + ;; callback, so that it knows from where to restart parsing. + newline-property + + ;; The tokens in the current syntax table that may match, + ;; i.e. the items in this list are not in nomatch. + token-list + + ;; A pointer to the syntable token list, if token-list is + ;; eq to this value, cannot change it inplace. + current-token-list + + ;; Help to avoid allocating too many new object cells, and + ;; optmizes a bit time in [n]?set-difference. + ;; This optimizes only the processing of one line of text + ;; as nomatch must be rebuilt when reading a new line of text. + token-list-stack + + ;; Matches for the current list of tokens. + matches + + ;; Line of text. + line + + ;; Length of the text line. + length + + ;; A inverse cache, don't call re-exec when the regex is + ;; already known to not match. + nomatch + + ;; Use cache as a list of matches to avoid repetitive + ;; unnecessary calls to re-exec. + ;; cache is a list in which every element has the format: + ;; (token . (start . end)) + ;; Line of text. + cache + + ;; Used just to avoid a function call at every re-exec call. + notbol + + match + + start + left + right + result + property + + ;; Beginig a new syntax table? + begin + + ;; Switching to another syntax table? + switch + + ;; Property flag when changing the current syntax table. + contained + + ;; Flag to know if syntax table has changed. + change + + ;; Variables used when removing invalid elements from the + ;; the cache. + item + from + to + ) + +;----------------------------------------------------------------------- +:read +#+debug-verbose + (format t "** Entering :READ stack length is ~D~%" (length stack)) +#+debug (format t "~%[~D]> " (incf *line-number*)) + + ;; If input has finished, return. + (unless (setq line (read-line stream nil nil)) + (when + (and + ;; If a nested syntax table wasn't finished + (consp stack) + (< + (setq *to* (scan *from* :eol :right)) + point-max + ) + ) + (setq line (read-text *from* (- *to* *from*))) + (clear-entities *from* (1+ *to*)) + (go :again) + ) +#-debug (close stream) + (return) + ) + +;------------------------------------------------------------------------ +:again + (setq + start 0 + length (length line) + token-list (syntable-tokens syntax-table) + current-token-list token-list + token-list-stack () + nomatch () + cache () + ) + + + ;; If empty line, and current table does not have matches for + ;; the empty string at start or end of a text line. + (when + (and + (= length 0) + (not (syntable-eol syntax-table)) + (not (syntable-bol syntax-table))) +#+debug-verbose + (format t "Empty line and table has no match to bol or eol~%") + + (and newline-property + (add-entity *from* 1 (synprop-quark newline-property))) + (go :update) + ) + +;------------------------------------------------------------------------ +:loop +#+debug-verbose + (format t "** Entering :LOOP at offset ~D in table ~A, cache has ~D items~%" + start + (syntable-label syntax-table) + (length cache)) + + (setq notbol (> start 0)) + + ;; For every token that may match. + (dolist + (token + (setq + token-list + (if (eq token-list current-token-list) + (set-difference token-list nomatch :test #'eq) + (nset-difference token-list nomatch :test #'eq) + ) + ) + ) + + ;; Try to fetch match from cache. + (if (setq match (member token cache :test #'eq :key #'car)) + ;; Match is in the cache. + + (progn + ;; Match must be moved to the beginning of the + ;; matches list, as a match from another syntax + ;; table may be also in the cache, but before + ;; the match for the current token. +#+debug-verbose (format t "cached: {~A:~S} ~A~%" + (cdar match) + (subseq line (cadar match) (cddar match)) + (syntoken-regex token)) + + ;; Remove the match from the cache. + (if (eq match cache) + + ;; This could be changed to only set "matches" + ;; if it is not the first element of cache, + ;; but is unsafe, because other tokens may + ;; be added to "matches", and will end up + ;; before when joining "matches" and "cache". + (progn + (setq cache (cdr cache)) + (rplacd match matches) + (setq matches match)) + + (progn + (if (= (length match) 1) + (progn + (rplacd (last cache 2) nil) + (rplacd match matches) + (setq matches match)) + (progn + (setq matches (cons (car match) matches)) + (rplaca match (cadr match)) + (rplacd match (cddr match))) + ) + ) + ) + + ;; Exit loop if the all the remaining + ;; input was matched. + (when + (and + (= start (cadar match)) + (= length (cddar match)) + ) +#+debug-verbose (format t "Rest of line match~%") + (return) + ) + ) + + ;; Not in the cache, call re-exec. + (if + (consp + (setq + match + (re-exec + (syntoken-regex token) + line + :start start + :notbol notbol))) + + ;; Match found. + (progn +#+debug-verbose (format t "Adding to cache: {~A:~S} ~A~%" + (car match) + (subseq line (caar match) (cdar match)) + (syntoken-regex token)) + + ;; Only the first pair is used. + (setq match (car match)) + + (cond + ( + (or + (null matches) + ;; No overlap and after most + ;; recent match. + (>= (car match) (cddar matches)) + ;; No overlap and before most + ;; recent match. + (<= (cdr match) (cadar matches)) + ) + (setq + matches + (cons (cons token match) matches) + ) + ) + ( + (or + ;; Overlap, but start before most + ;; recent match. + (< (car match) (cadar matches)) + (and + ;; Same offset as most recent + ;; match, but is longer. + (= (car match) (cadar matches)) + (> (cdr match) (cddar matches)) + ) + ) + (rplaca (car matches) token) + (rplacd (car matches) match) +#+debug-verbose (format t "Replaced most recent match~%") + ) + (t +#+debug-verbose (format t "Ignored~%") + ;; XXX The interpreter does not yet implement + ;; implicit tagbody in dolist, just comment + ;; the go call in that case. (Will just do + ;; an unecessary test...) + (go :ignored) + ) + ) + + ;; Exit loop if the all the remaining + ;; input was matched. + (when + (and + (= start (car match)) + (= length (cdr match))) +#+debug-verbose (format t "Rest of line match~%") + (return)) + ) + + ;; Match not found. + (progn +#+debug-verbose (format t "Adding to nomatch: ~A~%" + (syntoken-regex token)) + (setq nomatch (cons token nomatch))) + ) + ) +:ignored + ) + + ;; Add matches to the beginning of the cache list. + (setq + ;; Put matches with smaller offset first. + cache + (stable-sort (nconc (nreverse matches) cache) #'< :key #'cadr) + + ;; Make sure that when the match loop is reentered, this + ;; variable is NIL. + matches + () + ) + + ;; While the first entry in the cache is not from the current table. + (until (or (null cache) (member (caar cache) token-list :test #'eq)) + +#+debug-verbose + (format t "Not in the current table, removing {~A:~S} ~A~%" + (cdar cache) + (subseq line (cadar cache) (cddar cache)) + (syntoken-regex (caar cache))) + + (setq cache (cdr cache)) + ) + + + ;; If nothing was matched in the entire/remaining line. + (unless cache + (when default-property + (if + (or + (null result) + (> start (cadar result)) + (not (eq (cddar result) default-property))) + (setq + result + (cons + (cons start (cons length default-property)) + result + ) + ) + (rplaca (cdar result) length) + ) + ) + +#+debug-verbose + (format t "No match until end of line~%") + + ;; Result already known, and there is no syntax table + ;; change, bypass :PARSE. + (and interactive + (null indent-table) + (<= 0 (- point *from*) length) + (setq indent-table syntax-table)) + (go :process) + ) + +#+debug-verbose + (format t "Removing first candidate from cache {~A:~S} ~A~%" + (cdar cache) + (subseq line (cadar cache) (cddar cache)) + (syntoken-regex (caar cache)) + ) + + ;; Prepare to choose best match. + (setq + match (car cache) + left (cadr match) + right (cddr match) + cache (cdr cache) + ) + + ;; First element can be safely removed now. + ;; If there is only one, skip loop below. + (or cache (go :parse)) + + ;; Remove elements of cache that must be discarded. + (setq + item (car cache) + from (cadr item) + to (cddr item) + ) + + (loop + (if + (or + + ;; If everything removed from the cache. + (null item) + + ;; Or next item is at a longer offset than the + ;; end of current match. + (>= from right) + ) + (return) + ) + + (and + ;; If another match at the same offset. + (= left from) + + ;; And if this match is longer than the current one. + (> to right) + + (member (car item) token-list :test #'eq) + + (setq + match item + right to + ) + ) + +#+debug-verbose + (format t "Removing from cache {~A:~S} ~A~%" + (cdar cache) + (subseq line from to) + (syntoken-regex (caar cache))) + + (setq + cache (cdr cache) + item (car cache) + from (cadr item) + to (cddr item) + ) + ) + + +;----------------------------------------------------------------------- +:parse +#+debug-verbose + (format t "** Entering :PARSE~%") + + (setq + + ;; Change match value to the syntoken. + match (car match) + + begin (syntoken-begin match) + switch (syntoken-switch match) + contained (syntoken-contained match) + change (or begin switch) + ) + + ;; Check for unmatched leading text. + (when (and default-property (> left start)) +#+debug-verbose (format t "No match in {(~D . ~D):~S}~%" + start + left + (subseq line start left) + ) + (if + (or + (null result) + (> start (cadar result)) + (not (eq (cddar result) default-property))) + (setq + result + (cons + (cons start (cons left default-property)) + result + ) + ) + (rplaca (cdar result) left) + ) + ) + + ;; If the syntax table is not changed, + ;; or if the new table requires that the + ;; current default property be used. + (unless (and change contained) + + (and + (> right left) + (setq + property + (or + ;; If token specifies the property. + (syntoken-property match) + default-property + ) + ) + + ;; Add matched text. + (if + (or + (null result) + (> left (cadar result)) + (not (eq (cddar result) property)) + ) + (setq + result + (cons + (cons left (cons right property)) + result + ) + ) + (rplaca (cdar result) right) + ) + ) + +#+debug-verbose + (format t "(0)Match found for {(~D . ~D):~S}~%" + left + right + (subseq line left right) + ) + ) + + + ;; Update start offset in the input now! + (and interactive + (null indent-table) + (<= start (- point *from*) right) + (setq indent-table syntax-table)) + (setq start right) + + + ;; When changing the current syntax table. + (when change + (when switch + (if (numberp switch) + + ;; If returning to a previous state. + ;; Don't generate an error if the stack + ;; becomes empty? + (while + (< switch 0) + + (setq + syntax-table (pop stack) + token-list (pop token-list-stack) + switch (1+ switch) + ) + ) + + ;; Else, not to a previous state, but + ;; returning to a named syntax table, + ;; search for it in the stack. + (while + (and + + (setq + token-list (pop token-list-stack) + syntax-table (pop stack) + ) + + (not (eq switch syntax-table)) + ) + ;; Empty loop. + ) + ) + + ;; If no match found while popping + ;; the stack. + (unless syntax-table + + ;; Return to the topmost syntax table. + (setq + syntax-table + (car (syntax-labels *syntax*)) + ) + ) + +#+debug-verbose (format t "switching to ~A offset: ~D~%" + (syntable-label syntax-table) + start + ) + + (if (null token-list) + (setq token-list (syntable-tokens syntax-table)) + ) + ) + + (when begin + ;; Save state for a possible + ;; :SWITCH later. + (setq + stack (cons syntax-table stack) + token-list-stack (cons token-list token-list-stack) + token-list (syntable-tokens begin) + syntax-table begin + ) +#+debug-verbose (format t "begining ~A offset: ~D~%" + (syntable-label syntax-table) + start + ) + ) + + ;; Change current syntax table. + (setq + default-property (syntable-property syntax-table) + current-token-list (syntable-tokens syntax-table) + ) + + ;; Set newline property, to help interactive callback + ;; Only need to have a defined value, for now don't care + ;; about wich value is being used, neither if there is + ;; a value to be set. + (if (null stack) + (setq newline-property nil) + (or newline-property + (setq newline-property default-property) + (setq newline-property (syntoken-property match)) + ) + ) + + ;; If processing of text was deferred. + (when contained + + (and + (> right left) + (setq + property + (or + (syntoken-property match) + default-property + ) + ) + ;; Add matched text with the updated property. + (if + (or + (null result) + (> left (cadar result)) + (not (eq (cddar result) property)) + ) + (setq + result + (cons + (cons left (cons right property)) + result + ) + ) + (rplaca (cdar result) right) + ) + ) + +#+debug-verbose (format t "(1)Match found for {(~D . ~D):~S}~%" + left + right + (subseq line left right) + ) + ) + + (go :loop) + ) + + +;----------------------------------------------------------------------- + ;; Wait for the end of the line to process, so that + ;; it is possible to join sequential matches with the + ;; same text property. + (and (or cache (< start length)) (go :loop)) +:process + +#+debug-verbose + (format t "** Entering :PROCESS~%") + + (if result + (progn + ;; If the last property was at the end of the line, + ;; there are nested syntax tables, and there is a + ;; default property, include the newline in the property, + ;; as a hint to the interactive callback. + (and + newline-property + (if + (and + (eq (cddar result) newline-property) + (= length (cadar result)) + ) + (rplaca (cdar result) (1+ length)) + (setq + result + (cons + (cons length (cons (1+ length) newline-property)) + result + ) + ) + ) + ) + + ;; Result was created in reversed order. + (nreverse result) + (dolist (item result) + (setq + left (car item) + right (cadr item) + property (cddr item)) + + ;; Use the information. + (add-entity + (+ *from* left) + (- right left) + (synprop-quark property)) + ) + ) + + (and newline-property + (add-entity + (+ *from* length) + 1 + (synprop-quark newline-property)) + ) + ) + +;------------------------------------------------------------------------ +:update + ;; Prepare for new matches. + (setq + result nil + + ;; Update offset to read text. + ;; Add 1 for the skipped newline. + *from* (+ *from* length 1) + ) + + (go :read) + ) + +#+debug (terpri) + (values *to* indent-table) +) + +(compile 'syntax-highlight) Index: xc/programs/xedit/lisp/modules/x11.c diff -u xc/programs/xedit/lisp/modules/x11.c:1.4 xc/programs/xedit/lisp/modules/x11.c:1.10 --- xc/programs/xedit/lisp/modules/x11.c:1.4 Mon Oct 15 03:05:53 2001 +++ xc/programs/xedit/lisp/modules/x11.c Sat Nov 23 03:26:52 2002 @@ -27,48 +27,65 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/x11.c,v 1.4 2001/10/15 07:05:53 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/x11.c,v 1.10 2002/11/23 08:26:52 paulo Exp $ */ #include <stdlib.h> #include <string.h> #include "internal.h" +#include "private.h" #include <X11/Xlib.h> /* * Prototypes */ -int x11LoadModule(LispMac*); +int x11LoadModule(void); -LispObj *Lisp_XOpenDisplay(LispMac*, LispObj*, char*); -LispObj *Lisp_XCloseDisplay(LispMac*, LispObj*, char*); -LispObj *Lisp_XDefaultRootWindow(LispMac*, LispObj*, char*); -LispObj *Lisp_XDefaultScreenOfDisplay(LispMac*, LispObj*, char*); -LispObj *Lisp_XBlackPixelOfScreen(LispMac*, LispObj*, char*); -LispObj *Lisp_XWhitePixelOfScreen(LispMac*, LispObj*, char*); -LispObj *Lisp_XDefaultGCOfScreen(LispMac*, LispObj*, char*); -LispObj *Lisp_XCreateSimpleWindow(LispMac*, LispObj*, char*); -LispObj *Lisp_XMapWindow(LispMac*, LispObj*, char*); -LispObj *Lisp_XDestroyWindow(LispMac*, LispObj*, char*); -LispObj *Lisp_XFlush(LispMac*, LispObj*, char*); +LispObj *Lisp_XOpenDisplay(LispBuiltin *builtin); +LispObj *Lisp_XCloseDisplay(LispBuiltin *builtin); +LispObj *Lisp_XDefaultRootWindow(LispBuiltin *builtin); +LispObj *Lisp_XDefaultScreen(LispBuiltin *builtin); +LispObj *Lisp_XDefaultScreenOfDisplay(LispBuiltin *builtin); +LispObj *Lisp_XBlackPixel(LispBuiltin *builtin); +LispObj *Lisp_XBlackPixelOfScreen(LispBuiltin *builtin); +LispObj *Lisp_XWidthOfScreen(LispBuiltin *builtin); +LispObj *Lisp_XHeightOfScreen(LispBuiltin *builtin); +LispObj *Lisp_XWhitePixel(LispBuiltin *builtin); +LispObj *Lisp_XWhitePixelOfScreen(LispBuiltin *builtin); +LispObj *Lisp_XDefaultGC(LispBuiltin *builtin); +LispObj *Lisp_XDefaultGCOfScreen(LispBuiltin *builtin); +LispObj *Lisp_XCreateSimpleWindow(LispBuiltin *builtin); +LispObj *Lisp_XMapWindow(LispBuiltin *builtin); +LispObj *Lisp_XDestroyWindow(LispBuiltin *builtin); +LispObj *Lisp_XFlush(LispBuiltin *builtin); +LispObj *Lisp_XRaiseWindow(LispBuiltin *builtin); +LispObj *Lisp_XBell(LispBuiltin *builtin); -LispObj *Lisp_XDrawLine(LispMac*, LispObj*, char*); +LispObj *Lisp_XDrawLine(LispBuiltin *builtin); /* * Initialization */ static LispBuiltin lispbuiltins[] = { - {"X-OPEN-DISPLAY", Lisp_XOpenDisplay, 1,0,1,}, - {"X-CLOSE-DISPLAY", Lisp_XCloseDisplay, 1,1,1,}, - {"X-DEFAULT-ROOT-WINDOW", Lisp_XDefaultRootWindow, 1,1,1,}, - {"X-DEFAULT-SCREEN-OF-DISPLAY", Lisp_XDefaultScreenOfDisplay, 1,1,1,}, - {"X-BLACK-PIXEL-OF-SCREEN", Lisp_XBlackPixelOfScreen, 1,1,1,}, - {"X-WHITE-PIXEL-OF-SCREEN", Lisp_XWhitePixelOfScreen, 1,1,1,}, - {"X-DEFAULT-GC-OF-SCREEN", Lisp_XDefaultGCOfScreen, 1,1,1,}, - {"X-CREATE-SIMPLE-WINDOW", Lisp_XCreateSimpleWindow, 1,9,9,}, - {"X-MAP-WINDOW", Lisp_XMapWindow, 1,2,2,}, - {"X-DESTROY-WINDOW", Lisp_XDestroyWindow, 1,2,2,}, - {"X-FLUSH", Lisp_XFlush, 1,1,1,}, - {"X-DRAW-LINE", Lisp_XDrawLine, 1,7,7,}, + {LispFunction, Lisp_XOpenDisplay, "x-open-display &optional display-name"}, + {LispFunction, Lisp_XCloseDisplay, "x-close-display display"}, + {LispFunction, Lisp_XDefaultRootWindow, "x-default-root-window display"}, + {LispFunction, Lisp_XDefaultScreen, "x-default-screen display"}, + {LispFunction, Lisp_XDefaultScreenOfDisplay, "x-default-screen-of-display display"}, + {LispFunction, Lisp_XBlackPixel, "x-black-pixel display &optional screen"}, + {LispFunction, Lisp_XBlackPixelOfScreen, "x-black-pixel-of-screen screen"}, + {LispFunction, Lisp_XWhitePixel, "x-white-pixel display &optional screen"}, + {LispFunction, Lisp_XWhitePixelOfScreen, "x-white-pixel-of-screen screen"}, + {LispFunction, Lisp_XDefaultGC, "x-default-gc display &optional screen"}, + {LispFunction, Lisp_XDefaultGCOfScreen, "x-default-gc-of-screen screen"}, + {LispFunction, Lisp_XCreateSimpleWindow, "x-create-simple-window display parent x y width height &optional border-width border background"}, + {LispFunction, Lisp_XMapWindow, "x-map-window display window"}, + {LispFunction, Lisp_XDestroyWindow, "X-DESTROY-WINDOW"}, + {LispFunction, Lisp_XFlush, "x-flush display"}, + {LispFunction, Lisp_XDrawLine, "x-draw-line display drawable gc x1 y1 x2 y2"}, + {LispFunction, Lisp_XBell, "x-bell display &optional percent"}, + {LispFunction, Lisp_XRaiseWindow, "x-raise-window display window"}, + {LispFunction, Lisp_XWidthOfScreen, "x-width-of-screen screen"}, + {LispFunction, Lisp_XHeightOfScreen, "x-height-of-screen screen"}, }; LispModuleData x11LispModuleData = { @@ -82,179 +99,334 @@ * Implementation */ int -x11LoadModule(LispMac *mac) +x11LoadModule(void) { int i; - x11Display_t = LispRegisterOpaqueType(mac, "Display*"); - x11Screen_t = LispRegisterOpaqueType(mac, "Screen*"); - x11Window_t = LispRegisterOpaqueType(mac, "Window"); - x11GC_t = LispRegisterOpaqueType(mac, "GC"); + x11Display_t = LispRegisterOpaqueType("Display*"); + x11Screen_t = LispRegisterOpaqueType("Screen*"); + x11Window_t = LispRegisterOpaqueType("Window"); + x11GC_t = LispRegisterOpaqueType("GC"); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) - LispAddBuiltinFunction(mac, &lispbuiltins[i]); + LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } LispObj * -Lisp_XOpenDisplay(LispMac *mac, LispObj *list, char *fname) +Lisp_XOpenDisplay(LispBuiltin *builtin) +/* +x-open-display &optional display-name + */ { - LispObj *nam; + LispObj *display_name; char *dname; + + display_name = ARGUMENT(0); - if (list == NIL) + if (display_name == UNSPEC) dname = NULL; - else if ((nam = CAR(list))->type == LispString_t) - dname = STRPTR(nam); - else - LispDestroy(mac, "%s is not a valid display name, at %s", - LispStrObj(mac, nam), fname); + else { + CHECK_STRING(display_name); + dname = THESTR(display_name); + } return (OPAQUE(XOpenDisplay(dname), x11Display_t)); } LispObj * -Lisp_XCloseDisplay(LispMac *mac, LispObj *list, char *fname) +Lisp_XCloseDisplay(LispBuiltin *builtin) +/* + x-close-display display + */ { - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *display; - XCloseDisplay((Display*)(CAR(list)->data.opaque.data)); + display = ARGUMENT(0); + if (!CHECKO(display, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(display)); + + XCloseDisplay((Display*)(display->data.opaque.data)); + return (NIL); } LispObj * -Lisp_XDefaultRootWindow(LispMac *mac, LispObj *list, char *fname) +Lisp_XDefaultRootWindow(LispBuiltin *builtin) +/* + x-default-root-window display + */ { - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *display; + + display = ARGUMENT(0); - return (OPAQUE(XDefaultRootWindow((Display*)(CAR(list)->data.opaque.data)), + if (!CHECKO(display, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(display)); + + return (OPAQUE(DefaultRootWindow((Display*)(display->data.opaque.data)), x11Window_t)); } +LispObj * +Lisp_XDefaultScreen(LispBuiltin *builtin) +/* + x-default-screen display + */ +{ + LispObj *display; + + display = ARGUMENT(0); + + if (!CHECKO(display, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(display)); + + return (INTEGER(DefaultScreen((Display*)(display->data.opaque.data)))); +} + LispObj * -Lisp_XDefaultScreenOfDisplay(LispMac *mac, LispObj *list, char *fname) +Lisp_XDefaultScreenOfDisplay(LispBuiltin *builtin) +/* + x-default-screen-of-display display + */ { - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *display; + + display = ARGUMENT(0); - return (OPAQUE(XDefaultScreenOfDisplay((Display*)(CAR(list)->data.opaque.data)), + if (!CHECKO(display, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(display)); + + return (OPAQUE(DefaultScreenOfDisplay((Display*)(display->data.opaque.data)), x11Screen_t)); } LispObj * -Lisp_XBlackPixelOfScreen(LispMac *mac, LispObj *list, char *fname) +Lisp_XBlackPixel(LispBuiltin *builtin) +/* + x-black-pixel display &optional screen + */ { - if (!CHECKO(CAR(list), x11Screen_t)) - LispDestroy(mac, "cannot convert %s to Screen*, at %s", - LispStrObj(mac, CAR(list)), fname); + Display *display; + int screen; + + LispObj *odisplay, *oscreen; + + oscreen = ARGUMENT(1); + odisplay = ARGUMENT(0); - return (REAL((double) - XBlackPixelOfScreen((Screen*)(CAR(list)->data.opaque.data)))); + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (oscreen == UNSPEC) + screen = DefaultScreen(display); + else + CHECK_INDEX(oscreen); + else + screen = FIXNUM_VALUE(oscreen); + + if (screen >= ScreenCount(display)) + LispDestroy("%s: screen index %d too large, %d screens available", + STRFUN(builtin), screen, ScreenCount(display)); + + return (INTEGER(BlackPixel(display, screen))); } LispObj * -Lisp_XWhitePixelOfScreen(LispMac *mac, LispObj *list, char *fname) +Lisp_XBlackPixelOfScreen(LispBuiltin *builtin) +/* + x-black-pixel-of-screen screen + */ { - if (!CHECKO(CAR(list), x11Screen_t)) - LispDestroy(mac, "cannot convert %s to Screen*, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *screen; - return (REAL((double) - XWhitePixelOfScreen((Screen*)(CAR(list)->data.opaque.data)))); + screen = ARGUMENT(0); + + if (!CHECKO(screen, x11Screen_t)) + LispDestroy("%s: cannot convert %s to Screen*", + STRFUN(builtin), STROBJ(screen)); + + return (INTEGER(XBlackPixelOfScreen((Screen*)(screen->data.opaque.data)))); } LispObj * -Lisp_XDefaultGCOfScreen(LispMac *mac, LispObj *list, char *fname) +Lisp_XWhitePixel(LispBuiltin *builtin) +/* + x-white-pixel display &optional screen + */ { - if (!CHECKO(CAR(list), x11Screen_t)) - LispDestroy(mac, "cannot convert %s to Screen*, at %s", - LispStrObj(mac, CAR(list)), fname); + Display *display; + int screen; - return (OPAQUE(XDefaultGCOfScreen((Screen*)(CAR(list)->data.opaque.data)), + LispObj *odisplay, *oscreen; + + oscreen = ARGUMENT(1); + odisplay = ARGUMENT(0); + + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (oscreen == UNSPEC) + screen = DefaultScreen(display); + else + CHECK_FIXNUM(oscreen); + else + screen = FIXNUM_VALUE(oscreen); + + if (screen >= ScreenCount(display)) + LispDestroy("%s: screen index %d too large, %d screens available", + STRFUN(builtin), screen, ScreenCount(display)); + + return (INTEGER(WhitePixel(display, screen))); +} + +LispObj * +Lisp_XWhitePixelOfScreen(LispBuiltin *builtin) +/* + x-white-pixel-of-screen screen + */ +{ + LispObj *screen; + + screen = ARGUMENT(0); + + if (!CHECKO(screen, x11Screen_t)) + LispDestroy("%s: cannot convert %s to Screen*", + STRFUN(builtin), STROBJ(screen)); + + return (INTEGER(WhitePixelOfScreen((Screen*)(screen->data.opaque.data)))); +} + +LispObj * +Lisp_XDefaultGC(LispBuiltin *builtin) +/* + x-default-gc display &optional screen + */ +{ + Display *display; + int screen; + + LispObj *odisplay, *oscreen; + + oscreen = ARGUMENT(1); + odisplay = ARGUMENT(0); + + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (oscreen == UNSPEC) + screen = DefaultScreen(display); + else + CHECK_FIXNUM(oscreen); + else + screen = FIXNUM_VALUE(oscreen); + + if (screen >= ScreenCount(display)) + LispDestroy("%s: screen index %d too large, %d screens available", + STRFUN(builtin), screen, ScreenCount(display)); + + return (OPAQUE(DefaultGC(display, screen), x11GC_t)); +} + +LispObj * +Lisp_XDefaultGCOfScreen(LispBuiltin *builtin) +/* + x-default-gc-of-screen screen + */ +{ + LispObj *screen; + + screen = ARGUMENT(0); + + if (!CHECKO(screen, x11Screen_t)) + LispDestroy("%s: cannot convert %s to Screen*", + STRFUN(builtin), STROBJ(screen)); + + return (OPAQUE(DefaultGCOfScreen((Screen*)(screen->data.opaque.data)), x11GC_t)); } LispObj * -Lisp_XCreateSimpleWindow(LispMac *mac, LispObj *list, char *fname) +Lisp_XCreateSimpleWindow(LispBuiltin *builtin) +/* + x-create-simple-window display parent x y width height &optional border-width border background + */ { Display *display; Window parent; int x, y; unsigned int width, height, border_width; unsigned long border, background; + + LispObj *odisplay, *oparent, *ox, *oy, *owidth, *oheight, + *oborder_width, *oborder, *obackground; - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); - display = (Display*)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (!CHECKO(CAR(list), x11Window_t)) - LispDestroy(mac, "cannot convert %s to Window, at %s", - LispStrObj(mac, CAR(list)), fname); - parent = (Window)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to int, at %s", - LispStrObj(mac, CAR(list)), fname); - x = (int)(CAR(list)->data.real); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to int, at %s", - LispStrObj(mac, CAR(list)), fname); - y = (int)(CAR(list)->data.real); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - CAR(list)->data.real < 0 || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to unsigned int, at %s", - LispStrObj(mac, CAR(list)), fname); - width = (unsigned int)(CAR(list)->data.real); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - CAR(list)->data.real < 0 || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to unsigned int, at %s", - LispStrObj(mac, CAR(list)), fname); - height = (unsigned int)(CAR(list)->data.real); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - CAR(list)->data.real < 0 || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to unsigned int, at %s", - LispStrObj(mac, CAR(list)), fname); - border_width = (unsigned int)(CAR(list)->data.real); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - CAR(list)->data.real < 0 || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to unsigned long, at %s", - LispStrObj(mac, CAR(list)), fname); - border = (unsigned int)(CAR(list)->data.real); - list = CDR(list); - - if (CAR(list)->type != LispReal_t || - CAR(list)->data.real < 0 || - (int)(CAR(list)->data.real) != CAR(list)->data.real) - LispDestroy(mac, "Cannot convert %s to unsigned long, at %s", - LispStrObj(mac, CAR(list)), fname); - background = (unsigned int)(CAR(list)->data.real); + obackground = ARGUMENT(8); + oborder = ARGUMENT(7); + oborder_width = ARGUMENT(6); + oheight = ARGUMENT(5); + owidth = ARGUMENT(4); + oy = ARGUMENT(3); + ox = ARGUMENT(2); + oparent = ARGUMENT(1); + odisplay = ARGUMENT(0); + + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (!CHECKO(oparent, x11Window_t)) + LispDestroy("%s: cannot convert %s to Window", + STRFUN(builtin), STROBJ(oparent)); + parent = (Window)(oparent->data.opaque.data); + + CHECK_FIXNUM(ox); + x = FIXNUM_VALUE(ox); + + CHECK_FIXNUM(oy); + y = FIXNUM_VALUE(oy); + + CHECK_INDEX(owidth); + width = FIXNUM_VALUE(owidth); + + CHECK_INDEX(oheight); + height = FIXNUM_VALUE(oheight); + + /* check &OPTIONAL parameters */ + if (oborder_width == UNSPEC) + border_width = 1; + else + CHECK_INDEX(oborder_width); + else + border_width = FIXNUM_VALUE(oborder_width); + if (oborder == UNSPEC) + border = BlackPixel(display, DefaultScreen(display)); + else + CHECK_LONGINT(oborder); + else + border = LONGINT_VALUE(oborder); + + if (obackground == UNSPEC) + background = WhitePixel(display, DefaultScreen(display)); + else + CHECK_LONGINT(obackground); + else + background = LONGINT_VALUE(obackground); + return (OPAQUE( XCreateSimpleWindow(display, parent, x, y, width, height, border_width, border, background), @@ -262,112 +434,233 @@ } LispObj * -Lisp_XMapWindow(LispMac *mac, LispObj *list, char *fname) +Lisp_XMapWindow(LispBuiltin *builtin) +/* + x-map-window display window + */ { Display *display; Window window; + + LispObj *odisplay, *owindow; + + owindow = ARGUMENT(1); + odisplay = ARGUMENT(0); - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); - display = (Display*)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (!CHECKO(CAR(list), x11Window_t)) - LispDestroy(mac, "cannot convert %s to Window, at %s", - LispStrObj(mac, CAR(list)), fname); - window = (Window)(CAR(list)->data.opaque.data); + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (!CHECKO(owindow, x11Window_t)) + LispDestroy("%s: cannot convert %s to Window", + STRFUN(builtin), STROBJ(owindow)); + window = (Window)(owindow->data.opaque.data); XMapWindow(display, window); - return (CAR(list)); + return (owindow); } LispObj * -Lisp_XDestroyWindow(LispMac *mac, LispObj *list, char *fname) +Lisp_XDestroyWindow(LispBuiltin *builtin) +/* + x-destroy-window display window + */ { Display *display; Window window; - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); - display = (Display*)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (!CHECKO(CAR(list), x11Window_t)) - LispDestroy(mac, "cannot convert %s to Window, at %s", - LispStrObj(mac, CAR(list)), fname); - window = (Window)(CAR(list)->data.opaque.data); + LispObj *odisplay, *owindow; + owindow = ARGUMENT(1); + odisplay = ARGUMENT(0); + + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (!CHECKO(owindow, x11Window_t)) + LispDestroy("%s: cannot convert %s to Window", + STRFUN(builtin), STROBJ(owindow)); + window = (Window)(owindow->data.opaque.data); + XDestroyWindow(display, window); return (NIL); } LispObj * -Lisp_XFlush(LispMac *mac, LispObj *list, char *fname) +Lisp_XFlush(LispBuiltin *builtin) +/* + x-flush display + */ { Display *display; + + LispObj *odisplay; - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); - display = (Display*)(CAR(list)->data.opaque.data); + odisplay = ARGUMENT(0); + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + XFlush(display); - return (NIL); + return (odisplay); } LispObj * -Lisp_XDrawLine(LispMac *mac, LispObj *list, char *fname) +Lisp_XDrawLine(LispBuiltin *builtin) +/* + x-draw-line display drawable gc x1 y1 x2 y2 + */ { Display *display; - Drawable window; + Drawable drawable; GC gc; - int x0, y0, x1, y1; + int x1, y1, x2, y2; - if (!CHECKO(CAR(list), x11Display_t)) - LispDestroy(mac, "cannot convert %s to Display*, at %s", - LispStrObj(mac, CAR(list)), fname); - display = (Display*)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (!CHECKO(CAR(list), x11Window_t)) - LispDestroy(mac, "cannot convert %s to Drawable, at %s", - LispStrObj(mac, CAR(list)), fname); - window = (Drawable)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (!CHECKO(CAR(list), x11GC_t)) - LispDestroy(mac, "cannot convert %s to GC, at %s", - LispStrObj(mac, CAR(list)), fname); - gc = (GC)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (CAR(list)->type != LispReal_t) - LispDestroy(mac, "Cannot convert %s to int, at %s", - LispStrObj(mac, CAR(list)), fname); - x0 = (int)(CAR(list)->data.real); - list = CDR(list); - if (CAR(list)->type != LispReal_t) - LispDestroy(mac, "Cannot convert %s to int, at %s", - LispStrObj(mac, CAR(list)), fname); - y0 = (int)(CAR(list)->data.real); - list = CDR(list); - if (CAR(list)->type != LispReal_t) - LispDestroy(mac, "Cannot convert %s to int, at %s", - LispStrObj(mac, CAR(list)), fname); - x1 = (int)(CAR(list)->data.real); - list = CDR(list); - if (CAR(list)->type != LispReal_t) - LispDestroy(mac, "Cannot convert %s to int, at %s", - LispStrObj(mac, CAR(list)), fname); - y1 = (int)(CAR(list)->data.real); - list = CDR(list); + LispObj *odisplay, *odrawable, *ogc, *ox1, *oy1, *ox2, *oy2; - XDrawLine(display, window, gc, x0, y0, x1, y1); + oy2 = ARGUMENT(6); + ox2 = ARGUMENT(5); + oy1 = ARGUMENT(4); + ox1 = ARGUMENT(3); + ogc = ARGUMENT(2); + odrawable = ARGUMENT(1); + odisplay = ARGUMENT(0); - return (NIL); + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + /* XXX correct check when drawing to pixmaps implemented */ + if (!CHECKO(odrawable, x11Window_t)) + LispDestroy("%s: cannot convert %s to Drawable", + STRFUN(builtin), STROBJ(odrawable)); + drawable = (Drawable)(odrawable->data.opaque.data); + + if (!CHECKO(ogc, x11GC_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(ogc)); + gc = (GC)(ogc->data.opaque.data); + + CHECK_FIXNUM(ox1); + x1 = FIXNUM_VALUE(ox1); + + CHECK_FIXNUM(oy1); + y1 = FIXNUM_VALUE(oy1); + + CHECK_FIXNUM(ox2); + x2 = FIXNUM_VALUE(ox2); + + CHECK_FIXNUM(oy2); + y2 = FIXNUM_VALUE(oy2); + + XDrawLine(display, drawable, gc, x1, y1, x2, y2); + + return (odrawable); +} + +LispObj * +Lisp_XBell(LispBuiltin *builtin) +/* + x-bell &optional percent + */ +{ + Display *display; + int percent; + + LispObj *odisplay, *opercent; + + opercent = ARGUMENT(1); + odisplay = ARGUMENT(0); + + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (opercent == UNSPEC) + percent = 0; + else + CHECK_FIXNUM(opercent); + else + percent = FIXNUM_VALUE(opercent); + + if (percent < -100 || percent > 100) + LispDestroy("%s: percent value %d out of range -100 to 100", + STRFUN(builtin), percent); + + XBell(display, percent); + + return (odisplay); +} + +LispObj * +Lisp_XRaiseWindow(LispBuiltin *builtin) +/* + x-raise-window display window + */ +{ + Display *display; + Window window; + + LispObj *odisplay, *owindow; + + owindow = ARGUMENT(1); + odisplay = ARGUMENT(0); + + if (!CHECKO(odisplay, x11Display_t)) + LispDestroy("%s: cannot convert %s to Display*", + STRFUN(builtin), STROBJ(odisplay)); + display = (Display*)(odisplay->data.opaque.data); + + if (!CHECKO(owindow, x11Window_t)) + LispDestroy("%s: cannot convert %s to Window", + STRFUN(builtin), STROBJ(owindow)); + window = (Window)(owindow->data.opaque.data); + + XRaiseWindow(display, window); + + return (owindow); +} + +LispObj * +Lisp_XWidthOfScreen(LispBuiltin *builtin) +/* + x-width-of-screen screen + */ +{ + LispObj *screen; + + screen = ARGUMENT(0); + + if (!CHECKO(screen, x11Screen_t)) + LispDestroy("%s: cannot convert %s to Screen*", + STRFUN(builtin), STROBJ(screen)); + + return (FIXNUM(WidthOfScreen((Screen*)(screen->data.opaque.data)))); +} + +LispObj * +Lisp_XHeightOfScreen(LispBuiltin *builtin) +/* + x-height-of-screen screen + */ +{ + LispObj *screen; + + screen = ARGUMENT(0); + + if (!CHECKO(screen, x11Screen_t)) + LispDestroy("%s: cannot convert %s to Screen*", + STRFUN(builtin), STROBJ(screen)); + + return (FIXNUM(HeightOfScreen((Screen*)(screen->data.opaque.data)))); } Index: xc/programs/xedit/lisp/modules/xaw.c diff -u xc/programs/xedit/lisp/modules/xaw.c:1.7 xc/programs/xedit/lisp/modules/xaw.c:1.14 --- xc/programs/xedit/lisp/modules/xaw.c:1.7 Wed Oct 17 23:15:25 2001 +++ xc/programs/xedit/lisp/modules/xaw.c Sat Nov 23 03:26:52 2002 @@ -27,10 +27,11 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/xaw.c,v 1.7 2001/10/18 03:15:25 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/xaw.c,v 1.14 2002/11/23 08:26:52 paulo Exp $ */ #include <stdlib.h> #include <X11/Intrinsic.h> +#include <X11/StringDefs.h> #include <X11/Xaw/AsciiSink.h> #include <X11/Xaw/AsciiSrc.h> #include <X11/Xaw/AsciiText.h> @@ -64,34 +65,57 @@ #include <X11/Xaw/Viewport.h> #include <X11/Vendor.h> #include "internal.h" +#include "private.h" /* + * Types + */ +typedef struct { + LispObj *object; + void *data; +} WidgetData; + +/* * Prototypes */ -int xawLoadModule(LispMac*); +int xawLoadModule(void); +void LispXawCleanupCallback(Widget, XtPointer, XtPointer); -LispObj *Lisp_XawCoerceToListReturnStruct(LispMac*, LispObj*, char*); -LispObj *Lisp_XawFormDoLayout(LispMac*, LispObj*, char*); -LispObj *Lisp_XawListHighlight(LispMac*, LispObj*, char*); -LispObj *Lisp_XawListUnhighlight(LispMac*, LispObj*, char*); -LispObj *Lisp_XawTextGetSource(LispMac*, LispObj*, char*); -LispObj *Lisp_XawTextLastPosition(LispMac*, LispObj*, char*); -LispObj *Lisp_XawTextGetInsertionPoint(LispMac*, LispObj*, char*); -LispObj *Lisp_XawTextSetInsertionPoint(LispMac*, LispObj*, char*); +/* until a better/smarter interface be written... */ +LispObj *Lisp_XawCoerceToListReturnStruct(LispBuiltin*); +LispObj *Lisp_XawScrollbarCoerceToReal(LispBuiltin*); + +LispObj *Lisp_XawFormDoLayout(LispBuiltin*); +LispObj *Lisp_XawListChange(LispBuiltin*); +LispObj *Lisp_XawListHighlight(LispBuiltin*); +LispObj *Lisp_XawListUnhighlight(LispBuiltin*); +LispObj *Lisp_XawTextGetSource(LispBuiltin*); +LispObj *Lisp_XawTextLastPosition(LispBuiltin*); +LispObj *Lisp_XawTextReplace(LispBuiltin*); +LispObj *Lisp_XawTextSearch(LispBuiltin*); +LispObj *Lisp_XawTextGetInsertionPoint(LispBuiltin*); +LispObj *Lisp_XawTextSetInsertionPoint(LispBuiltin*); +LispObj *Lisp_XawScrollbarSetThumb(LispBuiltin*); /* * Initialization */ static LispBuiltin lispbuiltins[] = { - {"XAW-COERCE-TO-LIST-RETURN-STRUCT",Lisp_XawCoerceToListReturnStruct,1,1,1,}, - {"XAW-FORM-DO-LAYOUT", Lisp_XawFormDoLayout, 1,2,2,}, - {"XAW-LIST-HIGHLIGHT", Lisp_XawListHighlight, 1,2,2,}, - {"XAW-LIST-UNHIGHLIGHT", Lisp_XawListUnhighlight, 1,1,1,}, - {"XAW-TEXT-GET-SOURCE", Lisp_XawTextGetSource, 1,1,1,}, - {"XAW-TEXT-LAST-POSITION", Lisp_XawTextLastPosition, 1,1,1,}, - {"XAW-TEXT-GET-INSERTION-POINT", Lisp_XawTextGetInsertionPoint, 1,1,1,}, - {"XAW-TEXT-SET-INSERTION-POINT", Lisp_XawTextSetInsertionPoint, 1,2,2,}, + {LispFunction, Lisp_XawCoerceToListReturnStruct, "xaw-coerce-to-list-return-struct opaque"}, + {LispFunction, Lisp_XawScrollbarCoerceToReal, "xaw-scrollbar-coerce-to-real opaque"}, + + {LispFunction, Lisp_XawScrollbarSetThumb, "xaw-scrollbar-set-thumb widget top &optional shown"}, + {LispFunction, Lisp_XawFormDoLayout, "xaw-form-do-layout widget force"}, + {LispFunction, Lisp_XawListChange, "xaw-list-change widget list &optional longest resize"}, + {LispFunction, Lisp_XawListHighlight, "xaw-list-highlight widget index"}, + {LispFunction, Lisp_XawListUnhighlight, "xaw-list-unhighlight widget"}, + {LispFunction, Lisp_XawTextGetSource, "xaw-text-get-source widget"}, + {LispFunction, Lisp_XawTextLastPosition, "xaw-text-last-position widget"}, + {LispFunction, Lisp_XawTextReplace, "xaw-text-replace widget left right text"}, + {LispFunction, Lisp_XawTextSearch, "xaw-text-search widget direction text"}, + {LispFunction, Lisp_XawTextGetInsertionPoint, "xaw-text-get-insertion-point widget"}, + {LispFunction, Lisp_XawTextSetInsertionPoint, "xaw-text-set-insertion-point widget position"}, }; LispModuleData xawLispModuleData = { @@ -99,239 +123,543 @@ xawLoadModule }; -static int xawWidget_t, xawWidgetClass_t, xawListReturnStruct_t, charpp_t; +static int xawWidget_t, xawWidgetClass_t, xawListReturnStruct_t, xawFloatp_t; +static WidgetData **list_data; +static int num_list_data; /* * Implementation */ int -xawLoadModule(LispMac *mac) +xawLoadModule(void) { int i; - char *fname = "INTERNAL:XAW-LOAD-MODULE"; + char *fname = "XAW-LOAD-MODULE"; - xawWidget_t = LispRegisterOpaqueType(mac, "Widget"); - xawWidgetClass_t = LispRegisterOpaqueType(mac, "WidgetClass"); - xawListReturnStruct_t = LispRegisterOpaqueType(mac, "XawListReturnStruct"); - charpp_t = LispRegisterOpaqueType(mac, "char**"); + xawWidget_t = LispRegisterOpaqueType("Widget"); + xawWidgetClass_t = LispRegisterOpaqueType("WidgetClass"); + xawListReturnStruct_t = LispRegisterOpaqueType("XawListReturnStruct"); + xawFloatp_t = LispRegisterOpaqueType("float*"); - LispExecute(mac, "(DEFSTRUCT XAW-LIST-RETURN-STRUCT STRING INDEX)\n"); + LispExecute("(DEFSTRUCT XAW-LIST-RETURN-STRUCT STRING INDEX)\n"); - GCProtect(); - (void)LispSetVariable(mac, ATOM2("ASCII-SINK-OBJECT-CLASS"), + GCDisable(); + (void)LispSetVariable(ATOM2("ASCII-SINK-OBJECT-CLASS"), OPAQUE(asciiSinkObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("ASCII-SRC-OBJECT-CLASS"), + (void)LispSetVariable(ATOM2("ASCII-SRC-OBJECT-CLASS"), OPAQUE(asciiSinkObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("ASCII-TEXT-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("ASCII-TEXT-WIDGET-CLASS"), OPAQUE(asciiTextWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("BOX-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("BOX-WIDGET-CLASS"), OPAQUE(boxWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("COMMAND-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("COMMAND-WIDGET-CLASS"), OPAQUE(commandWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("DIALOG-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("DIALOG-WIDGET-CLASS"), OPAQUE(dialogWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("FORM-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("FORM-WIDGET-CLASS"), OPAQUE(formWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("GRIP-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("GRIP-WIDGET-CLASS"), OPAQUE(gripWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("LABEL-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("LABEL-WIDGET-CLASS"), OPAQUE(labelWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("LIST-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("LIST-WIDGET-CLASS"), OPAQUE(listWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("MENU-BUTTON-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("MENU-BUTTON-WIDGET-CLASS"), OPAQUE(menuButtonWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("MULTI-SINK-OBJEC-TCLASS"), + (void)LispSetVariable(ATOM2("MULTI-SINK-OBJEC-TCLASS"), OPAQUE(multiSinkObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("MULTI-SRC-OBJECT-CLASS"), + (void)LispSetVariable(ATOM2("MULTI-SRC-OBJECT-CLASS"), OPAQUE(multiSrcObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("PANED-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("PANED-WIDGET-CLASS"), OPAQUE(panedWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("PANNER-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("PANNER-WIDGET-CLASS"), OPAQUE(pannerWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("PORTHOLE-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("PORTHOLE-WIDGET-CLASS"), OPAQUE(portholeWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("REPEATER-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("REPEATER-WIDGET-CLASS"), OPAQUE(repeaterWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("SCROLLBAR-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("SCROLLBAR-WIDGET-CLASS"), OPAQUE(scrollbarWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("SIMPLE-MENU-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("SIMPLE-MENU-WIDGET-CLASS"), OPAQUE(simpleMenuWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("SIMPLE-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("SIMPLE-WIDGET-CLASS"), OPAQUE(simpleWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("SME-BSB-OBJECT-CLASS"), + (void)LispSetVariable(ATOM2("SME-BSB-OBJECT-CLASS"), OPAQUE(smeBSBObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("SME-LINE-OBJECT-CLASS"), + (void)LispSetVariable(ATOM2("SME-LINE-OBJECT-CLASS"), OPAQUE(smeLineObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("SME-OBJECT-CLASS"), + (void)LispSetVariable(ATOM2("SME-OBJECT-CLASS"), OPAQUE(smeObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("STRIP-CHART-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("STRIP-CHART-WIDGET-CLASS"), OPAQUE(stripChartWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TEXT-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("TEXT-WIDGET-CLASS"), OPAQUE(textWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TEXT-SINKOBJECT-CLASS"), + (void)LispSetVariable(ATOM2("TEXT-SINKOBJECT-CLASS"), OPAQUE(textSinkObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TEXT-SRC-OBJECT-CLASS"), + (void)LispSetVariable(ATOM2("TEXT-SRC-OBJECT-CLASS"), OPAQUE(textSrcObjectClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TIP-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("TIP-WIDGET-CLASS"), OPAQUE(tipWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TOGGLE-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("TOGGLE-WIDGET-CLASS"), OPAQUE(toggleWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TREE-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("TREE-WIDGET-CLASS"), OPAQUE(treeWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("VIEWPORT-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("VIEWPORT-WIDGET-CLASS"), OPAQUE(viewportWidgetClass, xawWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("VENDOR-SHELL-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("VENDOR-SHELL-WIDGET-CLASS"), OPAQUE(vendorShellWidgetClass, xawWidgetClass_t), fname, 0); - GCUProtect(); + + /* return codes of XawTextReplace */ + (void)LispSetVariable(ATOM2("XAW-REPLACE-ERROR"), + INTEGER(XawReplaceError), fname, 0); + (void)LispSetVariable(ATOM2("XAW-EDIT-DONE"), + INTEGER(XawEditDone), fname, 0); + (void)LispSetVariable(ATOM2("XAW-EDIT-ERROR"), + INTEGER(XawEditError), fname, 0); + (void)LispSetVariable(ATOM2("XAW-POSITION-ERROR"), + INTEGER(XawPositionError), fname, 0); + + /* return code of XawTextSearch */ + (void)LispSetVariable(ATOM2("XAW-TEXT-SEARCH-ERROR"), + INTEGER(XawTextSearchError), fname, 0); + + /* enum XawTextScanDirection */ + (void)LispSetVariable(ATOM2("XAWSD-LEFT"), + INTEGER(XawsdLeft), fname, 0); + (void)LispSetVariable(ATOM2("XAWSD-RIGHT"), + INTEGER(XawsdRight), fname, 0); + GCEnable(); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) - LispAddBuiltinFunction(mac, &lispbuiltins[i]); + LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } +void +LispXawCleanupCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + WidgetData *data = (WidgetData*)user_data; + + UPROTECT(CAR(data->object), data->object); + XtFree((XtPointer)data->data); + XtFree((XtPointer)data); +} + LispObj * -Lisp_XawCoerceToListReturnStruct(LispMac *mac, LispObj *list, char *fname) +Lisp_XawCoerceToListReturnStruct(LispBuiltin *builtin) +/* + xaw-coerce-to-list-return-struct opaque + */ { - LispObj *res, *code, *frm = FRM; + LispObj *result, *code, *ocod = COD; XawListReturnStruct *retlist; + + LispObj *opaque; - if (!CHECKO(CAR(list), xawListReturnStruct_t)) - LispDestroy(mac, "cannot convert %s to XawListReturnStruct, at %s", - LispStrObj(mac, CAR(list)), fname); + opaque = ARGUMENT(0); - retlist = (XawListReturnStruct*)(CAR(list)->data.opaque.data); + if (!CHECKO(opaque, xawListReturnStruct_t)) + LispDestroy("%s: cannot convert %s to XawListReturnStruct", + STRFUN(builtin), STROBJ(opaque)); - GCProtect(); + retlist = (XawListReturnStruct*)(opaque->data.opaque.data); + + GCDisable(); code = CONS(ATOM("MAKE-XAW-LIST-RETURN-STRUCT"), - CONS(ATOM(":STRING"), + CONS(KEYWORD("STRING"), CONS(STRING(retlist->string), - CONS(ATOM(":INDEX"), - CONS(REAL(retlist->list_index), NIL))))); - FRM = CONS(code, FRM); - GCUProtect(); + CONS(KEYWORD("INDEX"), + CONS(INTEGER(retlist->list_index), NIL))))); + COD = CONS(code, COD); + GCEnable(); + + result = EVAL(code); + COD = ocod; + + return (result); +} + +LispObj * +Lisp_XawScrollbarCoerceToReal(LispBuiltin *builtin) +/* + xaw-scrollbar-coerce-to-real opaque + */ +{ + LispObj *result; + float *floatp; + double real; + + LispObj *opaque; + + opaque = ARGUMENT(0); + + if (!CHECKO(opaque, xawFloatp_t)) + LispDestroy("%s: cannot convert %s to float*", + STRFUN(builtin), STROBJ(opaque)); - res = EVAL(code); - FRM = frm; + floatp = (float*)(opaque->data.opaque.data); + real = *floatp; - return (res); + return (DFLOAT(real)); } LispObj * -Lisp_XawFormDoLayout(LispMac *mac, LispObj *list, char *fname) +Lisp_XawFormDoLayout(LispBuiltin *builtin) +/* + xaw-form-do-layout widget force + */ { int force; - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *owidget, *oforce; - force = CAR(CDR(list)) != NIL; - XawFormDoLayout((Widget)(CAR(list)->data.opaque.data), force); + oforce = ARGUMENT(1); + owidget = ARGUMENT(0); - return (NIL); + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + + force = oforce != NIL; + XawFormDoLayout((Widget)(owidget->data.opaque.data), force); + + return (oforce); } LispObj * -Lisp_XawTextGetSource(LispMac *mac, LispObj *list, char *fname) +Lisp_XawTextGetSource(LispBuiltin *builtin) +/* + xaw-text-get-source widget + */ { - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *owidget; + + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); - return (OPAQUE(XawTextGetSource((Widget)(CAR(list)->data.opaque.data)), + return (OPAQUE(XawTextGetSource((Widget)(owidget->data.opaque.data)), xawWidget_t)); } LispObj * -Lisp_XawTextLastPosition(LispMac *mac, LispObj *list, char *fname) +Lisp_XawTextLastPosition(LispBuiltin *builtin) +/* + xaw-text-last-position widget + */ { - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *owidget; + + owidget = ARGUMENT(0); - return (REAL(XawTextLastPosition((Widget)(CAR(list)->data.opaque.data)))); + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + + return (FIXNUM(XawTextLastPosition((Widget)(owidget->data.opaque.data)))); } LispObj * -Lisp_XawTextGetInsertionPoint(LispMac *mac, LispObj *list, char *fname) +Lisp_XawTextGetInsertionPoint(LispBuiltin *builtin) +/* + xaw-text-get-insertion-point widget + */ { - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *owidget; - return (REAL(XawTextGetInsertionPoint((Widget)(CAR(list)->data.opaque.data)))); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + + return (FIXNUM(XawTextGetInsertionPoint((Widget)(owidget->data.opaque.data)))); } LispObj * -Lisp_XawTextSetInsertionPoint(LispMac *mac, LispObj *list, char *fname) +Lisp_XawTextSetInsertionPoint(LispBuiltin *builtin) +/* + xaw-text-set-insertion-point widget position + */ { - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - if (CAR(CDR(list))->type != LispReal_t) - LispDestroy(mac, "cannot convert %s to XawTextPosition, at %s", - LispStrObj(mac, CAR(CDR(list))), fname); + Widget widget; + XawTextPosition position; - XawTextSetInsertionPoint((Widget)(CAR(list)->data.opaque.data), - (XawTextPosition)(CAR(CDR(list))->data.real)); + LispObj *owidget, *oposition; - return (NIL); + oposition = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + + CHECK_INDEX(oposition); + position = (XawTextPosition)FIXNUM_VALUE(oposition); + + XawTextSetInsertionPoint(widget, position); + + return (oposition); } LispObj * -Lisp_XawListHighlight(LispMac *mac, LispObj *list, char *fname) +Lisp_XawTextReplace(LispBuiltin *builtin) +/* + xaw-text-replace widget left right text + */ { - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - if (CAR(CDR(list))->type != LispReal_t) - LispDestroy(mac, "expecting number, at %s", fname); - XawListHighlight((Widget)(CAR(list)->data.opaque.data), - (int)(CAR(CDR(list))->data.real)); + Widget widget; + XawTextPosition left, right; + XawTextBlock block; + + LispObj *owidget, *oleft, *oright, *otext; + + otext = ARGUMENT(3); + oright = ARGUMENT(2); + oleft = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + + CHECK_INDEX(oleft); + left = (XawTextPosition)FIXNUM_VALUE(oleft); + + CHECK_INDEX(oright); + right = (XawTextPosition)FIXNUM_VALUE(oright); + + CHECK_STRING(otext); + block.firstPos = 0; + block.ptr = THESTR(otext); + block.length = strlen(block.ptr); + block.format = FMT8BIT; - return (NIL); + return (FIXNUM(XawTextReplace(widget, left, right, &block))); +} + +LispObj * +Lisp_XawTextSearch(LispBuiltin *builtin) +/* + xaw-text-search widget direction text + */ +{ + Widget widget; + XawTextScanDirection direction; + XawTextBlock block; + + LispObj *owidget, *odirection, *otext; + + otext = ARGUMENT(2); + odirection = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + + CHECK_INDEX(odirection); + direction = (XawTextPosition)FIXNUM_VALUE(odirection); + if (direction != XawsdLeft && direction != XawsdRight) + LispDestroy("%s: %d does not fit in XawTextScanDirection", + STRFUN(builtin), direction); + + CHECK_STRING(otext); + block.firstPos = 0; + block.ptr = THESTR(otext); + block.length = strlen(block.ptr); + block.format = FMT8BIT; + + return (FIXNUM(XawTextSearch(widget, direction, &block))); +} + +LispObj * +Lisp_XawListChange(LispBuiltin *builtin) +/* + xaw-list-change widget list &optional longest resize + */ +{ + Widget widget; + String *list; + int i, nitems; + int longest; + Boolean resize; + LispObj *object; + WidgetData *data; + + LispObj *owidget, *olist, *olongest, *oresize; + + oresize = ARGUMENT(3); + olongest = ARGUMENT(2); + olist = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + + CHECK_LIST(olist); + for (nitems = 0, object = olist; CONSP(object); + ++nitems, object = CDR(object)) + CHECK_STRING(CAR(object)); + + if (olongest != UNSPEC) { + CHECK_INDEX(olongest); + longest = FIXNUM_VALUE(olongest); + } + else + XtVaGetValues(widget, XtNlongest, &longest, NULL, 0); + resize = oresize != UNSPEC && oresize != NIL; + + /* No errors in arguments, build string list */ + list = (String*)XtMalloc(sizeof(String) * nitems); + for (i = 0, object = olist; CONSP(object); i++, object = CDR(object)) + list[i] = THESTR(CAR(object)); + + /* Check if xaw-list-change was already called + * for this widget and free previous data */ + for (i = 0; i < num_list_data; i++) + if ((Widget)CAR(list_data[i]->object)->data.opaque.data == widget) { + XtRemoveCallback(widget, XtNdestroyCallback, + LispXawCleanupCallback, list_data[i]); + LispXawCleanupCallback(widget, list_data[i], NULL); + break; + } + + if (i >= num_list_data) { + ++num_list_data; + list_data = (WidgetData**)XtRealloc((XtPointer)list_data, + sizeof(WidgetData*) * num_list_data); + } + + data = (WidgetData*)XtMalloc(sizeof(WidgetData)); + data->data = list; + list_data[i] = data; + data->object = CONS(owidget, olist); + PROTECT(owidget, data->object); + XtAddCallback(widget, XtNdestroyCallback, LispXawCleanupCallback, data); + + XawListChange(widget, list, nitems, longest, resize); + + return (olist); +} + +LispObj * +Lisp_XawListHighlight(LispBuiltin *builtin) +/* + xaw-list-highlight widget index + */ +{ + Widget widget; + int position; + + LispObj *owidget, *oindex; + + oindex = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + + CHECK_INDEX(oindex); + position = FIXNUM_VALUE(oindex); + + XawListHighlight(widget, position); + + return (oindex); } LispObj * -Lisp_XawListUnhighlight(LispMac *mac, LispObj *list, char *fname) +Lisp_XawListUnhighlight(LispBuiltin *builtin) +/* + xaw-list-unhighlight widget + */ { - if (!CHECKO(CAR(list), xawWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - XawListUnhighlight((Widget)(CAR(list)->data.opaque.data)); + LispObj *owidget; + + owidget = ARGUMENT(0); + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + + XawListUnhighlight((Widget)(owidget->data.opaque.data)); + return (NIL); +} + +LispObj * +Lisp_XawScrollbarSetThumb(LispBuiltin *builtin) +/* + xaw-scrollbar-set-thumb widget top &optional shown + */ +{ + Widget widget; + double top, shown; + + LispObj *owidget, *otop, *oshown; + + oshown = ARGUMENT(2); + otop = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xawWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + + CHECK_DFLOAT(otop); + top = DFLOAT_VALUE(otop); + + if (oshown == UNSPEC) + shown = 1.0; + else { + CHECK_DFLOAT(oshown); + shown = DFLOAT_VALUE(oshown); + } + + XawScrollbarSetThumb(widget, top, shown); + + return (oshown == UNSPEC ? DFLOAT(shown) : oshown); } Index: xc/programs/xedit/lisp/modules/xedit.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/xedit.lsp:1.10 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/xedit.lsp Thu Jan 16 01:25:50 2003 @@ -0,0 +1,560 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/xedit.lsp,v 1.10 2003/01/16 06:25:50 paulo Exp $ +;; + +(provide "xedit") + +#+debug (make-package "XEDIT" :use '("LISP" "EXT")) +(in-package "XEDIT") + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; TODO The user should be able to define *auto-modes* prior to the +;; initialization here in a configuration file, since defvar only binds +;; the variable if it is unbound or doesn't have a value defined. +;; *auto-modes* is a list of conses where every car is compiled +;; to a regexp to match the name of the file being loaded. The caddr is +;; either a string, a pathname, or a syntax-p. +;; When loading a file, if the regexp in the car matches, it will check +;; the caddr value, and if it is a: +;; string: executes (load "progmodes/<the-string>.lsp") +;; pathname: executes (load <the-pathhame>) +;; syntax-p: does nothing, already loaded +;; +;; If it fails to load the file, or the returned value is not a +;; syntax-p, the entry is removed. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defvar *auto-modes* '( + ("\\.(c|cc|C|cxx|h|bm|xbm|xpm|l|y)$" + "C/C++" "c" . *c-mode*) + ("\\.(li?sp|scm)$" + "Lisp/Scheme" "lisp" . *lisp-mode*) + ("Imakefile|(\\.(cf|rules|tmpl|def|cpp)$)" + "X imake" "imake" . *imake-mode*) + ("[Mm]akefile.*|\\.mk$" + "Makefile" "make" . *make-mode*) + ("\\.sh$" + "Unix shell" "sh" . *sh-mode*) + ("\\.sgml?$" + "SGML" "sgml" . *sgml-mode*) + ("\\.html?$" + "HTML" "html" . *html-mode*) + ("\\.(man|\\d)$" + "Man page" "man" . *man-mode*) + ("app-defaults/\\w+|\\u[A-Za-z0-9_-]+\\.ad" + "X resource" "xrdb" . *xrdb-mode*) + ("\\<XF86Config[^/]*" + "XF86Config" "xconf" . *xconf-mode*) + ("\\.spec$" + "RPM spec" "rpm" . *rpm-mode*) + ("\\<XFree86\\.\\d+\\.log$" + "XFree86 log" "xlog" . *xlog-mode*) +)) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Compile the regexps in the *auto-modes* list. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(dolist (mode *auto-modes*) + (rplaca mode (re-comp (car mode) :nosub t)) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Find the progmode associated with the given filename. +;; Returns nil if nothing matches. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun auto-mode (filename &optional symbol &aux syntax) + (if (and symbol (symbolp symbol)) + (if (boundp symbol) + (return-from auto-mode (symbol-value symbol)) + (setq syntax (cddr (find symbol *auto-modes* :key #'cdddr))) + ) + ;; symbol optional argument is not a symbol + (do* + ( + (mode *auto-modes* (cdr mode)) + (regex (caar mode) (caar mode)) + ) + ((endp mode)) + + ;; only wants to know if the regex match. + (when (listp (re-exec regex filename :count 0)) + (setq syntax (cddar mode) symbol (cdr syntax)) + (return) + ) + ) + ) + + ;; if file was already loaded + (if (and symbol (boundp symbol)) + (return-from auto-mode (symbol-value symbol)) + ) + + (when (consp syntax) + ;; point to the syntax file specification + (setq syntax (car syntax)) + + ;; try to load the syntax definition file + (if (stringp syntax) + (load + (string-concat + (namestring *default-pathname-defaults*) + "progmodes/" + syntax + ".lsp" + ) + ) + (load syntax) + ) + + (and symbol (boundp symbol) (symbol-value symbol)) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Data types. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; The main syntax structure, normally, only one should exist per +;; syntax highlight module. +;; The structure is defined here so it is not required to load all +;; the extra data associated with syntax-highlight at initialization +;; time, and will never be loaded if no syntax-highlight mode is +;; defined to the files being edited. +(defstruct syntax + name ;; A unique string to identify the syntax mode. + ;; Should be the name of the language/file type. + options ;; A hash table of options specified for the + ;; language. + + ;; Field(s) defined at "compile time" + labels ;; Not exactly a list of labels, but all syntax + ;; tables for the module. + quark ;; A XrmQuark associated with the XawTextPropertyList + ;; used by this syntax mode. + token-count ;; Number of distinct syntoken structures in + ;; the syntax table. +) + +;; Xlfd description, used when combining properties. +;; Field names are self descriptive. +;; XXX Fields should be initialized as strings, but fields +;; that have an integer value should be allowed to +;; be initialized as such. +;; Combining properties in supported in Xaw, but not yet in the +;; syntax highlight code interface. Combining properties allow easier +;; implementation for markup languages, for example: +;; <b>bold<i>italic</i></b> +;; would render "bold" using a bold version of the default font, +;; and "italic" using a bold and italic version of the default font +(defstruct xlfd + foundry + family + weight + slant + setwidth + addstyle + pixel-size + point-size + res-x + res-y + spacing + avgwidth + registry + encoding +) + + +;; At some time this structure should also hold information for at least: +;; o fontset +;; o foreground pixmap +;; o background pixmap +;; XXX This is also a TODO in Xaw. +(defstruct synprop + quark ;; XrmQuark identifier of the XawTextProperty + ;; structure. This field is filled when "compiling" + ;; the syntax-table. + + name ;; String name of property, must be unique per + ;; property list. + font ;; Optional font string name of property. + foreground ;; Optional string representation of foreground color. + background ;; Optional string representation of background color. + xlfd ;; Optional xlfd structure, when combining properties. + ;; Currently combining properties logic not implemented, + ;; but fonts may be specified using the xlfd definition. + + ;; Boolean properties. + underline ;; Draw a line below the text. + overstrike ;; Draw a line over the text. + + ;; XXX Are these working in Xaw? + subscript ;; Align text to the bottom of the line. + superscript ;; Align text to the top of the line. + ;; Note: subscript and superscript only have effect when the text + ;; line has different height fonts displayed. +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Utility macro, to create a "special" variable holding +;; a synprop structure. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro defsynprop (variable name + &key font foreground background xlfd underline + overstrike subscript superscript) + `(progn + (proclaim '(special ,variable)) + (setq ,variable + (make-synprop + :name ,name + :font ,font + :foreground ,foreground + :background ,background + :xlfd ,xlfd + :underline ,underline + :overstrike ,overstrike + :subscript ,subscript + :superscript ,superscript + ) + ) + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Convert a synprop structure to a string in the format +;; expected by Xaw. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun synprop-to-string (synprop &aux values booleans xlfd) + (if (setq xlfd (synprop-xlfd synprop)) + (dolist + (element + `( + ("foundry" ,(xlfd-foundry xlfd)) + ("family" ,(xlfd-family xlfd)) + ("weight" ,(xlfd-weight xlfd)) + ("slant" ,(xlfd-slant xlfd)) + ("setwidth" ,(xlfd-setwidth xlfd)) + ("addstyle" ,(xlfd-addstyle xlfd)) + ("pixelsize" ,(xlfd-pixel-size xlfd)) + ("pointsize" ,(xlfd-point-size xlfd)) + ("resx" ,(xlfd-res-x xlfd)) + ("resy" ,(xlfd-res-y xlfd)) + ("spacing" ,(xlfd-spacing xlfd)) + ("avgwidth" ,(xlfd-avgwidth xlfd)) + ("registry" ,(xlfd-registry xlfd)) + ("encoding" ,(xlfd-encoding xlfd)) + ) + ) + (if (cadr element) + (setq values (append values element)) + ) + ) + ) + (dolist + (element + `( + ("font" ,(synprop-font synprop)) + ("foreground" ,(synprop-foreground synprop)) + ("background" ,(synprop-background synprop)) + ) + ) + (if (cadr element) + (setq values (append values element)) + ) + ) + + ;; Boolean attributes. These can be specified in the format + ;; <name>=<anything>, but do a nicer output as the format + ;; <name> is accepted. + (dolist + (element + `( + ("underline" ,(synprop-underline synprop)) + ("overstrike" ,(synprop-overstrike synprop)) + ("subscript" ,(synprop-subscript synprop)) + ("superscript" ,(synprop-superscript synprop)) + ) + ) + (if (cadr element) + (setq booleans (append booleans element)) + ) + ) + + ;; Play with format conditionals, list iteration, and goto, to + ;; make resulting string. + (format + nil + "~A~:[~;?~]~:[~3*~;~A=~A~{&~A=~A~}~]~:[~;&~]~:[~2*~;~A~{&~A~*~}~]" + + (synprop-name synprop) ;; ~A + (or values booleans) ;; ~:[~;?~] + values ;; ~:[ + (car values) (cadr values) (cddr values) ;; ~A=~A~{&~A=~A~} + (and values booleans) ;; ~:[~;&~] + booleans ;; ~:[ + (car booleans) (cddr booleans) ;; ~A~{&~A~*~} + ) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Use xedit protocol to create a XawTextPropertyList with the +;; given arguments. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun compile-syntax-property-list (name properties + &aux string-properties quark) + + ;; Create a string representation of the properties. + (dolist (property properties) + (setq + string-properties + (append + string-properties + (list (synprop-to-string property)) + ) + ) + ) + + (setq + string-properties + (case (length string-properties) + (0 "") + (1 (car string-properties)) + (t (format nil "~A~{,~A~}" + (car string-properties) + (cdr string-properties) + ) + ) + ) + ) + +#+debug + (format *output* "~Cconvert-property-list ~S ~S~%" + *escape* + name + string-properties + ) + (setq quark #-debug (convert-property-list name string-properties) + #+debug 0) + + ;; Store the quark for properties not yet "initialized". + ;; XXX This is just a call to Xrm{Perm,}StringToQuark, and should + ;; be made available if there were a wrapper/interface to + ;; that Xlib function. + (dolist (property properties) + (unless (integerp (synprop-quark property)) +#+debug + (format *output* "~Cxrm-string-to-quark ~S~%" + *escape* + (synprop-name property) + ) + (setf + (synprop-quark property) +#-debug (xrm-string-to-quark (synprop-name property)) +#+debug 0 + ) + ) + ) + + quark +) + + + + +#+debug +(progn + (defconstant *escape* #\$) + + (defconstant *output* *standard-output*) + + ;; Recognized identifiers for wrap mode. + (defconstant *wrap-modes* '(:never :line :word)) + + ;; Recognized identifiers for justification. + (defconstant *justifications* '(:left :right :center :full)) + + ;; XawTextScanType + (defconstant *scan-type* + '(:positions :white-space :eol :paragraph :all :alpha-numeric)) + + ;; XawTextScanDirection + (defconstant *scan-direction* '(:left :right)) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Debugging version of xedit functions. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defun clear-entities (left right) + (format *output* "~Cclear-entities ~D ~D~%" + *escape* left right)) + + (defun add-entity (offset length identifier) + (format *output* "~Cadd-entity ~D ~D ~D~%" + *escape* offset length identifier)) + + (defun background (&optional (value nil specified)) + (if specified + (format *output* "~Cset-background ~S~%" *escape* value) + (format *output* "~Cget-background~%" *escape*))) + + (defun foreground (&optional (value nil specified)) + (if specified + (format *output* "~Cset-foreground ~S~%" *escape* value) + (format *output* "~Cget-foreground~%" *escape*))) + + (defun font (&optional (value nil specified)) + (if specified + (format *output* "~Cset-font ~S~%" *escape* value) + (format *output* "~Cget-font~%" *escape*))) + + (defun point (&optional (value nil specified)) + (if specified + (format *output* "~Cset-point ~D~%" *escape* value) + (format *output* "~Cget-point~%" *escape*))) + + (defun point-min () + (format *output* "~Cpoint-min~%" *escape*)) + + (defun point-max () + (format *output* "~Cpoint-max~%" *escape*)) + + (defun property-list (&optional (quark nil specified)) + (format *output* "~property-list ~D~%" *escape* quark)) + + (defun insert (string) + (format *output* "~Cinsert ~S~%" *escape* string)) + + (defun read-text (offset length) + (format *output* "~Cread-text ~D ~D~%" + *escape* offset length)) + + (defun replace-text (left right string) + (format *output* "~Creplace-text ~D ~D ~S~%" + *escape* left right string)) + + (defun scan (offset type direction &key (count 1) include) + (unless (setq type (position type *scan-type*)) + (error "SCAN: type must be one of ~A, not ~A" + *scan-type* type)) + (unless (setq direction (position direction *scan-direction*)) + (error "SCAN: direction must be one of ~A, not ~A" + *scan-direction* direction)) + (format *output* "~Cscan ~D ~D ~D ~D ~D~%" + *escape* offset type direction count (if include 1 0))) + + (defun search-forward (string &optional case-sensitive) + (format *output* "~Csearch-forward ~S ~D~%" + *escape* string (if case-sensitive 1 0))) + + (defun search-backward (string &optional case-sensitive) + (format *output* "~Csearch-backward ~S ~D~%" + *escape* string (if case-sensitive 1 0))) + + (defun wrap-mode (&optional (value nil specified)) + (if specified + (progn + (unless (member value *wrap-modes*) + (error "WRAP-MODE: argument must be one of ~A, not ~A" + *wrap-modes* value)) + (format *output* "~Cset-wrap-mode ~S~%" + *escape* (string value))) + (format *output* "~Cget-wrap-mode~%" *escape*))) + + (defun auto-fill (&optional (value nil specified)) + (if specified + (format *output* "~Cset-auto-fill ~S~%" + *escape* (if value "true" "false")) + (format *output* "~Cget-auto-fill~%" *escape*))) + + (defun justification (&optional (value nil specified)) + (if specified + (progn + (unless (member value *justifications*) + (error "JUSTIFICATION: argument must be one of ~A, not ~A" + *justifications* value)) + (format *output* "~Cset-justification ~S~%" + *escape* (string value))) + (format *output* "~Cget-justification~%" *escape*))) + + (defun left-column (&optional (value nil specified)) + (if specified + (format *output* "~Cset-left-column ~D~%" *escape* value) + (format *output* "~Cget-left-column~%" *escape*))) + + (defun right-column (&optional (value nil specified)) + (if specified + (format *output* "~Cset-right-column ~D~%" *escape* value) + (format *output* "~Cget-right-column~%" *escape*))) + + (defun vertical-scrollbar (&optional (value nil specified)) + (if specified + (format *output* "~Cset-vert-scrollbar ~S~%" + *escape* (if value "always" "never")) + (format *output* "~Cget-vert-scrollbar~%" *escape*))) + + (defun horizontal-scrollbar (&optional (value nil specified)) + (if specified + (format *output* "~Cset-horiz-scrollbar ~S~%" + *escape* (if value "always" "never")) + (format *output* "~Cget-horiz-scrollbar~%" *escape*))) + + #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + (defun create-buffer (name) + (format *output* "~Ccreate-buffer ~S~%" *escape* name)) + + (defun remove-buffer (name) + (format *output* "~Cremove-buffer ~S~%" *escape* name)) + + (defun buffer-name (&optional (value nil specified)) + (if specified + (format *output* "~Cset-buffer-name ~S~%" *escape* value) + (format *output* "~Cget-buffer-name~%" *escape*))) + + (defun buffer-filename (&optional (value nil specified)) + (if specified + (format *output* "~Cset-buffer-filename ~S~%" + *escape* (namestring value)) + (format *output* "~Cget-buffer-filename~%" *escape*))) + + (defun current-buffer (&optional (value nil specified)) + (if specified + (format *output* "~Cset-current-buffer ~S~%" *escape* value) + (format *output* "~Cget-current-buffer~%" *escape*))) + + (defun other-buffer (&optional (value nil specified)) + (if specified + (format *output* "~Cset-other-buffer ~S~%" *escape* value) + (format *output* "~Cget-other-buffer~%" *escape*))) + |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||# +) Index: xc/programs/xedit/lisp/modules/xt.c diff -u xc/programs/xedit/lisp/modules/xt.c:1.10 xc/programs/xedit/lisp/modules/xt.c:1.19 --- xc/programs/xedit/lisp/modules/xt.c:1.10 Fri Oct 19 20:19:36 2001 +++ xc/programs/xedit/lisp/modules/xt.c Sat Nov 23 03:26:52 2002 @@ -27,14 +27,16 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/xt.c,v 1.10 2001/10/20 00:19:36 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/xt.c,v 1.19 2002/11/23 08:26:52 paulo Exp $ */ #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Shell.h> #include "internal.h" +#include "private.h" /* * Types @@ -58,7 +60,6 @@ } Resources; typedef struct { - LispMac *mac; LispObj *data; /* data is => (list* widget callback argument) */ } CallbackArgs; @@ -67,32 +68,57 @@ * Prototypes */ int xtLoadModule(LispMac*); -void _LispXtCleanupCallback(Widget, XtPointer, XtPointer); +void LispXtCleanupCallback(Widget, XtPointer, XtPointer); -void _LispXtCallback(Widget, XtPointer, XtPointer); +void LispXtCallback(Widget, XtPointer, XtPointer); +void LispXtInputCallback(XtPointer, int*, XtInputId*); -LispObj *Lisp_XtCoerceToWidgetList(LispMac*, LispObj*, char*); -LispObj *Lisp_XtAddCallback(LispMac*, LispObj*, char*); -LispObj *Lisp_XtAppInitialize(LispMac*, LispObj*, char*); -LispObj *Lisp_XtAppMainLoop(LispMac*, LispObj*, char*); -LispObj *Lisp_XtAppPending(LispMac*, LispObj*, char*); -LispObj *Lisp_XtAppProcessEvent(LispMac*, LispObj*, char*); -LispObj *Lisp_XtCreateWidget(LispMac*, LispObj*, char*); -LispObj *Lisp_XtCreateManagedWidget(LispMac*, LispObj*, char*); -LispObj *Lisp_XtCreatePopupShell(LispMac*, LispObj*, char*); -LispObj *Lisp_XtDestroyWidget(LispMac*, LispObj*, char*); -LispObj *Lisp_XtGetValues(LispMac*, LispObj*, char*); -LispObj *Lisp_XtManageChild(LispMac*, LispObj*, char*); -LispObj *Lisp_XtPopup(LispMac*, LispObj*, char*); -LispObj *Lisp_XtPopdown(LispMac*, LispObj*, char*); -LispObj *Lisp_XtRealizeWidget(LispMac*, LispObj*, char*); -LispObj *Lisp_XtSetSensitive(LispMac*, LispObj*, char*); -LispObj *Lisp_XtSetValues(LispMac*, LispObj*, char*); -LispObj *Lisp_XtWidgetToApplicationContext(LispMac*, LispObj*, char*); +/* a hack... */ +LispObj *Lisp_XtCoerceToWidgetList(LispBuiltin*); -LispObj *_LispXtCreateWidget(LispMac*, LispObj*, char*, int); +LispObj *Lisp_XtAddCallback(LispBuiltin*); +LispObj *Lisp_XtAppInitialize(LispBuiltin*); +LispObj *Lisp_XtAppMainLoop(LispBuiltin*); +LispObj *Lisp_XtAppAddInput(LispBuiltin*); +LispObj *Lisp_XtAppPending(LispBuiltin*); +LispObj *Lisp_XtAppProcessEvent(LispBuiltin*); +LispObj *Lisp_XtCreateWidget(LispBuiltin*); +LispObj *Lisp_XtCreateManagedWidget(LispBuiltin*); +LispObj *Lisp_XtCreatePopupShell(LispBuiltin*); +LispObj *Lisp_XtDestroyWidget(LispBuiltin*); +LispObj *Lisp_XtGetKeyboardFocusWidget(LispBuiltin*); +LispObj *Lisp_XtGetValues(LispBuiltin*); +LispObj *Lisp_XtManageChild(LispBuiltin*); +LispObj *Lisp_XtUnmanageChild(LispBuiltin*); +LispObj *Lisp_XtSetMappedWhenManaged(LispBuiltin*); +LispObj *Lisp_XtMapWidget(LispBuiltin*); +LispObj *Lisp_XtName(LispBuiltin*); +LispObj *Lisp_XtParent(LispBuiltin*); +LispObj *Lisp_XtUnmapWidget(LispBuiltin*); +LispObj *Lisp_XtPopup(LispBuiltin*); +LispObj *Lisp_XtPopdown(LispBuiltin*); +LispObj *Lisp_XtIsRealized(LispBuiltin*); +LispObj *Lisp_XtRealizeWidget(LispBuiltin*); +LispObj *Lisp_XtUnrealizeWidget(LispBuiltin*); +LispObj *Lisp_XtRemoveInput(LispBuiltin*); +LispObj *Lisp_XtSetSensitive(LispBuiltin*); +LispObj *Lisp_XtSetValues(LispBuiltin*); +LispObj *Lisp_XtWidgetToApplicationContext(LispBuiltin*); +LispObj *Lisp_XtDisplay(LispBuiltin*); +LispObj *Lisp_XtDisplayOfObject(LispBuiltin*); +LispObj *Lisp_XtScreen(LispBuiltin*); +LispObj *Lisp_XtScreenOfObject(LispBuiltin*); +LispObj *Lisp_XtSetKeyboardFocus(LispBuiltin*); +LispObj *Lisp_XtWindow(LispBuiltin*); +LispObj *Lisp_XtWindowOfObject(LispBuiltin*); +LispObj *Lisp_XtAddGrab(LispBuiltin*); +LispObj *Lisp_XtRemoveGrab(LispBuiltin*); +LispObj *Lisp_XtAppGetExitFlag(LispBuiltin*); +LispObj *Lisp_XtAppSetExitFlag(LispBuiltin*); -static Resources *LispConvertResources(LispMac*, LispObj*, Widget, +LispObj *LispXtCreateWidget(LispBuiltin*, int); + +static Resources *LispConvertResources(LispObj*, Widget, ResourceList*, ResourceList*); static void LispFreeResources(Resources*); @@ -109,29 +135,51 @@ static void PopdownAction(Widget, XEvent*, String*, Cardinal*); static void QuitAction(Widget, XEvent*, String*, Cardinal*); - /* * Initialization */ static LispBuiltin lispbuiltins[] = { - {"XT-COERCE-TO-WIDGET-LIST", Lisp_XtCoerceToWidgetList, 1,2,2,}, - {"XT-ADD-CALLBACK", Lisp_XtAddCallback, 1,3,4,}, - {"XT-APP-INITIALIZE", Lisp_XtAppInitialize, 1,2,4,}, - {"XT-APP-PENDING", Lisp_XtAppPending, 1,1,1,}, - {"XT-APP-MAIN-LOOP", Lisp_XtAppMainLoop, 1,1,1,}, - {"XT-APP-PROCESS-EVENT", Lisp_XtAppProcessEvent, 1,1,2,}, - {"XT-CREATE-MANAGED-WIDGET", Lisp_XtCreateManagedWidget, 1,3,4,}, - {"XT-CREATE-WIDGET", Lisp_XtCreateWidget, 1,3,4,}, - {"XT-CREATE-POPUP-SHELL", Lisp_XtCreatePopupShell, 1,3,4,}, - {"XT-DESTROY-WIDGET", Lisp_XtDestroyWidget, 1,1,1,}, - {"XT-GET-VALUES", Lisp_XtGetValues, 1,2,2,}, - {"XT-MANAGE-CHILD", Lisp_XtManageChild, 1,1,1,}, - {"XT-POPUP", Lisp_XtPopup, 1,2,2,}, - {"XT-POPDOWN", Lisp_XtPopdown, 1,1,1,}, - {"XT-REALIZE-WIDGET", Lisp_XtRealizeWidget, 1,1,1,}, - {"XT-SET-SENSITIVE", Lisp_XtSetSensitive, 1,2,2,}, - {"XT-SET-VALUES", Lisp_XtSetValues, 1,2,2,}, - {"XT-WIDGET-TO-APPLICATION-CONTEXT",Lisp_XtWidgetToApplicationContext,1,1,1,}, + {LispFunction, Lisp_XtCoerceToWidgetList, "xt-coerce-to-widget-list number opaque"}, + + {LispFunction, Lisp_XtAddGrab, "xt-add-grab widget exclusive spring-loaded"}, + {LispFunction, Lisp_XtAddCallback, "xt-add-callback widget callback-name callback &optional client-data"}, + {LispFunction, Lisp_XtAppAddInput, "xt-app-add-input app-context fileno condition function &optional client-data"}, + {LispFunction, Lisp_XtAppInitialize, "xt-app-initialize app-context-return application-class &optional options fallback-resources"}, + {LispFunction, Lisp_XtAppPending, "xt-app-pending app-context"}, + {LispFunction, Lisp_XtAppMainLoop, "xt-app-main-loop app-context"}, + {LispFunction, Lisp_XtAppProcessEvent, "xt-app-process-event app-context &optional mask"}, + {LispFunction, Lisp_XtAppGetExitFlag, "xt-app-get-exit-flag app-context"}, + {LispFunction, Lisp_XtAppSetExitFlag, "xt-app-set-exit-flag app-context"}, + {LispFunction, Lisp_XtCreateManagedWidget, "xt-create-managed-widget name widget-class parent &optional arguments"}, + {LispFunction, Lisp_XtCreateWidget, "xt-create-widget name widget-class parent &optional arguments"}, + {LispFunction, Lisp_XtCreatePopupShell, "xt-create-popup-shell name widget-class parent &optional arguments"}, + {LispFunction, Lisp_XtDestroyWidget, "xt-destroy-widget widget"}, + {LispFunction, Lisp_XtGetKeyboardFocusWidget, "xt-get-keyboard-focus-widget widget"}, + {LispFunction, Lisp_XtGetValues, "xt-get-values widget arguments"}, + {LispFunction, Lisp_XtManageChild, "xt-manage-child widget"}, + {LispFunction, Lisp_XtName, "xt-name widget"}, + {LispFunction, Lisp_XtUnmanageChild, "xt-unmanage-child widget"}, + {LispFunction, Lisp_XtMapWidget, "xt-map-widget widget"}, + {LispFunction, Lisp_XtUnmapWidget, "xt-unmap-widget widget"}, + {LispFunction, Lisp_XtSetMappedWhenManaged, "xt-set-mapped-when-managed widget map-when-managed"}, + {LispFunction, Lisp_XtParent, "xt-parent widget"}, + {LispFunction, Lisp_XtPopup, "xt-popup widget grab-kind"}, + {LispFunction, Lisp_XtPopdown, "xt-popdown widget"}, + {LispFunction, Lisp_XtIsRealized, "xt-is-realized widget"}, + {LispFunction, Lisp_XtRealizeWidget, "xt-realize-widget widget"}, + {LispFunction, Lisp_XtUnrealizeWidget, "xt-unrealize-widget widget"}, + {LispFunction, Lisp_XtRemoveInput, "xt-remove-input input"}, + {LispFunction, Lisp_XtRemoveGrab, "xt-remove-grab widget"}, + {LispFunction, Lisp_XtSetKeyboardFocus, "xt-set-keyboard-focus widget descendant"}, + {LispFunction, Lisp_XtSetSensitive, "xt-set-sensitive widget sensitive"}, + {LispFunction, Lisp_XtSetValues, "xt-set-values widget arguments"}, + {LispFunction, Lisp_XtWidgetToApplicationContext, "xt-widget-to-application-context widget"}, + {LispFunction, Lisp_XtDisplay, "xt-display widget"}, + {LispFunction, Lisp_XtDisplayOfObject, "xt-display-of-object object"}, + {LispFunction, Lisp_XtScreen, "xt-screen widget"}, + {LispFunction, Lisp_XtScreenOfObject, "xt-screen-of-object object"}, + {LispFunction, Lisp_XtWindow, "xt-window widget"}, + {LispFunction, Lisp_XtWindowOfObject, "xt-window-of-object object"}, }; LispModuleData xtLispModuleData = { @@ -143,245 +191,384 @@ static Cardinal num_resource_list; static Atom delete_window; -static int xtAppContext_t, xtWidget_t, xtWidgetClass_t, xtWidgetList_t; +static int xtAppContext_t, xtWidget_t, xtWidgetClass_t, xtWidgetList_t, + xtInputId_t, xtDisplay_t, xtScreen_t, xtWindow_t; static XtActionsRec actions[] = { {"xt-popdown", PopdownAction}, {"xt-quit", QuitAction}, }; -static XrmQuark qCardinal, qInt, qString, qWidget; +static XrmQuark qCardinal, qInt, qString, qWidget, qFloat; +static CallbackArgs **input_list; +static Cardinal num_input_list, size_input_list; + /* * Implementation */ int -xtLoadModule(LispMac *mac) +xtLoadModule(void) { int i; - char *fname = "INTERNAL:XT-LOAD-MODULE"; + char *fname = "XT-LOAD-MODULE"; - xtAppContext_t = LispRegisterOpaqueType(mac, "XtAppContext"); - xtWidget_t = LispRegisterOpaqueType(mac, "Widget"); - xtWidgetClass_t = LispRegisterOpaqueType(mac, "WidgetClass"); - xtWidgetList_t = LispRegisterOpaqueType(mac, "WidgetList"); + xtAppContext_t = LispRegisterOpaqueType("XtAppContext"); + xtWidget_t = LispRegisterOpaqueType("Widget"); + xtWidgetClass_t = LispRegisterOpaqueType("WidgetClass"); + xtWidgetList_t = LispRegisterOpaqueType("WidgetList"); + xtInputId_t = LispRegisterOpaqueType("XtInputId"); + xtDisplay_t = LispRegisterOpaqueType("Display*"); + xtScreen_t = LispRegisterOpaqueType("Screen*"); + xtWindow_t = LispRegisterOpaqueType("Window"); - LispExecute(mac, "(DEFSTRUCT XT-WIDGET-LIST NUM-CHILDREN CHILDREN)\n"); + LispExecute("(DEFSTRUCT XT-WIDGET-LIST NUM-CHILDREN CHILDREN)\n"); - GCProtect(); - (void)LispSetVariable(mac, ATOM2("CORE-WIDGET-CLASS"), + GCDisable(); + (void)LispSetVariable(ATOM2("CORE-WIDGET-CLASS"), OPAQUE(coreWidgetClass, xtWidgetClass_t), + fname, 0); + (void)LispSetVariable(ATOM2("COMPOSITE-WIDGET-CLASS"), + OPAQUE(compositeWidgetClass, xtWidgetClass_t), + fname, 0); + (void)LispSetVariable(ATOM2("CONSTRAINT-WIDGET-CLASS"), + OPAQUE(constraintWidgetClass, xtWidgetClass_t), fname, 0); - (void)LispSetVariable(mac, ATOM2("TRANSIENT-SHELL-WIDGET-CLASS"), + (void)LispSetVariable(ATOM2("TRANSIENT-SHELL-WIDGET-CLASS"), OPAQUE(transientShellWidgetClass, xtWidgetClass_t), fname, 0); /* parameters for XtPopup */ - (void)LispSetVariable(mac, ATOM2("XT-GRAB-EXCLUSIVE"), - REAL(XtGrabExclusive), fname, 0); - (void)LispSetVariable(mac, ATOM2("XT-GRAB-NONE"), - REAL(XtGrabNone), fname, 0); - (void)LispSetVariable(mac, ATOM2("XT-GRAB-NONE-EXCLUSIVE"), - REAL(XtGrabNonexclusive), fname, 0); + (void)LispSetVariable(ATOM2("XT-GRAB-EXCLUSIVE"), + INTEGER(XtGrabExclusive), fname, 0); + (void)LispSetVariable(ATOM2("XT-GRAB-NONE"), + INTEGER(XtGrabNone), fname, 0); + (void)LispSetVariable(ATOM2("XT-GRAB-NONE-EXCLUSIVE"), + INTEGER(XtGrabNonexclusive), fname, 0); /* parameters for XtAppProcessEvent */ - (void)LispSetVariable(mac, ATOM2("XT-IM-XEVENT"), - REAL(XtIMXEvent), fname, 0); - (void)LispSetVariable(mac, ATOM2("XT-IM-TIMER"), - REAL(XtIMTimer), fname, 0); - (void)LispSetVariable(mac, ATOM2("XT-IM-ALTERNATE-INPUT"), - REAL(XtIMAlternateInput), fname, 0); - (void)LispSetVariable(mac, ATOM2("XT-IM-SIGNAL"), - REAL(XtIMSignal), fname, 0); - (void)LispSetVariable(mac, ATOM2("XT-IM-ALL"), - REAL(XtIMSignal), fname, 0); - GCUProtect(); + (void)LispSetVariable(ATOM2("XT-IM-XEVENT"), + INTEGER(XtIMXEvent), fname, 0); + (void)LispSetVariable(ATOM2("XT-IM-TIMER"), + INTEGER(XtIMTimer), fname, 0); + (void)LispSetVariable(ATOM2("XT-IM-ALTERNATE-INPUT"), + INTEGER(XtIMAlternateInput), fname, 0); + (void)LispSetVariable(ATOM2("XT-IM-SIGNAL"), + INTEGER(XtIMSignal), fname, 0); + (void)LispSetVariable(ATOM2("XT-IM-ALL"), + INTEGER(XtIMAll), fname, 0); + + /* parameters for XtAppAddInput */ + (void)LispSetVariable(ATOM2("XT-INPUT-READ-MASK"), + INTEGER(XtInputReadMask), fname, 0); + (void)LispSetVariable(ATOM2("XT-INPUT-WRITE-MASK"), + INTEGER(XtInputWriteMask), fname, 0); + (void)LispSetVariable(ATOM2("XT-INPUT-EXCEPT-MASK"), + INTEGER(XtInputExceptMask), fname, 0); + GCEnable(); qCardinal = XrmPermStringToQuark(XtRCardinal); qInt = XrmPermStringToQuark(XtRInt); qString = XrmPermStringToQuark(XtRString); qWidget = XrmPermStringToQuark(XtRWidget); + qFloat = XrmPermStringToQuark(XtRFloat); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) - LispAddBuiltinFunction(mac, &lispbuiltins[i]); + LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } void -_LispXtCallback(Widget w, XtPointer user_data, XtPointer call_data) +LispXtCallback(Widget w, XtPointer user_data, XtPointer call_data) { CallbackArgs *args = (CallbackArgs*)user_data; - LispMac *mac = args->mac; - LispObj *code, *frm = FRM; + LispObj *code, *ocod = COD; - GCProtect(); - /* callback name */ /* reall caller */ - code = CONS(QUOTE(CDR(CDR(args->data))), CONS(OPAQUE(w, xtWidget_t), + GCDisable(); + /* callback name */ /* reall caller */ + code = CONS(CDR(CDR(args->data)), CONS(OPAQUE(w, xtWidget_t), CONS(CAR(CDR(args->data)), CONS(OPAQUE(call_data, 0), NIL)))); /* user arguments */ - FRM = CONS(code, FRM); - GCUProtect(); + COD = CONS(code, COD); + GCEnable(); - (void)Lisp_Funcall(mac, code, "FUNCALL"); - FRM = frm; + (void)EVAL(code); + COD = ocod; } + void -_LispXtCleanupCallback(Widget w, XtPointer user_data, XtPointer call_data) +LispXtCleanupCallback(Widget w, XtPointer user_data, XtPointer call_data) { CallbackArgs *args = (CallbackArgs*)user_data; - LispMac *mac = args->mac; UPROTECT(CAR(args->data), args->data); + XtFree((XtPointer)args); +} + +void +LispXtInputCallback(XtPointer closure, int *source, XtInputId *id) +{ + CallbackArgs *args = (CallbackArgs*)closure; + LispObj *code, *ocod = COD; + + GCDisable(); + /* callback name */ /* user arguments */ + code = CONS(CDR(CDR(args->data)), CONS(CAR(CDR(args->data)), + CONS(INTEGER(*source), CONS(CAR(args->data), NIL)))); + /* input source */ /* input id */ + COD = CONS(code, COD); + GCEnable(); + + (void)EVAL(code); + COD = ocod; } LispObj * -Lisp_XtCoerceToWidgetList(LispMac *mac, LispObj *list, char *fname) +Lisp_XtCoerceToWidgetList(LispBuiltin *builtin) +/* + xt-coerce-to-widget-list number opaque + */ { int i; WidgetList children; Cardinal num_children; - LispObj *obj, *cdr, *wid; + LispObj *cons, *widget_list, *result; - if (CAR(list)->type != LispReal_t) - LispDestroy(mac, "expecting number, at %s", fname); - if (!CHECKO(CAR(CDR(list)), xtWidgetList_t)) - LispDestroy(mac, "cannot convert %s to XawListReturnStruct, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *onumber, *opaque; - num_children = CAR(list)->data.real; - children = (WidgetList)(CAR(CDR(list))->data.opaque.data); + opaque = ARGUMENT(1); + onumber = ARGUMENT(0); - GCProtect(); - wid = cdr = NIL; + CHECK_INDEX(onumber); + num_children = FIXNUM_VALUE(onumber); + + if (!CHECKO(opaque, xtWidgetList_t)) + LispDestroy("%s: cannot convert %s to WidgetList", + STRFUN(builtin), STROBJ(opaque)); + children = (WidgetList)(opaque->data.opaque.data); + + GCDisable(); + widget_list = cons = NIL; for (i = 0; i < num_children; i++) { - obj = CONS(OPAQUE(children[i], xtWidget_t), NIL); - if (wid == NIL) - wid = cdr = CONS(OPAQUE(children[i], xtWidget_t), NIL); + result = CONS(OPAQUE(children[i], xtWidget_t), NIL); + if (widget_list == NIL) + widget_list = cons = result; else { - CDR(cdr) = CONS(OPAQUE(children[i], xtWidget_t), NIL); - cdr = CDR(cdr); + RPLACD(cons, result); + cons = CDR(cons); } } - obj = EVAL(CONS(ATOM("MAKE-XT-WIDGET-LIST"), - CONS(ATOM(":NUM-CHILDREN"), - CONS(REAL(num_children), - CONS(ATOM(":CHILDREN"), - CONS(QUOTE(wid), NIL)))))); - GCUProtect(); + result = APPLY(ATOM("MAKE-XT-WIDGET-LIST"), + CONS(KEYWORD("NUM-CHILDREN"), + CONS(INTEGER(num_children), + CONS(KEYWORD("CHILDREN"), + CONS(widget_list, NIL))))); + GCEnable(); - return (obj); + return (result); } LispObj * -Lisp_XtAddCallback(LispMac *mac, LispObj *list, char *fname) +Lisp_XtAddCallback(LispBuiltin *builtin) +/* + xt-add-callback widget callback-name callback &optional client-data + */ { CallbackArgs *arguments; - LispObj *widget, *name, *callback, *args, *data; + LispObj *data; + + LispObj *widget, *callback_name, *callback, *client_data; - widget = CAR(list); + client_data = ARGUMENT(3); + callback = ARGUMENT(2); + callback_name = ARGUMENT(1); + widget = ARGUMENT(0); + if (!CHECKO(widget, xtWidget_t)) - LispDestroy(mac, - "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - list = CDR(list); - - name = CAR(list); - if (name->type != LispString_t) - LispDestroy(mac, "expecting string, at %s", fname); - list = CDR(list); - - callback = CAR(list); - if (callback->type != LispAtom_t) - LispDestroy(mac, "expecting atom, at %s", fname); - list = CDR(list); - - GCProtect(); - if (list == NIL) - args = list; - else - args = QUOTE(CAR(list)); + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + CHECK_STRING(callback_name); + if (!SYMBOLP(callback) && callback->type != LispLambda_t) + LispDestroy("%s: %s cannot be used as a callback", + STRFUN(builtin), STROBJ(callback)); - data = CONS(widget, CONS(args, callback)); + if (client_data == UNSPEC) + client_data = NIL; + + data = CONS(widget, CONS(client_data, callback)); PROTECT(widget, data); - GCUProtect(); arguments = XtNew(CallbackArgs); - arguments->mac = mac; arguments->data = data; - XtAddCallback((Widget)(widget->data.opaque.data), STRPTR(name), - _LispXtCallback, (XtPointer)arguments); + XtAddCallback((Widget)(widget->data.opaque.data), THESTR(callback_name), + LispXtCallback, (XtPointer)arguments); XtAddCallback((Widget)(widget->data.opaque.data), XtNdestroyCallback, - _LispXtCleanupCallback, (XtPointer)arguments); + LispXtCleanupCallback, (XtPointer)arguments); + + return (client_data); +} + +LispObj * +Lisp_XtAppAddInput(LispBuiltin *builtin) +/* + xt-app-add-input app-context fileno condition function &optional client-data + */ +{ + LispObj *data, *input; + XtAppContext appcon; + int source, condition; + CallbackArgs *arguments; + XtInputId id; + + LispObj *app_context, *fileno, *ocondition, *function, *client_data; + + client_data = ARGUMENT(4); + function = ARGUMENT(3); + ocondition = ARGUMENT(2); + fileno = ARGUMENT(1); + app_context = ARGUMENT(0); + if (!CHECKO(app_context, xtAppContext_t)) + LispDestroy("%s: cannot convert %s to XtAppContext", + STRFUN(builtin), STROBJ(app_context)); + appcon = (XtAppContext)(app_context->data.opaque.data); + + CHECK_LONGINT(fileno); + source = LONGINT_VALUE(fileno); + + CHECK_FIXNUM(ocondition); + condition = FIXNUM_VALUE(ocondition); + + if (!SYMBOLP(function) && function->type != LispLambda_t) + LispDestroy("%s: %s cannot be used as a callback", + STRFUN(builtin), STROBJ(function)); + + /* client data optional */ + if (client_data == UNSPEC) + client_data = NIL; + + data = CONS(NIL, CONS(client_data, function)); + + arguments = XtNew(CallbackArgs); + arguments->data = data; + + id = XtAppAddInput(appcon, source, (XtPointer)condition, + LispXtInputCallback, (XtPointer)arguments); + GCDisable(); + input = OPAQUE(id, xtInputId_t); + GCEnable(); + RPLACA(data, input); + PROTECT(input, data); + + if (num_input_list + 1 >= size_input_list) { + ++size_input_list; + input_list = (CallbackArgs**) + XtRealloc((XtPointer)input_list, + sizeof(CallbackArgs*) * size_input_list); + } + input_list[num_input_list++] = arguments; + + return (input); +} + +LispObj * +Lisp_XtRemoveInput(LispBuiltin *builtin) +/* + xt-remove-input input + */ +{ + int i; + XtInputId id; + CallbackArgs *args; + + LispObj *input; + + input = ARGUMENT(0); + + if (!CHECKO(input, xtInputId_t)) + LispDestroy("%s: cannot convert %s to XtInputId", + STRFUN(builtin), STROBJ(input)); + + id = (XtInputId)(input->data.opaque.data); + for (i = 0; i < num_input_list; i++) { + args = input_list[i]; + if (id == (XtInputId)(CAR(args->data)->data.opaque.data)) { + UPROTECT(CAR(args->data), args->data); + XtFree((XtPointer)args); + + if (i + 1 < num_input_list) + memmove(input_list + i, input_list + i + 1, + sizeof(CallbackArgs*) * (num_input_list - i - 1)); + --num_input_list; + + XtRemoveInput(id); + + return (T); + } + } + return (NIL); } LispObj * -Lisp_XtAppInitialize(LispMac *mac, LispObj *list, char *fname) +Lisp_XtAppInitialize(LispBuiltin *builtin) +/* + xt-app-initialize app-context-return application-class &optional options fallback-resources + */ { XtAppContext appcon; - char *app, *cname; Widget shell; int zero = 0; Resources *resources = NULL; String *fallback = NULL; - if (CAR(list)->type != LispAtom_t) - LispDestroy(mac, "expecting atom, at %s", fname); - app = STRPTR(CAR(list)); - list = CDR(list); - - if (CAR(list)->type != LispString_t) { - LispDestroy(mac, "cannot convert %s to string, at %s", - LispStrObj(mac, CAR(list)), fname); - } - cname = STRPTR(CAR(list)); + LispObj *app_context_return, *application_class, + *options, *fallback_resources; - /* check if fallback resources given */ - if (list != NIL && CDR(list)->type == LispCons_t && - CDR(CDR(list))->type == LispCons_t) { + fallback_resources = ARGUMENT(3); + options = ARGUMENT(2); + application_class = ARGUMENT(1); + app_context_return = ARGUMENT(0); + + CHECK_SYMBOL(app_context_return); + CHECK_STRING(application_class); + CHECK_LIST(options); + + /* check fallback resources, if given */ + if (fallback_resources != UNSPEC) { + LispObj *string; int count; - LispObj *ptr, *obj = CAR(CDR(CDR(list))); - - if (obj->type != LispCons_t) - LispDestroy(mac, "expecting string list, at %s", fname); - for (ptr = obj, count = 0; ptr->type == LispCons_t; - ptr = CDR(ptr), count++) - if (CAR(ptr)->type != LispString_t) - LispDestroy(mac, "%s is not a string, at %s", - LispStrObj(mac, CAR(ptr)), fname); + CHECK_CONS(fallback_resources); + for (string = fallback_resources, count = 0; CONS_P(string); + string = CDR(string), count++) + CHECK_STRING(CAR(string)); /* fallback resources was correctly specified */ - fallback = LispMalloc(mac, sizeof(String) * (count + 1)); - for (ptr = obj, count = 0; ptr->type == LispCons_t; - ptr = CDR(ptr), count++) - fallback[count] = STRPTR(CAR(ptr)); + fallback = LispMalloc(sizeof(String) * (count + 1)); + for (string = fallback_resources, count = 0; CONS_P(string); + string = CDR(string), count++) + fallback[count] = THESTR(CAR(string)); fallback[count] = NULL; } - GCProtect(); - shell = XtAppInitialize(&appcon, cname, NULL, 0, &zero, NULL, - fallback, NULL, 0); + shell = XtAppInitialize(&appcon, THESTR(application_class), NULL, + 0, &zero, NULL, fallback, NULL, 0); if (fallback) - LispFree(mac, fallback); - (void)LispSetVariable(mac, ATOM(app), OPAQUE(appcon, xtAppContext_t), - fname, 0); - GCUProtect(); + LispFree(fallback); + (void)LispSetVariable(app_context_return, + OPAQUE(appcon, xtAppContext_t), + STRFUN(builtin), 0); XtAppAddActions(appcon, actions, XtNumber(actions)); - list = CDR(list); - if (list == NIL || CAR(list) == NIL) - resources = NULL; - else if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "expecting argument list, at %s", fname); - else { - resources = LispConvertResources(mac, CAR(list), shell, + if (options != UNSPEC) { + resources = LispConvertResources(options, shell, GetResourceList(XtClass(shell)), NULL); if (resources) { @@ -394,76 +581,94 @@ } LispObj * -Lisp_XtAppMainLoop(LispMac *mac, LispObj *list, char *fname) +Lisp_XtAppMainLoop(LispBuiltin *builtin) +/* + xt-app-main-loop app-context + */ { - if (!CHECKO(CAR(list), xtAppContext_t)) - LispDestroy(mac, - "cannot convert %s to XtAppContext, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *app_context; + + app_context = ARGUMENT(0); + + if (!CHECKO(app_context, xtAppContext_t)) + LispDestroy("%s: cannot convert %s to XtAppContext", + STRFUN(builtin), STROBJ(app_context)); - XtAppMainLoop((XtAppContext)(CAR(list)->data.opaque.data)); + XtAppMainLoop((XtAppContext)(app_context->data.opaque.data)); return (NIL); } LispObj * -Lisp_XtAppPending(LispMac *mac, LispObj *list, char *fname) +Lisp_XtAppPending(LispBuiltin *builtin) +/* + xt-app-pending app-context + */ { - if (!CHECKO(CAR(list), xtAppContext_t)) - LispDestroy(mac, - "cannot convert %s to XtAppContext, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *app_context; + + app_context = ARGUMENT(0); - return (REAL(XtAppPending((XtAppContext)(CAR(list)->data.opaque.data)))); + if (!CHECKO(app_context, xtAppContext_t)) + LispDestroy("%s: cannot convert %s to XtAppContext", + STRFUN(builtin), STROBJ(app_context)); + + return (INTEGER( + XtAppPending((XtAppContext)(app_context->data.opaque.data)))); } LispObj * -Lisp_XtAppProcessEvent(LispMac *mac, LispObj *list, char *fname) +Lisp_XtAppProcessEvent(LispBuiltin *builtin) +/* + xt-app-process-event app-context &optional mask + */ { XtInputMask mask; XtAppContext appcon; + + LispObj *app_context, *omask; + + omask = ARGUMENT(1); + app_context = ARGUMENT(0); + + if (!CHECKO(app_context, xtAppContext_t)) + LispDestroy("%s: cannot convert %s to XtAppContext", + STRFUN(builtin), STROBJ(app_context)); - if (!CHECKO(CAR(list), xtAppContext_t)) - LispDestroy(mac, - "cannot convert %s to XtAppContext, at %s", - LispStrObj(mac, CAR(list)), fname); - - appcon = (XtAppContext)(CAR(list)->data.opaque.data); - list = CDR(list); - if (list == NIL) + appcon = (XtAppContext)(app_context->data.opaque.data); + if (omask == UNSPEC) mask = XtIMAll; - else if (!INTEGER_P(CAR(list))) - LispDestroy(mac, "expecting XtInputMask, at %s", fname); - mask = NUMBER_VALUE(CAR(list)); - switch (mask) { - case 0: - break; - case XtIMXEvent: - case XtIMTimer: - case XtIMAlternateInput: - case XtIMSignal: - case XtIMAll: - XtAppProcessEvent(appcon, mask); - break; - default: - LispDestroy(mac, "bad XtInputMask, at %s", mask, fname); - break; + else { + CHECK_FIXNUM(omask); + mask = FIXNUM_VALUE(omask); } - return (NIL); + if (mask != (mask & XtIMAll)) + LispDestroy("%s: %d does not fit in XtInputMask %d", + STRFUN(builtin), mask); + + if (mask) + XtAppProcessEvent(appcon, mask); + + return (omask == NIL ? FIXNUM(mask) : omask); } LispObj * -Lisp_XtRealizeWidget(LispMac *mac, LispObj *list, char *fname) +Lisp_XtRealizeWidget(LispBuiltin *builtin) +/* + xt-realize-widget widget + */ { Widget widget; - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, - "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); + LispObj *owidget; - widget = (Widget)(CAR(list)->data.opaque.data); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); XtRealizeWidget(widget); if (XtIsSubclass(widget, shellWidgetClass)) { @@ -474,22 +679,61 @@ &delete_window, 1); } - return (NIL); + return (owidget); } LispObj * -Lisp_XtDestroyWidget(LispMac *mac, LispObj *list, char *fname) +Lisp_XtUnrealizeWidget(LispBuiltin *builtin) +/* + xt-unrealize-widget widget + */ { - Widget widget; + LispObj *widget; - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, - "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); + widget = ARGUMENT(0); - widget = (Widget)(CAR(list)->data.opaque.data); - XtDestroyWidget(widget); + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + XtUnrealizeWidget((Widget)(widget->data.opaque.data)); + + return (widget); +} + +LispObj * +Lisp_XtIsRealized(LispBuiltin *builtin) +/* + xt-is-realized widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + return (XtIsRealized((Widget)(widget->data.opaque.data)) ? T : NIL); +} + +LispObj * +Lisp_XtDestroyWidget(LispBuiltin *builtin) +/* + xt-destroy-widget widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + XtDestroyWidget((Widget)(widget->data.opaque.data)); + return (NIL); } @@ -497,60 +741,76 @@ #define MANAGED 1 #define SHELL 2 LispObj * -Lisp_XtCreateWidget(LispMac *mac, LispObj *list, char *fname) +Lisp_XtCreateWidget(LispBuiltin *builtin) +/* + xt-create-widget name widget-class parent &optional arguments + */ { - return (_LispXtCreateWidget(mac, list, fname, UNMANAGED)); + return (LispXtCreateWidget(builtin, UNMANAGED)); } LispObj * -Lisp_XtCreateManagedWidget(LispMac *mac, LispObj *list, char *fname) +Lisp_XtCreateManagedWidget(LispBuiltin *builtin) +/* + xt-create-managed-widget name widget-class parent &optional arguments + */ { - return (_LispXtCreateWidget(mac, list, fname, MANAGED)); + return (LispXtCreateWidget(builtin, MANAGED)); } LispObj * -Lisp_XtCreatePopupShell(LispMac *mac, LispObj *list, char *fname) +Lisp_XtCreatePopupShell(LispBuiltin *builtin) +/* + xt-create-popup-shell name widget-class parent &optional arguments + */ { - return (_LispXtCreateWidget(mac, list, fname, SHELL)); + return (LispXtCreateWidget(builtin, SHELL)); } LispObj * -_LispXtCreateWidget(LispMac *mac, LispObj *list, char *fname, int options) +LispXtCreateWidget(LispBuiltin *builtin, int options) +/* + xt-create-widget name widget-class parent &optional arguments + xt-create-managed-widget name widget-class parent &optional arguments + xt-create-popup-shell name widget-class parent &optional arguments + */ { char *name; WidgetClass widget_class; Widget widget, parent; Resources *resources = NULL; - if (CAR(list)->type != LispString_t) - LispDestroy(mac, "cannot convert %s to char*, at %s", - LispStrObj(mac, CAR(list)), fname); - name = STRPTR(CAR(list)); - list = CDR(list); - - if (!CHECKO(CAR(list), xtWidgetClass_t)) - LispDestroy(mac, "cannot convert %s to WidgetClass, at %s", - LispStrObj(mac, CAR(list)), fname); - widget_class = (WidgetClass)(CAR(list)->data.opaque.data); - list = CDR(list); - - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - parent = (Widget)(CAR(list)->data.opaque.data); - list = CDR(list); + LispObj *oname, *owidget_class, *oparent, *arguments; - if (options != SHELL) - widget = XtCreateWidget(name, widget_class, parent, NULL, 0); - else + arguments = ARGUMENT(3); + oparent = ARGUMENT(2); + owidget_class = ARGUMENT(1); + oname = ARGUMENT(0); + + CHECK_STRING(oname); + name = THESTR(oname); + + if (!CHECKO(owidget_class, xtWidgetClass_t)) + LispDestroy("%s: cannot convert %s to WidgetClass", + STRFUN(builtin), STROBJ(owidget_class)); + widget_class = (WidgetClass)(owidget_class->data.opaque.data); + + if (!CHECKO(oparent, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(oparent)); + parent = (Widget)(oparent->data.opaque.data); + + CHECK_LIST(arguments); + + if (options == SHELL) widget = XtCreatePopupShell(name, widget_class, parent, NULL, 0); + else + widget = XtCreateWidget(name, widget_class, parent, NULL, 0); - if (list == NIL || CAR(list) == NIL) + if (arguments == UNSPEC || arguments == NIL) resources = NULL; - else if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "expecting argument list, at %s", fname); else { - resources = LispConvertResources(mac, CAR(list), widget, + resources = LispConvertResources(arguments, widget, GetResourceList(widget_class), GetResourceList(XtClass(parent))); XtSetValues(widget, resources->args, resources->num_args); @@ -564,38 +824,63 @@ } LispObj * -Lisp_XtGetValues(LispMac *mac, LispObj *list, char *fname) +Lisp_XtGetKeyboardFocusWidget(LispBuiltin *builtin) +/* + xt-get-keyboard-focus-widget widget + */ { + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + return (OPAQUE(XtGetKeyboardFocusWidget((Widget)(widget->data.opaque.data)), + xtWidget_t)); +} + +LispObj * +Lisp_XtGetValues(LispBuiltin *builtin) +/* + xt-get-values widget arguments + */ +{ Arg args[1]; Widget widget; ResourceList *rlist, *plist; ResourceInfo *resource; - LispObj *obj, *res, *ptr; + LispObj *list, *object = NIL, *result, *cons = NIL; char c1; short c2; int c4; #ifdef LONG64 long c8; #endif + + LispObj *owidget, *arguments; + + arguments = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (arguments == NIL) + return (NIL); - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - widget = (Widget)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "expecting string list, at %s", fname); + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + CHECK_CONS(arguments); rlist = GetResourceList(XtClass(widget)); - plist = XtParent(widget) ? GetResourceList(XtClass(XtParent(widget))) : NULL; + plist = XtParent(widget) ? + GetResourceList(XtClass(XtParent(widget))) : NULL; - GCProtect(); - res = NIL; - for (list = CAR(list); list != NIL; list = CDR(list)) { - if (CAR(list)->type != LispString_t) - LispDestroy(mac, "%s is not a string, at %s", - LispStrObj(mac, CAR(list)), fname); - if ((resource = GetResourceInfo(STRPTR(CAR(list)), rlist, plist)) + GCDisable(); + result = NIL; + for (list = arguments; CONS_P(list); list = CDR(list)) { + CHECK_STRING(CAR(list)); + if ((resource = GetResourceInfo(THESTR(CAR(list)), rlist, plist)) == NULL) { int i; Widget child; @@ -608,7 +893,7 @@ XtGetValues(widget, args, 1); if (child && XtParent(child) == widget) { resource = - GetResourceInfo(STRPTR(CAR(list)), + GetResourceInfo(THESTR(CAR(list)), GetResourceList(XtClass(child)), NULL); if (resource) @@ -617,24 +902,24 @@ } } if (resource == NULL) { - fprintf(stderr, "resource %s not available.\n", - STRPTR(CAR(list))); + LispMessage("%s: resource %s not available", + STRFUN(builtin), THESTR(CAR(list))); continue; } } switch (resource->size) { case 1: - XtSetArg(args[0], STRPTR(CAR(list)), &c1); + XtSetArg(args[0], THESTR(CAR(list)), &c1); break; case 2: - XtSetArg(args[0], STRPTR(CAR(list)), &c2); + XtSetArg(args[0], THESTR(CAR(list)), &c2); break; case 4: - XtSetArg(args[0], STRPTR(CAR(list)), &c4); + XtSetArg(args[0], THESTR(CAR(list)), &c4); break; #ifdef LONG64 case 1: - XtSetArg(args[0], STRPTR(CAR(list)), &c8); + XtSetArg(args[0], THESTR(CAR(list)), &c8); break; #endif } @@ -643,120 +928,253 @@ /* special resources */ if (resource->qtype == qString) { #ifdef LONG64 - obj = CONS(CAR(list), STRING((char*)c8)); + object = CONS(CAR(list), STRING(c8)); #else - obj = CONS(CAR(list), STRING((char*)c4)); + object = CONS(CAR(list), STRING(c4)); #endif } else if (resource->qtype == qCardinal || resource->qtype == qInt) { #ifdef LONG64 if (sizeof(int) == 8) - obj = CONS(CAR(list), REAL(c8)); + object = CONS(CAR(list), INTEGER(c8)); else #endif - obj = CONS(CAR(list), REAL(c4)); + object = CONS(CAR(list), INTEGER(c4)); } else { switch (resource->size) { case 1: - obj = CONS(CAR(list), OPAQUE(c1, 0)); + object = CONS(CAR(list), OPAQUE(c1, 0)); break; case 2: - obj = CONS(CAR(list), OPAQUE(c2, 0)); + object = CONS(CAR(list), OPAQUE(c2, 0)); break; case 4: - obj = CONS(CAR(list), OPAQUE(c4, 0)); + object = CONS(CAR(list), OPAQUE(c4, 0)); break; #ifdef LONG64 case 8: - obj = CONS(CAR(list), OPAQUE(c8, 0)); + object = CONS(CAR(list), OPAQUE(c8, 0)); break; #endif } } - if (res == NIL) - res = ptr = CONS(obj, NIL); + if (result == NIL) + result = cons = CONS(object, NIL); else { - CDR(ptr) = CONS(obj, NIL); - ptr = CDR(ptr); + RPLACD(cons, CONS(object, NIL)); + cons = CDR(cons); } } - GCUProtect(); + GCEnable(); - return (res); + return (result); } LispObj * -Lisp_XtManageChild(LispMac *mac, LispObj *list, char *fname) +Lisp_XtManageChild(LispBuiltin *builtin) +/* + xt-manage-child widget + */ { - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - XtManageChild((Widget)(CAR(list)->data.opaque.data)); + LispObj *widget; - return (NIL); + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + XtManageChild((Widget)(widget->data.opaque.data)); + + return (widget); } LispObj * -Lisp_XtPopup(LispMac *mac, LispObj *list, char *fname) +Lisp_XtUnmanageChild(LispBuiltin *builtin) +/* + xt-unmanage-child widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + XtUnmanageChild((Widget)(widget->data.opaque.data)); + + return (widget); +} + +LispObj * +Lisp_XtMapWidget(LispBuiltin *builtin) +/* + xt-map-widget widget + */ { + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + XtMapWidget((Widget)(widget->data.opaque.data)); + + return (widget); +} + +LispObj * +Lisp_XtUnmapWidget(LispBuiltin *builtin) +/* + xt-unmap-widget widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + XtUnmapWidget((Widget)(widget->data.opaque.data)); + + return (widget); +} + +LispObj * +Lisp_XtSetMappedWhenManaged(LispBuiltin *builtin) +/* + xt-set-mapped-when-managed widget map-when-managed + */ +{ + LispObj *widget, *map_when_managed; + + map_when_managed = ARGUMENT(1); + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + XtSetMappedWhenManaged((Widget)(widget->data.opaque.data), + map_when_managed != NIL); + + return (map_when_managed); +} + +LispObj * +Lisp_XtPopup(LispBuiltin *builtin) +/* + xt-popup widget grab-kind + */ +{ XtGrabKind kind; + + LispObj *widget, *grab_kind; - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - if (CAR(CDR(list))->type != LispReal_t) - LispDestroy(mac, "cannot convert %s to XtGrabKind, at %s", - LispStrObj(mac, CAR(CDR(list))), fname); - kind = (XtGrabKind)(CAR(CDR(list))->data.real); + grab_kind = ARGUMENT(1); + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + CHECK_INDEX(grab_kind); + kind = (XtGrabKind)FIXNUM_VALUE(grab_kind); if (kind != XtGrabExclusive && kind != XtGrabNone && kind != XtGrabNonexclusive) - LispDestroy(mac, "cannot convert %d to XtGrabKind, at %s", - kind, fname); - XtPopup((Widget)(CAR(list)->data.opaque.data), kind); + LispDestroy("%s: %d does not fit in XtGrabKind", + STRFUN(builtin), kind); + XtPopup((Widget)(widget->data.opaque.data), kind); - return (NIL); + return (grab_kind); } LispObj * -Lisp_XtPopdown(LispMac *mac, LispObj *list, char *fname) +Lisp_XtPopdown(LispBuiltin *builtin) +/* + xt-popdown widget + */ { - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - XtPopdown((Widget)(CAR(list)->data.opaque.data)); + LispObj *widget; - return (NIL); + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + XtPopdown((Widget)(widget->data.opaque.data)); + + return (widget); +} + +LispObj * +Lisp_XtSetKeyboardFocus(LispBuiltin *builtin) +/* + xt-set-keyboard-focus widget descendant + */ +{ + LispObj *widget, *descendant; + + descendant = ARGUMENT(1); + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + if (!CHECKO(descendant, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(descendant)); + XtSetKeyboardFocus((Widget)(widget->data.opaque.data), + (Widget)(descendant->data.opaque.data)); + + return (widget); } LispObj * -Lisp_XtSetSensitive(LispMac *mac, LispObj *list, char *fname) +Lisp_XtSetSensitive(LispBuiltin *builtin) +/* + xt-set-sensitive widget sensitive + */ { - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - XtSetSensitive((Widget)(CAR(list)->data.opaque.data), - CAR(CDR(list)) != NIL); + LispObj *widget, *sensitive; - return (CAR(CDR(list)) == NIL ? NIL : T); + sensitive = ARGUMENT(1); + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + XtSetSensitive((Widget)(widget->data.opaque.data), sensitive != NIL); + + return (sensitive); } LispObj * -Lisp_XtSetValues(LispMac *mac, LispObj *list, char *fname) +Lisp_XtSetValues(LispBuiltin *builtin) +/* + xt-set-values widget arguments + */ { Widget widget; Resources *resources; + + LispObj *owidget, *arguments; - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - widget = (Widget)(CAR(list)->data.opaque.data); - list = CDR(list); - if (CAR(list)->type != LispCons_t) - LispDestroy(mac, "expecting string list, at %s", fname); + arguments = ARGUMENT(1); + owidget = ARGUMENT(0); - resources = LispConvertResources(mac, CAR(list), widget, + if (arguments == NIL) + return (owidget); + + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + CHECK_CONS(arguments); + resources = LispConvertResources(arguments, widget, GetResourceList(XtClass(widget)), XtParent(widget) ? GetResourceList(XtClass(XtParent(widget))) : @@ -764,26 +1182,282 @@ XtSetValues(widget, resources->args, resources->num_args); LispFreeResources(resources); - return (NIL); + return (owidget); } LispObj * -Lisp_XtWidgetToApplicationContext(LispMac *mac, LispObj *list, char *fname) +Lisp_XtWidgetToApplicationContext(LispBuiltin *builtin) +/* + xt-widget-to-application-context widget + */ { Widget widget; XtAppContext appcon; + + LispObj *owidget; + + owidget = ARGUMENT(0); - if (!CHECKO(CAR(list), xtWidget_t)) - LispDestroy(mac, "cannot convert %s to Widget, at %s", - LispStrObj(mac, CAR(list)), fname); - widget = (Widget)(CAR(list)->data.opaque.data); + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); appcon = XtWidgetToApplicationContext(widget); return (OPAQUE(appcon, xtAppContext_t)); } +LispObj * +Lisp_XtDisplay(LispBuiltin *builtin) +/* + xt-display widget + */ +{ + Widget widget; + Display *display; + + LispObj *owidget; + + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + display = XtDisplay(widget); + + return (OPAQUE(display, xtDisplay_t)); +} + +LispObj * +Lisp_XtDisplayOfObject(LispBuiltin *builtin) +/* + xt-display-of-object object + */ +{ + Widget widget; + Display *display; + + LispObj *object; + + object = ARGUMENT(0); + + if (!CHECKO(object, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(object)); + widget = (Widget)(object->data.opaque.data); + display = XtDisplayOfObject(widget); + + return (OPAQUE(display, xtDisplay_t)); +} + +LispObj * +Lisp_XtScreen(LispBuiltin *builtin) +/* + xt-screen widget + */ +{ + Widget widget; + Screen *screen; + + LispObj *owidget; + + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + screen = XtScreen(widget); + + return (OPAQUE(screen, xtScreen_t)); +} + +LispObj * +Lisp_XtScreenOfObject(LispBuiltin *builtin) +/* + xt-screen-of-object object + */ +{ + Widget widget; + Screen *screen; + + LispObj *object; + + object = ARGUMENT(0); + + if (!CHECKO(object, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(object)); + widget = (Widget)(object->data.opaque.data); + screen = XtScreenOfObject(widget); + + return (OPAQUE(screen, xtScreen_t)); +} + +LispObj * +Lisp_XtWindow(LispBuiltin *builtin) +/* + xt-window widget + */ +{ + Widget widget; + Window window; + + LispObj *owidget; + + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + window = XtWindow(widget); + + return (OPAQUE(window, xtWindow_t)); +} + +LispObj * +Lisp_XtWindowOfObject(LispBuiltin *builtin) +/* + xt-window-of-object widget + */ +{ + Widget widget; + Window window; + + LispObj *object; + + object = ARGUMENT(0); + + if (!CHECKO(object, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(object)); + widget = (Widget)(object->data.opaque.data); + window = XtWindowOfObject(widget); + + return (OPAQUE(window, xtWindow_t)); +} + +LispObj * +Lisp_XtAddGrab(LispBuiltin *builtin) +/* + xt-add-grab widget exclusive spring-loaded + */ +{ + Widget widget; + Bool exclusive, spring_loaded; + + LispObj *owidget, *oexclusive, *ospring_loaded; + + ospring_loaded = ARGUMENT(2); + oexclusive = ARGUMENT(1); + owidget = ARGUMENT(0); + + if (!CHECKO(owidget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(owidget)); + widget = (Widget)(owidget->data.opaque.data); + exclusive = oexclusive != NIL; + spring_loaded = ospring_loaded != NIL; + + XtAddGrab(widget, exclusive, spring_loaded); + + return (T); +} + +LispObj * +Lisp_XtRemoveGrab(LispBuiltin *builtin) +/* + xt-remove-grab widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + XtRemoveGrab((Widget)(widget->data.opaque.data)); + + return (NIL); +} + +LispObj * +Lisp_XtName(LispBuiltin *builtin) +/* + xt-name widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + return (STRING(XtName((Widget)(widget->data.opaque.data)))); +} + +LispObj * +Lisp_XtParent(LispBuiltin *builtin) +/* + xt-parent widget + */ +{ + LispObj *widget; + + widget = ARGUMENT(0); + + if (!CHECKO(widget, xtWidget_t)) + LispDestroy("%s: cannot convert %s to Widget", + STRFUN(builtin), STROBJ(widget)); + + return (OPAQUE(XtParent((Widget)widget->data.opaque.data), xtWidget_t)); +} + +LispObj * +Lisp_XtAppGetExitFlag(LispBuiltin *builtin) +/* + xt-app-get-exit-flag app-context + */ +{ + LispObj *app_context; + + app_context = ARGUMENT(0); + + if (!CHECKO(app_context, xtAppContext_t)) + LispDestroy("%s: cannot convert %s to XtAppContext", + STRFUN(builtin), STROBJ(app_context)); + + return (XtAppGetExitFlag((XtAppContext)(app_context->data.opaque.data)) ? + T : NIL); +} + +LispObj * +Lisp_XtAppSetExitFlag(LispBuiltin *builtin) +/* + xt-app-get-exit-flag app-context + */ +{ + LispObj *app_context; + + app_context = ARGUMENT(0); + + if (!CHECKO(app_context, xtAppContext_t)) + LispDestroy("%s: cannot convert %s to XtAppContext", + STRFUN(builtin), STROBJ(app_context)); + + XtAppSetExitFlag((XtAppContext)(app_context->data.opaque.data)); + + return (T); +} + static Resources * -LispConvertResources(LispMac *mac, LispObj *list, Widget widget, +LispConvertResources(LispObj *list, Widget widget, ResourceList *rlist, ResourceList *plist) { char c1; @@ -795,23 +1469,23 @@ XrmValue from, to; LispObj *arg, *val; ResourceInfo *resource; - char *fname = "XT-INTERNAL:CONVERT-RESOURCES"; + char *fname = "XT-CONVERT-RESOURCES"; Resources *resources = (Resources*)XtCalloc(1, sizeof(Resources)); - for (; list != NIL; list = CDR(list)) { - if (list->type != LispCons_t || CAR(list)->type != LispCons_t) { + for (; CONSP(list); list = CDR(list)) { + if (!CONSP(CAR(list))) { XtFree((XtPointer)resources); - LispDestroy(mac, "expecting cons, at %s", fname); + LispDestroy("%s: %s is not a cons", fname, STROBJ(CAR(list))); } arg = CAR(CAR(list)); val = CDR(CAR(list)); - if (arg->type != LispString_t) { + if (!STRINGP(arg)) { XtFree((XtPointer)resources); - LispDestroy(mac, "resource name must be a string, at %s", fname); + LispDestroy("%s: %s is not a string", fname, STROBJ(arg)); } - if ((resource = GetResourceInfo(STRPTR(arg), rlist, plist)) == NULL) { + if ((resource = GetResourceInfo(THESTR(arg), rlist, plist)) == NULL) { int i; Arg args[1]; Widget child; @@ -824,7 +1498,7 @@ XtGetValues(widget, args, 1); if (child && XtParent(child) == widget) { resource = - GetResourceInfo(STRPTR(arg), + GetResourceInfo(THESTR(arg), GetResourceList(XtClass(child)), NULL); if (resource) @@ -833,33 +1507,74 @@ } } if (resource == NULL) { - fprintf(stderr, "resource %s not available.\n", STRPTR(arg)); + LispMessage("%s: resource %s not available", + fname, THESTR(arg)); continue; } } - if (val->type == LispReal_t || val->type == LispOpaque_t) { + if (LONGINTP(val) || DFLOATP(val) || OPAQUEP(val)) { resources->args = (Arg*) XtRealloc((XtPointer)resources->args, sizeof(Arg) * (resources->num_args + 1)); - if (val->type == LispReal_t) - XtSetArg(resources->args[resources->num_args], - XrmQuarkToString(resource->qname), (int)val->data.real); + if (!OPAQUEP(val)) { + float fvalue; + + if (DFLOATP(val)) + fvalue = DFLOAT_VALUE(val); + else + fvalue = LONGINT_VALUE(val); + if (resource->qtype == qFloat) { + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), fvalue); + } + else + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), + (int)fvalue); + } else XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), val->data.opaque.data); ++resources->num_args; continue; + } + else if (val == NIL) { + /* XXX assume it is a pointer or a boolean */ +#ifdef DEBUG + LispWarning("%s: assuming %s is a pointer or boolean", + fname, XrmQuarkToString(resource->qname)); +#endif + resources->args = (Arg*) + XtRealloc((XtPointer)resources->args, + sizeof(Arg) * (resources->num_args + 1)); + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), NULL); + ++resources->num_args; + continue; + } + else if (val == T) { + /* XXX assume it is a boolean */ +#ifdef DEBUG + LispWarning("%s: assuming %s is a boolean", + fname, XrmQuarkToString(resource->qname)); +#endif + resources->args = (Arg*) + XtRealloc((XtPointer)resources->args, + sizeof(Arg) * (resources->num_args + 1)); + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), True); + ++resources->num_args; + continue; } - else if (val->type != LispString_t) { + else if (!STRINGP(val)) { XtFree((XtPointer)resources); - LispDestroy(mac, - "resource value must be string, number or opaque, not %s at %s", - LispStrObj(mac, val), fname); + LispDestroy("%s: resource value must be string, number or opaque, not %s", + fname, STROBJ(val)); } - from.size = val == NIL ? 1 : strlen(STRPTR(val)) + 1; - from.addr = val == NIL ? "" : STRPTR(val); + from.size = val == NIL ? 1 : strlen(THESTR(val)) + 1; + from.addr = val == NIL ? "" : THESTR(val); switch (to.size = resource->size) { case 1: to.addr = (XtPointer)&c1; @@ -876,8 +1591,8 @@ break; #endif default: - fprintf(stderr, "bad resource size %d, for %s.\n", - to.size, STRPTR(arg)); + LispWarning("%s: bad resource size %d for %s", + fname, to.size, THESTR(arg)); continue; } @@ -1078,5 +1793,5 @@ static void QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { - exit(0); + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); } Index: xc/programs/xedit/lisp/modules/progmodes/c.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/c.lsp:1.26 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/progmodes/c.lsp Tue Jan 28 22:05:54 2003 @@ -0,0 +1,1118 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/c.lsp,v 1.26 2003/01/29 03:05:54 paulo Exp $ +;; + +(require "syntax") +(require "indent") +(in-package "XEDIT") + +(defsynprop *prop-format* + "format" + :font "*lucidatypewriter-medium-r*12*" + :foreground "RoyalBlue2" + :underline t +) + +(defsynoptions *c-DEFAULT-style* + ;; Positive number. Basic indentation. + (:indentation . 4) + + ;; Boolean. Support for GNU style indentation. + (:brace-indent . nil) + + ;; Boolean. Add one indentation level to case and default? + (:case-indent . t) + + ;; Boolean. Remove one indentation level for labels? + (:label-dedent . t) + + ;; Boolean. Add one indentation level to continuations? + (:cont-indent . t) + + ;; Boolean. Move cursor to the indent column after pressing <Enter>? + (:newline-indent . t) + + ;; Boolean. Set to T if tabs shouldn't be used to fill indentation. + (:emulate-tabs . nil) + + ;; Boolean. Force a newline before braces? + (:newline-before-brace . nil) + + ;; Boolean. Force a newline after braces? + (:newline-after-brace . nil) + + ;; Boolean. Force a newline after semicolons? + (:newline-after-semi . nil) + + ;; Boolean. Only calculate indentation after pressing <Enter>? + ;; This may be useful if the parser does not always + ;; do what the user expects... + (:only-newline-indent . nil) + + ;; Boolean. Remove extra spaces from previous line. + ;; This should default to T when newline-indent is not NIL. + (:trim-blank-lines . t) + + ;; Boolean. If this hash-table entry is set, no indentation is done. + ;; Useful to temporarily disable indentation. + (:disable-indent . nil) +) + +;; BSD like style +(defsynoptions *c-BSD-style* + (:indentation . 8) + (:brace-indent . nil) + (:case-indent . nil) + (:label-dedent . t) + (:cont-indent . t) + (:newline-indent . t) + (:emulate-tabs . nil) + (:newline-before-brace . nil) + (:newline-after-brace . t) + (:newline-after-semi . t) + (:trim-blank-lines . t) +) + +;; GNU like style +(defsynoptions *c-GNU-style* + (:indentation . 2) + (:brace-indent . t) + (:case-indent . nil) + (:label-dedent . t) + (:cont-indent . t) + (:newline-indent . nil) + (:emulate-tabs . nil) + (:newline-before-brace . t) + (:newline-after-brace . t) + (:newline-after-semi . t) + (:trim-blank-lines . nil) +) + +;; K&R like style +(defsynoptions *c-K&R-style* + (:indentation . 5) + (:brace-indent . nil) + (:case-indent . nil) + (:label-dedent . t) + (:cont-indent . t) + (:newline-indent . t) + (:emulate-tabs . t) + (:newline-before-brace . t) + (:newline-after-brace . t) + (:newline-after-semi . t) + (:trim-blank-lines . t) +) + +(defvar *c-styles* '( + ("xedit" . *c-DEFAULT-style*) + ("BSD" . *c-BSD-style*) + ("GNU" . *c-GNU-style*) + ("K&R" . *c-K&R-style*) +)) + +(defvar *c-mode-options* *c-DEFAULT-style*) +; (setq *c-mode-options* *c-gnu-style*) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; This is a very lazy "pattern matcher" for the C language. +;; If the syntax in the code is not correct, it may get confused, and +;; because it is "lazy" some wrong constructs will be recognized as +;; correct when reducing patterns. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defindent *c-mode-indent* :main + ;; this must be the first token + (indtoken "^\\s*" :start-of-line) + (indtoken "\\<case\\>" :c-case) + (indtoken "\\<default\\>" :c-default) + (indtoken "\\<do\\>" :do) + (indtoken "\\<if\\>" :c-if) + (indtoken "\\<else\\>" :c-else) + (indtoken "\\<for\\>" :c-for) + (indtoken "\\<switch\\>" :c-switch) + (indtoken "\\<while\\>" :c-while) + ;; Match identifiers and numbers as an expression + (indtoken "\\w+" :expression) + (indtoken ";" :semi :nospec t) + (indtoken "," :comma :nospec t) + (indtoken ":" :collon :nospec t) + ;; Ignore spaces before collon, this avoids dedenting ternary + ;; and bitfield definitions as the parser does not distinguish + ;; labels from those, another option would be to use the pattern + ;; "\\w+:", but this way should properly handle labels generated + ;; by macros, example: `MACRO_LABEL(value):' + (indtoken "\\s+:" nil) + + (indinit (c-braces 0)) + (indtoken "{" + :obrace + :nospec t + :code (decf c-braces) + ) + (indtoken "}" + :cbrace + :nospec t + :begin :braces + :code (incf c-braces) + ) + (indtable :braces + (indtoken "{" + :obrace + :nospec t + :switch -1 + :code (decf c-braces) + ) + (indtoken "}" + :cbrace + :nospec t + :begin :braces + :code (incf c-braces) + ) + ) + + (indinit (c-bra 0)) + (indtoken ")" :cparen :nospec t :code (incf c-bra)) + (indtoken "(" :oparen :nospec t :code (decf c-bra)) + (indtoken "]" :cbrack :nospec t :code (incf c-bra)) + (indtoken "[" :obrack :nospec t :code (decf c-bra)) + (indtoken "\\\\$" :continuation) + + ;; C++ style comment, disallow other tokens to match inside comment + (indtoken "//.*$" nil) + + (indtoken "#" :hash :nospec t) + + ;; if in the same line, reduce now, this must be done because the + ;; delimiters are identical + (indtoken "'([^\\']|\\\\.)*'" :expression) + (indtoken "\"([^\\\"]|\\\\.)*\"" :expression) + + (indtoken "\"" :cstring :nospec t :begin :string) + + (indtoken "'" :cconstant :nospec t :begin :constant) + + (indtoken "*/" :ccomment :nospec t :begin :comment) + ;; this must be the last token + (indtoken "$" :end-of-line) + + (indtable :string + ;; Ignore escaped characters + (indtoken "\\." nil) + ;; Return to the toplevel when the start of the string is found + (indtoken "\"" :ostring :nospec t :switch -1) + ) + (indtable :constant + ;; Ignore escaped characters + (indtoken "\\." nil) + ;; Return to the toplevel when the start of the character is found + (indtoken "'" :oconstant :nospec t :switch -1) + ) + (indtable :comment + (indtoken "/*" :ocomment :nospec t :switch -1) + ) + + ;; "Complex" statements + (indinit (c-complex 0) (c-cases 0)) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Order of reduce rules here is important, process comment, + ;; continuations, preprocessor and set states when an eol is found. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + (indinit (c-offset (point-max)) + (c-prev-offset c-offset) + ) + (indreduce :indent + t + ((:start-of-line)) + (and (= *ind-start* *ind-offset*) + (setq + *offset* (+ *ind-offset* *ind-length*) + ) + ) + (setq + c-prev-offset c-offset + c-offset *ind-offset* + ) + ) + + ;; Delete comments + (indreduce nil + t + ((:ocomment nil :ccomment)) + ) + + ;; Join in a single token to simplify removal of possible multiline + ;; preprocessor directives + (indinit c-continuation) + (indreduce :continuation + t + ((:continuation :end-of-line)) + (setq c-continuation t) + ) + + (indreduce :eol + t + ((:end-of-line)) + ;; Anything after the eol offset is safe to parse now + (setq c-continuation nil) + ) + + ;; Delete blank lines + (indreduce nil + t + ((:indent :eol)) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Preprocessor + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce nil + (>= *ind-offset* *ind-start*) + ((:indent :hash)) + (setq *indent* 0) + (indent-macro-reject-left) + ) + (indreduce nil + t + ((:indent :hash nil :eol)) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Expressions + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce :expression + t + ;; Reduce to a single expression + ((:expression :parens) + (:expression :bracks) + (:expression :expression) + ;; These may be multiline + (:ostring (not :ostring) :cstring) + (:oconstant (not :oconstant) :cconstant) + ) + ) + + (indreduce :expression + t + ((:expression :eol :indent :expression) + (:expression :eol :expression) + ) + ) + + (indreduce :exp-comma + t + ((:expression :comma) + ) + ) + + ;; A semicollon, start a statement + (indreduce :stat + t + ((:semi)) + ) + + ;; Expression following (possibly empty) statement + (indreduce :stat + t + (((or :expression :exp-comma) :stat)) + ) + + ;; Multiline statements + (indreduce :stat + t + (((or :expression :exp-comma) :eol :indent :stat) + ;; rule below may have removed the :indent + ((or :expression :exp-comma) :eol :stat) + ) + ) + + (indinit c-exp-indent) + ;; XXX This rule avoids parsing large amounts of code + (indreduce :stat + t + ;; Eat eol if following expression + ((:indent :stat :eol) + (:indent :stat) + ) + (if + (or + (null c-exp-indent) + (/= (cdar c-exp-indent) (+ *ind-offset* *ind-length*)) + ) + ;; A new statement, i.e. not just joining a multiline one + (push + (cons + (offset-indentation *ind-offset* :resolve t) + (+ *ind-offset* *ind-length*) + ) + c-exp-indent + ) + ;; Update start of statement + (rplaca + (car c-exp-indent) + (offset-indentation *ind-offset* :resolve t) + ) + ) + (when (consp (cdr c-exp-indent)) + (if (and + (zerop c-complex) + (zerop c-cases) + (zerop c-bra) + (= (caar c-exp-indent) (caadr c-exp-indent)) + ) + ;; Two statements with the same indentation + (progn + (setq *indent* (caar c-exp-indent)) + (indent-macro-reject-left) + ) + ;; Different indentation or complex state + (progn + (rplacd c-exp-indent nil) + (setq c-complex 0) + ) + ) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Handle braces + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce :stat + ;; If block finishes before current line, group as a statement + (< (+ *ind-offset* *ind-length*) *ind-start*) + ((:obrace (not :obrace) :cbrace)) + ) + (indreduce :obrace + ;; If not in the first line + (< *ind-offset* *ind-start*) + ;; If the opening { is the first non blank char in the line + ((:indent :obrace)) + (setq *indent* (offset-indentation (+ *ind-offset* *ind-length*))) + + ;; XXX This may be the starting brace of a switch + (setq c-case-flag nil) + (indent-macro-reject-left) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Labels + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; XXX this frequently doesn't do what is expected, should redefine + ;; some rules, as it frequently will dedent while typing something + ;; like test ? exp1 : exp2 + ;; ^ dedents here because it reduces everything + ;; before ':' to a single :expression token. + (indreduce :label + t + ((:indent :expression :collon :eol)) + (when (and *label-dedent* (>= *ind-offset* *ind-start*)) + (setq + *indent* + (- (offset-indentation *ind-offset* :resolve t) *base-indent*) + ) + (indent-macro-reject-left) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Handle if + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce :if + t + ((:c-if :parens) + ) + (incf c-complex) + ) + + (indreduce :else + t + ((:c-else)) + (incf c-complex) + ) + + ;; Join + (indreduce :else-if + t + ((:else :if) + (:else :eol :indent :if) + ) + (incf c-complex) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Handle for + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Join with the parentheses + (indreduce :for + t + ((:c-for :parens) + ) + (incf c-complex) + ) + ;; Before current line, simplify + (indreduce :stat + (< (+ *ind-offset* *ind-length*) *ind-point*) + ((:for :stat) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Handle while and do + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce :while + t + ((:c-while :parens) + ;; Assume that it is yet being edited, or adjusting indentation + (:c-while) + ) + (incf c-complex) + ) + (indreduce :stat + t + ((:do :stat :while) + (:while :stat) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Handle switch + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indinit c-case-flag) + + (indreduce :switch + t + ((:c-switch :parens) + ) + ) + ;; Transform in a statement + (indreduce :stat + (< (+ *ind-offset* *ind-length*) *ind-start*) + ((:switch :stat) + ;; Do it now or some rule may stop parsing, and calculate + ;; a wrong indentation for nested switches + (:switch :eol :indent :stat) + ) + ) + ;; An open switch + (indreduce :obrace + (and + (<= c-braces 0) + (> *ind-start* *ind-offset*) + ) + ((:indent :switch :obrace) + ) + (setq + *indent* (offset-indentation *ind-offset* :resolve t) + c-case-flag nil + ) + (indent-macro-reject-left) + ) + (indreduce :obrace + (and + (<= c-braces 0) + (> *ind-start* *ind-offset*) + ) + ((:indent :switch :eol :indent :obrace) + ) + (setq + *indent* (- (offset-indentation *ind-offset* :resolve t) *base-indent*) + c-case-flag nil + ) + (and *brace-indent* (incf *indent* *base-indent*)) + (indent-macro-reject-left) + ) + ;; Before current line + (indreduce :case + (and + (or + (not *case-indent*) + (prog1 c-case-flag (setq c-case-flag t)) + ) + (<= c-braces 0) + (< *ind-offset* *ind-start*) + ) + ((:indent :case) + ) + (setq + *indent* (offset-indentation *ind-offset* :resolve t) + c-case-flag nil + ) + (indent-macro-reject-left) + ) + (indreduce :case + t + ((:c-case :expression :collon) + (:c-default :collon) + ;; Assume that it is yet being edited, or adjusting indentation + (:c-case) + (:c-default) + ) + (and (>= *ind-offset* *ind-start*) + (incf c-cases) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Handle parentheses and brackets + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Reduce matches + (indreduce :parens + t + ((:oparen (not :oparen) :cparen)) + (when + (and + (< *ind-offset* *ind-start*) + (> (+ *ind-offset* *ind-length*) *ind-start*) + ) + (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) + (indent-macro-reject-left) + ) + ) + (indreduce :bracks + t + ((:obrack (not :obrack) :cbrack)) + (when + (and + (< *ind-offset* *ind-start*) + (> (+ *ind-offset* *ind-length*) *ind-start*) + ) + (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) + (indent-macro-reject-left) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Assuming previous lines have correct indentation, this allows + ;; resolving the indentation fastly + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Line ended with an open brace + (indreduce :obrace + (< *ind-offset* *ind-start*) + ((:indent (or :for :while :if :else-if :else :do) :obrace) + ) + (setq *indent* (offset-indentation *ind-offset* :resolve t)) + (indent-macro-reject-left) + ) + ;; Adjust indentation level if current line starts with an open brace + (indreduce nil + (< *ind-offset* *ind-start* (+ *ind-offset* *ind-length*)) + ;; Just set initial indentation + ((:indent (or :for :while :if :else-if :else :do) :eol :indent :obrace) + ) + (setq + *indent* + (- (offset-indentation *ind-offset* :resolve t) *base-indent*) + ) + (and *brace-indent* (incf *indent* *base-indent*)) + (indent-macro-reject-left) + ) + ;; Previous rule failed, current line does not start with an open brace + (indreduce :flow + ;; first statement is in current line + (and + (<= c-braces 0) + (> (+ *ind-offset* *ind-length*) *ind-start* *ind-offset*) + ) + ((:indent (or :for :while :if :else-if :else :do) :eol :indent) + ) + (setq *indent* (offset-indentation *ind-offset* :resolve t)) + (indent-macro-reject-left) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Simplify, remove old (:eol :indent) + ;; This must be the last rule, to avoid not matching the + ;; rules for fast calculation of indentation above + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce nil + (> *ind-offset* c-prev-offset) + ((:eol :indent)) + ) + + + (indinit (c-flow 0)) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; If + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indinit c-if-flow) + (indresolve :if + (and (< *ind-offset* *ind-start*) + (push c-flow c-if-flow) + (incf *indent* *base-indent*) + (incf c-flow) + ) + ) + (indresolve (:else-if :else) + (when c-if-flow + (while (< c-flow (car c-if-flow)) + (incf *indent* *base-indent*) + (incf c-flow) + ) + (or (eq *ind-token* :else-if) (pop c-if-flow)) + ) + (and (< *ind-offset* *ind-start*) + (incf *indent* *base-indent*) + (incf c-flow) + ) + ) + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; For/while/do + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indinit c-do-flow) + (indresolve (:for :while :do) + (if (eq *ind-token* :do) + (and (< *ind-offset* *ind-start*) (push c-flow c-do-flow)) + (when (and c-do-flow (eq *ind-token* :while)) + (while (< c-flow (car c-do-flow)) + (incf *indent* *base-indent*) + (incf c-flow) + ) + (pop c-do-flow) + ) + ) + (and (< *ind-offset* *ind-start*) + (incf *indent* *base-indent*) + (incf c-flow) + ) + ) + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Switch + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indresolve :switch + (setq c-case-flag nil) + ) + (indresolve (:case :c-case) + (if (< *ind-offset* *ind-start*) + (or c-case-flag + (setq + *indent* + (+ (offset-indentation *ind-offset* :resolve t) + *base-indent* + ) + ) + ) + (if c-case-flag + (and (= (decf c-cases) 0) + (decf *indent* *base-indent*) + ) + (or *case-indent* + (decf *indent* *base-indent*) + ) + ) + ) + (setq c-case-flag t) + ) + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Braces/flow control + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indresolve :flow + (incf *indent* *base-indent*) + ) + (indresolve :obrace + (and (< *ind-offset* *ind-start*) + (incf *indent* *base-indent*) + ) + ) + (indresolve :cbrace + (decf *indent* *base-indent*) + (and *case-indent* c-case-flag + (decf *indent* *base-indent*) + (setq c-case-flag nil) + ) + (and (not *offset*) (>= *ind-offset* *ind-start*) + (setq *offset* *ind-offset*) + ) + ) + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Statements + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indresolve :stat + (when (< *ind-offset* *ind-start*) + (while (> c-flow 0) + (setq + *indent* (- *indent* *base-indent*) + c-flow (1- c-flow) + ) + ) + ) + (and + *cont-indent* + (< *ind-offset* *ind-start*) + (> (+ *ind-offset* *ind-length*) *ind-start*) + (incf *indent* *base-indent*) + ) + ) + + (indresolve :expression + (and + *cont-indent* + (zerop c-bra) + (> *indent* 0) + (< *ind-offset* *ind-start*) + (> (+ *ind-offset* *ind-length*) *ind-start*) + (incf *indent* *base-indent*) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Open + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indresolve (:oparen :obrack) + (and (< *ind-offset* *ind-start*) + (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) + ) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Find a "good" offset to start parsing backwards, so that it should +;; always generate the same results. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun c-offset-indent (&aux char (point (point))) + ;; Skip spaces forward + (while (member (setq char (char-after point)) indent-spaces) + (incf point) + ) + (or (characterp char) (return-from c-offset-indent point)) + + ;; Skip word chars + (when (alphanumericp char) + (while (and (setq char (char-after point)) (alphanumericp char)) + (incf point) + ) + (or (characterp char) (return-from c-offset-indent point)) + + ;; Skip spaces forward + (while (member (setq char (char-after point)) indent-spaces) + (incf point) + ) + (or (characterp char) (return-from c-offset-indent point)) + ) + + ;; don't include " or ' to avoid parsing strings "inverted" + (if (member char '(#\Newline #\" #\')) point (1+ point)) +) +(compile 'c-offset-indent) + +(defun c-should-indent (options) + (when (hash-table-p options) + ;; check if previous line has extra spaces + (and (gethash :trim-blank-lines options) + (indent-clear-empty-line) + ) + + ;; indentation disabled? + (and (gethash :disable-indent options) + (return-from c-should-indent) + ) + + (let* + ( + (point (point)) + (start (scan point :eol :left)) + (char (char-before point)) + offset + match + text + ) + + ;; at the start of an empty file + (or (characterp char) + (return-from c-should-indent) + ) + + ;; if at bol and should indent only when starting a line + (and (gethash :only-newline-indent options) + (return-from c-should-indent (= point start)) + ) + + (and + (char= char #\;) + (gethash :newline-after-semi options) + (return-from c-should-indent t) + ) + + ;; if one of these was typed, must check indentation + (and (member char '(#\{ #\} #\: #\] #\) #\#)) + (return-from c-should-indent t) + ) + + ;; at the start of a line + (and (= point start) + (return-from c-should-indent (gethash :newline-indent options)) + ) + + ;; if first character + (and (= point (1+ start)) + (return-from c-should-indent t) + ) + + ;; check if is the first non-blank character in a new line + (when + (and + (gethash :cont-indent options) + (= point (scan point :eol :right)) + (alphanumericp char) + ) + (setq offset (1- point)) + (while + (and + (> offset start) + (member (char-before offset) indent-spaces) + ) + (decf offset) + ) + ;; line has only one character with possible spaces before it + (and (<= offset start) + (return-from c-should-indent t) + ) + ) + + ;; check for keywords that change indentation + (when (alphanumericp char) + (setq offset (1- point)) + (while + (and + (alphanumericp (char-before offset)) + (> offset start) + ) + (decf offset) + ) + (setq + text (read-text offset (- point offset)) + match (re-exec #.(re-comp "(case|else|while)\\w?\\>") + text) + ) + (and + (consp match) + (return-from c-should-indent (<= (- (caar match) offset) 2)) + ) + ) + ) + ) + ;; Should not indent + nil +) +(compile 'c-should-indent) + + +(defun c-indent-check (syntax syntable options + &aux start point char left brace change) + (setq + point (point) + char (char-before point) + left point + brace (member char '(#\{ #\})) + ) + + (when + (and brace (gethash :newline-before-brace options)) + (setq start (scan point :eol :left)) + (while + (and + (> (decf left) start) + (member (char-before left) indent-spaces) + ) + ;; skip blanks + ) + (when (> left start) + (replace-text left left (string #\Newline)) + (c-indent syntax syntable) + (setq change t) + ) + ) + + (when + (or + (and brace (not change) (gethash :newline-after-brace options)) + (and (char= char #\;) (gethash :newline-after-semi options)) + ) + (setq left (point)) + (replace-text left left (string #\Newline)) + (goto-char (1+ left)) + (c-indent syntax syntable) + ) +) + +(defun c-indent (syntax syntable) + (let* + ( + (options (syntax-options syntax)) + *base-indent* + *brace-indent* + *case-indent* + *label-dedent* + *cont-indent* + ) + + (or (c-should-indent options) (return-from c-indent)) + + (setq + *base-indent* (gethash :indentation options 4) + *brace-indent* (gethash :brace-indent options nil) + *case-indent* (gethash :case-indent options t) + *label-dedent* (gethash :label-dedent options t) + *cont-indent* (gethash :cont-indent options t) + ) + + (indent-macro + *c-mode-indent* + (c-offset-indent) + (gethash :emulate-tabs options) + ) + + (c-indent-check syntax syntable options) + ) +) +(compile 'c-indent) + +(defsyntax *c-mode* :main nil #'c-indent *c-mode-options* + ;; All recognized C keywords. + (syntoken + (string-concat + "\\<(" + "asm|auto|break|case|catch|char|class|const|continue|default|" + "delete|do|double|else|enum|extern|float|for|friend|goto|if|" + "inline|int|long|new|operator|private|protected|public|register|" + "return|short|signed|sizeof|static|struct|switch|template|this|" + "throw|try|typedef|union|unsigned|virtual|void|volatile|while" + ")\\>") + :property *prop-keyword*) + + ;; Numbers, this is optional, comment this rule if xedit is + ;; too slow to load c files. + (syntoken + (string-concat + "\\<(" + ;; Integers + "(\\d+|0x\\x+)(u|ul|ull|l|ll|lu|llu)?|" + ;; Floats + "\\d+\\.?\\d*(e[+-]?\\d+)?[lf]?" + ")\\>") + :icase t + :property *prop-number* + ) + + ;; String start rule. + (syntoken "\"" :nospec t :begin :string :contained t) + + ;; Character start rule. + (syntoken "'" :nospec t :begin :character :contained t) + + ;; Preprocessor start rule. + (syntoken "^\\s*#\\s*\\w+" :begin :preprocessor :contained t) + + ;; Comment start rule. + (syntoken "/*" :nospec t :begin :comment :contained t) + + ;; C++ style comments. + (syntoken "//.*" :property *prop-comment*) + + ;; Punctuation, this is also optional, comment this rule if xedit is + ;; too slow to load c files. + (syntoken "[][(){}/*+:;=<>,&.!%|^~?-][][(){}*+:;=<>,&.!%|^~?-]?" + :property *prop-punctuation*) + + + ;; Rules for comments. + (syntable :comment *prop-comment* #'default-indent + ;; Match nested comments as an error. + (syntoken "/*" :nospec t :property *prop-error*) + + (syntoken "XXX|TODO|FIXME" :property *prop-annotation*) + + ;; Rule to finish a comment. + (syntoken "*/" :nospec t :switch -1) + ) + + ;; Rules for strings. + (syntable :string *prop-string* #'default-indent + ;; Ignore escaped characters, this includes \". + (syntoken "\\\\.") + + ;; Match, most, printf arguments. + (syntoken "%%|%([+-]?\\d+)?(l?[deEfgiouxX]|[cdeEfgiopsuxX])" + :property *prop-format*) + + ;; Ignore continuation in the next line. + (syntoken "\\\\$") + + ;; Rule to finish a string. + (syntoken "\"" :nospec t :switch -1) + + ;; Don't allow strings continuing in the next line. + (syntoken ".?$" :begin :error) + ) + + ;; Rules for characters. + (syntable :character *prop-constant* nil + ;; Ignore escaped characters, this includes \'. + (syntoken "\\\\.") + + ;; Ignore continuation in the next line. + (syntoken "\\\\$") + + ;; Rule to finish a character constant. + (syntoken "'" :nospec t :switch -1) + + ;; Don't allow constants continuing in the next line. + (syntoken ".?$" :begin :error) + ) + + ;; Rules for preprocessor. + (syntable :preprocessor *prop-preprocessor* #'default-indent + ;; Preprocessor includes comments. + (syntoken "/*" :nospec t :begin :comment :contained t) + + ;; Ignore lines finishing with a backslash. + (syntoken "\\\\$") + + ;; Return to previous state if end of line found. + (syntoken ".?$" :switch -1) + ) + + (syntable :error *prop-error* nil + (syntoken "^.*$" :switch -2) + ) + + ;; You may also want to comment this rule if the parsing is + ;; noticeably slow. + (syntoken "\\c" :property *prop-control*) +) Index: xc/programs/xedit/lisp/modules/progmodes/html.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/html.lsp:1.3 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/progmodes/html.lsp Sun Oct 6 13:11:48 2002 @@ -0,0 +1,327 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/html.lsp,v 1.3 2002/10/06 17:11:48 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +#| + This is not a validation tool for html. + + It is possible to, using macros generate all combinations of text attributes, + to properly handle <b>...<i>...</i>...</b> etc, as well as generating macros + to automatically closing tags, but for now this file was built to work as an + experience with the syntax highlight code. +|# + +(defsynprop *prop-html-default* + "default" + :font "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-1" + :foreground "Gray10") + +(defsynprop *prop-html-bold* + "bold" + :font "-*-lucida-bold-r-*-*-14-*-*-*-*-*-*-1" + :foreground "Gray15") + +(defsynprop *prop-html-italic* + "italic" + :font "-*-lucida-medium-i-*-*-14-*-*-*-*-*-*-1" + :foreground "Gray10") + +(defsynprop *prop-html-pre* + "pre" + :font "-*-courier-medium-r-*-*-14-*-*-*-*-*-*-1" + :foreground "Gray10") + +(defsynprop *prop-html-link* + "link" + :font "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-1" + :foreground "Blue" + :underline "t") + +(defsynprop *prop-html-small* + "small" + :font "-*-lucida-medium-r-*-*-10-*-*-*-*-*-*-1" + :foreground "Gray10") + +(defsynprop *prop-html-big* + "big" + :font "-*-lucida-medium-r-*-*-20-*-*-*-*-*-*-1" + :foreground "Gray15") + +(defsynprop *prop-html-name* + "name" + :font "-*-lucida-bold-r-*-*-14-*-*-*-*-*-*-1" + :foreground "Black" + :background "rgb:e/f/e") + +(defsynprop *prop-html-h1* + "h1" + :font "-*-lucida-bold-r-*-*-20-*-*-*-*-*-*-1" + :foreground "Gray15") + +(defsynprop *prop-html-h2* + "h2" + :font "-*-lucida-bold-r-*-*-17-*-*-*-*-*-*-1" + :foreground "Gray15") + +(defsynprop *prop-html-h4* + "h4" + :font "-*-lucida-bold-r-*-*-12-*-*-*-*-*-*-1" + :foreground "Gray15") + +(defsynprop *prop-html-h5* + "h5" + :font "-*-lucida-bold-r-*-*-10-*-*-*-*-*-*-1" + :foreground "Gray15") + +(defsynprop *prop-html-li* + "li" + :font "-*-lucida-bold-r-*-*-8-*-*-*-*-*-*-1" + :foreground "rgb:0/5/0" + :underline t) + +(defsynprop *prop-html-hr* + "hr" + :font "-*-courier-bold-r-*-*-12-*-*-*-*-*-*-1" + :foreground "rgb:0/5/0" + :overstrike t) + +(defsynprop *prop-html-title* + "title" + :font "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-1" + :foreground "Red3" + :underline "t") + +(defsynprop *prop-html-tag* + "tag" + :font "-*-courier-medium-r-*-*-10-*-*-*-*-*-*-1" + :foreground "green4") + +(defsynprop *prop-html-string* + "string" + :font "-*-lucida-medium-r-*-*-10-*-*-*-*-*-*-1" + :foreground "RoyalBlue2") + +(defsynprop *prop-html-comment* + "comment" + :font "-*-courier-medium-o-*-*-10-*-*-*-*-*-*-1" + :foreground "SlateBlue3") + +(defsynprop *prop-html-entity* + "entity" + :font "-*-lucida-medium-r-*-*-12-*-*-*-*-*-*-1" + :foreground "Red4") + +(defsynprop *prop-html-unknown* + "unknown" + :font "-*-courier-bold-r-*-*-10-*-*-*-*-*-*-1" + :foreground "yellow" + :background "red") + +(defmacro html-syntoken (name) + `(syntoken (string-concat "<" ,name "\\>") + :icase t :contained t + :begin (intern (string-concat ,name "$") 'keyword))) +(defmacro html-syntable (name property) + `(let + ((label (intern (string-concat ,name "$") 'keyword)) + (nested-label (intern (string (gensym)) 'keyword))) + (syntable label *prop-html-tag* nil + (synaugment :generic-tag) + (syntoken ">" :nospec t :property *prop-html-tag* :begin nested-label) + (syntable nested-label ,property nil + (syntoken (string-concat "</" ,name ">") + :icase t :nospec t :property *prop-html-tag* :switch -2) + (syntoken (string-concat "</" ,name "\\s*$") + :icase t :contained t :begin :continued-end-tag) + (synaugment :main))))) + + +(defsyntax *html-mode* :main *prop-html-default* nil nil + (syntoken "<!--" :nospec t :contained t :begin :comment) + (syntable :comment *prop-html-comment* nil + (syntoken "-->" :nospec t :switch -1)) + (syntoken "&([a-zA-Z0-9_.-]+|#\\x\\x?);?" :property *prop-html-entity*) + (syntoken "<li>" :nospec t :icase t :property *prop-html-li*) + (syntoken "<hr>" :nospec t :icase t :property *prop-html-hr*) + + (syntoken "<img\\>" :icase t :contained t :begin :tag) + (syntoken "<(p|br)>" :icase t :property *prop-html-tag*) + + ;; If in the toplevel, unbalanced! + ;; XXX When adding new nested tables, don't forget to update this pattern. + (syntoken + (string-concat + "</(" + "b|strong|i|em|address|pre|code|tt|small|big|a|span|div|" + "h1|h2|h3|h4|h5|title|font|ol|ul|dl|dt|dd|menu" + ")\\>") + :icase t :property *prop-html-unknown* :begin :unbalanced) + (syntable :unbalanced *prop-html-unknown* nil + (syntoken ">" :nospec t :switch :main) + (synaugment :generic-tag) + ) + + #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + ;; XXX ONLY add a rule for "html", "head" and "body" if you want to do a + ;; more complete check for common errors. If you add those rules, it will + ;; reparse the entire file at every character typed (unless there are + ;; errors in which case the parser resets the state). + ;; For visualization only that would be OK... + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||# + + (html-syntoken "b") + (html-syntable "b" *prop-html-bold*) + (html-syntoken "strong") + (html-syntable "strong" *prop-html-bold*) + + (html-syntoken "i") + (html-syntable "i" *prop-html-italic*) + (html-syntoken "em") + (html-syntable "em" *prop-html-italic*) + (html-syntoken "address") + (html-syntable "address" *prop-html-italic*) + + (html-syntoken "pre") + (html-syntable "pre" *prop-html-pre*) + (html-syntoken "code") + (html-syntable "code" *prop-html-pre*) + (html-syntoken "tt") + (html-syntable "tt" *prop-html-pre*) + + (html-syntoken "small") + (html-syntable "small" *prop-html-small*) + + (html-syntoken "big") + (html-syntable "big" *prop-html-big*) + + ;; Cannot hack html-syntoken and html-syntable to handle this, + ;; as the option to <a may be in the next line. + (syntoken "<a\\>" :icase t :contained t :begin :a) + (syntable :a *prop-html-tag* nil + ;; Tag is open + (syntoken "\\<href\\>" :icase t :begin :a-href) + (syntoken "\\<name\\>" :icase t :begin :a-name) + (syntoken "<" :nospec t :property *prop-html-unknown* :switch -2) + (synaugment :generic-tag) + (syntoken ">" :nospec t :begin :a-generic-text) + (syntable :a-href *prop-html-tag* nil + (syntoken ">" :nospec t :begin :a-href-text) + (synaugment :generic-tag) + (syntable :a-href-text *prop-html-link* nil + (syntoken "</a>" + :icase t :nospec t :property *prop-html-tag* :switch -3) + (syntoken "</a\\s*$" :icase t :begin :continued-nested-end-tag) + (synaugment :main) + ) + ) + (syntable :a-name *prop-html-tag* nil + (syntoken ">" :nospec t :begin :a-name-text) + (synaugment :generic-tag) + (syntable :a-name-text *prop-html-name* nil + (syntoken "</a>" + :icase t :nospec t :property *prop-html-tag* :switch -3) + (syntoken "</a\\s*$" :icase t :begin :continued-nested-end-tag) + (synaugment :main) + ) + ) + (syntable :a-generic-text nil nil + (syntoken "</a>" + :icase t :nospec t :property *prop-html-tag* :switch -2) + (syntoken "<a/\\s$" :icase t :begin :continued-end-tag) + (synaugment :main) + ) + ) + + ;; Do nothing, just check start/end tags + (html-syntoken "ol") + (html-syntable "ol" nil) + (html-syntoken "ul") + (html-syntable "ul" nil) + (html-syntoken "dl") + (html-syntable "dl" nil) + ;; Maybe <dt> and <dd> should be in a special table, to not require + ;; and ending tag. + ;; XXX Maybe should also add a table for <p>. + (html-syntoken "dt") + (html-syntable "dt" nil) + (html-syntoken "dd") + (html-syntable "dd" nil) + + (html-syntoken "span") + (html-syntable "span" nil) + (html-syntoken "div") + (html-syntable "div" nil) + (html-syntoken "menu") + (html-syntable "menu" nil) + + (html-syntoken "h1") + (html-syntable "h1" *prop-html-h1*) + (html-syntoken "h2") + (html-syntable "h2" *prop-html-h2*) + (html-syntoken "h3") + (html-syntable "h3" *prop-html-bold*) + (html-syntoken "h4") + (html-syntable "h4" *prop-html-h4*) + (html-syntoken "h5") + (html-syntable "h5" *prop-html-h5*) + (html-syntoken "title") + (html-syntable "title" *prop-html-title*) + + (html-syntoken "font") + (html-syntable "font" *prop-control*) + + (syntoken "<" :nospec t :contained t :begin :tag) + (syntable :generic-tag *prop-html-tag* nil + (syntoken "\"" :nospec t :contained t :begin :string) + (syntoken "<" :nospec t :property *prop-html-unknown*) + ) + (syntable :tag *prop-html-tag* nil + (syntoken ">" :nospec t :switch -1) + (synaugment :generic-tag) + ) + ;; Tag ended in a newline, common practice... + (syntable :continued-end-tag *prop-html-tag* nil + (syntoken ">" :nospec t :switch -3) + (synaugment :generic-tag) + ) + (syntable :continued-nested-end-tag *prop-html-tag* nil + (syntoken ">" :nospec t :switch -4) + (synaugment :generic-tag) + ) + + (syntable :string *prop-html-string* nil + (syntoken "\\\\.") + (syntoken "\"" :nospec t :switch -1) + ) +) Index: xc/programs/xedit/lisp/modules/progmodes/imake.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/imake.lsp:1.2 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/progmodes/imake.lsp Sun Oct 6 13:11:48 2002 @@ -0,0 +1,188 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/imake.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +(defsynprop *prop-shell* + "shell" + :font "*courier-bold-r*12*" + :foreground "Red4" +) + +(defsynprop *prop-variable* + "variable" + :font "*courier-medium-r*12*" + :foreground "Red3" +) + +;; The syntax-highlight definition does not try to flag errors, just show +;; tabs in the start of lines for better visualization. +(defsynprop *prop-tabulation* + "tabulation" + :font "*courier-medium-r*12*" + :background "Gray90" +) + +(defsynprop *prop-xcomm* + "xcomm" + :font "*courier-medium-o*12*" + :foreground "SkyBlue4" +) + + +(defsyntax *imake-mode* :main nil nil nil + (syntoken "^\\s*XCOMM\\W?.*$" + :property *prop-xcomm*) + + (syntoken "^\\t+" + :property *prop-tabulation*) + + (syntoken "$(" + :nospec t + :begin :shell + :property *prop-shell*) + + (syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]" + :property *prop-shell*) + + ;; Preprocessor start rule. + (syntoken "^\\s*#\\s*\\w+" + :begin :preprocessor + :contained t) + + ;; Comment start rule. + (syntoken "/*" + :nospec t + :begin :comment + :contained t) + + ;; String start rule. + (syntoken "\"" + :begin :string + :nospec t + :contained t) + + ;; Quoted string start rule. + (syntoken "\\\"" + :begin :quoted-string + :nospec t + :contained t) + + (syntable :shell *prop-variable* nil + (syntoken ")" + :nospec t + :property *prop-shell* + :switch -1) + ) + + ;; Rules for comments. + (syntable :comment *prop-comment* nil + + ;; Match nested comments as an error. + (syntoken "/*" + :nospec t + :property *prop-error*) + + (syntoken "XXX|TODO|FIXME" + :property *prop-annotation*) + + ;; Rule to finish a comment. + (syntoken "*/" + :nospec t + :switch -1) + ) + + ;; Rules for preprocessor. + (syntable :preprocessor *prop-preprocessor* nil + + ;; Preprocessor includes comments. + (syntoken "/*" + :nospec t + :begin :comment + :contained t) + + ;; Visualization help, show tabs in the start of lines. + (syntoken "^\\t+" + :property *prop-tabulation*) + + ;; Ignore lines finishing with a backslash. + (syntoken "\\\\$") + + ;; Return to previous state if end of line found. + (syntoken ".?$" + :switch -1) + ) + + ;; Rules for strings. + (syntable :string *prop-string* nil + + ;; Ignore escaped characters, this includes \". + (syntoken "\\\\.") + + ;; Ignore continuation in the next line. + (syntoken "\\\\$") + + ;; Rule to finish a string. + (syntoken "\"" + :nospec t + :switch -1) + + ;; Don't allow strings continuing in the next line. + (syntoken ".?$" + :begin :error) + ) + + ;; Rules for quoted strings. + (syntable :quoted-string *prop-constant* nil + + ;; Rule to finish the quoted string. + (syntoken "\\\"" + :nospec t + :switch -1) + + ;; Ignore escaped characters + (syntoken "\\\\.") + + ;; Ignore continuation in the next line. + (syntoken "\\\\$") + + ;; Don't allow strings continuing in the next line. + (syntoken ".?$" + :begin :error) + ) + + (syntable :error *prop-error* nil + (syntoken "^.*$" + :switch -2) + ) +) Index: xc/programs/xedit/lisp/modules/progmodes/lisp.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/lisp.lsp:1.9 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/progmodes/lisp.lsp Wed Jan 29 21:46:26 2003 @@ -0,0 +1,384 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/lisp.lsp,v 1.9 2003/01/30 02:46:26 paulo Exp $ +;; + +(require "syntax") +(require "indent") +(in-package "XEDIT") + +(defsynprop *prop-special* + "special" + :font "*courier-bold-r*12*" + :foreground "NavyBlue" +) + +(defsynprop *prop-quote* + "quote" + :font "*courier-bold-r*12*" + :foreground "Red3" +) + +(defsynprop *prop-package* + "package" + :font "*lucidatypewriter-medium-r*12*" + :foreground "Gold4" +) + +(defsynprop *prop-unreadable* + "unreadable" + :font "*courier-medium-r*12*" + :foreground "Gray25" + :underline t +) + +(defsynoptions *lisp-DEFAULT-style* + ;; Positive number. Basic indentation. + (:indentation . 2) + + ;; Boolean. Move cursor to the indent column after pressing <Enter>? + (:newline-indent . t) + + ;; Boolean. Use spaces instead of tabs to fill indentation? + (:emulate-tabs . nil) + + ;; Boolean. Remove extra spaces from previous line. + ;; This should default to T when newline-indent is not NIL. + (:trim-blank-lines . t) + + ;; Boolean. If this hash-table entry is set, no indentation is done. + ;; Useful to temporarily disable indentation. + (:disable-indent . nil) +) + +(defvar *lisp-mode-options* *lisp-DEFAULT-style*) + +(defindent *lisp-mode-indent* :main + ;; this must be the first token + (indtoken "^\\s*" :indent + :code (or *offset* (setq *offset* (+ *ind-offset* *ind-length*)))) + ;; ignore single line comments + (indtoken ";.*$" nil) + ;; multiline comments + (indtoken "|#" :comment :nospec t :begin :comment) + ;; characters + (indtoken "#\\\\(\\W|\\w+(-\\w+)?)" :character) + ;; numbers + (indtoken + (string-concat + "(\\<|[+-])\\d+(" + ;; integers + "(\\>|\\.(\\s|$))|" + ;; ratios + "/\\d+\\>|" + ;;floats + "\\.?\\d*([SsFfDdLlEe][+-]?\\d+)?\\>" + ")") + :number) + ;; symbols, with optional package + (indtoken + (string-concat + ;; optional package name and ending ':' + "([A-Za-z_0-9%-]+:)?" + ;; internal symbol if after package name, or keyword + ":?" + ;; symbol name + "[][{}A-Za-z_0-9!$%&/<=>^~*+-]+") + :symbol) + ;; strings in the same line + (indtoken "\"([^\\\"]|\\\\.)*\"" :string) + ;; multiline strings + (indtoken "\"" :cstring :nospec t :begin :string) + ;; "quoted" symbols in the same line + (indtoken "\\|([^\\|]|\\\\.)*\\|" :symbol) + ;; multiline + (indtoken "|" :csymbol :nospec t :begin :symbol) + (indtoken "#" :hash :nospec t) + + (indinit (parens 0)) + (indtoken "(" :oparen :nospec t :code (incf parens)) + (indtoken ")" :cparen :nospec t :code (decf parens)) + + (indtable :comment + ;; multiline comments can nest + (indtoken "|#" nil :nospec t :begin :comment) + (indtoken "#|" nil :nospec t :switch -1)) + + (indtable :string + ;; Ignore escaped characters + (indtoken "\\." nil) + ;; Return to the toplevel when the start of the string is found + (indtoken "\"" :ostring :nospec t :switch -1)) + + (indtable :symbol + ;; Ignore escaped characters + (indtoken "\\." nil) + ;; Return to the toplevel when the start of the symbol is found + (indtoken "|" :osymbol :nospec t :switch -1)) + + ;; ignore comments + (indreduce nil + t + ((:comment))) + + ;; reduce multiline strings + (indreduce :string + t + ((:ostring (not :ostring) :cstring))) + + ;; reduce multiline symbols + (indreduce :symbol + t + ((:osymbol (not :osymbol) :csymbol))) + + ;; reduce basic types, don't care if inside list or not + (indreduce :element + t + ((:number) + (:string) + (:character) + (:element :element) + (:indent :element))) + + (indreduce :symbol + t + ((:symbol :symbol) + (:symbol :element) + (:indent :symbol))) + + ;; the "real" indentation value, to make easier parsing code like: + ;; (foo (bar (baz (blah + ;; ^ ^ + ;; | | + ;; indent | + ;; effective indentation to be used + (indinit (indent 0)) + + ;; indentation values of opening parenthesis. + (indinit stack) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; if before current line and open parenthesis >= 0, use indentation + ;; of current line to calculate relative indentation. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (indreduce :oparen ;; simple list? + (and (>= parens 0) (< *ind-offset* *ind-start*)) + ((:indent :oparen)) + (setq + *indent* (offset-indentation (+ *ind-offset* *ind-length*) :resolve t) + indent *indent*) + (indent-macro-reject-left)) + + ;; reduce list if there isn't indentation change + (indreduce :element + t + ((:oparen (not :oparen) :cparen))) + + (indresolve :oparen + (setq + *indent* + (offset-indentation + (+ *ind-offset* *ind-length* -1 *base-indent*) :align t)) + (push *indent* stack) + (incf indent *base-indent*) + (if (< *indent* indent) (setq *indent* indent))) + + (indresolve :cparen + (decf indent *base-indent*) + (setq *indent* (pop stack)) + (if (null stack) + (setq *indent* indent) + (setq *indent* (car stack)))) +) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Find a "good" offset to start parsing backwards, so that it should +;; always generate the same results. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun lisp-offset-indent (&aux char (point (scan (point) :eol :left))) + ;; skip spaces + (while (member (setq char (char-after point)) indent-spaces) + (incf point)) + (if (member char '(#\))) (1+ point) point)) + +(defun lisp-should-indent (options &aux char point start) + (when (hash-table-p options) + ;; check if previous line has extra spaces + (and (gethash :trim-blank-lines options) + (indent-clear-empty-line)) + + ;; indentation disabled? + (and (gethash :disable-indent options) + (return-from lisp-should-indent)) + + (setq + point (point) + char (char-before (point)) + start (scan point :eol :left)) + + ;; at the start of a line + (and (= point start) + (return-from lisp-should-indent (gethash :newline-indent options))) + + ;; if first character + (and (= point (1+ start)) (return-from lisp-should-indent t)) + + ;; if closing parenthesis and first nonblank char + (when (and (characterp char) (char= char #\))) + (decf point) + (while + (and (> point start) (member (char-before point) indent-spaces)) + (decf point)) + (return-from lisp-should-indent (<= point start))) + ) + ;; should not indent + nil) + +(defun lisp-indent (syntax syntable) + (let* + ((options (syntax-options syntax)) + *base-indent*) + + (or (lisp-should-indent options) (return-from lisp-indent)) + + (setq *base-indent* (gethash :indentation options 2)) + + (indent-macro + *lisp-mode-indent* + (lisp-offset-indent) + (gethash :emulate-tabs options)))) + +(compile 'lisp-indent) + +(defsyntax *lisp-mode* :main nil #'lisp-indent *lisp-mode-options* + ;; highlight car and parenthesis + (syntoken "\\(+\\s*[][{}A-Za-z_0-9!$%&/<=>?^~*:+-]*\\)*" + :property *prop-keyword*) + (syntoken "\\)+" :property *prop-keyword*) + + ;; nil and t + (syntoken "\\<(nil|t)\\>" :icase t :property *prop-special*) + + (syntoken "|" :nospec t :begin :unreadable :contained t) + + ;; keywords + (syntoken ":[][{}A-Za-z_0-9!$%&/<=>^~+-]+" :property *prop-constant*) + + ;; special symbol. + (syntoken "\\*[][{}A-Za-z_0-9!$%&7=?^~+-]+\\*" + :property *prop-special*) + + ;; special identifiers + (syntoken "&(aux|key|optional|rest)\\>" :icase t :property *prop-constant*) + + ;; numbers + (syntoken + ;; since lisp is very liberal in what can be a symbol, this pattern + ;; will not always work as expected, since \< and \> will not properly + ;; work for all characters that may be in a symbol name + (string-concat + "(\\<|[+-])\\d+(" + ;; integers + "(\\>|\\.(\\s|$))|" + ;; ratios + "/\\d+\\>|" + ;;floats + "\\.?\\d*([SsFfDdLlEe][+-]?\\d+)?\\>" + ")") + :property *prop-number*) + + ;; characters + (syntoken "#\\\\(\\W|\\w+(-\\w+)?)" :property *prop-constant*) + + ;; quotes + (syntoken "[`'.]|,@?" :property *prop-quote*) + + ;; package names + (syntoken "[A-Za-z_0-9%-]+::?" :property *prop-package*) + + ;; read time evaluation + (syntoken "#\\d+#" :property *prop-preprocessor*) + (syntoken "#([+'cCsS-]|\\d+[aA=])?" :begin :preprocessor :contained t) + + (syntoken "\\c" :property *prop-control*) + + ;; symbols, do nothing, just resolve conflicting matches + (syntoken "[][{}A-Za-z_0-9!$%&/<=>^~*+-]+") + + (syntable :simple-comment *prop-comment* nil + (syntoken "$" :switch -1) + (syntoken "XXX|FIXME|TODO" :property *prop-annotation*)) + + (syntable :comment *prop-comment* nil + ;; comments can nest + (syntoken "#|" :nospec t :begin :comment) + ;; return to previous state + (syntoken "|#" :nospec t :switch -1) + (syntoken "XXX|FIXME|TODO" :property *prop-annotation*)) + + (syntable :unreadable *prop-unreadable* nil + ;; ignore escaped characters + (syntoken "\\\\.") + (syntoken "|" :nospec t :switch -1)) + + (syntable :string *prop-string* nil + ;; ignore escaped characters + (syntoken "\\\\.") + (syntoken "\"" :nospec t :switch -1)) + + (syntable :preprocessor *prop-preprocessor* nil + ;; a symbol + (syntoken "[][{}A-Za-z_0-9!$%&/<=>^~:*+-]+" :switch -1) + + ;; conditional expression + (syntoken "(" :nospec t :begin :preprocessor-expression :contained t) + + (syntable :preprocessor-expression *prop-preprocessor* nil + ;; recursive + (syntoken "(" :nospec t :begin :preprocessor-recursive :contained t) + (syntoken ")" :nospec t :switch -2) + + (syntable :preprocessor-recursive *prop-preprocessor* nil + (syntoken "(" :nospec t + :begin :preprocessor-recursive + :contained t) + (syntoken ")" :nospec t :switch -1) + (synaugment :comments-and-strings)) + (synaugment :comments-and-strings)) + (synaugment :comments-and-strings)) + + (syntable :comments-and-strings nil nil + (syntoken "\"" :nospec t :begin :string :contained t) + (syntoken "#|" :nospec t :begin :comment :contained t) + (syntoken ";" :begin :simple-comment :contained t)) + + (synaugment :comments-and-strings) +) Index: xc/programs/xedit/lisp/modules/progmodes/make.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/make.lsp:1.2 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/progmodes/make.lsp Sun Oct 6 13:11:48 2002 @@ -0,0 +1,135 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/make.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +(defsynprop *prop-shell* + "shell" + :font "*courier-bold-r*12*" + :foreground "Red4" +) + +(defsynprop *prop-variable* + "variable" + :font "*courier-medium-r*12*" + :foreground "Red3" +) + +;; The syntax-highlight definition does not try to flag errors, just show +;; tabs in the start of lines for better visualization. +(defsynprop *prop-tabulation* + "tabulation" + :font "*courier-medium-r*12*" + :background "Gray90" +) + + +(defsyntax *make-mode* :main nil nil nil + (syntoken "^\\t+" :property *prop-tabulation*) + + (syntoken "^\\.\\w+" :property *prop-keyword*) + + (syntoken "$(" + :nospec t + :begin :shell + :property *prop-shell*) + + (syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]" + :property *prop-shell*) + + ;; Preprocessor start rule. + (syntoken "#.*" + :property *prop-comment*) + + ;; String start rule. + (syntoken "\"" + :begin :string + :nospec t + :contained t) + + ;; Quoted string start rule. + (syntoken "\\\"" + :begin :quoted-string + :nospec t + :contained t) + + (syntable :shell *prop-variable* nil + (syntoken ")" + :nospec t + :property *prop-shell* + :switch -1) + ) + + ;; Rules for strings. + (syntable :string *prop-string* nil + + ;; Ignore escaped characters, this includes \". + (syntoken "\\\\.") + + ;; Ignore continuation in the next line. + (syntoken "\\\\$") + + ;; Rule to finish a string. + (syntoken "\"" + :nospec t + :switch -1) + + ;; Don't allow strings continuing in the next line. + (syntoken ".?$" + :begin :error) + ) + + ;; Rules for quoted strings. + (syntable :quoted-string *prop-constant* nil + + ;; Rule to finish the quoted string. + (syntoken "\\\"" + :nospec t + :switch -1) + + ;; Ignore escaped characters + (syntoken "\\\\.") + + ;; Ignore continuation in the next line. + (syntoken "\\\\$") + + ;; Don't allow strings continuing in the next line. + (syntoken ".?$" + :begin :error) + ) + + (syntable :error *prop-error* nil + (syntoken "^.*$" + :switch -2) + ) +) Index: xc/programs/xedit/lisp/modules/progmodes/man.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/man.lsp:1.2 --- /dev/null Thu Feb 27 12:35:00 2003 +++ xc/programs/xedit/lisp/modules/progmodes/man.lsp Sun Oct 6 13:11:48 2002 @@ -0,0 +1,160 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/man.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +(defsynprop *prop-man-b* + "b" + :font "*courier-bold-r*12*" + :foreground "gray12" +) + +(defsynprop *prop-man-i* + "i" + :font "*courier-medium-o*12*" + :foreground "black" +) + +(defsynprop *prop-man-bi* + "bi" + :font "*courier-bold-o*12*" + :foreground "gray20" +) + +(defsynprop *prop-man-th* + "th" + :font "-*-courier-*-*-*-*-18-*-*-*-*-*-*-1" + :foreground "Red3" +) + +(defsynprop *prop-man-sh* + "sh" + :font "-*-courier-*-*-*-*-14-*-*-*-*-*-*-1" + :foreground "OrangeRed3" +) + +(defsynprop *prop-man-ss* + "ss" + :font "-*-courier-*-*-*-*-12-*-*-*-*-*-*-1" + :foreground "Gold4" +) + +(defsynprop *prop-man-escape* + "escape" + :font "*lucidatypewriter-medium-r*12*" + :foreground "RoyalBlue4" +) + +(defsynprop *prop-man-string* + "string" + :font "*lucidatypewriter-bold-r*12*" + :foreground "RoyalBlue3" +; :underline t +) + +(defmacro man-syntoken (pattern) + `(syntoken (string-concat "^\\.(" ,pattern ")(\\s+|$)") + :icase t +; :contained t + :property *prop-preprocessor* + :begin (intern (string ,pattern) 'keyword))) + +(defmacro man-syntable (pattern property) + `(syntable (intern (string ,pattern) 'keyword) ,property nil + (syntoken "$" :switch -1) + (synaugment :extras))) + + +(defsyntax *man-mode* :main nil nil nil + (syntoken "^\\.\\\\\".*" + :property *prop-comment*) + + (man-syntoken "b|br|nm") + (man-syntable "b|br|nm" *prop-man-b*) + + (man-syntoken "i|ir|ri|ip") + (man-syntable "i|ir|ri|ip" *prop-man-i*) + + (man-syntoken "th|dt") + (man-syntable "th|dt" *prop-man-th*) + + (man-syntoken "sh") + (man-syntable "sh" *prop-man-sh*) + + (man-syntoken "ss") + (man-syntable "ss" *prop-man-ss*) + + (man-syntoken "bi") + (man-syntable "bi" *prop-man-bi*) + + ;; Anything not matched... + (syntoken "^\\.[a-z][a-z](\\s+|$)" + :icase t + :property *prop-preprocessor*) + + (syntable :extras nil nil + (syntoken "\\<__\\l+__\\>" + :property *prop-constant*) + (syntoken "\\\\fB" + :property *prop-preprocessor* + :begin :b) + (syntoken "\\\\fI" + :property *prop-preprocessor* + :begin :i) + (syntoken "\\\\f\\u" + :property *prop-preprocessor*) + + (syntoken "\\\\\\*?." + :property *prop-man-escape*) + + (syntoken "\"" + :property *prop-man-string*) + + (syntable :i *prop-man-i* nil + (syntoken "$" + :switch :main) + (syntoken "\\\\f\\u" + :property *prop-preprocessor* + :switch -1) + ) + (syntable :b *prop-man-b* nil + (syntoken "$" + :switch :main) + (syntoken "\\\\f\\u" + :property *prop-preprocessor* + :switch -1) + ) + ) + + (synaugment :extras) +) Index: xc/programs/xedit/lisp/modules/progmodes/rpm.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/rpm.lsp:1.1 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/modules/progmodes/rpm.lsp Wed Jan 15 22:50:46 2003 @@ -0,0 +1,166 @@ +;; +;; Copyright (c) 2003 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/rpm.lsp,v 1.1 2003/01/16 03:50:46 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +;; Only for testing, unifinished, good for viewing but too slow for real use... +#| +(defsynprop *prop-rpm-special* + "rpm-special" + :font "*courier-bold-r*12*" + :foreground "NavyBlue" +) + +(defsynprop *prop-rpm-escape* + "rpm-escape" + :font "*lucidatypewriter-medium-r*12*" + :foreground "Red3") + +;; main package is implicit +(defsyntax *rpm-mode* :package nil nil nil + (syntable :sections nil nil + (syntoken "^%package" + :icase t + :switch :package + ;; XXX :begin :package was added just to test finishing and + ;; starting a new syntax-table, unfortunately if using it + ;; this way, frequently the entire file will be reparsed + ;; at every character typed. + ;; TODO study these cases and implement code to avoid it, + ;; the easiest way is limiting the number of backtracked lines, + ;; the screen contents sometimes could not correctly reflect + ;; file contents in this case... + :begin :package + :property *prop-rpm-special*) + (syntoken "^%(build|setup|install|pre|preun|post|postun)\\>" + :icase t + :property *prop-rpm-special* + :switch :package + :begin :shell) + ;; %changelog, XXX no rules to return to the toplevel + (syntoken "^%changelog\\>" + :icase t + :switch :package + :begin :changelog + :property *prop-rpm-special*) + (syntable :changelog nil nil + ;; ignore if escaped + (syntoken "%%") + ;; "warn" if not escaped + (syntoken "%" :property *prop-control*) + ;; emails + (syntoken "<[a-z0-9_-]+@[a-z0-9_-]+\\.\\w+(\\.\\w+)?>" + :icase t + :property *prop-string*) + ) + ;; comments + (syntoken "#" :contained t :nospec t :begin :comment) + (syntable :comment *prop-comment* nil + ;; some macros are expanded even when inside comments, and may + ;; cause surprises, "warn" about it + (syntoken "%\\{?\\w+\\}?" :property *prop-rpm-special*) + (syntoken "$" :switch -1) + ) + (synaugment :global) + ) + + ;; may appear anywhere + (syntable :global nil nil + ;; preprocessor like commands + (syntoken "^%(define|if|ifarch|else|endif)\\>" + :icase t + :property *prop-preprocessor*) + ;; variables + (syntoken "%\\{.*\\}" :property *prop-constant*) + ) + + ;; example: "Group: ..." or "Group(pt_BR): ..." + (syntoken "^\\w+(\\(\\w+\\))?:" :property *prop-keyword*) + + ;; for sections with shell commands + (syntable :shell nil nil + (syntoken "\\<(if|then|elif|else|fi|for|do|done|case|esac|while|until)\\>" + :property *prop-keyword*) + (syntable :strings nil nil + (syntoken "\"" :nospec t :begin :string :contained t) + (syntable :string *prop-string* nil + (syntoken "\\$\\(?\\w+\\)?" :property *prop-constant*) + (syntoken "\\\\.") + (syntoken "\"" :nospec t :switch -1) + ) + (syntoken "\'" :nospec t :begin :constant :contained t) + (syntable :constant *prop-constant* nil + (syntoken "\\\\.") + (syntoken "\'" :nospec t :switch -1) + ) + (syntoken "\`" :nospec t :begin :escape :contained t) + (syntable :escape *prop-rpm-escape* nil + (syntoken "\\$\\(?\\w+\\)?" :property *prop-constant*) + (syntoken "\\\\.") + (syntoken "\`" :nospec t :switch -1) + ) + ) + (synaugment :strings :sections) + ) + (synaugment :sections) +) +|# + + +(defsyntax *rpm-mode* :package nil nil nil + ;; commands, macro definitions, etc + (syntoken "^\\s*%\\s*\\w+" :property *prop-keyword*) + + ;; rpm "variables" + (syntoken "%\\{.*\\}" :property *prop-constant*) + + ;; package info, example: "Group: ...", "Group(pt_BR): ...", etc. + (syntoken "^\\w+(\\(\\w+\\))?:" :property *prop-preprocessor*) + + ;; comments + (syntoken "#" :contained t :nospec t :begin :comment) + (syntable :comment *prop-comment* nil + ;; some macros are expanded even when inside comments, and may + ;; cause surprises, "warn" about it + (syntoken "%define\\>" :property *prop-control*) + (syntoken "%\\{?\\w+\\}?" :property *prop-string*) + (syntoken "$" :switch -1) + ) + + ;; emails + (syntoken "<?[a-z0-9_-]+@[a-z0-9_-]+\\.\\w+(\\.\\w+)*>?" + :icase t + :property *prop-string*) + ;; links + (syntoken "\\<(http|ftp)://\\S+" :property *prop-string*) +) Index: xc/programs/xedit/lisp/modules/progmodes/sgml.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/sgml.lsp:1.2 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/modules/progmodes/sgml.lsp Sun Oct 6 13:11:48 2002 @@ -0,0 +1,428 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/sgml.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +;; Default property the text is shown. +(defsynprop *prop-sgml-default* + "default" + :font "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-1" + :foreground "Gray10" +) + +(defsynprop *prop-sgml-default-short* + "default-short" + :font "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-1" + :foreground "Gray10" + :underline t +) + +;; Large font. +(defsynprop *prop-sgml-sect* + "sect" + :font "-*-helvetica-bold-r-*-*-17-*-*-*-*-*-*-1" + :foreground "Gray20" +) + +;; Monospaced property. +(defsynprop *prop-sgml-tt* + "tt" + :font "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-1" + :foreground "Black" +) + +;; Italic property. +(defsynprop *prop-sgml-it* + "it" + :font "-*-helvetica-medium-o-*-*-12-*-*-*-*-*-*-1" + :foreground "Black" +) + +;; Bold font property. +(defsynprop *prop-sgml-bf* + "bf" + :font "-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-1" + :foreground "Gray10" +) + +;; Looks like a link... +(defsynprop *prop-sgml-link* + "link" + :font "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-1" + :foreground "blue" + :underline t +) + +;; Monospaced, also looks like a link... +(defsynprop *prop-sgml-email* + "email" + :font "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-1" + :foreground "blue" + :underline t +) + +;; Another monospaced property, +(defsynprop *prop-sgml-screen* + "screen" + :font "-*-fixed-*-*-*-*-*-*-*-*-*-*-*-1" + :foreground "Gray10" +) + +(defsynprop *prop-sgml-maybe-entity* + "maybe-entity" + :font "*lucidatypewriter-medium-r*12*" + :foreground "VioletRed4" + :background "LightYellow" +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; The macros sgml-syntoken and sgml-syntable allows creating rules for +;; matching text inside tags in the format: +;; <tag> or <tag arg=value> or <tag arg1=value ... argn=value> +;; any-text +;; </tag> +;; The generated rules don't allow things like: < tag> or </tag > +;; +;; This could also be done as a normal definition, with a starting rule like: +;; "<(tag1|tag2|tag3)\\>" +;; and an ending rule like: +;; "</(tag1|tag2|tag3)>" +;; But is implemented in way that will fail on purpose for things like: +;; <tag1>any text</tag3></tag1> +;; +;; NOTE: These definitions aren't cheap in the time required to process the +;; file, and are just adaptations/tests with the syntax-highlight code, +;; probably it is better to avoid using it in other syntax definitions. +;; NOTE2: It cannot be defined as a single macro because it is required to +;; generate 2 entries in the main SGML syntax highlight definition, +;; or, should generate the entire definition from a macro; you will +;; need to type the tag name twice, but shouldn't be a problem if +;; you are using sgml :-) +;; XXX: Maybe the syntax-highlight code could save the starting match and +;; apply a regex generated at run-time to check for the ending tag, +;; but this probably would make the parser too slow, better to have +;; a specialized parser if that is required... +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro sgml-syntoken (name) + `(syntoken (string-concat "<" ,name "\\>") + :icase t + :contained t + :begin (intern (string-concat ,name "$") 'keyword)) +) +(defmacro sgml-syntable (name property) + `(let + ( + (label (intern (string-concat ,name "$") 'keyword)) + (nested-label (intern (string (gensym)) 'keyword)) + ) + (syntable label *prop-preprocessor* nil + ;; tag is still open, process any options + (synaugment :generic-tag) + (syntoken ">" + :nospec t + :property *prop-preprocessor* + :begin nested-label) + ;; Generate a nested table that includes everything, and only + ;; returns when the closing tag is found. + (syntable nested-label ,property nil + (syntoken (string-concat "</" ,name ">") + :icase t + :nospec t + :property *prop-preprocessor* + :switch -2) + (synaugment :main) + ) + ) + ) +) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Generate tokens for tags that don't require and ending tag. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro sgml-syntable-simple (name property) + `(let + ( + (label (intern (string-concat ,name "$") 'keyword)) + (nested-label (intern (string (gensym)) 'keyword)) + ) + (syntable label *prop-preprocessor* nil + ;; tag is still open, process any options + (synaugment :generic-tag) + (syntoken ">" + :nospec t + :property *prop-preprocessor* + :begin nested-label) + ;; Generate a nested table that finishes whenever an unmatched + ;; start or end tag is found. + (syntable nested-label ,property nil + (syntoken "</" + :icase t + :nospec t + :contained t + :begin :simple-nested-tag) + ;; These will take precedence over other rules + (syntoken "<" + :icase t + :nospec t + :contained t + :begin :simple-nested-tag) + (syntoken "<p>" + :icase t + :nospec t + :property *prop-preprocessor* + :switch :main) + (synaugment :main) + ) + ) + ) +) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Define some macros to generate tokens for tags in the format: +;; <tag/ ... / +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmacro sgml-syntoken-short (name) + `(syntoken (string-concat "<" ,name "/") + :icase t + :property *prop-preprocessor* + :begin (intern (string-concat ,name "/") 'keyword)) +) +(defmacro sgml-syntable-short (name property) + `(syntable (intern (string-concat ,name "/") 'keyword) ,property nil + (syntoken "/" + :nospec t + :property *prop-preprocessor* + :switch -1) + (syntoken "</?\\w+>" + :property *prop-control* + :switch :main) + ) +) + + +;; The main SGML syntax table +(defsyntax *sgml-mode* :main *prop-sgml-default* nil nil + ;; Comments + (syntoken "<!--" + :nospec t + :contained t + :begin :comment) + (syntable :comment *prop-comment* nil + ;; Only one rule, to finish the comment. + (syntoken "-->" + :nospec t + :switch -1) + ) + + ;; Entities + (syntoken "&[a-zA-Z0-9_.-]+;" + :property *prop-constant*) + ;; Probably an entity, missing ending `;' + (syntoken "&[a-zA-Z0-9_.-]+" + :property *prop-sgml-maybe-entity*) + + ;; Strings + (syntable :string *prop-string* nil + ;; Ignore escaped characters. + (syntoken "\\\\.") + ;; Rule to finish the string. + (syntoken "\"" + :nospec t + :switch -1) + ) + + ;; Links + (syntable :link *prop-preprocessor* nil + ;; No link string following "url=" + (syntoken ">" + :nospec t + :property *prop-control* + :switch -1) + (syntoken "\"" + :nospec t + :contained t + :begin :link-string) + (syntable :link-string *prop-sgml-link* nil + ;; Ignore escaped characters. + (syntoken "\\\\.") + ;; Rule to finish the link, note that returns two levels. + (syntoken "\"" + :nospec t + :switch -2) + ) + ) + + ;; "Special" tag + (syntoken "<!" + :nospec t + :contained t + :begin :special-tag) + ;; Rules for "special" tags + (syntable :special-tag *prop-preprocessor* nil + (syntoken "[" + :nospec t + :property *prop-preprocessor* + :begin :brackets) + ;; Finish the "special" tag + (syntoken ">" + :nospec t + :switch -1) + (syntable :brackets *prop-sgml-default* nil + (syntoken "]" + :nospec t + :property *prop-preprocessor* + :switch -1) + ;; Allow nesting. + (syntoken "[" + :nospec t + :property *prop-preprocessor* + :begin :brackets) + ;; Entities. + (syntoken "%[a-zA-Z0-9_.-]+;?" + :property *prop-annotation*) + ;; Allow everything inside the brackets + (synaugment :main) + ) + ;; Don't use generic tag tokens, only create a rule for strings + (syntoken "\"" + :nospec t + :begin :string + :contained t) + ;; Allow everything inside the "special" tag + (synaugment :main) + ) + + ;; Some "short" tags + (sgml-syntoken-short "tt") + (sgml-syntable-short "tt" *prop-sgml-tt*) + (sgml-syntoken-short "it") + (sgml-syntable-short "it" *prop-sgml-it*) + (sgml-syntoken-short "bf") + (sgml-syntable-short "bf" *prop-sgml-bf*) + (sgml-syntoken-short "em") + (sgml-syntable-short "em" *prop-sgml-bf*) + + ;; Short tag + (syntoken "<\\w+/" + :property *prop-preprocessor* + :begin :short-tag) + (syntable :short-tag *prop-sgml-default-short* nil + (syntoken "/" + :nospec t + :property *prop-preprocessor* + :switch -1) + (syntoken "</?\\w+>" + :property *prop-control* + :switch -1) + ) + + ;; Don't allow spaces, this may and may not be the start of a tag, + ;; but the syntax-highlight definition is not specialized... + (syntoken "<([^/a-zA-Z]|$)" + :property *prop-control*) + + ;; Some tags that require an end tag + (sgml-syntoken "tt") + (sgml-syntable "tt" *prop-sgml-tt*) + (sgml-syntoken "code") + (sgml-syntable "code" *prop-sgml-tt*) + (sgml-syntoken "tag") + (sgml-syntable "tag" *prop-sgml-tt*) + (sgml-syntoken "verb") + (sgml-syntable "verb" *prop-sgml-tt*) + (sgml-syntoken "programlisting") + (sgml-syntable "programlisting" *prop-sgml-tt*) + (sgml-syntoken "it") + (sgml-syntable "it" *prop-sgml-it*) + (sgml-syntoken "bf") + (sgml-syntable "bf" *prop-sgml-bf*) + (sgml-syntoken "em") + (sgml-syntable "em" *prop-sgml-bf*) + (sgml-syntoken "mail") + (sgml-syntable "mail" *prop-sgml-email*) + (sgml-syntoken "email") + (sgml-syntable "email" *prop-sgml-email*) + (sgml-syntoken "screen") + (sgml-syntable "screen" *prop-sgml-screen*) + (sgml-syntoken "tscreen") + (sgml-syntable "tscreen" *prop-sgml-screen*) + + + ;; Helper for tags that don't need an ending one. + ;; NOTE: Since the parser is not specialized, if the tag is + ;; folowed by one that has a special property defined here, + ;; it may not be detected, i.e. put a <p> after the <sect> + ;; and it will work. + (syntable :simple-nested-tag *prop-preprocessor* nil + ;; tag is still open, process any options + (synaugment :generic-tag) + (syntoken ">" + :nospec t + :property *prop-preprocessor* + :switch -3) + ) + (sgml-syntoken "sect") + (sgml-syntable-simple "sect" *prop-sgml-sect*) + (sgml-syntoken "sect1") + (sgml-syntable-simple "sect1" *prop-sgml-sect*) + (sgml-syntoken "sect2") + (sgml-syntable-simple "sect2" *prop-sgml-sect*) + + ;; Generic tags + (syntoken "<" + :nospec t + :contained t + :begin :tag) + ;; Table :generic-tag is defined to be augmented, no rule to finish it. + (syntable :generic-tag *prop-preprocessor* nil + ;; Start string + (syntoken "\"" + :nospec t + :begin :string + :contained t) + ;; Start url link + (syntoken "url=" + :nospec t + :begin :link) + ;; Cannot nest + (syntoken "<" + :nospec t + :property *prop-control*) + ) + (syntable :tag *prop-preprocessor* nil + ;; Finish the tag + (syntoken ">" + :nospec t + :switch -1) + ;; Import generic definitions + (synaugment :generic-tag) + ) +) Index: xc/programs/xedit/lisp/modules/progmodes/sh.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/sh.lsp:1.1 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/modules/progmodes/sh.lsp Wed Jan 15 22:50:46 2003 @@ -0,0 +1,113 @@ +;; +;; Copyright (c) 2003 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/sh.lsp,v 1.1 2003/01/16 03:50:46 paulo Exp $ +;; + +(require "syntax") +(require "indent") +(in-package "XEDIT") + +(defsynprop *prop-escape* + "escape" + :font "*lucidatypewriter-medium-r*12*" + :foreground "Red3") + +(defsynprop *prop-variable* + "variable" + :font "*lucidatypewriter-medium-r*12*" + :foreground "Gold4") + +(defsynprop *prop-backslash* + "backslash" + :font "*courier-bold-r*12*" + :foreground "green4") + +;; XXX it would be interesting if "here-documents" could be parsed +;; just searching for "<<\s*EOF\\>" and then for "^EOF\\>" should +;; handle most cases, but would be a hack... +(defsyntax *sh-mode* :main nil #'default-indent nil + ;; keywords and common commands/builtins + (syntoken "\\<(if|then|elif|else|fi|case|in|esac|for|do|done|while|until|break|continue|eval|exit|exec|test|echo|cd|shift|local|return)\\>" + :property *prop-keyword*) + + ; comments + (syntoken "#.*$" :property *prop-comment*) + + ;; punctuation + (syntoken "[][;:*?(){}<>&!|$#]+" :property *prop-punctuation*) + + ;; variable declaration + (syntoken "\\w+=" :property *prop-preprocessor*) + + ;; numbers + (syntoken "\\<\\d+\\>" :property *prop-number*) + + ;; escaped characters at toplevel + (syntoken "\\\\." :property *prop-backslash*) + + ;; single quote + (syntoken "'" :nospec t :contained t :begin :single) + (syntable :single *prop-constant* nil + ;; do nothing, escaped characters + (syntoken "\\\\.") + (syntoken "'" :nospec t :switch -1) + ) + + ;; double quote + (syntoken "\"" :nospec t :contained t :begin :double) + (syntable :double *prop-string* #'default-indent + ;; escaped characters + (syntoken "\\\\." :property *prop-backslash*) + (syntoken "\"" :nospec t :switch -1) + ;; rule to start escape + (syntoken "`" :nospec t :contained t :begin :escape) + ;; ignore single quote, required because escape is augmented + (syntoken "'" :nospec t) + (synaugment :escape :variable) + ) + + ;; escaped commands + (syntoken "`" :nospec t :contained t :begin :escape) + (syntable :escape *prop-escape* #'default-indent + ;; escaped characters + (syntoken "\\\\." :property *prop-backslash*) + (syntoken "`" :nospec t :switch -1) + ;; rule to start double quote inside escape + (syntoken "\"" :nospec t :contained t :begin :double) + ;; rule to start single quote + (syntoken "'" :nospec t :contained t :begin :single) + (synaugment :double :variable) + ) + + (syntable :variable nil nil + (syntoken "\\$\\w+" :property *prop-variable*) + ) + (synaugment :variable) +) Index: xc/programs/xedit/lisp/modules/progmodes/xconf.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/xconf.lsp:1.1 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/modules/progmodes/xconf.lsp Wed Jan 15 22:50:46 2003 @@ -0,0 +1,68 @@ +;; +;; Copyright (c) 2003 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/xconf.lsp,v 1.1 2003/01/16 03:50:46 paulo Exp $ +;; + +(require "syntax") +(require "indent") +(in-package "XEDIT") + +(defsyntax *xconf-mode* :main nil #'default-indent nil + ;; section start + (syntoken "\\<(Section|SubSection)\\>" + :property *prop-keyword* :icase t :begin :section) + ;; just for fun, highlight the section name differently + (syntable :section *prop-constant* #'default-indent + (syntoken "\"" :nospec t :begin :name) + (syntable :name *prop-constant* nil + ;; ignore escaped characters + (syntoken "\\\\.") + (syntoken "\"" :nospec t :switch -2) + ) + ) + + ;; section end + (syntoken "\\<(EndSection|EndSubSection)\\>" + :property *prop-keyword* :icase t) + + ;; numeric options + (syntoken "\\<\\d+(\\.\\d+)?\\>" :property *prop-number*) + + ;; comments + (syntoken "#.*$" :property *prop-comment*) + + ;; strings + (syntoken "\"" :nospec t :begin :string :contained t) + (syntable :string *prop-string* #'default-indent + ;; ignore escaped characters + (syntoken "\\\\.") + (syntoken "\"" :nospec t :switch -1) + ) +) Index: xc/programs/xedit/lisp/modules/progmodes/xlog.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/xlog.lsp:1.1 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/modules/progmodes/xlog.lsp Thu Jan 16 01:25:51 2003 @@ -0,0 +1,102 @@ +;; +;; Copyright (c) 2003 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/xlog.lsp,v 1.1 2003/01/16 06:25:51 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +(defsynprop *prop-xlog-probe* + "xlog-probe" + :font "*courier-medium-r*12*" + :background "rgb:c/f/c") + +(defsynprop *prop-xlog-config* + "xlog-config" + :font "*courier-medium-r*12*" + :background "rgb:c/e/f") + +(defsynprop *prop-xlog-default* + "xlog-default" + :font "*courier-medium-r*12*" + :background "rgb:e/c/f") + +(defsynprop *prop-xlog-warning* + "xlog-warning" + :font "*courier-bold-r*12*" + :foreground "Red4" + :background "Yellow1" +) + +(defsynprop *prop-xlog-error* + "xlog-error" + :font "*courier-bold-r*12*" + :foreground "Yellow2" + :background "Red3" +) + +(defsyntax *xlog-mode* :main nil nil nil + ;; highlight version + (syntoken "^XFree86 Version \\S+" :property *prop-annotation*) + + ;; release date + (syntoken "^Release Date: " :property *prop-keyword* :begin :note) + + ;; highlight operating system description + (syntoken "^Build Operating System: " :property *prop-keyword* :begin :note) + + (syntable :note *prop-annotation* nil (syntoken "$" :switch -1)) + + ;; don't highlight info lines + (syntoken "^\\(II\\) " :property *prop-keyword*) + + ;; default lines + (syntoken "^\\(==\\) " :property *prop-keyword* :begin :default) + (syntable :default *prop-xlog-default* nil (syntoken "$" :switch -1)) + + ;; probe lines + (syntoken "^\\(--\\) " :property *prop-keyword* :begin :probe) + (syntable :probe *prop-xlog-probe* nil (syntoken "$" :switch -1)) + + ;; config lines + (syntoken "^\\(\\*\\*\\) " :property *prop-keyword* :begin :config) + (syntable :config *prop-xlog-config* nil (syntoken "$" :switch -1)) + + ;; warnings + (syntoken "^\\(WW\\) " :property *prop-keyword* :begin :warning) + (syntable :warning *prop-xlog-warning* nil (syntoken "$" :switch -1)) + + ;; errors + (syntoken "^\\(EE\\) " :property *prop-keyword* :begin :error) + (syntable :error *prop-xlog-error* nil (syntoken "$" :switch -1)) + + ;; command line and "uncommon" messages + (syntoken "^\\(..\\) " :property *prop-control* :begin :warning) +) Index: xc/programs/xedit/lisp/modules/progmodes/xrdb.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/progmodes/xrdb.lsp:1.2 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/modules/progmodes/xrdb.lsp Sun Oct 6 13:11:48 2002 @@ -0,0 +1,115 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/xrdb.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ +;; + +(require "syntax") +(in-package "XEDIT") + +(defsynprop *prop-xrdb-comment* + "xrdb-comment" + :font "*courier-medium-o*12*" + :foreground "sienna" +) + +(defsynprop *prop-xrdb-special* + "format" + :font "*lucidatypewriter-medium-r*12*" + :foreground "RoyalBlue4" +) + +(defsynprop *prop-xrdb-punctuation* + "punctuation" + :font "-*-courier-bold-r-*-*-14-*-*-*-*-*-*-1" + :foreground "OrangeRed4" +) + +(defsyntax *xrdb-mode* :main nil nil nil + (syntoken "^\\s*!.*" + :property *prop-xrdb-comment*) + (syntoken "^\\s*#.*" + :property *prop-preprocessor*) + (syntoken "\\*|\\.|\\?" + :property *prop-xrdb-punctuation* + :begin :resource) + (syntoken "." + :nospec t + :begin :resource) + + ;; Extra comments + (syntoken "/*" :nospec t :begin :comment :contained t) + (syntable :comment *prop-comment* nil + (syntoken "/*" :nospec t :property *prop-error*) + ;; Rule to finish a comment. + (syntoken "*/" :nospec t :switch -1) + ) + + (syntable :resource nil nil + (syntoken "\\*|\\.|\\?" :property *prop-xrdb-punctuation*) + (syntoken ":\\s*" :property *prop-xrdb-punctuation* :begin :value) + ) + + (syntable :value *prop-string* nil + (syntoken "\\\\$" :property *prop-constant*) + + + ;; If the pattern ends at a newline, must switch to the previous state. + ;; Not sure yet how to better handle this. The parser does not detect + ;; eol because it is a match to the empty string. A possible hack + ;; would be to check if the pattern string ends in a "$", but probably + ;; better in this case to have a syntoken option, to tell the parser + ;; an eol may exist. + (syntoken + (string-concat + "(" + "\\d+|" ;; numbers + "(#\\x+|rgb:\\x+/\\x+/\\x+)|" ;; color spec + "#\\w+" ;; translation table + ")$") + :property *prop-xrdb-special* :switch -2) + (syntoken "(\\\\n?|\")$" + :property *prop-constant* :switch -2) + + ;; XXX Cut&paste of the above, only without the match to eol + (syntoken + (string-concat + "(" + "\\d+|" + "(#\\x+|rgb:\\x+/\\x+/\\x+)|" + "#\\w+" + ")") + :property *prop-xrdb-special*) + (syntoken "(\\\\n?|\")" + :property *prop-constant*) + + (syntoken "/*" :nospec t :begin :comment :contained t) + (syntoken ".?$" :switch -2) + ) +) Index: xc/programs/xedit/lisp/mp/Imakefile diff -u /dev/null xc/programs/xedit/lisp/mp/Imakefile:1.3 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/mp/Imakefile Fri Nov 8 03:01:00 2002 @@ -0,0 +1,25 @@ +XCOMM $XFree86: xc/programs/xedit/lisp/mp/Imakefile,v 1.3 2002/11/08 08:01:00 paulo Exp $ + +#define DoNormalLib YES +#define DoSharedLib NO +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#define LibName mp +#define LibInstall NO +#define LibHeaders NO + +LIB = LibName + +SRCS =\ + mp.c \ + mpi.c \ + mpr.c +OBJS =\ + mp.o \ + mpi.o \ + mpr.o + +#include <Library.tmpl> + +DependTarget() Index: xc/programs/xedit/lisp/mp/mp.c diff -u /dev/null xc/programs/xedit/lisp/mp/mp.c:1.3 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/mp/mp.c Wed Nov 20 02:44:43 2002 @@ -0,0 +1,822 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/mp/mp.c,v 1.3 2002/11/20 07:44:43 paulo Exp $ */ + +#include "mp.h" + +/* + * TODO: + * o Optimize squaring + * o Write better division code and move from mpi.c to here + * o Make multiplication code don't required memory to be zeroed + * + The first step is easy, just multiply the low word, + * then the high word, that may overlap with the result + * of the first multiply (in case of carry), and then + * just make sure carry is properly propagated in the + * subsequent multiplications. + * + Some code needs also to be rewritten because some + * intermediate addition code in mp_mul, mp_karatsuba_mul, + * and mp_toom_mul is assuming the memory is zeroed. + */ + +/* + * Prototypes + */ + /* out of memory handler */ +static void mp_outmem(void); + + /* memory allocation fallback functions */ +static void *_mp_malloc(size_t); +static void *_mp_calloc(size_t, size_t); +static void *_mp_realloc(void*, size_t); +static void _mp_free(void*); + +/* + * Initialization + */ +static mp_malloc_fun __mp_malloc = _mp_malloc; +static mp_calloc_fun __mp_calloc = _mp_calloc; +static mp_realloc_fun __mp_realloc = _mp_realloc; +static mp_free_fun __mp_free = _mp_free; + +/* + * Implementation + */ +static void +mp_outmem(void) +{ + fprintf(stderr, "out of memory in MP library.\n"); + exit(1); +} + +static void * +_mp_malloc(size_t size) +{ + return (malloc(size)); +} + +void * +mp_malloc(size_t size) +{ + void *pointer = (*__mp_malloc)(size); + + if (pointer == NULL) + mp_outmem(); + + return (pointer); +} + +mp_malloc_fun +mp_set_malloc(mp_malloc_fun fun) +{ + mp_malloc_fun old = __mp_malloc; + + __mp_malloc = fun; + + return (old); +} + +static void * +_mp_calloc(size_t nmemb, size_t size) +{ + return (calloc(nmemb, size)); +} + +void * +mp_calloc(size_t nmemb, size_t size) +{ + void *pointer = (*__mp_calloc)(nmemb, size); + + if (pointer == NULL) + mp_outmem(); + + return (pointer); +} + +mp_calloc_fun +mp_set_calloc(mp_calloc_fun fun) +{ + mp_calloc_fun old = __mp_calloc; + + __mp_calloc = fun; + + return (old); +} + +static void * +_mp_realloc(void *old, size_t size) +{ + return (realloc(old, size)); +} + +void * +mp_realloc(void *old, size_t size) +{ + void *pointer = (*__mp_realloc)(old, size); + + if (pointer == NULL) + mp_outmem(); + + return (pointer); +} + +mp_realloc_fun +mp_set_realloc(mp_realloc_fun fun) +{ + mp_realloc_fun old = __mp_realloc; + + __mp_realloc = fun; + + return (old); +} + +static void +_mp_free(void *pointer) +{ + free(pointer); +} + +void +mp_free(void *pointer) +{ + (*__mp_free)(pointer); +} + +mp_free_fun +mp_set_free(mp_free_fun fun) +{ + mp_free_fun old = __mp_free; + + __mp_free = fun; + + return (old); +} + +long +mp_add(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) +{ + BNI value; /* intermediate result */ + BNS carry; /* carry flag */ + long size; /* result size */ + + if (len1 < len2) + MP_SWAP(op1, op2, len1, len2); + + /* unroll start of loop */ + value = op1[0] + op2[0]; + rop[0] = value; + carry = value >> BNSBITS; + + /* add op1 and op2 */ + for (size = 1; size < len2; size++) { + value = op1[size] + op2[size] + carry; + rop[size] = value; + carry = value >> BNSBITS; + } + if (rop != op1) { + for (; size < len1; size++) { + value = op1[size] + carry; + rop[size] = value; + carry = value >> BNSBITS; + } + } + else { + /* if rop == op1, than just adjust carry */ + for (; carry && size < len1; size++) { + value = op1[size] + carry; + rop[size] = value; + carry = value >> BNSBITS; + } + size = len1; + } + if (carry) + rop[size++] = carry; + + return (size); +} + +long +mp_sub(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) +{ + long svalue; /* intermediate result */ + BNS carry; /* carry flag */ + long size; /* result size */ + + /* special case */ + if (op1 == op2) { + rop[0] = 0; + + return (1); + } + + /* unroll start of loop */ + svalue = op1[0] - op2[0]; + rop[0] = svalue; + carry = svalue < 0; + + /* subtracts op2 from op1 */ + for (size = 1; size < len2; size++) { + svalue = (long)(op1[size]) - op2[size] - carry; + rop[size] = svalue; + carry = svalue < 0; + } + if (rop != op1) { + for (; size < len1; size++) { + svalue = op1[size] - carry; + rop[size] = svalue; + carry = svalue < 0; + } + } + else { + /* if rop == op1, than just adjust carry */ + for (; carry && size < len1; size++) { + svalue = op1[size] - carry; + rop[size] = svalue; + carry = svalue < 0; + } + size = len1; + } + + /* calculate result size */ + while (size > 1 && rop[size - 1] == 0) + --size; + + return (size); +} + +long +mp_lshift(BNS *rop, BNS *op, BNI len, long shift) +{ + long i, size; + BNI words, bits; /* how many word and bit shifts */ + + words = shift / BNSBITS; + bits = shift % BNSBITS; + size = len + words; + + if (bits) { + BNS hi, lo; + BNI carry; + int adj; + + for (i = 1, carry = CARRY >> 1; carry; i++, carry >>= 1) + if (op[len - 1] & carry) + break; + adj = (bits + (BNSBITS - i)) / BNSBITS; + size += adj; + + lo = hi = op[0]; + rop[words] = lo << bits; + for (i = 1; i < len; i++) { + hi = op[i]; + rop[words + i] = hi << bits | (lo >> (BNSBITS - bits)); + lo = hi; + } + if (adj) + rop[size - 1] = hi >> (BNSBITS - bits); + } + else + memmove(rop + size - len, op, sizeof(BNS) * len); + + if (words) + memset(rop, '\0', sizeof(BNS) * words); + + return (size); +} + +long +mp_rshift(BNS *rop, BNS *op, BNI len, long shift) +{ + int adj = 0; + long i, size; + BNI words, bits; /* how many word and bit shifts */ + + words = shift / BNSBITS; + bits = shift % BNSBITS; + size = len - words; + + if (bits) { + BNS hi, lo; + BNI carry; + + for (i = 0, carry = CARRY >> 1; carry; i++, carry >>= 1) + if (op[len - 1] & carry) + break; + adj = (bits + i) / BNSBITS; + if (size - adj == 0) { + rop[0] = 0; + + return (1); + } + + hi = lo = op[words + size - 1]; + rop[size - 1] = hi >> bits; + for (i = size - 2; i >= 0; i--) { + lo = op[words + i]; + rop[i] = (lo >> bits) | (hi << (BNSBITS - bits)); + hi = lo; + } + if (adj) + rop[0] |= lo << (BNSBITS - bits); + } + else + memmove(rop, op + len - size, size * sizeof(BNS)); + + return (size - adj); +} + + /* rop must be a pointer to len1 + len2 elements + * rop cannot be either op1 or op2 + * rop must be all zeros */ +long +mp_base_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) +{ + long i, j; /* counters */ + BNI value; /* intermediate result */ + BNS carry; /* carry value */ + long size = len1 + len2; + + /* simple optimization: first pass does not need to deference rop[i+j] */ + if (op1[0]) { + value = (BNI)(op1[0]) * op2[0]; + rop[0] = value; + carry = (BNS)(value >> BNSBITS); + for (j = 1; j < len2; j++) { + value = (BNI)(op1[0]) * op2[j] + carry; + rop[j] = value; + carry = (BNS)(value >> BNSBITS); + } + rop[j] = carry; + } + + /* do the multiplication */ + for (i = 1; i < len1; i++) { + if (op1[i]) { + /* unrool loop initialization */ + value = (BNI)(op1[i]) * op2[0] + rop[i]; + rop[i] = value; + carry = (BNS)(value >> BNSBITS); + /* multiply */ + for (j = 1; j < len2; j++) { + value = (BNI)(op1[i]) * op2[j] + rop[i + j] + carry; + rop[i + j] = value; + carry = (BNS)(value >> BNSBITS); + } + rop[i + j] = carry; + } + } + + if (size > 1 && rop[size - 1] == 0) + --size; + + return (size); +} + + /* Karatsuba method + * t + ((a0 + a1) (b0 + b1) - t - u) x + ux² + * where t = a0b0 and u = a1b1 + * + * Karatsuba method reduces the number of multiplications. Example: + * Square a 40 length number + * instead of a plain 40*40 = 1600 multiplies/adds, it does: + * 20*20+20*20+20*20 = 1200 + * but since it is recursive, every 20*20=400 is reduced to + * 10*10+10*10+10*10=300 + * and so on. + * The multiplication by x and x² is a just a shift, as it is a + * power of two, and is implemented below by just writting at the + * correct offset */ +long +mp_karatsuba_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) +{ + BNI x; /* shift count */ + BNI la0, la1, lb0, lb1; /* length of a0, a1, b0, and b1 */ + BNS *t; /* temporary memory for t product */ + BNS *u; /* temporary memory for u product */ + BNS *r; /* pointer to rop */ + long xlen, tlen, ulen; + + /* calculate value of x, that is 2^(BNSBITS*x) */ + if (len1 >= len2) + x = (len1 + 1) >> 1; + else + x = (len2 + 1) >> 1; + + /* calculate length of operands */ + la0 = x; + la1 = len1 - x; + lb0 = x; + lb1 = len2 - x; + + /* allocate buffer for t and (a0 + a1) */ + tlen = la0 + lb0; + t = mp_malloc(sizeof(BNS) * tlen); + + /* allocate buffer for u and (b0 + b1) */ + if (la1 + lb1 < lb0 + lb1 + 1) + ulen = lb0 + lb1 + 1; + else + ulen = la1 + lb1; + u = mp_malloc(sizeof(BNS) * ulen); + + /* calculate a0 + a1, store result in t */ + tlen = mp_add(t, op1, op1 + x, la0, la1); + + /* calculate b0 + b1, store result in u */ + ulen = mp_add(u, op2, op2 + x, lb0, lb1); + + /* store (a0 + a1) * (b0 + b1) in rop */ + + r = rop + x; /* multiplied by 2^(BNSBITS*x) */ + xlen = mp_mul(r, t, u, tlen, ulen); + + /* must zero t and u memory, this is required for mp_mul */ + + /* calculate t = a0 * b0 */ + tlen = la0 + lb0; + memset(t, '\0', sizeof(BNS) * tlen); + tlen = mp_mul(t, op1, op2, la0, lb0); + + /* calculate u = a1 * b1 */ + ulen = la1 + lb1; + memset(u, '\0', sizeof(BNS) * ulen); + ulen = mp_mul(u, op1 + x, op2 + x, la1, lb1); + + /* subtract t from partial result */ + xlen = mp_sub(r, r, t, xlen, tlen); + + /* subtract u form partial result */ + xlen = mp_sub(r, r, u, xlen, ulen); + + /* add ux^2 to partial result */ + + r = rop + (x << 1); /* multiplied by x^2 = 2^(BNSBITS*x*2) */ + xlen = len1 + len2; + xlen = mp_add(r, r, u, xlen, ulen); + + /* now add t to final result */ + xlen = mp_add(rop, rop, t, xlen, tlen); + + mp_free(t); + mp_free(u); + + if (xlen > 1 && rop[xlen - 1] == 0) + --xlen; + + return (xlen); +} + + /* Toom method (partially based on GMP documentation) + * Evaluation at k = [ 0 1/2 1 2 oo ] + * U(x) = (U2k + U1)k + U0 + * V(x) = (V2k + V1)k + V0 + * W(x) = U(x)V(x) + * + * Sample: + * 123 * 456 + * + * EVALUATION: + * U(0) = (1*0+2)*0+3 => 3 + * U(1) = 1+(2+3*2)*2 => 17 + * U(2) = 1+2+3 => 6 + * U(3) = (1*2+2)*2+3 => 11 + * U(4) = 1+(2+3*0)*0 => 1 + * + * V(0) = (4*0+5)*0+6 => 6 + * V(1) = 4+(5+6*2)*2 => 38 + * V(2) = 4+5+6 => 15 + * V(3) = (4*2+5)*2+6 => 32 + * V(4) = 4+(5+6*0)*0 => 4 + * + * U = [ 3 17 6 11 1 ] + * V = [ 6 38 15 32 4 ] + * W = [ 18 646 90 352 4 ] + * + * After that, we have: + * a = 18 (w0 already known) + * b = 16w0 + 8w1 + 4w2 + 2w3 + w4 + * c = w0 + w1 + w2 + w3 + w4 + * d = w0 + 2w1 + 4w2 + 8w3 + 16w4 + * e = 4 (w4 already known) + * + * INTERPOLATION: + * b = b -16a - e (354) + * c = c - a - e (68) + * d = d - a - 16e (270) + * + * w = (b + d) - 8c = (10w1+8w2+10w3) - (8w1+8w2+8w3) = 2w1+2w3 + * w = 2c - w (56) + * b = b/2 = 4w1+w+w3 + * b = b-c = 4w1+w+w3 - w1+w2+w3 = 3w1+w2 + * c = w/2 (w2 = 28) + * b = b-c = 3w1+c - c = 3w1 + * b = b/3 (w1 = 27) + * d = d/2 + * d = d-b-w = b+w+4w3 - b-w = 4w3 + * d = d/4 (w3 = 13) + * + * RESULT: + * w4*10^4 + w3*10³ + w2*10² + w1*10 + w0 + * 40000 + 13000 + 2800 + 270 + 18 + * 10 is the base where the calculation was done + * + * This sample uses small numbers, so it does not show the + * advantage of the method. But for example (in base 10), when squaring + * 123456789012345678901234567890 + * The normal method would do 30*30=900 multiplications + * Karatsuba method would do 15*15*3=675 multiplications + * Toom method would do 10*10*5=500 multiplications + * Toom method has a larger overhead if compared with Karatsuba method, + * due to evaluation and interpolation, so it should be used for larger + * numbers, so that the computation time of evaluation/interpolation + * would be smaller than the time spent using other methods. + * + * Note that Karatsuba method can be seen as a special case of + * Toom method, i.e: + * U1U0 * V1V0 + * with k = [ 0 1 oo ] + * U = [ U0 U1+U0 U1 ] + * V = [ V0 V1+V0 V1 ] + * W = [ U0*V0 (U1+U0)*(V1+V0) (U1+V1) ] + * + * w0 = U0*V0 + * w = (U1+U0)*(V1+V0) + * w2 = (U1*V1) + * + * w1 = w - w0 - w2 + * w2x² + w1x + w0 + * + * See Knuth's Seminumerical Algorithms for a sample implemention + * using 4 stacks and k = [ 0 1 2 3 ... ], based on the size of the + * input. + */ +long +mp_toom_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) +{ + long size, xsize, i; + BNI value; /* used in division */ + BNS carry; + BNI x; /* shift count */ + BNI l1, l2; + BNI al, bl, cl, dl, el, Ul[3], Vl[3]; + BNS *a, *b, *c, *d, *e, *U[3], *V[3]; + + /* x is the base i.e. 2^(BNSBITS*x) */ + x = (len1 + len2 + 4) / 6; + l1 = len1 - (x << 1); /* length of remaining piece of op1 */ + l2 = len2 - (x << 1); /* length of remaining piece of op2 */ + + /* allocate memory for storing U and V */ + U[0] = mp_malloc(sizeof(BNS) * (x + 2)); + V[0] = mp_malloc(sizeof(BNS) * (x + 2)); + U[1] = mp_malloc(sizeof(BNS) * (x + 1)); + V[1] = mp_malloc(sizeof(BNS) * (x + 1)); + U[2] = mp_malloc(sizeof(BNS) * (x + 2)); + V[2] = mp_malloc(sizeof(BNS) * (x + 2)); + + /* EVALUATE U AND V */ + + /* Numbers are in the format U2x²+U1x+U0 and V2x²+V1x+V0 */ + + /* U[0] = U2+U1*2+U0*4 */ + + /* store U1*2 in U[1], this value is used twice */ + Ul[1] = mp_lshift(U[1], op1 + x, x, 1); + + /* store U0*4 in U[0] */ + Ul[0] = mp_lshift(U[0], op1, x, 2); + /* add U1*2 to U[0] */ + Ul[0] = mp_add(U[0], U[0], U[1], Ul[0], Ul[1]); + /* add U2 to U[0] */ + Ul[0] = mp_add(U[0], U[0], op1 + x + x, Ul[0], l1); + + /* U[2] = U2*4+U1*2+U0 */ + + /* store U2*4 in U[2] */ + Ul[2] = mp_lshift(U[2], op1 + x + x, l1, 2); + /* add U1*2 to U[2] */ + Ul[2] = mp_add(U[2], U[2], U[1], Ul[2], Ul[1]); + /* add U0 to U[2] */ + Ul[2] = mp_add(U[2], U[2], op1, Ul[2], x); + + /* U[1] = U2+U1+U0 */ + + Ul[1] = mp_add(U[1], op1, op1 + x, x, x); + Ul[1] = mp_add(U[1], U[1], op1 + x + x, Ul[1], l1); + + + /* Evaluate V[x], same code as U[x] */ + Vl[1] = mp_lshift(V[1], op2 + x, x, 1); + Vl[0] = mp_lshift(V[0], op2, x, 2); + Vl[0] = mp_add(V[0], V[0], V[1], Vl[0], Vl[1]); + Vl[0] = mp_add(V[0], V[0], op2 + x + x, Vl[0], l2); + Vl[2] = mp_lshift(V[2], op2 + x + x, l2, 2); + Vl[2] = mp_add(V[2], V[2], V[1], Vl[2], Vl[1]); + Vl[2] = mp_add(V[2], V[2], op2, Vl[2], x); + Vl[1] = mp_add(V[1], op2, op2 + x, x, x); + Vl[1] = mp_add(V[1], V[1], op2 + x + x, Vl[1], l2); + + + /* MULTIPLY U[] AND V[] */ + + /* calculate (U2+U1*2+U0*4) * (V2+V1*2+V0*4) */ + b = mp_calloc(1, sizeof(BNS) * (Ul[0] * Vl[0])); + bl = mp_mul(b, U[0], V[0], Ul[0], Vl[0]); + mp_free(U[0]); + mp_free(V[0]); + + /* calculate (U2+U1+U0) * (V2+V1+V0) */ + c = mp_calloc(1, sizeof(BNS) * (Ul[1] * Vl[1])); + cl = mp_mul(c, U[1], V[1], Ul[1], Vl[1]); + mp_free(U[1]); + mp_free(V[1]); + + /* calculate (U2*4+U1*2+U0) * (V2*4+V1*2+V0) */ + d = mp_calloc(1, sizeof(BNS) * (Ul[2] * Vl[2])); + dl = mp_mul(d, U[2], V[2], Ul[2], Vl[2]); + mp_free(U[2]); + mp_free(V[2]); + + /* calculate U0 * V0 */ + a = mp_calloc(1, sizeof(BNS) * (x + x)); + al = mp_mul(a, op1, op2, x, x); + + /* calculate U2 * V2 */ + e = mp_calloc(1, sizeof(BNS) * (l1 + l2)); + el = mp_mul(e, op1 + x + x, op2 + x + x, l1, l2); + + + /* INTERPOLATE COEFFICIENTS */ + + /* b = b - 16a - e */ + size = mp_lshift(rop, a, al, 4); + bl = mp_sub(b, b, rop, bl, size); + bl = mp_sub(b, b, e, bl, el); + + /* c = c - a - e*/ + cl = mp_sub(c, c, a, cl, al); + cl = mp_sub(c, c, e, cl, el); + + /* d = d - a - 16e */ + dl = mp_sub(d, d, a, dl, al); + size = mp_lshift(rop, e, el, 4); + dl = mp_sub(d, d, rop, dl, size); + + /* w = (b + d) - 8c */ + size = mp_add(rop, b, d, bl, dl); + xsize = mp_lshift(rop + size, c, cl, 3); /* rop has enough storage */ + size = mp_sub(rop, rop, rop + size, size, xsize); + + /* w = 2c - w*/ + xsize = mp_lshift(rop + size, c, cl, 1); + size = mp_sub(rop, rop + size, rop, xsize, size); + + /* b = b/2 */ + bl = mp_rshift(b, b, bl, 1); + + /* b = b - c */ + bl = mp_sub(b, b, c, bl, cl); + + /* c = w / 2 */ + cl = mp_rshift(c, rop, size, 1); + + /* b = b - c */ + bl = mp_sub(b, b, c, bl, cl); + + /* b = b/3 */ + /* maybe the most expensive calculation */ + i = bl - 1; + value = b[i]; + b[i] = value / 3; + for (--i; i >= 0; i--) { + carry = value % 3; + value = ((BNI)carry << BNSBITS) + b[i]; + b[i] = (BNS)(value / 3); + } + + /* d = d/2 */ + dl = mp_rshift(d, d, dl, 1); + + /* d = d - b - w */ + dl = mp_sub(d, d, b, dl, bl); + dl = mp_sub(d, d, rop, dl, size); + + /* d = d/4 */ + dl = mp_rshift(d, d, dl, 2); + + + /* STORE RESULT IN ROP */ + /* first clear memory used as temporary variable w and 8c */ + memset(rop, '\0', sizeof(BNS) * (len1 + len2)); + + i = x * 4; + xsize = (len1 + len2) - i; + size = mp_add(rop + i, rop + i, e, xsize, el) + i; + i = x * 3; + xsize = size - i; + size = mp_add(rop + i, rop + i, d, xsize, dl) + i; + i = x * 2; + xsize = size - i; + size = mp_add(rop + i, rop + i, c, xsize, cl) + i; + i = x; + xsize = size - i; + size = mp_add(rop + i, rop + i, b, xsize, bl) + i; + size = mp_add(rop, rop, a, size, al); + + mp_free(e); + mp_free(d); + mp_free(c); + mp_free(b); + mp_free(a); + + if (size > 1 && rop[size - 1] == 0) + --size; + + return (size); +} + +long +mp_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) +{ + if (len1 < len2) + MP_SWAP(op1, op2, len1, len2); + + if (len1 < KARATSUBA || len2 < KARATSUBA) + return (mp_base_mul(rop, op1, op2, len1, len2)); + else if (len1 < TOOM && len2 < TOOM && len2 > ((len1 + 1) >> 1)) + return (mp_karatsuba_mul(rop, op1, op2, len1, len2)); + else if (len1 >= TOOM && len2 >= TOOM && (len2 + 2) / 3 == (len1 + 2) / 3) + return (mp_toom_mul(rop, op1, op2, len1, len2)); + else { + long xsize, psize, isize; + BNS *ptr; + + /* adjust index pointer and estimated size of result */ + isize = 0; + xsize = len1 + len2; + mp_mul(rop, op1, op2, len2, len2); + /* adjust pointers */ + len1 -= len2; + op1 += len2; + + /* allocate buffer for intermediate multiplications */ + if (len1 > len2) + ptr = mp_calloc(1, sizeof(BNS) * (len2 + len2)); + else + ptr = mp_calloc(1, sizeof(BNS) * (len1 + len2)); + + /* loop multiplying len2 size operands at a time */ + while (len1 >= len2) { + isize += len2; + psize = mp_mul(ptr, op1, op2, len2, len2); + mp_add(rop + isize, rop + isize, ptr, xsize - isize, psize); + len1 -= len2; + op1 += len2; + + /* multiplication routines require zeroed memory */ + memset(ptr, '\0', sizeof(BNS) * (MIN(len1, len2) + len2)); + } + + /* len1 was not a multiple of len2 */ + if (len1) { + isize += len2; + psize = mp_mul(ptr, op2, op1, len2, len1); + mp_add(rop + isize, rop + isize, ptr, xsize, psize); + } + + /* adjust result size */ + if (rop[xsize - 1] == 0) + --xsize; + + mp_free(ptr); + + return (xsize); + } +} Index: xc/programs/xedit/lisp/mp/mp.h diff -u /dev/null xc/programs/xedit/lisp/mp/mp.h:1.6 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/mp/mp.h Sat Jan 11 22:55:51 2003 @@ -0,0 +1,435 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/mp/mp.h,v 1.6 2003/01/12 03:55:51 tsi Exp $ */ + +#include <stdio.h> +#include <math.h> +#ifdef sun +#include <ieeefp.h> +#endif +#include <float.h> +#include <stdlib.h> +#include <limits.h> +#include <ctype.h> +#include <string.h> + +#ifndef __mp_h_ +#define __mp_h_ + +#ifdef __GNUC__ +#define INLINE __inline__ +#else +#define INLINE /**/ +#endif + +/* this normally is better for multiplication and also + * simplify addition loops putting the larger value first */ +#define MP_SWAP(op1, op2, len1, len2) { \ + BNS *top = op1; \ + BNI tlen = len1; \ + \ + op1 = op2; \ + len1 = len2; \ + op2 = top; \ + len2 = tlen; \ +} + +/* + * At least this length to use Karatsuba multiplication method + */ +#define KARATSUBA 32 + +/* + * At least this length to use Toom multiplication method + */ +#define TOOM 128 + +#if ULONG_MAX > 4294967295UL + /* sizeof(long) == 8 and sizeof(int) == 4 */ +# define BNI unsigned long +# define BNS unsigned int +# define MINSLONG 0x8000000000000000UL +# define CARRY 0x100000000 +# define LMASK 0xffffffff00000000UL +# define SMASK 0x00000000ffffffffUL +# define BNIBITS 64 +# define BNSBITS 32 +# ifndef LONG64 +# define LONG64 +# endif +#else + /* sizeof(long) == 4 and sizeof(short) == 2 */ +# define BNI unsigned long +# define BNS unsigned short +# define MINSLONG 0x80000000UL +# define CARRY 0x10000 +# define LMASK 0xffff0000UL +# define SMASK 0x0000ffffUL +# define BNIBITS 32 +# define BNSBITS 16 +#endif + +#ifdef MAX +#undef MAX +#endif +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#ifdef MIN +#undef MIN +#endif +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +/* + * Types + */ +typedef struct _mpi { + unsigned int size : 31; + unsigned int sign : 1; + BNI alloc; + BNS *digs; /* LSF format */ +} mpi; + +typedef struct _mpr { + mpi num; + mpi den; +} mpr; + +typedef void *(*mp_malloc_fun)(size_t); +typedef void *(*mp_calloc_fun)(size_t, size_t); +typedef void *(*mp_realloc_fun)(void*, size_t); +typedef void (*mp_free_fun)(void*); + +/* + * Prototypes + */ +/* GENERIC FUNCTIONS */ + /* memory allocation wrappers */ +void *mp_malloc(size_t size); +void *mp_calloc(size_t nmemb, size_t size); +void *mp_realloc(void *pointer, size_t size); +void mp_free(void *pointer); +mp_malloc_fun mp_set_malloc(mp_malloc_fun); +mp_calloc_fun mp_set_calloc(mp_calloc_fun); +mp_realloc_fun mp_set_realloc(mp_realloc_fun); +mp_free_fun mp_set_free(mp_free_fun); + + /* adds op1 and op2, stores result in rop + * rop must pointer to at least len1 + len2 + 1 elements + * rop can be either op1 or op2 */ +long mp_add(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); + + /* subtracts op2 from op1, stores result in rop + * rop must pointer to at least len1 + len2 elements + * op1 must be >= op2 + * rop can be either op1 or op2 */ +long mp_sub(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); + + /* shift op to the left shift bits + * rop must have enough storage for result + * rop can be op */ +long mp_lshift(BNS *rop, BNS *op, BNI len, long shift); + + /* shift op to the right shift bits + * shift must be positive + * rop can be op */ +long mp_rshift(BNS *rop, BNS *op, BNI len, long shift); + + /* use simple generic multiplication method + * rop cannot be the same as op1 or op2 + * rop must be zeroed + * op1 can be op2 */ +long mp_base_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); + + /* use Karatsuba method + * MIN(len1, len2) must be larger than (MAX(len1, len2) + 1) >> 1 + * MAX(len1, len2) should be at least 2 + * rop cannot be the same as op1 or op2 + * rop must be zeroed + * op1 can be op2 */ +long mp_karatsuba_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); + + /* use Toom method + * len1 / 3 should be equal to len2 / 3 + * len1 / 3 should be at least 1 + * rop cannot be the same as op1 or op2 + * rop must be zeroed + * op1 can be op2 */ +long mp_toom_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); + + /* chooses the available multiplication methods based on it's input + * rop must be a pointer to len1 + len2 elements + * rop cannot be the same as op1 or op2 + * rop must be zeroed + * op1 can be op2 */ +long mp_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); + +/* INTEGER FUNCTIONS */ + /* initialize op and set it to 0 */ +void mpi_init(mpi *op); + + /* clear memory associated to op */ +void mpi_clear(mpi *op); + + /* set rop to the value of op */ +void mpi_set(mpi *rop, mpi *op); + + /* set rop to the value of si */ +void mpi_seti(mpi *rop, long si); + + /* set rop to the floor(fabs(d)) */ +void mpi_setd(mpi *rop, double d); + + /* initialize rop to number representation in str in the given base. + * leading zeros are skipped. + * if sign present, it is processed. + * base must be in the range 2 to 36. */ +void mpi_setstr(mpi *rop, char *str, int base); + + /* adds two mp integers */ +void mpi_add(mpi *rop, mpi *op1, mpi *op2); + + /* adds op1 and op2 */ +void mpi_addi(mpi *rop, mpi *op1, long op2); + + /* subtracts two mp integers */ +void mpi_sub(mpi *rop, mpi *op1, mpi *op2); + + /* subtracts op2 from op1 */ +void mpi_subi(mpi *rop, mpi *op1, long op2); + + /* multiply two mp integers */ +void mpi_mul(mpi *rop, mpi *op1, mpi *op2); + + /* multiply op1 by op2 */ +void mpi_muli(mpi *rop, mpi *op1, long op2); + + /* divides num by den and sets rop to result */ +void mpi_div(mpi *rop, mpi *num, mpi *den); + + /* divides num by den and sets rop to the remainder */ +void mpi_rem(mpi *rop, mpi *num, mpi *den); + + /* divides num by den, sets quotient to qrop and remainder to rrop + * qrop is truncated towards zero. + * qrop and rrop are optional + * qrop and rrop cannot be the same variable */ +void mpi_divqr(mpi *qrop, mpi *rrop, mpi *num, mpi *den); + + /* divides num by then and stores result in rop */ +void mpi_divi(mpi *rop, mpi *num, long den); + + /* divides num by den and returns remainder */ +long mpi_remi(mpi *num, long den); + + /* divides num by den + * stores quotient in qrop and returns remainder */ +long mpi_divqri(mpi *qrop, mpi *num, long den); + + /* sets rop to num modulo den */ +void mpi_mod(mpi *rop, mpi *num, mpi *den); + + /* returns num modulo den */ +long mpi_modi(mpi *num, long den); + + /* sets rop to the greatest common divisor of num and den + * result is always positive */ +void mpi_gcd(mpi *rop, mpi *num, mpi *den); + + /* sets rop to the least common multiple of num and den + * result is always positive */ +void mpi_lcm(mpi *rop, mpi *num, mpi *den); + + /* sets rop to op raised to exp */ +void mpi_pow(mpi *rop, mpi *op, unsigned long exp); + + /* sets rop to the integer part of the nth root of op. + * returns 1 if result is exact, 0 otherwise */ +int mpi_root(mpi *rop, mpi *op, unsigned long nth); + + /* sets rop to the integer part of the square root of op. + * returns 1 if result is exact, 0 otherwise */ +int mpi_sqrt(mpi *rop, mpi *op); + + /* bit shift, left if shift positive, right if negative + * a fast way to multiply and divide by powers of two */ +void mpi_ash(mpi *rop, mpi *op, long shift); + + /* sets rop to op1 logand op2 */ +void mpi_and(mpi *rop, mpi *op1, mpi *op2); + + /* sets rop to op1 logior op2 */ +void mpi_ior(mpi *rop, mpi *op1, mpi *op2); + + /* sets rop to op1 logxor op2 */ +void mpi_xor(mpi *rop, mpi *op1, mpi *op2); + + /* sets rop to one's complement of op */ +void mpi_com(mpi *rop, mpi *op); + + /* sets rop to -op */ +void mpi_neg(mpi *rop, mpi *op); + + /* sets rop to the absolute value of op */ +void mpi_abs(mpi *rop, mpi *op); + + /* compares op1 and op2 + * returns >0 if op1 > op2, 0 if op1 = op2, and <0 if op1 < op2 */ +int mpi_cmp(mpi *op1, mpi *op2); + + /* mpi_cmp with a long integer operand */ +int mpi_cmpi(mpi *op1, long op2); + + /* compares absolute value of op1 and op2 + * returns >0 if abs(op1) > abs(op2), 0 if abs(op1) = abs(op2), + * and <0 if abs(op1) < abs(op2) */ +int mpi_cmpabs(mpi *op1, mpi *op2); + + /* mpi_cmpabs with a long integer operand */ +int mpi_cmpabsi(mpi *op1, long op2); + + /* returns 1 if op1 > 0, 0 if op1 = 0, and -1 if op1 < 0 */ +int mpi_sgn(mpi *op); + + /* fastly swaps contents of op1 and op2 */ +void mpi_swap(mpi *op1, mpi *op2); + + /* returns 1 if op fits in a signed long int, 0 otherwise */ +int mpi_fiti(mpi *op); + + /* converts mp integer to long int + * to know if the value will fit, call mpi_fiti */ +long mpi_geti(mpi *op); + + /* convert mp integer to double */ +double mpi_getd(mpi *op); + + /* returns exact number of characters to represent mp integer + * in given base, excluding sign and ending null character. + * base must be in the range 2 to 36 */ +unsigned long mpi_getsize(mpi *op, int base); + + /* returns pointer to string with representation of mp integer + * if str is not NULL, it must have enough space to store integer + * representation, if NULL a newly allocated string is returned. + * base must be in the range 2 to 36 */ +char *mpi_getstr(char *str, mpi *op, int base); + +/* RATIO FUNCTIONS */ +#define mpr_num(op) (&((op)->num)) +#define mpr_den(op) (&((op)->den)) + + /* initialize op and set it to 0/1 */ +void mpr_init(mpr *op); + + /* clear memory associated to op */ +void mpr_clear(mpr *op); + + /* set rop to the value of op */ +void mpr_set(mpr *rop, mpr *op); + + /* set rop to num/den */ +void mpr_seti(mpr *rop, long num, long den); + + /* set rop to the value of d */ +void mpr_setd(mpr *rop, double d); + + /* initialize rop to number representation in str in the given base. + * leading zeros are skipped. + * if sign present, it is processed. + * base must be in the range 2 to 36. */ +void mpr_setstr(mpr *rop, char *str, int base); + + /* remove common factors of op */ +void mpr_canonicalize(mpr *op); + + /* adds two mp rationals */ +void mpr_add(mpr *rop, mpr *op1, mpr *op2); + + /* adds op1 and op2 */ +void mpr_addi(mpr *rop, mpr *op1, long op2); + + /* subtracts two mp rationals */ +void mpr_sub(mpr *rop, mpr *op1, mpr *op2); + + /* subtracts op2 from op1 */ +void mpr_subi(mpr *rop, mpr *op1, long op2); + + /* multiply two mp rationals */ +void mpr_mul(mpr *rop, mpr *op1, mpr *op2); + + /* multiply op1 by op2 */ +void mpr_muli(mpr *rop, mpr *op1, long op2); + + /* divide two mp rationals */ +void mpr_div(mpr *rop, mpr *op1, mpr *op2); + + /* divides op1 by op2 */ +void mpr_divi(mpr *rop, mpr *op1, long op2); + + /* sets rop to 1/op */ +void mpr_inv(mpr *rop, mpr *op); + + /* sets rop to -op */ +void mpr_neg(mpr *rop, mpr *op); + + /* sets rop to the absolute value of op */ +void mpr_abs(mpr *rop, mpr *op); + + /* compares op1 and op2 + * returns >0 if op1 > op2, 0 if op1 = op2, and <0 if op1 < op2 */ +int mpr_cmp(mpr *op1, mpr *op2); + + /* mpr_cmp with a long integer operand */ +int mpr_cmpi(mpr *op1, long op2); + + /* compares absolute value of op1 and op2 + * returns >0 if abs(op1) > abs(op2), 0 if abs(op1) = abs(op2), + * and <0 if abs(op1) < abs(op2) */ +int mpr_cmpabs(mpr *op1, mpr *op2); + + /* mpr_cmpabs with a long integer operand */ +int mpr_cmpabsi(mpr *op1, long op2); + + /* fastly swaps contents of op1 and op2 */ +void mpr_swap(mpr *op1, mpr *op2); + + /* returns 1 if op fits in a signed long int, 0 otherwise */ +int mpr_fiti(mpr *op); + + /* convert mp rational to double */ +double mpr_getd(mpr *op); + + /* returns pointer to string with representation of mp rational + * if str is not NULL, it must have enough space to store rational + * representation, if NULL a newly allocated string is returned. + * base must be in the range 2 to 36 */ +char *mpr_getstr(char *str, mpr *op, int base); + +#endif /* __mp_h_ */ Index: xc/programs/xedit/lisp/mp/mpi.c diff -u /dev/null xc/programs/xedit/lisp/mp/mpi.c:1.12 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/mp/mpi.c Wed Nov 20 02:44:43 2002 @@ -0,0 +1,1656 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/mp/mpi.c,v 1.12 2002/11/20 07:44:43 paulo Exp $ */ + +#include "mp.h" + +/* + * Prototypes + */ + /* do the hard work of mpi_add and mpi_sub */ +static void mpi_addsub(mpi *rop, mpi *op1, mpi *op2, int sub); + + /* logical functions implementation */ +static INLINE BNS mpi_logic(BNS op1, BNS op2, BNS op); +static void mpi_log(mpi *rop, mpi *op1, mpi *op2, BNS op); + + /* internal mpi_seti, whithout memory allocation */ +static void _mpi_seti(mpi *rop, long si); + +/* + * Initialization + */ +static BNS onedig[1] = { 1 }; +static mpi mpone = { 1, 1, 0, (BNS*)&onedig }; + +/* + * Implementation + */ +void +mpi_init(mpi *op) +{ + op->sign = 0; + op->size = op->alloc = 1; + op->digs = mp_malloc(sizeof(BNS)); + op->digs[0] = 0; +} + +void +mpi_clear(mpi *op) +{ + op->sign = 0; + op->size = op->alloc = 0; + mp_free(op->digs); +} + +void +mpi_set(mpi *rop, mpi *op) +{ + if (rop != op) { + if (rop->alloc < op->size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op->size); + rop->alloc = op->size; + } + rop->size = op->size; + memcpy(rop->digs, op->digs, sizeof(BNS) * op->size); + rop->sign = op->sign; + } +} + +void +mpi_seti(mpi *rop, long si) +{ + unsigned long ui; + int sign = si < 0; + int size; + + if (si == MINSLONG) { + ui = MINSLONG; + size = 2; + } + else { + if (sign) + ui = -si; + else + ui = si; + if (ui < CARRY) + size = 1; + else + size = 2; + } + + if (rop->alloc < size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size); + rop->alloc = size; + } + rop->size = size; + + /* store data in small mp integer */ + rop->digs[0] = (BNS)ui; + if (size > 1) + rop->digs[1] = (BNS)(ui >> BNSBITS); + rop->size = size; + + /* adjust result sign */ + rop->sign = sign; +} + +static void +_mpi_seti(mpi *rop, long si) +{ + unsigned long ui; + int sign = si < 0; + int size; + + if (si == MINSLONG) { + ui = MINSLONG; + size = 2; + } + else { + if (sign) + ui = -si; + else + ui = si; + if (ui < CARRY) + size = 1; + else + size = 2; + } + + rop->digs[0] = (BNS)ui; + if (size > 1) + rop->digs[1] = (BNS)(ui >> BNSBITS); + rop->size = size; + + rop->sign = sign; +} + +void +mpi_setd(mpi *rop, double d) +{ + long i; + double mantissa; + int shift, exponent; + BNI size; + + if (isnan(d)) + d = 0.0; + else if (!finite(d)) + d = copysign(1.0, d) * DBL_MAX; + + /* check if number is larger than 1 */ + if (fabs(d) < 1.0) { + rop->digs[0] = 0; + rop->size = 1; + rop->sign = d < 0.0; + + return; + } + + mantissa = frexp(d, &exponent); + if (mantissa < 0) + mantissa = -mantissa; + + size = (exponent + (BNSBITS - 1)) / BNSBITS; + shift = BNSBITS - (exponent & (BNSBITS - 1)); + + /* adjust amount of memory */ + if (rop->alloc < size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size); + rop->alloc = size; + } + rop->size = size; + + /* adjust the exponent */ + if (shift < BNSBITS) + mantissa = ldexp(mantissa, -shift); + + /* convert double */ + for (i = size - 1; i >= 0 && mantissa != 0.0; i--) { + mantissa = ldexp(mantissa, BNSBITS); + rop->digs[i] = (BNS)mantissa; + mantissa -= rop->digs[i]; + } + for (; i >= 0; i--) + rop->digs[i] = 0; + + /* normalize */ + if (size > 1 && rop->digs[size - 1] == 0) + --rop->size; + + rop->sign = d < 0.0; +} + +/* how many BNS in the given base, log(base) / log(CARRY) */ +#ifdef LONG64 +static double str_bases[37] = { + 0.0000000000000000, 0.0000000000000000, 0.0312500000000000, + 0.0495300781475362, 0.0625000000000000, 0.0725602529652301, + 0.0807800781475362, 0.0877298413143002, 0.0937500000000000, + 0.0990601562950723, 0.1038102529652301, 0.1081072380824156, + 0.1120300781475362, 0.1156387411919092, 0.1189798413143002, + 0.1220903311127662, 0.1250000000000000, 0.1277332137890731, + 0.1303101562950723, 0.1327477347951120, 0.1350602529652300, + 0.1372599194618363, 0.1393572380824156, 0.1413613111267817, + 0.1432800781475362, 0.1451205059304602, 0.1468887411919092, + 0.1485902344426084, 0.1502298413143002, 0.1518119060977367, + 0.1533403311127662, 0.1548186346995899, 0.1562500000000000, + 0.1576373162299517, 0.1589832137890731, 0.1602900942795302, + 0.1615601562950723, +}; +#else +static double str_bases[37] = { + 0.0000000000000000, 0.0000000000000000, 0.0625000000000000, + 0.0990601562950723, 0.1250000000000000, 0.1451205059304602, + 0.1615601562950723, 0.1754596826286003, 0.1875000000000000, + 0.1981203125901446, 0.2076205059304602, 0.2162144761648311, + 0.2240601562950723, 0.2312774823838183, 0.2379596826286003, + 0.2441806622255325, 0.2500000000000000, 0.2554664275781462, + 0.2606203125901445, 0.2654954695902241, 0.2701205059304602, + 0.2745198389236725, 0.2787144761648311, 0.2827226222535633, + 0.2865601562950723, 0.2902410118609203, 0.2937774823838183, + 0.2971804688852168, 0.3004596826286003, 0.3036238121954733, + 0.3066806622255324, 0.3096372693991797, 0.3125000000000000, + 0.3152746324599034, 0.3179664275781462, 0.3205801885590604, + 0.3231203125901446, +}; +#endif + +void +mpi_setstr(mpi *rop, char *str, int base) +{ + long i; /* counter */ + int sign; /* result sign */ + BNI carry; /* carry value */ + BNI value; /* temporary value */ + BNI size; /* size of result */ + char *ptr; /* end of valid input */ + + /* initialization */ + sign = 0; + carry = 0; + + /* skip leading spaces */ + while (isspace(*str)) + ++str; + + /* check if sign supplied */ + if (*str == '-') { + sign = 1; + ++str; + } + else if (*str == '+') + ++str; + + /* skip leading zeros */ + while (*str == '0') + ++str; + + ptr = str; + while (*ptr) { + if (*ptr >= '0' && *ptr <= '9') { + if (*ptr - '0' >= base) + break; + } + else if (*ptr >= 'A' && *ptr <= 'Z') { + if (*ptr - 'A' + 10 >= base) + break; + } + else if (*ptr >= 'a' && *ptr <= 'z') { + if (*ptr - 'a' + 10 >= base) + break; + } + else + break; + ++ptr; + } + + /* resulting size */ + size = (ptr - str) * str_bases[base] + 1; + + /* make sure rop has enough storage */ + if (rop->alloc < size) { + rop->digs = mp_realloc(rop->digs, size * sizeof(BNS)); + rop->alloc = size; + } + rop->size = size; + + /* initialize rop to zero */ + memset(rop->digs, '\0', size * sizeof(BNS)); + + /* set result sign */ + rop->sign = sign; + + /* convert string */ + for (; str < ptr; str++) { + value = *str; + if (islower(value)) + value = toupper(value); + value = value > '9' ? value - 'A' + 10 : value - '0'; + value += rop->digs[0] * base; + carry = value >> BNSBITS; + rop->digs[0] = (BNS)value; + for (i = 1; i < size; i++) { + value = (BNI)rop->digs[i] * base + carry; + carry = value >> BNSBITS; + rop->digs[i] = (BNS)value; + } + } + + /* normalize */ + if (rop->size > 1 && rop->digs[rop->size - 1] == 0) + --rop->size; +} + +void +mpi_add(mpi *rop, mpi *op1, mpi *op2) +{ + mpi_addsub(rop, op1, op2, 0); +} + +void +mpi_addi(mpi *rop, mpi *op1, long op2) +{ + BNS digs[2]; + mpi op; + + op.digs = (BNS*)digs; + _mpi_seti(&op, op2); + + mpi_addsub(rop, op1, &op, 0); +} + +void +mpi_sub(mpi *rop, mpi *op1, mpi *op2) +{ + mpi_addsub(rop, op1, op2, 1); +} + +void +mpi_subi(mpi *rop, mpi *op1, long op2) +{ + BNS digs[2]; + mpi op; + + op.digs = (BNS*)digs; + _mpi_seti(&op, op2); + + mpi_addsub(rop, op1, &op, 1); +} + +static void +mpi_addsub(mpi *rop, mpi *op1, mpi *op2, int sub) +{ + long xlen; /* maximum result size */ + + if (sub ^ (op1->sign == op2->sign)) { + /* plus one for possible carry */ + xlen = MAX(op1->size, op2->size) + 1; + if (rop->alloc < xlen) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xlen); + rop->alloc = xlen; + } + rop->size = mp_add(rop->digs, op1->digs, op2->digs, + op1->size, op2->size); + rop->sign = op1->sign; + } + else { + long cmp; /* check for larger operator */ + + cmp = mpi_cmpabs(op1, op2); + if (cmp == 0) { + rop->digs[0] = 0; + rop->size = 1; + rop->sign = 0; + } + else { + xlen = MAX(op1->size, op2->size); + if (rop->alloc < xlen) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xlen); + rop->alloc = xlen; + } + if (cmp > 0) { + rop->size = mp_sub(rop->digs, op1->digs, op2->digs, + op1->size, op2->size); + rop->sign = op1->sign; + } + else { + rop->size = mp_sub(rop->digs, op2->digs, op1->digs, + op2->size, op1->size); + rop->sign = sub ^ op2->sign; + } + } + } +} + +void +mpi_mul(mpi *rop, mpi *op1, mpi *op2) +{ + int sign; /* sign flag */ + BNS *digs; /* result data */ + long xsize; /* result size */ + + /* get result sign */ + sign = op1->sign ^ op2->sign; + + /* check for special cases */ + if (op1->size == 1) { + if (*op1->digs == 0) { + /* multiply by 0 */ + mpi_seti(rop, 0); + return; + } + else if (*op1->digs == 1) { + /* multiply by +-1 */ + if (rop->alloc < op2->size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op2->size); + rop->alloc = op2->size; + } + rop->size = op2->size; + memmove(rop->digs, op2->digs, sizeof(BNS) * op2->size); + rop->sign = op2->size > 1 || *op2->digs ? sign : 0; + + return; + } + } + else if (op2->size == 1) { + if (*op2->digs == 0) { + /* multiply by 0 */ + mpi_seti(rop, 0); + return; + } + else if (*op2->digs == 1) { + /* multiply by +-1 */ + if (rop->alloc < op1->size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op1->size); + rop->alloc = op1->size; + } + rop->size = op1->size; + memmove(rop->digs, op1->digs, sizeof(BNS) * op1->size); + rop->sign = op1->size > 1 || *op1->digs ? sign : 0; + + return; + } + } + + /* allocate result data and set it to zero */ + xsize = op1->size + op2->size; + if (rop->digs == op1->digs || rop->digs == op2->digs) + /* rop is also an operand */ + digs = mp_calloc(1, sizeof(BNS) * xsize); + else { + if (rop->alloc < xsize) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xsize); + rop->alloc = xsize; + } + digs = rop->digs; + memset(digs, '\0', sizeof(BNS) * xsize); + } + + /* multiply operands */ + xsize = mp_mul(digs, op1->digs, op2->digs, op1->size, op2->size); + + /* store result in rop */ + if (digs != rop->digs) { + /* if rop was an operand, free old data */ + mp_free(rop->digs); + rop->digs = digs; + } + rop->size = xsize; + + /* set result sign */ + rop->sign = sign; +} + +void +mpi_muli(mpi *rop, mpi *op1, long op2) +{ + BNS digs[2]; + mpi op; + + op.digs = (BNS*)digs; + _mpi_seti(&op, op2); + + mpi_mul(rop, op1, &op); +} + +void +mpi_div(mpi *rop, mpi *num, mpi *den) +{ + mpi_divqr(rop, NULL, num, den); +} + +void +mpi_rem(mpi *rop, mpi *num, mpi *den) +{ + mpi_divqr(NULL, rop, num, den); +} + +/* + * Could/should be changed to not allocate qdigs if qrop is NULL + * Performance wouldn't suffer too much with a test on every loop iteration. + */ +void +mpi_divqr(mpi *qrop, mpi *rrop, mpi *num, mpi *den) +{ + long i, j; /* counters */ + int qsign; /* sign of quotient */ + int rsign; /* sign of remainder */ + BNI qsize; /* size of quotient */ + BNI rsize; /* size of remainder */ + BNS qest; /* estimative of quotient value */ + BNS *qdigs, *rdigs; /* work copy or result */ + BNS *ndigs, *ddigs; /* work copy or divisor and dividend */ + BNI value; /* temporary result */ + long svalue; /* signed temporary result (2's complement) */ + BNS carry, scarry, denorm; /* carry and normalization */ + BNI dpos, npos; /* offsets in data */ + + /* get signs */ + rsign = num->sign; + qsign = rsign ^ den->sign; + + /* check for special case */ + if (num->size < den->size) { + /* quotient is zero and remainder is numerator */ + if (rrop && rrop->digs != num->digs) { + if (rrop->alloc < num->size) { + rrop->digs = mp_realloc(rrop->digs, sizeof(BNS) * num->size); + rrop->alloc = num->size; + } + rrop->size = num->size; + memcpy(rrop->digs, num->digs, sizeof(BNS) * num->size); + rrop->sign = rsign; + } + if (qrop) + mpi_seti(qrop, 0); + + return; + } + + /* estimate result sizes */ + rsize = den->size; + qsize = num->size - den->size + 1; + + /* offsets */ + npos = num->size - 1; + dpos = den->size - 1; + + /* allocate space for quotient and remainder */ + if (qrop == NULL || qrop->digs == num->digs || qrop->digs == den->digs) + qdigs = mp_calloc(1, sizeof(BNS) * qsize); + else { + if (qrop->alloc < qsize) { + qrop->digs = mp_realloc(qrop->digs, sizeof(BNS) * qsize); + qrop->alloc = qsize; + } + memset(qrop->digs, '\0', sizeof(BNS) * qsize); + qdigs = qrop->digs; + } + if (rrop) { + if (rrop->digs == num->digs || rrop->digs == den->digs) + rdigs = mp_calloc(1, sizeof(BNS) * rsize); + else { + if (rrop->alloc < rsize) { + rrop->digs = mp_realloc(rrop->digs, sizeof(BNS) * rsize); + rrop->alloc = rsize; + } + memset(rrop->digs, '\0', sizeof(BNS) * rsize); + rdigs = rrop->digs; + } + } + else + rdigs = NULL; /* fix gcc warning */ + + /* special case, only one word in divisor */ + if (dpos == 0) { + for (carry = 0, i = npos; i >= 0; i--) { + value = ((BNI)carry << BNSBITS) + num->digs[i]; + qdigs[i] = (BNS)(value / den->digs[0]); + carry = (BNS)(value % den->digs[0]); + } + if (rrop) + rdigs[0] = carry; + + goto mpi_divqr_done; + } + + /* make work copy of numerator */ + ndigs = mp_malloc(sizeof(BNS) * (num->size + 1)); + /* allocate one extra word an update offset */ + memcpy(ndigs, num->digs, sizeof(BNS) * num->size); + ndigs[num->size] = 0; + ++npos; + + /* normalize */ + denorm = (BNS)((BNI)CARRY / ((BNI)(den->digs[dpos]) + 1)); + + if (denorm > 1) { + /* i <= num->size because ndigs has an extra word */ + for (carry = 0, i = 0; i <= num->size; i++) { + value = ndigs[i] * (BNI)denorm + carry; + ndigs[i] = (BNS)value; + carry = (BNS)(value >> BNSBITS); + } + /* make work copy of denominator */ + ddigs = mp_malloc(sizeof(BNS) * den->size); + memcpy(ddigs, den->digs, sizeof(BNS) * den->size); + for (carry = 0, i = 0; i < den->size; i++) { + value = ddigs[i] * (BNI)denorm + carry; + ddigs[i] = (BNS)value; + carry = (BNS)(value >> BNSBITS); + } + } + else + /* only allocate copy of denominator if going to change it */ + ddigs = den->digs; + + /* divide mp integers */ + for (j = qsize - 1; j >= 0; j--, npos--) { + /* estimate quotient */ + if (ndigs[npos] == ddigs[dpos]) + qest = (BNS)SMASK; + else + qest = (BNS)((((BNI)(ndigs[npos]) << 16) + ndigs[npos - 1]) / + ddigs[dpos]); + + while ((value = ((BNI)(ndigs[npos]) << 16) + ndigs[npos - 1] - + qest * (BNI)(ddigs[dpos])) < CARRY && + ddigs[dpos - 1] * (BNI)qest > + (value << BNSBITS) + ndigs[npos - 2]) + --qest; + + /* multiply and subtract */ + carry = scarry = 0; + for (i = 0; i < den->size; i++) { + value = qest * (BNI)ddigs[i] + carry; + carry = (BNS)(value >> BNSBITS); + svalue = (long)ndigs[npos - dpos + i - 1] - (long)(value & SMASK) - + (long)scarry; + ndigs[npos - dpos + i - 1] = (BNS)svalue; + scarry = svalue < 0; + } + + svalue = (long)ndigs[npos] - (long)(carry & SMASK) - (long)scarry; + ndigs[npos] = (BNS)svalue; + + if (svalue & LMASK) { + /* quotient too big */ + --qest; + carry = 0; + for (i = 0; i < den->size; i++) { + value = ndigs[npos - dpos + i - 1] + (BNI)carry + (BNI)ddigs[i]; + ndigs[npos - dpos + i - 1] = (BNS)value; + carry = (BNS)(value >> BNSBITS); + } + ndigs[npos] += carry; + } + + qdigs[j] = qest; + } + + /* calculate remainder */ + if (rrop) { + for (carry = 0, j = dpos; j >= 0; j--) { + value = ((BNI)carry << BNSBITS) + ndigs[j]; + rdigs[j] = (BNS)(value / denorm); + carry = (BNS)(value % denorm); + } + } + + mp_free(ndigs); + if (ddigs != den->digs) + mp_free(ddigs); + +mpi_divqr_done: + if (rrop) { + if (rrop->digs != rdigs) + mp_free(rrop->digs); + /* normalize remainder */ + for (i = rsize - 1; i >= 0; i--) + if (rdigs[i] != 0) + break; + if (i != rsize - 1) { + if (i < 0) { + rsign = 0; + rsize = 1; + } + else + rsize = i + 1; + } + rrop->digs = rdigs; + rrop->sign = rsign; + rrop->size = rsize; + } + + /* normalize quotient */ + if (qrop) { + if (qrop->digs != qdigs) + mp_free(qrop->digs); + for (i = qsize - 1; i >= 0; i--) + if (qdigs[i] != 0) + break; + if (i != qsize - 1) { + if (i < 0) { + qsign = 0; + qsize = 1; + } + else + qsize = i + 1; + } + qrop->digs = qdigs; + qrop->sign = qsign; + qrop->size = qsize; + } + else + mp_free(qdigs); +} + +long +mpi_divqri(mpi *qrop, mpi *num, long den) +{ + BNS ddigs[2]; + mpi dop, rrop; + long remainder; + + dop.digs = (BNS*)ddigs; + _mpi_seti(&dop, den); + + memset(&rrop, '\0', sizeof(mpi)); + mpi_init(&rrop); + mpi_divqr(qrop, &rrop, num, &dop); + remainder = rrop.digs[0]; + if (rrop.size > 1) + remainder |= (BNI)(rrop.digs[1]) << BNSBITS; + if (rrop.sign) + remainder = -remainder; + mpi_clear(&rrop); + + return (remainder); +} + +void +mpi_divi(mpi *rop, mpi *num, long den) +{ + BNS ddigs[2]; + mpi dop; + + dop.digs = (BNS*)ddigs; + _mpi_seti(&dop, den); + + mpi_divqr(rop, NULL, num, &dop); +} + +long +mpi_remi(mpi *num, long den) +{ + return (mpi_divqri(NULL, num, den)); +} + +void +mpi_mod(mpi *rop, mpi *num, mpi *den) +{ + mpi_rem(rop, num, den); + if (num->sign ^ den->sign) + mpi_add(rop, rop, den); +} + +long +mpi_modi(mpi *num, long den) +{ + long remainder; + + remainder = mpi_remi(num, den); + if (num->sign ^ (den < 0)) + remainder += den; + + return (remainder); +} + +void +mpi_gcd(mpi *rop, mpi *num, mpi *den) +{ + long cmp; + mpi rem; + + /* check if result already given */ + cmp = mpi_cmpabs(num, den); + + /* check if num is equal to den or if num is zero */ + if (cmp == 0 || (num->size == 1 && num->digs[0] == 0)) { + mpi_set(rop, den); + rop->sign = 0; + return; + } + /* check if den is not zero */ + if (den->size == 1 && den->digs[0] == 0) { + mpi_set(rop, num); + rop->sign = 0; + return; + } + + /* don't call mpi_init, relies on realloc(0, size) == malloc(size) */ + memset(&rem, '\0', sizeof(mpi)); + + /* if num larger than den */ + if (cmp > 0) { + mpi_rem(&rem, num, den); + if (rem.size == 1 && rem.digs[0] == 0) { + /* exact division */ + mpi_set(rop, den); + rop->sign = 0; + mpi_clear(&rem); + return; + } + mpi_set(rop, den); + } + else { + mpi_rem(&rem, den, num); + if (rem.size == 1 && rem.digs[0] == 0) { + /* exact division */ + mpi_set(rop, num); + rop->sign = 0; + mpi_clear(&rem); + return; + } + mpi_set(rop, num); + } + + /* loop using positive values */ + rop->sign = rem.sign = 0; + + /* cannot optimize this inverting rem/rop assignment earlier + * because rop mais be an operand */ + mpi_swap(rop, &rem); + + /* Euclides algorithm */ + for (;;) { + mpi_rem(&rem, &rem, rop); + if (rem.size == 1 && rem.digs[0] == 0) + break; + mpi_swap(rop, &rem); + } + mpi_clear(&rem); +} + +void +mpi_lcm(mpi *rop, mpi *num, mpi *den) +{ + mpi gcd; + + /* check for zero operand */ + if ((num->size == 1 && num->digs[0] == 0) || + (den->size == 1 && den->digs[0] == 0)) { + rop->digs[0] = 0; + rop->sign = 0; + return; + } + + /* don't call mpi_init, relies on realloc(0, size) == malloc(size) */ + memset(&gcd, '\0', sizeof(mpi)); + + mpi_gcd(&gcd, num, den); + mpi_div(&gcd, den, &gcd); + mpi_mul(rop, &gcd, num); + rop->sign = 0; + + mpi_clear(&gcd); +} + +void +mpi_pow(mpi *rop, mpi *op, unsigned long exp) +{ + mpi zop, top; + + if (exp == 2) { + mpi_mul(rop, op, op); + return; + } + /* check for op**0 */ + else if (exp == 0) { + rop->digs[0] = 1; + rop->size = 1; + rop->sign = 0; + return; + } + else if (exp == 1) { + mpi_set(rop, op); + return; + } + else if (op->size == 1) { + if (op->digs[0] == 0) { + mpi_seti(rop, 0); + return; + } + else if (op->digs[0] == 1) { + mpi_seti(rop, op->sign && (exp & 1) ? -1 : 1); + return; + } + } + + memset(&zop, '\0', sizeof(mpi)); + memset(&top, '\0', sizeof(mpi)); + mpi_set(&zop, op); + mpi_set(&top, op); + for (--exp; exp; exp >>= 1) { + if (exp & 1) + mpi_mul(&zop, &top, &zop); + mpi_mul(&top, &top, &top); + } + + mpi_clear(&top); + rop->sign = zop.sign; + mp_free(rop->digs); + rop->digs = zop.digs; + rop->size = zop.size; +} + +/* Find integer root of given number using the iteration + * x{n+1} = ((K-1) * x{n} + N / x{n}^(K-1)) / K + */ +int +mpi_root(mpi *rop, mpi *op, unsigned long nth) +{ + long bits, cmp; + int exact; + int sign; + mpi *r, t, temp, quot, old, rem; + + sign = op->sign; + + /* divide by zero op**1/0 */ + if (nth == 0) { + int one = 1, zero = 0; + one = one / zero; + } + /* result is complex */ + if (sign && !(nth & 1)) { + int one = 1, zero = 0; + one = one / zero; + } + + /* special case op**1/1 = op */ + if (nth == 1) { + mpi_set(rop, op); + return (1); + } + + bits = mpi_getsize(op, 2) - 2; + + if (bits < 0 || bits / nth == 0) { + /* integral root is surely less than 2 */ + exact = op->size == 1 && (op->digs[0] == 1 || op->digs[0] == 0); + mpi_seti(rop, sign ? -1 : op->digs[0] == 0 ? 0 : 1); + + return (exact == 1); + } + + /* initialize */ + if (rop != op) + r = rop; + else { + r = &t; + memset(r, '\0', sizeof(mpi)); + } + memset(&temp, '\0', sizeof(mpi)); + memset(", '\0', sizeof(mpi)); + memset(&old, '\0', sizeof(mpi)); + memset(&rem, '\0', sizeof(mpi)); + + if (sign) + r->sign = 0; + + /* root aproximation */ + mpi_ash(r, op, -(bits - (bits / nth))); + + for (;;) { + mpi_pow(&temp, r, nth - 1); + mpi_divqr(", &rem, op, &temp); + cmp = mpi_cmpabs(r, "); + if (cmp == 0) { + exact = mpi_cmpi(&rem, 0) == 0; + break; + } + else if (cmp < 0) { + if (mpi_cmpabs(r, &old) == 0) { + exact = 0; + break; + } + mpi_set(&old, r); + } + mpi_muli(&temp, r, nth - 1); + mpi_add(", ", &temp); + mpi_divi(r, ", nth); + } + + mpi_clear(&temp); + mpi_clear("); + mpi_clear(&old); + mpi_clear(&rem); + if (r != rop) { + mpi_set(rop, r); + mpi_clear(r); + } + rop->sign = sign; + + return (exact); +} + +/* + * Find square root using the iteration: + * x{n+1} = (x{n}+N/x{n})/2 + */ +int +mpi_sqrt(mpi *rop, mpi *op) +{ + long bits, cmp; + int exact; + mpi *r, t, quot, rem, old; + + /* result is complex */ + if (op->sign) { + int one = 1, zero = 0; + one = one / zero; + } + + bits = mpi_getsize(op, 2) - 2; + + if (bits < 2) { + /* integral root is surely less than 2 */ + exact = op->size == 1 && (op->digs[0] == 1 || op->digs[0] == 0); + mpi_seti(rop, op->digs[0] == 0 ? 0 : 1); + + return (exact == 1); + } + + /* initialize */ + if (rop != op) + r = rop; + else { + r = &t; + memset(r, '\0', sizeof(mpi)); + } + memset(", '\0', sizeof(mpi)); + memset(&rem, '\0', sizeof(mpi)); + memset(&old, '\0', sizeof(mpi)); + + /* root aproximation */ + mpi_ash(r, op, -(bits - (bits / 2))); + + for (;;) { + if (mpi_cmpabs(r, &old) == 0) { + exact = 0; + break; + } + mpi_divqr(", &rem, op, r); + cmp = mpi_cmpabs(", r); + if (cmp == 0) { + exact = mpi_cmpi(&rem, 0) == 0; + break; + } + else if (cmp > 0 && rem.size == 1 && rem.digs[0] == 0) + mpi_subi(", ", 1); + mpi_set(&old, r); + mpi_add(r, r, "); + mpi_ash(r, r, -1); + } + mpi_clear("); + mpi_clear(&rem); + mpi_clear(&old); + if (r != rop) { + mpi_set(rop, r); + mpi_clear(r); + } + + return (exact); +} + +void +mpi_ash(mpi *rop, mpi *op, long shift) +{ + long i; /* counter */ + long xsize; /* maximum result size */ + BNS *digs; + + /* check for 0 shift, multiply/divide by 1 */ + if (shift == 0) { + if (rop != op) { + if (rop->alloc < op->size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op->size); + rop->alloc = op->size; + } + rop->size = op->size; + memcpy(rop->digs, op->digs, sizeof(BNS) * op->size); + } + + return; + } + else if (op->size == 1 && op->digs[0] == 0) { + rop->sign = 0; + rop->size = 1; + rop->digs[0] = 0; + + return; + } + + /* check shift and initialize */ + if (shift > 0) + xsize = op->size + (shift / BNSBITS) + 1; + else { + xsize = op->size - ((-shift) / BNSBITS); + if (xsize <= 0) { + rop->size = 1; + rop->sign = op->sign; + rop->digs[0] = op->sign ? 1 : 0; + + return; + } + } + + /* allocate/adjust memory for result */ + if (rop == op) + digs = mp_malloc(sizeof(BNS) * xsize); + else { + if (rop->alloc < xsize) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xsize); + rop->alloc = xsize; + } + digs = rop->digs; + } + + /* left shift, multiply by power of two */ + if (shift > 0) + rop->size = mp_lshift(digs, op->digs, op->size, shift); + /* right shift, divide by power of two */ + else { + long carry = 0; + + if (op->sign) { + BNI words, bits; + + words = -shift / BNSBITS; + bits = -shift % BNSBITS; + for (i = 0; i < words; i++) + carry |= op->digs[xsize + i]; + if (!carry) { + for (i = 0; i < bits; i++) + if (op->digs[op->size - xsize] & (1 << i)) { + carry = 1; + break; + } + } + } + rop->size = mp_rshift(digs, op->digs, op->size, -shift); + + if (carry) + /* emulates two's complement subtracting 1 from the result */ + rop->size = mp_add(digs, digs, mpone.digs, rop->size, 1); + } + + if (rop->digs != digs) { + mp_free(rop->digs); + rop->alloc = rop->size; + rop->digs = digs; + } + rop->sign = op->sign; +} + +static INLINE BNS +mpi_logic(BNS op1, BNS op2, BNS op) +{ + switch (op) { + case '&': + return (op1 & op2); + case '|': + return (op1 | op2); + case '^': + return (op1 ^ op2); + } + + return (SMASK); +} + +static void +mpi_log(mpi *rop, mpi *op1, mpi *op2, BNS op) +{ + long i; /* counter */ + long c, c1, c2; /* carry */ + BNS *digs, *digs1, *digs2; /* pointers to mp data */ + BNI size, size1, size2; + BNS sign, sign1, sign2; + BNS n, n1, n2; /* logical operands */ + BNI sum; + + /* initialize */ + size1 = op1->size; + size2 = op2->size; + + sign1 = op1->sign ? SMASK : 0; + sign2 = op2->sign ? SMASK : 0; + + sign = mpi_logic(sign1, sign2, op); + + size = MAX(size1, size2); + if (sign) + ++size; + if (rop->alloc < size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size); + rop->alloc = size; + } + + digs = rop->digs; + digs1 = op1->digs; + digs2 = op2->digs; + + c = c1 = c2 = 1; + + /* apply logical operation */ + for (i = 0; i < size; i++) { + if (i >= size1) + n1 = sign1; + else if (sign1) { + sum = (BNI)(BNS)(~digs1[i]) + c1; + c1 = (long)(sum >> BNSBITS); + n1 = (BNS)sum; + } + else + n1 = digs1[i]; + + if (i >= size2) + n2 = sign2; + else if (sign2) { + sum = (BNI)(BNS)(~digs2[i]) + c2; + c2 = (long)(sum >> BNSBITS); + n2 = (BNS)sum; + } + else + n2 = digs2[i]; + + n = mpi_logic(n1, n2, op); + if (sign) { + sum = (BNI)(BNS)(~n) + c; + c = (long)(sum >> BNSBITS); + digs[i] = (BNS)sum; + } + else + digs[i] = n; + } + + /* normalize */ + for (i = size - 1; i >= 0; i--) + if (digs[i] != 0) + break; + if (i != size - 1) { + if (i < 0) { + sign = 0; + size = 1; + } + else + size = i + 1; + } + + rop->sign = sign != 0; + rop->size = size; +} + +void +mpi_and(mpi *rop, mpi *op1, mpi *op2) +{ + mpi_log(rop, op1, op2, '&'); +} + +void +mpi_ior(mpi *rop, mpi *op1, mpi *op2) +{ + mpi_log(rop, op1, op2, '|'); +} + +void +mpi_xor(mpi *rop, mpi *op1, mpi *op2) +{ + mpi_log(rop, op1, op2, '^'); +} + +void +mpi_com(mpi *rop, mpi *op) +{ + static BNS digs[1] = { 1 }; + static mpi one = { 0, 1, 1, (BNS*)&digs }; + + mpi_log(rop, rop, &one, '^'); +} + +void +mpi_neg(mpi *rop, mpi *op) +{ + int sign = op->sign ^ 1; + + if (rop->digs != op->digs) { + if (rop->alloc < op->size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * rop->size); + rop->alloc = op->size; + } + rop->size = op->size; + memcpy(rop->digs, op->digs, sizeof(BNS) * rop->size); + } + + rop->sign = sign; +} + +void +mpi_abs(mpi *rop, mpi *op) +{ + if (rop->digs != op->digs) { + if (rop->alloc < op->size) { + rop->digs = mp_realloc(rop->digs, sizeof(BNS) * rop->size); + rop->alloc = op->size; + } + rop->size = op->size; + memcpy(rop->digs, op->digs, sizeof(BNS) * rop->size); + } + + rop->sign = 0; +} + +int +mpi_cmp(mpi *op1, mpi *op2) +{ + if (op1->sign ^ op2->sign) + return (op1->sign ? -1 : 1); + + if (op1->size == op2->size) { + long i, cmp = 0; + + for (i = op1->size - 1; i >= 0; i--) + if ((cmp = (long)op1->digs[i] - (long)op2->digs[i]) != 0) + break; + + return (cmp == 0 ? 0 : (cmp < 0) ^ op1->sign ? -1 : 1); + } + + return ((op1->size < op2->size) ^ op1->sign ? -1 : 1); +} + +int +mpi_cmpi(mpi *op1, long op2) +{ + long cmp; + + if (op1->size > 2) + return (op1->sign ? -1 : 1); + + cmp = op1->digs[0]; + if (op1->size == 2) { + cmp |= (long)op1->digs[1] << BNSBITS; + if (cmp == MINSLONG) + return (op2 == cmp && op1->sign ? 0 : op1->sign ? -1 : 1); + } + if (op1->sign) + cmp = -cmp; + + return (cmp - op2); +} + +int +mpi_cmpabs(mpi *op1, mpi *op2) +{ + if (op1->size == op2->size) { + long i, cmp = 0; + + for (i = op1->size - 1; i >= 0; i--) + if ((cmp = (long)op1->digs[i] - (long)op2->digs[i]) != 0) + break; + + return (cmp); + } + + return ((op1->size < op2->size) ? -1 : 1); +} + +int +mpi_cmpabsi(mpi *op1, long op2) +{ + unsigned long cmp; + + if (op1->size > 2) + return (1); + + cmp = op1->digs[0]; + if (op1->size == 2) + cmp |= (unsigned long)op1->digs[1] << BNSBITS; + + return (cmp > op2 ? 1 : cmp == op2 ? 0 : -1); +} + +int +mpi_sgn(mpi *op) +{ + return (op->sign ? -1 : op->size > 1 || op->digs[0] ? 1 : 0); +} + +void +mpi_swap(mpi *op1, mpi *op2) +{ + if (op1 != op2) { + mpi swap; + + memcpy(&swap, op1, sizeof(mpi)); + memcpy(op1, op2, sizeof(mpi)); + memcpy(op2, &swap, sizeof(mpi)); + } +} + +int +mpi_fiti(mpi *op) +{ + if (op->size == 1) + return (1); + else if (op->size == 2) { + unsigned long value = ((BNI)(op->digs[1]) << BNSBITS) | op->digs[0]; + + if (value & MINSLONG) + return (op->sign && value == MINSLONG) ? 1 : 0; + + return (1); + } + + return (0); +} + +long +mpi_geti(mpi *op) +{ + long value; + + value = op->digs[0]; + if (op->size > 1) + value |= (BNI)(op->digs[1]) << BNSBITS; + + return (op->sign && value != MINSLONG ? -value : value); +} + +double +mpi_getd(mpi *op) +{ + long i, len; + double d = 0.0; + int exponent; + +#define FLOATDIGS sizeof(double) / sizeof(BNS) + + switch (op->size) { + case 2: + d = (BNI)(op->digs[1]) << BNSBITS; + case 1: + d += op->digs[0]; + return (op->sign ? -d : d); + default: + break; + } + + for (i = 0, len = op->size; len > 0 && i < FLOATDIGS; i++) + d = ldexp(d, BNSBITS) + op->digs[--len]; + d = frexp(d, &exponent); + if (len > 0) + exponent += len * BNSBITS; + + if (d == 0.0) + return (d); + + d = ldexp(d, exponent); + + return (op->sign ? -d : d); +} + +/* how many digits in a given base, floor(log(CARRY) / log(base)) */ +#ifdef LONG64 +static char dig_bases[37] = { + 0, 0, 32, 20, 16, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, + 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, +}; +#else +static char dig_bases[37] = { + 0, 0, 16, 10, 8, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, + 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, +}; +#endif + +/* how many digits per bit in a given base, log(2) / log(base) */ +static double bit_bases[37] = { + 0.0000000000000000, 0.0000000000000000, 1.0000000000000000, + 0.6309297535714575, 0.5000000000000000, 0.4306765580733931, + 0.3868528072345416, 0.3562071871080222, 0.3333333333333334, + 0.3154648767857287, 0.3010299956639811, 0.2890648263178878, + 0.2789429456511298, 0.2702381544273197, 0.2626495350371936, + 0.2559580248098155, 0.2500000000000000, 0.2446505421182260, + 0.2398124665681315, 0.2354089133666382, 0.2313782131597592, + 0.2276702486969530, 0.2242438242175754, 0.2210647294575037, + 0.2181042919855316, 0.2153382790366965, 0.2127460535533632, + 0.2103099178571525, 0.2080145976765095, 0.2058468324604344, + 0.2037950470905062, 0.2018490865820999, 0.2000000000000000, + 0.1982398631705605, 0.1965616322328226, 0.1949590218937863, + 0.1934264036172708, +}; + +/* normalization base for string conversion, pow(base, dig_bases[base]) & ~CARRY */ +#ifdef LONG64 +static BNS big_bases[37] = { + 0x00000001, 0x00000001, 0x00000000, 0xCFD41B91, 0x00000000, 0x48C27395, + 0x81BF1000, 0x75DB9C97, 0x40000000, 0xCFD41B91, 0x3B9ACA00, 0x8C8B6D2B, + 0x19A10000, 0x309F1021, 0x57F6C100, 0x98C29B81, 0x00000000, 0x18754571, + 0x247DBC80, 0x3547667B, 0x4C4B4000, 0x6B5A6E1D, 0x94ACE180, 0xCAF18367, + 0x0B640000, 0x0E8D4A51, 0x1269AE40, 0x17179149, 0x1CB91000, 0x23744899, + 0x2B73A840, 0x34E63B41, 0x40000000, 0x4CFA3CC1, 0x5C13D840, 0x6D91B519, + 0x81BF1000, +}; +#else +static BNS big_bases[37] = { + 0x0001, 0x0001, 0x0000, 0xE6A9, 0x0000, 0x3D09, 0xB640, 0x41A7, 0x8000, + 0xE6A9, 0x2710, 0x3931, 0x5100, 0x6F91, 0x9610, 0xC5C1, 0x0000, 0x1331, + 0x16C8, 0x1ACB, 0x1F40, 0x242D, 0x2998, 0x2F87, 0x3600, 0x3D09, 0x44A8, + 0x4CE3, 0x55C0, 0x5F45, 0x6978, 0x745F, 0x8000, 0x8C61, 0x9988, 0xA77B, + 0xb640, +}; +#endif + +unsigned long +mpi_getsize(mpi *op, int base) +{ + unsigned long value, bits; + + value = op->digs[op->size - 1]; + + /* count leading bits */ + if (value) { + unsigned long count, carry; + + for (count = 0, carry = CARRY >> 1; carry; count++, carry >>= 1) + if (value & carry) + break; + + bits = BNSBITS - count; + } + else + bits = 0; + + return ((bits + (op->size - 1) * BNSBITS) * bit_bases[base] + 1); +} + +char * +mpi_getstr(char *str, mpi *op, int base) +{ + long i; /* counter */ + BNS *digs, *xdigs; /* copy of op data */ + BNI size; /* size of op */ + BNI digits; /* digits per word in given base */ + BNI bigbase; /* big base of given base */ + BNI strsize; /* size of resulting string */ + char *cp; /* pointer in str for conversion */ + + /* initialize */ + size = op->size; + strsize = mpi_getsize(op, base) + op->sign + 1; + + if (str == NULL) + str = mp_malloc(strsize); + + /* check for zero */ + if (size == 1 && op->digs[0] == 0) { + str[0] = '0'; + str[1] = '\0'; + + return (str); + } + + digits = dig_bases[base]; + bigbase = big_bases[base]; + + cp = str + strsize; + *--cp = '\0'; + + /* make copy of op data and adjust digs */ + xdigs = mp_malloc(size * sizeof(BNS)); + memcpy(xdigs, op->digs, size * sizeof(unsigned short)); + digs = xdigs + size - 1; + + /* convert to string */ + for (;;) { + long count = -1; + BNI value; + BNS quotient, remainder = 0; + + /* if power of two base */ + if ((base & (base - 1)) == 0) { + for (i = 0; i < size; i++) { + quotient = remainder; + remainder = digs[-i]; + digs[-i] = quotient; + if (count < 0 && quotient) + count = i; + } + } + else { + for (i = 0; i < size; i++) { + value = digs[-i] + ((BNI)remainder << BNSBITS); + quotient = (BNS)(value / bigbase); + remainder = (BNS)(value % bigbase); + digs[-i] = quotient; + if (count < 0 && quotient) + count = i; + } + } + quotient = remainder; + for (i = 0; i < digits; i++) { + if (quotient == 0 && count < 0) + break; + remainder = quotient % base; + quotient /= base; + *--cp = remainder < 10 ? remainder + '0' : remainder - 10 + 'A'; + } + if (count < 0) + break; + digs -= count; + size -= count; + } + + /* adjust sign */ + if (op->sign) + *--cp = '-'; + + /* remove any extra characters */ + if (cp > str) + strcpy(str, cp); + + mp_free(xdigs); + + return (str); +} Index: xc/programs/xedit/lisp/mp/mpr.c diff -u /dev/null xc/programs/xedit/lisp/mp/mpr.c:1.2 --- /dev/null Thu Feb 27 12:35:01 2003 +++ xc/programs/xedit/lisp/mp/mpr.c Fri Nov 8 03:01:00 2002 @@ -0,0 +1,436 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/mp/mpr.c,v 1.2 2002/11/08 08:01:00 paulo Exp $ */ + +#include "mp.h" + +/* + * TODO: + * Implement a fast gcd and divexact for integers, so that this code + * could be changed to do intermediary calculations faster using smaller + * numbers. + */ + +/* + * Prototypes + */ + /* do the hard work of mpr_add and mpr_sub */ +static void mpr_addsub(mpr *rop, mpr *op1, mpr *op2, int sub); + + /* do the hard work of mpr_cmp and mpr_cmpabs */ +static int mpr_docmp(mpr *op1, mpr *op2, int sign); + +/* + * Implementation + */ +void +mpr_init(mpr *op) +{ + op->num.digs = mp_malloc(sizeof(BNS)); + op->num.sign = 0; + op->num.size = op->num.alloc = 1; + op->num.digs[0] = 0; + + op->den.digs = mp_malloc(sizeof(BNS)); + op->den.sign = 0; + op->den.size = op->den.alloc = 1; + op->den.digs[0] = 1; +} + +void +mpr_clear(mpr *op) +{ + op->num.sign = 0; + op->num.size = op->num.alloc = 0; + mp_free(op->num.digs); + + op->den.sign = 0; + op->den.size = op->den.alloc = 0; + mp_free(op->den.digs); +} + +void +mpr_set(mpr *rop, mpr *op) +{ + if (rop != op) { + mpi_set(mpr_num(rop), mpr_num(op)); + mpi_set(mpr_den(rop), mpr_den(op)); + } +} + +void +mpr_seti(mpr *rop, long num, long den) +{ + mpi_seti(mpr_num(rop), num); + mpi_seti(mpr_den(rop), den); +} + +void +mpr_setd(mpr *rop, double d) +{ + double val, num; + int e, sign; + + /* initialize */ + if (d < 0) { + sign = 1; + val = -d; + } + else { + sign = 0; + val = d; + } + + val = frexp(val, &e); + while (modf(val, &num) != 0.0 && val <= DBL_MAX / 2.0) { + --e; + val *= 2.0; + } + if (e >= 0) { + mpi_setd(mpr_num(rop), d); + mpi_seti(mpr_den(rop), 1); + } + else { + mpi_setd(mpr_num(rop), sign ? -num : num); + mpi_setd(mpr_den(rop), ldexp(1.0, -e)); + } +} + +void +mpr_setstr(mpr *rop, char *str, int base) +{ + char *slash = strchr(str, '/'); + + mpi_setstr(mpr_num(rop), str, base); + if (slash != NULL) + mpi_setstr(mpr_den(rop), slash + 1, base); + else + mpi_seti(mpr_den(rop), 1); +} + +void +mpr_canonicalize(mpr *op) +{ + mpi gcd; + + memset(&gcd, '\0', sizeof(mpi)); + + mpi_gcd(&gcd, mpr_num(op), mpr_den(op)); + if (mpi_cmpabsi(&gcd, 1)) { + mpi_div(mpr_num(op), mpr_num(op), &gcd); + mpi_div(mpr_den(op), mpr_den(op), &gcd); + } + + if (op->den.sign) { + op->num.sign = !op->num.sign; + op->den.sign = 0; + } + + mpi_clear(&gcd); +} + +void +mpr_add(mpr *rop, mpr *op1, mpr *op2) +{ + mpr_addsub(rop, op1, op2, 0); +} + +void +mpr_addi(mpr *rop, mpr *op1, long op2) +{ + mpi prod; + + memset(&prod, '\0', sizeof(mpi)); + + mpi_muli(&prod, mpr_den(op1), op2); + mpi_add(mpr_num(rop), mpr_num(op1), &prod); + mpi_clear(&prod); +} + +void +mpr_sub(mpr *rop, mpr *op1, mpr *op2) +{ + mpr_addsub(rop, op1, op2, 1); +} + +void +mpr_subi(mpr *rop, mpr *op1, long op2) +{ + mpi prod; + + memset(&prod, '\0', sizeof(mpi)); + + mpi_muli(&prod, mpr_den(op1), op2); + mpi_sub(mpr_num(rop), mpr_num(op1), &prod); + mpi_clear(&prod); +} + +static void +mpr_addsub(mpr *rop, mpr *op1, mpr *op2, int sub) +{ + mpi prod1, prod2; + + memset(&prod1, '\0', sizeof(mpi)); + memset(&prod2, '\0', sizeof(mpi)); + + mpi_mul(&prod1, mpr_num(op1), mpr_den(op2)); + mpi_mul(&prod2, mpr_num(op2), mpr_den(op1)); + + if (sub) + mpi_sub(mpr_num(rop), &prod1, &prod2); + else + mpi_add(mpr_num(rop), &prod1, &prod2); + + mpi_clear(&prod1); + mpi_clear(&prod2); + + mpi_mul(mpr_den(rop), mpr_den(op1), mpr_den(op2)); +} + +void +mpr_mul(mpr *rop, mpr *op1, mpr *op2) +{ + /* check if temporary storage is required */ + if (op1 == op2 && rop == op1) { + mpi prod; + + memset(&prod, '\0', sizeof(mpi)); + + mpi_mul(&prod, mpr_num(op1), mpr_num(op2)); + mpi_mul(mpr_den(rop), mpr_den(op1), mpr_den(op2)); + mpi_set(mpr_num(rop), &prod); + + mpi_clear(&prod); + } + else { + mpi_mul(mpr_num(rop), mpr_num(op1), mpr_num(op2)); + mpi_mul(mpr_den(rop), mpr_den(op1), mpr_den(op2)); + } +} + +void +mpr_muli(mpr *rop, mpr *op1, long op2) +{ + mpi_muli(mpr_num(rop), mpr_num(op1), op2); +} + +void +mpr_div(mpr *rop, mpr *op1, mpr *op2) +{ + /* check if temporary storage is required */ + if (op1 == op2 && rop == op1) { + mpi prod; + + memset(&prod, '\0', sizeof(mpi)); + + mpi_mul(&prod, mpr_num(op1), mpr_den(op2)); + mpi_mul(mpr_den(rop), mpr_num(op2), mpr_den(op1)); + mpi_set(mpr_num(rop), &prod); + + mpi_clear(&prod); + } + else { + mpi_mul(mpr_num(rop), mpr_num(op1), mpr_den(op2)); + mpi_mul(mpr_den(rop), mpr_num(op2), mpr_den(op1)); + } +} + +void +mpr_divi(mpr *rop, mpr *op1, long op2) +{ + mpi_muli(mpr_den(rop), mpr_den(op1), op2); +} + +void +mpr_inv(mpr *rop, mpr *op) +{ + if (rop == op) + mpi_swap(mpr_num(op), mpr_den(op)); + else { + mpi_set(mpr_num(rop), mpr_den(op)); + mpi_set(mpr_den(rop), mpr_num(op)); + } +} + +void +mpr_neg(mpr *rop, mpr *op) +{ + mpi_neg(mpr_num(rop), mpr_num(op)); + mpi_set(mpr_den(rop), mpr_den(op)); +} + +void +mpr_abs(mpr *rop, mpr *op) +{ + if (mpr_num(op)->sign) + mpi_neg(mpr_num(rop), mpr_num(op)); + else + mpi_set(mpr_num(rop), mpr_num(op)); + + /* op may not be canonicalized */ + if (mpr_den(op)->sign) + mpi_neg(mpr_den(rop), mpr_den(op)); + else + mpi_set(mpr_den(rop), mpr_den(op)); +} + +int +mpr_cmp(mpr *op1, mpr *op2) +{ + return (mpr_docmp(op1, op2, 1)); +} + +int +mpr_cmpi(mpr *op1, long op2) +{ + int cmp; + mpr rat; + + mpr_init(&rat); + mpi_seti(mpr_num(&rat), op2); + cmp = mpr_docmp(op1, &rat, 1); + mpr_clear(&rat); + + return (cmp); +} + +int +mpr_cmpabs(mpr *op1, mpr *op2) +{ + return (mpr_docmp(op1, op2, 0)); +} + +int +mpr_cmpabsi(mpr *op1, long op2) +{ + int cmp; + mpr rat; + + mpr_init(&rat); + mpi_seti(mpr_num(&rat), op2); + cmp = mpr_docmp(op1, &rat, 0); + mpr_clear(&rat); + + return (cmp); +} + +static int +mpr_docmp(mpr *op1, mpr *op2, int sign) +{ + int cmp, neg; + mpi prod1, prod2; + + neg = 0; + if (sign) { + /* if op1 is negative */ + if (mpr_num(op1)->sign ^ mpr_den(op1)->sign) { + /* if op2 is positive */ + if (!(mpr_num(op2)->sign ^ mpr_den(op2)->sign)) + return (-1); + else + neg = 1; + } + /* if op2 is negative */ + else if (mpr_num(op2)->sign ^ mpr_den(op2)->sign) + return (1); + /* else same sign */ + } + + /* if denominators are equal, compare numerators */ + if (mpi_cmpabs(mpr_den(op1), mpr_den(op2)) == 0) { + cmp = mpi_cmpabs(mpr_num(op1), mpr_num(op2)); + if (cmp == 0) + return (0); + if (sign && neg) + return (cmp < 0 ? 1 : -1); + return (cmp); + } + + memset(&prod1, '\0', sizeof(mpi)); + memset(&prod2, '\0', sizeof(mpi)); + + /* "divide" op1 by op2 + * if result is smaller than 1, op1 is smaller than op2 */ + mpi_mul(&prod1, mpr_num(op1), mpr_den(op2)); + mpi_mul(&prod2, mpr_num(op2), mpr_den(op1)); + + cmp = mpi_cmpabs(&prod1, &prod2); + + mpi_clear(&prod1); + mpi_clear(&prod2); + + if (sign && neg) + return (cmp < 0 ? 1 : -1); + return (cmp); +} + +void +mpr_swap(mpr *op1, mpr *op2) +{ + if (op1 != op2) { + mpr swap; + + memcpy(&swap, op1, sizeof(mpr)); + memcpy(op1, op2, sizeof(mpr)); + memcpy(op2, &swap, sizeof(mpr)); + } +} + +int +mpr_fiti(mpr *op) +{ + return (mpi_fiti(mpr_num(op)) && mpi_fiti(mpr_den(op))); +} + +double +mpr_getd(mpr *op) +{ + return (mpi_getd(mpr_num(op)) / mpi_getd(mpr_den(op))); +} + +char * +mpr_getstr(char *str, mpr *op, int base) +{ + int len; + + if (str == NULL) { + len = mpi_getsize(mpr_num(op), base) + mpr_num(op)->sign + 1 + + mpi_getsize(mpr_den(op), base) + mpr_den(op)->sign + 1; + + str = mp_malloc(len); + } + + (void)mpi_getstr(str, mpr_num(op), base); + len = strlen(str); + str[len] = '/'; + (void)mpi_getstr(str + len + 1, mpr_den(op), base); + + return (str); +} Index: xc/programs/xedit/lisp/re/Imakefile diff -u /dev/null xc/programs/xedit/lisp/re/Imakefile:1.2 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/Imakefile Fri Nov 8 03:01:00 2002 @@ -0,0 +1,25 @@ +XCOMM $XFree86: xc/programs/xedit/lisp/re/Imakefile,v 1.2 2002/11/08 08:01:00 paulo Exp $ + +#define DoNormalLib YES +#define DoSharedLib NO +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#define LibName re +#define LibInstall NO +#define LibHeaders NO + +LIB = LibName + +SRCS =\ + re.c \ + rec.c \ + reo.c +OBJS =\ + re.o \ + rec.o \ + reo.o + +#include <Library.tmpl> + +DependTarget() Index: xc/programs/xedit/lisp/re/README diff -u /dev/null xc/programs/xedit/lisp/re/README:1.4 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/README Fri Nov 15 02:01:32 2002 @@ -0,0 +1,121 @@ +$XFree86: xc/programs/xedit/lisp/re/README,v 1.4 2002/11/15 07:01:32 paulo Exp $ + +LAST UPDATED: $Date$ + + This is a small regex library for fast matching tokens in text. It was built +to be used by xedit and it's syntax highlight code. It is not compliant with +IEEE Std 1003.2, but is expected to be used where very fast matching is +required, and exotic patterns will not be used. + + To understand what kind of patterns this library is expected to be used with, +see the file <XRoot>xc/programs/xedit/lisp/modules/progmodes/c.lsp and some +samples in the file tests.txt, with comments for patterns that will not work, +or may give incorrect results. + + The library is not built upon the standard regex library by Henry Spencer, +but is completely written from scratch, but it's syntax is heavily based on +that library, and the only reason for it to exist is that unfortunately +the standard version does not fit the requirements needed by xedit. +Anyways, I would like to thanks Henry for his regex library, it is a really +very useful tool. + + Small description of understood tokens: + + M A T C H I N G +------------------------------------------------------------------------ +. Any character (won't match newline if compiled with RE_NEWLINE) +\w Any word letter (shortcut to [a-zA-Z0-9_] +\W Not a word letter (shortcut to [^a-zA-Z0-9_] +\d Decimal number +\D Not a decimal number +\s A space +\S Not a space +\l A lower case letter +\u An upper case letter +\c A control character, currently the range 1-32 (minus tab) +\C Not a control character +\o Octal number +\O Not an octal number +\x Hexadecimal number +\X Not an hexadecimal number +\< Beginning of a word (matches an empty string) +\> End of a word (matches an empty string) +^ Beginning of a line (matches an empty string) +$ End of a line (matches an empty string) +[...] Matches one of the characters inside the brackets + ranges are specified separating two characters with "-". + If the first character is "^", matches only if the + character is not in this range. To add a "]" make it + the first character, and to add a "-" make it the last. +\1 to \9 Backreference, matches the text that was matched by a group, + that is, text that was matched by the pattern inside + "(" and ")". + + + O P E R A T O R S +------------------------------------------------------------------------ +() Any pattern inside works as a backreference, and is also + used to group patterns. +| Alternation, allows choosing different possibilities, like + character ranges, but allows patterns of different lengths. + + + R E P E T I T I O N +------------------------------------------------------------------------ +<re>* <re> may occur any number of times, including zero +<re>+ <re> must occur at least once +<re>? <re> is optional +<re>{<e>} <re> must occur exactly <e> times +<re>{<n>,} <re> must occur at least <n> times +<re>{,<m>} <re> must not occur more than <m> times +<re>{<n>,<m>} <re> must occur at least <n> times, but no more than <m> + + + Note that "." is a special character, and when used with a repetition +operator it changes completely its meaning. For example, ".*" matches +anything up to the end of the input string (unless the pattern was compiled +with RE_NEWLINE, in that case it will match anything, but a newline). + + + Limitations: + +o Only minimal matches supported. The engine has only one level "backtracking", + so, it also only does minimal matches to allow backreferences working + properly, and to avoid failing to match depending on the input. + +o Only one level "grouping", for example, with the pattern: + (a(b)c) + If "abc" is anywhere in the input, it will be in "\1", but there will + not exist a "\2" for "b". + +o Some "special repetitions" were not implemented, these are: + .{<e>} + .{<n>,} + .{,<m>} + .{<n>,<m>} + +o Some patterns will never match, for example: + \w*\d + Since "\w*" already includes all possible matches of "\d", "\d" will + only be tested when "\w*" failed. There are no plans to make such + patterns work. + + + Some of these limitations may be worked on future versions of the library, +but this is not what the library is expected to do, and, adding support for +correct handling of these would probably make the library slower, what is +not the reason of it to exist in the first time. + + If you need "true" regex than this library is not for you, but if all +you need is support for very quickly finding simple patterns, than this +library can be a very powerful tool, on some patterns it can run more +than 200 times faster than "true" regex implementations! And this is +the reason it was written. + + + + Send comments and code to me (paulo@XFree86.Org) or to the XFree86 +mailing/patch lists. + +-- +Paulo Index: xc/programs/xedit/lisp/re/re.c diff -u /dev/null xc/programs/xedit/lisp/re/re.c:1.9 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/re.c Tue Dec 10 23:44:28 2002 @@ -0,0 +1,2648 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/re/re.c,v 1.9 2002/12/11 04:44:28 paulo Exp $ */ + +#include <stdio.h> +#include "rep.h" +#define DEBUG +/* + * Types + */ + +/* Information used when generating the final form of the compiled re. + */ +struct _re_inf { + rec_alt *alt; + unsigned char *cod; + long len; + long spc; + + /* Start offset of special repetition instruction */ + long sr[MAX_DEPTH]; + + /* Jump offset of special repetition instruction */ + long sj[MAX_DEPTH]; + + /* Just a flag, to know if this nesting is for a special repetition */ + char sp[MAX_DEPTH]; + + int bas; /* Alternatives/repetitions depth */ + int par; /* Open parenthesis counter */ + int ref; /* Backreference counter */ + + rec_pat *apat; /* Alternatives duplicate patterns + * if a special repetition is found, + * this is done to somewhat simplify + * the bytecode engine and still allow + * some complex (and time consuming) + * patterns. */ + + int flags; + int ecode; +}; + +/* This structure is not associated with re_cod as it's data only matters + * to the current match search. + */ +struct _re_eng { + unsigned char *bas; /* Base string pointer */ + unsigned char *str; /* String to search for pattern */ + unsigned char *end; /* Where to stop searching */ + unsigned char *cod; /* Pointer in the re_cod structure */ + long off; /* Number of used entries in so/eo etc */ + + /* Match offset/nesting information */ + long so[MAX_DEPTH]; /* (s)tart of (m)atch */ + long eo[MAX_DEPTH]; /* (e)nd of (m)atch */ + long sv[MAX_DEPTH]; /* (s)a(v)e match end offset */ + long re[MAX_DEPTH]; /* (re)petition count */ + long ss[MAX_DEPTH]; /* (s)ave (s)tart of match */ + unsigned char *rcod[MAX_DEPTH]; /* restart position in regex code */ + unsigned char *rstr[MAX_DEPTH]; /* restart position in string */ + + /* Group/backreference information */ + long goff; + long gso[9]; + long geo[9]; +}; + +/* + * Prototypes + */ +static void reinit(void); +static int rec_check(re_inf*, int); +static int rec_code(re_inf*, ReCode); +static int rec_byte(re_inf*, int); +static int rec_byte_byte(re_inf*, int, int); +static int rec_code_byte(re_inf*, ReCode, int); +static int rec_length(re_inf*, int); +static int rec_code_byte_byte(re_inf*, ReCode, int, int); +static int rec_build_alt(re_inf*, rec_alt*); +static int rec_build_pat(re_inf*, rec_pat*); +static int rec_build_rng(re_inf*, rec_rng*); +static int rec_build_grp(re_inf*, rec_grp*); +static int rec_build_stl(re_inf*, rec_stl*); +static int rec_build_rep(re_inf*, rec_rep*); +static int rec_inc_spc(re_inf*); +static int rec_dec_spc(re_inf*); +static int rec_add_spc(re_inf*, int); +static int rec_off_spc(re_inf*); +static int rec_alt_spc(re_inf*, int); +static int rec_rep_spc(re_inf*, int); +#ifdef DEBUG +static void redump(re_cod*); +#endif + +/* + * Initialization + */ +unsigned char re__alnum[256]; +unsigned char re__odigit[256]; +unsigned char re__ddigit[256]; +unsigned char re__xdigit[256]; +unsigned char re__control[256]; + +/* + * Implementation + */ +int +recomp(re_cod *preg, const char *pattern, int flags) +{ + int i, ecode; + re_inf inf; + + reinit(); + + preg->cod = NULL; + inf.alt = irec_comp(pattern, + flags & RE_PEND ? preg->re_endp : + pattern + strlen(pattern), + flags, &ecode); + if (ecode != 0) + return (ecode); + + inf.cod = NULL; + inf.len = inf.spc = 0; + inf.bas = 0; + inf.par = 0; + inf.ref = 0; + inf.apat = NULL; + inf.flags = flags; + inf.ecode = 0; + for (i = 0; i < MAX_DEPTH; i++) + inf.sp[i] = 0; + + /* First byte is runtime modifier flags */ + if (rec_byte(&inf, flags & (RE_NEWLINE | RE_NOSUB)) == 0 && + rec_byte(&inf, 0xff) == 0 && + rec_build_alt(&inf, inf.alt) == 0 && + rec_rep_spc(&inf, 0) == 0 && + rec_code(&inf, Re_Done) == 0) { + /* Number of possible references, loops will not leave this + * value correct, but it is cheap to read it from the second + * byte, instead of adding several extra checks in the bytecode. */ + if (inf.ref) + inf.cod[1] = inf.ref - 1; + preg->cod = inf.cod; + /* Public structure member */ + preg->re_nsub = inf.ref; + } + + irec_free_alt(inf.alt); + if (inf.ecode) + free(inf.cod); +#ifdef DEBUG + else if (flags & RE_DUMP) + redump(preg); +#endif + + return (inf.ecode); +} + +int +reexec(const re_cod *preg, const char *string, + int nmatch, re_mat pmat[], int flags) +{ + unsigned char *ptr, *str, newline, nosub; + int len, si, ci, bas, i, j, k, l, m; + re_eng eng; + + if (preg == NULL || preg->cod == NULL || nmatch < 0 || + ((flags & RE_STARTEND) && + (pmat == NULL || pmat[0].rm_eo < pmat[0].rm_so))) + return (RE_INVARG); + + eng.str = (unsigned char*)string; + if (flags & RE_STARTEND) { + eng.end = eng.str + pmat[0].rm_eo; + eng.str += pmat[0].rm_so; + } + else + eng.end = eng.str + strlen(string); + eng.bas = eng.str; + nosub = preg->cod[0] & RE_NOSUB; + newline = preg->cod[0] & RE_NEWLINE; + eng.cod = preg->cod + 2; + + if (!nosub && preg->cod[1] != 0xff) { + for (i = 0; i <= preg->cod[1]; i++) { + eng.gso[i] = 0; + eng.geo[i] = -1; + } + } + + /* Setup to search for start of match from the first character */ + eng.so[0] = 0; + eng.eo[0] = eng.sv[0] = -1; + eng.rcod[0] = eng.cod; + eng.rstr[0] = eng.str + 1; + eng.off = 0; + eng.goff = -1; + for (ci = si = 1;;) { +reset: + switch (*eng.cod) { + /**************************************************** + * One byte codes * + ****************************************************/ + case Re_Any: + if (eng.str == eng.end || (newline && eng.str[0] == '\n')) + goto fail; + goto match; + case Re_AnyEatAnyTimes: + if (newline) { + for (ptr = eng.str; ptr < eng.end; ptr++) { + if (*ptr == '\n') + break; + } + si = ptr - eng.str; + } + else + si = eng.end - eng.str; + goto match; + case Re_AnyEatMaybe: + si = eng.end > eng.str; + if (newline && si && eng.str[0] == '\n') + si = 0; + goto match; + case Re_AnyEatAtLeast: + if (newline) { + for (ptr = eng.str; ptr < eng.end; ptr++) { + if (*ptr == '\n') + break; + } + si = ptr - eng.str; + } + else + si = eng.end - eng.str; + if (si == 0) { + si = 1; + goto fail; + } + goto match; + case Re_Odigit: + if (eng.str >= eng.end) + goto fail; + if (re__odigit[eng.str[0]]) + goto match; + goto fail; + case Re_OdigitNot: + if (eng.str >= eng.end || re__odigit[eng.str[0]]) + goto fail; + goto match; + case Re_Digit: + if (eng.str >= eng.end) + goto fail; + if (re__ddigit[eng.str[0]]) + goto match; + goto fail; + case Re_DigitNot: + if (eng.str >= eng.end || re__ddigit[eng.str[0]]) + goto fail; + goto match; + case Re_Xdigit: + if (eng.str >= eng.end) + goto fail; + if (re__xdigit[eng.str[0]]) + goto match; + goto fail; + case Re_XdigitNot: + if (eng.str >= eng.end || re__xdigit[eng.str[0]]) + goto fail; + goto match; + case Re_Space: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] == ' ' || eng.str[0] == '\t') + goto match; + goto fail; + case Re_SpaceNot: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] != ' ' && eng.str[0] != '\t') + goto match; + goto fail; + case Re_Tab: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] == '\t') + goto match; + goto fail; + case Re_Newline: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] == '\n') + goto match; + goto fail; + case Re_Lower: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] >= 'a' && eng.str[0] <= 'z') + goto match; + goto fail; + case Re_Upper: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] >= 'A' && eng.str[0] <= 'Z') + goto match; + goto fail; + case Re_Alnum: + if (eng.str >= eng.end) + goto fail; + if (re__alnum[eng.str[0]]) + goto match; + goto fail; + case Re_AlnumNot: + if (eng.str >= eng.end) + goto fail; + if (re__alnum[eng.str[0]]) + goto fail; + goto match; + case Re_Control: + if (eng.str >= eng.end) + goto fail; + if (re__control[eng.str[0]]) + goto match; + goto fail; + case Re_ControlNot: + if (eng.str >= eng.end || re__control[eng.str[0]]) + goto fail; + goto match; + + /**************************************************** + * One byte codes, match special emtpy strings * + ****************************************************/ + case Re_Bol: + if (eng.str == eng.bas) { + if ((flags & RE_NOTBOL)) { + /* String does not start at the beginning of a line */ + if (newline) + goto fail; + goto wont; + } + si = 0; + goto match; + } + if (newline && eng.str[-1] == '\n') { + si = 0; + goto match; + } + goto fail; + case Re_Eol: + if (eng.str == eng.end) { + if (flags & RE_NOTEOL) + /* String does not finish at the end of a line */ + goto wont; + si = 0; + goto match; + } + if (newline && eng.str[0] == '\n') { + si = 0; + goto match; + } + goto fail; + case Re_Bow: + if (eng.str >= eng.end || + (eng.str > eng.bas && + (re__alnum[eng.str[-1]]))) + goto fail; + if (re__alnum[eng.str[0]]) { + si = 0; + goto match; + } + goto fail; + case Re_Eow: + if (eng.str == eng.bas || + (eng.str < eng.end && + re__alnum[eng.str[0]])) + goto fail; + if (re__alnum[eng.str[-1]]) { + si = 0; + goto match; + } + goto fail; + + /**************************************************** + * One byte code, one byte argument * + ****************************************************/ + case Re_Literal: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] == eng.cod[1]) { + ci = 2; + goto match; + } + goto fail; + case Re_LiteralNot: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] != eng.cod[1]) { + ci = 2; + goto match; + } + goto fail; + case Re_SearchLiteral: + for (str = eng.str; str < eng.end; str++) { + if (*str == eng.cod[1]) { + ci = 2; + eng.str = str; + goto match; + } + } + /* This bytecode only happens in the toplevel */ + eng.so[0] = str - eng.bas; + eng.str = str; + goto fail; + + /**************************************************** + * One byte code, two bytes argument * + ****************************************************/ + case Re_CaseLiteral: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] == eng.cod[1] || eng.str[0] == eng.cod[2]) { + ci = 3; + goto match; + } + goto fail; + case Re_CaseLiteralNot: + if (eng.str >= eng.end) + goto fail; + if (eng.str[0] != eng.cod[1] && eng.str[0] != eng.cod[2]) { + ci = 3; + goto match; + } + goto fail; + case Re_SearchCaseLiteral: + for (str = eng.str; str < eng.end; str++) { + if (*str == eng.cod[1] || *str == eng.cod[2]) { + ci = 3; + eng.str = str; + goto match; + } + } + eng.so[0] = str - eng.bas; + eng.str = str; + goto fail; + + /**************************************************** + * One byte codes, two arguments, n bytes * + ****************************************************/ + case Re_String: + len = eng.cod[1]; + if (len & 0x80) { + i = 3; + len = (len & 0x7f) + (eng.cod[2] << 7); + } + else + i = 2; + if (eng.end - eng.str < len) + goto fail; + ptr = eng.cod + i; + str = eng.str; + for (k = len; k > 0; k--) { + if (*ptr++ != *str++) + goto fail; + } + ci = i + len; + si = len; + goto match; + case Re_SearchString: + len = eng.cod[1]; + if (len & 0x80) { + i = 3; + len = (len & 0x7f) + (eng.cod[2] << 7); + } + else + i = 2; + for (str = eng.str; eng.end - str >= len; str = eng.str++) { + for (ptr = eng.cod + i, str = eng.str, k = len; k > 0; k--) + if (*ptr++ != *str++) + break; + if (k == 0) { + /* Substring found */ + ci = i + len; + si = str - eng.str; + goto match; + } + } + eng.so[0] = eng.end - eng.bas; + eng.str = eng.end; + goto fail; + + case Re_CaseString: + len = eng.cod[1]; + if (len & 0x80) { + i = 3; + len = (len & 0x7f) + (eng.cod[2] << 7); + } + else + i = 2; + + len >>= 1; + /* Check if there are at least len/2 bytes left, string + * is represented as two bytes, lower and upper case */ + if (eng.end - eng.str < len) + goto fail; + ptr = eng.cod + i; + str = eng.str; + for (k = len; k > 0; str++, ptr += 2, k--) { + if (*str != ptr[0] && *str != ptr[1]) + goto fail; + } + ci = i + (len << 1); + si = len; + goto match; + case Re_SearchCaseString: + len = eng.cod[1]; + if (len & 0x80) { + i = 3; + len = (len & 0x7f) + (eng.cod[2] << 7); + } + else + i = 2; + len >>= 1; + for (str = eng.str; eng.end - str >= len; str = eng.str++) { + for (ptr = eng.cod + i, str = eng.str, k = len; + k > 0; k--, ptr += 2, str++) + if (ptr[0] != str[0] && ptr[1] != str[0]) + break; + if (k == 0) { + /* Substring found */ + ci = i + (len << 1); + si = str - eng.str; + goto match; + } + } + eng.so[0] = eng.end - eng.bas; + eng.str = eng.end; + goto fail; + + case Re_StringList: + /* Number of strings */ + k = eng.cod[1]; + + /* Where to jump after match */ + bas = eng.cod[2] | (eng.cod[3] << 8); + + str = eng.str; + ptr = eng.cod + k + 4; + l = eng.end - eng.str; + for (j = 0; j < k; j++) { + len = eng.cod[j + 4]; + if (len <= l) { + for (i = 0; i < len; i++) + if (ptr[i] != str[i]) + goto next_stl; + goto stl_match; + } +next_stl: + ptr += len; + } + goto fail; +stl_match: + ci = bas; + si = len; + goto match; + + case Re_CaseStringList: + /* Number of strings */ + k = eng.cod[1]; + + /* Where to jump after match */ + bas = eng.cod[2] | (eng.cod[3] << 8); + + str = eng.str; + ptr = eng.cod + k + 4; + l = eng.end - eng.str; + for (j = 0; j < k; j++) { + len = eng.cod[j + 4]; + if ((len >> 1) <= l) { + for (i = m = 0; i < len; m++, i += 2) + if (ptr[i] != str[m] && ptr[i + 1] != str[m]) + goto next_cstl; + goto cstl_match; + } +next_cstl: + ptr += len; + } + goto fail; +cstl_match: + ci = bas; + si = len >> 1; + goto match; + + + case Re_LargeStringList: + /* Where to jump after match */ + bas = eng.cod[1] | (eng.cod[2] << 8); + + str = eng.str; + + /* First entry in index map */ + ptr = eng.cod + 3; + i = (int)str[0] << 1; + j = ptr[i] | (ptr[i + 1] << 8); + if (j == 0xffff) + /* No entry with this byte */ + goto fail; + + /* Bytes left in input */ + l = eng.end - eng.str; + + /* First entry matching initial byte */ + ptr += 512 + j; + + for (len = ptr[0]; + str[0] == ptr[1]; + ptr += len + 1, len = ptr[0]) { + if (len <= l) { + for (i = 1; i < len; i++) { + if (ptr[i + 1] != str[i]) + goto next_lstl; + } + ci = bas; + si = len; + goto match; + } +next_lstl:; + } + goto fail; + + case Re_LargeCaseStringList: + /* Where to jump after match */ + bas = eng.cod[1] | (eng.cod[2] << 8); + + str = eng.str; + + /* First entry in index map */ + ptr = eng.cod + 3; + i = (int)str[0] << 1; + j = ptr[i] | (ptr[i + 1] << 8); + if (j == 0xffff) + /* No entry with this byte */ + goto fail; + + /* Bytes left in input */ + l = eng.end - eng.str; + + /* First entry matching initial byte */ + ptr += 512 + j; + + for (len = ptr[0]; + str[0] == ptr[1] || str[0] == ptr[2]; + ptr += len + 1, len = ptr[0]) { + if ((k = (len >> 1)) <= l) { + for (i = 2, j = 1; i < len; i += 2, j++) { + if (ptr[i + 1] != str[j] && ptr[i + 2] != str[j]) + goto next_lcstl; + } + ci = bas; + si = k; + goto match; + } +next_lcstl:; + } + goto fail; + + + /**************************************************** + * Character range matching * + ****************************************************/ + case Re_Range: + if (eng.str < eng.end && eng.cod[eng.str[0] + 1]) { + ci = 257; + goto match; + } + goto fail; + case Re_RangeNot: + if (eng.str >= eng.end || eng.cod[eng.str[0] + 1]) + goto fail; + ci = 257; + goto match; + + /**************************************************** + * Group handling * + ****************************************************/ + case Re_Open: + if (++eng.goff >= 9) + return (RE_ASSERT); + eng.gso[eng.goff] = eng.str - eng.bas; + ++eng.cod; + continue; + case Re_Close: + eng.geo[eng.goff] = eng.str - eng.bas; + ++eng.cod; + continue; + case Re_Update: + bas = eng.cod[1]; + eng.geo[eng.goff] = eng.str - eng.bas; + eng.cod += 2; /* + Update + bas */ + continue; + + /**************************************************** + * Backreference * + ****************************************************/ + case Re_Backref: + i = eng.cod[1]; + j = eng.gso[i]; + k = eng.geo[i]; + len = k - j; + if (k < j || eng.end - eng.str < len) + goto fail; + ptr = eng.bas + j; + str = eng.str; + for (l = len; l > 0; l--) { + if (*ptr++ != *str++) + goto fail; + } + ci = 2; + si = len; + goto match; + + /**************************************************** + * Alternatives handling * + ****************************************************/ + case Re_Alt: + bas = eng.off; + if (++eng.off >= MAX_DEPTH) + return (RE_ASSERT); + + /* Get offset of next alternative */ + i = eng.cod[1] | (eng.cod[2] << 8); + + /* Setup for next alternative if the current fails */ + eng.rcod[eng.off] = eng.cod + i + 1; /* + Alt */ + + /* If fail, test the next alternative in the same string */ + eng.rstr[eng.off] = eng.str; + + /* Setup match offsets */ + if (eng.so[bas] <= eng.eo[bas]) + eng.so[eng.off] = eng.eo[bas]; + else + eng.so[eng.off] = eng.so[bas]; + eng.sv[eng.off] = eng.eo[eng.off] = eng.so[eng.off] - 1; + + /* Save start of possible previous matches */ + eng.ss[eng.off] = eng.so[bas]; + + /* Skip code */ + eng.cod += 3; + + /* Go try the first alternative */ + continue; + + case Re_AltNext: + bas = eng.off - 1; + /* Check if matched and if it is a better match */ + if (eng.sv[eng.off] - eng.so[eng.off] < + eng.eo[eng.off] - eng.so[eng.off]) + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Get offset of next alternative */ + i = eng.cod[1] | (eng.cod[2] << 8); + + /* Setup for next alternative if the current fails */ + eng.rcod[eng.off] = eng.cod + i + 1; /* + AltNext */ + + /* Setup match offset */ + eng.eo[eng.off] = eng.so[eng.off] - 1; + + /* Reset string for next alternative */ + eng.str = eng.rstr[eng.off]; + + /* Skip code */ + eng.cod += 3; + + /* Go try the next alternative */ + continue; + + case Re_AltDone: + bas = eng.off - 1; + /* Check if matched and if it is a better match */ + if (eng.sv[eng.off] - eng.so[eng.off] < + eng.eo[eng.off] - eng.so[eng.off]) + eng.sv[eng.off] = eng.eo[eng.off]; + + /* If there is a match */ + if (eng.sv[eng.off] >= eng.so[eng.off]) { + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + + /* Pop stack and skip code */ + --eng.off; + ++eng.cod; + + /* Go try next regular expression pattern */ + continue; + } + + /* Failed, reset string and pop stack */ + eng.str = eng.rstr[eng.off]; + --eng.off; + goto fail; + + + /**************************************************** + * Repetition * + ****************************************************/ + + /* Note that the repetition counter is not + * updated for <re>*, <re>+ and <re>? + * it is easy to updated, but since it is not + * really useful, code to do it was removed + * to save a few cpu cicles. */ + +#define REPETITION_SETUP() \ + if (++eng.off >= MAX_DEPTH) \ + return (RE_ASSERT); \ + \ + /* Return here for recovery if match fail */ \ + eng.rcod[eng.off] = eng.cod; \ + \ + /* Setup match offsets */ \ + if (eng.so[bas] <= eng.eo[bas]) \ + eng.so[eng.off] = eng.eo[bas]; \ + else \ + eng.so[eng.off] = eng.so[bas]; \ + eng.ss[eng.off] = eng.so[bas]; \ + eng.sv[eng.off] = eng.eo[eng.off] = eng.so[eng.off] - 1;\ + \ + /* Skip repetition instruction */ \ + eng.cod += 4; + + + case Re_AnyTimes: + bas = eng.cod[1]; + if (eng.off == bas) { + /* First iteration */ + REPETITION_SETUP(); + } + else { + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.eo[eng.off] > eng.sv[eng.off]) { + /* Update offset of match */ + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Skip repetition instruction */ + eng.cod += 4; + } + else { + /* Match failed but it is ok */ + len = eng.cod[2] | (eng.cod[3] << 8); + eng.so[bas] = eng.ss[eng.off]; + if (eng.sv[eng.off] >= eng.so[eng.off]) + /* Something matched earlier, update */ + eng.eo[bas] = eng.sv[eng.off]; + else if (eng.eo[bas] < eng.so[bas]) + /* Empty match */ + eng.eo[bas] = eng.so[bas]; + + /* Try next pattern at correct offset */ + eng.str = eng.bas + eng.eo[bas]; + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + } + continue; + + case Re_Maybe: + bas = eng.cod[1]; + if (eng.off == bas) { + /* First iteration */ + REPETITION_SETUP(); + } + else { + /* Matched or first iteration is done */ + len = eng.cod[2] | (eng.cod[3] << 8); + eng.so[bas] = eng.ss[eng.off]; + if (eng.eo[eng.off] > eng.so[eng.off]) { + /* Something matched earlier, update */ + eng.eo[bas] = eng.eo[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + /* Don't need to update counter */ + } + else { + /* Empty match */ + if (eng.eo[bas] < eng.so[bas]) + eng.eo[bas] = eng.so[bas]; + + /* Try next pattern at correct offset */ + eng.str = eng.bas + eng.eo[bas]; + } + + /* Pop stack */ + --eng.off; + + /* Skip code */ + eng.cod += len; + } + continue; + + case Re_AtLeast: + bas = eng.cod[1]; + if (eng.off == bas) { + /* First iteration */ + REPETITION_SETUP(); + } + else { + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.eo[eng.off] > eng.sv[eng.off]) { + /* Update offset of match */ + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Skip repetition instruction */ + eng.cod += 4; + } + else { + /* Last try failed */ + len = eng.cod[2] | (eng.cod[3] << 8); + if (eng.sv[eng.off] >= eng.so[eng.off]) { + /* Something matched earlier, update */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + } + else { + /* Do it here, so that the fail label does + * not need to do too expensive work for + * simple patterns. */ + eng.so[bas] = eng.str - eng.bas; + + /* Zero matches, pop stack and restart */ + --eng.off; + goto fail; + } + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + } + continue; + + + /**************************************************** + * Repetition with arguments * + ****************************************************/ + case Re_Exact: +#define COMPLEX_REPETITION_SETUP_0() \ + i = eng.cod[1]; \ + bas = eng.cod[2]; + +#define COMPLEX_REPETITION_SETUP() \ + /* First iteration */ \ + if (++eng.off >= MAX_DEPTH) \ + return (RE_ASSERT); \ + \ + /* Remeber number or repetitions */ \ + eng.re[eng.off] = 0; \ + \ + /* Return here for recovery if match fail */ \ + eng.rcod[eng.off] = eng.cod; \ + \ + /* Setup match offsets */ \ + if (eng.so[bas] <= eng.eo[bas]) \ + eng.so[eng.off] = eng.eo[bas]; \ + else \ + eng.so[eng.off] = eng.so[bas]; \ + eng.sv[eng.off] = eng.eo[eng.off] = eng.so[eng.off] - 1;\ + eng.ss[eng.off] = eng.so[bas]; \ + \ + /* Skip repetition instruction */ \ + eng.cod += 5; + + COMPLEX_REPETITION_SETUP_0(); + if (eng.off == bas) { + /* First iteration */ + COMPLEX_REPETITION_SETUP(); + } + else { + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.eo[eng.off] > eng.sv[eng.off]) { + /* Update offset of match */ + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Update repetition counter */ + if (++eng.re[eng.off] == i) { + /* Matched the required times */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + + /* Update code */ + k = eng.cod[3] | (eng.cod[4] << 8); + eng.cod += k; + + /* Pop stack and go for next pattern */ + --eng.off; + continue; + } + + /* Skip repetition instruction */ + eng.cod += 5; + } + else { + /* Do it here, so that the fail label does + * not need to do too expensive work for + * simple patterns. */ + eng.so[bas] = eng.str - eng.bas; + + /* Pop stack and restart */ + --eng.off; + goto fail; + } + } + continue; + + case Re_Min: + COMPLEX_REPETITION_SETUP_0(); + if (eng.off == bas) { + /* First iteration */ + COMPLEX_REPETITION_SETUP(); + } + else { + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.eo[eng.off] > eng.sv[eng.off]) { + /* Update offset of match */ + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Update repetition counter */ + ++eng.re[eng.off]; + + /* Skip repetition instruction and try again */ + eng.cod += 5; + } + else { + /* Match failed! */ + if (eng.re[eng.off] < i) { + /* Do it here, so that the fail label does + * not need to do too expensive work for + * simple patterns. */ + eng.so[bas] = eng.str - eng.bas; + + /* Didn't match required number of times */ + --eng.off; + goto fail; + } + else { + /* Matched minimum number of times */ + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + k = eng.cod[3] | (eng.cod[4] << 8); + + /* Update code and pop stack */ + eng.cod += k; + --eng.off; + } + } + } + continue; + + case Re_Max: + COMPLEX_REPETITION_SETUP_0(); + if (eng.off == bas) { + /* First iteration */ + COMPLEX_REPETITION_SETUP(); + } + else { + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.eo[eng.off] > eng.sv[eng.off]) { + /* Update offset of match */ + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Update repetition counter */ + if (++eng.re[eng.off] == i) { + /* Matched the maximum times */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + + k = eng.cod[3] | (eng.cod[4] << 8); + + /* Update code and pop stack */ + eng.cod += k; + --eng.off; + continue; + } + + /* Skip repetition instruction and try again */ + eng.cod += 5; + } + else { + /* No matches, but zero matches are ok */ + k = eng.cod[3] | (eng.cod[4] << 8); + if (eng.sv[eng.off] >= eng.so[eng.off]) { + /* Something matched earlier, update */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + } + else { + /* Empty match */ + if (eng.eo[bas] < eng.so[bas]) + eng.eo[bas] = eng.so[bas]; + + /* Try next pattern at correct offset */ + eng.str = eng.bas + eng.eo[bas]; + } + + /* Pop stack and update code */ + --eng.off; + eng.cod += k; + } + } + continue; + + case Re_MinMax: + bas = eng.cod[3]; + if (eng.off == bas) { + /* First iteration */ + COMPLEX_REPETITION_SETUP(); + } + else { + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.eo[eng.off] > eng.sv[eng.off]) { + /* Update offset of match */ + eng.sv[eng.off] = eng.eo[eng.off]; + + /* Update repetition counter */ + if (++eng.re[eng.off] == eng.cod[2]) { + /* Matched the maximum times */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + k = eng.cod[4] | (eng.cod[5] << 8); + + /* Update code and pop stack */ + eng.cod += k; + --eng.off; + continue; + } + + /* Skip repetition instruction and try again */ + eng.cod += 6; + } + else { + /* Match failed! */ + if (eng.re[eng.off] < eng.cod[1]) { + /* Do it here, so that the fail label does + * not need to do too expensive work for + * simple patterns. */ + eng.so[bas] = eng.str - eng.bas; + + /* Didn't match required number of times */ + --eng.off; + goto fail; + } + else { + /* Matched minimum number of times */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.sv[eng.off]; + eng.str = eng.bas + eng.eo[bas]; + k = eng.cod[4] | (eng.cod[5] << 8); + + /* Update code and pop stack */ + eng.cod += k; + --eng.off; + } + } + } + continue; + + + /**************************************************** + * Special repetition handling * + ****************************************************/ + case Re_AnyAnyTimes: + /* code(1) + bas(1) + gbas(1) + jump(2) */ + bas = eng.cod[1]; + if (eng.off == bas) { + /* First iteration */ + if (++eng.off >= MAX_DEPTH) + return (RE_ASSERT); + + /* Return here for recovery if match fail */ + eng.rcod[eng.off] = eng.cod; + + /* If fail, test the next pattern at the same point */ + eng.rstr[eng.off] = eng.str; + + /* Setup match offsets */ + eng.so[eng.off] = eng.str - eng.bas; + eng.eo[eng.off] = eng.so[eng.off] - 1; + + if (newline) + /* Use the repetition counter to store start of + * skipped string, to later check if skipping a + * newline. */ + eng.re[eng.off] = eng.so[eng.off]; + + /* Save start of possible previous matches */ + eng.ss[eng.off] = eng.so[bas]; + + /* Skip repetition instruction */ + eng.cod += 5; + } + else { + /* -1 as an unsigned char */ + if (eng.cod[2] != 0xff) + eng.goff = eng.cod[2]; + else + eng.goff = -1; + + if (newline) { + ptr = eng.bas + eng.re[eng.off]; + str = eng.bas + eng.so[eng.off]; + for (; ptr < str; ptr++) + if (*ptr == '\n') { + eng.cod = eng.rcod[0]; + eng.so[0] = ptr - eng.bas + 1; + eng.eo[0] = eng.so[0] - 1; + eng.rstr[0] = eng.str = ptr + 1; + eng.off = 0; + goto reset; + } + /* If looping, don't do too many noops */ + eng.re[eng.off] = ptr - eng.bas; + } + + if (eng.eo[eng.off] >= eng.so[eng.off]) { + /* Note that this is only true if all possibly + * nested special repetitions also matched. */ + + if (eng.goff >= 0) { + if (eng.cod[5] == Re_Update) + eng.gso[eng.goff] = eng.eo[bas] + + (eng.so[bas] > eng.eo[bas]); + else if (eng.geo[eng.goff] < eng.so[eng.off]) + eng.geo[eng.goff] = eng.so[eng.off]; + } + + /* Jump relative offset */ + len = eng.cod[3] | (eng.cod[4] << 8); + + /* Restore offset from where started trying */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.eo[eng.off]; + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + else { + /* Only give up if the entire string was scanned */ + if (eng.str < eng.end) { + /* Update restart point for next pattern */ + eng.str = ++eng.rstr[eng.off]; + + /* Reset start of nested match */ + eng.so[eng.off] = eng.str - eng.bas; + + /* Skip repetition instruction */ + eng.cod += 5; + } + else { + /* Entire string scanned and failed */ + + /* Jump relative offset */ + len = eng.cod[3] | (eng.cod[4] << 8); + + /* Restore offset from where started trying */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.ss[eng.off] - 1; + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + } + } + continue; + + /* This is significantly different than matching <re>.*<re> + * because it may need to restart several times since it is + * possible to find too many false positives, for example: + * a.*b => once one "a" is found, scan all + * the remaining string searching for a "b" + * a.?b => the string may have too many "a"s, but the + * first occurrences of "a" may not be followed + * by any-character and a "b" or a single "b". + */ + case Re_AnyMaybe: + bas = eng.cod[1]; + if (eng.off == bas) { + /* First iteration */ + if (++eng.off >= MAX_DEPTH) + return (RE_ASSERT); + + /* Return here for recovery if match fail */ + eng.rcod[eng.off] = eng.cod; + + /* First try without eating a byte */ + eng.rstr[eng.off] = eng.str; + + /* Remember this is the first try if match fail */ + eng.re[eng.off] = 0; + + /* Setup match offsets */ + eng.so[eng.off] = eng.str - eng.bas; + eng.eo[eng.off] = eng.so[eng.off] - 1; + + /* Save start of possible previous matches */ + eng.ss[eng.off] = eng.so[bas]; + + /* Skip repetition instruction */ + eng.cod += 5; + } + else { + /* -1 as an unsigned char */ + if (eng.cod[2] != 0xff) + eng.goff = eng.cod[2]; + else + eng.goff = -1; + + if (eng.eo[eng.off] >= eng.so[eng.off]) { + /* Something matched */ + + if (eng.goff >= 0) { + if (eng.cod[5] == Re_Update) + eng.gso[eng.goff] = eng.eo[bas] + + (eng.so[bas] > eng.eo[bas]); + else if (eng.geo[eng.goff] < eng.so[eng.off]) + eng.geo[eng.goff] = eng.so[eng.off]; + } + + /* Jump relative offset */ + len = eng.cod[3] | (eng.cod[4] << 8); + + /* Update offset of match */ + eng.eo[bas] = eng.eo[eng.off]; + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + else if (eng.re[eng.off] == 0 && + (!newline || eng.rstr[eng.off][1] != '\n')) { + /* Try this time skiping a byte */ + ++eng.re[eng.off]; + + /* Reset string, skip code and go try one time more */ + eng.str = ++eng.rstr[eng.off]; + eng.cod += 5; + } + else { + /* Failed to match */ + + /* Update offsets */ + eng.eo[bas] = eng.ss[eng.off]; + eng.so[bas] = eng.eo[bas] + 1; + + eng.str = eng.rstr[eng.off] + (eng.re[eng.off] == 0); + + /* Pop stack and return to toplevel code */ + --eng.off; + if (eng.str >= eng.end) + goto wont; + eng.cod = eng.rcod[bas]; + } + } + continue; + + /* .+ almost identical to .* but requires eating at least one byte */ + case Re_AnyAtLeast: + bas = eng.cod[1]; + if (eng.off == bas) { + /* First iteration */ + if (++eng.off >= MAX_DEPTH) + return (RE_ASSERT); + + /* Return here for recovery if match fail */ + eng.rcod[eng.off] = eng.cod; + + /* Skip one byte for the restart string */ + if (newline && eng.str[0] == '\n') { + /* Cannot skip newline */ + eng.cod = eng.rcod[0]; + eng.rstr[0] = ++eng.str; + eng.so[0] = eng.str - eng.bas; + eng.eo[0] = eng.so[0] - 1; + eng.off = 0; + goto reset; + } + eng.rstr[eng.off] = ++eng.str; + + /* Setup match offsets */ + eng.so[eng.off] = eng.str - eng.bas; + eng.eo[eng.off] = eng.so[eng.off] - 1; + + if (newline) + /* Use the repetition counter to store start of + * skipped string, to later check if skipping a + * newline. */ + eng.re[eng.off] = eng.so[eng.off]; + + /* Save start of possible previous matches */ + eng.ss[eng.off] = eng.so[bas]; + + /* Skip repetition instruction */ + eng.cod += 5; + } + else { + /* -1 as an unsigned char */ + if (eng.cod[2] != 0xff) + eng.goff = eng.cod[2]; + else + eng.goff = -1; + + if (newline) { + ptr = eng.bas + eng.re[eng.off]; + str = eng.bas + eng.so[eng.off]; + for (; ptr < str; ptr++) + if (*ptr == '\n') { + eng.cod = eng.rcod[0]; + eng.so[0] = ptr - eng.bas + 1; + eng.eo[0] = eng.so[0] - 1; + eng.rstr[0] = eng.str = ptr + 1; + eng.off = 0; + goto reset; + } + /* If looping, don't do too many noops */ + eng.re[eng.off] = ptr - eng.bas; + } + + if (eng.eo[eng.off] >= eng.so[eng.off]) { + /* Note that this is only true if all possibly + * nested special repetitions also matched. */ + + if (eng.goff >= 0) { + if (eng.cod[5] == Re_Update) + eng.gso[eng.goff] = eng.eo[bas] + + (eng.so[bas] > eng.eo[bas]); + else if (eng.geo[eng.goff] < eng.so[eng.off]) + eng.geo[eng.goff] = eng.so[eng.off]; + } + + /* Jump relative offset */ + len = eng.cod[3] | (eng.cod[4] << 8); + + /* Restore offset from where started trying */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.eo[eng.off]; + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + else { + /* Only give up if the entire string was scanned */ + if (eng.str < eng.end) { + /* Update restart point for next pattern */ + eng.str = ++eng.rstr[eng.off]; + + /* Reset start of nested match */ + eng.so[eng.off] = eng.str - eng.bas; + + /* Skip repetition instruction */ + eng.cod += 5; + } + else { + /* Entire string scanned and failed */ + + /* Jump relative offset */ + len = eng.cod[3] | (eng.cod[4] << 8); + + /* Restore offset from where started trying */ + eng.so[bas] = eng.ss[eng.off]; + eng.eo[bas] = eng.ss[eng.off] - 1; + + /* Pop stack and skip code */ + --eng.off; + eng.cod += len; + } + } + } + continue; + + + /**************************************************** + * Repetition matched! * + ****************************************************/ + case Re_RepJump: + /* eng.cod[1] is toplevel offset of repetition */ + if (eng.off > eng.cod[1]) + /* If still needs to try matches */ + eng.cod -= eng.cod[2]; + else + eng.cod += 3; /* + RepJump + bas + len-size */ + continue; + + case Re_RepLongJump: + /* eng.cod[1] is toplevel offset of repetition */ + if (eng.off > eng.cod[1]) + /* If still needs to try matches */ + eng.cod -= eng.cod[2] | (eng.cod[3] << 8); + else + eng.cod += 4; /* + RepLongJump + bas + len-size */ + continue; + + /**************************************************** + * Finished * + ****************************************************/ + case Re_DoneIf: + if (eng.eo[eng.off] >= eng.so[eng.off]) { + eng.so[0] = eng.ss[eng.off]; + eng.eo[0] = eng.eo[eng.off]; + goto done; + } + ++eng.cod; + continue; + case Re_MaybeDone: + if (eng.eo[eng.off] >= eng.so[eng.off]) { + eng.so[0] = eng.ss[eng.off]; + eng.eo[0] = eng.eo[eng.off]; + goto done; + } + ++eng.cod; + continue; + case Re_Done: + goto done; + + default: + /* Fatal internal error */ + return (RE_ASSERT); + } + + +wont: + /* Surely won't match */ + if (eng.off == 0) { + eng.eo[0] = eng.so[0] - 1; + break; + } + + +fail: + if (eng.off == 0) { + /* If the entire string scanned */ + if (++eng.str > eng.end) { + eng.eo[0] = eng.so[0] - 1; + break; + } + eng.goff = -1; + /* Update start of possible match after restart */ + if (eng.eo[0] >= eng.so[0]) { + /* If first fail */ + eng.str = eng.rstr[0]; + ++eng.rstr[0]; + eng.so[0] = eng.str - eng.bas; + eng.eo[0] = eng.so[eng.off] - 1; + } + else + /* Just trying at next byte */ + ++eng.so[0]; + } + else + /* Remember this match failed */ + eng.eo[eng.off] = eng.so[eng.off] - 1; + + /* Restart code */ + eng.cod = eng.rcod[eng.off]; + continue; + + +match: + /* If first match */ + if (eng.eo[eng.off] < eng.so[eng.off]) { + if (eng.off == 0) + eng.rstr[0] = eng.str + 1; + eng.so[eng.off] = eng.eo[eng.off] = eng.str - eng.bas; + } + eng.eo[eng.off] += si; + eng.cod += ci; + eng.str += si; + ci = si = 1; + continue; + +done: + break; + } + + if (nmatch) { + if (flags & RE_STARTEND) + len = pmat[0].rm_so; + else + len = 0; + if (!nosub) { + if (preg->cod[1] != 0xff) + eng.goff = preg->cod[1]; + pmat[0].rm_so = eng.so[0]; + pmat[0].rm_eo = eng.eo[0]; + for (i = 1; i < nmatch; i++) { + if (i - 1 <= eng.goff) { + pmat[i].rm_so = eng.gso[i - 1]; + pmat[i].rm_eo = eng.geo[i - 1]; + } + else { + pmat[i].rm_so = 0; + pmat[i].rm_eo = -1; + } + } + if (len) { + /* Update offsets, since the match was done in a substring */ + j = eng.goff + 2 > nmatch ? nmatch : eng.goff + 2; + for (i = 0; i < j; i++) { + pmat[i].rm_so += len; + pmat[i].rm_eo += len; + } + } + } + else { + /* Already know these values, allow compiling the regex with + * RE_NOSUB to use parenthesis only for grouping, but avoiding + * the runtime overhead of keeping track of the subexpression + * offsets. */ + pmat[0].rm_so = eng.so[0] + len; + pmat[0].rm_eo = eng.eo[0] + len; + } + } + + return (eng.so[0] <= eng.eo[0] ? 0 : RE_NOMATCH); +} + +int +reerror(int ecode, const re_cod *preg, char *ebuffer, int ebuffer_size) +{ + static char *errors[] = { + "No error", + "Failed to match", /* NOMATCH */ + + /* Errors not generated */ + "Invalid regular expression", /* BADPAT */ + "Invalid collating element", /* ECOLLATE */ + "Invalid character class", /* ECTYPE */ + + "`\' applied to unescapable character", /* EESCAPE */ + "Invalid backreference number", /* ESUBREG */ + "Brackets `[ ]' not balanced", /* EBRACK */ + "Parentheses `( )' not balanced", /* EPAREN */ + "Braces `{ }' not balanced", /* EBRACE */ + "Invalid repetition count(s) in `{ }'", /* BADBR */ + "Invalid character range in `[ ]'", /* ERANGE */ + "Out of memory", /* ESPACE */ + "`?', `*', or `+' operand invalid", /* BADRPT */ + "Empty (sub)expression", /* EMPTY */ + "Assertion error - you found a bug", /* ASSERT */ + "Invalid argument" /* INVARG */ + }; + char *str; + + if (ecode >= 0 && ecode < sizeof(errors) / sizeof(errors[0])) + str = errors[ecode]; + else + str = "Unknown error"; + + return (snprintf(ebuffer, ebuffer_size, "%s", str)); +} + +void +refree(re_cod *cod) +{ + free(cod->cod); + cod->cod = NULL; +} + +static void +reinit(void) +{ + int i; + static int first = 1; + + if (!first) + return; + first = 0; + + re__alnum['_'] = 1; + + for (i = '0'; i <= '7'; i++) + re__alnum[i] = re__odigit[i] = re__ddigit[i] = re__xdigit[i] = 1; + + for (; i <= '9'; i++) + re__alnum[i] = re__ddigit[i] = re__xdigit[i] = 1; + + for (i = 'a'; i <= 'f'; i++) + re__alnum[i] = re__xdigit[i] = 1; + for (; i <= 'z'; i++) + re__alnum[i] = 1; + + for (i = 'A'; i <= 'F'; i++) + re__alnum[i] = re__xdigit[i] = 1; + for (; i <= 'Z'; i++) + re__alnum[i] = 1; + + for (i = 1; i < 32; i++) + re__control[i] = 1; + re__control[127] = 1; + /* Don't show tabs as control characters */ + re__control['\t'] = 0; +} + +static int +rec_check(re_inf *inf, int count) +{ + if (inf->len + count >= inf->spc) { + int spc; + unsigned char *cod; + + if ((spc = (count % 64)) != 0) + spc = 64 - spc; + spc += count + inf->spc; + if ((cod = realloc(inf->cod, spc)) == NULL) + return (inf->ecode = RE_ESPACE); + inf->cod = cod; + inf->spc = spc; + } + + return (inf->ecode); +} + +static int +rec_code(re_inf *inf, ReCode code) +{ + if (rec_check(inf, 1) == 0) + inf->cod[inf->len++] = code; + + return (inf->ecode); +} + +static int +rec_byte(re_inf *inf, int value) +{ + if (rec_check(inf, 1) == 0) + inf->cod[inf->len++] = value; + + return (inf->ecode); +} + +static int +rec_code_byte(re_inf *inf, ReCode code, int value) +{ + if (rec_check(inf, 2) == 0) { + inf->cod[inf->len++] = code; + inf->cod[inf->len++] = value; + } + + return (inf->ecode); +} + +static int +rec_length(re_inf *inf, int length) +{ + int lo, hi, two; + + if (length >= 16384) + return (inf->ecode = RE_ESPACE); + + lo = length & 0xff; + hi = length & 0xff00; + two = ((length > 0x7f) != 0) + 1; + if (two == 2) { + hi <<= 1; + hi |= (lo & 0x80) != 0; + lo |= 0x80; + } + + if (rec_check(inf, two) == 0) { + inf->cod[inf->len++] = lo; + if (two == 2) + inf->cod[inf->len++] = hi >> 8; + } + + return (inf->ecode); +} + +static int +rec_byte_byte(re_inf *inf, int value0, int value1) +{ + if (rec_check(inf, 2) == 0) { + inf->cod[inf->len++] = value0; + inf->cod[inf->len++] = value1; + } + + return (inf->ecode); +} + +static int +rec_code_byte_byte(re_inf *inf, ReCode code, int value0, int value1) +{ + if (rec_check(inf, 3) == 0) { + inf->cod[inf->len++] = code; + inf->cod[inf->len++] = value0; + inf->cod[inf->len++] = value1; + } + + return (inf->ecode); +} + +static int +rec_build_alt(re_inf *inf, rec_alt *alt) +{ + int offset, value, bas = inf->bas + 1; + + if (alt) { + if (alt->next) { + if (rec_inc_spc(inf)) + return (inf->ecode); + + /* A real a list of alternatives */ + rec_code(inf, Re_Alt); + + offset = inf->len; /* Remember current offset */ + rec_byte_byte(inf, 0, 0); /* Reserve two bytes for retry address */ + while (alt && inf->ecode == 0) { + if (rec_build_pat(inf, alt->pat)) + break; + alt = alt->next; + if (alt && inf->ecode == 0) { + /* Handle (hyper)complex repetitions */ + if (inf->bas != bas) { + /* Duplicate patterns up to end of expression */ + rec_build_pat(inf, inf->apat); + /* Restore engine state for next alternative(s) */ + rec_alt_spc(inf, bas - 1); + } + + /* If the jump would be so long */ + if ((value = inf->len - offset) >= 16384) { + inf->ecode = RE_ESPACE; + break; + } + inf->cod[offset] = value & 0xff; + inf->cod[offset + 1] = (value & 0xff00) >> 8; + + rec_code(inf, Re_AltNext); + offset = inf->len; + rec_byte_byte(inf, 0, 0); + } + } + if (inf->ecode == 0) { + /* Handle (hyper)complex repetitions */ + if (inf->bas != bas) { + /* Duplicate patterns up to end of expression */ + rec_build_pat(inf, inf->apat); + /* Restore engine state for next alternative(s) */ + rec_alt_spc(inf, bas - 1); + } + + /* If the jump would be so long */ + if ((value = inf->len - offset) >= 16384) + return (inf->ecode = RE_ESPACE); + inf->cod[offset] = value & 0xff; + inf->cod[offset + 1] = (value & 0xff00) >> 8; + /* Last jump is here */ + rec_code(inf, Re_AltDone); + } + rec_dec_spc(inf); + } + else + /* Single alternative */ + rec_build_pat(inf, alt->pat); + } + + return (inf->ecode); +} + +static int +rec_build_pat(re_inf *inf, rec_pat *pat) +{ + rec_pat *apat; + int length, offset = 0, distance, jump = 0, bas = 0; + + while (pat && inf->ecode == 0) { + if (pat->rep) { + bas = inf->bas; + if (pat->type == Rep_Group && !inf->par && rec_code(inf, Re_Open)) + return (inf->ecode); + if (rec_inc_spc(inf)) + return (inf->ecode); + offset = inf->len; + if (rec_build_rep(inf, pat->rep)) + break; + /* Reserve space to jump after repetition done */ + jump = inf->len; + rec_byte_byte(inf, 0, 0); + } + switch (pat->type) { + case Rep_AnyAnyTimes: + case Rep_AnyMaybe: + case Rep_AnyAtLeast: + if (rec_add_spc(inf, pat->type == Rep_AnyMaybe)) + return (inf->ecode); + if (rec_code(inf, (ReCode)pat->type) == 0 && + rec_byte(inf, inf->bas - 1) == 0 && + rec_byte(inf, inf->ref - 1) == 0) + rec_off_spc(inf); + break; + case Rep_Literal: + case Rep_LiteralNot: + case Rep_SearchLiteral: + rec_code_byte(inf, (ReCode)pat->type, pat->data.chr); + break; + case Rep_CaseLiteral: + case Rep_CaseLiteralNot: + case Rep_SearchCaseLiteral: + rec_code_byte_byte(inf, (ReCode)pat->type, + pat->data.cse.lower, pat->data.cse.upper); + break; + case Rep_Range: + case Rep_RangeNot: + if (rec_code(inf, (ReCode)pat->type) == 0) + rec_build_rng(inf, pat->data.rng); + break; + case Rep_String: + case Rep_SearchString: + case Rep_CaseString: + case Rep_SearchCaseString: + rec_code(inf, (ReCode)pat->type); + length = strlen((char*)pat->data.str); + if (rec_length(inf, length) == 0 && rec_check(inf, length) == 0) { + memcpy(inf->cod + inf->len, pat->data.str, length); + inf->len += length; + } + break; + case Rep_Any: + case Rep_AnyEatAnyTimes: + case Rep_AnyEatMaybe: + case Rep_AnyEatAtLeast: + case Rep_Odigit: + case Rep_OdigitNot: + case Rep_Digit: + case Rep_DigitNot: + case Rep_Xdigit: + case Rep_XdigitNot: + case Rep_Space: + case Rep_SpaceNot: + case Rep_Tab: + case Rep_Newline: + case Rep_Lower: + case Rep_Upper: + case Rep_Alnum: + case Rep_AlnumNot: + case Rep_Control: + case Rep_ControlNot: + case Rep_Bol: + case Rep_Eol: + case Rep_Bow: + case Rep_Eow: + rec_code(inf, (ReCode)pat->type); + break; + case Rep_Backref: + rec_code_byte(inf, Re_Backref, pat->data.chr); + break; + case Rep_Group: + if (pat->rep == NULL && !inf->par && rec_code(inf, Re_Open)) + break; + apat = inf->apat; + inf->apat = pat->next; + rec_build_grp(inf, pat->data.grp); + inf->apat = apat; + break; + case Rep_StringList: + rec_build_stl(inf, pat->data.stl); + break; + } + if (pat->rep) { +#if 0 + if (rec_dec_spc(inf)) + return (inf->ecode); +#else + if (rec_rep_spc(inf, bas)) + return (inf->ecode); +#endif + distance = inf->len - offset; + if (distance > 255) { + if (rec_code(inf, Re_RepLongJump) || + rec_byte(inf, inf->bas) || + rec_byte(inf, distance & 0xff) || + rec_byte(inf, (distance & 0xff00) >> 8)) + break; + } + else if (rec_code(inf, Re_RepJump) || + rec_byte(inf, inf->bas) || + rec_byte(inf, distance)) + break; + distance = inf->len - offset; + inf->cod[jump] = distance & 0xff; + inf->cod[jump + 1] = (distance & 0xff00) >> 8; + } + pat = pat->next; + } + + return (inf->ecode); +} + +static int +rec_build_rng(re_inf *inf, rec_rng *rng) +{ + if (rec_check(inf, sizeof(rng->range)) == 0) { + memcpy(inf->cod + inf->len, rng->range, sizeof(rng->range)); + inf->len += sizeof(rng->range); + } + + return (inf->ecode); +} + +static int +rec_build_grp(re_inf *inf, rec_grp *grp) +{ + int par = inf->par; + + if (!(inf->flags & RE_NOSUB)) { + ++inf->par; + if (par == 0) + ++inf->ref; + if (rec_build_alt(inf, grp->alt) == 0) { + if (par == 0) { + if (grp->comp) + rec_code_byte(inf, Re_Update, inf->ref - 1); + else + rec_code(inf, Re_Close); + } + } + --inf->par; + } + else + rec_build_alt(inf, grp->alt); + + return (inf->ecode); +} + +static int +rec_build_stl(re_inf *inf, rec_stl *stl) +{ + int i, len, rlen; + ReCode code; + + /* Calculate jump distance information */ + rlen = stl->tlen + stl->nstrs + 4; + /* + code + nstrs + place-offset + data-length */ + + if (stl->nstrs >= LARGE_STL_COUNT) { + rlen += 511; /* Don't write number of strings */ + code = stl->type == Rep_StringList ? + Re_LargeStringList : Re_LargeCaseStringList; + } + else + code = (ReCode)stl->type; + + if (rlen >= 16386) + return (inf->ecode = RE_ESPACE); + if (rec_check(inf, rlen) || + rec_code(inf, code)) + return (inf->ecode); + + /* Space is allocated, just write the data */ + if (stl->nstrs < LARGE_STL_COUNT) + inf->cod[inf->len++] = stl->nstrs; + + inf->cod[inf->len++] = rlen & 0xff; + inf->cod[inf->len++] = (rlen & 0xff00) >> 8; + + if (stl->nstrs < LARGE_STL_COUNT) { + for (i = 0; i < stl->nstrs; i++) + inf->cod[inf->len++] = stl->lens[i]; + for (i = 0; i < stl->nstrs; i++) { + len = stl->lens[i]; + if (len > 2) { + memcpy(inf->cod + inf->len, stl->strs[i], len); + inf->len += len; + } + else { + if (len == 1) + inf->cod[inf->len++] = (long)stl->strs[i]; + else { + inf->cod[inf->len++] = (long)stl->strs[i] & 0xff; + inf->cod[inf->len++] = ((long)stl->strs[i] & 0xff00) >> 8; + } + } + } + } + else { + /* The string length goes before the string itself */ + int j, chl, chu; + + /* Fill everything with an invalid jump address */ + memset(inf->cod + inf->len, 0xff, 512); + for (i = len = 0, j = -1; i < stl->nstrs; i++) { + chl = stl->lens[i] > 2 ? stl->strs[i][0] : (long)stl->strs[i] & 0xff; + if (chl != j) { + inf->cod[inf->len + (chl << 1)] = len & 0xff; + inf->cod[inf->len + (chl << 1) + 1] = (len & 0xff00) >> 8; + if (code == Re_LargeCaseStringList) { + chu = stl->lens[i] > 2 ? + stl->strs[i][1] : ((long)(stl->strs[i]) & 0xff00) >> 8; + inf->cod[inf->len + (chu << 1)] = len & 0xff; + inf->cod[inf->len + (chu << 1) + 1] = (len & 0xff00) >> 8; + } + j = chl; + } + len += stl->lens[i] + 1; + } + inf->len += 512; + + for (i = 0; i < stl->nstrs; i++) { + len = stl->lens[i]; + inf->cod[inf->len++] = len; + if (len > 2) { + memcpy(inf->cod + inf->len, stl->strs[i], len); + inf->len += len; + } + else { + if (len == 1) + inf->cod[inf->len++] = (long)stl->strs[i]; + else { + inf->cod[inf->len++] = (long)stl->strs[i] & 0xff; + inf->cod[inf->len++] = ((long)stl->strs[i] & 0xff00) >> 8; + } + } + } + } + + return (inf->ecode); +} + +static int +rec_build_rep(re_inf *inf, rec_rep *rep) +{ + if (rep) { + switch (rep->type) { + case Rer_AnyTimes: + case Rer_AtLeast: + case Rer_Maybe: + rec_code(inf, (ReCode)rep->type); + break; + case Rer_Exact: + if (rec_code(inf, Re_Exact) == 0) + rec_byte(inf, rep->mine); + break; + case Rer_Min: + if (rec_code(inf, Re_Min) == 0) + rec_byte(inf, rep->mine); + break; + case Rer_Max: + if (rec_code(inf, Re_Max) == 0) + rec_byte(inf, rep->maxc); + break; + case Rer_MinMax: + if (rec_code(inf, Re_MinMax) == 0 && + rec_byte(inf, rep->mine) == 0) + rec_byte(inf, rep->maxc); + break; + } + /* It is incremented in rec_build_pat */ + rec_byte(inf, inf->bas - 1); + } + + return (inf->ecode); +} + +static int +rec_inc_spc(re_inf *inf) +{ + if (++inf->bas >= MAX_DEPTH) + return (inf->ecode = RE_ESPACE); + + return (inf->ecode); +} + +static int +rec_dec_spc(re_inf *inf) +{ + if (--inf->bas < 0) + return (inf->ecode = RE_ASSERT); + + return (inf->ecode); +} + +static int +rec_add_spc(re_inf *inf, int maybe) +{ + if (++inf->bas >= MAX_DEPTH) + return (inf->ecode = RE_ESPACE); + inf->sp[inf->bas] = maybe + 1; + + return (inf->ecode); +} + +/* Could be joined with rec_rep_spc, code almost identical */ +static int +rec_alt_spc(re_inf *inf, int top) +{ + int distance, i, bas = inf->bas; + + while ((inf->bas > top) && inf->sp[inf->bas]) { + /* Jump to this repetition for cleanup */ + distance = inf->len - inf->sr[inf->bas]; + + /* This will generate a jump to a jump decision opcode */ + inf->sj[inf->bas] = inf->len; + + if (distance > 255) { + if (rec_code(inf, Re_RepLongJump) || + rec_byte(inf, inf->bas - 1) || + rec_byte(inf, distance & 0xff) || + rec_byte(inf, (distance & 0xff00) >> 8)) + break; + } + else if (rec_code(inf, Re_RepJump) || + rec_byte(inf, inf->bas - 1) || + rec_byte(inf, distance)) + break; + + /* Top of stack value before repetition, or end condition value */ + --inf->bas; + } + + i = inf->bas + 1; + + if (inf->ecode == 0 && i <= bas && inf->sp[i]) { + /* Only the repetition at the bottom jump to code after testing + * all possibilities */ + distance = inf->len - inf->sr[i]; + inf->cod[inf->sr[i] + 3] = distance & 0xff; + inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; + + /* The bottom jump is here */ + if (rec_code(inf, inf->sp[i] == 1 ? Re_DoneIf : Re_MaybeDone)) + return (inf->ecode); + + /* Generate jumps to the previous special repetition */ + for (++i; i <= bas; i++) { + if (inf->sp[i]) { + distance = inf->sj[i] - inf->sr[i]; + inf->cod[inf->sr[i] + 3] = distance & 0xff; + inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; + } + } + } + + return (inf->ecode); +} + +static int +rec_rep_spc(re_inf *inf, int top) +{ + int distance, i, bas = inf->bas; + + while (inf->bas > top) { + if (inf->sp[inf->bas]) { + /* Jump to this repetition for cleanup */ + distance = inf->len - inf->sr[inf->bas]; + + /* This will generate a jump to a jump decision opcode */ + inf->sj[inf->bas] = inf->len; + + if (distance > 255) { + if (rec_code(inf, Re_RepLongJump) || + rec_byte(inf, inf->bas - 1) || + rec_byte(inf, distance & 0xff) || + rec_byte(inf, (distance & 0xff00) >> 8)) + break; + } + else if (rec_code(inf, Re_RepJump) || + rec_byte(inf, inf->bas - 1) || + rec_byte(inf, distance)) + break; + } + + /* Top of stack value before repetition, or end condition value */ + --inf->bas; + } + + /* Find first special repetition offset. XXX This should be a noop */ + for (i = 0; i < bas; i++) + if (inf->sp[i]) + break; + + if (inf->ecode == 0 && i <= bas && inf->sp[i]) { + /* Only the repetition at the bottom jump to code after testing + * all possibilities */ + distance = inf->len - inf->sr[i]; + inf->cod[inf->sr[i] + 3] = distance & 0xff; + inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; + + /* Generate jumps to the previous special repetition */ + for (++i; i <= bas; i++) { + if (inf->sp[i]) { + distance = inf->sj[i] - inf->sr[i]; + inf->cod[inf->sr[i] + 3] = distance & 0xff; + inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; + } + } + } + + return (inf->ecode); +} + +static int +rec_off_spc(re_inf *inf) +{ + /* The jump address before the three bytes instruction */ + inf->sr[inf->bas] = inf->len - 3; + /* Don't know yet where to go after done with the special + * repetition, just reserve two bytes for the jump address. */ + return (rec_byte_byte(inf, 0, 0)); +} + +#ifdef DEBUG +static void +redump(re_cod *code) +{ + int i, j, k; + unsigned char *cod = code->cod, *stl; + + if (cod[0] & RE_NOSUB) + printf("Nosub\n"); + if (cod[0] & RE_NEWLINE) + printf("Newline\n"); + ++cod; + if (cod[0] != 0xff) + printf("%d backrefs\n", cod[0] + 1); + ++cod; + for (;;) { + switch (*cod++) { + case Re_Open: + printf("Open"); + break; + case Re_Close: + printf("Close"); + break; + case Re_Update: + printf("Update (%d)", (int)*cod++); + break; + case Re_Alt: + printf("Alt"); + i = cod[0] | cod[1]; + cod += 2; + printf(" %d", i); + break; + case Re_AltNext: + printf("Alt-next"); + i = cod[0] | cod[1]; + cod += 2; + printf(" %d", i); + break; + case Re_AltDone: + printf("Alt-done"); + break; + case Re_AnyTimes: + printf("-> Anytimes %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_AnyEatAnyTimes: + printf("Any-eat-anytimes"); + break; + case Re_AnyAnyTimes: + printf("-> Any-anytimes %d", (int)*cod++); + printf(" (%d)", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_AnyEatMaybe: + printf("Any-eat-maybe"); + break; + case Re_AnyMaybe: + printf("-> Any-maybe %d", (int)*cod++); + printf(" (%d)", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_AnyAtLeast: + printf("-> Any-atleast %d", (int)*cod++); + printf(" (%d)", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_AnyEatAtLeast: + printf("Any-eat-atleast"); + break; + case Re_Maybe: + printf("-> Maybe %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_AtLeast: + printf("-> Atleast %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_Exact: + printf("-> Exact "); + i = *cod++; + printf("%d", i); + printf(" %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_Min: + printf("-> Min "); + i = *cod++; + printf("%d", i); + printf(" %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_Max: + printf("-> Max "); + i = *cod++; + printf("%d", i); + printf(" %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_MinMax: + printf("-> Min-max "); + i = *cod++; + printf("%d ", i); + i = *cod++; + printf("%d", i); + printf(" %d", (int)*cod++); + i = cod[0] | (cod[1] << 8); + cod += 2; + printf(" /%d", i); + break; + case Re_RepJump: + printf("<- Rep-jump %d ", (int)*cod++); + i = *cod++; + printf("%d", i); + break; + case Re_RepLongJump: + printf("<- Rep-long-jump %d ", (int)*cod++); + i = cod[0] | (cod[1] << 8); + printf("%d", i); + break; + case Re_Any: + printf("Any"); + break; + case Re_Odigit: + printf("Odigit"); + break; + case Re_OdigitNot: + printf("Odigit-not"); + break; + case Re_Digit: + printf("Digit"); + break; + case Re_DigitNot: + printf("Digit-not"); + break; + case Re_Xdigit: + printf("Xdigit"); + break; + case Re_XdigitNot: + printf("Xdigit-not"); + break; + case Re_Space: + printf("Space"); + break; + case Re_SpaceNot: + printf("Space-not"); + break; + case Re_Tab: + printf("Tab"); + break; + case Re_Newline: + printf("Newline"); + break; + case Re_Lower: + printf("Lower"); + break; + case Re_Upper: + printf("Upper"); + break; + case Re_Alnum: + printf("Alnum"); + break; + case Re_AlnumNot: + printf("Alnum-not"); + break; + case Re_Control: + printf("Control"); + break; + case Re_ControlNot: + printf("Control-not"); + break; + case Re_Bol: + printf("Bol"); + break; + case Re_Eol: + printf("Eol"); + break; + case Re_Bow: + printf("Bow"); + break; + case Re_Eow: + printf("Eow"); + break; + case Re_Range: + printf("Range "); + goto range; + case Re_RangeNot: + printf("Range-not "); +range: + for (i = 0; i < 256; i += 32) { + for (j = k = 0; j < 32; j++) + k |= (*cod++ & 1) << (31 - j); + printf("%x ", k); + } + break; + case Re_Literal: + printf("Literal %c", *cod++); + break; + case Re_LiteralNot: + printf("Literal-not %c", *cod++); + break; + case Re_SearchLiteral: + printf("Search-literal %c", *cod++); + break; + case Re_CaseLiteral: + printf("Case-literal %c", *cod++); + putchar(*cod++); + break; + case Re_CaseLiteralNot: + printf("Case-literal-not %c", *cod++); + putchar(*cod++); + break; + case Re_SearchCaseLiteral: + printf("Search-case-literal %c", *cod++); + putchar(*cod++); + break; + case Re_String: + printf("String "); + goto string; + case Re_SearchString: + printf("Search-string "); + goto string; + case Re_CaseString: + printf("Case-string "); + goto string; + case Re_SearchCaseString: + printf("Search-case-string "); +string: + i = *cod++; + if (i & 0x80) + i = (i & 0x7f) | (*cod++ << 7); + for (j = 0; j < i; j++) + putchar(*cod++); + break; + case Re_StringList: + printf("String-list"); + goto string_list; + case Re_CaseStringList: + printf("Case-string-list"); +string_list: + j = *cod++; + cod += 2; + stl = cod + j; + for (i = 0; i < j; i++) { + k = *cod++; + putchar(i ? ',' : ' '); + fwrite(stl, k, 1, stdout); + stl += k; + } + cod = stl; + break; + case Re_LargeStringList: + printf("Large-string-list"); +large_string_list: + i = cod[0] | (cod[1] << 8); + stl = cod + i - 1; + for (i = 0, cod += 514; cod < stl; i++) { + k = *cod++; + putchar(i ? ',' : ' '); + fwrite(cod, k, 1, stdout); + cod += k; + } + cod = stl; + break; + case Re_LargeCaseStringList: + printf("Large-case-string-list"); + goto large_string_list; + case Re_Backref: + printf("Backref %d", (int)*cod++); + break; + case Re_DoneIf: + printf("Done-if"); + break; + case Re_MaybeDone: + printf("Maybe-done"); + break; + case Re_Done: + printf("Done\n"); + return; + } + putchar('\n'); + } +} +#endif Index: xc/programs/xedit/lisp/re/re.h diff -u /dev/null xc/programs/xedit/lisp/re/re.h:1.2 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/re.h Sun Sep 22 21:25:41 2002 @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/re/re.h,v 1.2 2002/09/23 01:25:41 paulo Exp $ */ + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#ifndef _re_h +#define _re_h + +/* + * Defines + */ + + /* Compile flags options */ +#define REG_BASIC 0000 /* Not used */ +#define REG_EXTENDED 0001 /* Not used, only extended supported */ + +#define RE_ICASE 0002 +#define RE_NOSUB 0004 +#define RE_NEWLINE 0010 +#define RE_NOSPEC 0020 +#define RE_PEND 0040 +#define RE_DUMP 0200 + + + + /* Execute flag options */ +#define RE_NOTBOL 1 +#define RE_NOTEOL 2 +#define RE_STARTEND 4 +#define RE_TRACE 00400 /* Not used/supported */ +#define RE_LARGE 01000 /* Not used/supported */ +#define RE_BACKR 02000 /* Not used/supported */ + + /* Value returned by reexec when match fails */ +#define RE_NOMATCH 1 + /* Compile error values */ +#define RE_BADPAT 2 +#define RE_ECOLLATE 3 +#define RE_ECTYPE 4 +#define RE_EESCAPE 5 +#define RE_ESUBREG 6 +#define RE_EBRACK 7 +#define RE_EPAREN 8 +#define RE_EBRACE 9 +#define RE_EBADBR 10 +#define RE_ERANGE 11 +#define RE_ESPACE 12 +#define RE_BADRPT 13 +#define RE_EMPTY 14 +#define RE_ASSERT 15 +#define RE_INVARG 16 +#define RE_ATOI 255 /* Not used/supported */ +#define RE_ITOA 0400 /* Not used/supported */ + + +/* + * Types + */ + +/* (re)gular expression (mat)ch result */ +typedef struct _re_mat { + long rm_so; + long rm_eo; +} re_mat; + +/* (re)gular expression (cod)e */ +typedef struct _re_cod { + unsigned char *cod; + int re_nsub; /* Public member */ + const char *re_endp; /* Support for RE_PEND */ +} re_cod; + + +/* + * Prototypes + */ + /* compile the given pattern string + * returns 0 on success, error code otherwise */ +int recomp(re_cod *preg, const char *pattern, int flags); + + /* execute the compiled pattern on the string. + * returns 0 if matched, RE_NOMATCH if failed, error code otherwise */ +int reexec(const re_cod *preg, const char *string, + int nmat, re_mat pmat[], int flags); + + /* formats an error message for the given code in ebuffer */ +int reerror(int ecode, const re_cod *preg, char *ebuffer, int ebuffer_size); + + /* frees the given parameter */ +void refree(re_cod *preg); + + +#endif /* _re_h */ Index: xc/programs/xedit/lisp/re/rec.c diff -u /dev/null xc/programs/xedit/lisp/re/rec.c:1.4 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/rec.c Thu Jan 16 01:25:52 2003 @@ -0,0 +1,1015 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/re/rec.c,v 1.4 2003/01/16 06:25:52 paulo Exp $ */ + +#include "rep.h" + +/* + * Types + */ + +/* Information used while compiling the intermediate format of the re. */ +typedef struct _irec_info { + unsigned char *ptr; /* Pointer in the given regex pattern */ + unsigned char *end; /* End of regex pattern */ + int flags; /* Compile flags */ + rec_alt *alt; /* Toplevel first/single alternative */ + + rec_alt *palt; /* Current alternative being compiled */ + rec_grp *pgrp; /* Current group, if any */ + rec_pat *ppat; /* Current pattern, if any */ + + /* Number of open parenthesis, for error checking */ + int nparens; + + int ngrps; /* Number of groups, for backreference */ + + int ecode; +} irec_info; + + +/* + * Prototypes + */ + + /* (i)ntermediate (r)egular (e)xpression (c)ompile + * Generates an intermediate stage compiled regex from + * the specified pattern argument. Basically builds an + * intermediate data structure to analyse and do syntax + * error checking. + */ +static void irec_simple_pattern(irec_info*, rec_pat_t); +static void irec_literal_pattern(irec_info*, int); +static void irec_case_literal_pattern(irec_info*, int); +static void irec_open_group(irec_info*); +static void irec_close_group(irec_info*); +static void irec_range(irec_info*); +static void irec_range_single(irec_info*, int); +static void irec_range_complex(irec_info*, int, int); +static void irec_escape(irec_info*); +static void irec_simple_repetition(irec_info*, rec_rep_t); +static void irec_complex_repetition(irec_info*); +static void irec_add_repetition(irec_info*, rec_rep*); +static void irec_free(irec_info*); +static void irec_free_grp(rec_grp*); +static void irec_free_pats(rec_pat*); + + +/* + * Implementation + */ +rec_alt * +irec_comp(const char *pattern, const char *endp, int flags, int *ecode) +{ + unsigned char *ptr; + rec_alt *alt; + irec_info inf; + + if (pattern == NULL || endp < pattern) { + *ecode = RE_INVARG; + return (NULL); + } + + if (endp == pattern) { + *ecode = RE_EMPTY; + return (NULL); + } + + alt = calloc(1, sizeof(rec_alt)); + if (alt == NULL) { + *ecode = RE_ESPACE; + return (NULL); + } + + inf.ptr = (unsigned char*)pattern; + inf.end = (unsigned char*)endp; + inf.flags = flags; + inf.alt = inf.palt = alt; + inf.pgrp = NULL; + inf.ppat = NULL; + inf.nparens = inf.ngrps = 0; + inf.ecode = 0; + + if (flags & RE_NOSPEC) { + /* Just searching for a character or substring */ + for (; inf.ecode == 0 && inf.ptr < inf.end; inf.ptr++) { + if (!(flags & RE_ICASE) || + (!isupper(*inf.ptr) && !islower(*inf.ptr))) + irec_literal_pattern(&inf, *inf.ptr); + else + irec_case_literal_pattern(&inf, *inf.ptr); + } + } + /* inf.ptr = inf.end is nul if flags & RE_NOSPEC */ + for (; inf.ecode == 0 && inf.ptr < inf.end;) { + switch (*inf.ptr++) { + case '*': + irec_simple_repetition(&inf, Rer_AnyTimes); + break; + case '+': + irec_simple_repetition(&inf, Rer_AtLeast); + break; + case '?': + irec_simple_repetition(&inf, Rer_Maybe); + break; + case '.': + irec_simple_pattern(&inf, Rep_Any); + break; + case '^': + if (flags & RE_NEWLINE) + /* It is up to the user decide if this can match */ + irec_simple_pattern(&inf, Rep_Bol); + else { + for (ptr = inf.ptr - 1; + ptr > (unsigned char*)pattern && *ptr == '('; ptr--) + ; + /* If at the start of a pattern */ + if (ptr == (unsigned char*)pattern || *ptr == '|') + irec_simple_pattern(&inf, Rep_Bol); + else + /* In the middle of a pattern, treat as literal */ + irec_literal_pattern(&inf, '^'); + } + break; + case '$': + if (flags & RE_NEWLINE) + irec_simple_pattern(&inf, Rep_Eol); + else { + /* Look ahead to check if is the last char of a group */ + for (ptr = inf.ptr; ptr < inf.end && *ptr == ')'; ptr++) + ; + if (*ptr == '\0' || *ptr == '|') + /* Last character of pattern, an EOL match */ + irec_simple_pattern(&inf, Rep_Eol); + else + /* Normal character */ + irec_literal_pattern(&inf, '$'); + } + break; + case '(': + irec_open_group(&inf); + break; + case ')': + /* Look ahead to check if need to close the group now */ + ptr = inf.ptr; + if (*ptr != '*' && *ptr != '+' && *ptr != '?' && *ptr != '{') + /* If a repetition does not follow */ + irec_close_group(&inf); + else if (inf.pgrp == NULL) + /* A repetition follows, but current group is implicit */ + inf.ecode = RE_EPAREN; + else + /* Can do this as next character is known */ + inf.ppat = NULL; + break; + case '[': + irec_range(&inf); + break; + case ']': + irec_literal_pattern(&inf, ']'); + break; + case '{': + irec_complex_repetition(&inf); + break; + case '}': + irec_literal_pattern(&inf, '}'); + break; + case '|': + /* If first character in the pattern */ + if (inf.ptr - 1 == (unsigned char*)pattern || + /* If last character in the pattern */ + inf.ptr >= inf.end || + /* If empty pattern */ + inf.ptr[0] == '|' || + inf.ptr[0] == ')') + inf.ecode = RE_EMPTY; + else { + rec_alt *alt = calloc(1, sizeof(rec_alt)); + + if (alt) { + alt->prev = inf.palt; + inf.palt->next = alt; + inf.palt = alt; + inf.ppat = NULL; + } + else + inf.ecode = RE_ESPACE; + } + break; + case '\\': + irec_escape(&inf); + break; + default: + if (!(flags & RE_ICASE) || + (!isupper(inf.ptr[-1]) && !islower(inf.ptr[-1]))) + irec_literal_pattern(&inf, inf.ptr[-1]); + else + irec_case_literal_pattern(&inf, inf.ptr[-1]); + break; + } + } + + /* Check if not all groups closed */ + if (inf.ecode == 0 && inf.nparens) + inf.ecode = RE_EPAREN; + + if (inf.ecode == 0) + inf.ecode = orec_comp(inf.alt, flags); + + /* If an error generated */ + if (inf.ecode) { + irec_free(&inf); + alt = NULL; + } + + *ecode = inf.ecode; + + return (alt); +} + +void +irec_free_alt(rec_alt *alt) +{ + rec_alt *next; + + while (alt) { + next = alt->next; + irec_free_pats(alt->pat); + free(alt); + alt = next; + } +} + + + +static void +irec_simple_pattern(irec_info *inf, rec_pat_t type) +{ + rec_pat *pat; + + /* Always add a new pattern to list */ + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + pat->type = type; + if ((pat->prev = inf->ppat) != NULL) + inf->ppat->next = pat; + else + inf->palt->pat = pat; + inf->ppat = pat; +} + +static void +irec_literal_pattern(irec_info *inf, int value) +{ + int length; + rec_pat *pat; + unsigned char chr, *str; + + /* If there is a current pattern */ + if (inf->ppat && inf->ppat->rep == NULL) { + switch (inf->ppat->type) { + case Rep_Literal: + /* Start literal string */ + chr = inf->ppat->data.chr; + if ((str = malloc(16)) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + inf->ppat->type = Rep_String; + inf->ppat->data.str = str; + str[0] = chr; + str[1] = value; + str[2] = '\0'; + return; + + case Rep_String: + /* Augments literal string */ + length = strlen((char*)inf->ppat->data.str); + if ((length % 16) >= 14) { + if ((str = realloc(inf->ppat->data.str, + length + 18)) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + inf->ppat->data.str = str; + } + inf->ppat->data.str[length] = value; + inf->ppat->data.str[length + 1] = '\0'; + return; + + default: + /* Anything else is added as a new pattern list element */ + break; + } + } + + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + pat->type = Rep_Literal; + pat->data.chr = value; + if ((pat->prev = inf->ppat) != NULL) + inf->ppat->next = pat; + else + inf->palt->pat = pat; + inf->ppat = pat; +} + +static void +irec_case_literal_pattern(irec_info *inf, int value) +{ + int length; + rec_pat *pat; + unsigned char plower, pupper, lower, upper, *str; + + lower = tolower(value); + upper = toupper(value); + + /* If there is a current pattern */ + if (inf->ppat && inf->ppat->rep == NULL) { + switch (inf->ppat->type) { + case Rep_CaseLiteral: + /* Start case literal string */ + plower = inf->ppat->data.cse.lower; + pupper = inf->ppat->data.cse.upper; + if ((str = malloc(32)) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + inf->ppat->type = Rep_CaseString; + inf->ppat->data.str = str; + str[0] = plower; + str[1] = pupper; + str[2] = lower; + str[3] = upper; + str[4] = '\0'; + return; + + case Rep_CaseString: + /* Augments case literal string */ + length = strlen((char*)inf->ppat->data.str); + if (((length) % 32) >= 28) { + if ((str = realloc(inf->ppat->data.str, + length + 36)) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + inf->ppat->data.str = str; + } + inf->ppat->data.str[length] = lower; + inf->ppat->data.str[length + 1] = upper; + inf->ppat->data.str[length + 2] = '\0'; + return; + + default: + /* Anything else is added as a new pattern list element */ + break; + } + } + + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + pat->type = Rep_CaseLiteral; + pat->data.cse.lower = lower; + pat->data.cse.upper = upper; + pat->prev = inf->ppat; + if ((pat->prev = inf->ppat) != NULL) + inf->ppat->next = pat; + else + inf->palt->pat = pat; + inf->ppat = pat; +} + +static void +irec_open_group(irec_info *inf) +{ + rec_pat *pat; + rec_alt *alt; + rec_grp *grp; + + if ((grp = calloc(1, sizeof(rec_grp))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + free(grp); + inf->ecode = RE_ESPACE; + return; + } + + if ((alt = calloc(1, sizeof(rec_alt))) == NULL) { + free(grp); + free(pat); + inf->ecode = RE_ESPACE; + return; + } + + pat->type = Rep_Group; + pat->data.grp = grp; + grp->parent = pat; + grp->palt = inf->palt; + grp->pgrp = inf->pgrp; + grp->alt = alt; + grp->comp = 0; + if ((pat->prev = inf->ppat) != NULL) + inf->ppat->next = pat; + else + inf->palt->pat = pat; + inf->palt = alt; + inf->ppat = NULL; + + /* Only toplevel parenthesis supported */ + if (++inf->nparens == 1) + ++inf->ngrps; + + inf->pgrp = grp; +} + +static void +irec_close_group(irec_info *inf) +{ + if (inf->pgrp == NULL) { + inf->ecode = RE_EPAREN; + return; + } + + inf->palt = inf->pgrp->palt; + inf->ppat = inf->pgrp->parent; + inf->pgrp = inf->pgrp->pgrp; + + --inf->nparens; +} + +static void +irec_range(irec_info *inf) +{ + int count; + rec_pat *pat; + rec_rng *rng; + int not = inf->ptr[0] == '^'; + + if (not) + ++inf->ptr; + + pat = calloc(1, sizeof(rec_pat)); + if (pat == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + rng = calloc(1, sizeof(rec_rng)); + if (pat == NULL) { + free(pat); + inf->ecode = RE_ESPACE; + return; + } + + pat->data.rng = rng; + pat->type = not ? Rep_RangeNot : Rep_Range; + if ((pat->prev = inf->ppat) != NULL) + inf->ppat->next = pat; + else + inf->palt->pat = pat; + inf->ppat = pat; + + /* First pass, add everything seen */ + for (count = 0; inf->ecode == 0; count++) { + /* If bracket not closed */ + if (inf->ptr == inf->end) { + inf->ecode = RE_EBRACK; + return; + } + /* If not the first character */ + else if (inf->ptr[0] == ']' && count) + break; + else { + /* If not a range of characters */ + if (inf->ptr[1] != '-' || inf->ptr[2] == ']') { + irec_range_single(inf, inf->ptr[0]); + ++inf->ptr; + } + else { + if ((inf->flags & RE_NEWLINE) && + inf->ptr[0] < '\n' && inf->ptr[2] > '\n') { + /* Unless it is forced to be a delimiter, don't allow + * a newline in a character range */ + if (inf->ptr[0] == '\n' - 1) + irec_range_single(inf, inf->ptr[0]); + else + irec_range_complex(inf, inf->ptr[0], '\n' - 1); + if (inf->ptr[2] == '\n' + 1) + irec_range_single(inf, inf->ptr[2]); + else + irec_range_complex(inf, '\n' + 1, inf->ptr[2]); + } + else + irec_range_complex(inf, inf->ptr[0], inf->ptr[2]); + inf->ptr += 3; + } + } + } + + /* Skip ] */ + ++inf->ptr; +} + +static void +irec_range_single(irec_info *inf, int value) +{ + if (value >= 0 && value <= 255) + inf->ppat->data.rng->range[value] = 1; + + if (inf->flags & RE_ICASE) { + if (islower(value)) { + value = toupper(value); + if (value >= 0 && value <= 255) + inf->ppat->data.rng->range[value] = 1; + } + else if (isupper(value)) { + value = tolower(value); + if (value >= 0 && value <= 255) + inf->ppat->data.rng->range[value] = 1; + } + } +} + +static void +irec_range_complex(irec_info *inf, int chrf, int chrt) +{ + if (chrf > chrt) { + inf->ecode = RE_ERANGE; + return; + } + + for (; chrf <= chrt; chrf++) + irec_range_single(inf, chrf); +} + +static void +irec_escape(irec_info *inf) +{ + rec_pat *pat; + unsigned char chr = inf->ptr[0]; + + if (chr == 0) { + inf->ecode = RE_EESCAPE; + return; + } + ++inf->ptr; + switch (chr) { + case 'o': + irec_simple_pattern(inf, Rep_Odigit); + break; + case 'O': + irec_simple_pattern(inf, Rep_OdigitNot); + break; + case 'd': + irec_simple_pattern(inf, Rep_Digit); + break; + case 'D': + irec_simple_pattern(inf, Rep_DigitNot); + break; + case 'x': + irec_simple_pattern(inf, Rep_Xdigit); + break; + case 'X': + irec_simple_pattern(inf, Rep_XdigitNot); + break; + case 's': + irec_simple_pattern(inf, Rep_Space); + break; + case 'S': + irec_simple_pattern(inf, Rep_SpaceNot); + break; + case 't': + irec_simple_pattern(inf, Rep_Tab); + break; + case 'n': + irec_simple_pattern(inf, Rep_Newline); + break; + case 'l': + irec_simple_pattern(inf, Rep_Lower); + break; + case 'u': + irec_simple_pattern(inf, Rep_Upper); + break; + case 'w': + irec_simple_pattern(inf, Rep_Alnum); + break; + case 'W': + irec_simple_pattern(inf, Rep_AlnumNot); + break; + case 'c': + irec_simple_pattern(inf, Rep_Control); + break; + case 'C': + irec_simple_pattern(inf, Rep_ControlNot); + break; + case '<': + irec_simple_pattern(inf, Rep_Bow); + break; + case '>': + irec_simple_pattern(inf, Rep_Eow); + break; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + if ((inf->flags & RE_NOSUB) || (chr -= '1') >= inf->ngrps) { + inf->ecode = RE_ESUBREG; + return; + } + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + pat->type = Rep_Backref; + pat->data.chr = chr; + pat->prev = inf->ppat; + if (inf->ppat) + inf->ppat->next = pat; + else + inf->palt->pat = pat; + inf->ppat = pat; + break; + + /* True literals */ + case '0': + irec_literal_pattern(inf, '\0'); + break; + case 'a': + irec_literal_pattern(inf, '\a'); + break; + case 'b': + irec_literal_pattern(inf, '\b'); + break; + case 'f': + irec_literal_pattern(inf, '\f'); + break; + case 'r': + irec_literal_pattern(inf, '\r'); + break; + case 'v': + irec_literal_pattern(inf, '\v'); + break; + + default: + /* Don't check if case insensitive regular expression */ + irec_literal_pattern(inf, chr); + break; + } +} + +static void +irec_simple_repetition(irec_info *inf, rec_rep_t type) +{ + rec_rep *rep; + + /* If nowhere to add repetition */ + if ((inf->pgrp == NULL && inf->ppat == NULL) || + /* If repetition already added to last/current pattern */ + (inf->pgrp == NULL && inf->ppat->rep != NULL) || + /* If repetition already added to last/current group */ + (inf->ppat == NULL && inf->pgrp->parent->rep != NULL)) { + inf->ecode = RE_BADRPT; + return; + } + + if ((rep = calloc(1, sizeof(rec_rep))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + rep->type = type; + irec_add_repetition(inf, rep); +} + +static void +irec_complex_repetition(irec_info *inf) +{ + int exact; + rec_rep *rep; + long mine, maxc; + unsigned char *end; + + /* If nowhere to add repetition */ + if ((inf->pgrp == NULL && inf->ppat == NULL) || + /* If repetition already added to last/current pattern */ + (inf->pgrp == NULL && inf->ppat->rep != NULL) || + /* If repetition already added to last/current group */ + (inf->ppat == NULL && inf->pgrp->parent->rep != NULL)) { + inf->ecode = RE_EBADBR; + return; + } + + exact = 0; + mine = maxc = -1; + if (inf->ptr[0] == ',') + /* Specify max number of ocurrences only */ + goto domax; + else if (!isdigit(inf->ptr[0])) + goto badbr; + + mine = strtol((char*)inf->ptr, (char**)&end, 10); + inf->ptr = end; + if (inf->ptr[0] == '}') { + exact = 1; + ++inf->ptr; + goto redone; + } + else if (inf->ptr[0] != ',') + goto badbr; + +domax: + /* Add one to skip comma */ + ++inf->ptr; + if (inf->ptr[0] == '}') { + ++inf->ptr; + goto redone; + } + else if (!isdigit(inf->ptr[0])) + goto badbr; + maxc = strtol((char*)inf->ptr, (char**)&end, 10); + inf->ptr = end; + if (inf->ptr[0] != '}') + goto badbr; + ++inf->ptr; + +redone: + if (mine == maxc) { + maxc = -1; + exact = 1; + } + + /* Check range and if min-max parameters are valid */ + if (mine >= 255 || maxc >= 255 || + (mine >= 0 && maxc >= 0 && mine > maxc)) + goto badbr; + + /* Check for noop */ + if (exact && mine == 1) + return; + + if ((rep = calloc(1, sizeof(rec_rep))) == NULL) { + inf->ecode = RE_ESPACE; + return; + } + + /* Convert {0,1} to ? */ + if (mine == 0 && maxc == 1) + rep->type = Rer_Maybe; + else if (exact) { + rep->type = Rer_Exact; + rep->mine = mine; + } + /* Convert {0,} to * */ + else if (mine == 0 && maxc == -1) + rep->type = Rer_AnyTimes; + /* Convert {1,} to + */ + else if (mine == 1 && maxc == -1) + rep->type = Rer_AtLeast; + else if (maxc == -1) { + rep->type = Rer_Min; + rep->mine = mine; + } + else if (mine < 1) { + rep->type = Rer_Max; + rep->maxc = maxc; + } + else { + rep->type = Rer_MinMax; + rep->mine = mine; + rep->maxc = maxc; + } + + irec_add_repetition(inf, rep); + + return; + +badbr: + inf->ecode = RE_EBADBR; +} + +/* The rep argument is allocated and has no reference yet, + * if something fails it must be freed before returning. + */ +static void +irec_add_repetition(irec_info *inf, rec_rep *rep) +{ + int length; + rec_pat *pat; + rec_grp *grp; + rec_rep_t rept; + unsigned char value, upper; + + rept = rep->type; + + if (inf->ppat == NULL) { + rec_pat *any; + rec_grp *grp = inf->pgrp; + + if (rept == Rer_AnyTimes || rept == Rer_Maybe || rept == Re_AtLeast) { + /* Convert (.)* to (.*), ((.))* not handled and may not match */ + any = NULL; + + if (grp->alt && grp->alt->pat) { + for (any = grp->alt->pat; any->next; any = any->next) + ; + switch (any->type) { + case Rep_Any: + break; + case Rep_AnyAnyTimes: + case Rep_AnyMaybe: + case Rep_AnyAtLeast: + free(rep); + inf->ecode = RE_BADRPT; + return; + default: + any = NULL; + break; + } + } + if (any) { + free(rep); + rep = NULL; + any->type = (rept == Rer_AnyTimes) ? Rep_AnyAnyTimes : + (rept == Rer_AtLeast) ? Rep_AnyAtLeast : + Rep_AnyMaybe; + while (grp) { + ++grp->comp; + grp = grp->pgrp; + } + } + } + inf->pgrp->parent->rep = rep; + irec_close_group(inf); + return; + } + + switch (inf->ppat->type) { + case Rep_Bol: + case Rep_Eol: + case Rep_Bow: + case Rep_Eow: + case Rep_AnyAnyTimes: + case Rep_AnyMaybe: + case Rep_AnyAtLeast: + /* Markers that cannot repeat */ + free(rep); + inf->ecode = RE_BADRPT; + return; + + case Rep_Any: + grp = inf->pgrp; + free(rep); + if (rept == Rer_AnyTimes || + rept == Rer_Maybe || + rept == Rer_AtLeast) { + inf->ppat->type = (rept == Rer_AnyTimes) ? + Rep_AnyAnyTimes : + (rept == Rer_Maybe) ? + Rep_AnyMaybe : + Rep_AnyAtLeast; + while (grp) { + ++grp->comp; + grp = grp->pgrp; + } + } + else + /* XXX Not (yet) implemented */ + inf->ecode = RE_BADRPT; + rep = NULL; + break; + + case Rep_String: + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + free(rep); + inf->ecode = RE_ESPACE; + return; + } + + length = strlen((char*)inf->ppat->data.str); + pat->type = Rep_Literal; + pat->prev = inf->ppat; + pat->data.chr = inf->ppat->data.str[length - 1]; + if (length == 2) { + /* Must convert to two Rep_Literals */ + value = inf->ppat->data.str[0]; + free(inf->ppat->data.str); + inf->ppat->data.chr = value; + inf->ppat->type = Rep_Literal; + } + else + /* Must remove last character from string */ + inf->ppat->data.str[length - 1] = '\0'; + inf->ppat->next = pat; + inf->ppat = pat; + break; + + case Rep_CaseString: + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + free(rep); + inf->ecode = RE_ESPACE; + return; + } + + length = strlen((char*)inf->ppat->data.str); + pat->type = Rep_CaseLiteral; + pat->prev = inf->ppat; + pat->data.cse.lower = inf->ppat->data.str[length - 2]; + pat->data.cse.upper = inf->ppat->data.str[length - 1]; + if (length == 4) { + /* Must convert to two Rep_CaseLiterals */ + value = inf->ppat->data.str[0]; + upper = inf->ppat->data.str[1]; + free(inf->ppat->data.str); + inf->ppat->data.cse.lower = value; + inf->ppat->data.cse.upper = upper; + inf->ppat->next = pat; + inf->ppat->type = Rep_CaseLiteral; + } + else + /* Must remove last character pair from string */ + inf->ppat->data.str[length - 2] = '\0'; + inf->ppat->next = pat; + inf->ppat = pat; + break; + + default: + /* Anything else does not need special handling */ + break; + } + + inf->ppat->rep = rep; +} + +static void +irec_free(irec_info *inf) +{ + irec_free_alt(inf->alt); +} + +static void +irec_free_grp(rec_grp *grp) +{ + if (grp->alt) + irec_free_alt(grp->alt); + free(grp); +} + +static void +irec_free_pats(rec_pat *pat) +{ + rec_pat *next; + rec_pat_t rect; + + while (pat) { + next = pat->next; + if (pat->rep) + free(pat->rep); + rect = pat->type; + if (rect == Rep_Range || rect == Rep_RangeNot) + free(pat->data.rng); + else if (rect == Rep_Group) + irec_free_grp(pat->data.grp); + else if (rect == Rep_StringList) + orec_free_stl(pat->data.stl); + free(pat); + pat = next; + } +} Index: xc/programs/xedit/lisp/re/reo.c diff -u /dev/null xc/programs/xedit/lisp/re/reo.c:1.9 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/reo.c Fri Nov 15 02:01:33 2002 @@ -0,0 +1,685 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/re/reo.c,v 1.9 2002/11/15 07:01:33 paulo Exp $ */ + +#include "rep.h" + +/* + * This file is a placeholder to add code to analyse and optimize the + * intermediate data structure generated in rep.c. + * Character ranges are optimized while being generated. + */ + +/* + * Types + */ +typedef struct _orec_inf { + rec_alt *alt; /* Main alternatives list */ + rec_grp *grp; /* Current group pointer */ + int flags; + int ecode; +} orec_inf; + +/* + * Prototypes + */ +static int orec_alt(orec_inf*, rec_alt*); +static int orec_pat(orec_inf*, rec_pat*); +static int orec_grp(orec_inf*, rec_grp*); +static int orec_pat_bad_rpt(orec_inf*, rec_pat*); +static int orec_pat_bad_forward_rpt(orec_inf*, rec_pat*); +static int orec_pat_rng(orec_inf*, rec_pat*); +static int orec_pat_cse(orec_inf*, rec_pat*); +static int orec_pat_cse_can(orec_inf*, rec_pat*); +static int orec_str_list(orec_inf*, rec_alt*, int, int); + +/* + * Initialization + */ +extern unsigned char re__alnum[256]; +extern unsigned char re__odigit[256]; +extern unsigned char re__ddigit[256]; +extern unsigned char re__xdigit[256]; +extern unsigned char re__control[256]; + +/* + * Implementation + */ +int +orec_comp(rec_alt *alt, int flags) +{ + orec_inf inf; + + inf.alt = alt; + inf.grp = NULL; + inf.flags = flags; + inf.ecode = 0; + + orec_alt(&inf, alt); + + return (inf.ecode); +} + +void +orec_free_stl(rec_stl *stl) +{ + int i; + + for (i = 0; i < stl->nstrs; i++) { + if (stl->lens[i] > 2) + free(stl->strs[i]); + } + + free(stl->lens); + free(stl->strs); + free(stl); +} + + +static int +orec_alt(orec_inf *inf, rec_alt *alt) +{ + if (alt) { + rec_alt *ptr = alt; + int ret, count = 0, str = 1, cstr = 1, lits = 0, clits = 0; + + /* Check if can build a string list */ + if (ptr->next) { + /* If more than one alternative */ + while (ptr && (str || cstr)) { + if (ptr->pat == NULL || ptr->pat->rep != NULL) { + cstr = str = 0; + break; + } + if ((inf->flags & RE_ICASE)) { + if (!(ret = orec_pat_cse_can(inf, ptr->pat))) { + cstr = str = 0; + break; + } + if (ret == 1) + ++lits; + else if (ret == 2) + ++clits; + } + else if (ptr->pat->next == NULL) { + if (ptr->pat->type != Rep_String) { + if (ptr->pat->type != Rep_Literal) { + str = 0; + if (ptr->pat->type != Rep_CaseString) { + if (ptr->pat->type != Rep_CaseLiteral) + cstr = 0; + else + ++clits; + } + else if (strlen((char*)ptr->pat->data.str) >= 255) + str = cstr = 0; + } + else + ++lits; + } + else if (strlen((char*)ptr->pat->data.str) >= 255) + str = cstr = 0; + } + else { + str = cstr = 0; + break; + } + if (++count >= 255) + str = cstr = 0; + ptr = ptr->next; + } + + if (str || cstr) { + if (inf->flags & RE_ICASE) { + for (ptr = alt; ptr; ptr = ptr->next) { + if (orec_pat_cse(inf, ptr->pat)) + return (inf->ecode); + } + str = 0; + } + return (orec_str_list(inf, alt, str, count)); + } + } + else if (alt == inf->alt && alt->pat && alt->pat->rep == NULL) { + /* If the toplevel single alternative */ + switch (alt->pat->type) { + /* One of these will always be true for RE_NOSPEC, + * but can also be optimized for simple patterns */ + case Rep_Literal: + alt->pat->type = Rep_SearchLiteral; + break; + case Rep_CaseLiteral: + alt->pat->type = Rep_SearchCaseLiteral; + break; + case Rep_String: + alt->pat->type = Rep_SearchString; + break; + case Rep_CaseString: + alt->pat->type = Rep_SearchCaseString; + break; + default: + break; + } + } + + while (alt) { + orec_pat(inf, alt->pat); + alt = alt->next; + } + } + + return (inf->ecode); +} + +static int +orec_pat(orec_inf *inf, rec_pat *pat) +{ + rec_pat *next; + + while (pat) { + switch (pat->type) { + case Rep_AnyAnyTimes: + if (pat->next == NULL) { + rec_grp *grp = inf->grp; + + next = NULL; + while (grp) { + next = grp->parent->next; + /* Cannot check if is .*$ as the input + * may be a substring */ + if (next) + break; + grp = grp->pgrp; + } + if (next == NULL) { + /* <re>.* */ + pat->type = Rep_AnyEatAnyTimes; + grp = inf->grp; + while (grp) { + --grp->comp; + next = grp->parent->next; + if (next) + break; + grp = grp->pgrp; + } + } + else if (orec_pat_bad_rpt(inf, next)) + return (inf->ecode); + } + else if (orec_pat_bad_rpt(inf, pat->next)) + return (inf->ecode); + break; + case Rep_AnyMaybe: + if (pat->next == NULL) { + rec_grp *grp = inf->grp; + + next = NULL; + while (grp) { + next = grp->parent->next; + if (next) + break; + grp = grp->pgrp; + } + if (next == NULL) { + /* <re>.? */ + pat->type = Rep_AnyEatMaybe; + grp = inf->grp; + while (grp) { + --grp->comp; + next = grp->parent->next; + if (next) + break; + grp = grp->pgrp; + } + } + else if (orec_pat_bad_rpt(inf, next)) + return (inf->ecode); + } + else if (orec_pat_bad_rpt(inf, pat->next)) + return (inf->ecode); + break; + case Rep_AnyAtLeast: + if (pat->next == NULL) { + rec_grp *grp = inf->grp; + + next = NULL; + while (grp) { + next = grp->parent->next; + if (next) + break; + grp = grp->pgrp; + } + if (next == NULL) { + /* <re>.+ */ + pat->type = Rep_AnyEatAtLeast; + grp = inf->grp; + while (grp) { + --grp->comp; + next = grp->parent->next; + if (next) + break; + grp = grp->pgrp; + } + } + else if (orec_pat_bad_rpt(inf, next)) + return (inf->ecode); + } + else if (orec_pat_bad_rpt(inf, pat->next)) + return (inf->ecode); + break; + case Rep_Range: + case Rep_RangeNot: + orec_pat_rng(inf, pat); + break; + case Rep_Group: + orec_grp(inf, pat->data.grp); + break; + default: + break; + } + pat = pat->next; + } + + return (inf->ecode); +} + +static int +orec_pat_bad_rpt(orec_inf *inf, rec_pat *pat) +{ + switch (pat->type) { + /* Not really an error, but aren't supported by the library. + * Includes: .*.*, .+<re>? .*<re>*, (.*)(<re>*), etc. + */ + + /* Not a repetition, but mathes anything... */ + case Rep_Any: + + /* Zero length matches */ + case Rep_Eol: + if (!(inf->flags & RE_NEWLINE)) + break; + case Rep_Bol: + case Rep_Bow: + case Rep_Eow: + + /* Repetitions */ + case Rep_AnyAnyTimes: + case Rep_AnyMaybe: + case Rep_AnyAtLeast: + inf->ecode = RE_BADRPT; + break; + + /* Check if the first group element is a complex pattern */ + case Rep_Group: + if (pat->rep == NULL) { + if (pat->data.grp->alt) { + for (pat = pat->data.grp->alt->pat; pat; pat = pat->next) { + if (orec_pat_bad_rpt(inf, pat)) + break; + } + } + break; + } + /*FALLTHROUGH*/ + default: + if (pat->rep) + inf->ecode = RE_BADRPT; + break; + } + + if (!inf->ecode && pat && pat->next) + orec_pat_bad_forward_rpt(inf, pat->next); + + return (inf->ecode); +} + +static int +orec_pat_bad_forward_rpt(orec_inf *inf, rec_pat *pat) +{ + if (pat->rep) { + switch (pat->rep->type) { + case Rer_MinMax: + if (pat->rep->mine > 0) + break; + case Rer_AnyTimes: + case Rer_Maybe: + case Rer_Max: + inf->ecode = RE_BADRPT; + default: + break; + } + } + else if (pat->type == Rep_Group && + pat->data.grp->alt && + pat->data.grp->alt->pat) + orec_pat_bad_forward_rpt(inf, pat->data.grp->alt->pat); + + return (inf->ecode); +} + +static int +orec_grp(orec_inf *inf, rec_grp *grp) +{ + rec_grp *prev = inf->grp; + + inf->grp = grp; + orec_alt(inf, grp->alt); + /* Could also just say: inf->grp = grp->gparent */ + inf->grp = prev; + + return (inf->ecode); +} + +static int +orec_pat_rng(orec_inf *inf, rec_pat *pat) +{ + int i, j[2], count; + rec_pat_t type = pat->type; + unsigned char *range = pat->data.rng->range; + + for (i = count = j[0] = j[1] = 0; i < 256; i++) { + if (range[i]) { + if (count == 2) { + ++count; + break; + } + j[count++] = i; + } + } + + if (count == 1 || + (count == 2 && + ((islower(j[0]) && toupper(j[0]) == j[1]) || + (isupper(j[0]) && tolower(j[0]) == j[1])))) { + free(pat->data.rng); + if (count == 1) { + pat->data.chr = j[0]; + pat->type = type == Rep_Range ? Rep_Literal : Rep_LiteralNot; + } + else { + pat->data.cse.upper = j[0]; + pat->data.cse.lower = j[1]; + pat->type = type == Rep_Range ? Rep_CaseLiteral : Rep_CaseLiteralNot; + } + } + else { + if (memcmp(re__alnum, range, 256) == 0) + type = type == Rep_Range ? Rep_Alnum : Rep_AlnumNot; + else if (memcmp(re__odigit, range, 256) == 0) + type = type == Rep_Range ? Rep_Odigit : Rep_OdigitNot; + else if (memcmp(re__ddigit, range, 256) == 0) + type = type == Rep_Range ? Rep_Digit : Rep_DigitNot; + else if (memcmp(re__xdigit, range, 256) == 0) + type = type == Rep_Range ? Rep_Xdigit : Rep_XdigitNot; + else if (memcmp(re__control, range, 256) == 0) + type = type == Rep_Range ? Rep_Control : Rep_ControlNot; + + if (type != pat->type) { + free(pat->data.rng); + pat->type = type; + } + } + + return (inf->ecode); +} + +/* Join patterns if required, will only fail on memory allocation failure: + */ +static int +orec_pat_cse(orec_inf *inf, rec_pat *pat) +{ + rec_pat_t type; + int i, len, length; + rec_pat *ptr, *next; + unsigned char *str, *tofree; + + if (pat->next == NULL && pat->type == Rep_CaseString) + return (inf->ecode); + + type = Rep_CaseString; + + /* First calculate how many bytes will be required */ + for (ptr = pat, length = 1; ptr; ptr = ptr->next) { + switch (ptr->type) { + case Rep_Literal: + length += 2; + break; + case Rep_String: + length += strlen((char*)ptr->data.str) << 1; + break; + case Rep_CaseLiteral: + length += 2; + break; + case Rep_CaseString: + length += strlen((char*)ptr->data.str); + break; + default: + break; + } + } + + if ((str = malloc(length)) == NULL) + return (inf->ecode = RE_ESPACE); + + for (ptr = pat, length = 0; ptr; ptr = next) { + tofree = NULL; + next = ptr->next; + switch (ptr->type) { + case Rep_Literal: + str[length++] = ptr->data.chr; + str[length++] = ptr->data.chr; + break; + case Rep_String: + tofree = ptr->data.str; + len = strlen((char*)tofree); + for (i = 0; i < len; i++) { + str[length++] = tofree[i]; + str[length++] = tofree[i]; + } + break; + case Rep_CaseLiteral: + str[length++] = ptr->data.cse.lower; + str[length++] = ptr->data.cse.upper; + break; + case Rep_CaseString: + tofree = ptr->data.str; + len = strlen((char*)tofree); + memcpy(str + length, tofree, len); + length += len; + break; + default: + break; + } + if (tofree) + free(tofree); + if (ptr != pat) + free(ptr); + } + str[length] = '\0'; + + pat->type = type; + pat->data.str = str; + pat->next = NULL; + + return (inf->ecode); +} + +/* Return 0 if the patterns in the list cannot be merged, 1 if will + * be a simple string, 2 if a case string. + * This is useful when building an alternative list that is composed + * only of strings, but the regex is case insensitive, in wich case + * the first pass may have splited some patterns, but if it is a member + * of an alternatives list, the cost of using a string list is smaller */ +static int +orec_pat_cse_can(orec_inf *inf, rec_pat *pat) +{ + int ret; + + if (pat == NULL) + return (0); + + for (ret = 1; pat; pat = pat->next) { + if (pat->rep) + return (0); + switch (pat->type) { + case Rep_Literal: + case Rep_String: + break; + case Rep_CaseLiteral: + case Rep_CaseString: + ret = 2; + break; + default: + return (0); + } + } + + return (ret); +} + + +/* XXX If everything is a (case) byte, the pattern should be + * [abcde] instead of a|b|c|d|e (or [aAbBcCdDeE] instead of aA|bB|cC|dD|eE) + * as a string list works fine, but as a character range + * should be faster, and maybe could be converted here. But not + * very important, if performance is required, it should have already + * been done in the pattern. + */ +static int +orec_str_list(orec_inf *inf, rec_alt *alt, int str, int count) +{ + rec_stl *stl; + rec_pat *pat; + rec_alt *ptr, *next; + int i, j, tlen, len, is; + + if ((stl = calloc(1, sizeof(rec_stl))) == NULL) + return (inf->ecode = RE_ESPACE); + + if ((stl->lens = malloc(sizeof(unsigned char) * count)) == NULL) { + free(stl); + return (inf->ecode = RE_ESPACE); + } + + if ((stl->strs = malloc(sizeof(char*) * count)) == NULL) { + free(stl->lens); + free(stl); + return (inf->ecode = RE_ESPACE); + } + + if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { + free(stl->strs); + free(stl->lens); + free(stl); + return (inf->ecode = RE_ESPACE); + } + + pat->data.stl = stl; + pat->type = Rep_StringList; + stl->type = str ? Resl_StringList : Resl_CaseStringList; + for (i = tlen = 0, ptr = alt; i < count; i++) { + next = ptr->next; + switch (ptr->pat->type) { + case Rep_Literal: + is = len = 1; + break; + case Rep_CaseLiteral: + is = len = 2; + break; + default: + is = 0; + len = strlen((char*)ptr->pat->data.str); + break; + } + tlen += len; + stl->lens[i] = len; + if (!is) { + if (len > 2) + stl->strs[i] = ptr->pat->data.str; + else { + if (len == 1) + stl->strs[i] = (void*)(long)(ptr->pat->data.str[0]); + else + stl->strs[i] = (void*)(long) + (ptr->pat->data.str[0] | + ((int)ptr->pat->data.str[1] << 8)); + free(ptr->pat->data.str); + } + } + else { + if (is == 1) + stl->strs[i] = (void*)(long)ptr->pat->data.chr; + else + stl->strs[i] = (void*)(long) + (ptr->pat->data.cse.lower | + (ptr->pat->data.cse.upper << 8)); + } + free(ptr->pat); + if (i) + free(ptr); + ptr = next; + } + stl->tlen = tlen; + stl->nstrs = count; + + alt->pat = pat; + alt->next = NULL; + + { + int li, lj; + unsigned char ci, cj, *str; + + /* Don't need a stable sort, there shouldn't be duplicated strings, + * but don't check for it either. Only need to make sure that all + * strings that start with the same byte are together */ + for (i = 0; i < count; i++) { + li = stl->lens[i]; + ci = li > 2 ? stl->strs[i][0] : (long)stl->strs[i] & 0xff; + for (j = i + 1; j < count; j++) { + lj = stl->lens[j]; + cj = lj > 2 ? stl->strs[j][0] : (long)stl->strs[j] & 0xff; + if ((count >= LARGE_STL_COUNT && cj < ci) || + (cj == ci && lj > li)) { + /* If both strings start with the same byte, + * put the longer first */ + str = stl->strs[j]; + stl->strs[j] = stl->strs[i]; + stl->strs[i] = str; + stl->lens[j] = li; + stl->lens[i] = lj; + li ^= lj; lj ^= li; li ^= lj; + ci ^= cj; cj ^= ci; ci ^= cj; + } + } + } + } + + return (inf->ecode); +} Index: xc/programs/xedit/lisp/re/rep.h diff -u /dev/null xc/programs/xedit/lisp/re/rep.h:1.3 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/rep.h Sun Nov 24 21:35:32 2002 @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/re/rep.h,v 1.3 2002/11/25 02:35:32 paulo Exp $ */ + +#include "re.h" + +#ifndef _rep_h +#define _rep_h + +/* + * Local defines + */ + +#ifdef MIN +#undef MIN +#endif +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +#ifdef MAX +#undef MAX +#endif +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +/* This value can not be larger than 255, a depth value is the nesting of + * repetition operations and alternatives. The number of nested parenthesis + * does not matter, but a repetition on the pattern inside the parenthesis + * does. Note also that you cannot have more than 9 parenthesis pairs in + * an expression. + * Depth is always at least 1. So for MAX_DEPTH 8, it is only allowed + * 7 complex repetitions. A complex repetition is a dot followed by an + * repetition operator. It is called a complex repetition because dot + * matches anything but the empty string, so the engine needs to test + * all possible combinations until the end of the string is found. + * Repetitions like .* use one depth until the end of the string is found, + * for example a.*b.*c.*d has depth 4, while a*b*c*d has depth 2. + */ +#define MAX_DEPTH 8 + +/* Minimum number of strings to generate a "large" string list, that is, + * sort the strings and allocate 512 extra bytes to map the first string + * with a given initial byte. */ +#define LARGE_STL_COUNT 16 + +/* + * Local types + */ +/* Intermediate compilation types declaration */ + /* (r)egular (e)xpression (c)ompile (c)a(se) */ +typedef struct _rec_cse rec_cse; + + /* (r)egular (e)xpression (c)ompile (r)a(ng)e */ +typedef struct _rec_rng rec_rng; + + /* (r)egular (e)xpression (c)ompile (pat)tern */ +typedef struct _rec_pat rec_pat; + + /* (r)egular (e)xpression (c)ompile (rep)etition */ +typedef struct _rec_rep rec_rep; + + /* (r)egular (e)xpression (c)ompile (gr)ou(p) */ +typedef struct _rec_grp rec_grp; + + /* (r)egular (e)xpression (c)ompile (alt)ernatives */ +typedef struct _rec_alt rec_alt; + + +/* Optimization types */ + /* (r)egular (e)xpression (c)ompile (st)ring (l)ist */ +typedef struct _rec_stl rec_stl; + +/* Final compilation and execution types */ + /* (re)gular expression (inf)ormation */ +typedef struct _re_inf re_inf; + + /* (re)gular expression (eng)ine */ +typedef struct _re_eng re_eng; + + +/* Codes used by the engine */ +typedef enum { + /* Grouping */ + Re_Open, /* ( */ + Re_Close, /* ) */ + Re_Update, /* Like Re_Close, but is inside a loop */ + + /* Alternatives */ + Re_Alt, /* Start alternative list, + next offset */ + Re_AltNext, /* Next alternative, + next offset */ + Re_AltDone, /* Finish alternative list */ + + /* Repetition */ + Re_AnyTimes, /* * */ + Re_Maybe, /* ? */ + Re_AtLeast, /* +, at least one */ + + /* Repetition like */ + Re_AnyAnyTimes, /* .*<re> */ + Re_AnyMaybe, /* .?<re> */ + Re_AnyAtLeast, /* .+<re> */ + + Re_AnyEatAnyTimes, /* Expression ends with .* */ + Re_AnyEatMaybe, /* Expression ends with .? */ + Re_AnyEatAtLeast, /* Expression ends with .+ */ + + /* Repetition with arguments */ + Re_Exact, /* {e} */ + Re_Min, /* {n,} */ + Re_Max, /* {,m} */ + Re_MinMax, /* {n,m} */ + + /* Repetition helper instruction */ + Re_RepJump, /* Special code, go back to repetition */ + Re_RepLongJump, /* Jump needs two bytes */ + /* After the repetition data, all repetitions have an offset + * to the code after the repetition */ + + /* Matching */ + Re_Any, /* . */ + Re_Odigit, /* \o */ + Re_OdigitNot, /* \O */ + Re_Digit, /* \d */ + Re_DigitNot, /* \D */ + Re_Xdigit, /* \x */ + Re_XdigitNot, /* \x */ + Re_Space, /* \s */ + Re_SpaceNot, /* \S */ + Re_Tab, /* \t */ + Re_Newline, /* \n */ + Re_Lower, /* \l */ + Re_Upper, /* \u */ + Re_Alnum, /* \w */ + Re_AlnumNot, /* \W */ + Re_Control, /* \c */ + Re_ControlNot, /* \C */ + Re_Bol, /* ^ */ + Re_Eol, /* $ */ + Re_Bow, /* \< */ + Re_Eow, /* \> */ + + /* Range matching information */ + Re_Range, /* + 256 bytes */ + Re_RangeNot, /* + 256 bytes */ + + /* Matching with arguments */ + Re_Literal, /* + character */ + Re_CaseLiteral, /* + lower + upper */ + Re_LiteralNot, /* + character */ + Re_CaseLiteralNot, /* + lower + upper */ + Re_String, /* + length + string */ + Re_CaseString, /* + length + string in format lower-upper */ + + /* These are useful to start matching, or when RE_NOSPEC is used. */ + Re_SearchLiteral, + Re_SearchCaseLiteral, + Re_SearchString, + Re_SearchCaseString, + + Re_StringList, /* + total-length + lengths + strings */ + Re_CaseStringList, /* + total-length + lengths + strings */ + + Re_LargeStringList, /* + total-length + lengths + map + strings */ + Re_LargeCaseStringList, /* + total-length + lengths + map + strings */ + + /* Backreference */ + Re_Backref, /* + reference number */ + + /* The last codes */ + Re_DoneIf, /* Done if at end of input */ + Re_MaybeDone, /* Done */ + Re_Done /* If this code found, finished execution */ +} ReCode; + + +/* (r)egular (e)xpresssion (pat)rern (t)ype */ +typedef enum _rec_pat_t { + Rep_Literal = Re_Literal, + Rep_CaseLiteral = Re_CaseLiteral, + Rep_LiteralNot = Re_LiteralNot, + Rep_CaseLiteralNot = Re_CaseLiteralNot, + Rep_Range = Re_Range, + Rep_RangeNot = Re_RangeNot, + Rep_String = Re_String, + Rep_CaseString = Re_CaseString, + Rep_SearchLiteral = Re_SearchLiteral, + Rep_SearchCaseLiteral = Re_SearchCaseLiteral, + Rep_SearchString = Re_SearchString, + Rep_SearchCaseString = Re_SearchCaseString, + Rep_Any = Re_Any, + Rep_AnyAnyTimes = Re_AnyAnyTimes, + Rep_AnyEatAnyTimes = Re_AnyEatAnyTimes, + Rep_AnyMaybe = Re_AnyMaybe, + Rep_AnyEatMaybe = Re_AnyEatMaybe, + Rep_AnyAtLeast = Re_AnyAtLeast, + Rep_AnyEatAtLeast = Re_AnyEatAtLeast, + Rep_Odigit = Re_Odigit, + Rep_OdigitNot = Re_OdigitNot, + Rep_Digit = Re_Digit, + Rep_DigitNot = Re_DigitNot, + Rep_Xdigit = Re_Xdigit, + Rep_XdigitNot = Re_XdigitNot, + Rep_Space = Re_Space, + Rep_SpaceNot = Re_SpaceNot, + Rep_Tab = Re_Tab, + Rep_Newline = Re_Newline, + Rep_Lower = Re_Lower, + Rep_Upper = Re_Upper, + Rep_Alnum = Re_Alnum, + Rep_AlnumNot = Re_AlnumNot, + Rep_Control = Re_Control, + Rep_ControlNot = Re_ControlNot, + Rep_Bol = Re_Bol, + Rep_Eol = Re_Eol, + Rep_Bow = Re_Bow, + Rep_Eow = Re_Eow, + Rep_Backref = Re_Backref, + Rep_StringList = Re_StringList, + Rep_Group = Re_Open +} rec_pat_t; + + +/* (r)egular (e)xpression (rep)etition (t)ype */ +typedef enum _rec_rep_t { + Rer_AnyTimes = Re_AnyTimes, + Rer_AtLeast = Re_AtLeast, + Rer_Maybe = Re_Maybe, + Rer_Exact = Re_Exact, + Rer_Min = Re_Min, + Rer_Max = Re_Max, + Rer_MinMax = Re_MinMax +} rec_rep_t; + + +/* Decide at re compilation time what is lowercase and what is uppercase */ +struct _rec_cse { + unsigned char lower; + unsigned char upper; +}; + + +/* A rec_rng is used only during compilation, just a character map */ +struct _rec_rng { + unsigned char range[256]; +}; + + +/* A rec_pat is used only during compilation, and can be viewed as + * a regular expression element like a match to any character, a match + * to the beginning or end of the line, etc. + * It is implemented as a linked list, and does not have nesting. + * The data field can contain: + * chr: the value of a single character to match. + * cse: the upper and lower case value of a character to match. + * rng: a character map to match or not match. + * str: a simple string or a string where every two bytes + * represents the character to match, in lower/upper + * case sequence. + * The rep field is not used for strings, strings are broken in the + * last character in this case. That is, strings are just a concatenation + * of several character matches. + */ +struct _rec_pat { + rec_pat_t type; + rec_pat *next, *prev; /* Linked list information */ + union { + unsigned char chr; + rec_cse cse; + rec_rng *rng; + rec_grp *grp; + unsigned char *str; + rec_stl *stl; + } data; + rec_rep *rep; /* Pattern repetition information */ +}; + + +/* A rec_rep is used only during compilation, and can be viewed as: + * + * ? or * or + or {<e>} or {<m>,} or {,<M>} or {<m>,<M>} + * + * where <e> is "exact", <m> is "minimum" and <M> is "maximum". + * In the compiled step it can also be just a NULL pointer, that + * is actually equivalent to {1}. + */ +struct _rec_rep { + rec_rep_t type; + short mine; /* minimum or exact number of matches */ + short maxc; /* maximum number of matches */ +}; + + +/* A rec_alt is used only during compilation, and can be viewed as: + * + * <re>|<re> + * + * where <re> is any regular expression. The expressions are nested + * using the grp field of the rec_pat structure. + */ +struct _rec_alt { + rec_alt *next, *prev; /* Linked list information */ + rec_pat *pat; +}; + + +/* A rec_grp is a place holder for expressions enclosed in parenthesis + * and is linked to the compilation data by an rec_pat structure. */ +struct _rec_grp { + rec_pat *parent; /* Reference to parent pattern */ + rec_alt *alt; /* The pattern information */ + rec_alt *palt; /* Parent alternative */ + rec_grp *pgrp; /* Nested groups */ + int comp; /* (comp)lex repetition pattern inside group */ +}; + + +/* Optimization compilation types definition */ + /* (r)egular (e)xpression (c)ompile (st)ring (l)ist (t)ype */ +typedef enum { + Resl_StringList = Re_StringList, + Resl_CaseStringList = Re_CaseStringList +} rec_stl_t; + +struct _rec_stl { + rec_stl_t type; + int nstrs; /* Number of strings in list */ + int tlen; /* Total length of all strings */ + unsigned char *lens; /* Vector of string lengths */ + unsigned char **strs; /* The strings */ +}; + + +/* + * Prototypes + */ + /* rep.c */ +rec_alt *irec_comp(const char*, const char*, int, int*); +void irec_free_alt(rec_alt*); + + /* reo.c */ +int orec_comp(rec_alt*, int); +void orec_free_stl(rec_stl*); + +#endif /* _rep_h */ Index: xc/programs/xedit/lisp/re/tests.c diff -u /dev/null xc/programs/xedit/lisp/re/tests.c:1.1 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/tests.c Sat Sep 7 22:29:50 2002 @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2002 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/re/tests.c,v 1.1 2002/09/08 02:29:50 paulo Exp $ */ + +/* + * Compile with: cc -o tests tests.c -L. -lre + */ + +#include <stdio.h> +#include <string.h> +#include "re.h" + +int +main(int argc, char *argv[]) +{ + re_cod cod; + re_mat mat[10]; + int line, ecode, i, len, group, failed; + long eo, so; + char buf[8192]; + char str[8192]; + FILE *fp = fopen("tests.txt", "r"); + + if (fp == NULL) { + fprintf(stderr, "failed to open tests.txt\n"); + exit(1); + } + + ecode = line = group = failed = 0; + cod.cod = NULL; + while (fgets(buf, sizeof(buf), fp)) { + ++line; + if (buf[0] == '#' || buf[0] == '\n') + continue; + else if (buf[0] == '/') { + char *ptr = strrchr(buf, '/'); + + if (ptr == buf) { + fprintf(stderr, "syntax error at line %d\n", line); + break; + } + else { + int flags = 0; + + refree(&cod); + for (*ptr++ = '\0'; *ptr; ptr++) { + if (*ptr == 'i') + flags |= RE_ICASE; + else if (*ptr == 'n') + flags |= RE_NEWLINE; + } + ecode = recomp(&cod, buf + 1, flags); + failed = ecode; + } + } + else if (buf[0] == '>') { + if (cod.cod == NULL) { + fprintf(stderr, "no previous pattern at line %d\n", line); + break; + } + len = strlen(buf) - 1; + buf[len] = '\0'; + strcpy(str, buf + 1); + for (i = 0, --len; i < len - 1; i++) { + if (str[i] == '\\') { + memmove(str + i, str + i + 1, len); + --len; + switch (str[i]) { + case 'a': + str[i] = '\a'; + break; + case 'b': + str[i] = '\b'; + break; + case 'f': + str[i] = '\f'; + break; + case 'n': + str[i] = '\n'; + break; + case 'r': + str[i] = '\r'; + break; + case 't': + str[i] = '\t'; + break; + case 'v': + str[i] = '\v'; + break; + default: + break; + } + } + } + group = 0; + ecode = reexec(&cod, str, 10, &mat[0], 0); + if (ecode && ecode != RE_NOMATCH) { + reerror(failed, &cod, buf, sizeof(buf)); + fprintf(stderr, "%s, at line %d\n", buf, line); + break; + } + } + else if (buf[0] == ':') { + if (failed) { + len = strlen(buf) - 1; + buf[len] = '\0'; + if (failed == RE_EESCAPE && strcmp(buf, ":EESCAPE") == 0) + continue; + if (failed == RE_ESUBREG && strcmp(buf, ":ESUBREG") == 0) + continue; + if (failed == RE_EBRACK && strcmp(buf, ":EBRACK") == 0) + continue; + if (failed == RE_EPAREN && strcmp(buf, ":EPAREN") == 0) + continue; + if (failed == RE_EBRACE && strcmp(buf, ":EBRACE") == 0) + continue; + if (failed == RE_EBADBR && strcmp(buf, ":EBADBR") == 0) + continue; + if (failed == RE_ERANGE && strcmp(buf, ":ERANGE") == 0) + continue; + if (failed == RE_ESPACE && strcmp(buf, ":ESPACE") == 0) + continue; + if (failed == RE_BADRPT && strcmp(buf, ":BADRPT") == 0) + continue; + if (failed == RE_EMPTY && strcmp(buf, ":EMPTY") == 0) + continue; + reerror(failed, &cod, buf, sizeof(buf)); + fprintf(stderr, "Error value %d doesn't match: %s, at line %d\n", + failed, buf, line); + break; + } + else if (!ecode) { + fprintf(stderr, "found match when shoudn't, at line %d\n", line); + break; + } + } + else { + if (failed) { + reerror(failed, &cod, buf, sizeof(buf)); + fprintf(stderr, "%s, at line %d\n", line); + break; + } + if (sscanf(buf, "%ld,%ld:", &so, &eo) != 2) { + fprintf(stderr, "expecting match offsets at line %d\n", line); + break; + } + else if (ecode) { + fprintf(stderr, "didn't match, at line %d\n", line); + break; + } + else if (group >= 10) { + fprintf(stderr, "syntax error at line %d (too many groups)\n", + line); + break; + } + else if (so != mat[group].rm_so || eo != mat[group].rm_eo) { + fprintf(stderr, "match failed at line %d, got %ld,%ld: ", + line, mat[group].rm_so, mat[group].rm_eo); + if (mat[group].rm_so < mat[group].rm_eo) + fwrite(str + mat[group].rm_so, + mat[group].rm_eo - mat[group].rm_so, 1, stderr); + fputc('\n', stderr); + break; + } + ++group; + } + } + + fclose(fp); + + return (ecode); +} Index: xc/programs/xedit/lisp/re/tests.txt diff -u /dev/null xc/programs/xedit/lisp/re/tests.txt:1.3 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/re/tests.txt Fri Nov 8 03:01:00 2002 @@ -0,0 +1,461 @@ +# +# Copyright (c) 2002 by The XFree86 Project, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the XFree86 Project shall +# not be used in advertising or otherwise to promote the sale, use or other +# dealings in this Software without prior written authorization from the +# XFree86 Project. +# +# Author: Paulo César Pereira de Andrade +# +# +# $XFree86: xc/programs/xedit/lisp/re/tests.txt,v 1.3 2002/11/08 08:01:00 paulo Exp $ + +# Some tests for the library: +# lines starting with # are comments +# lines starting with / are a regular expression pattern +# The pattern must end with / and may be followed by: +# i -> ignore case +# n -> create newline sensitive regex +# lines starting with > are a string input to the last pattern +# To test newline sensitive matching, add \n to the string. +# lines starting with a number are the expected result +# If more than one line, every subsequent line is the +# value of an "subresult". +# :NOMATCH means that the string input should not match + +# Simple string +/abc/ +>abc +0,3: abc +>aaaaaaaaaaaaaaabc +14,17: abc +>xxxxxxxxxxxxxxaaaaaaaaaaaaaaaaabcxx +30,33: abc + +# String list +/abc|bcd|cde/ +>abc +0,3: abc +>aabc +1,4: abc +>xxxbcdef +3,6: bcd +>abdzzzcdabcde +8,11: abc +>xxxxabdecdabdcde +13,16: cde + +# Complex string +/a?bc|ab?c|abc?/ +>abc +0,3: abc +>xxxb +:NOMATCH +>xxxbc +3,5: bc +>sssssab +5,7: ab + +# Another complex string +/a*bc|ab*c|abc*/ +>aaaaaaabc +0,9: aaaaaaabc +>xaaaaaaabc +1,10: aaaaaaabc +>xyzaaaaaaabc +3,12: aaaaaaabc +>abbc +0,4: abbc +>xxabbbbbc +2,9: abbbbbc +>abcccccccccc +0,12: abcccccccccc +>abccccccccccd +0,12: abcccccccccc +>xxxxxxxaaaaaaaaaabbbbbbbbbbbccccccccccc +16,29: abbbbbbbbbbbc +>xxxbbbbbbbbbc +11,13: bc + +# Another complex string +/a+bc|ab+c|abc+/ +>xxxbc +:NOMATCH +>xaaabc +1,6: aaabc +>zzzzaaaaabbc +8,12: abbc +>zzzzaaaabbbbbbcccc +7,15: abbbbbbc + +# Simple pattern +/a.c/ +>abc +0,3: abc +>aaac +1,4: aac +>xac +:NOMATCH +>xaac +1,4: aac +>xxabc +2,5: abc +>xxxaxc +3,6: axc + +# Another simple pattern +/a*c/ +>c +0,1: c +>xxxxxxxxc +8,9: c +>xxxxxxxcc +7,8: c +>ac +0,2: ac +>aaaac +0,5: aaaac +>xac +1,3: ac +>xxxaac +3,6: aac +>xxac +2,4: ac +>xxxxac +4,6: ac + +# Another simple pattern +/a+c/ +>xxaac +2,5: aac +>xxxaaaac +3,8: aaaac +>xaaaabac +6,8: ac +>xxxc +:NOMATCH +>xxxxaaaaccc +4,9: aaaac + +# Another simple pattern +/a{4}b/ +>xabxxaabxxxaaabxxxxaaaab +19,24: aaaab +>aaabaaaab +4,9: aaaab + +# Another simple pattern +/a{4,}b/ +>xxxaaaab +3,8: aaaab +>zaaabzzzaaaaaaaaaaaaaaaab +8,25: aaaaaaaaaaaaaaaab + +# Another simple pattern +/a{,4}b/ +>b +0,1: b +>xxxxxxxxb +8,9: b +>xaaaaaaaaab +6,11: aaaab +>xxxab +3,5: ab +>aaaaaxaaab +6,10: aaab + +# Another simple pattern +/a{2,4}b/ +>xab +:NOMATCH +>xaab +1,4: aab +>xaaab +1,5: aaab +>xxaaaab +2,7: aaaab +>xxxaaaaab +4,9: aaaab + +# Some simple grouping tests +/foo(bar|baz)fee/ +>feebarbazfoobarfee +9,18: foobarfee +12,15: bar +>foofooobazfeefoobazfee +13,22: foobazfee +/f(oo|ee)ba[rz]/ +>barfoebaz +:NOMATCH +>bazfoobar +3,9: foobar +4,6: oo +>barfeebaz +3,9: feebaz +4,6: ee +/\<(int|char)\>/ +>aint character int foo +15,18: int +15,18: int + +# Some complex repetitions +/foo.*bar/ +>barfoblaboofoobarfoobarfoobar +11,17: foobar +/foo.+bar/ +>foobar +:NOMATCH +>fobbarfooxbarfooybar +6,13: fooxbar +/foo.?bar/ +>xfoobar +1,7: foobar +>xxfooxxbar +:NOMATCH +>yyyfootbar +3,10: footbar + +# Some nested complex repetitions +/a.*b.*c/ +>abc +0,3: abc +>xxxxxxxxxabbbbbbbccaaaaabbbc +9,18: abbbbbbbc +/a.+b.*c/ +>xxxabc +:NOMATCH +>xxaxbbc +2,7: axbbc +/a.+b.?c/ +>xaabc +1,5: aabc +>xxaabbc +2,7: aabbc + +# Very complex repetitions +/(foo.*|bar)fee/ +# XXX NOTE +# This pattern does not return the correct offset for the group. +# Support for this may and may not be added. + +>barfoofee +3,9: foofee +>foobarfee +0,9: foobarfee +>xxfobarfee +4,10: barfee +>barfooooooobarfee +3,17: fooooooobarfee +>xxfobarfeefoobar +4,10: barfee +/(foo.+|bar)fee/ +>barfoofee +:NOMATCH +>barfooxfee +3,10: fooxfee +/(foo.?|bar)fee/ +>foobar +:NOMATCH +>bafoofee +2,8:foofee +>bafooofeebarfee +2,9: fooofee +>bafoofeebarfee +2,8: foofee + +# Simple backreference +/(a|b|c)\1/ +>aa +0,2: aa +0,1: a +/(a|b|c)(a|b|c)\1\2/ +>acac +0,4: acac +0,1: a +1,2: c +>xxxxacac +4,8: acac +4,5: a +5,6: c +>xxacabacbcacbbacbcaaccabcaca +24,28: caca +24,25: c +25,26: a +>xyabcccc +4,8: cccc +4,5: c +5,6: c + +# Complex backreference +/(a*b)\1/ +>xxxaaaaabaaaaab +3,15: aaaaabaaaaab +3,9: aaaaab +/(ab+c)\1/ +>xaaabbbcabbbc +3,13: abbbcabbbc +3,8: abbbc +/(ab?c)\1/ +>abcac +:NOMATCH +>abcacabcabc +5,11: abcabc +5,8: abc +>abcacac +3,7: acac +3,5: acac + +# Very complex backreference +/a(.*)b\1/ +>xxxab +3,5: ab +4,4: +>xxxxazzzbzzz +4,12: azzzbzzz +5,8: zzz + +# Case testing +/abc/i +>AbC +0,3: AbC +/[0-9][a-z]+/i +>xxx0aaZxYT9 +3,10: 0aaZxYT +/a.b/i +>aaaaaaaaaaaxB +10,13: axB +/a.*z/i +>xxxAaaaaZ +3,9: AaaaaZ +>xxaaaZaaa +2,6: aaaZ +/\<(lambda|defun|defmacro)\>/i +> (lambda +5,11: lambda +5,11: lambda +/\<(nil|t)\>/i +>it Nil +3,6: Nil +3,6: Nil +/\<(begin|end)\>/i +>beginning the ending EnD +21,24: EnD +21,24: EnD + +# Some newline tests +/a.*/n +>a\naaa +0,1:a +>xyza\naa +3,4: a +/a.+/n +>a\naaa +2,5: aaa +>xyza\naa +5,7: aa +/a.?/n +>a\naaa +0,1: a +>xyza\naa +3,4: a + +# Newline tests envolving complex patterns +/a.*b.*c/n +>xxaa\nzyacb\nabc +11,14: abc +>xxxab\nabc\nc +6,9: abc +/a.+b.*c/n +>ab\nbc\nabbc +6,10: abbc +/a.?b.*c/n +>ab\ncabbc\ncc +4,8: abbc +/^foo$/n +>bar\nfoobar\nfoo +11,14: foo + +# Not so complex test involving a newline... +/^\s*#\s*(define|include)\s+.+/n +>#define\n#include x +8,18: #include x +9,16: include + +# Check if large strings are working +/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ +>zzzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzzz +3,259: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~/ +>String here: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~/ +13,333: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ + + +# Some complex repetitions not supported +# Listed here only to make sure the library is not crashing on these +# Repetitions that match an empty match, or an empty string cannot follow +# a complex repetition. A complex repetition is: +# .* or .+ or .? +# .{...} is not supported. +/(.*)(\d*)/ +:BADRPT +/(.*).(\d*)/ +:BADRPT +/(.*)\<(\d*)/ +:BADRPT +/(.*)\s(\d*)/ +:BADRPT +/(.*)\D(\d*)/ +:BADRPT + +# This is a more clear pattern and partially works +/(.*)\D(\d+)/ +>abcW12 +0,6: abcW12 +0,3: abc +4,6: 12 +>abcW12abcW12 +0,6: abcW12 +0,3: abc +4,6: 12 +# This wasn't working in the previous version, but now with only minimal +# matches supported, it works. +>abcW12abcW12a +0,6: abcW12 +0,3: abc +4,6: 12 + +# Note the minimal match +/.*\d/ +>a1a1a1aaaaaaa +0,2: a1 +# Check match offsets +/(.*)\d/ +>a1a1a1aaaaaaa +0,2: a1 +0,1: a +/.*(\d)/ +>a1a1a1aaaaaaa +0,2: a1 +1,2: 1 + +/.*(\d+)/ +:BADRPT Index: xc/programs/xedit/lisp/test/hello.lsp diff -u xc/programs/xedit/lisp/test/hello.lsp:1.2 xc/programs/xedit/lisp/test/hello.lsp:1.3 --- xc/programs/xedit/lisp/test/hello.lsp:1.2 Sat Sep 29 00:46:06 2001 +++ xc/programs/xedit/lisp/test/hello.lsp Fri Nov 8 03:01:01 2002 @@ -27,7 +27,7 @@ ;; Author: Paulo César Pereira de Andrade ;; ;; -;; $XFree86: xc/programs/xedit/lisp/test/hello.lsp,v 1.2 2001/09/29 04:46:06 paulo Exp $ +;; $XFree86: xc/programs/xedit/lisp/test/hello.lsp,v 1.3 2002/11/08 08:01:01 paulo Exp $ ;; (require "xaw") (require "xt") Index: xc/programs/xedit/lisp/test/list.lsp diff -u /dev/null xc/programs/xedit/lisp/test/list.lsp:1.6 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/test/list.lsp Thu Dec 5 22:25:29 2002 @@ -0,0 +1,1895 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/test/list.lsp,v 1.6 2002/12/06 03:25:29 paulo Exp $ +;; + +;; basic lisp function tests + +;; Most of the tests are just the examples from the +;; +;; Common Lisp HyperSpec (TM) +;; Copyright 1996-2001, Xanalys Inc. All rights reserved. +;; +;; Some tests are hand crafted, to test how the interpreter treats +;; uncommon arguments or special conditions + + +#| + MAJOR PROBLEMS: + + o NIL and T should be always treated as symbols, actually it is + legal to say (defun nil (...) ...) + o There aren't true uninterned symbols, there are only symbols that + did not yet establish the home package, but once one is created, an + interned symbol is always returned. +|# + +(defun compare-test (test expect function arguments + &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + ) + (if error + (format t "ERROR: (~S~{ ~S~}) => ~S~%" function arguments error-value) + (or (funcall test result expect) + (format t "(~S~{ ~S~}) => should be ~S not ~S~%" + function arguments expect result + ) + ) + ) +) + +(defun compare-eval (test expect form + &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (eval form)) + (setq error nil) + ) + ) + (if error + (format t "ERROR: ~S => ~S~%" form error-value) + (or (funcall test result expect) + (format t "~S => should be ~S not ~S~%" + form expect result + ) + ) + ) +) + +(defun error-test (function &rest arguments &aux result (error t)) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + (or error + (format t "ERROR: no error for (~S~{ ~S~}), result was ~S~%" + function arguments result) + ) +) + +(defun error-eval (form &aux result (error t)) + (ignore-errors + (setq result (eval form)) + (setq error nil) + ) + (or error + (format t "ERROR: no error for ~S, result was ~S~%" form result) + ) +) + +(defun eq-test (expect function &rest arguments) + (compare-test #'eq expect function arguments)) + +(defun eql-test (expect function &rest arguments) + (compare-test #'eql expect function arguments)) + +(defun equal-test (expect function &rest arguments) + (compare-test #'equal expect function arguments)) + +(defun equalp-test (expect function &rest arguments) + (compare-test #'equalp expect function arguments)) + + +(defun eq-eval (expect form) + (compare-eval #'eq expect form)) + +(defun eql-eval (expect form) + (compare-eval #'eql expect form)) + +(defun equal-eval (expect form) + (compare-eval #'equal expect form)) + +(defun equalp-eval (expect form) + (compare-eval #'equalp expect form)) + +;; clisp treats strings loaded from a file as constants +(defun xseq (sequence) + #+clisp (if *load-pathname* (copy-seq sequence) sequence) + #-clisp sequence +) + +;; apply - function +(equal-test '((+ 2 3) . 4) #'apply 'cons '((+ 2 3) 4)) +(eql-test -1 #'apply #'- '(1 2)) +(eql-test 7 #'apply #'max 3 5 '(2 7 3)) +(error-test #'apply #'+ 1) +(error-test #'apply #'+ 1 2) +(error-test #'apply #'+ 1 . 2) +(error-test #'apply #'+ 1 2 3) +(error-test #'apply #'+ 1 2 . 3) +(eql-test 6 #'apply #'+ 1 2 3 ()) + +;; eq - function +(eq-eval t '(let* ((a #\a) (b a)) (eq a b))) +(eq-test t #'eq 'a 'a) +(eq-test nil #'eq 'a 'b) +(eq-eval t '(eq #1=1 #1#)) +(eq-test nil #'eq "abc" "abc") +(setq a '('x #c(1 2) #\z)) +(eq-test nil #'eq a (copy-seq a)) + +;; eql - function +(eq-test t #'eql 1 1) +(eq-test t #'eql 1.3d0 1.3d0) +(eq-test nil #'eql 1 1d0) +(eq-test t #'eql #c(1 -5) #c(1 -5)) +(eq-test t #'eql 'a 'a) +(eq-test nil #'eql :a 'a) +(eq-test t #'eql #c(5d0 0) 5d0) +(eq-test nil #'eql #c(5d0 0d0) 5d0) +(eq-test nil #'eql "abc" "abc") +(equal-eval '(1 5/6 #p"test" #\#) '(setq a '(1 5/6 #p"test" #\#))) +(eq-test nil #'eql a (copy-seq a)) + +(setf + hash0 (make-hash-table) + hash1 (make-hash-table) + (gethash 1 hash0) 2 + (gethash 1 hash1) 2 + (gethash :foo hash0) :bar + (gethash :foo hash1) :bar +) +(defstruct test a b c) +(setq + struc0 (make-test :a 1 :b 2 :c #\c) + struc1 (make-test :a 1 :b 2 :c #\c) +) + +;; equal - function +(eq-test t #'equal "abc" "abc") +(eq-test t #'equal 1 1) +(eq-test t #'equal #c(1 2) #c(1 2)) +(eq-test nil #'equal #c(1 2) #c(1 2d0)) +(eq-test t #'equal #\A #\A) +(eq-test nil #'equal #\A #\a) +(eq-test nil #'equal "abc" "Abc") +(equal-eval '(1 2 3/5 #\a) '(setq a '(1 2 3/5 #\a))) +(eq-test t #'equal a (copy-seq a)) +(eq-test nil #'equal hash0 hash1) +(eq-test nil #'equal struc0 struc1) +(eq-test nil #'equal #(1 2 3 4) #(1 2 3 4)) + +;; equalp - function +(eq-test t #'equalp hash0 hash1) +(setf + (gethash 2 hash0) "FoObAr" + (gethash 2 hash1) "fOoBaR" +) +(eq-test t #'equalp hash0 hash1) +(setf + (gethash 3 hash0) 3 + (gethash 3d0 hash1) 3 +) +(eq-test nil #'equalp hash0 hash1) +(eq-test t #'equalp struc0 struc1) +(setf + (test-a struc0) #\a + (test-a struc1) #\A +) +(eq-test t #'equalp struc0 struc1) +(setf + (test-b struc0) 'test + (test-b struc1) :test +) +(eq-test nil #'equalp struc0 struc1) +(eq-test t #'equalp #c(1/2 1d0) #c(0.5d0 1)) +(eq-test t #'equalp 1 1d0) +(eq-test t #'equalp #(1 2 3 4) #(1 2 3 4)) +(eq-test t #'equalp #(1 #\a 3 4d0) #(1 #\A 3 4)) + +;; acons - function +(equal-test '((1 . "one")) #'acons 1 "one" nil) +(equal-test '((2 . "two") (1 . "one")) #'acons 2 "two" '((1 . "one"))) + +;; adjoin - function +(equal-test '(nil) #'adjoin nil nil) +(equal-test '(a) #'adjoin 'a nil) +(equal-test '(1 2 3) #'adjoin 1 '(1 2 3)) +(equal-test '(1 2 3) #'adjoin 2 '(1 2 3)) +(equal-test '((1) (1) (2) (3)) #'adjoin '(1) '((1) (2) (3))) +(equal-test '((1) (2) (3)) #'adjoin '(1) '((1) (2) (3)) :key #'car) +(error-test #'adjoin nil 1) + +;; alpha-char-p - function +(eq-test t #'alpha-char-p #\a) +(eq-test nil #'alpha-char-p #\5) +(error-test #'alpha-char-p 'a) + +;; alphanumericp - function +(eq-test t #'alphanumericp #\Z) +(eq-test t #'alphanumericp #\8) +(eq-test nil #'alphanumericp #\#) + +;; and - macro +(eql-eval 1 '(setq temp1 1 temp2 1 temp3 1)) +(eql-eval 2 '(and (incf temp1) (incf temp2) (incf temp3))) +(eq-eval t '(and (eql 2 temp1) (eql 2 temp2) (eql 2 temp3))) +(eql-eval 1 '(decf temp3)) +(eq-eval nil '(and (decf temp1) (decf temp2) (eq temp3 'nil) (decf temp3))) +(eq-eval t '(and (eql temp1 temp2) (eql temp2 temp3))) +(eq-eval t '(and)) +(equal-eval '(1 2 3) '(multiple-value-list (and (values 'a) (values 1 2 3)))) +(equal-eval nil '(and (values) t)) + +;; append - function +(equal-test '(a b c d e f g) #'append '(a b c) '(d e f) '() '(g)) +(equal-test '(a b c . d) #'append '(a b c) 'd) +(eq-test nil #'append) +(eql-test 'a #'append nil 'a) +(error-test #'append 1 2) + +;; assoc - function +(equal-test '(1 . "one") #'assoc 1 '((2 . "two") (1 . "one"))) +(equal-test '(2 . "two") #'assoc 2 '((1 . "one") (2 . "two"))) +(eq-test nil #'assoc 1 nil) +(equal-test '(2 . "two") #'assoc-if #'evenp '((1 . "one") (2 . "two"))) +(equal-test '(3 . "three") #'assoc-if-not #'(lambda(x) (< x 3)) + '((1 . "one") (2 . "two") (3 . "three"))) +(equal-test '("two" . 2) #'assoc #\o '(("one" . 1) ("two" . 2) ("three" . 3)) + :key #'(lambda (x) (char x 2))) +(equal-test '(a . b) #'assoc 'a '((x . a) (y . b) (a . b) (a . c))) + +;; atom - function +(eq-test t #'atom 1) +(eq-test t #'atom '()) +(eq-test nil #'atom '(1)) +(eq-test t #'atom 'a) + +;; block - special operator +(eq-eval nil '(block empty)) +(eql-eval 2 '(let ((x 1)) + (block stop (setq x 2) (return-from stop) (setq x 3)) x)) +(eql-eval 2 '(block twin (block twin (return-from twin 1)) 2)) + +;; both-case-p - function +(eq-test t #'both-case-p #\a) +(eq-test nil #'both-case-p #\1) + +;; boundp - function +(eql-eval 1 '(setq x 1)) +(eq-test t #'boundp 'x) +(makunbound 'x) +(eq-test nil #'boundp 'x) +(eq-eval nil '(let ((x 1)) (boundp 'x))) +(error-test #'boundp 1) + +;; butlast, nbutlast - function +(setq x '(1 2 3 4 5 6 7 8 9)) +(equal-test '(1 2 3 4 5 6 7 8) #'butlast x) +(equal-eval '(1 2 3 4 5 6 7 8 9) 'x) +(eq-eval nil '(nbutlast x 9)) +(equal-test '(1) #'nbutlast x 8) +(equal-eval '(1) 'x) +(eq-test nil #'butlast nil) +(eq-test nil #'nbutlast '()) +(error-test #'butlast 1 2) +(error-test #'butlast -1 '(1 2)) + +;; car, cdr, caar ... - function +(eql-test 1 #'car '(1 2)) +(eql-test 2 #'cdr '(1 . 2)) +(eql-test 1 #'caar '((1 2))) +(eql-test 2 #'cadr '(1 2)) +(eql-test 2 #'cdar '((1 . 2))) +(eql-test 3 #'cddr '(1 2 . 3)) +(eql-test 1 #'caaar '(((1 2)))) +(eql-test 2 #'caadr '(1 (2 3))) +(eql-test 2 #'cadar '((1 2) 2 3)) +(eql-test 3 #'caddr '(1 2 3 4)) +(eql-test 2 #'cdaar '(((1 . 2)) 3)) +(eql-test 3 #'cdadr '(1 (2 . 3) 4)) +(eql-test 3 #'cddar '((1 2 . 3) 3)) +(eql-test 4 #'cdddr '(1 2 3 . 4)) +(eql-test 1 #'caaaar '((((1 2))))) +(eql-test 2 #'caaadr '(1 ((2)))) +(eql-test 2 #'caadar '((1 (2)) 3)) +(eql-test 3 #'caaddr '(1 2 (3 4))) +(eql-test 2 #'cadaar '(((1 2)) 3)) +(eql-test 3 #'cadadr '(1 (2 3) 4)) +(eql-test 3 #'caddar '((1 2 3) 4)) +(eql-test 4 #'cadddr '(1 2 3 4 5)) +(eql-test 2 #'cdaaar '((((1 . 2))) 3)) +(eql-test 3 #'cdaadr '(1 ((2 . 3)) 4)) +(eql-test 3 #'cdadar '((1 (2 . 3)) 4)) +(eql-test 4 #'cdaddr '(1 2 (3 . 4) 5)) +(eql-test 3 #'cddaar '(((1 2 . 3)) 4)) +(eql-test 4 #'cddadr '(1 (2 3 . 4) 5)) +(eql-test 4 #'cdddar '((1 2 3 . 4) 5)) +(eql-test 5 #'cddddr '(1 2 3 4 . 5)) + +;; first ... tenth, rest - function +(eql-test 2 #'rest '(1 . 2)) +(eql-test 1 #'first '(1 2)) +(eql-test 2 #'second '(1 2 3)) +(eql-test 2 #'second '(1 2 3)) +(eql-test 3 #'third '(1 2 3 4)) +(eql-test 4 #'fourth '(1 2 3 4 5)) +(eql-test 5 #'fifth '(1 2 3 4 5 6)) +(eql-test 6 #'sixth '(1 2 3 4 5 6 7)) +(eql-test 7 #'seventh '(1 2 3 4 5 6 7 8)) +(eql-test 8 #'eighth '(1 2 3 4 5 6 7 8 9)) +(eql-test 9 #'ninth '(1 2 3 4 5 6 7 8 9 10)) +(eql-test 10 #'tenth '(1 2 3 4 5 6 7 8 9 10 11)) +(error-test #'car 1) +(error-test #'car #c(1 2)) +(error-test #'car #(1 2)) + +;; case - macro +(eql-eval t '(let ((a 1)) (case a ((4 5 6) nil) ((3 2 1) t) (otherwise :error)))) +(eql-eval t '(let ((a 1)) (case a ((3 2) nil) (1 t) (t :error)))) +(error-eval '(let ((a 1)) (case a (2 :error) (t nil) (otherwise t)))) +(error-eval '(let ((a 1)) (case a (2 :error) (otherwise t) (t nil)))) + +;; catch - special operator +(eql-eval 3 '(catch 'dummy-tag 1 2 (throw 'dummy-tag 3) 4)) +(eql-eval 4 '(catch 'dummy-tag 1 2 3 4)) +(eq-eval 'throw-back '(defun throw-back (tag) (throw tag t))) +(eq-eval t '(catch 'dummy-tag (throw-back 'dummy-tag) 2)) + +;; char - function +(eql-test #\a #'char "abc" 0) +(eql-test #\b #'char "abc" 1) +(error-test #'char "abc" 3) + +;; char-* - function +(eq-test nil #'alpha-char-p #\3) +(eq-test t #'alpha-char-p #\y) +(eql-test #\a #'char-downcase #\a) +(eql-test #\a #'char-downcase #\a) +(eql-test #\1 #'char-downcase #\1) +(error-test #'char-downcase 1) +(eql-test #\A #'char-upcase #\a) +(eql-test #\A #'char-upcase #\A) +(eql-test #\1 #'char-upcase #\1) +(error-test #'char-upcase 1) +(eq-test t #'lower-case-p #\a) +(eq-test nil #'lower-case-p #\A) +(eq-test t #'upper-case-p #\W) +(eq-test nil #'upper-case-p #\w) +(eq-test t #'both-case-p #\x) +(eq-test nil #'both-case-p #\%) +(eq-test t #'char= #\d #\d) +(eq-test t #'char-equal #\d #\d) +(eq-test nil #'char= #\A #\a) +(eq-test t #'char-equal #\A #\a) +(eq-test nil #'char= #\d #\x) +(eq-test nil #'char-equal #\d #\x) +(eq-test nil #'char= #\d #\D) +(eq-test t #'char-equal #\d #\D) +(eq-test nil #'char/= #\d #\d) +(eq-test nil #'char-not-equal #\d #\d) +(eq-test nil #'char/= #\d #\d) +(eq-test nil #'char-not-equal #\d #\d) +(eq-test t #'char/= #\d #\x) +(eq-test t #'char-not-equal #\d #\x) +(eq-test t #'char/= #\d #\D) +(eq-test nil #'char-not-equal #\d #\D) +(eq-test t #'char= #\d #\d #\d #\d) +(eq-test t #'char-equal #\d #\d #\d #\d) +(eq-test nil #'char= #\d #\D #\d #\d) +(eq-test t #'char-equal #\d #\D #\d #\d) +(eq-test nil #'char/= #\d #\d #\d #\d) +(eq-test nil #'char-not-equal #\d #\d #\d #\d) +(eq-test nil #'char/= #\d #\d #\D #\d) +(eq-test nil #'char-not-equal #\d #\d #\D #\d) +(eq-test nil #'char= #\d #\d #\x #\d) +(eq-test nil #'char-equal #\d #\d #\x #\d) +(eq-test nil #'char/= #\d #\d #\x #\d) +(eq-test nil #'char-not-equal #\d #\d #\x #\d) +(eq-test nil #'char= #\d #\y #\x #\c) +(eq-test nil #'char-equal #\d #\y #\x #\c) +(eq-test t #'char/= #\d #\y #\x #\c) +(eq-test t #'char-not-equal #\d #\y #\x #\c) +(eq-test nil #'char= #\d #\c #\d) +(eq-test nil #'char-equal #\d #\c #\d) +(eq-test nil #'char/= #\d #\c #\d) +(eq-test nil #'char-not-equal #\d #\c #\d) +(eq-test t #'char< #\d #\x) +(eq-test t #'char-lessp #\d #\x) +(eq-test t #'char-lessp #\d #\X) +(eq-test t #'char-lessp #\D #\x) +(eq-test t #'char-lessp #\D #\X) +(eq-test t #'char<= #\d #\x) +(eq-test t #'char-not-greaterp #\d #\x) +(eq-test t #'char-not-greaterp #\d #\X) +(eq-test t #'char-not-greaterp #\D #\x) +(eq-test t #'char-not-greaterp #\D #\X) +(eq-test nil #'char< #\d #\d) +(eq-test nil #'char-lessp #\d #\d) +(eq-test nil #'char-lessp #\d #\D) +(eq-test nil #'char-lessp #\D #\d) +(eq-test nil #'char-lessp #\D #\D) +(eq-test t #'char<= #\d #\d) +(eq-test t #'char-not-greaterp #\d #\d) +(eq-test t #'char-not-greaterp #\d #\D) +(eq-test t #'char-not-greaterp #\D #\d) +(eq-test t #'char-not-greaterp #\D #\D) +(eq-test t #'char< #\a #\e #\y #\z) +(eq-test t #'char-lessp #\a #\e #\y #\z) +(eq-test t #'char-lessp #\a #\e #\y #\Z) +(eq-test t #'char-lessp #\a #\E #\y #\z) +(eq-test t #'char-lessp #\A #\e #\y #\Z) +(eq-test t #'char<= #\a #\e #\y #\z) +(eq-test t #'char-not-greaterp #\a #\e #\y #\z) +(eq-test t #'char-not-greaterp #\a #\e #\y #\Z) +(eq-test t #'char-not-greaterp #\A #\e #\y #\z) +(eq-test nil #'char< #\a #\e #\e #\y) +(eq-test nil #'char-lessp #\a #\e #\e #\y) +(eq-test nil #'char-lessp #\a #\e #\E #\y) +(eq-test nil #'char-lessp #\A #\e #\E #\y) +(eq-test t #'char<= #\a #\e #\e #\y) +(eq-test t #'char-not-greaterp #\a #\e #\e #\y) +(eq-test t #'char-not-greaterp #\a #\E #\e #\y) +(eq-test t #'char> #\e #\d) +(eq-test t #'char-greaterp #\e #\d) +(eq-test t #'char-greaterp #\e #\D) +(eq-test t #'char-greaterp #\E #\d) +(eq-test t #'char-greaterp #\E #\D) +(eq-test t #'char>= #\e #\d) +(eq-test t #'char-not-lessp #\e #\d) +(eq-test t #'char-not-lessp #\e #\D) +(eq-test t #'char-not-lessp #\E #\d) +(eq-test t #'char-not-lessp #\E #\D) +(eq-test t #'char> #\d #\c #\b #\a) +(eq-test t #'char-greaterp #\d #\c #\b #\a) +(eq-test t #'char-greaterp #\d #\c #\b #\A) +(eq-test t #'char-greaterp #\d #\c #\B #\a) +(eq-test t #'char-greaterp #\d #\C #\b #\a) +(eq-test t #'char-greaterp #\D #\C #\b #\a) +(eq-test t #'char>= #\d #\c #\b #\a) +(eq-test t #'char-not-lessp #\d #\c #\b #\a) +(eq-test t #'char-not-lessp #\d #\c #\b #\A) +(eq-test t #'char-not-lessp #\D #\c #\b #\a) +(eq-test t #'char-not-lessp #\d #\C #\B #\a) +(eq-test nil #'char> #\d #\d #\c #\a) +(eq-test nil #'char-greaterp #\d #\d #\c #\a) +(eq-test nil #'char-greaterp #\d #\d #\c #\A) +(eq-test nil #'char-greaterp #\d #\D #\c #\a) +(eq-test nil #'char-greaterp #\d #\D #\C #\a) +(eq-test t #'char>= #\d #\d #\c #\a) +(eq-test t #'char-not-lessp #\d #\d #\c #\a) +(eq-test t #'char-not-lessp #\d #\D #\c #\a) +(eq-test t #'char-not-lessp #\D #\d #\c #\a) +(eq-test t #'char-not-lessp #\D #\D #\c #\A) +(eq-test nil #'char> #\e #\d #\b #\c #\a) +(eq-test nil #'char-greaterp #\e #\d #\b #\c #\a) +(eq-test nil #'char-greaterp #\E #\d #\b #\c #\a) +(eq-test nil #'char-greaterp #\e #\D #\b #\c #\a) +(eq-test nil #'char-greaterp #\E #\d #\B #\c #\A) +(eq-test nil #'char>= #\e #\d #\b #\c #\a) +(eq-test nil #'char-not-lessp #\e #\d #\b #\c #\a) +(eq-test nil #'char-not-lessp #\e #\d #\b #\c #\A) +(eq-test nil #'char-not-lessp #\E #\d #\B #\c #\a) + +;; char-code - function +;; XXX assumes ASCII +(eql-test 49 #'char-code #\1) +(eql-test 90 #'char-code #\Z) +(eql-test 127 #'char-code #\Delete) +(eql-test 27 #'char-code #\Escape) +(eql-test 13 #'char-code #\Return) +(eql-test 0 #'char-code #\Null) +(eql-test 10 #'char-code #\Newline) +(error-test #'char-code 65) + +;; character - function +(eql-test #\a #'character #\a) +(eql-test #\a #'character "a") +(eql-test #\A #'character 'a) + +;; XXX assumes ASCII, and should be allowed to fail? +(eql-test #\A #'character 65) + +(error-test #'character 1/2) +(error-test #'character "abc") +(error-test #'character :test) +(eq-test #\T #'character t) +(error-test #'character nil) + +;; characterp - function +(eq-test t #'characterp #\a) +(eq-test nil #'characterp 1) +(eq-test nil #'characterp 1/2) +(eq-test nil #'characterp 'a) +(eq-test nil #'characterp '`a) + + + + +;; TODO coerce + + + + +;; cond - macro +(eql-eval 2 '(let ((a 1)) (cond ((= a 2) 1) ((= a 1) 2) ((= a 0) 1) (t nil)))) +(eql-eval nil '(let ((a 1)) (cond ((= a 2) 1) (t nil) ((= a 1) 2) ((= a 0) 1)))) + +;; consp - function (predicate) +(eq-test t #'consp '(1 2)) +(eq-test t #'consp '(1 . 2)) +(eq-test nil #'consp nil) +(eq-test nil #'consp 1) + +;; constantp - function (predicate) +(eq-test t #'constantp 1) +(eq-test t #'constantp #\x) +(eq-test t #'constantp :test) +(eq-test nil #'constantp 'test) +(eq-test t #'constantp ''1) +(eq-test t #'constantp '(quote 1)) +(eq-test t #'constantp "string") +(eq-test t #'constantp #c(1 2)) +(eq-test t #'constantp #(1 2)) +(eq-test nil #'constantp #p"test") +(eq-test nil #'constantp '(1 2)) +(eq-test nil #'constantp (make-hash-table)) +(eq-test nil #'constantp *package*) +(eq-test nil #'constantp *standard-input*) + +;; copy-list, copy-alist and copy-tree - function +(equal-test '(1 2) #'copy-list '(1 2)) +(equal-test '(1 . 2) #'copy-list '(1 . 2)) +(eq-test nil #'copy-list nil) +(error-test #'copy-list 1) +(equal-eval '(1 (2 3)) '(setq x '(1 (2 3)))) +(equal-eval x '(setq y (copy-list x))) +(equal-test '("one" (2 3)) #'rplaca x "one") +(eql-test 1 #'car y) +(equal-test '("two" 3) #'rplaca (cadr x) "two") +(eq-test (caadr x) #'caadr y) +(equal-eval '(1 (2 3) 4) '(setq a '(1 (2 3) 4) b (copy-list a))) +(eq-eval t '(eq (cadr a) (cadr b))) +(eq-eval t '(eq (car a) (car b))) +(setq a '(1 (2 3) 4) b (copy-alist a)) +(eq-eval nil '(eq (cadr a) (cadr b))) +(eq-eval t '(eq (car a) (car b))) +(eq-test nil #'copy-alist nil) +(eq-test nil #'copy-list nil) +(error-test #'copy-list 1) +(setq a '(1 (2 (3)))) +(setq as-list (copy-list a)) +(setq as-alist (copy-alist a)) +(setq as-tree (copy-tree a)) +(eq-eval t '(eq (cadadr a) (cadadr as-list))) +(eq-eval t '(eq (cadadr a) (cadadr as-alist))) +(eq-eval nil '(eq (cadadr a) (cadadr as-tree))) + +;; decf - macro +(setq n 2) +(eql-eval 1 '(decf n)) +(eql-eval 1 'n) +(setq n -2147483648) +(eql-eval -2147483649 '(decf n)) +(eql-eval -2147483649 'n) +(setq n 0) +(eql-eval -0.5d0 '(decf n 0.5d0)) +(eql-eval -0.5d0 'n) +(setq n 1) +(eql-eval 1/2 '(decf n 1/2)) +(eql-eval 1/2 'n) + +;; delete and remove - function +(setq a '(1 3 4 5 9) b a) +(equal-test '(1 3 5 9) #'remove 4 a) +(eq-eval t '(eq a b)) +(setq a (delete 4 a)) +(equal-eval '(1 3 5 9) 'a) +(setq a '(1 2 4 1 3 4 5) b a) +(equal-test '(1 2 1 3 5) #'remove 4 a) +(eq-eval t '(eq a b)) +(equal-test '(1 2 1 3 4 5) #'remove 4 a :count 1) +(eq-eval t '(eq a b)) +(equal-test '(1 2 4 1 3 5) #'remove 4 a :count 1 :from-end t) +(eq-eval t '(eq a b)) +(equal-test '(4 3 4 5) #'remove 3 a :test #'>) +(eq-eval t '(eq a b)) +(setq a (delete 4 '(1 2 4 1 3 4 5))) +(equal-eval '(1 2 1 3 5) 'a) +(setq a (delete 4 '(1 2 4 1 3 4 5) :count 1)) +(equal-eval '(1 2 1 3 4 5) 'a) +(setq a (delete 4 '(1 2 4 1 3 4 5) :count 1 :from-end t)) +(equal-eval '(1 2 4 1 3 5) 'a) +(equal-test "abc" #'delete-if #'digit-char-p "a1b2c3") +(equal-test "123" #'delete-if-not #'digit-char-p "a1b2c3") +(eq-test nil #'delete 1 nil) +(eq-test nil #'remove 1 nil) +(setq a '(1 2 3 4 :test 5 6 7 8) b a) +(equal-test '(1 2 :test 7 8) #'remove-if #'numberp a :start 2 :end 7) +(eq-eval t '(eq a b)) +(setq a (delete-if #'numberp a :start 2 :end 7)) +(equal-eval '(1 2 :test 7 8) 'a) + +;; digit-char - function +(eql-test #\0 #'digit-char 0) +(eql-test #\A #'digit-char 10 11) +(eq-test nil #'digit-char 10 10) +(eql-test 35 #'digit-char-p #\z 36) +(error-test #'digit-char #\a) +(error-test #'digit-char-p 1/2) + + + +;; TODO directory (known to have problems with parameters like "../*/../*/") + + + +;; elt - function +(eql-test #\a #'elt "xabc" 1) +(eql-test 3 #'elt '(0 1 2 3) 3) +(error-test #'elt nil 0) + +;; endp - function +(eql-test t #'endp nil) +(error-test #'endp t) +(eql-test nil #'endp '(1 . 2)) +(error-test #'endp #(1 2)) + +;; every - function +(eql-test t #'every 'not-used ()) +(eql-test t #'every #'characterp "abc") +(eql-test nil #'every #'< '(1 2 3) '(4 5 6) #(7 8 -1)) +(eql-test t #'every #'< '(1 2 3) '(4 5 6) #(7 8)) + +;; fboundp and fmakunbound - function +(eq-test t #'fboundp 'car) +(eq-eval 'test '(defun test ())) +(eq-test t #'fboundp 'test) +(eq-test 'test #'fmakunbound 'test) +(eq-test nil #'fboundp 'test) +(eq-eval 'test '(defmacro test (x) x)) +(eq-test t #'fboundp 'test) +(eq-test 'test #'fmakunbound 'test) + +;; fill - function +(setq x (list 1 2 3 4)) +(equal-test '((4 4 4 4) (4 4 4 4) (4 4 4 4) (4 4 4 4)) #'fill x '(4 4 4 4)) +(eq-eval t '(eq (car x) (cadr x))) +(equalp-test '#(a z z d e) #'fill '#(a b c d e) 'z :start 1 :end 3) +(equal-test "012ee" #'fill (xseq "01234") #\e :start 3) +(error-test #'fill 1 #\a) + +;; find - function +(eql-test #\Space #'find #\d "here are some letters that can be looked at" :test #'char>) +(eql-test 3 #'find-if #'oddp '(1 2 3 4 5) :end 3 :from-end t) +(eq-test nil #'find-if-not #'complexp '#(3.5 2 #C(1.0 0.0) #C(0.0 1.0)) :start 2) +(eq-test nil #'find 1 "abc") +(error-test #'find 1 #c(1 2)) + +;; find-symbol - function +(equal-eval '(nil nil) + '(multiple-value-list (find-symbol "NEVER-BEFORE-USED"))) +(equal-eval '(nil nil) + '(multiple-value-list (find-symbol "NEVER-BEFORE-USED"))) +(setq test (multiple-value-list (intern "NEVER-BEFORE-USED"))) +(equal-eval test '(read-from-string "(never-before-used nil)")) +(equal-eval '(never-before-used :internal) + '(multiple-value-list (intern "NEVER-BEFORE-USED"))) +(equal-eval '(never-before-used :internal) + '(multiple-value-list (find-symbol "NEVER-BEFORE-USED"))) +(equal-eval '(nil nil) + '(multiple-value-list (find-symbol "never-before-used"))) +(equal-eval '(car :inherited) + '(multiple-value-list (find-symbol "CAR" 'common-lisp-user))) +(equal-eval '(car :external) + '(multiple-value-list (find-symbol "CAR" 'common-lisp))) +;; XXX these will generate wrong results, NIL is not really a symbol +;; currently in the interpreter +(equal-eval '(nil :inherited) + '(multiple-value-list (find-symbol "NIL" 'common-lisp-user))) +(equal-eval '(nil :external) + '(multiple-value-list (find-symbol "NIL" 'common-lisp))) +(setq test (multiple-value-list + (find-symbol "NIL" (prog1 (make-package "JUST-TESTING" :use '()) + (intern "NIL" "JUST-TESTING"))))) +(equal-eval (read-from-string "(just-testing::nil :internal)") 'test) +(eq-eval t '(export 'just-testing::nil 'just-testing)) +(equal-eval '(just-testing:nil :external) + '(multiple-value-list (find-symbol "NIL" 'just-testing))) + +#+xedit (equal-eval '(nil nil) + '(multiple-value-list (find-symbol "NIL" "KEYWORD"))) +#| +;; optional result of previous form: +(equal-eval '(:nil :external) + '(multiple-value-list (find-symbol "NIL" "KEYWORD"))) +|# + + + +;; funcall - function +(eql-test 6 #'funcall #'+ 1 2 3) +(eql-test 1 #'funcall #'car '(1 2 3)) +(equal-test '(1 2 3) #'funcall #'list 1 2 3) + + + +;; TODO properly implement ``function'' + + + +;; functionp - function (predicate) +(eq-test nil #'functionp 'append) +(eq-test t #'functionp #'append) +(eq-test nil #'functionp '(lambda (x) (* x x))) +(eq-test t #'functionp #'(lambda (x) (* x x))) +(eq-test t #'functionp (symbol-function 'append)) +(eq-test nil #'functionp 1) +(eq-test nil #'functionp nil) + +;; gensym - function +(setq sym1 (gensym)) +(eq-test nil #'symbol-package sym1) +(setq sym1 (gensym 100)) +(setq sym2 (gensym 100)) +(eq-test nil #'eq sym1 sym2) +(eq-test nil #'equalp (gensym) (gensym)) + +;; get - accessor +(defun make-person (first-name last-name) + (let ((person (gensym "PERSON"))) + (setf (get person 'first-name) first-name) + (setf (get person 'last-name) last-name) + person)) +(eq-eval '*john* '(defvar *john* (make-person "John" "Dow"))) +(eq-eval '*sally* '(defvar *sally* (make-person "Sally" "Jones"))) +(equal-eval "John" '(get *john* 'first-name)) +(equal-eval "Jones" '(get *sally* 'last-name)) +(defun marry (man woman married-name) + (setf (get man 'wife) woman) + (setf (get woman 'husband) man) + (setf (get man 'last-name) married-name) + (setf (get woman 'last-name) married-name) + married-name) +(equal-eval "Dow-Jones" '(marry *john* *sally* "Dow-Jones")) +(equal-eval "Dow-Jones" '(get *john* 'last-name)) +(equal-eval "Sally" '(get (get *john* 'wife) 'first-name)) +(equal-eval `(wife ,*sally* last-name "Dow-Jones" first-name "John") + '(symbol-plist *john*)) +(eq-eval 'age + '(defmacro age (person &optional (default ''thirty-something)) + `(get ,person 'age ,default))) +(eq-eval 'thirty-something '(age *john*)) +(eql-eval 20 '(age *john* 20)) +(eql-eval 25 '(setf (age *john*) 25)) +(eql-eval 25 '(age *john*)) +(eql-eval 25 '(age *john* 20)) + +;; graphic-char-p - function +(eq-test t #'graphic-char-p #\a) +(eq-test t #'graphic-char-p #\Space) +(eq-test nil #'graphic-char-p #\Newline) +(eq-test nil #'graphic-char-p #\Tab) +(eq-test nil #'graphic-char-p #\Rubout) + +;; if - special operator +(eq-eval nil '(if nil t)) +(eq-eval nil '(if t nil t)) +(eq-eval nil '(if nil t nil)) +(eq-eval nil '(if nil t (if nil (if nil t) nil))) + +;; incf - macro +(setq n 1) +(eql-eval 2 '(incf n)) +(eql-eval 2 'n) +(setq n 2147483647) +(eql-eval 2147483648 '(incf n)) +(eql-eval 2147483648 'n) +(setq n 0) +(eql-eval 0.5d0 '(incf n 0.5d0)) +(eql-eval 0.5d0 'n) +(setq n 1) +(eql-eval 3/2 '(incf n 1/2)) +(eql-eval 3/2 'n) + +;; intersection - function +(setq list1 (list 1 1 2 3 4 'a 'b 'c "A" "B" "C" "d") + list2 (list 1 4 5 'b 'c 'd "a" "B" "c" "D")) +(equal-test '(1 1 4 b c) #'intersection list1 list2) +(equal-test '(1 1 4 b c "B") #'intersection list1 list2 :test 'equal) +(equal-test '(1 1 4 b c "A" "B" "C" "d") + #'intersection list1 list2 :test #'equalp) +(setq list1 (nintersection list1 list2)) +(equal-eval '(1 1 4 b c) 'list1) +(setq list1 (copy-list '((1 . 2) (2 . 3) (3 . 4) (4 . 5)))) +(setq list2 (copy-list '((1 . 3) (2 . 4) (3 . 6) (4 . 8)))) +(equal-test '((2 . 3) (3 . 4)) #'nintersection list1 list2 :key #'cdr) + +;; keywordp - function (predicate) +(eq-test t #'keywordp :test) +(eq-test nil #'keywordp 'test) +(eq-test nil #'keywordp '#:test) +(eq-test nil #'keywordp 1) +(eq-test nil #'keywordp #'keywordp) +(eq-test nil #'keywordp nil) + +;; last - function +(equal-test '(3) #'last '(1 2 3)) +(equal-test '(2 . 3) #'last '(1 2 . 3)) +(eq-test nil #'last nil) +(eql-test () #'last '(1 2 3) 0) +(setq a '(1 . 2)) +(eql-test 2 #'last a 0) +(eq-test a #'last a 1) +(eq-test a #'last a 2) +(eq-test t #'last t) +(equal-test #c(1 2) #'last #c(1 2)) +(equalp-test #(1 2 3) #'last #(1 2 3)) + +;; length - function +(eql-test 3 #'length "abc") +(eql-test 0 #'length nil) +(eql-test 1 #'length '(1 . 2)) +(eql-test 2 #'length #(1 2)) +(error-test #'length #c(1 2)) +(error-test #'length t) + +;; let - special operator +(eql-eval 2 '(setq a 1 b 2)) +(eql-eval 2 '(let ((a 2)) a)) +(eql-eval 1 'a) +(eql-eval 1 '(let ((a 3) (b a)) b)) +(eql-eval 2 'b) + +;; let* - special operator +(setq a 1 b 2) +(eql-eval 2 '(let* ((a 2)) a)) +(eql-eval 1 'a) +(eql-eval 3 '(let* ((a 3) (b a)) b)) +(eql-eval 2 'b) + +;; list - function +(equal-test '(1) #'list 1) +(equal-test '(3 4 a b 4) #'list 3 4 'a (car '(b . c)) (+ 6 -2)) +(eq-test nil #'list) + +;; list-length - function +(eql-test 4 #'list-length '(a b c d)) +(eql-test 3 #'list-length '(a (b c) d)) +(eql-test 0 #'list-length '()) +(eql-test 0 #'list-length nil) +(defun circular-list (&rest elements) + (let ((cycle (copy-list elements))) + (nconc cycle cycle))) +(eq-test nil #'list-length (circular-list 'a 'b)) +(eq-test nil #'list-length (circular-list 'a)) +(eql-test 0 #'list-length (circular-list)) + +;; list* - function +(eql-test 1 #'list* 1) +(equal-test '(a b c . d) #'list* 'a 'b 'c 'd) +(error-test #'list*) +(setq a '(1 2)) +(eq-test a #'list* a) + +;; listp - function (predicate) +(eq-test t #'listp nil) +(eq-test t #'listp '(1 . 2)) +(eq-test nil #'listp t) +(eq-test nil #'listp #'listp) +(eq-test nil #'listp #(1 2)) +(eq-test nil #'listp #c(1 2)) + +;; lower-case-p - function +(eq-test t #'lower-case-p #\a) +(eq-test nil #'lower-case-p #\1) +(eq-test nil #'lower-case-p #\Newline) +(error-test #'lower-case-p 1) + + + +;; TODO make-array (will be rewritten) + + + +;; make-list - function +(equal-test '(nil nil nil) #'make-list 3) +(equal-test '((1 2) (1 2)) #'make-list 2 :initial-element '(1 2)) +(eq-test nil #'make-list 0) +(eq-test nil #'make-list 0 :initial-element 1) + +;; make-package - function +(setq pack1 (make-package "PACKAGE-1" :nicknames '("PACK-1" "PACK1"))) +(setq pack2 (make-package "PACKAGE-2" :nicknames '("PACK-2" "PACK2") :use '("PACK1"))) +(equal-test (list pack2) #'package-used-by-list pack1) +(equal-test (list pack1) #'package-use-list pack2) +(eq-test pack1 #'symbol-package 'pack1::test) +(eq-test pack2 #'symbol-package 'pack2::test) + +;; make-string - function +(equal-test "55555" #'make-string 5 :initial-element #\5) +(equal-test "" #'make-string 0) +(error-test #'make-string 10 :initial-element t) +(error-test #'make-string 10 :initial-element nil) +(error-test #'make-string 10 :initial-element 1) +(eql-test 10 #'length (make-string 10)) + +;; make-symbol - function +(setq a "TEST") +;; This will fail +(eq-test nil #'eq (make-symbol a) (make-symbol a)) +(equal-test a #'symbol-name (make-symbol a)) +(setq temp-string "temp") +(setq temp-symbol (make-symbol temp-string)) +(equal-test temp-string #'symbol-name temp-symbol) +(equal-eval '(nil nil) '(multiple-value-list (find-symbol temp-string))) + +;; makunbound - function +(eq-eval 1 '(setf (symbol-value 'a) 1)) +(eq-test t #'boundp 'a) +(eql-eval 1 'a) +(eq-test 'a #'makunbound 'a) +(eq-test nil #'boundp 'a) +(error-test #'makunbound 1) + +;; mapc - function +(setq dummy nil) +(equal-test '(1 2 3 4) + #'mapc #'(lambda (&rest x) (setq dummy (append dummy x))) + '(1 2 3 4) + '(a b c d e) + '(x y z)) +(equal-eval '(1 a x 2 b y 3 c z) 'dummy) + +;; mapcan - function +(equal-test '(d 4 e 5) + #'mapcan #'(lambda (x y) (if (null x) nil (list x y))) + '(nil nil nil d e) + '(1 2 3 4 5 6)) +(equal-test '(1 3 4 5) + #'mapcan #'(lambda (x) (and (numberp x) (list x))) + '(a 1 b c 3 4 d 5)) + +;; mapcar - function +(equal-test '(1 2 3) #'mapcar #'car '((1 a) (2 b) (3 c))) +(equal-test '(3 4 2 5 6) #'mapcar #'abs '(3 -4 2 -5 -6)) +(equal-test '((a . 1) (b . 2) (c . 3)) #'mapcar #'cons '(a b c) '(1 2 3)) +(equal-test '((1 3 5)) #'mapcar #'list* '(1 2) '(3 4) '((5))) +(equal-test '((1 3 5) (2 4 6)) #'mapcar #'list* '(1 2) '(3 4) '((5) (6))) + +;; mapcon - function +(equal-test '(1 a 2 b (3) c) #'mapcon #'car '((1 a) (2 b) ((3) c))) +(equal-test '((1 2 3 4) (2 3 4) (3 4) (4)) #'mapcon #'list '(1 2 3 4)) + +;; mapl - function +(setq dummy nil) +(equal-test '(1 2 3 4) #'mapl #'(lambda (x) (push x dummy)) '(1 2 3 4)) +(equal-eval '((4) (3 4) (2 3 4) (1 2 3 4)) 'dummy) + +;; maplist - function +(equal-test '((1 2 3 4 1 2 1 2 3) (2 3 4 2 2 3)) + #'maplist #'append '(1 2 3 4) '(1 2) '(1 2 3)) +(equal-test '((foo a b c d) (foo b c d) (foo c d) (foo d)) + #'maplist #'(lambda (x) (cons 'foo x)) '(a b c d)) +(equal-test '(0 0 1 0 1 1 1) + #'maplist #'(lambda (x) (if (member (car x) (cdr x)) 0 1)) '(a b a c d b c)) + +;; member - function +(setq a '(1 2 3)) +(eq-test (cdr a) #'member 2 a) +(setq a '((1 . 2) (3 . 4))) +(eq-test (cdr a) #'member 2 a :test-not #'= :key #'cdr) +(eq-test nil #'member 'e '(a b c d)) +(eq-test nil #'member 1 nil) +(error-test #'member 2 '(1 . 2)) +(setq a '(a b nil c d)) +(eq-test (cddr a) #'member-if #'listp a) +(setq a '(a #\Space 5/3 foo)) +(eq-test (cddr a) #'member-if #'numberp a) +(setq a '(3 6 9 11 . 12)) +(eq-test (cdddr a) #'member-if-not #'zerop a :key #'(lambda (x) (mod x 3))) + +;; multiple-value-bind - macro +(equal-eval '(11 9) '(multiple-value-bind (f r) (floor 130 11) (list f r))) + +;; multiple-value-call - special operator +(equal-eval '(1 / 2 3 / / 2 0.5) + '(multiple-value-call #'list 1 '/ (values 2 3) '/ (values) '/ (floor 2.5))) +(eql-eval 10 '(multiple-value-call #'+ (floor 5 3) (floor 19 4))) + +;; multiple-value-list - macro +(equal-eval '(-1 1) '(multiple-value-list (floor -3 4))) +(eql-eval nil '(multiple-value-list (values))) +(equal-eval '(nil) '(multiple-value-list (values nil))) + +;; multiple-value-prog1 - special operator +(setq temp '(1 2 3)) +(equal-eval temp + '(multiple-value-list + (multiple-value-prog1 + (values-list temp) + (setq temp nil) + (values-list temp)))) + +;; multiple-value-setq - macro +(eql-eval 1 '(multiple-value-setq (quotient remainder) (truncate 3.5d0 2))) +(eql-eval 1 quotient) +(eql-eval 1.5d0 'remainder) +(eql-eval 1 '(multiple-value-setq (a b c) (values 1 2))) +(eql-eval 1 'a) +(eql-eval 2 'b) +(eq-eval nil 'c) +(eql-eval 4 '(multiple-value-setq (a b) (values 4 5 6))) +(eql-eval 4 'a) +(eql-eval 5 'b) +(setq a 1) +(eql-eval nil '(multiple-value-setq (a) (values))) +(eql-eval nil 'a) + +;; nconc - function +(eq-test nil #'nconc) +(setq x '(a b c)) +(setq y '(d e f)) +(equal-test '(a b c d e f) #'nconc x y) +(equal-eval '(a b c d e f) 'x) +(eq-test y #'cdddr x) +(equal-test '(1 . 2) #'nconc (list 1) 2) +(error-test #'nconc 1 2 3) +(equal-eval '(k l m) + '(setq foo (list 'a 'b 'c 'd 'e) + bar (list 'f 'g 'h 'i 'j) + baz (list 'k 'l 'm))) +(equal-test '(a b c d e f g h i j k l m) #'nconc foo bar baz) +(equal-eval '(a b c d e f g h i j k l m) 'foo) +(equal-eval (nthcdr 5 foo) 'bar) +(equal-eval (nthcdr 10 foo) 'baz) +(setq foo (list 'a 'b 'c 'd 'e) + bar (list 'f 'g 'h 'i 'j) + baz (list 'k 'l 'm)) +(equal-eval '(a b c d e f g h i j k l m) '(setq foo (nconc nil foo bar nil baz))) +(equal-eval '(a b c d e f g h i j k l m) 'foo) +(equal-eval (nthcdr 5 foo) 'bar) +(equal-eval (nthcdr 10 foo) 'baz) + +;; notany - function +(eql-test t #'notany #'> '(1 2 3 4) '(5 6 7 8) '(9 10 11 12)) +(eql-test t #'notany 'not-used ()) +(eql-test nil #'notany #'characterp #(1 2 3 4 5 #\6 7 8)) + +;; notevery - function +(eql-test nil #'notevery #'< '(1 2 3 4) '(5 6 7 8) '(9 10 11 12)) +(eql-test nil #'notevery 'not-used ()) +(eql-test t #'notevery #'numberp #(1 2 3 4 5 #\6 7 8)) + +;; nth - accessor (function) +(eql-test 'foo #'nth 0 '(foo bar baz)) +(eql-test 'bar #'nth 1 '(foo bar baz)) +(eq-test nil #'nth 3 '(foo bar baz)) +(error-test #'nth 0 #c(1 2)) +(error-test #'nth 0 #(1 2)) +(error-test #'nth 0 "test") + +;; nth-value - macro +(equal-eval 'a '(nth-value 0 (values 'a 'b))) +(equal-eval 'b '(nth-value 1 (values 'a 'b))) +(eq-eval nil '(nth-value 2 (values 'a 'b))) +(equal-eval '(3332987528 3332987528 t) + '(multiple-value-list + (let* ((x 83927472397238947423879243432432432) + (y 32423489732) + (a (nth-value 1 (floor x y))) + (b (mod x y))) + (values a b (= a b))))) + +;; nthcdr - function +(eq-test nil #'nthcdr 0 '()) +(eq-test nil #'nthcdr 3 '()) +(equal-test '(a b c) #'nthcdr 0 '(a b c)) +(equal-test '(c) #'nthcdr 2 '(a b c)) +(eq-test () #'nthcdr 4 '(a b c)) +(eql-test 1 #'nthcdr 1 '(0 . 1)) +(error-test #'nthcdr -1 '(1 2)) +(error-test #'nthcdr #\Null '(1 2)) +(error-test #'nthcdr 1 t) +(error-test #'nthcdr 1 #(1 2 3)) + +;; or - macro +(eq-eval nil '(or)) +(setq temp0 nil temp1 10 temp2 20 temp3 30) +(eql-eval 10 '(or temp0 temp1 (setq temp2 37))) +(eql-eval 20 'temp2) +(eql-eval 11 '(or (incf temp1) (incf temp2) (incf temp3))) +(eql-eval 11 'temp1) +(eql-eval 20 temp2) +(eql-eval 30 'temp3) +(eql-eval 11 '(or (values) temp1)) +(eql-eval 11 '(or (values temp1 temp2) temp3)) +(equal-eval '(11 20) '(multiple-value-list (or temp0 (values temp1 temp2)))) +(equal-eval '(20 30) + '(multiple-value-list (or (values temp0 temp1) (values temp2 temp3)))) + +;; packagep - function (predicate) +(eq-test t #'packagep *package*) +(eq-test nil #'packagep 10) +(eq-test t #'packagep (make-package "TEST-PACKAGE")) +(eq-test nil #'packagep 'keyword) +(eq-test t #'packagep (find-package 'keyword)) + +;; pairlis - function +#+xedit ;; order of result may vary +(progn + (equal-test '((one . 1) (two . 2) (three . 3) (four . 19)) + #'pairlis '(one two) '(1 2) '((three . 3) (four . 19))) + (setq keys '(1 2 3) + data '("one" "two" "three") + alist '((4 . "four"))) + (equal-test '((1 . "one") (2 . "two") (3 . "three")) + #'pairlis keys data) + (equal-test '((1 . "one") (2 . "two") (3 . "three") (4 . "four")) + #'pairlis keys data alist) + (equal-eval '(1 2 3) 'keys) + (equal-eval '("one" "two" "three") 'data) + (equal-eval '((4 . "four")) 'alist) + (eq-test nil #'pairlis 1 2) + (error-test #'pairlis '(1 2 3) '(4 5)) +) + +;; pop - macro +(setq stack '(a b c) test stack) +(eq-eval 'a '(pop stack)) +(eq-eval (cdr test) 'stack) +(setq llst '((1 2 3 4)) test (car llst)) +(eq-eval 1 '(pop (car llst))) +(eq-eval (cdr test) '(car llst)) +(error-eval '(pop 1)) +(error-eval '(pop nil)) +;; dotted list +(setq stack (cons 1 2)) +(eq-eval 1 '(pop stack)) +(error-eval '(pop stack)) +;; circular list +(setq stack '#1=(1 . #1#) *print-circle* t) +(eql-eval 1 '(pop stack)) +(eql-eval 1 '(pop stack)) +(eql-eval 1 '(pop (cdr stack))) + +;; position - function +(eql-test 4 #'position #\a "baobab" :from-end t) +(eql-test 2 #'position-if #'oddp '((1) (2) (3) (4)) :start 1 :key #'car) +(eq-test nil #'position 595 '()) +(eq-test 4 #'position-if-not #'integerp '(1 2 3 4 5.0)) +(eql-test 1 #'position (char-int #\1) "0123" :key #'char-int) + +;; prog - macro +(eq-eval nil '(prog () :error)) +(eq-eval 'ok + '(prog ((a 0)) + l1 (if (< a 10) (go l3) (go l2)) + (return 'failed) + l2 (return 'ok) + (return 'failed) + l3 (incf a) (go l1) + (return 'failed) + )) +(setq a 1) +(eq-eval '/= '(prog ((a 2) (b a)) (return (if (= a b) '= '/=)))) + +;; prog* - macro +(setq a 1) +(eq-eval nil '(prog* () :error)) +(eq-eval 'ok + '(prog* ((a 0) (b 0)) + l1 (if (< a 10) (go l3) (go l2)) + (return 'failed) + l2 (if (< b 10) (go l4) (return 'ok)) + (return 'failed) + l3 (incf a) (go l1) + (return 'failed) + l4 (incf b) (setq a 0) (go l1) + (return 'failed) + )) +(eq-eval '= '(prog* ((a 2) (b a)) (return (if (= a b) '= '/=)))) + +;; prog1 - macro +(setq temp 1) +(eql-eval 1 '(prog1 temp (incf temp) (eql-eval 2 'temp) temp)) +(eql-eval 2 'temp) +(eql-eval 2 '(prog1 temp (setq temp nil) (eql-eval nil 'temp) temp)) +(eq-eval nil 'temp) +(eql-eval 1 '(prog1 (values 1 2 3) 4)) +(setq temp (list 'a 'b 'c)) +(eq-eval 'a '(prog1 (car temp) (setf (car temp) 'alpha))) +(equal-eval '(alpha b c) 'temp) +(equal-eval '(1) + '(multiple-value-list (prog1 (values 1 2) (values 4 5)))) + +;; prog2 - macro +(setq temp 1) +(eql-eval 3 '(prog2 (incf temp) (incf temp) (incf temp))) +(eql-eval 4 'temp) +(eql-eval 2 '(prog2 1 (values 2 3 4) 5)) +(equal-eval '(3) + '(multiple-value-list (prog2 (values 1 2) (values 3 4) (values 5 6)))) + +;; progn - special operator +(eq-eval nil '(progn)) +(eql-eval 3 '(progn 1 2 3)) +(equal-eval '(1 2 3) '(multiple-value-list (progn (values 1 2 3)))) +(setq a 1) +(eq-eval 'here '(if a (progn (setq a nil) 'here) (progn (setq a t) 'there))) +(eq-eval nil 'a) + +;; progv - special operator +(makunbound '*x*) ;; make sure it is not bound +(setq *x* 1) +(eql-eval 2 '(progv '(*x*) '(2) *x*)) +(eql-eval 1 '*x*) +(equal-eval '(3 4) + '(let ((*x* 3)) (progv '(*x*) '(4) (list *x* (symbol-value '*x*))))) +(makunbound '*x*) +(defvar *x* 1) +(equal-eval '(4 4) + '(let ((*x* 3)) (progv '(*x*) '(4) (list *x* (symbol-value '*x*))))) +(equal-eval '(4 4) + '(multiple-value-list + (let ((*x* 3)) + (progv '(*x*) '(4) (values-list (list *x* (symbol-value '*x*))))))) + +;; push - macro +(setq llst '(nil)) +(equal-eval '(1) '(push 1 (car llst))) +(equal-eval '((1)) 'llst) +(equal-eval '(1 1) '(push 1 (car llst))) +(equal-eval '((1 1)) 'llst) +(setq x '(a (b c) d)) +(equal-eval '(5 B C) '(push 5 (cadr x))) +(equal-eval '(a (5 b c) d) 'x) + +;; pushnew - macro +(setq x '(a (b c) d)) +(equal-eval '(5 b c) '(pushnew 5 (cadr x))) +(equal-eval '(a (5 b c) d) 'x) +(equal-eval '(5 b c) '(pushnew 'b (cadr x))) +(equal-eval '(a (5 b c) d) 'x) +(setq lst '((1) (1 2) (1 2 3))) +(equal-eval '((2) (1) (1 2) (1 2 3)) '(pushnew '(2) lst)) +(equal-eval '((1) (2) (1) (1 2) (1 2 3)) '(pushnew '(1) lst)) +(equal-eval '((1) (2) (1) (1 2) (1 2 3)) '(pushnew '(1) lst :test 'equal)) +(equal-eval '((1) (2) (1) (1 2) (1 2 3)) '(pushnew '(1) lst :key #'car)) + +;; remove-duplicates - function +(equal-test "aBcD" #'remove-duplicates "aBcDAbCd" :test #'char-equal :from-end t) +(equal-test '(a c b d e) #'remove-duplicates '(a b c b d d e)) +(equal-test '(a b c d e) #'remove-duplicates '(a b c b d d e) :from-end t) +(equal-test '((bar #\%) (baz #\A)) + #'remove-duplicates '((foo #\a) (bar #\%) (baz #\A)) + :test #'char-equal :key #'cadr) +(equal-test '((foo #\a) (bar #\%)) + #'remove-duplicates '((foo #\a) (bar #\%) (baz #\A)) + :test #'char-equal :key #'cadr :from-end t) +(setq tester (list 0 1 2 3 4 5 6)) +(equal-test '(0 4 5 6) #'delete-duplicates tester :key #'oddp :start 1 :end 6) + +;; replace - function +(equal-test "abcd456hij" + #'replace (copy-seq "abcdefghij") "0123456789" :start1 4 :end1 7 :start2 4) +(setq lst (xseq "012345678")) +(equal-test "010123456" #'replace lst lst :start1 2 :start2 0) +(equal-eval "010123456" 'lst) + +;; rest - accessor +(equal-eval '(2) '(rest '(1 2))) +(eql-eval 2 '(rest '(1 . 2))) +(eq-eval nil '(rest '(1))) +(setq *cons* '(1 . 2)) +(equal-eval "two" '(setf (rest *cons*) "two")) +(equal-eval '(1 . "two") '*cons*) + +;; return - macro +(eq-eval nil '(block nil (return) 1)) +(eql-eval 1 '(block nil (return 1) 2)) +(equal-eval '(1 2) '(multiple-value-list (block nil (return (values 1 2)) 3))) +(eql-eval 1 '(block nil (block alpha (return 1) 2))) +(eql-eval 2 '(block alpha (block nil (return 1)) 2)) +(eql-eval 1 '(block nil (block nil (return 1) 2))) + +;; return-from - special operator +(eq-eval nil '(block alpha (return-from alpha) 1)) +(eql-eval 1 '(block alpha (return-from alpha 1) 2)) +(equal-eval '(1 2) + '(multiple-value-list (block alpha (return-from alpha (values 1 2)) 3))) +(eql-eval 2 + '(let ((a 0)) (dotimes (i 10) (incf a) (when (oddp i) (return))) a)) +(eq-eval 'temp '(defun temp (x) (if x (return-from temp ''dummy)) 44)) +(eql-eval 44 '(temp nil)) +(eq-eval 'dummy (temp t)) +(eql-eval 2 (block nil (unwind-protect (return-from nil 1) (return-from nil 2)))) +(error-eval '(funcall (block nil #'(lambda () (return-from nil))))) + +;; reverse - function +(setq str (xseq "abc") test str) +(equal-test "cba" #'reverse str) +(eq-eval test 'str) +(equal-eval "cba" '(setq test (nreverse str))) +(equal-eval "cba" 'test) +(setq l (list 1 2 3) test l) +(equal-eval '(3 2 1) '(setq test (nreverse l))) +(equal-eval '(3 2 1) 'test) + +;; rplac? - function +(eql-eval '*some-list* + '(defparameter *some-list* (list* 'one 'two 'three 'four))) +(equal-eval '(one two three . four) '*some-list*) +(equal-test '(uno two three . four) #'rplaca *some-list* 'uno) +(equal-eval '(uno two three . four) '*some-list*) +(equal-test '(three iv) #'rplacd (last *some-list*) (list 'iv)) +(equal-eval '(uno two three iv) '*some-list*) + +;; search - function +(eql-test 7 #'search "dog" "it's a dog's life") +(eql-test 2 #'search '(0 1) '(2 4 6 1 3 5) :key #'oddp) +(eql-test 8 #'search "foo" "foooobarfooooobarfo" :from-end t) +(eql-test 5 + #'search "123" + (mapcar #'(lambda (x) (+ x (char-code #\0))) + '(1 2 34 3 2 1 2 3 4 3 2 1)) :from-end t + :key #'(lambda (x) (if (integerp x) (code-char x) x))) +(eql-test 0 #'search "abc" "abcd" :from-end t) +(eql-test 3 #'search "bar" "foobar") + +;; set - function +(eql-eval 1 '(setf (symbol-value 'n) 1)) +(eql-test 2 #'set 'n 2) +(eql-test 2 #'symbol-value 'n) +(eql-eval 4 + '(let ((n 3)) + (setq n (+ n 1)) + (setf (symbol-value 'n) (* n 10)) + (set 'n (+ (symbol-value 'n) n)) + n)) +(eql-eval 44 'n) +(defvar *n* 2) +(eql-eval 80 + '(let ((*n* 3)) + (setq *n* (+ *n* 1)) + (setf (symbol-value '*n*) (* *n* 10)) + (set '*n* (+ (symbol-value '*n*) *n*)) + *n*)) +(eql-eval 2 '*n*) +(eq-eval '*even-count* '(defvar *even-count* 0)) +(eq-eval '*odd-count* '(defvar *odd-count* 0)) +(eql-eval 'tally-list + '(defun tally-list (list) + (dolist (element list) + (set (if (evenp element) '*even-count* '*odd-count*) + (+ element (if (evenp element) *even-count* *odd-count*)))))) +(eq-eval nil '(tally-list '(1 9 4 3 2 7))) +(eql-eval 6 '*even-count*) +(eql-eval 20 '*odd-count*) + +;; set-difference - function +(setq lst1 (list "A" "b" "C" "d") lst2 (list "a" "B" "C" "d")) +(equal-test '("A" "b" "C" "d") #'set-difference lst1 lst2) +(equal-test '("A" "b") #'set-difference lst1 lst2 :test 'equal) +(eq-test nil #'set-difference lst1 lst2 :test #'equalp) +(equal-test '("A" "b") #'nset-difference lst1 lst2 :test #'string=) +(setq lst1 '(("a" . "b") ("c" . "d") ("e" . "f")) + lst2 '(("c" . "a") ("e" . "b") ("d" . "a"))) +(equal-test '(("c" . "d") ("e" . "f")) + #'nset-difference lst1 lst2 :test #'string= :key #'cdr) +(equal-eval '(("c" . "a") ("e" . "b") ("d" . "a")) 'lst2) +(equal-test '("banana" "lemon" "rhubarb") + #'set-difference + '("strawberry" "chocolate" "banana" "lemon" "pistachio" "rhubarb") + '(#\c #\w) :test #'(lambda (s c) (find c s))) + +;; set-exclusive-or - function +(setq lst1 (list 1 "a" "b") lst2 (list 1 "A" "b")) +(equal-test '("a" "b" "A" "b") #'set-exclusive-or lst1 lst2) +(equal-test '("a" "A") #'set-exclusive-or lst1 lst2 :test #'equal) +(eq-test nil #'set-exclusive-or lst1 lst2 :test 'equalp) +(equal-test '("a" "b" "A" "b") #'nset-exclusive-or lst1 lst2) +(setq lst1 '(("a" . "b") ("c" . "d") ("e" . "f")) + lst2 '(("c" . "a") ("e" . "b") ("d" . "a"))) +(equal-test '(("c" . "d") ("e" . "f") ("c" . "a") ("d" . "a")) + #'nset-exclusive-or lst1 lst2 :test #'string= :key #'cdr) + +;; setf - macro +(setq x (cons 'a 'b) y (list 1 2 3)) +(equal-eval '(1 x 3) '(setf (car x) 'x (cadr y) (car x) (cdr x) y)) +(equal-eval '(x 1 x 3) 'x) +(equal-eval '(1 x 3) 'y) +(setq x (cons 'a 'b) y (list 1 2 3)) +(eq-eval nil '(psetf (car x) 'x (cadr y) (car x) (cdr x) y)) +(equal-eval '(x 1 a 3) 'x) +(equal-eval '(1 a 3) 'y) +(error-eval '(setf x)) +(error-eval '(psetf x)) + +;; setq - special form +(eql-eval 3 '(setq a 1 b 2 c 3)) +(eql-eval 1 'a) +(eql-eval 2 'b) +(eql-eval 3 'c) +(eql-eval 7 '(setq a (1+ b) b (1+ a) c (+ a b))) +(eql-eval 3 'a) +(eql-eval 4 'b) +(eql-eval 7 'c) +(eq-eval nil '(psetq a 1 b 2 c 3)) +(eql-eval 1 'a) +(eql-eval 2 'b) +(eql-eval 3 'c) +(equal-eval '(2 1) + '(multiple-value-list (let ((a 1) (b 2)) (psetq a b b a) (values a b)))) +(error-eval '(setq x)) +(error-eval '(setq x 1 y)) + +;; some - function +(eq-test t #'some #'= '(1 2 3 4 5) '(5 4 3 2 1)) + +;; sort - function +(setq tester (copy-seq "lkjashd")) +(equal-test "adhjkls" #'sort tester #'char-lessp) +(setq tester (list '(1 2 3) '(4 5 6) '(7 8 9))) +(equal-test '((7 8 9) (4 5 6) (1 2 3)) #'sort tester #'> :key #'car) +(setq tester (list 1 2 3 4 5 6 7 8 9 0)) +(equal-test '(1 3 5 7 9 2 4 6 8 0) + #'stable-sort tester #'(lambda (x y) (and (oddp x) (evenp y)))) +(equalp-test + #((("Kathy" "Chapman") "Editorial") + (("Dick" "Gabriel") "Objects") + (("Gregor" "Kiczales") "Objects") + (("Sandra" "Loosemore") "Compiler") + (("Larry" "Masinter") "Cleanup") + (("David" "Moon") "Objects") + (("Kent" "Pitman") "Conditions") + (("Dick" "Waters") "Iteration") + (("JonL" "White") "Iteration")) + #'sort (setq committee-data + (vector (list (list "JonL" "White") "Iteration") + (list (list "Dick" "Waters") "Iteration") + (list (list "Dick" "Gabriel") "Objects") + (list (list "Kent" "Pitman") "Conditions") + (list (list "Gregor" "Kiczales") "Objects") + (list (list "David" "Moon") "Objects") + (list (list "Kathy" "Chapman") "Editorial") + (list (list "Larry" "Masinter") "Cleanup") + (list (list "Sandra" "Loosemore") "Compiler"))) + #'string-lessp :key #'cadar) +(equalp-eval + #((("Larry" "Masinter") "Cleanup") + (("Sandra" "Loosemore") "Compiler") + (("Kent" "Pitman") "Conditions") + (("Kathy" "Chapman") "Editorial") + (("Dick" "Waters") "Iteration") + (("JonL" "White") "Iteration") + (("Dick" "Gabriel") "Objects") + (("Gregor" "Kiczales") "Objects") + (("David" "Moon") "Objects")) + '(setq committee-data + (stable-sort committee-data #'string-lessp :key #'cadr))) +(error-test #'sort #c(1 2)) + +;; string - function +(setq a "already a string") +(eq-test a #'string a) +(equal-test "ELM" #'string 'elm) +(equal-test "c" #'string #\c) + +;; string-* - function +(eq-test t #'string= "foo" "foo") +(eq-test nil #'string= "foo" "Foo") +(eq-test nil #'string= "foo" "bar") +(eq-test t #'string= "together" "frog" :start1 1 :end1 3 :start2 2) +(eq-test t #'string-equal "foo" "Foo") +(eq-test t #'string= "abcd" "01234abcd9012" :start2 5 :end2 9) +(eql-test 3 #'string< "aaaa" "aaab") +(eql-test 4 #'string>= "aaaaa" "aaaa") +(eql-test 5 #'string-not-greaterp "Abcde" "abcdE") +(eql-test 6 #'string-lessp "012AAAA789" "01aaab6" :start1 3 :end1 7 + :start2 2 :end2 6) +(eq-test nil #'string-not-equal "AAAA" "aaaA") +(error-test #'string= #(1 2 3) '(1 2 3)) +(eql-test 0 #'string< "abcd" "efg") +(eql-test 1 #'string< "abcd" "afg") +(eql-test 0 #'string/= "foo" "baar") +(eql-test nil #'string/= "foobar" "foobar") + +;; string-{upcase,downcase,capitalize} - function +(equal-test "ABCDE" #'string-upcase "abcde") +(equal-test "aBCDe" #'string-upcase "abcde" :start 1 :end 4) +(equal-test "aBCDe" #'nstring-upcase (xseq "abcde") :start 1 :end 4) +(equal-test "DR. LIVINGSTON, I PRESUME?" + #'string-upcase "Dr. Livingston, I presume?") +(equal-test "Dr. LIVINGSTON, I Presume?" + #'string-upcase "Dr. Livingston, I presume?" :start 4 :end 19) +(equal-test "Dr. LIVINGSTON, I Presume?" + #'nstring-upcase (xseq "Dr. Livingston, I presume?") :start 4 :end 19) +(equal-test "Dr. LiVINGston, I presume?" + #'string-upcase "Dr. Livingston, I presume?" :start 6 :end 10) +(equal-test "Dr. LiVINGston, I presume?" + #'nstring-upcase (xseq "Dr. Livingston, I presume?") :start 6 :end 10) +(equal-test "dr. livingston, i presume?" + #'string-downcase "Dr. Livingston, I presume?") +(equal-test "Dr. livingston, i Presume?" + #'string-downcase "Dr. Livingston, I Presume?" :start 1 :end 17) +(equal-test "Dr. livingston, i Presume?" + #'nstring-downcase (xseq "Dr. Livingston, I Presume?") :start 1 :end 17) +(equal-test "Elm 13c Arthur;Fig Don'T" + #'string-capitalize "elm 13c arthur;fig don't") +(equal-test "elm 13C Arthur;Fig Don't" + #'string-capitalize "elm 13c arthur;fig don't" :start 6 :end 21) +(equal-test "elm 13C Arthur;Fig Don't" + #'nstring-capitalize (xseq "elm 13c arthur;fig don't") :start 6 :end 21) +(equal-test " Hello " #'string-capitalize " hello ") +(equal-test " Hello " #'nstring-capitalize (xseq " hello ")) +(equal-test "Occluded Casements Forestall Inadvertent Defenestration" + #'string-capitalize "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION") +(equal-test "Don'T!" #'string-capitalize "DON'T!") +(equal-test "Pipe 13a, Foo16c" #'string-capitalize "pipe 13a, foo16c") +(setq str (copy-seq "0123ABCD890a")) +(equal-test "0123AbcD890a" #'nstring-downcase str :start 5 :end 7) +(equal-eval "0123AbcD890a" 'str) +(error-test #'nstring-capitalize 1) +(error-test #'string-capitalize "foobar" :start 4 :end 2) +(equal-test "foobar" #'string-capitalize "foobar" :start 0 :end 0) + +;; string-{,left-,right-}trim - function +(equal-test "kaaak" #'string-trim "abc" "abcaakaaakabcaaa") +#+xedit (equal-test "kaaak" #'nstring-trim "abc" "abcaakaaakabcaaa") +(equal-test "garbanzo beans" + #'string-trim '(#\Space #\Tab #\Newline) " garbanzo beans + ") +#+xedit (equal-test "garbanzo beans" + #'nstring-trim '(#\Space #\Tab #\Newline) " garbanzo beans + ") +(equal-test "three (silly) words" + #'string-trim " (*)" " ( *three (silly) words* ) ") +#+xedit (equal-test "three (silly) words" + #'nstring-trim " (*)" " ( *three (silly) words* ) ") +(equal-test "labcabcabc" #'string-left-trim "abc" "labcabcabc") +#+xedit (equal-test "labcabcabc" #'nstring-left-trim "abc" "labcabcabc") +(equal-test "three (silly) words* ) " + #'string-left-trim " (*)" " ( *three (silly) words* ) ") +#+xedit (equal-test "three (silly) words* ) " + #'nstring-left-trim " (*)" " ( *three (silly) words* ) ") +(equal-test " ( *three (silly) words" + #'string-right-trim " (*)" " ( *three (silly) words* ) ") +#+xedit (equal-test " ( *three (silly) words" + #'nstring-right-trim " (*)" " ( *three (silly) words* ) ") +(error-test #'string-trim 123 "123") +(error-test #'string-left-trim 123 "123") + +;; stringp - function (predicate) +(eq-test t #'stringp "abc") +(eq-test nil #'stringp #\a) +(eq-test nil #'stringp 1) +(eq-test nil #'stringp #(#\a #\b #\c)) + +;; subseq - accessor +(setq str (xseq "012345")) +(equal-test "2345" #'subseq str 2) +(equal-test "34" #'subseq str 3 5) +(equal-eval "abc" '(setf (subseq str 4) "abc")) +(equal-eval "0123ab" 'str) +(equal-eval "A" '(setf (subseq str 0 2) "A")) +(equal-eval "A123ab" 'str) + +;; subsetp - function +(setq cosmos '(1 "a" (1 2))) +(eq-test t #'subsetp '(1) cosmos) +(eq-test nil #'subsetp '((1 2)) cosmos) +(eq-test t #'subsetp '((1 2)) cosmos :test 'equal) +(eq-test t #'subsetp '(1 "A") cosmos :test #'equalp) +(eq-test nil #'subsetp '((1) (2)) '((1) (2))) +(eq-test t #'subsetp '((1) (2)) '((1) (2)) :key #'car) + +;; svref - function +;; XXX vectors will be reimplemented, just a test for the current implementation +(setq v (vector 1 2 'sirens)) +(eql-eval 1 '(svref v 0)) +(eql-eval 'sirens '(svref v 2)) +(eql-eval 'newcomer '(setf (svref v 1) 'newcomer)) +(equalp-eval #(1 newcomer sirens) 'v) + +;; symbol-name - function +(equal-test "TEMP" #'symbol-name 'temp) +(equal-test "START" #'symbol-name :start) +(error-test #'symbol-name 1) + +;; symbol-package - function +(eq-test (find-package "LISP") #'symbol-package 'car) +(eql-test *package* #'symbol-package 'bus) +(eq-test (find-package "KEYWORD") #'symbol-package :optional) +;; Gensyms are uninterned, so have no home package. +(eq-test nil #'symbol-package (gensym)) +(setq pk1 (make-package 'pk1)) +(intern "SAMPLE1" "PK1") +(eq-eval t '(export (find-symbol "SAMPLE1" "PK1") "PK1")) +(setq pk2 (make-package 'pk2 :use '(pk1))) +(equal-eval '(pk1:sample1 :inherited) + '(multiple-value-list (find-symbol "SAMPLE1" "PK2"))) +(eq-test pk1 #'symbol-package 'pk1::sample1) +(eq-test pk1 #'symbol-package 'pk2::sample1) +(eq-test pk1 #'symbol-package 'pk1::sample2) +(eq-test pk2 #'symbol-package 'pk2::sample2) +;; The next several forms create a scenario in which a symbol +;; is not really uninterned, but is "apparently uninterned", +;; and so SYMBOL-PACKAGE still returns NIL. +(setq s3 'pk1::sample3) +(eq-eval t '(import s3 'pk2)) +(eq-eval t '(unintern s3 'pk1)) ;; XXX unintern not yet implemented +(eq-test nil #'symbol-package s3) ;; fail due to unintern not implemented +(eq-test t #'eq s3 'pk2::sample3) + +;; symbol-plist - accessor +(setq sym (gensym)) +(eq-eval () '(symbol-plist sym)) +(eq-eval 'val1 '(setf (get sym 'prop1) 'val1)) +(equal-eval '(prop1 val1) '(symbol-plist sym)) +(eq-eval 'val2 '(setf (get sym 'prop2) 'val2)) +(equal-eval '(prop2 val2 prop1 val1) '(symbol-plist sym)) +(setq sym-plist (list 'prop3 'val3)) +(eq-eval sym-plist '(setf (symbol-plist sym) sym-plist)) +(eq-eval sym-plist '(symbol-plist sym)) + +;; symbol-value - accessor +(eql-eval 1 '(setf (symbol-value 'a) 1)) +(eql-eval 1 '(symbol-value 'a)) +;; SYMBOL-VALUE cannot see lexical variables. +(eql-eval 1 '(let ((a 2)) (symbol-value 'a))) +(eql-eval 1 '(let ((a 2)) (setq a 3) (symbol-value 'a))) + +#+xedit ;; incorrect... +(progn + ;; SYMBOL-VALUE can see dynamic variables. + ;; declare not yet implemented + (proclaim '(special a)) + (eql-eval 2 '(let ((a 2)) (symbol-value 'a))) + (eql-eval 1 'a) + (eql-eval 3 '(let ((a 2)) (setq a 3) (symbol-value 'a))) + (eql-eval 1 'a) + ;; declare not yet implement + (makunbound 'a) + (eql-eval 2 '(let ((a 2)) (setf (symbol-value 'a) 3) a)) + (eql-eval 3 'a) + (eql-eval 3 '(symbol-value 'a)) + ;; declare not yet implement + (makunbound 'a) + (equal-eval '(5 4) + '(multiple-value-list + (let ((a 4)) + + ;; declare not yet implemented + (defparameter a 3) + + (let ((b (symbol-value 'a))) + (setf (symbol-value 'a) 5) + (values a b))))) + (eql-eval 3 'a) +) +(eq-eval :any-keyword '(symbol-value :any-keyword)) +;; XXX these will fail +(eq-eval nil '(symbol-value 'nil)) +(eq-eval nil '(symbol-value '())) + +;; symbolp - function (predicate) +(eq-test t #'symbolp 'elephant) +(eq-test nil #'symbolp 12) +;; XXX these will fail +(eq-test t #'symbolp nil) +(eq-test t #'symbolp '()) +(eq-test t #'symbolp :test) +(eq-test nil #'symbolp "hello") + +;; remprop - function +(setq test (make-symbol "PSEUDO-PI")) +(eq-eval () '(symbol-plist test)) +(eq-eval t '(setf (get test 'constant) t)) +(eql-eval 3.14 '(setf (get test 'approximation) 3.14)) +(eql-eval 'noticeable '(setf (get test 'error-range) 'noticeable)) +(equal-eval '(error-range noticeable approximation 3.14 constant t) + '(symbol-plist test)) +(eq-eval nil '(setf (get test 'approximation) nil)) +(equal-eval '(error-range noticeable approximation nil constant t) + '(symbol-plist test)) +(eq-eval nil (get test 'approximation)) +(eq-test t #'remprop test 'approximation) +(eq-eval nil '(get test 'approximation)) +(equal-eval '(error-range noticeable constant t) '(symbol-plist test)) +(eq-test nil #'remprop test 'approximation) +(equal-eval '(error-range noticeable constant t) '(symbol-plist test)) +(eq-test t #'remprop test 'error-range) +(eql-eval 3 '(setf (get test 'approximation) 3)) +(equal-eval '(approximation 3 constant t) '(symbol-plist test)) + +;; throw - special operator +(equal-eval '(3 9) + '(multiple-value-list + (catch 'result + (setq i 0 j 0) + (loop (incf j 3) (incf i) + (if (= i 3) (throw 'result (values i j))))))) +(eql-eval 2 '(catch nil (unwind-protect (throw nil 1) (throw nil 2)))) + +;; XXX undefined consequences +(eql-eval 2 + '(catch 'a + (catch 'b + (unwind-protect (throw 'a 1) + (throw 'b 2))))) +(eq-eval :outer-catch + '(catch 'foo + (setq string (format nil "The inner catch returns ~s." + (catch 'foo + (unwind-protect (throw 'foo :first-throw) + (throw 'foo :second-throw))))) + :outer-catch)) +(equal-eval "The inner catch returns :SECOND-THROW." 'string) + +;; tree-equal - function +(setq tree1 '(1 (1 2)) + tree2 '(1 (1 2))) +(eq-test t #'tree-equal tree1 tree2) +(eq-test nil #'eql tree1 tree2) +(setq tree1 '('a ('b 'c)) + tree2 '('a ('b 'c))) +(eq-test t #'tree-equal tree1 tree2 :test 'eq) +(eq-test t #'tree-equal 1 1) +(eq-test nil #'tree-equal (list 1 2) (cons 1 2)) +(eq-test nil #'tree-equal 1 2) + +;; union - function +(equal-test '(b c f a d) #'union '(a b c) '(f a d)) +(equal-test '((y 6) (z 2) (x 4)) + #'union '((x 5) (y 6)) '((z 2) (x 4)) :key #'car) +(setq lst1 (list 1 2 '(1 2) "a" "b") + lst2 (list 2 3 '(2 3) "B" "C")) +(equal-test '(1 (1 2) "a" "b" 2 3 (2 3) "B" "C") #'nunion lst1 lst2) + +;; unless - macro +(eq-eval 'hello '(when t 'hello)) +(eq-eval nil '(unless t 'hello)) +(eq-eval nil (when nil 'hello)) +(eq-eval 'hello '(unless nil 'hello)) +(eq-eval nil (when t)) +(eql-eval nil '(unless nil)) +(setq test nil) +(equal-eval '(3 2 1) '(when t (push 1 test) (push 2 test) (push 3 test))) +(equal-eval '(3 2 1) 'test) +(setq test nil) +(eq-eval nil '(unless t (push 1 test) (push 2 test) (push 3 test))) +(eq-eval nil 'test) +(eq-eval nil '(when nil (push 1 test) (push 2 test) (push 3 test))) +(eq-eval nil 'test) +(equal-eval '(3 2 1) '(unless nil (push 1 test) (push 2 test) (push 3 test))) +(equal-eval '(3 2 1) 'test) +(equal-eval '((4) nil (5) nil 6 (6) 7 (7)) + '(let ((x 3)) + (list (when (oddp x) (incf x) (list x)) + (when (oddp x) (incf x) (list x)) + (unless (oddp x) (incf x) (list x)) + (unless (oddp x) (incf x) (list x)) + (if (oddp x) (incf x) (list x)) + (if (oddp x) (incf x) (list x)) + (if (not (oddp x)) (incf x) (list x)) + (if (not (oddp x)) (incf x) (list x))))) + +;; unwind-protect - special operator +(defun dummy-function (x) + (setq state 'running) + (unless (numberp x) (throw 'abort 'not-a-number)) + (setq state (1+ x))) +(eql-eval 2 '(catch 'abort (dummy-function 1))) +(eql-eval 2 'state) +(eq-eval 'not-a-number '(catch 'abort (dummy-function 'trash))) +(eq-eval 'running 'state) +(eq-eval 'not-a-number + '(catch 'abort (unwind-protect (dummy-function 'trash) + (setq state 'aborted)))) +(eq-eval 'aborted 'state) +(eql-eval 2 '(block nil (unwind-protect (return 1) (return 2)))) +;; XXX undefined consequences +(eql-eval 2 + '(block a + (block b + (unwind-protect (return-from a 1) + (return-from b 2))))) +(eql-eval 2 '(catch nil (unwind-protect (throw nil 1) (throw nil 2)))) +;; XXX undefined consequences +(eql-eval 2 + '(catch 'a (catch 'b (unwind-protect (throw 'a 1) (throw 'b 2))))) +(eq-eval ':outer-catch + '(catch 'foo + (setq string + (format nil "The inner catch returns ~s." + (catch 'foo + (unwind-protect (throw 'foo :first-throw) + (throw 'foo :second-throw))))) + :outer-catch)) +(equal-eval "The inner catch returns :SECOND-THROW." 'string) +(eql-eval 10 + '(catch 'a + (catch 'b + (unwind-protect (1+ (catch 'a (throw 'b 1))) + (throw 'a 10))))) +;; XXX undefined consequences +(eql-eval 4 + '(catch 'foo + (catch 'bar + (unwind-protect (throw 'foo 3) + (throw 'bar 4) + (print 'xxx))))) +(eql-eval 4 + '(catch 'bar + (catch 'foo + (unwind-protect (throw 'foo 3) + (throw 'bar 4) + (print 'xxx))))) +(eql-eval 5 + '(block nil + (let ((x 5)) + (unwind-protect (return) + (return x))))) + +;; upper-case-p - function +(eq-test t #'upper-case-p #\A) +(eq-test nil #'upper-case-p #\a) +(eq-test nil #'upper-case-p #\5) +(error-test #'upper-case-p 1) + +;; values - accessor +(eq-eval () '(multiple-value-list (values))) +(equal-eval '(1) '(multiple-value-list (values 1))) +(equal-eval '(1 2) '(multiple-value-list (values 1 2))) +(equal-eval '(1 2 3) '(multiple-value-list (values 1 2 3))) +(equal-eval '(1 4 5) '(multiple-value-list (values (values 1 2 3) 4 5))) + +;; values-list - function +(eq-eval nil '(multiple-value-list (values-list nil))) +(equal-eval '(1) '(multiple-value-list (values-list '(1)))) +(equal-eval '(1 2) '(multiple-value-list (values-list '(1 2)))) +(equal-eval '(1 2 3) '(multiple-value-list (values-list '(1 2 3)))) Index: xc/programs/xedit/lisp/test/math.lsp diff -u /dev/null xc/programs/xedit/lisp/test/math.lsp:1.5 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/test/math.lsp Wed Jan 29 21:46:26 2003 @@ -0,0 +1,982 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/test/math.lsp,v 1.5 2003/01/30 02:46:26 paulo Exp $ +;; + +;; basic math tests +;; This is far from a good regression test, but in the current stage of +;; the interpreter, this is good enough to make sure it is not "so" +;; broken. But note that this does not test all cases where there is +;; change in the type of a numeric object. + +(setq *default-float-format* 'double-float) + +;; floating point results may differ from implementation to implementation (?!) + +(defun test (expect function &rest arguments &aux result (error t)) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + (if error + (format t "ERROR: (~A~{ ~A~})~%" function arguments) + ;; Use eql to make sure result and expect have the same type + (or (eql result expect) +#-xedit ;; hack... + (or + (and + (floatp result) + (floatp expect) + (< (abs (- (abs result) (abs expect))) + 0.00000000000001d0) + ) + (format t "(~A~{ ~A~}) => should be ~A not ~A~%" + function arguments expect result + ) + ) +#+xedit (format t "(~A~{ ~A~}) => should be ~A not ~A~%" + function arguments expect result + ) + ) + ) +) + +(defun div-test (quotient remainder function &rest arguments + &aux quo rem (error t)) + (ignore-errors + (multiple-value-setq (quo rem) (apply function arguments)) + (setq error nil) + ) + (if error + (format t "ERROR: (~A~{ ~A~})~%" function arguments) + (or (and (eql quotient quo) (eql remainder rem)) +#-xedit ;; hack + (or + (or + (eql quotient quo) + (and + (floatp quotient) + (floatp quo) + (< (abs (- (abs quotient) (abs quo))) + 0.00000000000001d0) + ) + ) + (or + (eql remainder rem) + (and + (floatp remainder) + (floatp rem) + (< (abs (- (abs remainder) (abs rem))) + 0.00000000000001d0) + ) + ) + (format t "(~A~{ ~A~}) => should be ~A; ~A not ~A; ~A~%" + function arguments quotient remainder quo rem + ) + ) +#+xedit (format t "(~A~{ ~A~}) => should be ~A; ~A not ~A; ~A~%" + function arguments quotient remainder quo rem + ) + ) + ) +) + +(defun bool-test (expect function &rest arguments &aux result (error t)) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + (if error + (format t "ERROR: (~A~{ ~A~})~%" function arguments) + (or (eq result expect) + (format t "(~A~{ ~A~}) => should be ~A not ~A~%" + function arguments expect result + ) + ) + ) +) + +(defun error-test (function &rest arguments &aux result (error t)) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil)) + (unless error + (format t "ERROR: no error for (~A~{ ~A}), result was ~A~%" + function arguments result))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixnum fixnum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 0 #'+) +(test 5 #'+ 5) +(test -2 #'+ -2) +(test 3 #'+ 2 1) +(test 134217728 #'+ 134217727 1) +(test -134217729 #'+ -134217728 -1) +(test 2147483648 #'+ 2147483647 1) +(test -2147483649 #'+ -2147483648 -1) +(test -5 #'- 5) +(test 6 #'- -6) +(test 1 #'- 2 1) +(test 134217728 #'- 134217727 -1) +(test -2147483649 #'- -2147483648 1) +(test 4294967295 #'- 2147483647 -2147483648) +(test 1 #'*) +(test 4 #'* 4) +(test -5 #'* -5) +(test 6 #'* 2 3) +(test 2147483648 #'* 65536 32768) +(test 2147418112 #'* 65536 32767) +(test 134217728 #'* 65536 2048) +(test -134217728 #'* 65536 -2048) +(test 1/3 #'/ 3) +(test -1/4 #'/ -4) +(test 1/3 #'/ 10 30) +(test -1/2 #'/ -5 10) +(test -4 #'/ 20 -5) +(test 431432412345/32 #'/ 431432412345 32) +(test -2147483647/2147483648 #'/ 2147483647 -2147483648) +(test -1 #'/ 2147483648 -2147483648) +(test 2147483648 #'/ -2147483648 -1) +(test -1/2147483648 #'/ 1 -2147483648) +(test 1 #'min 2 3 4 1 5) +(test 7 #'max 0 -2 7 6 3) +(test -2147483648 #'min -2147483648 2147483647) +(test 2147483647 #'max -2147483648 2147483647) +(bool-test t #'< 1 2) +(bool-test nil #'< 2 2) +(bool-test nil #'< 4 3) +(bool-test t #'< -2147483648 -1) +(bool-test t #'< -2147483648 2147483648) +(bool-test t #'<= 3 3) +(bool-test nil #'<= 3 2) +(bool-test t #'<= 3 7) +(bool-test t #'<= -2147483648 2147483648) +(bool-test t #'= 1 1) +(bool-test nil #'= 1 -1) +(bool-test t #'= -2147483648 -2147483648) +(bool-test t #'>= 4 3) +(bool-test t #'>= 5 5) +(bool-test nil #'>= 4 9) +(bool-test t #'>= 2147483647 -2147483648) +(bool-test t #'> 7 5) +(bool-test nil #'> 20 20) +(bool-test nil #'> 19 31) +(bool-test nil #'> 2147483647 2147483648) +(bool-test nil #'> -2147483648 2147483647) +(bool-test nil #'/= 2147483647 2147483647) +(bool-test t #'/= 2147483647 -2147483648) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixnum bignum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 4123412341238575768576858308380 #'+ + 431412 4123412341238575768576857876968) +(test -653653534554686349560628211 #'- + 4231423 653653534554686349564859634) +(test 17952112630025927929 #'* 4342423 4134123421423) +(test 412341/766687896595678 #'/ 412341 766687896595678) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixnum flonum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 566594.4123d0 #'+ 43141 523453.4123d0) +(test -2.106249523586876d9 #'+ -2147483647 41234123.413124d0) +(test -6530250.653d0 #'- 4314 6534564.653d0) +(test -358687.653d0 #'- -324123 34564.653d0) +(test 3.26338916904d67 #'* 431234 756756d56) +(test 5.731169192902366d-50 #'/ 3 5234534d43) +(bool-test t #'< 423421 646454d0) +(bool-test t #'= 43242113 43242113d0) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixnum fixratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 38654705646/17 #'+ 2147483647 2147483647/17) +(test -2146748499/17 #'+ 43244 -2147483647/17) +(test 17633127/4232 #'- 4321 653345/4232) +(test 28227714415090/4323 #'* 4312442 6545645/4323) +(test 639030/1441 #'* 42 15215/1441) +(test 924444112/547 #'/ 3432342 1641/808) +(bool-test t #'> 41342 42423/32) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixnum bigratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 134681902103055335/31231131234 #'+ 4312423 53453535353/31231131234) +(test 134681795195984629/31231131234 #'- 4312423 53453535353/31231131234) +(test 230514255287590319/31231131234 #'* 4312423 53453535353/31231131234) +(test 134681848649519982/53453535353 #'/ 4312423 53453535353/31231131234) +(bool-test t #'> 4312423 53453535353/31231131234) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bignum fixnum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 4123412341234124068 #'+ 4123412341234123412 656) +(test 2147483647 #'+ 2147483648 -1) +(test 2147483648 #'- 2147483647 -1) +(test 3245393337480 #'* 4242344232 765) +(test 1414114744/255 #'/ 4242344232 765) +(bool-test nil #'< 2147483648 1) +(bool-test t #'> 2147483648 -2147483648) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bignum flonum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 5.452523543454353d15 #'+ 5452523543454353 423d-6) +(test -3.41423d205 #'- 54235423452345424443423 341423d200) +(test 2.7061221650759596d89 #'* 413423412341231232 6.545643242d71) +(test 9.744908405310087d-29 #'/ 41341234214 4242342d32) +(bool-test t #'< 4314123412312341234123 4234242d46) +(bool-test nil #'> 42342342142142421412341242 423423.432423d51) +(bool-test t #'= 100000000000000000000 1d20) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bignum fixratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 3027180466416641662/7 #'+ 432454352345234523 1/7) +(test 4294967295/2 #'- 2147483648 1/2) +(test 14113747078041141/152263 #'* 42341241234123423 1/456789) +(test 475355357536664/19 #'* 43214123412424 11/19) +(test 143960192608 #'/ 4234123312 1/34) +(test 15032385536/5 #'/ 2147483648 5/7) +(bool-test nil #'< 4123412341234123 423424/23) +(bool-test nil #'= 2147483648 1/3) +(bool-test t #'> 2147483648 1/3) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bignum bigratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test -493153721444554600746963362777609/11404707804137 + #'+ -43241241241241234234 18178448448449/11404707804137) +(test 22573725350444837506376255369215081106984960/431241324242143434377 + #'- 52345923457394857234895 455/431241324242143434377) +(test 355905909219316970540364021939287762325439304380984344811607132990/14374707710807 + #'* 45523452345234790345923405723902389345782390 23454234524234523623623/43124123132421) +(test -853356237922877963618542794532291751029677352/21566206170617061706171 + #'/ 4131234123412342 -43132412341234123412342/413124123412312234123412312312) +(bool-test nil #'< 9482384762389461234892 463124869123897/43124123456678) +(bool-test t #'/= 4689123469123846123843 4123894623894612/211) +(bool-test t #'> 90437849234701234891203 4234123423/37) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; flonum fixnum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 4.3291328479d86 #'+ 43291328479d76 431243) +(test 4.123123123432d58 #'- 4123123123432d46 2147483647) +(test 4.1974800714094d109 #'* 970874791d96 43234) +(test -1.0004838618250252d55 #'/ -432423.432d56 4322143) +(bool-test nil #'< 4324932.342d5 4321421) +(bool-test t #'> 2147483648d0 2147483647) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; flonum bignum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 4.3124325345d62 #'+ 4312432.5345d56 431241234901234791023479023) +(test 4.123123443242d39 #'- 41231234.43242d32 -10947390284720389) +(test 9.81681448753991d48 #'* 42342.89d27 231840917980324712) +(test 6.837110051466236d49 #'/ -64832d57 -948236894126) +(bool-test nil #'< 7589079203d56 43214124124312) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; flonum flonum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 4.12685643412d7 #'+ 34442.3412d0 41234122d0) +(test -4.23432d84 #'- -45523453d56 423432d79) +(test 2.0000000000000004d0 #'* 1.4142135623730951d0 1.4142135623730951d0) +(test -1.414213562373095d0 #'/ -2d0 1.4142135623730951d0) +(test 0.7071067811865476d0 #'/ 1.4142135623730951d0 2d0) +(bool-test nil #'< 43124123d56 4231412d43) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; flonum fixratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 3.41412d61 #'+ 341412d56 3/652) +(test 4.312443d72 #'- 43124.43d68 42421/5678) +(test -4.32112300201218d73 #'* 4321123d67 -2147483648/2147483647) +(test 3.388443859138533d58 #'/ 432412d54 13744/1077) +(bool-test t #'> 423194237d43 4231412/23) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; flonum bigratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 4.378904431d62 #'+ 4378904.431d56 49230471923047129/32412341234126) +(test 0d0 #'- 1.7320508075688772d0 3900231685776981/2251799813685248) +(test 5.000000000000001d0 #'* 2.23606797749979d0 629397181890197/281474976710656) +(test 7.000000000000001d0 #'/ 2.6457513110645907d0 1125899906842624/2978851154656373) +(bool-test nil #'< 790412390412d45 1005712007432/10518078881) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixratio fixnum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 23502480199/57 #'+ 1/57 412324214) +(test -1608505/39 #'- 11/39 41244) +(test 241844976595/3121 #'* 45245/3121 5345231) +(test 4231/30211050 #'/ 4231/67890 445) +(bool-test nil #'< 43123/12 -3432) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixratio bignum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 290071443963580821646/4115 #'+ -14119/4115 70491237901234711) +(test 92654360215843653827434431256/1237 #'- 423412/1237 -74902473901247901234789012) +(test 139081825032265225396/111 #'* 13/777 74890213478912044444) +(test -22/19000187487170108051697772680759 #'/ -176/31 4903274190237447239147812304712) +(bool-test t #'< 7094123/312 423412429047) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixratio flonum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 3756.777956289953d0 #'+ 41290/11 3.141592653589793d0) +(test 3750.494770982774d0 #'- 41290/11 3.141592653589793d0) +(test 11792.396424247505d0 #'* 41290/11 3.141592653589793d0) +(test 1194.8195636844289d0 #'/ 41290/11 3.141592653589793d0) +(bool-test nil #'< 41290/11 3.141592653589793d0) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixratio fixratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test -2/2147483647 #'+ 2147483646/2147483647 -2147483648/2147483647) +(test 4611686015206162432/2305843005992468481 #'+ 2147483648/2147483646 2147483648/2147483647) +(test 114/91 #'+ 5/7 7/13) +(test 2 #'- 2147483646/2147483647 -2147483648/2147483647) +(test -6442450939/4611686009837453315 #'- 2147483646/2147483647 2147483647/2147483645) +(test 214/231 #'- 5/7 -7/33) +(test 183092240452/408559 #'* '432421/3217 423412/127) +(test 1057751/7345 #'* 34121/65 31/113) +(test -93866791/102381559 #'/ 143747/107 -956837/653) +(test 117/517 #'/ 13/33 47/27) +(bool-test nil #'< 5/3 7/9) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; fixratio bigratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 1211321073398067249731082729214954013/1099249926163926018396018404101914 + #'+ 23141/21 572903572390457239/52345234579234572304572304957234) +(test -1210401943424090457832980748892408320175/1099249926163926018396018404101914 + #'+ -23123441/21 572903572390457239/52345234579234572304572304957234) +(test -130565585970579643613431728982140/1297324236427391 + #'- 6/83 1573079349043128237436315709694/15630412487077) +(test 119377824848653/98027 #'* 4123/61 28954117111/1607) +(test -533081148/1126543487854337661125 #'/ 4132412/125 -9012347902834701289/129) +(bool-test nil #'< 4132412/125 -9012347902834701289/129) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bigratio fixnum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 48668779872364438/8438103123 #'+ 49032749012471920/8438103123 -43134) +(test 49396718152579402/8438103123 #'- 49032749012471920/8438103123 -43134) +(test -704992865301321265760/2812701041 #'* 49032749012471920/8438103123 -43134) +(test -24516374506235960/181984570053741 #'/ 49032749012471920/8438103123 -43134) +(bool-test t #'> 49032749012471920/8438103123 -43134) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bigratio bignum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 22765322736543569109219273030163417097453878379283263605274270/46382946123894712341 + #'+ 4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912) +(test -22765322736543569109219273030163417097453878379283263605274270/46382946123894712341 + #'- -4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912) +(test -2303047849571666696101160700266058250647016644840659232609643130849536/46382946123894712341 + #'* 4692318468912374612389461278/46382946123894712341 -490812348912346238794612389461238961238912) +(test 2346159234456187306194730639/11382661368271784554609636515081706202567704733454325607906496 + #'/ -4692318468912374612389461278/46382946123894712341 -490812348912346238794612389461238961238912) +(bool-test t #'< 4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bigratio flonum +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 63.2771680782255d0 #'+ 31.63858403911275d0 4452734852783697/140737488355328) +(test 0d0 #'+ -31.63858403911275d0 4452734852783697/140737488355328) +(test -1001.0000000000001d0 #'* -31.63858403911275d0 4452734852783697/140737488355328) +(test 1d0 #'/ -31.63858403911275d0 -4452734852783697/140737488355328) +(bool-test nil #'< -31.63858403911275d0 -4452734852783697/140737488355328) +(bool-test nil #'> -31.63858403911275d0 -4452734852783697/140737488355328) +(bool-test nil #'/= -31.63858403911275d0 -4452734852783697/140737488355328) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bigratio fixratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 0 #'+ 2147483648/2147483647 -2147483648/2147483647) +(test 3230093924913437/413416372043776 #'+ 45705840067699/8796093022208 123/47) +(test 4294967296/2147483647 #'- 2147483648/2147483647 -2147483648/2147483647) +(test 1066255041450269/413416372043776 #'- 45705840067699/8796093022208 123/47) +(test -5621818328326977/413416372043776 #'* -45705840067699/8796093022208 123/47) +(test -2148174483181853/1081919441731584 #'/ 45705840067699/8796093022208 -123/47) +(bool-test t #'> 45705840067699/8796093022208 123/47) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bigratio bigratio +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 2679495973598190955776211861634126560767052764822779809414184089582/140710542183009389719255843429922029722593 + #'+ 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) +(test 2679495973598190955776211861634126560767052765333892522296541398514/140710542183009389719255843429922029722593 + #'- 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) +(test -4866460021317766216371472892133283923086494176/140710542183009389719255843429922029722593 + #'* 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) +(test -1339747986799095477888105930817063280383526382539168082927681372024/127778178220589327233 + #'/ 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) +(bool-test t #'> 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; complex real +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test #c(2147483648 -1) #'+ #c(1 -1) 2147483647) +(test #c(2.147483648d9 -1) #'+ #c(2147483647 -1) 1d0) +(test #c(129642370237029633787/3 0.25d0) #'- #c(-11/3 0.25d0) -43214123412343211266) +(test #c(23470/21 4.333333333333334d0) #'* #c(2347/7 1.3d0) 10/3) +(test #c(134217728/11 67108864/11) #'* #c(65536 32768) 2048/11) +(test #c(1.3133333333333332d0 82304) #'/ #c(1.97d0 123456) 3/2) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; real complex +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test #c(80/7 7/13) #'+ 3/7 #c(11 7/13)) +(test #c(1.2345d47 -1) #'+ 12345d43 #c(-2147483648 -1)) +(test #c(-2147483649 2147483647) #'+ -2147483648 #c(-1 2147483647)) +(test #c(41/15 1.23456d68) #'- #c(7/5 1234.56d65) -4/3) +(test #c(-41/19 2147483648) #'* #c(41/19 -2147483648) -1) +(test #c(-88046829568/40802189293 2.147483649d41) #'* #c(41/19 -2147483648d32) -2147483648/2147483647) +(test #c(-5.0691244239631335d0 1.3911008563333336d16) + #'/ #c(-11/7 4312412654633334) 0.31d0) +(bool-test t #'= #c(1 0.0) 1) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; complex complex +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test #c(-16.0d0 -4.0d0) #'+ #c(-16.0d0 -4.0d0)) +(test #c(0d0 1d0) #'- #c(0d0 -1d0)) +(test #c(1d0 3d0) #'- #c(-1d0 -3d0)) +(test #c(-16.0d0 -4.0d0) #'* #c(-16.0d0 -4.0d0)) +(test #c(-0.058823529411764705d0 0.014705882352941176d0) #'/ #c(-16d0 -4d0)) +(test #c(1.94d0 301868863889/7) #'+ #c(3/5 5/7) #c(1.34d0 43124123412)) +(test #c(8641975242/7 -3.4596d0) #'- #c(1234567890 0.0004d0) #c(-12/7 3.46d0)) +(test #c(2944.315858312371d0 5.59002d13) #'* #c(-11/7 -1234d9) #c(-45.3d0 5/2147483647)) +(test #c(1.9635384272224412d-8 -0.33333333317811176d0) + #'/ #c(2147483647/3 -0.5d0) #c(128 2147483648.0d0)) +(test #c(8.154945137073864d11 2.621232365490813d12) + #'/ #c(-1.3d0 4312412654633) #c(3/2 7/15)) +(test #c(0.003674737027278924d0 -257.6948748113586d0) + #'/ #c(1.5d0 -432412) #c(1678 -567/31313)) +(bool-test t #'= #c(1 2d0) #c(1 2)) +(bool-test nil #'/= #c(1 2) #c(1d0 2d0)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; abs +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 2147483648 #'abs -2147483648) +(test 2147483647 #'abs -2147483647) +(test 2147483647 #'abs 2147483647) +(test 1 #'abs 1) +(test 5/7 #'abs -5/7) +(test 2147483648/2147483647 #'abs -2147483648/2147483647) +(test 3.12d0 #'abs -3.12d0) +(test 4312412341234124124123412 #'abs 4312412341234124124123412) +(test 4312412341234124124123412 #'abs -4312412341234124124123412) +(test 1.0 #'abs #c(1 0.0)) +(test 11.40175425099138d0 #'abs #c(-11 3d0)) +(test 4.47213595499958d0 #'abs #c(-4 -2)) +(test 1.0 #'abs #c(0.0 -1.0)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; sqrt +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 3.4641016151377544d0 #'sqrt 12) +(test #c(0 12) #'sqrt -144) +(test 6.429728792199102d18 #'sqrt 41341412341234123412490123470912347210) +(test 41341412341234123412490123470912347210 + #'sqrt 1709112374367945085349927261774254951456404621200206927501652414831594784100) +(test 46340.95001184158d0 #'sqrt 2147483648) +(test 0.7071067811865476d0 #'sqrt 0.5d0) +(test 0 #'sqrt 0) +(test 0d0 #'sqrt 0d0) +(test 111.1106106544285d0 #'sqrt 12345.5678d0) +(test #c(0 11.119982014373944d0) #'sqrt -123.654d0) +(test 3/8 #'sqrt 9/64) +(test #c(0 1.1832159566199232d0) #'sqrt -7/5) +(test 514.7536007118473d0 #'sqrt 821974900428408092/3102128401119) +(test 413412341293461238946192384612893/314212341412341246128361289 + #'sqrt 170909763933741276657131032282211169869649489782500833989461829449/98729395495825697643724477479624921705328808513741521) +;; check for overflow +(error-test #'sqrt 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; mod +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 5 #'mod 5 9) +(test 4 #'mod -5 9) +(test -4 #'mod 5 -9) +(test -5 #'mod -5 -9) +(test 2147483646 #'mod -2147483648 2147483647) +(test -1 #'mod -2147483648 -2147483647) +(test 1 #'mod 2147483648 2147483647) +(test 0 #'mod -170909763933741276657131032282211169869649489782500833989461829449 413412341293461238946192384612893) +(test -1709112374367945085349927261774254951415063208858972804089162291360682436890 + #'mod 41341412341234123412490123470912347210 -1709112374367945085349927261774254951456404621200206927501652414831594784100) +(test 9.666666666666666d0 #'mod -1/3 10d0) +(test -9.666666666666666d0 #'mod 1/3 -10d0) +(test -0.3333333333333333d0 #'mod -1/3 -10d0) +(test 0.3333333333333333d0 #'mod 1/3 10d0) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; rem +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 2 #'rem 11 3) +(test 2 #'rem 11 -3) +(test -2 #'rem -11 3) +(test -2 #'rem -11 -3) +(test -1 #'rem -2147483648 2147483647) +(test 0.1499999999999999d0 #'rem 1.35d0 1/5) +(test -0.1499999999999999d0 #'rem -1.35d0 1/5) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; gcd +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 11 #'gcd 33 11) +(test 7 #'gcd 91 -49) +(test 4 #'gcd -4) +(test 0 #'gcd) +(test 11 #'gcd 3333 -33 1002001) +(test 1 #'gcd -2147483648 2147483647) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; lcm +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 1 #'lcm) +(test 10 #'lcm 10) +(test 5 #'lcm -5) +(test 4611686016279904256 #'lcm -2147483648 2147483647) +(test 0 #'lcm 0 5) +(test 60 #'lcm 1 2 3 4 5 6) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; and +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test -1 #'logand) +(test 0 #'logand 1 2) +(test -2147483648 #'logand -2147483648 -1) +(test 2147483647 #'logand 2147483647 -1) +(test 2147479552 #'logand 8796093018112 2147483647) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; eqv +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test -1 #'logeqv) +(test -4 #'logeqv 1 2) +(test -2147483648 #'logeqv -2147483648 -1) +(test 2147483647 #'logeqv 2147483647 -1) +(test -8793945542656 #'logeqv 8796093018112 2147483647) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; or +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 0 #'logior) +(test 3 #'logior 1 2) +(test -1 #'logior -2147483648 -1) +(test -1 #'logior 2147483647 -1) +(test 8796093022207 #'logior 8796093018112 2147483647) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; xor +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test 0 #'logxor) +(test 3 #'logxor 1 2) +(test 2147483647 #'logxor -2147483648 -1) +(test -2147483648 #'logxor 2147483647 -1) +(test 8793945542655 #'logxor 8796093018112 2147483647) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; not +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test -1 #'lognot 0) +(test 0 #'lognot -1) +(test -2 #'lognot 1) +(test 1 #'lognot -2) +(test -3 #'lognot 2) +(test 2 #'lognot -3) +(test -2147483648 #'lognot 2147483647) +(test 2147483647 #'lognot -2147483648) +(test -8793945542656 #'lognot 8793945542655) +(test -8796093018113 #'lognot 8796093018112) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; floor +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(div-test 1 1/2 #'floor 3/2) +(div-test 1d0 1 #'ffloor 3 2) +(div-test -2 2147483646 #'floor -2147483648 2147483647) +(div-test 2147483648 0 #'floor -2147483648 -1) +(div-test 17179869184 0 #'floor 18446744073709551616 1073741824) +(div-test -17179869201 -1073741807 #'floor 18446744073709551616 -1073741823) +(div-test 2147483648 0d0 #'floor -2147483648 -1d0) +(div-test -2 2147483646/2147483647 #'floor -2147483648/2147483647) +(div-test 32768 32768/2147483647 #'floor 2147483648/2147483647 65535/2147483647) +(div-test -32769 -32767/2147483647 #'floor 2147483648/2147483647 -65535/2147483647) +(div-test -32769 32767/2147483647 #'floor -2147483648/2147483647 65535/2147483647) +(div-test 32768 -32768/2147483647 #'floor -2147483648/2147483647 -65535/2147483647) +(div-test 2 0.5d0 #'floor 3d0 1.25d0) +(div-test 2 1d0 #'floor 4d0 1.5d0) +(div-test -3 -0.5d0 #'floor 4d0 -1.5d0) +(div-test -3 0.5d0 #'floor -4d0 1.5d0) +(div-test 2 -1d0 #'floor -4d0 -1.5d0) +(div-test 1 2/91 #'floor 5/7 9/13) +(div-test -2 -61/91 #'floor 5/7 -9/13) +(div-test -2 61/91 #'floor -5/7 9/13) +(div-test 1 -2/91 #'floor -5/7 -9/13) +(div-test 1 0 #'floor 2147483648/2147483647 2147483648/2147483647) +(div-test -1 0 #'floor 2147483648/2147483647 -2147483648/2147483647) +(div-test -1 0 #'floor -2147483648/2147483647 2147483648/2147483647) +(div-test 1 0 #'floor -2147483648/2147483647 -2147483648/2147483647) +(div-test 9437 1416337955817765/144137437447079 + #'floor 16324116304212832041/144137437447079 12) +(div-test -9438 -313311293547183/144137437447079 + #'floor 16324116304212832041/144137437447079 -12) +(div-test -9438 313311293547183/144137437447079 + #'floor -16324116304212832041/144137437447079 12) +(div-test 9437 -1416337955817765/144137437447079 + #'floor -16324116304212832041/144137437447079 -12) +(div-test 8081 1138147903718848755797/4324123123412370 + #'floor 2147483648 1148972348912638496123/4324123123412370) +(div-test -8082 -1804074198964956721/720687187235395 + #'floor 2147483648 -1148972348912638496123/4324123123412370) +(div-test -8082 1804074198964956721/720687187235395 + #'floor -2147483648 1148972348912638496123/4324123123412370) +(div-test 8081 -1138147903718848755797/4324123123412370 + #'floor -2147483648 -1148972348912638496123/4324123123412370) +(div-test 0 1148972348912638496123/4324123123412370111 + #'floor 1148972348912638496123/4324123123412370111 2147483648) +(div-test -1 -9285982550494401861657948805/4324123123412370111 + #'floor 1148972348912638496123/4324123123412370111 -2147483648) +(div-test -1 9285982550494401861657948805/4324123123412370111 + #'floor -1148972348912638496123/4324123123412370111 2147483648) +(div-test 0 -1148972348912638496123/4324123123412370111 + #'floor -1148972348912638496123/4324123123412370111 -2147483648) +(div-test 0.0d0 1.0000000004656613d0 #'ffloor 2147483648/2147483647 2147483648d0) +(div-test -1.0d0 -2.147483647d9 #'ffloor 2147483648/2147483647 -2147483648d0) +(div-test -1.0d0 2.147483647d9 #'ffloor -2147483648/2147483647 2147483648d0) +(div-test 0.0d0 -1.0000000004656613d0 #'ffloor -2147483648/2147483647 -2147483648d0) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ceiling +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(div-test 2 -1/2 #'ceiling 3/2) +(div-test 2d0 -1 #'fceiling 3 2) +(div-test -1 -1 #'ceiling -2147483648 2147483647) +(div-test 2147483648 0 #'ceiling -2147483648 -1) +(div-test 17179869184 0 #'ceiling 18446744073709551616 1073741824) +(div-test -17179869200 16 #'ceiling 18446744073709551616 -1073741823) +(div-test 2147483648 0d0 #'ceiling -2147483648 -1d0) +(div-test -1 -1/2147483647 #'ceiling -2147483648/2147483647) +(div-test 32769 -32767/2147483647 #'ceiling 2147483648/2147483647 65535/2147483647) +(div-test -32768 32768/2147483647 #'ceiling 2147483648/2147483647 -65535/2147483647) +(div-test -32768 -32768/2147483647 #'ceiling -2147483648/2147483647 65535/2147483647) +(div-test 32769 32767/2147483647 #'ceiling -2147483648/2147483647 -65535/2147483647) +(div-test 3 -0.75d0 #'ceiling 3d0 1.25d0) +(div-test 3 -0.5d0 #'ceiling 4d0 1.5d0) +(div-test -2 1d0 #'ceiling 4d0 -1.5d0) +(div-test -2 -1d0 #'ceiling -4d0 1.5d0) +(div-test 3 0.5d0 #'ceiling -4d0 -1.5d0) +(div-test 2 -61/91 #'ceiling 5/7 9/13) +(div-test -1 2/91 #'ceiling 5/7 -9/13) +(div-test -1 -2/91 #'ceiling -5/7 9/13) +(div-test 2 61/91 #'ceiling -5/7 -9/13) +(div-test 1 0 #'ceiling 2147483648/2147483647 2147483648/2147483647) +(div-test -1 0 #'ceiling 2147483648/2147483647 -2147483648/2147483647) +(div-test -1 0 #'ceiling -2147483648/2147483647 2147483648/2147483647) +(div-test 1 0 #'ceiling -2147483648/2147483647 -2147483648/2147483647) +(div-test 9438 -313311293547183/144137437447079 + #'ceiling 16324116304212832041/144137437447079 12) +(div-test -9437 1416337955817765/144137437447079 + #'ceiling 16324116304212832041/144137437447079 -12) +(div-test -9437 -1416337955817765/144137437447079 + #'ceiling -16324116304212832041/144137437447079 12) +(div-test 9438 313311293547183/144137437447079 + #'ceiling -16324116304212832041/144137437447079 -12) +(div-test 8082 -1804074198964956721/720687187235395 + #'ceiling 2147483648 1148972348912638496123/4324123123412370) +(div-test -8081 1138147903718848755797/4324123123412370 + #'ceiling 2147483648 -1148972348912638496123/4324123123412370) +(div-test -8081 -1138147903718848755797/4324123123412370 + #'ceiling -2147483648 1148972348912638496123/4324123123412370) +(div-test 8082 1804074198964956721/720687187235395 + #'ceiling -2147483648 -1148972348912638496123/4324123123412370) +(div-test 1 -9285982550494401861657948805/4324123123412370111 + #'ceiling 1148972348912638496123/4324123123412370111 2147483648) +(div-test 0 1148972348912638496123/4324123123412370111 + #'ceiling 1148972348912638496123/4324123123412370111 -2147483648) +(div-test 0 -1148972348912638496123/4324123123412370111 + #'ceiling -1148972348912638496123/4324123123412370111 2147483648) +(div-test 1 9285982550494401861657948805/4324123123412370111 + #'ceiling -1148972348912638496123/4324123123412370111 -2147483648) +(div-test 1.0d0 -2.147483647d9 #'fceiling 2147483648/2147483647 2147483648d0) +(div-test 0d0 1.0000000004656613d0 #'fceiling 2147483648/2147483647 -2147483648d0) +(div-test 0d0 -1.0000000004656613d0 #'fceiling -2147483648/2147483647 2147483648d0) +(div-test 1d0 2.147483647d9 #'fceiling -2147483648/2147483647 -2147483648d0) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; truncate +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(div-test 1 1/2 #'truncate 3/2) +(div-test 1d0 1 #'ftruncate 3 2) +(div-test -1 -1 #'truncate -2147483648 2147483647) +(div-test 2147483648 0 #'truncate -2147483648 -1) +(div-test 17179869184 0 #'truncate 18446744073709551616 1073741824) +(div-test -17179869200 16 #'truncate 18446744073709551616 -1073741823) +(div-test 2147483648 0d0 #'truncate -2147483648 -1d0) +(div-test -1 -1/2147483647 #'truncate -2147483648/2147483647) +(div-test 32768 32768/2147483647 #'truncate 2147483648/2147483647 65535/2147483647) +(div-test -32768 32768/2147483647 #'truncate 2147483648/2147483647 -65535/2147483647) +(div-test -32768 -32768/2147483647 #'truncate -2147483648/2147483647 65535/2147483647) +(div-test 32768 -32768/2147483647 #'truncate -2147483648/2147483647 -65535/2147483647) +(div-test 2 0.5d0 #'truncate 3d0 1.25d0) +(div-test 2 1d0 #'truncate 4d0 1.5d0) +(div-test -2 1d0 #'truncate 4d0 -1.5d0) +(div-test -2 -1d0 #'truncate -4d0 1.5d0) +(div-test 2 -1d0 #'truncate -4d0 -1.5d0) +(div-test 1 2/91 #'truncate 5/7 9/13) +(div-test -1 2/91 #'truncate 5/7 -9/13) +(div-test -1 -2/91 #'truncate -5/7 9/13) +(div-test 1 -2/91 #'truncate -5/7 -9/13) +(div-test 1 0 #'truncate 2147483648/2147483647 2147483648/2147483647) +(div-test -1 0 #'truncate 2147483648/2147483647 -2147483648/2147483647) +(div-test -1 0 #'truncate -2147483648/2147483647 2147483648/2147483647) +(div-test 1 0 #'truncate -2147483648/2147483647 -2147483648/2147483647) +(div-test 9437 1416337955817765/144137437447079 + #'truncate 16324116304212832041/144137437447079 12) +(div-test -9437 1416337955817765/144137437447079 + #'truncate 16324116304212832041/144137437447079 -12) +(div-test -9437 -1416337955817765/144137437447079 + #'truncate -16324116304212832041/144137437447079 12) +(div-test 9437 -1416337955817765/144137437447079 + #'truncate -16324116304212832041/144137437447079 -12) +(div-test 8081 1138147903718848755797/4324123123412370 + #'truncate 2147483648 1148972348912638496123/4324123123412370) +(div-test -8081 1138147903718848755797/4324123123412370 + #'truncate 2147483648 -1148972348912638496123/4324123123412370) +(div-test -8081 -1138147903718848755797/4324123123412370 + #'truncate -2147483648 1148972348912638496123/4324123123412370) +(div-test 8081 -1138147903718848755797/4324123123412370 + #'truncate -2147483648 -1148972348912638496123/4324123123412370) +(div-test 0 1148972348912638496123/4324123123412370111 + #'truncate 1148972348912638496123/4324123123412370111 2147483648) +(div-test 0 1148972348912638496123/4324123123412370111 + #'truncate 1148972348912638496123/4324123123412370111 -2147483648) +(div-test 0 -1148972348912638496123/4324123123412370111 + #'truncate -1148972348912638496123/4324123123412370111 2147483648) +(div-test 0 -1148972348912638496123/4324123123412370111 + #'truncate -1148972348912638496123/4324123123412370111 -2147483648) +(div-test 0d0 1.0000000004656613d0 #'ftruncate 2147483648/2147483647 2147483648d0) +(div-test 0d0 1.0000000004656613d0 #'ftruncate 2147483648/2147483647 -2147483648d0) +(div-test 0d0 -1.0000000004656613d0 #'ftruncate -2147483648/2147483647 2147483648d0) +(div-test 0d0 -1.0000000004656613d0 #'ftruncate -2147483648/2147483647 -2147483648d0) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; round +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(div-test 2 -1/2 #'round 3/2) +(div-test 2d0 -1 #'fround 3 2) +(div-test -1 -1 #'round -2147483648 2147483647) +(div-test 2147483648 0 #'round -2147483648 -1) +(div-test 17179869184 0 #'round 18446744073709551616 1073741824) +(div-test -17179869200 16 #'round 18446744073709551616 -1073741823) +(div-test 2147483648 0d0 #'round -2147483648 -1d0) +(div-test -1 -1/2147483647 #'round -2147483648/2147483647) +(div-test 32769 -32767/2147483647 #'round 2147483648/2147483647 65535/2147483647) +(div-test -32769 -32767/2147483647 #'round 2147483648/2147483647 -65535/2147483647) +(div-test -32769 32767/2147483647 #'round -2147483648/2147483647 65535/2147483647) +(div-test 32769 32767/2147483647 #'round -2147483648/2147483647 -65535/2147483647) +(div-test 2 0.5d0 #'round 3d0 1.25d0) +(div-test 3 -0.5d0 #'round 4d0 1.5d0) +(div-test -3 -0.5d0 #'round 4d0 -1.5d0) +(div-test -3 0.5d0 #'round -4d0 1.5d0) +(div-test 3 0.5d0 #'round -4d0 -1.5d0) +(div-test 1 2/91 #'round 5/7 9/13) +(div-test -1 2/91 #'round 5/7 -9/13) +(div-test -1 -2/91 #'round -5/7 9/13) +(div-test 1 -2/91 #'round -5/7 -9/13) +(div-test 1 0 #'round 2147483648/2147483647 2147483648/2147483647) +(div-test -1 0 #'round 2147483648/2147483647 -2147483648/2147483647) +(div-test -1 0 #'round -2147483648/2147483647 2147483648/2147483647) +(div-test 1 0 #'round -2147483648/2147483647 -2147483648/2147483647) +(div-test 9438 -313311293547183/144137437447079 + #'round 16324116304212832041/144137437447079 12) +(div-test -9438 -313311293547183/144137437447079 + #'round 16324116304212832041/144137437447079 -12) +(div-test -9438 313311293547183/144137437447079 + #'round -16324116304212832041/144137437447079 12) +(div-test 9438 313311293547183/144137437447079 + #'round -16324116304212832041/144137437447079 -12) +(div-test 8082 -1804074198964956721/720687187235395 + #'round 2147483648 1148972348912638496123/4324123123412370) +(div-test -8082 -1804074198964956721/720687187235395 + #'round 2147483648 -1148972348912638496123/4324123123412370) +(div-test -8082 1804074198964956721/720687187235395 + #'round -2147483648 1148972348912638496123/4324123123412370) +(div-test 8082 1804074198964956721/720687187235395 + #'round -2147483648 -1148972348912638496123/4324123123412370) +(div-test 0 1148972348912638496123/4324123123412370111 + #'round 1148972348912638496123/4324123123412370111 2147483648) +(div-test 0 1148972348912638496123/4324123123412370111 + #'round 1148972348912638496123/4324123123412370111 -2147483648) +(div-test 0 -1148972348912638496123/4324123123412370111 + #'round -1148972348912638496123/4324123123412370111 2147483648) +(div-test 0 -1148972348912638496123/4324123123412370111 + #'round -1148972348912638496123/4324123123412370111 -2147483648) +(div-test 0d0 1.0000000004656613d0 #'fround 2147483648/2147483647 2147483648d0) +(div-test 0d0 1.0000000004656613d0 #'fround 2147483648/2147483647 -2147483648d0) +(div-test 0d0 -1.0000000004656613d0 #'fround -2147483648/2147483647 2147483648d0) +(div-test 0d0 -1.0000000004656613d0 #'fround -2147483648/2147483647 -2147483648d0) +(div-test 2 0.5d0 #'round 2.5d0) +(div-test -2 -0.5d0 #'round -2.5d0) +(div-test 5 0d0 #'round 2.5d0 0.5d0) +(div-test -5 0d0 #'round 2.5d0 -0.5d0) +(div-test -5 0d0 #'round 2.5d0 -0.5d0) +(div-test -5 0d0 #'round -2.5d0 0.5d0) +(div-test 5 0d0 #'round -2.5d0 -0.5d0) +(div-test 1 -2/7 #'round 5/7) +(div-test -1 2/7 #'round -5/7) +(div-test 2 -1/2 #'round 3/2) +(div-test -2 1/2 #'round -3/2) +(div-test 2 1 #'round 30/2 7) +(div-test -2 1 #'round 30/2 -7) +(div-test -2 -1 #'round -30/2 7) +(div-test 2 -1 #'round -30/2 -7) +(div-test 1073741824 -1/2 #'round 2147483647/2) +(div-test -1073741824 1/2 #'round -2147483647/2) +(div-test 1 -2147483645/2 #'round 2147483647/2 2147483646) +(div-test -1 -2147483645/2 #'round 2147483647/2 -2147483646) +(div-test -1 2147483645/2 #'round -2147483647/2 2147483646) +(div-test 1 -2147483645/2 #'round 2147483647/2 2147483646) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; misc +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(test #c(5 -5) #'conjugate #c(5 5)) +(test #c(5 5) #'conjugate #c(5 -5)) +(test #c(-5 -5) #'conjugate #c(-5 5)) +(test #c(-5 5) #'conjugate #c(-5 -5)) + +(test 1 #'denominator 10) +(test 3 #'denominator 10/3) +(test 3 #'denominator 1804074198964956721/3) +(test 4324123123412370111 #'denominator -1148972348912638496123/4324123123412370111) + +(bool-test nil #'evenp -1) +(bool-test t #'evenp -2147483648) +(bool-test t #'evenp -4294967296) +(bool-test nil #'evenp -4294967295) + +(test 0.5d0 #'float 1/2) +(test 10.0d0 #'float 10) +(test 4.978341823462786d22 #'float 49783418234627861238926) +(test 1.845867531346429d12 #'float 643827946123846123984/348794231) + +(bool-test t #'floatp 0.3d0) +(bool-test nil #'floatp 1/3) + +(test 0 #'imagpart 1) +(test -5 #'imagpart #c(1 -5)) + +(bool-test t #'integerp 12) +(bool-test nil #'integerp 1/2) +(bool-test nil #'integerp :test) +(bool-test nil #'integerp 0d0) +(bool-test t #'integerp 49783418234627861238926) + +(test 3 #'isqrt 12) +(test 46340 #'isqrt 2147483648) +(test 46340 #'isqrt 2147483647) +(test 25373764918 #'isqrt 643827946123846123984) + +(bool-test nil #'logtest 1 2) +(bool-test t #'logtest 1 3) +(bool-test t #'logtest 7 -1) + +(bool-test nil #'minusp 0) +(bool-test nil #'minusp 2147483648) +(bool-test t #'minusp -2147483648) +(bool-test t #'minusp -1/4) +(bool-test nil #'minusp 0.2d0) +(bool-test nil #'minusp 0d0) +(bool-test nil #'minusp 984723891462817946123897416) +(bool-test t #'minusp -1148972348912638496123/4324123123412370111) + +(bool-test t #'numberp #c(1 2)) +(bool-test t #'numberp -200) +(bool-test nil #'numberp :test) + +(test 10 #'numerator 10) +(test 10 #'numerator 10/3) +(test 1804074198964956721 #'numerator 1804074198964956721/3) +(test -1148972348912638496123 #'numerator -1148972348912638496123/4324123123412370111) + +(bool-test t #'oddp -1) +(bool-test nil #'oddp -2147483648) +(bool-test nil #'oddp -4294967296) +(bool-test t #'oddp -4294967295) + +(bool-test nil #'plusp 0) +(bool-test t #'plusp 2147483648) +(bool-test nil #'plusp -2147483648) +(bool-test nil #'plusp -1/4) +(bool-test t #'plusp 0.2d0) +(bool-test nil #'plusp 0d0) +(bool-test t #'plusp 984723891462817946123897416) +(bool-test nil #'plusp -1148972348912638496123/4324123123412370111) + +(test 1/4 #'rational 0.25d0) +(test 5/2 #'rational 2.5d0) +(test 1/8 #'rational 0.125d0) +(test -5/8 #'rational -0.625d0) +(test 524293/8 #'rational 65536.625d0) +(test 17179869181/8 #'rational 2147483647.625d0) + +(bool-test t #'rationalp -3) +(bool-test t #'rationalp 1/2) +(bool-test t #'rationalp 1/2412341242424122412) +(bool-test nil #'rationalp :test) +(bool-test nil #'rationalp 0d0) +(bool-test t #'rationalp 49783418234627861238926) + +(test -1 #'realpart #c(-1 0.5d0)) + +(test 1 #'signum 123/5) +(test 0d0 #'signum 0d0) +(test -1d0 #'signum -7.3d0) + +(bool-test nil #'zerop 1) +(bool-test nil #'zerop 1/4312412341234123412) +(bool-test nil #'zerop 0.000003d0) +(bool-test t #'zerop 0) +(bool-test t #'zerop 0d0) +(bool-test t #'zerop #c(0 0d0)) + +(bool-test t #'= 10 #c(10 0d0)) + Index: xc/programs/xedit/lisp/test/regex.lsp diff -u /dev/null xc/programs/xedit/lisp/test/regex.lsp:1.2 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/test/regex.lsp Tue Dec 10 23:44:28 2002 @@ -0,0 +1,440 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/test/regex.lsp,v 1.2 2002/12/11 04:44:28 paulo Exp $ +;; + +;; Basic regex tests. This file is only for xedit lisp and for it's regex +;; library. Note that the regex library used by xedit lisp is not mean't +;; to be fully compatible with most regexes, but to be as fast as possible. +;; This means that some patterns that looks basic may never be matched, +;; but it is expected that almost any pattern can be rewritten to be +;; matched, or in the worst case, it may be required to search in the +;; regions matched by a previous regex. + +(defun re-test (expect &rest arguments &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (apply #'re-exec arguments)) + (setq error nil))) + (if error + (format t "ERROR: (re-exec~{ ~S~}) => ~S~%" arguments error-value) + (or (equal result expect) + (format t "(re-exec~{ ~S~}) => should be ~S not ~S~%" + arguments expect result)))) + +;; errors only generated for regex compilation (or incorrect arguments) +(defun re-error (&rest arguments &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (apply #'re-comp arguments)) + (setq error nil))) + (or error + (format t "ERROR: no error for (re-comp~{ ~S~})" arguments))) + +(re-error "") +(re-error "a**") +(re-error "[a") +(re-error "a{") +(re-error "a(") +(re-error "a||b") +(re-error "|b|c") +(re-error "a|b|") + +(setq re (re-comp "abc")) +(re-test '((0 . 3)) re "abc") +(re-test '((0 . 3)) re "abc" :notbol t) +(re-test '((0 . 3)) re "abc" :noteol t) +(re-test '((0 . 3)) re "abc" :notbol t :noteol t) +(re-test '((14 . 17)) re "aaaaaaaaaaaaaaabc") +(re-test '((14 . 17)) re "aaaaaaaaaaaaaaabc" :start 12 :end 17) +(re-test '((30 . 33)) re "xxxxxxxxxxxxxxaaaaaaaaaaaaaaaaabcxx") +(re-test '((30 . 33)) re "xxxxxxxxxxxxxxaaaaaaaaaaaaaaaaabcxx" :start 28 :end 34) + +(setq re (re-comp "^abc")) +(re-test '((0 . 3)) re "abc") +(re-test :nomatch re "xabc") +(re-test '((1 . 4)) re "xabc" :start 1) +(re-test :nomatch re "xabc" :start 1 :notbol t) + +(setq re (re-comp "abc$")) +(re-test '((0 . 3)) re "abc") +(re-test :nomatch re "xabcx") +(re-test '((1 . 4)) re "xabcx" :end 4) +(re-test :nomatch re "xabc" :end 4 :noteol t) + +(setq re (re-comp "^abc$")) +(re-test '((0 . 3)) re "abc") +(re-test :nomatch re "xabcx") +(re-test '((1 . 4)) re "xabcx" :start 1 :end 4) +(re-test :nomatch re "xabcx" :start 1 :end 4 :notbol t) +(re-test :nomatch re "xabcx" :start 1 :end 4 :noteol t) +(re-test :nomatch re "xabcx" :start 1 :end 4 :notbol t :noteol t) +(re-test nil re "abc" :count 0) + +(setq re (re-comp "abc|bcd|cde")) +(re-test '((0 . 3)) re "abc") +(re-test '((1 . 4)) re "aabc") +(re-test '((3 . 6)) re "xxxbcdef") +(re-test '((8 . 11)) re "abdzzzcdabcde") +(re-test '((13 . 16)) re "xxxxabdecdabdcde") + +(setq re (re-comp "^abc|bcd$|cde")) +(re-test '((0 . 3)) re "abcde") +(re-test '((3 . 6)) re "xabcde") +(re-test '((1 . 4)) re "xabcde" :start 1) +(re-test '((3 . 6)) re "xabcde" :start 1 :notbol t) +(re-test '((2 . 5)) re "xabcd") +(re-test :nomatch re "xabcd" :noteol t) +(re-test nil re "xabcd" :count 0) +(re-test :nomatch re "abcdx" :notbol t) + +(setq re (re-comp "a?bc|ab?c|abc?")) +(re-test '((0 . 3)) re "abc") +(re-test :nomatch re "xxxb") +(re-test '((3 . 5)) re "xxxbc") +(re-test '((5 . 7)) re "sssssab") +(re-test '((0 . 3)) re "abcd") +(re-test '((1 . 4)) re "aabcdef") +(re-test '((1 . 3)) re "aabbccdef") ;; ab matches abc? + +(setq re (re-comp "a?bc")) +(re-test '((2 . 4)) re "acbcd") +(re-test '((2 . 5)) re "acabcd") + +(setq re (re-comp "ab?c")) +(re-test '((1 . 3)) re "xacc") +(re-test '((2 . 5)) re "xxabcc") + +(setq re (re-comp "abc?")) +(re-test '((1 . 3)) re "xababc") +(re-test '((2 . 5)) re "xxabccabc") + +(setq re (re-comp "a*bc|ab*c|abc*")) +(re-test '((0 . 9)) re "aaaaaaabc") +(re-test '((1 . 10)) re "xaaaaaaabc") +(re-test '((3 . 12)) re "xyzaaaaaaabc") +(re-test '((0 . 4)) re "abbc") +(re-test '((2 . 9)) re "xxabbbbbc") +(re-test '((0 . 12)) re "abcccccccccc") +(re-test '((0 . 12)) re "abccccccccccd") +(re-test '((16 . 29)) re "xxxxxxxaaaaaaaaaabbbbbbbbbbbccccccccccc") +(re-test '((11 . 13)) re "xxxbbbbbbbbbc") +(re-test '((8 . 10)) re "aaaaazbxacd") + +(setq re (re-comp "a*bc")) +(re-test '((2 . 4)) re "acbcd") +(re-test '((2 . 5)) re "acabcd") +(re-test '((2 . 8)) re "acaaaabcd") + +(setq re (re-comp "ab*c")) +(re-test '((1 . 3)) re "xacc") +(re-test '((2 . 5)) re "xxabcc") +(re-test '((3 . 8)) re "xxaabbbcc") + +(setq re (re-comp "abc*")) +(re-test '((1 . 3)) re "xababc") +(re-test '((2 . 5)) re "xxabcbabccc") +(re-test '((3 . 7)) re "axxabccabc") + +(setq re (re-comp "a+bc|ab+c|abc+")) +(re-test :nomatch re "xxxbc") +(re-test '((1 . 6)) re "xaaabc") +(re-test '((8 . 12)) re "zzzzaaaaabbc") +(re-test '((7 . 15)) re "zzzzaaaabbbbbbcccc") + +(setq re (re-comp "a.c")) +(re-test '((0 . 3)) re "abc") +(re-test '((1 . 4)) re "aaac") +(re-test :nomatch re "xac") +(re-test '((3 . 6)) re "xaxaac") +(re-test '((2 . 5)) re "xxabc") +(re-test '((3 . 6)) re "acxaxc") + +(setq re (re-comp "a*c")) +(re-test '((0 . 1)) re "c") +(re-test '((5 . 6)) re "xxxxxc") +(re-test '((8 . 9)) re "xxxxxxxxc") +(re-test '((7 . 8)) re "xxxxxxxcc") +(re-test '((0 . 2)) re "ac") +(re-test '((0 . 5)) re "aaaac") +(re-test '((1 . 3)) re "xac") +(re-test '((3 . 6)) re "xxxaac") +(re-test '((2 . 4)) re "xxac") +(re-test '((4 . 6)) re "xxxxac") + +(setq re (re-comp "a+c")) +(re-test '((2 . 5)) re "xxaac") +(re-test '((3 . 8)) re "xxxaaaac") +(re-test '((6 . 8)) re "xaaaabac") +(re-test :nomatch re "xxxc") +(re-test '((4 . 9)) re "xxxxaaaaccc") + +(setq re (re-comp "a{4}b")) +(re-test '((19 . 24)) re "xabxxaabxxxaaabxxxxaaaab") +(re-test '((4 . 9)) re "aaabaaaab") + +(setq re (re-comp "a{4,}b")) +(re-test '((3 . 8)) re "xxxaaaab") +(re-test '((8 . 25)) re "zaaabzzzaaaaaaaaaaaaaaaab") + +(setq re (re-comp "a{,4}b")) +(re-test '((0 . 1)) re "b") +(re-test '((8 . 9)) re "xxxxxxxxb") +(re-test '((6 . 11)) re "xaaaaaaaaab") +(re-test '((3 . 5)) re "xxxab") +(re-test '((6 . 10)) re "aaaaaxaaab") + +(setq re (re-comp "a{2,4}b")) +(re-test :nomatch re "xab") +(re-test '((1 . 4)) re "xaab") +(re-test '((1 . 5)) re "xaaab") +(re-test '((2 . 7)) re "xxaaaab") +(re-test '((4 . 9)) re "xxxaaaaab") + +(setq re (re-comp "foo(bar|baz)fee")) +(re-test '((9 . 18)) re "feebarbazfoobarfee") +(re-test '((9 . 18) (12 . 15)) re "feebarbazfoobarfee" :count 2) +(re-test '((13 . 22)) re "foofooobazfeefoobazfee") +(re-test '((13 . 22) (16 . 19)) re "foofooobazfeefoobazfee" :count 3) + +(setq re (re-comp "foo(bar|baz)fee" :nosub t)) +(re-test '((9 . 18)) re "feebarbazfoobarfee") +(re-test '((9 . 18)) re "feebarbazfoobarfee" :count 2) +(re-test '((13 . 22)) re "foofooobazfeefoobazfee") +(re-test '((13 . 22)) re "foofooobazfeefoobazfee" :count 3) + +(setq re (re-comp "f(oo|ee)ba[rz]")) +(re-test :nomatch re "barfoebaz") +(re-test '((3 . 9) (4 . 6)) re "bazfoobar" :count 2) +(re-test '((3 . 9) (4 . 6)) re "barfeebaz" :count 2) + +(setq re (re-comp "f(oo|ee)ba[rz]" :nosub t)) +(re-test :nomatch re "barfoebaz") +(re-test '((3 . 9)) re "bazfoobar" :count 2) +(re-test '((3 . 9)) re "barfeebaz" :count 2) + +(setq re (re-comp "\\<(int|char)\\>")) +(re-test '((15 . 18)) re "aint character int foo") +(re-test '((15 . 18) (15 . 18)) re "aint character int foo" :count 2) + +(setq re (re-comp "\\<(int|char)\\>" :nosub t)) +(re-test '((15 . 18)) re "aint character int foo" :count 2) + +(setq re (re-comp "foo.*bar")) +(re-test '((11 . 17)) re "barfoblaboofoobarfoobarfoobar") + +(setq re (re-comp "foo.+bar")) +(re-test :nomatch re "foobar") +(re-test '((6 . 13)) re "fobbarfooxbarfooybar") + +(setq re (re-comp "foo.?bar")) +(re-test '((1 . 7)) re "xfoobar") +(re-test :nomatch re "xxfooxxbar") +(re-test '((3 . 10)) re "yyyfootbar") + +(setq re (re-comp "a.*b.*c")) +(re-test '((0 . 3)) re "abc") +(re-test '((9 . 18)) re "xxxxxxxxxabbbbbbbccaaaaabbbc") + +(setq re (re-comp "a.+b.*c")) +(re-test :nomatch re "xxxabc") +(re-test '((2 . 7)) re "xxaxbbc") + +(setq re (re-comp "a.+b.?c")) +(re-test '((1 . 5)) re "xaabc") +(re-test '((2 . 7)) re "xxaabbc") + +(setq re (re-comp "(foo.*|bar)fee")) +(re-test '((3 . 9) (3 . 6)) re "barfoofee" :count 2) +(re-test '((0 . 9) (0 . 6)) re "foobarfee" :count 2) +(re-test '((4 . 10) (4 . 7)) re "xxfobarfee" :count 2) +(re-test '((3 . 17) (3 . 14)) re "barfooooooobarfee" :count 2) +(re-test '((4 . 10) (4 . 7)) re "xxfobarfeefoobar" :count 2) + +(setq re (re-comp "(foo.+|bar)fee")) +(re-test :nomatch re "barfoofee" :count 2) +(re-test '((3 . 10) (3 . 7)) re "barfooxfee" :count 2) + +(setq re (re-comp "(foo.?|bar)fee")) +(re-test :nomatch re "foobar" :count 2) +(re-test '((2 . 8) (2 . 5)) re "bafoofee" :count 2) +(re-test '((2 . 9) (2 . 6)) re "bafooofeebarfee" :count 4) +(re-test '((2 . 8) (2 . 5)) re "bafoofeebarfee" :count 2) +(re-test nil re "bafoofeebarfee" :count 0) +(re-test '((2 . 8)) re "bafoofeebarfee" :count 1) + +(setq re (re-comp "(a|b|c)\\1")) +(re-test '((0 . 2) (0 . 1)) re "aa" :count 2) + +(setq re (re-comp "(a|b|c)(a|b|c)\\1\\2")) +(re-test '((0 . 4) (0 . 1) (1 . 2)) re "acac" :count 5) +(re-test '((4 . 8) (4 . 5) (5 . 6)) re "xxxxacac" :count 4) +(re-test '((24 . 28) (24 . 25) (25 . 26)) re "xxacabacbcacbbacbcaaccabcaca" :count 3) +(re-test '((4 . 8) (4 . 5) (5 . 6)) re "xyabcccc" :count 3) +(re-test '((4 . 8) (4 . 5)) re "xyabcccc" :count 2) +(re-test '((4 . 8)) re "xyabcccc" :count 1) +(re-test nil re "xyabcccc" :count 0) + +(setq re (re-comp "(a*b)\\1")) +(re-test '((3 . 15) (3 . 9)) re "xxxaaaaabaaaaab" :count 2) +(re-test '((7 . 9) (7 . 8)) re "abaabaxbb" :count 2) + +(setq re (re-comp "(ab+c)\\1")) +(re-test '((3 . 13) (3 . 8)) re "xaaabbbcabbbc" :count 3) + +(setq re (re-comp "(ab?c)\\1")) +(re-test :nomatch re "abcac" :count 2) +(re-test '((4 . 8) (4 . 6)) re "acabacac" :count 2) +(re-test '((5 . 11) (5 . 8)) re "abcacabcabc" :count 2) +(re-test '((3 . 7) (3 . 5)) re "abcacac" :count 2) + +(setq re (re-comp "a(.*)b\\1")) +(re-test '((3 . 5) (4 . 4)) re "xxxab" :count 2) +(re-test '((4 . 12) (5 . 8)) re "xxxxazzzbzzz" :count 2) + +(setq re (re-comp "abc" :icase t)) +(re-test '((0 . 3)) re "AbC") + +(setq re (re-comp "[0-9][a-z]+" :icase t)) +(re-test '((3 . 10)) re "xxx0aaZxYT9") + +(setq re (re-comp "a.b" :icase t)) +(re-test '((10 . 13)) re "aaaaaaaaaaaxB") + +(setq re (re-comp "a.*z" :icase t)) +(re-test '((3 . 9)) re "xxxAaaaaZ") +(re-test '((2 . 6)) re "xxaaaZaaa") + +(setq re (re-comp "\\<(lambda|defun|defmacro)\\>" :icase t)) +(re-test '((5 . 11)) re " (lambda") +(re-test '((5 . 11) (5 . 11)) re " (lambda" :count 2) +(re-test :nomatch re "lamda defunn deffmacro") + +(setq re (re-comp "\\<(nil|t)\\>" :icase t)) +(re-test '((3 . 6)) re "it Nil") +(re-test '((3 . 6) (3 . 6)) re "it Nil" :count 6) +(re-test :nomatch re "nilo") + +(setq re (re-comp "\\<(begin|end)\\>" :icase t)) +(re-test '((21 . 24) (21 . 24)) re "beginning the ending EnD" :count 7) + +(setq re (re-comp "a.*" :newline t)) +(re-test '((0 . 1)) re "a +aaa") +(re-test '((3 . 4)) re "xyza +aa") + +(setq re (re-comp "a.+" :newline t)) +(re-test '((2 . 5)) re "a +aaa") +(re-test '((5 . 7)) re "xyza +aa") + +(setq re (re-comp "a.?" :newline t)) +(re-test '((0 . 1)) re "a +aaa") +(re-test '((3 . 4)) re "xyza +aa") + +(setq re (re-comp "a.*b.*c" :newline t)) +(re-test '((11 . 14)) re "xxaa +zyacb +abc") +(re-test '((6 . 9)) re "xxxab +abc +c") + +(setq re (re-comp "a.+b.*c" :newline t)) +(re-test '((6 . 10)) re "ab +bc +abbc") + +(setq re (re-comp "a.?b.*c" :newline t)) +(re-test '((4 . 8)) re "ab +cabbc +cc") + +(setq re (re-comp "^foo$" :newline t)) +(re-test '((11 . 14)) re "bar +foobar +foo") +(re-test '((0 . 3)) re "foo +bar +foo +bar") +(re-test '((8 . 11)) re "foo +bar +foo +bar" :notbol t) +(re-test '((8 . 11)) re "foo +bar +foo" :notbol t) +(re-test :nomatch re "foo +bar +foo" :notbol t :noteol t) + +(setq re (re-comp "^\\s*#\\s*(define|include)\\s+.+" :newline t)) +(re-test '((8 . 18)) re "#define +#include x") +(re-test '((8 . 18) (9 . 16)) re "#define +#include x" :count 2) + +(setq re (re-comp "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")) +(re-test '((3 . 259)) re "zzzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzzz") + +(setq re (re-comp "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~")) +(re-test '((13 . 333)) re "String here: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~/") + +(setq re (re-comp "(.*)\\D(\\d+)")) +(re-test '((0 . 6) (0 . 3) (4 . 6)) re "abcW12" :count 3) +(re-test '((0 . 6) (0 . 3)) re "abcW12" :count 2) +(re-test '((0 . 6)) re "abcW12" :count 1) +(re-test nil re "abcW12" :count 0) +(re-test '((0 . 6) (0 . 3) (4 . 6)) re "abcW12abcW12" :count 3) +(re-test '((0 . 6) (0 . 3) (4 . 6)) re "abcW12abcW12a" :count 3) + +(setq re (re-comp ".*\\d")) +(re-test '((0 . 2)) re "a1a1a1aaaaaaa") ; minimal match only + +(setq re (re-comp "(.*)\\d")) +(re-test '((0 . 2) (0 . 1)) re "a1a1a1aaaaaaa" :count 2); minimal match only + +(setq re (re-comp ".*(\\d)")) +(re-test '((0 . 2) (1 . 2)) re "a1a1a1aaaaaaa" :count 2); minimal match only + +;; XXX this very simple pattern was entering an infinite loop +;; actually, this pattern is not supported, just test if is not +;; crashing (not supported because it is not cheap to match variations +;; of the pattern) +(setq re (re-comp "(.*a)?")) +(re-test '((0 . 1)) re "aaaa") ; expected, minimal match +(re-test '((0 . 1) (0 . 1)) re "aaaa" :count 2) Index: xc/programs/xedit/lisp/test/stream.lsp diff -u /dev/null xc/programs/xedit/lisp/test/stream.lsp:1.4 --- /dev/null Thu Feb 27 12:35:02 2003 +++ xc/programs/xedit/lisp/test/stream.lsp Mon Dec 9 22:59:04 2002 @@ -0,0 +1,807 @@ +;; +;; Copyright (c) 2002 by The XFree86 Project, Inc. +;; +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. +;; +;; Except as contained in this notice, the name of the XFree86 Project shall +;; not be used in advertising or otherwise to promote the sale, use or other +;; dealings in this Software without prior written authorization from the +;; XFree86 Project. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/test/stream.lsp,v 1.4 2002/12/10 03:59:04 paulo Exp $ +;; + +;; most format tests from the cltl second edition samples + +;; basic io/format/pathname/stream tests + +(defun do-format-test (error-test expect arguments + &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (apply #'format nil arguments)) + (setq error nil) + ) + ) + (if error-test + (or error + (format t "ERROR: no error for (format nil~{ ~S~}), result was ~S~%" + arguments result)) + (if error + (format t "ERROR: (format nil~{ ~S~}) => ~S~%" arguments error-value) + (or (string= result expect) + (format t "(format nil~{ ~S~}) => should be ~S not ~S~%" + arguments expect result))) + ) +) + +(defun format-test (expect &rest arguments) + (do-format-test nil expect arguments)) + +(defun format-error (&rest arguments) + (do-format-test t nil arguments)) + + + +(defun compare-test (test expect function arguments + &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + ) + (if error + (format t "ERROR: (~S~{ ~S~}) => ~S~%" function arguments error-value) + (or (funcall test result expect) + (format t "(~S~{ ~S~}) => should be ~S not ~S~%" + function arguments expect result + ) + ) + ) +) + +(defun compare-eval (test expect form + &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (eval form)) + (setq error nil) + ) + ) + (if error + (format t "ERROR: ~S => ~S~%" form error-value) + (or (funcall test result expect) + (format t "~S => should be ~S not ~S~%" + form expect result + ) + ) + ) +) + +(defun error-test (function &rest arguments &aux result (error t)) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + (or error + (format t "ERROR: no error for (~S~{ ~S~}), result was ~S~%" + function arguments result) + ) +) + +(defun error-eval (form &aux result (error t)) + (ignore-errors + (setq result (eval form)) + (setq error nil) + ) + (or error + (format t "ERROR: no error for ~S, result was ~S~%" form result) + ) +) + +(defun eq-test (expect function &rest arguments) + (compare-test #'eq expect function arguments)) + +(defun eql-test (expect function &rest arguments) + (compare-test #'eql expect function arguments)) + +(defun equal-test (expect function &rest arguments) + (compare-test #'equal expect function arguments)) + +(defun equalp-test (expect function &rest arguments) + (compare-test #'equalp expect function arguments)) + +(defun eq-eval (expect form) + (compare-eval #'eq expect form)) + +(defun eql-eval (expect form) + (compare-eval #'eql expect form)) + +(defun equal-eval (expect form) + (compare-eval #'equal expect form)) + +(defun equalp-eval (expect form) + (compare-eval #'equalp expect form)) + +(defun bool-test (expect function &rest arguments + &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (apply function arguments)) + (setq error nil) + ) + ) + (if error + (format t "ERROR: (~S~{ ~S~}) => ~S~%" function arguments error-value) + (or (eq (null result) (null expect)) + (format t "(~S~{ ~S~}) => should be ~A not ~A~%" + function arguments expect result + ) + ) + ) +) + +(defun bool-eval (expect form &aux result (error t) unused error-value) + (multiple-value-setq + (unused error-value) + (ignore-errors + (setq result (eval form)) + (setq error nil) + ) + ) + (if error + (format t "ERROR: ~S => ~S~%" form error-value) + (or (eq (null result) (null expect)) + (format t "~S => should be ~A not ~A~%" + form expect result + ) + ) + ) +) + + +;; format - function + +;; ~c +(format-test "A" "~C" #\A) +(format-test " " "~C" #\Space) +(format-test "A" "~:C" #\A) +(format-test "Space" "~:C" #\Space) +(format-test "#\\A" "~@C" #\A) +(format-test "#\\Space" "~@C" #\Space) +(format-test " " "~A" #\Space) +(let ((*print-escape* t)) (format-test " " "~A" #\Space)) +(format-test "#\\Space" "~S" #\Space) +(let ((*print-escape* nil)) (format-test "#\\Space" "~S" #\Space)) + +;; ~% +(format-test " +" "~%") +(format-test " + + +" "~3%") + +;; ~& +(format-test "" "~&") +(format-test " +" "~2&") + +;; ~| +(format-test " " "~|") + +;; ~~ +(format-test "~~~" "~3~") + +;; radix +(format-test "1101" "~,,' ,4:B" 13) +(format-test "1 0001" "~,,' ,4:B" 17) +(format-test "1101 0000 0101" "~14,,' ,4:B" 3333) +(format-test "1 22" "~3,,,' ,2:R" 17) +(format-test "6|55|35" "~,,'|,2:D" #xFFFF) +(format-test "1,000,000" "~,,,3:D" 1000000) +(format-test "one hundred and twenty-three thousand, four hundred and fifty-six" + "~R" 123456) +(format-test "six hundred and fifty-four thousand, three hundred twenty-first" + "~:R" 654321) +(format-test "MCCXXXIV" "~@R" 1234) +(format-test "MCCXXXXVIIII" "~@:R" 1249) +(format-test "3039" "~X" 12345) +(format-test "30071" "~O" 12345) +(format-test "9IX" "~36R" 12345) +(format-test "11000000111001" "~B" 12345) +(format-test "The answer is 5." "The answer is ~D." 5) +(format-test "The answer is 5." "The answer is ~3D." 5) +(format-test "The answer is 005." "The answer is ~3,'0D." 5) +(format-test "1111 1010 1100 1110" "~,,' ,4:B" #xFACE) +(format-test "1 1100 1110" "~,,' ,4:B" #x1CE) +(format-test "1111 1010 1100 1110" "~19,,' ,4:B" #xFACE) +(format-test " 1 1100 1110" "~19,,' ,4:B" #x1CE) + +;; 6.37 and 6.38 are correct +#+xedit (format-test "6.38" "~4,2F" 6.375d0) +(format-test "10.0" "~,1F" 9.995d0) +;; 6.37E+2 and 6.38E+2 are correct +#+xedit (format-test " 6.38E+2" "~8,2E" 637.5) +(do* + ( + (n '(3.14159 -3.14159 100.0 1234.0 0.006) (cdr n)) + (r '(" 3.14| 31.42| 3.14|3.1416|3.14|3.14159" + " -3.14|-31.42| -3.14|-3.142|-3.14|-3.14159" + "100.00|******|100.00| 100.0|100.00|100.0" + "1234.00|******|??????|1234.0|1234.00|1234.0" + " 0.01| 0.06| 0.01| 0.006|0.01|0.006") (cdr r)) + (x (car n) (car n)) + ) + ((endp n)) + (format-test (car r) + "~6,2F|~6,2,1,'*F|~6,2,,'?F|~6F|~,2F|~F" x x x x x x) +) +(do* + ( + (n '(3.14159 -3.14159 1100.0 1.1e13 #+xedit 1.1e120) (cdr n)) + (r '(" 3.14E+0| 31.42$-01|+.003E+03| 3.14E+0" + " -3.14E+0|-31.42$-01|-.003E+03| -3.14E+0" + " 1.10E+3| 11.00$+02|+.001E+06| 1.10E+3" + "*********| 11.00$+12|+.001E+16| 1.10E+13" + #+xedit + "*********|??????????|%%%%%%%%%|1.10E+120") (cdr r)) + (x (car n) (car n)) + ) + ((endp n)) + (format-test (car r) + "~9,2,1,,'*E|~10,3,2,2,'?,,'$E|~9,3,2,-2,'%@E|~9,2E" x x x x) +) +(do + ( + (k -5 (1+ k)) + (r '("Scale factor -5: | 0.000003E+06|" + "Scale factor -4: | 0.000031E+05|" + "Scale factor -3: | 0.000314E+04|" + "Scale factor -2: | 0.003142E+03|" + "Scale factor -1: | 0.031416E+02|" + "Scale factor 0: | 0.314159E+01|" + "Scale factor 1: | 3.141590E+00|" + "Scale factor 2: | 31.41590E-01|" + "Scale factor 3: | 314.1590E-02|" + "Scale factor 4: | 3141.590E-03|" + "Scale factor 5: | 31415.90E-04|" + "Scale factor 6: | 314159.0E-05|" + "Scale factor 7: | 3141590.E-06|") (cdr r)) + ) + ((endp r)) + (format-test (car r) "Scale factor ~2D: | ~12,6,2,VE|" k k 3.14159) +) +(do* + ( + (n '(0.0314159 0.314159 3.14159 31.4159 314.159 3141.59 3.14E12 + #+xedit 3.14d120) (cdr n)) + (r '(" 3.14E-2|314.2$-04|0.314E-01| 3.14E-2" + " 0.31 |0.314 |0.314 | 0.31 " + " 3.1 | 3.14 | 3.14 | 3.1 " + " 31. | 31.4 | 31.4 | 31. " + " 3.14E+2| 314. | 314. | 3.14E+2" + " 3.14E+3|314.2$+01|0.314E+04| 3.14E+3" + "*********|314.0$+10|0.314E+13| 3.14E+12" + #+xedit "*********|?????????|%%%%%%%%%|3.14E+120") (cdr r)) + (x (car n) (car n)) + ) + ((endp n)) + (format-test (car r) "~9,2,1,,'*G|~9,3,2,3,'?,,'$G|~9,3,2,0,'%G|~9,2G" + x x x x) +) +(format-test " 1." "~4,0f" 0.5) +(format-test " 0." "~4,0f" 0.4) + +;; ~p +(setq n 3) +(format-test "3 items found.""~D item~:P found." n) +(format-test "three dogs are here." "~R dog~:[s are~; is~] here." n (= n 1)) +(format-test "three dogs are here." "~R dog~:*~[s are~; is~:;s are~] here." n) +(format-test "Here are three puppies.""Here ~[are~;is~:;are~] ~:*~R pupp~:@P." n) +(format-test "7 tries/1 win" "~D tr~:@P/~D win~:P" 7 1) +(format-test "1 try/0 wins" "~D tr~:@P/~D win~:P" 1 0) +(format-test "1 try/3 wins" "~D tr~:@P/~D win~:P" 1 3) + +;; ~t +(format-test " foo" "~8Tfoo") +#+xedit (format-test " foo" "~8,3Tfoo") +(format-test " foo" "~8,3@Tfoo") +(format-test " foo" "~1,3@Tfoo") + +;; ~* +(format-test "2" "~*~D" 1 2 3 4) +(format-test "4" "~3*~D" 1 2 3 4) +(format-test "2" "~3*~2:*~D" 1 2 3 4) +(format-test "4 3 2 1 2 3 4" "~3@*~D ~2@*~D ~1@*~D ~0@*~D ~D ~D ~D" 1 2 3 4) + +;; ~? +(format-test "<Foo 5> 7" "~? ~D" "<~A ~D>" '("Foo" 5) 7) +(format-test "<Foo 5> 7" "~? ~D" "<~A ~D>" '("Foo" 5 14) 7) +(format-test "<Foo 5> 7" "~@? ~D" "<~A ~D>" "Foo" 5 7) +(format-test "<Foo 5> 14" "~@? ~D" "<~A ~D>" "Foo" 5 14 7) + + +(format-error "~:[abc~:@(def~;ghi~:@(jkl~]mno~)" 1) +(format-error "~?ghi~)" "abc~@(def") + + +;; ~(...~) +(format-test "XIV xiv" "~@R ~(~@R~)" 14 14) +(format-test "Zero errors detected." "~@(~R~) error~:P detected." 0) +(format-test "One error detected." "~@(~R~) error~:P detected." 1) +(format-test "Twenty-three errors detected." "~@(~R~) error~:P detected." 23) + +;; ~[...~] +(format-test "Persian Cat" "~[Siamese~;Manx~;Persian~] Cat" 2) +(format-test " Cat" "~[Siamese~;Manx~;Persian~] Cat" 3) +(format-test "Siamese Cat" "~[Siamese~;Manx~;Persian~] Cat" 0) +(setq *print-level* nil *print-length* 5) +(format-test " print length = 5" + "~@[ print level = ~D~]~@[ print length = ~D~]" *print-level* *print-length*) +(setq foo "Items:~#[ none~; ~S~; ~S and ~S~:;~@{ ~#[~;and ~]~S~^,~}~].") +(format-test "Items: none." foo) +(format-test "Items: FOO." foo 'foo) +(format-test "Items: FOO and BAR." foo 'foo 'bar) +(format-test "Items: FOO, BAR, and BAZ." foo 'foo 'bar 'baz) +(format-test "Items: FOO, BAR, BAZ, and QUUX." foo 'foo 'bar 'baz 'quux) + +;; ~{...~} +(format-test "The winners are: FRED HARRY JILL." + "The winners are:~{ ~S~}." '(fred harry jill)) +(format-test "Pairs: <A,1> <B,2> <C,3>." "Pairs:~{ <~S,~S>~}." '(a 1 b 2 c 3)) +(format-test "Pairs: <A,1> <B,2> <C,3>." + "Pairs:~:{ <~S,~S>~}." '((a 1) (b 2) (c 3))) +(format-test "Pairs: <A,1> <B,2> <C,3>." + "Pairs:~:@{ <~S,~S>~}." '(a 1) '(b 2) '(c 3)) + +;; ~<...~> +(format-test "foo bar" "~10<foo~;bar~>") +(format-test " foo bar" "~10:<foo~;bar~>") +(format-test " foo bar " "~10:@<foo~;bar~>") +(format-test " foobar" "~10<foobar~>") +(format-test " foobar" "~10:<foobar~>") +(format-test "foobar " "~10@<foobar~>") +(format-test " foobar " "~10:@<foobar~>") + +;; ~^ +(setq donestr "Done.~^ ~D warning~:P.~^ ~D error~:P.") +(format-test "Done." donestr) +(format-test "Done. 3 warnings." donestr 3) +(format-test "Done. 1 warning. 5 errors." donestr 1 5) +(format-test "/HOT .../HAMBURGER/ICE .../FRENCH ..." + "~:{/~S~^ ...~}" '((hot dog) (hamburger) (ice cream) (french fries))) +(format-test "/HOT .../HAMBURGER .../ICE .../FRENCH" + "~:{/~S~:^ ...~}" '((hot dog) (hamburger) (ice cream) (french fries))) +(format-test "/HOT .../HAMBURGER" + "~:{/~S~:#^ ...~}" '((hot dog) (hamburger) (ice cream) (french fries))) +(setq tellstr "~@(~@[~R~]~^ ~A.~)") +(format-test "Twenty-three" tellstr 23) +(format-test " Losers." tellstr nil "losers") +(format-test "Twenty-three losers." tellstr 23 "losers") +(format-test " FOO" "~15<~S~;~^~S~;~^~S~>" 'foo) +(format-test "FOO BAR" "~15<~S~;~^~S~;~^~S~>" 'foo 'bar) +(format-test "FOO BAR BAZ" "~15<~S~;~^~S~;~^~S~>" 'foo 'bar 'baz) + + +;; make-pathname - function +(equal-test #P"/public/games/chess.db" + #'make-pathname :directory '(:absolute "public" "games") + :name "chess" :type "db") +(equal-test #P"/etc/passwd" #'list* #P"/etc/passwd") +(setq path (make-pathname :directory '(:absolute "public" "games") + :name "chess" :type "db")) +(eq-test path #'pathname path) +(eq-test nil #'pathname-host path) +(eq-test nil #'pathname-device path) +(equal-test '(:absolute "public" "games") #'pathname-directory path) +(equal-test "chess" #'pathname-name path) +(equal-test "db" #'pathname-type path) +(eq-test nil #'pathname-version path) +(equal-test #P"/tmp/foo.txt" #'make-pathname :defaults "/tmp/foo.txt") + +#+xedit (equal-test #P"/tmp/foo.txt" #'pathname "///tmp///foo.txt") +;; XXX changed to remove extra separators +;; (equal-test #P"///tmp///foo.txt" #'pathname "///tmp///foo.txt") + + +;; merge-pathnames - function +(equal-test #P"/tmp/foo.txt" #'merge-pathnames "/tmp/foo" "/tmp/foo.txt") +(equal-test #P"/tmp/foo.txt" #'merge-pathnames "foo" "/tmp/foo.txt") +(equal-test #P"/tmp/foo/bar.txt" #'merge-pathnames "foo/bar" "/tmp/foo.txt") + +;; namestring - function +(setq path (merge-pathnames "foo/bar" "/tmp/foo.txt")) +(equal-test "/tmp/foo/bar.txt" #'namestring path) +(equal-test "" #'host-namestring path) +(equal-test "/tmp/foo/" #'directory-namestring path) +(equal-test "bar.txt" #'file-namestring path) +(equal-test "/tmp/foo/bar.txt" #'enough-namestring path) +(equal-test "foo/bar.txt" #'enough-namestring path "/tmp/") +(equal-test "bar.txt" #'enough-namestring path "/tmp/foo/") +(equal-test "foo/bar.txt" #'enough-namestring path "/tmp/foo") + +;; parse-namestring - function +(equal-eval '(#P"foo" 3) '(multiple-value-list (parse-namestring "foo"))) +(equal-eval '(#P"foo" 0) '(multiple-value-list (parse-namestring #P"foo"))) + + + +;; read - function +(setq is (make-string-input-stream " foo ")) +(eq-test t #'streamp is) +(eq-test t #'input-stream-p is) +(eq-test nil #'output-stream-p is) +(eq-test 'foo #'read is) +(eq-test t #'close is) +(setq is (make-string-input-stream "xfooy" 1 4)) +(eq-test 'foo #'read is) +(eq-test t #'close is) +(setq is (make-string-input-stream "")) +(eq-test nil #'read is nil) +(eq-test 'end-of-string #'read is nil 'end-of-string) +(close is) +(error-test #'read is) +(error-test #'read is nil) +(error-test #'read is nil 'end-of-string) +(eq-test t #'streamp is) +(eq-test nil #'input-stream-p is) +(eq-test nil #'streamp "test") +(error-test #'input-stream-p "test") + +;; read-char - function +(setq is (make-string-input-stream "0123")) +(setq test nil) +(equal-eval '(#\0 #\1 #\2 #\3) + '(do ((c (read-char is) (read-char is nil 'the-end))) + ((not (characterp c)) test) + (setq test (append test (list c))))) +(close is) +(setq is (make-string-input-stream "abc")) +(eql-test #\a #'read-char is) +(eql-test #\b #'read-char is) +(eql-test #\c #'read-char is) +(error-test #'read-char is) +(eq-test nil #'read-char is nil) +(eq-test :end-of-string #'read-char is nil :end-of-string) +(eq-test t #'close is) + +;; read-char-no-hang - function +(setq is (make-string-input-stream "0123")) +(setq test nil) +(equal-eval '(#\0 #\1 #\2 #\3) + '(do ((c (read-char-no-hang is) (read-char-no-hang is nil 'the-end))) + ((not (characterp c)) test) + (setq test (append test (list c))))) +(close is) +(setq is (make-string-input-stream "abc")) +(eql-test #\a #'read-char-no-hang is) +(eql-test #\b #'read-char-no-hang is) +(eql-test #\c #'read-char-no-hang is) +(error-test #'read-char-no-hang is) +(eq-test nil #'read-char-no-hang is nil) +(eq-test :end-of-string #'read-char-no-hang is nil :end-of-string) +(eq-test t #'close is) +#+(and xedit unix) +(progn + ;; wait one second for input pooling every 0.1 seconds + (defun wait-for-cat () + (let ((time 0.0)) + (loop + (and (listen is) (return)) + (sleep 0.1) + (when (>= (incf time 0.1) 1.0) + (format t "Cat is sleeping~%") + (return))))) + (setq is (make-pipe "/bin/cat" :direction :io)) + (equal-test "dog" #'write-line "dog" is) + (wait-for-cat) + (eql-test #\d #'read-char-no-hang is) + (eql-test #\o #'read-char-no-hang is) + (eql-test #\g #'read-char-no-hang is) + (eql-test #\Newline #'read-char-no-hang is) + (eq-test nil #'read-char-no-hang is) + (eq-test nil #'read-char-no-hang is) + (equal-test "mouse" #'write-line "mouse" is) + (wait-for-cat) + (eql-test #\m #'read-char-no-hang is) + (eql-test #\o #'read-char-no-hang is) + (eql-test #\u #'read-char-no-hang is) + (eql-test #\s #'read-char-no-hang is) + (eql-test #\e #'read-char-no-hang is) + (eql-test #\Newline #'read-char-no-hang is) + (eq-test nil #'read-char-no-hang is) + (eq-test t #'close is) + (error-test #'read-char-no-hang is) + (error-test #'read-char-no-hang is nil) + (error-test #'read-char-no-hang is nil t) +) + +;; read-from-string - function +(equal-eval '(3 5) + '(multiple-value-list (read-from-string " 1 3 5" t nil :start 2))) +(equal-eval '((a b c) 7) + '(multiple-value-list (read-from-string "(a b c)"))) +(error-test #'read-from-string "") +(eq-test nil #'read-from-string "" nil) +(eq-test 'end-of-file #'read-from-string "" nil 'end-of-file) + +;; read-line - function +(setq is (make-string-input-stream "line 1 +line 2")) +(equal-eval '("line 1" nil) '(multiple-value-list (read-line is))) +(equal-eval '("line 2" t) '(multiple-value-list (read-line is))) +(error-test #'read-line is) +(equal-eval '(nil t) '(multiple-value-list (read-line is nil))) +(equal-eval '(end-of-string t) + '(multiple-value-list (read-line is nil 'end-of-string))) + + +;; write - function +;; XXX several write options still missing +(setq os (make-string-output-stream)) +(equal-test '(1 2 3 4) #'write '(1 2 3 4) :stream os) +(equal-test "(1 2 3 4)" #'get-output-stream-string os) +(eq-test t #'streamp os) +(eq-test t #'output-stream-p os) +(eq-test nil #'input-stream-p os) +(equal-test '(:foo :bar) #'write '(:foo :bar) :case :downcase :stream os) +(equal-test "(:foo :bar)" #'get-output-stream-string os) +(equal-test '(:foo :bar) #'write '(:foo :bar) :case :capitalize :stream os) +(equal-test "(:Foo :Bar)" #'get-output-stream-string os) +(equal-test '(:foo :bar) #'write '(:foo :bar) :case :upcase :stream os) +(equal-test "(:FOO :BAR)" #'get-output-stream-string os) +(equal-test '(foo bar baz) #'write '(foo bar baz) :length 2 :stream os) +(equal-test "(FOO BAR ...)" #'get-output-stream-string os) +(equal-test '(foo (bar) baz) #'write '(foo (bar) baz) :level 1 :stream os) +(equal-test "(FOO # BAZ)" #'get-output-stream-string os) +(setq circle '#1=(1 #1#)) +(eq-test circle #'write circle :circle t :stream os) +(equal-test "#1=(1 #1#)" #'get-output-stream-string os) +(eql-test #\Space #'write #\Space :stream os) +(equal-test "#\\Space" #'get-output-stream-string os) +(eql-test #\Space #'write #\Space :escape nil :stream os) +(equal-test " " #'get-output-stream-string os) +(eq-test t #'close os) +(eq-test nil #'output-stream-p os) +(error-test #'output-stream-p "test") +(error-test #'write 'foo :stream "bar") + +;; fresh-line - function +(setq os (make-string-output-stream)) +(equal-test "some text" #'write-string "some text" os) +(eq-test t #'fresh-line os) +(eq-test nil #'fresh-line os) +(equal-test "more text" #'write-string "more text" os) +(equal-test "some text +more text" #'get-output-stream-string os) +(equal-test nil #'fresh-line os) +(equal-test nil #'fresh-line os) +(equal-test "" #'get-output-stream-string os) +(close os) +(error-test #'fresh-line 1) + +;; prin1 - function +;; (prin1 object stream) == +;; (write object :stream stream :escape t) +(setq p-os (make-string-output-stream) w-os (make-string-output-stream)) +(dolist (object (list #\a 1 "string" 2.5d0 '(a . b) '(a b c) #P"foo" + *package* *standard-input* #c(1 2) #(1 2 3) + (make-hash-table))) + (eq-test object #'prin1 object p-os) + (eq-test object #'write object :stream w-os :escape t) + (equal-test (get-output-stream-string p-os) + #'get-output-stream-string w-os)) +(close p-os) +(close w-os) +(error-test #'prin1 1 1) + +;; princ - function +;; (princ object stream) == +;; (write object :stream stream :escape nil :readably nil) +;; XXX readably not yet implemented +(setq p-os (make-string-output-stream) w-os (make-string-output-stream)) +(dolist (object (list #\a 1 "string" 2.5d0 '(a . b) '(a b c) #P"foo" + *package* *standard-input* #c(1 2) #(1 2 3) + (make-hash-table))) + (eq-test object #'princ object p-os) + (eq-test object #'write object :stream w-os :escape nil) + (equal-test (get-output-stream-string p-os) + #'get-output-stream-string w-os)) +(close p-os) +(close w-os) +(error-test #'princ 1 1) + +;; print - function +;; (print object stream) == +;; (progn +;; (terpri stream) +;; (write object :stream stream :escape t) +;; (write-char #\Space stream)) +(setq p-os (make-string-output-stream) w-os (make-string-output-stream)) +(dolist (object (list #\a 1 "string" 2.5d0 '(a . b) '(a b c) #P"foo" + *package* *standard-input* #c(1 2) #(1 2 3) + (make-hash-table))) + (eq-test object #'print object p-os) + (progn + (eq-test nil #'terpri w-os) + (eq-test object #'write object :stream w-os :escape t) + (eql-test #\Space #'write-char #\Space w-os)) + (equal-test (get-output-stream-string p-os) + #'get-output-stream-string w-os)) +(close p-os) +(close w-os) +(error-test #'print 1 1) + +;; terpri - function +(setq os (make-string-output-stream)) +(equal-test "some text" #'write-string "some text" os) +(eq-test nil #'terpri os) +(eq-test nil #'terpri os) +(equal-test "more text" #'write-string "more text" os) +(equal-test "some text + +more text" #'get-output-stream-string os) +(equal-test nil #'terpri os) +(equal-test nil #'terpri os) +(equal-test " + +" #'get-output-stream-string os) +(close os) +(error-test #'terpri 1) + +;; write-char - function +(equal-eval "a b" + '(with-output-to-string (s) + (write-char #\a s) + (write-char #\Space s) + (write-char #\b s))) +(error-test #'write-char 1) + +;; write-line - function +(setq os (make-string-output-stream)) +(equal-test "text" #'write-line "text" os) +(equal-test "text +" #'get-output-stream-string os) +(eql-test #\< #'write-char #\< os) +(equal-test "text" #'write-line "text" os :start 1 :end 3) +(eql-test #\> #'write-char #\> os) +(equal-test "<ex +>" #'get-output-stream-string os) +(error-test #'write-line 1) +(close os) + +;; write-string - function +(setq os (make-string-output-stream)) +(equal-test "text" #'write-string "text" os) +(equal-test "text" #'get-output-stream-string os) +(eql-test #\< #'write-char #\< os) +(equal-test "text" #'write-string "text" os :start 1 :end 3) +(eql-test #\> #'write-char #\> os) +(equal-test "<ex>" #'get-output-stream-string os) +(error-test #'write-string #\a) +(close os) + + +;; open - function +(setq name #P"delete-me.text") +(bool-eval t '(setq file (open name :direction :output))) +(equal-test "some text" #'write-line "some text" file) +(close file) +(equal-test "delete-me.text" #'file-namestring (truename name)) +(setq file (open name :direction :output :if-exists :rename)) +(equal-test "other text" #'write-line "other text" file) +(close file) +(equal-test "delete-me.text" #'file-namestring (truename name)) +;; Clisp returns the pathname if the file exists +#+xedit (eq-test t #'delete-file name) +#+clisp (bool-test t #'delete-file name) +(setq backup + #+xedit "delete-me.text~" + #+clisp "delete-me.text%" + #+cmu "delete-me.text.BAK") +(bool-test t #'delete-file backup) +(eq-test nil #'delete-file name) +(eq-test nil #'directory name) +(eq-test nil #'directory backup) +;; test append +(with-open-file (s name :direction :output :if-exists :error) + (write-line "line 1" s)) +(with-open-file (s name :direction :output :if-exists :append) + (write-line "line 2" s)) +(with-open-file (s name :direction :input) + (equal-test "line 1" #'read-line s) + (equal-test "line 2" #'read-line s) + (eq-test 'eof #'read-line s nil 'eof) +) +(bool-test t #'delete-file name) +;; test overwrite +(with-open-file (s name :direction :output :if-exists :error) + (write-line "overwrite-me" s)) +(with-open-file (s name :direction :output :if-exists :overwrite) + (write-line "some-text" s)) +(with-open-file (s name :direction :input) + (equal-test "some-text" #'read-line s) + (eq-test 'eof #'read-line s nil 'eof)) +;; test check for file existence +(eq-test nil #'open name :direction :output :if-exists nil) +(error-test #'open name :direction :output :if-exists :error) +(bool-test t #'delete-file name) +;; test check for no file existence +(eq-test nil #'open name :direction :output :if-does-not-exist nil) +(error-test #'open name :direction :output :if-does-not-exist :error) +#+xedit ;; test io -- not sure if this is the expected behaviour +(progn + (with-open-file (s name :direction :io) + (write-line "foo" s) + (write-line "bar" s)) + (with-open-file (s name :direction :io :if-exists :append) + (equal-test "foo" #'read-line s) + (equal-test "bar" #'read-line s) + (eq-test 'eof #'read-line s nil 'eof) + (write-line "baz" s)) + (with-open-file (s name :direction :io :if-exists :append) + (equal-test "foo" #'read-line s) + (equal-test "bar" #'read-line s) + (equal-test "baz" #'read-line s) + (eq-test 'eof #'read-line s nil 'eof)) + (bool-test t #'delete-file name) +) + +;; delete-file - function +(eq-eval nil + '(with-open-file (s "delete-me.text" :direction :output :if-exists :error))) +(eq-test t #'pathnamep (setq p (probe-file "delete-me.text"))) +(bool-test t #'delete-file p) +(eq-test nil #'probe-file "delete-me.text") +(bool-eval t + '(with-open-file (s "delete-me.text" :direction :output :if-exists :error) + (delete-file s))) +(bool-test nil #'probe-file "delete-me.text") + +;; rename-file - function +(setq name "foo.bar") +(bool-eval t '(setq file (open name :direction :output :if-exists :error))) +(eq-test t #'close file) +(setq result (multiple-value-list (rename-file name "bar.foo"))) +(eql-test 3 #'length result) +(eq-test t #'pathnamep (first result)) +(eq-test t #'pathnamep (second result)) +(eq-test t #'pathnamep (third result)) +(equal-test (third result) #'truename "bar.foo") +(eq-test nil #'directory name) +(eq-test nil #'directory (second result)) +(equal-test (list (third result)) #'directory (third result)) +(error-test #'truename name) +(error-test #'truename (second result)) +(eq-test nil #'probe-file name) +(bool-test t #'probe-file (first result)) +(eq-test nil #'probe-file (second result)) +(bool-test t #'probe-file (third result)) +(bool-test t #'delete-file "bar.foo") +(eq-test nil #'delete-file (third result)) +(eq-test nil #'delete-file (second result)) Index: xc/programs/xedit/lisp/test/widgets.lsp diff -u xc/programs/xedit/lisp/test/widgets.lsp:1.2 xc/programs/xedit/lisp/test/widgets.lsp:1.3 --- xc/programs/xedit/lisp/test/widgets.lsp:1.2 Sat Sep 29 00:46:06 2001 +++ xc/programs/xedit/lisp/test/widgets.lsp Fri Nov 8 03:01:01 2002 @@ -27,7 +27,7 @@ ;; Author: Paulo César Pereira de Andrade ;; ;; -;; $XFree86: xc/programs/xedit/lisp/test/widgets.lsp,v 1.2 2001/09/29 04:46:06 paulo Exp $ +;; $XFree86: xc/programs/xedit/lisp/test/widgets.lsp,v 1.3 2002/11/08 08:01:01 paulo Exp $ ;; (require "xaw") (require "xt") Index: xc/programs/xev/xev.c diff -u xc/programs/xev/xev.c:1.5 xc/programs/xev/xev.c:1.7 --- xc/programs/xev/xev.c:1.5 Mon Jan 7 15:38:30 2002 +++ xc/programs/xev/xev.c Tue Dec 24 12:43:00 2002 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xev/xev.c,v 1.5 2002/01/07 20:38:30 dawes Exp $ */ +/* $XFree86: xc/programs/xev/xev.c,v 1.7 2002/12/24 17:43:00 tsi Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -103,7 +103,7 @@ if (nbytes < 0) nbytes = 0; if (nbytes > 256) nbytes = 256; str[nbytes] = '\0'; - printf (" XLookupString gives %d characters: \"%s\"\n", nbytes, str); + printf (" XLookupString gives %d bytes: \"%s\"\n", nbytes, str); } void @@ -638,7 +638,8 @@ } -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) void usage () __attribute__((__noreturn__)); #endif void Index: xc/programs/xf86dga/dga.c diff -u xc/programs/xf86dga/dga.c:3.19 xc/programs/xf86dga/dga.c:3.20 --- xc/programs/xf86dga/dga.c:3.19 Sat Oct 27 23:34:32 2001 +++ xc/programs/xf86dga/dga.c Fri May 31 14:46:11 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xf86dga/dga.c,v 3.19 2001/10/28 03:34:32 tsi Exp $ */ +/* $XFree86: xc/programs/xf86dga/dga.c,v 3.20 2002/05/31 18:46:11 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Intrinsic.h> @@ -139,7 +139,7 @@ } -#ifndef __EMX__ +#ifndef __UNIXOS2__ /* Give up root privs */ setuid(getuid()); #endif Index: xc/programs/xfd/Imakefile diff -u xc/programs/xfd/Imakefile:1.1.1.3 xc/programs/xfd/Imakefile:1.3 --- xc/programs/xfd/Imakefile:1.1.1.3 Tue Jan 16 17:49:28 2001 +++ xc/programs/xfd/Imakefile Mon Jul 22 21:45:41 2002 @@ -1,9 +1,25 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ - DEPLIBS = XawClientDepLibs XkbClientDepLibs -LOCAL_LIBRARIES = XawClientLibs XkbClientLibs + + + +XCOMM $XFree86: xc/programs/xfd/Imakefile,v 1.3 2002/07/23 01:45:41 tsi Exp $ + +#ifndef XFdUseRender +#define XFdUseRender BuildRenderLibrary +#endif + +#if XFdUseRender + XRENDERDEFS = -DXRENDER + XRENDERDEPS = XftClientDepLibs $(DEPXFTLIB) $(DEPXRENDERLIB) + XRENDERLIBS = XftClientLibs $(XRENDERLIB) -lm + XRENDERINCS = $(XFTINCLUDES) $(XRENDERINCLUDES) +#endif + DEPLIBS = $(XRENDERDEPS) XawClientDepLibs XkbClientDepLibs +LOCAL_LIBRARIES = $(XRENDERLIBS) XawClientLibs XkbClientLibs SRCS = xfd.c grid.c OBJS = xfd.o grid.o - DEFINES = XkbClientDefines + INCLUDES = $(XRENDERINCS) + DEFINES = $(XRENDERDEFS) XkbClientDefines ComplexProgramTarget(xfd) InstallAppDefaults(Xfd) Index: xc/programs/xfd/Xfd.ad diff -u xc/programs/xfd/Xfd.ad:1.1.1.2 xc/programs/xfd/Xfd.ad:1.3 --- xc/programs/xfd/Xfd.ad:1.1.1.2 Tue Jan 16 17:49:31 2001 +++ xc/programs/xfd/Xfd.ad Mon Jul 22 21:45:41 2002 @@ -1,12 +1,19 @@ ! $Xorg: Xfd.ad,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ + + + +! $XFree86: xc/programs/xfd/Xfd.ad,v 1.3 2002/07/23 01:45:41 tsi Exp $ + *internalBorderWidth: 0 *showGrip: false *grid.borderWidth: 0 *quit.Label: Quit -*prev.Label: Prev Page -*next.Label: Next Page +*prev.Label: Prev +*next.Label: Next +*prev16.Label: -16 +*next16.Label: +16 *select.Label: Select a character *metrics.Label: @@ -17,10 +24,14 @@ *quit.Translations: #override \ <Btn1Down>,<Btn1Up>: Quit() unset() +*next16.Translations: #override \ + <Btn1Down>,<Btn1Up>: Next16() unset() *next.Translations: #override \ <Btn1Down>,<Btn1Up>: Next() unset() *prev.Translations: #override \ <Btn1Down>,<Btn1Up>: Prev() unset() +*prev16.Translations: #override \ + <Btn1Down>,<Btn1Up>: Prev16() unset() *Translations: #override \n\ <Key>q: Quit()\n\ Index: xc/programs/xfd/grid.c diff -u xc/programs/xfd/grid.c:1.5 xc/programs/xfd/grid.c:1.9 --- xc/programs/xfd/grid.c:1.5 Fri Dec 14 15:01:31 2001 +++ xc/programs/xfd/grid.c Fri Jul 5 20:46:42 2002 @@ -26,7 +26,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xfd/grid.c,v 1.5 2001/12/14 20:01:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfd/grid.c,v 1.9 2002/07/06 00:46:42 keithp Exp $ */ #include <X11/IntrinsicP.h> @@ -77,10 +77,12 @@ Offset(cell_width), XtRImmediate, (XtPointer) 0 }, { XtNcellHeight, XtCCellHeight, XtRInt, sizeof(int), Offset(cell_height), XtRImmediate, (XtPointer) 0 }, - { XtNstartChar, XtCStartChar, XtRDimension, sizeof(Dimension), - Offset(start_char), XtRImmediate, (XtPointer) 0xffff }, + { XtNstartChar, XtCStartChar, XtRLong, sizeof(long), + Offset(start_char), XtRImmediate, (XtPointer) 0xffffffff }, +#ifndef XRENDER { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), Offset(foreground_pixel), XtRString, (XtPointer) XtDefaultForeground }, +#endif { XtNcenterChars, XtCCenterChars, XtRBoolean, sizeof(Boolean), Offset(center_chars), XtRImmediate, (XtPointer) FALSE }, { XtNboxChars, XtCBoxChars, XtRBoolean, sizeof(Boolean), @@ -93,6 +95,12 @@ Offset(internal_pad), XtRImmediate, (XtPointer) 4 }, { XtNgridWidth, XtCGridWidth, XtRInt, sizeof(int), Offset(grid_width), XtRImmediate, (XtPointer) 1 }, +#ifdef XRENDER + {XtNforeground, XtCForeground, XtRXftColor, sizeof(XftColor), + Offset(fg_color), XtRString, XtDefaultForeground}, + {XtNface, XtCFace, XtRXftFont, sizeof (XftFont *), + Offset (text_face), XtRString, 0}, +#endif }; #undef Offset @@ -147,32 +155,193 @@ WidgetClass fontgridWidgetClass = (WidgetClass) &fontgridClassRec; +long +GridFirstChar (Widget w) +{ + FontGridWidget fgw = (FontGridWidget) w; + XFontStruct *fs = fgw->fontgrid.text_font; +#ifdef XRENDER + XftFont *xft = fgw->fontgrid.text_face; + if (xft) + { + FcChar32 map[FC_CHARSET_MAP_SIZE]; + FcChar32 next; + FcChar32 first; + int i; + + first = FcCharSetFirstPage (xft->charset, map, &next); + for (i = 0; i < FC_CHARSET_MAP_SIZE; i++) + if (map[i]) + { + FcChar32 bits = map[i]; + first += i * 32; + while (!(bits & 0x1)) + { + bits >>= 1; + first++; + } + break; + } + return first; + } + else +#endif + if (fs) + { + return (fs->min_byte1 << 8) | (fs->min_char_or_byte2); + } + else + return 0; +} + +long +GridLastChar (Widget w) +{ + FontGridWidget fgw = (FontGridWidget) w; + XFontStruct *fs = fgw->fontgrid.text_font; +#ifdef XRENDER + XftFont *xft = fgw->fontgrid.text_face; + if (xft) + { + FcChar32 this, last, next; + FcChar32 map[FC_CHARSET_MAP_SIZE]; + int i; + last = FcCharSetFirstPage (xft->charset, map, &next); + while ((this = FcCharSetNextPage (xft->charset, map, &next)) != FC_CHARSET_DONE) + last = this; + last &= ~0xff; + for (i = FC_CHARSET_MAP_SIZE - 1; i >= 0; i--) + if (map[i]) + { + FcChar32 bits = map[i]; + last += i * 32 + 31; + while (!(bits & 0x80000000)) + { + last--; + bits <<= 1; + } + break; + } + return (long) last; + } + else +#endif + if (fs) + { + return (fs->max_byte1 << 8) | (fs->max_char_or_byte2); + } + else + return 0; +} + +/* + * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit + * character. If the character is in the column and exists, then return the + * appropriate metrics (note that fonts with common per-character metrics will + * return min_bounds). + */ + +#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ + (((cs)->rbearing|(cs)->lbearing| \ + (cs)->ascent|(cs)->descent) == 0)) + +#define CI_GET_CHAR_INFO_1D(fs,col,cs) \ +{ \ + cs = 0; \ + if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ + } \ + if (CI_NONEXISTCHAR(cs)) \ + cs = 0; \ + } \ +} + +/* + * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and + * column. This is used for fonts that have more than row zero. + */ +#define CI_GET_CHAR_INFO_2D(fs,row,col,cs) \ +{ \ + cs = 0; \ + if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ + col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[((row - fs->min_byte1) * \ + (fs->max_char_or_byte2 - \ + fs->min_char_or_byte2 + 1)) + \ + (col - fs->min_char_or_byte2)]; \ + } \ + if (CI_NONEXISTCHAR(cs)) \ + cs = 0; \ + } \ +} + +static Boolean +GridHasChar (Widget w, long ch) +{ + FontGridWidget fgw = (FontGridWidget) w; +#ifdef XRENDER + XftFont *xft = fgw->fontgrid.text_face; + if (xft) + { + return FcCharSetHasChar (xft->charset, (FcChar32) ch); + } + else +#endif + { + XFontStruct *fs = fgw->fontgrid.text_font; + XCharStruct *cs; + + if (!fs) + return False; + if (fs->max_byte1 == 0) + { + CI_GET_CHAR_INFO_1D (fs, ch, cs); + } + else + { + unsigned int r = (ch >> 8); + unsigned int c = (ch & 0xff); + CI_GET_CHAR_INFO_2D (fs, r, c, cs); + } + return cs != 0; + } +} + /* * public routines */ void -GetFontGridCellDimensions(Widget w, Dimension *startp, +GetFontGridCellDimensions(Widget w, long *startp, int *ncolsp, int *nrowsp) { FontGridWidget fgw = (FontGridWidget) w; - *startp = (long)fgw->fontgrid.start_char; + *startp = fgw->fontgrid.start_char; *ncolsp = fgw->fontgrid.cell_cols; *nrowsp = fgw->fontgrid.cell_rows; } void -GetPrevNextStates(Widget w, Bool *prevvalidp, Bool *nextvalidp) +GetPrevNextStates(Widget w, Bool *prevvalidp, Bool *nextvalidp, + Bool *prev16validp, Bool *next16validp) { FontGridWidget fgw = (FontGridWidget) w; - - XFontStruct *fs = fgw->fontgrid.text_font; - long minn = (long) ((fs->min_byte1 << 0) | fs->min_char_or_byte2); - long maxn = (long) ((fs->max_byte1 << 8) | fs->max_char_or_byte2); + long minn = (long) GridFirstChar (w); + long maxn = (long) GridLastChar (w); - *prevvalidp = ((long)fgw->fontgrid.start_char > minn); - *nextvalidp = (((long)fgw->fontgrid.start_char + + *prev16validp = (fgw->fontgrid.start_char - 0xf00 > minn); + *prevvalidp = (fgw->fontgrid.start_char > minn); + *nextvalidp = (fgw->fontgrid.start_char + + (fgw->fontgrid.cell_cols * fgw->fontgrid.cell_rows) + < maxn); + *next16validp =((fgw->fontgrid.start_char + 0xf00 + (fgw->fontgrid.cell_cols * fgw->fontgrid.cell_rows)) < maxn); } @@ -190,11 +359,15 @@ XtGCMask mask; XGCValues gcv; - mask = (GCForeground | GCBackground | GCFunction | GCFont); + mask = (GCForeground | GCBackground | GCFunction); gcv.foreground = fore; gcv.background = fgw->core.background_pixel; gcv.function = GXcopy; - gcv.font = fgw->fontgrid.text_font->fid; + if (fgw->fontgrid.text_font) + { + mask |= GCFont; + gcv.font = fgw->fontgrid.text_font->fid; + } gcv.cap_style = CapProjecting; mask |= GCCapStyle; if (fgw->fontgrid.grid_width > 0) { @@ -206,10 +379,196 @@ } +#ifdef XRENDER +XtConvertArgRec xftColorConvertArgs[] = { + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)}, + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), + sizeof(Colormap)} +}; + +#define donestr(type, value, tstr) \ + { \ + if (toVal->addr != NULL) { \ + if (toVal->size < sizeof(type)) { \ + toVal->size = sizeof(type); \ + XtDisplayStringConversionWarning(dpy, \ + (char*) fromVal->addr, tstr); \ + return False; \ + } \ + *(type*)(toVal->addr) = (value); \ + } \ + else { \ + static type static_val; \ + static_val = (value); \ + toVal->addr = (XPointer)&static_val; \ + } \ + toVal->size = sizeof(type); \ + return True; \ + } + +static void +XmuFreeXftColor (XtAppContext app, XrmValuePtr toVal, XtPointer closure, + XrmValuePtr args, Cardinal *num_args) +{ + Screen *screen; + Colormap colormap; + XftColor *color; + + if (*num_args != 2) + { + XtAppErrorMsg (app, + "freeXftColor", "wrongParameters", + "XtToolkitError", + "Freeing an XftColor requires screen and colormap arguments", + (String *) NULL, (Cardinal *)NULL); + return; + } + + screen = *((Screen **) args[0].addr); + colormap = *((Colormap *) args[1].addr); + color = (XftColor *) toVal->addr; + XftColorFree (DisplayOfScreen (screen), + DefaultVisual (DisplayOfScreen (screen), + XScreenNumberOfScreen (screen)), + colormap, color); +} + +static Boolean +XmuCvtStringToXftColor(Display *dpy, + XrmValue *args, Cardinal *num_args, + XrmValue *fromVal, XrmValue *toVal, + XtPointer *converter_data) +{ + char *spec; + XRenderColor renderColor; + XftColor xftColor; + Screen *screen; + Colormap colormap; + + if (*num_args != 2) + { + XtAppErrorMsg (XtDisplayToApplicationContext (dpy), + "cvtStringToXftColor", "wrongParameters", + "XtToolkitError", + "String to render color conversion needs screen and colormap arguments", + (String *) NULL, (Cardinal *)NULL); + return False; + } + + screen = *((Screen **) args[0].addr); + colormap = *((Colormap *) args[1].addr); + + spec = (char *) fromVal->addr; + if (strcasecmp (spec, XtDefaultForeground) == 0) + { + renderColor.red = 0; + renderColor.green = 0; + renderColor.blue = 0; + renderColor.alpha = 0xffff; + } + else if (strcasecmp (spec, XtDefaultBackground) == 0) + { + renderColor.red = 0xffff; + renderColor.green = 0xffff; + renderColor.blue = 0xffff; + renderColor.alpha = 0xffff; + } + else if (!XRenderParseColor (dpy, spec, &renderColor)) + return False; + if (!XftColorAllocValue (dpy, + DefaultVisual (dpy, + XScreenNumberOfScreen (screen)), + colormap, + &renderColor, + &xftColor)) + return False; + + donestr (XftColor, xftColor, XtRXftColor); +} + +static void +XmuFreeXftFont (XtAppContext app, XrmValuePtr toVal, XtPointer closure, + XrmValuePtr args, Cardinal *num_args) +{ + Screen *screen; + XftFont *font; + + if (*num_args != 1) + { + XtAppErrorMsg (app, + "freeXftFont", "wrongParameters", + "XtToolkitError", + "Freeing an XftFont requires screen argument", + (String *) NULL, (Cardinal *)NULL); + return; + } + + screen = *((Screen **) args[0].addr); + font = *((XftFont **) toVal->addr); + if (font) + XftFontClose (DisplayOfScreen (screen), font); +} + +static Boolean +XmuCvtStringToXftFont(Display *dpy, + XrmValue *args, Cardinal *num_args, + XrmValue *fromVal, XrmValue *toVal, + XtPointer *converter_data) +{ + char *name; + XftFont *font; + Screen *screen; + + if (*num_args != 1) + { + XtAppErrorMsg (XtDisplayToApplicationContext (dpy), + "cvtStringToXftFont", "wrongParameters", + "XtToolkitError", + "String to XftFont conversion needs screen argument", + (String *) NULL, (Cardinal *)NULL); + return False; + } + + screen = *((Screen **) args[0].addr); + name = (char *) fromVal->addr; + + font = 0; + if (name) + { + font = XftFontOpenName (dpy, + XScreenNumberOfScreen (screen), + name); + if (!font) + { + XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRXftFont); + return False; + } + } + donestr (XftFont *, font, XtRXftFont); +} + +static XtConvertArgRec xftFontConvertArgs[] = { + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)}, +}; + +#endif + static void ClassInitialize(void) { XtAddConverter (XtRString, XtRLong, XmuCvtStringToLong, NULL, 0); +#ifdef XRENDER + XtSetTypeConverter (XtRString, XtRXftColor, + XmuCvtStringToXftColor, + xftColorConvertArgs, XtNumber(xftColorConvertArgs), + XtCacheByDisplay, XmuFreeXftColor); + XtSetTypeConverter (XtRString, XtRXftFont, + XmuCvtStringToXftFont, + xftFontConvertArgs, XtNumber(xftFontConvertArgs), + XtCacheByDisplay, XmuFreeXftFont); +#endif } @@ -219,12 +578,20 @@ FontGridWidget reqfg = (FontGridWidget) request; FontGridWidget newfg = (FontGridWidget) new; XFontStruct *fs = newfg->fontgrid.text_font; +#ifdef XRENDER + XftFont *xft = newfg->fontgrid.text_face; +#endif unsigned maxn; if (reqfg->fontgrid.cell_cols <= 0) newfg->fontgrid.cell_cols = 16; if (reqfg->fontgrid.cell_rows <= 0) { +#ifdef XRENDER + if (xft) + newfg->fontgrid.cell_rows = 16; + else +#endif if (fs && fs->max_byte1 == 0) { newfg->fontgrid.cell_rows = (fs->max_char_or_byte2 / newfg->fontgrid.cell_cols) + 1; @@ -235,9 +602,9 @@ } if (reqfg->fontgrid.cell_width <= 0) - newfg->fontgrid.cell_width = (fs ? DefaultCellWidth (newfg) : 1); + newfg->fontgrid.cell_width = DefaultCellWidth (newfg); if (reqfg->fontgrid.cell_height <= 0) - newfg->fontgrid.cell_height = (fs ? DefaultCellHeight (newfg) : 1); + newfg->fontgrid.cell_height = DefaultCellHeight (newfg); /* give a nice size that fits one screen full */ if (newfg->core.width == 0) @@ -256,16 +623,13 @@ * select the first character */ - if (newfg->fontgrid.start_char == 0xffff) { - newfg->fontgrid.start_char = (fs ? (unsigned)(fs->min_byte1 << 8) : 0); - } - if (fs) { - maxn = ((fs->max_byte1 << 8) | fs->max_char_or_byte2); - if (newfg->fontgrid.start_char > maxn) - newfg->fontgrid.start_char = (maxn + 1 - - (newfg->fontgrid.cell_cols * - newfg->fontgrid.cell_rows)); - } + if (newfg->fontgrid.start_char == 0xffffffff) + newfg->fontgrid.start_char = GridFirstChar(new) & ~0xff; + maxn = GridLastChar (new); + if (newfg->fontgrid.start_char > maxn) + newfg->fontgrid.start_char = (maxn + 1 - + (newfg->fontgrid.cell_cols * + newfg->fontgrid.cell_rows)); } static void @@ -274,11 +638,17 @@ FontGridWidget fgw = (FontGridWidget) gw; FontGridPart *p = &fgw->fontgrid; - p->text_gc = get_gc (fgw, p->foreground_pixel); + p->text_gc = get_gc (fgw, GridForeground (fgw)); p->box_gc = get_gc (fgw, p->box_pixel); Resize (gw); (*(XtSuperclass(gw)->core_class.realize)) (gw, valueMask, attributes); +#ifdef XRENDER + p->draw = XftDrawCreate (XtDisplay (gw), XtWindow (gw), + DefaultVisual (XtDisplay (gw), + DefaultScreen(XtDisplay (gw))), + fgw->core.colormap); +#endif return; } @@ -323,6 +693,9 @@ int left, right, top, bottom; /* which cells were damaged */ int cw, ch; /* cell size */ +#ifdef XRENDER + if (!fgw->fontgrid.text_face) +#endif if (!fgw->fontgrid.text_font) { Bell (gw, XkbBI_BadValue); return; @@ -357,8 +730,7 @@ int tcols = p->cell_cols; int trows = p->cell_rows; int x1, y1, x2, y2, x, y; - unsigned maxn = ((p->text_font->max_byte1 << 8) | - p->text_font->max_char_or_byte2); + unsigned maxn = GridLastChar ((Widget) fgw); unsigned n, prevn; int startx; @@ -388,8 +760,6 @@ XDrawLine (dpy, wind, p->box_gc, x1, y, x2, y); } } - - /* * Draw a character in every box; treat all fonts as if they were 16bit * fonts. Store the high eight bits in byte1 and the low eight bits in @@ -398,15 +768,45 @@ prevn = p->start_char + col + row * tcols; startx = col * cw + p->internal_pad + p->grid_width; for (j = 0, - y = row * ch + p->internal_pad + p->grid_width + p->text_font->ascent; + y = row * ch + p->internal_pad + p->grid_width + GridFontAscent (fgw); j < nrows; j++, y += ch) { n = prevn; for (i = 0, x = startx; i < ncols; i++, x += cw) { - XChar2b thechar; int xoff = p->xoff, yoff = p->yoff; - if (n > maxn) goto done; /* no break out of nested */ +#ifdef XRENDER + if (fgw->fontgrid.text_face) + { + XftFont *xft = p->text_face; + FcChar32 c = n; + XGlyphInfo extents; + XftTextExtents32 (dpy, xft, &c, 1, &extents); + if (p->center_chars) + { + xoff = (p->cell_width - extents.width) / 2 - extents.x; + yoff = (p->cell_height - extents.height) / 2 - extents.y; + } + if (extents.width && extents.height) + { + XClearArea (dpy, wind, x + xoff - extents.x, + y + yoff - extents.y, + extents.width, extents.height, False); + if (p->box_chars) + XDrawRectangle (dpy, wind, p->box_gc, + x + xoff - extents.x, + y + yoff - extents.y, + extents.width - 1, + extents.height - 1); + } + XftDrawString32 (p->draw, &p->fg_color, xft, + x + xoff, y + yoff, &c, 1); + } + else +#endif + { + XChar2b thechar; + thechar.byte1 = (n >> 8); /* high eight bits */ thechar.byte2 = (n & 255); /* low eight bits */ if (p->box_chars || p->center_chars) { @@ -440,15 +840,46 @@ } XDrawString16 (dpy, wind, p->text_gc, x + xoff, y + yoff, &thechar, 1); + } n++; } prevn += tcols; } done: + /* + * paint the grid lines for the indicated rows + */ + if (p->grid_width > 0) { + int half_grid_width = p->grid_width >> 1; + x1 = col * cw + half_grid_width; + y1 = row * ch + half_grid_width; + x2 = x1 + ncols * cw; + y2 = y1 + nrows * ch; + for (i = 0, x = x1; i <= ncols; i++, x += cw) { + XDrawLine (dpy, wind, p->box_gc, x, y1, x, y2); + } + for (i = 0, y = y1; i <= nrows; i++, y += ch) { + XDrawLine (dpy, wind, p->box_gc, x1, y, x2, y); + } + } + + return; } +static Boolean +PageBlank (Widget w, long first, long last) +{ + while (first <= last) + { + if (GridHasChar (w, first)) + return False; + first++; + } + return True; +} + /*ARGSUSED*/ static Boolean SetValues(Widget current, Widget request, Widget new, @@ -465,10 +896,9 @@ redisplay = TRUE; } - if (curfg->fontgrid.foreground_pixel != newfg->fontgrid.foreground_pixel) { + if (GridForeground(curfg) != GridForeground (newfg)) { XtReleaseGC (new, curfg->fontgrid.text_gc); - newfg->fontgrid.text_gc = get_gc (newfg, - newfg->fontgrid.foreground_pixel); + newfg->fontgrid.text_gc = get_gc (newfg, GridForeground (newfg)); redisplay = TRUE; } @@ -483,14 +913,29 @@ redisplay = TRUE; if (curfg->fontgrid.start_char != newfg->fontgrid.start_char) { - XFontStruct *fs = newfg->fontgrid.text_font; - unsigned maxn = ((fs->max_byte1 << 8) | fs->max_char_or_byte2); - - if (newfg->fontgrid.start_char > maxn) - newfg->fontgrid.start_char = (maxn + 1 - - (newfg->fontgrid.cell_cols * - newfg->fontgrid.cell_rows)); + long maxn = GridLastChar (new); + long page = newfg->fontgrid.cell_cols * newfg->fontgrid.cell_rows; + long dir = page; + long start = newfg->fontgrid.start_char; + + if (start < curfg->fontgrid.start_char) + dir = -page; + + if (start < 0) + start = 0; + if (start > maxn) + start = (maxn / page) * page; + + while (PageBlank (new, start, start + page - 1)) + { + long next = start + dir; + + if (next < 0 || maxn < next) + break; + start = next; + } + newfg->fontgrid.start_char = start; redisplay = (curfg->fontgrid.start_char != newfg->fontgrid.start_char); } @@ -546,8 +991,10 @@ ((y / ch) * fgw->fontgrid.cell_cols) + (x / cw)); rec.thefont = fgw->fontgrid.text_font; - rec.thechar.byte1 = (n >> 8); - rec.thechar.byte2 = (n & 255); +#ifdef XRENDER + rec.theface = fgw->fontgrid.text_face; +#endif + rec.thechar = n; } XtCallCallbacks (gw, XtNcallback, (XtPointer) &rec); Index: xc/programs/xfd/grid.h diff -u xc/programs/xfd/grid.h:1.2 xc/programs/xfd/grid.h:1.4 --- xc/programs/xfd/grid.h:1.2 Fri Dec 14 15:01:31 2001 +++ xc/programs/xfd/grid.h Mon Jul 22 21:45:41 2002 @@ -26,10 +26,16 @@ from The Open Group. */ +/* $XFree86: xc/programs/xfd/grid.h,v 1.4 2002/07/23 01:45:41 tsi Exp $ */ #ifndef _FontGrid_h_ #define _FontGrid_h_ +#ifdef XRENDER +#include <X11/Xft/Xft.h> +#include <X11/extensions/Xrender.h> +#endif + typedef struct _FontGridRec *FontGridWidget; extern WidgetClass fontgridWidgetClass; @@ -60,15 +66,24 @@ #define XtNgridWidth "gridWidth" #define XtCGridWidth "GridWidth" +#define XtRXftColor "XftColor" + +#define XtNface "face" +#define XtCFace "Face" +#define XtRXftFont "XftFont" + typedef struct _FontGridCharRec { +#ifdef XRENDER + XftFont * theface; +#endif XFontStruct * thefont; - XChar2b thechar; + long thechar; } FontGridCharRec; extern void GetFontGridCellDimensions( #if NeedFunctionPrototypes Widget, - Dimension *, + long *, int *, int * #endif @@ -78,8 +93,17 @@ #if NeedFunctionPrototypes Widget, Bool *, + Bool *, + Bool *, Bool * #endif ); +long +GridFirstChar (Widget w); + +long +GridLastChar (Widget w); + + #endif /* _FontGrid_h_ */ Index: xc/programs/xfd/gridP.h diff -u xc/programs/xfd/gridP.h:1.2 xc/programs/xfd/gridP.h:1.4 --- xc/programs/xfd/gridP.h:1.2 Fri Dec 14 15:01:31 2001 +++ xc/programs/xfd/gridP.h Mon Jul 22 21:45:41 2002 @@ -26,8 +26,8 @@ from The Open Group. */ +/* $XFree86: xc/programs/xfd/gridP.h,v 1.4 2002/07/23 01:45:41 tsi Exp $ */ - #ifndef _FontGridP_h_ #define _FontGridP_h_ @@ -46,18 +46,25 @@ XFontStruct * text_font; /* font to display */ int cell_cols, cell_rows; /* number of cells */ int cell_width, cell_height; /* size of cell */ +#ifndef XRENDER Pixel foreground_pixel; /* color of text */ +#endif Pixel box_pixel; /* for box_chars */ Boolean center_chars; /* center characters in grid */ Boolean box_chars; /* put box around logical width */ XtCallbackList callbacks; /* for notifying caller */ int internal_pad; /* extra padding inside grid */ - Dimension start_char; /* first character of grid */ + long start_char; /* first character of grid */ int grid_width; /* width of grid lines */ /* private data */ GC text_gc; /* printing text */ GC box_gc; /* for box_chars */ int xoff, yoff; /* extra offsets within grid */ +#ifdef XRENDER + XftDraw *draw; + XftColor fg_color; + XftFont *text_face; +#endif } FontGridPart; typedef struct _FontGridRec { @@ -65,13 +72,39 @@ SimplePart simple; FontGridPart fontgrid; } FontGridRec; + +#ifdef XRENDER -#define DefaultCellWidth(fgw) (((fgw)->fontgrid.text_font->max_bounds.width) \ +#define GridFontHeight(g) ((g)->fontgrid.text_face ? \ + (g)->fontgrid.text_face->height : \ + (g)->fontgrid.text_font ? \ + (g)->fontgrid.text_font->ascent + \ + (g)->fontgrid.text_font->descent : 1) +#define GridFontAscent(g) ((g)->fontgrid.text_face ? \ + (g)->fontgrid.text_face->ascent : \ + (g)->fontgrid.text_font ? \ + (g)->fontgrid.text_font->ascent: 1) +#define GridFontWidth(g) ((g)->fontgrid.text_face ? \ + (g)->fontgrid.text_face->max_advance_width : \ + (g)->fontgrid.text_font ? \ + (g)->fontgrid.text_font->max_bounds.width : 1) +#define GridForeground(g) ((g)->fontgrid.fg_color.pixel) + +#else /* XRENDER */ + +#define GridFontHeight(g) ((g)->fontgrid.text_font->ascent + \ + (g)->fontgrid.text_font->descent) +#define GridFontAscent(g) ((g)->fontgrid.text_font ? \ + (g)->fontgrid.text_font->ascent: 1) +#define GridFontWidth(g) ((g)->fontgrid.text_font->max_bounds.width) +#define GridForeground(g) ((g)->fontgrid.foreground_pixel) + +#endif /* else XRENDER */ + +#define DefaultCellWidth(fgw) (GridFontWidth(fgw) \ + ((fgw)->fontgrid.internal_pad * 2)) -#define DefaultCellHeight(fgw) ((fgw)->fontgrid.text_font->ascent + \ - (fgw)->fontgrid.text_font->descent + \ +#define DefaultCellHeight(fgw) (GridFontHeight(fgw) + \ ((fgw)->fontgrid.internal_pad * 2)) - #define CellWidth(fgw) (((int)(fgw)->core.width - (fgw)->fontgrid.grid_width) \ / (fgw)->fontgrid.cell_cols \ Index: xc/programs/xfd/xfd.c diff -u xc/programs/xfd/xfd.c:1.6 xc/programs/xfd/xfd.c:1.8 --- xc/programs/xfd/xfd.c:1.6 Fri Dec 14 15:01:31 2001 +++ xc/programs/xfd/xfd.c Wed Feb 19 21:56:40 2003 @@ -26,7 +26,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xfd/xfd.c,v 1.6 2001/12/14 20:01:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfd/xfd.c,v 1.8 2003/02/20 02:56:40 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -41,11 +41,18 @@ #include <stdio.h> #include <stdlib.h> #include "grid.h" +#ifdef XRENDER +#include <X11/Xft/Xft.h> +#include <X11/extensions/Xrender.h> +#endif char *ProgramName; static XrmOptionDescRec xfd_options[] = { {"-fn", "*grid.font", XrmoptionSepArg, (caddr_t) NULL }, +#ifdef XRENDER +{"-fa", "*grid.face", XrmoptionSepArg, (caddr_t) NULL }, +#endif {"-start", "*startChar", XrmoptionSepArg, (caddr_t) NULL }, {"-box", "*grid.boxChars", XrmoptionNoArg, (caddr_t) "on" }, {"-bc", "*grid.boxColor", XrmoptionSepArg, (caddr_t) NULL }, @@ -64,6 +71,10 @@ Cardinal *num_params); static void do_next(Widget w, XEvent *event, String *params, Cardinal *num_params); +static void do_prev16(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void do_next16(Widget w, XEvent *event, String *params, + Cardinal *num_params); static char *get_font_name(Display *dpy, XFontStruct *fs); static void CatchFontConversionWarning(String name, String type, String class, String defaultp, String *params, @@ -71,20 +82,22 @@ static XtActionsRec xfd_actions[] = { { "Quit", do_quit }, + { "Prev16", do_prev16 }, { "Prev", do_prev }, { "Next", do_next }, + { "Next16", do_next16 }, }; static Atom wm_delete_window; -Widget quitButton, prevButton, nextButton; +Widget quitButton, prev16Button, prevButton, nextButton, next16Button; -#define DEF_SELECT_FORMAT "character 0x%02x%02x (%u,%u) (%#o,%#o)" +#define DEF_SELECT_FORMAT "character 0x%04x%02x (%u,%u) (%#o,%#o)" #define DEF_METRICS_FORMAT "width %d; left %d, right %d; ascent %d, descent %d (font %d, %d)" -#define DEF_RANGE_FORMAT "range: 0x%02x%02x (%u,%u) thru 0x%02x%02x (%u,%u)" -#define DEF_START_FORMAT "upper left: 0x%04x (%d,%d)" -#define DEF_NOCHAR_FORMAT "no such character 0x%02x%02x (%u,%u) (%#o,%#o)" +#define DEF_RANGE_FORMAT "range: 0x%04x%02x (%u,%u) thru 0x%04x%02x (%u,%u)" +#define DEF_START_FORMAT "upper left: 0x%06x (%d,%d)" +#define DEF_NOCHAR_FORMAT "no such character 0x%04x%02x (%u,%u) (%#o,%#o)" static struct _xfd_resources { char *select_format; @@ -150,7 +163,11 @@ Cardinal i; static XtCallbackRec cb[2] = { { SelectChar, NULL }, { NULL, NULL } }; XFontStruct *fs; +#ifdef XRENDER + XftFont *xft; +#endif char *fontname; + long minn, maxn; ProgramName = argv[0]; @@ -178,10 +195,14 @@ box = XtCreateManagedWidget ("box", boxWidgetClass, pane, NULL, ZERO); quitButton = XtCreateManagedWidget ("quit", commandWidgetClass, box, NULL, ZERO); + prev16Button = XtCreateManagedWidget ("prev16", commandWidgetClass, box, + NULL, ZERO); prevButton = XtCreateManagedWidget ("prev", commandWidgetClass, box, NULL, ZERO); nextButton = XtCreateManagedWidget ("next", commandWidgetClass, box, NULL, ZERO); + next16Button = XtCreateManagedWidget ("next16", commandWidgetClass, box, + NULL, ZERO); /* and labels in which to put information */ @@ -216,26 +237,56 @@ XtAppSetWarningMsgHandler(xtcontext, oldWarningHandler); /* set the label at the top to tell us which font this is */ +#ifdef XRENDER i = 0; - XtSetArg (av[i], XtNfont, &fs); i++; + XtSetArg (av[i], XtNface, &xft); i++; XtGetValues (fontGrid, av, i); - if (!fs || fontConversionFailed) { - fprintf (stderr, "%s: no font to display\n", ProgramName); - exit (1); + if (xft) + { + FcChar8 *family; + FcChar8 *style; + FcPattern *p; + double size; + family = (FcChar8 *) ""; + FcPatternGetString (xft->pattern, FC_FAMILY, 0, &family); + style = (FcChar8 *) ""; + FcPatternGetString (xft->pattern, FC_STYLE, 0, &style); + size = 0; + FcPatternGetDouble (xft->pattern, FC_SIZE, 0, &size); + p = FcPatternBuild (0, + FC_FAMILY, FcTypeString, family, + FC_STYLE, FcTypeString, style, + FC_SIZE, FcTypeDouble, size, + NULL); + fontname = (char *) FcNameUnparse (p); + FcPatternDestroy (p); + } + else +#endif + { + i = 0; + XtSetArg (av[i], XtNfont, &fs); i++; + XtGetValues (fontGrid, av, i); + if (!fs || fontConversionFailed) { + fprintf (stderr, "%s: no font to display\n", ProgramName); + exit (1); + } + fontname = get_font_name (XtDisplay(toplevel), fs); } - fontname = get_font_name (XtDisplay(toplevel), fs); - if (!fontname) fontname = "unknown font!"; i = 0; XtSetArg (av[i], XtNlabel, fontname); i++; XtSetValues (toplabel, av, i); + minn = GridFirstChar (fontGrid); + maxn = GridLastChar (fontGrid); + sprintf (buf, xfd_resources.range_format, + minn >> 8, minn & 0xff, + minn >> 8, minn & 0xff, + maxn >> 8, maxn & 0xff, + maxn >> 8, maxn & 0xff); + i = 0; XtSetArg (av[i], XtNlabel, buf); i++; - sprintf (buf, xfd_resources.range_format, - fs->min_byte1, fs->min_char_or_byte2, - fs->min_byte1, fs->min_char_or_byte2, - fs->max_byte1, fs->max_char_or_byte2, - fs->max_byte1, fs->max_char_or_byte2); XtSetValues (rangeLabel, av, i); XtRealizeWidget (toplevel); @@ -256,43 +307,74 @@ { FontGridCharRec *p = (FontGridCharRec *) data; XFontStruct *fs = p->thefont; - unsigned n = ((((unsigned) p->thechar.byte1) << 8) | - ((unsigned) p->thechar.byte2)); + long n = p->thechar; int direction, fontascent, fontdescent; XCharStruct metrics; char buf[256]; Arg arg; + Boolean has_char = 1; XtSetArg (arg, XtNlabel, buf); - if ((!fs->min_byte1 && !fs->max_byte1) ? - (n < fs->min_char_or_byte2 || n > fs->max_char_or_byte2) : - (p->thechar.byte1 < fs->min_byte1 || p->thechar.byte1 > fs->max_byte1 || - p->thechar.byte2 < fs->min_char_or_byte2 || - p->thechar.byte2 > fs->max_char_or_byte2)) { - sprintf (buf, xfd_resources.nochar_format, - (unsigned) p->thechar.byte1, (unsigned) p->thechar.byte2, - (unsigned) p->thechar.byte1, (unsigned) p->thechar.byte2, - (unsigned) p->thechar.byte1, (unsigned) p->thechar.byte2); - XtSetValues (selectLabel, &arg, ONE); - buf[0] = '\0'; - XtSetValues (metricsLabel, &arg, ONE); - return; + buf[0] = '\0'; +#ifdef XRENDER + if (p->theface) + { + XftFont *xft = p->theface; + FcChar32 c = (FcChar32) n; + has_char = (Boolean) FcCharSetHasChar (xft->charset, n); + if (has_char) + { + XGlyphInfo extents; + XftTextExtents32 (XtDisplay (w), xft, &c, 1, &extents); + sprintf (buf, xfd_resources.metrics_format, + extents.xOff, - extents.x, + extents.xOff - extents.width + extents.x, + extents.y, extents.height - extents.y, + xft->ascent, xft->descent); + } } + else +#endif + { + if ((!fs->min_byte1 && !fs->max_byte1) ? + (n < fs->min_char_or_byte2 || n > fs->max_char_or_byte2) : + (n >> 8 < fs->min_byte1 || n >> 8 > fs->max_byte1 || + (n & 0xff) < fs->min_char_or_byte2 || + (n & 0xff) > fs->max_char_or_byte2)) + { + has_char = 0; + } + else + { + XChar2b char2b; + char2b.byte1 = p->thechar >> 8; + char2b.byte2 = p->thechar & 0xff; + XTextExtents16 (fs, &char2b, 1, &direction, &fontascent, &fontdescent, + &metrics); + sprintf (buf, xfd_resources.metrics_format, + metrics.width, metrics.lbearing, metrics.rbearing, + metrics.ascent, metrics.descent, fontascent, fontdescent); + } + } + XtSetValues (metricsLabel, &arg, ONE); - XTextExtents16 (fs, &p->thechar, 1, &direction, &fontascent, &fontdescent, - &metrics); - sprintf (buf, xfd_resources.select_format, - (unsigned) p->thechar.byte1, (unsigned) p->thechar.byte2, - (unsigned) p->thechar.byte1, (unsigned) p->thechar.byte2, - (unsigned) p->thechar.byte1, (unsigned) p->thechar.byte2); + if (has_char) + { + sprintf (buf, xfd_resources.select_format, + n >> 8, n & 0xff, + n >> 8, n & 0xff, + n >> 8, n & 0xff); + } + else + { + sprintf (buf, xfd_resources.nochar_format, + n >> 8, n & 0xff, + n >> 8, n & 0xff, + n >> 8, n & 0xff); + } XtSetValues (selectLabel, &arg, ONE); - sprintf (buf, xfd_resources.metrics_format, - metrics.width, metrics.lbearing, metrics.rbearing, - metrics.ascent, metrics.descent, fontascent, fontdescent); - XtSetValues (metricsLabel, &arg, ONE); - return; } @@ -307,7 +389,7 @@ static void change_page(int page) { - Dimension oldstart, newstart; + long oldstart, newstart; int ncols, nrows; char buf[256]; Arg arg; @@ -346,20 +428,32 @@ static void set_button_state(void) { - Bool prevvalid, nextvalid; + Bool prevvalid, nextvalid, prev16valid, next16valid; Arg arg; - GetPrevNextStates (fontGrid, &prevvalid, &nextvalid); + GetPrevNextStates (fontGrid, &prevvalid, &nextvalid, &prev16valid, &next16valid); arg.name = XtNsensitive; arg.value = (XtArgVal) (prevvalid ? TRUE : FALSE); XtSetValues (prevButton, &arg, ONE); arg.value = (XtArgVal) (nextvalid ? TRUE : FALSE); XtSetValues (nextButton, &arg, ONE); + arg.name = XtNsensitive; + arg.value = (XtArgVal) (prev16valid ? TRUE : FALSE); + XtSetValues (prev16Button, &arg, ONE); + arg.value = (XtArgVal) (next16valid ? TRUE : FALSE); + XtSetValues (next16Button, &arg, ONE); } /* ARGSUSED */ static void +do_prev16(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + change_page (-16); +} + + +static void do_prev(Widget w, XEvent *event, String *params, Cardinal *num_params) { change_page (-1); @@ -371,6 +465,13 @@ do_next(Widget w, XEvent *event, String *params, Cardinal *num_params) { change_page (1); +} + +/* ARGSUSED */ +static void +do_next16(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + change_page (16); } Index: xc/programs/xfindproxy/Imakefile diff -u xc/programs/xfindproxy/Imakefile:1.3 xc/programs/xfindproxy/Imakefile:1.4 --- xc/programs/xfindproxy/Imakefile:1.3 Wed Jan 17 18:45:27 2001 +++ xc/programs/xfindproxy/Imakefile Fri May 31 14:46:12 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xfindproxy/Imakefile,v 1.3 2001/01/17 23:45:27 dawes Exp $ +XCOMM $XFree86: xc/programs/xfindproxy/Imakefile,v 1.4 2002/05/31 18:46:12 dawes Exp $ DEPLIBS = $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTOOLLIB) $(XLIB) @@ -12,7 +12,7 @@ OBJS1 = xfindproxy.o - PROGS1 = xfindproxy + PROGS1 = ProgramTargetName(xfindproxy) PROGRAMS = $(PROGS1) Index: xc/programs/xfontsel/xfontsel.man diff -u xc/programs/xfontsel/xfontsel.man:1.3 xc/programs/xfontsel/xfontsel.man:1.4 --- xc/programs/xfontsel/xfontsel.man:1.3 Sat Jan 27 13:21:12 2001 +++ xc/programs/xfontsel/xfontsel.man Sat Oct 12 12:06:48 2002 @@ -25,7 +25,7 @@ .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" -.\" $XFree86: xc/programs/xfontsel/xfontsel.man,v 1.3 2001/01/27 18:21:12 dawes Exp $ +.\" $XFree86: xc/programs/xfontsel/xfontsel.man,v 1.4 2002/10/12 16:06:48 herrb Exp $ .de EX \"Begin example .ne 5 .if n .sp 1 @@ -130,8 +130,8 @@ resulting window will be nearly incomprehensible. .PP Most of the significant parts of the widget hierarchy are documented -in the app-defaults file (normally <XRoot>/lib/X11/app-defaults/XFontSel, -where <XRoot> refers to the root of the X11 install tree.) +in +.IR __apploaddir__/XFontSel , .PP Application specific resources: .PP Index: xc/programs/xfs/Imakefile diff -u xc/programs/xfs/Imakefile:3.22 xc/programs/xfs/Imakefile:3.23 --- xc/programs/xfs/Imakefile:3.22 Wed Jan 17 18:45:27 2001 +++ xc/programs/xfs/Imakefile Mon Oct 14 21:45:02 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xfs/Imakefile,v 3.22 2001/01/17 23:45:27 dawes Exp $ +XCOMM $XFree86: xc/programs/xfs/Imakefile,v 3.23 2002/10/15 01:45:02 dawes Exp $ #undef ServerDefines #include <Server.tmpl> @@ -40,7 +40,7 @@ SUBDIRS = $(FSDIRS) FSLIBDIR = $(LIBDIR)/fs -FSERRORS = $(LOGDIRECTORY)/fs-errors +FSERRORS = $(LOGDIRECTORY)/xfs.log DEFAULTFONTPATH = DefaultFSFontPath SITE_CONFIG = -DDEFAULTFONTPATH=$(DEFAULTFONTPATH) -DFSERRORS=$(FSERRORS) Index: xc/programs/xfs/difs/cache.c diff -u xc/programs/xfs/difs/cache.c:1.6 xc/programs/xfs/difs/cache.c:1.7 --- xc/programs/xfs/difs/cache.c:1.6 Fri Dec 14 15:01:33 2001 +++ xc/programs/xfs/difs/cache.c Mon Oct 14 21:45:02 2002 @@ -47,7 +47,7 @@ * @(#)cache.c 4.2 91/05/02 * */ -/* $XFree86: xc/programs/xfs/difs/cache.c,v 1.6 2001/12/14 20:01:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/cache.c,v 1.7 2002/10/15 01:45:02 dawes Exp $ */ #include "cachestr.h" #include "misc.h" @@ -370,7 +370,7 @@ } } if (!found) - FatalError("Freeing cache entry %d which isn't there\n", cid); + FatalError("freeing cache entry %d which isn't there\n", cid); } /* ARGSUSED */ Index: xc/programs/xfs/difs/dispatch.c diff -u xc/programs/xfs/difs/dispatch.c:3.12 xc/programs/xfs/difs/dispatch.c:3.13 --- xc/programs/xfs/difs/dispatch.c:3.12 Fri Dec 14 15:01:33 2001 +++ xc/programs/xfs/difs/dispatch.c Mon Oct 14 21:45:02 2002 @@ -46,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/dispatch.c,v 3.12 2001/12/14 20:01:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/dispatch.c,v 3.13 2002/10/15 01:45:02 dawes Exp $ */ #include <stdlib.h> #include "dispatch.h" @@ -165,7 +165,7 @@ if (dispatchException) { /* re-read the config file */ if (dispatchException & DE_RECONFIG) { - NoticeF("Re-reading config file\n"); + NoticeF("re-reading config file\n"); if (ReadConfigFile(configfilename) != FSSuccess) ErrorF("couldn't parse config file\n"); SetConfigValues(); @@ -186,6 +186,8 @@ if (dispatchException & DE_TERMINATE) { NoticeF("terminating\n"); kill_all_clients(); + CloseSockets(); + CloseErrors(); exit(0); break; } Index: xc/programs/xfs/difs/fontinfo.c diff -u xc/programs/xfs/difs/fontinfo.c:1.10 xc/programs/xfs/difs/fontinfo.c:1.11 --- xc/programs/xfs/difs/fontinfo.c:1.10 Fri Dec 14 15:01:34 2001 +++ xc/programs/xfs/difs/fontinfo.c Mon Oct 14 21:45:02 2002 @@ -46,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/fontinfo.c,v 1.10 2001/12/14 20:01:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/fontinfo.c,v 1.11 2002/10/15 01:45:02 dawes Exp $ */ #include "FS.h" #include "FSproto.h" @@ -61,24 +61,6 @@ #include "dispatch.h" #include <swapreq.h> #include <swaprep.h> - -extern int -QueryBitmaps( - ClientPtr client, - ClientFontPtr cfp, - int item_size, - fsBitmapFormat format, - int nranges, - Bool range_flag, - pointer range_data); -extern int -QueryExtents( - ClientPtr client, - ClientFontPtr cfp, - int item_size, - int nranges, - Bool range_flag, - pointer range_data); void CopyCharInfo( Index: xc/programs/xfs/difs/main.c diff -u xc/programs/xfs/difs/main.c:3.11 xc/programs/xfs/difs/main.c:3.12 --- xc/programs/xfs/difs/main.c:3.11 Fri Dec 14 15:01:35 2001 +++ xc/programs/xfs/difs/main.c Mon Oct 14 21:45:02 2002 @@ -46,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/main.c,v 3.11 2001/12/14 20:01:35 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/main.c,v 3.12 2002/10/15 01:45:02 dawes Exp $ */ #include <stdlib.h> #include <sys/types.h> @@ -98,12 +98,11 @@ InitErrors(); /* - * do this first thing, to get any options that only take effect at - * startup time. it is read again each time the server resets + * Do this first thing, to get any options that only take effect at + * startup time. It is read again each time the server resets. */ if (ReadConfigFile(configfilename) != FSSuccess) { - ErrorF("fatal: couldn't read config file\n"); - exit(1); + FatalError("couldn't read config file\n"); } /* make sure at least world write access is disabled */ @@ -181,7 +180,7 @@ { NoopDDA(); /* dummy to get difsutils.o to link */ /* Getting here can become the next xfs exploit... so don't exit */ - ErrorF("Not implemented\n"); + ErrorF("not implemented\n"); return (FSBadImplementation); } Index: xc/programs/xfs/difs/resource.c diff -u xc/programs/xfs/difs/resource.c:3.7 xc/programs/xfs/difs/resource.c:3.8 --- xc/programs/xfs/difs/resource.c:3.7 Fri Dec 14 15:01:35 2001 +++ xc/programs/xfs/difs/resource.c Mon Oct 14 21:45:02 2002 @@ -47,7 +47,7 @@ * %W% %G% * */ -/* $XFree86: xc/programs/xfs/difs/resource.c,v 3.7 2001/12/14 20:01:35 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/resource.c,v 3.8 2002/10/15 01:45:02 dawes Exp $ */ /* * a resource is a 32 bit quantity. the upper 12 bits are client id. * client provides a 19 bit resource id. this is "hashed" by me by @@ -105,7 +105,6 @@ typedef int (*DeleteType) (void *, FSID); extern int CloseClientFont(ClientPtr, FSID); -extern int DeleteAuthCont (pointer, FSID); static DeleteType *DeleteFuncs = (DeleteType *) NULL; @@ -405,7 +404,7 @@ } } if (!gotOne) - FatalError("Freeing resource id=%X which isn't there\n", id); + FatalError("freeing resource id=%X which isn't there\n", id); } #ifdef NOTYET Index: xc/programs/xfs/include/difsutils.h diff -u xc/programs/xfs/include/difsutils.h:1.4 xc/programs/xfs/include/difsutils.h:1.5 --- xc/programs/xfs/include/difsutils.h:1.4 Mon Jun 25 16:40:18 2001 +++ xc/programs/xfs/include/difsutils.h Mon Oct 14 21:45:03 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xfs/include/difsutils.h,v 1.4 2001/06/25 20:40:18 paulo Exp $ + * $XFree86: xc/programs/xfs/include/difsutils.h,v 1.5 2002/10/15 01:45:03 dawes Exp $ */ /************************************************************ @@ -73,5 +73,6 @@ extern void SetDefaultPointSize (int ps); extern void WakeupHandler (int result, unsigned long * pReadmask); extern void Xfree (unsigned long *n); +extern pointer Xcalloc (unsigned long n); #endif /* _DIFSUTILS_H */ Index: xc/programs/xfs/include/os.h diff -u xc/programs/xfs/include/os.h:3.13 xc/programs/xfs/include/os.h:3.14 --- xc/programs/xfs/include/os.h:3.13 Fri Dec 14 15:01:38 2001 +++ xc/programs/xfs/include/os.h Mon Oct 14 21:45:03 2002 @@ -47,7 +47,7 @@ * $NCDXorg: @(#)os.h,v 4.2 1991/05/10 07:59:16 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/include/os.h,v 3.13 2001/12/14 20:01:38 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/os.h,v 3.14 2002/10/15 01:45:03 dawes Exp $ */ #ifndef _OS_H_ #define _OS_H_ @@ -107,7 +107,6 @@ /* os/daemon.c */ extern void BecomeOrphan(void); extern void BecomeDaemon(void); -extern int StorePid(void); /* os/error.c */ extern void Error(char *str); Index: xc/programs/xfs/os/Imakefile diff -u xc/programs/xfs/os/Imakefile:3.8 xc/programs/xfs/os/Imakefile:3.9 --- xc/programs/xfs/os/Imakefile:3.8 Tue Jul 31 20:45:05 2001 +++ xc/programs/xfs/os/Imakefile Mon Oct 14 21:45:03 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xfs/os/Imakefile,v 3.8 2001/08/01 00:45:05 tsi Exp $ +XCOMM $XFree86: xc/programs/xfs/os/Imakefile,v 3.9 2002/10/15 01:45:03 dawes Exp $ #undef ServerDefines #include <Server.tmpl> @@ -39,10 +39,19 @@ FONTCACHE_DEFINES = FontCacheExtensionDefines #endif +#ifdef VarRunDirectory +XFSPIDDIR = $(VARRUNDIR) +#else +XFSPIDDIR = $(LIBDIR)/fs +#endif +PID_DEFINES = -DXFSPIDDIR=\"$(XFSPIDDIR)\" + NormalLibraryObjectRule() NormalLibraryTarget(os,$(OBJS)) SpecialCObjectRule(connection,$(ICONFIGFILES),$(CONN_DEFINES) $(SIGNAL_DEFINES) $(SOCK_DEFINES) $(OS_DEFINES)) + +SpecialCObjectRule(utils,$(ICONFIGFILES),$(PID_DEFINES)) SpecialCObjectRule(io,$(ICONFIGFILES),$(CONN_DEFINES)) Index: xc/programs/xfs/os/config.c diff -u xc/programs/xfs/os/config.c:3.14 xc/programs/xfs/os/config.c:3.16 --- xc/programs/xfs/os/config.c:3.14 Fri Dec 14 15:01:40 2001 +++ xc/programs/xfs/os/config.c Mon Oct 14 21:45:03 2002 @@ -47,7 +47,7 @@ * $NCDXorg: @(#)config.c,v 4.6 1991/07/09 14:08:09 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/config.c,v 3.14 2001/12/14 20:01:40 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/config.c,v 3.16 2002/10/15 01:45:03 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -288,7 +288,7 @@ err = SetFontCatalogue(font_catalogue, &num); if (err != FSSuccess) { - FatalError("Element #%d (starting at 0) of font path is bad or has a bad font:\n\"%s\"\n", + FatalError("element #%d (starting at 0) of font path is bad or has a bad font:\n\"%s\"\n", num, font_catalogue); } InitErrors(); @@ -296,7 +296,7 @@ font_catalogue = NULL; } -#ifdef __EMX__ +#ifdef __UNIXOS2__ char *__XFSRedirRoot(char *fname) { static char redirname[300]; /* enough for long filenames */ @@ -329,7 +329,7 @@ ErrorF(ConfigErrors[CONFIG_ERR_MEMORY], filename); return FSBadAlloc; } -#ifdef __EMX__ +#ifdef __UNIXOS2__ filename = __XFSRedirRoot(filename); #endif if ((fp = fopen(filename, "r")) == NULL) { @@ -514,7 +514,7 @@ t = *val; *val = '\0'; if (!strcmp(parm->parm_name, "error-file")) { -#ifndef __EMX__ +#ifndef __UNIXOS2__ memmove( ErrorFile, start, val - start + 1); #else strcpy( ErrorFile, __XFSRedirRoot(start)); @@ -536,7 +536,7 @@ fsfree((char *) font_catalogue); /* dump any previous one */ b = font_catalogue = (char *) fsalloc(strlen(val) + 1); if (!font_catalogue) - FatalError("Insufficent memory for font catalogue\n"); + FatalError("insufficent memory for font catalogue\n"); while (*val) { /* remove all the gunk */ if (!isspace(*val)) { *b++ = *val; @@ -615,7 +615,7 @@ if (!strcmp(parm->parm_name, "default-resolutions")) { err = SetDefaultResolutions(start); if (err != FSSuccess) { - FatalError("Bogus resolution list \"%s\"\n", start); + FatalError("bogus resolution list \"%s\"\n", start); } } *val = t; Index: xc/programs/xfs/os/connection.c diff -u xc/programs/xfs/os/connection.c:3.23 xc/programs/xfs/os/connection.c:3.25 --- xc/programs/xfs/os/connection.c:3.23 Fri Dec 14 15:01:41 2001 +++ xc/programs/xfs/os/connection.c Mon Oct 14 21:45:03 2002 @@ -67,7 +67,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/connection.c,v 3.23 2001/12/14 20:01:41 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/connection.c,v 3.25 2002/10/15 01:45:03 dawes Exp $ */ #include <X11/Xtrans.h> #include <stdlib.h> @@ -78,7 +78,7 @@ #ifndef Lynx #include <sys/param.h> #include <sys/socket.h> -#ifndef __EMX__ +#ifndef __UNIXOS2__ #include <sys/uio.h> #endif #else @@ -98,7 +98,7 @@ #include "dispatch.h" #include "fsevents.h" -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define _NFILE OPEN_MAX #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif @@ -187,7 +187,7 @@ #ifdef _SC_OPEN_MAX lastfdesc = sysconf(_SC_OPEN_MAX) - 1; #else -#if defined(hpux) || defined(__EMX__) +#if defined(hpux) || defined(__UNIXOS2__) lastfdesc = _NFILE - 1; #else lastfdesc = getdtablesize() - 1; @@ -228,7 +228,7 @@ ListenTransFds[ListenTransCount] = old_listen[i].fd; FD_SET (old_listen[i].fd, &WellKnownConnections); - NoticeF("Reusing existing file descriptor %d\n", + NoticeF("reusing existing file descriptor %d\n", old_listen[i].fd); ListenTransCount++; @@ -254,11 +254,10 @@ FD_SET (fd, &WellKnownConnections); } } - NoticeF("listening on port %s\n", port); } if (! XFD_ANYSET(&WellKnownConnections)) - FatalError("Cannot establish any listening sockets\n"); + FatalError("cannot establish any listening sockets\n"); /* set up all the signal handlers */ signal(SIGPIPE, SIG_IGN); @@ -364,7 +363,7 @@ } } -#define NOROOM "Maximum number of clients reached" +#define NOROOM "maximum number of clients reached" static void error_conn_max(XtransConnInfo trans_conn) @@ -542,7 +541,7 @@ ClientPtr client; #ifdef DEBUG - fprintf(stderr, "Looking for clients to reap\n"); + fprintf(stderr, "looking for clients to reap\n"); #endif for (i = MINCLIENT; i < currentMaxClients; i++) { Index: xc/programs/xfs/os/daemon.c diff -u xc/programs/xfs/os/daemon.c:1.8 xc/programs/xfs/os/daemon.c:1.12 --- xc/programs/xfs/os/daemon.c:1.8 Fri Nov 16 11:47:58 2001 +++ xc/programs/xfs/os/daemon.c Sun Oct 20 17:42:50 2002 @@ -27,29 +27,35 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.8 2001/11/16 16:47:58 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.12 2002/10/20 21:42:50 tsi Exp $ */ #include <X11/Xos.h> -#include <stdio.h> +#include <sys/types.h> +#include <errno.h> #include <stdlib.h> -#if defined(SVR4) || defined(USG) -#include <termios.h> -#else -#include <sys/ioctl.h> +#ifndef __GLIBC__ +# if defined(__osf__) || \ + defined(__GNU__) || \ + defined(__CYGWIN__) || \ + defined(linux) +# define setpgrp setpgid +# endif #endif -#if defined(__osf__) || defined(linux) || defined(__GNU__) || defined(__CYGWIN__) -#define setpgrp setpgid + +#if defined(SVR4) || defined(USG) || defined(__GLIBC__) +# include <termios.h> +#else +# include <sys/ioctl.h> #endif #ifdef hpux -#include <sys/ptyio.h> +# include <sys/ptyio.h> #endif -#include <errno.h> -#include <sys/types.h> + #ifdef X_NOT_POSIX -#define Pid_t int +# define Pid_t int #else -#define Pid_t pid_t +# define Pid_t pid_t #endif #include "os.h" @@ -58,8 +64,8 @@ BecomeOrphan () { Pid_t child_id; - int stat; + chdir("/"); /* * fork so that the process goes into the background automatically. Also * has a nice side effect of having the child process get inherited by @@ -76,27 +82,35 @@ break; case -1: /* error */ - FatalError("daemon fork failed, errno = %d\n", errno); + FatalError("daemon fork failed, %s\n", strerror(errno)); break; default: /* parent */ -#if !defined(CSRG_BASED) && !defined(__QNXNTO__) -#if defined(SVR4) - stat = setpgid(child_id, child_id); - /* This gets error EPERM. Why? */ -#else -#if defined(SYSV) - stat = 0; /* don't know how to set child's process group */ -#else - stat = setpgrp(child_id, child_id); - if (stat != 0) - FatalError("setting process grp for daemon failed, errno = %d\n", - errno); -#endif -#endif -#endif /* !CSRG_BASED */ +#if defined(CSRG_BASED) || \ + defined(SYSV) || \ + defined(SVR4) || \ + defined(__QNXNTO__) || \ + defined(__GLIBC__) || \ + defined(linux) + { + int stat; +# if defined(SVR4) || defined(__QNXNTO__) + /* This gets error EPERM. Why? */ + stat = setpgid (child_id, child_id); +# elif defined(SYSV) + stat = 0; /* don't know how to set child's process group */ +# elif defined(__GLIBC__) + stat = setpgrp (); +# else + stat = setpgrp (child_id, child_id); +# endif + if (stat != 0) + FatalError("setting process group for daemon failed: %s\n", + strerror(errno)); + } +#endif /* ! (CSRG_BASED || SYSV || SVR4 || __QNXNTO__ || __GLIBC__) */ exit (0); } } @@ -104,43 +118,44 @@ void BecomeDaemon () { - register int i; - /* - * Close standard file descriptors and get rid of controlling tty + * Close standard file descriptors and get rid of controlling tty. */ -#if defined(CSRG_BASED) || defined(__QNXNTO__) + /* If our C library has the daemon() function, just use it. */ +#if defined(__GLIBC__) || defined(CSRG_BASED) daemon (0, 0); #else -#if defined(SYSV) || defined(SVR4) + register int i; + +# if defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) setpgrp (); -#else +# else setpgrp (0, getpid()); -#endif +# endif - close (0); + close (0); close (1); close (2); -#if !defined(__EMX__) && !defined(__CYGWIN__) -#if !((defined(SYSV) || defined(SVR4)) && defined(i386)) +# if !defined(__UNIXOS2__) && !defined(__CYGWIN__) +# if !((defined(SYSV) || defined(SVR4)) && defined(i386)) if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ -#if defined(USG) && defined(TCCLRCTTY) +# if defined(USG) && defined(TCCLRCTTY) int zero = 0; (void) ioctl (i, TCCLRCTTY, &zero); -#else -#if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) +# else +# if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) int zero = 0; (void) ioctl (i, TIOCTTY, &zero); -#else +# else (void) ioctl (i, TIOCNOTTY, (char *) 0); /* detach, BSD style */ -#endif -#endif +# endif +# endif (void) close (i); } -#endif /* !((SYSV || SVR4) && i386) */ -#endif /* !__EMX__ */ +# endif /* !((SYSV || SVR4) && i386) */ +# endif /* !__UNIXOS2__ && !__CYGWIN__ */ /* * Set up the standard file descriptors. @@ -148,37 +163,5 @@ (void) open ("/", O_RDONLY); /* root inode already in core */ (void) dup2 (0, 1); (void) dup2 (0, 2); -#endif /* CSRG_BASED */ -} - -#if defined(linux) || defined(CSRG_BASED) || defined(__QNXNTO__) -FILE *pidFilePtr; -static int pidFd; -char *pidFile = "/var/run/xfs.pid"; -#endif - -int -StorePid () -{ -#if defined(linux) || defined(CSRG_BASED) || defined(__QNXNTO__) - int oldpid; - - if (pidFile[0] != '\0') { - pidFd = open (pidFile, 2); - if (pidFd == -1 && errno == ENOENT) - pidFd = open (pidFile, O_RDWR|O_CREAT, 0666); - if (pidFd == -1 || !(pidFilePtr = fdopen (pidFd, "r+"))) - { - ErrorF ("process-id file %s cannot be opened\n", - pidFile); - return -1; - } - if (fscanf (pidFilePtr, "%d\n", &oldpid) != 1) - oldpid = -1; - fseek (pidFilePtr, 0l, 0); - fprintf (pidFilePtr, "%5d\n", getpid ()); - (void) fflush (pidFilePtr); - } #endif - return 0; } Index: xc/programs/xfs/os/error.c diff -u xc/programs/xfs/os/error.c:1.10 xc/programs/xfs/os/error.c:1.11 --- xc/programs/xfs/os/error.c:1.10 Fri Dec 14 15:01:41 2001 +++ xc/programs/xfs/os/error.c Mon Oct 14 21:45:03 2002 @@ -44,7 +44,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/error.c,v 1.10 2001/12/14 20:01:41 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/error.c,v 1.11 2002/10/15 01:45:03 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -106,7 +106,7 @@ #ifdef USE_SYSLOG if (UseSyslog && !log_open) { - openlog("Font Server", LOG_PID, LOG_LOCAL0); + openlog("xfs", LOG_PID, LOG_DAEMON); log_open = TRUE; return; } @@ -118,7 +118,7 @@ dup2(i, 2); close(i); } else { - ErrorF("Can't open error file \"%s\"\n", ErrorFile); + ErrorF("can't open error file \"%s\"\n", ErrorFile); } } } @@ -161,9 +161,10 @@ vsyslog(LOG_NOTICE, f, args); return; } -#endif +#else fprintf(stderr, "%s notice: ", progname); vfprintf(stderr, f, args); +#endif /* USE_SYSLOG */ va_end(args); } @@ -177,12 +178,13 @@ va_start(args, f); #ifdef USE_SYSLOG if (UseSyslog) { - vsyslog(LOG_NOTICE, f, args); + vsyslog(LOG_WARNING, f, args); return; } -#endif +#else fprintf(stderr, "%s error: ", progname); vfprintf(stderr, f, args); +#endif va_end(args); } @@ -191,8 +193,15 @@ { va_list args; va_start(args, f); - fprintf(stderr, "%s error: ", progname); +#ifdef USE_SYSLOG + if (UseSyslog) { + vsyslog(LOG_ERR, f, args); + return; + } +#else + fprintf(stderr, "%s fatal error: ", progname); vfprintf(stderr, f, args); +#endif va_end(args); abort_server(); /* NOTREACHED */ Index: xc/programs/xfs/os/io.c diff -u xc/programs/xfs/os/io.c:3.18 xc/programs/xfs/os/io.c:3.19 --- xc/programs/xfs/os/io.c:3.18 Fri Dec 14 15:01:41 2001 +++ xc/programs/xfs/os/io.c Fri May 31 14:46:12 2002 @@ -46,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/io.c,v 3.18 2001/12/14 20:01:41 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/io.c,v 3.19 2002/05/31 18:46:12 dawes Exp $ */ #include <X11/Xtrans.h> #include <stdio.h> @@ -54,7 +54,7 @@ #include <sys/types.h> #ifndef Lynx #include <sys/param.h> -#ifndef __EMX__ +#ifndef __UNIXOS2__ #include <sys/uio.h> #endif #else Index: xc/programs/xfs/os/osdep.h diff -u xc/programs/xfs/os/osdep.h:3.11 xc/programs/xfs/os/osdep.h:3.12 --- xc/programs/xfs/os/osdep.h:3.11 Fri Dec 14 15:01:41 2001 +++ xc/programs/xfs/os/osdep.h Fri May 31 14:46:12 2002 @@ -47,7 +47,7 @@ * @(#)osdep.h 4.1 5/2/91 * */ -/* $XFree86: xc/programs/xfs/os/osdep.h,v 3.11 2001/12/14 20:01:41 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osdep.h,v 3.12 2002/05/31 18:46:12 dawes Exp $ */ #ifndef _OSDEP_H_ #define _OSDEP_H_ @@ -70,7 +70,7 @@ #endif #ifndef OPEN_MAX -#if defined(__EMX__) || defined(__QNX__) +#if defined(__UNIXOS2__) || defined(__QNX__) #define OPEN_MAX 256 #else #ifdef SVR4 Index: xc/programs/xfs/os/osglue.c diff -u xc/programs/xfs/os/osglue.c:3.15 xc/programs/xfs/os/osglue.c:3.19 --- xc/programs/xfs/os/osglue.c:3.15 Fri Dec 14 15:01:41 2001 +++ xc/programs/xfs/os/osglue.c Sat Oct 19 16:04:20 2002 @@ -47,7 +47,7 @@ * $NCDXorg: @(#)osglue.c,v 4.6 1991/07/09 14:07:30 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/osglue.c,v 3.15 2001/12/14 20:01:41 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osglue.c,v 3.19 2002/10/19 20:04:20 herrb Exp $ */ /* * this is miscellaneous OS specific stuff. @@ -61,7 +61,7 @@ #include <stdlib.h> #define XK_LATIN1 #include <X11/keysymdef.h> -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define _NFILE 256 #endif @@ -294,8 +294,8 @@ if (!CloneSelf) return -1; -#ifdef __EMX__ - NoticeF("Cloning of font server not supported under OS/2!\n"); +#ifdef __UNIXOS2__ + NoticeF("cloning of font server not supported under OS/2!\n"); return(-1); #endif @@ -307,7 +307,7 @@ #ifdef _SC_OPEN_MAX lastfdesc = sysconf(_SC_OPEN_MAX) - 1; #else -#if defined(hpux) || defined(__EMX__) +#if defined(hpux) || defined(__UNIXOS2__) lastfdesc = _NFILE - 1; #else lastfdesc = getdtablesize() - 1; @@ -315,10 +315,11 @@ #endif NoticeF("attempting clone...\n"); + chdir("/"); child = fork(); if (child == -1) { /* failed to fork */ - ErrorF("Clone failed to fork()\n"); + ErrorF("clone failed to fork()\n"); return -1; } /* @@ -328,11 +329,11 @@ */ if (child == 0) { StopListening(); - NoticeF("Clone: child becoming drone\n"); + NoticeF("clone: child becoming drone\n"); drone_server = TRUE; return 1; } else { /* parent */ - NoticeF("Clone: parent revitalizing as %s\n", progname); + NoticeF("clone: parent revitalizing as %s\n", progname); CloseErrors(); /* XXX should we close stdio as well? */ for (i = 3; i < lastfdesc; i++) @@ -371,12 +372,12 @@ "-ls", old_listen_arg, "-cf", configfilename, "-port", portnum, - NULL); + (void *)NULL); InitErrors(); /* reopen errors, since we don't want to lose * this */ - Error("Clone failed"); - FatalError("Failed to clone self\n"); + Error("clone failed"); + FatalError("failed to clone self\n"); } /* NOTREACHED */ return 0; Index: xc/programs/xfs/os/utils.c diff -u xc/programs/xfs/os/utils.c:3.18 xc/programs/xfs/os/utils.c:3.20 --- xc/programs/xfs/os/utils.c:3.18 Mon Jan 7 15:38:30 2002 +++ xc/programs/xfs/os/utils.c Mon Oct 14 21:45:03 2002 @@ -46,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/utils.c,v 3.18 2002/01/07 20:38:30 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/utils.c,v 3.20 2002/10/15 01:45:03 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> @@ -63,6 +63,8 @@ #include <grp.h> #include <errno.h> #include <sys/types.h> +#include <errno.h> +#include <string.h> #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE @@ -111,6 +113,11 @@ # define WRITES write(fileno(stderr), s, strlen(s)) #endif +static char *pidFile = XFSPIDDIR "/xfs.pid"; +static int pidFd; +static FILE *pidFilePtr; +static int StorePid (void); + /* ARGSUSED */ SIGVAL AutoResetServer(int n) @@ -212,7 +219,7 @@ static void usage(void) { - fprintf(stderr, "usage: %s [-config config_file] [-port tcp_port] [-droppriv] [-daemon] [-nodaemon] [-user user_name]\n", + fprintf(stderr, "usage: %s [-config config_file] [-port tcp_port] [-droppriv] [-daemon] [-nodaemon] [-user user_name] [-ls listen_socket]\n", progname); exit(1); } @@ -235,9 +242,7 @@ * * [] denotes optional and ... denotes repitition. * - * The string must be _exactly_ in the above format. Since this is - * an internal option used by the font server, it's ok to be strict - * about the format of the string. + * The string must be _exactly_ in the above format. */ void @@ -259,12 +264,18 @@ OldListenCount = count + 1; OldListen = (OldListenRec *) malloc ( OldListenCount * sizeof (OldListenRec)); - + if (OldListen == NULL) { + fprintf(stderr, "ProcessLSoption: malloc error\n"); + exit(1); + } ptr = str; for (i = 0; i < OldListenCount; i++) { slash = (char *) strchr (ptr, '/'); + if (slash == NULL) { + usage(); + } len = slash - ptr; strncpy (number, ptr, len); number[len] = '\0'; @@ -273,6 +284,9 @@ ptr = slash + 1; slash = (char *) strchr (ptr, '/'); + if (slash == NULL) { + usage(); + } len = slash - ptr; strncpy (number, ptr, len); number[len] = '\0'; @@ -285,7 +299,9 @@ else { char *comma = (char *) strchr (ptr, ','); - + if (comma == NULL) { + usage(); + } len = comma - ptr; strncpy (number, ptr, len); number[len] = '\0'; @@ -372,7 +388,7 @@ * expectations of malloc, but this makes lint happier. */ -pointer +pointer FSalloc (unsigned long amount) { register pointer ptr; @@ -394,7 +410,7 @@ return ptr; #endif if (Must_have_memory) - FatalError("Out of memory\n"); + FatalError("out of memory\n"); return 0; } @@ -443,7 +459,7 @@ return ptr; #endif if (Must_have_memory) - FatalError("Out of memory\n"); + FatalError("out of memory\n"); return 0; } @@ -482,29 +498,24 @@ pwent = getpwnam(user); if (pwent) { if (setgid(pwent->pw_gid)) { - ErrorF("fatal: couldn't set groupid to xfs user's group\n"); - exit(1); + FatalError("fatal: couldn't set groupid to xfs user's group\n"); } #ifndef QNX4 #ifndef __CYGWIN__ if (setgroups(0, NULL)) { - ErrorF("fatal: couldn't drop supplementary groups\n"); - exit(1); + FatalError("fatal: couldn't drop supplementary groups\n"); } #endif if (initgroups(user, pwent->pw_gid)) { - ErrorF("fatal: couldn't init supplementary groups\n"); - exit(1); + FatalError("fatal: couldn't init supplementary groups\n"); } #endif /* QNX4 */ if (setuid(pwent->pw_uid)) { - ErrorF("fatal: couldn't set userid to %s user\n", user); - exit(1); + FatalError("fatal: couldn't set userid to %s user\n", user); } } } else if (dropPriv || userId) { - ErrorF("fatal: -droppriv or -user flag specified, but xfs not run as root\n"); - exit(1); + FatalError("fatal: -droppriv or -user flag specified, but xfs not run as root\n"); } } @@ -512,18 +523,54 @@ void SetDaemonState(void) { - int oldpid; + int oldpid; if (becomeDaemon) { BecomeOrphan(); BecomeDaemon(); - if ((oldpid = StorePid())) { + if ((oldpid = StorePid ())) { if (oldpid == -1) - ErrorF ("can't create/lock pid file\n"); + ErrorF ("error opening process-id file %s\n", pidFile); else - ErrorF ("can't lock pid file, another xfs is running (pid %s)\n", - oldpid); + ErrorF ("process-id file %s indicates another xfs is " + "running (pid %d); exiting\n", pidFile, oldpid); exit(1); } } +} + + +static int +StorePid (void) +{ + int oldpid; + + if (pidFile[0] != '\0') { + pidFd = open (pidFile, O_RDWR); + if (pidFd == -1 && errno == ENOENT) + pidFd = open (pidFile, O_RDWR|O_CREAT, 0666); + if (pidFd == -1 || !(pidFilePtr = fdopen (pidFd, "r+"))) + { + ErrorF ("cannot open process-id file %s: %s\n", pidFile, + strerror (errno)); + return -1; + } + if (fscanf (pidFilePtr, "%d\n", &oldpid) != 1) + oldpid = -1; + if (fseek (pidFilePtr, 0L, SEEK_SET) == -1) + { + ErrorF ("cannot seek process-id file %s: %s\n", pidFile, + strerror (errno)); + return -1; + } + if (fprintf (pidFilePtr, "%5ld\n", (long) getpid ()) != 6) + { + ErrorF ("cannot write to process-id file %s: %s\n", pidFile, + strerror (errno)); + return -1; + } + (void) fflush (pidFilePtr); + (void) fclose (pidFilePtr); + } + return 0; } Index: xc/programs/xfs/os/waitfor.c diff -u xc/programs/xfs/os/waitfor.c:3.15 xc/programs/xfs/os/waitfor.c:3.16 --- xc/programs/xfs/os/waitfor.c:3.15 Fri Dec 14 15:01:41 2001 +++ xc/programs/xfs/os/waitfor.c Fri May 31 14:46:12 2002 @@ -50,7 +50,7 @@ * $NCDXorg: @(#)waitfor.c,v 4.5 1991/06/24 11:59:20 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/waitfor.c,v 3.15 2001/12/14 20:01:41 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/waitfor.c,v 3.16 2002/05/31 18:46:12 dawes Exp $ */ #include <X11/Xos.h> /* strings, time, etc */ @@ -66,7 +66,7 @@ #include "osdep.h" #include "os.h" -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif Index: xc/programs/xftcache/Imakefile diff -u xc/programs/xftcache/Imakefile:1.3 xc/programs/xftcache/Imakefile:removed --- xc/programs/xftcache/Imakefile:1.3 Sun Apr 1 10:00:21 2001 +++ xc/programs/xftcache/Imakefile Thu Feb 27 12:35:07 2003 @@ -1,15 +0,0 @@ -XCOMM $XFree86: xc/programs/xftcache/Imakefile,v 1.3 2001/04/01 14:00:21 tsi Exp $ - - - -INCLUDES=$(FREETYPE2INCLUDES) -DEFINES=$(FREETYPE2DEFINES) $(RENDERDEFINES) -DEPLIBS=$(DEPXFTLIB) $(DEPXRENDERLIB) $(DEPXLIB) -LOCAL_LIBRARIES=$(XFTLIB) $(XRENDERLIB) $(XLIB) $(FREETYPE2LIB) - -SRCS=xftcache.c -OBJS=xftcache.o - -ComplexProgramTarget(xftcache) -LinkBuildBinary(ProgramTargetName(xftcache)) - Index: xc/programs/xftcache/xftcache.c diff -u xc/programs/xftcache/xftcache.c:1.1 xc/programs/xftcache/xftcache.c:removed --- xc/programs/xftcache/xftcache.c:1.1 Mon Jan 1 21:48:42 2001 +++ xc/programs/xftcache/xftcache.c Thu Feb 27 12:35:07 2003 @@ -1,88 +0,0 @@ -/* - * $XFree86: xc/programs/xftcache/xftcache.c,v 1.1 2001/01/02 02:48:42 keithp Exp $ - * - * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#include <X11/Xlib.h> -#include <X11/Xft/XftFreetype.h> -#include <stdio.h> - -extern char **XftConfigDirs; - -int -main (int argc, char **argv) -{ - int ret = 0; - XftFontSet *set; - char **dirs; - - if (!XftInit (0)) - { - fprintf (stderr, "Can't init Xft library\n"); - return -1; - } - /* - * This will scan all of the directories into a single database - * which is not useful here - */ - if (!XftInitFtLibrary()) - { - fprintf (stderr, "Can't init FreeType library\n"); - return -1; - } - if (argv[1]) - dirs = argv+1; - else - dirs = XftConfigDirs; - /* - * Now scan all of the directories into separate databases - * and write out the results - */ - while (*dirs) - { - set = XftFontSetCreate (); - if (!set) - { - fprintf (stderr, "Out of memory in \"%s\"\n", *dirs); - ret++; - } - else - { - if (!XftDirScan (set, *dirs, True)) - { - fprintf (stderr, "Can't scan directory \"%s\"\n", *dirs); - ret++; - } - else - { - if (!XftDirSave (set, *dirs)) - { - fprintf (stderr, "Can't save cache in \"%s\"\n", *dirs); - ret++; - } - } - XftFontSetDestroy (set); - } - ++dirs; - } - return ret; -} Index: xc/programs/xftcache/xftcache.man diff -u xc/programs/xftcache/xftcache.man:1.3 xc/programs/xftcache/xftcache.man:removed --- xc/programs/xftcache/xftcache.man:1.3 Thu Feb 8 22:47:56 2001 +++ xc/programs/xftcache/xftcache.man Thu Feb 27 12:35:07 2003 @@ -1,45 +0,0 @@ -.\" -.\" Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. -.\" -.\" Permission to use, copy, modify, distribute, and sell this software and its -.\" documentation for any purpose is hereby granted without fee, provided that -.\" the above copyright notice appear in all copies and that both that -.\" copyright notice and this permission notice appear in supporting -.\" documentation, and that the name of Keith Packard not be used in -.\" advertising or publicity pertaining to distribution of the software without -.\" specific, written prior permission. Keith Packard makes no -.\" representations about the suitability of this software for any purpose. It -.\" is provided "as is" without express or implied warranty. -.\" -.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -.\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR -.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -.\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -.\" PERFORMANCE OF THIS SOFTWARE. -.\" -.\" -.\" $XFree86: xc/programs/xftcache/xftcache.man,v 1.3 2001/02/09 03:47:56 tsi Exp $ -.\" -.TH XFTCACHE 1 __vendorversion__ -.SH NAME -xftcache, XftCache \- create an index of FreeType font files in a directory -.SH SYNOPSIS -.B "xftcache" -.RI [ directory-name -\|.\|.\|. ] -.SH DESCRIPTION -If directory arguments are not given, -.I xftcache -uses each directory in the current Xft configuration. Each directory is -scanned for font files readable by FreeType. A cache is created which -contains properties of each font and the associated filename. This cache is -used to speed application startup when using the Xft library. -.SH FILES -.TP 15 -.B XftCache -Maps file names to font properties. Read by the Xft library at application -startup to locate appropriate fonts. -.SH "SEE ALSO" -Xft(3), Xrender(3) Index: xc/programs/xfwp/pm.c diff -u xc/programs/xfwp/pm.c:1.7 xc/programs/xfwp/pm.c:1.8 --- xc/programs/xfwp/pm.c:1.7 Fri Dec 14 15:01:43 2001 +++ xc/programs/xfwp/pm.c Wed Sep 18 13:11:56 2002 @@ -29,7 +29,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/pm.c,v 1.7 2001/12/14 20:01:43 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/pm.c,v 1.8 2002/09/18 17:11:56 tsi Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -352,7 +352,7 @@ (void) fprintf(stderr, "\tclass = 0x%x, offending minor opcode = %d\n", pMsg->errorClass, pMsg->offendingMinorOpcode); (void) fprintf(stderr, "\tseverity = %d, sequence = %ld\n", - pMsg->severity, pMsg->offendingSequenceNum); + pMsg->severity, (long)pMsg->offendingSequenceNum); IceDisposeCompleteMessage (iceConn, pStart); Index: xc/programs/xgc/Imakefile diff -u xc/programs/xgc/Imakefile:1.1 xc/programs/xgc/Imakefile:1.2 --- xc/programs/xgc/Imakefile:1.1 Sat Feb 12 22:26:25 2000 +++ xc/programs/xgc/Imakefile Fri Feb 15 03:06:56 2002 @@ -1,12 +1,12 @@ XCOMM $XConsortium: Imakefile,v 1.12 93/08/25 10:13:31 rws Exp $ -XCOMM $XFree86: xc/programs/xgc/Imakefile,v 1.1 2000/02/13 03:26:25 dawes Exp $ +XCOMM $XFree86: xc/programs/xgc/Imakefile,v 1.2 2002/02/15 08:06:56 keithp Exp $ DEFINES = SRCS = dashlist.c planemask.c getfile.c tests.c text.c \ choice.c main.c interpret.c record.c testfrac.c OBJS = dashlist.o planemask.o getfile.o tests.o text.o \ choice.o main.o interpret.o record.o testfrac.o \ gram.o lex.o -LOCAL_LIBRARIES = XawClientLibs $(LEXLIB) +LOCAL_LIBRARIES = XawClientLibs DEPLIBS = XawClientDepLibs $(DEPXLIB) SYS_LIBRARIES = MathLibrary YFLAGS = -d Index: xc/programs/xgc/lex.l diff -u xc/programs/xgc/lex.l:1.3 xc/programs/xgc/lex.l:1.4 --- xc/programs/xgc/lex.l:1.3 Wed Apr 5 14:14:07 2000 +++ xc/programs/xgc/lex.l Fri May 31 14:46:13 2002 @@ -1,5 +1,5 @@ /* $XConsortium: lex.l,v 1.8 94/03/31 20:40:44 rws Exp $ */ -/* $XFree86: xc/programs/xgc/lex.l,v 1.3 2000/04/05 18:14:07 dawes Exp $ */ +/* $XFree86: xc/programs/xgc/lex.l,v 1.4 2002/05/31 18:46:13 dawes Exp $ */ /* ** lex file for xgc syntax */ @@ -11,7 +11,7 @@ #include <X11/X.h> #include "gram.h" #include "constants.h" -#if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT) && !defined(__EMX__) +#if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT) && !defined(__UNIXOS2__) int yylineno = 0; #endif %} Index: xc/programs/xgc/tests.c diff -u xc/programs/xgc/tests.c:1.9 xc/programs/xgc/tests.c:1.10 --- xc/programs/xgc/tests.c:1.9 Wed Jan 9 23:29:18 2002 +++ xc/programs/xgc/tests.c Fri May 31 14:46:13 2002 @@ -1,6 +1,6 @@ /* ** $XConsortium: tests.c,v 1.20 91/06/08 18:57:07 rws Exp $ -** $XFree86: xc/programs/xgc/tests.c,v 1.9 2002/01/10 04:29:18 dawes Exp $ +** $XFree86: xc/programs/xgc/tests.c,v 1.10 2002/05/31 18:46:13 dawes Exp $ ** */ @@ -52,7 +52,7 @@ #if !defined(SYSV) static struct timeval starttime; /* starting time for gettimeofday() */ struct timeval endtime; /* ending time for gettimeofday() */ -#if !defined(__EMX__) && !defined(QNX4) +#if !defined(__UNIXOS2__) && !defined(QNX4) static struct rusage startusage; /* starting time for getrusage() */ struct rusage endusage; /* ending time for getrusage() */ #endif @@ -63,13 +63,13 @@ switch (flag) { case StartTimer: /* store initial values */ gettimeofday(&starttime,&tz); -#if !defined(__EMX__) && !defined(QNX4) +#if !defined(__UNIXOS2__) && !defined(QNX4) getrusage(RUSAGE_SELF,&startusage); #endif return((long) NULL); case EndTimer: gettimeofday(&endtime,&tz); /* store final values */ -#if !defined(__EMX__) && !defined(QNX4) +#if !defined(__UNIXOS2__) && !defined(QNX4) getrusage(RUSAGE_SELF,&endusage); #endif @@ -77,7 +77,7 @@ elapsed time = ending time - starting time, but there are three different timers and two different units of time, ack... */ -#if !defined(__EMX__) && !defined(QNX4) +#if !defined(__UNIXOS2__) && !defined(QNX4) elapsedtime = (long) ((long) ((endtime.tv_sec - endusage.ru_utime.tv_sec - endusage.ru_stime.tv_sec - starttime.tv_sec + startusage.ru_utime.tv_sec Index: xc/programs/xinit/Imakefile diff -u xc/programs/xinit/Imakefile:3.15 xc/programs/xinit/Imakefile:3.16 --- xc/programs/xinit/Imakefile:3.15 Thu Nov 1 10:29:05 2001 +++ xc/programs/xinit/Imakefile Fri May 31 14:46:13 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xinit/Imakefile,v 3.15 2001/11/01 15:29:05 dawes Exp $ +XCOMM $XFree86: xc/programs/xinit/Imakefile,v 3.16 2002/05/31 18:46:13 dawes Exp $ #if HasVFork VFORK_DEFINES = -DHAS_VFORK @@ -21,7 +21,7 @@ SRCS1 = xinit.c OBJS1 = xinit.o SAMPLECONFIG = xinitrc - PROGRAMS = xinit + PROGRAMS = ProgramTargetName(xinit) #if HasCookieMaker COOKIEDEFS = -DHAS_COOKIE_MAKER -DMK_COOKIE=MkCookieCmd #endif @@ -30,19 +30,12 @@ ComplexProgramTarget_1(xinit,$(LOCAL_LIBRARIES),$(DEFFILE)) -#ifndef OS2Architecture MakeScriptFromCpp(xinitrc, -DXINITDIR=$(XINITDIR)) -#endif MakeScriptFromCpp(startx, -DXINITDIR=$(XINITDIR) -DBINDIR=$(BINDIR) $(COOKIEDEFS)) EXTRAMANDEFS=-D__xinitdir__=$(XINITDIR) -#ifdef OS2Architecture -InstallNamedProg(startx.cmd,startx.cmd,$(BINDIR)) -InstallManPage(startx,$(MANDIR)) -InstallNonExecFile(xinitrc.cmd,$(XINITDIR)) -#else InstallNamedProg(startx,startx,$(BINDIR)) InstallManPage(startx,$(MANDIR)) @@ -50,7 +43,6 @@ InstallNonExecFile($(SAMPLECONFIG),$(XINITDIR)) #else InstallNonExecFileNoClobber($(SAMPLECONFIG),$(XINITDIR)) -#endif #endif LinkConfDirectory(xinit,.,xinit,.) Index: xc/programs/xinit/startx.cpp diff -u xc/programs/xinit/startx.cpp:3.12 xc/programs/xinit/startx.cpp:3.16 --- xc/programs/xinit/startx.cpp:3.12 Fri Nov 30 15:57:48 2001 +++ xc/programs/xinit/startx.cpp Fri Jan 24 16:30:02 2003 @@ -11,7 +11,7 @@ XCOMM XCOMM Site administrators are STRONGLY urged to write nicer versions. XCOMM -XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.12 2001/11/30 20:57:48 dawes Exp $ +XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16 2003/01/24 21:30:02 herrb Exp $ #ifdef SCO @@ -139,26 +139,34 @@ fi if [ x"$XAUTHORITY" = x ]; then - export XAUTHORITY=$HOME/.Xauthority + XAUTHORITY=$HOME/.Xauthority + export XAUTHORITY fi removelist= #if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE) XCOMM set up default Xauth info for this machine -#ifndef HOSTNAME -#ifdef __linux__ -#define HOSTNAME hostname -f -#else -#define HOSTNAME hostname -#endif -#endif +case `uname` in +Linux*) + if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then + hostname=`hostname -f` + else + hostname=`hostname` + fi + ;; +*) + hostname=`hostname` + ;; +esac authdisplay=${display:-:0} mcookie=`MK_COOKIE` -for displayname in $authdisplay `HOSTNAME`$authdisplay; do +for displayname in $authdisplay $hostname$authdisplay; do if ! xauth list "$displayname" | grep "$displayname " >/dev/null 2>&1; then - xauth add $displayname . $mcookie + xauth << EOF +add $displayname . $mcookie +EOF removelist="$displayname $removelist" fi done Index: xc/programs/xinit/xinit.c diff -u xc/programs/xinit/xinit.c:3.31 xc/programs/xinit/xinit.c:3.32 --- xc/programs/xinit/xinit.c:3.31 Fri Dec 14 15:01:56 2001 +++ xc/programs/xinit/xinit.c Fri May 31 14:46:13 2002 @@ -25,7 +25,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xinit/xinit.c,v 3.31 2001/12/14 20:01:56 dawes Exp $ */ +/* $XFree86: xc/programs/xinit/xinit.c,v 3.32 2002/05/31 18:46:13 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xos.h> @@ -56,7 +56,7 @@ #if !defined(SIGCHLD) && defined(SIGCLD) #define SIGCHLD SIGCLD #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define INCL_DOSMODULEMGR #include <os2.h> #define setpgid(a,b) @@ -65,7 +65,7 @@ #define SHELL "cmd.exe" #define XINITRC "xinitrc.cmd" #define XSERVERRC "xservrc.cmd" -char **envsave; /* to circumvent an EMX problem */ +char **envsave; /* to circumvent an UNIXOS2 problem */ #define environ envsave #endif @@ -91,7 +91,7 @@ #define setpgrp setpgid #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define HAS_EXECVPE #endif @@ -148,11 +148,7 @@ char *default_server = "X"; char *default_display = ":0"; /* choose most efficient */ -#ifndef __EMX__ char *default_client[] = {"xterm", "-geometry", "+1+1", "-n", "login", NULL}; -#else -char *default_client[] = {"/XFree86/bin/xterm.exe", "-geometry", "+1+1", "-n", "login", NULL}; -#endif char *serverargv[100]; char *clientargv[100]; char **server = serverargv + 2; /* make sure room for sh .xserverrc args */ @@ -161,7 +157,7 @@ char *program; Display *xd; /* server connection */ #ifndef SYSV -#if defined(__CYGWIN__) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(CSRG_BASED) || defined(__EMX__) || defined(Lynx) +#if defined(__CYGWIN__) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(CSRG_BASED) || defined(__UNIXOS2__) || defined(Lynx) int status; #else union wait status; @@ -224,7 +220,7 @@ static SIGVAL sigAlarm(int sig) { -#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__EMX__) +#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__UNIXOS2__) signal (sig, sigAlarm); #endif } @@ -232,7 +228,7 @@ static SIGVAL sigUsr1(int sig) { -#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__EMX__) +#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__UNIXOS2__) signal (sig, sigUsr1); #endif } @@ -242,7 +238,7 @@ char **envp) { Execvpe (vec[0], vec, envp); -#ifndef __EMX__ +#ifndef __UNIXOS2__ if (access (vec[0], R_OK) == 0) { vec--; /* back it up to stuff shell in */ vec[0] = SHELL; @@ -252,7 +248,7 @@ return; } -#ifndef __EMX__ +#ifndef __UNIXOS2__ int main(int argc, char *argv[]) #else @@ -271,7 +267,7 @@ struct sigaction sa; #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ envsave = envp; /* circumvent an EMX problem */ /* Check whether the system will run at all */ @@ -298,7 +294,7 @@ * copy the client args. */ if (argc == 0 || -#ifndef __EMX__ +#ifndef __UNIXOS2__ (**argv != '/' && **argv != '.')) { #else (**argv != '/' && **argv != '\\' && **argv != '.' && @@ -334,7 +330,7 @@ * Copy the server args. */ if (argc == 0 || -#ifndef __EMX__ +#ifndef __UNIXOS2__ (**argv != '/' && **argv != '.')) { *sptr++ = default_server; #else @@ -514,7 +510,7 @@ static char *laststring; for (;;) { -#if defined(SYSV) || defined(__EMX__) +#if defined(SYSV) || defined(__UNIXOS2__) alarm(1); if ((pidfound = wait(NULL)) == serverpid) break; @@ -591,7 +587,7 @@ * prevent server from getting sighup from vhangup() * if client is xterm -L */ -#ifndef __EMX__ +#ifndef __UNIXOS2__ setpgrp(0,getpid()); #endif Execute (server, environ); @@ -668,7 +664,7 @@ setuid(getuid()); setpgrp(0, getpid()); environ = newenviron; -#ifdef __EMX__ +#ifdef __UNIXOS2__ #undef environ environ = newenviron; client[0] = (char*)__XOS2RedirRoot(client[0]); @@ -685,7 +681,7 @@ return (clientpid); } -#if !defined(X_NOT_POSIX) || defined(SYSV) || defined(__EMX__) +#if !defined(X_NOT_POSIX) || defined(SYSV) || defined(__UNIXOS2__) #define killpg(pgrp, sig) kill(-(pgrp), sig) #endif Index: xc/programs/xinit/xinit.def diff -u xc/programs/xinit/xinit.def:3.1 xc/programs/xinit/xinit.def:3.2 --- xc/programs/xinit/xinit.def:3.1 Thu Oct 17 11:23:49 1996 +++ xc/programs/xinit/xinit.def Fri May 31 14:46:13 2002 @@ -1,4 +1,4 @@ NAME xinit NOTWINDOWCOMPAT -DESCRIPTION "X11R6 XFree86 3.2 xinit EMX09C" +DESCRIPTION "@#XFREE86:4.2.0#@ $XFree86: xc/programs/xinit/xinit.def,v 3.2 2002/05/31 18:46:13 dawes Exp $" PROTMODE EXETYPE OS2 Index: xc/programs/xkbcomp/Imakefile diff -u xc/programs/xkbcomp/Imakefile:3.18 xc/programs/xkbcomp/Imakefile:3.21 --- xc/programs/xkbcomp/Imakefile:3.18 Wed Oct 10 08:56:58 2001 +++ xc/programs/xkbcomp/Imakefile Sat Feb 15 17:22:43 2003 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xkbcomp/Imakefile,v 3.18 2001/10/10 12:56:58 alanh Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/Imakefile,v 3.21 2003/02/15 22:22:43 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -23,6 +23,7 @@ LOCAL_LIBRARIES = $(XKBFILELIB) $(XLIB) SUBDIRS = $(CROSS) compat geometry keycodes keymap semantics symbols \ types compiled rules + DATAFILES = README README.config README.enhancing ROOT_DEFINES = -DDFLT_XKB_CONFIG_ROOT=\"$(LIBDIR)/xkb\" @@ -38,24 +39,20 @@ @echo "Creating $(LIBDIR)/xkb" MakeDir($(DESTDIR)$(LIBDIR)/xkb) -#ifdef VarDbDirectory -CONFDIR = $(VARDBDIR) -#endif -LinkConfDirectory(xkb,xkb,compiled,compiled) - InstallProgram(xkbcomp,$(LIBDIR)/xkb) +InstallMultiple($(DATAFILES),$(LIBDIR)/xkb) clean:: RemoveFiles(test.h *.xkm *.xkb) ComplexProgramTarget(xkbcomp) +#ifdef OS2Architecture +all:: + $(CP) ProgramTargetName(xkbcomp) / +#endif LinkBuildBinary(ProgramTargetName(xkbcomp)) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) -#ifdef OS2Architecture -all:: - $(CP) ProgramTargetName(xkbcomp) / -#endif Index: xc/programs/xkbcomp/README diff -u /dev/null xc/programs/xkbcomp/README:1.1 --- /dev/null Thu Feb 27 12:35:12 2003 +++ xc/programs/xkbcomp/README Thu Nov 21 23:19:25 2002 @@ -0,0 +1,25 @@ +X Keyboard Extension +-------------------- + +The X Keyboard Extension essentially replaces the core protocol definition of +keyboard. The extension makes possible to clearly and explicitly specify most +aspects of keyboard behaviour on per-key basis and to more closely track the +logical and physical state of the keyboard. It also includes a number of +keyboard controls designed to make keyboards more accessible to people with +physical impairments. + +There are five types of components in the server database corresponing to five +xkb symbolic names: symbols, geometry, keycodes, compat and types which +determine the keyboard behaviour. These five components can combined together +into a resulting keyboard mapping using the 'rules' component. + +The complete specification can be found on +http://www.x-docs.org/XKB/XKBproto.pdf + +For XKB configuration information see 'README.config' file. + +For information how to further enhance XKB configuration see 'README.enhancing' +file. + + +$XFree86: xc/programs/xkbcomp/README,v 1.1 2002/11/22 04:19:25 dawes Exp $ Index: xc/programs/xkbcomp/README.config diff -u /dev/null xc/programs/xkbcomp/README.config:1.3 --- /dev/null Thu Feb 27 12:35:12 2003 +++ xc/programs/xkbcomp/README.config Tue Feb 25 16:32:33 2003 @@ -0,0 +1,198 @@ + The XKB Configuration Guide + + Kamil Toman, Ivan U. Pascal + + 25 November 2002 + + Abstract + + This document describes how to configure XFree86 XKB from a user's + point a few. It converts basic configuration syntax and gives also + a few examples. + +1. Overview + +The XKB configuration is decomposed into a number of components. Selecting +proper parts and combining them back you can achieve most of configurations +you might need. Unless you have a completely atypical keyboard you really +don't need to touch any of xkb configuration files. + +2. Selecting XKB Configuration + +The easiest and the most natural way how to specify a keyboard mapping is tu +use rules component. As its name suggests it describes a number of general +rules how to combine all bits and pieces into a valid and useful keyboard +mapping. All you need to do is to select a suitable rules file and then to +feed it with a few parameters that will adjust the keyboard behaviour to ful- +fill your needs. + +The parameters are: + + o XkbRules - files of rules to be used for keyboard mapping composition + + o XkbModel - name of model of your keyboard type + + o XkbLayout - layout(s) you intend to use + + o XkbVariant - variant(s) of layout you intend to use + + o XkbOptions - extra xkb configuration options + +The proper rules file depends on your vendor. In reality, the commonest file +of rules is xfree86. For each rules file there is a description file named +<vendor-rules>.lst, for instance xfree86.lst which is located in xkb configu- +ration subdirectory rules (for example /etc/X11/xkb/rules). + +2.1 Basic Configuration + +Let's say you want to configure a PC style America keyboard with 104 keys as +described in xfree86.lst. It can be done by simply writing several lines from +below to you XFree86 configuration file (often found as /etc/X11/XF86Config-4 +or /etc/X11/XF86Config): + + Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "pc104" + Option "XkbLayout" "us" + Option "XKbOptions" "" + EndSection + +The values of parameters XkbModel and XkbLayout are really not surprising. +The parameters XkbOptions has been explicitly set to empty set of parameters. +The parameter XkbVariant has been left out. That means the default variant +named basic is loaded. + +Of course, this can be also done at runtime using utility setxkbmap. Shell +command loading the same keyboard mapping would look like: + + setxkbmap -rules xfree86 -model pc104 -layout us -option "" + +The configuration and the shell command would be very analogical for most +other layouts (internationalized mappings). + +2.2 Advanced Configuration + +Since XFree86 4.3.x you can use multi-layouts xkb configuration. What does +it mean? Basically it allows to load up to four different keyboard layouts at +a time. Each such layout would reside in its own group. The groups (unlike +complete keyboard remapping) can be switched very fast from one to another by +a combination of keys. + +Let's say you want to configure your new Logitech cordless desktop keyboard, +you intend to use three different layouts at the same time - us, czech and +german (in this order), and that you are used to Alt-Shift combination for +switching among them. + +Then the configuration snippet could look like this: + + Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "logicordless" + Option "XkbLayout" "us,cz,de" + Option "XKbOptions" "grp:alt_shift_toggle" + EndSection + +Of course, this can be also done at runtime using utility setxkbmap. Shell +command loading the same keyboard mapping would look like: + + setxkmap -rules xfree86 -model logicordless -layout "us,cz,de" \ + -option "grp:alt_shift_toggle" + +2.3 Even More Advanced Configuration + +Okay, let's say you are more demanding. You do like the example above but you +want it to change a bit. Let's imagine you want the czech keyboard mapping to +use another variant but basic. The configuration snippet then changes into: + + Section "InputDevice" + Identifier "Keyboard1" + Driver "Keyboard" + + Option "XkbModel" "logicordless" + Option "XkbLayout" "us,cz,de" + Option "XkbVariant" ",bksl," + Option "XKbOptions" "grp:alt_shift_toggle" + EndSection + +That's seems tricky but it is not. The logic for settings of variants is the +same as for layouts, that means the first and the third variant settings are +left out (set to basic), the second is set to bksl (a special variant with an +enhanced definition of the backslash key). + +Analogically, the loading runtime will change to: + + setxkmap -rules xfree86 -model logicordless -layout "us,cz,de" \ + -variant ",bksl," -option "grp:alt_shift_toggle" + +2.4 Basic Global Options + +See rules/*.lst files. + +3. Direct XKB Configuration + +Generally, you can directly prescribe what configuration of each of basic xkb +components should be used to form the resulting keyboard mapping. This +method is rather "brute force". You precisely need to know the structure and +the meaning of all of used configuration components. + +This method also exposes all xkb configuration details directly into XFree86 +configuration file which is a not very fortunate fact. In rare occasions it +may be needed, though. So how does it work? + +3.1 Basic Components + +There are five basic components used to form a keyboard mapping: + + o key codes - a translation of the scan codes produced by the keyboard + into a suitable symbolic form + + o types - a specification of what various combinations of modifiers pro- + duce + + o key symbols - a translation of symbolic key codes into actual symbols + + o geometry - a description of physical keyboard geometry + + o compatibility maps - a specification of what action should each key pro- + duce in order to preserve compatibility with XKB-unware clients + +3.2 Example Configuration + +Look at the following example: + + Section "InputDevice" + Identifier "Keyboard0" + Driver "Keyboard" + + Option "XkbKeycodes" "xfree86" + Option "XkbTypes" "default" + Option "XkbSymbols" "en_US(pc104)+de+swapcaps" + Option "XkbGeometry" "pc(pc104)" + Option "XkbCompat" "basic+pc+iso9995" + EndSection + +This configuration sets the standard XFree86 default interpretation of key- +board keycodes, sets the default modificator types. The symbol table is com- +posed of extended US keyboard layout in its variant for pc keyboards with 104 +keys plus all keys for german layout are redefined respectively. Also the +logical meaning of Caps-lock and Control keys is swapped. The standard key- +board geometry (physical look) is set to pc style keyboard with 104 keys. The +compatibility map is set to allow basic shifting, to allow Alt keys to be +interpreted and also to allow iso9995 group shifting. + +4. Keymap XKB Configuration + +It is the formerly used way to configure xkb. The user included a special +keymap file which specified the direct xkb configuration. This method has +been obsoleted by previously described rules files which are far more flexi- +ble and allow simpler and more intuitive syntax. It is preserved merely for +compatibility reasons. Avoid using it if it is possible. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Config.sgml,v 1.2 2003/02/25 19:31:02 dawes Exp $ + + +$XFree86: xc/programs/xkbcomp/README.config,v 1.3 2003/02/25 21:32:33 dawes Exp $ Index: xc/programs/xkbcomp/README.enhancing diff -u /dev/null xc/programs/xkbcomp/README.enhancing:1.3 --- /dev/null Thu Feb 27 12:35:12 2003 +++ xc/programs/xkbcomp/README.enhancing Tue Feb 25 16:32:33 2003 @@ -0,0 +1,511 @@ + How to further enhance XKB configuration + + Kamil Toman, Ivan U. Pascal + + 25 November 2002 + + Abstract + + This guide is aimed to relieve one's labour to create a new (inter- + nationalized) keyboard layout. Unlike other documents this guide + accents the keymap developer's point of view. + +1. Overview + +The developer of a new layout should read the xkb protocol specification (The +X Keyboard Extension: Protocol Specification <URL:http://www.x- +docs.org/XKB/XKBproto.pdf>) at least to clarify for himself some xkb-specific +terms used in this document and elsewhere in xkb configuration. Also it shows +wise to understand how the X server and a client digest their keyboard inputs +(with and without xkb). + +A useful source is also Ivan Pascal's text about xkb configuration +<URL:http://www.tsu.ru/~pascal/en/xkb> often referenced throughout this docu- +ment. + +Note that this document covers only enhancements which are to be made to +XFree86 version 4.3.x and above. + +2. The Basics + +At the startup (or at later at user's command) X server starts its xkb key- +board module extension and reads data from a compiled configuration file. + +This compiled configuration file is prepared by the program xkbcomp which +behaves altogether as an ordinary compiler (see man xkbcomp). Its input are +human readable xkb configuration files which are verified and then composed +into a useful xkb configuration. Users don't need to mess with xkbcomp them- +selves, for them it is invisible. Usually, it is started upon X server +startup. + +As you probably already know, the xkb configuration consists of five main +modules: + + Keycodes + Tables that defines translation from keyboard scan codes into + reasonable symbolic names, maximum, minimum legal keycodes, sym- + bolic aliases and description of physically present LED-indica- + tors. The primary sence of this component is to allow definitions + of maps of symbols (see below) to be independent of physical key- + board scancodes. There are two main naming conventions for sym- + bolic names (always four bytes long): + + o names which express some traditional meaning like <SPCE> + (stands for space bar) or + + o names which express some relative positioning on a key- + board, for example <AE01> (an exclamation mark on US key- + boards), on the right there are keys <AE02>, <AE03> etc. + + Types + Types describe how the produced key is changed by active modi- + fiers (like Shift, Control, Alt, ...). There are several prede- + fined types which cover most of used combinations. + + Compat + Compatibility component defines internal behaviour of modifiers. + Using compat component you can assign various actions (elabo- + rately described in xkb specification) to key events. This is + also the place where LED-indicators behaviour is defined. + + Symbols + For i18n purposes, this is the most important table. It defines + what values (=symbols) are assigned to what keycodes (represented + by their symbolic name, see above). There may be defined more + than one value for each key and then it depends on a key type and + on modifiers state (respective compat component) which value will + be the resulting one. + + Geometry + Geometry files aren't used by xkb itself but they may be used by + some external programs to depict a keyboard image. + +All these components have the files located in xkb configuration tree in sub- +directories with the same names (usually in /usr/lib/X11/xkb). + +3. Enhancing XKB Configuration + +Most of xkb enhancements concerns a need to define new output symbols for the +some input key events. In other words, a need to define a new symbol map (for +a new language, standard or just to feel more comfortable when typing text). + +What do you need to do? Generally, you have to define following things: + + o the map of symbols itself + + o the rules to allow users to select the new mapping + + o the description of the new layout + +First of all, it is good to go through existing layouts and to examine them +if there is something you could easily adjust to fit your needs. Even if +there is nothing similar you may get some ideas about basic concepts and used +tricks. + +3.1 Levels And Groups + +Since XFree86 4.3.0 you can use multi-layout concept of xkb configuration. +Though it is still in boundaries of xkb protocol and general ideas, the +keymap designer must obey new rules when creating new maps. In exchange we +get a more powerful and cleaner configuration system. + +Remember that it is the application which must decide which symbol matches +which keycode according to effective modifier state. The X server itself +sends only an input event message to. Of course, usually the general inter- +pretation is processed by Xlib, Xaw, Motif, Qt, Gtk and similar libraries. +The X server only supplies its mapping table (usually upon an application +startup). + +You can think of the X server's symbol table as of a irregular table where +each keycode has its row and where each combination of modifiers determines +exactly one column. The resulting cell then gives the proper symbolic value. +Not all keycodes need to bind different values for different combination of +modifiers. <ENTER> key, for instance, usually doesn't depend on any modi- +fiers so it its row has only one column defined. + +Note that in XKB there is no prior assumption that certain modifiers are +bound to certain columns. By editing proper files (see keytypes (section 4.2, +page 1)) this mapping can be changed as well. + +Unlike the original X protocol the XKB approach is far more flexible. It is +comfortable to add one additional XKB term - group. You can think of a group +as of a vector of columns per each keycode (naturally the dimension of this +vector may differ for different keycodes). What is it good for? The group is +not very useful unless you intend to use more than one logically different +set of symbols (like more than one alphabet) defined in a single mapping +table. But then, the group has a natural meaning - each symbol set has its +own group and changing it means selecting a different one. XKB approach +allows up to four different groups. The columns inside each group are called +(shift) levels. The X server knows the current group and reports it together +with modifier set and with a keycode in key events. + +To sum it up: + + o for each keycode XKB keyboard map contains up to four one-dimensional + tables - groups (logically different symbol sets) + + o for each group of a keycode XKB keyboard map contains some columns - + shift levels (values reached by combinations of Shift, Ctrl, Alt, ... + modifiers) + + o different keycodes can have different number of groups + + o different groups of one keycode can have different number of shift lev- + els + + o the current group number is tracked by X server + +It is clear that if you sanely define levels, groups and sanely bind modi- +fiers and associated actions you can have simultaneously loaded up to four +different symbol sets where each of them would reside in its own group. + +The multi-layout concept provides a facility to manipulate xkb groups and +symbol definitions in a way that allows almost arbitrary composition of pre- +defined symbol tables. To keep it fully functional you have to: + + o define all symbols only in the first group + + o (re)define any modifiers with extra care to avoid strange (anisometric) + behaviour + +4. Defining New Layouts + +See Some Words About XKB internals <URL:http://www.tsu.ru/~pas- +cal/en/xkb/internals.html> for explanation of used xkb terms and problems +addressed by XKB extension. + +See Common notes about XKB configuration files language +<URL:http://www.tsu.ru/~pascal/en/xkb/gram-common.html> for more precise +explanation of syntax of xkb configuration files. + +4.1 Predefined XKB Symbol Sets + +If you are about to define some European symbol map extension, you might want +to use on of four predefined latin alphabet layouts. + +Okay, let's assume you want extend an existing keymap and you want to over- +ride a few keys. Let's take a simple U.K. keyboard as an example (defined in +pc/gb): + + partial default alphanumeric_keys + xkb_symbols "basic" { + include "pc/latin" + + name[Group1]="Great Britain"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE03> { [ 3, sterling, threesuperior, sterling ] }; + key <AC11> { [apostrophe, at, dead_circumflex, dead_caron] }; + key <TLDE> { [ grave, notsign, bar, bar ] }; + key <BKSL> { [numbersign, asciitilde, dead_grave, dead_breve ] }; + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + + modifier_map Mod5 { <RALT> }; + }; + +It defines a new layout in basic variant as an extension of common latin +alphabet layout. The layout (symbol set) name is set to "Great Britain". +Then there are redefinitions of a few keycodes and a modifiers binding. As +you can see the number of shift levels is the same for <AE02>, <AE03>, +<AC11>, <TLDE> and <BKSL> keys but it differs from number of shift levels of +<RALT>. + +Note that the <RALT> key itself is a binding key for Mod5 and that it serves +like a shift modifier for LevelThree, together with Shift as a multi-key. It +is a good habit to respect this rule in a new similar layout. + +Okay, you could now define more variants of your new layout besides basic +simply by including (augmenting/overriding/...) the basic definition and +altering what may be needed. + +4.2 Key Types + +The differences in the number of columns (shift levels) are caused by a dif- +ferent types of keys (see the types definition in section basics). Most key- +codes have implicitly set the keytype in the included "pc/latin" file to +"FOUR_LEVEL_ALPHABETIC". The only exception is <RALT> keycode which is +explicitly set "TWO_LEVEL" keytype. + +All those names refer to pre-defined shift level schemes. Usually you can +choose a suitable shift level scheme from default types scheme list in proper +xkb component's subdirectory. + +The most used schemes are: + + ONE_LEVEL + The key does not depend on any modifiers. The symbol from first + level is always chosen. + + TWO_LEVEL + The key uses a modifier Shift and may have two possible values. + The second level may be chosen by Shift modifier. If Lock modi- + fier (usually Caps-lock) applies the symbol is further processed + using system-specific capitalization rules. If both Shift+Lock + modifier apply the symbol from the second level is taken and cap- + italization rules are applied (and usually have no effect). + + ALPHABETIC + The key uses modifiers Shift and Lock. It may have two possible + values. The second level may be chosen by Shift modifier. When + Lock modifier applies, the symbol from the first level is taken + and further processed using system-specific capitalization rules. + If both Shift+Lock modifier apply the symbol from the first level + is taken and no capitalization rules applied. This is often + called shift-cancels-caps behaviour. + + THREE_LEVEL + Is the same as TWO_LEVEL but it considers an extra modifier - + LevelThree which can be used to gain the symbol value from the + third level. If both Shift+LevelThree modifiers apply the value + from the third level is also taken. As in TWO_LEVEL, the Lock + modifier doesn't influence the resulting level. Only Shift and + LevelThree are taken into that consideration. If the Lock modi- + fier is active capitalization rules are applied on the resulting + symbol. + + FOUR_LEVEL + Is the same as THREE_LEVEL but unlike LEVEL_THREE if both + Shift+LevelThree modifiers apply the symbol is taken from the + fourth level. + + FOUR_LEVEL_ALPHABETIC + Is similar to FOUR_LEVEL but also defines shift-cancels-caps + behaviour as in ALPHABETIC. If Lock+LevelThree apply the symbol + from the third level is taken and the capitalization rules are + applied. If Lock+Shift+LevelThree apply the symbol from the + third level is taken and no capitalization rules are applied. + + KEYPAD + As the name suggest this scheme is primarily used for numeric + keypads. The scheme considers two modifiers - Shift and NumLock. + If none of modifiers applies the symbol from the first level is + taken. If either Shift or NumLock modifiers apply the symbol from + the second level is taken. If both Shift+NumLock modifiers apply + the symbol from the first level is taken. Again, shift-cancels- + caps variant. + + FOUR_LEVEL_KEYPAD + Is similar to KEYPAD scheme but considers also LevelThree modi- + fier. If LevelThree modifier applies the symbol from the third + level is taken. If Shift+LevelThree or NumLock+LevelThree apply + the symbol from the fourth level is taken. If all Shift+Num- + Lock+LevelThree modifiers apply the symbol from the third level + is taken. This also, shift-cancels-caps variant. + +Besides that, there are several schemes for special purposes: + + PC_BREAK + It is similar to TWO_LEVEL scheme but it considers the Control + modifier rather than Shift. That means, the symbol from the sec- + ond level is chosen by Control rather than by Shift. + + PC_SYSRQ + It is similar to TWO_LEVEL scheme but it considers the Alt modi- + fier rather than Shift. That means, the symbol from the second + level is chosen by Alt rather than by Shift. + + CTRL+ALT + The key uses modifiers Alt and Control. It may have two possible + values. If only one modifier (Alt or Control) applies the symbol + from the first level is chosen. Only if both Alt+Control modi- + fiers apply the symbol from the second level is chosen. + + SHIFT+ALT + The key uses modifiers Shift and Alt. It may have two possible + values. If only one modifier (Alt or Shift) applies the symbol + from the first level is chosen. Only if both Alt+Shift modifiers + apply the symbol from the second level is chosen. + +If needed, special caps schemes may be used. They redefine the standard +behaviour of all *ALPHABETIC types. The layouts (maps of symbols) with keys +defined in respective types then automatically change their behaviour accord- +ingly. Possible redefinitions are: + + o internal + + o internal_nocancel + + o shift + + o shift_nocancel + +None of these schemes should be used directly. They are defined merely for +'caps:' xkb options (used to globally change the layouts behaviour). + +Don't alter any of existing key types. If you need a different behaviour cre- +ate a new one. + +4.2.1 More On Definitions Of Types + +When the XKB software deals with a separate type description it gets a com- +plete list of modifiers that should be taken into account from the 'modi- +fiers=<list of modifiers>' list and expects that a set of 'map[<combination +of modifiers>]=<list of modifiers>' instructions that contain the mapping for +each combination of modifiers mentioned in that list. Modifiers that are not +explicitly listed are NOT taken into account when the resulting shift level +is computed. If some combination is omitted the program (subroutine) should +choose the first level for this combination (a quite reasonable behavior). + +Lets consider an example with two modifiers ModOne and ModTwo: + + type "..." { + modifiers = ModOne+ModTwo; + map[None] = Level1; + map[ModOne] = Level2; + }; + +In this case the map statements for ModTwo only and ModOne+ModTwo are omit- +ted. It means that if the ModTwo is active the subroutine can't found +explicit mapping for such combination an will use the default level i.e. +Level1. + +But in the case the type described as: + + type "..." { + modifiers = ModOne; + map[None] = Level1; + map[ModOne] = Level2; + }; + +the ModTwo will not be taken into account and the resulting level depends on +the ModOne state only. That means, ModTwo alone produces the Level1 but the +combination ModOne+ModTwo produces the Level2 as well as ModOne alone. + +What does it mean if the second modifier is the Lock? It means that in the +first case (the Lock itself is included in the list of modifiers but combina- +tions with this modifier aren't mentioned in the map statements) the internal +capitalization rules will be applied to the symbol from the first level. But +in the second case the capitalization will be applied to the symbol chosen +accordingly to he first modifier - and this can be the symbol from the first +as well as from the second level. + +Usually, all modifiers introduced in 'modifiers=<list of modifiers>' list are +used for shift level calculation and then discarded. Sometimes this is not +desirable. If you want to use a modifier for shift level calculation but you +don't want to discard it, you may list in 'preserve[<combination of modi- +fiers>]=<list of modifiers>'. That means, for a given combination all listed +modifiers will be preserved. If the Lock modifier is preserved then the +resulting symbol is passed to internal capitalization routine regardless +whether it has been used for a shift level calculation or not. + +Any key type description can use both real and virtual modifiers. Since real +modifiers always have standard names it is not necessary to explicitly +declare them. Virtual modifiers can have arbitrary names and can be declared +(prior using them) directly in key type definition: + + virtual_modifiers <comma-separated list of modifiers> ; + +as seen in for example basic, pc or mousekeys key type definitions. + +4.3 Rules + +Once you are finished with your symbol map you need to add it to rules file. +The rules file describes how all the five basic keycodes, types, compat, sym- +bols and geometry components should be composed to give a sensible resulting +xkb configuration. + +The main advantage of rules over formerly used keymaps is a possibility to +simply parameterize (once) fixed patterns of configurations and thus to ele- +gantly allow substitutions of various local configurations into predefined +templates. + +A pattern in a rules file (often located in /usr/lib/X11/xkb/rules) can be +parameterized with four other arguments: Model, Layout, Variant and Options. +For most cases parameters model and layout should be sufficient for choosing +a functional keyboard mapping. + +The rules file itself is composed of pattern lines and lines with rules. The +pattern line starts with an exclamation mark ('!') and describes how will the +xkb interpret the following lines (rules). A sample rules file looks like +this: + + ! model = keycodes + macintosh_old = macintosh + ... + * = xfree86 + + ! model = symbols + hp = +inet(%m) + microsoftpro = +inet(%m) + geniuscomfy = +inet(%m) + + ! model layout[1] = symbols + macintosh us = macintosh/us%(v[1]) + * * = pc/pc(%m)+pc/%l[1]%(v[1]) + + ! model layout[2] = symbols + macintosh us = +macintosh/us[2]%(v[2]):2 + * * = +pc/%l[2]%(v[2]):2 + + ! option = types + caps:internal = +caps(internal) + caps:internal_nocancel = +caps(internal_nocancel) + +Each rule defines what certain combination of values on the left side of +equal sign ('=') results in. For example a (keyboard) model macintosh_old +instructs xkb to take definitions of keycodes from file keycodes/macintosh +while the rest of models (represented by a wild card '*') instructs it to +take them from file keycodes/xfree86. The wild card represents all possible +values on the left side which were not found in any of the previous rules. +The more specialized (more complete) rules have higher precedence than gen- +eral ones, i.e. the more general rules supply reasonable default values. + +As you can see some lines contain substitution parameters - the parameters +preceded by the percent sign ('%'). The first alphabetical character after +the percent sign expands to the value which has been found on the left side. +For example +%l%(v) expands into +cz(bksl) if the respective values on the +left side were cz layout in its bksl variant. More, if the layout resp. vari- +ant parameter is followed by a pair of brackets ('[', ']') it means that xkb +should place the layout resp. variant into specified xkb group. If the brack- +ets are omitted the first group is the default value. + +So the second block of rules enhances symbol definitions for some particular +keyboard models with extra keys (for internet, multimedia, ...) . Other mod- +els are left intact. Similarly, the last block overrides some key type defi- +nitions, so the common global behaviour ''shift cancels caps'' or ''shift +doesn't cancel caps'' can be selected. The rest of rules produces special +symbols for each variant us layout of macintosh keyboard and standard pc sym- +bols in appropriate variants as a default. + +4.4 Descriptive Files of Rules + +Now you just need to add a detailed description to <rules>.xml description +file so the other users (and external programs which often parse this file) +know what is your work about. + +4.4.1 Old Descriptive Files + +The formerly used descriptive files were named <rules>.lst Its structure is +very simple and quite self descriptive but such simplicity had also some cav- +ities, for example there was no way how to describe local variants of layouts +and there were problems with the localization of descriptions. To preserve +compatibility with some older programs, new XML descriptive files can be con- +verted to old format '.lst'. + +For each parameter of rules file should be described its meaning. For the +rules file described above the .lst file could look like: + + ! model + pc104 Generic 104-key PC + microsoft Microsoft Natural + pc98 PC-98xx Series + macintosh Original Macintosh + ... + + ! layout + us U.S. English + cz Czech + de German + ... + + ! option + caps:internal uses internal capitalization. Shift cancels Caps + caps:internal_nocancel uses internal capitalization. Shift doesn't cancel Caps + +And that should be it. Enjoy creating your own xkb mapping. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/XKB-Enhancing.sgml,v 1.2 2003/02/25 19:31:02 dawes Exp $ + + +$XFree86: xc/programs/xkbcomp/README.enhancing,v 1.3 2003/02/25 21:32:33 dawes Exp $ Index: xc/programs/xkbcomp/action.c diff -u xc/programs/xkbcomp/action.c:3.8 xc/programs/xkbcomp/action.c:3.11 --- xc/programs/xkbcomp/action.c:3.8 Wed Jan 17 18:45:42 2001 +++ xc/programs/xkbcomp/action.c Fri Nov 22 17:56:04 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/action.c,v 3.8 2001/01/17 23:45:42 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/action.c,v 3.11 2002/11/22 22:56:04 tsi Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -43,13 +43,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes stringToAction(char *str,unsigned *type_rtrn) -#else -stringToAction(str,type_rtrn) - char * str; - unsigned * type_rtrn; -#endif { if (str==NULL) return False; @@ -110,13 +104,7 @@ } static Bool -#if NeedFunctionPrototypes stringToField(char *str,unsigned *field_rtrn) -#else -stringToField(str,field_rtrn) - char * str; - unsigned * field_rtrn; -#endif { if (str==NULL) @@ -161,12 +149,7 @@ } static char * -#if NeedFunctionPrototypes fieldText(unsigned field) -#else -fieldText(field) - unsigned field; -#endif { static char buf[32]; @@ -202,14 +185,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes ReportMismatch(unsigned action,unsigned field,char *type) -#else -ReportMismatch(action,field,type) - unsigned action; - unsigned field; - char * type; -#endif { ERROR2("Value of %s field must be of type %s\n",fieldText(field),type); ACTION1("Action %s definition ignored\n", @@ -218,13 +194,7 @@ } static Bool -#if NeedFunctionPrototypes ReportIllegal(unsigned action,unsigned field) -#else -ReportIllegal(action,field) - unsigned action; - unsigned field; -#endif { ERROR2("Field %s is not defined for an action of type %s\n", fieldText(field), @@ -234,13 +204,7 @@ } static Bool -#if NeedFunctionPrototypes ReportActionNotArray(unsigned action,unsigned field) -#else -ReportActionNotArray(action,field) - unsigned action; - unsigned field; -#endif { ERROR2("The %s field in the %s action is not an array\n", fieldText(field), @@ -250,15 +214,7 @@ } static Bool -#if NeedFunctionPrototypes ReportNotFound(unsigned action,unsigned field,char *what,char *bad) -#else -ReportNotFound(action,field,what,bad) - unsigned action; - unsigned field; - char * what; - char * bad; -#endif { ERROR2("%s named %s not found\n",what,bad); ACTION2("Ignoring the %s field of an %s action\n",fieldText(field), @@ -267,37 +223,20 @@ } static Bool -#if NeedFunctionPrototypes HandleNoAction( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleNoAction(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { return ReportIllegal(action->type,field); } static Bool -#if NeedFunctionPrototypes CheckLatchLockFlags( unsigned action, unsigned field, ExprDef * value, unsigned * flags_inout) -#else -CheckLatchLockFlags(action,field,value,flags_inout) - unsigned action; - unsigned field; - ExprDef * value; - unsigned * flags_inout; -#endif { unsigned tmp; ExprResult result; @@ -313,20 +252,11 @@ } static Bool -#if NeedFunctionPrototypes CheckModifierField( XkbDescPtr xkb, unsigned action, ExprDef * value, unsigned * flags_inout, unsigned * mods_rtrn) -#else -CheckModifierField(xkb,action,value,flags_inout,mods_rtrn) - XkbDescPtr xkb; - unsigned action; - ExprDef * value; - unsigned * flags_inout; - unsigned * mods_rtrn; -#endif { ExprResult rtrn; @@ -349,20 +279,11 @@ } static Bool -#if NeedFunctionPrototypes HandleSetLatchMods( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleSetLatchMods(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { XkbModAction * act; unsigned rtrn; @@ -400,20 +321,11 @@ } static Bool -#if NeedFunctionPrototypes HandleLockMods( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleLockMods(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { XkbModAction * act; unsigned t1,t2; @@ -449,18 +361,10 @@ }; static Bool -#if NeedFunctionPrototypes CheckGroupField( unsigned action, ExprDef * value, unsigned * flags_inout, int * grp_rtrn) -#else -CheckGroupField(action,value,flags_inout,grp_rtrn) - unsigned action; - ExprDef * value; - unsigned * flags_inout; - int * grp_rtrn; -#endif { ExprDef * spec; ExprResult rtrn; @@ -490,20 +394,11 @@ } static Bool -#if NeedFunctionPrototypes HandleSetLatchGroup( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleSetLatchGroup(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { XkbGroupAction * act; unsigned rtrn; @@ -540,20 +435,11 @@ } static Bool -#if NeedFunctionPrototypes HandleLockGroup( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleLockGroup(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { XkbGroupAction * act; unsigned t1; @@ -575,20 +461,11 @@ } static Bool -#if NeedFunctionPrototypes HandleMovePtr( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleMovePtr(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbPtrAction * act; @@ -644,20 +521,11 @@ }; static Bool -#if NeedFunctionPrototypes HandlePtrBtn( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandlePtrBtn(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbPtrBtnAction * act; @@ -709,20 +577,11 @@ }; static Bool -#if NeedFunctionPrototypes HandleSetPtrDflt( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleSetPtrDflt(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbPtrDfltAction * act; @@ -784,20 +643,11 @@ }; static Bool -#if NeedFunctionPrototypes HandleISOLock( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleISOLock(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbISOAction * act; @@ -840,20 +690,11 @@ } static Bool -#if NeedFunctionPrototypes HandleSwitchScreen( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleSwitchScreen(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbSwitchScreenAction * act; @@ -918,20 +759,11 @@ }; static Bool -#if NeedFunctionPrototypes HandleSetLockControls( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleSetLockControls(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbCtrlsAction * act; @@ -959,20 +791,11 @@ }; static Bool -#if NeedFunctionPrototypes HandleActionMessage( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleActionMessage(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbMessageAction * act; @@ -1037,20 +860,11 @@ } static Bool -#if NeedFunctionPrototypes HandleRedirectKey( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleRedirectKey(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbRedirectKeyAction * act; @@ -1098,20 +912,11 @@ } static Bool -#if NeedFunctionPrototypes HandleDeviceBtn( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandleDeviceBtn(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; XkbDeviceBtnAction * act; @@ -1168,21 +973,29 @@ return ReportIllegal(action->type,field); } +static Bool +HandleDeviceValuator( XkbDescPtr xkb, + XkbAnyAction * action, + unsigned field, + ExprDef * array_ndx, + ExprDef * value) +{ +#if 0 +ExprResult rtrn; +XkbDeviceValuatorAction * act; + + act= (XkbDeviceValuatorAction *)action; + /* XXX - Not yet implemented */ +#endif + return False; +} + static Bool -#if NeedFunctionPrototypes HandlePrivate( XkbDescPtr xkb, XkbAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) -#else -HandlePrivate(xkb,action,field,array_ndx,value) - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned field; - ExprDef * array_ndx; - ExprDef * value; -#endif { ExprResult rtrn; @@ -1240,13 +1053,11 @@ } typedef Bool (*actionHandler)( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, XkbAnyAction * /* action */, unsigned /* field */, ExprDef * /* array_ndx */, ExprDef * /* value */ -#endif ); static actionHandler handleAction[XkbSA_NumActions+1] = { @@ -1270,18 +1081,14 @@ HandleRedirectKey /* RedirectKey */, HandleDeviceBtn /* DeviceBtn */, HandleDeviceBtn /* LockDeviceBtn*/, + HandleDeviceValuator /* DeviceValuatr*/, HandlePrivate /* Private */ }; /***====================================================================***/ static void -#if NeedFunctionPrototypes ApplyActionFactoryDefaults(XkbAction *action) -#else -ApplyActionFactoryDefaults(action) - XkbAction * action; -#endif { if (action->type==XkbSA_SetPtrDflt) { /* increment default button */ action->dflt.affect= XkbSA_AffectDfltBtn; @@ -1296,20 +1103,11 @@ int -#if NeedFunctionPrototypes HandleActionDef( ExprDef * def, XkbDescPtr xkb, XkbAnyAction * action, unsigned mergeMode, ActionInfo * info) -#else -HandleActionDef(def,xkb,action,mergeMode,info) - ExprDef * def; - XkbDescPtr xkb; - XkbAnyAction * action; - unsigned mergeMode; - ActionInfo * info; -#endif { ExprDef * arg; register char * str; @@ -1387,22 +1185,12 @@ /***====================================================================***/ int -#if NeedFunctionPrototypes SetActionField( XkbDescPtr xkb, char * elem, char * field, ExprDef * array_ndx, ExprDef * value, ActionInfo ** info_rtrn) -#else -SetActionField(xkb,elem,field,array_ndx,value,info_rtrn) - XkbDescPtr xkb; - char * elem; - char * field; - ExprDef * array_ndx; - ExprDef * value; - ActionInfo ** info_rtrn; -#endif { ActionInfo *new,*old; @@ -1442,11 +1230,7 @@ /***====================================================================***/ void -#if NeedFunctionPrototypes ActionsInit(void) -#else -ActionsInit() -#endif { if (!actionsInitialized) { bzero((char *)&constTrue,sizeof(constTrue)); Index: xc/programs/xkbcomp/action.h diff -u xc/programs/xkbcomp/action.h:3.1 xc/programs/xkbcomp/action.h:3.3 --- xc/programs/xkbcomp/action.h:3.1 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/action.h Sun Jun 30 22:26:00 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/action.h,v 3.3 2002/07/01 02:26:00 tsi Exp $ */ #ifndef ACTION_H #define ACTION_H 1 @@ -65,30 +66,26 @@ } ActionInfo; extern int HandleActionDef( -#if NeedFunctionPrototypes ExprDef * /* def */, XkbDescPtr /* xkb */, XkbAnyAction * /* action */, unsigned /* mergeMode */, ActionInfo * /* info */ -#endif ); extern int SetActionField( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, char * /* elem */, char * /* field */, ExprDef * /* index */, ExprDef * /* value */, ActionInfo ** /* info_rtrn */ -#endif ); extern void ActionsInit( -#if NeedFunctionPrototypes void -#endif ); + +extern LookupEntry ctrlNames[]; #endif /* ACTION_H */ Index: xc/programs/xkbcomp/alias.c diff -u xc/programs/xkbcomp/alias.c:1.3 xc/programs/xkbcomp/alias.c:1.5 --- xc/programs/xkbcomp/alias.c:1.3 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/alias.c Sun Jun 30 22:26:00 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/alias.c,v 1.5 2002/07/01 02:26:00 tsi Exp $ */ #include "xkbcomp.h" #include "misc.h" @@ -33,13 +34,7 @@ #include <X11/extensions/XKBgeom.h> static void -#if NeedFunctionPrototypes HandleCollision(AliasInfo *old,AliasInfo *new) -#else -HandleCollision(old,new) - AliasInfo * old; - AliasInfo * new; -#endif { if (strncmp(new->real,old->real,XkbKeyNameLength)==0) { if (((new->def.fileID==old->def.fileID)&&(warningLevel>0))|| @@ -76,20 +71,11 @@ } static void -#if NeedFunctionPrototypes InitAliasInfo( AliasInfo * info, unsigned merge, unsigned file_id, char * alias, char * real) -#else -InitAliasInfo(info,merge,file_id,alias,real) - AliasInfo * info; - unsigned merge; - unsigned file_id; - char * alias; - char * real; -#endif { bzero(info,sizeof(AliasInfo)); info->def.merge= merge; @@ -100,18 +86,10 @@ } int -#if NeedFunctionPrototypes HandleAliasDef( KeyAliasDef * def, unsigned merge, unsigned file_id, AliasInfo ** info_in) -#else -HandleAliasDef(def,merge,file_id,info_in) - KeyAliasDef * def; - unsigned merge; - unsigned file_id; - AliasInfo ** info_in; -#endif { AliasInfo * info; @@ -138,12 +116,7 @@ } void -#if NeedFunctionPrototypes ClearAliases(AliasInfo **info_in) -#else -ClearAliases(info_in) - AliasInfo ** info_in; -#endif { if ((info_in)&&(*info_in)) ClearCommonInfo(&(*info_in)->def); @@ -151,14 +124,7 @@ } Bool -#if NeedFunctionPrototypes MergeAliases(AliasInfo **into,AliasInfo **merge,unsigned how_merge) -#else -MergeAliases(into,merge,how_merge) - AliasInfo ** into; - AliasInfo ** merge; - unsigned how_merge; -#endif { AliasInfo * tmp; KeyAliasDef def; @@ -184,14 +150,7 @@ } int -#if NeedFunctionPrototypes ApplyAliases(XkbDescPtr xkb,Bool toGeom,AliasInfo **info_in) -#else -ApplyAliases(xkb,toGeom,info_in) - XkbDescPtr xkb; - Bool toGeom; - AliasInfo ** info_in; -#endif { register int i; XkbKeyAliasPtr old,a; Index: xc/programs/xkbcomp/alias.h diff -u xc/programs/xkbcomp/alias.h:1.1.1.4 xc/programs/xkbcomp/alias.h:1.3 --- xc/programs/xkbcomp/alias.h:1.1.1.4 Tue Jan 16 17:54:50 2001 +++ xc/programs/xkbcomp/alias.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/alias.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */ #ifndef ALIAS_H #define ALIAS_H 1 @@ -35,34 +36,26 @@ } AliasInfo; extern int HandleAliasDef( -#if NeedFunctionPrototypes KeyAliasDef * /* def */, unsigned /* merge */, unsigned /* file_id */, AliasInfo ** /* info */ -#endif ); extern void ClearAliases( -#if NeedFunctionPrototypes AliasInfo ** /* info */ -#endif ); extern Bool MergeAliases( -#if NeedFunctionPrototypes AliasInfo ** /* into */, AliasInfo ** /* merge */, unsigned /* how_merge */ -#endif ); extern int ApplyAliases( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, Bool /* toGeom */, AliasInfo ** /* info */ -#endif ); #endif /* ALIAS_H */ Index: xc/programs/xkbcomp/compat.c diff -u xc/programs/xkbcomp/compat.c:3.3 xc/programs/xkbcomp/compat.c:3.4 --- xc/programs/xkbcomp/compat.c:3.3 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/compat.c Tue Jun 4 20:00:37 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/compat.c,v 3.3 2001/01/17 23:45:43 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/compat.c,v 3.4 2002/06/05 00:00:37 dawes Exp $ */ #include <X11/Xos.h> #include "xkbcomp.h" @@ -78,13 +78,7 @@ /***====================================================================***/ static char * -#if NeedFunctionPrototypes siText(SymInterpInfo * si,CompatInfo * info) -#else -siText(si,info) - SymInterpInfo * si; - CompatInfo * info; -#endif { static char buf[128]; @@ -100,13 +94,7 @@ } static void -#if NeedFunctionPrototypes InitCompatInfo(CompatInfo *info,XkbDescPtr xkb) -#else -InitCompatInfo(info,xkb) - CompatInfo * info; - XkbDescPtr xkb; -#endif { register int i; @@ -137,13 +125,7 @@ } static void -#if NeedFunctionPrototypes ClearCompatInfo(CompatInfo *info,XkbDescPtr xkb) -#else -ClearCompatInfo(info,xkb) - CompatInfo * info; - XkbDescPtr xkb; -#endif { register int i; @@ -169,12 +151,7 @@ } static SymInterpInfo * -#if NeedFunctionPrototypes NextInterp(CompatInfo *info) -#else -NextInterp(info) - CompatInfo * info; -#endif { SymInterpInfo * si; @@ -189,13 +166,7 @@ } static SymInterpInfo * -#if NeedFunctionPrototypes FindMatchingInterp(CompatInfo *info,SymInterpInfo *new) -#else -FindMatchingInterp(info,new) - CompatInfo * info; - SymInterpInfo * new; -#endif { SymInterpInfo * old; @@ -210,13 +181,7 @@ } static Bool -#if NeedFunctionPrototypes AddInterp(CompatInfo *info,SymInterpInfo *new) -#else -AddInterp(info,new) - CompatInfo * info; - SymInterpInfo * new; -#endif { unsigned collide; SymInterpInfo * old; @@ -274,14 +239,7 @@ } static Bool -#if NeedFunctionPrototypes AddGroupCompat(CompatInfo *info,unsigned group,GroupCompatInfo *newGC) -#else -AddGroupCompat(info,group,newGC) - CompatInfo * info; - unsigned group; - GroupCompatInfo * newGC; -#endif { GroupCompatInfo * gc; unsigned merge; @@ -304,18 +262,10 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes ResolveStateAndPredicate( ExprDef * expr, unsigned * pred_rtrn, unsigned * mods_rtrn, CompatInfo * info) -#else -ResolveStateAndPredicate(expr,pred_rtrn,mods_rtrn,info) - ExprDef * expr; - unsigned * pred_rtrn; - unsigned * mods_rtrn; - CompatInfo * info; -#endif { ExprResult result; @@ -364,16 +314,9 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes MergeIncludedCompatMaps( CompatInfo * into, CompatInfo * from, unsigned merge) -#else -MergeIncludedCompatMaps(into,from,merge) - CompatInfo * into; - CompatInfo * from; - unsigned merge; -#endif { SymInterpInfo * si; LEDInfo * led,*rtrn,*next; @@ -413,27 +356,17 @@ } typedef void (*FileHandler)( -#if NeedFunctionPrototypes XkbFile * /* rtrn */, XkbDescPtr /* xkb */, unsigned /* merge */, CompatInfo * /* info */ -#endif ); static Bool -#if NeedFunctionPrototypes HandleIncludeCompatMap( IncludeStmt * stmt, XkbDescPtr xkb, CompatInfo * info, FileHandler hndlr) -#else -HandleIncludeCompatMap(stmt,xkb,info,hndlr) - IncludeStmt * stmt; - XkbDescPtr xkb; - CompatInfo * info; - FileHandler hndlr; -#endif { unsigned newMerge; XkbFile * rtrn; @@ -515,22 +448,12 @@ }; static int -#if NeedFunctionPrototypes SetInterpField( SymInterpInfo * si, XkbDescPtr xkb, char * field, ExprDef * arrayNdx, ExprDef * value, CompatInfo * info) -#else -SetInterpField(si,xkb,field,arrayNdx,value,info) - SymInterpInfo * si; - XkbDescPtr xkb; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - CompatInfo * info; -#endif { int ok= 1; ExprResult tmp; @@ -608,14 +531,7 @@ }; static int -#if NeedFunctionPrototypes HandleInterpVar(VarDef *stmt,XkbDescPtr xkb,CompatInfo *info) -#else -HandleInterpVar(stmt,xkb,info) - VarDef * stmt; - XkbDescPtr xkb; - CompatInfo * info; -#endif { ExprResult elem,field; ExprDef * ndx; @@ -632,15 +548,7 @@ } static int -#if NeedFunctionPrototypes HandleInterpBody(VarDef *def,XkbDescPtr xkb,SymInterpInfo *si,CompatInfo *info) -#else -HandleInterpBody(def,xkb,si,info) - VarDef * def; - XkbDescPtr xkb; - SymInterpInfo * si; - CompatInfo * info; -#endif { int ok= 1; ExprResult tmp,field; @@ -659,15 +567,7 @@ } static int -#if NeedFunctionPrototypes HandleInterpDef(InterpDef *def,XkbDescPtr xkb,unsigned merge,CompatInfo *info) -#else -HandleInterpDef(def,xkb,merge,info) - InterpDef * def; - XkbDescPtr xkb; - unsigned merge; - CompatInfo * info; -#endif { unsigned pred,mods; SymInterpInfo si; @@ -698,18 +598,10 @@ } static int -#if NeedFunctionPrototypes HandleGroupCompatDef( GroupCompatDef * def, XkbDescPtr xkb, unsigned merge, CompatInfo * info) -#else -HandleGroupCompatDef(def,xkb,merge,info) - GroupCompatDef * def; - XkbDescPtr xkb; - unsigned merge; - CompatInfo * info; -#endif { ExprResult val; GroupCompatInfo tmp; @@ -734,18 +626,10 @@ } static void -#if NeedFunctionPrototypes HandleCompatMapFile( XkbFile * file, XkbDescPtr xkb, unsigned merge, CompatInfo * info) -#else -HandleCompatMapFile(file,xkb,merge,info) - XkbFile *file; - XkbDescPtr xkb; - unsigned merge; - CompatInfo *info; -#endif { ParseCommon *stmt; @@ -810,18 +694,10 @@ } static void -#if NeedFunctionPrototypes CopyInterps( CompatInfo * info, XkbCompatMapPtr compat, Bool needSymbol, unsigned pred) -#else -CopyInterps(info,compat,needSymbol,pred) - CompatInfo * info; - XkbCompatMapPtr compat; - Bool needSymbol; - unsigned pred; -#endif { SymInterpInfo * si; @@ -841,18 +717,10 @@ } Bool -#if NeedFunctionPrototypes CompileCompatMap( XkbFile * file, XkbFileInfo * result, unsigned merge, LEDInfo ** unboundLEDs) -#else -CompileCompatMap(file,result,merge,unboundLEDs) - XkbFile * file; - XkbFileInfo * result; - unsigned merge; - LEDInfo ** unboundLEDs; -#endif { int i; CompatInfo info; Index: xc/programs/xkbcomp/compat.h diff -u /dev/null xc/programs/xkbcomp/compat.h:1.1 --- /dev/null Thu Feb 27 12:35:13 2003 +++ xc/programs/xkbcomp/compat.h Tue Jun 4 20:00:37 2002 @@ -0,0 +1,8 @@ +/* $XFree86: xc/programs/xkbcomp/compat.h,v 1.1 2002/06/05 00:00:37 dawes Exp $ */ + +#ifndef COMPAT_H +#define COMPAT_H 1 + +extern LookupEntry groupNames[]; + +#endif /* COMPAT_H */ Index: xc/programs/xkbcomp/expr.c diff -u xc/programs/xkbcomp/expr.c:3.5 xc/programs/xkbcomp/expr.c:3.6 --- xc/programs/xkbcomp/expr.c:3.5 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/expr.c Tue Jun 4 20:00:37 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.5 2001/01/17 23:45:43 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.6 2002/06/05 00:00:37 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -35,12 +35,7 @@ /***====================================================================***/ char * -#if NeedFunctionPrototypes exprOpText(unsigned type) -#else -exprOpText(type) - unsigned type; -#endif { static char buf[32]; @@ -101,12 +96,7 @@ } char * -#if NeedFunctionPrototypes exprTypeText(unsigned type) -#else -exprTypeText(type) - unsigned type; -#endif { static char buf[20]; @@ -137,18 +127,10 @@ } int -#if NeedFunctionPrototypes ExprResolveLhs( ExprDef * expr, ExprResult * elem_rtrn, ExprResult * field_rtrn, ExprDef ** index_rtrn) -#else -ExprResolveLhs(expr,elem_rtrn,field_rtrn,index_rtrn) - ExprDef * expr; - ExprResult * elem_rtrn; - ExprResult * field_rtrn; - ExprDef ** index_rtrn; -#endif { switch (expr->op) { case ExprIdent: @@ -172,20 +154,11 @@ } Bool -#if NeedFunctionPrototypes SimpleLookup( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -SimpleLookup(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { LookupEntry * entry; register char * str; @@ -208,20 +181,11 @@ } Bool -#if NeedFunctionPrototypes RadioLookup( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -RadioLookup(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { register char * str; int rg; @@ -246,20 +210,11 @@ } int -#if NeedFunctionPrototypes TableLookup( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -TableLookup(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { LookupTable * tbl= (LookupTable *)priv; register char * str; @@ -294,39 +249,21 @@ }; int -#if NeedFunctionPrototypes LookupModIndex( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -LookupModIndex(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { return SimpleLookup((XPointer)modIndexNames,elem,field,type,val_rtrn); } int -#if NeedFunctionPrototypes LookupModMask( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -LookupModMask(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { char *str; @@ -352,18 +289,10 @@ } int -#if NeedFunctionPrototypes ExprResolveModIndex( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveModIndex(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; char *bogus= NULL; @@ -430,18 +359,10 @@ } int -#if NeedFunctionPrototypes ExprResolveModMask( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveModMask(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { LookupPriv priv; @@ -452,18 +373,10 @@ } int -#if NeedFunctionPrototypes ExprResolveBoolean( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveBoolean(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; char * bogus= NULL; @@ -538,18 +451,10 @@ } int -#if NeedFunctionPrototypes ExprResolveFloat( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveFloat(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; ExprResult leftRtrn,rightRtrn; @@ -650,18 +555,10 @@ } int -#if NeedFunctionPrototypes ExprResolveInteger( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveInteger(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; ExprResult leftRtrn,rightRtrn; @@ -762,18 +659,10 @@ } int -#if NeedFunctionPrototypes ExprResolveString( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveString(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; ExprResult leftRtrn,rightRtrn; @@ -859,18 +748,10 @@ } int -#if NeedFunctionPrototypes ExprResolveKeyName( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveKeyName(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; ExprDef * left; @@ -938,14 +819,7 @@ /***====================================================================***/ int -#if NeedFunctionPrototypes ExprResolveEnum(ExprDef *expr,ExprResult *val_rtrn,LookupEntry *values) -#else -ExprResolveEnum(expr,val_rtrn,values) - ExprDef * expr; - ExprResult * val_rtrn; - LookupEntry * values; -#endif { if (expr->op!=ExprIdent) { ERROR1("Found a %s where an enumerated value was expected\n", @@ -970,18 +844,10 @@ } int -#if NeedFunctionPrototypes ExprResolveMask( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveMask(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; ExprResult leftRtrn,rightRtrn; @@ -1078,18 +944,10 @@ } int -#if NeedFunctionPrototypes ExprResolveKeySym( ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) -#else -ExprResolveKeySym(expr,val_rtrn,lookup,lookupPriv) - ExprDef * expr; - ExprResult * val_rtrn; - IdentLookupFunc lookup; - XPointer lookupPriv; -#endif { int ok= 0; KeySym sym; Index: xc/programs/xkbcomp/expr.h diff -u xc/programs/xkbcomp/expr.h:3.1 xc/programs/xkbcomp/expr.h:3.3 --- xc/programs/xkbcomp/expr.h:3.1 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/expr.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/expr.h,v 3.3 2002/07/01 02:26:01 tsi Exp $ */ #ifndef EXPR_H #define EXPR_H 1 @@ -35,33 +36,23 @@ XkbKeyNameRec keyName; } ExprResult; -_XFUNCPROTOBEGIN - typedef Bool (*IdentLookupFunc)( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern char *exprTypeText( -#if NeedFunctionPrototypes unsigned /* type */ -#endif ); -_XFUNCPROTOEND - extern int ExprResolveLhs( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* elem_rtrn */, ExprResult * /* field_rtrn */, ExprDef ** /* index_rtrn */ -#endif ); typedef struct _LookupPriv { @@ -81,154 +72,118 @@ struct _LookupTable * nextElement; } LookupTable; -_XFUNCPROTOBEGIN - extern char *exprOpText( -#if NeedFunctionPrototypes unsigned /* type */ -#endif ); extern int RadioLookup( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int SimpleLookup( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int TableLookup( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int LookupModIndex( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int LookupModMask( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int ExprResolveModIndex( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveModMask( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* priv */ -#endif ); extern int ExprResolveBoolean( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveInteger( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveFloat( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveString( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveKeyName( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveEnum( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, LookupEntry * /* values */ -#endif ); extern int ExprResolveMask( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); extern int ExprResolveKeySym( -#if NeedFunctionPrototypes ExprDef * /* expr */, ExprResult * /* val_rtrn */, IdentLookupFunc /* lookup */, XPointer /* lookupPriv */ -#endif ); - -_XFUNCPROTOEND #endif /* EXPR_H */ Index: xc/programs/xkbcomp/geometry.c diff -u xc/programs/xkbcomp/geometry.c:1.3 xc/programs/xkbcomp/geometry.c:1.4 --- xc/programs/xkbcomp/geometry.c:1.3 Wed Dec 19 16:30:30 2001 +++ xc/programs/xkbcomp/geometry.c Tue Jun 4 20:00:37 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/geometry.c,v 1.3 2001/12/19 21:30:30 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/geometry.c,v 1.4 2002/06/05 00:00:37 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -241,13 +241,7 @@ } GeometryInfo; static char * -#if NeedFunctionPrototypes ddText(Display *dpy,DoodadInfo *di) -#else -ddText(dpy,di) - Display * dpy; - DoodadInfo * di; -#endif { static char buf[64]; @@ -266,13 +260,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes InitPropertyInfo(PropertyInfo *pi,GeometryInfo *info) -#else -InitPropertyInfo(pi,info) - PropertyInfo * pi; - GeometryInfo * info; -#endif { pi->defs.defined= 0; pi->defs.fileID= info->fileID; @@ -282,13 +270,7 @@ } static void -#if NeedFunctionPrototypes FreeProperties(PropertyInfo *pi,GeometryInfo *info) -#else -FreeProperties(pi,info) - PropertyInfo * pi; - GeometryInfo * info; -#endif { PropertyInfo * tmp; PropertyInfo * next; @@ -310,14 +292,7 @@ } static void -#if NeedFunctionPrototypes InitKeyInfo(KeyInfo *key,RowInfo *row,GeometryInfo *info) -#else -InitKeyInfo(key,row,info) - KeyInfo * key; - RowInfo * row; - GeometryInfo * info; -#endif { if (key!=&row->dfltKey) { @@ -338,12 +313,7 @@ } static void -#if NeedFunctionPrototypes ClearKeyInfo(KeyInfo *key) -#else -ClearKeyInfo(key) - KeyInfo * key; -#endif { key->defs.defined&= ~_GK_Default; strcpy(key->name,"default"); @@ -354,14 +324,7 @@ } static void -#if NeedFunctionPrototypes FreeKeys(KeyInfo *key,RowInfo *row,GeometryInfo *info) -#else -FreeKeys(key,row,info) - KeyInfo * key; - RowInfo * row; - GeometryInfo * info; -#endif { KeyInfo * tmp; KeyInfo * next; @@ -379,14 +342,7 @@ } static void -#if NeedFunctionPrototypes InitRowInfo(RowInfo *row,SectionInfo *section,GeometryInfo *info) -#else -InitRowInfo(row,section,info) - RowInfo * row; - SectionInfo * section; - GeometryInfo * info; -#endif { if (row!= §ion->dfltRow) { *row= section->dfltRow; @@ -407,13 +363,7 @@ } static void -#if NeedFunctionPrototypes ClearRowInfo(RowInfo *row,GeometryInfo *info) -#else -ClearRowInfo(row,info) - RowInfo * row; - GeometryInfo * info; -#endif { row->defs.defined&= ~_GR_Default; row->top= row->left= 0; @@ -427,14 +377,7 @@ } static void -#if NeedFunctionPrototypes FreeRows(RowInfo *row,SectionInfo *section,GeometryInfo *info) -#else -FreeRows(row,section,info) - RowInfo * row; - SectionInfo * section; - GeometryInfo * info; -#endif { RowInfo * next; RowInfo * tmp; @@ -452,13 +395,7 @@ } static DoodadInfo * -#if NeedFunctionPrototypes FindDoodadByType(DoodadInfo *di,unsigned type) -#else -FindDoodadByType(di,type) - DoodadInfo * di; - unsigned type; -#endif { while (di) { if (di->type==type) @@ -469,13 +406,7 @@ } static DoodadInfo * -#if NeedFunctionPrototypes FindDoodadByName(DoodadInfo *di,Atom name) -#else -FindDoodadByName(di,name) - DoodadInfo * di; - Atom name; -#endif { while (di) { if (di->name==name) @@ -486,15 +417,7 @@ } static void -#if NeedFunctionPrototypes InitDoodadInfo(DoodadInfo *di,unsigned type,SectionInfo *si,GeometryInfo *info) -#else -InitDoodadInfo(di,type,si,info) - DoodadInfo * di; - unsigned type; - SectionInfo * si; - GeometryInfo * info; -#endif { DoodadInfo * dflt; @@ -527,12 +450,7 @@ } static void -#if NeedFunctionPrototypes ClearDoodadInfo(DoodadInfo *di) -#else -ClearDoodadInfo(di) - DoodadInfo * di; -#endif { CommonInfo defs; @@ -544,12 +462,7 @@ } static void -#if NeedFunctionPrototypes ClearOverlayInfo(OverlayInfo *ol) -#else -ClearOverlayInfo(ol) - OverlayInfo * ol; -#endif { if (ol && ol->keys) { ol->keys= (OverlayKeyInfo *)ClearCommonInfo(&ol->keys->defs); @@ -559,14 +472,7 @@ } static void -#if NeedFunctionPrototypes FreeDoodads(DoodadInfo *di,SectionInfo *si,GeometryInfo *info) -#else -FreeDoodads(di,si,info) - DoodadInfo * di; - SectionInfo * si; - GeometryInfo * info; -#endif { DoodadInfo * tmp; DoodadInfo * next; @@ -594,13 +500,7 @@ } static void -#if NeedFunctionPrototypes InitSectionInfo(SectionInfo *si,GeometryInfo *info) -#else -InitSectionInfo(si,info) - SectionInfo * si; - GeometryInfo * info; -#endif { if (si!=&info->dfltSection) { *si= info->dfltSection; @@ -623,14 +523,7 @@ } static void -#if NeedFunctionPrototypes DupSectionInfo(SectionInfo *into,SectionInfo *from,GeometryInfo *info) -#else -DupSectionInfo(into,from,info) - SectionInfo * into; - SectionInfo * from; - GeometryInfo * info; -#endif { CommonInfo defs; @@ -651,13 +544,7 @@ } static void -#if NeedFunctionPrototypes ClearSectionInfo(SectionInfo *si,GeometryInfo *info) -#else -ClearSectionInfo(si,info) - SectionInfo * si; - GeometryInfo * info; -#endif { si->defs.defined&= ~_GS_Default; @@ -679,13 +566,7 @@ } static void -#if NeedFunctionPrototypes FreeSections(SectionInfo *si,GeometryInfo *info) -#else -FreeSections(si,info) - SectionInfo * si; - GeometryInfo * info; -#endif { SectionInfo * tmp; SectionInfo * next; @@ -703,13 +584,7 @@ } static void -#if NeedFunctionPrototypes FreeShapes(ShapeInfo *si,GeometryInfo *info) -#else -FreeShapes(si,info) - ShapeInfo * si; - GeometryInfo * info; -#endif { ShapeInfo * tmp; ShapeInfo * next; @@ -743,14 +618,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes InitGeometryInfo(GeometryInfo *info,unsigned fileID,unsigned merge) -#else -InitGeometryInfo(info,fileID,merge) - GeometryInfo * info; - unsigned fileID; - unsigned merge; -#endif { bzero(info,sizeof(GeometryInfo)); info->fileID= fileID; @@ -761,12 +629,7 @@ } static void -#if NeedFunctionPrototypes ClearGeometryInfo(GeometryInfo *info) -#else -ClearGeometryInfo(info) - GeometryInfo * info; -#endif { if (info->name) uFree(info->name); @@ -790,12 +653,7 @@ /***====================================================================***/ static PropertyInfo * -#if NeedFunctionPrototypes NextProperty(GeometryInfo *info) -#else -NextProperty(info) - GeometryInfo * info; -#endif { PropertyInfo * pi; @@ -810,13 +668,7 @@ } static PropertyInfo * -#if NeedFunctionPrototypes FindProperty(GeometryInfo *info,char *name) -#else -FindProperty(info,name) - GeometryInfo * info; - char * name; -#endif { PropertyInfo * old; @@ -830,13 +682,7 @@ } static Bool -#if NeedFunctionPrototypes AddProperty(GeometryInfo *info,PropertyInfo *new) -#else -AddProperty(info,new) - GeometryInfo * info; - PropertyInfo * new; -#endif { PropertyInfo * old; @@ -876,12 +722,7 @@ /***====================================================================***/ static ShapeInfo * -#if NeedFunctionPrototypes NextShape(GeometryInfo *info) -#else -NextShape(info) - GeometryInfo * info; -#endif { ShapeInfo * si; @@ -897,15 +738,7 @@ } static ShapeInfo * -#if NeedFunctionPrototypes FindShape(GeometryInfo *info,Atom name,char *type,char *which) -#else -FindShape(info,name,type,which) - GeometryInfo * info; - Atom name; - char * type; - char * which; -#endif { ShapeInfo * old; @@ -928,13 +761,7 @@ } static Bool -#if NeedFunctionPrototypes AddShape(GeometryInfo *info,ShapeInfo *new) -#else -AddShape(info,new) - GeometryInfo * info; - ShapeInfo * new; -#endif { ShapeInfo * old; @@ -973,13 +800,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes ReplaceDoodad(DoodadInfo *into,DoodadInfo *from) -#else -ReplaceDoodad(into,from) - DoodadInfo * into; - DoodadInfo * from; -#endif { CommonInfo * next; @@ -994,13 +815,7 @@ } static DoodadInfo * -#if NeedFunctionPrototypes NextDfltDoodad(SectionInfo *si,GeometryInfo *info) -#else -NextDfltDoodad(si,info) - SectionInfo * si; - GeometryInfo * info; -#endif { DoodadInfo * di; @@ -1019,13 +834,7 @@ } static DoodadInfo * -#if NeedFunctionPrototypes NextDoodad(SectionInfo *si,GeometryInfo *info) -#else -NextDoodad(si,info) - SectionInfo * si; - GeometryInfo * info; -#endif { DoodadInfo * di; @@ -1046,14 +855,7 @@ } static Bool -#if NeedFunctionPrototypes AddDoodad(SectionInfo *si,GeometryInfo *info,DoodadInfo *new) -#else -AddDoodad(si,info,new) - SectionInfo * si; - GeometryInfo * info; - DoodadInfo * new; -#endif { DoodadInfo * old; @@ -1088,14 +890,7 @@ } static DoodadInfo * -#if NeedFunctionPrototypes FindDfltDoodadByTypeName(char *name,SectionInfo *si,GeometryInfo *info) -#else -FindDfltDoodadByTypeName(name,si,info) - char * name; - SectionInfo * si; - GeometryInfo * info; -#endif { DoodadInfo * dflt; unsigned type; @@ -1124,14 +919,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes AddOverlay(SectionInfo *si,GeometryInfo *info,OverlayInfo *new) -#else -AddOverlay(si,info,new) - SectionInfo *si; - GeometryInfo *info; - OverlayInfo *new; -#endif { OverlayInfo * old; @@ -1187,12 +975,7 @@ /***====================================================================***/ static SectionInfo * -#if NeedFunctionPrototypes NextSection(GeometryInfo *info) -#else -NextSection(info) - GeometryInfo * info; -#endif { SectionInfo * si; @@ -1211,13 +994,7 @@ } static SectionInfo * -#if NeedFunctionPrototypes FindMatchingSection(GeometryInfo *info,SectionInfo *new) -#else -FindMatchingSection(info,new) - GeometryInfo * info; - SectionInfo * new; -#endif { SectionInfo * old; @@ -1229,13 +1006,7 @@ } static Bool -#if NeedFunctionPrototypes AddSection(GeometryInfo *info,SectionInfo *new) -#else -AddSection(info,new) - GeometryInfo * info; - SectionInfo * new; -#endif { SectionInfo * old; @@ -1284,12 +1055,7 @@ /***====================================================================***/ static RowInfo * -#if NeedFunctionPrototypes NextRow(SectionInfo *si) -#else -NextRow(si) - SectionInfo * si; -#endif { RowInfo * row; @@ -1307,13 +1073,7 @@ } static Bool -#if NeedFunctionPrototypes AddRow(SectionInfo *si,RowInfo *new) -#else -AddRow(si,new) - SectionInfo * si; - RowInfo * new; -#endif { RowInfo * old; @@ -1330,12 +1090,7 @@ /***====================================================================***/ static KeyInfo * -#if NeedFunctionPrototypes NextKey(RowInfo *row) -#else -NextKey(row) - RowInfo * row; -#endif { KeyInfo * key; @@ -1350,13 +1105,7 @@ } static Bool -#if NeedFunctionPrototypes AddKey(RowInfo *row,KeyInfo *new) -#else -AddKey(row,new) - RowInfo * row; - KeyInfo * new; -#endif { KeyInfo * old; @@ -1372,14 +1121,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes MergeIncludedGeometry(GeometryInfo *into,GeometryInfo *from,unsigned merge) -#else -MergeIncludedGeometry(into,from,merge) - GeometryInfo * into; - GeometryInfo * from; - unsigned merge; -#endif { Bool clobber; @@ -1454,25 +1196,15 @@ } typedef void (*FileHandler)( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbDescPtr /* xkb */, unsigned /* merge */, GeometryInfo * /* info */ -#endif ); static Bool -#if NeedFunctionPrototypes HandleIncludeGeometry(IncludeStmt *stmt,XkbDescPtr xkb,GeometryInfo *info, FileHandler hndlr) -#else -HandleIncludeGeometry(stmt,xkb,info,hndlr) - IncludeStmt * stmt; - XkbDescPtr xkb; - GeometryInfo * info; - FileHandler hndlr; -#endif { unsigned newMerge; XkbFile * rtrn; @@ -1539,20 +1271,11 @@ } static int -#if NeedFunctionPrototypes SetShapeField( ShapeInfo * si, char * field, ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) -#else -SetShapeField(si,field,arrayNdx,value,info) - ShapeInfo * si; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - GeometryInfo * info; -#endif { ExprResult tmp; @@ -1577,22 +1300,12 @@ } static int -#if NeedFunctionPrototypes SetShapeDoodadField( DoodadInfo * di, char * field, ExprDef * arrayNdx, ExprDef * value, SectionInfo * si, GeometryInfo * info) -#else -SetShapeDoodadField(di,field,arrayNdx,value,si,info) - DoodadInfo * di; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SectionInfo * si; - GeometryInfo * info; -#endif { ExprResult tmp; char * typeName; @@ -1645,22 +1358,12 @@ #define FIELD_USHORT 2 static int -#if NeedFunctionPrototypes SetTextDoodadField( DoodadInfo * di, char * field, ExprDef * arrayNdx, ExprDef * value, SectionInfo * si, GeometryInfo * info) -#else -SetTextDoodadField(di,field,arrayNdx,value,si,info) - DoodadInfo * di; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SectionInfo * si; - GeometryInfo * info; -#endif { ExprResult tmp; unsigned def; @@ -1781,22 +1484,12 @@ } static int -#if NeedFunctionPrototypes SetIndicatorDoodadField( DoodadInfo * di, char * field, ExprDef * arrayNdx, ExprDef * value, SectionInfo * si, GeometryInfo * info) -#else -SetIndicatorDoodadField(di,field,arrayNdx,value,si,info) - DoodadInfo * di; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SectionInfo * si; - GeometryInfo * info; -#endif { ExprResult tmp; @@ -1830,22 +1523,12 @@ } static int -#if NeedFunctionPrototypes SetLogoDoodadField( DoodadInfo * di, char * field, ExprDef * arrayNdx, ExprDef * value, SectionInfo * si, GeometryInfo * info) -#else -SetLogoDoodadField(di,field,arrayNdx,value,si,info) - DoodadInfo * di; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SectionInfo * si; - GeometryInfo * info; -#endif { ExprResult tmp; char * typeName= "logo doodad"; @@ -1905,22 +1588,12 @@ } static int -#if NeedFunctionPrototypes SetDoodadField( DoodadInfo * di, char * field, ExprDef * arrayNdx, ExprDef * value, SectionInfo * si, GeometryInfo * info) -#else -SetDoodadField(di,field,arrayNdx,value,si,info) - DoodadInfo * di; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SectionInfo * si; - GeometryInfo * info; -#endif { ExprResult tmp; @@ -2000,20 +1673,11 @@ } static int -#if NeedFunctionPrototypes SetSectionField( SectionInfo * si, char * field, ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) -#else -SetSectionField(si,field,arrayNdx,value,info) - SectionInfo * si; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - GeometryInfo * info; -#endif { unsigned short * pField; unsigned def; @@ -2082,20 +1746,11 @@ } static int -#if NeedFunctionPrototypes SetRowField( RowInfo * row, char * field, ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) -#else -SetRowField(row,field,arrayNdx,value,info) - RowInfo * row; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - GeometryInfo * info; -#endif { ExprResult tmp; @@ -2146,20 +1801,11 @@ } static int -#if NeedFunctionPrototypes SetKeyField( KeyInfo *key, char *field, ExprDef *arrayNdx, ExprDef *value, GeometryInfo *info) -#else -SetKeyField(key,field,arrayNdx,value,info) - KeyInfo * key; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - GeometryInfo * info; -#endif { ExprResult tmp; @@ -2221,14 +1867,7 @@ } static int -#if NeedFunctionPrototypes SetGeometryProperty(GeometryInfo *info,char *property,ExprDef *value) -#else -SetGeometryProperty(info,property,value) - GeometryInfo * info; - char * property; - ExprDef * value; -#endif { PropertyInfo pi; ExprResult result; @@ -2246,14 +1885,7 @@ } static int -#if NeedFunctionPrototypes HandleGeometryVar(VarDef *stmt,XkbDescPtr xkb,GeometryInfo *info) -#else -HandleGeometryVar(stmt,xkb,info) - VarDef * stmt; - XkbDescPtr xkb; - GeometryInfo * info; -#endif { ExprResult elem,field,tmp; ExprDef * ndx; @@ -2464,15 +2096,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes HandleShapeBody(ShapeDef *def,ShapeInfo *si,unsigned merge,GeometryInfo *info) -#else -HandleShapeBody(def,si,merge,info) - ShapeDef * def; - ShapeInfo * si; - unsigned merge; - GeometryInfo * info; -#endif { OutlineDef * ol; int nOut,nPt; @@ -2551,15 +2175,7 @@ } static int -#if NeedFunctionPrototypes HandleShapeDef(ShapeDef *def,XkbDescPtr xkb,unsigned merge,GeometryInfo *info) -#else -HandleShapeDef(def,xkb,merge,info) - ShapeDef * def; - XkbDescPtr xkb; - unsigned merge; - GeometryInfo * info; -#endif { ShapeInfo si; @@ -2580,18 +2196,10 @@ /***====================================================================***/ static int -#if NeedFunctionPrototypes HandleDoodadDef( DoodadDef *def, unsigned merge, SectionInfo *si, GeometryInfo *info) -#else -HandleDoodadDef(def,merge,si,info) - DoodadDef * def; - unsigned merge; - SectionInfo * si; - GeometryInfo * info; -#endif { ExprResult elem,field; ExprDef * ndx; @@ -2624,18 +2232,10 @@ /***====================================================================***/ static int -#if NeedFunctionPrototypes HandleOverlayDef( OverlayDef * def, unsigned merge, SectionInfo * si, GeometryInfo * info) -#else -HandleOverlayDef(def,merge,si,info) - OverlayDef * def; - unsigned merge; - SectionInfo * si; - GeometryInfo * info; -#endif { OverlayKeyDef * keyDef; OverlayKeyInfo *key; @@ -2676,14 +2276,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes HandleComplexKey(KeyDef *def,KeyInfo *key,GeometryInfo *info) -#else -HandleComplexKey(def,key,info) - KeyDef * def; - KeyInfo * key; - GeometryInfo * info; -#endif { RowInfo * row; ExprDef * expr; @@ -2732,15 +2325,7 @@ } static Bool -#if NeedFunctionPrototypes HandleRowBody(RowDef *def,RowInfo *row,unsigned merge,GeometryInfo *info) -#else -HandleRowBody(def,row,merge,info) - RowDef * def; - RowInfo * row; - unsigned merge; - GeometryInfo * info; -#endif { KeyDef * keyDef; @@ -2800,18 +2385,10 @@ } static Bool -#if NeedFunctionPrototypes HandleSectionBody( SectionDef * def, SectionInfo * si, unsigned merge, GeometryInfo * info) -#else -HandleSectionBody(def,si,merge,info) - SectionDef * def; - SectionInfo * si; - unsigned merge; - GeometryInfo * info; -#endif { RowDef * rowDef; DoodadInfo * di; @@ -2879,18 +2456,10 @@ } static int -#if NeedFunctionPrototypes HandleSectionDef( SectionDef * def, XkbDescPtr xkb, unsigned merge, GeometryInfo * info) -#else -HandleSectionDef(def,xkb,merge,info) - SectionDef * def; - XkbDescPtr xkb; - unsigned merge; - GeometryInfo * info; -#endif { SectionInfo si; char * str; @@ -2916,18 +2485,10 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes HandleGeometryFile( XkbFile * file, XkbDescPtr xkb, unsigned merge, GeometryInfo * info) -#else -HandleGeometryFile(file,xkb,merge,info) - XkbFile * file; - XkbDescPtr xkb; - unsigned merge; - GeometryInfo * info; -#endif { ParseCommon * stmt; char * failWhat; @@ -2999,14 +2560,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes CopyShapeDef(Display *dpy,XkbGeometryPtr geom,ShapeInfo *si) -#else -CopyShapeDef(dpy,geom,si) - Display * dpy; - XkbGeometryPtr geom; - ShapeInfo * si; -#endif { register int i,n; XkbShapePtr shape; @@ -3047,13 +2601,7 @@ } static Bool -#if NeedFunctionPrototypes VerifyDoodadInfo(DoodadInfo *di,GeometryInfo *info) -#else -VerifyDoodadInfo(di,info) - DoodadInfo * di; - GeometryInfo * info; -#endif { if ((di->defs.defined&(_GD_Top|_GD_Left))!=(_GD_Top|_GD_Left)) { if (warningLevel<9) { @@ -3303,7 +2851,6 @@ #define FONT_TEMPLATE "-*-%s-%s-%s-%s-%s-*-%d-*-*-*-*-%s" static char * -#if NeedFunctionPrototypes FontFromParts( Atom fontTok, Atom weightTok, Atom slantTok, @@ -3311,16 +2858,6 @@ Atom varTok, int size, Atom encodingTok) -#else -FontFromParts(fontTok,weightTok,slantTok,setWidthTok,varTok,size,encodingTok) - Atom fontTok; - Atom weightTok; - Atom slantTok; - Atom setWidthTok; - Atom varTok; - int size; - Atom encodingTok; -#endif { int totalSize; char *font,*weight,*slant,*setWidth,*variant,*encoding; @@ -3347,18 +2884,10 @@ } static Bool -#if NeedFunctionPrototypes CopyDoodadDef( XkbGeometryPtr geom, XkbSectionPtr section, DoodadInfo * di, GeometryInfo * info) -#else -CopyDoodadDef(geom,section,di,info) - XkbGeometryPtr geom; - XkbSectionPtr section; - DoodadInfo * di; - GeometryInfo * info; -#endif { Atom name; XkbDoodadPtr doodad; @@ -3436,22 +2965,12 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes VerifyOverlayInfo( XkbGeometryPtr geom, XkbSectionPtr section, OverlayInfo * oi, GeometryInfo * info, short rowMap[256], short rowSize[256]) -#else -VerifyOverlayInfo(geom,section,oi,info,rowMap,rowSize) - XkbGeometryPtr geom; - XkbSectionPtr section; - OverlayInfo * oi; - GeometryInfo * info; - short rowMap[256]; - short rowSize[256]; -#endif { register OverlayKeyInfo * ki,*next; unsigned long oKey,uKey,sKey; @@ -3529,18 +3048,10 @@ } static Bool -#if NeedFunctionPrototypes CopyOverlayDef( XkbGeometryPtr geom, XkbSectionPtr section, OverlayInfo * oi, GeometryInfo * info) -#else -CopyOverlayDef(geom,section,oi,info) - XkbGeometryPtr geom; - XkbSectionPtr section; - OverlayInfo * oi; - GeometryInfo * info; -#endif { Atom name; XkbOverlayPtr ol; @@ -3586,14 +3097,7 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes CopySectionDef(XkbGeometryPtr geom,SectionInfo *si,GeometryInfo *info) -#else -CopySectionDef(geom,si,info) - XkbGeometryPtr geom; - SectionInfo * si; - GeometryInfo * info; -#endif { XkbSectionPtr section; XkbRowPtr row; @@ -3682,14 +3186,7 @@ /***====================================================================***/ Bool -#if NeedFunctionPrototypes CompileGeometry(XkbFile *file,XkbFileInfo *result,unsigned merge) -#else -CompileGeometry(file,result,merge) - XkbFile * file; - XkbFileInfo * result; - unsigned merge; -#endif { GeometryInfo info; XkbDescPtr xkb; Index: xc/programs/xkbcomp/indicators.c diff -u xc/programs/xkbcomp/indicators.c:1.4 xc/programs/xkbcomp/indicators.c:1.5 --- xc/programs/xkbcomp/indicators.c:1.4 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/indicators.c Tue Jun 4 20:00:37 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/indicators.c,v 1.4 2001/01/17 23:45:43 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/indicators.c,v 1.5 2002/06/05 00:00:37 dawes Exp $ */ #include "xkbcomp.h" #include "misc.h" @@ -32,6 +32,8 @@ #include "expr.h" #include "vmod.h" #include "indicators.h" +#include "action.h" +#include "compat.h" /***====================================================================***/ @@ -45,13 +47,7 @@ /***====================================================================***/ void -#if NeedFunctionPrototypes ClearIndicatorMapInfo(Display *dpy,LEDInfo *info) -#else -ClearIndicatorMapInfo(dpy,info) - Display * dpy; - LEDInfo * info; -#endif { info->name= XkbInternAtom(dpy,"default",False); info->indicator= _LED_NotBound; @@ -63,13 +59,7 @@ } LEDInfo * -#if NeedFunctionPrototypes AddIndicatorMap(LEDInfo *oldLEDs,LEDInfo *new) -#else -AddIndicatorMap(oldLEDs,new) - LEDInfo * oldLEDs; - LEDInfo * new; -#endif { LEDInfo *old,*last; unsigned collide; @@ -182,20 +172,11 @@ }; int -#if NeedFunctionPrototypes SetIndicatorMapField( LEDInfo * led, XkbDescPtr xkb, char * field, ExprDef * arrayNdx, ExprDef * value) -#else -SetIndicatorMapField(led,xkb,field,arrayNdx,value) - LEDInfo * led; - XkbDescPtr xkb; - char * field; - ExprDef * arrayNdx; - ExprDef * value; -#endif { ExprResult rtrn; Bool ok; @@ -211,7 +192,6 @@ led->defs.defined|= _LED_Mods; } else if (uStrCaseCmp(field,"groups")==0) { - extern LookupEntry groupNames[]; if (arrayNdx!=NULL) return ReportIndicatorNotArray(xkb->dpy,led,field); if (!ExprResolveMask(value,&rtrn,SimpleLookup,(XPointer)groupNames)) @@ -221,7 +201,6 @@ } else if ((uStrCaseCmp(field,"controls")==0)|| (uStrCaseCmp(field,"ctrls")==0)) { - extern LookupEntry ctrlNames[]; if (arrayNdx!=NULL) return ReportIndicatorNotArray(xkb->dpy,led,field); if (!ExprResolveMask(value,&rtrn,SimpleLookup,(XPointer)ctrlNames)) @@ -298,20 +277,11 @@ } LEDInfo * -#if NeedFunctionPrototypes HandleIndicatorMapDef( IndicatorMapDef * def, XkbDescPtr xkb, LEDInfo * dflt, LEDInfo * oldLEDs, unsigned merge) -#else -HandleIndicatorMapDef(def,xkb,dflt,oldLEDs,merge) - IndicatorMapDef * def; - XkbDescPtr xkb; - LEDInfo * dflt; - LEDInfo * oldLEDs; - unsigned merge; -#endif { LEDInfo led,*rtrn; VarDef * var; @@ -350,14 +320,7 @@ } Bool -#if NeedFunctionPrototypes CopyIndicatorMapDefs(XkbFileInfo *result,LEDInfo *leds,LEDInfo **unboundRtrn) -#else -CopyIndicatorMapDefs(result,leds,unboundRtrn) - XkbFileInfo * result; - LEDInfo * leds; - LEDInfo ** unboundRtrn; -#endif { LEDInfo * led,*next; LEDInfo * unbound,*last; @@ -415,18 +378,10 @@ } Bool -#if NeedFunctionPrototypes BindIndicators( XkbFileInfo * result, Bool force, LEDInfo * unbound, LEDInfo ** unboundRtrn) -#else -BindIndicators(result,force,unbound,unboundRtrn) - XkbFileInfo * result; - Bool force; - LEDInfo * unbound; - LEDInfo ** unboundRtrn; -#endif { XkbDescPtr xkb; register int i; Index: xc/programs/xkbcomp/indicators.h diff -u xc/programs/xkbcomp/indicators.h:1.1.1.3 xc/programs/xkbcomp/indicators.h:1.3 --- xc/programs/xkbcomp/indicators.h:1.1.1.3 Tue Jan 16 17:55:04 2001 +++ xc/programs/xkbcomp/indicators.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/indicators.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */ #ifndef INDICATORS_H #define INDICATORS_H 1 @@ -52,55 +53,43 @@ } LEDInfo; extern void ClearIndicatorMapInfo( -#if NeedFunctionPrototypes Display * /* dpy */, LEDInfo * /* info */ -#endif ); extern LEDInfo *AddIndicatorMap( -#if NeedFunctionPrototypes LEDInfo * /* oldLEDs */, LEDInfo * /* newLED */ -#endif ); extern int SetIndicatorMapField( -#if NeedFunctionPrototypes LEDInfo * /* led */, XkbDescPtr /* xkb */, char * /* field */, ExprDef * /* arrayNdx */, ExprDef * /* value */ -#endif ); extern LEDInfo *HandleIndicatorMapDef( -#if NeedFunctionPrototypes IndicatorMapDef * /* stmt */, XkbDescPtr /* xkb */, LEDInfo * /* dflt */, LEDInfo * /* oldLEDs */, unsigned /* mergeMode */ -#endif ); extern Bool CopyIndicatorMapDefs( -#if NeedFunctionPrototypes XkbFileInfo * /* result */, LEDInfo * /* leds */, LEDInfo ** /* unboundRtrn */ -#endif ); extern Bool BindIndicators( -#if NeedFunctionPrototypes XkbFileInfo * /* result */, Bool /* force */, LEDInfo * /* unbound */, LEDInfo ** /* unboundRtrn */ -#endif ); #endif /* INDICATORS_H */ Index: xc/programs/xkbcomp/keycodes.c diff -u xc/programs/xkbcomp/keycodes.c:3.3 xc/programs/xkbcomp/keycodes.c:3.5 --- xc/programs/xkbcomp/keycodes.c:3.3 Wed Jan 17 18:45:43 2001 +++ xc/programs/xkbcomp/keycodes.c Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/keycodes.c,v 3.5 2002/07/01 02:26:01 tsi Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -33,13 +34,7 @@ #include "alias.h" char * -#if NeedFunctionPrototypes longText(unsigned long val,unsigned format) -#else -longText(val,format) - unsigned long val; - unsigned format; -#endif { char buf[4]; @@ -50,13 +45,7 @@ /***====================================================================***/ void -#if NeedFunctionPrototypes LongToKeyName(unsigned long val,char *name) -#else -LongToKeyName(val,name) - unsigned long val; - char * name; -#endif { name[0]= ((val>>24)&0xff); name[1]= ((val>>16)&0xff); @@ -93,13 +82,7 @@ } KeyNamesInfo; static void -#if NeedFunctionPrototypes InitIndicatorNameInfo(IndicatorNameInfo *ii,KeyNamesInfo *info) -#else -InitIndicatorNameInfo(ii,info) - IndicatorNameInfo * ii; - KeyNamesInfo * info; -#endif { ii->defs.defined= 0; ii->defs.merge= info->merge; @@ -112,13 +95,7 @@ } static void -#if NeedFunctionPrototypes ClearIndicatorNameInfo(IndicatorNameInfo *ii,KeyNamesInfo *info) -#else -ClearIndicatorNameInfo(ii,info) - IndicatorNameInfo * ii; - KeyNamesInfo * info; -#endif { if (ii==info->leds) { ClearCommonInfo(&ii->defs); @@ -128,12 +105,7 @@ } static IndicatorNameInfo * -#if NeedFunctionPrototypes NextIndicatorName(KeyNamesInfo *info) -#else -NextIndicatorName(info) - KeyNamesInfo * info; -#endif { IndicatorNameInfo * ii; @@ -147,13 +119,7 @@ } static IndicatorNameInfo * -#if NeedFunctionPrototypes FindIndicatorByIndex(KeyNamesInfo *info,int ndx) -#else -FindIndicatorByIndex(info,ndx) - KeyNamesInfo * info; - int ndx; -#endif { IndicatorNameInfo * old; @@ -165,13 +131,7 @@ } static IndicatorNameInfo * -#if NeedFunctionPrototypes FindIndicatorByName(KeyNamesInfo *info,Atom name) -#else -FindIndicatorByName(info,name) - KeyNamesInfo * info; - Atom name; -#endif { IndicatorNameInfo * old; @@ -183,13 +143,7 @@ } static Bool -#if NeedFunctionPrototypes AddIndicatorName(KeyNamesInfo *info,IndicatorNameInfo *new) -#else -AddIndicatorName(info,new) - KeyNamesInfo * info; - IndicatorNameInfo *new; -#endif { IndicatorNameInfo *old; Bool replace; @@ -285,12 +239,7 @@ } static void -#if NeedFunctionPrototypes ClearKeyNamesInfo(KeyNamesInfo *info) -#else -ClearKeyNamesInfo(info) - KeyNamesInfo *info; -#endif { if (info->name!=NULL) uFree(info->name); @@ -310,12 +259,7 @@ } static void -#if NeedFunctionPrototypes InitKeyNamesInfo(KeyNamesInfo *info) -#else -InitKeyNamesInfo(info) - KeyNamesInfo *info; -#endif { info->name= NULL; info->leds= NULL; @@ -325,14 +269,8 @@ return; } -int -#if NeedFunctionPrototypes +static int FindKeyByLong(KeyNamesInfo *info,unsigned long name) -#else -FindKeyByLong(info,name) - KeyNamesInfo * info; - unsigned long name; -#endif { register int i; @@ -344,22 +282,12 @@ } static Bool -#if NeedFunctionPrototypes AddKeyName( KeyNamesInfo * info, int kc, char * name, unsigned merge, unsigned fileID, Bool reportCollisions) -#else -AddKeyName(info,kc,name,merge,fileID,reportCollisions) - KeyNamesInfo * info; - int kc; - char * name; - unsigned merge; - unsigned fileID; - Bool reportCollisions; -#endif { int old; unsigned long lval; @@ -442,14 +370,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes MergeIncludedKeycodes(KeyNamesInfo *into,KeyNamesInfo *from,unsigned merge) -#else -MergeIncludedKeycodes(into,from,merge) - KeyNamesInfo * into; - KeyNamesInfo * from; - unsigned merge; -#endif { register int i; char buf[5]; @@ -498,27 +419,17 @@ } typedef void (*FileHandler)( -#if NeedFunctionPrototypes XkbFile * /* rtrn */, XkbDescPtr /* xkb */, unsigned /* merge */, KeyNamesInfo * /* included */ -#endif ); static Bool -#if NeedFunctionPrototypes HandleIncludeKeycodes( IncludeStmt * stmt, XkbDescPtr xkb, KeyNamesInfo * info, FileHandler hndlr) -#else -HandleIncludeKeycodes(stmt,xkb,info,hndlr) - IncludeStmt * stmt; - XkbDescPtr xkb; - KeyNamesInfo * info; - FileHandler hndlr; -#endif { unsigned newMerge; XkbFile * rtrn; @@ -584,18 +495,10 @@ } static int -#if NeedFunctionPrototypes HandleKeycodeDef( KeycodeDef * stmt, XkbDescPtr xkb, unsigned merge, KeyNamesInfo * info) -#else -HandleKeycodeDef(stmt,xkb,merge,info) - KeycodeDef * stmt; - XkbDescPtr xkb; - unsigned merge; - KeyNamesInfo * info; -#endif { int code; ExprResult result; @@ -623,15 +526,7 @@ #define MAX_KEYCODE_DEF 1 static int -#if NeedFunctionPrototypes HandleKeyNameVar(VarDef *stmt,XkbDescPtr xkb,unsigned merge,KeyNamesInfo *info) -#else -HandleKeyNameVar(stmt,xkb,merge,info) - VarDef * stmt; - XkbDescPtr xkb; - unsigned merge; - KeyNamesInfo * info; -#endif { ExprResult tmp,field; ExprDef * arrayNdx; @@ -704,18 +599,10 @@ } static int -#if NeedFunctionPrototypes HandleIndicatorNameDef( IndicatorNameDef * def, XkbDescPtr xkb, unsigned merge, KeyNamesInfo * info) -#else -HandleIndicatorNameDef(def,xkb,merge,info) - IndicatorNameDef * def; - XkbDescPtr xkb; - unsigned merge; - KeyNamesInfo * info; -#endif { IndicatorNameInfo ii; ExprResult tmp; @@ -742,18 +629,10 @@ } static void -#if NeedFunctionPrototypes HandleKeycodesFile( XkbFile * file, XkbDescPtr xkb, unsigned merge, KeyNamesInfo * info) -#else -HandleKeycodesFile(file,xkb,merge,info) - XkbFile *file; - XkbDescPtr xkb; - unsigned merge; - KeyNamesInfo *info; -#endif { ParseCommon *stmt; @@ -812,14 +691,7 @@ } Bool -#if NeedFunctionPrototypes CompileKeycodes(XkbFile *file,XkbFileInfo *result,unsigned merge) -#else -CompileKeycodes(file,result,merge) - XkbFile * file; - XkbFileInfo * result; - unsigned merge; -#endif { KeyNamesInfo info; XkbDescPtr xkb; Index: xc/programs/xkbcomp/keycodes.h diff -u xc/programs/xkbcomp/keycodes.h:1.1.1.3 xc/programs/xkbcomp/keycodes.h:1.3 --- xc/programs/xkbcomp/keycodes.h:1.1.1.3 Tue Jan 16 17:55:07 2001 +++ xc/programs/xkbcomp/keycodes.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/keycodes.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */ #ifndef KEYCODES_H #define KEYCODES_H 1 @@ -31,17 +32,13 @@ #define KeyNameToLong(n) ((((unsigned long)n[0])<<24)|(((unsigned long)n[1])<<16)|(((unsigned long)n[2])<<8)|n[3]) extern char * longText( -#if NeedFunctionPrototypes unsigned long /* val */, unsigned /* format */ -#endif ); extern void LongToKeyName( -#if NeedFunctionPrototypes unsigned long /* val */, char * /* name_rtrn */ -#endif ); #endif /* KEYCODES_H */ Index: xc/programs/xkbcomp/keymap.c diff -u xc/programs/xkbcomp/keymap.c:1.1.1.4 xc/programs/xkbcomp/keymap.c:1.3 --- xc/programs/xkbcomp/keymap.c:1.1.1.4 Tue Jan 16 17:55:09 2001 +++ xc/programs/xkbcomp/keymap.c Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/keymap.c,v 1.3 2002/07/01 02:26:01 tsi Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -43,14 +44,7 @@ XkbFile * sections[MAX_SECTIONS]; Bool -#if NeedFunctionPrototypes CompileKeymap(XkbFile *file,XkbFileInfo *result,unsigned merge) -#else -CompileKeymap(file,result,merge) - XkbFile * file; - XkbFileInfo * result; - unsigned merge; -#endif { unsigned have; Bool ok; Index: xc/programs/xkbcomp/keytypes.c diff -u xc/programs/xkbcomp/keytypes.c:1.4 xc/programs/xkbcomp/keytypes.c:1.5 --- xc/programs/xkbcomp/keytypes.c:1.4 Wed Jan 17 18:45:44 2001 +++ xc/programs/xkbcomp/keytypes.c Tue Jun 4 20:00:37 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/keytypes.c,v 1.4 2001/01/17 23:45:44 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/keytypes.c,v 1.5 2002/06/05 00:00:37 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -91,40 +91,30 @@ /***====================================================================***/ -_XFUNCPROTOBEGIN - extern Bool AddMapEntry( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, KeyTypeInfo * /* type */, XkbKTMapEntryPtr /* new */, Bool /* clobber */, Bool /* report */ -#endif ); extern Bool AddPreserve( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, KeyTypeInfo * /* type */, PreserveInfo * /* new */, Bool /* clobber */, Bool /* report */ -#endif ); extern Bool AddLevelName( -#if NeedFunctionPrototypes KeyTypeInfo * /* type */, unsigned /* level */, Atom /* name */, Bool /* clobber */, Bool /* report */ -#endif ); -_XFUNCPROTOEND - #define MapEntryTxt(t,x,e) \ XkbVModMaskText((t)->dpy,(x),(e)->mods.real_mods,(e)->mods.vmods,XkbMessage) #define PreserveIndexTxt(t,x,p) \ @@ -138,14 +128,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes InitKeyTypesInfo(KeyTypesInfo *info,XkbDescPtr xkb,KeyTypesInfo *from) -#else -InitKeyTypesInfo(info,xkb,from) - KeyTypesInfo * info; - XkbDescPtr xkb; - KeyTypesInfo * from; -#endif { tok_ONE_LEVEL= XkbInternAtom(NULL,"ONE_LEVEL",False); tok_TWO_LEVEL= XkbInternAtom(NULL,"TWO_LEVEL",False); @@ -210,12 +193,7 @@ } static void -#if NeedFunctionPrototypes FreeKeyTypeInfo(KeyTypeInfo *type) -#else -FreeKeyTypeInfo(type) - KeyTypeInfo * type; -#endif { if (type->entries!=NULL) { uFree(type->entries); @@ -233,12 +211,7 @@ } static void -#if NeedFunctionPrototypes FreeKeyTypesInfo(KeyTypesInfo *info) -#else -FreeKeyTypesInfo(info) - KeyTypesInfo * info; -#endif { info->dpy= NULL; if (info->name) @@ -256,12 +229,7 @@ } static KeyTypeInfo * -#if NeedFunctionPrototypes NextKeyType(KeyTypesInfo *info) -#else -NextKeyType(info) - KeyTypesInfo * info; -#endif { KeyTypeInfo * type; @@ -278,13 +246,7 @@ } static KeyTypeInfo * -#if NeedFunctionPrototypes FindMatchingKeyType(KeyTypesInfo *info,KeyTypeInfo *new) -#else -FindMatchingKeyType(info,new) - KeyTypesInfo * info; - KeyTypeInfo * new; -#endif { KeyTypeInfo *old; @@ -296,14 +258,7 @@ } static Bool -#if NeedFunctionPrototypes ReportTypeBadWidth(char *type,int has,int needs) -#else -ReportTypeBadWidth(type,has,needs) - char * type; - int has; - int needs; -#endif { ERROR3("Key type \"%s\" has %d levels, must have %d\n",type,has,needs); ACTION("Illegal type definition ignored\n"); @@ -311,14 +266,7 @@ } static Bool -#if NeedFunctionPrototypes AddKeyType(XkbDescPtr xkb,KeyTypesInfo *info,KeyTypeInfo *new) -#else -AddKeyType(xkb,info,new) - XkbDescPtr xkb; - KeyTypesInfo * info; - KeyTypeInfo * new; -#endif { KeyTypeInfo * old; @@ -394,18 +342,10 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes MergeIncludedKeyTypes( KeyTypesInfo * into, KeyTypesInfo * from, unsigned merge, XkbDescPtr xkb) -#else -MergeIncludedKeyTypes(into,from,merge,xkb) - KeyTypesInfo *into; - KeyTypesInfo *from; - unsigned merge; - XkbDescPtr xkb; -#endif { KeyTypeInfo * type; @@ -428,27 +368,17 @@ } typedef void (*FileHandler)( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbDescPtr /* xkb */, unsigned /* merge */, KeyTypesInfo * /* included */ -#endif ); static Bool -#if NeedFunctionPrototypes HandleIncludeKeyTypes( IncludeStmt * stmt, XkbDescPtr xkb, KeyTypesInfo * info, FileHandler hndlr) -#else -HandleIncludeKeyTypes(stmt,xkb,info,hndlr) - IncludeStmt * stmt; - XkbDescPtr xkb; - KeyTypesInfo * info; - FileHandler hndlr; -#endif { unsigned newMerge; XkbFile * rtrn; @@ -515,14 +445,7 @@ /***====================================================================***/ static XkbKTMapEntryPtr -#if NeedFunctionPrototypes FindMatchingMapEntry(KeyTypeInfo *type,unsigned mask,unsigned vmask) -#else -FindMatchingMapEntry(type,mask,vmask) - KeyTypeInfo * type; - unsigned mask; - unsigned vmask; -#endif { register int i; XkbKTMapEntryPtr entry; @@ -535,12 +458,7 @@ } static void -#if NeedFunctionPrototypes DeleteLevel1MapEntries(KeyTypeInfo *type) -#else -DeleteLevel1MapEntries(type) - KeyTypeInfo * type; -#endif { register int i,n; @@ -556,12 +474,7 @@ } static XkbKTMapEntryPtr -#if NeedFunctionPrototypes NextMapEntry(KeyTypeInfo *type) -#else -NextMapEntry(type) - KeyTypeInfo * type; -#endif { if (type->entries==NULL) { type->entries= uTypedCalloc(2,XkbKTMapEntryRec); @@ -588,20 +501,11 @@ } Bool -#if NeedFunctionPrototypes AddPreserve( XkbDescPtr xkb, KeyTypeInfo * type, PreserveInfo * new, Bool clobber, Bool report) -#else -AddPreserve(xkb,type,new,clobber,report) - XkbDescPtr xkb; - KeyTypeInfo * type; - PreserveInfo * new; - Bool clobber; - Bool report; -#endif { PreserveInfo *old; @@ -651,20 +555,11 @@ } Bool -#if NeedFunctionPrototypes AddMapEntry( XkbDescPtr xkb, KeyTypeInfo * type, XkbKTMapEntryPtr new, Bool clobber, Bool report) -#else -AddMapEntry(xkb,type,new,clobber,report) - XkbDescPtr xkb; - KeyTypeInfo * type; - XkbKTMapEntryPtr new; - Bool clobber; - Bool report; -#endif { XkbKTMapEntryPtr old; @@ -719,18 +614,10 @@ }; static Bool -#if NeedFunctionPrototypes SetMapEntry( KeyTypeInfo * type, XkbDescPtr xkb, ExprDef * arrayNdx, ExprDef * value) -#else -SetMapEntry(type,xkb,arrayNdx,value) - KeyTypeInfo * type; - XkbDescPtr xkb; - ExprDef * arrayNdx; - ExprDef * value; -#endif { ExprResult rtrn; XkbKTMapEntryRec entry; @@ -772,18 +659,10 @@ } static Bool -#if NeedFunctionPrototypes SetPreserve( KeyTypeInfo * type, XkbDescPtr xkb, ExprDef * arrayNdx, ExprDef * value) -#else -SetPreserve(type,xkb,arrayNdx,value) - KeyTypeInfo * type; - XkbDescPtr xkb; - ExprDef * arrayNdx; - ExprDef * value; -#endif { ExprResult rtrn; PreserveInfo new; @@ -835,20 +714,11 @@ /***====================================================================***/ Bool -#if NeedFunctionPrototypes AddLevelName( KeyTypeInfo * type, unsigned level, Atom name, Bool clobber, Bool report) -#else -AddLevelName(type,level,name,clobber,report) - KeyTypeInfo * type; - unsigned level; - Atom name; - Bool clobber; - Bool report; -#endif { if ((type->lvlNames==NULL)||(type->szNames<=level)) { type->lvlNames= @@ -890,14 +760,7 @@ } static Bool -#if NeedFunctionPrototypes SetLevelName(KeyTypeInfo *type,ExprDef *arrayNdx,ExprDef *value) -#else -SetLevelName(type,arrayNdx,value) - KeyTypeInfo * type; - ExprDef * arrayNdx; - ExprDef * value; -#endif { ExprResult rtrn; unsigned level; @@ -928,22 +791,12 @@ /***====================================================================***/ static Bool -#if NeedFunctionPrototypes SetKeyTypeField( KeyTypeInfo * type, XkbDescPtr xkb, char * field, ExprDef * arrayNdx, ExprDef * value, KeyTypesInfo * info) -#else -SetKeyTypeField(type,xkb,field,arrayNdx,value,info) - KeyTypeInfo * type; - XkbDescPtr xkb; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - KeyTypesInfo * info; -#endif { ExprResult tmp; @@ -993,14 +846,7 @@ } static Bool -#if NeedFunctionPrototypes HandleKeyTypeVar(VarDef *stmt,XkbDescPtr xkb,KeyTypesInfo *info) -#else -HandleKeyTypeVar(stmt,xkb,info) - VarDef * stmt; - XkbDescPtr xkb; - KeyTypesInfo * info; -#endif { ExprResult elem,field; ExprDef * arrayNdx; @@ -1022,18 +868,10 @@ } static int -#if NeedFunctionPrototypes HandleKeyTypeBody( VarDef * def, XkbDescPtr xkb, KeyTypeInfo * type, KeyTypesInfo * info) -#else -HandleKeyTypeBody(def,xkb,type,info) - VarDef * def; - XkbDescPtr xkb; - KeyTypeInfo * type; - KeyTypesInfo * info; -#endif { int ok= 1; ExprResult tmp,field; @@ -1052,18 +890,10 @@ } static int -#if NeedFunctionPrototypes HandleKeyTypeDef( KeyTypeDef * def, XkbDescPtr xkb, unsigned merge, KeyTypesInfo * info) -#else -HandleKeyTypeDef(def,xkb,merge,info) - KeyTypeDef * def; - XkbDescPtr xkb; - unsigned merge; - KeyTypesInfo * info; -#endif { register int i; KeyTypeInfo type; @@ -1125,18 +955,10 @@ } static void -#if NeedFunctionPrototypes HandleKeyTypesFile( XkbFile * file, XkbDescPtr xkb, unsigned merge, KeyTypesInfo * info) -#else -HandleKeyTypesFile(file,xkb,merge,info) - XkbFile *file; - XkbDescPtr xkb; - unsigned merge; - KeyTypesInfo *info; -#endif { ParseCommon *stmt; @@ -1194,14 +1016,7 @@ } static Bool -#if NeedFunctionPrototypes CopyDefToKeyType(XkbDescPtr xkb,XkbKeyTypePtr type,KeyTypeInfo *def) -#else -CopyDefToKeyType(xkb,type,def) - XkbDescPtr xkb; - XkbKeyTypePtr type; - KeyTypeInfo * def; -#endif { register int i; PreserveInfo *pre; @@ -1263,14 +1078,7 @@ } Bool -#if NeedFunctionPrototypes CompileKeyTypes(XkbFile *file,XkbFileInfo *result,unsigned merge) -#else -CompileKeyTypes(file,result,merge) - XkbFile * file; - XkbFileInfo * result; - unsigned merge; -#endif { KeyTypesInfo info; XkbDescPtr xkb; Index: xc/programs/xkbcomp/listing.c diff -u xc/programs/xkbcomp/listing.c:3.9 xc/programs/xkbcomp/listing.c:3.10 --- xc/programs/xkbcomp/listing.c:3.9 Fri Dec 14 15:01:57 2001 +++ xc/programs/xkbcomp/listing.c Tue Jun 4 20:00:37 2002 @@ -70,7 +70,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.9 2001/12/14 20:01:57 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.10 2002/06/05 00:00:37 dawes Exp $ */ #include <stdio.h> @@ -162,12 +162,7 @@ /***====================================================================***/ int -#if NeedFunctionPrototypes AddMapOnly(char *map) -#else -AddMapOnly(map) - char *map; -#endif { if (nMapOnly>=szMapOnly) { if (szMapOnly<1) szMapOnly= 5; @@ -183,13 +178,7 @@ } int -#if NeedFunctionPrototypes AddListing(char *file,char *map) -#else -AddListing(file,map) - char *file; - char *map; -#endif { if (nListed>=szListing) { if (szListing<1) szListing= 10; @@ -213,14 +202,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes ListFile(FILE *outFile,char *fileName,XkbFile *map) -#else -ListFile(outFile,fileName,map) -FILE * outFile; -char * fileName; -XkbFile * map; -#endif { register unsigned flags; char * mapName; @@ -268,15 +250,7 @@ /***====================================================================***/ static int -#if NeedFunctionPrototypes AddDirectory(char *head,char *ptrn,char *rest,char *map) -#else -AddDirectory(head,ptrn,rest,map) - char * head; - char * ptrn; - char * rest; - char * map; -#endif { #ifdef WIN32 HANDLE dirh; @@ -358,12 +332,7 @@ /***====================================================================***/ Bool -#if NeedFunctionPrototypes AddMatchingFiles(char *head_in) -#else -AddMatchingFiles(head_in) - char * head_in; -#endif { char *str,*head,*ptrn,*rest= NULL; @@ -405,10 +374,8 @@ /***====================================================================***/ -Bool -MapMatches(mapToConsider,ptrn) - char * mapToConsider; - char * ptrn; +static Bool +MapMatches(char *mapToConsider, char *ptrn) { int i; @@ -424,12 +391,7 @@ } int -#if NeedFunctionPrototypes GenerateListing(char *out_name) -#else -GenerateListing(out_name) - char * out_name; -#endif { int i; FILE * inputFile,*outFile; Index: xc/programs/xkbcomp/misc.c diff -u xc/programs/xkbcomp/misc.c:3.4 xc/programs/xkbcomp/misc.c:3.6 --- xc/programs/xkbcomp/misc.c:3.4 Wed Jan 17 18:45:44 2001 +++ xc/programs/xkbcomp/misc.c Fri Dec 20 15:18:33 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/misc.c,v 3.4 2001/01/17 23:45:44 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/misc.c,v 3.6 2002/12/20 20:18:33 paulo Exp $ */ #include "xkbcomp.h" #include "xkbpath.h" @@ -39,18 +39,10 @@ /***====================================================================***/ Bool -#if NeedFunctionPrototypes ProcessIncludeFile( IncludeStmt * stmt, unsigned file_type, XkbFile ** file_rtrn, unsigned * merge_rtrn) -#else -ProcessIncludeFile(stmt,file_type,file_rtrn,merge_rtrn) - IncludeStmt * stmt; - unsigned file_type; - XkbFile ** file_rtrn; - unsigned * merge_rtrn; -#endif { FILE *file; XkbFile *rtrn,*mapToUse; @@ -108,12 +100,8 @@ ACTION1("Include file \"%s\" ignored\n",stmt->file); return False; } - if (mapToUse->compiled) { - ERROR2("Map \"%s(%s)\" included more than once\n",stmt->file, - rtrn->name); - ACTION("Later inclusion ignored\n"); - return False; - } + /* FIXME: we have to check recursive includes here (or somewhere) */ + mapToUse->compiled= True; *file_rtrn= mapToUse; *merge_rtrn= stmt->merge; @@ -123,14 +111,7 @@ /***====================================================================***/ int -#if NeedFunctionPrototypes ReportNotArray(char *type,char *field,char *name) -#else -ReportNotArray(type,field,name) - char * type; - char * field; - char * name; -#endif { ERROR2("The %s %s field is not an array\n",type,field); ACTION1("Ignoring illegal assignment in %s\n",name); @@ -138,14 +119,7 @@ } int -#if NeedFunctionPrototypes ReportShouldBeArray(char *type,char *field,char *name) -#else -ReportShouldBeArray(type,field,name) - char * type; - char * field; - char * name; -#endif { ERROR2("Missing subscript for %s %s\n",type,field); ACTION1("Ignoring illegal assignment in %s\n",name); @@ -153,15 +127,7 @@ } int -#if NeedFunctionPrototypes ReportBadType(char *type,char *field,char *name,char *wanted) -#else -ReportBadType(type,field,name,wanted) - char *type; - char *field; - char *name; - char *wanted; -#endif { ERROR3("The %s %s field must be a %s\n",type,field,wanted); ACTION1("Ignoring illegal assignment in %s\n",name); @@ -169,15 +135,7 @@ } int -#if NeedFunctionPrototypes ReportBadIndexType(char *type,char *field,char *name,char *wanted) -#else -ReportBadIndexType(type,field,name,wanted) - char *type; - char *field; - char *name; - char *wanted; -#endif { ERROR3("Index for the %s %s field must be a %s\n",type,field,wanted); ACTION1("Ignoring assignment to illegal field in %s\n",name); @@ -185,14 +143,7 @@ } int -#if NeedFunctionPrototypes ReportBadField(char *type,char *field,char *name) -#else -ReportBadField(type,field,name) - char *type; - char *field; - char *name; -#endif { ERROR3("Unknown %s field %s in %s\n",type,field,name); ACTION1("Ignoring assignment to unknown field in %s\n",name); @@ -200,14 +151,7 @@ } int -#if NeedFunctionPrototypes ReportMultipleDefs(char *type,char *field,char *name) -#else -ReportMultipleDefs(type,field,name) - char *type; - char *field; - char *name; -#endif { WARN3("Multiple definitions of %s in %s \"%s\"\n",field,type,name); ACTION("Using last definition\n"); @@ -217,18 +161,10 @@ /***====================================================================***/ Bool -#if NeedFunctionPrototypes UseNewField( unsigned field, CommonInfo * oldDefs, CommonInfo * newDefs, unsigned * pCollide) -#else -UseNewField(field,oldDefs,newDefs,pCollide) - unsigned field; - CommonInfo * oldDefs; - CommonInfo * newDefs; - unsigned * pCollide; -#endif { Bool useNew; @@ -249,18 +185,10 @@ } Bool -#if NeedFunctionPrototypes MergeNewField( unsigned field, CommonInfo * oldDefs, CommonInfo * newDefs, unsigned * pCollide) -#else -MergeNewField(field,oldDefs,newDefs,pCollide) - unsigned field; - CommonInfo * oldDefs; - CommonInfo * newDefs; - unsigned * pCollide; -#endif { if ((oldDefs->defined&field)&&(newDefs->defined&field)) { if (((oldDefs->fileID==newDefs->fileID)&&(warningLevel>0))|| @@ -274,12 +202,7 @@ } XPointer -#if NeedFunctionPrototypes ClearCommonInfo(CommonInfo *cmn) -#else -ClearCommonInfo(cmn) - CommonInfo * cmn; -#endif { if (cmn!=NULL) { CommonInfo *this,*next; @@ -292,13 +215,7 @@ } XPointer -#if NeedFunctionPrototypes AddCommonInfo(CommonInfo *old,CommonInfo *new) -#else -AddCommonInfo(old,new) - CommonInfo * old; - CommonInfo * new; -#endif { CommonInfo * first; @@ -433,12 +350,7 @@ }; Status -#if NeedFunctionPrototypes ComputeKbdDefaults(XkbDescPtr xkb) -#else -ComputeKbdDefaults(xkb) - XkbDescPtr xkb; -#endif { Status rtrn; register int i,tmp,nUnknown; @@ -495,22 +407,12 @@ } Bool -#if NeedFunctionPrototypes FindNamedKey( XkbDescPtr xkb, unsigned long name, unsigned int * kc_rtrn, Bool use_aliases, Bool create, int start_from) -#else -FindNamedKey(xkb,name,kc_rtrn,use_aliases,create,start_from) - XkbDescPtr xkb; - unsigned long name; - unsigned int * kc_rtrn; - Bool use_aliases; - Bool create; - int start_from; -#endif { register unsigned n; @@ -566,14 +468,7 @@ } Bool -#if NeedFunctionPrototypes FindKeyNameForAlias(XkbDescPtr xkb,unsigned long lname,unsigned long *real_name) -#else -FindKeyNameForAlias(xkb,lname,real_name) - XkbDescPtr xkb; - unsigned long lname; - unsigned long * real_name; -#endif { register int i; char name[XkbKeyNameLength+1]; Index: xc/programs/xkbcomp/misc.h diff -u xc/programs/xkbcomp/misc.h:1.3 xc/programs/xkbcomp/misc.h:1.5 --- xc/programs/xkbcomp/misc.h:1.3 Wed Jan 17 18:45:44 2001 +++ xc/programs/xkbcomp/misc.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/misc.h,v 1.5 2002/07/01 02:26:01 tsi Exp $ */ #ifndef MISC_H #define MISC_H 1 @@ -35,123 +36,91 @@ struct _CommonInfo * next; } CommonInfo; -_XFUNCPROTOBEGIN - extern Bool UseNewField( -#if NeedFunctionPrototypes unsigned /* field */, CommonInfo * /* oldDefs */, CommonInfo * /* newDefs */, unsigned * /* pCollide */ -#endif ); extern Bool MergeNewField( -#if NeedFunctionPrototypes unsigned /* field */, CommonInfo * /* oldDefs */, CommonInfo * /* newDefs */, unsigned * /* pCollide */ -#endif ); extern XPointer ClearCommonInfo( -#if NeedFunctionPrototypes CommonInfo * /* cmn */ -#endif ); extern XPointer AddCommonInfo( -#if NeedFunctionPrototypes CommonInfo * /* old */, CommonInfo * /* new */ -#endif ); extern int ReportNotArray( -#if NeedFunctionPrototypes char * /* type */, char * /* field */, char * /* name */ -#endif ); extern int ReportShouldBeArray( -#if NeedFunctionPrototypes char * /* type */, char * /* field */, char * /* name */ -#endif ); extern int ReportBadType( -#if NeedFunctionPrototypes char * /* type */, char * /* field */, char * /* name */, char * /* wanted */ -#endif ); extern int ReportBadIndexType( -#if NeedFunctionPrototypes char * /* type */, char * /* field */, char * /* name */, char * /* wanted */ -#endif ); extern int ReportBadField( -#if NeedFunctionPrototypes char * /* type */, char * /* field */, char * /* name */ -#endif ); extern int ReportMultipleDefs( -#if NeedFunctionPrototypes char * /* type */, char * /* field */, char * /* which */ -#endif ); extern Bool ProcessIncludeFile( -#if NeedFunctionPrototypes IncludeStmt * /* stmt */, unsigned /* file_type */, XkbFile ** /* file_rtrn */, unsigned * /* merge_rtrn */ -#endif ); extern Status ComputeKbdDefaults( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */ -#endif ); extern Bool FindNamedKey( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned long /* name */, unsigned int * /* kc_rtrn */, Bool /* use_aliases */, Bool /* create */, int /* start_from */ -#endif ); extern Bool FindKeyNameForAlias( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned long /* lname */, unsigned long * /* real_name */ -#endif ); - -_XFUNCPROTOEND #endif /* MISC_H */ Index: xc/programs/xkbcomp/parseutils.c diff -u xc/programs/xkbcomp/parseutils.c:1.3 xc/programs/xkbcomp/parseutils.c:1.5 --- xc/programs/xkbcomp/parseutils.c:1.3 Wed Jan 17 18:45:44 2001 +++ xc/programs/xkbcomp/parseutils.c Sun Jun 30 22:26:01 2002 @@ -24,6 +24,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/parseutils.c,v 1.5 2002/07/01 02:26:01 tsi Exp $ */ + #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR parseDebug #include "parseutils.h" @@ -35,13 +37,7 @@ XkbFile *rtrnValue; ParseCommon * -#if NeedFunctionPrototypes AppendStmt(ParseCommon *to,ParseCommon *append) -#else -AppendStmt(to,append) - ParseCommon * to; - ParseCommon * append; -#endif { ParseCommon *start= to; @@ -58,13 +54,7 @@ } ExprDef * -#if NeedFunctionPrototypes ExprCreate(unsigned op,unsigned type) -#else -ExprCreate(op,type) - unsigned op; - unsigned type; -#endif { ExprDef *expr; expr= uTypedAlloc(ExprDef); @@ -82,14 +72,7 @@ } ExprDef * -#if NeedFunctionPrototypes ExprCreateUnary(unsigned op,unsigned type,ExprDef *child) -#else -ExprCreateUnary(op,type,child) - unsigned op; - unsigned type; - ExprDef *child; -#endif { ExprDef *expr; expr= uTypedAlloc(ExprDef); @@ -108,14 +91,7 @@ } ExprDef * -#if NeedFunctionPrototypes ExprCreateBinary(unsigned op,ExprDef *left,ExprDef *right) -#else -ExprCreateBinary(op,left,right) - unsigned op; - ExprDef *left; - ExprDef *right; -#endif { ExprDef *expr; expr= uTypedAlloc(ExprDef); @@ -139,13 +115,7 @@ } KeycodeDef * -#if NeedFunctionPrototypes KeycodeCreate(char *name,ExprDef *value) -#else -KeycodeCreate(name,value) - char * name; - ExprDef * value; -#endif { KeycodeDef *def; @@ -165,13 +135,7 @@ } KeyAliasDef * -#if NeedFunctionPrototypes KeyAliasCreate(char *alias,char *real) -#else -KeyAliasCreate(alias,real) - char * alias; - char * real; -#endif { KeyAliasDef *def; @@ -192,13 +156,7 @@ } VModDef * -#if NeedFunctionPrototypes VModCreate(Atom name,ExprDef *value) -#else -VModCreate(name,value) - Atom name; - ExprDef * value; -#endif { VModDef *def; def= uTypedAlloc(VModDef); @@ -216,13 +174,7 @@ } VarDef * -#if NeedFunctionPrototypes VarCreate(ExprDef *name,ExprDef *value) -#else -VarCreate(name,value) - ExprDef * name; - ExprDef * value; -#endif { VarDef *def; def= uTypedAlloc(VarDef); @@ -240,13 +192,7 @@ } VarDef * -#if NeedFunctionPrototypes BoolVarCreate(Atom nameToken,unsigned set) -#else -BoolVarCreate(nameToken,set) - Atom nameToken; - unsigned set; -#endif { ExprDef *name,*value; @@ -258,13 +204,7 @@ } InterpDef * -#if NeedFunctionPrototypes InterpCreate(KeySym sym,ExprDef *match) -#else -InterpCreate(sym,match) - KeySym sym; - ExprDef * match; -#endif { InterpDef *def; @@ -283,13 +223,7 @@ } KeyTypeDef * -#if NeedFunctionPrototypes KeyTypeCreate(Atom name,VarDef *body) -#else -KeyTypeCreate(name,body) - Atom name; - VarDef * body; -#endif { KeyTypeDef *def; @@ -309,13 +243,7 @@ } SymbolsDef * -#if NeedFunctionPrototypes SymbolsCreate(char *keyName,ExprDef *symbols) -#else -SymbolsCreate(keyName,symbols) - char * keyName; - ExprDef * symbols; -#endif { SymbolsDef *def; @@ -336,13 +264,7 @@ } GroupCompatDef * -#if NeedFunctionPrototypes GroupCompatCreate(int group,ExprDef *val) -#else -GroupCompatCreate(group,val) - int group; - ExprDef * val; -#endif { GroupCompatDef *def; @@ -362,13 +284,7 @@ } ModMapDef * -#if NeedFunctionPrototypes ModMapCreate(Atom modifier,ExprDef *keys) -#else -ModMapCreate(modifier,keys) - Atom modifier; - ExprDef * keys; -#endif { ModMapDef *def; @@ -388,13 +304,7 @@ } IndicatorMapDef * -#if NeedFunctionPrototypes IndicatorMapCreate(Atom name,VarDef *body) -#else -IndicatorMapCreate(name,body) - Atom name; - VarDef * body; -#endif { IndicatorMapDef *def; @@ -414,14 +324,7 @@ } IndicatorNameDef * -#if NeedFunctionPrototypes IndicatorNameCreate(int ndx,ExprDef *name,Bool virtual) -#else -IndicatorNameCreate(ndx,name,virtual) - int ndx; - ExprDef * name; - Bool virtual; -#endif { IndicatorNameDef *def; @@ -442,13 +345,7 @@ } ExprDef * -#if NeedFunctionPrototypes ActionCreate(Atom name,ExprDef *args) -#else -ActionCreate(name,args) - Atom name; - ExprDef *args; -#endif { ExprDef *act; @@ -466,12 +363,7 @@ } ExprDef * -#if NeedFunctionPrototypes CreateKeysymList(KeySym sym) -#else -CreateKeysymList(sym) - KeySym sym; -#endif { ExprDef *def; @@ -490,13 +382,7 @@ } ShapeDef * -#if NeedFunctionPrototypes ShapeDeclCreate(Atom name,OutlineDef *outlines) -#else -ShapeDeclCreate(name,outlines) - Atom name; - OutlineDef * outlines; -#endif { ShapeDef * shape; OutlineDef * ol; @@ -519,13 +405,7 @@ } OutlineDef * -#if NeedFunctionPrototypes OutlineCreate(Atom field,ExprDef *points) -#else -OutlineCreate(field,points) - Atom field; - ExprDef * points; -#endif { OutlineDef * outline; ExprDef * pt; @@ -548,13 +428,7 @@ } KeyDef * -#if NeedFunctionPrototypes KeyDeclCreate(char *name,ExprDef *expr) -#else -KeyDeclCreate(name,expr) - char * name; - ExprDef * expr; -#endif { KeyDef * key; @@ -570,13 +444,7 @@ } KeyDef * -#if NeedFunctionPrototypes KeyDeclMerge(KeyDef *into,KeyDef *from) -#else -KeyDeclMerge(into,from) - KeyDef * into; - KeyDef * from; -#endif { into->expr= (ExprDef *)AppendStmt(&into->expr->common,&from->expr->common); from->expr= NULL; @@ -585,12 +453,7 @@ } RowDef * -#if NeedFunctionPrototypes RowDeclCreate(KeyDef * keys) -#else -RowDeclCreate(keys) - KeyDef * keys; -#endif { RowDef * row; KeyDef * key; @@ -611,13 +474,7 @@ } SectionDef * -#if NeedFunctionPrototypes SectionDeclCreate(Atom name,RowDef *rows) -#else -SectionDeclCreate(name,rows) - Atom name; - RowDef * rows; -#endif { SectionDef * section; RowDef * row; @@ -639,13 +496,7 @@ } OverlayKeyDef * -#if NeedFunctionPrototypes OverlayKeyCreate(char * under,char *over) -#else -OverlayKeyCreate(under,over) - char * under; - char * over; -#endif { OverlayKeyDef * key; @@ -662,13 +513,7 @@ } OverlayDef * -#if NeedFunctionPrototypes OverlayDeclCreate(Atom name,OverlayKeyDef *keys) -#else -OverlayDeclCreate(name,keys) - Atom name; - OverlayKeyDef * keys; -#endif { OverlayDef * ol; OverlayKeyDef * key; @@ -687,14 +532,7 @@ } DoodadDef * -#if NeedFunctionPrototypes DoodadCreate(unsigned type,Atom name,VarDef *body) -#else -DoodadCreate(type,name,body) - unsigned type; - Atom name; - VarDef * body; -#endif { DoodadDef * doodad; @@ -711,13 +549,7 @@ } ExprDef * -#if NeedFunctionPrototypes AppendKeysymList(ExprDef *list,KeySym sym) -#else -AppendKeysymList(list,sym) - ExprDef * list; - KeySym sym; -#endif { if (list->value.list.nSyms>=list->value.list.szSyms) { list->value.list.szSyms*=2; @@ -735,13 +567,7 @@ } int -#if NeedFunctionPrototypes LookupKeysym(char *str,KeySym *sym_rtrn) -#else -LookupKeysym(str,sym_rtrn) - char *str; - KeySym *sym_rtrn; -#endif { KeySym sym; @@ -762,16 +588,10 @@ } IncludeStmt * -#if NeedFunctionPrototypes IncludeCreate(char *str,unsigned merge) -#else -IncludeCreate(str,merge) - char * str; - unsigned merge; -#endif { IncludeStmt * incl,*first; -char * file,*map,*stmt,*tmp; +char * file,*map,*stmt,*tmp, *extra_data; char nextop; Bool haveSelf; @@ -781,7 +601,7 @@ tmp= str; stmt= uStringDup(str); while ((tmp)&&(*tmp)) { - if (XkbParseIncludeMap(&tmp,&file,&map,&nextop)) { + if (XkbParseIncludeMap(&tmp,&file,&map,&nextop,&extra_data)) { if ((file==NULL)&&(map==NULL)) { if (haveSelf) goto BAIL; @@ -800,6 +620,7 @@ incl->stmt= NULL; incl->file= file; incl->map= map; + incl->modifier= extra_data; incl->path= NULL; incl->next= NULL; } @@ -825,6 +646,7 @@ incl= first->next; if (first->file) uFree(first->file); if (first->map) uFree(first->map); + if (first->modifier) uFree(first->modifier); if (first->path) uFree(first->path); first->file= first->map= first->path= NULL; uFree(first); @@ -837,12 +659,7 @@ #ifdef DEBUG void -#if NeedFunctionPrototypes PrintStmtAddrs(ParseCommon *stmt) -#else -PrintStmtAddrs(stmt) - ParseCommon * stmt; -#endif { fprintf(stderr,"0x%x",stmt); if (stmt) { @@ -856,12 +673,7 @@ #endif static void -#if NeedFunctionPrototypes CheckDefaultMap(XkbFile *maps) -#else -CheckDefaultMap(maps) -XkbFile *maps; -#endif { XkbFile * dflt,*tmp; @@ -885,24 +697,8 @@ return; } -_XFUNCPROTOBEGIN -extern int yyparse( -#if NeedFunctionPrototypes - void -#endif -); -_XFUNCPROTOEND - -extern FILE * yyin; - int -#if NeedFunctionPrototypes XKBParseFile(FILE *file,XkbFile **pRtrn) -#else -XKBParseFile(file,pRtrn) -FILE *file; -XkbFile **pRtrn; -#endif { if (file) { yyin= file; @@ -921,15 +717,7 @@ } XkbFile * -#if NeedFunctionPrototypes CreateXKBFile(int type,char *name,ParseCommon *defs,unsigned flags) -#else -CreateXKBFile(type,name,defs,flags) -int type; -char * name; -ParseCommon * defs; -unsigned flags; -#endif { XkbFile * file; static int fileID; @@ -950,13 +738,7 @@ } unsigned -#if NeedFunctionPrototypes StmtSetMerge(ParseCommon *stmt,unsigned merge) -#else -StmtSetMerge(stmt,merge) - ParseCommon * stmt; - unsigned merge; -#endif { if ((merge==MergeAltForm) && (stmt->stmtType!=StmtKeycodeDef)) { yyerror("illegal use of 'alternate' merge mode"); Index: xc/programs/xkbcomp/parseutils.h diff -u xc/programs/xkbcomp/parseutils.h:1.3 xc/programs/xkbcomp/parseutils.h:1.5 --- xc/programs/xkbcomp/parseutils.h:1.3 Wed Jan 17 18:45:44 2001 +++ xc/programs/xkbcomp/parseutils.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/parseutils.h,v 1.5 2002/07/01 02:26:01 tsi Exp $ */ #ifndef XKBPARSE_H #define XKBPARSE_H 1 @@ -50,270 +51,198 @@ #define d2(str,a,b) #endif -_XFUNCPROTOBEGIN extern ParseCommon *AppendStmt( -#if NeedFunctionPrototypes ParseCommon * /* to */, ParseCommon * /* append */ -#endif ); extern ExprDef *ExprCreate( -#if NeedFunctionPrototypes unsigned /* op */, unsigned /* type */ -#endif ); extern ExprDef *ExprCreateUnary( -#if NeedFunctionPrototypes unsigned /* op */, unsigned /* type */, ExprDef * /* child */ -#endif ); extern ExprDef *ExprCreateBinary( -#if NeedFunctionPrototypes unsigned /* op */, ExprDef * /* left */, ExprDef * /* right */ -#endif ); extern KeycodeDef *KeycodeCreate( -#if NeedFunctionPrototypes char * /* name */, ExprDef * /* value */ -#endif ); extern KeyAliasDef *KeyAliasCreate( -#if NeedFunctionPrototypes char * /* alias */, char * /* real */ -#endif ); extern VModDef *VModCreate( -#if NeedFunctionPrototypes Atom /* name */, ExprDef * /* value */ -#endif ); extern VarDef *VarCreate( -#if NeedFunctionPrototypes ExprDef * /* name */, ExprDef * /* value */ -#endif ); extern VarDef *BoolVarCreate( -#if NeedFunctionPrototypes Atom /* nameToken */, unsigned /* set */ -#endif ); extern InterpDef *InterpCreate( -#if NeedFunctionPrototypes KeySym /* sym */, ExprDef * /* match */ -#endif ); extern KeyTypeDef *KeyTypeCreate( -#if NeedFunctionPrototypes Atom /* name */, VarDef * /* body */ -#endif ); extern SymbolsDef *SymbolsCreate( -#if NeedFunctionPrototypes char * /* keyName */, ExprDef * /* symbols */ -#endif ); extern GroupCompatDef *GroupCompatCreate( -#if NeedFunctionPrototypes int /* group */, ExprDef * /* def */ -#endif ); extern ModMapDef *ModMapCreate( -#if NeedFunctionPrototypes Atom /* modifier */, ExprDef * /* keys */ -#endif ); extern IndicatorMapDef *IndicatorMapCreate( -#if NeedFunctionPrototypes Atom /* name */, VarDef * /* body */ -#endif ); extern IndicatorNameDef *IndicatorNameCreate( -#if NeedFunctionPrototypes int /* ndx */, ExprDef * /* name */, Bool /* virtual */ -#endif ); extern ExprDef *ActionCreate( -#if NeedFunctionPrototypes Atom /* name */, ExprDef * /* args */ -#endif ); extern ExprDef *CreateKeysymList( -#if NeedFunctionPrototypes KeySym /* sym */ -#endif ); extern ShapeDef *ShapeDeclCreate( -#if NeedFunctionPrototypes Atom /* name */, OutlineDef * /* outlines */ -#endif ); extern OutlineDef *OutlineCreate( -#if NeedFunctionPrototypes Atom /* field */, ExprDef * /* points */ -#endif ); extern KeyDef *KeyDeclCreate( -#if NeedFunctionPrototypes char * /* name */, ExprDef * /* expr */ -#endif ); extern KeyDef *KeyDeclMerge( -#if NeedFunctionPrototypes KeyDef * /* into */, KeyDef * /* from */ -#endif ); extern RowDef *RowDeclCreate( -#if NeedFunctionPrototypes KeyDef * /* keys */ -#endif ); extern SectionDef *SectionDeclCreate( -#if NeedFunctionPrototypes Atom /* name */, RowDef * /* rows */ -#endif ); extern OverlayKeyDef *OverlayKeyCreate( -#if NeedFunctionPrototypes char * /* under */, char * /* over */ -#endif ); extern OverlayDef *OverlayDeclCreate( -#if NeedFunctionPrototypes Atom /* name */, OverlayKeyDef * /* rows */ -#endif ); extern DoodadDef *DoodadCreate( -#if NeedFunctionPrototypes unsigned /* type */, Atom /* name */, VarDef * /* body */ -#endif ); extern ExprDef *AppendKeysymList( -#if NeedFunctionPrototypes ExprDef * /* list */, KeySym /* sym */ -#endif ); extern int LookupKeysym( -#if NeedFunctionPrototypes char * /* str */, KeySym * /* sym_rtrn */ -#endif ); extern IncludeStmt *IncludeCreate( -#if NeedFunctionPrototypes char * /* str */, unsigned /* merge */ -#endif ); extern unsigned StmtSetMerge( -#if NeedFunctionPrototypes ParseCommon * /* stmt */, unsigned /* merge */ -#endif ); #ifdef DEBUG extern void PrintStmtAddrs( -#if NeedFunctionPrototypes ParseCommon * /* stmt */ -#endif ); #endif extern int XKBParseFile( -#if NeedFunctionPrototypes -FILE * /* file */, + FILE * /* file */, XkbFile ** /* pRtrn */ -#endif ); extern XkbFile *CreateXKBFile( -#if NeedFunctionPrototypes int /* type */, char * /* name */, ParseCommon * /* defs */, unsigned /* flags */ -#endif ); extern void yyerror( -#if NeedFunctionPrototypes char * /* s */ -#endif ); extern int yywrap( -#if NeedFunctionPrototypes void -#endif ); +extern int yylex(void); +extern int yyparse(void); + extern int setScanState( -#if NeedFunctionPrototypes char * /* file */, int /* line */ -#endif ); -_XFUNCPROTOEND +extern FILE *yyin; #endif /* XKBPARSE_H */ Index: xc/programs/xkbcomp/symbols.c diff -u xc/programs/xkbcomp/symbols.c:3.11 xc/programs/xkbcomp/symbols.c:3.14 --- xc/programs/xkbcomp/symbols.c:3.11 Tue Feb 20 11:43:14 2001 +++ xc/programs/xkbcomp/symbols.c Fri Dec 20 15:18:33 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/symbols.c,v 3.11 2001/02/20 16:43:14 paulo Exp $ */ +/* $XFree86: xc/programs/xkbcomp/symbols.c,v 3.14 2002/12/20 20:18:33 paulo Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -32,6 +32,7 @@ #include <X11/keysym.h> #include <X11/Xutil.h> +#include <stdlib.h> #include "expr.h" #include "vmod.h" @@ -79,12 +80,7 @@ } KeyInfo; static void -#if NeedFunctionPrototypes InitKeyInfo(KeyInfo *info) -#else -InitKeyInfo(info) - KeyInfo * info; -#endif { register int i; static char dflt[4]= "*"; @@ -113,12 +109,7 @@ } static void -#if NeedFunctionPrototypes FreeKeyInfo(KeyInfo *info) -#else -FreeKeyInfo(info) - KeyInfo * info; -#endif { register int i; @@ -148,14 +139,7 @@ } static Bool -#if NeedFunctionPrototypes CopyKeyInfo(KeyInfo *old,KeyInfo *new,Bool clearOld) -#else -CopyKeyInfo(old,new,clearOld) - KeyInfo * old; - KeyInfo * new; - Bool clearOld; -#endif { register int i; @@ -215,6 +199,7 @@ int errorCount; unsigned fileID; unsigned merge; + unsigned explicit_group; unsigned groupInfo; unsigned szKeys; unsigned nKeys; @@ -229,13 +214,7 @@ } SymbolsInfo; static void -#if NeedFunctionPrototypes InitSymbolsInfo(SymbolsInfo *info,XkbDescPtr xkb) -#else -InitSymbolsInfo(info,xkb) - SymbolsInfo * info; - XkbDescPtr xkb; -#endif { register int i; @@ -243,6 +222,7 @@ tok_TWO_LEVEL= XkbInternAtom(NULL,"TWO_LEVEL",False); tok_KEYPAD= XkbInternAtom(NULL,"KEYPAD",False); info->name= NULL; + info->explicit_group= 0; info->errorCount= 0; info->fileID= 0; info->merge= MergeOverride; @@ -261,12 +241,7 @@ } static void -#if NeedFunctionPrototypes FreeSymbolsInfo(SymbolsInfo *info) -#else -FreeSymbolsInfo(info) - SymbolsInfo * info; -#endif { register int i; @@ -293,18 +268,10 @@ } static Bool -#if NeedFunctionPrototypes ResizeKeyGroup( KeyInfo * key, unsigned group, unsigned atLeastSize, Bool forceActions) -#else -ResizeKeyGroup(key,group,atLeastSize,forceActions) - KeyInfo * key; - unsigned group; - unsigned atLeastSize; - Bool forceActions; -#endif { Bool tooSmall; unsigned newWidth; @@ -333,18 +300,10 @@ } static Bool -#if NeedFunctionPrototypes MergeKeyGroups( SymbolsInfo * info, KeyInfo * into, KeyInfo * from, unsigned group) -#else -MergeKeyGroups(info,into,from,group) - SymbolsInfo * info; - KeyInfo * into; - KeyInfo * from; - unsigned group; -#endif { KeySym * resultSyms; XkbAction * resultActs; @@ -438,23 +397,24 @@ uFree(into->syms[group]); if ((from->syms[group]!=NULL)&&(resultSyms!=from->syms[group])) uFree(from->syms[group]); + if ((into->acts[group]!=NULL)&&(resultActs!=into->acts[group])) + uFree(into->acts[group]); + if ((from->acts[group]!=NULL)&&(resultActs!=from->acts[group])) + uFree(from->acts[group]); into->numLevels[group]= resultWidth; into->syms[group]= resultSyms; from->syms[group]= NULL; + into->acts[group]= resultActs; + from->acts[group]= NULL; into->symsDefined|= (1<<group); from->symsDefined&= ~(1<<group); + into->actsDefined|= (1<<group); + from->actsDefined&= ~(1<<group); return True; } static Bool -#if NeedFunctionPrototypes MergeKeys(SymbolsInfo *info,KeyInfo *into,KeyInfo *from) -#else -MergeKeys(info,into,from) - SymbolsInfo * info; - KeyInfo * into; - KeyInfo * from; -#endif { register int i; unsigned collide= 0; @@ -552,14 +512,7 @@ } static Bool -#if NeedFunctionPrototypes AddKeySymbols(SymbolsInfo *info,KeyInfo *key,XkbDescPtr xkb) -#else -AddKeySymbols(info,key) - SymbolsInfo * info; - KeyInfo * key; - XkbDescPtr xkb; -#endif { register int i; unsigned long real_name; @@ -587,13 +540,7 @@ } static Bool -#if NeedFunctionPrototypes AddModMapEntry(SymbolsInfo *info,ModMapEntry *new) -#else -AddModMapEntry(info,new) - SymbolsInfo * info; - ModMapEntry * new; -#endif { ModMapEntry * mm; Bool clobber; @@ -658,16 +605,8 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes MergeIncludedSymbols(SymbolsInfo *into,SymbolsInfo *from, unsigned merge,XkbDescPtr xkb) -#else -MergeIncludedSymbols(into,from,merge,xkb) - SymbolsInfo * into; - SymbolsInfo * from; - unsigned merge; - XkbDescPtr xkb; -#endif { register int i; KeyInfo * key; @@ -710,27 +649,17 @@ } typedef void (*FileHandler)( -#if NeedFunctionPrototypes XkbFile * /* rtrn */, XkbDescPtr /* xkb */, unsigned /* merge */, SymbolsInfo * /* included */ -#endif ); static Bool -#if NeedFunctionPrototypes HandleIncludeSymbols( IncludeStmt * stmt, XkbDescPtr xkb, SymbolsInfo * info, FileHandler hndlr) -#else -HandleIncludeSymbols(stmt,xkb,info,hndlr) - IncludeStmt * stmt; - XkbDescPtr xkb; - SymbolsInfo * info; - void (*hndlr)(); -#endif { unsigned newMerge; XkbFile * rtrn; @@ -747,6 +676,11 @@ InitSymbolsInfo(&included,xkb); included.fileID= included.dflt.defs.fileID= rtrn->id; included.merge= included.dflt.defs.merge= MergeOverride; + if (stmt->modifier) { + included.explicit_group= atoi(stmt->modifier) - 1; + } else { + included.explicit_group= info->explicit_group; + } (*hndlr)(rtrn,xkb,MergeOverride,&included); if (stmt->stmt!=NULL) { if (included.name!=NULL) @@ -774,6 +708,11 @@ InitSymbolsInfo(&next_incl,xkb); next_incl.fileID= next_incl.dflt.defs.fileID= rtrn->id; next_incl.merge= next_incl.dflt.defs.merge= MergeOverride; + if (next->modifier) { + next_incl.explicit_group= atoi(next->modifier) - 1; + } else { + next_incl.explicit_group= info->explicit_group; + } (*hndlr)(rtrn,xkb,MergeOverride,&next_incl); MergeIncludedSymbols(&included,&next_incl,op,xkb); FreeSymbolsInfo(&next_incl); @@ -810,18 +749,10 @@ #define ACTIONS 2 static Bool -#if NeedFunctionPrototypes GetGroupIndex( KeyInfo * key, ExprDef * arrayNdx, unsigned what, unsigned * ndx_rtrn) -#else -GetGroupIndex(key,arrayNdx,what,ndx_rtrn) - KeyInfo * key; - ExprDef * arrayNdx; - unsigned what; - unsigned * ndx_rtrn; -#endif { char * name; ExprResult tmp; @@ -865,22 +796,12 @@ } static Bool -#if NeedFunctionPrototypes AddSymbolsToKey( KeyInfo * key, XkbDescPtr xkb, char * field, ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info) -#else -AddSymbolsToKey(key,xkb,field,arrayNdx,value,info) - KeyInfo * key; - XkbDescPtr xkb; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SymbolsInfo * info; -#endif { unsigned ndx,nSyms; int i; @@ -914,8 +835,6 @@ key->symsDefined|= (1<<ndx); memcpy((char *)key->syms[ndx],(char *)value->value.list.syms, nSyms*sizeof(KeySym)); - uFree(value->value.list.syms); - value->value.list.syms= NULL; for (i=key->numLevels[ndx]-1;(i>=0)&&(key->syms[ndx][i]==NoSymbol);i--) { key->numLevels[ndx]--; } @@ -923,22 +842,12 @@ } static Bool -#if NeedFunctionPrototypes AddActionsToKey( KeyInfo * key, XkbDescPtr xkb, char * field, ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info) -#else -AddActionsToKey(key,xkb,field,arrayNdx,value,info) - KeyInfo * key; - XkbDescPtr xkb; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SymbolsInfo * info; -#endif { register int i; unsigned ndx,nActs; @@ -994,14 +903,7 @@ } static int -#if NeedFunctionPrototypes SetAllowNone(KeyInfo *key,ExprDef *arrayNdx,ExprDef *value) -#else -SetAllowNone(key,arrayNdx,value) - KeyInfo * key; - ExprDef * arrayNdx; - ExprDef * value; -#endif { ExprResult tmp; unsigned radio_groups= 0; @@ -1063,22 +965,12 @@ }; static Bool -#if NeedFunctionPrototypes SetSymbolsField( KeyInfo * key, XkbDescPtr xkb, char * field, ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info) -#else -SetSymbolsField(key,xkb,field,arrayNdx,value,info) - KeyInfo * key; - XkbDescPtr xkb; - char * field; - ExprDef * arrayNdx; - ExprDef * value; - SymbolsInfo * info; -#endif { Bool ok= True; ExprResult tmp; @@ -1282,14 +1174,7 @@ } static int -#if NeedFunctionPrototypes SetGroupName(SymbolsInfo *info,ExprDef *arrayNdx,ExprDef *value) -#else -SetGroupName(info,arrayNdx,value) - SymbolsInfo * info; - ExprDef * arrayNdx; - ExprDef * value; -#endif { ExprResult tmp,name; @@ -1314,19 +1199,14 @@ ACTION1("Illegal name for group %d ignored\n",tmp.uval); return False; } - info->groupNames[tmp.uval-1]= XkbInternAtom(NULL,name.str,False); + info->groupNames[tmp.uval-1+info->explicit_group]= + XkbInternAtom(NULL,name.str,False); + return True; } static int -#if NeedFunctionPrototypes HandleSymbolsVar(VarDef *stmt,XkbDescPtr xkb,SymbolsInfo *info) -#else -HandleSymbolsVar(stmt,xkb,info) - VarDef * stmt; - XkbDescPtr xkb; - SymbolsInfo * info; -#endif { ExprResult elem,field,tmp; ExprDef * arrayNdx; @@ -1388,18 +1268,10 @@ } static Bool -#if NeedFunctionPrototypes HandleSymbolsBody( VarDef * def, XkbDescPtr xkb, KeyInfo * key, SymbolsInfo * info) -#else -HandleSymbolsBody(def,xkb,key,info) - VarDef * def; - XkbDescPtr xkb; - KeyInfo * key; - SymbolsInfo * info; -#endif { Bool ok= True; ExprResult tmp,field; @@ -1427,19 +1299,50 @@ return ok; } +static Bool +SetExplicitGroup( SymbolsInfo * info, + KeyInfo * key) +{ + unsigned group = info->explicit_group; + + if (group == 0) + return True; + + if ((key->typesDefined|key->symsDefined|key->actsDefined) & ~1) { + int i; + WARN1("For the map %s an explicit group specified\n", info->name); + WARN1("but key %s has more than one group defined\n", + longText(key->name,XkbMessage)); + ACTION("All groups except first one will be ignored\n"); + for (i = 1; i < XkbNumKbdGroups ; i++) { + key->numLevels[i]= 0; + if (key->syms[i]!=NULL) + uFree(key->syms[i]); + key->syms[i]= (KeySym*) NULL; + if (key->acts[i]!=NULL) + uFree(key->acts[i]); + key->acts[i]= (XkbAction*) NULL; + key->types[i]= (Atom) 0; + } + } + key->typesDefined = key->symsDefined = key->actsDefined = 1 << group; + + key->numLevels[group]= key->numLevels[0]; + key->numLevels[0]= 0; + key->syms[group]= key->syms[0]; + key->syms[0]= (KeySym*) NULL; + key->acts[group]= key->acts[0]; + key->acts[0]= (XkbAction*) NULL; + key->types[group]= key->types[0]; + key->types[0]= (Atom) 0; + return True; +} + static int -#if NeedFunctionPrototypes HandleSymbolsDef( SymbolsDef * stmt, XkbDescPtr xkb, unsigned merge, SymbolsInfo * info) -#else -HandleSymbolsDef(stmt,xkb,merge,info) - SymbolsDef * stmt; - XkbDescPtr xkb; - unsigned merge; - SymbolsInfo * info; -#endif { KeyInfo key; @@ -1452,6 +1355,11 @@ return False; } + if (!SetExplicitGroup(info,&key)) { + info->errorCount++; + return False; + } + if (!AddKeySymbols(info,&key,xkb)) { info->errorCount++; return False; @@ -1460,18 +1368,10 @@ } static Bool -#if NeedFunctionPrototypes HandleModMapDef( ModMapDef * def, XkbDescPtr xkb, unsigned merge, SymbolsInfo * info) -#else -HandleModMapDef(def,xkb,merge,info) - ModMapDef * def; - XkbDescPtr xkb; - unsigned merge; - SymbolsInfo * info; -#endif { ExprDef * key; ModMapEntry tmp; @@ -1508,18 +1408,10 @@ } static void -#if NeedFunctionPrototypes HandleSymbolsFile( XkbFile * file, XkbDescPtr xkb, unsigned merge, SymbolsInfo * info) -#else -HandleSymbolsFile(file,xkb,merge,info) - XkbFile * file; - XkbDescPtr xkb; - unsigned merge; - SymbolsInfo * info; -#endif { ParseCommon *stmt; @@ -1576,14 +1468,7 @@ } static Bool -#if NeedFunctionPrototypes FindKeyForSymbol(XkbDescPtr xkb,KeySym sym,unsigned int *kc_rtrn) -#else -FindKeyForSymbol(xkb,sym,kc_rtrn) - XkbDescPtr xkb; - KeySym sym; - unsigned int * kc_rtrn; -#endif { register int i, j; register Bool gotOne; @@ -1606,14 +1491,7 @@ } static Bool -#if NeedFunctionPrototypes FindNamedType(XkbDescPtr xkb,Atom name,unsigned *type_rtrn) -#else -FindNamedType(xkb,name,type_rtrn) - XkbDescPtr xkb; - Atom name; - unsigned * type_rtrn; -#endif { register unsigned n; @@ -1629,34 +1507,121 @@ } static Bool -#if NeedFunctionPrototypes FindAutomaticType(int width,KeySym *syms,Atom *typeNameRtrn) -#else -FindAutomaticType(width,syms,typeNameRtrn) - int width; - KeySym * syms; - Atom * typeNameRtrn; -#endif { - if ((width==1)||(width==0)) + if ((width==1)||(width==0)) { *typeNameRtrn= XkbInternAtom(NULL,"ONE_LEVEL",False); - else if ( syms && XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]) ) - *typeNameRtrn= XkbInternAtom(NULL,"ALPHABETIC",False); - else if ( syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])) ) - *typeNameRtrn= XkbInternAtom(NULL,"KEYPAD",False); - else *typeNameRtrn= XkbInternAtom(NULL,"TWO_LEVEL",False); - return ((width>=0)&&(width<=2)); + } else if (width == 2) { + if ( syms && XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]) ) + *typeNameRtrn= XkbInternAtom(NULL,"ALPHABETIC",False); + else if ( syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])) ) + *typeNameRtrn= XkbInternAtom(NULL,"KEYPAD",False); + else *typeNameRtrn= XkbInternAtom(NULL,"TWO_LEVEL",False); + } else if (width <= 4 ) { + if ( syms && XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]) ) + *typeNameRtrn= XkbInternAtom(NULL, + "FOUR_LEVEL_ALPHABETIC",False); + else if ( syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])) ) + *typeNameRtrn= XkbInternAtom(NULL, + "FOUR_LEVEL_KEYPAD",False); + else *typeNameRtrn= XkbInternAtom(NULL,"FOUR_LEVEL",False); + } + return ((width>=0)&&(width<=4)); +} + +static void +PrepareKeyDef(KeyInfo *key) +{ + int i, j, width, defined, lastGroup; + Bool identical; + + defined = key->symsDefined | key->actsDefined | key->typesDefined; + for (i = XkbNumKbdGroups - 1; i >= 0; i--) { + if (defined & (1<<i)) + break; + } + lastGroup = i; + + if (lastGroup == 0) + return; + + /* If there are empty groups between non-empty ones fill them with data */ + /* from the first group. */ + /* We can make a wrong assumption here. But leaving gaps is worse. */ + for (i = lastGroup; i > 0; i--) { + if (defined & (1<<i)) + continue; + width = key->numLevels[0]; + if (key->typesDefined & 1) { + for (j = 0; j < width; j++) { + key->types[i] = key->types[0]; + } + key->typesDefined |= 1 << i; + } + if (key->actsDefined & 1) { + key->acts[i]= uTypedCalloc(width, XkbAction); + if (key->acts[i] == NULL) + continue; + memcpy((void *) key->acts[i], (void *) key->acts[0], + width * sizeof(XkbAction)); + key->actsDefined |= 1 << i; + } + if (key->symsDefined & 1) { + key->syms[i]= uTypedCalloc(width, KeySym); + if (key->syms[i] == NULL) + continue; + memcpy((void *) key->syms[i], (void *) key->syms[0], + width * sizeof(KeySym)); + key->symsDefined |= 1 << i; + } + if (defined & 1) { + key->numLevels[i] = key->numLevels[0]; + } + } + /* If all groups are completely identical remove them all */ + /* exept the first one. */ + identical = True; + for (i = lastGroup; i > 0; i--) { + if ((key->numLevels[i] != key->numLevels[0]) || + (key->types[i] != key->types[0])) { + identical = False; + break; + } + if ((key->syms[i] != key->syms[0]) && + (key->syms[i] == NULL || key->syms[0] == NULL || + memcmp((void*) key->syms[i], (void*) key->syms[0], + sizeof(KeySym) * key->numLevels[0])) ) { + identical = False; + break; + } + if ((key->acts[i] != key->acts[0]) && + (key->acts[i] == NULL || key->acts[0] == NULL || + memcmp((void*) key->acts[i], (void*) key->acts[0], + sizeof(XkbAction) * key->numLevels[0]))) { + identical = False; + break; + } + } + if (identical) { + for (i = lastGroup; i > 0; i--) { + key->numLevels[i]= 0; + if (key->syms[i] != NULL) + uFree(key->syms[i]); + key->syms[i]= (KeySym*) NULL; + if (key->acts[i] != NULL) + uFree(key->acts[i]); + key->acts[i]= (XkbAction*) NULL; + key->types[i]= (Atom) 0; + } + key->symsDefined &= 1; + key->actsDefined &= 1; + key->typesDefined &= 1; + } + return; } static Bool -#if NeedFunctionPrototypes CopySymbolsDef(XkbFileInfo *result,KeyInfo *key,int start_from) -#else -CopySymbolsDef(result,key,start_from) - XkbFileInfo * result; - KeyInfo * key; - int start_from; -#endif { register int i; unsigned okc,kc,width,tmp,nGroups; @@ -1706,7 +1671,7 @@ } } if (FindNamedType(xkb,key->types[i],&types[i])) { - if (!autoType) + if (!autoType || key->numLevels[i] > 2) xkb->server->explicit[kc]|= (1<<i); } else { @@ -1814,13 +1779,7 @@ } static Bool -#if NeedFunctionPrototypes CopyModMapDef(XkbFileInfo *result,ModMapEntry *entry) -#else -CopyModMapDef(result,entry) - XkbFileInfo * result; - ModMapEntry * entry; -#endif { unsigned kc; XkbDescPtr xkb; @@ -1852,14 +1811,7 @@ } Bool -#if NeedFunctionPrototypes CompileSymbols(XkbFile *file,XkbFileInfo *result,unsigned merge) -#else -CompileSymbols(file,result,merge) - XkbFile * file; - XkbFileInfo * result; - unsigned merge; -#endif { register int i; SymbolsInfo info; @@ -1902,6 +1854,9 @@ for (i=0;i<XkbNumKbdGroups;i++) { if (info.groupNames[i]!=None) xkb->names->groups[i]= info.groupNames[i]; + } + for (key=info.keys,i=0;i<info.nKeys;i++,key++) { + PrepareKeyDef(key); } for (key=info.keys,i=0;i<info.nKeys;i++,key++) { if (!CopySymbolsDef(result,key,0)) Index: xc/programs/xkbcomp/utils.c diff -u xc/programs/xkbcomp/utils.c:3.6 xc/programs/xkbcomp/utils.c:3.7 --- xc/programs/xkbcomp/utils.c:3.6 Wed Jul 25 11:05:24 2001 +++ xc/programs/xkbcomp/utils.c Tue Jun 4 20:00:37 2002 @@ -25,7 +25,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ -/* $XFree86: xc/programs/xkbcomp/utils.c,v 3.6 2001/07/25 15:05:24 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/utils.c,v 3.7 2002/06/05 00:00:37 dawes Exp $ */ #include "utils.h" #include <ctype.h> @@ -35,12 +35,7 @@ /***====================================================================***/ Opaque -#if NeedFunctionPrototypes uAlloc(unsigned size) -#else -uAlloc(size) - unsigned size; -#endif { return((Opaque)malloc(size)); } @@ -48,13 +43,7 @@ /***====================================================================***/ Opaque -#if NeedFunctionPrototypes uCalloc(unsigned n,unsigned size) -#else -uCalloc(n,size) - unsigned n; - unsigned size; -#endif { return((Opaque)calloc(n,size)); } @@ -62,13 +51,7 @@ /***====================================================================***/ Opaque -#if NeedFunctionPrototypes uRealloc(Opaque old,unsigned newSize) -#else -uRealloc(old,newSize) - Opaque old; - unsigned newSize; -#endif { if (old==NULL) return((Opaque)malloc(newSize)); @@ -78,15 +61,7 @@ /***====================================================================***/ Opaque -#if NeedFunctionPrototypes uRecalloc(Opaque old,unsigned nOld,unsigned nNew,unsigned itemSize) -#else -uRecalloc(old,nOld,nNew,itemSize) - Opaque old; - unsigned nOld; - unsigned nNew; - unsigned itemSize; -#endif { char *rtrn; @@ -104,12 +79,7 @@ /***====================================================================***/ void -#if NeedFunctionPrototypes uFree(Opaque ptr) -#else -uFree(ptr) - Opaque ptr; -#endif { if (ptr!=(Opaque)NULL) free((char *)ptr); @@ -124,12 +94,7 @@ int uEntryLevel; Boolean -#if NeedFunctionPrototypes uSetEntryFile(char *name) -#else -uSetEntryFile(name) - char *name; -#endif { if ((entryFile!=NULL)&&(entryFile!=stderr)) { fprintf(entryFile,"switching to %s\n",name?name:"stderr"); @@ -160,13 +125,7 @@ } void -#if NeedFunctionPrototypes uExit(int l,char *rtVal) -#else -uExit(l,rtVal) - int l; - char * rtVal; -#endif { int i; @@ -188,12 +147,7 @@ int uDebugIndentSize= 4; Boolean -#if NeedFunctionPrototypes uSetDebugFile(char *name) -#else -uSetDebugFile(name) - char *name; -#endif { if ((uDebugFile!=NULL)&&(uDebugFile!=stderr)) { fprintf(uDebugFile,"switching to %s\n",name?name:"stderr"); @@ -243,12 +197,7 @@ static char *prefix= NULL; Boolean -#if NeedFunctionPrototypes uSetErrorFile(char *name) -#else -uSetErrorFile(name) - char *name; -#endif { if ((errorFile!=NULL)&&(errorFile!=stderr)) { fprintf(errorFile,"switching to %s\n",name?name:"stderr"); @@ -370,12 +319,7 @@ } void -#if NeedFunctionPrototypes uSetPreErrorMessage(char *msg) -#else -uSetPreErrorMessage(msg) - char *msg; -#endif { outCount= 0; preMsg= msg; @@ -383,35 +327,21 @@ } void -#if NeedFunctionPrototypes uSetPostErrorMessage(char *msg) -#else -uSetPostErrorMessage(msg) - char *msg; -#endif { postMsg= msg; return; } void -#if NeedFunctionPrototypes uSetErrorPrefix(char *pre) -#else -uSetErrorPrefix(pre) - char *pre; -#endif { prefix= pre; return; } void -#if NeedFunctionPrototypes uFinishUp(void) -#else -uFinishUp() -#endif { if ((outCount>0)&&(postMsg!=NULL)) fprintf(errorFile,"%s\n",postMsg); @@ -422,12 +352,7 @@ #ifndef HAVE_STRDUP char * -#if NeedFunctionPrototypes uStringDup(char *str) -#else -uStringDup(str) - char *str; -#endif { char *rtrn; @@ -441,12 +366,7 @@ #ifndef HAVE_STRCASECMP int -#if NeedFunctionPrototypes uStrCaseCmp(char *str1,char *str2) -#else -uStrCaseCmp(str1, str2) - char *str1, *str2; -#endif { char buf1[512],buf2[512]; char c, *s; @@ -472,12 +392,7 @@ } int -#if NeedFunctionPrototypes uStrCasePrefix(char *my_prefix,char *str) -#else -uStrCasePrefix(my_prefix, str) - char *my_prefix, *str; -#endif { char c1; char c2; Index: xc/programs/xkbcomp/utils.h diff -u xc/programs/xkbcomp/utils.h:3.4 xc/programs/xkbcomp/utils.h:3.6 --- xc/programs/xkbcomp/utils.h:3.4 Wed Jul 25 11:05:24 2001 +++ xc/programs/xkbcomp/utils.h Tue Dec 24 12:43:00 2002 @@ -27,7 +27,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ -/* $XFree86: xc/programs/xkbcomp/utils.h,v 3.4 2001/07/25 15:05:24 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/utils.h,v 3.6 2002/12/24 17:43:00 tsi Exp $ */ /***====================================================================***/ @@ -71,8 +71,6 @@ #define comparisonText(c) ((c)?((c)<0?"Less":"Greater"):"Equal") #endif -_XFUNCPROTOBEGIN - #if 0 typedef union { int i; @@ -85,34 +83,24 @@ /***====================================================================***/ extern Opaque uAlloc( -#if NeedFunctionPrototypes unsigned /* size */ -#endif ); extern Opaque uCalloc( -#if NeedFunctionPrototypes unsigned /* n */, unsigned /* size */ -#endif ); extern Opaque uRealloc( -#if NeedFunctionPrototypes Opaque /* old */, unsigned /* newSize */ -#endif ); extern Opaque uRecalloc( -#if NeedFunctionPrototypes Opaque /* old */, unsigned /* nOld */, unsigned /* nNew */, unsigned /* newSize */ -#endif ); extern void uFree( -#if NeedFunctionPrototypes Opaque /* ptr */ -#endif ); #define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t))) @@ -130,12 +118,9 @@ /***====================================================================***/ extern Boolean uSetErrorFile( -#if NeedFunctionPrototypes char * /* name */ -#endif ); -#if NeedVarargsPrototypes #define INFO6 uInformation #define INFO5 uInformation #define INFO4 uInformation @@ -143,29 +128,16 @@ #define INFO2 uInformation #define INFO1 uInformation #define INFO uInformation -#else -#define INFO6(s,a,b,c,d,e,f) uInformation((s),(Opaque)(a),(Opaque)(b),\ - (Opaque)(c),(Opaque)(d),\ - (Opaque)(e),(Opaque)(f)) -#define INFO5(s,a,b,c,d,e) INFO6(s,a,b,c,d,e,NULL) -#define INFO4(s,a,b,c,d) INFO5(s,a,b,c,d,NULL) -#define INFO3(s,a,b,c) INFO4(s,a,b,c,NULL) -#define INFO2(s,a,b) INFO3(s,a,b,NULL) -#define INFO1(s,a) INFO2(s,a,NULL) -#define INFO(s) INFO1(s,NULL) -#endif extern void uInformation( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; -#if NeedVarargsPrototypes #define ACTION6 uAction #define ACTION5 uAction #define ACTION4 uAction @@ -173,29 +145,16 @@ #define ACTION2 uAction #define ACTION1 uAction #define ACTION uAction -#else -#define ACTION6(s,a,b,c,d,e,f) uAction((s),(Opaque)(a),(Opaque)(b),\ - (Opaque)(c),(Opaque)(d),\ - (Opaque)(e),(Opaque)(f)) -#define ACTION5(s,a,b,c,d,e) ACTION6(s,a,b,c,d,e,NULL) -#define ACTION4(s,a,b,c,d) ACTION5(s,a,b,c,d,NULL) -#define ACTION3(s,a,b,c) ACTION4(s,a,b,c,NULL) -#define ACTION2(s,a,b) ACTION3(s,a,b,NULL) -#define ACTION1(s,a) ACTION2(s,a,NULL) -#define ACTION(s) ACTION1(s,NULL) -#endif extern void uAction( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; -#if NeedVarargsPrototypes #define WARN6 uWarning #define WARN5 uWarning #define WARN4 uWarning @@ -203,29 +162,16 @@ #define WARN2 uWarning #define WARN1 uWarning #define WARN uWarning -#else -#define WARN6(s,a,b,c,d,e,f) uWarning((s),(Opaque)(a),(Opaque)(b),\ - (Opaque)(c),(Opaque)(d),\ - (Opaque)(e),(Opaque)(f)) -#define WARN5(s,a,b,c,d,e) WARN6(s,a,b,c,d,e,NULL) -#define WARN4(s,a,b,c,d) WARN5(s,a,b,c,d,NULL) -#define WARN3(s,a,b,c) WARN4(s,a,b,c,NULL) -#define WARN2(s,a,b) WARN3(s,a,b,NULL) -#define WARN1(s,a) WARN2(s,a,NULL) -#define WARN(s) WARN1(s,NULL) -#endif extern void uWarning( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; -#if NeedVarargsPrototypes #define ERROR6 uError #define ERROR5 uError #define ERROR4 uError @@ -233,29 +179,16 @@ #define ERROR2 uError #define ERROR1 uError #define ERROR uError -#else -#define ERROR6(s,a,b,c,d,e,f) uError((s),(Opaque)(a),(Opaque)(b),\ - (Opaque)(c),(Opaque)(d),\ - (Opaque)(e),(Opaque)(f)) -#define ERROR5(s,a,b,c,d,e) ERROR6(s,a,b,c,d,e,NULL) -#define ERROR4(s,a,b,c,d) ERROR5(s,a,b,c,d,NULL) -#define ERROR3(s,a,b,c) ERROR4(s,a,b,c,NULL) -#define ERROR2(s,a,b) ERROR3(s,a,b,NULL) -#define ERROR1(s,a) ERROR2(s,a,NULL) -#define ERROR(s) ERROR1(s,NULL) -#endif extern void uError( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; -#if NeedVarargsPrototypes #define FATAL6 uFatalError #define FATAL5 uFatalError #define FATAL4 uFatalError @@ -263,30 +196,17 @@ #define FATAL2 uFatalError #define FATAL1 uFatalError #define FATAL uFatalError -#else -#define FATAL6(s,a,b,c,d,e,f) uFatalError((s),(Opaque)(a),(Opaque)(b),\ - (Opaque)(c),(Opaque)(d),\ - (Opaque)(e),(Opaque)(f)) -#define FATAL5(s,a,b,c,d,e) FATAL6(s,a,b,c,d,e,NULL) -#define FATAL4(s,a,b,c,d) FATAL5(s,a,b,c,d,NULL) -#define FATAL3(s,a,b,c) FATAL4(s,a,b,c,NULL) -#define FATAL2(s,a,b) FATAL3(s,a,b,NULL) -#define FATAL1(s,a) FATAL2(s,a,NULL) -#define FATAL(s) FATAL1(s,NULL) -#endif extern void uFatalError( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; /* WSGO stands for "Weird Stuff Going On" */ -#if NeedVarargsPrototypes #define WSGO6 uInternalError #define WSGO5 uInternalError #define WSGO4 uInternalError @@ -294,50 +214,30 @@ #define WSGO2 uInternalError #define WSGO1 uInternalError #define WSGO uInternalError -#else -#define WSGO6(s,a,b,c,d,e,f) uInternalError((s),(Opaque)(a),(Opaque)(b),\ - (Opaque)(c),(Opaque)(d),\ - (Opaque)(e),(Opaque)(f)) -#define WSGO5(s,a,b,c,d,e) WSGO6(s,a,b,c,d,e,NULL) -#define WSGO4(s,a,b,c,d) WSGO5(s,a,b,c,d,NULL) -#define WSGO3(s,a,b,c) WSGO4(s,a,b,c,NULL) -#define WSGO2(s,a,b) WSGO3(s,a,b,NULL) -#define WSGO1(s,a) WSGO2(s,a,NULL) -#define WSGO(s) WSGO1(s,NULL) -#endif extern void uInternalError( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; extern void uSetPreErrorMessage( -#if NeedFunctionPrototypes char * /* msg */ -#endif ); extern void uSetPostErrorMessage( -#if NeedFunctionPrototypes char * /* msg */ -#endif ); extern void uSetErrorPrefix( -#if NeedFunctionPrototypes char * /* void */ -#endif ); extern void uFinishUp( -#if NeedFunctionPrototypes void -#endif ); @@ -356,25 +256,19 @@ #define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0) #else extern int uStrCaseCmp( -#if NeedFunctionPrototypes char * /* s1 */, char * /* s2 */ -#endif ); extern int uStrCasePrefix( -#if NeedFunctionPrototypes char * /* p */, char * /* str */ -#endif ); #endif #ifdef HAVE_STRDUP #define uStringDup(s1) (strdup(s1)) #else extern char *uStringDup( -#if NeedFunctionPrototypes char * /* s1 */ -#endif ); #endif @@ -399,29 +293,25 @@ unsigned int DEBUG_VAR; extern void uDebug( -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; extern void uDebugNOI( /* no indent */ -#if NeedVarargsPrototypes char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 1, 2))) #endif ; extern Boolean uSetDebugFile( -#if NeedFunctionPrototypes char *name -#endif ); extern FILE *uDebugFile; @@ -458,25 +348,20 @@ #endif extern Boolean uSetEntryFile( -#if NeedFunctionPrototypes char *name -#endif ); extern void uEntry( -#if NeedVarargsPrototypes int /* l */, char * /* s */, ... -#endif ) -#if __GNUC__-0 > 2 || (__GNUC__-0 == 2 && __GNUC_MINOR__ >= 6) +#if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) __attribute__((format(printf, 2, 3))) #endif ; extern void uExit( -#if NeedFunctionPrototypes int l,char *rtVal -#endif ); #ifdef ENTRY_TRACKING_ON #define ENTRY_BIT 0x10 @@ -531,7 +416,6 @@ #define uFLAG_VOIDRETURN { return; } #endif -_XFUNCPROTOEND #endif /* UTILS_H */ Index: xc/programs/xkbcomp/vmod.c diff -u xc/programs/xkbcomp/vmod.c:3.3 xc/programs/xkbcomp/vmod.c:3.4 --- xc/programs/xkbcomp/vmod.c:3.3 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/vmod.c Tue Jun 4 20:00:37 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/vmod.c,v 3.3 2001/01/17 23:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/vmod.c,v 3.4 2002/06/05 00:00:37 dawes Exp $ */ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags @@ -40,13 +40,7 @@ #include "vmod.h" void -#if NeedFunctionPrototypes InitVModInfo(VModInfo *info,XkbDescPtr xkb) -#else -InitVModInfo(info,xkb) - VModInfo * info; - XkbDescPtr xkb; -#endif { ClearVModInfo(info,xkb); info->errorCount= 0; @@ -54,13 +48,7 @@ } void -#if NeedFunctionPrototypes ClearVModInfo(VModInfo *info,XkbDescPtr xkb) -#else -ClearVModInfo(info,xkb) - VModInfo * info; - XkbDescPtr xkb; -#endif { register int i; @@ -83,14 +71,7 @@ /***====================================================================***/ Bool -#if NeedFunctionPrototypes HandleVModDef(VModDef *stmt,unsigned mergeMode,VModInfo *info) -#else -HandleVModDef(stmt,mergeMode,info) - VModDef * stmt; - unsigned mergeMode; - VModInfo * info; -#endif { register int i,bit,nextFree; ExprResult mod; @@ -157,20 +138,11 @@ } int -#if NeedFunctionPrototypes LookupVModIndex( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -LookupVModIndex(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { register int i; register char * fieldStr; @@ -195,20 +167,11 @@ } int -#if NeedFunctionPrototypes LookupVModMask( XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) -#else -LookupVModMask(priv,elem,field,type,val_rtrn) - XPointer priv; - Atom elem; - Atom field; - unsigned type; - ExprResult * val_rtrn; -#endif { if (LookupVModIndex(priv,elem,field,type,val_rtrn)) { register unsigned ndx= val_rtrn->uval; @@ -219,12 +182,7 @@ } int -#if NeedFunctionPrototypes FindKeypadVMod(XkbDescPtr xkb) -#else -FindKeypadVMod(xkb) - XkbDescPtr xkb; -#endif { Atom name; ExprResult rtrn; @@ -238,14 +196,7 @@ } Bool -#if NeedFunctionPrototypes ResolveVirtualModifier(ExprDef *def,ExprResult *val_rtrn,VModInfo *info) -#else -ResolveVirtualModifier(def,val_rtrn,info) - ExprDef * def; - ExprResult * val_rtrn; - VModInfo * info; -#endif { XkbNamesPtr names; Index: xc/programs/xkbcomp/vmod.h diff -u xc/programs/xkbcomp/vmod.h:1.1.1.3 xc/programs/xkbcomp/vmod.h:1.3 --- xc/programs/xkbcomp/vmod.h:1.1.1.3 Tue Jan 16 17:55:32 2001 +++ xc/programs/xkbcomp/vmod.h Sun Jun 30 22:26:01 2002 @@ -24,6 +24,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/vmod.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */ + #ifndef VMOD_H #define VMOD_H 1 @@ -36,66 +38,50 @@ } VModInfo; extern void InitVModInfo( -#if NeedFunctionPrototypes VModInfo * /* info */, XkbDescPtr /* xkb */ -#endif ); extern void ClearVModInfo( -#if NeedFunctionPrototypes VModInfo * /* info */, XkbDescPtr /* xkb */ -#endif ); extern Bool HandleVModDef( -#if NeedFunctionPrototypes VModDef * /* stmt */, unsigned /* mergeMode */, VModInfo * /* info */ -#endif ); extern Bool ApplyVModDefs( -#if NeedFunctionPrototypes VModInfo * /* info */, XkbDescPtr /* xkb */ -#endif ); extern int LookupVModIndex( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int LookupVModMask( -#if NeedFunctionPrototypes XPointer /* priv */, Atom /* elem */, Atom /* field */, unsigned /* type */, ExprResult * /* val_rtrn */ -#endif ); extern int FindKeypadVMod( -#if NeedFunctionPrototypes XkbDescPtr /* xkb */ -#endif ); extern Bool ResolveVirtualModifier( -#if NeedFunctionPrototypes ExprDef * /* def */, ExprResult * /* value_rtrn */, VModInfo * /* info */ -#endif ); #endif /* VMOD_H */ Index: xc/programs/xkbcomp/xkbcomp.c diff -u xc/programs/xkbcomp/xkbcomp.c:3.15 xc/programs/xkbcomp/xkbcomp.c:3.18 --- xc/programs/xkbcomp/xkbcomp.c:3.15 Wed Jul 25 11:05:24 2001 +++ xc/programs/xkbcomp/xkbcomp.c Thu Nov 14 22:14:12 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.15 2001/07/25 15:05:24 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.18 2002/11/15 03:14:12 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -50,7 +50,7 @@ #include "tokens.h" #include <X11/extensions/XKBgeom.h> -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define chdir _chdir2 #endif @@ -105,13 +105,7 @@ #define M1(m,a) fprintf(stderr,(m),(a)) static void -#if NeedFunctionPrototypes Usage(int argc,char *argv[]) -#else -Usage(argc,argv) - int argc; - char * argv[]; -#endif { if (!xkblist) M1("Usage: %s [options] input-file [ output-file ]\n",argv[0]); @@ -174,12 +168,7 @@ /***====================================================================***/ static void -#if NeedFunctionPrototypes setVerboseFlags(char *str) -#else -setVerboseFlags(str) - char * str; -#endif { for (;*str;str++) { switch (*str) { @@ -200,13 +189,7 @@ } static Bool -#if NeedFunctionPrototypes parseArgs(int argc,char *argv[]) -#else -parseArgs(argc,argv) - int argc; - char * argv[]; -#endif { register int i,tmp; @@ -634,13 +617,7 @@ } static Display * -#if NeedFunctionPrototypes GetDisplay(char *program,char *dpyName) -#else -GetDisplay(program,dpyName) - char * program; - char * dpyName; -#endif { int mjr,mnr,error; Display *dpy; @@ -682,13 +659,7 @@ extern int yydebug; int -#if NeedFunctionPrototypes main(int argc,char *argv[]) -#else -main(argc,argv) - int argc; - char * argv[]; -#endif { FILE * file; XkbFile * rtrn; @@ -697,12 +668,12 @@ XkbFileInfo result; Status status; - extern FILE *yyin; yyin = stdin; uSetEntryFile(NullString); uSetDebugFile(NullString); uSetErrorFile(NullString); + XkbInitIncludePath(); if (!parseArgs(argc,argv)) exit(1); #ifdef DEBUG @@ -717,7 +688,7 @@ uSetPostErrorMessage(postErrorMsg); file= NULL; XkbInitAtoms(NULL); - XkbInitIncludePath(); + XkbAddDefaultDirectoriesToPath(); if (xkblist) { Bool gotSome; gotSome= GenerateListing(outputFile); Index: xc/programs/xkbcomp/xkbcomp.h diff -u xc/programs/xkbcomp/xkbcomp.h:3.8 xc/programs/xkbcomp/xkbcomp.h:3.9 --- xc/programs/xkbcomp/xkbcomp.h:3.8 Wed Dec 19 16:30:30 2001 +++ xc/programs/xkbcomp/xkbcomp.h Tue Jun 4 20:00:38 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.8 2001/12/19 21:30:30 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.9 2002/06/05 00:00:38 dawes Exp $ */ #ifndef XKBCOMP_H #define XKBCOMP_H 1 @@ -120,6 +120,7 @@ char *stmt; char *file; char *map; + char *modifier; char *path; struct _IncludeStmt *next; } IncludeStmt; @@ -310,61 +311,45 @@ Bool compiled; } XkbFile; -_XFUNCPROTOBEGIN - extern Bool CompileKeymap( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbFileInfo * /* result */, unsigned /* merge */ -#endif ); extern Bool CompileKeycodes( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbFileInfo * /* result */, unsigned /* merge */ -#endif ); extern Bool CompileGeometry( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbFileInfo * /* result */, unsigned /* merge */ -#endif ); extern Bool CompileKeyTypes( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbFileInfo * /* result */, unsigned /* merge */ -#endif ); typedef struct _LEDInfo *LEDInfoPtr; extern Bool CompileCompatMap( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbFileInfo * /* result */, unsigned /* merge */, LEDInfoPtr * /* unboundLEDs */ -#endif ); extern Bool CompileSymbols( -#if NeedFunctionPrototypes XkbFile * /* file */, XkbFileInfo * /* result */, unsigned /* merge */ -#endif ); -_XFUNCPROTOEND - #define WantLongListing (1<<0) #define WantPartialMaps (1<<1) #define WantHiddenMaps (1<<2) @@ -375,33 +360,21 @@ extern unsigned verboseLevel; extern unsigned dirsToStrip; -_XFUNCPROTOBEGIN - extern Bool AddListing( -#if NeedFunctionPrototypes char * /* file */, char * /* map */ -#endif ); extern Bool AddMatchingFiles( -#if NeedFunctionPrototypes char * /* head_in */ -#endif ); extern int AddMapOnly( -#if NeedFunctionPrototypes char * /* map */ -#endif ); extern int GenerateListing( -#if NeedFunctionPrototypes char * /* filename */ -#endif ); - -_XFUNCPROTOEND #endif /* XKBCOMP_H */ Index: xc/programs/xkbcomp/xkbcomp.man diff -u xc/programs/xkbcomp/xkbcomp.man:1.9 xc/programs/xkbcomp/xkbcomp.man:1.10 --- xc/programs/xkbcomp/xkbcomp.man:1.9 Sat Jan 27 13:21:16 2001 +++ xc/programs/xkbcomp/xkbcomp.man Thu Nov 14 22:14:12 2002 @@ -3,7 +3,7 @@ .\" .\" .\" -.\" $XFree86: xc/programs/xkbcomp/xkbcomp.man,v 1.9 2001/01/27 18:21:16 dawes Exp $ +.\" $XFree86: xc/programs/xkbcomp/xkbcomp.man,v 1.10 2002/11/15 03:14:12 dawes Exp $ .\" .TH XKBCOMP 1 __xorgversion__ .SH NAME @@ -55,7 +55,13 @@ .TP 8 .B \-I\fIdir\fP Specifies top-level directories to be searched for files included by the -keymap description. +keymap description. After all directories specified by \-I options +have been searched, the current directory and finally, the default +xkb directory (usually __projectroot__/lib/X11/xkb) will be searched. +.sp +To prevent the current and default directories from being searched, +use the \-I option alone (i.e. without a directory), before any \-I +options that specify the directories you do want searched. .TP 8 .B \-l List maps that specify the \fImap\fP pattern in any files listed on the @@ -82,7 +88,7 @@ Specifies the root directory for relative path names. .TP 8 .B -synch -Force synchonization for X requests. +Force synchronization for X requests. .TP 8 .B \-w\ \fIlvl\fP Controls the reporting of warnings during compilation. A warning level Index: xc/programs/xkbcomp/xkbparse.y diff -u xc/programs/xkbcomp/xkbparse.y:3.9 xc/programs/xkbcomp/xkbparse.y:3.12 --- xc/programs/xkbcomp/xkbparse.y:3.9 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/xkbparse.y Wed Oct 16 17:33:04 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbparse.y,v 3.9 2001/01/17 23:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbparse.y,v 3.12 2002/10/16 21:33:04 tsi Exp $ */ %token END_OF_FILE 0 @@ -98,14 +98,9 @@ #include "parseutils.h" #include <X11/keysym.h> #include <X11/extensions/XKBgeom.h> +#include <stdlib.h> -_XFUNCPROTOBEGIN -extern int yylex( -#if NeedFunctionPrototypes - void -#endif -); -_XFUNCPROTOEND + %} %right EQUALS %left PLUS MINUS @@ -448,7 +443,6 @@ ShapeDecl : SHAPE String OBRACE OutlineList CBRACE SEMI { $$= ShapeDeclCreate($2,(OutlineDef *)&$4->common); } - ; | SHAPE String OBRACE CoordList CBRACE SEMI { OutlineDef *outlines; @@ -511,7 +505,7 @@ { $$= (OverlayKeyDef *) AppendStmt(&$1->common,&$3->common); - }; + } | OverlayKey { $$= $1; } ; @@ -780,12 +774,7 @@ ; %% void -#if NeedFunctionPrototypes yyerror(char *s) -#else -yyerror(s) -char *s; -#endif { if (warningLevel>0) { (void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum, @@ -798,11 +787,7 @@ int -#if NeedFunctionPrototypes yywrap(void) -#else -yywrap() -#endif { return 1; } Index: xc/programs/xkbcomp/xkbpath.c diff -u xc/programs/xkbcomp/xkbpath.c:3.5 xc/programs/xkbcomp/xkbpath.c:3.8 --- xc/programs/xkbcomp/xkbpath.c:3.5 Wed Jul 25 11:05:24 2001 +++ xc/programs/xkbcomp/xkbpath.c Thu Nov 14 22:14:12 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.5 2001/07/25 15:05:24 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.8 2002/11/15 03:14:12 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/XKBlib.h> @@ -46,22 +46,15 @@ #define PATH_CHUNK 8 +static Bool noDefaultPath = False; static int longestPath; static int szPath; static int nPathEntries; static char ** includePath; Bool -#if NeedFunctionPrototypes XkbParseIncludeMap(char **str_inout,char **file_rtrn,char **map_rtrn, - char *nextop_rtrn) -#else -XkbParseIncludeMap(str_inout,file_rtrn,map_rtrn,nextop_rtrn) - char ** str_inout; - char ** file_rtrn; - char ** map_rtrn; - char * nextop_rtrn; -#endif + char *nextop_rtrn, char **extra_data) { char *tmp,*str,*next; @@ -86,12 +79,21 @@ *nextop_rtrn= '\0'; next= NULL; } + tmp= strchr(str,':'); + if (tmp != NULL) { + *tmp++ = '\0'; + *extra_data = uStringDup(tmp); + } + else { + *extra_data = NULL; + } tmp= strchr(str,'('); if (tmp==NULL) { *file_rtrn= uStringDup(str); *map_rtrn= NULL; } else if (str[0]=='(') { + uFree(*extra_data); return False; } else { @@ -101,6 +103,7 @@ tmp= strchr(str,')'); if ((tmp==NULL)||(tmp[1]!='\0')) { uFree(*file_rtrn); + uFree(*extra_data); return False; } *tmp++= '\0'; @@ -116,27 +119,26 @@ } Bool -#if NeedFunctionPrototypes XkbInitIncludePath(void) -#else -XkbInitIncludePath() -#endif { szPath= PATH_CHUNK; includePath= (char **)calloc(szPath,sizeof(char *)); if (includePath==NULL) return False; + return True; +} + +void +XkbAddDefaultDirectoriesToPath(void) +{ + if (noDefaultPath) + return; XkbAddDirectoryToPath("."); XkbAddDirectoryToPath(DFLT_XKB_CONFIG_ROOT); - return True; } void -#if NeedFunctionPrototypes XkbClearIncludePath(void) -#else -XkbClearIncludePath() -#endif { register int i; @@ -150,23 +152,19 @@ nPathEntries= 0; longestPath= 0; } + noDefaultPath = True; return; } Bool -#if NeedFunctionPrototypes XkbAddDirectoryToPath(char *dir) -#else -XkbAddDirectoryToPath(dir) - char *dir; -#endif { int len; if ((dir==NULL)||(dir[0]=='\0')) { XkbClearIncludePath(); return True; } -#ifdef __EMX__ +#ifdef __UNIXOS2__ dir = (char*)__XOS2RedirRoot(dir); #endif len= strlen(dir); @@ -197,12 +195,7 @@ /***====================================================================***/ char * -#if NeedFunctionPrototypes XkbDirectoryForInclude(unsigned type) -#else -XkbDirectoryForInclude(type) - unsigned type; -#endif { static char buf[32]; @@ -251,15 +244,7 @@ static FileCacheEntry *fileCache; void * -#if NeedFunctionPrototypes XkbAddFileToCache(char *name,unsigned type,char *path,void *data) -#else -XkbAddFileToCache(name,type,path,data) - char * name; - unsigned type; - char * path; - void * data; -#endif { FileCacheEntry *entry; @@ -285,14 +270,7 @@ } void * -#if NeedFunctionPrototypes XkbFindFileInCache(char *name,unsigned type,char **pathRtrn) -#else -XkbFindFileInCache(name,type,pathRtrn) - char * name; - unsigned type; - char ** pathRtrn; -#endif { FileCacheEntry *entry; @@ -308,14 +286,7 @@ /***====================================================================***/ FILE * -#if NeedFunctionPrototypes XkbFindFileInPath(char *name,unsigned type,char **pathRtrn) -#else -XkbFindFileInPath(name,type,pathRtrn) - char * name; - unsigned type; - char ** pathRtrn; -#endif { register int i; FILE *file= NULL; Index: xc/programs/xkbcomp/xkbpath.h diff -u xc/programs/xkbcomp/xkbpath.h:1.1.1.1 xc/programs/xkbcomp/xkbpath.h:1.4 --- xc/programs/xkbcomp/xkbpath.h:1.1.1.1 Wed Jan 3 02:40:17 1996 +++ xc/programs/xkbcomp/xkbpath.h Thu Nov 14 22:14:12 2002 @@ -24,66 +24,56 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/xkbpath.h,v 1.4 2002/11/15 03:14:12 dawes Exp $ */ #ifndef _XKBPATH_H_ #define _XKBPATH_H_ 1 extern Bool XkbInitIncludePath( -#if NeedFunctionPrototypes void -#endif ); extern void XkbClearIncludePath( -#if NeedFunctionPrototypes void -#endif ); +extern void XkbAddDefaultDirectoriesToPath( + void +); + extern Bool XkbAddDirectoryToPath( -#if NeedFunctionPrototypes char * /* dir */ -#endif ); extern char * XkbDirectoryForInclude( -#if NeedFunctionPrototypes unsigned /* type */ -#endif ); extern FILE *XkbFindFileInPath( -#if NeedFunctionPrototypes char * /* name */, unsigned /* type */, char ** /* pathRtrn */ -#endif ); extern void * XkbAddFileToCache( -#if NeedFunctionPrototypes char * /* name */, unsigned /* type */, char * /* path */, void * /* data */ -#endif ); extern void * XkbFindFileInCache( -#if NeedFunctionPrototypes char * /* name */, unsigned /* type */, char ** /* pathRtrn */ -#endif ); extern Bool XkbParseIncludeMap( -#if NeedFunctionPrototypes char ** /* str_inout */, char ** /* file_rtrn */, char ** /* map_rtrn */, - char * /* nextop_rtrn */ -#endif + char * /* nextop_rtrn */, + char ** /* extra_data */ ); #endif /* _XKBPATH_H_ */ Index: xc/programs/xkbcomp/xkbscan.c diff -u xc/programs/xkbcomp/xkbscan.c:3.10 xc/programs/xkbcomp/xkbscan.c:3.11 --- xc/programs/xkbcomp/xkbscan.c:3.10 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/xkbscan.c Tue Jun 4 20:00:38 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbscan.c,v 3.10 2001/01/17 23:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbscan.c,v 3.11 2002/06/05 00:00:38 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -35,6 +35,7 @@ #include "tokens.h" #define DEBUG_VAR scanDebug #include "utils.h" +#include "parseutils.h" FILE *yyin = NULL; @@ -58,12 +59,7 @@ extern unsigned debugFlags; static char * -#if NeedFunctionPrototypes tokText(int tok) -#else -tokText(tok) - int tok; -#endif { static char buf[32]; @@ -148,13 +144,7 @@ #endif int -#if NeedFunctionPrototypes setScanState(char *file,int line) -#else -setScanState(file,line) - char * file; - int line; -#endif { if (file!=NULL) strncpy(scanFile,file,1024); @@ -163,12 +153,8 @@ return 1; } -int -#if NeedFunctionPrototypes +static int yyGetString(void) -#else -yyGetString() -#endif { int ch; @@ -229,12 +215,8 @@ return ERROR_TOK; } -int -#if NeedFunctionPrototypes +static int yyGetKeyName(void) -#else -yyGetKeyName() -#endif { int ch; @@ -347,13 +329,8 @@ }; int numKeywords = sizeof(keywords)/sizeof(struct _Keyword); -int -#if NeedFunctionPrototypes +static int yyGetIdent(int first) -#else -yyGetIdent(first) - int first; -#endif { int ch,i,found; int rtrn = IDENT; @@ -388,13 +365,8 @@ return rtrn; } -int -#if NeedFunctionPrototypes +static int yyGetNumber(int ch) -#else -yyGetNumber(ch) - int ch; -#endif { int isFloat= 0; @@ -428,11 +400,7 @@ } int -#if NeedFunctionPrototypes yylex(void) -#else -yylex() -#endif { int ch; int rtrn; Index: xc/programs/xkbcomp/compat/Imakefile diff -u xc/programs/xkbcomp/compat/Imakefile:3.8 xc/programs/xkbcomp/compat/Imakefile:3.10 --- xc/programs/xkbcomp/compat/Imakefile:3.8 Wed Jan 17 18:45:47 2001 +++ xc/programs/xkbcomp/compat/Imakefile Sat Feb 15 17:22:43 2003 @@ -3,10 +3,10 @@ -XCOMM $XFree86: xc/programs/xkbcomp/compat/Imakefile,v 3.8 2001/01/17 23:45:47 dawes Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/compat/Imakefile,v 3.10 2003/02/15 22:22:43 dawes Exp $ - DATAFILES = accessx basic complete default group_led iso9995 japan \ - keypad misc mousekeys norepeat pc pc98 xtest leds + DATAFILES = README accessx basic complete default group_led iso9995 japan \ + keypad misc mousekeys norepeat pc pc98 xtest leds xfree86 all:: Index: xc/programs/xkbcomp/compat/README diff -u /dev/null xc/programs/xkbcomp/compat/README:1.1 --- /dev/null Thu Feb 27 12:35:16 2003 +++ xc/programs/xkbcomp/compat/README Thu Nov 21 23:19:26 2002 @@ -0,0 +1,37 @@ +The core protocol interpretation of keyboard modifiers does not include direct +support for multiple keyboard groups, so XKB reports the effective keyboard +group to XKB-aware clients using some of reserved bits in the state field of +some core protocol events. This modified state field would not be interpreted +correctly by XKB-unaware clients, so XKB provides a group compatibility mapping +which remaps the keyboard group into a core modifier mask that has similar +effects, when possible. + +XKB maintains three compatibility state components that are used to make +XKB-unaware clients(*) work as well as possible: +- The compatibility state which corresponds to the effective modifier and + effective group state. +- The compatibility lookup state which is the core-protocol equivalent of the + lookup state. +- The compatibility grab state which is the nearest core-protocol equivalent + of the grab state. + +Compatibility state are essentially the corresponding XKB states, but with +keyboard group possibly encoded as one or more modifiers. + +Modifiers that correspond to each keyboard group are described in this +group compatibility map. + + +---- +(*) The implementation of XKB invisibly extends the X library to use the +keyboard extension if it is present. That means, clients that use library or +toolkit routines to interpret keyboard events automatically use all of XKB +features; clients that directly interpret the state field of core protocol +events or the keymap direcly may be affected by some of the XKB differences. +Thus most clients can take all advantages without modification but it also +means that XKB state can be reported to clients that have not explicitly +requested the keyboard extension. + + + +/* $XFree86: xc/programs/xkbcomp/compat/README,v 1.1 2002/11/22 04:19:26 dawes Exp $ */ Index: xc/programs/xkbcomp/compat/complete diff -u xc/programs/xkbcomp/compat/complete:1.1.1.3 xc/programs/xkbcomp/compat/complete:1.2 --- xc/programs/xkbcomp/compat/complete:1.1.1.3 Tue Jan 16 17:55:58 2001 +++ xc/programs/xkbcomp/compat/complete Mon Feb 10 21:51:10 2003 @@ -5,5 +5,6 @@ augment "mousekeys" augment "accessx(full)" augment "misc" + augment "xfree86" }; Index: xc/programs/xkbcomp/compat/default diff -u xc/programs/xkbcomp/compat/default:1.1.1.3 xc/programs/xkbcomp/compat/default:1.2 --- xc/programs/xkbcomp/compat/default:1.1.1.3 Tue Jan 16 17:56:00 2001 +++ xc/programs/xkbcomp/compat/default Mon Feb 10 21:51:10 2003 @@ -5,5 +5,6 @@ augment "accessx(basic)" augment "misc" augment "iso9995" + augment "xfree86" augment "japan" }; Index: xc/programs/xkbcomp/compat/iso9995 diff -u xc/programs/xkbcomp/compat/iso9995:1.1.1.3 xc/programs/xkbcomp/compat/iso9995:1.3 --- xc/programs/xkbcomp/compat/iso9995:1.1.1.3 Tue Jan 16 17:56:03 2001 +++ xc/programs/xkbcomp/compat/iso9995 Thu Feb 20 22:16:34 2003 @@ -3,6 +3,8 @@ // Fairly complete set of symbol interpretations // to provide reasonable default behavior +// $XFree86: xc/programs/xkbcomp/compat/iso9995,v 1.3 2003/02/21 03:16:34 dawes Exp $ + default partial xkb_compatibility "default" { virtual_modifiers LevelThree,AltGr; @@ -21,7 +23,6 @@ }; interpret ISO_Level3_Shift+Any { - useModMapMods= level1; virtualModifier= LevelThree; action= SetMods(modifiers=LevelThree); }; @@ -30,6 +31,12 @@ useModMapMods= level1; virtualModifier= LevelThree; action= LatchMods(modifiers=LevelThree); + }; + + interpret ISO_Level3_Lock+Any { + useModMapMods= level1; + virtualModifier= LevelThree; + action= LockMods(modifiers=LevelThree); }; interpret ISO_Group_Latch { Index: xc/programs/xkbcomp/compat/misc diff -u xc/programs/xkbcomp/compat/misc:1.1.1.3 xc/programs/xkbcomp/compat/misc:1.3 --- xc/programs/xkbcomp/compat/misc:1.1.1.3 Tue Jan 16 17:56:11 2001 +++ xc/programs/xkbcomp/compat/misc Thu Feb 20 22:17:42 2003 @@ -1,4 +1,9 @@ // $Xorg: misc,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ +// +// +// +// $XFree86: xc/programs/xkbcomp/compat/misc,v 1.3 2003/02/21 03:17:42 dawes Exp $ + default partial xkb_compatibility "misc" { virtual_modifiers Alt,ScrollLock; @@ -16,8 +21,7 @@ }; interpret Alt_R+Any { - virtualModifier= Alt; - action = SetMods(modifiers=modMapMods); + action = SetMods(modifiers=Alt); }; // Sets the "ScrollLock" virtual modifier and Index: xc/programs/xkbcomp/compat/xfree86 diff -u /dev/null xc/programs/xkbcomp/compat/xfree86:1.1 --- /dev/null Thu Feb 27 12:35:17 2003 +++ xc/programs/xkbcomp/compat/xfree86 Mon Feb 10 21:51:10 2003 @@ -0,0 +1,57 @@ +// $XFree86: xc/programs/xkbcomp/compat/xfree86,v 1.1 2003/02/11 02:51:10 dawes Exp $ +// XFree86 special keysyms + +default partial xkb_compatibility "basic" { + + interpret.repeat= True; + + interpret XF86_Switch_VT_1 { + action = SwitchScreen(Screen=1, !SameServer); + }; + interpret XF86_Switch_VT_2 { + action = SwitchScreen(Screen=2, !SameServer); + }; + interpret XF86_Switch_VT_3 { + action = SwitchScreen(Screen=3, !SameServer); + }; + interpret XF86_Switch_VT_4 { + action = SwitchScreen(Screen=4, !SameServer); + }; + interpret XF86_Switch_VT_5 { + action = SwitchScreen(Screen=5, !SameServer); + }; + interpret XF86_Switch_VT_6 { + action = SwitchScreen(Screen=6, !SameServer); + }; + interpret XF86_Switch_VT_7 { + action = SwitchScreen(Screen=7, !SameServer); + }; + interpret XF86_Switch_VT_8 { + action = SwitchScreen(Screen=8, !SameServer); + }; + interpret XF86_Switch_VT_9 { + action = SwitchScreen(Screen=9, !SameServer); + }; + interpret XF86_Switch_VT_10 { + action = SwitchScreen(Screen=10, !SameServer); + }; + interpret XF86_Switch_VT_11 { + action = SwitchScreen(Screen=11, !SameServer); + }; + interpret XF86_Switch_VT_12 { + action = SwitchScreen(Screen=12, !SameServer); + }; + + interpret XF86_Ungrab { + action = Private(type=0x86, data="Ungrab"); + }; + interpret XF86_ClearGrab { + action = Private(type=0x86, data="ClsGrb"); + }; + interpret XF86_Next_VMode { + action = Private(type=0x86, data="+VMode"); + }; + interpret XF86_Prev_VMode { + action = Private(type=0x86, data="-VMode"); + }; +}; Index: xc/programs/xkbcomp/cross/Imakefile diff -u xc/programs/xkbcomp/cross/Imakefile:1.2 xc/programs/xkbcomp/cross/Imakefile:1.3 --- xc/programs/xkbcomp/cross/Imakefile:1.2 Wed Oct 10 09:19:06 2001 +++ xc/programs/xkbcomp/cross/Imakefile Thu Apr 4 09:05:58 2002 @@ -1,5 +1,5 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ -XCOMM $XFree86: xc/programs/xkbcomp/cross/Imakefile,v 1.2 2001/10/10 13:19:06 alanh Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/cross/Imakefile,v 1.3 2002/04/04 14:05:58 eich Exp $ #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -11,7 +11,7 @@ keymap.o keycodes.o keytypes.o compat.o action.o \ symbols.o geometry.o xkbpath.o listing.o \ xkbparse.o parseutils.o utils.o - DEPLIBS = $(DEPXKBFILELIB) $(DEPXLIBONLY) + DEPLIBS = $(DEPXLIBONLY) XCOMM Assumes local libraries installed in /usr/X11R6/lib LOCAL_LIBRARIES = -L/usr/X11R6/lib $(XKBFILELIB) $(XLIB) Index: xc/programs/xkbcomp/geometry/Imakefile diff -u xc/programs/xkbcomp/geometry/Imakefile:3.11 xc/programs/xkbcomp/geometry/Imakefile:3.12 --- xc/programs/xkbcomp/geometry/Imakefile:3.11 Sun Jan 21 16:19:40 2001 +++ xc/programs/xkbcomp/geometry/Imakefile Sat Feb 15 17:22:43 2003 @@ -3,12 +3,12 @@ -XCOMM $XFree86: xc/programs/xkbcomp/geometry/Imakefile,v 3.11 2001/01/21 21:19:40 tsi Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/geometry/Imakefile,v 3.12 2003/02/15 22:22:43 dawes Exp $ #define IHaveSubdirs TESTDATA = - DATAFILES = amiga ataritt dell everex fujitsu hp keytronic kinesis \ + DATAFILES = README amiga ataritt dell everex fujitsu hp keytronic kinesis \ macintosh microsoft nec northgate pc sony sun winbook \ $(TESTDATA) SUBDIRS = digital sgi Index: xc/programs/xkbcomp/geometry/README diff -u /dev/null xc/programs/xkbcomp/geometry/README:1.1 --- /dev/null Thu Feb 27 12:35:18 2003 +++ xc/programs/xkbcomp/geometry/README Thu Nov 21 23:19:26 2002 @@ -0,0 +1,10 @@ +The geometry component of a keyboard mapping specifies primarily the geometry of +the keyboard. It contains the geometry symbolic name and the keyboard geometry +description. The geometry component might also contain aliases for some keys or +symbolic names for some indicators and might affect the set of indicators that +are physically present. Key aliases defined in the geometry component of a +keyboard mapping override those defined in the keycodes component. + + + +/* $XFree86: xc/programs/xkbcomp/geometry/README,v 1.1 2002/11/22 04:19:26 dawes Exp $ */ Index: xc/programs/xkbcomp/keycodes/Imakefile diff -u xc/programs/xkbcomp/keycodes/Imakefile:3.14 xc/programs/xkbcomp/keycodes/Imakefile:3.16 --- xc/programs/xkbcomp/keycodes/Imakefile:3.14 Sat Sep 29 16:42:07 2001 +++ xc/programs/xkbcomp/keycodes/Imakefile Sat Feb 15 17:22:44 2003 @@ -3,12 +3,12 @@ -XCOMM $XFree86: xc/programs/xkbcomp/keycodes/Imakefile,v 3.14 2001/09/29 20:42:07 herrb Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/keycodes/Imakefile,v 3.16 2003/02/15 22:22:44 dawes Exp $ #define IHaveSubdirs - DATAFILES = amiga ataritt fujitsu hp ibm macintosh sony sun xfree86 \ - xfree98 powerpcps2 + DATAFILES = README amiga ataritt fujitsu hp ibm macintosh sony sun \ + xfree86 xfree98 powerpcps2 aliases SUBDIRS = digital sgi all:: Index: xc/programs/xkbcomp/keycodes/README diff -u /dev/null xc/programs/xkbcomp/keycodes/README:1.1 --- /dev/null Thu Feb 27 12:35:21 2003 +++ xc/programs/xkbcomp/keycodes/README Thu Nov 21 23:19:27 2002 @@ -0,0 +1,10 @@ +The keycodes component of a keyboard mapping specifies the range and +interpretation of the raw keycodes reported by the device. It sets the keycodes +symbolic name, the minimum and maximum legal codes for the keyboard, and the +symbolic name for each key. The keycodes component might also contain aliases +for some keys, symbolic names for some indicators and a description of which +indicators are physically present. + + + +/* $XFree86: xc/programs/xkbcomp/keycodes/README,v 1.1 2002/11/22 04:19:27 dawes Exp $ */ Index: xc/programs/xkbcomp/keycodes/aliases diff -u /dev/null xc/programs/xkbcomp/keycodes/aliases:1.1 --- /dev/null Thu Feb 27 12:35:21 2003 +++ xc/programs/xkbcomp/keycodes/aliases Mon Sep 16 21:26:24 2002 @@ -0,0 +1,101 @@ + +// keycode aliases for phonetic keyboard maps +// +// $XFree86: xc/programs/xkbcomp/keycodes/aliases,v 1.1 2002/09/17 01:26:24 dawes Exp $ + +default +xkb_keycodes "qwerty" { + + alias <LatQ> = <AD01>; + alias <LatW> = <AD02>; + alias <LatE> = <AD03>; + alias <LatR> = <AD04>; + alias <LatT> = <AD05>; + alias <LatY> = <AD06>; + alias <LatU> = <AD07>; + alias <LatI> = <AD08>; + alias <LatO> = <AD09>; + alias <LatP> = <AD10>; + + alias <LatA> = <AC01>; + alias <LatS> = <AC02>; + alias <LatD> = <AC03>; + alias <LatF> = <AC04>; + alias <LatG> = <AC05>; + alias <LatH> = <AC06>; + alias <LatJ> = <AC07>; + alias <LatK> = <AC08>; + alias <LatL> = <AC09>; + + alias <LatZ> = <AB01>; + alias <LatX> = <AB02>; + alias <LatC> = <AB03>; + alias <LatV> = <AB04>; + alias <LatB> = <AB05>; + alias <LatN> = <AB06>; + alias <LatM> = <AB07>; +}; + +xkb_keycodes "azerty" { + + alias <LatA> = <AD01>; + alias <LatZ> = <AD02>; + alias <LatE> = <AD03>; + alias <LatR> = <AD04>; + alias <LatT> = <AD05>; + alias <LatY> = <AD06>; + alias <LatU> = <AD07>; + alias <LatI> = <AD08>; + alias <LatO> = <AD09>; + alias <LatP> = <AD10>; + + alias <LatQ> = <AC01>; + alias <LatS> = <AC02>; + alias <LatD> = <AC03>; + alias <LatF> = <AC04>; + alias <LatG> = <AC05>; + alias <LatH> = <AC06>; + alias <LatJ> = <AC07>; + alias <LatK> = <AC08>; + alias <LatL> = <AC09>; + alias <LatM> = <AC10>; + + alias <LatW> = <AB01>; + alias <LatX> = <AB02>; + alias <LatC> = <AB03>; + alias <LatV> = <AB04>; + alias <LatB> = <AB05>; + alias <LatN> = <AB06>; +}; + +xkb_keycodes "qwertz" { + + alias <LatQ> = <AD01>; + alias <LatW> = <AD02>; + alias <LatE> = <AD03>; + alias <LatR> = <AD04>; + alias <LatT> = <AD05>; + alias <LatZ> = <AD06>; + alias <LatU> = <AD07>; + alias <LatI> = <AD08>; + alias <LatO> = <AD09>; + alias <LatP> = <AD10>; + + alias <LatA> = <AC01>; + alias <LatS> = <AC02>; + alias <LatD> = <AC03>; + alias <LatF> = <AC04>; + alias <LatG> = <AC05>; + alias <LatH> = <AC06>; + alias <LatJ> = <AC07>; + alias <LatK> = <AC08>; + alias <LatL> = <AC09>; + + alias <LatY> = <AB01>; + alias <LatX> = <AB02>; + alias <LatC> = <AB03>; + alias <LatV> = <AB04>; + alias <LatB> = <AB05>; + alias <LatN> = <AB06>; + alias <LatM> = <AB07>; +}; Index: xc/programs/xkbcomp/keycodes/xfree86 diff -u xc/programs/xkbcomp/keycodes/xfree86:3.17 xc/programs/xkbcomp/keycodes/xfree86:3.18 --- xc/programs/xkbcomp/keycodes/xfree86:3.17 Fri Nov 30 07:12:04 2001 +++ xc/programs/xkbcomp/keycodes/xfree86 Mon Oct 14 22:11:38 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/keycodes/xfree86,v 3.17 2001/11/30 12:12:04 eich Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/xfree86,v 3.18 2002/10/15 02:11:38 dawes Exp $ // "standard" XFree86 codes // It seems that the "default" must be the first entry in the file. @@ -155,7 +155,8 @@ <NFER> = 131; // Muhenkan <AE13> = 133; // Yen - // Keys that are generated on Japanese and Brazillian keyboards + // Keys that are generated on Japanese keyboards and the + // ABNT2 Brazillian keyboards alias <AC12> = <BKSL>; // Extended keys that may be generated on "Internet" keyboards. Index: xc/programs/xkbcomp/keymap/Imakefile diff -u xc/programs/xkbcomp/keymap/Imakefile:3.9 xc/programs/xkbcomp/keymap/Imakefile:3.10 --- xc/programs/xkbcomp/keymap/Imakefile:3.9 Sun Jan 21 16:19:40 2001 +++ xc/programs/xkbcomp/keymap/Imakefile Sat Feb 15 17:22:44 2003 @@ -3,11 +3,11 @@ -XCOMM $XFree86: xc/programs/xkbcomp/keymap/Imakefile,v 3.9 2001/01/21 21:19:40 tsi Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/keymap/Imakefile,v 3.10 2003/02/15 22:22:44 dawes Exp $ #define IHaveSubdirs - DATAFILES = amiga ataritt macintosh sony xfree86 xfree98 + DATAFILES = README amiga ataritt macintosh sony xfree86 xfree98 SUBDIRS = digital sgi sun all:: Index: xc/programs/xkbcomp/keymap/README diff -u /dev/null xc/programs/xkbcomp/keymap/README:1.1 --- /dev/null Thu Feb 27 12:35:23 2003 +++ xc/programs/xkbcomp/keymap/README Thu Nov 21 23:19:27 2002 @@ -0,0 +1,8 @@ +The keymap component provides a way how to set up one pre-defined keyboard +mapping from a given set. It has been obsoleted by 'rules' component which +is simplier and more flexible. The directory is preserved for compatibility +reasons. Avoid using it if it is possible. + + + +/* $XFree86: xc/programs/xkbcomp/keymap/README,v 1.1 2002/11/22 04:19:27 dawes Exp $ */ Index: xc/programs/xkbcomp/keymap/xfree86 diff -u xc/programs/xkbcomp/keymap/xfree86:3.26 xc/programs/xkbcomp/keymap/xfree86:3.29 --- xc/programs/xkbcomp/keymap/xfree86:3.26 Wed Jan 16 13:20:11 2002 +++ xc/programs/xkbcomp/keymap/xfree86 Thu Dec 19 21:07:10 2002 @@ -1,10 +1,6 @@ -// $Xorg: xfree86,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/xfree86,v 3.29 2002/12/20 02:07:10 dawes Exp $ - - -// $XFree86: xc/programs/xkbcomp/keymap/xfree86,v 3.26 2002/01/16 18:20:11 dawes Exp $ - default xkb_keymap "us" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -12,40 +8,53 @@ xkb_symbols { include "us(pc105)" }; xkb_geometry { include "pc" }; }; -xkb_keymap "us_microsoft" { + +// "ar" addition by Arabeyes Team, <support@arabeyes.org> +xkb_keymap "ar" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "us(pc105)" }; - xkb_geometry { include "microsoft" }; + xkb_symbols { include "en_US(pc105)+ar" }; + xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "us_flexpro" { +xkb_keymap "be" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "us(pc105)" }; - xkb_geometry { include "keytronic(FlexPro)" }; + xkb_symbols { include "en_US(pc105)+be" }; + xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "en_US" { +xkb_keymap "bg" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)" }; - xkb_geometry { include "pc" }; + xkb_symbols { include "en_US(pc105)+bg" }; + xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "be" { +// us_intl and br by Ricardo Y. Igarashi (iga@that.com.br) +xkb_keymap "br" { + xkb_keycodes { include "xfree86(abnt2)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc101)+br" }; + xkb_geometry { include "pc(abnt2)" }; +}; +// cz and sk keymaps by Kamil Toman (ktoman@email.cz) +// are designed to replace old czechoslovakian and czsk keyboards +// and their prog variants. Those are now obsolete and should not be used anymore. +xkb_keymap "cz" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+be" }; - xkb_geometry { include "pc(pc102)" }; + xkb_symbols { include "en_US(pc105)+cz" }; + xkb_geometry { include "pc" }; }; -xkb_keymap "bg" { +xkb_keymap "cz_qwerty" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+bg" }; - xkb_geometry { include "pc(pc102)" }; + xkb_symbols { include "en_US(pc105)+cz_qwerty" }; + xkb_geometry { include "pc" }; }; xkb_keymap "de" { xkb_keycodes { include "xfree86" }; @@ -54,6 +63,13 @@ xkb_symbols { include "en_US(pc105)+de" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "de_CH" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+de_CH" }; + xkb_geometry { include "pc(pc102)" }; +}; xkb_keymap "dk" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -68,6 +84,13 @@ xkb_symbols { include "en_US(pc105)+dvorak" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "en_US" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)" }; + xkb_geometry { include "pc" }; +}; xkb_keymap "es" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -82,6 +105,13 @@ xkb_symbols { include "en_US(pc105)+fr" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "fr-latin9" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+fr-latin9" }; + xkb_geometry { include "pc" }; +}; xkb_keymap "fr_CA" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -89,6 +119,13 @@ xkb_symbols { include "en_US(pc105)+ca" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "fr_CH" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+fr_CH" }; + xkb_geometry { include "pc(pc102)" }; +}; xkb_keymap "gb" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -110,6 +147,13 @@ xkb_symbols { include "en_US(pc105)+it" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "jp106" { + xkb_keycodes { include "xfree86(jp106)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "jp(jp106)" }; + xkb_geometry { include "pc(jp106)" }; +}; xkb_keymap "lt" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -173,6 +217,21 @@ xkb_symbols { include "en_US(pc105)+pt" }; xkb_geometry { include "pc(pc102)" }; }; +// ro: additions by Cristian Gafton, <gafton@redhat.com> +xkb_keymap "ro" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc101)+ro(pc101)" }; + xkb_geometry { include "pc(pc101)" }; +}; +xkb_keymap "ro_microsoft" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+ro(pc105)" }; + xkb_geometry { include "pc(pc105)" }; +}; xkb_keymap "ru" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -193,148 +252,89 @@ xkb_compatibility { include "default" }; xkb_symbols { include "en_US(pc105)+se" }; xkb_geometry { include "pc(pc102)" }; -}; -xkb_keymap "th" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+th" }; - xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "de_CH" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+de_CH" }; - xkb_geometry { include "pc(pc102)" }; -}; -xkb_keymap "fr_CH" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+fr_CH" }; - xkb_geometry { include "pc(pc102)" }; -}; -xkb_keymap "jp106" { - xkb_keycodes { include "xfree86(jp106)" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "jp(jp106)" }; - xkb_geometry { include "pc(jp106)" }; -}; - -// Additions by Eric Moreau, 1998-09-27 -// I am reachable at eric_moreau@compuserve.com - -xkb_keymap "fr_CA_sundeadkeys" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc102)+ca_enhanced(sundeadkeys)+us_group3(basic)+group(ctrl_shift_toggle)+ralt(mode_switch)" }; - xkb_geometry { include "pc(pc102)" }; -}; - -xkb_keymap "fr_CA" { +xkb_keymap "sl" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc102)+ca_enhanced(basic)+us_group3(basic)+group(ctrl_shift_toggle)+ralt(mode_switch)" }; - xkb_geometry { include "pc(pc102)" }; + xkb_symbols { include "en_US(pc105)+si" }; + xkb_geometry { include "pc(pc102)" }; }; - -// us_intl and br by Ricardo Y. Igarashi (iga@that.com.br) -// us_intl means standard us keyboard plus dead_keys symbols -// these keyboards are very popular in Brazil - -xkb_keymap "us_intl" { +xkb_keymap "sl_SI" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "us(pc101)+us_intl" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "br" { - xkb_keycodes { include "xfree86(abnt2)" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "us(pc101)+br" }; - xkb_geometry { include "pc(abnt2)" }; + xkb_symbols { include "en_US(pc105)+si" }; + xkb_geometry { include "pc(pc102)" }; }; - // cz and sk keymaps by Kamil Toman (ktoman@email.cz) // are designed to replace old czechoslovakian and czsk keyboards // and their prog variants. Those are now obsolete and should not be used anymore. -xkb_keymap "cz" { +xkb_keymap "sk" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+cz" }; + xkb_symbols { include "en_US(pc105)+sk" }; xkb_geometry { include "pc" }; }; -xkb_keymap "cz_qwerty" { +xkb_keymap "sk_qwerty" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+cz_qwerty" }; + xkb_symbols { include "en_US(pc105)+sk_qwerty" }; xkb_geometry { include "pc" }; }; -xkb_keymap "sk" { +// Additions by Emil Soleyman-Zomalan, <emil@nishra.com> +xkb_keymap "syr" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+sk" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "sk_qwerty" { + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+syr" }; + xkb_geometry { include "pc(pc102)" }; +}; +xkb_keymap "th" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+sk_qwerty" }; - xkb_geometry { include "pc" }; + xkb_symbols { include "en_US(pc105)+th" }; + xkb_geometry { include "pc(pc102)" }; }; - -xkb_keymap "sl" { +xkb_keymap "tr" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+si" }; + xkb_symbols { include "en_US(pc105)+tr" }; xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "sl_SI" { +xkb_keymap "uk" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+si" }; + xkb_symbols { include "en_US(pc105)+uk)" }; xkb_geometry { include "pc(pc102)" }; }; - -// Additions by Cristian Gafton, <gafton@redhat.com> -xkb_keymap "ro" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc101)+ro(pc101)" }; - xkb_geometry { include "pc(pc101)" }; -}; -xkb_keymap "ro_microsoft" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+ro(pc105)" }; - xkb_geometry { include "pc(pc105)" }; +xkb_keymap "us_flexpro" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc105)" }; + xkb_geometry { include "keytronic(FlexPro)" }; }; -xkb_keymap "tr" { +// us_intl and br by Ricardo Y. Igarashi (iga@that.com.br) +// us_intl means standard us keyboard plus dead_keys symbols +// these keyboards are very popular in Brazil +xkb_keymap "us_intl" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+tr" }; - xkb_geometry { include "pc(pc102)" }; + xkb_symbols { include "us(pc101)+us_intl" }; + xkb_geometry { include "pc" }; }; -// Additions by Arabeyes Team, <support@arabeyes.org> -xkb_keymap "ar" { +xkb_keymap "us_microsoft" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+ar" }; - xkb_geometry { include "pc(pc102)" }; + xkb_symbols { include "us(pc105)" }; + xkb_geometry { include "microsoft" }; }; + Index: xc/programs/xkbcomp/rules/Imakefile diff -u xc/programs/xkbcomp/rules/Imakefile:3.3 xc/programs/xkbcomp/rules/Imakefile:3.5 --- xc/programs/xkbcomp/rules/Imakefile:3.3 Wed Jan 17 18:45:56 2001 +++ xc/programs/xkbcomp/rules/Imakefile Sat Feb 15 17:22:44 2003 @@ -1,7 +1,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ - DATAFILES = sgi xfree86 sun - LISTFILES = sgi.lst xfree86.lst xfree86-it.lst sun.lst + DATAFILES = README sgi xfree86 sun + LISTFILES = sgi.lst xfree86.lst xfree86-it.lst sun.lst xfree86.xml all:: Index: xc/programs/xkbcomp/rules/README diff -u /dev/null xc/programs/xkbcomp/rules/README:1.1 --- /dev/null Thu Feb 27 12:35:27 2003 +++ xc/programs/xkbcomp/rules/README Thu Nov 21 23:19:27 2002 @@ -0,0 +1,6 @@ +This directory lists sets of rules which can be used to obtain an exact XKB +configuration. + + + +/* $XFree86: xc/programs/xkbcomp/rules/README,v 1.1 2002/11/22 04:19:27 dawes Exp $ */ Index: xc/programs/xkbcomp/rules/xfree86 diff -u xc/programs/xkbcomp/rules/xfree86:3.41 xc/programs/xkbcomp/rules/xfree86:3.61 --- xc/programs/xkbcomp/rules/xfree86:3.41 Fri Dec 28 11:03:30 2001 +++ xc/programs/xkbcomp/rules/xfree86 Wed Feb 19 23:36:09 2003 @@ -4,152 +4,141 @@ // Rules for resolving XKB components for use with XFree86 // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86,v 3.41 2001/12/28 16:03:30 dawes Exp $ +// 2002 Modifier: Ivan Pascal The XFree86 Project +// $XFree86: xc/programs/xkbcomp/rules/xfree86,v 3.61 2003/02/20 04:36:09 dawes Exp $ // -! model = keycodes geometry - microsoft = xfree86 microsoft(natural) - dell101 = xfree86 dell(dell101) - flexpro = xfree86 keytronic(FlexPro) - omnikey101 = xfree86 northgate(omnikey101) - pc101 = xfree86 pc(pc101) - pc102 = xfree86 pc(pc102) - pc104 = xfree86 pc(pc104) - pc105 = xfree86 pc(pc105) - jp106 = xfree86 pc(jp106) - everex = xfree86 everex(STEPnote) - winbook = xfree86 winbook(XP5) - pc98 = xfree98(pc98) nec(pc98) - abnt2 = xfree86(abnt2) pc - hp = xfree86 pc(pc104) - itouch = xfree86 pc(pc104) - logiinetnav = xfree86 pc(pc104) - logicordless = xfree86 pc(pc104) - logiinternet = xfree86 pc(pc104) - compaq = xfree86 pc(pc104) - microsoftpro = xfree86 microsoft(natural) - geniuscomfy = xfree86 pc(pc104) - btc9000 = xfree86 pc(pc104) - rapidaccess = xfree86 pc(pc104) - rapidaccess2 = xfree86 pc(pc104) - chicony = xfree86 pc(pc104) - dell = xfree86 pc(pc104) - macintosh = xfree86 macintosh(macintosh) - macintosh_old = macintosh macintosh(macintosh) - powerpcps2 = powerpcps2 pc(pc104) - -//! model layout = symbols -// microsoft us = us(pc104) -// microsoft en_US = en_US(pc104) -// microsoft * = en_US(pc104)+%l%(v) -// pc104 us = us(pc104) -// pc104 en_US = en_US(pc104) -// pc104 * = en_US(pc104)+%l%(v) -// * us = us(pc101) -// * en_US = en_US(pc102) -// * * = en_US(pc102)+%l%(v) -// * jp = jp - -! model variant = symbols - pc102 nodeadkeys = en_US(pc102%_v)+%l%(v) - pc104 nodeadkeys = en_US(pc104%_v)+%l%(v) - pc105 nodeadkeys = en_US(pc105%_v)+%l%(v) - microsoft nodeadkeys = en_US(pc104%_v)+%l%(v) - macintosh nodeadkeys = macintosh/us(extended)+macintosh/%l%(v) - powerpcps2 nodeadkeys = en_US(pc104%_v)+%l%(v) - * nodeadkeys = en_US(pc101%_v)+%l%(v) +// Layouts that still need be composed by old rules +! $oldlayouts = az bs ca ca_enhanced de_CH fr_CH hu hu_qwerty lt_std mn vn +// If you want non-latin layouts implicitly include the en_US layout +// uncomment lines below +//! $nonlatin = am ar ben bg by dev el ge_la ge_ru guj gur il il_phonetic\ +// ir iu kan lo mk mm ml ori ru sr syr syr_phonetic tel th\ +// tj tml ua + +! $pcmodels = pc101 pc102 pc104 pc105 +! $mac = macintosh macintosh_old + +! model = keycodes + macintosh_old = macintosh + powerpcps2 = powerpcps2 + pc98 = xfree98(pc98) + abnt2 = xfree86(abnt2) + * = xfree86 + +! $azerty = be fr fr-latin9 +! $qwertz = al cz de hr pl2 si sk + +! layout[1] = keycodes + $azerty = +aliases(azerty) + $qwertz = +aliases(qwertz) + * = +aliases(qwerty) + +! layout = keycodes + $azerty = +aliases(azerty) + $qwertz = +aliases(qwertz) + * = +aliases(qwerty) + +! model = geometry + microsoft = microsoft(natural) + microsoftpro = microsoft(natural) + microsoftprose = microsoft(natural) + dell101 = dell(dell101) + flexpro = keytronic(FlexPro) + omnikey101 = northgate(omnikey101) + $pcmodels = pc(%m) + jp106 = pc(jp106) + everex = everex(STEPnote) + winbook = winbook(XP5) + pc98 = nec(pc98) + abnt2 = pc + macintosh = macintosh(macintosh) + macintosh_old = macintosh(macintosh) + * = pc(pc104) + +! model variant layout = symbols + macintosh nodeadkeys * = macintosh/us(extended)+macintosh/%l%(v) + $pcmodels nodeadkeys $oldlayouts = en_US(%m%_v)+%l%(v) + * nodeadkeys $oldlayouts = en_US(pc105%_v)+%l%(v) + ! model layout = symbols - pc102 us = us(pc102) - pc102 en_US = en_US(pc102) - pc102 intl = us(pc102compose) - pc102 * = en_US(pc102)+%l%(v) - pc104 us = us(pc104) - pc104 en_US = en_US(pc104) - pc104 intl = us(pc104compose) - pc104 * = en_US(pc104)+%l%(v) - pc105 us = us(pc105) - pc105 en_US = en_US(pc105) - pc105 intl = us(pc105compose) - pc105 * = en_US(pc105)+%l%(v) - microsoft us = us(pc104) - microsoft en_US = en_US(pc104) - microsoft intl = us(pc104compose) - microsoft * = en_US(pc104)+%l%(v) - pc104 us = us(pc104) - pc104 en_US = en_US(pc104) - pc104 * = en_US(pc104)+%l%(v) - pc105 us = us(pc105) - pc105 en_US = en_US(pc105) - pc105 * = en_US(pc105)+%l%(v) - pc101 us_intl = us(pc101)+us_intl pc98 nec/jp = nec/jp(pc98) abnt2 br = us(pc101)+br - hp us = us(pc104)+inet(hp) - hp en_US = en_US(pc104)+inet(hp) - hp * = en_US(pc104)+inet(hp)+%l%(v) - compaq us = us(pc104)+inet(compaq) - compaq en_US = en_US(pc104)+inet(compaq) - compaq * = en_US(pc104)+inet(compaq)+%l%(v) - itouch us = us(pc104)+inet(itouch) - itouch en_US = en_US(pc104)+inet(itouch) - itouch * = en_US(pc104)+inet(itouch)+%l%(v) - logiinetnav us = us(pc104)+inet(logiinetnav) - logiinetnav en_US = en_US(pc104)+inet(logiinetnav) - logiinetnav * = en_US(pc104)+inet(logiinetnav)+%l%(v) - logicordless us = us(pc104)+inet(logicordless) - logicordless en_US = en_US(pc104)+inet(logicordless) - logicordless * = en_US(pc104)+inet(logicordless)+%l%(v) - logiinternet us = us(pc104)+inet(logiinternet) - logiinternet en_US = en_US(pc104)+inet(logiinternet) - logiinternet * = en_US(pc104)+inet(logiinternet)+%l%(v) - microsoftpro us = us(pc104)+inet(microsoftpro) - microsoftpro en_US = en_US(pc104)+inet(microsoftpro) - microsoftpro * = en_US(pc104)+inet(microsoftpro)+%l%(v) - geniuscomfy us = us(pc104)+inet(geniuscomfy) - geniuscomfy en_US = en_US(pc104)+inet(geniuscomfy) - geniuscomfy * = en_US(pc104)+inet(geniuscomfy)+%l%(v) - btc9000 us = us(pc104)+inet(btc9000) - btc9000 en_US = en_US(pc104)+inet(btc9000) - btc9000 * = en_US(pc104)+inet(btc9000)+%l%(v) - rapidaccess us = us(pc104)+inet(rapidaccess) - rapidaccess en_US = en_US(pc104)+inet(rapidaccess) - rapidaccess * = en_US(pc104)+inet(rapidaccess)+%l%(v) - rapidaccess2 us = us(pc104)+inet(rapidaccess2) - rapidaccess2 en_US = en_US(pc104)+inet(rapidaccess2) - rapidaccess2 * = en_US(pc104)+inet(rapidaccess2)+%l%(v) - chicony us = us(pc104)+inet(chicony) - chicony en_US = en_US(pc104)+inet(chicony) - chicony * = en_US(pc104)+inet(chicony)+%l%(v) - dell us = us(pc104)+inet(dell) - dell en_US = en_US(pc104)+inet(dell) - dell * = en_US(pc104)+inet(dell)+%l%(v) - macintosh us = macintosh/us(extended) - macintosh en_US = macintosh/us(extended) - macintosh * = macintosh/us(extended)+macintosh/%l%(v) - macintosh_old us = macintosh/us(extended) - macintosh_old en_US = macintosh/us(extended) - macintosh_old * = macintosh/us(extended)+macintosh/%l%(v) - powerpcps2 us = us(pc104) - powerpcps2 en_US = en_US(pc104) - powerpcps2 * = en_US(pc104)+%l%(v) - * us = us(pc101) - * en_US = en_US(pc101) - * intl = us(pc101compose) - * * = en_US(pc101)+%l%(v) + $pcmodels us_intl = us(%m)+us_intl + $mac us = macintosh/us(extended) + $mac en_US = macintosh/us(extended) + $mac * = macintosh/us(extended)+macintosh/%l%(v) + $pcmodels intl = us(%mcompose) + * intl = us(pc104compose) * jp = jp + $pcmodels $oldlayouts = en_US(%m)+%l%(v) + $pcmodels $nonlatin = pc/pc(%m)+pc/us+pc/%l%(v):2 + $pcmodels * = pc/pc(%m)+pc/%l%(v) + * $oldlayouts = en_US(pc105)+%l%(v) + * $nonlatin = pc/pc(pc105)+pc/us+pc/%l%(v):2 + * * = pc/pc(pc105)+pc/%l%(v) + +! model layout[1] = symbols + $pcmodels * = pc/pc(%m)+pc/%l[1]%(v[1]) + * * = pc/pc(pc105)+pc/%l[1]%(v[1]) + +! layout[2] = symbols + * = +pc/%l[2]%(v[2]):2 + +! layout[3] = symbols + * = +pc/%l[3]%(v[3]):3 + +! layout[4] = symbols + * = +pc/%l[4]%(v[4]):4 + +! $inetkbds = airkey acpi scorpius \ + brother \ + btc5113rf btc5126t btc9000 btc9000a \ + cherryblue cherrybluea \ + chicony chicony9885 \ + compaqeak8 compaqik7 compaqik13 compaqik18 armada presario ipaq \ + dell inspiron \ + dexxa diamond genius \ + ennyah_dkb1008 \ + hpi6 hp2501 hp2505 hp5181 hpxe3gc hpxe3gf hpxe4xxx hpzt11xx \ + hp500fa hp5xx \ + honeywell_euroboard \ + rapidaccess rapidaccess2 rapidaccess2a \ + ltcd logicdit logicdp logicdpa logicdpa2 logicdo logicfn \ + logicdn logidak logiik itouch logiitc logiik logiink itouchin \ + mx1998 mx2500 mx2750 \ + microsoftinet microsoftpro microsoftprose microsoftoffice \ + oretec \ + propeller \ + qtronix \ + samsung4500 samsung4510 \ + sk1300 sk2500 sk6200 sk7100 \ + sven symplon toshiba_s3000 trust trustda yahoo + +! model = symbols + $inetkbds = +inet(%m) + +! model layout = compat + pc98 nec/jp = pc98(basic) + * * = complete + +! model layout[1] = compat + * * = complete -! model layout = compat types - pc98 nec/jp = pc98(basic) complete - * * = complete complete +! model = types + * = complete ! option = symbols grp:switch = +group(switch) + grp:lswitch = +group(lswitch) grp:win_switch = +group(win_switch) grp:lwin_switch = +group(lwin_switch) grp:rwin_switch = +group(rwin_switch) grp:toggle = +group(toggle) grp:shift_toggle = +group(shift_toggle) + grp:ctrls_toggle = +group(ctrls_toggle) + grp:alts_toggle = +group(alts_toggle) grp:ctrl_shift_toggle = +group(ctrl_shift_toggle) grp:caps_toggle = +group(caps_toggle) grp:ctrl_alt_toggle = +group(ctrl_alt_toggle) @@ -157,6 +146,11 @@ grp:menu_toggle = +group(menu_toggle) grp:lwin_toggle = +group(lwin_toggle) grp:rwin_toggle = +group(rwin_toggle) + grp:lshift_toggle = +group(lshift_toggle) + grp:rshift_toggle = +group(rshift_toggle) + grp:lctrl_toggle = +group(lctrl_toggle) + grp:rctrl_toggle = +group(rctrl_toggle) + grp:lalt_toggle = +group(lalt_toggle) lv3:switch = +level3(switch) lv3:menu_switch = +level3(menu_switch) lv3:win_switch = +level3(win_switch) Index: xc/programs/xkbcomp/rules/xfree86-it.lst diff -u xc/programs/xkbcomp/rules/xfree86-it.lst:1.6 xc/programs/xkbcomp/rules/xfree86-it.lst:1.7 --- xc/programs/xkbcomp/rules/xfree86-it.lst:1.6 Fri May 18 19:35:34 2001 +++ xc/programs/xkbcomp/rules/xfree86-it.lst Mon Nov 25 09:05:06 2002 @@ -4,7 +4,7 @@ // Elenco dei modelli e dei lingauggi // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86-it.lst,v 1.6 2001/05/18 23:35:34 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86-it.lst,v 1.7 2002/11/25 14:05:06 eich Exp $ ! model microsoft Microsoft Natural @@ -37,6 +37,7 @@ fr_CH Francese Svizzero gb Regno Unito hu Ungherese + hu_qwerty Ungherese (qwerty) it Italiano jp Giapponese no Norvegese Index: xc/programs/xkbcomp/rules/xfree86.lst diff -u xc/programs/xkbcomp/rules/xfree86.lst:3.42 xc/programs/xkbcomp/rules/xfree86.lst:3.64 --- xc/programs/xkbcomp/rules/xfree86.lst:3.42 Wed Jan 16 13:20:12 2002 +++ xc/programs/xkbcomp/rules/xfree86.lst Thu Feb 27 00:07:39 2003 @@ -4,7 +4,7 @@ // Rules descriptions for XFree86 // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86.lst,v 3.42 2002/01/16 18:20:12 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86.lst,v 3.64 2003/02/27 05:07:39 dawes Exp $ ! model pc101 Generic 101-key PC @@ -20,18 +20,83 @@ jp106 Japanese 106-key pc98 PC-98xx Series abnt2 Brazilian ABNT2 - hp HP Internet - itouch Logitech iTouch - logicordless Logitech Cordless Desktop Pro - logiinternet Logitech Internet Keyboard - logiinetnav Logitech Internet Navigator Keyboard - compaq Compaq Internet - microsoftpro Microsoft Natural Pro - geniuscomfy Genius Comfy KB-16M + airkey Acer AirKey V + acpi ACPI Standard + scorpius Advance Scorpius KI + brother Brother Internet Keyboard + btc5113rf BTC 5113RF Multimedia + btc5126t BTC 5126T + btc9000 BTC 9000 + btc9000a BTC 9000A + cherryblue Cherry Blue Line CyBo@rd + cherrybluea Cherry Blue Line CyBo@rd (alternate option) + chicony Chicony Internet Keyboard + chicony9885 Chicony KB-9885 + compaqeak8 Compaq Easy Access Keyboard + compaqik7 Compaq Internet Keyboard (7 keys) + compaqik13 Compaq Internet Keyboard (13 keys) + compaqik18 Compaq Internet Keyboard (18 keys) + armada Laptop/notebook Compaq (eg. Armada) Laptop Keyboard + presario Laptop/notebook Compaq (eg. Presario) Internet Keyboard + ipaq Compaq iPaq Keyboard + dell Dell + inspiron Laptop/notebook Dell Inspiron 8xxx + dexxa Dexxa Wireless Desktop Keyboard + diamond Diamond 9801 / 9802 series + ennyah_dkb1008 Ennyah DKB-1008 + genius Genius Comfy KB-16M / Genius MM Keyboard KWD-910 + hpi6 Hewlett-Packard Internet Keyboard + hp2501 Hewlett-Packard SK-2501 Multimedia Keyboard + hp2505 Hewlett-Packard SK-2505 Internet Keyboard + hp5181 Hewlett-Packard 5181 Internet Keyboard + hpxe3gc Hewlett-Packard Omnibook XE3 GC, GD, GE and Pavilion N5xxx + hpxe3gf Hewlett-Packard Omnibook XE3 GF + hpxe4xxx Hewlett-Packard Omnibook XE4xxx and ZE4xxx + hpxt1000 Hewlett-Packard Omnibook XT1000 + hpzt11xx Hewlett-Packard Pavilion ZT11xx + hp500fa Hewlett-Packard Omnibook 500 FA + hp5xx Hewlett-Packard Omnibook 5xx + honeywell_euroboard Honeywell Euroboard rapidaccess IBM Rapid Access rapidaccess2 IBM Rapid Access II - chicony Chicony Internet Keyboard - dell Dell Internet Keyboard + rapidaccess2a IBM Rapid Access II (alternate option) + ltcd Logitech Cordless Desktop + logicdit Logitech Cordless Desktop iTouch + logicdp Logitech Cordless Desktop Pro + logicdpa Logitech Cordless Desktop Pro (alternate option) + logicdpa2 Logitech Cordless Desktop Pro (alternate option2) + logicdo Logitech Cordless Desktop Optical + logicfn Logitech Cordless Freedom/Desktop Navigator + logicdn Logitech Cordless Desktop Navigator + logidak Logitech Deluxe Access Keyboard + logiik Logitech Internet Keyboard + itouch Logitech iTouch + logiitc Logitech iTouch Cordless Keyboard (model Y-RB6) + logiik Logitech Internet Keyboard + logiink Logitech Internet Navigator Keyboard + itouchin Logitech iTouch keyboard Internet Navigator + mx1998 Memorex MX1998 + mx2500 Memorex MX2500 EZ-Access Keyboard + mx2750 Memorex MX2750 + microsoftinet Microsoft Internet Keyboard + microsoftpro Microsoft Natural Keyboard Pro / Microsoft Internet Keyboard Pro + microsoftprose Microsoft Internet Keyboard Pro, Swedish + microsoftoffice Microsoft Office Keyboard + oretec Oretec MCK-800 MM/Internet keyboard + propeller Propeller Voyager (KTEZ-1000) + qtronix QTronix Scorpius 98N+ + samsung4500 Samsung SDM 4500P + samsung4510 Samsung SDM 4510P + sk1300 SK-1300 + sk2500 SK-2500 + sk6200 SK-6200 + sk7100 SK-7100 + sven SVEN Ergonomic 2500 + symplon Symplon PaceBook (tablet PC) + toshiba_s3000 Toshiba Satellite S3000 + trust Trust Wireless Keyboard Classic + trustda Trust Direct Access Keyboard + yahoo Yahoo! Internet Keyboard // The entries here should be ordered as follows: @@ -46,14 +111,16 @@ al Albanian ar Arabic am Armenian - az Azerbaidjani + az Azerbaijani by Belarusian be Belgian ben Bengali + bs Bosnian br Brazilian bg Bulgarian mm Burmese ca Canadian + ca_enhanced French Canadian hr Croatian cz Czech cz_qwerty Czech (qwerty) @@ -63,30 +130,36 @@ ee Estonian fi Finnish fr French - fr_CH Swiss French + fr-latin9 French (alternative) ge_la Georgian (latin) ge_ru Georgian (russian) de German - de_CH Swiss German el Greek guj Gujarati gur Gurmukhi dev Hindi hu Hungarian + hu_qwerty Hungarian (qwerty) is Icelandic iu Inuktitut ir Iranian il Israeli it Italian jp Japanese + kan Kannada + lo Lao la Latin America lt Lithuanian qwerty "numeric" lt_std Lithuanian azerty standard lv Latvian mk Macedonian + ml Malayalam mt Maltese mt_us Maltese (US layout) + mn Mongolian no Norwegian + ogham Ogham + ori Oriya pl Polish pl2 Polish (qwertz) pt Portuguese @@ -102,8 +175,12 @@ sk_qwerty Slovak (qwerty) es Spanish se Swedish + fr_CH Swiss French + de_CH Swiss German + syr Syriac tj Tajik tml Tamil + tel Telugu th Thai tr Turkish tr_f Turkish (F) @@ -123,14 +200,21 @@ grp:rwin_switch Right Win-key switches group while pressed grp:win_switch Both Win-keys switch group while pressed grp:toggle Right Alt key changes group + grp:lalt_toggle Left Alt key changes group grp:caps_toggle Caps Lock key changes group - grp:menu_toggle Menu key changes group - grp:lwin_toggle Left Win-key changes group - grp:rwin_toggle Right Win-key changes group grp:shift_toggle Both Shift keys together change group + grp:alts_toggle Both Alt keys together change group + grp:ctrls_toggle Both Ctrl keys together change group grp:ctrl_shift_toggle Control+Shift changes group grp:ctrl_alt_toggle Alt+Control changes group grp:alt_shift_toggle Alt+Shift changes group + grp:menu_toggle Menu key changes group + grp:lwin_toggle Left Win-key changes group + grp:rwin_toggle Right Win-key changes group + grp:lshift_toggle Left Shift key changes group + grp:rshift_toggle Right Shift key changes group + grp:lctrl_toggle Left Ctrl key changes group + grp:rctrl_toggle Right Ctrl key changes group lv3 Third level choosers lv3:switch Press Right Control to choose 3rd level lv3:menu_switch Press Menu key to choose 3rd level @@ -148,7 +232,7 @@ grp_led:scroll Scroll_Lock LED shows alternative group caps CapsLock key behavior caps:internal uses internal capitalization. Shift cancels Caps. - caps:internal_nocancel uses internal capitalization. Shift doesn't cancel Cap$ + caps:internal_nocancel uses internal capitalization. Shift doesn't cancel Caps. caps:shift acts as Shift with locking. Shift cancels Caps. caps:shift_nocancel acts as Shift with locking. Shift doesn't cancel Caps. Index: xc/programs/xkbcomp/rules/xfree86.xml diff -u /dev/null xc/programs/xkbcomp/rules/xfree86.xml:1.3 --- /dev/null Thu Feb 27 12:35:28 2003 +++ xc/programs/xkbcomp/rules/xfree86.xml Thu Feb 27 00:07:39 2003 @@ -0,0 +1,2614 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd"> +<xkbConfigRegistry> + <modelList> + <model> + <configItem> + <name>pc101</name> + <description>Generic 101-key PC</description> + <description xml:lang="bg">Стандартна 101 клавишна PC клавиатура</description> + <description xml:lang="ru">Обычный 101-клавишный PC</description> + </configItem> + </model> + <model> + <configItem> + <name>pc102</name> + <description>Generic 102-key (Intl) PC</description> + <description xml:lang="bg">Стандартна 102 клавишна PC клавиатура</description> + <description xml:lang="ru">Обычный 102-клавишный PC</description> + </configItem> + </model> + <model> + <configItem> + <name>pc104</name> + <description>Generic 104-key PC</description> + <description xml:lang="bg">Стандартна 104 клавишна PC клавиатура</description> + <description xml:lang="ru">Обычный 104-клавишный PC</description> + </configItem> + </model> + <model> + <configItem> + <name>pc105</name> + <description>Generic 105-key (Intl) PC</description> + <description xml:lang="bg">Стандартна 105 клавишна PC клавиатура</description> + <description xml:lang="ru">Обычный 105-клавишный (инт.) РС</description> + </configItem> + </model> + <model> + <configItem> + <name>dell101</name> + <description>Dell 101-key PC</description> + <description xml:lang="bg">101 клавишна PC клавиатура на Dell</description> + <description xml:lang="ru">Dell 101-клавишный PC</description> + </configItem> + </model> + <model> + <configItem> + <name>everex</name> + <description>Everex STEPnote</description> + </configItem> + </model> + <model> + <configItem> + <name>flexpro</name> + <description>Keytronic FlexPro</description> + </configItem> + </model> + <model> + <configItem> + <name>microsoft</name> + <description>Microsoft Natural</description> + </configItem> + </model> + <model> + <configItem> + <name>omnikey101</name> + <description>Northgate OmniKey 101</description> + </configItem> + </model> + <model> + <configItem> + <name>winbook</name> + <description>Winbook Model XP5</description> + </configItem> + </model> + <model> + <configItem> + <name>jp106</name> + <description>Japanese 106-key</description> + <description xml:lang="bg">ÑпонÑка 106 клавишна</description> + <description xml:lang="ru">ЯпонÑÐºÐ°Ñ 106-клавишнаÑ</description> + </configItem> + </model> + <model> + <configItem> + <name>pc98</name> + <description>PC-98xx Series</description> + <description xml:lang="bg">PC-98xx Ñерии</description> + </configItem> + </model> + <model> + <configItem> + <name>abnt2</name> + <description>Brazilian ABNT2</description> + <description xml:lang="bg">бразилÑка ABNT2</description> + </configItem> + </model> + <model> + <configItem> + <name>airkey</name> + <description>Acer AirKey V</description> + </configItem> + </model> + <model> + <configItem> + <name>acpi</name> + <description>ACPI Standard</description> + <description xml:lang="ru">Ð¡Ñ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð°Ñ ACPI</description> + </configItem> + </model> + <model> + <configItem> + <name>scorpius</name> + <description>Advance Scorpius KI</description> + </configItem> + </model> + <model> + <configItem> + <name>brother</name> + <description>Brother Internet Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>btc5113rf</name> + <description>BTC 5113RF Multimedia</description> + <description xml:lang="ru">BTC 5113RF мультимедиÑ</description> + </configItem> + </model> + <model> + <configItem> + <name>btc5126t</name> + <description>BTC 5126T</description> + </configItem> + </model> + <model> + <configItem> + <name>btc9000</name> + <description>BTC 9000</description> + </configItem> + </model> + <model> + <configItem> + <name>btc9000a</name> + <description>BTC 9000A</description> + </configItem> + </model> + <model> + <configItem> + <name>cherryblue</name> + <description>Cherry Blue Line CyBo@rd</description> + </configItem> + </model> + <model> + <configItem> + <name>cherrybluea</name> + <description>Cherry Blue Line CyBo@rd (alternate option)</description> + <description xml:lang="ru">Cherry Blue Line CyBo@rd (альтернативный вариант)</description> + </configItem> + </model> + <model> + <configItem> + <name>chicony</name> + <description>Chicony Internet Keyboard</description> + <description xml:lang="bg">Интернет клавиатура на Chicony</description> + </configItem> + </model> + <model> + <configItem> + <name>chicony9885</name> + <description>Chicony KB-9885</description> + </configItem> + </model> + <model> + <configItem> + <name>compaqeak8</name> + <description>Compaq Easy Access Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>compaqik7</name> + <description>Compaq Internet Keyboard (7 keys)</description> + <description xml:lang="ru">Compaq Internet Keyboard (7 клавиш)</description> + </configItem> + </model> + <model> + <configItem> + <name>compaqik13</name> + <description>Compaq Internet Keyboard (13 keys)</description> + <description xml:lang="ru">Compaq Internet Keyboard (13 клавиш)</description> + </configItem> + </model> + <model> + <configItem> + <name>compaqik18</name> + <description>Compaq Internet Keyboard (18 keys)</description> + <description xml:lang="ru">Compaq Internet Keyboard (18 клавиш)</description> + </configItem> + </model> + <model> + <configItem> + <name>armada</name> + <description>Laptop/notebook Compaq (eg. Armada) Laptop Keyboard</description> + <description xml:lang="ru">Клавиатура Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¿ÑŒÑŽÑ‚ÐµÑ€Ð¾Ð² Compaq (например Armada)</description> + </configItem> + </model> + <model> + <configItem> + <name>presario</name> + <description>Laptop/notebook Compaq (eg. Presario) Internet Keyboard</description> + <description xml:lang="ru">"Интернет" клавиатура Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¿ÑŒÑŽÑ‚ÐµÑ€Ð¾Ð² Compaq (например Presario)</description> + </configItem> + </model> + <model> + <configItem> + <name>ipaq</name> + <description>Compaq iPaq Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>dell</name> + <description>Dell</description> + </configItem> + </model> + <model> + <configItem> + <name>inspiron</name> + <description>Laptop/notebook Dell Inspiron 8xxx</description> + <description xml:lang="ru">ÐаÑтольнаÑ/Ð¿Ð¾Ñ€Ñ‚Ð°Ñ‚Ð¸Ð²Ð½Ð°Ñ Ð´Ð»Ñ Dell Inspiron 8xxx</description> + </configItem> + </model> + <model> + <configItem> + <name>dexxa</name> + <description>Dexxa Wireless Desktop Keyboard</description> + <description xml:lang="ru">Dexxa Wireless Desktop Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>diamond</name> + <description>Diamond 9801 / 9802 series</description> + <description xml:lang="ru">Модели Diamond 9801/9802</description> + </configItem> + </model> + <model> + <configItem> + <name>ennyah_dkb1008</name> + <description>Ennyah DKB-1008</description> + </configItem> + </model> + <model> + <configItem> + <name>genius</name> + <description>Genius Comfy KB-16M / Genius MM Keyboard KWD-910</description> + </configItem> + </model> + <model> + <configItem> + <name>hpi6</name> + <description>Hewlett-Packard Internet Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>hp2501</name> + <description>Hewlett-Packard SK-2501 Multimedia Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>hp2505</name> + <description>Hewlett-Packard SK-2505 Internet Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>hpxe3gc</name> + <description>Hewlett-Packard Omnibook XE3 GC</description> + </configItem> + </model> + <model> + <configItem> + <name>hpxe3gf</name> + <description>Hewlett-Packard Omnibook XE3 GF</description> + </configItem> + </model> + <model> + <configItem> + <name>hpxt1000</name> + <description>Hewlett-Packard Omnibook XT1000</description> + </configItem> + </model> + <model> + <configItem> + <name>hpzt11xx</name> + <description>Hewlett-Packard Pavilion ZT11xx</description> + </configItem> + </model> + <model> + <configItem> + <name>hp500fa</name> + <description>Hewlett-Packard Omnibook 500 FA</description> + </configItem> + </model> + <model> + <configItem> + <name>honeywell_euroboard</name> + <description>Honeywell Euroboard</description> + </configItem> + </model> + <model> + <configItem> + <name>rapidaccess</name> + <description>IBM Rapid Access</description> + </configItem> + </model> + <model> + <configItem> + <name>rapidaccess2</name> + <description>IBM Rapid Access II</description> + </configItem> + </model> + <model> + <configItem> + <name>rapidaccess2a</name> + <description>IBM Rapid Access II (alternate option)</description> + <description xml:lang="ru">IBM Rapid Access II (альтернативный вариант)</description> + </configItem> + </model> + <model> + <configItem> + <name>ltcd</name> + <description>Logitech Cordless Desktop</description> + </configItem> + </model> + <model> + <configItem> + <name>logicdit</name> + <description>Logitech Cordless Desktop iTouch</description> + </configItem> + </model> + <model> + <configItem> + <name>logicdp</name> + <description>Logitech Cordless Desktop Pro</description> + </configItem> + </model> + <model> + <configItem> + <name>logicdpa</name> + <description>Logitech Cordless Desktop Pro (alternate option)</description> + <description xml:lang="ru">Logitech Cordless Desktop Pro (альтернативный вариант)</description> + </configItem> + </model> + <model> + <configItem> + <name>logicdpa2</name> + <description>Logitech Cordless Desktop Pro (alternate option2)</description> + <description xml:lang="ru">Logitech Cordless Desktop Pro (альтернативный вариант 2)</description> + </configItem> + </model> + <model> + <configItem> + <name>logicdo</name> + <description>Logitech Cordless Desktop Optical</description> + </configItem> + </model> + <model> + <configItem> + <name>logicfn</name> + <description>Logitech Cordless Freedom/Desktop Navigator</description> + </configItem> + </model> + <model> + <configItem> + <name>logicdn</name> + <description>Logitech Cordless Desktop Navigator</description> + </configItem> + </model> + <model> + <configItem> + <name>logidak</name> + <description>Logitech Deluxe Access Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>logiik</name> + <description>Logitech Internet Keyboard</description> + <description xml:lang="bg">Logitech Интернет клавиатура</description> + </configItem> + </model> + <model> + <configItem> + <name>itouch</name> + <description>Logitech iTouch</description> + </configItem> + </model> + <model> + <configItem> + <name>logiitc</name> + <description>Logitech iTouch Cordless Keyboard (model Y-RB6)</description> + <description xml:lang="ru">Logitech iTouch Cordless Keyboard (модель Y-RB6)</description> + </configItem> + </model> + <model> + <configItem> + <name>logiik</name> + <description>Logitech Internet Keyboard</description> + <description xml:lang="bg">Logitech Интернет клавиатура</description> + </configItem> + </model> + <model> + <configItem> + <name>logiink</name> + <description>Logitech Internet Navigator Keyboard</description> + <description xml:lang="bg">Logitech клавиатура за Интернет навигациÑ</description> + </configItem> + </model> + <model> + <configItem> + <name>itouchin</name> + <description>Logitech iTouch keyboard Internet Navigator</description> + </configItem> + </model> + <model> + <configItem> + <name>mx1998</name> + <description>Memorex MX1998</description> + </configItem> + </model> + <model> + <configItem> + <name>mx2500</name> + <description>Memorex MX2500 EZ-Access Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>mx2750</name> + <description>Memorex MX2750</description> + </configItem> + </model> + <model> + <configItem> + <name>microsoftinet</name> + <description>Microsoft Internet Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>microsoftpro</name> + <description>Microsoft Natural Keyboard Pro / Microsoft Internet Keyboard Pro</description> + </configItem> + </model> + <model> + <configItem> + <name>microsoftprose</name> + <description>Microsoft Internet Keyboard Pro, Swedish</description> + <description xml:lang="ru">Microsoft Internet Keyboard Pro, шведÑкаÑ</description> + </configItem> + </model> + <model> + <configItem> + <name>microsoftoffice</name> + <description>Microsoft Office Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>oretec</name> + <description>Oretec MCK-800 MM/Internet keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>propeller</name> + <description>Propeller Voyager (KTEZ-1000)</description> + </configItem> + </model> + <model> + <configItem> + <name>qtronix</name> + <description>QTronix Scorpius 98N+</description> + </configItem> + </model> + <model> + <configItem> + <name>samsung4500</name> + <description>Samsung SDM 4500P</description> + </configItem> + </model> + <model> + <configItem> + <name>samsung4510</name> + <description>Samsung SDM 4510P</description> + </configItem> + </model> + <model> + <configItem> + <name>sk1300</name> + <description>SK-1300</description> + </configItem> + </model> + <model> + <configItem> + <name>sk2500</name> + <description>SK-2500</description> + </configItem> + </model> + <model> + <configItem> + <name>sk6200</name> + <description>SK-6200</description> + </configItem> + </model> + <model> + <configItem> + <name>sk7100</name> + <description>SK-7100</description> + </configItem> + </model> + <model> + <configItem> + <name>sven</name> + <description>SVEN Ergonomic 2500</description> + </configItem> + </model> + <model> + <configItem> + <name>symplon</name> + <description>Symplon PaceBook (tablet PC)</description> + <description xml:lang="ru">Symplon PaceBook (карманный ПК)</description> + </configItem> + </model> + <model> + <configItem> + <name>toshiba_s3000</name> + <description>Toshiba Satellite S3000</description> + </configItem> + </model> + <model> + <configItem> + <name>trust</name> + <description>Trust Wireless Keyboard Classic</description> + </configItem> + </model> + <model> + <configItem> + <name>trustda</name> + <description>Trust Direct Access Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>yahoo</name> + <description>Yahoo! Internet Keyboard</description> + </configItem> + </model> + <model> + <configItem> + <name>macintosh</name> + <description>macintosh - No decription</description> + <description xml:lang="bg">macintosh - без опиÑание</description> + <description xml:lang="ru">Macintosh</description> + </configItem> + </model> + <model> + <configItem> + <name>macintosh_old</name> + <description>macintosh_old - No decription</description> + <description xml:lang="bg">macintosh_old - без опиÑание</description> + <description xml:lang="ru">Ð¡Ñ‚Ð°Ñ€Ð°Ñ Macintosh</description> + </configItem> + </model> + <model> + <configItem> + <name>powerpcps2</name> + <description>powerpcps2 - No decription</description> + <description xml:lang="bg">powerpcps2 - без опиÑание</description> + <description xml:lang="ru">PowerPC PS/2</description> + </configItem> + </model> + </modelList> + <layoutList> + <layout> + <configItem> + <name>us</name> + <description>U.S. English</description> + <description xml:lang="bg">американÑка английÑка</description> + <description xml:lang="ru">ÐнглийÑÐºÐ°Ñ (СШÐ)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>en_US</name> + <description>U.S. English w/ ISO9995-3</description> + <description xml:lang="bg">американÑка английÑка Ñ ISO9995-3</description> + <description xml:lang="ru">ÐнглийÑÐºÐ°Ñ (СШÐ) Ñ ISO9995-3</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>us_intl</name> + <description>U.S. English w/ deadkeys</description> + <description xml:lang="bg">американÑка английÑка ÑÑŠÑ Ñпециални клавиши </description> + <description xml:lang="ru">ÐнглийÑÐºÐ°Ñ (СШÐ) Ñо Ñпециальными клавишами (dead keys)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>al</name> + <description>Albanian</description> + <description xml:lang="bg">албанÑка</description> + <description xml:lang="ru">ÐлбанÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ar</name> + <description>Arabic</description> + <description xml:lang="bg">арабÑка</description> + <description xml:lang="ru">ÐрабÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>azerty</name> + <description>ar(azerty) - No decription</description> + <description xml:lang="bg">ar(azerty) - без опиÑание</description> + <description xml:lang="ru">azerty</description> + </configItem> + </variant> + <variant> + <configItem> + <name>azerty_digits</name> + <description>ar(azerty_digits) - No decription</description> + <description xml:lang="bg">ar(azerty_digits) - без опиÑание</description> + <description xml:lang="ru">azerty, цифры</description> + </configItem> + </variant> + <variant> + <configItem> + <name>digits</name> + <description>ar(digits) - No decription</description> + <description xml:lang="bg">ar(digits) - без опиÑание</description> + <description xml:lang="ru">Ñ Ñ†Ð¸Ñ„Ñ€Ð°Ð¼Ð¸</description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty</name> + <description>ar(qwerty) - No decription</description> + <description xml:lang="bg">ar(qwerty) - без опиÑание</description> + <description xml:lang="ru">qwerty</description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty_digits</name> + <description>ar(qwerty_digits) - No decription</description> + <description xml:lang="bg">ar(qwerty_digits) - без опиÑание</description> + <description xml:lang="ru">qwerty, цифры</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>am</name> + <description>Armenian</description> + <description xml:lang="bg">арменÑка</description> + <description xml:lang="ru">ÐрмÑнÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>az</name> + <description>Azerbaijani</description> + <description xml:lang="ru">ÐзербайджанÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>cyrillic</name> + <description>az(cyrillic) - No decription</description> + <description xml:lang="bg">az(cyrillic) - без опиÑание</description> + <description xml:lang="ru">кириллица</description> + </configItem> + </variant> + <variant> + <configItem> + <name>latin</name> + <description>az(latin) - No decription</description> + <description xml:lang="bg">az(latin) - без опиÑание</description> + <description xml:lang="ru">латиница</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>by</name> + <description>Belarusian</description> + <description xml:lang="bg">беларуÑка</description> + <description xml:lang="ru">БелоруÑÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>winkeys</name> + <description>by(winkeys) - No decription</description> + <description xml:lang="bg">by(winkeys) - без опиÑание</description> + <description xml:lang="ru">Microsoft</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>be</name> + <description>Belgian</description> + <description xml:lang="bg">белгийÑка</description> + <description xml:lang="ru">БельгийÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>be(Sundeadkeys) - No decription</description> + <description xml:lang="bg">be(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>iso-alternate</name> + <description>be(iso-alternate) - No decription</description> + <description xml:lang="bg">be(iso-alternate) - без опиÑание</description> + <description xml:lang="ru">Ð°Ð»ÑŒÑ‚ÐµÑ€Ð½Ð°Ñ‚Ð¸Ð²Ð½Ð°Ñ iso</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ben</name> + <description>Bengali</description> + <description xml:lang="bg">бенгалÑка</description> + <description xml:lang="ru">БенгальÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>bs</name> + <description>Bosnian</description> + <description xml:lang="ru">БоÑнийÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>br</name> + <description>Brazilian</description> + <description xml:lang="bg">бразилÑка</description> + <description xml:lang="ru">БразильÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>abnt2</name> + <description>br(abnt2) - No decription</description> + <description xml:lang="ru">ABNT2</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>bg</name> + <description>Bulgarian</description> + <description xml:lang="bg">българÑка</description> + <description xml:lang="ru">БолгарÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <description>bg(phonetic) - No decription</description> + <description xml:lang="bg">bg(phonetic) - без опиÑание</description> + <description xml:lang="ru">фонетичеÑкаÑ</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mm</name> + <description>Burmese</description> + <description xml:lang="bg">бирманÑка</description> + <description xml:lang="ru">БирманÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ca</name> + <description>Canadian</description> + <description xml:lang="bg">канадÑка</description> + <description xml:lang="ru">КанадÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>alternate</name> + <description>ca(alternate) - No decription</description> + <description xml:lang="bg">ca(alternate) - без опиÑание</description> + <description xml:lang="ru">альтернативнаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <description>ca(sundeadkeys) - No decription</description> + <description xml:lang="bg">ca(sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">sundeadkeys</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ca_enhanced</name> + <description>French Canadian</description> + <description xml:lang="ru">ФранцузÑÐºÐ°Ñ ÐšÐ°Ð½Ð°Ð´ÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>ca_enhanced(Sundeadkeys) - No decription</description> + <description xml:lang="bg">ca_enhanced(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>basic</name> + <description>ca_enhanced(basic) - No decription</description> + <description xml:lang="bg">ca_enhanced(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>hr</name> + <description>Croatian</description> + <description xml:lang="bg">хърватÑка</description> + <description xml:lang="ru">ХорватÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>cz</name> + <description>Czech</description> + <description xml:lang="bg">чехшка</description> + <description xml:lang="ru">ЧешÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>cz(basic) - No decription</description> + <description xml:lang="bg">cz(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>bksl</name> + <description>cz(bksl) - No decription</description> + <description xml:lang="bg">cz(bksl) - без опиÑание</description> + <description xml:lang="ru">bksl</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>cz_qwerty</name> + <description>Czech (qwerty)</description> + <description xml:lang="bg">чешка (qwerty)</description> + <description xml:lang="ru">ЧешÑÐºÐ°Ñ (qwerty)</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>cz_qwerty(basic) - No decription</description> + <description xml:lang="bg">cz_qwerty(basic) - без опиÑание</description> + <description xml:lang="ru">проÑÑ‚Ð°Ñ qwerty</description> + </configItem> + </variant> + <variant> + <configItem> + <name>bksl</name> + <description>cz_qwerty(bksl) - No decription</description> + <description xml:lang="ru">bksl qwerty</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>dk</name> + <description>Danish</description> + <description xml:lang="bg">датÑка</description> + <description xml:lang="ru">ДатÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>nl</name> + <description>Dutch</description> + <description xml:lang="bg">холандÑка</description> + <description xml:lang="ru">ГолландÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>dvorak</name> + <description>Dvorak</description> + <description xml:lang="bg">Дворак</description> + <description xml:lang="ru">Дворак</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>no</name> + <description>dvorak(no) - No decription</description> + <description xml:lang="bg">dvorak(no) - без опиÑание</description> + <description xml:lang="ru">ÐорвегиÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>se</name> + <description>dvorak(se) - No decription</description> + <description xml:lang="ru">Ð¨Ð²ÐµÑ†Ð¸Ñ SE</description> + </configItem> + </variant> + <variant> + <configItem> + <name>sv</name> + <description>dvorak(sv) - No decription</description> + <description xml:lang="ru">Ð¨Ð²ÐµÑ†Ð¸Ñ SV</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ee</name> + <description>Estonian</description> + <description xml:lang="bg">еÑтонÑка</description> + <description xml:lang="ru">ЭÑтонÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ir</name> + <description>Iranian</description> + <description xml:lang="ru">ФарÑи</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>fi</name> + <description>Finnish</description> + <description xml:lang="bg">финландÑка</description> + <description xml:lang="ru">ФинÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>fi(basic) - No decription</description> + <description xml:lang="bg">fi(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>fr</name> + <description>French</description> + <description xml:lang="bg">френÑка</description> + <description xml:lang="ru">ФранцузÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>fr(Sundeadkeys) - No decription</description> + <description xml:lang="bg">fr(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>fr-latin9</name> + <description>French (alternative)</description> + <description xml:lang="ru">ФранцузÑÐºÐ°Ñ (альтернативнаÑ)</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>fr-latin9(Sundeadkeys) - No decription</description> + <description xml:lang="ru">Latin9, Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ge_la</name> + <description>Georgian (latin)</description> + <description xml:lang="bg">грузинÑка (латинÑка)</description> + <description xml:lang="ru">ГрузинÑÐºÐ°Ñ "латинÑкаÑ"</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ge_ru</name> + <description>Georgian (russian)</description> + <description xml:lang="bg">грузинÑка (руÑка)</description> + <description xml:lang="ru">ГрузинÑÐºÐ°Ñ "руÑÑкаÑ"</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>de</name> + <description>German</description> + <description xml:lang="bg">немÑка</description> + <description xml:lang="ru">ÐемецкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>de(basic) - No decription</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>deadacute</name> + <description>de(deadacute) - No decription</description> + <description xml:lang="bg">de(deadacute) - без опиÑание</description> + <description xml:lang="ru">deadacute</description> + </configItem> + </variant> + <variant> + <configItem> + <name>deadgraveacute</name> + <description>de(deadgraveacute) - No decription</description> + <description xml:lang="bg">de(deadgraveacute) - без опиÑание</description> + <description xml:lang="ru">deadgraveacute</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>el</name> + <description>Greek</description> + <description xml:lang="bg">гръцка</description> + <description xml:lang="ru">ГречеÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>extended</name> + <description>el(extended) - No decription</description> + <description xml:lang="ru">РаÑширеннаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + <variant> + <configItem> + <name>polytonic</name> + <description>el(polytonic) - No decription</description> + <description xml:lang="ru">ПолитоничеÑкаÑ</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>guj</name> + <description>Gujarati</description> + <description xml:lang="bg">гуджарати</description> + <description xml:lang="ru">Гуджарати</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>gur</name> + <description>Gurmukhi</description> + <description xml:lang="bg">гурмуки</description> + <description xml:lang="ru">Гурмукхи</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>dev</name> + <description>Hindi</description> + <description xml:lang="bg">хинди</description> + <description xml:lang="ru">Хинди</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>hu</name> + <description>Hungarian</description> + <description xml:lang="bg">унгарÑка</description> + <description xml:lang="ru">ВенгерÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>hu(Sundeadkeys) - No decription</description> + <description xml:lang="bg">hu(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_101_qwerty_comma</name> + <description>hu(l2_101_qwerty_comma) - No decription</description> + <description xml:lang="bg">hu(l2_101_qwerty_comma) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc101, qwerty, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_101_qwerty_dot</name> + <description>hu(l2_101_qwerty_dot) - No decription</description> + <description xml:lang="bg">hu(l2_101_qwerty_dot) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc101, qwerty, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_101_qwertz_comma</name> + <description>hu(l2_101_qwertz_comma) - No decription</description> + <description xml:lang="bg">hu(l2_101_qwertz_comma) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc101, qwertz, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_101_qwertz_dot</name> + <description>hu(l2_101_qwertz_dot) - No decription</description> + <description xml:lang="bg">hu(l2_101_qwertz_dot) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc101, qwertz, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_102_qwerty_comma</name> + <description>hu(l2_102_qwerty_comma) - No decription</description> + <description xml:lang="bg">hu(l2_102_qwerty_comma) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc102, qwerty, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_102_qwerty_dot</name> + <description>hu(l2_102_qwerty_dot) - No decription</description> + <description xml:lang="bg">hu(l2_102_qwerty_dot) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc102, qwerty, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_102_qwertz_comma</name> + <description>hu(l2_102_qwertz_comma) - No decription</description> + <description xml:lang="bg">hu(l2_102_qwertz_comma) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc102, qwertz, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>l2_102_qwertz_dot</name> + <description>hu(l2_102_qwertz_dot) - No decription</description> + <description xml:lang="bg">hu(l2_102_qwertz_dot) - без опиÑание</description> + <description xml:lang="ru">Latin2 pc102, qwertz, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + <variant> + <configItem> + <name>standard</name> + <description>hu(standard) - No decription</description> + <description xml:lang="bg">hu(standard) - без опиÑание</description> + <description xml:lang="ru">ÑтандартнаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_101_qwerty_comma</name> + <description>hu(uni_101_qwerty_comma) - No decription</description> + <description xml:lang="bg">hu(uni_101_qwerty_comma) - без опиÑание</description> + <description xml:lang="ru">Unicode pc101, qwerty, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_101_qwerty_dot</name> + <description>hu(uni_101_qwerty_dot) - No decription</description> + <description xml:lang="bg">hu(uni_101_qwerty_dot) - без опиÑание</description> + <description xml:lang="ru">Unicode pc101, qwerty, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_101_qwertz_comma</name> + <description>hu(uni_101_qwertz_comma) - No decription</description> + <description xml:lang="bg">hu(uni_101_qwertz_comma) - без опиÑание</description> + <description xml:lang="ru">Unicode pc101, qwertz, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_101_qwertz_dot</name> + <description>hu(uni_101_qwertz_dot) - No decription</description> + <description xml:lang="bg">hu(uni_101_qwertz_dot) - без опиÑание</description> + <description xml:lang="ru">Unicode pc101, qwertz, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_102_qwerty_comma</name> + <description>hu(uni_102_qwerty_comma) - No decription</description> + <description xml:lang="bg">hu(uni_102_qwerty_comma) - без опиÑание</description> + <description xml:lang="ru">Unicode pc102, qwerty, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_102_qwerty_dot</name> + <description>hu(uni_102_qwerty_dot) - No decription</description> + <description xml:lang="bg">hu(uni_102_qwerty_dot) - без опиÑание</description> + <description xml:lang="ru">Unicode pc102, qwerty, точка</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_102_qwertz_comma</name> + <description>hu(uni_102_qwertz_comma) - No decription</description> + <description xml:lang="bg">hu(uni_102_qwertz_comma) - без опиÑание</description> + <description xml:lang="ru">Unicode pc102, qwertz, запÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>uni_102_qwertz_dot</name> + <description>hu(uni_102_qwertz_dot) - No decription</description> + <description xml:lang="bg">hu(uni_102_qwertz_dot) - без опиÑание</description> + <description xml:lang="ru">Unicode pc102, qwertz, точка</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>hu_qwerty</name> + <description>Hungarian (qwerty)</description> + <description xml:lang="ru">ВенгерÑÐºÐ°Ñ (qwerty)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>is</name> + <description>Icelandic</description> + <description xml:lang="bg">иÑландÑка</description> + <description xml:lang="ru">ИÑландÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>is(Sundeadkeys) - No decription</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>iu</name> + <description>Inuktitut</description> + <description xml:lang="bg">еÑкимоÑка</description> + <description xml:lang="ru">ИннуитÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>il</name> + <description>Israeli</description> + <description xml:lang="bg">израелÑка</description> + <description xml:lang="ru">Иврит</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>lyx</name> + <description>il(lyx) - No decription</description> + <description xml:lang="ru">lyx</description> + </configItem> + </variant> + <variant> + <configItem> + <name>si1452</name> + <description>il(si1452) - No decription</description> + <description xml:lang="ru">sil1452</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>it</name> + <description>Italian</description> + <description xml:lang="bg">италианÑка</description> + <description xml:lang="ru">ИтальÑнÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>jp</name> + <description>Japanese</description> + <description xml:lang="bg">ÑпонÑка</description> + <description xml:lang="ru">ЯпонÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>kan</name> + <description>Kannada</description> + <description xml:lang="ru">КанадÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>lo</name> + <description>Lao</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>la</name> + <description>Latin America</description> + <description xml:lang="bg">латиноамериканÑка</description> + <description xml:lang="ru">ЛатиноамериканÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>la(Sundeadkeys) - No decription</description> + <description xml:lang="bg">la(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>lt</name> + <description>Lithuanian qwerty "numeric"</description> + <description xml:lang="bg">литовÑка "цифрова" qwerty</description> + <description xml:lang="ru">ЛитовÑÐºÐ°Ñ "БалтийÑкаÑ" qwerty</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>lt_std</name> + <description>lt(lt_std) - No decription</description> + <description xml:lang="ru">ÑтандартнаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>lt_us</name> + <description>lt(lt_us) - No decription</description> + <description xml:lang="ru">американÑкаÑ</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>lt_std</name> + <description>Lithuanian azerty standard</description> + <description xml:lang="bg">литовÑка Ñтандартна azerty</description> + <description xml:lang="ru">ЛитовÑÐºÐ°Ñ ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð°Ñ azerty</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>lt_std(Sundeadkeys) - No decription</description> + <description xml:lang="bg">lt_std(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>lv</name> + <description>Latvian</description> + <description xml:lang="bg">латвийÑка</description> + <description xml:lang="ru">ЛатышÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>mk</name> + <description>Macedonian</description> + <description xml:lang="bg">македонÑка</description> + <description xml:lang="ru">МакедонÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>pc104</name> + <description>mk(pc104) - No decription</description> + <description xml:lang="bg">mk(pc104) - без опиÑание</description> + <description xml:lang="ru">pc104</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ml</name> + <description>Malayalam</description> + <description xml:lang="ru">МалайÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>mt</name> + <description>Maltese</description> + <description xml:lang="bg">малтийÑка</description> + <description xml:lang="ru">МальтийÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>mt_us</name> + <description>Maltese (US layout)</description> + <description xml:lang="bg">малтийÑка (американÑка подредба)</description> + <description xml:lang="ru">МальтийÑÐºÐ°Ñ (ÐмериканÑÐºÐ°Ñ Ñ€Ð°Ñкладка)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>mn</name> + <description>Mongolian</description> + <description xml:lang="ru">МонгольÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>no</name> + <description>Norwegian</description> + <description xml:lang="bg">норвежка</description> + <description xml:lang="ru">ÐорвежÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>no(basic) - No decription</description> + <description xml:lang="bg">no(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ogham</name> + <description>Ogham</description> + <description xml:lang="ru">Огхам (древнеирланÑкаÑ)</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>IS434</name> + <description>ogham(IS434) - No decription</description> + <description xml:lang="ru">IS434</description> + </configItem> + </variant> + <variant> + <configItem> + <name>IS434laptop</name> + <description>ogham(IS434laptop) - No decription</description> + <description xml:lang="ru">IS434 Ð´Ð»Ñ Ð½Ð°Ñтольных ПК</description> + </configItem> + </variant> + <variant> + <configItem> + <name>laptop</name> + <description>ogham(laptop) - No decription</description> + <description xml:lang="ru">Ð´Ð»Ñ Ð½Ð°Ñтольных ПК</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ori</name> + <description>Oriya</description> + <description xml:lang="ru">ОрийÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>pl</name> + <description>Polish</description> + <description xml:lang="bg">полÑка</description> + <description xml:lang="ru">ПольÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>pl2</name> + <description>Polish (qwertz)</description> + <description xml:lang="bg">полÑка (qwertz)</description> + <description xml:lang="ru">ПольÑÐºÐ°Ñ (qwertz)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>pt</name> + <description>Portuguese</description> + <description xml:lang="bg">португалÑка</description> + <description xml:lang="ru">ПортугальÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>pt(Sundeadkeys) - No decription</description> + <description xml:lang="bg">pt(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ro</name> + <description>Romanian</description> + <description xml:lang="bg">румънÑка</description> + <description xml:lang="ru">РумынÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ru</name> + <description>Russian</description> + <description xml:lang="bg">руÑка</description> + <description xml:lang="ru">РуÑÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <description>ru(phonetic) - No decription</description> + <description xml:lang="bg">ru(phonetic) - без опиÑание</description> + <description xml:lang="ru">фонетичеÑкаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>typewriter</name> + <description>ru(typewriter) - No decription</description> + <description xml:lang="bg">ru(typewriter) - без опиÑание</description> + <description xml:lang="ru">"ÐŸÐµÑ‡Ð°Ñ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½ÐºÐ°"</description> + </configItem> + </variant> + <variant> + <configItem> + <name>winkeys</name> + <description>ru(winkeys) - No decription</description> + <description xml:lang="bg">ru(winkeys) - без опиÑание</description> + <description xml:lang="ru">Microsoft</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ru_yawerty</name> + <description>Russian (cyrillic phonetic)</description> + <description xml:lang="bg">руÑка (фонетична кирилица)</description> + <description xml:lang="ru">РуÑÑÐºÐ°Ñ (кириллица, фонетичеÑкаÑ)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>se_FI</name> + <description>Northern Saami (Finland)</description> + <description xml:lang="bg">ÑеверноÑамÑка (ФинландиÑ)</description> + <description xml:lang="ru">СаамÑÐºÐ°Ñ (ФинлÑндиÑ)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>se_NO</name> + <description>Northern Saami (Norway)</description> + <description xml:lang="bg">ÑеверноÑамÑка (ÐорвегиÑ)</description> + <description xml:lang="ru">СаамÑÐºÐ°Ñ (ÐорвегиÑ)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>se_SE</name> + <description>Northern Saami (Sweden)</description> + <description xml:lang="bg">ÑеверноÑамÑка (ШвециÑ)</description> + <description xml:lang="ru">СаамÑÐºÐ°Ñ (ШвециÑ)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>sr</name> + <description>Serbian</description> + <description xml:lang="bg">ÑръбÑка</description> + <description xml:lang="ru">СербÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>si</name> + <description>Slovenian</description> + <description xml:lang="bg">ÑловенÑка</description> + <description xml:lang="ru">СловенÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>sk</name> + <description>Slovak</description> + <description xml:lang="bg">Ñловашка</description> + <description xml:lang="ru">СловацкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>sk(basic) - No decription</description> + <description xml:lang="bg">sk(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>bksl</name> + <description>sk(bksl) - No decription</description> + <description xml:lang="ru">bksl</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>sk_qwerty</name> + <description>Slovak (qwerty)</description> + <description xml:lang="bg">Ñловашка (qwerty)</description> + <description xml:lang="ru">Ð¡Ð»Ð¾Ð²Ð°Ñ†ÐºÐ°Ñ (qwerty)</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>sk_qwerty(basic) - No decription</description> + <description xml:lang="bg">sk_qwerty(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ-qwerty</description> + </configItem> + </variant> + <variant> + <configItem> + <name>bksl</name> + <description>sk_qwerty(bksl) - No decription</description> + <description xml:lang="ru">bksl-qwerty</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>es</name> + <description>Spanish</description> + <description xml:lang="bg">иÑпанÑка</description> + <description xml:lang="ru">ИÑпанÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>es(Sundeadkeys) - No decription</description> + <description xml:lang="bg">es(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>se</name> + <description>Swedish</description> + <description xml:lang="bg">шведÑка</description> + <description xml:lang="ru">ШведÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>se(basic) - No decription</description> + <description xml:lang="bg">se(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>fr_CH</name> + <description>Swiss French</description> + <description xml:lang="bg">швейцарÑка френÑка</description> + <description xml:lang="ru">ФранцузÑÐºÐ°Ñ (ШвейцариÑ)</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>fr_CH(Sundeadkeys) - No decription</description> + <description xml:lang="bg">fr_CH(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>de_CH</name> + <description>Swiss German</description> + <description xml:lang="bg">швейцарÑка немÑка</description> + <description xml:lang="ru">ÐÐµÐ¼ÐµÑ†ÐºÐ°Ñ (ШвейцариÑ)</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <description>de_CH(Sundeadkeys) - No decription</description> + <description xml:lang="bg">de_CH(Sundeadkeys) - без опиÑание</description> + <description xml:lang="ru">Sundeadkeys</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>syr</name> + <description>Syriac</description> + <description xml:lang="ru">СирийÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>tj</name> + <description>Tajik</description> + <description xml:lang="bg">таджикÑка</description> + <description xml:lang="ru">ТаджикÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>tml</name> + <description>Tamil</description> + <description xml:lang="bg">тамилÑка</description> + <description xml:lang="ru">ТамильÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>tel</name> + <description>Telugu</description> + <description xml:lang="ru">Телугу</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>th</name> + <description>Thai</description> + <description xml:lang="bg">тайландÑка</description> + <description xml:lang="ru">ТаиландÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>tr</name> + <description>Turkish </description> + <description xml:lang="bg">турÑка</description> + <description xml:lang="ru">ТурецкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>tr_f</name> + <description>Turkish (F)</description> + <description xml:lang="bg">турÑка (F)</description> + <description xml:lang="ru">Ð¢ÑƒÑ€ÐµÑ†ÐºÐ°Ñ (F)</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ua</name> + <description>Ukrainian </description> + <description xml:lang="bg">украинÑка</description> + <description xml:lang="ru">УкраинÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <description>ua(phonetic) - No decription</description> + <description xml:lang="bg">ua(phonetic) - без опиÑание</description> + <description xml:lang="ru">фонетичеÑкаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>typewriter</name> + <description>ua(typewriter) - No decription</description> + <description xml:lang="bg">ua(typewriter) - без опиÑание</description> + <description xml:lang="ru">"ÐŸÐµÑ‡Ð°Ñ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½ÐºÐ°"</description> + </configItem> + </variant> + <variant> + <configItem> + <name>winkeys</name> + <description>ua(winkeys) - No decription</description> + <description xml:lang="bg">ua(winkeys) - без опиÑание</description> + <description xml:lang="ru">Microsoft</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>gb</name> + <description>United Kingdom</description> + <description xml:lang="bg">британÑка</description> + <description xml:lang="ru">ÐнглийÑÐºÐ°Ñ (ВеликобританиÑ)</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>vn</name> + <description>Vietnamese</description> + <description xml:lang="bg">виетнамÑка</description> + <description xml:lang="ru">ВьетнамÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>yu</name> + <description>Yugoslavian</description> + <description xml:lang="bg">югоÑлавÑка</description> + <description xml:lang="ru">ЮгоÑлавÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>nec/jp</name> + <description>PC-98xx Series</description> + <description xml:lang="bg">PC-98xx Ñерии</description> + <description xml:lang="ru">PC-98xx</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ie</name> + <description>ie - No decription</description> + <description xml:lang="ru">ИрландÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>CloGaelach</name> + <description>ie(CloGaelach) - No decription</description> + <description xml:lang="ru">CloGaelach</description> + </configItem> + </variant> + <variant> + <configItem> + <name>CloGaelachLaptop</name> + <description>ie(CloGaelachLaptop) - No decription</description> + <description xml:lang="ru">CloGaelach Ð´Ð»Ñ Ð½Ð°Ñтольных ПК</description> + </configItem> + </variant> + <variant> + <configItem> + <name>UnicodeExpert</name> + <description>ie(UnicodeExpert) - No decription</description> + <description xml:lang="ru">уникод</description> + </configItem> + </variant> + <variant> + <configItem> + <name>laptop</name> + <description>ie(laptop) - No decription</description> + <description xml:lang="ru">Ð´Ð»Ñ Ð½Ð°Ñтольных ПК</description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>il_phonetic</name> + <description>il_phonetic - No decription</description> + <description xml:lang="bg">il_phonetic - без опиÑание</description> + <description xml:lang="ru">Иврит, фонетичеÑкаÑ</description> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>sapmi</name> + <description>sapmi - No decription</description> + <description xml:lang="bg">sapmi - без опиÑание</description> + <description xml:lang="ru">СаамÑкаÑ</description> + </configItem> + <variantList> + <variant> + <configItem> + <name>basic</name> + <description>sapmi(basic) - No decription</description> + <description xml:lang="bg">sapmi(basic) - без опиÑание</description> + <description xml:lang="ru">проÑтаÑ</description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <description>Eliminate dead keys</description> + <description xml:lang="bg">Изключи Ñпециалните клавиши (dead keys)</description> + <description xml:lang="ru">ИÑключить Ñпециальные клавиши (dead keys)</description> + </configItem> + </variant> + <variant> + <configItem> + <name>sefi</name> + <description>sapmi(sefi) - No decription</description> + <description xml:lang="bg">sapmi(sefi) - без опиÑание</description> + <description xml:lang="ru">шведÑко-финÑкаÑ</description> + </configItem> + </variant> + </variantList> + </layout> + </layoutList> + <optionList> + <group allowMultipleSelection="true"> + <configItem> + <name>grp</name> + <description>Group Shift/Lock behavior</description> + <description xml:lang="bg">Функции на клавишите Shift/Lock</description> + <description xml:lang="ru">Ð¤ÑƒÐ½ÐºÑ†Ð¸Ñ Ñмены раÑкладки</description> + </configItem> + <option> + <configItem> + <name>grp:switch</name> + <description>R-Alt switches group while pressed</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Alt ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð° докато е натиÑнат</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Alt переключает группу на Ð²Ñ€ÐµÐ¼Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lwin_switch</name> + <description>Left Win-key switches group while pressed</description> + <description xml:lang="bg">ЛевиÑÑ‚ Win клавиш ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð° докато е натиÑнат</description> + <description xml:lang="ru">Ð›ÐµÐ²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Win переключает группу на Ð²Ñ€ÐµÐ¼Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rwin_switch</name> + <description>Right Win-key switches group while pressed</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Win ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð° докато е натиÑнат</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Win переключает группу на Ð²Ñ€ÐµÐ¼Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:win_switch</name> + <description>Both Win-keys switch group while pressed</description> + <description xml:lang="bg">Двата Win-а заедно ÑменÑÑ‚ групата докато Ñа натиÑнати</description> + <description xml:lang="ru">Две клавиши Win переключает группу на Ð²Ñ€ÐµÐ¼Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:toggle</name> + <description>Right Alt key changes group</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Alt ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Alt менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lalt_toggle</name> + <description>Left Alt key changes group</description> + <description xml:lang="ru">Ð›ÐµÐ²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Alt менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:caps_toggle</name> + <description>Caps Lock key changes group</description> + <description xml:lang="bg">Caps Lock ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">Клавиша Caps Lock менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:shift_toggle</name> + <description>Both Shift keys together change group</description> + <description xml:lang="bg">Двата Shift-а заедно ÑменÑÑ‚ групата</description> + <description xml:lang="ru">Две клавиши Shift вмеÑте менÑÑŽÑ‚ группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:alts_toggle</name> + <description>Both Alt keys together change group</description> + <description xml:lang="ru">Две клавиши Alt вмеÑте менÑÑŽÑ‚ группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:ctrls_toggle</name> + <description>Both Ctrl keys together change group</description> + <description xml:lang="ru">Две клавиши Ctrl вмеÑте менÑÑŽÑ‚ группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:ctrl_shift_toggle</name> + <description>Control+Shift changes group</description> + <description xml:lang="bg">Control+Shift ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">Control+Shift менÑÑŽÑ‚ группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:ctrl_alt_toggle</name> + <description>Alt+Control changes group</description> + <description xml:lang="bg">Alt+Control ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">Alt+Control менÑÑŽÑ‚ группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:alt_shift_toggle</name> + <description>Alt+Shift changes group</description> + <description xml:lang="bg">Alt+Shift ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">Alt+Shift менÑÑŽÑ‚ группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:menu_toggle</name> + <description>Menu key changes group</description> + <description xml:lang="bg">Menu клавишът ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">Клавиша Menu менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lwin_toggle</name> + <description>Left Win-key changes group</description> + <description xml:lang="bg">ЛевиÑÑ‚ Win клавиш ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">Ð›ÐµÐ²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Win менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rwin_toggle</name> + <description>Right Win-key changes group</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Win ÑÐ¼ÐµÐ½Ñ Ð³Ñ€ÑƒÐ¿Ð°Ñ‚Ð°</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Win менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lshift_toggle</name> + <description>Left Shift key changes group</description> + <description xml:lang="ru">Ð›ÐµÐ²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Shift менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rshift_toggle</name> + <description>Right Shift key changes group</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Shift менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lctrl_toggle</name> + <description>Left Ctrl key changes group</description> + <description xml:lang="ru">Ð›ÐµÐ²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Ctrl менÑет группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rctrl_toggle</name> + <description>Right Ctrl key changes group</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Ctrl менÑет группу</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>lv3</name> + <description>Third level choosers</description> + <description xml:lang="bg">Избор на третата група</description> + <description xml:lang="ru">Выбор 3-го уровнÑ</description> + </configItem> + <option> + <configItem> + <name>lv3:switch</name> + <description>Press Right Control to choose 3rd level</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Control избира третата група</description> + <description xml:lang="ru">Выбор 3-го ÑƒÑ€Ð¾Ð²Ð½Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸ÐµÐ¼ правой клавиши Control</description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:menu_switch</name> + <description>Press Menu key to choose 3rd level</description> + <description xml:lang="bg">Menu избира третата група</description> + <description xml:lang="ru">Выбор 3-го ÑƒÑ€Ð¾Ð²Ð½Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸ÐµÐ¼ клавиши Menu</description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:win_switch</name> + <description>Press any of Win-keys to choose 3rd level</description> + <description xml:lang="bg">Двата Win клавиша избират третата група</description> + <description xml:lang="ru">Выбор 3-го ÑƒÑ€Ð¾Ð²Ð½Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸ÐµÐ¼ любой клавиши Win</description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:lwin_switch</name> + <description>Press Left Win-key to choose 3rd level</description> + <description xml:lang="bg">ЛевиÑÑ‚ Win клавиш избира третата група</description> + <description xml:lang="ru">Выбор 3-го ÑƒÑ€Ð¾Ð²Ð½Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸ÐµÐ¼ левой клавиши Win</description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:rwin_switch</name> + <description>Press Right Win-key to choose 3rd level</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Win избира третата група</description> + <description xml:lang="ru">Выбор 3-го ÑƒÑ€Ð¾Ð²Ð½Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¸ÐµÐ¼ правой клавиши Win</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <configItem> + <name>ctrl</name> + <description>Control Key Position</description> + <description xml:lang="bg">Положение на клавиша Control</description> + <description xml:lang="ru">Положение клавиши Control</description> + </configItem> + <option> + <configItem> + <name>ctrl:nocaps</name> + <description>Make CapsLock an additional Control</description> + <description xml:lang="bg">Caps Lock да функционира като Control</description> + <description xml:lang="ru">ИÑпользовать CapsLock как дополнительную клавишу Control</description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:swapcaps</name> + <description>Swap Control and Caps Lock</description> + <description xml:lang="bg">Размени Control и Caps Lock</description> + <description xml:lang="ru">ПоменÑÑ‚ÑŒ меÑтами клавиши Control и Caps Lock</description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:ctrl_ac</name> + <description>Control key at left of 'A'</description> + <description xml:lang="bg">Control е влÑво от 'A'</description> + <description xml:lang="ru">Клавиша Control Ñлева от 'Ф'</description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:ctrl_aa</name> + <description>Control key at bottom left</description> + <description xml:lang="bg">Control е долу влÑво</description> + <description xml:lang="ru">Клавиша Control Ñнизу Ñлева</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>grp_led</name> + <description>Use keyboard LED to show alternative group</description> + <description xml:lang="bg">Използвай клавиатурен индикатор за указване на алтернативна група</description> + <description xml:lang="ru">ИÑпользование клавиатурных индикаторов Ð´Ð»Ñ Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð´Ð¾Ð¿. групп</description> + </configItem> + <option> + <configItem> + <name>grp_led:num</name> + <description>Num_Lock LED shows alternative group</description> + <description xml:lang="bg">Индикаторът на Num_Lock указва алтернативната група</description> + <description xml:lang="ru">Индикатор Num Lock отображает доп. группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp_led:caps</name> + <description>Caps_Lock LED shows alternative group</description> + <description xml:lang="bg">Индикаторът на Caps_Lock показва алтернативната група</description> + <description xml:lang="ru">Индикатор Caps Lock отображает доп. группу</description> + </configItem> + </option> + <option> + <configItem> + <name>grp_led:scroll</name> + <description>Scroll_Lock LED shows alternative group</description> + <description xml:lang="bg">Индикаторът на Scroll_Lock указва ÑмÑната на групата</description> + <description xml:lang="ru">Индикатор Scroll Lock отображает доп. группу</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <configItem> + <name>caps</name> + <description>CapsLock key behavior</description> + <description xml:lang="bg">Поведение на Caps Lock</description> + <description xml:lang="ru">Клавиша Caps Lock</description> + </configItem> + <option> + <configItem> + <name>caps:internal</name> + <description>Uses internal capitalization. Shift cancels Caps.</description> + <description xml:lang="bg">Използва вътрешна промÑна на региÑтъра. Shift Ð¾Ñ‚Ð¼ÐµÐ½Ñ Caps.</description> + <description xml:lang="ru">Включает внутреннюю капитализацию. Shift отменÑет Caps.</description> + </configItem> + </option> + <option> + <configItem> + <name>caps:internal_nocancel</name> + <description>Uses internal capitalization. Shift doesn't cancel Caps.</description> + <description xml:lang="ru">Включает внутреннюю капитализацию. Shift не отменÑет Caps.</description> + </configItem> + </option> + <option> + <configItem> + <name>caps:shift</name> + <description>Acts as Shift with locking. Shift cancels Caps.</description> + <description xml:lang="bg">Работи като Shift ÑÑŠÑ Ð·Ð°ÐºÐ»ÑŽÑ‡Ð²Ð°Ð½Ðµ. Shift Ð¾Ñ‚Ð¼ÐµÐ½Ñ CapsLock.</description> + <description xml:lang="ru">ДейÑтвует как Shift Ñ Ð±Ð»Ð¾ÐºÐ¸Ñ€Ð¾Ð²ÐºÐ¾Ð¹. Shift отменÑет Caps.</description> + </configItem> + </option> + <option> + <configItem> + <name>caps:shift_nocancel</name> + <description>Acts as Shift with locking. Shift doesn't cancel Caps.</description> + <description xml:lang="bg">Работи като Shift ÑÑŠÑ Ð·Ð°ÐºÐ»ÑŽÑ‡Ð²Ð°Ð½Ðµ. Shift не Ð¾Ñ‚Ð¼ÐµÐ½Ñ CapsLock.</description> + <description xml:lang="ru">ДейÑтвует как Shift Ñ Ð±Ð»Ð¾ÐºÐ¸Ñ€Ð¾Ð²ÐºÐ¾Ð¹. Shift не отменÑет Caps.</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <configItem> + <name>altwin</name> + <description>Alt/Win key behavior</description> + <description xml:lang="bg">ФункциÑта на Alt/Win</description> + <description xml:lang="ru">Клавиши Alt/Win</description> + </configItem> + <option> + <configItem> + <name>altwin:menu</name> + <description>Add the standard behavior to Menu key.</description> + <description xml:lang="bg">Ð”Ð¾Ð±Ð°Ð²Ñ Ñтандартното поведение на клавиша Menu.</description> + <description xml:lang="ru">Добавить Ñтандартную функцию клавиши Menu</description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:meta_alt</name> + <description>Alt and Meta on the Alt keys (default).</description> + <description xml:lang="bg">Alt и Meta на Alt клавиша (по подразбиране)</description> + <description xml:lang="ru">Alt и Meta на клавишах Alt (по умолчанию)</description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:meta_win</name> + <description>Meta is mapped to the Win-keys.</description> + <description xml:lang="bg">Win клавишите фунцкионират като Meta</description> + <description xml:lang="ru">Мета ÑоответÑтвует клавишам Win</description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:left_meta_win</name> + <description>Meta is mapped to the left Win-key.</description> + <description xml:lang="bg">ЛевиÑÑ‚ Win клавиш функционира като Meta</description> + <description xml:lang="ru">Meta ÑоответÑтвует левой клавише Win</description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:meta_super</name> + <description>Super is mapped to the Win-keys (default).</description> + <description xml:lang="bg">Win клавишите функционират като Super</description> + <description xml:lang="ru">Super ÑоответÑтвует клавишам Win (по умолчанию)</description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:meta_hyper</name> + <description>Hyper is mapped to the Win-keys.</description> + <description xml:lang="bg">Hyper ÑъответÑтва на клавишите Win</description> + <description xml:lang="ru">Hyper ÑоответÑтвует клавишам Win</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>compose</name> + <description> </description> + </configItem> + <option> + <configItem> + <name>compose:ralt</name> + <description>Right Alt is Compose</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Alt фунцкионира като Compose</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Alt ÑоответÑтвует клавише Alt</description> + </configItem> + </option> + <option> + <configItem> + <name>compose:rwin</name> + <description>Right Win-key is Compose</description> + <description xml:lang="bg">ДеÑниÑÑ‚ Win фунцкионира като Compose</description> + <description xml:lang="ru">ÐŸÑ€Ð°Ð²Ð°Ñ ÐºÐ»Ð°Ð²Ð¸ÑˆÐ° Win ÑоответÑтвует клавише Compose</description> + </configItem> + </option> + <option> + <configItem> + <name>compose:menu</name> + <description>Menu is Compose</description> + <description xml:lang="bg">Клавиша Menu фунцкионира като Compose</description> + <description xml:lang="ru">Клавиша Menu ÑоответÑтвует клавише Compose</description> + </configItem> + </option> + </group> + </optionList> +</xkbConfigRegistry> Index: xc/programs/xkbcomp/rules/xkb.dtd diff -u /dev/null xc/programs/xkbcomp/rules/xkb.dtd:1.1 --- /dev/null Thu Feb 27 12:35:28 2003 +++ xc/programs/xkbcomp/rules/xkb.dtd Mon Nov 25 20:51:30 2002 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + + Description: XKB configuration file DTD + Author: Sergey V. Udaltsov + +--> + +<!ELEMENT xkbConfigRegistry (modelList,layoutList,optionList)> + +<!ELEMENT modelList (model*)> + +<!ELEMENT model (configItem)> + +<!ELEMENT layoutList (layout*)> + +<!ELEMENT layout (configItem,variantList?)> + +<!ELEMENT optionList (group*)> + +<!ELEMENT variantList (variant*)> + +<!ELEMENT variant (configItem)> + +<!ELEMENT group (configItem,option*)> +<!ATTLIST group + allowMultipleSelection (true|false) "false"> + +<!ELEMENT option (configItem)> + +<!ELEMENT configItem (name,description*)> + +<!ELEMENT name (#PCDATA)> + +<!ELEMENT description (#PCDATA)> +<!ATTLIST description + lang CDATA #IMPLIED> Index: xc/programs/xkbcomp/rules/xml2lst.pl diff -u /dev/null xc/programs/xkbcomp/rules/xml2lst.pl:1.1 --- /dev/null Thu Feb 27 12:35:28 2003 +++ xc/programs/xkbcomp/rules/xml2lst.pl Mon Nov 25 20:51:30 2002 @@ -0,0 +1,288 @@ +#!/usr/bin/perl + +# converts the <rules>.xml file to the old format <rules>.lst file +# +# Usage: +# +# perl xml2lst.pl [lang] < filename.xml > filename.lst +# +# author Ivan Pascal + +if (@ARGV) { + $lang = shift @ARGV; +} else { + $lang = ''; +} + +$doc = new_document( 0, ''); +parse('', $doc); + +($reg) = node_by_name($doc, '/xkbConfigRegistry'); +@models = node_by_name($reg, 'modelList/model/configItem'); +@layouts = node_by_name($reg, 'layoutList/layout/configItem'); +@options = node_by_name($reg, 'optionList/group/configItem'); + +print "! model\n"; +for $i (@models) { + ($name) = node_by_name($i, 'name'); + @desc = node_by_name($i, 'description'); + $descr = with_attribute(\@desc, 'xml:lang='.$lang); + if (! defined $descr) { + $descr = with_attribute(\@desc, 'xml:lang='); + } + printf(" %-15s %s\n", text_child($name), text_child($descr)); +} + +print "\n! layout\n"; +for $i (@layouts) { + ($name) = node_by_name($i, 'name'); + @desc = node_by_name($i, 'description'); + $descr = with_attribute(\@desc, 'xml:lang='.$lang); + if (! defined $descr ) { + $descr = with_attribute(\@desc, 'xml:lang='); + } + printf(" %-15s %s\n", text_child($name), text_child($descr)); +} + +print "\n! variant\n"; +for $l (@layouts) { + ($lname) = node_by_name($l, 'name'); + @variants = node_by_name($l, '../variantList/variant/configItem'); + for $v (@variants) { + ($name) = node_by_name($v, 'name'); + @desc = node_by_name($v, 'description'); + $descr = with_attribute(\@desc, 'xml:lang='.$lang); + if (! defined $descr) { + $descr = with_attribute(\@desc, 'xml:lang='); + } + printf(" %-15s %s: %s\n", + text_child($name), text_child($lname), text_child($descr)); + } +} + +print "\n! options\n"; +for $g (@options) { + ($name) = node_by_name($g, 'name'); + @desc = node_by_name($g, 'description'); + $descr = with_attribute(\@desc, 'xml:lang='.$lang); + if (! defined $descr) { + $descr = with_attribute(\@desc, 'xml:lang='); + } + printf(" %-20s %s\n", text_child($name), text_child($descr)); + + @opts = node_by_name($g, '../option/configItem'); + for $o (@opts) { + ($name) = node_by_name($o, 'name'); + @desc = node_by_name($o, 'description'); + $descr = with_attribute(\@desc, 'xml:lang='.$lang); + if (! defined $descr) { + $descr = with_attribute(\@desc, 'xml:lang='); + } + printf(" %-20s %s\n", + text_child($name), text_child($descr)); + } +} + +sub with_attribute { + local ($nodelist, $attrexpr) = @_; + local ($attr, $value) = split (/=/, $attrexpr); + local ($node, $attrvalue); + if (defined $value && $value ne '') { + $value =~ s/"//g; + foreach $node (@{$nodelist}) { + $attrvalue = node_attribute($node, $attr); + if (defined $attrvalue && $attrvalue eq $value) { + return $node; + } + } + } else { + foreach $node (@{$nodelist}) { + if (! defined node_attribute($node, $attr)) { + return $node; + } + } + } + undef; +} + +# Subroutines + +sub parse { + local $intag = 0; + my (@node_stack, $parent); + $parent = @_[1]; + local ($tag, $text); + + while (<>) { + chomp; + @str = split /([<>])/; + shift @str if ($str[0] eq '' || $str[0] =~ /^[ \t]*$/); + + while (scalar @str) { + $token = shift @str; + if ($token eq '<') { + $intag = 1; + if (defined $text) { + add_text_node($parent, $text); + undef $text; + } + } elsif ($token eq '>') { + $intag = 0; + if ($tag =~ /^\/(.*)/) { # close tag + $parent = pop @node_stack; + } elsif ($tag =~ /^([^\/]*)\/$/) { + empty_tag($parent, $1); + } else { + if (defined ($node = open_tag($parent, $tag))) { + push @node_stack, $parent; + $parent = $node; + } + } + undef $tag; + } else { + if ($intag == 1) { + if (defined $tag) { + $tag .= ' '. $token; + } else { + $tag = $token; + } + } else { + if (defined $text) { + $text .= "\n" . $token; + } else { + $text = $token; + } + } + } + } + } +} + +sub new_document { + $doc = new_node( 0, '', 'DOCUMENT'); + $doc->{CHILDREN} = []; + return $doc; +} + +sub new_node { + local ($parent_node, $tag, $type) = @_; + + my %node; + $node{PARENT} = $parent_node; + $node{TYPE} = $type; + + if ($type eq 'COMMENT' || $type eq 'TEXT') { + $node{TEXT} = $tag; + $node{NAME} = $type; + return \%node; + } + + local ($tname, $attr) = split(' ', $tag, 2); + $node{NAME} = $tname; + + if (defined $attr && $attr ne '') { + my %attr_table; + local @attr_list = split ( /"/, $attr); + local ($name, $value); + while (scalar @attr_list) { + $name = shift @attr_list; + $name =~ s/[ =]//g; + next if ($name eq ''); + $value = shift @attr_list; + $attr_table{$name} =$value; + } + $node{ATTRIBUTES} = \%attr_table; + } + return \%node; +} + +sub add_node { + local ($parent_node, $node) = @_; + push @{$parent_node->{CHILDREN}}, $node; + + local $tname = $node->{NAME}; + if (defined $parent_node->{$tname}) { + push @{$parent_node->{$tname}}, $node + } else { + $parent_node->{$tname} = [ $node ]; + } +} + +sub empty_tag { + local ($parent_node, $tag) = @_; + local $node = new_node($parent_node, $tag, 'EMPTY'); + add_node($parent_node, $node); +} + +sub open_tag { + local ($parent_node, $tag) = @_; + local $node; + + if ($tag =~ /^\?.*/ || $tag =~ /^\!.*/) { + $node = new_node($parent_node, $tag, 'COMMENT'); + add_node($parent_node, $node); + undef; return; + } else { + $node = new_node($parent_node, $tag, 'NODE'); + $node->{CHILDREN} = []; + add_node($parent_node, $node); + return $node; + } +} + +sub add_text_node { + local ($parent_node, $text) = @_; + local $node = new_node($parent_node, $text, 'TEXT'); + add_node($parent_node, $node); +} + +sub node_by_name { + local ($node, $name) = @_; + local ($tagname, $path) = split(/\//, $name, 2); + + my @nodelist; + + if ($tagname eq '') { + while ($node->{PARENT} != 0) { + $node = $node->{PARENT}; + } + sublist_by_name($node, $path, \@nodelist); + } else { + sublist_by_name($node, $name, \@nodelist); + } + return @nodelist; +} + +sub sublist_by_name { + local ($node, $name, $res) = @_; + local ($tagname, $path) = split(/\//, $name, 2); + + if (! defined $path) { + push @{$res}, (@{$node->{$tagname}}); + return; + } + + if ($tagname eq '..' && $node->{PARENT} != 0) { + $node = $node->{PARENT}; + sublist_by_name($node, $path, $res); + } else { + local $n; + for $n (@{$node->{$tagname}}) { + sublist_by_name($n, $path, $res); + } + } +} + +sub node_attribute { + local $node = @_[0]; + if (defined $node->{ATTRIBUTES}) { + return $node->{ATTRIBUTES}{@_[1]}; + } + undef; +} + +sub text_child { + local ($node) = @_; + local ($child) = node_by_name($node, 'TEXT'); + return $child->{TEXT}; +} Index: xc/programs/xkbcomp/symbols/Imakefile diff -u xc/programs/xkbcomp/symbols/Imakefile:3.45 xc/programs/xkbcomp/symbols/Imakefile:3.56 --- xc/programs/xkbcomp/symbols/Imakefile:3.45 Wed Jan 16 13:20:12 2002 +++ xc/programs/xkbcomp/symbols/Imakefile Sat Feb 15 17:22:44 2003 @@ -3,35 +3,38 @@ -XCOMM $XFree86: xc/programs/xkbcomp/symbols/Imakefile,v 3.45 2002/01/16 18:20:12 dawes Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/symbols/Imakefile,v 3.56 2003/02/15 22:22:44 dawes Exp $ #define IHaveSubdirs TESTDATA = - DATAFILES = al altwin am ar az \ - be ben bg br by \ + DATAFILES = README \ + al altwin am ar az \ + be ben bg br bs by \ ca ca_enhanced compose ctrl \ czsk cz cz_qwerty \ de de_CH dev dk dvorak \ ee el en_US es \ fi fr fr_CH \ gb ge_la ge_ru group guj gur \ - hu hu_US hr \ - il il_phonetic iso9995-3 inet ir is it iu \ + hu hu_US hu_qwerty hr \ + ie il il_phonetic iso9995-3 inet ir is it iu \ jp \ - keypad \ - la level3 lock lt lt_std lv \ - mk mm mt mt_us \ + kan keypad \ + la level3 lo lock lt lt_std lv \ + ml mk mm mt mt_us \ nl no \ + ogham ori \ pc104 pl pl2 pt \ ralt ro ru ru_yawerty \ - sapmi se se_FI se_NO se_SE si sk sk_qwerty sr \ - th tj tml tr tr_f \ + sapmi se se_FI se_NO se_SE si sk sk_qwerty sr srvr_ctrl \ + syr syr_phonetic \ + tel th tj tml tr tr_f \ ua us us_intl us_group2 us_group3 \ vn \ yu - SUBDIRS = digital fujitsu hp macintosh nec sgi sony sun xfree68 + SUBDIRS = digital fujitsu hp macintosh nec sgi sony sun xfree68 pc MakeXkbDir($(LIBDIR)/xkb,symbols) InstallMultiple($(DATAFILES),$(LIBDIR)/xkb/symbols) Index: xc/programs/xkbcomp/symbols/README diff -u /dev/null xc/programs/xkbcomp/symbols/README:1.1 --- /dev/null Thu Feb 27 12:35:29 2003 +++ xc/programs/xkbcomp/symbols/README Thu Nov 21 23:19:28 2002 @@ -0,0 +1,8 @@ +The symbols component of a keyboard mapping specifies primarily the symbols +bound to each keyboard key. It affects the symbols symbolic name, a key symbol +mapping for each key, the keyboard modifier mapping, and the symbolic names for +the keyboard symbol groups. + + + +/* $XFree86: xc/programs/xkbcomp/symbols/README,v 1.1 2002/11/22 04:19:28 dawes Exp $ */ Index: xc/programs/xkbcomp/symbols/am diff -u xc/programs/xkbcomp/symbols/am:1.3 xc/programs/xkbcomp/symbols/am:1.4 --- xc/programs/xkbcomp/symbols/am:1.3 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/am Tue Jun 4 18:50:58 2002 @@ -1,6 +1,6 @@ // $XConsortium: am /main/3 1997/12/18 12:40:12 rch $ // -// $XFree86: xc/programs/xkbcomp/symbols/am,v 1.3 2001/11/21 22:28:52 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/am,v 1.4 2002/06/04 22:50:58 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -12,107 +12,59 @@ name[Group2]= "Armenian"; // Alphanumeric section - key <TLDE> { [ grave, asciitilde ], - [ 0x100055d, 0x100055c ] }; - key <LSGT> { [ less, greater ], - [ question, 0x100058a ] }; - key <BKSL> { [ backslash, bar ], - [ guillemotright, guillemotleft ] }; - - key <AE01> { [ 1, exclam ], - [ 0x1000586, 0x1000556 ] }; - key <AE02> { [ 2, at ], - [ 0x1000571, 0x1000541 ] }; - key <AE03> { [ 3, numbersign ], - [ 0x1002013, 0x1002014 ] }; - key <AE04> { [ 4, dollar ], - [ comma, dollar ] }; - key <AE05> { [ 5, percent ], - [ 0x1000589, 0x1002026 ] }; - key <AE06> { [ 6, asciicircum ], - [ 0x100055e, percent ] }; - key <AE07> { [ 7, ampersand ], - [ period, 0x1000587 ] }; - key <AE08> { [ 8, asterisk ], - [ 0x100055b, 0x10002bc ] }; - key <AE09> { [ 9, parenleft ], - [ parenright, parenleft ] }; - key <AE10> { [ 0, parenright ], - [ 0x1000585, 0x1000555 ] }; - key <AE11> { [ minus, underscore ], - [ 0x1000567, 0x1000537 ] }; - key <AE12> { [ equal, plus ], - [ 0x1000572, 0x1000542 ] }; - - - key <AD01> { [ q, Q ], - [ 0x1000573, 0x1000543 ] }; - key <AD02> { [ w, W ], - [ 0x1000583, 0x1000553 ] }; - key <AD03> { [ e, E ], - [ 0x1000562, 0x1000532 ] }; - key <AD04> { [ r, R ], - [ 0x100057d, 0x100054d ] }; - key <AD05> { [ t, T ], - [ 0x1000574, 0x1000544 ] }; - key <AD06> { [ y, Y ], - [ 0x1000578, 0x1000548 ] }; - key <AD07> { [ u, U ], - [ 0x1000582, 0x1000552 ] }; - key <AD08> { [ i, I ], - [ 0x100056f, 0x100053f ] }; - key <AD09> { [ o, O ], - [ 0x1000568, 0x1000538 ] }; - key <AD10> { [ p, P ], - [ 0x1000569, 0x1000539 ] }; - key <AD11> { [ bracketleft, braceleft ], - [ 0x100056e, 0x100053e ] }; - key <AD12> { [ bracketright, braceright ], - [ 0x1000581, 0x1000551 ] }; - - key <AC01> { [ a, A ], - [ 0x100057b, 0x100054b ] }; - key <AC02> { [ s, S ], - [ 0x100057e, 0x100054e ] }; - key <AC03> { [ d, D ], - [ 0x1000563, 0x1000533 ] }; - key <AC04> { [ f, F ], - [ 0x1000565, 0x1000535 ] }; - key <AC05> { [ g, G ], - [ 0x1000561, 0x1000531 ] }; - key <AC06> { [ h, H ], - [ 0x1000576, 0x1000546 ] }; - key <AC07> { [ j, J ], - [ 0x100056b, 0x100053b ] }; - key <AC08> { [ k, K ], - [ 0x100057f, 0x100054f ] }; - key <AC09> { [ l, L ], - [ 0x1000570, 0x1000540 ] }; - key <AC10> { [ semicolon, colon ], - [ 0x100057a, 0x100054a ] }; - key <AC11> { [ apostrophe, quotedbl ], - [ 0x1000580, 0x1000550 ] }; - - key <AB01> { [ z, Z ], - [ 0x100056a, 0x100053a ] }; - key <AB02> { [ x, X ], - [ 0x1000564, 0x1000534 ] }; - key <AB03> { [ c, C ], - [ 0x1000579, 0x1000549 ] }; - key <AB04> { [ v, V ], - [ 0x1000575, 0x1000545 ] }; - key <AB05> { [ b, B ], - [ 0x1000566, 0x1000536 ] }; - key <AB06> { [ n, N ], - [ 0x100056c, 0x100053c ] }; - key <AB07> { [ m, M ], - [ 0x1000584, 0x1000554 ] }; - key <AB08> { [ comma, less ], - [ 0x100056d, 0x100053d ] }; - key <AB09> { [ period, greater ], - [ 0x1000577, 0x1000547 ] }; - key <AB10> { [ slash, question ], - [ 0x100057c, 0x100054c ] }; + key <TLDE> { [ ], [ 0x100055d, 0x100055c ] }; + key <LSGT> { [ ], [ question, 0x100058a ] }; + key <BKSL> { [ ], [ guillemotright, guillemotleft ] }; + + key <AE01> { [ ], [ 0x1000586, 0x1000556 ] }; + key <AE02> { [ ], [ 0x1000571, 0x1000541 ] }; + key <AE03> { [ ], [ 0x1002013, 0x1002014 ] }; + key <AE04> { [ ], [ comma, dollar ] }; + key <AE05> { [ ], [ 0x1000589, 0x1002026 ] }; + key <AE06> { [ ], [ 0x100055e, percent ] }; + key <AE07> { [ ], [ period, 0x1000587 ] }; + key <AE08> { [ ], [ 0x100055b, 0x10002bc ] }; + key <AE09> { [ ], [ parenright, parenleft ] }; + key <AE10> { [ ], [ 0x1000585, 0x1000555 ] }; + key <AE11> { [ ], [ 0x1000567, 0x1000537 ] }; + key <AE12> { [ ], [ 0x1000572, 0x1000542 ] }; + + + key <AD01> { [ ], [ 0x1000573, 0x1000543 ] }; + key <AD02> { [ ], [ 0x1000583, 0x1000553 ] }; + key <AD03> { [ ], [ 0x1000562, 0x1000532 ] }; + key <AD04> { [ ], [ 0x100057d, 0x100054d ] }; + key <AD05> { [ ], [ 0x1000574, 0x1000544 ] }; + key <AD06> { [ ], [ 0x1000578, 0x1000548 ] }; + key <AD07> { [ ], [ 0x1000582, 0x1000552 ] }; + key <AD08> { [ ], [ 0x100056f, 0x100053f ] }; + key <AD09> { [ ], [ 0x1000568, 0x1000538 ] }; + key <AD10> { [ ], [ 0x1000569, 0x1000539 ] }; + key <AD11> { [ ], [ 0x100056e, 0x100053e ] }; + key <AD12> { [ ], [ 0x1000581, 0x1000551 ] }; + + key <AC01> { [ ], [ 0x100057b, 0x100054b ] }; + key <AC02> { [ ], [ 0x100057e, 0x100054e ] }; + key <AC03> { [ ], [ 0x1000563, 0x1000533 ] }; + key <AC04> { [ ], [ 0x1000565, 0x1000535 ] }; + key <AC05> { [ ], [ 0x1000561, 0x1000531 ] }; + key <AC06> { [ ], [ 0x1000576, 0x1000546 ] }; + key <AC07> { [ ], [ 0x100056b, 0x100053b ] }; + key <AC08> { [ ], [ 0x100057f, 0x100054f ] }; + key <AC09> { [ ], [ 0x1000570, 0x1000540 ] }; + key <AC10> { [ ], [ 0x100057a, 0x100054a ] }; + key <AC11> { [ ], [ 0x1000580, 0x1000550 ] }; + + key <AB01> { [ ], [ 0x100056a, 0x100053a ] }; + key <AB02> { [ ], [ 0x1000564, 0x1000534 ] }; + key <AB03> { [ ], [ 0x1000579, 0x1000549 ] }; + key <AB04> { [ ], [ 0x1000575, 0x1000545 ] }; + key <AB05> { [ ], [ 0x1000566, 0x1000536 ] }; + key <AB06> { [ ], [ 0x100056c, 0x100053c ] }; + key <AB07> { [ ], [ 0x1000584, 0x1000554 ] }; + key <AB08> { [ ], [ 0x100056d, 0x100053d ] }; + key <AB09> { [ ], [ 0x1000577, 0x1000547 ] }; + key <AB10> { [ ], [ 0x100057c, 0x100054c ] }; // Begin modifier mappings @@ -120,6 +72,113 @@ modifier_map Lock { Caps_Lock, ISO_Lock }; modifier_map Control{ Control_L }; modifier_map Mod3 { Mode_switch }; +}; + +xkb_symbols "old" { + include "am(basic)" + + key <BKSL> { [ ], [ 0x1002026, 0x1000587 ] }; + + key <AE01> { [ ], [ 0x1000573, 0x1000543 ] }; + key <AE02> { [ ], [ 0x100057b, 0x100054b ] }; + key <AE03> { [ ], [ 0x100056a, 0x100053a ] }; + key <AE04> { [ ], [ 0x1000571, 0x1000541 ] }; + key <AE05> { [ ], [ 0x1000575, 0x1000545 ] }; + key <AE06> { [ ], [ 0x100057c, 0x100054c ] }; + key <AE07> { [ ], [ 0x1000580, 0x1000550 ] }; + key <AE08> { [ ], [ 0x1000581, 0x1000551 ] }; + key <AE09> { [ ], [ 0x1000567, 0x1000537 ] }; + key <AE10> { [ ], [ 0x1000572, 0x1000542 ] }; + key <AE11> { [ ], [ 0x1002013, 0x1002014 ] }; + key <AE12> { [ ], [ parenleft, parenright] }; + + key <AD01> { [ ], [ 0x1000583, 0x1000553 ] }; + key <AD02> { [ ], [ 0x1000562, 0x1000532 ] }; + key <AD03> { [ ], [ 0x100057d, 0x100054d ] }; + key <AD04> { [ ], [ 0x1000574, 0x1000544 ] }; + key <AD05> { [ ], [ 0x1000578, 0x1000548 ] }; + key <AD06> { [ ], [ 0x1000582, 0x1000552 ] }; + key <AD07> { [ ], [ 0x100056f, 0x100053f ] }; + key <AD08> { [ ], [ 0x1000568, 0x1000538 ] }; + key <AD09> { [ ], [ 0x1000569, 0x1000539 ] }; + key <AD10> { [ ], [ 0x100056e, 0x100053e ] }; + key <AD11> { [ ], [ 0x1000585, 0x1000555 ] }; + key <AD12> { [ ], [ 0x1000586, 0x1000556 ] }; + + key <AC01> { [ ], [ 0x100057e, 0x100054e ] }; + key <AC02> { [ ], [ 0x1000563, 0x1000533 ] }; + key <AC03> { [ ], [ 0x1000565, 0x1000535 ] }; + key <AC04> { [ ], [ 0x1000561, 0x1000531 ] }; + key <AC05> { [ ], [ 0x1000576, 0x1000546 ] }; + key <AC06> { [ ], [ 0x100056b, 0x100053b ] }; + key <AC07> { [ ], [ 0x100057f, 0x100054f ] }; + key <AC08> { [ ], [ 0x1000570, 0x1000540 ] }; + key <AC09> { [ ], [ 0x100057a, 0x100054a ] }; + key <AC10> { [ ], [ 0x1000589, 0x100058a ] }; + key <AC11> { [ ], [ 0x100055b, 0x10002bc ] }; + + key <AB01> { [ ], [ 0x1000564, 0x1000534 ] }; + key <AB02> { [ ], [ 0x1000579, 0x1000549 ] }; + key <AB03> { [ ], [ 0x1000566, 0x1000536 ] }; + key <AB04> { [ ], [ 0x100056c, 0x100053c ] }; + key <AB05> { [ ], [ 0x1000584, 0x1000554 ] }; + key <AB06> { [ ], [ 0x100056d, 0x100053d ] }; + key <AB07> { [ ], [ 0x1000577, 0x1000547 ] }; + key <AB08> { [ ], [ comma, guillemotleft ] }; + key <AB09> { [ ], [ period, guillemotright ] }; + key <AB10> { [ ], [ 0x100055e, 0x1000530 ] }; + +}; + +xkb_symbols "phonetic" { + include "am(old)" + + key <BKSL> { [ ], [ 0x1000530, backslash ] }; + + key <AE01> { [ ], [ 0x1000567, 0x1000537 ] }; + key <AE02> { [ ], [ 0x1000569, 0x1000539 ] }; + key <AE03> { [ ], [ 0x1000583, 0x1000553 ] }; + key <AE05> { [ ], [ 0x100057b, 0x100054b ] }; + key <AE06> { [ ], [ parenright, parenleft ] }; + key <AE07> { [ ], [ 0x1000587, percent ] }; + key <AE08> { [ ], [ 0x100057c, 0x100054c ] }; + key <AE09> { [ ], [ 0x1000579, 0x1000549 ] }; + key <AE10> { [ ], [ 0x1000573, 0x1000543 ] }; + key <AE12> { [ ], [ 0x100056a, 0x100053a ] }; + + key <AD01> { [ ], [ 0x1000584, 0x1000554 ] }; + key <AD02> { [ ], [ 0x1000578, 0x1000548 ] }; + key <AD03> { [ ], [ 0x1000565, 0x1000535 ] }; + key <AD04> { [ ], [ 0x1000580, 0x1000550 ] }; + key <AD05> { [ ], [ 0x100057f, 0x100054f ] }; + key <AD06> { [ ], [ 0x1000568, 0x1000538 ] }; + key <AD07> { [ ], [ 0x1000582, 0x1000552 ] }; + key <AD08> { [ ], [ 0x100056b, 0x100053b ] }; + key <AD09> { [ ], [ 0x1000585, 0x1000555 ] }; + key <AD10> { [ ], [ 0x100057a, 0x100054a ] }; + key <AD11> { [ ], [ 0x100056d, 0x100053d ] }; + key <AD12> { [ ], [ 0x100056e, 0x100053e ] }; + + key <AC01> { [ ], [ 0x1000561, 0x1000531 ] }; + key <AC02> { [ ], [ 0x100057d, 0x100054d ] }; + key <AC03> { [ ], [ 0x1000564, 0x1000534 ] }; + key <AC04> { [ ], [ 0x1000586, 0x1000556 ] }; + key <AC05> { [ ], [ 0x1000563, 0x1000533 ] }; + key <AC06> { [ ], [ 0x1000570, 0x1000540 ] }; + key <AC07> { [ ], [ 0x1000575, 0x1000545 ] }; + key <AC08> { [ ], [ 0x100056f, 0x100053f ] }; + key <AC09> { [ ], [ 0x100056c, 0x100053c ] }; + key <AC10> { [ ], [ 0x1000589, 0x1002026 ] }; + + key <AB01> { [ ], [ 0x1000566, 0x1000536 ] }; + key <AB02> { [ ], [ 0x1000572, 0x1000542 ] }; + key <AB03> { [ ], [ 0x1000581, 0x1000551 ] }; + key <AB04> { [ ], [ 0x100057e, 0x100054e ] }; + key <AB05> { [ ], [ 0x1000562, 0x1000532 ] }; + key <AB06> { [ ], [ 0x1000576, 0x1000546 ] }; + key <AB07> { [ ], [ 0x1000574, 0x1000544 ] }; + key <AB10> { [ ], [ 0x1000577, 0x1000547 ] }; + }; Index: xc/programs/xkbcomp/symbols/ben diff -u xc/programs/xkbcomp/symbols/ben:1.1 xc/programs/xkbcomp/symbols/ben:1.2 --- xc/programs/xkbcomp/symbols/ben:1.1 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/ben Mon Feb 3 20:52:08 2003 @@ -1,6 +1,6 @@ // $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/ben,v 1.1 2001/11/21 22:28:52 dawes Exp $ -partial default alphanumeric_keys +// $XFree86: xc/programs/xkbcomp/symbols/ben,v 1.2 2003/02/04 01:52:08 dawes Exp $ +partial default alphanumeric_keys xkb_symbols "basic" { name[Group2]= "Bengali"; key <TLDE> { [], [ ] }; @@ -65,3 +65,77 @@ key <AB09> { [], [ period, 0x1000964 ] }; key <AB10> { [], [ 0x10009DF, 0x10009AF ] }; }; + +xkb_symbols "probhat" { + name[Group2]= "Bengali"; + key <ESC> { [], [ Escape ] }; + +// numbers + key <TLDE> { [], [ quoteleft, asciitilde ] }; + key <AE01> { [], [ 0x10009E7, exclam ] }; + key <AE02> { [], [ 0x10009E8, at ] }; + key <AE03> { [], [ 0x10009E9, numbersign ] }; + key <AE04> { [], [ 0x10009EA, 0x10009F3 ] }; + key <AE05> { [], [ 0x10009EB, percent ] }; + key <AE06> { [], [ 0x10009EC, asciicircum ] }; + key <AE07> { [], [ 0x10009ED, 0x100099E ] }; + key <AE08> { [], [ 0x10009EE, asterisk ] }; + key <AE09> { [], [ 0x10009EF, parenleft ] }; + key <AE10> { [], [ 0x10009E6, parenright ] }; + key <AE11> { [], [ minus, 0x1000983 ] }; + key <AE12> { [], [ 0x100098B, 0x10009C3 ] }; + key <BKSP> { [], [ BackSpace ] }; + +// tab, q to ] + key <TAB> { [], [ Tab, ISO_Left_Tab ] }; + key <AD01> { [], [ 0x10009A6, 0x10009A7 ] }; + key <AD02> { [], [ 0x10009C2, 0x100098A ] }; + key <AD03> { [], [ 0x10009C0, 0x1000988 ] }; + key <AD04> { [], [ 0x10009B0, 0x10009DC ] }; + key <AD05> { [], [ 0x100099F, 0x10009A0 ] }; + key <AD06> { [], [ 0x100098F, 0x1000990 ] }; + key <AD07> { [], [ 0x10009C1, 0x1000989 ] }; + key <AD08> { [], [ 0x10009BF, 0x1000987 ] }; + key <AD09> { [], [ 0x1000993, 0x1000994 ] }; + key <AD10> { [], [ 0x10009AA, 0x10009AB ] }; + key <AD11> { [], [ 0x10009C7, 0x10009C8 ] }; + key <AD12> { [], [ 0x10009CB, 0x10009CC ] }; + key <RTRN> { [], [ Return ] }; + +// caps, a to ' +// key <CAPS> { [], [ Caps_Lock ] }; + key <AC01> { [], [ 0x10009BE, 0x1000985 ] }; + key <AC02> { [], [ 0x10009B8, 0x10009B7 ] }; + key <AC03> { [], [ 0x10009A1, 0x10009A2 ] }; + key <AC04> { [], [ 0x10009A4, 0x10009A5 ] }; + key <AC05> { [], [ 0x1000997, 0x1000998 ] }; + key <AC06> { [], [ 0x10009B9, 0x1000983 ] }; + key <AC07> { [], [ 0x100099C, 0x100099D ] }; + key <AC08> { [], [ 0x1000995, 0x1000996 ] }; + key <AC09> { [], [ 0x10009B2, 0x1000982 ] }; + key <AC10> { [], [ semicolon, colon ] }; + key <AC11> { [], [ quoteright, quotedbl ] }; + +// shift, z to / +// key <LFSH> { [], [ Shift_L ] }; + key <AB01> { [], [ 0x10009DF, 0x10009AF ] }; + key <AB02> { [], [ 0x10009B6, 0x10009DD ] }; + key <AB03> { [], [ 0x100099A, 0x100099B ] }; + key <AB04> { [], [ 0x1000986, 0x100098B ] }; + key <AB05> { [], [ 0x10009AC, 0x10009AD ] }; + key <AB06> { [], [ 0x10009A8, 0x10009A3 ] }; + key <AB07> { [], [ 0x10009AE, 0x1000999 ] }; + key <AB08> { [], [ comma, 0x10009C3 ] }; + key <AB09> { [], [ period, 0x1000981 ] }; + key <AB10> { [], [ 0x10009CD, question ] }; + key <BKSL> { [], [ backslash, bar ] }; + +// key <LCTL> { [], [ Control_L ] }; +// key <SPCE> { [], [ space ] }; + +// modifier_map Shift { Shift_L }; +// modifier_map Lock { Caps_Lock }; +// modifier_map Control{ Control_L }; + +}; + Index: xc/programs/xkbcomp/symbols/bs diff -u /dev/null xc/programs/xkbcomp/symbols/bs:1.1 --- /dev/null Thu Feb 27 12:35:29 2003 +++ xc/programs/xkbcomp/symbols/bs Thu Dec 12 23:18:03 2002 @@ -0,0 +1,91 @@ +// Bosnian keyboards +// Amila Akagic, <bono@linux.org.ba> +// Zadnja promjena: 07.05.2002. +// $XFree86: xc/programs/xkbcomp/symbols/bs,v 1.1 2002/12/13 04:18:03 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + // Alphanumeric section + name[Group1]= "Bosnian"; + key <TLDE> { [ dead_cedilla, dead_diaeresis ] }; + key <AE01> { [ 1, exclam ], + [ asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl ], + [ dead_caron, caron ] }; + key <AE03> { [ 3, numbersign ], + [ asciicircum, dead_circumflex ] }; + key <AE04> { [ 4, dollar ], + [ dead_breve, breve ] }; + key <AE05> { [ 5, percent ], + [ degree, dead_abovering ] }; + key <AE06> { [ 6, ampersand ], + [ dead_ogonek, ogonek ] }; + key <AE07> { [ 7, slash ], + [ quoteleft, dead_grave ] }; + key <AE08> { [ 8, parenleft ], + [ dead_abovedot, abovedot ] }; + key <AE09> { [ 9, parenright ], + [ dead_acute, quoteright ] }; + key <AE10> { [ 0, equal ], + [ dead_doubleacute, doubleacute ] }; + key <AE11> { [ apostrophe, question ], + [ dead_diaeresis, diaeresis ] }; + key <AE12> { [ plus, asterisk ], + [ dead_cedilla, cedilla ] }; + + key <AD01> { [ q, Q ], + [ backslash ] }; + key <AD02> { [ w, W ], + [ bar ] }; + key <AD03> { [ e, E ], + [ EuroSign ] }; + key <AD05> { [ t, T ] }; + key <AD06> { [ z, Z ] }; + key <AD07> { [ u, U ] }; + key <AD08> { [ i, I ] }; + key <AD11> { [ scaron, Scaron ], + [ division ] }; + key <AD12> { [ dstroke, Dstroke ], + [ multiply, dead_macron ] }; + key <AC04> { [ f, F ], + [ bracketleft ] }; + key <AC05> { [ g, G ], + [ bracketright ] }; + key <AC08> { [ k, K ], + [ lstroke ] }; + key <AC09> { [ l, L ], + [ Lstroke ] }; + key <AC10> { [ ccaron, Ccaron ] }; + key <AC11> { [ cacute, Cacute ], + [ ssharp ] }; + + key <LSGT> { [ less, greater ], + [ bar ] }; + key <AB01> { [ y, Y ] }; + key <AB04> { [ v, V ], + [ at ] }; + key <AB05> { [ b, B ], + [ braceleft ] }; + key <AB06> { [ n, N ], + [ braceright ] }; + key <AB07> { [ m, M ], + [ section ] }; + key <AB08> { [ comma, semicolon ] }; + key <AB09> { [ period, colon ], + [ periodcentered ] }; + key <AB10> { [ minus, underscore ] }; + key <BKSL> { [ zcaron, Zcaron ], + [ currency ] }; + key <RALT> { [ Mode_switch, Multi_key ] }; + + // End alphanumeric section + + // begin modifier mappings + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; + + Index: xc/programs/xkbcomp/symbols/cz diff -u xc/programs/xkbcomp/symbols/cz:1.3 xc/programs/xkbcomp/symbols/cz:1.4 --- xc/programs/xkbcomp/symbols/cz:1.3 Mon Oct 1 09:44:16 2001 +++ xc/programs/xkbcomp/symbols/cz Mon Sep 16 14:06:21 2002 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/symbols/cz,v 1.3 2001/10/01 13:44:16 eich Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/cz,v 1.4 2002/09/16 18:06:21 eich Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -125,10 +125,14 @@ key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; - // This certainly shouldn't be 'comma'. Something like KP_DecimalComma - // would be better but there's no such definition in keysyms. - key <KPDL> { type="FOUR_LEVEL_KEYPAD", [ KP_Delete, comma, - KP_Delete, KP_Decimal] }; +// KP_Separator should produce a comma as KP_Decimal produces a "." +// independent of the locale selected. + key <KPDL> { type="FOUR_LEVEL_KEYPAD", [ KP_Delete, KP_Separator, + KP_Delete, KP_Decimal], + // hack a decimal dot into the second (US) group + // Martin Vidner <mvidner@suse.cz> + [ KP_Delete, KP_Decimal, + KP_Delete, KP_Separator] }; key <RALT> { type="TWO_LEVEL", [ ISO_Level3_Shift, ISO_Level3_Shift ] }; modifier_map Mod5 { <RALT> }; Index: xc/programs/xkbcomp/symbols/czsk diff -u xc/programs/xkbcomp/symbols/czsk:1.7 xc/programs/xkbcomp/symbols/czsk:1.9 --- xc/programs/xkbcomp/symbols/czsk:1.7 Thu Oct 4 09:12:05 2001 +++ xc/programs/xkbcomp/symbols/czsk Mon Feb 3 21:32:48 2003 @@ -10,7 +10,7 @@ // // This file is distributed without any expressed or implied warranty. // -// $XFree86: xc/programs/xkbcomp/symbols/czsk,v 1.7 2001/10/04 13:12:05 alanh Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/czsk,v 1.9 2003/02/04 02:32:48 dawes Exp $ partial default alphanumeric_keys xkb_symbols "us_sk_qwerty" { @@ -160,13 +160,17 @@ xkb_symbols "def_basic" { include "group(shift_toggle)" + include "srvr_ctrl(xfree86)" // Alphanumeric keys identical to US key <ESC> { [ Escape ], [ Escape ] }; - key <BKSP> { [ BackSpace ], - [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; + key <TLDE> { [ grave, asciitilde ], [ grave, asciitilde ] }; Index: xc/programs/xkbcomp/symbols/de diff -u xc/programs/xkbcomp/symbols/de:3.10 xc/programs/xkbcomp/symbols/de:3.12 --- xc/programs/xkbcomp/symbols/de:3.10 Mon Oct 1 10:04:15 2001 +++ xc/programs/xkbcomp/symbols/de Mon Nov 25 09:05:06 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/de,v 3.10 2001/10/01 14:04:15 eich Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/de,v 3.12 2002/11/25 14:05:06 eich Exp $ default partial alphanumeric_keys xkb_symbols "basic" { @@ -71,7 +71,9 @@ [ dead_grave ] }; key <RALT> { [ Mode_switch, Multi_key ] }; - // End alphanumeric section + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Separator ] }; + // End "Keypad" section // begin modifier mappings modifier_map Shift { Shift_L }; @@ -86,7 +88,7 @@ include "de(basic)" key <TLDE> { [ asciicircum, degree ], [ notsign ] }; - key <AE12> { [ acute, grave ], + key <AE12> { [ apostrophe, grave ], [ cedilla ] }; key <AD11> { [ udiaeresis, Udiaeresis ], [ diaeresis ] }; Index: xc/programs/xkbcomp/symbols/de_CH diff -u xc/programs/xkbcomp/symbols/de_CH:3.5 xc/programs/xkbcomp/symbols/de_CH:3.6 --- xc/programs/xkbcomp/symbols/de_CH:3.5 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/de_CH Mon Nov 25 09:05:06 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/de_CH,v 3.5 2001/01/17 23:45:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/de_CH,v 3.6 2002/11/25 14:05:06 eich Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -56,7 +56,10 @@ key <AB09> { [ period, colon ] }; key <AB10> { [ minus, underscore ] }; - // End alphanumeric section + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Decimal ] }; + // End "Keypad" section + // begin modifier mappings modifier_map Shift { Shift_L }; Index: xc/programs/xkbcomp/symbols/dk diff -u xc/programs/xkbcomp/symbols/dk:3.6 xc/programs/xkbcomp/symbols/dk:3.7 --- xc/programs/xkbcomp/symbols/dk:3.6 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/dk Wed Dec 18 20:07:54 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/dk,v 3.6 2001/01/17 23:45:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/dk,v 3.7 2002/12/19 01:07:54 dawes Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -75,7 +75,9 @@ [ dead_tilde, dead_caron ]}; - // End alphanumeric section + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Separator ] }; + // End "Keypad" section // begin modifier mappings Index: xc/programs/xkbcomp/symbols/dvorak diff -u xc/programs/xkbcomp/symbols/dvorak:3.6 xc/programs/xkbcomp/symbols/dvorak:3.9 --- xc/programs/xkbcomp/symbols/dvorak:3.6 Mon Apr 23 16:31:09 2001 +++ xc/programs/xkbcomp/symbols/dvorak Mon Feb 3 21:32:48 2003 @@ -6,11 +6,12 @@ // uses the punctuation keys configurations common on PC // keyboards (e.g. key <ABO9> is { [ period greater ] }) -// $XFree86: xc/programs/xkbcomp/symbols/dvorak,v 3.6 2001/04/23 20:31:09 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/dvorak,v 3.9 2003/02/04 02:32:48 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { + include "srvr_ctrl(xfree86)" name[Group1]= "Dvorak"; key <ESC> { [ Escape ] }; @@ -34,7 +35,10 @@ key <AE11> { [ bracketleft, braceleft ] }; key <AE12> { [ bracketright, braceright ], [ dead_tilde ] }; - key <BKSP> { [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; key <TAB> { [ Tab, ISO_Left_Tab ] }; key <AD01> { [ apostrophe, quotedbl ], @@ -172,3 +176,44 @@ [ bar, backslash ] }; }; + +// Swedish Dvorak +partial alphanumeric_keys +xkb_symbols "se" { + include "dvorak(no)" + + key <TLDE> { [ section, onehalf ] }; + + key <AE04> { [ 4, currency ], + [ dollar, onequarter ] }; + key <AE11> { [ plus, question ], + [ backslash, questiondown ] }; + key <AE12> { [ dead_acute, dead_grave ], + [ backslash, grave ] }; + + key <AD01> { [ odiaeresis, Odiaeresis ], + [ braceright, bracketright ] }; + key <AD02> { [ aring, Aring ] }; + key <AD03> { [ adiaeresis, Adiaeresis ] }; + key <AD11> { [ q, Q ] }; + key <AD12> { [ dead_diaeresis, dead_circumflex], + [ dead_tilde, asciicircum ] }; + + key <AB01> { [ comma, semicolon ], + [ dead_cedilla, cedilla ] }; + key <AB02> { [ period, colon ], + [ periodcentered ] }; + + key <BKSL> { [ less, greater ], + [ bar, brokenbar ] }; + + key <LSGT> { [ apostrophe, asterisk ], + [ bar, backslash ] }; + +}; +// Swedish Dvorak alias +partial alphanumeric_keys +xkb_symbols "sv" { + include "dvorak(se)" +}; + Index: xc/programs/xkbcomp/symbols/el diff -u xc/programs/xkbcomp/symbols/el:1.2 xc/programs/xkbcomp/symbols/el:1.3 --- xc/programs/xkbcomp/symbols/el:1.2 Fri Apr 6 13:44:58 2001 +++ xc/programs/xkbcomp/symbols/el Mon Jun 3 18:19:48 2002 @@ -1,12 +1,17 @@ -// $XFree86: xc/programs/xkbcomp/symbols/el,v 1.2 2001/04/06 17:44:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/el,v 1.3 2002/06/03 22:19:48 dawes Exp $ // +// Hellenic keyboard map for XFree86 +// Original version: +// Kostas Gewrgiou <gewrgiou@imbc.gr> +// Heavily modified by: +// Vasilis Vasaitis <vvas@hal.csd.auth.gr> default partial alphanumeric_keys alternate_group xkb_symbols "basic" { include "el(bare)" - key <TLDE> { [], [ quoteleft, asciitilde ] }; + key <TLDE> { [], [ grave, asciitilde ] }; key <AE01> { [], [ 1, exclam ] }; key <AE02> { [], [ 2, at ] }; key <AE03> { [], [ 3, numbersign ] }; @@ -23,7 +28,7 @@ key <AD11> { [], [ bracketleft, braceleft ] }; key <AD12> { [], [ bracketright, braceright ] }; - key <AC11> { [], [ quoteright, quotedbl ] }; + key <AC11> { [], [ apostrophe, quotedbl ] }; key <AB08> { [], [ comma, less ] }; key <AB09> { [], [ period, greater ] }; @@ -37,41 +42,85 @@ name[Group2] = "ISO8859-7"; - key <AD01> { [], [ semicolon, colon ] }; - key <AD02> { [], [ Greek_finalsmallsigma, Greek_SIGMA ] }; - key <AD03> { [], [ Greek_epsilon, Greek_EPSILON ] }; - key <AD04> { [], [ Greek_rho, Greek_RHO ] }; - key <AD05> { [], [ Greek_tau, Greek_TAU ] }; - key <AD06> { [], [ Greek_upsilon, Greek_UPSILON ] }; - key <AD07> { [], [ Greek_theta, Greek_THETA ] }; - key <AD08> { [], [ Greek_iota, Greek_IOTA ] }; - key <AD09> { [], [ Greek_omicron, Greek_OMICRON ] }; - key <AD10> { [], [ Greek_pi, Greek_PI ] }; - - key <AC01> { [], [ Greek_alpha, Greek_ALPHA ] }; - key <AC02> { [], [ Greek_sigma, Greek_SIGMA ] }; - key <AC03> { [], [ Greek_delta, Greek_DELTA ] }; - key <AC04> { [], [ Greek_phi, Greek_PHI ] }; - key <AC05> { [], [ Greek_gamma, Greek_GAMMA ] }; - key <AC06> { [], [ Greek_eta, Greek_ETA ] }; - key <AC07> { [], [ Greek_xi, Greek_XI ] }; - key <AC08> { [], [ Greek_kappa, Greek_KAPPA ] }; - key <AC09> { [], [ Greek_lamda, Greek_LAMDA ] }; - key <AC10> { [], [ dead_acute, dead_diaeresis ] }; - - key <AB01> { [], [ Greek_zeta, Greek_ZETA ] }; - key <AB02> { [], [ Greek_chi, Greek_CHI ] }; - key <AB03> { [], [ Greek_psi, Greek_PSI ] }; - key <AB04> { [], [ Greek_omega, Greek_OMEGA ] }; - key <AB05> { [], [ Greek_beta, Greek_BETA ] }; - key <AB06> { [], [ Greek_nu, Greek_NU ] }; - key <AB07> { [], [ Greek_mu, Greek_MU ] }; + key <AD01> { [], [ semicolon, colon ] }; + key <AD02> { [], [ Greek_finalsmallsigma, Greek_SIGMA ] }; + key <AD03> { [], [ Greek_epsilon, Greek_EPSILON ] }; + key <AD04> { [], [ Greek_rho, Greek_RHO ] }; + key <AD05> { [], [ Greek_tau, Greek_TAU ] }; + key <AD06> { [], [ Greek_upsilon, Greek_UPSILON ] }; + key <AD07> { [], [ Greek_theta, Greek_THETA ] }; + key <AD08> { [], [ Greek_iota, Greek_IOTA ] }; + key <AD09> { [], [ Greek_omicron, Greek_OMICRON ] }; + key <AD10> { [], [ Greek_pi, Greek_PI ] }; + + key <AC01> { [], [ Greek_alpha, Greek_ALPHA ] }; + key <AC02> { [], [ Greek_sigma, Greek_SIGMA ] }; + key <AC03> { [], [ Greek_delta, Greek_DELTA ] }; + key <AC04> { [], [ Greek_phi, Greek_PHI ] }; + key <AC05> { [], [ Greek_gamma, Greek_GAMMA ] }; + key <AC06> { [], [ Greek_eta, Greek_ETA ] }; + key <AC07> { [], [ Greek_xi, Greek_XI ] }; + key <AC08> { [], [ Greek_kappa, Greek_KAPPA ] }; + key <AC09> { [], [ Greek_lamda, Greek_LAMDA ] }; + key <AC10> { [], [ dead_acute, dead_diaeresis ] }; + + key <AB01> { [], [ Greek_zeta, Greek_ZETA ] }; + key <AB02> { [], [ Greek_chi, Greek_CHI ] }; + key <AB03> { [], [ Greek_psi, Greek_PSI ] }; + key <AB04> { [], [ Greek_omega, Greek_OMEGA ] }; + key <AB05> { [], [ Greek_beta, Greek_BETA ] }; + key <AB06> { [], [ Greek_nu, Greek_NU ] }; + key <AB07> { [], [ Greek_mu, Greek_MU ] }; - key <LSGT> { [], [ guillemotleft, guillemotright ] }; + key <LSGT> { [], [ guillemotleft, guillemotright ] }; }; partial alphanumeric_keys alternate_group +xkb_symbols "extended" { + + include "el(basic)" + + key.type = "THREE_LEVEL"; + + key <AE05> { [ 5, percent, EuroSign ], + [ 5, percent, EuroSign ] }; + + key <AD01> { [], [ semicolon, colon, periodcentered ] }; + + key <AD03> { [ e, E, EuroSign ], + [ Greek_epsilon, Greek_EPSILON, EuroSign ] }; + + key <AC10> { [ semicolon, colon, periodcentered ] }; + + key <AB08> { [ comma, less, guillemotleft ], + [ comma, less, guillemotleft ] }; + + key <AB09> { [ period, greater, guillemotright ], + [ period, greater, guillemotright ] }; + + key <RALT> { [ ISO_Level3_Shift ] }; + + modifier_map Mod5 { ISO_Level3_Shift }; + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "polytonic" { + + include "el(extended)" + + key.type = "THREE_LEVEL"; + + key <AD11> { [], [ dead_tilde, dead_diaeresis, dead_macron ] }; + key <AD12> { [], [ dead_iota, VoidSymbol, dead_breve ] }; + + key <AC10> { [], [ dead_acute, dead_horn ] }; + key <AC11> { [], [ dead_grave, dead_ogonek ] }; + +}; + +partial alphanumeric_keys alternate_group xkb_symbols "Sundeadkeys" { include "el(basic)" @@ -90,7 +139,7 @@ include "el(basic)" - key <AC10> { [], [ semicolon, colon ] }; + key <AC10> { [], [ semicolon, colon ] }; }; Index: xc/programs/xkbcomp/symbols/fi diff -u xc/programs/xkbcomp/symbols/fi:3.6 xc/programs/xkbcomp/symbols/fi:3.10 --- xc/programs/xkbcomp/symbols/fi:3.6 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/fi Sat Jan 25 21:48:28 2003 @@ -1,25 +1,25 @@ // $Xorg: fi,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/fi,v 3.10 2003/01/26 02:48:28 dawes Exp $ - -// $XFree86: xc/programs/xkbcomp/symbols/fi,v 3.6 2001/01/17 23:45:58 dawes Exp $ - partial alphanumeric_keys xkb_symbols "basic" { - // Describes the differences between a very simple en_US + // Describes the differences between a very simple en_US // keyboard and a Finnish keyboard with dead key support - // and all of ISO-8859-1 characters available. + // and all of ISO-8859-1 and ISO-8859-15 characters available. - name[Group1]= "Finnish"; + name[Group1]= "Finnish"; key <TLDE> { [ section, onehalf ], - [ paragraph, threequarters ]}; + [ onequarter, threequarters ]}; key <LSGT> { [ less, greater ], [ bar, brokenbar ]}; + // AltGr+<SPCE> is pressed accidentally too often after AltGr+<LSGT>, + // hence AltGr+<SPCE> produces now space, not nobreakspace. key <SPCE> { [ space, space ], - [ nobreakspace, nobreakspace ]}; + [ space, nobreakspace ]}; key <AE01> { [ 1, exclam ], [ exclamdown, onesuperior ]}; key <AE02> { [ 2, quotedbl ], @@ -27,13 +27,13 @@ key <AE03> { [ 3, numbersign ], [ sterling, threesuperior ]}; key <AE04> { [ 4, currency ], - [ dollar, onequarter ]}; + [ dollar, cent ]}; key <AE05> { [ 5, percent ], - [ NoSymbol, cent ]}; + [ EuroSign, masculine ]}; key <AE06> { [ 6, ampersand ], - [ yen, NoSymbol ]}; + [ yen, ordfeminine ]}; key <AE07> { [ 7, slash ], - [ braceleft, division ]}; + [ braceleft, plusminus ]}; key <AE08> { [ 8, parenleft ], [ bracketleft, guillemotleft ]}; key <AE09> { [ 9, parenright ], @@ -43,13 +43,23 @@ key <AB08> { [ comma, semicolon ], [ dead_cedilla, dead_ogonek ]}; key <AB09> { [ period, colon ], - [ periodcentered, dead_abovedot ]}; + [ periodcentered, notsign ]}; + key <AB01> { [ z, Z ], + [ zcaron, Zcaron ]}; + key <AB02> { [ x, X ], + [ multiply, division ]}; key <AB03> { [ c, C ], - [ copyright, NoSymbol ]}; + [ copyright, cent ]}; + key <AB05> { [ b, B ], + [ ssharp, NoSymbol ]}; + key <AB06> { [ n, N ], + [ ntilde, Ntilde ]}; + key <AB07> { [ m, M ], + [ mu, NoSymbol ]}; key <AB10> { [ minus, underscore ], [ hyphen, macron ]}; - key <AC01> { [ a, A ], - [ ordfeminine, masculine ]}; + key <AC02> { [ s, S ], + [ scaron, Scaron ]}; key <AC03> { [ d, D ], [ eth, ETH ]}; key <AD03> { [ e, E ], @@ -58,10 +68,8 @@ [ registered, NoSymbol ]}; key <AD05> { [ t, T ], [ thorn, THORN ]}; - key <AD08> { [ i, I ], - [ NoSymbol, NoSymbol ]}; - key <AD09> { [ o, O ], - [ oe, OE ]}; + key <AD10> { [ p, P ], + [ paragraph, NoSymbol ]}; key <AC10> { [ odiaeresis, Odiaeresis ], [ oslash, Ooblique ]}; key <AE11> { [ plus, question ], @@ -69,27 +77,29 @@ key <AC11> { [ adiaeresis, Adiaeresis ], [ ae, AE ]}; key <BKSL> { [ apostrophe, asterisk ], - [ acute, multiply ]}; - key <AD11> { [ aring, Aring ]}; + [ NoSymbol, NoSymbol ]}; + key <AD11> { [ aring, Aring ], + [ oe, OE ]}; key <AE12> { [ dead_acute, dead_grave ], - [ plusminus, notsign ]}; + [ NoSymbol, NoSymbol ]}; key <AD12> { [ dead_diaeresis, dead_circumflex ], [ dead_tilde, dead_caron ]}; + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Separator ] }; + // End "Keypad" section - // End alphanumeric section - - // begin modifier mappings + // Begin modifier mappings - modifier_map Shift { Shift_L }; - modifier_map Lock { Caps_Lock }; - modifier_map Control{ Control_L }; - modifier_map Mod3 { Mode_switch }; + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control { Control_L }; + modifier_map Mod3 { Mode_switch }; }; partial alphanumeric_keys xkb_symbols "Sundeadkeys" { - include "fi(basic)" // for consistent naming + include "fi(basic)" // for consistent naming }; partial alphanumeric_keys @@ -99,6 +109,14 @@ partial alphanumeric_keys xkb_symbols "nodeadkeys" { - include "fi(basic)" // for consistent naming + // Modifies the basic Finnish layout to eliminate all dead keys + + include "fi(basic)" // for consistent naming + + key <AB08> { [ comma, semicolon ], + [ cedilla, ogonek ]}; + key <AE12> { [ acute, grave ], + [ NoSymbol, NoSymbol ]}; + key <AD12> { [ diaeresis, asciicircum ], + [ asciitilde, caron ]}; }; - Index: xc/programs/xkbcomp/symbols/gb diff -u xc/programs/xkbcomp/symbols/gb:3.4 xc/programs/xkbcomp/symbols/gb:3.5 --- xc/programs/xkbcomp/symbols/gb:3.4 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/gb Thu Dec 12 23:18:03 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/gb,v 3.4 2001/01/17 23:45:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/gb,v 3.5 2002/12/13 04:18:03 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -22,6 +22,8 @@ [ bar, brokenbar ] }; key <AE02> { [ 2, quotedbl ] }; key <AE03> { [ 3, sterling ] }; + key <AE04> { [ 4, dollar ], + [ EuroSign ] }; key <AC11> { [ apostrophe, at ] }; key <BKSL> { [ numbersign, asciitilde ] }; Index: xc/programs/xkbcomp/symbols/group diff -u xc/programs/xkbcomp/symbols/group:3.6 xc/programs/xkbcomp/symbols/group:3.8 --- xc/programs/xkbcomp/symbols/group:3.6 Fri Aug 17 09:27:58 2001 +++ xc/programs/xkbcomp/symbols/group Sun Jan 19 22:48:39 2003 @@ -2,7 +2,7 @@ // using the group(switch) map, the right alt key temporarily chooses // the second keyboard group (until it is released). // -// $XFree86: xc/programs/xkbcomp/symbols/group,v 3.6 2001/08/17 13:27:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/group,v 3.8 2003/01/20 03:48:39 dawes Exp $ partial modifier_keys xkb_symbols "switch" { key <RALT> { @@ -11,6 +11,18 @@ }; }; +// using the group(lswitch) map, the left alt key temporarily chooses +// the second keyboard group (until it is released). +// +partial modifier_keys +xkb_symbols "lswitch" { + key <LALT> { + symbols[Group1]= [ Mode_switch, Multi_key ], + virtualMods= AltGr + }; +}; + + // using the group(win_switch) map, both Windows'logo keys temporarily // choose the second keyboard group (until release). If you use this // map, you would declare you keyboard as pc101 or pc102 instead of @@ -180,5 +192,85 @@ key <RWIN> { virtualMods= AltGr, symbols[Group1] = [ ISO_Next_Group ] + }; +}; + +// Both Ctrls pressed together toggle group +partial modifier_keys +xkb_symbols "ctrls_toggle" { + virtual_modifiers AltGr; + key <LCTL> { + type="PC_BREAK", + symbols[Group1]= [ NoSymbol, ISO_Next_Group ] + }; + key <RCTL> { + type="PC_BREAK", + symbols[Group1]= [ NoSymbol, ISO_Next_Group ] + }; +}; + +// Both Alts pressed together toggle group +partial modifier_keys +xkb_symbols "alts_toggle" { + virtual_modifiers AltGr; + key <LALT> { + type="PC_SYSRQ", + symbols[Group1]= [ NoSymbol, ISO_Prev_Group ], + virtualMods= Alt + }; + key <RALT> { + type="PC_SYSRQ", + symbols[Group1]= [ NoSymbol, ISO_Next_Group ], + virtualMods= Alt + }; +}; + +// Left Shift key toggles group +partial modifier_keys +xkb_symbols "lshift_toggle" { + virtual_modifiers AltGr; + key <LFSH> { + symbols[Group1]= [ ISO_Next_Group ], + virtualMods= AltGr + }; +}; + +// Right Shift key toggles group +partial modifier_keys +xkb_symbols "rshift_toggle" { + virtual_modifiers AltGr; + key <RTSH> { + symbols[Group1]= [ ISO_Next_Group ], + virtualMods= AltGr + }; +}; + +// Left Alt key toggles group +partial modifier_keys +xkb_symbols "lalt_toggle" { + virtual_modifiers AltGr; + key <LALT> { + symbols[Group1]= [ ISO_Next_Group ], + virtualMods= AltGr + }; +}; + +// Left Ctrl key toggles group +partial modifier_keys +xkb_symbols "lctrl_toggle" { + virtual_modifiers AltGr; + key <LCTL> { + symbols[Group1]= [ ISO_Next_Group ], + virtualMods= AltGr + }; +}; + +// Right Ctrl key toggles group +partial modifier_keys +xkb_symbols "rctrl_toggle" { + virtual_modifiers AltGr; + key <RCTL> { + symbols[Group1]= [ ISO_Next_Group ], + virtualMods= AltGr }; }; Index: xc/programs/xkbcomp/symbols/hu diff -u xc/programs/xkbcomp/symbols/hu:1.5 xc/programs/xkbcomp/symbols/hu:1.7 --- xc/programs/xkbcomp/symbols/hu:1.5 Thu Apr 26 12:23:13 2001 +++ xc/programs/xkbcomp/symbols/hu Thu Dec 12 23:18:03 2002 @@ -1,6 +1,6 @@ // Hungarian keyboard symbols for XKB and PC keyboard // -// (C) 2001 Peter Soos <sp@osb.hu> +// (C) 2002 Peter Soos <sp@osb.hu> // // Permission is granted to anyone to use, distribute and modify // this file in any way, provided that the above copyright notice @@ -13,7 +13,7 @@ // layout and some widely used Hungarian keyboard layouts. // Tested on Linux with XFree86 3.3.6 // -// $XFree86: xc/programs/xkbcomp/symbols/hu,v 1.5 2001/04/26 16:23:13 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/hu,v 1.7 2002/12/13 04:18:03 dawes Exp $ // Default layout @@ -260,6 +260,8 @@ hidden partial alphanumeric_keys xkb_symbols "def_uni" { + key <AD07> { [ u, U ], + [ EuroSign ] }; key <AC02> { [ s, S ], [ dstroke ] }; key <AC03> { [ d, D ], @@ -305,8 +307,6 @@ xkb_symbols "def_102" { key <TLDE> { [ 0, section ], [ notsign ] }; - key <AB07> { [ m, M ] }; - key <AB09> { [ period, colon ] }; }; // def_101: @@ -316,10 +316,6 @@ xkb_symbols "def_101" { key <TLDE> { [ iacute, Iacute ], [ 0, section ] }; - key <AB07> { [ m, M ], - [ less ] }; - key <AB09> { [ period, colon ], - [ greater ] }; }; // def_qwertz: @@ -420,9 +416,12 @@ [ braceleft ] }; key <AB06> { [ n, N ], [ braceright ] }; + key <AB07> { [ m, M ], + [ less ] }; key <AB08> { [ comma, question ], [ semicolon ] }; - key <AB09> { [ period, colon ] }; + key <AB09> { [ period, colon ], + [ greater ] }; key <AB10> { [ minus, underscore ], [ asterisk ] }; key <RALT> { [ Mode_switch, Multi_key ] }; Index: xc/programs/xkbcomp/symbols/hu_qwerty diff -u /dev/null xc/programs/xkbcomp/symbols/hu_qwerty:1.1 --- /dev/null Thu Feb 27 12:35:30 2003 +++ xc/programs/xkbcomp/symbols/hu_qwerty Thu Apr 4 09:05:59 2002 @@ -0,0 +1,9 @@ +// Hungarian keyboard symbols for XKB and 101-key qwerty PC keyboard +// +// +// Check also ../rules/xfree86.lst + +default partial +xkb_symbols "default" { + include "hu(uni_101_qwerty_comma)" +}; Index: xc/programs/xkbcomp/symbols/ie diff -u /dev/null xc/programs/xkbcomp/symbols/ie:1.3 --- /dev/null Thu Feb 27 12:35:30 2003 +++ xc/programs/xkbcomp/symbols/ie Mon Dec 30 21:07:04 2002 @@ -0,0 +1,262 @@ +// $XFree86: xc/programs/xkbcomp/symbols/ie,v 1.3 2002/12/31 02:07:04 dawes Exp $ + +// Irish keyboard map + +// Support for Irish (old and new orthography) and English +// Seamus O Ciardhuain <seoc@cnds.ucd.ie> (19 December 2002) + +// The general idea is to provide the characters in ISO 8859-1, +// ISO 8859-15, ISO 8859-14, CP1252 and "Extended Latin-8". +// However, not all are accessible directly because there aren't +// enough keys; some need deadkeys to access them, others the +// "Multi_key" compose sequences. + +// Designed to be similar to the layouts used on Windows +// and the Macintosh. + +// Everything is in Group 1 to be compatible with the +// multi-layout keyboard support in XFree86 4.3. + +// The basic layout is a modern keyboard, but dotted consonants are +// accessible using a deadkey (AltGr+H or AltGr+W). +// If a proper Clo Gaelach keyboard is needed, then use the layout +// defined below as ie(CloGaelach), which gives dotted consonants +// without use of a deadkey. + + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Modern keyboard for Irish and English + // - acute-accented vowels as AltGr+vowel and AltGr+Shift+vowel + // - euro currency sign as AltGr+4 + // - Comhartha Agus (Tironian Sign Et) as AltGr+Shift+7 + // - non-breaking space as AltGr+Space and AltGr+Shift+Space + // - matches hardware (keys and engraved symbols) for Irish keyboards + + name[Group1] = "Irish"; + + key.type[Group1] = "FOUR_LEVEL_ALPHABETIC"; + + // + // Numeric row `1234567890-= + // + key <TLDE> { [ grave, notsign, brokenbar, NoSymbol ] }; + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, quotedbl, trademark, twosuperior ] }; + key <AE03> { [ 3, sterling, copyright, threesuperior ] }; + key <AE04> { [ 4, dollar, EuroSign, cent ] }; + key <AE05> { [ 5, percent, section, dagger ] }; + key <AE06> { [ 6, asciicircum, dead_circumflex, 0x1002030 ] }; + // per thousand + key <AE07> { [ 7, ampersand, paragraph, 0x100204A ] }; + // Tironian Et + key <AE08> { [ 8, asterisk, dead_diaeresis, enfilledcircbullet ] }; + key <AE09> { [ 9, parenleft, ordfeminine, periodcentered ] }; + key <AE10> { [ 0, parenright, masculine, degree ] }; + key <AE11> { [ minus, underscore, endash, emdash ] }; + key <AE12> { [ equal, plus, notequal, plusminus ] }; + + // + // QWERTYUIOP[] + // + key <AD01> { [ q, Q, oe, OE ] }; + key <AD02> { [ w, W, dead_abovedot, dead_abovedot ] }; + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD04> { [ r, R, registered, 0x1002030 ] }; + // per thousand + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, yen, mu ] }; + key <AD07> { [ u, U, uacute, Uacute ] }; + key <AD08> { [ i, I, iacute, Iacute ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + key <AD10> { [ p, P, singlelowquotemark, NoSymbol ] }; + key <AD11> { [ bracketleft, braceleft, leftdoublequotemark, rightdoublequotemark ] }; + key <AD12> { [ bracketright, braceright, leftsinglequotemark, rightsinglequotemark ] }; + + // + // ASDFGHJKL;'# + // + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ s, S, ssharp, NoSymbol ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, 0x1000192, NoSymbol ] }; + // f with hook + key <AC05> { [ g, G, copyright, NoSymbol ] }; + key <AC06> { [ h, H, dead_abovedot, dead_abovedot ] }; + key <AC07> { [ j, J, idotless, onequarter ] }; + key <AC08> { [ k, K, dead_abovering, onehalf ] }; + key <AC09> { [ l, L, acute, threequarters ] }; + key <AC10> { [ semicolon, colon, ellipsis, doubledagger ] }; + key <AC11> { [ apostrophe, at, ae, AE ] }; + key <BKSL> { [ numbersign, asciitilde, guillemotleft, guillemotright ] }; + + + // + // \ZXCVBNM,./ + // + key <LSGT> { [ backslash, bar, dead_grave, dead_acute ] }; + key <AB01> { [ z, Z, leftanglebracket, rightanglebracket ] }; + key <AB02> { [ x, X, multiply, approximate ] }; + key <AB03> { [ c, C, dead_cedilla, cedilla ] }; + key <AB04> { [ v, V, dead_caron, NoSymbol ] }; + key <AB05> { [ b, B, diaeresis, NoSymbol ] }; + key <AB06> { [ n, N, dead_tilde, NoSymbol ] }; + key <AB07> { [ m, M, macron, NoSymbol ] }; + key <AB08> { [ comma, less, lessthanequal, doublelowquotemark ] }; + key <AB09> { [ period, greater, greaterthanequal, singlelowquotemark ] }; + key <AB10> { [ slash, question, division, questiondown ] }; + + + key <SPCE> { type[Group1]="FOUR_LEVEL", + [ space, space, nobreakspace, nobreakspace ] }; + + key <RALT> { type[Group1]="ONE_LEVEL", [ ISO_Level3_Shift ] }; + modifier_map Mod5 { ISO_Level3_Shift }; + + // NB: putting Shift+<RALT> as Multi_key gives odd behaviour since the + // order of pressing keys affects the result. + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "laptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ie(basic)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "CloGaelach" { + + // Adds support for Clo Gaelach (old orthography for Irish). + // Changes from "basic": + // - dotted consonants as AltGr+consonant or AltGr+Shift+consonant (TPSDFGCBM) + // - long lowercase r as AltGr+R + // - long lowercase s as AltGr+Z + // - long lowercase s dotted as AltGr+Shift+Z + // - some symbols moved around to retain them + // - several characters unlikely to be used are lost + // The long letters are needed only where the font provides + // both the long and short forms as different glyphs. + + include "ie(basic)" + + name[Group1] = "Irish (Clo Gaelach)"; + + key <TLDE> { [ grave, notsign, brokenbar, ssharp ] }; + key <AD04> { [ r, R, 0x100027C, registered ] }; + // long r + key <AD05> { [ t, T, tabovedot, Tabovedot ] }; + key <AD10> { [ p, P, pabovedot, Pabovedot ] }; + + key <AC02> { [ s, S, sabovedot, Sabovedot ] }; + key <AC03> { [ d, D, dabovedot, Dabovedot ] }; + key <AC04> { [ f, F, fabovedot, Fabovedot ] }; + key <AC05> { [ g, G, gabovedot, Gabovedot ] }; + + key <AB01> { [ z, Z, 0x100017F, 0x1001E9B ] }; + // long s, long s dot + key <AB03> { [ c, C, cabovedot, Cabovedot ] }; + key <AB05> { [ b, B, babovedot, Babovedot ] }; + key <AB07> { [ m, M, mabovedot, Mabovedot ] }; + + key <LSGT> { [ backslash, bar, dead_grave, dead_cedilla ] }; +}; + +partial alphanumeric_keys +xkb_symbols "CloGaelachLaptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ie(CloGaelach)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "UnicodeExpert" { + +// This should eventually be a "Unicode Expert" layout like the Mac one. + + name[Group1] = "Irish (Unicode Expert)"; + + key.type[Group1] = "FOUR_LEVEL_ALPHABETIC"; + + // + // Numeric row `1234567890-= + // + key <TLDE> { [ grave, notsign, 0x10000A6, 0x10000A6 ] }; + // broken bar + key <AE01> { [ 1, exclam, NoSymbol, NoSymbol ] }; + key <AE02> { [ 2, quotedbl, dead_doubleacute, dead_doubleacute ] }; + key <AE03> { [ 3, sterling, NoSymbol, NoSymbol ] }; + key <AE04> { [ 4, dollar, EuroSign, EuroSign ] }; + key <AE05> { [ 5, percent, NoSymbol, NoSymbol ] }; + key <AE06> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] }; + key <AE07> { [ 7, ampersand, 0x100204A, 0x100204A ] }; + // Tironian Et + key <AE08> { [ 8, asterisk, dead_abovering, dead_abovering ] }; + key <AE09> { [ 9, parenleft, dead_breve, dead_breve ] }; + key <AE10> { [ 0, parenright, dead_ogonek, dead_ogonek ] }; + key <AE11> { [ minus, underscore, dead_macron, dead_macron ] }; + key <AE12> { [ equal, plus, NoSymbol, NoSymbol ] }; + + // + // QWERTYUIOP[] + // + key <AD01> { [ q, Q, NoSymbol, NoSymbol ] }; + key <AD02> { [ w, W, NoSymbol, NoSymbol ] }; + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD04> { [ r, R, 0x100027C, 0x100027C ] }; + // long r + key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, uacute, Uacute ] }; + key <AD08> { [ i, I, iacute, Iacute ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; + key <AD11> { [ bracketleft, braceleft, dead_hook, dead_hook ] }; + key <AD12> { [ bracketright, braceright, dead_horn, dead_horn ] }; + + // + // ASDFGHJKL;'# + // + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ s, S, NoSymbol, NoSymbol ] }; + key <AC03> { [ d, D, NoSymbol, NoSymbol ] }; + key <AC04> { [ f, F, NoSymbol, NoSymbol ] }; + key <AC05> { [ g, G, NoSymbol, NoSymbol ] }; + key <AC06> { [ h, H, dead_abovedot, dead_abovedot ] }; + key <AC07> { [ j, J, NoSymbol, NoSymbol ] }; + key <AC08> { [ k, K, NoSymbol, NoSymbol ] }; + key <AC09> { [ l, L, NoSymbol, NoSymbol ] }; + key <AC10> { [ semicolon, colon, dead_diaeresis, dead_diaeresis ] }; + key <AC11> { [ apostrophe, at, dead_acute, dead_acute ] }; + key <BKSL> { [ numbersign, asciitilde, dead_tilde, dead_tilde ] }; + + // + // \ZXCVBNM,./ + // + key <LSGT> { [ backslash, bar, dead_grave, dead_grave ] }; + key <AB01> { [ z, Z, 0x100017F, 0x1001E9B ] }; + // long s, long s dot + key <AB02> { [ x, X, NoSymbol, NoSymbol ] }; + key <AB03> { [ c, C, NoSymbol, NoSymbol ] }; + key <AB04> { [ v, V, dead_caron, dead_caron ] }; + key <AB05> { [ b, B, NoSymbol, NoSymbol ] }; + key <AB06> { [ n, N, NoSymbol, NoSymbol ] }; + key <AB07> { [ m, M, NoSymbol, NoSymbol ] }; + key <AB08> { [ comma, less, dead_cedilla, dead_cedilla ] }; + key <AB09> { [ period, greater, dead_abovedot, dead_abovedot ] }; + key <AB10> { [ slash, question, dead_belowdot, dead_belowdot ] }; + + key <SPCE> { type[Group1]="FOUR_LEVEL", + [ space, space, space, nobreakspace ] }; + + key <RALT> { type[Group1]="ONE_LEVEL", [ ISO_Level3_Shift ] }; + modifier_map Mod5 { <RALT> }; + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + Index: xc/programs/xkbcomp/symbols/inet diff -u xc/programs/xkbcomp/symbols/inet:1.16 xc/programs/xkbcomp/symbols/inet:1.28 --- xc/programs/xkbcomp/symbols/inet:1.16 Fri Dec 28 11:03:30 2001 +++ xc/programs/xkbcomp/symbols/inet Wed Feb 26 14:08:43 2003 @@ -1,270 +1,264 @@ -// $XFree86: xc/programs/xkbcomp/symbols/inet,v 1.16 2001/12/28 16:03:30 dawes Exp $ + // $XFree86: xc/programs/xkbcomp/symbols/inet,v 1.28 2003/02/26 19:08:43 dawes Exp $ -partial alphanumeric_keys -xkb_symbols "hp" { - - // Describes the extra keys on an HP "Internet" keyboard. +// EAK (Easy Access, Internet, Multimedia, PDA) keyboards +// Copyright (C) 2002 Stanislav Brabec <sbrabec@suse.cz> +// +// Based on LinEAK project +// LinEAK - Linux support for Easy Access and Internet Keyboards +// Copyright (C) 2001, 2002 Mark Smulders <Mark@PIRnet.nl> + +// Usage in XF86Config: +// Option "XkbLayout" "my_kb_layout" +// Option "XkbVariant" "my_kb_variant" +// Option "XkbModel" "my_eak_type" +// Option "XkbRules" "xfree86" +// Simple command line usage: +// setxkbmap 'my_kb_layout(my_kb_variant)+inet(my_eak_type)' - name[Group1]= "HP"; - key <I12> { [ XF86Search ] }; - key <I26> { [ Help ] }; - key <I5F> { [ XF86Standby ] }; - key <I2E> { [ XF86AudioLowerVolume ] }; - key <I30> { [ XF86AudioRaiseVolume ] }; - key <I20> { [ XF86AudioMute ] }; -}; -partial alphanumeric_keys -xkb_symbols "compaq" { +// Acer - // Describes the extra keys on a Compaq "Internet" keyboard. +partial alphanumeric_keys +xkb_symbols "airkey" { + name[Group1]= "Acer AirKey V"; - name[Group1]= "Compaq"; - key <I1E> { [ XF86Mail ] }; - key <I23> { [ Help ] }; - key <I21> { [ XF86Search ] }; - key <I25> { [ XF86VendorHome ] }; - key <I26> { [ XF86HomePage ] }; - key <I12> { [ XF86LightBulb ] }; - key <I32> { [ XF86Shop ] }; + key <I18> { [ XF86AudioPrev ] }; + key <I15> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I31> { [ XF86AudioStop, XF86Eject ] }; + key <I13> { [ XF86AudioNext ] }; + key <I2D> { [ XF86AudioRaiseVolume ] }; + key <I26> { [ XF86AudioLowerVolume ] }; + key <I19> { [ XF86AudioMute ] }; + key <I24> { [ XF86WWW ] }; + key <I16> { [ XF86Mail ] }; + key <I2F> { [ XF86Terminal ] }; + key <I63> { [ XF86Standby ] }; + key <I5E> { [ XF86PowerOff ] }; }; -partial alphanumeric_keys -xkb_symbols "itouch" { - // Describes the extra keys on a Logitech iTouch keyboard. +// ACPI Standard + +partial alphanumeric_keys +xkb_symbols "acpi" { + name[Group1]= "ACPI Standard"; - name[Group1]= "iTouch"; + key <I5E> { [ XF86PowerOff ] }; key <I5F> { [ XF86Standby ] }; - key <I1F> { [ XF86AudioMute ] }; - key <I2B> { [ XF86AudioLowerVolume ] }; - key <I2D> { [ XF86AudioRaiseVolume ] }; - key <I22> { [ XF86AudioPlay ] }; - key <I24> { [ XF86AudioStop ] }; - key <I10> { [ XF86AudioPrev ] }; - key <I19> { [ XF86AudioNext ] }; - key <I32> { [ XF86HomePage ] }; - key <I6C> { [ XF86Mail ] }; - key <I65> { [ XF86Search ] }; - key <I66> { [ XF86Start ] }; + key <I63> { [ XF86WakeUp ] }; }; -partial alphanumeric_keys -xkb_symbols "logiinetnav" { - // Describes the extra keys on a newer Logitech iTouch keyboard. +// Advance - name[Group1]= "LogiInternetNavigator"; +partial alphanumeric_keys +xkb_symbols "scorpius" { + name[Group1]= "Advance Scorpius KI"; - // Media keys - key <I20> { [ XF86AudioMute ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I19> { [ XF86AudioNext ] }; key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; key <I30> { [ XF86AudioRaiseVolume ] }; - key <I22> { [ XF86AudioPlay ] }; - key <I24> { [ XF86AudioStop ] }; - key <I10> { [ XF86AudioPrev ] }; - key <I19> { [ XF86AudioNext ] }; - // Left side + key <I63> { [ XF86WakeUp ] }; key <I5F> { [ XF86Standby ] }; - key <I13> { [ XF86Finance ] }; - key <I14> { [ XF86Favorites ] }; - key <I15> { [ XF86Community ] }; - key <I66> { [ XF86Start ] }; + key <I5E> { [ XF86PowerOff ] }; - // Right side - key <I12> { [ XF86VendorHome ] }; + key <I21> { [ XF86Calculator ] }; + key <I6B> { [ XF86MyComputer ] }; key <I6C> { [ XF86Mail ] }; + key <I66> { [ XF86Favorites ] }; key <I32> { [ XF86HomePage ] }; - key <I11> { [ XF86Shop ] }; - key <I65> { [ XF86Search ] }; - // Wheel buttons key <I6A> { [ XF86Back ] }; key <I69> { [ XF86Forward ] }; - -}; - -partial alphanumeric_keys -xkb_symbols "logicordless" { - - // Describes the extra keys on a Logitech Desktop Pro keyboard. - - name[Group1]= "CordLess"; - key <I5F> { [ XF86Standby ] }; - key <I20> { [ XF86AudioMute ] }; - key <I2E> { [ XF86AudioLowerVolume ] }; - key <I30> { [ XF86AudioRaiseVolume ] }; - key <I22> { [ XF86AudioPlay ] }; - key <I24> { [ XF86AudioStop ] }; - key <I10> { [ XF86AudioPrev ] }; - key <I19> { [ XF86AudioNext ] }; - key <I32> { [ XF86HomePage ] }; - key <I6C> { [ XF86Mail ] }; + key <I68> { [ XF86Stop ] }; + key <I67> { [ XF86Reload ] }; key <I65> { [ XF86Search ] }; - key <I66> { [ XF86Start ] }; }; + +// Brother + partial alphanumeric_keys -xkb_symbols "logiinternet" { - - // Describes the extra keys on a Logitech Internet Keyboard - - name[Group1]= "LogiInternet"; - key <I25> { [ XF86VendorHome ] }; - key <I10> { [ XF86Back ] }; - key <I22> { [ XF86Forward ] }; - key <I24> { [ XF86Stop ] }; - key <I19> { [ XF86Refresh ] }; - key <I1E> { [ XF86Search ] }; - key <I18> { [ XF86Favorites ] }; +xkb_symbols "brother" { + name[Group1]= "Brother Internet Keyboard"; + + key <I21> { [ XF86WWW ] }; + key <I1E> { [ XF86AudioMute ] }; + key <I68> { [ XF86AudioLowerVolume ] }; key <I30> { [ XF86AudioRaiseVolume ] }; - key <I2E> { [ XF86AudioLowerVolume ] }; - key <I23> { [ XF86HomePage ] }; - key <I7A> { [ XF86WWW ] }; - key <I32> { [ XF86History ] }; - key <I21> { [ XF86OpenURL ] }; - key <I17> { [ Print ] }; - key <I12> { [ Find ] }; - key <I26> { [ XF86AddFavorite ] }; - key <I20> { [ XF86HotLinks ] }; + key <I18> { [ XF86ScrollDown ] }; + key <I10> { [ XF86ScrollUp ] }; + key <I17> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I2E> { [ XF86AudioNext ] }; + key <I23> { [ XF86AudioStop ] }; + key <I19> { [ XF86ZoomOut ] }; + key <I32> { [ XF86ZoomIn ] }; + key <I24> { [ XF86Calculator ] }; + key <I25> { [ XF86Xfer ] }; + key <I22> { [ Menu ] }; + key <I26> { [ XF86Mail ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; }; + +// BTC + partial alphanumeric_keys -xkb_symbols "geniuscomfy" { - - // Describes the extra keys on a Genius Comfy KB-16M - - name[Group1]= "GeniusComfy16M"; - key <I23> { [ XF86AudioPrev ] }; - key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; - key <I24> { [ XF86AudioStop ] }; - key <I21> { [ XF86AudioNext ] }; - key <I30> { [ XF86Eject ] }; - key <I19> { [ XF86AudioLowerVolume ] }; - key <I12> { [ XF86AudioRaiseVolume ] }; - key <I20> { [ XF86AudioMute ] }; - key <I26> { [ XF86ScreenSaver ] }; - key <I17> { [ XF86Calculator ] }; - key <I2E> { [ XF86Mail ] }; - key <I25> { [ XF86Back ] }; - key <I32> { [ XF86WWW ] }; - key <I1E> { [ XF86Forward ] }; - key <I5F> { [ XF86Sleep ] }; - key <I63> { [ XF86WakeUp ] }; -}; +xkb_symbols "btc5113rf" { + name[Group1]= "BTC 5113RF Multimedia"; -partial alphanumeric_keys -xkb_symbols "microsoftpro" { + key <I30> { [ XF86WWW ] }; + key <I26> { [ XF86Back ] }; + key <I20> { [ XF86Favorites ] }; + key <I32> { [ XF86Search ] }; + key <I25> { [ XF86AudioLowerVolume ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I12> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioNext ] }; + key <I21> { [ XF86Eject ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; - // Describes the extra keys on a Microsoft Natural Keyboard Pro +partial alphanumeric_keys +xkb_symbols "btc5126t" { + name[Group1]= "BTC 5126T"; - name[Group1]= "MicrosoftPro"; - key <I6A> { [ XF86Back ] }; - key <I69> { [ XF86Forward ] }; - key <I68> { [ XF86Stop ] }; - key <I67> { [ XF86Refresh ] }; - key <I65> { [ XF86Search ] }; - key <I66> { [ XF86Favorites ] }; - key <I32> { [ XF86HomePage ] }; - key <I6C> { [ XF86Mail ] }; - key <I20> { [ XF86AudioMute ] }; - key <I2E> { [ XF86AudioLowerVolume ] }; - key <I30> { [ XF86AudioRaiseVolume ] }; - key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; - key <I24> { [ XF86AudioStop ] }; - key <I10> { [ XF86AudioPrev ] }; - key <I19> { [ XF86AudioNext ] }; - key <I6D> { [ XF86AudioMedia ] }; - key <I6B> { [ XF86MyComputer ] }; - key <I21> { [ XF86Calculator ] }; + key <I30> { [ XF86WWW ] }; key <I5F> { [ XF86Standby ] }; + key <I2B> { [ XF86Mail ] }; }; +partial alphanumeric_keys xkb_symbols "btc9000" { - // from <supercava@libero.it> - // Describes the extra keys on a BTC model 9000 keyboard - // found in many computers sold by Computer Discount - name[Group1]= "btc9000"; - key <I26> { [ XF86Refresh ] }; - key <I32> { [ XF86Search ] }; - key <I20> { [ XF86Favorites ] }; - key <I30> { [ XF86HomePage ] }; - key <I2E> { [ XF86Mail ] }; - key <I12> { [ XF86AudioMute ] }; - key <I25> { [ XF86AudioLowerVolume ] }; - key <I1E> { [ XF86AudioRaiseVolume ] }; - key <I19> { [ XF86AudioPlay, XF86AudioPause ] }; - key <I10> { [ XF86AudioStop ] }; + name[Group1]= "BTC 9000"; + + key <I19> { [ XF86AudioPlay, XF86AudioPause ] }; key <I22> { [ XF86AudioPrev ] }; key <I24> { [ XF86AudioNext ] }; + key <I10> { [ XF86AudioStop ] }; key <I21> { [ XF86AudioMedia ] }; + + key <I25> { [ XF86AudioLowerVolume ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I12> { [ XF86AudioMute ] }; + + key <I30> { [ XF86HomePage ] }; + key <I26> { [ XF86Reload ] }; + key <I32> { [ XF86Search ] }; + key <I20> { [ XF86Favorites ] }; + + key <I2E> { [ XF86Mail ] }; + key <I63> { [ XF86WakeUp ] }; key <I5F> { [ XF86Standby ] }; key <I5E> { [ XF86PowerOff ] }; - key <I63> { [ XF86WakeUp ] }; }; - -partial alphanumeric_keys -xkb_symbols "rapidaccess" { +partial alphanumeric_keys +xkb_symbols "btc9000a" { + name[Group1]= "BTC 9000A"; - // Describes the extra keys on an IBM Rapid Access keyboard + key <I19> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I22> { [ XF86AudioPrev ] }; + key <I24> { [ XF86AudioNext ] }; + key <I10> { [ XF86AudioStop ] }; + key <I21> { [ XF86Eject ] }; - name[Group1]= "RapidAccess"; - key <I22> { [ XF86AudioPause ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I25> { [ XF86AudioLowerVolume ] }; key <I12> { [ XF86AudioMute ] }; - key <I1E> { [ XF86AudioLowerVolume ] }; - key <I20> { [ XF86AudioRaiseVolume ] }; - key <I19> { [ XF86AudioPlay ] }; - key <I24> { [ XF86AudioStop ] }; - key <I23> { [ XF86AudioPrev ] }; - key <I21> { [ XF86AudioNext ] }; - key <I25> { [ XF86Standby ] }; - key <I32> { [ XF86Launch1 ] }; - key <I17> { [ XF86Launch2 ] }; - key <I30> { [ XF86Launch3 ] }; - key <I2E> { [ XF86Launch4 ] }; - key <I26> { [ Help ] }; + + key <I30> { [ XF86WWW ] }; + key <I26> { [ XF86HomePage ] }; + key <I32> { [ XF86Search ] }; + key <I20> { [ XF86Favorites ] }; + + key <I2E> { [ Help ] }; + key <I63> { [ XF86WakeUp ] }; + key <I5F> { [ XF86Standby ] }; + key <I5E> { [ XF86PowerOff ] }; }; -partial alphanumeric_keys -xkb_symbols "rapidaccess2" { +// Cherry Blue Line - // From <patrick@dcruze.org> - // Describes the extra keys on an IBM Rapid Access II keyboard +partial alphanumeric_keys +xkb_symbols "cherryblue" { + name[Group1]= "Cherry Blue Line CyBo@rd"; - name[Group1]= "RapidAccess2"; - key <I25> { [ XF86HomePage ] }; - key <I26> { [ XF86Shop ] }; - key <I32> { [ XF86VendorHome ] }; - key <I17> { [ XF86Favorites ] }; - key <I30> { [ XF86MyComputer ] }; - key <I2E> { [ XF86Search ] }; - key <I5F> { [ XF86Standby ] }; - key <I1E> { [ XF86AudioMute ] }; - key <I21> { [ XF86AudioLowerVolume ] }; - key <I23> { [ XF86AudioRaiseVolume ] }; - key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; - key <I20> { [ XF86AudioStop ] }; + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I68> { [ XF86Stop ] }; + key <FK16> { [ XF86Reload ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86MyComputer ] }; + key <I02> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <PRSC> { [ XF86Terminal ] }; + key <I21> { [ XF86Calculator ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I26> { [ XF86AudioMute ] }; + key <I25> { [ XF86AudioLowerVolume ] }; + key <XFER> { [ XF86Go ] }; key <I24> { [ XF86AudioPrev ] }; - key <I12> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioNext ] }; + key <I1F> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I17> { [ XF86AudioStop ] }; + key <I63> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "cherrybluea" { + name[Group1]= "Cherry Blue Line CyBo@rd (alternate option)"; + + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I68> { [ XF86Stop ] }; + key <I67> { [ XF86Reload ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86MyComputer ] }; + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I6B> { [ XF86Terminal ] }; + key <I21> { [ XF86Calculator ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I6D> { [ XF86Go ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I5F> { [ XF86Standby ] }; }; +// Chicony + partial alphanumeric_keys xkb_symbols "chicony" { + name[Group1]= "Chicony Internet Keyboard"; - // Describes the extra keys on a Chicony internet keyboard - - name[Group1]= "Chicony"; key <I19> { [ XF86AudioLowerVolume ] }; key <I12> { [ XF86AudioMute ] }; key <I23> { [ XF86AudioRaiseVolume ] }; key <I22> { [ XF86AudioPrev ] }; key <I24> { [ XF86AudioStop ] }; - key <I21> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I21> { [ XF86AudioPlay, XF86AudioPause ] }; key <I20> { [ XF86AudioNext ] }; key <I5E> { [ XF86PowerOff ] }; key <I32> { [ XF86HomePage ] }; @@ -278,18 +272,1498 @@ key <I2E> { [ XF86LaunchC ] }; }; - partial alphanumeric_keys -xkb_symbols "dell" { - - // From <liblit@acm.org> - // Describes the extra keys on a Dell Internet keyboard. - - name[Group1]= "Dell"; - key <I12> { [ XF86Mail ] }; - key <I26> { [ XF86HomePage ] }; - key <I1E> { [ XF86Search ] }; - key <I5F> { [ XF86Standby ] }; -}; - +xkb_symbols "chicony9885" { + name[Group1]= "Chicony KB-9885"; + key <I19> { [ XF86AudioLowerVolume ] }; + key <I12> { [ XF86AudioMute ] }; + key <I23> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPrev ] }; + key <I24> { [ XF86AudioStop ] }; + key <I21> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I20> { [ XF86AudioNext ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; + key <I32> { [ XF86WWW ] }; + key <I17> { [ XF86Mail ] }; + key <I30> { [ XF86LaunchA ] }; + key <I26> { [ XF86LaunchB ] }; + key <I2E> { [ XF86LaunchC ] }; + key <I25> { [ XF86Back ] }; + key <I1E> { [ XF86Forward ] }; +}; + + +// Compaq + +partial alphanumeric_keys +xkb_symbols "compaqeak8" { + name[Group1]= "Compaq Easy Access Keyboard"; + + key <I23> { [ XF86WWW ] }; + key <I1F> { [ XF86HomePage ] }; + key <I1A> { [ XF86Search ] }; + key <I1E> { [ XF86Mail ] }; + key <I13> { [ XF86Community ] }; + key <I14> { [ XF86Market ] }; + key <I15> { [ XF86Meeting ] }; + key <I1B> { [ XF86News ] }; +}; + +partial alphanumeric_keys +xkb_symbols "compaqik7" { + name[Group1]= "Compaq Internet Keyboard (7 keys)"; + + key <I1E> { [ XF86Mail ] }; + key <I23> { [ Help ] }; + key <I21> { [ XF86Search ] }; + key <I25> { [ XF86VendorHome ] }; + key <I26> { [ XF86HomePage ] }; + key <I12> { [ XF86LightBulb ] }; + key <I32> { [ XF86Shop ] }; +}; + +partial alphanumeric_keys +xkb_symbols "compaqik13" { + name[Group1]= "Compaq Internet Keyboard (13 keys)"; + + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I5F> { [ XF86Standby ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I1F> { [ XF86Go ] }; + key <I23> { [ XF86WWW ] }; + key <I21> { [ XF86Search ] }; + key <I1E> { [ XF86Mail ] }; + key <I32> { [ XF86Shop ] }; +}; + +partial alphanumeric_keys +xkb_symbols "compaqik18" { + name[Group1]= "Compaq Internet Keyboard (18 keys)"; + + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I24> { [ XF86AudioStop ] }; + key <I18> { [ XF86Eject ] }; + + key <I1E> { [ XF86Mail ] }; + key <I26> { [ XF86Community ] }; + key <I25> { [ XF86VendorHome ] }; + key <I23> { [ XF86WWW ] }; + key <I21> { [ XF86Search ] }; + key <I12> { [ XF86LightBulb ] }; + key <I32> { [ XF86Shop ] }; + + key <I68> { [ Print ] }; + key <I1F> { [ XF86Go ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I5F> { [ XF86Standby ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "armada" { + name[Group1]= "Laptop/notebook Compaq (eg. Armada) Laptop Keyboard"; + + key <I23> { [ XF86WWW ] }; + key <I1F> { [ XF86HomePage ] }; + key <I1A> { [ XF86Search ] }; + key <I1E> { [ XF86Mail ] }; +}; + +partial alphanumeric_keys +xkb_symbols "presario" { + name[Group1]= "Laptop/notebook Compaq (eg. Presario) Internet Keyboard"; + + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I24> { [ XF86AudioStop ] }; + key <I1F> { [ XF86Launch1 ] }; + key <I18> { [ XF86Launch2 ] }; + + key <I75> { [ XF86AudioMedia ] }; + key <I23> { [ XF86WWW ] }; + key <I14> { [ XF86Q ] }; + key <I32> { [ XF86Shop ] }; + key <I1E> { [ XF86Mail ] }; + key <I20> { [ XF86AudioMute ] }; + key <I5F> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "ipaq" { + name[Group1]= "Compaq iPaq Keyboard"; + + key <I6C> { [ XF86Mail ] }; + key <I69> { [ XF86BackForward ] }; + key <I6A> { [ XF86Q ] }; + key <I02> { [ XF86Standby ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Travel ] }; + key <FK16> { [ XF86Shop ] }; +}; + + +// Dell + +partial alphanumeric_keys +xkb_symbols "dell" { + name[Group1]= "Dell"; + + key <I12> { [ XF86Mail ] }; + key <I26> { [ XF86HomePage ] }; + key <I1E> { [ XF86Search ] }; + key <I5F> { [ XF86Standby ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "inspiron" { + name[Group1]= "Laptop/notebook Dell Inspiron 8xxx"; + + key <XFER> { [ XF86AudioPlay, XF86AudioPause ] }; + key <NFER> { [ XF86AudioPrev ] }; + key <I04> { [ XF86AudioNext ] }; + key <I02> { [ XF86AudioStop ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + + +// Dexxa + +partial alphanumeric_keys +xkb_symbols "dexxa" { + name[Group1]= "Dexxa Wireless Desktop Keyboard"; + + key <I67> { [ XF86Reload ] }; + key <I66> { [ XF86Favorites ] }; + key <I65> { [ XF86Search ] }; + key <I6C> { [ XF86Mail ] }; + key <I32> { [ XF86WWW ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + + +// Diamond + +partial alphanumeric_keys +xkb_symbols "diamond" { + name[Group1]= "Diamond 9801 / 9802 series"; + + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I68> { [ XF86Stop ] }; + key <I66> { [ XF86Favorites ] }; + key <I65> { [ XF86Search ] }; + key <I67> { [ XF86Reload ] }; + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I6D> { [ XF86Go ] }; + key <I24> { [ XF86AudioStop ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I19> { [ XF86AudioNext ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I21> { [ XF86Calculator ] }; + key <I6B> { [ XF86MyComputer ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; + +// Ennyah + +partial alphanumeric_keys +xkb_symbols "ennyah_dkb1008" { + name[Group1]= "Ennyah DKB-1008"; + + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I65> { [ XF86Search ] }; + key <I67> { [ XF86Refresh ] }; + key <I66> { [ XF86Favorites ] }; + key <I68> { [ XF86Stop ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I19> { [ XF86AudioNext ] }; + key <XFER> { [ XF86AudioMedia ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; + + +// Genius + +partial alphanumeric_keys +xkb_symbols "genius" { + name[Group1]= "Genius Comfy KB-16M / Genius MM Keyboard KWD-910"; + + key <I23> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I21> { [ XF86AudioNext ] }; + key <I30> { [ XF86Eject ] }; + key <I19> { [ XF86AudioLowerVolume ] }; + key <I12> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I26> { [ XF86ScreenSaver ] }; + key <I17> { [ XF86Calculator ] }; + key <I2E> { [ XF86Mail ] }; + key <I25> { [ XF86Back ] }; + key <I32> { [ XF86WWW ] }; + key <I1E> { [ XF86Forward ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; + + +// Hewlett-Packard + +partial alphanumeric_keys +xkb_symbols "hpi6" { + name[Group1]= "Hewlett-Packard Internet Keyboard"; + + key <I12> { [ XF86Search ] }; + key <I26> { [ Help ] }; + key <I5F> { [ XF86Standby ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hp2501" { + name[Group1]= "Hewlett-Packard SK-2501 Multimedia Keyboard"; + + key <I32> { [ XF86WWW ] }; + key <I17> { [ XF86Search ] }; + key <I12> { [ XF86Tools ] }; + key <I1E> { [ XF86Mail ] }; + key <I23> { [ XF86Launch2 ] }; + key <I22> { [ XF86Launch3 ] }; + key <I24> { [ XF86Launch4 ] }; + key <I21> { [ XF86Launch5 ] }; + key <I25> { [ XF86Standby ] }; + key <I26> { [ Help ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hp2505" { + name[Group1]= "Hewlett-Packard SK-2505 Internet Keyboard"; + + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I24> { [ XF86AudioStop ] }; + key <I18> { [ XF86Eject ] }; + key <I1E> { [ XF86Mail ] }; + key <I32> { [ XF86WWW ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I25> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hp5181" { + name[Group1]= "Hewlett-Packard 5181 Internet Keyboard"; + + key <I10> { [ XF86AudioPrev ] }; + key <I12> { [ XF86Search ] }; + key <I14> { [ XF86VendorHome ] }; + key <I15> { [ XF86Community ] }; + key <I16> { [ XF86AudioMedia ] }; + key <I18> { [ XF86Eject ] }; + key <I19> { [ XF86AudioNext ] }; + key <I1E> { [ XF86Shop ] }; + key <I1F> { [ XF86Launch1 ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I26> { [ Help ] }; + key <I27> { [ XF86Finance ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I32> { [ XF86HomePage ] }; + key <I39> { [ Print ] }; + key <I5F> { [ XF86Standby ] }; + key <I6C> { [ XF86Mail ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "hpxe3gc" { + + // Describes the OneTouch buttons on HP Omnibook XE3 GC and + // HP Pavilion N52XX models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Omnibook XE3 GC, GD, GE and Pavilion N5xxx"; + key <I73> { [ XF86WWW ] }; + key <I74> { [ XF86Mail ] }; + key <I72> { [ XF86Launch1 ] }; + key <I71> { [ Help ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop, XF86Eject ] }; + key <I19> { [ XF86AudioNext ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hpxe3gf" { + + // Describes the OneTouch buttons on HP Omnibook XE3 GF models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Omnibook XE3 GF"; + key <I32> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <I74> { [ XF86Launch1 ] }; + key <I73> { [ Help ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop, XF86Eject ] }; + key <I19> { [ XF86AudioNext ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hpxt1000" { + + // Describes the OneTouch buttons on HP Omnibook XT1000 models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Omnibook XT1000"; + key <I6C> { [ XF86Mail ] }; + key <I74> { [ XF86Launch1 ] }; + key <I32> { [ XF86WWW ] }; + key <I73> { [ XF86Launch2 ] }; + key <I72> { [ Help ] }; + key <I71> { [ XF86Launch3 ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop, XF86Eject ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hpzt11xx" { + + // Describes the OneTouch buttons on HP Pavilion ZT11xx models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Pavilion ZT11xx"; + key <I6C> { [ XF86Mail ] }; + key <I74> { [ XF86Launch1 ] }; + key <I32> { [ XF86WWW ] }; + key <I73> { [ XF86Launch2 ] }; + key <I72> { [ Help ] }; + key <I71> { [ XF86Launch3 ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop, XF86Eject ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hpxe4xxx" { + + // Describes the OneTouch buttons on HP Omnibook XE4xxx and ZE4xxx + // models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Omnibook XE4xxx and ZE4xxx"; + key <I6C> { [ XF86Mail ] }; + key <I73> { [ XF86Launch1 ] }; + key <I32> { [ XF86WWW ] }; + key <I71> { [ XF86Launch2 ] }; + key <I70> { [ Help ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hp500fa" { + + // Describes the OneTouch buttons on HP Omnibook 500 FA models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Omnibook 500 FA"; + key <I74> { [ XF86Launch1 ] }; + key <I73> { [ Help ] }; +}; + +partial alphanumeric_keys +xkb_symbols "hp5xx" { + + // Describes the OneTouch buttons on HP Omnibook 5xx models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Hewlett-Packard Omnibook 5xx"; + key <I74> { [ XF86Launch1 ] }; + key <I73> { [ Help ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop, XF86Eject ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; +}; + + +// Honeywell + + +partial alphanumeric_keys +xkb_symbols "honeywell_euroboard" { + + // Scott Penrose <scottp@dd.com.au> + // January 2002 + // http://linux.dd.com.au/quest/linux/keyboard/honeywell/ + + name[Group1]= "Honeywell Euroboard"; + key <I10> { [ XF86Game ] }; + key <I12> { [ XF86AudioPrev ] }; + key <I17> { [ XF86Eject ] }; + key <I18> { [ XF86Launch2 ] }; + key <I19> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I1E> { [ XF86Launch1 ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioNext ] }; + key <I23> { [ XF86AudioStop ] }; + key <I24> { [ XF86Mail ] }; + key <I25> { [ XF86ScreenSaver ] }; + key <I26> { [ XF86Calculator ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I32> { [ XF86WWW ] }; +}; + + +// IBM + + +partial alphanumeric_keys +xkb_symbols "rapidaccess" { + name[Group1]= "IBM Rapid Access"; + + key <I22> { [ XF86AudioPause ] }; + key <I12> { [ XF86AudioMute ] }; + key <I1E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I23> { [ XF86AudioPrev ] }; + key <I21> { [ XF86AudioNext ] }; + key <I25> { [ XF86Standby ] }; + key <I32> { [ XF86Launch1 ] }; + key <I17> { [ XF86Launch2 ] }; + key <I30> { [ XF86Launch3 ] }; + key <I2E> { [ XF86Launch4 ] }; + key <I26> { [ Help ] }; +}; + +partial alphanumeric_keys +xkb_symbols "rapidaccess2" { + name[Group1]= "IBM Rapid Access II"; + + key <I25> { [ XF86HomePage ] }; + key <I26> { [ XF86Shop ] }; + key <I32> { [ XF86VendorHome ] }; + key <I17> { [ XF86Favorites ] }; + key <I30> { [ XF86MyComputer ] }; + key <I2E> { [ XF86Search ] }; + key <I5F> { [ XF86Standby ] }; + key <I1E> { [ XF86AudioMute ] }; + key <I21> { [ XF86AudioLowerVolume ] }; + key <I23> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I20> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioNext ] }; +}; + +partial alphanumeric_keys +xkb_symbols "rapidaccess2a" { + name[Group1]= "IBM Rapid Access II (alternate option)"; + + key <I25> { [ XF86WWW ] }; + key <I26> { [ XF86Shop ] }; + key <I32> { [ XF86VendorHome ] }; + key <I17> { [ XF86Favorites ] }; + key <I30> { [ XF86Option ] }; + key <I2E> { [ Help ] }; + key <I5F> { [ XF86Standby ] }; + key <I1E> { [ XF86AudioMute ] }; + key <I20> { [ XF86AudioStop ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioNext ] }; + key <I21> { [ XF86AudioLowerVolume ] }; + key <I23> { [ XF86AudioRaiseVolume ] }; + key <MENU> { [ Menu ] }; +}; + + +// Logitech + +partial alphanumeric_keys +xkb_symbols "ltcd" { + name[Group1]= "Logitech Cordless Desktop"; + + key <I5F> { [ XF86Standby ] }; + key <I02> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Go ] }; + key <I26> { [ XF86AudioMute ] }; + key <I25> { [ XF86AudioLowerVolume ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I1F> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I17> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioNext ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicdit" { + name[Group1]= "Logitech Cordless Desktop iTouch"; + + key <I5F> { [ XF86Standby ] }; + key <I13> { [ XF86Finance ] }; + key <I14> { [ XF86MySites ] }; + key <I15> { [ XF86Community ] }; + key <I66> { [ XF86Favorites ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I12> { [ XF86VendorHome ] }; + key <I6C> { [ XF86Mail ] }; + key <I11> { [ XF86Shop ] }; + key <I65> { [ XF86Search ] }; + key <I32> { [ XF86HomePage ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicdp" { + name[Group1]= "Logitech Cordless Desktop Pro"; + + key <I5F> { [ XF86Standby ] }; + key <I32> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Go ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I21> { [ XF86VendorHome ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicdpa" { + name[Group1]= "Logitech Cordless Desktop Pro (alternate option)"; + + key <I5F> { [ XF86Standby ] }; + key <I02> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Go ] }; + key <I26> { [ XF86AudioMute ] }; + key <I25> { [ XF86AudioLowerVolume ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I1F> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I17> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioNext ] }; + key <I21> { [ XF86VendorHome ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicdpa2" { + name[Group1]= "Logitech Cordless Desktop Pro (alternate option2)"; + + key <I5F> { [ XF86Standby ] }; + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Start ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicdo" { + name[Group1]= "Logitech Cordless Desktop Optical"; + + key <I69> { [ XF86Go ] }; + key <I6A> { [ XF86Back ] }; + key <I16> { [ XF86WheelButton ] }; + key <I5F> { [ XF86Standby ] }; + key <I13> { [ XF86Finance ] }; + key <I14> { [ XF86MySites ] }; + key <I15> { [ XF86Community ] }; + key <I66> { [ XF86Favorites ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I12> { [ XF86iTouch ] }; + key <I6C> { [ XF86Mail ] }; + key <I11> { [ XF86Shop ] }; + key <I65> { [ XF86Search ] }; + key <I32> { [ XF86HomePage ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicfn" { + name[Group1]= "Logitech Cordless Freedom/Desktop Navigator"; + + key <I13> { [ XF86Finance ] }; + key <I14> { [ XF86MySites ] }; + key <I15> { [ XF86Community ] }; + key <I66> { [ XF86Favorites ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I12> { [ XF86iTouch ] }; + key <I6C> { [ XF86Mail ] }; + key <I11> { [ XF86Shop ] }; + key <I65> { [ XF86Search ] }; + key <I32> { [ XF86HomePage ] }; + key <I69> { [ XF86Standby ] }; + key <UP> { [ XF86ScrollUp ] }; + key <DOWN> { [ XF86ScrollDown ] }; + key <I16> { [ XF86ScrollClick ] }; + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logicdn" { + name[Group1]= "Logitech Cordless Desktop Navigator"; + + // Media keys + key <I20> { [ XF86AudioMute ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + + // Left side + key <I5F> { [ XF86Standby ] }; + key <I6C> { [ XF86Mail ] }; + key <I11> { [ XF86Messenger ] }; + key <I12> { [ XF86WebCam ] }; + + // Right side + key <I13> { [ XF86VendorHome ] }; + key <I65> { [ XF86Search ] }; + key <I14> { [ XF86Shop ] }; + key <I66> { [ XF86Favorites ] }; + key <I32> { [ XF86HomePage ] }; + + // Extended function keys + key <I3B> { [ XF86New ] }; // F1 + key <I3C> { [ XF86Reply ] }; // F2 + key <FK13> { [ XF86MailForward ] }; // F3 + key <FK14> { [ XF86Send ] }; // F4 + key <FK15> { [ Undo ] }; // F5 + key <FK16> { [ Redo ] }; // F6 + key <FK17> { [ Print ] }; // F7 + key <I42> { [ XF86Save ] }; // F8 + key <I43> { [ XF86MyComputer ] }; // F9 + key <I44> { [ XF86Documents ] }; // F10 + key <I57> { [ XF86Pictures ] }; // F11 + key <I58> { [ XF86Music ] }; // F12 + +}; + +partial alphanumeric_keys +xkb_symbols "logidak" { + name[Group1]= "Logitech Deluxe Access Keyboard"; + + key <I32> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logiik" { + name[Group1]= "Logitech Internet Keyboard"; + + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I24> { [ XF86AudioStop ] }; + + key <I6C> { [ XF86Mail ] }; + key <I32> { [ XF86WWW ] }; + key <I65> { [ XF86Search ] }; + + key <I66> { [ XF86Go ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I5F> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "itouch" { + name[Group1]= "Logitech iTouch"; + + key <I5F> { [ XF86Standby ] }; + key <I1F> { [ XF86AudioMute ] }; + key <I2B> { [ XF86AudioLowerVolume ] }; + key <I2D> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Start ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logiitc" { + name[Group1]= "Logitech iTouch Cordless Keyboard (model Y-RB6)"; + + key <I5F> { [ XF86PowerOff ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Favorites ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logiik" { + name[Group1]= "Logitech Internet Keyboard"; + + key <I25> { [ XF86VendorHome ] }; + key <I10> { [ XF86Back ] }; + key <I22> { [ XF86Forward ] }; + key <I24> { [ XF86Stop ] }; + key <I19> { [ XF86Reload ] }; + key <I1E> { [ XF86Search ] }; + key <I18> { [ XF86Favorites ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I23> { [ XF86HomePage ] }; + key <I7A> { [ XF86WWW ] }; + key <I32> { [ XF86History ] }; + key <I21> { [ XF86OpenURL ] }; + key <I17> { [ Print ] }; + key <I12> { [ Find ] }; + key <I26> { [ XF86AddFavorite ] }; + key <I20> { [ XF86HotLinks ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logiink" { + name[Group1]= "Logitech Internet Navigator Keyboard"; + + key <I69> { [ XF86Go ] }; + key <I6A> { [ XF86Back ] }; + key <I5F> { [ XF86Standby ] }; + key <I13> { [ XF86Finance ] }; + key <I14> { [ XF86MySites ] }; + key <I15> { [ XF86Community ] }; + key <I66> { [ XF86Favorites ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I12> { [ XF86VendorHome ] }; + key <I6C> { [ XF86Mail ] }; + key <I11> { [ XF86Market ] }; + key <I65> { [ XF86Search ] }; + key <I32> { [ XF86HomePage ] }; +}; + +partial alphanumeric_keys +xkb_symbols "itouchin" { + name[Group1]= "Logitech iTouch keyboard Internet Navigator"; + + // Media keys + key <I20> { [ XF86AudioMute ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + + // Left side + key <I5F> { [ XF86Standby ] }; + key <I13> { [ XF86Finance ] }; + key <I14> { [ XF86Favorites ] }; + key <I15> { [ XF86Community ] }; + key <I66> { [ XF86Start ] }; + + // Right side + key <I12> { [ XF86VendorHome ] }; + key <I6C> { [ XF86Mail ] }; + key <I32> { [ XF86HomePage ] }; + key <I11> { [ XF86Shop ] }; + key <I65> { [ XF86Search ] }; + + // Wheel buttons + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; +}; + + +// Memorex + +partial alphanumeric_keys +xkb_symbols "mx1998" { + name[Group1]= "Memorex MX1998"; + + key <I24> { [ XF86AudioStop ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I7A> { [ XF86ScreenSaver ] }; + key <I57> { [ XF86WakeUp ] }; + key <I32> { [ XF86WWW ] }; + key <I25> { [ XF86Calculator ] }; + key <I18> { [ XF86Xfer ] }; + key <I68> { [ XF86DOS ] }; + key <I21> { [ XF86Documents ] }; + key <I12> { [ XF86AudioRewind ] }; + key <I1E> { [ XF86AudioRecord ] }; + key <I23> { [ XF86Game ] }; + key <I17> { [ XF86Close ] }; + key <I26> { [ Menu ] }; + key <UP> { [ XF86ScrollUp ] }; + key <DOWN> { [ XF86ScrollDown ] }; +}; + +partial alphanumeric_keys +xkb_symbols "mx2500" { + name[Group1]= "Memorex MX2500 EZ-Access Keyboard"; + + key <I5F> { [ XF86Standby ] }; + key <I6B> { [ XF86WakeUp ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I14> { [ XF86DOS ] }; + key <I1F> { [ XF86Documents ] }; + key <I26> { [ XF86News ] }; + key <I32> { [ XF86WWW ] }; + key <I18> { [ XF86Xfer ] }; + key <I6C> { [ XF86Mail ] }; + key <I12> { [ XF86Clear ] }; + key <I13> { [ XF86Phone ] }; + key <I21> { [ XF86Calculator ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I6D> { [ XF86RotateWindows ] }; + key <I24> { [ XF86AudioStop ] }; + key <I17> { [ XF86Close ] }; + key <I1E> { [ XF86Eject ] }; + key <LWIN> { [ Meta_L ] }; + key <RWIN> { [ Meta_R ] }; + key <MENU> { [ Menu ] }; +}; + +partial alphanumeric_keys +xkb_symbols "mx2750" { + name[Group1]= "Memorex MX2750"; + + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; + key <I32> { [ XF86Launch0 ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Favorites ] }; + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I6C> { [ XF86Mail ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I24> { [ XF86AudioStop ] }; + key <I20> { [ XF86AudioMute ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; +}; + + +// Microsoft + +partial alphanumeric_keys +xkb_symbols "microsoftinet" { + name[Group1]= "Microsoft Internet Keyboard"; + + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I68> { [ XF86AudioStop ] }; + key <I6C> { [ XF86Mail ] }; + key <I32> { [ XF86WWW ] }; + key <I6B> { [ XF86MyComputer ] }; + key <I21> { [ XF86Calculator ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Favorites ] }; + key <I5F> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "microsoftpro" { + name[Group1]= "Microsoft Natural Keyboard Pro / Microsoft Internet Keyboard Pro"; + +// Multimedia Section -- Right Side + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I24> { [ XF86AudioStop ] }; + key <I19> { [ XF86AudioNext ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; +// Internet Section -- Left Side + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I66> { [ XF86Favorites ] }; + key <I65> { [ XF86Search ] }; + key <I68> { [ XF86Stop ] }; + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I67> { [ XF86Reload ] }; +// My Computer Section -- Far Right + key <I6B> { [ XF86MyComputer ] }; + key <I21> { [ XF86Calculator ] }; + key <I5F> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "microsoftprose" { + name[Group1]= "Microsoft Internet Keyboard Pro, Swedish"; + + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I68> { [ XF86AudioStop ] }; + key <FK16> { [ XF86Reload ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Favorites ] }; + key <I02> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I26> { [ XF86AudioMute ] }; + key <I25> { [ XF86AudioLowerVolume ] }; + key <I1E> { [ XF86AudioRaiseVolume ] }; + key <I1F> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I17> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioNext ] }; + key <XFER> { [ XF86AudioMedia ] }; + key <PRSC> { [ XF86MyComputer ] }; + key <I21> { [ XF86Calculator ] }; + key <I63> { [ XF86Standby ] }; +}; + +partial alphanumeric_keys +xkb_symbols "microsoftoffice" { + name[Group1]= "Microsoft Office Keyboard"; + + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I3C> { [ XF86Cut ] }; + key <I78> { [ XF86Copy ] }; + key <RCTL> { [ XF86Paste ] }; + key <I54> { [ XF86ApplicationLeft ] }; + key <MOAR> { [ XF86ApplicationRight ] }; + key <I44> { [ XF86Word ] }; + key <I45> { [ XF86Excel ] }; + key <I02> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <BRK> { [ XF86Calendar ] }; + key <I57> { [ XF86HomePage ] }; + key <I21> { [ XF86Calculator ] }; + key <I26> { [ XF86AudioMute ] }; + key <I25> { [ XF86AudioRaiseVolume ] }; + key <I1E> { [ XF86AudioLowerVolume ] }; + key <I4A> { [ XF86LogOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I62> { [ Help ] }; + key <I6D> { [ XF86OfficeHome ] }; + key <I55> { [ XF86TaskPane ] }; + key <I58> { [ XF86New ] }; + key <I59> { [ XF86Open ] }; + key <I5A> { [ XF86Close ] }; + key <I71> { [ XF86Reply ] }; + key <I72> { [ XF86MailForward ] }; + key <I73> { [ XF86Send ] }; + key <I56> { [ XF86Spell ] }; + key <I64> { [ XF86Save ] }; + key <I67> { [ Print ] }; + key <END> { [ Undo ] }; + key <I70> { [ Redo ] }; +}; + + +// Oretec + +partial alphanumeric_keys +xkb_symbols "oretec" { + name[Group1]= "Oretec MCK-800 MM/Internet keyboard"; + + key <I21> { [ XF86WWW ] }; + key <I1E> { [ XF86AudioMute ] }; + key <I68> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I18> { [ XF86ScrollDown ] }; + key <I10> { [ XF86ScrollUp ] }; + key <I17> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I2E> { [ XF86AudioNext ] }; + key <I23> { [ XF86AudioStop ] }; + key <I19> { [ XF86ZoomOut ] }; + key <I32> { [ XF86ZoomIn ] }; + key <I24> { [ XF86Calculator ] }; + key <I25> { [ XF86Xfer ] }; + key <I22> { [ Menu ] }; + key <I26> { [ XF86Mail ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; + + +// Propeller + +partial alphanumeric_keys +xkb_symbols "propeller" { + name[Group1]= "Propeller Voyager (KTEZ-1000)"; + + key <I25> { [ XF86Calculator ] }; + key <I18> { [ XF86Xfer ] }; + + key <I68> { [ XF86DOS ] }; + key <I21> { [ XF86Documents ] }; + key <I32> { [ XF86WWW ] }; + key <I26> { [ Menu ] }; + key <I23> { [ XF86Game ] }; + + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I12> { [ XF86AudioRewind ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I24> { [ XF86AudioStop ] }; + key <I17> { [ XF86Close ] }; + key <I1E> { [ XF86AudioRecord ] }; + + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I7A> { [ XF86Standby ] }; +}; + + +// QTronix + +partial alphanumeric_keys +xkb_symbols "qtronix" { + name[Group1]= "QTronix Scorpius 98N+"; + + key <I21> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I23> { [ XF86AudioNext ] }; + key <I30> { [ XF86AudioRecord ] }; + + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I26> { [ XF86AudioMute ] }; + key <I20> { [ XF86AudioRaiseVolume ] }; + + key <I13> { [ XF86WakeUp ] }; + key <I18> { [ XF86Standby ] }; + key <I31> { [ XF86PowerOff ] }; + key <I68> { [ XF86Calculator ] }; + key <I1F> { [ XF86Reload ] }; + + key <I25> { [ XF86HomePage ] }; + key <I1E> { [ XF86Back ] }; + key <I17> { [ XF86Search ] }; + key <I32> { [ XF86Stop ] }; + key <I12> { [ XF86Forward ] }; + + key <I19> { [ XF86ScrollUp ] }; + key <I10> { [ XF86ScrollDown ] }; +}; + + +// Samsung + +partial alphanumeric_keys +xkb_symbols "samsung4500" { + name[Group1]= "Samsung SDM 4500P"; + + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I18> { [ XF86Eject ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I32> { [ XF86WWW ] }; + key <I6C> { [ XF86Mail ] }; + key <I5F> { [ XF86Standby ] }; + key <I26> { [ Help ] }; + key <I59> { [ XF86Explorer ] }; + key <I09> { [ XF86Close ] }; + key <I0A> { [ XF86Book ] }; + key <I02> { [ XF86Launch1 ] }; + key <NFER> { [ XF86Launch2 ] }; + key <I04> { [ XF86Launch3 ] }; + key <AE13> { [ XF86Launch4 ] }; + key <I06> { [ XF86Launch5 ] }; +}; + +partial alphanumeric_keys +xkb_symbols "samsung4510" { + name[Group1]= "Samsung SDM 4510P"; + + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I18> { [ XF86Eject ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I02> { [ XF86Launch1 ] }; + key <NFER> { [ XF86Launch2 ] }; + key <I04> { [ XF86Launch3 ] }; + key <I5F> { [ XF86Standby ] }; +}; + + +// SK + +partial alphanumeric_keys +xkb_symbols "sk1300" { + name[Group1]= "SK-1300"; + + key <I20> { [ XF86WWW ] }; + key <I26> { [ XF86Back ] }; + key <I1E> { [ XF86Forward ] }; + key <I32> { [ XF86Stop ] }; + key <I25> { [ XF86Standby ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I12> { [ XF86Eject ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sk2500" { + name[Group1]= "SK-2500"; + + key <I25> { [ XF86PowerOff ] }; + key <I7A> { [ XF86ScreenSaver ] }; + key <I32> { [ XF86WWW ] }; + key <I21> { [ XF86Calculator ] }; + key <I23> { [ XF86Xfer ] }; + key <I17> { [ XF86Close ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I19> { [ XF86AudioNext ] }; + key <I1E> { [ XF86AudioRecord ] }; + key <I12> { [ XF86AudioRewind ] }; + key <I26> { [ Menu ] }; + key <I18> { [ XF86Eject ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I19> { [ XF86Forward ] }; + key <I18> { [ XF86Eject ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sk6200" { + name[Group1]= "SK-6200"; + + key <I24> { [ XF86AudioStop ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I23> { [ XF86AudioPrev ] }; + key <I21> { [ XF86AudioNext ] }; + key <I16> { [ XF86AudioRaiseVolume ] }; + key <I14> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I1E> { [ XF86WWW ] }; + key <I12> { [ XF86Favorites ] }; + key <I32> { [ XF86Mail ] }; + key <I17> { [ XF86Back ] }; + key <I19> { [ XF86Forward ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sk7100" { + name[Group1]= "SK-7100"; + + key <I17> { [ XF86Close ] }; + key <I25> { [ XF86CD ] }; + key <I18> { [ XF86Video ] }; + key <I32> { [ XF86WWW ] }; + key <I1E> { [ XF86Eject ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioPause ] }; + key <I22> { [ XF86AudioPlay ] }; + key <I24> { [ XF86AudioStop ] }; + key <I19> { [ XF86AudioNext ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I26> { [ XF86Display ] }; +}; + + +// Sven + +partial alphanumeric_keys +xkb_symbols "sven" { + name[Group1]= "SVEN Ergonomic 2500"; + + key <I68> { [ XF86Back ] }; + key <I12> { [ XF86Forward ] }; + key <I23> { [ XF86Stop ] }; + key <I29> { [ XF86Reload ] }; + key <I2E> { [ XF86Search ] }; + key <I30> { [ XF86Favorites ] }; + key <I1E> { [ XF86HomePage ] }; + key <I19> { [ XF86AudioPrev ] }; + key <I1A> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I62> { [ XF86AudioNext ] }; + key <I26> { [ XF86AudioMute ] }; + key <I25> { [ XF86AudioLowerVolume ] }; + key <I17> { [ XF86AudioRaiseVolume ] }; + key <I18> { [ XF86ZoomOut ] }; + key <I21> { [ XF86ZoomIn ] }; + key <I32> { [ XF86ScrollDown ] }; + key <I31> { [ XF86ScrollUp ] }; + key <I20> { [ XF86Mail ] }; + key <I22> { [ XF86MyComputer ] }; + key <I28> { [ XF86Calculator ] }; + key <I24> { [ XF86ScreenSaver ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; + + +// Symplon + +partial alphanumeric_keys +xkb_symbols "symplon" { + name[Group1]= "Symplon PaceBook (tablet PC)"; + + key <HOME> { [ XF86RotationPB ] }; + key <UP> { [ XF86MenuPB ] }; + key <PAUS> { [ XF86UserPB ] }; + key <I25> { [ XF86RotationKB ] }; + key <I26> { [ XF86MenuKB ] }; + key <I13> { [ XF86SplitScreen ] }; + key <I6B> { [ XF86User1KB ] }; + key <I21> { [ XF86User2KB ] }; + key <I5F> { [ XF86Standby ] }; + key <I17> { [ XF86New ] }; + key <I6C> { [ XF86Mail ] }; + key <I32> { [ XF86WWW ] }; + key <I14> { [ XF86Support ] }; +}; + +// Toshiba + +partial alphanumeric_keys +xkb_symbols "toshiba_s3000" { + + // Describes the Special buttons on Toshiba Satellite 3000 models. + // See http://sourceforge.net/projects/omke for details on enabling + // these keys + + name[Group1]= "Toshiba Satellite S3000"; + key <I71> { [ XF86WWW ] }; + key <I73> { [ XF86Mail ] }; + key <I06> { [ XF86Launch1 ] }; + key <I13> { [ XF86Launch2 ] }; + key <I24> { [ XF86AudioStop, XF86Eject ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I75> { [ XF86AudioRaiseVolume ] }; + key <I76> { [ XF86AudioLowerVolume ] }; +}; + +// Trust + +partial alphanumeric_keys +xkb_symbols "trust" { + name[Group1]= "Trust Wireless Keyboard Classic"; + + key <I32> { [ XF86WWW ] }; + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + key <I6C> { [ XF86Mail ] }; + key <I21> { [ XF86Calculator ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I1E> { [ XF86Eject ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; + key <I11> { [ XF86ScreenSaver ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "trustda" { + name[Group1]= "Trust Direct Access Keyboard"; + + key <I7A> { [ XF86Away ] }; + key <I32> { [ XF86WWW ] }; + key <I21> { [ XF86Calculator ] }; + key <I23> { [ XF86Xfer ] }; + key <I17> { [ XF86Close ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I19> { [ XF86AudioNext ] }; + key <I1E> { [ XF86AudioRecord ] }; + key <I12> { [ XF86AudioRewind ] }; + key <I26> { [ Help ] }; + key <I18> { [ XF86Eject ] }; + key <I20> { [ XF86AudioMute ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I25> { [ XF86Standby ] }; +}; + + +// YaHoo! + +partial alphanumeric_keys +xkb_symbols "yahoo" { + name[Group1]= "Yahoo! Internet Keyboard"; + + key <I11> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I1E> { [ XF86AudioStop ] }; + key <I1F> { [ XF86AudioNext ] }; + key <I20> { [ XF86AudioRecord ] }; + key <I21> { [ XF86AudioLowerVolume ] }; + key <I22> { [ XF86AudioRaiseVolume ] }; + key <I23> { [ XF86AudioMute ] }; + key <I24> { [ XF86Close ] }; + key <I25> { [ XF86Calculator ] }; + key <I26> { [ Help ] }; + key <I27> { [ XF86Mail ] }; + key <I28> { [ XF86WWW ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I5F> { [ XF86Standby ] }; + key <I63> { [ XF86WakeUp ] }; +}; Index: xc/programs/xkbcomp/symbols/ir diff -u xc/programs/xkbcomp/symbols/ir:1.1 xc/programs/xkbcomp/symbols/ir:1.2 --- xc/programs/xkbcomp/symbols/ir:1.1 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/ir Thu Dec 12 23:18:03 2002 @@ -1,23 +1,27 @@ // $XConsortium: // $XFree86: +// // Iranian keymap, by Robert Brady <robert@suse.co.uk> -// data supplied by Roozbeh Pournader <roozbeh@Sina.sharif.ac.ir> +// Data supplied by Roozbeh Pournader <roozbeh@sharif.edu> +// Minor changes made by Arash Zeini <a.zeini@farsikde.com>, +// and Roozbeh Pournader. +// +// Last update: 2002-06-19 + partial default alphanumeric_keys xkb_symbols "basic" { name[Group2]= "Iranian"; - key <TLDE> { [], [ 0x100200d ] }; - - // Mainly numbers. - key <AE01> { [], [ 1, exclam ] }; - key <AE02> { [], [ 2, 0x100066C ] }; - key <AE03> { [], [ 3, 0x100066B ] }; - key <AE04> { [], [ 4, currency ] }; - key <AE05> { [], [ 5, 0x100066A ] }; - key <AE06> { [], [ 6, 0x10000D7 ] }; - key <AE07> { [], [ 7, Arabic_comma ] }; - key <AE08> { [], [ 8, asterisk ] }; - key <AE09> { [], [ 9, parenleft ] }; - key <AE10> { [], [ 0, parenright ] }; + key <TLDE> { [], [ 0x100200d ] }; + key <AE01> { [], [ 0x10006f1, exclam ] }; + key <AE02> { [], [ 0x10006f2, 0x100066c ] }; + key <AE03> { [], [ 0x10006f3, 0x100066b ] }; + key <AE04> { [], [ 0x10006f4, 0x100fdfc ] }; + key <AE05> { [], [ 0x10006f5, 0x100066a ] }; + key <AE06> { [], [ 0x10006f6, multiply ] }; + key <AE07> { [], [ 0x10006f7, Arabic_comma ] }; + key <AE08> { [], [ 0x10006f8, asterisk ] }; + key <AE09> { [], [ 0x10006f9, parenright ] }; + key <AE10> { [], [ 0x10006f0, parenleft ] }; key <AE11> { [], [ minus, Arabic_tatweel ] }; key <AE12> { [], [ equal, plus ] }; @@ -44,7 +48,7 @@ key <AC08> { [], [ Arabic_noon, guillemotright ] }; key <AC09> { [], [ Arabic_meem, guillemotleft ] }; key <AC10> { [], [ 0x10006a9, colon ] }; - key <AC11> { [], [ 0x10006af, 0x100061b ] }; + key <AC11> { [], [ 0x10006af, Arabic_semicolon ] }; key <BKSL> { [], [ backslash, bar ] }; key <SPCE> { [], [ space, 0x100200c ] }; @@ -52,7 +56,7 @@ key <AB01> { [], [ Arabic_zah, Arabic_kaf ] }; key <AB02> { [], [ Arabic_tah ] }; key <AB03> { [], [ Arabic_zain, 0x1000698 ] }; - key <AB04> { [], [ 0x1000631 ] }; + key <AB04> { [], [ Arabic_ra ] }; key <AB05> { [], [ Arabic_thal, 0x100200c ] }; key <AB06> { [], [ Arabic_dal ] }; key <AB07> { [], [ 0x100067e, Arabic_hamza ] }; @@ -60,23 +64,3 @@ key <AB09> { [], [ period, less ] }; key <AB10> { [], [ slash, Arabic_question_mark ] }; }; - -partial alphanumeric_keys -xkb_symbols "digits" { - include "AR(basic)" - - // use arabic script digits - - key <AE01> { [], [ 0x10006f1, exclam ] }; - key <AE02> { [], [ 0x10006f2, 0x100066C ] }; - key <AE03> { [], [ 0x10006f3, 0x100066B ] }; - key <AE04> { [], [ 0x10006f4, currency ] }; - key <AE05> { [], [ 0x10006f5, 0x100066A ] }; - key <AE06> { [], [ 0x10006f6, 0x10000D7 ] }; - key <AE07> { [], [ 0x10006f7, Arabic_comma ] }; - key <AE08> { [], [ 0x10006f8, asterisk ] }; - key <AE09> { [], [ 0x10006f9, parenleft ] }; - key <AE10> { [], [ 0x10006f0, parenright ] }; - -}; - Index: xc/programs/xkbcomp/symbols/is diff -u xc/programs/xkbcomp/symbols/is:3.6 xc/programs/xkbcomp/symbols/is:3.8 --- xc/programs/xkbcomp/symbols/is:3.6 Mon Oct 1 10:04:15 2001 +++ xc/programs/xkbcomp/symbols/is Mon Jan 20 16:58:55 2003 @@ -1,9 +1,10 @@ // $Xorg: is,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ // XKB keyboard by Hrafnkell Eiriksson - hkelle@rhi.hi.is -// $XFree86: xc/programs/xkbcomp/symbols/is,v 3.6 2001/10/01 14:04:15 eich Exp $ +// fixes by Olafur Osvaldsson - oli@isnic.is +// $XFree86: xc/programs/xkbcomp/symbols/is,v 3.8 2003/01/20 21:58:55 tsi Exp $ default partial alphanumeric_keys -xkb_symbols "default" { +xkb_symbols "basic" { // Describes the differences between a very simple US/ASCII // keyboard and an Icelandic one - hopefully @@ -50,7 +51,7 @@ // key <AC05> { [ g, G ] }; key <AC10> { [ ae, AE ], [ asciicircum ] }; - key <AC11> { [ dead_acute, Adiaeresis ], + key <AC11> { [ dead_acute, dead_diaeresis ], [ dead_circumflex ] }; key <LSGT> { [ less, greater ], @@ -64,12 +65,13 @@ [ periodcentered, division ] }; key <AB10> { [ thorn, Thorn ] }; key <BKSL> { [ plus, asterisk ], - [ bar ] }; - key <RALT> { [ Mode_switch, Multi_key ] }; + [ grave ] }; // End alphanumeric section // begin modifier mappings + include "ralt(mode_switch)" + modifier_map Shift { Shift_L }; modifier_map Lock { Caps_Lock }; modifier_map Control{ Control_L }; @@ -78,7 +80,7 @@ partial alphanumeric_keys xkb_symbols "Sundeadkeys" { - // modify the default German layout to use Sun dead keys + // modify the default Icelandic layout to use Sun dead keys include "is(basic)" key <TLDE> { [ SunFA_Circum, degree ], [ notsign ] }; @@ -92,7 +94,6 @@ [ SunFA_Acute ] }; key <AC11> { [ adiaeresis, Adiaeresis ], [ SunFA_Circum ] }; - key <BKSL> { [ numbersign, acute ], [ SunFA_Grave ] }; }; @@ -104,7 +105,7 @@ partial alphanumeric_keys xkb_symbols "nodeadkeys" { - // modify the default German layout to not have any dead keys + // modify the default Icelandic layout to not have any dead keys include "is(basic)" key <TLDE> { [ asciicircum, degree ], [ notsign ] }; @@ -118,7 +119,6 @@ [ acute ] }; key <AC11> { [ adiaeresis, Adiaeresis ], [ asciicircum ] }; - key <BKSL> { [ numbersign, acute ], [ grave ] }; }; Index: xc/programs/xkbcomp/symbols/jp diff -u xc/programs/xkbcomp/symbols/jp:3.6 xc/programs/xkbcomp/symbols/jp:3.9 --- xc/programs/xkbcomp/symbols/jp:3.6 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/jp Tue Feb 4 20:48:25 2003 @@ -3,10 +3,10 @@ // symbols for a Japanese 106 keyboard(by tsuka@kawalab.dnj.ynu.ac.jp) -// $XFree86: xc/programs/xkbcomp/symbols/jp,v 3.6 2001/01/17 23:45:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/jp,v 3.9 2003/02/05 01:48:25 dawes Exp $ default xkb_symbols "jp106" { - + include "srvr_ctrl(xfree86)" key <ESC> { [ Escape ] }; // Alphanumeric section @@ -24,7 +24,10 @@ key <AE11> { [ minus, equal ], [ kana_HO ] }; key <AE12> { [ asciicircum, asciitilde], [ kana_HE ] }; key <AE13> { [ backslash, bar ], [ prolongedsound ] }; - key <BKSP> { [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; key <TAB> { [ Tab, ISO_Left_Tab ] }; key <AD01> { [ q, Q ], [ kana_TA ] }; @@ -155,5 +158,8 @@ modifier_map Shift { Shift_L,Shift_R }; modifier_map Lock { Caps_Lock }; modifier_map Control{ Control_L,Control_R }; + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; + modifier_map Mod2 { Num_Lock }; + modifier_map Mod5 { Scroll_Lock }; }; Index: xc/programs/xkbcomp/symbols/kan diff -u /dev/null xc/programs/xkbcomp/symbols/kan:1.1 --- /dev/null Thu Feb 27 12:35:31 2003 +++ xc/programs/xkbcomp/symbols/kan Sat Dec 14 19:44:56 2002 @@ -0,0 +1,72 @@ +// $XFree86: xc/programs/xkbcomp/symbols/kan,v 1.1 2002/12/15 00:44:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Inscript layout for Kannada + // Author : G Karunakar <karunakar@freedomink.org> + // Date : Wed Nov 13 17:22:58 IST 2002 + // Kannada digits mapped in basic only + + name[Group2]= "Kannada"; + + key <TLDE> { [], [ 0x01000cca, 0x01000c92 ] }; + key <AE01> { [], [ 0x01000ce7, 0x01000c8d ] }; + key <AE02> { [], [ 0x01000ce8, 0x01000cc5 ] }; + key <AE03> { [], [ 0x01000ce9 ] }; + key <AE04> { [], [ 0x01000cea ] }; + key <AE05> { [], [ 0x01000ceb ] }; + key <AE06> { [], [ 0x01000cec ] }; + key <AE07> { [], [ 0x01000ced ] }; + key <AE08> { [], [ 0x01000cee ] }; + key <AE09> { [], [ 0x01000cef ] }; + key <AE10> { [], [ 0x01000ce6 ] }; + key <AE11> { [], [ 0x01000c83 ] }; + key <AE12> { [], [ 0x01000cc3, 0x01000c8b ] }; + + key <AD01> { [], [ 0x01000ccc, 0x01000c94 ] }; + key <AD02> { [], [ 0x01000cc8, 0x01000c90 ] }; + key <AD03> { [], [ 0x01000cbe, 0x01000c86 ] }; + key <AD04> { [], [ 0x01000cc0, 0x01000c88 ] }; + key <AD05> { [], [ 0x01000cc2, 0x01000c8a ] }; + key <AD06> { [], [ 0x01000cac, 0x01000cad ] }; + key <AD07> { [], [ 0x01000cb9, 0x01000c99 ] }; + key <AD08> { [], [ 0x01000c97, 0x01000c98 ] }; + key <AD09> { [], [ 0x01000ca6, 0x01000ca7 ] }; + key <AD10> { [], [ 0x01000c9c, 0x01000c9d ] }; + key <AD11> { [], [ 0x01000ca1, 0x01000ca2 ] }; + key <AD12> { [], [ 0x01000cbc, 0x01000c9e ] }; + + key <AC01> { [], [ 0x01000ccb, 0x01000c93 ] }; + key <AC02> { [], [ 0x01000cc7, 0x01000c8f ] }; + key <AC03> { [], [ 0x01000ccd, 0x01000c85 ] }; + key <AC04> { [], [ 0x01000cbf, 0x01000c87 ] }; + key <AC05> { [], [ 0x01000cc1, 0x01000c89 ] }; + key <AC06> { [], [ 0x01000caa, 0x01000cab ] }; + key <AC07> { [], [ 0x01000cb0, 0x01000cb1 ] }; + key <AC08> { [], [ 0x01000c95, 0x01000c96 ] }; + key <AC09> { [], [ 0x01000ca4, 0x01000ca5 ] }; + key <AC10> { [], [ 0x01000c9a, 0x01000c9b ] }; + key <AC11> { [], [ 0x01000c9f, 0x01000ca0 ] }; + + key <AB01> { [], [ 0x01000cc6, 0x01000c8e ] }; + key <AB02> { [], [ 0x01000c82, 0x01000c81 ] }; + key <AB03> { [], [ 0x01000cae, 0x01000ca3 ] }; + key <AB04> { [], [ 0x01000ca8, 0x01000ca9 ] }; + key <AB05> { [], [ 0x01000cb5, 0x01000cb4 ] }; + key <AB06> { [], [ 0x01000cb2, 0x01000cb3 ] }; + key <AB07> { [], [ 0x01000cb8, 0x01000cb6 ] }; + key <AB08> { [], [ comma , 0x01000cb7 ] }; + key <AB09> { [], [ period , 0x01000ce4 ] }; + key <AB10> { [], [ 0x01000caf, 0x01000040 ] }; + key <BKSL> { [], [ 0x01000cc9, 0x01000c91 ] }; + key <RALT> { + symbols[Group1] = [ Mode_switch , Multi_key ], + virtualMods = AltGr + }; + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; Index: xc/programs/xkbcomp/symbols/la diff -u xc/programs/xkbcomp/symbols/la:1.1 xc/programs/xkbcomp/symbols/la:1.2 --- xc/programs/xkbcomp/symbols/la:1.1 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/la Tue Jun 4 18:50:58 2002 @@ -1,5 +1,5 @@ // $XConsortium: es /main/3 1996/08/31 12:19:38 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/la,v 1.1 2001/11/21 22:28:52 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/la,v 1.2 2002/06/04 22:50:58 dawes Exp $ // Modified for a real Latin American Keyboard by Fabian Mandelbaum partial default alphanumeric_keys xkb_symbols "basic" { @@ -55,7 +55,7 @@ partial alphanumeric_keys xkb_symbols "Sundeadkeys" { - include "es(basic)" + include "la(basic)" key <AC11> { [ SunFA_Acute, SunFA_Diaeresis ], [ braceleft, braceleft ] }; @@ -65,12 +65,12 @@ partial alphanumeric_keys xkb_symbols "sundeadkeys" { - include "es(Sundeadkeys)" + include "la(Sundeadkeys)" }; partial alphanumeric_keys xkb_symbols "nodeadkeys" { - include "es(basic)" + include "la(basic)" key <AC10> { [ ntilde, Ntilde ], [ asciitilde, doubleacute ] }; Index: xc/programs/xkbcomp/symbols/level3 diff -u xc/programs/xkbcomp/symbols/level3:1.1 xc/programs/xkbcomp/symbols/level3:1.2 --- xc/programs/xkbcomp/symbols/level3:1.1 Fri Aug 17 09:27:58 2001 +++ xc/programs/xkbcomp/symbols/level3 Tue Dec 17 14:55:15 2002 @@ -1,7 +1,7 @@ // using the level(switch) map, the right Control key temporarily // chooses the third group level (until it is released). // -// $XFree86: xc/programs/xkbcomp/symbols/level3,v 1.1 2001/08/17 13:27:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/level3,v 1.2 2002/12/17 19:55:15 dawes Exp $ // partial modifier_keys @@ -28,8 +28,8 @@ // pc105. partial modifier_keys xkb_symbols "win_switch" { - include group(lwin_switch); - include group(rwin_switch); + include "level3(lwin_switch)" + include "level3(rwin_switch)" }; // using the level(lwin_switch) map, the left Windows' logo key Index: xc/programs/xkbcomp/symbols/lo diff -u /dev/null xc/programs/xkbcomp/symbols/lo:1.1 --- /dev/null Thu Feb 27 12:35:31 2003 +++ xc/programs/xkbcomp/symbols/lo Sat Jan 25 21:38:14 2003 @@ -0,0 +1,80 @@ +// $XConsortium: lo 2002/11/28 $ +// +// $XFree86: xc/programs/xkbcomp/symbols/lo,v 1.1 2003/01/26 02:38:14 dawes Exp $ +// +// Lao keymap, by Anousak Souphavanh <anousak@muanglao.com> +// +// +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple US/ASCII + // keyboard and a Lao keyboard + // This keymap uses the Lao keyboard standard [kind of] widely used inLaos + + name[Group2]= "Lao"; + + // Alphanumeric section + key <TLDE> { [], [ 0x100200D ]}; + key <AE01> { [], [ 0x1000ea2, 0x1000ed1 ]}; + key <AE01> { [], [ 0x1000ea2, 0x1000ed1 ]}; + key <AE02> { [], [ 0x1000e9f, 0x1000ed2 ]}; + key <AE03> { [], [ 0x1000ec2, 0x1000ed3 ]}; + key <AE04> { [], [ 0x1000e96, 0x1000ed4 ]}; + key <AE05> { [], [ 0x1000eb8, 0x1000ecc ]}; + key <AE06> { [], [ 0x1000eb9, 0x1000ebc ]}; + key <AE07> { [], [ 0x1000e84, 0x1000ed5 ]}; + key <AE08> { [], [ 0x1000e95, 0x1000ed6 ]}; + key <AE09> { [], [ 0x1000e88, 0x1000ed7 ]}; + key <AE10> { [], [ 0x1000e82, 0x1000ed8 ]}; + key <AE11> { [], [ 0x1000e8a, 0x1000ed9 ]}; + key <AE12> { [], [ 0x1000ecd ]}; + + key <AD01> { [], [ 0x1000ebb ]}; + key <AD02> { [], [ 0x1000ec4, 0x1000ed0 ]}; + key <AD03> { [], [ 0x1000eb3 ]}; + key <AD04> { [], [ 0x1000e9e, underscore ]}; + key <AD05> { [], [ 0x1000eb0, plus ]}; + key <AD06> { [], [ 0x1000eb4 ]}; + key <AD07> { [], [ 0x1000eb5 ]}; + key <AD08> { [], [ 0x1000ea3, 0x1000eae ]}; + key <AD09> { [], [ 0x1000e99 ]}; + key <AD10> { [], [ 0x1000e8d, 0x1000ebd ]}; + key <AD11> { [], [ 0x1000e9a, minus ]}; + key <AD12> { [], [ 0x1000ea5, braceright ]}; + key <BKSL> { [], [ 0x1000edc, 0x1000edd ]}; + + key <AC01> { [], [ 0x1000eb1 ]}; + key <AC02> { [], [ 0x1000eab, semicolon ]}; + key <AC03> { [], [ 0x1000e81, period ]}; + key <AC04> { [], [ 0x1000e94, comma ]}; + key <AC05> { [], [ 0x1000ec0, colon ]}; + key <AC06> { [], [ 0x1000ec9, 0x1000eca ]}; + key <AC07> { [], [ 0x1000ec8, 0x1000ecb ]}; + key <AC08> { [], [ 0x1000eb2, exclam ]}; + key <AC09> { [], [ 0x1000eaa, question ]}; + key <AC10> { [], [ 0x1000ea7, percent ]}; + key <AC11> { [], [ 0x1000e87, equal ]}; + + key <AB01> { [], [ 0x1000e9c, 0x10020ad ]}; + key <AB02> { [], [ 0x1000e9b, parenleft ]}; + key <AB03> { [], [ 0x1000ec1, 0x1000eaf ]}; + key <AB04> { [], [ 0x1000ead ]}; + key <AB05> { [], [ 0x1000eb6 ]}; + key <AB06> { [], [ 0x1000eb7 ]}; + key <AB07> { [], [ 0x1000e97, 0x1000ec6 ]}; + key <AB08> { [], [ 0x1000ea1, quoteleft ]}; + key <AB09> { [], [ 0x1000ec3, dollar ]}; + key <AB10> { [], [ 0x1000e9d, parenright ]}; + +override key <LFSH> { + type="PC_SYSRQ", + [ Shift_L, ISO_First_Group ] + }; +override key <RTSH> { + type="PC_SYSRQ", + [ Shift_R, ISO_Last_Group ] + }; +}; Index: xc/programs/xkbcomp/symbols/ml diff -u /dev/null xc/programs/xkbcomp/symbols/ml:1.1 --- /dev/null Thu Feb 27 12:35:31 2003 +++ xc/programs/xkbcomp/symbols/ml Thu Oct 10 21:59:04 2002 @@ -0,0 +1,107 @@ +default partial alphanumeric_keys +xkb_symbols "basic" { + +// Description : A keymap for Malayalam +// Encoding : Unicode (http://www.unicode.org) +// Author : Baiju M <baiju@freeshell.org> +// Date : Sat Aug 17 21:10:48 IST 2002 +// Mapping: +// +// $XFree86: xc/programs/xkbcomp/symbols/ml,v 1.1 2002/10/11 01:59:04 dawes Exp $ + + name[Group1] = "US/ASCII"; + name[Group2] = "Malayalam"; + + //From grave to backslash (\) + + key <TLDE> { [],[ 0x01000d4a , 0x01000d12 ] }; + key <AE01> { [],[1 , exclam ] }; + key <AE02> { [],[2 , at ] }; + key <AE03> { [],[3 , numbersign ] }; + key <AE04> { [],[4 , dollar ] }; + key <AE05> { [],[5 , percent ] }; + key <AE06> { [],[6 ,asciicircum ] }; + key <AE07> { [],[7 , ampersand ] }; + key <AE08> { [],[8 , 0x01000d7e ] }; + key <AE09> { [],[9 , parenleft ] }; + key <AE10> { [],[0 , parenright ] }; + key <AE11> { [],[ minus , 0x01000d03 ] }; + key <AE12> { [],[ 0x01000d43 , 0x01000d0b ] }; + key <BKSL> { [],[ 0x01000d7c ] }; + + + // From 'q' to right bracket (]) + + key <AD01> { [],[ 0x01000d4c , 0x01000d14 ] }; + key <AD02> { [],[ 0x01000d48 , 0x01000d10 ] }; + key <AD03> { [],[ 0x01000d3e , 0x01000d06 ] }; + key <AD04> { [],[ 0x01000d40 , 0x01000d08 ] }; + key <AD05> { [],[ 0x01000d42 , 0x01000d0a ] }; + key <AD06> { [],[ 0x01000d2c , 0x01000d2d ] }; + key <AD07> { [],[ 0x01000d39 , 0x01000d19 ] }; + key <AD08> { [],[ 0x01000d17 , 0x01000d18 ] }; + key <AD09> { [],[ 0x01000d26 , 0x01000d27 ] }; + key <AD10> { [],[ 0x01000d1c , 0x01000d1d ] }; + key <AD11> { [],[ 0x01000d21 , 0x01000d22 ] }; + key <AD12> { [],[ 0x0100200d , 0x01000d1e ] }; + + + // From 'a' to apostrophe (') + + key <AC01> { [],[ 0x01000d4b , 0x01000d13 ] }; + key <AC02> { [],[ 0x01000d47 , 0x01000d0f ] }; + key <AC03> { [],[ 0x01000d4d , 0x01000d05 ] }; + key <AC04> { [],[ 0x01000d3f , 0x01000d07 ] }; + key <AC05> { [],[ 0x01000d41 , 0x01000d09 ] }; + key <AC06> { [],[ 0x01000d2a , 0x01000d2b ] }; + key <AC07> { [],[ 0x01000d30 , 0x01000d31 ] }; + key <AC08> { [],[ 0x01000d15 , 0x01000d16 ] }; + key <AC09> { [],[ 0x01000d24 , 0x01000d25 ] }; + key <AC10> { [],[ 0x01000d1a , 0x01000d1b ] }; + key <AC11> { [],[ 0x01000d1f , 0x01000d20 ] }; + + // From 'z' to slash (/) + + key <AB01> { [],[ 0x01000d46 , 0x01000d0e ] }; + key <AB02> { [],[ 0x01000d02 , 0x01000d7a ] }; + key <AB03> { [],[ 0x01000d2e , 0x01000d23 ] }; + key <AB04> { [],[ 0x01000d28 , 0x01000d7b ] }; + key <AB05> { [],[ 0x01000d35 , 0x01000d34 ] }; + key <AB06> { [],[ 0x01000d32 , 0x01000d33 ] }; + key <AB07> { [],[ 0x01000d38 , 0x01000d36 ] }; + key <AB08> { [],[ comma , 0x01000d37 ] }; + key <AB09> { [],[ period , 0x01000d7d ] }; + key <AB10> { [],[ 0x01000d2f , question ] }; + + key <RALT> { + symbols[Group1] = [ Mode_switch , Multi_key ], + virtualMods = AltGr + }; + + // begin modifier mappings + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; + +}; + +partial alphanumeric_keys +xkb_symbols "mlplusnum" { + + // Modifies the basic layout to include malayalam numbers + + include "ml(basic)" + + key <AE01> { [],[ 0x01000d67 , exclam ] }; + key <AE02> { [],[ 0x01000d68 , at ] }; + key <AE03> { [],[ 0x01000d69 , numbersign ] }; + key <AE04> { [],[ 0x01000d6a , dollar ] }; + key <AE05> { [],[ 0x01000d6b , percent ] }; + key <AE06> { [],[ 0x01000d6c , asciicircum ] }; + key <AE07> { [],[ 0x01000d6d , ampersand ] }; + key <AE08> { [],[ 0x01000d6e , 0x01000d7e ] }; + key <AE09> { [],[ 0x01000d6f , parenleft ] }; + key <AE10> { [],[ 0x01000d66 , parenright ] }; +}; Index: xc/programs/xkbcomp/symbols/mn diff -u /dev/null xc/programs/xkbcomp/symbols/mn:1.2 --- /dev/null Thu Feb 27 12:35:31 2003 +++ xc/programs/xkbcomp/symbols/mn Thu Jan 9 21:59:41 2003 @@ -0,0 +1,253 @@ +// Mongolian standard keyboard +// Author Sanlig Badral <badral@chinggis.com> +// 2002/12/7 Version 1.0 + +// $XFree86: xc/programs/xkbcomp/symbols/mn,v 1.2 2003/01/10 02:59:41 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + +// Describes the differences between a very simple en_US keyboard +// and a very simple Mongolian (cyrillic) keyboard + + name[Group1]= "Latin"; + name[Group2]= "Mongolian"; + + key.type = "THREE_LEVEL"; + + key <TLDE> {[ quoteleft, asciitilde, degree ], + [ equal, plus, degree ]}; + key <AE01> {[ 1, exclam, multiply ], + [ 1, numerosign, multiply ]}; + key <AE02> {[ 2, at, division ], + [ 2, minus, division ]}; + key <AE03> {[ 3, numbersign, plusminus ], + [ 3, quotedbl, plusminus ]}; + key <AE04> {[ 4, dollar, notsign ], + [ 4, 0x010020ae, notsign ]}; + key <AE05> {[ 5, percent, NoSymbol ], + [ 5, colon, NoSymbol ]}; + key <AE06> {[ 6, asciicircum, notequal ], + [ 6, period, notequal ]}; + key <AE07> {[ 7, ampersand, ampersand ], + [ 7, underscore, ampersand ]}; + key <AE08> {[ 8, asterisk, asterisk ], + [ 8, comma, asterisk ]}; + key <AE09> {[ 9, parenleft, bracketleft ], + [ 9, percent, bracketleft ]}; + key <AE10> {[ 0, parenright, bracketright ], + [ 0, question, bracketright ]}; + key <AE11> {[ minus, underscore, X ], + [ Cyrillic_ie, Cyrillic_IE, X ]}; + key <AE12> {[ equal, plus, L ], + [ Cyrillic_shcha, Cyrillic_SHCHA, L ]}; + + key <AD01> {[ q, Q, apostrophe ], + [ Cyrillic_ef, Cyrillic_EF, apostrophe ]}; + key <AD02> {[ w, W, grave ], + [ Cyrillic_tse, Cyrillic_TSE, grave ]}; + key <AD03> {[ e, E, EuroSign ], + [ Cyrillic_u, Cyrillic_U, EuroSign ]}; + key <AD04> {[ r, R, registered ], + [ Cyrillic_zhe, Cyrillic_ZHE, registered ]}; + key <AD05> {[ t, T, trademark ], + [ Cyrillic_e, Cyrillic_E, trademark ]}; + key <AD06> {[ y, Y, yen ], + [ Cyrillic_en, Cyrillic_EN, yen ]}; + key <AD07> {[ u, U, doublelowquotemark ], + [ Cyrillic_ghe, Cyrillic_GHE, doublelowquotemark ]}; + key <AD08> {[ i, I, leftdoublequotemark ], + [ Cyrillic_sha, Cyrillic_SHA, leftdoublequotemark ]}; + // mongolian (ue) straight u + key <AD09> {[ o, O, rightdoublequotemark ], + [ 0x010004af, 0x010004ae, rightdoublequotemark ]}; + key <AD10> {[ p, P, NoSymbol ], + [ Cyrillic_ze, Cyrillic_ZE, NoSymbol ]}; + key <AD11> {[ bracketleft, braceleft, braceleft ], + [ Cyrillic_ka, Cyrillic_KA, braceleft ]}; + key <AD12> {[ bracketright, braceright, braceright ], + [ Cyrillic_hardsign, Cyrillic_HARDSIGN, braceright ]}; + + key <AC01> {[ a, A, mu ], + [ Cyrillic_shorti, Cyrillic_SHORTI, mu ]}; + key <AC02> {[ s, S, sterling ], + [ Cyrillic_yeru, Cyrillic_YERU, sterling ]}; + key <AC03> {[ d, D, dollar ], + [ Cyrillic_be, Cyrillic_BE, dollar ]}; + //oe mongolian (oe) barred o + key <AC04> {[ f, F, cent ], + [ 0x010004e9, 0x010004e8, rightdoublequotemark ]}; + key <AC05> {[ g, G, Cyrillic_yeru ], + [ Cyrillic_a, Cyrillic_A, Cyrillic_yeru ]}; + key <AC06> {[ h, H, Cyrillic_YERU ], + [ Cyrillic_ha, Cyrillic_HA, Cyrillic_YERU ]}; + key <AC07> {[ j, J, Cyrillic_e ], + [ Cyrillic_er, Cyrillic_ER, Cyrillic_e ]}; + key <AC08> {[ k, K, Cyrillic_E ], + [ Cyrillic_o, Cyrillic_O, Cyrillic_E ]}; + key <AC09> {[ l, L, numerosign ], + [ Cyrillic_el, Cyrillic_EL, numerosign ]}; + key <AC10> {[ semicolon, colon, section ], + [ Cyrillic_de, Cyrillic_DE, section ]}; + key <AC11> {[ quoteright, quotedbl, ellipsis ], + [ Cyrillic_pe, Cyrillic_PE, ellipsis ]}; + key <BKSL> {[ backslash, bar, bar ], + [ exclam, bar, bar ]}; + + key <LSGT> {[ less, greater, NoSymbol ], + [ parenleft, parenright, NoSymbol ]}; + key <AB01> {[ z, Z, emdash ], + [ Cyrillic_ya, Cyrillic_YA, emdash ]}; + key <AB02> {[ x, X, endash ], + [ Cyrillic_che, Cyrillic_CHE, endash ]}; + key <AB03> {[ c, C, copyright ], + [ Cyrillic_io, Cyrillic_IO, copyright ]}; + key <AB04> {[ v, V, NoSymbol ], + [ Cyrillic_es, Cyrillic_ES, NoSymbol ]}; + key <AB05> {[ b, B, NoSymbol ], + [ Cyrillic_em, Cyrillic_EM, NoSymbol ]}; + key <AB06> {[ n, N, less ], + [ Cyrillic_i, Cyrillic_I, less ]}; + key <AB07> {[ m, M, greater ], + [ Cyrillic_te, Cyrillic_TE, greater ]}; + key <AB08> {[ comma, less, guillemotleft ], + [ Cyrillic_softsign, Cyrillic_SOFTSIGN, guillemotleft ]}; + key <AB09> {[ period, greater, guillemotright ], + [ Cyrillic_ve, Cyrillic_VE, guillemotright ]}; + key <AB10> {[ slash, question, backslash ], + [ Cyrillic_yu, Cyrillic_YU, backslash ]}; + + // End alphanumeric section + + key <SPCE> {[ space, space, nobreakspace ]}; + key <RALT> { type="TWO_LEVEL",[ Mode_switch, Multi_key ]}; + + // Begin modifier mappings + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; + +partial alphanumeric_keys +xkb_symbols "mn(basic)" { + + // Describes the differences between a very simple en_US keyboard + // and a very simple mongolian keyboard with publishing + // symbols in the third level. + + name[Group1]= "Latin"; + name[Group2]= "Mongolian"; + + key <TLDE> {[ quoteleft, asciitilde ], + [ equal, plus ]}; + key <AE01> {[ 1, exclam ], + [ 1, numerosign ]}; + key <AE02> {[ 2, at ], + [ 2, minus ]}; + key <AE03> {[ 3, numbersign ], + [ 3, quotedbl ]}; + key <AE04> {[ 4, dollar ], + [ 4, 0x010020ae ]}; + key <AE05> {[ 5, percent ], + [ 5, colon ]}; + key <AE06> {[ 6, asciicircum ], + [ 6, period ]}; + key <AE07> {[ 7, ampersand ], + [ 7, underscore ]}; + key <AE08> {[ 8, asterisk ], + [ 8, comma ]}; + key <AE09> {[ 9, parenleft ], + [ 9, percent ]}; + key <AE10> {[ 0, parenright ], + [ 0, question ]}; + key <AE11> {[ minus, underscore ], + [ Cyrillic_ie, Cyrillic_IE ]}; + key <AE12> {[ equal, plus ], + [ Cyrillic_shcha, Cyrillic_SHCHA ]}; + + key <AD01> {[ q, Q ], + [ Cyrillic_ef, Cyrillic_EF ]}; + key <AD02> {[ w, W ], + [ Cyrillic_tse, Cyrillic_TSE ]}; + key <AD03> {[ e, E ], + [ Cyrillic_u, Cyrillic_U ]}; + key <AD04> {[ r, R ], + [ Cyrillic_zhe, Cyrillic_ZHE ]}; + key <AD05> {[ t, T ], + [ Cyrillic_e, Cyrillic_E ]}; + key <AD06> {[ y, Y ], + [ Cyrillic_en, Cyrillic_EN ]}; + key <AD07> {[ u, U ], + [ Cyrillic_ghe, Cyrillic_GHE ]}; + key <AD08> {[ i, I ], + [ Cyrillic_sha, Cyrillic_SHA ]}; + // mongolian (ue) straight u + key <AD09> {[ o, O ], + [ 0x010004af, 0x010004ae ]}; + key <AD10> {[ p, P ], + [ Cyrillic_ze, Cyrillic_ZE ]}; + key <AD11> {[ bracketleft, braceleft ], + [ Cyrillic_ka, Cyrillic_KA ]}; + key <AD12> {[ bracketright, braceright ], + [ Cyrillic_hardsign, Cyrillic_HARDSIGN ]}; + + key <AC01> {[ a, A ], + [ Cyrillic_shorti, Cyrillic_SHORTI ]}; + key <AC02> {[ s, S ], + [ Cyrillic_yeru, Cyrillic_YERU ]}; + key <AC03> {[ d, D ], + [ Cyrillic_be, Cyrillic_BE ]}; + //oe mongolian (oe) barred o + key <AC04> {[ f, F ], + [ 0x010004e9, 0x010004e8 ]}; + key <AC05> {[ g, G ], + [ Cyrillic_a, Cyrillic_A ]}; + key <AC06> {[ h, H ], + [ Cyrillic_ha, Cyrillic_HA ]}; + key <AC07> {[ j, J ], + [ Cyrillic_er, Cyrillic_ER ]}; + key <AC08> {[ k, K ], + [ Cyrillic_o, Cyrillic_O ]}; + key <AC09> {[ l, L ], + [ Cyrillic_el, Cyrillic_EL ]}; + key <AC10> {[ semicolon, colon ], + [ Cyrillic_de, Cyrillic_DE ]}; + key <AC11> {[ quoteright, quotedbl ], + [ Cyrillic_pe, Cyrillic_PE ]}; + key <BKSL> {[ backslash, bar ], + [ parenleft, parenright ]}; + + key <LSGT> {[ less, greater ], + [ less, greater ]}; + key <AB01> {[ z, Z ], + [ Cyrillic_ya, Cyrillic_YA ]}; + key <AB02> {[ x, X ], + [ Cyrillic_che, Cyrillic_CHE ]}; + key <AB03> {[ c, C ], + [ Cyrillic_io, Cyrillic_IO ]}; + key <AB04> {[ v, V ], + [ Cyrillic_es, Cyrillic_ES ]}; + key <AB05> {[ b, B ], + [ Cyrillic_em, Cyrillic_EM ]}; + key <AB06> {[ n, N ], + [ Cyrillic_i, Cyrillic_I ]}; + key <AB07> {[ m, M ], + [ Cyrillic_te, Cyrillic_TE ]}; + key <AB08> {[ comma, less ], + [ Cyrillic_softsign, Cyrillic_SOFTSIGN ]}; + key <AB09> {[ period, greater ], + [ Cyrillic_ve, Cyrillic_VE ]}; + key <AB10> {[ slash, question ], + [ Cyrillic_yu, Cyrillic_YU ]}; + + key <RALT> {[ Alt_R, Meta_R ]}; + + // Begin modifier mappings + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; Index: xc/programs/xkbcomp/symbols/mt diff -u xc/programs/xkbcomp/symbols/mt:1.2 xc/programs/xkbcomp/symbols/mt:1.3 --- xc/programs/xkbcomp/symbols/mt:1.2 Mon Dec 17 15:00:47 2001 +++ xc/programs/xkbcomp/symbols/mt Thu Dec 12 23:18:03 2002 @@ -1,55 +1,43 @@ -// Maltese keyboard map (for UK-based keyboards) +// Maltese keyboard map (based on MSA Standard DMS100) // by Ramon Casha (ramon.casha@linux.org.mt) // -// $XFree86: xc/programs/xkbcomp/symbols/mt,v 1.2 2001/12/17 20:00:47 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/mt,v 1.3 2002/12/13 04:18:03 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { - // Describes the differences between a UK keyboard - // and a Maltese layout. + // Describes the differences between the en_GB + // keyboard and the Maltese keyboard. + include "gb(basic)" - name[Group1]= "Maltese (UK layout)"; + name[Group1]= "Maltese"; + + // the following four sets are the four additional letters (C. G. H- Z.) + // Group 2 contains the UK equivalents + key <TLDE> { [ cabovedot, Cabovedot ], + [ grave, notsign ] }; + key <AD11> { [ gabovedot, Gabovedot ], + [ bracketleft, braceleft ] }; + key <AD12> { [ hstroke, Hstroke ], + [ bracketright, braceright ] }; + key <LSGT> { [ zabovedot, Zabovedot ], + [ backslash, bar ] }; - // define the ^ as a deadkey for long accents (â). The use of - // long accents was officially dropped recently but there are - // still exists literature using it. - key <AE06> { - symbols[Group1]= [ 6, dead_circumflex ], - symbols[Group2]= [ asciicircum ] - }; - // define the grave accent as a deadkey for the ordinary accent (à). - key <TLDE> { - symbols[Group1]= [ dead_grave, notsign ], - symbols[Group2]= [ grave, bar ] - }; - // the following four sets are the four additional letters Å,Õ,¡,¯ (CGHZ) - key <AE12> { - symbols[Group1]= [ cabovedot, Cabovedot ], - symbols[Group2]= [ equal, plus ] - }; - key <AD11> { - symbols[Group1]= [ gabovedot, Gabovedot ], - symbols[Group2]= [ bracketleft, braceleft ] - }; - key <AD12> { - symbols[Group1]= [ hstroke, Hstroke ], - symbols[Group2]= [ bracketright, braceright ] - }; - key <LSGT> { - symbols[Group1]= [ zabovedot, Zabovedot ], - symbols[Group2]= [ backslash, bar ] - }; - // add Å Õ ¡ and ¯ as AltGr + C G H or Z for convenience. - key <AC05> { [], [ gabovedot, Gabovedot ] }; - key <AC06> { [], [ hstroke, Hstroke ] }; - key <AB01> { [], [ zabovedot, Zabovedot ] }; - key <AB03> { [], [ cabovedot, Cabovedot ] }; - // and the Euro sign as AltGr-E - key <AD03> { [], [ EuroSign ] }; + // Euro symbol + key <AE03> { [ 3, EuroSign ], + [ sterling ] }; + // Long accent + key <AE06> { [], [ dead_circumflex, dead_circumflex ] }; + // Normal accented vowels + key <AD03> { [], [ egrave, Egrave ] }; + key <AD07> { [], [ ugrave, Ugrave ] }; + key <AD08> { [], [ igrave, Igrave ] }; + key <AD09> { [], [ ograve, Ograve ] }; + key <AC01> { [], [ agrave, Agrave ] }; + // End alphanumeric section - + // begin modifier mappings modifier_map Shift { Shift_L }; Index: xc/programs/xkbcomp/symbols/mt_us diff -u xc/programs/xkbcomp/symbols/mt_us:1.1 xc/programs/xkbcomp/symbols/mt_us:1.2 --- xc/programs/xkbcomp/symbols/mt_us:1.1 Fri Aug 17 12:31:25 2001 +++ xc/programs/xkbcomp/symbols/mt_us Thu Dec 12 23:18:03 2002 @@ -1,51 +1,40 @@ -// Maltese keyboard map (for US-based keyboards) +// Maltese keyboard map (based on MSA Standard DMS100, annex A) // by Ramon Casha (ramon.casha@linux.org.mt) // -// $XFree86: xc/programs/xkbcomp/symbols/mt_us,v 1.1 2001/08/17 16:31:25 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/mt_us,v 1.2 2002/12/13 04:18:03 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { - // Describes the differences between a very simple en_US - // keyboard and the interim Maltese keyboard + // Describes the differences between the en_US + // keyboard and the Maltese keyboard. - name[Group1]= "Maltese"; + include "us(basic)" + name[Group1]= "Maltese (US layout)"; - // define the ^ as a deadkey for long accents (â). The use of - // long accents was officially dropped recently but there are - // still exists literature using it. - key <AE06> { - symbols[Group1]= [ 6, dead_circumflex ], - symbols[Group2]= [ asciicircum ] - }; - // define the grave accent as a deadkey for the ordinary accent (à). - key <TLDE> { - symbols[Group1]= [ dead_grave, asciitilde ], - symbols[Group2]= [ grave ] - }; - // the following four sets are the four additional letters Å,Õ,¡,¯ (CGHZ) - key <AE12> { - symbols[Group1]= [ cabovedot, Cabovedot ], - symbols[Group2]= [ equal, plus ] - }; - key <AD11> { - symbols[Group1]= [ gabovedot, Gabovedot ], - symbols[Group2]= [ bracketleft, braceleft ] - }; - key <AD12> { - symbols[Group1]= [ hstroke, Hstroke ], - symbols[Group2]= [ bracketright, braceright ] - }; - key <BKSL> { - symbols[Group1]= [ zabovedot, Zabovedot ], - symbols[Group2]= [ backslash, bar ] - }; - // add Å Õ ¡ and ¯ as AltGr + C G H or Z for convenience. - key <AC05> { [], [ gabovedot, Gabovedot ] }; - key <AC06> { [], [ hstroke, Hstroke ] }; - key <AB01> { [], [ zabovedot, Zabovedot ] }; - key <AB03> { [], [ cabovedot, Cabovedot ] }; - key <AD03> { [], [ EuroSign ] }; + // the following four sets are the four additional letters (C. G. H- Z.) + // Group 2 contains the UK equivalents + key <TLDE> { [ cabovedot, Cabovedot ], + [ grave, asciitilde ] }; + key <AD11> { [ gabovedot, Gabovedot ], + [ bracketleft, braceleft ] }; + key <AD12> { [ hstroke, Hstroke ], + [ bracketright, braceright ] }; + key <BKSL> { [ zabovedot, Zabovedot ], + [ backslash, bar ] }; + + // Euro symbol + key <AE03> { [ 3, EuroSign ], + [ numbersign ] }; + // Long accent + key <AE06> { [], [ dead_circumflex, dead_circumflex ] }; + + // Normal accented vowels + key <AD03> { [], [ egrave, Egrave ] }; + key <AD07> { [], [ ugrave, Ugrave ] }; + key <AD08> { [], [ igrave, Igrave ] }; + key <AD09> { [], [ ograve, Ograve ] }; + key <AC01> { [], [ agrave, Agrave ] }; // End alphanumeric section Index: xc/programs/xkbcomp/symbols/nl diff -u xc/programs/xkbcomp/symbols/nl:1.1 xc/programs/xkbcomp/symbols/nl:1.2 --- xc/programs/xkbcomp/symbols/nl:1.1 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/nl Tue Jun 4 18:50:58 2002 @@ -22,7 +22,7 @@ key <AE04> { [ 4, dollar ], [ onequarter ] }; key <AE05> { [ 5, percent ], - [ onehalf ] }; + [ EuroSign ] }; key <AE06> { [ 6, ampersand ], [ threequarters ] }; key <AE07> { [ 7, underscore ], Index: xc/programs/xkbcomp/symbols/no diff -u xc/programs/xkbcomp/symbols/no:3.9 xc/programs/xkbcomp/symbols/no:3.10 --- xc/programs/xkbcomp/symbols/no:3.9 Wed Jan 17 18:45:59 2001 +++ xc/programs/xkbcomp/symbols/no Wed Dec 18 20:07:54 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/no,v 3.9 2001/01/17 23:45:59 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/no,v 3.10 2002/12/19 01:07:54 dawes Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -75,7 +75,9 @@ [ dead_tilde, dead_caron ]}; - // End alphanumeric section + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Separator ] }; + // End "Keypad" section // begin modifier mappings Index: xc/programs/xkbcomp/symbols/ogham diff -u /dev/null xc/programs/xkbcomp/symbols/ogham:1.3 --- /dev/null Thu Feb 27 12:35:32 2003 +++ xc/programs/xkbcomp/symbols/ogham Mon Dec 30 21:07:04 2002 @@ -0,0 +1,206 @@ +// $XFree86: xc/programs/xkbcomp/symbols/ogham,v 1.3 2002/12/31 02:07:04 dawes Exp $ +// +// Ogham keyboard map for XFree86 +// +// Seamus O Ciardhuain <seoc@cnds.ucd.ie> (17 December 2002) +// +// Ogham keyboard layout as recommended in I.S. 434:1999. +// Suitable for multi-layout xkbcomp. +// Character names are given as in the Unicode standard, +// range U+1680 to U+169F. + + +default partial alphanumeric_keys +xkb_symbols "basic" { + + name[Group1] = "Ogham"; + + key.type[Group1] = "ONE_LEVEL"; + + key <LSGT> { type[Group1]="TWO_LEVEL", + [ 0x100169B, 0x100169C ] }; + // OGHAM FEATHER MARK, OGHAM REVERSED FEATHER MARK + + key <BKSL> { [ 0x1001680 ] }; // OGHAM SPACE MARK + + key <TLDE> { [ 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + + key <SPCE> { [ space ] }; + + // + // Top Row QWERTYUIOP + // + key <AD01> { [ 0x100168A ] }; // OGHAM LETTER CEIRT + key <AD02> { [ 0x1001695 ] }; // OGHAM LETTER EABHADH + key <AD03> { [ 0x1001693 ] }; // OGHAM LETTER EADHADH + key <AD04> { [ 0x100168F ] }; // OGHAM LETTER RUIS + key <AD05> { [ 0x1001688 ] }; // OGHAM LETTER TINNE + key <AD06> { [ 0x1001698 ] }; // OGHAM LETTER IFIN + key <AD07> { [ 0x1001692 ] }; // OGHAM LETTER UR + key <AD08> { [ 0x1001694 ] }; // OGHAM LETTER IODHADH + key <AD09> { [ 0x1001691 ] }; // OGHAM LETTER ONN + key <AD10> { [ 0x100169A ] }; // OGHAM LETTER PEITH + + // + // Middle Row ASDFGHJKL + // + key <AC01> { [ 0x1001690 ] }; // OGHAM LETTER AILM + key <AC02> { [ 0x1001684 ] }; // OGHAM LETTER SAIL + key <AC03> { [ 0x1001687 ] }; // OGHAM LETTER DAIR + key <AC04> { [ 0x1001683 ] }; // OGHAM LETTER FEARN + key <AC05> { [ 0x100168C ] }; // OGHAM LETTER GORT + key <AC06> { [ 0x1001686 ] }; // OGHAM LETTER UATH + key <AC07> { [ 0x1001697 ] }; // OGHAM LETTER UILLEANN + key <AC08> { [ 0x1001696 ] }; // OGHAM LETTER OR + key <AC09> { [ 0x1001682 ] }; // OGHAM LETTER LUIS + + // + // Bottom Row ZXCVBNM + // + key <AB01> { [ 0x100168E ] }; // OGHAM LETTER STRAIF + key <AB02> { [ 0x1001699 ] }; // OGHAM LETTER EAMHANCHOLL + key <AB03> { [ 0x1001689 ] }; // OGHAM LETTER COLL + key <AB04> { [ 0x100168D ] }; // OGHAM LETTER NGEADAL + key <AB05> { [ 0x1001681 ] }; // OGHAM LETTER BEITH + key <AB06> { [ 0x1001685 ] }; // OGHAM LETTER NION + key <AB07> { [ 0x100168B ] }; // OGHAM LETTER MUIN + + // As an extension because <BKSL> and <LSGT> may not be + // available or sensible. These are also a bit more + // intuitive on a standard Irish keyboard. + key <AB08> { [ 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + key <AB09> { [ 0x100169B ] }; // OGHAM FEATHER MARK + key <AB10> { [ 0x1001680 ] }; // OGHAM SPACE MARK + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "laptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ogham(basic)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "is434" { + + // This has the full layout of IS434 with an Irish QWERTY keyboard, + // and the Ogham characters accessed when CAPS LOCK is on. + + name[Group1] = "Ogham (IS434)"; + + key.type[Group1] = "THREE_LEVEL"; + + key <LSGT> { type[Group1] = "FOUR_LEVEL_ALPHABETIC", + [ backslash, bar, 0x100169B, 0x100169C ] }; + // OGHAM FEATHER MARK, OGHAM REVERSED FEATHER MARK + + key <BKSL> { [ numbersign, asciitilde, 0x1001680 ] }; // OGHAM SPACE MARK + key <TLDE> { [ grave, notsign, 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + key <SPCE> { [ space, space, space ] }; + + // + // Numeric row + // + key <AE01> { type[Group1]="TWO_LEVEL", [ 1, exclam ] }; + key <AE02> { type[Group1]="TWO_LEVEL", [ 2, quotedbl ] }; + key <AE03> { type[Group1]="TWO_LEVEL", [ 3, sterling ] }; + key <AE04> { [ 4, dollar, EuroSign ] }; + key <AE05> { type[Group1]="TWO_LEVEL", [ 5, percent ] }; + key <AE06> { type[Group1]="TWO_LEVEL", [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand, 0x100204A ] }; // Tironian Et + key <AE08> { type[Group1]="TWO_LEVEL", [ 8, asterisk ] }; + key <AE09> { type[Group1]="TWO_LEVEL", [ 9, parenleft ] }; + key <AE10> { type[Group1]="TWO_LEVEL", [ 0, parenright ] }; + key <AE11> { type[Group1]="TWO_LEVEL", [ minus, underscore ] }; + key <AE12> { type[Group1]="TWO_LEVEL", [ equal, plus ] }; + + // + // Top Row QWERTYUIOP + // + key <AD01> { [ q, Q, 0x100168A ] }; // OGHAM LETTER CEIRT + key <AD02> { [ w, W, 0x1001695 ] }; // OGHAM LETTER EABHADH + key <AD03> { [ e, E, 0x1001693 ] }; // OGHAM LETTER EADHADH + key <AD04> { [ r, R, 0x100168F ] }; // OGHAM LETTER RUIS + key <AD05> { [ t, T, 0x1001688 ] }; // OGHAM LETTER TINNE + key <AD06> { [ y, Y, 0x1001698 ] }; // OGHAM LETTER IFIN + key <AD07> { [ u, U, 0x1001692 ] }; // OGHAM LETTER UR + key <AD08> { [ i, I, 0x1001694 ] }; // OGHAM LETTER IODHADH + key <AD09> { [ o, O, 0x1001691 ] }; // OGHAM LETTER ONN + key <AD10> { [ p, P, 0x100169A ] }; // OGHAM LETTER PEITH + + // + // Middle Row ASDFGHJKL + // + key <AC01> { [ a, A, 0x1001690 ] }; // OGHAM LETTER AILM + key <AC02> { [ s, S, 0x1001684 ] }; // OGHAM LETTER SAIL + key <AC03> { [ d, D, 0x1001687 ] }; // OGHAM LETTER DAIR + key <AC04> { [ f, F, 0x1001683 ] }; // OGHAM LETTER FEARN + key <AC05> { [ g, G, 0x100168C ] }; // OGHAM LETTER GORT + key <AC06> { [ h, H, 0x1001686 ] }; // OGHAM LETTER UATH + key <AC07> { [ j, J, 0x1001697 ] }; // OGHAM LETTER UILLEANN + key <AC08> { [ k, K, 0x1001696 ] }; // OGHAM LETTER OR + key <AC09> { [ l, L, 0x1001682 ] }; // OGHAM LETTER LUIS + + // + // Bottom Row ZXCVBNM + // + key <AB01> { [ z, Z, 0x100168E ] }; // OGHAM LETTER STRAIF + key <AB02> { [ x, X, 0x1001699 ] }; // OGHAM LETTER EAMHANCHOLL + key <AB03> { [ c, C, 0x1001689 ] }; // OGHAM LETTER COLL + key <AB04> { [ v, V, 0x100168D ] }; // OGHAM LETTER NGEADAL + key <AB05> { [ b, B, 0x1001681 ] }; // OGHAM LETTER BEITH + key <AB06> { [ n, N, 0x1001685 ] }; // OGHAM LETTER NION + key <AB07> { [ m, M, 0x100168B ] }; // OGHAM LETTER MUIN + + // As an extension because <BKSL> and <LSGT> may not be + // available or sensible. These are also a bit more + // intuitive on a standard Irish keyboard. + key <AB08> { [ comma, less, 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + key <AB09> { [ period, greater, 0x100169B ] }; // OGHAM FEATHER MARK + key <AB10> { [ slash, question, 0x1001680 ] }; // OGHAM SPACE MARK + + // The standard says the Ogham characters should be accessed when + // Caps Lock is down; not clear if this means it should lock but + // seems logical. + + key <CAPS> { type[Group1] = "ONE_LEVEL", [ ISO_Level3_Lock ] }; + + // Also allow access to Ogham characters using RALT for convenience + key <RALT> { type[Group1] = "ONE_LEVEL", [ ISO_Level3_Shift ] }; + + modifier_map Mod5 { ISO_Level3_Shift, ISO_Level3_Lock }; + + // Redefine Scroll Lock as locking shift in case that's needed. + // Also overcomes annoying use of Scroll Lock LED inherited from + // US symbols but not relevant here since we're not changing group. + key <SCLK> {type[Group1] = "ONE_LEVEL", [ Shift_Lock ] }; + modifier_map Shift { Shift_Lock }; + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "IS434" { + // just has uppercase in the name + include "ogham(is434)" +}; + +partial alphanumeric_keys +xkb_symbols "is434laptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ogham(is434)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "IS434laptop" { + // just has uppercase in the name + include "ogham(is434)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; Index: xc/programs/xkbcomp/symbols/ori diff -u /dev/null xc/programs/xkbcomp/symbols/ori:1.1 --- /dev/null Thu Feb 27 12:35:32 2003 +++ xc/programs/xkbcomp/symbols/ori Sat Dec 14 19:44:56 2002 @@ -0,0 +1,71 @@ +// $XFree86: xc/programs/xkbcomp/symbols/ori,v 1.1 2002/12/15 00:44:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + // Inscript layout for Oriya + // Author: G Karunakar <karunakar@freedomink.org> + // Date: Wed Nov 13 18:16:19 IST 2002 + + name[Group2]= "Oriya"; + + key <TLDE> { [], [ 0x01000b4a, 0x01000b12 ] }; + key <AE01> { [], [ 0x01000b67, 0x01000b0d ] }; + key <AE02> { [], [ 0x01000b68, 0x01000b45 ] }; + key <AE03> { [], [ 0x01000b69 ] }; + key <AE04> { [], [ 0x01000b6a ] }; + key <AE05> { [], [ 0x01000b6b ] }; + key <AE06> { [], [ 0x01000b6c ] }; + key <AE07> { [], [ 0x01000b6d ] }; + key <AE08> { [], [ 0x01000b6e ] }; + key <AE09> { [], [ 0x01000b6f ] }; + key <AE10> { [], [ 0x01000b66 ] }; + key <AE11> { [], [ 0x01000b03 ] }; + key <AE12> { [], [ 0x01000b43, 0x01000b0b ] }; + + key <AD01> { [], [ 0x01000b4c, 0x01000b14 ] }; + key <AD02> { [], [ 0x01000b48, 0x01000b10 ] }; + key <AD03> { [], [ 0x01000b3e, 0x01000b06 ] }; + key <AD04> { [], [ 0x01000b40, 0x01000b08 ] }; + key <AD05> { [], [ 0x01000b42, 0x01000b0a ] }; + key <AD06> { [], [ 0x01000b2c, 0x01000b2d ] }; + key <AD07> { [], [ 0x01000b39, 0x01000b19 ] }; + key <AD08> { [], [ 0x01000b17, 0x01000b18 ] }; + key <AD09> { [], [ 0x01000b26, 0x01000b27 ] }; + key <AD10> { [], [ 0x01000b1c, 0x01000b1d ] }; + key <AD11> { [], [ 0x01000b21, 0x01000b22 ] }; + key <AD12> { [], [ 0x01000b3c, 0x01000b1e ] }; + + key <AC01> { [], [ 0x01000b4b, 0x01000b13 ] }; + key <AC02> { [], [ 0x01000b47, 0x01000b0f ] }; + key <AC03> { [], [ 0x01000b4d, 0x01000b05 ] }; + key <AC04> { [], [ 0x01000b3f, 0x01000b07 ] }; + key <AC05> { [], [ 0x01000b41, 0x01000b09 ] }; + key <AC06> { [], [ 0x01000b2a, 0x01000b2b ] }; + key <AC07> { [], [ 0x01000b30, 0x01000b31 ] }; + key <AC08> { [], [ 0x01000b15, 0x01000b16 ] }; + key <AC09> { [], [ 0x01000b24, 0x01000b25 ] }; + key <AC10> { [], [ 0x01000b1a, 0x01000b1b ] }; + key <AC11> { [], [ 0x01000b1f, 0x01000b20 ] }; + + key <AB01> { [], [ 0x01000b46, 0x01000b0e ] }; + key <AB02> { [], [ 0x01000b02, 0x01000b01 ] }; + key <AB03> { [], [ 0x01000b2e, 0x01000b23 ] }; + key <AB04> { [], [ 0x01000b28, 0x01000b29 ] }; + key <AB05> { [], [ 0x01000b35, 0x01000b34 ] }; + key <AB06> { [], [ 0x01000b32, 0x01000b33 ] }; + key <AB07> { [], [ 0x01000b38, 0x01000b36 ] }; + key <AB08> { [], [ comma , 0x01000b37 ] }; + key <AB09> { [], [ period , 0x01000b64 ] }; + key <AB10> { [], [ 0x01000b2f, 0x01000040 ] }; + key <BKSL> { [], [ 0x01000b49, 0x01000b11 ] }; + + key <RALT> { + symbols[Group1] = [ Mode_switch, Multi_key ], + virtualMods = AltGr + }; + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; Index: xc/programs/xkbcomp/symbols/pl2 diff -u xc/programs/xkbcomp/symbols/pl2:1.1 xc/programs/xkbcomp/symbols/pl2:1.2 --- xc/programs/xkbcomp/symbols/pl2:1.1 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/pl2 Wed Jan 29 17:30:21 2003 @@ -76,7 +76,7 @@ key <AB01> { [ y, Y ] }; key <AB02> { [ x, X ] }; - key <AB03> { [ C, C ] }; + key <AB03> { [ c, C ] }; key <AB04> { [ v, V ], [ at ] }; key <AB05> { [ b, B ], Index: xc/programs/xkbcomp/symbols/ro diff -u xc/programs/xkbcomp/symbols/ro:3.4 xc/programs/xkbcomp/symbols/ro:3.5 --- xc/programs/xkbcomp/symbols/ro:3.4 Fri Dec 21 16:03:59 2001 +++ xc/programs/xkbcomp/symbols/ro Tue Jun 4 18:50:58 2002 @@ -7,7 +7,7 @@ // Modified by Miºu Moldovan, <dumol@go.ro> (C) 2001 // Modified by Marius Andreiana, <mandreiana@yahoo.com> (C) 2001 // -// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.4 2001/12/21 21:03:59 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.5 2002/06/04 22:50:58 dawes Exp $ // Diacriticele se scriu cu ALT-ul din dreapta si q,t,i,a,s (+shift eventual) // @@ -34,3 +34,11 @@ modifier_map Mod3 { Mode_switch }; }; + +xkb_symbols "comma" { + include "ro(basic)" + + key <AC02> { [], [ 0x1000219, 0x1000218 ] }; + key <AD05> { [], [ 0x100021b, 0x100021a ] }; +}; + Index: xc/programs/xkbcomp/symbols/ro2 diff -u /dev/null xc/programs/xkbcomp/symbols/ro2:1.1 --- /dev/null Thu Feb 27 12:35:32 2003 +++ xc/programs/xkbcomp/symbols/ro2 Tue Jun 4 18:50:58 2002 @@ -0,0 +1,96 @@ +// symbols definition for Romanian Keyboard layout. +// +// Created by Derrick Jobidon, <globe99@rdstm.ro> (C) 2001 +// Inspired from modified US keyboard by Cristian Gafton +// +// $XFree86: xc/programs/xkbcomp/symbols/ro2,v 1.1 2002/06/04 22:50:58 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Romanian"; + + key <TLDE> { [ bracketright, bracketleft ] }; + key <AE01> { [ 1, exclam ], [ asciitilde, asciitilde ] }; + key <AE02> { [ 2, quotedbl ], [dead_caron, dead_caron ] }; + key <AE03> { [ 3, numbersign ], [dead_circumflex, dead_circumflex] }; + key <AE04> { [ 4, currency], [dead_breve, dead_breve] }; + key <AE05> { [ 5, percent], [ dead_abovering ] }; + key <AE06> { [ 6, ampersand], [ dead_ogonek ] }; + key <AE07> { [ 7, slash], [dead_grave, dead_grave] }; + key <AE08> { [ 8, parenleft], [ dead_abovedot ] }; + key <AE09> { [ 9, parenright], [dead_acute, dead_acute] }; + key <AE10> { [ 0, equal], [ dead_doubleacute ] }; + key <AE11> { [ plus, question], [dead_diaeresis, dead_diaeresis] }; + key <AE12> { [ quoteright, asterisk], [dead_cedilla] }; + key <BKSL> { [ acircumflex, Acircumflex] }; + key <AD01> { [ q, Q], [backslash, backslash] }; + key <AD02> { [ w, W], [bar, bar] }; + key <AD03> { [ e, E], [EuroSign, EuroSign] }; + key <AD04> { [ r, R], [registered, registered] }; + key <AD05> { [ t, T], [trademark, trademark] }; + key <AD06> { [ z, Z] }; + key <AD11> { [ abreve, Abreve], [division, division] }; + key <AD12> { [ icircumflex, Icircumflex], [multiply, multiply] }; + key <AC02> { [ s, S], [ dstroke, dstroke ] }; + key <AC03> { [ d, D], [ Dstroke, Dstroke ] }; + key <AC08> { [ k, K], [ lstroke, lstroke ] }; + key <AC09> { [ l, L], [ Lstroke, Lstroke ] }; + key <AC10> { [ scedilla, Scedilla], [dollar, dollar] }; + key <AC11> { [ tcediila, Tcedilla], [ ssharp, ssharp ] }; + key <AB01> { [ y, Y] }; + key <AB03> { [ c, C], [copyright, copyright] }; + key <AB04> { [ v, V], [at, at] }; + key <AB05> { [ b, B], [braceleft, braceleft] }; + key <AB06> { [ n, N], [braceright,braceright] }; + key <AB07> { [ m, M], [section, section] }; + key <AB08> { [ comma, semicolon], [less, less] }; + key <AB09> { [ period, colon], [greater, greater] }; + key <AB10> { [ minus, underscore] }; + +}; + +default +xkb_symbols "pc101" { + key <RALT> { [ Mode_switch, Multi_key ] }; + + include "ro(basic)" + + modifier_map Mod3 { Mode_switch }; +}; + +xkb_symbols "pc104" { + key <RALT> { [ Mode_switch ] }; + key <RWIN> { [ Multi_key ] }; + + include "ro(basic)" + + modifier_map Mod3 { Mode_switch }; +}; + +xkb_symbols "pc105" { + key <RALT> { [ Mode_switch ] }; + key <RWIN> { [ Multi_key ] }; + + include "ro(basic)" + + modifier_map Mod3 { Mode_switch }; +}; + +xkb_symbols "alt_is_meta" { + key <LALT> { [ Meta_L ] }; + key <LWIN> { [ Alt_L ] }; + + include "ro(pc104)" + + // modifier mappings + modifier_map Mod1 { Meta_L, Meta_R }; + modifier_map Mod4 { Alt_L, Alt_R }; +}; + +xkb_symbols "comma" { + include "ro(basic)" + + key <AC10> { [ 0x1000219, 0x1000218 ], [dollar, dollar] }; + key <AC11> { [ 0x100021b, 0x100021a ], [ ssharp, ssharp ] }; +}; + Index: xc/programs/xkbcomp/symbols/ru diff -u xc/programs/xkbcomp/symbols/ru:3.9 xc/programs/xkbcomp/symbols/ru:3.10 --- xc/programs/xkbcomp/symbols/ru:3.9 Wed Jan 16 13:20:12 2002 +++ xc/programs/xkbcomp/symbols/ru Sat Feb 15 17:27:05 2003 @@ -3,7 +3,7 @@ // russian standard keyboard // AEN <aen@logic.ru> // Last Changes 2001/12/23 by Leon Kanter <leon@blackcatlinux.com> -// $XFree86: xc/programs/xkbcomp/symbols/ru,v 3.9 2002/01/16 18:20:12 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/ru,v 3.10 2003/02/15 22:27:05 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -143,6 +143,8 @@ [ 8, asterisk ] }; key <AB10> { [ slash, question ], [ period, comma ] }; + key <BKSL> { [ backslash, bar ], + [ backslash, slash ] }; }; partial alphanumeric_keys Index: xc/programs/xkbcomp/symbols/se diff -u xc/programs/xkbcomp/symbols/se:3.8 xc/programs/xkbcomp/symbols/se:3.10 --- xc/programs/xkbcomp/symbols/se:3.8 Fri Aug 17 09:27:58 2001 +++ xc/programs/xkbcomp/symbols/se Wed Dec 18 20:07:54 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/se,v 3.8 2001/08/17 13:27:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/se,v 3.10 2002/12/19 01:07:54 dawes Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -29,7 +29,7 @@ key <AE04> { [ 4, currency ], [ dollar, onequarter ]}; key <AE05> { [ 5, percent ], - [ NoSymbol, cent ]}; + [ EuroSign, cent ]}; key <AE06> { [ 6, ampersand ], [ yen, NoSymbol ]}; key <AE07> { [ 7, slash ], @@ -77,7 +77,9 @@ [ dead_tilde, dead_caron ]}; - // End alphanumeric section + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Separator ] }; + // End "Keypad" section // begin modifier mappings Index: xc/programs/xkbcomp/symbols/si diff -u xc/programs/xkbcomp/symbols/si:1.1 xc/programs/xkbcomp/symbols/si:1.2 --- xc/programs/xkbcomp/symbols/si:1.1 Tue Feb 8 10:46:35 2000 +++ xc/programs/xkbcomp/symbols/si Tue Feb 4 20:38:36 2003 @@ -15,7 +15,7 @@ // Revision 1.2 2000/01/30 21:33:14 peterlin // Popravil neme znake na stevilcnih tipkah. Obesil "multiply" na Dstroke. // -// $XFree86: xc/programs/xkbcomp/symbols/si,v 1.1 2000/02/08 15:46:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/si,v 1.2 2003/02/05 01:38:36 dawes Exp $ default partial alphanumeric_keys xkb_symbols "basic" { @@ -95,6 +95,7 @@ key <AB10> { [ minus, underscore ] }; key <BKSL> { [ zcaron, Zcaron ], [ currency ] }; + key <KPDL> { [ KP_Delete, KP_Separator ] }; key <RALT> { [ Mode_switch, Multi_key ] }; // End alphanumeric section Index: xc/programs/xkbcomp/symbols/sk diff -u xc/programs/xkbcomp/symbols/sk:1.3 xc/programs/xkbcomp/symbols/sk:1.4 --- xc/programs/xkbcomp/symbols/sk:1.3 Mon Dec 24 17:23:10 2001 +++ xc/programs/xkbcomp/symbols/sk Mon Sep 16 14:06:21 2002 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/symbols/sk,v 1.3 2001/12/24 22:23:10 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/sk,v 1.4 2002/09/16 18:06:21 eich Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -125,10 +125,14 @@ key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; - // This certainly shouldn't be 'comma'. Something like KP_DecimalComma - // would be better but there's no such definition in keysyms. - key <KPDL> { type="FOUR_LEVEL_KEYPAD", [ KP_Delete, comma, - KP_Delete, KP_Decimal] }; +// KP_Separator should produce a comma as KP_Decimal produces a "." +// independent of the locale selected. + key <KPDL> { type="FOUR_LEVEL_KEYPAD", [ KP_Delete, KP_Separator, + KP_Delete, KP_Decimal], + // hack a decimal dot into the second (US) group + // Martin Vidner <mvidner@suse.cz> + [ KP_Delete, KP_Decimal, + KP_Delete, KP_Separator] }; key <RALT> { type="TWO_LEVEL", [ ISO_Level3_Shift, ISO_Level3_Shift ] }; modifier_map Mod5 { <RALT> }; Index: xc/programs/xkbcomp/symbols/srvr_ctrl diff -u /dev/null xc/programs/xkbcomp/symbols/srvr_ctrl:1.2 --- /dev/null Thu Feb 27 12:35:32 2003 +++ xc/programs/xkbcomp/symbols/srvr_ctrl Mon Feb 10 21:51:10 2003 @@ -0,0 +1,108 @@ +// $XFree86: xc/programs/xkbcomp/symbols/srvr_ctrl,v 1.2 2003/02/11 02:51:10 dawes Exp $ +// +// Actions which control the server's behavior + +partial keypad_keys function_keys +xkb_symbols "xfree86" { + include "srvr_ctrl(stdkeypad)" + include "srvr_ctrl(fkey2vt)" +}; + +partial keypad_keys +xkb_symbols "stdkeypad" { + + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; + +// Ungrab cancels server/keyboard/pointer grabs + key <KPDV> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Divide, XF86_Ungrab ] + }; + +// ClsGrb kills whichever client has a grab in effect + key <KPMU> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Multiply, XF86_ClearGrab ] + }; + +// -VMode switches to the previous video mode + key <KPSU> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Subtract, XF86_Prev_VMode ] + }; + +// +VMode switches to the next video mode + key <KPAD> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Add, XF86_Next_VMode] + }; + +}; + +partial function_keys +xkb_symbols "fkey2vt" { + + key <FK01> { + type="CTRL+ALT", + symbols[Group1]= [ F1, XF86_Switch_VT_1 ] + }; + + key <FK02> { + type="CTRL+ALT", + symbols[Group1]= [ F2, XF86_Switch_VT_2 ] + }; + + key <FK03> { + type="CTRL+ALT", + symbols[Group1]= [ F3, XF86_Switch_VT_3 ] + }; + + key <FK04> { + type="CTRL+ALT", + symbols[Group1]= [ F4, XF86_Switch_VT_4 ] + }; + + key <FK05> { + type="CTRL+ALT", + symbols[Group1]= [ F5, XF86_Switch_VT_5 ] + }; + + key <FK06> { + type="CTRL+ALT", + symbols[Group1]= [ F6, XF86_Switch_VT_6 ] + }; + + key <FK07> { + type="CTRL+ALT", + symbols[Group1]= [ F7, XF86_Switch_VT_7 ] + }; + + key <FK08> { + type="CTRL+ALT", + symbols[Group1]= [ F8, XF86_Switch_VT_8 ] + }; + + key <FK09> { + type="CTRL+ALT", + symbols[Group1]= [ F9, XF86_Switch_VT_9 ] + }; + + key <FK10> { + type="CTRL+ALT", + symbols[Group1]= [ F10, XF86_Switch_VT_10 ] + }; + + key <FK11> { + type="CTRL+ALT", + symbols[Group1]= [ F11, XF86_Switch_VT_11 ] + }; + + key <FK12> { + type="CTRL+ALT", + symbols[Group1]= [ F12, XF86_Switch_VT_12 ] + }; + +}; Index: xc/programs/xkbcomp/symbols/syr diff -u /dev/null xc/programs/xkbcomp/symbols/syr:1.2 --- /dev/null Thu Feb 27 12:35:33 2003 +++ xc/programs/xkbcomp/symbols/syr Wed Feb 26 14:02:24 2003 @@ -0,0 +1,72 @@ +// +// $XFree86: xc/programs/xkbcomp/symbols/syr,v 1.2 2003/02/26 19:02:24 dawes Exp $ +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Syriac"; + + key <TLDE> { [ 0x100070F, 0x100032E, Arabic_shadda ] }; + key <AE01> { [ 1, exclam, 0x1000701 ] }; + key <AE02> { [ 2, 0x100030A, 0x1000702 ] }; + key <AE03> { [ 3, 0x1000325, 0x1000703 ] }; + key <AE04> { [ 4, 0x1000749, 0x1000704 ] }; + key <AE05> { [ 5, 0x1002670, 0x1000705 ] }; + key <AE06> { [ 6, 0x1002671, 0x1000708 ] }; + key <AE07> { [ 7, 0x100070A, 0x1000709 ] }; + key <AE08> { [ 8, 0x10000BB, 0x100070B ] }; + key <AE09> { [ 9, parenright, 0x100070C ] }; + key <AE10> { [ 0, parenleft, 0x100070D ] }; + key <AE11> { [ minus, 0x10000AB, 0x100250C ] }; + key <AE12> { [ equal, plus, 0x1002510 ] }; + + key <AD01> { [ 0x1000714, 0x1000730, Arabic_fatha ] }; + key <AD02> { [ 0x1000728, 0x1000733, Arabic_fathatan ] }; + key <AD03> { [ 0x1000716, 0x1000736, Arabic_damma ] }; + key <AD04> { [ 0x1000729, 0x100073A, Arabic_dammatan ] }; + key <AD05> { [ 0x1000726, 0x100073D, Arabic_madda_above ] }; + key <AD06> { [ 0x100071C, 0x1000740, Arabic_hamza_above ] }; + key <AD07> { [ 0x1000725, 0x1000741, 0x1000747 ] }; + key <AD08> { [ 0x1000717, 0x1000308, 0x1000743 ] }; + key <AD09> { [ 0x100071E, 0x1000304, 0x1000745 ] }; + key <AD10> { [ 0x100071A, 0x1000307, 0x100032D ] }; + key <AD11> { [ 0x1000713, 0x1000303 ] }; + key <AD12> { [ 0x1000715, 0x100074A ] }; + key <BKSL> { [ 0x1000706, colon ] }; + + key <AC01> { [ 0x100072B, 0x1000731, Arabic_kasra ] }; + key <AC02> { [ 0x1000723, 0x1000734, Arabic_kasratan ] }; + key <AC03> { [ 0x100071D, 0x1000737 ] }; + key <AC04> { [ 0x1000712, 0x100073B, Arabic_hamza ] }; + key <AC05> { [ 0x1000720, 0x100073E, Arabic_hamza_below ] }; + key <AC06> { [ 0x1000710, 0x1000711, Arabic_superscript_alef ] }; + key <AC07> { [ 0x100072C, Arabic_tatweel, 0x1000748 ] }; + key <AC08> { [ 0x1000722, 0x1000324, 0x1000744 ] }; + key <AC09> { [ 0x1000721, 0x1000331, 0x1000746 ] }; + key <AC10> { [ 0x100071F, 0x1000323 ] }; + key <AC11> { [ 0x100071B, 0x1000330 ] }; + + key <SPCE> { [ space, 0x100200c ] }; + key <AB01> { [ bracketright, 0x1000732, Arabic_sukun ] }; + key <AB02> { [ bracketleft, 0x1000735 ] }; + key <AB03> { [ 0x1000724, 0x1000738, 0x100200D ] }; + key <AB04> { [ 0x100072A, 0x100073C, 0x100200C ] }; + key <AB05> { [ 0x1000727, 0x100073F, 0x100200E ] }; + key <AB06> { [ 0x1000700, 0x1000739, 0x100200F ] }; + key <AB07> { [ 0x100002E, 0x1000742 ] }; + key <AB08> { [ 0x1000718, Arabic_comma ] }; + key <AB09> { [ 0x1000719, Arabic_semicolon ] }; + key <AB10> { [ 0x1000707, Arabic_question_mark ] }; + + // End Alphanumeric Section + + + // Begin Modifier Mappings + + modifier_map Shift { Shift_L, Shift_R }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L, Control_R }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod2 { Mode_switch }; + +}; Index: xc/programs/xkbcomp/symbols/syr_phonetic diff -u /dev/null xc/programs/xkbcomp/symbols/syr_phonetic:1.2 --- /dev/null Thu Feb 27 12:35:33 2003 +++ xc/programs/xkbcomp/symbols/syr_phonetic Wed Feb 26 14:02:24 2003 @@ -0,0 +1,72 @@ +// +// $XFree86: xc/programs/xkbcomp/symbols/syr_phonetic,v 1.2 2003/02/26 19:02:24 dawes Exp $ +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Syriac(phonetic)"; + + key <TLDE> { [ 0x100070F, 0x100032E, Arabic_shadda ] }; + key <AE01> { [ 1, exclam, 0x1000701 ] }; + key <AE02> { [ 2, 0x100030A, 0x1000702 ] }; + key <AE03> { [ 3, 0x1000325, 0x1000703 ] }; + key <AE04> { [ 4, 0x1000749, 0x1000704 ] }; + key <AE05> { [ 5, 0x1002670, 0x1000705 ] }; + key <AE06> { [ 6, 0x1002671, 0x1000708 ] }; + key <AE07> { [ 7, 0x100070A, 0x1000709 ] }; + key <AE08> { [ 8, 0x10000BB, 0x100070B ] }; + key <AE09> { [ 9, parenright, 0x100070C ] }; + key <AE10> { [ 0, parenleft, 0x100070D ] }; + key <AE11> { [ minus, 0x10000AB, 0x100250C ] }; + key <AE12> { [ equal, plus, 0x1002510 ] }; + + key <AD01> { [ 0x1000729, 0x1000730, Arabic_fatha ] }; + key <AD02> { [ 0x1000718, 0x1000733, Arabic_fathatan ] }; + key <AD03> { [ 0x1000716, 0x1000736, Arabic_damma ] }; + key <AD04> { [ 0x100072A, 0x100073A, Arabic_dammatan ] }; + key <AD05> { [ 0x100072C, 0x100073D, Arabic_madda_above ] }; + key <AD06> { [ 0x100071D, 0x1000740, Arabic_hamza_above ] }; + key <AD07> { [ 0x100071C, 0x1000741, 0x1000747 ] }; + key <AD08> { [ 0x1000725, 0x1000308, 0x1000743 ] }; + key <AD09> { [ 0x1000727, 0x1000304, 0x1000745 ] }; + key <AD10> { [ 0x1000726, 0x1000307, 0x100032D ] }; + key <AD11> { [ bracketright, 0x1000303 ] }; + key <AD12> { [ bracketleft, 0x100074A ] }; + key <BKSL> { [ 0x1000706, colon ] }; + + key <AC01> { [ 0x1000710, 0x1000731, Arabic_kasra ] }; + key <AC02> { [ 0x1000723, 0x1000734, Arabic_kasratan ] }; + key <AC03> { [ 0x1000715, 0x1000737 ] }; + key <AC04> { [ 0x1000714, 0x100073B, Arabic_hamza ] }; + key <AC05> { [ 0x1000713, 0x100073E, Arabic_hamza_below ] }; + key <AC06> { [ 0x1000717, 0x1000711, Arabic_superscript_alef ] }; + key <AC07> { [ 0x100071B, Arabic_tatweel, 0x1000748 ] }; + key <AC08> { [ 0x100071F, 0x1000324, 0x1000744 ] }; + key <AC09> { [ 0x1000720, 0x1000331, 0x1000746 ] }; + key <AC10> { [ 0x100071A, 0x1000323 ] }; + key <AC11> { [ 0x100071E, 0x1000330 ] }; + + key <SPCE> { [ space, 0x100200c ] }; + key <AB01> { [ 0x1000719, 0x1000732, Arabic_sukun ] }; + key <AB02> { [ 0x1000728, 0x1000735 ] }; + key <AB03> { [ 0x1000724, 0x1000738, 0x100200D ] }; + key <AB04> { [ 0x100072B, 0x100073C, 0x100200C ] }; + key <AB05> { [ 0x1000712, 0x100073F, 0x100200E ] }; + key <AB06> { [ 0x1000722, 0x1000739, 0x100200F ] }; + key <AB07> { [ 0x1000721, 0x1000742 ] }; + key <AB08> { [ 0x1000700, Arabic_comma ] }; + key <AB09> { [ 0x100002E, Arabic_semicolon ] }; + key <AB10> { [ 0x1000707, Arabic_question_mark ] }; + + // End Alphanumeric Section + + + // Begin Modifier Mappings + + modifier_map Shift { Shift_L, Shift_R }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L, Control_R }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod2 { Mode_switch }; + +}; Index: xc/programs/xkbcomp/symbols/tel diff -u /dev/null xc/programs/xkbcomp/symbols/tel:1.1 --- /dev/null Thu Feb 27 12:35:33 2003 +++ xc/programs/xkbcomp/symbols/tel Sat Dec 14 19:44:56 2002 @@ -0,0 +1,74 @@ +// $XFree86: xc/programs/xkbcomp/symbols/tel,v 1.1 2002/12/15 00:44:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Inscript layout for Telugu using Unicode + // Author: G Karunakar <karunakar@freedomink.org> + // Date: + // See layout at http://www.indlinux.org/keymap/telugu.php + + name[Group2]= "Telugu"; + + key <TLDE> { [], [ 0x01000c4a, 0x01000c12 ] }; + key <AE01> { [], [ 0x01000c67, 0x01000c0d ] }; + key <AE02> { [], [ 0x01000c68, 0x01000c45 ] }; + key <AE03> { [], [ 0x01000c69, numbersign ] }; + key <AE04> { [], [ 0x01000c6a, dollar ] }; + key <AE05> { [], [ 0x01000c6b, percent ] }; + key <AE06> { [], [ 0x01000c6c, asciicircum ] }; + key <AE07> { [], [ 0x01000c6d, ampersand ] }; + key <AE08> { [], [ 0x01000c6e, asterisk ] }; + key <AE09> { [], [ 0x01000c6f, parenleft ] }; + key <AE10> { [], [ 0x01000c66, parenright ] }; + key <AE11> { [], [ 0x01000c03, underscore ] }; + key <AE12> { [], [ 0x01000c43, 0x01000c0b ] }; + key <BKSP> { [], [ BackSpace ] }; + + key <AD01> { [], [ 0x01000c4c, 0x01000c14 ] }; + key <AD02> { [], [ 0x01000c48, 0x01000c10 ] }; + key <AD03> { [], [ 0x01000c3e, 0x01000c06 ] }; + key <AD04> { [], [ 0x01000c40, 0x01000c08 ] }; + key <AD05> { [], [ 0x01000c42, 0x01000c0a ] }; + key <AD06> { [], [ 0x01000c2c, 0x01000c2d ] }; + key <AD07> { [], [ 0x01000c39, 0x01000c19 ] }; + key <AD08> { [], [ 0x01000c17, 0x01000c18 ] }; + key <AD09> { [], [ 0x01000c26, 0x01000c27 ] }; + key <AD10> { [], [ 0x01000c1c, 0x01000c1d ] }; + key <AD11> { [], [ 0x01000c21, 0x01000c22 ] }; + key <AD12> { [], [ 0x01000c3c, 0x01000c1e ] }; + + key <AC01> { [], [ 0x01000c4b, 0x01000c13 ] }; + key <AC02> { [], [ 0x01000c47, 0x01000c0f ] }; + key <AC03> { [], [ 0x01000c4d, 0x01000c05 ] }; + key <AC04> { [], [ 0x01000c3f, 0x01000c07 ] }; + key <AC05> { [], [ 0x01000c41, 0x01000c09 ] }; + key <AC06> { [], [ 0x01000c2a, 0x01000c2b ] }; + key <AC07> { [], [ 0x01000c30, 0x01000c31 ] }; + key <AC08> { [], [ 0x01000c15, 0x01000c16 ] }; + key <AC09> { [], [ 0x01000c24, 0x01000c25 ] }; + key <AC10> { [], [ 0x01000c1a, 0x01000c1b ] }; + key <AC11> { [], [ 0x01000c1f, 0x01000c20 ] }; + + key <AB01> { [], [ 0x01000c46, 0x01000c0e ] }; + key <AB02> { [], [ 0x01000c02, 0x01000c01 ] }; + key <AB03> { [], [ 0x01000c2e, 0x01000c23 ] }; + key <AB04> { [], [ 0x01000c28, 0x01000c29 ] }; + key <AB05> { [], [ 0x01000c35, 0x01000c34 ] }; + key <AB06> { [], [ 0x01000c32, 0x01000c33 ] }; + key <AB07> { [], [ 0x01000c38, 0x01000c36 ] }; + key <AB08> { [], [ comma , 0x01000c37 ] }; + key <AB09> { [], [ period , 0x01000c64 ] }; + key <AB10> { [], [ 0x01000c2f, 0x01000040 ] }; + key <BKSL> { [], [ 0x01000c49, 0x01000c11 ] }; + + key <RALT> { + symbols[Group1] = [ Mode_switch , Multi_key ], + virtualMods = AltGr + }; + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; Index: xc/programs/xkbcomp/symbols/ua diff -u xc/programs/xkbcomp/symbols/ua:1.2 xc/programs/xkbcomp/symbols/ua:1.3 --- xc/programs/xkbcomp/symbols/ua:1.2 Mon Jan 14 13:30:11 2002 +++ xc/programs/xkbcomp/symbols/ua Sat Feb 15 17:27:05 2003 @@ -1,7 +1,7 @@ // ukrainian standard keyboard // AEN <aen@logic.ru> & Leon Kanter <leon@geon.donetsk.ua> // Last Changes 2001/12/11 by Andriy Rysin <arysin@yahoo.com> -// $XFree86: xc/programs/xkbcomp/symbols/ua,v 1.2 2002/01/14 18:30:11 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/ua,v 1.3 2003/02/15 22:27:05 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -139,6 +139,8 @@ [ 8, asterisk ] }; key <AB10> { [ slash, question ], [ period, comma ] }; + key <BKSL> { [ backslash, bar ], + [ backslash, slash ] }; // key <AC02> { [ s, S ], // [ Ukrainian_i, Ukrainian_I ] }; Index: xc/programs/xkbcomp/symbols/us diff -u xc/programs/xkbcomp/symbols/us:3.11 xc/programs/xkbcomp/symbols/us:3.12 --- xc/programs/xkbcomp/symbols/us:3.11 Fri Aug 17 09:27:58 2001 +++ xc/programs/xkbcomp/symbols/us Tue Nov 19 23:49:03 2002 @@ -6,7 +6,7 @@ // uses the punctuation keys configurations common on PC // keyboards (e.g. key <ABO9> is { [ period greater ] }) -// $XFree86: xc/programs/xkbcomp/symbols/us,v 3.11 2001/08/17 13:27:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us,v 3.12 2002/11/20 04:49:03 dawes Exp $ partial hidden alphanumeric_keys modifier_keys xkb_symbols "basic" { @@ -28,7 +28,10 @@ key <AE10> { [ 0, parenright ] }; key <AE11> { [ minus, underscore ] }; key <AE12> { [ equal, plus ] }; - key <BKSP> { [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; key <TAB> { [ Tab, ISO_Left_Tab ] }; key <AD01> { [ q, Q ] }; @@ -86,6 +89,7 @@ // defines the "extra" (right) modifier keys, function keys, cursor, // edit, and keypad keys. xkb_symbols "generic101" { + include "srvr_ctrl(xfree86)" include "us(basic)" key <RTSH> { [ Shift_R ] }; key <LALT> { [ Alt_L ] }; Index: xc/programs/xkbcomp/symbols/us_group2 diff -u xc/programs/xkbcomp/symbols/us_group2:1.1 xc/programs/xkbcomp/symbols/us_group2:1.3 --- xc/programs/xkbcomp/symbols/us_group2:1.1 Mon Oct 1 10:04:16 2001 +++ xc/programs/xkbcomp/symbols/us_group2 Tue Nov 19 23:49:03 2002 @@ -10,7 +10,7 @@ // use mainly in cz* and sk* keyboards. // Modified by Jan Holesovsky <kendy@suse.cz>, 2001 -// $XFree86: xc/programs/xkbcomp/symbols/us_group2,v 1.1 2001/10/01 14:04:16 eich Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us_group2,v 1.3 2002/11/20 04:49:03 dawes Exp $ partial hidden alphanumeric_keys modifier_keys xkb_symbols "basic" { @@ -32,7 +32,10 @@ key <AE10> { [], [ 0, parenright ] }; key <AE11> { [], [ minus, underscore ] }; key <AE12> { [], [ equal, plus ] }; - key <BKSP> { [], [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group2]= [ BackSpace, Terminate_Server ] + }; key <TAB> { [], [ Tab, ISO_Left_Tab ] }; key <AD01> { [], [ q, Q ] }; @@ -76,7 +79,7 @@ key <BKSL> { [], [ backslash, bar ] }; key <LCTL> { [], [ Control_L ] }; - key <SPCE> { [], [ space ] }; + key <SPCE> { [], [ space, space ] }; // End alphanumeric section // begin modifier mappings Index: xc/programs/xkbcomp/symbols/us_group3 diff -u xc/programs/xkbcomp/symbols/us_group3:1.2 xc/programs/xkbcomp/symbols/us_group3:1.4 --- xc/programs/xkbcomp/symbols/us_group3:1.2 Thu Jun 15 16:34:15 2000 +++ xc/programs/xkbcomp/symbols/us_group3 Mon Nov 25 09:05:06 2002 @@ -4,7 +4,7 @@ // so that the US keyboard would show as Group 3 on the keymap. // I am reachable at eric_moreau@compuserve.com // -// $XFree86: xc/programs/xkbcomp/symbols/us_group3,v 1.2 2000/06/15 20:34:15 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us_group3,v 1.4 2002/11/25 14:05:06 eich Exp $ // // Original Header follows: // @@ -36,7 +36,10 @@ key <AE10> { [], [], [ 0, parenright ] }; key <AE11> { [], [], [ minus, underscore ] }; key <AE12> { [], [], [ equal, plus ] }; - key <BKSP> { [], [], [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group3]= [ BackSpace, Terminate_Server ] + }; key <TAB> { [], [], [ Tab, ISO_Left_Tab ] }; key <AD01> { [], [], [ q, Q ] }; @@ -278,3 +281,7 @@ include "us_group3(pc104compose)" key <LSGT> { [], [], [ less, greater ] }; }; +// Override broken Numlock key on some IBM keyboards +xkb_symbols "ibm_space_saver" { + key <NMLK> { [ Num_Lock, Num_Lock ] }; +}; Index: xc/programs/xkbcomp/symbols/us_intl diff -u xc/programs/xkbcomp/symbols/us_intl:1.4 xc/programs/xkbcomp/symbols/us_intl:1.5 --- xc/programs/xkbcomp/symbols/us_intl:1.4 Fri Nov 2 18:29:34 2001 +++ xc/programs/xkbcomp/symbols/us_intl Thu Apr 4 09:05:59 2002 @@ -1,5 +1,5 @@ // -// $XFree86: xc/programs/xkbcomp/symbols/us_intl,v 1.4 2001/11/02 23:29:34 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us_intl,v 1.5 2002/04/04 14:05:59 eich Exp $ // // Dead-keys definition for a very simple US/ASCII layout. // by Conectiva (http://www.conectiva.com.br) @@ -41,21 +41,21 @@ key <AC11> { [ dead_acute, dead_diaeresis ], [ apostrophe, quotedbl ] }; - key <AE09> { [ 9, parenleft ] + key <AE09> { [ 9, parenleft ], [ dead_breve, dead_breve ] }; - key <AE10> { [ 0, parenright ] + key <AE10> { [ 0, parenright ], [ dead_abovering, dead_abovering ] }; key <AE11> { [ minus, underscore ], [ dead_macron, dead_belowdot ] }; key <AE12> { [ equal, plus ], [ dead_doubleacute, dead_horn ] }; - key <AC10> { [ semicolon, colon ] + key <AC10> { [ semicolon, colon ], [ dead_ogonek, dead_diaeresis ] }; - key <AB08> { [ comma, less ] + key <AB08> { [ comma, less ], [ dead_cedilla, dead_caron ] }; - key <AB09> { [ period, greater ] + key <AB09> { [ period, greater ], [ dead_abovedot, dead_circumflex ] }; - key <AB10> { [ slash, question ] + key <AB10> { [ slash, question ], [ dead_hook, dead_hook ] }; Index: xc/programs/xkbcomp/symbols/vn diff -u xc/programs/xkbcomp/symbols/vn:1.3 xc/programs/xkbcomp/symbols/vn:1.5 --- xc/programs/xkbcomp/symbols/vn:1.3 Wed Nov 21 17:28:52 2001 +++ xc/programs/xkbcomp/symbols/vn Mon Feb 3 21:32:48 2003 @@ -15,7 +15,7 @@ // aclark (2000-07-27) // I've modified this to refer to the correct keysyms in the server // -// $XFree86: xc/programs/xkbcomp/symbols/vn,v 1.3 2001/11/21 22:28:52 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/vn,v 1.5 2003/02/04 02:32:48 dawes Exp $ partial modifier_keys xkb_symbols "toggle" { @@ -29,6 +29,8 @@ partial default alphanumeric_keys xkb_symbols "basic" { + include "srvr_ctrl(xfree86)" + name[Group1]= "US/ASCII"; name[Group2]= "Vietnamese"; @@ -61,8 +63,10 @@ [ minus, underscore ] }; key <AE12> { [ equal, plus ], [ equal, plus ] }; - key <BKSP> { [ BackSpace ], - [ BackSpace ] }; + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; key <TAB> { [ Tab, ISO_Left_Tab ], [ Tab, ISO_Left_Tab ] }; Index: xc/programs/xkbcomp/symbols/macintosh/us diff -u xc/programs/xkbcomp/symbols/macintosh/us:1.6 xc/programs/xkbcomp/symbols/macintosh/us:1.7 --- xc/programs/xkbcomp/symbols/macintosh/us:1.6 Wed Oct 3 03:44:23 2001 +++ xc/programs/xkbcomp/symbols/macintosh/us Tue Oct 15 21:29:41 2002 @@ -1,10 +1,8 @@ // $XConsortium: macintosh /main/10 1996/01/29 19:54:54 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/macintosh/us,v 1.6 2001/10/03 07:44:23 alanh Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/macintosh/us,v 1.7 2002/10/16 01:29:41 dawes Exp $ +// symbols definition for a Macintosh "Extended" keyboard -// some symbols need a special charset, most symbols not added yet -// /dev/busy - xkb_symbols "extended" { name[Group1]= "US/ASCII"; @@ -12,40 +10,26 @@ // Alphanumeric section key <TLDE> { [ quoteleft, asciitilde ] }; - key <LSGT> { [ quoteleft, asciitilde ] }; - key <AE01> { [ 1, exclam ], - [exclamdown, slash ] }; - key <AE02> { [ 2, at ], - [ trademark, eth ] }; - key <AE03> { [ 3, numbersign ], - [ sterling ] }; - key <AE04> { [ 4, dollar ], - [ cent ] }; - key <AE05> { [ 5, percent ], - [ infinity ] }; - key <AE06> { [ 6, asciicircum ], - [ section ] }; - key <AE07> { [ 7, ampersand ], - [ paragraph ] }; - key <AE08> { [ 8, asterisk ], - [periodcentered ] }; - key <AE09> { [ 9, parenleft ], - [ordfeminine ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; key <AE10> { [ 0, parenright ] }; key <AE11> { [ minus, underscore ] }; - key <AE12> { [ equal, plus ], - [ notequal, plusminus ] }; + key <AE12> { [ equal, plus ] }; key <BKSP> { [ BackSpace ] }; - key <TAB> { [ Tab, ISO_Left_Tab ] }; - key <AD01> { [ q, Q ], - [ oe, OE ] }; + key <TAB> { [ Tab, ISO_Left_Tab ] }; + key <AD01> { [ q, Q ] }; key <AD02> { [ w, W ] }; key <AD03> { [ e, E ] }; - key <AD04> { [ r, R ], - [registered ] }; - key <AD05> { [ t, T ], - [ dagger ] }; + key <AD04> { [ r, R ] }; + key <AD05> { [ t, T ] }; key <AD06> { [ y, Y ] }; key <AD07> { [ u, U ] }; key <AD08> { [ i, I ] }; @@ -53,40 +37,29 @@ key <AD10> { [ p, P ] }; key <AD11> { [ bracketleft, braceleft ] }; key <AD12> { [ bracketright, braceright ] }; - key <BKSL> { [ backslash, bar ], - [guillemotleft,guillemotright ] }; + key <BKSL> { [ backslash, bar ] }; key <CAPS> { [ Caps_Lock ] }; - key <AC01> { [ a, A ], - [ aring, Aring ] }; - key <AC02> { [ s, S ], - [ ssharp, Iacute ] }; - key <AC03> { [ d, D ], - [ eth, Icircumflex ] }; - key <AC04> { [ f, F ], - [ Idiaeresis ] }; - key <AC05> { [ g, G ], - [ copyright ] }; + key <AC01> { [ a, A ] }; + key <AC02> { [ s, S ] }; + key <AC03> { [ d, D ] }; + key <AC04> { [ f, F ] }; + key <AC05> { [ g, G ] }; key <AC06> { [ h, H ] }; key <AC07> { [ j, J ] }; key <AC08> { [ k, K ] }; - key <AC09> { [ l, L ], - [ notsign, Ograve ] }; + key <AC09> { [ l, L ] }; key <AC10> { [ semicolon, colon ] }; - key <AC11> { [ quoteright, quotedbl ], - [ ae, AE ] }; + key <AC11> { [ quoteright, quotedbl ] }; key <RTRN> { [ Return ] }; key <AB01> { [ z, Z ] }; key <AB02> { [ x, X ] }; - key <AB03> { [ c, C ], - [ ccedilla, Ccedilla ] }; + key <AB03> { [ c, C ] }; key <AB04> { [ v, V ] }; key <AB05> { [ b, B ] }; - key <AB06> { [ n, N ], - [asciitilde ] }; - key <AB07> { [ m, M ], - [ mu, Acircumflex ] }; + key <AB06> { [ n, N ] }; + key <AB07> { [ m, M ] }; key <AB08> { [ comma, less ] }; key <AB09> { [ period, greater ] }; key <AB10> { [ slash, question ] }; @@ -95,87 +68,134 @@ // End alphanumeric section // Begin "Function" section - key <FK01> { [ F1 ] }; - key <FK02> { [ F2 ] }; - key <FK03> { [ F3 ] }; - key <FK04> { [ F4 ] }; - key <FK05> { [ F5 ] }; - key <FK06> { [ F6 ] }; - key <FK07> { [ F7 ] }; - key <FK08> { [ F8 ] }; - key <FK09> { [ F9 ] }; - key <FK10> { [ F10 ] }; - key <FK11> { [ F11 ] }; - key <FK12> { [ F12 ] }; - key <FK13> { [ Print ] }; - key <FK14> { [ Scroll_Lock ] }; - key <FK15> { [ Pause ] }; + key <FK01> { [ F1 ] }; + key <FK02> { [ F2 ] }; + key <FK03> { [ F3 ] }; + key <FK04> { [ F4 ] }; + key <FK05> { [ F5 ] }; + key <FK06> { [ F6 ] }; + key <FK07> { [ F7 ] }; + key <FK08> { [ F8 ] }; + key <FK09> { [ F9 ] }; + key <FK10> { [ F10 ] }; + key <FK11> { [ F11 ] }; + key <FK12> { [ F12 ] }; + key <FK13> { [ Print ] }; + key <FK14> { [ Scroll_Lock ] }; + key <FK15> { [ Pause ] }; // End "Function" section // Begin "Editing" section - key <INS> { [ Insert ] }; - key <HOME> { [ Home ] }; - key <PGUP> { [ Prior ] }; - key <DELE> { [ Delete ] }; - key <END> { [ End ] }; - key <PGDN> { [ Next ] }; - - key <UP> { [ Up ] }; - key <LEFT> { [ Left ] }; - key <DOWN> { [ Down ] }; - key <RGHT> { [ Right ] }; + key <INS> { [ Insert ] }; + key <HOME> { [ Home ] }; + key <PGUP> { [ Prior ] }; + key <DELE> { [ Delete ] }; + key <END> { [ End ] }; + key <PGDN> { [ Next ] }; + + key <UP> { [ Up ] }; + key <LEFT> { [ Left ] }; + key <DOWN> { [ Down ] }; + key <RGHT> { [ Right ] }; // End "Editing" section // Begin "Keypad" section - key <NMLK> { [ Num_Lock ] }; - key <KPEQ> { [ equal ] }; - key <KPDV> { [ KP_Divide ] }; - key <KPMU> { [ KP_Multiply ] }; - - key <KP7> { [ KP_7 , KP_Home ] }; - key <KP8> { [ KP_8 , KP_Up ] }; - key <KP9> { [ KP_9 , KP_Prior ] }; - key <KPSU> { [ KP_Subtract ] }; - - key <KP4> { [ KP_4 , KP_Left ] }; - key <KP5> { [ KP_5 , KP_Begin ] }; - key <KP6> { [ KP_6 , KP_Right ] }; - key <KPAD> { [ KP_Add ] }; - - key <KP1> { [ KP_1 , KP_End ] }; - key <KP2> { [ KP_2 , KP_Down ] }; - key <KP3> { [ KP_3 , KP_Next ] }; - key <KPEN> { [ KP_Enter ] }; + key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] }; + key <KPEQ> { [ equal ] }; + key <KPDV> { [ KP_Divide ] }; + key <KPMU> { [ KP_Multiply ] }; + + key <KP7> { [ KP_7, KP_Home ] }; + key <KP8> { [ KP_8, KP_Up ] }; + key <KP9> { [ KP_9, KP_Prior ] }; + key <KPSU> { [ KP_Subtract ] }; + + key <KP4> { [ KP_4, KP_Left ] }; + key <KP5> { [ KP_5, KP_Begin ] }; + key <KP6> { [ KP_6, KP_Right ] }; + key <KPAD> { [ KP_Add ] }; + + key <KP1> { [ KP_1, KP_End ] }; + key <KP2> { [ KP_2, KP_Down ] }; + key <KP3> { [ KP_3, KP_Next ] }; + key <KPEN> { [ KP_Enter ] }; - key <KP0> { [ KP_0 , KP_Insert ] }; - key <KPDL> { [ KP_Decimal , KP_Delete ] }; + key <KP0> { [ KP_0, KP_Insert ] }; + key <KPDL> { [ KP_Decimal, KP_Delete ] }; // End "Keypad" section - // Begin modifier mappings -// key <LMTA> { [ Meta_L ] }; - key <LFSH> { [ Shift_L ] }; - key <LCTL> { [ Control_L ] }; - key <LALT> { [ Alt_L ] }; - key <RALT> { [ Mode_switch, Multi_key ] }; - key <RTSH> { [ Shift_R ] }; - key <RCTL> { [ Control_R ] }; + // Begin "Modifier" section + key <LFSH> { [ Shift_L ] }; + key <RTSH> { [ Shift_R ] }; + key <LCTL> { [ Control_L ] }; + key <RCTL> { [ Control_R ] }; + key <LALT> { [ Alt_L ] }; + key <RALT> { [ Alt_R ] }; + key <LWIN> { [ Meta_L ] }; + key <WWIN> { [ Meta_R ] }; + // End "Modifier" section - // End modifier mappings // begin modifier mappings modifier_map Shift { Shift_L , Shift_R }; modifier_map Lock { Caps_Lock }; modifier_map Control{ Control_L, Control_R }; -// modifier_map Mod1 { Meta_L, Meta_R }; -// modifier_map Mod2 { Alt_L, Alt_R }; -// modifier_map Mod4 { Num_Lock }; -// modifier_map Mod1 { Alt_L, Alt_R }; - modifier_map Mod2 { Num_Lock }; modifier_map Mod1 { Alt_L, Alt_R }; -// modifier_map Mod4 { Meta_L, Meta_R }; - modifier_map Mod3 { Mode_switch }; + modifier_map Mod2 { Num_Lock }; + modifier_map Mod4 { Meta_L, Meta_R }; + modifier_map Mod5 { Scroll_Lock }; // end modifier mappings +// *** FIXME +// key <LSGT> { [ quoteleft, asciitilde ] }; +// key <AE01> { [ 1, exclam ], +// [exclamdown, slash ] }; +// key <AE02> { [ 2, at ], +// [ trademark, eth ] }; +// key <AE03> { [ 3, numbersign ], +// [ sterling ] }; +// key <AE04> { [ 4, dollar ], +// [ cent ] }; +// key <AE05> { [ 5, percent ], +// [ infinity ] }; +// key <AE06> { [ 6, asciicircum ], +// [ section ] }; +// key <AE07> { [ 7, ampersand ], +// [ paragraph ] }; +// key <AE08> { [ 8, asterisk ], +// [periodcentered ] }; +// key <AE09> { [ 9, parenleft ], +// [ordfeminine ] }; +// key <AE12> { [ equal, plus ], +// [ notequal, plusminus ] }; +// key <AD01> { [ q, Q ], +// [ oe, OE ] }; +// key <AD04> { [ r, R ], +// [registered ] }; +// key <AD05> { [ t, T ], +// [ dagger ] }; +// key <BKSL> { [ backslash, bar ], +// [guillemotleft,guillemotright ] }; +// key <AC01> { [ a, A ], +// [ aring, Aring ] }; +// key <AC02> { [ s, S ], +// [ ssharp, Iacute ] }; +// key <AC03> { [ d, D ], +// eth, Icircumflex ] }; +// key <AC04> { [ f, F ], +// [ Idiaeresis ] }; +// key <AC05> { [ g, G ], +// [ copyright ] }; +// key <AC09> { [ l, L ], +// [ notsign, Ograve ] }; +// key <AC11> { [ quoteright, quotedbl ], +// [ ae, AE ] }; +// key <AB03> { [ c, C ], +// [ ccedilla, Ccedilla ] }; +// key <AB06> { [ n, N ], +// [asciitilde ] }; +// key <AB07> { [ m, M ], +// [ mu, Acircumflex ] }; +// key <RALT> { [ Mode_switch, Multi_key ] }; +// modifier_map Mod3 { Mode_switch }; - }; - Index: xc/programs/xkbcomp/symbols/pc/Imakefile diff -u /dev/null xc/programs/xkbcomp/symbols/pc/Imakefile:1.10 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/Imakefile Sat Jan 25 21:38:14 2003 @@ -0,0 +1,29 @@ +XCOMM +XCOMM $XFree86: xc/programs/xkbcomp/symbols/pc/Imakefile,v 1.10 2003/01/26 02:38:14 dawes Exp $ +XCOMM + + DATAFILES = al am ar \ + be ben bg br by \ + cz cz_qwerty \ + de dev dk dvorak \ + ee el en_US es \ + fi fr fr-latin9 \ + gb ge_la ge_ru guj gur \ + hr \ + ie il il_phonetic ir is it iu \ + kan \ + la latin lo lt lv \ + mk ml mm mt mt_us \ + nl no \ + ogham ori \ + pc pl pl2 pt \ + ro ru \ + sapmi se si sk sk_qwerty sr syr syr_phonetic \ + tel th tj tml tr \ + ua us \ + yu + +all:: + +InstallMultiple($(DATAFILES),$(LIBDIR)/xkb/symbols/pc) +DependTarget() Index: xc/programs/xkbcomp/symbols/pc/al diff -u /dev/null xc/programs/xkbcomp/symbols/pc/al:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/al Thu Nov 21 23:03:28 2002 @@ -0,0 +1,46 @@ + +// based on +// albanian keyboard layout +// done by Pablo Saratxaga <pablo@mandrakesoft.com> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/al,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type3)" + + name[Group1]="Albanian"; + + key <AE01> { [ 1, exclam, asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl, dead_caron, oneeighth ] }; + key <AE03> { [ 3, numbersign, dead_circumflex, sterling ] }; + key <AE04> { [ 4, dollar, dead_breve, dollar ] }; + key <AE05> { [ 5, percent, dead_abovering, threeeighths] }; + key <AE06> { [ 6, asciicircum, dead_ogonek, fiveeighths ] }; + key <AE07> { [ 7, ampersand, grave, dead_grave ] }; + key <AE08> { [ 8, asterisk, dead_abovedot, trademark ] }; + key <AE09> { [ 9, parenleft, dead_acute, plusminus ] }; + key <AE10> { [ 0, parenright, dead_doubleacute, degree ] }; + key <AE11> { [ minus, underscore, dead_diaeresis, questiondown] }; + + key <AD03> { [ e, E, EuroSign, EuroSign ] }; + key <AD11> { [ ccedilla, Ccedilla, division, dead_abovering ] }; + key <AD12> { [ at, apostrophe, multiply, dead_macron ] }; + + key <AC02> { [ s, S, dstroke, section ] }; + key <AC03> { [ d, D, Dstroke, ETH ] }; + key <AC10> { [ediaeresis, Ediaeresis, dollar, dead_doubleacute ] }; + key <AC11> { [bracketleft, braceleft, ssharp, dead_caron ] }; + key <TLDE> { [ backslash, bar, notsign, notsign ] }; + + key <BKSL> { [bracketright, braceright, currency, dead_breve ] }; + key <AB08> { [ comma, semicolon, less, multiply ] }; + key <AB09> { [ period, colon, greater, division ] }; + key <AB10> { [ slash, question, dead_belowdot, dead_abovedot ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; + +}; Index: xc/programs/xkbcomp/symbols/pc/am diff -u /dev/null xc/programs/xkbcomp/symbols/pc/am:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/am Thu Nov 21 23:03:28 2002 @@ -0,0 +1,66 @@ + +// based on a keyboard map from an 'xkb/symbols/am' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/am,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Armenian"; + + // Alphanumeric section + key <TLDE> { [ 0x100055d, 0x100055c ] }; + key <LSGT> { [ question, 0x100058a ] }; + key <BKSL> { [ guillemotright, guillemotleft ] }; + + key <AE01> { [ 0x1000586, 0x1000556 ] }; + key <AE02> { [ 0x1000571, 0x1000541 ] }; + key <AE03> { [ 0x1002013, 0x1002014 ] }; + key <AE04> { [ comma, dollar ] }; + key <AE05> { [ 0x1000589, 0x1002026 ] }; + key <AE06> { [ 0x100055e, percent ] }; + key <AE07> { [ period, 0x1000587 ] }; + key <AE08> { [ 0x100055b, 0x10002bc ] }; + key <AE09> { [ parenright, parenleft ] }; + key <AE10> { [ 0x1000585, 0x1000555 ] }; + key <AE11> { [ 0x1000567, 0x1000537 ] }; + key <AE12> { [ 0x1000572, 0x1000542 ] }; + + + key <AD01> { [ 0x1000573, 0x1000543 ] }; + key <AD02> { [ 0x1000583, 0x1000553 ] }; + key <AD03> { [ 0x1000562, 0x1000532 ] }; + key <AD04> { [ 0x100057d, 0x100054d ] }; + key <AD05> { [ 0x1000574, 0x1000544 ] }; + key <AD06> { [ 0x1000578, 0x1000548 ] }; + key <AD07> { [ 0x1000582, 0x1000552 ] }; + key <AD08> { [ 0x100056f, 0x100053f ] }; + key <AD09> { [ 0x1000568, 0x1000538 ] }; + key <AD10> { [ 0x1000569, 0x1000539 ] }; + key <AD11> { [ 0x100056e, 0x100053e ] }; + key <AD12> { [ 0x1000581, 0x1000551 ] }; + + key <AC01> { [ 0x100057b, 0x100054b ] }; + key <AC02> { [ 0x100057e, 0x100054e ] }; + key <AC03> { [ 0x1000563, 0x1000533 ] }; + key <AC04> { [ 0x1000565, 0x1000535 ] }; + key <AC05> { [ 0x1000561, 0x1000531 ] }; + key <AC06> { [ 0x1000576, 0x1000546 ] }; + key <AC07> { [ 0x100056b, 0x100053b ] }; + key <AC08> { [ 0x100057f, 0x100054f ] }; + key <AC09> { [ 0x1000570, 0x1000540 ] }; + key <AC10> { [ 0x100057a, 0x100054a ] }; + key <AC11> { [ 0x1000580, 0x1000550 ] }; + + key <AB01> { [ 0x100056a, 0x100053a ] }; + key <AB02> { [ 0x1000564, 0x1000534 ] }; + key <AB03> { [ 0x1000579, 0x1000549 ] }; + key <AB04> { [ 0x1000575, 0x1000545 ] }; + key <AB05> { [ 0x1000566, 0x1000536 ] }; + key <AB06> { [ 0x100056c, 0x100053c ] }; + key <AB07> { [ 0x1000584, 0x1000554 ] }; + key <AB08> { [ 0x100056d, 0x100053d ] }; + key <AB09> { [ 0x1000577, 0x1000547 ] }; + key <AB10> { [ 0x100057c, 0x100054c ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/ar diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ar:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/ar Thu Nov 21 23:03:28 2002 @@ -0,0 +1,142 @@ + +// based on a keyboard map from an 'xkb/symbols/ar' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ar,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Arabic"; + +// NOTES: +// +// there is also combined shadda diacritis in AltGr position of simple +// diacritics fatha, fathatan, damma, dammatan, kasra and kasratan +// should a third state be added to Group2 ? +// + + key <TLDE> { [ Arabic_thal, Arabic_shadda ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <AD01> { [ Arabic_dad, Arabic_fatha ] }; + key <AD02> { [ Arabic_sad, Arabic_fathatan ] }; + key <AD03> { [ Arabic_theh, Arabic_damma ] }; + key <AD04> { [ Arabic_qaf, Arabic_dammatan ] }; + key <AD05> { [ Arabic_feh, 0x100fef9 ] }; + key <AD06> { [ Arabic_ghain, Arabic_hamzaunderalef ] }; + key <AD07> { [ Arabic_ain, grave ] }; + key <AD08> { [ Arabic_ha, division ] }; + key <AD09> { [ Arabic_khah, multiply ] }; + key <AD10> { [ Arabic_hah, Arabic_semicolon ] }; + key <AD11> { [ Arabic_jeem, braceleft ] }; + key <AD12> { [ Arabic_dal, braceright ] }; + + key <AC01> { [ Arabic_sheen, backslash ] }; + key <AC02> { [ Arabic_seen, S ] }; + key <AC03> { [ Arabic_yeh, bracketleft ] }; + key <AC04> { [ Arabic_beh, bracketright ] }; + key <AC05> { [ Arabic_lam, 0x100fef7 ] }; + key <AC06> { [ Arabic_alef, Arabic_hamzaonalef ] }; + key <AC07> { [ Arabic_teh, Arabic_tatweel ] }; + key <AC08> { [ Arabic_noon, Arabic_comma ] }; + key <AC09> { [ Arabic_meem, slash ] }; + key <AC10> { [ Arabic_kaf, colon ] }; + key <AC11> { [ Arabic_tah, quotedbl ] }; + key <BKSL> { [ less, greater ] }; + + key <LSGT> { [ bar, brokenbar ] }; + key <AB01> { [Arabic_hamzaonyeh, asciitilde ] }; + key <AB02> { [ Arabic_hamza, Arabic_sukun ] }; + key <AB03> { [Arabic_hamzaonwaw, Arabic_kasra ] }; + key <AB04> { [ Arabic_ra, Arabic_kasratan ] }; + key <AB05> { [ 0x100fefb, 0x100fef5 ] }; + key <AB06> { [Arabic_alefmaksura, Arabic_maddaonalef ] }; + key <AB07> { [Arabic_tehmarbuta, apostrophe ] }; + key <AB08> { [ Arabic_waw, comma ] }; + key <AB09> { [ Arabic_zain, period ] }; + key <AB10> { [ Arabic_zah, Arabic_question_mark ] }; + + // End alphanumeric section +}; + +partial alphanumeric_keys +xkb_symbols "qwerty" { + include "pc/ar(basic)" +}; + +partial alphanumeric_keys +xkb_symbols "azerty" { + include "pc/ar(basic)" + + // the north african arabic keyboard differs from the middle east one + // by the numeric row; it follows French keyboard style + // + // PROBLEM: some chars are inaccessible: ! @ # $ % ^ * + // should they go elsewhere? replace " ' that are now in double ? + // also, dead_circumflex and dead_diaeresis from French keyboard + // as well as ugrave are missing, which questions the utility of the + // other accentuated latin letters. Maybe this is useful only with + // a French keyboard in Group1 ? Then, shouldn't Group1 be filled ? + + key <AE01> { [ ampersand, 1 ] }; + key <AE02> { [ eacute, 2 ] }; + key <AE03> { [ quotedbl, 3 ] }; + key <AE04> { [ apostrophe, 4 ] }; + key <AE05> { [ parenleft, 5 ] }; + key <AE06> { [ minus, 6 ] }; + key <AE07> { [ egrave, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ ccedilla, 9 ] }; + key <AE10> { [ agrave, 0 ] }; + key <AE11> { [ parenright, degree ] }; +}; + +partial alphanumeric_keys +xkb_symbols "digits" { + include "pc/ar(basic)" + + // use arabic script digits + + key <AE01> { [ 0x1000661, exclam ] }; + key <AE02> { [ 0x1000662, at ] }; + key <AE03> { [ 0x1000663, numbersign ] }; + key <AE04> { [ 0x1000664, dollar ] }; + key <AE05> { [ 0x1000665, percent ] }; + key <AE06> { [ 0x1000666, asciicircum ] }; + key <AE07> { [ 0x1000667, ampersand ] }; + key <AE08> { [ 0x1000668, asterisk ] }; + key <AE09> { [ 0x1000669, parenleft ] }; + key <AE10> { [ 0x1000660, parenright ] }; +}; + +partial alphanumeric_keys +xkb_symbols "qwerty_digits" { + include "pc/ar(digits)" +}; + +partial alphanumeric_keys +xkb_symbols "azerty_digits" { + include "pc/ar(azerty)" + + key <AE01> { [ ampersand, 0x1000661 ] }; + key <AE02> { [ eacute, 0x1000662 ] }; + key <AE03> { [ quotedbl, 0x1000663 ] }; + key <AE04> { [ apostrophe, 0x1000664 ] }; + key <AE05> { [ parenleft, 0x1000665 ] }; + key <AE06> { [ minus, 0x1000666 ] }; + key <AE07> { [ egrave, 0x1000667 ] }; + key <AE08> { [ underscore, 0x1000668 ] }; + key <AE09> { [ ccedilla, 0x1000669 ] }; + key <AE10> { [ agrave, 0x1000660 ] }; +}; + Index: xc/programs/xkbcomp/symbols/pc/be diff -u /dev/null xc/programs/xkbcomp/symbols/pc/be:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/be Thu Nov 21 23:03:28 2002 @@ -0,0 +1,99 @@ + +// based on a keyboard map from an 'xkb/symbols/be' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/be,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Belgian"; + + key <AE01> { [ ampersand, 1, bar, exclamdown ] }; + key <AE02> { [ eacute, 2, at, oneeighth ] }; + key <AE03> { [ quotedbl, 3, numbersign, sterling ] }; + key <AE04> { [apostrophe, 4, onequarter, dollar ] }; + key <AE05> { [ parenleft, 5, onehalf, threeeighths ] }; + key <AE06> { [ section, 6, asciicircum, fiveeighths ] }; + key <AE07> { [ egrave, 7, braceleft, seveneighths ] }; + key <AE08> { [ exclam, 8, bracketleft, trademark ] }; + key <AE09> { [ ccedilla, 9, braceleft, plusminus ] }; + key <AE10> { [ agrave, 0, braceright, degree ] }; + key <AE11> { [parenright, degree, backslash, questiondown ] }; + key <AE12> { [ minus, underscore, dead_cedilla, dead_ogonek ] }; + + key <AD01> { [ a, A, at, Greek_OMEGA ] }; + key <AD02> { [ z, Z, lstroke, Lstroke ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD11> { [dead_circumflex, dead_diaeresis, bracketleft, dead_abovering ] }; + key <AD12> { [ dollar, asterisk, bracketright, dead_macron ] }; + + key <AC01> { [ q, Q, ae, AE ] }; + key <AC10> { [ m, M, dead_acute, dead_doubleacute ] }; + key <AC11> { [ ugrave, percent, dead_acute, dead_caron ] }; + key <TLDE> { [twosuperior, threesuperior, notsign, notsign ] }; + + key <BKSL> { [ mu, sterling, dead_grave, dead_breve ] }; + key <AB01> { [ w, W, guillemotleft, less ] }; + key <AB07> { [ comma, question, dead_cedilla, masculine ] }; + key <AB08> { [ semicolon, period, horizconnector, multiply ] }; + key <AB09> { [ colon, slash, periodcentered, division ] }; + key <AB10> { [ equal, plus, dead_tilde, dead_abovedot] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "iso-alternate" { + include "pc/be(basic)" + + key <AD01> { [ a, A, ae, AE ] }; + key <AD02> { [ z, Z, guillemotleft, less ] }; + key <AC01> { [ q, Q, at, Greek_OMEGA ] }; + key <AC10> { [ m, M, mu, masculine ] }; + key <AB01> { [ w, W, lstroke, Lstroke ] }; + key <AB07> { [ comma, question, dead_cedilla, dead_doubleacute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + // Use the Sun dead keys + + include "pc/be(basic)" + + key <AD11> { [SunFA_Circum, SunFA_Diaeresis, bracketleft, bracketleft] }; + key <AC11> { [ ugrave, percent, SunFA_Acute, SunFA_Acute ] }; + key <BKSL> { [ mu, sterling, SunFA_Grave, SunFA_Grave ] }; + key <AB07> { [ comma, question, SunFA_Cedilla, SunFA_Cedilla] }; + key <AB10> { [ equal, plus, SunFA_Tilde, SunFA_Tilde ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + + // Use the Sun dead keys + + include "pc/be(Sundeadkeys)" + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Eliminates dead keys from the basic Belgian layout + + include "pc/be(basic)" + + key <AE12> { [ minus, underscore, cedilla, ogonek ] }; + key <AD11> { [asciicircum, diaeresis, bracketleft, bracketleft] }; + key <AD12> { [ dollar, asterisk, bracketright, macron ] }; + key <AC10> { [ m, M, acute, doubleacute ] }; + key <AC11> { [ ugrave, percent, quoteright, quoteright ] }; + key <BKSL> { [ mu, sterling, quoteleft, quoteleft ] }; + key <AB07> { [ comma, question, cedilla, masculine ] }; + key <AB10> { [ equal, plus, asciitilde, asciitilde ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/ben diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ben:1.3 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/ben Mon Feb 3 20:52:08 2003 @@ -0,0 +1,143 @@ + +// based on a keyboard map from an 'xkb/symbols/ben' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ben,v 1.3 2003/02/04 01:52:08 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Bengali"; + + // Mainly numbers. + key <AE01> { [ 0x10009E7 ] }; + key <AE02> { [ 0x10009E8 ] }; + key <AE03> { [ 0x10009E9 ] }; + key <AE04> { [ 0x10009EA ] }; + key <AE05> { [ 0x10009EB ] }; + key <AE06> { [ 0x10009EC ] }; + key <AE07> { [ 0x10009ED ] }; + key <AE08> { [ 0x10009EE ] }; + key <AE09> { [ 0x10009EF, parenleft ] }; + key <AE10> { [ 0x10009E6, parenright ] }; + key <AE11> { [ minus, 0x1000983 ] }; + key <AE12> { [ 0x100098B, 0x10009C3 ] }; + +// Mainly long vowels + + key <AD01> { [ 0x10009CC, 0x1000994 ] }; + key <AD02> { [ 0x10009C8, 0x1000990 ] }; + key <AD03> { [ 0x10009BE, 0x1000986 ] }; + key <AD04> { [ 0x10009C0, 0x1000988 ] }; + key <AD05> { [ 0x10009C2, 0x100098A ] }; + +// Mainly voiced consonants + + key <AD06> { [ 0x10009AC, 0x10009AD ] }; + key <AD07> { [ 0x10009B9, 0x1000999 ] }; + key <AD08> { [ 0x1000997, 0x1000998 ] }; + key <AD09> { [ 0x10009A6, 0x10009A7 ] }; + key <AD10> { [ 0x100099C, 0x100099D ] }; + key <AD11> { [ 0x10009A1, 0x10009A2 ] }; + key <AD12> { [ 0x10009BC, 0x100099E ] }; + +// Mainly short vowels + key <AC01> { [ 0x10009CB, 0x1000993 ] }; + key <AC02> { [ 0x10009C7, 0x100098F ] }; + key <AC03> { [ 0x10009CD, 0x1000985 ] }; + key <AC04> { [ 0x10009BF, 0x1000987 ] }; + key <AC05> { [ 0x10009C1, 0x1000989 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [ 0x10009AA, 0x10009AB ] }; + key <AC07> { [ 0x10009B0, 0x10009DD ] }; + key <AC08> { [ 0x1000995, 0x1000996 ] }; + key <AC09> { [ 0x10009A4, 0x10009A5 ] }; + key <AC10> { [ 0x100099A, 0x100099B ] }; + key <AC11> { [ 0x100099F, 0x10009A0 ] }; + key <BKSL> { [ backslash, bar ] }; + + key <AB01> { [ z, Z ] }; + key <AB02> { [ 0x1000982, 0x1000981 ] }; + key <AB03> { [ 0x10009AE, 0x10009A3 ] }; + key <AB04> { [ 0x10009A8, 0x10009A8 ] }; + key <AB05> { [ 0x10009AC, 0x10009AC ] }; + key <AB06> { [ 0x10009B2, 0x10009B2 ] }; + key <AB07> { [ 0x10009B8, 0x10009B6 ] }; + key <AB08> { [ comma, 0x10009B7 ] }; + key <AB09> { [ period, 0x1000964 ] }; + key <AB10> { [ 0x10009DF, 0x10009AF ] }; +}; + +xkb_symbols "probhat" { + name[Group1]= "Bengali"; + key <ESC> { [ Escape ] }; + +// numbers + key <TLDE> { [ quoteleft, asciitilde ] }; + key <AE01> { [ 0x10009E7, exclam ] }; + key <AE02> { [ 0x10009E8, at ] }; + key <AE03> { [ 0x10009E9, numbersign ] }; + key <AE04> { [ 0x10009EA, 0x10009F3 ] }; + key <AE05> { [ 0x10009EB, percent ] }; + key <AE06> { [ 0x10009EC, asciicircum ] }; + key <AE07> { [ 0x10009ED, 0x100099E ] }; + key <AE08> { [ 0x10009EE, asterisk ] }; + key <AE09> { [ 0x10009EF, parenleft ] }; + key <AE10> { [ 0x10009E6, parenright ] }; + key <AE11> { [ minus, 0x1000983 ] }; + key <AE12> { [ 0x100098B, 0x10009C3 ] }; + key <BKSP> { [ BackSpace ] }; + +// tab, q to ] + key <TAB> { [ Tab, ISO_Left_Tab ] }; + key <AD01> { [ 0x10009A6, 0x10009A7 ] }; + key <AD02> { [ 0x10009C2, 0x100098A ] }; + key <AD03> { [ 0x10009C0, 0x1000988 ] }; + key <AD04> { [ 0x10009B0, 0x10009DC ] }; + key <AD05> { [ 0x100099F, 0x10009A0 ] }; + key <AD06> { [ 0x100098F, 0x1000990 ] }; + key <AD07> { [ 0x10009C1, 0x1000989 ] }; + key <AD08> { [ 0x10009BF, 0x1000987 ] }; + key <AD09> { [ 0x1000993, 0x1000994 ] }; + key <AD10> { [ 0x10009AA, 0x10009AB ] }; + key <AD11> { [ 0x10009C7, 0x10009C8 ] }; + key <AD12> { [ 0x10009CB, 0x10009CC ] }; + key <RTRN> { [ Return ] }; + +// caps, a to ' +// key <CAPS> { [ Caps_Lock ] }; + key <AC01> { [ 0x10009BE, 0x1000985 ] }; + key <AC02> { [ 0x10009B8, 0x10009B7 ] }; + key <AC03> { [ 0x10009A1, 0x10009A2 ] }; + key <AC04> { [ 0x10009A4, 0x10009A5 ] }; + key <AC05> { [ 0x1000997, 0x1000998 ] }; + key <AC06> { [ 0x10009B9, 0x1000983 ] }; + key <AC07> { [ 0x100099C, 0x100099D ] }; + key <AC08> { [ 0x1000995, 0x1000996 ] }; + key <AC09> { [ 0x10009B2, 0x1000982 ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ quoteright, quotedbl ] }; + +// shift, z to / +// key <LFSH> { [ Shift_L ] }; + key <AB01> { [ 0x10009DF, 0x10009AF ] }; + key <AB02> { [ 0x10009B6, 0x10009DD ] }; + key <AB03> { [ 0x100099A, 0x100099B ] }; + key <AB04> { [ 0x1000986, 0x100098B ] }; + key <AB05> { [ 0x10009AC, 0x10009AD ] }; + key <AB06> { [ 0x10009A8, 0x10009A3 ] }; + key <AB07> { [ 0x10009AE, 0x1000999 ] }; + key <AB08> { [ comma, 0x10009C3 ] }; + key <AB09> { [ period, 0x1000981 ] }; + key <AB10> { [ 0x10009CD, question ] }; + key <BKSL> { [ backslash, bar ] }; + +// key <LCTL> { [ Control_L ] }; +// key <SPCE> { [ space ] }; + +// modifier_map Shift { Shift_L }; +// modifier_map Lock { Caps_Lock }; +// modifier_map Control{ Control_L }; + +}; + Index: xc/programs/xkbcomp/symbols/pc/bg diff -u /dev/null xc/programs/xkbcomp/symbols/pc/bg:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/bg Thu Nov 21 23:03:28 2002 @@ -0,0 +1,141 @@ + +// based on a keyboard map: +// +////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1999, 2000 by Anton Zinoviev <anton@lml.bas.bg> +// +// This software may be used, modified, copied, distributed, and sold, +// in both source and binary form provided that the above copyright +// and these terms are retained. Under no circumstances is the author +// responsible for the proper functioning of this software, nor does +// the author assume any responsibility for damages incurred with its +// use. +// +////////////////////////////////////////////////////////////////////////// +// Version 1.6r1 +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/bg,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "bds" { + + name[Group1]= "Cyrillic"; + + key <TLDE> { [ parenleft, parenright ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, question ] }; + key <AE03> { [ 3, plus ] }; + key <AE04> { [ 4, quotedbl ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, equal ] }; + key <AE07> { [ 7, colon ] }; + key <AE08> { [ 8, slash ] }; + key <AE09> { [ 9, emdash ] }; + key <AE10> { [ 0, numerosign ] }; + key <AE11> { [ minus, I ] }; + key <AE12> { [ period, V ] }; + + key <AD01> { [ comma, Cyrillic_yeru ] }; + key <AD02> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD03> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD04> { [ Cyrillic_i, Cyrillic_I ] }; + key <AD05> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD06> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD07> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD08> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AD09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD12> { [ semicolon, section ] }; + + key <AC01> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <AC02> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AC03> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC04> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC05> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC06> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AC07> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AC08> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AC09> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC10> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AC11> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <BKSL> { [ apostrophe, Cyrillic_YERU ] }; + + key <AB01> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB02> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AB03> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + key <AB04> { [ Cyrillic_e, Cyrillic_E ] }; + key <AB05> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AB06> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AB07> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AB08> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AB09> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AB10> { [ Cyrillic_be, Cyrillic_BE ] }; + + // End alphanumeric section + + key <RALT> { [ Alt_R, Meta_R ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "phonetic" { + + name[Group1]= "Cyrillic"; + + key <TLDE> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatY> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ quoteright, quotedbl ] }; + key <BKSL> { [ Cyrillic_yu, Cyrillic_YU ] }; + + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + + // End alphanumeric section + + key <RALT> { [ Alt_R, Meta_R ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/br diff -u /dev/null xc/programs/xkbcomp/symbols/pc/br:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/br Thu Nov 21 23:03:28 2002 @@ -0,0 +1,60 @@ + +// based on +// "a very simple Brasilian ABNT2 keybaord +// by Ricardo Y. Igarashi (iga@that.com.br) +// Adds suport for dead-keys in I18N applications +// by Conectiva (http://www.conectiva.com.br)" +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/br,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +xkb_symbols "abnt2" { + + include "pc/latin" + + name[Group1]="Brazilian"; + + key <AE02> { [ 2, at, twosuperior, onehalf ] }; + key <AE03> { [ 3, numbersign, threesuperior, threequarters ] }; + key <AE04> { [ 4, dollar, sterling, onequarter ] }; + key <AE05> { [ 5, percent, cent, threeeighths ] }; + key <AE06> { [ 6, dead_diaeresis, notsign, diaeresis ] }; + key <AE12> { [ equal, plus, section, dead_ogonek ] }; + + key <AD03> { [ e, E, EuroSign, EuroSign ] }; + key <AD04> { [ r, R, registered, registered ] }; + key <AD11> { [dead_acute, dead_grave, acute, grave ] }; + key <AD12> { [bracketleft, braceleft, ordfeminine, dead_macron ] }; + + key <AC10> { [ ccedilla, Ccedilla, dead_acute, dead_doubleacute] }; + key <AC11> { [dead_tilde, dead_circumflex, asciitilde, asciicircum ] }; + key <TLDE> { [apostrophe, quotedbl, notsign, notsign ] }; + + key <BKSL> { [ backslash, bar, masculine, dead_breve ] }; + key <AB03> { [ c, C, copyright, copyright ] }; + key <AB10> { [ semicolon, colon, dead_belowdot, dead_abovedot ] }; + +// ABNT-2 keyboard has this special key + + key <AB11> { type[Group1] = "FOUR_LEVEL", + [ slash, question, degree, questiondown ] }; + + key <KPPT> { [KP_Decimal ] }; + key <KPDL> { [ KP_Delete, comma ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + include "pc/br(abnt2)" // for consistent naming + + + key <AE06> { [ 6, diaeresis, notsign, notsign ] }; + key <AD11> { [apostrophe, grave ] }; + key <AC10> { [ ccedilla, Ccedilla, acute, doubleacute ] }; + key <AC11> { [asciitilde, asciicircum ] }; + key <AB10> { [ semicolon, colon, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/by diff -u /dev/null xc/programs/xkbcomp/symbols/pc/by:1.2 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/by Thu Nov 21 23:03:28 2002 @@ -0,0 +1,75 @@ + +// based on +// belarusian standard keyboard +// Alexander Mikhailian <mikhailian@altern.org> +// +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/by,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Belarusian"; + + key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] }; + key <LSGT> { [ bar, brokenbar ] }; + + key <AE02> { [ 2, quotedbl ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ Byelorussian_shortu, Byelorussian_SHORTU ]}; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AD12> { [ apostrophe, apostrophe ] }; + + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E ] }; + + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB05> { [ Ukrainian_i, Ukrainian_I ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ period, comma ] }; + + key <BKSL> { [ slash, bar ] }; + + // End alphanumeric section +}; + +partial alphanumeric_keys +xkb_symbols "winkeys" { + include "pc/by(basic)" + key <AE04> { [ 4, semicolon ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + key <AB10> { [ period, comma ] }; + key <BKSL> { [ slash, bar ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/cz diff -u /dev/null xc/programs/xkbcomp/symbols/pc/cz:1.4 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/cz Fri Dec 20 15:18:34 2002 @@ -0,0 +1,99 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/cz,v 1.2 2002/11/22 04:02:22 dawes +// Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // This layout conforms to a new cz compromise standard designed + // to satisfy most unix, windows and mac users. + // 2001 by Kamil Toman <ktoman@email.cz> + + include "pc/latin" + + name[Group1]= "Czech"; + + key <TLDE> { type[Group1]="FOUR_LEVEL", + [ semicolon, dead_abovering, grave, asciitilde ] }; + key <AE01> { type[Group1]="FOUR_LEVEL", + [ plus, 1, exclam, dead_tilde ] }; + key <AE02> { type[Group1]="FOUR_LEVEL", + [ ecaron, 2, at, dead_caron ] }; + key <AE03> { type[Group1]="FOUR_LEVEL", + [ scaron, 3, numbersign, dead_circumflex ] }; + key <AE04> { type[Group1]="FOUR_LEVEL", + [ ccaron, 4, dollar, dead_breve ] }; + key <AE05> { type[Group1]="FOUR_LEVEL", + [ rcaron, 5, percent, dead_abovering ] }; + key <AE06> { type[Group1]="FOUR_LEVEL", + [ zcaron, 6, asciicircum, dead_ogonek ] }; + key <AE07> { type[Group1]="FOUR_LEVEL", + [ yacute, 7, ampersand, dead_grave ] }; + key <AE08> { type[Group1]="FOUR_LEVEL", + [ aacute, 8, asterisk, dead_abovedot] }; + key <AE09> { type[Group1]="FOUR_LEVEL", + [ iacute, 9, braceleft, dead_acute ] }; + key <AE10> { type[Group1]="FOUR_LEVEL", + [ eacute, 0, braceright, dead_doubleacute ] }; + key <AE11> { type[Group1]="FOUR_LEVEL", + [ equal, percent, NoSymbol, dead_diaeresis ] }; + key <AE12> { type[Group1]="FOUR_LEVEL", + [dead_acute, dead_caron, dead_macron, dead_cedilla ] }; + + key <AD01> { [ q, Q, backslash, NoSymbol ] }; + key <AD02> { [ w, W, bar, Nosymbol ] }; + key <AD03> { [ e, E, EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, NoSymbol, NoSymbol ] }; + key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; + key <AD06> { [ z, Z, NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, NoSymbol, NoSymbol ] }; + key <AD08> { [ i, I, NoSymbol, NoSymbol ] }; + key <AD09> { [ o, O, NoSymbol, NoSymbol ] }; + key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; + + key <AD11> { [ uacute, slash, bracketleft, division ] }; + key <AD12> { [parenright, parenleft, bracketright, multiply ] }; + + key <AC01> { [ a, A, asciitilde, NoSymbol ] }; + key <AC02> { [ s, S, dstroke, NoSymbol ] }; + key <AC03> { [ d, D, Dstroke, NoSymbol ] }; + key <AC04> { [ f, F, bracketleft, NoSymbol ] }; + key <AC05> { [ g, G, bracketright, NoSymbol ] }; + key <AC06> { [ h, H, grave, NoSymbol ] }; + key <AC07> { [ j, J, apostrophe, NoSymbol ] }; + key <AC08> { [ k, K, lstroke, NoSymbol ] }; + key <AC09> { [ l, L, Lstroke, NoSymbol ] }; + + key <AC10> { [ uring, quotedbl, dollar, NoSymbol ] }; + key <AC11> { [ section, exclam, apostrophe, ssharp ] }; + key <AC12> { [ EuroSign, dead_diaeresis, NoSymbol, NoSymbol ] }; + key <BKSL> { [dead_diaeresis, apostrophe, backslash, bar ] }; + + key <LSGT> { [ backslash, bar, slash, NoSymbol ] }; + key <AB01> { [ y, Y, degree, NoSymbol ] }; + key <AB02> { [ x, X, numbersign, Nosymbol ] }; + key <AB03> { [ c, C, ampersand, NoSymbol ] }; + key <AB04> { [ v, V, at, NoSymbol ] }; + key <AB05> { [ b, B, braceleft, NoSymbol ] }; + key <AB06> { [ n, N, braceright, NoSymbol ] }; + key <AB07> { [ m, M, asciicircum, NoSymbol ] }; + key <AB08> { [ comma, question, less, NoSymbol ] }; + key <AB09> { [ period, colon, greater, NoSymbol ] }; + key <AB10> { [ minus, underscore, asterisk, NoSymbol ] }; + + key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; + + key <KPDL> { type[Group1]="FOUR_LEVEL_KEYPAD", + [ KP_Delete, comma, KP_Delete, KP_Decimal ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; + +}; + +// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) +xkb_symbols "bksl" { + include "pc/cz(basic)" + + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/cz_qwerty diff -u /dev/null xc/programs/xkbcomp/symbols/pc/cz_qwerty:1.1 --- /dev/null Thu Feb 27 12:35:35 2003 +++ xc/programs/xkbcomp/symbols/pc/cz_qwerty Thu Nov 21 23:02:22 2002 @@ -0,0 +1,21 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/cz_qwerty,v 1.1 2002/11/22 04:02:22 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // This layout should work exactly as a cz with the exception + // of 'Z' and 'Y' keys, which are in the qwerty style (ie. swapped). + // 2001 by Kamil Toman <ktoman@email.cz> + + include "pc/cz(basic)" + + key <AB01> { [ z, Z, degree, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; +}; + +// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) +xkb_symbols "bksl" { + include "pc/cz_qwerty(basic)" + + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/de diff -u /dev/null xc/programs/xkbcomp/symbols/pc/de:1.4 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/de Wed Dec 18 20:21:30 2002 @@ -0,0 +1,78 @@ + +// based on a keyboard map from an 'xkb/symbols/de' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/de,v 1.4 2002/12/19 01:21:30 dawes Exp $ + +xkb_symbols "basic" { + + include "pc/latin(type4)" + + name[Group1]="German"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE03> { [ 3, section, threesuperior, sterling ] }; + key <AE04> { [ 4, dollar, onequarter, currency ] }; + key <AE11> { [ ssharp, question, backslash, questiondown ] }; + key <AE12> { [dead_acute, dead_grave, dead_cedilla, dead_ogonek ] }; + + key <AD03> { [ e, E, EuroSign, EuroSign ] }; + key <AD06> { [ z, Z, leftarrow, yen ] }; + key <AD11> { [udiaeresis, Udiaeresis, dead_diaeresis, dead_abovering ] }; + key <AD12> { [ plus, asterisk, dead_tilde, dead_macron ] }; + + key <AC10> { [odiaeresis, Odiaeresis, dead_doubleacute, dead_doubleacute ] }; + key <AC11> { [adiaeresis, Adiaeresis, dead_circumflex, dead_caron] }; + key <TLDE> { [dead_circumflex, degree, notsign, notsign ] }; + + key <BKSL> { [numbersign, apostrophe, dead_grave, dead_breve ] }; + key <AB01> { [ y, Y, guillemotleft, less ] }; + + key <KPDL> { [ KP_Delete, KP_Separator ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // modify the default German layout to not have any dead keys + + include "pc/de(basic)" + + key <TLDE> { [asciicircum, degree, notsign, notsign ] }; + key <AE12> { [ acute, grave, cedilla, cedilla ] }; + key <AD11> { [udiaeresis, Udiaeresis, diaeresis, diaeresis ] }; + key <AD12> { [ plus, asterisk, asciitilde, macron ] }; + key <AC10> { [odiaeresis, Odiaeresis, doubleacute, doubleacute ] }; + key <AC11> { [adiaeresis, Adiaeresis, asciicircum, asciicircum ] }; + key <BKSL> { [numbersign, apostrophe, grave, grave ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; + +partial alphanumeric_keys +xkb_symbols "deadgraveacute" { + // modify the default German layout to have only acute and grave + // as dead keys (tilde and circumflex are needed as spacing characters + // in many programming languages) + + include "pc/de(basic)" + + key <TLDE> { [asciicircum, degree, notsign, notsign ] }; + key <AD12> { [ plus, asterisk, asciitilde, dead_macron ] }; + key <BKSL> { [numbersign, apostrophe, grave, grave ] }; +}; + +partial alphanumeric_keys +xkb_symbols "deadacute" { + // modify the default German layout to have only acute as + // dead keys (ASCII grave, tilde and circumflex are needed as + // spacing characters in many programming languages and text formatters) + + include "pc/de(deadgraveacute)" + + key <AE12> { [dead_acute, grave, dead_cedilla, dead_ogonek ] }; + key <BKSL> { [numbersign, apostrophe, dead_grave, dead_grave ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/dev diff -u /dev/null xc/programs/xkbcomp/symbols/pc/dev:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/dev Thu Nov 21 23:03:28 2002 @@ -0,0 +1,71 @@ + +// based on a keyboard map from an 'xkb/symbols/dev' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/dev,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Hindi"; + + key <TLDE> { [ 0x100094A, 0x1000912 ] }; + + // Mainly numbers. + key <AE01> { [ 0x1000967, 0x100090D ] }; + key <AE02> { [ 0x1000968, 0x1000945 ] }; + key <AE03> { [ 0x1000969 ] }; + key <AE04> { [ 0x100096A ] }; + key <AE05> { [ 0x100096B ] }; + key <AE06> { [ 0x100096C ] }; + key <AE07> { [ 0x100096D ] }; + key <AE08> { [ 0x100096e ] }; + key <AE09> { [ 0x100096F, parenleft ] }; + key <AE10> { [ 0x1000966, parenright ] }; + key <AE11> { [ 0x1000903 ] }; + key <AE12> { [ 0x1000943, 0x100090B ] }; + +// Mainly long vowels + + key <AD01> { [ 0x100094C, 0x1000914 ] }; + key <AD02> { [ 0x1000948, 0x1000910 ] }; + key <AD03> { [ 0x100093E, 0x1000906 ] }; + key <AD04> { [ 0x1000940, 0x1000908 ] }; + key <AD05> { [ 0x1000942, 0x100090A ] }; + +// Mainly voiced consonants + + key <AD06> { [ 0x100092C, 0x100092D ] }; + key <AD07> { [ 0x1000939, 0x1000919 ] }; + key <AD08> { [ 0x1000917, 0x1000918 ] }; + key <AD09> { [ 0x1000926, 0x1000927 ] }; + key <AD10> { [ 0x100091C, 0x100091D ] }; + key <AD11> { [ 0x1000921, 0x1000922 ] }; + key <AD12> { [ 0x100093C, 0x100091E ] }; + +// Mainly short vowels + key <AC01> { [ 0x100094B, 0x1000913 ] }; + key <AC02> { [ 0x1000947, 0x100090F ] }; + key <AC03> { [ 0x100094D, 0x1000905 ] }; + key <AC04> { [ 0x100093F, 0x1000907 ] }; + key <AC05> { [ 0x1000941, 0x1000909 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [ 0x100092A, 0x100092B ] }; + key <AC07> { [ 0x1000930, 0x1000931 ] }; + key <AC08> { [ 0x1000915, 0x1000916 ] }; + key <AC09> { [ 0x1000924, 0x1000925 ] }; + key <AC10> { [ 0x100091A, 0x100091B ] }; + key <AC11> { [ 0x100091F, 0x1000920 ] }; + key <BKSL> { [ 0x1000949, 0x1000911 ] }; + + key <AB01> { [ 0x1000946, 0x100090E ] }; + key <AB02> { [ 0x1000902, 0x1000901 ] }; + key <AB03> { [ 0x100092E, 0x1000923 ] }; + key <AB04> { [ 0x1000928, 0x1000929 ] }; + key <AB05> { [ 0x1000935, 0x1000934 ] }; + key <AB06> { [ 0x1000932, 0x1000933 ] }; + key <AB07> { [ 0x1000938, 0x1000936 ] }; + key <AB08> { [ comma, 0x1000937 ] }; + key <AB09> { [ period, 0x1000964 ] }; + key <AB10> { [ 0x100092F, question ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/dk diff -u /dev/null xc/programs/xkbcomp/symbols/pc/dk:1.3 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/dk Wed Dec 18 20:07:56 2002 @@ -0,0 +1,47 @@ + +// based on a keyboard map from an 'xkb/symbols/dk' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/dk,v 1.3 2002/12/19 01:07:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type2)" + + name[Group1]="Danish"; + + key <AE11> { [ plus, question, plusminus, questiondown ] }; + key <AE12> { [dead_acute, dead_grave, bar, brokenbar ] }; + + + key <AC10> { [ ae, AE, dead_acute, dead_doubleacute ] }; + key <AC11> { [ oslash, Ooblique, dead_circumflex, dead_caron ] }; + key <TLDE> { [ onehalf, section, threequarters, paragraph ] }; + + key <BKSL> { [apostrophe, asterisk, dead_doubleacute, multiply ] }; + + key <LSGT> { type[Group1] = "FOUR_LEVEL", + [ less, greater, backslash, notsign ] }; + + key <KPDL> { [ KP_Delete, KP_Separator ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + include "pc/dk(basic)" + + key <AE12> { [ acute, grave, bar, ogonek ] }; + key <AD11> { [ aring, Aring, diaeresis, degree ] }; + key <AD12> { [ diaeresis, asciicircum, asciitilde, macron ] }; + key <AC10> { [ ae, AE, acute, doubleacute ] }; + key <AC11> { [ oslash, Ooblique, asciicircum, caron ] }; + key <BKSL> { [apostrophe, asterisk, doubleacute, multiply ] }; + key <AB08> { [ comma, semicolon, cedilla, ogonek ] }; + key <AB09> { [ period, colon, periodcentered, abovedot ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/dvorak diff -u /dev/null xc/programs/xkbcomp/symbols/pc/dvorak:1.1 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/dvorak Mon Nov 25 20:43:25 2002 @@ -0,0 +1,148 @@ + +// based on a keyboard map from an 'xkb/symbols/dk' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/dvorak,v 1.1 2002/11/26 01:43:25 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Dvorak"; + + // Alphanumeric section + key.type[Group1] = "FOUR_LEVEL_ALPHABETIC"; + + key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] }; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft, dead_grave] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ bracketleft, braceleft ] }; + key <AE12> { [ bracketright, braceright, dead_tilde] }; + + key <AD01> { [ apostrophe, quotedbl, dead_acute, dead_diaeresis ] }; + key <AD02> { [ comma, less, dead_cedilla, dead_caron ] }; + key <AD03> { [ period, greater, dead_abovedot, periodcentered ] }; + key <AD04> { [ p, P ] }; + key <AD05> { [ y, Y ] }; + key <AD06> { [ f, F ] }; + key <AD07> { [ g, G ] }; + key <AD08> { [ c, C ] }; + key <AD09> { [ r, R ] }; + key <AD10> { [ l, L ] }; + key <AD11> { [ slash, question ] }; + key <AD12> { [ equal, plus ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ o, O ] }; + key <AC03> { [ e, E ] }; + key <AC04> { [ u, U ] }; + key <AC05> { [ i, I ] }; + key <AC06> { [ d, D ] }; + key <AC07> { [ h, H ] }; + key <AC08> { [ t, T ] }; + key <AC09> { [ n, N ] }; + key <AC10> { [ s, S ] }; + key <AC11> { [ minus, underscore ] }; + + key <AB01> { [ semicolon, colon, dead_ogonek, dead_doubleacute ] }; + key <AB02> { [ q, Q ] }; + key <AB03> { [ j, J ] }; + key <AB04> { [ k, K ] }; + key <AB05> { [ x, X ] }; + key <AB06> { [ b, B ] }; + key <AB07> { [ m, M ] }; + key <AB08> { [ w, W ] }; + key <AB09> { [ v, V ] }; + key <AB10> { [ z, Z ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + + modifier_map Mod5 { <RALT> }; +}; + +// Norwegian Dvorak +partial alphanumeric_keys +xkb_symbols "no" { + include "pc/dvorak(basic)" + + key <TLDE> { [ bar, section, brokenbar, paragraph ] }; + + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, quotedbl, at, twosuperior ] }; + key <AE03> { [ 3, numbersign, sterling, threesuperior ] }; + key <AE04> { [ 4, dollar, currency,onequarter ] }; + key <AE05> { [ 5, percent, onehalf, onehalf ] }; + key <AE06> { [ 6, ampersand, threequarters, threequarters ] }; + key <AE07> { [ 7, slash, braceleft, division ] }; + key <AE08> { [ 8, parenleft, bracketleft ] }; + key <AE09> { [ 9, parenright, bracketright ] }; + key <AE10> { [ 0, equal, braceright ] }; + key <AE11> { [ plus, question, plusminus, questiondown ] }; + key <AE12> { [ backslash, grave, dead_acute, dead_grave ] }; + + key <AD01> { [ aring, Aring, braceright, bracketright ] }; + key <AD02> { [ comma, semicolon, dead_cedilla, cedilla ] }; + key <AD03> { [ period, colon, periodcentered ] }; + key <AD04> { [ p, P, thorn, THORN ] }; + key <AD05> { [ y, Y, yen ] }; + key <AD06> { [ f, F, ordfeminine ] }; + key <AD08> { [ c, C, ccedilla, copyright ] }; + key <AD09> { [ r, R, registered ] }; + key <AD11> { [ apostrophe, asterisk, dead_circumflex, acute ] }; + key <AD12> { [ asciitilde, asciicircum, dead_diaeresis, dead_tilde ] }; + + key <AC03> { [ e, E, EuroSign, cent ] }; + key <AC05> { [ i, I, idotless, Iabovedot] }; + key <AC06> { [ d, D, eth, ETH ] }; + key <AC10> { [ s, S, ssharp ] }; + key <AC11> { [ minus, underscore, hyphen, diaeresis] }; + + key <AB01> { [ ae, AE, braceleft, bracketleft] }; + key <AB05> { [ x, X, multiply ] }; + key <AB07> { [ m, M, mu ] }; + key <BKSL> { [ less, greater, guillemotleft, guillemotright ] }; + + key <SPCE> { [ space, space, nobreakspace, nobreakspace] }; + + key <LSGT> { [ oslash, Ooblique, bar, backslash ] }; + +}; + +// Swedish Dvorak +partial alphanumeric_keys +xkb_symbols "se" { + include "pc/dvorak(no)" + + key <TLDE> { [ section, onehalf ] }; + + key <AE04> { [ 4, currency, dollar, onequarter ] }; + key <AE11> { [ plus, question, backslash, questiondown ] }; + key <AE12> { [ dead_acute, dead_grave, backslash, grave ] }; + + key <AD01> { [ odiaeresis, Odiaeresis, braceright, bracketright ] }; + key <AD02> { [ aring, Aring ] }; + key <AD03> { [ adiaeresis, Adiaeresis ] }; + key <AD11> { [ q, Q ] }; + key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, asciicircum ] }; + + key <AB01> { [ comma, semicolon, dead_cedilla, cedilla ] }; + key <AB02> { [ period, colon, periodcentered ] }; + + key <BKSL> { [ less, greater, bar, brokenbar ] }; + + key <LSGT> { [ apostrophe, asterisk, bar, backslash ] }; + +}; +// Swedish Dvorak alias +partial alphanumeric_keys +xkb_symbols "sv" { + include "pc/dvorak(se)" +}; Index: xc/programs/xkbcomp/symbols/pc/ee diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ee:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/ee Thu Nov 21 23:03:28 2002 @@ -0,0 +1,58 @@ + +// based on +// Estonian XKB-keymap by Ville Hallik <ville@linux.ee> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ee,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Estonian keyboard + // This layout conforms to both EVS8:1993 and EVS8:2000 standards + + include "pc/latin(type4)" + + name[Group1]="Estonian"; + + key <AE03> { [ 3, numbersign, sterling, sterling ] }; + key <AE04> { [ 4, currency, dollar, dollar ] }; + key <AE11> { [ plus, question, backslash, questiondown ] }; + key <AE12> { [dead_acute, dead_grave, grave, apostrophe ] }; + + key <AD03> { [ e, E, EuroSign, EuroSign ] }; + key <AD11> { [udiaeresis, Udiaeresis, dead_diaeresis, dead_abovering ] }; + key <AD12> { [ otilde, Otilde, section, dead_macron ] }; + + key <AC02> { [ s, S, scaron, Scaron ] }; + key <AC10> { [odiaeresis, Odiaeresis, dead_acute, dead_doubleacute ] }; + key <AC11> { [adiaeresis, Adiaeresis, asciicircum, dead_caron ] }; + key <TLDE> { [dead_caron, dead_tilde, notsign, notsign ] }; + + key <BKSL> { [apostrophe, asterisk, onehalf, dead_breve ] }; + key <AB01> { [ z, Z, zcaron, Zcaron ] }; + key <AB08> { [ comma, semicolon, less, multiply ] }; + key <AB09> { [ period, colon, greater, division ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic Estonian layout to eliminate all dead keys + + include "pc/ee(basic)" + + key <TLDE> { [asciicircum,asciitilde ] }; + key <AE12> { [apostrophe, grave ] }; + key <AD11> { [udiaeresis, Udiaeresis, diaeresis, degree ] }; + key <AD12> { [ otilde, Otilde, section, macron ] }; + key <AC10> { [odiaeresis, Odiaeresis, acute, doubleacute ] }; + key <AC11> { [adiaeresis, Adiaeresis, asciicircum, caron ] }; + key <BKSL> { [apostrophe, asterisk, onehalf, breve ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/el diff -u /dev/null xc/programs/xkbcomp/symbols/pc/el:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/el Thu Nov 14 21:26:41 2002 @@ -0,0 +1,125 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/el,v 1.2 2002/11/15 02:26:41 dawes Exp $ +// +// Hellenic keyboard map for XFree86 +// Original version: +// Kostas Gewrgiou <gewrgiou@imbc.gr> +// Heavily modified and maintained by: +// Vasilis Vasaitis <vvas@hal.csd.auth.gr> +// Originally converted to single group form by: +// Ivan Pascal <pascal@info.tsu.ru> + +default partial alphanumeric_keys alternate_group +xkb_symbols "basic" { + + include "pc/el(bare)" + + key <TLDE> { [ grave, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <AD11> { [ bracketleft, braceleft ] }; + key <AD12> { [ bracketright, braceright ] }; + + key <AC11> { [ apostrophe, quotedbl ] }; + + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + key <BKSL> { [ backslash, bar ] }; + +}; + +hidden partial alphanumeric_keys alternate_group +xkb_symbols "bare" { + + name[Group1] = "ISO8859-7"; + + key <AD01> { [ semicolon, colon ] }; + key <AD02> { [ Greek_finalsmallsigma, Greek_SIGMA ] }; + key <AD03> { [ Greek_epsilon, Greek_EPSILON ] }; + key <AD04> { [ Greek_rho, Greek_RHO ] }; + key <AD05> { [ Greek_tau, Greek_TAU ] }; + key <AD06> { [ Greek_upsilon, Greek_UPSILON ] }; + key <AD07> { [ Greek_theta, Greek_THETA ] }; + key <AD08> { [ Greek_iota, Greek_IOTA ] }; + key <AD09> { [ Greek_omicron, Greek_OMICRON ] }; + key <AD10> { [ Greek_pi, Greek_PI ] }; + + key <AC01> { [ Greek_alpha, Greek_ALPHA ] }; + key <AC02> { [ Greek_sigma, Greek_SIGMA ] }; + key <AC03> { [ Greek_delta, Greek_DELTA ] }; + key <AC04> { [ Greek_phi, Greek_PHI ] }; + key <AC05> { [ Greek_gamma, Greek_GAMMA ] }; + key <AC06> { [ Greek_eta, Greek_ETA ] }; + key <AC07> { [ Greek_xi, Greek_XI ] }; + key <AC08> { [ Greek_kappa, Greek_KAPPA ] }; + key <AC09> { [ Greek_lamda, Greek_LAMDA ] }; + key <AC10> { [ dead_acute, dead_diaeresis ] }; + + key <AB01> { [ Greek_zeta, Greek_ZETA ] }; + key <AB02> { [ Greek_chi, Greek_CHI ] }; + key <AB03> { [ Greek_psi, Greek_PSI ] }; + key <AB04> { [ Greek_omega, Greek_OMEGA ] }; + key <AB05> { [ Greek_beta, Greek_BETA ] }; + key <AB06> { [ Greek_nu, Greek_NU ] }; + key <AB07> { [ Greek_mu, Greek_MU ] }; + + key <LSGT> { [ guillemotleft, guillemotright ] }; + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "extended" { + + include "pc/el(basic)" + + key.type = "THREE_LEVEL"; + + key <AE05> { [ 5, percent, EuroSign ] }; + + key <AD01> { [ semicolon, colon, periodcentered ] }; + key <AD03> { [ Greek_epsilon, Greek_EPSILON, EuroSign ] }; + + key <AB08> { [ comma, less, guillemotleft ] }; + key <AB09> { [ period, greater, guillemotright ] }; + + key <RALT> { [ ISO_Level3_Shift ] }; + + modifier_map Mod5 { ISO_Level3_Shift }; + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "polytonic" { + + include "pc/el(extended)" + + key.type = "THREE_LEVEL"; + + key <AD11> { [ dead_tilde, dead_diaeresis, dead_macron ] }; + key <AD12> { [ dead_iota, VoidSymbol, dead_breve ] }; + + key <AC10> { [ dead_acute, dead_horn ] }; + key <AC11> { [ dead_grave, dead_ogonek ] }; + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "nodeadkeys" { + + include "pc/el(basic)" + + key <AC10> { [ semicolon, colon ] }; + +}; + Index: xc/programs/xkbcomp/symbols/pc/en_US diff -u /dev/null xc/programs/xkbcomp/symbols/pc/en_US:1.3 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/en_US Sat Jan 25 21:01:48 2003 @@ -0,0 +1,25 @@ + +// based on a keyboard map from an 'xkb/symbols/iso3335-3' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/en_US,v 1.3 2003/01/26 02:01:48 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + name[Group1]="en_US"; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; + +}; + +xkb_symbols "nodeadkeys" { + + // Modifies the basic iso9995-3 layout to eliminate all dead keys + + include "pc/en_US(basic)" + include "pc/latin(nodeadkeys)" + +}; Index: xc/programs/xkbcomp/symbols/pc/es diff -u /dev/null xc/programs/xkbcomp/symbols/pc/es:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/es Thu Nov 21 23:03:28 2002 @@ -0,0 +1,61 @@ + +// based on a keyboard +// Modified for a real Spanish Keyboard by Jon Tombs +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/es,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type4)" + + name[Group1]="Spanish"; + + key <AE01> { [ 1, exclam, bar, exclamdown ] }; + key <AE03> { [ 3, periodcentered, numbersign, sterling ] }; + key <AE04> { [ 4, dollar, asciitilde, dollar ] }; + key <AE06> { [ 6, ampersand, notsign, fiveeighths ] }; + key <AE11> { [apostrophe, question, backslash, questiondown ] }; + key <AE12> { [exclamdown, questiondown, asciitilde, asciitilde ] }; + + key <AD11> { [dead_grave, dead_circumflex, bracketleft, dead_abovering ] }; + key <AD12> { [ plus, asterisk, bracketright, dead_macron ] }; + + key <AC10> { [ ntilde, Ntilde, asciitilde, dead_doubleacute ] }; + key <AC11> { [dead_acute, dead_diaeresis, braceleft, braceleft ] }; + key <TLDE> { [ masculine, ordfeminine, backslash, backslash ] }; + + key <BKSL> { [ ccedilla, Ccedilla, braceright, dead_breve ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + include "pc/es(basic)" + + key <AC11> { [SunFA_Acute, SunFA_Diaeresis, braceleft, braceleft ] }; + key <AD11> { [SunFA_Grave, SunFA_Circum, bracketleft, dead_abovering ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + + include "pc/es(Sundeadkeys)" +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + include "pc/es(basic)" + + key <AD11> { [ grave, asciicircum, bracketleft, degree ] }; + key <AD12> { [ plus, asterisk, bracketright, macron ] }; + key <AC10> { [ ntilde, Ntilde, asciitilde, doubleacute ] }; + key <AC11> { [ acute, diaeresis, braceleft, braceleft ] }; + key <BKSL> { [ ccedilla, Ccedilla, braceright, breve ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/fi diff -u /dev/null xc/programs/xkbcomp/symbols/pc/fi:1.9 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/fi Wed Jan 29 12:17:31 2003 @@ -0,0 +1,75 @@ +// based on a keyboard map from an 'xkb/symbols/fi' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/fi,v 1.9 2003/01/29 17:17:31 dawes Exp $ + + +partial default alphanumeric_keys +xkb_symbols "basic" { + include "pc/latin(type2)" + include "pc/fi(fi)" +}; + +partial alphanumeric_keys +xkb_symbols "fi" { + + // a Finnish keyboard with dead key support and all of + // ISO-8859-1 and ISO-8859-15 characters available. + + name[Group1]="Finnish"; + + key <TLDE> { [ section, onehalf, onequarter, threequarters ] }; + key <LSGT> { [ less, greater, bar, brokenbar ] }; + // AltGr+<SPCE> is pressed accidentally too often after AltGr+<LSGT>, + // hence AltGr+<SPCE> produces now space, not nobreakspace. + key <SPCE> { [ space, space, space, nobreakspace ] }; + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, quotedbl, at, twosuperior ] }; + key <AE03> { [ 3, numbersign, sterling, threesuperior ] }; + key <AE04> { [ 4, currency, dollar, cent ] }; + key <AE05> { [ 5, percent, EuroSign, masculine ] }; + key <AE06> { [ 6, ampersand, yen, ordfeminine ] }; + key <AE07> { [ 7, slash, braceleft, plusminus ] }; + key <AE08> { [ 8, parenleft, bracketleft, guillemotleft ] }; + key <AE09> { [ 9, parenright, bracketright, guillemotright ] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + key <AB09> { [ period, colon, periodcentered, notsign ] }; + key <AB01> { [ z, Z, zcaron, Zcaron ] }; + key <AB02> { [ x, X, multiply, division ] }; + key <AB03> { [ c, C, copyright, cent ] }; + key <AB05> { [ b, B, ssharp, NoSymbol ] }; + key <AB06> { [ n, N, ntilde, Ntilde ] }; + key <AB07> { [ m, M, mu, NoSymbol ] }; + key <AB10> { [ minus, underscore, hyphen, macron ] }; + key <AC02> { [ s, S, scaron, Scaron ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD04> { [ r, R, registered, NoSymbol ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD10> { [ p, P, paragraph, NoSymbol ] }; + key <AC10> { [ odiaeresis, Odiaeresis, oslash, Ooblique ] }; + key <AE11> { [ plus, question, backslash, questiondown ] }; + key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] }; + key <BKSL> { [ apostrophe, asterisk ] }; + key <AD11> { [ aring, Aring, oe, OE ] }; + key <AE12> { [ dead_acute, dead_grave ] }; + key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, dead_caron ] }; + + // End alphanumeric section, begin "Keypad" + key <KPDL> { [ KP_Delete, KP_Separator ] }; + // End "Keypad" section + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + include "pc/latin(type2)" + include "pc/latin(type2_nodeadkeys)" + include "pc/fi(fi)" + + key <AE12> { [ acute, grave ] }; + key <AD12> { [ diaeresis, asciicircum, asciitilde, caron ] }; +}; + Index: xc/programs/xkbcomp/symbols/pc/fr diff -u /dev/null xc/programs/xkbcomp/symbols/pc/fr:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/fr Thu Nov 21 23:03:28 2002 @@ -0,0 +1,80 @@ + +// based on a keyboard map from an 'xkb/symbols/fr' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/fr,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="French"; + + key <AE01> { [ ampersand, 1, onesuperior, exclamdown ] }; + key <AE02> { [ eacute, 2, asciitilde, oneeighth ] }; + key <AE03> { [ quotedbl, 3, numbersign, sterling ] }; + key <AE04> { [apostrophe, 4, braceleft, dollar ] }; + key <AE05> { [ parenleft, 5, bracketleft, threeeighths ] }; + key <AE06> { [ minus, 6, bar, fiveeighths ] }; + key <AE07> { [ egrave, 7, grave, seveneighths ] }; + key <AE08> { [underscore, 8, backslash, trademark ] }; + key <AE09> { [ ccedilla, 9, asciicircum, plusminus ] }; + key <AE10> { [ agrave, 0, at, degree ] }; + key <AE11> { [parenright, degree, bracketright, questiondown ] }; + key <AE12> { [ equal, plus, braceright, dead_ogonek ] }; + + key <AD01> { [ a, A, ae, AE ] }; + key <AD02> { [ z, Z, guillemotleft, less ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD11> { [dead_circumflex, dead_diaeresis, dead_diaeresis, dead_abovering ] }; + key <AD12> { [ dollar, sterling, currency, dead_macron ] }; + + key <AC01> { [ q, Q, at, Greek_OMEGA ] }; + key <AC10> { [ m, M, mu, masculine ] }; + key <AC11> { [ ugrave, percent, dead_circumflex, dead_caron] }; + key <TLDE> { [twosuperior, asciitilde, notsign, notsign ] }; + + key <BKSL> { [ asterisk, mu, dead_grave, dead_breve ] }; + key <AB01> { [ w, W, lstroke, Lstroke ] }; + key <AB07> { [ comma, question, dead_acute, dead_doubleacute ] }; + key <AB08> { [ semicolon, period, horizconnector, multiply ] }; + key <AB09> { [ colon, slash, periodcentered, division ] }; + key <AB10> { [ exclam, section, dead_belowdot, dead_abovedot ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + // Modifies the basic French layout to use the Sun dead keys + + include "pc/fr(basic)" + + key <AD11> { [SunFA_Circum, SunFA_Diaeresis ] }; + key <AB07> { [comma, question, SunFA_Acute, dead_doubleacute ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "pc/fr(Sundeadkeys)" + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic French layout to eliminate all dead keys + + include "pc/fr(basic)" + + key <AE12> { [ equal, plus, braceright, ogonek ] }; + key <AD11> { [asciicircum, diaeresis ] }; + key <AD12> { [ dollar, sterling, currency, macron ] }; + key <AC11> { [ ugrave, percent, asciicircum, caron ] }; + key <BKSL> { [ asterisk, mu, grave, breve ] }; + key <AB07> { [ comma, question, acute, doubleacute ] }; + key <AB10> { [ exclam, section, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/fr-latin9 diff -u /dev/null xc/programs/xkbcomp/symbols/pc/fr-latin9:1.1 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/fr-latin9 Thu Dec 19 21:07:11 2002 @@ -0,0 +1,171 @@ +// Historic Linux French keyboard layout (fr-latin9) +// Copyright (c) 199x, 2002 Rene Cougnenc (original work) +// Guylhem Aznar <clavier @ externe.net> (maintainer) +// Nicolas Mailhot <Nicolas.Mailhot @ laposte.net> +// (XFree86 submission) +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/fr-latin9,v 1.1 2002/12/20 02:07:11 dawes Exp $ +// +// This layout has long been distributed and refined outside official channels. +// To this day it remains more feature-rich and popular than the 'fr' layout. +// +// This file is derived from an original version by Guylhem Aznar. The +// original version is always available from: +// http://en.tldp.org/HOWTO/Francophones-HOWTO.html +// and is distributed under a GPL license. +// +// The author has given permission for this derived version to be distributed +// under the standard XFree86 license. He would like all changes to this +// version be send to him at <clavier @ externe.net> so he can sync the +// identically named linux console map (kbd, linux-console) and this +// fileout-of-tree GPL version. +// +// Now follows the keyboard design description in French. +// (If you can't read it you probably have no business changing this file anyway:) +// +// Les accents circonflexes des principales voyelles sont obtenus avec +// la touche Alt_Gr, les trémas sont obtenus par Alt_Gr + Shift. +// +// ____ _________ _____________ _______ +// | S A| S = Shift, A = AltGr + Shift | Imprime | Arrêt défil | Pause | +// | s a| s = normal, a = AltGr | Exec | | Halte | +// ¯¯¯¯ ¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯ +// ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ _______ +// | ½ "| 1 ·| 2 É| 3 ,| 4 '| 5 "| 6 || 7 È| 8 ¯| 9 Ç| 0 À| ° ÿ| + °| <-- | +// | ¼ "| & '| é ~| " #| ' {| ( [| - || è `| _ \| ç ^| à @| ) ]| = }| | +// ======================================================================== +// | |<- | A ä| Z Å| E ¢| R Ç| T Þ| Y Ý| U ü| I ï| O ö| P '| " `| $ ë| , | +// | ->| | a â| z å| e ¤| r ç| t þ| y ý| u û| i î| o ô| p ¶| ^ ~| £ ê| <-' | +// ===================================================================¬ | +// | | Q Ä| S Ø| D Ë| F ª| G Æ| H Ð| J Ü| K Ï| L Ö| M º| % Ù| µ ¥| | +// | MAJ | q Â| s ø| d Ê| f ±| g æ| h ð| j Û| k Î| l Ô| m ¹| ù ²| * ³| | +// ======================================================================== +// | ^ | > | W | X | C | V | B | N | ? | . | / | § | ^ | +// | | | < || w «| x »| c ©| v ®| b ß| n ¬| , ¿| ; ×| : ÷| ! ¡| | | +// ======================================================================== +// | | | | | | | | | +// | Ctrl | Meta | Alt | Space Nobreakspace | AltGr | Multi|Menu | Ctrl | +// ¯¯¯¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯ ¯¯¯¯¯¯ +// +// +// Si les touches mortes fonctionnent, utiliser les accents dits +// « morts », i.e. fonctionnant comme l'accent circonflexe & le +// tréma des machines à écrire ; sont disponibles : +// +// (^) : accent circonflexe, +// Shift+(^) : tréma, +// Shift+AltGr (^) : tilde, +// AltGr (1) : accent aigu, +// AltGr (7) : accent grave +// +// Pour s'en servir, procéder comme avec l'accent circonflexe & le tréma +// sur les vielles machines à écrire : +// +// AltGr (1) puis e : é +// Shift+AltGr (1) puis e : É ... + +partial default alphanumeric_keys + +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="fr-latin9"; + + key <TLDE> { [ oe, OE, leftdoublequotemark, rightdoublequotemark ] }; + key <AE01> { [ ampersand, 1, dead_acute, periodcentered ] }; + key <AE02> { [ eacute, 2, asciitilde, Eacute ] }; + key <AE03> { [ quotedbl, 3, numbersign, cedilla ] }; + key <AE04> { [ apostrophe, 4, braceleft, acute ] }; + key <AE05> { [ parenleft, 5, bracketleft, diaeresis ] }; + key <AE06> { [ minus, 6, bar, brokenbar ] }; + key <AE07> { [ egrave, 7, dead_grave, Egrave ] }; + key <AE08> { [ underscore, 8, backslash, macron ] }; + key <AE09> { [ ccedilla, 9, asciicircum, Ccedilla ] }; + key <AE10> { [ agrave, 0, at, Agrave ] }; + key <AE11> { [ parenright, degree, bracketright, ydiaeresis ] }; + key <AE12> { [ equal, plus, braceright, dead_abovering ] }; + + key <AD01> { [ a, A, acircumflex, adiaeresis ] }; + key <AD02> { [ z, Z, aring, Aring ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD04> { [ r, R, ccedilla, Ccedilla ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, yacute, Yacute ] }; + key <AD07> { [ u, U, ucircumflex, udiaeresis ] }; + key <AD08> { [ i, I, icircumflex, idiaeresis ] }; + key <AD09> { [ o, O, ocircumflex, odiaeresis ] }; + key <AD10> { [ p, P, paragraph, quoteleft ] }; + key <AD11> { [ dead_circumflex, dead_diaeresis, dead_tilde, quoteright ] }; + key <AD12> { [ dollar, sterling, ecircumflex, ediaeresis ] }; + + key <AC01> { [ q, Q, Acircumflex, Adiaeresis ] }; + key <AC02> { [ s, S, oslash, Ooblique ] }; + key <AC03> { [ d, D, Ecircumflex, Ediaeresis ] }; + key <AC04> { [ f, F, plusminus, ordfeminine ] }; + key <AC05> { [ g, G, ae, AE ] }; + key <AC06> { [ h, H, eth, ETH ] }; + key <AC07> { [ j, J, Ucircumflex, Udiaeresis ] }; + key <AC08> { [ k, K, Icircumflex, Idiaeresis ] }; + key <AC09> { [ l, L, Ocircumflex, Odiaeresis ] }; + key <AC10> { [ m, M, onesuperior, masculine ] }; + key <AC11> { [ ugrave, percent, twosuperior, Ugrave ] }; + key <BKSL> { [ asterisk, mu, threesuperior, yen ] }; + + key <LSGT> { [ less, greater, bar ] }; + key <AB01> { [ w, W, guillemotleft ] }; + key <AB02> { [ x, X, guillemotright ] }; + key <AB03> { [ c, C, copyright ] }; + key <AB04> { [ v, V, registered ] }; + key <AB05> { [ b, B, ssharp ] }; + key <AB06> { [ n, N, notsign ] }; + key <AB07> { [ comma, question, questiondown ] }; + key <AB08> { [ semicolon, period, multiply ] }; + key <AB09> { [ colon, slash, division ] }; + key <AB10> { [ exclam, section, exclamdown ] }; + + key <SPCE> { [ space, space, nobreakspace ] }; + + // French uses a comma as decimal separator, but keyboards are labeled with a period + // Will take effect when KP_Decimal is mapped to the locale decimal separator + key <KPDL> { [ KP_Delete, period, KP_Delete, KP_Decimal ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + + modifier_map Mod5 { <RALT> }; + +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + // Modifies the basic fr-latin9 layout to use the Sun dead keys + + include "pc/fr-latin9(basic)" + + key <AE01> { [ ampersand, 1, SunFA_Acute, periodcentered ] }; + key <AE07> { [ egrave, 7, SunFA_Grave, Egrave ] }; + key <AD11> { [ SunFA_Circum, SunFA_Diaeresis, SunFA_Tilde, quoteright ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + + include "pc/fr-latin9(Sundeadkeys)" + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic fr-latin9 layout to eliminate all dead keys + + include "pc/fr-latin9(basic)" + + key <AE01> { [ ampersand, 1, apostrophe, periodcentered ] }; + key <AE07> { [ egrave, 7, grave, Egrave ] }; + key <AE12> { [ equal, plus, braceright ] }; + key <AD11> { [ asciicircum, diaeresis, asciitilde, quoteright ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/gb diff -u /dev/null xc/programs/xkbcomp/symbols/pc/gb:1.4 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/gb Thu Dec 12 23:18:04 2002 @@ -0,0 +1,31 @@ + +// based on a keyboard map from an 'xkb/symbols/gb' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/gb,v 1.4 2002/12/13 04:18:04 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple U.K. keyboard layout defined by + // the SVR4 European Language Supplement and sometimes also + // known as the IBM 166 layout. + + include "pc/latin" + + name[Group1]="Great Britain"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE03> { [ 3, sterling, threesuperior, sterling ] }; + key <AE04> { [ 4, dollar, EuroSign, onequarter ] }; + + key <AC11> { [apostrophe, at, dead_circumflex, dead_caron] }; + key <TLDE> { [ grave, notsign, bar, bar ] }; + + key <BKSL> { [numbersign, asciitilde, dead_grave, dead_breve ] }; + key <LSGT> { [ backslash, bar, bar, brokenbar ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/ge_la diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ge_la:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/ge_la Thu Nov 21 23:03:28 2002 @@ -0,0 +1,51 @@ + +// based on +// Georgian keyboard map, in the so called "latin" layout. +// 1999, Pablo Saratxaga <srtxg@chanae.alphanet.ch> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ge_la,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Georgian"; + + key <AD01> { [ 0x010010e5, q ] }; + key <AD02> { [ 0x010010ec, 0x010010ed ] }; + key <AD03> { [ 0x010010d4, e ] }; + key <AD04> { [ 0x010010e0, r ] }; + key <AD05> { [ 0x010010e2, 0x010010e6 ] }; + key <AD06> { [ 0x010010e7, 0x010010d7 ] }; + key <AD07> { [ 0x010010e3, u ] }; + key <AD08> { [ 0x010010d8, i ] }; + key <AD09> { [ 0x010010dd, o ] }; + key <AD10> { [ 0x010010de, p ] }; + key <AD11> { [ bracketleft, braceleft ] }; + key <AD12> { [ bracketright,braceright ] }; + + key <AC01> { [ 0x010010d0, a ] }; + key <AC02> { [ 0x010010e1, 0x010010e8 ] }; + key <AC03> { [ 0x010010d3, d ] }; + key <AC04> { [ 0x010010e4, f ] }; + key <AC05> { [ 0x010010d2, g ] }; + key <AC06> { [ 0x010010f0, h ] }; + key <AC07> { [ 0x010010ef, 0x010010df ] }; + key <AC08> { [ 0x010010d9, k ] }; + key <AC09> { [ 0x010010da, l ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + key <BKSL> { [ backslash, bar ] }; + + key <LSGT> { [ guillemotleft,guillemotright ] }; + key <AB01> { [ 0x010010d6, 0x010010eb ] }; + key <AB02> { [ 0x010010ee, x ] }; + key <AB03> { [ 0x010010ea, 0x010010d9 ] }; + key <AB04> { [ 0x010010d5, v ] }; + key <AB05> { [ 0x010010d1, b ] }; + key <AB06> { [ 0x010010dc, n ] }; + key <AB07> { [ 0x010010db, m ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/ge_ru diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ge_ru:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/ge_ru Thu Nov 21 23:03:28 2002 @@ -0,0 +1,65 @@ + +// based on +// Georgian keyboard map, in the so called "russian" layout. +// 1999, Pablo Saratxaga <srtxg@chanae.alphanet.ch> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ge_ru,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Georgian"; + + key <TLDE> { [ asciicircum, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; // 2 0xeb + key <AE03> { [ 3, numbersign ] }; // 3 0xec + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ numbersign, bar ] }; + + key <AD01> { [ 0x010010e6, q ] }; + key <AD02> { [ 0x010010ea, w ] }; + key <AD03> { [ 0x010010e3, e ] }; + key <AD04> { [ 0x010010d9, r ] }; + key <AD05> { [ 0x010010d4, t ] }; + key <AD06> { [ 0x010010dc, y ] }; + key <AD07> { [ 0x010010d2, u ] }; + key <AD08> { [ 0x010010e8, i ] }; + key <AD09> { [ 0x010010ec, o ] }; + key <AD10> { [ 0x010010d6, p ] }; + key <AD11> { [ 0x010010ee, bracketleft ] }; + key <AD12> { [ 0x010010ef, bracketright ] }; + + key <AC01> { [ 0x010010e4, a ] }; + key <AC02> { [ 0x010010d7, s ] }; + key <AC03> { [ 0x010010d5, d ] }; + key <AC04> { [ 0x010010d0, f ] }; + key <AC05> { [ 0x010010de, g ] }; + key <AC06> { [ 0x010010e0, h ] }; + key <AC07> { [ 0x010010dd, j ] }; + key <AC08> { [ 0x010010da, k ] }; + key <AC09> { [ 0x010010d3, l ] }; + key <AC10> { [ 0x010010df, semicolon ] }; + key <AC11> { [ 0x010010eb, percent ] }; + key <BKSL> { [ backslash, bar ] }; // 0xe9 0xea + + key <LSGT> { [ guillemotleft,guillemotright ] }; // 0xab 0xbb 0xe7 0xe8 + key <AB01> { [ 0x010010ed, z ] }; + key <AB02> { [ 0x010010e9, x ] }; + key <AB03> { [ 0x010010e1, c ] }; + key <AB04> { [ 0x010010db, v ] }; + key <AB05> { [ 0x010010d8, b ] }; + key <AB06> { [ 0x010010e2, n ] }; + key <AB07> { [ 0x010010e5, m ] }; + key <AB08> { [ 0x010010d1, less ] }; + key <AB09> { [ 0x010010e7, greater ] }; + key <AB10> { [ 0x010010f0, question ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/guj diff -u /dev/null xc/programs/xkbcomp/symbols/pc/guj:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/guj Thu Nov 21 23:03:28 2002 @@ -0,0 +1,69 @@ + +// based on a keyboard map from an 'xkb/symbols/guj' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/guj,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Gujarati"; + + // Mainly numbers. + key <AE01> { [ 0x1000AE7, 0x1000A8D ] }; + key <AE02> { [ 0x1000AE8, 0x1000AC5 ] }; + key <AE03> { [ 0x1000AE9 ] }; + key <AE04> { [ 0x1000AEA ] }; + key <AE05> { [ 0x1000AEB ] }; + key <AE06> { [ 0x1000AEC ] }; + key <AE07> { [ 0x1000AED ] }; + key <AE08> { [ 0x1000AEE ] }; + key <AE09> { [ 0x1000AEF, parenleft ] }; + key <AE10> { [ 0x1000AE6, parenright ] }; + key <AE11> { [ minus, 0x1000A83 ] }; + key <AE12> { [ 0x1000A8B, 0x1000AC3 ] }; + +// Mainly long vowels + + key <AD01> { [ 0x1000ACC, 0x1000A94 ] }; + key <AD02> { [ 0x1000AC8, 0x1000A90 ] }; + key <AD03> { [ 0x1000ABE, 0x1000A86 ] }; + key <AD04> { [ 0x1000AC0, 0x1000A88 ] }; + key <AD05> { [ 0x1000AC2, 0x1000A8A ] }; + +// Mainly voiced consonants + + key <AD06> { [ 0x1000AAC, 0x1000AAD ] }; + key <AD07> { [ 0x1000AB9, 0x1000A99 ] }; + key <AD08> { [ 0x1000A97, 0x1000A98 ] }; + key <AD09> { [ 0x1000AA6, 0x1000AA7 ] }; + key <AD10> { [ 0x1000A9C, 0x1000A9D ] }; + key <AD11> { [ 0x1000AA1, 0x1000AA2 ] }; + key <AD12> { [ 0x1000ABC, 0x1000A9E ] }; + +// Mainly short vowels + key <AC01> { [ 0x1000ACB, 0x1000A93 ] }; + key <AC02> { [ 0x1000AC7, 0x1000A8F ] }; + key <AC03> { [ 0x1000ACD, 0x1000A85 ] }; + key <AC04> { [ 0x1000ABF, 0x1000A87 ] }; + key <AC05> { [ 0x1000AC1, 0x1000A89 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [ 0x1000AAA, 0x1000AAB ] }; + key <AC07> { [ 0x1000AB0, guj_rra ] }; + key <AC08> { [ 0x1000A95, 0x1000A96 ] }; + key <AC09> { [ 0x1000AA4, 0x1000AA5 ] }; + key <AC10> { [ 0x1000A9A, 0x1000A9B ] }; + key <AC11> { [ 0x1000A9F, 0x1000AA0 ] }; + key <BKSL> { [ 0x1000AC9, 0x1000A91 ] }; + + key <AB01> { [ z , Z ] }; + key <AB02> { [ 0x1000A82, 0x1000A81 ] }; + key <AB03> { [ 0x1000AAE, 0x1000AA3 ] }; + key <AB04> { [ 0x1000AA8, guj_nnna ] }; + key <AB05> { [ 0x1000AB5, guj_llla ] }; + key <AB06> { [ 0x1000AB2, 0x1000AB3 ] }; + key <AB07> { [ 0x1000AB8, 0x1000AB6 ] }; + key <AB08> { [ comma, 0x1000AB7 ] }; + key <AB09> { [ period, 0x1000964 ] }; + key <AB10> { [ 0x1000AAF, question ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/gur diff -u /dev/null xc/programs/xkbcomp/symbols/pc/gur:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/gur Thu Nov 21 23:03:28 2002 @@ -0,0 +1,69 @@ + +// based on a keyboard map from an 'xkb/symbols/gur' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/gur,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Gurmukhi"; + + // Mainly numbers. + key <AE01> { [ 0x1000A67 ] }; + key <AE02> { [ 0x1000A68 ] }; + key <AE03> { [ 0x1000A69 ] }; + key <AE04> { [ 0x1000A6A ] }; + key <AE05> { [ 0x1000A6B ] }; + key <AE06> { [ 0x1000A6C ] }; + key <AE07> { [ 0x1000A6D ] }; + key <AE08> { [ 0x1000A6e ] }; + key <AE09> { [ 0x1000A6F, parenleft ] }; + key <AE10> { [ 0x1000A66, parenright ] }; + key <AE11> { [ gur_visarga ] }; + key <AE12> { [ gur_v_r, gur_v_r_s ] }; + +// Mainly long vowels + + key <AD01> { [ 0x1000A4C, 0x1000A14 ] }; + key <AD02> { [ 0x1000A48, 0x1000A10 ] }; + key <AD03> { [ 0x1000A3E, 0x1000A06 ] }; + key <AD04> { [ 0x1000A40, 0x1000A08 ] }; + key <AD05> { [ 0x1000A42, 0x1000A0A ] }; + +// Mainly voiced consonants + + key <AD06> { [ 0x1000A2C, 0x1000A2D ] }; + key <AD07> { [ 0x1000A39, 0x1000A19 ] }; + key <AD08> { [ 0x1000A17, 0x1000A18 ] }; + key <AD09> { [ 0x1000A26, 0x1000A27 ] }; + key <AD10> { [ 0x1000A1C, 0x1000A1D ] }; + key <AD11> { [ 0x1000A21, 0x1000A22 ] }; + key <AD12> { [ 0x1000A3C, 0x1000A1E ] }; + +// Mainly short vowels + key <AC01> { [ 0x1000A4B, 0x1000A13 ] }; + key <AC02> { [ 0x1000A47, 0x1000A0F ] }; + key <AC03> { [ 0x1000A4D, 0x1000A05 ] }; + key <AC04> { [ 0x1000A3F, 0x1000A07 ] }; + key <AC05> { [ 0x1000A41, 0x1000A09 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [ 0x1000A2A, 0x1000A2B ] }; + key <AC07> { [ 0x1000A30, 0x1000A30 ] }; + key <AC08> { [ 0x1000A15, 0x1000A16 ] }; + key <AC09> { [ 0x1000A24, 0x1000A25 ] }; + key <AC10> { [ 0x1000A1A, 0x1000A1B ] }; + key <AC11> { [ 0x1000A1F, 0x1000A20 ] }; + key <BKSL> { [ backslash, bar ] }; + + key <AB01> { [ z, Z ] }; + key <AB02> { [ 0x1000A02, 0x1000A70 ] }; + key <AB03> { [ 0x1000A2E, 0x1000A23 ] }; + key <AB04> { [ 0x1000A28, 0x1000A28 ] }; + key <AB05> { [ 0x1000A35, 0x1000A35 ] }; + key <AB06> { [ 0x1000A32, 0x1000A33 ] }; + key <AB07> { [ 0x1000A38, 0x1000A36 ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, 0x1000964 ] }; + key <AB10> { [ 0x1000A2F, question ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/hr diff -u /dev/null xc/programs/xkbcomp/symbols/pc/hr:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/hr Thu Nov 21 23:03:28 2002 @@ -0,0 +1,45 @@ + +// based on +// Croatian keyboards +// by Vlatko Kosturjak (kost@iname.com) +// Taken from Slovenian keyboards +// by Marko Samastur (markos@elite.org) and +// Primoz Peterlin (primoz.peterlin@biofiz.mf.uni-lj.si) +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/hr,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type3)" + + name[Group1]="Croatian"; + + key <AE01> { [ 1, exclam, asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl, dead_caron, caron ] }; + key <AE03> { [ 3, numbersign, asciicircum, dead_circumflex ] }; + key <AE04> { [ 4, dollar, dead_breve, breve ] }; + key <AE05> { [ 5, percent, degree, dead_abovering ] }; + key <AE06> { [ 6, ampersand, dead_ogonek, ogonek ] }; + key <AE07> { [ 7, slash, grave, dead_grave ] }; + key <AE08> { [ 8, parenleft, dead_abovedot, abovedot ] }; + key <AE09> { [ 9, parenright, dead_acute, apostrophe ] }; + key <AE10> { [ 0, equal, dead_doubleacute, doubleacute ] }; + key <AE11> { [apostrophe, question, dead_diaeresis, diaeresis ] }; + key <AE12> { [ plus, asterisk, dead_cedilla, cedilla ] }; + + key <AD03> { [ e, E, EuroSign, EuroSign ] }; + key <AD11> { [ scaron, Scaron, division, dead_abovering ] }; + key <AD12> { [ dstroke, Dstroke, multiply, dead_macron ] }; + + key <AC10> { [ ccaron, Ccaron, dead_acute, dead_doubleacute ] }; + key <AC11> { [ cacute, Cacute, ssharp, dead_caron ] }; + key <TLDE> { [dead_cedilla, dead_diaeresis, notsign, notsign ] }; + + key <BKSL> { [ zcaron, Zcaron, currency, dead_breve ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + Index: xc/programs/xkbcomp/symbols/pc/ie diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ie:1.3 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/ie Mon Dec 30 21:07:04 2002 @@ -0,0 +1,262 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/ie,v 1.3 2002/12/31 02:07:04 dawes Exp $ + +// Irish keyboard map + +// Support for Irish (old and new orthography) and English +// Seamus O Ciardhuain <seoc@cnds.ucd.ie> (19 December 2002) + +// The general idea is to provide the characters in ISO 8859-1, +// ISO 8859-15, ISO 8859-14, CP1252 and "Extended Latin-8". +// However, not all are accessible directly because there aren't +// enough keys; some need deadkeys to access them, others the +// "Multi_key" compose sequences. + +// Designed to be similar to the layouts used on Windows +// and the Macintosh. + +// Everything is in Group 1 to be compatible with the +// multi-layout keyboard support in XFree86 4.3. + +// The basic layout is a modern keyboard, but dotted consonants are +// accessible using a deadkey (AltGr+H or AltGr+W). +// If a proper Clo Gaelach keyboard is needed, then use the layout +// defined below as ie(CloGaelach), which gives dotted consonants +// without use of a deadkey. + + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Modern keyboard for Irish and English + // - acute-accented vowels as AltGr+vowel and AltGr+Shift+vowel + // - euro currency sign as AltGr+4 + // - Comhartha Agus (Tironian Sign Et) as AltGr+Shift+7 + // - non-breaking space as AltGr+Space and AltGr+Shift+Space + // - matches hardware (keys and engraved symbols) for Irish keyboards + + name[Group1] = "Irish"; + + key.type[Group1] = "FOUR_LEVEL_ALPHABETIC"; + + // + // Numeric row `1234567890-= + // + key <TLDE> { [ grave, notsign, brokenbar, NoSymbol ] }; + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, quotedbl, trademark, twosuperior ] }; + key <AE03> { [ 3, sterling, copyright, threesuperior ] }; + key <AE04> { [ 4, dollar, EuroSign, cent ] }; + key <AE05> { [ 5, percent, section, dagger ] }; + key <AE06> { [ 6, asciicircum, dead_circumflex, 0x1002030 ] }; + // per thousand + key <AE07> { [ 7, ampersand, paragraph, 0x100204A ] }; + // Tironian Et + key <AE08> { [ 8, asterisk, dead_diaeresis, enfilledcircbullet ] }; + key <AE09> { [ 9, parenleft, ordfeminine, periodcentered ] }; + key <AE10> { [ 0, parenright, masculine, degree ] }; + key <AE11> { [ minus, underscore, endash, emdash ] }; + key <AE12> { [ equal, plus, notequal, plusminus ] }; + + // + // QWERTYUIOP[] + // + key <AD01> { [ q, Q, oe, OE ] }; + key <AD02> { [ w, W, dead_abovedot, dead_abovedot ] }; + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD04> { [ r, R, registered, 0x1002030 ] }; + // per thousand + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, yen, mu ] }; + key <AD07> { [ u, U, uacute, Uacute ] }; + key <AD08> { [ i, I, iacute, Iacute ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + key <AD10> { [ p, P, singlelowquotemark, NoSymbol ] }; + key <AD11> { [ bracketleft, braceleft, leftdoublequotemark, rightdoublequotemark ] }; + key <AD12> { [ bracketright, braceright, leftsinglequotemark, rightsinglequotemark ] }; + + // + // ASDFGHJKL;'# + // + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ s, S, ssharp, NoSymbol ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, 0x1000192, NoSymbol ] }; + // f with hook + key <AC05> { [ g, G, copyright, NoSymbol ] }; + key <AC06> { [ h, H, dead_abovedot, dead_abovedot ] }; + key <AC07> { [ j, J, idotless, onequarter ] }; + key <AC08> { [ k, K, dead_abovering, onehalf ] }; + key <AC09> { [ l, L, acute, threequarters ] }; + key <AC10> { [ semicolon, colon, ellipsis, doubledagger ] }; + key <AC11> { [ apostrophe, at, ae, AE ] }; + key <BKSL> { [ numbersign, asciitilde, guillemotleft, guillemotright ] }; + + + // + // \ZXCVBNM,./ + // + key <LSGT> { [ backslash, bar, dead_grave, dead_acute ] }; + key <AB01> { [ z, Z, leftanglebracket, rightanglebracket ] }; + key <AB02> { [ x, X, multiply, approximate ] }; + key <AB03> { [ c, C, dead_cedilla, cedilla ] }; + key <AB04> { [ v, V, dead_caron, NoSymbol ] }; + key <AB05> { [ b, B, diaeresis, NoSymbol ] }; + key <AB06> { [ n, N, dead_tilde, NoSymbol ] }; + key <AB07> { [ m, M, macron, NoSymbol ] }; + key <AB08> { [ comma, less, lessthanequal, doublelowquotemark ] }; + key <AB09> { [ period, greater, greaterthanequal, singlelowquotemark ] }; + key <AB10> { [ slash, question, division, questiondown ] }; + + + key <SPCE> { type[Group1]="FOUR_LEVEL", + [ space, space, nobreakspace, nobreakspace ] }; + + key <RALT> { type[Group1]="ONE_LEVEL", [ ISO_Level3_Shift ] }; + modifier_map Mod5 { ISO_Level3_Shift }; + + // NB: putting Shift+<RALT> as Multi_key gives odd behaviour since the + // order of pressing keys affects the result. + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "laptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ie(basic)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "CloGaelach" { + + // Adds support for Clo Gaelach (old orthography for Irish). + // Changes from "basic": + // - dotted consonants as AltGr+consonant or AltGr+Shift+consonant (TPSDFGCBM) + // - long lowercase r as AltGr+R + // - long lowercase s as AltGr+Z + // - long lowercase s dotted as AltGr+Shift+Z + // - some symbols moved around to retain them + // - several characters unlikely to be used are lost + // The long letters are needed only where the font provides + // both the long and short forms as different glyphs. + + include "ie(basic)" + + name[Group1] = "Irish (Clo Gaelach)"; + + key <TLDE> { [ grave, notsign, brokenbar, ssharp ] }; + key <AD04> { [ r, R, 0x100027C, registered ] }; + // long r + key <AD05> { [ t, T, tabovedot, Tabovedot ] }; + key <AD10> { [ p, P, pabovedot, Pabovedot ] }; + + key <AC02> { [ s, S, sabovedot, Sabovedot ] }; + key <AC03> { [ d, D, dabovedot, Dabovedot ] }; + key <AC04> { [ f, F, fabovedot, Fabovedot ] }; + key <AC05> { [ g, G, gabovedot, Gabovedot ] }; + + key <AB01> { [ z, Z, 0x100017F, 0x1001E9B ] }; + // long s, long s dot + key <AB03> { [ c, C, cabovedot, Cabovedot ] }; + key <AB05> { [ b, B, babovedot, Babovedot ] }; + key <AB07> { [ m, M, mabovedot, Mabovedot ] }; + + key <LSGT> { [ backslash, bar, dead_grave, dead_cedilla ] }; +}; + +partial alphanumeric_keys +xkb_symbols "CloGaelachLaptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ie(CloGaelach)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "UnicodeExpert" { + +// This should eventually be a "Unicode Expert" layout like the Mac one. + + name[Group1] = "Irish (Unicode Expert)"; + + key.type[Group1] = "FOUR_LEVEL_ALPHABETIC"; + + // + // Numeric row `1234567890-= + // + key <TLDE> { [ grave, notsign, 0x10000A6, 0x10000A6 ] }; + // broken bar + key <AE01> { [ 1, exclam, NoSymbol, NoSymbol ] }; + key <AE02> { [ 2, quotedbl, dead_doubleacute, dead_doubleacute ] }; + key <AE03> { [ 3, sterling, NoSymbol, NoSymbol ] }; + key <AE04> { [ 4, dollar, EuroSign, EuroSign ] }; + key <AE05> { [ 5, percent, NoSymbol, NoSymbol ] }; + key <AE06> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] }; + key <AE07> { [ 7, ampersand, 0x100204A, 0x100204A ] }; + // Tironian Et + key <AE08> { [ 8, asterisk, dead_abovering, dead_abovering ] }; + key <AE09> { [ 9, parenleft, dead_breve, dead_breve ] }; + key <AE10> { [ 0, parenright, dead_ogonek, dead_ogonek ] }; + key <AE11> { [ minus, underscore, dead_macron, dead_macron ] }; + key <AE12> { [ equal, plus, NoSymbol, NoSymbol ] }; + + // + // QWERTYUIOP[] + // + key <AD01> { [ q, Q, NoSymbol, NoSymbol ] }; + key <AD02> { [ w, W, NoSymbol, NoSymbol ] }; + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD04> { [ r, R, 0x100027C, 0x100027C ] }; + // long r + key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, uacute, Uacute ] }; + key <AD08> { [ i, I, iacute, Iacute ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; + key <AD11> { [ bracketleft, braceleft, dead_hook, dead_hook ] }; + key <AD12> { [ bracketright, braceright, dead_horn, dead_horn ] }; + + // + // ASDFGHJKL;'# + // + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ s, S, NoSymbol, NoSymbol ] }; + key <AC03> { [ d, D, NoSymbol, NoSymbol ] }; + key <AC04> { [ f, F, NoSymbol, NoSymbol ] }; + key <AC05> { [ g, G, NoSymbol, NoSymbol ] }; + key <AC06> { [ h, H, dead_abovedot, dead_abovedot ] }; + key <AC07> { [ j, J, NoSymbol, NoSymbol ] }; + key <AC08> { [ k, K, NoSymbol, NoSymbol ] }; + key <AC09> { [ l, L, NoSymbol, NoSymbol ] }; + key <AC10> { [ semicolon, colon, dead_diaeresis, dead_diaeresis ] }; + key <AC11> { [ apostrophe, at, dead_acute, dead_acute ] }; + key <BKSL> { [ numbersign, asciitilde, dead_tilde, dead_tilde ] }; + + // + // \ZXCVBNM,./ + // + key <LSGT> { [ backslash, bar, dead_grave, dead_grave ] }; + key <AB01> { [ z, Z, 0x100017F, 0x1001E9B ] }; + // long s, long s dot + key <AB02> { [ x, X, NoSymbol, NoSymbol ] }; + key <AB03> { [ c, C, NoSymbol, NoSymbol ] }; + key <AB04> { [ v, V, dead_caron, dead_caron ] }; + key <AB05> { [ b, B, NoSymbol, NoSymbol ] }; + key <AB06> { [ n, N, NoSymbol, NoSymbol ] }; + key <AB07> { [ m, M, NoSymbol, NoSymbol ] }; + key <AB08> { [ comma, less, dead_cedilla, dead_cedilla ] }; + key <AB09> { [ period, greater, dead_abovedot, dead_abovedot ] }; + key <AB10> { [ slash, question, dead_belowdot, dead_belowdot ] }; + + key <SPCE> { type[Group1]="FOUR_LEVEL", + [ space, space, space, nobreakspace ] }; + + key <RALT> { type[Group1]="ONE_LEVEL", [ ISO_Level3_Shift ] }; + modifier_map Mod5 { <RALT> }; + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + Index: xc/programs/xkbcomp/symbols/pc/il diff -u /dev/null xc/programs/xkbcomp/symbols/pc/il:1.4 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/il Sun Jan 19 22:23:18 2003 @@ -0,0 +1,154 @@ + +// based on a keyboard map from an 'xkb/symbols/il' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/il,v 1.4 2003/01/20 03:23:18 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // uses the kbd layout in use in Israel. + + name[Group1]= "Israelian"; + + key <TLDE> { [ semicolon, asciitilde ] }; + + key <AD01> { [ slash, Q ] }; + key <AD02> { [ apostrophe, W ] }; + key <AD03> { [ hebrew_qoph, E ] }; + key <AD04> { [ hebrew_resh, R ] }; + key <AD05> { [ hebrew_aleph,T ] }; + key <AD06> { [ hebrew_tet, Y ] }; + key <AD07> { [ hebrew_waw, U ] }; + key <AD08> { [ hebrew_finalnun, I ] }; + key <AD09> { [ hebrew_finalmem, O ] }; + key <AD10> { [ hebrew_pe, P ] }; + + key <AC01> { [ hebrew_shin, A ] }; + key <AC02> { [ hebrew_dalet,S ] }; + key <AC03> { [ hebrew_gimel,D ] }; + key <AC04> { [ hebrew_kaph, F ] }; + key <AC05> { [ hebrew_ayin, G ] }; + key <AC06> { [ hebrew_yod, H ] }; + key <AC07> { [ hebrew_chet, J ] }; + key <AC08> { [ hebrew_lamed, K ] }; + key <AC09> { [ hebrew_finalkaph, L ] }; + key <AC10> { [ hebrew_finalpe, colon ] }; + key <AC11> { [ comma, quotedbl ] }; + + key <AB01> { [ hebrew_zain, Z ] }; + key <AB02> { [ hebrew_samech, X ] }; + key <AB03> { [ hebrew_bet, C ] }; + key <AB04> { [ hebrew_he, V ] }; + key <AB05> { [ hebrew_nun, B ] }; + key <AB06> { [ hebrew_mem, N ] }; + key <AB07> { [ hebrew_zade, M ] }; + // Mirrored: + key <AB08> { [ hebrew_taw, greater ] }; + key <AB09> { [ hebrew_finalzade, less ] }; + key <AB10> { [ period, question ] }; + + // Note the parens mirroring below: + key <AD11> { [ bracketright, braceright ] }; + key <AD12> { [ bracketleft, braceleft ] }; + key <AE09> { [ 9 , parenright ] }; + key <AE10> { [ 0 , parenleft ] }; + key <BKSL> { [ backslash, bar ] }; +}; + + +// nikud patter based on Dekel Tsur's Hebrew mapping for LyX +partial alphanumeric_keys +xkb_symbols "lyx" { + name[Group1]= "Israelian"; + + key <TLDE> { [ semicolon, asciitilde ] }; + // On some key (e.g. AD01, right below) there is not yet mapping for the + // second shift level. Since I could not figure a simple way to map this + // to "emit nothing", it is currently mapped to the same letter of the + // first shift level (avoiding mapping may risk it be used by a character + // from a different group). + key <AD01> { [ slash, slash ] }; + key <AD02> { [ apostrophe, apostrophe ] }; + key <AD03> { [ hebrew_qoph, 0x10005b8 ] }; // Qamats + key <AD04> { [ hebrew_resh, 0x10005bc ] }; // Dagesh/Shuruq + key <AD05> { [ hebrew_aleph, 0x100200e ] }; // LRM + key <AD06> { [ hebrew_tet, 0x100200f ] }; // RLM + key <AD07> { [ hebrew_waw, 0x10005b9 ] }; // Holam + key <AD08> { [ hebrew_finalnun,hebrew_finalnun] }; + key <AD09> { [ hebrew_finalmem,hebrew_finalmem] }; + key <AD10> { [ hebrew_pe, 0x10005b7 ] }; // Patah + + key <AC01> { [ hebrew_shin, 0x10005b0 ] }; // Sheva + key <AC02> { [ hebrew_dalet, 0x10005bc ] }; // Dagesh/Shuruq + key <AC03> { [ hebrew_gimel, hebrew_gimel ] }; + key <AC04> { [ hebrew_kaph, hebrew_kaph ] }; + key <AC05> { [ hebrew_ayin, 0x10005c2 ] }; // Sin dot + key <AC06> { [ hebrew_yod, 0x10005c1 ] }; // Shin dot + key <AC07> { [ hebrew_chet, 0x10005b4 ] }; // Hiriq + key <AC08> { [ hebrew_lamed, 0x10020aa ] }; // NIS + key <AC09> { [ hebrew_finalkaph,hebrew_finalkaph] }; + key <AC10> { [ hebrew_finalpe, colon ] }; + key <AC11> { [ comma, quotedbl ] }; + + key <AB01> { [ hebrew_zain, hebrew_zain ] }; + key <AB02> { [ hebrew_samech,0x10005b6 ] }; // Segol + key <AB03> { [ hebrew_bet, 0x10005bb ] }; // Qubuts + key <AB04> { [ hebrew_he, 0x10005b1 ] }; // H. Segol + key <AB05> { [ hebrew_nun, 0x10005b2 ] }; // H. Patah + key <AB06> { [ hebrew_mem, 0x10005b3 ] }; // H. Qamats + key <AB07> { [ hebrew_zade, 0x10005b5 ] }; // Tsere + key <AB08> { [ hebrew_taw, greater ] }; + key <AB09> { [ hebrew_finalzade, less ] }; + key <AB10> { [ period, question ] }; + + // Note the parens mirroring below: + key <AD11> { [ bracketright, braceright ] }; + key <AD12> { [ bracketleft, braceleft ] }; + key <AE09> { [ 9 , parenright ] }; + key <AE10> { [ 0 , parenleft ] }; + + key <AE11> { [ minus, 0x10005be ] }; // H. Hiphen +}; + + + +// This is a partial implemetation of the Israeli standard SI-1452 +// It does not implement changes to the English layout ("Alt-English"), +// as I believe that it is not the job of this layout to modify the English +// layout. +partial alphanumeric_keys +xkb_symbols "si1452" { + name[Group1]= "Israelian"; + + include "pc/il(basic)" + + key.type = "THREE_LEVEL"; + + key <TLDE> { [ semicolon, asciitilde,0x10005b0 ]}; // Sheva + key <AB10> { [ period, question, 0x10005c3 ]}; // Sof Pasuq + + // The following may get overriden by the iso9995-3(basic101) symbols. + // therefore they are included here. + // Including them isn't a great idea (for instance: what if group 1 uses + // UK keyboard mapping, and maps shift-3 to sterling? This mapping won't + // preserve that, and I'm not sure that this is a good feature. + key <AE01> { [ 1, exclam , 0x10005b1 ]}; // H. Segol + key <AE02> { [ 2, at , 0x10005b2 ]}; // H. Patah + key <AE03> { [ 3, numbersign , 0x10005b3 ]}; // H. Qamats + key <AE04> { [ 4, dollar , 0x10005b4 ]}; // Hiriq + key <AE05> { [ 5, percent , 0x10005b5 ]}; // Tsere + key <AE06> { [ 6, asciicircum , 0x10005b6 ]}; // Segol + key <AE07> { [ 7, ampersand , 0x10005b7 ]}; // Patah + key <AE08> { [ 8, asterisk , 0x10005b8 ]}; // Qamats + // Mirrored!: + key <AE09> { [ 9, parenright , 0x10005c2 ]}; // Sin dot + key <AE10> { [ 0, parenleft , 0x10005c1 ]}; // Shin dot + key <AE11> { [ minus, underscore , 0x10005b9 ]}; // Holam + key <AE12> { [ equal, plus , 0x10005bc ]}; // Dagesh/Shuruq + + // Mirrored!: + key <AD11> { [ bracketright, braceright, 0x10005bf ]}; // Rafe + key <AD12> { [ bracketleft, braceleft, 0x10005bd ]}; // Meteg + + key <BKSL> { [ backslash, backslash, 0x10005bb ]}; // Qubuts +}; Index: xc/programs/xkbcomp/symbols/pc/il_phonetic diff -u /dev/null xc/programs/xkbcomp/symbols/pc/il_phonetic:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/il_phonetic Thu Nov 21 23:03:28 2002 @@ -0,0 +1,46 @@ + +// based on a keyboard map from an 'xkb/symbols/il_phonetic' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/il_phonetic,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // uses the phonetic layout from old Slackware 'il.map' file + + name[Group1]= "Israelian(phonetic)"; + + key <AE12> { [ equal, plus ], + [ hebrew_doublelowline, hebrew_doublelowline ]}; + + key <LatQ> { [ hebrew_qoph, hebrew_qoph ] }; + key <LatW> { [ hebrew_waw, hebrew_waw ] }; + key <LatE> { [ hebrew_aleph, hebrew_aleph ] }; + key <LatR> { [ hebrew_resh, hebrew_resh ] }; + key <LatT> { [ hebrew_taw, hebrew_tet ] }; + key <LatY> { [ hebrew_ayin, hebrew_ayin ] }; + key <LatU> { [ hebrew_waw, hebrew_waw ] }; + key <LatI> { [ hebrew_yod, hebrew_yod ] }; + key <LatO> { [ hebrew_samech, hebrew_samech ] }; + key <LatP> { [ hebrew_pe, hebrew_finalpe ] }; + + key <LatA> { [ hebrew_aleph, hebrew_aleph ] }; + key <LatS> { [ hebrew_shin, hebrew_shin ] }; + key <LatD> { [ hebrew_dalet, hebrew_dalet ] }; + key <LatF> { [ hebrew_pe, hebrew_finalpe ] }; + key <LatG> { [ hebrew_gimel, hebrew_gimel ] }; + key <LatH> { [ hebrew_he, hebrew_he ] }; + key <LatJ> { [ hebrew_yod, hebrew_yod ] }; + key <LatK> { [ hebrew_kaph, hebrew_finalkaph ] }; + key <LatL> { [ hebrew_lamed, hebrew_lamed ] }; + + key <LatZ> { [ hebrew_zain, hebrew_zain ] }; + key <LatX> { [ hebrew_chet, hebrew_chet ] }; + key <LatC> { [ hebrew_zade, hebrew_finalzade ] }; + key <LatV> { [ hebrew_waw, hebrew_waw ] }; + key <LatB> { [ hebrew_bet, hebrew_bet ] }; + key <LatN> { [ hebrew_nun, hebrew_finalnun ] }; + key <LatM> { [ hebrew_mem, hebrew_finalmem ] }; +}; + + Index: xc/programs/xkbcomp/symbols/pc/ir diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ir:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/ir Thu Nov 21 23:03:28 2002 @@ -0,0 +1,69 @@ + +// based on +// Iranian keymap, by Robert Brady <robert@suse.co.uk> +// Data supplied by Roozbeh Pournader <roozbeh@sharif.edu> +// Minor changes made by Arash Zeini <a.zeini@farsikde.com>, +// and Roozbeh Pournader. +// Last update: 2002-06-19 +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ir,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Iranian"; + + key <TLDE> { [ 0x100200d ] }; + + // Mainly numbers. + key <AE01> { [ 0x10006f1, exclam ] }; + key <AE02> { [ 0x10006f2, 0x100066c ] }; + key <AE03> { [ 0x10006f3, 0x100066b ] }; + key <AE04> { [ 0x10006f4, 0x100fdfc ] }; + key <AE05> { [ 0x10006f5, 0x100066a ] }; + key <AE06> { [ 0x10006f6, multiply ] }; + key <AE07> { [ 0x10006f7, Arabic_comma ] }; + key <AE08> { [ 0x10006f8, asterisk ] }; + key <AE09> { [ 0x10006f9, parenright ] }; + key <AE10> { [ 0x10006f0, parenleft ] }; + key <AE11> { [ minus, Arabic_tatweel ] }; + key <AE12> { [ equal, plus ] }; + + key <AD01> { [ Arabic_dad, Arabic_sukun ] }; + key <AD02> { [ Arabic_sad, Arabic_dammatan ] }; + key <AD03> { [ Arabic_theh, Arabic_kasratan ] }; + key <AD04> { [ Arabic_qaf, Arabic_fathatan ] }; + key <AD05> { [ Arabic_feh, Arabic_damma ] }; + key <AD06> { [ Arabic_ghain, Arabic_kasra ] }; + key <AD07> { [ Arabic_ain, Arabic_fatha ] }; + key <AD08> { [ Arabic_heh, Arabic_shadda ] }; + key <AD09> { [ Arabic_khah, bracketright ] }; + key <AD10> { [ Arabic_hah, bracketleft ] }; + key <AD11> { [ Arabic_jeem, braceright ] }; + key <AD12> { [ 0x1000686, braceleft ] }; + + key <AC01> { [ Arabic_sheen, Arabic_hamzaonwaw ] }; + key <AC02> { [ Arabic_seen, Arabic_hamzaonyeh ] }; + key <AC03> { [ 0x10006cc, Arabic_yeh ] }; + key <AC04> { [ Arabic_beh, Arabic_hamzaunderalef] }; + key <AC05> { [ Arabic_lam, Arabic_hamzaonalef ] }; + key <AC06> { [ Arabic_alef, Arabic_maddaonalef ] }; + key <AC07> { [ Arabic_teh, Arabic_tehmarbuta ] }; + key <AC08> { [ Arabic_noon, guillemotright ] }; + key <AC09> { [ Arabic_meem, guillemotleft ] }; + key <AC10> { [ 0x10006a9, colon ] }; + key <AC11> { [ 0x10006af, Arabic_semicolon ] }; + + key <BKSL> { [ backslash, bar ] }; + key <SPCE> { [ space, 0x100200c ] }; + + key <AB01> { [ Arabic_zah, Arabic_kaf ] }; + key <AB02> { [ Arabic_tah ] }; + key <AB03> { [ Arabic_zain, 0x1000698 ] }; + key <AB04> { [ Arabic_ra ] }; + key <AB05> { [ Arabic_thal, 0x100200c ] }; + key <AB06> { [ Arabic_dal ] }; + key <AB07> { [ 0x100067e, Arabic_hamza ] }; + key <AB08> { [ Arabic_waw, greater ] }; + key <AB09> { [ period, less ] }; + key <AB10> { [ slash, Arabic_question_mark ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/is diff -u /dev/null xc/programs/xkbcomp/symbols/pc/is:1.3 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/is Mon Nov 25 20:57:25 2002 @@ -0,0 +1,67 @@ + +// based on +// XKB keyboard by Hrafnkell Eiriksson - hkelle@rhi.hi.is +// fixes by Olafur Osvaldsson - oli@isnic.is +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/is,v 1.3 2002/11/26 01:57:25 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type4)" + + name[Group1]="Icelandic"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE04> { [ 4, dollar, onequarter, currency ] }; + key <AE11> { [odiaeresis, Odiaeresis, backslash, questiondown ] }; + key <AE12> { [ minus, underscore, ccedilla, dead_ogonek ] }; + + key <AD11> { [ eth, ETH, dead_diaeresis, dead_abovering ] }; + key <AD12> { [apostrophe, question, asciitilde, dead_macron ] }; + + key <AC10> { [ ae, AE, asciicircum, dead_doubleacute ] }; + key <AC11> { [dead_acute, Adiaeresis, dead_circumflex, dead_caron] }; + key <TLDE> { [ degree, diaeresis, notsign, notsign ] }; + + key <BKSL> { [ plus, asterisk, grave, dead_breve ] }; + key <AB10> { [ thorn, THORN, dead_belowdot, dead_abovedot ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + // modify the default Icelandic layout to use Sun dead keys + + include "pc/is(basic)" + + + key <TLDE> { [SunFA_Circum, degree, notsign, notsign ] }; + key <AE12> { [SunFA_Acute, SunFA_Grave, SunFA_Cedilla, SunFA_Cedilla ] }; + key <AD11> { [udiaeresis, Udiaeresis, SunFA_Diaeresis, SunFA_Diaeresis ] }; + key <AD12> { [ plus, asterisk, SunFA_Tilde, dead_macron ] }; + key <AC10> { [odiaeresis, Odiaeresis, SunFA_Acute, SunFA_Acute ] }; + key <AC11> { [adiaeresis, Adiaeresis, SunFA_Circum, SunFA_Circum ] }; + key <BKSL> { [numbersign, acute, SunFA_Grave, SunFA_Grave ] }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // modify the default Icelandic layout to not have any dead keys + + include "pc/is(basic)" + + key <TLDE> { [asciicircum, degree, notsign, notsign ] }; + key <AE12> { [apostrophe, grave, cedilla, cedilla ] }; + key <AD11> { [udiaeresis, Udiaeresis, diaeresis, diaeresis ] }; + key <AD12> { [ plus, asterisk, asciitilde, macron ] }; + key <AC10> { [odiaeresis, Odiaeresis, acute, acute ] }; + key <AC11> { [adiaeresis, Adiaeresis, asciicircum, asciicircum ] }; + key <BKSL> { [numbersign, acute, grave, grave ] }; + key <AB10> { [ thorn, THORN, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/it diff -u /dev/null xc/programs/xkbcomp/symbols/pc/it:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/it Thu Nov 21 23:03:28 2002 @@ -0,0 +1,45 @@ + +// based on a keyboard map from an 'xkb/symbols/it' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/it,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type4)" + + name[Group1]="Italian"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE03> { [ 3, sterling, threesuperior, sterling ] }; + key <AE11> { [apostrophe, question, grave, questiondown ] }; + key <AE12> { [ igrave, asciicircum, asciitilde, dead_ogonek ] }; + + key <AD11> { [ egrave, eacute, bracketleft, dead_abovering ] }; + key <AD12> { [ plus, asterisk, bracketright, dead_macron ] }; + + key <AC10> { [ ograve, ccedilla, at, dead_doubleacute ] }; + key <AC11> { [ agrave, degree, numbersign, numbersign ] }; + key <TLDE> { [ backslash, bar, notsign, notsign ] }; + + key <BKSL> { [ ugrave, section, dead_grave, dead_breve ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic italian layout to eliminate all dead keys + + include "pc/it(basic)" + + key <AE12> { [ igrave, asciicircum, asciitilde, ogonek ] }; + key <AD11> { [ egrave, eacute, bracketleft, degree ] }; + key <AD12> { [ plus, asterisk, bracketright, macron ] }; + key <AC10> { [ ograve, ccedilla, at, doubleacute ] }; + key <BKSL> { [ ugrave, section, grave, breve ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/iu diff -u /dev/null xc/programs/xkbcomp/symbols/pc/iu:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/iu Thu Nov 21 23:03:28 2002 @@ -0,0 +1,67 @@ + +// based on +// Inuktitut keyboard for X11 +// written by Pablo Saratxaga <pablo@mandrakesoft.com> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/iu,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Inuktitut"; + + key <AE01> { [ 0x01001595, 1 ] }; + key <AE02> { [ 0x01001449, 2 ] }; + key <AE03> { [ 0x01001550, 3 ] }; + key <AE04> { [ 0x01001483, 4 ] }; + key <AE05> { [ 0x01001466, 5 ] }; + key <AE06> { [ 0x01001585, 6 ] }; + key <AE07> { [ 0x010014bb, 7 ] }; + key <AE08> { [ 0x010014d0, 8 ] }; + key <AE09> { [ 0x010014ea, 9 ] }; + key <AE10> { [ 0x0100153e, 0 ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ 0x0100155d, equal ] }; + + key <AD01> { [ 0x0100158f, 0x0100148b ] }; + key <AD02> { [ 0x01001403, 0x01001431 ] }; + key <AD03> { [ 0x0100157f, 0x01001546 ] }; + key <AD04> { [ 0x0100146d, 0x01001596 ] }; + key <AD05> { [ 0x0100144e, 0x01001671 ] }; + key <AD06> { [ 0x010014ef, 0x01001673 ] }; + key <AD07> { [ 0x010014a5, 0x01001675 ] }; + key <AD08> { [ 0x010014c2, 0x010015a4 ] }; + key <AD09> { [ 0x010014d5, 0x010015a0 ] }; + key <AD10> { [ 0x01001528, 0x010015a6 ] }; + key <AD11> { [ 0x010014a1, 0x01001505 ] }; + key <AD12> { [ dead_abovedot, 0x0100141e] }; + + key <AC01> { [ 0x01001591, 0x0100148d ] }; + key <AC02> { [ 0x01001405, 0x01001433 ] }; + key <AC03> { [ 0x01001581, 0x01001548 ] }; + key <AC04> { [ 0x0100146f, 0x01001555 ] }; + key <AC05> { [ 0x01001450, parenleft ] }; + key <AC06> { [ 0x010014f1, parenright ] }; + key <AC07> { [ 0x010014a7, 0x0100152a ] }; + key <AC08> { [ 0x010014c4, 0x01001557 ] }; + key <AC09> { [ 0x010014d7, 0x010015a2 ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + + key <AB01> { [ 0x01001593, 0x01001490 ] }; + key <AB02> { [ 0x0100140a, 0x01001438 ] }; + key <AB03> { [ 0x01001583, 0x0100154b ] }; + key <AB04> { [ 0x01001472, question ] }; + key <AB05> { [ 0x01001455, 0x0100157c ] }; + key <AB06> { [ 0x010014f4, 0x010014c7 ] }; + key <AB07> { [ 0x010014aa, 0x010014da ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ 0x0100152d, 0x01001559 ] }; + + key <TLDE> { [ 0x0100157b, 0x01001575 ] }; + key <LSGT> { [ 0x01001579, 0x01001577 ] }; + key <BKSL> { [ backslash, bar ] }; + +// End alphanumeric section +}; Index: xc/programs/xkbcomp/symbols/pc/kan diff -u /dev/null xc/programs/xkbcomp/symbols/pc/kan:1.1 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/kan Sat Dec 14 19:44:56 2002 @@ -0,0 +1,69 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/kan,v 1.1 2002/12/15 00:44:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Inscript layout for Kannada + // Author : G Karunakar <karunakar@freedomink.org> + // Date : Wed Nov 13 17:22:58 IST 2002 + // Kannada digits mapped in basic only + + name[Group1]= "Kannada"; + + key <TLDE> { [ 0x01000cca, 0x01000c92 ] }; + key <AE01> { [ 0x01000ce7, 0x01000c8d ] }; + key <AE02> { [ 0x01000ce8, 0x01000cc5 ] }; + key <AE03> { [ 0x01000ce9 ] }; + key <AE04> { [ 0x01000cea ] }; + key <AE05> { [ 0x01000ceb ] }; + key <AE06> { [ 0x01000cec ] }; + key <AE07> { [ 0x01000ced ] }; + key <AE08> { [ 0x01000cee ] }; + key <AE09> { [ 0x01000cef ] }; + key <AE10> { [ 0x01000ce6 ] }; + key <AE11> { [ 0x01000c83 ] }; + key <AE12> { [ 0x01000cc3, 0x01000c8b ] }; + + key <AD01> { [ 0x01000ccc, 0x01000c94 ] }; + key <AD02> { [ 0x01000cc8, 0x01000c90 ] }; + key <AD03> { [ 0x01000cbe, 0x01000c86 ] }; + key <AD04> { [ 0x01000cc0, 0x01000c88 ] }; + key <AD05> { [ 0x01000cc2, 0x01000c8a ] }; + key <AD06> { [ 0x01000cac, 0x01000cad ] }; + key <AD07> { [ 0x01000cb9, 0x01000c99 ] }; + key <AD08> { [ 0x01000c97, 0x01000c98 ] }; + key <AD09> { [ 0x01000ca6, 0x01000ca7 ] }; + key <AD10> { [ 0x01000c9c, 0x01000c9d ] }; + key <AD11> { [ 0x01000ca1, 0x01000ca2 ] }; + key <AD12> { [ 0x01000cbc, 0x01000c9e ] }; + + key <AC01> { [ 0x01000ccb, 0x01000c93 ] }; + key <AC02> { [ 0x01000cc7, 0x01000c8f ] }; + key <AC03> { [ 0x01000ccd, 0x01000c85 ] }; + key <AC04> { [ 0x01000cbf, 0x01000c87 ] }; + key <AC05> { [ 0x01000cc1, 0x01000c89 ] }; + key <AC06> { [ 0x01000caa, 0x01000cab ] }; + key <AC07> { [ 0x01000cb0, 0x01000cb1 ] }; + key <AC08> { [ 0x01000c95, 0x01000c96 ] }; + key <AC09> { [ 0x01000ca4, 0x01000ca5 ] }; + key <AC10> { [ 0x01000c9a, 0x01000c9b ] }; + key <AC11> { [ 0x01000c9f, 0x01000ca0 ] }; + + key <AB01> { [ 0x01000cc6, 0x01000c8e ] }; + key <AB02> { [ 0x01000c82, 0x01000c81 ] }; + key <AB03> { [ 0x01000cae, 0x01000ca3 ] }; + key <AB04> { [ 0x01000ca8, 0x01000ca9 ] }; + key <AB05> { [ 0x01000cb5, 0x01000cb4 ] }; + key <AB06> { [ 0x01000cb2, 0x01000cb3 ] }; + key <AB07> { [ 0x01000cb8, 0x01000cb6 ] }; + key <AB08> { [ comma , 0x01000cb7 ] }; + key <AB09> { [ period , 0x01000ce4 ] }; + key <AB10> { [ 0x01000caf, 0x01000040 ] }; + key <BKSL> { [ 0x01000cc9, 0x01000c91 ] }; + + key <RALT> { + symbols[Group1] = [ Mode_switch , Multi_key ], + virtualMods = AltGr + }; + +}; Index: xc/programs/xkbcomp/symbols/pc/la diff -u /dev/null xc/programs/xkbcomp/symbols/pc/la:1.2 --- /dev/null Thu Feb 27 12:35:36 2003 +++ xc/programs/xkbcomp/symbols/pc/la Thu Nov 21 23:03:28 2002 @@ -0,0 +1,62 @@ + +// based on a keyboard +// Modified for a real Latin American Keyboard by Fabian Mandelbaum +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/la,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type4)" + + name[Group1]="Latin American"; + + key <AE01> { [ 1, exclam, bar, exclamdown ] }; + key <AE03> { [ 3, numbersign, periodcentered, sterling ] }; + key <AE04> { [ 4, dollar, asciitilde, dollar ] }; + key <AE06> { [ 6, ampersand, notsign, fiveeighths ] }; + key <AE11> { [apostrophe, question, backslash, questiondown ] }; + key <AE12> { [questiondown, exclamdown, dead_cedilla, dead_ogonek] }; + + key <AD11> { [dead_acute, dead_diaeresis, dead_diaeresis, dead_abovering ] }; + key <AD12> { [ plus, asterisk, asciitilde, dead_macron ] }; + + key <AC10> { [ ntilde, Ntilde, asciitilde, dead_doubleacute ] }; + key <AC11> { [ braceleft, bracketleft, dead_circumflex, braceleft] }; + key <TLDE> { [ bar, degree, notsign, notsign ] }; + + key <BKSL> { [braceright, bracketright, dead_grave, braceright ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + include "pc/la(basic)" + + key <AC11> { [SunFA_Acute, SunFA_Diaeresis, braceleft, braceleft ] }; + key <AD11> { [SunFA_Grave, SunFA_Circum, bracketleft, dead_abovering ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "pc/la(Sundeadkeys)" + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + include "pc/la(basic)" + + key <AE12> { [questiondown, exclamdown, cedilla, ogonek ] }; + key <AD11> { [ grave, asciicircum, bracketleft, degree ] }; + key <AD12> { [ plus, asterisk, bracketright, macron ] }; + key <AC10> { [ ntilde, Ntilde, asciitilde, doubleacute ] }; + key <AC11> { [ acute, diaeresis, braceleft, braceleft ] }; + key <BKSL> { [ ccedilla, Ccedilla, braceright, breve ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; + Index: xc/programs/xkbcomp/symbols/pc/latin diff -u /dev/null xc/programs/xkbcomp/symbols/pc/latin:1.4 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/latin Sat Jan 25 21:01:48 2003 @@ -0,0 +1,179 @@ + +// Common Latin alphabet layout +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/latin,v 1.4 2003/01/26 02:01:48 dawes Exp $ + +default partial +xkb_symbols "basic" { + + key <AE01> { [ 1, exclam, onesuperior, exclamdown ] }; + key <AE02> { [ 2, at, twosuperior, oneeighth ] }; + key <AE03> { [ 3, numbersign, threesuperior, sterling ] }; + key <AE04> { [ 4, dollar, onequarter, dollar ] }; + key <AE05> { [ 5, percent, onehalf, threeeighths ] }; + key <AE06> { [ 6, asciicircum, threequarters, fiveeighths ] }; + key <AE07> { [ 7, ampersand, braceleft, seveneighths ] }; + key <AE08> { [ 8, asterisk, bracketleft, trademark ] }; + key <AE09> { [ 9, parenleft, bracketright, plusminus ] }; + key <AE10> { [ 0, parenright, braceright, degree ] }; + key <AE11> { [ minus, underscore, backslash, questiondown ] }; + key <AE12> { [ equal, plus, dead_cedilla, dead_ogonek ] }; + + key <AD01> { [ q, Q, at, Greek_OMEGA ] }; + key <AD02> { [ w, W, lstroke, Lstroke ] }; + key <AD03> { [ e, E ] }; + key <AD04> { [ r, R, paragraph, registered ] }; + key <AD05> { [ t, T, tslash, Tslash ] }; + key <AD06> { [ y, Y, leftarrow, yen ] }; + key <AD07> { [ u, U, downarrow, uparrow ] }; + key <AD08> { [ i, I, rightarrow, idotless ] }; + key <AD09> { [ o, O, oslash, Ooblique ] }; + key <AD10> { [ p, P, thorn, THORN ] }; + key <AD11> { [bracketleft, braceleft, dead_diaeresis, dead_abovering ] }; + key <AD12> { [bracketright, braceright, dead_tilde, dead_macron ] }; + + key <AC01> { [ a, A, ae, AE ] }; + key <AC02> { [ s, S, ssharp, section ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, dstroke, ordfeminine ] }; + key <AC05> { [ g, G, eng, ENG ] }; + key <AC06> { [ h, H, hstroke, Hstroke ] }; + key <AC07> { [ j, J ] }; + key <AC08> { [ k, K, kra, ampersand ] }; + key <AC09> { [ l, L, lstroke, Lstroke ] }; + key <AC10> { [ semicolon, colon, dead_acute, dead_doubleacute ] }; + key <AC11> { [apostrophe, quotedbl, dead_circumflex, dead_caron ] }; + key <TLDE> { [ grave, asciitilde, notsign, notsign ] }; + + key <BKSL> { [ backslash, bar, dead_grave, dead_breve ] }; + key <AB01> { [ z, Z, guillemotleft, less ] }; + key <AB02> { [ x, X, guillemotright, greater ] }; + key <AB03> { [ c, C, cent, copyright ] }; + key <AB04> { [ v, V, leftdoublequotemark, grave ] }; + key <AB05> { [ b, B, rightdoublequotemark, apostrophe ] }; + key <AB06> { [ n, N ] }; + key <AB07> { [ m, M, mu, masculine ] }; + key <AB08> { [ comma, less, horizconnector, multiply ] }; + key <AB09> { [ period, greater, periodcentered, division ] }; + key <AB10> { [ slash, question, dead_belowdot, dead_abovedot ] }; + +}; + +// Northern Europe ( Danish, Finnish, Norwegian, Swedish) common layout + +partial +xkb_symbols "type2" { + + include "pc/latin" + + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, quotedbl, at, twosuperior ] }; + key <AE03> { [ 3, numbersign, sterling, threesuperior] }; + key <AE04> { [ 4, currency, dollar, onequarter ] }; + key <AE05> { [ 5, percent, onehalf, cent ] }; + key <AE06> { [ 6, ampersand, yen, fiveeighths ] }; + key <AE07> { [ 7, slash, braceleft, division ] }; + key <AE08> { [ 8, parenleft, bracketleft, guillemotleft] }; + key <AE09> { [ 9, parenright, bracketright, guillemotright] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD04> { [ r, R, registered, registered ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD09> { [ o, O, oe, OE ] }; + key <AD11> { [ aring, Aring, dead_diaeresis, dead_abovering ] }; + key <AD12> { [dead_diaeresis, dead_circumflex, dead_tilde, dead_caron ] }; + + key <AC01> { [ a, A, ordfeminine, masculine ] }; + + key <AB03> { [ c, C, copyright, copyright ] }; + key <AB08> { [ comma, semicolon, dead_cedilla, dead_ogonek ] }; + key <AB09> { [ period, colon, periodcentered, dead_abovedot ] }; + key <AB10> { [ minus, underscore, dead_belowdot, dead_abovedot ] }; +}; + +// Slavic Latin ( Albanian, Croatian, Polish, Slovene, Yugoslav) +// common layout + +partial +xkb_symbols "type3" { + + include "pc/latin" + + key <AD01> { [ q, Q, backslash, Greek_OMEGA ] }; + key <AD02> { [ w, W, bar, Lstroke ] }; + key <AD06> { [ z, Z, leftarrow, yen ] }; + + key <AC04> { [ f, F, bracketleft, ordfeminine ] }; + key <AC05> { [ g, G, bracketright, ENG ] }; + key <AC08> { [ k, K, lstroke, ampersand ] }; + + key <AB01> { [ y, Y, guillemotleft, less ] }; + key <AB04> { [ v, V, at, grave ] }; + key <AB05> { [ b, B, braceleft, apostrophe ] }; + key <AB06> { [ n, N, braceright, braceright ] }; + key <AB07> { [ m, M, section, masculine ] }; + key <AB08> { [ comma, semicolon, less, multiply ] }; + key <AB09> { [ period, colon, greater, division ] }; +}; + +// Another one Latin common layout +// (German, Estonian, Spanish, Icelandic, Italian, Latin American, Portuguese) + +partial +xkb_symbols "type4" { + + include "pc/latin" + + key <AE02> { [ 2, quotedbl, at, oneeighth ] }; + key <AE06> { [ 6, ampersand, notsign, fiveeighths ] }; + key <AE07> { [ 7, slash, braceleft, seveneighths ] }; + key <AE08> { [ 8, parenleft, bracketleft, trademark ] }; + key <AE09> { [ 9, parenright, bracketright, plusminus ] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + + key <AD03> { [ e, E, EuroSign, cent ] }; + + key <AB08> { [ comma, semicolon, horizconnector, multiply ] }; + key <AB09> { [ period, colon, periodcentered, division ] }; + key <AB10> { [ minus, underscore, dead_belowdot, dead_abovedot ] }; +}; + +partial +xkb_symbols "nodeadkeys" { + + key <AE12> { [ equal, plus, cedilla, ogonek ] }; + key <AD11> { [bracketleft, braceleft, diaeresis, degree ] }; + key <AD12> { [bracketright, braceright, asciitilde, macron ] }; + key <AC10> { [ semicolon, colon, acute, doubleacute ] }; + key <AC11> { [apostrophe, quotedbl, asciicircum, caron ] }; + key <BKSL> { [ backslash, bar, grave, breve ] }; + key <AB10> { [ slash, question, dead_belowdot, abovedot ] }; +}; + +partial +xkb_symbols "type2_nodeadkeys" { + + include "pc/latin(nodeadkeys)" + + key <AD11> { [ aring, Aring, diaeresis, degree ] }; + key <AD12> { [ diaeresis, asciicircum, asciitilde, caron ] }; + key <AB08> { [ comma, semicolon, cedilla, ogonek ] }; + key <AB09> { [ period, colon, periodcentered, abovedot ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; + +partial +xkb_symbols "type3_nodeadkeys" { + + include "pc/latin(nodeadkeys)" +}; + +partial +xkb_symbols "type4_nodeadkeys" { + + include "pc/latin(nodeadkeys)" + + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; + Index: xc/programs/xkbcomp/symbols/pc/lo diff -u /dev/null xc/programs/xkbcomp/symbols/pc/lo:1.1 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/lo Sat Jan 25 21:38:14 2003 @@ -0,0 +1,80 @@ +// $XConsortium: lo 2002/11/28 $ +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/lo,v 1.1 2003/01/26 02:38:14 dawes Exp $ +// +// Lao keymap, by Anousak Souphavanh <anousak@muanglao.com> +// +// +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple US/ASCII + // keyboard and a Lao keyboard + // This keymap uses the Lao keyboard standard [kind of] widely used inLaos + + name[Group1]= "Lao"; + + // Alphanumeric section + key <TLDE> { [ 0x100200D ]}; + key <AE01> { [ 0x1000ea2, 0x1000ed1 ]}; + key <AE01> { [ 0x1000ea2, 0x1000ed1 ]}; + key <AE02> { [ 0x1000e9f, 0x1000ed2 ]}; + key <AE03> { [ 0x1000ec2, 0x1000ed3 ]}; + key <AE04> { [ 0x1000e96, 0x1000ed4 ]}; + key <AE05> { [ 0x1000eb8, 0x1000ecc ]}; + key <AE06> { [ 0x1000eb9, 0x1000ebc ]}; + key <AE07> { [ 0x1000e84, 0x1000ed5 ]}; + key <AE08> { [ 0x1000e95, 0x1000ed6 ]}; + key <AE09> { [ 0x1000e88, 0x1000ed7 ]}; + key <AE10> { [ 0x1000e82, 0x1000ed8 ]}; + key <AE11> { [ 0x1000e8a, 0x1000ed9 ]}; + key <AE12> { [ 0x1000ecd ]}; + + key <AD01> { [ 0x1000ebb ]}; + key <AD02> { [ 0x1000ec4, 0x1000ed0 ]}; + key <AD03> { [ 0x1000eb3 ]}; + key <AD04> { [ 0x1000e9e, underscore ]}; + key <AD05> { [ 0x1000eb0, plus ]}; + key <AD06> { [ 0x1000eb4 ]}; + key <AD07> { [ 0x1000eb5 ]}; + key <AD08> { [ 0x1000ea3, 0x1000eae ]}; + key <AD09> { [ 0x1000e99 ]}; + key <AD10> { [ 0x1000e8d, 0x1000ebd ]}; + key <AD11> { [ 0x1000e9a, minus ]}; + key <AD12> { [ 0x1000ea5, braceright ]}; + key <BKSL> { [ 0x1000edc, 0x1000edd ]}; + + key <AC01> { [ 0x1000eb1 ]}; + key <AC02> { [ 0x1000eab, semicolon ]}; + key <AC03> { [ 0x1000e81, period ]}; + key <AC04> { [ 0x1000e94, comma ]}; + key <AC05> { [ 0x1000ec0, colon ]}; + key <AC06> { [ 0x1000ec9, 0x1000eca ]}; + key <AC07> { [ 0x1000ec8, 0x1000ecb ]}; + key <AC08> { [ 0x1000eb2, exclam ]}; + key <AC09> { [ 0x1000eaa, question ]}; + key <AC10> { [ 0x1000ea7, percent ]}; + key <AC11> { [ 0x1000e87, equal ]}; + + key <AB01> { [ 0x1000e9c, 0x10020ad ]}; + key <AB02> { [ 0x1000e9b, parenleft ]}; + key <AB03> { [ 0x1000ec1, 0x1000eaf ]}; + key <AB04> { [ 0x1000ead ]}; + key <AB05> { [ 0x1000eb6 ]}; + key <AB06> { [ 0x1000eb7 ]}; + key <AB07> { [ 0x1000e97, 0x1000ec6 ]}; + key <AB08> { [ 0x1000ea1, quoteleft ]}; + key <AB09> { [ 0x1000ec3, dollar ]}; + key <AB10> { [ 0x1000e9d, parenright ]}; + +override key <LFSH> { + type="PC_SYSRQ", + [ Shift_L, ISO_First_Group ] + }; +override key <RTSH> { + type="PC_SYSRQ", + [ Shift_R, ISO_Last_Group ] + }; +}; Index: xc/programs/xkbcomp/symbols/pc/lt diff -u /dev/null xc/programs/xkbcomp/symbols/pc/lt:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/lt Sat Dec 14 17:26:11 2002 @@ -0,0 +1,121 @@ + +// based on +// Lithuanian keyboard map by Rièardas Èepas <rch@richard.eu.org> +// merged into one file by Nerijus Baliûnas +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/lt,v 1.3 2002/12/14 22:26:11 dawes Exp $ + +// If you want to have 2 layouts, use +// Option "XkbLayout" "lt,lt(lt_us)" + +// Lithuanian Baltic layout - Lithuanian letters on the numeric row +partial default alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Lithuanian"; + + key <AE01> { [ aogonek, Aogonek ] }; + key <AE02> { [ ccaron, Ccaron ] }; + key <AE03> { [ eogonek, Eogonek ] }; + key <AE04> { [ eabovedot, Eabovedot ] }; + key <AE05> { [ iogonek, Iogonek ] }; + key <AE06> { [ scaron, Scaron ] }; + key <AE07> { [ uogonek, Uogonek ] }; + key <AE08> { [ umacron, Umacron ] }; + key <AE09> { [doublelowquotemark, parenleft ] }; + key <AE10> { [leftdoublequotemark,parenright ] }; + key <AE12> { [ zcaron, Zcaron ] }; + + key <LSGT> { [ endash, EuroSign ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +// Similar to the above, but you should use Right Alt + numeric row +// for Lithuanian letters +partial default alphanumeric_keys modifier_keys +xkb_symbols "lt_us" { + + include "pc/latin" + + name[Group1]="Lithuanian"; + + key.type = "FOUR_LEVEL"; + + key <AE01> { [ 1, exclam, aogonek, Aogonek ] }; + key <AE02> { [ 2, at, ccaron, Ccaron ] }; + key <AE03> { [ 3, numbersign, eogonek, Eogonek ] }; + key <AE04> { [ 4, dollar, eabovedot, Eabovedot ] }; + key <AE05> { [ 5, percent, iogonek, Iogonek ] }; + key <AE06> { [ 6, asciicircum, scaron, Scaron ] }; + key <AE07> { [ 7, ampersand, uogonek, Uogonek ] }; + key <AE08> { [ 8, asterisk, umacron, Umacron ] }; + key <AE09> { [ 9, parenleft, doublelowquotemark, parenleft ] }; + key <AE10> { [ 0, parenright, leftdoublequotemark,parenright ] }; + key <AE12> { [ equal, plus, zcaron, Zcaron ] }; + + key <AD03> { [ e, E, endash, EuroSign ] }; + key <LSGT> { [ endash, EuroSign ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +// Lithuanian keyboard map by Gediminas Paulauskas <menesis@delfi.lt> +// Minor modification by Rièardas Èepas according to http://sun3.mif.vu.lt/cs/TK4/lithkeyb.html + +// Describes Lithuanian keymap LST 1582:2000 +// Extensions: B01 L3 is "<" , B02 L3 is ">" and B03 L3 is endash to make this +// layout usable with pc101 and pc104 keyboards. + +partial default alphanumeric_keys modifier_keys +xkb_symbols "lt_std" { + + include "pc/latin" + + name[Group1]= "Lithuanian"; + + key.type = "FOUR_LEVEL"; + + key <TLDE> {[ grave, asciitilde, acute ]}; + key <AE01> {[ exclam, 1, at ]}; + key <AE02> {[ minus, 2, underscore ]}; + key <AE03> {[ slash, 3, numbersign ]}; + key <AE04> {[ semicolon, 4, dollar ]}; + key <AE05> {[ colon, 5, section ]}; + key <AE06> {[ comma, 6, asciicircum ]}; + key <AE07> {[ period, 7, ampersand ]}; + key <AE08> {[ equal, 8, asterisk ]}; + key <AE09> {[ parenleft, 9, bracketleft ]}; + key <AE10> {[ parenright, 0, bracketright ]}; + key <AE11> {[ question, plus, apostrophe ]}; + key <AE12> {[ x, X, percent ]}; + key <AD01> {[ aogonek, Aogonek ]}; + key <AD02> {[ zcaron, Zcaron ]}; + key <AD03> {[ e, E, EuroSign ]}; + key <AD11> {[ iogonek, Iogonek, braceleft ]}; + key <AD12> {[ w, W, braceright ]}; + key <AC04> {[ scaron, Scaron ]}; + key <AC10> {[ uogonek, Uogonek ]}; + key <AC11> {[ eabovedot, Eabovedot, quotedbl ]}; + key <AB01> {[ z, Z, less ]}; + key <AB02> {[ umacron, Umacron, greater ]}; + key <AB03> {[ c, C, endash ]}; + key <AB08> {[ ccaron, Ccaron, doublelowquotemark ]}; + key <AB09> {[ f, F, leftdoublequotemark ]}; +// this is actually right quote for Lithuanian + key <AB10> {[ eogonek, Eogonek, backslash ]}; + key <BKSL> {[ q, Q, bar ]}; + key <SPCE> {[ space, space, nobreakspace, nobreakspace ]}; + + key <LSGT> {[ less, greater, endash ]}; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/lv diff -u /dev/null xc/programs/xkbcomp/symbols/pc/lv:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/lv Thu Nov 21 23:03:28 2002 @@ -0,0 +1,36 @@ + +// based on +// Latvian keyboard map by Ilya Ketris <Ilya.Ketris@ipro.lv> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/lv,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Latvian"; + + key <AE04> { [ 4, dollar, EuroSign, cent ] }; + + key <AD03> { [ e, E, emacron, Emacron ] }; + key <AD04> { [ r, R, rcedilla, Rcedilla ] }; + key <AD07> { [ u, U, umacron, Umacron ] }; + key <AD08> { [ i, I, imacron, Imacron ] }; + key <AD09> { [ o, O, omacron, Omacron ] }; + + key <AC01> { [ a, A, amacron, Amacron ] }; + key <AC02> { [ s, S, scaron, Scaron ] }; + key <AC05> { [ g, G, gcedilla, Gcedilla ] }; + key <AC08> { [ k, K, kcedilla, Kcedilla ] }; + key <AC09> { [ l, L, lcedilla, Lcedilla ] }; + key <AC11> { [apostrophe, quotedbl, leftdoublequotemark, doublelowquotemark ] }; + + key <AB01> { [ z, Z, zcaron, Zcaron ] }; + key <AB03> { [ c, C, ccaron, Ccaron ] }; + key <AB06> { [ n, N, ncedilla, Ncedilla ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/mk diff -u /dev/null xc/programs/xkbcomp/symbols/pc/mk:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/mk Thu Nov 21 23:03:28 2002 @@ -0,0 +1,67 @@ + +// base on keyboard map: +// Author: Damjan Georgievski <gdamjan@freemail.org.mk> +// Revision: 1.4 +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/mk,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Macedonian"; + + key <AB01> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AC02> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AC01> { [ Cyrillic_a, Cyrillic_A ] }; + key <AD01> { [ Cyrillic_lje, Cyrillic_LJE ] }; + key <AD02> { [ Cyrillic_nje, Cyrillic_NJE ] }; + key <AB03> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AB02> { [ Cyrillic_dzhe, Cyrillic_DZHE ] }; + key <AC03> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AD03> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AB04> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AD05> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AD04> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AB06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AB05> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AC06> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AC05> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD06> { [ Macedonia_dse, Macedonia_DSE ] }; + key <AB07> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AC07> { [ Cyrillic_je, Cyrillic_JE ] }; + key <AD07> { [ Cyrillic_u, Cyrillic_U ] }; + key <AC08> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD08> { [ Cyrillic_i, Cyrillic_I ] }; + key <AD09> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC09> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AD10> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC11> { [ Macedonia_kje, Macedonia_KJE ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ Macedonia_gje, Macedonia_GJE ] }; + key <BKSL> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AE12> { [ equal, plus ] }; + key <AE11> { [ minus, underscore ] }; + key <TLDE> { [ grave, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, doublelowquotemark ] }; + key <AE03> { [ 3, leftdoublequotemark ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AB08> { [ comma, semicolon ] }; + key <AB09> { [ period, colon ] }; + key <AB10> { [ slash, question ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "pc104" { + include "pc/mk(basic)" + include "pc/mk(win)" +}; + Index: xc/programs/xkbcomp/symbols/pc/ml diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ml:1.1 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/ml Sat Jan 25 21:30:23 2003 @@ -0,0 +1,91 @@ + +// Description : A keymap for Malayalam +// Encoding : Unicode (http://www.unicode.org) +// Author : Baiju M <baiju@freeshell.org> +// Date : Sat Aug 17 21:10:48 IST 2002 +// Mapping: + +default partial alphanumeric_keys +xkb_symbols "basic" { + + name[Group1] = "Malayalam"; + + //From grave to backslash (\) + + key <TLDE> { [ 0x01000d4a , 0x01000d12 ] }; + key <AE01> { [1 , exclam ] }; + key <AE02> { [2 , at ] }; + key <AE03> { [3 , numbersign ] }; + key <AE04> { [4 , dollar ] }; + key <AE05> { [5 , percent ] }; + key <AE06> { [6 ,asciicircum ] }; + key <AE07> { [7 , ampersand ] }; + key <AE08> { [8 , 0x01000d7e ] }; + key <AE09> { [9 , parenleft ] }; + key <AE10> { [0 , parenright ] }; + key <AE11> { [ minus , 0x01000d03 ] }; + key <AE12> { [ 0x01000d43 , 0x01000d0b ] }; + key <BKSL> { [ 0x01000d7c ] }; + + // From 'q' to right bracket (]) + + key <AD01> { [ 0x01000d4c , 0x01000d14 ] }; + key <AD02> { [ 0x01000d48 , 0x01000d10 ] }; + key <AD03> { [ 0x01000d3e , 0x01000d06 ] }; + key <AD04> { [ 0x01000d40 , 0x01000d08 ] }; + key <AD05> { [ 0x01000d42 , 0x01000d0a ] }; + key <AD06> { [ 0x01000d2c , 0x01000d2d ] }; + key <AD07> { [ 0x01000d39 , 0x01000d19 ] }; + key <AD08> { [ 0x01000d17 , 0x01000d18 ] }; + key <AD09> { [ 0x01000d26 , 0x01000d27 ] }; + key <AD10> { [ 0x01000d1c , 0x01000d1d ] }; + key <AD11> { [ 0x01000d21 , 0x01000d22 ] }; + key <AD12> { [ 0x0100200d , 0x01000d1e ] }; + + // From 'a' to apostrophe (') + + key <AC01> { [ 0x01000d4b , 0x01000d13 ] }; + key <AC02> { [ 0x01000d47 , 0x01000d0f ] }; + key <AC03> { [ 0x01000d4d , 0x01000d05 ] }; + key <AC04> { [ 0x01000d3f , 0x01000d07 ] }; + key <AC05> { [ 0x01000d41 , 0x01000d09 ] }; + key <AC06> { [ 0x01000d2a , 0x01000d2b ] }; + key <AC07> { [ 0x01000d30 , 0x01000d31 ] }; + key <AC08> { [ 0x01000d15 , 0x01000d16 ] }; + key <AC09> { [ 0x01000d24 , 0x01000d25 ] }; + key <AC10> { [ 0x01000d1a , 0x01000d1b ] }; + key <AC11> { [ 0x01000d1f , 0x01000d20 ] }; + + // From 'z' to slash (/) + + key <AB01> { [ 0x01000d46 , 0x01000d0e ] }; + key <AB02> { [ 0x01000d02 , 0x01000d7a ] }; + key <AB03> { [ 0x01000d2e , 0x01000d23 ] }; + key <AB04> { [ 0x01000d28 , 0x01000d7b ] }; + key <AB05> { [ 0x01000d35 , 0x01000d34 ] }; + key <AB06> { [ 0x01000d32 , 0x01000d33 ] }; + key <AB07> { [ 0x01000d38 , 0x01000d36 ] }; + key <AB08> { [ comma , 0x01000d37 ] }; + key <AB09> { [ period , 0x01000d7d ] }; + key <AB10> { [ 0x01000d2f , question ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "mlplusnum" { + + // Modifies the basic layout to include malayalam numbers + + include "pc/ml(basic)" + + key <AE01> { [ 0x01000d67 , exclam ] }; + key <AE02> { [ 0x01000d68 , at ] }; + key <AE03> { [ 0x01000d69 , numbersign ] }; + key <AE04> { [ 0x01000d6a , dollar ] }; + key <AE05> { [ 0x01000d6b , percent ] }; + key <AE06> { [ 0x01000d6c , asciicircum ] }; + key <AE07> { [ 0x01000d6d , ampersand ] }; + key <AE08> { [ 0x01000d6e , 0x01000d7e ] }; + key <AE09> { [ 0x01000d6f , parenleft ] }; + key <AE10> { [ 0x01000d66 , parenright ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/mm diff -u /dev/null xc/programs/xkbcomp/symbols/pc/mm:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/mm Thu Nov 21 23:03:28 2002 @@ -0,0 +1,66 @@ + +// based on a keyboard map from an 'xkb/symbols/mm' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/mm,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Burmese"; + +// Mainly numbers. + key <AE01> { [ 0x1001041, exclam ] }; + key <AE02> { [ 0x1001042 ] }; + key <AE03> { [ 0x1001043 ] }; + key <AE04> { [ 0x1001044 ] }; + key <AE05> { [ 0x1001045 ] }; + key <AE06> { [ 0x1001046 ] }; + key <AE07> { [ 0x1001047 ] }; + key <AE08> { [ 0x1001048 ] }; + key <AE09> { [ 0x1001049, parenleft ] }; + key <AE10> { [ 0x1001040, parenright ] }; + key <AE11> { [ minus, 0x1001038 ] }; + key <AE12> { [ 0x1001052, 0x1001056 ] }; + +// Mainly long vowels + key <AD01> { [ 0x100102A, 0x100102A ] }; + key <AD02> { [ 0x1001032, 0x1001032 ] }; + key <AD03> { [ 0x100102C, 0x1001021 ] }; + key <AD04> { [ 0x100102E, 0x1001024 ] }; + key <AD05> { [ 0x1001030, 0x1001026 ] }; + +// Mainly voiced consonants + key <AD06> { [ 0x1001017, 0x1001018 ] }; + key <AD07> { [ 0x100101F, 0x1001004 ] }; + key <AD08> { [ 0x1001002, 0x1001003 ] }; + key <AD09> { [ 0x1001012, 0x1001013 ] }; + key <AD10> { [ 0x1001007, 0x1001008 ] }; + key <AD11> { [ 0x100100d, 0x100100e ] }; + key <AD12> { [ 0x100100a, 0x1001009 ] }; + +// Mainly short vowels + key <AC01> { [ 0x1001029, 0x1001029 ] }; + key <AC02> { [ 0x1001027, 0x1001027 ] }; + key <AC03> { [ 0x1001039, 0x1001021 ] }; + key <AC04> { [ 0x100102D, 0x1001023 ] }; + key <AC05> { [ 0x100102F, 0x1001025 ] }; + +// Mainly unvoiced consonants + key <AC06> { [ 0x1001015, 0x1001016 ] }; + key <AC07> { [ 0x100101B, 0x100101B ] }; + key <AC08> { [ 0x1001000, 0x1001001 ] }; + key <AC09> { [ 0x1001010, 0x1001011 ] }; + key <AC10> { [ 0x1001005, 0x1001006 ] }; + key <AC11> { [ 0x100100b, 0x100100c ] }; + key <BKSL> { [ 0x100104E, 0x100104F ] }; + + key <AB01> { [ 0x100104C, 0x100104D ] }; + key <AB02> { [ 0x1001037, 0x1001036 ] }; + key <AB03> { [ 0x1001019, 0x100100f ] }; + key <AB04> { [ 0x1001014, 0x1001014 ] }; + key <AB05> { [ 0x1001017, 0x1001017 ] }; + key <AB06> { [ 0x100101C, 0x100101C ] }; + key <AB07> { [ 0x100101E, 0x1001050 ] }; + key <AB08> { [ comma, 0x1001051 ] }; + key <AB09> { [ period, 0x100104A ] }; + key <AB10> { [ slash, 0x100101A ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/mt diff -u /dev/null xc/programs/xkbcomp/symbols/pc/mt:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/mt Thu Dec 12 23:18:04 2002 @@ -0,0 +1,36 @@ +// Maltese keyboard map (based on MSA Standard DMS100) +// by Ramon Casha (ramon.casha@linux.org.mt) +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/mt,v 1.3 2002/12/13 04:18:04 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Maltese"; + + // The following four sets are the four additional letters, with the UK + // equivalents + key <TLDE> { [ cabovedot, Cabovedot, grave, notsign ] }; + key <AD11> { [ gabovedot, Gabovedot, bracketleft, braceleft ] }; + key <AD12> { [ hstroke, Hstroke, bracketright, braceright ] }; + key <LSGT> { [ zabovedot, Zabovedot, backslash, bar ] }; + + // Euro symbol + key <AE03> { [ 3, EuroSign, sterling ] }; + + // Long accent + key <AE06> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] }; + + // Normal accented vowels + key <AD03> { [ e, E, egrave, Egrave ] }; + key <AD07> { [ u, U, ugrave, Ugrave ] }; + key <AD08> { [ i, I, igrave, Igrave ] }; + key <AD09> { [ o, O, ograve, Ograve ] }; + key <AC01> { [ a, A, agrave, Agrave ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/mt_us diff -u /dev/null xc/programs/xkbcomp/symbols/pc/mt_us:1.4 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/mt_us Fri Dec 20 15:18:34 2002 @@ -0,0 +1,22 @@ +// Maltese keyboard map (based on MSA Standard DMS100, annex A) +// by Ramon Casha (ramon.casha@linux.org.mt) +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/mt_us,v 1.4 2002/12/20 20:18:34 paulo Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/mt" + + // Describes the differences between the mt + // keyboard and a US-based physical keyboard + + name[Group1]="Maltese (US layout)"; + + key <BKSL> { [ zabovedot, Zabovedot, backslash, bar ] }; + + key <TLDE> { [ cabovedot, Cabovedot, grave, asciitilde ] }; + + key <AE03> { [ 3, EuroSign, numbersign ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/nl diff -u /dev/null xc/programs/xkbcomp/symbols/pc/nl:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/nl Thu Nov 21 23:03:28 2002 @@ -0,0 +1,57 @@ + +// based on +// Converted keytable file to xkb/symbols/ file +// with mk_xkb by root@linux.chanae.stben.be Tue Sep 30 00:53:29 MET DST 1997 + +// converted from the nl-latin.map of the Linux kbd package by +// Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/nl,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Nederland"; + + key <AE02> { [ 2, quotedbl, twosuperior, oneeighth ] }; + key <AE06> { [ 6, ampersand, threequarters, fiveeighths ] }; + key <AE07> { [ 7, underscore, sterling, seveneighths ] }; + key <AE08> { [ 8, parenleft, braceleft, trademark ] }; + key <AE09> { [ 9, parenright, braceright, plusminus ] }; + key <AE10> { [ 0, apostrophe, braceright, degree ] }; + key <AE11> { [ slash, question, backslash, questiondown ] }; + key <AE12> { [ degree, dead_tilde, dead_cedilla, dead_ogonek ] }; + + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, ydiaeresis, yen ] }; + key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; + key <AD08> { [ i, I, idiaeresis, Idiaeresis ] }; + key <AD09> { [ o, O, ograve, Ograve ] }; + key <AD10> { [ p, P, paragraph, THORN ] }; + key <AD11> { [dead_diaeresis, dead_tilde, asciitilde, asciicircum] }; + key <AD12> { [ asterisk, bar, dead_tilde, dead_macron ] }; + + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC04> { [ f, F, ordfeminine, ordfeminine ] }; + key <AC10> { [ plus, plusminus, dead_acute, dead_doubleacute ] }; + key <AC11> { [apostrophe, grave, dead_acute, dead_grave ] }; + key <TLDE> { [ at, section, notsign, notsign ] }; + + key <BKSL> { [ less, greater, dead_grave, dead_breve ] }; + key <AB06> { [ n, N, ntilde, Ntilde ] }; + key <AB07> { [ m, M, Greek_mu, masculine ] }; + key <AB08> { [ comma, semicolon, cedilla, guillemotleft] }; + key <AB09> { [ period, colon, periodcentered, guillemotright ] }; + key <AB10> { [ minus, equal, hyphen, dead_abovedot] }; + + key <LSGT> { type[Group1] = "FOUR_LEVEL", + [bracketleft, bracketright, bar, brokenbar ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + Index: xc/programs/xkbcomp/symbols/pc/no diff -u /dev/null xc/programs/xkbcomp/symbols/pc/no:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/no Wed Dec 18 20:07:56 2002 @@ -0,0 +1,50 @@ + +// based on a keyboard map from an 'xkb/symbols/no' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/no,v 1.3 2002/12/19 01:07:56 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a Norwegian keyboard with dead key support + // and all of ISO-8859-1 characters available. + + include "pc/latin(type2)" + + name[Group1]="Norwegian"; + + key <AE11> { [ plus, question, plusminus, questiondown ] }; + key <AE12> { [ backslash, dead_grave, dead_acute, notsign ] }; + + + key <AC10> { [ oslash, Ooblique, dead_acute, dead_doubleacute ] }; + key <AC11> { [ ae, AE, dead_circumflex, dead_caron] }; + key <TLDE> { [ bar, section, brokenbar, paragraph ] }; + + key <BKSL> { [apostrophe, asterisk, dead_doubleacute, multiply ] }; + + key <LSGT> { type[Group1] = "FOUR_LEVEL", + [ less, greater, onehalf, threequarters] }; + + key <KPDL> { [ KP_Delete, KP_Separator ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic Norwegian layout to eliminate dead keys + + include "pc/no(basic)" + + key <AE12> { [ backslash, grave, acute, ogonek ] }; + key <AD12> { [ diaeresis, asciicircum, asciitilde, macron ] }; + key <AC10> { [ oslash, Ooblique, acute, doubleacute ] }; + key <AC11> { [ ae, AE, asciicircum, caron ] }; + key <AB08> { [ comma, semicolon, cedilla, ogonek ] }; + key <AB09> { [ period, colon, periodcentered, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/ogham diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ogham:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/ogham Mon Dec 30 21:07:04 2002 @@ -0,0 +1,206 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/ogham,v 1.3 2002/12/31 02:07:04 dawes Exp $ +// +// Ogham keyboard map for XFree86 +// +// Seamus O Ciardhuain <seoc@cnds.ucd.ie> (17 December 2002) +// +// Ogham keyboard layout as recommended in I.S. 434:1999. +// Suitable for multi-layout xkbcomp. +// Character names are given as in the Unicode standard, +// range U+1680 to U+169F. + + +default partial alphanumeric_keys +xkb_symbols "basic" { + + name[Group1] = "Ogham"; + + key.type[Group1] = "ONE_LEVEL"; + + key <LSGT> { type[Group1]="TWO_LEVEL", + [ 0x100169B, 0x100169C ] }; + // OGHAM FEATHER MARK, OGHAM REVERSED FEATHER MARK + + key <BKSL> { [ 0x1001680 ] }; // OGHAM SPACE MARK + + key <TLDE> { [ 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + + key <SPCE> { [ space ] }; + + // + // Top Row QWERTYUIOP + // + key <AD01> { [ 0x100168A ] }; // OGHAM LETTER CEIRT + key <AD02> { [ 0x1001695 ] }; // OGHAM LETTER EABHADH + key <AD03> { [ 0x1001693 ] }; // OGHAM LETTER EADHADH + key <AD04> { [ 0x100168F ] }; // OGHAM LETTER RUIS + key <AD05> { [ 0x1001688 ] }; // OGHAM LETTER TINNE + key <AD06> { [ 0x1001698 ] }; // OGHAM LETTER IFIN + key <AD07> { [ 0x1001692 ] }; // OGHAM LETTER UR + key <AD08> { [ 0x1001694 ] }; // OGHAM LETTER IODHADH + key <AD09> { [ 0x1001691 ] }; // OGHAM LETTER ONN + key <AD10> { [ 0x100169A ] }; // OGHAM LETTER PEITH + + // + // Middle Row ASDFGHJKL + // + key <AC01> { [ 0x1001690 ] }; // OGHAM LETTER AILM + key <AC02> { [ 0x1001684 ] }; // OGHAM LETTER SAIL + key <AC03> { [ 0x1001687 ] }; // OGHAM LETTER DAIR + key <AC04> { [ 0x1001683 ] }; // OGHAM LETTER FEARN + key <AC05> { [ 0x100168C ] }; // OGHAM LETTER GORT + key <AC06> { [ 0x1001686 ] }; // OGHAM LETTER UATH + key <AC07> { [ 0x1001697 ] }; // OGHAM LETTER UILLEANN + key <AC08> { [ 0x1001696 ] }; // OGHAM LETTER OR + key <AC09> { [ 0x1001682 ] }; // OGHAM LETTER LUIS + + // + // Bottom Row ZXCVBNM + // + key <AB01> { [ 0x100168E ] }; // OGHAM LETTER STRAIF + key <AB02> { [ 0x1001699 ] }; // OGHAM LETTER EAMHANCHOLL + key <AB03> { [ 0x1001689 ] }; // OGHAM LETTER COLL + key <AB04> { [ 0x100168D ] }; // OGHAM LETTER NGEADAL + key <AB05> { [ 0x1001681 ] }; // OGHAM LETTER BEITH + key <AB06> { [ 0x1001685 ] }; // OGHAM LETTER NION + key <AB07> { [ 0x100168B ] }; // OGHAM LETTER MUIN + + // As an extension because <BKSL> and <LSGT> may not be + // available or sensible. These are also a bit more + // intuitive on a standard Irish keyboard. + key <AB08> { [ 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + key <AB09> { [ 0x100169B ] }; // OGHAM FEATHER MARK + key <AB10> { [ 0x1001680 ] }; // OGHAM SPACE MARK + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "laptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ogham(basic)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "is434" { + + // This has the full layout of IS434 with an Irish QWERTY keyboard, + // and the Ogham characters accessed when CAPS LOCK is on. + + name[Group1] = "Ogham (IS434)"; + + key.type[Group1] = "THREE_LEVEL"; + + key <LSGT> { type[Group1] = "FOUR_LEVEL_ALPHABETIC", + [ backslash, bar, 0x100169B, 0x100169C ] }; + // OGHAM FEATHER MARK, OGHAM REVERSED FEATHER MARK + + key <BKSL> { [ numbersign, asciitilde, 0x1001680 ] }; // OGHAM SPACE MARK + key <TLDE> { [ grave, notsign, 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + key <SPCE> { [ space, space, space ] }; + + // + // Numeric row + // + key <AE01> { type[Group1]="TWO_LEVEL", [ 1, exclam ] }; + key <AE02> { type[Group1]="TWO_LEVEL", [ 2, quotedbl ] }; + key <AE03> { type[Group1]="TWO_LEVEL", [ 3, sterling ] }; + key <AE04> { [ 4, dollar, EuroSign ] }; + key <AE05> { type[Group1]="TWO_LEVEL", [ 5, percent ] }; + key <AE06> { type[Group1]="TWO_LEVEL", [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand, 0x100204A ] }; // Tironian Et + key <AE08> { type[Group1]="TWO_LEVEL", [ 8, asterisk ] }; + key <AE09> { type[Group1]="TWO_LEVEL", [ 9, parenleft ] }; + key <AE10> { type[Group1]="TWO_LEVEL", [ 0, parenright ] }; + key <AE11> { type[Group1]="TWO_LEVEL", [ minus, underscore ] }; + key <AE12> { type[Group1]="TWO_LEVEL", [ equal, plus ] }; + + // + // Top Row QWERTYUIOP + // + key <AD01> { [ q, Q, 0x100168A ] }; // OGHAM LETTER CEIRT + key <AD02> { [ w, W, 0x1001695 ] }; // OGHAM LETTER EABHADH + key <AD03> { [ e, E, 0x1001693 ] }; // OGHAM LETTER EADHADH + key <AD04> { [ r, R, 0x100168F ] }; // OGHAM LETTER RUIS + key <AD05> { [ t, T, 0x1001688 ] }; // OGHAM LETTER TINNE + key <AD06> { [ y, Y, 0x1001698 ] }; // OGHAM LETTER IFIN + key <AD07> { [ u, U, 0x1001692 ] }; // OGHAM LETTER UR + key <AD08> { [ i, I, 0x1001694 ] }; // OGHAM LETTER IODHADH + key <AD09> { [ o, O, 0x1001691 ] }; // OGHAM LETTER ONN + key <AD10> { [ p, P, 0x100169A ] }; // OGHAM LETTER PEITH + + // + // Middle Row ASDFGHJKL + // + key <AC01> { [ a, A, 0x1001690 ] }; // OGHAM LETTER AILM + key <AC02> { [ s, S, 0x1001684 ] }; // OGHAM LETTER SAIL + key <AC03> { [ d, D, 0x1001687 ] }; // OGHAM LETTER DAIR + key <AC04> { [ f, F, 0x1001683 ] }; // OGHAM LETTER FEARN + key <AC05> { [ g, G, 0x100168C ] }; // OGHAM LETTER GORT + key <AC06> { [ h, H, 0x1001686 ] }; // OGHAM LETTER UATH + key <AC07> { [ j, J, 0x1001697 ] }; // OGHAM LETTER UILLEANN + key <AC08> { [ k, K, 0x1001696 ] }; // OGHAM LETTER OR + key <AC09> { [ l, L, 0x1001682 ] }; // OGHAM LETTER LUIS + + // + // Bottom Row ZXCVBNM + // + key <AB01> { [ z, Z, 0x100168E ] }; // OGHAM LETTER STRAIF + key <AB02> { [ x, X, 0x1001699 ] }; // OGHAM LETTER EAMHANCHOLL + key <AB03> { [ c, C, 0x1001689 ] }; // OGHAM LETTER COLL + key <AB04> { [ v, V, 0x100168D ] }; // OGHAM LETTER NGEADAL + key <AB05> { [ b, B, 0x1001681 ] }; // OGHAM LETTER BEITH + key <AB06> { [ n, N, 0x1001685 ] }; // OGHAM LETTER NION + key <AB07> { [ m, M, 0x100168B ] }; // OGHAM LETTER MUIN + + // As an extension because <BKSL> and <LSGT> may not be + // available or sensible. These are also a bit more + // intuitive on a standard Irish keyboard. + key <AB08> { [ comma, less, 0x100169C ] }; // OGHAM REVERSED FEATHER MARK + key <AB09> { [ period, greater, 0x100169B ] }; // OGHAM FEATHER MARK + key <AB10> { [ slash, question, 0x1001680 ] }; // OGHAM SPACE MARK + + // The standard says the Ogham characters should be accessed when + // Caps Lock is down; not clear if this means it should lock but + // seems logical. + + key <CAPS> { type[Group1] = "ONE_LEVEL", [ ISO_Level3_Lock ] }; + + // Also allow access to Ogham characters using RALT for convenience + key <RALT> { type[Group1] = "ONE_LEVEL", [ ISO_Level3_Shift ] }; + + modifier_map Mod5 { ISO_Level3_Shift, ISO_Level3_Lock }; + + // Redefine Scroll Lock as locking shift in case that's needed. + // Also overcomes annoying use of Scroll Lock LED inherited from + // US symbols but not relevant here since we're not changing group. + key <SCLK> {type[Group1] = "ONE_LEVEL", [ Shift_Lock ] }; + modifier_map Shift { Shift_Lock }; + + key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "IS434" { + // just has uppercase in the name + include "ogham(is434)" +}; + +partial alphanumeric_keys +xkb_symbols "is434laptop" { + // For laptops which don't have the RWIN key but are otherwise + // the same as 105-key layouts. + include "ogham(is434)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; + +partial alphanumeric_keys +xkb_symbols "IS434laptop" { + // just has uppercase in the name + include "ogham(is434)" + key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, ISO_Next_Group ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/ori diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ori:1.1 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/ori Sat Dec 14 19:44:56 2002 @@ -0,0 +1,66 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/ori,v 1.1 2002/12/15 00:44:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + // Inscript layout for Oriya + // Author: G Karunakar <karunakar@freedomink.org> + // Date: Wed Nov 13 18:16:19 IST 2002 + + name[Group1]= "Oriya"; + + key <TLDE> { [ 0x01000b4a, 0x01000b12 ] }; + key <AE01> { [ 0x01000b67, 0x01000b0d ] }; + key <AE02> { [ 0x01000b68, 0x01000b45 ] }; + key <AE03> { [ 0x01000b69 ] }; + key <AE04> { [ 0x01000b6a ] }; + key <AE05> { [ 0x01000b6b ] }; + key <AE06> { [ 0x01000b6c ] }; + key <AE07> { [ 0x01000b6d ] }; + key <AE08> { [ 0x01000b6e ] }; + key <AE09> { [ 0x01000b6f ] }; + key <AE10> { [ 0x01000b66 ] }; + key <AE11> { [ 0x01000b03 ] }; + key <AE12> { [ 0x01000b43, 0x01000b0b ] }; + + key <AD01> { [ 0x01000b4c, 0x01000b14 ] }; + key <AD02> { [ 0x01000b48, 0x01000b10 ] }; + key <AD03> { [ 0x01000b3e, 0x01000b06 ] }; + key <AD04> { [ 0x01000b40, 0x01000b08 ] }; + key <AD05> { [ 0x01000b42, 0x01000b0a ] }; + key <AD06> { [ 0x01000b2c, 0x01000b2d ] }; + key <AD07> { [ 0x01000b39, 0x01000b19 ] }; + key <AD08> { [ 0x01000b17, 0x01000b18 ] }; + key <AD09> { [ 0x01000b26, 0x01000b27 ] }; + key <AD10> { [ 0x01000b1c, 0x01000b1d ] }; + key <AD11> { [ 0x01000b21, 0x01000b22 ] }; + key <AD12> { [ 0x01000b3c, 0x01000b1e ] }; + + key <AC01> { [ 0x01000b4b, 0x01000b13 ] }; + key <AC02> { [ 0x01000b47, 0x01000b0f ] }; + key <AC03> { [ 0x01000b4d, 0x01000b05 ] }; + key <AC04> { [ 0x01000b3f, 0x01000b07 ] }; + key <AC05> { [ 0x01000b41, 0x01000b09 ] }; + key <AC06> { [ 0x01000b2a, 0x01000b2b ] }; + key <AC07> { [ 0x01000b30, 0x01000b31 ] }; + key <AC08> { [ 0x01000b15, 0x01000b16 ] }; + key <AC09> { [ 0x01000b24, 0x01000b25 ] }; + key <AC10> { [ 0x01000b1a, 0x01000b1b ] }; + key <AC11> { [ 0x01000b1f, 0x01000b20 ] }; + + key <AB01> { [ 0x01000b46, 0x01000b0e ] }; + key <AB02> { [ 0x01000b02, 0x01000b01 ] }; + key <AB03> { [ 0x01000b2e, 0x01000b23 ] }; + key <AB04> { [ 0x01000b28, 0x01000b29 ] }; + key <AB05> { [ 0x01000b35, 0x01000b34 ] }; + key <AB06> { [ 0x01000b32, 0x01000b33 ] }; + key <AB07> { [ 0x01000b38, 0x01000b36 ] }; + key <AB08> { [ comma , 0x01000b37 ] }; + key <AB09> { [ period , 0x01000b64 ] }; + key <AB10> { [ 0x01000b2f, 0x01000040 ] }; + key <BKSL> { [ 0x01000b49, 0x01000b11 ] }; + + key <RALT> { + symbols[Group1] = [ Mode_switch, Multi_key ], + virtualMods = AltGr + }; +}; Index: xc/programs/xkbcomp/symbols/pc/pc diff -u /dev/null xc/programs/xkbcomp/symbols/pc/pc:1.6 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/pc Mon Feb 10 21:51:11 2003 @@ -0,0 +1,220 @@ + +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/pc,v 1.6 2003/02/11 02:51:11 dawes Exp $ + +partial hidden alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + key <ESC> { [ Escape ] }; + + // Alphanumeric section + key <TLDE> { [ grave, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <BKSP> { + type="CTRL+ALT", + symbols[Group1]= [ BackSpace, Terminate_Server ] + }; + + key <TAB> { [ Tab, ISO_Left_Tab ] }; + key <RTRN> { [ Return ] }; + + key <CAPS> { [ Caps_Lock ] }; + + key <LFSH> { [ Shift_L ] }; + key <BKSL> { [ backslash, bar ] }; + + key <LCTL> { [ Control_L ] }; + key <SPCE> { [ space ] }; + + key <RTSH> { [ Shift_R ] }; + key <LALT> { [ Alt_L ] }; + key <RCTL> { [ Control_R ] }; + key <RALT> { [ Alt_R ] }; + + // End alphanumeric section + + // Begin "Function" section + key <FK01> { + type="CTRL+ALT", + symbols[Group1]= [ F1, XF86_Switch_VT_1 ] + }; + key <FK02> { + type="CTRL+ALT", + symbols[Group1]= [ F2, XF86_Switch_VT_2 ] + }; + key <FK03> { + type="CTRL+ALT", + symbols[Group1]= [ F3, XF86_Switch_VT_3 ] + }; + key <FK04> { + type="CTRL+ALT", + symbols[Group1]= [ F4, XF86_Switch_VT_4 ] + }; + key <FK05> { + type="CTRL+ALT", + symbols[Group1]= [ F5, XF86_Switch_VT_5 ] + }; + key <FK06> { + type="CTRL+ALT", + symbols[Group1]= [ F6, XF86_Switch_VT_6 ] + }; + key <FK07> { + type="CTRL+ALT", + symbols[Group1]= [ F7, XF86_Switch_VT_7 ] + }; + key <FK08> { + type="CTRL+ALT", + symbols[Group1]= [ F8, XF86_Switch_VT_8 ] + }; + key <FK09> { + type="CTRL+ALT", + symbols[Group1]= [ F9, XF86_Switch_VT_9 ] + }; + key <FK10> { + type="CTRL+ALT", + symbols[Group1]= [ F10, XF86_Switch_VT_10 ] + }; + key <FK11> { + type="CTRL+ALT", + symbols[Group1]= [ F11, XF86_Switch_VT_11 ] + }; + key <FK12> { + type="CTRL+ALT", + symbols[Group1]= [ F12, XF86_Switch_VT_12 ] + }; + // End "Function" section + + // Begin "Editing" section + key <PRSC> { + type= "PC_SYSRQ", + symbols[Group1]= [ Print, Sys_Req ] + }; + key <SYRQ> { + type= "PC_SYSRQ", + symbols[Group1]= [ Print, Sys_Req ] + }; + key <SCLK> { [ Scroll_Lock ] }; + key <PAUS> { + type= "PC_BREAK", + symbols[Group1]= [ Pause, Break ] + }; + key <BRK> { + type= "PC_BREAK", + symbols[Group1]= [ Pause, Break ] + }; + key <INS> { [ Insert ] }; + key <HOME> { [ Home ] }; + key <PGUP> { [ Prior ] }; + key <DELE> { [ Delete ] }; + key <END> { [ End ] }; + key <PGDN> { [ Next ] }; + + key <UP> { [ Up ] }; + key <LEFT> { [ Left ] }; + key <DOWN> { [ Down ] }; + key <RGHT> { [ Right ] }; + + // End "Editing" section, begin "Keypad" + key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] }; + +// Ungrab cancels server/keyboard/pointer grabs + key <KPDV> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Divide, XF86_Ungrab ] + }; + +// ClsGrb kills whichever client has a grab in effect + key <KPMU> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Multiply, XF86_ClearGrab ] + }; + +// -VMode switches to the previous video mode + key <KPSU> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Subtract, XF86_Prev_VMode ] + }; + + key <KP7> { [ KP_Home, KP_7 ] }; + key <KP8> { [ KP_Up, KP_8 ] }; + key <KP9> { [ KP_Prior, KP_9 ] }; + +// +VMode switches to the next video mode + key <KPAD> { + type="CTRL+ALT", + symbols[Group1]= [ KP_Add, XF86_Next_VMode ] + }; + + key <KP4> { [ KP_Left, KP_4 ] }; + key <KP5> { [ KP_Begin, KP_5 ] }; + key <KP6> { [ KP_Right, KP_6 ] }; + + key <KP1> { [ KP_End, KP_1 ] }; + key <KP2> { [ KP_Down, KP_2 ] }; + key <KP3> { [ KP_Next, KP_3 ] }; + key <KPEN> { [ KP_Enter ] }; + + key <KP0> { [ KP_Insert, KP_0 ] }; + key <KPDL> { [ KP_Delete, KP_Decimal ] }; + // End "Keypad" section + + + // begin modifier mappings + modifier_map Shift { Shift_L, Shift_R }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L, Control_R }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod2 { Num_Lock }; +}; + +// definition for the PC-AT type 101 key keyboard +xkb_symbols "pc101" { + include "pc/pc(basic)" + key <LALT> { [ Alt_L, Meta_L ] }; + key <RALT> { [ Alt_R, Meta_R ] }; + + // begin modifier mappings + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; +}; + +// definition for the extra key on 102-key keyboards +xkb_symbols "pc102" { + include "pc/pc(pc101)" + key <LSGT> { type[Group1] = "FOUR_LEVEL", + [ less, greater, bar, brokenbar ] }; +}; + +// definition for the extra keys on 104-key "Windows95" keyboards +default +xkb_symbols "pc104" { + include "pc/pc(basic)" + key <LALT> { [ Alt_L, Meta_L ] }; + key <RALT> { [ Alt_R, Meta_R ] }; + key <LWIN> { [ Super_L ] }; + key <RWIN> { [ Super_R ] }; + key <MENU> { [ Menu ] }; + + // modifier mappings + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; + modifier_map Mod4 { Super_L, Super_R }; +}; + +// defintion which includes both the Windows95 keyboards _and_ +// the extra key on most European keyboards. +xkb_symbols "pc105" { + include "pc/pc(pc104)" + key <LSGT> { type[Group1] = "FOUR_LEVEL", + [ less, greater, bar, brokenbar ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/pl diff -u /dev/null xc/programs/xkbcomp/symbols/pc/pl:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/pl Thu Nov 21 23:03:28 2002 @@ -0,0 +1,27 @@ + +// based on a keyboard map from an 'xkb/symbols/pl' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/pl,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Polish"; + + key <AD03> { [ e, E, eogonek, Eogonek ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + + key <AC01> { [ a, A, aogonek, Aogonek ] }; + key <AC02> { [ s, S, sacute, Sacute ] }; + + key <AB01> { [ z, Z, zabovedot, Zabovedot ] }; + key <AB02> { [ x, X, zacute, Zacute ] }; + key <AB03> { [ c, C, cacute, Cacute ] }; + key <AB06> { [ n, N, nacute, Nacute ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/pl2 diff -u /dev/null xc/programs/xkbcomp/symbols/pc/pl2:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/pl2 Fri Dec 20 15:18:34 2002 @@ -0,0 +1,48 @@ + +// based on a keyboard map from an 'xkb/symbols/pl2' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/pl2,v 1.3 2002/12/20 20:18:34 paulo Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple QWERTZ Polish keybaord + + include "pc/latin(type3)" + + name[Group1]="Polish"; + + key <AE01> { [ 1, exclam, asciitilde, exclamdown ] }; + key <AE02> { [ 2, quotedbl, dead_caron, oneeighth ] }; + key <AE03> { [ 3, numbersign, dead_circumflex, sterling ] }; + key <AE04> { [ 4, dollar, dead_breve, dollar ] }; + key <AE05> { [ 5, percent, degree, threeeighths ] }; + key <AE06> { [ 6, ampersand, dead_ogonek, fiveeighths ] }; + key <AE07> { [ 7, slash, dead_grave, seveneighths ] }; + key <AE08> { [ 8, parenleft, dead_abovedot, trademark ] }; + key <AE09> { [ 9, parenright, dead_acute, plusminus ] }; + key <AE10> { [ 0, equal, dead_doubleacute, degree ] }; + key <AE11> { [ plus, question, dead_diaeresis, questiondown ] }; + key <AE12> { [apostrophe, asterisk, dead_cedilla, dead_ogonek ] }; + + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD11> { [ zabovedot, nacute, division, dead_abovering ] }; + key <AD12> { [ sacute, cacute, multiply, dead_macron ] }; + + key <AC02> { [ s, S, dstroke, section ] }; + key <AC03> { [ d, D, Dstroke, ETH ] }; + key <AC08> { [ k, K, kra, ampersand ] }; + key <AC09> { [ l, L, lstroke, Lstroke ] }; + key <AC10> { [ lstroke, Lstroke, dollar, dead_doubleacute ] }; + key <AC11> { [ aogonek, eogonek, ssharp, dead_caron ] }; + key <TLDE> { [ abovedot, dead_ogonek, notsign, notsign ] }; + + key <BKSL> { [ oacute, zacute, dead_grave, dead_breve ] }; + key <AB03> { [ c, C, cent, copyright ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + Index: xc/programs/xkbcomp/symbols/pc/pt diff -u /dev/null xc/programs/xkbcomp/symbols/pc/pt:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/pt Thu Nov 21 23:03:28 2002 @@ -0,0 +1,60 @@ + +// based on a keyboard map from an 'xkb/symbols/pt' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/pt,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type4)" + + name[Group1]="Portuguese"; + + key <AE03> { [ 3, numbersign, sterling, sterling ] }; + key <AE04> { [ 4, dollar, section, dollar ] }; + key <AE11> { [apostrophe, question, backslash, questiondown ] }; + key <AE12> { [guillemotleft, guillemotright, dead_cedilla, dead_ogonek ] }; + + key <AD11> { [ plus, asterisk, dead_diaeresis, dead_abovering ] }; + key <AD12> { [dead_acute, dead_grave, dead_tilde, dead_macron ] }; + + key <AC10> { [ ccedilla, Ccedilla, dead_acute, dead_doubleacute ] }; + key <AC11> { [ masculine, ordfeminine, dead_circumflex, dead_caron ] }; + key <TLDE> { [ backslash, bar, notsign, notsign ] }; + + key <BKSL> { [dead_tilde, dead_circumflex, dead_grave, dead_breve] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + include "pc/pt(basic)" // for consistent naming + + key <AD11> { [plus, asterisk, SunFA_Diaeresis, SunFA_Diaeresis ] }; + key <BKSL> { [SunFA_Tilde, SunFA_Circum ] }; + key <AD12> { [SunFA_Acute, SunFA_Grave ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "pc/pt(Sundeadkeys)" // for consistent naming + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + include "pc/pt(basic)" // for consistent naming + + key <AE12> { [guillemotleft, guillemotright, cedilla, ogonek ] }; + key <AD11> { [ plus, asterisk, quotedbl, quotedbl ] }; + key <AD12> { [ acute, grave ] }; + key <AC10> { [ ccedilla, Ccedilla, acute, doubleacute ] }; + key <AC11> { [ masculine, ordfeminine, asciicircum, caron ] }; + key <BKSL> { [asciitilde, asciicircum ] }; + key <AB10> { [ minus, underscore, dead_belowdot, abovedot ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/ro diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ro:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/ro Thu Nov 21 23:03:28 2002 @@ -0,0 +1,26 @@ + +// based on a keyboard +// Created by Cristian Gafton, <gafton@redhat.com> (C) 2000 +// Modified by Miºu Moldovan, <dumol@go.ro> (C) 2001 +// Modified by Marius Andreiana, <mandreiana@yahoo.com> (C) 2001 +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ro,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Romanian"; + + key <AD01> { [ q, Q, acircumflex, Acircumflex ] }; + key <AD05> { [ t, T, tcedilla, Tcedilla ] }; + key <AD08> { [ i, I, icircumflex, Icircumflex ] }; + + key <AC01> { [ a, A, abreve, Abreve ] }; + key <AC02> { [ s, S, scedilla, Scedilla ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/ru diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ru:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/ru Sat Feb 15 17:27:05 2003 @@ -0,0 +1,165 @@ + +// based on +// russian standard keyboard +// AEN <aen@logic.ru> +// Last Changes 2001/12/23 by Leon Kanter <leon@blackcatlinux.com> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ru,v 1.3 2003/02/15 22:27:05 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Russian"; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, asterisk ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + key <BKSL> { [ backslash, bar ] }; + key <AB10> { [ slash, question ] }; + key <LSGT> { [ slash, bar ] }; + +key.type[group1]="ALPHABETIC"; + + key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E ] }; + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; + +key.type[group2]="TWO_LEVEL"; + + // End alphanumeric section +}; + +partial alphanumeric_keys +xkb_symbols "winkeys" { + include "pc/ru(basic)" + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + key <AB10> { [ period, comma ] }; + key <BKSL> { [ backslash, slash ] }; +}; + +partial alphanumeric_keys +xkb_symbols "typewriter" { + include "pc/ru(basic)" + key <TLDE> { [ apostrophe, quotedbl ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ numerosign, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; + key <BKSL> { [ parenleft, parenright ] }; + +key.type[group2]="ALPHABETIC"; + + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic" { + + name[Group1]= "Russian(phonetic)"; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, Cyrillic_io ] }; + key <AE04> { [ 4, Cyrillic_IO ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + key <AB08> { [ comma, less ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + key <LSGT> { [ bar, brokenbar ] }; + +key.type[group2]="ALPHABETIC"; + + key <TLDE> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatX> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + + key <AE11> { [ minus, Cyrillic_hardsign ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AE12> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <BKSL> { [ Cyrillic_e, Cyrillic_E ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/sapmi diff -u /dev/null xc/programs/xkbcomp/symbols/pc/sapmi:1.2 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/sapmi Thu Nov 21 23:03:28 2002 @@ -0,0 +1,96 @@ + +// based on +// Northern Sami keyboards for Finland, Norway and Sweden +// +// Describes the differences between a very simple en_US +// keyboard and a Norwegian Northern Sami keyboard (with +// dead key support) according to the spec on +// http://www.hum.uit.no/a/trond/se-lat9-no-keys.html +// Written by Børre Gaup <boerre.gaup@pc.nu> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/sapmi,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + include "pc/latin" + + name[Group1]= "Sámegiella"; + + key <AE01> { [ 1, exclam, copyright, exclamdown ] }; + key <AE02> { [ 2, quotedbl, at, registered ] }; + key <AE03> { [ 3, numbersign, sterling, less ] }; + key <AE04> { [ 4, dollar, dollar, greater ] }; + key <AE05> { [ 5, percent, U2022, U2030 ] }; + key <AE06> { [ 6, ampersand, section, paragraph ] }; + key <AE07> { [ 7, slash, braceleft, bar ] }; + key <AE08> { [ 8, parenleft, bracketleft, braceleft ] }; + key <AE09> { [ 9, parenright, bracketright, braceright ] }; + key <AE10> { [ 0, equal, braceright, notequal ] }; + key <AE11> { [ plus, question, division, questiondown ] }; + key <AE12> { [ backslash, grave, acute, asciitilde ] }; + + key <AD01> { [ aacute, Aacute, q, Q ] }; + key <AD02> { [ scaron, Scaron, w, W ] }; + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD04> { [ r, R, registered, trademark ] }; + key <AD06> { [ y, Y, yacute, Yacute ] }; + key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; + key <AD08> { [ i, I, idiaeresis, Idiaeresis ] }; + key <AD09> { [ o, O, oe, OE ] }; + key <AD11> { [ aring, Aring, acircumflex, Acircumflex ] }; + key <AD12> { [ eng, ENG, quotedbl, asciicircum ] }; + + key <AC01> { [ a, A, agrave, Agrave ] }; + key <AC02> { [ s, S, ssharp, apostrophe ] }; + key <AC04> { [ f, F, ordfeminine, ordfeminine ] }; + key <AC05> { [ g, G, gcaron, Gcaron ] }; + key <AC06> { [ h, H, U01E5, U01E4 ] }; + key <AC07> { [ j, J, notsign, multiply ] }; + key <AC08> { [ k, K, U01E9, U01E8 ] }; + key <AC09> { [ l, L, degree, hyphen ] }; + key <AC10> { [ oslash, Ooblique, odiaeresis, Odiaeresis ] }; + key <AC11> { [ ae, AE, adiaeresis, Adiaeresis ] }; + key <TLDE> { [ bar, section, brokenbar, paragraph ] }; + + key <BKSL> { [ dstroke, Dstroke, apostrophe, asterisk ] }; + key <AB01> { [ z, Z, U0292, U01B7 ] }; + key <AB02> { [ ccaron, Ccaron, x, X ] }; + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + key <AB04> { [ v, V, lessthanequal, guillemotleft ] }; + key <AB05> { [ b, B, greaterthanequal, guillemotright ] }; + key <AB06> { [ n, N, leftsinglequotemark, leftdoublequotemark ] }; + key <AB07> { [ m, M, rightsinglequotemark, rightdoublequotemark ] }; + key <AB08> { [ comma, semicolon, singlelowquotemark, doublelowquotemark ] }; + key <AB09> { [ period, colon, ellipsis, periodcentered ] }; + key <AB10> { [ minus, underscore, endash, emdash ] }; + + key <LSGT> { type[Group1] = "FOUR_LEVEL", + [ zcaron, Zcaron, U01EF, U01EE ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + + xkb_symbols "sefi" { + + // Describes the differences between a Norwegian Northern Sami + // (keyboard with dead key support) and a Swedish/Finnish Sami + // keyboard according to the specs at: + // http://www.hum.uit.no/a/trond/se-lat9-sefi-keys.html + + include "pc/sapmi(basic)" + + key <AC10> { [odiaeresis, Odiaeresis, oslash, Ooblique ] }; + key <AC11> { [adiaeresis, Adiaeresis, ae, AE ] }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic Norwegian layout to eliminate dead keys + + include "pc/sapmi(basic)" + + key <AE12> { [ backslash, grave, acute, ogonek ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/se diff -u /dev/null xc/programs/xkbcomp/symbols/pc/se:1.5 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/se Sat Jan 25 21:01:48 2003 @@ -0,0 +1,50 @@ + +// based on a keyboard map from an 'xkb/symbols/se' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/se,v 1.5 2003/01/26 02:01:48 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + include "pc/latin(type2)" + include "pc/se(se)" +}; + +partial alphanumeric_keys +xkb_symbols "se" { + + name[Group1]="Swedish"; + + key <AE05> { [ 5, percent, EuroSign, cent ] }; + key <AE11> { [ plus, question, backslash, questiondown ] }; + key <AE12> { [dead_acute, dead_grave, plusminus, notsign ] }; + + + key <AC10> { [odiaeresis, Odiaeresis, oslash, Ooblique ] }; + key <AC11> { [adiaeresis, Adiaeresis, ae, AE ] }; + key <TLDE> { [ section, onehalf, paragraph, threequarters] }; + + key <BKSL> { [apostrophe, asterisk, acute, multiply ] }; + + key <SPCE> { type[Group1]="FOUR_LEVEL", + [ space, space, space, nobreakspace ] }; + + key <KPDL> { [ KP_Delete, KP_Separator ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic Swedish layout to eliminate all dead keys + + include "pc/latin(type2)" + include "pc/latin(type2_nodeadkeys)" + include "pc/se(se)" + + key <AE12> { [ acute, grave, plusminus, notsign ] }; + +}; + Index: xc/programs/xkbcomp/symbols/pc/si diff -u /dev/null xc/programs/xkbcomp/symbols/pc/si:1.3 --- /dev/null Thu Feb 27 12:35:37 2003 +++ xc/programs/xkbcomp/symbols/pc/si Tue Feb 4 20:38:36 2003 @@ -0,0 +1,48 @@ + +// based on +// Slovenian keyboards +// by Marko Samastur (markos@elite.org) and +// Primoz Peterlin (primoz.peterlin@biofiz.mf.uni-lj.si) +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/si,v 1.3 2003/02/05 01:38:36 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type3)" + + name[Group1]="Slovene"; + + key <AE01> { [ 1, exclam, asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl, dead_caron, caron ] }; + key <AE03> { [ 3, numbersign, asciicircum, dead_circumflex ] }; + key <AE04> { [ 4, dollar, dead_breve, breve ] }; + key <AE05> { [ 5, percent, degree, dead_abovering ] }; + key <AE06> { [ 6, ampersand, dead_ogonek, ogonek ] }; + key <AE07> { [ 7, slash, grave, dead_grave ] }; + key <AE08> { [ 8, parenleft, dead_abovedot, abovedot ] }; + key <AE09> { [ 9, parenright, dead_acute, apostrophe ] }; + key <AE10> { [ 0, equal, dead_doubleacute, doubleacute ] }; + key <AE11> { [apostrophe, question, dead_diaeresis, diaeresis ] }; + key <AE12> { [ plus, asterisk, dead_cedilla, cedilla ] }; + + key <AD03> { [ e, E, EuroSign, EuroSign ] }; + key <AD11> { [ scaron, Scaron, division, dead_abovering ] }; + key <AD12> { [ dstroke, Dstroke, multiply, dead_macron ] }; + + key <AC10> { [ ccaron, Ccaron, dead_acute, dead_doubleacute ] }; + key <AC11> { [ cacute, Cacute, ssharp, dead_caron ] }; + + key <AB10> { [ minus, underscore, dead_belowdot, dead_abovedot ] }; + + key <TLDE> { [dead_cedilla, dead_diaeresis, notsign, notsign ] }; + + key <BKSL> { [ zcaron, Zcaron, currency, dead_breve ] }; + + key <KPDL> { [ KP_Delete, KP_Separator ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + Index: xc/programs/xkbcomp/symbols/pc/sk diff -u /dev/null xc/programs/xkbcomp/symbols/pc/sk:1.4 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/sk Fri Dec 20 15:18:34 2002 @@ -0,0 +1,98 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/sk,v 1.2 2002/11/22 04:02:22 dawes +// Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // This layout conforms to a new sk compromise standard designed + // to satisfy most unix, windows and mac users. + // 2001 by Kamil Toman <ktoman@email.cz> + + include "pc/latin" + + name[Group1] = "Slovak"; + + key <TLDE> { type[Group1]="FOUR_LEVEL", + [ semicolon, dead_abovering, grave, asciitilde ] }; + key <AE01> { type[Group1]="FOUR_LEVEL", + [ plus, 1, exclam, dead_tilde ] }; + key <AE02> { type[Group1]="FOUR_LEVEL", + [ lcaron, 2, at, dead_caron ] }; + key <AE03> { type[Group1]="FOUR_LEVEL", + [ scaron, 3, numbersign, dead_circumflex ] }; + key <AE04> { type[Group1]="FOUR_LEVEL", + [ ccaron, 4, dollar, dead_breve ] }; + key <AE05> { type[Group1]="FOUR_LEVEL", + [ tcaron, 5, percent, dead_abovering ] }; + key <AE06> { type[Group1]="FOUR_LEVEL", + [ zcaron, 6, asciicircum, dead_ogonek ] }; + key <AE07> { type[Group1]="FOUR_LEVEL", + [ yacute, 7, ampersand, dead_grave ] }; + key <AE08> { type[Group1]="FOUR_LEVEL", + [ aacute, 8, asterisk, dead_abovedot ] }; + key <AE09> { type[Group1]="FOUR_LEVEL", + [ iacute, 9, braceleft, dead_acute ] }; + key <AE10> { type[Group1]="FOUR_LEVEL", + [ eacute, 0, braceright, dead_doubleacute ] }; + key <AE11> { type[Group1]="FOUR_LEVEL", + [ equal, percent, NoSymbol, dead_diaeresis ] }; + key <AE12> { type[Group1]="FOUR_LEVEL", + [dead_acute, dead_caron, dead_macron, dead_cedilla ] }; + + key <AD01> { [ q, Q, backslash, NoSymbol ] }; + key <AD02> { [ w, W, bar, Nosymbol ] }; + key <AD03> { [ e, E, EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, NoSymbol, NoSymbol ] }; + key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; + key <AD06> { [ z, Z, NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, NoSymbol, NoSymbol ] }; + key <AD08> { [ i, I, NoSymbol, NoSymbol ] }; + key <AD09> { [ o, O, NoSymbol, NoSymbol ] }; + key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; + + key <AD11> { [ uacute, slash, bracketleft, division ] }; + key <AD12> { [adiaeresis, parenleft, bracketright, multiply ] }; + + key <AC01> { [ a, A, asciitilde, NoSymbol ] }; + key <AC02> { [ s, S, dstroke, NoSymbol ] }; + key <AC03> { [ d, D, Dstroke, NoSymbol ] }; + key <AC04> { [ f, F, bracketleft, NoSymbol ] }; + key <AC05> { [ g, G, bracketright, NoSymbol ] }; + key <AC06> { [ h, H, grave, NoSymbol ] }; + key <AC07> { [ j, J, apostrophe, NoSymbol ] }; + key <AC08> { [ k, K, lstroke, NoSymbol ] }; + key <AC09> { [ l, L, Lstroke, NoSymbol ] }; + + key <AC10> { [ocircumflex, quotedbl, dollar, NoSymbol ] }; + key <AC11> { [ section, exclam, apostrophe, ssharp ] }; + key <AC12> { [ EuroSign, dead_diaeresis, NoSymbol, NoSymbol ] }; + key <BKSL> { [ ncaron, parenright, backslash, bar ] }; + + key <LSGT> { [ backslash, bar, slash, NoSymbol ] }; + key <AB01> { [ y, Y, degree, NoSymbol ] }; + key <AB02> { [ x, X, numbersign, Nosymbol ] }; + key <AB03> { [ c, C, ampersand, NoSymbol ] }; + key <AB04> { [ v, V, at, NoSymbol ] }; + key <AB05> { [ b, B, braceleft, NoSymbol ] }; + key <AB06> { [ n, N, braceright, NoSymbol ] }; + key <AB07> { [ m, M, asciicircum, NoSymbol ] }; + key <AB08> { [ comma, question, less, NoSymbol ] }; + key <AB09> { [ period, colon, greater, NoSymbol ] }; + key <AB10> { [ minus, underscore, asterisk, NoSymbol ] }; + + key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; + + key <KPDL> { type[Group1]="FOUR_LEVEL_KEYPAD", + [ KP_Delete, comma, KP_Delete, KP_Decimal ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + +// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) +xkb_symbols "bksl" { + include "pc/sk(basic)" + + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/sk_qwerty diff -u /dev/null xc/programs/xkbcomp/symbols/pc/sk_qwerty:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/sk_qwerty Thu Nov 21 23:02:22 2002 @@ -0,0 +1,21 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/sk_qwerty,v 1.2 2002/11/22 04:02:22 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // This layout should work exactly as a sk with the exception + // of 'Z' and 'Y' keys, which are in the qwerty style (ie. swapped). + // 2001 by Kamil Toman <ktoman@email.cz> + + include "pc/sk(basic)" + + key <AB01> { [ z, Z, degree, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; +}; + +// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) +xkb_symbols "bksl" { + include "pc/sk_qwerty(basic)" + + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/sr diff -u /dev/null xc/programs/xkbcomp/symbols/pc/sr:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/sr Thu Nov 21 23:03:28 2002 @@ -0,0 +1,70 @@ + +// based on +// Serbian standard keyboard, version 1.1 +// Authors of this keyboard map are Milos Rancic <millosh@galeb.etf.bg.ac.yu> +// and Anton Zinoviev <anton@lml.bas.bg>. +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/sr,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + // Note that the letter Serbian_dje is on the key with latin letter + // `Z' and in Cyrillic mode on the key with right bracket and brace + // you will find left and right bracket. + + name[Group1]= "Cyrillic"; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, ampersand ] }; + key <AE07> { [ 7, slash ] }; + key <AE08> { [ 8, parenleft ] }; + key <AE09> { [ 9, parenright ] }; + key <AE10> { [ 0, equal ] }; + key <AE11> { [ apostrophe, question ] }; + key <AE12> { [ plus, asterisk ] }; + + key <AD01> { [ Cyrillic_lje, Cyrillic_LJE ] }; + key <AD02> { [ Cyrillic_nje, Cyrillic_NJE ] }; + key <AD03> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD04> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AD05> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AD06> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD07> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD08> { [ Cyrillic_i, Cyrillic_I ] }; + key <AD09> { [ Cyrillic_o, Cyrillic_O ] }; + key <AD10> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ bracketleft, bracketright ] }; + + key <AC01> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC02> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AC03> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC04> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC05> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AC06> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AC07> { [ Cyrillic_je, Cyrillic_JE ] }; + key <AC08> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AC09> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AC11> { [ Serbian_tshe, Serbian_TSHE ] }; + key <BKSL> { [ minus, underscore ] }; + + key <AB01> { [ Serbian_dje, Serbian_DJE ] }; + key <AB02> { [ Cyrillic_dzhe, Cyrillic_DZHE ] }; + key <AB03> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AB04> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AB05> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AB07> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB08> { [ comma, semicolon ] }; + key <AB09> { [ period, colon ] }; + key <AB10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + + // End alphanumeric section +}; + Index: xc/programs/xkbcomp/symbols/pc/syr diff -u /dev/null xc/programs/xkbcomp/symbols/pc/syr:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/syr Wed Feb 26 14:02:25 2003 @@ -0,0 +1,72 @@ +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/syr,v 1.2 2003/02/26 19:02:25 dawes Exp $ +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Syriac"; + + key <TLDE> { [ 0x100070F, 0x100032E, Arabic_shadda ] }; + key <AE01> { [ 1, exclam, 0x1000701 ] }; + key <AE02> { [ 2, 0x100030A, 0x1000702 ] }; + key <AE03> { [ 3, 0x1000325, 0x1000703 ] }; + key <AE04> { [ 4, 0x1000749, 0x1000704 ] }; + key <AE05> { [ 5, 0x1002670, 0x1000705 ] }; + key <AE06> { [ 6, 0x1002671, 0x1000708 ] }; + key <AE07> { [ 7, 0x100070A, 0x1000709 ] }; + key <AE08> { [ 8, 0x10000BB, 0x100070B ] }; + key <AE09> { [ 9, parenright, 0x100070C ] }; + key <AE10> { [ 0, parenleft, 0x100070D ] }; + key <AE11> { [ minus, 0x10000AB, 0x100250C ] }; + key <AE12> { [ equal, plus, 0x1002510 ] }; + + key <AD01> { [ 0x1000714, 0x1000730, Arabic_fatha ] }; + key <AD02> { [ 0x1000728, 0x1000733, Arabic_fathatan ] }; + key <AD03> { [ 0x1000716, 0x1000736, Arabic_damma ] }; + key <AD04> { [ 0x1000729, 0x100073A, Arabic_dammatan ] }; + key <AD05> { [ 0x1000726, 0x100073D, Arabic_madda_above ] }; + key <AD06> { [ 0x100071C, 0x1000740, Arabic_hamza_above ] }; + key <AD07> { [ 0x1000725, 0x1000741, 0x1000747 ] }; + key <AD08> { [ 0x1000717, 0x1000308, 0x1000743 ] }; + key <AD09> { [ 0x100071E, 0x1000304, 0x1000745 ] }; + key <AD10> { [ 0x100071A, 0x1000307, 0x100032D ] }; + key <AD11> { [ 0x1000713, 0x1000303 ] }; + key <AD12> { [ 0x1000715, 0x100074A ] }; + key <BKSL> { [ 0x1000706, colon ] }; + + key <AC01> { [ 0x100072B, 0x1000731, Arabic_kasra ] }; + key <AC02> { [ 0x1000723, 0x1000734, Arabic_kasratan ] }; + key <AC03> { [ 0x100071D, 0x1000737 ] }; + key <AC04> { [ 0x1000712, 0x100073B, Arabic_hamza ] }; + key <AC05> { [ 0x1000720, 0x100073E, Arabic_hamza_below ] }; + key <AC06> { [ 0x1000710, 0x1000711, Arabic_superscript_alef ] }; + key <AC07> { [ 0x100072C, Arabic_tatweel, 0x1000748 ] }; + key <AC08> { [ 0x1000722, 0x1000324, 0x1000744 ] }; + key <AC09> { [ 0x1000721, 0x1000331, 0x1000746 ] }; + key <AC10> { [ 0x100071F, 0x1000323 ] }; + key <AC11> { [ 0x100071B, 0x1000330 ] }; + + key <SPCE> { [ space, 0x100200c ] }; + key <AB01> { [ bracketright, 0x1000732, Arabic_sukun ] }; + key <AB02> { [ bracketleft, 0x1000735 ] }; + key <AB03> { [ 0x1000724, 0x1000738, 0x100200D ] }; + key <AB04> { [ 0x100072A, 0x100073C, 0x100200C ] }; + key <AB05> { [ 0x1000727, 0x100073F, 0x100200E ] }; + key <AB06> { [ 0x1000700, 0x1000739, 0x100200F ] }; + key <AB07> { [ 0x100002E, 0x1000742 ] }; + key <AB08> { [ 0x1000718, Arabic_comma ] }; + key <AB09> { [ 0x1000719, Arabic_semicolon ] }; + key <AB10> { [ 0x1000707, Arabic_question_mark ] }; + + // End Alphanumeric Section + + + // Begin Modifier Mappings + + modifier_map Shift { Shift_L, Shift_R }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L, Control_R }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod2 { Mode_switch }; + +}; Index: xc/programs/xkbcomp/symbols/pc/syr_phonetic diff -u /dev/null xc/programs/xkbcomp/symbols/pc/syr_phonetic:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/syr_phonetic Wed Feb 26 14:02:25 2003 @@ -0,0 +1,72 @@ +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/syr_phonetic,v 1.2 2003/02/26 19:02:25 dawes Exp $ +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Syriac(phonetic)"; + + key <TLDE> { [ 0x100070F, 0x100032E, Arabic_shadda ] }; + key <AE01> { [ 1, exclam, 0x1000701 ] }; + key <AE02> { [ 2, 0x100030A, 0x1000702 ] }; + key <AE03> { [ 3, 0x1000325, 0x1000703 ] }; + key <AE04> { [ 4, 0x1000749, 0x1000704 ] }; + key <AE05> { [ 5, 0x1002670, 0x1000705 ] }; + key <AE06> { [ 6, 0x1002671, 0x1000708 ] }; + key <AE07> { [ 7, 0x100070A, 0x1000709 ] }; + key <AE08> { [ 8, 0x10000BB, 0x100070B ] }; + key <AE09> { [ 9, parenright, 0x100070C ] }; + key <AE10> { [ 0, parenleft, 0x100070D ] }; + key <AE11> { [ minus, 0x10000AB, 0x100250C ] }; + key <AE12> { [ equal, plus, 0x1002510 ] }; + + key <AD01> { [ 0x1000729, 0x1000730, Arabic_fatha ] }; + key <AD02> { [ 0x1000718, 0x1000733, Arabic_fathatan ] }; + key <AD03> { [ 0x1000716, 0x1000736, Arabic_damma ] }; + key <AD04> { [ 0x100072A, 0x100073A, Arabic_dammatan ] }; + key <AD05> { [ 0x100072C, 0x100073D, Arabic_madda_above ] }; + key <AD06> { [ 0x100071D, 0x1000740, Arabic_hamza_above ] }; + key <AD07> { [ 0x100071C, 0x1000741, 0x1000747 ] }; + key <AD08> { [ 0x1000725, 0x1000308, 0x1000743 ] }; + key <AD09> { [ 0x1000727, 0x1000304, 0x1000745 ] }; + key <AD10> { [ 0x1000726, 0x1000307, 0x100032D ] }; + key <AD11> { [ bracketright, 0x1000303 ] }; + key <AD12> { [ bracketleft, 0x100074A ] }; + key <BKSL> { [ 0x1000706, colon ] }; + + key <AC01> { [ 0x1000710, 0x1000731, Arabic_kasra ] }; + key <AC02> { [ 0x1000723, 0x1000734, Arabic_kasratan ] }; + key <AC03> { [ 0x1000715, 0x1000737 ] }; + key <AC04> { [ 0x1000714, 0x100073B, Arabic_hamza ] }; + key <AC05> { [ 0x1000713, 0x100073E, Arabic_hamza_below ] }; + key <AC06> { [ 0x1000717, 0x1000711, Arabic_superscript_alef ] }; + key <AC07> { [ 0x100071B, Arabic_tatweel, 0x1000748 ] }; + key <AC08> { [ 0x100071F, 0x1000324, 0x1000744 ] }; + key <AC09> { [ 0x1000720, 0x1000331, 0x1000746 ] }; + key <AC10> { [ 0x100071A, 0x1000323 ] }; + key <AC11> { [ 0x100071E, 0x1000330 ] }; + + key <SPCE> { [ space, 0x100200c ] }; + key <AB01> { [ 0x1000719, 0x1000732, Arabic_sukun ] }; + key <AB02> { [ 0x1000728, 0x1000735 ] }; + key <AB03> { [ 0x1000724, 0x1000738, 0x100200D ] }; + key <AB04> { [ 0x100072B, 0x100073C, 0x100200C ] }; + key <AB05> { [ 0x1000712, 0x100073F, 0x100200E ] }; + key <AB06> { [ 0x1000722, 0x1000739, 0x100200F ] }; + key <AB07> { [ 0x1000721, 0x1000742 ] }; + key <AB08> { [ 0x1000700, Arabic_comma ] }; + key <AB09> { [ 0x100002E, Arabic_semicolon ] }; + key <AB10> { [ 0x1000707, Arabic_question_mark ] }; + + // End Alphanumeric Section + + + // Begin Modifier Mappings + + modifier_map Shift { Shift_L, Shift_R }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L, Control_R }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod2 { Mode_switch }; + +}; Index: xc/programs/xkbcomp/symbols/pc/tel diff -u /dev/null xc/programs/xkbcomp/symbols/pc/tel:1.1 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/tel Sat Dec 14 19:44:56 2002 @@ -0,0 +1,69 @@ +// $XFree86: xc/programs/xkbcomp/symbols/pc/tel,v 1.1 2002/12/15 00:44:56 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Inscript layout for Telugu using Unicode + // Author: G Karunakar <karunakar@freedomink.org> + // Date: + // See layout at http://www.indlinux.org/keymap/telugu.php + + name[Group1]= "Telugu"; + + key <TLDE> { [ 0x01000c4a, 0x01000c12 ] }; + key <AE01> { [ 0x01000c67, 0x01000c0d ] }; + key <AE02> { [ 0x01000c68, 0x01000c45 ] }; + key <AE03> { [ 0x01000c69, numbersign ] }; + key <AE04> { [ 0x01000c6a, dollar ] }; + key <AE05> { [ 0x01000c6b, percent ] }; + key <AE06> { [ 0x01000c6c, asciicircum ] }; + key <AE07> { [ 0x01000c6d, ampersand ] }; + key <AE08> { [ 0x01000c6e, asterisk ] }; + key <AE09> { [ 0x01000c6f, parenleft ] }; + key <AE10> { [ 0x01000c66, parenright ] }; + key <AE11> { [ 0x01000c03, underscore ] }; + key <AE12> { [ 0x01000c43, 0x01000c0b ] }; + key <BKSP> { [ BackSpace ] }; + + key <AD01> { [ 0x01000c4c, 0x01000c14 ] }; + key <AD02> { [ 0x01000c48, 0x01000c10 ] }; + key <AD03> { [ 0x01000c3e, 0x01000c06 ] }; + key <AD04> { [ 0x01000c40, 0x01000c08 ] }; + key <AD05> { [ 0x01000c42, 0x01000c0a ] }; + key <AD06> { [ 0x01000c2c, 0x01000c2d ] }; + key <AD07> { [ 0x01000c39, 0x01000c19 ] }; + key <AD08> { [ 0x01000c17, 0x01000c18 ] }; + key <AD09> { [ 0x01000c26, 0x01000c27 ] }; + key <AD10> { [ 0x01000c1c, 0x01000c1d ] }; + key <AD11> { [ 0x01000c21, 0x01000c22 ] }; + key <AD12> { [ 0x01000c3c, 0x01000c1e ] }; + + key <AC01> { [ 0x01000c4b, 0x01000c13 ] }; + key <AC02> { [ 0x01000c47, 0x01000c0f ] }; + key <AC03> { [ 0x01000c4d, 0x01000c05 ] }; + key <AC04> { [ 0x01000c3f, 0x01000c07 ] }; + key <AC05> { [ 0x01000c41, 0x01000c09 ] }; + key <AC06> { [ 0x01000c2a, 0x01000c2b ] }; + key <AC07> { [ 0x01000c30, 0x01000c31 ] }; + key <AC08> { [ 0x01000c15, 0x01000c16 ] }; + key <AC09> { [ 0x01000c24, 0x01000c25 ] }; + key <AC10> { [ 0x01000c1a, 0x01000c1b ] }; + key <AC11> { [ 0x01000c1f, 0x01000c20 ] }; + + key <AB01> { [ 0x01000c46, 0x01000c0e ] }; + key <AB02> { [ 0x01000c02, 0x01000c01 ] }; + key <AB03> { [ 0x01000c2e, 0x01000c23 ] }; + key <AB04> { [ 0x01000c28, 0x01000c29 ] }; + key <AB05> { [ 0x01000c35, 0x01000c34 ] }; + key <AB06> { [ 0x01000c32, 0x01000c33 ] }; + key <AB07> { [ 0x01000c38, 0x01000c36 ] }; + key <AB08> { [ comma , 0x01000c37 ] }; + key <AB09> { [ period , 0x01000c64 ] }; + key <AB10> { [ 0x01000c2f, 0x01000040 ] }; + key <BKSL> { [ 0x01000c49, 0x01000c11 ] }; + + key <RALT> { + symbols[Group1] = [ Mode_switch , Multi_key ], + virtualMods = AltGr + }; +}; Index: xc/programs/xkbcomp/symbols/pc/th diff -u /dev/null xc/programs/xkbcomp/symbols/pc/th:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/th Thu Nov 21 23:03:28 2002 @@ -0,0 +1,64 @@ + +// based on a keyboard map from an 'xkb/symbols/th' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/th,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Thai"; + + // converted to THai keysysms - Pablo Saratxaga <pablo@mandrakesoft.com> + + key <TLDE> { [ underscore, percent ] }; + key <AE01> { [ Thai_lakkhangyao, plus ] }; + key <AE02> { [ slash, Thai_leknung ] }; + key <AE03> { [ minus, Thai_leksong ] }; + key <AE04> { [ Thai_phosamphao,Thai_leksam ] }; + key <AE05> { [ Thai_thothung, Thai_leksi ] }; + key <AE06> { [ Thai_sarau, Thai_sarauu ] }; + key <AE07> { [ Thai_saraue, Thai_baht ] }; + key <AE08> { [ Thai_khokhwai, Thai_lekha ] }; + key <AE09> { [ Thai_totao, Thai_lekhok ] }; + key <AE10> { [ Thai_chochan, Thai_lekchet ] }; + key <AE11> { [ Thai_khokhai, Thai_lekpaet ] }; + key <AE12> { [ Thai_chochang, Thai_lekkao ] }; + + key <AD01> { [ Thai_maiyamok,Thai_leksun ] }; + key <AD02> { [ Thai_saraaimaimalai, quotedbl] }; + key <AD03> { [ Thai_saraam, Thai_dochada ] }; + key <AD04> { [ Thai_phophan,Thai_thonangmontho ] }; + key <AD05> { [ Thai_saraa, Thai_thothong ] }; + key <AD06> { [ Thai_maihanakat,Thai_nikhahit] }; + key <AD07> { [ Thai_saraii, Thai_maitri ] }; + key <AD08> { [ Thai_rorua, Thai_nonen ] }; + key <AD09> { [ Thai_nonu, Thai_paiyannoi ] }; + key <AD10> { [ Thai_yoyak, Thai_yoying ] }; + key <AD11> { [ Thai_bobaimai, Thai_thothan ] }; + key <AD12> { [ Thai_loling, comma ] }; + + key <AC01> { [ Thai_fofan, Thai_ru ] }; + key <AC02> { [ Thai_hohip, Thai_khorakhang ] }; + key <AC03> { [ Thai_kokai, Thai_topatak ] }; + key <AC04> { [ Thai_dodek, Thai_sarao ] }; + key <AC05> { [ Thai_sarae, Thai_chochoe ] }; + key <AC06> { [ Thai_maitho, Thai_maitaikhu ] }; + key <AC07> { [ Thai_maiek, Thai_maichattawa ] }; + key <AC08> { [ Thai_saraaa, Thai_sorusi ] }; + key <AC09> { [ Thai_sosua, Thai_sosala ] }; + key <AC10> { [ Thai_wowaen, Thai_soso ] }; + key <AC11> { [ Thai_ngongu, period ] }; + + key <AB01> { [ Thai_phophung, parenleft ] }; + key <AB02> { [ Thai_popla, parenright ] }; + key <AB03> { [ Thai_saraae, Thai_choching ] }; + key <AB04> { [ Thai_oang, Thai_honokhuk ] }; + key <AB05> { [ Thai_sarai, Thai_phinthu ] }; + key <AB06> { [ Thai_sarauee,Thai_thanthakhat ] }; + key <AB07> { [ Thai_thothahan, question ] }; + key <AB08> { [ Thai_moma, Thai_thophuthao ] }; + key <AB09> { [ Thai_saraaimaimuan, Thai_lochula ] }; + key <AB10> { [ Thai_fofa, Thai_lu ] }; + + key <BKSL> { [ Thai_khokhuat, Thai_khokhon ] }; + +}; Index: xc/programs/xkbcomp/symbols/pc/tj diff -u /dev/null xc/programs/xkbcomp/symbols/pc/tj:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/tj Thu Nov 21 23:03:28 2002 @@ -0,0 +1,82 @@ + +// based on +// Tajik keyboard +// it is a Russian layout keyboard, with SHCHA replaced with +// dead_cedilla/dead_macron +// that allows to type the SHCHA with dead_cedilla + SHA +// and all the extra Tajik keys: +// dead_cedilla + KA, HA --> KA descender, HA descender +// dead_macron + I, U, GHE --> I macron, U macron, GHE horizontal stroke +// it requires proper dead_cedilla and dead_macron entries in Compose file +// it also allows to use Mode_switch when in cyrillic mode to enter +// special letters by doing Mode_switch + base letter +// +// AEN <aen@logic.ru> (for the Russian layout) +// Pablo Saratxaga <pablo@mandrakesoft> (for the dead keys changes) +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/tj,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Tajik"; + + key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] }; + key <LSGT> { [ bar, brokenbar ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AE01> { [ 1, exclam ] }; + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ], + [ 0x010004b7, 0x010004b6 ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ], + [ 0x010004ef, 0x010004ee ] }; + key <AE04> { [ 4, asterisk ] }; + key <AE03> { [ 3, apostrophe ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ], + [ 0x0100049b, 0x0100049a ] }; + key <AE05> { [ 5, colon ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ], + [ 0x010004e3, 0x010004e2 ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AE06> { [ 6, comma ] }; + key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ], + [ 0x01000493, 0x01000492 ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ], + [ Cyrillic_shcha, Cyrillic_SHCHA] }; + key <AD09> { [ dead_cedilla, dead_macron ] }; + key <AE10> { [ 0, parenright ] }; + key <AE09> { [ 9, parenleft ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ slash, question ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ], + [ 0x01000497, 0x01000496 ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AE11> { [ minus, underscore ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ], + [ 0x010004b3, 0x010004b2 ] }; + key <AE12> { [ equal, plus ] }; + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + + // End alphanumeric section + +}; Index: xc/programs/xkbcomp/symbols/pc/tml diff -u /dev/null xc/programs/xkbcomp/symbols/pc/tml:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/tml Thu Nov 21 23:03:28 2002 @@ -0,0 +1,66 @@ + +// based on a keyboard map from an 'xkb/symbols/tml' file +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/tml,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group1]= "Tamil"; + + key <TLDE> { [ 0x1000BCA, 0x1000B92 ] }; + +// Mainly numbers. + key <AE01> { [ 0x1000BE7 ] }; + key <AE02> { [ 0x1000BE8 ] }; + key <AE03> { [ 0x1000BE9 ] }; + key <AE04> { [ 0x1000BEA ] }; + key <AE05> { [ 0x1000BEB ] }; + key <AE06> { [ 0x1000BEC ] }; + key <AE07> { [ 0x1000BED ] }; + key <AE08> { [ 0x1000BEE ] }; + key <AE09> { [ 0x1000BEF, parenleft ] }; + key <AE10> { [ 0x1000BF0, parenright ] }; + key <AE11> { [ 0x1000BF1, 0x1000B83 ] }; + key <AE12> { [ 0x1000BF2, plus ] }; + +// Mainly long vowels + + key <AD01> { [ 0x1000BCC, 0x1000B94 ] }; + key <AD02> { [ 0x1000BC8, 0x1000B90 ] }; + key <AD03> { [ 0x1000BBE, 0x1000B86 ] }; + key <AD04> { [ 0x1000BC0, 0x1000B88 ] }; + key <AD05> { [ 0x1000BC2, 0x1000B8A ] }; + +// Mainly voiced consonants + + key <AD07> { [ 0x1000BB9, 0x1000B99 ] }; + key <AD12> { [ 0x1000BBC, 0x1000B9E ] }; + +// Mainly short vowels + key <AC01> { [ 0x1000BCB, 0x1000B93 ] }; + key <AC02> { [ 0x1000BC7, 0x1000B8F ] }; + key <AC03> { [ 0x1000BCD, 0x1000B85 ] }; + key <AC04> { [ 0x1000BBF, 0x1000B87 ] }; + key <AC05> { [ 0x1000BC1, 0x1000B89 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [ 0x1000BAA ] }; + key <AC07> { [ 0x1000BB0, 0x1000BB1 ] }; + key <AC08> { [ 0x1000B95 ] }; + key <AC09> { [ 0x1000BA4 ] }; + key <AC10> { [ 0x1000B9A ] }; + key <AC11> { [ 0x1000B9F ] }; + key <BKSL> { [ backslash, bar ] }; + + key <AB01> { [ 0x1000BC6, 0x1000B8E ] }; + key <AB02> { [ 0x1000B82 ] }; + key <AB03> { [ 0x1000BAE, 0x1000BA3 ] }; + key <AB04> { [ 0x1000BA8, 0x1000BA9 ] }; + key <AB05> { [ 0x1000BB5, 0x1000BB4 ] }; + key <AB06> { [ 0x1000BB2, 0x1000BB3 ] }; + key <AB07> { [ 0x1000BB8 ] }; + key <AB08> { [ comma, 0x1000BB7 ] }; + key <AB09> { [ period, 0x1000964 ] }; + key <AB10> { [ 0x1000BAF, question ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/tr diff -u /dev/null xc/programs/xkbcomp/symbols/pc/tr:1.4 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/tr Fri Jan 3 21:55:20 2003 @@ -0,0 +1,126 @@ + +// based on +// Turkish keyboard symbols for PC and xkb +// This file distributed without any expressed or implied warranty +// Nilgün Belma Bugüner <nilgun@superonline.com>, 2002 +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/tr,v 1.4 2003/01/04 02:55:20 dawes Exp $ + +//Default Layout (Turkish Q) +default partial +xkb_symbols "basic" { + + include "pc/latin" + + name[Group1]="Turkish"; + + key <AE01> { type[group1] = "FOUR_LEVEL", [ 1, exclam, onesuperior, exclamdown ] }; + key <AE02> { type[group1] = "FOUR_LEVEL", [ 2, apostrophe, sterling, twosuperior ] }; + key <AE03> { type[group1] = "FOUR_LEVEL", [ 3, asciicircum, numbersign, threesuperior ] }; + key <AE04> { type[group1] = "FOUR_LEVEL", [ 4, plus, dollar, onequarter ] }; + key <AE06> { type[group1] = "FOUR_LEVEL", [ 6, ampersand, threequarters, VoidSymbol ] }; + key <AE07> { type[group1] = "FOUR_LEVEL", [ 7, slash, braceleft, VoidSymbol ] }; + key <AE08> { type[group1] = "FOUR_LEVEL", [ 8, parenleft, bracketleft, VoidSymbol ] }; + key <AE09> { type[group1] = "FOUR_LEVEL", [ 9, parenright, bracketright, plusminus ] }; + key <AE10> { type[group1] = "FOUR_LEVEL", [ 0, equal, braceright, degree ] }; + key <AE11> { type[group1] = "FOUR_LEVEL", [ asterisk, question, backslash, questiondown ] }; + key <AE12> { type[group1] = "FOUR_LEVEL", [ minus, underscore, division, VoidSymbol ] }; + + key <AD02> { [ w, W, VoidSymbol, VoidSymbol ] }; + key <AD03> { [ e, E, EuroSign, VoidSymbol ] }; + key <AD05> { [ t, T, trademark, VoidSymbol ] }; + key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; + key <AD08> { [ idotless, I, icircumflex, Icircumflex ] }; + key <AD09> { [ o, O, ocircumflex, Ocircumflex ] }; + key <AD10> { [ p, P, VoidSymbol, VoidSymbol ] }; + key <AD11> { [ gbreve, Gbreve ] }; + key <AD12> { [udiaeresis, Udiaeresis, asciitilde, dead_macron ] }; + + key <AC01> { [ a, A, acircumflex, Acircumflex ] }; + key <AC02> { [ s, S, section, VoidSymbol ] }; + key <AC03> { [ d, D, VoidSymbol, VoidSymbol ] }; + key <AC04> { [ f, F, ordfeminine, VoidSymbol ] }; + key <AC05> { [ g, G, VoidSymbol, VoidSymbol ] }; + key <AC06> { [ h, H, VoidSymbol, VoidSymbol ] }; + key <AC08> { [ k, K, VoidSymbol, VoidSymbol ] }; + key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; + key <AC10> { [ scedilla, Scedilla, acute, dead_acute ] }; + key <AC11> { [ i, Iabovedot, apostrophe, dead_caron ] }; + key <TLDE> { type[group1] = "FOUR_LEVEL",[ quotedbl, backslash, plusminus, degree ] }; + + key <BKSL> { type[group1] = "FOUR_LEVEL",[ comma, semicolon, grave, dead_grave ] }; + key <LSGT> { type[group1] = "FOUR_LEVEL",[ less, greater, bar, brokenbar ] }; + key <AB08> { [odiaeresis, Odiaeresis, multiply, VoidSymbol ] }; + key <AB09> { [ ccedilla, Ccedilla, periodcentered, division ] }; + key <AB10> { type[group1] = "FOUR_LEVEL",[ period, colon, dead_abovedot, dead_abovedot ] }; + key <SPCE> { type[group1] = "FOUR_LEVEL", [ space, space, nobreakspace, nobreakspace ] }; + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + + +// Turkish F Layout +partial +xkb_symbols "tr_f" { + + include "pc/latin" + + name[Group1]="Turkish"; + + key <AE01> { type[group1] = "FOUR_LEVEL", [ 1, exclam, onesuperior, exclamdown ] }; + key <AE02> { type[group1] = "FOUR_LEVEL", [ 2, quotedbl, twosuperior, VoidSymbol ] }; + key <AE03> { type[group1] = "FOUR_LEVEL", [ 3, asciicircum, numbersign, threesuperior ] }; + key <AE04> { type[group1] = "FOUR_LEVEL", [ 4, dollar, onequarter, VoidSymbol ] }; + key <AE06> { type[group1] = "FOUR_LEVEL", [ 6, ampersand, threequarters, VoidSymbol ] }; + key <AE07> { type[group1] = "FOUR_LEVEL", [ 7, apostrophe, braceleft, VoidSymbol ] }; + key <AE08> { type[group1] = "FOUR_LEVEL", [ 8, parenleft, bracketleft, VoidSymbol ] }; + key <AE09> { type[group1] = "FOUR_LEVEL", [ 9, parenright, bracketright, plusminus ] }; + key <AE10> { type[group1] = "FOUR_LEVEL", [ 0, equal, braceright, degree ] }; + key <AE11> { type[group1] = "FOUR_LEVEL", [ slash, question, backslash, questiondown ] }; + key <AE12> { type[group1] = "FOUR_LEVEL", [ minus, underscore, division, VoidSymbol ] }; + + key <AD01> { [ f, F, at, VoidSymbol ] }; + key <AD02> { [ g, G, VoidSymbol, VoidSymbol ] }; + key <AD03> { [ gbreve, Gbreve, VoidSymbol, VoidSymbol ] }; + key <AD04> { [ idotless, I, paragraph, VoidSymbol ] }; + key <AD05> { [ o, O, ocircumflex, Ocircumflex ] }; + key <AD06> { [ d, D, yen, VoidSymbol ] }; + key <AD07> { [ r, R, registered, VoidSymbol ] }; + key <AD08> { [ n, N, VoidSymbol, VoidSymbol ] }; + key <AD09> { [ h, H, degree, VoidSymbol ] }; + key <AD10> { [ p, P, sterling, VoidSymbol ] }; + key <AD11> { [ q, Q, dead_diaeresis, dead_abovering ] }; + key <AD12> { [ w, W, asciitilde, dead_breve ] }; + + key <AC01> { [ u, U, ucircumflex, Ucircumflex ] }; + key <AC02> { [ i, Iabovedot, icircumflex, Icircumflex ] }; + key <AC03> { [ e, E, EuroSign, VoidSymbol ] }; + key <AC04> { [ a, A, acircumflex, Acircumflex ] }; + key <AC05> { [udiaeresis, Udiaeresis, ucircumflex, Ucircumflex ] }; + key <AC06> { [ t, T, trademark, VoidSymbol ] }; + key <AC07> { [ k, K, VoidSymbol, VoidSymbol ] }; + key <AC08> { [ m, M, mu, VoidSymbol ] }; + key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; + key <AC10> { [ y, Y, acute, dead_acute ] }; + key <AC11> { [ scedilla, Scedilla, numbersign, dead_caron ] }; + key <TLDE> { type[group1] = "FOUR_LEVEL", [ plus, asterisk, notsign, plusminus ] }; + + key <BKSL> { [ x, X, grave, dead_grave ] }; + key <AB01> { [ j, J, guillemotleft, VoidSymbol ] }; + key <AB02> { [odiaeresis, Odiaeresis, guillemotright, VoidSymbol ] }; + key <AB03> { [ v, V, leftdoublequotemark, VoidSymbol ] }; + key <AB04> { [ c, C, cent, copyright ] }; + key <AB05> { [ ccedilla, Ccedilla, rightdoublequotemark, VoidSymbol] }; + key <AB06> { [ z, Z, VoidSymbol, VoidSymbol ] }; + key <AB07> { [ s, S, section, VoidSymbol ] }; + key <AB08> { [ b, B, multiply, nobreakspace ] }; + key <AB09> { type[group1] = "FOUR_LEVEL", [ period, colon, division, dead_abovedot] }; + key <AB10> { type[group1] = "FOUR_LEVEL", [ comma, semicolon, periodcentered, VoidSymbol ] }; + key <SPCE> { type[group1] = "FOUR_LEVEL", [ space, space, nobreakspace, nobreakspace ] }; + key <LSGT> { type[group1] = "FOUR_LEVEL", [ less, greater, bar, brokenbar ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; Index: xc/programs/xkbcomp/symbols/pc/ua diff -u /dev/null xc/programs/xkbcomp/symbols/pc/ua:1.3 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/ua Sat Feb 15 17:27:05 2003 @@ -0,0 +1,150 @@ + +// based on +// ukrainian standard keyboard +// AEN <aen@logic.ru> & Leon Kanter <leon@geon.donetsk.ua> +// Last Changes 2001/12/11 by Andriy Rysin <arysin@yahoo.com> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/ua,v 1.3 2003/02/15 22:27:05 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + name[Group1]= "Ukrainian"; + + key <TLDE> { [ apostrophe, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, asterisk ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AD12> { [ Ukrainian_yi, Ukrainian_YI ] }; + key <BKSL> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Ukrainian_i, Ukrainian_I ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ Ukrainian_ie, Ukrainian_IE ] }; + + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ slash, question ] }; + + key <LSGT> { [ slash, bar ] }; + // End alphanumeric section +}; + +partial alphanumeric_keys +xkb_symbols "winkeys" { + include "pc/ua(basic)" + + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + key <AB10> { [ period, comma ] }; + key <BKSL> { [ backslash, slash ] }; +}; + +partial alphanumeric_keys +xkb_symbols "typewriter" { + include "pc/ua(basic)" + + key <TLDE> { [ apostrophe, quotedbl ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ numerosign, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; + + key <AD12> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + + key <AC02> { [ Cyrillic_i, Cyrillic_I ] }; + + key <AB05> { [ Ukrainian_i, Ukrainian_I ] }; + + key <AB10> { [ Ukrainian_yi, Ukrainian_YI ] }; + + key <BKSL> { [ parenleft, parenright ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic" { + include "pc/ua(basic)" + + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatY> { [ Cyrillic_i, Cyrillic_i ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatI> { [ Ukrainian_i, Ukrainian_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <AC11> { [ quoteright, quotedbl ] }; + key <BKSL> { [ Cyrillic_yu, Cyrillic_YU ] }; + + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; +}; Index: xc/programs/xkbcomp/symbols/pc/us diff -u /dev/null xc/programs/xkbcomp/symbols/pc/us:1.3 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/us Sat Feb 15 17:21:24 2003 @@ -0,0 +1,62 @@ +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/us,v 1.3 2003/02/15 22:21:24 dawes Exp $ + +default +partial hidden alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + name[Group1]= "US/ASCII"; + + // Alphanumeric section + key <TLDE> { [ grave, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <AD01> { [ q, Q ] }; + key <AD02> { [ w, W ] }; + key <AD03> { [ e, E ] }; + key <AD04> { [ r, R ] }; + key <AD05> { [ t, T ] }; + key <AD06> { [ y, Y ] }; + key <AD07> { [ u, U ] }; + key <AD08> { [ i, I ] }; + key <AD09> { [ o, O ] }; + key <AD10> { [ p, P ] }; + key <AD11> { [ bracketleft, braceleft ] }; + key <AD12> { [ bracketright, braceright ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ s, S ] }; + key <AC03> { [ d, D ] }; + key <AC04> { [ f, F ] }; + key <AC05> { [ g, G ] }; + key <AC06> { [ h, H ] }; + key <AC07> { [ j, J ] }; + key <AC08> { [ k, K ] }; + key <AC09> { [ l, L ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + + key <AB01> { [ z, Z ] }; + key <AB02> { [ x, X ] }; + key <AB03> { [ c, C ] }; + key <AB04> { [ v, V ] }; + key <AB05> { [ b, B ] }; + key <AB06> { [ n, N ] }; + key <AB07> { [ m, M ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + + // End alphanumeric section +}; Index: xc/programs/xkbcomp/symbols/pc/yu diff -u /dev/null xc/programs/xkbcomp/symbols/pc/yu:1.2 --- /dev/null Thu Feb 27 12:35:38 2003 +++ xc/programs/xkbcomp/symbols/pc/yu Thu Nov 21 23:03:28 2002 @@ -0,0 +1,45 @@ + +// based on +// Yugoslavian keyboard. +// Source: the keyboard pictures on MS-DOS 6.22 manual +// Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> +// +// $XFree86: xc/programs/xkbcomp/symbols/pc/yu,v 1.2 2002/11/22 04:03:28 dawes Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + include "pc/latin(type3)" + + name[Group1]="Yugoslav"; + + key <AE01> { [ 1, exclam, asciitilde, exclamdown ] }; + key <AE02> { [ 2, quotedbl, dead_caron, oneeighth ] }; + key <AE03> { [ 3, numbersign, dead_circumflex, sterling ] }; + key <AE04> { [ 4, dollar, dead_breve, dollar ] }; + key <AE05> { [ 5, percent, degree, threeeighths ] }; + key <AE06> { [ 6, ampersand, dead_ogonek, fiveeighths ] }; + key <AE07> { [ 7, slash, dead_grave, seveneighths ] }; + key <AE08> { [ 8, parenleft, abovedot, trademark ] }; + key <AE09> { [ 9, parenright, dead_acute, plusminus ] }; + key <AE10> { [ 0, equal, dead_doubleacute, degree ] }; + key <AE11> { [apostrophe, question, dead_diaeresis, questiondown ] }; + key <AE12> { [ plus, asterisk, dead_cedilla, dead_ogonek ] }; + + key <AD06> { [ y, Y, leftarrow, yen ] }; + key <AD11> { [ scaron, Scaron, division, dead_abovering ] }; + key <AD12> { [ dstroke, Dstroke, multiply, dead_macron ] }; + + key <AC09> { [ l, l, Lstroke, Lstroke ] }; + key <AC10> { [ ccaron, Ccaron, dead_acute, dead_doubleacute ] }; + key <AC11> { [ cacute, Cacute, ssharp, dead_caron ] }; + key <TLDE> { [dead_diaeresis, dead_cedilla, notsign, notsign ] }; + + key <BKSL> { [ zcaron, Zcaron, dead_grave, dead_breve ] }; + key <AB01> { [ z, Z, guillemotleft, less ] }; + + key <RALT> { type[Group1]="TWO_LEVEL", + [ ISO_Level3_Shift, Multi_key ] }; + modifier_map Mod5 { <RALT> }; +}; + Index: xc/programs/xkbcomp/types/Imakefile diff -u xc/programs/xkbcomp/types/Imakefile:3.5 xc/programs/xkbcomp/types/Imakefile:3.7 --- xc/programs/xkbcomp/types/Imakefile:3.5 Fri May 18 22:05:56 2001 +++ xc/programs/xkbcomp/types/Imakefile Sat Feb 15 17:22:45 2003 @@ -3,10 +3,10 @@ -XCOMM $XFree86: xc/programs/xkbcomp/types/Imakefile,v 3.5 2001/05/19 02:05:56 dawes Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/types/Imakefile,v 3.7 2003/02/15 22:22:45 dawes Exp $ - DATAFILES = basic cancel nocancel complete default mousekeys iso9995 pc extra + DATAFILES = README basic caps complete default mousekeys iso9995 pc extra all:: Index: xc/programs/xkbcomp/types/README diff -u /dev/null xc/programs/xkbcomp/types/README:1.1 --- /dev/null Thu Feb 27 12:35:40 2003 +++ xc/programs/xkbcomp/types/README Thu Nov 21 23:19:28 2002 @@ -0,0 +1,8 @@ +The types component of a keyboard mapping specifies the key types that can be +associated with the various keyboard keys. The types component can also +optionally contain real modifiers binding and symbolic names for one +or more virtual modifiers. + + + +/* $XFree86: xc/programs/xkbcomp/types/README,v 1.1 2002/11/22 04:19:28 dawes Exp $ */ Index: xc/programs/xkbcomp/types/caps diff -u xc/programs/xkbcomp/types/caps:1.1 xc/programs/xkbcomp/types/caps:1.3 --- xc/programs/xkbcomp/types/caps:1.1 Mon Aug 13 15:39:04 2001 +++ xc/programs/xkbcomp/types/caps Mon Nov 25 21:14:02 2002 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/types/caps,v 1.1 2001/08/13 19:39:04 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/types/caps,v 1.3 2002/11/26 02:14:02 dawes Exp $ // CapsLock uses internal capitalization rules // Shift cancels CapsLock @@ -6,10 +6,26 @@ type "ALPHABETIC" { modifiers = Shift+Lock; map[Shift] = Level2; - preserve[Lock]= Lock; + preserve[Lock] = Lock; level_name[Level1] = "Base"; level_name[Level2] = "Caps"; }; + + type "FOUR_LEVEL_ALPHABETIC" { + modifiers = Shift+Lock+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + map[Lock+LevelThree] = Level3; + map[Lock+Shift+LevelThree] = Level3; + preserve[Lock] = Lock; + preserve[Lock+LevelThree] = Lock; + level_name[Level1] = "Base"; + level_name[Level2] = "Shift"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Shift Alt"; + }; }; // CapsLock uses internal capitalization rules // Shift doesn't cancel CapsLock @@ -20,6 +36,18 @@ level_name[Level1] = "Base"; level_name[Level2] = "Caps"; }; + + type "FOUR_LEVEL_ALPHABETIC" { + modifiers = Shift+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + level_name[Level1] = "Base"; + level_name[Level2] = "Shift"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Shift Alt"; + }; }; // CapsLock acts as Shift with locking // Shift cancels CapsLock @@ -27,10 +55,25 @@ type "ALPHABETIC" { modifiers = Shift+Lock; map[Shift] = Level2; - map[Lock]= Level2; + map[Lock] = Level2; level_name[Level1] = "Base"; level_name[Level2] = "Caps"; }; + + type "FOUR_LEVEL_ALPHABETIC" { + modifiers = Shift+Lock+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[Lock] = Level2; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + map[Lock+LevelThree] = Level4; + map[Shift+Lock+LevelThree] = Level3; + level_name[Level1] = "Base"; + level_name[Level2] = "Shift"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Shift Alt"; + }; }; // CapsLock acts as Shift with locking // Shift doesn't cancel CapsLock @@ -38,9 +81,25 @@ type "ALPHABETIC" { modifiers = Shift+Lock; map[Shift] = Level2; - map[Lock]= Level2; - map[Shift+Lock]= Level2; + map[Lock] = Level2; + map[Shift+Lock] = Level2; level_name[Level1] = "Base"; level_name[Level2] = "Caps"; + }; + + type "FOUR_LEVEL_ALPHABETIC" { + modifiers = Shift+Lock+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[Lock] = Level2; + map[Shift+Lock] = Level2; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + map[Lock+LevelThree] = Level4; + map[Shift+Lock+LevelThree] = Level4; + level_name[Level1] = "Base"; + level_name[Level2] = "Shift"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Shift Alt"; }; }; Index: xc/programs/xkbcomp/types/extra diff -u xc/programs/xkbcomp/types/extra:1.1 xc/programs/xkbcomp/types/extra:1.3 --- xc/programs/xkbcomp/types/extra:1.1 Fri May 18 19:35:35 2001 +++ xc/programs/xkbcomp/types/extra Mon Nov 25 21:14:02 2002 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/types/extra,v 1.1 2001/05/18 23:35:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/types/extra,v 1.3 2002/11/26 02:14:02 dawes Exp $ partial default xkb_types "default" { // Definition for a key type used for the czech keymap, for instance. @@ -13,6 +13,22 @@ map[Shift] = Level2; map[LevelThree] = Level3; map[Shift+LevelThree] = Level4; + level_name[Level1] = "Base"; + level_name[Level2] = "Shift"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Shift Alt"; + }; + + type "FOUR_LEVEL_ALPHABETIC" { + modifiers = Shift+Lock+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + map[Lock+LevelThree] = Level3; + map[Lock+Shift+LevelThree] = Level3; + preserve[Lock]= Lock; + preserve[Lock+LevelThree]= Lock; level_name[Level1] = "Base"; level_name[Level2] = "Shift"; level_name[Level3] = "Alt Base"; Index: xc/programs/xkbevd/cfgparse.y diff -u xc/programs/xkbevd/cfgparse.y:1.4 xc/programs/xkbevd/cfgparse.y:1.5 --- xc/programs/xkbevd/cfgparse.y:1.4 Wed Jan 17 18:46:07 2001 +++ xc/programs/xkbevd/cfgparse.y Wed Oct 16 00:53:17 2002 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/cfgparse.y,v 1.4 2001/01/17 23:46:07 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/cfgparse.y,v 1.5 2002/10/16 04:53:17 tsi Exp $ */ %token END_OF_FILE 0 @@ -173,6 +173,7 @@ | SHELL { $$ = ShellAction; } | SOUND { $$ = SoundAction; } | { $$ = UnknownAction; } + ; OptNameSpec : NameSpec { $$= $1; } | { $$= NULL; } Index: xc/programs/xload/get_load.c diff -u xc/programs/xload/get_load.c:1.15 xc/programs/xload/get_load.c:1.18 --- xc/programs/xload/get_load.c:1.15 Mon Jan 7 15:38:31 2002 +++ xc/programs/xload/get_load.c Wed Sep 18 13:11:57 2002 @@ -1,5 +1,5 @@ /* $XConsortium: get_load.c /main/37 1996/03/09 09:38:04 kaleb $ */ -/* $XFree86: xc/programs/xload/get_load.c,v 1.15 2002/01/07 20:38:31 dawes Exp $ */ +/* $XFree86: xc/programs/xload/get_load.c,v 1.18 2002/09/18 17:11:57 tsi Exp $ */ /* Copyright (c) 1989 X Consortium @@ -43,6 +43,7 @@ #include <X11/Intrinsic.h> #include <X11/Xlocale.h> #include <stdio.h> +#include <stdlib.h> #include "xload.h" #if !defined(DGUX) @@ -53,7 +54,7 @@ #ifndef macII #ifndef apollo #ifndef LOADSTUB -#if !defined(linux) && !defined(__EMX__) && !defined(__GNU__) +#if !defined(linux) && !defined(__UNIXOS2__) && !defined(__GNU__) #include <nlist.h> #endif /* !linux && ... */ #endif /* LOADSTUB */ @@ -613,6 +614,7 @@ #else /* not __bsdi__ */ #if defined(BSD) && (BSD >= 199306) +#include <stdlib.h> void InitLoadPoint() { Index: xc/programs/xload/xload.c diff -u xc/programs/xload/xload.c:1.6 xc/programs/xload/xload.c:1.7 --- xc/programs/xload/xload.c:1.6 Mon Aug 27 19:35:14 2001 +++ xc/programs/xload/xload.c Wed Sep 18 13:11:57 2002 @@ -1,5 +1,5 @@ /* $XConsortium: xload.c,v 1.37 94/04/17 20:43:44 converse Exp $ */ -/* $XFree86: xc/programs/xload/xload.c,v 1.6 2001/08/27 23:35:14 dawes Exp $ */ +/* $XFree86: xc/programs/xload/xload.c,v 1.7 2002/09/18 17:11:57 tsi Exp $ */ /* Copyright (c) 1989 X Consortium @@ -36,6 +36,7 @@ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <X11/Intrinsic.h> #include <X11/Xatom.h> Index: xc/programs/xload/xload.man diff -u xc/programs/xload/xload.man:1.4 xc/programs/xload/xload.man:1.5 --- xc/programs/xload/xload.man:1.4 Mon Aug 13 15:35:01 2001 +++ xc/programs/xload/xload.man Sat Oct 12 12:06:48 2002 @@ -1,6 +1,6 @@ .\" $XConsortium: xload.man,v 1.29 94/04/17 20:43:44 matt Exp $ .\" -.\" $XFree86: xc/programs/xload/xload.man,v 1.4 2001/08/13 19:35:01 dawes Exp $ +.\" $XFree86: xc/programs/xload/xload.man,v 1.5 2002/10/12 16:06:48 herrb Exp $ .\" .TH XLOAD 1 __xorgversion__ .SH NAME @@ -88,7 +88,9 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -<XRoot>/lib/X11/app-defaults/XLoad - specifies required resources +.TP +.I __apploaddir__/XLoad +specifies required resources .SH SEE ALSO X(__miscmansuffix__), xrdb(1), mem(4), Athena StripChart Widget. .SH BUGS Index: xc/programs/xlogo/Imakefile diff -u xc/programs/xlogo/Imakefile:1.1.1.3 xc/programs/xlogo/Imakefile:1.3 --- xc/programs/xlogo/Imakefile:1.1.1.3 Tue Jan 16 18:01:24 2001 +++ xc/programs/xlogo/Imakefile Sun Jun 30 22:26:04 2002 @@ -1,10 +1,28 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ - DEPLIBS = XawClientDepLibs XkbClientDepLibs -LOCAL_LIBRARIES = XawClientLibs XkbClientLibs - SRCS = xlogo.c Logo.c - OBJS = xlogo.o Logo.o - HEADERS = LogoP.h Logo.h - DEFINES = XkbClientDefines + + + +XCOMM $XFree86: xc/programs/xlogo/Imakefile,v 1.3 2002/07/01 02:26:04 tsi Exp $ + +#ifndef XLogoUseRender +#define XLogoUseRender BuildRenderLibrary +#endif + +#if XLogoUseRender + XRENDERDEFS = -DXRENDER + XRENDERDEPS = XftClientDepLibs $(DEPXFTLIB) $(DEPXRENDERLIB) + XRENDERLIBS = XftClientLibs $(XRENDERLIB) -lm + XRENDERINCS = $(XFTINCLUDES) $(XRENDERINCLUDES) +#endif + + DEPLIBS = $(XRENDERDEPS) XawClientDepLibs XkbClientDepLibs +LOCAL_LIBRARIES = $(XRENDERLIBS) XawClientLibs XkbClientLibs + SRCS = xlogo.c Logo.c RenderLogo.c + OBJS = xlogo.o Logo.o RenderLogo.o + HEADERS = LogoP.h Logo.h RenderLogo.h + INCLUDES = $(XRENDERINCS) + DEFINES = $(XRENDERDEFS) XkbClientDefines + CDEBUGFLAGS = -g ComplexProgramTarget(xlogo) InstallAppDefaults(XLogo) Index: xc/programs/xlogo/Logo.c diff -u xc/programs/xlogo/Logo.c:1.5 xc/programs/xlogo/Logo.c:1.6 --- xc/programs/xlogo/Logo.c:1.5 Fri Dec 14 15:02:07 2001 +++ xc/programs/xlogo/Logo.c Thu May 23 19:53:59 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xlogo/Logo.c,v 1.5 2001/12/14 20:02:07 dawes Exp $ */ +/* $XFree86: xc/programs/xlogo/Logo.c,v 1.6 2002/05/23 23:53:59 keithp Exp $ */ #include <X11/StringDefs.h> #include <X11/IntrinsicP.h> @@ -34,15 +34,35 @@ #include "LogoP.h" #include <X11/extensions/shape.h> +#ifdef XRENDER +#include "RenderLogo.h" +#endif + static XtResource resources[] = { - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - XtOffsetOf(LogoRec,logo.fgpixel), XtRString, - (XtPointer) XtDefaultForeground}, {XtNshapeWindow, XtCShapeWindow, XtRBoolean, sizeof (Boolean), XtOffsetOf(LogoRec,logo.shape_window), XtRImmediate, (XtPointer) FALSE}, +#ifdef XRENDER + {XtNrender, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffsetOf(LogoRec,logo.render), XtRImmediate, + (XtPointer) FALSE }, + {XtNsharp, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffsetOf(LogoRec,logo.sharp), XtRImmediate, + (XtPointer) FALSE }, + {XtNforeground, XtCForeground, XtRXftColor, sizeof(XftColor), + XtOffsetOf(LogoRec, logo.fg), XtRString, + (XtPointer) XtDefaultForeground}, + {XtNbackground, XtCForeground, XtRXftColor, sizeof(XftColor), + XtOffsetOf(LogoRec, logo.bg), XtRString, + (XtPointer) XtDefaultBackground}, +#else + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(LogoRec,logo.fgpixel), XtRString, + (XtPointer) XtDefaultForeground}, +#endif }; +static void ClassInitialize ( void ); static void Initialize ( Widget request, Widget new, ArgList args, Cardinal *num_args ); static void Destroy ( Widget gw ); @@ -58,7 +78,7 @@ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Logo", /* widget_size */ sizeof(LogoRec), - /* class_initialize */ NULL, + /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, @@ -110,6 +130,10 @@ { XGCValues v; +#ifdef XRENDER + w->logo.fgpixel = w->logo.fg.pixel; +#endif + v.foreground = w->logo.fgpixel; w->logo.foreGC = XtGetGC ((Widget) w, GCForeground, &v); v.foreground = w->core.background_pixel; @@ -196,12 +220,151 @@ * * *****************************************************************************/ +#ifdef XRENDER + +static void +RenderPrepare (LogoWidget w) +{ + if (!w->logo.draw) + { + w->logo.draw = XftDrawCreate (XtDisplay (w), XtWindow (w), + DefaultVisual (XtDisplay (w), + DefaultScreen(XtDisplay (w))), + w->core.colormap); + } +} + +XtConvertArgRec xftColorConvertArgs[] = { + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)}, + {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), + sizeof(Colormap)} +}; + +#define donestr(type, value, tstr) \ + { \ + if (toVal->addr != NULL) { \ + if (toVal->size < sizeof(type)) { \ + toVal->size = sizeof(type); \ + XtDisplayStringConversionWarning(dpy, \ + (char*) fromVal->addr, tstr); \ + return False; \ + } \ + *(type*)(toVal->addr) = (value); \ + } \ + else { \ + static type static_val; \ + static_val = (value); \ + toVal->addr = (XPointer)&static_val; \ + } \ + toVal->size = sizeof(type); \ + return True; \ + } + +static void +XmuFreeXftColor (XtAppContext app, XrmValuePtr toVal, XtPointer closure, + XrmValuePtr args, Cardinal *num_args) +{ + Screen *screen; + Colormap colormap; + XftColor *color; + + if (*num_args != 2) + { + XtAppErrorMsg (app, + "freeXftColor", "wrongParameters", + "XtToolkitError", + "Freeing an XftColor requires screen and colormap arguments", + (String *) NULL, (Cardinal *)NULL); + return; + } + + screen = *((Screen **) args[0].addr); + colormap = *((Colormap *) args[1].addr); + color = (XftColor *) toVal->addr; + XftColorFree (DisplayOfScreen (screen), + DefaultVisual (DisplayOfScreen (screen), + XScreenNumberOfScreen (screen)), + colormap, color); +} + +static Boolean +XmuCvtStringToXftColor(Display *dpy, + XrmValue *args, Cardinal *num_args, + XrmValue *fromVal, XrmValue *toVal, + XtPointer *converter_data) +{ + char *spec; + XRenderColor renderColor; + XftColor xftColor; + Screen *screen; + Colormap colormap; + + if (*num_args != 2) + { + XtAppErrorMsg (XtDisplayToApplicationContext (dpy), + "cvtStringToXftColor", "wrongParameters", + "XtToolkitError", + "String to render color conversion needs screen and colormap arguments", + (String *) NULL, (Cardinal *)NULL); + return False; + } + + screen = *((Screen **) args[0].addr); + colormap = *((Colormap *) args[1].addr); + + spec = (char *) fromVal->addr; + if (strcasecmp (spec, XtDefaultForeground) == 0) + { + renderColor.red = 0; + renderColor.green = 0; + renderColor.blue = 0; + renderColor.alpha = 0xffff; + } + else if (strcasecmp (spec, XtDefaultBackground) == 0) + { + renderColor.red = 0xffff; + renderColor.green = 0xffff; + renderColor.blue = 0xffff; + renderColor.alpha = 0xffff; + } + else if (!XRenderParseColor (dpy, spec, &renderColor)) + return False; + if (!XftColorAllocValue (dpy, + DefaultVisual (dpy, + XScreenNumberOfScreen (screen)), + colormap, + &renderColor, + &xftColor)) + return False; + + donestr (XftColor, xftColor, XtRXftColor); +} + + +#endif + +static void +ClassInitialize(void) +{ +#ifdef XRENDER + XtSetTypeConverter (XtRString, XtRXftColor, + XmuCvtStringToXftColor, + xftColorConvertArgs, XtNumber(xftColorConvertArgs), + XtCacheByDisplay, XmuFreeXftColor); +#endif +} + /* ARGSUSED */ static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { LogoWidget w = (LogoWidget)new; +#ifdef XRENDER + w->logo.draw = 0; + w->logo.fgpixel = w->logo.fg.pixel; +#endif if (w->core.width < 1) w->core.width = 100; if (w->core.height < 1) w->core.height = 100; @@ -255,11 +418,32 @@ if (w->logo.shape_window) { if (w->logo.need_shaping) set_shape (w); /* may change shape flag */ + } + if (!w->logo.shape_window) { +#ifdef XRENDER + if (w->logo.render) + { + RenderPrepare (w); + + XClearWindow (XtDisplay(w), XtWindow(w)); + RenderLogo (XtDisplay(w), PictOpOver, + XftDrawSrcPicture (w->logo.draw, &w->logo.fg), + XftDrawPicture (w->logo.draw), + XRenderFindStandardFormat (XtDisplay (w), + w->logo.sharp ? + PictStandardA1: + PictStandardA8), + 0, 0, (unsigned int) w->core.width, + (unsigned int) w->core.height); + } + else +#endif + { + XmuDrawLogo (XtDisplay(w), XtWindow(w), w->logo.foreGC, w->logo.backGC, + 0, 0, (unsigned int) w->core.width, + (unsigned int) w->core.height); + } } - if (!w->logo.shape_window) - XmuDrawLogo(XtDisplay(w), XtWindow(w), w->logo.foreGC, w->logo.backGC, - 0, 0, (unsigned int) w->core.width, - (unsigned int) w->core.height); } /* ARGSUSED */ Index: xc/programs/xlogo/Logo.h diff -u xc/programs/xlogo/Logo.h:1.2 xc/programs/xlogo/Logo.h:1.4 --- xc/programs/xlogo/Logo.h:1.2 Fri Dec 14 15:02:07 2001 +++ xc/programs/xlogo/Logo.h Sun Jun 30 22:26:04 2002 @@ -26,6 +26,7 @@ from The Open Group. */ +/* $XFree86: xc/programs/xlogo/Logo.h,v 1.4 2002/07/01 02:26:04 tsi Exp $ */ #ifndef _XawLogo_h #define _XawLogo_h @@ -50,6 +51,14 @@ #define XtNshapeWindow "shapeWindow" #define XtCShapeWindow "ShapeWindow" + +#define XtNrender "render" +#define XtCRender "Render" + +#define XtRXftColor "XftColor" + +#define XtNsharp "sharp" +#define XtCSharp "Sharp" typedef struct _LogoRec *LogoWidget; typedef struct _LogoClassRec *LogoWidgetClass; Index: xc/programs/xlogo/LogoP.h diff -u xc/programs/xlogo/LogoP.h:1.2 xc/programs/xlogo/LogoP.h:1.4 --- xc/programs/xlogo/LogoP.h:1.2 Fri Dec 14 15:02:07 2001 +++ xc/programs/xlogo/LogoP.h Sun Jun 30 22:26:04 2002 @@ -26,20 +26,33 @@ from The Open Group. */ +/* $XFree86: xc/programs/xlogo/LogoP.h,v 1.4 2002/07/01 02:26:04 tsi Exp $ */ - #ifndef _XawLogoP_h #define _XawLogoP_h #include "Logo.h" #include <X11/Xaw/SimpleP.h> +#ifdef XRENDER +#include <X11/extensions/Xrender.h> +#include <X11/Xft/Xft.h> +#endif + typedef struct { - Pixel fgpixel; + Pixel fgpixel; GC foreGC; GC backGC; Boolean shape_window; Boolean need_shaping; +#ifdef XRENDER + Boolean render; + Boolean sharp; + XftDraw *draw; + XRenderPictFormat *mask_format; + XftColor fg; + XftColor bg; +#endif } LogoPart; typedef struct _LogoRec { Index: xc/programs/xlogo/RenderLogo.c diff -u /dev/null xc/programs/xlogo/RenderLogo.c:1.2 --- /dev/null Thu Feb 27 12:35:45 2003 +++ xc/programs/xlogo/RenderLogo.c Sat Oct 19 15:15:32 2002 @@ -0,0 +1,163 @@ +/* $Xorg: DrawLogo.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ + +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/programs/xlogo/RenderLogo.c,v 1.2 2002/10/19 19:15:32 herrb Exp $ */ + +#include <stdio.h> +#include <math.h> + +#include <X11/Xlib.h> +#include <X11/extensions/Xrender.h> + +#include "RenderLogo.h" + +typedef struct _XLineDouble { + XPointDouble p1, p2; +} XLineDouble; + +static void +intersect(XLineDouble *l1, XLineDouble *l2, XPointDouble *intersection); + +/* + * Draw the "official" X Window System Logo, designed by Danny Chong + * + * Written by Ollie Jones, Apollo Computer + * + * Does some fancy stuff to make the logo look acceptable even + * if it is tiny. Also makes the various linear elements of + * the logo line up as well as possible considering rasterization. + * + * Munged to draw anti-aliased logo using Render extension. + * Carl Worth, 2002-05-16 + */ +void +RenderLogo(Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat *maskFormat, + int x, int y, unsigned int width, unsigned int height) +{ + unsigned int size; + double thin, thick, gap, d31; + XPointDouble poly[6]; + XLineDouble thick_left, thick_right, thin_left, thin_right, gap_left, gap_right; + + /* for now, do a centered even-sized square, at least for now */ + size = width; + if (height < width) + size = height; + size &= ~1; + x += (width - size) >> 1; + y += (height - size) >> 1; + + thin = (size / 11.0); + thick = (size / 4.0); + gap = thin / 4.0; + d31 = thin + thin + gap; + + thick_left.p1.x = x; thick_left.p1.y = y; + thick_left.p2.x = x + size - thick; thick_left.p2.y = y + size; + + thick_right.p1.x = x + thick; thick_right.p1.y = y; + thick_right.p2.x = x + size; thick_right.p2.y = y + size; + + thin_left.p1.x = x + size-d31; thin_left.p1.y = y; + thin_left.p2.x = x + 0; thin_left.p2.y = y + size; + + thin_right.p1.x = x + size; thin_right.p1.y = y; + thin_right.p2.x = x + d31; thin_right.p2.y = y + size; + + gap_left.p1.x = x + size-( thin+gap); gap_left.p1.y = y; + gap_left.p2.x = x + thin; gap_left.p2.y = y + size; + + gap_right.p1.x = x + size- thin; gap_right.p1.y = y; + gap_right.p2.x = x + thin + gap; gap_right.p2.y = y + size; + + poly[0] = thick_left.p1; + poly[1] = thick_right.p1; + intersect(&thick_right, &gap_left, &poly[2]); + poly[3] = gap_left.p2; + poly[4] = thin_left.p2; + intersect(&thick_left, &thin_left, &poly[5]); + + XRenderCompositeDoublePoly(dpy, op, + src, dst, maskFormat, + 0, 0, 0, 0, + poly, 6, 0); + + poly[0] = thin_right.p1; + poly[1] = gap_right.p1; + intersect(&thick_left, &gap_right, &poly[2]); + poly[3] = thick_left.p2; + poly[4] = thick_right.p2; + intersect(&thick_right, &thin_right, &poly[5]); + + XRenderCompositeDoublePoly(dpy, op, + src, dst, maskFormat, + 0, 0, 0, 0, + poly, 6, 0); +} + +static double +compute_inverse_slope (XLineDouble *l) +{ + return ((l->p2.x - l->p1.x) / + (l->p2.y - l->p1.y)); +} + +static double +compute_x_intercept(XLineDouble *l, double inverse_slope) +{ + return (l->p1.x) - inverse_slope * l->p1.y; +} + +static void +intersect(XLineDouble *l1, XLineDouble *l2, XPointDouble *intersection) +{ + double check; + /* + * x = m1y + b1 + * x = m2y + b2 + * m1y + b1 = m2y + b2 + * y * (m1 - m2) = b2 - b1 + * y = (b2 - b1) / (m1 - m2) + */ + double m1 = compute_inverse_slope (l1); + double b1 = compute_x_intercept (l1, m1); + double m2 = compute_inverse_slope (l2); + double b2 = compute_x_intercept (l2, m2); + + intersection->y = (b2 - b1) / (m1 - m2); + intersection->x = m1 * intersection->y + b1; + + check = m2 * intersection->y + b2; + if (fabs(check - intersection->x) > (1/(double)(1<<16))) { +#ifdef __GNUC__ + fprintf(stderr, "%s: intersection is off by: %f\n", __FUNCTION__, fabs(check - intersection->x)); +#else + fprintf(stderr, "intersect: intersection is off by %f\n", fabs(check - instersection->x)); +#endif + } +} + Index: xc/programs/xlogo/RenderLogo.h diff -u /dev/null xc/programs/xlogo/RenderLogo.h:1.2 --- /dev/null Thu Feb 27 12:35:45 2003 +++ xc/programs/xlogo/RenderLogo.h Sun Jun 30 22:26:04 2002 @@ -0,0 +1,38 @@ +/* $Xorg: Logo.h,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ +/* + +Copyright 1988, 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/programs/xlogo/RenderLogo.h,v 1.2 2002/07/01 02:26:04 tsi Exp $ */ + +#ifndef _RenderLogo_h +#define _RenderLogo_h + +void +RenderLogo(Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat *maskFormat, + int x, int y, unsigned int width, unsigned int height); + +#endif /* _RenderLogo_h */ Index: xc/programs/xlogo/xlogo.c diff -u xc/programs/xlogo/xlogo.c:3.8 xc/programs/xlogo/xlogo.c:3.9 --- xc/programs/xlogo/xlogo.c:3.8 Fri Dec 14 15:02:07 2001 +++ xc/programs/xlogo/xlogo.c Thu May 23 19:53:59 2002 @@ -25,7 +25,7 @@ * */ -/* $XFree86: xc/programs/xlogo/xlogo.c,v 3.8 2001/12/14 20:02:07 dawes Exp $ */ +/* $XFree86: xc/programs/xlogo/xlogo.c,v 3.9 2002/05/23 23:53:59 keithp Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> @@ -42,6 +42,10 @@ static XrmOptionDescRec options[] = { { "-shape", "*shapeWindow", XrmoptionNoArg, (XPointer) "on" }, +#ifdef XRENDER +{"-render", "*render",XrmoptionNoArg, "TRUE"}, +{"-sharp", "*sharp", XrmoptionNoArg, "TRUE"}, +#endif }; static XtActionsRec actions[] = { @@ -78,15 +82,20 @@ { Arg arg; SmcConn connection; - String reasons[6]; - int i, num_reasons = 6; + String reasons[7]; + int i, num_reasons = 7; reasons[0] = "Usage: "; reasons[1] = call; reasons[2] = " [-fg <color>] [-bg <color>] [-rv] [-bw <pixels>] [-bd <color>]\n"; reasons[3] = " [-d [<host>]:[<vs>]]\n"; reasons[4] = " [-g [<width>][x<height>][<+-><xoff>[<+-><yoff>]]]\n"; - reasons[5] = " [-shape]\n\n"; +#ifdef XRENDER + reasons[5] = " [-render] [-sharp]\n"; +#else + reasons[5] = ""; +#endif + reasons[6] = " [-shape]\n\n"; XtSetArg(arg, XtNconnection, &connection); XtGetValues(toplevel, &arg, (Cardinal)1); Index: xc/programs/xlogo/xlogo.man diff -u xc/programs/xlogo/xlogo.man:1.8 xc/programs/xlogo/xlogo.man:1.10 --- xc/programs/xlogo/xlogo.man:1.8 Fri Dec 14 15:02:07 2001 +++ xc/programs/xlogo/xlogo.man Sat Oct 12 12:06:48 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xlogo/xlogo.man,v 1.8 2001/12/14 20:02:07 dawes Exp $ +.\" $XFree86: xc/programs/xlogo/xlogo.man,v 1.10 2002/10/12 16:06:48 herrb Exp $ .\" .TH XLOGO 1 __xorgversion__ .SH NAME @@ -38,6 +38,12 @@ accepts all of the standard X Toolkit command line options, as well as the following: .TP 8 +.B \-render +This option indicates that the logo should be drawn with anti-aliased edges using the RENDER extension. +.TP 8 +.B \-shape +If -render is also specified, this forces the edges to be rendered in sharp mode, (ie. 1-bit alpha channel). +.TP 8 .B \-shape This option indicates that the logo window should be shaped rather than rectangular. @@ -76,7 +82,9 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -<XRoot>/lib/X11/app-defaults/XLogo - specifies required resources +.TP +.I __apploaddir__/XLogo +specifies required resources .SH SEE ALSO X(__miscmansuffix__), xrdb(1) .SH AUTHORS Index: xc/programs/xlsfonts/dsimple.h diff -u xc/programs/xlsfonts/dsimple.h:1.7 xc/programs/xlsfonts/dsimple.h:1.8 --- xc/programs/xlsfonts/dsimple.h:1.7 Fri Dec 14 15:02:10 2001 +++ xc/programs/xlsfonts/dsimple.h Tue Dec 24 12:43:01 2002 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xlsfonts/dsimple.h,v 1.7 2001/12/14 20:02:10 dawes Exp $ */ +/* $XFree86: xc/programs/xlsfonts/dsimple.h,v 1.8 2002/12/24 17:43:01 tsi Exp $ */ /* * Just_display.h: This file contains the definitions needed to use the @@ -100,7 +100,7 @@ void blip(); Window Window_With_Name(); #endif -#if __GNUC__ +#ifdef __GNUC__ void Fatal_Error(char *, ...) __attribute__((__noreturn__)); #else void Fatal_Error(char *, ...); Index: xc/programs/xmag/Xmag.ad diff -u xc/programs/xmag/Xmag.ad:1.1.1.2 xc/programs/xmag/Xmag.ad:1.2 --- xc/programs/xmag/Xmag.ad:1.1.1.2 Tue Jan 16 18:01:44 2001 +++ xc/programs/xmag/Xmag.ad Sat Jan 18 23:44:45 2003 @@ -1,4 +1,5 @@ -.\ "$Xorg: Xmag.ad,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ +! $Xorg: Xmag.ad,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ +! $XFree86: xc/programs/xmag/Xmag.ad,v 1.2 2003/01/19 04:44:45 paulo Exp $ *Font: fixed *pane2*orientation: horizontal *pane2*showGrip: False @@ -22,6 +23,5 @@ <Key>space:set()notify()unset()\n\ <Btn2Up>:set()notify()unset()\n\ <Btn3Up>:set()notify()unset() -*pixLabel.Translations:<Enter>:popdown-pixel() *helpLabel.font: 8x13bold *helpLabel.label: xmag Index: xc/programs/xmag/xmag.c diff -u xc/programs/xmag/xmag.c:1.10 xc/programs/xmag/xmag.c:1.11 --- xc/programs/xmag/xmag.c:1.10 Fri Dec 14 15:02:11 2001 +++ xc/programs/xmag/xmag.c Sat Jan 18 23:44:45 2003 @@ -26,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/xmag.c,v 1.10 2001/12/14 20:02:11 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/xmag.c,v 1.11 2003/01/19 04:44:45 paulo Exp $ */ #include <stdlib.h> /* for exit() and abs() */ @@ -403,17 +403,12 @@ { int n; Arg wargs[3]; - hlPtr data; + hlPtr data = NULL; n = 0; XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); -/* - * When the mouse button is released inside the popup window, this - * function is called twice, presumably once for the main window and - * once for the popup window. In the latter case, data turns out to - * be a null pointer. This probably isn't the best fix, but it works. - */ + if (data) XtPopdown(data->pixShell); } Index: xc/programs/xman/Imakefile diff -u xc/programs/xman/Imakefile:1.5 xc/programs/xman/Imakefile:1.8 --- xc/programs/xman/Imakefile:1.5 Thu Nov 1 18:35:35 2001 +++ xc/programs/xman/Imakefile Fri Sep 20 22:38:25 2002 @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile,v 1.22 91/09/09 16:02:18 rws Exp $ -XCOMM $XFree86: xc/programs/xman/Imakefile,v 1.5 2001/11/01 23:35:35 dawes Exp $ +XCOMM $XFree86: xc/programs/xman/Imakefile,v 1.8 2002/09/21 02:38:25 dawes Exp $ #ifdef XmanSearchPath XMANSYSPATH = XmanSearchPath @@ -17,14 +17,24 @@ XCOMM select internal format of manpath configuration file #if defined(FreeBSDArchitecture) || \ - (defined(LinuxDistribution) && (LinuxDistribution == LinuxDebian)) -MANCONFIGSTYLE = -DMANCONFIGSTYLE_FreeBSD + (defined(LinuxDistribution) && (LinuxDistribution == LinuxDebian)) || \ + (defined(DarwinArchitecture) && (OSMajorVersion >= 6)) + MANCONFIGSTYLE = -DMANCONFIGSTYLE_FreeBSD + MANCONF = -DMANCONF=\"/etc/manpath.config\" #elif defined(LinuxArchitecture) -MANCONFIGSTYLE = -DMANCONFIGSTYLE_Linux -#elif defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) -MANCONFIGSTYLE = -DMANCONFIGSTYLE_OpenBSD + MANCONFIGSTYLE = -DMANCONFIGSTYLE_Linux +# if defined(LinuxDistribution) && (LinuxDistribution == LinuxRedHat) + MANCONF = -DMANCONF=\"/etc/man.config\" +# else + MANCONF = -DMANCONF=\"/etc/man.conf\" +# endif +#elif defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || \ + defined(DarwinArchitecture) + MANCONFIGSTYLE = -DMANCONFIGSTYLE_OpenBSD + MANCONF = -DMANCONF=\"/etc/man.conf\" #elif defined(BSDArchitecture) -MANCONFIGSTYLE = -DMANCONFIGSTYLE_BSD + MANCONFIGSTYLE = -DMANCONFIGSTYLE_BSD + MANCONF = -DMANCONF=\"/etc/man.conf\" #endif #if HasGroff @@ -42,7 +52,7 @@ DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) \ $(SNPDEFINES) $(HELPFILE) $(MANPATHS) $(MKSTEMP) $(GROFF) \ - $(MANCONFIGSTYLE) + $(MANCONFIGSTYLE) $(MANCONF) INCLUDES = -I$(SNPINCLUDES) DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs Index: xc/programs/xman/buttons.c diff -u xc/programs/xman/buttons.c:1.3 xc/programs/xman/buttons.c:1.4 --- xc/programs/xman/buttons.c:1.3 Fri Mar 3 18:16:26 2000 +++ xc/programs/xman/buttons.c Sat Jan 18 23:44:45 2003 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/buttons.c,v 1.3 2000/03/03 23:16:26 dawes Exp $ */ +/* $XFree86: xc/programs/xman/buttons.c,v 1.4 2003/01/19 04:44:45 paulo Exp $ */ /* * xman - X window system manual page display program. @@ -123,6 +123,7 @@ man_globals = (ManpageGlobals*) XtMalloc( (Cardinal) sizeof(ManpageGlobals)); man_globals->label = NULL; + man_globals->search_widget = NULL; man_globals->manpagewidgets.directory = NULL; man_globals->manpagewidgets.manpage = NULL; man_globals->manpagewidgets.box = NULL; @@ -186,6 +187,7 @@ man_globals = (ManpageGlobals *) XtMalloc( (Cardinal) sizeof(ManpageGlobals)); + man_globals->search_widget = NULL; man_globals->section_name = (char **) XtMalloc( (Cardinal) (sections * sizeof(char *))); man_globals->manpagewidgets.box = (Widget *) XtCalloc( (Cardinal) sections, Index: xc/programs/xman/handler.c diff -u xc/programs/xman/handler.c:1.5 xc/programs/xman/handler.c:1.6 --- xc/programs/xman/handler.c:1.5 Tue Jun 13 19:15:53 2000 +++ xc/programs/xman/handler.c Sat Jan 18 23:44:45 2003 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/handler.c,v 1.5 2000/06/13 23:15:53 dawes Exp $ */ +/* $XFree86: xc/programs/xman/handler.c,v 1.6 2003/01/19 04:44:45 paulo Exp $ */ /* * xman - X window system manual page display program. @@ -463,11 +463,14 @@ PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals * man_globals = GetGlobals(w); - if (!XtIsRealized(man_globals->search_widget)) { - XtRealizeWidget(man_globals->search_widget); - AddCursor(man_globals->search_widget, resources.cursors.search_entry); + + if (man_globals->search_widget) { + if (!XtIsRealized(man_globals->search_widget)) { + XtRealizeWidget(man_globals->search_widget); + AddCursor(man_globals->search_widget, resources.cursors.search_entry); + } + Popup(man_globals->search_widget, XtGrabNone); } - Popup(man_globals->search_widget, XtGrabNone); } /* Function Name: CreateNewManpage Index: xc/programs/xman/man.c diff -u xc/programs/xman/man.c:1.6 xc/programs/xman/man.c:1.7 --- xc/programs/xman/man.c:1.6 Thu Nov 1 18:35:35 2001 +++ xc/programs/xman/man.c Sun Aug 4 21:47:34 2002 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/man.c,v 1.6 2001/11/01 23:35:35 dawes Exp $ */ +/* $XFree86: xc/programs/xman/man.c,v 1.7 2002/08/05 01:47:34 torrey Exp $ */ #include "globals.h" @@ -1088,7 +1088,7 @@ continue; } memset(&gs, 0, sizeof(glob_t)); - while (path = strtok((char *)NULL, " \t\n")) { + while ((path = strtok((char *)NULL, " \t\n"))) { if (glob(path, GLOB_BRACE, NULL, &gs) < 0) { return FALSE; } @@ -1136,7 +1136,7 @@ path = strtok(line, " \t\n"); if (!path || *path == '#' || strcmp(path, "_default")) continue; - while (path = strtok((char *)NULL, " \t\n")) { + while ((path = strtok((char *)NULL, " \t\n"))) { if (firstpath) { strcpy(manpath, path); firstpath = FALSE; Index: xc/programs/xman/vendor.h diff -u xc/programs/xman/vendor.h:1.9 xc/programs/xman/vendor.h:1.11 --- xc/programs/xman/vendor.h:1.9 Sat Nov 3 19:13:48 2001 +++ xc/programs/xman/vendor.h Fri Sep 20 22:38:25 2002 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/vendor.h,v 1.9 2001/11/04 00:13:48 dawes Exp $ */ +/* $XFree86: xc/programs/xman/vendor.h,v 1.11 2002/09/21 02:38:25 dawes Exp $ */ /* Vendor-specific definitions */ @@ -59,12 +59,6 @@ # define SEARCHOTHER CAT #endif -#if defined(MANCONFIGSTYLE_FreeBSD) -# define MANCONF "/etc/manpath.config" -#elif defined(MANCONFIGSTYLE_Linux) || defined(MANCONFIGSTYLE_OpenBSD) || defined(MANCONFIGSTYLE_BSD) -# define MANCONF "/etc/man.conf" -#endif - /* * The default manual page directory. * @@ -77,7 +71,7 @@ # define SYSMANPATH "/usr/catman/u_man:/usr/catman/a_man" #elif defined(__bsdi__) # define SYSMANPATH "/usr/share/man:/usr/contrib/man:/usr/contrib/isode/man:/usr/local/man" -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__DARWIN__) # define SYSMANPATH "/usr/share/man:/usr/local/man:/usr/X11R6/man" #elif defined(SVR4) || defined(__osf__) || (defined(BSD) && (BSD >= 199103)) # define SYSMANPATH "/usr/share/man" Index: xc/programs/xman/xman.man diff -u xc/programs/xman/xman.man:1.3 xc/programs/xman/xman.man:1.4 --- xc/programs/xman/xman.man:1.3 Sat Jan 27 13:21:18 2001 +++ xc/programs/xman/xman.man Sat Oct 12 12:06:48 2002 @@ -1,6 +1,6 @@ .\" $XConsortium: xman.man,v 1.23 94/04/17 20:44:02 matt Exp $ .\" -.\" $XFree86: xc/programs/xman/xman.man,v 1.3 2001/01/27 18:21:18 dawes Exp $ +.\" $XFree86: xc/programs/xman/xman.man,v 1.4 2002/10/12 16:06:48 herrb Exp $ .\" .TH XMAN 1 __xorgversion__ .SH NAME @@ -347,11 +347,10 @@ of xman. .SH FILES .IP "\fI<manpath directory>\fP/man<\fIcharacter\fP>" 2.5i -.IP "\fI<manpath directory>\fP/cat<\fIcharacter\fP>" -.IP "\fI<manpath directory>\fP/mandesc" -.IP <XRoot>/lib/X11/app-defaults/Xman -specifies required resources. <XRoot> refers to the root of the X11 install -tree. +.IP "\fI<manpath directory>\fP/cat<\fIcharacter\fP>" +.IP "\fI<manpath directory>\fP/mandesc" +.IP __apploaddir__/Xman +specifies required resources. .IP /tmp .I Xman creates temporary files in /tmp for all unformatted man pages and all apropos Index: xc/programs/xmessage/Imakefile diff -u xc/programs/xmessage/Imakefile:1.1 xc/programs/xmessage/Imakefile:1.2 --- xc/programs/xmessage/Imakefile:1.1 Sat Feb 12 22:26:33 2000 +++ xc/programs/xmessage/Imakefile Mon Oct 14 22:26:12 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xmessage/Imakefile,v 1.1 2000/02/13 03:26:33 dawes Exp $ +XCOMM $XFree86: xc/programs/xmessage/Imakefile,v 1.2 2002/10/15 02:26:12 dawes Exp $ @@ -17,3 +17,4 @@ ComplexProgramTarget(xmessage) InstallAppDefaults(Xmessage) +InstallAppDefaults(Xmessage-color) Index: xc/programs/xmessage/Xmessage-color.ad diff -u /dev/null xc/programs/xmessage/Xmessage-color.ad:1.1 --- /dev/null Thu Feb 27 12:35:51 2003 +++ xc/programs/xmessage/Xmessage-color.ad Mon Oct 14 22:26:12 2002 @@ -0,0 +1,44 @@ +! $XFree86: xc/programs/xmessage/Xmessage-color.ad,v 1.1 2002/10/15 02:26:12 dawes Exp $ + +#include "Xmessage" + +*background: gray85 +*foreground: gray15 + +*Scrollbar.thumb: vlines2 +*Scrollbar.width: 14 +*Scrollbar.foreground: rgb:a/5/5 +*Scrollbar.borderWidth: 0 +*Scrollbar.displayList:\ +foreground gray90;\ +lines 1,-1,-1,-1,-1,1;\ +foreground gray60;\ +lines -1,0,0,0,0,-1 + +*Text.?.cursorColor: rgb:d/5/5 +*Text.borderColor: gray80 +*Text*background: gray96 +*Text*Scrollbar.background: gray80 +*Text.displayList:\ +foreground gray90;\ +lines 1,-1,-1,-1,-1,1;\ +foreground gray60;\ +lines -1,0,0,0,0,-1 + +*Command.highlightThickness: 2 +*Command.internalWidth: 5 +*Command.internalHeight: 3 +*Command.borderColor: gray40 +*Command.shapeStyle: Rectangle +*Command.background: gray80 +*Command.displayList:\ +foreground gray60;\ +lines 1,-1,-1,-1,-1,1;\ +foreground gray90;\ +lines -1,0,0,0,0,-1 + +*Form.displayList:\ +foreground gray60;\ +lines 1,-1,-1,-1,-1,1;\ +foreground gray90;\ +lines -1,0,0,0,0,-1 Index: xc/programs/xmessage/Xmessage.ad diff -u xc/programs/xmessage/Xmessage.ad:1.1 xc/programs/xmessage/Xmessage.ad:1.2 --- xc/programs/xmessage/Xmessage.ad:1.1 Sat Feb 12 22:26:33 2000 +++ xc/programs/xmessage/Xmessage.ad Mon Oct 14 22:26:12 2002 @@ -1,5 +1,6 @@ ! $XConsortium: Xmessage.ad,v 1.3 94/07/26 20:23:17 gildea Exp $ *baseTranslations: #override :<Key>Return: default-exit() -*message.Scroll: whenNeeded +*message.scrollVertical: Always +*message.scrollHorizontal: Never *Command.shapeStyle: oval *Command.highlightThickness: 1 Index: xc/programs/xmessage/makeform.c diff -u xc/programs/xmessage/makeform.c:1.5 xc/programs/xmessage/makeform.c:1.6 --- xc/programs/xmessage/makeform.c:1.5 Fri Oct 20 10:59:09 2000 +++ xc/programs/xmessage/makeform.c Thu Nov 21 22:56:39 2002 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xmessage/makeform.c,v 1.5 2000/10/20 14:59:09 alanh Exp $ */ +/* $XFree86: xc/programs/xmessage/makeform.c,v 1.6 2002/11/22 03:56:39 paulo Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -243,7 +243,6 @@ XtNtop, XtChainTop, XtNbottom, XtChainBottom, XtNdisplayCaret, False, - XtNuseStringInPlace, True, XtNlength, msglen, XtNstring, msgstr, NULL); Index: xc/programs/xmh/actions.h diff -u xc/programs/xmh/actions.h:1.1.1.1 xc/programs/xmh/actions.h:1.3 --- xc/programs/xmh/actions.h:1.1.1.1 Wed Apr 27 03:12:55 1994 +++ xc/programs/xmh/actions.h Sun Jun 30 22:26:05 2002 @@ -25,75 +25,78 @@ in this Software without prior written authorization from the X Consortium. * */ +/* $XFree86: xc/programs/xmh/actions.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ +#define XMH_ACTION_ARGS Widget, XEvent *, String *, Cardinal * + /* from compfuncs.c */ -extern void XmhResetCompose(); -extern void XmhSend(); -extern void XmhSave(); +extern void XmhResetCompose (XMH_ACTION_ARGS); +extern void XmhSend (XMH_ACTION_ARGS); +extern void XmhSave (XMH_ACTION_ARGS); /* from folder.c */ -extern void XmhClose(); -extern void XmhComposeMessage(); -extern void XmhOpenFolder(); -extern void XmhOpenFolderInNewWindow(); -extern void XmhCreateFolder(); -extern void XmhDeleteFolder(); -extern void XmhPopupFolderMenu(); -extern void XmhSetCurrentFolder(); -extern void XmhLeaveFolderButton(); -extern void XmhPushFolder(); -extern void XmhPopFolder(); -extern void XmhWMProtocols(); +extern void XmhClose (XMH_ACTION_ARGS); +extern void XmhComposeMessage (XMH_ACTION_ARGS); +extern void XmhOpenFolder (XMH_ACTION_ARGS); +extern void XmhOpenFolderInNewWindow (XMH_ACTION_ARGS); +extern void XmhCreateFolder (XMH_ACTION_ARGS); +extern void XmhDeleteFolder (XMH_ACTION_ARGS); +extern void XmhPopupFolderMenu (XMH_ACTION_ARGS); +extern void XmhSetCurrentFolder (XMH_ACTION_ARGS); +extern void XmhLeaveFolderButton (XMH_ACTION_ARGS); +extern void XmhPushFolder (XMH_ACTION_ARGS); +extern void XmhPopFolder (XMH_ACTION_ARGS); +extern void XmhWMProtocols (XMH_ACTION_ARGS); /* from msg.c */ -extern void XmhInsert(); +extern void XmhInsert (XMH_ACTION_ARGS); /* from popup.c */ -extern void XmhPromptOkayAction(); +extern void XmhPromptOkayAction (XMH_ACTION_ARGS); /* from toc.c */ -extern void XmhPushSequence(); -extern void XmhPopSequence(); -extern void XmhReloadSeqLists(); +extern void XmhPushSequence (XMH_ACTION_ARGS); +extern void XmhPopSequence (XMH_ACTION_ARGS); +extern void XmhReloadSeqLists (XMH_ACTION_ARGS); /* from tocfuncs.c */ -extern void XmhCheckForNewMail(); -extern void XmhIncorporateNewMail(); -extern void XmhCommitChanges(); -extern void XmhPackFolder(); -extern void XmhSortFolder(); -extern void XmhForceRescan(); -extern void XmhViewNextMessage(); -extern void XmhViewPreviousMessage(); -extern void XmhMarkDelete(); -extern void XmhMarkMove(); -extern void XmhMarkCopy(); -extern void XmhUnmark(); -extern void XmhViewInNewWindow(); -extern void XmhReply(); -extern void XmhForward(); -extern void XmhUseAsComposition(); -extern void XmhPrint(); -extern void XmhShellCommand(); -extern void XmhPickMessages(); -extern void XmhOpenSequence(); -extern void XmhAddToSequence(); -extern void XmhRemoveFromSequence(); -extern void XmhDeleteSequence(); +extern void XmhCheckForNewMail (XMH_ACTION_ARGS); +extern void XmhIncorporateNewMail (XMH_ACTION_ARGS); +extern void XmhCommitChanges (XMH_ACTION_ARGS); +extern void XmhPackFolder (XMH_ACTION_ARGS); +extern void XmhSortFolder (XMH_ACTION_ARGS); +extern void XmhForceRescan (XMH_ACTION_ARGS); +extern void XmhViewNextMessage (XMH_ACTION_ARGS); +extern void XmhViewPreviousMessage (XMH_ACTION_ARGS); +extern void XmhMarkDelete (XMH_ACTION_ARGS); +extern void XmhMarkMove (XMH_ACTION_ARGS); +extern void XmhMarkCopy (XMH_ACTION_ARGS); +extern void XmhUnmark (XMH_ACTION_ARGS); +extern void XmhViewInNewWindow (XMH_ACTION_ARGS); +extern void XmhReply (XMH_ACTION_ARGS); +extern void XmhForward (XMH_ACTION_ARGS); +extern void XmhUseAsComposition (XMH_ACTION_ARGS); +extern void XmhPrint (XMH_ACTION_ARGS); +extern void XmhShellCommand (XMH_ACTION_ARGS); +extern void XmhPickMessages (XMH_ACTION_ARGS); +extern void XmhOpenSequence (XMH_ACTION_ARGS); +extern void XmhAddToSequence (XMH_ACTION_ARGS); +extern void XmhRemoveFromSequence (XMH_ACTION_ARGS); +extern void XmhDeleteSequence (XMH_ACTION_ARGS); /* from viewfuncs.c */ -extern void XmhCloseView(); -extern void XmhViewReply(); -extern void XmhViewForward(); -extern void XmhViewUseAsComposition(); -extern void XmhEditView(); -extern void XmhSaveView(); -extern void XmhPrintView(); -extern void XmhViewMarkDelete(); +extern void XmhCloseView (XMH_ACTION_ARGS); +extern void XmhViewReply (XMH_ACTION_ARGS); +extern void XmhViewForward (XMH_ACTION_ARGS); +extern void XmhViewUseAsComposition (XMH_ACTION_ARGS); +extern void XmhEditView (XMH_ACTION_ARGS); +extern void XmhSaveView (XMH_ACTION_ARGS); +extern void XmhPrintView (XMH_ACTION_ARGS); +extern void XmhViewMarkDelete (XMH_ACTION_ARGS); Index: xc/programs/xmh/bbox.c diff -u xc/programs/xmh/bbox.c:1.2 xc/programs/xmh/bbox.c:1.3 --- xc/programs/xmh/bbox.c:1.2 Sat Oct 27 23:34:38 2001 +++ xc/programs/xmh/bbox.c Fri Apr 5 16:06:28 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/bbox.c,v 1.2 2001/10/28 03:34:38 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/bbox.c,v 1.3 2002/04/05 21:06:28 dickey Exp $ */ /* bbox.c -- management of buttons and buttonboxes. * @@ -38,7 +38,7 @@ static XtTranslations RadioButtonTranslations = NULL; -void BBoxInit() +void BBoxInit(void) { RadioButtonTranslations = XtParseTranslationTable("<Btn1Down>,<Btn1Up>:set()\n"); @@ -50,9 +50,9 @@ * scrn's widget, and it will be added to the scrn's pane. */ -ButtonBox BBoxCreate(scrn, name) - Scrn scrn; - char *name; /* name of the buttonbox widgets */ +ButtonBox BBoxCreate( + Scrn scrn, + char *name) /* name of the buttonbox widgets */ { Cardinal n; ButtonBox buttonbox = XtNew(ButtonBoxRec); @@ -75,9 +75,9 @@ } -ButtonBox RadioBBoxCreate(scrn, name) - Scrn scrn; - char *name; /* name of the buttonbox widgets */ +ButtonBox RadioBBoxCreate( + Scrn scrn, + char *name) /* name of the buttonbox widgets */ { return BBoxCreate(scrn, name); } @@ -85,13 +85,12 @@ /* Create a new button, and add it to a buttonbox. */ -static void bboxAddButton(buttonbox, name, kind, enabled, radio) - - ButtonBox buttonbox; - char *name; - WidgetClass kind; - Boolean enabled; - Boolean radio; +static void bboxAddButton( + ButtonBox buttonbox, + char *name, + WidgetClass kind, + Boolean enabled, + Boolean radio) { Button button; Cardinal i; @@ -136,20 +135,20 @@ } -void BBoxAddButton(buttonbox, name, kind, enabled) - ButtonBox buttonbox; - char *name; - WidgetClass kind; - Boolean enabled; +void BBoxAddButton( + ButtonBox buttonbox, + char *name, + WidgetClass kind, + Boolean enabled) { bboxAddButton(buttonbox, name, kind, enabled, False); } -void RadioBBoxAddButton(buttonbox, name, enabled) - ButtonBox buttonbox; - char *name; - Boolean enabled; +void RadioBBoxAddButton( + ButtonBox buttonbox, + char *name, + Boolean enabled) { bboxAddButton(buttonbox, name, toggleWidgetClass, enabled, True); } @@ -157,8 +156,8 @@ /* Set the current button in a radio buttonbox. */ -void RadioBBoxSet(button) - Button button; +void RadioBBoxSet( + Button button) { XawToggleSetCurrent(button->widget, button->name); } @@ -166,8 +165,8 @@ /* Get the name of the current button in a radio buttonbox. */ -char *RadioBBoxGetCurrent(buttonbox) - ButtonBox buttonbox; +char *RadioBBoxGetCurrent( + ButtonBox buttonbox) { return ((char *) XawToggleGetCurrent(buttonbox->button[0]->widget)); } @@ -179,8 +178,8 @@ * button in the box. */ -void BBoxDeleteButton(button) - Button button; +void BBoxDeleteButton( + Button button) { ButtonBox buttonbox; int i, found; @@ -209,8 +208,8 @@ } -void RadioBBoxDeleteButton(button) - Button button; +void RadioBBoxDeleteButton( + Button button) { ButtonBox buttonbox; Boolean reradio = False; @@ -229,9 +228,9 @@ /* Enable or disable the given button widget. */ -static void SendEnableMsg(widget, value) - Widget widget; - int value; /* TRUE for enable, FALSE for disable. */ +static void SendEnableMsg( + Widget widget, + int value) /* TRUE for enable, FALSE for disable. */ { static Arg arglist[] = {{XtNsensitive, (XtArgVal)False}}; arglist[0].value = (XtArgVal) value; @@ -241,8 +240,8 @@ /* Enable the given button (if it's not already). */ -void BBoxEnable(button) -Button button; +void BBoxEnable( + Button button) { SendEnableMsg(button->widget, True); } @@ -250,8 +249,8 @@ /* Disable the given button (if it's not already). */ -void BBoxDisable(button) - Button button; +void BBoxDisable( + Button button) { SendEnableMsg(button->widget, False); } @@ -260,9 +259,9 @@ /* Given a buttonbox and a button name, find the button in the box with that name. */ -Button BBoxFindButtonNamed(buttonbox, name) - ButtonBox buttonbox; - char *name; +Button BBoxFindButtonNamed( + ButtonBox buttonbox, + char *name) { register int i; for (i=0 ; i<buttonbox->numbuttons; i++) @@ -274,9 +273,9 @@ /* Given a buttonbox and a widget, find the button which is that widget. */ -Button BBoxFindButton(buttonbox, w) - ButtonBox buttonbox; - Widget w; +Button BBoxFindButton( + ButtonBox buttonbox, + Widget w) { register int i; for (i=0; i < buttonbox->numbuttons; i++) @@ -288,9 +287,9 @@ /* Return the nth button in the given buttonbox. */ -Button BBoxButtonNumber(buttonbox, n) - ButtonBox buttonbox; - int n; +Button BBoxButtonNumber( + ButtonBox buttonbox, + int n) { return buttonbox->button[n]; } @@ -298,8 +297,8 @@ /* Return how many buttons are in a buttonbox. */ -int BBoxNumButtons(buttonbox) - ButtonBox buttonbox; +int BBoxNumButtons( + ButtonBox buttonbox) { return buttonbox->numbuttons; } @@ -307,8 +306,8 @@ /* Given a button, return its name. */ -char *BBoxNameOfButton(button) - Button button; +char *BBoxNameOfButton( + Button button) { return button->name; } @@ -316,8 +315,8 @@ /* Given a button, return its menu. */ -Widget BBoxMenuOfButton(button) - Button button; +Widget BBoxMenuOfButton( + Button button) { return button->menu; } @@ -328,8 +327,8 @@ * Allow the user to set the minimum size. */ -void BBoxLockSize(buttonbox) - ButtonBox buttonbox; +void BBoxLockSize( + ButtonBox buttonbox) { Dimension maxheight; Arg args[1]; @@ -341,18 +340,18 @@ } -Boolean BBoxIsGrandparent(buttonbox, widget) - ButtonBox buttonbox; - Widget widget; +Boolean BBoxIsGrandparent( + ButtonBox buttonbox, + Widget widget) { return (XtParent(XtParent(widget)) == buttonbox->inner); } -void BBoxMailFlag(buttonbox, name, up) - ButtonBox buttonbox; - char* name; - int up; +void BBoxMailFlag( + ButtonBox buttonbox, + char* name, + int up) { Arg args[1]; Pixel flag; Index: xc/programs/xmh/bbox.h diff -u xc/programs/xmh/bbox.h:1.1.1.1 xc/programs/xmh/bbox.h:1.3 --- xc/programs/xmh/bbox.h:1.1.1.1 Wed Apr 27 03:12:52 1994 +++ xc/programs/xmh/bbox.h Sun Jun 30 22:26:05 2002 @@ -23,40 +23,41 @@ * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/bbox.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _bbox_h #define _bbox_h /* for radio button boxes only */ -extern ButtonBox RadioBBoxCreate (/* Scrn, char * */); -extern void RadioBBoxAddButton (/* ButtonBox, char *, Boolean */); -extern void RadioBBoxSet (/* Button */); -extern char * RadioBBoxGetCurrent (/* ButtonBox */); -extern void RadioBBoxDeleteButton(/* Button */); +extern ButtonBox RadioBBoxCreate (Scrn, char *); +extern void RadioBBoxAddButton (ButtonBox, char *, Boolean); +extern void RadioBBoxSet (Button); +extern char * RadioBBoxGetCurrent (ButtonBox); +extern void RadioBBoxDeleteButton(Button); /* for other kinds of button boxes */ -extern ButtonBox BBoxCreate (/* Scrn, char * */); -extern void BBoxAddButton (/* ButtonBox, char *, WidgetClass, Boolean */); -extern void BBoxDeleteButton (/* Button */); +extern ButtonBox BBoxCreate (Scrn, char *); +extern void BBoxAddButton (ButtonBox, char *, WidgetClass, Boolean); +extern void BBoxDeleteButton (Button); /* for all kinds of button boxes */ -extern void BBoxInit (/* void */); -extern void BBoxEnable (/* Button */); -extern void BBoxDisable (/* Button */); -extern Button BBoxFindButtonNamed (/* ButtonBox, char * */); -extern Button BBoxFindButton (/* ButtonBox, Widget */); -extern Button BBoxButtonNumber (/* ButtonBox, int */); -extern int BBoxNumButtons (/* ButtonBox */); -extern char * BBoxNameOfButton (/* Button */); -extern Widget BBoxMenuOfButton (/* Button */); -extern void BBoxLockSize (/* ButtonBox */); -extern Boolean BBoxIsGrandparent (/* ButtonBox, Widget */); +extern void BBoxInit (void); +extern void BBoxEnable (Button); +extern void BBoxDisable (Button); +extern Button BBoxFindButtonNamed (ButtonBox, char *); +extern Button BBoxFindButton (ButtonBox, Widget); +extern Button BBoxButtonNumber (ButtonBox, int); +extern int BBoxNumButtons (ButtonBox); +extern char * BBoxNameOfButton (Button); +extern Widget BBoxMenuOfButton (Button); +extern void BBoxLockSize (ButtonBox); +extern Boolean BBoxIsGrandparent (ButtonBox, Widget); /* operations upon folder buttons */ -extern void BBoxMailFlag (/* ButtonBox, char*, int */); +extern void BBoxMailFlag (ButtonBox, char*, int); #endif /* _bbox_h */ Index: xc/programs/xmh/command.c diff -u xc/programs/xmh/command.c:3.8 xc/programs/xmh/command.c:3.9 --- xc/programs/xmh/command.c:3.8 Sun Dec 9 10:48:36 2001 +++ xc/programs/xmh/command.c Fri Apr 5 16:06:28 2002 @@ -1,5 +1,5 @@ /* $XConsortium: command.c,v 2.49 95/04/05 19:59:06 kaleb Exp $ */ -/* $XFree86: xc/programs/xmh/command.c,v 3.8 2001/12/09 15:48:36 herrb Exp $ */ +/* $XFree86: xc/programs/xmh/command.c,v 3.9 2002/04/05 21:06:28 dickey Exp $ */ /* * COPYRIGHT 1987, 1989 @@ -66,11 +66,10 @@ } CommandStatusRec, *CommandStatus; typedef char* Pointer; -static void FreeStatus(); -static void CheckReadFromPipe(); +static void FreeStatus(XMH_CB_ARGS); +static void CheckReadFromPipe(int, char **, int *, Bool); -static void SystemError(text) - char* text; +static void SystemError(char* text) { char msg[BUFSIZ]; sprintf( msg, "%s; errno = %d %s", text, errno, @@ -81,8 +80,7 @@ /* Return the full path name of the given mh command. */ -static char *FullPathOfCommand(str) - char *str; +static char *FullPathOfCommand(char *str) { static char result[100]; (void) sprintf(result, "%s/%s", app_resources.mh_path, str); @@ -91,10 +89,10 @@ /*ARGSUSED*/ -static void ReadStdout(closure, fd, id) - XtPointer closure; - int *fd; - XtInputId *id; /* unused */ +static void ReadStdout( + XtPointer closure, + int *fd, + XtInputId *id) /* unused */ { register CommandStatus status = (CommandStatus)closure; CheckReadFromPipe(*fd, &status->output_buffer, &status->output_buf_size, @@ -103,10 +101,10 @@ /*ARGSUSED*/ -static void ReadStderr(closure, fd, id) - XtPointer closure; - int *fd; - XtInputId *id; /* unused */ +static void ReadStderr( + XtPointer closure, + int *fd, + XtInputId *id) /* unused */ { register CommandStatus status = (CommandStatus)closure; CheckReadFromPipe(*fd, &status->error_buffer, &status->error_buf_size, @@ -118,8 +116,7 @@ finishes. */ /* ARGSUSED */ static void -ChildDone(n) - int n; +ChildDone(int n) { childdone++; } @@ -129,12 +126,12 @@ incoming data. This will prevent the socket from overflowing during long commands. Returns 0 if stderr empty, -1 otherwise. */ -static int _DoCommandToFileOrPipe(argv, inputfd, outputfd, bufP, lenP) - char **argv; /* The command to execute, and its args. */ - int inputfd; /* Input stream for command. */ - int outputfd; /* Output stream; /dev/null if == -1 */ - char **bufP; /* output buffer ptr if outputfd == -2 */ - int *lenP; /* output length ptr if outputfd == -2 */ +static int _DoCommandToFileOrPipe( + char **argv, /* The command to execute, and its args. */ + int inputfd, /* Input stream for command. */ + int outputfd, /* Output stream; /dev/null if == -1 */ + char **bufP, /* output buffer ptr if outputfd == -2 */ + int *lenP) /* output length ptr if outputfd == -2 */ { XtAppContext appCtx = XtWidgetToApplicationContext(toplevel); int return_status; @@ -239,14 +236,15 @@ */ readfds = fds; if (childdone) break; -DEBUG("blocking.\n") + DEBUG("blocking.\n") (void) Select(num_fds, &readfds, NULL, NULL, NULL); -DEBUG1("unblocked; child%s done.\n", childdone ? "" : " not") + DEBUG1("unblocked; child%s done.\n", childdone ? "" : " not") if (childdone) break; - if (!FD_ISSET(ConnectionNumber(theDisplay), &readfds)) -{DEBUG("reading alternate input...") + if (!FD_ISSET(ConnectionNumber(theDisplay), &readfds)) { + DEBUG("reading alternate input...") XtAppProcessEvent(appCtx, (unsigned)XtIMAlternateInput); -DEBUG("read.\n")} + DEBUG("read.\n") + } } if (childdone) break; XtAppNextEvent(app, eventP); @@ -369,11 +367,11 @@ static void -CheckReadFromPipe( fd, bufP, lenP, waitEOF ) - int fd; - char **bufP; - int *lenP; - Bool waitEOF; +CheckReadFromPipe( + int fd, + char **bufP, + int *lenP, + Bool waitEOF) { int nread; /* DEBUG2( " CheckReadFromPipe #%d,len=%d,", fd, *lenP ) */ @@ -403,10 +401,10 @@ /* ARGSUSED */ -static void FreeStatus( w, closure, call_data ) - Widget w; /* unused */ - Pointer closure; - Pointer call_data; /* unused */ +static void FreeStatus( + Widget w, /* unused */ + XtPointer closure, + XtPointer call_data) /* unused */ { CommandStatus status = (CommandStatus)closure; if (status->popup != (Widget)NULL) { @@ -420,10 +418,10 @@ /* Execute the given command, waiting until it's finished. Put the output in the specified file path. Returns 0 if stderr empty, -1 otherwise */ -int DoCommand(argv, inputfile, outputfile) - char **argv; /* The command to execute, and its args. */ - char *inputfile; /* Input file for command. */ - char *outputfile; /* Output file for command. */ +int DoCommand( + char **argv, /* The command to execute, and its args. */ + char *inputfile, /* Input file for command. */ + char *outputfile) /* Output file for command. */ { int fd_in, fd_out; int status; @@ -452,8 +450,7 @@ /* Execute the given command, waiting until it's finished. Put the output in a newly mallocced string, and return a pointer to that string. */ -char *DoCommandToString(argv) -char ** argv; +char *DoCommandToString(char ** argv) { char *result = NULL; int len = 0; @@ -467,8 +464,7 @@ /* Execute the command to a temporary file, and return the name of the file. */ -char *DoCommandToFile(argv) - char **argv; +char *DoCommandToFile(char **argv) { char *name; FILEPTR file; @@ -480,4 +476,3 @@ _DoCommandToFileOrPipe(argv, -1, fd, (char **) NULL, (int *) NULL); return name; } - Index: xc/programs/xmh/compfuncs.c diff -u xc/programs/xmh/compfuncs.c:1.2 xc/programs/xmh/compfuncs.c:1.3 --- xc/programs/xmh/compfuncs.c:1.2 Tue Jul 31 20:45:06 2001 +++ xc/programs/xmh/compfuncs.c Fri Apr 5 16:06:28 2002 @@ -24,21 +24,21 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/compfuncs.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/compfuncs.c,v 1.3 2002/04/05 21:06:28 dickey Exp $ */ /* comp.c -- action procedures to handle composition buttons. */ #include "xmh.h" +#include "actions.h" - /* Reset this composition widget to be one with just a blank message template. */ /*ARGSUSED*/ -void DoResetCompose(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoResetCompose( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; Msg msg; @@ -61,11 +61,11 @@ } /*ARGSUSED*/ -void XmhResetCompose(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhResetCompose( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); DoResetCompose(w, (XtPointer) scrn, (XtPointer) NULL); @@ -77,11 +77,11 @@ sending the same message twice, but it doesn't hurt to be safe here.) */ /*ARGSUSED*/ -void XmhSend(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhSend( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (scrn->msg == NULL) return; @@ -95,11 +95,11 @@ /* Save any changes to the message. This also makes this message permanent. */ /*ARGSUSED*/ -void XmhSave(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhSave( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); DEBUG("XmhSave\n") @@ -113,10 +113,10 @@ /* Utility routine; creates a composition screen containing a forward message of the messages in the given msglist. */ -void CreateForward(mlist, params, num_params) - MsgList mlist; - String *params; - Cardinal num_params; +void CreateForward( + MsgList mlist, + String *params, + Cardinal num_params) { Scrn scrn; Msg msg; Index: xc/programs/xmh/externs.h diff -u xc/programs/xmh/externs.h:1.4 xc/programs/xmh/externs.h:1.5 --- xc/programs/xmh/externs.h:1.4 Sat Oct 27 23:34:38 2001 +++ xc/programs/xmh/externs.h Fri Apr 5 16:06:28 2002 @@ -25,7 +25,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/externs.h,v 1.4 2001/10/28 03:34:38 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/externs.h,v 1.5 2002/04/05 21:06:28 dickey Exp $ */ #include <X11/Intrinsic.h> #include <errno.h> @@ -42,18 +42,18 @@ /* from compfuncs.c */ -extern void DoResetCompose (Widget, XtPointer, XtPointer); +extern void DoResetCompose (XMH_CB_ARGS); extern void CreateForward (MsgList, String *, Cardinal); /* from folder.c */ -extern void DoClose (Widget, XtPointer, XtPointer); -extern void DoComposeMessage (Widget, XtPointer, XtPointer); -extern void DoOpenFolder (Widget, XtPointer, XtPointer); -extern void DoOpenFolderInNewWindow (Widget, XtPointer, XtPointer); -extern void DoCreateFolder (Widget, XtPointer, XtPointer); -extern void DoDeleteFolder (Widget, XtPointer, XtPointer); -extern void DoSaveYourself (Widget, XtPointer, XtPointer); +extern void DoClose (XMH_CB_ARGS); +extern void DoComposeMessage (XMH_CB_ARGS); +extern void DoOpenFolder (XMH_CB_ARGS); +extern void DoOpenFolderInNewWindow (XMH_CB_ARGS); +extern void DoCreateFolder (XMH_CB_ARGS); +extern void DoDeleteFolder (XMH_CB_ARGS); +extern void DoSaveYourself (XMH_CB_ARGS); extern void Push (Stack *, char *); extern char * Pop (Stack *); @@ -65,7 +65,7 @@ extern void AttachMenuToButton (Button, Widget, char *); extern void AddMenuEntry (Widget, char *, ...); -extern void DoRememberMenuSelection (Widget, XtPointer, XtPointer); +extern void DoRememberMenuSelection (XMH_CB_ARGS); extern void SendMenuEntryEnableMsg (Button, char *, int); extern void ToggleMenuItem (Widget, Boolean); @@ -85,14 +85,14 @@ /* from popup.c */ -extern void DestroyPopup (Widget, XtPointer, XtPointer); +extern void DestroyPopup (XMH_CB_ARGS); extern void WMDeletePopup (Widget, XEvent*); extern void PopupPrompt (Widget, String, XtCallbackProc); extern void PopupConfirm (Widget, String, XtCallbackList, XtCallbackList); extern void PopupNotice (char *, XtCallbackProc, XtPointer); extern void PopupError (Widget, String); -extern void PopupWarningHandler(); /* for Xt to call */ +extern void PopupWarningHandler(String, String, String, String, String *, Cardinal *); /* from screen.c */ @@ -113,29 +113,29 @@ /* from tocfuncs.c */ extern Boolean UserWantsAction (Widget, Scrn); -extern void DoIncorporateNewMail (Widget, XtPointer, XtPointer); -extern void DoCommit (Widget, XtPointer, XtPointer); -extern void DoPack (Widget, XtPointer, XtPointer); -extern void DoSort (Widget, XtPointer, XtPointer); -extern void DoForceRescan (Widget, XtPointer, XtPointer); -extern void DoReverseReadOrder (Widget, XtPointer, XtPointer); -extern void DoNextView (Widget, XtPointer, XtPointer); -extern void DoPrevView (Widget, XtPointer, XtPointer); -extern void DoDelete (Widget, XtPointer, XtPointer); -extern void DoMove (Widget, XtPointer, XtPointer); -extern void DoCopy (Widget, XtPointer, XtPointer); -extern void DoUnmark (Widget, XtPointer, XtPointer); -extern void DoViewNew (Widget, XtPointer, XtPointer); -extern void DoReply (Widget, XtPointer, XtPointer); -extern void DoForward (Widget, XtPointer, XtPointer); -extern void DoTocUseAsComp (Widget, XtPointer, XtPointer); -extern void DoPrint (Widget, XtPointer, XtPointer); -extern void DoPickMessages (Widget, XtPointer, XtPointer); -extern void DoSelectSequence (Widget, XtPointer, XtPointer); -extern void DoOpenSeq (Widget, XtPointer, XtPointer); -extern void DoAddToSeq (Widget, XtPointer, XtPointer); -extern void DoRemoveFromSeq (Widget, XtPointer, XtPointer); -extern void DoDeleteSeq (Widget, XtPointer, XtPointer); +extern void DoIncorporateNewMail (XMH_CB_ARGS); +extern void DoCommit (XMH_CB_ARGS); +extern void DoPack (XMH_CB_ARGS); +extern void DoSort (XMH_CB_ARGS); +extern void DoForceRescan (XMH_CB_ARGS); +extern void DoReverseReadOrder (XMH_CB_ARGS); +extern void DoNextView (XMH_CB_ARGS); +extern void DoPrevView (XMH_CB_ARGS); +extern void DoDelete (XMH_CB_ARGS); +extern void DoMove (XMH_CB_ARGS); +extern void DoCopy (XMH_CB_ARGS); +extern void DoUnmark (XMH_CB_ARGS); +extern void DoViewNew (XMH_CB_ARGS); +extern void DoReply (XMH_CB_ARGS); +extern void DoForward (XMH_CB_ARGS); +extern void DoTocUseAsComp (XMH_CB_ARGS); +extern void DoPrint (XMH_CB_ARGS); +extern void DoPickMessages (XMH_CB_ARGS); +extern void DoSelectSequence (XMH_CB_ARGS); +extern void DoOpenSeq (XMH_CB_ARGS); +extern void DoAddToSeq (XMH_CB_ARGS); +extern void DoRemoveFromSeq (XMH_CB_ARGS); +extern void DoDeleteSeq (XMH_CB_ARGS); /* from util.c */ @@ -168,7 +168,7 @@ extern int GetHeight (Widget); extern Toc SelectedToc (Scrn); extern Toc CurrentToc (Scrn); -extern int strncmpIgnoringCase(); +extern int strncmpIgnoringCase(char *, char *, int); extern void StoreWindowName (Scrn, char *); extern void InitBusyCursor (Scrn); extern void ShowBusyCursor (void); @@ -177,10 +177,10 @@ /* from viewfuncs.c */ -extern void DoCloseView (Widget, XtPointer, XtPointer); -extern void DoViewReply (Widget, XtPointer, XtPointer); -extern void DoViewForward (Widget, XtPointer, XtPointer); -extern void DoViewUseAsComposition (Widget, XtPointer, XtPointer); -extern void DoEditView (Widget, XtPointer, XtPointer); -extern void DoSaveView (Widget, XtPointer, XtPointer); -extern void DoPrintView (Widget, XtPointer, XtPointer); +extern void DoCloseView (XMH_CB_ARGS); +extern void DoViewReply (XMH_CB_ARGS); +extern void DoViewForward (XMH_CB_ARGS); +extern void DoViewUseAsComposition (XMH_CB_ARGS); +extern void DoEditView (XMH_CB_ARGS); +extern void DoSaveView (XMH_CB_ARGS); +extern void DoPrintView (XMH_CB_ARGS); Index: xc/programs/xmh/folder.c diff -u xc/programs/xmh/folder.c:1.3 xc/programs/xmh/folder.c:1.4 --- xc/programs/xmh/folder.c:1.3 Sat Oct 27 23:34:38 2001 +++ xc/programs/xmh/folder.c Fri Apr 5 16:06:28 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/folder.c,v 1.3 2001/10/28 03:34:38 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/folder.c,v 1.4 2002/04/05 21:06:28 dickey Exp $ */ /* folder.c -- implement buttons relating to folders and other globals. */ @@ -45,9 +45,13 @@ } DeleteDataRec, *DeleteData; -static void CreateFolderMenu(); -static void AddFolderMenuEntry(); -static void DeleteFolderMenuEntry(); +static void CheckAndDeleteFolder(XMH_CB_ARGS); +static void CancelDeleteFolder(XMH_CB_ARGS); +static void CheckAndConfirmDeleteFolder(XMH_CB_ARGS); +static void FreeMenuData(XMH_CB_ARGS); +static void CreateFolderMenu(Button); +static void AddFolderMenuEntry(Button, char *); +static void DeleteFolderMenuEntry(Button, char *); #ifdef DEBUG_CLEANUP extern Boolean ExitLoop; @@ -56,10 +60,10 @@ /* Close this toc&view scrn. If this is the last toc&view, quit xmh. */ /*ARGSUSED*/ -void DoClose(widget, client_data, call_data) - Widget widget; - XtPointer client_data; - XtPointer call_data; +void DoClose( + Widget widget, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; register int i, count; @@ -122,11 +126,11 @@ } /*ARGSUSED*/ -void XmhClose(w, event, params, num_params) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ +void XmhClose( + Widget w, + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { Scrn scrn = ScrnFromWidget(w); DoClose(w, (XtPointer) scrn, (XtPointer) NULL); @@ -135,10 +139,10 @@ /* Open the selected folder in this screen. */ /* ARGSUSED*/ -void DoOpenFolder(widget, client_data, call_data) - Widget widget; - XtPointer client_data; - XtPointer call_data; +void DoOpenFolder( + Widget widget, + XtPointer client_data, + XtPointer call_data) { /* Invoked by the Folder menu entry "Open Folder"'s notify action. */ @@ -152,11 +156,11 @@ /*ARGSUSED*/ -void XmhOpenFolder(w, event, params, num_params) - Widget w; - XEvent *event; /* unused */ - String *params; - Cardinal *num_params; +void XmhOpenFolder( + Widget w, + XEvent *event, /* unused */ + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); @@ -188,10 +192,10 @@ /* Compose a new message. */ /*ARGSUSED*/ -void DoComposeMessage(widget, client_data, call_data) - Widget widget; - XtPointer client_data; - XtPointer call_data; +void DoComposeMessage( + Widget widget, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = NewCompScrn(); Msg msg = TocMakeNewMsg(DraftsFolder); @@ -204,11 +208,11 @@ /*ARGSUSED*/ -void XmhComposeMessage(w, event, params, num_params) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ +void XmhComposeMessage( + Widget w, + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { DoComposeMessage(w, (XtPointer) NULL, (XtPointer) NULL); } @@ -217,10 +221,10 @@ /* Make a new scrn displaying the given folder. */ /*ARGSUSED*/ -void DoOpenFolderInNewWindow(widget, client_data, call_data) - Widget widget; - XtPointer client_data; - XtPointer call_data; +void DoOpenFolderInNewWindow( + Widget widget, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = SelectedToc(scrn); @@ -234,11 +238,11 @@ /*ARGSUSED*/ -void XmhOpenFolderInNewWindow(w, event, params, num_params) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ +void XmhOpenFolderInNewWindow( + Widget w, + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { Scrn scrn = ScrnFromWidget(w); DoOpenFolderInNewWindow(w, (XtPointer) scrn, (XtPointer) NULL); @@ -249,10 +253,10 @@ static char *previous_label = NULL; /*ARGSUSED*/ -static void CreateFolder(widget, client_data, call_data) - Widget widget; /* the okay button of the dialog widget */ - XtPointer client_data; /* the dialog widget */ - XtPointer call_data; +static void CreateFolder( + Widget widget, /* the okay button of the dialog widget */ + XtPointer client_data, /* the dialog widget */ + XtPointer call_data) { Toc toc; register int i; @@ -307,10 +311,10 @@ /* Create a new folder. Requires the user to name the new folder. */ /*ARGSUSED*/ -void DoCreateFolder(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoCreateFolder( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; PopupPrompt(scrn->parent, "Create folder named:", CreateFolder); @@ -318,11 +322,11 @@ /*ARGSUSED*/ -void XmhCreateFolder(w, event, params, num_params) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ +void XmhCreateFolder( + Widget w, + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { Scrn scrn = ScrnFromWidget(w); DoCreateFolder(w, (XtPointer)scrn, (XtPointer)NULL); @@ -330,10 +334,10 @@ /*ARGSUSED*/ -void CancelDeleteFolder(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +static void CancelDeleteFolder( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { DeleteData deleteData = (DeleteData) client_data; @@ -353,10 +357,10 @@ /*ARGSUSED*/ -void CheckAndConfirmDeleteFolder(widget, client_data, call_data) - Widget widget; /* unreliable; sometimes NULL */ - XtPointer client_data; /* data structure */ - XtPointer call_data; /* unused */ +static void CheckAndConfirmDeleteFolder( + Widget widget, /* unreliable; sometimes NULL */ + XtPointer client_data, /* data structure */ + XtPointer call_data) /* unused */ { DeleteData deleteData = (DeleteData) client_data; Scrn scrn = deleteData->scrn; @@ -364,7 +368,6 @@ char str[300]; XtCallbackRec confirms[2]; XtCallbackRec cancels[2]; - void CheckAndDeleteFolder(); static XtCallbackRec yes_callbacks[] = { {CheckAndDeleteFolder, (XtPointer) NULL}, @@ -407,10 +410,10 @@ /*ARGSUSED*/ -void CheckAndDeleteFolder(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; /* data structure */ - XtPointer call_data; /* unused */ +static void CheckAndDeleteFolder( + Widget widget, /* unused */ + XtPointer client_data, /* data structure */ + XtPointer call_data) /* unused */ { DeleteData deleteData = (DeleteData) client_data; Scrn scrn = deleteData->scrn; @@ -484,10 +487,10 @@ /* Delete the selected folder. Requires confirmation! */ /*ARGSUSED*/ -void DoDeleteFolder(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoDeleteFolder( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = SelectedToc(scrn); @@ -520,11 +523,11 @@ /*ARGSUSED*/ -void XmhDeleteFolder(w, event, params, num_params) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ +void XmhDeleteFolder( + Widget w, + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { Scrn scrn = ScrnFromWidget(w); DoDeleteFolder(w, (XtPointer) scrn, (XtPointer) NULL); @@ -547,8 +550,7 @@ /* Function name: IsFolder * Description: determines if a file is an mh subfolder. */ -static int IsFolder(name) - char *name; +static int IsFolder(char *name) { register int i, len; struct stat buf; @@ -577,19 +579,20 @@ /* menu entry selection callback for folder menus. */ /*ARGSUSED*/ -static void DoSelectFolder(w, closure, data) - Widget w; /* the menu entry object */ - XtPointer closure; /* foldername */ - XtPointer data; +static void DoSelectFolder( + Widget w, /* the menu entry object */ + XtPointer closure, /* foldername */ + XtPointer data) { Scrn scrn = ScrnFromWidget(w); SetCurrentFolderName(scrn, (char *) closure); } /*ARGSUSED*/ -void FreeMenuData(w, client_data, call_data) - Widget w; - XtPointer client_data, call_data; +static void FreeMenuData( + Widget w, + XtPointer client_data, + XtPointer call_data) { XtFree((char*) client_data); } @@ -601,9 +604,9 @@ * If the menu is already created, add the new entry. */ -static void AddFolderMenuEntry(button, entryname) - Button button; /* the corresponding menu button */ - char *entryname; /* the new entry, relative to MailDir */ +static void AddFolderMenuEntry( + Button button, /* the corresponding menu button */ + char *entryname) /* the new entry, relative to MailDir */ { Arg args[4]; char * name; @@ -664,8 +667,8 @@ * parent folder. Remaining entries are alphabetized. */ -static void CreateFolderMenu(button) - Button button; +static void CreateFolderMenu( + Button button) { char **namelist; register int i, n, length; @@ -709,9 +712,9 @@ * Description: Remove a subfolder from a menu. */ -static void DeleteFolderMenuEntry(button, foldername) - Button button; - char *foldername; +static void DeleteFolderMenuEntry( + Button button, + char *foldername) { char * c; Arg args[2]; @@ -756,11 +759,11 @@ */ /*ARGSUSED*/ -void XmhPopupFolderMenu(w, event, vector, count) - Widget w; - XEvent *event; /* unused */ - String *vector; /* unused */ - Cardinal *count; /* unused */ +void XmhPopupFolderMenu( + Widget w, + XEvent *event, /* unused */ + String *vector, /* unused */ + Cardinal *count) /* unused */ { Button button; Scrn scrn; @@ -791,11 +794,11 @@ */ /*ARGSUSED*/ -void XmhSetCurrentFolder(w, event, vector, count) - Widget w; - XEvent *event; /* unused */ - String *vector; /* unused */ - Cardinal *count; /* unused */ +void XmhSetCurrentFolder( + Widget w, + XEvent *event, /* unused */ + String *vector, /* unused */ + Cardinal *count) /* unused */ { Button button; Scrn scrn; @@ -823,19 +826,19 @@ /*ARGSUSED*/ -void XmhLeaveFolderButton(w, event, vector, count) - Widget w; - XEvent *event; - String *vector; - Cardinal *count; +void XmhLeaveFolderButton( + Widget w, + XEvent *event, + String *vector, + Cardinal *count) { LastMenuButtonPressed = NULL; } -void Push(stack_ptr, data) - Stack *stack_ptr; - char *data; +void Push( + Stack *stack_ptr, + char *data) { Stack new = XtNew(StackRec); new->data = data; @@ -843,8 +846,8 @@ *stack_ptr = new; } -char * Pop(stack_ptr) - Stack *stack_ptr; +char * Pop( + Stack *stack_ptr) { Stack top; char *data = NULL; @@ -862,14 +865,14 @@ */ /*ARGSUSED*/ -void XmhPushFolder(w, event, params, count) - Widget w; - XEvent *event; - String *params; - Cardinal *count; +void XmhPushFolder( + Widget w, + XEvent *event, + String *params, + Cardinal *count) { Scrn scrn = ScrnFromWidget(w); - int i; + Cardinal i; for (i=0; i < *count; i++) Push(&scrn->folder_stack, params[i]); @@ -881,11 +884,11 @@ /* Pop the stack & take that folder to be the currently selected folder. */ /*ARGSUSED*/ -void XmhPopFolder(w, event, params, count) - Widget w; - XEvent *event; - String *params; - Cardinal *count; +void XmhPopFolder( + Widget w, + XEvent *event, + String *params, + Cardinal *count) { Scrn scrn = ScrnFromWidget(w); char *folder; @@ -894,12 +897,12 @@ SetCurrentFolderName(scrn, folder); } -static Boolean InParams(str, p, n) - String str; - String *p; - Cardinal n; +static Boolean InParams( + String str, + String *p, + Cardinal n) { - int i; + Cardinal i; for (i=0; i < n; p++, i++) if (! XmuCompareISOLatin1(*p, str)) return True; return False; @@ -908,11 +911,11 @@ /* generalized routine for xmh participation in WM protocols */ /*ARGSUSED*/ -void XmhWMProtocols(w, event, params, num_params) - Widget w; /* NULL if from checkpoint timer */ - XEvent * event; /* NULL if from checkpoint timer */ - String * params; - Cardinal * num_params; +void XmhWMProtocols( + Widget w, /* NULL if from checkpoint timer */ + XEvent * event, /* NULL if from checkpoint timer */ + String * params, + Cardinal * num_params) { Boolean dw = False; /* will we do delete window? */ Boolean sy = False; /* will we do save yourself? */ @@ -988,10 +991,10 @@ XtCheckpointToken cp_token; } InteractMsgTokenRec, *InteractMsgToken; -static void CommitMsgChanges(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* InteractMsgToken */ - XtPointer call_data; +static void CommitMsgChanges( + Widget w, /* unused */ + XtPointer client_data, /* InteractMsgToken */ + XtPointer call_data) { Cardinal zero = 0; InteractMsgToken iToken = (InteractMsgToken) client_data; @@ -1005,10 +1008,10 @@ XtFree((XtPointer)iToken); } -static void CancelMsgChanges(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* InteractMsgToken */ - XtPointer call_data; +static void CancelMsgChanges( + Widget w, /* unused */ + XtPointer client_data, /* InteractMsgToken */ + XtPointer call_data) { InteractMsgToken iToken = (InteractMsgToken) client_data; @@ -1021,10 +1024,10 @@ XtFree((XtPointer)iToken); } -static void CommitMsgInteract(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* Scrn */ - XtPointer call_data; /* XtCheckpointToken */ +static void CommitMsgInteract( + Widget w, /* unused */ + XtPointer client_data, /* Scrn */ + XtPointer call_data) /* XtCheckpointToken */ { Scrn scrn = (Scrn) client_data; XtCheckpointToken cpToken = (XtCheckpointToken) call_data; @@ -1065,10 +1068,10 @@ XtCheckpointToken cp_token; } InteractTocTokenRec, *InteractTocToken; -static void CommitTocChanges(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* InteractTocToken */ - XtPointer call_data; +static void CommitTocChanges( + Widget w, /* unused */ + XtPointer client_data, /* InteractTocToken */ + XtPointer call_data) { InteractTocToken iToken = (InteractTocToken) client_data; @@ -1078,10 +1081,10 @@ XtFree((XtPointer)iToken); } -static void CancelTocChanges(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* InteractTocToken */ - XtPointer call_data; +static void CancelTocChanges( + Widget w, /* unused */ + XtPointer client_data, /* InteractTocToken */ + XtPointer call_data) { InteractTocToken iToken = (InteractTocToken) client_data; @@ -1092,16 +1095,16 @@ XtFree((XtPointer)iToken); } -static void CommitTocInteract(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* Toc */ - XtPointer call_data; /* XtCheckpointToken */ +static void CommitTocInteract( + Widget w, /* unused */ + XtPointer client_data, /* Toc */ + XtPointer call_data) /* XtCheckpointToken */ { Toc toc = (Toc) client_data; XtCheckpointToken cpToken = (XtCheckpointToken) call_data; char str[300]; Widget tocwidget; - int i; + Cardinal i; InteractTocToken iToken; static XtCallbackRec yes_callbacks[] = { {CommitTocChanges, (XtPointer) NULL}, @@ -1142,10 +1145,10 @@ /* Callback for Session Manager SaveYourself */ /*ARGSUSED*/ -void DoSaveYourself(w, client_data, call_data) - Widget w; /* unused; s/b toplevel */ - XtPointer client_data; /* unused */ - XtPointer call_data; /* XtCheckpointToken */ +void DoSaveYourself( + Widget w, /* unused; s/b toplevel */ + XtPointer client_data, /* unused */ + XtPointer call_data) /* XtCheckpointToken */ { XtCheckpointToken cpToken = (XtCheckpointToken)call_data; Index: xc/programs/xmh/globals.h diff -u xc/programs/xmh/globals.h:1.1.1.3 xc/programs/xmh/globals.h:1.3 --- xc/programs/xmh/globals.h:1.1.1.3 Sun Feb 4 02:48:58 1996 +++ xc/programs/xmh/globals.h Sun Jun 30 22:26:05 2002 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/globals.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifdef MAIN #define ext @@ -121,7 +122,7 @@ typedef struct _XmhMenuEntry { char *name; /* menu entry name */ - void (*function)(); /* menu entry callback function */ + void (*function)(XMH_CB_ARGS); /* menu entry callback function */ } XmhMenuEntryRec, *XmhMenuEntry; Index: xc/programs/xmh/init.c diff -u xc/programs/xmh/init.c:1.5 xc/programs/xmh/init.c:1.6 --- xc/programs/xmh/init.c:1.5 Mon Jan 7 15:20:12 2002 +++ xc/programs/xmh/init.c Fri Apr 5 16:06:28 2002 @@ -25,7 +25,7 @@ * without specific, written prior permission. * */ -/* $XFree86: xc/programs/xmh/init.c,v 1.5 2002/01/07 20:20:12 dawes Exp $ */ +/* $XFree86: xc/programs/xmh/init.c,v 1.6 2002/04/05 21:06:28 dickey Exp $ */ /* Init.c - Handle start-up initialization. */ @@ -174,8 +174,7 @@ }; /* Tell the user how to use this program. */ -static void Syntax(call) - char *call; +static void Syntax(char *call) { (void) fprintf(stderr, "usage: %s [-path <path>] [-initial <folder>]\n", call); @@ -183,9 +182,7 @@ } -static char *FixUpGeometry(geo, defwidth, defheight) -char *geo; -Dimension defwidth, defheight; +static char *FixUpGeometry(char *geo, unsigned defwidth, unsigned defheight) { int gbits; int x, y; @@ -205,8 +202,7 @@ } -static int _IOErrorHandler(dpy) - Display *dpy; +static int _IOErrorHandler(Display *dpy) { (void) fprintf (stderr, "%s:\tfatal IO error after %lu requests (%lu known processed)\n", @@ -225,11 +221,11 @@ } /*ARGSUSED*/ -static void PopupAppDefaultsWarning(w, closure, event, cont) - Widget w; - XtPointer closure; - XEvent *event; - Boolean *cont; +static void PopupAppDefaultsWarning( + Widget w, + XtPointer closure, + XEvent *event, + Boolean *cont) { if (event->type == MapNotify) { PopupError(w, @@ -245,10 +241,10 @@ /*ARGSUSED*/ -static void _Die(w, client_data, call_data) - Widget w; /* == toplevel */ - XtPointer client_data; /* unused */ - XtPointer call_data; /* unused */ +static void _Die( + Widget w, /* == toplevel */ + XtPointer client_data, /* unused */ + XtPointer call_data) /* unused */ { int i; @@ -263,11 +259,10 @@ /* All the start-up initialization goes here. */ -void InitializeWorld(argc, argv) -int argc; -char **argv; +extern char** environ; /* POSIX doesn't specify a .h for this */ + +void InitializeWorld(int argc, char **argv) { - extern char** environ; /* POSIX doesn't specify a .h for this */ int l; FILEPTR fid; char str[500], str2[500], *ptr; Index: xc/programs/xmh/main.c diff -u xc/programs/xmh/main.c:1.2 xc/programs/xmh/main.c:1.3 --- xc/programs/xmh/main.c:1.2 Tue Jul 31 20:45:06 2001 +++ xc/programs/xmh/main.c Fri Apr 5 16:06:28 2002 @@ -23,15 +23,16 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/main.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/main.c,v 1.3 2002/04/05 21:06:28 dickey Exp $ */ #define MAIN 1 /* Makes global.h actually declare vars */ #include "xmh.h" +#include "actions.h" /*ARGSUSED*/ -static void NeedToCheckScans(client_data, id) - XtPointer client_data; - XtIntervalId *id; /* unused */ +static void NeedToCheckScans( + XtPointer client_data, + XtIntervalId *id) /* unused */ { int i; if (!subProcessRunning) { @@ -50,12 +51,10 @@ } /*ARGSUSED*/ -static void Checkpoint(client_data, id) - XtPointer client_data; - XtIntervalId *id; /* unused */ +static void Checkpoint( + XtPointer client_data, + XtIntervalId *id) /* unused */ { - extern void XmhWMProtocols(); - if (!subProcessRunning) { Cardinal n = 1; String params = "wm_save_yourself"; @@ -69,12 +68,10 @@ } /*ARGSUSED*/ -static void CheckMail(client_data, id) - XtPointer client_data; - XtIntervalId *id; /* unused */ +static void CheckMail( + XtPointer client_data, + XtIntervalId *id) /* unused */ { - extern void XmhCheckForNewMail(); - if (!subProcessRunning) { DEBUG("(Checking for new mail...") XmhCheckForNewMail(NULL, NULL, NULL, NULL); @@ -91,9 +88,7 @@ Boolean ExitLoop = FALSE; #endif -int main(argc, argv) -int argc; -char **argv; +int main(int argc, char **argv) { XtAppContext appCtx; Index: xc/programs/xmh/miscfuncs.c diff -u xc/programs/xmh/miscfuncs.c:3.6 xc/programs/xmh/miscfuncs.c:3.7 --- xc/programs/xmh/miscfuncs.c:3.6 Sat Oct 27 23:34:39 2001 +++ xc/programs/xmh/miscfuncs.c Fri Apr 5 16:06:28 2002 @@ -1,6 +1,8 @@ /* $XConsortium: miscfuncs.c,v 1.7 94/12/01 17:15:05 kaleb Exp $ */ -/* $XFree86: xc/programs/xmh/miscfuncs.c,v 3.6 2001/10/28 03:34:39 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/miscfuncs.c,v 3.7 2002/04/05 21:06:28 dickey Exp $ */ +#include "xmh.h" + #include <X11/Xos.h> #ifndef X_NOT_POSIX @@ -22,8 +24,6 @@ #include <stdlib.h> - - #if defined(SYSV) && (defined(i386) || defined(MOTOROLA)) /* These systems don't have the ftruncate() system call, so we emulate it. @@ -39,10 +39,10 @@ #define CHUNKSIZE 1024 -int ftruncate_emu(fd, length, name) - int fd; - off_t length; - char *name; +int ftruncate_emu( + int fd, + off_t length, + char *name) { char tmp_file[15]; int new_fid, bytes_left, i; @@ -112,17 +112,16 @@ /* Initial guess at directory size. */ #define INITIAL_SIZE 20 -static int StrCmp(a, b) - char **a, **b; +static int StrCmp(char **a, char **b) { return strcmp(*a, *b); } int -ScanDir(Name, List, Selector) - char *Name; - char ***List; - int (*Selector)(); +ScanDir( + char *Name, + char ***List, + int (*Selector)(char *)) { register char **names; register ENTRY *E; Index: xc/programs/xmh/mlist.c diff -u xc/programs/xmh/mlist.c:1.1.1.1 xc/programs/xmh/mlist.c:1.3 --- xc/programs/xmh/mlist.c:1.1.1.1 Wed Apr 27 03:12:51 1994 +++ xc/programs/xmh/mlist.c Sun Jun 30 22:26:05 2002 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/mlist.c,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ /* mlist.c -- functions to deal with message lists. */ @@ -32,7 +33,7 @@ /* Create a message list containing no messages. */ -MsgList MakeNullMsgList() +MsgList MakeNullMsgList(void) { MsgList mlist; mlist = XtNew(MsgListRec); @@ -45,9 +46,7 @@ /* Append a message to the given message list. */ -void AppendMsgList(mlist, msg) - MsgList mlist; - Msg msg; +void AppendMsgList(MsgList mlist, Msg msg) { mlist->nummsgs++; mlist->msglist = @@ -61,9 +60,7 @@ /* Delete a message from a message list. */ -void DeleteMsgFromMsgList(mlist, msg) -MsgList mlist; -Msg msg; +void DeleteMsgFromMsgList(MsgList mlist, Msg msg) { int i; for (i=0 ; i<mlist->nummsgs ; i++) { @@ -80,8 +77,7 @@ /* Create a new messages list containing only the one given message. */ -MsgList MakeSingleMsgList(msg) - Msg msg; +MsgList MakeSingleMsgList(Msg msg) { MsgList result; result = MakeNullMsgList(); @@ -92,8 +88,7 @@ /* We're done with this message list; free it's storage. */ -void FreeMsgList(mlist) - MsgList mlist; +void FreeMsgList(MsgList mlist) { XtFree((char *) mlist->msglist); XtFree((char *) mlist); @@ -105,9 +100,7 @@ message numbers. This routine assumes those messages numbers refer to messages in the given toc. */ -MsgList StringToMsgList(toc, str) -Toc toc; -char *str; +MsgList StringToMsgList(Toc toc, char *str) { MsgList mlist; char *ptr; Index: xc/programs/xmh/mlist.h diff -u xc/programs/xmh/mlist.h:1.1.1.1 xc/programs/xmh/mlist.h:1.3 --- xc/programs/xmh/mlist.h:1.1.1.1 Wed Apr 27 03:12:52 1994 +++ xc/programs/xmh/mlist.h Sun Jun 30 22:26:05 2002 @@ -23,15 +23,16 @@ * or publicity pertaining to distribution of the software without specific, * written prior permission. */ +/* $XFree86: xc/programs/xmh/mlist.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _mlist_h #define _mlist_h -extern MsgList MakeNullMsgList(); -extern void AppendMsgList(); -extern void DeleteMsgFromMsgList(); -extern MsgList MakeSingleMsgList(); -extern void FreeMsgList(); -extern MsgList StringToMsgList(); +extern MsgList MakeNullMsgList(void); +extern void AppendMsgList(MsgList, Msg); +extern void DeleteMsgFromMsgList(MsgList, Msg); +extern MsgList MakeSingleMsgList(Msg); +extern void FreeMsgList(MsgList); +extern MsgList StringToMsgList(Toc, char *); #endif /* _mlist_h */ Index: xc/programs/xmh/msg.c diff -u xc/programs/xmh/msg.c:1.3 xc/programs/xmh/msg.c:1.4 --- xc/programs/xmh/msg.c:1.3 Sat Oct 27 23:34:39 2001 +++ xc/programs/xmh/msg.c Fri Apr 5 16:06:28 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/msg.c,v 1.3 2001/10/28 03:34:39 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/msg.c,v 1.4 2002/04/05 21:06:28 dickey Exp $ */ /* msgs.c -- handle operations on messages. */ @@ -32,8 +32,9 @@ #include "xmh.h" #include "tocintrnl.h" +#include "actions.h" -static int SetScrn(); +static int SetScrn(Msg, Scrn, Boolean, XtCallbackList, XtCallbackList); /* Function Name: SetEditable * Description: Sets the editable flag for this message. @@ -43,9 +44,7 @@ */ static void -SetEditable(msg, edit) -Msg msg; -Boolean edit; +SetEditable(Msg msg, Boolean edit) { Arg args[1]; @@ -64,8 +63,7 @@ */ static Boolean -IsEditable(msg) -Msg msg; +IsEditable(Msg msg) { Arg args[1]; XawTextEditType type; @@ -78,8 +76,7 @@ /* Return the user-viewable name of the given message. */ -char *MsgName(msg) -Msg msg; +char *MsgName(Msg msg) { static char result[100]; (void) sprintf(result, "%s:%d", msg->toc->foldername, msg->msgid); @@ -89,8 +86,7 @@ /* Update the message titlebar in the given scrn. */ -static void ResetMsgLabel(scrn) -Scrn scrn; +static void ResetMsgLabel(Scrn scrn) { Msg msg; char str[200]; @@ -124,8 +120,7 @@ insertion point to the proper place if this is a composition and we're viewing it for the first time. */ -static void RedisplayMsg(scrn) -Scrn scrn; +static void RedisplayMsg(Scrn scrn) { Msg msg; XawTextPosition startPos, lastPos, nextPos; @@ -177,7 +172,7 @@ /* Temporarily move the draftfile somewhere else, so we can exec an mh command that affects it. */ -static void TempMoveDraft() +static void TempMoveDraft(void) { char *ptr; if (FileExists(draftFile)) { @@ -194,7 +189,7 @@ /* Restore the draftfile from its temporary hiding place. */ -static void RestoreDraft() +static void RestoreDraft(void) { if (*tempDraftFile) { RenameAndCheck(tempDraftFile, draftFile); @@ -209,8 +204,7 @@ /* Given a message, return the corresponding filename. */ -char *MsgFileName(msg) -Msg msg; +char *MsgFileName(Msg msg) { static char result[500]; (void) sprintf(result, "%s/%d", msg->toc->path, msg->msgid); @@ -222,8 +216,7 @@ /* Save any changes to a message. Also calls the toc routine to update the scanline for this msg. Returns True if saved, false otherwise. */ -int MsgSaveChanges(msg) -Msg msg; +int MsgSaveChanges(Msg msg) { int i; Window w; @@ -259,10 +252,10 @@ /*ARGSUSED*/ -static void ConfirmedNoScrn(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +static void ConfirmedNoScrn( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Msg msg = (Msg) client_data; register int i; @@ -273,8 +266,7 @@ } -static void RemoveMsgConfirmed(scrn) - Scrn scrn; +static void RemoveMsgConfirmed(Scrn scrn) { if (scrn->kind == STtocAndView && MsgChanged(scrn->msg)) { Arg args[1]; @@ -294,9 +286,9 @@ } -static void SetScrnNewMsg(msg, scrn) - Msg msg; - Scrn scrn; +static void SetScrnNewMsg( + Msg msg, + Scrn scrn) { scrn->msg = msg; if (msg == NULL) { @@ -329,10 +321,10 @@ } MsgAndScrnRec, *MsgAndScrn; /*ARGSUSED*/ -static void ConfirmedWithScrn(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +static void ConfirmedWithScrn( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { MsgAndScrn mas = (MsgAndScrn) client_data; RemoveMsgConfirmed(mas->scrn); @@ -341,12 +333,12 @@ } -static int SetScrn(msg, scrn, force, confirms, cancels) - Msg msg; - Scrn scrn; - Boolean force; /* if true, force msg set scrn */ - XtCallbackList confirms; /* callbacks upon confirmation */ - XtCallbackList cancels; /* callbacks upon cancellation */ +static int SetScrn( + Msg msg, + Scrn scrn, + Boolean force, /* if true, force msg set scrn */ + XtCallbackList confirms, /* callbacks upon confirmation */ + XtCallbackList cancels) /* callbacks upon cancellation */ { register int i, num_scrns; static XtCallbackRec yes_callbacks[] = { @@ -413,11 +405,11 @@ /* Associate the given msg and scrn, asking for confirmation if necessary. */ -int MsgSetScrn(msg, scrn, confirms, cancels) -Msg msg; -Scrn scrn; -XtCallbackList confirms; -XtCallbackList cancels; +int MsgSetScrn( + Msg msg, + Scrn scrn, + XtCallbackList confirms, + XtCallbackList cancels) { return SetScrn(msg, scrn, FALSE, confirms, cancels); } @@ -426,9 +418,7 @@ /* Same as above, but with the extra information that the message is actually a composition. (Nothing currently takes advantage of that extra fact.) */ -void MsgSetScrnForComp(msg, scrn) -Msg msg; -Scrn scrn; +void MsgSetScrnForComp(Msg msg, Scrn scrn) { (void) SetScrn(msg, scrn, FALSE, (XtCallbackList) NULL, (XtCallbackList) NULL); @@ -438,9 +428,7 @@ /* Associate the given msg and scrn, even if it means losing some unsaved changes. */ -void MsgSetScrnForce(msg, scrn) -Msg msg; -Scrn scrn; +void MsgSetScrnForce(Msg msg, Scrn scrn) { (void) SetScrn(msg, scrn, TRUE, (XtCallbackList) NULL, (XtCallbackList) NULL); @@ -450,10 +438,7 @@ /* Set the fate of the given message. */ -void MsgSetFate(msg, fate, desttoc) - Msg msg; - FateType fate; - Toc desttoc; +void MsgSetFate(Msg msg, FateType fate, Toc desttoc) { Toc toc = msg->toc; XawTextBlock block; @@ -490,9 +475,7 @@ /* Get the fate of this message. */ -FateType MsgGetFate(msg, toc) -Msg msg; -Toc *toc; /* RETURN */ +FateType MsgGetFate(Msg msg, Toc *toc) { if (toc) *toc = msg->desttoc; return msg->fate; @@ -501,8 +484,7 @@ /* Make this a temporary message. */ -void MsgSetTemporary(msg) -Msg msg; +void MsgSetTemporary(Msg msg) { int i; msg->temporary = TRUE; @@ -513,8 +495,7 @@ /* Make this a permanent message. */ -void MsgSetPermanent(msg) -Msg msg; +void MsgSetPermanent(Msg msg) { int i; msg->temporary = FALSE; @@ -526,8 +507,7 @@ /* Return the id# of this message. */ -int MsgGetId(msg) -Msg msg; +int MsgGetId(Msg msg) { return msg->msgid; } @@ -535,8 +515,7 @@ /* Return the scanline for this message. */ -char *MsgGetScanLine(msg) -Msg msg; +char *MsgGetScanLine(Msg msg) { return msg->buf; } @@ -545,8 +524,7 @@ /* Return the toc this message is in. */ -Toc MsgGetToc(msg) -Msg msg; +Toc MsgGetToc(Msg msg) { return msg->toc; } @@ -554,8 +532,7 @@ /* Set the reapable flag for this msg. */ -void MsgSetReapable(msg) -Msg msg; +void MsgSetReapable(Msg msg) { int i; msg->reapable = TRUE; @@ -567,8 +544,7 @@ /* Clear the reapable flag for this msg. */ -void MsgClearReapable(msg) -Msg msg; +void MsgClearReapable(Msg msg) { int i; msg->reapable = FALSE; @@ -580,8 +556,7 @@ /* Get the reapable value for this msg. Returns TRUE iff the reapable flag is set AND no changes have been made. */ -int MsgGetReapable(msg) -Msg msg; +int MsgGetReapable(Msg msg) { return msg == NULL || (msg->reapable && (msg->source == NULL || @@ -590,8 +565,7 @@ /* Make it possible to edit the given msg. */ -void MsgSetEditable(msg) -Msg msg; +void MsgSetEditable(Msg msg) { int i; if (msg && msg->source) { @@ -605,8 +579,7 @@ /* Turn off editing for the given msg. */ -void MsgClearEditable(msg) -Msg msg; +void MsgClearEditable(Msg msg) { int i; if (msg && msg->source) { @@ -620,8 +593,7 @@ /* Get whether the msg is editable. */ -int MsgGetEditable(msg) -Msg msg; +int MsgGetEditable(Msg msg) { return msg && msg->source && IsEditable(msg); } @@ -629,8 +601,7 @@ /* Get whether the msg has changed since last saved. */ -int MsgChanged(msg) -Msg msg; +int MsgChanged(Msg msg) { return msg && msg->source && XawAsciiSourceChanged(msg->source); } @@ -638,10 +609,7 @@ /* Call the given function when the msg changes. */ void -MsgSetCallOnChange(msg, func, param) -Msg msg; -void (*func)(); -XtPointer param; +MsgSetCallOnChange(Msg msg, void (*func)(XMH_CB_ARGS), XtPointer param) { Arg args[1]; static XtCallbackRec cb[] = { {NULL, NULL}, {NULL, NULL} }; @@ -666,8 +634,7 @@ prefix. Also, these should stay in an area private to the user for security.) */ -void MsgSend(msg) -Msg msg; +void MsgSend(Msg msg) { FILEPTR from; FILEPTR to; @@ -749,8 +716,7 @@ so that the text insertion point will be placed at the end of the first line (which is usually the "To:" field). */ -void MsgLoadComposition(msg) -Msg msg; +void MsgLoadComposition(Msg msg) { static char *blankcomp = NULL; /* Array containing comp template */ static int compsize = 0; @@ -795,10 +761,11 @@ that the text insertion point will be placed at the beginning of the message body. */ -void MsgLoadReply(msg, frommsg, params, num_params) -Msg msg, frommsg; -String *params; -Cardinal num_params; +void MsgLoadReply( + Msg msg, + Msg frommsg, + String *params, + Cardinal num_params) { char **argv; char str[100]; @@ -832,12 +799,12 @@ msg->startPos so that the text insertion point will be placed at the end of the first line (which is usually a "To:" field). */ -void MsgLoadForward(scrn, msg, mlist, params, num_params) - Scrn scrn; - Msg msg; - MsgList mlist; - String *params; - Cardinal num_params; +void MsgLoadForward( + Scrn scrn, + Msg msg, + MsgList mlist, + String *params, + Cardinal num_params) { char **argv, str[100]; int i; @@ -868,8 +835,7 @@ /* Load msg with a copy of frommsg. */ -void MsgLoadCopy(msg, frommsg) -Msg msg, frommsg; +void MsgLoadCopy(Msg msg, Msg frommsg) { char str[500]; (void)strcpy(str, MsgFileName(msg)); @@ -879,8 +845,7 @@ /* Checkpoint the given message if it contains unsaved edits. */ -void MsgCheckPoint(msg) -Msg msg; +void MsgCheckPoint(Msg msg) { int len; char file[500]; @@ -908,8 +873,7 @@ /* Free the storage being used by the given msg. */ -void MsgFree(msg) -Msg msg; +void MsgFree(Msg msg) { XtFree(msg->buf); XtFree((char *)msg); @@ -918,11 +882,11 @@ /* Insert the associated message, if any, filtering it first */ /*ARGSUSED*/ -void XmhInsert(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhInsert( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); Msg msg = scrn->msg; Index: xc/programs/xmh/msg.h diff -u xc/programs/xmh/msg.h:1.1.1.1 xc/programs/xmh/msg.h:1.3 --- xc/programs/xmh/msg.h:1.1.1.1 Wed Apr 27 03:12:53 1994 +++ xc/programs/xmh/msg.h Sun Jun 30 22:26:05 2002 @@ -23,37 +23,37 @@ * or publicity pertaining to distribution of the software without specific, * written prior permission. */ +/* $XFree86: xc/programs/xmh/msg.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _msg_h #define _msg_h -extern char *MsgFileName(); -extern int MsgSaveChanges(); -extern int MsgSetScrn(); -extern void MsgSetScrnForComp(); -extern void MsgSetScrnForce(); -extern void MsgSetFate(); -extern FateType MsgGetFate(); -extern void MsgSetTemporary(); -extern void MsgSetPermanent(); -extern int MsgGetId(); -extern char *MsgGetScanLine(); -extern Toc MsgGetToc(); -extern void MsgSetReapable(); -extern void MsgClearReapable(); -extern int MsgGetReapable(); -extern void MsgSetEditable(); -extern void MsgClearEditable(); -extern int MsgGetEditable(); -extern int MsgChanged(); -extern void MsgSetCallOnChange(); -extern void MsgClearCallOnChange(); -extern void MsgSend(); -extern void MsgLoadComposition(); -extern void MsgLoadReply(); -extern void MsgLoadForward(); -extern void MsgLoadCopy(); -extern void MsgCheckPoint(); -extern void MsgFree(); +extern char *MsgFileName(Msg); +extern int MsgSaveChanges(Msg); +extern int MsgSetScrn(Msg, Scrn, XtCallbackList, XtCallbackList); +extern void MsgSetScrnForComp(Msg, Scrn); +extern void MsgSetScrnForce(Msg, Scrn); +extern void MsgSetFate(Msg, FateType, Toc); +extern FateType MsgGetFate(Msg, Toc *); +extern void MsgSetTemporary(Msg); +extern void MsgSetPermanent(Msg); +extern int MsgGetId(Msg); +extern char *MsgGetScanLine(Msg); +extern Toc MsgGetToc(Msg); +extern void MsgSetReapable(Msg); +extern void MsgClearReapable(Msg); +extern int MsgGetReapable(Msg); +extern void MsgSetEditable(Msg); +extern void MsgClearEditable(Msg); +extern int MsgGetEditable(Msg); +extern int MsgChanged(Msg); +extern void MsgSetCallOnChange(Msg, void (*)(XMH_CB_ARGS), XtPointer); +extern void MsgSend(Msg); +extern void MsgLoadComposition(Msg); +extern void MsgLoadReply(Msg, Msg, String *, Cardinal); +extern void MsgLoadForward(Scrn, Msg, MsgList, String *, Cardinal); +extern void MsgLoadCopy(Msg, Msg); +extern void MsgCheckPoint(Msg); +extern void MsgFree(Msg); #endif /* _msg_h */ Index: xc/programs/xmh/pick.c diff -u xc/programs/xmh/pick.c:1.2 xc/programs/xmh/pick.c:1.3 --- xc/programs/xmh/pick.c:1.2 Tue Jul 31 20:45:06 2001 +++ xc/programs/xmh/pick.c Fri Apr 5 16:06:29 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/pick.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/pick.c,v 1.3 2002/04/05 21:06:29 dickey Exp $ */ /* pick.c -- handle a pick subwidget. */ @@ -93,10 +93,10 @@ } PickRec; -static FormEntry CreateWidget(); -static void DeleteWidget(), AddDetailGroup(); +static FormEntry CreateWidget(RowList, WidgetClass, ArgList, Cardinal); +static void DeleteWidget(FormEntry); +static void AddDetailGroup(FormBox); - void InitPick(void) { TypeName[RTfrom] = "From:"; @@ -117,24 +117,19 @@ } -static void PrepareToUpdate(form) - FormBox form; +static void PrepareToUpdate(FormBox form) { XawFormDoLayout(form->inner, FALSE); } -static void ExecuteUpdate(form) - FormBox form; +static void ExecuteUpdate(FormBox form) { XawFormDoLayout(form->inner, TRUE); XtManageChild(form->inner); XtManageChild(form->outer); } -static void AddLabel(row, text, usestd) - RowList row; - char *text; - int usestd; +static void AddLabel(RowList row, char *text, int usestd) { static Arg arglist[] = { {XtNlabel, (XtArgVal)NULL}, @@ -150,10 +145,7 @@ } -static void AddButton(row, text, func) - RowList row; - char *text; - void (*func)(); +static void AddButton(RowList row, char *text, void (*func)(XMH_CB_ARGS)) { FormEntry entry; static Arg args[] = { @@ -166,12 +158,12 @@ } -static void AddToggle(row, text, initial_state, radio_group, radio_data) - RowList row; - char *text; - int initial_state; - Widget radio_group; - XtPointer radio_data; +static void AddToggle( + RowList row, + char *text, + int initial_state, + Widget radio_group, + XtPointer radio_data) { FormEntry entry; Arg args[4]; @@ -188,9 +180,7 @@ } -static void AddTextEntry(row, str) - RowList row; - char *str; +static void AddTextEntry(RowList row, char *str) { FormEntry entry; static Arg arglist[] = { @@ -207,9 +197,7 @@ } -static void ChangeTextEntry(entry, str) -FormEntry entry; -char *str; +static void ChangeTextEntry(FormEntry entry, char *str) { Arg arglist[1]; char *ptr; @@ -224,10 +212,10 @@ } /* ARGSUSED */ -static void ExecRowOr(w, closure, call_data) - Widget w; /* unused */ - XtPointer closure; /* FormEntry */ - XtPointer call_data; /* unused */ +static void ExecRowOr( + Widget w, /* unused */ + XtPointer closure, /* FormEntry */ + XtPointer call_data) /* unused */ { FormEntry entry = (FormEntry)closure; RowList row = entry->row; @@ -242,10 +230,10 @@ /* ARGSUSED */ -static void ExecGroupOr(w, closure, call_data) - Widget w; /* unused */ - XtPointer closure; /* FormEntry */ - XtPointer call_data; /* unused */ +static void ExecGroupOr( + Widget w, /* unused */ + XtPointer closure, /* FormEntry */ + XtPointer call_data) /* unused */ { FormBox form = ((FormEntry)closure)->row->group->form; /* %%% XUnmapWindow(theDisplay, XtWindow(form->inner)); */ @@ -259,8 +247,7 @@ static int argvsize; -static void AppendArgv(ptr) - char *ptr; +static void AppendArgv(char *ptr) { argvsize++; argv = ResizeArgv(argv, argvsize); @@ -276,8 +263,7 @@ -static Boolean ParseRow(row) - RowList row; +static Boolean ParseRow(RowList row) { int result = FALSE; int i; @@ -341,8 +327,7 @@ } -static Boolean ParseGroup(group) - Group group; +static Boolean ParseGroup(Group group) { int found = FALSE; int i; @@ -358,10 +343,10 @@ } /* ARGSUSED */ -static void ExecOK(w, closure, call_data) - Widget w; /* unused */ - XtPointer closure; /* FormEntry */ - XtPointer call_data; /* unused */ +static void ExecOK( + Widget w, /* unused */ + XtPointer closure, /* FormEntry */ + XtPointer call_data) /* unused */ { Pick pick = ((FormEntry)closure)->row->group->form->pick; Toc toc = pick->toc; @@ -459,10 +444,10 @@ /* ARGSUSED */ -static void ExecCancel(w, closure, call_data) - Widget w; /* unused */ - XtPointer closure; /* FormEntry */ - XtPointer call_data; /* unused */ +static void ExecCancel( + Widget w, /* unused */ + XtPointer closure, /* FormEntry */ + XtPointer call_data) /* unused */ { Pick pick = ((FormEntry)closure)->row->group->form->pick; Scrn scrn = pick->scrn; @@ -470,11 +455,11 @@ } -static FormEntry CreateWidget(row, class, args, num_args) - RowList row; - WidgetClass class; - ArgList args; - Cardinal num_args; +static FormEntry CreateWidget( + RowList row, + WidgetClass class, + ArgList args, + Cardinal num_args) { static Arg arglist[] = { {XtNfromHoriz, (XtArgVal)NULL}, @@ -512,8 +497,7 @@ static void -DeleteWidget(entry) - FormEntry entry; +DeleteWidget(FormEntry entry) { RowList row = entry->row; int i; @@ -530,15 +514,13 @@ /* Figure out how wide text fields and labels should be so that they'll all line up correctly, and be big enough to hold everything, but not too big. */ -static void FindStdWidth() +static void FindStdWidth(void) { stdwidth = 100; /* %%% HACK! */ } -static RowList AddRow(group, type) - Group group; - int type; +static RowList AddRow(Group group, int type) { static Arg arglist[] = { {XtNborderWidth, (XtArgVal) 0}, @@ -580,8 +562,7 @@ } -static Group AddGroup(form) - FormBox form; +static Group AddGroup(FormBox form) { static Arg arglist[] = { {XtNborderWidth, (XtArgVal) 0}, @@ -614,8 +595,7 @@ static void -AddDetailGroup(form) - FormBox form; +AddDetailGroup(FormBox form) { Group group; RowList row; @@ -639,8 +619,7 @@ } -static void AddGeneralGroup(form) - FormBox form; +static void AddGeneralGroup(FormBox form) { Group group; RowList row; @@ -675,9 +654,7 @@ } -static void InitGeneral(pick, fromseq, toseq) -Pick pick; -char *fromseq, *toseq; +static void InitGeneral(Pick pick, char *fromseq, char *toseq) { RowList row; row = pick->general->glist[0]->rlist[0]; @@ -686,8 +663,7 @@ } -static void CleanForm(form) -FormBox form; +static void CleanForm(FormBox form) { int i, j, k; Group group; @@ -707,8 +683,7 @@ } -static FormBox MakeAForm(pick) -Pick pick; +static FormBox MakeAForm(Pick pick) { static Arg arglist1[] = { {XtNallowHoriz, (XtArgVal)TRUE}, @@ -734,10 +709,7 @@ } -void AddPick(scrn, toc, fromseq, toseq) - Scrn scrn; - Toc toc; - char *fromseq, *toseq; +void AddPick(Scrn scrn, Toc toc, char *fromseq, char *toseq) { Pick pick; FormBox general, details; @@ -779,7 +751,3 @@ ChangeLabel(pick->label, str); StoreWindowName(scrn, str); } - - - - Index: xc/programs/xmh/popup.c diff -u xc/programs/xmh/popup.c:1.1.1.2 xc/programs/xmh/popup.c:1.3 --- xc/programs/xmh/popup.c:1.1.1.2 Thu Jan 26 19:28:15 1995 +++ xc/programs/xmh/popup.c Sun Jun 30 22:26:05 2002 @@ -23,10 +23,13 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/popup.c,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ /* popup.c -- Handle pop-up widgets. */ #include "xmh.h" +#include "actions.h" + #include <X11/Xaw/Cardinals.h> typedef struct _PopupStatus { @@ -50,11 +53,12 @@ * which remains the toplevel widget. */ -static void DeterminePopupPosition(x_ptr, y_ptr, transFor_return) - Position *x_ptr, *y_ptr; - Widget *transFor_return; /* return a suitable top level shell */ +static void DeterminePopupPosition( + Position *x_ptr, + Position *y_ptr, + Widget *transFor_return) /* return a suitable top level shell */ { - if (lastInput.win != -1) { + if (lastInput.win != (Window) -1) { if (transFor_return) { Widget source; source = XtWindowToWidget(XtDisplay(toplevel), lastInput.win); @@ -85,9 +89,10 @@ } } -static Boolean PositionThePopup(popup, x, y) - Widget popup; - Position x, y; +static Boolean PositionThePopup( + Widget popup, + Position x, + Position y) { /* Hack. Fix up the position of the popup. The xmh app defaults file * contains an Xmh*Geometry specification; the effects of that on @@ -119,10 +124,11 @@ } -static void CenterPopupPosition(widget, popup, px, py) - Widget widget; - Widget popup; - Position px, py; +static void CenterPopupPosition( + Widget widget, + Widget popup, + Position px, + Position py) { Position x, y; Position nx, ny; @@ -154,10 +160,13 @@ on current position. */ -static void InsureVisibility(popup, popup_child, x, y, centerX, centerY) - Widget popup, popup_child; - Position x, y; /* assert: current position = (x,y) */ - Boolean centerX, centerY; +static void InsureVisibility( + Widget popup, + Widget popup_child, + Position x, /* assert: current position = (x,y) */ + Position y, + Boolean centerX, + Boolean centerY) { Position root_x, root_y; Dimension width, height, border; @@ -192,19 +201,19 @@ /*ARGSUSED*/ -void DestroyPopup(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void DestroyPopup( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Widget popup = (Widget) client_data; XtPopdown(popup); XtDestroyWidget(popup); } -void WMDeletePopup(popup, event) - Widget popup; /* transient shell */ - XEvent* event; +void WMDeletePopup( + Widget popup, /* transient shell */ + XEvent* event) { String shellName; String buttonName; @@ -229,8 +238,8 @@ XtCallActionProc(button, "unset", event, (String*)NULL, ZERO); } -static void TheUsual(popup) - Widget popup; /* shell */ +static void TheUsual( + Widget popup) /* shell */ { XtInstallAllAccelerators(popup, popup); XtAugmentTranslations(popup, app_resources.wm_protocols_translations); @@ -242,21 +251,21 @@ /*ARGSUSED*/ -void XmhPromptOkayAction(w, event, params, num_params) - Widget w; /* the "value" widget in the Dialog box */ - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ +void XmhPromptOkayAction( + Widget w, /* the "value" widget in the Dialog box */ + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { XtCallCallbacks(XtNameToWidget(XtParent(w), XmhNokay), XtNcallback, (XtPointer)XtParent(w)); } -void PopupPrompt(transientFor, question, okayCallback) - Widget transientFor; /* required to be a top-level shell */ - String question; /* the prompting string */ - XtCallbackProc okayCallback; /* CreateFolder() */ +void PopupPrompt( + Widget transientFor, /* required to be a top-level shell */ + String question, /* the prompting string */ + XtCallbackProc okayCallback) /* CreateFolder() */ { Widget popup; Widget dialog; @@ -298,10 +307,10 @@ /* ARGSUSED */ -static void FreePopupStatus( w, closure, call_data ) - Widget w; /* unused */ - XtPointer closure; - XtPointer call_data; /* unused */ +static void FreePopupStatus( + Widget w, /* unused */ + XtPointer closure, + XtPointer call_data) /* unused */ { PopupStatus popup = (PopupStatus)closure; XtPopdown(popup->popup); @@ -312,10 +321,10 @@ } -void PopupNotice(message, callback, closure) - String message; - XtCallbackProc callback; - XtPointer closure; +void PopupNotice( + String message, + XtCallbackProc callback, + XtPointer closure) { PopupStatus popup_status = (PopupStatus)closure; Widget transientFor; @@ -380,11 +389,11 @@ } -void PopupConfirm(center_widget, question, affirm_callbacks, negate_callbacks) - Widget center_widget; /* where to center; may be NULL */ - String question; - XtCallbackList affirm_callbacks; - XtCallbackList negate_callbacks; +void PopupConfirm( + Widget center_widget, /* where to center; may be NULL */ + String question, + XtCallbackList affirm_callbacks, + XtCallbackList negate_callbacks) { Widget popup; Widget dialog; @@ -430,9 +439,9 @@ } -void PopupError(widget, message) - Widget widget; /* transient for this top-level shell, or NULL */ - String message; +void PopupError( + Widget widget, /* transient for this top-level shell, or NULL */ + String message) { Widget transFor, error_popup, dialog; Position x, y; @@ -465,13 +474,13 @@ } /*ARGSUSED*/ -void PopupWarningHandler(name, type, class, msg, params, num) - String name; - String type; - String class; - String msg; - String *params; - Cardinal *num; +void PopupWarningHandler( + String name, + String type, + String class, + String msg, + String *params, + Cardinal *num) { char *ptr; int i; Index: xc/programs/xmh/screen.c diff -u xc/programs/xmh/screen.c:1.2 xc/programs/xmh/screen.c:1.3 --- xc/programs/xmh/screen.c:1.2 Sat Oct 27 23:34:39 2001 +++ xc/programs/xmh/screen.c Fri Apr 5 16:06:29 2002 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/screen.c,v 1.2 2001/10/28 03:34:39 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/screen.c,v 1.3 2002/04/05 21:06:29 dickey Exp $ */ /* scrn.c -- management of scrns. */ @@ -103,8 +103,8 @@ /* Fill in the buttons for the view commands. */ -static void FillViewButtons(scrn) -Scrn scrn; +static void FillViewButtons( +Scrn scrn) { ButtonBox buttonbox = scrn->viewbuttons; BBoxAddButton(buttonbox, "close", commandWidgetClass, True); @@ -119,8 +119,8 @@ -static void FillCompButtons(scrn) -Scrn scrn; +static void FillCompButtons( +Scrn scrn) { ButtonBox buttonbox = scrn->viewbuttons; BBoxAddButton(buttonbox, "close", commandWidgetClass, True); @@ -132,11 +132,11 @@ } -static void MakeCommandMenu(scrn, mbd) - Scrn scrn; - XmhMenuButtonDesc mbd; +static void MakeCommandMenu( + Scrn scrn, + XmhMenuButtonDesc mbd) { - register int i; + register Cardinal i; Cardinal n; Widget menu; ButtonBox buttonbox = scrn->mainbuttons; @@ -189,8 +189,7 @@ /* Create subwidgets for a toc&view window. */ -static void MakeTocAndView(scrn) -Scrn scrn; +static void MakeTocAndView(Scrn scrn) { register int i; XmhMenuButtonDesc mbd; @@ -251,8 +250,7 @@ } } -static void MakeView(scrn) -Scrn scrn; +static void MakeView(Scrn scrn) { scrn->viewlabel = CreateTitleBar(scrn, "viewTitlebar"); scrn->viewwidget = CreateTextSW(scrn, "view", (ArgList)NULL, (Cardinal)0); @@ -261,8 +259,7 @@ } -static void MakeComp(scrn) -Scrn scrn; +static void MakeComp(Scrn scrn) { scrn->viewlabel = CreateTitleBar(scrn, "composeTitlebar"); scrn->viewwidget = CreateTextSW(scrn, "comp", (ArgList)NULL, (Cardinal)0); @@ -273,8 +270,7 @@ /* Create a scrn of the given type. */ -Scrn CreateNewScrn(kind) -ScrnKind kind; +Scrn CreateNewScrn(ScrnKind kind) { int i; Scrn scrn; @@ -380,12 +376,12 @@ } -Scrn NewViewScrn() +Scrn NewViewScrn(void) { return CreateNewScrn(STview); } -Scrn NewCompScrn() +Scrn NewCompScrn(void) { Scrn scrn; scrn = CreateNewScrn(STcomp); @@ -393,17 +389,14 @@ return scrn; } -void ScreenSetAssocMsg(scrn, msg) - Scrn scrn; - Msg msg; +void ScreenSetAssocMsg(Scrn scrn, Msg msg) { scrn->assocmsg = msg; } /* Destroy the screen. If unsaved changes are in a msg, too bad. */ -void DestroyScrn(scrn) - Scrn scrn; +void DestroyScrn(Scrn scrn) { if (scrn->mapped) { scrn->mapped = False; @@ -415,8 +408,7 @@ } -void MapScrn(scrn) -Scrn scrn; +void MapScrn(Scrn scrn) { if (!scrn->mapped) { XtPopup(scrn->parent, XtGrabNone); @@ -425,8 +417,7 @@ } -Scrn ScrnFromWidget(w) /* heavily used, should be efficient */ -Widget w; +Scrn ScrnFromWidget(Widget w) /* heavily used, should be efficient */ { register int i; while (w && ! XtIsTopLevelShell(w)) @@ -449,22 +440,17 @@ /*ARGSUSED*/ -static void EnableCallback(w, data, junk) -Widget w; -XtPointer data, junk; +static void EnableCallback(Widget w, XtPointer data, XtPointer junk) { EnableProperButtons( (Scrn) data); } -static void EnableCallback(); - #define SetButton(buttonbox, name, value) \ if (value) BBoxEnable(BBoxFindButtonNamed(buttonbox, name)); \ else BBoxDisable(BBoxFindButtonNamed(buttonbox, name)); -void EnableProperButtons(scrn) -Scrn scrn; +void EnableProperButtons(Scrn scrn) { int value, changed, reapable; Button button; Index: xc/programs/xmh/toc.c diff -u xc/programs/xmh/toc.c:3.4 xc/programs/xmh/toc.c:3.5 --- xc/programs/xmh/toc.c:3.4 Sat Oct 27 23:34:39 2001 +++ xc/programs/xmh/toc.c Fri Apr 5 16:06:29 2002 @@ -1,5 +1,5 @@ /* $XConsortium: toc.c,v 2.59 95/01/09 16:52:53 swick Exp $ - * $XFree86: xc/programs/xmh/toc.c,v 3.4 2001/10/28 03:34:39 tsi Exp $ + * $XFree86: xc/programs/xmh/toc.c,v 3.5 2002/04/05 21:06:29 dickey Exp $ * * * COPYRIGHT 1987 @@ -31,10 +31,11 @@ #include "tocintrnl.h" #include "toc.h" #include "tocutil.h" +#include "actions.h" + #include <sys/stat.h> -static int IsDir(name) -char *name; +static int IsDir(char *name) { char str[500]; struct stat buf; @@ -50,10 +51,10 @@ } -static void MakeSureFolderExists(namelistptr, numfoldersptr, name) -char ***namelistptr; -int *numfoldersptr; -char *name; +static void MakeSureFolderExists( + char ***namelistptr, + int *numfoldersptr, + char *name) { int i; char str[200]; @@ -68,10 +69,10 @@ } -static void MakeSureSubfolderExists(namelistptr, numfoldersptr, name) - char *** namelistptr; - int * numfoldersptr; - char * name; +static void MakeSureSubfolderExists( + char *** namelistptr, + int * numfoldersptr, + char * name) { char folder[300]; char subfolder_path[300]; @@ -101,8 +102,7 @@ Punt("Can't create new xmh subfolder!"); } -int TocFolderExists(toc) - Toc toc; +int TocFolderExists(Toc toc) { struct stat buf; if (! toc->path) { @@ -118,7 +118,7 @@ #endif } -static void LoadCheckFiles() +static void LoadCheckFiles(void) { FILE *fid; char str[1024]; @@ -156,7 +156,7 @@ /* Read in the list of folders. */ -void TocInit() +void TocInit(void) { Toc toc; char **namelist; @@ -200,8 +200,7 @@ /* Create a toc and add a folder to the folderList. */ -Toc TocCreate(foldername) - char *foldername; +Toc TocCreate(char *foldername) { Toc toc = TUMalloc(); @@ -215,8 +214,7 @@ /* Create a new folder with the given name. */ -Toc TocCreateFolder(foldername) -char *foldername; +Toc TocCreateFolder(char *foldername) { Toc toc; char str[500]; @@ -227,14 +225,12 @@ return toc; } -int TocHasMail(toc) - Toc toc; +int TocHasMail(Toc toc) { return toc->mailpending; } -static int CheckForNewMail(toc) - Toc toc; +static int CheckForNewMail(Toc toc) { if (toc->incfile) return (GetFileLength(toc->incfile) > 0); @@ -258,8 +254,8 @@ } /*ARGSUSED*/ -void TocCheckForNewMail(update) - Boolean update; /* if True, actually make the check */ +void TocCheckForNewMail( + Boolean update) /* if True, actually make the check */ { Toc toc; Scrn scrn; @@ -323,8 +319,7 @@ * of the confirm popup. */ -Boolean TocTestAndSetDeletePending(toc) - Toc toc; +Boolean TocTestAndSetDeletePending(Toc toc) { Boolean flag; @@ -333,8 +328,7 @@ return flag; } -void TocClearDeletePending(toc) - Toc toc; +void TocClearDeletePending(Toc toc) { toc->delete_pending = False; } @@ -342,8 +336,7 @@ /* Recursively delete an entire directory. Nasty. */ -static void NukeDirectory(path) - char *path; +static void NukeDirectory(char *path) { struct stat buf; @@ -371,8 +364,7 @@ /* Destroy the given folder. */ -void TocDeleteFolder(toc) -Toc toc; +void TocDeleteFolder(Toc toc) { Toc toc2; int i, j, w; @@ -409,11 +401,10 @@ * toc from all scrns displaying it. */ -void TocSetScrn(toc, scrn) -Toc toc; -Scrn scrn; +void TocSetScrn(Toc toc, Scrn scrn) { - int i; + Cardinal i; + if (toc == NULL && scrn == NULL) return; if (scrn == NULL) { for (i=0 ; i<toc->num_scrns ; i++) @@ -461,9 +452,7 @@ /* Remove the given message from the toc. Doesn't actually touch the file. Also note that it does not free the storage for the msg. */ -void TocRemoveMsg(toc, msg) -Toc toc; -Msg msg; +void TocRemoveMsg(Toc toc, Msg msg) { Msg newcurmsg; MsgList mlist; @@ -499,10 +488,10 @@ -void TocRecheckValidity(toc) - Toc toc; +void TocRecheckValidity(Toc toc) { - int i; + Cardinal i; + if (toc && toc->validity == valid && TUScanFileOutOfDate(toc)) { if (app_resources.block_events_on_busy) ShowBusyCursor(); @@ -519,12 +508,11 @@ /* Set the current message. */ -void TocSetCurMsg(toc, msg) - Toc toc; - Msg msg; +void TocSetCurMsg(Toc toc, Msg msg) { Msg msg2; - int i; + Cardinal i; + if (toc->validity != valid) return; if (msg != toc->curmsg) { msg2 = toc->curmsg; @@ -549,8 +537,7 @@ /* Return the current message. */ -Msg TocGetCurMsg(toc) -Toc toc; +Msg TocGetCurMsg(Toc toc) { return toc->curmsg; } @@ -560,9 +547,7 @@ /* Return the message after the given one. (If none, return NULL.) */ -Msg TocMsgAfter(toc, msg) - Toc toc; - Msg msg; +Msg TocMsgAfter(Toc toc, Msg msg) { int i; i = TUGetMsgPosition(toc, msg); @@ -578,9 +563,7 @@ /* Return the message before the given one. (If none, return NULL.) */ -Msg TocMsgBefore(toc, msg) - Toc toc; - Msg msg; +Msg TocMsgBefore(Toc toc, Msg msg) { int i; i = TUGetMsgPosition(toc, msg); @@ -596,10 +579,10 @@ /* The caller KNOWS the toc's information is out of date; rescan it. */ -void TocForceRescan(toc) - Toc toc; +void TocForceRescan(Toc toc) { - register int i; + register Cardinal i; + if (toc->num_scrns) { toc->viewedseq = toc->seqlist[0]; for (i=0 ; i<toc->num_scrns ; i++) @@ -619,10 +602,10 @@ /* The caller has just changed a sequence list. Reread them from mh. */ -void TocReloadSeqLists(toc) -Toc toc; +void TocReloadSeqLists(Toc toc) { - int i; + Cardinal i; + TocSetCacheValid(toc); TULoadSeqLists(toc); TURefigureWhatsVisible(toc); @@ -634,11 +617,11 @@ /*ARGSUSED*/ -void XmhReloadSeqLists(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhReloadSeqLists( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); TocReloadSeqLists(scrn->toc); @@ -649,8 +632,7 @@ /* Return TRUE if the toc has an interesting sequence. */ -int TocHasSequences(toc) -Toc toc; +int TocHasSequences(Toc toc) { return toc && toc->numsequences > 1; } @@ -658,9 +640,7 @@ /* Change which sequence is being viewed. */ -void TocChangeViewedSeq(toc, seq) - Toc toc; - Sequence seq; +void TocChangeViewedSeq(Toc toc, Sequence seq) { if (seq == NULL) seq = toc->viewedseq; toc->viewedseq = seq; @@ -671,9 +651,7 @@ /* Return the sequence with the given name in the given toc. */ -Sequence TocGetSeqNamed(toc, name) -Toc toc; -char *name; +Sequence TocGetSeqNamed(Toc toc, char *name) { register int i; if (name == NULL) @@ -688,8 +666,7 @@ /* Return the sequence currently being viewed in the toc. */ -Sequence TocViewedSequence(toc) -Toc toc; +Sequence TocViewedSequence(Toc toc) { return toc->viewedseq; } @@ -697,9 +674,9 @@ /* Set the selected sequence in the toc */ -void TocSetSelectedSequence(toc, sequence) - Toc toc; - Sequence sequence; +void TocSetSelectedSequence( + Toc toc, + Sequence sequence) { if (toc) toc->selectseq = sequence; @@ -708,8 +685,7 @@ /* Return the sequence currently selected */ -Sequence TocSelectedSequence(toc) - Toc toc; +Sequence TocSelectedSequence(Toc toc) { if (toc) return (toc->selectseq); else return (Sequence) NULL; @@ -720,12 +696,11 @@ #define SrcScan XawTextSourceScan -MsgList TocCurMsgList(toc) - Toc toc; +MsgList TocCurMsgList(Toc toc) { MsgList result; XawTextPosition pos1, pos2; - extern Msg MsgFromPosition(); + if (toc->num_scrns == 0) return NULL; result = MakeNullMsgList(); XawTextGetSelectionPos( toc->scrn[0]->tocwidget, &pos1, &pos2); /* %%% */ @@ -745,8 +720,7 @@ /* Unset the current selection. */ -void TocUnsetSelection(toc) -Toc toc; +void TocUnsetSelection(Toc toc) { if (toc->source) XawTextUnsetSelection(toc->scrn[0]->tocwidget); @@ -756,8 +730,7 @@ /* Create a brand new, blank message. */ -Msg TocMakeNewMsg(toc) -Toc toc; +Msg TocMakeNewMsg(Toc toc) { Msg msg; static int looping = False; @@ -779,10 +752,10 @@ /* Set things to not update cache or display until further notice. */ -void TocStopUpdate(toc) -Toc toc; +void TocStopUpdate(Toc toc) { - int i; + Cardinal i; + for (i=0 ; i<toc->num_scrns ; i++) XawTextDisableRedisplay(toc->scrn[i]->tocwidget); toc->stopupdate++; @@ -791,10 +764,10 @@ /* Start updating again, and do whatever updating has been queued. */ -void TocStartUpdate(toc) -Toc toc; +void TocStartUpdate(Toc toc) { - int i; + Cardinal i; + if (toc->stopupdate && --(toc->stopupdate) == 0) { for (i=0 ; i<toc->num_scrns ; i++) { if (toc->needsrepaint) @@ -814,8 +787,7 @@ /* Something has happened that could later convince us that our cache is out of date. Make this not happen; our cache really *is* up-to-date. */ -void TocSetCacheValid(toc) -Toc toc; +void TocSetCacheValid(Toc toc) { TUSaveTocFile(toc); } @@ -823,16 +795,14 @@ /* Return the full folder pathname of the given toc, prefixed w/'+' */ -char *TocMakeFolderName(toc) -Toc toc; +char *TocMakeFolderName(Toc toc) { char* name = XtMalloc((Cardinal) (strlen(toc->path) + 2) ); (void)sprintf( name, "+%s", toc->path ); return name; } -char *TocName(toc) -Toc toc; +char *TocName(Toc toc) { return toc->foldername; } @@ -841,8 +811,7 @@ /* Given a foldername, return the corresponding toc. */ -Toc TocGetNamed(name) -char *name; +Toc TocGetNamed(char *name) { int i; for (i=0; i<numFolders ; i++) @@ -851,8 +820,7 @@ } -Boolean TocHasChanges(toc) - Toc toc; +Boolean TocHasChanges(Toc toc) { int i; for (i=0 ; i<toc->nummsgs ; i++) @@ -867,10 +835,10 @@ Requires confirmation by the user. */ /*ARGSUSED*/ -static void TocCataclysmOkay(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +static void TocCataclysmOkay( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Toc toc = (Toc) client_data; register int i; @@ -884,12 +852,13 @@ (XtCallbackList) NULL); } -int TocConfirmCataclysm(toc, confirms, cancels) - Toc toc; - XtCallbackList confirms; - XtCallbackList cancels; +int TocConfirmCataclysm( + Toc toc, + XtCallbackList confirms, + XtCallbackList cancels) { register int i; + static XtCallbackRec yes_callbacks[] = { {TocCataclysmOkay, (XtPointer) NULL}, {(XtCallbackProc) NULL, (XtPointer) NULL}, @@ -935,10 +904,10 @@ /* Commit all the changes in this toc; all messages will meet their 'fate'. */ /*ARGSUSED*/ -void TocCommitChanges(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void TocCommitChanges( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Toc toc = (Toc) client_data; Msg msg; @@ -1056,8 +1025,7 @@ /* Return whether the given toc can incorporate mail. */ -int TocCanIncorporate(toc) -Toc toc; +int TocCanIncorporate(Toc toc) { return (toc && (toc == InitialFolder || toc->incfile)); } @@ -1065,8 +1033,7 @@ /* Incorporate new messages into the given toc. */ -int TocIncorporate(toc) -Toc toc; +int TocIncorporate(Toc toc) { char **argv; char str[100], *file, *ptr; @@ -1116,14 +1083,14 @@ /* The given message has changed. Rescan it and change the scanfile. */ -void TocMsgChanged(toc, msg) -Toc toc; -Msg msg; +void TocMsgChanged(Toc toc, Msg msg) { char **argv, str[100], str2[10], *ptr; - int length, delta, i; + int length, delta; + int i; FateType fate; Toc desttoc; + if (toc->validity != valid) return; fate = MsgGetFate(msg, &desttoc); MsgSetFate(msg, Fignore, (Toc) NULL); @@ -1162,9 +1129,7 @@ -Msg TocMsgFromId(toc, msgid) -Toc toc; -int msgid; +Msg TocMsgFromId(Toc toc, int msgid) { int h, l, m; l = 0; @@ -1201,15 +1166,15 @@ */ /*ARGSUSED*/ -void XmhPushSequence(w, event, params, count) - Widget w; - XEvent *event; - String *params; - Cardinal *count; +void XmhPushSequence( + Widget w, + XEvent *event, + String *params, + Cardinal *count) { Scrn scrn = ScrnFromWidget(w); Toc toc; - int i; + Cardinal i; if (! (toc = scrn->toc)) return; @@ -1224,11 +1189,11 @@ /*ARGSUSED*/ -void XmhPopSequence(w, event, params, count) - Widget w; /* any widget on the screen of interest */ - XEvent *event; - String *params; - Cardinal *count; +void XmhPopSequence( + Widget w, /* any widget on the screen of interest */ + XEvent *event, + String *params, + Cardinal *count) { Scrn scrn = ScrnFromWidget(w); char *seqname; Index: xc/programs/xmh/toc.h diff -u xc/programs/xmh/toc.h:1.1.1.1 xc/programs/xmh/toc.h:1.3 --- xc/programs/xmh/toc.h:1.1.1.1 Wed Apr 27 03:12:51 1994 +++ xc/programs/xmh/toc.h Sun Jun 30 22:26:05 2002 @@ -24,52 +24,53 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/toc.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _toc_h #define _toc_h -extern void TocInit (/* void */); -extern Toc TocCreate (/* char * */); -extern Toc TocCreateFolder (/* char * */); -extern int TocHasMail (/* Toc */); -extern void TocCheckForNewMail (/* Boolean */); -extern Boolean TocTestAndSetDeletePending(/* Toc */); -extern void TocClearDeletePending (/* Toc */); -extern void TocDeleteFolder (/* Toc */); -extern void TocSetScrn (/* Toc, Scrn */); - -extern void TocRemoveMsg (/* Toc, Msg */); -extern void TocRecheckValidity (/* Toc */); -extern void TocSetCurMsg (/* Toc, Msg */); -extern Msg TocGetCurMsg (/* Toc */); -extern Msg TocMsgAfter (/* Toc, Msg */); -extern Msg TocMsgBefore (/* Toc, Msg */); -extern void TocForceRescan (/* Toc */); - -extern void TocReloadSeqLists (/* Toc */); -extern int TocHasSequences (/* Toc */); -extern void TocChangeViewedSeq (/* Toc, Sequence */); -extern Sequence TocViewedSequence (/* Toc */); -extern Sequence TocGetSeqNamed (/* Toc, char * */); -extern void TocSetSelectedSequence (/* Toc, Sequence */); -extern Sequence TocSelectedSequence (/* Toc */); - -extern MsgList TocCurMsgList (/* Toc */); -extern void TocUnsetSelection (/* Toc */); -extern Msg TocMakeNewMsg (/* Toc */); -extern void TocStopUpdate (/* Toc */); -extern void TocStartUpdate (/* Toc */); -extern void TocSetCacheValid (/* Toc */); - -extern char * TocMakeFolderName (/* Toc */); -extern char * TocName (/* Toc */); -extern Toc TocGetNamed (/* char* */); - -extern int TocConfirmCataclysm(/* Toc, XtCallbackList, XtCallbackList */); -extern void TocCommitChanges (/* Widget, XtPointer, XtPointer */); -extern int TocCanIncorporate (/* Toc */); -extern int TocIncorporate (/* Toc */); -extern void TocMsgChanged (/* Toc, Msg */); -extern Msg TocMsgFromId (/* Toc, int */); +extern void TocInit (void); +extern Toc TocCreate (char *); +extern Toc TocCreateFolder (char *); +extern int TocHasMail (Toc); +extern void TocCheckForNewMail (Boolean); +extern Boolean TocTestAndSetDeletePending(Toc); +extern void TocClearDeletePending (Toc); +extern void TocDeleteFolder (Toc); +extern void TocSetScrn (Toc, Scrn); + +extern void TocRemoveMsg (Toc, Msg); +extern void TocRecheckValidity (Toc); +extern void TocSetCurMsg (Toc, Msg); +extern Msg TocGetCurMsg (Toc); +extern Msg TocMsgAfter (Toc, Msg); +extern Msg TocMsgBefore (Toc, Msg); +extern void TocForceRescan (Toc); + +extern void TocReloadSeqLists (Toc); +extern int TocHasSequences (Toc); +extern void TocChangeViewedSeq (Toc, Sequence); +extern Sequence TocViewedSequence (Toc); +extern Sequence TocGetSeqNamed (Toc, char *); +extern void TocSetSelectedSequence (Toc, Sequence); +extern Sequence TocSelectedSequence (Toc); + +extern MsgList TocCurMsgList (Toc); +extern void TocUnsetSelection (Toc); +extern Msg TocMakeNewMsg (Toc); +extern void TocStopUpdate (Toc); +extern void TocStartUpdate (Toc); +extern void TocSetCacheValid (Toc); + +extern char * TocMakeFolderName (Toc); +extern char * TocName (Toc); +extern Toc TocGetNamed (char*); + +extern int TocConfirmCataclysm(Toc, XtCallbackList, XtCallbackList); +extern void TocCommitChanges (Widget, XtPointer, XtPointer); +extern int TocCanIncorporate (Toc); +extern int TocIncorporate (Toc); +extern void TocMsgChanged (Toc, Msg); +extern Msg TocMsgFromId (Toc, int); #endif /* _toc_h */ Index: xc/programs/xmh/tocfuncs.c diff -u xc/programs/xmh/tocfuncs.c:1.3 xc/programs/xmh/tocfuncs.c:1.4 --- xc/programs/xmh/tocfuncs.c:1.3 Sat Oct 27 23:34:39 2001 +++ xc/programs/xmh/tocfuncs.c Fri Apr 5 16:06:29 2002 @@ -24,18 +24,19 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xmh/tocfuncs.c,v 1.3 2001/10/28 03:34:39 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/tocfuncs.c,v 1.4 2002/04/05 21:06:29 dickey Exp $ */ /* tocfuncs.c -- action procedures concerning things in the toc widget. */ #include "xmh.h" #include "tocutil.h" +#include "actions.h" #define MAX_SYSTEM_LEN 510 -Boolean UserWantsAction(w, scrn) /* general action procedure "filter" */ - Widget w; - Scrn scrn; +Boolean UserWantsAction( + Widget w, + Scrn scrn) { /* Commands in the command menus invoke callbacks directly. * Keyboard accelerators use the command menus as source widgets. @@ -66,9 +67,9 @@ /*ARGSUSED*/ -static void NextAndPreviousView(scrn, next) - Scrn scrn; - Boolean next; /* if true, next or forward; if false, previous */ +static void NextAndPreviousView( + Scrn scrn, + Boolean next) /* if true, next or forward; if false, previous */ { Toc toc = scrn->toc; MsgList mlist; @@ -112,10 +113,10 @@ /*ARGSUSED*/ -void DoReverseReadOrder(widget, client_data, call_data) - Widget widget; /* the menu entry widget */ - XtPointer client_data; - XtPointer call_data; +void DoReverseReadOrder( + Widget widget, /* the menu entry widget */ + XtPointer client_data, + XtPointer call_data) { app_resources.reverse_read_order = (app_resources.reverse_read_order ? False : True); @@ -124,21 +125,21 @@ /*ARGSUSED*/ -void DoNextView(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoNextView( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { NextAndPreviousView((Scrn) client_data, (app_resources.reverse_read_order ? False : True)); } /*ARGSUSED*/ -void XmhViewNextMessage(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewNextMessage( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -146,21 +147,21 @@ } /*ARGSUSED*/ -void DoPrevView(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoPrevView( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { NextAndPreviousView((Scrn) client_data, (app_resources.reverse_read_order ? True : False)); } /*ARGSUSED*/ -void XmhViewPreviousMessage(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewPreviousMessage( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -169,10 +170,10 @@ /*ARGSUSED*/ -void DoViewNew(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoViewNew( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -192,11 +193,11 @@ /*ARGSUSED*/ -void XmhViewInNewWindow(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewInNewWindow( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -204,10 +205,10 @@ } -void DoForwardMsg(scrn, params, num_params) - Scrn scrn; - String *params; - Cardinal num_params; +static void DoForwardMsg( + Scrn scrn, + String *params, + Cardinal num_params) { Toc toc = scrn->toc; MsgList mlist; @@ -221,21 +222,21 @@ /*ARGSUSED*/ -void DoForward(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoForward( + Widget w, + XtPointer client_data, + XtPointer call_data) { DoForwardMsg((Scrn) client_data, (String *)NULL, (Cardinal)0); } /*ARGSUSED*/ -void XmhForward(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhForward( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -244,10 +245,10 @@ /*ARGSUSED*/ -void DoTocUseAsComp(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoTocUseAsComp( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -274,11 +275,11 @@ /*ARGSUSED*/ -void XmhUseAsComposition(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhUseAsComposition( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -288,10 +289,7 @@ /* Utility: change the fate of a set of messages. */ -static void MarkMessages(scrn, fate, skip) -Scrn scrn; -FateType fate; -int skip; +static void MarkMessages(Scrn scrn, FateType fate, int skip) { Toc toc = scrn->toc; Toc desttoc; @@ -325,11 +323,11 @@ /*ARGSUSED*/ -void XmhMarkDelete(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhMarkDelete( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -338,10 +336,10 @@ /*ARGSUSED*/ -void DoDelete(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoDelete( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; MarkMessages(scrn, Fdelete, app_resources.skip_deleted); @@ -349,10 +347,10 @@ /*ARGSUSED*/ -void DoCopy(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoCopy( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; MarkMessages(scrn, Fcopy, app_resources.skip_copied); @@ -360,11 +358,11 @@ /*ARGSUSED*/ -void XmhMarkCopy(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhMarkCopy( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -373,10 +371,10 @@ /*ARGSUSED*/ -void DoMove(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoMove( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; MarkMessages(scrn, Fmove, app_resources.skip_moved); @@ -384,11 +382,11 @@ /*ARGSUSED*/ -void XmhMarkMove(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhMarkMove( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -397,10 +395,10 @@ /*ARGSUSED*/ -void DoUnmark(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoUnmark( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; MarkMessages(scrn, Fignore, FALSE); @@ -408,11 +406,11 @@ /*ARGSUSED*/ -void XmhUnmark(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhUnmark( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -421,10 +419,10 @@ /*ARGSUSED*/ -void DoCommit(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoCommit( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; TocCommitChanges(w, (XtPointer) scrn->toc, (XtPointer) NULL); @@ -432,11 +430,11 @@ /*ARGSUSED*/ -void XmhCommitChanges(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhCommitChanges( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -445,11 +443,11 @@ /*ARGSUSED*/ -void XmhShellCommand(w, event, params, num_params) - Widget w; /* any widget on same scrn as the messages */ - XEvent *event; /* unused */ - String *params; /* shell command to execute with msgs appended */ - Cardinal *num_params; +void XmhShellCommand( + Widget w, /* any widget on same scrn as the messages */ + XEvent *event, /* unused */ + String *params, /* shell command to execute with msgs appended */ + Cardinal *num_params) { int i, len, used; MsgList mlist; @@ -512,11 +510,11 @@ } -void XmhPrint(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhPrint( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { if (! num_params || ! *num_params) { /* use the print command specified in application resources */ @@ -533,10 +531,10 @@ /*ARGSUSED*/ -void DoPrint(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoPrint( + Widget w, + XtPointer client_data, + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; Cardinal num_params = 0; @@ -549,10 +547,10 @@ /*ARGSUSED*/ -void DoPack(widget, client_data, call_data) - Widget widget; - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoPack( + Widget widget, + XtPointer client_data, + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -584,11 +582,11 @@ /*ARGSUSED*/ -void XmhPackFolder(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhPackFolder( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -597,10 +595,10 @@ /*ARGSUSED*/ -void DoSort(widget, client_data, call_data) - Widget widget; - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoSort( + Widget widget, + XtPointer client_data, + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -630,11 +628,11 @@ /*ARGSUSED*/ -void XmhSortFolder(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhSortFolder( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -643,11 +641,11 @@ /*ARGSUSED*/ -void XmhForceRescan(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhForceRescan( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -655,10 +653,10 @@ } /*ARGSUSED*/ -void DoForceRescan(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoForceRescan( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -671,11 +669,11 @@ } /*ARGSUSED*/ -void XmhCheckForNewMail(w, e, p, n) - Widget w; - XEvent *e; - String *p; - Cardinal *n; +void XmhCheckForNewMail( + Widget w, + XEvent *e, + String *p, + Cardinal *n) { TocCheckForNewMail(True); } @@ -683,11 +681,11 @@ /* Incorporate new mail. */ /*ARGSUSED*/ -void XmhIncorporateNewMail(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhIncorporateNewMail( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) { @@ -697,10 +695,10 @@ } -void DoIncorporateNewMail(w, client_data, call_data) - Widget w; /* unused */ - XtPointer client_data; /* screen */ - XtPointer call_data; /* unused */ +void DoIncorporateNewMail( + Widget w, /* unused */ + XtPointer client_data, /* screen */ + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -728,10 +726,10 @@ } -void DoReplyMsg(scrn, params, num_params) - Scrn scrn; - String *params; - Cardinal num_params; +static void DoReplyMsg( + Scrn scrn, + String *params, + Cardinal num_params) { Toc toc = scrn->toc; Scrn nscrn; @@ -754,21 +752,21 @@ /*ARGSUSED*/ -void DoReply(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoReply( + Widget w, + XtPointer client_data, + XtPointer call_data) { DoReplyMsg((Scrn) client_data, (String *)NULL, (Cardinal)0); } /*ARGSUSED*/ -void XmhReply(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhReply( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -777,10 +775,10 @@ /*ARGSUSED*/ -void DoPickMessages(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoPickMessages( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -815,11 +813,11 @@ /*ARGSUSED*/ -void XmhPickMessages(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhPickMessages( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -828,10 +826,10 @@ /*ARGSUSED*/ -void DoSelectSequence(widget, client_data, call_data) - Widget widget; /* sequence menu entry object */ - XtPointer client_data; /* the screen */ - XtPointer call_data; +void DoSelectSequence( + Widget widget, /* sequence menu entry object */ + XtPointer client_data, /* the screen */ + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = (Toc) scrn->toc; @@ -854,10 +852,10 @@ /*ARGSUSED*/ -void DoOpenSeq(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoOpenSeq( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; @@ -867,11 +865,11 @@ /*ARGSUSED*/ -void XmhOpenSequence(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhOpenSequence( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Widget entry_object; Scrn scrn = ScrnFromWidget(w); @@ -937,9 +935,7 @@ typedef enum {ADD, REMOVE, DELETE} TwiddleOperation; -static void TwiddleSequence(scrn, op) -Scrn scrn; -TwiddleOperation op; +static void TwiddleSequence(Scrn scrn, TwiddleOperation op) { Toc toc = scrn->toc; char **argv, str[100]; @@ -997,10 +993,10 @@ /*ARGSUSED*/ -void DoAddToSeq(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoAddToSeq( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; TwiddleSequence(scrn, ADD); @@ -1008,11 +1004,11 @@ /*ARGSUSED*/ -void XmhAddToSequence(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhAddToSequence( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (! UserWantsAction(w, scrn)) @@ -1027,10 +1023,10 @@ /*ARGSUSED*/ -void DoRemoveFromSeq(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoRemoveFromSeq( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; TwiddleSequence(scrn, REMOVE); @@ -1038,11 +1034,11 @@ /*ARGSUSED*/ -void XmhRemoveFromSequence(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhRemoveFromSequence( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (UserWantsAction(w, scrn)) @@ -1052,10 +1048,10 @@ /*ARGSUSED*/ -void DoDeleteSeq(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoDeleteSeq( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; TwiddleSequence(scrn, DELETE); @@ -1064,11 +1060,11 @@ /*ARGSUSED*/ -void XmhDeleteSequence(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhDeleteSequence( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (! UserWantsAction(w, scrn)) @@ -1080,4 +1076,3 @@ if (TocHasSequences(scrn->toc)) DoDeleteSeq(w, (XtPointer) scrn, (XtPointer) NULL); } - Index: xc/programs/xmh/tocutil.c diff -u xc/programs/xmh/tocutil.c:3.3 xc/programs/xmh/tocutil.c:3.4 --- xc/programs/xmh/tocutil.c:3.3 Sat Oct 27 23:34:40 2001 +++ xc/programs/xmh/tocutil.c Fri Apr 5 16:06:29 2002 @@ -1,6 +1,6 @@ /* * $XConsortium: tocutil.c,v 2.60 95/01/09 16:52:53 swick Exp $ - * $XFree86: xc/programs/xmh/tocutil.c,v 3.3 2001/10/28 03:34:40 tsi Exp $ + * $XFree86: xc/programs/xmh/tocutil.c,v 3.4 2002/04/05 21:06:29 dickey Exp $ * * * COPYRIGHT 1987, 1989 @@ -37,7 +37,7 @@ extern long lseek(); #endif -Toc TUMalloc() +Toc TUMalloc(void) { Toc toc; toc = XtNew(TocRec); @@ -51,8 +51,7 @@ /* Returns TRUE if the scan file for the given toc is out of date. */ -int TUScanFileOutOfDate(toc) - Toc toc; +int TUScanFileOutOfDate(Toc toc) { return LastModifyDate(toc->path) > toc->lastreaddate; } @@ -62,14 +61,14 @@ * for this toc. */ -void TUCheckSequenceMenu(toc) - Toc toc; +void TUCheckSequenceMenu(Toc toc) { Scrn scrn; register int i, n; Arg query_args[2]; char *name; - int j, numChildren; + Cardinal j; + int numChildren; Widget menu, item; Button button; WidgetList children; @@ -127,8 +126,7 @@ } -void TUScanFileForToc(toc) - Toc toc; +void TUScanFileForToc(Toc toc) { Scrn scrn; char **argv, str[100]; @@ -159,9 +157,7 @@ -int TUGetMsgPosition(toc, msg) - Toc toc; - Msg msg; +int TUGetMsgPosition(Toc toc, Msg msg) { int msgid, h = 0, l, m; char str[100]; @@ -192,8 +188,7 @@ } -void TUResetTocLabel(scrn) - Scrn scrn; +void TUResetTocLabel(Scrn scrn) { char str[500]; Toc toc; @@ -218,8 +213,7 @@ /* A major toc change has occured; redisplay it. (This also should work even if we now have a new source to display stuff from.) */ -void TURedisplayToc(scrn) - Scrn scrn; +void TURedisplayToc(Scrn scrn) { Toc toc; Widget source; @@ -248,8 +242,7 @@ } -void TULoadSeqLists(toc) - Toc toc; +void TULoadSeqLists(Toc toc) { Sequence seq; FILEPTR fid; @@ -310,12 +303,12 @@ /* Refigure what messages are visible. */ -void TURefigureWhatsVisible(toc) -Toc toc; +void TURefigureWhatsVisible(Toc toc) { MsgList mlist; Msg msg, oldcurmsg; - int i, w, changed, newval, msgid; + int i; + int w, changed, newval, msgid; Sequence seq = toc->viewedseq; mlist = seq->mlist; oldcurmsg = toc->curmsg; @@ -361,8 +354,7 @@ ((msg1)->temporary || (msg2)->temporary ||\ strcmp((msg1)->buf, (msg2)->buf) == 0)) -void TULoadTocFile(toc) - Toc toc; +void TULoadTocFile(Toc toc) { int maxmsgs, l, orignummsgs, i, j, origcurmsgid; FILEPTR fid; @@ -403,7 +395,7 @@ msg->msgid = atoi(ptr); do ptr = fgets(buf, bufsiz, fid); - while (ptr && strlen(ptr) == app_resources.toc_width + while (ptr && (int) strlen(ptr) == app_resources.toc_width && buf[bufsiz-2] != '\n'); } else { msg->buf = strcpy(XtMalloc((Cardinal) ++l), ptr); @@ -471,8 +463,7 @@ } -void TUSaveTocFile(toc) - Toc toc; +void TUSaveTocFile(Toc toc) { Msg msg; int fid; @@ -515,8 +506,8 @@ } -static Boolean UpdateScanFile(client_data) - XtPointer client_data; /* Toc */ +static Boolean UpdateScanFile( + XtPointer client_data) /* Toc */ { Toc toc = (Toc)client_data; int i; @@ -535,9 +526,7 @@ } -void TUEnsureScanIsValidAndOpen(toc, delay) - Toc toc; - Boolean delay; +void TUEnsureScanIsValidAndOpen(Toc toc, Boolean delay) { if (toc) { TUGetFullFolderInfo(toc); @@ -565,8 +554,7 @@ /* Refigure all the positions, based on which lines are visible. */ -void TURefigureTocPositions(toc) - Toc toc; +void TURefigureTocPositions(Toc toc) { int i; Msg msg; @@ -587,8 +575,7 @@ /* Make sure we've loaded ALL the folder info for this toc, including its path and sequence lists. */ -void TUGetFullFolderInfo(toc) - Toc toc; +void TUGetFullFolderInfo(Toc toc) { char str[500]; if (! toc->scanfile) { @@ -614,9 +601,7 @@ routine will figure out the message number, and change the scan line accordingly. */ -Msg TUAppendToc(toc, ptr) - Toc toc; - char *ptr; +Msg TUAppendToc(Toc toc, char *ptr) { Msg msg; int msgid; Index: xc/programs/xmh/tocutil.h diff -u xc/programs/xmh/tocutil.h:1.1.1.2 xc/programs/xmh/tocutil.h:1.3 --- xc/programs/xmh/tocutil.h:1.1.1.2 Thu Jan 26 19:28:16 1995 +++ xc/programs/xmh/tocutil.h Sun Jun 30 22:26:05 2002 @@ -23,24 +23,25 @@ * advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/tocutil.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _tocutil_h #define _tocutil_h -extern Toc TUMalloc (/* void */); -extern int TUScanFileOutOfDate (/* Toc */); -extern void TUCheckSequenceMenu (/* Toc */); -extern void TUScanFileForToc (/* Toc */); -extern int TUGetMsgPosition (/* Toc, Msg */); -extern void TUResetTocLabel (/* Scrn */); -extern void TURedisplayToc (/* Scrn */); -extern void TULoadSeqLists (/* Toc */); -extern void TURefigureWhatsVisible (/* Toc */); -extern void TULoadTocFile (/* Toc */); -extern void TUSaveTocFile (/* Toc */); -extern void TUEnsureScanIsValidAndOpen (/* Toc, delay */); -extern void TURefigureTocPositions (/* Toc */); -extern void TUGetFullFolderInfo (/* Toc */); -extern Msg TUAppendToc (/* Toc, char * */); +extern Toc TUMalloc (void); +extern int TUScanFileOutOfDate (Toc); +extern void TUCheckSequenceMenu (Toc); +extern void TUScanFileForToc (Toc); +extern int TUGetMsgPosition (Toc, Msg); +extern void TUResetTocLabel (Scrn); +extern void TURedisplayToc (Scrn); +extern void TULoadSeqLists (Toc); +extern void TURefigureWhatsVisible (Toc); +extern void TULoadTocFile (Toc); +extern void TUSaveTocFile (Toc); +extern void TUEnsureScanIsValidAndOpen (Toc, Boolean); +extern void TURefigureTocPositions (Toc); +extern void TUGetFullFolderInfo (Toc); +extern Msg TUAppendToc (Toc, char *); #endif /* _tocutil_h */ Index: xc/programs/xmh/tsource.c diff -u xc/programs/xmh/tsource.c:1.2 xc/programs/xmh/tsource.c:1.4 --- xc/programs/xmh/tsource.c:1.2 Sat Oct 27 23:34:40 2001 +++ xc/programs/xmh/tsource.c Sat Apr 6 22:57:46 2002 @@ -24,7 +24,7 @@ * or publicity pertaining to distribution of the software without specific, * written prior permission. */ -/* $XFree86: xc/programs/xmh/tsource.c,v 1.2 2001/10/28 03:34:40 tsi Exp $ */ +/* $XFree86: xc/programs/xmh/tsource.c,v 1.4 2002/04/07 03:57:46 tsi Exp $ */ /* File: tsource.c -- the code for a toc source */ @@ -50,9 +50,11 @@ #undef Offset -static void Initialize(); -static XawTextPosition Read(), Scan(), Search(); -static int Replace(); +static void Initialize(Widget, Widget, ArgList, Cardinal *num_args); +static XawTextPosition Read(Widget, XawTextPosition, XawTextBlock *, int); +static XawTextPosition Scan(Widget, XawTextPosition, XawTextScanType, XawTextScanDirection, int, Bool); +static XawTextPosition Search(Widget, XawTextPosition, XawTextScanDirection, XawTextBlock *); +static int Replace(Widget, XawTextPosition, XawTextPosition, XawTextBlock *); #define SuperClass (&textSrcClassRec) TocSourceClassRec tocSourceClassRec = { @@ -114,10 +116,10 @@ * ************************************************************/ -Msg MsgFromPosition(toc, position, dir) - Toc toc; - XawTextPosition position; - XawTextScanDirection dir; +Msg MsgFromPosition( + Toc toc, + XawTextPosition position, + XawTextScanDirection dir) { Msg msg; int h, l, m; @@ -143,20 +145,19 @@ } -static XawTextPosition CoerceToLegalPosition(toc, position) - Toc toc; - XawTextPosition position; +static XawTextPosition +CoerceToLegalPosition(Toc toc, XawTextPosition position) { return (position < 0) ? 0 : ((position > toc->lastPos) ? toc->lastPos : position); } static XawTextPosition -Read(w, position, block, length) -Widget w; -XawTextPosition position; -XawTextBlock *block; -int length; +Read( + Widget w, + XawTextPosition position, + XawTextBlock *block, + int length) { TocSourceWidget source = (TocSourceWidget) w; Toc toc = source->toc_source.toc; @@ -184,10 +185,11 @@ and it can't cross between lines. */ static int -Replace(w, startPos, endPos, block) -Widget w; -XawTextPosition startPos, endPos; -XawTextBlock *block; +Replace( + Widget w, + XawTextPosition startPos, + XawTextPosition endPos, + XawTextBlock *block) { TocSourceWidget source = (TocSourceWidget) w; Toc toc = source->toc_source.toc; @@ -224,13 +226,13 @@ static XawTextPosition -Scan(w, position, sType, dir, count, include) -Widget w; -XawTextPosition position; -XawTextScanType sType; -XawTextScanDirection dir; -int count; -Boolean include; +Scan( + Widget w, + XawTextPosition position, + XawTextScanType sType, + XawTextScanDirection dir, + int count, + Bool include) { TocSourceWidget source = (TocSourceWidget) w; Toc toc = source->toc_source.toc; @@ -298,12 +300,13 @@ } return textindex; } + /*ARGSUSED*/ -static XawTextPosition Search(w, position, direction, block) -Widget w; -XawTextPosition position; -XawTextScanDirection direction; -XawTextBlock *block; +static XawTextPosition Search( + Widget w, + XawTextPosition position, + XawTextScanDirection direction, + XawTextBlock *block) { /* TocSourceWidget source = (TocSourceWidget) w; * Toc toc = source->toc_source.toc; @@ -315,10 +318,11 @@ /* Public definitions. */ /* ARGSUSED*/ -static void Initialize(request, new, args, num_args) -Widget request, new; -ArgList args; -Cardinal *num_args; +static void Initialize( + Widget request, + Widget new, + ArgList args, + Cardinal *num_args) { Toc toc; TocSourceWidget source = (TocSourceWidget) new; @@ -331,10 +335,8 @@ toc->left = toc->right = 0; } -void TSourceInvalid(toc, position, length) - Toc toc; - XawTextPosition position; - int length; +void +TSourceInvalid(Toc toc, XawTextPosition position, int length) { XawTextInvalidate(XtParent(toc->source), position, (XawTextPosition) position+length-1); Index: xc/programs/xmh/tsource.h diff -u xc/programs/xmh/tsource.h:1.1.1.1 xc/programs/xmh/tsource.h:1.3 --- xc/programs/xmh/tsource.h:1.1.1.1 Wed Apr 27 03:12:54 1994 +++ xc/programs/xmh/tsource.h Sun Jun 30 22:26:05 2002 @@ -47,6 +47,7 @@ SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/xmh/tsource.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _tsource_h #define _tsource_h @@ -69,7 +70,8 @@ typedef struct _TocSourceClassRec *TocSourceWidgetClass; typedef struct _TocSourceRec *TocSourceWidget; -extern void TSourceInvalid(); +extern Msg MsgFromPosition(Toc, XawTextPosition, XawTextScanDirection); +extern void TSourceInvalid(Toc, XawTextPosition, int); #endif /* _XawTextSrc_h */ /* DON'T ADD STUFF AFTER THIS #endif */ Index: xc/programs/xmh/util.c diff -u xc/programs/xmh/util.c:3.6 xc/programs/xmh/util.c:3.7 --- xc/programs/xmh/util.c:3.6 Wed Oct 31 17:50:31 2001 +++ xc/programs/xmh/util.c Fri Apr 5 16:06:29 2002 @@ -1,6 +1,6 @@ /* * $XConsortium: util.c /main/42 1996/01/14 16:51:55 kaleb $ - * $XFree86: xc/programs/xmh/util.c,v 3.6 2001/10/31 22:50:31 tsi Exp $ + * $XFree86: xc/programs/xmh/util.c,v 3.7 2002/04/05 21:06:29 dickey Exp $ * * * COPYRIGHT 1987 @@ -39,8 +39,7 @@ #define abs(x) ((x) < 0 ? (-(x)) : (x)) #endif -static char *SysErrorMsg (n) - int n; +static char *SysErrorMsg (int n) { char *s = strerror(n); @@ -49,8 +48,7 @@ /* Something went wrong; panic and quit. */ -void Punt(str) - char *str; +void Punt(char *str) { (void) fprintf( stderr, "%s: %s\nerrno = %d; %s\007\n", progName, str, errno, SysErrorMsg(errno) ); @@ -67,9 +65,7 @@ } -int myopen(path, flags, mode) -char *path; -int flags, mode; +int myopen(char *path, int flags, int mode) { int fid; fid = open(path, flags, mode); @@ -78,8 +74,7 @@ } -FILE *myfopen(path, mode) -char *path, *mode; +FILE *myfopen(char *path, char *mode) { FILE *result; result = fopen(path, mode); @@ -89,15 +84,14 @@ -void myclose(fid) +void myclose(int fid) { if (close(fid) < 0) Punt("Error in myclose!"); DEBUG1( "# %d : <Closed>\n", fid) } -void myfclose(file) -FILE *file; +void myfclose(FILE *file) { int fid = fileno(file); if (fclose(file) < 0) Punt("Error in myfclose!"); @@ -108,7 +102,7 @@ /* Return a unique file name. */ -char *MakeNewTempFileName() +char *MakeNewTempFileName(void) { static char name[60]; static int uniqueid = 0; @@ -122,8 +116,7 @@ /* Make an array of string pointers big enough to hold n+1 entries. */ -char **MakeArgv(n) - int n; +char **MakeArgv(int n) { char **result; result = ((char **) XtMalloc((unsigned) (n+1) * sizeof(char *))); @@ -132,9 +125,7 @@ } -char **ResizeArgv(argv, n) - char **argv; - int n; +char **ResizeArgv(char **argv, int n) { argv = ((char **) XtRealloc((char *) argv, (unsigned) (n+1) * sizeof(char *))); argv[n] = 0; @@ -143,8 +134,7 @@ /* Open a file, and punt if we can't. */ -FILEPTR FOpenAndCheck(name, mode) - char *name, *mode; +FILEPTR FOpenAndCheck(char *name, char *mode) { FILEPTR result; result = myfopen(name, mode); @@ -160,9 +150,7 @@ /* Read one line from a file. */ -static char *DoReadLine(fid, lastchar) - FILEPTR fid; - char lastchar; +static char *DoReadLine(FILEPTR fid, char lastchar) { static char *buf; static int maxlength = 0; @@ -190,8 +178,7 @@ } -char *ReadLine(fid) - FILEPTR fid; +char *ReadLine(FILEPTR fid) { return DoReadLine(fid, 0); } @@ -199,8 +186,7 @@ /* Read a line, and keep the CR at the end. */ -char *ReadLineWithCR(fid) - FILEPTR fid; +char *ReadLineWithCR(FILEPTR fid) { return DoReadLine(fid, '\n'); } @@ -209,8 +195,7 @@ /* Delete a file, and Punt if it fails. */ -void DeleteFileAndCheck(name) - char *name; +void DeleteFileAndCheck(char *name) { if (strcmp(name, "/dev/null") != 0 && unlink(name) == -1) { char str[500]; @@ -220,8 +205,7 @@ } } -void CopyFileAndCheck(from, to) - char *from, *to; +void CopyFileAndCheck(char *from, char *to) { int fromfid, tofid, n; char buf[512]; @@ -241,8 +225,7 @@ } -void RenameAndCheck(from, to) - char *from, *to; +void RenameAndCheck(char *from, char *to) { if (rename(from, to) == -1) { if (errno != EXDEV) { @@ -257,9 +240,7 @@ } -char *CreateGeometry(gbits, x, y, width, height) - int gbits; - int x, y, width, height; +char *CreateGeometry(int gbits, int x, int y, int width, int height) { char *result, str1[10], str2[10], str3[10], str4[10]; if (gbits & WidthValue) @@ -283,46 +264,38 @@ return result; } -int FileExists(file) - char *file; +int FileExists(char *file) { return (access(file, F_OK) == 0); } -long LastModifyDate(file) - char *file; +long LastModifyDate(char *file) { struct stat buf; if (stat(file, &buf)) return -1; return buf.st_mtime; } -int GetFileLength(file) -char *file; +int GetFileLength(char *file) { struct stat buf; if (stat(file, &buf)) return -1; return buf.st_size; } -Boolean IsSubfolder(foldername) - char *foldername; +Boolean IsSubfolder(char *foldername) { return (strchr(foldername, '/')) ? True : False; } -void SetCurrentFolderName(scrn, foldername) - Scrn scrn; - char *foldername; +void SetCurrentFolderName(Scrn scrn, char *foldername) { scrn->curfolder = foldername; ChangeLabel((Widget) scrn->folderlabel, foldername); } -void ChangeLabel(widget, str) -Widget widget; -char *str; +void ChangeLabel(Widget widget, char *str) { static Arg arglist[] = {{XtNlabel, (XtArgVal)NULL}}; arglist[0].value = (XtArgVal) str; @@ -330,11 +303,11 @@ } -Widget CreateTextSW(scrn, name, args, num_args) -Scrn scrn; -char *name; -ArgList args; -Cardinal num_args; +Widget CreateTextSW( + Scrn scrn, + char *name, + ArgList args, + Cardinal num_args) { /* most text widget options are set in the application defaults file */ @@ -343,9 +316,7 @@ } -Widget CreateTitleBar(scrn, name) -Scrn scrn; -char *name; +Widget CreateTitleBar(Scrn scrn, char *name) { Widget result; int height; @@ -360,10 +331,7 @@ return result; } -void Feep(type,volume,win) - int type; - int volume; - Window win; +void Feep(int type, int volume, Window win) { #ifdef XKB XkbStdBell(theDisplay, win, volume, type); @@ -373,8 +341,7 @@ } -MsgList CurMsgListOrCurMsg(toc) - Toc toc; +MsgList CurMsgListOrCurMsg(Toc toc) { MsgList result; Msg curmsg; @@ -387,8 +354,7 @@ } -int GetHeight(w) - Widget w; +int GetHeight(Widget w) { Dimension height; Arg args[1]; @@ -399,8 +365,7 @@ } -int GetWidth(w) - Widget w; +int GetWidth(Widget w) { Dimension width; Arg args[1]; @@ -411,8 +376,7 @@ } -Toc SelectedToc(scrn) -Scrn scrn; +Toc SelectedToc(Scrn scrn) { Toc toc; @@ -424,8 +388,7 @@ } -Toc CurrentToc(scrn) - Scrn scrn; +Toc CurrentToc(Scrn scrn) { /* return the toc currently being viewed */ @@ -433,9 +396,7 @@ } -int strncmpIgnoringCase(str1, str2, length) -char *str1, *str2; -int length; +int strncmpIgnoringCase(char *str1, char *str2, int length) { int i, diff; for (i=0 ; i<length ; i++, str1++, str2++) { @@ -447,9 +408,7 @@ } -void StoreWindowName(scrn, str) -Scrn scrn; -char *str; +void StoreWindowName(Scrn scrn, char *str) { static Arg arglist[] = { {XtNiconName, (XtArgVal) NULL}, @@ -462,8 +421,7 @@ /* Create an input-only window with a busy-wait cursor. */ -void InitBusyCursor(scrn) - Scrn scrn; +void InitBusyCursor(Scrn scrn) { unsigned long valuemask; XSetWindowAttributes attributes; @@ -490,7 +448,7 @@ InputOnly, CopyFromParent, valuemask, &attributes); } -void ShowBusyCursor() +void ShowBusyCursor(void) { register int i; @@ -499,7 +457,7 @@ XMapWindow(theDisplay, scrnList[i]->wait_window); } -void UnshowBusyCursor() +void UnshowBusyCursor(void) { register int i; @@ -509,10 +467,10 @@ } -void SetCursorColor(widget, cursor, foreground) - Widget widget; - Cursor cursor; - unsigned long foreground; +void SetCursorColor( + Widget widget, + Cursor cursor, + unsigned long foreground) { XColor colors[2]; Arg args[2]; @@ -525,4 +483,3 @@ XQueryColors(XtDisplay(widget), cmap, colors, 2); XRecolorCursor(XtDisplay(widget), cursor, &colors[0], &colors[1]); } - Index: xc/programs/xmh/viewfuncs.c diff -u xc/programs/xmh/viewfuncs.c:1.1.1.1 xc/programs/xmh/viewfuncs.c:1.3 --- xc/programs/xmh/viewfuncs.c:1.1.1.1 Wed Apr 27 03:12:55 1994 +++ xc/programs/xmh/viewfuncs.c Sun Jun 30 22:26:05 2002 @@ -24,17 +24,18 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/viewfuncs.c,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ /* view.c -- action procedures to handle viewing of a message */ #include "xmh.h" +#include "actions.h" - /*ARGSUSED*/ -void DoCloseView(widget, client_data, call_data) - Widget widget; /* unused */ - XtPointer client_data; - XtPointer call_data; /* unused */ +void DoCloseView( + Widget widget, /* unused */ + XtPointer client_data, + XtPointer call_data) /* unused */ { Scrn scrn = (Scrn) client_data; XtCallbackRec confirms[2]; @@ -52,21 +53,21 @@ /*ARGSUSED*/ -void XmhCloseView(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhCloseView( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); DoCloseView(w, (XtPointer) scrn, (XtPointer) NULL); } -void DoViewReplyMsg(scrn, params, num_params) - Scrn scrn; - String *params; - Cardinal num_params; +static void DoViewReplyMsg( + Scrn scrn, + String *params, + Cardinal num_params) { Msg msg; Scrn nscrn; @@ -82,10 +83,10 @@ } /*ARGSUSED*/ -void DoViewReply(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoViewReply( + Widget w, + XtPointer client_data, + XtPointer call_data) { DoViewReplyMsg((Scrn) client_data, (String *)NULL, (Cardinal)0); } @@ -93,11 +94,11 @@ /*ARGSUSED*/ -void XmhViewReply(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewReply( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); DoViewReplyMsg(scrn, params, *num_params); @@ -105,10 +106,10 @@ /*ARGSUSED*/ -void DoViewForwardMsg(scrn, params, num_params) - Scrn scrn; - String *params; - Cardinal num_params; +static void DoViewForwardMsg( + Scrn scrn, + String *params, + Cardinal num_params) { MsgList mlist; @@ -119,30 +120,30 @@ } /*ARGSUSED*/ -void DoViewForward(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoViewForward( + Widget w, + XtPointer client_data, + XtPointer call_data) { DoViewForwardMsg((Scrn) client_data, (String *)NULL, (Cardinal)0); } /*ARGSUSED*/ -void XmhViewForward(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewForward( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { DoViewForwardMsg(ScrnFromWidget(w), params, *num_params); } /*ARGSUSED*/ -void DoViewUseAsComposition(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoViewUseAsComposition( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Msg msg; @@ -163,11 +164,11 @@ /*ARGSUSED*/ -void XmhViewUseAsComposition(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewUseAsComposition( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); DoViewUseAsComposition(w, (XtPointer) scrn, (XtPointer) NULL); @@ -175,10 +176,10 @@ /*ARGSUSED*/ -void DoEditView(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoEditView( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Arg args[1]; @@ -192,11 +193,11 @@ /*ARGSUSED*/ -void XmhEditView(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhEditView( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (scrn->msg != NULL && ! MsgGetEditable(scrn->msg)) @@ -205,10 +206,10 @@ /*ARGSUSED*/ -void DoSaveView(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoSaveView( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; Arg args[2]; @@ -223,11 +224,11 @@ /*ARGSUSED*/ -void XmhSaveView(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhSaveView( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (MsgChanged(scrn->msg) || MsgGetReapable(scrn->msg)) @@ -236,10 +237,10 @@ /*ARGSUSED*/ -void DoPrintView(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +void DoPrintView( + Widget w, + XtPointer client_data, + XtPointer call_data) { Scrn scrn = (Scrn) client_data; char **argv; @@ -259,11 +260,11 @@ /*ARGSUSED*/ -void XmhPrintView(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhPrintView( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); DoPrintView(w, (XtPointer) scrn, (XtPointer) NULL); @@ -271,11 +272,11 @@ /*ARGSUSED*/ -void XmhViewMarkDelete(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void XmhViewMarkDelete( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Scrn scrn = ScrnFromWidget(w); if (scrn->msg == NULL) return; Index: xc/programs/xmh/xmh.h diff -u xc/programs/xmh/xmh.h:1.1.1.1 xc/programs/xmh/xmh.h:1.3 --- xc/programs/xmh/xmh.h:1.1.1.1 Wed Apr 27 03:12:51 1994 +++ xc/programs/xmh/xmh.h Sun Jun 30 22:26:05 2002 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/xmh.h,v 1.3 2002/07/01 02:26:05 tsi Exp $ */ #ifndef _xmh_h #define _xmh_h @@ -139,6 +140,7 @@ MsgList mlist; /* Messages in this sequence. */ } SequenceRec, *Sequence; +#define XMH_CB_ARGS Widget, XtPointer, XtPointer #include "globals.h" #include "externs.h" Index: xc/programs/xmodmap/xmodmap.man diff -u xc/programs/xmodmap/xmodmap.man:1.10 xc/programs/xmodmap/xmodmap.man:1.11 --- xc/programs/xmodmap/xmodmap.man:1.10 Fri Dec 14 15:02:13 2001 +++ xc/programs/xmodmap/xmodmap.man Sat Oct 12 12:06:48 2002 @@ -24,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.10 2001/12/14 20:02:13 dawes Exp $ +.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.11 2002/10/12 16:06:48 herrb Exp $ .\" .de EX \"Begin example .ne 5 @@ -122,9 +122,13 @@ .B keycode \fINUMBER\fP = \fIKEYSYMNAME ...\fP The list of keysyms is assigned to the indicated keycode (which may be specified in decimal, hex or octal and can be determined by -running the -.I xev -program. +running the +.I xev +program. Up to eight keysyms may be attached to a key, however the last four +are not used in any major X server implementation. The first keysym is used +when no modifier key is pressed in conjunction with this key, the second with +Shift, the third when the Mode_Switch key is used with this key and the fourth +when both the Mode_Switch and Shift keys are used. .TP 8 .B keycode any = \fIKEYSYMNAME ...\fP If no existing key has the specified list of keysyms assigned to it, @@ -136,10 +140,9 @@ used to perform the corresponding set of \fBkeycode\fP expressions. The list of keysym names may be found in the header file \fI<X11/keysymdef.h>\fP (without the \fIXK_\fP prefix) -or the keysym database \fI<XRoot>/lib/X11/XKeysymDB\fP, where <XRoot> refers -to the root of the X11 install tree. -Note that if the same keysym is bound to multiple keys, the expression is -executed for each matching keycode. +or the keysym database \fI__projectroot__/lib/X11/XKeysymDB\fP. Note that +if the same keysym is bound to multiple keys, the expression is executed +for each matching keycode. .TP 8 .B clear \fIMODIFIERNAME\fP This removes all entries in the modifier map for the given modifier, where Index: xc/programs/xprop/xprop.c diff -u xc/programs/xprop/xprop.c:1.11 xc/programs/xprop/xprop.c:1.12 --- xc/programs/xprop/xprop.c:1.11 Fri Dec 14 15:02:14 2001 +++ xc/programs/xprop/xprop.c Mon Dec 2 17:10:23 2002 @@ -27,7 +27,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xprop/xprop.c,v 1.11 2001/12/14 20:02:14 dawes Exp $ */ +/* $XFree86: xc/programs/xprop/xprop.c,v 1.12 2002/12/02 22:10:23 tsi Exp $ */ #include <X11/Xlib.h> @@ -55,6 +55,7 @@ #include "dsimple.h" #define MAXSTR 10000 +#define MAXELEMENTS 64 #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -1341,9 +1342,9 @@ const char *dformat; int size; char format_char; - Atom type; - unsigned char *data; - int nelements; + Atom type = 0; + unsigned char *data = NULL; + int nelements = 0; atom = Parse_Atom(propname, False); @@ -1379,37 +1380,83 @@ } case 'x': case 'c': { - unsigned long intvalue = strtoul(value, NULL, 0); - static unsigned char data8; - static unsigned short data16; - static unsigned long data32; - type = XA_INTEGER; - switch (size) { - case 8: - data8 = intvalue; data = (unsigned char *) &data8; break; - case 16: - data16 = intvalue; data = (unsigned char *) &data16; break; - case 32: default: - data32 = intvalue; data = (unsigned char *) &data32; break; - } + static unsigned char data8[MAXELEMENTS]; + static unsigned short data16[MAXELEMENTS]; + static unsigned long data32[MAXELEMENTS]; + unsigned long intvalue; + unsigned char * value2 = strdup(value); + unsigned char * tmp = strtok(value2,","); nelements = 1; + intvalue = strtoul(tmp, NULL, 0); + switch(size) { + case 8: + data8[0] = intvalue; data = (unsigned char *) data8; break; + case 16: + data16[0] = intvalue; data = (unsigned char *) data16; break; + case 32: + data32[0] = intvalue; data = (unsigned char *) data32; break; + } + tmp = strtok(NULL,","); + while(tmp != NULL){ + intvalue = strtoul(tmp, NULL,0); + switch(size) { + case 8: + data8[nelements] = intvalue; break; + case 16: + data16[nelements] = intvalue; break; + case 32: + data32[nelements] = intvalue; break; + } + nelements++; + if(nelements == MAXELEMENTS){ + fprintf(stderr, "Maximum number of elements reached (%d). List truncated.\n",MAXELEMENTS); + break; + } + tmp = strtok(NULL,","); + } + + type = XA_CARDINAL; + free(value2); break; } case 'i': { - long intvalue = strtol(value, NULL, 0); - static signed char data8; - static short data16; - static long data32; - type = XA_INTEGER; - switch (size) { - case 8: - data8 = intvalue; data = (unsigned char *) &data8; break; - case 16: - data16 = intvalue; data = (unsigned char *) &data16; break; - case 32: default: - data32 = intvalue; data = (unsigned char *) &data32; break; - } + static unsigned char data8[MAXELEMENTS]; + static unsigned short data16[MAXELEMENTS]; + static unsigned long data32[MAXELEMENTS]; + unsigned long intvalue; + unsigned char * value2 = strdup(value); + unsigned char * tmp = strtok(value2,","); nelements = 1; + intvalue = strtoul(tmp, NULL, 0); + switch(size) { + case 8: + data8[0] = intvalue; data = (unsigned char *) data8; break; + case 16: + data16[0] = intvalue; data = (unsigned char *) data16; break; + case 32: + data32[0] = intvalue; data = (unsigned char *) data32; break; + } + tmp = strtok(NULL,","); + while(tmp != NULL){ + intvalue = strtoul(tmp, NULL,0); + switch(size) { + case 8: + data8[nelements] = intvalue; break; + case 16: + data16[nelements] = intvalue; break; + case 32: + data32[nelements] = intvalue; break; + } + nelements++; + if(nelements == MAXELEMENTS){ + fprintf(stderr, "Maximum number of elements reached (%d). List truncated.\n",MAXELEMENTS); + break; + } + tmp = strtok(NULL,","); + } + + type = XA_INTEGER; + free(value2); break; } case 'b': { Index: xc/programs/xrandr/Imakefile diff -u xc/programs/xrandr/Imakefile:1.3 xc/programs/xrandr/Imakefile:1.4 --- xc/programs/xrandr/Imakefile:1.3 Sun Jun 10 21:40:14 2001 +++ xc/programs/xrandr/Imakefile Sun Sep 29 19:39:47 2002 @@ -1,8 +1,8 @@ -XCOMM $XFree86: xc/programs/xrandr/Imakefile,v 1.3 2001/06/11 01:40:14 keithp Exp $ +XCOMM $XFree86: xc/programs/xrandr/Imakefile,v 1.4 2002/09/29 23:39:47 keithp Exp $ DEFINES=$(RANDRDEFINES) DEPLIBS=$(DEPXRANDRLIB) $(DEPXLIB) -LOCAL_LIBRARIES=$(XRANDRLIB) $(XLIB) +LOCAL_LIBRARIES=$(XRANDRLIB) $(XRENDERLIB) $(XLIB) SRCS=xrandr.c OBJS=xrandr.o Index: xc/programs/xrandr/xrandr.c diff -u xc/programs/xrandr/xrandr.c:1.8 xc/programs/xrandr/xrandr.c:1.12 --- xc/programs/xrandr/xrandr.c:1.8 Wed Jul 11 12:40:32 2001 +++ xc/programs/xrandr/xrandr.c Fri Nov 1 15:04:00 2002 @@ -1,33 +1,37 @@ /* - * $XFree86: xc/programs/xrandr/xrandr.c,v 1.8 2001/07/11 16:40:32 keithp Exp $ + * $XFree86: xc/programs/xrandr/xrandr.c,v 1.12 2002/11/01 20:04:00 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. - * Copyright © 2001 Compaq Computer Corporation + * Copyright © 2002 Hewlett Pacard Company, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard or Compaq not be used in + * documentation, and that the name of Keith Packard or HP not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. Keith Packard and HP makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD and COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * KEITH PACKARD and HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. - * Blame Jim Gettys for any bugs... + * + * Blame Jim Gettys for any bugs; he wrote most of the client side code, + * and part of the server code for randr. */ #include <stdio.h> #include <X11/Xlib.h> +#include <X11/Xlibint.h> #include <X11/Xproto.h> #include <X11/extensions/Xrandr.h> +#include <X11/extensions/Xrender.h> /* we share subpixel information */ #include <string.h> #include <stdlib.h> @@ -40,6 +44,15 @@ "right", "\n"}; +/* subpixel order */ +static char *order[6] = { + "unknown", + "horizontal rgb", + "horizontal bgr", + "vertical rgb", + "vertical bgr", + "no subpixels"}; + static void usage(void) @@ -49,11 +62,15 @@ fprintf(stderr, " -display <display> or -d <display>\n"); fprintf(stderr, " -help\n"); fprintf(stderr, " -o <normal,inverted,left,right,0,1,2,3>\n"); - fprintf(stderr, " or --orientation <normal,inverted,left,right,0,1,2,3>\n"); - fprintf(stderr, " -q or --query\n"); - fprintf(stderr, " -s <size> or --size <size>\n"); - fprintf(stderr, " -v or --verbose\n"); - fprintf(stderr, " or --screen <screen>\n"); + fprintf(stderr, " or --orientation <normal,inverted,left,right,0,1,2,3>\n"); + fprintf(stderr, " -q or --query\n"); + fprintf(stderr, " -s <size>/<width>x<height> or --size <size>/<width>x<height>\n"); + fprintf(stderr, " -r <rate> or --rate <rate>\n"); + fprintf(stderr, " -v or --version\n"); + fprintf(stderr, " -x (reflect in x)\n"); + fprintf(stderr, " -y (reflect in y)\n"); + fprintf(stderr, " --screen <screen>\n"); + fprintf(stderr, " --verbose\n"); exit(1); /*NOTREACHED*/ @@ -66,20 +83,29 @@ XRRScreenSize *sizes; XRRScreenConfiguration *sc; int nsize; + int nrate; + short *rates; Window root; Status status = RRSetConfigFailed; int rot = -1; int verbose = 0, query = 0; Rotation rotation, current_rotation, rotations; - XRRScreenChangeNotifyEvent event; + XEvent event; + XRRScreenChangeNotifyEvent *sce; char *display_name = NULL; - int i; + int i, j; SizeID current_size; - VisualGroupID current_visual_group; + short current_rate; + int rate = -1; int size = -1; int dirind = 0; int setit = 0; int screen = -1; + int version = 0; + int event_base, error_base; + int reflection = 0; + int width = 0, height = 0; + int have_pixel_size = 0; program_name = argv[0]; if (argc == 1) query = 1; @@ -91,18 +117,48 @@ } if (!strcmp("-help", argv[i])) { usage(); + continue; } - if (!strcmp ("-v", argv[i]) || !strcmp ("--verbose", argv[i])) { + if (!strcmp ("--verbose", argv[i])) { verbose = 1; continue; } + if (!strcmp ("-s", argv[i]) || !strcmp ("--size", argv[i])) { + if (++i>=argc) usage (); + if (sscanf (argv[i], "%dx%d", &width, &height) == 2) + have_pixel_size = 1; + else { + size = atoi (argv[i]); + if (size < 0) usage(); + } + setit = 1; + continue; + } + + if (!strcmp ("-r", argv[i]) || !strcmp ("--rate", argv[i])) { if (++i>=argc) usage (); - size = atoi (argv[i]); - if (size < 0) usage(); + rate = atoi (argv[i]); + if (rate < 0) usage(); + setit = 1; + continue; + } + + if (!strcmp ("-v", argv[i]) || !strcmp ("--version", argv[i])) { + version = 1; + continue; + } + + if (!strcmp ("-x", argv[i])) { + reflection |= RR_Reflect_X; setit = 1; continue; } + if (!strcmp ("-y", argv[i])) { + reflection |= RR_Reflect_Y; + setit = 1; + continue; + } if (!strcmp ("--screen", argv[i])) { if (++i>=argc) usage (); screen = atoi (argv[i]); @@ -132,6 +188,7 @@ if (verbose) query = 1; dpy = XOpenDisplay (display_name); + if (dpy == NULL) { fprintf (stderr, "Can't open display %s\n", display_name); exit (1); @@ -151,61 +208,170 @@ if (sc == NULL) exit (1); - current_size = XRRCurrentConfig (sc, ¤t_visual_group, ¤t_rotation); - if (size < 0) + current_size = XRRConfigCurrentConfiguration (sc, ¤t_rotation); + + sizes = XRRConfigSizes(sc, &nsize); + + if (have_pixel_size) { + for (size = 0; size < nsize; size++) + { + if (sizes[size].width == width && sizes[size].height == height) + break; + } + } + else if (size < 0) size = current_size; + + if (size >= nsize) usage(); + if (rot < 0) { for (rot = 0; rot < 4; rot++) - if (1 << rot == current_rotation) + if (1 << rot == (current_rotation & 0xf)) break; } - sizes = XRRSizes(sc, &nsize); - for (i = 0; i < nsize; i++) { - if (query) - printf ("SZ: Pixels Physical\n%d: %4d x%4d (%4dmm x%4dmm)\n", - i, sizes[i].width, sizes[i].height, - sizes[i].mwidth, sizes[i].mheight); + current_rate = XRRConfigCurrentRate (sc); + + if (rate < 0) + { + if (size == current_size) + rate = current_rate; + else + rate = 0; } - if (size >= nsize) usage(); - rotations = XRRRotations(sc, ¤t_rotation); + if (version) { + int major_version, minor_version; + XRRQueryVersion (dpy, &major_version, &minor_version); + printf("Server reports RandR version %d.%d\n", + major_version, minor_version); + } + + if (query) { + printf(" SZ: Pixels Physical Refresh\n"); + for (i = 0; i < nsize; i++) { + printf ("%c%-2d %5d x %-5d (%4dmm x%4dmm )", + i == current_size ? '*' : ' ', + i, sizes[i].width, sizes[i].height, + sizes[i].mwidth, sizes[i].mheight); + rates = XRRConfigRates (sc, i, &nrate); + if (nrate) printf (" "); + for (j = 0; j < nrate; j++) + printf ("%c%-4d", + i == current_size && rates[j] == current_rate ? '*' : ' ', + rates[j]); + printf ("\n"); + } + } + + rotations = XRRConfigRotations(sc, ¤t_rotation); + rotation = 1 << rot ; if (query) { for (i = 0; i < 4; i ++) { if ((current_rotation >> i) & 1) printf("Current rotation - %s\n", direction[i]); } + + printf("Current reflection - "); + if (current_rotation & (RR_Reflect_X|RR_Reflect_Y)) + { + if (current_rotation & RR_Reflect_X) printf ("X Axis "); + if (current_rotation & RR_Reflect_Y) printf ("Y Axis"); + } + else + printf ("none"); + printf ("\n"); + + printf ("Rotations possible - "); for (i = 0; i < 4; i ++) { if ((rotations >> i) & 1) printf("%s ", direction[i]); } printf ("\n"); + + printf ("Reflections possible - "); + if (rotations & (RR_Reflect_X|RR_Reflect_Y)) + { + if (rotations & RR_Reflect_X) printf ("X Axis "); + if (rotations & RR_Reflect_Y) printf ("Y Axis"); + } + else + printf ("none"); + printf ("\n"); + } + + if (verbose) { + printf("Setting size to %d, rotation to %s\n", size, direction[rot]); + + printf ("Setting reflection on "); + if (reflection) + { + if (reflection & RR_Reflect_X) printf ("X Axis "); + if (reflection & RR_Reflect_Y) printf ("Y Axis"); + } + else + printf ("neither axis"); + printf ("\n"); + + if (reflection & RR_Reflect_X) printf("Setting reflection on X axis\n"); + + if (reflection & RR_Reflect_Y) printf("Setting reflection on Y axis\n"); } - if (verbose) printf("Setting size to %d, rotation to %s\n", - size, direction[rot]); + /* we should test configureNotify on the root window */ + XSelectInput (dpy, root, StructureNotifyMask); - if (setit) XRRScreenChangeSelectInput (dpy, root, True); - if (setit) status = XRRSetScreenConfig (dpy, sc, DefaultRootWindow (dpy), - (SizeID) size, current_visual_group, (Rotation) rotation, CurrentTime); + if (setit) XRRSelectInput (dpy, root, + RRScreenChangeNotifyMask); + if (setit) status = XRRSetScreenConfigAndRate (dpy, sc, + DefaultRootWindow (dpy), + (SizeID) size, (Rotation) (rotation | reflection), rate, CurrentTime); + + XRRQueryExtension(dpy, &event_base, &error_base); if (verbose && setit) { if (status == RRSetConfigSuccess) { + while (1) { + int spo; XNextEvent(dpy, (XEvent *) &event); - printf("Got an event!\n"); - printf(" window = %d\n root = %d\n size_index = %d\n visual_group_index %d\n rotation %d\n", - (int) event.window, (int) event.root, - event.size_index, event.visual_group_index, event.rotation); - printf(" timestamp = %ld, config_timestamp = %ld\n", - event.timestamp, event.config_timestamp); - printf(" %dX%d pixels, %dX%d mm\n", - event.width, event.height, - event.mwidth, event.mheight); + + printf ("Event received, type = %d\n", event.type); + /* update Xlib's knowledge of the event */ + XRRUpdateConfiguration (&event); + if (event.type == ConfigureNotify) + printf("Received ConfigureNotify Event!\n"); + + switch (event.type - event_base) { + case RRScreenChangeNotify: + sce = (XRRScreenChangeNotifyEvent *) &event; + + printf("Got a screen change notify event!\n"); + printf(" window = %d\n root = %d\n size_index = %d\n rotation %d\n", + (int) sce->window, (int) sce->root, + sce->size_index, sce->rotation); + printf(" timestamp = %ld, config_timestamp = %ld\n", + sce->timestamp, sce->config_timestamp); + printf(" Rotation = %x\n", sce->rotation); + printf(" %d X %d pixels, %d X %d mm\n", + sce->width, sce->height, sce->mwidth, sce->mheight); + printf("Display width %d, height %d\n", + DisplayWidth(dpy, screen), DisplayHeight(dpy, screen)); + printf("Display widthmm %d, heightmm %d\n", + DisplayWidthMM(dpy, screen), DisplayHeightMM(dpy, screen)); + spo = sce->subpixel_order; + if ((spo < 0) || (spo > 5)) + printf ("Unknown subpixel order, value = %d\n", spo); + else printf ("new Subpixel rendering model is %s\n", order[spo]); + break; + default: + if (event.type != ConfigureNotify) + printf("unknown event received, type = %d!\n", event.type); + } + } } } - XRRFreeScreenInfo(sc); + XRRFreeScreenConfigInfo(sc); return(0); } - Index: xc/programs/xrandr/xrandr.man diff -u xc/programs/xrandr/xrandr.man:1.2 xc/programs/xrandr/xrandr.man:1.4 --- xc/programs/xrandr/xrandr.man:1.2 Sun Jun 10 21:40:14 2001 +++ xc/programs/xrandr/xrandr.man Wed Oct 2 12:58:05 2002 @@ -20,9 +20,9 @@ .\" PERFORMANCE OF THIS SOFTWARE. .\" .\" -.\" $XFree86: xc/programs/xrandr/xrandr.man,v 1.2 2001/06/11 01:40:14 keithp Exp $ +.\" $XFree86: xc/programs/xrandr/xrandr.man,v 1.4 2002/10/02 16:58:05 keithp Exp $ .\" -.TH XRANDR 1 __vendorversion__ +.TH XRANDR 1 "Version 1.0" "XFree86" .SH NAME xrandr \- primitive command line interface to RandR extension .SH SYNOPSIS @@ -31,29 +31,46 @@ [-o \fIorientation\fP] [-q] [-v] [-s \fIsize\fP] +[-x] [-y] +[--screen \fIsnum\fP] +[--verbose] .SH DESCRIPTION .I Xrandr -is uses to set the screen size and/or orientation. +is uses to set the screen size, orientation and/or reflection. The .I -s option is a small integer index used to specify which size the screen should be set to. To find out what sizes are available, use the .I -q option, which reports the sizes available, the current rotation, and -the possibee rotations. +the possible rotations and reflections. +The default size is the first size specified in the list. The .I -o option is used to specify the orientation of the screen, and can be one of \f"Inormal inverted left right 0 1 2 3"\fP. +.PP The +.I -x +option instructs the server to reflect the screen on the X axis. +The +.I -y +option instructs the server to reflect the screen on the Y axis. +Reflection is applied after rotation. +.PP +The .I -help option prints out a usage summary. +The +.I --verbose +option tells you what xrandr is doing, selects for events, and tells you +when events are received to enable debugging. .SH "SEE ALSO" -RandR(3) +Xrandr(3) .SH AUTHORS -Keith Packard -XFree86 Core Team, SuSE Inc. -.br +Keith Packard, +XFree86 Core Team and Cambridge Research Laboratory, HP Labs, HP. +and Jim Gettys, -Compaq Computer Corporation, Cambridge Research Laboratory +Cambridge Research Laboratory, HP Labs, HP. Index: xc/programs/xrdb/Imakefile diff -u xc/programs/xrdb/Imakefile:3.4 xc/programs/xrdb/Imakefile:3.6 --- xc/programs/xrdb/Imakefile:3.4 Thu Mar 29 21:15:26 2001 +++ xc/programs/xrdb/Imakefile Thu Nov 14 16:01:21 2002 @@ -3,20 +3,16 @@ -XCOMM $XFree86: xc/programs/xrdb/Imakefile,v 3.4 2001/03/30 02:15:26 keithp Exp $ +XCOMM $XFree86: xc/programs/xrdb/Imakefile,v 3.6 2002/11/14 21:01:21 tsi Exp $ -#if PatheticCpp +#ifdef PatheticCpp CPPDEFS = -DPATHETICCPP #endif #if HasMkstemp CPPDEFS = -DHAS_MKSTEMP #endif XCOMM Due to ill make parsing the cpp is passed directly in source file -#ifdef OS2Architecture - DEFINES = $(CPPDEFS) -#else DEFINES = -DCPP="\"$(CPP)\"" $(CPPDEFS) -#endif DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) Index: xc/programs/xrdb/xrdb.c diff -u xc/programs/xrdb/xrdb.c:3.15 xc/programs/xrdb/xrdb.c:3.16 --- xc/programs/xrdb/xrdb.c:3.15 Tue Nov 6 11:11:37 2001 +++ xc/programs/xrdb/xrdb.c Fri May 31 14:46:14 2002 @@ -30,7 +30,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xrdb/xrdb.c,v 3.15 2001/11/06 16:11:37 alanh Exp $ */ +/* $XFree86: xc/programs/xrdb/xrdb.c,v 3.16 2002/05/31 18:46:14 dawes Exp $ */ /* * this program is used to load, or dump the resource manager database @@ -55,12 +55,12 @@ #define SCREEN_RESOURCES "SCREEN_RESOURCES" #ifndef CPP -#ifdef __EMX__ +#ifdef __UNIXOS2__ /* expected to be in path */ #define CPP "cpp" #else #define CPP "/usr/lib/cpp" -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ #endif /* CPP */ #define INIT_BUFFER_SIZE 10000 @@ -887,10 +887,10 @@ strcpy(tmpname2, "xrdbD_XXXXXX"); strcpy(tmpname3, "\\temp\\xrdbD_XXXXXX"); #else -#ifdef __EMX__ +#ifdef __UNIXOS2__ { char *tmpdir=getenv("TMP"); - if (!tmpdir) tmpdir="\\"; - sprintf(tmpname2, "%s\\xrdbD_XXXXXX",tmpdir); + if (!tmpdir) tmpdir="/"; + sprintf(tmpname2, "%s/xrdbD_XXXXXX",tmpdir); } #else strcpy(tmpname2, "/tmp/xrdbD_XXXXXX"); @@ -912,10 +912,10 @@ #ifdef WIN32 strcpy(tmpname, "\\temp\\xrdb_XXXXXX"); #else -#ifdef __EMX__ +#ifdef __UNIXOS2__ { char *tmpdir=getenv("TMP"); - if (!tmpdir) tmpdir="\\"; - sprintf(tmpname, "%s\\xrdb_XXXXXX",tmpdir); + if (!tmpdir) tmpdir="/"; + sprintf(tmpname, "%s/xrdb_XXXXXX",tmpdir); } #else strcpy(tmpname, "/tmp/xrdb_XXXXXX"); Index: xc/programs/xrx/Imakefile diff -u xc/programs/xrx/Imakefile:1.5 xc/programs/xrx/Imakefile:1.6 --- xc/programs/xrx/Imakefile:1.5 Wed Jan 17 18:46:23 2001 +++ xc/programs/xrx/Imakefile Fri Nov 22 17:56:05 2002 @@ -1,8 +1,13 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/xrx/Imakefile,v 1.6 2002/11/22 22:56:05 tsi Exp $ + #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" -#if BuildPlugin && !VendorHasX11R6_3libXext +#if BuildPlugin && !defined(VendorHasX11R6_3libXext) LIBXPLUGINDIR = libxplugin #endif Index: xc/programs/xrx/libxplugin/Imakefile diff -u xc/programs/xrx/libxplugin/Imakefile:1.1.1.3 xc/programs/xrx/libxplugin/Imakefile:1.2 --- xc/programs/xrx/libxplugin/Imakefile:1.1.1.3 Tue Jan 16 18:02:57 2001 +++ xc/programs/xrx/libxplugin/Imakefile Fri Nov 22 17:56:05 2002 @@ -1,5 +1,9 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ + + +XCOMM $XFree86: xc/programs/xrx/libxplugin/Imakefile,v 1.2 2002/11/22 22:56:05 tsi Exp $ + #if defined(SGIArchitecture) && (OSMajorVersion > 5) /* Even though we want to build the distribution with -n32, Navigator 3.0 @@ -39,13 +43,13 @@ #if defined(HPArchitecture) || defined(SunArchitecture) #if defined(HPArchitecture) || \ (defined(SunArchitecture) && \ - OSMajorVersion == 4 || (OSMajorVerion == 5 && OSMinorVersion < 6)) + (OSMajorVersion == 4) || ((OSMajorVersion == 5) && (OSMinorVersion < 6))) ICEOBJS = accept.o authutil.o connect.o error.o getauth.o \ iceauth.o listen.o listenwk.o locking.o misc.o \ ping.o process.o protosetup.o register.o replywait.o \ setauth.o shutdown.o transport.o watch.o #endif -#if defined(SunArchitecture) && OSMajorVersion == 4 +#if defined(SunArchitecture) && (OSMajorVersion == 4) SUNOSOBJS = extutil.o globals.o #endif #endif @@ -58,7 +62,7 @@ #if defined(HPArchitecture) || defined(SunArchitecture) #if defined(HPArchitecture) || \ (defined(SunArchitecture) && \ - OSMajorVersion == 4 || (OSMajorVersion == 5 && OSMinorVersion < 6)) + (OSMajorVersion == 4) || ((OSMajorVersion == 5) && (OSMinorVersion < 6))) accept.o:: RemoveFile($@) $(LN) $(ICESRC)/$@ . @@ -135,7 +139,7 @@ RemoveFile($@) $(LN) $(ICESRC)/$@ . #endif -#if defined(SunArchitecture) && OSMajorVersion == 4 +#if defined(SunArchitecture) && (OSMajorVersion == 4) extutil.o:: RemoveFile($@) $(LN) $(XEXTLIBSRC)/$@ . Index: xc/programs/xrx/plugin/Imakefile diff -u xc/programs/xrx/plugin/Imakefile:1.11 xc/programs/xrx/plugin/Imakefile:1.13 --- xc/programs/xrx/plugin/Imakefile:1.11 Wed Nov 21 17:54:17 2001 +++ xc/programs/xrx/plugin/Imakefile Fri Nov 22 17:56:06 2002 @@ -3,8 +3,10 @@ -XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.11 2001/11/21 22:54:17 dawes Exp $ +XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.13 2002/11/22 22:56:06 tsi Exp $ +#if HasSharedLibraries + XCOMM This isn't an option we must build a shared lib #define DoSharedLib YES @@ -174,3 +176,5 @@ $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) shr.o $(DESTDIR)$(SHLIBDIR)/lib$(LIBNAME).so $(RM) $(DESTDIR)$(SHLIBDIR)/lib$(LIBNAME).a #endif + +#endif /* HasSharedLibraries */ Index: xc/programs/xset/xset.c diff -u xc/programs/xset/xset.c:3.25 xc/programs/xset/xset.c:3.30 --- xc/programs/xset/xset.c:3.25 Fri Dec 14 15:02:22 2001 +++ xc/programs/xset/xset.c Thu Feb 6 13:48:17 2003 @@ -27,7 +27,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xset/xset.c,v 3.25 2001/12/14 20:02:22 dawes Exp $ */ +/* $XFree86: xc/programs/xset/xset.c,v 3.30 2003/02/06 18:48:17 dawes Exp $ */ /* Modified by Stephen so keyboard rate is set using XKB extensions */ #include <stdio.h> @@ -556,7 +556,7 @@ # define Usleep(us) usleep((us)) # endif #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ # define Usleep(us) _sleep2((us / 1000 > 0) ? us / 1000 : 1) #endif #ifdef WIN32 @@ -1091,7 +1091,9 @@ static void xkbset_repeatrate(Display *dpy, int delay, int interval) { - XkbDescPtr xkb = XkbGetKeyboard(dpy,XkbControlsMask,XkbUseCoreKbd); + XkbDescPtr xkb = XkbAllocKeyboard(); + if (!xkb) + return; XkbGetControls(dpy, XkbRepeatKeysMask, xkb); xkb->ctrls->repeat_delay = delay; xkb->ctrls->repeat_interval = interval; @@ -1249,7 +1251,7 @@ values.key_click_percent, values.led_mask); #ifdef XKB if (XkbQueryExtension(dpy, &xkbopcode, &xkbevent, &xkberror, &xkbmajor, &xkbminor) - && (xkb = XkbGetKeyboard(dpy,XkbControlsMask,XkbUseCoreKbd)) != NULL + && (xkb = XkbAllocKeyboard()) != NULL && XkbGetControls(dpy, XkbRepeatKeysMask, xkb) == Success) printf (" auto repeat delay: %d repeat rate: %d\n", xkb->ctrls->repeat_delay, 1000/xkb->ctrls->repeat_interval); @@ -1377,6 +1379,23 @@ } } #endif +#ifdef XF86MISC +{ + int dummy; + int maj, min; + XF86MiscFilePaths paths; + + if (XF86MiscQueryExtension(dpy, &dummy, &dummy) && + XF86MiscQueryVersion(dpy, &maj, &min) && + ((maj > 0) || (maj == 0 && min >= 7)) && + XF86MiscGetFilePaths(dpy, &paths)) { + printf("File paths:\n"); + printf(" Config file: %s\n", paths.configfile); + printf(" Modules path: %s\n", paths.modulepath); + printf(" Log file: %s\n", paths.logfile); + } +} +#endif return; } @@ -1467,6 +1486,7 @@ fprintf (stderr, "\t force standby \n"); fprintf (stderr, "\t force suspend \n"); fprintf (stderr, "\t force off \n"); + fprintf (stderr, "\t force on \n"); fprintf (stderr, "\t (also implicitly enables DPMS features) \n"); fprintf (stderr, "\t a timeout value of zero disables the mode \n"); #endif Index: xc/programs/xset/xset.man diff -u xc/programs/xset/xset.man:3.14 xc/programs/xset/xset.man:3.15 --- xc/programs/xset/xset.man:3.14 Fri Dec 14 15:02:22 2001 +++ xc/programs/xset/xset.man Tue Nov 12 18:53:35 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xset/xset.man,v 3.14 2001/12/14 20:02:22 dawes Exp $ +.\" $XFree86: xc/programs/xset/xset.man,v 3.15 2002/11/12 23:53:35 dawes Exp $ .\" .TH XSET 1 __xorgversion__ .SH NAME @@ -34,7 +34,7 @@ [-b] [b on/off] [b [\fIvolume\fP [\fIpitch\fP [\fIduration\fP]]] [[-]bc] [-c] [c on/off] [c [\fIvolume\fP]] -[[+-]dpms] [dpms \fIstandby\fP [\fI suspend\fP [\fI off\fP]]] [dpms force standby/suspend/off] +[[+-]dpms] [dpms \fIstandby\fP [\fI suspend\fP [\fI off\fP]]] [dpms force standby/suspend/off/on] [[-+]fp[-+=] \fIpath\fP[,\fIpath\fP[,...]]] [fp default] [fp rehash] [[-]led [\fIinteger\fP]] [led on/off] [m[ouse] [\fIaccel_mult\fP[/\fIaccel_div\fP] [\fIthreshold\fP]]] [m[ouse] default] @@ -107,7 +107,7 @@ set. The option can take up to three numerical values, or the `force' flag followed by a DPMS state. The `force' flags forces the server to immediately switch to the DPMS state specified. The DPMS state can -be one of `standby', `suspend', or `off'. When numerical values are +be one of `standby', `suspend', `off', or `on'. When numerical values are given, they set the inactivity period (in units of seconds) before the three modes are activated. Index: xc/programs/xsm/Imakefile diff -u xc/programs/xsm/Imakefile:1.7 xc/programs/xsm/Imakefile:1.8 --- xc/programs/xsm/Imakefile:1.7 Tue Jul 31 20:45:07 2001 +++ xc/programs/xsm/Imakefile Fri May 31 14:46:14 2002 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xsm/Imakefile,v 1.7 2001/08/01 00:45:07 tsi Exp $ +XCOMM $XFree86: xc/programs/xsm/Imakefile,v 1.8 2002/05/31 18:46:14 dawes Exp $ #if !defined(RshCmd) #if SystemV @@ -35,7 +35,7 @@ INCLUDES = -I. - PROGS1 = xsm + PROGS1 = ProgramTargetName(xsm) PROGRAMS = $(PROGS1) Index: xc/programs/xsm/lock.c diff -u xc/programs/xsm/lock.c:3.4 xc/programs/xsm/lock.c:3.5 --- xc/programs/xsm/lock.c:3.4 Fri Dec 14 15:02:25 2001 +++ xc/programs/xsm/lock.c Fri May 31 14:46:14 2002 @@ -23,7 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/lock.c,v 3.4 2001/12/14 20:02:25 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/lock.c,v 3.5 2002/05/31 18:46:14 dawes Exp $ */ #include "xsm.h" #include "lock.h" @@ -58,7 +58,7 @@ path = GetPath (); -#ifndef __EMX__ +#ifndef __UNIXOS2__ sprintf (lock_file, "%s/.XSMlock-%s", path, session_name); sprintf (temp_lock_file, "%s/.XSMtlock-%s", path, session_name); #else @@ -78,7 +78,7 @@ close (fd); -#ifndef __EMX__ +#ifndef __UNIXOS2__ status = 1; if (link (temp_lock_file, lock_file) < 0) Index: xc/programs/xterm/256colres.h diff -u xc/programs/xterm/256colres.h:1.3 xc/programs/xterm/256colres.h:1.5 --- xc/programs/xterm/256colres.h:1.3 Mon Jun 18 15:09:24 2001 +++ xc/programs/xterm/256colres.h Sat Oct 5 13:57:11 2002 @@ -1,223 +1,227 @@ /* * This header file was generated by ./256colres.pl */ -/* $XFree86: xc/programs/xterm/256colres.h,v 1.3 2001/06/18 19:09:24 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/256colres.h,v 1.5 2002/10/05 17:57:11 dickey Exp $ */ + +#ifndef included_256colres_h +#define included_256colres_h + COLOR_RES("16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), -COLOR_RES("17", screen.Acolors[17], DFT_COLOR("rgb:00/00/2a")), -COLOR_RES("18", screen.Acolors[18], DFT_COLOR("rgb:00/00/55")), -COLOR_RES("19", screen.Acolors[19], DFT_COLOR("rgb:00/00/7f")), -COLOR_RES("20", screen.Acolors[20], DFT_COLOR("rgb:00/00/aa")), -COLOR_RES("21", screen.Acolors[21], DFT_COLOR("rgb:00/00/d4")), -COLOR_RES("22", screen.Acolors[22], DFT_COLOR("rgb:00/2a/00")), -COLOR_RES("23", screen.Acolors[23], DFT_COLOR("rgb:00/2a/2a")), -COLOR_RES("24", screen.Acolors[24], DFT_COLOR("rgb:00/2a/55")), -COLOR_RES("25", screen.Acolors[25], DFT_COLOR("rgb:00/2a/7f")), -COLOR_RES("26", screen.Acolors[26], DFT_COLOR("rgb:00/2a/aa")), -COLOR_RES("27", screen.Acolors[27], DFT_COLOR("rgb:00/2a/d4")), -COLOR_RES("28", screen.Acolors[28], DFT_COLOR("rgb:00/55/00")), -COLOR_RES("29", screen.Acolors[29], DFT_COLOR("rgb:00/55/2a")), -COLOR_RES("30", screen.Acolors[30], DFT_COLOR("rgb:00/55/55")), -COLOR_RES("31", screen.Acolors[31], DFT_COLOR("rgb:00/55/7f")), -COLOR_RES("32", screen.Acolors[32], DFT_COLOR("rgb:00/55/aa")), -COLOR_RES("33", screen.Acolors[33], DFT_COLOR("rgb:00/55/d4")), -COLOR_RES("34", screen.Acolors[34], DFT_COLOR("rgb:00/7f/00")), -COLOR_RES("35", screen.Acolors[35], DFT_COLOR("rgb:00/7f/2a")), -COLOR_RES("36", screen.Acolors[36], DFT_COLOR("rgb:00/7f/55")), -COLOR_RES("37", screen.Acolors[37], DFT_COLOR("rgb:00/7f/7f")), -COLOR_RES("38", screen.Acolors[38], DFT_COLOR("rgb:00/7f/aa")), -COLOR_RES("39", screen.Acolors[39], DFT_COLOR("rgb:00/7f/d4")), -COLOR_RES("40", screen.Acolors[40], DFT_COLOR("rgb:00/aa/00")), -COLOR_RES("41", screen.Acolors[41], DFT_COLOR("rgb:00/aa/2a")), -COLOR_RES("42", screen.Acolors[42], DFT_COLOR("rgb:00/aa/55")), -COLOR_RES("43", screen.Acolors[43], DFT_COLOR("rgb:00/aa/7f")), -COLOR_RES("44", screen.Acolors[44], DFT_COLOR("rgb:00/aa/aa")), -COLOR_RES("45", screen.Acolors[45], DFT_COLOR("rgb:00/aa/d4")), -COLOR_RES("46", screen.Acolors[46], DFT_COLOR("rgb:00/d4/00")), -COLOR_RES("47", screen.Acolors[47], DFT_COLOR("rgb:00/d4/2a")), -COLOR_RES("48", screen.Acolors[48], DFT_COLOR("rgb:00/d4/55")), -COLOR_RES("49", screen.Acolors[49], DFT_COLOR("rgb:00/d4/7f")), -COLOR_RES("50", screen.Acolors[50], DFT_COLOR("rgb:00/d4/aa")), -COLOR_RES("51", screen.Acolors[51], DFT_COLOR("rgb:00/d4/d4")), -COLOR_RES("52", screen.Acolors[52], DFT_COLOR("rgb:2a/00/00")), -COLOR_RES("53", screen.Acolors[53], DFT_COLOR("rgb:2a/00/2a")), -COLOR_RES("54", screen.Acolors[54], DFT_COLOR("rgb:2a/00/55")), -COLOR_RES("55", screen.Acolors[55], DFT_COLOR("rgb:2a/00/7f")), -COLOR_RES("56", screen.Acolors[56], DFT_COLOR("rgb:2a/00/aa")), -COLOR_RES("57", screen.Acolors[57], DFT_COLOR("rgb:2a/00/d4")), -COLOR_RES("58", screen.Acolors[58], DFT_COLOR("rgb:2a/2a/00")), -COLOR_RES("59", screen.Acolors[59], DFT_COLOR("rgb:2a/2a/2a")), -COLOR_RES("60", screen.Acolors[60], DFT_COLOR("rgb:2a/2a/55")), -COLOR_RES("61", screen.Acolors[61], DFT_COLOR("rgb:2a/2a/7f")), -COLOR_RES("62", screen.Acolors[62], DFT_COLOR("rgb:2a/2a/aa")), -COLOR_RES("63", screen.Acolors[63], DFT_COLOR("rgb:2a/2a/d4")), -COLOR_RES("64", screen.Acolors[64], DFT_COLOR("rgb:2a/55/00")), -COLOR_RES("65", screen.Acolors[65], DFT_COLOR("rgb:2a/55/2a")), -COLOR_RES("66", screen.Acolors[66], DFT_COLOR("rgb:2a/55/55")), -COLOR_RES("67", screen.Acolors[67], DFT_COLOR("rgb:2a/55/7f")), -COLOR_RES("68", screen.Acolors[68], DFT_COLOR("rgb:2a/55/aa")), -COLOR_RES("69", screen.Acolors[69], DFT_COLOR("rgb:2a/55/d4")), -COLOR_RES("70", screen.Acolors[70], DFT_COLOR("rgb:2a/7f/00")), -COLOR_RES("71", screen.Acolors[71], DFT_COLOR("rgb:2a/7f/2a")), -COLOR_RES("72", screen.Acolors[72], DFT_COLOR("rgb:2a/7f/55")), -COLOR_RES("73", screen.Acolors[73], DFT_COLOR("rgb:2a/7f/7f")), -COLOR_RES("74", screen.Acolors[74], DFT_COLOR("rgb:2a/7f/aa")), -COLOR_RES("75", screen.Acolors[75], DFT_COLOR("rgb:2a/7f/d4")), -COLOR_RES("76", screen.Acolors[76], DFT_COLOR("rgb:2a/aa/00")), -COLOR_RES("77", screen.Acolors[77], DFT_COLOR("rgb:2a/aa/2a")), -COLOR_RES("78", screen.Acolors[78], DFT_COLOR("rgb:2a/aa/55")), -COLOR_RES("79", screen.Acolors[79], DFT_COLOR("rgb:2a/aa/7f")), -COLOR_RES("80", screen.Acolors[80], DFT_COLOR("rgb:2a/aa/aa")), -COLOR_RES("81", screen.Acolors[81], DFT_COLOR("rgb:2a/aa/d4")), -COLOR_RES("82", screen.Acolors[82], DFT_COLOR("rgb:2a/d4/00")), -COLOR_RES("83", screen.Acolors[83], DFT_COLOR("rgb:2a/d4/2a")), -COLOR_RES("84", screen.Acolors[84], DFT_COLOR("rgb:2a/d4/55")), -COLOR_RES("85", screen.Acolors[85], DFT_COLOR("rgb:2a/d4/7f")), -COLOR_RES("86", screen.Acolors[86], DFT_COLOR("rgb:2a/d4/aa")), -COLOR_RES("87", screen.Acolors[87], DFT_COLOR("rgb:2a/d4/d4")), -COLOR_RES("88", screen.Acolors[88], DFT_COLOR("rgb:55/00/00")), -COLOR_RES("89", screen.Acolors[89], DFT_COLOR("rgb:55/00/2a")), -COLOR_RES("90", screen.Acolors[90], DFT_COLOR("rgb:55/00/55")), -COLOR_RES("91", screen.Acolors[91], DFT_COLOR("rgb:55/00/7f")), -COLOR_RES("92", screen.Acolors[92], DFT_COLOR("rgb:55/00/aa")), -COLOR_RES("93", screen.Acolors[93], DFT_COLOR("rgb:55/00/d4")), -COLOR_RES("94", screen.Acolors[94], DFT_COLOR("rgb:55/2a/00")), -COLOR_RES("95", screen.Acolors[95], DFT_COLOR("rgb:55/2a/2a")), -COLOR_RES("96", screen.Acolors[96], DFT_COLOR("rgb:55/2a/55")), -COLOR_RES("97", screen.Acolors[97], DFT_COLOR("rgb:55/2a/7f")), -COLOR_RES("98", screen.Acolors[98], DFT_COLOR("rgb:55/2a/aa")), -COLOR_RES("99", screen.Acolors[99], DFT_COLOR("rgb:55/2a/d4")), -COLOR_RES("100", screen.Acolors[100], DFT_COLOR("rgb:55/55/00")), -COLOR_RES("101", screen.Acolors[101], DFT_COLOR("rgb:55/55/2a")), -COLOR_RES("102", screen.Acolors[102], DFT_COLOR("rgb:55/55/55")), -COLOR_RES("103", screen.Acolors[103], DFT_COLOR("rgb:55/55/7f")), -COLOR_RES("104", screen.Acolors[104], DFT_COLOR("rgb:55/55/aa")), -COLOR_RES("105", screen.Acolors[105], DFT_COLOR("rgb:55/55/d4")), -COLOR_RES("106", screen.Acolors[106], DFT_COLOR("rgb:55/7f/00")), -COLOR_RES("107", screen.Acolors[107], DFT_COLOR("rgb:55/7f/2a")), -COLOR_RES("108", screen.Acolors[108], DFT_COLOR("rgb:55/7f/55")), -COLOR_RES("109", screen.Acolors[109], DFT_COLOR("rgb:55/7f/7f")), -COLOR_RES("110", screen.Acolors[110], DFT_COLOR("rgb:55/7f/aa")), -COLOR_RES("111", screen.Acolors[111], DFT_COLOR("rgb:55/7f/d4")), -COLOR_RES("112", screen.Acolors[112], DFT_COLOR("rgb:55/aa/00")), -COLOR_RES("113", screen.Acolors[113], DFT_COLOR("rgb:55/aa/2a")), -COLOR_RES("114", screen.Acolors[114], DFT_COLOR("rgb:55/aa/55")), -COLOR_RES("115", screen.Acolors[115], DFT_COLOR("rgb:55/aa/7f")), -COLOR_RES("116", screen.Acolors[116], DFT_COLOR("rgb:55/aa/aa")), -COLOR_RES("117", screen.Acolors[117], DFT_COLOR("rgb:55/aa/d4")), -COLOR_RES("118", screen.Acolors[118], DFT_COLOR("rgb:55/d4/00")), -COLOR_RES("119", screen.Acolors[119], DFT_COLOR("rgb:55/d4/2a")), -COLOR_RES("120", screen.Acolors[120], DFT_COLOR("rgb:55/d4/55")), -COLOR_RES("121", screen.Acolors[121], DFT_COLOR("rgb:55/d4/7f")), -COLOR_RES("122", screen.Acolors[122], DFT_COLOR("rgb:55/d4/aa")), -COLOR_RES("123", screen.Acolors[123], DFT_COLOR("rgb:55/d4/d4")), -COLOR_RES("124", screen.Acolors[124], DFT_COLOR("rgb:7f/00/00")), -COLOR_RES("125", screen.Acolors[125], DFT_COLOR("rgb:7f/00/2a")), -COLOR_RES("126", screen.Acolors[126], DFT_COLOR("rgb:7f/00/55")), -COLOR_RES("127", screen.Acolors[127], DFT_COLOR("rgb:7f/00/7f")), -COLOR_RES("128", screen.Acolors[128], DFT_COLOR("rgb:7f/00/aa")), -COLOR_RES("129", screen.Acolors[129], DFT_COLOR("rgb:7f/00/d4")), -COLOR_RES("130", screen.Acolors[130], DFT_COLOR("rgb:7f/2a/00")), -COLOR_RES("131", screen.Acolors[131], DFT_COLOR("rgb:7f/2a/2a")), -COLOR_RES("132", screen.Acolors[132], DFT_COLOR("rgb:7f/2a/55")), -COLOR_RES("133", screen.Acolors[133], DFT_COLOR("rgb:7f/2a/7f")), -COLOR_RES("134", screen.Acolors[134], DFT_COLOR("rgb:7f/2a/aa")), -COLOR_RES("135", screen.Acolors[135], DFT_COLOR("rgb:7f/2a/d4")), -COLOR_RES("136", screen.Acolors[136], DFT_COLOR("rgb:7f/55/00")), -COLOR_RES("137", screen.Acolors[137], DFT_COLOR("rgb:7f/55/2a")), -COLOR_RES("138", screen.Acolors[138], DFT_COLOR("rgb:7f/55/55")), -COLOR_RES("139", screen.Acolors[139], DFT_COLOR("rgb:7f/55/7f")), -COLOR_RES("140", screen.Acolors[140], DFT_COLOR("rgb:7f/55/aa")), -COLOR_RES("141", screen.Acolors[141], DFT_COLOR("rgb:7f/55/d4")), -COLOR_RES("142", screen.Acolors[142], DFT_COLOR("rgb:7f/7f/00")), -COLOR_RES("143", screen.Acolors[143], DFT_COLOR("rgb:7f/7f/2a")), -COLOR_RES("144", screen.Acolors[144], DFT_COLOR("rgb:7f/7f/55")), -COLOR_RES("145", screen.Acolors[145], DFT_COLOR("rgb:7f/7f/7f")), -COLOR_RES("146", screen.Acolors[146], DFT_COLOR("rgb:7f/7f/aa")), -COLOR_RES("147", screen.Acolors[147], DFT_COLOR("rgb:7f/7f/d4")), -COLOR_RES("148", screen.Acolors[148], DFT_COLOR("rgb:7f/aa/00")), -COLOR_RES("149", screen.Acolors[149], DFT_COLOR("rgb:7f/aa/2a")), -COLOR_RES("150", screen.Acolors[150], DFT_COLOR("rgb:7f/aa/55")), -COLOR_RES("151", screen.Acolors[151], DFT_COLOR("rgb:7f/aa/7f")), -COLOR_RES("152", screen.Acolors[152], DFT_COLOR("rgb:7f/aa/aa")), -COLOR_RES("153", screen.Acolors[153], DFT_COLOR("rgb:7f/aa/d4")), -COLOR_RES("154", screen.Acolors[154], DFT_COLOR("rgb:7f/d4/00")), -COLOR_RES("155", screen.Acolors[155], DFT_COLOR("rgb:7f/d4/2a")), -COLOR_RES("156", screen.Acolors[156], DFT_COLOR("rgb:7f/d4/55")), -COLOR_RES("157", screen.Acolors[157], DFT_COLOR("rgb:7f/d4/7f")), -COLOR_RES("158", screen.Acolors[158], DFT_COLOR("rgb:7f/d4/aa")), -COLOR_RES("159", screen.Acolors[159], DFT_COLOR("rgb:7f/d4/d4")), -COLOR_RES("160", screen.Acolors[160], DFT_COLOR("rgb:aa/00/00")), -COLOR_RES("161", screen.Acolors[161], DFT_COLOR("rgb:aa/00/2a")), -COLOR_RES("162", screen.Acolors[162], DFT_COLOR("rgb:aa/00/55")), -COLOR_RES("163", screen.Acolors[163], DFT_COLOR("rgb:aa/00/7f")), -COLOR_RES("164", screen.Acolors[164], DFT_COLOR("rgb:aa/00/aa")), -COLOR_RES("165", screen.Acolors[165], DFT_COLOR("rgb:aa/00/d4")), -COLOR_RES("166", screen.Acolors[166], DFT_COLOR("rgb:aa/2a/00")), -COLOR_RES("167", screen.Acolors[167], DFT_COLOR("rgb:aa/2a/2a")), -COLOR_RES("168", screen.Acolors[168], DFT_COLOR("rgb:aa/2a/55")), -COLOR_RES("169", screen.Acolors[169], DFT_COLOR("rgb:aa/2a/7f")), -COLOR_RES("170", screen.Acolors[170], DFT_COLOR("rgb:aa/2a/aa")), -COLOR_RES("171", screen.Acolors[171], DFT_COLOR("rgb:aa/2a/d4")), -COLOR_RES("172", screen.Acolors[172], DFT_COLOR("rgb:aa/55/00")), -COLOR_RES("173", screen.Acolors[173], DFT_COLOR("rgb:aa/55/2a")), -COLOR_RES("174", screen.Acolors[174], DFT_COLOR("rgb:aa/55/55")), -COLOR_RES("175", screen.Acolors[175], DFT_COLOR("rgb:aa/55/7f")), -COLOR_RES("176", screen.Acolors[176], DFT_COLOR("rgb:aa/55/aa")), -COLOR_RES("177", screen.Acolors[177], DFT_COLOR("rgb:aa/55/d4")), -COLOR_RES("178", screen.Acolors[178], DFT_COLOR("rgb:aa/7f/00")), -COLOR_RES("179", screen.Acolors[179], DFT_COLOR("rgb:aa/7f/2a")), -COLOR_RES("180", screen.Acolors[180], DFT_COLOR("rgb:aa/7f/55")), -COLOR_RES("181", screen.Acolors[181], DFT_COLOR("rgb:aa/7f/7f")), -COLOR_RES("182", screen.Acolors[182], DFT_COLOR("rgb:aa/7f/aa")), -COLOR_RES("183", screen.Acolors[183], DFT_COLOR("rgb:aa/7f/d4")), -COLOR_RES("184", screen.Acolors[184], DFT_COLOR("rgb:aa/aa/00")), -COLOR_RES("185", screen.Acolors[185], DFT_COLOR("rgb:aa/aa/2a")), -COLOR_RES("186", screen.Acolors[186], DFT_COLOR("rgb:aa/aa/55")), -COLOR_RES("187", screen.Acolors[187], DFT_COLOR("rgb:aa/aa/7f")), -COLOR_RES("188", screen.Acolors[188], DFT_COLOR("rgb:aa/aa/aa")), -COLOR_RES("189", screen.Acolors[189], DFT_COLOR("rgb:aa/aa/d4")), -COLOR_RES("190", screen.Acolors[190], DFT_COLOR("rgb:aa/d4/00")), -COLOR_RES("191", screen.Acolors[191], DFT_COLOR("rgb:aa/d4/2a")), -COLOR_RES("192", screen.Acolors[192], DFT_COLOR("rgb:aa/d4/55")), -COLOR_RES("193", screen.Acolors[193], DFT_COLOR("rgb:aa/d4/7f")), -COLOR_RES("194", screen.Acolors[194], DFT_COLOR("rgb:aa/d4/aa")), -COLOR_RES("195", screen.Acolors[195], DFT_COLOR("rgb:aa/d4/d4")), -COLOR_RES("196", screen.Acolors[196], DFT_COLOR("rgb:d4/00/00")), -COLOR_RES("197", screen.Acolors[197], DFT_COLOR("rgb:d4/00/2a")), -COLOR_RES("198", screen.Acolors[198], DFT_COLOR("rgb:d4/00/55")), -COLOR_RES("199", screen.Acolors[199], DFT_COLOR("rgb:d4/00/7f")), -COLOR_RES("200", screen.Acolors[200], DFT_COLOR("rgb:d4/00/aa")), -COLOR_RES("201", screen.Acolors[201], DFT_COLOR("rgb:d4/00/d4")), -COLOR_RES("202", screen.Acolors[202], DFT_COLOR("rgb:d4/2a/00")), -COLOR_RES("203", screen.Acolors[203], DFT_COLOR("rgb:d4/2a/2a")), -COLOR_RES("204", screen.Acolors[204], DFT_COLOR("rgb:d4/2a/55")), -COLOR_RES("205", screen.Acolors[205], DFT_COLOR("rgb:d4/2a/7f")), -COLOR_RES("206", screen.Acolors[206], DFT_COLOR("rgb:d4/2a/aa")), -COLOR_RES("207", screen.Acolors[207], DFT_COLOR("rgb:d4/2a/d4")), -COLOR_RES("208", screen.Acolors[208], DFT_COLOR("rgb:d4/55/00")), -COLOR_RES("209", screen.Acolors[209], DFT_COLOR("rgb:d4/55/2a")), -COLOR_RES("210", screen.Acolors[210], DFT_COLOR("rgb:d4/55/55")), -COLOR_RES("211", screen.Acolors[211], DFT_COLOR("rgb:d4/55/7f")), -COLOR_RES("212", screen.Acolors[212], DFT_COLOR("rgb:d4/55/aa")), -COLOR_RES("213", screen.Acolors[213], DFT_COLOR("rgb:d4/55/d4")), -COLOR_RES("214", screen.Acolors[214], DFT_COLOR("rgb:d4/7f/00")), -COLOR_RES("215", screen.Acolors[215], DFT_COLOR("rgb:d4/7f/2a")), -COLOR_RES("216", screen.Acolors[216], DFT_COLOR("rgb:d4/7f/55")), -COLOR_RES("217", screen.Acolors[217], DFT_COLOR("rgb:d4/7f/7f")), -COLOR_RES("218", screen.Acolors[218], DFT_COLOR("rgb:d4/7f/aa")), -COLOR_RES("219", screen.Acolors[219], DFT_COLOR("rgb:d4/7f/d4")), -COLOR_RES("220", screen.Acolors[220], DFT_COLOR("rgb:d4/aa/00")), -COLOR_RES("221", screen.Acolors[221], DFT_COLOR("rgb:d4/aa/2a")), -COLOR_RES("222", screen.Acolors[222], DFT_COLOR("rgb:d4/aa/55")), -COLOR_RES("223", screen.Acolors[223], DFT_COLOR("rgb:d4/aa/7f")), -COLOR_RES("224", screen.Acolors[224], DFT_COLOR("rgb:d4/aa/aa")), -COLOR_RES("225", screen.Acolors[225], DFT_COLOR("rgb:d4/aa/d4")), -COLOR_RES("226", screen.Acolors[226], DFT_COLOR("rgb:d4/d4/00")), -COLOR_RES("227", screen.Acolors[227], DFT_COLOR("rgb:d4/d4/2a")), -COLOR_RES("228", screen.Acolors[228], DFT_COLOR("rgb:d4/d4/55")), -COLOR_RES("229", screen.Acolors[229], DFT_COLOR("rgb:d4/d4/7f")), -COLOR_RES("230", screen.Acolors[230], DFT_COLOR("rgb:d4/d4/aa")), -COLOR_RES("231", screen.Acolors[231], DFT_COLOR("rgb:d4/d4/d4")), +COLOR_RES("17", screen.Acolors[17], DFT_COLOR("rgb:00/00/5f")), +COLOR_RES("18", screen.Acolors[18], DFT_COLOR("rgb:00/00/87")), +COLOR_RES("19", screen.Acolors[19], DFT_COLOR("rgb:00/00/af")), +COLOR_RES("20", screen.Acolors[20], DFT_COLOR("rgb:00/00/d7")), +COLOR_RES("21", screen.Acolors[21], DFT_COLOR("rgb:00/00/ff")), +COLOR_RES("22", screen.Acolors[22], DFT_COLOR("rgb:00/5f/00")), +COLOR_RES("23", screen.Acolors[23], DFT_COLOR("rgb:00/5f/5f")), +COLOR_RES("24", screen.Acolors[24], DFT_COLOR("rgb:00/5f/87")), +COLOR_RES("25", screen.Acolors[25], DFT_COLOR("rgb:00/5f/af")), +COLOR_RES("26", screen.Acolors[26], DFT_COLOR("rgb:00/5f/d7")), +COLOR_RES("27", screen.Acolors[27], DFT_COLOR("rgb:00/5f/ff")), +COLOR_RES("28", screen.Acolors[28], DFT_COLOR("rgb:00/87/00")), +COLOR_RES("29", screen.Acolors[29], DFT_COLOR("rgb:00/87/5f")), +COLOR_RES("30", screen.Acolors[30], DFT_COLOR("rgb:00/87/87")), +COLOR_RES("31", screen.Acolors[31], DFT_COLOR("rgb:00/87/af")), +COLOR_RES("32", screen.Acolors[32], DFT_COLOR("rgb:00/87/d7")), +COLOR_RES("33", screen.Acolors[33], DFT_COLOR("rgb:00/87/ff")), +COLOR_RES("34", screen.Acolors[34], DFT_COLOR("rgb:00/af/00")), +COLOR_RES("35", screen.Acolors[35], DFT_COLOR("rgb:00/af/5f")), +COLOR_RES("36", screen.Acolors[36], DFT_COLOR("rgb:00/af/87")), +COLOR_RES("37", screen.Acolors[37], DFT_COLOR("rgb:00/af/af")), +COLOR_RES("38", screen.Acolors[38], DFT_COLOR("rgb:00/af/d7")), +COLOR_RES("39", screen.Acolors[39], DFT_COLOR("rgb:00/af/ff")), +COLOR_RES("40", screen.Acolors[40], DFT_COLOR("rgb:00/d7/00")), +COLOR_RES("41", screen.Acolors[41], DFT_COLOR("rgb:00/d7/5f")), +COLOR_RES("42", screen.Acolors[42], DFT_COLOR("rgb:00/d7/87")), +COLOR_RES("43", screen.Acolors[43], DFT_COLOR("rgb:00/d7/af")), +COLOR_RES("44", screen.Acolors[44], DFT_COLOR("rgb:00/d7/d7")), +COLOR_RES("45", screen.Acolors[45], DFT_COLOR("rgb:00/d7/ff")), +COLOR_RES("46", screen.Acolors[46], DFT_COLOR("rgb:00/ff/00")), +COLOR_RES("47", screen.Acolors[47], DFT_COLOR("rgb:00/ff/5f")), +COLOR_RES("48", screen.Acolors[48], DFT_COLOR("rgb:00/ff/87")), +COLOR_RES("49", screen.Acolors[49], DFT_COLOR("rgb:00/ff/af")), +COLOR_RES("50", screen.Acolors[50], DFT_COLOR("rgb:00/ff/d7")), +COLOR_RES("51", screen.Acolors[51], DFT_COLOR("rgb:00/ff/ff")), +COLOR_RES("52", screen.Acolors[52], DFT_COLOR("rgb:5f/00/00")), +COLOR_RES("53", screen.Acolors[53], DFT_COLOR("rgb:5f/00/5f")), +COLOR_RES("54", screen.Acolors[54], DFT_COLOR("rgb:5f/00/87")), +COLOR_RES("55", screen.Acolors[55], DFT_COLOR("rgb:5f/00/af")), +COLOR_RES("56", screen.Acolors[56], DFT_COLOR("rgb:5f/00/d7")), +COLOR_RES("57", screen.Acolors[57], DFT_COLOR("rgb:5f/00/ff")), +COLOR_RES("58", screen.Acolors[58], DFT_COLOR("rgb:5f/5f/00")), +COLOR_RES("59", screen.Acolors[59], DFT_COLOR("rgb:5f/5f/5f")), +COLOR_RES("60", screen.Acolors[60], DFT_COLOR("rgb:5f/5f/87")), +COLOR_RES("61", screen.Acolors[61], DFT_COLOR("rgb:5f/5f/af")), +COLOR_RES("62", screen.Acolors[62], DFT_COLOR("rgb:5f/5f/d7")), +COLOR_RES("63", screen.Acolors[63], DFT_COLOR("rgb:5f/5f/ff")), +COLOR_RES("64", screen.Acolors[64], DFT_COLOR("rgb:5f/87/00")), +COLOR_RES("65", screen.Acolors[65], DFT_COLOR("rgb:5f/87/5f")), +COLOR_RES("66", screen.Acolors[66], DFT_COLOR("rgb:5f/87/87")), +COLOR_RES("67", screen.Acolors[67], DFT_COLOR("rgb:5f/87/af")), +COLOR_RES("68", screen.Acolors[68], DFT_COLOR("rgb:5f/87/d7")), +COLOR_RES("69", screen.Acolors[69], DFT_COLOR("rgb:5f/87/ff")), +COLOR_RES("70", screen.Acolors[70], DFT_COLOR("rgb:5f/af/00")), +COLOR_RES("71", screen.Acolors[71], DFT_COLOR("rgb:5f/af/5f")), +COLOR_RES("72", screen.Acolors[72], DFT_COLOR("rgb:5f/af/87")), +COLOR_RES("73", screen.Acolors[73], DFT_COLOR("rgb:5f/af/af")), +COLOR_RES("74", screen.Acolors[74], DFT_COLOR("rgb:5f/af/d7")), +COLOR_RES("75", screen.Acolors[75], DFT_COLOR("rgb:5f/af/ff")), +COLOR_RES("76", screen.Acolors[76], DFT_COLOR("rgb:5f/d7/00")), +COLOR_RES("77", screen.Acolors[77], DFT_COLOR("rgb:5f/d7/5f")), +COLOR_RES("78", screen.Acolors[78], DFT_COLOR("rgb:5f/d7/87")), +COLOR_RES("79", screen.Acolors[79], DFT_COLOR("rgb:5f/d7/af")), +COLOR_RES("80", screen.Acolors[80], DFT_COLOR("rgb:5f/d7/d7")), +COLOR_RES("81", screen.Acolors[81], DFT_COLOR("rgb:5f/d7/ff")), +COLOR_RES("82", screen.Acolors[82], DFT_COLOR("rgb:5f/ff/00")), +COLOR_RES("83", screen.Acolors[83], DFT_COLOR("rgb:5f/ff/5f")), +COLOR_RES("84", screen.Acolors[84], DFT_COLOR("rgb:5f/ff/87")), +COLOR_RES("85", screen.Acolors[85], DFT_COLOR("rgb:5f/ff/af")), +COLOR_RES("86", screen.Acolors[86], DFT_COLOR("rgb:5f/ff/d7")), +COLOR_RES("87", screen.Acolors[87], DFT_COLOR("rgb:5f/ff/ff")), +COLOR_RES("88", screen.Acolors[88], DFT_COLOR("rgb:87/00/00")), +COLOR_RES("89", screen.Acolors[89], DFT_COLOR("rgb:87/00/5f")), +COLOR_RES("90", screen.Acolors[90], DFT_COLOR("rgb:87/00/87")), +COLOR_RES("91", screen.Acolors[91], DFT_COLOR("rgb:87/00/af")), +COLOR_RES("92", screen.Acolors[92], DFT_COLOR("rgb:87/00/d7")), +COLOR_RES("93", screen.Acolors[93], DFT_COLOR("rgb:87/00/ff")), +COLOR_RES("94", screen.Acolors[94], DFT_COLOR("rgb:87/5f/00")), +COLOR_RES("95", screen.Acolors[95], DFT_COLOR("rgb:87/5f/5f")), +COLOR_RES("96", screen.Acolors[96], DFT_COLOR("rgb:87/5f/87")), +COLOR_RES("97", screen.Acolors[97], DFT_COLOR("rgb:87/5f/af")), +COLOR_RES("98", screen.Acolors[98], DFT_COLOR("rgb:87/5f/d7")), +COLOR_RES("99", screen.Acolors[99], DFT_COLOR("rgb:87/5f/ff")), +COLOR_RES("100", screen.Acolors[100], DFT_COLOR("rgb:87/87/00")), +COLOR_RES("101", screen.Acolors[101], DFT_COLOR("rgb:87/87/5f")), +COLOR_RES("102", screen.Acolors[102], DFT_COLOR("rgb:87/87/87")), +COLOR_RES("103", screen.Acolors[103], DFT_COLOR("rgb:87/87/af")), +COLOR_RES("104", screen.Acolors[104], DFT_COLOR("rgb:87/87/d7")), +COLOR_RES("105", screen.Acolors[105], DFT_COLOR("rgb:87/87/ff")), +COLOR_RES("106", screen.Acolors[106], DFT_COLOR("rgb:87/af/00")), +COLOR_RES("107", screen.Acolors[107], DFT_COLOR("rgb:87/af/5f")), +COLOR_RES("108", screen.Acolors[108], DFT_COLOR("rgb:87/af/87")), +COLOR_RES("109", screen.Acolors[109], DFT_COLOR("rgb:87/af/af")), +COLOR_RES("110", screen.Acolors[110], DFT_COLOR("rgb:87/af/d7")), +COLOR_RES("111", screen.Acolors[111], DFT_COLOR("rgb:87/af/ff")), +COLOR_RES("112", screen.Acolors[112], DFT_COLOR("rgb:87/d7/00")), +COLOR_RES("113", screen.Acolors[113], DFT_COLOR("rgb:87/d7/5f")), +COLOR_RES("114", screen.Acolors[114], DFT_COLOR("rgb:87/d7/87")), +COLOR_RES("115", screen.Acolors[115], DFT_COLOR("rgb:87/d7/af")), +COLOR_RES("116", screen.Acolors[116], DFT_COLOR("rgb:87/d7/d7")), +COLOR_RES("117", screen.Acolors[117], DFT_COLOR("rgb:87/d7/ff")), +COLOR_RES("118", screen.Acolors[118], DFT_COLOR("rgb:87/ff/00")), +COLOR_RES("119", screen.Acolors[119], DFT_COLOR("rgb:87/ff/5f")), +COLOR_RES("120", screen.Acolors[120], DFT_COLOR("rgb:87/ff/87")), +COLOR_RES("121", screen.Acolors[121], DFT_COLOR("rgb:87/ff/af")), +COLOR_RES("122", screen.Acolors[122], DFT_COLOR("rgb:87/ff/d7")), +COLOR_RES("123", screen.Acolors[123], DFT_COLOR("rgb:87/ff/ff")), +COLOR_RES("124", screen.Acolors[124], DFT_COLOR("rgb:af/00/00")), +COLOR_RES("125", screen.Acolors[125], DFT_COLOR("rgb:af/00/5f")), +COLOR_RES("126", screen.Acolors[126], DFT_COLOR("rgb:af/00/87")), +COLOR_RES("127", screen.Acolors[127], DFT_COLOR("rgb:af/00/af")), +COLOR_RES("128", screen.Acolors[128], DFT_COLOR("rgb:af/00/d7")), +COLOR_RES("129", screen.Acolors[129], DFT_COLOR("rgb:af/00/ff")), +COLOR_RES("130", screen.Acolors[130], DFT_COLOR("rgb:af/5f/00")), +COLOR_RES("131", screen.Acolors[131], DFT_COLOR("rgb:af/5f/5f")), +COLOR_RES("132", screen.Acolors[132], DFT_COLOR("rgb:af/5f/87")), +COLOR_RES("133", screen.Acolors[133], DFT_COLOR("rgb:af/5f/af")), +COLOR_RES("134", screen.Acolors[134], DFT_COLOR("rgb:af/5f/d7")), +COLOR_RES("135", screen.Acolors[135], DFT_COLOR("rgb:af/5f/ff")), +COLOR_RES("136", screen.Acolors[136], DFT_COLOR("rgb:af/87/00")), +COLOR_RES("137", screen.Acolors[137], DFT_COLOR("rgb:af/87/5f")), +COLOR_RES("138", screen.Acolors[138], DFT_COLOR("rgb:af/87/87")), +COLOR_RES("139", screen.Acolors[139], DFT_COLOR("rgb:af/87/af")), +COLOR_RES("140", screen.Acolors[140], DFT_COLOR("rgb:af/87/d7")), +COLOR_RES("141", screen.Acolors[141], DFT_COLOR("rgb:af/87/ff")), +COLOR_RES("142", screen.Acolors[142], DFT_COLOR("rgb:af/af/00")), +COLOR_RES("143", screen.Acolors[143], DFT_COLOR("rgb:af/af/5f")), +COLOR_RES("144", screen.Acolors[144], DFT_COLOR("rgb:af/af/87")), +COLOR_RES("145", screen.Acolors[145], DFT_COLOR("rgb:af/af/af")), +COLOR_RES("146", screen.Acolors[146], DFT_COLOR("rgb:af/af/d7")), +COLOR_RES("147", screen.Acolors[147], DFT_COLOR("rgb:af/af/ff")), +COLOR_RES("148", screen.Acolors[148], DFT_COLOR("rgb:af/d7/00")), +COLOR_RES("149", screen.Acolors[149], DFT_COLOR("rgb:af/d7/5f")), +COLOR_RES("150", screen.Acolors[150], DFT_COLOR("rgb:af/d7/87")), +COLOR_RES("151", screen.Acolors[151], DFT_COLOR("rgb:af/d7/af")), +COLOR_RES("152", screen.Acolors[152], DFT_COLOR("rgb:af/d7/d7")), +COLOR_RES("153", screen.Acolors[153], DFT_COLOR("rgb:af/d7/ff")), +COLOR_RES("154", screen.Acolors[154], DFT_COLOR("rgb:af/ff/00")), +COLOR_RES("155", screen.Acolors[155], DFT_COLOR("rgb:af/ff/5f")), +COLOR_RES("156", screen.Acolors[156], DFT_COLOR("rgb:af/ff/87")), +COLOR_RES("157", screen.Acolors[157], DFT_COLOR("rgb:af/ff/af")), +COLOR_RES("158", screen.Acolors[158], DFT_COLOR("rgb:af/ff/d7")), +COLOR_RES("159", screen.Acolors[159], DFT_COLOR("rgb:af/ff/ff")), +COLOR_RES("160", screen.Acolors[160], DFT_COLOR("rgb:d7/00/00")), +COLOR_RES("161", screen.Acolors[161], DFT_COLOR("rgb:d7/00/5f")), +COLOR_RES("162", screen.Acolors[162], DFT_COLOR("rgb:d7/00/87")), +COLOR_RES("163", screen.Acolors[163], DFT_COLOR("rgb:d7/00/af")), +COLOR_RES("164", screen.Acolors[164], DFT_COLOR("rgb:d7/00/d7")), +COLOR_RES("165", screen.Acolors[165], DFT_COLOR("rgb:d7/00/ff")), +COLOR_RES("166", screen.Acolors[166], DFT_COLOR("rgb:d7/5f/00")), +COLOR_RES("167", screen.Acolors[167], DFT_COLOR("rgb:d7/5f/5f")), +COLOR_RES("168", screen.Acolors[168], DFT_COLOR("rgb:d7/5f/87")), +COLOR_RES("169", screen.Acolors[169], DFT_COLOR("rgb:d7/5f/af")), +COLOR_RES("170", screen.Acolors[170], DFT_COLOR("rgb:d7/5f/d7")), +COLOR_RES("171", screen.Acolors[171], DFT_COLOR("rgb:d7/5f/ff")), +COLOR_RES("172", screen.Acolors[172], DFT_COLOR("rgb:d7/87/00")), +COLOR_RES("173", screen.Acolors[173], DFT_COLOR("rgb:d7/87/5f")), +COLOR_RES("174", screen.Acolors[174], DFT_COLOR("rgb:d7/87/87")), +COLOR_RES("175", screen.Acolors[175], DFT_COLOR("rgb:d7/87/af")), +COLOR_RES("176", screen.Acolors[176], DFT_COLOR("rgb:d7/87/d7")), +COLOR_RES("177", screen.Acolors[177], DFT_COLOR("rgb:d7/87/ff")), +COLOR_RES("178", screen.Acolors[178], DFT_COLOR("rgb:d7/af/00")), +COLOR_RES("179", screen.Acolors[179], DFT_COLOR("rgb:d7/af/5f")), +COLOR_RES("180", screen.Acolors[180], DFT_COLOR("rgb:d7/af/87")), +COLOR_RES("181", screen.Acolors[181], DFT_COLOR("rgb:d7/af/af")), +COLOR_RES("182", screen.Acolors[182], DFT_COLOR("rgb:d7/af/d7")), +COLOR_RES("183", screen.Acolors[183], DFT_COLOR("rgb:d7/af/ff")), +COLOR_RES("184", screen.Acolors[184], DFT_COLOR("rgb:d7/d7/00")), +COLOR_RES("185", screen.Acolors[185], DFT_COLOR("rgb:d7/d7/5f")), +COLOR_RES("186", screen.Acolors[186], DFT_COLOR("rgb:d7/d7/87")), +COLOR_RES("187", screen.Acolors[187], DFT_COLOR("rgb:d7/d7/af")), +COLOR_RES("188", screen.Acolors[188], DFT_COLOR("rgb:d7/d7/d7")), +COLOR_RES("189", screen.Acolors[189], DFT_COLOR("rgb:d7/d7/ff")), +COLOR_RES("190", screen.Acolors[190], DFT_COLOR("rgb:d7/ff/00")), +COLOR_RES("191", screen.Acolors[191], DFT_COLOR("rgb:d7/ff/5f")), +COLOR_RES("192", screen.Acolors[192], DFT_COLOR("rgb:d7/ff/87")), +COLOR_RES("193", screen.Acolors[193], DFT_COLOR("rgb:d7/ff/af")), +COLOR_RES("194", screen.Acolors[194], DFT_COLOR("rgb:d7/ff/d7")), +COLOR_RES("195", screen.Acolors[195], DFT_COLOR("rgb:d7/ff/ff")), +COLOR_RES("196", screen.Acolors[196], DFT_COLOR("rgb:ff/00/00")), +COLOR_RES("197", screen.Acolors[197], DFT_COLOR("rgb:ff/00/5f")), +COLOR_RES("198", screen.Acolors[198], DFT_COLOR("rgb:ff/00/87")), +COLOR_RES("199", screen.Acolors[199], DFT_COLOR("rgb:ff/00/af")), +COLOR_RES("200", screen.Acolors[200], DFT_COLOR("rgb:ff/00/d7")), +COLOR_RES("201", screen.Acolors[201], DFT_COLOR("rgb:ff/00/ff")), +COLOR_RES("202", screen.Acolors[202], DFT_COLOR("rgb:ff/5f/00")), +COLOR_RES("203", screen.Acolors[203], DFT_COLOR("rgb:ff/5f/5f")), +COLOR_RES("204", screen.Acolors[204], DFT_COLOR("rgb:ff/5f/87")), +COLOR_RES("205", screen.Acolors[205], DFT_COLOR("rgb:ff/5f/af")), +COLOR_RES("206", screen.Acolors[206], DFT_COLOR("rgb:ff/5f/d7")), +COLOR_RES("207", screen.Acolors[207], DFT_COLOR("rgb:ff/5f/ff")), +COLOR_RES("208", screen.Acolors[208], DFT_COLOR("rgb:ff/87/00")), +COLOR_RES("209", screen.Acolors[209], DFT_COLOR("rgb:ff/87/5f")), +COLOR_RES("210", screen.Acolors[210], DFT_COLOR("rgb:ff/87/87")), +COLOR_RES("211", screen.Acolors[211], DFT_COLOR("rgb:ff/87/af")), +COLOR_RES("212", screen.Acolors[212], DFT_COLOR("rgb:ff/87/d7")), +COLOR_RES("213", screen.Acolors[213], DFT_COLOR("rgb:ff/87/ff")), +COLOR_RES("214", screen.Acolors[214], DFT_COLOR("rgb:ff/af/00")), +COLOR_RES("215", screen.Acolors[215], DFT_COLOR("rgb:ff/af/5f")), +COLOR_RES("216", screen.Acolors[216], DFT_COLOR("rgb:ff/af/87")), +COLOR_RES("217", screen.Acolors[217], DFT_COLOR("rgb:ff/af/af")), +COLOR_RES("218", screen.Acolors[218], DFT_COLOR("rgb:ff/af/d7")), +COLOR_RES("219", screen.Acolors[219], DFT_COLOR("rgb:ff/af/ff")), +COLOR_RES("220", screen.Acolors[220], DFT_COLOR("rgb:ff/d7/00")), +COLOR_RES("221", screen.Acolors[221], DFT_COLOR("rgb:ff/d7/5f")), +COLOR_RES("222", screen.Acolors[222], DFT_COLOR("rgb:ff/d7/87")), +COLOR_RES("223", screen.Acolors[223], DFT_COLOR("rgb:ff/d7/af")), +COLOR_RES("224", screen.Acolors[224], DFT_COLOR("rgb:ff/d7/d7")), +COLOR_RES("225", screen.Acolors[225], DFT_COLOR("rgb:ff/d7/ff")), +COLOR_RES("226", screen.Acolors[226], DFT_COLOR("rgb:ff/ff/00")), +COLOR_RES("227", screen.Acolors[227], DFT_COLOR("rgb:ff/ff/5f")), +COLOR_RES("228", screen.Acolors[228], DFT_COLOR("rgb:ff/ff/87")), +COLOR_RES("229", screen.Acolors[229], DFT_COLOR("rgb:ff/ff/af")), +COLOR_RES("230", screen.Acolors[230], DFT_COLOR("rgb:ff/ff/d7")), +COLOR_RES("231", screen.Acolors[231], DFT_COLOR("rgb:ff/ff/ff")), COLOR_RES("232", screen.Acolors[232], DFT_COLOR("rgb:08/08/08")), COLOR_RES("233", screen.Acolors[233], DFT_COLOR("rgb:12/12/12")), COLOR_RES("234", screen.Acolors[234], DFT_COLOR("rgb:1c/1c/1c")), @@ -242,3 +246,5 @@ COLOR_RES("253", screen.Acolors[253], DFT_COLOR("rgb:da/da/da")), COLOR_RES("254", screen.Acolors[254], DFT_COLOR("rgb:e4/e4/e4")), COLOR_RES("255", screen.Acolors[255], DFT_COLOR("rgb:ee/ee/ee")), + +#endif /* included_256colres_h */ Index: xc/programs/xterm/256colres.pl diff -u xc/programs/xterm/256colres.pl:1.6 xc/programs/xterm/256colres.pl:1.8 --- xc/programs/xterm/256colres.pl:1.6 Mon Jun 18 15:09:25 2001 +++ xc/programs/xterm/256colres.pl Sat Oct 5 13:57:11 2002 @@ -1,6 +1,6 @@ #! /usr/bin/perl # Author: Thomas E. Dickey -# $XFree86: xc/programs/xterm/256colres.pl,v 1.6 2001/06/18 19:09:25 dickey Exp $ +# $XFree86: xc/programs/xterm/256colres.pl,v 1.8 2002/10/05 17:57:11 dickey Exp $ # Construct a header file defining default resources for the 256-color model # of xterm. This is modeled after the 256colors2.pl script. @@ -14,6 +14,10 @@ * This header file was generated by $0 */ /* \$XFree86\$ */ + +#ifndef included_256colres_h +#define included_256colres_h + EOF $line1="COLOR_RES(\"%d\","; @@ -28,9 +32,9 @@ printf($line1, $code); printf($line2, $code); printf($line3, - int ($red * 42.5), - int ($green * 42.5), - int ($blue * 42.5)); + ($red ? ($red * 40 + 55) : 0), + ($green ? ($green * 40 + 55) : 0), + ($blue ? ($blue * 40 + 55) : 0)); } } } @@ -46,3 +50,8 @@ printf($line3, $level, $level, $level); } + +print <<EOF; + +#endif /* included_256colres_h */ +EOF Index: xc/programs/xterm/88colres.h diff -u xc/programs/xterm/88colres.h:1.3 xc/programs/xterm/88colres.h:1.4 --- xc/programs/xterm/88colres.h:1.3 Mon Jun 18 15:09:25 2001 +++ xc/programs/xterm/88colres.h Sat Oct 5 13:57:11 2002 @@ -1,7 +1,11 @@ /* * This header file was generated by ./88colres.pl */ -/* $XFree86: xc/programs/xterm/88colres.h,v 1.3 2001/06/18 19:09:25 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/88colres.h,v 1.4 2002/10/05 17:57:11 dickey Exp $ */ + +#ifndef included_88colres_h +#define included_88colres_h + COLOR_RES("16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), COLOR_RES("17", screen.Acolors[17], DFT_COLOR("rgb:00/00/8b")), COLOR_RES("18", screen.Acolors[18], DFT_COLOR("rgb:00/00/cd")), @@ -74,3 +78,5 @@ COLOR_RES("85", screen.Acolors[85], DFT_COLOR("rgb:b9/b9/b9")), COLOR_RES("86", screen.Acolors[86], DFT_COLOR("rgb:d0/d0/d0")), COLOR_RES("87", screen.Acolors[87], DFT_COLOR("rgb:e7/e7/e7")), + +#endif /* included_88colres_h */ Index: xc/programs/xterm/88colres.pl diff -u xc/programs/xterm/88colres.pl:1.4 xc/programs/xterm/88colres.pl:1.6 --- xc/programs/xterm/88colres.pl:1.4 Mon Jun 18 15:09:25 2001 +++ xc/programs/xterm/88colres.pl Sat Oct 5 13:57:11 2002 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Author: Steve Wall <steve_wall@redcom.com> -# $XFree86: xc/programs/xterm/88colres.pl,v 1.4 2001/06/18 19:09:25 dickey Exp $ +# Author: Steve Wall +# $XFree86: xc/programs/xterm/88colres.pl,v 1.6 2002/10/05 17:57:11 dickey Exp $ # Made from 256colres.pl # Construct a header file defining default resources for the @@ -15,6 +15,10 @@ * This header file was generated by $0 */ /* \$XFree86\$ */ + +#ifndef included_88colres_h +#define included_88colres_h + EOF $line1="COLOR_RES(\"%d\","; @@ -48,3 +52,8 @@ printf($line3, int($level), int($level), int($level)); } + +print <<EOF; + +#endif /* included_88colres_h */ +EOF Index: xc/programs/xterm/INSTALL diff -u xc/programs/xterm/INSTALL:3.25 xc/programs/xterm/INSTALL:3.27 --- xc/programs/xterm/INSTALL:3.25 Fri Nov 23 14:50:46 2001 +++ xc/programs/xterm/INSTALL Sat Oct 5 13:57:11 2002 @@ -1,4 +1,4 @@ --- $XFree86: xc/programs/xterm/INSTALL,v 3.25 2001/11/23 19:50:46 dawes Exp $ +-- $XFree86: xc/programs/xterm/INSTALL,v 3.27 2002/10/05 17:57:11 dickey Exp $ -- Thomas E. Dickey Xterm is normally built as part of the X Window System source tree, using @@ -138,7 +138,7 @@ Do not compile-in code for "input method". This is an X11R6 feature which deals with translation of composite characters. - Some user report problems with their configuration, e.g., messages + Some users report problems with their configuration, e.g., messages stating that there is no input method defined for the given preedit type. If you do not need input method (and are troubled by the warning messages), it is safe to disable this option. @@ -176,6 +176,12 @@ Do not compile-in code that suppresses redundant updates to the titlebar when the text has not changed. + --disable-session-mgt enable support for session management + + Do not compile-in code which adds simple session management hooks which + are used when closing an xterm. Normally the code is compiled-in, + except for systems which do not support it. + --disable-tek4014 disable tek4014 emulation Do not compile-in code to support Tektronix 4014 emulation. @@ -230,6 +236,15 @@ Logging was disabled in X11R5 xterm because of security problems. They were addressed in X11R6, but the feature was not reinstated. + + --enable-luit enable support for luit filter (Unicode translation) + + Luit is a filter that can be run between an arbitrary application and a + UTF-8 terminal emulator. It will convert application output from the + locale's encoding into UTF-8, and convert terminal input from UTF-8 + into the locale's encoding. + + This sets "--enable-wide-chars" as a side-effect. --enable-sco-fkeys enable support for SCO-style function keys Index: xc/programs/xterm/Imakefile diff -u xc/programs/xterm/Imakefile:3.40 xc/programs/xterm/Imakefile:3.49 --- xc/programs/xterm/Imakefile:3.40 Wed Oct 10 15:46:22 2001 +++ xc/programs/xterm/Imakefile Fri Nov 22 17:56:06 2002 @@ -7,7 +7,7 @@ XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. XCOMM -XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.40 2001/10/10 19:46:22 dickey Exp $ +XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.49 2002/11/22 22:56:06 tsi Exp $ XCOMM /* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ @@ -52,12 +52,14 @@ #if SetTtyGroup /* turn on in config/machine.cf */ TTYGROUPDEF = -DUSE_TTY_GROUP #endif -#if UsePUCCPtyd /* turn on in config/site.def */ +#ifdef UsePUCCPtyd /* turn on in config/site.def */ PUCCPTYDDEF = -DPUCC_PTYD /* does not need to be setuid */ PTYLIB = -lpucc #endif -#if ((LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1)) +#if defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) || \ + (defined(LinuxArchitecture) && \ + (LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1)) PTYLIB = -lutil #endif @@ -77,7 +79,7 @@ OSMAJORVERSION = OSMajorVersion OSMINORVERSION = OSMinorVersion -#if !defined(AmoebaArchitecture) && !defined(OS2Architecture) && !defined(__GNU__) +#if !defined(OS2Architecture) && !defined(__GNU__) #if defined(UseUtempter) UTMPDEF = -DUSE_UTEMPTER #else @@ -85,13 +87,8 @@ #endif #endif -#ifdef AmoebaArchitecture - EXTRASRC = ttysvr.c - EXTRAOBJ = ttysvr.o -#endif - #ifdef UTF8support - UTF8_OPTION = -DOPT_WIDE_CHARS + UTF8_OPTION = -DOPT_WIDE_CHARS -DOPT_LUIT_PROG UTF8SRC = charclass.c precompose.c wcwidth.c xutf8.c UTF8OBJ = charclass.o precompose.o wcwidth.o xutf8.o #endif @@ -102,34 +99,43 @@ XRFDEF = -DXRENDERFONT XRFLIBS = XftClientLibs $(XRENDERLIB) XRFDEPLIBS = XftClientDepLibs $(DEPXRENDERLIB) + XRFINCLUDES = $(XFTINCLUDES) #endif - +#ifdef TraceXTerm + TRACEDEF = -DOPT_TRACE=1 +#endif MAIN_DEFINES = $(UTMPDEF) $(TTYGROUPDEF) $(PUCCPTYDDEF) $(NOPOSIXTERMIOS) \ -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */ XKB_DEFINES = XkbClientDefines - DEFINES = -I. $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) + PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT) + DEFINES = -I. $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(TRACEDEF) + INCLUDES = $(XRFINCLUDES) #ifdef OS2Architecture - MAINSRC = os2main.c - MAINOBJ = os2main.o + MAINSRC = os2main.c + MAINOBJ = os2main.o #else - MAINSRC = main.c - MAINOBJ = main.o + MAINSRC = main.c + MAINOBJ = main.o #endif +#ifdef TraceXTerm + TRACESRC = trace.c + TRACEOBJ = trace.o +#endif SRCS1 = button.c charproc.c charsets.c cursor.c \ data.c doublechr.c fontutils.c input.c \ menu.c misc.c print.c ptydata.c \ screen.c scrollbar.c tabs.c util.c xstrings.c \ TekPrsTbl.c Tekproc.c VTPrsTbl.c \ - $(MAINSRC) $(EXTRASRC) $(UTF8SRC) + $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(TRACESRC) OBJS1 = button.o charproc.o charsets.o cursor.o \ data.o doublechr.o fontutils.o input.o \ menu.o misc.o print.o ptydata.o \ screen.o scrollbar.o tabs.o util.o xstrings.o \ TekPrsTbl.o Tekproc.o VTPrsTbl.o \ - $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) + $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(TRACEOBJ) SRCS2 = resize.c xstrings.c OBJS2 = resize.o xstrings.o SRCS = $(SRCS1) $(SRCS2) @@ -164,6 +170,11 @@ SetUIDProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(PTYLIB)) #else NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(UTMPLIB) $(PTYLIB)) +#endif + +#if defined(OpenBSDArchitecture) +/* On OpenBSD xterm is now setgid utmp */ +INSTUIDFLAGS= -m 6755 -g utmp #endif #if InstallXtermSetUID && defined(SunArchitecture) && HasSharedLibraries && (OSMajorVersion < 5) Index: xc/programs/xterm/MANIFEST diff -u xc/programs/xterm/MANIFEST:1.13 xc/programs/xterm/MANIFEST:1.19 --- xc/programs/xterm/MANIFEST:1.13 Wed Sep 19 21:06:35 2001 +++ xc/programs/xterm/MANIFEST Tue Feb 25 18:36:55 2003 @@ -1,4 +1,4 @@ -MANIFEST for xterm, version xterm-159 +MANIFEST for xterm, version xterm-174 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -72,8 +72,8 @@ testxmc.c testing: xmc/magic-cookies trace.c debugging trace functions for 'xterm' trace.h interface of trace.c -ttysvr.c simple tty server for AMOEBA port of 'xterm' util.c miscellaneous utility functions for 'xterm' +uxterm wrapper script to make unicode-xterm version.h version of xterm vms.c VMS version of xterm's spawn(), etc. vms.h system headers and definitions for vms.c @@ -90,7 +90,6 @@ xtermcfg.hin configure script: template for xtermcfg.h xutf8.c JC's cleanup of UTF8 xutf8.h JC's cleanup of UTF8 -tektests subdirectory tektests/aitest.tek tek4014 demo: draw a globe tektests/dmerc.tek tek4014 demo: draws a Mercator projection with orbit tektests/fotest.tek tek4014 demo: draw a scatterplot on log scale @@ -98,20 +97,19 @@ tektests/imtesth.tek tek4014 demo: draw a test pattern tektests/ocpred.tek tek4014 demo: an occultation prediction tektests/usmap.tek tek4014 demo: a US map -unicode subdirectory unicode/README description of files in ./unicode unicode/convmap.pl perl script for generating the lookup table for UTF-8 to keysym unicode/keysym.map keysym mapping from UTF-8 unicode/make-precompose.sh make precompose.c unicode/precompose.c.head header of precompose.c unicode/precompose.c.tail tail of precompose.c -vttests subdirectory vttests/16colors.sh test-script to show 16-colors vttests/256colors.pl script to illustrate 256-colors vttests/256colors2.pl fancy test-script for 256-colors vttests/88colors.pl sample script showing 88-colors vttests/88colors2.pl sample script showing 88-colors vttests/8colors.sh test-script to illustrate 8-colors +vttests/acolors.sh demonstrate changing the ANSI colors vttests/doublechars.sh test script to demonstrate doublesize chars vttests/dynamic.sh script to illustrate the dynamic colors control sequence vttests/fonts.sh script to demonstrate font-switching sequences Index: xc/programs/xterm/Makefile.in diff -u xc/programs/xterm/Makefile.in:3.39 xc/programs/xterm/Makefile.in:3.40 --- xc/programs/xterm/Makefile.in:3.39 Sat Jan 5 17:05:02 2002 +++ xc/programs/xterm/Makefile.in Mon Mar 25 20:46:39 2002 @@ -1,4 +1,25 @@ -## $XFree86: xc/programs/xterm/Makefile.in,v 3.39 2002/01/05 22:05:02 dickey Exp $ ## +## $XFree86: xc/programs/xterm/Makefile.in,v 3.40 2002/03/26 01:46:39 dickey Exp $ ## +## +## Copyright 2002 by Thomas E. Dickey +## +## All Rights Reserved +## +## Permission to use, copy, modify, and distribute this software and its +## documentation for any purpose and without fee is hereby granted, +## provided that the above copyright notice appear in all copies and that +## both that copyright notice and this permission notice appear in +## supporting documentation, and that the name of the above listed +## copyright holder(s) not be used in advertising or publicity pertaining +## to distribution of the software without specific, written prior +## permission. +## +## THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD +## TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +## AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE +## LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +## ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +## OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. SHELL = /bin/sh @@ -91,7 +112,7 @@ main.o : main.h version.h -$(OBJS1) : ptyx.h xtermcfg.h +$(OBJS1) : xterm.h ptyx.h xtermcfg.h main.o resize.o screen.o : xterm_io.h xterm$x : $(OBJS1) @@ -119,27 +140,20 @@ install \ install-bin \ -install-man \ -install-full \ -install-dirs :: $(INSTALL_DIRS) - @echo $@ built - -install \ -install-bin \ -install-full :: xterm$x resize$x +install-full :: xterm$x resize$x $(BINDIR) $(SHELL) $(srcdir)/sinstall.sh "$(INSTALL_PROGRAM)" xterm$x @XTERM_PATH@ $(BINDIR)/$(binary_xterm) $(INSTALL_PROGRAM) -s -m 755 resize$x $(BINDIR)/$(binary_resize) $(INSTALL_PROGRAM) -m 755 $(srcdir)/uxterm $(BINDIR)/$(binary_uxterm) install \ install-man \ -install-full :: +install-full :: $(MANDIR) $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/xterm.man $(MANDIR)/$(actual_xterm).$(manext) $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/resize.man $(MANDIR)/$(actual_resize).$(manext) install \ install-app \ -install-full :: +install-full :: $(APPSDIR) @echo installing $(APPSDIR)/$(CLASS) @sed -e s/XTerm/$(CLASS)/ $(srcdir)/XTerm.ad >XTerm.tmp @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$(CLASS) Index: xc/programs/xterm/Tekproc.c diff -u xc/programs/xterm/Tekproc.c:3.35 xc/programs/xterm/Tekproc.c:3.40 --- xc/programs/xterm/Tekproc.c:3.35 Sat Jan 5 17:05:02 2002 +++ xc/programs/xterm/Tekproc.c Tue Feb 25 18:36:55 2003 @@ -3,12 +3,11 @@ * * Warning, there be crufty dragons here. */ -/* $XFree86: xc/programs/xterm/Tekproc.c,v 3.35 2002/01/05 22:05:02 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/Tekproc.c,v 3.40 2003/02/25 23:36:55 dickey Exp $ */ - /* -Copyright 2001 by Thomas E. Dickey +Copyright 2001-2002,2003 by Thomas E. Dickey All Rights Reserved @@ -36,7 +35,6 @@ sale, use or other dealings in this Software without prior written authorization. - Copyright 1988 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -59,7 +57,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. - * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved @@ -89,14 +86,20 @@ #include <X11/Xatom.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> #include <X11/Xmu/CharSet.h> #if OPT_TOOLBAR + +#if defined(HAVE_LIB_XAW) #include <X11/Xaw/Form.h> +#elif defined(HAVE_LIB_XAW3D) +#include <X11/Xaw3d/Form.h> +#elif defined(HAVE_LIB_NEXTAW) +#include <X11/neXtaw/Form.h> #endif +#endif /* OPT_TOOLBAR */ + #include <stdio.h> #include <ctype.h> #include <signal.h> @@ -106,14 +109,6 @@ #include <error.h> #include <menu.h> -#ifdef MINIX -#include <sys/nbio.h> - -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#define read(f,b,s) nbio_read(f,b,s) -#define write(f,b,s) nbio_write(f,b,s) -#endif - #define DefaultGCID XGContextFromGC(DefaultGC(screen->display, DefaultScreen(screen->display))) /* Tek defines */ @@ -148,22 +143,20 @@ #define TekMove(x,y) screen->cur_X = x; screen->cur_Y = y #define input() Tinput() #define unput(c) *Tpushback++ = c - -extern Bool waiting_for_initial_map; -extern Arg ourTopLevelShellArgs[]; -extern int number_ourTopLevelShellArgs; +/* *INDENT-OFF* */ static struct Tek_Char { - int hsize; /* in Tek units */ - int vsize; /* in Tek units */ - int charsperline; - int nlines; + int hsize; /* in Tek units */ + int vsize; /* in Tek units */ + int charsperline; + int nlines; } TekChar[TEKNUMFONTS] = { - {56, 88, 74, 35}, /* large */ - {51, 82, 81, 38}, /* #2 */ - {34, 53, 121, 58}, /* #3 */ - {31, 48, 133, 64}, /* small */ + {56, 88, 74, 35}, /* large */ + {51, 82, 81, 38}, /* #2 */ + {34, 53, 121, 58}, /* #3 */ + {31, 48, 133, 64}, /* small */ }; +/* *INDENT-ON* */ static Cursor GINcursor; static XSegment *line_pt; @@ -193,8 +186,7 @@ ~Meta<Btn2Down>: gin-press(m) \n\ Shift ~Meta<Btn3Down>: gin-press(R) \n\ ~Meta<Btn3Down>: gin-press(r)"; - - +/* *INDENT-OFF* */ static XtActionsRec actionsList[] = { { "string", HandleStringEvent }, { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */ @@ -222,7 +214,7 @@ { "set-appcursor", HandleAppCursor }, { "set-appkeypad", HandleAppKeypad }, { "set-scroll-on-key", HandleScrollKey }, - { "set-scroll-on-tty-output", HandleScrollTtyOutput }, + { "set-scroll-on-tty-output", HandleScrollTtyOutput }, { "set-allow132", HandleAllow132 }, { "set-cursesemul", HandleCursesEmul }, { "set-marginbell", HandleMarginBell }, @@ -236,6 +228,7 @@ { "tek-reset", HandleTekReset }, { "tek-copy", HandleTekCopy }, }; +/* *INDENT-ON* */ static Dimension defOne = 1; @@ -253,129 +246,138 @@ #define DFT_FONT_SMALL "6x10" #endif -static XtResource resources[] = { +static XtResource resources[] = +{ #ifdef VMS {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), - XtOffset(TekWidget, core.background_pixel), - XtRString, "White"}, + XtOffset(TekWidget, core.background_pixel), + XtRString, "White"}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - XtOffset(TekWidget, Tforeground), - XtRString, "Black"}, + XtOffset(TekWidget, Tforeground), + XtRString, "Black"}, #endif {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), - XtOffsetOf(CoreRec, core.width), XtRDimension, (caddr_t)&defOne}, + XtOffsetOf(CoreRec, core.width), XtRDimension, (caddr_t) & defOne}, {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), - XtOffsetOf(CoreRec, core.height), XtRDimension, (caddr_t)&defOne}, + XtOffsetOf(CoreRec, core.height), XtRDimension, (caddr_t) & defOne}, {"fontLarge", XtCFont, XtRFontStruct, sizeof(XFontStruct *), - XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_LARGE]), - XtRString, "9x15"}, + XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_LARGE]), + XtRString, "9x15"}, {"font2", XtCFont, XtRFontStruct, sizeof(XFontStruct *), - XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_2]), - XtRString, "6x13"}, + XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_2]), + XtRString, "6x13"}, {"font3", XtCFont, XtRFontStruct, sizeof(XFontStruct *), - XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_3]), - XtRString, "8x13"}, + XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_3]), + XtRString, "8x13"}, {"fontSmall", XtCFont, XtRFontStruct, sizeof(XFontStruct *), - XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_SMALL]), - XtRString, DFT_FONT_SMALL}, + XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_SMALL]), + XtRString, DFT_FONT_SMALL}, {"initialFont", "InitialFont", XtRString, sizeof(char *), - XtOffsetOf(TekWidgetRec, tek.initial_font), - XtRString, "large"}, + XtOffsetOf(TekWidgetRec, tek.initial_font), + XtRString, "large"}, {"ginTerminator", "GinTerminator", XtRString, sizeof(char *), - XtOffsetOf(TekWidgetRec, tek.gin_terminator_str), - XtRString, GIN_TERM_NONE_STR}, + XtOffsetOf(TekWidgetRec, tek.gin_terminator_str), + XtRString, GIN_TERM_NONE_STR}, #if OPT_TOOLBAR {XtNmenuBar, XtCMenuBar, XtRWidget, sizeof(Widget), - XtOffsetOf(TekWidgetRec, tek.menu_bar), - XtRWidget, (XtPointer) 0}, + XtOffsetOf(TekWidgetRec, tek.menu_bar), + XtRWidget, (XtPointer) 0}, {XtNmenuHeight, XtCMenuHeight, XtRInt, sizeof(int), - XtOffsetOf(TekWidgetRec, tek.menu_height), - XtRString, "25"}, + XtOffsetOf(TekWidgetRec, tek.menu_height), + XtRString, "25"}, #endif }; -static int Tinput (void); -static int getpoint (void); -static void TCursorBack (void); -static void TCursorDown (void); -static void TCursorForward (void); -static void TCursorUp (void); -static void TekBackground (TScreen *screen); -static void TekConfigure (Widget w); -static void TekDraw (int x, int y); -static void TekEnq (int status, int x, int y); -static void TekFlush (void); -static void TekInitialize (Widget request, Widget wnew, ArgList args, Cardinal *num_args); -static void TekPage (void); -static void TekRealize (Widget gw, XtValueMask *valuemaskp, XSetWindowAttributes *values); +static int Tinput(void); +static int getpoint(void); +static void TCursorBack(void); +static void TCursorDown(void); +static void TCursorForward(void); +static void TCursorUp(void); +static void TekBackground(TScreen * screen); +static void TekConfigure(Widget w); +static void TekDraw(int x, int y); +static void TekEnq(int status, int x, int y); +static void TekFlush(void); +static void TekInitialize(Widget request, + Widget wnew, + ArgList args, + Cardinal * num_args); +static void TekPage(void); +static void TekRealize(Widget gw, + XtValueMask * valuemaskp, + XSetWindowAttributes * values); -static WidgetClassRec tekClassRec = { - { +static WidgetClassRec tekClassRec = +{ + { /* core_class fields */ - /* superclass */ (WidgetClass) &widgetClassRec, - /* class_name */ "Tek4014", - /* widget_size */ sizeof(TekWidgetRec), - /* class_initialize */ NULL, - /* class_part_initialize */ NULL, - /* class_inited */ FALSE, - /* initialize */ TekInitialize, - /* initialize_hook */ NULL, - /* realize */ TekRealize, - /* actions */ actionsList, - /* num_actions */ XtNumber(actionsList), - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ TekConfigure, - /* expose */ TekExpose, - /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ NULL, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_offsets */ NULL, - /* tm_table */ defaultTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator*/ XtInheritDisplayAccelerator, - /* extension */ NULL - } + (WidgetClass) & widgetClassRec, /* superclass */ + "Tek4014", /* class_name */ + sizeof(TekWidgetRec), /* widget_size */ + NULL, /* class_initialize */ + NULL, /* class_part_initialize */ + FALSE, /* class_inited */ + TekInitialize, /* initialize */ + NULL, /* initialize_hook */ + TekRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + NULL, /* destroy */ + TekConfigure, /* resize */ + TekExpose, /* expose */ + NULL, /* set_values */ + NULL, /* set_values_hook */ + NULL, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_offsets */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + } }; #define tekWidgetClass ((WidgetClass)&tekClassRec) static Boolean Tfailed = FALSE; -int TekInit (void) +int +TekInit(void) { Widget form_top, menu_top; if (!Tfailed - && tekWidget == 0) { + && tekWidget == 0) { /* this causes the Initialize method to be called */ - tekshellwidget = XtCreatePopupShell ( - "tektronix", topLevelShellWidgetClass, - toplevel, ourTopLevelShellArgs, - number_ourTopLevelShellArgs); + tekshellwidget = + XtCreatePopupShell("tektronix", topLevelShellWidgetClass, + toplevel, ourTopLevelShellArgs, + number_ourTopLevelShellArgs); SetupMenus(tekshellwidget, &form_top, &menu_top); /* this causes the Realize method to be called */ - tekWidget = (TekWidget) XtVaCreateManagedWidget ( - "tek4014", tekWidgetClass, form_top, + tekWidget = (TekWidget) + XtVaCreateManagedWidget("tek4014", + tekWidgetClass, form_top, #if OPT_TOOLBAR - XtNmenuBar, menu_top, - XtNresizable, True, - XtNfromVert, menu_top, - XtNleft, XawChainLeft, - XtNright, XawChainRight, - XtNbottom, XawChainBottom, + XtNmenuBar, menu_top, + XtNresizable, True, + XtNfromVert, menu_top, + XtNleft, XawChainLeft, + XtNright, XawChainRight, + XtNbottom, XawChainBottom, #endif - 0); + (XtPointer) 0); } return (!Tfailed); } @@ -387,12 +389,14 @@ TekPtyData(void) { if (Tbuffer == 0) { - if ((Tbuffer = (PtyData *)malloc(sizeof(PtyData))) == NULL - || (Tpushb = (Char *)malloc(10)) == NULL - || (Tline = (XSegment *)malloc(MAX_VTX * sizeof(XSegment))) == NULL) { - fprintf (stderr, "%s: Not enough core for Tek mode\n", xterm_name); - if(Tpushb) free((char *)Tpushb); - if(Tbuffer) free((char *)Tbuffer); + if ((Tbuffer = (PtyData *) malloc(sizeof(PtyData))) == NULL + || (Tpushb = (Char *) malloc(10)) == NULL + || (Tline = (XSegment *) malloc(MAX_VTX * sizeof(XSegment))) == NULL) { + fprintf(stderr, "%s: Not enough core for Tek mode\n", xterm_name); + if (Tpushb) + free((char *) Tpushb); + if (Tbuffer) + free((char *) Tbuffer); Tfailed = TRUE; return 0; } @@ -400,603 +404,589 @@ return 1; } -static void Tekparse(void) +static void +Tekparse(void) { - register TScreen *screen = &term->screen; - register int c, x, y; - Char ch; - int nextstate; - - for( ; ; ) { - c = input(); - /* - * The parsing tables all have 256 entries. If we're supporting - * wide characters, we handle them by treating them the same as - * printing characters. - */ + register TScreen *screen = &term->screen; + register int c = 0, x, y; + Char ch; + int nextstate; + + for (;;) { + c = input(); + /* + * The parsing tables all have 256 entries. If we're supporting + * wide characters, we handle them by treating them the same as + * printing characters. + */ #if OPT_WIDE_CHARS - if (c > 255) { - nextstate = (Tparsestate == Talptable) - ? CASE_PRINT - : CASE_IGNORE; - } else + if (c > 255) { + nextstate = (Tparsestate == Talptable) + ? CASE_PRINT + : CASE_IGNORE; + } else #endif - nextstate = Tparsestate[c]; - TRACE(("parse %d -> %d\n", c, nextstate)); + nextstate = Tparsestate[c]; + TRACE(("Tekparse %d -> %d\n", c, nextstate)); - switch(nextstate) { - case CASE_REPORT: - /* report address */ - if(screen->TekGIN) { - TekGINoff(); - TekEnqMouse(0); - } else { - c = 064; /* has hard copy unit */ - if(screen->margin == MARGIN2) - c |= 02; - TekEnq(c, screen->cur_X, screen->cur_Y); - } - TekRecord->ptr[-1] = NAK; /* remove from recording */ - Tparsestate = curstate; - break; + switch (nextstate) { + case CASE_REPORT: + TRACE(("case: report address\n")); + if (screen->TekGIN) { + TekGINoff(); + TekEnqMouse(0); + } else { + c = 064; /* has hard copy unit */ + if (screen->margin == MARGIN2) + c |= 02; + TekEnq(c, screen->cur_X, screen->cur_Y); + } + TekRecord->ptr[-1] = NAK; /* remove from recording */ + Tparsestate = curstate; + break; - case CASE_VT_MODE: - /* special return to vt102 mode */ - Tparsestate = curstate; - TekRecord->ptr[-1] = NAK; /* remove from recording */ + case CASE_VT_MODE: + TRACE(("case: special return to vt102 mode\n")); + Tparsestate = curstate; + TekRecord->ptr[-1] = NAK; /* remove from recording */ #ifdef ALLOWLOGGING - if(screen->logging) { - FlushLog(screen); - screen->logstart = DecodedData(&(VTbuffer)); - } + if (screen->logging) { + FlushLog(screen); + screen->logstart = DecodedData(&(VTbuffer)); + } #endif - return; + return; - case CASE_SPT_STATE: - /* Enter Special Point Plot mode */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate = Tspttable; - break; + case CASE_SPT_STATE: + TRACE(("case: Enter Special Point Plot mode\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate = Tspttable; + break; - case CASE_GIN: - /* Do Tek GIN mode */ - screen->TekGIN = &TekRecord->ptr[-1]; - /* Set cross-hair cursor raster array */ - if ((GINcursor = - make_colored_cursor (XC_tcross, screen->mousecolor, - screen->mousecolorback)) != 0) - XDefineCursor (screen->display, TShellWindow, - GINcursor); - Tparsestate = Tbyptable; /* Bypass mode */ - break; + case CASE_GIN: + TRACE(("case: Do Tek GIN mode\n")); + screen->TekGIN = &TekRecord->ptr[-1]; + /* Set cross-hair cursor raster array */ + if ((GINcursor = + make_colored_cursor(XC_tcross, screen->mousecolor, + screen->mousecolorback)) != 0) { + XDefineCursor(screen->display, TWindow(screen), + GINcursor); + } + Tparsestate = Tbyptable; /* Bypass mode */ + break; - case CASE_BEL: - /* BEL */ - if(screen->TekGIN) - TekGINoff(); - if(!TekRefresh) - Bell(XkbBI_TerminalBell,0); - Tparsestate = curstate; /* clear bypass condition */ - break; + case CASE_BEL: + TRACE(("case: BEL\n")); + if (screen->TekGIN) + TekGINoff(); + if (!TekRefresh) + Bell(XkbBI_TerminalBell, 0); + Tparsestate = curstate; /* clear bypass condition */ + break; - case CASE_BS: - /* BS */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate; /* clear bypass condition */ - TCursorBack(); - break; + case CASE_BS: + TRACE(("case: BS\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate; /* clear bypass condition */ + TCursorBack(); + break; - case CASE_PT_STATE: - /* Enter Tek Point Plot mode */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate = Tpttable; - break; + case CASE_PT_STATE: + TRACE(("case: Enter Tek Point Plot mode\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate = Tpttable; + break; - case CASE_PLT_STATE: - /* Enter Tek Plot mode */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate = Tplttable; - if((c = input()) == BEL) - screen->pen = PENDOWN; - else { - unput(c); - screen->pen = PENUP; - } - break; + case CASE_PLT_STATE: + TRACE(("case: Enter Tek Plot mode\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate = Tplttable; + if ((c = input()) == BEL) + screen->pen = PENDOWN; + else { + unput(c); + screen->pen = PENUP; + } + break; - case CASE_TAB: - /* HT */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate; /* clear bypass condition */ - TCursorForward(); - break; + case CASE_TAB: + TRACE(("case: HT\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate; /* clear bypass condition */ + TCursorForward(); + break; - case CASE_IPL_STATE: - /* Enter Tek Incremental Plot mode */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate = Tipltable; - break; + case CASE_IPL_STATE: + TRACE(("case: Enter Tek Incremental Plot mode\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate = Tipltable; + break; - case CASE_ALP_STATE: - /* Enter Tek Alpha mode from any other mode */ - if(screen->TekGIN) - TekGINoff(); - /* if in one of graphics states, move alpha cursor */ - if(nplot > 0) /* flush line Tbuffer */ - TekFlush(); - Tparsestate = curstate = Talptable; - break; + case CASE_ALP_STATE: + TRACE(("case: Enter Tek Alpha mode from any other mode\n")); + if (screen->TekGIN) + TekGINoff(); + /* if in one of graphics states, move alpha cursor */ + if (nplot > 0) /* flush line Tbuffer */ + TekFlush(); + Tparsestate = curstate = Talptable; + break; - case CASE_UP: - /* cursor up */ - if(screen->TekGIN) - TekGINoff(); - Tparsestate = curstate; /* clear bypass condition */ - TCursorUp(); - break; + case CASE_UP: + TRACE(("case: cursor up\n")); + if (screen->TekGIN) + TekGINoff(); + Tparsestate = curstate; /* clear bypass condition */ + TCursorUp(); + break; - case CASE_COPY: - /* make copy */ - if(screen->TekGIN) - TekGINoff(); - TekCopy(); - TekRecord->ptr[-1] = NAK; /* remove from recording */ - Tparsestate = curstate; /* clear bypass condition */ - break; + case CASE_COPY: + TRACE(("case: make copy\n")); + if (screen->TekGIN) + TekGINoff(); + TekCopy(); + TekRecord->ptr[-1] = NAK; /* remove from recording */ + Tparsestate = curstate; /* clear bypass condition */ + break; - case CASE_PAGE: - /* Page Function */ - if(screen->TekGIN) - TekGINoff(); - TekPage(); /* clear bypass condition */ - break; + case CASE_PAGE: + TRACE(("case: Page Function\n")); + if (screen->TekGIN) + TekGINoff(); + TekPage(); /* clear bypass condition */ + break; - case CASE_BES_STATE: - /* Byp: an escape char */ - Tparsestate = Tbestable; - break; + case CASE_BES_STATE: + TRACE(("case: Byp: an escape char\n")); + Tparsestate = Tbestable; + break; - case CASE_BYP_STATE: - /* set bypass condition */ - Tparsestate = Tbyptable; - break; + case CASE_BYP_STATE: + TRACE(("case: set bypass condition\n")); + Tparsestate = Tbyptable; + break; - case CASE_IGNORE: - /* Esc: totally ignore CR, ESC, LF, ~ */ - break; + case CASE_IGNORE: + TRACE(("case: Esc: totally ignore CR, ESC, LF, ~\n")); + break; - case CASE_ASCII: - /* Select ASCII char set */ - /* ignore for now */ - Tparsestate = curstate; - break; + case CASE_ASCII: + TRACE(("case: Select ASCII char set\n")); + /* ignore for now */ + Tparsestate = curstate; + break; - case CASE_APL: - /* Select APL char set */ - /* ignore for now */ - Tparsestate = curstate; - break; + case CASE_APL: + TRACE(("case: Select APL char set\n")); + /* ignore for now */ + Tparsestate = curstate; + break; - case CASE_CHAR_SIZE: - /* character size selector */ - TekSetFontSize (c & 03); - Tparsestate = curstate; - break; + case CASE_CHAR_SIZE: + TRACE(("case: character size selector\n")); + TekSetFontSize(c & 03); + Tparsestate = curstate; + break; - case CASE_BEAM_VEC: - /* beam and vector selector */ - /* only line types */ - if((c &= LINEMASK) != screen->cur.linetype) { - if(nplot > 0) - TekFlush(); - if (c <= TEKNUMLINES) - screen->cur.linetype = c; - } - Tparsestate = curstate; - break; + case CASE_BEAM_VEC: + TRACE(("case: beam and vector selector\n")); + /* only line types */ + if ((c &= LINEMASK) != screen->cur.linetype) { + if (nplot > 0) + TekFlush(); + if (c <= TEKNUMLINES) + screen->cur.linetype = c; + } + Tparsestate = curstate; + break; - case CASE_CURSTATE: - Tparsestate = curstate; - break; + case CASE_CURSTATE: + Tparsestate = curstate; + break; - case CASE_PENUP: - /* Ipl: penup */ - screen->pen = PENUP; - break; + case CASE_PENUP: + TRACE(("case: Ipl: penup\n")); + screen->pen = PENUP; + break; - case CASE_PENDOWN: - /* Ipl: pendown */ - screen->pen = PENDOWN; - break; + case CASE_PENDOWN: + TRACE(("case: Ipl: pendown\n")); + screen->pen = PENDOWN; + break; - case CASE_IPL_POINT: - /* Ipl: point */ - x = screen->cur_X; - y = screen->cur_Y; - if(c & NORTH) - y++; - else if(c & SOUTH) - y--; - if(c & EAST) - x++; - else if(c & WEST) - x--; - if(screen->pen == PENDOWN) - TekDraw(x, y); - else - TekMove(x, y); - break; + case CASE_IPL_POINT: + TRACE(("case: Ipl: point\n")); + x = screen->cur_X; + y = screen->cur_Y; + if (c & NORTH) + y++; + else if (c & SOUTH) + y--; + if (c & EAST) + x++; + else if (c & WEST) + x--; + if (screen->pen == PENDOWN) + TekDraw(x, y); + else + TekMove(x, y); + break; - case CASE_PLT_VEC: - /* Plt: vector */ - unput(c); - if(getpoint()) { - if(screen->pen == PENDOWN) - TekDraw(screen->cur.x, screen->cur.y); - else - TekMove(screen->cur.x, screen->cur.y); - screen->pen = PENDOWN; - } - break; + case CASE_PLT_VEC: + TRACE(("case: Plt: vector\n")); + unput(c); + if (getpoint()) { + if (screen->pen == PENDOWN) + TekDraw(screen->cur.x, screen->cur.y); + else + TekMove(screen->cur.x, screen->cur.y); + screen->pen = PENDOWN; + } + break; - case CASE_PT_POINT: - /* Pt: point */ - unput(c); - if(getpoint()) { - TekMove(screen->cur.x, screen->cur.y); - TekDraw(screen->cur.x, screen->cur.y); - } - break; + case CASE_PT_POINT: + TRACE(("case: Pt: point\n")); + unput(c); + if (getpoint()) { + TekMove(screen->cur.x, screen->cur.y); + TekDraw(screen->cur.x, screen->cur.y); + } + break; - case CASE_SPT_POINT: - /* Spt: point */ - /* ignore intensity character in c */ - if(getpoint()) { - TekMove(screen->cur.x, screen->cur.y); - TekDraw(screen->cur.x, screen->cur.y); - } - break; + case CASE_SPT_POINT: + TRACE(("case: Spt: point\n")); + /* ignore intensity character in c */ + if (getpoint()) { + TekMove(screen->cur.x, screen->cur.y); + TekDraw(screen->cur.x, screen->cur.y); + } + break; - case CASE_CR: - /* CR */ - if(screen->TekGIN) - TekGINoff(); - if(nplot > 0) /* flush line Tbuffer */ - TekFlush(); - screen->cur_X = screen->margin == MARGIN1 ? 0 : - TEKWIDTH / 2; - Tparsestate = curstate = Talptable; - break; + case CASE_CR: + TRACE(("case: CR\n")); + if (screen->TekGIN) + TekGINoff(); + if (nplot > 0) /* flush line Tbuffer */ + TekFlush(); + screen->cur_X = screen->margin == MARGIN1 ? 0 : + TEKWIDTH / 2; + Tparsestate = curstate = Talptable; + break; - case CASE_ESC_STATE: - /* ESC */ - Tparsestate = Tesctable; - break; + case CASE_ESC_STATE: + TRACE(("case: ESC\n")); + Tparsestate = Tesctable; + break; - case CASE_LF: - /* LF */ - if(screen->TekGIN) - TekGINoff(); - TCursorDown(); - if (!TekRefresh) - do_xevents(); - break; + case CASE_LF: + TRACE(("case: LF\n")); + if (screen->TekGIN) + TekGINoff(); + TCursorDown(); + if (!TekRefresh) + do_xevents(); + break; - case CASE_SP: - /* SP */ - TCursorForward(); - break; + case CASE_SP: + TRACE(("case: SP\n")); + TCursorForward(); + break; - case CASE_PRINT: - /* printable character */ - ch = c; - c = screen->cur.fontsize; - x = (int)(screen->cur_X * TekScale(screen)) + screen->border; - y = (int)((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) + screen->border; + case CASE_PRINT: + TRACE(("case: printable character\n")); + ch = c; + c = screen->cur.fontsize; + x = (int) (screen->cur_X * TekScale(screen)) + + screen->border; + y = (int) ((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) + + screen->border; #if OPT_WIDE_CHARS - if (screen->wide_chars - && (ch > 255)) { - XChar2b sbuf; - sbuf.byte2 = CharOf(ch); - sbuf.byte1 = CharOf(ch >>8); - XDrawImageString16( - screen->display, - TWindow(screen), - screen->TnormalGC, - x, - y, - &sbuf, - 1); - } else + if (screen->wide_chars + && (ch > 255)) { + XChar2b sbuf; + sbuf.byte2 = CharOf(ch); + sbuf.byte1 = CharOf(ch >> 8); + XDrawImageString16(screen->display, + TWindow(screen), + screen->TnormalGC, + x, + y, + &sbuf, + 1); + } else #endif - XDrawString( - screen->display, + XDrawString(screen->display, TWindow(screen), screen->TnormalGC, x, y, - (char *)&ch, + (char *) &ch, 1); - TCursorForward(); - break; - case CASE_OSC: - /* FIXME: someone should disentangle the input queues - * of this code so that it can be state-driven. - */ - /* do osc escape */ - { - Char buf2[512]; - int c2, len = 0; - while ((c2 = Tinput()) != BEL) { - if (!isprint(c2 & 0x7f) - || len+2 >= (int) sizeof(buf2)) - break; - buf2[len++] = c2; - } - if (c2 == BEL) - do_osc(buf2, len, BEL); - } - Tparsestate = curstate; + TCursorForward(); + break; + case CASE_OSC: + /* FIXME: someone should disentangle the input queues + * of this code so that it can be state-driven. + */ + TRACE(("case: do osc escape\n")); + { + Char buf2[512]; + int c2, len = 0; + while ((c2 = Tinput()) != BEL) { + if (!isprint(c2 & 0x7f) + || len + 2 >= (int) sizeof(buf2)) break; + buf2[len++] = c2; } + if (c2 == BEL) + do_osc(buf2, len, BEL); + } + Tparsestate = curstate; + break; } + } } static int rcnt; static char *rptr; #ifdef VMS static int Tselect_mask; -#else /* VMS */ +#else /* VMS */ static fd_set Tselect_mask; #endif /* VMS */ -static int Tinput(void) +static int +Tinput(void) { - register TScreen *screen = &term->screen; - register int i; - register TekLink *tek; - - if(Tpushback > Tpushb) - return(*--Tpushback); - if(TekRefresh) { - if(rcnt-- > 0) - return(*rptr++); - if ((tek = TekRefresh->next) != 0) { - TekRefresh = tek; - rptr = tek->data; - rcnt = tek->count - 1; - TekSetFontSize(tek->fontsize); - return(*rptr++); - } - TekRefresh = (TekLink *)0; - longjmp(Tekjump, 1); + register TScreen *screen = &term->screen; + register int i; + register TekLink *tek; + + if (Tpushback > Tpushb) + return (*--Tpushback); + if (TekRefresh) { + if (rcnt-- > 0) + return (*rptr++); + if ((tek = TekRefresh->next) != 0) { + TekRefresh = tek; + rptr = tek->data; + rcnt = tek->count - 1; + TekSetFontSize(tek->fontsize); + return (*rptr++); } -again: - if(Tbuffer->cnt-- <= 0) { - if(nplot > 0) /* flush line Tbuffer */ - TekFlush(); + TekRefresh = (TekLink *) 0; + longjmp(Tekjump, 1); + } + again: + if (Tbuffer->cnt-- <= 0) { + if (nplot > 0) /* flush line Tbuffer */ + TekFlush(); #ifdef VMS - Tselect_mask = pty_mask; /* force a read */ + Tselect_mask = pty_mask; /* force a read */ #else /* VMS */ - XFD_COPYSET (&pty_mask, &Tselect_mask); + XFD_COPYSET(&pty_mask, &Tselect_mask); #endif /* VMS */ - for( ; ; ) { + for (;;) { #ifdef CRAY - struct timeval crocktimeout; - crocktimeout.tv_sec = 0; - crocktimeout.tv_usec = 0; - (void) Select (max_plus1, - &Tselect_mask, NULL, NULL, - &crocktimeout); + struct timeval crocktimeout; + crocktimeout.tv_sec = 0; + crocktimeout.tv_usec = 0; + (void) Select(max_plus1, + &Tselect_mask, NULL, NULL, + &crocktimeout); #endif #ifdef VMS - if(Tselect_mask & pty_mask) { + if (Tselect_mask & pty_mask) { #ifdef ALLOWLOGGING - if(screen->logging) - FlushLog(screen); + if (screen->logging) + FlushLog(screen); #endif - if (read_queue.flink != 0) { - Tbuffer->cnt = tt_read(Tbuffer->ptr = Tbuffer->buf); - if(Tbuffer->cnt == 0) { - Panic("input: read returned zero\n", 0); - } - else { break; } - } - else { sys$hiber(); } - } -#else /* VMS */ - if (getPtyData(screen, &Tselect_mask, Tbuffer)) { - break; - } + if (read_queue.flink != 0) { + Tbuffer->cnt = tt_read(Tbuffer->ptr = Tbuffer->buf); + if (Tbuffer->cnt == 0) { + Panic("input: read returned zero\n", 0); + } else { + break; + } + } else { + sys$hiber(); + } + } +#else /* VMS */ + if (getPtyData(screen, &Tselect_mask, Tbuffer)) { + break; + } #endif /* VMS */ - if (Ttoggled && curstate == Talptable) { - TCursorToggle(TOGGLE); - Ttoggled = FALSE; - } -#ifndef AMOEBA - if(XtAppPending(app_con) & XtIMXEvent) { + if (Ttoggled && curstate == Talptable) { + TCursorToggle(TOGGLE); + Ttoggled = FALSE; + } + if (XtAppPending(app_con) & XtIMXEvent) { #ifdef VMS - Tselect_mask = X_mask; + Tselect_mask = X_mask; #else /* VMS */ - XFD_COPYSET (&X_mask, &Tselect_mask); + XFD_COPYSET(&X_mask, &Tselect_mask); #endif /* VMS */ - } else { - XFlush(screen->display); + } else { + XFlush(screen->display); #ifdef VMS - Tselect_mask = Select_mask; + Tselect_mask = Select_mask; #else /* VMS */ - XFD_COPYSET (&Select_mask, &Tselect_mask); - if((i = Select(max_plus1, - &Tselect_mask, NULL, NULL, - NULL)) < 0){ - if (errno != EINTR) - SysError(ERROR_TSELECT); - continue; - } + XFD_COPYSET(&Select_mask, &Tselect_mask); + if ((i = Select(max_plus1, + &Tselect_mask, NULL, NULL, + NULL)) < 0) { + if (errno != EINTR) + SysError(ERROR_TSELECT); + continue; + } #endif /* VMS */ - } -#else /* AMOEBA */ - XFlush(screen->display); - i = _X11TransAmSelect(ConnectionNumber(screen->display), - 1); - /* if there are X events already in our queue, - it counts as being readable */ - if (XtAppPending(app_con) || i > 0) { - xevents(); - continue; - } else if (i < 0) { - extern int exiting; - if (errno != EINTR && !exiting) - SysError(ERROR_SELECT); - } - if (Tbuffer->cnt > 0) - goto again; - if (cb_full(screen->tty_outq) <= 0) - SleepMainThread(); -#endif /* AMOEBA */ + } #ifdef VMS - if(Tselect_mask & X_mask) { - xevents(); - if(Tbuffer->cnt > 0) - goto again; - } + if (Tselect_mask & X_mask) { + xevents(); + if (Tbuffer->cnt > 0) + goto again; + } #else /* VMS */ - if(FD_ISSET (ConnectionNumber (screen->display), &Tselect_mask)) { - xevents(); - if(Tbuffer->cnt > 0) - goto again; - } + if (FD_ISSET(ConnectionNumber(screen->display), &Tselect_mask)) { + xevents(); + if (Tbuffer->cnt > 0) + goto again; + } #endif /* VMS */ - } - Tbuffer->cnt--; - if (!Ttoggled && curstate == Talptable) { - TCursorToggle(TOGGLE); - Ttoggled = TRUE; - } } - tek = TekRecord; - if(tek->count >= TEK_LINK_BLOCK_SIZE - || tek->fontsize != screen->cur.fontsize) { - if((TekRecord = tek->next = (TekLink *)malloc(sizeof(TekLink))) - == (TekLink *)0) - Panic("Tinput: malloc error (%d)\n", errno); - tek = tek->next; - tek->next = (TekLink *)0; - tek->fontsize = screen->cur.fontsize; - tek->count = 0; - tek->ptr = tek->data; + Tbuffer->cnt--; + if (!Ttoggled && curstate == Talptable) { + TCursorToggle(TOGGLE); + Ttoggled = TRUE; } - tek->count++; - return(*tek->ptr++ = *(Tbuffer->ptr)++); + } + tek = TekRecord; + if (tek->count >= TEK_LINK_BLOCK_SIZE + || tek->fontsize != screen->cur.fontsize) { + if ((TekRecord = tek->next = (TekLink *) malloc(sizeof(TekLink))) + == (TekLink *) 0) + Panic("Tinput: malloc error (%d)\n", errno); + tek = tek->next; + tek->next = (TekLink *) 0; + tek->fontsize = screen->cur.fontsize; + tek->count = 0; + tek->ptr = tek->data; + } + tek->count++; + return (*tek->ptr++ = *(Tbuffer->ptr)++); } /* this should become the Tek Widget's Resize proc */ -static void TekConfigure(Widget w) +static void +TekConfigure(Widget w) { register TScreen *screen = &term->screen; register int border = 2 * screen->border; register double d; - if (TWindow(screen)) XClearWindow(screen->display, TWindow(screen)); + if (TWindow(screen)) + XClearWindow(screen->display, TWindow(screen)); TWidth(screen) = w->core.width - border; THeight(screen) = w->core.height - border; - TekScale(screen) = (double)TWidth(screen) / TEKWIDTH; - if((d = (double)THeight(screen) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) - < TekScale(screen)) - TekScale(screen) = d; + TekScale(screen) = (double) TWidth(screen) / TEKWIDTH; + if ((d = (double) THeight(screen) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) + < TekScale(screen)) + TekScale(screen) = d; TFullWidth(screen) = w->core.width; TFullHeight(screen) = w->core.height; } /*ARGSUSED*/ void -TekExpose( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - Region region GCC_UNUSED) +TekExpose(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + Region region GCC_UNUSED) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; #ifdef lint - region = region; + region = region; #endif - if(!Ttoggled) - TCursorToggle(CLEAR); - Ttoggled = TRUE; - Tpushback = Tpushb; - screen->cur_X = 0; - screen->cur_Y = TEKHOME; - TekSetFontSize(screen->page.fontsize); - screen->cur = screen->page; - screen->margin = MARGIN1; - if(screen->TekGIN) { - screen->TekGIN = NULL; - TekGINoff(); - } - TekRefresh = &Tek0; - rptr = TekRefresh->data; - rcnt = TekRefresh->count; - Tparsestate = curstate = Talptable; - if (waiting_for_initial_map) - first_map_occurred (); - if(!screen->waitrefresh) - dorefresh(); + if (!Ttoggled) + TCursorToggle(CLEAR); + Ttoggled = TRUE; + Tpushback = Tpushb; + screen->cur_X = 0; + screen->cur_Y = TEKHOME; + TekSetFontSize(screen->page.fontsize); + screen->cur = screen->page; + screen->margin = MARGIN1; + if (screen->TekGIN) { + screen->TekGIN = NULL; + TekGINoff(); + } + TekRefresh = &Tek0; + rptr = TekRefresh->data; + rcnt = TekRefresh->count; + Tparsestate = curstate = Talptable; + if (waiting_for_initial_map) + first_map_occurred(); + if (!screen->waitrefresh) + dorefresh(); } void dorefresh(void) { - register TScreen *screen = &term->screen; - static Cursor wait_cursor = None; + register TScreen *screen = &term->screen; + static Cursor wait_cursor = None; - if (wait_cursor == None) - wait_cursor = make_colored_cursor (XC_watch, screen->mousecolor, - screen->mousecolorback); - XDefineCursor(screen->display, TShellWindow, wait_cursor); - XFlush(screen->display); - if(!setjmp(Tekjump)) - Tekparse(); - XDefineCursor(screen->display, TShellWindow, - (screen->TekGIN && GINcursor) ? GINcursor : screen->arrow); + if (wait_cursor == None) + wait_cursor = make_colored_cursor(XC_watch, screen->mousecolor, + screen->mousecolorback); + XDefineCursor(screen->display, TShellWindow, wait_cursor); + XFlush(screen->display); + if (!setjmp(Tekjump)) + Tekparse(); + XDefineCursor(screen->display, TShellWindow, + (screen->TekGIN && GINcursor) ? GINcursor : screen->arrow); } static void TekPage(void) { - register TScreen *screen = &term->screen; - register TekLink *tek; + register TScreen *screen = &term->screen; + register TekLink *tek; - XClearWindow(screen->display, TWindow(screen)); - screen->cur_X = 0; - screen->cur_Y = TEKHOME; - screen->margin = MARGIN1; - screen->page = screen->cur; - if(screen->TekGIN) - TekGINoff(); - tek = TekRecord = &Tek0; - tek->fontsize = screen->cur.fontsize; - tek->count = 0; - tek->ptr = tek->data; - tek = tek->next; - if(tek) - do { - TekLink *tek2 = tek->next; - - free((char *)tek); - tek = tek2; - } while(tek); - TekRecord->next = (TekLink *)0; - TekRefresh = (TekLink *)0; - Ttoggled = TRUE; - Tparsestate = curstate = Talptable; /* Tek Alpha mode */ + XClearWindow(screen->display, TWindow(screen)); + screen->cur_X = 0; + screen->cur_Y = TEKHOME; + screen->margin = MARGIN1; + screen->page = screen->cur; + if (screen->TekGIN) + TekGINoff(); + tek = TekRecord = &Tek0; + tek->fontsize = screen->cur.fontsize; + tek->count = 0; + tek->ptr = tek->data; + tek = tek->next; + if (tek) + do { + TekLink *tek2 = tek->next; + + free((char *) tek); + tek = tek2; + } while (tek); + TekRecord->next = (TekLink *) 0; + TekRefresh = (TekLink *) 0; + Ttoggled = TRUE; + Tparsestate = curstate = Talptable; /* Tek Alpha mode */ } #define EXTRABITS 017 @@ -1010,229 +1000,229 @@ static int getpoint(void) { - register int c, x, y, e, lo_y = 0; - register TScreen *screen = &term->screen; + register int c, x, y, e, lo_y = 0; + register TScreen *screen = &term->screen; - x = screen->cur.x; - y = screen->cur.y; - for( ; ; ) { - if((c = input()) < ' ') { /* control character */ - unput(c); - return(0); - } - if(c < '@') { /* Hi X or Hi Y */ - if(lo_y) { /* seen a Lo Y, so this must be Hi X */ - x &= ~HIBITS; - x |= (c & FIVEBITS) << SHIFTHI; - continue; - } - /* else Hi Y */ - y &= ~HIBITS; - y |= (c & FIVEBITS) << SHIFTHI; - continue; - } - if(c < '`') { /* Lo X */ - x &= ~LOBITS; - x |= (c & FIVEBITS) << SHIFTLO; - screen->cur.x = x; - screen->cur.y = y; - return(1); /* OK */ - } - /* else Lo Y */ - if(lo_y) { /* seen a Lo Y, so other must be extra bits */ - e = (y >> SHIFTLO) & EXTRABITS; - x &= ~TWOBITS; - x |= e & TWOBITS; - y &= ~TWOBITS; - y |= (e >> SHIFTLO) & TWOBITS; - } - y &= ~LOBITS; - y |= (c & FIVEBITS) << SHIFTLO; - lo_y++; - } + x = screen->cur.x; + y = screen->cur.y; + for (;;) { + if ((c = input()) < ' ') { /* control character */ + unput(c); + return (0); + } + if (c < '@') { /* Hi X or Hi Y */ + if (lo_y) { /* seen a Lo Y, so this must be Hi X */ + x &= ~HIBITS; + x |= (c & FIVEBITS) << SHIFTHI; + continue; + } + /* else Hi Y */ + y &= ~HIBITS; + y |= (c & FIVEBITS) << SHIFTHI; + continue; + } + if (c < '`') { /* Lo X */ + x &= ~LOBITS; + x |= (c & FIVEBITS) << SHIFTLO; + screen->cur.x = x; + screen->cur.y = y; + return (1); /* OK */ + } + /* else Lo Y */ + if (lo_y) { /* seen a Lo Y, so other must be extra bits */ + e = (y >> SHIFTLO) & EXTRABITS; + x &= ~TWOBITS; + x |= e & TWOBITS; + y &= ~TWOBITS; + y |= (e >> SHIFTLO) & TWOBITS; + } + y &= ~LOBITS; + y |= (c & FIVEBITS) << SHIFTLO; + lo_y++; + } } static void TCursorBack(void) { - register TScreen *screen = &term->screen; - register struct Tek_Char *t; - register int x, l; - - x = ( screen->cur_X -= - (t = &TekChar[screen->cur.fontsize])->hsize - ); + register TScreen *screen = &term->screen; + register struct Tek_Char *t; + register int x, l; - if(((screen->margin == MARGIN1) && (x < 0)) + x = (screen->cur_X -= + (t = &TekChar[screen->cur.fontsize])->hsize + ); + + if (((screen->margin == MARGIN1) && (x < 0)) || ((screen->margin == MARGIN2) && (x < TEKWIDTH / 2))) { - if((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= - t->nlines) { - screen->margin = !screen->margin; - l = 0; - } - screen->cur_Y = l * t->vsize; - screen->cur_X = (t->charsperline - 1) * t->hsize; + if ((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= + t->nlines) { + screen->margin = !screen->margin; + l = 0; } + screen->cur_Y = l * t->vsize; + screen->cur_X = (t->charsperline - 1) * t->hsize; + } } static void TCursorForward(void) { - register TScreen *screen = &term->screen; - register struct Tek_Char *t; - register int l; - - if( ( screen->cur_X += - ( t = &TekChar[screen->cur.fontsize])->hsize - ) > TEKWIDTH - ) { - if((l = screen->cur_Y / t->vsize - 1) < 0) { - screen->margin = !screen->margin; - l = t->nlines - 1; - } - screen->cur_Y = l * t->vsize; - screen->cur_X = screen->margin == MARGIN1 ? 0 : TEKWIDTH / 2; + register TScreen *screen = &term->screen; + register struct Tek_Char *t; + register int l; + + if ((screen->cur_X += + (t = &TekChar[screen->cur.fontsize])->hsize + ) > TEKWIDTH + ) { + if ((l = screen->cur_Y / t->vsize - 1) < 0) { + screen->margin = !screen->margin; + l = t->nlines - 1; } + screen->cur_Y = l * t->vsize; + screen->cur_X = screen->margin == MARGIN1 ? 0 : TEKWIDTH / 2; + } } static void TCursorUp(void) { - register TScreen *screen = &term->screen; - register struct Tek_Char *t; - register int l; - - t = &TekChar[screen->cur.fontsize]; - - if((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { - l = 0; - if((screen->margin = !screen->margin) != MARGIN1) { - if(screen->cur_X < TEKWIDTH / 2) - screen->cur_X += TEKWIDTH / 2; - } else if(screen->cur_X >= TEKWIDTH / 2) - screen->cur_X -= TEKWIDTH / 2; - } - screen->cur_Y = l * t->vsize; + register TScreen *screen = &term->screen; + register struct Tek_Char *t; + register int l; + + t = &TekChar[screen->cur.fontsize]; + + if ((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { + l = 0; + if ((screen->margin = !screen->margin) != MARGIN1) { + if (screen->cur_X < TEKWIDTH / 2) + screen->cur_X += TEKWIDTH / 2; + } else if (screen->cur_X >= TEKWIDTH / 2) + screen->cur_X -= TEKWIDTH / 2; + } + screen->cur_Y = l * t->vsize; } static void TCursorDown(void) { - register TScreen *screen = &term->screen; - register struct Tek_Char *t; - register int l; - - t = &TekChar[screen->cur.fontsize]; - - if((l = screen->cur_Y / t->vsize - 1) < 0) { - l = t->nlines - 1; - if((screen->margin = !screen->margin) != MARGIN1) { - if(screen->cur_X < TEKWIDTH / 2) - screen->cur_X += TEKWIDTH / 2; - } else if(screen->cur_X >= TEKWIDTH / 2) - screen->cur_X -= TEKWIDTH / 2; - } - screen->cur_Y = l * t->vsize; + register TScreen *screen = &term->screen; + register struct Tek_Char *t; + register int l; + + t = &TekChar[screen->cur.fontsize]; + + if ((l = screen->cur_Y / t->vsize - 1) < 0) { + l = t->nlines - 1; + if ((screen->margin = !screen->margin) != MARGIN1) { + if (screen->cur_X < TEKWIDTH / 2) + screen->cur_X += TEKWIDTH / 2; + } else if (screen->cur_X >= TEKWIDTH / 2) + screen->cur_X -= TEKWIDTH / 2; + } + screen->cur_Y = l * t->vsize; } static void AddToDraw(int x1, int y1, int x2, int y2) { - register TScreen *screen = &term->screen; - register XSegment *lp; + register TScreen *screen = &term->screen; + register XSegment *lp; - if(nplot >= MAX_PTS) { - TekFlush(); - } - lp = line_pt++; - lp->x1 = x1 = (int) (x1 * TekScale(screen) + screen->border); - lp->y1 = y1 = (int) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(screen) + - screen->border); - lp->x2 = x2 = (int) (x2 * TekScale(screen) + screen->border); - lp->y2 = y2 = (int) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(screen) + - screen->border); - nplot++; + if (nplot >= MAX_PTS) { + TekFlush(); + } + lp = line_pt++; + lp->x1 = x1 = (int) (x1 * TekScale(screen) + screen->border); + lp->y1 = y1 = (int) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(screen) + + screen->border); + lp->x2 = x2 = (int) (x2 * TekScale(screen) + screen->border); + lp->y2 = y2 = (int) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(screen) + + screen->border); + nplot++; } static void -TekDraw (int x, int y) +TekDraw(int x, int y) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - if(nplot == 0 || T_lastx != screen->cur_X || T_lasty != screen->cur_Y) { - /* - * We flush on each unconnected line segment if the line - * type is not solid. This solves a bug in X when drawing - * points while the line type is not solid. - */ - if(nplot > 0 && screen->cur.linetype != SOLIDLINE) - TekFlush(); - } - AddToDraw(screen->cur_X, screen->cur_Y, x, y); - T_lastx = screen->cur_X = x; - T_lasty = screen->cur_Y = y; + if (nplot == 0 || T_lastx != screen->cur_X || T_lasty != screen->cur_Y) { + /* + * We flush on each unconnected line segment if the line + * type is not solid. This solves a bug in X when drawing + * points while the line type is not solid. + */ + if (nplot > 0 && screen->cur.linetype != SOLIDLINE) + TekFlush(); + } + AddToDraw(screen->cur_X, screen->cur_Y, x, y); + T_lastx = screen->cur_X = x; + T_lasty = screen->cur_Y = y; } static void -TekFlush (void) +TekFlush(void) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - XDrawSegments(screen->display, TWindow(screen), - ((screen->cur.linetype == SOLIDLINE)? screen->TnormalGC : - screen->linepat[screen->cur.linetype - 1]), - Tline, nplot); - nplot = 0; - line_pt = Tline; + XDrawSegments(screen->display, TWindow(screen), + ((screen->cur.linetype == SOLIDLINE) ? screen->TnormalGC : + screen->linepat[screen->cur.linetype - 1]), + Tline, nplot); + nplot = 0; + line_pt = Tline; } void TekGINoff(void) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - XDefineCursor(screen->display, TShellWindow, screen->arrow); - if(GINcursor) - XFreeCursor(screen->display, GINcursor); - if(screen->TekGIN) { - *screen->TekGIN = CAN; /* modify recording */ - screen->TekGIN = NULL; - } + XDefineCursor(screen->display, TShellWindow, screen->arrow); + if (GINcursor) + XFreeCursor(screen->display, GINcursor); + if (screen->TekGIN) { + *screen->TekGIN = CAN; /* modify recording */ + screen->TekGIN = NULL; + } } void TekEnqMouse(int c) /* character pressed */ { - register TScreen *screen = &term->screen; - int mousex, mousey, rootx, rooty; - unsigned int mask; /* XQueryPointer */ - Window root, subw; - - XQueryPointer( - screen->display, TWindow(screen), - &root, &subw, - &rootx, &rooty, - &mousex, &mousey, - &mask); - if((mousex = (int)((mousex - screen->border) / TekScale(screen))) < 0) - mousex = 0; - else if(mousex >= TEKWIDTH) - mousex = TEKWIDTH - 1; - if((mousey = (int)(TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) / - TekScale(screen))) < 0) - mousey = 0; - else if(mousey >= TEKHEIGHT) - mousey = TEKHEIGHT - 1; - TekEnq(c, mousex, mousey); -} - -static void TekEnq ( - int status, - register int x, - register int y) + register TScreen *screen = &term->screen; + int mousex, mousey, rootx, rooty; + unsigned int mask; /* XQueryPointer */ + Window root, subw; + + XQueryPointer( + screen->display, TWindow(screen), + &root, &subw, + &rootx, &rooty, + &mousex, &mousey, + &mask); + if ((mousex = (int) ((mousex - screen->border) / TekScale(screen))) < 0) + mousex = 0; + else if (mousex >= TEKWIDTH) + mousex = TEKWIDTH - 1; + if ((mousey = (int) (TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) / + TekScale(screen))) < 0) + mousey = 0; + else if (mousey >= TEKHEIGHT) + mousey = TEKHEIGHT - 1; + TekEnq(c, mousex, mousey); +} + +static void +TekEnq(int status, + register int x, + register int y) { register TScreen *screen = &term->screen; - Char cplot [7]; + Char cplot[7]; int len = 5; int adj = (status != 0) ? 0 : 1; @@ -1248,46 +1238,46 @@ if (screen->gin_terminator == GIN_TERM_EOT) cplot[len++] = '\004'; #ifdef VMS - tt_write(cplot+adj, len-adj); + tt_write(cplot + adj, len - adj); #else /* VMS */ - v_write(screen->respond, cplot+adj, len-adj); + v_write(screen->respond, cplot + adj, len - adj); #endif /* VMS */ } void TekRun(void) { - register TScreen *screen = &term->screen; - register int i; + register TScreen *screen = &term->screen; + register int i; - if(!TWindow(screen) && !TekInit()) { - if(VWindow(screen)) { - screen->TekEmu = FALSE; - return; - } - Exit(ERROR_TINIT); + if (!TWindow(screen) && !TekInit()) { + if (VWindow(screen)) { + screen->TekEmu = FALSE; + return; } - if(!screen->Tshow) { - set_tek_visibility (TRUE); - } - update_vttekmode(); - update_vtshow(); - update_tekshow(); - set_tekhide_sensitivity(); - - Tpushback = Tpushb; - Tbuffer->ptr = DecodedData(Tbuffer); - for(i = Tbuffer->cnt = VTbuffer.cnt ; i > 0 ; i--) - *(Tbuffer->ptr)++ = *(VTbuffer.ptr)++; - Tbuffer->ptr = DecodedData(Tbuffer); + Exit(ERROR_TINIT); + } + if (!screen->Tshow) { + set_tek_visibility(TRUE); + } + update_vttekmode(); + update_vtshow(); + update_tekshow(); + set_tekhide_sensitivity(); + + Tpushback = Tpushb; + Tbuffer->ptr = DecodedData(Tbuffer); + for (i = Tbuffer->cnt = VTbuffer.cnt; i > 0; i--) + *(Tbuffer->ptr)++ = *(VTbuffer.ptr)++; + Tbuffer->ptr = DecodedData(Tbuffer); + Ttoggled = TRUE; + if (!setjmp(Tekend)) + Tekparse(); + if (!Ttoggled) { + TCursorToggle(TOGGLE); Ttoggled = TRUE; - if(!setjmp(Tekend)) - Tekparse(); - if(!Ttoggled) { - TCursorToggle(TOGGLE); - Ttoggled = TRUE; - } - screen->TekEmu = FALSE; + } + screen->TekEmu = FALSE; } #define DOTTED_LENGTH 2 @@ -1295,36 +1285,40 @@ #define SHORT_DASHED_LENGTH 2 #define LONG_DASHED_LENGTH 2 -static int dash_length[TEKNUMLINES] = { - DOTTED_LENGTH, - DOT_DASHED_LENGTH, - SHORT_DASHED_LENGTH, - LONG_DASHED_LENGTH, +static int dash_length[TEKNUMLINES] = +{ + DOTTED_LENGTH, + DOT_DASHED_LENGTH, + SHORT_DASHED_LENGTH, + LONG_DASHED_LENGTH, }; -static unsigned char dotted[DOTTED_LENGTH] = {3, 1}; -static unsigned char dot_dashed[DOT_DASHED_LENGTH] = {3, 4, 3, 1}; -static unsigned char short_dashed[SHORT_DASHED_LENGTH] = {4, 4}; -static unsigned char long_dashed[LONG_DASHED_LENGTH] = {4, 7}; - -static unsigned char *dashes[TEKNUMLINES] = { - dotted, - dot_dashed, - short_dashed, - long_dashed, +static unsigned char dotted[DOTTED_LENGTH] = +{3, 1}; +static unsigned char dot_dashed[DOT_DASHED_LENGTH] = +{3, 4, 3, 1}; +static unsigned char short_dashed[SHORT_DASHED_LENGTH] = +{4, 4}; +static unsigned char long_dashed[LONG_DASHED_LENGTH] = +{4, 7}; + +static unsigned char *dashes[TEKNUMLINES] = +{ + dotted, + dot_dashed, + short_dashed, + long_dashed, }; - - /* * The following is called to create the tekWidget */ -static void TekInitialize( - Widget request GCC_UNUSED, - Widget wnew GCC_UNUSED, - ArgList args GCC_UNUSED, - Cardinal *num_args GCC_UNUSED) +static void +TekInitialize(Widget request GCC_UNUSED, + Widget wnew GCC_UNUSED, + ArgList args GCC_UNUSED, + Cardinal * num_args GCC_UNUSED) { Widget tekparent = SHELL_OF(wnew); @@ -1332,20 +1326,19 @@ * to care about the shell's border being part of our focus. */ XtAddEventHandler(tekparent, EnterWindowMask, FALSE, - HandleEnterWindow, (caddr_t)NULL); + HandleEnterWindow, (caddr_t) NULL); XtAddEventHandler(tekparent, LeaveWindowMask, FALSE, - HandleLeaveWindow, (caddr_t)NULL); + HandleLeaveWindow, (caddr_t) NULL); XtAddEventHandler(tekparent, FocusChangeMask, FALSE, - HandleFocusChange, (caddr_t)NULL); - XtAddEventHandler((Widget)wnew, PropertyChangeMask, FALSE, - HandleBellPropertyChange, (Opaque)NULL); + HandleFocusChange, (caddr_t) NULL); + XtAddEventHandler((Widget) wnew, PropertyChangeMask, FALSE, + HandleBellPropertyChange, (Opaque) NULL); } - -static void TekRealize ( - Widget gw, - XtValueMask *valuemaskp, - XSetWindowAttributes *values) +static void +TekRealize(Widget gw, + XtValueMask * valuemaskp, + XSetWindowAttributes * values) { TekWidget tw = (TekWidget) gw; register TScreen *screen = &term->screen; @@ -1367,7 +1360,7 @@ for (i = 0; i < TEKNUMFONTS; i++) { if (!tw->tek.Tfont[i]) - tw->tek.Tfont[i] = XQueryFont (screen->display, DefaultGCID); + tw->tek.Tfont[i] = XQueryFont(screen->display, DefaultGCID); tw->tek.tobaseline[i] = tw->tek.Tfont[i]->ascent; } @@ -1390,7 +1383,7 @@ defwidth = TEKDEFWIDTH; defheight = TEKDEFHEIGHT; } - sprintf (Tdefault, "=%dx%d", defwidth + border, defheight + border); + sprintf(Tdefault, "=%dx%d", defwidth + border, defheight + border); term->misc.T_geometry = Tdefault; } @@ -1399,36 +1392,40 @@ width = TEKDEFWIDTH + border; height = TEKDEFHEIGHT + border; - pr = XParseGeometry(term->misc.T_geometry, &winX, &winY, (unsigned int *)&width, (unsigned int *)&height); + pr = XParseGeometry(term->misc.T_geometry, + &winX, + &winY, + (unsigned int *) &width, + (unsigned int *) &height); if ((pr & XValue) && (pr & XNegative)) - winX += DisplayWidth(screen->display, DefaultScreen(screen->display)) - - width - (SHELL_OF(term)->core.border_width * 2); + winX += DisplayWidth(screen->display, DefaultScreen(screen->display)) + - width - (SHELL_OF(term)->core.border_width * 2); if ((pr & YValue) && (pr & YNegative)) - winY += DisplayHeight(screen->display, DefaultScreen(screen->display)) - - height - (SHELL_OF(term)->core.border_width * 2); + winY += DisplayHeight(screen->display, DefaultScreen(screen->display)) + - height - (SHELL_OF(term)->core.border_width * 2); /* set up size hints */ sizehints.min_width = TEKMINWIDTH + border; sizehints.min_height = TEKMINHEIGHT + border; sizehints.width_inc = 1; sizehints.height_inc = 1; - sizehints.flags = PMinSize|PResizeInc; + sizehints.flags = PMinSize | PResizeInc; sizehints.x = winX; sizehints.y = winY; - if ((XValue&pr) || (YValue&pr)) { - sizehints.flags |= USSize|USPosition; + if ((XValue & pr) || (YValue & pr)) { + sizehints.flags |= USSize | USPosition; sizehints.flags |= PWinGravity; switch (pr & (XNegative | YNegative)) { - case 0: + case 0: sizehints.win_gravity = NorthWestGravity; break; - case XNegative: + case XNegative: sizehints.win_gravity = NorthEastGravity; break; - case YNegative: + case YNegative: sizehints.win_gravity = SouthWestGravity; break; - default: + default: sizehints.win_gravity = SouthEastGravity; break; } @@ -1437,69 +1434,70 @@ } sizehints.width = width; sizehints.height = height; - if ((WidthValue&pr) || (HeightValue&pr)) - sizehints.flags |= USSize; - else sizehints.flags |= PSize; + if ((WidthValue & pr) || (HeightValue & pr)) + sizehints.flags |= USSize; + else + sizehints.flags |= PSize; - (void) XtMakeResizeRequest ((Widget) tw, width, height, - &tw->core.width, &tw->core.height); + (void) XtMakeResizeRequest((Widget) tw, width, height, + &tw->core.width, &tw->core.height); /* XXX This is bogus. We are parsing geometries too late. This * is information that the shell widget ought to have before we get * realized, so that it can do the right thing. */ if (sizehints.flags & USPosition) - XMoveWindow (XtDisplay(tw), XtWindow(SHELL_OF(tw)), - sizehints.x, sizehints.y); + XMoveWindow(XtDisplay(tw), XtWindow(SHELL_OF(tw)), + sizehints.x, sizehints.y); - XSetWMNormalHints (XtDisplay(tw), XtWindow(SHELL_OF(tw)), - &sizehints); - XFlush (XtDisplay(tw)); /* get it out to window manager */ + XSetWMNormalHints(XtDisplay(tw), XtWindow(SHELL_OF(tw)), + &sizehints); + XFlush(XtDisplay(tw)); /* get it out to window manager */ values->win_gravity = NorthWestGravity; values->background_pixel = screen->Tbackground; XtWindow(tw) = TWindow(screen) = - XCreateWindow (screen->display, - XtWindow(SHELL_OF(tw)), - tw->core.x, tw->core.y, - tw->core.width, tw->core.height, tw->core.border_width, - (int) tw->core.depth, - InputOutput, CopyFromParent, - ((*valuemaskp)|CWBackPixel|CWWinGravity), - values); + XCreateWindow(screen->display, + XtWindow(SHELL_OF(tw)), + tw->core.x, tw->core.y, + tw->core.width, tw->core.height, tw->core.border_width, + (int) tw->core.depth, + InputOutput, CopyFromParent, + ((*valuemaskp) | CWBackPixel | CWWinGravity), + values); TFullWidth(screen) = width; TFullHeight(screen) = height; TWidth(screen) = width - border; THeight(screen) = height - border; - TekScale(screen) = (double)TWidth(screen) / TEKWIDTH; - if((d = (double)THeight(screen) / (TEKHEIGHT + TEKTOPPAD + - TEKBOTTOMPAD)) < TekScale(screen)) - TekScale(screen) = d; - + TekScale(screen) = (double) TWidth(screen) / TEKWIDTH; + if ((d = (double) THeight(screen) / (TEKHEIGHT + TEKTOPPAD + + TEKBOTTOMPAD)) < TekScale(screen)) + TekScale(screen) = d; screen->cur.fontsize = TEK_FONT_LARGE; if (tw->tek.initial_font) { char *s = tw->tek.initial_font; - if (XmuCompareISOLatin1 (s, "large") == 0) - screen->cur.fontsize = TEK_FONT_LARGE; - else if (XmuCompareISOLatin1 (s, "2") == 0 || - XmuCompareISOLatin1 (s, "two") == 0) - screen->cur.fontsize = TEK_FONT_2; - else if (XmuCompareISOLatin1 (s, "3") == 0 || - XmuCompareISOLatin1 (s, "three") == 0) - screen->cur.fontsize = TEK_FONT_3; - else if (XmuCompareISOLatin1 (s, "small") == 0) - screen->cur.fontsize = TEK_FONT_SMALL; + if (XmuCompareISOLatin1(s, "large") == 0) + screen->cur.fontsize = TEK_FONT_LARGE; + else if (XmuCompareISOLatin1(s, "2") == 0 || + XmuCompareISOLatin1(s, "two") == 0) + screen->cur.fontsize = TEK_FONT_2; + else if (XmuCompareISOLatin1(s, "3") == 0 || + XmuCompareISOLatin1(s, "three") == 0) + screen->cur.fontsize = TEK_FONT_3; + else if (XmuCompareISOLatin1(s, "small") == 0) + screen->cur.fontsize = TEK_FONT_SMALL; } +#define TestGIN(s) XmuCompareISOLatin1(tw->tek.gin_terminator_str, s) - if(XmuCompareISOLatin1(tw->tek.gin_terminator_str, GIN_TERM_NONE_STR) == 0) + if (TestGIN(GIN_TERM_NONE_STR) == 0) screen->gin_terminator = GIN_TERM_NONE; - else if(XmuCompareISOLatin1(tw->tek.gin_terminator_str, GIN_TERM_CR_STR) == 0) + else if (TestGIN(GIN_TERM_CR_STR) == 0) screen->gin_terminator = GIN_TERM_CR; - else if(XmuCompareISOLatin1(tw->tek.gin_terminator_str, GIN_TERM_EOT_STR) == 0) + else if (TestGIN(GIN_TERM_EOT_STR) == 0) screen->gin_terminator = GIN_TERM_EOT; else fprintf(stderr, "%s: illegal GIN terminator setting \"%s\"\n", @@ -1514,61 +1512,61 @@ the Default GC's ID, meaning that we must use the server default font. */ TEKgcFontMask = (gcv.font == DefaultGCID) ? 0 : GCFont; - screen->TnormalGC = XCreateGC (screen->display, TWindow(screen), - (TEKgcFontMask|GCGraphicsExposures| - GCForeground|GCBackground), &gcv); + screen->TnormalGC = XCreateGC(screen->display, TWindow(screen), + (TEKgcFontMask | GCGraphicsExposures | + GCForeground | GCBackground), &gcv); gcv.function = GXinvert; gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ screen->Tcursorcolor); gcv.join_style = JoinMiter; /* default */ gcv.line_width = 1; - screen->TcursorGC = XCreateGC (screen->display, TWindow(screen), - (GCFunction|GCPlaneMask), &gcv); + screen->TcursorGC = XCreateGC(screen->display, TWindow(screen), + (GCFunction | GCPlaneMask), &gcv); gcv.foreground = screen->Tforeground; gcv.line_style = LineOnOffDash; gcv.line_width = 0; - for(i = 0 ; i < TEKNUMLINES ; i++) { - screen->linepat[i] = XCreateGC (screen->display, TWindow(screen), - (GCForeground|GCLineStyle), &gcv); - XSetDashes (screen->display, screen->linepat[i], 0, - (char *) dashes[i], dash_length[i]); + for (i = 0; i < TEKNUMLINES; i++) { + screen->linepat[i] = XCreateGC(screen->display, TWindow(screen), + (GCForeground | GCLineStyle), &gcv); + XSetDashes(screen->display, screen->linepat[i], 0, + (char *) dashes[i], dash_length[i]); } TekBackground(screen); - screen->margin = MARGIN1; /* Margin 1 */ - screen->TekGIN = FALSE; /* GIN off */ + screen->margin = MARGIN1; /* Margin 1 */ + screen->TekGIN = FALSE; /* GIN off */ - XDefineCursor(screen->display, TShellWindow, screen->pointer_cursor); - { /* there's gotta be a better way... */ - static Arg args[] = { - {XtNtitle, (XtArgVal)NULL}, - {XtNiconName, (XtArgVal)NULL}, + { /* there's gotta be a better way... */ + static Arg args[] = + { + {XtNtitle, (XtArgVal) NULL}, + {XtNiconName, (XtArgVal) NULL}, }; char *icon_name, *title, *tek_icon_name, *tek_title; - args[0].value = (XtArgVal)&icon_name; - args[1].value = (XtArgVal)&title; - XtGetValues (SHELL_OF(tw), args, 2); - tek_icon_name = XtMalloc(strlen(icon_name)+7); + args[0].value = (XtArgVal) & icon_name; + args[1].value = (XtArgVal) & title; + XtGetValues(SHELL_OF(tw), args, 2); + tek_icon_name = XtMalloc(strlen(icon_name) + 7); strcpy(tek_icon_name, icon_name); strcat(tek_icon_name, "(Tek)"); - tek_title = XtMalloc(strlen(title)+7); + tek_title = XtMalloc(strlen(title) + 7); strcpy(tek_title, title); strcat(tek_title, "(Tek)"); - args[0].value = (XtArgVal)tek_icon_name; - args[1].value = (XtArgVal)tek_title; - XtSetValues (SHELL_OF(tw), args, 2); - XtFree( tek_icon_name ); - XtFree( tek_title ); + args[0].value = (XtArgVal) tek_icon_name; + args[1].value = (XtArgVal) tek_title; + XtSetValues(SHELL_OF(tw), args, 2); + XtFree(tek_icon_name); + XtFree(tek_title); } tek = TekRecord = &Tek0; - tek->next = (TekLink *)0; + tek->next = (TekLink *) 0; tek->fontsize = screen->cur.fontsize; tek->count = 0; tek->ptr = tek->data; @@ -1582,125 +1580,125 @@ return; } -void TekSetFontSize (int newitem) +void +TekSetFontSize(int newitem) { register TScreen *screen = &term->screen; int oldsize = screen->cur.fontsize; int newsize = MI2FS(newitem); Font fid; - if (!tekWidget || oldsize == newsize) + if (!tekWidget || oldsize == newsize) return; - if (!Ttoggled) TCursorToggle(TOGGLE); - set_tekfont_menu_item (oldsize, FALSE); + if (!Ttoggled) + TCursorToggle(TOGGLE); + set_tekfont_menu_item(oldsize, FALSE); fid = tekWidget->tek.Tfont[newsize]->fid; if (fid == DefaultGCID) - /* we didn't succeed in opening a real font - for this size. Instead, use server default. */ - XCopyGC (screen->display, + /* we didn't succeed in opening a real font + for this size. Instead, use server default. */ + XCopyGC(screen->display, DefaultGC(screen->display, DefaultScreen(screen->display)), GCFont, screen->TnormalGC); else - XSetFont (screen->display, screen->TnormalGC, fid); + XSetFont(screen->display, screen->TnormalGC, fid); screen->cur.fontsize = newsize; - set_tekfont_menu_item (newsize, TRUE); - if (!Ttoggled) TCursorToggle(TOGGLE); + set_tekfont_menu_item(newsize, TRUE); + if (!Ttoggled) + TCursorToggle(TOGGLE); } void -ChangeTekColors(register TScreen *screen, ScrnColors *pNew) +ChangeTekColors(register TScreen * screen, ScrnColors * pNew) { - register int i; - XGCValues gcv; - - - if (COLOR_DEFINED(pNew,TEK_FG)) { - screen->Tforeground= COLOR_VALUE(pNew,TEK_FG); - XSetForeground(screen->display,screen->TnormalGC, - screen->Tforeground); - } - if (COLOR_DEFINED(pNew,TEK_BG)) { - screen->Tbackground= COLOR_VALUE(pNew,TEK_BG); - XSetBackground(screen->display,screen->TnormalGC, - screen->Tbackground); - } + register int i; + XGCValues gcv; + if (COLOR_DEFINED(pNew, TEK_FG)) { + screen->Tforeground = COLOR_VALUE(pNew, TEK_FG); + XSetForeground(screen->display, screen->TnormalGC, + screen->Tforeground); + } + if (COLOR_DEFINED(pNew, TEK_BG)) { + screen->Tbackground = COLOR_VALUE(pNew, TEK_BG); + XSetBackground(screen->display, screen->TnormalGC, + screen->Tbackground); + } - if (tekWidget) { - if (tekWidget->core.border_pixel == screen->Tbackground) { - tekWidget->core.border_pixel = screen->Tforeground; - XtParent(tekWidget)->core.border_pixel = - screen->Tforeground; - if (XtWindow(XtParent(tekWidget))) - XSetWindowBorder (screen->display, - XtWindow(XtParent(tekWidget)), - tekWidget->core.border_pixel); - } + if (tekWidget) { + if (tekWidget->core.border_pixel == screen->Tbackground) { + tekWidget->core.border_pixel = screen->Tforeground; + XtParent(tekWidget)->core.border_pixel = + screen->Tforeground; + if (XtWindow(XtParent(tekWidget))) + XSetWindowBorder(screen->display, + XtWindow(XtParent(tekWidget)), + tekWidget->core.border_pixel); } + } - for(i = 0 ; i < TEKNUMLINES ; i++) { - XSetForeground(screen->display, screen->linepat[i], - screen->Tforeground); - } + for (i = 0; i < TEKNUMLINES; i++) { + XSetForeground(screen->display, screen->linepat[i], + screen->Tforeground); + } - screen->Tcursorcolor = screen->Tforeground; + screen->Tcursorcolor = screen->Tforeground; - gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ - screen->Tcursorcolor); - XChangeGC (screen->display, screen->TcursorGC, GCPlaneMask, &gcv); - TekBackground(screen); - return; + gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ + screen->Tcursorcolor); + XChangeGC(screen->display, screen->TcursorGC, GCPlaneMask, &gcv); + TekBackground(screen); + return; } void -TekReverseVideo(register TScreen *screen) +TekReverseVideo(register TScreen * screen) { - register int i; - XGCValues gcv; - - - i = screen->Tbackground; - screen->Tbackground = screen->Tforeground; - screen->Tforeground = i; - - XSetForeground(screen->display, screen->TnormalGC, - screen->Tforeground); - XSetBackground(screen->display, screen->TnormalGC, - screen->Tbackground); + register int i; + XGCValues gcv; - if (tekWidget) { - if (tekWidget->core.border_pixel == screen->Tbackground) { - tekWidget->core.border_pixel = screen->Tforeground; - XtParent(tekWidget)->core.border_pixel = - screen->Tforeground; - if (XtWindow(XtParent(tekWidget))) - XSetWindowBorder (screen->display, - XtWindow(XtParent(tekWidget)), - tekWidget->core.border_pixel); - } + i = screen->Tbackground; + screen->Tbackground = screen->Tforeground; + screen->Tforeground = i; + + XSetForeground(screen->display, screen->TnormalGC, + screen->Tforeground); + XSetBackground(screen->display, screen->TnormalGC, + screen->Tbackground); + + if (tekWidget) { + if (tekWidget->core.border_pixel == screen->Tbackground) { + tekWidget->core.border_pixel = screen->Tforeground; + XtParent(tekWidget)->core.border_pixel = + screen->Tforeground; + if (XtWindow(XtParent(tekWidget))) + XSetWindowBorder(screen->display, + XtWindow(XtParent(tekWidget)), + tekWidget->core.border_pixel); } + } - for(i = 0 ; i < TEKNUMLINES ; i++) { - XSetForeground(screen->display, screen->linepat[i], - screen->Tforeground); - } + for (i = 0; i < TEKNUMLINES; i++) { + XSetForeground(screen->display, screen->linepat[i], + screen->Tforeground); + } - screen->Tcursorcolor = screen->Tforeground; + screen->Tcursorcolor = screen->Tforeground; - gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ - screen->Tcursorcolor); - XChangeGC (screen->display, screen->TcursorGC, GCPlaneMask, &gcv); - TekBackground(screen); + gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ + screen->Tcursorcolor); + XChangeGC(screen->display, screen->TcursorGC, GCPlaneMask, &gcv); + TekBackground(screen); } static void -TekBackground(register TScreen *screen) +TekBackground(register TScreen * screen) { - if(TWindow(screen)) - XSetWindowBackground(screen->display, TWindow(screen), - screen->Tbackground); + if (TWindow(screen)) + XSetWindowBackground(screen->display, TWindow(screen), + screen->Tbackground); } /* @@ -1709,54 +1707,56 @@ void TCursorToggle(int toggle) /* TOGGLE or CLEAR */ { - register TScreen *screen = &term->screen; - register int c, x, y; - unsigned int cellwidth, cellheight; - - if (!screen->Tshow) return; - - c = screen->cur.fontsize; - cellwidth = (unsigned) tekWidget->tek.Tfont[c]->max_bounds.width; - cellheight = (unsigned) (tekWidget->tek.Tfont[c]->ascent + - tekWidget->tek.Tfont[c]->descent); - - x = (int)((screen->cur_X * TekScale(screen)) + screen->border); - y = (int)(((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) - + screen->border - tekWidget->tek.tobaseline[c]); - - if (toggle == TOGGLE) { - if (screen->select || screen->always_highlight) - XFillRectangle(screen->display, TWindow(screen), - screen->TcursorGC, x, y, - cellwidth, cellheight); - else { /* fix to use different GC! */ - XDrawRectangle(screen->display, TWindow(screen), - screen->TcursorGC, x, y, - cellwidth-1, cellheight-1); - } - } else { - /* Clear the entire rectangle, even though we may only - * have drawn an outline. This fits with our refresh - * scheme of redrawing the entire window on any expose - * event and is easier than trying to figure out exactly - * which part of the cursor needs to be erased. - */ - XClearArea(screen->display, TWindow(screen), x, y, - cellwidth, cellheight, FALSE); + register TScreen *screen = &term->screen; + register int c, x, y; + unsigned int cellwidth, cellheight; + + if (!screen->Tshow) + return; + + c = screen->cur.fontsize; + cellwidth = (unsigned) tekWidget->tek.Tfont[c]->max_bounds.width; + cellheight = (unsigned) (tekWidget->tek.Tfont[c]->ascent + + tekWidget->tek.Tfont[c]->descent); + + x = (int) ((screen->cur_X * TekScale(screen)) + screen->border); + y = (int) (((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) + + screen->border - tekWidget->tek.tobaseline[c]); + + if (toggle == TOGGLE) { + if (screen->select || screen->always_highlight) + XFillRectangle(screen->display, TWindow(screen), + screen->TcursorGC, x, y, + cellwidth, cellheight); + else { /* fix to use different GC! */ + XDrawRectangle(screen->display, TWindow(screen), + screen->TcursorGC, x, y, + cellwidth - 1, cellheight - 1); } + } else { + /* Clear the entire rectangle, even though we may only + * have drawn an outline. This fits with our refresh + * scheme of redrawing the entire window on any expose + * event and is easier than trying to figure out exactly + * which part of the cursor needs to be erased. + */ + XClearArea(screen->display, TWindow(screen), x, y, + cellwidth, cellheight, FALSE); + } } -void TekSimulatePageButton (Bool reset) +void +TekSimulatePageButton(Bool reset) { register TScreen *screen = &term->screen; if (!tekWidget) return; if (reset) { - bzero ((char *) &screen->cur, sizeof screen->cur); + bzero((char *) &screen->cur, sizeof screen->cur); } - TekRefresh = (TekLink *)0; - TekPage (); + TekRefresh = (TekLink *) 0; + TekPage(); screen->cur_X = 0; screen->cur_Y = TEKHOME; } @@ -1775,28 +1775,27 @@ timestamp_filename(buf, "COPY"); if (access(buf, F_OK) >= 0 - && access(buf, W_OK) < 0) { - Bell(XkbBI_MinorError,0); + && access(buf, W_OK) < 0) { + Bell(XkbBI_MinorError, 0); return; } - #ifndef VMS - if(access(".", W_OK) < 0) { /* can't write in directory */ - Bell(XkbBI_MinorError,0); + if (access(".", W_OK) < 0) { /* can't write in directory */ + Bell(XkbBI_MinorError, 0); return; } #endif if ((tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False)) >= 0) { sprintf(initbuf, "%c%c%c%c", - ESC, screen->page.fontsize + '8', - ESC, screen->page.linetype + '`'); + ESC, screen->page.fontsize + '8', + ESC, screen->page.linetype + '`'); write(tekcopyfd, initbuf, 4); Tp = &Tek0; do { - write(tekcopyfd, (char *)Tp->data, Tp->count); + write(tekcopyfd, (char *) Tp->data, Tp->count); Tp = Tp->next; - } while(Tp); + } while (Tp); close(tekcopyfd); } } Index: xc/programs/xterm/VTPrsTbl.c diff -u xc/programs/xterm/VTPrsTbl.c:3.23 xc/programs/xterm/VTPrsTbl.c:3.24 --- xc/programs/xterm/VTPrsTbl.c:3.23 Wed Jan 17 18:46:34 2001 +++ xc/programs/xterm/VTPrsTbl.c Sun Dec 8 17:31:47 2002 @@ -2,7 +2,7 @@ * $Xorg: VTPrsTbl.c,v 1.3 2000/08/17 19:55:07 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/VTPrsTbl.c,v 3.23 2001/01/17 23:46:34 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/VTPrsTbl.c,v 3.24 2002/12/08 22:31:47 dickey Exp $ */ /* * * Copyright 1999-2000 by Thomas E. Dickey @@ -60,7 +60,7 @@ #if !OPT_DEC_LOCATOR #undef CASE_CSI_TICK_STATE -#define CASE_CSI_TICK_STATE CASE_ESC_IGNORE +#define CASE_CSI_TICK_STATE CASE_CSI_IGNORE #endif #if !OPT_WIDE_CHARS @@ -77,13 +77,13 @@ { /* NUL SOH STX ETX */ CASE_IGNORE, -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_PRINT, +CASE_IGNORE, CASE_ENQ, -CASE_PRINT, +CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, @@ -96,25 +96,25 @@ CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* DC4 NAK SYN ETB */ -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* SP ! " # */ CASE_PRINT, CASE_PRINT, @@ -234,40 +234,40 @@ CASE_PRINT, CASE_PRINT, CASE_PRINT, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_PRINT, -CASE_PRINT, CASE_PRINT, -CASE_PRINT, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x84 0x85 0x86 0x87 */ CASE_IND, CASE_NEL, -CASE_PRINT, -CASE_PRINT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x88 0x89 0x8a 0x8b */ CASE_HTS, -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x8c 0x8d 0x8e 0x8f */ -CASE_PRINT, +CASE_GROUND_STATE, CASE_RI, CASE_SS2, CASE_SS3, /* 0x90 0x91 0x92 0x93 */ CASE_DCS, -CASE_PRINT, -CASE_PRINT, -CASE_PRINT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x94 0x95 0x96 0x97 */ -CASE_PRINT, -CASE_PRINT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, CASE_SPA, CASE_EPA, /* 0x98 0x99 0x9a 0x9b */ CASE_SOS, -CASE_PRINT, +CASE_GROUND_STATE, CASE_DECID, CASE_CSI_STATE, /* 0x9c 0x9d 0x9e 0x9f */ @@ -406,7 +406,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -430,9 +430,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -440,25 +440,25 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, CASE_CSI_EX_STATE, CASE_CSI_QUOTE_STATE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, CASE_CSI_TICK_STATE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, @@ -472,10 +472,10 @@ /* 8 9 : ; */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, -CASE_IGNORE, +CASE_CSI_IGNORE, CASE_ESC_SEMI, /* < = > ? */ -CASE_IGNORE, +CASE_CSI_IGNORE, CASE_DEC3_STATE, CASE_DEC2_STATE, CASE_DEC_STATE, @@ -558,121 +558,121 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_ESC_SEMI, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_DEC3_STATE, +CASE_DEC2_STATE, +CASE_DEC_STATE, /* Agrave Aacute Acircumflex Atilde */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, /* Adiaeresis Aring AE Ccedilla */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, /* Egrave Eacute Ecircumflex Ediaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, /* Igrave Iacute Icircumflex Idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IL, +CASE_DL, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DCH, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SU, /* Ocircumflex Otilde Odiaeresis multiply */ -CASE_GROUND_STATE, +CASE_TRACK_MOUSE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ECH, CASE_GROUND_STATE, +CASE_CBT, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, @@ -680,37 +680,37 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_HPA, CASE_GROUND_STATE, +CASE_REP, +CASE_DA1, /* adiaeresis aring ae ccedilla */ +CASE_VPA, CASE_GROUND_STATE, +CASE_CUP, +CASE_TBC, +/* egrave eacute ecircumflex ediaeresis */ +CASE_SET, +CASE_MC, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_RST, +CASE_SGR, +CASE_CPR, CASE_GROUND_STATE, -/* egrave eacute ecircumflex ediaeresis */ +/* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* igrave iacute icircumflex idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* eth ntilde ograve oacute */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECSTBM, +CASE_DECSC, /* ocircumflex otilde odiaeresis division */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_XTERM_WINOPS, +CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ -CASE_GROUND_STATE, +CASE_DECREQTPARM, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -718,10 +718,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, }; -Const PARSE_T csi_ex_table[] = /* CSI ! */ +Const PARSE_T csi2_table[] = /* CSI */ { /* NUL SOH STX ETX */ CASE_IGNORE, @@ -729,8 +729,8 @@ CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_IGNORE, CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -754,9 +754,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -764,205 +764,528 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* 4 5 6 7 */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* D E F G */ +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, +/* H I J K */ +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, +/* L M N O */ +CASE_IL, +CASE_DL, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* 8 9 : ; */ +/* P Q R S */ +CASE_DCH, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SU, +/* T U V W */ +CASE_TRACK_MOUSE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* < = > ? */ CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_ECH, CASE_GROUND_STATE, +CASE_CBT, CASE_GROUND_STATE, +/* \ ] ^ _ */ CASE_GROUND_STATE, -/* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* ` a b c */ +CASE_HPA, CASE_GROUND_STATE, -/* D E F G */ +CASE_REP, +CASE_DA1, +/* d e f g */ +CASE_VPA, CASE_GROUND_STATE, +CASE_CUP, +CASE_TBC, +/* h i j k */ +CASE_SET, +CASE_MC, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* l m n o */ +CASE_RST, +CASE_SGR, +CASE_CPR, CASE_GROUND_STATE, -/* H I J K */ +/* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_DECSTBM, +CASE_DECSC, +/* t u v w */ +CASE_XTERM_WINOPS, +CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* L M N O */ +/* x y z { */ +CASE_DECREQTPARM, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* | } ~ DEL */ CASE_GROUND_STATE, -/* P Q R S */ -CASE_IGNORE_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, -/* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, -/* X Y Z [ */ CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* \ ] ^ _ */ +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* ` a b c */ +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_ESC_SEMI, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* Adiaeresis Aring AE Ccedilla */ +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IL, +CASE_DL, CASE_GROUND_STATE, -/* d e f g */ CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_DCH, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SU, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_TRACK_MOUSE, CASE_GROUND_STATE, -/* h i j k */ CASE_GROUND_STATE, CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_ECH, CASE_GROUND_STATE, +CASE_CBT, CASE_GROUND_STATE, -/* l m n o */ +/* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* p q r s */ -CASE_DECSTR, +/* agrave aacute acircumflex atilde */ +CASE_HPA, CASE_GROUND_STATE, +CASE_REP, +CASE_DA1, +/* adiaeresis aring ae ccedilla */ +CASE_VPA, CASE_GROUND_STATE, +CASE_CUP, +CASE_TBC, +/* egrave eacute ecircumflex ediaeresis */ +CASE_SET, +CASE_MC, CASE_GROUND_STATE, -/* t u v w */ CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_RST, +CASE_SGR, +CASE_CPR, CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, -/* x y z { */ +CASE_DECSTBM, +CASE_DECSC, +/* ocircumflex otilde odiaeresis division */ +CASE_XTERM_WINOPS, +CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_DECREQTPARM, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* | } ~ DEL */ CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, +}; +Const PARSE_T csi_ex_table[] = /* CSI ! */ +{ +/* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, +/* EOT ENQ ACK BEL */ CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, +/* DC4 NAK SYN ETB */ CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ +/* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ +/* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* degree plusminus twosuperior threesuperior */ +/* P Q R S */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* acute mu paragraph periodcentered */ +/* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* cedilla onesuperior masculine guillemotright */ +/* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* onequarter onehalf threequarters questiondown */ +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_DECSTR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1024,7 +1347,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ -CASE_GROUND_STATE, +CASE_DECSTR, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1041,8 +1364,8 @@ /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; Const PARSE_T csi_quo_table[] = /* CSI ... " */ @@ -1053,8 +1376,8 @@ CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_IGNORE, CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -1078,9 +1401,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -1088,50 +1411,50 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 4 5 6 7 */ -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 8 9 : ; */ -CASE_ESC_DIGIT, -CASE_ESC_DIGIT, -CASE_IGNORE, -CASE_ESC_SEMI, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* < = > ? */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* @ A B C */ -CASE_ESC_IGNORE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_GROUND_STATE, /* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1206,92 +1529,92 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* Agrave Aacute Acircumflex Atilde */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1348,8 +1671,8 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECSCL, +CASE_DECSCA, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ @@ -1365,8 +1688,8 @@ /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; #if OPT_DEC_LOCATOR @@ -1378,8 +1701,8 @@ CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_IGNORE, CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -1403,9 +1726,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -1413,45 +1736,45 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 4 5 6 7 */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 8 9 : ; */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* < = > ? */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1473,7 +1796,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ -CASE_IGNORE_STATE, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1531,87 +1854,87 @@ CASE_DECRQLP, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1681,17 +2004,17 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECEFR, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_DECELR, +CASE_DECSLE, /* udiaeresis yacute thorn ydiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECRQLP, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; #endif /* OPT_DEC_LOCATOR */ @@ -1704,7 +2027,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -1728,9 +2051,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -1738,25 +2061,25 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, @@ -1770,13 +2093,13 @@ /* 8 9 : ; */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, -CASE_IGNORE, +CASE_CSI_IGNORE, CASE_ESC_SEMI, /* < = > ? */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1856,87 +2179,87 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_ESC_SEMI, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1950,8 +2273,8 @@ /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECSED, +CASE_DECSEL, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -1988,20 +2311,20 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECSET, +CASE_DEC_MC, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECRST, CASE_GROUND_STATE, +CASE_DSR, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_XTERM_RESTORE, +CASE_XTERM_SAVE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2016,7 +2339,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, }; Const PARSE_T dec2_table[] = /* CSI > */ @@ -2028,7 +2351,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -2052,9 +2375,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -2062,25 +2385,25 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, @@ -2094,13 +2417,13 @@ /* 8 9 : ; */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, -CASE_IGNORE, +CASE_CSI_IGNORE, CASE_ESC_SEMI, /* < = > ? */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2114,8 +2437,8 @@ /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_DECSED, -CASE_DECSEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2180,87 +2503,87 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_ESC_SEMI, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2305,7 +2628,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DA2, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2340,7 +2663,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, }; Const PARSE_T dec3_table[] = /* CSI = */ @@ -2352,7 +2675,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -2376,9 +2699,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -2386,25 +2709,25 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* 0 1 2 3 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, @@ -2418,13 +2741,13 @@ /* 8 9 : ; */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, -CASE_IGNORE, +CASE_CSI_IGNORE, CASE_ESC_SEMI, /* < = > ? */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2438,8 +2761,8 @@ /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_DECSED, -CASE_DECSEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2504,87 +2827,87 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_CSI_IGNORE, +CASE_ESC_SEMI, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2629,7 +2952,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECRPTUI, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2664,10 +2987,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, }; -Const PARSE_T eigtable[] = /* CASE_ESC_IGNORE */ +Const PARSE_T cigtable[] = /* CASE_CSI_IGNORE */ { /* NUL SOH STX ETX */ CASE_IGNORE, @@ -2675,8 +2998,8 @@ CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_IGNORE, CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -2700,9 +3023,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -2730,25 +3053,25 @@ CASE_IGNORE, CASE_IGNORE, /* 0 1 2 3 */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* 4 5 6 7 */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* 8 9 : ; */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* < = > ? */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2827,88 +3150,88 @@ /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, /* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ +/* currency yen brokenbar section */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ +/* diaeresis copyright ordfeminine guillemotleft */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ +/* notsign hyphen registered macron */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ +/* degree plusminus twosuperior threesuperior */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ +/* acute mu paragraph periodcentered */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ +/* cedilla onesuperior masculine guillemotright */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ +/* onequarter onehalf threequarters questiondown */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* currency yen brokenbar section */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* notsign hyphen registered macron */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -2987,11 +3310,10 @@ /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; - -Const PARSE_T esc_table[] = /* ESC */ +Const PARSE_T eigtable[] = /* CASE_ESC_IGNORE */ { /* NUL SOH STX ETX */ CASE_IGNORE, @@ -3000,7 +3322,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -3024,9 +3346,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -3034,25 +3356,25 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_SP_STATE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_SCR_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_PERCENT, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* ( ) * + */ -CASE_SCS0_STATE, -CASE_SCS1_STATE, -CASE_SCS2_STATE, -CASE_SCS3_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3062,16 +3384,16 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_DECSC, +CASE_GROUND_STATE, /* 8 9 : ; */ -CASE_DECRC, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ CASE_GROUND_STATE, -CASE_DECKPAM, -CASE_DECKPNM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, @@ -3079,45 +3401,45 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* D E F G */ -CASE_IND, -CASE_NEL, -CASE_HP_BUGGY_LL, CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* H I J K */ -CASE_HTS, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, -CASE_RI, -CASE_SS2, -CASE_SS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* P Q R S */ -CASE_DCS, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ -CASE_XTERM_TITLE, CASE_GROUND_STATE, -CASE_SPA, -CASE_EPA, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* X Y Z [ */ -CASE_SOS, CASE_GROUND_STATE, -CASE_DECID, -CASE_CSI_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* \ ] ^ _ */ -CASE_ST, -CASE_OSC, -CASE_PM, -CASE_APC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_RIS, +CASE_GROUND_STATE, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3129,10 +3451,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ -CASE_HP_MEM_LOCK, -CASE_HP_MEM_UNLOCK, -CASE_LS2, -CASE_LS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3149,70 +3471,70 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ -CASE_LS3R, -CASE_LS2R, -CASE_LS1R, CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, /* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ +/* currency yen brokenbar section */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ +/* diaeresis copyright ordfeminine guillemotleft */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ +/* notsign hyphen registered macron */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* currency yen brokenbar section */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* notsign hyphen registered macron */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3312,10 +3634,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, }; -Const PARSE_T esc_sp_table[] = /* ESC SP */ +Const PARSE_T esc_table[] = /* ESC */ { /* NUL SOH STX ETX */ CASE_IGNORE, @@ -3324,7 +3646,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -3348,9 +3670,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -3358,20 +3680,20 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_ESC_SP_STATE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, +CASE_SCR_STATE, /* $ % & ' */ CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_ESC_PERCENT, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_SCS0_STATE, +CASE_SCS1_STATE, +CASE_SCS2_STATE, +CASE_SCS3_STATE, /* , - . / */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, @@ -3386,16 +3708,16 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECSC, /* 8 9 : ; */ -CASE_GROUND_STATE, +CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_DECKPAM, +CASE_DECKPNM, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, @@ -3403,45 +3725,45 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* D E F G */ +CASE_IND, +CASE_NEL, +CASE_HP_BUGGY_LL, CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_S7C1T, -CASE_S8C1T, /* H I J K */ -CASE_GROUND_STATE, +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ -CASE_ANSI_LEVEL_1, -CASE_ANSI_LEVEL_2, -CASE_ANSI_LEVEL_3, CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, /* P Q R S */ -CASE_IGNORE_STATE, +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_XTERM_TITLE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, /* X Y Z [ */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, /* \ ] ^ _ */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_RIS, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3453,10 +3775,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_HP_MEM_LOCK, +CASE_HP_MEM_UNLOCK, +CASE_LS2, +CASE_LS3, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3473,70 +3795,70 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ +CASE_LS3R, +CASE_LS2R, +CASE_LS1R, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_SP_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_SCR_STATE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_PERCENT, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_SCS0_STATE, +CASE_SCS1_STATE, +CASE_SCS2_STATE, +CASE_SCS3_STATE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3545,17 +3867,17 @@ /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_DECSC, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, +CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECKPAM, +CASE_DECKPNM, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, @@ -3563,45 +3885,45 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IND, +CASE_NEL, +CASE_HP_BUGGY_LL, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ -CASE_GROUND_STATE, +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, /* Eth Ntilde Ograve Oacute */ -CASE_GROUND_STATE, +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_XTERM_TITLE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, /* Ooblique Ugrave Uacute Ucircumflex */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, /* Udiaeresis Yacute Thorn ssharp */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_RIS, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3613,10 +3935,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_HP_MEM_LOCK, +CASE_HP_MEM_UNLOCK, +CASE_LS2, +CASE_LS3, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3633,558 +3955,234 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_LS3R, +CASE_LS2R, +CASE_LS1R, +CASE_IGNORE, }; -Const PARSE_T iestable[] = /* CASE_IGNORE_ESC */ +Const PARSE_T esc_sp_table[] = /* ESC SP */ { /* NUL SOH STX ETX */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* EOT ENQ ACK BEL */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* BS HT NL VT */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* NP CR SO SI */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* DLE DC1 DC2 DC3 */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* DC4 NAK SYN ETB */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* CAN EM SUB ESC */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* FS GS RS US */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* SP ! " # */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* $ % & ' */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* ( ) * + */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* , - . / */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* 0 1 2 3 */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* 4 5 6 7 */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* 8 9 : ; */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* < = > ? */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* @ A B C */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* D E F G */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* H I J K */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* L M N O */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* P Q R S */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* T U V W */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* X Y Z [ */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* \ ] ^ _ */ -CASE_GROUND_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* ` a b c */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* d e f g */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* h i j k */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* l m n o */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* p q r s */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* t u v w */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* x y z { */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* | } ~ DEL */ -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -CASE_IGNORE_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, +/* EOT ENQ ACK BEL */ CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, +/* DC4 NAK SYN ETB */ CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ +/* 4 5 6 7 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ +/* 8 9 : ; */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* degree plusminus twosuperior threesuperior */ +/* < = > ? */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* acute mu paragraph periodcentered */ +/* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* cedilla onesuperior masculine guillemotright */ +/* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_S7C1T, +CASE_S8C1T, +/* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, -/* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, +/* L M N O */ +CASE_ANSI_LEVEL_1, +CASE_ANSI_LEVEL_2, +CASE_ANSI_LEVEL_3, CASE_GROUND_STATE, +/* P Q R S */ CASE_GROUND_STATE, -/* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* T U V W */ CASE_GROUND_STATE, -/* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* X Y Z [ */ CASE_GROUND_STATE, -/* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* \ ] ^ _ */ CASE_GROUND_STATE, -/* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* ` a b c */ CASE_GROUND_STATE, -/* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* d e f g */ CASE_GROUND_STATE, -/* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* h i j k */ CASE_GROUND_STATE, -/* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* l m n o */ CASE_GROUND_STATE, -/* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* p q r s */ CASE_GROUND_STATE, -/* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* t u v w */ CASE_GROUND_STATE, -/* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* x y z { */ CASE_GROUND_STATE, -/* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* | } ~ DEL */ CASE_GROUND_STATE, -/* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, -/* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* ocircumflex otilde odiaeresis division */ +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, -/* oslash ugrave uacute ucircumflex */ +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, -/* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -}; - -Const PARSE_T igntable[] = /* CASE_IGNORE_STATE */ -{ -/* NUL SOH STX ETX */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* EOT ENQ ACK BEL */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* BS HT NL VT */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* NP CR SO SI */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* DLE DC1 DC2 DC3 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* DC4 NAK SYN ETB */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* CAN EM SUB ESC */ -CASE_GROUND_STATE, -CASE_IGNORE, -CASE_GROUND_STATE, -CASE_IGNORE_ESC, -/* FS GS RS US */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* SP ! " # */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* $ % & ' */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* ( ) * + */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* , - . / */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0 1 2 3 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 4 5 6 7 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 8 9 : ; */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* < = > ? */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* @ A B C */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* D E F G */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* H I J K */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* L M N O */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* P Q R S */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* T U V W */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* X Y Z [ */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* \ ] ^ _ */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* ` a b c */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* d e f g */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* h i j k */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* l m n o */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* p q r s */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* t u v w */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* x y z { */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* | } ~ DEL */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_DECID, +CASE_CSI_STATE, /* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, /* nobreakspace exclamdown cent sterling */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* currency yen brokenbar section */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* diaeresis copyright ordfeminine guillemotleft */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* notsign hyphen registered macron */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -4212,18 +4210,18 @@ CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_S7C1T, +CASE_S8C1T, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_ANSI_LEVEL_1, +CASE_ANSI_LEVEL_2, +CASE_ANSI_LEVEL_3, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, @@ -4283,8 +4281,8 @@ /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; Const PARSE_T scrtable[] = /* ESC # */ @@ -4295,8 +4293,8 @@ CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_IGNORE, CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -4320,9 +4318,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ +CASE_GROUND_STATE, CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -4448,79 +4446,79 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_DECDHL, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECDHL, +CASE_DECSWL, +CASE_DECDWL, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, +CASE_DECALN, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -4607,8 +4605,8 @@ /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; Const PARSE_T scstable[] = /* ESC ( etc. */ @@ -4619,8 +4617,8 @@ CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ -CASE_IGNORE, CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -4644,9 +4642,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -4772,111 +4770,111 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, -/* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x84 0x85 0x86 0x87 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x88 0x89 0x8a 0x8b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, -CASE_IGNORE, CASE_IGNORE, -CASE_IGNORE, -/* 0x90 0x91 0x92 0x93 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x98 0x99 0x9a 0x9b */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* 0x9c 0x9d 0x9e 0x9f */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -/* nobreakspace exclamdown cent sterling */ +/* 0x80 0x81 0x82 0x83 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* currency yen brokenbar section */ +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, CASE_GROUND_STATE, CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, CASE_GROUND_STATE, CASE_GROUND_STATE, -/* notsign hyphen registered macron */ CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_GSETS, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, /* Adiaeresis Aring AE Ccedilla */ -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_GSETS, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_GSETS, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_GSETS, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ -CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, @@ -4884,9 +4882,9 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ -CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, @@ -4931,8 +4929,8 @@ /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, }; /* @@ -4948,19 +4946,19 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_ENQ, CASE_IGNORE, +CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ -CASE_BS, -CASE_TAB, -CASE_VMOT, -CASE_VMOT, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* NP CR SO SI */ -CASE_VMOT, -CASE_CR, -CASE_SO, -CASE_SI, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, @@ -4972,7 +4970,7 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, CASE_GROUND_STATE, CASE_ESC, @@ -5102,38 +5100,38 @@ CASE_IGNORE, CASE_IGNORE, /* 0x80 0x81 0x82 0x83 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x84 0x85 0x86 0x87 */ CASE_IND, CASE_NEL, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x88 0x89 0x8a 0x8b */ CASE_HTS, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x8c 0x8d 0x8e 0x8f */ -CASE_IGNORE, +CASE_GROUND_STATE, CASE_RI, CASE_SS2, CASE_SS3, /* 0x90 0x91 0x92 0x93 */ CASE_DCS, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 0x94 0x95 0x96 0x97 */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, CASE_SPA, CASE_EPA, /* 0x98 0x99 0x9a 0x9b */ CASE_SOS, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_DECID, CASE_CSI_STATE, /* 0x9c 0x9d 0x9e 0x9f */ @@ -5206,62 +5204,388 @@ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +#if OPT_WIDE_CHARS +Const PARSE_T esc_pct_table[] = /* ESC % */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_UTF8, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_UTF8, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_UTF8, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_UTF8, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* eth ntilde ograve oacute */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, CASE_IGNORE, }; +#endif #if OPT_VT52_MODE Const PARSE_T vt52_table[] = @@ -5273,14 +5597,14 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, -CASE_IGNORE, +CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, @@ -5297,9 +5621,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -5597,17 +5921,17 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, +CASE_BELL, /* BS HT NL VT */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, /* NP CR SO SI */ -CASE_IGNORE, -CASE_IGNORE, +CASE_VMOT, +CASE_CR, CASE_IGNORE, CASE_IGNORE, /* DLE DC1 DC2 DC3 */ @@ -5621,9 +5945,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -5631,53 +5955,53 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, /* $ % & ' */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, /* ( ) * + */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, /* , - . / */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, /* 0 1 2 3 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 4 5 6 7 */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* 8 9 : ; */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* < = > ? */ CASE_ANSI_LEVEL_1, CASE_DECKPAM, CASE_DECKPNM, -CASE_IGNORE, +CASE_GROUND_STATE, /* @ A B C */ -CASE_IGNORE, +CASE_GROUND_STATE, CASE_CUU, CASE_CUD, CASE_CUF, /* D E F G */ CASE_CUB, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_SO, CASE_SI, /* H I J K */ @@ -5686,70 +6010,70 @@ CASE_ED, CASE_EL, /* L M N O */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* P Q R S */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* T U V W */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* X Y Z [ */ -CASE_IGNORE, +CASE_GROUND_STATE, CASE_VT52_CUP, CASE_DECID, -CASE_IGNORE, +CASE_GROUND_STATE, /* \ ] ^ _ */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* ` a b c */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* d e f g */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* h i j k */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* l m n o */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* p q r s */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* t u v w */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* x y z { */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, /* | } ~ DEL */ -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, @@ -5911,10 +6235,8 @@ CASE_IGNORE, CASE_IGNORE, }; -#endif /* OPT_VT52_MODE */ -#if OPT_WIDE_CHARS -Const PARSE_T esc_pct_table[] = /* ESC % */ +Const PARSE_T vt52_ignore_table[] = { /* NUL SOH STX ETX */ CASE_IGNORE, @@ -5923,7 +6245,7 @@ CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, -CASE_IGNORE, +CASE_ENQ, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ @@ -5934,8 +6256,8 @@ /* NP CR SO SI */ CASE_VMOT, CASE_CR, -CASE_SO, -CASE_SI, +CASE_IGNORE, +CASE_IGNORE, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, @@ -5947,9 +6269,9 @@ CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ -CASE_IGNORE, -CASE_IGNORE, +CASE_GROUND_STATE, CASE_IGNORE, +CASE_GROUND_STATE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, @@ -5957,25 +6279,25 @@ CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* $ % & ' */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* ( ) * + */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* , - . / */ -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -5997,7 +6319,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ -CASE_UTF8, +CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -6005,7 +6327,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_UTF8, +CASE_GROUND_STATE, /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -6017,10 +6339,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ -CASE_IGNORE_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_GROUND_STATE, /* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -6074,8 +6396,8 @@ /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, CASE_GROUND_STATE, +CASE_IGNORE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, @@ -6117,124 +6439,125 @@ CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* currency yen brokenbar section */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* diaeresis copyright ordfeminine guillemotleft */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* notsign hyphen registered macron */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* degree plusminus twosuperior threesuperior */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* acute mu paragraph periodcentered */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* cedilla onesuperior masculine guillemotright */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Agrave Aacute Acircumflex Atilde */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Adiaeresis Aring AE Ccedilla */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Egrave Eacute Ecircumflex Ediaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Igrave Iacute Icircumflex Idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Eth Ntilde Ograve Oacute */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Ocircumflex Otilde Odiaeresis multiply */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Ooblique Ugrave Uacute Ucircumflex */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* Udiaeresis Yacute Thorn ssharp */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* agrave aacute acircumflex atilde */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* adiaeresis aring ae ccedilla */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* egrave eacute ecircumflex ediaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* igrave iacute icircumflex idiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* eth ntilde ograve oacute */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* ocircumflex otilde odiaeresis division */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* oslash ugrave uacute ucircumflex */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, /* udiaeresis yacute thorn ydiaeresis */ -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, }; -#endif +#endif /* OPT_VT52_MODE */ + Index: xc/programs/xterm/VTparse.def diff -u xc/programs/xterm/VTparse.def:3.12 xc/programs/xterm/VTparse.def:3.13 --- xc/programs/xterm/VTparse.def:3.12 Wed Jan 17 18:46:34 2001 +++ xc/programs/xterm/VTparse.def Sun Dec 8 17:31:47 2002 @@ -5,12 +5,10 @@ # change any of the CASE_ macros, make the change here and rerun the command # shown in VTparse.h. # -# $XFree86: xc/programs/xterm/VTparse.def,v 3.12 2001/01/17 23:46:34 dawes Exp $ +# $XFree86: xc/programs/xterm/VTparse.def,v 3.13 2002/12/08 22:31:47 dickey Exp $ # CASE_GROUND_STATE -CASE_IGNORE_STATE -CASE_IGNORE_ESC CASE_IGNORE CASE_BELL CASE_BS @@ -129,3 +127,5 @@ CASE_DECRQLP CASE_DECEFR CASE_DECSLE +CASE_CSI_IGNORE +CASE_VT52_IGNORE Index: xc/programs/xterm/VTparse.h diff -u xc/programs/xterm/VTparse.h:3.15 xc/programs/xterm/VTparse.h:3.17 --- xc/programs/xterm/VTparse.h:3.15 Wed Jan 17 18:46:34 2001 +++ xc/programs/xterm/VTparse.h Sun Dec 8 17:31:47 2002 @@ -2,8 +2,29 @@ * $Xorg: VTparse.h,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/VTparse.h,v 3.15 2001/01/17 23:46:34 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/VTparse.h,v 3.17 2002/12/08 22:31:47 dickey Exp $ */ /* + * Copyright 2002 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of the above listed + * copyright holder(s) not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. + * + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved @@ -51,14 +72,14 @@ extern Const PARSE_T csi_tick_table[]; #endif /* OPT_DEC_LOCATOR */ extern Const PARSE_T csi_table[]; +extern Const PARSE_T csi2_table[]; extern Const PARSE_T dec2_table[]; extern Const PARSE_T dec3_table[]; extern Const PARSE_T dec_table[]; +extern Const PARSE_T cigtable[]; extern Const PARSE_T eigtable[]; extern Const PARSE_T esc_sp_table[]; extern Const PARSE_T esc_table[]; -extern Const PARSE_T iestable[]; -extern Const PARSE_T igntable[]; extern Const PARSE_T scrtable[]; extern Const PARSE_T scstable[]; extern Const PARSE_T sos_table[]; @@ -66,6 +87,11 @@ #if OPT_VT52_MODE extern Const PARSE_T vt52_table[]; extern Const PARSE_T vt52_esc_table[]; +extern Const PARSE_T vt52_ignore_table[]; +#endif + +#if OPT_WIDE_CHARS +extern Const PARSE_T esc_pct_table[]; #endif /* @@ -80,125 +106,125 @@ */ #define CASE_GROUND_STATE 0 -#define CASE_IGNORE_STATE 1 -#define CASE_IGNORE_ESC 2 -#define CASE_IGNORE 3 -#define CASE_BELL 4 -#define CASE_BS 5 -#define CASE_CR 6 -#define CASE_ESC 7 -#define CASE_VMOT 8 -#define CASE_TAB 9 -#define CASE_SI 10 -#define CASE_SO 11 -#define CASE_SCR_STATE 12 -#define CASE_SCS0_STATE 13 -#define CASE_SCS1_STATE 14 -#define CASE_SCS2_STATE 15 -#define CASE_SCS3_STATE 16 -#define CASE_ESC_IGNORE 17 -#define CASE_ESC_DIGIT 18 -#define CASE_ESC_SEMI 19 -#define CASE_DEC_STATE 20 -#define CASE_ICH 21 -#define CASE_CUU 22 -#define CASE_CUD 23 -#define CASE_CUF 24 -#define CASE_CUB 25 -#define CASE_CUP 26 -#define CASE_ED 27 -#define CASE_EL 28 -#define CASE_IL 29 -#define CASE_DL 30 -#define CASE_DCH 31 -#define CASE_DA1 32 -#define CASE_TRACK_MOUSE 33 -#define CASE_TBC 34 -#define CASE_SET 35 -#define CASE_RST 36 -#define CASE_SGR 37 -#define CASE_CPR 38 -#define CASE_DECSTBM 39 -#define CASE_DECREQTPARM 40 -#define CASE_DECSET 41 -#define CASE_DECRST 42 -#define CASE_DECALN 43 -#define CASE_GSETS 44 -#define CASE_DECSC 45 -#define CASE_DECRC 46 -#define CASE_DECKPAM 47 -#define CASE_DECKPNM 48 -#define CASE_IND 49 -#define CASE_NEL 50 -#define CASE_HTS 51 -#define CASE_RI 52 -#define CASE_SS2 53 -#define CASE_SS3 54 -#define CASE_CSI_STATE 55 -#define CASE_OSC 56 -#define CASE_RIS 57 -#define CASE_LS2 58 -#define CASE_LS3 59 -#define CASE_LS3R 60 -#define CASE_LS2R 61 -#define CASE_LS1R 62 -#define CASE_PRINT 63 -#define CASE_XTERM_SAVE 64 -#define CASE_XTERM_RESTORE 65 -#define CASE_XTERM_TITLE 66 -#define CASE_DECID 67 -#define CASE_HP_MEM_LOCK 68 -#define CASE_HP_MEM_UNLOCK 69 -#define CASE_HP_BUGGY_LL 70 -#define CASE_HPA 71 -#define CASE_VPA 72 -#define CASE_XTERM_WINOPS 73 -#define CASE_ECH 74 -#define CASE_CHT 75 -#define CASE_CPL 76 -#define CASE_CNL 77 -#define CASE_CBT 78 -#define CASE_SU 79 -#define CASE_SD 80 -#define CASE_S7C1T 81 -#define CASE_S8C1T 82 -#define CASE_ESC_SP_STATE 83 -#define CASE_ENQ 84 -#define CASE_DECSCL 85 -#define CASE_DECSCA 86 -#define CASE_DECSED 87 -#define CASE_DECSEL 88 -#define CASE_DCS 89 -#define CASE_PM 90 -#define CASE_SOS 91 -#define CASE_ST 92 -#define CASE_APC 93 -#define CASE_EPA 94 -#define CASE_SPA 95 -#define CASE_CSI_QUOTE_STATE 96 -#define CASE_DSR 97 -#define CASE_ANSI_LEVEL_1 98 -#define CASE_ANSI_LEVEL_2 99 -#define CASE_ANSI_LEVEL_3 100 -#define CASE_MC 101 -#define CASE_DEC2_STATE 102 -#define CASE_DA2 103 -#define CASE_DEC3_STATE 104 -#define CASE_DECRPTUI 105 -#define CASE_VT52_CUP 106 -#define CASE_REP 107 -#define CASE_CSI_EX_STATE 108 -#define CASE_DECSTR 109 -#define CASE_DECDHL 110 -#define CASE_DECSWL 111 -#define CASE_DECDWL 112 -#define CASE_DEC_MC 113 -#define CASE_ESC_PERCENT 114 -#define CASE_UTF8 115 -#define CASE_CSI_TICK_STATE 116 -#define CASE_DECELR 117 -#define CASE_DECRQLP 118 -#define CASE_DECEFR 119 -#define CASE_DECSLE 120 +#define CASE_IGNORE 1 +#define CASE_BELL 2 +#define CASE_BS 3 +#define CASE_CR 4 +#define CASE_ESC 5 +#define CASE_VMOT 6 +#define CASE_TAB 7 +#define CASE_SI 8 +#define CASE_SO 9 +#define CASE_SCR_STATE 10 +#define CASE_SCS0_STATE 11 +#define CASE_SCS1_STATE 12 +#define CASE_SCS2_STATE 13 +#define CASE_SCS3_STATE 14 +#define CASE_ESC_IGNORE 15 +#define CASE_ESC_DIGIT 16 +#define CASE_ESC_SEMI 17 +#define CASE_DEC_STATE 18 +#define CASE_ICH 19 +#define CASE_CUU 20 +#define CASE_CUD 21 +#define CASE_CUF 22 +#define CASE_CUB 23 +#define CASE_CUP 24 +#define CASE_ED 25 +#define CASE_EL 26 +#define CASE_IL 27 +#define CASE_DL 28 +#define CASE_DCH 29 +#define CASE_DA1 30 +#define CASE_TRACK_MOUSE 31 +#define CASE_TBC 32 +#define CASE_SET 33 +#define CASE_RST 34 +#define CASE_SGR 35 +#define CASE_CPR 36 +#define CASE_DECSTBM 37 +#define CASE_DECREQTPARM 38 +#define CASE_DECSET 39 +#define CASE_DECRST 40 +#define CASE_DECALN 41 +#define CASE_GSETS 42 +#define CASE_DECSC 43 +#define CASE_DECRC 44 +#define CASE_DECKPAM 45 +#define CASE_DECKPNM 46 +#define CASE_IND 47 +#define CASE_NEL 48 +#define CASE_HTS 49 +#define CASE_RI 50 +#define CASE_SS2 51 +#define CASE_SS3 52 +#define CASE_CSI_STATE 53 +#define CASE_OSC 54 +#define CASE_RIS 55 +#define CASE_LS2 56 +#define CASE_LS3 57 +#define CASE_LS3R 58 +#define CASE_LS2R 59 +#define CASE_LS1R 60 +#define CASE_PRINT 61 +#define CASE_XTERM_SAVE 62 +#define CASE_XTERM_RESTORE 63 +#define CASE_XTERM_TITLE 64 +#define CASE_DECID 65 +#define CASE_HP_MEM_LOCK 66 +#define CASE_HP_MEM_UNLOCK 67 +#define CASE_HP_BUGGY_LL 68 +#define CASE_HPA 69 +#define CASE_VPA 70 +#define CASE_XTERM_WINOPS 71 +#define CASE_ECH 72 +#define CASE_CHT 73 +#define CASE_CPL 74 +#define CASE_CNL 75 +#define CASE_CBT 76 +#define CASE_SU 77 +#define CASE_SD 78 +#define CASE_S7C1T 79 +#define CASE_S8C1T 80 +#define CASE_ESC_SP_STATE 81 +#define CASE_ENQ 82 +#define CASE_DECSCL 83 +#define CASE_DECSCA 84 +#define CASE_DECSED 85 +#define CASE_DECSEL 86 +#define CASE_DCS 87 +#define CASE_PM 88 +#define CASE_SOS 89 +#define CASE_ST 90 +#define CASE_APC 91 +#define CASE_EPA 92 +#define CASE_SPA 93 +#define CASE_CSI_QUOTE_STATE 94 +#define CASE_DSR 95 +#define CASE_ANSI_LEVEL_1 96 +#define CASE_ANSI_LEVEL_2 97 +#define CASE_ANSI_LEVEL_3 98 +#define CASE_MC 99 +#define CASE_DEC2_STATE 100 +#define CASE_DA2 101 +#define CASE_DEC3_STATE 102 +#define CASE_DECRPTUI 103 +#define CASE_VT52_CUP 104 +#define CASE_REP 105 +#define CASE_CSI_EX_STATE 106 +#define CASE_DECSTR 107 +#define CASE_DECDHL 108 +#define CASE_DECSWL 109 +#define CASE_DECDWL 110 +#define CASE_DEC_MC 111 +#define CASE_ESC_PERCENT 112 +#define CASE_UTF8 113 +#define CASE_CSI_TICK_STATE 114 +#define CASE_DECELR 115 +#define CASE_DECRQLP 116 +#define CASE_DECEFR 117 +#define CASE_DECSLE 118 +#define CASE_CSI_IGNORE 119 +#define CASE_VT52_IGNORE 120 #endif /* included_VTparse_h */ Index: xc/programs/xterm/XTerm.ad diff -u xc/programs/xterm/XTerm.ad:3.22 xc/programs/xterm/XTerm.ad:3.24 --- xc/programs/xterm/XTerm.ad:3.22 Sat Jan 5 17:05:02 2002 +++ xc/programs/xterm/XTerm.ad Sun Sep 29 20:39:05 2002 @@ -3,9 +3,11 @@ ! ! ! -! $XFree86: xc/programs/xterm/XTerm.ad,v 3.22 2002/01/05 22:05:02 dickey Exp $ +! $XFree86: xc/programs/xterm/XTerm.ad,v 3.24 2002/09/30 00:39:05 dickey Exp $ -XTerm.JoinSession:False +! This is nonsense: if the xterm has no session management capabilities, +! it is useless, and if it does, it is harmful. +!XTerm.JoinSession:False *SimpleMenu*BackingStore: NotUseful *SimpleMenu*menuLabel.font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-* @@ -18,9 +20,10 @@ *mainMenu.Label: Main Options *mainMenu*securekbd*Label: Secure Keyboard *mainMenu*allowsends*Label: Allow SendEvents +*mainMenu*redraw*Label: Redraw Window *mainMenu*logging*Label: Log to File *mainMenu*print*Label: Print Window -*mainMenu*redraw*Label: Redraw Window +*mainMenu*print-redir*Label: Redirect to Printer *mainMenu*8-bit control*Label: 8-Bit Controls *mainMenu*backarrow key*Label: Backarrow Key (BS/DEL) *mainMenu*num-lock*Label: Alt/NumLock Modifiers Index: xc/programs/xterm/aclocal.m4 diff -u xc/programs/xterm/aclocal.m4:3.40 xc/programs/xterm/aclocal.m4:3.44 --- xc/programs/xterm/aclocal.m4:3.40 Sat Apr 28 09:51:55 2001 +++ xc/programs/xterm/aclocal.m4 Fri Dec 27 16:05:20 2002 @@ -1,9 +1,9 @@ dnl -dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.40 2001/04/28 13:51:55 dickey Exp $ +dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.44 2002/12/27 21:05:20 dickey Exp $ dnl dnl --------------------------------------------------------------------------- dnl -dnl Copyright 1997-2001 by Thomas E. Dickey +dnl Copyright 1997-2001,2002 by Thomas E. Dickey dnl dnl All Rights Reserved dnl @@ -27,33 +27,46 @@ dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS +dnl The second parameter if given makes this macro verbose. AC_DEFUN([CF_ADD_CFLAGS], [ +cf_new_cflags= +cf_new_cppflags= for cf_add_cflags in $1 do case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case "$CPPFLAGS" in - *$cf_add_cflags) + *$cf_add_cflags) #(vi ;; - *) - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) - CFLAGS="$CFLAGS $cf_add_cflags" + cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac done + +if test -n "$cf_new_cflags" ; then + ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + ])dnl dnl --------------------------------------------------------------------------- dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' dnl in the sharutils 4.2 distribution. AC_DEFUN([CF_ANSI_CC_CHECK], [ -AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) -AC_CACHE_VAL(cf_cv_ansi_cc,[ +AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" @@ -89,7 +102,6 @@ CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" ]) -AC_MSG_RESULT($cf_cv_ansi_cc) if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then @@ -151,7 +163,7 @@ AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name") +test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) @@ -159,18 +171,34 @@ fi ])dnl dnl --------------------------------------------------------------------------- +dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from +dnl a build-configuration such as imake. These have the pitfall that they +dnl often contain compiler-specific options which we cannot use, mixed with +dnl preprocessor options that we usually can. +AC_DEFUN([CF_CHECK_CFLAGS], +[ +CF_VERBOSE(checking additions to CFLAGS) +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" +CF_ADD_CFLAGS($1,yes) +if test "$cf_check_cflags" != "$CFLAGS" ; then +AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, + [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) + if test "$cf_check_cppflags" != "$CPPFLAGS" ; then + CF_VERBOSE(but keeping change to \$CPPFLAGS) + fi + CFLAGS="$cf_check_flags"]) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it dnl ourselves. dnl -dnl (I would use AC_CACHE_CHECK here, but it will not work when called in a -dnl loop from CF_SYS_ERRLIST). -dnl dnl $1 = the name to check AC_DEFUN([CF_CHECK_ERRNO], [ -AC_MSG_CHECKING(if external $1 is declared) -AC_CACHE_VAL(cf_cv_dcl_$1,[ +AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ AC_TRY_COMPILE([ #ifdef HAVE_STDLIB_H #include <stdlib.h> @@ -179,16 +207,12 @@ #include <sys/types.h> #include <errno.h> ], [long x = (long) $1], - [eval 'cf_cv_dcl_'$1'=yes'], - [eval 'cf_cv_dcl_'$1'=no']) + [cf_cv_dcl_$1=yes], + [cf_cv_dcl_$1=no]) ]) - -eval 'cf_result=$cf_cv_dcl_'$1 -AC_MSG_RESULT($cf_result) -if test "$cf_result" = no ; then - eval 'cf_result=DECL_'$1 - CF_UPPER(cf_result,$cf_result) +if test "$cf_cv_dcl_$1" = no ; then + CF_UPPER(cf_result,decl_$1) AC_DEFINE_UNQUOTED($cf_result) fi @@ -202,22 +226,18 @@ dnl $2 = its type AC_DEFUN([CF_CHECK_EXTERN_DATA], [ -AC_MSG_CHECKING(if external $1 exists) -AC_CACHE_VAL(cf_cv_have_$1,[ +AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ AC_TRY_LINK([ #undef $1 extern $2 $1; ], [$1 = 2], - [eval 'cf_cv_have_'$1'=yes'], - [eval 'cf_cv_have_'$1'=no'])]) - -eval 'cf_result=$cf_cv_have_'$1 -AC_MSG_RESULT($cf_result) + [cf_cv_have_$1=yes], + [cf_cv_have_$1=no]) +]) -if test "$cf_result" = yes ; then - eval 'cf_result=HAVE_'$1 - CF_UPPER(cf_result,$cf_result) +if test "$cf_cv_have_$1" = yes ; then + CF_UPPER(cf_result,have_$1) AC_DEFINE_UNQUOTED($cf_result) fi @@ -295,6 +315,14 @@ dnl function, since it cannot provide the termcap-format data). AC_DEFUN([CF_FUNC_TGETENT], [ +# compute a reasonable value for $TERM to give tgetent(), since we may be +# running in 'screen', which sets $TERMCAP to a specific entry that is not +# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply +# discard $TERMCAP. +cf_TERMVAR=vt100 +test -n "$TERMCAP" && cf_TERMVAR="$TERM" +test -z "$cf_TERMVAR" && cf_TERMVAR=vt100 + AC_CACHE_CHECK(for full tgetent function,cf_cv_lib_tgetent,[ cf_save_LIBS="$LIBS" cf_cv_lib_tgetent=no @@ -311,7 +339,7 @@ { char buffer[1024]; buffer[0] = 0; - tgetent(buffer, "vt100"); + tgetent(buffer, "$cf_TERMVAR"); exit(buffer[0] == 0); }], [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC if test -n "$cf_termlib" ; then @@ -348,7 +376,7 @@ cf_cv_lib_part_tgetent=no for cf_termlib in $cf_TERMLIB ; do LIBS="$cf_save_LIBS -l$cf_termlib" - AC_TRY_LINK([],[tgetent(0, 0)], + AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")], [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC cf_cv_lib_part_tgetent="-l$cf_termlib" break]) @@ -453,7 +481,7 @@ dnl AC_DEFUN([CF_GCC_WARNINGS], [ -if test "$GCC" = yes +if ( test "$GCC" = yes || test "$GXX" = yes ) then cat > conftest.$ac_ext <<EOF #line __oline__ "configure" @@ -474,7 +502,8 @@ Wnested-externs \ Wpointer-arith \ Wshadow \ - Wstrict-prototypes $cf_warn_CONST + Wstrict-prototypes \ + Wundef $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if AC_TRY_EVAL(ac_compile); then @@ -679,8 +708,7 @@ fi]) ]) test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG) -] -)dnl +])dnl dnl --------------------------------------------------------------------------- dnl Check for POSIX wait support AC_DEFUN([CF_POSIX_WAIT], @@ -784,7 +812,6 @@ dnl Check if this is a SYSV flavor of UTMP AC_DEFUN([CF_SYSV_UTMP], [ -AC_REQUIRE([CF_UTMP]) AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" AC_TRY_LINK([ @@ -963,36 +990,30 @@ AC_DEFUN([CF_UTMP], [ AC_REQUIRE([CF_LASTLOG]) + AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ cf_cv_have_utmp=no for cf_header in utmpx utmp ; do - AC_TRY_COMPILE([ +cf_utmp_includes=" #include <sys/types.h> #include <${cf_header}.h> #define getutent getutxent #ifdef USE_LASTLOG #include <lastlog.h> /* may conflict with utmpx.h on Linux */ #endif -], +" + AC_TRY_COMPILE([$cf_utmp_includes], [struct $cf_header x; char *name = x.ut_name; /* utmp.h and compatible definitions */ ], [cf_cv_have_utmp=$cf_header break], [ - AC_TRY_COMPILE([ -#include <sys/types.h> -#include <${cf_header}.h> -#define getutent getutxent -#ifdef USE_LASTLOG -#include <lastlog.h> /* may conflict with utmpx.h on Linux */ -#endif -], + AC_TRY_COMPILE([$cf_utmp_includes], [struct $cf_header x; char *name = x.ut_user; /* utmpx.h must declare this */ ], [cf_cv_have_utmp=$cf_header - AC_DEFINE(ut_name,ut_user) break ])]) done @@ -1002,17 +1023,17 @@ AC_DEFINE(HAVE_UTMP) test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP) CF_UTMP_UT_HOST + CF_UTMP_UT_NAME CF_UTMP_UT_XSTATUS CF_UTMP_UT_XTIME CF_UTMP_UT_SESSION CF_SYSV_UTMP fi -]) +])dnl dnl --------------------------------------------------------------------------- dnl Check if UTMP/UTMPX struct defines ut_host member AC_DEFUN([CF_UTMP_UT_HOST], [ -AC_REQUIRE([CF_UTMP]) if test $cf_cv_have_utmp != no ; then AC_MSG_CHECKING(if utmp.ut_host is declared) AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ @@ -1026,12 +1047,46 @@ AC_MSG_RESULT($cf_cv_have_utmp_ut_host) test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST) fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if UTMP/UTMPX struct defines ut_name member +AC_DEFUN([CF_UTMP_UT_NAME], +[ +if test $cf_cv_have_utmp != no ; then +AC_CACHE_CHECK(if utmp.ut_name is declared,cf_cv_have_utmp_ut_name,[ + cf_cv_have_utmp_ut_name=no +cf_utmp_includes=" +#include <sys/types.h> +#include <${cf_cv_have_utmp}.h> +#define getutent getutxent +#ifdef USE_LASTLOG +#include <lastlog.h> /* may conflict with utmpx.h on Linux */ +#endif +" +for cf_header in ut_name ut_user ; do + AC_TRY_COMPILE([$cf_utmp_includes], + [struct $cf_cv_have_utmp x; + char *name = x.$cf_header; + ], + [cf_cv_have_utmp_ut_name=$cf_header + break]) +done ]) + +case $cf_cv_have_utmp_ut_name in #(vi +no) #(vi + AC_MSG_ERROR(Cannot find declaration for ut.ut_name) + ;; +ut_user) + AC_DEFINE(ut_name,ut_user) + ;; +esac +fi +])dnl dnl --------------------------------------------------------------------------- dnl Check if UTMP/UTMPX struct defines ut_session member AC_DEFUN([CF_UTMP_UT_SESSION], [ -AC_REQUIRE([CF_UTMP]) if test $cf_cv_have_utmp != no ; then AC_CACHE_CHECK(if utmp.ut_session is declared, cf_cv_have_utmp_ut_session,[ AC_TRY_COMPILE([ @@ -1045,7 +1100,7 @@ AC_DEFINE(HAVE_UTMP_UT_SESSION) fi fi -]) +])dnl dnl --------------------------------------------------------------------------- dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported dnl by various people: @@ -1059,7 +1114,6 @@ dnl system header files. AC_DEFUN([CF_UTMP_UT_XSTATUS], [ -AC_REQUIRE([CF_UTMP]) if test $cf_cv_have_utmp != no ; then AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ for cf_result in \ @@ -1087,7 +1141,6 @@ dnl Check if UTMP/UTMPX struct defines ut_xtime member AC_DEFUN([CF_UTMP_UT_XTIME], [ -AC_REQUIRE([CF_UTMP]) if test $cf_cv_have_utmp != no ; then AC_CACHE_CHECK(if utmp.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ AC_TRY_COMPILE([ @@ -1110,7 +1163,7 @@ fi fi fi -]) +])dnl dnl --------------------------------------------------------------------------- dnl Use AC_VERBOSE w/o the warnings AC_DEFUN([CF_VERBOSE], @@ -1135,19 +1188,28 @@ AC_CHECK_LIB(Xext,XextCreateExtension, [LIBS="-lXext $LIBS"]) -cf_x_athena_include="" cf_x_athena_lib="" +CF_X_ATHENA_CPPFLAGS($cf_x_athena) +CF_X_ATHENA_LIBS($cf_x_athena) +])dnl +dnl --------------------------------------------------------------------------- +dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of +dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. +AC_DEFUN([CF_X_ATHENA_CPPFLAGS], +[ +cf_x_athena_root=ifelse($1,,Xaw,$1) +cf_x_athena_include="" + for cf_path in default \ /usr/contrib/X11R6 \ /usr/contrib/X11R5 \ /usr/lib/X11R5 \ /usr/local do - if test -z "$cf_x_athena_include" ; then cf_save="$CPPFLAGS" - cf_test=X11/$cf_x_athena/SimpleMenu.h + cf_test=X11/$cf_x_athena_root/SimpleMenu.h if test $cf_path != default ; then CPPFLAGS="-I$cf_path/include $cf_save" AC_MSG_CHECKING(for $cf_test in $cf_path) @@ -1162,12 +1224,38 @@ AC_MSG_RESULT($cf_result) if test "$cf_result" = yes ; then cf_x_athena_include=$cf_path + break else CPPFLAGS="$cf_save" fi fi +done + +if test -z "$cf_x_athena_include" ; then + AC_MSG_WARN( +[Unable to successfully find Athena header files with test program]) +elif test "$cf_x_athena_include" != default ; then + CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include" +fi +]) +dnl --------------------------------------------------------------------------- +dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of +dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. +AC_DEFUN([CF_X_ATHENA_LIBS], +[AC_REQUIRE([CF_X_TOOLKIT]) +cf_x_athena_root=ifelse($1,,Xaw,$1) +cf_x_athena_lib="" - for cf_lib in "-l$cf_x_athena -lXmu" "-l${cf_x_athena}_s -lXmu_s" +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + "-l$cf_x_athena_root -lXmu" \ + "-l$cf_x_athena_root -lXpm -lXmu" \ + "-l${cf_x_athena_root}_s -lXmu_s" do if test -z "$cf_x_athena_lib" ; then cf_save="$LIBS" @@ -1186,6 +1274,7 @@ AC_MSG_RESULT($cf_result) if test "$cf_result" = yes ; then cf_x_athena_lib="$cf_lib" + break else LIBS="$cf_save" fi @@ -1193,19 +1282,14 @@ done done -if test -z "$cf_x_athena_include" ; then - AC_MSG_WARN( -[Unable to successfully find Athena header files with test program]) -fi - if test -z "$cf_x_athena_lib" ; then AC_ERROR( -[Unable to successfully link Athena library (-l$cf_x_athena) with test program]) +[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) fi -CF_UPPER(CF_X_ATHENA_LIBS,HAVE_LIB_$cf_x_athena) -AC_DEFINE_UNQUOTED($CF_X_ATHENA_LIBS) -])dnl +CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) +AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) +]) dnl --------------------------------------------------------------------------- dnl Check for X freetype libraries (XFree86 4.x) AC_DEFUN([CF_X_FREETYPE], @@ -1270,7 +1354,7 @@ if test $cf_have_X_LIBS = no ; then AC_PATH_XTRA LDFLAGS="$LDFLAGS $X_LIBS" - CF_ADD_CFLAGS($X_CFLAGS) + CF_CHECK_CFLAGS($X_CFLAGS) AC_CHECK_LIB(X11,XOpenDisplay, [LIBS="-lX11 $LIBS"],, [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) @@ -1281,7 +1365,7 @@ [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) else LDFLAGS="$LDFLAGS $X_LIBS" - CF_ADD_CFLAGS($X_CFLAGS) + CF_CHECK_CFLAGS($X_CFLAGS) fi if test $cf_have_X_LIBS = no ; then Index: xc/programs/xterm/button.c diff -u xc/programs/xterm/button.c:3.65 xc/programs/xterm/button.c:3.71 --- xc/programs/xterm/button.c:3.65 Sat Jan 5 20:34:23 2002 +++ xc/programs/xterm/button.c Sat Oct 5 13:57:11 2002 @@ -1,6 +1,6 @@ /* $Xorg: button.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ /* - * Copyright 1999,2000,2001,2002 by Thomas E. Dickey + * Copyright 1999-2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -50,7 +50,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/button.c,v 3.65 2002/01/06 01:34:23 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/button.c,v 3.71 2002/10/05 17:57:11 dickey Exp $ */ /* button.c Handles button events in the terminal emulator. @@ -73,9 +73,9 @@ #include <error.h> #include <menu.h> #include <xcharmouse.h> +#include <charclass.h> #if OPT_WIDE_CHARS -#include <charclass.h> #include <wcwidth.h> #else #define CharacterClass(value) \ @@ -100,9 +100,9 @@ #define KeyState(x) (((x) & (ShiftMask|ControlMask)) + (((x) & Mod1Mask) ? 2 : 0)) /* adds together the bits: - shift key -> 1 - meta key -> 2 - control key -> 4 */ + shift key -> 1 + meta key -> 2 + control key -> 4 */ #define Coordinate(r,c) ((r) * (term->screen.max_col+1) + (c)) @@ -136,7 +136,17 @@ /* Multi-click handling */ static int numberOfClicks = 0; static Time lastButtonUpTime = 0; + +#if OPT_READLINE +static Time lastButtonDownTime = 0; +static int ExtendingSelection = 0; +static Time lastButton3UpTime = 0; +static Time lastButton3DoubleDownTime = 0; +static int lastButton3row, lastButton3col; /* At the release time */ +#endif /* OPT_READLINE */ + typedef int SelectUnit; + #define SELECTCHAR 0 #define SELECTWORD 1 #define SELECTLINE 2 @@ -146,29 +156,36 @@ /* Send emacs escape code when done selecting or extending? */ static int replyToEmacs; -static Char *SaveText (TScreen *screen, int row, int scol, int ecol, Char *lp, int *eol); -static int Length (TScreen *screen, int row, int scol, int ecol); -static void ComputeSelect (int startRow, int startCol, int endRow, int endCol, Bool extend); -static void EditorButton (XButtonEvent *event); -static void EndExtend (Widget w, XEvent *event, String *params, Cardinal num_params, Bool use_cursor_loc); -static void ExtendExtend (int row, int col); -static void PointToRowCol (int y, int x, int *r, int *c); -static void ReHiliteText (int frow, int fcol, int trow, int tcol); -static void SaltTextAway (int crow, int ccol, int row, int col, String *params, Cardinal num_params); -static void SelectSet (Widget w, XEvent *event, String *params, Cardinal num_params); +static Char *SaveText(TScreen * screen, int row, int scol, int ecol, Char * + lp, int *eol); +static int Length(TScreen * screen, int row, int scol, int ecol); +static void ComputeSelect(int startRow, int startCol, int endRow, int + endCol, Bool extend); +static void EditorButton(XButtonEvent * event); +static void EndExtend(Widget w, XEvent * event, String * params, Cardinal + num_params, Bool use_cursor_loc); +static void ExtendExtend(int row, int col); +static void PointToRowCol(int y, int x, int *r, int *c); +static void ReHiliteText(int frow, int fcol, int trow, int tcol); +static void SaltTextAway(int crow, int ccol, int row, int col, String * + params, Cardinal num_params); +static void SelectSet(Widget w, XEvent * event, String * params, Cardinal num_params); static void SelectionReceived PROTO_XT_SEL_CB_ARGS; -static void StartSelect (int startrow, int startcol); -static void TrackDown (XButtonEvent *event); -static void _OwnSelection (XtermWidget termw, String *selections, Cardinal count); +static void StartSelect(int startrow, int startcol); +static void TrackDown(XButtonEvent * event); +static void _OwnSelection(XtermWidget termw, String * selections, Cardinal count); +static void do_select_end(Widget w, XEvent * event, String * params, + Cardinal * num_params, Bool use_cursor_loc); -Boolean SendMousePosition(Widget w, XEvent* event) +Boolean +SendMousePosition(Widget w, XEvent * event) { TScreen *screen; if (!IsXtermWidget(w)) return False; - screen = &((XtermWidget)w)->screen; + screen = &((XtermWidget) w)->screen; /* If send_mouse_pos mode isn't on, we shouldn't be here */ if (screen->send_mouse_pos == MOUSE_OFF) @@ -176,53 +193,53 @@ #if OPT_DEC_LOCATOR if (screen->send_mouse_pos == DEC_LOCATOR) { - return( SendLocatorPosition( w, event ) ); + return (SendLocatorPosition(w, event)); } -#endif /* OPT_DEC_LOCATOR */ +#endif /* OPT_DEC_LOCATOR */ /* Make sure the event is an appropriate type */ if ((screen->send_mouse_pos != BTN_EVENT_MOUSE) - && (screen->send_mouse_pos != ANY_EVENT_MOUSE) - && event->type != ButtonPress - && event->type != ButtonRelease) + && (screen->send_mouse_pos != ANY_EVENT_MOUSE) + && event->type != ButtonPress + && event->type != ButtonRelease) return False; switch (screen->send_mouse_pos) { - case X10_MOUSE: /* X10 compatibility sequences */ + case X10_MOUSE: /* X10 compatibility sequences */ if (KeyModifiers == 0) { if (event->type == ButtonPress) - EditorButton((XButtonEvent *)event); + EditorButton((XButtonEvent *) event); return True; } return False; - case VT200_HIGHLIGHT_MOUSE: /* DEC vt200 hilite tracking */ - if ( event->type == ButtonPress && - KeyModifiers == 0 && - event->xbutton.button == Button1 ) { - TrackDown((XButtonEvent *)event); + case VT200_HIGHLIGHT_MOUSE: /* DEC vt200 hilite tracking */ + if (event->type == ButtonPress && + KeyModifiers == 0 && + event->xbutton.button == Button1) { + TrackDown((XButtonEvent *) event); return True; } if (KeyModifiers == 0 || KeyModifiers == ControlMask) { - EditorButton((XButtonEvent *)event); + EditorButton((XButtonEvent *) event); return True; } return False; - case VT200_MOUSE: /* DEC vt200 compatible */ + case VT200_MOUSE: /* DEC vt200 compatible */ - /* xterm extension for motion reporting. June 1998 */ - /* EditorButton() will distinguish between the modes */ - case BTN_EVENT_MOUSE: - case ANY_EVENT_MOUSE: + /* xterm extension for motion reporting. June 1998 */ + /* EditorButton() will distinguish between the modes */ + case BTN_EVENT_MOUSE: + case ANY_EVENT_MOUSE: if (KeyModifiers == 0 || KeyModifiers == ControlMask) { - EditorButton((XButtonEvent *)event); + EditorButton((XButtonEvent *) event); return True; } return False; - default: + default: return False; } } @@ -265,129 +282,129 @@ XSelectInput(XtDisplay((t)), XtWindow((t)), (s)->event_mask); } Boolean -SendLocatorPosition(Widget w, XEvent* event) +SendLocatorPosition(Widget w, XEvent * event) { - TScreen *screen = &((XtermWidget)w)->screen; - int row, col; - Boolean oor; - int button; - int state; + TScreen *screen = &((XtermWidget) w)->screen; + int row, col; + Boolean oor; + int button; + int state; /* Make sure the event is an appropriate type */ if ((event->type != ButtonPress && event->type != ButtonRelease && !screen->loc_filter) || (KeyModifiers != 0 && KeyModifiers != ControlMask)) - return( False ); + return (False); if ((event->type == ButtonPress && !(screen->locator_events & LOC_BTNS_DN)) || (event->type == ButtonRelease && !(screen->locator_events & LOC_BTNS_UP))) - return( True ); + return (True); - if( event->type == MotionNotify ) { - CheckLocatorPosition( w, event ); - return( True ); + if (event->type == MotionNotify) { + CheckLocatorPosition(w, event); + return (True); } /* get button # */ button = event->xbutton.button - 1; - LocatorCoords( row, col, event->xbutton.x, event->xbutton.y, oor ); + LocatorCoords(row, col, event->xbutton.x, event->xbutton.y, oor); /* - * DECterm mouse: - * - * ESCAPE '[' event ; mask ; row ; column '&' 'w' - */ - reply.a_type = CSI; + * DECterm mouse: + * + * ESCAPE '[' event ; mask ; row ; column '&' 'w' + */ + reply.a_type = CSI; - if( oor) { + if (oor) { reply.a_nparam = 1; - reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } - return( True ); + return (True); } /* - * event: - * 1 no buttons - * 2 left button down - * 3 left button up - * 4 middle button down - * 5 middle button up - * 6 right button down - * 7 right button up - * 8 M4 down - * 9 M4 up - */ + * event: + * 1 no buttons + * 2 left button down + * 3 left button up + * 4 middle button down + * 5 middle button up + * 6 right button down + * 7 right button up + * 8 M4 down + * 9 M4 up + */ reply.a_nparam = 4; - switch(event->type) - { - case ButtonPress: - reply.a_param[0] = 2 + (button<<1); - break; - case ButtonRelease: - reply.a_param[0] = 3 + (button<<1); - break; - default: - return( True ); + switch (event->type) { + case ButtonPress: + reply.a_param[0] = 2 + (button << 1); + break; + case ButtonRelease: + reply.a_param[0] = 3 + (button << 1); + break; + default: + return (True); } /* - * mask: - * bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 - * M4 down left down middle down right down - * - * Notice that Button1 (left) and Button3 (right) are swapped in the mask. - * Also, mask should be the state after the button press/release, - * X provides the state not including the button press/release. - */ - state = (event->xbutton.state & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; + * mask: + * bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 + * M4 down left down middle down right down + * + * Notice that Button1 (left) and Button3 (right) are swapped in the mask. + * Also, mask should be the state after the button press/release, + * X provides the state not including the button press/release. + */ + state = (event->xbutton.state + & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; state ^= 1 << button; /* update mask to "after" state */ - state = (state & ~(4|1)) | ((state&1)?4:0) | ((state&4)?1:0); /* swap Button1 & Button3 */ + state = (state & ~(4 | 1)) | ((state & 1) ? 4 : 0) | ((state & 4) ? 1 : 0); /* swap Button1 & Button3 */ reply.a_param[1] = state; reply.a_param[2] = row; reply.a_param[3] = col; reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } /* - * DECterm turns the Locator off if a button is pressed while a filter rectangle - * is active. This might be a bug, but I don't know, so I'll emulate it anyways. - */ - if( screen->loc_filter ) { + * DECterm turns the Locator off if a button is pressed while a filter rectangle + * is active. This might be a bug, but I don't know, so I'll emulate it anyways. + */ + if (screen->loc_filter) { screen->send_mouse_pos = MOUSE_OFF; screen->loc_filter = FALSE; screen->locator_events = 0; - MotionOff( screen, term ); + MotionOff(screen, term); } - return( True ); + return (True); } /* -* mask: -* bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 -* M4 down left down middle down right down -* -* Button1 (left) and Button3 (right) are swapped in the mask relative to X. -*/ + * mask: + * bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 + * M4 down left down middle down right down + * + * Button1 (left) and Button3 (right) are swapped in the mask relative to X. + */ #define ButtonState(state, mask) \ { (state) = ((mask) & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; \ /* swap Button1 & Button3 */ \ @@ -397,128 +414,125 @@ void GetLocatorPosition(XtermWidget w) { - TScreen *screen = &w->screen; - Window root, child; - int rx, ry, x, y; - unsigned int mask; - int row = 0, col = 0; - Boolean oor = FALSE; - Bool ret = FALSE; - int state; + TScreen *screen = &w->screen; + Window root, child; + int rx, ry, x, y; + unsigned int mask; + int row = 0, col = 0; + Boolean oor = FALSE; + Bool ret = FALSE; + int state; /* - * DECterm turns the Locator off if the position is requested while a filter rectangle - * is active. This might be a bug, but I don't know, so I'll emulate it anyways. - */ - if( screen->loc_filter ) { + * DECterm turns the Locator off if the position is requested while a filter rectangle + * is active. This might be a bug, but I don't know, so I'll emulate it anyways. + */ + if (screen->loc_filter) { screen->send_mouse_pos = MOUSE_OFF; screen->loc_filter = FALSE; screen->locator_events = 0; - MotionOff( screen, term ); + MotionOff(screen, term); } - reply.a_type = CSI; + reply.a_type = CSI; if (screen->send_mouse_pos == DEC_LOCATOR) { - ret = XQueryPointer( screen->display, VWindow(screen), &root, - &child, &rx, &ry, &x, &y, &mask ); + ret = XQueryPointer(screen->display, VWindow(screen), &root, + &child, &rx, &ry, &x, &y, &mask); if (ret) { - LocatorCoords( row, col, x, y, oor ); + LocatorCoords(row, col, x, y, oor); } } - if( ret == FALSE || oor ) - { + if (ret == FALSE || oor) { reply.a_nparam = 1; - reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } return; } - ButtonState( state, mask ); + ButtonState(state, mask); reply.a_nparam = 4; - reply.a_param[0] = 1; /* Event - 1 = response to locator request */ + reply.a_param[0] = 1; /* Event - 1 = response to locator request */ reply.a_param[1] = state; reply.a_param[2] = row; reply.a_param[3] = col; reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } } void -InitLocatorFilter( XtermWidget w ) +InitLocatorFilter(XtermWidget w) { - TScreen *screen = &w->screen; - Window root, child; - int rx, ry, x, y; - unsigned int mask; - int row = 0, col = 0; - Boolean oor = 0; - Bool ret; - int state; + TScreen *screen = &w->screen; + Window root, child; + int rx, ry, x, y; + unsigned int mask; + int row = 0, col = 0; + Boolean oor = 0; + Bool ret; + int state; - ret = XQueryPointer( screen->display, VWindow(screen), - &root, &child, &rx, &ry, &x, &y, &mask ); + ret = XQueryPointer(screen->display, VWindow(screen), + &root, &child, &rx, &ry, &x, &y, &mask); if (ret) { - LocatorCoords( row, col, x, y, oor ); + LocatorCoords(row, col, x, y, oor); } - if( ret == FALSE || oor ) - { + if (ret == FALSE || oor) { /* Locator is unavailable */ - if( screen->loc_filter_top != LOC_FILTER_POS || - screen->loc_filter_left != LOC_FILTER_POS || + if (screen->loc_filter_top != LOC_FILTER_POS || + screen->loc_filter_left != LOC_FILTER_POS || screen->loc_filter_bottom != LOC_FILTER_POS || - screen->loc_filter_right != LOC_FILTER_POS ) - { + screen->loc_filter_right != LOC_FILTER_POS) { /* - * If any explicit coordinates were received, - * report immediately with no coordinates. - */ - reply.a_type = CSI; + * If any explicit coordinates were received, + * report immediately with no coordinates. + */ + reply.a_type = CSI; reply.a_nparam = 1; - reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } } else { /* - * No explicit coordinates were received, and the pointer is - * unavailable. Report when the pointer re-enters the window. - */ + * No explicit coordinates were received, and the pointer is + * unavailable. Report when the pointer re-enters the window. + */ screen->loc_filter = TRUE; - MotionOn( screen, term ); + MotionOn(screen, term); } return; } /* - * Adjust rectangle coordinates: - * 1. Replace "LOC_FILTER_POS" with current coordinates - * 2. Limit coordinates to screen size - * 3. make sure top and left are less than bottom and right, resp. - */ - if( screen->locator_pixels ) { - rx = OriginX(screen)*2+Width(screen); - ry = screen->border*2+Height(screen); + * Adjust rectangle coordinates: + * 1. Replace "LOC_FILTER_POS" with current coordinates + * 2. Limit coordinates to screen size + * 3. make sure top and left are less than bottom and right, resp. + */ + if (screen->locator_pixels) { + rx = OriginX(screen) * 2 + Width(screen); + ry = screen->border * 2 + Height(screen); } else { rx = screen->max_col; ry = screen->max_row; @@ -529,241 +543,491 @@ else if ((coord) < 1) (coord) = 1; \ else if ((coord) > (max)) (coord) = (max) - Adjust( screen->loc_filter_top, row, ry ); - Adjust( screen->loc_filter_left, col, rx ); - Adjust( screen->loc_filter_bottom, row, ry ); - Adjust( screen->loc_filter_right, col, rx ); + Adjust(screen->loc_filter_top, row, ry); + Adjust(screen->loc_filter_left, col, rx); + Adjust(screen->loc_filter_bottom, row, ry); + Adjust(screen->loc_filter_right, col, rx); - if( screen->loc_filter_top > screen->loc_filter_bottom ) { + if (screen->loc_filter_top > screen->loc_filter_bottom) { ry = screen->loc_filter_top; screen->loc_filter_top = screen->loc_filter_bottom; screen->loc_filter_bottom = ry; } - if( screen->loc_filter_left > screen->loc_filter_right ) { + if (screen->loc_filter_left > screen->loc_filter_right) { rx = screen->loc_filter_left; screen->loc_filter_left = screen->loc_filter_right; screen->loc_filter_right = rx; } - if( (col < screen->loc_filter_left) || + if ((col < screen->loc_filter_left) || (col > screen->loc_filter_right) || (row < screen->loc_filter_top) || - (row > screen->loc_filter_bottom) ) - { + (row > screen->loc_filter_bottom)) { /* Pointer is already outside the rectangle - report immediately */ - ButtonState( state, mask ); + ButtonState(state, mask); - reply.a_type = CSI; + reply.a_type = CSI; reply.a_nparam = 4; - reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ + reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ reply.a_param[1] = state; reply.a_param[2] = row; reply.a_param[3] = col; reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } return; } /* - * Rectangle is set up. Allow pointer tracking - * to detect if the mouse leaves the rectangle. - */ + * Rectangle is set up. Allow pointer tracking + * to detect if the mouse leaves the rectangle. + */ screen->loc_filter = TRUE; - MotionOn( screen, term ); + MotionOn(screen, term); } void -CheckLocatorPosition( Widget w, XEvent *event ) +CheckLocatorPosition(Widget w, XEvent * event) { - TScreen *screen = &((XtermWidget)w)->screen; - int row, col; - Boolean oor; - int state; + TScreen *screen = &((XtermWidget) w)->screen; + int row, col; + Boolean oor; + int state; - LocatorCoords( row, col, event->xbutton.x, event->xbutton.y, oor ); + LocatorCoords(row, col, event->xbutton.x, event->xbutton.y, oor); /* - * Send report if the pointer left the filter rectangle, if - * the pointer left the window, or if the filter rectangle - * had no coordinates and the pointer re-entered the window. - */ + * Send report if the pointer left the filter rectangle, if + * the pointer left the window, or if the filter rectangle + * had no coordinates and the pointer re-entered the window. + */ if (oor || (screen->loc_filter_top == LOC_FILTER_POS) || - (col < screen->loc_filter_left) || + (col < screen->loc_filter_left) || (col > screen->loc_filter_right) || - (row < screen->loc_filter_top) || - (row > screen->loc_filter_bottom)) - { + (row < screen->loc_filter_top) || + (row > screen->loc_filter_bottom)) { /* Filter triggered - disable it */ screen->loc_filter = FALSE; - MotionOff( screen, term ); + MotionOff(screen, term); - reply.a_type = CSI; + reply.a_type = CSI; if (oor) { reply.a_nparam = 1; - reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ } else { - ButtonState( state, event->xbutton.state ); + ButtonState(state, event->xbutton.state); reply.a_nparam = 4; - reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ + reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ reply.a_param[1] = state; reply.a_param[2] = row; reply.a_param[3] = col; } reply.a_inters = '&'; - reply.a_final = 'w'; + reply.a_final = 'w'; unparseseq(&reply, screen->respond); - if( screen->locator_reset ) { - MotionOff( screen, term ); + if (screen->locator_reset) { + MotionOff(screen, term); screen->send_mouse_pos = MOUSE_OFF; } } +} +#endif /* OPT_DEC_LOCATOR */ + +#if OPT_READLINE +static int +isClick1_clean(XEvent * event) +{ + TScreen *screen = &term->screen; + int delta; + + if (!(event->type == ButtonPress || event->type == ButtonRelease) + /* Disable on Shift-Click-1, including the application-mouse modes */ + || (KeyModifiers & ShiftMask) + || (screen->send_mouse_pos != MOUSE_OFF) /* Kinda duplicate... */ + ||ExtendingSelection) /* Was moved */ + return 0; + if (event->type != ButtonRelease) + return 0; + if (lastButtonDownTime == (Time) 0) /* first time or once in a blue moon */ + delta = term->screen.multiClickTime + 1; + else if (event->xbutton.time > lastButtonDownTime) /* most of the time */ + delta = event->xbutton.time - lastButtonDownTime; + else /* time has rolled over since lastButtonUpTime */ + delta = (((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time; + return delta <= term->screen.multiClickTime; +} + +static int +isDoubleClick3(XEvent * event) +{ + int delta; + + if (event->type != ButtonRelease + || (KeyModifiers & ShiftMask) + || event->xbutton.button != Button3) { + lastButton3UpTime = 0; /* Disable the cached info */ + return 0; + } + /* Process Btn3Release. */ + if (lastButton3DoubleDownTime == (Time) 0) /* No previous click + or once in a blue moon */ + delta = term->screen.multiClickTime + 1; + else if (event->xbutton.time > lastButton3DoubleDownTime) /* most of the time */ + delta = event->xbutton.time - lastButton3DoubleDownTime; + else /* time has rolled over since lastButton3DoubleDownTime */ + delta = (((Time) ~ 0) - lastButton3DoubleDownTime) + event->xbutton.time; + if (delta <= term->screen.multiClickTime) { + /* Double click */ + int row, col; + + /* Cannot check ExtendingSelection, since mouse-3 always sets it */ + PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); + if (row == lastButton3row && col == lastButton3col) { + lastButton3DoubleDownTime = 0; /* Disable the third click */ + return 1; + } + } + /* Not a double click, memorize for future check. */ + lastButton3UpTime = event->xbutton.time; + PointToRowCol(event->xbutton.y, event->xbutton.x, + &lastButton3row, &lastButton3col); + return 0; } -#endif /* OPT_DEC_LOCATOR */ +static int +CheckSecondPress3(XEvent * event) +{ + int delta, row, col; + + if (event->type != ButtonPress + || (KeyModifiers & ShiftMask) + || event->xbutton.button != Button3) { + lastButton3DoubleDownTime = 0; /* Disable the cached info */ + return 0; + } + /* Process Btn3Press. */ + if (lastButton3UpTime == (Time) 0) /* No previous click + or once in a blue moon */ + delta = term->screen.multiClickTime + 1; + else if (event->xbutton.time > lastButton3UpTime) /* most of the time */ + delta = event->xbutton.time - lastButton3UpTime; + else /* time has rolled over since lastButton3UpTime */ + delta = (((Time) ~ 0) - lastButton3UpTime) + event->xbutton.time; + if (delta <= term->screen.multiClickTime) { + PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); + if (row == lastButton3row && col == lastButton3col) { + /* A candidate for a double-click */ + lastButton3DoubleDownTime = event->xbutton.time; + PointToRowCol(event->xbutton.y, event->xbutton.x, + &lastButton3row, &lastButton3col); + return 1; + } + lastButton3UpTime = 0; /* Disable the info about the previous click */ + } + /* Either too long, or moved, disable. */ + lastButton3DoubleDownTime = 0; + return 0; +} + +static int +rowOnCurrentLine(int line, int *deltap) /* must be XButtonEvent */ +{ + TScreen *screen = &term->screen; + int l1, l2; + + *deltap = 0; + if (line == screen->cur_row) + return 1; + + if (line < screen->cur_row) + l1 = line, l2 = screen->cur_row; + else + l2 = line, l1 = screen->cur_row; + l1--; + while (++l1 < l2) + if (!ScrnTstWrapped(screen, l1)) + return 0; + /* Everything is on one "wrapped line" now */ + *deltap = line - screen->cur_row; + return 1; +} + +static int +eventRow(XEvent * event) /* must be XButtonEvent */ +{ + TScreen *screen = &term->screen; + + return (event->xbutton.y - screen->border) / FontHeight(screen); +} + +static int +eventColBetween(XEvent * event) /* must be XButtonEvent */ +{ + TScreen *screen = &term->screen; + + /* Correct by half a width - we are acting on a boundary, not on a cell. */ + return ((event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) / 2) + / FontWidth(screen)); +} + +static int +ReadLineMovePoint(int col, int ldelta) +{ + TScreen *screen = &term->screen; + Char line[6]; + int count = 0; + + col += ldelta * (screen->max_col + 1) - screen->cur_col; + if (col == 0) + return 0; + if (screen->control_eight_bits) { + line[count++] = CSI; + } else { + line[count++] = ESC; + line[count++] = '['; /* XXX maybe sometimes O is better? */ + } + line[count++] = (col > 0 ? 'C' : 'D'); + if (col < 0) + col = -col; + while (col--) + v_write(screen->respond, line, 3); + return 1; +} + +static int +ReadLineDelete(int r1, int c1, int r2, int c2) +{ + TScreen *screen = &term->screen; + int del; + + del = c2 - c1 + (r2 - r1) * (screen->max_col + 1); + if (del <= 0) /* Just in case... */ + return 0; + while (del--) + v_write(screen->respond, "\177", 1); /* XXX Sometimes "\08"? */ + return 1; +} +#endif /* OPT_READLINE */ + +/* ^XM-G<line+' '><col+' '> */ void -DiredButton( - Widget w GCC_UNUSED, - XEvent *event, /* must be XButtonEvent */ - String *params GCC_UNUSED, /* selections */ - Cardinal *num_params GCC_UNUSED) -{ /* ^XM-G<line+' '><col+' '> */ - register TScreen *screen = &term->screen; - Char Line[ 6 ]; - register unsigned line, col; +DiredButton(Widget w GCC_UNUSED, + XEvent * event, /* must be XButtonEvent */ + String * params GCC_UNUSED, /* selections */ + Cardinal * num_params GCC_UNUSED) +{ + TScreen *screen = &term->screen; + Char Line[6]; + unsigned line, col; if (event->type == ButtonPress || event->type == ButtonRelease) { - line = ( event->xbutton.y - screen->border ) / FontHeight( screen ); - col = ( event->xbutton.x - OriginX(screen)) / FontWidth( screen ); + line = (event->xbutton.y - screen->border) / FontHeight(screen); + col = (event->xbutton.x - OriginX(screen)) / FontWidth(screen); Line[0] = CONTROL('X'); Line[1] = ESC; Line[2] = 'G'; Line[3] = ' ' + col; Line[4] = ' ' + line; - v_write(screen->respond, Line, 5 ); + v_write(screen->respond, Line, 5); } } +#if OPT_READLINE void -ViButton( - Widget w GCC_UNUSED, - XEvent *event, /* must be XButtonEvent */ - String *params GCC_UNUSED, /* selections */ - Cardinal *num_params GCC_UNUSED) -{ /* ^XM-G<line+' '><col+' '> */ - register TScreen *screen = &term->screen; +ReadLineButton(Widget w GCC_UNUSED, + XEvent * event, /* must be XButtonEvent */ + String * params GCC_UNUSED, /* selections */ + Cardinal * num_params GCC_UNUSED) +{ + TScreen *screen = &term->screen; + Char Line[6]; + int line, col, ldelta = 0; + + if (!(event->type == ButtonPress || event->type == ButtonRelease) + || (screen->send_mouse_pos != MOUSE_OFF) || ExtendingSelection) + goto finish; + if (event->type == ButtonRelease) { + int delta; + + if (lastButtonDownTime == (Time) 0) /* first time and once in a blue moon */ + delta = screen->multiClickTime + 1; + else if (event->xbutton.time > lastButtonDownTime) /* most of the time */ + delta = event->xbutton.time - lastButtonDownTime; + else /* time has rolled over since lastButtonUpTime */ + delta = (((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time; + if (delta > screen->multiClickTime) + goto finish; /* All this work for this... */ + } + line = (event->xbutton.y - screen->border) / FontHeight(screen); + if (line != screen->cur_row) { + int l1, l2; + + if (line < screen->cur_row) + l1 = line, l2 = screen->cur_row; + else + l2 = line, l1 = screen->cur_row; + l1--; + while (++l1 < l2) + if (!ScrnTstWrapped(screen, l1)) + goto finish; + /* Everything is on one "wrapped line" now */ + ldelta = line - screen->cur_row; + } + /* Correct by half a width - we are acting on a boundary, not on a cell. */ + col = (event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) / 2) + / FontWidth(screen) - screen->cur_col + ldelta * (screen->max_col + 1); + if (col == 0) + goto finish; + Line[0] = ESC; + /* XXX: sometimes it is better to send '['? */ + Line[1] = 'O'; + Line[2] = (col > 0 ? 'C' : 'D'); + if (col < 0) + col = -col; + while (col--) + v_write(screen->respond, Line, 3); + finish: + if (event->type == ButtonRelease) + do_select_end(w, event, params, num_params, False); +} +#endif /* OPT_READLINE */ + +/* repeats <ESC>n or <ESC>p */ +void +ViButton(Widget w GCC_UNUSED, + XEvent * event, /* must be XButtonEvent */ + String * params GCC_UNUSED, /* selections */ + Cardinal * num_params GCC_UNUSED) +{ + TScreen *screen = &term->screen; int pty = screen->respond; - Char Line[ 6 ]; - register int line; + Char Line[6]; + int line; if (event->type == ButtonPress || event->type == ButtonRelease) { line = screen->cur_row - - (( event->xbutton.y - screen->border ) / FontHeight( screen )); + ((event->xbutton.y - screen->border) / FontHeight(screen)); if (line != 0) { Line[0] = ESC; /* force an exit from insert-mode */ - v_write(pty, Line, 1 ); + v_write(pty, Line, 1); - if ( line < 0 ) { + if (line < 0) { line = -line; Line[0] = CONTROL('n'); } else { Line[0] = CONTROL('p'); } - while ( --line >= 0 ) - v_write(pty, Line, 1 ); + while (--line >= 0) + v_write(pty, Line, 1); } } } - /* * This function handles button-motion events */ /*ARGSUSED*/ -void HandleSelectExtend( - Widget w, - XEvent *event, /* must be XMotionEvent */ - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +void +HandleSelectExtend(Widget w, + XEvent * event, /* must be XMotionEvent */ + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { - register TScreen *screen; - int row, col; + TScreen *screen; + int row, col; - if (!IsXtermWidget(w)) - return; + if (!IsXtermWidget(w)) + return; - screen = &((XtermWidget)w)->screen; - screen->selection_time = event->xmotion.time; - switch (eventMode) { - /* If not in one of the DEC mouse-reporting modes */ - case LEFTEXTENSION : - case RIGHTEXTENSION : - PointToRowCol (event->xmotion.y, event->xmotion.x, - &row, &col); - ExtendExtend (row, col); - break; - - /* If in motion reporting mode, send mouse position to - character process as a key sequence \E[M... */ - case NORMAL : - /* will get here if send_mouse_pos != MOUSE_OFF */ - if ( screen->send_mouse_pos == BTN_EVENT_MOUSE - || screen->send_mouse_pos == ANY_EVENT_MOUSE ) - SendMousePosition(w,event); - break; - } + screen = &((XtermWidget) w)->screen; + screen->selection_time = event->xmotion.time; + switch (eventMode) { + /* If not in one of the DEC mouse-reporting modes */ + case LEFTEXTENSION: + case RIGHTEXTENSION: + PointToRowCol(event->xmotion.y, event->xmotion.x, + &row, &col); + ExtendExtend(row, col); + break; + + /* If in motion reporting mode, send mouse position to + character process as a key sequence \E[M... */ + case NORMAL: + /* will get here if send_mouse_pos != MOUSE_OFF */ + if (screen->send_mouse_pos == BTN_EVENT_MOUSE + || screen->send_mouse_pos == ANY_EVENT_MOUSE) + SendMousePosition(w, event); + break; + } } -static void do_select_end ( - Widget w, - XEvent *event, /* must be XButtonEvent */ - String *params, /* selections */ - Cardinal *num_params, - Bool use_cursor_loc) -{ - if (!IsXtermWidget(w)) - return; +static void +do_select_end(Widget w, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal * num_params, + Bool use_cursor_loc) +{ +#if OPT_READLINE + int ldelta1, ldelta2; + TScreen *screen = &term->screen; +#endif + + if (!IsXtermWidget(w)) + return; - ((XtermWidget)w)->screen.selection_time = event->xbutton.time; - switch (eventMode) { - case NORMAL : - (void) SendMousePosition(w, event); - break; - case LEFTEXTENSION : - case RIGHTEXTENSION : - EndExtend(w, event, params, *num_params, use_cursor_loc); - break; + ((XtermWidget) w)->screen.selection_time = event->xbutton.time; + switch (eventMode) { + case NORMAL: + (void) SendMousePosition(w, event); + break; + case LEFTEXTENSION: + case RIGHTEXTENSION: + EndExtend(w, event, params, *num_params, use_cursor_loc); +#if OPT_READLINE + if (isClick1_clean(event) + && SCREEN_FLAG(screen, click1_moves) + && rowOnCurrentLine(eventRow(event), &ldelta1)) { + ReadLineMovePoint(eventColBetween(event), ldelta1); + } + if (isDoubleClick3(event) + && SCREEN_FLAG(screen, dclick3_deletes) + && rowOnCurrentLine(startSRow, &ldelta1) + && rowOnCurrentLine(endSRow, &ldelta2)) { + ReadLineMovePoint(endSCol, ldelta2); + ReadLineDelete(startSRow, startSCol, endSRow, endSCol); } +#endif /* OPT_READLINE */ + break; + } } - -void HandleSelectEnd( - Widget w, - XEvent *event, /* must be XButtonEvent */ - String *params, /* selections */ - Cardinal *num_params) +void +HandleSelectEnd(Widget w, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal * num_params) { - do_select_end (w, event, params, num_params, False); + do_select_end(w, event, params, num_params, False); } - -void HandleKeyboardSelectEnd( - Widget w, - XEvent *event, /* must be XButtonEvent */ - String *params, /* selections */ - Cardinal *num_params) +void +HandleKeyboardSelectEnd(Widget w, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal * num_params) { - do_select_end (w, event, params, num_params, True); + do_select_end(w, event, params, num_params, True); } struct _SelectionList { @@ -778,7 +1042,7 @@ #if OPT_WIDE_CHARS static Char * -UTF8toLatin1(Char *s, int len, unsigned long *result) +UTF8toLatin1(Char * s, int len, unsigned long *result) { static Char *buffer; static size_t used; @@ -787,14 +1051,14 @@ Char *q; if (used == 0) { - buffer = (Char*)XtMalloc(used = len); + buffer = (Char *) XtMalloc(used = len); } else if (len > (int) used) { - buffer = (Char*)XtRealloc((char*)buffer, used = len); + buffer = (Char *) XtRealloc((char *) buffer, used = len); } q = buffer; - /* We're assuming that the xterm widget never contains Unicode - control characters. */ + /* We're assuming that the xterm widget never contains Unicode + control characters. */ while (p < s + len) { if ((*p & 0x80) == 0) { @@ -816,78 +1080,6 @@ *result = q - buffer; return buffer; } - -#if 0 -/* Eliminate all control characters from a UTF-8 string, doing - something reasonable with PS and LS */ - -static Char* -filterUTF8(Char *s, int len, int *len_return) -{ - Char *p=s; - Char *t; - Char *q; - unsigned codepoint; - int size; - - t = (Char *)XtMalloc(len); - if (t == 0) { - TRACE(("Couldn't allocate target string\n")); - return 0; - } - q = t; - - while (p < (s + len) && q < (t + len)) { - if ((*p & 0x80) == 0) { - codepoint = *p & 0x7F; - size = 1; - } else if ((*p & 0x60) == 0x40 && p < s + len - 1) { - codepoint = ((p[0] & 0x1F) << 6) | (p[1] & 0x3F); - size = 2; - } else if ((*p & 0x70) == 0x60 && p < s + len - 2) { - codepoint = ((p[0] & 0x0F) << 12) - | ((p[1] & 0x3F) << 6) - | (p[2] & 0x3F); - size = 3; - } else if ((*p & 0x78) == 0x70 && p < s + len - 3) { - p += 4; /* eliminate surrogates */ - continue; - } else if ((*p & 0x7C) == 0x78 && p < s + len - 4) { - p += 5; - continue; - } else if ((*p & 0x7E) == 0x7C && p < s + len - 5) { - p += 6; - continue; - } else { /* wrong UTF-8? Silently discard. */ - p++; - continue; - } - - if(codepoint == 0x2028) { - /* line separator -- replace by NL*/ - p += size; - *q++ = 0x0A; - } else if (codepoint == 0x2029) { - /* paragraph separator -- replace by NL NL */ - p += size; - *q++ = 0x0A; - if (q < t + len) - *q++ = 0x0A; - } else if (codepoint >= 0x202A && codepoint <= 0x202E) { - /* ignore Unicode control characters; surrogates have already - been eliminated */ - p += size; - } else { - /* just copy the UTF-8 */ - while (size--) - *q++ = *p++; - } - } - *len_return = q - t; - return t; -} -#endif - #endif /* OPT_WIDE_CHARS */ static Atom * @@ -897,30 +1089,30 @@ TScreen *screen; int n; - if(!IsXtermWidget(w)) + if (!IsXtermWidget(w)) return NULL; - screen = &((XtermWidget)w)->screen; + screen = &((XtermWidget) w)->screen; #if OPT_WIDE_CHARS if (screen->wide_chars) { static Atom *utf8SelectionTargets = NULL; if (utf8SelectionTargets == NULL) { - utf8SelectionTargets = (Atom*)XtMalloc(5 * sizeof(Atom)); + utf8SelectionTargets = (Atom *) XtMalloc(5 * sizeof(Atom)); if (utf8SelectionTargets == NULL) { TRACE(("Couldn't allocate utf8SelectionTargets\n")); return NULL; } n = 0; - utf8SelectionTargets[n] = XA_UTF8_STRING(XtDisplay(w)); n++; + utf8SelectionTargets[n++] = XA_UTF8_STRING(XtDisplay(w)); #ifdef X_HAVE_UTF8_STRING if (screen->i18nSelections) { - utf8SelectionTargets[n] = XA_TEXT(XtDisplay(w)); n++; - utf8SelectionTargets[n] = XA_COMPOUND_TEXT(XtDisplay(w)); n++; + utf8SelectionTargets[n++] = XA_TEXT(XtDisplay(w)); + utf8SelectionTargets[n++] = XA_COMPOUND_TEXT(XtDisplay(w)); } #endif - utf8SelectionTargets[n] = XA_STRING; n++; + utf8SelectionTargets[n++] = XA_STRING; utf8SelectionTargets[n] = None; } return utf8SelectionTargets; @@ -929,31 +1121,31 @@ /* not screen->wide_chars */ if (eightBitSelectionTargets == NULL) { - eightBitSelectionTargets = (Atom*)XtMalloc(5 * sizeof(Atom)); + eightBitSelectionTargets = (Atom *) XtMalloc(5 * sizeof(Atom)); if (eightBitSelectionTargets == NULL) { TRACE(("Couldn't allocate eightBitSelectionTargets\n")); return NULL; } n = 0; #ifdef X_HAVE_UTF8_STRING - eightBitSelectionTargets[n] = XA_UTF8_STRING(XtDisplay(w)); n++; + eightBitSelectionTargets[n++] = XA_UTF8_STRING(XtDisplay(w)); #endif if (screen->i18nSelections) { - eightBitSelectionTargets[n] = XA_TEXT(XtDisplay(w)); n++; - eightBitSelectionTargets[n] = XA_COMPOUND_TEXT(XtDisplay(w)); n++; + eightBitSelectionTargets[n++] = XA_TEXT(XtDisplay(w)); + eightBitSelectionTargets[n++] = XA_COMPOUND_TEXT(XtDisplay(w)); } - eightBitSelectionTargets[n] = XA_STRING; n++; + eightBitSelectionTargets[n++] = XA_STRING; eightBitSelectionTargets[n] = None; } return eightBitSelectionTargets; } -static void _GetSelection( - Widget w, - Time ev_time, - String *params, /* selections in precedence order */ - Cardinal num_params, - Atom *targets) +static void +_GetSelection(Widget w, + Time ev_time, + String * params, /* selections in precedence order */ + Cardinal num_params, + Atom * targets) { Atom selection; int cutbuffer; @@ -962,21 +1154,37 @@ if (!IsXtermWidget(w)) return; - XmuInternStrings(XtDisplay(w), params, (Cardinal)1, &selection); + XmuInternStrings(XtDisplay(w), params, (Cardinal) 1, &selection); switch (selection) { - case XA_CUT_BUFFER0: cutbuffer = 0; break; - case XA_CUT_BUFFER1: cutbuffer = 1; break; - case XA_CUT_BUFFER2: cutbuffer = 2; break; - case XA_CUT_BUFFER3: cutbuffer = 3; break; - case XA_CUT_BUFFER4: cutbuffer = 4; break; - case XA_CUT_BUFFER5: cutbuffer = 5; break; - - case XA_CUT_BUFFER6: cutbuffer = 6; break; - case XA_CUT_BUFFER7: cutbuffer = 7; break; - default: cutbuffer = -1; + case XA_CUT_BUFFER0: + cutbuffer = 0; + break; + case XA_CUT_BUFFER1: + cutbuffer = 1; + break; + case XA_CUT_BUFFER2: + cutbuffer = 2; + break; + case XA_CUT_BUFFER3: + cutbuffer = 3; + break; + case XA_CUT_BUFFER4: + cutbuffer = 4; + break; + case XA_CUT_BUFFER5: + cutbuffer = 5; + break; + case XA_CUT_BUFFER6: + cutbuffer = 6; + break; + case XA_CUT_BUFFER7: + cutbuffer = 7; + break; + default: + cutbuffer = -1; } TRACE(("Cutbuffer: %d, target: %lu\n", cutbuffer, - targets ? (unsigned long)targets[0] : 0)); + targets ? (unsigned long) targets[0] : 0)); if (cutbuffer >= 0) { int inbytes; unsigned long nbytes; @@ -985,13 +1193,13 @@ char *line = XFetchBuffer(XtDisplay(w), &inbytes, cutbuffer); nbytes = (unsigned long) inbytes; if (nbytes > 0) - SelectionReceived(w, NULL, &selection, &type, (XtPointer)line, + SelectionReceived(w, NULL, &selection, &type, (XtPointer) line, &nbytes, &fmt8); else if (num_params > 1) - _GetSelection(w, ev_time, params+1, num_params-1, NULL); + _GetSelection(w, ev_time, params + 1, num_params - 1, NULL); return; } else { - struct _SelectionList* list; + struct _SelectionList *list; if (targets == NULL || targets[0] == None) { targets = _SelectionTargets(w); @@ -1000,7 +1208,7 @@ if (targets != 0) { target = targets[0]; - if (targets[1] == None) { /* last target in list */ + if (targets[1] == None) { /* last target in list */ params++; num_params--; targets = _SelectionTargets(w); @@ -1014,99 +1222,122 @@ list->count = num_params; list->targets = targets; list->time = ev_time; - } else list = NULL; + } else + list = NULL; XtGetSelectionValue(w, selection, target, SelectionReceived, - (XtPointer)list, ev_time); + (XtPointer) list, ev_time); } } } #if OPT_TRACE && OPT_WIDE_CHARS -static void GettingSelection(Display *dpy, Atom type, Char *line, int len) +static void +GettingSelection(Display * dpy, Atom type, Char * line, int len) { Char *cp; char *name; name = XGetAtomName(dpy, type); - Trace("Getting %s (%ld)\n", XGetAtomName(dpy, type), (long int)type); + Trace("Getting %s (%ld)\n", XGetAtomName(dpy, type), (long int) type); for (cp = line; cp < line + len; cp++) Trace("%c\n", *cp); } #else -#define GettingSelection(dpy,type,line,len) /* nothing */ +#define GettingSelection(dpy,type,line,len) /* nothing */ #endif + +#ifdef VMS +# define tty_vwrite(pty,lag,l) tt_write(lag,l) +#else /* !( VMS ) */ +# define tty_vwrite(pty,lag,l) v_write(pty,lag,l) +#endif /* defined VMS */ -#ifndef VMS static void -_WriteSelectionData(int pty, Char *line, int length) +_qWriteSelectionData(TScreen * screen, Char * lag, int length) { - /* Write data to pty a line at a time. */ - /* Doing this one line at a time may no longer be necessary - because v_write has been re-written. */ - - register Char *lag, *cp, *end; - - end = &line[length]; - lag = line; - for (cp = line; cp != end; cp++) { - if (*cp == '\n') { - *cp = '\r'; - v_write(pty, lag, cp - lag + 1); - lag = cp + 1; +#if OPT_READLINE + if (SCREEN_FLAG(screen, paste_quotes)) { + while (length--) { + tty_vwrite(screen->respond, "\026", 1); /* Control-V */ + tty_vwrite(screen->respond, lag++, 1); } - } - if (lag != end) { - v_write(pty, lag, end - lag); - } + } else +#endif + tty_vwrite(screen->respond, lag, length); } -#else /* VMS */ - static void -_WriteSelectionData(int pty, Char *line, int length) +_WriteSelectionData(TScreen * screen, Char * line, int length) { + /* Write data to pty a line at a time. */ + /* Doing this one line at a time may no longer be necessary + because v_write has been re-written. */ + + Char *lag, *cp, *end; + /* in the VMS version, if tt_pasting isn't set to TRUE then qio reads aren't blocked and an infinite loop is entered, where the pasted text shows up as new input, goes in again, shows up again, ad nauseum. */ - - register Char *lag, *cp, *end; - +#ifdef VMS tt_pasting = TRUE; +#endif end = &line[length]; lag = line; - for (cp = line; cp != end; cp++) { - if (*cp == '\n') { - *cp = '\r'; - tt_write(lag, cp - lag + 1); - lag = cp + 1; + if (!SCREEN_FLAG(screen, paste_literal_nl)) { + for (cp = line; cp != end; cp++) { + if (*cp == '\n') { + *cp = '\r'; + _qWriteSelectionData(screen, lag, cp - lag + 1); + lag = cp + 1; + } } } if (lag != end) { - tt_write(lag, end - lag); + _qWriteSelectionData(screen, lag, end - lag); } - +#ifdef VMS tt_pasting = FALSE; - tt_start_read(); /* reenable reads or a character may be lost */ + tt_start_read(); /* reenable reads or a character may be lost */ +#endif +} + +#if OPT_READLINE +static void +_WriteKey(TScreen * screen, Char * in) +{ + char line[16]; + int count = 0, length = strlen(in); + + if (screen->control_eight_bits) { + line[count++] = CSI; + } else { + line[count++] = ESC; + line[count++] = '['; + } + while (length--) + line[count++] = *in++; + line[count++] = '~'; + tty_vwrite(screen->respond, line, count); } -#endif /* VMS */ +#endif /* OPT_READLINE */ /* SelectionReceived: stuff received selection text into pty */ /* ARGSUSED */ -static void SelectionReceived( - Widget w, - XtPointer client_data, - Atom *selection GCC_UNUSED, - Atom *type, - XtPointer value, - unsigned long *length, - int *format GCC_UNUSED) +static void +SelectionReceived(Widget w, + XtPointer client_data, + Atom * selection GCC_UNUSED, + Atom * type, + XtPointer value, + unsigned long *length, + int *format GCC_UNUSED) { char **text_list = NULL; int text_list_count; @@ -1114,31 +1345,33 @@ TScreen *screen; Display *dpy; #if OPT_TRACE && OPT_WIDE_CHARS - Char *line = (Char*)value; + Char *line = (Char *) value; #endif if (!IsXtermWidget(w)) return; - screen = &((XtermWidget)w)->screen; + screen = &((XtermWidget) w)->screen; dpy = XtDisplay(w); - if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0 || value == NULL) + if (*type == 0 /*XT_CONVERT_FAIL */ + || *length == 0 + || value == NULL) goto fail; - text_prop.value = (unsigned char *)value; + text_prop.value = (unsigned char *) value; text_prop.encoding = *type; text_prop.format = *format; text_prop.nitems = *length; #if OPT_WIDE_CHARS - if(screen->wide_chars) { + if (screen->wide_chars) { if (*type == XA_UTF8_STRING(XtDisplay(w)) || - *type == XA_STRING || - *type == XA_COMPOUND_TEXT(XtDisplay(w))) { + *type == XA_STRING || + *type == XA_COMPOUND_TEXT(XtDisplay(w))) { GettingSelection(dpy, *type, line, *length); - if(Xutf8TextPropertyToTextList(dpy, &text_prop, - &text_list, - &text_list_count) < 0) { + if (Xutf8TextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count) < 0) { TRACE(("Conversion failed\n")); text_list = NULL; } @@ -1148,66 +1381,89 @@ { /* Convert the selection to locale's multibyte encoding. */ - /* There's no need to special-case UTF8_STRING. If Xlib - doesn't know about it, we didn't request it. If a broken - selection holder sends it anyhow, the conversion function - will fail. */ + /* There's no need to special-case UTF8_STRING. If Xlib + doesn't know about it, we didn't request it. If a broken + selection holder sends it anyhow, the conversion function + will fail. */ if (*type == XA_UTF8_STRING(XtDisplay(w)) || - *type == XA_STRING || - *type == XA_COMPOUND_TEXT(XtDisplay(w))) { - Status rc; + *type == XA_STRING || + *type == XA_COMPOUND_TEXT(XtDisplay(w))) { + Status rc; GettingSelection(dpy, *type, line, *length); - if(*type == XA_STRING && screen->brokenSelections) { + if (*type == XA_STRING && screen->brokenSelections) { rc = XTextPropertyToStringList(&text_prop, &text_list, &text_list_count); - } else { - rc = XmbTextPropertyToTextList(dpy, &text_prop, - &text_list, - &text_list_count); - } - if (rc < 0) { + } else { + rc = XmbTextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count); + } + if (rc < 0) { TRACE(("Conversion failed\n")); text_list = NULL; } } } - if(text_list != NULL && text_list_count != 0) { + if (text_list != NULL && text_list_count != 0) { int i; - for(i = 0; i < text_list_count; i++) { + +#if OPT_READLINE + if (SCREEN_FLAG(screen, paste_brackets)) + _WriteKey(screen, "200"); +#endif + for (i = 0; i < text_list_count; i++) { int len = strlen(text_list[i]); - _WriteSelectionData(((XtermWidget)w)->screen.respond, - (Char*)text_list[i], len); + _WriteSelectionData(screen, (Char *) text_list[i], len); } +#if OPT_READLINE + if (SCREEN_FLAG(screen, paste_brackets)) + _WriteKey(screen, "201"); +#endif XFreeStringList(text_list); } else goto fail; - XtFree((char *)client_data); - XtFree((char *)value); + XtFree((char *) client_data); + XtFree((char *) value); return; fail: if (client_data != 0) { - struct _SelectionList* list = (struct _SelectionList*)client_data; + struct _SelectionList *list = (struct _SelectionList *) client_data; _GetSelection(w, list->time, list->params, list->count, list->targets); - XtFree((char *)client_data); + XtFree((char *) client_data); } return; } - void -HandleInsertSelection( - Widget w, - XEvent *event, /* assumed to be XButtonEvent* */ - String *params, /* selections in precedence order */ - Cardinal *num_params) +HandleInsertSelection(Widget w, + XEvent * event, /* assumed to be XButtonEvent* */ + String * params, /* selections in precedence order */ + Cardinal * num_params) { - if (SendMousePosition(w, event)) return; +#if OPT_READLINE + int ldelta; + TScreen *screen = &((XtermWidget) w)->screen; +#endif + + if (SendMousePosition(w, event)) + return; + +#if OPT_READLINE + if ((event->type == ButtonPress || event->type == ButtonRelease) + /* Disable on Shift-mouse, including the application-mouse modes */ + && !(KeyModifiers & ShiftMask) + && (screen->send_mouse_pos == MOUSE_OFF) + && SCREEN_FLAG(screen, paste_moves) + && rowOnCurrentLine(eventRow(event), &ldelta)) + ReadLineMovePoint(eventColBetween(event), ldelta); +#endif /* OPT_READLINE */ + _GetSelection(w, event->xbutton.time, params, *num_params, NULL); } @@ -1216,12 +1472,12 @@ { int delta; - if (lastButtonUpTime == (Time) 0) /* first time and once in a blue moon */ + if (lastButtonUpTime == (Time) 0) /* first time and once in a blue moon */ delta = term->screen.multiClickTime + 1; - else if (buttonDownTime > lastButtonUpTime) /* most of the time */ + else if (buttonDownTime > lastButtonUpTime) /* most of the time */ delta = buttonDownTime - lastButtonUpTime; - else /* time has rolled over since lastButtonUpTime */ - delta = (((Time) ~0) - lastButtonUpTime) + buttonDownTime; + else /* time has rolled over since lastButtonUpTime */ + delta = (((Time) ~ 0) - lastButtonUpTime) + buttonDownTime; if (delta > term->screen.multiClickTime) { numberOfClicks = 1; @@ -1232,75 +1488,81 @@ } } -static void do_select_start ( - Widget w, - XEvent *event, /* must be XButtonEvent* */ - int startrow, - int startcol) -{ - if (SendMousePosition(w, event)) return; - selectUnit = EvalSelectUnit(event->xbutton.time, SELECTCHAR); - replyToEmacs = FALSE; - StartSelect(startrow, startcol); +static void +do_select_start(Widget w, + XEvent * event, /* must be XButtonEvent* */ + int startrow, + int startcol) +{ + if (SendMousePosition(w, event)) + return; + selectUnit = EvalSelectUnit(event->xbutton.time, SELECTCHAR); + replyToEmacs = FALSE; + +#if OPT_READLINE + lastButtonDownTime = event->xbutton.time; +#endif + + StartSelect(startrow, startcol); } /* ARGSUSED */ void -HandleSelectStart( - Widget w, - XEvent *event, /* must be XButtonEvent* */ - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +HandleSelectStart(Widget w, + XEvent * event, /* must be XButtonEvent* */ + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { - register TScreen *screen; - int startrow, startcol; + TScreen *screen; + int startrow, startcol; - if (!IsXtermWidget(w)) - return; + if (!IsXtermWidget(w)) + return; - screen = &((XtermWidget)w)->screen; - firstValidRow = 0; - lastValidRow = screen->max_row; - PointToRowCol(event->xbutton.y, event->xbutton.x, &startrow, &startcol); - do_select_start (w, event, startrow, startcol); -} + screen = &((XtermWidget) w)->screen; + firstValidRow = 0; + lastValidRow = screen->max_row; + PointToRowCol(event->xbutton.y, event->xbutton.x, &startrow, &startcol); + +#if OPT_READLINE + ExtendingSelection = 0; +#endif + do_select_start(w, event, startrow, startcol); +} /* ARGSUSED */ void -HandleKeyboardSelectStart( - Widget w, - XEvent *event, /* must be XButtonEvent* */ - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +HandleKeyboardSelectStart(Widget w, + XEvent * event, /* must be XButtonEvent* */ + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { - register TScreen *screen; + TScreen *screen; - if (!IsXtermWidget(w)) - return; + if (!IsXtermWidget(w)) + return; - screen = &((XtermWidget)w)->screen; - do_select_start (w, event, screen->cursor_row, screen->cursor_col); + screen = &((XtermWidget) w)->screen; + do_select_start(w, event, screen->cursor_row, screen->cursor_col); } - static void -TrackDown(register XButtonEvent *event) +TrackDown(XButtonEvent * event) { - int startrow, startcol; + int startrow, startcol; - selectUnit = EvalSelectUnit(event->time, SELECTCHAR); - if (numberOfClicks > 1 ) { - PointToRowCol(event->y, event->x, &startrow, &startcol); - replyToEmacs = TRUE; - StartSelect(startrow, startcol); - } else { - waitingForTrackInfo = 1; - EditorButton((XButtonEvent *)event); - } + selectUnit = EvalSelectUnit(event->time, SELECTCHAR); + if (numberOfClicks > 1) { + PointToRowCol(event->y, event->x, &startrow, &startcol); + replyToEmacs = TRUE; + StartSelect(startrow, startcol); + } else { + waitingForTrackInfo = 1; + EditorButton((XButtonEvent *) event); + } } - #define boundsCheck(x) if (x < 0) \ x = 0; \ else if (x >= screen->max_row) \ @@ -1309,249 +1571,268 @@ void TrackMouse(int func, int startrow, int startcol, int firstrow, int lastrow) { - TScreen *screen = &term->screen; + TScreen *screen = &term->screen; - if (!waitingForTrackInfo) { /* Timed out, so ignore */ - return; - } - waitingForTrackInfo = 0; - if (func == 0) return; - boundsCheck (startrow) - boundsCheck (firstrow) - boundsCheck (lastrow) + if (!waitingForTrackInfo) { /* Timed out, so ignore */ + return; + } + waitingForTrackInfo = 0; + if (func == 0) + return; + boundsCheck(startrow) + boundsCheck(firstrow) + boundsCheck(lastrow) firstValidRow = firstrow; - lastValidRow = lastrow; - replyToEmacs = TRUE; - StartSelect(startrow, startcol); + lastValidRow = lastrow; + replyToEmacs = TRUE; + StartSelect(startrow, startcol); } static void StartSelect(int startrow, int startcol) { - TScreen *screen = &term->screen; + TScreen *screen = &term->screen; - TRACE(("StartSelect row=%d, col=%d\n", startrow, startcol)); - if (screen->cursor_state) - HideCursor (); - if (numberOfClicks == 1) { - /* set start of selection */ - rawRow = startrow; - rawCol = startcol; - - } /* else use old values in rawRow, Col */ - - saveStartRRow = startERow = rawRow; - saveStartRCol = startECol = rawCol; - saveEndRRow = endERow = rawRow; - saveEndRCol = endECol = rawCol; - if (Coordinate(startrow, startcol) < Coordinate(rawRow, rawCol)) { - eventMode = LEFTEXTENSION; - startERow = startrow; - startECol = startcol; - } else { - eventMode = RIGHTEXTENSION; - endERow = startrow; - endECol = startcol; - } - ComputeSelect(startERow, startECol, endERow, endECol, False); + TRACE(("StartSelect row=%d, col=%d\n", startrow, startcol)); + if (screen->cursor_state) + HideCursor(); + if (numberOfClicks == 1) { + /* set start of selection */ + rawRow = startrow; + rawCol = startcol; + + } + /* else use old values in rawRow, Col */ + saveStartRRow = startERow = rawRow; + saveStartRCol = startECol = rawCol; + saveEndRRow = endERow = rawRow; + saveEndRCol = endECol = rawCol; + if (Coordinate(startrow, startcol) < Coordinate(rawRow, rawCol)) { + eventMode = LEFTEXTENSION; + startERow = startrow; + startECol = startcol; + } else { + eventMode = RIGHTEXTENSION; + endERow = startrow; + endECol = startcol; + } + ComputeSelect(startERow, startECol, endERow, endECol, False); } static void -EndExtend( - Widget w, - XEvent *event, /* must be XButtonEvent */ - String *params, /* selections */ - Cardinal num_params, - Bool use_cursor_loc) -{ - int row, col, count; - TScreen *screen = &term->screen; - Char line[9]; - - if (use_cursor_loc) { - row = screen->cursor_row; - col = screen->cursor_col; - } else { - PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); - } - ExtendExtend (row, col); - lastButtonUpTime = event->xbutton.time; - if (startSRow != endSRow || startSCol != endSCol) { - if (replyToEmacs) { - count = 0; - if (screen->control_eight_bits) { - line[count++] = CSI; - } else { - line[count++] = ESC; - line[count++] = '['; - } - if (rawRow == startSRow && rawCol == startSCol - && row == endSRow && col == endSCol) { - /* Use short-form emacs select */ - line[count++] = 't'; - line[count++] = ' ' + endSCol + 1; - line[count++] = ' ' + endSRow + 1; - } else { - /* long-form, specify everything */ - line[count++] = 'T'; - line[count++] = ' ' + startSCol + 1; - line[count++] = ' ' + startSRow + 1; - line[count++] = ' ' + endSCol + 1; - line[count++] = ' ' + endSRow + 1; - line[count++] = ' ' + col + 1; - line[count++] = ' ' + row + 1; - } - v_write(screen->respond, line, count); - TrackText(0, 0, 0, 0); - } +EndExtend(Widget w, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal num_params, + Bool use_cursor_loc) +{ + int row, col, count; + TScreen *screen = &term->screen; + Char line[9]; + + if (use_cursor_loc) { + row = screen->cursor_row; + col = screen->cursor_col; + } else { + PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); + } + ExtendExtend(row, col); + lastButtonUpTime = event->xbutton.time; + if (startSRow != endSRow || startSCol != endSCol) { + if (replyToEmacs) { + count = 0; + if (screen->control_eight_bits) { + line[count++] = CSI; + } else { + line[count++] = ESC; + line[count++] = '['; + } + if (rawRow == startSRow && rawCol == startSCol + && row == endSRow && col == endSCol) { + /* Use short-form emacs select */ + line[count++] = 't'; + line[count++] = ' ' + endSCol + 1; + line[count++] = ' ' + endSRow + 1; + } else { + /* long-form, specify everything */ + line[count++] = 'T'; + line[count++] = ' ' + startSCol + 1; + line[count++] = ' ' + startSRow + 1; + line[count++] = ' ' + endSCol + 1; + line[count++] = ' ' + endSRow + 1; + line[count++] = ' ' + col + 1; + line[count++] = ' ' + row + 1; + } + v_write(screen->respond, line, count); + TrackText(0, 0, 0, 0); } - SelectSet(w, event, params, num_params); - eventMode = NORMAL; + } + SelectSet(w, event, params, num_params); + eventMode = NORMAL; } void -HandleSelectSet( - Widget w, - XEvent *event, - String *params, - Cardinal *num_params) +HandleSelectSet(Widget w, + XEvent * event, + String * params, + Cardinal * num_params) { - SelectSet (w, event, params, *num_params); + SelectSet(w, event, params, *num_params); } /* ARGSUSED */ static void -SelectSet ( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params, - Cardinal num_params) -{ - /* Only do select stuff if non-null select */ - if (startSRow != endSRow || startSCol != endSCol) { - SaltTextAway(startSRow, startSCol, endSRow, endSCol, - params, num_params); - } else - DisownSelection(term); +SelectSet(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params, + Cardinal num_params) +{ + /* Only do select stuff if non-null select */ + if (startSRow != endSRow || startSCol != endSCol) { + SaltTextAway(startSRow, startSCol, endSRow, endSCol, + params, num_params); + } else + DisownSelection(term); } #define Abs(x) ((x) < 0 ? -(x) : (x)) /* ARGSUSED */ -static void do_start_extend ( - Widget w, - XEvent *event, /* must be XButtonEvent* */ - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED, - Bool use_cursor_loc) +static void +do_start_extend(Widget w, + XEvent * event, /* must be XButtonEvent* */ + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED, + Bool use_cursor_loc) { - TScreen *screen; - int row, col, coord; + TScreen *screen; + int row, col, coord; - if (!IsXtermWidget(w)) - return; + if (!IsXtermWidget(w)) + return; - screen = &((XtermWidget)w)->screen; - if (SendMousePosition(w, event)) return; - firstValidRow = 0; - lastValidRow = screen->max_row; + screen = &((XtermWidget) w)->screen; + if (SendMousePosition(w, event)) + return; + firstValidRow = 0; + lastValidRow = screen->max_row; +#if OPT_READLINE + if ((KeyModifiers & ShiftMask) + || event->xbutton.button != Button3 + || !(SCREEN_FLAG(screen, dclick3_deletes))) +#endif selectUnit = EvalSelectUnit(event->xbutton.time, selectUnit); - replyToEmacs = FALSE; + replyToEmacs = FALSE; - if (numberOfClicks == 1) { - /* Save existing selection so we can reestablish it if the guy - extends past the other end of the selection */ - saveStartRRow = startERow = startRRow; - saveStartRCol = startECol = startRCol; - saveEndRRow = endERow = endRRow; - saveEndRCol = endECol = endRCol; - } else { - /* He just needed the selection mode changed, use old values. */ - startERow = startRRow = saveStartRRow; - startECol = startRCol = saveStartRCol; - endERow = endRRow = saveEndRRow; - endECol = endRCol = saveEndRCol; +#if OPT_READLINE + CheckSecondPress3(event); +#endif - } - if (use_cursor_loc) { - row = screen->cursor_row; - col = screen->cursor_col; - } else { - PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); - } - coord = Coordinate(row, col); + if (numberOfClicks == 1 + || (SCREEN_FLAG(screen, dclick3_deletes) /* Dclick special */ + &&!(KeyModifiers & ShiftMask))) { + /* Save existing selection so we can reestablish it if the guy + extends past the other end of the selection */ + saveStartRRow = startERow = startRRow; + saveStartRCol = startECol = startRCol; + saveEndRRow = endERow = endRRow; + saveEndRCol = endECol = endRCol; + } else { + /* He just needed the selection mode changed, use old values. */ + startERow = startRRow = saveStartRRow; + startECol = startRCol = saveStartRCol; + endERow = endRRow = saveEndRRow; + endECol = endRCol = saveEndRCol; - if (Abs(coord - Coordinate(startSRow, startSCol)) - < Abs(coord - Coordinate(endSRow, endSCol)) - || coord < Coordinate(startSRow, startSCol)) { - /* point is close to left side of selection */ - eventMode = LEFTEXTENSION; - startERow = row; - startECol = col; - } else { - /* point is close to left side of selection */ - eventMode = RIGHTEXTENSION; - endERow = row; - endECol = col; - } - ComputeSelect(startERow, startECol, endERow, endECol, True); + } + if (use_cursor_loc) { + row = screen->cursor_row; + col = screen->cursor_col; + } else { + PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); + } + coord = Coordinate(row, col); + + if (Abs(coord - Coordinate(startSRow, startSCol)) + < Abs(coord - Coordinate(endSRow, endSCol)) + || coord < Coordinate(startSRow, startSCol)) { + /* point is close to left side of selection */ + eventMode = LEFTEXTENSION; + startERow = row; + startECol = col; + } else { + /* point is close to left side of selection */ + eventMode = RIGHTEXTENSION; + endERow = row; + endECol = col; + } + ComputeSelect(startERow, startECol, endERow, endECol, True); + +#if OPT_READLINE + if (startSRow != endSRow || startSCol != endSCol) + ExtendingSelection = 1; +#endif } static void -ExtendExtend (int row, int col) -{ - int coord = Coordinate(row, col); - - TRACE(("ExtendExtend row=%d, col=%d\n", row, col)); - if (eventMode == LEFTEXTENSION - && (coord + (selectUnit!=SELECTCHAR)) > Coordinate(endSRow, endSCol)) { - /* Whoops, he's changed his mind. Do RIGHTEXTENSION */ - eventMode = RIGHTEXTENSION; - startERow = saveStartRRow; - startECol = saveStartRCol; - } else if (eventMode == RIGHTEXTENSION - && coord < Coordinate(startSRow, startSCol)) { - /* Whoops, he's changed his mind. Do LEFTEXTENSION */ - eventMode = LEFTEXTENSION; - endERow = saveEndRRow; - endECol = saveEndRCol; - } - if (eventMode == LEFTEXTENSION) { - startERow = row; - startECol = col; - } else { - endERow = row; - endECol = col; - } - ComputeSelect(startERow, startECol, endERow, endECol, False); -} +ExtendExtend(int row, int col) +{ + int coord = Coordinate(row, col); + + TRACE(("ExtendExtend row=%d, col=%d\n", row, col)); + if (eventMode == LEFTEXTENSION + && (coord + (selectUnit != SELECTCHAR)) > Coordinate(endSRow, endSCol)) { + /* Whoops, he's changed his mind. Do RIGHTEXTENSION */ + eventMode = RIGHTEXTENSION; + startERow = saveStartRRow; + startECol = saveStartRCol; + } else if (eventMode == RIGHTEXTENSION + && coord < Coordinate(startSRow, startSCol)) { + /* Whoops, he's changed his mind. Do LEFTEXTENSION */ + eventMode = LEFTEXTENSION; + endERow = saveEndRRow; + endECol = saveEndRCol; + } + if (eventMode == LEFTEXTENSION) { + startERow = row; + startECol = col; + } else { + endERow = row; + endECol = col; + } + ComputeSelect(startERow, startECol, endERow, endECol, False); +#if OPT_READLINE + if (startSRow != endSRow || startSCol != endSCol) + ExtendingSelection = 1; +#endif +} -void HandleStartExtend( - Widget w, - XEvent *event, /* must be XButtonEvent* */ - String *params, /* unused */ - Cardinal *num_params) /* unused */ +void +HandleStartExtend(Widget w, + XEvent * event, /* must be XButtonEvent* */ + String * params, /* unused */ + Cardinal * num_params) /* unused */ { - do_start_extend (w, event, params, num_params, False); + do_start_extend(w, event, params, num_params, False); } -void HandleKeyboardStartExtend( - Widget w, - XEvent *event, /* must be XButtonEvent* */ - String *params, /* unused */ - Cardinal *num_params) /* unused */ +void +HandleKeyboardStartExtend(Widget w, + XEvent * event, /* must be XButtonEvent* */ + String * params, /* unused */ + Cardinal * num_params) /* unused */ { - do_start_extend (w, event, params, num_params, True); + do_start_extend(w, event, params, num_params, True); } void -ScrollSelection(register TScreen* screen, register int amount) +ScrollSelection(TScreen * screen, int amount) { - register int minrow = -screen->savedlines - screen->topline; - register int maxrow = screen->max_row - screen->topline; - register int maxcol = screen->max_col; + int minrow = -screen->savedlines - screen->topline; + int maxrow = screen->max_row - screen->topline; + int maxcol = screen->max_col; #define scroll_update_one(row, col) \ row += amount; \ @@ -1565,109 +1846,117 @@ } scroll_update_one(startRRow, startRCol); - scroll_update_one(endRRow, endRCol); + scroll_update_one(endRRow, endRCol); scroll_update_one(startSRow, startSCol); - scroll_update_one(endSRow, endSCol); + scroll_update_one(endSRow, endSCol); scroll_update_one(rawRow, rawCol); scroll_update_one(screen->startHRow, screen->startHCol); - scroll_update_one(screen->endHRow, screen->endHCol); + scroll_update_one(screen->endHRow, screen->endHCol); - screen->startHCoord = Coordinate (screen->startHRow, screen->startHCol); - screen->endHCoord = Coordinate (screen->endHRow, screen->endHCol); + screen->startHCoord = Coordinate(screen->startHRow, screen->startHCol); + screen->endHCoord = Coordinate(screen->endHRow, screen->endHCol); } - /*ARGSUSED*/ void -ResizeSelection (TScreen *screen GCC_UNUSED, int rows, int cols) +ResizeSelection(TScreen * screen GCC_UNUSED, int rows, int cols) { - rows--; /* decr to get 0-max */ + rows--; /* decr to get 0-max */ cols--; - if (startRRow > rows) startRRow = rows; - if (startSRow > rows) startSRow = rows; - if (endRRow > rows) endRRow = rows; - if (endSRow > rows) endSRow = rows; - if (rawRow > rows) rawRow = rows; - - if (startRCol > cols) startRCol = cols; - if (startSCol > cols) startSCol = cols; - if (endRCol > cols) endRCol = cols; - if (endSCol > cols) endSCol = cols; - if (rawCol > cols) rawCol = cols; + if (startRRow > rows) + startRRow = rows; + if (startSRow > rows) + startSRow = rows; + if (endRRow > rows) + endRRow = rows; + if (endSRow > rows) + endSRow = rows; + if (rawRow > rows) + rawRow = rows; + + if (startRCol > cols) + startRCol = cols; + if (startSCol > cols) + startSCol = cols; + if (endRCol > cols) + endRCol = cols; + if (endSCol > cols) + endSCol = cols; + if (rawCol > cols) + rawCol = cols; } #if OPT_WIDE_CHARS -int iswide(int i) +int +iswide(int i) { return (i == HIDDEN_CHAR) || (my_wcwidth(i) == 2); } #endif static void -PointToRowCol( - register int y, - register int x, - int *r, - int *c) +PointToRowCol(int y, + int x, + int *r, + int *c) /* Convert pixel coordinates to character coordinates. Rows are clipped between firstValidRow and lastValidRow. Columns are clipped between to be 0 or greater, but are not clipped to some maximum value. */ { - register TScreen *screen = &term->screen; - register int row, col; + TScreen *screen = &term->screen; + int row, col; - row = (y - screen->border) / FontHeight(screen); - if(row < firstValidRow) - row = firstValidRow; - else if(row > lastValidRow) - row = lastValidRow; - col = (x - OriginX(screen)) / FontWidth(screen); - if(col < 0) - col = 0; - else if(col > screen->max_col+1) { - col = screen->max_col+1; - } + row = (y - screen->border) / FontHeight(screen); + if (row < firstValidRow) + row = firstValidRow; + else if (row > lastValidRow) + row = lastValidRow; + col = (x - OriginX(screen)) / FontWidth(screen); + if (col < 0) + col = 0; + else if (col > screen->max_col + 1) { + col = screen->max_col + 1; + } #if OPT_WIDE_CHARS - /* - * If we got a click on the right half of a doublewidth character, - * pretend it happened on the left half. - */ - if (col > 0 - && iswide(XTERM_CELL(row, col-1)) - && (XTERM_CELL(row, col) == HIDDEN_CHAR)) { - col -= 1; - } + /* + * If we got a click on the right half of a doublewidth character, + * pretend it happened on the left half. + */ + if (col > 0 + && iswide(XTERM_CELL(row, col - 1)) + && (XTERM_CELL(row, col) == HIDDEN_CHAR)) { + col -= 1; + } #endif - *r = row; - *c = col; + *r = row; + *c = col; } static int -LastTextCol(register int row) +LastTextCol(int row) { - register TScreen *screen = &term->screen; - register int i; - register Char *ch; - - if ((row += screen->topline) + screen->savedlines >= 0) { - for ( i = screen->max_col, - ch = SCRN_BUF_ATTRS(screen, row) + i ; - i >= 0 && !(*ch & CHARDRAWN) ; - ch--, i--) - ; + TScreen *screen = &term->screen; + int i; + Char *ch; + + if ((row += screen->topline) + screen->savedlines >= 0) { + for (i = screen->max_col, + ch = SCRN_BUF_ATTRS(screen, row) + i; + i >= 0 && !(*ch & CHARDRAWN); + ch--, i--) ; #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, row)[0])) { - i *= 2; - } -#endif - } else { - i = -1; + if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, row)[0])) { + i *= 2; } - return(i); +#endif + } else { + i = -1; + } + return (i); } #if !OPT_WIDE_CHARS @@ -1681,9 +1970,11 @@ ** - binding characters [0x40,0x7f] U [0xc0,0xff] ** - exceptions */ -static int charClass[256] = { +/* *INDENT-OFF* */ +static int charClass[256] = +{ /* NUL SOH STX ETX EOT ENQ ACK BEL */ - 32, 1, 1, 1, 1, 1, 1, 1, + 32, 1, 1, 1, 1, 1, 1, 1, /* BS HT NL VT NP CR SO SI */ 1, 32, 1, 1, 1, 1, 1, 1, /* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ @@ -1715,54 +2006,58 @@ /* x y z { | } ~ DEL */ 48, 48, 48, 123, 124, 125, 126, 1, /* x80 x81 x82 x83 IND NEL SSA ESA */ - 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, /* HTS HTJ VTS PLD PLU RI SS2 SS3 */ - 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, /* DCS PU1 PU2 STS CCH MW SPA EPA */ - 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, /* x98 x99 x9A CSI ST OSC PM APC */ - 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, /* - i c/ L ox Y- | So */ - 160, 161, 162, 163, 164, 165, 166, 167, + 160, 161, 162, 163, 164, 165, 166, 167, /* .. c0 ip << _ R0 - */ - 168, 169, 170, 171, 172, 173, 174, 175, + 168, 169, 170, 171, 172, 173, 174, 175, /* o +- 2 3 ' u q| . */ - 176, 177, 178, 179, 180, 181, 182, 183, + 176, 177, 178, 179, 180, 181, 182, 183, /* , 1 2 >> 1/4 1/2 3/4 ? */ - 184, 185, 186, 187, 188, 189, 190, 191, + 184, 185, 186, 187, 188, 189, 190, 191, /* A` A' A^ A~ A: Ao AE C, */ - 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, /* E` E' E^ E: I` I' I^ I: */ - 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, /* D- N~ O` O' O^ O~ O: X */ - 48, 48, 48, 48, 48, 48, 48, 215, + 48, 48, 48, 48, 48, 48, 48, 215, /* O/ U` U' U^ U: Y' P B */ - 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, /* a` a' a^ a~ a: ao ae c, */ - 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, /* e` e' e^ e: i` i' i^ i: */ - 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, /* d n~ o` o' o^ o~ o: -: */ - 48, 48, 48, 48, 48, 48, 48, 247, + 48, 48, 48, 48, 48, 48, 48, 247, /* o/ u` u' u^ u: y' P y: */ - 48, 48, 48, 48, 48, 48, 48, 48}; + 48, 48, 48, 48, 48, 48, 48, 48}; +/* *INDENT-ON* */ -int SetCharacterClassRange ( - register int low, /* in range of [0..255] */ - register int high, - register int value) /* arbitrary */ +int +SetCharacterClassRange(int low, /* in range of [0..255] */ + int high, + int value) /* arbitrary */ { - if (low < 0 || high > 255 || high < low) return (-1); + if (low < 0 || high > 255 || high < low) + return (-1); - for (; low <= high; low++) charClass[low] = value; + for (; low <= high; low++) + charClass[low] = value; return (0); } #endif #if OPT_WIDE_CHARS -static int class_of(TScreen *screen, int row, int col) +static int +class_of(TScreen * screen, int row, int col) { unsigned value; #if OPT_DEC_CHRSET @@ -1773,7 +2068,7 @@ value = XTERM_CELL(row, col); if_OPT_WIDE_CHARS(screen, { return CharacterClass(value); - }) + }); return CharacterClass(value); } #define ClassSelects(screen, row, col, cclass) \ @@ -1789,248 +2084,254 @@ * sets startSRow startSCol endSRow endSCol * ensuring that they have legal values */ - static void -ComputeSelect( - int startRow, - int startCol, - int endRow, - int endCol, - Bool extend) -{ - register TScreen *screen = &term->screen; - register int length; - register int cclass; +ComputeSelect(int startRow, + int startCol, + int endRow, + int endCol, + Bool extend) +{ + TScreen *screen = &term->screen; + int length; + int cclass; + TRACE(("ComputeSelect(startRow=%d, startCol=%d, endRow=%d, endCol=%d, %sextend)\n", + startRow, startCol, endRow, endCol, extend ? "" : "no")); + #if OPT_WIDE_CHARS - if (startCol > 1 - && iswide(XTERM_CELL(startRow, startCol-1)) - && XTERM_CELL(startRow, startCol-0) == HIDDEN_CHAR) { - fprintf(stderr, "Adjusting start. Changing downwards from %i.\n", startCol); - startCol -= 1; - if (endCol == (startCol+1)) endCol--; - } - - if (iswide(XTERM_CELL(endRow, endCol-1)) - && XTERM_CELL(endRow, endCol) == HIDDEN_CHAR) { - endCol += 1; - } + if (startCol > 1 + && iswide(XTERM_CELL(startRow, startCol - 1)) + && XTERM_CELL(startRow, startCol - 0) == HIDDEN_CHAR) { + fprintf(stderr, "Adjusting start. Changing downwards from %i.\n", startCol); + startCol -= 1; + if (endCol == (startCol + 1)) + endCol--; + } + + if (iswide(XTERM_CELL(endRow, endCol - 1)) + && XTERM_CELL(endRow, endCol) == HIDDEN_CHAR) { + endCol += 1; + } #endif - if (Coordinate(startRow, startCol) <= Coordinate(endRow, endCol)) { - startSRow = startRRow = startRow; - startSCol = startRCol = startCol; - endSRow = endRRow = endRow; - endSCol = endRCol = endCol; - } else { /* Swap them */ - startSRow = startRRow = endRow; - startSCol = startRCol = endCol; - endSRow = endRRow = startRow; - endSCol = endRCol = startCol; - } - - switch (selectUnit) { - case SELECTCHAR : - if (startSCol > (LastTextCol(startSRow) + 1)) { - startSCol = 0; - startSRow++; - } - if (endSCol > (LastTextCol(endSRow) + 1)) { - endSCol = 0; - endSRow++; - } - break; - case SELECTWORD : - if (startSCol > (LastTextCol(startSRow) + 1)) { - startSCol = 0; - startSRow++; - } else { - cclass = class_of(screen,startSRow,startSCol); - do { - --startSCol; - if (startSCol < 0 - && ScrnTstWrapped(screen, startSRow - 1)) { - --startSRow; - startSCol = LastTextCol(startSRow); - } - } while (startSCol >= 0 - && ClassSelects(screen, startSRow, startSCol, cclass)); - ++startSCol; - } + if (Coordinate(startRow, startCol) <= Coordinate(endRow, endCol)) { + startSRow = startRRow = startRow; + startSCol = startRCol = startCol; + endSRow = endRRow = endRow; + endSCol = endRCol = endCol; + } else { /* Swap them */ + startSRow = startRRow = endRow; + startSCol = startRCol = endCol; + endSRow = endRRow = startRow; + endSCol = endRCol = startCol; + } + + switch (selectUnit) { + case SELECTCHAR: + if (startSCol > (LastTextCol(startSRow) + 1)) { + startSCol = 0; + startSRow++; + } + if (endSCol > (LastTextCol(endSRow) + 1)) { + endSCol = 0; + endSRow++; + } + break; + case SELECTWORD: + if (startSCol > (LastTextCol(startSRow) + 1)) { + startSCol = 0; + startSRow++; + } else { + cclass = class_of(screen, startSRow, startSCol); + do { + --startSCol; + if (startSCol < 0 + && ScrnTstWrapped(screen, startSRow - 1)) { + --startSRow; + startSCol = LastTextCol(startSRow); + } + } while (startSCol >= 0 + && ClassSelects(screen, startSRow, startSCol, cclass)); + ++startSCol; + } #if OPT_WIDE_CHARS - if (startSCol && XTERM_CELL(startSRow, startSCol) == HIDDEN_CHAR) - startSCol++; + if (startSCol && XTERM_CELL(startSRow, startSCol) == HIDDEN_CHAR) + startSCol++; #endif - if (endSCol > (LastTextCol(endSRow) + 1)) { - endSCol = 0; - endSRow++; - } else { - length = LastTextCol(endSRow); - cclass = class_of(screen,endSRow,endSCol); - do { - ++endSCol; - if (endSCol > length - && ScrnTstWrapped(screen, endSRow)) { - endSCol = 0; - ++endSRow; - length = LastTextCol(endSRow); - } - } while (endSCol <= length - && ClassSelects(screen,endSRow,endSCol, cclass)); - /* Word select selects if pointing to any char - in "word", especially in that it includes - the last character in a word. So no --endSCol - and do special eol handling */ - if (endSCol > length+1) { - endSCol = 0; - ++endSRow; - } - } + if (endSCol > (LastTextCol(endSRow) + 1)) { + endSCol = 0; + endSRow++; + } else { + length = LastTextCol(endSRow); + cclass = class_of(screen, endSRow, endSCol); + do { + ++endSCol; + if (endSCol > length + && ScrnTstWrapped(screen, endSRow)) { + endSCol = 0; + ++endSRow; + length = LastTextCol(endSRow); + } + } while (endSCol <= length + && ClassSelects(screen, endSRow, endSCol, cclass)); + /* Word select selects if pointing to any char + in "word", especially in that it includes + the last character in a word. So no --endSCol + and do special eol handling */ + if (endSCol > length + 1) { + endSCol = 0; + ++endSRow; + } + } #if OPT_WIDE_CHARS - if (endSCol && XTERM_CELL(endSRow, endSCol) == HIDDEN_CHAR) - endSCol++; + if (endSCol && XTERM_CELL(endSRow, endSCol) == HIDDEN_CHAR) + endSCol++; #endif - saveStartWRow = startSRow; - saveStartWCol = startSCol; - break; - case SELECTLINE : - while (ScrnTstWrapped(screen, endSRow)) { - ++endSRow; - } - if (term->screen.cutToBeginningOfLine - || startSRow < saveStartWRow) { - startSCol = 0; - while (ScrnTstWrapped(screen, startSRow - 1)) { - --startSRow; - } - } else if (!extend) { - if ((startRow < saveStartWRow) - || (startRow == saveStartWRow - && startCol < saveStartWCol)) { - startSCol = 0; - while (ScrnTstWrapped(screen, startSRow - 1)) { - --startSRow; - } - } else { - startSRow = saveStartWRow; - startSCol = saveStartWCol; - } - } - if (term->screen.cutNewline) { - endSCol = 0; - ++endSRow; - } else { - endSCol = LastTextCol(endSRow) + 1; - } - break; - } - - TrackText(startSRow, startSCol, endSRow, endSCol); - return; + saveStartWRow = startSRow; + saveStartWCol = startSCol; + break; + case SELECTLINE: + while (ScrnTstWrapped(screen, endSRow)) { + ++endSRow; + } + if (term->screen.cutToBeginningOfLine + || startSRow < saveStartWRow) { + startSCol = 0; + while (ScrnTstWrapped(screen, startSRow - 1)) { + --startSRow; + } + } else if (!extend) { + if ((startRow < saveStartWRow) + || (startRow == saveStartWRow + && startCol < saveStartWCol)) { + startSCol = 0; + while (ScrnTstWrapped(screen, startSRow - 1)) { + --startSRow; + } + } else { + startSRow = saveStartWRow; + startSCol = saveStartWCol; + } + } + if (term->screen.cutNewline) { + endSCol = 0; + ++endSRow; + } else { + endSCol = LastTextCol(endSRow) + 1; + } + break; + } + + /* check boundaries */ + ScrollSelection(screen, 0); + + TrackText(startSRow, startSCol, endSRow, endSCol); + return; } void -TrackText( - register int frow, - register int fcol, - register int trow, - register int tcol) +TrackText(int frow, + int fcol, + int trow, + int tcol) /* Guaranteed (frow, fcol) <= (trow, tcol) */ { - register int from, to; - register TScreen *screen = &term->screen; - int old_startrow, old_startcol, old_endrow, old_endcol; - - old_startrow = screen->startHRow; - old_startcol = screen->startHCol; - old_endrow = screen->endHRow; - old_endcol = screen->endHCol; - if (frow == old_startrow && fcol == old_startcol && - trow == old_endrow && tcol == old_endcol) return; - screen->startHRow = frow; - screen->startHCol = fcol; - screen->endHRow = trow; - screen->endHCol = tcol; - from = Coordinate(frow, fcol); - to = Coordinate(trow, tcol); - if (to <= screen->startHCoord || from > screen->endHCoord) { - /* No overlap whatsoever between old and new hilite */ - ReHiliteText(old_startrow, old_startcol, old_endrow, old_endcol); - ReHiliteText(frow, fcol, trow, tcol); - } else { - if (from < screen->startHCoord) { - /* Extend left end */ - ReHiliteText(frow, fcol, old_startrow, old_startcol); - } else if (from > screen->startHCoord) { - /* Shorten left end */ - ReHiliteText(old_startrow, old_startcol, frow, fcol); - } - if (to > screen->endHCoord) { - /* Extend right end */ - ReHiliteText(old_endrow, old_endcol, trow, tcol); - } else if (to < screen->endHCoord) { - /* Shorten right end */ - ReHiliteText(trow, tcol, old_endrow, old_endcol); - } + int from, to; + TScreen *screen = &term->screen; + int old_startrow, old_startcol, old_endrow, old_endcol; + + TRACE(("TrackText(frow=%d, fcol=%d, trow=%d, tcol=%d)\n", + frow, fcol, trow, tcol)); + + old_startrow = screen->startHRow; + old_startcol = screen->startHCol; + old_endrow = screen->endHRow; + old_endcol = screen->endHCol; + if (frow == old_startrow && fcol == old_startcol && + trow == old_endrow && tcol == old_endcol) + return; + screen->startHRow = frow; + screen->startHCol = fcol; + screen->endHRow = trow; + screen->endHCol = tcol; + from = Coordinate(frow, fcol); + to = Coordinate(trow, tcol); + if (to <= screen->startHCoord || from > screen->endHCoord) { + /* No overlap whatsoever between old and new hilite */ + ReHiliteText(old_startrow, old_startcol, old_endrow, old_endcol); + ReHiliteText(frow, fcol, trow, tcol); + } else { + if (from < screen->startHCoord) { + /* Extend left end */ + ReHiliteText(frow, fcol, old_startrow, old_startcol); + } else if (from > screen->startHCoord) { + /* Shorten left end */ + ReHiliteText(old_startrow, old_startcol, frow, fcol); + } + if (to > screen->endHCoord) { + /* Extend right end */ + ReHiliteText(old_endrow, old_endcol, trow, tcol); + } else if (to < screen->endHCoord) { + /* Shorten right end */ + ReHiliteText(trow, tcol, old_endrow, old_endcol); } - screen->startHCoord = from; - screen->endHCoord = to; + } + screen->startHCoord = from; + screen->endHCoord = to; } static void -ReHiliteText( - register int frow, - register int fcol, - register int trow, - register int tcol) +ReHiliteText(int frow, + int fcol, + int trow, + int tcol) /* Guaranteed that (frow, fcol) <= (trow, tcol) */ { - register TScreen *screen = &term->screen; - register int i; + TScreen *screen = &term->screen; + int i; - if (frow < 0) - frow = fcol = 0; - else if (frow > screen->max_row) - return; /* nothing to do, since trow >= frow */ - - if (trow < 0) - return; /* nothing to do, since frow <= trow */ - else if (trow > screen->max_row) { - trow = screen->max_row; - tcol = screen->max_col+1; - } - if (frow == trow && fcol == tcol) - return; + if (frow < 0) + frow = fcol = 0; + else if (frow > screen->max_row) + return; /* nothing to do, since trow >= frow */ + + if (trow < 0) + return; /* nothing to do, since frow <= trow */ + else if (trow > screen->max_row) { + trow = screen->max_row; + tcol = screen->max_col + 1; + } + if (frow == trow && fcol == tcol) + return; - if(frow != trow) { /* do multiple rows */ - if((i = screen->max_col - fcol + 1) > 0) { /* first row */ - ScrnRefresh(screen, frow, fcol, 1, i, True); - } - if((i = trow - frow - 1) > 0) { /* middle rows*/ - ScrnRefresh(screen, frow+1, 0,i, screen->max_col+1, True); - } - if(tcol > 0 && trow <= screen->max_row) { /* last row */ - ScrnRefresh(screen, trow, 0, 1, tcol, True); - } - } else { /* do single row */ - ScrnRefresh(screen, frow, fcol, 1, tcol - fcol, True); + if (frow != trow) { /* do multiple rows */ + if ((i = screen->max_col - fcol + 1) > 0) { /* first row */ + ScrnRefresh(screen, frow, fcol, 1, i, True); } + if ((i = trow - frow - 1) > 0) { /* middle rows */ + ScrnRefresh(screen, frow + 1, 0, i, screen->max_col + 1, True); + } + if (tcol > 0 && trow <= screen->max_row) { /* last row */ + ScrnRefresh(screen, trow, 0, 1, tcol, True); + } + } else { /* do single row */ + ScrnRefresh(screen, frow, fcol, 1, tcol - fcol, True); + } } static void -SaltTextAway( - int crow, int ccol, int row, int col, - String *params, /* selections */ - Cardinal num_params) +SaltTextAway(int crow, int ccol, int row, int col, + String * params, /* selections */ + Cardinal num_params) /* Guaranteed that (crow, ccol) <= (row, col), and that both points are valid (may have row = screen->max_row+1, col = 0) */ { - register TScreen *screen = &term->screen; - register int i, j = 0; + TScreen *screen = &term->screen; + int i, j = 0; int eol; char *line; Char *lp; @@ -2042,11 +2343,11 @@ } --col; - /* first we need to know how long the string is before we can save it*/ + /* first we need to know how long the string is before we can save it */ - if ( row == crow ) { + if (row == crow) { j = Length(screen, crow, ccol, col); - } else { /* two cases, cut is on same line, cut spans multiple lines */ + } else { /* two cases, cut is on same line, cut spans multiple lines */ j += Length(screen, crow, ccol, screen->max_col) + 1; for (i = crow + 1; i < row; i++) j += Length(screen, i, 0, screen->max_col) + 1; @@ -2055,12 +2356,14 @@ } /* UTF-8 may require more space */ - if_OPT_WIDE_CHARS(screen,{j *= 4;}) + if_OPT_WIDE_CHARS(screen, { + j *= 4; + }); /* now get some memory to save it in */ if (screen->selection_size <= j) { - if((line = (char *)malloc((unsigned) j + 1)) == 0) + if ((line = (char *) malloc((unsigned) j + 1)) == 0) SysError(ERROR_BMALLOC2); XtFree(screen->selection_data); screen->selection_data = line; @@ -2070,50 +2373,50 @@ } if ((line == 0) - || (j < 0)) + || (j < 0)) return; line[j] = '\0'; /* make sure it is null terminated */ - lp = (Char *)line; /* lp points to where to save the text */ - if ( row == crow ) { + lp = (Char *) line; /* lp points to where to save the text */ + if (row == crow) { lp = SaveText(screen, row, ccol, col, lp, &eol); } else { lp = SaveText(screen, crow, ccol, screen->max_col, lp, &eol); if (eol) - *lp ++ = '\n'; /* put in newline at end of line */ - for(i = crow +1; i < row; i++) { + *lp++ = '\n'; /* put in newline at end of line */ + for (i = crow + 1; i < row; i++) { lp = SaveText(screen, i, 0, screen->max_col, lp, &eol); if (eol) - *lp ++ = '\n'; + *lp++ = '\n'; } if (col >= 0) lp = SaveText(screen, row, 0, col, lp, &eol); } *lp = '\0'; /* make sure we have end marked */ - TRACE(("Salted TEXT:%.*s\n", (char *)lp - line, line)); - screen->selection_length = ((char *)lp - line); + TRACE(("Salted TEXT:%.*s\n", (char *) lp - line, line)); + screen->selection_length = ((char *) lp - line); _OwnSelection(term, params, num_params); } static Boolean _ConvertSelectionHelper(Widget w, - Atom *type, XtPointer *value, + Atom * type, XtPointer * value, unsigned long *length, int *format, - int (*conversion_function)(Display*, - char**, int, - XICCEncodingStyle, - XTextProperty*), + int (*conversion_function) (Display *, + char **, int, + XICCEncodingStyle, + XTextProperty *), XICCEncodingStyle conversion_style) { - Display* d = XtDisplay(w); + Display *d = XtDisplay(w); TScreen *screen; XTextProperty textprop; if (!IsXtermWidget(w)) return False; - screen = &((XtermWidget)w)->screen; + screen = &((XtermWidget) w)->screen; if (conversion_function(d, &screen->selection_data, 1, conversion_style, @@ -2126,37 +2429,35 @@ return True; } - static Boolean -ConvertSelection( - Widget w, - Atom *selection, - Atom *target, - Atom *type, - XtPointer *value, - unsigned long *length, - int *format) +ConvertSelection(Widget w, + Atom * selection, + Atom * target, + Atom * type, + XtPointer * value, + unsigned long *length, + int *format) { - Display* d = XtDisplay(w); + Display *d = XtDisplay(w); TScreen *screen; if (!IsXtermWidget(w)) return False; - screen = &((XtermWidget)w)->screen; + screen = &((XtermWidget) w)->screen; if (screen->selection_data == NULL) return False; /* can this happen? */ if (*target == XA_TARGETS(d)) { - Atom* targetP; - Atom* std_targets; + Atom *targetP; + Atom *std_targets; unsigned long std_length; XmuConvertStandardSelection(w, screen->selection_time, selection, - target, type, (XPointer *)&std_targets, + target, type, (XPointer *) & std_targets, &std_length, format); *length = std_length + 6; - targetP = (Atom*)XtMalloc(sizeof(Atom)*(*length)); + targetP = (Atom *) XtMalloc(sizeof(Atom) * (*length)); *value = (XtPointer) targetP; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); @@ -2167,19 +2468,17 @@ *targetP = XA_COMPOUND_TEXT(d); if_OPT_WIDE_CHARS(screen, { *targetP = XA_UTF8_STRING(d); - }) + }); targetP++; #endif *targetP++ = XA_LENGTH(d); *targetP++ = XA_LIST_LENGTH(d); - memcpy ( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); - XtFree((char*)std_targets); + memcpy((char *) targetP, (char *) std_targets, sizeof(Atom) * std_length); + XtFree((char *) std_targets); *type = XA_ATOM; *format = 32; return True; } - - #if OPT_WIDE_CHARS if (screen->wide_chars && *target == XA_STRING) { return @@ -2189,8 +2488,8 @@ XStringStyle); } if (screen->wide_chars && *target == XA_UTF8_STRING(d)) { - return - _ConvertSelectionHelper(w, + return + _ConvertSelectionHelper(w, type, value, length, format, Xutf8TextListToTextProperty, XUTF8StringStyle); @@ -2211,10 +2510,10 @@ } #endif - if (*target == XA_STRING) { /* not wide_chars */ + if (*target == XA_STRING) { /* not wide_chars */ /* We can only reach this point if the selection requestor requested STRING before any of TEXT, COMPOUND_TEXT or - UTF8_STRING. We therefore assume that the requestor is not + UTF8_STRING. We therefore assume that the requestor is not properly internationalised, and dump raw eight-bit data with no conversion into the selection. Yes, this breaks the ICCCM in non-Latin-1 locales. */ @@ -2225,7 +2524,7 @@ return True; } - if (*target == XA_TEXT(d)) { /* not wide_chars */ + if (*target == XA_TEXT(d)) { /* not wide_chars */ return _ConvertSelectionHelper(w, type, value, length, format, @@ -2233,16 +2532,15 @@ XStdICCTextStyle); } - if (*target == XA_COMPOUND_TEXT(d)) { /* not wide_chars */ + if (*target == XA_COMPOUND_TEXT(d)) { /* not wide_chars */ return _ConvertSelectionHelper(w, type, value, length, format, XmbTextListToTextProperty, XCompoundTextStyle); } - #ifdef X_HAVE_UTF8_STRING - if (*target == XA_UTF8_STRING(d)) { /* not wide_chars */ + if (*target == XA_UTF8_STRING(d)) { /* not wide_chars */ return _ConvertSelectionHelper(w, type, value, length, format, @@ -2254,10 +2552,10 @@ if (*target == XA_LIST_LENGTH(d)) { *value = XtMalloc(4); if (sizeof(long) == 4) - *(long*)*value = 1; + *(long *) *value = 1; else { long temp = 1; - memcpy ( (char*)*value, ((char*)&temp)+sizeof(long)-4, 4); + memcpy((char *) *value, ((char *) &temp) + sizeof(long) - 4, 4); } *type = XA_INTEGER; *length = 1; @@ -2269,10 +2567,10 @@ /* This value is wrong if we have UTF-8 text */ *value = XtMalloc(4); if (sizeof(long) == 4) - *(long*)*value = screen->selection_length; + *(long *) *value = screen->selection_length; else { long temp = screen->selection_length; - memcpy ( (char*)*value, ((char*)&temp)+sizeof(long)-4, 4); + memcpy((char *) *value, ((char *) &temp) + sizeof(long) - 4, 4); } *type = XA_INTEGER; *length = 1; @@ -2281,7 +2579,7 @@ } if (XmuConvertStandardSelection(w, screen->selection_time, selection, - target, type, (XPointer *)value, + target, type, (XPointer *) value, length, format)) return True; @@ -2289,43 +2587,43 @@ return False; } - static void -LoseSelection(Widget w, Atom *selection) +LoseSelection(Widget w, Atom * selection) { - register TScreen* screen; - register Atom* atomP; + TScreen *screen; + Atom *atomP; Cardinal i; if (!IsXtermWidget(w)) return; - screen = &((XtermWidget)w)->screen; + screen = &((XtermWidget) w)->screen; for (i = 0, atomP = screen->selection_atoms; - i < screen->selection_count; i++, atomP++) - { - if (*selection == *atomP) *atomP = (Atom)0; + i < screen->selection_count; i++, atomP++) { + if (*selection == *atomP) + *atomP = (Atom) 0; switch (*atomP) { - case XA_CUT_BUFFER0: - case XA_CUT_BUFFER1: - case XA_CUT_BUFFER2: - case XA_CUT_BUFFER3: - case XA_CUT_BUFFER4: - case XA_CUT_BUFFER5: - case XA_CUT_BUFFER6: - case XA_CUT_BUFFER7: *atomP = (Atom)0; + case XA_CUT_BUFFER0: + case XA_CUT_BUFFER1: + case XA_CUT_BUFFER2: + case XA_CUT_BUFFER3: + case XA_CUT_BUFFER4: + case XA_CUT_BUFFER5: + case XA_CUT_BUFFER6: + case XA_CUT_BUFFER7: + *atomP = (Atom) 0; } } for (i = screen->selection_count; i; i--) { - if (screen->selection_atoms[i-1] != 0) break; + if (screen->selection_atoms[i - 1] != 0) + break; } screen->selection_count = i; for (i = 0, atomP = screen->selection_atoms; - i < screen->selection_count; i++, atomP++) - { - if (*atomP == (Atom)0) { + i < screen->selection_count; i++, atomP++) { + if (*atomP == (Atom) 0) { *atomP = screen->selection_atoms[--screen->selection_count]; } } @@ -2334,52 +2632,67 @@ TrackText(0, 0, 0, 0); } - /* ARGSUSED */ -static void SelectionDone( - Widget w GCC_UNUSED, - Atom *selection GCC_UNUSED, - Atom *target GCC_UNUSED) +static void +SelectionDone(Widget w GCC_UNUSED, + Atom * selection GCC_UNUSED, + Atom * target GCC_UNUSED) { /* empty proc so Intrinsics know we want to keep storage */ } - static void -_OwnSelection( - register XtermWidget termw, - String *selections, - Cardinal count) +_OwnSelection(XtermWidget termw, + String * selections, + Cardinal count) { - Atom* atoms = termw->screen.selection_atoms; + Atom *atoms = termw->screen.selection_atoms; Cardinal i; Boolean have_selection = False; - if (termw->screen.selection_length < 0) return; + if (termw->screen.selection_length < 0) + return; if (count > termw->screen.sel_atoms_size) { - XtFree((char*)atoms); - atoms = (Atom*)XtMalloc(count*sizeof(Atom)); + XtFree((char *) atoms); + atoms = (Atom *) XtMalloc(count * sizeof(Atom)); termw->screen.selection_atoms = atoms; termw->screen.sel_atoms_size = count; } - XmuInternStrings( XtDisplay((Widget)termw), selections, count, atoms ); + XmuInternStrings(XtDisplay((Widget) termw), selections, count, atoms); for (i = 0; i < count; i++) { int cutbuffer; switch (atoms[i]) { - case XA_CUT_BUFFER0: cutbuffer = 0; break; - case XA_CUT_BUFFER1: cutbuffer = 1; break; - case XA_CUT_BUFFER2: cutbuffer = 2; break; - case XA_CUT_BUFFER3: cutbuffer = 3; break; - case XA_CUT_BUFFER4: cutbuffer = 4; break; - case XA_CUT_BUFFER5: cutbuffer = 5; break; - case XA_CUT_BUFFER6: cutbuffer = 6; break; - case XA_CUT_BUFFER7: cutbuffer = 7; break; - default: cutbuffer = -1; + case XA_CUT_BUFFER0: + cutbuffer = 0; + break; + case XA_CUT_BUFFER1: + cutbuffer = 1; + break; + case XA_CUT_BUFFER2: + cutbuffer = 2; + break; + case XA_CUT_BUFFER3: + cutbuffer = 3; + break; + case XA_CUT_BUFFER4: + cutbuffer = 4; + break; + case XA_CUT_BUFFER5: + cutbuffer = 5; + break; + case XA_CUT_BUFFER6: + cutbuffer = 6; + break; + case XA_CUT_BUFFER7: + cutbuffer = 7; + break; + default: + cutbuffer = -1; } if (cutbuffer >= 0) { - if ( termw->screen.selection_length > - 4*XMaxRequestSize(XtDisplay((Widget)termw))-32) { + if (termw->screen.selection_length > + 4 * XMaxRequestSize(XtDisplay((Widget) termw)) - 32) { fprintf(stderr, "%s: selection too big (%d bytes), not storing in CUT_BUFFER%d\n", xterm_name, termw->screen.selection_length, cutbuffer); @@ -2390,18 +2703,18 @@ * Robert Brady, 2000-09-05 */ unsigned long length = termw->screen.selection_length; - Char *data = (Char *)termw->screen.selection_data; + Char *data = (Char *) termw->screen.selection_data; if_OPT_WIDE_CHARS((&(termw->screen)), { data = UTF8toLatin1(data, length, &length); - }) - XStoreBuffer( XtDisplay((Widget)termw), - (char *)data, length, cutbuffer ); + }); + XStoreBuffer(XtDisplay((Widget) termw), + (char *) data, length, cutbuffer); } } else if (!replyToEmacs) { have_selection |= - XtOwnSelection( (Widget)termw, atoms[i], - termw->screen.selection_time, - ConvertSelection, LoseSelection, SelectionDone ); + XtOwnSelection((Widget) termw, atoms[i], + termw->screen.selection_time, + ConvertSelection, LoseSelection, SelectionDone); } } if (!replyToEmacs) @@ -2411,60 +2724,74 @@ } void -DisownSelection(register XtermWidget termw) +DisownSelection(XtermWidget termw) { - Atom* atoms = termw->screen.selection_atoms; + Atom *atoms = termw->screen.selection_atoms; Cardinal count = termw->screen.selection_count; Cardinal i; for (i = 0; i < count; i++) { int cutbuffer; switch (atoms[i]) { - case XA_CUT_BUFFER0: cutbuffer = 0; break; - case XA_CUT_BUFFER1: cutbuffer = 1; break; - case XA_CUT_BUFFER2: cutbuffer = 2; break; - case XA_CUT_BUFFER3: cutbuffer = 3; break; - case XA_CUT_BUFFER4: cutbuffer = 4; break; - case XA_CUT_BUFFER5: cutbuffer = 5; break; - case XA_CUT_BUFFER6: cutbuffer = 6; break; - case XA_CUT_BUFFER7: cutbuffer = 7; break; - default: cutbuffer = -1; + case XA_CUT_BUFFER0: + cutbuffer = 0; + break; + case XA_CUT_BUFFER1: + cutbuffer = 1; + break; + case XA_CUT_BUFFER2: + cutbuffer = 2; + break; + case XA_CUT_BUFFER3: + cutbuffer = 3; + break; + case XA_CUT_BUFFER4: + cutbuffer = 4; + break; + case XA_CUT_BUFFER5: + cutbuffer = 5; + break; + case XA_CUT_BUFFER6: + cutbuffer = 6; + break; + case XA_CUT_BUFFER7: + cutbuffer = 7; + break; + default: + cutbuffer = -1; } if (cutbuffer < 0) - XtDisownSelection( (Widget)termw, atoms[i], - termw->screen.selection_time ); + XtDisownSelection((Widget) termw, atoms[i], + termw->screen.selection_time); } termw->screen.selection_count = 0; termw->screen.startHRow = termw->screen.startHCol = 0; termw->screen.endHRow = termw->screen.endHCol = 0; } - /* returns number of chars in line from scol to ecol out */ /* ARGSUSED */ static int -Length( - register TScreen *screen GCC_UNUSED, - register int row, - register int scol, - register int ecol) -{ - register int lastcol = LastTextCol(row); - - if (ecol > lastcol) - ecol = lastcol; - return (ecol - scol + 1); +Length(TScreen * screen GCC_UNUSED, + int row, + int scol, + int ecol) +{ + int lastcol = LastTextCol(row); + + if (ecol > lastcol) + ecol = lastcol; + return (ecol - scol + 1); } /* copies text into line, preallocated */ static Char * -SaveText( - TScreen *screen, - int row, - int scol, - int ecol, - register Char *lp, /* pointer to where to put the text */ - int *eol) +SaveText(TScreen * screen, + int row, + int scol, + int ecol, + Char * lp, /* pointer to where to put the text */ + int *eol) { int i = 0; unsigned c; @@ -2513,8 +2840,7 @@ if (c_2) lp = convertToUTF8(lp, c_2); } - } - else + } else #endif { if (c == 0) { @@ -2540,153 +2866,153 @@ if (!*eol || !screen->trim_selection) result = lp; - return(result); + return (result); } static int -BtnCode(XButtonEvent *event, int button) +BtnCode(XButtonEvent * event, int button) { - int result = 32 + (KeyState(event->state) << 2); + int result = 32 + (KeyState(event->state) << 2); - if (button < 0 || button > 5) { - result += 3; - } else { - if (button > 3) - result += (64 - 4); - if (event->type == MotionNotify) - result += 32; - result += button; - } - return result; + if (button < 0 || button > 5) { + result += 3; + } else { + if (button > 3) + result += (64 - 4); + if (event->type == MotionNotify) + result += 32; + result += button; + } + return result; } #define MOUSE_LIMIT (255 - 32) static void -EditorButton(register XButtonEvent *event) +EditorButton(XButtonEvent * event) { - TScreen *screen = &term->screen; - int pty = screen->respond; - Char line[6]; - int row, col; - int button, count = 0; - - /* If button event, get button # adjusted for DEC compatibility */ - button = event->button - 1; - if (button >= 3) button++; - - /* Compute character position of mouse pointer */ - row = (event->y - screen->border) / FontHeight(screen); - col = (event->x - OriginX(screen)) / FontWidth(screen); - - /* Limit to screen dimensions */ - if (row < 0) - row = 0; - else if (row > screen->max_row) - row = screen->max_row; - else if (row > MOUSE_LIMIT) - row = MOUSE_LIMIT; - - if (col < 0) - col = 0; - else if (col > screen->max_col) - col = screen->max_col; - else if (col > MOUSE_LIMIT) - col = MOUSE_LIMIT; - - /* Build key sequence starting with \E[M */ - if (screen->control_eight_bits) { - line[count++] = CSI; - } else { - line[count++] = ESC; - line[count++] = '['; - } - line[count++] = 'M'; + TScreen *screen = &term->screen; + int pty = screen->respond; + Char line[6]; + int row, col; + int button, count = 0; + + /* If button event, get button # adjusted for DEC compatibility */ + button = event->button - 1; + if (button >= 3) + button++; + + /* Compute character position of mouse pointer */ + row = (event->y - screen->border) / FontHeight(screen); + col = (event->x - OriginX(screen)) / FontWidth(screen); + + /* Limit to screen dimensions */ + if (row < 0) + row = 0; + else if (row > screen->max_row) + row = screen->max_row; + else if (row > MOUSE_LIMIT) + row = MOUSE_LIMIT; + + if (col < 0) + col = 0; + else if (col > screen->max_col) + col = screen->max_col; + else if (col > MOUSE_LIMIT) + col = MOUSE_LIMIT; + + /* Build key sequence starting with \E[M */ + if (screen->control_eight_bits) { + line[count++] = CSI; + } else { + line[count++] = ESC; + line[count++] = '['; + } + line[count++] = 'M'; - /* Add event code to key sequence */ - if (screen->send_mouse_pos == X10_MOUSE) { - line[count++] = ' ' + button; - } - else - { - /* Button-Motion events */ - switch(event->type) - { - case ButtonPress: - line[count++] = BtnCode(event, screen->mouse_button = button); - break; - case ButtonRelease: - /* - * Wheel mouse interface generates release-events for buttons - * 4 and 5, coded here as 3 and 4 respectively. We change the - * release for buttons 1..3 to a -1. - */ - if (button < 3) - button = -1; - line[count++] = BtnCode(event, screen->mouse_button = button); - break; - case MotionNotify: - /* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion - * events only if character cell has changed. - */ - if ((row == screen->mouse_row) - && (col == screen->mouse_col)) - return; - line[count++] = BtnCode(event, screen->mouse_button); - break; - default: + /* Add event code to key sequence */ + if (screen->send_mouse_pos == X10_MOUSE) { + line[count++] = ' ' + button; + } else { + /* Button-Motion events */ + switch (event->type) { + case ButtonPress: + line[count++] = BtnCode(event, screen->mouse_button = button); + break; + case ButtonRelease: + /* + * Wheel mouse interface generates release-events for buttons + * 4 and 5, coded here as 3 and 4 respectively. We change the + * release for buttons 1..3 to a -1. + */ + if (button < 3) + button = -1; + line[count++] = BtnCode(event, screen->mouse_button = button); + break; + case MotionNotify: + /* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion + * events only if character cell has changed. + */ + if ((row == screen->mouse_row) + && (col == screen->mouse_col)) return; - } + line[count++] = BtnCode(event, screen->mouse_button); + break; + default: + return; } + } - screen->mouse_row = row; - screen->mouse_col = col; + screen->mouse_row = row; + screen->mouse_col = col; - /* Add pointer position to key sequence */ - line[count++] = ' ' + col + 1; - line[count++] = ' ' + row + 1; + /* Add pointer position to key sequence */ + line[count++] = ' ' + col + 1; + line[count++] = ' ' + row + 1; - TRACE(("mouse at %d,%d button+mask = %#x\n", row, col, - (screen->control_eight_bits) ? line[2] : line[3])); + TRACE(("mouse at %d,%d button+mask = %#x\n", row, col, + (screen->control_eight_bits) ? line[2] : line[3])); - /* Transmit key sequence to process running under xterm */ - v_write(pty, line, count); + /* Transmit key sequence to process running under xterm */ + v_write(pty, line, count); } - /*ARGSUSED*/ #if OPT_TEK4014 -void HandleGINInput ( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *param_list, - Cardinal *nparamsp) +void +HandleGINInput(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * param_list, + Cardinal * nparamsp) { if (term->screen.TekGIN && *nparamsp == 1) { int c = param_list[0][0]; switch (c) { - case 'l': case 'm': case 'r': - case 'L': case 'M': case 'R': + case 'l': + case 'm': + case 'r': + case 'L': + case 'M': + case 'R': break; - default: - Bell (XkbBI_MinorError,0); /* let them know they goofed */ - c = 'l'; /* provide a default */ + default: + Bell(XkbBI_MinorError, 0); /* let them know they goofed */ + c = 'l'; /* provide a default */ } - TekEnqMouse (c | 0x80); + TekEnqMouse(c | 0x80); TekGINoff(); } else { - Bell (XkbBI_MinorError,0); + Bell(XkbBI_MinorError, 0); } } #endif /* OPT_TEK4014 */ - /* ARGSUSED */ -void HandleSecure( - Widget w GCC_UNUSED, - XEvent *event, /* unused */ - String *params GCC_UNUSED, /* [0] = volume */ - Cardinal *param_count GCC_UNUSED) /* 0 or 1 */ +void +HandleSecure(Widget w GCC_UNUSED, + XEvent * event, /* unused */ + String * params GCC_UNUSED, /* [0] = volume */ + Cardinal * param_count GCC_UNUSED) /* 0 or 1 */ { Time ev_time = CurrentTime; @@ -2696,5 +3022,5 @@ else if ((event->xany.type == ButtonPress) || (event->xany.type == ButtonRelease)) ev_time = event->xbutton.time; - DoSecureKeyboard (ev_time); + DoSecureKeyboard(ev_time); } Index: xc/programs/xterm/charclass.c diff -u xc/programs/xterm/charclass.c:1.2 xc/programs/xterm/charclass.c:1.3 --- xc/programs/xterm/charclass.c:1.2 Wed Dec 27 19:51:50 2000 +++ xc/programs/xterm/charclass.c Sun Apr 28 15:04:19 2002 @@ -20,7 +20,7 @@ * but merging in new intervals is significantly more hassle and * not worth the effort here. */ -/* $XFree86: xc/programs/xterm/charclass.c,v 1.2 2000/12/28 00:51:50 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/charclass.c,v 1.3 2002/04/28 19:04:19 dickey Exp $ */ #include <xterm.h> #include <charclass.h> @@ -28,9 +28,9 @@ #if OPT_WIDE_CHARS struct classentry { - int class; - int first; - int last; + int class; + int first; + int last; } *classtab; /* @@ -40,99 +40,102 @@ * - classtab[0].last is the last used entry in classtab */ -int SetCharacterClassRange(int low, int high, int value) +int +SetCharacterClassRange(int low, int high, int value) { - if (high < low) - return -1; /* nothing to do */ + if (high < low) + return -1; /* nothing to do */ - /* make sure we have at least one free entry left at table end */ - if (classtab[0].last > classtab[0].class - 2) { - classtab[0].class += 5 + classtab[0].class/4; - classtab = realloc(classtab, - classtab[0].class * sizeof(struct classentry)); - if (!classtab) - abort(); - } - - /* simply append new interval to end of interval array */ - classtab[0].last++; - classtab[classtab[0].last].first = low; - classtab[classtab[0].last].last = high; - classtab[classtab[0].last].class = value; + /* make sure we have at least one free entry left at table end */ + if (classtab[0].last > classtab[0].class - 2) { + classtab[0].class += 5 + classtab[0].class / 4; + classtab = realloc(classtab, + classtab[0].class * sizeof(struct classentry)); + if (!classtab) + abort(); + } + + /* simply append new interval to end of interval array */ + classtab[0].last++; + classtab[classtab[0].last].first = low; + classtab[classtab[0].last].last = high; + classtab[classtab[0].last].class = value; - return 0; + return 0; } -void init_classtab(void) +void +init_classtab(void) { - const int size = 50; + const int size = 50; - classtab = (struct classentry *) malloc(size * sizeof(struct classentry)); - if (!classtab) - abort(); - classtab[0].class = size; - classtab[0].first = 1; - classtab[0].last = 0; - - /* old xterm default classes */ - SetCharacterClassRange(0, 0, 32); - SetCharacterClassRange(1, 31, 1); - SetCharacterClassRange('\t', '\t', 32); - SetCharacterClassRange('0', '9', 48); - SetCharacterClassRange('A', 'Z', 48); - SetCharacterClassRange('_', '_', 48); - SetCharacterClassRange('a', 'z', 48); - SetCharacterClassRange(127, 159, 1); - SetCharacterClassRange(160, 191, -1); - SetCharacterClassRange(192, 255, 48); - SetCharacterClassRange(215, 215, 216); - SetCharacterClassRange(247, 247, 248); - - /* added Unicode classes */ - SetCharacterClassRange(0x0100, 0xffdf, 48); /* mostly characters */ - SetCharacterClassRange(0x037e, 0x037e, -1); /* Greek question mark */ - SetCharacterClassRange(0x0387, 0x0387, -1); /* Greek ano teleia */ - SetCharacterClassRange(0x055a, 0x055f, -1); /* Armenian punctuation */ - SetCharacterClassRange(0x0589, 0x0589, -1); /* Armenian full stop */ - SetCharacterClassRange(0x0700, 0x070d, -1); /* Syriac punctuation */ - SetCharacterClassRange(0x104a, 0x104f, -1); /* Myanmar punctuation */ - SetCharacterClassRange(0x10fb, 0x10fb, -1); /* Georgian punctuation */ - SetCharacterClassRange(0x1361, 0x1368, -1); /* Ethiopic punctuation */ - SetCharacterClassRange(0x166d, 0x166e, -1); /* Canadian Syl. punctuation */ - SetCharacterClassRange(0x17d4, 0x17dc, -1); /* Khmer punctuation */ - SetCharacterClassRange(0x1800, 0x180a, -1); /* Mongolian punctuation */ - SetCharacterClassRange(0x2000, 0x200a, 32); /* spaces */ - SetCharacterClassRange(0x200b, 0x27ff, -1); /* punctuation and symbols */ - SetCharacterClassRange(0x2070, 0x207f, 0x2070); /* superscript */ - SetCharacterClassRange(0x2080, 0x208f, 0x2080); /* subscript */ - SetCharacterClassRange(0x3000, 0x3000, 32); /* ideographic space */ - SetCharacterClassRange(0x3001, 0x3020, -1); /* ideographic punctuation */ - SetCharacterClassRange(0x3040, 0x309f, 0x3040); /* Hiragana */ - SetCharacterClassRange(0x30a0, 0x30ff, 0x30a0); /* Katakana */ - SetCharacterClassRange(0x3300, 0x9fff, 0x4e00); /* CJK Ideographs */ - SetCharacterClassRange(0xac00, 0xd7a3, 0xac00); /* Hangul Syllables */ - SetCharacterClassRange(0xf900, 0xfaff, 0x4e00); /* CJK Ideographs */ - SetCharacterClassRange(0xfe30, 0xfe6b, -1); /* punctuation forms */ - SetCharacterClassRange(0xff00, 0xff0f, -1); /* half/fullwidth ASCII */ - SetCharacterClassRange(0xff1a, 0xff20, -1); /* half/fullwidth ASCII */ - SetCharacterClassRange(0xff3b, 0xff40, -1); /* half/fullwidth ASCII */ - SetCharacterClassRange(0xff5b, 0xff64, -1); /* half/fullwidth ASCII */ + classtab = (struct classentry *) malloc(size * sizeof(struct classentry)); + if (!classtab) + abort(); + classtab[0].class = size; + classtab[0].first = 1; + classtab[0].last = 0; + + /* old xterm default classes */ + SetCharacterClassRange(0, 0, 32); + SetCharacterClassRange(1, 31, 1); + SetCharacterClassRange('\t', '\t', 32); + SetCharacterClassRange('0', '9', 48); + SetCharacterClassRange('A', 'Z', 48); + SetCharacterClassRange('_', '_', 48); + SetCharacterClassRange('a', 'z', 48); + SetCharacterClassRange(127, 159, 1); + SetCharacterClassRange(160, 191, -1); + SetCharacterClassRange(192, 255, 48); + SetCharacterClassRange(215, 215, 216); + SetCharacterClassRange(247, 247, 248); + + /* added Unicode classes */ + SetCharacterClassRange(0x0100, 0xffdf, 48); /* mostly characters */ + SetCharacterClassRange(0x037e, 0x037e, -1); /* Greek question mark */ + SetCharacterClassRange(0x0387, 0x0387, -1); /* Greek ano teleia */ + SetCharacterClassRange(0x055a, 0x055f, -1); /* Armenian punctuation */ + SetCharacterClassRange(0x0589, 0x0589, -1); /* Armenian full stop */ + SetCharacterClassRange(0x0700, 0x070d, -1); /* Syriac punctuation */ + SetCharacterClassRange(0x104a, 0x104f, -1); /* Myanmar punctuation */ + SetCharacterClassRange(0x10fb, 0x10fb, -1); /* Georgian punctuation */ + SetCharacterClassRange(0x1361, 0x1368, -1); /* Ethiopic punctuation */ + SetCharacterClassRange(0x166d, 0x166e, -1); /* Canadian Syl. punctuation */ + SetCharacterClassRange(0x17d4, 0x17dc, -1); /* Khmer punctuation */ + SetCharacterClassRange(0x1800, 0x180a, -1); /* Mongolian punctuation */ + SetCharacterClassRange(0x2000, 0x200a, 32); /* spaces */ + SetCharacterClassRange(0x200b, 0x27ff, -1); /* punctuation and symbols */ + SetCharacterClassRange(0x2070, 0x207f, 0x2070); /* superscript */ + SetCharacterClassRange(0x2080, 0x208f, 0x2080); /* subscript */ + SetCharacterClassRange(0x3000, 0x3000, 32); /* ideographic space */ + SetCharacterClassRange(0x3001, 0x3020, -1); /* ideographic punctuation */ + SetCharacterClassRange(0x3040, 0x309f, 0x3040); /* Hiragana */ + SetCharacterClassRange(0x30a0, 0x30ff, 0x30a0); /* Katakana */ + SetCharacterClassRange(0x3300, 0x9fff, 0x4e00); /* CJK Ideographs */ + SetCharacterClassRange(0xac00, 0xd7a3, 0xac00); /* Hangul Syllables */ + SetCharacterClassRange(0xf900, 0xfaff, 0x4e00); /* CJK Ideographs */ + SetCharacterClassRange(0xfe30, 0xfe6b, -1); /* punctuation forms */ + SetCharacterClassRange(0xff00, 0xff0f, -1); /* half/fullwidth ASCII */ + SetCharacterClassRange(0xff1a, 0xff20, -1); /* half/fullwidth ASCII */ + SetCharacterClassRange(0xff3b, 0xff40, -1); /* half/fullwidth ASCII */ + SetCharacterClassRange(0xff5b, 0xff64, -1); /* half/fullwidth ASCII */ - return; + return; } -int CharacterClass(int c) +int +CharacterClass(int c) { - int i, class = -1; + int i, class = -1; + + for (i = classtab[0].first; i <= classtab[0].last; i++) + if (classtab[i].first <= c && classtab[i].last >= c) + class = classtab[i].class; + + if (class < 0) + class = c; - for (i = classtab[0].first; i <= classtab[0].last; i++) - if (classtab[i].first <= c && classtab[i].last >= c) - class = classtab[i].class; - - if (class < 0) - class = c; - - return class; + return class; } #endif Index: xc/programs/xterm/charproc.c diff -u xc/programs/xterm/charproc.c:3.128 xc/programs/xterm/charproc.c:3.139 --- xc/programs/xterm/charproc.c:3.128 Mon Jan 7 16:02:44 2002 +++ xc/programs/xterm/charproc.c Tue Feb 25 18:36:55 2003 @@ -2,11 +2,11 @@ * $Xorg: charproc.c,v 1.6 2001/02/09 02:06:02 xorgcvs Exp $ */ -/* $XFree86: xc/programs/xterm/charproc.c,v 3.128 2002/01/07 21:02:44 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/charproc.c,v 3.139 2003/02/25 23:36:55 dickey Exp $ */ /* -Copyright 1999, 2000, 2001, 2002 by Thomas E. Dickey +Copyright 1999-2002,2003 by Thomas E. Dickey All Rights Reserved @@ -34,7 +34,6 @@ sale, use or other dealings in this Software without prior written authorization. - Copyright 1988 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -89,14 +88,20 @@ #include <X11/Xatom.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> #include <X11/Xmu/Atoms.h> #include <X11/Xmu/CharSet.h> #include <X11/Xmu/Converters.h> #if OPT_INPUT_METHOD + +#if defined(HAVE_LIB_XAW) #include <X11/Xaw/XawImP.h> +#elif defined(HAVE_LIB_XAW3D) +#include <X11/Xaw3d/XawImP.h> +#elif defined(HAVE_LIB_NEXTAW) +#include <X11/neXtaw/XawImP.h> +#endif + #endif #if OPT_WIDE_CHARS @@ -111,14 +116,6 @@ #include <stdio.h> #include <ctype.h> -#ifdef MINIX -#include <sys/nbio.h> - -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#define read(f,b,s) nbio_read(f,b,s) -#define write(f,b,s) nbio_write(f,b,s) -#endif - #include <VTparse.h> #include <data.h> #include <error.h> @@ -127,48 +124,51 @@ #include <fontutils.h> #include <xcharmouse.h> #include <charclass.h> +#include <xstrings.h> #if OPT_ZICONBEEP || OPT_TOOLBAR #define HANDLE_STRUCT_NOTIFY 1 +#else +#define HANDLE_STRUCT_NOTIFY 0 #endif -extern char *ProgramName; +static IChar in_put(void); +static int set_character_class(char *s); +static void FromAlternate(TScreen * screen); +static void RequestResize(XtermWidget termw, int rows, int cols, int text); +static void SwitchBufs(TScreen * screen); +static void ToAlternate(TScreen * screen); +static void VTallocbuf(void); +static void WriteText(TScreen * screen, PAIRED_CHARS(Char * str, Char * + str2), Cardinal len); +static void ansi_modes(XtermWidget termw, + void (*func) (unsigned *p, unsigned mask)); +static void bitclr(unsigned *p, unsigned mask); +static void bitcpy(unsigned *p, unsigned q, unsigned mask); +static void bitset(unsigned *p, unsigned mask); +static void dpmodes(XtermWidget termw, void (*func) (unsigned *p, unsigned mask)); +static void restoremodes(XtermWidget termw); +static void savemodes(XtermWidget termw); +static void unparseputn(unsigned int n, int fd); +static void window_ops(XtermWidget termw); -static IChar in_put (void); -static int set_character_class (char *s); -static void FromAlternate (TScreen *screen); -static void RequestResize (XtermWidget termw, int rows, int cols, int text); -static void SwitchBufs (TScreen *screen); -static void ToAlternate (TScreen *screen); -static void VTallocbuf (void); -static void WriteText (TScreen *screen, PAIRED_CHARS(Char *str, Char *str2), Cardinal len); -static void ansi_modes (XtermWidget termw, void (*func)(unsigned *p, unsigned mask)); -static void bitclr (unsigned *p, unsigned mask); -static void bitcpy (unsigned *p, unsigned q, unsigned mask); -static void bitset (unsigned *p, unsigned mask); -static void dpmodes (XtermWidget termw, void (*func)(unsigned *p, unsigned mask)); -static void restoremodes (XtermWidget termw); -static void savemodes (XtermWidget termw); -static void unparseputn (unsigned int n, int fd); -static void window_ops (XtermWidget termw); - #if OPT_BLINK_CURS -static void BlinkCursor ( XtPointer closure, XtIntervalId* id); -static void StartBlinking (TScreen *screen); -static void StopBlinking (TScreen *screen); +static void BlinkCursor(XtPointer closure, XtIntervalId * id); +static void StartBlinking(TScreen * screen); +static void StopBlinking(TScreen * screen); #else -#define StartBlinking(screen) /* nothing */ -#define StopBlinking(screen) /* nothing */ +#define StartBlinking(screen) /* nothing */ +#define StopBlinking(screen) /* nothing */ #endif #if OPT_INPUT_METHOD -static void PreeditPosition(TScreen *screen); +static void PreeditPosition(TScreen * screen); #endif #define DEFAULT -1 #define BELLSUPPRESSMSEC 200 -#define doinput() (morePtyData(&VTbuffer) ? nextPtyData(&VTbuffer) : in_put()) +#define doinput() (morePtyData(&VTbuffer) ? nextPtyData(&VTbuffer) : in_put()) static int nparam; static ANSI reply; @@ -182,12 +182,12 @@ static jmp_buf vtjmpbuf; /* event handlers */ -static void HandleBell PROTO_XT_ACTIONS_ARGS; -static void HandleIgnore PROTO_XT_ACTIONS_ARGS; -static void HandleKeymapChange PROTO_XT_ACTIONS_ARGS; -static void HandleVisualBell PROTO_XT_ACTIONS_ARGS; +static void HandleBell PROTO_XT_ACTIONS_ARGS; +static void HandleIgnore PROTO_XT_ACTIONS_ARGS; +static void HandleKeymapChange PROTO_XT_ACTIONS_ARGS; +static void HandleVisualBell PROTO_XT_ACTIONS_ARGS; #if HANDLE_STRUCT_NOTIFY -static void HandleStructNotify PROTO_XT_EV_HANDLER_ARGS; +static void HandleStructNotify PROTO_XT_EV_HANDLER_ARGS; #endif /* @@ -209,7 +209,7 @@ #endif #endif -static char * _Font_Selected_ = "yes"; /* string is arbitrary */ +static char *_Font_Selected_ = "yes"; /* string is arbitrary */ static char defaultTranslations[] = "\ @@ -259,8 +259,8 @@ <Btn5Down>:scroll-forw(5,line,m) \n\ <BtnUp>:select-end(PRIMARY, CUT_BUFFER0) \n\ <BtnDown>:bell(0) \ -"; /* PROCURA added "Meta <Btn2Down>:clear-saved-lines()" */ - +"; /* PROCURA added "Meta <Btn2Down>:clear-saved-lines()" */ +/* *INDENT-OFF* */ static XtActionsRec actionsList[] = { { "allow-send-events", HandleAllowSends }, { "bell", HandleBell }, @@ -276,7 +276,8 @@ { "interpret", HandleInterpret }, { "keymap", HandleKeymapChange }, { "popup-menu", HandlePopupMenu }, - { "print", HandlePrint }, + { "print", HandlePrintScreen }, + { "print-redir", HandlePrintControlMode }, { "quit", HandleQuit }, { "redraw", HandleRedraw }, { "delete-is-del", HandleDeleteIsDEL }, @@ -347,6 +348,9 @@ { "meta-sends-escape", HandleMetaEsc }, { "set-num-lock", HandleNumLock }, #endif +#if OPT_READLINE + { "readline-button", ReadLineButton }, +#endif #if OPT_SCO_FUNC_KEYS { "set-sco-function-keys", HandleScoFunctionKeys }, #endif @@ -363,165 +367,173 @@ { "tek-copy", HandleTekCopy }, #endif }; +/* *INDENT-ON* */ #ifdef VMS #define OS_DEPENDENT_PRINT_COMMAND "print/delete/noflag" -#else /* VMS */ +#else /* VMS */ #define OS_DEPENDENT_PRINT_COMMAND "lpr" #endif /* VMS */ -static XtResource resources[] = { -Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvents, FALSE), -Bres(XtNalwaysHighlight, XtCAlwaysHighlight, screen.always_highlight, FALSE), -Bres(XtNappcursorDefault, XtCAppcursorDefault, misc.appcursorDefault, FALSE), -Bres(XtNappkeypadDefault, XtCAppkeypadDefault, misc.appkeypadDefault, FALSE), -Bres(XtNautoWrap, XtCAutoWrap, misc.autoWrap, TRUE), -Bres(XtNawaitInput, XtCAwaitInput, screen.awaitInput, FALSE), -Bres(XtNfreeBoldBox, XtCBoolean, screen.free_bold_box, FALSE), -Bres(XtNforceBoxChars, XtCBoolean, screen.force_box_chars, FALSE), -Bres(XtNbackarrowKey, XtCBackarrowKey, screen.backarrow_key, TRUE), -Bres(XtNboldMode, XtCBoldMode, screen.bold_mode, TRUE), -Bres(XtNbrokenSelections, XtCBrokenSelections, screen.brokenSelections, FALSE), -Bres(XtNc132, XtCC132, screen.c132, FALSE), -Bres(XtNcurses, XtCCurses, screen.curses, FALSE), -Bres(XtNcutNewline, XtCCutNewline, screen.cutNewline, TRUE), -Bres(XtNcutToBeginningOfLine, XtCCutToBeginningOfLine, screen.cutToBeginningOfLine, TRUE), -Bres(XtNdeleteIsDEL, XtCDeleteIsDEL, screen.delete_is_del, 2), -Bres(XtNdynamicColors, XtCDynamicColors, misc.dynamicColors, TRUE), -Bres(XtNeightBitControl, XtCEightBitControl, screen.control_eight_bits, FALSE), -Bres(XtNeightBitInput, XtCEightBitInput, screen.input_eight_bits, TRUE), -Bres(XtNeightBitOutput, XtCEightBitOutput, screen.output_eight_bits, TRUE), -Bres(XtNhighlightSelection, XtCHighlightSelection, screen.highlight_selection, FALSE), -Bres(XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, screen.hp_ll_bc, FALSE), -Bres(XtNi18nSelections, XtCI18nSelections, screen.i18nSelections, TRUE), -Bres(XtNjumpScroll, XtCJumpScroll, screen.jumpscroll, TRUE), -Bres(XtNloginShell, XtCLoginShell, misc.login_shell, FALSE), -Bres(XtNmarginBell, XtCMarginBell, screen.marginbell, FALSE), -Bres(XtNmetaSendsEscape, XtCMetaSendsEscape, screen.meta_sends_esc, FALSE), -Bres(XtNmultiScroll, XtCMultiScroll, screen.multiscroll, FALSE), -Bres(XtNoldXtermFKeys, XtCOldXtermFKeys, screen.old_fkeys, FALSE), -Bres(XtNpopOnBell, XtCPopOnBell, screen.poponbell, FALSE), -Bres(XtNprinterAutoClose, XtCPrinterAutoClose, screen.printer_autoclose, FALSE), -Bres(XtNprinterExtent, XtCPrinterExtent, screen.printer_extent, FALSE), -Bres(XtNprinterFormFeed, XtCPrinterFormFeed, screen.printer_formfeed, FALSE), -Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, FALSE), -Bres(XtNreverseWrap, XtCReverseWrap, misc.reverseWrap, FALSE), -Bres(XtNscrollBar, XtCScrollBar, misc.scrollbar, FALSE), -Bres(XtNscrollKey, XtCScrollCond, screen.scrollkey, FALSE), -Bres(XtNscrollTtyOutput, XtCScrollCond, screen.scrollttyoutput, TRUE), -Bres(XtNsignalInhibit, XtCSignalInhibit, misc.signalInhibit, FALSE), -Bres(XtNtiteInhibit, XtCTiteInhibit, misc.titeInhibit, FALSE), -Bres(XtNtiXtraScroll, XtCTiXtraScroll, misc.tiXtraScroll, FALSE), -Bres(XtNtrimSelection, XtCTrimSelection, screen.trim_selection, FALSE), -Bres(XtNunderLine, XtCUnderLine, screen.underline, TRUE), -Bres(XtNvisualBell, XtCVisualBell, screen.visualbell, FALSE), -Cres(XtNcursorColor, XtCCursorColor, screen.cursorcolor, XtDefaultForeground), -Cres(XtNforeground, XtCForeground, screen.foreground, XtDefaultForeground), -Cres(XtNpointerColor, XtCPointerColor,screen.mousecolor, XtDefaultForeground), -Cres(XtNbackground, XtCBackground, core.background_pixel, XtDefaultBackground), -Cres(XtNpointerColorBackground, XtCBackground, screen.mousecolorback, "XtDefaultBackground"), -Ires(XtNbellSuppressTime, XtCBellSuppressTime, screen.bellSuppressTime, BELLSUPPRESSMSEC), -Ires(XtNinternalBorder, XtCBorderWidth, screen.border, DEFBORDER), -Ires(XtNlimitResize, XtCLimitResize, misc.limit_resize, 1), -Ires(XtNmultiClickTime, XtCMultiClickTime, screen.multiClickTime, MULTICLICKTIME), -Ires(XtNnMarginBell, XtCColumn, screen.nmarginbell, N_MARGINBELL), -Ires(XtNprinterControlMode, XtCPrinterControlMode, screen.printer_controlmode, 0), -Ires(XtNsaveLines, XtCSaveLines, screen.savelines, SAVELINES), -Ires(XtNscrollLines, XtCScrollLines, screen.scrolllines, SCROLLLINES), -Sres("font1", "Font1", screen.menu_font_names[fontMenu_font1], NULL), -Sres("font2", "Font2", screen.menu_font_names[fontMenu_font2], NULL), -Sres("font3", "Font3", screen.menu_font_names[fontMenu_font3], NULL), -Sres("font4", "Font4", screen.menu_font_names[fontMenu_font4], NULL), -Sres("font5", "Font5", screen.menu_font_names[fontMenu_font5], NULL), -Sres("font6", "Font6", screen.menu_font_names[fontMenu_font6], NULL), -Sres(XtNanswerbackString, XtCAnswerbackString, screen.answer_back, ""), -Sres(XtNboldFont, XtCBoldFont, misc.f_b, DEFBOLDFONT), -Sres(XtNcharClass, XtCCharClass, screen.charClass, NULL), -Sres(XtNdecTerminalID, XtCDecTerminalID, screen.term_id, DFT_DECID), -Sres(XtNfont, XtCFont, misc.f_n, DEFFONT), -Sres(XtNgeometry, XtCGeometry, misc.geo_metry, NULL), -Sres(XtNkeyboardDialect, XtCKeyboardDialect, screen.keyboard_dialect, DFT_KBD_DIALECT), -Sres(XtNprinterCommand, XtCPrinterCommand, screen.printer_command, OS_DEPENDENT_PRINT_COMMAND), -Sres(XtNtekGeometry, XtCGeometry, misc.T_geometry, NULL), - -{XtNresizeGravity, XtCResizeGravity, XtRGravity, sizeof(XtGravity), - XtOffsetOf(XtermWidgetRec, misc.resizeGravity), - XtRImmediate, (XtPointer) SouthWestGravity}, - -{XtNpointerShape,XtCCursor, XtRCursor, sizeof(Cursor), - XtOffsetOf(XtermWidgetRec, screen.pointer_cursor), - XtRString, (XtPointer) "xterm"}, +static XtResource resources[] = +{ + Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvents, FALSE), + Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOps, TRUE), + Bres(XtNalwaysHighlight, XtCAlwaysHighlight, screen.always_highlight, FALSE), + Bres(XtNappcursorDefault, XtCAppcursorDefault, misc.appcursorDefault, FALSE), + Bres(XtNappkeypadDefault, XtCAppkeypadDefault, misc.appkeypadDefault, FALSE), + Bres(XtNautoWrap, XtCAutoWrap, misc.autoWrap, TRUE), + Bres(XtNawaitInput, XtCAwaitInput, screen.awaitInput, FALSE), + Bres(XtNfreeBoldBox, XtCBoolean, screen.free_bold_box, FALSE), + Bres(XtNforceBoxChars, XtCBoolean, screen.force_box_chars, FALSE), + Bres(XtNbackarrowKey, XtCBackarrowKey, screen.backarrow_key, TRUE), + Bres(XtNboldMode, XtCBoldMode, screen.bold_mode, TRUE), + Bres(XtNbrokenSelections, XtCBrokenSelections, screen.brokenSelections, FALSE), + Bres(XtNc132, XtCC132, screen.c132, FALSE), + Bres(XtNcurses, XtCCurses, screen.curses, FALSE), + Bres(XtNcutNewline, XtCCutNewline, screen.cutNewline, TRUE), + Bres(XtNcutToBeginningOfLine, XtCCutToBeginningOfLine, + screen.cutToBeginningOfLine, TRUE), + Bres(XtNdeleteIsDEL, XtCDeleteIsDEL, screen.delete_is_del, 2), + Bres(XtNdynamicColors, XtCDynamicColors, misc.dynamicColors, TRUE), + Bres(XtNeightBitControl, XtCEightBitControl, screen.control_eight_bits, FALSE), + Bres(XtNeightBitInput, XtCEightBitInput, screen.input_eight_bits, TRUE), + Bres(XtNeightBitOutput, XtCEightBitOutput, screen.output_eight_bits, TRUE), + Bres(XtNhighlightSelection, XtCHighlightSelection, + screen.highlight_selection, FALSE), + Bres(XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, screen.hp_ll_bc, FALSE), + Bres(XtNi18nSelections, XtCI18nSelections, screen.i18nSelections, TRUE), + Bres(XtNjumpScroll, XtCJumpScroll, screen.jumpscroll, TRUE), + Bres(XtNloginShell, XtCLoginShell, misc.login_shell, FALSE), + Bres(XtNmarginBell, XtCMarginBell, screen.marginbell, FALSE), + Bres(XtNmetaSendsEscape, XtCMetaSendsEscape, screen.meta_sends_esc, FALSE), + Bres(XtNmultiScroll, XtCMultiScroll, screen.multiscroll, FALSE), + Bres(XtNoldXtermFKeys, XtCOldXtermFKeys, screen.old_fkeys, FALSE), + Bres(XtNpopOnBell, XtCPopOnBell, screen.poponbell, FALSE), + Bres(XtNprinterAutoClose, XtCPrinterAutoClose, screen.printer_autoclose, FALSE), + Bres(XtNprinterExtent, XtCPrinterExtent, screen.printer_extent, FALSE), + Bres(XtNprinterFormFeed, XtCPrinterFormFeed, screen.printer_formfeed, FALSE), + Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, FALSE), + Bres(XtNreverseWrap, XtCReverseWrap, misc.reverseWrap, FALSE), + Bres(XtNscrollBar, XtCScrollBar, misc.scrollbar, FALSE), + Bres(XtNscrollKey, XtCScrollCond, screen.scrollkey, FALSE), + Bres(XtNscrollTtyOutput, XtCScrollCond, screen.scrollttyoutput, TRUE), + Bres(XtNsignalInhibit, XtCSignalInhibit, misc.signalInhibit, FALSE), + Bres(XtNtiteInhibit, XtCTiteInhibit, misc.titeInhibit, FALSE), + Bres(XtNtiXtraScroll, XtCTiXtraScroll, misc.tiXtraScroll, FALSE), + Bres(XtNtrimSelection, XtCTrimSelection, screen.trim_selection, FALSE), + Bres(XtNunderLine, XtCUnderLine, screen.underline, TRUE), + Bres(XtNvisualBell, XtCVisualBell, screen.visualbell, FALSE), + Cres(XtNcursorColor, XtCCursorColor, screen.cursorcolor, XtDefaultForeground), + Cres(XtNforeground, XtCForeground, screen.foreground, XtDefaultForeground), + Cres(XtNpointerColor, XtCPointerColor, screen.mousecolor, XtDefaultForeground), + Cres(XtNbackground, XtCBackground, core.background_pixel, XtDefaultBackground), + Cres(XtNpointerColorBackground, XtCBackground, screen.mousecolorback, XtDefaultBackground), + Ires(XtNbellSuppressTime, XtCBellSuppressTime, screen.bellSuppressTime, BELLSUPPRESSMSEC), + Ires(XtNinternalBorder, XtCBorderWidth, screen.border, DEFBORDER), + Ires(XtNlimitResize, XtCLimitResize, misc.limit_resize, 1), + Ires(XtNmultiClickTime, XtCMultiClickTime, screen.multiClickTime, MULTICLICKTIME), + Ires(XtNnMarginBell, XtCColumn, screen.nmarginbell, N_MARGINBELL), + Ires(XtNprinterControlMode, XtCPrinterControlMode, + screen.printer_controlmode, 0), + Ires(XtNsaveLines, XtCSaveLines, screen.savelines, SAVELINES), + Ires(XtNscrollLines, XtCScrollLines, screen.scrolllines, SCROLLLINES), + Sres("font1", "Font1", screen.menu_font_names[fontMenu_font1], NULL), + Sres("font2", "Font2", screen.menu_font_names[fontMenu_font2], NULL), + Sres("font3", "Font3", screen.menu_font_names[fontMenu_font3], NULL), + Sres("font4", "Font4", screen.menu_font_names[fontMenu_font4], NULL), + Sres("font5", "Font5", screen.menu_font_names[fontMenu_font5], NULL), + Sres("font6", "Font6", screen.menu_font_names[fontMenu_font6], NULL), + Sres(XtNanswerbackString, XtCAnswerbackString, screen.answer_back, ""), + Sres(XtNboldFont, XtCBoldFont, misc.f_b, DEFBOLDFONT), + Sres(XtNcharClass, XtCCharClass, screen.charClass, NULL), + Sres(XtNdecTerminalID, XtCDecTerminalID, screen.term_id, DFT_DECID), + Sres(XtNfont, XtCFont, misc.f_n, DEFFONT), + Sres(XtNgeometry, XtCGeometry, misc.geo_metry, NULL), + Sres(XtNkeyboardDialect, XtCKeyboardDialect, screen.keyboard_dialect, DFT_KBD_DIALECT), + Sres(XtNprinterCommand, XtCPrinterCommand, screen.printer_command, OS_DEPENDENT_PRINT_COMMAND), + Sres(XtNtekGeometry, XtCGeometry, misc.T_geometry, NULL), + + {XtNresizeGravity, XtCResizeGravity, XtRGravity, sizeof(XtGravity), + XtOffsetOf(XtermWidgetRec, misc.resizeGravity), + XtRImmediate, (XtPointer) SouthWestGravity}, + + {XtNpointerShape, XtCCursor, XtRCursor, sizeof(Cursor), + XtOffsetOf(XtermWidgetRec, screen.pointer_cursor), + XtRString, (XtPointer) "xterm"}, #ifdef ALLOWLOGGING -Bres(XtNlogInhibit, XtCLogInhibit, misc.logInhibit, FALSE), -Bres(XtNlogging, XtCLogging, misc.log_on, FALSE), -Sres(XtNlogFile, XtCLogfile, screen.logfile, NULL), + Bres(XtNlogInhibit, XtCLogInhibit, misc.logInhibit, FALSE), + Bres(XtNlogging, XtCLogging, misc.log_on, FALSE), + Sres(XtNlogFile, XtCLogfile, screen.logfile, NULL), #endif #ifndef NO_ACTIVE_ICON -Bres("activeIcon", "ActiveIcon", misc.active_icon, FALSE), -Ires("iconBorderWidth", XtCBorderWidth, misc.icon_border_width, 2), + Bres("activeIcon", "ActiveIcon", misc.active_icon, FALSE), + Ires("iconBorderWidth", XtCBorderWidth, misc.icon_border_width, 2), -{"iconFont", "IconFont", XtRFontStruct, sizeof(XFontStruct), - XtOffsetOf(XtermWidgetRec, screen.fnt_icon), - XtRString, (XtPointer)XtExtdefaultfont}, - -{"iconBorderColor", XtCBorderColor, XtRPixel, sizeof(Pixel), - XtOffsetOf(XtermWidgetRec, misc.icon_border_pixel), - XtRString, XtExtdefaultbackground}, + {"iconFont", "IconFont", XtRFontStruct, sizeof(XFontStruct), + XtOffsetOf(XtermWidgetRec, screen.fnt_icon), + XtRString, (XtPointer) XtExtdefaultfont}, + + {"iconBorderColor", XtCBorderColor, XtRPixel, sizeof(Pixel), + XtOffsetOf(XtermWidgetRec, misc.icon_border_pixel), + XtRString, XtExtdefaultbackground}, -#endif /* NO_ACTIVE_ICON */ +#endif /* NO_ACTIVE_ICON */ #if OPT_BLINK_CURS -Bres(XtNcursorBlink, XtCCursorBlink, screen.cursor_blink, FALSE), -Ires(XtNcursorOnTime, XtCCursorOnTime, screen.cursor_on, 600), -Ires(XtNcursorOffTime, XtCCursorOffTime, screen.cursor_off, 300), + Bres(XtNcursorBlink, XtCCursorBlink, screen.cursor_blink, FALSE), + Ires(XtNcursorOnTime, XtCCursorOnTime, screen.cursor_on, 600), + Ires(XtNcursorOffTime, XtCCursorOffTime, screen.cursor_off, 300), #endif #if OPT_DEC_CHRSET -Bres(XtNfontDoublesize, XtCFontDoublesize, screen.font_doublesize, TRUE), -Ires(XtNcacheDoublesize, XtCCacheDoublesize, screen.cache_doublesize, NUM_CHRSET), + Bres(XtNfontDoublesize, XtCFontDoublesize, screen.font_doublesize, TRUE), + Ires(XtNcacheDoublesize, XtCCacheDoublesize, screen.cache_doublesize, NUM_CHRSET), #endif #if OPT_HIGHLIGHT_COLOR -Cres(XtNhighlightColor, XtCHighlightColor, screen.highlightcolor, XtDefaultForeground), -#endif /* OPT_HIGHLIGHT_COLOR */ + Cres(XtNhighlightColor, XtCHighlightColor, screen.highlightcolor, XtDefaultForeground), +#endif /* OPT_HIGHLIGHT_COLOR */ #if OPT_INPUT_METHOD -Bres(XtNopenIm, XtCOpenIm, misc.open_im, TRUE), -Sres(XtNinputMethod, XtCInputMethod, misc.input_method, NULL), -Sres(XtNpreeditType, XtCPreeditType, misc.preedit_type, "OverTheSpot,Root"), + Bres(XtNopenIm, XtCOpenIm, misc.open_im, TRUE), + Sres(XtNinputMethod, XtCInputMethod, misc.input_method, NULL), + Sres(XtNpreeditType, XtCPreeditType, misc.preedit_type, + "OverTheSpot,Root"), #endif #if OPT_ISO_COLORS -Bres(XtNboldColors, XtCColorMode, screen.boldColors, TRUE), -Bres(XtNcolorAttrMode, XtCColorMode, screen.colorAttrMode, FALSE), -Bres(XtNcolorBDMode, XtCColorMode, screen.colorBDMode, FALSE), -Bres(XtNcolorBLMode, XtCColorMode, screen.colorBLMode, FALSE), -Bres(XtNcolorMode, XtCColorMode, screen.colorMode, DFT_COLORMODE), -Bres(XtNcolorRVMode, XtCColorMode, screen.colorRVMode, FALSE), -Bres(XtNcolorULMode, XtCColorMode, screen.colorULMode, FALSE), - -COLOR_RES("0", screen.Acolors[COLOR_0], DFT_COLOR("black")), -COLOR_RES("1", screen.Acolors[COLOR_1], DFT_COLOR("red3")), -COLOR_RES("2", screen.Acolors[COLOR_2], DFT_COLOR("green3")), -COLOR_RES("3", screen.Acolors[COLOR_3], DFT_COLOR("yellow3")), -COLOR_RES("4", screen.Acolors[COLOR_4], DFT_COLOR("blue3")), -COLOR_RES("5", screen.Acolors[COLOR_5], DFT_COLOR("magenta3")), -COLOR_RES("6", screen.Acolors[COLOR_6], DFT_COLOR("cyan3")), -COLOR_RES("7", screen.Acolors[COLOR_7], DFT_COLOR("gray90")), -COLOR_RES("8", screen.Acolors[COLOR_8], DFT_COLOR("gray30")), -COLOR_RES("9", screen.Acolors[COLOR_9], DFT_COLOR("red")), -COLOR_RES("10", screen.Acolors[COLOR_10], DFT_COLOR("green")), -COLOR_RES("11", screen.Acolors[COLOR_11], DFT_COLOR("yellow")), -COLOR_RES("12", screen.Acolors[COLOR_12], DFT_COLOR("blue")), -COLOR_RES("13", screen.Acolors[COLOR_13], DFT_COLOR("magenta")), -COLOR_RES("14", screen.Acolors[COLOR_14], DFT_COLOR("cyan")), -COLOR_RES("15", screen.Acolors[COLOR_15], DFT_COLOR("white")), -COLOR_RES("BD", screen.Acolors[COLOR_BD], DFT_COLOR(XtDefaultForeground)), -COLOR_RES("BL", screen.Acolors[COLOR_BL], DFT_COLOR(XtDefaultForeground)), -COLOR_RES("UL", screen.Acolors[COLOR_UL], DFT_COLOR(XtDefaultForeground)), -COLOR_RES("RV", screen.Acolors[COLOR_RV], DFT_COLOR(XtDefaultForeground)), + Bres(XtNboldColors, XtCColorMode, screen.boldColors, TRUE), + Ires(XtNveryBoldColors, XtCColorMode, screen.veryBoldColors, 0), + Bres(XtNcolorAttrMode, XtCColorMode, screen.colorAttrMode, FALSE), + Bres(XtNcolorBDMode, XtCColorMode, screen.colorBDMode, FALSE), + Bres(XtNcolorBLMode, XtCColorMode, screen.colorBLMode, FALSE), + Bres(XtNcolorMode, XtCColorMode, screen.colorMode, DFT_COLORMODE), + Bres(XtNcolorRVMode, XtCColorMode, screen.colorRVMode, FALSE), + Bres(XtNcolorULMode, XtCColorMode, screen.colorULMode, FALSE), + + COLOR_RES("0", screen.Acolors[COLOR_0], DFT_COLOR("black")), + COLOR_RES("1", screen.Acolors[COLOR_1], DFT_COLOR("red3")), + COLOR_RES("2", screen.Acolors[COLOR_2], DFT_COLOR("green3")), + COLOR_RES("3", screen.Acolors[COLOR_3], DFT_COLOR("yellow3")), + COLOR_RES("4", screen.Acolors[COLOR_4], DFT_COLOR("blue3")), + COLOR_RES("5", screen.Acolors[COLOR_5], DFT_COLOR("magenta3")), + COLOR_RES("6", screen.Acolors[COLOR_6], DFT_COLOR("cyan3")), + COLOR_RES("7", screen.Acolors[COLOR_7], DFT_COLOR("gray90")), + COLOR_RES("8", screen.Acolors[COLOR_8], DFT_COLOR("gray30")), + COLOR_RES("9", screen.Acolors[COLOR_9], DFT_COLOR("red")), + COLOR_RES("10", screen.Acolors[COLOR_10], DFT_COLOR("green")), + COLOR_RES("11", screen.Acolors[COLOR_11], DFT_COLOR("yellow")), + COLOR_RES("12", screen.Acolors[COLOR_12], DFT_COLOR("blue")), + COLOR_RES("13", screen.Acolors[COLOR_13], DFT_COLOR("magenta")), + COLOR_RES("14", screen.Acolors[COLOR_14], DFT_COLOR("cyan")), + COLOR_RES("15", screen.Acolors[COLOR_15], DFT_COLOR("white")), + COLOR_RES("BD", screen.Acolors[COLOR_BD], DFT_COLOR(XtDefaultForeground)), + COLOR_RES("BL", screen.Acolors[COLOR_BL], DFT_COLOR(XtDefaultForeground)), + COLOR_RES("UL", screen.Acolors[COLOR_UL], DFT_COLOR(XtDefaultForeground)), + COLOR_RES("RV", screen.Acolors[COLOR_RV], DFT_COLOR(XtDefaultForeground)), #if OPT_256_COLORS # include <256colres.h> @@ -529,127 +541,147 @@ # include <88colres.h> #endif -#endif /* OPT_ISO_COLORS */ +#endif /* OPT_ISO_COLORS */ + +#if OPT_MOD_FKEYS + Ires(XtNmodifyCursorKeys, XtCModifyCursorKeys, + keyboard.modify_cursor_keys, 2), +#endif #if OPT_NUM_LOCK -Bres(XtNalwaysUseMods, XtCAlwaysUseMods, misc.alwaysUseMods, FALSE), -Bres(XtNnumLock, XtCNumLock, misc.real_NumLock, TRUE), + Bres(XtNalwaysUseMods, XtCAlwaysUseMods, misc.alwaysUseMods, FALSE), + Bres(XtNnumLock, XtCNumLock, misc.real_NumLock, TRUE), #endif #if OPT_PRINT_COLORS -Ires(XtNprintAttributes, XtCPrintAttributes, screen.print_attributes, 1), + Ires(XtNprintAttributes, XtCPrintAttributes, screen.print_attributes, 1), #endif #if OPT_SHIFT_FONTS -Bres(XtNshiftFonts, XtCShiftFonts, misc.shift_fonts, TRUE), + Bres(XtNshiftFonts, XtCShiftFonts, misc.shift_fonts, TRUE), #endif #if OPT_SUNPC_KBD -Ires(XtNctrlFKeys, XtCCtrlFKeys, misc.ctrl_fkeys, 10), + Ires(XtNctrlFKeys, XtCCtrlFKeys, misc.ctrl_fkeys, 10), #endif #if OPT_TEK4014 -Bres(XtNtekInhibit, XtCTekInhibit, misc.tekInhibit, FALSE), -Bres(XtNtekSmall, XtCTekSmall, misc.tekSmall, FALSE), -Bres(XtNtekStartup, XtCTekStartup, screen.TekEmu, FALSE), + Bres(XtNtekInhibit, XtCTekInhibit, misc.tekInhibit, FALSE), + Bres(XtNtekSmall, XtCTekSmall, misc.tekSmall, FALSE), + Bres(XtNtekStartup, XtCTekStartup, screen.TekEmu, FALSE), #endif #if OPT_TOOLBAR -{XtNmenuBar, XtCMenuBar, XtRWidget, sizeof(Widget), - XtOffsetOf(XtermWidgetRec, screen.fullVwin.menu_bar), - XtRWidget, (XtPointer) 0}, -Ires(XtNmenuHeight, XtCMenuHeight, screen.fullVwin.menu_height, 25), + {XtNmenuBar, XtCMenuBar, XtRWidget, sizeof(Widget), + XtOffsetOf(XtermWidgetRec, screen.fullVwin.menu_bar), + XtRWidget, (XtPointer) 0}, + Ires(XtNmenuHeight, XtCMenuHeight, screen.fullVwin.menu_height, 25), #endif #if OPT_WIDE_CHARS -{XtNutf8, XtCUtf8, XtRInt, sizeof(int), - XtOffsetOf(XtermWidgetRec, screen.utf8_mode), - XtRString, defaultUTF8}, -Bres(XtNwideChars, XtCWideChars, screen.wide_chars, FALSE), -Sres(XtNwideBoldFont, XtCWideBoldFont, misc.f_wb, DEFWIDEBOLDFONT), -Sres(XtNwideFont, XtCWideFont, misc.f_w, DEFWIDEFONT), + Ires(XtNutf8, XtCUtf8, screen.utf8_mode, 3), + Bres(XtNwideChars, XtCWideChars, screen.wide_chars, FALSE), + Bres(XtNcjkWidth, XtCCjkWidth, misc.cjk_width, FALSE), + Bres(XtNvt100Graphics, XtCVT100Graphics, screen.vt100_graphics, TRUE), + Sres(XtNwideBoldFont, XtCWideBoldFont, misc.f_wb, DEFWIDEBOLDFONT), + Sres(XtNwideFont, XtCWideFont, misc.f_w, DEFWIDEFONT), +#endif + +#if OPT_LUIT_PROG + Sres(XtNlocale, XtCLocale, misc.locale_str, "medium"), + Sres(XtNlocaleFilter, XtCLocaleFilter, misc.localefilter, DEFLOCALEFILTER), #endif #if OPT_INPUT_METHOD -Sres(XtNximFont, XtCXimFont, misc.f_x, DEFXIMFONT), + Sres(XtNximFont, XtCXimFont, misc.f_x, DEFXIMFONT), #endif #if OPT_XMC_GLITCH -Bres(XtNxmcInline, XtCXmcInline, screen.xmc_inline, FALSE), -Bres(XtNxmcMoveSGR, XtCXmcMoveSGR, screen.move_sgr_ok, TRUE), -Ires(XtNxmcAttributes, XtCXmcAttributes, screen.xmc_attributes, 1), -Ires(XtNxmcGlitch, XtCXmcGlitch, screen.xmc_glitch, 0), + Bres(XtNxmcInline, XtCXmcInline, screen.xmc_inline, FALSE), + Bres(XtNxmcMoveSGR, XtCXmcMoveSGR, screen.move_sgr_ok, TRUE), + Ires(XtNxmcAttributes, XtCXmcAttributes, screen.xmc_attributes, 1), + Ires(XtNxmcGlitch, XtCXmcGlitch, screen.xmc_glitch, 0), #endif #ifdef SCROLLBAR_RIGHT -Bres(XtNrightScrollBar, XtCRightScrollBar, misc.useRight, FALSE), + Bres(XtNrightScrollBar, XtCRightScrollBar, misc.useRight, FALSE), #endif #ifdef XRENDERFONT -Ires(XtNfaceSize, XtCFaceSize, misc.face_size, DEFFACESIZE), -Sres(XtNfaceName, XtCFaceName, misc.face_name, DEFFACENAME), + Ires(XtNfaceSize, XtCFaceSize, misc.face_size, DEFFACESIZE), + Sres(XtNfaceName, XtCFaceName, misc.face_name, DEFFACENAME), #endif }; -static Boolean VTSetValues (Widget cur, Widget request, Widget new_arg, ArgList args, Cardinal *num_args); -static void VTClassInit (void); -static void VTDestroy (Widget w); -static void VTExpose (Widget w, XEvent *event, Region region); -static void VTInitialize (Widget wrequest, Widget new_arg, ArgList args, Cardinal *num_args); -static void VTRealize (Widget w, XtValueMask *valuemask, XSetWindowAttributes *values); -static void VTResize (Widget w); +static Boolean VTSetValues(Widget cur, Widget request, Widget new_arg, + ArgList args, Cardinal * num_args); +static void VTClassInit(void); +static void VTDestroy(Widget w); +static void VTExpose(Widget w, XEvent * event, Region region); +static void VTInitialize(Widget wrequest, Widget new_arg, ArgList args, + Cardinal * num_args); +static void VTRealize(Widget w, XtValueMask * valuemask, + XSetWindowAttributes * values); +static void VTResize(Widget w); #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD -static void VTInitI18N (void); +static void VTInitI18N(void); #endif #ifdef VMS -globaldef {"xtermclassrec"} noshare +globaldef { + "xtermclassrec" +} noshare + #else static -#endif /* VMS */ -WidgetClassRec xtermClassRec = { - { +#endif /* VMS */ +WidgetClassRec xtermClassRec = +{ + { /* core_class fields */ - /* superclass */ (WidgetClass) &widgetClassRec, - /* class_name */ "VT100", - /* widget_size */ sizeof(XtermWidgetRec), - /* class_initialize */ VTClassInit, - /* class_part_initialize */ NULL, - /* class_inited */ FALSE, - /* initialize */ VTInitialize, - /* initialize_hook */ NULL, - /* realize */ VTRealize, - /* actions */ actionsList, - /* num_actions */ XtNumber(actionsList), - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ FALSE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ VTDestroy, - /* resize */ VTResize, - /* expose */ VTExpose, - /* set_values */ VTSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ NULL, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_offsets */ NULL, - /* tm_table */ defaultTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator*/ XtInheritDisplayAccelerator, - /* extension */ NULL - } + (WidgetClass) & widgetClassRec, /* superclass */ + "VT100", /* class_name */ + sizeof(XtermWidgetRec), /* widget_size */ + VTClassInit, /* class_initialize */ + NULL, /* class_part_initialize */ + FALSE, /* class_inited */ + VTInitialize, /* initialize */ + NULL, /* initialize_hook */ + VTRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + FALSE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + VTDestroy, /* destroy */ + VTResize, /* resize */ + VTExpose, /* expose */ + VTSetValues, /* set_values */ + NULL, /* set_values_hook */ + NULL, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_offsets */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + } }; #ifdef VMS -globaldef {"xtermwidgetclass"} noshare +globaldef { + "xtermwidgetclass" +} +noshare #endif /* VMS */ -WidgetClass xtermWidgetClass = (WidgetClass)&xtermClassRec; +WidgetClass xtermWidgetClass = (WidgetClass) & xtermClassRec; #if OPT_ISO_COLORS /* @@ -658,58 +690,60 @@ * XDrawImageString and XDrawString) * area (X11 graphics context used in XClearArea and XFillRectangle) */ -void SGR_Foreground(int color) +void +SGR_Foreground(int color) { - register TScreen *screen = &term->screen; - Pixel fg; + register TScreen *screen = &term->screen; + Pixel fg; - /* FIXME HideCursor(); */ - if (color >= 0) { - term->flags |= FG_COLOR; - } else { - term->flags &= ~FG_COLOR; - } - fg = getXtermForeground(term->flags, color); - term->cur_foreground = color; + /* FIXME HideCursor(); */ + if (color >= 0) { + term->flags |= FG_COLOR; + } else { + term->flags &= ~FG_COLOR; + } + fg = getXtermForeground(term->flags, color); + term->cur_foreground = color; - XSetForeground(screen->display, NormalGC(screen), fg); - XSetBackground(screen->display, ReverseGC(screen), fg); + XSetForeground(screen->display, NormalGC(screen), fg); + XSetBackground(screen->display, ReverseGC(screen), fg); - if (NormalGC(screen) != NormalBoldGC(screen)) { - XSetForeground(screen->display, NormalBoldGC(screen), fg); - XSetBackground(screen->display, ReverseBoldGC(screen), fg); - } + if (NormalGC(screen) != NormalBoldGC(screen)) { + XSetForeground(screen->display, NormalBoldGC(screen), fg); + XSetBackground(screen->display, ReverseBoldGC(screen), fg); + } } -void SGR_Background(int color) +void +SGR_Background(int color) { - register TScreen *screen = &term->screen; - Pixel bg; + register TScreen *screen = &term->screen; + Pixel bg; - /* - * An indexing operation may have set screen->scroll_amt, which would - * normally result in calling FlushScroll() in WriteText(). However, - * if we're changing the background color now, then the new value - * should not apply to the pending blank lines. - */ - if (screen->scroll_amt && (color != term->cur_background)) - FlushScroll(screen); + /* + * An indexing operation may have set screen->scroll_amt, which would + * normally result in calling FlushScroll() in WriteText(). However, + * if we're changing the background color now, then the new value + * should not apply to the pending blank lines. + */ + if (screen->scroll_amt && (color != term->cur_background)) + FlushScroll(screen); - if (color >= 0) { - term->flags |= BG_COLOR; - } else { - term->flags &= ~BG_COLOR; - } - bg = getXtermBackground(term->flags, color); - term->cur_background = color; + if (color >= 0) { + term->flags |= BG_COLOR; + } else { + term->flags &= ~BG_COLOR; + } + bg = getXtermBackground(term->flags, color); + term->cur_background = color; - XSetBackground(screen->display, NormalGC(screen), bg); - XSetForeground(screen->display, ReverseGC(screen), bg); + XSetBackground(screen->display, NormalGC(screen), bg); + XSetForeground(screen->display, ReverseGC(screen), bg); - if (NormalGC(screen) != NormalBoldGC(screen)) { - XSetBackground(screen->display, NormalBoldGC(screen), bg); - XSetForeground(screen->display, ReverseBoldGC(screen), bg); - } + if (NormalGC(screen) != NormalBoldGC(screen)) { + XSetBackground(screen->display, NormalBoldGC(screen), bg); + XSetForeground(screen->display, ReverseBoldGC(screen), bg); + } } /* Invoked after updating bold/underline flags, computes the extended color @@ -718,33 +752,33 @@ static void setExtendedFG(void) { - int fg = term->sgr_foreground; + int fg = term->sgr_foreground; - if (term->screen.colorAttrMode - || (fg < 0)) { - if (term->screen.colorULMode && (term->flags & UNDERLINE)) - fg = COLOR_UL; - if (term->screen.colorBDMode && (term->flags & BOLD)) - fg = COLOR_BD; - if (term->screen.colorBLMode && (term->flags & BLINK)) - fg = COLOR_BL; - } - - /* This implements the IBM PC-style convention of 8-colors, with one - * bit for bold, thus mapping the 0-7 codes to 8-15. It won't make - * much sense for 16-color applications, but we keep it to retain - * compatiblity with ANSI-color applications. - */ -#if OPT_PC_COLORS /* XXXJTL should be settable at runtime (resource or OSC?) */ - if (term->screen.boldColors - && (!term->sgr_extended) - && (fg >= 0) - && (fg < 8) - && (term->flags & BOLD)) - fg |= 8; + if (term->screen.colorAttrMode + || (fg < 0)) { + if (term->screen.colorULMode && (term->flags & UNDERLINE)) + fg = COLOR_UL; + if (term->screen.colorBDMode && (term->flags & BOLD)) + fg = COLOR_BD; + if (term->screen.colorBLMode && (term->flags & BLINK)) + fg = COLOR_BL; + } + + /* This implements the IBM PC-style convention of 8-colors, with one + * bit for bold, thus mapping the 0-7 codes to 8-15. It won't make + * much sense for 16-color applications, but we keep it to retain + * compatiblity with ANSI-color applications. + */ +#if OPT_PC_COLORS /* XXXJTL should be settable at runtime (resource or OSC?) */ + if (term->screen.boldColors + && (!term->sgr_extended) + && (fg >= 0) + && (fg < 8) + && (term->flags & BOLD)) + fg |= 8; #endif - SGR_Foreground(fg); + SGR_Foreground(fg); } /* Invoked after updating inverse flag, computes the extended color @@ -753,49 +787,50 @@ static void setExtendedBG(void) { - int bg = term->sgr_background; + int bg = term->sgr_background; - if (term->screen.colorAttrMode - || (bg < 0)) { - if (term->screen.colorRVMode && (term->flags & INVERSE)) - bg = COLOR_RV; - } + if (term->screen.colorAttrMode + || (bg < 0)) { + if (term->screen.colorRVMode && (term->flags & INVERSE)) + bg = COLOR_RV; + } - SGR_Background(bg); + SGR_Background(bg); } static void reset_SGR_Foreground(void) { - term->sgr_foreground = -1; - term->sgr_extended = 0; - setExtendedFG(); + term->sgr_foreground = -1; + term->sgr_extended = 0; + setExtendedFG(); } static void reset_SGR_Background(void) { - term->sgr_background = -1; - setExtendedBG(); + term->sgr_background = -1; + setExtendedBG(); } static void reset_SGR_Colors(void) { - reset_SGR_Foreground(); - reset_SGR_Background(); + reset_SGR_Foreground(); + reset_SGR_Background(); } #endif /* OPT_ISO_COLORS */ -void resetCharsets(TScreen *screen) +void +resetCharsets(TScreen * screen) { - screen->gsets[0] = 'B'; /* ASCII_G */ - screen->gsets[1] = '0'; /* line drawing */ - screen->gsets[2] = 'B'; /* DEC supplemental. */ - screen->gsets[3] = 'B'; - screen->curgl = 0; /* G0 => GL. */ - screen->curgr = 2; /* G2 => GR. */ - screen->curss = 0; /* No single shift. */ + screen->gsets[0] = 'B'; /* ASCII_G */ + screen->gsets[1] = '0'; /* line drawing */ + screen->gsets[2] = 'B'; /* DEC supplemental. */ + screen->gsets[3] = 'B'; + screen->curgl = 0; /* G0 => GL. */ + screen->curgr = 2; /* G2 => GR. */ + screen->curss = 0; /* No single shift. */ } /* allocate larger buffer if needed/possible */ @@ -823,1470 +858,1503 @@ extern int last_written_col, last_written_row; -static void VTparse(void) +static void +VTparse(void) { - /* Buffer for processing printable text */ - static IChar *print_area; - static size_t print_size, print_used; - - /* Buffer for processing strings (e.g., OSC ... ST) */ - static Char *string_area; - static size_t string_size, string_used; + /* Buffer for processing printable text */ + static IChar *print_area; + static size_t print_size, print_used; + + /* Buffer for processing strings (e.g., OSC ... ST) */ + static Char *string_area; + static size_t string_size, string_used; #if OPT_VT52_MODE - static Bool vt52_cup = FALSE; + static Bool vt52_cup = FALSE; #endif - Const PARSE_T *groundtable = ansi_table; - TScreen *screen = &term->screen; - Const PARSE_T *parsestate; - unsigned int c; - Char *cp; - int row, col, top, bot, scstype, count; - Bool private_function; /* distinguish private-mode from standard */ - int string_mode; /* nonzero iff we're processing a string */ - int lastchar; /* positive iff we had a graphic character */ - int nextstate; - int laststate; + Const PARSE_T *groundtable = ansi_table; + TScreen *screen = &term->screen; + Const PARSE_T *parsestate; + unsigned int c; + Char *cp; + int row, col, top, bot, scstype, count; + Bool private_function; /* distinguish private-mode from standard */ + int string_mode; /* nonzero iff we're processing a string */ + int lastchar; /* positive iff we had a graphic character */ + int nextstate; + int laststate; #if OPT_WIDE_CHARS - int last_was_wide; + int last_was_wide; #endif - /* We longjmp back to this point in VTReset() */ - (void)setjmp(vtjmpbuf); + /* We longjmp back to this point in VTReset() */ + (void) setjmp(vtjmpbuf); #if OPT_VT52_MODE - groundtable = screen->ansi_level ? ansi_table : vt52_table; + groundtable = screen->ansi_level ? ansi_table : vt52_table; #else - groundtable = ansi_table; + groundtable = ansi_table; #endif - parsestate = groundtable; - scstype = 0; - private_function = False; - string_mode = 0; - lastchar = -1; /* not a legal IChar */ - nextstate = -1; /* not a legal state */ + parsestate = groundtable; + scstype = 0; + private_function = False; + string_mode = 0; + lastchar = -1; /* not a legal IChar */ + nextstate = -1; /* not a legal state */ #if OPT_WIDE_CHARS - last_was_wide = 0; + last_was_wide = 0; #endif - for( ; ; ) { - int thischar = -1; - c = doinput(); + for (;;) { + int thischar = -1; + c = doinput(); #if OPT_WIDE_CHARS - if (screen->wide_chars - && my_wcwidth(c) == 0) { - unsigned single = 0; - int prev, precomposed; - - if (screen->curss) { - dotext(screen, screen->gsets[(int)(screen->curss)], - print_area, 1); - screen->curss = 0; - single++; - } - if (print_used > single) { - dotext(screen, - screen->gsets[(int)(screen->curgl)], - print_area + single, - print_used - single); - } - print_used = 0; + if (screen->wide_chars + && my_wcwidth(c) == 0) { + unsigned single = 0; + int prev, precomposed; + + if (screen->curss) { + dotext(screen, screen->gsets[(int) (screen->curss)], + print_area, 1); + screen->curss = 0; + single++; + } + if (print_used > single) { + dotext(screen, + screen->gsets[(int) (screen->curgl)], + print_area + single, + print_used - single); + } + print_used = 0; - prev = getXtermCell(screen, last_written_row, last_written_col); - precomposed = do_precomposition(prev, c); + prev = getXtermCell(screen, last_written_row, last_written_col); + precomposed = do_precomposition(prev, c); - if (precomposed != -1) { - putXtermCell(screen, last_written_row, last_written_col, precomposed); - } else { - addXtermCombining(screen, last_written_row, last_written_col, c); - } - if (!screen->scroll_amt) - ScrnRefresh(screen, last_written_row, last_written_col, 1, 1, 1); - continue; + if (precomposed != -1) { + putXtermCell(screen, last_written_row, last_written_col, precomposed); + } else { + addXtermCombining(screen, + last_written_row, + last_written_col, c); } + if (!screen->scroll_amt) + ScrnRefresh(screen, + last_written_row, + last_written_col, 1, 1, 1); + continue; + } #endif - /* Intercept characters for printer controller mode */ - if (screen->printer_controlmode == 2) { - if ((c = xtermPrinterControl(c)) == 0) - continue; - } + /* Intercept characters for printer controller mode */ + if (screen->printer_controlmode == 2) { + if ((c = xtermPrinterControl(c)) == 0) + continue; + } - /* - * VT52 is a little ugly in the one place it has a parameterized - * control sequence, since the parameter falls after the character - * that denotes the type of sequence. - */ + /* + * VT52 is a little ugly in the one place it has a parameterized + * control sequence, since the parameter falls after the character + * that denotes the type of sequence. + */ #if OPT_VT52_MODE - if (vt52_cup) { - param[nparam++] = (c & 0x7f) - 32; - if (nparam < 2) - continue; - vt52_cup = FALSE; - if((row = param[0]) < 0) - row = 0; - if((col = param[1]) < 0) - col = 0; - CursorSet(screen, row, col, term->flags); - parsestate = vt52_table; - param[0] = 0; - param[1] = 0; + if (vt52_cup) { + param[nparam++] = (c & 0x7f) - 32; + if (nparam < 2) continue; - } + vt52_cup = FALSE; + if ((row = param[0]) < 0) + row = 0; + if ((col = param[1]) < 0) + col = 0; + CursorSet(screen, row, col, term->flags); + parsestate = vt52_table; + param[0] = 0; + param[1] = 0; + continue; + } #endif - /* - * The parsing tables all have 256 entries. If we're supporting - * wide characters, we handle them by treating them the same as - * printing characters. - */ - laststate = nextstate; + /* + * The parsing tables all have 256 entries. If we're supporting + * wide characters, we handle them by treating them the same as + * printing characters. + */ + laststate = nextstate; #if OPT_WIDE_CHARS - if (c > 255) { - if (parsestate == groundtable) { - nextstate = CASE_PRINT; - } else if (parsestate == sos_table) { - c &= 0xffff; - if (c > 255) { - TRACE(("Found code > 255 while in SOS state: %04X\n", c)); - c = '?'; - } - } else { - nextstate = CASE_GROUND_STATE; + if (c > 255) { + if (parsestate == groundtable) { + nextstate = CASE_PRINT; + } else if (parsestate == sos_table) { + c &= 0xffff; + if (c > 255) { + TRACE(("Found code > 255 while in SOS state: %04X\n", c)); + c = '?'; } - } else + } else { + nextstate = CASE_GROUND_STATE; + } + } else #endif - nextstate = parsestate[E2A(c)]; + nextstate = parsestate[E2A(c)]; #if OPT_WIDE_CHARS - /* if this character is a different width than - the last one, put the previous text into - the buffer and draw it now */ - - if (iswide(c) != last_was_wide) { - unsigned single = 0; - - if (screen->curss) { - dotext(screen, - screen->gsets[(int)(screen->curss)], - print_area, 1); - screen->curss = 0; - single++; - } - if (print_used > single) { - dotext(screen, - screen->gsets[(int)(screen->curgl)], - print_area + single, - print_used - single); - } - print_used = 0; + /* if this character is a different width than + the last one, put the previous text into + the buffer and draw it now */ + + if (iswide(c) != last_was_wide) { + unsigned single = 0; + + if (screen->curss) { + dotext(screen, + screen->gsets[(int) (screen->curss)], + print_area, 1); + screen->curss = 0; + single++; + } + if (print_used > single) { + dotext(screen, + screen->gsets[(int) (screen->curgl)], + print_area + single, + print_used - single); } + print_used = 0; + } #endif + /* + * Accumulate string for printable text. This may be 8/16-bit + * characters. + */ + if (nextstate == CASE_PRINT) { + SafeAlloc(IChar, print_area, print_used, print_size); + if (new_string == 0) { + fprintf(stderr, + "Cannot allocate %d bytes for printable text\n", + new_length); + continue; + } +#if OPT_VT52_MODE /* - * Accumulate string for printable text. This may be 8/16-bit - * characters. + * Strip output text to 7-bits for VT52. We should do this for + * VT100 also (which is a 7-bit device), but xterm has been + * doing this for so long we shouldn't change this behavior. */ - if (nextstate == CASE_PRINT) { - SafeAlloc(IChar, print_area, print_used, print_size); - if (new_string == 0) { - fprintf(stderr, - "Cannot allocate %d bytes for printable text\n", - new_length); - continue; - } - -#if OPT_VT52_MODE - /* - * Strip output text to 7-bits for VT52. We should do this for - * VT100 also (which is a 7-bit device), but xterm has been - * doing this for so long we shouldn't change this behavior. - */ - if (screen->ansi_level < 1) - c &= 0x7f; + if (screen->ansi_level < 1) + c &= 0x7f; #endif - print_area = new_string; - print_size = new_length; - print_area[print_used++] = lastchar = thischar = c; + print_area = new_string; + print_size = new_length; + print_area[print_used++] = lastchar = thischar = c; #if OPT_WIDE_CHARS - last_was_wide = iswide(c); + last_was_wide = iswide(c); #endif - if (morePtyData(&VTbuffer)) { - continue; - } + if (morePtyData(&VTbuffer)) { + continue; } - - if (nextstate == CASE_PRINT - || (laststate == CASE_PRINT && print_used)) { - unsigned single = 0; + } - if (screen->curss) { - dotext(screen, - screen->gsets[(int)(screen->curss)], - print_area, 1); - screen->curss = 0; - single++; - } - if (print_used > single) { - dotext(screen, - screen->gsets[(int)(screen->curgl)], - print_area + single, - print_used - single); - } - print_used = 0; + if (nextstate == CASE_PRINT + || (laststate == CASE_PRINT && print_used)) { + unsigned single = 0; + + if (screen->curss) { + dotext(screen, + screen->gsets[(int) (screen->curss)], + print_area, 1); + screen->curss = 0; + single++; } + if (print_used > single) { + dotext(screen, + screen->gsets[(int) (screen->curgl)], + print_area + single, + print_used - single); + } + print_used = 0; + } + /* + * Accumulate string for APC, DCS, PM, OSC, SOS controls + * This should always be 8-bit characters. + */ + if (parsestate == sos_table) { + SafeAlloc(Char, string_area, string_used, string_size); + if (new_string == 0) { + fprintf(stderr, + "Cannot allocate %d bytes for string mode %d\n", + new_length, string_mode); + continue; + } +#if OPT_WIDE_CHARS /* - * Accumulate string for APC, DCS, PM, OSC, SOS controls - * This should always be 8-bit characters. + * We cannot display codes above 255, but let's try to + * accommodate the application a little by not aborting the + * string. */ - if (parsestate == sos_table) { - SafeAlloc(Char, string_area, string_used, string_size); - if (new_string == 0) { - fprintf(stderr, - "Cannot allocate %d bytes for string mode %d\n", - new_length, string_mode); - continue; - } - -#if OPT_WIDE_CHARS - /* - * We cannot display codes above 255, but let's try to - * accommodate the application a little by not aborting the - * string. - */ - if ((c & 0xffff) > 255) { - nextstate = CASE_PRINT; - c = '?'; - } -#endif - string_area = new_string; - string_size = new_length; - string_area[string_used++] = c; - } else if (parsestate != esc_table) { - /* if we were accumulating, we're not any more */ - string_mode = 0; - string_used = 0; + if ((c & 0xffff) > 255) { + nextstate = CASE_PRINT; + c = '?'; } - - TRACE(("parse %04X -> %d\n", c, nextstate)); - - switch (nextstate) { - case CASE_PRINT: - /* printable characters (see above) */ - break; - - case CASE_GROUND_STATE: - /* exit ignore mode */ - parsestate = groundtable; - break; +#endif + string_area = new_string; + string_size = new_length; + string_area[string_used++] = c; + } else if (parsestate != esc_table) { + /* if we were accumulating, we're not any more */ + string_mode = 0; + string_used = 0; + } - case CASE_IGNORE_STATE: - /* Ies: ignore anything else */ - parsestate = igntable; - break; + TRACE(("parse %04X -> %d\n", c, nextstate)); + + switch (nextstate) { + case CASE_PRINT: + /* printable characters (see above) */ + break; - case CASE_IGNORE_ESC: - /* Ign: escape */ - parsestate = iestable; - break; + case CASE_GROUND_STATE: + /* exit ignore mode */ + parsestate = groundtable; + break; - case CASE_IGNORE: - /* Ignore character */ - break; + case CASE_IGNORE: + /* Ignore character */ + break; - case CASE_ENQ: - for (count = 0; screen->answer_back[count] != 0; count++) - unparseputc(screen->answer_back[count], screen->respond); - break; + case CASE_ENQ: + for (count = 0; screen->answer_back[count] != 0; count++) + unparseputc(screen->answer_back[count], screen->respond); + break; - case CASE_BELL: - if (string_mode == OSC) { - if (string_used) - string_area[--string_used] = '\0'; - do_osc(string_area, string_used, c); - parsestate = groundtable; - } else { - /* bell */ - Bell(XkbBI_TerminalBell,0); - } - break; + case CASE_BELL: + if (string_mode == OSC) { + if (string_used) + string_area[--string_used] = '\0'; + do_osc(string_area, string_used, c); + parsestate = groundtable; + } else { + /* bell */ + Bell(XkbBI_TerminalBell, 0); + } + break; - case CASE_BS: - /* backspace */ - CursorBack(screen, 1); - break; + case CASE_BS: + /* backspace */ + CursorBack(screen, 1); + break; - case CASE_CR: - /* carriage return */ - CarriageReturn(screen); - parsestate = groundtable; - break; + case CASE_CR: + /* carriage return */ + CarriageReturn(screen); + break; - case CASE_ESC: - /* escape */ - if_OPT_VT52_MODE(screen,{ - parsestate = vt52_esc_table; - break;}) - parsestate = esc_table; - break; + case CASE_ESC: + /* escape */ + if_OPT_VT52_MODE(screen, { + parsestate = vt52_esc_table; + break; + }); + parsestate = esc_table; + break; #if OPT_VT52_MODE - case CASE_VT52_CUP: - vt52_cup = TRUE; - nparam = 0; - break; + case CASE_VT52_CUP: + vt52_cup = TRUE; + nparam = 0; + break; + + case CASE_VT52_IGNORE: + parsestate = vt52_ignore_table; + break; #endif - case CASE_VMOT: - /* - * form feed, line feed, vertical tab - */ - xtermAutoPrint(c); - xtermIndex(screen, 1); - if (term->flags & LINEFEED) - CarriageReturn(screen); - do_xevents(); - parsestate = groundtable; - break; + case CASE_VMOT: + /* + * form feed, line feed, vertical tab + */ + xtermAutoPrint(c); + xtermIndex(screen, 1); + if (term->flags & LINEFEED) + CarriageReturn(screen); + do_xevents(); + break; - case CASE_CBT: - /* cursor backward tabulation */ - if((count = param[0]) == DEFAULT) - count = 1; - while ((count-- > 0) - && (TabToPrevStop())); - parsestate = groundtable; - break; + case CASE_CBT: + /* cursor backward tabulation */ + if ((count = param[0]) == DEFAULT) + count = 1; + while ((count-- > 0) + && (TabToPrevStop())) ; + parsestate = groundtable; + break; - case CASE_CHT: - /* cursor forward tabulation */ - if((count = param[0]) == DEFAULT) - count = 1; - while ((count-- > 0) - && (TabToNextStop())); - parsestate = groundtable; - break; + case CASE_CHT: + /* cursor forward tabulation */ + if ((count = param[0]) == DEFAULT) + count = 1; + while ((count-- > 0) + && (TabToNextStop())) ; + parsestate = groundtable; + break; - case CASE_TAB: - /* tab */ - TabToNextStop(); - break; + case CASE_TAB: + /* tab */ + TabToNextStop(); + break; - case CASE_SI: - screen->curgl = 0; - parsestate = groundtable; - break; + case CASE_SI: + screen->curgl = 0; + break; - case CASE_SO: - screen->curgl = 1; - parsestate = groundtable; - break; + case CASE_SO: + screen->curgl = 1; + break; - case CASE_DECDHL: - xterm_DECDHL(c == '3'); - parsestate = groundtable; - break; + case CASE_DECDHL: + xterm_DECDHL(c == '3'); + parsestate = groundtable; + break; - case CASE_DECSWL: - xterm_DECSWL(); - parsestate = groundtable; - break; + case CASE_DECSWL: + xterm_DECSWL(); + parsestate = groundtable; + break; - case CASE_DECDWL: - xterm_DECDWL(); - parsestate = groundtable; - break; + case CASE_DECDWL: + xterm_DECDWL(); + parsestate = groundtable; + break; - case CASE_SCR_STATE: - /* enter scr state */ - parsestate = scrtable; - break; + case CASE_SCR_STATE: + /* enter scr state */ + parsestate = scrtable; + break; - case CASE_SCS0_STATE: - /* enter scs state 0 */ - scstype = 0; - parsestate = scstable; - break; + case CASE_SCS0_STATE: + /* enter scs state 0 */ + scstype = 0; + parsestate = scstable; + break; - case CASE_SCS1_STATE: - /* enter scs state 1 */ - scstype = 1; - parsestate = scstable; - break; + case CASE_SCS1_STATE: + /* enter scs state 1 */ + scstype = 1; + parsestate = scstable; + break; - case CASE_SCS2_STATE: - /* enter scs state 2 */ - scstype = 2; - parsestate = scstable; - break; + case CASE_SCS2_STATE: + /* enter scs state 2 */ + scstype = 2; + parsestate = scstable; + break; - case CASE_SCS3_STATE: - /* enter scs state 3 */ - scstype = 3; - parsestate = scstable; - break; + case CASE_SCS3_STATE: + /* enter scs state 3 */ + scstype = 3; + parsestate = scstable; + break; - case CASE_ESC_IGNORE: - /* unknown escape sequence */ - parsestate = eigtable; - break; + case CASE_ESC_IGNORE: + /* unknown escape sequence */ + parsestate = eigtable; + break; - case CASE_ESC_DIGIT: - /* digit in csi or dec mode */ - if((row = param[nparam - 1]) == DEFAULT) - row = 0; - param[nparam - 1] = 10 * row + (c - '0'); - if (param[nparam - 1] > 65535) - param[nparam - 1] = 65535; - break; + case CASE_ESC_DIGIT: + /* digit in csi or dec mode */ + if ((row = param[nparam - 1]) == DEFAULT) + row = 0; + param[nparam - 1] = 10 * row + (c - '0'); + if (param[nparam - 1] > 65535) + param[nparam - 1] = 65535; + if (parsestate == csi_table) + parsestate = csi2_table; + break; - case CASE_ESC_SEMI: - /* semicolon in csi or dec mode */ - if (nparam < NPARAM) - param[nparam++] = DEFAULT; - break; + case CASE_ESC_SEMI: + /* semicolon in csi or dec mode */ + if (nparam < NPARAM) + param[nparam++] = DEFAULT; + if (parsestate == csi_table) + parsestate = csi2_table; + break; - case CASE_DEC_STATE: - /* enter dec mode */ - parsestate = dec_table; - break; + case CASE_DEC_STATE: + /* enter dec mode */ + parsestate = dec_table; + break; - case CASE_DEC2_STATE: - /* enter dec2 mode */ - parsestate = dec2_table; - break; + case CASE_DEC2_STATE: + /* enter dec2 mode */ + parsestate = dec2_table; + break; - case CASE_DEC3_STATE: - /* enter dec3 mode */ - parsestate = dec3_table; - break; + case CASE_DEC3_STATE: + /* enter dec3 mode */ + parsestate = dec3_table; + break; - case CASE_ICH: - /* ICH */ - if((row = param[0]) < 1) - row = 1; - InsertChar(screen, row); - parsestate = groundtable; - break; + case CASE_ICH: + /* ICH */ + if ((row = param[0]) < 1) + row = 1; + InsertChar(screen, row); + parsestate = groundtable; + break; - case CASE_CUU: - /* CUU */ - if((row = param[0]) < 1) - row = 1; - CursorUp(screen, row); - parsestate = groundtable; - break; + case CASE_CUU: + /* CUU */ + if ((row = param[0]) < 1) + row = 1; + CursorUp(screen, row); + parsestate = groundtable; + break; - case CASE_CUD: - /* CUD */ - if((row = param[0]) < 1) - row = 1; - CursorDown(screen, row); - parsestate = groundtable; - break; + case CASE_CUD: + /* CUD */ + if ((row = param[0]) < 1) + row = 1; + CursorDown(screen, row); + parsestate = groundtable; + break; - case CASE_CUF: - /* CUF */ - if((col = param[0]) < 1) - col = 1; - CursorForward(screen, col); - parsestate = groundtable; - break; + case CASE_CUF: + /* CUF */ + if ((col = param[0]) < 1) + col = 1; + CursorForward(screen, col); + parsestate = groundtable; + break; - case CASE_CUB: - /* CUB */ - if((col = param[0]) < 1) - col = 1; - CursorBack(screen, col); - parsestate = groundtable; - break; + case CASE_CUB: + /* CUB */ + if ((col = param[0]) < 1) + col = 1; + CursorBack(screen, col); + parsestate = groundtable; + break; - case CASE_CUP: - /* CUP | HVP */ - if_OPT_XMC_GLITCH(screen,{ - Jump_XMC(screen); - }) - if((row = param[0]) < 1) - row = 1; - if(nparam < 2 || (col = param[1]) < 1) - col = 1; - CursorSet(screen, row-1, col-1, term->flags); - parsestate = groundtable; - break; + case CASE_CUP: + /* CUP | HVP */ + if_OPT_XMC_GLITCH(screen, { + Jump_XMC(screen); + }); + if ((row = param[0]) < 1) + row = 1; + if (nparam < 2 || (col = param[1]) < 1) + col = 1; + CursorSet(screen, row - 1, col - 1, term->flags); + parsestate = groundtable; + break; - case CASE_VPA: - if((row = param[0]) < 1) - row = 1; - CursorSet(screen, row-1, screen->cur_col, term->flags); - parsestate = groundtable; - break; + case CASE_VPA: + if ((row = param[0]) < 1) + row = 1; + CursorSet(screen, row - 1, screen->cur_col, term->flags); + parsestate = groundtable; + break; - case CASE_HPA: - /* HPA | CHA */ - if((col = param[0]) < 1) - col = 1; - CursorSet(screen, screen->cur_row, col-1, term->flags); - parsestate = groundtable; - break; + case CASE_HPA: + /* HPA | CHA */ + if ((col = param[0]) < 1) + col = 1; + CursorSet(screen, screen->cur_row, col - 1, term->flags); + parsestate = groundtable; + break; - case CASE_HP_BUGGY_LL: - /* Some HP-UX applications have the bug that they - assume ESC F goes to the lower left corner of - the screen, regardless of what terminfo says. */ - if (screen->hp_ll_bc) - CursorSet(screen, screen->max_row, 0, term->flags); - parsestate = groundtable; - break; + case CASE_HP_BUGGY_LL: + /* Some HP-UX applications have the bug that they + assume ESC F goes to the lower left corner of + the screen, regardless of what terminfo says. */ + if (screen->hp_ll_bc) + CursorSet(screen, screen->max_row, 0, term->flags); + parsestate = groundtable; + break; - case CASE_ED: - /* ED */ - do_erase_display(screen, param[0], OFF_PROTECT); - parsestate = groundtable; - break; + case CASE_ED: + /* ED */ + do_erase_display(screen, param[0], OFF_PROTECT); + parsestate = groundtable; + break; - case CASE_EL: - /* EL */ - do_erase_line(screen, param[0], OFF_PROTECT); - parsestate = groundtable; - break; + case CASE_EL: + /* EL */ + do_erase_line(screen, param[0], OFF_PROTECT); + parsestate = groundtable; + break; - case CASE_ECH: - /* ECH */ - ClearRight(screen, param[0] < 1 ? 1 : param[0]); - parsestate = groundtable; - break; + case CASE_ECH: + /* ECH */ + ClearRight(screen, param[0] < 1 ? 1 : param[0]); + parsestate = groundtable; + break; - case CASE_IL: - /* IL */ - if((row = param[0]) < 1) - row = 1; - InsertLine(screen, row); - parsestate = groundtable; - break; + case CASE_IL: + /* IL */ + if ((row = param[0]) < 1) + row = 1; + InsertLine(screen, row); + parsestate = groundtable; + break; - case CASE_DL: - /* DL */ - if((row = param[0]) < 1) - row = 1; - DeleteLine(screen, row); - parsestate = groundtable; - break; + case CASE_DL: + /* DL */ + if ((row = param[0]) < 1) + row = 1; + DeleteLine(screen, row); + parsestate = groundtable; + break; - case CASE_DCH: - /* DCH */ - if((row = param[0]) < 1) - row = 1; - DeleteChar(screen, row); - parsestate = groundtable; - break; + case CASE_DCH: + /* DCH */ + if ((row = param[0]) < 1) + row = 1; + DeleteChar(screen, row); + parsestate = groundtable; + break; - case CASE_TRACK_MOUSE: - if (screen->send_mouse_pos == VT200_HIGHLIGHT_MOUSE - || nparam > 1) { - /* Track mouse as long as in window and between - * specified rows - */ - TrackMouse(param[0], - param[2]-1, param[1]-1, - param[3]-1, param[4]-2); - } else { - /* SD */ - if((count = param[0]) < 1) - count = 1; - RevScroll(screen, count); - do_xevents(); - } - parsestate = groundtable; - break; + case CASE_TRACK_MOUSE: + if (screen->send_mouse_pos == VT200_HIGHLIGHT_MOUSE + || nparam > 1) { + /* Track mouse as long as in window and between + * specified rows + */ + TrackMouse(param[0], + param[2] - 1, param[1] - 1, + param[3] - 1, param[4] - 2); + } else { + /* SD */ + if ((count = param[0]) < 1) + count = 1; + RevScroll(screen, count); + do_xevents(); + } + parsestate = groundtable; + break; - case CASE_DECID: - if_OPT_VT52_MODE(screen,{ - unparseputc(ESC, screen->respond); - unparseputc('/', screen->respond); - unparseputc('Z', screen->respond); - parsestate = groundtable; - break; - }) - param[0] = -1; /* Default ID parameter */ - /* FALLTHRU */ - case CASE_DA1: - /* DA1 */ - if (param[0] <= 1) { /* less than means DEFAULT */ - count = 0; - reply.a_type = CSI; - reply.a_pintro = '?'; - - /* The first param corresponds to the highest - * operating level (i.e., service level) of the - * emulation. A DEC terminal can be setup to - * respond with a different DA response, but - * there's no control sequence that modifies this. - * We set it via a resource. - */ - if (screen->terminal_id < 200) { - switch (screen->terminal_id) { - case 102: - reply.a_param[count++] = 6; /* VT102 */ - break; - case 101: - reply.a_param[count++] = 1; /* VT101 */ - reply.a_param[count++] = 0; /* no options */ - break; - default: /* VT100 */ - reply.a_param[count++] = 1; /* VT100 */ - reply.a_param[count++] = 2; /* AVO */ - break; - } - } else { - reply.a_param[count++] = 60 + screen->terminal_id/100; - reply.a_param[count++] = 1; /* 132-columns */ - reply.a_param[count++] = 2; /* printer */ - reply.a_param[count++] = 6; /* selective-erase */ + case CASE_DECID: + if_OPT_VT52_MODE(screen, { + unparseputc(ESC, screen->respond); + unparseputc('/', screen->respond); + unparseputc('Z', screen->respond); + parsestate = groundtable; + break; + }); + param[0] = -1; /* Default ID parameter */ + /* FALLTHRU */ + case CASE_DA1: + /* DA1 */ + if (param[0] <= 1) { /* less than means DEFAULT */ + count = 0; + reply.a_type = CSI; + reply.a_pintro = '?'; + + /* The first param corresponds to the highest + * operating level (i.e., service level) of the + * emulation. A DEC terminal can be setup to + * respond with a different DA response, but + * there's no control sequence that modifies this. + * We set it via a resource. + */ + if (screen->terminal_id < 200) { + switch (screen->terminal_id) { + case 102: + reply.a_param[count++] = 6; /* VT102 */ + break; + case 101: + reply.a_param[count++] = 1; /* VT101 */ + reply.a_param[count++] = 0; /* no options */ + break; + default: /* VT100 */ + reply.a_param[count++] = 1; /* VT100 */ + reply.a_param[count++] = 2; /* AVO */ + break; + } + } else { + reply.a_param[count++] = 60 + screen->terminal_id / 100; + reply.a_param[count++] = 1; /* 132-columns */ + reply.a_param[count++] = 2; /* printer */ + reply.a_param[count++] = 6; /* selective-erase */ #if OPT_SUNPC_KBD - if (term->keyboard.type == keyboardIsVT220) + if (term->keyboard.type == keyboardIsVT220) #endif - reply.a_param[count++] = 8; /* user-defined-keys */ - reply.a_param[count++] = 9; /* national replacement charsets */ - reply.a_param[count++] = 15; /* technical characters */ - if_OPT_ISO_COLORS(screen,{ - reply.a_param[count++] = 22; /* ANSI color, VT525 */ - }) + reply.a_param[count++] = 8; /* user-defined-keys */ + reply.a_param[count++] = 9; /* national replacement charsets */ + reply.a_param[count++] = 15; /* technical characters */ + if_OPT_ISO_COLORS(screen, { + reply.a_param[count++] = 22; /* ANSI color, VT525 */ + }); #if OPT_DEC_LOCATOR - reply.a_param[count++] = 29; /* ANSI text locator */ -#endif -#if 0 /* not sure how this fits in */ - if_OPT_ISO_COLORS(screen,{ - reply.a_param[count++] = 30 + - (((term->flags & FG_COLOR) != 0 - && (term->cur_foreground >= 0)) - ? term->cur_foreground - : 9); - reply.a_param[count++] = 40 + - (((term->flags & BG_COLOR) != 0 - && (term->cur_background >= 0)) - ? term->cur_background - : 9); - }) + reply.a_param[count++] = 29; /* ANSI text locator */ #endif - } - reply.a_nparam = count; - reply.a_inters = 0; - reply.a_final = 'c'; - unparseseq(&reply, screen->respond); - } - parsestate = groundtable; - break; + } + reply.a_nparam = count; + reply.a_inters = 0; + reply.a_final = 'c'; + unparseseq(&reply, screen->respond); + } + parsestate = groundtable; + break; - case CASE_DA2: - /* DA2 */ - if (param[0] <= 0) { /* less than means DEFAULT */ - count = 0; - reply.a_type = CSI; - reply.a_pintro = '>'; - - if (screen->terminal_id >= 200) - reply.a_param[count++] = 1; /* VT220 */ - else - reply.a_param[count++] = 0; /* VT100 (nonstandard) */ - reply.a_param[count++] = XTERM_PATCH; /* Version */ - reply.a_param[count++] = 0; /* options (none) */ - reply.a_nparam = count; - reply.a_inters = 0; - reply.a_final = 'c'; - unparseseq(&reply, screen->respond); - } - parsestate = groundtable; - break; + case CASE_DA2: + /* DA2 */ + if (param[0] <= 0) { /* less than means DEFAULT */ + count = 0; + reply.a_type = CSI; + reply.a_pintro = '>'; - case CASE_DECRPTUI: - /* DECRPTUI */ - if ((screen->terminal_id >= 400) - && (param[0] <= 0)) { /* less than means DEFAULT */ - unparseputc1(DCS, screen->respond); - unparseputc('!', screen->respond); - unparseputc('|', screen->respond); - unparseputc('0', screen->respond); - unparseputc1(ST, screen->respond); - } - parsestate = groundtable; - break; + if (screen->terminal_id >= 200) + reply.a_param[count++] = 1; /* VT220 */ + else + reply.a_param[count++] = 0; /* VT100 (nonstandard) */ + reply.a_param[count++] = XTERM_PATCH; /* Version */ + reply.a_param[count++] = 0; /* options (none) */ + reply.a_nparam = count; + reply.a_inters = 0; + reply.a_final = 'c'; + unparseseq(&reply, screen->respond); + } + parsestate = groundtable; + break; - case CASE_TBC: - /* TBC */ - if ((row = param[0]) <= 0) /* less than means default */ - TabClear(term->tabs, screen->cur_col); - else if (row == 3) - TabZonk(term->tabs); - parsestate = groundtable; - break; + case CASE_DECRPTUI: + /* DECRPTUI */ + if ((screen->terminal_id >= 400) + && (param[0] <= 0)) { /* less than means DEFAULT */ + unparseputc1(DCS, screen->respond); + unparseputc('!', screen->respond); + unparseputc('|', screen->respond); + unparseputc('0', screen->respond); + unparseputc1(ST, screen->respond); + } + parsestate = groundtable; + break; - case CASE_SET: - /* SET */ - ansi_modes(term, bitset); - parsestate = groundtable; - break; + case CASE_TBC: + /* TBC */ + if ((row = param[0]) <= 0) /* less than means default */ + TabClear(term->tabs, screen->cur_col); + else if (row == 3) + TabZonk(term->tabs); + parsestate = groundtable; + break; - case CASE_RST: - /* RST */ - ansi_modes(term, bitclr); - parsestate = groundtable; - break; + case CASE_SET: + /* SET */ + ansi_modes(term, bitset); + parsestate = groundtable; + break; - case CASE_SGR: - /* SGR */ - for (row=0; row<nparam; ++row) { - if_OPT_XMC_GLITCH(screen,{ - Mark_XMC(screen,param[row]); - }) - switch (param[row]) { - case DEFAULT: - case 0: - term->flags &= - ~(INVERSE|BOLD|BLINK|UNDERLINE|INVISIBLE); - if_OPT_ISO_COLORS(screen,{reset_SGR_Colors();}) - break; - case 1: /* Bold */ - term->flags |= BOLD; - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - break; - case 5: /* Blink */ - term->flags |= BLINK; - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - break; - case 4: /* Underscore */ - term->flags |= UNDERLINE; - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - break; - case 7: - term->flags |= INVERSE; - if_OPT_ISO_COLORS(screen,{setExtendedBG();}) - break; - case 8: - term->flags |= INVISIBLE; - break; - case 22: /* reset 'bold' */ - term->flags &= ~BOLD; - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - break; - case 24: - term->flags &= ~UNDERLINE; - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - break; - case 25: /* reset 'blink' */ - term->flags &= ~BLINK; - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - break; - case 27: - term->flags &= ~INVERSE; - if_OPT_ISO_COLORS(screen,{setExtendedBG();}) - break; - case 28: - term->flags &= ~INVISIBLE; - break; - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - if_OPT_ISO_COLORS(screen,{ - term->sgr_foreground = (param[row] - 30); - term->sgr_extended = 0; - setExtendedFG(); - }) - break; - case 38: - /* This is more complicated than I'd - like, but it should properly eat all - the parameters for unsupported modes - */ - if_OPT_ISO_COLORS(screen,{ - row++; - if (row < nparam) { - switch(param[row]) { - case 5: - row++; - if (row < nparam && - param[row] < NUM_ANSI_COLORS) { - term->sgr_foreground = param[row]; - term->sgr_extended = 1; - setExtendedFG(); - } - break; - default: - row += 7; - break; - } - } - }) - break; - case 39: - if_OPT_ISO_COLORS(screen,{ - reset_SGR_Foreground(); - }) - break; - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - if_OPT_ISO_COLORS(screen,{ - term->sgr_background = (param[row] - 40); - setExtendedBG(); - }) - break; - case 48: - if_OPT_ISO_COLORS(screen,{ - row++; - if (row < nparam) { - switch(param[row]) { - case 5: - row++; - if (row < nparam && - param[row] < NUM_ANSI_COLORS) { - term->sgr_background = param[row]; - setExtendedBG(); - } - break; - default: - row += 7; - break; - } - } - }) - break; - case 49: - if_OPT_ISO_COLORS(screen,{ - reset_SGR_Background(); - }) - break; - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - if_OPT_AIX_COLORS(screen,{ - term->sgr_foreground = (param[row] - 90 + 8); - term->sgr_extended = 0; - setExtendedFG(); - }) - break; - case 100: -#if !OPT_AIX_COLORS - if_OPT_ISO_COLORS(screen,{ - reset_SGR_Foreground(); - reset_SGR_Background(); - }) - break; -#endif - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - if_OPT_AIX_COLORS(screen,{ - term->sgr_background = (param[row] - 100 + 8); - setExtendedBG(); - }) - break; - } - } - parsestate = groundtable; - break; + case CASE_RST: + /* RST */ + ansi_modes(term, bitclr); + parsestate = groundtable; + break; - /* DSR (except for the '?') is a superset of CPR */ - case CASE_DSR: - private_function = True; - - /* FALLTHRU */ - case CASE_CPR: - count = 0; - reply.a_type = CSI; - reply.a_pintro = private_function ? '?' : 0; - reply.a_inters = 0; - reply.a_final = 'n'; - - switch (param[0]) { - case 5: - /* operating status */ - reply.a_param[count++] = 0; /* (no malfunction ;-) */ - break; - case 6: - /* CPR */ - /* DECXCPR (with page=0) */ - reply.a_param[count++] = screen->cur_row + 1; - reply.a_param[count++] = screen->cur_col + 1; - reply.a_final = 'R'; - break; - case 15: - /* printer status */ - reply.a_param[count++] = 13; /* implement printer */ + case CASE_SGR: + /* SGR */ + for (row = 0; row < nparam; ++row) { + if_OPT_XMC_GLITCH(screen, { + Mark_XMC(screen, param[row]); + }); + switch (param[row]) { + case DEFAULT: + case 0: + term->flags &= + ~(INVERSE | BOLD | BLINK | UNDERLINE | INVISIBLE); + if_OPT_ISO_COLORS(screen, { + reset_SGR_Colors(); + }); + break; + case 1: /* Bold */ + term->flags |= BOLD; + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + break; + case 5: /* Blink */ + term->flags |= BLINK; + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + break; + case 4: /* Underscore */ + term->flags |= UNDERLINE; + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + break; + case 7: + term->flags |= INVERSE; + if_OPT_ISO_COLORS(screen, { + setExtendedBG(); + }); + break; + case 8: + term->flags |= INVISIBLE; + break; + case 22: /* reset 'bold' */ + term->flags &= ~BOLD; + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + break; + case 24: + term->flags &= ~UNDERLINE; + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + break; + case 25: /* reset 'blink' */ + term->flags &= ~BLINK; + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + break; + case 27: + term->flags &= ~INVERSE; + if_OPT_ISO_COLORS(screen, { + setExtendedBG(); + }); + break; + case 28: + term->flags &= ~INVISIBLE; + break; + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + if_OPT_ISO_COLORS(screen, { + term->sgr_foreground = (param[row] - 30); + term->sgr_extended = 0; + setExtendedFG(); + }); + break; + case 38: + /* This is more complicated than I'd + like, but it should properly eat all + the parameters for unsupported modes + */ + if_OPT_ISO_COLORS(screen, { + row++; + if (row < nparam) { + switch (param[row]) { + case 5: + row++; + if (row < nparam && + param[row] < NUM_ANSI_COLORS) { + term->sgr_foreground = param[row]; + term->sgr_extended = 1; + setExtendedFG(); + } break; - case 25: - /* UDK status */ - reply.a_param[count++] = 20; /* UDK always unlocked */ + default: + row += 7; break; - case 26: - /* keyboard status */ - reply.a_param[count++] = 27; - reply.a_param[count++] = 1; /* North American */ - if (screen->terminal_id >= 400) { - reply.a_param[count++] = 0; /* ready */ - reply.a_param[count++] = 0; /* LK201 */ + } + } + }); + break; + case 39: + if_OPT_ISO_COLORS(screen, { + reset_SGR_Foreground(); + }); + break; + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + if_OPT_ISO_COLORS(screen, { + term->sgr_background = (param[row] - 40); + setExtendedBG(); + }); + break; + case 48: + if_OPT_ISO_COLORS(screen, { + row++; + if (row < nparam) { + switch (param[row]) { + case 5: + row++; + if (row < nparam && + param[row] < NUM_ANSI_COLORS) { + term->sgr_background = param[row]; + setExtendedBG(); } break; - case 53: - /* Locator status */ + default: + row += 7; + break; + } + } + }); + break; + case 49: + if_OPT_ISO_COLORS(screen, { + reset_SGR_Background(); + }); + break; + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + if_OPT_AIX_COLORS(screen, { + term->sgr_foreground = (param[row] - 90 + 8); + term->sgr_extended = 0; + setExtendedFG(); + }); + break; + case 100: +#if !OPT_AIX_COLORS + if_OPT_ISO_COLORS(screen, { + reset_SGR_Foreground(); + reset_SGR_Background(); + }); + break; +#endif + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + if_OPT_AIX_COLORS(screen, { + term->sgr_background = (param[row] - 100 + 8); + setExtendedBG(); + }); + break; + } + } + parsestate = groundtable; + break; + + /* DSR (except for the '?') is a superset of CPR */ + case CASE_DSR: + private_function = True; + + /* FALLTHRU */ + case CASE_CPR: + count = 0; + reply.a_type = CSI; + reply.a_pintro = private_function ? '?' : 0; + reply.a_inters = 0; + reply.a_final = 'n'; + + switch (param[0]) { + case 5: + /* operating status */ + reply.a_param[count++] = 0; /* (no malfunction ;-) */ + break; + case 6: + /* CPR */ + /* DECXCPR (with page=0) */ + reply.a_param[count++] = screen->cur_row + 1; + reply.a_param[count++] = screen->cur_col + 1; + reply.a_final = 'R'; + break; + case 15: + /* printer status */ + reply.a_param[count++] = 13; /* implement printer */ + break; + case 25: + /* UDK status */ + reply.a_param[count++] = 20; /* UDK always unlocked */ + break; + case 26: + /* keyboard status */ + reply.a_param[count++] = 27; + reply.a_param[count++] = 1; /* North American */ + if (screen->terminal_id >= 400) { + reply.a_param[count++] = 0; /* ready */ + reply.a_param[count++] = 0; /* LK201 */ + } + break; + case 53: + /* Locator status */ #if OPT_DEC_LOCATOR - reply.a_param[count++] = 50; /* locator ready */ + reply.a_param[count++] = 50; /* locator ready */ #else - reply.a_param[count++] = 53; /* no locator */ + reply.a_param[count++] = 53; /* no locator */ #endif - break; - } + break; + } - if ((reply.a_nparam = count) != 0) - unparseseq(&reply, screen->respond); + if ((reply.a_nparam = count) != 0) + unparseseq(&reply, screen->respond); - parsestate = groundtable; - private_function = False; - break; + parsestate = groundtable; + private_function = False; + break; - case CASE_MC: - xtermMediaControl(param[0], FALSE); - parsestate = groundtable; - break; + case CASE_MC: + xtermMediaControl(param[0], FALSE); + parsestate = groundtable; + break; - case CASE_DEC_MC: - xtermMediaControl(param[0], TRUE); - parsestate = groundtable; - break; + case CASE_DEC_MC: + xtermMediaControl(param[0], TRUE); + parsestate = groundtable; + break; - case CASE_HP_MEM_LOCK: - case CASE_HP_MEM_UNLOCK: - if(screen->scroll_amt) - FlushScroll(screen); - if (parsestate[c] == CASE_HP_MEM_LOCK) - screen->top_marg = screen->cur_row; - else - screen->top_marg = 0; - parsestate = groundtable; - break; + case CASE_HP_MEM_LOCK: + case CASE_HP_MEM_UNLOCK: + if (screen->scroll_amt) + FlushScroll(screen); + if (parsestate[c] == CASE_HP_MEM_LOCK) + screen->top_marg = screen->cur_row; + else + screen->top_marg = 0; + parsestate = groundtable; + break; - case CASE_DECSTBM: - /* DECSTBM - set scrolling region */ - if((top = param[0]) < 1) - top = 1; - if(nparam < 2 || (bot = param[1]) == DEFAULT - || bot > screen->max_row + 1 - || bot == 0) - bot = screen->max_row+1; - if (bot > top) { - if(screen->scroll_amt) - FlushScroll(screen); - screen->top_marg = top-1; - screen->bot_marg = bot-1; - CursorSet(screen, 0, 0, term->flags); - } - parsestate = groundtable; - break; + case CASE_DECSTBM: + /* DECSTBM - set scrolling region */ + if ((top = param[0]) < 1) + top = 1; + if (nparam < 2 || (bot = param[1]) == DEFAULT + || bot > screen->max_row + 1 + || bot == 0) + bot = screen->max_row + 1; + if (bot > top) { + if (screen->scroll_amt) + FlushScroll(screen); + screen->top_marg = top - 1; + screen->bot_marg = bot - 1; + CursorSet(screen, 0, 0, term->flags); + } + parsestate = groundtable; + break; - case CASE_DECREQTPARM: - /* DECREQTPARM */ - if (screen->terminal_id < 200) { /* VT102 */ - if ((row = param[0]) == DEFAULT) - row = 0; - if (row == 0 || row == 1) { - reply.a_type = CSI; - reply.a_pintro = 0; - reply.a_nparam = 7; - reply.a_param[0] = row + 2; - reply.a_param[1] = 1; /* no parity */ - reply.a_param[2] = 1; /* eight bits */ - reply.a_param[3] = 128; /* transmit 38.4k baud */ - reply.a_param[4] = 128; /* receive 38.4k baud */ - reply.a_param[5] = 1; /* clock multiplier ? */ - reply.a_param[6] = 0; /* STP flags ? */ - reply.a_inters = 0; - reply.a_final = 'x'; - unparseseq(&reply, screen->respond); - } - } - parsestate = groundtable; - break; + case CASE_DECREQTPARM: + /* DECREQTPARM */ + if (screen->terminal_id < 200) { /* VT102 */ + if ((row = param[0]) == DEFAULT) + row = 0; + if (row == 0 || row == 1) { + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 7; + reply.a_param[0] = row + 2; + reply.a_param[1] = 1; /* no parity */ + reply.a_param[2] = 1; /* eight bits */ + reply.a_param[3] = 128; /* transmit 38.4k baud */ + reply.a_param[4] = 128; /* receive 38.4k baud */ + reply.a_param[5] = 1; /* clock multiplier ? */ + reply.a_param[6] = 0; /* STP flags ? */ + reply.a_inters = 0; + reply.a_final = 'x'; + unparseseq(&reply, screen->respond); + } + } + parsestate = groundtable; + break; - case CASE_DECSET: - /* DECSET */ - dpmodes(term, bitset); - parsestate = groundtable; + case CASE_DECSET: + /* DECSET */ + dpmodes(term, bitset); + parsestate = groundtable; #if OPT_TEK4014 - if(screen->TekEmu) - return; + if (screen->TekEmu) + return; #endif - break; + break; - case CASE_DECRST: - /* DECRST */ - dpmodes(term, bitclr); + case CASE_DECRST: + /* DECRST */ + dpmodes(term, bitclr); #if OPT_VT52_MODE - if (screen->ansi_level == 0) - groundtable = vt52_table; - else if (screen->terminal_id >= 100) - groundtable = ansi_table; + if (screen->ansi_level == 0) + groundtable = vt52_table; + else if (screen->terminal_id >= 100) + groundtable = ansi_table; #endif - parsestate = groundtable; - break; + parsestate = groundtable; + break; - case CASE_DECALN: - /* DECALN */ - if(screen->cursor_state) - HideCursor(); - for(row = screen->max_row ; row >= 0 ; row--) { - bzero(SCRN_BUF_ATTRS(screen, row), - col = screen->max_col + 1); - for(cp = SCRN_BUF_CHARS(screen, row) ; col > 0 ; col--) - *cp++ = (Char)'E'; - if_OPT_WIDE_CHARS(screen,{ - bzero(SCRN_BUF_WIDEC(screen, row), - screen->max_col+1); - }) - } - ScrnRefresh(screen, 0, 0, screen->max_row + 1, - screen->max_col + 1, False); - parsestate = groundtable; - break; + case CASE_DECALN: + /* DECALN */ + if (screen->cursor_state) + HideCursor(); + for (row = screen->max_row; row >= 0; row--) { + bzero(SCRN_BUF_ATTRS(screen, row), + col = screen->max_col + 1); + for (cp = SCRN_BUF_CHARS(screen, row); col > 0; col--) + *cp++ = (Char) 'E'; + if_OPT_WIDE_CHARS(screen, { + bzero(SCRN_BUF_WIDEC(screen, row), + screen->max_col + 1); + }); + } + ScrnRefresh(screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); + parsestate = groundtable; + break; - case CASE_GSETS: - TRACE(("CASE_GSETS(%d) = '%c'\n", scstype, c)); - screen->gsets[scstype] = c; - parsestate = groundtable; - break; + case CASE_GSETS: + TRACE(("CASE_GSETS(%d) = '%c'\n", scstype, c)); + screen->gsets[scstype] = c; + parsestate = groundtable; + break; - case CASE_DECSC: - /* DECSC */ - CursorSave(term); - parsestate = groundtable; - break; + case CASE_DECSC: + /* DECSC */ + CursorSave(term); + parsestate = groundtable; + break; - case CASE_DECRC: - /* DECRC */ - CursorRestore(term); - if_OPT_ISO_COLORS(screen,{setExtendedFG();}) - parsestate = groundtable; - break; + case CASE_DECRC: + /* DECRC */ + CursorRestore(term); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(); + }); + parsestate = groundtable; + break; - case CASE_DECKPAM: - /* DECKPAM */ - term->keyboard.flags |= MODE_DECKPAM; - update_appkeypad(); - parsestate = groundtable; - break; + case CASE_DECKPAM: + /* DECKPAM */ + term->keyboard.flags |= MODE_DECKPAM; + update_appkeypad(); + parsestate = groundtable; + break; - case CASE_DECKPNM: - /* DECKPNM */ - term->keyboard.flags &= ~MODE_DECKPAM; - update_appkeypad(); - parsestate = groundtable; - break; + case CASE_DECKPNM: + /* DECKPNM */ + term->keyboard.flags &= ~MODE_DECKPAM; + update_appkeypad(); + parsestate = groundtable; + break; - case CASE_CSI_QUOTE_STATE: - parsestate = csi_quo_table; - break; + case CASE_CSI_QUOTE_STATE: + parsestate = csi_quo_table; + break; - /* the ANSI conformance levels are noted in the - * vt400 user's manual (I assume they're the non-DEC - * equivalents of DECSCL - T.Dickey) - */ - case CASE_ANSI_LEVEL_1: - if (screen->terminal_id >= 100) { - screen->ansi_level = 1; - show_8bit_control(False); + /* the ANSI conformance levels are noted in the + * vt400 user's manual (I assume they're the non-DEC + * equivalents of DECSCL - T.Dickey) + */ + case CASE_ANSI_LEVEL_1: + if (screen->terminal_id >= 100) { + screen->ansi_level = 1; + show_8bit_control(False); #if OPT_VT52_MODE - groundtable = - parsestate = ansi_table; + groundtable = + parsestate = ansi_table; #endif - } - break; - case CASE_ANSI_LEVEL_2: - if (screen->terminal_id >= 200) - screen->ansi_level = 2; - break; - case CASE_ANSI_LEVEL_3: - if (screen->terminal_id >= 300) - screen->ansi_level = 3; - break; + } + parsestate = groundtable; + break; - case CASE_DECSCL: - if (param[0] >= 61 && param[0] <= 63) { - screen->ansi_level = param[0] - 60; - if (param[0] > 61) { - if (param[1] == 1) - show_8bit_control(False); - else if (param[1] == 0 || param[1] == 2) - show_8bit_control(True); - } - } - parsestate = groundtable; - break; + case CASE_ANSI_LEVEL_2: + if (screen->terminal_id >= 200) + screen->ansi_level = 2; + parsestate = groundtable; + break; - case CASE_DECSCA: - screen->protected_mode = DEC_PROTECT; - if (param[0] <= 0 || param[0] == 2) - term->flags &= ~PROTECTED; - else if (param[0] == 1) - term->flags |= PROTECTED; - parsestate = groundtable; - break; + case CASE_ANSI_LEVEL_3: + if (screen->terminal_id >= 300) + screen->ansi_level = 3; + parsestate = groundtable; + break; - case CASE_DECSED: - /* DECSED */ - do_erase_display(screen, param[0], DEC_PROTECT); - parsestate = groundtable; - break; + case CASE_DECSCL: + if (param[0] >= 61 && param[0] <= 63) { + screen->ansi_level = param[0] - 60; + if (param[0] > 61) { + if (param[1] == 1) + show_8bit_control(False); + else if (param[1] == 0 || param[1] == 2) + show_8bit_control(True); + } + } + parsestate = groundtable; + break; - case CASE_DECSEL: - /* DECSEL */ - do_erase_line(screen, param[0], DEC_PROTECT); - parsestate = groundtable; - break; + case CASE_DECSCA: + screen->protected_mode = DEC_PROTECT; + if (param[0] <= 0 || param[0] == 2) + term->flags &= ~PROTECTED; + else if (param[0] == 1) + term->flags |= PROTECTED; + parsestate = groundtable; + break; - case CASE_ST: - if (!string_used) - break; - string_area[--string_used] = '\0'; - switch (string_mode) { - case APC: - /* ignored */ - break; - case DCS: - do_dcs(string_area, string_used); - break; - case OSC: - do_osc(string_area, string_used, ST); - break; - case PM: - /* ignored */ - break; - case SOS: - /* ignored */ - break; - } - parsestate = groundtable; - break; + case CASE_DECSED: + /* DECSED */ + do_erase_display(screen, param[0], DEC_PROTECT); + parsestate = groundtable; + break; - case CASE_SOS: - /* Start of String */ - string_mode = SOS; - parsestate = sos_table; - break; + case CASE_DECSEL: + /* DECSEL */ + do_erase_line(screen, param[0], DEC_PROTECT); + parsestate = groundtable; + break; - case CASE_PM: - /* Privacy Message */ - string_mode = PM; - parsestate = sos_table; - break; + case CASE_ST: + if (!string_used) + break; + string_area[--string_used] = '\0'; + switch (string_mode) { + case APC: + /* ignored */ + break; + case DCS: + do_dcs(string_area, string_used); + break; + case OSC: + do_osc(string_area, string_used, ST); + break; + case PM: + /* ignored */ + break; + case SOS: + /* ignored */ + break; + } + parsestate = groundtable; + break; - case CASE_DCS: - /* Device Control String */ - string_mode = DCS; - parsestate = sos_table; - break; + case CASE_SOS: + /* Start of String */ + string_mode = SOS; + parsestate = sos_table; + break; - case CASE_APC: - /* Application Program Command */ - string_mode = APC; - parsestate = sos_table; - break; + case CASE_PM: + /* Privacy Message */ + string_mode = PM; + parsestate = sos_table; + break; - case CASE_SPA: - screen->protected_mode = ISO_PROTECT; - term->flags |= PROTECTED; - parsestate = groundtable; - break; + case CASE_DCS: + /* Device Control String */ + string_mode = DCS; + parsestate = sos_table; + break; - case CASE_EPA: - term->flags &= ~PROTECTED; - parsestate = groundtable; - break; + case CASE_APC: + /* Application Program Command */ + string_mode = APC; + parsestate = sos_table; + break; - case CASE_SU: - /* SU */ - if((count = param[0]) < 1) - count = 1; - xtermScroll(screen, count); - parsestate = groundtable; - break; + case CASE_SPA: + screen->protected_mode = ISO_PROTECT; + term->flags |= PROTECTED; + parsestate = groundtable; + break; - case CASE_IND: - /* IND */ - xtermIndex(screen, 1); - do_xevents(); - parsestate = groundtable; - break; + case CASE_EPA: + term->flags &= ~PROTECTED; + parsestate = groundtable; + break; - case CASE_CPL: - /* cursor prev line */ - CursorPrevLine(screen, param[0]); - parsestate = groundtable; - break; + case CASE_SU: + /* SU */ + if ((count = param[0]) < 1) + count = 1; + xtermScroll(screen, count); + parsestate = groundtable; + break; - case CASE_CNL: - /* cursor next line */ - CursorNextLine(screen, param[0]); - parsestate = groundtable; - break; + case CASE_IND: + /* IND */ + xtermIndex(screen, 1); + do_xevents(); + parsestate = groundtable; + break; - case CASE_NEL: - /* NEL */ - xtermIndex(screen, 1); - CarriageReturn(screen); - do_xevents(); - parsestate = groundtable; - break; + case CASE_CPL: + /* cursor prev line */ + CursorPrevLine(screen, param[0]); + parsestate = groundtable; + break; - case CASE_HTS: - /* HTS */ - TabSet(term->tabs, screen->cur_col); - parsestate = groundtable; - break; + case CASE_CNL: + /* cursor next line */ + CursorNextLine(screen, param[0]); + parsestate = groundtable; + break; - case CASE_RI: - /* RI */ - RevIndex(screen, 1); - parsestate = groundtable; - break; + case CASE_NEL: + /* NEL */ + xtermIndex(screen, 1); + CarriageReturn(screen); + do_xevents(); + parsestate = groundtable; + break; - case CASE_SS2: - /* SS2 */ - screen->curss = 2; - parsestate = groundtable; - break; + case CASE_HTS: + /* HTS */ + TabSet(term->tabs, screen->cur_col); + parsestate = groundtable; + break; - case CASE_SS3: - /* SS3 */ - screen->curss = 3; - parsestate = groundtable; - break; + case CASE_RI: + /* RI */ + RevIndex(screen, 1); + parsestate = groundtable; + break; - case CASE_CSI_STATE: - /* enter csi state */ - nparam = 1; - param[0] = DEFAULT; - parsestate = csi_table; - break; + case CASE_SS2: + /* SS2 */ + screen->curss = 2; + parsestate = groundtable; + break; - case CASE_ESC_SP_STATE: - /* esc space */ - parsestate = esc_sp_table; - break; + case CASE_SS3: + /* SS3 */ + screen->curss = 3; + parsestate = groundtable; + break; - case CASE_CSI_EX_STATE: - /* csi exclamation */ - parsestate = csi_ex_table; - break; + case CASE_CSI_STATE: + /* enter csi state */ + nparam = 1; + param[0] = DEFAULT; + parsestate = csi_table; + break; + case CASE_ESC_SP_STATE: + /* esc space */ + parsestate = esc_sp_table; + break; + + case CASE_CSI_EX_STATE: + /* csi exclamation */ + parsestate = csi_ex_table; + break; + #if OPT_DEC_LOCATOR - case CASE_CSI_TICK_STATE: - /* csi tick (') */ - parsestate = csi_tick_table; - break; + case CASE_CSI_TICK_STATE: + /* csi tick (') */ + parsestate = csi_tick_table; + break; - case CASE_DECEFR: - TRACE(("DECEFR - Enable Filter Rectangle\n")); - if (screen->send_mouse_pos == DEC_LOCATOR) { - MotionOff( screen, term ); - if((screen->loc_filter_top = param[0]) < 1) - screen->loc_filter_top = LOC_FILTER_POS; - if(nparam < 2 || (screen->loc_filter_left = param[1]) < 1) - screen->loc_filter_left = LOC_FILTER_POS; - if(nparam < 3 || (screen->loc_filter_bottom = param[2]) < 1) - screen->loc_filter_bottom = LOC_FILTER_POS; - if(nparam < 4 || (screen->loc_filter_right = param[3]) < 1) - screen->loc_filter_right = LOC_FILTER_POS; - InitLocatorFilter( term ); - } - parsestate = groundtable; - break; + case CASE_DECEFR: + TRACE(("DECEFR - Enable Filter Rectangle\n")); + if (screen->send_mouse_pos == DEC_LOCATOR) { + MotionOff(screen, term); + if ((screen->loc_filter_top = param[0]) < 1) + screen->loc_filter_top = LOC_FILTER_POS; + if (nparam < 2 || (screen->loc_filter_left = param[1]) < 1) + screen->loc_filter_left = LOC_FILTER_POS; + if (nparam < 3 || (screen->loc_filter_bottom = param[2]) < 1) + screen->loc_filter_bottom = LOC_FILTER_POS; + if (nparam < 4 || (screen->loc_filter_right = param[3]) < 1) + screen->loc_filter_right = LOC_FILTER_POS; + InitLocatorFilter(term); + } + parsestate = groundtable; + break; - case CASE_DECELR: - MotionOff( screen, term ); - if (param[0] <= 0 || param[0] > 2) { - screen->send_mouse_pos = MOUSE_OFF; - TRACE(("DECELR - Disable Locator Reports\n")); - } else { - TRACE(("DECELR - Enable Locator Reports\n")); - screen->send_mouse_pos = DEC_LOCATOR; - if (param[0] == 2) { - screen->locator_reset = TRUE; - } else { - screen->locator_reset = FALSE; - } - if (nparam < 2 || param[1] != 1) { - screen->locator_pixels = FALSE; - } else { - screen->locator_pixels = TRUE; - } - screen->loc_filter = FALSE; - } - parsestate = groundtable; - break; + case CASE_DECELR: + MotionOff(screen, term); + if (param[0] <= 0 || param[0] > 2) { + screen->send_mouse_pos = MOUSE_OFF; + TRACE(("DECELR - Disable Locator Reports\n")); + } else { + TRACE(("DECELR - Enable Locator Reports\n")); + screen->send_mouse_pos = DEC_LOCATOR; + if (param[0] == 2) { + screen->locator_reset = TRUE; + } else { + screen->locator_reset = FALSE; + } + if (nparam < 2 || param[1] != 1) { + screen->locator_pixels = FALSE; + } else { + screen->locator_pixels = TRUE; + } + screen->loc_filter = FALSE; + } + parsestate = groundtable; + break; - case CASE_DECSLE: - TRACE(("DECSLE - Select Locator Events\n")); - for (count=0; count<nparam; ++count) { - switch (param[count]) { - case DEFAULT: - case 0: - MotionOff( screen, term ); - screen->loc_filter = FALSE; - screen->locator_events = 0; - break; - case 1: - screen->locator_events |= LOC_BTNS_DN; - break; - case 2: - screen->locator_events &= ~LOC_BTNS_DN; - break; - case 3: - screen->locator_events |= LOC_BTNS_UP; - break; - case 4: - screen->locator_events &= ~LOC_BTNS_UP; - break; - } - } - parsestate = groundtable; - break; + case CASE_DECSLE: + TRACE(("DECSLE - Select Locator Events\n")); + for (count = 0; count < nparam; ++count) { + switch (param[count]) { + case DEFAULT: + case 0: + MotionOff(screen, term); + screen->loc_filter = FALSE; + screen->locator_events = 0; + break; + case 1: + screen->locator_events |= LOC_BTNS_DN; + break; + case 2: + screen->locator_events &= ~LOC_BTNS_DN; + break; + case 3: + screen->locator_events |= LOC_BTNS_UP; + break; + case 4: + screen->locator_events &= ~LOC_BTNS_UP; + break; + } + } + parsestate = groundtable; + break; - case CASE_DECRQLP: - TRACE(("DECRQLP - Request Locator Position\n")); - if( param[0] < 2 ) { - /* Issue DECLRP Locator Position Report */ - GetLocatorPosition( term ); - } - parsestate = groundtable; - break; -#endif /* OPT_DEC_LOCATOR */ + case CASE_DECRQLP: + TRACE(("DECRQLP - Request Locator Position\n")); + if (param[0] < 2) { + /* Issue DECLRP Locator Position Report */ + GetLocatorPosition(term); + } + parsestate = groundtable; + break; +#endif /* OPT_DEC_LOCATOR */ - case CASE_S7C1T: - show_8bit_control(False); - parsestate = groundtable; - break; + case CASE_S7C1T: + show_8bit_control(False); + parsestate = groundtable; + break; - case CASE_S8C1T: + case CASE_S8C1T: #if OPT_VT52_MODE - if (screen->ansi_level <= 1) - break; + if (screen->ansi_level <= 1) + break; #endif - show_8bit_control(True); - parsestate = groundtable; - break; + show_8bit_control(True); + parsestate = groundtable; + break; - case CASE_OSC: - /* Operating System Command */ - parsestate = sos_table; - string_mode = OSC; - break; + case CASE_OSC: + /* Operating System Command */ + parsestate = sos_table; + string_mode = OSC; + break; - case CASE_RIS: - /* RIS */ - VTReset(TRUE, TRUE); - parsestate = groundtable; - break; + case CASE_RIS: + /* RIS */ + VTReset(TRUE, TRUE); + parsestate = groundtable; + break; - case CASE_DECSTR: - /* DECSTR */ - VTReset(FALSE, FALSE); - parsestate = groundtable; - break; + case CASE_DECSTR: + /* DECSTR */ + VTReset(FALSE, FALSE); + parsestate = groundtable; + break; - case CASE_REP: - /* REP */ - if (lastchar >= 0 && - groundtable[E2A(lastchar)] == CASE_PRINT) { - IChar repeated[2]; - count = (param[0] < 1) ? 1 : param[0]; - repeated[0] = lastchar; - while (count-- > 0) { - dotext(screen, - screen->gsets[(int)(screen->curgl)], - repeated, 1); - } - } - parsestate = groundtable; - break; + case CASE_REP: + /* REP */ + if (lastchar >= 0 && + groundtable[E2A(lastchar)] == CASE_PRINT) { + IChar repeated[2]; + count = (param[0] < 1) ? 1 : param[0]; + repeated[0] = lastchar; + while (count-- > 0) { + dotext(screen, + screen->gsets[(int) (screen->curgl)], + repeated, 1); + } + } + parsestate = groundtable; + break; - case CASE_LS2: - /* LS2 */ - screen->curgl = 2; - parsestate = groundtable; - break; + case CASE_LS2: + /* LS2 */ + screen->curgl = 2; + parsestate = groundtable; + break; - case CASE_LS3: - /* LS3 */ - screen->curgl = 3; - parsestate = groundtable; - break; + case CASE_LS3: + /* LS3 */ + screen->curgl = 3; + parsestate = groundtable; + break; - case CASE_LS3R: - /* LS3R */ - screen->curgr = 3; - parsestate = groundtable; - break; + case CASE_LS3R: + /* LS3R */ + screen->curgr = 3; + parsestate = groundtable; + break; - case CASE_LS2R: - /* LS2R */ - screen->curgr = 2; - parsestate = groundtable; - break; + case CASE_LS2R: + /* LS2R */ + screen->curgr = 2; + parsestate = groundtable; + break; - case CASE_LS1R: - /* LS1R */ - screen->curgr = 1; - parsestate = groundtable; - break; + case CASE_LS1R: + /* LS1R */ + screen->curgr = 1; + parsestate = groundtable; + break; - case CASE_XTERM_SAVE: - savemodes(term); - parsestate = groundtable; - break; + case CASE_XTERM_SAVE: + savemodes(term); + parsestate = groundtable; + break; - case CASE_XTERM_RESTORE: - restoremodes(term); - parsestate = groundtable; - break; + case CASE_XTERM_RESTORE: + restoremodes(term); + parsestate = groundtable; + break; - case CASE_XTERM_WINOPS: - window_ops(term); - parsestate = groundtable; - break; + case CASE_XTERM_WINOPS: + if (screen->allowWindowOps) + window_ops(term); + parsestate = groundtable; + break; #if OPT_WIDE_CHARS - case CASE_UTF8: - /* If we did not set UTF-8 mode from resource or - * the command-line, allow it to be enabled/disabled - * by control sequence. - */ - if (screen->utf8_mode != 2) - screen->utf8_mode = (c == 'G'); - parsestate = groundtable; - break; -#endif + case CASE_ESC_PERCENT: + parsestate = esc_pct_table; + break; + + case CASE_UTF8: + /* If we did not set UTF-8 mode from resource or the + * command-line, allow it to be enabled/disabled by + * control sequence. To keep the logic simple, require + * that wide_chars have been set during initialization + * so that we have been maintaining data structures for + * wide characters, anyway. Otherwise we would have to + * reallocate everything the first time we turned UTF-8 + * mode on. + */ + if (screen->wide_chars + && screen->utf8_mode != 2) { + screen->utf8_mode = (c == 'G'); + TRACE(("UTF8 mode %s\n", + screen->utf8_mode ? "ON" : "OFF")); + } else { + TRACE(("UTF8 mode NOT turned %s (%s)\n", + (c == 'G') ? "ON" : "OFF", + (screen->utf8_mode == 2) + ? "UTF-8 mode set from command-line" + : "wideChars resource was not set")); } - if (parsestate == groundtable) - lastchar = thischar; + parsestate = groundtable; + break; +#endif + + case CASE_CSI_IGNORE: + parsestate = cigtable; + break; } + if (parsestate == groundtable) + lastchar = thischar; + } } static Char *v_buffer; /* pointer to physical buffer */ @@ -2298,171 +2366,165 @@ or generated by us in response to a query ESC sequence. */ int -v_write(int f, Char *data, int len) +v_write(int f, Char * data, int len) { - int riten; - int c = len; + int riten; + int c = len; - if (v_bufstr == NULL && len > 0) { - v_buffer = (Char *) XtMalloc(len); - v_bufstr = v_buffer; - v_bufptr = v_buffer; - v_bufend = v_buffer + len; - } + if (v_bufstr == NULL && len > 0) { + v_buffer = (Char *) XtMalloc(len); + v_bufstr = v_buffer; + v_bufptr = v_buffer; + v_bufend = v_buffer + len; + } #ifdef DEBUG - if (debug) { - fprintf(stderr, "v_write called with %d bytes (%d left over)", - len, v_bufptr - v_bufstr); - if (len > 1 && len < 10) - fprintf(stderr, " \"%.*s\"", len, (char *)data); - fprintf(stderr, "\n"); - } + if (debug) { + fprintf(stderr, "v_write called with %d bytes (%d left over)", + len, v_bufptr - v_bufstr); + if (len > 1 && len < 10) + fprintf(stderr, " \"%.*s\"", len, (char *) data); + fprintf(stderr, "\n"); + } #endif -#ifndef AMOEBA #ifdef VMS - if ((1 << f) != pty_mask) - return(tt_write((char *)data, len)); + if ((1 << f) != pty_mask) + return (tt_write((char *) data, len)); #else /* VMS */ - if (!FD_ISSET (f, &pty_mask)) - return(write(f, (char *)data, len)); + if (!FD_ISSET(f, &pty_mask)) + return (write(f, (char *) data, len)); #endif /* VMS */ -#else - if (term->screen.respond != f) - return(write(f, (char *)data, len)); -#endif - - /* - * Append to the block we already have. - * Always doing this simplifies the code, and - * isn't too bad, either. If this is a short - * block, it isn't too expensive, and if this is - * a long block, we won't be able to write it all - * anyway. - */ - if (len > 0) { - if (v_bufend < v_bufptr + len) { /* we've run out of room */ - if (v_bufstr != v_buffer) { - /* there is unused space, move everything down */ - /* possibly overlapping memmove here */ + /* + * Append to the block we already have. + * Always doing this simplifies the code, and + * isn't too bad, either. If this is a short + * block, it isn't too expensive, and if this is + * a long block, we won't be able to write it all + * anyway. + */ + + if (len > 0) { + if (v_bufend < v_bufptr + len) { /* we've run out of room */ + if (v_bufstr != v_buffer) { + /* there is unused space, move everything down */ + /* possibly overlapping memmove here */ +#ifdef DEBUG + if (debug) + fprintf(stderr, "moving data down %d\n", + v_bufstr - v_buffer); +#endif + memmove(v_buffer, v_bufstr, v_bufptr - v_bufstr); + v_bufptr -= v_bufstr - v_buffer; + v_bufstr = v_buffer; + } + if (v_bufend < v_bufptr + len) { + /* still won't fit: get more space */ + /* Don't use XtRealloc because an error is not fatal. */ + int size = v_bufptr - v_buffer; /* save across realloc */ + v_buffer = (Char *) realloc(v_buffer, size + len); + if (v_buffer) { #ifdef DEBUG if (debug) - fprintf(stderr, "moving data down %d\n", - v_bufstr - v_buffer); + fprintf(stderr, "expanded buffer to %d\n", + size + len); #endif - memmove( v_buffer, v_bufstr, v_bufptr - v_bufstr); - v_bufptr -= v_bufstr - v_buffer; v_bufstr = v_buffer; + v_bufptr = v_buffer + size; + v_bufend = v_bufptr + len; + } else { + /* no memory: ignore entire write request */ + fprintf(stderr, "%s: cannot allocate buffer space\n", + xterm_name); + v_buffer = v_bufstr; /* restore clobbered pointer */ + c = 0; } - if (v_bufend < v_bufptr + len) { - /* still won't fit: get more space */ - /* Don't use XtRealloc because an error is not fatal. */ - int size = v_bufptr - v_buffer; /* save across realloc */ - v_buffer = (Char *)realloc(v_buffer, size + len); - if (v_buffer) { -#ifdef DEBUG - if (debug) - fprintf(stderr, "expanded buffer to %d\n", - size + len); -#endif - v_bufstr = v_buffer; - v_bufptr = v_buffer + size; - v_bufend = v_bufptr + len; - } else { - /* no memory: ignore entire write request */ - fprintf(stderr, "%s: cannot allocate buffer space\n", - xterm_name); - v_buffer = v_bufstr; /* restore clobbered pointer */ - c = 0; - } - } - } - if (v_bufend >= v_bufptr + len) { - /* new stuff will fit */ - memmove( v_bufptr, data, len); - v_bufptr += len; } } + if (v_bufend >= v_bufptr + len) { + /* new stuff will fit */ + memmove(v_bufptr, data, len); + v_bufptr += len; + } + } - /* - * Write out as much of the buffer as we can. - * Be careful not to overflow the pty's input silo. - * We are conservative here and only write - * a small amount at a time. - * - * If we can't push all the data into the pty yet, we expect write - * to return a non-negative number less than the length requested - * (if some data written) or -1 and set errno to EAGAIN, - * EWOULDBLOCK, or EINTR (if no data written). - * - * (Not all systems do this, sigh, so the code is actually - * a little more forgiving.) - */ + /* + * Write out as much of the buffer as we can. + * Be careful not to overflow the pty's input silo. + * We are conservative here and only write + * a small amount at a time. + * + * If we can't push all the data into the pty yet, we expect write + * to return a non-negative number less than the length requested + * (if some data written) or -1 and set errno to EAGAIN, + * EWOULDBLOCK, or EINTR (if no data written). + * + * (Not all systems do this, sigh, so the code is actually + * a little more forgiving.) + */ #define MAX_PTY_WRITE 128 /* 1/2 POSIX minimum MAX_INPUT */ - if (v_bufptr > v_bufstr) { -#ifndef AMOEBA + if (v_bufptr > v_bufstr) { #ifdef VMS - riten = tt_write(v_bufstr,v_bufptr - v_bufstr <= VMS_TERM_BUFFER_SIZE ? - v_bufptr - v_bufstr : VMS_TERM_BUFFER_SIZE); - if (riten == 0) return(riten); + riten = tt_write(v_bufstr, + ((v_bufptr - v_bufstr <= VMS_TERM_BUFFER_SIZE) + ? v_bufptr - v_bufstr + : VMS_TERM_BUFFER_SIZE)); + if (riten == 0) + return (riten); #else /* VMS */ - riten = write(f, v_bufstr, v_bufptr - v_bufstr <= MAX_PTY_WRITE ? - v_bufptr - v_bufstr : MAX_PTY_WRITE); - if (riten < 0) + riten = write(f, v_bufstr, + ((v_bufptr - v_bufstr <= MAX_PTY_WRITE) + ? v_bufptr - v_bufstr + : MAX_PTY_WRITE)); + if (riten < 0) #endif /* VMS */ -#else - riten = v_bufptr - v_bufstr <= MAX_PTY_WRITE ? - v_bufptr - v_bufstr : MAX_PTY_WRITE; - if (cb_puts(term->screen.tty_inq, v_bufstr, riten) != 0) -#endif /* AMOEBA */ - { -#ifdef DEBUG - if (debug) perror("write"); -#endif - riten = 0; - } + { #ifdef DEBUG if (debug) - fprintf(stderr, "write called with %d, wrote %d\n", - v_bufptr - v_bufstr <= MAX_PTY_WRITE ? - v_bufptr - v_bufstr : MAX_PTY_WRITE, - riten); -#endif - v_bufstr += riten; - if (v_bufstr >= v_bufptr) /* we wrote it all */ - v_bufstr = v_bufptr = v_buffer; + perror("write"); +#endif + riten = 0; } +#ifdef DEBUG + if (debug) + fprintf(stderr, "write called with %d, wrote %d\n", + v_bufptr - v_bufstr <= MAX_PTY_WRITE ? + v_bufptr - v_bufstr : MAX_PTY_WRITE, + riten); +#endif + v_bufstr += riten; + if (v_bufstr >= v_bufptr) /* we wrote it all */ + v_bufstr = v_bufptr = v_buffer; + } - /* - * If we have lots of unused memory allocated, return it - */ - if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */ - /* save pointers across realloc */ - int start = v_bufstr - v_buffer; - int size = v_bufptr - v_buffer; - int allocsize = size ? size : 1; - - v_buffer = (Char *)realloc(v_buffer, allocsize); - if (v_buffer) { - v_bufstr = v_buffer + start; - v_bufptr = v_buffer + size; - v_bufend = v_buffer + allocsize; + /* + * If we have lots of unused memory allocated, return it + */ + if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */ + /* save pointers across realloc */ + int start = v_bufstr - v_buffer; + int size = v_bufptr - v_buffer; + int allocsize = size ? size : 1; + + v_buffer = (Char *) realloc(v_buffer, allocsize); + if (v_buffer) { + v_bufstr = v_buffer + start; + v_bufptr = v_buffer + size; + v_bufend = v_buffer + allocsize; #ifdef DEBUG - if (debug) - fprintf(stderr, "shrunk buffer to %d\n", allocsize); + if (debug) + fprintf(stderr, "shrunk buffer to %d\n", allocsize); #endif - } else { - /* should we print a warning if couldn't return memory? */ - v_buffer = v_bufstr - start; /* restore clobbered pointer */ - } + } else { + /* should we print a warning if couldn't return memory? */ + v_buffer = v_bufstr - start; /* restore clobbered pointer */ } - return(c); + } + return (c); } - #ifdef VMS static int select_mask; static int write_mask; @@ -2482,72 +2544,66 @@ register int i; select_mask = pty_mask; /* force initial read */ - for ( ; ;) - { + for (;;) { - /* if the terminal changed size, resize the widget */ - if(tt_changed) - { - tt_changed = FALSE; + /* if the terminal changed size, resize the widget */ + if (tt_changed) { + tt_changed = FALSE; - stat = XtMakeResizeRequest ( - (Widget) term, - (Dimension) FontWidth(screen) + stat = XtMakeResizeRequest((Widget) term, + ((Dimension) FontWidth(screen) * (tt_width) - + 2*screen->border - + screen->fullVwin.sb_info.width, - (Dimension) FontHeight(screen) + + 2 * screen->border + + screen->fullVwin.sb_info.width), + ((Dimension) FontHeight(screen) * (tt_length) - + 2 * screen->border, - &replyWidth, &replyHeight); + + 2 * screen->border), + &replyWidth, &replyHeight); - if (stat == XtGeometryYes || stat == XtGeometryDone) - { - term->core.width = replyWidth; - term->core.height = replyHeight; + if (stat == XtGeometryYes || stat == XtGeometryDone) { + term->core.width = replyWidth; + term->core.height = replyHeight; - ScreenResize (&term->screen,replyWidth,replyHeight, - &term->flags); + ScreenResize(&term->screen, replyWidth, replyHeight, + &term->flags); } } - if((select_mask & pty_mask) && (eventMode == NORMAL)) { + if ((select_mask & pty_mask) && (eventMode == NORMAL)) { #ifdef ALLOWLOGGING - if(screen->logging){ + if (screen->logging) { FlushLog(screen); } #endif if (read_queue.flink != 0) { VTbuffer.cnt = tt_read(VTbuffer.ptr = VTbuffer.buf); - if(VTbuffer.cnt == 0) + if (VTbuffer.cnt == 0) Panic("input: read returned zero\n", 0); - else - { + else { /* strip parity bit */ - for(i = VTbuffer.cnt, cp = VTbuffer.ptr ; i > 0 ; i--) - *cp++ &= 0177; /* originally CHAR */ - if(screen->scrollWidget && screen->scrollttyoutput && + for (i = VTbuffer.cnt, cp = VTbuffer.ptr; i > 0; i--) + *cp++ &= 0177; /* originally CHAR */ + if (screen->scrollWidget && screen->scrollttyoutput && screen->topline < 0) /* Scroll to bottom */ - WindowScroll(screen, 0); + WindowScroll(screen, 0); break; } - } - else { + } else { sys$hiber(); } } - if(screen->scroll_amt) + if (screen->scroll_amt) FlushScroll(screen); - if(screen->cursor_set && (screen->cursor_col != screen->cur_col - || screen->cursor_row != screen->cur_row)) { - if(screen->cursor_state) + if (screen->cursor_set && (screen->cursor_col != screen->cur_col + || screen->cursor_row != screen->cur_row)) { + if (screen->cursor_state) HideCursor(); ShowCursor(); - } else if(screen->cursor_set != screen->cursor_state) { - if(screen->cursor_set) + } else if (screen->cursor_set != screen->cursor_state) { + if (screen->cursor_set) ShowCursor(); else HideCursor(); @@ -2556,10 +2612,9 @@ PreeditPosition(screen); #endif - if (QLength(screen->display)){ + if (QLength(screen->display)) { select_mask = X_mask; - } - else { + } else { write_mask = ptymask(); XFlush(screen->display); select_mask = Select_mask; @@ -2570,7 +2625,7 @@ v_write(screen->respond, 0, 0); /* flush buffer */ } - if(select_mask & X_mask) { + if (select_mask & X_mask) { if (VTbuffer.cnt <= 0) { VTbuffer.cnt = 0; VTbuffer.ptr = VTbuffer.buf; @@ -2581,7 +2636,7 @@ } } VTbuffer.cnt--; - return(*VTbuffer.ptr++); + return (*VTbuffer.ptr++); } #else /* VMS */ static fd_set select_mask; @@ -2598,21 +2653,21 @@ #define TICK (1000/8) #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) - int tick = MAX( 1, MIN( screen->cursor_on, screen->cursor_off) ) * TICK; + int tick = MAX(1, MIN(screen->cursor_on, screen->cursor_off)) * TICK; #endif - for( ; ; ) { + for (;;) { if (eventMode == NORMAL - && getPtyData(screen, &select_mask, &VTbuffer)) { + && getPtyData(screen, &select_mask, &VTbuffer)) { if (screen->scrollWidget - && screen->scrollttyoutput - && screen->topline < 0) - WindowScroll(screen, 0); /* Scroll to bottom */ + && screen->scrollttyoutput + && screen->topline < 0) + WindowScroll(screen, 0); /* Scroll to bottom */ pty_read_bytes += VTbuffer.cnt; /* stop speed reading at some point to look for X stuff */ /* (4096 is just a random large number.) */ if (pty_read_bytes > 4096) - FD_CLR (screen->respond, &select_mask); + FD_CLR(screen->respond, &select_mask); break; } pty_read_bytes = 0; @@ -2634,20 +2689,19 @@ PreeditPosition(screen); #endif - XFlush(screen->display); /* always flush writes before waiting */ + XFlush(screen->display); /* always flush writes before waiting */ -#ifndef AMOEBA /* Update the masks and, unless X events are already in the queue, wait for I/O to be possible. */ - XFD_COPYSET (&Select_mask, &select_mask); + XFD_COPYSET(&Select_mask, &select_mask); /* in selection mode xterm does not read pty */ if (eventMode != NORMAL) - FD_CLR (screen->respond, &select_mask); + FD_CLR(screen->respond, &select_mask); if (v_bufptr > v_bufstr) { - XFD_COPYSET (&pty_mask, &write_mask); + XFD_COPYSET(&pty_mask, &write_mask); } else - FD_ZERO (&write_mask); + FD_ZERO(&write_mask); select_timeout.tv_sec = 0; time_select = 0; @@ -2660,25 +2714,25 @@ * on the host. */ if (XtAppPending(app_con)) { - select_timeout.tv_usec = 0; - time_select = 1; + select_timeout.tv_usec = 0; + time_select = 1; } else if (screen->awaitInput) { - select_timeout.tv_usec = 50000; - time_select = 1; + select_timeout.tv_usec = 50000; + time_select = 1; #if OPT_BLINK_CURS } else if ((screen->cursor_blink && - ((screen->select&FOCUS) || screen->always_highlight)) || + ((screen->select & FOCUS) || screen->always_highlight)) || (screen->cursor_state == BLINKED_OFF)) { - select_timeout.tv_usec = tick; - while( select_timeout.tv_usec > 1000000 ) { - select_timeout.tv_usec -= 1000000; - select_timeout.tv_sec++; - } - time_select = 1; + select_timeout.tv_usec = tick; + while (select_timeout.tv_usec > 1000000) { + select_timeout.tv_usec -= 1000000; + select_timeout.tv_sec++; + } + time_select = 1; #endif } i = select(max_plus1, &select_mask, &write_mask, 0, - time_select ? &select_timeout : 0); + time_select ? &select_timeout : 0); if (i < 0) { if (errno != EINTR) SysError(ERROR_SELECT); @@ -2686,35 +2740,18 @@ } /* if there is room to write more data to the pty, go write more */ - if (FD_ISSET (screen->respond, &write_mask)) { - v_write(screen->respond, (Char *)0, 0); /* flush buffer */ + if (FD_ISSET(screen->respond, &write_mask)) { + v_write(screen->respond, (Char *) 0, 0); /* flush buffer */ } /* if there are X events already in our queue, it counts as being readable */ if (XtAppPending(app_con) || - FD_ISSET (ConnectionNumber(screen->display), &select_mask)) { - xevents(); - if (VTbuffer.cnt > 0) /* HandleInterpret */ - break; - } -#else /* AMOEBA */ - i = _X11TransAmSelect(ConnectionNumber(screen->display), 1); - /* if there are X events already in our queue, - it counts as being readable */ - if (XtAppPending(app_con) || i > 0) { + FD_ISSET(ConnectionNumber(screen->display), &select_mask)) { xevents(); if (VTbuffer.cnt > 0) /* HandleInterpret */ break; - continue; - } else if (i < 0) { - extern int exiting; - if (errno != EINTR && !exiting) - SysError(ERROR_SELECT); } - if (cb_full(screen->tty_outq) <= 0) - SleepMainThread(); -#endif /* AMOENA */ } return nextPtyData(&VTbuffer); @@ -2725,12 +2762,14 @@ /* * For OverTheSpot, client has to inform the position for XIM preedit. */ -static void PreeditPosition(TScreen *screen) +static void +PreeditPosition(TScreen * screen) { XPoint spot; XVaNestedList list; - if (!screen->xic) return; + if (!screen->xic) + return; spot.x = CurCursorX(screen, screen->cur_row, screen->cur_col); spot.y = CursorY(screen, screen->cur_row) + screen->fs_ascent; list = XVaCreateNestedList(0, @@ -2748,141 +2787,143 @@ * by charset. worry about end of line conditions (wraparound if selected). */ void -dotext( - TScreen *screen, - int charset, - IChar *buf, /* start of characters to process */ - Cardinal len) /* end */ +dotext(TScreen * screen, + int charset, + IChar * buf, /* start of characters to process */ + Cardinal len) /* end */ { #if OPT_WIDE_CHARS - Cardinal chars_chomped; + Cardinal chars_chomped; #else - int next_col, last_col, this_col; /* must be signed */ + int next_col, last_col, this_col; /* must be signed */ #endif - Cardinal offset; + Cardinal offset; #if OPT_WIDE_CHARS - if (!screen->utf8_mode || charset == '0') /* don't translate if we use UTF-8 */ + /* don't translate if we use UTF-8, and are not handling legacy support + * for line-drawing characters. + */ + if (!screen->utf8_mode + || (screen->vt100_graphics && charset == '0')) #endif - - if (!xtermCharSetOut(buf, buf+len, charset)) - return; - if_OPT_XMC_GLITCH(screen,{ - Cardinal n; - if (charset != '?') { - for (n = 0; n < len; n++) { - if (buf[n] == XMC_GLITCH) - buf[n] = XMC_GLITCH+1; - } - } - }) + if (!xtermCharSetOut(buf, buf + len, charset)) + return; + if_OPT_XMC_GLITCH(screen, { + Cardinal n; + if (charset != '?') { + for (n = 0; n < len; n++) { + if (buf[n] == XMC_GLITCH) + buf[n] = XMC_GLITCH + 1; + } + } + }); #if OPT_WIDE_CHARS - for (offset = 0; offset < len; offset += chars_chomped) { - int width_available = screen->max_col - screen->cur_col + 1; - int width_here = 0, need_wrap = 0; - chars_chomped = 0; - - if (screen->do_wrap && (term->flags & WRAPAROUND)) { - /* mark that we had to wrap this line */ - ScrnSetWrapped(screen, screen->cur_row); - xtermAutoPrint('\n'); - xtermIndex(screen, 1); - screen->cur_col = 0; - screen->do_wrap = 0; - width_available = screen->max_col - screen->cur_col + 1; - } + for (offset = 0; offset < len; offset += chars_chomped) { + int width_available = screen->max_col - screen->cur_col + 1; + int width_here = 0, need_wrap = 0; + chars_chomped = 0; - while (width_here <= width_available && chars_chomped < (len - offset)) { - width_here += my_wcwidth(buf[chars_chomped + offset]); - chars_chomped ++; - } + if (screen->do_wrap && (term->flags & WRAPAROUND)) { + /* mark that we had to wrap this line */ + ScrnSetWrapped(screen, screen->cur_row); + xtermAutoPrint('\n'); + xtermIndex(screen, 1); + screen->cur_col = 0; + screen->do_wrap = 0; + width_available = screen->max_col - screen->cur_col + 1; + } - if (width_here > width_available) { - chars_chomped --; - width_here -= my_wcwidth(buf[chars_chomped + offset]); - need_wrap = 1; - } + while (width_here <= width_available && chars_chomped < (len - offset)) { + width_here += my_wcwidth(buf[chars_chomped + offset]); + chars_chomped++; + } - if (width_here == width_available) { - need_wrap = 1; - } + if (width_here > width_available) { + chars_chomped--; + width_here -= my_wcwidth(buf[chars_chomped + offset]); + need_wrap = 1; + } - if (chars_chomped != (len - offset)) { - need_wrap = 1; - } + if (width_here == width_available) { + need_wrap = 1; + } - /* - * Split the wide characters back into separate arrays of 8-bit - * characters so we can use the existing interface. - * - * FIXME: If we rewrote this interface, it would involve - * rewriting all of the memory-management for the screen - * buffers (perhaps this is simpler). - */ - { - static unsigned limit; - static Char *hibyte, *lobyte; - Boolean both = False; - unsigned j, k; - - if (chars_chomped >= limit) { - limit = (chars_chomped + 1) * 2; - lobyte = (Char *)XtRealloc((char *)lobyte, limit); - hibyte = (Char *)XtRealloc((char *)hibyte, limit); - } - for (j = offset; j < offset+chars_chomped; j++) { - k = j-offset; - lobyte[k] = buf[j]; - if (buf[j] > 255) { - hibyte[k] = (buf[j] >> 8); - both = True; - } else { - hibyte[k] = 0; - } - } + if (chars_chomped != (len - offset)) { + need_wrap = 1; + } - WriteText(screen, PAIRED_CHARS( - lobyte, - both ? hibyte : 0), chars_chomped); + /* + * Split the wide characters back into separate arrays of 8-bit + * characters so we can use the existing interface. + * + * FIXME: If we rewrote this interface, it would involve + * rewriting all of the memory-management for the screen + * buffers (perhaps this is simpler). + */ + { + static unsigned limit; + static Char *hibyte, *lobyte; + Boolean both = False; + unsigned j, k; + + if (chars_chomped >= limit) { + limit = (chars_chomped + 1) * 2; + lobyte = (Char *) XtRealloc((char *) lobyte, limit); + hibyte = (Char *) XtRealloc((char *) hibyte, limit); + } + for (j = offset; j < offset + chars_chomped; j++) { + k = j - offset; + lobyte[k] = buf[j]; + if (buf[j] > 255) { + hibyte[k] = (buf[j] >> 8); + both = True; + } else { + hibyte[k] = 0; } - screen->do_wrap = need_wrap; + } + + WriteText(screen, PAIRED_CHARS(lobyte, + (both ? hibyte : 0)), + chars_chomped); } + screen->do_wrap = need_wrap; + } #else - - for (offset = 0; offset < len; offset += this_col) { - last_col = CurMaxCol(screen, screen->cur_row); - this_col = last_col - screen->cur_col +1; - if (this_col <= 1) { - if (screen->do_wrap && (term->flags & WRAPAROUND)) { - /* mark that we had to wrap this line */ - ScrnSetWrapped(screen, screen->cur_row); - xtermAutoPrint('\n'); - xtermIndex(screen, 1); - screen->cur_col = 0; - screen->do_wrap = 0; - this_col = last_col + 1; - } else - this_col = 1; - } - if (offset + this_col > len) { - this_col = len - offset; - } - next_col = screen->cur_col + this_col; - WriteText(screen, PAIRED_CHARS( - buf+offset, - buf2 ? buf2+offset : 0), this_col); - - /* - * the call to WriteText updates screen->cur_col. - * If screen->cur_col != next_col, we must have - * hit the right margin, so set the do_wrap flag. - */ - screen->do_wrap = (screen->cur_col < (int)next_col); + for (offset = 0; offset < len; offset += this_col) { + last_col = CurMaxCol(screen, screen->cur_row); + this_col = last_col - screen->cur_col + 1; + if (this_col <= 1) { + if (screen->do_wrap && (term->flags & WRAPAROUND)) { + /* mark that we had to wrap this line */ + ScrnSetWrapped(screen, screen->cur_row); + xtermAutoPrint('\n'); + xtermIndex(screen, 1); + screen->cur_col = 0; + screen->do_wrap = 0; + this_col = last_col + 1; + } else + this_col = 1; } + if (offset + this_col > len) { + this_col = len - offset; + } + next_col = screen->cur_col + this_col; + + WriteText(screen, PAIRED_CHARS(buf + offset, + buf2 ? buf2 + offset : 0), + this_col); + + /* + * the call to WriteText updates screen->cur_col. + * If screen->cur_col != next_col, we must have + * hit the right margin, so set the do_wrap flag. + */ + screen->do_wrap = (screen->cur_col < (int) next_col); + } #endif } @@ -2901,20 +2942,27 @@ #endif /* HANDLE_STRUCT_NOTIFY */ #if OPT_WIDE_CHARS -int visual_width(PAIRED_CHARS(Char *str, Char *str2), Cardinal len) { - /* returns the visual width of a string (doublewide characters count - as 2, normalwide characters count as 1) */ - int my_len = 0; - while (len) { - int ch = *str; - if (str2) ch |= *str2 << 8; - if (str) str++; - if (str2) str2++; - if (iswide(ch)) my_len += 2; - else my_len++; - len--; - } - return my_len; +int +visual_width(PAIRED_CHARS(Char * str, Char * str2), Cardinal len) +{ + /* returns the visual width of a string (doublewide characters count + as 2, normalwide characters count as 1) */ + int my_len = 0; + while (len) { + int ch = *str; + if (str2) + ch |= *str2 << 8; + if (str) + str++; + if (str2) + str2++; + if (iswide(ch)) + my_len += 2; + else + my_len++; + len--; + } + return my_len; } #endif @@ -2923,116 +2971,122 @@ * the current cursor position. update cursor position. */ static void -WriteText(TScreen *screen, PAIRED_CHARS(Char *str, Char *str2), Cardinal len) +WriteText(TScreen * screen, PAIRED_CHARS(Char * str, Char * str2), Cardinal len) { - unsigned flags = term->flags; - int fg_bg = makeColorPair(term->cur_foreground, term->cur_background); - GC currentGC; - - TRACE(("WriteText (%2d,%2d) (%d) %3d:%s\n", - screen->cur_row, - screen->cur_col, - curXtermChrSet(screen->cur_row), - len, visibleChars(PAIRED_CHARS(str, str2), len))); - - if(screen->cur_row - screen->topline <= screen->max_row) { - if(screen->cursor_state) - HideCursor(); + unsigned test; + unsigned flags = term->flags; + int fg_bg = makeColorPair(term->cur_foreground, term->cur_background); + GC currentGC; + + TRACE(("WriteText (%2d,%2d) (%d) %3d:%s\n", + screen->cur_row, + screen->cur_col, + curXtermChrSet(screen->cur_row), + len, visibleChars(PAIRED_CHARS(str, str2), len))); + + if (screen->cur_row - screen->topline <= screen->max_row) { + if (screen->cursor_state) + HideCursor(); + + if (flags & INSERT) { + InsertChar(screen, visual_width(PAIRED_CHARS(str, str2), len)); + } + if (!AddToRefresh(screen)) { + /* make sure that the correct GC is current */ + currentGC = updatedXtermGC(screen, flags, fg_bg, False); - if (flags & INSERT) { - InsertChar(screen, visual_width(PAIRED_CHARS(str, str2), len)); - } - if (!AddToRefresh(screen)) { - /* make sure that the correct GC is current */ - currentGC = updatedXtermGC(screen, flags, fg_bg, False); - - if(screen->scroll_amt) - FlushScroll(screen); - - if (flags & INVISIBLE) { - memset(str, ' ', len); - if_OPT_WIDE_CHARS(screen,{ - if (str2 != 0) - memset(str2, ' ', len); - }) - } + if (screen->scroll_amt) + FlushScroll(screen); + + if (flags & INVISIBLE) { + memset(str, ' ', len); + if_OPT_WIDE_CHARS(screen, { + if (str2 != 0) + memset(str2, ' ', len); + }); + } - TRACE(("%s @%d, calling drawXtermText (%d,%d)\n", - __FILE__, __LINE__, - screen->cur_col, - screen->cur_row)); - drawXtermText(screen, flags, currentGC, - CurCursorX(screen, screen->cur_row, screen->cur_col), - CursorY(screen, screen->cur_row), - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(str, str2), len, 0); - - resetXtermGC(screen, flags, False); - - /* - * The following statements compile data to compute the - * average number of characters written on each call to - * XText. The data may be examined via the use of a - * "hidden" escape sequence. - */ + TRACE(("WriteText calling drawXtermText (%d,%d)\n", + screen->cur_col, + screen->cur_row)); + + test = flags; + checkVeryBoldColors(test, term->cur_foreground); + + drawXtermText(screen, test, currentGC, + CurCursorX(screen, screen->cur_row, screen->cur_col), + CursorY(screen, screen->cur_row), + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(str, str2), len, 0); + + resetXtermGC(screen, flags, False); + + /* + * The following statements compile data to compute the + * average number of characters written on each call to + * XText. The data may be examined via the use of a + * "hidden" escape sequence. + */ #ifdef UNUSED - ctotal += len; - ++ntotal; + ctotal += len; + ++ntotal; #endif - } } - ScreenWrite(screen, PAIRED_CHARS(str, str2), flags, fg_bg, len); - CursorForward(screen, visual_width(PAIRED_CHARS(str, str2), len)); + } + ScreenWrite(screen, PAIRED_CHARS(str, str2), flags, fg_bg, len); + CursorForward(screen, visual_width(PAIRED_CHARS(str, str2), len)); #if OPT_ZICONBEEP - /* Flag icon name with "***" on window output when iconified. - */ - if( zIconBeep && mapstate == IsUnmapped && ! zIconBeep_flagged) { - static char *icon_name; - static Arg args[] = { - { XtNiconName, (XtArgVal) &icon_name } - }; + /* Flag icon name with "***" on window output when iconified. + */ + if (zIconBeep && mapstate == IsUnmapped && !zIconBeep_flagged) { + static char *icon_name; + static Arg args[] = + { + {XtNiconName, (XtArgVal) & icon_name} + }; - icon_name = NULL; - XtGetValues(toplevel,args,XtNumber(args)); + icon_name = NULL; + XtGetValues(toplevel, args, XtNumber(args)); - if( icon_name != NULL ) { - zIconBeep_flagged = True; - Changename(icon_name); - } - if (zIconBeep > 0) - XBell( XtDisplay(toplevel), zIconBeep ); + if (icon_name != NULL) { + zIconBeep_flagged = True; + Changename(icon_name); } - mapstate = -1; + if (zIconBeep > 0) + XBell(XtDisplay(toplevel), zIconBeep); + } + mapstate = -1; #endif /* OPT_ZICONBEEP */ } #if HANDLE_STRUCT_NOTIFY /* Flag icon name with "***" on window output when iconified. */ -static void HandleStructNotify( - Widget w GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XEvent *event, - Boolean *cont GCC_UNUSED) +static void +HandleStructNotify(Widget w GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XEvent * event, + Boolean * cont GCC_UNUSED) { static char *icon_name; - static Arg args[] = { - { XtNiconName, (XtArgVal) &icon_name } + static Arg args[] = + { + {XtNiconName, (XtArgVal) & icon_name} }; - switch( event->type ){ + switch (event->type) { case MapNotify: TRACE(("HandleStructNotify(MapNotify)\n")); #if OPT_ZICONBEEP - if( zIconBeep_flagged ) { + if (zIconBeep_flagged) { zIconBeep_flagged = False; icon_name = NULL; XtGetValues(toplevel, args, XtNumber(args)); - if( icon_name != NULL ) { - char *buf = (char *)malloc(strlen(icon_name) + 1); + if (icon_name != NULL) { + char *buf = (char *) malloc(strlen(icon_name) + 1); if (buf == NULL) { - zIconBeep_flagged = True; - return; + zIconBeep_flagged = True; + return; } strcpy(buf, icon_name + 4); Changename(buf); @@ -3057,8 +3111,8 @@ #endif if (Vwin->menu_bar) { XtVaGetValues(Vwin->menu_bar, - XtNheight, &Vwin->menu_height, - NULL); + XtNheight, &Vwin->menu_height, + (XtPointer) 0); TRACE(("...menu_height %d\n", Vwin->menu_height)); } } @@ -3075,303 +3129,326 @@ * process ANSI modes set, reset */ static void -ansi_modes( - XtermWidget termw, - void (*func) (unsigned *p, unsigned mask)) +ansi_modes(XtermWidget termw, + void (*func) (unsigned *p, unsigned mask)) { - register int i; + register int i; - for (i=0; i<nparam; ++i) { - switch (param[i]) { - case 2: /* KAM (if set, keyboard locked */ - (*func)(&termw->keyboard.flags, MODE_KAM); - break; + for (i = 0; i < nparam; ++i) { + switch (param[i]) { + case 2: /* KAM (if set, keyboard locked */ + (*func) (&termw->keyboard.flags, MODE_KAM); + break; - case 4: /* IRM */ - (*func)(&termw->flags, INSERT); - break; + case 4: /* IRM */ + (*func) (&termw->flags, INSERT); + break; - case 12: /* SRM (if set, local echo */ - (*func)(&termw->keyboard.flags, MODE_SRM); - break; + case 12: /* SRM (if set, local echo */ + (*func) (&termw->keyboard.flags, MODE_SRM); + break; - case 20: /* LNM */ - (*func)(&termw->flags, LINEFEED); - update_autolinefeed(); - break; - } + case 20: /* LNM */ + (*func) (&termw->flags, LINEFEED); + update_autolinefeed(); + break; } + } } #define set_mousemode(mode) \ screen->send_mouse_pos = (func == bitset) ? mode : MOUSE_OFF +#define set_mouseflag(f) \ + ((func == bitset) \ + ? SCREEN_FLAG_set(screen, f) \ + : SCREEN_FLAG_unset(screen, f)) /* * process DEC private modes set, reset */ static void -dpmodes( - XtermWidget termw, +dpmodes(XtermWidget termw, void (*func) (unsigned *p, unsigned mask)) { - register TScreen *screen = &termw->screen; - register int i, j; + register TScreen *screen = &termw->screen; + register int i, j; - for (i=0; i<nparam; ++i) { - TRACE(("%s %d\n", (func == bitset) ? "DECSET" : "DECRST", param[i])); - switch (param[i]) { - case 1: /* DECCKM */ - (*func)(&termw->keyboard.flags, MODE_DECCKM); - update_appcursor(); - break; - case 2: /* ANSI/VT52 mode */ - if (func == bitset) { /* ANSI (VT100) */ - resetCharsets(screen); - if_OPT_VT52_MODE(screen,{ - screen->ansi_level = 1;}) - } + for (i = 0; i < nparam; ++i) { + TRACE(("%s %d\n", (func == bitset) ? "DECSET" : "DECRST", param[i])); + switch (param[i]) { + case 1: /* DECCKM */ + (*func) (&termw->keyboard.flags, MODE_DECCKM); + update_appcursor(); + break; + case 2: /* ANSI/VT52 mode */ + if (func == bitset) { /* ANSI (VT100) */ + resetCharsets(screen); + if_OPT_VT52_MODE(screen, { + screen->ansi_level = 1; + }); + } #if OPT_VT52_MODE - else if (screen->terminal_id >= 100) { /* VT52 */ - screen->ansi_level = 0; - param[0] = 0; - param[1] = 0; - resetCharsets(screen); - } + else if (screen->terminal_id >= 100) { /* VT52 */ + screen->ansi_level = 0; + param[0] = 0; + param[1] = 0; + resetCharsets(screen); + } #endif - break; - case 3: /* DECCOLM */ - if(screen->c132) { - ClearScreen(screen); - CursorSet(screen, 0, 0, termw->flags); - if((j = func == bitset ? 132 : 80) != - ((termw->flags & IN132COLUMNS) ? 132 : 80) || - j != screen->max_col + 1) - RequestResize(termw, -1, j, TRUE); - (*func)(&termw->flags, IN132COLUMNS); - } - break; - case 4: /* DECSCLM (slow scroll) */ - if (func == bitset) { - screen->jumpscroll = 0; - if (screen->scroll_amt) - FlushScroll(screen); - } else - screen->jumpscroll = 1; - (*func)(&termw->flags, SMOOTHSCROLL); - update_jumpscroll(); - break; - case 5: /* DECSCNM */ - j = termw->flags; - (*func)(&termw->flags, REVERSE_VIDEO); - if ((termw->flags ^ j) & REVERSE_VIDEO) - ReverseVideo(termw); - /* update_reversevideo done in RevVid */ - break; + break; + case 3: /* DECCOLM */ + if (screen->c132) { + ClearScreen(screen); + CursorSet(screen, 0, 0, termw->flags); + if ((j = func == bitset ? 132 : 80) != + ((termw->flags & IN132COLUMNS) ? 132 : 80) || + j != screen->max_col + 1) + RequestResize(termw, -1, j, TRUE); + (*func) (&termw->flags, IN132COLUMNS); + } + break; + case 4: /* DECSCLM (slow scroll) */ + if (func == bitset) { + screen->jumpscroll = 0; + if (screen->scroll_amt) + FlushScroll(screen); + } else + screen->jumpscroll = 1; + (*func) (&termw->flags, SMOOTHSCROLL); + update_jumpscroll(); + break; + case 5: /* DECSCNM */ + j = termw->flags; + (*func) (&termw->flags, REVERSE_VIDEO); + if ((termw->flags ^ j) & REVERSE_VIDEO) + ReverseVideo(termw); + /* update_reversevideo done in RevVid */ + break; - case 6: /* DECOM */ - (*func)(&termw->flags, ORIGIN); - CursorSet(screen, 0, 0, termw->flags); - break; + case 6: /* DECOM */ + (*func) (&termw->flags, ORIGIN); + CursorSet(screen, 0, 0, termw->flags); + break; - case 7: /* DECAWM */ - (*func)(&termw->flags, WRAPAROUND); - update_autowrap(); - break; - case 8: /* DECARM */ - /* ignore autorepeat */ - break; - case SET_X10_MOUSE: /* MIT bogus sequence */ - MotionOff( screen, termw ); - set_mousemode(X10_MOUSE); - break; - case 18: /* DECPFF: print form feed */ - screen->printer_formfeed = (func == bitset) ? ON : OFF; - break; - case 19: /* DECPEX: print extent */ - screen->printer_extent = (func == bitset) ? ON : OFF; - break; - case 25: /* DECTCEM: Show/hide cursor (VT200) */ - screen->cursor_set = (func == bitset) ? ON : OFF; - break; - case 30: /* rxvt */ - if (screen->fullVwin.sb_info.width != ((func == bitset) ? ON : OFF)) - ToggleScrollBar(termw); - break; + case 7: /* DECAWM */ + (*func) (&termw->flags, WRAPAROUND); + update_autowrap(); + break; + case 8: /* DECARM */ + /* ignore autorepeat */ + break; + case SET_X10_MOUSE: /* MIT bogus sequence */ + MotionOff(screen, termw); + set_mousemode(X10_MOUSE); + break; + case 18: /* DECPFF: print form feed */ + screen->printer_formfeed = (func == bitset) ? ON : OFF; + break; + case 19: /* DECPEX: print extent */ + screen->printer_extent = (func == bitset) ? ON : OFF; + break; + case 25: /* DECTCEM: Show/hide cursor (VT200) */ + screen->cursor_set = (func == bitset) ? ON : OFF; + break; + case 30: /* rxvt */ + if (screen->fullVwin.sb_info.width != ((func == bitset) ? ON : OFF)) + ToggleScrollBar(termw); + break; #if OPT_SHIFT_FONTS - case 35: /* rxvt */ - term->misc.shift_fonts = (func == bitset) ? ON : OFF; - break; + case 35: /* rxvt */ + term->misc.shift_fonts = (func == bitset) ? ON : OFF; + break; #endif - case 38: /* DECTEK */ + case 38: /* DECTEK */ #if OPT_TEK4014 - if(func == bitset && !(screen->inhibit & I_TEK)) { + if (func == bitset && !(screen->inhibit & I_TEK)) { #ifdef ALLOWLOGGING - if(screen->logging && TekPtyData()) { - FlushLog(screen); - screen->logstart = DecodedData(Tbuffer); - } + if (screen->logging && TekPtyData()) { + FlushLog(screen); + screen->logstart = DecodedData(Tbuffer); + } #endif - screen->TekEmu = TRUE; - } + screen->TekEmu = TRUE; + } #endif - break; - case 40: /* 132 column mode */ - screen->c132 = (func == bitset); - update_allow132(); - break; - case 41: /* curses hack */ - screen->curses = (func == bitset); - update_cursesemul(); - break; - case 42: /* DECNRCM national charset (VT220) */ - (*func)(&termw->flags, NATIONAL); - break; - case 44: /* margin bell */ - screen->marginbell = (func == bitset); - if(!screen->marginbell) - screen->bellarmed = -1; - update_marginbell(); - break; - case 45: /* reverse wraparound */ - (*func)(&termw->flags, REVERSEWRAP); - update_reversewrap(); - break; + break; + case 40: /* 132 column mode */ + screen->c132 = (func == bitset); + update_allow132(); + break; + case 41: /* curses hack */ + screen->curses = (func == bitset); + update_cursesemul(); + break; + case 42: /* DECNRCM national charset (VT220) */ + (*func) (&termw->flags, NATIONAL); + break; + case 44: /* margin bell */ + screen->marginbell = (func == bitset); + if (!screen->marginbell) + screen->bellarmed = -1; + update_marginbell(); + break; + case 45: /* reverse wraparound */ + (*func) (&termw->flags, REVERSEWRAP); + update_reversewrap(); + break; #ifdef ALLOWLOGGING - case 46: /* logging */ + case 46: /* logging */ #ifdef ALLOWLOGFILEONOFF - /* - * if this feature is enabled, logging may be - * enabled and disabled via escape sequences. - */ - if(func == bitset) - StartLog(screen); - else - CloseLog(screen); + /* + * if this feature is enabled, logging may be + * enabled and disabled via escape sequences. + */ + if (func == bitset) + StartLog(screen); + else + CloseLog(screen); #else - Bell(XkbBI_Info,0); - Bell(XkbBI_Info,0); + Bell(XkbBI_Info, 0); + Bell(XkbBI_Info, 0); #endif /* ALLOWLOGFILEONOFF */ - break; + break; #endif - case 1049: /* alternate buffer & cursor */ - if (!termw->misc.titeInhibit) { - if(func == bitset) { - CursorSave(termw); - ToAlternate(screen); - ClearScreen(screen); - } else { - FromAlternate(screen); - CursorRestore(termw); - } - } else if (termw->misc.tiXtraScroll) { - if(func == bitset) { - xtermScroll(screen, screen->max_row); - } - } - break; - case 1047: - case 47: /* alternate buffer */ - if (!termw->misc.titeInhibit) { - if(func == bitset) { - ToAlternate(screen); - } else { - if (screen->alternate - && (param[i] == 1047)) - ClearScreen(screen); - FromAlternate(screen); - } - } else if (termw->misc.tiXtraScroll) { - if(func == bitset) { - xtermScroll(screen, screen->max_row); - } - } - break; - case 66: /* DECNKM */ - (*func)(&termw->keyboard.flags, MODE_DECKPAM); - update_appkeypad(); - break; - case 67: /* DECBKM */ - /* back-arrow mapped to backspace or delete(D)*/ - (*func)(&termw->keyboard.flags, MODE_DECBKM); - TRACE(("DECSET DECBKM %s\n", - (termw->keyboard.flags & MODE_DECBKM) - ? "on" - : "off")); - update_decbkm(); - break; - case SET_VT200_MOUSE: /* xterm bogus sequence */ - MotionOff( screen, termw ); - set_mousemode(VT200_MOUSE); - break; - case SET_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */ - MotionOff( screen, termw ); - set_mousemode(VT200_HIGHLIGHT_MOUSE); - break; - case SET_BTN_EVENT_MOUSE: - MotionOff( screen, termw ); - set_mousemode(BTN_EVENT_MOUSE); - break; - case SET_ANY_EVENT_MOUSE: - set_mousemode(ANY_EVENT_MOUSE); - if (screen->send_mouse_pos == MOUSE_OFF) { - screen->event_mask |= ButtonMotionMask; - screen->event_mask &= ~PointerMotionMask; - } else { - screen->event_mask &= ~ButtonMotionMask; - screen->event_mask |= PointerMotionMask; - } - XSelectInput(XtDisplay(termw), XtWindow(term), screen->event_mask); - break; - case 1010: /* rxvt */ - screen->scrollttyoutput = (func == bitset) ? ON : OFF; - update_scrollttyoutput(); - break; - case 1011: /* rxvt */ - screen->scrollkey = (func == bitset) ? ON : OFF; - update_scrollkey(); - break; + case 1049: /* alternate buffer & cursor */ + if (!termw->misc.titeInhibit) { + if (func == bitset) { + CursorSave(termw); + ToAlternate(screen); + ClearScreen(screen); + } else { + FromAlternate(screen); + CursorRestore(termw); + } + } else if (termw->misc.tiXtraScroll) { + if (func == bitset) { + xtermScroll(screen, screen->max_row); + } + } + break; + case 1047: + case 47: /* alternate buffer */ + if (!termw->misc.titeInhibit) { + if (func == bitset) { + ToAlternate(screen); + } else { + if (screen->alternate + && (param[i] == 1047)) + ClearScreen(screen); + FromAlternate(screen); + } + } else if (termw->misc.tiXtraScroll) { + if (func == bitset) { + xtermScroll(screen, screen->max_row); + } + } + break; + case 66: /* DECNKM */ + (*func) (&termw->keyboard.flags, MODE_DECKPAM); + update_appkeypad(); + break; + case 67: /* DECBKM */ + /* back-arrow mapped to backspace or delete(D) */ + (*func) (&termw->keyboard.flags, MODE_DECBKM); + TRACE(("DECSET DECBKM %s\n", + (termw->keyboard.flags & MODE_DECBKM) + ? "on" + : "off")); + update_decbkm(); + break; + case SET_VT200_MOUSE: /* xterm bogus sequence */ + MotionOff(screen, termw); + set_mousemode(VT200_MOUSE); + break; + case SET_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */ + MotionOff(screen, termw); + set_mousemode(VT200_HIGHLIGHT_MOUSE); + break; + case SET_BTN_EVENT_MOUSE: + MotionOff(screen, termw); + set_mousemode(BTN_EVENT_MOUSE); + break; + case SET_ANY_EVENT_MOUSE: + set_mousemode(ANY_EVENT_MOUSE); + if (screen->send_mouse_pos == MOUSE_OFF) { + screen->event_mask |= ButtonMotionMask; + screen->event_mask &= ~PointerMotionMask; + } else { + screen->event_mask &= ~ButtonMotionMask; + screen->event_mask |= PointerMotionMask; + } + XSelectInput(XtDisplay(termw), XtWindow(term), screen->event_mask); + break; + case 1010: /* rxvt */ + screen->scrollttyoutput = (func == bitset) ? ON : OFF; + update_scrollttyoutput(); + break; + case 1011: /* rxvt */ + screen->scrollkey = (func == bitset) ? ON : OFF; + update_scrollkey(); + break; #if OPT_NUM_LOCK - case 1035: - term->misc.real_NumLock = (func == bitset) ? ON : OFF; - break; - case 1036: - screen->meta_sends_esc = (func == bitset) ? ON : OFF; - break; + case 1035: + term->misc.real_NumLock = (func == bitset) ? ON : OFF; + break; + case 1036: + screen->meta_sends_esc = (func == bitset) ? ON : OFF; + break; #endif - case 1037: - screen->delete_is_del = (func == bitset) ? ON : OFF; - break; - case 1048: - if (!termw->misc.titeInhibit) { - if(func == bitset) - CursorSave(termw); - else - CursorRestore(termw); - } - break; - case 1051: - set_keyboard_type(keyboardIsSun, func == bitset); - break; + case 1037: + screen->delete_is_del = (func == bitset) ? ON : OFF; + break; + case 1048: + if (!termw->misc.titeInhibit) { + if (func == bitset) + CursorSave(termw); + else + CursorRestore(termw); + } + break; + case 1051: + set_keyboard_type(keyboardIsSun, func == bitset); + break; #if OPT_HP_FUNC_KEYS - case 1052: - set_keyboard_type(keyboardIsHP, func == bitset); - break; + case 1052: + set_keyboard_type(keyboardIsHP, func == bitset); + break; #endif #if OPT_SCO_FUNC_KEYS - case 1053: - set_keyboard_type(keyboardIsSCO, func == bitset); - break; + case 1053: + set_keyboard_type(keyboardIsSCO, func == bitset); + break; #endif - case 1060: - set_keyboard_type(keyboardIsLegacy, func == bitset); - break; + case 1060: + set_keyboard_type(keyboardIsLegacy, func == bitset); + break; #if OPT_SUNPC_KBD - case 1061: - set_keyboard_type(keyboardIsVT220, func == bitset); - break; + case 1061: + set_keyboard_type(keyboardIsVT220, func == bitset); + break; #endif - } +#if OPT_READLINE + case SET_BUTTON1_MOVE_POINT: + set_mouseflag(click1_moves); + break; + case SET_BUTTON2_MOVE_POINT: + set_mouseflag(paste_moves); + break; + case SET_DBUTTON3_DELETE: + set_mouseflag(dclick3_deletes); + break; + case SET_PASTE_IN_BRACKET: + set_mouseflag(paste_brackets); + break; + case SET_PASTE_QUOTE: + set_mouseflag(paste_quotes); + break; + case SET_PASTE_LITERAL_NL: + set_mouseflag(paste_literal_nl); + break; +#endif /* OPT_READLINE */ } + } } /* @@ -3380,72 +3457,92 @@ static void savemodes(XtermWidget termw) { - register TScreen *screen = &termw->screen; - register int i; + register TScreen *screen = &termw->screen; + register int i; - for (i = 0; i < nparam; i++) { - switch (param[i]) { - case 1: /* DECCKM */ - DoSM(DP_DECCKM, termw->keyboard.flags & MODE_DECCKM); - break; - case 3: /* DECCOLM */ - if(screen->c132) - DoSM(DP_DECCOLM, termw->flags & IN132COLUMNS); - break; - case 4: /* DECSCLM (slow scroll) */ - DoSM(DP_DECSCLM, termw->flags & SMOOTHSCROLL); - break; - case 5: /* DECSCNM */ - DoSM(DP_DECSCNM, termw->flags & REVERSE_VIDEO); - break; - case 6: /* DECOM */ - DoSM(DP_DECOM, termw->flags & ORIGIN); - break; + for (i = 0; i < nparam; i++) { + switch (param[i]) { + case 1: /* DECCKM */ + DoSM(DP_DECCKM, termw->keyboard.flags & MODE_DECCKM); + break; + case 3: /* DECCOLM */ + if (screen->c132) + DoSM(DP_DECCOLM, termw->flags & IN132COLUMNS); + break; + case 4: /* DECSCLM (slow scroll) */ + DoSM(DP_DECSCLM, termw->flags & SMOOTHSCROLL); + break; + case 5: /* DECSCNM */ + DoSM(DP_DECSCNM, termw->flags & REVERSE_VIDEO); + break; + case 6: /* DECOM */ + DoSM(DP_DECOM, termw->flags & ORIGIN); + break; - case 7: /* DECAWM */ - DoSM(DP_DECAWM, termw->flags & WRAPAROUND); - break; - case 8: /* DECARM */ - /* ignore autorepeat */ - break; - case SET_X10_MOUSE: /* mouse bogus sequence */ - DoSM(DP_X_X10MSE, screen->send_mouse_pos); - break; - case 40: /* 132 column mode */ - DoSM(DP_X_DECCOLM, screen->c132); - break; - case 41: /* curses hack */ - DoSM(DP_X_MORE, screen->curses); - break; - case 44: /* margin bell */ - DoSM(DP_X_MARGIN, screen->marginbell); - break; - case 45: /* reverse wraparound */ - DoSM(DP_X_REVWRAP, termw->flags & REVERSEWRAP); - break; + case 7: /* DECAWM */ + DoSM(DP_DECAWM, termw->flags & WRAPAROUND); + break; + case 8: /* DECARM */ + /* ignore autorepeat */ + break; + case SET_X10_MOUSE: /* mouse bogus sequence */ + DoSM(DP_X_X10MSE, screen->send_mouse_pos); + break; + case 40: /* 132 column mode */ + DoSM(DP_X_DECCOLM, screen->c132); + break; + case 41: /* curses hack */ + DoSM(DP_X_MORE, screen->curses); + break; + case 44: /* margin bell */ + DoSM(DP_X_MARGIN, screen->marginbell); + break; + case 45: /* reverse wraparound */ + DoSM(DP_X_REVWRAP, termw->flags & REVERSEWRAP); + break; #ifdef ALLOWLOGGING - case 46: /* logging */ - DoSM(DP_X_LOGGING, screen->logging); - break; + case 46: /* logging */ + DoSM(DP_X_LOGGING, screen->logging); + break; #endif - case 1047: /* alternate buffer */ - /* FALLTHRU */ - case 47: /* alternate buffer */ - DoSM(DP_X_ALTSCRN, screen->alternate); - break; - case SET_VT200_MOUSE: /* mouse bogus sequence */ - case SET_VT200_HIGHLIGHT_MOUSE: - case SET_BTN_EVENT_MOUSE: - case SET_ANY_EVENT_MOUSE: - DoSM(DP_X_MOUSE, screen->send_mouse_pos); - break; - case 1048: - if (!termw->misc.titeInhibit) { - CursorSave(termw); - } - break; - } + case 1047: /* alternate buffer */ + /* FALLTHRU */ + case 47: /* alternate buffer */ + DoSM(DP_X_ALTSCRN, screen->alternate); + break; + case SET_VT200_MOUSE: /* mouse bogus sequence */ + case SET_VT200_HIGHLIGHT_MOUSE: + case SET_BTN_EVENT_MOUSE: + case SET_ANY_EVENT_MOUSE: + DoSM(DP_X_MOUSE, screen->send_mouse_pos); + break; + case 1048: + if (!termw->misc.titeInhibit) { + CursorSave(termw); + } + break; +#if OPT_READLINE + case SET_BUTTON1_MOVE_POINT: + SCREEN_FLAG_save(screen, click1_moves); + break; + case SET_BUTTON2_MOVE_POINT: + SCREEN_FLAG_save(screen, paste_moves); + break; + case SET_DBUTTON3_DELETE: + SCREEN_FLAG_save(screen, dclick3_deletes); + break; + case SET_PASTE_IN_BRACKET: + SCREEN_FLAG_save(screen, paste_brackets); + break; + case SET_PASTE_QUOTE: + SCREEN_FLAG_save(screen, paste_quotes); + break; + case SET_PASTE_LITERAL_NL: + SCREEN_FLAG_save(screen, paste_literal_nl); + break; +#endif /* OPT_READLINE */ } + } } /* @@ -3454,117 +3551,137 @@ static void restoremodes(XtermWidget termw) { - register TScreen *screen = &termw->screen; - register int i, j; + register TScreen *screen = &termw->screen; + register int i, j; - for (i = 0; i < nparam; i++) { - switch (param[i]) { - case 1: /* DECCKM */ - bitcpy(&termw->keyboard.flags, - screen->save_modes[DP_DECCKM], MODE_DECCKM); - update_appcursor(); - break; - case 3: /* DECCOLM */ - if(screen->c132) { - ClearScreen(screen); - CursorSet(screen, 0, 0, termw->flags); - if((j = (screen->save_modes[DP_DECCOLM] & IN132COLUMNS) - ? 132 : 80) != ((termw->flags & IN132COLUMNS) - ? 132 : 80) || j != screen->max_col + 1) - RequestResize(termw, -1, j, TRUE); - bitcpy(&termw->flags, - screen->save_modes[DP_DECCOLM], - IN132COLUMNS); - } - break; - case 4: /* DECSCLM (slow scroll) */ - if (screen->save_modes[DP_DECSCLM] & SMOOTHSCROLL) { - screen->jumpscroll = 0; - if (screen->scroll_amt) - FlushScroll(screen); - } else - screen->jumpscroll = 1; - bitcpy(&termw->flags, screen->save_modes[DP_DECSCLM], SMOOTHSCROLL); - update_jumpscroll(); - break; - case 5: /* DECSCNM */ - if((screen->save_modes[DP_DECSCNM] ^ termw->flags) & REVERSE_VIDEO) { - bitcpy(&termw->flags, screen->save_modes[DP_DECSCNM], REVERSE_VIDEO); - ReverseVideo(termw); - /* update_reversevideo done in RevVid */ - } - break; - case 6: /* DECOM */ - bitcpy(&termw->flags, screen->save_modes[DP_DECOM], ORIGIN); - CursorSet(screen, 0, 0, termw->flags); - break; + for (i = 0; i < nparam; i++) { + switch (param[i]) { + case 1: /* DECCKM */ + bitcpy(&termw->keyboard.flags, + screen->save_modes[DP_DECCKM], MODE_DECCKM); + update_appcursor(); + break; + case 3: /* DECCOLM */ + if (screen->c132) { + ClearScreen(screen); + CursorSet(screen, 0, 0, termw->flags); + if ((j = (screen->save_modes[DP_DECCOLM] & IN132COLUMNS) + ? 132 : 80) != ((termw->flags & IN132COLUMNS) + ? 132 : 80) || j != screen->max_col + 1) + RequestResize(termw, -1, j, TRUE); + bitcpy(&termw->flags, + screen->save_modes[DP_DECCOLM], + IN132COLUMNS); + } + break; + case 4: /* DECSCLM (slow scroll) */ + if (screen->save_modes[DP_DECSCLM] & SMOOTHSCROLL) { + screen->jumpscroll = 0; + if (screen->scroll_amt) + FlushScroll(screen); + } else + screen->jumpscroll = 1; + bitcpy(&termw->flags, screen->save_modes[DP_DECSCLM], SMOOTHSCROLL); + update_jumpscroll(); + break; + case 5: /* DECSCNM */ + if ((screen->save_modes[DP_DECSCNM] ^ termw->flags) & REVERSE_VIDEO) { + bitcpy(&termw->flags, screen->save_modes[DP_DECSCNM], REVERSE_VIDEO); + ReverseVideo(termw); + /* update_reversevideo done in RevVid */ + } + break; + case 6: /* DECOM */ + bitcpy(&termw->flags, screen->save_modes[DP_DECOM], ORIGIN); + CursorSet(screen, 0, 0, termw->flags); + break; - case 7: /* DECAWM */ - bitcpy(&termw->flags, screen->save_modes[DP_DECAWM], WRAPAROUND); - update_autowrap(); - break; - case 8: /* DECARM */ - /* ignore autorepeat */ - break; - case SET_X10_MOUSE: /* MIT bogus sequence */ - DoRM(DP_X_X10MSE, screen->send_mouse_pos); - break; - case 40: /* 132 column mode */ - DoRM(DP_X_DECCOLM, screen->c132); - update_allow132(); - break; - case 41: /* curses hack */ - DoRM(DP_X_MORE, screen->curses); - update_cursesemul(); - break; - case 44: /* margin bell */ - if((DoRM(DP_X_MARGIN, screen->marginbell)) == 0) - screen->bellarmed = -1; - update_marginbell(); - break; - case 45: /* reverse wraparound */ - bitcpy(&termw->flags, screen->save_modes[DP_X_REVWRAP], REVERSEWRAP); - update_reversewrap(); - break; + case 7: /* DECAWM */ + bitcpy(&termw->flags, screen->save_modes[DP_DECAWM], WRAPAROUND); + update_autowrap(); + break; + case 8: /* DECARM */ + /* ignore autorepeat */ + break; + case SET_X10_MOUSE: /* MIT bogus sequence */ + DoRM(DP_X_X10MSE, screen->send_mouse_pos); + break; + case 40: /* 132 column mode */ + DoRM(DP_X_DECCOLM, screen->c132); + update_allow132(); + break; + case 41: /* curses hack */ + DoRM(DP_X_MORE, screen->curses); + update_cursesemul(); + break; + case 44: /* margin bell */ + if ((DoRM(DP_X_MARGIN, screen->marginbell)) == 0) + screen->bellarmed = -1; + update_marginbell(); + break; + case 45: /* reverse wraparound */ + bitcpy(&termw->flags, screen->save_modes[DP_X_REVWRAP], REVERSEWRAP); + update_reversewrap(); + break; #ifdef ALLOWLOGGING - case 46: /* logging */ + case 46: /* logging */ #ifdef ALLOWLOGFILEONOFF - if(screen->save_modes[DP_X_LOGGING]) - StartLog(screen); - else - CloseLog(screen); + if (screen->save_modes[DP_X_LOGGING]) + StartLog(screen); + else + CloseLog(screen); #endif /* ALLOWLOGFILEONOFF */ - /* update_logging done by StartLog and CloseLog */ - break; + /* update_logging done by StartLog and CloseLog */ + break; #endif - case 1047: /* alternate buffer */ - /* FALLTHRU */ - case 47: /* alternate buffer */ - if (!termw->misc.titeInhibit) { - if(screen->save_modes[DP_X_ALTSCRN]) - ToAlternate(screen); - else - FromAlternate(screen); - /* update_altscreen done by ToAlt and FromAlt */ - } else if (termw->misc.tiXtraScroll) { - if(screen->save_modes[DP_X_ALTSCRN]) { - xtermScroll(screen, screen->max_row); - } - } - break; - case SET_VT200_MOUSE: /* mouse bogus sequence */ - case SET_VT200_HIGHLIGHT_MOUSE: - case SET_BTN_EVENT_MOUSE: - case SET_ANY_EVENT_MOUSE: - DoRM(DP_X_MOUSE, screen->send_mouse_pos); - break; - case 1048: - if (!termw->misc.titeInhibit) { - CursorRestore(termw); - } - break; + case 1047: /* alternate buffer */ + /* FALLTHRU */ + case 47: /* alternate buffer */ + if (!termw->misc.titeInhibit) { + if (screen->save_modes[DP_X_ALTSCRN]) + ToAlternate(screen); + else + FromAlternate(screen); + /* update_altscreen done by ToAlt and FromAlt */ + } else if (termw->misc.tiXtraScroll) { + if (screen->save_modes[DP_X_ALTSCRN]) { + xtermScroll(screen, screen->max_row); } + } + break; + case SET_VT200_MOUSE: /* mouse bogus sequence */ + case SET_VT200_HIGHLIGHT_MOUSE: + case SET_BTN_EVENT_MOUSE: + case SET_ANY_EVENT_MOUSE: + DoRM(DP_X_MOUSE, screen->send_mouse_pos); + break; + case 1048: + if (!termw->misc.titeInhibit) { + CursorRestore(termw); + } + break; +#if OPT_READLINE + case SET_BUTTON1_MOVE_POINT: + SCREEN_FLAG_restore(screen, click1_moves); + break; + case SET_BUTTON2_MOVE_POINT: + SCREEN_FLAG_restore(screen, paste_moves); + break; + case SET_DBUTTON3_DELETE: + SCREEN_FLAG_restore(screen, dclick3_deletes); + break; + case SET_PASTE_IN_BRACKET: + SCREEN_FLAG_restore(screen, paste_brackets); + break; + case SET_PASTE_QUOTE: + SCREEN_FLAG_restore(screen, paste_quotes); + break; + case SET_PASTE_LITERAL_NL: + SCREEN_FLAG_restore(screen, paste_literal_nl); + break; +#endif /* OPT_READLINE */ } + } } /* @@ -3572,36 +3689,35 @@ * ESC ] code label ESC backslash */ static void -report_win_label( - TScreen *screen, - int code, - XTextProperty *text, - Status ok) -{ - char **list; - int length = 0; - - reply.a_type = ESC; - unparseputc(ESC, screen->respond); - unparseputc(']', screen->respond); - unparseputc(code, screen->respond); - - if (ok) { - if (XTextPropertyToStringList(text, &list, &length)) { - int n, c; - for (n = 0; n < length; n++) { - char *s = list[n]; - while ((c = *s++) != '\0') - unparseputc(c, screen->respond); - } - XFreeStringList(list); - } - if (text->value != 0) - XFree(text->value); +report_win_label(TScreen * screen, + int code, + XTextProperty * text, + Status ok) +{ + char **list; + int length = 0; + + reply.a_type = ESC; + unparseputc(ESC, screen->respond); + unparseputc(']', screen->respond); + unparseputc(code, screen->respond); + + if (ok) { + if (XTextPropertyToStringList(text, &list, &length)) { + int n, c; + for (n = 0; n < length; n++) { + char *s = list[n]; + while ((c = *s++) != '\0') + unparseputc(c, screen->respond); + } + XFreeStringList(list); } + if (text->value != 0) + XFree(text->value); + } - unparseputc(ESC, screen->respond); - unparseputc('\\', screen->respond); + unparseputc(ESC, screen->respond); + unparseputc('\\', screen->respond); } /* @@ -3610,641 +3726,643 @@ static void window_ops(XtermWidget termw) { - register TScreen *screen = &termw->screen; - XWindowChanges values; - XWindowAttributes win_attrs; - XTextProperty text; - unsigned int value_mask; - Position x, y; - unsigned root_width, root_height; - - switch (param[0]) { - case 1: /* Restore (de-iconify) window */ - XMapWindow(screen->display, - VShellWindow); - break; + register TScreen *screen = &termw->screen; + XWindowChanges values; + XWindowAttributes win_attrs; + XTextProperty text; + unsigned int value_mask; + unsigned root_width, root_height; + + switch (param[0]) { + case 1: /* Restore (de-iconify) window */ + XMapWindow(screen->display, + VShellWindow); + break; - case 2: /* Minimize (iconify) window */ - XIconifyWindow(screen->display, - VShellWindow, - DefaultScreen(screen->display)); - break; + case 2: /* Minimize (iconify) window */ + XIconifyWindow(screen->display, + VShellWindow, + DefaultScreen(screen->display)); + break; - case 3: /* Move the window to the given position */ - values.x = param[1]; - values.y = param[2]; - value_mask = (CWX | CWY); - XReconfigureWMWindow( - screen->display, - VShellWindow, - DefaultScreen(screen->display), - value_mask, - &values); - break; + case 3: /* Move the window to the given position */ + values.x = param[1]; + values.y = param[2]; + value_mask = (CWX | CWY); + XReconfigureWMWindow( + screen->display, + VShellWindow, + DefaultScreen(screen->display), + value_mask, + &values); + break; - case 4: /* Resize the window to given size in pixels */ - RequestResize(termw, param[1], param[2], FALSE); - break; + case 4: /* Resize the window to given size in pixels */ + RequestResize(termw, param[1], param[2], FALSE); + break; - case 5: /* Raise the window to the front of the stack */ - XRaiseWindow(screen->display, VShellWindow); - break; + case 5: /* Raise the window to the front of the stack */ + XRaiseWindow(screen->display, VShellWindow); + break; - case 6: /* Lower the window to the bottom of the stack */ - XLowerWindow(screen->display, VShellWindow); - break; + case 6: /* Lower the window to the bottom of the stack */ + XLowerWindow(screen->display, VShellWindow); + break; - case 7: /* Refresh the window */ - Redraw(); - break; + case 7: /* Refresh the window */ + Redraw(); + break; - case 8: /* Resize the text-area, in characters */ - RequestResize(termw, param[1], param[2], TRUE); - break; + case 8: /* Resize the text-area, in characters */ + RequestResize(termw, param[1], param[2], TRUE); + break; #if OPT_MAXIMIZE - case 9: /* Maximize or restore */ - RequestMaximize(termw, param[1]); - break; + case 9: /* Maximize or restore */ + RequestMaximize(termw, param[1]); + break; #endif - case 11: /* Report the window's state */ - XGetWindowAttributes(screen->display, - VWindow(screen), - &win_attrs); - reply.a_type = CSI; - reply.a_pintro = 0; - reply.a_nparam = 1; - reply.a_param[0] = (win_attrs.map_state == IsViewable) ? 1 : 2; - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(&reply, screen->respond); - break; + case 11: /* Report the window's state */ + XGetWindowAttributes(screen->display, + VWindow(screen), + &win_attrs); + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 1; + reply.a_param[0] = (win_attrs.map_state == IsViewable) ? 1 : 2; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(&reply, screen->respond); + break; - case 13: /* Report the window's position */ - XtTranslateCoords(toplevel, 0, 0, &x, &y); - reply.a_type = CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 3; - reply.a_param[1] = x; - reply.a_param[2] = y; - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(&reply, screen->respond); - break; + case 13: /* Report the window's position */ + XGetWindowAttributes(screen->display, + WMFrameWindow(termw), + &win_attrs); + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 3; + reply.a_param[1] = win_attrs.x; + reply.a_param[2] = win_attrs.y; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(&reply, screen->respond); + break; - case 14: /* Report the window's size in pixels */ - XGetWindowAttributes(screen->display, - VWindow(screen), - &win_attrs); - reply.a_type = CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 4; - /*FIXME: find if dtterm uses - * win_attrs.height or Height - * win_attrs.width or Width - */ - reply.a_param[1] = Height(screen); - reply.a_param[2] = Width(screen); - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(&reply, screen->respond); - break; + case 14: /* Report the window's size in pixels */ + XGetWindowAttributes(screen->display, + VWindow(screen), + &win_attrs); + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 4; + /*FIXME: find if dtterm uses + * win_attrs.height or Height + * win_attrs.width or Width + */ + reply.a_param[1] = Height(screen); + reply.a_param[2] = Width(screen); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(&reply, screen->respond); + break; - case 18: /* Report the text's size in characters */ - reply.a_type = CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 8; - reply.a_param[1] = screen->max_row + 1; - reply.a_param[2] = screen->max_col + 1; - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(&reply, screen->respond); - break; + case 18: /* Report the text's size in characters */ + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 8; + reply.a_param[1] = screen->max_row + 1; + reply.a_param[2] = screen->max_col + 1; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(&reply, screen->respond); + break; #if OPT_MAXIMIZE - case 19: /* Report the screen's size, in characters */ - if (!QueryMaximize(screen, &root_height, &root_width)) { - root_height = 0; - root_width = 0; - } - reply.a_type = CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 9; - reply.a_param[1] = root_height / FontHeight(screen); - reply.a_param[2] = root_width / FontWidth(screen); - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(&reply, screen->respond); - break; + case 19: /* Report the screen's size, in characters */ + if (!QueryMaximize(screen, &root_height, &root_width)) { + root_height = 0; + root_width = 0; + } + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 9; + reply.a_param[1] = root_height / FontHeight(screen); + reply.a_param[2] = root_width / FontWidth(screen); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(&reply, screen->respond); + break; #endif - case 20: /* Report the icon's label */ - report_win_label(screen, 'L', &text, - XGetWMIconName( - screen->display, - VShellWindow, - &text)); - break; + case 20: /* Report the icon's label */ + report_win_label(screen, 'L', &text, + XGetWMIconName( + screen->display, + VShellWindow, + &text)); + break; - case 21: /* Report the window's title */ - report_win_label(screen, 'l', &text, - XGetWMName( - screen->display, - VShellWindow, - &text)); - break; + case 21: /* Report the window's title */ + report_win_label(screen, 'l', &text, + XGetWMName( + screen->display, + VShellWindow, + &text)); + break; - default: /* DECSLPP (24, 25, 36, 48, 72, 144) */ - if (param[0] >= 24) - RequestResize(termw, param[0], -1, TRUE); - break; - } + default: /* DECSLPP (24, 25, 36, 48, 72, 144) */ + if (param[0] >= 24) + RequestResize(termw, param[0], -1, TRUE); + break; + } } /* * set a bit in a word given a pointer to the word and a mask. */ -static void bitset(unsigned *p, unsigned mask) +static void +bitset(unsigned *p, unsigned mask) { - *p |= mask; + *p |= mask; } /* * clear a bit in a word given a pointer to the word and a mask. */ -static void bitclr(unsigned *p, unsigned mask) +static void +bitclr(unsigned *p, unsigned mask) { - *p &= ~mask; + *p &= ~mask; } /* * Copy bits from one word to another, given a mask */ -static void bitcpy(unsigned *p, unsigned q, unsigned mask) +static void +bitcpy(unsigned *p, unsigned q, unsigned mask) { - bitclr(p, mask); - bitset(p, q & mask); + bitclr(p, mask); + bitset(p, q & mask); } void unparseputc1(int c, int fd) { - if (c >= 0x80 && c <= 0x9F) { - if (!term->screen.control_eight_bits) { - unparseputc(A2E(ESC), fd); - c = A2E(c-0x40); - } + if (c >= 0x80 && c <= 0x9F) { + if (!term->screen.control_eight_bits) { + unparseputc(A2E(ESC), fd); + c = A2E(c - 0x40); } - unparseputc(c, fd); + } + unparseputc(c, fd); } void -unparseseq(register ANSI *ap, int fd) +unparseseq(register ANSI * ap, int fd) { - register int c; - register int i; - register int inters; - - unparseputc1(c = ap->a_type, fd); - if (c==ESC || c==DCS || c==CSI || c==OSC || c==PM || c==APC || c==SS3) { - if (ap->a_pintro != 0) - unparseputc((char) ap->a_pintro, fd); - for (i=0; i<ap->a_nparam; ++i) { - if (i != 0) - unparseputc(';', fd); - unparseputn((unsigned int) ap->a_param[i], fd); - } - inters = ap->a_inters; - for (i=3; i>=0; --i) { - c = CharOf(inters >> (8*i)); - if (c != 0) - unparseputc(c, fd); - } - unparseputc((char) ap->a_final, fd); + register int c; + register int i; + register int inters; + + unparseputc1(c = ap->a_type, fd); + if (c == ESC + || c == DCS + || c == CSI + || c == OSC + || c == PM + || c == APC + || c == SS3) { + if (ap->a_pintro != 0) + unparseputc((char) ap->a_pintro, fd); + for (i = 0; i < ap->a_nparam; ++i) { + if (i != 0) + unparseputc(';', fd); + unparseputn((unsigned int) ap->a_param[i], fd); + } + inters = ap->a_inters; + for (i = 3; i >= 0; --i) { + c = CharOf(inters >> (8 * i)); + if (c != 0) + unparseputc(c, fd); } + unparseputc((char) ap->a_final, fd); + } } static void unparseputn(unsigned int n, int fd) { - unsigned int q; + unsigned int q; - q = n/10; - if (q != 0) - unparseputn(q, fd); - unparseputc((char) ('0' + (n%10)), fd); + q = n / 10; + if (q != 0) + unparseputn(q, fd); + unparseputc((char) ('0' + (n % 10)), fd); } void unparseputc(int c, int fd) { - register TScreen *screen = &term->screen; - IChar buf[2]; - register int i = 1; + register TScreen *screen = &term->screen; + IChar buf[2]; + register int i = 1; -#ifdef AMOEBA - if (ttypreprocess(c)) return; -#endif #if OPT_TCAP_QUERY - /* - * If we're returning a termcap string, it has to be translated since - * a DCS must not contain any characters except for the normal 7-bit - * printable ASCII (counting tab, carriage return, etc). For now, - * just use hexadecimal for the whole thing. - */ - if (screen->tc_query >= 0) { - char tmp[3]; - sprintf(tmp, "%02X", c & 0xFF); - buf[0] = tmp[0]; - buf[1] = tmp[1]; - i = 2; - } - else + /* + * If we're returning a termcap string, it has to be translated since + * a DCS must not contain any characters except for the normal 7-bit + * printable ASCII (counting tab, carriage return, etc). For now, + * just use hexadecimal for the whole thing. + */ + if (screen->tc_query >= 0) { + char tmp[3]; + sprintf(tmp, "%02X", c & 0xFF); + buf[0] = tmp[0]; + buf[1] = tmp[1]; + i = 2; + } else #endif - if((buf[0] = c) == '\r' && (term->flags & LINEFEED)) { - buf[1] = '\n'; - i++; - } + if ((buf[0] = c) == '\r' && (term->flags & LINEFEED)) { + buf[1] = '\n'; + i++; + } #ifdef VMS - tt_write(&buf, i); + tt_write(&buf, i); #else /* VMS */ - writePtyData(fd, buf, i); + writePtyData(fd, buf, i); #endif /* VMS */ - /* If send/receive mode is reset, we echo characters locally */ - if ((term->keyboard.flags & MODE_SRM) == 0) { - dotext(screen, screen->gsets[(int)(screen->curgl)], buf, i); - } + /* If send/receive mode is reset, we echo characters locally */ + if ((term->keyboard.flags & MODE_SRM) == 0) { + dotext(screen, screen->gsets[(int) (screen->curgl)], buf, i); + } } void unparseputs(char *s, int fd) { - while (*s) - unparseputc(*s++, fd); + while (*s) + unparseputc(*s++, fd); } #if OPT_BLINK_CURS void -ToggleCursorBlink(register TScreen *screen) +ToggleCursorBlink(register TScreen * screen) { - ShowCursor(); - if (screen->cursor_blink) { - screen->cursor_blink = FALSE; - StopBlinking(screen); - } else { - screen->cursor_blink = TRUE; - StartBlinking(screen); - } - update_cursorblink(); + ShowCursor(); + if (screen->cursor_blink) { + screen->cursor_blink = FALSE; + StopBlinking(screen); + } else { + screen->cursor_blink = TRUE; + StartBlinking(screen); + } + update_cursorblink(); } #endif void -ToggleAlternate(register TScreen *screen) +ToggleAlternate(register TScreen * screen) { - if (screen->alternate) - FromAlternate(screen); - else - ToAlternate(screen); + if (screen->alternate) + FromAlternate(screen); + else + ToAlternate(screen); } static void -ToAlternate(register TScreen *screen) +ToAlternate(register TScreen * screen) { - if(screen->alternate) - return; - TRACE(("ToAlternate\n")); - if(!screen->altbuf) - screen->altbuf = Allocate(screen->max_row + 1, screen->max_col - + 1, &screen->abuf_address); - SwitchBufs(screen); - screen->alternate = TRUE; - update_altscreen(); + if (screen->alternate) + return; + TRACE(("ToAlternate\n")); + if (!screen->altbuf) + screen->altbuf = Allocate(screen->max_row + 1, screen->max_col + + 1, &screen->abuf_address); + SwitchBufs(screen); + screen->alternate = TRUE; + update_altscreen(); } static void -FromAlternate(register TScreen *screen) +FromAlternate(register TScreen * screen) { - if(!screen->alternate) - return; - TRACE(("FromAlternate\n")); - if(screen->scroll_amt) - FlushScroll(screen); - screen->alternate = FALSE; - SwitchBufs(screen); - update_altscreen(); + if (!screen->alternate) + return; + TRACE(("FromAlternate\n")); + if (screen->scroll_amt) + FlushScroll(screen); + screen->alternate = FALSE; + SwitchBufs(screen); + update_altscreen(); } static void -SwitchBufs(register TScreen *screen) +SwitchBufs(register TScreen * screen) { - register int rows, top; + register int rows, top; - if(screen->cursor_state) - HideCursor(); + if (screen->cursor_state) + HideCursor(); - rows = screen->max_row + 1; - SwitchBufPtrs(screen); - TrackText(0, 0, 0, 0); /* remove any highlighting */ - - if((top = -screen->topline) < rows) { - if(screen->scroll_amt) - FlushScroll(screen); - if(top == 0) - XClearWindow(screen->display, VWindow(screen)); - else - XClearArea( - screen->display, - VWindow(screen), - (int) OriginX(screen), - (int) top * FontHeight(screen) + screen->border, - (unsigned) Width(screen), - (unsigned) (rows - top) * FontHeight(screen), - FALSE); - } - ScrnRefresh(screen, 0, 0, rows, screen->max_col + 1, False); + rows = screen->max_row + 1; + SwitchBufPtrs(screen); + TrackText(0, 0, 0, 0); /* remove any highlighting */ + + if ((top = -screen->topline) < rows) { + if (screen->scroll_amt) + FlushScroll(screen); + if (top == 0) + XClearWindow(screen->display, VWindow(screen)); + else + XClearArea( + screen->display, + VWindow(screen), + (int) OriginX(screen), + (int) top * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) (rows - top) * FontHeight(screen), + FALSE); + } + ScrnRefresh(screen, 0, 0, rows, screen->max_col + 1, False); } /* swap buffer line pointers between alt and regular screens */ void -SwitchBufPtrs(register TScreen *screen) +SwitchBufPtrs(register TScreen * screen) { size_t len = ScrnPointers(screen, screen->max_row + 1); - memcpy ( (char *)screen->save_ptr, (char *)screen->visbuf, len); - memcpy ( (char *)screen->visbuf, (char *)screen->altbuf, len); - memcpy ( (char *)screen->altbuf, (char *)screen->save_ptr, len); + memcpy((char *) screen->save_ptr, (char *) screen->visbuf, len); + memcpy((char *) screen->visbuf, (char *) screen->altbuf, len); + memcpy((char *) screen->altbuf, (char *) screen->save_ptr, len); } void VTRun(void) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; #if OPT_TEK4014 - register int i; + register int i; #endif - - if (!screen->Vshow) { - set_vt_visibility (TRUE); - } - update_vttekmode(); - update_vtshow(); - update_tekshow(); - set_vthide_sensitivity(); - if (screen->allbuf == NULL) VTallocbuf (); - - screen->cursor_state = OFF; - screen->cursor_set = ON; - StartBlinking(screen); + if (!screen->Vshow) { + set_vt_visibility(TRUE); + } + update_vttekmode(); + update_vtshow(); + update_tekshow(); + set_vthide_sensitivity(); + + if (screen->allbuf == NULL) + VTallocbuf(); + + screen->cursor_state = OFF; + screen->cursor_set = ON; + StartBlinking(screen); - initPtyData(&VTbuffer); + initPtyData(&VTbuffer); #if OPT_TEK4014 - while(Tpushb > Tpushback) { - *(VTbuffer.ptr)++ = *--Tpushb; - VTbuffer.cnt++; - } - VTbuffer.cnt += (i = (Tbuffer ? Tbuffer->cnt : 0)); - for( ; i > 0 ; i--) - *(VTbuffer.ptr)++ = *(Tbuffer->ptr)++; - VTbuffer.ptr = DecodedData(&VTbuffer); -#endif - if(!setjmp(VTend)) - VTparse(); - StopBlinking(screen); - HideCursor(); - screen->cursor_set = OFF; + while (Tpushb > Tpushback) { + *(VTbuffer.ptr)++ = *--Tpushb; + VTbuffer.cnt++; + } + VTbuffer.cnt += (i = (Tbuffer ? Tbuffer->cnt : 0)); + for (; i > 0; i--) + *(VTbuffer.ptr)++ = *(Tbuffer->ptr)++; + VTbuffer.ptr = DecodedData(&VTbuffer); +#endif + if (!setjmp(VTend)) + VTparse(); + StopBlinking(screen); + HideCursor(); + screen->cursor_set = OFF; } /*ARGSUSED*/ -static void VTExpose( - Widget w GCC_UNUSED, - XEvent *event, - Region region GCC_UNUSED) +static void +VTExpose(Widget w GCC_UNUSED, + XEvent * event, + Region region GCC_UNUSED) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; #ifdef DEBUG - if(debug) - fputs("Expose\n", stderr); -#endif /* DEBUG */ - if (event->type == Expose) - HandleExposure (screen, event); -} - -static void VTGraphicsOrNoExpose (XEvent *event) -{ - register TScreen *screen = &term->screen; - if (screen->incopy <= 0) { - screen->incopy = 1; - if (screen->scrolls > 0) - screen->scrolls--; - } - if (event->type == GraphicsExpose) - if (HandleExposure (screen, event)) - screen->cursor_state = OFF; - if ((event->type == NoExpose) - || ((XGraphicsExposeEvent *)event)->count == 0) { - if (screen->incopy <= 0 && screen->scrolls > 0) - screen->scrolls--; - if (screen->scrolls) - screen->incopy = -1; - else - screen->incopy = 0; - } + if (debug) + fputs("Expose\n", stderr); +#endif /* DEBUG */ + if (event->type == Expose) + HandleExposure(screen, event); +} + +static void +VTGraphicsOrNoExpose(XEvent * event) +{ + register TScreen *screen = &term->screen; + if (screen->incopy <= 0) { + screen->incopy = 1; + if (screen->scrolls > 0) + screen->scrolls--; + } + if (event->type == GraphicsExpose) + if (HandleExposure(screen, event)) + screen->cursor_state = OFF; + if ((event->type == NoExpose) + || ((XGraphicsExposeEvent *) event)->count == 0) { + if (screen->incopy <= 0 && screen->scrolls > 0) + screen->scrolls--; + if (screen->scrolls) + screen->incopy = -1; + else + screen->incopy = 0; + } } /*ARGSUSED*/ -static void VTNonMaskableEvent ( - Widget w GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XEvent *event, - Boolean *cont GCC_UNUSED) +static void +VTNonMaskableEvent(Widget w GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XEvent * event, + Boolean * cont GCC_UNUSED) { switch (event->type) { - case GraphicsExpose: - case NoExpose: - VTGraphicsOrNoExpose (event); - break; - } + case GraphicsExpose: + case NoExpose: + VTGraphicsOrNoExpose(event); + break; + } } - - - -static void VTResize(Widget w) +static void +VTResize(Widget w) { if (XtIsRealized(w)) - ScreenResize (&term->screen, term->core.width, term->core.height, - &term->flags); + ScreenResize(&term->screen, term->core.width, term->core.height, + &term->flags); } - #define okDimension(src,dst) ((src <= 32767) && ((dst = src) == src)) -static void RequestResize( - XtermWidget termw, - int rows, - int cols, - int text) +static void +RequestResize(XtermWidget termw, int rows, int cols, int text) { #ifndef nothack - XSizeHints sizehints; - long supp; + XSizeHints sizehints; + long supp; #endif - TScreen *screen = &termw->screen; - unsigned long value; - Dimension replyWidth, replyHeight; - Dimension askedWidth, askedHeight; - XtGeometryResult status; - XWindowAttributes attrs; - - TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text)); + TScreen *screen = &termw->screen; + unsigned long value; + Dimension replyWidth, replyHeight; + Dimension askedWidth, askedHeight; + XtGeometryResult status; + XWindowAttributes attrs; - if ((askedWidth = cols) < cols - || (askedHeight = rows) < rows) - return; + TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text)); - if (askedHeight == 0 - || askedWidth == 0 - || term->misc.limit_resize > 0) { - XGetWindowAttributes(XtDisplay(termw), - RootWindowOfScreen(XtScreen(termw)), &attrs); - } + if ((askedWidth = cols) < cols + || (askedHeight = rows) < rows) + return; - if (text) { - if ((value = rows) != 0) { - if (rows < 0) - value = screen->max_row + 1; - value *= FontHeight(screen); - value += (2 * screen->border); - if (!okDimension(value, askedHeight)) - return; - } + if (askedHeight == 0 + || askedWidth == 0 + || term->misc.limit_resize > 0) { + XGetWindowAttributes(XtDisplay(termw), + RootWindowOfScreen(XtScreen(termw)), &attrs); + } - if ((value = cols) != 0) { - if (cols < 0) - value = screen->max_col + 1; - value *= FontWidth(screen); - value += (2 * screen->border) + ScrollbarWidth(screen); - if (!okDimension(value, askedWidth)) - return; - } + if (text) { + if ((value = rows) != 0) { + if (rows < 0) + value = screen->max_row + 1; + value *= FontHeight(screen); + value += (2 * screen->border); + if (!okDimension(value, askedHeight)) + return; + } - } else { - if (rows < 0) - askedHeight = FullHeight(screen); - if (cols < 0) - askedWidth = FullWidth(screen); - } - - if (rows == 0) - askedHeight = attrs.height; - if (cols == 0) - askedWidth = attrs.width; - - if (term->misc.limit_resize > 0) { - Dimension high = term->misc.limit_resize * attrs.height; - Dimension wide = term->misc.limit_resize * attrs.width; - if (high < attrs.height) - high = attrs.height; - if (askedHeight > high) - askedHeight = high; - if (wide < attrs.width) - wide = attrs.width; - if (askedWidth > wide) - askedWidth = wide; + if ((value = cols) != 0) { + if (cols < 0) + value = screen->max_col + 1; + value *= FontWidth(screen); + value += (2 * screen->border) + ScrollbarWidth(screen); + if (!okDimension(value, askedWidth)) + return; } + } else { + if (rows < 0) + askedHeight = FullHeight(screen); + if (cols < 0) + askedWidth = FullWidth(screen); + } + + if (rows == 0) + askedHeight = attrs.height; + if (cols == 0) + askedWidth = attrs.width; + + if (term->misc.limit_resize > 0) { + Dimension high = term->misc.limit_resize * attrs.height; + Dimension wide = term->misc.limit_resize * attrs.width; + if (high < attrs.height) + high = attrs.height; + if (askedHeight > high) + askedHeight = high; + if (wide < attrs.width) + wide = attrs.width; + if (askedWidth > wide) + askedWidth = wide; + } #ifndef nothack - if (! XGetWMNormalHints(screen->display, VShellWindow, - &sizehints, &supp)) - bzero(&sizehints, sizeof(sizehints)); -#endif - - status = XtMakeResizeRequest ( - (Widget) termw, - askedWidth, askedHeight, - &replyWidth, &replyHeight); - TRACE(("charproc.c XtMakeResizeRequest %dx%d -> %dx%d (status %d)\n", - askedHeight, askedWidth, - replyHeight, replyWidth, - status)); - - if (status == XtGeometryYes || - status == XtGeometryDone) { - ScreenResize (&termw->screen, - replyWidth, - replyHeight, - &termw->flags); - } + if (!XGetWMNormalHints(screen->display, VShellWindow, + &sizehints, &supp)) + bzero(&sizehints, sizeof(sizehints)); +#endif + status = XtMakeResizeRequest( + (Widget) termw, + askedWidth, askedHeight, + &replyWidth, &replyHeight); + TRACE(("charproc.c XtMakeResizeRequest %dx%d -> %dx%d (status %d)\n", + askedHeight, askedWidth, + replyHeight, replyWidth, + status)); + + if (status == XtGeometryYes || + status == XtGeometryDone) { + ScreenResize(&termw->screen, + replyWidth, + replyHeight, + &termw->flags); + } #ifndef nothack - /* - * XtMakeResizeRequest() has the undesirable side-effect of clearing - * the window manager's hints, even on a failed request. This would - * presumably be fixed if the shell did its own work. - */ - if (sizehints.flags - && replyHeight - && replyWidth) { - sizehints.height = replyHeight; - sizehints.width = replyWidth; - XSetWMNormalHints(screen->display, VShellWindow, &sizehints); - } + /* + * XtMakeResizeRequest() has the undesirable side-effect of clearing + * the window manager's hints, even on a failed request. This would + * presumably be fixed if the shell did its own work. + */ + if (sizehints.flags + && replyHeight + && replyWidth) { + sizehints.height = replyHeight; + sizehints.width = replyWidth; + XSetWMNormalHints(screen->display, VShellWindow, &sizehints); + } #endif - XSync(screen->display, FALSE); /* synchronize */ - if(XtAppPending(app_con)) - xevents(); + XSync(screen->display, FALSE); /* synchronize */ + if (XtAppPending(app_con)) + xevents(); } -extern Atom wm_delete_window; /* for ICCCM delete window */ - static String xterm_trans = - "<ClientMessage>WM_PROTOCOLS: DeleteWindow()\n\ +"<ClientMessage>WM_PROTOCOLS: DeleteWindow()\n\ <MappingNotify>: KeyboardMapping()\n"; -int VTInit (void) +int +VTInit(void) { register TScreen *screen = &term->screen; Widget vtparent = SHELL_OF(term); - XtRealizeWidget (vtparent); + XtRealizeWidget(vtparent); XtOverrideTranslations(vtparent, XtParseTranslationTable(xterm_trans)); - (void) XSetWMProtocols (XtDisplay(vtparent), XtWindow(vtparent), - &wm_delete_window, 1); + (void) XSetWMProtocols(XtDisplay(vtparent), XtWindow(vtparent), + &wm_delete_window, 1); TRACE_TRANS("shell", vtparent); - TRACE_TRANS("vt100", (Widget)(term)); + TRACE_TRANS("vt100", (Widget) (term)); - if (screen->allbuf == NULL) VTallocbuf (); + if (screen->allbuf == NULL) + VTallocbuf(); return (1); } -static void VTallocbuf (void) +static void +VTallocbuf(void) { register TScreen *screen = &term->screen; int nrows = screen->max_row + 1; /* allocate screen buffer now, if necessary. */ if (screen->scrollWidget) - nrows += screen->savelines; - screen->allbuf = Allocate (nrows, screen->max_col + 1, - &screen->sbuf_address); + nrows += screen->savelines; + screen->allbuf = Allocate(nrows, screen->max_col + 1, + &screen->sbuf_address); if (screen->scrollWidget) - screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines]; + screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines]; else - screen->visbuf = screen->allbuf; + screen->visbuf = screen->allbuf; return; } -static void VTClassInit (void) +static void +VTClassInit(void) { XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, (XtConvertArgList) NULL, (Cardinal) 0); @@ -4262,351 +4380,463 @@ TRACE(("init " #name " = %d\n", \ wnew->name = request->name)) #define init_Sres(name) \ - TRACE(("init " #name " = %s\n", \ - (wnew->name = request->name) != NULL \ + TRACE(("init " #name " = \"%s\"\n", \ + (wnew->name = x_strtrim(request->name)) != NULL \ ? wnew->name : "<null>")) #else #define init_Bres(name) wnew->name = request->name #define init_Cres(name) wnew->name = request->name #define init_Ires(name) wnew->name = request->name -#define init_Sres(name) wnew->name = request->name +#define init_Sres(name) wnew->name = x_strtrim(request->name) +#endif + +#if OPT_WIDE_CHARS +static void +VTInitialize_locale(XtermWidget request) +{ + char *locale; + Boolean is_utf8; + + if ((locale = getenv("LC_ALL")) == 0 || *locale == '\0') + if ((locale = getenv("LC_CTYPE")) == 0 || *locale == '\0') + if ((locale = getenv("LANG")) == 0 || *locale == '\0') + locale = ""; +#ifdef HAVE_LANGINFO_CODESET /* FIXME: not available yet */ + is_utf8 = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0); +#else + is_utf8 = (strstr(locale, "UTF-8") != NULL); +#endif + +#if OPT_LUIT_PROG + request->misc.callfilter = 0; + request->misc.use_encoding = 0; + + if (x_strcasecmp(request->misc.locale_str, "TRUE") == 0 || + x_strcasecmp(request->misc.locale_str, "ON") == 0 || + x_strcasecmp(request->misc.locale_str, "YES") == 0 || + x_strcasecmp(request->misc.locale_str, "AUTO") == 0 || + strcmp(request->misc.locale_str, "1") == 0) { + /* when true ... fully obeying LC_CTYPE locale */ + request->misc.callfilter = is_utf8 ? 0 : 1; + request->screen.utf8_mode = 2; + } else if (x_strcasecmp(request->misc.locale_str, "FALSE") == 0 || + x_strcasecmp(request->misc.locale_str, "OFF") == 0 || + x_strcasecmp(request->misc.locale_str, "NO") == 0 || + strcmp(request->misc.locale_str, "0") == 0) { + /* when false ... original value of utf8_mode is effective */ + if (request->screen.utf8_mode == 3) { + request->screen.utf8_mode = is_utf8 ? 2 : 0; + } + } else if (x_strcasecmp(request->misc.locale_str, "MEDIUM") == 0 || + x_strcasecmp(request->misc.locale_str, "SEMIAUTO") == 0) { + /* when medium ... obeying locale only for UTF-8 and Asian */ + if (is_utf8) { + request->screen.utf8_mode = 2; + } else if ( +#ifdef MB_CUR_MAX + MB_CUR_MAX > 1 || +#else + !strncmp(locale, "ja", 2) || + !strncmp(locale, "ko", 2) || + !strncmp(locale, "zh", 2) || +#endif + !strncmp(locale, "th", 2) || + !strncmp(locale, "vi", 2)) { + request->misc.callfilter = 1; + request->screen.utf8_mode = 2; + } else { + request->screen.utf8_mode = 0; + } + } else if (x_strcasecmp(request->misc.locale_str, "UTF-8") == 0 || + x_strcasecmp(request->misc.locale_str, "UTF8") == 0) { + /* when UTF-8 ... UTF-8 mode */ + request->screen.utf8_mode = 2; + } else { + /* other words are regarded as encoding name passed to luit */ + request->misc.callfilter = 1; + request->screen.utf8_mode = 2; + request->misc.use_encoding = 1; + } +#else + if (request->screen.utf8_mode == 3) { + request->screen.utf8_mode = is_utf8 ? 2 : 0; + } +#endif /* OPT_LUIT_PROG */ + +} #endif /* ARGSUSED */ -static void VTInitialize ( - Widget wrequest, - Widget new_arg, - ArgList args GCC_UNUSED, - Cardinal *num_args GCC_UNUSED) -{ - XtermWidget request = (XtermWidget) wrequest; - XtermWidget wnew = (XtermWidget) new_arg; - Widget my_parent = SHELL_OF(wnew); - int i; +static void +VTInitialize(Widget wrequest, + Widget new_arg, + ArgList args GCC_UNUSED, + Cardinal * num_args GCC_UNUSED) +{ + XtermWidget request = (XtermWidget) wrequest; + XtermWidget wnew = (XtermWidget) new_arg; + Widget my_parent = SHELL_OF(wnew); + int i; #if OPT_ISO_COLORS - Boolean color_ok; + Boolean color_ok; #endif - char *s; + char *s; + + /* Zero out the entire "screen" component of "wnew" widget, then do + * field-by-field assignment of "screen" fields that are named in the + * resource list. + */ + bzero((char *) &wnew->screen, sizeof(wnew->screen)); + + /* dummy values so that we don't try to Realize the parent shell with height + * or width of 0, which is illegal in X. The real size is computed in the + * xtermWidget's Realize proc, but the shell's Realize proc is called first, + * and must see a valid size. + */ + wnew->core.height = wnew->core.width = 1; + + /* + * The definition of -rv now is that it changes the definition of + * XtDefaultForeground and XtDefaultBackground. So, we no longer + * need to do anything special. + */ + wnew->screen.display = wnew->core.screen->display; - /* Zero out the entire "screen" component of "wnew" widget, then do - * field-by-field assignment of "screen" fields that are named in the - * resource list. - */ - bzero ((char *) &wnew->screen, sizeof(wnew->screen)); - - /* dummy values so that we don't try to Realize the parent shell with height - * or width of 0, which is illegal in X. The real size is computed in the - * xtermWidget's Realize proc, but the shell's Realize proc is called first, - * and must see a valid size. - */ - wnew->core.height = wnew->core.width = 1; - - /* - * The definition of -rv now is that it changes the definition of - * XtDefaultForeground and XtDefaultBackground. So, we no longer - * need to do anything special. - */ - wnew->screen.display = wnew->core.screen->display; - - /* - * We use the default foreground/background colors to compare/check if a - * color-resource has been set. - */ + /* + * We use the default foreground/background colors to compare/check if a + * color-resource has been set. + */ #define MyBlackPixel(dpy) BlackPixel(dpy,DefaultScreen(dpy)) #define MyWhitePixel(dpy) WhitePixel(dpy,DefaultScreen(dpy)) - if (request->misc.re_verse) { + if (request->misc.re_verse) { wnew->dft_foreground = MyWhitePixel(wnew->screen.display); wnew->dft_background = MyBlackPixel(wnew->screen.display); - } else { + } else { wnew->dft_foreground = MyBlackPixel(wnew->screen.display); wnew->dft_background = MyWhitePixel(wnew->screen.display); - } - TRACE(("Color resource initialization:\n")); - TRACE((" Default foreground %#lx\n", wnew->dft_foreground)); - TRACE((" Default background %#lx\n", wnew->dft_background)); - TRACE((" Screen foreground %#lx\n", request->screen.foreground)); - TRACE((" Screen background %#lx\n", request->core.background_pixel)); - - wnew->screen.mouse_button = -1; - wnew->screen.mouse_row = -1; - wnew->screen.mouse_col = -1; - - init_Bres(screen.force_box_chars); - init_Bres(screen.free_bold_box); - - init_Bres(screen.c132); - init_Bres(screen.curses); - init_Bres(screen.hp_ll_bc); + } + TRACE(("Color resource initialization:\n")); + TRACE((" Default foreground %#lx\n", wnew->dft_foreground)); + TRACE((" Default background %#lx\n", wnew->dft_background)); + TRACE((" Screen foreground %#lx\n", request->screen.foreground)); + TRACE((" Screen background %#lx\n", request->core.background_pixel)); + + wnew->screen.mouse_button = -1; + wnew->screen.mouse_row = -1; + wnew->screen.mouse_col = -1; + + init_Bres(screen.force_box_chars); + init_Bres(screen.free_bold_box); + + init_Bres(screen.c132); + init_Bres(screen.curses); + init_Bres(screen.hp_ll_bc); #if OPT_XMC_GLITCH - init_Ires(screen.xmc_glitch); - init_Ires(screen.xmc_attributes); - init_Bres(screen.xmc_inline); - init_Bres(screen.move_sgr_ok); + init_Ires(screen.xmc_glitch); + init_Ires(screen.xmc_attributes); + init_Bres(screen.xmc_inline); + init_Bres(screen.move_sgr_ok); #endif - init_Cres(screen.foreground); - init_Cres(screen.cursorcolor); + init_Cres(screen.foreground); + init_Cres(screen.cursorcolor); #if OPT_BLINK_CURS - init_Bres(screen.cursor_blink); - init_Ires(screen.cursor_on); - init_Ires(screen.cursor_off); -#endif - init_Ires(screen.border); - init_Bres(screen.jumpscroll); - init_Bres(screen.old_fkeys); - init_Bres(screen.delete_is_del); - wnew->keyboard.type = wnew->screen.old_fkeys - ? keyboardIsLegacy - : keyboardIsDefault; + init_Bres(screen.cursor_blink); + init_Ires(screen.cursor_on); + init_Ires(screen.cursor_off); +#endif + init_Ires(screen.border); + init_Bres(screen.jumpscroll); + init_Bres(screen.old_fkeys); + init_Bres(screen.delete_is_del); + wnew->keyboard.type = wnew->screen.old_fkeys + ? keyboardIsLegacy + : keyboardIsDefault; #ifdef ALLOWLOGGING - init_Sres(screen.logfile); + init_Sres(screen.logfile); #endif - init_Bres(screen.marginbell); - init_Cres(screen.mousecolor); - init_Cres(screen.mousecolorback); - init_Bres(screen.multiscroll); - init_Ires(screen.nmarginbell); - init_Ires(screen.savelines); - init_Ires(screen.scrolllines); - init_Bres(screen.scrollttyoutput); - init_Bres(screen.scrollkey); + init_Bres(screen.marginbell); + init_Cres(screen.mousecolor); + init_Cres(screen.mousecolorback); + init_Bres(screen.multiscroll); + init_Ires(screen.nmarginbell); + init_Ires(screen.savelines); + init_Ires(screen.scrolllines); + init_Bres(screen.scrollttyoutput); + init_Bres(screen.scrollkey); - init_Sres(screen.term_id); - for (s = request->screen.term_id; *s; s++) { + init_Sres(screen.term_id); + for (s = request->screen.term_id; *s; s++) { if (!isalpha(CharOf(*s))) break; - } - wnew->screen.terminal_id = atoi(s); - if (wnew->screen.terminal_id < MIN_DECID) - wnew->screen.terminal_id = MIN_DECID; - if (wnew->screen.terminal_id > MAX_DECID) - wnew->screen.terminal_id = MAX_DECID; - TRACE(("term_id '%s' -> terminal_id %d\n", - wnew->screen.term_id, - wnew->screen.terminal_id)); - - wnew->screen.ansi_level = (wnew->screen.terminal_id / 100); - init_Bres(screen.visualbell); - init_Bres(screen.poponbell); - init_Ires(misc.limit_resize); + } + wnew->screen.terminal_id = atoi(s); + if (wnew->screen.terminal_id < MIN_DECID) + wnew->screen.terminal_id = MIN_DECID; + if (wnew->screen.terminal_id > MAX_DECID) + wnew->screen.terminal_id = MAX_DECID; + TRACE(("term_id '%s' -> terminal_id %d\n", + wnew->screen.term_id, + wnew->screen.terminal_id)); + + wnew->screen.ansi_level = (wnew->screen.terminal_id / 100); + init_Bres(screen.visualbell); + init_Bres(screen.poponbell); + init_Ires(misc.limit_resize); #if OPT_NUM_LOCK - init_Bres(misc.real_NumLock); - init_Bres(misc.alwaysUseMods); - wnew->misc.num_lock = 0; - wnew->misc.alt_left = 0; - wnew->misc.alt_right = 0; - wnew->misc.meta_trans = False; - wnew->misc.meta_left = 0; - wnew->misc.meta_right = 0; + init_Bres(misc.real_NumLock); + init_Bres(misc.alwaysUseMods); + wnew->misc.num_lock = 0; + wnew->misc.alt_left = 0; + wnew->misc.alt_right = 0; + wnew->misc.meta_trans = False; + wnew->misc.meta_left = 0; + wnew->misc.meta_right = 0; #endif #if OPT_SHIFT_FONTS - init_Bres(misc.shift_fonts); + init_Bres(misc.shift_fonts); #endif #if OPT_SUNPC_KBD - init_Ires(misc.ctrl_fkeys); + init_Ires(misc.ctrl_fkeys); #endif #if OPT_TEK4014 - init_Bres(misc.tekInhibit); - init_Bres(misc.tekSmall); - init_Bres(screen.TekEmu); + init_Bres(misc.tekInhibit); + init_Bres(misc.tekSmall); + init_Bres(screen.TekEmu); #endif #if OPT_TCAP_QUERY - wnew->screen.tc_query = -1; + wnew->screen.tc_query = -1; #endif - wnew->misc.re_verse0 = request->misc.re_verse; - init_Bres(misc.re_verse); - init_Ires(screen.multiClickTime); - init_Ires(screen.bellSuppressTime); - init_Sres(screen.charClass); - init_Bres(screen.cutNewline); - init_Bres(screen.cutToBeginningOfLine); - init_Bres(screen.highlight_selection); - init_Bres(screen.trim_selection); - init_Bres(screen.i18nSelections); - init_Bres(screen.brokenSelections); - init_Bres(screen.always_highlight); - wnew->screen.pointer_cursor = request->screen.pointer_cursor; - - init_Sres(screen.answer_back); - - init_Sres(screen.printer_command); - init_Bres(screen.printer_autoclose); - init_Bres(screen.printer_extent); - init_Bres(screen.printer_formfeed); - init_Ires(screen.printer_controlmode); + wnew->misc.re_verse0 = request->misc.re_verse; + init_Bres(misc.re_verse); + init_Ires(screen.multiClickTime); + init_Ires(screen.bellSuppressTime); + init_Sres(screen.charClass); + init_Bres(screen.cutNewline); + init_Bres(screen.cutToBeginningOfLine); + init_Bres(screen.highlight_selection); + init_Bres(screen.trim_selection); + init_Bres(screen.i18nSelections); + init_Bres(screen.brokenSelections); + init_Bres(screen.always_highlight); + wnew->screen.pointer_cursor = request->screen.pointer_cursor; + + init_Sres(screen.answer_back); + + init_Sres(screen.printer_command); + init_Bres(screen.printer_autoclose); + init_Bres(screen.printer_extent); + init_Bres(screen.printer_formfeed); + init_Ires(screen.printer_controlmode); #if OPT_PRINT_COLORS - init_Ires(screen.print_attributes); + init_Ires(screen.print_attributes); #endif - init_Sres(screen.keyboard_dialect); + init_Sres(screen.keyboard_dialect); - init_Bres(screen.input_eight_bits); - init_Bres(screen.output_eight_bits); - init_Bres(screen.control_eight_bits); - init_Bres(screen.backarrow_key); - init_Bres(screen.meta_sends_esc); - init_Bres(screen.allowSendEvents); + init_Bres(screen.input_eight_bits); + init_Bres(screen.output_eight_bits); + init_Bres(screen.control_eight_bits); + init_Bres(screen.backarrow_key); + init_Bres(screen.meta_sends_esc); + init_Bres(screen.allowSendEvents); + init_Bres(screen.allowWindowOps); #ifndef NO_ACTIVE_ICON - wnew->screen.fnt_icon = request->screen.fnt_icon; + wnew->screen.fnt_icon = request->screen.fnt_icon; #endif /* NO_ACTIVE_ICON */ - init_Bres(misc.titeInhibit); - init_Bres(misc.tiXtraScroll); - init_Bres(misc.dynamicColors); - for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) { - init_Sres(screen.menu_font_names[i]); - } - /* set default in realize proc */ - wnew->screen.menu_font_names[fontMenu_fontdefault] = NULL; - wnew->screen.menu_font_names[fontMenu_fontescape] = NULL; - wnew->screen.menu_font_names[fontMenu_fontsel] = NULL; - wnew->screen.menu_font_number = fontMenu_fontdefault; + init_Bres(misc.titeInhibit); + init_Bres(misc.tiXtraScroll); + init_Bres(misc.dynamicColors); + for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) { + init_Sres(screen.menu_font_names[i]); + } + /* set default in realize proc */ + wnew->screen.menu_font_names[fontMenu_fontdefault] = NULL; + wnew->screen.menu_font_names[fontMenu_fontescape] = NULL; + wnew->screen.menu_font_names[fontMenu_fontsel] = NULL; + wnew->screen.menu_font_number = fontMenu_fontdefault; #if OPT_DEC_CHRSET - init_Bres(screen.font_doublesize); - init_Ires(screen.cache_doublesize); - if (wnew->screen.cache_doublesize > NUM_CHRSET) - wnew->screen.cache_doublesize = NUM_CHRSET; - if (wnew->screen.cache_doublesize == 0) - wnew->screen.font_doublesize = False; - TRACE(("Doublesize%s enabled, up to %d fonts\n", - wnew->screen.font_doublesize ? "" : " not", - wnew->screen.cache_doublesize)); + init_Bres(screen.font_doublesize); + init_Ires(screen.cache_doublesize); + if (wnew->screen.cache_doublesize > NUM_CHRSET) + wnew->screen.cache_doublesize = NUM_CHRSET; + if (wnew->screen.cache_doublesize == 0) + wnew->screen.font_doublesize = False; + TRACE(("Doublesize%s enabled, up to %d fonts\n", + wnew->screen.font_doublesize ? "" : " not", + wnew->screen.cache_doublesize)); #endif #if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS - wnew->num_ptrs = (OFF_ATTRS+1); /* OFF_FLAGS, OFF_CHARS, OFF_ATTRS */ + wnew->num_ptrs = (OFF_ATTRS + 1); /* OFF_FLAGS, OFF_CHARS, OFF_ATTRS */ #endif #if OPT_ISO_COLORS - init_Bres(screen.boldColors); - init_Bres(screen.colorAttrMode); - init_Bres(screen.colorBDMode); - init_Bres(screen.colorBLMode); - init_Bres(screen.colorMode); - init_Bres(screen.colorULMode); - init_Bres(screen.colorRVMode); + init_Ires(screen.veryBoldColors); + init_Bres(screen.boldColors); + init_Bres(screen.colorAttrMode); + init_Bres(screen.colorBDMode); + init_Bres(screen.colorBLMode); + init_Bres(screen.colorMode); + init_Bres(screen.colorULMode); + init_Bres(screen.colorRVMode); - for (i = 0, color_ok = False; i < MAXCOLORS; i++) { - wnew->screen.Acolors[i] = request->screen.Acolors[i]; + for (i = 0, color_ok = False; i < MAXCOLORS; i++) { + wnew->screen.Acolors[i] = request->screen.Acolors[i]; #if OPT_COLOR_RES - TRACE(("Acolors[%d] = %s\n", i, request->screen.Acolors[i].resource)); - wnew->screen.Acolors[i].mode = False; - if (strcmp(wnew->screen.Acolors[i].resource, XtDefaultForeground)) - color_ok = True; + TRACE(("Acolors[%d] = %s\n", i, request->screen.Acolors[i].resource)); + wnew->screen.Acolors[i].mode = False; + if (strcmp(wnew->screen.Acolors[i].resource, XtDefaultForeground)) + color_ok = True; #else - TRACE(("Acolors[%d] = %#lx\n", i, request->screen.Acolors[i])); - if (wnew->screen.Acolors[i] != wnew->dft_foreground - && wnew->screen.Acolors[i] != request->screen.foreground - && wnew->screen.Acolors[i] != request->core.background_pixel) - color_ok = True; -#endif - } - - /* If none of the colors are anything other than the foreground or - * background, we'll assume this isn't color, no matter what the colorMode - * resource says. (There doesn't seem to be any good way to determine if - * the resource lookup failed versus the user having misconfigured this). - */ - if (!color_ok) { + TRACE(("Acolors[%d] = %#lx\n", i, request->screen.Acolors[i])); + if (wnew->screen.Acolors[i] != wnew->dft_foreground + && wnew->screen.Acolors[i] != request->screen.foreground + && wnew->screen.Acolors[i] != request->core.background_pixel) + color_ok = True; +#endif + } + /* + * Check if we're trying to use color in a monochrome screen. Disable color + * in that case, since that would make ANSI colors unusable. A 4-bit or + * 8-bit display is usable, so we do not have to check for anything more + * specific. + */ + if (color_ok) { + Display *display = wnew->screen.display; + XVisualInfo template, *visInfoPtr; + int numFound; + + template.visualid = XVisualIDFromVisual(DefaultVisual(display, + XDefaultScreen(display))); + visInfoPtr = XGetVisualInfo(display, (long) VisualIDMask, + &template, &numFound); + if (visInfoPtr == 0 + || numFound == 0 + || visInfoPtr->depth <= 1) { + TRACE(("disabling color since screen is monochrome\n")); + color_ok = False; + } + } + + /* If none of the colors are anything other than the foreground or + * background, we'll assume this isn't color, no matter what the colorMode + * resource says. (There doesn't seem to be any good way to determine if + * the resource lookup failed versus the user having misconfigured this). + */ + if (!color_ok) { wnew->screen.colorMode = False; TRACE(("All colors are foreground or background: disable colorMode\n")); - } - + } #if OPT_EXT_COLORS - wnew->num_ptrs = (OFF_BGRND+1); + wnew->num_ptrs = (OFF_BGRND + 1); #else - wnew->num_ptrs = (OFF_COLOR+1); + wnew->num_ptrs = (OFF_COLOR + 1); #endif - wnew->sgr_foreground = -1; - wnew->sgr_background = -1; - wnew->sgr_extended = 0; + wnew->sgr_foreground = -1; + wnew->sgr_background = -1; + wnew->sgr_extended = 0; #endif /* OPT_ISO_COLORS */ #if OPT_HIGHLIGHT_COLOR - init_Cres(screen.highlightcolor); + init_Cres(screen.highlightcolor); #endif #if OPT_DEC_CHRSET - wnew->num_ptrs = (OFF_CSETS+1); + wnew->num_ptrs = (OFF_CSETS + 1); #endif #if OPT_WIDE_CHARS - init_Bres(screen.wide_chars); - if (request->screen.utf8_mode) { - wnew->screen.wide_chars = True; - wnew->screen.utf8_mode = 2; /* disable further change */ - TRACE(("initialized UTF-8 mode\n")); - } - if (wnew->screen.wide_chars != False) - wnew->num_ptrs = (OFF_COM2H+1); + VTInitialize_locale(request); + +#if OPT_LUIT_PROG + init_Bres(misc.callfilter); + init_Bres(misc.use_encoding); + init_Sres(misc.locale_str); + init_Sres(misc.localefilter); +#endif + + init_Bres(screen.vt100_graphics); + init_Bres(screen.wide_chars); + init_Bres(misc.cjk_width); + if (request->screen.utf8_mode) { + wnew->screen.wide_chars = True; + wnew->screen.utf8_mode = 2; /* disable further change */ + } else { + wnew->screen.utf8_mode = 0; + } + TRACE(("initialized UTF-8 mode to %d\n", wnew->screen.utf8_mode)); + + if (wnew->screen.wide_chars != False) + wnew->num_ptrs = (OFF_COM2H + 1); #endif - init_Bres(screen.bold_mode); - init_Bres(screen.underline); + init_Bres(screen.bold_mode); + init_Bres(screen.underline); #ifdef XRENDERFONT - wnew->screen.renderFont = 0; - wnew->screen.renderFontBold = 0; - wnew->screen.renderDraw = 0; -#endif - - wnew->cur_foreground = 0; - wnew->cur_background = 0; - - wnew->keyboard.flags = MODE_SRM; - if (wnew->screen.backarrow_key) - wnew->keyboard.flags |= MODE_DECBKM; - TRACE(("initialized DECBKM %s\n", - (wnew->keyboard.flags & MODE_DECBKM) ? "on" : "off")); - - /* look for focus related events on the shell, because we need - * to care about the shell's border being part of our focus. - */ - XtAddEventHandler(my_parent, EnterWindowMask, FALSE, - HandleEnterWindow, (Opaque)NULL); - XtAddEventHandler(my_parent, LeaveWindowMask, FALSE, - HandleLeaveWindow, (Opaque)NULL); - XtAddEventHandler(my_parent, FocusChangeMask, FALSE, - HandleFocusChange, (Opaque)NULL); - XtAddEventHandler((Widget)wnew, 0L, TRUE, - VTNonMaskableEvent, (Opaque)NULL); - XtAddEventHandler((Widget)wnew, PropertyChangeMask, FALSE, - HandleBellPropertyChange, (Opaque)NULL); + wnew->screen.renderFont = 0; + wnew->screen.renderFontBold = 0; + wnew->screen.renderDraw = 0; +#endif + + wnew->cur_foreground = 0; + wnew->cur_background = 0; + + wnew->keyboard.flags = MODE_SRM; + if (wnew->screen.backarrow_key) + wnew->keyboard.flags |= MODE_DECBKM; + TRACE(("initialized DECBKM %s\n", + (wnew->keyboard.flags & MODE_DECBKM) ? "on" : "off")); + + /* look for focus related events on the shell, because we need + * to care about the shell's border being part of our focus. + */ + XtAddEventHandler(my_parent, EnterWindowMask, FALSE, + HandleEnterWindow, (Opaque) NULL); + XtAddEventHandler(my_parent, LeaveWindowMask, FALSE, + HandleLeaveWindow, (Opaque) NULL); + XtAddEventHandler(my_parent, FocusChangeMask, FALSE, + HandleFocusChange, (Opaque) NULL); + XtAddEventHandler((Widget) wnew, 0L, TRUE, + VTNonMaskableEvent, (Opaque) NULL); + XtAddEventHandler((Widget) wnew, PropertyChangeMask, FALSE, + HandleBellPropertyChange, (Opaque) NULL); #if HANDLE_STRUCT_NOTIFY #if OPT_TOOLBAR - wnew->screen.fullVwin.menu_bar = request->screen.fullVwin.menu_bar; - init_Ires(screen.fullVwin.menu_height); + wnew->screen.fullVwin.menu_bar = request->screen.fullVwin.menu_bar; + init_Ires(screen.fullVwin.menu_height); #else - /* Flag icon name with "***" on window output when iconified. - * Put in a handler that will tell us when we get Map/Unmap events. - */ - if ( zIconBeep ) + /* Flag icon name with "***" on window output when iconified. + * Put in a handler that will tell us when we get Map/Unmap events. + */ + if (zIconBeep) #endif - XtAddEventHandler(my_parent, StructureNotifyMask, FALSE, - HandleStructNotify, (XtPointer)0); + XtAddEventHandler(my_parent, StructureNotifyMask, FALSE, + HandleStructNotify, (XtPointer) 0); #endif /* HANDLE_STRUCT_NOTIFY */ - wnew->screen.bellInProgress = FALSE; + wnew->screen.bellInProgress = FALSE; - set_character_class (wnew->screen.charClass); + set_character_class(wnew->screen.charClass); - /* create it, but don't realize it */ - ScrollBarOn (wnew, TRUE, FALSE); + /* create it, but don't realize it */ + ScrollBarOn(wnew, TRUE, FALSE); - /* make sure that the resize gravity acceptable */ - if ( wnew->misc.resizeGravity != NorthWestGravity && + /* make sure that the resize gravity acceptable */ + if (wnew->misc.resizeGravity != NorthWestGravity && wnew->misc.resizeGravity != SouthWestGravity) { - Cardinal nparams = 1; + Cardinal nparams = 1; - XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError", - "unsupported resizeGravity resource value (%d)", - (String *) &(wnew->misc.resizeGravity), &nparams); - wnew->misc.resizeGravity = SouthWestGravity; - } - + XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError", + "unsupported resizeGravity resource value (%d)", + (String *) & (wnew->misc.resizeGravity), &nparams); + wnew->misc.resizeGravity = SouthWestGravity; + } #ifndef NO_ACTIVE_ICON - wnew->screen.whichVwin = &wnew->screen.fullVwin; + wnew->screen.whichVwin = &wnew->screen.fullVwin; #if OPT_TEK4014 - wnew->screen.whichTwin = &wnew->screen.fullTwin; + wnew->screen.whichTwin = &wnew->screen.fullTwin; #endif #endif /* NO_ACTIVE_ICON */ @@ -4627,293 +4857,304 @@ wnew->initflags = wnew->flags; + init_Ires(keyboard.modify_cursor_keys); + + init_Ires(misc.appcursorDefault); if (wnew->misc.appcursorDefault) wnew->keyboard.flags |= MODE_DECCKM; + init_Ires(misc.appkeypadDefault); if (wnew->misc.appkeypadDefault) wnew->keyboard.flags |= MODE_DECKPAM; - return; + return; } - -static void VTDestroy (Widget w) +static void +VTDestroy(Widget w) { - XtFree(((XtermWidget)w)->screen.selection_data); + XtFree(((XtermWidget) w)->screen.selection_data); } /*ARGSUSED*/ -static void VTRealize ( - Widget w, - XtValueMask *valuemask, - XSetWindowAttributes *values) -{ - unsigned int width, height; - register TScreen *screen = &term->screen; - int xpos, ypos, pr; - XSizeHints sizehints; - int scrollbar_width; - - TabReset (term->tabs); - - screen->menu_font_names[fontMenu_fontdefault] = term->misc.f_n; - screen->fnt_norm = NULL; - screen->fnt_bold = NULL; +static void +VTRealize(Widget w, + XtValueMask * valuemask, + XSetWindowAttributes * values) +{ + unsigned int width, height; + register TScreen *screen = &term->screen; + int xpos, ypos, pr; + XSizeHints sizehints; + int scrollbar_width; + + TabReset(term->tabs); + + screen->menu_font_names[fontMenu_fontdefault] = term->misc.f_n; + screen->fnt_norm = NULL; + screen->fnt_bold = NULL; #if OPT_WIDE_CHARS - screen->fnt_dwd = NULL; - screen->fnt_dwdb = NULL; + screen->fnt_dwd = NULL; + screen->fnt_dwdb = NULL; #endif - if (!xtermLoadFont(screen, - VT_FONTSET(term->misc.f_n, - term->misc.f_b, - term->misc.f_w, - term->misc.f_wb), - False, 0)) { - if (XmuCompareISOLatin1(term->misc.f_n, "fixed") != 0) { - fprintf (stderr, - "%s: unable to open font \"%s\", trying \"fixed\"....\n", - xterm_name, term->misc.f_n); - (void) xtermLoadFont (screen, - VT_FONTSET("fixed", NULL, NULL, NULL), - False, 0); - screen->menu_font_names[fontMenu_fontdefault] = "fixed"; - } + if (!xtermLoadFont(screen, + VT_FONTSET(term->misc.f_n, + term->misc.f_b, + term->misc.f_w, + term->misc.f_wb), + False, 0)) { + if (XmuCompareISOLatin1(term->misc.f_n, "fixed") != 0) { + fprintf(stderr, + "%s: unable to open font \"%s\", trying \"fixed\"....\n", + xterm_name, term->misc.f_n); + (void) xtermLoadFont(screen, + VT_FONTSET("fixed", NULL, NULL, NULL), + False, 0); + screen->menu_font_names[fontMenu_fontdefault] = "fixed"; } + } - /* really screwed if we couldn't open default font */ - if (!screen->fnt_norm) { - fprintf (stderr, "%s: unable to locate a suitable font\n", - xterm_name); - Exit (1); - } - - /* making cursor */ - if (!screen->pointer_cursor) - screen->pointer_cursor = make_colored_cursor(XC_xterm, - screen->mousecolor, - screen->mousecolorback); - else - recolor_cursor (screen->pointer_cursor, - screen->mousecolor, screen->mousecolorback); + /* really screwed if we couldn't open default font */ + if (!screen->fnt_norm) { + fprintf(stderr, "%s: unable to locate a suitable font\n", + xterm_name); + Exit(1); + } + + /* making cursor */ + if (!screen->pointer_cursor) + screen->pointer_cursor = make_colored_cursor(XC_xterm, + screen->mousecolor, + screen->mousecolorback); + else + recolor_cursor(screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); - scrollbar_width = (term->misc.scrollbar ? - screen->scrollWidget->core.width /* + - screen->scrollWidget->core.border_width */ : 0); - - /* set defaults */ - xpos = 1; ypos = 1; width = 80; height = 24; - pr = XParseGeometry (term->misc.geo_metry, &xpos, &ypos, - &width, &height); - screen->max_col = (width - 1); /* units in character cells */ - screen->max_row = (height - 1); /* units in character cells */ - xtermUpdateFontInfo (&term->screen, False); - - width = screen->fullVwin.fullwidth; - height = screen->fullVwin.fullheight; - - if ((pr & XValue) && (XNegative&pr)) - xpos += DisplayWidth(screen->display, DefaultScreen(screen->display)) - - width - (XtParent(term)->core.border_width * 2); - if ((pr & YValue) && (YNegative&pr)) - ypos += DisplayHeight(screen->display,DefaultScreen(screen->display)) - - height - (XtParent(term)->core.border_width * 2); + scrollbar_width = (term->misc.scrollbar ? + screen->scrollWidget->core.width : 0); - /* set up size hints for window manager; min 1 char by 1 char */ - bzero(&sizehints, sizeof(sizehints)); - sizehints.base_width = 2 * screen->border + scrollbar_width; - sizehints.base_height = 2 * screen->border; - sizehints.width_inc = FontWidth(screen); - sizehints.height_inc = FontHeight(screen); - sizehints.min_width = sizehints.base_width + sizehints.width_inc; - sizehints.min_height = sizehints.base_height + sizehints.height_inc; - sizehints.flags = (PBaseSize|PMinSize|PResizeInc); - sizehints.x = xpos; - sizehints.y = ypos; - if ((XValue&pr) || (YValue&pr)) { - sizehints.flags |= USSize|USPosition; - sizehints.flags |= PWinGravity; - switch (pr & (XNegative | YNegative)) { - case 0: - sizehints.win_gravity = NorthWestGravity; - break; - case XNegative: - sizehints.win_gravity = NorthEastGravity; - break; - case YNegative: - sizehints.win_gravity = SouthWestGravity; - break; - default: - sizehints.win_gravity = SouthEastGravity; - break; - } - } else { - /* set a default size, but do *not* set position */ - sizehints.flags |= PSize; + /* set defaults */ + xpos = 1; + ypos = 1; + width = 80; + height = 24; + pr = XParseGeometry(term->misc.geo_metry, &xpos, &ypos, + &width, &height); + screen->max_col = (width - 1); /* units in character cells */ + screen->max_row = (height - 1); /* units in character cells */ + xtermUpdateFontInfo(&term->screen, False); + + width = screen->fullVwin.fullwidth; + height = screen->fullVwin.fullheight; + + if ((pr & XValue) && (XNegative & pr)) + xpos += DisplayWidth(screen->display, DefaultScreen(screen->display)) + - width - (XtParent(term)->core.border_width * 2); + if ((pr & YValue) && (YNegative & pr)) + ypos += DisplayHeight(screen->display, DefaultScreen(screen->display)) + - height - (XtParent(term)->core.border_width * 2); + + /* set up size hints for window manager; min 1 char by 1 char */ + bzero(&sizehints, sizeof(sizehints)); + sizehints.base_width = 2 * screen->border + scrollbar_width; + sizehints.base_height = 2 * screen->border; + sizehints.width_inc = FontWidth(screen); + sizehints.height_inc = FontHeight(screen); + sizehints.min_width = sizehints.base_width + sizehints.width_inc; + sizehints.min_height = sizehints.base_height + sizehints.height_inc; + sizehints.flags = (PBaseSize | PMinSize | PResizeInc); + sizehints.x = xpos; + sizehints.y = ypos; + if ((XValue & pr) || (YValue & pr)) { + sizehints.flags |= USSize | USPosition; + sizehints.flags |= PWinGravity; + switch (pr & (XNegative | YNegative)) { + case 0: + sizehints.win_gravity = NorthWestGravity; + break; + case XNegative: + sizehints.win_gravity = NorthEastGravity; + break; + case YNegative: + sizehints.win_gravity = SouthWestGravity; + break; + default: + sizehints.win_gravity = SouthEastGravity; + break; } - sizehints.width = width; - sizehints.height = height; - if ((WidthValue&pr) || (HeightValue&pr)) - sizehints.flags |= USSize; - else sizehints.flags |= PSize; - - (void) XtMakeResizeRequest((Widget) term, - (Dimension)width, (Dimension)height, - &term->core.width, &term->core.height); - - /* XXX This is bogus. We are parsing geometries too late. This - * is information that the shell widget ought to have before we get - * realized, so that it can do the right thing. - */ - if (sizehints.flags & USPosition) - XMoveWindow (XtDisplay(term), XtWindow(XtParent(term)), - sizehints.x, sizehints.y); - - XSetWMNormalHints (XtDisplay(term), XtWindow(XtParent(term)), - &sizehints); - XFlush (XtDisplay(term)); /* get it out to window manager */ - - /* use ForgetGravity instead of SouthWestGravity because translating - the Expose events for ConfigureNotifys is too hard */ - values->bit_gravity = term->misc.resizeGravity == NorthWestGravity ? - NorthWestGravity : ForgetGravity; - term->screen.fullVwin.window = XtWindow(term) = - XCreateWindow(XtDisplay(term), XtWindow(XtParent(term)), - term->core.x, term->core.y, - term->core.width, term->core.height, term->core.border_width, - (int) term->core.depth, - InputOutput, CopyFromParent, - *valuemask|CWBitGravity, values); - screen->event_mask = values->event_mask; + } else { + /* set a default size, but do *not* set position */ + sizehints.flags |= PSize; + } + sizehints.width = width; + sizehints.height = height; + if ((WidthValue & pr) || (HeightValue & pr)) + sizehints.flags |= USSize; + else + sizehints.flags |= PSize; + (void) XtMakeResizeRequest((Widget) term, + (Dimension) width, (Dimension) height, + &term->core.width, &term->core.height); + + /* XXX This is bogus. We are parsing geometries too late. This + * is information that the shell widget ought to have before we get + * realized, so that it can do the right thing. + */ + if (sizehints.flags & USPosition) + XMoveWindow(XtDisplay(term), XtWindow(XtParent(term)), + sizehints.x, sizehints.y); + + XSetWMNormalHints(XtDisplay(term), XtWindow(XtParent(term)), + &sizehints); + XFlush(XtDisplay(term)); /* get it out to window manager */ + + /* use ForgetGravity instead of SouthWestGravity because translating + the Expose events for ConfigureNotifys is too hard */ + values->bit_gravity = term->misc.resizeGravity == NorthWestGravity ? + NorthWestGravity : ForgetGravity; + term->screen.fullVwin.window = XtWindow(term) = + XCreateWindow(XtDisplay(term), XtWindow(XtParent(term)), + term->core.x, term->core.y, + term->core.width, term->core.height, term->core.border_width, + (int) term->core.depth, + InputOutput, CopyFromParent, + *valuemask | CWBitGravity, values); + screen->event_mask = values->event_mask; + #ifndef NO_ACTIVE_ICON - if (term->misc.active_icon && screen->fnt_icon) { - int iconX=0, iconY=0; - Widget shell = XtParent(term); - unsigned long mask; - XGCValues xgcv; + if (term->misc.active_icon && screen->fnt_icon) { + int iconX = 0, iconY = 0; + Widget shell = XtParent(term); + unsigned long mask; + XGCValues xgcv; - XtVaGetValues(shell, XtNiconX, &iconX, XtNiconY, &iconY, NULL); - xtermComputeFontInfo (screen, &(screen->iconVwin), screen->fnt_icon, 0); + XtVaGetValues(shell, XtNiconX, &iconX, XtNiconY, &iconY, (XtPointer) 0); + xtermComputeFontInfo(screen, &(screen->iconVwin), screen->fnt_icon, 0); - /* since only one client is permitted to select for Button - * events, we have to let the window manager get 'em... - */ - values->event_mask &= ~(ButtonPressMask|ButtonReleaseMask); - values->border_pixel = term->misc.icon_border_pixel; + /* since only one client is permitted to select for Button + * events, we have to let the window manager get 'em... + */ + values->event_mask &= ~(ButtonPressMask | ButtonReleaseMask); + values->border_pixel = term->misc.icon_border_pixel; - screen->iconVwin.window = - XCreateWindow(XtDisplay(term), - RootWindowOfScreen(XtScreen(shell)), - iconX, iconY, - screen->iconVwin.fullwidth, - screen->iconVwin.fullheight, - term->misc.icon_border_width, - (int) term->core.depth, - InputOutput, CopyFromParent, - *valuemask|CWBitGravity|CWBorderPixel, - values); - XtVaSetValues(shell, XtNiconWindow, screen->iconVwin.window, NULL); - XtRegisterDrawable(XtDisplay(term), screen->iconVwin.window, w); - - mask = (GCFont | GCForeground | GCBackground | - GCGraphicsExposures | GCFunction); - - xgcv.font = screen->fnt_icon->fid; - xgcv.foreground = screen->foreground; - xgcv.background = term->core.background_pixel; - xgcv.graphics_exposures = TRUE; /* default */ - xgcv.function = GXcopy; - - screen->iconVwin.normalGC = - screen->iconVwin.normalboldGC = - XtGetGC(shell, mask, &xgcv); - - xgcv.foreground = term->core.background_pixel; - xgcv.background = screen->foreground; - - screen->iconVwin.reverseGC = - screen->iconVwin.reverseboldGC = - XtGetGC(shell, mask, &xgcv); - } - else { - term->misc.active_icon = False; - } + screen->iconVwin.window = + XCreateWindow(XtDisplay(term), + RootWindowOfScreen(XtScreen(shell)), + iconX, iconY, + screen->iconVwin.fullwidth, + screen->iconVwin.fullheight, + term->misc.icon_border_width, + (int) term->core.depth, + InputOutput, CopyFromParent, + *valuemask | CWBitGravity | CWBorderPixel, + values); + XtVaSetValues(shell, + XtNiconWindow, screen->iconVwin.window, + (XtPointer) 0); + XtRegisterDrawable(XtDisplay(term), screen->iconVwin.window, w); + + mask = (GCFont | GCForeground | GCBackground | + GCGraphicsExposures | GCFunction); + + xgcv.font = screen->fnt_icon->fid; + xgcv.foreground = screen->foreground; + xgcv.background = term->core.background_pixel; + xgcv.graphics_exposures = TRUE; /* default */ + xgcv.function = GXcopy; + + screen->iconVwin.normalGC = + screen->iconVwin.normalboldGC = + XtGetGC(shell, mask, &xgcv); + + xgcv.foreground = term->core.background_pixel; + xgcv.background = screen->foreground; + + screen->iconVwin.reverseGC = + screen->iconVwin.reverseboldGC = + XtGetGC(shell, mask, &xgcv); + } else { + term->misc.active_icon = False; + } #endif /* NO_ACTIVE_ICON */ #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD - VTInitI18N(); + VTInitI18N(); #else - term->screen.xic = NULL; + term->screen.xic = NULL; #endif #if OPT_NUM_LOCK - VTInitModifiers(); + VTInitModifiers(); #endif - set_cursor_gcs (screen); + set_cursor_gcs(screen); - /* Reset variables used by ANSI emulation. */ + /* Reset variables used by ANSI emulation. */ - resetCharsets(screen); + resetCharsets(screen); - XDefineCursor(screen->display, VShellWindow, screen->pointer_cursor); + XDefineCursor(screen->display, VShellWindow, screen->pointer_cursor); - screen->cur_col = screen->cur_row = 0; - screen->max_col = Width(screen)/screen->fullVwin.f_width - 1; - screen->top_marg = 0; - screen->bot_marg = screen->max_row = Height(screen) / - screen->fullVwin.f_height - 1; + screen->cur_col = screen->cur_row = 0; + screen->max_col = Width(screen) / screen->fullVwin.f_width - 1; + screen->top_marg = 0; + screen->bot_marg = screen->max_row = Height(screen) / + screen->fullVwin.f_height - 1; - memset(screen->sc, 0, sizeof(screen->sc)); + memset(screen->sc, 0, sizeof(screen->sc)); - /* Mark screen buffer as unallocated. We wait until the run loop so - that the child process does not fork and exec with all the dynamic - memory it will never use. If we were to do it here, the - swap space for new process would be huge for huge savelines. */ + /* Mark screen buffer as unallocated. We wait until the run loop so + that the child process does not fork and exec with all the dynamic + memory it will never use. If we were to do it here, the + swap space for new process would be huge for huge savelines. */ #if OPT_TEK4014 - if (!tekWidget) /* if not called after fork */ + if (!tekWidget) /* if not called after fork */ #endif - screen->visbuf = screen->allbuf = NULL; + screen->visbuf = screen->allbuf = NULL; - screen->do_wrap = 0; - screen->scrolls = screen->incopy = 0; - xtermSetCursorBox (screen); + screen->do_wrap = 0; + screen->scrolls = screen->incopy = 0; + xtermSetCursorBox(screen); - screen->savedlines = 0; + screen->savedlines = 0; - if (term->misc.scrollbar) { - screen->fullVwin.sb_info.width = 0; - ScrollBarOn (term, FALSE, TRUE); - } - CursorSave (term); - return; + if (term->misc.scrollbar) { + screen->fullVwin.sb_info.width = 0; + ScrollBarOn(term, FALSE, TRUE); + } + CursorSave(term); + return; } #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD -static void VTInitI18N(void) +static void +VTInitI18N(void) { - unsigned i, j; - char *p, - *s, - *t, - *ns, - *end, - buf[32]; - XIM xim = (XIM) NULL; - XIMStyles *xim_styles; - XIMStyle input_style = 0; - Boolean found; + unsigned i, j; + char *p, *s, *t, *ns, *end, buf[32]; + XIM xim = (XIM) NULL; + XIMStyles *xim_styles; + XIMStyle input_style = 0; + Boolean found; static struct { char *name; unsigned long code; } known_style[] = { - { "OverTheSpot", (XIMPreeditPosition | XIMStatusNothing) }, - { "OffTheSpot", (XIMPreeditArea | XIMStatusArea) }, - { "Root", (XIMPreeditNothing | XIMStatusNothing) }, + { + "OverTheSpot", (XIMPreeditPosition | XIMStatusNothing) + }, + { + "OffTheSpot", (XIMPreeditArea | XIMStatusArea) + }, + { + "Root", (XIMPreeditNothing | XIMStatusNothing) + }, }; term->screen.xic = NULL; - if (!term->misc.open_im) return; + if (!term->misc.open_im) + return; if (!term->misc.input_method || !*term->misc.input_method) { if ((p = XSetLocaleModifiers("")) != NULL && *p) @@ -4921,16 +5162,19 @@ } else { s = term->misc.input_method; i = 5 + strlen(s); - t = (char *)MyStackAlloc(i, buf); + t = (char *) MyStackAlloc(i, buf); if (t == NULL) SysError(ERROR_VINIT); - for(ns = s; ns && *s;) { - while (*s && isspace(CharOf(*s))) s++; - if (!*s) break; + for (ns = s; ns && *s;) { + while (*s && isspace(CharOf(*s))) + s++; + if (!*s) + break; if ((ns = end = strchr(s, ',')) == 0) end = s + strlen(s); - while ((end != s) && isspace(CharOf(end[-1]))) end--; + while ((end != s) && isspace(CharOf(end[-1]))) + end--; if (end != s) { strcpy(t, "@im="); @@ -4964,20 +5208,23 @@ } found = False; - for(s = term->misc.preedit_type; s && !found;) { - while (*s && isspace(CharOf(*s))) s++; - if (!*s) break; + for (s = term->misc.preedit_type; s && !found;) { + while (*s && isspace(CharOf(*s))) + s++; + if (!*s) + break; if ((ns = end = strchr(s, ',')) != 0) ns++; else end = s + strlen(s); - while ((end != s) && isspace(CharOf(end[-1]))) end--; + while ((end != s) && isspace(CharOf(end[-1]))) + end--; - if (end != s) { /* just in case we have a spurious comma */ + if (end != s) { /* just in case we have a spurious comma */ TRACE(("looking for style '%.*s'\n", end - s, s)); - for (i = 0; i < sizeof(known_style)/sizeof(known_style[0]); i++) { - if ((int)strlen(known_style[i].name) == (end - s) - && !strncmp(s, known_style[i].name, end - s)) { + for (i = 0; i < XtNumber(known_style); i++) { + if ((int) strlen(known_style[i].name) == (end - s) + && !strncmp(s, known_style[i].name, end - s)) { input_style = known_style[i].code; for (j = 0; j < xim_styles->count_styles; j++) { if (input_style == xim_styles->supported_styles[j]) { @@ -4996,7 +5243,8 @@ XFree(xim_styles); if (!found) { - fprintf(stderr, "input method doesn't support my preedit type (%s)\n", + fprintf(stderr, + "input method doesn't support my preedit type (%s)\n", term->misc.preedit_type); XCloseIM(xim); return; @@ -5006,7 +5254,8 @@ * Check for styles we do not yet support. */ if (input_style == (XIMPreeditArea | XIMStatusArea)) { - fprintf(stderr,"This program doesn't support the 'OffTheSpot' preedit type\n"); + fprintf(stderr, + "This program doesn't support the 'OffTheSpot' preedit type\n"); XCloseIM(xim); return; } @@ -5023,7 +5272,8 @@ int missing_charset_count; char *def_string; XVaNestedList p_list; - XPoint spot = {0, 0}; + XPoint spot = + {0, 0}; XFontSetExtents *extents; XFontStruct **fonts; char **font_name_list; @@ -5034,7 +5284,7 @@ &missing_charset_count, &def_string); if (term->screen.fs == NULL) { - fprintf(stderr,"Preparation of font set " + fprintf(stderr, "Preparation of font set " "\"%s\" for XIM failed.\n", term->misc.f_x); term->screen.fs = XCreateFontSet(XtDisplay(term), DEFXIMFONT, @@ -5043,7 +5293,7 @@ &def_string); } if (term->screen.fs == NULL) { - fprintf(stderr,"Preparation of default font set " + fprintf(stderr, "Preparation of default font set " "\"%s\" for XIM failed.\n", DEFXIMFONT); XCloseIM(xim); return; @@ -5072,63 +5322,61 @@ } if (!term->screen.xic) { - fprintf(stderr,"Failed to create input context\n"); + fprintf(stderr, "Failed to create input context\n"); XCloseIM(xim); } return; } #endif - -static Boolean VTSetValues ( - Widget cur, - Widget request GCC_UNUSED, - Widget wnew, - ArgList args GCC_UNUSED, - Cardinal *num_args GCC_UNUSED) +static Boolean +VTSetValues(Widget cur, + Widget request GCC_UNUSED, + Widget wnew, + ArgList args GCC_UNUSED, + Cardinal * num_args GCC_UNUSED) { XtermWidget curvt = (XtermWidget) cur; XtermWidget newvt = (XtermWidget) wnew; Boolean refresh_needed = FALSE; Boolean fonts_redone = FALSE; - if(curvt->core.background_pixel != newvt->core.background_pixel - || curvt->screen.foreground != newvt->screen.foreground - || curvt->screen.menu_font_names[curvt->screen.menu_font_number] - != newvt->screen.menu_font_names[newvt->screen.menu_font_number] - || curvt->misc.f_n != newvt->misc.f_n) { - if(curvt->misc.f_n != newvt->misc.f_n) + if (curvt->core.background_pixel != newvt->core.background_pixel + || curvt->screen.foreground != newvt->screen.foreground + || curvt->screen.menu_font_names[curvt->screen.menu_font_number] + != newvt->screen.menu_font_names[newvt->screen.menu_font_number] + || curvt->misc.f_n != newvt->misc.f_n) { + if (curvt->misc.f_n != newvt->misc.f_n) newvt->screen.menu_font_names[fontMenu_fontdefault] = newvt->misc.f_n; if (xtermLoadFont(&newvt->screen, - VT_FONTSET(newvt->screen.menu_font_names[curvt->screen.menu_font_number], - newvt->screen.menu_font_names[curvt->screen.menu_font_number], - NULL, - NULL), - TRUE, newvt->screen.menu_font_number)) { + VT_FONTSET(newvt->screen.menu_font_names[curvt->screen.menu_font_number], + newvt->screen.menu_font_names[curvt->screen.menu_font_number], + NULL, + NULL), + TRUE, newvt->screen.menu_font_number)) { /* resizing does the redisplay, so don't ask for it here */ refresh_needed = TRUE; fonts_redone = TRUE; - } else - if(curvt->misc.f_n != newvt->misc.f_n) - newvt->screen.menu_font_names[fontMenu_fontdefault] = curvt->misc.f_n; + } else if (curvt->misc.f_n != newvt->misc.f_n) + newvt->screen.menu_font_names[fontMenu_fontdefault] = curvt->misc.f_n; } - if(!fonts_redone - && curvt->screen.cursorcolor != newvt->screen.cursorcolor) { + if (!fonts_redone + && curvt->screen.cursorcolor != newvt->screen.cursorcolor) { set_cursor_gcs(&newvt->screen); refresh_needed = TRUE; } - if(curvt->misc.re_verse != newvt->misc.re_verse) { + if (curvt->misc.re_verse != newvt->misc.re_verse) { newvt->flags ^= REVERSE_VIDEO; ReverseVideo(newvt); - newvt->misc.re_verse = !newvt->misc.re_verse; /* ReverseVideo toggles */ + newvt->misc.re_verse = !newvt->misc.re_verse; /* ReverseVideo toggles */ refresh_needed = TRUE; } - if(curvt->screen.mousecolor != newvt->screen.mousecolor - || curvt->screen.mousecolorback != newvt->screen.mousecolorback) { - recolor_cursor (newvt->screen.pointer_cursor, - newvt->screen.mousecolor, - newvt->screen.mousecolorback); + if (curvt->screen.mousecolor != newvt->screen.mousecolor + || curvt->screen.mousecolorback != newvt->screen.mousecolorback) { + recolor_cursor(newvt->screen.pointer_cursor, + newvt->screen.mousecolor, + newvt->screen.mousecolorback); refresh_needed = TRUE; } if (curvt->misc.scrollbar != newvt->misc.scrollbar) { @@ -5144,203 +5392,204 @@ void ShowCursor(void) { - register TScreen *screen = &term->screen; - register int x, y, flags; - Char clo; - int fg_bg = 0; - GC currentGC; - Boolean in_selection; - Boolean reversed; - Pixel fg_pix; - Pixel bg_pix; - Pixel tmp; + register TScreen *screen = &term->screen; + register int x, y, flags; + Char clo; + int fg_bg = 0; + GC currentGC; + Boolean in_selection; + Boolean reversed; + Pixel fg_pix; + Pixel bg_pix; + Pixel tmp; #if OPT_HIGHLIGHT_COLOR - Pixel hi_pix = screen->highlightcolor; + Pixel hi_pix = screen->highlightcolor; #endif #if OPT_WIDE_CHARS - Char chi = 0; - Char c1h = 0; - Char c1l = 0; - Char c2h = 0; - Char c2l = 0; - int base; + Char chi = 0; + Char c1h = 0; + Char c1l = 0; + Char c2h = 0; + Char c2l = 0; + int base; #endif - int cursor_col; + int cursor_col; - if (screen->cursor_state == BLINKED_OFF) - return; + if (screen->cursor_state == BLINKED_OFF) + return; - if (eventMode != NORMAL) return; + if (eventMode != NORMAL) + return; - if (screen->cur_row - screen->topline > screen->max_row) - return; + if (screen->cur_row - screen->topline > screen->max_row) + return; - screen->cursor_row = screen->cur_row; - cursor_col = screen->cursor_col = screen->cur_col; + screen->cursor_row = screen->cur_row; + cursor_col = screen->cursor_col = screen->cur_col; #ifndef NO_ACTIVE_ICON - if (IsIcon(screen)) { - screen->cursor_state = ON; - return; - } + if (IsIcon(screen)) { + screen->cursor_state = ON; + return; + } #endif /* NO_ACTIVE_ICON */ #if OPT_WIDE_CHARS - base = + base = #endif - clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; - if_OPT_WIDE_CHARS(screen,{ - int my_col; + if_OPT_WIDE_CHARS(screen, { + int my_col; + chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; + if (clo == HIDDEN_LO && chi == HIDDEN_HI) { + /* if cursor points to non-initial part of wide character, + * back it up + */ + --cursor_col; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; - if (clo == HIDDEN_LO && chi == HIDDEN_HI) { - /* if cursor points to non-initial part of wide character, - * back it up - */ - --cursor_col; - clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; - chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; - } - my_col = cursor_col; - base = (chi << 8) | clo; - if (iswide(base)) - my_col += 1; - c1l = SCRN_BUF_COM1L(screen, screen->cursor_row)[my_col]; - c1h = SCRN_BUF_COM1H(screen, screen->cursor_row)[my_col]; - c2l = SCRN_BUF_COM2L(screen, screen->cursor_row)[my_col]; - c2h = SCRN_BUF_COM2H(screen, screen->cursor_row)[my_col]; - }) + } + my_col = cursor_col; + base = (chi << 8) | clo; + if (iswide(base)) + my_col += 1; + c1l = SCRN_BUF_COM1L(screen, screen->cursor_row)[my_col]; + c1h = SCRN_BUF_COM1H(screen, screen->cursor_row)[my_col]; + c2l = SCRN_BUF_COM2L(screen, screen->cursor_row)[my_col]; + c2h = SCRN_BUF_COM2H(screen, screen->cursor_row)[my_col]; + }); - flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[cursor_col]; + flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[cursor_col]; - if (clo == 0 + if (clo == 0 #if OPT_WIDE_CHARS - && chi == 0 + && chi == 0 #endif ) { - clo = ' '; - } + clo = ' '; + } - /* - * Compare the current cell to the last set of colors used for the - * cursor and update the GC's if needed. - */ - if_OPT_EXT_COLORS(screen,{ - fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[cursor_col] << 8) | - (SCRN_BUF_BGRND(screen, screen->cursor_row)[cursor_col]); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[cursor_col]; - }) - fg_pix = getXtermForeground(flags,extract_fg(fg_bg,flags)); - bg_pix = getXtermBackground(flags,extract_bg(fg_bg,flags)); - - if (screen->cur_row > screen->endHRow || - (screen->cur_row == screen->endHRow && - screen->cur_col >= screen->endHCol) || - screen->cur_row < screen->startHRow || - (screen->cur_row == screen->startHRow && - screen->cur_col < screen->startHCol)) - in_selection = False; - else - in_selection = True; + /* + * Compare the current cell to the last set of colors used for the + * cursor and update the GC's if needed. + */ + if_OPT_EXT_COLORS(screen, { + fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[cursor_col] << 8) + | (SCRN_BUF_BGRND(screen, screen->cursor_row)[cursor_col]); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[cursor_col]; + }); + fg_pix = getXtermForeground(flags, extract_fg(fg_bg, flags)); + bg_pix = getXtermBackground(flags, extract_bg(fg_bg, flags)); + + if (screen->cur_row > screen->endHRow || + (screen->cur_row == screen->endHRow && + screen->cur_col >= screen->endHCol) || + screen->cur_row < screen->startHRow || + (screen->cur_row == screen->startHRow && + screen->cur_col < screen->startHCol)) + in_selection = False; + else + in_selection = True; - reversed = ReverseOrHilite(screen, flags, in_selection); + reversed = ReverseOrHilite(screen, flags, in_selection); - /* This is like updatedXtermGC(), except that we have to worry about - * whether the window has focus, since in that case we want just an - * outline for the cursor. - */ - if(screen->select || screen->always_highlight) { - if (reversed) { /* text is reverse video */ - if (screen->cursorGC) { - currentGC = screen->cursorGC; - } else { - if (flags & (BOLD|BLINK)) { - currentGC = NormalBoldGC(screen); - } else { - currentGC = NormalGC(screen); - } - } + /* This is like updatedXtermGC(), except that we have to worry about + * whether the window has focus, since in that case we want just an + * outline for the cursor. + */ + if (screen->select || screen->always_highlight) { + if (reversed) { /* text is reverse video */ + if (screen->cursorGC) { + currentGC = screen->cursorGC; + } else { + if (flags & (BOLD | BLINK)) { + currentGC = NormalBoldGC(screen); + } else { + currentGC = NormalGC(screen); + } + } #if OPT_HIGHLIGHT_COLOR - if (hi_pix != screen->foreground - && hi_pix != fg_pix - && hi_pix != bg_pix - && hi_pix != term->dft_foreground) { - bg_pix = fg_pix; - fg_pix = hi_pix; - } + if (hi_pix != screen->foreground + && hi_pix != fg_pix + && hi_pix != bg_pix + && hi_pix != term->dft_foreground) { + bg_pix = fg_pix; + fg_pix = hi_pix; + } #endif - EXCHANGE(fg_pix, bg_pix, tmp) - } else { /* normal video */ - if (screen->reversecursorGC) { - currentGC = screen->reversecursorGC; - } else { - if (flags & (BOLD|BLINK)) { - currentGC = ReverseBoldGC(screen); - } else { - currentGC = ReverseGC(screen); - } - } - } - if (screen->cursorcolor == term->dft_foreground) { - XSetBackground(screen->display, currentGC, fg_pix); + EXCHANGE(fg_pix, bg_pix, tmp) + } else { /* normal video */ + if (screen->reversecursorGC) { + currentGC = screen->reversecursorGC; + } else { + if (flags & (BOLD | BLINK)) { + currentGC = ReverseBoldGC(screen); + } else { + currentGC = ReverseGC(screen); } - XSetForeground(screen->display, currentGC, bg_pix); - } else { /* not selected */ - if (reversed) { /* text is reverse video */ + } + } + if (screen->cursorcolor == term->dft_foreground) { + XSetBackground(screen->display, currentGC, fg_pix); + } + XSetForeground(screen->display, currentGC, bg_pix); + } else { /* not selected */ + if (reversed) { /* text is reverse video */ #if OPT_HIGHLIGHT_COLOR - if (hi_pix != screen->foreground - && hi_pix != fg_pix - && hi_pix != bg_pix - && hi_pix != term->dft_foreground) { - bg_pix = fg_pix; - fg_pix = hi_pix; - } + if (hi_pix != screen->foreground + && hi_pix != fg_pix + && hi_pix != bg_pix + && hi_pix != term->dft_foreground) { + bg_pix = fg_pix; + fg_pix = hi_pix; + } #endif - currentGC = ReverseGC(screen); - XSetForeground(screen->display, currentGC, bg_pix); - XSetBackground(screen->display, currentGC, fg_pix); - } else { /* normal video */ - currentGC = NormalGC(screen); - XSetForeground(screen->display, currentGC, fg_pix); - XSetBackground(screen->display, currentGC, bg_pix); - } + currentGC = ReverseGC(screen); + XSetForeground(screen->display, currentGC, bg_pix); + XSetBackground(screen->display, currentGC, fg_pix); + } else { /* normal video */ + currentGC = NormalGC(screen); + XSetForeground(screen->display, currentGC, fg_pix); + XSetBackground(screen->display, currentGC, bg_pix); } + } - TRACE(("%s @%d, ShowCursor calling drawXtermText cur(%d,%d)\n", __FILE__, __LINE__, - screen->cur_row, screen->cur_col)); + TRACE(("ShowCursor calling drawXtermText cur(%d,%d)\n", + screen->cur_row, screen->cur_col)); - drawXtermText(screen, flags, currentGC, - x = CurCursorX(screen, screen->cur_row, cursor_col), - y = CursorY(screen, screen->cur_row), - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&clo, &chi), 1, 0); + drawXtermText(screen, flags, currentGC, + x = CurCursorX(screen, screen->cur_row, cursor_col), + y = CursorY(screen, screen->cur_row), + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(&clo, &chi), 1, 0); #if OPT_WIDE_CHARS - if (c1l || c1h) { - drawXtermText(screen, flags, currentGC, - x, y, - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&c1l, &c1h), 1, iswide(base)); - - if (c2l || c2h) - drawXtermText(screen, flags, currentGC, - x, y, - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&c2l, &c2h), 1, iswide(base)); - } + if (c1l || c1h) { + drawXtermText(screen, flags, currentGC, + x, y, + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(&c1l, &c1h), 1, iswide(base)); + + if (c2l || c2h) + drawXtermText(screen, flags, currentGC, + x, y, + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(&c2l, &c2h), 1, iswide(base)); + } #endif - if (!screen->select && !screen->always_highlight) { - screen->box->x = x; - screen->box->y = y; - XDrawLines (screen->display, VWindow(screen), - screen->cursoroutlineGC ? screen->cursoroutlineGC - : currentGC, - screen->box, NBOX, CoordModePrevious); - } - screen->cursor_state = ON; + if (!screen->select && !screen->always_highlight) { + screen->box->x = x; + screen->box->y = y; + XDrawLines(screen->display, VWindow(screen), + screen->cursoroutlineGC ? screen->cursoroutlineGC + : currentGC, + screen->box, NBOX, CoordModePrevious); + } + screen->cursor_state = ON; } /* @@ -5349,142 +5598,141 @@ void HideCursor(void) { - register TScreen *screen = &term->screen; - GC currentGC; - register int flags; - register int fg_bg = 0; - int x, y; - Char clo; - Boolean in_selection; + register TScreen *screen = &term->screen; + GC currentGC; + register int flags; + register int fg_bg = 0; + int x, y; + Char clo; + Boolean in_selection; #if OPT_WIDE_CHARS - Char chi = 0; - Char c1h = 0; - Char c1l = 0; - Char c2h = 0; - Char c2l = 0; - int base; + Char chi = 0; + Char c1h = 0; + Char c1l = 0; + Char c2h = 0; + Char c2l = 0; + int base; #endif - int cursor_col; + int cursor_col; - if (screen->cursor_state == OFF) /* FIXME */ - return; - if(screen->cursor_row - screen->topline > screen->max_row) - return; + if (screen->cursor_state == OFF) /* FIXME */ + return; + if (screen->cursor_row - screen->topline > screen->max_row) + return; - cursor_col = screen->cursor_col; + cursor_col = screen->cursor_col; #ifndef NO_ACTIVE_ICON - if (IsIcon(screen)) { - screen->cursor_state = OFF; - return; - } + if (IsIcon(screen)) { + screen->cursor_state = OFF; + return; + } #endif /* NO_ACTIVE_ICON */ #if OPT_WIDE_CHARS - base = + base = #endif - clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; - flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[cursor_col]; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; + flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[cursor_col]; - if_OPT_WIDE_CHARS(screen,{ - int my_col; + if_OPT_WIDE_CHARS(screen, { + int my_col; + chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; + if (clo == HIDDEN_LO && chi == HIDDEN_HI) { + /* if cursor points to non-initial part of wide character, + * back it up + */ + --cursor_col; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; - if (clo == HIDDEN_LO && chi == HIDDEN_HI) { - /* if cursor points to non-initial part of wide character, - * back it up - */ - --cursor_col; - clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; - chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; - } - my_col = cursor_col; - base = (chi << 8) | clo; - if (iswide(base)) - my_col += 1; - c1l = SCRN_BUF_COM1L(screen, screen->cursor_row)[my_col]; - c1h = SCRN_BUF_COM1H(screen, screen->cursor_row)[my_col]; - c2l = SCRN_BUF_COM2L(screen, screen->cursor_row)[my_col]; - c2h = SCRN_BUF_COM2H(screen, screen->cursor_row)[my_col]; - }) - - if_OPT_EXT_COLORS(screen,{ - fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[cursor_col] << 8) | - (SCRN_BUF_BGRND(screen, screen->cursor_row)[cursor_col]); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[cursor_col]; - }) - - if (screen->cursor_row > screen->endHRow || - (screen->cursor_row == screen->endHRow && - screen->cursor_col >= screen->endHCol) || - screen->cursor_row < screen->startHRow || - (screen->cursor_row == screen->startHRow && - screen->cursor_col < screen->startHCol)) - in_selection = False; - else - in_selection = True; + } + my_col = cursor_col; + base = (chi << 8) | clo; + if (iswide(base)) + my_col += 1; + c1l = SCRN_BUF_COM1L(screen, screen->cursor_row)[my_col]; + c1h = SCRN_BUF_COM1H(screen, screen->cursor_row)[my_col]; + c2l = SCRN_BUF_COM2L(screen, screen->cursor_row)[my_col]; + c2h = SCRN_BUF_COM2H(screen, screen->cursor_row)[my_col]; + }); + + if_OPT_EXT_COLORS(screen, { + fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[cursor_col] << 8) + | (SCRN_BUF_BGRND(screen, screen->cursor_row)[cursor_col]); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[cursor_col]; + }); + + if (screen->cursor_row > screen->endHRow || + (screen->cursor_row == screen->endHRow && + screen->cursor_col >= screen->endHCol) || + screen->cursor_row < screen->startHRow || + (screen->cursor_row == screen->startHRow && + screen->cursor_col < screen->startHCol)) + in_selection = False; + else + in_selection = True; - currentGC = updatedXtermGC(screen, flags, fg_bg, in_selection); + currentGC = updatedXtermGC(screen, flags, fg_bg, in_selection); - if (clo == 0 + if (clo == 0 #if OPT_WIDE_CHARS - && chi == 0 + && chi == 0 #endif ) { - clo = ' '; - } + clo = ' '; + } - TRACE(("%s @%d, HideCursor calling drawXtermText cur(%d,%d)\n", __FILE__, __LINE__, - screen->cursor_row, screen->cursor_col)); - drawXtermText(screen, flags, currentGC, - x = CurCursorX(screen, screen->cursor_row, cursor_col), - y = CursorY(screen, screen->cursor_row), - curXtermChrSet(screen->cursor_row), - PAIRED_CHARS(&clo, &chi), 1, 0); + TRACE(("HideCursor calling drawXtermText cur(%d,%d)\n", + screen->cursor_row, screen->cursor_col)); + drawXtermText(screen, flags, currentGC, + x = CurCursorX(screen, screen->cursor_row, cursor_col), + y = CursorY(screen, screen->cursor_row), + curXtermChrSet(screen->cursor_row), + PAIRED_CHARS(&clo, &chi), 1, 0); #if OPT_WIDE_CHARS - if (c1l || c1h) { - drawXtermText (screen, flags, currentGC, - x, y, - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&c1l, &c1h), 1, iswide(base)); - - if (c2l || c2h) - drawXtermText (screen, flags, currentGC, - x, y, - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&c2l, &c2h), 1, iswide(base)); - } + if (c1l || c1h) { + drawXtermText(screen, flags, currentGC, + x, y, + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(&c1l, &c1h), 1, iswide(base)); + + if (c2l || c2h) + drawXtermText(screen, flags, currentGC, + x, y, + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(&c2l, &c2h), 1, iswide(base)); + } #endif - screen->cursor_state = OFF; - resetXtermGC(screen, flags, in_selection); + screen->cursor_state = OFF; + resetXtermGC(screen, flags, in_selection); } #if OPT_BLINK_CURS static void -StartBlinking(TScreen *screen) +StartBlinking(TScreen * screen) { - if (screen->cursor_blink - && screen->cursor_timer == 0) { - unsigned long interval = (screen->cursor_state == ON ? - screen->cursor_on : screen->cursor_off); - if (interval == 0) /* wow! */ - interval = 1; /* let's humor him anyway */ - screen->cursor_timer = XtAppAddTimeOut( - app_con, - interval, - BlinkCursor, - screen); - } + if (screen->cursor_blink + && screen->cursor_timer == 0) { + unsigned long interval = (screen->cursor_state == ON ? + screen->cursor_on : screen->cursor_off); + if (interval == 0) /* wow! */ + interval = 1; /* let's humor him anyway */ + screen->cursor_timer = XtAppAddTimeOut(app_con, + interval, + BlinkCursor, + screen); + } } static void -StopBlinking(TScreen *screen) +StopBlinking(TScreen * screen) { - if (screen->cursor_timer) - XtRemoveTimeOut(screen->cursor_timer); - screen->cursor_timer = 0; + if (screen->cursor_timer) + XtRemoveTimeOut(screen->cursor_timer); + screen->cursor_timer = 0; } /* @@ -5493,25 +5741,24 @@ * logic simple. */ static void -BlinkCursor(XtPointer closure, XtIntervalId* id GCC_UNUSED) +BlinkCursor(XtPointer closure, XtIntervalId * id GCC_UNUSED) { - TScreen *screen = (TScreen *)closure; + TScreen *screen = (TScreen *) closure; - screen->cursor_timer = 0; - if (screen->cursor_state == ON) { - if(screen->select || screen->always_highlight) { - HideCursor(); - if (screen->cursor_state == OFF) - screen->cursor_state = BLINKED_OFF; - } - } else if (screen->cursor_state == BLINKED_OFF) { - screen->cursor_state = OFF; - ShowCursor(); - if (screen->cursor_state == OFF) - screen->cursor_state = BLINKED_OFF; + screen->cursor_timer = 0; + if (screen->cursor_state == ON) { + if (screen->select || screen->always_highlight) { + HideCursor(); + if (screen->cursor_state == OFF) + screen->cursor_state = BLINKED_OFF; } - StartBlinking(screen); - xevents(); + } else if (screen->cursor_state == BLINKED_OFF) { + screen->cursor_state = OFF; + ShowCursor(); + if (screen->cursor_state == OFF) + screen->cursor_state = BLINKED_OFF; + } + StartBlinking(screen); } #endif /* OPT_BLINK_CURS */ @@ -5528,101 +5775,108 @@ void VTReset(Bool full, Bool saved) { - register TScreen *screen = &term->screen; - - if (saved) { - screen->savedlines = 0; - ScrollBarDrawThumb(screen->scrollWidget); - } - - /* make cursor visible */ - screen->cursor_set = ON; - - /* reset scrolling region */ - screen->top_marg = 0; - screen->bot_marg = screen->max_row; - - bitclr(&term->flags, ORIGIN); + register TScreen *screen = &term->screen; - if_OPT_ISO_COLORS(screen,{reset_SGR_Colors();}) + if (saved) { + screen->savedlines = 0; + ScrollBarDrawThumb(screen->scrollWidget); + } - /* Reset character-sets to initial state */ - resetCharsets(screen); + /* make cursor visible */ + screen->cursor_set = ON; - /* Reset DECSCA */ - bitclr(&term->flags, PROTECTED); - screen->protected_mode = OFF_PROTECT; + /* reset scrolling region */ + screen->top_marg = 0; + screen->bot_marg = screen->max_row; + + bitclr(&term->flags, ORIGIN); + + if_OPT_ISO_COLORS(screen, { + reset_SGR_Colors(); + }); + + /* Reset character-sets to initial state */ + resetCharsets(screen); + + /* Reset DECSCA */ + bitclr(&term->flags, PROTECTED); + screen->protected_mode = OFF_PROTECT; + + if (full) { /* RIS */ + /* reset the mouse mode */ + screen->send_mouse_pos = MOUSE_OFF; + waitingForTrackInfo = FALSE; + eventMode = NORMAL; - if (full) { /* RIS */ - TabReset (term->tabs); - term->keyboard.flags = MODE_SRM; + TabReset(term->tabs); + term->keyboard.flags = MODE_SRM; #if OPT_INITIAL_ERASE - if (term->keyboard.reset_DECBKM == 1) - term->keyboard.flags |= MODE_DECBKM; - else if (term->keyboard.reset_DECBKM == 2) -#endif - if (term->screen.backarrow_key) - term->keyboard.flags |= MODE_DECBKM; - TRACE(("full reset DECBKM %s\n", - (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); - update_appcursor(); - update_appkeypad(); - update_decbkm(); - show_8bit_control(False); - reset_decudk(); - - FromAlternate(screen); - ClearScreen(screen); - screen->cursor_state = OFF; - if (term->flags & REVERSE_VIDEO) - ReverseVideo(term); - - term->flags = term->initflags; - update_reversevideo(); - update_autowrap(); - update_reversewrap(); - update_autolinefeed(); - - screen->jumpscroll = !(term->flags & SMOOTHSCROLL); - update_jumpscroll(); - - if(screen->c132 && (term->flags & IN132COLUMNS)) { - Dimension junk; - XtMakeResizeRequest( - (Widget) term, - (Dimension) 80*FontWidth(screen) - + 2 * screen->border + ScrollbarWidth(screen), - (Dimension) FontHeight(screen) - * (screen->max_row + 1) + 2 * screen->border, - &junk, &junk); - XSync(screen->display, FALSE); /* synchronize */ - if(XtAppPending(app_con)) - xevents(); - } - CursorSet(screen, 0, 0, term->flags); - CursorSave(term); - } else { /* DECSTR */ - /* - * There's a tiny difference, to accommodate usage of xterm. - * We reset autowrap to the resource values rather than turning - * it off. - */ - term->keyboard.flags &= ~(MODE_DECCKM|MODE_KAM|MODE_DECKPAM); - bitcpy(&term->flags, term->initflags, WRAPAROUND|REVERSEWRAP); - bitclr(&term->flags, INSERT|INVERSE|BOLD|BLINK|UNDERLINE|INVISIBLE); - if_OPT_ISO_COLORS(screen,{reset_SGR_Colors();}) - update_appcursor(); - update_autowrap(); - update_reversewrap(); - - CursorSave(term); - screen->sc[screen->alternate != False].row = - screen->sc[screen->alternate != False].col = 0; - } - longjmp(vtjmpbuf, 1); /* force ground state in parser */ -} + if (term->keyboard.reset_DECBKM == 1) + term->keyboard.flags |= MODE_DECBKM; + else if (term->keyboard.reset_DECBKM == 2) +#endif + if (term->screen.backarrow_key) + term->keyboard.flags |= MODE_DECBKM; + TRACE(("full reset DECBKM %s\n", + (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); + update_appcursor(); + update_appkeypad(); + update_decbkm(); + show_8bit_control(False); + reset_decudk(); + FromAlternate(screen); + ClearScreen(screen); + screen->cursor_state = OFF; + if (term->flags & REVERSE_VIDEO) + ReverseVideo(term); + term->flags = term->initflags; + update_reversevideo(); + update_autowrap(); + update_reversewrap(); + update_autolinefeed(); + + screen->jumpscroll = !(term->flags & SMOOTHSCROLL); + update_jumpscroll(); + + if (screen->c132 && (term->flags & IN132COLUMNS)) { + Dimension junk; + XtMakeResizeRequest( + (Widget) term, + (Dimension) 80 * FontWidth(screen) + + 2 * screen->border + ScrollbarWidth(screen), + (Dimension) FontHeight(screen) + * (screen->max_row + 1) + 2 * screen->border, + &junk, &junk); + XSync(screen->display, FALSE); /* synchronize */ + if (XtAppPending(app_con)) + xevents(); + } + CursorSet(screen, 0, 0, term->flags); + CursorSave(term); + } else { /* DECSTR */ + /* + * There's a tiny difference, to accommodate usage of xterm. + * We reset autowrap to the resource values rather than turning + * it off. + */ + term->keyboard.flags &= ~(MODE_DECCKM | MODE_KAM | MODE_DECKPAM); + bitcpy(&term->flags, term->initflags, WRAPAROUND | REVERSEWRAP); + bitclr(&term->flags, INSERT | INVERSE | BOLD | BLINK | UNDERLINE | INVISIBLE); + if_OPT_ISO_COLORS(screen, { + reset_SGR_Colors(); + }); + update_appcursor(); + update_autowrap(); + update_reversewrap(); + + CursorSave(term); + screen->sc[screen->alternate != False].row = + screen->sc[screen->alternate != False].col = 0; + } + longjmp(vtjmpbuf, 1); /* force ground state in parser */ +} /* * set_character_class - takes a string of the form @@ -5632,23 +5886,24 @@ * and sets the indicated ranges to the indicated values. */ static int -set_character_class (register char *s) +set_character_class(register char *s) { - register int i; /* iterator, index into s */ - int len; /* length of s */ - int acc; /* accumulator */ - int low, high; /* bounds of range [0..127] */ - int base; /* 8, 10, 16 (octal, decimal, hex) */ - int numbers; /* count of numbers per range */ - int digits; /* count of digits in a number */ + register int i; /* iterator, index into s */ + int len; /* length of s */ + int acc; /* accumulator */ + int low, high; /* bounds of range [0..127] */ + int base; /* 8, 10, 16 (octal, decimal, hex) */ + int numbers; /* count of numbers per range */ + int digits; /* count of digits in a number */ static char *errfmt = "%s: %s in range string \"%s\" (position %d)\n"; - if (!s || !s[0]) return -1; + if (!s || !s[0]) + return -1; - base = 10; /* in case we ever add octal, hex */ - low = high = -1; /* out of range */ + base = 10; /* in case we ever add octal, hex */ + low = high = -1; /* out of range */ - for (i = 0, len = strlen (s), acc = 0, numbers = digits = 0; + for (i = 0, len = strlen(s), acc = 0, numbers = digits = 0; i < len; i++) { Char c = s[i]; @@ -5662,7 +5917,7 @@ low = acc; acc = 0; if (digits == 0) { - fprintf (stderr, errfmt, ProgramName, "missing number", s, i); + fprintf(stderr, errfmt, ProgramName, "missing number", s, i); return (-1); } digits = 0; @@ -5670,12 +5925,12 @@ continue; } else if (c == ':') { if (numbers == 0) - low = acc; + low = acc; else if (numbers == 1) - high = acc; + high = acc; else { - fprintf (stderr, errfmt, ProgramName, "too many numbers", - s, i); + fprintf(stderr, errfmt, ProgramName, "too many numbers", + s, i); return (-1); } digits = 0; @@ -5692,10 +5947,10 @@ numbers++; } if (numbers != 2) { - fprintf (stderr, errfmt, ProgramName, "bad value number", - s, i); - } else if (SetCharacterClassRange (low, high, acc) != 0) { - fprintf (stderr, errfmt, ProgramName, "bad range", s, i); + fprintf(stderr, errfmt, ProgramName, "bad value number", + s, i); + } else if (SetCharacterClassRange(low, high, acc) != 0) { + fprintf(stderr, errfmt, ProgramName, "bad range", s, i); } low = high = -1; @@ -5704,143 +5959,153 @@ numbers = 0; continue; } else { - fprintf (stderr, errfmt, ProgramName, "bad character", s, i); + fprintf(stderr, errfmt, ProgramName, "bad character", s, i); return (-1); - } /* end if else if ... else */ + } /* end if else if ... else */ } - if (low < 0 && high < 0) return (0); + if (low < 0 && high < 0) + return (0); /* * now, process it */ - if (high < 0) high = low; + if (high < 0) + high = low; if (numbers < 1 || numbers > 2) { - fprintf (stderr, errfmt, ProgramName, "bad value number", s, i); - } else if (SetCharacterClassRange (low, high, acc) != 0) { - fprintf (stderr, errfmt, ProgramName, "bad range", s, i); + fprintf(stderr, errfmt, ProgramName, "bad value number", s, i); + } else if (SetCharacterClassRange(low, high, acc) != 0) { + fprintf(stderr, errfmt, ProgramName, "bad range", s, i); } return (0); } /* ARGSUSED */ -static void HandleKeymapChange( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +static void +HandleKeymapChange(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { static XtTranslations keymap, original; - static XtResource key_resources[] = { - { XtNtranslations, XtCTranslations, XtRTranslationTable, - sizeof(XtTranslations), 0, XtRTranslationTable, (XtPointer)NULL} + static XtResource key_resources[] = + { + {XtNtranslations, XtCTranslations, XtRTranslationTable, + sizeof(XtTranslations), 0, XtRTranslationTable, (XtPointer) NULL} }; char mapName[1000]; char mapClass[1000]; - char* pmapName; - char* pmapClass; + char *pmapName; + char *pmapClass; size_t len; - if (*param_count != 1) return; + if (*param_count != 1) + return; - if (original == NULL) original = w->core.tm.translations; + if (original == NULL) + original = w->core.tm.translations; if (strcmp(params[0], "None") == 0) { XtOverrideTranslations(w, original); return; } - len = strlen (params[0]) + 7; + len = strlen(params[0]) + 7; - pmapName = (char *)MyStackAlloc(len, mapName); - pmapClass = (char *)MyStackAlloc(len, mapClass); + pmapName = (char *) MyStackAlloc(len, mapName); + pmapClass = (char *) MyStackAlloc(len, mapClass); if (pmapName == NULL - || pmapClass == NULL) + || pmapClass == NULL) SysError(ERROR_KMMALLOC1); - (void) sprintf( pmapName, "%sKeymap", params[0] ); - (void) strcpy( pmapClass, pmapName ); - if (islower(CharOf(pmapClass[0]))) pmapClass[0] = toupper(pmapClass[0]); - XtGetSubresources( w, (XtPointer)&keymap, pmapName, pmapClass, - key_resources, (Cardinal)1, NULL, (Cardinal)0 ); + (void) sprintf(pmapName, "%sKeymap", params[0]); + (void) strcpy(pmapClass, pmapName); + if (islower(CharOf(pmapClass[0]))) + pmapClass[0] = toupper(pmapClass[0]); + XtGetSubresources(w, (XtPointer) & keymap, pmapName, pmapClass, + key_resources, (Cardinal) 1, NULL, (Cardinal) 0); if (keymap != NULL) XtOverrideTranslations(w, keymap); - MyStackFree(pmapName, mapName); + MyStackFree(pmapName, mapName); MyStackFree(pmapClass, mapClass); } - /* ARGSUSED */ -static void HandleBell( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params, /* [0] = volume */ - Cardinal *param_count) /* 0 or 1 */ +static void +HandleBell(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params, /* [0] = volume */ + Cardinal * param_count) /* 0 or 1 */ { int percent = (*param_count) ? atoi(params[0]) : 0; Bell(XkbBI_TerminalBell, percent); } - /* ARGSUSED */ -static void HandleVisualBell( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +static void +HandleVisualBell(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { VisualBell(); } /* ARGSUSED */ -static void HandleIgnore( - Widget w, - XEvent *event, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +static void +HandleIgnore(Widget w, + XEvent * event, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { /* do nothing, but check for funny escape sequences */ (void) SendMousePosition(w, event); } - /* ARGSUSED */ static void -DoSetSelectedFont( - Widget w GCC_UNUSED, - XtPointer client_data GCC_UNUSED, - Atom *selection GCC_UNUSED, - Atom *type, - XtPointer value, - unsigned long *length GCC_UNUSED, - int *format) +DoSetSelectedFont(Widget w GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + Atom * selection GCC_UNUSED, + Atom * type, + XtPointer value, + unsigned long *length GCC_UNUSED, + int *format) { - char *val = (char *)value; + char *val = (char *) value; int len; - if (*type != XA_STRING || *format != 8) { - Bell(XkbBI_MinorError,0); + if (*type != XA_STRING || *format != 8) { + Bell(XkbBI_MinorError, 0); return; } len = strlen(val); if (len > 0) { - if (val[len-1] == '\n') val[len-1] = '\0'; + if (val[len - 1] == '\n') + val[len - 1] = '\0'; /* Do some sanity checking to avoid sending a long selection back to the server in an OpenFont that is unlikely to succeed. XLFD allows up to 255 characters and no control characters; we are a little more liberal here. */ - if (len > 1000 || strchr(val, '\n')) + if (len > 1000 || strchr(val, '\n')) return; - if (!xtermLoadFont (&term->screen, VT_FONTSET(val, NULL, NULL, NULL), True, fontMenu_fontsel)) - Bell(XkbBI_MinorError,0); + if (!xtermLoadFont(&term->screen, + VT_FONTSET(val, + NULL, + NULL, + NULL), + True, + fontMenu_fontsel)) + Bell(XkbBI_MinorError, 0); } } -void FindFontSelection (char *atom_name, Bool justprobe) +void +FindFontSelection(char *atom_name, Bool justprobe) { static AtomPtr *atoms; static int atomCount = 0; @@ -5848,32 +6113,33 @@ int a; Atom target; - if (!atom_name) atom_name = "PRIMARY"; + if (!atom_name) + atom_name = "PRIMARY"; for (pAtom = atoms, a = atomCount; a; a--, pAtom++) { - if (strcmp(atom_name, XmuNameOfAtom(*pAtom)) == 0) break; + if (strcmp(atom_name, XmuNameOfAtom(*pAtom)) == 0) + break; } if (!a) { - atoms = (AtomPtr*) XtRealloc ((char *)atoms, - sizeof(AtomPtr)*(atomCount+1)); + atoms = (AtomPtr *) XtRealloc((char *) atoms, + sizeof(AtomPtr) * (atomCount + 1)); *(pAtom = &atoms[atomCount++]) = XmuMakeAtom(atom_name); } target = XmuInternAtom(XtDisplay(term), *pAtom); if (justprobe) { term->screen.menu_font_names[fontMenu_fontsel] = - XGetSelectionOwner(XtDisplay(term), target) ? _Font_Selected_ : 0; + XGetSelectionOwner(XtDisplay(term), target) ? _Font_Selected_ : 0; } else { - XtGetSelectionValue((Widget)term, target, XA_STRING, + XtGetSelectionValue((Widget) term, target, XA_STRING, DoSetSelectedFont, NULL, XtLastTimestampProcessed(XtDisplay(term))); } return; } - void -set_cursor_gcs (TScreen *screen) +set_cursor_gcs(TScreen * screen) { XGCValues xgcv; XtGCMask mask; @@ -5916,18 +6182,19 @@ * Use the colorMode value to determine which we'll do (the VWindow may * not be set before the widget's realized, so it's tested separately). */ - if(screen->colorMode) { + if (screen->colorMode) { if (VWindow(screen) != 0 && (cc != bg) && (cc != fg)) { /* we might have a colored foreground/background later */ xgcv.font = screen->fnt_norm->fid; mask = (GCForeground | GCBackground | GCFont); xgcv.foreground = fg; xgcv.background = cc; - new_cursorGC = XCreateGC (screen->display, VWindow(screen), mask, &xgcv); + new_cursorGC = XCreateGC(screen->display, VWindow(screen), mask, &xgcv); xgcv.foreground = cc; xgcv.background = fg; - new_cursorFillGC = XCreateGC (screen->display, VWindow(screen), mask, &xgcv); + new_cursorFillGC = + XCreateGC(screen->display, VWindow(screen), mask, &xgcv); if (screen->always_highlight) { new_reversecursorGC = (GC) 0; @@ -5935,10 +6202,12 @@ } else { xgcv.foreground = bg; xgcv.background = cc; - new_reversecursorGC = XCreateGC (screen->display, VWindow(screen), mask, &xgcv); + new_reversecursorGC = + XCreateGC(screen->display, VWindow(screen), mask, &xgcv); xgcv.foreground = cc; xgcv.background = bg; - new_cursoroutlineGC = XCreateGC (screen->display, VWindow(screen), mask, &xgcv); + new_cursoroutlineGC = + XCreateGC(screen->display, VWindow(screen), mask, &xgcv); } } } else @@ -5950,11 +6219,11 @@ xgcv.foreground = fg; xgcv.background = cc; - new_cursorGC = XtGetGC ((Widget) term, mask, &xgcv); + new_cursorGC = XtGetGC((Widget) term, mask, &xgcv); xgcv.foreground = cc; xgcv.background = fg; - new_cursorFillGC = XtGetGC ((Widget) term, mask, &xgcv); + new_cursorFillGC = XtGetGC((Widget) term, mask, &xgcv); if (screen->always_highlight) { new_reversecursorGC = (GC) 0; @@ -5962,40 +6231,37 @@ } else { xgcv.foreground = bg; xgcv.background = cc; - new_reversecursorGC = XtGetGC ((Widget) term, mask, &xgcv); + new_reversecursorGC = XtGetGC((Widget) term, mask, &xgcv); xgcv.foreground = cc; xgcv.background = bg; - new_cursoroutlineGC = XtGetGC ((Widget) term, mask, &xgcv); + new_cursoroutlineGC = XtGetGC((Widget) term, mask, &xgcv); } } - #if OPT_ISO_COLORS - if(screen->colorMode) - { + if (screen->colorMode) { if (screen->cursorGC) - XFreeGC (screen->display, screen->cursorGC); + XFreeGC(screen->display, screen->cursorGC); if (screen->fillCursorGC) - XFreeGC (screen->display, screen->fillCursorGC); + XFreeGC(screen->display, screen->fillCursorGC); if (screen->reversecursorGC) - XFreeGC (screen->display, screen->reversecursorGC); + XFreeGC(screen->display, screen->reversecursorGC); if (screen->cursoroutlineGC) - XFreeGC (screen->display, screen->cursoroutlineGC); - } - else + XFreeGC(screen->display, screen->cursoroutlineGC); + } else #endif { if (screen->cursorGC) - XtReleaseGC ((Widget)term, screen->cursorGC); + XtReleaseGC((Widget) term, screen->cursorGC); if (screen->fillCursorGC) - XtReleaseGC ((Widget)term, screen->fillCursorGC); + XtReleaseGC((Widget) term, screen->fillCursorGC); if (screen->reversecursorGC) - XtReleaseGC ((Widget)term, screen->reversecursorGC); + XtReleaseGC((Widget) term, screen->reversecursorGC); if (screen->cursoroutlineGC) - XtReleaseGC ((Widget)term, screen->cursoroutlineGC); + XtReleaseGC((Widget) term, screen->cursoroutlineGC); } - screen->cursorGC = new_cursorGC; - screen->fillCursorGC = new_cursorFillGC; + screen->cursorGC = new_cursorGC; + screen->fillCursorGC = new_cursorFillGC; screen->reversecursorGC = new_reversecursorGC; screen->cursoroutlineGC = new_cursoroutlineGC; } Index: xc/programs/xterm/config.guess diff -u xc/programs/xterm/config.guess:1.12 xc/programs/xterm/config.guess:1.15 --- xc/programs/xterm/config.guess:1.12 Sun Mar 11 19:54:17 2001 +++ xc/programs/xterm/config.guess Sun Dec 8 17:31:48 2002 @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2001-02-13' +timestamp='2002-11-30' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,8 +24,9 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Written by Per Bothner <bothner@cygnus.com>. -# Please send patches to <config-patches@gnu.org>. +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -52,7 +53,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -87,33 +88,43 @@ exit 1 fi +trap 'exit 1' 1 2 15 -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. -# CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c - for c in cc gcc c89 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 - if test $? = 0 ; then - CC_FOR_BUILD="$c"; break - fi - done - rm -f $dummy.c $dummy.o $dummy.rel + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $files ; if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found + CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac +esac ; +unset files' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) +# (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi @@ -127,29 +138,31 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) - # Netbsd (nbsd) targets should (where applicable) match one or + # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. - # Determine the machine/vendor (is the vendor relevant). - case "${UNAME_MACHINE}" in - amiga) machine=m68k-unknown ;; - arm32) machine=arm-unknown ;; - atari*) machine=m68k-atari ;; - sun3*) machine=m68k-sun ;; - mac68k) machine=m68k-apple ;; - macppc) machine=powerpc-apple ;; - hp3[0-9][05]) machine=m68k-hp ;; - ibmrt|romp-ibm) machine=romp-ibm ;; - *) machine=${UNAME_MACHINE}-unknown ;; + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. - case "${UNAME_MACHINE}" in - i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then @@ -165,12 +178,62 @@ ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -179,6 +242,7 @@ # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build cat <<EOF >$dummy.s .data \$Lformat: @@ -204,9 +268,9 @@ jsr \$26,exit .end main EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null if test "$?" = 0 ; then - case `./$dummy` in + case `$dummy` in 0-0) UNAME_MACHINE="alpha" ;; @@ -225,9 +289,15 @@ 2-307) UNAME_MACHINE="alphaev67" ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; esac fi - rm -f $dummy.s $dummy + rm -f $dummy.s $dummy && rmdir $tmpdir echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) @@ -242,30 +312,12 @@ Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; @@ -286,6 +338,10 @@ NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -314,7 +370,7 @@ echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) @@ -328,9 +384,6 @@ aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -357,18 +410,6 @@ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -385,6 +426,7 @@ echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include <stdio.h> /* for printf() prototype */ @@ -406,12 +448,21 @@ exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -459,7 +510,7 @@ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) + i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) @@ -472,6 +523,7 @@ exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include <sys/systemcfg.h> @@ -483,8 +535,8 @@ exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -493,7 +545,7 @@ fi exit 0 ;; *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else @@ -533,10 +585,8 @@ 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - case "${HPUX_REV}" in - 11.[0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 @@ -545,12 +595,13 @@ case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac - fi ;; - esac - if [ "${HP_ARCH}" = "" ]; then - sed 's/^ //' << EOF >$dummy.c + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include <stdlib.h> @@ -583,10 +634,10 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy && rmdir $tmpdir + fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; @@ -595,6 +646,7 @@ echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include <unistd.h> int @@ -620,8 +672,8 @@ exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -630,7 +682,7 @@ 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; - *9??*:MPE/iX:*:*) + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) @@ -639,7 +691,7 @@ hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; - i?86:OSF1:*:*) + i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else @@ -649,9 +701,6 @@ parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -670,16 +719,14 @@ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' @@ -693,19 +740,13 @@ CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) @@ -715,10 +756,19 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -729,11 +779,17 @@ i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; + x86:Interix*:3*) + echo i586-pc-interix3 + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix + echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin @@ -750,35 +806,75 @@ i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) - cat >$dummy.c <<EOF -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ -int main (int argc, char *argv[]) { -#else -int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -790,195 +886,104 @@ parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; - *:Linux:*:*) + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - ld_supported_emulations=`cd /; ld --help 2>&1 \ - | sed -ne '/supported emulations:/!d + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - i?86linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 - ;; - elf_i?86) + case "$ld_supported_targets" in + elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; - i?86coff) + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 - ;; - sparclinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32_sparc) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - armlinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32arm*) - echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" - exit 0 - ;; - armelf_linux*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - m68klinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32ppc | elf32ppclinux) - # Determine Lib Version - cat >$dummy.c <<EOF -#include <features.h> -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} - exit 0 - ;; + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - cat <<EOF >$dummy.s - .data - \$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main - main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) UNAME_MACHINE="alpha" ;; - 1-0) UNAME_MACHINE="alphaev5" ;; - 1-1) UNAME_MACHINE="alphaev56" ;; - 1-101) UNAME_MACHINE="alphapca56" ;; - 2-303) UNAME_MACHINE="alphaev6" ;; - 2-307) UNAME_MACHINE="alphaev67" ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - test -z "$ld_supported_emulations" \ - && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF -#include <features.h> -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) + i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} @@ -986,36 +991,32 @@ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i?86:*:5:7*) - # Fixed at (any) Pentium or better - UNAME_MACHINE=i586 - if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; - i?86:*:3.2:*) + i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo ${UNAME_MACHINE}-pc-isc$UNAME_REL elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i?86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1039,9 +1040,15 @@ # "miniframe" echo m68010-convergent-sysv exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1052,22 +1059,19 @@ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) @@ -1087,8 +1091,8 @@ echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) @@ -1100,6 +1104,10 @@ # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; @@ -1128,6 +1136,9 @@ SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; @@ -1138,15 +1149,17 @@ echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) - if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo `uname -p`-${UNAME_MACHINE}-nto-qnx + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[KW]:NONSTOP_KERNEL:*:*) + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1169,11 +1182,6 @@ fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; - i?86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; @@ -1197,6 +1205,7 @@ #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> @@ -1311,8 +1320,8 @@ } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir # Apollos put the system type in the environment. Index: xc/programs/xterm/config.sub diff -u xc/programs/xterm/config.sub:1.12 xc/programs/xterm/config.sub:1.15 --- xc/programs/xterm/config.sub:1.12 Sun Mar 11 19:54:17 2001 +++ xc/programs/xterm/config.sub Sun Dec 8 17:31:48 2002 @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2001-02-13' +timestamp='2002-11-30' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -29,7 +29,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Please send patches to <config-patches@gnu.org>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -117,7 +118,7 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) + nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -157,6 +158,14 @@ os=-vxworks basic_machine=$1 ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; @@ -215,24 +224,46 @@ case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ - | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ - | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | hppa64 \ - | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ - | alphaev6[78] \ - | we32k | ns16k | clipper | i370 | sh | sh[34] \ - | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp10 | pdp11 \ - | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr | openrisc) + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -240,13 +271,13 @@ basic_machine=$basic_machine-unknown os=-none ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[234567]86 | x86_64) + i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -255,29 +286,56 @@ exit 1 ;; # Recognize the basic CPU types with company name. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ - | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ - | hppa2.0n-* | hppa64-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ - | alphaev6[78]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-* | x86_64-*) + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39 | mipstx39el \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -340,6 +398,10 @@ basic_machine=ns32k-sequent os=-dynix ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -360,18 +422,10 @@ basic_machine=c38-convex os=-bsd ;; - cray | ymp) - basic_machine=ymp-cray + cray | j90) + basic_machine=j90-cray os=-unicos ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [cjt]90) - basic_machine=${basic_machine}-cray - os=-unicos - ;; crds | unos) basic_machine=m68k-crds ;; @@ -384,6 +438,14 @@ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola @@ -504,19 +566,19 @@ basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) + i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; - i[34567]86v4*) + i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; - i[34567]86v) + i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; - i[34567]86sol2) + i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; @@ -564,14 +626,6 @@ basic_machine=m68k-atari os=-mint ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -586,6 +640,10 @@ basic_machine=m68k-rom68k os=-coff ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; msdos) basic_machine=i386-pc os=-msdos @@ -665,6 +723,10 @@ basic_machine=hppa1.1-oki os=-proelf ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -687,19 +749,19 @@ pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexgen) + pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86 | athlon) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) @@ -714,15 +776,25 @@ power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ps2) basic_machine=i386-ibm ;; @@ -740,10 +812,22 @@ rtpc | rtpc-*) basic_machine=romp-ibm ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; sa29200) basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; sequent) basic_machine=i386-sequent ;; @@ -751,7 +835,7 @@ basic_machine=sh-hitachi os=-hms ;; - sparclite-wrs) + sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -817,10 +901,22 @@ basic_machine=i386-sequent os=-dynix ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; t3e) - basic_machine=t3e-cray + basic_machine=alphaev5-cray os=-unicos ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff @@ -831,6 +927,10 @@ tx39el) basic_machine=mipstx39el-unknown ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; tower | tower-32) basic_machine=m68k-ncr ;; @@ -855,8 +955,8 @@ os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -877,13 +977,13 @@ basic_machine=hppa1.1-winbond os=-proelf ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim @@ -904,13 +1004,6 @@ op60c) basic_machine=hppa1.1-oki ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; romp) basic_machine=romp-ibm ;; @@ -930,13 +1023,16 @@ we32k) basic_machine=we32k-att ;; - sh3 | sh4) + sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown ;; - sparc | sparcv9) + sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -951,9 +1047,8 @@ pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff + *-unknown) + # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 @@ -1011,24 +1106,30 @@ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in - x86-* | i[34567]86-*) + x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ @@ -1067,14 +1168,20 @@ -acis*) os=-aos ;; + -atheos*) + os=-atheos + ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; + -nova*) + os=-rtmk-nova + ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 ;; -nsk*) os=-nsk @@ -1113,8 +1220,8 @@ -xenix) os=-xenix ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint ;; -none) ;; @@ -1147,10 +1254,11 @@ arm*-semi) os=-aout ;; + # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; - pdp11-*) + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1177,6 +1285,9 @@ mips*-*) os=-elf ;; + or32-*) + os=-coff + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -1240,19 +1351,19 @@ *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) @@ -1324,7 +1435,7 @@ -ptx*) vendor=sequent ;; - -vxsim* | -vxworks*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) @@ -1338,6 +1449,9 @@ ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari + ;; + -vos*) + vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` Index: xc/programs/xterm/configure diff -u xc/programs/xterm/configure:3.62 xc/programs/xterm/configure:3.68 --- xc/programs/xterm/configure:3.62 Sun Nov 4 21:07:15 2001 +++ xc/programs/xterm/configure Fri Dec 27 16:05:21 2002 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13.20000819 +# Generated automatically using autoconf version 2.13.20020210 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -220,12 +220,14 @@ --disable-num-lock disable NumLock keypad support --disable-rightbar disable right-scrollbar support --disable-samename disable check for redundant name-change + --disable-session-mgt disable support for session management --enable-tcap-query compile-in termcap-query support --disable-tek4014 disable tek4014 emulation --enable-toolbar compile-in toolbar for pulldown menus - --disable-vt52 disable VT52 emulation EOF cat <<EOF + --disable-vt52 disable VT52 emulation + --enable-luit enable luit filter (Unicode translation) --enable-wide-chars enable wide-character support --enable-dec-locator enable DECterm Locator support --disable-ziconbeep disable -ziconbeep option @@ -384,7 +386,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13.20000819" + echo "configure generated by autoconf version 2.13.20020210" exit 0 ;; -with-* | --with-*) @@ -601,7 +603,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:605: checking host system type" >&5 +echo "configure:607: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -640,7 +642,7 @@ test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && echo "$ac_t"""Configuring for $cf_cv_system_name"" 1>&6 +test -n "$cf_cv_system_name" && echo "$ac_t""Configuring for $cf_cv_system_name" 1>&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$ac_t""Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" 1>&6 @@ -660,7 +662,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:664: checking for $ac_word" >&5 +echo "configure:666: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -690,7 +692,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:694: checking for $ac_word" >&5 +echo "configure:696: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -741,7 +743,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:745: checking for $ac_word" >&5 +echo "configure:747: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -773,7 +775,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:777: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:779: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -784,12 +786,12 @@ cat > conftest.$ac_ext << EOF -#line 788 "configure" +#line 790 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -815,12 +817,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:819: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:821: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:824: checking whether we are using GNU C" >&5 +echo "configure:826: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -829,7 +831,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -848,7 +850,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:852: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:854: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -880,7 +882,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:884: checking how to run the C preprocessor" >&5 +echo "configure:886: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -895,13 +897,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 899 "configure" +#line 901 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -912,13 +914,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 916 "configure" +#line 918 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -929,13 +931,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 933 "configure" +#line 935 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -961,13 +963,13 @@ if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:965: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:967: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 971 "configure" +#line 973 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -985,7 +987,7 @@ if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 989 "configure" +#line 991 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1011,7 +1013,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1015: checking for $ac_word" >&5 +echo "configure:1017: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1052,7 +1054,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1056: checking for a BSD compatible install" >&5 +echo "configure:1058: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1126,9 +1128,9 @@ ### checks for UNIX variants that set C preprocessor variables echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1130: checking for AIX" >&5 +echo "configure:1132: checking for AIX" >&5 cat > conftest.$ac_ext <<EOF -#line 1132 "configure" +#line 1134 "configure" #include "confdefs.h" #ifdef _AIX yes @@ -1150,7 +1152,7 @@ echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1154: checking for POSIXized ISC" >&5 +echo "configure:1156: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1170,55 +1172,6 @@ ISC= fi -ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1176: checking for minix/config.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1181 "configure" -#include "confdefs.h" -#include <minix/config.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - MINIX=yes -else - echo "$ac_t""no" 1>&6 -MINIX= -fi - -if test "$MINIX" = yes; then - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define _POSIX_1_SOURCE 2 -EOF - - cat >> confdefs.h <<\EOF -#define _MINIX 1 -EOF - -fi - ### checks for header files for ac_hdr in \ @@ -1230,17 +1183,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1234: checking for $ac_hdr" >&5 +echo "configure:1187: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1239 "configure" +#line 1192 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1267,12 +1220,12 @@ done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1271: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1224: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1276 "configure" +#line 1229 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -1281,7 +1234,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1305,13 +1258,13 @@ ### checks for typedefs echo $ac_n "checking for size_t in <sys/types.h> or <stdio.h>""... $ac_c" 1>&6 -echo "configure:1309: checking for size_t in <sys/types.h> or <stdio.h>" >&5 +echo "configure:1262: checking for size_t in <sys/types.h> or <stdio.h>" >&5 if eval "test \"`echo '$''{'cf_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1315 "configure" +#line 1268 "configure" #include "confdefs.h" #include <sys/types.h> @@ -1324,7 +1277,7 @@ size_t x ; return 0; } EOF -if { (eval echo configure:1328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_size_t=yes else @@ -1344,12 +1297,12 @@ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1348: checking for ANSI C header files" >&5 +echo "configure:1301: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1353 "configure" +#line 1306 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1357,7 +1310,7 @@ #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1361: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1374,7 +1327,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1378 "configure" +#line 1331 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1392,7 +1345,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1396 "configure" +#line 1349 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1413,7 +1366,7 @@ : else cat > conftest.$ac_ext <<EOF -#line 1417 "configure" +#line 1370 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1424,7 +1377,7 @@ exit (0); } EOF -if { (eval echo configure:1428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1448,12 +1401,12 @@ fi echo $ac_n "checking for time_t""... $ac_c" 1>&6 -echo "configure:1452: checking for time_t" >&5 +echo "configure:1405: checking for time_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1457 "configure" +#line 1410 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1484,20 +1437,22 @@ ### checks for library functions for ac_func in \ bcopy \ + gethostname \ getlogin \ memmove \ strerror \ + strftime \ tcgetattr \ waitpid \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1496: checking for $ac_func" >&5 +echo "configure:1451: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1501 "configure" +#line 1456 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1520,7 +1475,7 @@ ; return 0; } EOF -if { (eval echo configure:1524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1546,12 +1501,12 @@ echo $ac_n "checking for memmove""... $ac_c" 1>&6 -echo "configure:1550: checking for memmove" >&5 +echo "configure:1505: checking for memmove" >&5 if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1555 "configure" +#line 1510 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove(); below. */ @@ -1574,7 +1529,7 @@ ; return 0; } EOF -if { (eval echo configure:1578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_memmove=yes" else @@ -1593,12 +1548,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for bcopy""... $ac_c" 1>&6 -echo "configure:1597: checking for bcopy" >&5 +echo "configure:1552: checking for bcopy" >&5 if eval "test \"`echo '$''{'ac_cv_func_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1602 "configure" +#line 1557 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char bcopy(); below. */ @@ -1621,7 +1576,7 @@ ; return 0; } EOF -if { (eval echo configure:1625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_bcopy=yes" else @@ -1637,7 +1592,7 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6 -echo "configure:1641: checking if bcopy does overlapping moves" >&5 +echo "configure:1596: checking if bcopy does overlapping moves" >&5 if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1646,7 +1601,7 @@ cf_cv_good_bcopy=unknown else cat > conftest.$ac_ext <<EOF -#line 1650 "configure" +#line 1605 "configure" #include "confdefs.h" int main() { @@ -1659,7 +1614,7 @@ } EOF -if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_good_bcopy=yes else @@ -1696,8 +1651,16 @@ fi +# compute a reasonable value for $TERM to give tgetent(), since we may be +# running in 'screen', which sets $TERMCAP to a specific entry that is not +# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply +# discard $TERMCAP. +cf_TERMVAR=vt100 +test -n "$TERMCAP" && cf_TERMVAR="$TERM" +test -z "$cf_TERMVAR" && cf_TERMVAR=vt100 + echo $ac_n "checking for full tgetent function""... $ac_c" 1>&6 -echo "configure:1701: checking for full tgetent function" >&5 +echo "configure:1664: checking for full tgetent function" >&5 if eval "test \"`echo '$''{'cf_cv_lib_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1712,7 +1675,7 @@ echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&5 else cat > conftest.$ac_ext <<EOF -#line 1716 "configure" +#line 1679 "configure" #include "confdefs.h" /* terminfo implementations ignore the buffer argument, making it useless for @@ -1723,10 +1686,10 @@ { char buffer[1024]; buffer[0] = 0; - tgetent(buffer, "vt100"); + tgetent(buffer, "$cf_TERMVAR"); exit(buffer[0] == 0); } EOF -if { (eval echo configure:1730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&5 if test -n "$cf_termlib" ; then @@ -1762,7 +1725,7 @@ EOF cat > conftest.$ac_ext <<EOF -#line 1766 "configure" +#line 1729 "configure" #include "confdefs.h" #include <termcap.h> @@ -1773,7 +1736,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:1777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TERMCAP_H 1 @@ -1791,7 +1754,7 @@ # validate values for the TERM environment variable given to # child processes. echo $ac_n "checking for partial tgetent function""... $ac_c" 1>&6 -echo "configure:1795: checking for partial tgetent function" >&5 +echo "configure:1758: checking for partial tgetent function" >&5 if eval "test \"`echo '$''{'cf_cv_lib_part_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1800,14 +1763,14 @@ for cf_termlib in $cf_TERMLIB ; do LIBS="$cf_save_LIBS -l$cf_termlib" cat > conftest.$ac_ext <<EOF -#line 1804 "configure" +#line 1767 "configure" #include "confdefs.h" int main() { -tgetent(0, 0) +tgetent(0, "$cf_TERMVAR") ; return 0; } EOF -if { (eval echo configure:1811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "there is a terminfo/tgetent in $cf_termlib" 1>&5 cf_cv_lib_part_tgetent="-l$cf_termlib" @@ -1830,17 +1793,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1834: checking for $ac_hdr" >&5 +echo "configure:1797: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1839 "configure" +#line 1802 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1881,17 +1844,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1885: checking for $ac_hdr" >&5 +echo "configure:1848: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1890 "configure" +#line 1853 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1858: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1918,13 +1881,13 @@ done echo $ac_n "checking for lastlog path""... $ac_c" 1>&6 -echo "configure:1922: checking for lastlog path" >&5 +echo "configure:1885: checking for lastlog path" >&5 if eval "test \"`echo '$''{'cf_cv_path_lastlog'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1928 "configure" +#line 1891 "configure" #include "confdefs.h" #include <sys/types.h> @@ -1939,7 +1902,7 @@ char *path = _PATH_LASTLOG ; return 0; } EOF -if { (eval echo configure:1943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_path_lastlog="_PATH_LASTLOG" else @@ -1966,31 +1929,32 @@ echo $ac_n "checking for utmp implementation""... $ac_c" 1>&6 -echo "configure:1970: checking for utmp implementation" >&5 +echo "configure:1933: checking for utmp implementation" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_have_utmp=no for cf_header in utmpx utmp ; do - cat > conftest.$ac_ext <<EOF -#line 1978 "configure" -#include "confdefs.h" - +cf_utmp_includes=" #include <sys/types.h> #include <${cf_header}.h> #define getutent getutxent #ifdef USE_LASTLOG #include <lastlog.h> /* may conflict with utmpx.h on Linux */ #endif - +" + cat > conftest.$ac_ext <<EOF +#line 1949 "configure" +#include "confdefs.h" +$cf_utmp_includes int main() { struct $cf_header x; char *name = x.ut_name; /* utmp.h and compatible definitions */ ; return 0; } EOF -if { (eval echo configure:1994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=$cf_header break @@ -2000,29 +1964,18 @@ rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 2004 "configure" +#line 1968 "configure" #include "confdefs.h" - -#include <sys/types.h> -#include <${cf_header}.h> -#define getutent getutxent -#ifdef USE_LASTLOG -#include <lastlog.h> /* may conflict with utmpx.h on Linux */ -#endif - +$cf_utmp_includes int main() { struct $cf_header x; char *name = x.ut_user; /* utmpx.h must declare this */ ; return 0; } EOF -if { (eval echo configure:2020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=$cf_header - cat >> confdefs.h <<\EOF -#define ut_name ut_user -EOF - break else @@ -2048,16 +2001,15 @@ EOF - if test $cf_cv_have_utmp != no ; then echo $ac_n "checking if utmp.ut_host is declared""... $ac_c" 1>&6 -echo "configure:2055: checking if utmp.ut_host is declared" >&5 +echo "configure:2007: checking if utmp.ut_host is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_host'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2061 "configure" +#line 2013 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2066,7 +2018,7 @@ struct $cf_cv_have_utmp x; char *y = &x.ut_host[0] ; return 0; } EOF -if { (eval echo configure:2070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_host=yes else @@ -2087,10 +2039,65 @@ fi +if test $cf_cv_have_utmp != no ; then +echo $ac_n "checking if utmp.ut_name is declared""... $ac_c" 1>&6 +echo "configure:2045: checking if utmp.ut_name is declared" >&5 +if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_name'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cf_cv_have_utmp_ut_name=no +cf_utmp_includes=" +#include <sys/types.h> +#include <${cf_cv_have_utmp}.h> +#define getutent getutxent +#ifdef USE_LASTLOG +#include <lastlog.h> /* may conflict with utmpx.h on Linux */ +#endif +" +for cf_header in ut_name ut_user ; do + cat > conftest.$ac_ext <<EOF +#line 2061 "configure" +#include "confdefs.h" +$cf_utmp_includes +int main() { +struct $cf_cv_have_utmp x; + char *name = x.$cf_header; + +; return 0; } +EOF +if { (eval echo configure:2070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_have_utmp_ut_name=$cf_header + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$cf_cv_have_utmp_ut_name" 1>&6 +case $cf_cv_have_utmp_ut_name in #(vi +no) #(vi + { echo "configure: error: Cannot find declaration for ut.ut_name" 1>&2; exit 1; } + ;; +ut_user) + cat >> confdefs.h <<\EOF +#define ut_name ut_user +EOF + + ;; +esac +fi + + if test $cf_cv_have_utmp != no ; then echo $ac_n "checking for exit-status in $cf_cv_have_utmp""... $ac_c" 1>&6 -echo "configure:2094: checking for exit-status in $cf_cv_have_utmp" >&5 +echo "configure:2101: checking for exit-status in $cf_cv_have_utmp" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_xstatus'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2102,7 +2109,7 @@ ut_exit.ut_exit do cat > conftest.$ac_ext <<EOF -#line 2106 "configure" +#line 2113 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2111,7 +2118,7 @@ struct $cf_cv_have_utmp x; long y = x.$cf_result = 0 ; return 0; } EOF -if { (eval echo configure:2115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xstatus=$cf_result break @@ -2140,16 +2147,15 @@ fi - if test $cf_cv_have_utmp != no ; then echo $ac_n "checking if utmp.ut_xtime is declared""... $ac_c" 1>&6 -echo "configure:2147: checking if utmp.ut_xtime is declared" >&5 +echo "configure:2153: checking if utmp.ut_xtime is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_xtime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2153 "configure" +#line 2159 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2158,7 +2164,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0 ; return 0; } EOF -if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2168: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xtime=yes else @@ -2166,7 +2172,7 @@ cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 2170 "configure" +#line 2176 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2175,7 +2181,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec ; return 0; } EOF -if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xtime=define else @@ -2207,16 +2213,15 @@ fi - if test $cf_cv_have_utmp != no ; then echo $ac_n "checking if utmp.ut_session is declared""... $ac_c" 1>&6 -echo "configure:2214: checking if utmp.ut_session is declared" >&5 +echo "configure:2219: checking if utmp.ut_session is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_session'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2220 "configure" +#line 2225 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2225,7 +2230,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_session ; return 0; } EOF -if { (eval echo configure:2229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_session=yes else @@ -2248,16 +2253,15 @@ fi - echo $ac_n "checking if $cf_cv_have_utmp is SYSV flavor""... $ac_c" 1>&6 -echo "configure:2254: checking if $cf_cv_have_utmp is SYSV flavor" >&5 +echo "configure:2258: checking if $cf_cv_have_utmp is SYSV flavor" >&5 if eval "test \"`echo '$''{'cf_cv_sysv_utmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" cat > conftest.$ac_ext <<EOF -#line 2261 "configure" +#line 2265 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2271,7 +2275,7 @@ end${cf_prefix}ent(); ; return 0; } EOF -if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_sysv_utmp=yes else @@ -2294,7 +2298,7 @@ echo $ac_n "checking if you want to link with utempter""... $ac_c" 1>&6 -echo "configure:2298: checking if you want to link with utempter" >&5 +echo "configure:2302: checking if you want to link with utempter" >&5 # Check whether --with-utempter or --without-utempter was given. if test "${with_utempter+set}" = set; then @@ -2306,10 +2310,10 @@ echo "$ac_t""$use_utempter" 1>&6 -if test $use_utempter = yes ; then +if test "$use_utempter" = yes ; then echo $ac_n "checking if we can link with utempter library""... $ac_c" 1>&6 -echo "configure:2313: checking if we can link with utempter library" >&5 +echo "configure:2317: checking if we can link with utempter library" >&5 if eval "test \"`echo '$''{'cf_cv_have_utempter'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2317,7 +2321,7 @@ cf_save_LIBS="$LIBS" LIBS="-lutempter $LIBS" cat > conftest.$ac_ext <<EOF -#line 2321 "configure" +#line 2325 "configure" #include "confdefs.h" #include <utempter.h> @@ -2329,7 +2333,7 @@ ; return 0; } EOF -if { (eval echo configure:2333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_have_utempter=yes @@ -2360,13 +2364,13 @@ echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6 -echo "configure:2364: checking if external errno is declared" >&5 +echo "configure:2368: checking if external errno is declared" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2370 "configure" +#line 2374 "configure" #include "confdefs.h" #ifdef HAVE_STDLIB_H @@ -2379,27 +2383,24 @@ long x = (long) errno ; return 0; } EOF -if { (eval echo configure:2383: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - eval 'cf_cv_dcl_'errno'=yes' + cf_cv_dcl_errno=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval 'cf_cv_dcl_'errno'=no' + cf_cv_dcl_errno=no fi rm -f conftest* fi - -eval 'cf_result=$cf_cv_dcl_'errno -echo "$ac_t""$cf_result" 1>&6 +echo "$ac_t""$cf_cv_dcl_errno" 1>&6 -if test "$cf_result" = no ; then - eval 'cf_result=DECL_'errno +if test "$cf_cv_dcl_errno" = no ; then -cf_result=`echo "$cf_result" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_result=`echo "decl_errno" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >> confdefs.h <<EOF #define $cf_result 1 @@ -2410,13 +2411,13 @@ # It's possible (for near-UNIX clones) that the data doesn't exist echo $ac_n "checking if external errno exists""... $ac_c" 1>&6 -echo "configure:2414: checking if external errno exists" >&5 +echo "configure:2415: checking if external errno exists" >&5 if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2420 "configure" +#line 2421 "configure" #include "confdefs.h" #undef errno @@ -2426,26 +2427,24 @@ errno = 2 ; return 0; } EOF -if { (eval echo configure:2430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval 'cf_cv_have_'errno'=yes' + cf_cv_have_errno=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval 'cf_cv_have_'errno'=no' + cf_cv_have_errno=no fi rm -f conftest* -fi +fi -eval 'cf_result=$cf_cv_have_'errno -echo "$ac_t""$cf_result" 1>&6 +echo "$ac_t""$cf_cv_have_errno" 1>&6 -if test "$cf_result" = yes ; then - eval 'cf_result=HAVE_'errno +if test "$cf_cv_have_errno" = yes ; then -cf_result=`echo "$cf_result" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_result=`echo "have_errno" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >> confdefs.h <<EOF #define $cf_result 1 @@ -2458,7 +2457,7 @@ echo $ac_n "checking for tty group name""... $ac_c" 1>&6 -echo "configure:2462: checking for tty group name" >&5 +echo "configure:2461: checking for tty group name" >&5 if eval "test \"`echo '$''{'cf_cv_tty_group_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2516,7 +2515,7 @@ echo $ac_n "checking if we may use tty group""... $ac_c" 1>&6 -echo "configure:2520: checking if we may use tty group" >&5 +echo "configure:2519: checking if we may use tty group" >&5 if eval "test \"`echo '$''{'cf_cv_tty_group'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2525,7 +2524,7 @@ cf_cv_tty_group=unknown else cat > conftest.$ac_ext <<EOF -#line 2529 "configure" +#line 2528 "configure" #include "confdefs.h" #include <unistd.h> @@ -2550,7 +2549,7 @@ } EOF -if { (eval echo configure:2554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_tty_group=yes else @@ -2575,7 +2574,7 @@ ### checks for compiler characteristics echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:2579: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:2578: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2599,26 +2598,39 @@ -Xc do +cf_new_cflags= +cf_new_cppflags= for cf_add_cflags in $cf_arg do case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case "$CPPFLAGS" in - *$cf_add_cflags) + *$cf_add_cflags) #(vi ;; - *) - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) - CFLAGS="$CFLAGS $cf_add_cflags" + cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac done +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + + cat > conftest.$ac_ext <<EOF -#line 2622 "configure" +#line 2634 "configure" #include "confdefs.h" #ifndef CC_HAS_PROTOS @@ -2634,7 +2646,7 @@ struct s2 {int (*f) (double a);}; ; return 0; } EOF -if { (eval echo configure:2638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else @@ -2653,24 +2665,37 @@ if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then +cf_new_cflags= +cf_new_cppflags= for cf_add_cflags in $cf_cv_ansi_cc do case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case "$CPPFLAGS" in - *$cf_add_cflags) + *$cf_add_cflags) #(vi ;; - *) - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) - CFLAGS="$CFLAGS $cf_add_cflags" + cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac done +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + + else cat >> confdefs.h <<\EOF #define CC_HAS_PROTOS 1 @@ -2680,12 +2705,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2684: checking for working const" >&5 +echo "configure:2709: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2689 "configure" +#line 2714 "configure" #include "confdefs.h" int main() { @@ -2734,7 +2759,7 @@ ; return 0; } EOF -if { (eval echo configure:2738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2758,12 +2783,12 @@ ### checks for system services and user specified options echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2762: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2787: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2767 "configure" +#line 2792 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -2779,7 +2804,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2802,13 +2827,13 @@ echo $ac_n "checking for POSIX wait functions""... $ac_c" 1>&6 -echo "configure:2806: checking for POSIX wait functions" >&5 +echo "configure:2831: checking for POSIX wait functions" >&5 if eval "test \"`echo '$''{'cf_cv_posix_wait'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2812 "configure" +#line 2837 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2826,7 +2851,7 @@ ; return 0; } EOF -if { (eval echo configure:2830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_posix_wait=yes else @@ -2847,13 +2872,13 @@ echo $ac_n "checking if this platform has SYSV flavor""... $ac_c" 1>&6 -echo "configure:2851: checking if this platform has SYSV flavor" >&5 +echo "configure:2876: checking if this platform has SYSV flavor" >&5 if eval "test \"`echo '$''{'cf_cv_sysv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2857 "configure" +#line 2882 "configure" #include "confdefs.h" #include <curses.h> @@ -2878,7 +2903,7 @@ ; return 0; } EOF -if { (eval echo configure:2882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sysv=yes else @@ -2899,7 +2924,7 @@ echo $ac_n "checking for elf_begin in -lelf""... $ac_c" 1>&6 -echo "configure:2903: checking for elf_begin in -lelf" >&5 +echo "configure:2928: checking for elf_begin in -lelf" >&5 ac_lib_var=`echo elf'_'elf_begin | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2907,7 +2932,7 @@ ac_save_LIBS="$LIBS" LIBS="-lelf $LIBS" cat > conftest.$ac_ext <<EOF -#line 2911 "configure" +#line 2936 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2918,7 +2943,7 @@ elf_begin() ; return 0; } EOF -if { (eval echo configure:2922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2935,13 +2960,13 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking if this is an SVR4 system""... $ac_c" 1>&6 -echo "configure:2939: checking if this is an SVR4 system" >&5 +echo "configure:2964: checking if this is an SVR4 system" >&5 if eval "test \"`echo '$''{'cf_cv_svr4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2945 "configure" +#line 2970 "configure" #include "confdefs.h" #include <elf.h> @@ -2962,7 +2987,7 @@ ; return 0; } EOF -if { (eval echo configure:2966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_svr4=yes else @@ -2988,13 +3013,13 @@ echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6 -echo "configure:2992: checking if we must define _GNU_SOURCE" >&5 +echo "configure:3017: checking if we must define _GNU_SOURCE" >&5 if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2998 "configure" +#line 3023 "configure" #include "confdefs.h" #include <sys/types.h> int main() { @@ -3004,7 +3029,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -3014,7 +3039,7 @@ cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat > conftest.$ac_ext <<EOF -#line 3018 "configure" +#line 3043 "configure" #include "confdefs.h" #include <sys/types.h> int main() { @@ -3024,7 +3049,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -3049,7 +3074,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:3053: checking for X" >&5 +echo "configure:3078: checking for X" >&5 # Check whether --with-x or --without-x was given. @@ -3112,12 +3137,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 3116 "configure" +#line 3141 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3186,14 +3211,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 3190 "configure" +#line 3215 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:3197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -3293,7 +3318,7 @@ # FIXME: modify the library lookup in autoconf to # allow _s.a suffix ahead of .a echo $ac_n "checking for open in -lc_s""... $ac_c" 1>&6 -echo "configure:3297: checking for open in -lc_s" >&5 +echo "configure:3322: checking for open in -lc_s" >&5 ac_lib_var=`echo c_s'_'open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3301,7 +3326,7 @@ ac_save_LIBS="$LIBS" LIBS="-lc_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3305 "configure" +#line 3330 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3312,7 +3337,7 @@ open() ; return 0; } EOF -if { (eval echo configure:3316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3329,7 +3354,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lc_s $LIBS" echo $ac_n "checking for gethostname in -lbsd""... $ac_c" 1>&6 -echo "configure:3333: checking for gethostname in -lbsd" >&5 +echo "configure:3358: checking for gethostname in -lbsd" >&5 ac_lib_var=`echo bsd'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3337,7 +3362,7 @@ ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <<EOF -#line 3341 "configure" +#line 3366 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3348,7 +3373,7 @@ gethostname() ; return 0; } EOF -if { (eval echo configure:3352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3365,7 +3390,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lbsd $LIBS" echo $ac_n "checking for gethostname in -lnsl_s""... $ac_c" 1>&6 -echo "configure:3369: checking for gethostname in -lnsl_s" >&5 +echo "configure:3394: checking for gethostname in -lnsl_s" >&5 ac_lib_var=`echo nsl_s'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3373,7 +3398,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3377 "configure" +#line 3402 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3384,7 +3409,7 @@ gethostname() ; return 0; } EOF -if { (eval echo configure:3388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3401,7 +3426,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lnsl_s $LIBS" echo $ac_n "checking for XOpenDisplay in -lX11_s""... $ac_c" 1>&6 -echo "configure:3405: checking for XOpenDisplay in -lX11_s" >&5 +echo "configure:3430: checking for XOpenDisplay in -lX11_s" >&5 ac_lib_var=`echo X11_s'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3409,7 +3434,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3413 "configure" +#line 3438 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3420,7 +3445,7 @@ XOpenDisplay() ; return 0; } EOF -if { (eval echo configure:3424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3437,7 +3462,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lX11_s $LIBS" echo $ac_n "checking for XtAppInitialize in -lXt_s""... $ac_c" 1>&6 -echo "configure:3441: checking for XtAppInitialize in -lXt_s" >&5 +echo "configure:3466: checking for XtAppInitialize in -lXt_s" >&5 ac_lib_var=`echo Xt_s'_'XtAppInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3445,7 +3470,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXt_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3449 "configure" +#line 3474 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3456,7 +3481,7 @@ XtAppInitialize() ; return 0; } EOF -if { (eval echo configure:3460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3497,7 +3522,7 @@ ;; *) echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:3501: checking for socket in -lsocket" >&5 +echo "configure:3526: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3505,7 +3530,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 3509 "configure" +#line 3534 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3516,7 +3541,7 @@ socket() ; return 0; } EOF -if { (eval echo configure:3520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3544,7 +3569,7 @@ fi echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6 -echo "configure:3548: checking for gethostname in -lnsl" >&5 +echo "configure:3573: checking for gethostname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3552,7 +3577,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3556 "configure" +#line 3581 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3563,7 +3588,7 @@ gethostname() ; return 0; } EOF -if { (eval echo configure:3567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3614,17 +3639,17 @@ case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:3618: checking whether -R must be followed by a space" >&5 +echo "configure:3643: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <<EOF -#line 3621 "configure" +#line 3646 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -3640,14 +3665,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <<EOF -#line 3644 "configure" +#line 3669 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:3651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -3679,7 +3704,7 @@ # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:3683: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3708: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3687,7 +3712,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <<EOF -#line 3691 "configure" +#line 3716 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3698,7 +3723,7 @@ dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3720,7 +3745,7 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:3724: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:3749: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3728,7 +3753,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <<EOF -#line 3732 "configure" +#line 3757 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3739,7 +3764,7 @@ dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:3743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3768,12 +3793,12 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:3772: checking for gethostbyname" >&5 +echo "configure:3797: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3777 "configure" +#line 3802 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -3796,7 +3821,7 @@ ; return 0; } EOF -if { (eval echo configure:3800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -3817,7 +3842,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3821: checking for gethostbyname in -lnsl" >&5 +echo "configure:3846: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3825,7 +3850,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3829 "configure" +#line 3854 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3836,7 +3861,7 @@ gethostbyname() ; return 0; } EOF -if { (eval echo configure:3840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3866,12 +3891,12 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:3870: checking for connect" >&5 +echo "configure:3895: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3875 "configure" +#line 3900 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -3894,7 +3919,7 @@ ; return 0; } EOF -if { (eval echo configure:3898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -3915,7 +3940,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3919: checking for connect in -lsocket" >&5 +echo "configure:3944: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3923,7 +3948,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 3927 "configure" +#line 3952 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3934,7 +3959,7 @@ connect() ; return 0; } EOF -if { (eval echo configure:3938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3958,12 +3983,12 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:3962: checking for remove" >&5 +echo "configure:3987: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3967 "configure" +#line 3992 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove(); below. */ @@ -3986,7 +4011,7 @@ ; return 0; } EOF -if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -4007,7 +4032,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:4011: checking for remove in -lposix" >&5 +echo "configure:4036: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4015,7 +4040,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 4019 "configure" +#line 4044 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4026,7 +4051,7 @@ remove() ; return 0; } EOF -if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4050,12 +4075,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:4054: checking for shmat" >&5 +echo "configure:4079: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4059 "configure" +#line 4084 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat(); below. */ @@ -4078,7 +4103,7 @@ ; return 0; } EOF -if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -4099,7 +4124,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4103: checking for shmat in -lipc" >&5 +echo "configure:4128: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4107,7 +4132,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <<EOF -#line 4111 "configure" +#line 4136 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4118,7 +4143,7 @@ shmat() ; return 0; } EOF -if { (eval echo configure:4122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4151,7 +4176,7 @@ # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:4155: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4180: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4159,7 +4184,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4163 "configure" +#line 4188 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4170,7 +4195,7 @@ IceConnectionNumber() ; return 0; } EOF -if { (eval echo configure:4174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4196,26 +4221,72 @@ LDFLAGS="$LDFLAGS $X_LIBS" +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 + +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" + +cf_new_cflags= +cf_new_cppflags= for cf_add_cflags in $X_CFLAGS do case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case "$CPPFLAGS" in - *$cf_add_cflags) + *$cf_add_cflags) #(vi ;; - *) - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) - CFLAGS="$CFLAGS $cf_add_cflags" + cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac done +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + + +if test "$cf_check_cflags" != "$CFLAGS" ; then +cat > conftest.$ac_ext <<EOF +#line 4265 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +printf("Hello world"); +; return 0; } +EOF +if { (eval echo configure:4272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + + if test "$cf_check_cppflags" != "$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest* +fi + echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:4219: checking for XOpenDisplay in -lX11" >&5 +echo "configure:4290: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4223,7 +4294,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4227 "configure" +#line 4298 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4234,7 +4305,7 @@ XOpenDisplay() ; return 0; } EOF -if { (eval echo configure:4238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4255,7 +4326,7 @@ fi echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6 -echo "configure:4259: checking for XtAppInitialize in -lXt" >&5 +echo "configure:4330: checking for XtAppInitialize in -lXt" >&5 ac_lib_var=`echo Xt'_'XtAppInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4263,7 +4334,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4267 "configure" +#line 4338 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4274,7 +4345,7 @@ XtAppInitialize() ; return 0; } EOF -if { (eval echo configure:4278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4302,26 +4373,72 @@ else LDFLAGS="$LDFLAGS $X_LIBS" +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 + +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" + +cf_new_cflags= +cf_new_cppflags= for cf_add_cflags in $X_CFLAGS do case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case "$CPPFLAGS" in - *$cf_add_cflags) + *$cf_add_cflags) #(vi ;; - *) - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) - CFLAGS="$CFLAGS $cf_add_cflags" + cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac done +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi + +if test "$cf_check_cflags" != "$CFLAGS" ; then +cat > conftest.$ac_ext <<EOF +#line 4417 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +printf("Hello world"); +; return 0; } +EOF +if { (eval echo configure:4424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + + if test "$cf_check_cppflags" != "$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest* +fi + +fi + if test $cf_have_X_LIBS = no ; then echo "configure: warning: Unable to successfully link X Toolkit library (-lXt) with test program. You will have to check and add the proper libraries by hand @@ -4337,17 +4454,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4341: checking for $ac_hdr" >&5 +echo "configure:4458: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4346 "configure" +#line 4463 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4395,7 +4512,7 @@ echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6 -echo "configure:4399: checking for XextCreateExtension in -lXext" >&5 +echo "configure:4516: checking for XextCreateExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4403,7 +4520,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXext $LIBS" cat > conftest.$ac_ext <<EOF -#line 4407 "configure" +#line 4524 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4414,7 +4531,7 @@ XextCreateExtension() ; return 0; } EOF -if { (eval echo configure:4418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4435,29 +4552,31 @@ fi -cf_x_athena_include="" cf_x_athena_lib="" + +cf_x_athena_root=$cf_x_athena +cf_x_athena_include="" + for cf_path in default \ /usr/contrib/X11R6 \ /usr/contrib/X11R5 \ /usr/lib/X11R5 \ /usr/local do - if test -z "$cf_x_athena_include" ; then cf_save="$CPPFLAGS" - cf_test=X11/$cf_x_athena/SimpleMenu.h + cf_test=X11/$cf_x_athena_root/SimpleMenu.h if test $cf_path != default ; then CPPFLAGS="-I$cf_path/include $cf_save" echo $ac_n "checking for $cf_test in $cf_path""... $ac_c" 1>&6 -echo "configure:4455: checking for $cf_test in $cf_path" >&5 +echo "configure:4574: checking for $cf_test in $cf_path" >&5 else echo $ac_n "checking for $cf_test""... $ac_c" 1>&6 -echo "configure:4458: checking for $cf_test" >&5 +echo "configure:4577: checking for $cf_test" >&5 fi cat > conftest.$ac_ext <<EOF -#line 4461 "configure" +#line 4580 "configure" #include "confdefs.h" #include <X11/Intrinsic.h> @@ -4466,7 +4585,7 @@ ; return 0; } EOF -if { (eval echo configure:4470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_result=yes else @@ -4479,12 +4598,33 @@ echo "$ac_t""$cf_result" 1>&6 if test "$cf_result" = yes ; then cf_x_athena_include=$cf_path + break else CPPFLAGS="$cf_save" fi fi +done - for cf_lib in "-l$cf_x_athena -lXmu" "-l${cf_x_athena}_s -lXmu_s" +if test -z "$cf_x_athena_include" ; then + echo "configure: warning: Unable to successfully find Athena header files with test program" 1>&2 +elif test "$cf_x_athena_include" != default ; then + CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include" +fi + + +cf_x_athena_root=$cf_x_athena +cf_x_athena_lib="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + "-l$cf_x_athena_root -lXmu" \ + "-l$cf_x_athena_root -lXpm -lXmu" \ + "-l${cf_x_athena_root}_s -lXmu_s" do if test -z "$cf_x_athena_lib" ; then cf_save="$LIBS" @@ -4492,21 +4632,21 @@ if test $cf_path != default ; then LIBS="-L$cf_path/lib $cf_lib $LIBS" echo $ac_n "checking for $cf_lib in $cf_path""... $ac_c" 1>&6 -echo "configure:4496: checking for $cf_lib in $cf_path" >&5 +echo "configure:4636: checking for $cf_lib in $cf_path" >&5 else LIBS="$cf_lib $LIBS" echo $ac_n "checking for $cf_test in $cf_lib""... $ac_c" 1>&6 -echo "configure:4500: checking for $cf_test in $cf_lib" >&5 +echo "configure:4640: checking for $cf_test in $cf_lib" >&5 fi cat > conftest.$ac_ext <<EOF -#line 4503 "configure" +#line 4643 "configure" #include "confdefs.h" int main() { $cf_test() ; return 0; } EOF -if { (eval echo configure:4510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -4519,6 +4659,7 @@ echo "$ac_t""$cf_result" 1>&6 if test "$cf_result" = yes ; then cf_x_athena_lib="$cf_lib" + break else LIBS="$cf_save" fi @@ -4526,31 +4667,28 @@ done done -if test -z "$cf_x_athena_include" ; then - echo "configure: warning: Unable to successfully find Athena header files with test program" 1>&2 -fi - if test -z "$cf_x_athena_lib" ; then - { echo "configure: error: Unable to successfully link Athena library (-l$cf_x_athena) with test program" 1>&2; exit 1; } + { echo "configure: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" 1>&2; exit 1; } fi -CF_X_ATHENA_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >> confdefs.h <<EOF -#define $CF_X_ATHENA_LIBS 1 +#define $cf_x_athena_LIBS 1 EOF + echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6 -echo "configure:4548: checking for declaration of fd_set" >&5 +echo "configure:4686: checking for declaration of fd_set" >&5 if eval "test \"`echo '$''{'cf_cv_type_fd_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo "trying sys/types alone" 1>&5 cat > conftest.$ac_ext <<EOF -#line 4554 "configure" +#line 4692 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4558,7 +4696,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=sys/types.h else @@ -4567,7 +4705,7 @@ rm -rf conftest* echo "trying X11/Xpoll.h" 1>&5 cat > conftest.$ac_ext <<EOF -#line 4571 "configure" +#line 4709 "configure" #include "confdefs.h" #ifdef HAVE_X11_XPOLL_H @@ -4577,7 +4715,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=X11/Xpoll.h else @@ -4586,7 +4724,7 @@ rm -rf conftest* echo "trying sys/select.h" 1>&5 cat > conftest.$ac_ext <<EOF -#line 4590 "configure" +#line 4728 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4595,7 +4733,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=sys/select.h else @@ -4621,13 +4759,13 @@ echo $ac_n "checking for IRIX 6.5 baud-rate redefinitions""... $ac_c" 1>&6 -echo "configure:4625: checking for IRIX 6.5 baud-rate redefinitions" >&5 +echo "configure:4763: checking for IRIX 6.5 baud-rate redefinitions" >&5 if eval "test \"`echo '$''{'cf_cv_termio_c_ispeed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4631 "configure" +#line 4769 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4640,7 +4778,7 @@ ; return 0; } EOF -if { (eval echo configure:4644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_termio_c_ispeed=yes @@ -4668,12 +4806,12 @@ for ac_func in grantpt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4672: checking for $ac_func" >&5 +echo "configure:4810: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4677 "configure" +#line 4815 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4696,7 +4834,7 @@ ; return 0; } EOF -if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4718,7 +4856,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6 -echo "configure:4722: checking for openpty in -lutil" >&5 +echo "configure:4860: checking for openpty in -lutil" >&5 ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4726,7 +4864,7 @@ ac_save_LIBS="$LIBS" LIBS="-lutil $LIBS" cat > conftest.$ac_ext <<EOF -#line 4730 "configure" +#line 4868 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4737,7 +4875,7 @@ openpty() ; return 0; } EOF -if { (eval echo configure:4741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4771,7 +4909,7 @@ # Extract the first word of "xterm", so it can be a program name with args. set dummy xterm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4775: checking for $ac_word" >&5 +echo "configure:4913: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XTERM_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4809,12 +4947,12 @@ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4813: checking for $ac_func" >&5 +echo "configure:4951: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4818 "configure" +#line 4956 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4837,7 +4975,7 @@ ; return 0; } EOF -if { (eval echo configure:4841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4864,12 +5002,12 @@ for ac_func in Xutf8LookupString do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4868: checking for $ac_func" >&5 +echo "configure:5006: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4873 "configure" +#line 5011 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4892,7 +5030,7 @@ ; return 0; } EOF -if { (eval echo configure:4896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4922,7 +5060,7 @@ echo $ac_n "checking if we should use imake to help""... $ac_c" 1>&6 -echo "configure:4926: checking if we should use imake to help" >&5 +echo "configure:5064: checking if we should use imake to help" >&5 # Check whether --enable-imake or --disable-imake was given. if test "${enable_imake+set}" = set; then @@ -4940,14 +5078,14 @@ fi echo "$ac_t""$enable_imake" 1>&6 -if test $enable_imake = yes ; then +if test "$enable_imake" = yes ; then for ac_prog in xmkmf imake do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4951: checking for $ac_word" >&5 +echo "configure:5089: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_IMAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5084,28 +5222,41 @@ +cf_new_cflags= +cf_new_cppflags= for cf_add_cflags in $IMAKE_CFLAGS do case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case "$CPPFLAGS" in - *$cf_add_cflags) + *$cf_add_cflags) #(vi ;; - *) - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) - CFLAGS="$CFLAGS $cf_add_cflags" + cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac done +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi + +fi + echo $ac_n "checking for default terminal-id""... $ac_c" 1>&6 -echo "configure:5109: checking for default terminal-id" >&5 +echo "configure:5260: checking for default terminal-id" >&5 # Check whether --with-terminal-id or --without-terminal-id was given. if test "${with_terminal_id+set}" = set; then @@ -5126,7 +5277,7 @@ echo $ac_n "checking for default terminal-type""... $ac_c" 1>&6 -echo "configure:5130: checking for default terminal-type" >&5 +echo "configure:5281: checking for default terminal-type" >&5 # Check whether --with-terminal-type or --without-terminal-type was given. if test "${with_terminal_type+set}" = set; then @@ -5143,7 +5294,7 @@ echo $ac_n "checking for private terminfo-directory""... $ac_c" 1>&6 -echo "configure:5147: checking for private terminfo-directory" >&5 +echo "configure:5298: checking for private terminfo-directory" >&5 # Check whether --with-own-terminfo or --without-own-terminfo was given. if test "${with_own_terminfo+set}" = set; then @@ -5154,9 +5305,9 @@ fi echo "$ac_t""$TERMINFO_DIR" 1>&6 -if test $TERMINFO_DIR = yes ; then +if test "$TERMINFO_DIR" = yes ; then echo "configure: warning: no value given" 1>&2 -elif test $TERMINFO_DIR != none ; then +elif test "$TERMINFO_DIR" != none ; then if test -d $TERMINFO_DIR ; then cat >> confdefs.h <<EOF #define OWN_TERMINFO_DIR "$TERMINFO_DIR" @@ -5184,7 +5335,7 @@ echo $ac_n "checking if you want active-icons""... $ac_c" 1>&6 -echo "configure:5188: checking if you want active-icons" >&5 +echo "configure:5339: checking if you want active-icons" >&5 # Check whether --enable-active-icon or --disable-active-icon was given. if test "${enable_active_icon+set}" = set; then @@ -5202,7 +5353,7 @@ fi echo "$ac_t""$enable_active_icon" 1>&6 -if test $enable_active_icon = no ; then +if test "$enable_active_icon" = no ; then cat >> confdefs.h <<\EOF #define NO_ACTIVE_ICON 1 EOF @@ -5210,7 +5361,7 @@ fi echo $ac_n "checking if you want ANSI color""... $ac_c" 1>&6 -echo "configure:5214: checking if you want ANSI color" >&5 +echo "configure:5365: checking if you want ANSI color" >&5 # Check whether --enable-ansi-color or --disable-ansi-color was given. if test "${enable_ansi_color+set}" = set; then @@ -5228,15 +5379,15 @@ fi echo "$ac_t""$enable_ansi_color" 1>&6 -test $enable_ansi_color = no && cat >> confdefs.h <<\EOF +test "$enable_ansi_color" = no && cat >> confdefs.h <<\EOF #define OPT_ISO_COLORS 0 EOF -if test $enable_ansi_color = yes ; then +if test "$enable_ansi_color" = yes ; then echo $ac_n "checking if you want 16 colors like aixterm""... $ac_c" 1>&6 -echo "configure:5240: checking if you want 16 colors like aixterm" >&5 +echo "configure:5391: checking if you want 16 colors like aixterm" >&5 # Check whether --enable-16-color or --disable-16-color was given. if test "${enable_16_color+set}" = set; then @@ -5254,13 +5405,13 @@ fi echo "$ac_t""$enable_16_color" 1>&6 - test $enable_16_color = no && cat >> confdefs.h <<\EOF + test "$enable_16_color" = no && cat >> confdefs.h <<\EOF #define OPT_AIX_COLORS 0 EOF echo $ac_n "checking if you want 256 colors""... $ac_c" 1>&6 -echo "configure:5264: checking if you want 256 colors" >&5 +echo "configure:5415: checking if you want 256 colors" >&5 # Check whether --enable-256-color or --disable-256-color was given. if test "${enable_256_color+set}" = set; then @@ -5278,7 +5429,7 @@ fi echo "$ac_t""$enable_256_color" 1>&6 - if test $enable_256_color = yes ; then + if test "$enable_256_color" = yes ; then CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h" EXTRAHDRS="$EXTRAHDRS 256colres.h" cat >> confdefs.h <<\EOF @@ -5287,7 +5438,7 @@ else echo $ac_n "checking if you want 88 colors""... $ac_c" 1>&6 -echo "configure:5291: checking if you want 88 colors" >&5 +echo "configure:5442: checking if you want 88 colors" >&5 # Check whether --enable-88-color or --disable-88-color was given. if test "${enable_88_color+set}" = set; then @@ -5305,7 +5456,7 @@ fi echo "$ac_t""$enable_88_color" 1>&6 - if test $enable_88_color = yes ; then + if test "$enable_88_color" = yes ; then CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h" EXTRAHDRS="$EXTRAHDRS 88colres.h" cat >> confdefs.h <<\EOF @@ -5318,7 +5469,7 @@ fi echo $ac_n "checking if you want blinking cursor""... $ac_c" 1>&6 -echo "configure:5322: checking if you want blinking cursor" >&5 +echo "configure:5473: checking if you want blinking cursor" >&5 # Check whether --enable-blink-cursor or --disable-blink-cursor was given. if test "${enable_blink_cursor+set}" = set; then @@ -5336,15 +5487,15 @@ fi echo "$ac_t""$enable_blink_curs" 1>&6 -test $enable_blink_curs = no && cat >> confdefs.h <<\EOF +test "$enable_blink_curs" = no && cat >> confdefs.h <<\EOF #define OPT_BLINK_CURS 0 EOF -if test $enable_ansi_color = yes ; then +if test "$enable_ansi_color" = yes ; then echo $ac_n "checking if you want bold colors mapped like IBM PC""... $ac_c" 1>&6 -echo "configure:5348: checking if you want bold colors mapped like IBM PC" >&5 +echo "configure:5499: checking if you want bold colors mapped like IBM PC" >&5 # Check whether --enable-bold-color or --disable-bold-color was given. if test "${enable_bold_color+set}" = set; then @@ -5362,13 +5513,13 @@ fi echo "$ac_t""$enable_pc_color" 1>&6 - test $enable_pc_color = no && cat >> confdefs.h <<\EOF + test "$enable_pc_color" = no && cat >> confdefs.h <<\EOF #define OPT_PC_COLORS 0 EOF echo $ac_n "checking if you want separate color-classes""... $ac_c" 1>&6 -echo "configure:5372: checking if you want separate color-classes" >&5 +echo "configure:5523: checking if you want separate color-classes" >&5 # Check whether --enable-color-class or --disable-color-class was given. if test "${enable_color_class+set}" = set; then @@ -5386,13 +5537,13 @@ fi echo "$ac_t""$enable_color_class" 1>&6 - test $enable_color_class = no && cat >> confdefs.h <<\EOF + test "$enable_color_class" = no && cat >> confdefs.h <<\EOF #define OPT_COLOR_CLASS FALSE EOF echo $ac_n "checking if you want color-mode enabled by default""... $ac_c" 1>&6 -echo "configure:5396: checking if you want color-mode enabled by default" >&5 +echo "configure:5547: checking if you want color-mode enabled by default" >&5 # Check whether --enable-color-mode or --disable-color-mode was given. if test "${enable_color_mode+set}" = set; then @@ -5410,7 +5561,7 @@ fi echo "$ac_t""$default_colormode" 1>&6 - test $default_colormode = no && cat >> confdefs.h <<\EOF + test "$default_colormode" = no && cat >> confdefs.h <<\EOF #define DFT_COLORMODE FALSE EOF @@ -5418,7 +5569,7 @@ fi echo $ac_n "checking if you want support for color highlighting""... $ac_c" 1>&6 -echo "configure:5422: checking if you want support for color highlighting" >&5 +echo "configure:5573: checking if you want support for color highlighting" >&5 # Check whether --enable-highlighting or --disable-highlighting was given. if test "${enable_highlighting+set}" = set; then @@ -5436,13 +5587,13 @@ fi echo "$ac_t""$default_highlight" 1>&6 -test $default_highlight = no && cat >> confdefs.h <<\EOF +test "$default_highlight" = no && cat >> confdefs.h <<\EOF #define OPT_HIGHLIGHT_COLOR 0 EOF echo $ac_n "checking if you want support for doublesize characters""... $ac_c" 1>&6 -echo "configure:5446: checking if you want support for doublesize characters" >&5 +echo "configure:5597: checking if you want support for doublesize characters" >&5 # Check whether --enable-doublechars or --disable-doublechars was given. if test "${enable_doublechars+set}" = set; then @@ -5460,13 +5611,13 @@ fi echo "$ac_t""$enable_doublechars" 1>&6 -test $enable_doublechars = no && cat >> confdefs.h <<\EOF +test "$enable_doublechars" = no && cat >> confdefs.h <<\EOF #define OPT_DEC_CHRSET 0 EOF echo $ac_n "checking if you want fallback-support for box characters""... $ac_c" 1>&6 -echo "configure:5470: checking if you want fallback-support for box characters" >&5 +echo "configure:5621: checking if you want fallback-support for box characters" >&5 # Check whether --enable-boxchars or --disable-boxchars was given. if test "${enable_boxchars+set}" = set; then @@ -5484,13 +5635,13 @@ fi echo "$ac_t""$enable_boxchars" 1>&6 -test $enable_boxchars = no && cat >> confdefs.h <<\EOF +test "$enable_boxchars" = no && cat >> confdefs.h <<\EOF #define OPT_BOX_CHARS 0 EOF echo $ac_n "checking if you want to use FreeType library""... $ac_c" 1>&6 -echo "configure:5494: checking if you want to use FreeType library" >&5 +echo "configure:5645: checking if you want to use FreeType library" >&5 # Check whether --enable-freetype or --disable-freetype was given. if test "${enable_freetype+set}" = set; then @@ -5508,11 +5659,11 @@ fi echo "$ac_t""$enable_freetype" 1>&6 -if test $enable_freetype = yes ; then +if test "$enable_freetype" = yes ; then cf_freetype_libs="-lXft -lfreetype -lXrender -lXrender" echo $ac_n "checking for X FreeType libraries""... $ac_c" 1>&6 -echo "configure:5516: checking for X FreeType libraries" >&5 +echo "configure:5667: checking for X FreeType libraries" >&5 if eval "test \"`echo '$''{'cf_cv_x_freetype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5522,7 +5673,7 @@ LIBS="$cf_freetype_libs $LIBS" cat > conftest.$ac_ext <<EOF -#line 5526 "configure" +#line 5677 "configure" #include "confdefs.h" #include <X11/Xlib.h> @@ -5534,7 +5685,7 @@ ; return 0; } EOF -if { (eval echo configure:5538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_x_freetype=yes else @@ -5564,7 +5715,7 @@ fi echo $ac_n "checking if you want support for HP-style function keys""... $ac_c" 1>&6 -echo "configure:5568: checking if you want support for HP-style function keys" >&5 +echo "configure:5719: checking if you want support for HP-style function keys" >&5 # Check whether --enable-hp-fkeys or --disable-hp-fkeys was given. if test "${enable_hp_fkeys+set}" = set; then @@ -5582,7 +5733,7 @@ fi echo "$ac_t""$enable_hp_fkeys" 1>&6 -if test $enable_hp_fkeys = yes ; then +if test "$enable_hp_fkeys" = yes ; then cat >> confdefs.h <<\EOF #define OPT_HP_FUNC_KEYS 1 EOF @@ -5590,7 +5741,7 @@ fi echo $ac_n "checking if you want support for SCO-style function keys""... $ac_c" 1>&6 -echo "configure:5594: checking if you want support for SCO-style function keys" >&5 +echo "configure:5745: checking if you want support for SCO-style function keys" >&5 # Check whether --enable-sco-fkeys or --disable-sco-fkeys was given. if test "${enable_sco_fkeys+set}" = set; then @@ -5608,7 +5759,7 @@ fi echo "$ac_t""$enable_sco_fkeys" 1>&6 -if test $enable_sco_fkeys = yes ; then +if test "$enable_sco_fkeys" = yes ; then cat >> confdefs.h <<\EOF #define OPT_SCO_FUNC_KEYS 1 EOF @@ -5616,7 +5767,7 @@ fi echo $ac_n "checking if you want support for internationalization""... $ac_c" 1>&6 -echo "configure:5620: checking if you want support for internationalization" >&5 +echo "configure:5771: checking if you want support for internationalization" >&5 # Check whether --enable-i18n or --disable-i18n was given. if test "${enable_i18n+set}" = set; then @@ -5634,7 +5785,7 @@ fi echo "$ac_t""$enable_i18n" 1>&6 -if test $enable_i18n = no ; then +if test "$enable_i18n" = no ; then cat >> confdefs.h <<\EOF #define OPT_I18N_SUPPORT 0 EOF @@ -5642,7 +5793,7 @@ fi echo $ac_n "checking if you want support for initial-erase setup""... $ac_c" 1>&6 -echo "configure:5646: checking if you want support for initial-erase setup" >&5 +echo "configure:5797: checking if you want support for initial-erase setup" >&5 # Check whether --enable-initial-erase or --disable-initial-erase was given. if test "${enable_initial_erase+set}" = set; then @@ -5660,7 +5811,7 @@ fi echo "$ac_t""$enable_ie" 1>&6 -if test $enable_ie = no ; then +if test "$enable_ie" = no ; then cat >> confdefs.h <<\EOF #define OPT_INITIAL_ERASE 0 EOF @@ -5668,7 +5819,7 @@ fi echo $ac_n "checking if you want support for input-method""... $ac_c" 1>&6 -echo "configure:5672: checking if you want support for input-method" >&5 +echo "configure:5823: checking if you want support for input-method" >&5 # Check whether --enable-input-method or --disable-input-method was given. if test "${enable_input_method+set}" = set; then @@ -5688,13 +5839,13 @@ echo "$ac_t""$enable_ximp" 1>&6 echo $ac_n "checking if X libraries support input-method""... $ac_c" 1>&6 -echo "configure:5692: checking if X libraries support input-method" >&5 +echo "configure:5843: checking if X libraries support input-method" >&5 if eval "test \"`echo '$''{'cf_cv_input_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5698 "configure" +#line 5849 "configure" #include "confdefs.h" #include <X11/IntrinsicP.h> @@ -5721,7 +5872,7 @@ ; return 0; } EOF -if { (eval echo configure:5725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_input_method=yes else @@ -5736,7 +5887,7 @@ echo "$ac_t""$cf_cv_input_method" 1>&6 test "$cf_cv_input_method" = no && enable_ximp=no -if test $enable_ximp = no ; then +if test "$enable_ximp" = no ; then cat >> confdefs.h <<\EOF #define OPT_INPUT_METHOD 0 EOF @@ -5744,7 +5895,7 @@ fi echo $ac_n "checking if you want support for logging""... $ac_c" 1>&6 -echo "configure:5748: checking if you want support for logging" >&5 +echo "configure:5899: checking if you want support for logging" >&5 # Check whether --enable-logging or --disable-logging was given. if test "${enable_logging+set}" = set; then @@ -5762,13 +5913,13 @@ fi echo "$ac_t""$enable_logging" 1>&6 -if test $enable_logging = yes ; then +if test "$enable_logging" = yes ; then cat >> confdefs.h <<\EOF #define ALLOWLOGGING 1 EOF echo $ac_n "checking if you want to allow logging via a pipe""... $ac_c" 1>&6 -echo "configure:5772: checking if you want to allow logging via a pipe" >&5 +echo "configure:5923: checking if you want to allow logging via a pipe" >&5 # Check whether --enable-logfile-exec or --disable-logfile-exec was given. if test "${enable_logfile_exec+set}" = set; then @@ -5786,7 +5937,7 @@ fi echo "$ac_t""$enable_log_exec" 1>&6 - if test $enable_log_exec = yes ; then + if test "$enable_log_exec" = yes ; then cat >> confdefs.h <<\EOF #define ALLOWLOGFILEEXEC 1 EOF @@ -5795,7 +5946,7 @@ fi echo $ac_n "checking if you want support for iconify/maximize translations""... $ac_c" 1>&6 -echo "configure:5799: checking if you want support for iconify/maximize translations" >&5 +echo "configure:5950: checking if you want support for iconify/maximize translations" >&5 # Check whether --enable-maximize or --disable-maximize was given. if test "${enable_maximize+set}" = set; then @@ -5813,13 +5964,13 @@ fi echo "$ac_t""$enable_maximize" 1>&6 -test $enable_maximize = no && cat >> confdefs.h <<\EOF +test "$enable_maximize" = no && cat >> confdefs.h <<\EOF #define OPT_MAXIMIZE 0 EOF echo $ac_n "checking if you want NumLock to override keyboard tables""... $ac_c" 1>&6 -echo "configure:5823: checking if you want NumLock to override keyboard tables" >&5 +echo "configure:5974: checking if you want NumLock to override keyboard tables" >&5 # Check whether --enable-num-lock or --disable-num-lock was given. if test "${enable_num_lock+set}" = set; then @@ -5837,13 +5988,13 @@ fi echo "$ac_t""$enable_numlock" 1>&6 -test $enable_numlock = no && cat >> confdefs.h <<\EOF +test "$enable_numlock" = no && cat >> confdefs.h <<\EOF #define OPT_NUM_LOCK 0 EOF echo $ac_n "checking if you want support for right-scrollbar""... $ac_c" 1>&6 -echo "configure:5847: checking if you want support for right-scrollbar" >&5 +echo "configure:5998: checking if you want support for right-scrollbar" >&5 # Check whether --enable-rightbar or --disable-rightbar was given. if test "${enable_rightbar+set}" = set; then @@ -5861,7 +6012,7 @@ fi echo "$ac_t""$enable_rightbar" 1>&6 -if test $enable_rightbar = yes ; then +if test "$enable_rightbar" = yes ; then cat >> confdefs.h <<\EOF #define SCROLLBAR_RIGHT 1 EOF @@ -5869,7 +6020,7 @@ fi echo $ac_n "checking if you want check for redundant name-change""... $ac_c" 1>&6 -echo "configure:5873: checking if you want check for redundant name-change" >&5 +echo "configure:6024: checking if you want check for redundant name-change" >&5 # Check whether --enable-samename or --disable-samename was given. if test "${enable_samename+set}" = set; then @@ -5887,13 +6038,37 @@ fi echo "$ac_t""$enable_samename" 1>&6 -test $enable_samename = no && cat >> confdefs.h <<\EOF +test "$enable_samename" = no && cat >> confdefs.h <<\EOF #define OPT_SAME_NAME 0 EOF +echo $ac_n "checking if you want support for session management""... $ac_c" 1>&6 +echo "configure:6048: checking if you want support for session management" >&5 + +# Check whether --enable-session-mgt or --disable-session-mgt was given. +if test "${enable_session_mgt+set}" = set; then + enableval="$enable_session_mgt" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_session_mgt=no + else + enable_session_mgt=yes + fi +else + enableval=yes + enable_session_mgt=yes + +fi + +echo "$ac_t""$enable_session_mgt" 1>&6 +test "$enable_session_mgt" = no && cat >> confdefs.h <<\EOF +#define OPT_SESSION_MGT 0 +EOF + + echo $ac_n "checking if you want to use termcap-query/report""... $ac_c" 1>&6 -echo "configure:5897: checking if you want to use termcap-query/report" >&5 +echo "configure:6072: checking if you want to use termcap-query/report" >&5 # Check whether --enable-tcap-query or --disable-tcap-query was given. if test "${enable_tcap_query+set}" = set; then @@ -5911,13 +6086,13 @@ fi echo "$ac_t""$enable_tcap_query" 1>&6 -test $enable_tcap_query = yes && cat >> confdefs.h <<\EOF +test "$enable_tcap_query" = yes && cat >> confdefs.h <<\EOF #define OPT_TCAP_QUERY 1 EOF echo $ac_n "checking if you want support for tek4014""... $ac_c" 1>&6 -echo "configure:5921: checking if you want support for tek4014" >&5 +echo "configure:6096: checking if you want support for tek4014" >&5 # Check whether --enable-tek4014 or --disable-tek4014 was given. if test "${enable_tek4014+set}" = set; then @@ -5935,7 +6110,7 @@ fi echo "$ac_t""$enable_tek4014" 1>&6 -if test $enable_tek4014 = no ; then +if test "$enable_tek4014" = no ; then cat >> confdefs.h <<\EOF #define OPT_TEK4014 0 EOF @@ -5947,7 +6122,7 @@ fi echo $ac_n "checking if you want pulldown menus with a toolbar""... $ac_c" 1>&6 -echo "configure:5951: checking if you want pulldown menus with a toolbar" >&5 +echo "configure:6126: checking if you want pulldown menus with a toolbar" >&5 # Check whether --enable-toolbar or --disable-toolbar was given. if test "${enable_toolbar+set}" = set; then @@ -5965,13 +6140,52 @@ fi echo "$ac_t""$enable_toolbar" 1>&6 -test $enable_toolbar = yes && cat >> confdefs.h <<\EOF +if test "$enable_toolbar" = yes ; then + # The Xaw library in XFree86 4.x is broken. Let's try to avoid using + # that for the toolbar. + cf_broken_xaw=no + echo $ac_n "checking for broken Xaw library""... $ac_c" 1>&6 +echo "configure:6149: checking for broken Xaw library" >&5 + cat > conftest.$ac_ext <<EOF +#line 6151 "configure" +#include "confdefs.h" + +#include <X11/Intrinsic.h> +#include <X11/Xaw/XawInit.h> + +int main() { + +#if defined(XawVersion) && XawVersion > 7000000L +make an error +#endif + +; return 0; } +EOF +if { (eval echo configure:6165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + cf_broken_xaw=no + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cf_broken_xaw=yes + +fi +rm -f conftest* + echo "$ac_t""$cf_broken_xaw" 1>&6 + if test "$cf_broken_xaw" = no ; then + cat >> confdefs.h <<\EOF #define OPT_TOOLBAR 1 EOF + fi +fi echo $ac_n "checking if you want VT52 emulation""... $ac_c" 1>&6 -echo "configure:5975: checking if you want VT52 emulation" >&5 +echo "configure:6189: checking if you want VT52 emulation" >&5 # Check whether --enable-vt52 or --disable-vt52 was given. if test "${enable_vt52+set}" = set; then @@ -5989,31 +6203,57 @@ fi echo "$ac_t""$enable_vt52" 1>&6 -test $enable_vt52 = no && cat >> confdefs.h <<\EOF +test "$enable_vt52" = no && cat >> confdefs.h <<\EOF #define OPT_VT52_MODE 0 EOF +echo $ac_n "checking if you want to use luit""... $ac_c" 1>&6 +echo "configure:6213: checking if you want to use luit" >&5 + +# Check whether --enable-luit or --disable-luit was given. +if test "${enable_luit+set}" = set; then + enableval="$enable_luit" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_luit=yes + else + enable_luit=no + fi +else + enableval=no + enable_luit=no + +fi + +echo "$ac_t""$enable_luit" 1>&6 +if test "$enable_luit" = yes ; then + cat >> confdefs.h <<\EOF +#define OPT_LUIT_PROG 1 +EOF + +fi + echo $ac_n "checking if you want wide-character support""... $ac_c" 1>&6 -echo "configure:5999: checking if you want wide-character support" >&5 +echo "configure:6239: checking if you want wide-character support" >&5 # Check whether --enable-wide-chars or --disable-wide-chars was given. if test "${enable_wide_chars+set}" = set; then enableval="$enable_wide_chars" - test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then + test "$enableval" != no && enableval=yes + if test "$enableval" != "$enable_luit" ; then enable_wchar=yes else - enable_wchar=no + enable_wchar=$enable_luit fi else - enableval=no - enable_wchar=no + enableval=$enable_luit + enable_wchar=$enable_luit fi echo "$ac_t""$enable_wchar" 1>&6 -if test $enable_wchar = yes ; then +if test "$enable_wchar" = yes ; then cat >> confdefs.h <<\EOF #define OPT_WIDE_CHARS 1 EOF @@ -6024,7 +6264,7 @@ fi echo $ac_n "checking if you want DECterm Locator support""... $ac_c" 1>&6 -echo "configure:6028: checking if you want DECterm Locator support" >&5 +echo "configure:6268: checking if you want DECterm Locator support" >&5 # Check whether --enable-dec-locator or --disable-dec-locator was given. if test "${enable_dec_locator+set}" = set; then @@ -6042,7 +6282,7 @@ fi echo "$ac_t""$enable_dec_locator" 1>&6 -if test $enable_dec_locator = yes ; then +if test "$enable_dec_locator" = yes ; then cat >> confdefs.h <<\EOF #define OPT_DEC_LOCATOR 1 EOF @@ -6050,7 +6290,7 @@ fi echo $ac_n "checking if you want -ziconbeep option""... $ac_c" 1>&6 -echo "configure:6054: checking if you want -ziconbeep option" >&5 +echo "configure:6294: checking if you want -ziconbeep option" >&5 # Check whether --enable-ziconbeep or --disable-ziconbeep was given. if test "${enable_ziconbeep+set}" = set; then @@ -6068,7 +6308,7 @@ fi echo "$ac_t""$enable_ziconbeep" 1>&6 -test $enable_ziconbeep = no && cat >> confdefs.h <<\EOF +test "$enable_ziconbeep" = no && cat >> confdefs.h <<\EOF #define OPT_ZICONBEEP 0 EOF @@ -6077,7 +6317,7 @@ echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6 -echo "configure:6081: checking if you want debugging traces" >&5 +echo "configure:6321: checking if you want debugging traces" >&5 # Check whether --enable-trace or --disable-trace was given. if test "${enable_trace+set}" = set; then @@ -6095,7 +6335,7 @@ fi echo "$ac_t""$enable_trace" 1>&6 -if test $enable_trace = yes ; then +if test "$enable_trace" = yes ; then cat >> confdefs.h <<\EOF #define OPT_TRACE 1 EOF @@ -6106,7 +6346,7 @@ echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6 -echo "configure:6110: checking if you want to see long compiling messages" >&5 +echo "configure:6350: checking if you want to see long compiling messages" >&5 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then @@ -6146,7 +6386,7 @@ echo $ac_n "checking if you want magic cookie emulation""... $ac_c" 1>&6 -echo "configure:6150: checking if you want magic cookie emulation" >&5 +echo "configure:6390: checking if you want magic cookie emulation" >&5 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. if test "${enable_xmc_glitch+set}" = set; then @@ -6164,7 +6404,7 @@ fi echo "$ac_t""$enable_xmc" 1>&6 -if test $enable_xmc = yes ; then +if test "$enable_xmc" = yes ; then cat >> confdefs.h <<\EOF #define OPT_XMC_GLITCH 1 EOF @@ -6175,7 +6415,7 @@ if test -n "$GCC" ; then echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6 -echo "configure:6179: checking if you want to turn on gcc warnings" >&5 +echo "configure:6419: checking if you want to turn on gcc warnings" >&5 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then @@ -6215,9 +6455,9 @@ if test "$GCC" = yes then echo "checking for $CC __attribute__ directives" 1>&6 -echo "configure:6219: checking for $CC __attribute__ directives" >&5 +echo "configure:6459: checking for $CC __attribute__ directives" >&5 cat > conftest.$ac_ext <<EOF -#line 6221 "configure" +#line 6461 "configure" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -6255,7 +6495,7 @@ EOF ;; esac - if { (eval echo configure:6259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:6499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6 cat conftest.h >>confdefs.h # else @@ -6269,14 +6509,14 @@ fi -if test "$GCC" = yes +if ( test "$GCC" = yes || test "$GXX" = yes ) then cat > conftest.$ac_ext <<EOF -#line 6276 "configure" +#line 6516 "configure" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF echo "checking for $CC warning options" 1>&6 -echo "configure:6280: checking for $CC warning options" >&5 +echo "configure:6520: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" @@ -6291,10 +6531,11 @@ Wnested-externs \ Wpointer-arith \ Wshadow \ - Wstrict-prototypes $cf_warn_CONST + Wstrict-prototypes \ + Wundef $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo configure:6298: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:6539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" @@ -6315,8 +6556,12 @@ ### remove from CPPFLAGS the optional features we define in xtermcfg.h +### or other conflicting symbols that may be defined via imake: for cf_def in \ + __STDC__ \ ALLOWLOGGING \ + ALLOWLOGFILEEXEC \ + OPT_LUIT_PROG \ OPT_WIDE_CHARS \ SCROLLBAR_RIGHT \ USE_TTY_GROUP \ @@ -6417,7 +6662,7 @@ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13.20000819" + echo "$CONFIG_STATUS generated by autoconf version 2.13.20020210" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; Index: xc/programs/xterm/configure.in diff -u xc/programs/xterm/configure.in:3.51 xc/programs/xterm/configure.in:3.56 --- xc/programs/xterm/configure.in:3.51 Sun Nov 4 21:07:15 2001 +++ xc/programs/xterm/configure.in Fri Dec 27 16:05:22 2002 @@ -1,9 +1,9 @@ dnl -dnl $XFree86: xc/programs/xterm/configure.in,v 3.51 2001/11/05 02:07:15 dickey Exp $ +dnl $XFree86: xc/programs/xterm/configure.in,v 3.56 2002/12/27 21:05:22 dickey Exp $ dnl dnl --------------------------------------------------------------------------- dnl -dnl Copyright 1997-2000 by Thomas E. Dickey +dnl Copyright 1997-2002 by Thomas E. Dickey dnl dnl All Rights Reserved dnl @@ -27,7 +27,7 @@ dnl --------------------------------------------------------------------------- dnl Process this file with autoconf to produce a configure script. dnl -AC_PREREQ(2.13.20000819) +AC_PREREQ(2.13.20020210) AC_INIT(charproc.c) AC_CONFIG_HEADER(xtermcfg.h:xtermcfg.hin) CF_CHECK_CACHE @@ -53,7 +53,6 @@ ### checks for UNIX variants that set C preprocessor variables AC_AIX AC_ISC_POSIX -AC_MINIX ### checks for header files AC_CHECK_HEADERS( \ @@ -71,9 +70,11 @@ ### checks for library functions AC_CHECK_FUNCS( \ bcopy \ + gethostname \ getlogin \ memmove \ strerror \ + strftime \ tcgetattr \ waitpid \ ) @@ -88,7 +89,7 @@ [use_utempter=no]) AC_MSG_RESULT($use_utempter) -if test $use_utempter = yes ; then +if test "$use_utempter" = yes ; then CF_UTEMPTER fi @@ -141,7 +142,7 @@ [enable_imake=no], [enable_imake=yes]) AC_MSG_RESULT($enable_imake) -if test $enable_imake = yes ; then +if test "$enable_imake" = yes ; then CF_IMAKE_CFLAGS($(MAIN_DEFINES)) CF_ADD_CFLAGS($IMAKE_CFLAGS) fi @@ -172,9 +173,9 @@ [TERMINFO_DIR=$withval], [TERMINFO_DIR=${TERMINFO-none}]) AC_MSG_RESULT($TERMINFO_DIR) -if test $TERMINFO_DIR = yes ; then +if test "$TERMINFO_DIR" = yes ; then AC_MSG_WARN(no value given) -elif test $TERMINFO_DIR != none ; then +elif test "$TERMINFO_DIR" != none ; then if test -d $TERMINFO_DIR ; then AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR") else @@ -204,7 +205,7 @@ [enable_active_icon=no], [enable_active_icon=yes]) AC_MSG_RESULT($enable_active_icon) -if test $enable_active_icon = no ; then +if test "$enable_active_icon" = no ; then AC_DEFINE(NO_ACTIVE_ICON) fi @@ -214,9 +215,9 @@ [enable_ansi_color=no], [enable_ansi_color=yes]) AC_MSG_RESULT($enable_ansi_color) -test $enable_ansi_color = no && AC_DEFINE(OPT_ISO_COLORS,0) +test "$enable_ansi_color" = no && AC_DEFINE(OPT_ISO_COLORS,0) -if test $enable_ansi_color = yes ; then +if test "$enable_ansi_color" = yes ; then AC_MSG_CHECKING(if you want 16 colors like aixterm) CF_ARG_DISABLE(16-color, @@ -224,7 +225,7 @@ [enable_16_color=no], [enable_16_color=yes]) AC_MSG_RESULT($enable_16_color) - test $enable_16_color = no && AC_DEFINE(OPT_AIX_COLORS,0) + test "$enable_16_color" = no && AC_DEFINE(OPT_AIX_COLORS,0) AC_MSG_CHECKING(if you want 256 colors) CF_ARG_ENABLE(256-color, @@ -232,7 +233,7 @@ [enable_256_color=yes], [enable_256_color=no]) AC_MSG_RESULT($enable_256_color) - if test $enable_256_color = yes ; then + if test "$enable_256_color" = yes ; then CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h" EXTRAHDRS="$EXTRAHDRS 256colres.h" AC_DEFINE(OPT_256_COLORS,1) @@ -243,7 +244,7 @@ [enable_88_color=yes], [enable_88_color=no]) AC_MSG_RESULT($enable_88_color) - if test $enable_88_color = yes ; then + if test "$enable_88_color" = yes ; then CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h" EXTRAHDRS="$EXTRAHDRS 88colres.h" AC_DEFINE(OPT_88_COLORS,1) @@ -258,9 +259,9 @@ [enable_blink_curs=no], [enable_blink_curs=yes]) AC_MSG_RESULT($enable_blink_curs) -test $enable_blink_curs = no && AC_DEFINE(OPT_BLINK_CURS,0) +test "$enable_blink_curs" = no && AC_DEFINE(OPT_BLINK_CURS,0) -if test $enable_ansi_color = yes ; then +if test "$enable_ansi_color" = yes ; then AC_MSG_CHECKING(if you want bold colors mapped like IBM PC) CF_ARG_DISABLE(bold-color, @@ -268,7 +269,7 @@ [enable_pc_color=no], [enable_pc_color=yes]) AC_MSG_RESULT($enable_pc_color) - test $enable_pc_color = no && AC_DEFINE(OPT_PC_COLORS,0) + test "$enable_pc_color" = no && AC_DEFINE(OPT_PC_COLORS,0) AC_MSG_CHECKING(if you want separate color-classes) CF_ARG_DISABLE(color-class, @@ -276,7 +277,7 @@ [enable_color_class=no], [enable_color_class=yes]) AC_MSG_RESULT($enable_color_class) - test $enable_color_class = no && AC_DEFINE(OPT_COLOR_CLASS,FALSE) + test "$enable_color_class" = no && AC_DEFINE(OPT_COLOR_CLASS,FALSE) AC_MSG_CHECKING(if you want color-mode enabled by default) CF_ARG_DISABLE(color-mode, @@ -284,7 +285,7 @@ [default_colormode=no], [default_colormode=yes]) AC_MSG_RESULT($default_colormode) - test $default_colormode = no && AC_DEFINE(DFT_COLORMODE,FALSE) + test "$default_colormode" = no && AC_DEFINE(DFT_COLORMODE,FALSE) fi @@ -294,7 +295,7 @@ [default_highlight=no], [default_highlight=yes]) AC_MSG_RESULT($default_highlight) -test $default_highlight = no && AC_DEFINE(OPT_HIGHLIGHT_COLOR,0) +test "$default_highlight" = no && AC_DEFINE(OPT_HIGHLIGHT_COLOR,0) AC_MSG_CHECKING(if you want support for doublesize characters) CF_ARG_DISABLE(doublechars, @@ -302,7 +303,7 @@ [enable_doublechars=no], [enable_doublechars=yes]) AC_MSG_RESULT($enable_doublechars) -test $enable_doublechars = no && AC_DEFINE(OPT_DEC_CHRSET,0) +test "$enable_doublechars" = no && AC_DEFINE(OPT_DEC_CHRSET,0) AC_MSG_CHECKING(if you want fallback-support for box characters) CF_ARG_DISABLE(boxchars, @@ -310,7 +311,7 @@ [enable_boxchars=no], [enable_boxchars=yes]) AC_MSG_RESULT($enable_boxchars) -test $enable_boxchars = no && AC_DEFINE(OPT_BOX_CHARS,0) +test "$enable_boxchars" = no && AC_DEFINE(OPT_BOX_CHARS,0) AC_MSG_CHECKING(if you want to use FreeType library) CF_ARG_DISABLE(freetype, @@ -318,7 +319,7 @@ [enable_freetype=no], [enable_freetype=yes]) AC_MSG_RESULT($enable_freetype) -if test $enable_freetype = yes ; then +if test "$enable_freetype" = yes ; then CF_X_FREETYPE else CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` @@ -330,7 +331,7 @@ [enable_hp_fkeys=yes], [enable_hp_fkeys=no]) AC_MSG_RESULT($enable_hp_fkeys) -if test $enable_hp_fkeys = yes ; then +if test "$enable_hp_fkeys" = yes ; then AC_DEFINE(OPT_HP_FUNC_KEYS,1) fi @@ -340,7 +341,7 @@ [enable_sco_fkeys=yes], [enable_sco_fkeys=no]) AC_MSG_RESULT($enable_sco_fkeys) -if test $enable_sco_fkeys = yes ; then +if test "$enable_sco_fkeys" = yes ; then AC_DEFINE(OPT_SCO_FUNC_KEYS,1) fi @@ -350,7 +351,7 @@ [enable_i18n=no], [enable_i18n=yes]) AC_MSG_RESULT($enable_i18n) -if test $enable_i18n = no ; then +if test "$enable_i18n" = no ; then AC_DEFINE(OPT_I18N_SUPPORT,0) fi @@ -360,7 +361,7 @@ [enable_ie=no], [enable_ie=yes]) AC_MSG_RESULT($enable_ie) -if test $enable_ie = no ; then +if test "$enable_ie" = no ; then AC_DEFINE(OPT_INITIAL_ERASE,0) fi @@ -372,7 +373,7 @@ AC_MSG_RESULT($enable_ximp) CF_INPUT_METHOD test "$cf_cv_input_method" = no && enable_ximp=no -if test $enable_ximp = no ; then +if test "$enable_ximp" = no ; then AC_DEFINE(OPT_INPUT_METHOD,0) fi @@ -382,7 +383,7 @@ [enable_logging=yes], [enable_logging=no]) AC_MSG_RESULT($enable_logging) -if test $enable_logging = yes ; then +if test "$enable_logging" = yes ; then AC_DEFINE(ALLOWLOGGING) AC_MSG_CHECKING(if you want to allow logging via a pipe) CF_ARG_ENABLE(logfile-exec, @@ -390,7 +391,7 @@ [enable_log_exec=yes], [enable_log_exec=no]) AC_MSG_RESULT($enable_log_exec) - if test $enable_log_exec = yes ; then + if test "$enable_log_exec" = yes ; then AC_DEFINE(ALLOWLOGFILEEXEC) fi fi @@ -401,7 +402,7 @@ [enable_maximize=no], [enable_maximize=yes]) AC_MSG_RESULT($enable_maximize) -test $enable_maximize = no && AC_DEFINE(OPT_MAXIMIZE,0) +test "$enable_maximize" = no && AC_DEFINE(OPT_MAXIMIZE,0) AC_MSG_CHECKING(if you want NumLock to override keyboard tables) CF_ARG_DISABLE(num-lock, @@ -409,7 +410,7 @@ [enable_numlock=no], [enable_numlock=yes]) AC_MSG_RESULT($enable_numlock) -test $enable_numlock = no && AC_DEFINE(OPT_NUM_LOCK,0) +test "$enable_numlock" = no && AC_DEFINE(OPT_NUM_LOCK,0) AC_MSG_CHECKING(if you want support for right-scrollbar) CF_ARG_DISABLE(rightbar, @@ -417,7 +418,7 @@ [enable_rightbar=no], [enable_rightbar=yes]) AC_MSG_RESULT($enable_rightbar) -if test $enable_rightbar = yes ; then +if test "$enable_rightbar" = yes ; then AC_DEFINE(SCROLLBAR_RIGHT) fi @@ -427,15 +428,23 @@ [enable_samename=no], [enable_samename=yes]) AC_MSG_RESULT($enable_samename) -test $enable_samename = no && AC_DEFINE(OPT_SAME_NAME,0) +test "$enable_samename" = no && AC_DEFINE(OPT_SAME_NAME,0) +AC_MSG_CHECKING(if you want support for session management) +CF_ARG_DISABLE(session-mgt, + [ --disable-session-mgt disable support for session management], + [enable_session_mgt=no], + [enable_session_mgt=yes]) +AC_MSG_RESULT($enable_session_mgt) +test "$enable_session_mgt" = no && AC_DEFINE(OPT_SESSION_MGT,0) + AC_MSG_CHECKING(if you want to use termcap-query/report) CF_ARG_ENABLE(tcap-query, [ --enable-tcap-query compile-in termcap-query support], [enable_tcap_query=yes], [enable_tcap_query=no]) AC_MSG_RESULT($enable_tcap_query) -test $enable_tcap_query = yes && AC_DEFINE(OPT_TCAP_QUERY,1) +test "$enable_tcap_query" = yes && AC_DEFINE(OPT_TCAP_QUERY,1) AC_MSG_CHECKING(if you want support for tek4014) CF_ARG_DISABLE(tek4014, @@ -443,7 +452,7 @@ [enable_tek4014=no], [enable_tek4014=yes]) AC_MSG_RESULT($enable_tek4014) -if test $enable_tek4014 = no ; then +if test "$enable_tek4014" = no ; then AC_DEFINE(OPT_TEK4014,0) else EXTRAHDRS="$EXTRAHDRS Tekparse.h" @@ -457,7 +466,28 @@ [enable_toolbar=yes], [enable_toolbar=no]) AC_MSG_RESULT($enable_toolbar) -test $enable_toolbar = yes && AC_DEFINE(OPT_TOOLBAR,1) +if test "$enable_toolbar" = yes ; then + # The Xaw library in XFree86 4.x is broken. Let's try to avoid using + # that for the toolbar. + cf_broken_xaw=no + AC_MSG_CHECKING(for broken Xaw library) + AC_TRY_COMPILE([ +#include <X11/Intrinsic.h> +#include <X11/Xaw/XawInit.h> + ],[ +#if defined(XawVersion) && XawVersion > 7000000L +make an error +#endif + ],[ + cf_broken_xaw=no + ],[ + cf_broken_xaw=yes + ]) + AC_MSG_RESULT($cf_broken_xaw) + if test "$cf_broken_xaw" = no ; then + AC_DEFINE(OPT_TOOLBAR,1) + fi +fi AC_MSG_CHECKING(if you want VT52 emulation) CF_ARG_DISABLE(vt52, @@ -465,15 +495,26 @@ [enable_vt52=no], [enable_vt52=yes]) AC_MSG_RESULT($enable_vt52) -test $enable_vt52 = no && AC_DEFINE(OPT_VT52_MODE,0) +test "$enable_vt52" = no && AC_DEFINE(OPT_VT52_MODE,0) + +AC_MSG_CHECKING(if you want to use luit) +CF_ARG_ENABLE(luit, + [ --enable-luit enable luit filter (Unicode translation)], + [enable_luit=yes], + [enable_luit=no]) +AC_MSG_RESULT($enable_luit) +if test "$enable_luit" = yes ; then + AC_DEFINE(OPT_LUIT_PROG,1) +fi AC_MSG_CHECKING(if you want wide-character support) -CF_ARG_ENABLE(wide-chars, +CF_ARG_OPTION(wide-chars, [ --enable-wide-chars enable wide-character support], [enable_wchar=yes], - [enable_wchar=no]) + [enable_wchar=$enable_luit], + [$enable_luit]) AC_MSG_RESULT($enable_wchar) -if test $enable_wchar = yes ; then +if test "$enable_wchar" = yes ; then AC_DEFINE(OPT_WIDE_CHARS,1) EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c" @@ -486,7 +527,7 @@ [enable_dec_locator=yes], [enable_dec_locator=no]) AC_MSG_RESULT($enable_dec_locator) -if test $enable_dec_locator = yes ; then +if test "$enable_dec_locator" = yes ; then AC_DEFINE(OPT_DEC_LOCATOR,1) fi @@ -496,7 +537,7 @@ [enable_ziconbeep=no], [enable_ziconbeep=yes]) AC_MSG_RESULT($enable_ziconbeep) -test $enable_ziconbeep = no && AC_DEFINE(OPT_ZICONBEEP,0) +test "$enable_ziconbeep" = no && AC_DEFINE(OPT_ZICONBEEP,0) ############################################################################### CF_HELP_MESSAGE(Testing/development Options:) @@ -507,7 +548,7 @@ [enable_trace=yes], [enable_trace=no]) AC_MSG_RESULT($enable_trace) -if test $enable_trace = yes ; then +if test "$enable_trace" = yes ; then AC_DEFINE(OPT_TRACE) EXTRASRCS="$EXTRASRCS trace.c" EXTRAOBJS="$EXTRAOBJS trace.o" @@ -521,7 +562,7 @@ [enable_xmc=yes], [enable_xmc=no]) AC_MSG_RESULT($enable_xmc) -if test $enable_xmc = yes ; then +if test "$enable_xmc" = yes ; then AC_DEFINE(OPT_XMC_GLITCH,1) EXTRASRCS="$EXTRASRCS testxmc.c" EXTRAOBJS="$EXTRAOBJS testxmc.o" @@ -548,8 +589,12 @@ AC_SUBST(EXTRAOBJS) ### remove from CPPFLAGS the optional features we define in xtermcfg.h +### or other conflicting symbols that may be defined via imake: for cf_def in \ + __STDC__ \ ALLOWLOGGING \ + ALLOWLOGFILEEXEC \ + OPT_LUIT_PROG \ OPT_WIDE_CHARS \ SCROLLBAR_RIGHT \ USE_TTY_GROUP \ Index: xc/programs/xterm/cursor.c diff -u xc/programs/xterm/cursor.c:3.14 xc/programs/xterm/cursor.c:3.15 --- xc/programs/xterm/cursor.c:3.14 Wed Jan 17 18:46:36 2001 +++ xc/programs/xterm/cursor.c Sun Apr 28 15:04:20 2002 @@ -2,9 +2,37 @@ * $Xorg: cursor.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/cursor.c,v 3.14 2001/01/17 23:46:36 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/cursor.c,v 3.15 2002/04/28 19:04:20 dickey Exp $ */ /* + * Copyright 2002 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved @@ -58,62 +86,62 @@ * The origin is considered to be 0, 0 for this procedure. */ void -CursorSet(register TScreen *screen, register int row, register int col, unsigned flags) +CursorSet(register TScreen * screen, register int row, register int col, unsigned flags) { - register int maxr; + register int maxr; - col = (col < 0 ? 0 : col); - screen->cur_col = (col <= screen->max_col ? col : screen->max_col); - maxr = screen->max_row; - if (flags & ORIGIN) { - row += screen->top_marg; - maxr = screen->bot_marg; - } - row = (row < 0 ? 0 : row); - screen->cur_row = (row <= maxr ? row : maxr); - screen->do_wrap = 0; - _CheckSelection(screen); + col = (col < 0 ? 0 : col); + screen->cur_col = (col <= screen->max_col ? col : screen->max_col); + maxr = screen->max_row; + if (flags & ORIGIN) { + row += screen->top_marg; + maxr = screen->bot_marg; + } + row = (row < 0 ? 0 : row); + screen->cur_row = (row <= maxr ? row : maxr); + screen->do_wrap = 0; + _CheckSelection(screen); } /* * moves the cursor left n, no wrap around */ void -CursorBack(register TScreen *screen, int n) +CursorBack(register TScreen * screen, int n) { - register int i, j, k, rev; + register int i, j, k, rev; - if((rev = (term->flags & (REVERSEWRAP | WRAPAROUND)) == - (REVERSEWRAP | WRAPAROUND)) != 0 - && screen->do_wrap) - n--; - if ((screen->cur_col -= n) < 0) { - if(rev) { - if((i = (j = screen->max_col + 1) * screen->cur_row + - screen->cur_col) < 0) { - k = j * (screen->max_row + 1); - i += ((-i) / k + 1) * k; - } - screen->cur_row = i / j; - screen->cur_col = i % j; - } else - screen->cur_col = 0; - } - screen->do_wrap = 0; - _CheckSelection(screen); + if ((rev = (term->flags & (REVERSEWRAP | WRAPAROUND)) == + (REVERSEWRAP | WRAPAROUND)) != 0 + && screen->do_wrap) + n--; + if ((screen->cur_col -= n) < 0) { + if (rev) { + if ((i = ((j = screen->max_col + 1) + * screen->cur_row) + screen->cur_col) < 0) { + k = j * (screen->max_row + 1); + i += ((-i) / k + 1) * k; + } + screen->cur_row = i / j; + screen->cur_col = i % j; + } else + screen->cur_col = 0; + } + screen->do_wrap = 0; + _CheckSelection(screen); } /* * moves the cursor forward n, no wraparound */ void -CursorForward(register TScreen *screen, int n) +CursorForward(register TScreen * screen, int n) { - screen->cur_col += n; - if (screen->cur_col > CurMaxCol(screen, screen->cur_row)) - screen->cur_col = CurMaxCol(screen, screen->cur_row); - screen->do_wrap = 0; - _CheckSelection(screen); + screen->cur_col += n; + if (screen->cur_col > CurMaxCol(screen, screen->cur_row)) + screen->cur_col = CurMaxCol(screen, screen->cur_row); + screen->do_wrap = 0; + _CheckSelection(screen); } /* @@ -121,18 +149,18 @@ * Won't pass bottom margin or bottom of screen. */ void -CursorDown(register TScreen *screen, int n) +CursorDown(register TScreen * screen, int n) { - register int max; + register int max; - max = (screen->cur_row > screen->bot_marg ? - screen->max_row : screen->bot_marg); + max = (screen->cur_row > screen->bot_marg ? + screen->max_row : screen->bot_marg); - screen->cur_row += n; - if (screen->cur_row > max) - screen->cur_row = max; - screen->do_wrap = 0; - _CheckSelection(screen); + screen->cur_row += n; + if (screen->cur_row > max) + screen->cur_row = max; + screen->do_wrap = 0; + _CheckSelection(screen); } /* @@ -140,18 +168,18 @@ * Won't pass top margin or top of screen. */ void -CursorUp(register TScreen *screen, int n) +CursorUp(register TScreen * screen, int n) { - register int min; + register int min; - min = (screen->cur_row < screen->top_marg ? - 0 : screen->top_marg); + min = (screen->cur_row < screen->top_marg ? + 0 : screen->top_marg); - screen->cur_row -= n; - if (screen->cur_row < min) - screen->cur_row = min; - screen->do_wrap = 0; - _CheckSelection(screen); + screen->cur_row -= n; + if (screen->cur_row < min) + screen->cur_row = min; + screen->do_wrap = 0; + _CheckSelection(screen); } /* @@ -159,22 +187,22 @@ * Won't leave scrolling region. No carriage return. */ void -xtermIndex(register TScreen *screen, register int amount) +xtermIndex(register TScreen * screen, register int amount) { - register int j; + register int j; - /* - * indexing when below scrolling region is cursor down. - * if cursor high enough, no scrolling necessary. - */ - if (screen->cur_row > screen->bot_marg - || screen->cur_row + amount <= screen->bot_marg) { - CursorDown(screen, amount); - return; - } + /* + * indexing when below scrolling region is cursor down. + * if cursor high enough, no scrolling necessary. + */ + if (screen->cur_row > screen->bot_marg + || screen->cur_row + amount <= screen->bot_marg) { + CursorDown(screen, amount); + return; + } - CursorDown(screen, j = screen->bot_marg - screen->cur_row); - xtermScroll(screen, amount - j); + CursorDown(screen, j = screen->bot_marg - screen->cur_row); + xtermScroll(screen, amount - j); } /* @@ -182,20 +210,20 @@ * Won't leave scrolling region. No carriage return. */ void -RevIndex(register TScreen *screen, register int amount) +RevIndex(register TScreen * screen, register int amount) { - /* - * reverse indexing when above scrolling region is cursor up. - * if cursor low enough, no reverse indexing needed - */ - if (screen->cur_row < screen->top_marg - || screen->cur_row-amount >= screen->top_marg) { - CursorUp(screen, amount); - return; - } + /* + * reverse indexing when above scrolling region is cursor up. + * if cursor low enough, no reverse indexing needed + */ + if (screen->cur_row < screen->top_marg + || screen->cur_row - amount >= screen->top_marg) { + CursorUp(screen, amount); + return; + } - RevScroll(screen, amount - (screen->cur_row - screen->top_marg)); - CursorUp(screen, screen->cur_row - screen->top_marg); + RevScroll(screen, amount - (screen->cur_row - screen->top_marg)); + CursorUp(screen, screen->cur_row - screen->top_marg); } /* @@ -203,11 +231,11 @@ * (Note: xterm doesn't implement SLH, SLL which would affect use of this) */ void -CarriageReturn(register TScreen *screen) +CarriageReturn(register TScreen * screen) { - screen->cur_col = 0; - screen->do_wrap = 0; - _CheckSelection(screen); + screen->cur_col = 0; + screen->do_wrap = 0; + _CheckSelection(screen); } /* @@ -216,21 +244,21 @@ void CursorSave(register XtermWidget tw) { - register TScreen *screen = &tw->screen; - register SavedCursor *sc = &screen->sc[screen->alternate != False]; + register TScreen *screen = &tw->screen; + register SavedCursor *sc = &screen->sc[screen->alternate != False]; - sc->saved = True; - sc->row = screen->cur_row; - sc->col = screen->cur_col; - sc->flags = tw->flags; - sc->curgl = screen->curgl; - sc->curgr = screen->curgr; + sc->saved = True; + sc->row = screen->cur_row; + sc->col = screen->cur_col; + sc->flags = tw->flags; + sc->curgl = screen->curgl; + sc->curgr = screen->curgr; #if OPT_ISO_COLORS - sc->cur_foreground = tw->cur_foreground; - sc->cur_background = tw->cur_background; - sc->sgr_foreground = tw->sgr_foreground; + sc->cur_foreground = tw->cur_foreground; + sc->cur_background = tw->cur_background; + sc->sgr_foreground = tw->sgr_foreground; #endif - memmove( sc->gsets, screen->gsets, sizeof(screen->gsets)); + memmove(sc->gsets, screen->gsets, sizeof(screen->gsets)); } /* @@ -245,32 +273,32 @@ void CursorRestore(register XtermWidget tw) { - register TScreen *screen = &tw->screen; - register SavedCursor *sc = &screen->sc[screen->alternate != False]; + register TScreen *screen = &tw->screen; + register SavedCursor *sc = &screen->sc[screen->alternate != False]; - /* Restore the character sets, unless we never did a save-cursor op. - * In that case, we'll reset the character sets. - */ - if (sc->saved) { - memmove( screen->gsets, sc->gsets, sizeof(screen->gsets)); - screen->curgl = sc->curgl; - screen->curgr = sc->curgr; - } else { - resetCharsets(screen); - } - - tw->flags &= ~DECSC_FLAGS; - tw->flags |= sc->flags & DECSC_FLAGS; - CursorSet (screen, - (tw->flags & ORIGIN) - ? sc->row - screen->top_marg - : sc->row, - sc->col, tw->flags); + /* Restore the character sets, unless we never did a save-cursor op. + * In that case, we'll reset the character sets. + */ + if (sc->saved) { + memmove(screen->gsets, sc->gsets, sizeof(screen->gsets)); + screen->curgl = sc->curgl; + screen->curgr = sc->curgr; + } else { + resetCharsets(screen); + } + + tw->flags &= ~DECSC_FLAGS; + tw->flags |= sc->flags & DECSC_FLAGS; + CursorSet(screen, + ((tw->flags & ORIGIN) + ? sc->row - screen->top_marg + : sc->row), + sc->col, tw->flags); #if OPT_ISO_COLORS - tw->sgr_foreground = sc->sgr_foreground; - SGR_Foreground(tw->flags & FG_COLOR ? sc->cur_foreground : -1); - SGR_Background(tw->flags & BG_COLOR ? sc->cur_background : -1); + tw->sgr_foreground = sc->sgr_foreground; + SGR_Foreground(tw->flags & FG_COLOR ? sc->cur_foreground : -1); + SGR_Background(tw->flags & BG_COLOR ? sc->cur_background : -1); #endif } @@ -278,20 +306,20 @@ * Move the cursor to the first column of the n-th next line. */ void -CursorNextLine(TScreen *screen, int count) +CursorNextLine(TScreen * screen, int count) { - CursorDown(screen, count < 1 ? 1 : count); - CarriageReturn(screen); - do_xevents(); + CursorDown(screen, count < 1 ? 1 : count); + CarriageReturn(screen); + do_xevents(); } /* * Move the cursor to the first column of the n-th previous line. */ void -CursorPrevLine(TScreen *screen, int count) +CursorPrevLine(TScreen * screen, int count) { - CursorUp(screen, count < 1 ? 1 : count); - CarriageReturn(screen); - do_xevents(); + CursorUp(screen, count < 1 ? 1 : count); + CarriageReturn(screen); + do_xevents(); } Index: xc/programs/xterm/data.c diff -u xc/programs/xterm/data.c:3.21 xc/programs/xterm/data.c:3.25 --- xc/programs/xterm/data.c:3.21 Wed Jan 17 18:46:36 2001 +++ xc/programs/xterm/data.c Sun Dec 8 17:31:48 2002 @@ -2,9 +2,37 @@ * $Xorg: data.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/data.c,v 3.21 2001/01/17 23:46:36 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/data.c,v 3.25 2002/12/08 22:31:48 dickey Exp $ */ /* + * Copyright 2002 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved @@ -46,31 +74,47 @@ jmp_buf Tekend; #endif +char *ProgramName; + +Arg ourTopLevelShellArgs[] = +{ + {XtNallowShellResize, (XtArgVal) TRUE}, + {XtNinput, (XtArgVal) TRUE}, +}; +int number_ourTopLevelShellArgs = 2; + +Bool waiting_for_initial_map; + +Atom wm_delete_window; /* for ICCCM delete window */ + +XTERM_RESOURCE resource; + PtyData VTbuffer; jmp_buf VTend; #ifdef DEBUG -int debug = 0; /* true causes error messages to be displayed */ -#endif /* DEBUG */ +int debug = 0; /* true causes error messages to be displayed */ +#endif /* DEBUG */ XtAppContext app_con; -XtermWidget term; /* master data structure for client */ -char *xterm_name; /* argv[0] */ +XtermWidget term; /* master data structure for client */ +char *xterm_name; /* argv[0] */ int hold_screen; #if OPT_ZICONBEEP -int zIconBeep; /* non-zero means beep; see charproc.c for details -IAN! */ -Boolean zIconBeep_flagged; /* True if the icon name has been changed */ +int zIconBeep; /* non-zero means beep; see charproc.c for details -IAN! */ +Boolean zIconBeep_flagged; /* True if the icon name has been changed */ #endif /* OPT_ZICONBEEP */ #if OPT_SAME_NAME -Boolean sameName; /* Don't change the title or icon name if it - is the same. This prevents flicker on the screen at - the cost of an extra request to the server */ +Boolean sameName; /* Don't change the title or icon name if it + is the same. This prevents flicker on the + screen at the cost of an extra request to + the server */ #endif -int am_slave = -1; /* set to file-descriptor if we're a slave process */ +int am_slave = -1; /* set to file-descriptor if we're a slave process */ int max_plus1; #ifdef VMS int Select_mask; @@ -83,48 +127,45 @@ #endif /* VMS */ char *ptydev; char *ttydev; -#ifdef ALLOWLOGGING -char log_def_name[] = "XtermLog.XXXXXX"; -#endif int waitingForTrackInfo = 0; EventMode eventMode = NORMAL; #if OPT_WIDE_CHARS -char defaultUTF8[2] = { '0', 0 }; -const unsigned short dec2ucs[32] = { - 0x25ae /* black vertical rectangle */, - 0x25c6 /* black diamond */, - 0x2592 /* medium shade */, - 0x2409 /* symbol for horizontal tabulation */, - 0x240c /* symbol for form feed */, - 0x240d /* symbol for carriage return */, - 0x240a /* symbol for line feed */, - 0x00b0 /* degree sign */, - 0x00b1 /* plus-minus sign */, - 0x2424 /* symbol for newline */, - 0x240b /* symbol for vertical tabulation */, - 0x2518 /* box drawings light up and left */, - 0x2510 /* box drawings light down and left */, - 0x250c /* box drawings light down and right */, - 0x2514 /* box drawings light up and right */, - 0x253c /* box drawings light vertical and horizontal */, - UCS_REPL /* replacement character */, - UCS_REPL /* replacement character */, - 0x2500 /* box drawings light horizontal */, - UCS_REPL /* replacement character */, - UCS_REPL /* replacement character */, - 0x251c /* box drawings light vertical and right */, - 0x2524 /* box drawings light vertical and left */, - 0x2534 /* box drawings light up and horizontal */, - 0x252c /* box drawings light down and horizontal */, - 0x2502 /* box drawings light vertical */, - 0x2264 /* less-than or equal to */, - 0x2265 /* greater-than or equal to */, - 0x03c0 /* greek small letter pi */, - 0x2260 /* not equal to */, - 0x00a3 /* pound sign */, - 0x00b7 /* middle dot */ +const unsigned short dec2ucs[32] = +{ + 0x25ae, /* black vertical rectangle */ + 0x25c6, /* black diamond */ + 0x2592, /* medium shade */ + 0x2409, /* symbol for horizontal tabulation */ + 0x240c, /* symbol for form feed */ + 0x240d, /* symbol for carriage return */ + 0x240a, /* symbol for line feed */ + 0x00b0, /* degree sign */ + 0x00b1, /* plus-minus sign */ + 0x2424, /* symbol for newline */ + 0x240b, /* symbol for vertical tabulation */ + 0x2518, /* box drawings light up and left */ + 0x2510, /* box drawings light down and left */ + 0x250c, /* box drawings light down and right */ + 0x2514, /* box drawings light up and right */ + 0x253c, /* box drawings light vertical and horizontal */ + UCS_REPL, /* replacement character */ + UCS_REPL, /* replacement character */ + 0x2500, /* box drawings light horizontal */ + UCS_REPL, /* replacement character */ + UCS_REPL, /* replacement character */ + 0x251c, /* box drawings light vertical and right */ + 0x2524, /* box drawings light vertical and left */ + 0x2534, /* box drawings light up and horizontal */ + 0x252c, /* box drawings light down and horizontal */ + 0x2502, /* box drawings light vertical */ + 0x2264, /* less-than or equal to */ + 0x2265, /* greater-than or equal to */ + 0x03c0, /* greek small letter pi */ + 0x2260, /* not equal to */ + 0x00a3, /* pound sign */ + 0x00b7 /* middle dot */ }; #endif Index: xc/programs/xterm/data.h diff -u xc/programs/xterm/data.h:3.25 xc/programs/xterm/data.h:3.28 --- xc/programs/xterm/data.h:3.25 Wed Jan 17 18:46:36 2001 +++ xc/programs/xterm/data.h Sun Dec 8 17:31:48 2002 @@ -2,9 +2,37 @@ * $Xorg: data.h,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/data.h,v 3.25 2001/01/17 23:46:36 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/data.h,v 3.28 2002/12/08 22:31:48 dickey Exp $ */ /* + * Copyright 2002 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved @@ -45,8 +73,8 @@ extern int tt_new_output; #define VMS_TERM_BUFFER_SIZE 500 struct q_head { - int flink; - int blink; + int flink; + int blink; }; extern struct q_head read_queue; #endif @@ -65,9 +93,6 @@ extern jmp_buf Tekend; #endif -#ifdef ALLOWLOGGING -extern char log_def_name[]; -#endif extern char *ptydev; extern char *ttydev; extern char *xterm_name; @@ -89,7 +114,7 @@ #ifdef DEBUG extern int debug; -#endif /* DEBUG */ +#endif /* DEBUG */ #ifdef VMS extern int Select_mask; @@ -122,8 +147,53 @@ #endif #if OPT_WIDE_CHARS -extern char defaultUTF8[]; extern const unsigned short dec2ucs[32]; #endif + +extern char *ProgramName; +extern Arg ourTopLevelShellArgs[]; +extern int number_ourTopLevelShellArgs; +extern Bool waiting_for_initial_map; +extern Atom wm_delete_window; + +typedef struct { + char *xterm_name; + char *icon_geometry; + char *title; + char *icon_name; + char *term_name; + char *tty_modes; + Boolean hold_screen; /* true if we keep window open */ + Boolean utmpInhibit; + Boolean messages; + Boolean sunFunctionKeys; /* %%% should be widget resource? */ +#if OPT_SUNPC_KBD + Boolean sunKeyboard; +#endif +#if OPT_HP_FUNC_KEYS + Boolean hpFunctionKeys; +#endif +#if OPT_INITIAL_ERASE + Boolean ptyInitialErase; /* if true, use pty's sense of erase char */ + Boolean backarrow_is_erase; /* override backspace/delete */ +#endif + Boolean wait_for_map; + Boolean useInsertMode; +#if OPT_ZICONBEEP + int zIconBeep; /* beep level when output while iconified */ +#endif +#if OPT_SAME_NAME + Boolean sameName; /* Don't change the title or icon name if it is + * the same. This prevents flicker on the + * screen at the cost of an extra request to + * the server. + */ +#endif +#if OPT_SESSION_MGT + Boolean sessionMgt; +#endif +} XTERM_RESOURCE; + +extern XTERM_RESOURCE resource; #endif /* included_data_h */ Index: xc/programs/xterm/doublechr.c diff -u xc/programs/xterm/doublechr.c:3.10 xc/programs/xterm/doublechr.c:3.11 --- xc/programs/xterm/doublechr.c:3.10 Mon Jun 12 22:28:39 2000 +++ xc/programs/xterm/doublechr.c Sun Apr 28 15:04:20 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/doublechr.c,v 3.10 2000/06/13 02:28:39 dawes Exp $ + * $XFree86: xc/programs/xterm/doublechr.c,v 3.11 2002/04/28 19:04:20 dickey Exp $ */ /************************************************************ @@ -49,50 +49,50 @@ static void repaint_line(unsigned newChrSet) { - register TScreen *screen = &term->screen; - int curcol = screen->cur_col; - int currow = screen->cur_row; - int len = screen->max_col + 1; - int width = len; - unsigned oldChrSet = SCRN_BUF_CSETS(screen, currow)[0]; - - /* - * Ignore repetition. - */ - if (oldChrSet == newChrSet) - return; - - TRACE(("repaint_line(%2d,%2d) (%d)\n", currow, screen->cur_col, newChrSet)); - HideCursor(); - - /* If switching from single-width, keep the cursor in the visible part - * of the line. - */ - if (CSET_DOUBLE(newChrSet)) { - width /= 2; - if (curcol > width) - curcol = width; - } - - /* - * ScrnRefresh won't paint blanks for us if we're switching between a - * single-size and double-size font. - */ - if (CSET_DOUBLE(oldChrSet) != CSET_DOUBLE(newChrSet)) { - ClearCurBackground( - screen, - CursorY (screen, currow), - CurCursorX (screen, currow, 0), - FontHeight(screen), - len * CurFontWidth(screen,currow)); - } - - /* FIXME: do VT220 softchars allow double-sizes? */ - memset(SCRN_BUF_CSETS(screen, currow), newChrSet, len); - - screen->cur_col = 0; - ScrnRefresh (screen, currow, 0, 1, len, True); - screen->cur_col = curcol; + register TScreen *screen = &term->screen; + int curcol = screen->cur_col; + int currow = screen->cur_row; + int len = screen->max_col + 1; + int width = len; + unsigned oldChrSet = SCRN_BUF_CSETS(screen, currow)[0]; + + /* + * Ignore repetition. + */ + if (oldChrSet == newChrSet) + return; + + TRACE(("repaint_line(%2d,%2d) (%d)\n", currow, screen->cur_col, newChrSet)); + HideCursor(); + + /* If switching from single-width, keep the cursor in the visible part + * of the line. + */ + if (CSET_DOUBLE(newChrSet)) { + width /= 2; + if (curcol > width) + curcol = width; + } + + /* + * ScrnRefresh won't paint blanks for us if we're switching between a + * single-size and double-size font. + */ + if (CSET_DOUBLE(oldChrSet) != CSET_DOUBLE(newChrSet)) { + ClearCurBackground( + screen, + CursorY(screen, currow), + CurCursorX(screen, currow, 0), + FontHeight(screen), + len * CurFontWidth(screen, currow)); + } + + /* FIXME: do VT220 softchars allow double-sizes? */ + memset(SCRN_BUF_CSETS(screen, currow), newChrSet, len); + + screen->cur_col = 0; + ScrnRefresh(screen, currow, 0, 1, len, True); + screen->cur_col = curcol; } #endif @@ -104,7 +104,7 @@ xterm_DECDHL(Bool top) { #if OPT_DEC_CHRSET - repaint_line(top ? CSET_DHL_TOP : CSET_DHL_BOT); + repaint_line(top ? CSET_DHL_TOP : CSET_DHL_BOT); #endif } @@ -115,7 +115,7 @@ xterm_DECSWL(void) { #if OPT_DEC_CHRSET - repaint_line(CSET_SWL); + repaint_line(CSET_SWL); #endif } @@ -126,79 +126,78 @@ xterm_DECDWL(void) { #if OPT_DEC_CHRSET - repaint_line(CSET_DWL); + repaint_line(CSET_DWL); #endif } - #if OPT_DEC_CHRSET static void -discard_font(TScreen *screen, XTermFonts *data) +discard_font(TScreen * screen, XTermFonts * data) { - TRACE(("discard_font chrset=%d %s\n", data->chrset, - (data->fn != 0) ? data->fn : "<no-name>")); + TRACE(("discard_font chrset=%d %s\n", data->chrset, + (data->fn != 0) ? data->fn : "<no-name>")); - data->chrset = 0; - data->flags = 0; - if (data->gc != 0) { - XFreeGC(screen->display, data->gc); - data->gc = 0; - } - if (data->fn != 0) { - free(data->fn); - data->fn = 0; - } - if (data->fs != 0) { - XFreeFont(screen->display, data->fs); - data->fs = 0; - } + data->chrset = 0; + data->flags = 0; + if (data->gc != 0) { + XFreeGC(screen->display, data->gc); + data->gc = 0; + } + if (data->fn != 0) { + free(data->fn); + data->fn = 0; + } + if (data->fs != 0) { + XFreeFont(screen->display, data->fs); + data->fs = 0; + } } int xterm_Double_index(unsigned chrset, unsigned flags) { - int n; - TScreen *screen = &term->screen; - XTermFonts *data = screen->double_fonts; - - flags &= BOLD; - TRACE(("xterm_Double_index chrset=%#x, flags=%#x\n", chrset, flags)); - - for (n = 0; n < screen->fonts_used; n++) { - if (data[n].chrset == chrset - && data[n].flags == flags) { - if (n != 0) { - XTermFonts save; - TRACE(("...xterm_Double_index -> %d (OLD:%d)\n", n, screen->fonts_used)); - save = data[n]; - while (n > 0) { - data[n] = data[n-1]; - n--; - } - data[n] = save; - } - return n; + int n; + TScreen *screen = &term->screen; + XTermFonts *data = screen->double_fonts; + + flags &= BOLD; + TRACE(("xterm_Double_index chrset=%#x, flags=%#x\n", chrset, flags)); + + for (n = 0; n < screen->fonts_used; n++) { + if (data[n].chrset == chrset + && data[n].flags == flags) { + if (n != 0) { + XTermFonts save; + TRACE(("...xterm_Double_index -> %d (OLD:%d)\n", n, screen->fonts_used)); + save = data[n]; + while (n > 0) { + data[n] = data[n - 1]; + n--; } - } - - /* Not, found, push back existing fonts and create a new entry */ - if (screen->fonts_used >= screen->cache_doublesize) { - TRACE(("...xterm_Double_index: discard oldest\n")); - discard_font(screen, &(data[screen->fonts_used - 1])); - } else { - screen->fonts_used += 1; - } - for (n = screen->fonts_used; n > 0; n--) - data[n] = data[n-1]; - - TRACE(("...xterm_Double_index -> (NEW:%d)\n", screen->fonts_used)); - - data[0].chrset = chrset; - data[0].flags = flags; - data[0].fn = 0; - data[0].fs = 0; - data[0].gc = 0; - return 0; + data[n] = save; + } + return n; + } + } + + /* Not, found, push back existing fonts and create a new entry */ + if (screen->fonts_used >= screen->cache_doublesize) { + TRACE(("...xterm_Double_index: discard oldest\n")); + discard_font(screen, &(data[screen->fonts_used - 1])); + } else { + screen->fonts_used += 1; + } + for (n = screen->fonts_used; n > 0; n--) + data[n] = data[n - 1]; + + TRACE(("...xterm_Double_index -> (NEW:%d)\n", screen->fonts_used)); + + data[0].chrset = chrset; + data[0].flags = flags; + data[0].fn = 0; + data[0].fs = 0; + data[0].gc = 0; + return 0; } /* @@ -208,44 +207,44 @@ GC xterm_DoubleGC(unsigned chrset, unsigned flags, GC old_gc) { - XGCValues gcv; - register TScreen *screen = &term->screen; - unsigned long mask = (GCForeground | GCBackground | GCFont); - int n; - char *name; - XTermFonts *data; - - if ((name = xtermSpecialFont(flags, chrset)) == 0) - return 0; - - n = xterm_Double_index(chrset, flags); - data = &(screen->double_fonts[n]); - if (data->fn != 0) { - if (!strcmp(data->fn, name)) { - if (data->fs != 0) { - XCopyGC(screen->display, old_gc, ~GCFont, data->gc); - return data->gc; - } - } - discard_font(screen, data); - data->chrset = chrset; - data->flags = flags & BOLD; - } - data->fn = name; + XGCValues gcv; + register TScreen *screen = &term->screen; + unsigned long mask = (GCForeground | GCBackground | GCFont); + int n; + char *name; + XTermFonts *data; - TRACE(("xterm_DoubleGC %s %d: %s\n", flags&BOLD ? "BOLD" : "NORM", n, name)); + if ((name = xtermSpecialFont(flags, chrset)) == 0) + return 0; + + n = xterm_Double_index(chrset, flags); + data = &(screen->double_fonts[n]); + if (data->fn != 0) { + if (!strcmp(data->fn, name)) { + if (data->fs != 0) { + XCopyGC(screen->display, old_gc, ~GCFont, data->gc); + return data->gc; + } + } + discard_font(screen, data); + data->chrset = chrset; + data->flags = flags & BOLD; + } + data->fn = name; + + TRACE(("xterm_DoubleGC %s %d: %s\n", flags & BOLD ? "BOLD" : "NORM", n, name)); + + if ((data->fs = XLoadQueryFont(screen->display, name)) == 0) + return 0; + TRACE(("-> OK\n")); - if ((data->fs = XLoadQueryFont (screen->display, name)) == 0) - return 0; - TRACE(("-> OK\n")); - - gcv.graphics_exposures = TRUE; /* default */ - gcv.font = data->fs->fid; - gcv.foreground = screen->foreground; - gcv.background = term->core.background_pixel; - - data->gc = XCreateGC (screen->display, VWindow(screen), mask, &gcv); - XCopyGC(screen->display, old_gc, ~GCFont, data->gc); - return data->gc; + gcv.graphics_exposures = TRUE; /* default */ + gcv.font = data->fs->fid; + gcv.foreground = screen->foreground; + gcv.background = term->core.background_pixel; + + data->gc = XCreateGC(screen->display, VWindow(screen), mask, &gcv); + XCopyGC(screen->display, old_gc, ~GCFont, data->gc); + return data->gc; } #endif Index: xc/programs/xterm/error.h diff -u xc/programs/xterm/error.h:1.6 xc/programs/xterm/error.h:1.8 --- xc/programs/xterm/error.h:1.6 Wed Jan 17 18:46:36 2001 +++ xc/programs/xterm/error.h Fri Dec 27 16:05:22 2002 @@ -3,7 +3,7 @@ */ -/* $XFree86: xc/programs/xterm/error.h,v 1.6 2001/01/17 23:46:36 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/error.h,v 1.8 2002/12/27 21:05:22 dickey Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * @@ -28,84 +28,63 @@ */ /* @(#)error.h X10/6.6 11/6/86 */ + /* main.c */ -#define ERROR_KMALLOC 10 /* main: malloc() failed for keyboardtype */ #define ERROR_FIONBIO 11 /* main: ioctl() failed on FIONBIO */ - - +#define ERROR_F_GETFL 12 /* main: ioctl() failed on F_GETFL */ +#define ERROR_F_SETFL 13 /* main: ioctl() failed on F_SETFL */ #define ERROR_OPDEVTTY 14 /* spawn: open() failed on /dev/tty */ #define ERROR_TIOCGETP 15 /* spawn: ioctl() failed on TIOCGETP */ -#define ERROR_TIOCGETC 16 /* spawn: ioctl() failed on TIOCGETC */ -#define ERROR_TIOCGETD 17 /* spawn: ioctl() failed on TIOCGETD */ -#define ERROR_TIOCGLTC 18 /* spawn: ioctl() failed on TIOCGLTC */ -#define ERROR_TIOCLGET 19 /* spawn: ioctl() failed on TIOCLGET */ -#define ERROR_TIOCCONS 20 /* spawn: ioctl() failed on TIOCCONS */ -#define ERROR_OPDEVTTY2 21 /* spawn: second open() failed on /dev/tty */ -#define ERROR_NOTTY 22 /* spawn: ioctl() failed on TIOCNOTTY */ +#define ERROR_PTSNAME 17 /* spawn: ptsname() failed */ +#define ERROR_OPPTSNAME 18 /* spawn: open() failed on ptsname */ +#define ERROR_PTEM 19 /* spawn: ioctl() failed on I_PUSH/"ptem" */ +#define ERROR_CONSEM 20 /* spawn: ioctl() failed on I_PUSH/"consem" */ +#define ERROR_LDTERM 21 /* spawn: ioctl() failed on I_PUSH/"ldterm" */ +#define ERROR_TTCOMPAT 22 /* spawn: ioctl() failed on I_PUSH/"ttcompat" */ #define ERROR_TIOCSETP 23 /* spawn: ioctl() failed on TIOCSETP */ #define ERROR_TIOCSETC 24 /* spawn: ioctl() failed on TIOCSETC */ #define ERROR_TIOCSETD 25 /* spawn: ioctl() failed on TIOCSETD */ #define ERROR_TIOCSLTC 26 /* spawn: ioctl() failed on TIOCSLTC */ #define ERROR_TIOCLSET 27 /* spawn: ioctl() failed on TIOCLSET */ - +#define ERROR_INIGROUPS 28 /* spawn: initgroups() failed */ #define ERROR_FORK 29 /* spawn: fork() failed */ #define ERROR_EXEC 30 /* spawn: exec() failed */ -#define ERROR_OPDEVTTY3 31 /* spawn: third open() failed on /dev/tty */ #define ERROR_PTYS 32 /* get_pty: not enough ptys */ -#define ERROR_NOX 33 /* get_terminal: can't connect to server */ #define ERROR_PTY_EXEC 34 /* waiting for initial map */ - +#define ERROR_SETUID 35 /* spawn: setuid() failed */ #define ERROR_INIT 36 /* spawn: can't initialize window */ -#define ERROR_NOCO 37 /* resize: no `co' in termcap */ -#define ERROR_NOLI 38 /* resize: no `li' in termcap */ -#define ERROR_BORDER 39 /* get_terminal: can't make border tile */ -#define ERROR_BACK 40 /* get_terminal: can't make background tile */ -#define ERROR_NOX3 43 /* get_terminal: bad pty from display server */ -#define ERROR_TIOCKGET 44 /* spawn: ioctl() failed on TIOCKGET */ -#define ERROR_TIOCKGETC 45 /* spawn: ioctl() failed on TIOCKGETC */ #define ERROR_TIOCKSET 46 /* spawn: ioctl() failed on TIOCKSET */ #define ERROR_TIOCKSETC 47 /* spawn: ioctl() failed on TIOCKSETC */ #define ERROR_SPREALLOC 48 /* spawn: realloc of ttydev failed */ +#define ERROR_LUMALLOC 49 /* luit: command-line malloc failed */ + /* charproc.c */ #define ERROR_SELECT 50 /* in_put: select() failed */ #define ERROR_VINIT 54 /* VTInit: can't initialize window */ -#define ERROR_CNMALLOC1 55 /* Changename: malloc failed */ -#define ERROR_CNMALLOC2 56 /* Changename: malloc failed */ #define ERROR_KMMALLOC1 57 /* HandleKeymapChange: malloc failed */ -#define ERROR_VTREALLOC 58 /* VTParse: realloc failed */ + /* Tekproc.c */ #define ERROR_TSELECT 60 /* Tinput: select() failed */ #define ERROR_TINIT 64 /* TekInit: can't initialize window */ -#define ERROR_TBACK 65 /* TekBackground: can't make background */ + /* button.c */ #define ERROR_BMALLOC2 71 /* SaltTextAway: malloc() failed */ /* misc.c */ -#ifdef ALLOWLOGGING -#ifdef ALLOWLOGFILEEXEC #define ERROR_LOGEXEC 80 /* StartLog: exec() failed */ -#endif -#endif #define ERROR_XERROR 83 /* xerror: XError event */ #define ERROR_XIOERROR 84 /* xioerror: X I/O error */ -#define ERROR_WINNAME 85 /* get_terminal: malloc failed */ + /* screen.c */ #define ERROR_SCALLOC 90 /* Alloc: calloc() failed on base */ #define ERROR_SCALLOC2 91 /* Alloc: calloc() failed on rows */ #define ERROR_SREALLOC 92 /* ScreenResize: realloc() failed on alt base */ -#define ERROR_SREALLOC2 93 /* ScreenResize: realloc() failed on alt rows */ -#define ERROR_SREALLOC3 94 /* ScreenResize: realloc() failed on rows */ -#define ERROR_SREALLOC4 95 /* ScreenResize: realloc() failed on rows */ #define ERROR_RESIZE 96 /* ScreenResize: malloc() or realloc() failed */ -#define ERROR_RESIZE2 97 /* ScreenResize: malloc() or realloc() failed */ -#define ERROR_RESIZROW 98 /* ScreenResize: realloc() failed on alt char */ -#define ERROR_RESIZROW2 99 /* ScreenResize: realloc() failed on alt attr */ -#define ERROR_RESIZROW3 100 /* ScreenResize: realloc() failed on attr */ -#define ERROR_RESIZROW4 101 /* ScreenResize: realloc() failed on attr */ #define ERROR_SAVE_PTR 102 /* ScrnPointers: malloc/realloc() failed */ + /* scrollbar.c */ #define ERROR_SBRALLOC 110 /* ScrollBarOn: realloc() failed on base */ #define ERROR_SBRALLOC2 111 /* ScrollBarOn: realloc() failed on rows */ + /* util.c */ -#define ERROR_UBACK 120 /* ReverseVideo: can't make background */ #define ERROR_MMALLOC 121 /* my_memmove: malloc/realloc failed */ Index: xc/programs/xterm/fontutils.c diff -u xc/programs/xterm/fontutils.c:1.32 xc/programs/xterm/fontutils.c:1.36 --- xc/programs/xterm/fontutils.c:1.32 Mon Jun 18 15:09:26 2001 +++ xc/programs/xterm/fontutils.c Sun Dec 8 17:31:48 2002 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/fontutils.c,v 1.32 2001/06/18 19:09:26 dickey Exp $ + * $XFree86: xc/programs/xterm/fontutils.c,v 1.36 2002/12/08 22:31:48 dickey Exp $ */ /************************************************************ -Copyright 1998-2000 by Thomas E. Dickey +Copyright 1998-2001,2002 by Thomas E. Dickey All Rights Reserved @@ -91,24 +91,24 @@ * we need to make a well formed font name for it. */ typedef struct { - /* registry, foundry, family */ - char *beginning; - /* weight */ - char *weight; - /* slant */ - char *slant; - /* wideness */ - char *wideness; - /* add style */ - char *add_style; - int pixel_size; - char *point_size; - int res_x; - int res_y; - char *spacing; - int average_width; - /* charset registry, charset encoding */ - char *end; + /* registry, foundry, family */ + char *beginning; + /* weight */ + char *weight; + /* slant */ + char *slant; + /* wideness */ + char *wideness; + /* add style */ + char *add_style; + int pixel_size; + char *point_size; + int res_x; + int res_y; + char *spacing; + int average_width; + /* charset registry, charset encoding */ + char *end; } FontNameProperties; /* @@ -121,37 +121,36 @@ static char * n_fields(char **source, int start, int stop) { - int i; - char *str , *str1; + int i; + char *str, *str1; - /* - * find the start-1th dash - */ - for (i = start-1, str = *source; i; i--, str++) - if ((str = strchr(str, '-')) == 0) - return 0; - - /* - * find the stopth dash - */ - for (i = stop - start + 1, str1 = str; i; i--, str1++) - if ((str1 = strchr(str1, '-')) == 0) - return 0; + /* + * find the start-1th dash + */ + for (i = start - 1, str = *source; i; i--, str++) + if ((str = strchr(str, '-')) == 0) + return 0; + + /* + * find the stopth dash + */ + for (i = stop - start + 1, str1 = str; i; i--, str1++) + if ((str1 = strchr(str1, '-')) == 0) + return 0; + + /* + * put a \0 at the end of the fields + */ + *(str1 - 1) = '\0'; + + /* + * move source forward + */ + *source = str1; - /* - * put a \0 at the end of the fields - */ - *(str1 - 1) = '\0'; - - /* - * move source forward - */ - *source = str1; - - return str; + return str; } - /* * Gets the font properties from a given font structure. We use the FONT name * to find them out, since that seems easier. @@ -160,100 +159,100 @@ * or NULL on error. */ static FontNameProperties * -get_font_name_props(Display *dpy, XFontStruct *fs, char *result) +get_font_name_props(Display * dpy, XFontStruct * fs, char *result) { - static FontNameProperties props; - static char *last_name; + static FontNameProperties props; + static char *last_name; - register XFontProp *fp; - register int i; - Atom fontatom = XInternAtom (dpy, "FONT", False); - char *name; - char *str; + register XFontProp *fp; + register int i; + Atom fontatom = XInternAtom(dpy, "FONT", False); + char *name; + char *str; + + /* + * first get the full font name + */ + for (name = 0, i = 0, fp = fs->properties; + i < fs->n_properties; + i++, fp++) + if (fp->name == fontatom) + name = XGetAtomName(dpy, fp->card32); - /* - * first get the full font name - */ - for (name = 0, i = 0, fp = fs->properties; - i < fs->n_properties; - i++, fp++) - if (fp->name == fontatom) - name = XGetAtomName (dpy, fp->card32); + if (name == 0) + return 0; - if (name == 0) - return 0; + /* + * XGetAtomName allocates memory - don't leak + */ + if (last_name != 0) + XFree(last_name); + last_name = name; + if (result != 0) + strcpy(result, name); + + /* + * Now split it up into parts and put them in + * their places. Since we are using parts of + * the original string, we must not free the Atom Name + */ - /* - * XGetAtomName allocates memory - don't leak - */ - if (last_name != 0) - XFree(last_name); - last_name = name; - if (result != 0) - strcpy(result, name); + /* registry, foundry, family */ + if ((props.beginning = n_fields(&name, 1, 3)) == 0) + return 0; - /* - * Now split it up into parts and put them in - * their places. Since we are using parts of - * the original string, we must not free the Atom Name - */ - - /* registry, foundry, family */ - if ((props.beginning = n_fields(&name, 1, 3)) == 0) - return 0; - - /* weight is the next */ - if ((props.weight = n_fields(&name, 1, 1)) == 0) - return 0; - - /* slant */ - if ((props.slant = n_fields(&name, 1, 1)) == 0) - return 0; - - /* width */ - if ((props.wideness = n_fields(&name, 1, 1)) == 0) - return 0; - - /* add style */ - if ((props.add_style = n_fields(&name, 1, 1)) == 0) - return 0; - - /* pixel size */ - if ((str = n_fields(&name, 1, 1)) == 0) - return 0; - if ((props.pixel_size = atoi(str)) == 0) - return 0; - - /* point size */ - if ((props.point_size = n_fields(&name, 1, 1)) == 0) - return 0; - - /* res_x */ - if ((str = n_fields(&name, 1, 1)) == 0) - return 0; - if ((props.res_x = atoi(str)) == 0) - return 0; - - /* res_y */ - if ((str = n_fields(&name, 1, 1)) == 0) - return 0; - if ((props.res_y = atoi(str)) == 0) - return 0; - - /* spacing */ - if ((props.spacing = n_fields(&name, 1, 1)) == 0) - return 0; - - /* average width */ - if ((str = n_fields(&name, 1, 1)) == 0) - return 0; - if ((props.average_width = atoi(str)) == 0) - return 0; + /* weight is the next */ + if ((props.weight = n_fields(&name, 1, 1)) == 0) + return 0; + + /* slant */ + if ((props.slant = n_fields(&name, 1, 1)) == 0) + return 0; + + /* width */ + if ((props.wideness = n_fields(&name, 1, 1)) == 0) + return 0; + + /* add style */ + if ((props.add_style = n_fields(&name, 1, 1)) == 0) + return 0; + + /* pixel size */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.pixel_size = atoi(str)) == 0) + return 0; + + /* point size */ + if ((props.point_size = n_fields(&name, 1, 1)) == 0) + return 0; + + /* res_x */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.res_x = atoi(str)) == 0) + return 0; + + /* res_y */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.res_y = atoi(str)) == 0) + return 0; + + /* spacing */ + if ((props.spacing = n_fields(&name, 1, 1)) == 0) + return 0; + + /* average width */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.average_width = atoi(str)) == 0) + return 0; - /* the rest: charset registry and charset encoding */ - props.end = name; + /* the rest: charset registry and charset encoding */ + props.end = name; - return &props; + return &props; } /* @@ -262,54 +261,54 @@ * comes from a static variable, so be careful if you reuse it. */ static char * -bold_font_name(FontNameProperties *props) +bold_font_name(FontNameProperties * props) { - static char ret[MAX_FONTNAME]; + static char ret[MAX_FONTNAME]; - /* - * Put together something in the form - * "<beginning>-bold-<middle>-<pixel_size>-<point_size>-<res_x>-<res_y>"\ - * "-<spacing>-*-<end>" - */ - sprintf(ret, "%s-bold-%s-%s-%s-%d-%s-%d-%d-%s-*-%s", - props->beginning, - props->slant, - props->wideness, - props->add_style, - props->pixel_size, - props->point_size, - props->res_x, - props->res_y, - props->spacing, - props->end); - return ret; + /* + * Put together something in the form + * "<beginning>-bold-<middle>-<pixel_size>-<point_size>-<res_x>-<res_y>"\ + * "-<spacing>-*-<end>" + */ + sprintf(ret, "%s-bold-%s-%s-%s-%d-%s-%d-%d-%s-*-%s", + props->beginning, + props->slant, + props->wideness, + props->add_style, + props->pixel_size, + props->point_size, + props->res_x, + props->res_y, + props->spacing, + props->end); + return ret; } #if OPT_WIDE_CHARS /* like bold_font_name, but doubles AVERAGE_WIDTH */ static char * -wide_font_name(FontNameProperties *props) +wide_font_name(FontNameProperties * props) { - static char ret[MAX_FONTNAME]; + static char ret[MAX_FONTNAME]; - /* - * Put together something in the form - * "<beginning>-bold-<middle>-<pixel_size>-<point_size>-<res_x>-<res_y>"\ - * "-<spacing>-*-<end>" - */ - sprintf(ret, "%s-%s-%s-*-*-%d-%s-%d-%d-%s-%i-%s", - props->beginning, - props->weight, - props->slant, - props->pixel_size, - props->point_size, - props->res_x, - props->res_y, - props->spacing, - props->average_width * 2, - props->end); + /* + * Put together something in the form + * "<beginning>-bold-<middle>-<pixel_size>-<point_size>-<res_x>-<res_y>"\ + * "-<spacing>-*-<end>" + */ + sprintf(ret, "%s-%s-%s-*-*-%d-%s-%d-%d-%s-%i-%s", + props->beginning, + props->weight, + props->slant, + props->pixel_size, + props->point_size, + props->res_x, + props->res_y, + props->spacing, + props->average_width * 2, + props->end); - return ret; + return ret; } #endif /* OPT_WIDE_CHARS */ @@ -325,74 +324,73 @@ xtermSpecialFont(unsigned atts, unsigned chrset) { #if OPT_TRACE - static char old_spacing[80]; - static FontNameProperties old_props; + static char old_spacing[80]; + static FontNameProperties old_props; #endif - TScreen *screen = &term->screen; - FontNameProperties *props; - char tmp[MAX_FONTNAME]; - char *ret; - char *width; - int pixel_size; - int res_x; - int res_y; - - props = get_font_name_props(screen->display, screen->fnt_norm, (char *)0); - if (props == 0) - return 0; - - pixel_size = props->pixel_size; - res_x = props->res_x; - res_y = props->res_y; - if (atts & BOLD) - width = "bold"; - else - width = props->weight; - - if (CSET_DOUBLE(chrset)) - res_x *= 2; - - if (chrset == CSET_DHL_TOP - || chrset == CSET_DHL_BOT) { - res_y *= 2; - pixel_size *= 2; - } + TScreen *screen = &term->screen; + FontNameProperties *props; + char tmp[MAX_FONTNAME]; + char *ret; + char *width; + int pixel_size; + int res_x; + int res_y; + + props = get_font_name_props(screen->display, screen->fnt_norm, (char *) 0); + if (props == 0) + return 0; + + pixel_size = props->pixel_size; + res_x = props->res_x; + res_y = props->res_y; + if (atts & BOLD) + width = "bold"; + else + width = props->weight; + + if (CSET_DOUBLE(chrset)) + res_x *= 2; + if (chrset == CSET_DHL_TOP + || chrset == CSET_DHL_BOT) { + res_y *= 2; + pixel_size *= 2; + } #if OPT_TRACE - if (old_props.res_x != res_x - || old_props.res_x != res_y - || old_props.pixel_size != pixel_size - || strcmp(old_props.spacing, props->spacing)) { - TRACE(("xtermSpecialFont(atts = %#x, chrset = %#x)\n", atts, chrset)); - TRACE(("res_x = %d\n", res_x)); - TRACE(("res_y = %d\n", res_y)); - TRACE(("point_size = %s\n", props->point_size)); - TRACE(("pixel_size = %d\n", pixel_size)); - TRACE(("spacing = %s\n", props->spacing)); - old_props.res_x = res_x; - old_props.res_x = res_y; - old_props.pixel_size = pixel_size; - old_props.spacing = strcpy(old_spacing, props->spacing); - } + if (old_props.res_x != res_x + || old_props.res_x != res_y + || old_props.pixel_size != pixel_size + || strcmp(old_props.spacing, props->spacing)) { + TRACE(("xtermSpecialFont(atts = %#x, chrset = %#x)\n", atts, chrset)); + TRACE(("res_x = %d\n", res_x)); + TRACE(("res_y = %d\n", res_y)); + TRACE(("point_size = %s\n", props->point_size)); + TRACE(("pixel_size = %d\n", pixel_size)); + TRACE(("spacing = %s\n", props->spacing)); + old_props.res_x = res_x; + old_props.res_x = res_y; + old_props.pixel_size = pixel_size; + old_props.spacing = strcpy(old_spacing, props->spacing); + } #endif - sprintf(tmp, "%s-%s-%s-%s-%s-%d-%s-%d-%d-%s-*-%s", - props->beginning, - width, - props->slant, - props->wideness, - props->add_style, - pixel_size, - props->point_size, - res_x, - res_y, - props->spacing, - props->end); + sprintf(tmp, "%s-%s-%s-%s-%s-%d-%s-%d-%d-%s-*-%s", + props->beginning, + width, + props->slant, + props->wideness, + props->add_style, + pixel_size, + props->point_size, + res_x, + res_y, + props->spacing, + props->end); - ret = XtMalloc(strlen(tmp) + 1); - strcpy(ret, tmp); + ret = XtMalloc(strlen(tmp) + 1); + strcpy(ret, tmp); - return ret; + return ret; } #endif /* OPT_DEC_CHRSET */ @@ -404,24 +402,24 @@ static Boolean same_font_name(char *pattern, char *match) { - while (*pattern && *match) { - if (*pattern == *match) { - pattern++; - match++; - } else if (*pattern == '*' || *match == '*') { - if (same_font_name(pattern+1, match)) { - return True; - } else if (same_font_name(pattern, match+1)) { - return True; - } else { - return False; - } - } else { - if (char2lower(*pattern++) != char2lower(*match++)) - return False; - } + while (*pattern && *match) { + if (*pattern == *match) { + pattern++; + match++; + } else if (*pattern == '*' || *match == '*') { + if (same_font_name(pattern + 1, match)) { + return True; + } else if (same_font_name(pattern, match + 1)) { + return True; + } else { + return False; + } + } else { + if (char2lower(*pattern++) != char2lower(*match++)) + return False; } - return (*pattern == *match); /* both should be NUL */ + } + return (*pattern == *match); /* both should be NUL */ } /* @@ -435,16 +433,16 @@ * offset. */ static int -got_bold_font(Display *dpy, XFontStruct *fs, char *requested) +got_bold_font(Display * dpy, XFontStruct * fs, char *requested) { - char actual[MAX_FONTNAME]; - int got; + char actual[MAX_FONTNAME]; + int got; - if (get_font_name_props(dpy, fs, actual) == 0) - got = 0; - else - got = same_font_name(requested, actual); - return got; + if (get_font_name_props(dpy, fs, actual) == 0) + got = 0; + else + got = same_font_name(requested, actual); + return got; } /* @@ -453,30 +451,30 @@ * leave trash on the display when we mix normal and bold fonts. */ static int -same_font_size(XFontStruct *nfs, XFontStruct *bfs) +same_font_size(XFontStruct * nfs, XFontStruct * bfs) { - TRACE(("same_font_size height %d/%d, min %d/%d max %d/%d\n", - nfs->ascent + nfs->descent, - bfs->ascent + bfs->descent, - nfs->min_bounds.width, bfs->min_bounds.width, - nfs->max_bounds.width, bfs->max_bounds.width)); - return term->screen.free_bold_box || ( - (nfs->ascent + nfs->descent) == (bfs->ascent + bfs->descent) - && ( nfs->min_bounds.width == bfs->min_bounds.width - || nfs->min_bounds.width == bfs->min_bounds.width + 1) - && ( nfs->max_bounds.width == bfs->max_bounds.width - || nfs->max_bounds.width == bfs->max_bounds.width + 1)); + TRACE(("same_font_size height %d/%d, min %d/%d max %d/%d\n", + nfs->ascent + nfs->descent, + bfs->ascent + bfs->descent, + nfs->min_bounds.width, bfs->min_bounds.width, + nfs->max_bounds.width, bfs->max_bounds.width)); + return term->screen.free_bold_box + || ((nfs->ascent + nfs->descent) == (bfs->ascent + bfs->descent) + && (nfs->min_bounds.width == bfs->min_bounds.width + || nfs->min_bounds.width == bfs->min_bounds.width + 1) + && (nfs->max_bounds.width == bfs->max_bounds.width + || nfs->max_bounds.width == bfs->max_bounds.width + 1)); } /* * Check if the font looks like it has fixed width */ static int -is_fixed_font(XFontStruct *fs) +is_fixed_font(XFontStruct * fs) { - if (fs) - return (fs->min_bounds.width == fs->max_bounds.width); - return 1; + if (fs) + return (fs->min_bounds.width == fs->max_bounds.width); + return 1; } /* @@ -485,9 +483,9 @@ */ #if OPT_WIDE_CHARS static int -is_double_width_font(XFontStruct *fs) +is_double_width_font(XFontStruct * fs) { - return (2 * fs->min_bounds.width == fs->max_bounds.width); + return (2 * fs->min_bounds.width == fs->max_bounds.width); } #else #define is_double_width_font(fs) 0 @@ -501,404 +499,411 @@ * (fs)->max_bounds.width) int -xtermLoadFont ( - TScreen *screen, - VT_FONTSET(char *nfontname, char *bfontname, char *wfontname, char *wbfontname), - Bool doresize, - int fontnum) -{ - /* FIXME: use XFreeFontInfo */ - FontNameProperties *fp; - XFontStruct *nfs = NULL; - XFontStruct *bfs = NULL; +xtermLoadFont(TScreen * screen, + VT_FONTSET(char *nfontname, + char *bfontname, + char *wfontname, + char *wbfontname), + Bool doresize, + int fontnum) +{ + /* FIXME: use XFreeFontInfo */ + FontNameProperties *fp; + XFontStruct *nfs = NULL; + XFontStruct *bfs = NULL; #if OPT_WIDE_CHARS - XFontStruct *wfs = NULL; - XFontStruct *wbfs = NULL; + XFontStruct *wfs = NULL; + XFontStruct *wbfs = NULL; #endif - XGCValues xgcv; - unsigned long mask; - GC new_normalGC = NULL; - GC new_normalboldGC = NULL; - GC new_reverseGC = NULL; - GC new_reverseboldGC = NULL; - Pixel new_normal; - Pixel new_revers; - char *tmpname = NULL; - char normal[MAX_FONTNAME]; - Boolean proportional = False; - int ch; - - if (!nfontname) return 0; - - if (fontnum == fontMenu_fontescape - && nfontname != screen->menu_font_names[fontnum]) { - if ((tmpname = x_strdup(nfontname)) == 0) - return 0; - } - - TRACE(("xtermLoadFont normal %s\n", nfontname)); - - if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad; - if (EmptyFont(nfs)) - goto bad; /* can't use a 0-sized font */ - - - strcpy(normal, nfontname); - if (bfontname == 0) { - fp = get_font_name_props(screen->display, nfs, normal); - if (fp != 0) { - bfontname = bold_font_name(fp); - TRACE(("...derived bold %s\n", bfontname)); - } - if (bfontname == 0 - || (bfs = XLoadQueryFont (screen->display, bfontname)) == 0) { - bfs = nfs; - TRACE(("...cannot load a matching bold font\n")); - } else if (same_font_size(nfs, bfs) - && got_bold_font(screen->display, bfs, bfontname)) { - TRACE(("...got a matching bold font\n")); - } else { - XFreeFont(screen->display, bfs); - bfs = nfs; - TRACE(("...did not get a matching bold font\n")); - } - } else if ((bfs = XLoadQueryFont (screen->display, bfontname)) == 0) { - bfs = nfs; - TRACE(("...cannot load bold font %s\n", bfontname)); + XGCValues xgcv; + unsigned long mask; + GC new_normalGC = NULL; + GC new_normalboldGC = NULL; + GC new_reverseGC = NULL; + GC new_reverseboldGC = NULL; + Pixel new_normal; + Pixel new_revers; + char *tmpname = NULL; + char normal[MAX_FONTNAME]; + Boolean proportional = False; + int ch; + + if (!nfontname) + return 0; + + if (fontnum == fontMenu_fontescape + && nfontname != screen->menu_font_names[fontnum]) { + if ((tmpname = x_strdup(nfontname)) == 0) + return 0; + } + + TRACE(("xtermLoadFont normal %s\n", nfontname)); + + if (!(nfs = XLoadQueryFont(screen->display, nfontname))) + goto bad; + if (EmptyFont(nfs)) + goto bad; /* can't use a 0-sized font */ + + strcpy(normal, nfontname); + if (bfontname == 0) { + fp = get_font_name_props(screen->display, nfs, normal); + if (fp != 0) { + bfontname = bold_font_name(fp); + TRACE(("...derived bold %s\n", bfontname)); + } + if (bfontname == 0 + || (bfs = XLoadQueryFont(screen->display, bfontname)) == 0) { + bfs = nfs; + TRACE(("...cannot load a matching bold font\n")); + } else if (same_font_size(nfs, bfs) + && got_bold_font(screen->display, bfs, bfontname)) { + TRACE(("...got a matching bold font\n")); + } else { + XFreeFont(screen->display, bfs); + bfs = nfs; + TRACE(("...did not get a matching bold font\n")); + } + } else if ((bfs = XLoadQueryFont(screen->display, bfontname)) == 0) { + bfs = nfs; + TRACE(("...cannot load bold font %s\n", bfontname)); + } + + /* + * If there is no widefont specified, fake it by doubling AVERAGE_WIDTH + * of normal fonts XLFD, and asking for it. This plucks out 18x18ja + * and 12x13ja as the corresponding fonts for 9x18 and 6x13. + */ + if_OPT_WIDE_CHARS(screen, { + if (wfontname == 0 && !is_double_width_font(nfs)) { + fp = get_font_name_props(screen->display, nfs, normal); + if (fp != 0) { + wfontname = wide_font_name(fp); + TRACE(("...derived wide %s\n", wfontname)); + } } - /* - * If there is no widefont specified, fake it by doubling AVERAGE_WIDTH - * of normal fonts XLFD, and asking for it. This plucks out 18x18ja - * and 12x13ja as the corresponding fonts for 9x18 and 6x13. - */ - if_OPT_WIDE_CHARS(screen, { - if (wfontname == 0 && !is_double_width_font(nfs)) { - fp = get_font_name_props(screen->display, nfs, normal); - if (fp != 0) { - wfontname = wide_font_name(fp); - TRACE(("...derived wide %s\n", wfontname)); - } - } - - if (wfontname) { - wfs = XLoadQueryFont(screen->display, wfontname); - } else { - wfs = nfs; - } - - if (wbfontname) { - wbfs = XLoadQueryFont(screen->display, wbfontname); - } else if (is_double_width_font(bfs)) { - wbfs = bfs; - } else { - wbfs = wfs; - TRACE(("...cannot load wide bold font %s\n", wbfontname)); - } - - if (EmptyFont(wbfs)) - goto bad; /* can't use a 0-sized font */ - }) + if (wfontname) { + wfs = XLoadQueryFont(screen->display, wfontname); + } else { + wfs = nfs; + } + + if (wbfontname) { + wbfs = XLoadQueryFont(screen->display, wbfontname); + } else if (is_double_width_font(bfs)) { + wbfs = bfs; + } else { + wbfs = wfs; + TRACE(("...cannot load wide bold font %s\n", wbfontname)); + } + if (EmptyFont(wbfs)) + goto bad; /* can't use a 0-sized font */ + }); + + /* + * Most of the time this call to load the font will succeed, even if + * there is no wide font : the X server doubles the width of the + * normal font, or similar. + * + * But if it did fail for some reason, then nevermind. + */ + if (EmptyFont(bfs)) + goto bad; /* can't use a 0-sized font */ + + if (!same_font_size(nfs, bfs) + && (is_fixed_font(nfs) && is_fixed_font(bfs))) { + XFreeFont(screen->display, bfs); + bfs = nfs; + TRACE(("...fixing mismatched normal/bold fonts\n")); /* - * Most of the time this call to load the font will succeed, even if - * there is no wide font : the X server doubles the width of the - * normal font, or similar. - * - * But if it did fail for some reason, then nevermind. + * If we're given a nonnull bfontname here, it came from a + * resource setting. Perhaps the user did something like set + * the "*font" in a resource file. But they would be startled + * to see a mismatched bold font. Try again, asking the font + * server for the appropriate font. */ - if (EmptyFont(bfs)) - goto bad; /* can't use a 0-sized font */ + if (bfontname != 0) { + return xtermLoadFont(screen, + VT_FONTSET(nfontname, + NULL, /* throw it away! */ + wfontname, + wbfontname), + doresize, + fontnum); + } + } - if (!same_font_size(nfs, bfs) - && (is_fixed_font(nfs) && is_fixed_font(bfs))) { - XFreeFont(screen->display, bfs); - bfs = nfs; - TRACE(("...fixing mismatched normal/bold fonts\n")); - /* - * If we're given a nonnull bfontname here, it came from a - * resource setting. Perhaps the user did something like set - * the "*font" in a resource file. But they would be startled - * to see a mismatched bold font. Try again, asking the font - * server for the appropriate font. - */ - if (bfontname != 0) { - return xtermLoadFont (screen, - VT_FONTSET(nfontname, - NULL, /* throw it away! */ - wfontname, - wbfontname), - doresize, - fontnum); - } - } - - if_OPT_WIDE_CHARS(screen, { - if (wfs != 0 - && wbfs != 0 - && !same_font_size(wfs, wbfs) - && (is_fixed_font(wfs) && is_fixed_font(wbfs))) { - XFreeFont(screen->display, wbfs); - wbfs = wfs; - TRACE(("...fixing mismatched normal/bold wide fonts\n")); - if (bfontname != 0) { - return xtermLoadFont (screen, - VT_FONTSET(nfontname, - bfontname, - wfontname, - NULL), - doresize, - fontnum); - } - } - }) + if_OPT_WIDE_CHARS(screen, { + if (wfs != 0 + && wbfs != 0 + && !same_font_size(wfs, wbfs) + && (is_fixed_font(wfs) && is_fixed_font(wbfs))) { + XFreeFont(screen->display, wbfs); + wbfs = wfs; + TRACE(("...fixing mismatched normal/bold wide fonts\n")); + if (bfontname != 0) { + return xtermLoadFont(screen, + VT_FONTSET(nfontname, + bfontname, + wfontname, + NULL), + doresize, + fontnum); + } + } + }); - /* - * Normal/bold fonts should be the same width. Also, the min/max - * values should be the same. - */ - if (!is_fixed_font(nfs) - || !is_fixed_font(bfs) - || nfs->max_bounds.width != bfs->max_bounds.width) { - TRACE(("Proportional font! normal %d/%d, bold %d/%d\n", - nfs->min_bounds.width, - nfs->max_bounds.width, - bfs->min_bounds.width, - bfs->max_bounds.width)); - proportional = True; - } - - if_OPT_WIDE_CHARS(screen, { - if (wfs != 0 - && wbfs != 0 - && (!is_fixed_font(wfs) - || !is_fixed_font(wbfs) - || wfs->max_bounds.width != wbfs->max_bounds.width)) { + /* + * Normal/bold fonts should be the same width. Also, the min/max + * values should be the same. + */ + if (!is_fixed_font(nfs) + || !is_fixed_font(bfs) + || nfs->max_bounds.width != bfs->max_bounds.width) { + TRACE(("Proportional font! normal %d/%d, bold %d/%d\n", + nfs->min_bounds.width, + nfs->max_bounds.width, + bfs->min_bounds.width, + bfs->max_bounds.width)); + proportional = True; + } + + if_OPT_WIDE_CHARS(screen, { + if (wfs != 0 + && wbfs != 0 + && (!is_fixed_font(wfs) + || !is_fixed_font(wbfs) + || wfs->max_bounds.width != wbfs->max_bounds.width)) { TRACE(("Proportional font! wide %d/%d, wide bold %d/%d\n", wfs->min_bounds.width, wfs->max_bounds.width, wbfs->min_bounds.width, wbfs->max_bounds.width)); proportional = True; - } - }) + } + }); - /* TODO : enforce that the width of the wide font is 2* the width - of the narrow font */ + /* TODO : enforce that the width of the wide font is 2* the width + of the narrow font */ - mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures | - GCFunction); + mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures | + GCFunction); - new_normal = getXtermForeground(term->flags, term->cur_foreground); - new_revers = getXtermBackground(term->flags, term->cur_background); + new_normal = getXtermForeground(term->flags, term->cur_foreground); + new_revers = getXtermBackground(term->flags, term->cur_background); - xgcv.font = nfs->fid; - xgcv.foreground = new_normal; - xgcv.background = new_revers; - xgcv.graphics_exposures = TRUE; /* default */ - xgcv.function = GXcopy; + xgcv.font = nfs->fid; + xgcv.foreground = new_normal; + xgcv.background = new_revers; + xgcv.graphics_exposures = TRUE; /* default */ + xgcv.function = GXcopy; - new_normalGC = XtGetGC((Widget)term, mask, &xgcv); - if (!new_normalGC) goto bad; + new_normalGC = XtGetGC((Widget) term, mask, &xgcv); + if (!new_normalGC) + goto bad; - if (nfs == bfs) { /* there is no bold font */ - new_normalboldGC = new_normalGC; - } else { - xgcv.font = bfs->fid; - new_normalboldGC = XtGetGC((Widget)term, mask, &xgcv); - if (!new_normalboldGC) goto bad; - } + if (nfs == bfs) { /* there is no bold font */ + new_normalboldGC = new_normalGC; + } else { + xgcv.font = bfs->fid; + new_normalboldGC = XtGetGC((Widget) term, mask, &xgcv); + if (!new_normalboldGC) + goto bad; + } - xgcv.font = nfs->fid; - xgcv.foreground = new_revers; - xgcv.background = new_normal; - new_reverseGC = XtGetGC((Widget)term, mask, &xgcv); - if (!new_reverseGC) goto bad; + xgcv.font = nfs->fid; + xgcv.foreground = new_revers; + xgcv.background = new_normal; + new_reverseGC = XtGetGC((Widget) term, mask, &xgcv); + if (!new_reverseGC) + goto bad; - if (nfs == bfs) { /* there is no bold font */ - new_reverseboldGC = new_reverseGC; - } else { - xgcv.font = bfs->fid; - new_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv); - if (!new_reverseboldGC) goto bad; - } - - if (NormalGC(screen) != NormalBoldGC(screen)) - XtReleaseGC ((Widget) term, NormalBoldGC(screen)); - XtReleaseGC ((Widget) term, NormalGC(screen)); - - if (ReverseGC(screen) != ReverseBoldGC(screen)) - XtReleaseGC ((Widget) term, ReverseBoldGC(screen)); - XtReleaseGC ((Widget) term, ReverseGC(screen)); - - NormalGC(screen) = new_normalGC; - NormalBoldGC(screen) = new_normalboldGC; - ReverseGC(screen) = new_reverseGC; - ReverseBoldGC(screen) = new_reverseboldGC; + if (nfs == bfs) { /* there is no bold font */ + new_reverseboldGC = new_reverseGC; + } else { + xgcv.font = bfs->fid; + new_reverseboldGC = XtGetGC((Widget) term, mask, &xgcv); + if (!new_reverseboldGC) + goto bad; + } - /* - * If we're switching fonts, free the old ones. Otherwise we'll leak - * the memory that is associated with the old fonts. The - * XLoadQueryFont call allocates a new XFontStruct. - */ - if (screen->fnt_bold != 0 - && screen->fnt_bold != screen->fnt_norm) - XFreeFont(screen->display, screen->fnt_bold); - if (screen->fnt_norm != 0) - XFreeFont(screen->display, screen->fnt_norm); + if (NormalGC(screen) != NormalBoldGC(screen)) + XtReleaseGC((Widget) term, NormalBoldGC(screen)); + XtReleaseGC((Widget) term, NormalGC(screen)); + + if (ReverseGC(screen) != ReverseBoldGC(screen)) + XtReleaseGC((Widget) term, ReverseBoldGC(screen)); + XtReleaseGC((Widget) term, ReverseGC(screen)); + + NormalGC(screen) = new_normalGC; + NormalBoldGC(screen) = new_normalboldGC; + ReverseGC(screen) = new_reverseGC; + ReverseBoldGC(screen) = new_reverseboldGC; + + /* + * If we're switching fonts, free the old ones. Otherwise we'll leak + * the memory that is associated with the old fonts. The + * XLoadQueryFont call allocates a new XFontStruct. + */ + if (screen->fnt_bold != 0 + && screen->fnt_bold != screen->fnt_norm) + XFreeFont(screen->display, screen->fnt_bold); + if (screen->fnt_norm != 0) + XFreeFont(screen->display, screen->fnt_norm); - screen->fnt_norm = nfs; - screen->fnt_bold = bfs; + screen->fnt_norm = nfs; + screen->fnt_bold = bfs; #if OPT_WIDE_CHARS - screen->fnt_dwd = wfs; - screen->fnt_dwdb = wbfs; + screen->fnt_dwd = wfs; + screen->fnt_dwdb = wbfs; #endif - screen->fnt_prop = proportional; - screen->fnt_boxes = True; + screen->fnt_prop = proportional; + screen->fnt_boxes = True; #if OPT_BOX_CHARS - /* - * Xterm uses character positions 1-31 of a font for the line-drawing - * characters. Check that they are all present. The null character - * (0) is special, and is not used. - */ - for (ch = 1; ch < 32; ch++) { - int n = ch; + /* + * Xterm uses character positions 1-31 of a font for the line-drawing + * characters. Check that they are all present. The null character + * (0) is special, and is not used. + */ + for (ch = 1; ch < 32; ch++) { + int n = ch; #if OPT_WIDE_CHARS - if (screen->utf8_mode) { - n = dec2ucs[ch]; - if (n == UCS_REPL) - continue; - } + if (screen->utf8_mode) { + n = dec2ucs[ch]; + if (n == UCS_REPL) + continue; + } #endif - if (xtermMissingChar(n, nfs) - || xtermMissingChar(n, bfs)) { - screen->fnt_boxes = False; - break; - } + if (xtermMissingChar(n, nfs) + || xtermMissingChar(n, bfs)) { + screen->fnt_boxes = False; + break; } - TRACE(("Will %suse internal line-drawing characters\n", screen->fnt_boxes ? "not " : "")); + } + TRACE(("Will %suse internal line-drawing characters\n", + screen->fnt_boxes ? "not " : "")); #endif - screen->enbolden = screen->bold_mode - && ((nfs == bfs) || same_font_name(normal, bfontname)); - TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n", screen->enbolden ? "" : "not ")); - - set_menu_font (False); - screen->menu_font_number = fontnum; - set_menu_font (True); - if (tmpname) { /* if setting escape or sel */ - if (screen->menu_font_names[fontnum]) - free (screen->menu_font_names[fontnum]); - screen->menu_font_names[fontnum] = tmpname; - if (fontnum == fontMenu_fontescape) { - set_sensitivity (term->screen.fontMenu, - fontMenuEntries[fontMenu_fontescape].widget, - TRUE); - } + screen->enbolden = screen->bold_mode + && ((nfs == bfs) || same_font_name(normal, bfontname)); + TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n", + screen->enbolden ? "" : "not ")); + + set_menu_font(False); + screen->menu_font_number = fontnum; + set_menu_font(True); + if (tmpname) { /* if setting escape or sel */ + if (screen->menu_font_names[fontnum]) + free(screen->menu_font_names[fontnum]); + screen->menu_font_names[fontnum] = tmpname; + if (fontnum == fontMenu_fontescape) { + set_sensitivity(term->screen.fontMenu, + fontMenuEntries[fontMenu_fontescape].widget, + TRUE); + } #if OPT_SHIFT_FONTS - screen->menu_font_sizes[fontnum] = FontSize(nfs); + screen->menu_font_sizes[fontnum] = FontSize(nfs); #endif - } - set_cursor_gcs (screen); - xtermUpdateFontInfo (screen, doresize); - return 1; - -bad: - if (tmpname) - free (tmpname); - if (new_normalGC) - XtReleaseGC ((Widget) term, new_normalGC); - if (new_normalboldGC && new_normalGC != new_normalboldGC) - XtReleaseGC ((Widget) term, new_normalboldGC); - if (new_reverseGC) - XtReleaseGC ((Widget) term, new_reverseGC); - if (new_reverseboldGC && new_reverseGC != new_reverseboldGC) - XtReleaseGC ((Widget) term, new_reverseboldGC); - if (nfs) - XFreeFont (screen->display, nfs); - if (bfs && nfs != bfs) - XFreeFont (screen->display, bfs); + } + set_cursor_gcs(screen); + xtermUpdateFontInfo(screen, doresize); + return 1; + + bad: + if (tmpname) + free(tmpname); + if (new_normalGC) + XtReleaseGC((Widget) term, new_normalGC); + if (new_normalboldGC && new_normalGC != new_normalboldGC) + XtReleaseGC((Widget) term, new_normalboldGC); + if (new_reverseGC) + XtReleaseGC((Widget) term, new_reverseGC); + if (new_reverseboldGC && new_reverseGC != new_reverseboldGC) + XtReleaseGC((Widget) term, new_reverseboldGC); + if (nfs) + XFreeFont(screen->display, nfs); + if (bfs && nfs != bfs) + XFreeFont(screen->display, bfs); #if OPT_WIDE_CHARS - if (wfs) - XFreeFont (screen->display, wfs); - if (wbfs && wbfs != wfs) - XFreeFont (screen->display, wbfs); + if (wfs) + XFreeFont(screen->display, wfs); + if (wbfs && wbfs != wfs) + XFreeFont(screen->display, wbfs); #endif - return 0; + return 0; } /* * Set the limits for the box that outlines the cursor. */ void -xtermSetCursorBox (TScreen *screen) +xtermSetCursorBox(TScreen * screen) { - static XPoint VTbox[NBOX]; - XPoint *vp; + static XPoint VTbox[NBOX]; + XPoint *vp; - vp = &VTbox[1]; - (vp++)->x = FontWidth(screen) - 1; - (vp++)->y = FontHeight(screen) - 1; - (vp++)->x = -(FontWidth(screen) - 1); - vp->y = -(FontHeight(screen) - 1); - screen->box = VTbox; + vp = &VTbox[1]; + (vp++)->x = FontWidth(screen) - 1; + (vp++)->y = FontHeight(screen) - 1; + (vp++)->x = -(FontWidth(screen) - 1); + vp->y = -(FontHeight(screen) - 1); + screen->box = VTbox; } /* * Compute useful values for the font/window sizes */ void -xtermComputeFontInfo (TScreen *screen, struct _vtwin *win, XFontStruct *font, int sbwidth) +xtermComputeFontInfo(TScreen * screen, + struct _vtwin *win, + XFontStruct * font, + int sbwidth) { int i, j, width, height; #ifdef XRENDERFONT - Display *dpy = screen->display; - if (!screen->renderFont && term->misc.face_name && - XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy)))) - { - XftPattern *pat, *match; - XftResult result; - - pat = XftNameParse (term->misc.face_name); - XftPatternBuild (pat, - XFT_FAMILY, XftTypeString, "mono", - XFT_SIZE, XftTypeInteger, term->misc.face_size, - XFT_SPACING, XftTypeInteger, XFT_MONO, - 0); - match = XftFontMatch (dpy, DefaultScreen (dpy), pat, &result); - screen->renderFont = XftFontOpenPattern (dpy, match); + Display *dpy = screen->display; + if (!screen->renderFont && term->misc.face_name) { + XftPattern *pat, *match; + XftResult result; + + pat = XftNameParse(term->misc.face_name); + XftPatternBuild(pat, + XFT_FAMILY, XftTypeString, "mono", + XFT_SIZE, XftTypeInteger, term->misc.face_size, + XFT_SPACING, XftTypeInteger, XFT_MONO, + (void *) 0); + match = XftFontMatch(dpy, DefaultScreen(dpy), pat, &result); + screen->renderFont = XftFontOpenPattern(dpy, match); if (!screen->renderFont && match) - XftPatternDestroy (match); - if (screen->renderFont) - { - XftPatternBuild (pat, - XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, - XFT_CHAR_WIDTH, XftTypeInteger, screen->renderFont->max_advance_width, - 0); - match = XftFontMatch (dpy, DefaultScreen (dpy), pat, &result); - screen->renderFontBold = XftFontOpenPattern (dpy, match); + XftPatternDestroy(match); + if (screen->renderFont) { + XftPatternBuild(pat, + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, + XFT_CHAR_WIDTH, XftTypeInteger, screen->renderFont->max_advance_width, + (void *) 0); + match = XftFontMatch(dpy, DefaultScreen(dpy), pat, &result); + screen->renderFontBold = XftFontOpenPattern(dpy, match); if (!screen->renderFontBold && match) - XftPatternDestroy (match); + XftPatternDestroy(match); } if (pat) - XftPatternDestroy (pat); + XftPatternDestroy(pat); } - if (screen->renderFont) - { + if (screen->renderFont) { win->f_width = screen->renderFont->max_advance_width; win->f_height = screen->renderFont->height; win->f_ascent = screen->renderFont->ascent; win->f_descent = screen->renderFont->descent; - } - else + } else #endif { if (is_double_width_font(font)) { - win->f_width = (font->min_bounds.width); + win->f_width = (font->min_bounds.width); } else { - win->f_width = (font->max_bounds.width); + win->f_width = (font->max_bounds.width); } win->f_height = (font->ascent + font->descent); win->f_ascent = font->ascent; @@ -906,49 +911,48 @@ } i = 2 * screen->border + sbwidth; j = 2 * screen->border; - width = (screen->max_col + 1) * win->f_width + i; + width = (screen->max_col + 1) * win->f_width + i; height = (screen->max_row + 1) * win->f_height + j; - win->fullwidth = width; + win->fullwidth = width; win->fullheight = height; - win->width = width - i; + win->width = width - i; win->height = height - j; } - /* save this information as a side-effect for double-sized characters */ void -xtermSaveFontInfo (TScreen *screen, XFontStruct *font) +xtermSaveFontInfo(TScreen * screen, XFontStruct * font) { - screen->fnt_wide = (font->max_bounds.width); - screen->fnt_high = (font->ascent + font->descent); + screen->fnt_wide = (font->max_bounds.width); + screen->fnt_high = (font->ascent + font->descent); } /* * After loading a new font, update the structures that use its size. */ void -xtermUpdateFontInfo (TScreen *screen, Bool doresize) +xtermUpdateFontInfo(TScreen * screen, Bool doresize) { - int scrollbar_width; - struct _vtwin *win = &(screen->fullVwin); + int scrollbar_width; + struct _vtwin *win = &(screen->fullVwin); - scrollbar_width = (term->misc.scrollbar - ? screen->scrollWidget->core.width + - screen->scrollWidget->core.border_width - : 0); - xtermComputeFontInfo (screen, win, screen->fnt_norm, scrollbar_width); - xtermSaveFontInfo(screen, screen->fnt_norm); - - if (doresize) { - if (VWindow(screen)) { - XClearWindow (screen->display, VWindow(screen)); - } - DoResizeScreen (term); /* set to the new natural size */ - if (screen->scrollWidget) - ResizeScrollBar (screen); - Redraw (); - } - xtermSetCursorBox (screen); + scrollbar_width = (term->misc.scrollbar + ? screen->scrollWidget->core.width + + screen->scrollWidget->core.border_width + : 0); + xtermComputeFontInfo(screen, win, screen->fnt_norm, scrollbar_width); + xtermSaveFontInfo(screen, screen->fnt_norm); + + if (doresize) { + if (VWindow(screen)) { + XClearWindow(screen->display, VWindow(screen)); + } + DoResizeScreen(term); /* set to the new natural size */ + if (screen->scrollWidget) + ResizeScrollBar(screen); + Redraw(); + } + xtermSetCursorBox(screen); } #if OPT_BOX_CHARS @@ -957,42 +961,43 @@ * Returns true if the given character is missing from the specified font. */ Bool -xtermMissingChar(unsigned ch, XFontStruct *font) +xtermMissingChar(unsigned ch, XFontStruct * font) { - if (font != 0 + if (font != 0 && font->per_char != 0 && !font->all_chars_exist) { - static XCharStruct dft, *tmp = &dft, *pc = 0; + static XCharStruct dft, *tmp = &dft, *pc = 0; - if (font->max_byte1 == 0) { + if (font->max_byte1 == 0) { #if OPT_WIDE_CHARS - if (ch > 255) { - TRACE(("xtermMissingChar %#04x (row)\n", ch)); - return True; - } + if (ch > 255) { + TRACE(("xtermMissingChar %#04x (row)\n", ch)); + return True; + } #endif - CI_GET_CHAR_INFO_1D (font, E2A(ch), tmp, pc); - } + CI_GET_CHAR_INFO_1D(font, E2A(ch), tmp, pc); + } #if OPT_WIDE_CHARS - else { - CI_GET_CHAR_INFO_2D (font, (ch >> 8), (ch & 0xff), tmp, pc); - } + else { + CI_GET_CHAR_INFO_2D(font, (ch >> 8), (ch & 0xff), tmp, pc); + } #else - if (!pc) return False; /* Urgh! */ + if (!pc) + return False; /* Urgh! */ #endif - if (CI_NONEXISTCHAR(pc)) { - TRACE(("xtermMissingChar %#04x (!exists)\n", ch)); - return True; - } - } - if (ch < 32 - && term->screen.force_box_chars) { - TRACE(("xtermMissingChar %#04x (forced off)\n", ch)); - return True; + if (CI_NONEXISTCHAR(pc)) { + TRACE(("xtermMissingChar %#04x (!exists)\n", ch)); + return True; } - return False; + } + if (ch < 32 + && term->screen.force_box_chars) { + TRACE(("xtermMissingChar %#04x (forced off)\n", ch)); + return True; + } + return False; } /* @@ -1010,341 +1015,344 @@ #define SCALE_X(n) n = (n * (screen->fnt_wide-1)) / (BOX_WIDE-1) #define SCALE_Y(n) n = (n * (screen->fnt_high-1)) / (BOX_HIGH-1) +#define SEG(x0,y0,x1,y1) x0,y0, x1,y1 /* * Draw the given graphic character, if it is simple enough (i.e., a * line-drawing character). */ void -xtermDrawBoxChar(TScreen *screen, int ch, unsigned flags, GC gc, int x, int y) +xtermDrawBoxChar(TScreen * screen, int ch, unsigned flags, GC gc, int x, int y) { - static const short - diamond[] = { - MID_WIDE, BOX_HIGH/4, 3*BOX_WIDE/4, MID_WIDE, - 3*BOX_WIDE/4, MID_WIDE, MID_WIDE, 3*BOX_HIGH/4, - MID_WIDE, 3*BOX_HIGH/4, BOX_WIDE/4, MID_HIGH, - BOX_WIDE/4, MID_HIGH, MID_WIDE, BOX_HIGH/4, - MID_WIDE, BOX_HIGH/3, 2*BOX_WIDE/3, MID_WIDE, - 2*BOX_WIDE/3, MID_WIDE, MID_WIDE, 2*BOX_HIGH/3, - MID_WIDE, 2*BOX_HIGH/3, BOX_WIDE/3, MID_HIGH, - BOX_WIDE/3, MID_HIGH, MID_WIDE, BOX_HIGH/3, - BOX_WIDE/4, MID_HIGH, 3*BOX_WIDE/4, MID_HIGH, - MID_WIDE, BOX_HIGH/4, MID_WIDE, 3*BOX_HIGH/4, - -1 - }, - degrees[] = { - MID_WIDE, BOX_HIGH/4, 2*BOX_WIDE/3, 3*BOX_HIGH/8, - 2*BOX_WIDE/3, 3*BOX_HIGH/8, MID_WIDE, MID_HIGH, - MID_WIDE, MID_HIGH, BOX_WIDE/3, 3*BOX_HIGH/8, - BOX_WIDE/3, 3*BOX_HIGH/8, MID_WIDE, BOX_HIGH/4, - -1 - }, - lower_right_corner[] = { - 0, MID_HIGH, MID_WIDE, MID_HIGH, - MID_WIDE, MID_HIGH, MID_WIDE, 0, - -1 - }, - upper_right_corner[] = { - 0, MID_HIGH, MID_WIDE, MID_HIGH, - MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH, - -1 - }, - upper_left_corner[] = { - MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH, - MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH, - -1 - }, - lower_left_corner[] = { - MID_WIDE, 0, MID_WIDE, MID_HIGH, - MID_WIDE, MID_WIDE, BOX_WIDE, MID_HIGH, - -1 - }, - cross[] = { - 0, MID_HIGH, BOX_WIDE, MID_HIGH, - MID_WIDE, 0, MID_WIDE, BOX_HIGH, - -1 - }, - scan_line_1[] = { - 0, 0, BOX_WIDE, 0, - -1 - }, - scan_line_3[] = { - 0, BOX_HIGH/4, BOX_WIDE, BOX_HIGH/4, - -1 - }, - scan_line_7[] = { - 0, MID_HIGH, BOX_WIDE, MID_HIGH, - -1 - }, - scan_line_9[] = { - 0, 3*BOX_HIGH/4, BOX_WIDE, 3*BOX_HIGH/4, - -1 - }, - horizontal_line[] = { - 0, BOX_HIGH, BOX_WIDE, BOX_HIGH, - -1 - }, - left_tee[] = { - MID_WIDE, 0, MID_WIDE, BOX_HIGH, - MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH, - -1 - }, - right_tee[] = { - MID_WIDE, 0, MID_WIDE, BOX_HIGH, - MID_WIDE, MID_HIGH, 0, MID_HIGH, - -1 - }, - bottom_tee[] = { - 0, MID_HIGH, BOX_WIDE, MID_HIGH, - MID_WIDE, 0, MID_WIDE, MID_HIGH, - -1 - }, - top_tee[] = { - 0, MID_HIGH, BOX_WIDE, MID_HIGH, - MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH, - -1 - }, - vertical_line[] = { - MID_WIDE, 0, MID_WIDE, BOX_HIGH, - -1 - }, - less_than_or_equal[] = { - 5*BOX_WIDE/6, BOX_HIGH/6, BOX_WIDE/5, MID_HIGH, - 5*BOX_WIDE/6, 5*BOX_HIGH/6, BOX_WIDE/5, MID_HIGH, - BOX_WIDE/6, 5*BOX_HIGH/6, 5*BOX_WIDE/6, 5*BOX_HIGH/6, - -1 - }, - greater_than_or_equal[] = { - BOX_WIDE/6, BOX_HIGH/6, 5*BOX_WIDE/6, MID_HIGH, - BOX_WIDE/6, 5*BOX_HIGH/6, 5*BOX_WIDE/6, MID_HIGH, - BOX_WIDE/6, 5*BOX_HIGH/6, 5*BOX_WIDE/6, 5*BOX_HIGH/6, - -1 - }; - - static const short *lines[] = { - 0, /* 00 */ - diamond, /* 01 */ - 0, /* 02 */ - 0, /* 03 */ - 0, /* 04 */ - 0, /* 05 */ - 0, /* 06 */ - degrees, /* 07 */ - 0, /* 08 */ - 0, /* 09 */ - 0, /* 0A */ - lower_right_corner, /* 0B */ - upper_right_corner, /* 0C */ - upper_left_corner, /* 0D */ - lower_left_corner, /* 0E */ - cross, /* 0F */ - scan_line_1, /* 10 */ - scan_line_3, /* 11 */ - scan_line_7, /* 12 */ - scan_line_9, /* 13 */ - horizontal_line, /* 14 */ - left_tee, /* 15 */ - right_tee, /* 16 */ - bottom_tee, /* 17 */ - top_tee, /* 18 */ - vertical_line, /* 19 */ - less_than_or_equal, /* 1A */ - greater_than_or_equal, /* 1B */ - 0, /* 1C */ - 0, /* 1D */ - 0, /* 1E */ - 0, /* 1F */ - }; - - XGCValues values; - GC gc2; - const short *p; + /* *INDENT-OFF* */ + static const short diamond[] = + { + SEG( MID_WIDE, BOX_HIGH/4, 3*BOX_WIDE/4, MID_WIDE), + SEG(3*BOX_WIDE/4, MID_WIDE, MID_WIDE, 3*BOX_HIGH/4), + SEG( MID_WIDE, 3*BOX_HIGH/4, BOX_WIDE/4, MID_HIGH), + SEG( BOX_WIDE/4, MID_HIGH, MID_WIDE, BOX_HIGH/4), + SEG( MID_WIDE, BOX_HIGH/3, 2*BOX_WIDE/3, MID_WIDE), + SEG(2*BOX_WIDE/3, MID_WIDE, MID_WIDE, 2*BOX_HIGH/3), + SEG( MID_WIDE, 2*BOX_HIGH/3, BOX_WIDE/3, MID_HIGH), + SEG( BOX_WIDE/3, MID_HIGH, MID_WIDE, BOX_HIGH/3), + SEG( BOX_WIDE/4, MID_HIGH, 3*BOX_WIDE/4, MID_HIGH), + SEG( MID_WIDE, BOX_HIGH/4, MID_WIDE, 3*BOX_HIGH/4), + -1 + }, degrees[] = + { + SEG( MID_WIDE, BOX_HIGH/4, 2*BOX_WIDE/3, 3*BOX_HIGH/8), + SEG(2*BOX_WIDE/3, 3*BOX_HIGH/8, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, BOX_WIDE/3, 3*BOX_HIGH/8), + SEG( BOX_WIDE/3, 3*BOX_HIGH/8, MID_WIDE, BOX_HIGH/4), + -1 + }, lower_right_corner[] = + { + SEG( 0, MID_HIGH, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, 0), + -1 + }, upper_right_corner[] = + { + SEG( 0, MID_HIGH, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), + -1 + }, upper_left_corner[] = + { + SEG( MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), + -1 + }, lower_left_corner[] = + { + SEG( MID_WIDE, 0, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_WIDE, BOX_WIDE, MID_HIGH), + -1 + }, cross[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + -1 + }, scan_line_1[] = + { + SEG( 0, 0, BOX_WIDE, 0), + -1 + }, scan_line_3[] = + { + SEG( 0, BOX_HIGH/4, BOX_WIDE, BOX_HIGH/4), + -1 + }, scan_line_7[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + -1 + }, scan_line_9[] = + { + SEG( 0, 3*BOX_HIGH/4, BOX_WIDE, 3 * BOX_HIGH / 4), + -1 + }, horizontal_line[] = + { + SEG( 0, BOX_HIGH, BOX_WIDE, BOX_HIGH), + -1 + }, left_tee[] = + { + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + SEG( MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH), + -1 + }, right_tee[] = + { + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + SEG( MID_WIDE, MID_HIGH, 0, MID_HIGH), + -1 + }, bottom_tee[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, 0, MID_WIDE, MID_HIGH), + -1 + }, top_tee[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), + -1 + }, vertical_line[] = + { + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + -1 + }, less_than_or_equal[] = + { + SEG(5*BOX_WIDE/6, BOX_HIGH/6, BOX_WIDE/5, MID_HIGH), + SEG(5*BOX_WIDE/6, 5*BOX_HIGH/6, BOX_WIDE/5, MID_HIGH), + SEG( BOX_WIDE/6, 5*BOX_HIGH/6, 5*BOX_WIDE/6, 5*BOX_HIGH/6), + -1 + }, greater_than_or_equal[] = + { + SEG( BOX_WIDE/6, BOX_HIGH /6, 5*BOX_WIDE/6, MID_HIGH), + SEG( BOX_WIDE/6, 5*BOX_HIGH/6, 5*BOX_WIDE/6, MID_HIGH), + SEG( BOX_WIDE/6, 5*BOX_HIGH/6, 5*BOX_WIDE/6, 5*BOX_HIGH/6), + -1 + }; + /* *INDENT-ON* */ + + static const short *lines[] = + { + 0, /* 00 */ + diamond, /* 01 */ + 0, /* 02 */ + 0, /* 03 */ + 0, /* 04 */ + 0, /* 05 */ + 0, /* 06 */ + degrees, /* 07 */ + 0, /* 08 */ + 0, /* 09 */ + 0, /* 0A */ + lower_right_corner, /* 0B */ + upper_right_corner, /* 0C */ + upper_left_corner, /* 0D */ + lower_left_corner, /* 0E */ + cross, /* 0F */ + scan_line_1, /* 10 */ + scan_line_3, /* 11 */ + scan_line_7, /* 12 */ + scan_line_9, /* 13 */ + horizontal_line, /* 14 */ + left_tee, /* 15 */ + right_tee, /* 16 */ + bottom_tee, /* 17 */ + top_tee, /* 18 */ + vertical_line, /* 19 */ + less_than_or_equal, /* 1A */ + greater_than_or_equal, /* 1B */ + 0, /* 1C */ + 0, /* 1D */ + 0, /* 1E */ + 0, /* 1F */ + }; + + XGCValues values; + GC gc2; + const short *p; #if OPT_WIDE_CHARS - /* - * Try to show line-drawing characters if we happen to be in UTF-8 - * mode, but have gotten an old-style font. - */ - if (screen->utf8_mode - && (ch > 127) - && (ch != UCS_REPL)) { - unsigned n; - for (n = 1; n < 32; n++) { - if (dec2ucs[n] == ch - && !xtermMissingChar(n, (flags & BOLD) - ? screen->fnt_bold - : screen->fnt_norm)) { - TRACE(("...use xterm-style linedrawing\n")); - ch = n; - break; - } - } + /* + * Try to show line-drawing characters if we happen to be in UTF-8 + * mode, but have gotten an old-style font. + */ + if (screen->utf8_mode + && (ch > 127) + && (ch != UCS_REPL)) { + unsigned n; + for (n = 1; n < 32; n++) { + if (dec2ucs[n] == ch + && !xtermMissingChar(n, (flags & BOLD) + ? screen->fnt_bold + : screen->fnt_norm)) { + TRACE(("...use xterm-style linedrawing\n")); + ch = n; + break; + } } + } #endif - - TRACE(("DRAW_BOX(%d) cell %dx%d at %d,%d%s\n", - ch, screen->fnt_high, screen->fnt_wide, y, x, - (ch < 0 || ch >= (int)(sizeof(lines)/sizeof(lines[0]))) ? "-BAD": "")); - if (!XGetGCValues(screen->display, gc, GCBackground, &values)) - return; - - values.foreground = values.background; - gc2 = XCreateGC(screen->display, VWindow(screen), GCForeground, &values); - - XFillRectangle( - screen->display, VWindow(screen), gc2, x, y, - screen->fnt_wide, - screen->fnt_high); - - XCopyGC(screen->display, gc, (1<<GCLastBit)-1, gc2); - XSetLineAttributes(screen->display, gc2, - (flags&BOLD) - ? ((screen->fnt_high > 6) - ? screen->fnt_high/6 + TRACE(("DRAW_BOX(%d) cell %dx%d at %d,%d%s\n", + ch, screen->fnt_high, screen->fnt_wide, y, x, + (ch < 0 || ch >= (int) (sizeof(lines) / sizeof(lines[0]))) + ? "-BAD" + : "")); + + if (!XGetGCValues(screen->display, gc, GCBackground, &values)) + return; + + values.foreground = values.background; + gc2 = XCreateGC(screen->display, VWindow(screen), GCForeground, &values); + + XFillRectangle( + screen->display, VWindow(screen), gc2, x, y, + screen->fnt_wide, + screen->fnt_high); + + XCopyGC(screen->display, gc, (1 << GCLastBit) - 1, gc2); + XSetLineAttributes(screen->display, gc2, + (flags & BOLD) + ? ((screen->fnt_high > 6) + ? screen->fnt_high / 6 : 1) - : ((screen->fnt_high > 8) - ? screen->fnt_high/8 + : ((screen->fnt_high > 8) + ? screen->fnt_high / 8 : 1), - LineSolid, - CapProjecting, - JoinMiter); - - if (ch >= 0 - && ch < (int)(sizeof(lines)/sizeof(lines[0])) - && (p = lines[ch]) != 0) { - int coord[4]; - int n = 0; - while (*p >= 0) { - coord[n++] = *p++; - if (n == 4) { - SCALE_X(coord[0]); SCALE_Y(coord[1]); - SCALE_X(coord[2]); SCALE_Y(coord[3]); - XDrawLine( - screen->display, - VWindow(screen), gc2, - x + coord[0], y + coord[1], - x + coord[2], y + coord[3]); - n = 0; - } - } - } -#if 0 /* bounding rectangle, for debugging */ - else { - XDrawRectangle( - screen->display, VWindow(screen), gc, x, y, - screen->fnt_wide-1, - screen->fnt_high-1); + LineSolid, + CapProjecting, + JoinMiter); + + if (ch >= 0 + && ch < (int) (sizeof(lines) / sizeof(lines[0])) + && (p = lines[ch]) != 0) { + int coord[4]; + int n = 0; + while (*p >= 0) { + coord[n++] = *p++; + if (n == 4) { + SCALE_X(coord[0]); + SCALE_Y(coord[1]); + SCALE_X(coord[2]); + SCALE_Y(coord[3]); + XDrawLine( + screen->display, + VWindow(screen), gc2, + x + coord[0], y + coord[1], + x + coord[2], y + coord[3]); + n = 0; + } } + } +#if 0 /* bounding rectangle, for debugging */ + else { + XDrawRectangle( + screen->display, VWindow(screen), gc, x, y, + screen->fnt_wide - 1, + screen->fnt_high - 1); + } #endif - XFreeGC(screen->display, gc2); + XFreeGC(screen->display, gc2); } #endif #if OPT_SHIFT_FONTS static XFontStruct * -xtermFindFont ( - TScreen *screen, - int fontnum) -{ - XFontStruct *nfs = 0; - char *name; - - if ((name = screen->menu_font_names[fontnum]) != 0 - && (nfs = XLoadQueryFont (screen->display, name)) != 0) { - if (EmptyFont(nfs)) { - XFreeFont (screen->display, nfs); - nfs = 0; - } +xtermFindFont(TScreen * screen, int fontnum) +{ + XFontStruct *nfs = 0; + char *name; + + if ((name = screen->menu_font_names[fontnum]) != 0 + && (nfs = XLoadQueryFont(screen->display, name)) != 0) { + if (EmptyFont(nfs)) { + XFreeFont(screen->display, nfs); + nfs = 0; } - return nfs; + } + return nfs; } /* * Cache the font-sizes so subsequent larger/smaller font actions will go fast. */ static void -lookupFontSizes(TScreen *screen) +lookupFontSizes(TScreen * screen) { - int n; + int n; - for (n = 0; n < NMENUFONTS; n++) { - if (screen->menu_font_sizes[n] == 0) { - XFontStruct *fs = xtermFindFont(screen, n); - screen->menu_font_sizes[n] = -1; - if (fs != 0) { - screen->menu_font_sizes[n] = FontSize(fs); - TRACE(("menu_font_sizes[%d] = %ld\n", n, - screen->menu_font_sizes[n])); - XFreeFont (screen->display, fs); - } - } + for (n = 0; n < NMENUFONTS; n++) { + if (screen->menu_font_sizes[n] == 0) { + XFontStruct *fs = xtermFindFont(screen, n); + screen->menu_font_sizes[n] = -1; + if (fs != 0) { + screen->menu_font_sizes[n] = FontSize(fs); + TRACE(("menu_font_sizes[%d] = %ld\n", n, + screen->menu_font_sizes[n])); + XFreeFont(screen->display, fs); + } } + } } /* ARGSUSED */ void -HandleLargerFont( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +HandleLargerFont(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - TScreen *screen = &term->screen; - int n, m; + TScreen *screen = &term->screen; + int n, m; - if (!term->misc.shift_fonts) - return; - lookupFontSizes(screen); - for (n = 0, m = -1; n < NMENUFONTS; n++) { - if ((screen->menu_font_sizes[n] > screen->menu_font_sizes[screen->menu_font_number]) - && ((m < 0) - || (screen->menu_font_sizes[n] < screen->menu_font_sizes[m]))) - m = n; - } - if (m >= 0) { - SetVTFont (m, TRUE, VT_FONTSET(NULL, NULL, NULL, NULL)); - } else { - Bell(XkbBI_MinorError,0); - } + if (!term->misc.shift_fonts) + return; + lookupFontSizes(screen); + for (n = 0, m = -1; n < NMENUFONTS; n++) { + if ((screen->menu_font_sizes[n] > screen->menu_font_sizes[screen->menu_font_number]) + && ((m < 0) + || (screen->menu_font_sizes[n] < screen->menu_font_sizes[m]))) + m = n; + } + if (m >= 0) { + SetVTFont(m, TRUE, VT_FONTSET(NULL, NULL, NULL, NULL)); + } else { + Bell(XkbBI_MinorError, 0); + } } /* ARGSUSED */ void -HandleSmallerFont( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +HandleSmallerFont(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - TScreen *screen = &term->screen; - int n, m; + TScreen *screen = &term->screen; + int n, m; - if (!term->misc.shift_fonts) - return; - lookupFontSizes(screen); - for (n = 0, m = -1; n < NMENUFONTS; n++) { - if ((screen->menu_font_sizes[n] < screen->menu_font_sizes[screen->menu_font_number]) - && (screen->menu_font_sizes[n] > 0) - && ((m < 0) - || (screen->menu_font_sizes[n] > screen->menu_font_sizes[m]))) - m = n; - } - if (m >= 0) { - SetVTFont (m, TRUE, VT_FONTSET(NULL, NULL, NULL, NULL)); - } else { - Bell(XkbBI_MinorError,0); - } + if (!term->misc.shift_fonts) + return; + lookupFontSizes(screen); + for (n = 0, m = -1; n < NMENUFONTS; n++) { + if ((screen->menu_font_sizes[n] < screen->menu_font_sizes[screen->menu_font_number]) + && (screen->menu_font_sizes[n] > 0) + && ((m < 0) + || (screen->menu_font_sizes[n] > screen->menu_font_sizes[m]))) + m = n; + } + if (m >= 0) { + SetVTFont(m, TRUE, VT_FONTSET(NULL, NULL, NULL, NULL)); + } else { + Bell(XkbBI_MinorError, 0); + } } #endif /* ARGSUSED */ void -HandleSetFont( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +HandleSetFont(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { int fontnum; char *name1 = NULL, *name2 = NULL, *name3 = NULL, *name4 = NULL; @@ -1352,78 +1360,101 @@ if (*param_count == 0) { fontnum = fontMenu_fontdefault; } else { - Cardinal maxparams = 1; /* total number of params allowed */ + Cardinal maxparams = 1; /* total number of params allowed */ switch (params[0][0]) { - case 'd': case 'D': case '0': - fontnum = fontMenu_fontdefault; break; - case '1': - fontnum = fontMenu_font1; break; - case '2': - fontnum = fontMenu_font2; break; - case '3': - fontnum = fontMenu_font3; break; - case '4': - fontnum = fontMenu_font4; break; - case '5': - fontnum = fontMenu_font5; break; - case '6': - fontnum = fontMenu_font6; break; - case 'e': case 'E': - fontnum = fontMenu_fontescape; maxparams = 5; break; - case 's': case 'S': - fontnum = fontMenu_fontsel; maxparams = 2; break; - default: - Bell(XkbBI_MinorError,0); + case 'd': + case 'D': + case '0': + fontnum = fontMenu_fontdefault; + break; + case '1': + fontnum = fontMenu_font1; + break; + case '2': + fontnum = fontMenu_font2; + break; + case '3': + fontnum = fontMenu_font3; + break; + case '4': + fontnum = fontMenu_font4; + break; + case '5': + fontnum = fontMenu_font5; + break; + case '6': + fontnum = fontMenu_font6; + break; + case 'e': + case 'E': + fontnum = fontMenu_fontescape; + maxparams = 5; + break; + case 's': + case 'S': + fontnum = fontMenu_fontsel; + maxparams = 2; + break; + default: + Bell(XkbBI_MinorError, 0); return; } - if (*param_count > maxparams) { /* see if extra args given */ - Bell(XkbBI_MinorError,0); + if (*param_count > maxparams) { /* see if extra args given */ + Bell(XkbBI_MinorError, 0); return; } - switch (*param_count) { /* assign 'em */ - case 5: + switch (*param_count) { /* assign 'em */ + case 5: name4 = params[4]; /* FALLTHRU */ - case 4: + case 4: name3 = params[3]; /* FALLTHRU */ - case 3: + case 3: name2 = params[2]; /* FALLTHRU */ - case 2: + case 2: name1 = params[1]; break; } } - SetVTFont (fontnum, True, VT_FONTSET(name1, name2, name3, name4)); + SetVTFont(fontnum, True, VT_FONTSET(name1, name2, name3, name4)); } -void SetVTFont ( - int i, - Bool doresize, - VT_FONTSET(char *name1, char *name2, char *name3, char *name4)) +void +SetVTFont(int i, + Bool doresize, + VT_FONTSET(char *name1, + char *name2, + char *name3, + char *name4)) { TScreen *screen = &term->screen; TRACE(("SetVTFont(i=%d, name1=%s, name2=%s)\n", i, - name1 ? name1 : "<null>", - name2 ? name2 : "<null>")); + name1 ? name1 : "<null>", + name2 ? name2 : "<null>")); if (i >= 0 && i < NMENUFONTS) { if (i == fontMenu_fontsel) { /* go get the selection */ - FindFontSelection (name1, False); /* name1 = atom, name2 is ignored */ + FindFontSelection(name1, False); /* name1 = atom, name2 is ignored */ return; } else { if (name1 == 0) name1 = screen->menu_font_names[i]; - if (xtermLoadFont(screen, VT_FONTSET(name1, name2, name3, name4), doresize, i)) { + if (xtermLoadFont(screen, + VT_FONTSET(name1, + name2, + name3, + name4), + doresize, i)) { return; } } } - Bell(XkbBI_MinorError,0); + Bell(XkbBI_MinorError, 0); return; } Index: xc/programs/xterm/input.c diff -u xc/programs/xterm/input.c:3.55 xc/programs/xterm/input.c:3.62 --- xc/programs/xterm/input.c:3.55 Wed Oct 10 15:46:23 2001 +++ xc/programs/xterm/input.c Fri Dec 27 16:05:22 2002 @@ -2,10 +2,10 @@ * $Xorg: input.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/input.c,v 3.55 2001/10/10 19:46:23 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/input.c,v 3.62 2002/12/27 21:05:22 dickey Exp $ */ /* - * Copyright 1999-2001 by Thomas E. Dickey + * Copyright 1999-2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -75,7 +75,6 @@ #endif #include <X11/Xutil.h> -#include <X11/StringDefs.h> #include <ctype.h> #include <xutf8.h> @@ -83,6 +82,8 @@ #include <data.h> #include <fontutils.h> +#define MAP(from, to) case from: return(to) + #define KEYSYM_FMT "0x%04lX" /* simplify matching <X11/keysymdef.h> */ /* 0123456789 abc def0123456789abdef0123456789abcdef0123456789abcd */ @@ -93,13 +94,13 @@ static char *curfinal = "HDACB FE"; -static int decfuncvalue (KeySym keycode); -static int sunfuncvalue (KeySym keycode); +static int decfuncvalue(KeySym keycode); +static int sunfuncvalue(KeySym keycode); #if OPT_HP_FUNC_KEYS -static int hpfuncvalue (KeySym keycode); +static int hpfuncvalue(KeySym keycode); #endif #if OPT_SCO_FUNC_KEYS -static int scofuncvalue (KeySym keycode); +static int scofuncvalue(KeySym keycode); #endif #if OPT_TRACE @@ -128,50 +129,50 @@ #endif static void -AdjustAfterInput (register TScreen *screen) +AdjustAfterInput(TScreen * screen) { - if(screen->scrollkey && screen->topline != 0) - WindowScroll(screen, 0); - if(screen->marginbell) { - int col = screen->max_col - screen->nmarginbell; - if(screen->bellarmed >= 0) { - if(screen->bellarmed == screen->cur_row) { - if(screen->cur_col >= col) { - Bell(XkbBI_MarginBell,0); - screen->bellarmed = -1; - } - } else - screen->bellarmed = - screen->cur_col < col ? screen->cur_row : -1; - } else if(screen->cur_col < col) - screen->bellarmed = screen->cur_row; - } + if (screen->scrollkey && screen->topline != 0) + WindowScroll(screen, 0); + if (screen->marginbell) { + int col = screen->max_col - screen->nmarginbell; + if (screen->bellarmed >= 0) { + if (screen->bellarmed == screen->cur_row) { + if (screen->cur_col >= col) { + Bell(XkbBI_MarginBell, 0); + screen->bellarmed = -1; + } + } else + screen->bellarmed = + screen->cur_col < col ? screen->cur_row : -1; + } else if (screen->cur_col < col) + screen->bellarmed = screen->cur_row; + } } /* returns true if the key is on the editing keypad */ static Boolean IsEditFunctionKey(KeySym keysym) { - switch (keysym) { - case XK_Prior: - case XK_Next: - case XK_Insert: - case XK_Find: - case XK_Select: + switch (keysym) { + case XK_Prior: + case XK_Next: + case XK_Insert: + case XK_Find: + case XK_Select: #ifdef DXK_Remove - case DXK_Remove: + case DXK_Remove: #endif #ifdef XK_KP_Delete - case XK_KP_Delete: - case XK_KP_Insert: + case XK_KP_Delete: + case XK_KP_Insert: #endif #ifdef XK_ISO_Left_Tab - case XK_ISO_Left_Tab: + case XK_ISO_Left_Tab: #endif - return True; - default: - return False; - } + return True; + default: + return False; + } } #if OPT_SUNPC_KBD @@ -183,40 +184,43 @@ static KeySym TranslateFromSUNPC(KeySym keysym) { - static struct { - KeySym before, after; - } table[] = { + /* *INDENT-OFF* */ + static struct { + KeySym before, after; + } table[] = { #ifdef DXK_Remove - { XK_Delete, DXK_Remove }, + { XK_Delete, DXK_Remove }, #endif - { XK_Home, XK_Find }, - { XK_End, XK_Select }, + { XK_Home, XK_Find }, + { XK_End, XK_Select }, #ifdef XK_KP_Home - { XK_Delete, XK_KP_Decimal }, - { XK_KP_Delete, XK_KP_Decimal }, - { XK_KP_Insert, XK_KP_0 }, - { XK_KP_End, XK_KP_1 }, - { XK_KP_Down, XK_KP_2 }, - { XK_KP_Next, XK_KP_3 }, - { XK_KP_Left, XK_KP_4 }, - { XK_KP_Begin, XK_KP_5 }, - { XK_KP_Right, XK_KP_6 }, - { XK_KP_Home, XK_KP_7 }, - { XK_KP_Up, XK_KP_8 }, - { XK_KP_Prior, XK_KP_9 }, -#endif - }; - unsigned n; - - for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) { - if (table[n].before == keysym) { - TRACE(("...Input keypad before was "KEYSYM_FMT"\n", keysym)); - keysym = table[n].after; - TRACE(("...Input keypad changed to "KEYSYM_FMT"\n", keysym)); - break; - } + { XK_Delete, XK_KP_Decimal }, + { XK_KP_Delete, XK_KP_Decimal }, + { XK_KP_Insert, XK_KP_0 }, + { XK_KP_End, XK_KP_1 }, + { XK_KP_Down, XK_KP_2 }, + { XK_KP_Next, XK_KP_3 }, + { XK_KP_Left, XK_KP_4 }, + { XK_KP_Begin, XK_KP_5 }, + { XK_KP_Right, XK_KP_6 }, + { XK_KP_Home, XK_KP_7 }, + { XK_KP_Up, XK_KP_8 }, + { XK_KP_Prior, XK_KP_9 }, +#endif + }; + /* *INDENT-ON* */ + + unsigned n; + + for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) { + if (table[n].before == keysym) { + TRACE(("...Input keypad before was " KEYSYM_FMT "\n", keysym)); + keysym = table[n].after; + TRACE(("...Input keypad changed to " KEYSYM_FMT "\n", keysym)); + break; } - return keysym; + } + return keysym; } #endif @@ -240,50 +244,55 @@ reply.a_type = ESC; \ }) +#define APPEND_PARM(number) \ + reply.a_param[(int) reply.a_nparam] = number, \ + reply.a_nparam += 1 + +#if OPT_MOD_FKEYS #define MODIFIER_PARM \ - if (modify_parm > 1) { \ - reply.a_param[(int) reply.a_nparam] = modify_parm; \ - reply.a_nparam += 1; \ - } + if (modify_parm > 1) APPEND_PARM(modify_parm) +#else +#define MODIFIER_PARM /*nothing */ +#endif #if OPT_WIDE_CHARS /* Convert a Unicode value c into a UTF-8 sequence in strbuf */ int -convertFromUTF8(unsigned long c, Char *strbuf) +convertFromUTF8(unsigned long c, Char * strbuf) { - int nbytes = 0; + int nbytes = 0; - if (c < 0x80) { - strbuf[nbytes++] = c; - } else if (c < 0x800) { - strbuf[nbytes++] = 0xc0 | (c >> 6); - strbuf[nbytes++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - strbuf[nbytes++] = 0xe0 | (c >> 12); - strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); - strbuf[nbytes++] = 0x80 | ( c & 0x3f); - } else if (c < 0x200000) { - strbuf[nbytes++] = 0xf0 | (c >> 18); - strbuf[nbytes++] = 0x80 | ((c >> 12) & 0x3f); - strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); - strbuf[nbytes++] = 0x80 | ( c & 0x3f); - } else if (c < 0x4000000) { - strbuf[nbytes++] = 0xf8 | (c >> 24); - strbuf[nbytes++] = 0x80 | ((c >> 18) & 0x3f); - strbuf[nbytes++] = 0x80 | ((c >> 12) & 0x3f); - strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); - strbuf[nbytes++] = 0x80 | ( c & 0x3f); - } else if (c < UCS_LIMIT) { - strbuf[nbytes++] = 0xfe | (c >> 30); - strbuf[nbytes++] = 0x80 | ((c >> 24) & 0x3f); - strbuf[nbytes++] = 0x80 | ((c >> 18) & 0x3f); - strbuf[nbytes++] = 0x80 | ((c >> 12) & 0x3f); - strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); - strbuf[nbytes++] = 0x80 | ( c & 0x3f); - } else - return convertFromUTF8(UCS_REPL, strbuf); + if (c < 0x80) { + strbuf[nbytes++] = c; + } else if (c < 0x800) { + strbuf[nbytes++] = 0xc0 | (c >> 6); + strbuf[nbytes++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + strbuf[nbytes++] = 0xe0 | (c >> 12); + strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); + strbuf[nbytes++] = 0x80 | (c & 0x3f); + } else if (c < 0x200000) { + strbuf[nbytes++] = 0xf0 | (c >> 18); + strbuf[nbytes++] = 0x80 | ((c >> 12) & 0x3f); + strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); + strbuf[nbytes++] = 0x80 | (c & 0x3f); + } else if (c < 0x4000000) { + strbuf[nbytes++] = 0xf8 | (c >> 24); + strbuf[nbytes++] = 0x80 | ((c >> 18) & 0x3f); + strbuf[nbytes++] = 0x80 | ((c >> 12) & 0x3f); + strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); + strbuf[nbytes++] = 0x80 | (c & 0x3f); + } else if (c < UCS_LIMIT) { + strbuf[nbytes++] = 0xfe | (c >> 30); + strbuf[nbytes++] = 0x80 | ((c >> 24) & 0x3f); + strbuf[nbytes++] = 0x80 | ((c >> 18) & 0x3f); + strbuf[nbytes++] = 0x80 | ((c >> 12) & 0x3f); + strbuf[nbytes++] = 0x80 | ((c >> 6) & 0x3f); + strbuf[nbytes++] = 0x80 | (c & 0x3f); + } else + return convertFromUTF8(UCS_REPL, strbuf); - return nbytes; + return nbytes; } #endif /* OPT_WIDE_CHARS */ @@ -300,22 +309,22 @@ Boolean xtermDeleteIsDEL(void) { - TScreen *screen = &term->screen; - Boolean result = True; + TScreen *screen = &term->screen; + Boolean result = True; - if (term->keyboard.type == keyboardIsDefault - || term->keyboard.type == keyboardIsVT220) - result = (screen->delete_is_del == True); - - if (term->keyboard.type == keyboardIsLegacy) - result = (screen->delete_is_del != False); - - TRACE(("xtermDeleteIsDEL(%d/%d) = %d\n", - term->keyboard.type, - screen->delete_is_del, - result)); + if (term->keyboard.type == keyboardIsDefault + || term->keyboard.type == keyboardIsVT220) + result = (screen->delete_is_del == True); + + if (term->keyboard.type == keyboardIsLegacy) + result = (screen->delete_is_del != False); + + TRACE(("xtermDeleteIsDEL(%d/%d) = %d\n", + term->keyboard.type, + screen->delete_is_del, + result)); - return result; + return result; } /* @@ -334,7 +343,6 @@ static char input_trans[] = "\ ~Meta <KeyPress>:insert-seven-bit() \n\ Meta <KeyPress>:insert-eight-bit() \n"; - /* *INDENT-OFF* */ XtActionsRec input_actions[] = { { "insert", HandleKeyPressed }, /* alias */ @@ -350,618 +358,661 @@ } void -Input ( - register TKeyboard *keyboard, - register TScreen *screen, - register XKeyEvent *event, - Bool eightbit) +Input(TKeyboard * keyboard, + TScreen * screen, + XKeyEvent * event, + Bool eightbit) { #define STRBUFSIZE 500 + + char strbuf[STRBUFSIZE]; + Char *string; + int key = FALSE; + int pty = screen->respond; + int nbytes; + KeySym keysym = 0; + ANSI reply; + int dec_code; + short modify_parm = 0; + int keypad_mode = ((keyboard->flags & MODE_DECKPAM) != 0); - char strbuf[STRBUFSIZE]; - register Char *string; - register int key = FALSE; - int pty = screen->respond; - int nbytes; - KeySym keysym = 0; - ANSI reply; - int dec_code; - short modify_parm = 0; - int keypad_mode = ((keyboard->flags & MODE_DECKPAM) != 0); - - /* Ignore characters typed at the keyboard */ - if (keyboard->flags & MODE_KAM) - return; + /* Ignore characters typed at the keyboard */ + if (keyboard->flags & MODE_KAM) + return; #if OPT_TCAP_QUERY - if (screen->tc_query >= 0) { - keysym = screen->tc_query; - nbytes = 0; - strbuf[0] = 0; - } - else + if (screen->tc_query >= 0) { + keysym = screen->tc_query; + nbytes = 0; + strbuf[0] = 0; + } else #endif #if OPT_I18N_SUPPORT - if (screen->xic) { - Status status_return; + if (screen->xic) { + Status status_return; #if OPT_WIDE_CHARS - if(screen->utf8_mode) - nbytes = Xutf8LookupString (screen->xic, event, - strbuf, sizeof(strbuf), - &keysym, &status_return); - else -#endif - nbytes = XmbLookupString (screen->xic, event, - strbuf, sizeof(strbuf), - &keysym, &status_return); - } + if (screen->utf8_mode) + nbytes = Xutf8LookupString(screen->xic, event, + strbuf, sizeof(strbuf), + &keysym, &status_return); else #endif - { - static XComposeStatus compose_status = {NULL, 0}; - nbytes = XLookupString (event, strbuf, sizeof(strbuf), - &keysym, &compose_status); - } - - string = (Char *)&strbuf[0]; - reply.a_pintro = 0; - reply.a_final = 0; - reply.a_nparam = 0; - reply.a_inters = 0; - - TRACE(("Input keysym "KEYSYM_FMT", %d:'%.*s'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", - keysym, - nbytes, - nbytes > 0 ? nbytes : 1, - nbytes > 0 ? strbuf : "", - ModifierName(event->state & ShiftMask), - ModifierName(event->state & LockMask), - ModifierName(event->state & ControlMask), - ModifierName(event->state & Mod1Mask), - ModifierName(event->state & Mod2Mask), - ModifierName(event->state & Mod3Mask), - ModifierName(event->state & Mod4Mask), - ModifierName(event->state & Mod5Mask), - eightbit ? " 8bit" : " 7bit", - IsKeypadKey(keysym) ? " KeypadKey" : "", - IsCursorKey(keysym) ? " CursorKey" : "", - IsPFKey(keysym) ? " PFKey" : "", - IsFunctionKey(keysym) ? " FKey" : "", - IsMiscFunctionKey(keysym) ? " MiscFKey" : "", - IsEditFunctionKey(keysym) ? " EditFkey" : "")); + nbytes = XmbLookupString(screen->xic, event, + strbuf, sizeof(strbuf), + &keysym, &status_return); + } else +#endif + { + static XComposeStatus compose_status = + {NULL, 0}; + nbytes = XLookupString(event, strbuf, sizeof(strbuf), + &keysym, &compose_status); + } + string = (Char *) & strbuf[0]; + reply.a_pintro = 0; + reply.a_final = 0; + reply.a_nparam = 0; + reply.a_inters = 0; + + TRACE(("Input keysym " + KEYSYM_FMT + ", %d:'%.*s'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + keysym, + nbytes, + nbytes > 0 ? nbytes : 1, + nbytes > 0 ? strbuf : "", + ModifierName(event->state & ShiftMask), + ModifierName(event->state & LockMask), + ModifierName(event->state & ControlMask), + ModifierName(event->state & Mod1Mask), + ModifierName(event->state & Mod2Mask), + ModifierName(event->state & Mod3Mask), + ModifierName(event->state & Mod4Mask), + ModifierName(event->state & Mod5Mask), + eightbit ? " 8bit" : " 7bit", + IsKeypadKey(keysym) ? " KeypadKey" : "", + IsCursorKey(keysym) ? " CursorKey" : "", + IsPFKey(keysym) ? " PFKey" : "", + IsFunctionKey(keysym) ? " FKey" : "", + IsMiscFunctionKey(keysym) ? " MiscFKey" : "", + IsEditFunctionKey(keysym) ? " EditFkey" : "")); + #if OPT_SUNPC_KBD - /* - * DEC keyboards don't have keypad(+), but do have keypad(,) instead. - * Other (Sun, PC) keyboards commonly have keypad(+), but no keypad(,) - * - it's a pain for users to work around. - */ - if (term->keyboard.type == keyboardIsVT220 - && (event->state & ShiftMask) == 0) { - if (keysym == XK_KP_Add) { - keysym = XK_KP_Separator; - TRACE(("...Input keypad(+), change keysym to "KEYSYM_FMT"\n", keysym)); - } - if (event->state & ControlMask - && keysym == XK_KP_Separator) { - keysym = XK_KP_Subtract; - TRACE(("...Input control/keypad(,), change keysym to "KEYSYM_FMT"\n", keysym)); - } + /* + * DEC keyboards don't have keypad(+), but do have keypad(,) instead. + * Other (Sun, PC) keyboards commonly have keypad(+), but no keypad(,) + * - it's a pain for users to work around. + */ + if (keyboard->type == keyboardIsVT220 + && (event->state & ShiftMask) == 0) { + if (keysym == XK_KP_Add) { + keysym = XK_KP_Separator; + TRACE(("...Input keypad(+), change keysym to " + KEYSYM_FMT + "\n", + keysym)); + } + if ((event->state & ControlMask) != 0 + && keysym == XK_KP_Separator) { + keysym = XK_KP_Subtract; + TRACE(("...Input control/keypad(,), change keysym to " + KEYSYM_FMT + "\n", + keysym)); } + } #endif - /* - * The keyboard tables may give us different keypad codes according to - * whether NumLock is pressed. Use this check to simplify the process - * of determining whether we generate an escape sequence for a keypad - * key, or force it to the value kypd_num[]. There is no fixed - * modifier for this feature, so we assume that it is the one assigned - * to the NumLock key. - * - * This check used to try to return the contents of strbuf, but that - * does not work properly when a control modifier is given (trash is - * returned in the buffer in some cases -- perhaps an X bug). - */ + /* + * The keyboard tables may give us different keypad codes according to + * whether NumLock is pressed. Use this check to simplify the process + * of determining whether we generate an escape sequence for a keypad + * key, or force it to the value kypd_num[]. There is no fixed + * modifier for this feature, so we assume that it is the one assigned + * to the NumLock key. + * + * This check used to try to return the contents of strbuf, but that + * does not work properly when a control modifier is given (trash is + * returned in the buffer in some cases -- perhaps an X bug). + */ #if OPT_NUM_LOCK - if (nbytes == 1 - && IsKeypadKey(keysym) - && term->misc.real_NumLock - && (term->misc.num_lock & event->state) != 0) { - keypad_mode = 0; - TRACE(("...Input num_lock, force keypad_mode off\n")); - } + if (nbytes == 1 + && IsKeypadKey(keysym) + && term->misc.real_NumLock + && (term->misc.num_lock & event->state) != 0) { + keypad_mode = 0; + TRACE(("...Input num_lock, force keypad_mode off\n")); + } #endif - /* - * If we are in the normal (possibly Sun/PC) keyboard state, allow - * modifiers to add a parameter to the function-key control sequences. - */ - if (event->state != 0 - && !(IsKeypadKey(keysym) && keypad_mode) +#if OPT_MOD_FKEYS + /* + * If we are in the normal (possibly Sun/PC) keyboard state, allow + * modifiers to add a parameter to the function-key control sequences. + */ + if (event->state != 0 + && !(IsKeypadKey(keysym) && keypad_mode) #if OPT_SUNPC_KBD - && term->keyboard.type != keyboardIsVT220 + && keyboard->type != keyboardIsVT220 #endif #if OPT_VT52_MODE - && screen->ansi_level != 0 + && screen->ansi_level != 0 #endif ) { /* * Modifier codes: -* None 1 -* Shift 2 = 1(None)+1(Shift) -* Alt 3 = 1(None)+2(Alt) -* Alt+Shift 4 = 1(None)+1(Shift)+2(Alt) -* Ctrl 5 = 1(None)+4(Ctrl) -* Ctrl+Shift 6 = 1(None)+1(Shift)+4(Ctrl) -* Ctrl+Alt 7 = 1(None)+2(Alt)+4(Ctrl) -* Ctrl+Alt+Shift 8 = 1(None)+1(Shift)+2(Alt)+4(Ctrl) +* None 1 +* Shift 2 = 1(None)+1(Shift) +* Alt 3 = 1(None)+2(Alt) +* Alt+Shift 4 = 1(None)+1(Shift)+2(Alt) +* Ctrl 5 = 1(None)+4(Ctrl) +* Ctrl+Shift 6 = 1(None)+1(Shift)+4(Ctrl) +* Ctrl+Alt 7 = 1(None)+2(Alt)+4(Ctrl) +* Ctrl+Alt+Shift 8 = 1(None)+1(Shift)+2(Alt)+4(Ctrl) +* Meta 9 = 1(None)+8(Meta) +* Meta+Shift 10 = 1(None)+8(Meta)+1(Shift) +* Meta+Alt 11 = 1(None)+8(Meta)+2(Alt) +* Meta+Alt+Shift 12 = 1(None)+8(Meta)+1(Shift)+2(Alt) +* Meta+Ctrl 13 = 1(None)+8(Meta)+4(Ctrl) +* Meta+Ctrl+Shift 14 = 1(None)+8(Meta)+1(Shift)+4(Ctrl) +* Meta+Ctrl+Alt 15 = 1(None)+8(Meta)+2(Alt)+4(Ctrl) +* Meta+Ctrl+Alt+Shift 16 = 1(None)+8(Meta)+1(Shift)+2(Alt)+4(Ctrl) */ #define UNMOD 1 #define SHIFT 1 #define ALT 2 #define CTRL 4 #define META 8 - modify_parm = UNMOD; - if (event->state & ShiftMask) { - modify_parm += SHIFT; - } - if (event->state & ControlMask) { - modify_parm += CTRL; - } -#if OPT_NUM_LOCK - if ((term->misc.alwaysUseMods - || term->misc.real_NumLock) - && ((event->state & term->misc.alt_left) != 0 - || (event->state & term->misc.alt_right)) != 0) { - modify_parm += ALT; - } - if (term->misc.alwaysUseMods - && ((event->state & term->misc.meta_left) != 0 - || (event->state & term->misc.meta_right)) != 0) { - modify_parm += META; - } -#endif - TRACE(("...ModifierParm %d\n", modify_parm)); + modify_parm = UNMOD; + if (event->state & ShiftMask) { + modify_parm += SHIFT; } - - /* VT300 & up: backarrow toggle */ - if ((nbytes == 1) - && (((term->keyboard.flags & MODE_DECBKM) == 0) - ^ ((event->state & ControlMask) != 0)) - && (keysym == XK_BackSpace)) { - strbuf[0] = '\177'; - TRACE(("...Input backarrow changed to %d\n", *strbuf)); + if (event->state & ControlMask) { + modify_parm += CTRL; + } +#if OPT_NUM_LOCK + if ((term->misc.alwaysUseMods + || term->misc.real_NumLock) + && ((event->state & term->misc.alt_left) != 0 + || (event->state & term->misc.alt_right)) != 0) { + modify_parm += ALT; + } + if (term->misc.alwaysUseMods + && ((event->state & term->misc.meta_left) != 0 + || (event->state & term->misc.meta_right)) != 0) { + modify_parm += META; } +#endif + TRACE(("...ModifierParm %d\n", modify_parm)); + } +#endif /* OPT_MOD_FKEYS */ + /* VT300 & up: backarrow toggle */ + if ((nbytes == 1) + && (((keyboard->flags & MODE_DECBKM) == 0) + ^ ((event->state & ControlMask) != 0)) + && (keysym == XK_BackSpace)) { + strbuf[0] = '\177'; + TRACE(("...Input backarrow changed to %d\n", *strbuf)); + } #if OPT_SUNPC_KBD - /* make an DEC editing-keypad from a Sun or PC editing-keypad */ - if (term->keyboard.type == keyboardIsVT220 - && (keysym != XK_Delete || !xtermDeleteIsDEL())) - keysym = TranslateFromSUNPC(keysym); - else + /* make an DEC editing-keypad from a Sun or PC editing-keypad */ + if (keyboard->type == keyboardIsVT220 + && (keysym != XK_Delete || !xtermDeleteIsDEL())) + keysym = TranslateFromSUNPC(keysym); + else #endif - { + { #ifdef XK_KP_Home if (keysym >= XK_KP_Home && keysym <= XK_KP_Begin) { - TRACE(("...Input keypad before was "KEYSYM_FMT"\n", keysym)); - keysym += XK_Home - XK_KP_Home; - TRACE(("...Input keypad changed to "KEYSYM_FMT"\n", keysym)); + TRACE(("...Input keypad before was " KEYSYM_FMT "\n", keysym)); + keysym += XK_Home - XK_KP_Home; + TRACE(("...Input keypad changed to " KEYSYM_FMT "\n", keysym)); } #endif - } + } #if OPT_HP_FUNC_KEYS - if (term->keyboard.type == keyboardIsHP - && (reply.a_final = hpfuncvalue (keysym)) != 0) { - reply.a_type = ESC; - MODIFIER_PARM; - unparseseq(&reply, pty); - } else + if (keyboard->type == keyboardIsHP + && (reply.a_final = hpfuncvalue(keysym)) != 0) { + reply.a_type = ESC; + MODIFIER_PARM; + unparseseq(&reply, pty); + } else #endif #if OPT_SCO_FUNC_KEYS - if (term->keyboard.type == keyboardIsSCO - && (reply.a_final = scofuncvalue (keysym)) != 0) { - reply.a_type = CSI; - MODIFIER_PARM; - unparseseq(&reply, pty); - } else -#endif - if (IsPFKey(keysym)) { - reply.a_type = SS3; - reply.a_final = keysym-XK_KP_F1+'P'; - VT52_CURSOR_KEYS - MODIFIER_PARM; - unparseseq(&reply, pty); - key = TRUE; -#if 0 /* OPT_SUNPC_KBD should suppress - but only for vt220 compatibility */ - } else if (term->keyboard.type == keyboardIsVT220 - && screen->ansi_level <= 1 - && IsEditFunctionKey(keysym)) { - key = FALSE; /* ignore editing-keypad in vt100 mode */ -#endif - } else if (IsCursorKey(keysym) && - keysym != XK_Prior && keysym != XK_Next) { - if (keyboard->flags & MODE_DECCKM) { - reply.a_type = SS3; - reply.a_final = curfinal[keysym-XK_Home]; - VT52_CURSOR_KEYS - MODIFIER_PARM; - unparseseq(&reply, pty); - } else { - reply.a_type = CSI; - if_OPT_VT52_MODE(screen,{ reply.a_type = ESC; }) - reply.a_final = curfinal[keysym-XK_Home]; - MODIFIER_PARM; - unparseseq(&reply, pty); - } - key = TRUE; - } else if (IsFunctionKey(keysym) - || IsMiscFunctionKey(keysym) - || IsEditFunctionKey(keysym) + if (keyboard->type == keyboardIsSCO + && (reply.a_final = scofuncvalue(keysym)) != 0) { + reply.a_type = CSI; + MODIFIER_PARM; + unparseseq(&reply, pty); + } else +#endif + if (IsPFKey(keysym)) { + reply.a_type = SS3; + reply.a_final = keysym - XK_KP_F1 + 'P'; + VT52_CURSOR_KEYS; + MODIFIER_PARM; + unparseseq(&reply, pty); + key = TRUE; +#if 0 /* OPT_SUNPC_KBD should suppress - but only for vt220 compatibility */ + } else if (keyboard->type == keyboardIsVT220 + && screen->ansi_level <= 1 + && IsEditFunctionKey(keysym)) { + key = FALSE; /* ignore editing-keypad in vt100 mode */ +#endif + } else if (IsCursorKey(keysym) && + keysym != XK_Prior && keysym != XK_Next) { + if (keyboard->flags & MODE_DECCKM) { + reply.a_type = SS3; + } else { + reply.a_type = CSI; + } +#if OPT_MOD_FKEYS + if (modify_parm > 1) { + if (keyboard->modify_cursor_keys) + reply.a_type = CSI; /* SS3 should not have params */ + if (keyboard->modify_cursor_keys > 1) + APPEND_PARM(1); /* force modifier to 2nd param */ + if (keyboard->modify_cursor_keys > 2) + reply.a_pintro = '>'; /* mark this as "private" */ + } +#endif + reply.a_final = curfinal[keysym - XK_Home]; + VT52_CURSOR_KEYS; + MODIFIER_PARM; + unparseseq(&reply, pty); + key = TRUE; + } else if (IsFunctionKey(keysym) + || IsMiscFunctionKey(keysym) + || IsEditFunctionKey(keysym) #ifdef SunXK_F36 - || keysym == SunXK_F36 - || keysym == SunXK_F37 + || keysym == SunXK_F36 + || keysym == SunXK_F37 #endif - || (keysym == XK_Delete - && ((modify_parm > 1) - || !xtermDeleteIsDEL()))) { + || (keysym == XK_Delete + && ((modify_parm > 1) + || !xtermDeleteIsDEL()))) { #if OPT_SUNPC_KBD - if (term->keyboard.type == keyboardIsVT220) { - if ((event->state & ControlMask) - && (keysym >= XK_F1 && keysym <= XK_F12)) - keysym += term->misc.ctrl_fkeys; - } + if (keyboard->type == keyboardIsVT220) { + if ((event->state & ControlMask) + && (keysym >= XK_F1 && keysym <= XK_F12)) + keysym += term->misc.ctrl_fkeys; + } #endif - dec_code = decfuncvalue(keysym); - if ((event->state & ShiftMask) + dec_code = decfuncvalue(keysym); + if ((event->state & ShiftMask) #if OPT_SUNPC_KBD - && term->keyboard.type == keyboardIsVT220 + && keyboard->type == keyboardIsVT220 #endif - && ((string = (Char *)udk_lookup(dec_code, &nbytes)) != 0)) { - while (nbytes-- > 0) - unparseputc(*string++, pty); - } + && ((string = (Char *) udk_lookup(dec_code, &nbytes)) != 0)) { + while (nbytes-- > 0) + unparseputc(*string++, pty); + } #if OPT_VT52_MODE - /* - * Interpret F1-F4 as PF1-PF4 for VT52, VT100 - */ - else if (term->keyboard.type != keyboardIsSun - && term->keyboard.type != keyboardIsLegacy - && (dec_code >= 11 && dec_code <= 14)) - { - reply.a_type = SS3; - VT52_CURSOR_KEYS - reply.a_final = A2E(dec_code - 11 + E2A('P')) ; - MODIFIER_PARM; - unparseseq(&reply, pty); - } -#endif - else { - reply.a_type = CSI; - reply.a_nparam = 1; - reply.a_final = 0; - MODIFIER_PARM; - if (term->keyboard.type == keyboardIsSun ) { - reply.a_param[0] = sunfuncvalue (keysym); - reply.a_final = 'z'; + /* + * Interpret F1-F4 as PF1-PF4 for VT52, VT100 + */ + else if (keyboard->type != keyboardIsSun + && keyboard->type != keyboardIsLegacy + && (dec_code >= 11 && dec_code <= 14)) { + reply.a_type = SS3; + VT52_CURSOR_KEYS; + reply.a_final = A2E(dec_code - 11 + E2A('P')); + MODIFIER_PARM; + unparseseq(&reply, pty); + } +#endif + else { + reply.a_type = CSI; + reply.a_nparam = 1; + reply.a_final = 0; + MODIFIER_PARM; + if (keyboard->type == keyboardIsSun) { + reply.a_param[0] = sunfuncvalue(keysym); + reply.a_final = 'z'; #ifdef XK_ISO_Left_Tab - } else if (keysym == XK_ISO_Left_Tab) { - reply.a_nparam = 0; - reply.a_final = 'Z'; -#endif - } else { - reply.a_param[0] = dec_code; - reply.a_final = '~'; - } - if (reply.a_final != 0 - && (reply.a_nparam == 0 || reply.a_param[0] >= 0)) - unparseseq(&reply, pty); - } - key = TRUE; - } else if (IsKeypadKey(keysym)) { - if (keypad_mode) { - reply.a_type = SS3; - reply.a_final = kypd_apl[keysym-XK_KP_Space]; - VT52_KEYPAD - MODIFIER_PARM; - unparseseq(&reply, pty); - } else { - unparseputc(kypd_num[keysym-XK_KP_Space], pty); - } - key = TRUE; - } else if (nbytes > 0) { + } else if (keysym == XK_ISO_Left_Tab) { + reply.a_nparam = 0; + reply.a_final = 'Z'; +#endif + } else { + reply.a_param[0] = dec_code; + reply.a_final = '~'; + } + if (reply.a_final != 0 + && (reply.a_nparam == 0 || reply.a_param[0] >= 0)) + unparseseq(&reply, pty); + } + key = TRUE; + } else if (IsKeypadKey(keysym)) { + if (keypad_mode) { + reply.a_type = SS3; + reply.a_final = kypd_apl[keysym - XK_KP_Space]; + VT52_KEYPAD; + MODIFIER_PARM; + unparseseq(&reply, pty); + } else { + unparseputc(kypd_num[keysym - XK_KP_Space], pty); + } + key = TRUE; + } else if (nbytes > 0) { #if OPT_TEK4014 - if(screen->TekGIN) { - TekEnqMouse(*string++); - TekGINoff(); - nbytes--; - } + if (screen->TekGIN) { + TekEnqMouse(*string++); + TekGINoff(); + nbytes--; + } #endif - if (nbytes == 1) { + if (nbytes == 1) { #if OPT_NUM_LOCK - /* - * Send ESC if we have a META modifier and - * metaSendsEcape is true. Like eightBitInput, except - * that it is not associated with terminal settings. - */ - if (eightbit - && screen->meta_sends_esc - && ((event->state & term->misc.meta_left) != 0 - || (event->state & term->misc.meta_right)) != 0) { - TRACE(("...input-char is modified by META\n")); - eightbit = False; - unparseputc (ESC, pty); /* escape */ - } -#endif - if (eightbit && screen->input_eight_bits) { - if (CharOf(*string) < 128) { - TRACE(("...input shift from %d to %d\n", - CharOf(*string), - CharOf(*string) | 0x80)); - *string |= 0x80; - } - eightbit = False; - } - /* VT220 & up: National Replacement Characters */ - if ((term->flags & NATIONAL) != 0) { - int cmp = xtermCharSetIn(CharOf(*string), screen->keyboard_dialect[0]); - TRACE(("...input NRC %d, %s %d\n", - CharOf(*string), - (CharOf(*string) == cmp) - ? "unchanged" - : "changed to", - CharOf(cmp))); - *string = cmp; - } else if (eightbit) { - unparseputc (ESC, pty); /* escape */ - } else if (*string == '?' - && (event->state & ControlMask) != 0) { - *string = 127; - } + /* + * Send ESC if we have a META modifier and + * metaSendsEcape is true. Like eightBitInput, except + * that it is not associated with terminal settings. + */ + if (screen->meta_sends_esc + && ((event->state & term->misc.meta_left) != 0 + || (event->state & term->misc.meta_right)) != 0) { + TRACE(("...input-char is modified by META\n")); + eightbit = False; + unparseputc(ESC, pty); /* escape */ + } +#endif + if (eightbit && screen->input_eight_bits) { + if (CharOf(*string) < 128) { + TRACE(("...input shift from %d to %d\n", + CharOf(*string), + CharOf(*string) | 0x80)); + *string |= 0x80; } - while (nbytes-- > 0) - unparseputc(*string++, pty); - key = TRUE; + eightbit = False; + } + /* VT220 & up: National Replacement Characters */ + if ((term->flags & NATIONAL) != 0) { + int cmp = xtermCharSetIn(CharOf(*string), + screen->keyboard_dialect[0]); + TRACE(("...input NRC %d, %s %d\n", + CharOf(*string), + (CharOf(*string) == cmp) + ? "unchanged" + : "changed to", + CharOf(cmp))); + *string = cmp; + } else if (eightbit) { + unparseputc(ESC, pty); /* escape */ + } else if (*string == '?' + && (event->state & ControlMask) != 0) { + *string = 127; + } } - if(key && !TEK4014_ACTIVE(screen)) - AdjustAfterInput(screen); + while (nbytes-- > 0) + unparseputc(*string++, pty); + key = TRUE; + } + if (key && !TEK4014_ACTIVE(screen)) + AdjustAfterInput(screen); #ifdef ENABLE_PRINT - if (keysym == XK_F2) TekPrint(); + if (keysym == XK_F2) + TekPrint(); #endif - return; + return; } void -StringInput ( register TScreen *screen, Char *string, size_t nbytes) +StringInput(TScreen * screen, Char * string, size_t nbytes) { - int pty = screen->respond; + int pty = screen->respond; - TRACE(("InputString (%s,%d)\n", visibleChars(PAIRED_CHARS(string,0), nbytes), nbytes)); + TRACE(("InputString (%s,%d)\n", + visibleChars(PAIRED_CHARS(string, 0), nbytes), + nbytes)); #if OPT_TEK4014 - if(nbytes && screen->TekGIN) { - TekEnqMouse(*string++); - TekGINoff(); - nbytes--; - } + if (nbytes && screen->TekGIN) { + TekEnqMouse(*string++); + TekGINoff(); + nbytes--; + } #endif - while (nbytes-- != 0) - unparseputc(*string++, pty); - if (!TEK4014_ACTIVE(screen)) - AdjustAfterInput(screen); + while (nbytes-- != 0) + unparseputc(*string++, pty); + if (!TEK4014_ACTIVE(screen)) + AdjustAfterInput(screen); } /* These definitions are DEC-style (e.g., vt320) */ static int -decfuncvalue (KeySym keycode) +decfuncvalue(KeySym keycode) { - switch (keycode) { - case XK_F1: return(11); - case XK_F2: return(12); - case XK_F3: return(13); - case XK_F4: return(14); - case XK_F5: return(15); - case XK_F6: return(17); - case XK_F7: return(18); - case XK_F8: return(19); - case XK_F9: return(20); - case XK_F10: return(21); - case XK_F11: return(23); - case XK_F12: return(24); - case XK_F13: return(25); - case XK_F14: return(26); - case XK_F15: return(28); - case XK_Help: return(28); - case XK_F16: return(29); - case XK_Menu: return(29); - case XK_F17: return(31); - case XK_F18: return(32); - case XK_F19: return(33); - case XK_F20: return(34); + switch (keycode) { + MAP(XK_F1, 11); + MAP(XK_F2, 12); + MAP(XK_F3, 13); + MAP(XK_F4, 14); + MAP(XK_F5, 15); + MAP(XK_F6, 17); + MAP(XK_F7, 18); + MAP(XK_F8, 19); + MAP(XK_F9, 20); + MAP(XK_F10, 21); + MAP(XK_F11, 23); + MAP(XK_F12, 24); + MAP(XK_F13, 25); + MAP(XK_F14, 26); + MAP(XK_F15, 28); + MAP(XK_Help, 28); + MAP(XK_F16, 29); + MAP(XK_Menu, 29); + MAP(XK_F17, 31); + MAP(XK_F18, 32); + MAP(XK_F19, 33); + MAP(XK_F20, 34); +#if defined(XK_F21) + MAP(XK_F21, 42); + MAP(XK_F22, 43); + MAP(XK_F23, 44); + MAP(XK_F24, 45); + MAP(XK_F25, 46); + MAP(XK_F26, 47); + MAP(XK_F27, 48); + MAP(XK_F28, 49); + MAP(XK_F29, 50); + MAP(XK_F30, 51); + MAP(XK_F31, 52); + MAP(XK_F32, 53); + MAP(XK_F33, 54); + MAP(XK_F34, 55); + MAP(XK_F35, 56); +#endif #ifdef SunXK_F36 - case SunXK_F36: return(57); - case SunXK_F37: return(58); + MAP(SunXK_F36, 57); + MAP(SunXK_F37, 58); #endif - - case XK_Find : return(1); - case XK_Insert: return(2); - case XK_Delete: return(3); + MAP(XK_Find, 1); + MAP(XK_Insert, 2); + MAP(XK_Delete, 3); #ifdef XK_KP_Insert - case XK_KP_Insert: return(2); - case XK_KP_Delete: return(3); + MAP(XK_KP_Insert, 2); + MAP(XK_KP_Delete, 3); #endif #ifdef DXK_Remove - case DXK_Remove: return(3); + MAP(DXK_Remove, 3); #endif - case XK_Select: return(4); - case XK_Prior: return(5); - case XK_Next: return(6); + MAP(XK_Select, 4); + MAP(XK_Prior, 5); + MAP(XK_Next, 6); #ifdef XK_ISO_Left_Tab - case XK_ISO_Left_Tab: return('Z'); + MAP(XK_ISO_Left_Tab, 'Z'); #endif - default: return(-1); - } + default: + return (-1); + } } #if OPT_HP_FUNC_KEYS static int -hpfuncvalue (KeySym keycode) +hpfuncvalue(KeySym keycode) { - switch (keycode) { - case XK_Up: return('A'); - case XK_Down: return('B'); - case XK_Right: return('C'); - case XK_Left: return('D'); - case XK_End: return('F'); - case XK_Clear: return('J'); - case XK_Delete: return('P'); - case XK_Insert: return('Q'); - case XK_Next: return('S'); - case XK_Prior: return('T'); - case XK_Home: return('h'); - case XK_F1: return('p'); - case XK_F2: return('q'); - case XK_F3: return('r'); - case XK_F4: return('s'); - case XK_F5: return('t'); - case XK_F6: return('u'); - case XK_F7: return('v'); - case XK_F8: return('w'); + switch (keycode) { + MAP(XK_Up, 'A'); + MAP(XK_Down, 'B'); + MAP(XK_Right, 'C'); + MAP(XK_Left, 'D'); + MAP(XK_End, 'F'); + MAP(XK_Clear, 'J'); + MAP(XK_Delete, 'P'); + MAP(XK_Insert, 'Q'); + MAP(XK_Next, 'S'); + MAP(XK_Prior, 'T'); + MAP(XK_Home, 'h'); + MAP(XK_F1, 'p'); + MAP(XK_F2, 'q'); + MAP(XK_F3, 'r'); + MAP(XK_F4, 's'); + MAP(XK_F5, 't'); + MAP(XK_F6, 'u'); + MAP(XK_F7, 'v'); + MAP(XK_F8, 'w'); #ifdef XK_KP_Insert - case XK_KP_Delete: return('P'); - case XK_KP_Insert: return('Q'); + MAP(XK_KP_Delete, 'P'); + MAP(XK_KP_Insert, 'Q'); #endif #ifdef DXK_Remove - case DXK_Remove: return('P'); + MAP(DXK_Remove, 'P'); #endif - case XK_Select: return('F'); - case XK_Find: return('h'); - default: return 0; - } + MAP(XK_Select, 'F'); + MAP(XK_Find, 'h'); + default: + return 0; + } } #endif #if OPT_SCO_FUNC_KEYS static int -scofuncvalue (KeySym keycode) +scofuncvalue(KeySym keycode) { - switch (keycode) { - case XK_Up: return('A'); - case XK_Down: return('B'); - case XK_Right: return('C'); - case XK_Left: return('D'); - case XK_End: return('F'); - case XK_Insert: return('L'); - case XK_Next: return('G'); - case XK_Prior: return('I'); - case XK_Home: return('H'); - case XK_F1: return('M'); - case XK_F2: return('N'); - case XK_F3: return('O'); - case XK_F4: return('P'); - case XK_F5: return('Q'); - case XK_F6: return('R'); - case XK_F7: return('S'); - case XK_F8: return('T'); - case XK_F9: return('U'); - case XK_F10: return('V'); - case XK_F11: return('W'); - case XK_F12: return('X'); - case XK_F13: return('Y'); - case XK_F15: return('a'); - case XK_F16: return('b'); - case XK_F17: return('c'); - case XK_F18: return('d'); - case XK_F19: return('e'); - case XK_F20: return('f'); + switch (keycode) { + MAP(XK_Up, 'A'); + MAP(XK_Down, 'B'); + MAP(XK_Right, 'C'); + MAP(XK_Left, 'D'); + MAP(XK_End, 'F'); + MAP(XK_Insert, 'L'); + MAP(XK_Next, 'G'); + MAP(XK_Prior, 'I'); + MAP(XK_Home, 'H'); + MAP(XK_F1, 'M'); + MAP(XK_F2, 'N'); + MAP(XK_F3, 'O'); + MAP(XK_F4, 'P'); + MAP(XK_F5, 'Q'); + MAP(XK_F6, 'R'); + MAP(XK_F7, 'S'); + MAP(XK_F8, 'T'); + MAP(XK_F9, 'U'); + MAP(XK_F10, 'V'); + MAP(XK_F11, 'W'); + MAP(XK_F12, 'X'); + MAP(XK_F13, 'Y'); + MAP(XK_F15, 'a'); + MAP(XK_F16, 'b'); + MAP(XK_F17, 'c'); + MAP(XK_F18, 'd'); + MAP(XK_F19, 'e'); + MAP(XK_F20, 'f'); #if defined(XK_F21) - case XK_F21: return('g'); - case XK_F22: return('h'); - case XK_F23: return('i'); - case XK_F24: return('j'); - case XK_F25: return('k'); - case XK_F26: return('l'); - case XK_F27: return('m'); - case XK_F28: return('n'); - case XK_F29: return('o'); - case XK_F30: return('p'); - case XK_F31: return('q'); - case XK_F32: return('r'); - case XK_F33: return('s'); - case XK_F34: return('t'); - case XK_F35: return('u'); + MAP(XK_F21, 'g'); + MAP(XK_F22, 'h'); + MAP(XK_F23, 'i'); + MAP(XK_F24, 'j'); + MAP(XK_F25, 'k'); + MAP(XK_F26, 'l'); + MAP(XK_F27, 'm'); + MAP(XK_F28, 'n'); + MAP(XK_F29, 'o'); + MAP(XK_F30, 'p'); + MAP(XK_F31, 'q'); + MAP(XK_F32, 'r'); + MAP(XK_F33, 's'); + MAP(XK_F34, 't'); + MAP(XK_F35, 'u'); #endif #ifdef XK_KP_Insert - case XK_KP_Insert: return('L'); + MAP(XK_KP_Insert, 'L'); #endif - default: return 0; - } + default: + return 0; + } } #endif static int -sunfuncvalue (KeySym keycode) +sunfuncvalue(KeySym keycode) { - switch (keycode) { - case XK_F1: return(224); - case XK_F2: return(225); - case XK_F3: return(226); - case XK_F4: return(227); - case XK_F5: return(228); - case XK_F6: return(229); - case XK_F7: return(230); - case XK_F8: return(231); - case XK_F9: return(232); - case XK_F10: return(233); - case XK_F11: return(192); - case XK_F12: return(193); - case XK_F13: return(194); - case XK_F14: return(195); /* kund */ - case XK_F15: return(196); - case XK_Help: return(196); /* khlp */ - case XK_F16: return(197); /* kcpy */ - case XK_Menu: return(197); - case XK_F17: return(198); - case XK_F18: return(199); - case XK_F19: return(200); /* kfnd */ - case XK_F20: return(201); - - case XK_R1: return(208); /* kf31 */ - case XK_R2: return(209); /* kf32 */ - case XK_R3: return(210); /* kf33 */ - case XK_R4: return(211); /* kf34 */ - case XK_R5: return(212); /* kf35 */ - case XK_R6: return(213); /* kf36 */ - case XK_R7: return(214); /* kf37 */ - case XK_R8: return(215); /* kf38 */ - case XK_R9: return(216); /* kf39=kpp */ - case XK_R10: return(217); /* kf40 */ - case XK_R11: return(218); /* kf41=kb2 */ - case XK_R12: return(219); /* kf42 */ - case XK_R13: return(220); /* kf43=kend */ - case XK_R14: return(221); /* kf44 */ - case XK_R15: return(222); /* kf45 */ + switch (keycode) { + MAP(XK_F1, 224); + MAP(XK_F2, 225); + MAP(XK_F3, 226); + MAP(XK_F4, 227); + MAP(XK_F5, 228); + MAP(XK_F6, 229); + MAP(XK_F7, 230); + MAP(XK_F8, 231); + MAP(XK_F9, 232); + MAP(XK_F10, 233); + MAP(XK_F11, 192); + MAP(XK_F12, 193); + MAP(XK_F13, 194); + MAP(XK_F14, 195); /* kund */ + MAP(XK_F15, 196); + MAP(XK_Help, 196); /* khlp */ + MAP(XK_F16, 197); /* kcpy */ + MAP(XK_Menu, 197); + MAP(XK_F17, 198); + MAP(XK_F18, 199); + MAP(XK_F19, 200); /* kfnd */ + MAP(XK_F20, 201); + + MAP(XK_R1, 208); /* kf31 */ + MAP(XK_R2, 209); /* kf32 */ + MAP(XK_R3, 210); /* kf33 */ + MAP(XK_R4, 211); /* kf34 */ + MAP(XK_R5, 212); /* kf35 */ + MAP(XK_R6, 213); /* kf36 */ + MAP(XK_R7, 214); /* kf37 */ + MAP(XK_R8, 215); /* kf38 */ + MAP(XK_R9, 216); /* kf39=kpp */ + MAP(XK_R10, 217); /* kf40 */ + MAP(XK_R11, 218); /* kf41=kb2 */ + MAP(XK_R12, 219); /* kf42 */ + MAP(XK_R13, 220); /* kf43=kend */ + MAP(XK_R14, 221); /* kf44 */ + MAP(XK_R15, 222); /* kf45 */ #ifdef SunXK_F36 - case SunXK_F36: return(234); - case SunXK_F37: return(235); + MAP(SunXK_F36, 234); + MAP(SunXK_F37, 235); #endif - case XK_Find : return(1); - case XK_Insert: return(2); /* kich1 */ - case XK_Delete: return(3); + MAP(XK_Find, 1); + MAP(XK_Insert, 2); /* kich1 */ + MAP(XK_Delete, 3); #ifdef XK_KP_Insert - case XK_KP_Insert: return(2); - case XK_KP_Delete: return(3); + MAP(XK_KP_Insert, 2); + MAP(XK_KP_Delete, 3); #endif #ifdef DXK_Remove - case DXK_Remove: return(3); + MAP(DXK_Remove, 3); #endif - case XK_Select: return(4); - case XK_Prior: return(5); - case XK_Next: return(6); - default: return(-1); - } + MAP(XK_Select, 4); + MAP(XK_Prior, 5); + MAP(XK_Next, 6); + default: + return (-1); + } } #if OPT_NUM_LOCK @@ -978,14 +1029,21 @@ TranslationsUseKeyword(Widget w, const char *keyword) { static String data; - static XtResource key_resources[] = { - { XtNtranslations, XtCTranslations, XtRString, - sizeof(data), 0, XtRString, (XtPointer)NULL} + static XtResource key_resources[] = + { + {XtNtranslations, XtCTranslations, XtRString, + sizeof(data), 0, XtRString, (XtPointer) NULL} }; Bool result = False; - XtGetSubresources( w, (XtPointer)&data, "vt100", "VT100", - key_resources, XtNumber(key_resources), NULL, (Cardinal)0 ); + XtGetSubresources(w, + (XtPointer) & data, + "vt100", + "VT100", + key_resources, + XtNumber(key_resources), + NULL, + (Cardinal) 0); if (data != 0) { char *p = data; @@ -995,17 +1053,17 @@ prv = now; now = char2lower(*p++); if (now == ':' - || now == '!') { + || now == '!') { state = -1; } else if (now == '\n') { state = 0; } else if (state >= 0) { if (isgraph(now) - && now == keyword[state]) { + && now == keyword[state]) { if ((state != 0 - || !isalnum(prv)) - && ((keyword[++state] == 0) - && !isalnum(CharOf(*p)))) { + || !isalnum(prv)) + && ((keyword[++state] == 0) + && !isalnum(CharOf(*p)))) { result = True; break; } @@ -1046,7 +1104,7 @@ for (j = 0; j < keymap->max_keypermod; j++) { KeyCode code = keymap->modifiermap[k]; if (code != 0) { - KeySym keysym = XKeycodeToKeysym(dpy,code,0); + KeySym keysym = XKeycodeToKeysym(dpy, code, 0); if (keysym == XK_Num_Lock) { SaveMask(num_lock); } else if (keysym == XK_Alt_L) { @@ -1070,9 +1128,9 @@ * use it to modify function-keys when NumLock is active. */ if ((term->misc.alt_left != 0 - || term->misc.alt_right != 0) - && (TranslationsUseKeyword(toplevel, "alt") - || TranslationsUseKeyword((Widget)term, "alt"))) { + || term->misc.alt_right != 0) + && (TranslationsUseKeyword(toplevel, "alt") + || TranslationsUseKeyword((Widget) term, "alt"))) { TRACE(("ALT is used as a modifier in translations (ignore mask)\n")); term->misc.alt_left = 0; term->misc.alt_right = 0; @@ -1083,9 +1141,9 @@ * use it to modify function-keys. */ if ((term->misc.meta_left != 0 - || term->misc.meta_right != 0) - && (TranslationsUseKeyword(toplevel, "meta") - || TranslationsUseKeyword((Widget)term, "meta"))) { + || term->misc.meta_right != 0) + && (TranslationsUseKeyword(toplevel, "meta") + || TranslationsUseKeyword((Widget) term, "meta"))) { TRACE(("META is used as a modifier in translations\n")); term->misc.meta_trans = True; } @@ -1097,16 +1155,16 @@ #endif /* OPT_NUM_LOCK */ #if OPT_TCAP_QUERY - static int +static int hex2int(int c) { - if (c >= '0' && c <= '9') - return c - '0'; - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - return -1; + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + return -1; } /* @@ -1117,104 +1175,108 @@ int xtermcapKeycode(char *params, unsigned *state) { + /* *INDENT-OFF* */ #define DATA(tc,ti,x,y) { tc, ti, x, y } - static struct { - char *tc; - char *ti; - int code; - unsigned state; - } table[] = { - DATA( "#2", "kHOM", XK_Home, ShiftMask), - DATA( "#4", "kLFT", XK_Left, ShiftMask), - DATA( "%1", "khlp", XK_Help, 0), - DATA( "%i", "kRIT", XK_Right, ShiftMask), - DATA( "*6", "kslt", XK_Select, 0), - DATA( "*7", "kEND", XK_End, ShiftMask), - DATA( "@0", "kfnd", XK_Find, 0), - DATA( "@7", "kend", XK_End, 0), - DATA( "F1", "kf11", XK_F11, 0), - DATA( "F2", "kf12", XK_F12, 0), - DATA( "F3", "kf13", XK_F13, 0), - DATA( "F4", "kf14", XK_F14, 0), - DATA( "F5", "kf15", XK_F15, 0), - DATA( "F6", "kf16", XK_F16, 0), - DATA( "F7", "kf17", XK_F17, 0), - DATA( "F8", "kf18", XK_F18, 0), - DATA( "F9", "kf19", XK_F19, 0), - DATA( "FA", "kf20", XK_F20, 0), - DATA( "FB", "kf21", XK_F21, 0), - DATA( "FC", "kf22", XK_F22, 0), - DATA( "FD", "kf23", XK_F23, 0), - DATA( "FE", "kf24", XK_F24, 0), - DATA( "FF", "kf25", XK_F25, 0), - DATA( "FG", "kf26", XK_F26, 0), - DATA( "FH", "kf27", XK_F27, 0), - DATA( "FI", "kf28", XK_F28, 0), - DATA( "FJ", "kf29", XK_F29, 0), - DATA( "FK", "kf30", XK_F30, 0), - DATA( "FL", "kf31", XK_F31, 0), - DATA( "FM", "kf32", XK_F32, 0), - DATA( "FN", "kf33", XK_F33, 0), - DATA( "FO", "kf34", XK_F34, 0), - DATA( "FP", "kf35", XK_F35, 0), + static struct { + char *tc; + char *ti; + int code; + unsigned state; + } table[] = { + /* tcap terminfo keycode masks */ + DATA( "#2", "kHOM", XK_Home, ShiftMask ), + DATA( "#4", "kLFT", XK_Left, ShiftMask ), + DATA( "%1", "khlp", XK_Help, 0 ), + DATA( "%i", "kRIT", XK_Right, ShiftMask ), + DATA( "*6", "kslt", XK_Select, 0 ), + DATA( "*7", "kEND", XK_End, ShiftMask ), + DATA( "@0", "kfnd", XK_Find, 0 ), + DATA( "@7", "kend", XK_End, 0 ), + DATA( "F1", "kf11", XK_F11, 0 ), + DATA( "F2", "kf12", XK_F12, 0 ), + DATA( "F3", "kf13", XK_F13, 0 ), + DATA( "F4", "kf14", XK_F14, 0 ), + DATA( "F5", "kf15", XK_F15, 0 ), + DATA( "F6", "kf16", XK_F16, 0 ), + DATA( "F7", "kf17", XK_F17, 0 ), + DATA( "F8", "kf18", XK_F18, 0 ), + DATA( "F9", "kf19", XK_F19, 0 ), + DATA( "FA", "kf20", XK_F20, 0 ), + DATA( "FB", "kf21", XK_F21, 0 ), + DATA( "FC", "kf22", XK_F22, 0 ), + DATA( "FD", "kf23", XK_F23, 0 ), + DATA( "FE", "kf24", XK_F24, 0 ), + DATA( "FF", "kf25", XK_F25, 0 ), + DATA( "FG", "kf26", XK_F26, 0 ), + DATA( "FH", "kf27", XK_F27, 0 ), + DATA( "FI", "kf28", XK_F28, 0 ), + DATA( "FJ", "kf29", XK_F29, 0 ), + DATA( "FK", "kf30", XK_F30, 0 ), + DATA( "FL", "kf31", XK_F31, 0 ), + DATA( "FM", "kf32", XK_F32, 0 ), + DATA( "FN", "kf33", XK_F33, 0 ), + DATA( "FO", "kf34", XK_F34, 0 ), + DATA( "FP", "kf35", XK_F35, 0 ), #ifdef SunXK_F36 - DATA( "FQ", "kf36", SunXK_F36, 0), - DATA( "FR", "kf37", SunXK_F37, 0), + DATA( "FQ", "kf36", SunXK_F36, 0 ), + DATA( "FR", "kf37", SunXK_F37, 0 ), #endif - DATA( "K1", "ka1", XK_KP_Home, 0), - DATA( "K4", "kc1", XK_KP_End, 0), - DATA( "k1", "kf1", XK_F1, 0), - DATA( "k2", "kf2", XK_F2, 0), - DATA( "k3", "kf3", XK_F3, 0), - DATA( "k4", "kf4", XK_F4, 0), - DATA( "k5", "kf5", XK_F5, 0), - DATA( "k6", "kf6", XK_F6, 0), - DATA( "k7", "kf7", XK_F7, 0), - DATA( "k8", "kf8", XK_F8, 0), - DATA( "k9", "kf9", XK_F9, 0), - DATA( "k;", "kf10", XK_F10, 0), + DATA( "K1", "ka1", XK_KP_Home, 0 ), + DATA( "K4", "kc1", XK_KP_End, 0 ), + DATA( "k1", "kf1", XK_F1, 0 ), + DATA( "k2", "kf2", XK_F2, 0 ), + DATA( "k3", "kf3", XK_F3, 0 ), + DATA( "k4", "kf4", XK_F4, 0 ), + DATA( "k5", "kf5", XK_F5, 0 ), + DATA( "k6", "kf6", XK_F6, 0 ), + DATA( "k7", "kf7", XK_F7, 0 ), + DATA( "k8", "kf8", XK_F8, 0 ), + DATA( "k9", "kf9", XK_F9, 0 ), + DATA( "k;", "kf10", XK_F10, 0 ), #ifdef XK_ISO_Left_Tab - DATA( "kB", "kcbt", XK_ISO_Left_Tab,0), + DATA( "kB", "kcbt", XK_ISO_Left_Tab, 0 ), #endif - DATA( "kC", "kclr", XK_Clear, 0), - DATA( "kD", "kdch1", XK_Delete, 0), - DATA( "kI", "kich1", XK_Insert, 0), - DATA( "kN", "knp", XK_Next, 0), - DATA( "kP", "kpp", XK_Prior, 0), - DATA( "kb", "kbs", XK_BackSpace, 0), - DATA( "kd", "kcud1", XK_Down, 0), - DATA( "kh", "khome", XK_Home, 0), - DATA( "kl", "kcub1", XK_Left, 0), - DATA( "kr", "kcuf1", XK_Right, 0), - DATA( "ku", "kcuu1", XK_Up, 0), + DATA( "kC", "kclr", XK_Clear, 0 ), + DATA( "kD", "kdch1", XK_Delete, 0 ), + DATA( "kI", "kich1", XK_Insert, 0 ), + DATA( "kN", "knp", XK_Next, 0 ), + DATA( "kP", "kpp", XK_Prior, 0 ), + DATA( "kb", "kbs", XK_BackSpace, 0 ), + DATA( "kd", "kcud1", XK_Down, 0 ), + DATA( "kh", "khome", XK_Home, 0 ), + DATA( "kl", "kcub1", XK_Left, 0 ), + DATA( "kr", "kcuf1", XK_Right, 0 ), + DATA( "ku", "kcuu1", XK_Up, 0 ), # if OPT_ISO_COLORS - /* XK_COLORS is a fake code. */ - DATA( "Co", "colors", XK_COLORS, 0), + /* XK_COLORS is a fake code. */ + DATA( "Co", "colors", XK_COLORS, 0 ), # endif - }; - Cardinal n; - unsigned len = 0; - int code = -1; + }; + /* *INDENT-ON* */ + + Cardinal n; + unsigned len = 0; + int code = -1; #define MAX_TNAME_LEN 6 - char name[MAX_TNAME_LEN]; - char *p; + char name[MAX_TNAME_LEN]; + char *p; - /* Convert hex encoded name to ascii */ - for (p = params; hex2int(p[0]) >= 0 && hex2int(p[1]) >= 0; p += 2) { - if (len == MAX_TNAME_LEN - 1) - return -1; - name[len++] = (hex2int(p[0]) << 4) + hex2int(p[1]); - } - if (*p) - return -1; - name[len] = 0; - for (n = 0; n < XtNumber(table); n++) { - if (!strcmp(table[n].ti, name) || !strcmp(table[n].tc, name)) { - code = table[n].code; - *state = table[n].state; - break; - } + /* Convert hex encoded name to ascii */ + for (p = params; hex2int(p[0]) >= 0 && hex2int(p[1]) >= 0; p += 2) { + if (len == MAX_TNAME_LEN - 1) + return -1; + name[len++] = (hex2int(p[0]) << 4) + hex2int(p[1]); + } + if (*p) + return -1; + name[len] = 0; + for (n = 0; n < XtNumber(table); n++) { + if (!strcmp(table[n].ti, name) || !strcmp(table[n].tc, name)) { + code = table[n].code; + *state = table[n].state; + break; } - return code; + } + return code; } #endif Index: xc/programs/xterm/install.sh diff -u xc/programs/xterm/install.sh:3.5 xc/programs/xterm/install.sh:3.6 --- xc/programs/xterm/install.sh:3.5 Mon Sep 27 10:59:29 1999 +++ xc/programs/xterm/install.sh Sun Dec 8 17:31:49 2002 @@ -1,17 +1,27 @@ #! /bin/sh # # install - install a program, script, or datafile -# This comes from X11R5. +# This comes from X11R5 (mit/util/scripts/install.sh). # +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. -# -# $XFree86: xc/programs/xterm/install.sh,v 3.5 1999/09/27 14:59:29 dawes Exp $ -# +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. # set DOITPROG to echo to test this script @@ -31,7 +41,7 @@ rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -tranformbasename="" +transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" @@ -99,7 +109,7 @@ echo "install: no input file specified" exit 1 else - true + : fi if [ x"$dir_arg" != x ]; then @@ -108,8 +118,9 @@ if [ -d $dst ]; then instcmd=: + chmodcmd="" else - instcmd=mkdir + instcmd=$mkdirprog fi else @@ -119,7 +130,7 @@ if [ -f $src -o -d $src ] then - true + : else echo "install: $src does not exist" exit 1 @@ -130,7 +141,7 @@ echo "install: no destination specified" exit 1 else - true + : fi # If destination is a directory, append the input filename; if your system @@ -140,7 +151,7 @@ then dst="$dst"/`basename $src` else - true + : fi fi @@ -152,8 +163,8 @@ # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' -' +defaultIFS=' + ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" @@ -172,7 +183,7 @@ then $mkdirprog "${pathcomp}" else - true + : fi pathcomp="${pathcomp}/" @@ -183,10 +194,10 @@ then $doit $instcmd $dst && - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. @@ -205,7 +216,7 @@ then dstfile=`basename $dst` else - true + : fi # Make a temp file name in the proper directory. @@ -224,10 +235,10 @@ # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. Index: xc/programs/xterm/main.c diff -u xc/programs/xterm/main.c:3.145 xc/programs/xterm/main.c:3.162 --- xc/programs/xterm/main.c:3.145 Mon Jan 7 13:35:41 2002 +++ xc/programs/xterm/main.c Fri Dec 27 16:05:22 2002 @@ -1,5 +1,5 @@ -#ifndef lint -static char *rid="$Xorg: main.c,v 1.7 2001/02/09 02:06:02 xorgcvs Exp $"; +#if !defined(lint) && 0 +static char *rid = "$Xorg: main.c,v 1.7 2001/02/09 02:06:02 xorgcvs Exp $"; #endif /* lint */ /* @@ -45,7 +45,6 @@ sale, use or other dealings in this Software without prior written authorization. - Copyright 1987, 1988 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -68,7 +67,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. - Copyright 1987, 1988 by Digital Equipment Corporation, Maynard. All Rights Reserved @@ -91,23 +89,28 @@ ******************************************************************/ -/* $XFree86: xc/programs/xterm/main.c,v 3.145 2002/01/07 18:35:41 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/main.c,v 3.162 2002/12/27 21:05:22 dickey Exp $ */ - /* main.c */ #include <version.h> #include <xterm.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> #include <X11/cursorfont.h> #include <X11/Xlocale.h> #if OPT_TOOLBAR + +#if defined(HAVE_LIB_XAW) #include <X11/Xaw/Form.h> +#elif defined(HAVE_LIB_XAW3D) +#include <X11/Xaw3d/Form.h> +#elif defined(HAVE_LIB_NEXTAW) +#include <X11/neXtaw/Form.h> #endif +#endif /* OPT_TOOLBAR */ + #include <pwd.h> #include <ctype.h> @@ -120,37 +123,9 @@ #if OPT_WIDE_CHARS #include <charclass.h> +#include <wcwidth.h> #endif -#ifdef AMOEBA -#include <amoeba.h> -#include <cmdreg.h> -#include <stderr.h> -#include <thread.h> -#include <limits.h> -#include <module/proc.h> -#include <module/name.h> - -#define NILCAP ((capability *)NULL) -#endif - -#ifdef MINIX -#include <sys/nbio.h> - -#define setpgrp(pid, pgid) setpgid(pid, pgid) -#define MNX_LASTLOG -#define WTMP -/* Remap or define non-existing termios flags */ -#define OCRNL 0 -#define ONLRET 0 -#define NLDLY 0 -#define CRDLY 0 -#define TABDLY 0 -#define BSDLY 0 -#define VTDLY 0 -#define FFDLY 0 -#endif /* MINIX */ - #ifdef __osf__ #define USE_SYSV_SIGNALS #define WTMP @@ -227,18 +202,18 @@ #endif #endif -#ifdef SYSV /* { */ +#ifdef SYSV /* { */ -#ifdef USE_USG_PTYS /* AT&T SYSV has no ptyio.h */ -#include <sys/stropts.h> /* for I_PUSH */ -#include <poll.h> /* for POLLIN */ +#ifdef USE_USG_PTYS /* AT&T SYSV has no ptyio.h */ +#include <sys/stropts.h> /* for I_PUSH */ +#include <poll.h> /* for POLLIN */ #endif /* USE_USG_PTYS */ #define USE_SYSV_SIGNALS #define USE_SYSV_PGRP #if !defined(TIOCSWINSZ) -#define USE_SYSV_ENVVARS /* COLUMNS/LINES vs. TERMCAP */ +#define USE_SYSV_ENVVARS /* COLUMNS/LINES vs. TERMCAP */ #endif /* @@ -279,17 +254,19 @@ #include <sys/strredir.h> #endif -#else /* } !SYSV { */ /* BSD systems */ +#else /* } !SYSV { */ /* BSD systems */ -#ifndef MINIX /* { */ - #ifdef __QNX__ #ifndef __QNXNTO__ #define ttyslot() 1 #else #define USE_SYSV_PGRP -extern __inline__ ttyslot() {return 1;} /* yuk */ +extern __inline__ +ttyslot() +{ + return 1; /* yuk */ +} #endif #else @@ -311,10 +288,8 @@ #endif /* !linux */ #endif /* __QNX__ */ - -#endif /* } MINIX */ -#endif /* } !SYSV */ +#endif /* } !SYSV */ #if defined(SVR4) && !defined(__CYGWIN__) #define HAS_SAVED_IDS_AND_SETEUID @@ -329,8 +304,8 @@ #ifndef NOFILE #define NOFILE OPEN_MAX #endif -#elif !(defined(VMS) || defined(MINIX) || defined(WIN32) || defined(Lynx) || defined(__GNU__) || defined(__MVS__)) -#include <sys/param.h> /* for NOFILE */ +#elif !(defined(VMS) || defined(WIN32) || defined(Lynx) || defined(__GNU__) || defined(__MVS__)) +#include <sys/param.h> /* for NOFILE */ #endif #if defined(BSD) && (BSD >= 199103) @@ -348,6 +323,12 @@ #define ttyslot() 1 #endif /* apollo */ +#if defined(UTMPX_FOR_UTMP) +#define UTMP_STR utmpx +#else +#define UTMP_STR utmp +#endif + #if defined(USE_UTEMPTER) #include <utempter.h> @@ -364,7 +345,7 @@ #include <utmp.h> #if defined(_CRAY) && (OSMAJORVERSION < 8) -extern struct utmp *getutid __((struct utmp *_Id)); +extern struct utmp *getutid __((struct utmp * _Id)); #endif #endif @@ -377,6 +358,10 @@ #include <local/openpty.h> #endif /* PUCC_PTYD */ +#ifdef __OpenBSD__ +#include <util.h> +#endif + #if !defined(UTMP_FILENAME) #if defined(UTMP_FILE) #define UTMP_FILENAME UTMP_FILE @@ -391,7 +376,7 @@ #ifdef _PATH_LASTLOG #define LASTLOG_FILENAME _PATH_LASTLOG #else -#define LASTLOG_FILENAME "/usr/adm/lastlog" /* only on BSD systems */ +#define LASTLOG_FILENAME "/usr/adm/lastlog" /* only on BSD systems */ #endif #endif @@ -431,31 +416,36 @@ extern char *ptsname(int); #endif -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -extern int tgetent (char *ptr, char *name); -extern char *tgetstr (char *name, char **ptr); + extern int tgetent(char *ptr, char *name); + extern char *tgetstr(char *name, char **ptr); -#ifdef __cplusplus - } +#ifdef __cplusplus +} #endif - #ifndef VMS -static SIGNAL_T reapchild (int n); -static int spawn (void); -static void remove_termcap_entry (char *buf, char *str); +static SIGNAL_T reapchild(int n); +static int spawn(void); +static void remove_termcap_entry(char *buf, char *str); #ifdef USE_PTY_SEARCH -static int pty_search (int *pty); +static int pty_search(int *pty); #endif #endif /* ! VMS */ -static void get_terminal (void); -static void resize (TScreen *s, char *oldtc, char *newtc); +static int get_pty(int *pty, char *from); +static void get_terminal(void); +static void resize(TScreen * s, char *oldtc, char *newtc); +static void set_owner(char *device, int uid, int gid, int mode); static Bool added_utmp_entry = False; +#ifdef __OpenBSD__ +static gid_t utmpGid = -1; +#endif + #ifdef USE_SYSV_UTMP static Bool xterm_exiting = False; #endif @@ -469,15 +459,19 @@ */ static char **command_to_exec = NULL; +#if OPT_LUIT_PROG +static char **command_to_exec_with_luit = NULL; +#endif + #define TERMCAP_ERASE "kb" #define VAL_INITIAL_ERASE A2E(8) /* choose a nice default value for speed - if we make it too low, users who * mistakenly use $TERM set to vt100 will get padding delays */ -#ifdef B38400 /* everyone should define this */ +#ifdef B38400 /* everyone should define this */ #define VAL_LINE_SPEED B38400 -#else /* ...but xterm's used this for a long time */ +#else /* ...but xterm's used this for a long time */ #define VAL_LINE_SPEED B9600 #endif @@ -540,32 +534,36 @@ static struct termio d_tio; #ifdef HAS_LTCHARS static struct ltchars d_ltc; -#endif /* HAS_LTCHARS */ +#endif /* HAS_LTCHARS */ #ifdef TIOCLSET static unsigned int d_lmode; -#endif /* TIOCLSET */ +#endif /* TIOCLSET */ #elif defined(USE_POSIX_TERMIOS) static struct termios d_tio; #else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ -static struct sgttyb d_sg = { - 0, 0, 0177, CKILL, EVENP|ODDP|ECHO|XTABS|CRMOD +static struct sgttyb d_sg = +{ + 0, 0, 0177, CKILL, (EVENP | ODDP | ECHO | XTABS | CRMOD) }; -static struct tchars d_tc = { - CINTR, CQUIT, CSTART, - CSTOP, CEOF, CBRK +static struct tchars d_tc = +{ + CINTR, CQUIT, CSTART, + CSTOP, CEOF, CBRK }; -static struct ltchars d_ltc = { - CSUSP, CDSUSP, CRPRNT, - CFLUSH, CWERASE, CLNEXT +static struct ltchars d_ltc = +{ + CSUSP, CDSUSP, CRPRNT, + CFLUSH, CWERASE, CLNEXT }; static int d_disipline = NTTYDISC; -static long int d_lmode = LCRTBS|LCRTERA|LCRTKIL|LCTLECH; +static long int d_lmode = LCRTBS | LCRTERA | LCRTKIL | LCTLECH; #ifdef sony -static long int d_jmode = KM_SYSSJIS|KM_ASCII; -static struct jtchars d_jtc = { - 'J', 'B' +static long int d_jmode = KM_SYSSJIS | KM_ASCII; +static struct jtchars d_jtc = +{ + 'J', 'B' }; #endif /* sony */ #endif /* USE_ANY_SYSV_TERMIO */ @@ -577,61 +575,63 @@ * POSIX termios has termios.c_cc, which is similar to SVR4. */ static int override_tty_modes = 0; +/* *INDENT-OFF* */ struct _xttymodes { char *name; size_t len; int set; char value; } ttymodelist[] = { -{ "intr", 4, 0, '\0' }, /* tchars.t_intrc ; VINTR */ + { "intr", 4, 0, '\0' }, /* tchars.t_intrc ; VINTR */ #define XTTYMODE_intr 0 -{ "quit", 4, 0, '\0' }, /* tchars.t_quitc ; VQUIT */ + { "quit", 4, 0, '\0' }, /* tchars.t_quitc ; VQUIT */ #define XTTYMODE_quit 1 -{ "erase", 5, 0, '\0' }, /* sgttyb.sg_erase ; VERASE */ + { "erase", 5, 0, '\0' }, /* sgttyb.sg_erase ; VERASE */ #define XTTYMODE_erase 2 -{ "kill", 4, 0, '\0' }, /* sgttyb.sg_kill ; VKILL */ + { "kill", 4, 0, '\0' }, /* sgttyb.sg_kill ; VKILL */ #define XTTYMODE_kill 3 -{ "eof", 3, 0, '\0' }, /* tchars.t_eofc ; VEOF */ + { "eof", 3, 0, '\0' }, /* tchars.t_eofc ; VEOF */ #define XTTYMODE_eof 4 -{ "eol", 3, 0, '\0' }, /* VEOL */ + { "eol", 3, 0, '\0' }, /* VEOL */ #define XTTYMODE_eol 5 -{ "swtch", 5, 0, '\0' }, /* VSWTCH */ + { "swtch", 5, 0, '\0' }, /* VSWTCH */ #define XTTYMODE_swtch 6 -{ "start", 5, 0, '\0' }, /* tchars.t_startc */ + { "start", 5, 0, '\0' }, /* tchars.t_startc */ #define XTTYMODE_start 7 -{ "stop", 4, 0, '\0' }, /* tchars.t_stopc */ + { "stop", 4, 0, '\0' }, /* tchars.t_stopc */ #define XTTYMODE_stop 8 -{ "brk", 3, 0, '\0' }, /* tchars.t_brkc */ + { "brk", 3, 0, '\0' }, /* tchars.t_brkc */ #define XTTYMODE_brk 9 -{ "susp", 4, 0, '\0' }, /* ltchars.t_suspc ; VSUSP */ + { "susp", 4, 0, '\0' }, /* ltchars.t_suspc ; VSUSP */ #define XTTYMODE_susp 10 -{ "dsusp", 5, 0, '\0' }, /* ltchars.t_dsuspc ; VDSUSP */ + { "dsusp", 5, 0, '\0' }, /* ltchars.t_dsuspc ; VDSUSP */ #define XTTYMODE_dsusp 11 -{ "rprnt", 5, 0, '\0' }, /* ltchars.t_rprntc ; VREPRINT */ + { "rprnt", 5, 0, '\0' }, /* ltchars.t_rprntc ; VREPRINT */ #define XTTYMODE_rprnt 12 -{ "flush", 5, 0, '\0' }, /* ltchars.t_flushc ; VDISCARD */ + { "flush", 5, 0, '\0' }, /* ltchars.t_flushc ; VDISCARD */ #define XTTYMODE_flush 13 -{ "weras", 5, 0, '\0' }, /* ltchars.t_werasc ; VWERASE */ + { "weras", 5, 0, '\0' }, /* ltchars.t_werasc ; VWERASE */ #define XTTYMODE_weras 14 -{ "lnext", 5, 0, '\0' }, /* ltchars.t_lnextc ; VLNEXT */ + { "lnext", 5, 0, '\0' }, /* ltchars.t_lnextc ; VLNEXT */ #define XTTYMODE_lnext 15 -{ "status", 6, 0, '\0' }, /* VSTATUS */ + { "status", 6, 0, '\0' }, /* VSTATUS */ #define XTTYMODE_status 16 -{ NULL, 0, 0, '\0' }, /* end of data */ + { NULL, 0, 0, '\0' }, /* end of data */ }; +/* *INDENT-ON* */ #define TMODE(ind,var) if (ttymodelist[ind].set) var = ttymodelist[ind].value -static int parse_tty_modes (char *s, struct _xttymodes *modelist); +static int parse_tty_modes(char *s, struct _xttymodes *modelist); #ifdef USE_SYSV_UTMP #if (defined(AIXV3) && (OSMAJORVERSION < 4)) && !(defined(getutid)) extern struct utmp *getutid(); #endif /* AIXV3 */ -#else /* not USE_SYSV_UTMP */ +#else /* not USE_SYSV_UTMP */ static char etc_utmp[] = UTMP_FILENAME; -#endif /* USE_SYSV_UTMP */ +#endif /* USE_SYSV_UTMP */ #ifdef USE_LASTLOG static char etc_lastlog[] = LASTLOG_FILENAME; @@ -663,105 +663,74 @@ #define MIT_CONSOLE "MIT_CONSOLE_" static char mit_console_name[255 + MIT_CONSOLE_LEN + 1] = MIT_CONSOLE; static Atom mit_console; -#endif /* TIOCCONS */ +#endif /* TIOCCONS */ #ifndef USE_SYSV_UTMP static int tslot; -#endif /* USE_SYSV_UTMP */ +#endif /* USE_SYSV_UTMP */ static sigjmp_buf env; -char *ProgramName; - -static struct _resource { - char *xterm_name; - char *icon_geometry; - char *title; - char *icon_name; - char *term_name; - char *tty_modes; - Boolean hold_screen; /* true if we keep window open */ - Boolean utmpInhibit; - Boolean messages; - Boolean sunFunctionKeys; /* %%% should be widget resource? */ -#if OPT_SUNPC_KBD - Boolean sunKeyboard; -#endif -#if OPT_HP_FUNC_KEYS - Boolean hpFunctionKeys; -#endif -#if OPT_INITIAL_ERASE - Boolean ptyInitialErase; /* if true, use pty's sense of erase char */ - Boolean backarrow_is_erase; /* override backspace/delete */ -#endif - Boolean wait_for_map; - Boolean useInsertMode; -#if OPT_ZICONBEEP - int zIconBeep; /* beep level when output while iconified */ -#endif -#if OPT_SAME_NAME - Boolean sameName; /* Don't change the title or icon name if it is - * the same. This prevents flicker on the - * screen at the cost of an extra request to - * the server. - */ -#endif -} resource; - /* used by VT (charproc.c) */ -#define offset(field) XtOffsetOf(struct _resource, field) +#define offset(field) XtOffsetOf(XTERM_RESOURCE, field) -static XtResource application_resources[] = { +static XtResource application_resources[] = +{ {"name", "Name", XtRString, sizeof(char *), - offset(xterm_name), XtRString, DFT_TERMTYPE}, + offset(xterm_name), XtRString, DFT_TERMTYPE}, {"iconGeometry", "IconGeometry", XtRString, sizeof(char *), - offset(icon_geometry), XtRString, (caddr_t) NULL}, + offset(icon_geometry), XtRString, (caddr_t) NULL}, {XtNtitle, XtCTitle, XtRString, sizeof(char *), - offset(title), XtRString, (caddr_t) NULL}, + offset(title), XtRString, (caddr_t) NULL}, {XtNiconName, XtCIconName, XtRString, sizeof(char *), - offset(icon_name), XtRString, (caddr_t) NULL}, + offset(icon_name), XtRString, (caddr_t) NULL}, {"termName", "TermName", XtRString, sizeof(char *), - offset(term_name), XtRString, (caddr_t) NULL}, + offset(term_name), XtRString, (caddr_t) NULL}, {"ttyModes", "TtyModes", XtRString, sizeof(char *), - offset(tty_modes), XtRString, (caddr_t) NULL}, - {"hold", "Hold", XtRBoolean, sizeof (Boolean), - offset(hold_screen), XtRString, "false"}, - {"utmpInhibit", "UtmpInhibit", XtRBoolean, sizeof (Boolean), - offset(utmpInhibit), XtRString, "false"}, - {"messages", "Messages", XtRBoolean, sizeof (Boolean), - offset(messages), XtRString, "true"}, - {"sunFunctionKeys", "SunFunctionKeys", XtRBoolean, sizeof (Boolean), - offset(sunFunctionKeys), XtRString, "false"}, + offset(tty_modes), XtRString, (caddr_t) NULL}, + {"hold", "Hold", XtRBoolean, sizeof(Boolean), + offset(hold_screen), XtRString, "false"}, + {"utmpInhibit", "UtmpInhibit", XtRBoolean, sizeof(Boolean), + offset(utmpInhibit), XtRString, "false"}, + {"messages", "Messages", XtRBoolean, sizeof(Boolean), + offset(messages), XtRString, "true"}, + {"sunFunctionKeys", "SunFunctionKeys", XtRBoolean, sizeof(Boolean), + offset(sunFunctionKeys), XtRString, "false"}, #if OPT_SUNPC_KBD - {"sunKeyboard", "SunKeyboard", XtRBoolean, sizeof (Boolean), - offset(sunKeyboard), XtRString, "false"}, + {"sunKeyboard", "SunKeyboard", XtRBoolean, sizeof(Boolean), + offset(sunKeyboard), XtRString, "false"}, #endif #if OPT_HP_FUNC_KEYS - {"hpFunctionKeys", "HpFunctionKeys", XtRBoolean, sizeof (Boolean), - offset(hpFunctionKeys), XtRString, "false"}, + {"hpFunctionKeys", "HpFunctionKeys", XtRBoolean, sizeof(Boolean), + offset(hpFunctionKeys), XtRString, "false"}, #endif #if OPT_INITIAL_ERASE - {"ptyInitialErase", "PtyInitialErase", XtRBoolean, sizeof (Boolean), - offset(ptyInitialErase), XtRString, "false"}, + {"ptyInitialErase", "PtyInitialErase", XtRBoolean, sizeof(Boolean), + offset(ptyInitialErase), XtRString, "false"}, {"backarrowKeyIsErase", "BackarrowKeyIsErase", XtRBoolean, sizeof(Boolean), - offset(backarrow_is_erase), XtRString, "false"}, + offset(backarrow_is_erase), XtRString, "false"}, #endif - {"waitForMap", "WaitForMap", XtRBoolean, sizeof (Boolean), - offset(wait_for_map), XtRString, "false"}, - {"useInsertMode", "UseInsertMode", XtRBoolean, sizeof (Boolean), - offset(useInsertMode), XtRString, "false"}, + {"waitForMap", "WaitForMap", XtRBoolean, sizeof(Boolean), + offset(wait_for_map), XtRString, "false"}, + {"useInsertMode", "UseInsertMode", XtRBoolean, sizeof(Boolean), + offset(useInsertMode), XtRString, "false"}, #if OPT_ZICONBEEP - {"zIconBeep", "ZIconBeep", XtRInt, sizeof (int), - offset(zIconBeep), XtRImmediate, 0}, + {"zIconBeep", "ZIconBeep", XtRInt, sizeof(int), + offset(zIconBeep), XtRImmediate, 0}, #endif #if OPT_SAME_NAME - {"sameName", "SameName", XtRBoolean, sizeof (Boolean), - offset(sameName), XtRString, "true"}, + {"sameName", "SameName", XtRBoolean, sizeof(Boolean), + offset(sameName), XtRString, "true"}, +#endif +#if OPT_SESSION_MGT + {"sessionMgt", "SessionMgt", XtRBoolean, sizeof(Boolean), + offset(sessionMgt), XtRString, "true"}, #endif }; #undef offset -static char *fallback_resources[] = { +static char *fallback_resources[] = +{ "*SimpleMenu*menuLabel.vertSpace: 100", "*SimpleMenu*HorizontalMargins: 16", "*SimpleMenu*Sme.height: 16", @@ -777,7 +746,7 @@ /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XrmParseCommand is let loose. */ - +/* *INDENT-OFF* */ static XrmOptionDescRec optionDescList[] = { {"-geometry", "*vt100.geometry",XrmoptionSepArg, (caddr_t) NULL}, {"-132", "*c132", XrmoptionNoArg, (caddr_t) "on"}, @@ -892,6 +861,12 @@ {"-u8", "*utf8", XrmoptionNoArg, (caddr_t) "2"}, {"+u8", "*utf8", XrmoptionNoArg, (caddr_t) "0"}, #endif +#if OPT_LUIT_PROG +{"-lc", "*locale", XrmoptionNoArg, (caddr_t) "True"}, +{"+lc", "*locale", XrmoptionNoArg, (caddr_t) "False"}, +{"-lcc", "*localeFilter",XrmoptionSepArg, (caddr_t) NULL}, +{"-en", "*locale", XrmoptionSepArg, (caddr_t) NULL}, +#endif {"-ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "off"}, {"+ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "on"}, {"-ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "on"}, @@ -905,6 +880,8 @@ #if OPT_WIDE_CHARS {"-wc", "*wideChars", XrmoptionNoArg, (caddr_t) "on"}, {"+wc", "*wideChars", XrmoptionNoArg, (caddr_t) "off"}, +{"-cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "on"}, +{"+cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "off"}, #endif {"-wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "on"}, {"+wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "off"}, @@ -915,13 +892,18 @@ {"-samename", "*sameName", XrmoptionNoArg, (caddr_t) "on"}, {"+samename", "*sameName", XrmoptionNoArg, (caddr_t) "off"}, #endif +#if OPT_SESSION_MGT +{"-sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "on"}, +{"+sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "off"}, +#endif /* options that we process ourselves */ {"-help", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, {"-version", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, {"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, {"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, +{"-into", NULL, XrmoptionSkipArg, (caddr_t) NULL}, /* bogus old compatibility stuff for which there are - standard XtAppInitialize options now */ + standard XtOpenApplication options now */ {"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, {"#", ".iconGeometry",XrmoptionStickyArg, (caddr_t) NULL}, {"-T", ".title", XrmoptionSepArg, (caddr_t) NULL}, @@ -933,7 +915,7 @@ {"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, }; -static OptionHelp options[] = { +static OptionHelp xtermOptions[] = { { "-version", "print the version number" }, { "-help", "print out this message" }, { "-display displayname", "X server to contact" }, @@ -945,7 +927,7 @@ { "-bw number", "border width in pixels" }, { "-fn fontname", "normal text font" }, { "-fb fontname", "bold text font" }, -{ "-/+fbb", "turn on/off bold font's box checking"}, +{ "-/+fbb", "turn on/off normal/bold font comparison inhibit"}, { "-/+fbx", "turn off/on linedrawing characters"}, #ifdef XRENDERFONT { "-fa pattern", "FreeType font-selection pattern" }, @@ -963,10 +945,10 @@ { "-class string", "class string (XTerm)" }, { "-title string", "title string" }, { "-xrm resourcestring", "additional resource specifications" }, -{ "-/+132", "turn on/off column switch inhibiting" }, +{ "-/+132", "turn on/off 80/132 column switching" }, { "-/+ah", "turn on/off always highlight" }, #ifndef NO_ACTIVE_ICON -{ "-/+ai", "turn on/off active icon" }, +{ "-/+ai", "turn off/on active icon" }, { "-fi fontname", "icon font for active icon" }, #endif /* NO_ACTIVE_ICON */ { "-b number", "internal border in pixels" }, @@ -982,7 +964,7 @@ { "-/+cu", "turn on/off curses emulation" }, { "-/+dc", "turn off/on dynamic color selection" }, #if OPT_HIGHLIGHT_COLOR -{ "-hc", "selection background color" }, +{ "-hc color", "selection background color" }, #endif #if OPT_HP_FUNC_KEYS { "-/+hf", "turn on/off HP Function Key escape codes" }, @@ -1006,7 +988,7 @@ { "-/+mesg", "forbid/allow messages" }, { "-ms color", "pointer color" }, { "-nb number", "margin bell in characters from right end" }, -{ "-/+nul", "turn on/off display of underlining" }, +{ "-/+nul", "turn off/on display of underlining" }, { "-/+aw", "turn on/off auto wraparound" }, { "-/+pc", "turn on/off PC-style bold colors" }, { "-/+rw", "turn on/off reverse wraparound" }, @@ -1033,16 +1015,21 @@ #if OPT_WIDE_CHARS { "-/+u8", "turn on/off UTF-8 mode (implies wide-characters)" }, #endif +#if OPT_LUIT_PROG +{ "-/+lc", "turn on/off locale mode using luit" }, +{ "-lcc path", "filename of locale converter (" DEFLOCALEFILTER ")" }, +#endif { "-/+ulc", "turn off/on display of underline as color" }, #ifdef HAVE_UTMP -{ "-/+ut", "turn on/off utmp inhibit" }, +{ "-/+ut", "turn on/off utmp support" }, #else -{ "-/+ut", "turn on/off utmp inhibit (not supported)" }, +{ "-/+ut", "turn on/off utmp support (not available)" }, #endif { "-/+vb", "turn on/off visual bell" }, { "-/+pob", "turn on/off pop on bell" }, #if OPT_WIDE_CHARS { "-/+wc", "turn on/off wide-character mode" }, +{ "-/+cjk_width", "turn on/off legacy CJK width convention" }, #endif { "-/+wf", "turn on/off wait for map before command exec" }, { "-e command args ...", "command to execute" }, @@ -1058,29 +1045,37 @@ { "-C", "intercept console messages (not supported)" }, #endif { "-Sccn", "slave mode on \"ttycc\", file descriptor \"n\"" }, +{ "-into windowId", "use the window id given to -into as the parent window rather than the default root window" }, #if OPT_ZICONBEEP { "-ziconbeep percent", "beep and flag icon of window having hidden output" }, #endif #if OPT_SAME_NAME { "-/+samename", "turn on/off the no-flicker option for title and icon name" }, #endif +#if OPT_SESSION_MGT +{ "-/+sm", "turn on/off the session-management support" }, +#endif { NULL, NULL }}; +/* *INDENT-ON* */ -static char *message[] = { -"Fonts should be fixed width and, if both normal and bold are specified, should", -"have the same size. If only a normal font is specified, it will be used for", -"both normal and bold text (by doing overstriking). The -e option, if given,", -"must appear at the end of the command line, otherwise the user's default shell", -"will be started. Options that start with a plus sign (+) restore the default.", -NULL}; +static char *message[] = +{ + "Fonts should be fixed width and, if both normal and bold are specified, should", + "have the same size. If only a normal font is specified, it will be used for", + "both normal and bold text (by doing overstriking). The -e option, if given,", + "must appear at the end of the command line, otherwise the user's default shell", + "will be started. Options that start with a plus sign (+) restore the default.", + NULL}; /* * Decode a key-definition. This combines the termcap and ttyModes, for * comparison. Note that octal escapes in ttyModes are done by the normal * resource translation. Also, ttyModes allows '^-' as a synonym for disabled. */ -static int decode_keyvalue(char *string, int termcap) +static int +decode_keyvalue(char **ptr, int termcap) { + char *string = *ptr; int value = -1; TRACE(("...decode '%s'\n", string)); @@ -1115,14 +1110,19 @@ value = CONTROL(*string); break; } + ++string; } else if (termcap && (*string == '\\')) { char *d; - int temp = strtol(string, &d, 8); - if (temp > 0 && d != string) + int temp = strtol(string + 1, &d, 8); + if (temp > 0 && d != string) { value = temp; + string = d; + } } else { value = CharOf(*string); + ++string; } + *ptr = string; return value; } @@ -1130,21 +1130,22 @@ * If we're linked to terminfo, tgetent() will return an empty buffer. We * cannot use that to adjust the $TERMCAP variable. */ -static Boolean get_termcap(char *name, char *buffer, char *resized) +static Boolean +get_termcap(char *name, char *buffer, char *resized) { register TScreen *screen = &term->screen; - *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ + *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ if (name != 0) { - if (tgetent (buffer, name) == 1) { + if (tgetent(buffer, name) == 1) { TRACE(("get_termcap(%s) succeeded (%s)\n", name, - *buffer - ? "ok:termcap, we can update $TERMCAP" - : "assuming this is terminfo")); + (*buffer + ? "ok:termcap, we can update $TERMCAP" + : "assuming this is terminfo"))); if (*buffer) { if (!TEK4014_ACTIVE(screen)) { - resize (screen, buffer, resized); + resize(screen, buffer, resized); } } return True; @@ -1155,136 +1156,154 @@ return False; } -static int abbrev (char *tst, char *cmp, size_t need) +static int +abbrev(char *tst, char *cmp, size_t need) { - size_t len = strlen(tst); - return ((len >= need) && (!strncmp(tst, cmp, len))); + size_t len = strlen(tst); + return ((len >= need) && (!strncmp(tst, cmp, len))); } -static void Syntax (char *badOption) +static void +Syntax(char *badOption) { OptionHelp *opt; + OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList)); int col; - fprintf (stderr, "%s: bad command line option \"%s\"\r\n\n", - ProgramName, badOption); + fprintf(stderr, "%s: bad command line option \"%s\"\r\n\n", + ProgramName, badOption); - fprintf (stderr, "usage: %s", ProgramName); + fprintf(stderr, "usage: %s", ProgramName); col = 8 + strlen(ProgramName); - for (opt = options; opt->opt; opt++) { - int len = 3 + strlen(opt->opt); /* space [ string ] */ + for (opt = list; opt->opt; opt++) { + int len = 3 + strlen(opt->opt); /* space [ string ] */ if (col + len > 79) { - fprintf (stderr, "\r\n "); /* 3 spaces */ + fprintf(stderr, "\r\n "); /* 3 spaces */ col = 3; } - fprintf (stderr, " [%s]", opt->opt); + fprintf(stderr, " [%s]", opt->opt); col += len; } - fprintf (stderr, "\r\n\nType %s -help for a full description.\r\n\n", - ProgramName); - exit (1); + fprintf(stderr, "\r\n\nType %s -help for a full description.\r\n\n", + ProgramName); + exit(1); } -static void Version (void) +static void +Version(void) { printf("%s(%d)\n", XFREE86_VERSION, XTERM_PATCH); fflush(stdout); } -static void Help (void) +static void +Help(void) { OptionHelp *opt; + OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList)); char **cpp; - fprintf (stderr, "%s(%d) usage:\n %s [-options ...] [-e command args]\n\n", - XFREE86_VERSION, XTERM_PATCH, ProgramName); - fprintf (stderr, "where options include:\n"); - for (opt = options; opt->opt; opt++) { - fprintf (stderr, " %-28s %s\n", opt->opt, opt->desc); + fprintf(stderr, + "%s(%d) usage:\n %s [-options ...] [-e command args]\n\n", + XFREE86_VERSION, XTERM_PATCH, ProgramName); + fprintf(stderr, "where options include:\n"); + for (opt = list; opt->opt; opt++) { + fprintf(stderr, " %-28s %s\n", opt->opt, opt->desc); } - putc ('\n', stderr); + putc('\n', stderr); for (cpp = message; *cpp; cpp++) { - fputs (*cpp, stderr); - putc ('\n', stderr); + fputs(*cpp, stderr); + putc('\n', stderr); } - putc ('\n', stderr); + putc('\n', stderr); fflush(stderr); } #if defined(TIOCCONS) || defined(SRIOCSREDIR) /* ARGSUSED */ static Boolean -ConvertConsoleSelection( - Widget w GCC_UNUSED, - Atom *selection GCC_UNUSED, - Atom *target GCC_UNUSED, - Atom *type GCC_UNUSED, - XtPointer *value GCC_UNUSED, - unsigned long *length GCC_UNUSED, - int *format GCC_UNUSED) +ConvertConsoleSelection(Widget w GCC_UNUSED, + Atom * selection GCC_UNUSED, + Atom * target GCC_UNUSED, + Atom * type GCC_UNUSED, + XtPointer * value GCC_UNUSED, + unsigned long *length GCC_UNUSED, + int *format GCC_UNUSED) { /* we don't save console output, so can't offer it */ return False; } #endif /* TIOCCONS */ -Arg ourTopLevelShellArgs[] = { - { XtNallowShellResize, (XtArgVal) TRUE }, - { XtNinput, (XtArgVal) TRUE }, -}; -int number_ourTopLevelShellArgs = 2; +#if OPT_SESSION_MGT +static void +die_callback(Widget w GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + XtPointer call_data GCC_UNUSED) +{ + Cleanup(0); +} + +static void +save_callback(Widget w GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + XtPointer call_data) +{ + XtCheckpointToken token = (XtCheckpointToken) call_data; + /* we have nothing to save */ + token->save_success = True; +} +#endif /* OPT_SESSION_MGT */ -Bool waiting_for_initial_map; +#if OPT_WIDE_CHARS +int (*my_wcwidth) (wchar_t); +#endif /* * DeleteWindow(): Action proc to implement ICCCM delete_window. */ /* ARGSUSED */ static void -DeleteWindow( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +DeleteWindow(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { #if OPT_TEK4014 - if (w == toplevel) { - if (term->screen.Tshow) - hide_vt_window(); - else - do_hangup(w, (XtPointer)0, (XtPointer)0); - } else - if (term->screen.Vshow) - hide_tek_window(); + if (w == toplevel) { + if (term->screen.Tshow) + hide_vt_window(); + else + do_hangup(w, (XtPointer) 0, (XtPointer) 0); + } else if (term->screen.Vshow) + hide_tek_window(); else #endif - do_hangup(w, (XtPointer)0, (XtPointer)0); + do_hangup(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ static void -KeyboardMapping( - Widget w GCC_UNUSED, - XEvent *event, - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +KeyboardMapping(Widget w GCC_UNUSED, + XEvent * event, + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { switch (event->type) { - case MappingNotify: - XRefreshKeyboardMapping(&event->xmapping); - break; + case MappingNotify: + XRefreshKeyboardMapping(&event->xmapping); + break; } } -XtActionsRec actionProcs[] = { - { "DeleteWindow", DeleteWindow }, - { "KeyboardMapping", KeyboardMapping }, +XtActionsRec actionProcs[] = +{ + {"DeleteWindow", DeleteWindow}, + {"KeyboardMapping", KeyboardMapping}, }; -Atom wm_delete_window; - /* * Some platforms use names such as /dev/tty01, others /dev/pts/1. Parse off * the "tty01" or "pts/1" portion, and return that for use as an identifier for @@ -1293,26 +1312,26 @@ static char * my_pty_name(char *device) { - size_t len = strlen(device); - Boolean name = False; + size_t len = strlen(device); + Boolean name = False; - while (len != 0) { - int ch = device[len-1]; - if (isdigit(ch)) { - len--; - } else if (ch == '/') { - if (name) - break; - len--; - } else if (isalpha(ch)) { - name = True; - len--; - } else { - break; - } + while (len != 0) { + int ch = device[len - 1]; + if (isdigit(ch)) { + len--; + } else if (ch == '/') { + if (name) + break; + len--; + } else if (isalpha(ch)) { + name = True; + len--; + } else { + break; } - TRACE(("my_pty_name(%s) -> '%s'\n", device, device + len)); - return device + len; + } + TRACE(("my_pty_name(%s) -> '%s'\n", device, device + len)); + return device + len; } /* @@ -1322,16 +1341,16 @@ static char * my_pty_id(char *device) { - char *name = my_pty_name(device); - char *leaf = x_basename(name); + char *name = my_pty_name(device); + char *leaf = x_basename(name); - if (name == leaf) { /* no '/' in the name */ - int len = strlen(leaf); - if (PTYCHARLEN < len) - leaf = leaf + (len - PTYCHARLEN); - } - TRACE(("my_pty_id (%s) -> '%s'\n", device, leaf)); - return leaf; + if (name == leaf) { /* no '/' in the name */ + int len = strlen(leaf); + if (PTYCHARLEN < len) + leaf = leaf + (len - PTYCHARLEN); + } + TRACE(("my_pty_id (%s) -> '%s'\n", device, leaf)); + return leaf; } /* @@ -1340,15 +1359,15 @@ static void set_pty_id(char *device, char *id) { - char *name = my_pty_name(device); - char *leaf = x_basename(name); + char *name = my_pty_name(device); + char *leaf = x_basename(name); - if (name == leaf) { - strcpy(my_pty_id(device), id); - } else { - strcpy(leaf, id); - } - TRACE(("set_pty_id(%s) -> '%s'\n", id, device)); + if (name == leaf) { + strcpy(my_pty_id(device), id); + } else { + strcpy(leaf, id); + } + TRACE(("set_pty_id(%s) -> '%s'\n", id, device)); } /* @@ -1360,34 +1379,34 @@ static Boolean ParseSccn(char *option) { - char *leaf = x_basename(option); - Boolean code = False; + char *leaf = x_basename(option); + Boolean code = False; - if (leaf != option) { - if (leaf - option > 1 - && leaf - option <= PTYCHARLEN - && sscanf(leaf, "%d", &am_slave) == 1) { - size_t len = leaf - option - 1; - /* - * If the given length is less than PTYCHARLEN, that is - * all right because the calling application may be - * giving us a path for /dev/pts, which would be - * followed by one or more decimal digits. - * - * For fixed-width fields, it is up to the calling - * application to provide leading 0's, if needed. - */ - strncpy(passedPty, option, len); - passedPty[len] = 0; - code = True; - } - } else { - code = (sscanf(option, "%c%c%d", - passedPty, passedPty+1, &am_slave) == 3); + if (leaf != option) { + if (leaf - option > 1 + && leaf - option <= PTYCHARLEN + && sscanf(leaf, "%d", &am_slave) == 1) { + size_t len = leaf - option - 1; + /* + * If the given length is less than PTYCHARLEN, that is + * all right because the calling application may be + * giving us a path for /dev/pts, which would be + * followed by one or more decimal digits. + * + * For fixed-width fields, it is up to the calling + * application to provide leading 0's, if needed. + */ + strncpy(passedPty, option, len); + passedPty[len] = 0; + code = True; } - TRACE(("ParseSccn(%s) = '%s' %d (%s)\n", option, - passedPty, am_slave, code ? "OK" : "ERR")); - return code; + } else { + code = (sscanf(option, "%c%c%d", + passedPty, passedPty + 1, &am_slave) == 3); + } + TRACE(("ParseSccn(%s) = '%s' %d (%s)\n", option, + passedPty, am_slave, code ? "OK" : "ERR")); + return code; } #ifdef USE_SYSV_UTMP @@ -1401,770 +1420,809 @@ * ut_time, ut_user and ut_host as well. * * Generally ut_id allows no more than 3 characters (plus null), even if the - * pty implementation allows more than 3 digits. + * pty implementation allows more than 3 digits. */ static char * my_utmp_id(char *device) { - static char result[PTYCHARLEN + 4]; - char *name = my_pty_name(device); - char *leaf = x_basename(name); - - if (name == leaf) { /* no '/' in the name */ - int len = strlen(leaf); - if (PTYCHARLEN < len) - leaf = leaf + (len - PTYCHARLEN); - strcpy(result, leaf); - } else { - sprintf(result, "p%s", leaf); - } - TRACE(("my_utmp_id (%s) -> '%s'\n", device, result)); - return result; + static char result[PTYCHARLEN + 4]; + char *name = my_pty_name(device); + char *leaf = x_basename(name); + + if (name == leaf) { /* no '/' in the name */ + int len = strlen(leaf); + if (PTYCHARLEN < len) + leaf = leaf + (len - PTYCHARLEN); + strcpy(result, leaf); + } else { + sprintf(result, "p%s", leaf); + } + TRACE(("my_utmp_id (%s) -> '%s'\n", device, result)); + return result; } #endif #ifdef USE_POSIX_SIGNALS -typedef void (*sigfunc)(int); +typedef void (*sigfunc) (int); -/* make sure we sure we ignore SIGCHLD for the cases parent +/* make sure we sure we ignore SIGCHLD for the cases parent has just been stopped and not actually killed */ static sigfunc posix_signal(int signo, sigfunc func) { - struct sigaction act, oact; + struct sigaction act, oact; - act.sa_handler = func; - sigemptyset(&act.sa_mask); + act.sa_handler = func; + sigemptyset(&act.sa_mask); #ifdef SA_RESTART - act.sa_flags = SA_NOCLDSTOP|SA_RESTART; + act.sa_flags = SA_NOCLDSTOP | SA_RESTART; #else - act.sa_flags = SA_NOCLDSTOP; + act.sa_flags = SA_NOCLDSTOP; #endif - if (sigaction(signo, &act, &oact) < 0) - return(SIG_ERR); - return (oact.sa_handler); + if (sigaction(signo, &act, &oact) < 0) + return (SIG_ERR); + return (oact.sa_handler); } #endif /* linux && _POSIX_SOURCE */ int -main (int argc, char *argv[]) +main(int argc, char *argv[]ENVP_ARG) { - Widget form_top, menu_top; - register TScreen *screen; - int mode; - char *my_class = DEFCLASS; - - /* Do these first, since we may not be able to open the display */ - ProgramName = argv[0]; - TRACE_OPTS(options, optionDescList, XtNumber(optionDescList)); - TRACE_ARGV("Before XtAppInitialize", argv); - if (argc > 1) { - int n; - int unique = 2; - Boolean quit = True; - - for (n = 1; n < argc; n++) { - TRACE(("parsing %s\n", argv[n])); - if (abbrev(argv[n], "-version", unique)) { - Version(); - } else if (abbrev(argv[n], "-help", unique)) { - Help(); - } else if (abbrev(argv[n], "-class", 3)) { - if ((my_class = argv[++n]) == 0) { - Help(); - } else { - quit = False; - } - unique = 3; - } else { - quit = False; - unique = 3; - } - } - if (quit) - exit(0); - } + Widget form_top, menu_top; + register TScreen *screen; + int mode; + char *my_class = DEFCLASS; + Window winToEmbedInto = None; - /* This dumps core on HP-UX 9.05 with X11R5 */ -#if OPT_I18N_SUPPORT - XtSetLanguageProc (NULL, NULL, NULL); -#endif + ProgramName = argv[0]; -#ifndef AMOEBA - /* extra length in case longer tty name like /dev/ttyq255 */ - ttydev = (char *) malloc (sizeof(TTYDEV) + 80); + /* extra length in case longer tty name like /dev/ttyq255 */ + ttydev = (char *) malloc(sizeof(TTYDEV) + 80); #ifdef USE_PTY_DEVICE - ptydev = (char *) malloc (sizeof(PTYDEV) + 80); - if (!ttydev || !ptydev) + ptydev = (char *) malloc(sizeof(PTYDEV) + 80); + if (!ttydev || !ptydev) #else - if (!ttydev) + if (!ttydev) #endif - { - fprintf (stderr, - "%s: unable to allocate memory for ttydev or ptydev\n", - ProgramName); - exit (1); - } - strcpy (ttydev, TTYDEV); + { + fprintf(stderr, + "%s: unable to allocate memory for ttydev or ptydev\n", + ProgramName); + exit(1); + } + strcpy(ttydev, TTYDEV); #ifdef USE_PTY_DEVICE - strcpy (ptydev, PTYDEV); + strcpy(ptydev, PTYDEV); +#endif + +#ifdef __OpenBSD__ + get_pty(NULL, NULL); + seteuid(getuid()); + setuid(getuid()); +#endif /* __OpenBSD__ */ + + /* Do these first, since we may not be able to open the display */ + TRACE_OPTS(xtermOptions, optionDescList, XtNumber(optionDescList)); + TRACE_ARGV("Before XtOpenApplication", argv); + if (argc > 1) { + int n; + int unique = 2; + Boolean quit = True; + + for (n = 1; n < argc; n++) { + TRACE(("parsing %s\n", argv[n])); + if (abbrev(argv[n], "-version", unique)) { + Version(); + } else if (abbrev(argv[n], "-help", unique)) { + Help(); + } else if (abbrev(argv[n], "-class", 3)) { + if ((my_class = argv[++n]) == 0) { + Help(); + } else { + quit = False; + } + unique = 3; + } else { + quit = False; + unique = 3; + } + } + if (quit) + exit(0); + } + + /* This dumps core on HP-UX 9.05 with X11R5 */ +#if OPT_I18N_SUPPORT + XtSetLanguageProc(NULL, NULL, NULL); #endif -#ifdef MINIX - d_tio.c_iflag= TINPUT_DEF; - d_tio.c_oflag= TOUTPUT_DEF; - d_tio.c_cflag= TCTRL_DEF; - d_tio.c_lflag= TLOCAL_DEF; - cfsetispeed(&d_tio, TSPEED_DEF); - cfsetispeed(&d_tio, TSPEED_DEF); - d_tio.c_cc[VEOF]= TEOF_DEF; - d_tio.c_cc[VEOL]= TEOL_DEF; - d_tio.c_cc[VERASE]= TERASE_DEF; - d_tio.c_cc[VINTR]= TINTR_DEF; - d_tio.c_cc[VKILL]= TKILL_DEF; - d_tio.c_cc[VMIN]= TMIN_DEF; - d_tio.c_cc[VQUIT]= TQUIT_DEF; - d_tio.c_cc[VTIME]= TTIME_DEF; - d_tio.c_cc[VSUSP]= TSUSP_DEF; - d_tio.c_cc[VSTART]= TSTART_DEF; - d_tio.c_cc[VSTOP]= TSTOP_DEF; - d_tio.c_cc[VREPRINT]= TREPRINT_DEF; - d_tio.c_cc[VLNEXT]= TLNEXT_DEF; - d_tio.c_cc[VDISCARD]= TDISCARD_DEF; -#elif defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) /* { */ - /* Initialization is done here rather than above in order - ** to prevent any assumptions about the order of the contents - ** of the various terminal structures (which may change from - ** implementation to implementation). - */ - d_tio.c_iflag = ICRNL|IXON; +#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) /* { */ + /* Initialization is done here rather than above in order + * to prevent any assumptions about the order of the contents + * of the various terminal structures (which may change from + * implementation to implementation). + */ + d_tio.c_iflag = ICRNL | IXON; #ifdef TAB3 - d_tio.c_oflag = OPOST|ONLCR|TAB3; + d_tio.c_oflag = OPOST | ONLCR | TAB3; #else #ifdef ONLCR - d_tio.c_oflag = OPOST|ONLCR; + d_tio.c_oflag = OPOST | ONLCR; #else - d_tio.c_oflag = OPOST; + d_tio.c_oflag = OPOST; #endif #endif -#if defined(macII) || defined(ATT) || defined(CRAY) /* { */ - d_tio.c_cflag = VAL_LINE_SPEED|CS8|CREAD|PARENB|HUPCL; - d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; +#if defined(macII) || defined(ATT) || defined(CRAY) /* { */ + d_tio.c_cflag = VAL_LINE_SPEED | CS8 | CREAD | PARENB | HUPCL; + d_tio.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK; #ifdef ECHOKE - d_tio.c_lflag |= ECHOKE|IEXTEN; + d_tio.c_lflag |= ECHOKE | IEXTEN; #endif #ifdef ECHOCTL - d_tio.c_lflag |= ECHOCTL|IEXTEN; + d_tio.c_lflag |= ECHOCTL | IEXTEN; #endif -#ifndef USE_TERMIOS /* { */ - d_tio.c_line = 0; +#ifndef USE_TERMIOS /* { */ + d_tio.c_line = 0; #endif /* } */ - d_tio.c_cc[VINTR] = CINTR; - d_tio.c_cc[VQUIT] = CQUIT; - d_tio.c_cc[VERASE] = CERASE; - d_tio.c_cc[VKILL] = CKILL; - d_tio.c_cc[VEOF] = CEOF; - d_tio.c_cc[VEOL] = CNUL; - d_tio.c_cc[VEOL2] = CNUL; + d_tio.c_cc[VINTR] = CINTR; + d_tio.c_cc[VQUIT] = CQUIT; + d_tio.c_cc[VERASE] = CERASE; + d_tio.c_cc[VKILL] = CKILL; + d_tio.c_cc[VEOF] = CEOF; + d_tio.c_cc[VEOL] = CNUL; + d_tio.c_cc[VEOL2] = CNUL; #ifdef VSWTCH - d_tio.c_cc[VSWTCH] = CNUL; + d_tio.c_cc[VSWTCH] = CNUL; #endif -#if defined(USE_TERMIOS) || defined(USE_POSIX_TERMIOS) /* { */ - d_tio.c_cc[VSUSP] = CSUSP; +#if defined(USE_TERMIOS) || defined(USE_POSIX_TERMIOS) /* { */ + d_tio.c_cc[VSUSP] = CSUSP; #ifdef VDSUSP - d_tio.c_cc[VDSUSP] = CDSUSP; + d_tio.c_cc[VDSUSP] = CDSUSP; #endif - d_tio.c_cc[VREPRINT] = CRPRNT; - d_tio.c_cc[VDISCARD] = CFLUSH; - d_tio.c_cc[VWERASE] = CWERASE; - d_tio.c_cc[VLNEXT] = CLNEXT; - d_tio.c_cc[VMIN] = 1; - d_tio.c_cc[VTIME] = 0; + d_tio.c_cc[VREPRINT] = CRPRNT; + d_tio.c_cc[VDISCARD] = CFLUSH; + d_tio.c_cc[VWERASE] = CWERASE; + d_tio.c_cc[VLNEXT] = CLNEXT; + d_tio.c_cc[VMIN] = 1; + d_tio.c_cc[VTIME] = 0; #endif /* } */ -#ifdef HAS_LTCHARS /* { */ - d_ltc.t_suspc = CSUSP; /* t_suspc */ - d_ltc.t_dsuspc = CDSUSP; /* t_dsuspc */ - d_ltc.t_rprntc = CRPRNT; - d_ltc.t_flushc = CFLUSH; - d_ltc.t_werasc = CWERASE; - d_ltc.t_lnextc = CLNEXT; +#ifdef HAS_LTCHARS /* { */ + d_ltc.t_suspc = CSUSP; /* t_suspc */ + d_ltc.t_dsuspc = CDSUSP; /* t_dsuspc */ + d_ltc.t_rprntc = CRPRNT; + d_ltc.t_flushc = CFLUSH; + d_ltc.t_werasc = CWERASE; + d_ltc.t_lnextc = CLNEXT; #endif /* } HAS_LTCHARS */ -#ifdef TIOCLSET /* { */ - d_lmode = 0; +#ifdef TIOCLSET /* { */ + d_lmode = 0; #endif /* } TIOCLSET */ -#else /* }{ else !macII, ATT, CRAY */ +#else /* }{ else !macII, ATT, CRAY */ #ifndef USE_POSIX_TERMIOS -#ifdef BAUD_0 /* { */ - d_tio.c_cflag = CS8|CREAD|PARENB|HUPCL; -#else /* }{ !BAUD_0 */ - d_tio.c_cflag = VAL_LINE_SPEED|CS8|CREAD|PARENB|HUPCL; -#endif /* } !BAUD_0 */ +#ifdef BAUD_0 /* { */ + d_tio.c_cflag = CS8 | CREAD | PARENB | HUPCL; +#else /* }{ !BAUD_0 */ + d_tio.c_cflag = VAL_LINE_SPEED | CS8 | CREAD | PARENB | HUPCL; +#endif /* } !BAUD_0 */ #else /* USE_POSIX_TERMIOS */ - d_tio.c_cflag = CS8|CREAD|PARENB|HUPCL; - cfsetispeed(&d_tio, VAL_LINE_SPEED); - cfsetospeed(&d_tio, VAL_LINE_SPEED); + d_tio.c_cflag = CS8 | CREAD | PARENB | HUPCL; + cfsetispeed(&d_tio, VAL_LINE_SPEED); + cfsetospeed(&d_tio, VAL_LINE_SPEED); #endif - d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; + d_tio.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK; #ifdef ECHOKE - d_tio.c_lflag |= ECHOKE|IEXTEN; + d_tio.c_lflag |= ECHOKE | IEXTEN; #endif #ifdef ECHOCTL - d_tio.c_lflag |= ECHOCTL|IEXTEN; + d_tio.c_lflag |= ECHOCTL | IEXTEN; #endif #ifndef USE_POSIX_TERMIOS #ifdef NTTYDISC - d_tio.c_line = NTTYDISC; + d_tio.c_line = NTTYDISC; #else - d_tio.c_line = 0; + d_tio.c_line = 0; #endif #endif /* USE_POSIX_TERMIOS */ #ifdef __sgi - d_tio.c_cflag &= ~(HUPCL|PARENB); - d_tio.c_iflag |= BRKINT|ISTRIP|IGNPAR; + d_tio.c_cflag &= ~(HUPCL | PARENB); + d_tio.c_iflag |= BRKINT | ISTRIP | IGNPAR; #endif - d_tio.c_cc[VINTR] = CONTROL('C'); /* '^C' */ - d_tio.c_cc[VERASE] = 0x7f; /* DEL */ - d_tio.c_cc[VKILL] = CONTROL('U'); /* '^U' */ - d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */ - d_tio.c_cc[VEOF] = CEOF; /* '^D' */ - d_tio.c_cc[VEOL] = CEOL; /* '^@' */ - d_tio.c_cc[VMIN] = 1; - d_tio.c_cc[VTIME] = 0; + d_tio.c_cc[VINTR] = CONTROL('C'); /* '^C' */ + d_tio.c_cc[VERASE] = 0x7f; /* DEL */ + d_tio.c_cc[VKILL] = CONTROL('U'); /* '^U' */ + d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */ + d_tio.c_cc[VEOF] = CEOF; /* '^D' */ + d_tio.c_cc[VEOL] = CEOL; /* '^@' */ + d_tio.c_cc[VMIN] = 1; + d_tio.c_cc[VTIME] = 0; #ifdef VSWTCH - d_tio.c_cc[VSWTCH] = CSWTCH; /* usually '^Z' */ + d_tio.c_cc[VSWTCH] = CSWTCH; /* usually '^Z' */ #endif #ifdef VLNEXT - d_tio.c_cc[VLNEXT] = CLNEXT; + d_tio.c_cc[VLNEXT] = CLNEXT; #endif #ifdef VWERASE - d_tio.c_cc[VWERASE] = CWERASE; + d_tio.c_cc[VWERASE] = CWERASE; #endif #ifdef VREPRINT - d_tio.c_cc[VREPRINT] = CRPRNT; + d_tio.c_cc[VREPRINT] = CRPRNT; #endif #ifdef VRPRNT - d_tio.c_cc[VRPRNT] = CRPRNT; + d_tio.c_cc[VRPRNT] = CRPRNT; #endif #ifdef VDISCARD - d_tio.c_cc[VDISCARD] = CFLUSH; + d_tio.c_cc[VDISCARD] = CFLUSH; #endif #ifdef VFLUSHO - d_tio.c_cc[VFLUSHO] = CFLUSH; + d_tio.c_cc[VFLUSHO] = CFLUSH; #endif #ifdef VSTOP - d_tio.c_cc[VSTOP] = CSTOP; + d_tio.c_cc[VSTOP] = CSTOP; #endif #ifdef VSTART - d_tio.c_cc[VSTART] = CSTART; + d_tio.c_cc[VSTART] = CSTART; #endif #ifdef VSUSP - d_tio.c_cc[VSUSP] = CSUSP; + d_tio.c_cc[VSUSP] = CSUSP; #endif #ifdef VDSUSP - d_tio.c_cc[VDSUSP] = CDSUSP; + d_tio.c_cc[VDSUSP] = CDSUSP; #endif #ifdef VSTATUS - d_tio.c_cc[VSTATUS] = CSTATUS; + d_tio.c_cc[VSTATUS] = CSTATUS; #endif - /* now, try to inherit tty settings */ - { - int i; + /* now, try to inherit tty settings */ + { + int i; - for (i = 0; i <= 2; i++) { + for (i = 0; i <= 2; i++) { #ifndef USE_POSIX_TERMIOS - struct termio deftio; - if (ioctl (i, TCGETA, &deftio) == 0) + struct termio deftio; + if (ioctl(i, TCGETA, &deftio) == 0) #else - struct termios deftio; - if (tcgetattr(i, &deftio) == 0) + struct termios deftio; + if (tcgetattr(i, &deftio) == 0) #endif - { - d_tio.c_cc[VINTR] = deftio.c_cc[VINTR]; - d_tio.c_cc[VQUIT] = deftio.c_cc[VQUIT]; - d_tio.c_cc[VERASE] = deftio.c_cc[VERASE]; - d_tio.c_cc[VKILL] = deftio.c_cc[VKILL]; - d_tio.c_cc[VEOF] = deftio.c_cc[VEOF]; - d_tio.c_cc[VEOL] = deftio.c_cc[VEOL]; + { + d_tio.c_cc[VINTR] = deftio.c_cc[VINTR]; + d_tio.c_cc[VQUIT] = deftio.c_cc[VQUIT]; + d_tio.c_cc[VERASE] = deftio.c_cc[VERASE]; + d_tio.c_cc[VKILL] = deftio.c_cc[VKILL]; + d_tio.c_cc[VEOF] = deftio.c_cc[VEOF]; + d_tio.c_cc[VEOL] = deftio.c_cc[VEOL]; #ifdef VSWTCH - d_tio.c_cc[VSWTCH] = deftio.c_cc[VSWTCH]; + d_tio.c_cc[VSWTCH] = deftio.c_cc[VSWTCH]; #endif #ifdef VEOL2 - d_tio.c_cc[VEOL2] = deftio.c_cc[VEOL2]; + d_tio.c_cc[VEOL2] = deftio.c_cc[VEOL2]; #endif #ifdef VLNEXT - d_tio.c_cc[VLNEXT] = deftio.c_cc[VLNEXT]; + d_tio.c_cc[VLNEXT] = deftio.c_cc[VLNEXT]; #endif #ifdef VWERASE - d_tio.c_cc[VWERASE] = deftio.c_cc[VWERASE]; + d_tio.c_cc[VWERASE] = deftio.c_cc[VWERASE]; #endif #ifdef VREPRINT - d_tio.c_cc[VREPRINT] = deftio.c_cc[VREPRINT]; + d_tio.c_cc[VREPRINT] = deftio.c_cc[VREPRINT]; #endif #ifdef VRPRNT - d_tio.c_cc[VRPRNT] = deftio.c_cc[VRPRNT]; + d_tio.c_cc[VRPRNT] = deftio.c_cc[VRPRNT]; #endif #ifdef VDISCARD - d_tio.c_cc[VDISCARD] = deftio.c_cc[VDISCARD]; + d_tio.c_cc[VDISCARD] = deftio.c_cc[VDISCARD]; #endif #ifdef VFLUSHO - d_tio.c_cc[VFLUSHO] = deftio.c_cc[VFLUSHO]; + d_tio.c_cc[VFLUSHO] = deftio.c_cc[VFLUSHO]; #endif #ifdef VSTOP - d_tio.c_cc[VSTOP] = deftio.c_cc[VSTOP]; + d_tio.c_cc[VSTOP] = deftio.c_cc[VSTOP]; #endif #ifdef VSTART - d_tio.c_cc[VSTART] = deftio.c_cc[VSTART]; + d_tio.c_cc[VSTART] = deftio.c_cc[VSTART]; #endif #ifdef VSUSP - d_tio.c_cc[VSUSP] = deftio.c_cc[VSUSP]; + d_tio.c_cc[VSUSP] = deftio.c_cc[VSUSP]; #endif #ifdef VDSUSP - d_tio.c_cc[VDSUSP] = deftio.c_cc[VDSUSP]; + d_tio.c_cc[VDSUSP] = deftio.c_cc[VDSUSP]; #endif #ifdef VSTATUS - d_tio.c_cc[VSTATUS] = deftio.c_cc[VSTATUS]; + d_tio.c_cc[VSTATUS] = deftio.c_cc[VSTATUS]; #endif - break; - } + break; } } -#ifdef HAS_LTCHARS /* { */ - d_ltc.t_suspc = '\000'; /* t_suspc */ - d_ltc.t_dsuspc = '\000'; /* t_dsuspc */ - d_ltc.t_rprntc = '\377'; /* reserved...*/ - d_ltc.t_flushc = '\377'; - d_ltc.t_werasc = '\377'; - d_ltc.t_lnextc = '\377'; -#endif /* } HAS_LTCHARS */ -#if defined(USE_TERMIOS) || defined(USE_POSIX_TERMIOS) /* { */ - d_tio.c_cc[VSUSP] = CSUSP; + } +#ifdef HAS_LTCHARS /* { */ + d_ltc.t_suspc = '\000'; /* t_suspc */ + d_ltc.t_dsuspc = '\000'; /* t_dsuspc */ + d_ltc.t_rprntc = '\377'; /* reserved... */ + d_ltc.t_flushc = '\377'; + d_ltc.t_werasc = '\377'; + d_ltc.t_lnextc = '\377'; +#endif /* } HAS_LTCHARS */ +#if defined(USE_TERMIOS) || defined(USE_POSIX_TERMIOS) /* { */ + d_tio.c_cc[VSUSP] = CSUSP; #ifdef VDSUSP - d_tio.c_cc[VDSUSP] = '\000'; + d_tio.c_cc[VDSUSP] = '\000'; #endif #ifdef VSTATUS - d_tio.c_cc[VSTATUS] = '\377'; + d_tio.c_cc[VSTATUS] = '\377'; #endif #ifdef VREPRINT - d_tio.c_cc[VREPRINT] = '\377'; + d_tio.c_cc[VREPRINT] = '\377'; #endif #ifdef VDISCARD - d_tio.c_cc[VDISCARD] = '\377'; + d_tio.c_cc[VDISCARD] = '\377'; #endif #ifdef VWERASE - d_tio.c_cc[VWERASE] = '\377'; + d_tio.c_cc[VWERASE] = '\377'; #endif #ifdef VLNEXT - d_tio.c_cc[VLNEXT] = '\377'; + d_tio.c_cc[VLNEXT] = '\377'; #endif #endif /* } USE_TERMIOS */ -#ifdef TIOCLSET /* { */ - d_lmode = 0; -#endif /* } TIOCLSET */ -#endif /* } macII, ATT, CRAY */ -#endif /* } MINIX, etc */ -#endif /* AMOEBA */ +#ifdef TIOCLSET /* { */ + d_lmode = 0; +#endif /* } TIOCLSET */ +#endif /* } macII, ATT, CRAY */ +#endif /* } USE_ANY_SYSV_TERMIO || USE_POSIX_TERMIOS */ - /* Init the Toolkit. */ - { + /* Init the Toolkit. */ + { #ifdef HAS_SAVED_IDS_AND_SETEUID - uid_t euid = geteuid(); - gid_t egid = getegid(); - uid_t ruid = getuid(); - gid_t rgid = getgid(); + uid_t euid = geteuid(); + gid_t egid = getegid(); + uid_t ruid = getuid(); + gid_t rgid = getgid(); - if (setegid(rgid) == -1) + if (setegid(rgid) == -1) { #ifdef __MVS__ - if (!(errno == EMVSERR)) /* could happen if _BPX_SHAREAS=REUSE */ + if (!(errno == EMVSERR)) /* could happen if _BPX_SHAREAS=REUSE */ #endif (void) fprintf(stderr, "setegid(%d): %s\n", (int) rgid, strerror(errno)); + } - if (seteuid(ruid) == -1) + if (seteuid(ruid) == -1) { #ifdef __MVS__ - if (!(errno == EMVSERR)) + if (!(errno == EMVSERR)) #endif (void) fprintf(stderr, "seteuid(%d): %s\n", (int) ruid, strerror(errno)); + } #endif - XtSetErrorHandler(xt_error); - toplevel = XtAppInitialize (&app_con, my_class, - optionDescList, - XtNumber(optionDescList), - &argc, argv, fallback_resources, - NULL, 0); - XtSetErrorHandler((XtErrorHandler)0); - - XtGetApplicationResources(toplevel, (XtPointer) &resource, - application_resources, - XtNumber(application_resources), NULL, 0); + XtSetErrorHandler(xt_error); +#if OPT_SESSION_MGT + toplevel = XtOpenApplication(&app_con, my_class, + optionDescList, + XtNumber(optionDescList), + &argc, argv, fallback_resources, + sessionShellWidgetClass, + NULL, 0); +#else + toplevel = XtAppInitialize(&app_con, my_class, + optionDescList, + XtNumber(optionDescList), + &argc, argv, fallback_resources, + NULL, 0); +#endif /* OPT_SESSION_MGT */ + XtSetErrorHandler((XtErrorHandler) 0); + + XtGetApplicationResources(toplevel, (XtPointer) & resource, + application_resources, + XtNumber(application_resources), NULL, 0); #ifdef HAS_SAVED_IDS_AND_SETEUID - if (seteuid(euid) == -1) + if (seteuid(euid) == -1) { #ifdef __MVS__ - if (!(errno == EMVSERR)) + if (!(errno == EMVSERR)) #endif (void) fprintf(stderr, "seteuid(%d): %s\n", (int) euid, strerror(errno)); + } - if (setegid(egid) == -1) + if (setegid(egid) == -1) { #ifdef __MVS__ - if (!(errno == EMVSERR)) + if (!(errno == EMVSERR)) #endif (void) fprintf(stderr, "setegid(%d): %s\n", (int) egid, strerror(errno)); + } #endif + +#ifdef __OpenBSD__ + if (resource.utmpInhibit) { + /* Can totally revoke group privs */ + setegid(getgid()); + setgid(getgid()); } +#endif + } - waiting_for_initial_map = resource.wait_for_map; + waiting_for_initial_map = resource.wait_for_map; - /* - * ICCCM delete_window. - */ - XtAppAddActions(app_con, actionProcs, XtNumber(actionProcs)); + /* + * ICCCM delete_window. + */ + XtAppAddActions(app_con, actionProcs, XtNumber(actionProcs)); - /* - * fill in terminal modes - */ - if (resource.tty_modes) { - int n = parse_tty_modes (resource.tty_modes, ttymodelist); - if (n < 0) { - fprintf (stderr, "%s: bad tty modes \"%s\"\n", - ProgramName, resource.tty_modes); - } else if (n > 0) { - override_tty_modes = 1; - } + /* + * fill in terminal modes + */ + if (resource.tty_modes) { + int n = parse_tty_modes(resource.tty_modes, ttymodelist); + if (n < 0) { + fprintf(stderr, "%s: bad tty modes \"%s\"\n", + ProgramName, resource.tty_modes); + } else if (n > 0) { + override_tty_modes = 1; } - + } #if OPT_ZICONBEEP - zIconBeep = resource.zIconBeep; - zIconBeep_flagged = False; - if ( zIconBeep > 100 || zIconBeep < -100 ) { - zIconBeep = 0; /* was 100, but I prefer to defaulting off. */ - fprintf( stderr, "a number between -100 and 100 is required for zIconBeep. 0 used by default\n"); - } + zIconBeep = resource.zIconBeep; + zIconBeep_flagged = False; + if (zIconBeep > 100 || zIconBeep < -100) { + zIconBeep = 0; /* was 100, but I prefer to defaulting off. */ + fprintf(stderr, + "a number between -100 and 100 is required for zIconBeep. 0 used by default\n"); + } #endif /* OPT_ZICONBEEP */ #if OPT_SAME_NAME - sameName = resource.sameName; + sameName = resource.sameName; #endif - hold_screen = resource.hold_screen ? 1 : 0; - xterm_name = resource.xterm_name; - if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE; - if (resource.icon_geometry != NULL) { - int scr, junk; - int ix, iy; - Arg args[2]; - - for(scr = 0; /* yyuucchh */ - XtScreen(toplevel) != ScreenOfDisplay(XtDisplay(toplevel),scr); - scr++); - - args[0].name = XtNiconX; - args[1].name = XtNiconY; - XGeometry(XtDisplay(toplevel), scr, resource.icon_geometry, "", - 0, 0, 0, 0, 0, &ix, &iy, &junk, &junk); - args[0].value = (XtArgVal) ix; - args[1].value = (XtArgVal) iy; - XtSetValues( toplevel, args, 2); - } + hold_screen = resource.hold_screen ? 1 : 0; + xterm_name = resource.xterm_name; + if (strcmp(xterm_name, "-") == 0) + xterm_name = DFT_TERMTYPE; + if (resource.icon_geometry != NULL) { + int scr, junk; + int ix, iy; + Arg args[2]; + + for (scr = 0; /* yyuucchh */ + XtScreen(toplevel) != ScreenOfDisplay(XtDisplay(toplevel), scr); + scr++) ; + + args[0].name = XtNiconX; + args[1].name = XtNiconY; + XGeometry(XtDisplay(toplevel), scr, resource.icon_geometry, "", + 0, 0, 0, 0, 0, &ix, &iy, &junk, &junk); + args[0].value = (XtArgVal) ix; + args[1].value = (XtArgVal) iy; + XtSetValues(toplevel, args, 2); + } - XtSetValues (toplevel, ourTopLevelShellArgs, - number_ourTopLevelShellArgs); + XtSetValues(toplevel, ourTopLevelShellArgs, + number_ourTopLevelShellArgs); #if OPT_WIDE_CHARS - /* seems as good a place as any */ - init_classtab(); + /* seems as good a place as any */ + init_classtab(); #endif - /* Parse the rest of the command line */ - TRACE_ARGV("After XtAppInitialize", argv); - for (argc--, argv++ ; argc > 0 ; argc--, argv++) { - if(**argv != '-') Syntax (*argv); - - TRACE(("parsing %s\n", argv[0])); - switch(argv[0][1]) { - case 'h': /* -help */ - Help(); - continue; - case 'v': /* -version */ - Version(); - continue; - case 'C': + /* Parse the rest of the command line */ + TRACE_ARGV("After XtOpenApplication", argv); + for (argc--, argv++; argc > 0; argc--, argv++) { + if (**argv != '-') + Syntax(*argv); + + TRACE(("parsing %s\n", argv[0])); + switch (argv[0][1]) { + case 'h': /* -help */ + Help(); + continue; + case 'v': /* -version */ + Version(); + continue; + case 'C': #if defined(TIOCCONS) || defined(SRIOCSREDIR) #ifndef __sgi - { - struct stat sbuf; + { + struct stat sbuf; - /* Must be owner and have read/write permission. - xdm cooperates to give the console the right user. */ - if ( !stat("/dev/console", &sbuf) && - (sbuf.st_uid == getuid()) && - !access("/dev/console", R_OK|W_OK)) - { - Console = TRUE; - } else - Console = FALSE; - } + /* Must be owner and have read/write permission. + xdm cooperates to give the console the right user. */ + if (!stat("/dev/console", &sbuf) && + (sbuf.st_uid == getuid()) && + !access("/dev/console", R_OK | W_OK)) { + Console = TRUE; + } else + Console = FALSE; + } #else /* __sgi */ - Console = TRUE; + Console = TRUE; #endif /* __sgi */ -#endif /* TIOCCONS */ - continue; - case 'S': - if (!ParseSccn(*argv + 2)) - Syntax(*argv); - continue; +#endif /* TIOCCONS */ + continue; + case 'S': + if (!ParseSccn(*argv + 2)) + Syntax(*argv); + continue; #ifdef DEBUG - case 'D': - debug = TRUE; - continue; -#endif /* DEBUG */ - case 'c': /* -class param */ + case 'D': + debug = TRUE; + continue; +#endif /* DEBUG */ + case 'c': /* -class param */ + if (strcmp(argv[0] + 1, "class") == 0) argc--, argv++; - continue; - case 'e': - if (argc <= 1) Syntax (*argv); - command_to_exec = ++argv; - break; - default: - Syntax (*argv); + else + Syntax(*argv); + continue; + case 'e': + if (argc <= 1) + Syntax(*argv); + command_to_exec = ++argv; + break; + case 'i': + if (argc <= 1) { + Syntax(*argv); + } else { + char *endPtr; + --argc; + ++argv; + winToEmbedInto = (Window) strtol(argv[0], &endPtr, 10); } break; - } - -#if OPT_WIDE_CHARS - /* Test whether UTF-8 mode should be active by default */ - { - char *s; - if (((s = getenv("LC_ALL")) != 0 && *s != '\0') || - ((s = getenv("LC_CTYPE")) != 0 && *s != '\0') || - ((s = getenv("LANG")) != 0 && *s != '\0')) { - if (strstr(s, "UTF-8")) - defaultUTF8[0] = '2'; - } + default: + Syntax(*argv); } -#endif + break; + } - SetupMenus(toplevel, &form_top, &menu_top); + SetupMenus(toplevel, &form_top, &menu_top); - term = (XtermWidget) XtVaCreateManagedWidget( - "vt100", xtermWidgetClass, form_top, + term = (XtermWidget) XtVaCreateManagedWidget("vt100", xtermWidgetClass, + form_top, #if OPT_TOOLBAR - XtNmenuBar, menu_top, - XtNresizable, True, - XtNfromVert, menu_top, - XtNleft, XawChainLeft, - XtNright, XawChainRight, - XtNbottom, XawChainBottom, + XtNmenuBar, menu_top, + XtNresizable, True, + XtNfromVert, menu_top, + XtNleft, XawChainLeft, + XtNright, XawChainRight, + XtNbottom, XawChainBottom, #endif - 0); - /* this causes the initialize method to be called */ + (XtPointer) 0); + /* this causes the initialize method to be called */ #if OPT_HP_FUNC_KEYS - init_keyboard_type(keyboardIsHP, resource.hpFunctionKeys); + init_keyboard_type(keyboardIsHP, resource.hpFunctionKeys); #endif - init_keyboard_type(keyboardIsSun, resource.sunFunctionKeys); + init_keyboard_type(keyboardIsSun, resource.sunFunctionKeys); #if OPT_SUNPC_KBD - init_keyboard_type(keyboardIsVT220, resource.sunKeyboard); + init_keyboard_type(keyboardIsVT220, resource.sunKeyboard); #endif - screen = &term->screen; + screen = &term->screen; - inhibit = 0; + inhibit = 0; #ifdef ALLOWLOGGING - if (term->misc.logInhibit) inhibit |= I_LOG; + if (term->misc.logInhibit) + inhibit |= I_LOG; #endif - if (term->misc.signalInhibit) inhibit |= I_SIGNAL; + if (term->misc.signalInhibit) + inhibit |= I_SIGNAL; #if OPT_TEK4014 - if (term->misc.tekInhibit) inhibit |= I_TEK; + if (term->misc.tekInhibit) + inhibit |= I_TEK; #endif -/* - * Set title and icon name if not specified - */ +#if OPT_WIDE_CHARS + my_wcwidth = &mk_wcwidth; + if (term->misc.cjk_width) + my_wcwidth = &mk_wcwidth_cjk; +#endif - if (command_to_exec) { - Arg args[2]; +#if OPT_SESSION_MGT + if (resource.sessionMgt) { + TRACE(("Enabling session-management callbacks\n")); + XtAddCallback(toplevel, XtNdieCallback, die_callback, NULL); + XtAddCallback(toplevel, XtNsaveCallback, save_callback, NULL); + } +#endif - if (!resource.title) { - if (command_to_exec) { - resource.title = x_basename (command_to_exec[0]); - } /* else not reached */ - } + /* + * Set title and icon name if not specified + */ + if (command_to_exec) { + Arg args[2]; - if (!resource.icon_name) - resource.icon_name = resource.title; - XtSetArg (args[0], XtNtitle, resource.title); - XtSetArg (args[1], XtNiconName, resource.icon_name); + if (!resource.title) { + if (command_to_exec) { + resource.title = x_basename(command_to_exec[0]); + } /* else not reached */ + } - TRACE(("setting:\n\ttitle \"%s\"\n\ticon \"%s\"\n\tbased on command \"%s\"\n", - resource.title, - resource.icon_name, - *command_to_exec)); + if (!resource.icon_name) + resource.icon_name = resource.title; + XtSetArg(args[0], XtNtitle, resource.title); + XtSetArg(args[1], XtNiconName, resource.icon_name); - XtSetValues (toplevel, args, 2); - } + TRACE(("setting:\n\ttitle \"%s\"\n\ticon \"%s\"\n\tbased on command \"%s\"\n", + resource.title, + resource.icon_name, + *command_to_exec)); + XtSetValues(toplevel, args, 2); + } +#if OPT_LUIT_PROG + if (term->misc.callfilter) { + int u = (term->misc.use_encoding ? 2 : 0); + if (command_to_exec) { + int n; + char **c; + for (n = 0, c = command_to_exec; *c; n++, c++) ; + c = malloc((n + 3 + u) * sizeof(char *)); + if (c == NULL) + SysError(ERROR_LUMALLOC); + memcpy(c + 2 + u, command_to_exec, (n + 1) * sizeof(char *)); + c[0] = term->misc.localefilter; + if (u) { + c[1] = "-encoding"; + c[2] = term->misc.locale_str; + } + c[1 + u] = "--"; + command_to_exec_with_luit = c; + } else { + static char *luit[4]; + luit[0] = term->misc.localefilter; + if (u) { + luit[1] = "-encoding"; + luit[2] = term->misc.locale_str; + luit[3] = NULL; + } else + luit[1] = NULL; + command_to_exec_with_luit = luit; + } + } +#endif #if OPT_TEK4014 - if(inhibit & I_TEK) - screen->TekEmu = FALSE; + if (inhibit & I_TEK) + screen->TekEmu = FALSE; - if(screen->TekEmu && !TekInit()) - exit(ERROR_INIT); + if (screen->TekEmu && !TekInit()) + SysError(ERROR_INIT); #endif -#ifndef MINIX #ifdef DEBUG { /* Set up stderr properly. Opening this log file cannot be - done securely by a privileged xterm process (although we try), - so the debug feature is disabled by default. */ + done securely by a privileged xterm process (although we try), + so the debug feature is disabled by default. */ char dbglogfile[45]; int i = -1; - if(debug) { - timestamp_filename(dbglogfile, "xterm.debug.log."); - if(creat_as (getuid(), getgid(), False, dbglogfile, 0666)) { - i = open (dbglogfile, O_WRONLY | O_TRUNC, 0666); - } + if (debug) { + timestamp_filename(dbglogfile, "xterm.debug.log."); + if (creat_as(getuid(), getgid(), False, dbglogfile, 0666)) { + i = open(dbglogfile, O_WRONLY | O_TRUNC); + } } - if(i >= 0) { -#if defined(USE_ANY_SYSV_TERMIO) && !defined(SVR4) && !defined(linux) - /* SYSV has another pointer which should be part of the - ** FILE structure but is actually a separate array. - */ - unsigned char *old_bufend; - - old_bufend = (unsigned char *) _bufend(stderr); -#ifdef __hpux - stderr->__fileH = (i >> 8); - stderr->__fileL = i; -#else - stderr->_file = i; -#endif - _bufend(stderr) = old_bufend; -#else /* USE_ANY_SYSV_TERMIO */ - freopen(dbglogfile, "w", stderr); -#endif /* USE_ANY_SYSV_TERMIO */ + if (i >= 0) { + dup2(i, 2); - /* mark this file as close on exec */ - (void) fcntl(i, F_SETFD, 1); + /* mark this file as close on exec */ + (void) fcntl(i, F_SETFD, 1); } } -#endif /* DEBUG */ -#endif /* MINIX */ +#endif /* DEBUG */ - /* open a terminal for client */ - get_terminal (); + /* open a terminal for client */ + get_terminal(); - spawn (); + spawn(); #ifndef VMS - /* Child process is out there, let's catch its termination */ + /* Child process is out there, let's catch its termination */ #ifdef USE_POSIX_SIGNALS - (void) posix_signal(SIGCHLD, reapchild); + (void) posix_signal(SIGCHLD, reapchild); #else - (void) signal (SIGCHLD, reapchild); + (void) signal(SIGCHLD, reapchild); #endif - /* Realize procs have now been executed */ + /* Realize procs have now been executed */ -#ifndef AMOEBA - if (am_slave >= 0) { /* Write window id so master end can read and use */ - char buf[80]; + if (am_slave >= 0) { /* Write window id so master end can read and use */ + char buf[80]; - buf[0] = '\0'; - sprintf (buf, "%lx\n", XtWindow (XtParent (CURRENT_EMU(screen)))); - write (screen->respond, buf, strlen (buf)); - } -#endif /* !AMOEBA */ + buf[0] = '\0'; + sprintf(buf, "%lx\n", XtWindow(XtParent(CURRENT_EMU(screen)))); + write(screen->respond, buf, strlen(buf)); + } - screen->inhibit = inhibit; + screen->inhibit = inhibit; #ifdef AIXV3 #if (OSMAJORVERSION < 4) - /* In AIXV3, xterms started from /dev/console have CLOCAL set. - * This means we need to clear CLOCAL so that SIGHUP gets sent - * to the slave-pty process when xterm exits. - */ + /* In AIXV3, xterms started from /dev/console have CLOCAL set. + * This means we need to clear CLOCAL so that SIGHUP gets sent + * to the slave-pty process when xterm exits. + */ - { - struct termio tio; + { + struct termio tio; - if(ioctl(screen->respond, TCGETA, &tio) == -1) - SysError(ERROR_TIOCGETP); + if (ioctl(screen->respond, TCGETA, &tio) == -1) + SysError(ERROR_TIOCGETP); - tio.c_cflag &= ~(CLOCAL); + tio.c_cflag &= ~(CLOCAL); - if (ioctl (screen->respond, TCSETA, &tio) == -1) - SysError(ERROR_TIOCSETP); - } + if (ioctl(screen->respond, TCSETA, &tio) == -1) + SysError(ERROR_TIOCSETP); + } #endif #endif -#ifndef AMOEBA -#ifdef MINIX - if ((mode = fcntl(screen->respond, F_GETFD, 0)) == -1) - Error(1); - mode |= FD_ASYNCHIO; - if (fcntl(screen->respond, F_SETFD, mode) == -1) - Error(1); - nbio_register(screen->respond); -#elif defined(USE_ANY_SYSV_TERMIO) || defined(__MVS__) - if (0 > (mode = fcntl(screen->respond, F_GETFL, 0))) - Error(1); +#if defined(USE_ANY_SYSV_TERMIO) || defined(__MVS__) + if (0 > (mode = fcntl(screen->respond, F_GETFL, 0))) + SysError(ERROR_F_GETFL); #ifdef O_NDELAY - mode |= O_NDELAY; + mode |= O_NDELAY; #else - mode |= O_NONBLOCK; + mode |= O_NONBLOCK; #endif /* O_NDELAY */ - if (fcntl(screen->respond, F_SETFL, mode)) - Error(1); -#else /* !MINIX && !USE_ANY_SYSV_TERMIO */ - mode = 1; - if (ioctl (screen->respond, FIONBIO, (char *)&mode) == -1) SysError (ERROR_FIONBIO); -#endif /* MINIX, etc */ -#endif /* AMOEBA */ - - FD_ZERO (&pty_mask); - FD_ZERO (&X_mask); - FD_ZERO (&Select_mask); - FD_SET (screen->respond, &pty_mask); - FD_SET (ConnectionNumber(screen->display), &X_mask); - FD_SET (screen->respond, &Select_mask); - FD_SET (ConnectionNumber(screen->display), &Select_mask); - max_plus1 = (screen->respond < ConnectionNumber(screen->display)) ? - (1 + ConnectionNumber(screen->display)) : - (1 + screen->respond); + if (fcntl(screen->respond, F_SETFL, mode)) + SysError(ERROR_F_SETFL); +#else /* !USE_ANY_SYSV_TERMIO */ + mode = 1; + if (ioctl(screen->respond, FIONBIO, (char *) &mode) == -1) + SysError(ERROR_FIONBIO); +#endif /* USE_ANY_SYSV_TERMIO, etc */ + + FD_ZERO(&pty_mask); + FD_ZERO(&X_mask); + FD_ZERO(&Select_mask); + FD_SET(screen->respond, &pty_mask); + FD_SET(ConnectionNumber(screen->display), &X_mask); + FD_SET(screen->respond, &Select_mask); + FD_SET(ConnectionNumber(screen->display), &Select_mask); + max_plus1 = ((screen->respond < ConnectionNumber(screen->display)) + ? (1 + ConnectionNumber(screen->display)) + : (1 + screen->respond)); #endif /* !VMS */ #ifdef DEBUG - if (debug) printf ("debugging on\n"); -#endif /* DEBUG */ - XSetErrorHandler(xerror); - XSetIOErrorHandler(xioerror); + if (debug) + printf("debugging on\n"); +#endif /* DEBUG */ + XSetErrorHandler(xerror); + XSetIOErrorHandler(xioerror); #ifdef ALLOWLOGGING - if (term->misc.log_on) { - StartLog(screen); - } + if (term->misc.log_on) { + StartLog(screen); + } #endif - for( ; ; ) { + + if (winToEmbedInto != None) { + XtRealizeWidget(toplevel); + /* + * This should probably query the tree or check the attributes of + * winToEmbedInto in order to verify that it exists, but I'm still not + * certain what is the best way to do it -GPS + */ + XReparentWindow(XtDisplay(toplevel), + XtWindow(toplevel), + winToEmbedInto, 0, 0); + } + + for (;;) { #if OPT_TEK4014 - if(screen->TekEmu) - TekRun(); - else + if (screen->TekEmu) + TekRun(); + else #endif - VTRun(); - } + VTRun(); + } } -#ifndef AMOEBA /* * This function opens up a pty master and stuffs its value into pty. * @@ -2174,145 +2232,168 @@ * has problems, we can re-enter this function and get another one. */ static int -get_pty (int *pty, char *from GCC_UNUSED) +get_pty(int *pty, char *from GCC_UNUSED) { - int result = 1; -#ifdef PUCC_PTYD + int result = 1; + +#ifdef __OpenBSD__ + static int m_tty = -1; + static int m_pty = -1; + struct group *ttygrp; + + if (pty == NULL) { + result = openpty(&m_pty, &m_tty, ttydev, NULL, NULL); + + seteuid(0); + if ((ttygrp = getgrnam(TTY_GROUP_NAME)) != 0) { + set_owner(ttydev, getuid(), ttygrp->gr_gid, 0600); + } else { + set_owner(ttydev, getuid(), getgid(), 0600); + } + seteuid(getuid()); + } else if (m_pty != -1) { + *pty = m_pty; + result = 0; + } else { + result = -1; + } +#elif defined(PUCC_PTYD) - result = ((*pty = openrpty(ttydev, ptydev, - (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), - getuid(), from)) < 0); + result = ((*pty = openrpty(ttydev, ptydev, + (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), + getuid(), from)) < 0); -#elif defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS)) +#elif defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS)) || defined(__NetBSD__) - int tty; - result = openpty(pty, &tty, ttydev, NULL, NULL); + int tty; + result = openpty(pty, &tty, ttydev, NULL, NULL); #elif defined(__QNXNTO__) - result = pty_search(pty); + result = pty_search(pty); #else #if defined(USE_ISPTS_FLAG) - /* - The order of this code is *important*. On SYSV/386 we want to open - a /dev/ttyp? first if at all possible. If none are available, then - we'll try to open a /dev/pts??? device. - - The reason for this is because /dev/ttyp? works correctly, where - as /dev/pts??? devices have a number of bugs, (won't update - screen correcly, will hang -- it more or less works, but you - really don't want to use it). - - Most importantly, for boxes of this nature, one of the major - "features" is that you can emulate a 8086 by spawning off a UNIX - program on 80386/80486 in v86 mode. In other words, you can spawn - off multiple MS-DOS environments. On ISC the program that does - this is named "vpix." The catcher is that "vpix" will *not* work - with a /dev/pts??? device, will only work with a /dev/ttyp? device. - - Since we can open either a /dev/ttyp? or a /dev/pts??? device, - the flag "IsPts" is set here so that we know which type of - device we're dealing with in routine spawn(). That's the reason - for the "if (IsPts)" statement in spawn(); we have two different - device types which need to be handled differently. - */ - result = pty_search(pty); + /* + The order of this code is *important*. On SYSV/386 we want to open + a /dev/ttyp? first if at all possible. If none are available, then + we'll try to open a /dev/pts??? device. + + The reason for this is because /dev/ttyp? works correctly, where + as /dev/pts??? devices have a number of bugs, (won't update + screen correcly, will hang -- it more or less works, but you + really don't want to use it). + + Most importantly, for boxes of this nature, one of the major + "features" is that you can emulate a 8086 by spawning off a UNIX + program on 80386/80486 in v86 mode. In other words, you can spawn + off multiple MS-DOS environments. On ISC the program that does + this is named "vpix." The catcher is that "vpix" will *not* work + with a /dev/pts??? device, will only work with a /dev/ttyp? device. + + Since we can open either a /dev/ttyp? or a /dev/pts??? device, + the flag "IsPts" is set here so that we know which type of + device we're dealing with in routine spawn(). That's the reason + for the "if (IsPts)" statement in spawn(); we have two different + device types which need to be handled differently. + */ + result = pty_search(pty); #endif #if defined(USE_USG_PTYS) || defined(__CYGWIN__) -#ifdef __GLIBC__ /* if __GLIBC__ and USE_USG_PTYS, we know glibc >= 2.1 */ - /* GNU libc 2 allows us to abstract away from having to know the - master pty device name. */ - if ((*pty = getpt()) >= 0) { - strcpy(ttydev, ptsname(*pty)); +#ifdef __GLIBC__ /* if __GLIBC__ and USE_USG_PTYS, we know glibc >= 2.1 */ + /* GNU libc 2 allows us to abstract away from having to know the + master pty device name. */ + if ((*pty = getpt()) >= 0) { + char *name = ptsname(*pty); + if (name != 0) { /* if filesystem is trashed, this may be null */ + strcpy(ttydev, name); result = 0; } + } #elif defined(__MVS__) - result = pty_search(pty); + result = pty_search(pty); #else - result = ((*pty = open ("/dev/ptmx", O_RDWR)) < 0); + result = ((*pty = open("/dev/ptmx", O_RDWR)) < 0); #endif #if defined(SVR4) || defined(SCO325) || defined(USE_ISPTS_FLAG) - if (!result) - strcpy(ttydev, ptsname(*pty)); + if (!result) + strcpy(ttydev, ptsname(*pty)); #ifdef USE_ISPTS_FLAG - IsPts = !result; /* true if we're successful */ + IsPts = !result; /* true if we're successful */ #endif #endif #elif defined(AIXV3) - - if ((*pty = open ("/dev/ptc", O_RDWR)) >= 0) { - strcpy(ttydev, ttyname(*pty)); - result = 0; - } + if ((*pty = open("/dev/ptc", O_RDWR)) >= 0) { + strcpy(ttydev, ttyname(*pty)); + result = 0; + } #elif defined(__convex__) - char *pty_name; - extern char *getpty(void); + char *pty_name; + extern char *getpty(void); - while ((pty_name = getpty()) != NULL) { - if ((*pty = open (pty_name, O_RDWR)) >= 0) { - strcpy(ptydev, pty_name); - strcpy(ttydev, pty_name); - *x_basename(ttydev) = 't'; - result = 0; - break; - } + while ((pty_name = getpty()) != NULL) { + if ((*pty = open(pty_name, O_RDWR)) >= 0) { + strcpy(ptydev, pty_name); + strcpy(ttydev, pty_name); + *x_basename(ttydev) = 't'; + result = 0; + break; } + } #elif defined(sequent) - result = ((*pty = getpseudotty (&ttydev, &ptydev)) < 0); + result = ((*pty = getpseudotty(&ttydev, &ptydev)) < 0); #elif defined(__sgi) && (OSMAJORVERSION >= 4) - char *tty_name; - - tty_name = _getpty (pty, O_RDWR, 0622, 0); - if (tty_name != 0) { - strcpy (ttydev, tty_name); - result = 0; - } + char *tty_name; + tty_name = _getpty(pty, O_RDWR, 0622, 0); + if (tty_name != 0) { + strcpy(ttydev, tty_name); + result = 0; + } #elif (defined(__sgi) && (OSMAJORVERSION < 4)) || (defined(umips) && defined (SYSTYPE_SYSV)) - struct stat fstat_buf; - - *pty = open ("/dev/ptc", O_RDWR); - if (*pty >= 0 && (fstat (*pty, &fstat_buf)) >= 0) { - result = 0; - sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev)); - } + struct stat fstat_buf; + *pty = open("/dev/ptc", O_RDWR); + if (*pty >= 0 && (fstat(*pty, &fstat_buf)) >= 0) { + result = 0; + sprintf(ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev)); + } #elif defined(__hpux) - - /* - * Use the clone device if it works, otherwise use pty_search logic. - */ - if ((*pty = open("/dev/ptym/clone", O_RDWR)) >= 0) { - strcpy(ttydev, ptsname(*pty)); - result = 0; - } else { - result = pty_search(pty); - } + /* + * Use the clone device if it works, otherwise use pty_search logic. + */ + if ((*pty = open("/dev/ptym/clone", O_RDWR)) >= 0) { + strcpy(ttydev, ptsname(*pty)); + result = 0; + } else { + result = pty_search(pty); + } + #else - result = pty_search(pty); + result = pty_search(pty); #endif #endif - TRACE(("get_pty(ttydev=%s, ptydev=%s) %s fd=%d\n", - ttydev != 0 ? ttydev : "?", - ptydev != 0 ? ptydev : "?", - result ? "FAIL" : "OK", *pty)); - return result; + TRACE(("get_pty(ttydev=%s, ptydev=%s) %s fd=%d\n", + ttydev != 0 ? ttydev : "?", + ptydev != 0 ? ptydev : "?", + result ? "FAIL" : "OK", + pty != 0 ? *pty : -1)); + return result; } /* @@ -2329,27 +2410,27 @@ #if defined(CRAY) || defined(__MVS__) while (devindex < MAXPTTYS) { - sprintf (ttydev, TTYFORMAT, devindex); - sprintf (ptydev, PTYFORMAT, devindex); + sprintf(ttydev, TTYFORMAT, devindex); + sprintf(ptydev, PTYFORMAT, devindex); devindex++; TRACE(("pty_search(ttydev=%s, ptydev=%s)\n", ttydev, ptydev)); - if ((*pty = open (ptydev, O_RDWR)) >= 0) { + if ((*pty = open(ptydev, O_RDWR)) >= 0) { return 0; } } #else /* CRAY || __MVS__ */ while (PTYCHAR1[letter]) { - ttydev [strlen(ttydev) - 2] = - ptydev [strlen(ptydev) - 2] = PTYCHAR1 [letter]; + ttydev[strlen(ttydev) - 2] = + ptydev[strlen(ptydev) - 2] = PTYCHAR1[letter]; while (PTYCHAR2[devindex]) { - ttydev [strlen(ttydev) - 1] = - ptydev [strlen(ptydev) - 1] = PTYCHAR2 [devindex]; + ttydev[strlen(ttydev) - 1] = + ptydev[strlen(ptydev) - 1] = PTYCHAR2[devindex]; devindex++; TRACE(("pty_search(ttydev=%s, ptydev=%s)\n", ttydev, ptydev)); - if ((*pty = open (ptydev, O_RDWR)) >= 0) { + if ((*pty = open(ptydev, O_RDWR)) >= 0) { #ifdef sun /* Need to check the process group of the pty. * If it exists, then the slave pty is in use, @@ -2375,19 +2456,18 @@ return 1; } #endif /* USE_PTY_SEARCH */ -#endif /* AMOEBA */ static void -get_terminal (void) +get_terminal(void) /* * sets up X and initializes the terminal structure except for term.buf.fildes. */ { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - screen->arrow = make_colored_cursor (XC_left_ptr, - screen->mousecolor, - screen->mousecolorback); + screen->arrow = make_colored_cursor(XC_left_ptr, + screen->mousecolor, + screen->mousecolorback); } /* @@ -2404,14 +2484,15 @@ */ #if OPT_TEK4014 -static char *tekterm[] = { - "tek4014", - "tek4015", /* 4014 with APL character set support */ - "tek4012", /* 4010 with lower case */ - "tek4013", /* 4012 with APL character set support */ - "tek4010", /* small screen, upper-case only */ - "dumb", - 0 +static char *tekterm[] = +{ + "tek4014", + "tek4015", /* 4014 with APL character set support */ + "tek4012", /* 4010 with lower case */ + "tek4013", /* 4012 with APL character set support */ + "tek4010", /* small screen, upper-case only */ + "dumb", + 0 }; #endif @@ -2422,52 +2503,54 @@ * The VT420 has up to 48 lines on the screen. */ -static char *vtterm[] = { +static char *vtterm[] = +{ #ifdef USE_X11TERM - "x11term", /* for people who want special term name */ + "x11term", /* for people who want special term name */ #endif - DFT_TERMTYPE, /* for people who want special term name */ - "xterm", /* the prefered name, should be fastest */ - "vt102", - "vt100", - "ansi", - "dumb", - 0 + DFT_TERMTYPE, /* for people who want special term name */ + "xterm", /* the prefered name, should be fastest */ + "vt102", + "vt100", + "ansi", + "dumb", + 0 }; /* ARGSUSED */ -static SIGNAL_T hungtty(int i GCC_UNUSED) +static SIGNAL_T +hungtty(int i GCC_UNUSED) { - siglongjmp(env, 1); - SIGNAL_RETURN; + siglongjmp(env, 1); + SIGNAL_RETURN; } /* * declared outside USE_HANDSHAKE so HsSysError() callers can use */ -static int pc_pipe[2]; /* this pipe is used for parent to child transfer */ -static int cp_pipe[2]; /* this pipe is used for child to parent transfer */ +static int pc_pipe[2]; /* this pipe is used for parent to child transfer */ +static int cp_pipe[2]; /* this pipe is used for child to parent transfer */ #ifdef USE_HANDSHAKE -typedef enum { /* c == child, p == parent */ - PTY_BAD, /* c->p: can't open pty slave for some reason */ - PTY_FATALERROR, /* c->p: we had a fatal error with the pty */ - PTY_GOOD, /* c->p: we have a good pty, let's go on */ - PTY_NEW, /* p->c: here is a new pty slave, try this */ - PTY_NOMORE, /* p->c; no more pty's, terminate */ - UTMP_ADDED, /* c->p: utmp entry has been added */ - UTMP_TTYSLOT, /* c->p: here is my ttyslot */ - PTY_EXEC /* p->c: window has been mapped the first time */ +typedef enum { /* c == child, p == parent */ + PTY_BAD, /* c->p: can't open pty slave for some reason */ + PTY_FATALERROR, /* c->p: we had a fatal error with the pty */ + PTY_GOOD, /* c->p: we have a good pty, let's go on */ + PTY_NEW, /* p->c: here is a new pty slave, try this */ + PTY_NOMORE, /* p->c; no more pty's, terminate */ + UTMP_ADDED, /* c->p: utmp entry has been added */ + UTMP_TTYSLOT, /* c->p: here is my ttyslot */ + PTY_EXEC /* p->c: window has been mapped the first time */ } status_t; typedef struct { - status_t status; - int error; - int fatal_error; - int tty_slot; - int rows; - int cols; - char buffer[1024]; + status_t status; + int error; + int fatal_error; + int tty_slot; + int rows; + int cols; + char buffer[1024]; } handshake_t; /* HsSysError() @@ -2481,17 +2564,18 @@ static void HsSysError(int pf, int error) { - handshake_t handshake; + handshake_t handshake; - handshake.status = PTY_FATALERROR; - handshake.error = errno; - handshake.fatal_error = error; - strcpy(handshake.buffer, ttydev); - write(pf, (char *) &handshake, sizeof(handshake)); - exit(error); + handshake.status = PTY_FATALERROR; + handshake.error = errno; + handshake.fatal_error = error; + strcpy(handshake.buffer, ttydev); + write(pf, (char *) &handshake, sizeof(handshake)); + exit(error); } -void first_map_occurred (void) +void +first_map_occurred(void) { handshake_t handshake; register TScreen *screen = &term->screen; @@ -2499,9 +2583,9 @@ handshake.status = PTY_EXEC; handshake.rows = screen->max_row; handshake.cols = screen->max_col; - write (pc_pipe[1], (char *) &handshake, sizeof(handshake)); - close (cp_pipe[0]); - close (pc_pipe[1]); + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + close(cp_pipe[0]); + close(pc_pipe[1]); waiting_for_initial_map = False; } #else @@ -2516,423 +2600,407 @@ exit(error); } -void first_map_occurred (void) +void +first_map_occurred(void) { return; } #endif /* USE_HANDSHAKE else !USE_HANDSHAKE */ - #ifndef VMS -#ifndef AMOEBA extern char **environ; static void set_owner(char *device, int uid, int gid, int mode) { - if (chown (device, uid, gid) < 0) { - if (errno != ENOENT - && getuid() == 0) { - fprintf(stderr, "Cannot chown %s to %d,%d: %s\n", - device, uid, gid, strerror(errno)); - } + if (chown(device, uid, gid) < 0) { + if (errno != ENOENT + && getuid() == 0) { + fprintf(stderr, "Cannot chown %s to %d,%d: %s\n", + device, uid, gid, strerror(errno)); } - chmod (device, mode); + } + chmod(device, mode); } static int -spawn (void) +spawn(void) /* * Inits pty and tty and forks a login process. * Does not close fd Xsocket. * If slave, the pty named in passedPty is already open for use */ { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; #ifdef USE_HANDSHAKE - handshake_t handshake; - int done; + handshake_t handshake; + int done; #endif #if OPT_INITIAL_ERASE - int initial_erase = VAL_INITIAL_ERASE; + int initial_erase = VAL_INITIAL_ERASE; #endif - int rc; - int tty = -1; + int rc; + int tty = -1; #ifdef USE_ANY_SYSV_TERMIO - struct termio tio; + struct termio tio; #ifdef TIOCLSET - unsigned lmode; -#endif /* TIOCLSET */ + unsigned lmode; +#endif /* TIOCLSET */ #ifdef HAS_LTCHARS - struct ltchars ltc; -#endif /* HAS_LTCHARS */ + struct ltchars ltc; +#endif /* HAS_LTCHARS */ #elif defined(USE_POSIX_TERMIOS) - struct termios tio; + struct termios tio; #else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - int ldisc = 0; - int discipline; - unsigned lmode; - struct tchars tc; - struct ltchars ltc; - struct sgttyb sg; + int ldisc = 0; + int discipline; + unsigned lmode; + struct tchars tc; + struct ltchars ltc; + struct sgttyb sg; #ifdef sony - int jmode; - struct jtchars jtc; + int jmode; + struct jtchars jtc; #endif /* sony */ -#endif /* USE_ANY_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ - char termcap [TERMCAP_SIZE]; - char newtc [TERMCAP_SIZE]; - char *ptr, *shname, *shname_minus; - int i, no_dev_tty = FALSE; - char **envnew; /* new environment */ - int envsize; /* elements in new environment */ - char buf[64]; - char *TermName = NULL; + char termcap[TERMCAP_SIZE]; + char newtc[TERMCAP_SIZE]; + char *ptr, *shname, *shname_minus; + int i, no_dev_tty = FALSE; + char **envnew; /* new environment */ + int envsize; /* elements in new environment */ + char buf[64]; + char *TermName = NULL; #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - struct ttysize ts; + struct ttysize ts; #elif defined(TIOCSWINSZ) - struct winsize ws; -#endif /* sun vs TIOCSWINSZ */ - struct passwd *pw = NULL; - char *login_name = NULL; + struct winsize ws; +#endif /* sun vs TIOCSWINSZ */ + struct passwd *pw = NULL; + char *login_name = NULL; #ifdef HAVE_UTMP -#if defined(UTMPX_FOR_UTMP) - struct utmpx utmp, - *utret; -#else - struct utmp utmp, - *utret; + struct UTMP_STR utmp; +#ifdef USE_SYSV_UTMP + struct UTMP_STR *utret; #endif #ifdef USE_LASTLOG - struct lastlog lastlog; -#endif /* USE_LASTLOG */ -#endif /* HAVE_UTMP */ + struct lastlog lastlog; +#endif /* USE_LASTLOG */ +#endif /* HAVE_UTMP */ - screen->uid = getuid(); - screen->gid = getgid(); + screen->uid = getuid(); + screen->gid = getgid(); - termcap[0] = '\0'; - newtc[0] = '\0'; + termcap[0] = '\0'; + newtc[0] = '\0'; #ifdef SIGTTOU - /* so that TIOCSWINSZ || TIOCSIZE doesn't block */ - signal(SIGTTOU,SIG_IGN); + /* so that TIOCSWINSZ || TIOCSIZE doesn't block */ + signal(SIGTTOU, SIG_IGN); #endif - if (am_slave >= 0) { - screen->respond = am_slave; - set_pty_id(ttydev, passedPty); + if (am_slave >= 0) { + screen->respond = am_slave; + set_pty_id(ttydev, passedPty); #ifdef USE_PTY_DEVICE - set_pty_id(ptydev, passedPty); + set_pty_id(ptydev, passedPty); #endif - setgid (screen->gid); - setuid (screen->uid); - } else { - Bool tty_got_hung; + setgid(screen->gid); + setuid(screen->uid); + } else { + Bool tty_got_hung; - /* - * Sometimes /dev/tty hangs on open (as in the case of a pty - * that has gone away). Simply make up some reasonable - * defaults. - */ + /* + * Sometimes /dev/tty hangs on open (as in the case of a pty + * that has gone away). Simply make up some reasonable + * defaults. + */ - signal(SIGALRM, hungtty); - alarm(2); /* alarm(1) might return too soon */ - if (! sigsetjmp(env, 1)) { - tty = open ("/dev/tty", O_RDWR, 0); - alarm(0); - tty_got_hung = False; - } else { - tty_got_hung = True; - tty = -1; - errno = ENXIO; - } + signal(SIGALRM, hungtty); + alarm(2); /* alarm(1) might return too soon */ + if (!sigsetjmp(env, 1)) { + tty = open("/dev/tty", O_RDWR); + alarm(0); + tty_got_hung = False; + } else { + tty_got_hung = True; + tty = -1; + errno = ENXIO; + } #if OPT_INITIAL_ERASE - initial_erase = VAL_INITIAL_ERASE; + initial_erase = VAL_INITIAL_ERASE; #endif - signal(SIGALRM, SIG_DFL); + signal(SIGALRM, SIG_DFL); - /* - * Check results and ignore current control terminal if - * necessary. ENXIO is what is normally returned if there is - * no controlling terminal, but some systems (e.g. SunOS 4.0) - * seem to return EIO. Solaris 2.3 is said to return EINVAL. - * Cygwin returns ENOENT. - */ - no_dev_tty = FALSE; - if (tty < 0) { - if (tty_got_hung || errno == ENXIO || errno == EIO || + /* + * Check results and ignore current control terminal if + * necessary. ENXIO is what is normally returned if there is + * no controlling terminal, but some systems (e.g. SunOS 4.0) + * seem to return EIO. Solaris 2.3 is said to return EINVAL. + * Cygwin returns ENOENT. + */ + no_dev_tty = FALSE; + if (tty < 0) { + if (tty_got_hung || errno == ENXIO || errno == EIO || #ifdef ENODEV - errno == ENODEV || + errno == ENODEV || #endif #ifdef __CYGWIN__ - errno == ENOENT || + errno == ENOENT || #endif - errno == EINVAL || errno == ENOTTY || errno == EACCES) { - no_dev_tty = TRUE; + errno == EINVAL || errno == ENOTTY || errno == EACCES) { + no_dev_tty = TRUE; #ifdef HAS_LTCHARS - ltc = d_ltc; -#endif /* HAS_LTCHARS */ + ltc = d_ltc; +#endif /* HAS_LTCHARS */ #ifdef TIOCLSET - lmode = d_lmode; -#endif /* TIOCLSET */ + lmode = d_lmode; +#endif /* TIOCLSET */ #if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) - tio = d_tio; -#else /* not USE_ANY_SYSV_TERMIO and not USE_POSIX_TERMIOS */ - sg = d_sg; - tc = d_tc; - discipline = d_disipline; + tio = d_tio; +#else /* not USE_ANY_SYSV_TERMIO and not USE_POSIX_TERMIOS */ + sg = d_sg; + tc = d_tc; + discipline = d_disipline; #ifdef sony - jmode = d_jmode; - jtc = d_jtc; + jmode = d_jmode; + jtc = d_jtc; #endif /* sony */ -#endif /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ - } else { - SysError(ERROR_OPDEVTTY); - } - } else { +#endif /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ + } else { + SysError(ERROR_OPDEVTTY); + } + } else { - /* Get a copy of the current terminal's state, - * if we can. Some systems (e.g., SVR4 and MacII) - * may not have a controlling terminal at this point - * if started directly from xdm or xinit, - * in which case we just use the defaults as above. - */ + /* Get a copy of the current terminal's state, + * if we can. Some systems (e.g., SVR4 and MacII) + * may not have a controlling terminal at this point + * if started directly from xdm or xinit, + * in which case we just use the defaults as above. + */ #ifdef HAS_LTCHARS - if(ioctl(tty, TIOCGLTC, <c) == -1) - ltc = d_ltc; -#endif /* HAS_LTCHARS */ + if (ioctl(tty, TIOCGLTC, <c) == -1) + ltc = d_ltc; +#endif /* HAS_LTCHARS */ #ifdef TIOCLSET - if(ioctl(tty, TIOCLGET, &lmode) == -1) - lmode = d_lmode; -#endif /* TIOCLSET */ + if (ioctl(tty, TIOCLGET, &lmode) == -1) + lmode = d_lmode; +#endif /* TIOCLSET */ #ifdef USE_ANY_SYSV_TERMIO - if ((rc = ioctl(tty, TCGETA, &tio)) == -1) - tio = d_tio; + if ((rc = ioctl(tty, TCGETA, &tio)) == -1) + tio = d_tio; #elif defined(USE_POSIX_TERMIOS) - if ((rc = tcgetattr(tty, &tio)) == -1) - tio = d_tio; -#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - if ((rc = ioctl(tty, TIOCGETP, (char *)&sg)) == -1) - sg = d_sg; - if (ioctl(tty, TIOCGETC, (char *)&tc) == -1) - tc = d_tc; - if (ioctl(tty, TIOCGETD, (char *)&discipline) == -1) - discipline = d_disipline; + if ((rc = tcgetattr(tty, &tio)) == -1) + tio = d_tio; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + if ((rc = ioctl(tty, TIOCGETP, (char *) &sg)) == -1) + sg = d_sg; + if (ioctl(tty, TIOCGETC, (char *) &tc) == -1) + tc = d_tc; + if (ioctl(tty, TIOCGETD, (char *) &discipline) == -1) + discipline = d_disipline; #ifdef sony - if (ioctl(tty, TIOCKGET, (char *)&jmode) == -1) - jmode = d_jmode; - if (ioctl(tty, TIOCKGETC, (char *)&jtc) == -1) - jtc = d_jtc; + if (ioctl(tty, TIOCKGET, (char *) &jmode) == -1) + jmode = d_jmode; + if (ioctl(tty, TIOCKGETC, (char *) &jtc) == -1) + jtc = d_jtc; #endif /* sony */ -#endif /* USE_ANY_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ - /* - * If ptyInitialErase is set, we want to get the pty's - * erase value. Just in case that will fail, first get - * the value from /dev/tty, so we will have something - * at least. - */ + /* + * If ptyInitialErase is set, we want to get the pty's + * erase value. Just in case that will fail, first get + * the value from /dev/tty, so we will have something + * at least. + */ #if OPT_INITIAL_ERASE - if (resource.ptyInitialErase) { + if (resource.ptyInitialErase) { #ifdef USE_ANY_SYSV_TERMIO - initial_erase = tio.c_cc[VERASE]; + initial_erase = tio.c_cc[VERASE]; #elif defined(USE_POSIX_TERMIOS) - initial_erase = tio.c_cc[VERASE]; -#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - initial_erase = sg.sg_erase; -#endif /* USE_ANY_SYSV_TERMIO */ - TRACE(("%s initial_erase:%d (from /dev/tty)\n", - rc == 0 ? "OK" : "FAIL", - initial_erase)); - } -#endif - -#ifdef MINIX - /* Editing shells interfere with xterms started in - * the background. - */ - tio = d_tio; + initial_erase = tio.c_cc[VERASE]; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + initial_erase = sg.sg_erase; +#endif /* USE_ANY_SYSV_TERMIO */ + TRACE(("%s initial_erase:%d (from /dev/tty)\n", + rc == 0 ? "OK" : "FAIL", + initial_erase)); + } #endif - close (tty); - /* tty is no longer an open fd! */ - tty = -1; - } - if (get_pty (&screen->respond, XDisplayString(screen->display))) - { - /* no ptys! */ - (void) fprintf(stderr, "%s: no available ptys: %s\n", - xterm_name, strerror(errno)); - exit (ERROR_PTYS); - } + close(tty); + /* tty is no longer an open fd! */ + tty = -1; + } + if (get_pty(&screen->respond, XDisplayString(screen->display))) { + SysError(ERROR_PTYS); + } #if OPT_INITIAL_ERASE - if (resource.ptyInitialErase) { + if (resource.ptyInitialErase) { #ifdef USE_ANY_SYSV_TERMIO - struct termio my_tio; - if ((rc = ioctl(screen->respond, TCGETA, &my_tio)) == 0) - initial_erase = my_tio.c_cc[VERASE]; + struct termio my_tio; + if ((rc = ioctl(screen->respond, TCGETA, &my_tio)) == 0) + initial_erase = my_tio.c_cc[VERASE]; #elif defined(USE_POSIX_TERMIOS) - struct termios my_tio; - if ((rc = tcgetattr(screen->respond, &my_tio)) == 0) - initial_erase = my_tio.c_cc[VERASE]; -#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - struct sgttyb my_sg; - if ((rc = ioctl(screen->respond, TIOCGETP, (char *)&my_sg)) == 0) - initial_erase = my_sg.sg_erase; -#endif /* USE_ANY_SYSV_TERMIO */ - TRACE(("%s initial_erase:%d (from pty)\n", - (rc == 0) ? "OK" : "FAIL", - initial_erase)); - } -#endif /* OPT_INITIAL_ERASE */ + struct termios my_tio; + if ((rc = tcgetattr(screen->respond, &my_tio)) == 0) + initial_erase = my_tio.c_cc[VERASE]; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + struct sgttyb my_sg; + if ((rc = ioctl(screen->respond, TIOCGETP, (char *) &my_sg)) == 0) + initial_erase = my_sg.sg_erase; +#endif /* USE_ANY_SYSV_TERMIO */ + TRACE(("%s initial_erase:%d (from pty)\n", + (rc == 0) ? "OK" : "FAIL", + initial_erase)); } +#endif /* OPT_INITIAL_ERASE */ + } - /* avoid double MapWindow requests */ - XtSetMappedWhenManaged(XtParent(CURRENT_EMU(screen)), False ); + /* avoid double MapWindow requests */ + XtSetMappedWhenManaged(XtParent(CURRENT_EMU(screen)), False); - wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", - False); + wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", + False); - if (!TEK4014_ACTIVE(screen)) - VTInit(); /* realize now so know window size for tty driver */ + if (!TEK4014_ACTIVE(screen)) + VTInit(); /* realize now so know window size for tty driver */ #if defined(TIOCCONS) || defined(SRIOCSREDIR) - if (Console) { - /* - * Inform any running xconsole program - * that we are going to steal the console. - */ - XmuGetHostname (mit_console_name + MIT_CONSOLE_LEN, 255); - mit_console = XInternAtom(screen->display, mit_console_name, False); - /* the user told us to be the console, so we can use CurrentTime */ - XtOwnSelection(XtParent(CURRENT_EMU(screen)), - mit_console, CurrentTime, - ConvertConsoleSelection, NULL, NULL); - } + if (Console) { + /* + * Inform any running xconsole program + * that we are going to steal the console. + */ + XmuGetHostname(mit_console_name + MIT_CONSOLE_LEN, 255); + mit_console = XInternAtom(screen->display, mit_console_name, False); + /* the user told us to be the console, so we can use CurrentTime */ + XtOwnSelection(XtParent(CURRENT_EMU(screen)), + mit_console, CurrentTime, + ConvertConsoleSelection, NULL, NULL); + } #endif #if OPT_TEK4014 - if(screen->TekEmu) { - envnew = tekterm; - ptr = newtc; - } - else + if (screen->TekEmu) { + envnew = tekterm; + ptr = newtc; + } else #endif - { - envnew = vtterm; - ptr = termcap; - } + { + envnew = vtterm; + ptr = termcap; + } - /* - * This used to exit if no termcap entry was found for the specified - * terminal name. That's a little unfriendly, so instead we'll allow - * the program to proceed (but not to set $TERMCAP) if the termcap - * entry is not found. - */ - get_termcap(TermName = resource.term_name, ptr, newtc); + /* + * This used to exit if no termcap entry was found for the specified + * terminal name. That's a little unfriendly, so instead we'll allow + * the program to proceed (but not to set $TERMCAP) if the termcap + * entry is not found. + */ + get_termcap(TermName = resource.term_name, ptr, newtc); - /* - * This block is invoked only if there was no terminal name specified - * by the command-line option "-tn". - */ - if (!TermName) { - TermName = *envnew; - while (*envnew != NULL) { - if (get_termcap(*envnew, ptr, newtc)) { - TermName = *envnew; - break; - } - envnew++; + /* + * This block is invoked only if there was no terminal name specified + * by the command-line option "-tn". + */ + if (!TermName) { + TermName = *envnew; + while (*envnew != NULL) { + if (get_termcap(*envnew, ptr, newtc)) { + TermName = *envnew; + break; } + envnew++; } + } - /* - * Check if ptyInitialErase is not set. If so, we rely on the termcap - * (or terminfo) to tell us what the erase mode should be set to. - */ + /* + * Check if ptyInitialErase is not set. If so, we rely on the termcap + * (or terminfo) to tell us what the erase mode should be set to. + */ #if OPT_INITIAL_ERASE - TRACE(("resource ptyInitialErase is %sset\n", - resource.ptyInitialErase ? "" : "not ")); - if (!resource.ptyInitialErase) { - char temp[1024], *p = temp; - char *s = tgetstr(TERMCAP_ERASE, &p); - TRACE(("...extracting initial_erase value from termcap\n")); - if (s != 0) { - initial_erase = decode_keyvalue(s, True); - } + TRACE(("resource ptyInitialErase is %sset\n", + resource.ptyInitialErase ? "" : "not ")); + if (!resource.ptyInitialErase) { + char temp[1024], *p = temp; + char *s = tgetstr(TERMCAP_ERASE, &p); + TRACE(("...extracting initial_erase value from termcap\n")); + if (s != 0) { + initial_erase = decode_keyvalue(&s, True); } - TRACE(("...initial_erase:%d\n", initial_erase)); + } + TRACE(("...initial_erase:%d\n", initial_erase)); - TRACE(("resource backarrowKeyIsErase is %sset\n", - resource.backarrow_is_erase ? "" : "not ")); - if (resource.backarrow_is_erase) { /* see input.c */ - if (initial_erase == 127) { - term->keyboard.flags &= ~MODE_DECBKM; - } else { - term->keyboard.flags |= MODE_DECBKM; - term->keyboard.reset_DECBKM = 1; - } - TRACE(("...sets DECBKM %s\n", - (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); + TRACE(("resource backarrowKeyIsErase is %sset\n", + resource.backarrow_is_erase ? "" : "not ")); + if (resource.backarrow_is_erase) { /* see input.c */ + if (initial_erase == 127) { + term->keyboard.flags &= ~MODE_DECBKM; } else { - term->keyboard.reset_DECBKM = 2; + term->keyboard.flags |= MODE_DECBKM; + term->keyboard.reset_DECBKM = 1; } -#endif /* OPT_INITIAL_ERASE */ + TRACE(("...sets DECBKM %s\n", + (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); + } else { + term->keyboard.reset_DECBKM = 2; + } +#endif /* OPT_INITIAL_ERASE */ #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - /* tell tty how big window is */ - if(TEK4014_ACTIVE(screen)) { - ts.ts_lines = 38; - ts.ts_cols = 81; - } else { - ts.ts_lines = screen->max_row + 1; - ts.ts_cols = screen->max_col + 1; - } - i = ioctl (screen->respond, TIOCSSIZE, &ts); - TRACE(("spawn TIOCSSIZE %dx%d return %d\n", ts.ts_lines, ts.ts_cols, i)); + /* tell tty how big window is */ + if (TEK4014_ACTIVE(screen)) { + ts.ts_lines = 38; + ts.ts_cols = 81; + } else { + ts.ts_lines = screen->max_row + 1; + ts.ts_cols = screen->max_col + 1; + } + i = ioctl(screen->respond, TIOCSSIZE, &ts); + TRACE(("spawn TIOCSSIZE %dx%d return %d\n", ts.ts_lines, ts.ts_cols, i)); #elif defined(TIOCSWINSZ) - /* tell tty how big window is */ + /* tell tty how big window is */ #if OPT_TEK4014 - if(TEK4014_ACTIVE(screen)) { - ws.ws_row = 38; - ws.ws_col = 81; - ws.ws_xpixel = TFullWidth(screen); - ws.ws_ypixel = TFullHeight(screen); - } else -#endif - { - ws.ws_row = screen->max_row + 1; - ws.ws_col = screen->max_col + 1; - ws.ws_xpixel = FullWidth(screen); - ws.ws_ypixel = FullHeight(screen); - } - i = ioctl (screen->respond, TIOCSWINSZ, (char *)&ws); - TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", ws.ws_row, ws.ws_col, i)); -#endif /* sun vs TIOCSWINSZ */ + if (TEK4014_ACTIVE(screen)) { + ws.ws_row = 38; + ws.ws_col = 81; + ws.ws_xpixel = TFullWidth(screen); + ws.ws_ypixel = TFullHeight(screen); + } else +#endif + { + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); + } + i = ioctl(screen->respond, TIOCSWINSZ, (char *) &ws); + TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", ws.ws_row, ws.ws_col, i)); +#endif /* sun vs TIOCSWINSZ */ #if defined(USE_UTEMPTER) #undef UTMP - if (!resource.utmpInhibit) { - addToUtmp(ttydev, NULL, screen->respond); - added_utmp_entry = True; - } + if (!resource.utmpInhibit) { + addToUtmp(ttydev, NULL, screen->respond); + added_utmp_entry = True; + } #endif - if (am_slave < 0) { + if (am_slave < 0) { #ifdef USE_HANDSHAKE - if (pipe(pc_pipe) || pipe(cp_pipe)) - SysError (ERROR_FORK); + if (pipe(pc_pipe) || pipe(cp_pipe)) + SysError(ERROR_FORK); #endif - TRACE(("Forking...\n")); - if ((screen->pid = fork ()) == -1) - SysError (ERROR_FORK); + TRACE(("Forking...\n")); + if ((screen->pid = fork()) == -1) + SysError(ERROR_FORK); - if (screen->pid == 0) { - /* - * now in child process - */ - TRACE_CHILD + if (screen->pid == 0) { + /* + * now in child process + */ + TRACE_CHILD #if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__convex__) || defined(SCO325) || defined(__QNX__) int pgrp = setsid(); /* variable may not be used... */ #else @@ -2941,88 +3009,92 @@ #ifdef USE_USG_PTYS #ifdef USE_ISPTS_FLAG - if (IsPts) { /* SYSV386 supports both, which did we open? */ + if (IsPts) { /* SYSV386 supports both, which did we open? */ #endif - int ptyfd; + int ptyfd = 0; + char *pty_name = 0; setpgrp(); - grantpt (screen->respond); - unlockpt (screen->respond); - if ((ptyfd = open (ptsname(screen->respond), O_RDWR)) < 0) { - SysError (1); + grantpt(screen->respond); + unlockpt(screen->respond); + if ((pty_name = ptsname(screen->respond)) == 0) { + SysError(ERROR_PTSNAME); + } + if ((ptyfd = open(pty_name, O_RDWR)) < 0) { + SysError(ERROR_OPPTSNAME); } #ifdef I_PUSH - if (ioctl (ptyfd, I_PUSH, "ptem") < 0) { - SysError (2); + if (ioctl(ptyfd, I_PUSH, "ptem") < 0) { + SysError(ERROR_PTEM); } #if !defined(SVR4) && !(defined(SYSV) && defined(i386)) - if (!getenv("CONSEM") && ioctl (ptyfd, I_PUSH, "consem") < 0) { - SysError (3); + if (!getenv("CONSEM") && ioctl(ptyfd, I_PUSH, "consem") < 0) { + SysError(ERROR_CONSEM); } #endif /* !SVR4 */ - if (ioctl (ptyfd, I_PUSH, "ldterm") < 0) { - SysError (4); + if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) { + SysError(ERROR_LDTERM); } #ifdef SVR4 /* from Sony */ - if (ioctl (ptyfd, I_PUSH, "ttcompat") < 0) { - SysError (5); + if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) { + SysError(ERROR_TTCOMPAT); } #endif /* SVR4 */ #endif /* I_PUSH */ tty = ptyfd; - close (screen->respond); + close(screen->respond); #ifdef TIOCSWINSZ /* tell tty how big window is */ #if OPT_TEK4014 - if(TEK4014_ACTIVE(screen)) { - ws.ws_row = 24; - ws.ws_col = 80; - ws.ws_xpixel = TFullWidth(screen); - ws.ws_ypixel = TFullHeight(screen); + if (TEK4014_ACTIVE(screen)) { + ws.ws_row = 24; + ws.ws_col = 80; + ws.ws_xpixel = TFullWidth(screen); + ws.ws_ypixel = TFullHeight(screen); } else #endif { - ws.ws_row = screen->max_row + 1; - ws.ws_col = screen->max_col + 1; - ws.ws_xpixel = FullWidth(screen); - ws.ws_ypixel = FullHeight(screen); + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); } #endif #ifdef USE_ISPTS_FLAG - } else { /* else pty, not pts */ + } else { /* else pty, not pts */ #endif #endif /* USE_USG_PTYS */ #ifdef USE_HANDSHAKE /* warning, goes for a long ways */ /* close parent's sides of the pipes */ - close (cp_pipe[0]); - close (pc_pipe[1]); + close(cp_pipe[0]); + close(pc_pipe[1]); /* Make sure that our sides of the pipes are not in the * 0, 1, 2 range so that we don't fight with stdin, out * or err. */ if (cp_pipe[1] <= 2) { - if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) { - (void) close(cp_pipe[1]); - cp_pipe[1] = i; - } + if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) { + (void) close(cp_pipe[1]); + cp_pipe[1] = i; + } } if (pc_pipe[0] <= 2) { - if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) { - (void) close(pc_pipe[0]); - pc_pipe[0] = i; - } + if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) { + (void) close(pc_pipe[0]); + pc_pipe[0] = i; + } } /* we don't need the socket, or the pty master anymore */ - close (ConnectionNumber(screen->display)); - close (screen->respond); + close(ConnectionNumber(screen->display)); + close(screen->respond); /* Now is the time to set up our process group and * open up the pty slave. */ -#ifdef USE_SYSV_PGRP +#ifdef USE_SYSV_PGRP #if defined(CRAY) && (OSMAJORVERSION > 5) (void) setsid(); #else @@ -3031,997 +3103,1015 @@ #endif /* USE_SYSV_PGRP */ #if defined(__QNX__) && !defined(__QNXNTO__) - qsetlogin( getlogin(), ttydev ); + qsetlogin(getlogin(), ttydev); #endif while (1) { #if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) - if (!no_dev_tty && (tty = open ("/dev/tty", O_RDWR)) >= 0) { - ioctl (tty, TIOCNOTTY, (char *) NULL); - close (tty); - } + if (!no_dev_tty && (tty = open("/dev/tty", O_RDWR)) >= 0) { + ioctl(tty, TIOCNOTTY, (char *) NULL); + close(tty); + } #endif /* TIOCNOTTY && !glibc >= 2.1 */ #ifdef CSRG_BASED - (void)revoke(ttydev); + (void) revoke(ttydev); #endif - if ((tty = open(ttydev, O_RDWR, 0)) >= 0) { + if ((tty = open(ttydev, O_RDWR)) >= 0) { #if defined(CRAY) && defined(TCSETCTTY) - /* make /dev/tty work */ - ioctl(tty, TCSETCTTY, 0); + /* make /dev/tty work */ + ioctl(tty, TCSETCTTY, 0); #endif -#ifdef USE_SYSV_PGRP - /* We need to make sure that we are acutally - * the process group leader for the pty. If - * we are, then we should now be able to open - * /dev/tty. - */ - if ((i = open("/dev/tty", O_RDWR, 0)) >= 0) { - /* success! */ - close(i); - break; - } -#else /* USE_SYSV_PGRP */ - break; -#endif /* USE_SYSV_PGRP */ +#ifdef USE_SYSV_PGRP + /* We need to make sure that we are actually + * the process group leader for the pty. If + * we are, then we should now be able to open + * /dev/tty. + */ + if ((i = open("/dev/tty", O_RDWR)) >= 0) { + /* success! */ + close(i); + break; } - +#else /* USE_SYSV_PGRP */ + break; +#endif /* USE_SYSV_PGRP */ + } + perror("open ttydev"); #ifdef TIOCSCTTY - ioctl(tty, TIOCSCTTY, 0); + ioctl(tty, TIOCSCTTY, 0); #endif - /* let our master know that the open failed */ - handshake.status = PTY_BAD; - handshake.error = errno; - strcpy(handshake.buffer, ttydev); - write(cp_pipe[1], (char *) &handshake, - sizeof(handshake)); - - /* get reply from parent */ - i = read(pc_pipe[0], (char *) &handshake, - sizeof(handshake)); - if (i <= 0) { - /* parent terminated */ - exit(1); - } + /* let our master know that the open failed */ + handshake.status = PTY_BAD; + handshake.error = errno; + strcpy(handshake.buffer, ttydev); + write(cp_pipe[1], (char *) &handshake, + sizeof(handshake)); + + /* get reply from parent */ + i = read(pc_pipe[0], (char *) &handshake, + sizeof(handshake)); + if (i <= 0) { + /* parent terminated */ + exit(1); + } - if (handshake.status == PTY_NOMORE) { - /* No more ptys, let's shutdown. */ - exit(1); - } + if (handshake.status == PTY_NOMORE) { + /* No more ptys, let's shutdown. */ + exit(1); + } - /* We have a new pty to try */ - free(ttydev); - ttydev = (char *)malloc((unsigned) - (strlen(handshake.buffer) + 1)); - if (ttydev == NULL) { - SysError(ERROR_SPREALLOC); - } - strcpy(ttydev, handshake.buffer); + /* We have a new pty to try */ + free(ttydev); + ttydev = (char *) malloc((unsigned) + (strlen(handshake.buffer) + 1)); + if (ttydev == NULL) { + SysError(ERROR_SPREALLOC); + } + strcpy(ttydev, handshake.buffer); } /* use the same tty name that everyone else will use * (from ttyname) */ - if ((ptr = ttyname(tty)) != 0) - { - /* it may be bigger */ - ttydev = (char *)realloc (ttydev, - (unsigned) (strlen(ptr) + 1)); - if (ttydev == NULL) { - SysError(ERROR_SPREALLOC); - } - (void) strcpy(ttydev, ptr); + if ((ptr = ttyname(tty)) != 0) { + /* it may be bigger */ + ttydev = (char *) realloc(ttydev, + (unsigned) (strlen(ptr) + 1)); + if (ttydev == NULL) { + SysError(ERROR_SPREALLOC); + } + (void) strcpy(ttydev, ptr); } #ifdef USE_ISPTS_FLAG - } /* end of IsPts else clause */ + } /* end of IsPts else clause */ #endif #endif /* USE_HANDSHAKE -- from near fork */ #ifdef USE_TTY_GROUP - { + { struct group *ttygrp; if ((ttygrp = getgrnam(TTY_GROUP_NAME)) != 0) { - /* change ownership of tty to real uid, "tty" gid */ - set_owner (ttydev, screen->uid, ttygrp->gr_gid, - (resource.messages? 0620 : 0600)); - } - else { - /* change ownership of tty to real group and user id */ - set_owner (ttydev, screen->uid, screen->gid, - (resource.messages? 0622 : 0600)); + /* change ownership of tty to real uid, "tty" gid */ + set_owner(ttydev, screen->uid, ttygrp->gr_gid, + (resource.messages ? 0620 : 0600)); + } else { + /* change ownership of tty to real group and user id */ + set_owner(ttydev, screen->uid, screen->gid, + (resource.messages ? 0622 : 0600)); } endgrent(); - } + } #else /* else !USE_TTY_GROUP */ - /* change ownership of tty to real group and user id */ - set_owner (ttydev, screen->uid, screen->gid, - (resource.messages? 0622 : 0600)); + /* change ownership of tty to real group and user id */ + set_owner(ttydev, screen->uid, screen->gid, + (resource.messages ? 0622 : 0600)); #endif /* USE_TTY_GROUP */ - /* - * set up the tty modes - */ - { + /* + * set up the tty modes + */ + { #if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) #if defined(umips) || defined(CRAY) || defined(linux) - /* If the control tty had its modes screwed around with, - eg. by lineedit in the shell, or emacs, etc. then tio - will have bad values. Let's just get termio from the - new tty and tailor it. */ - if (ioctl (tty, TCGETA, &tio) == -1) - SysError (ERROR_TIOCGETP); - tio.c_lflag |= ECHOE; + /* If the control tty had its modes screwed around with, + eg. by lineedit in the shell, or emacs, etc. then tio + will have bad values. Let's just get termio from the + new tty and tailor it. */ + if (ioctl(tty, TCGETA, &tio) == -1) + SysError(ERROR_TIOCGETP); + tio.c_lflag |= ECHOE; #endif /* umips */ - /* Now is also the time to change the modes of the - * child pty. - */ - /* input: nl->nl, don't ignore cr, cr->nl */ - tio.c_iflag &= ~(INLCR|IGNCR); - tio.c_iflag |= ICRNL; - /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */ + /* Now is also the time to change the modes of the + * child pty. + */ + /* input: nl->nl, don't ignore cr, cr->nl */ + tio.c_iflag &= ~(INLCR | IGNCR); + tio.c_iflag |= ICRNL; + /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */ #ifndef USE_POSIX_TERMIOS - tio.c_oflag &= - ~(OCRNL|ONLRET|NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); + tio.c_oflag &= + ~(OCRNL + | ONLRET + | NLDLY + | CRDLY + | TABDLY + | BSDLY + | VTDLY + | FFDLY); #endif /* USE_POSIX_TERMIOS */ #ifdef ONLCR - tio.c_oflag |= ONLCR; + tio.c_oflag |= ONLCR; #endif /* ONLCR */ #ifdef OPOST - tio.c_oflag |= OPOST; + tio.c_oflag |= OPOST; #endif /* OPOST */ -#ifdef MINIX /* should be ifdef _POSIX_SOURCE */ - cfsetispeed(&tio, VAL_LINE_SPEED); - cfsetospeed(&tio, VAL_LINE_SPEED); -#else /* !MINIX */ #ifndef USE_POSIX_TERMIOS # if defined(Lynx) && !defined(CBAUD) # define CBAUD V_CBAUD # endif - tio.c_cflag &= ~(CBAUD); + tio.c_cflag &= ~(CBAUD); #ifdef BAUD_0 - /* baud rate is 0 (don't care) */ + /* baud rate is 0 (don't care) */ #elif defined(HAVE_TERMIO_C_ISPEED) - tio.c_ispeed = tio.c_ospeed = VAL_LINE_SPEED; -#else /* !BAUD_0 */ - tio.c_cflag |= VAL_LINE_SPEED; -#endif /* !BAUD_0 */ + tio.c_ispeed = tio.c_ospeed = VAL_LINE_SPEED; +#else /* !BAUD_0 */ + tio.c_cflag |= VAL_LINE_SPEED; +#endif /* !BAUD_0 */ #else /* USE_POSIX_TERMIOS */ - cfsetispeed(&tio, VAL_LINE_SPEED); - cfsetospeed(&tio, VAL_LINE_SPEED); + cfsetispeed(&tio, VAL_LINE_SPEED); + cfsetospeed(&tio, VAL_LINE_SPEED); #ifdef __MVS__ - /* turn off bits that can't be set from the slave side */ - tio.c_cflag &= ~(PACKET|PKT3270|PTU3270|PKTXTND); + /* turn off bits that can't be set from the slave side */ + tio.c_cflag &= ~(PACKET | PKT3270 | PTU3270 | PKTXTND); #endif /* __MVS__ */ - /* Clear CLOCAL so that SIGHUP is sent to us - when the xterm ends */ - tio.c_cflag &= ~CLOCAL; + /* Clear CLOCAL so that SIGHUP is sent to us + when the xterm ends */ + tio.c_cflag &= ~CLOCAL; #endif /* USE_POSIX_TERMIOS */ -#endif /* MINIX */ - tio.c_cflag &= ~CSIZE; - if (screen->input_eight_bits) - tio.c_cflag |= CS8; - else - tio.c_cflag |= CS7; - /* enable signals, canonical processing (erase, kill, etc), - ** echo - */ - tio.c_lflag |= ISIG|ICANON|ECHO|ECHOE|ECHOK; + tio.c_cflag &= ~CSIZE; + if (screen->input_eight_bits) + tio.c_cflag |= CS8; + else + tio.c_cflag |= CS7; + /* enable signals, canonical processing (erase, kill, etc), + * echo + */ + tio.c_lflag |= ISIG | ICANON | ECHO | ECHOE | ECHOK; #ifdef ECHOKE - tio.c_lflag |= ECHOKE|IEXTEN; + tio.c_lflag |= ECHOKE | IEXTEN; #endif #ifdef ECHOCTL - tio.c_lflag |= ECHOCTL|IEXTEN; + tio.c_lflag |= ECHOCTL | IEXTEN; #endif #ifndef __MVS__ - /* reset EOL to default value */ - tio.c_cc[VEOL] = CEOL; /* '^@' */ - /* certain shells (ksh & csh) change EOF as well */ - tio.c_cc[VEOF] = CEOF; /* '^D' */ + /* reset EOL to default value */ + tio.c_cc[VEOL] = CEOL; /* '^@' */ + /* certain shells (ksh & csh) change EOF as well */ + tio.c_cc[VEOF] = CEOF; /* '^D' */ #else - if(tio.c_cc[VEOL]==0) tio.c_cc[VEOL] = CEOL; /* '^@' */ - if(tio.c_cc[VEOF]==0) tio.c_cc[VEOF] = CEOF; /* '^D' */ + if (tio.c_cc[VEOL] == 0) + tio.c_cc[VEOL] = CEOL; /* '^@' */ + if (tio.c_cc[VEOF] == 0) + tio.c_cc[VEOF] = CEOF; /* '^D' */ #endif #ifdef VLNEXT - tio.c_cc[VLNEXT] = CLNEXT; + tio.c_cc[VLNEXT] = CLNEXT; #endif #ifdef VWERASE - tio.c_cc[VWERASE] = CWERASE; + tio.c_cc[VWERASE] = CWERASE; #endif #ifdef VREPRINT - tio.c_cc[VREPRINT] = CRPRNT; + tio.c_cc[VREPRINT] = CRPRNT; #endif #ifdef VRPRNT - tio.c_cc[VRPRNT] = CRPRNT; + tio.c_cc[VRPRNT] = CRPRNT; #endif #ifdef VDISCARD - tio.c_cc[VDISCARD] = CFLUSH; + tio.c_cc[VDISCARD] = CFLUSH; #endif #ifdef VFLUSHO - tio.c_cc[VFLUSHO] = CFLUSH; + tio.c_cc[VFLUSHO] = CFLUSH; #endif #ifdef VSTOP - tio.c_cc[VSTOP] = CSTOP; + tio.c_cc[VSTOP] = CSTOP; #endif #ifdef VSTART - tio.c_cc[VSTART] = CSTART; + tio.c_cc[VSTART] = CSTART; #endif #ifdef VSUSP - tio.c_cc[VSUSP] = CSUSP; + tio.c_cc[VSUSP] = CSUSP; #endif #ifdef VDSUSP - tio.c_cc[VDSUSP] = CDSUSP; + tio.c_cc[VDSUSP] = CDSUSP; #endif - if (override_tty_modes) { - /* sysv-specific */ - TMODE (XTTYMODE_intr, tio.c_cc[VINTR]); - TMODE (XTTYMODE_quit, tio.c_cc[VQUIT]); - TMODE (XTTYMODE_erase, tio.c_cc[VERASE]); - TMODE (XTTYMODE_kill, tio.c_cc[VKILL]); - TMODE (XTTYMODE_eof, tio.c_cc[VEOF]); - TMODE (XTTYMODE_eol, tio.c_cc[VEOL]); + if (override_tty_modes) { + /* sysv-specific */ + TMODE(XTTYMODE_intr, tio.c_cc[VINTR]); + TMODE(XTTYMODE_quit, tio.c_cc[VQUIT]); + TMODE(XTTYMODE_erase, tio.c_cc[VERASE]); + TMODE(XTTYMODE_kill, tio.c_cc[VKILL]); + TMODE(XTTYMODE_eof, tio.c_cc[VEOF]); + TMODE(XTTYMODE_eol, tio.c_cc[VEOL]); #ifdef VSWTCH - TMODE (XTTYMODE_swtch, tio.c_cc[VSWTCH]); + TMODE(XTTYMODE_swtch, tio.c_cc[VSWTCH]); #endif #ifdef VSUSP - TMODE (XTTYMODE_susp, tio.c_cc[VSUSP]); + TMODE(XTTYMODE_susp, tio.c_cc[VSUSP]); #endif #ifdef VDSUSP - TMODE (XTTYMODE_dsusp, tio.c_cc[VDSUSP]); + TMODE(XTTYMODE_dsusp, tio.c_cc[VDSUSP]); #endif #ifdef VREPRINT - TMODE (XTTYMODE_rprnt, tio.c_cc[VREPRINT]); + TMODE(XTTYMODE_rprnt, tio.c_cc[VREPRINT]); #endif #ifdef VRPRNT - TMODE (XTTYMODE_rprnt, tio.c_cc[VRPRNT]); + TMODE(XTTYMODE_rprnt, tio.c_cc[VRPRNT]); #endif #ifdef VDISCARD - TMODE (XTTYMODE_flush, tio.c_cc[VDISCARD]); + TMODE(XTTYMODE_flush, tio.c_cc[VDISCARD]); #endif #ifdef VFLUSHO - TMODE (XTTYMODE_flush, tio.c_cc[VFLUSHO]); + TMODE(XTTYMODE_flush, tio.c_cc[VFLUSHO]); #endif #ifdef VWERASE - TMODE (XTTYMODE_weras, tio.c_cc[VWERASE]); + TMODE(XTTYMODE_weras, tio.c_cc[VWERASE]); #endif #ifdef VLNEXT - TMODE (XTTYMODE_lnext, tio.c_cc[VLNEXT]); + TMODE(XTTYMODE_lnext, tio.c_cc[VLNEXT]); #endif #ifdef VSTART - TMODE (XTTYMODE_start, tio.c_cc[VSTART]); + TMODE(XTTYMODE_start, tio.c_cc[VSTART]); #endif #ifdef VSTOP - TMODE (XTTYMODE_stop, tio.c_cc[VSTOP]); + TMODE(XTTYMODE_stop, tio.c_cc[VSTOP]); #endif #ifdef VSTATUS - TMODE (XTTYMODE_status, tio.c_cc[VSTATUS]); + TMODE(XTTYMODE_status, tio.c_cc[VSTATUS]); #endif #ifdef HAS_LTCHARS - /* both SYSV and BSD have ltchars */ - TMODE (XTTYMODE_susp, ltc.t_suspc); - TMODE (XTTYMODE_dsusp, ltc.t_dsuspc); - TMODE (XTTYMODE_rprnt, ltc.t_rprntc); - TMODE (XTTYMODE_flush, ltc.t_flushc); - TMODE (XTTYMODE_weras, ltc.t_werasc); - TMODE (XTTYMODE_lnext, ltc.t_lnextc); + /* both SYSV and BSD have ltchars */ + TMODE(XTTYMODE_susp, ltc.t_suspc); + TMODE(XTTYMODE_dsusp, ltc.t_dsuspc); + TMODE(XTTYMODE_rprnt, ltc.t_rprntc); + TMODE(XTTYMODE_flush, ltc.t_flushc); + TMODE(XTTYMODE_weras, ltc.t_werasc); + TMODE(XTTYMODE_lnext, ltc.t_lnextc); #endif - } - + } #ifdef HAS_LTCHARS #ifdef __hpux - /* ioctl chokes when the "reserved" process group controls - * are not set to _POSIX_VDISABLE */ - ltc.t_rprntc = ltc.t_rprntc = ltc.t_flushc = + /* ioctl chokes when the "reserved" process group controls + * are not set to _POSIX_VDISABLE */ + ltc.t_rprntc = ltc.t_rprntc = ltc.t_flushc = ltc.t_werasc = ltc.t_lnextc = _POSIX_VDISABLE; #endif /* __hpux */ - if (ioctl (tty, TIOCSLTC, <c) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETC); -#endif /* HAS_LTCHARS */ + if (ioctl(tty, TIOCSLTC, <c) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETC); +#endif /* HAS_LTCHARS */ #ifdef TIOCLSET - if (ioctl (tty, TIOCLSET, (char *)&lmode) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCLSET); -#endif /* TIOCLSET */ + if (ioctl(tty, TIOCLSET, (char *) &lmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCLSET); +#endif /* TIOCLSET */ #ifndef USE_POSIX_TERMIOS - if (ioctl (tty, TCSETA, &tio) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETP); -#else /* USE_POSIX_TERMIOS */ - if (tcsetattr (tty, TCSANOW, &tio) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETP); -#endif /* USE_POSIX_TERMIOS */ -#else /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ - sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW); - sg.sg_flags |= ECHO | CRMOD; - /* make sure speed is set on pty so that editors work right*/ - sg.sg_ispeed = VAL_LINE_SPEED; - sg.sg_ospeed = VAL_LINE_SPEED; - /* reset t_brkc to default value */ - tc.t_brkc = -1; + if (ioctl(tty, TCSETA, &tio) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); +#else /* USE_POSIX_TERMIOS */ + if (tcsetattr(tty, TCSANOW, &tio) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); +#endif /* USE_POSIX_TERMIOS */ +#else /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ + sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW); + sg.sg_flags |= ECHO | CRMOD; + /* make sure speed is set on pty so that editors work right */ + sg.sg_ispeed = VAL_LINE_SPEED; + sg.sg_ospeed = VAL_LINE_SPEED; + /* reset t_brkc to default value */ + tc.t_brkc = -1; #ifdef LPASS8 - if (screen->input_eight_bits) - lmode |= LPASS8; - else - lmode &= ~(LPASS8); + if (screen->input_eight_bits) + lmode |= LPASS8; + else + lmode &= ~(LPASS8); #endif #ifdef sony - jmode &= ~KM_KANJI; + jmode &= ~KM_KANJI; #endif /* sony */ - ltc = d_ltc; - - if (override_tty_modes) { - TMODE (XTTYMODE_intr, tc.t_intrc); - TMODE (XTTYMODE_quit, tc.t_quitc); - TMODE (XTTYMODE_erase, sg.sg_erase); - TMODE (XTTYMODE_kill, sg.sg_kill); - TMODE (XTTYMODE_eof, tc.t_eofc); - TMODE (XTTYMODE_start, tc.t_startc); - TMODE (XTTYMODE_stop, tc.t_stopc); - TMODE (XTTYMODE_brk, tc.t_brkc); - /* both SYSV and BSD have ltchars */ - TMODE (XTTYMODE_susp, ltc.t_suspc); - TMODE (XTTYMODE_dsusp, ltc.t_dsuspc); - TMODE (XTTYMODE_rprnt, ltc.t_rprntc); - TMODE (XTTYMODE_flush, ltc.t_flushc); - TMODE (XTTYMODE_weras, ltc.t_werasc); - TMODE (XTTYMODE_lnext, ltc.t_lnextc); - } + ltc = d_ltc; - if (ioctl (tty, TIOCSETP, (char *)&sg) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCSETP); - if (ioctl (tty, TIOCSETC, (char *)&tc) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCSETC); - if (ioctl (tty, TIOCSETD, (char *)&discipline) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCSETD); - if (ioctl (tty, TIOCSLTC, (char *)<c) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCSLTC); - if (ioctl (tty, TIOCLSET, (char *)&lmode) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCLSET); + if (override_tty_modes) { + TMODE(XTTYMODE_intr, tc.t_intrc); + TMODE(XTTYMODE_quit, tc.t_quitc); + TMODE(XTTYMODE_erase, sg.sg_erase); + TMODE(XTTYMODE_kill, sg.sg_kill); + TMODE(XTTYMODE_eof, tc.t_eofc); + TMODE(XTTYMODE_start, tc.t_startc); + TMODE(XTTYMODE_stop, tc.t_stopc); + TMODE(XTTYMODE_brk, tc.t_brkc); + /* both SYSV and BSD have ltchars */ + TMODE(XTTYMODE_susp, ltc.t_suspc); + TMODE(XTTYMODE_dsusp, ltc.t_dsuspc); + TMODE(XTTYMODE_rprnt, ltc.t_rprntc); + TMODE(XTTYMODE_flush, ltc.t_flushc); + TMODE(XTTYMODE_weras, ltc.t_werasc); + TMODE(XTTYMODE_lnext, ltc.t_lnextc); + } + + if (ioctl(tty, TIOCSETP, (char *) &sg) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); + if (ioctl(tty, TIOCSETC, (char *) &tc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETC); + if (ioctl(tty, TIOCSETD, (char *) &discipline) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETD); + if (ioctl(tty, TIOCSLTC, (char *) <c) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSLTC); + if (ioctl(tty, TIOCLSET, (char *) &lmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCLSET); #ifdef sony - if (ioctl (tty, TIOCKSET, (char *)&jmode) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCKSET); - if (ioctl (tty, TIOCKSETC, (char *)&jtc) == -1) - HsSysError (cp_pipe[1], ERROR_TIOCKSETC); + if (ioctl(tty, TIOCKSET, (char *) &jmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCKSET); + if (ioctl(tty, TIOCKSETC, (char *) &jtc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCKSETC); #endif /* sony */ -#endif /* !USE_ANY_SYSV_TERMIO */ +#endif /* !USE_ANY_SYSV_TERMIO */ #if defined(TIOCCONS) || defined(SRIOCSREDIR) - if (Console) { + if (Console) { #ifdef TIOCCONS - int on = 1; - if (ioctl (tty, TIOCCONS, (char *)&on) == -1) - fprintf(stderr, "%s: cannot open console: %s\n", - xterm_name, strerror(errno)); + int on = 1; + if (ioctl(tty, TIOCCONS, (char *) &on) == -1) + fprintf(stderr, "%s: cannot open console: %s\n", + xterm_name, strerror(errno)); #endif #ifdef SRIOCSREDIR - int fd = open("/dev/console",O_RDWR); - if (fd == -1 || ioctl (fd, SRIOCSREDIR, tty) == -1) - fprintf(stderr, "%s: cannot open console: %s\n", - xterm_name, strerror(errno)); - (void) close (fd); + int fd = open("/dev/console", O_RDWR); + if (fd == -1 || ioctl(fd, SRIOCSREDIR, tty) == -1) + fprintf(stderr, "%s: cannot open console: %s\n", + xterm_name, strerror(errno)); + (void) close(fd); #endif - } -#endif /* TIOCCONS */ } +#endif /* TIOCCONS */ + } - signal (SIGCHLD, SIG_DFL); + signal(SIGCHLD, SIG_DFL); #ifdef USE_SYSV_SIGHUP - /* watch out for extra shells (I don't understand either) */ - signal (SIGHUP, SIG_DFL); + /* watch out for extra shells (I don't understand either) */ + signal(SIGHUP, SIG_DFL); #else - signal (SIGHUP, SIG_IGN); + signal(SIGHUP, SIG_IGN); #endif - /* restore various signals to their defaults */ - signal (SIGINT, SIG_DFL); - signal (SIGQUIT, SIG_DFL); - signal (SIGTERM, SIG_DFL); + /* restore various signals to their defaults */ + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); - /* - * If we're not asked to make the parent process set the - * terminal's erase mode, and if we had no ttyModes resource, - * then set the terminal's erase mode from our best guess. - */ + /* + * If we're not asked to make the parent process set the + * terminal's erase mode, and if we had no ttyModes resource, + * then set the terminal's erase mode from our best guess. + */ #if OPT_INITIAL_ERASE - TRACE(("check if we should set erase to %d:%s\n\tptyInitialErase:%d,\n\toveride_tty_modes:%d,\n\tXTTYMODE_erase:%d\n", - initial_erase, - (! resource.ptyInitialErase - && !override_tty_modes - && !ttymodelist[XTTYMODE_erase].set) - ? "YES" : "NO", - resource.ptyInitialErase, - override_tty_modes, - ttymodelist[XTTYMODE_erase].set)); - if (! resource.ptyInitialErase - && !override_tty_modes - && !ttymodelist[XTTYMODE_erase].set) { - int old_erase; + TRACE(("check if we should set erase to %d:%s\n\tptyInitialErase:%d,\n\toveride_tty_modes:%d,\n\tXTTYMODE_erase:%d\n", + initial_erase, + (!resource.ptyInitialErase + && !override_tty_modes + && !ttymodelist[XTTYMODE_erase].set) + ? "YES" : "NO", + resource.ptyInitialErase, + override_tty_modes, + ttymodelist[XTTYMODE_erase].set)); + if (!resource.ptyInitialErase + && !override_tty_modes + && !ttymodelist[XTTYMODE_erase].set) { + int old_erase; #ifdef USE_ANY_SYSV_TERMIO - if (ioctl(tty, TCGETA, &tio) == -1) - tio = d_tio; - old_erase = tio.c_cc[VERASE]; - tio.c_cc[VERASE] = initial_erase; - rc = ioctl(tty, TCSETA, &tio); + if (ioctl(tty, TCGETA, &tio) == -1) + tio = d_tio; + old_erase = tio.c_cc[VERASE]; + tio.c_cc[VERASE] = initial_erase; + rc = ioctl(tty, TCSETA, &tio); #elif defined(USE_POSIX_TERMIOS) - if (tcgetattr(tty, &tio) == -1) - tio = d_tio; - old_erase = tio.c_cc[VERASE]; - tio.c_cc[VERASE] = initial_erase; - rc = tcsetattr(tty, TCSANOW, &tio); -#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - if (ioctl(tty, TIOCGETP, (char *)&sg) == -1) - sg = d_sg; - old_erase = sg.sg_erase; - sg.sg_erase = initial_erase; - rc = ioctl(tty, TIOCSETP, (char *)&sg); -#endif /* USE_ANY_SYSV_TERMIO */ - TRACE(("%s setting erase to %d (was %d)\n", - rc ? "FAIL" : "OK", initial_erase, old_erase)); - } + if (tcgetattr(tty, &tio) == -1) + tio = d_tio; + old_erase = tio.c_cc[VERASE]; + tio.c_cc[VERASE] = initial_erase; + rc = tcsetattr(tty, TCSANOW, &tio); +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + if (ioctl(tty, TIOCGETP, (char *) &sg) == -1) + sg = d_sg; + old_erase = sg.sg_erase; + sg.sg_erase = initial_erase; + rc = ioctl(tty, TIOCSETP, (char *) &sg); +#endif /* USE_ANY_SYSV_TERMIO */ + TRACE(("%s setting erase to %d (was %d)\n", + rc ? "FAIL" : "OK", initial_erase, old_erase)); + } #endif - /* copy the environment before Setenving */ - for (i = 0 ; environ [i] != NULL ; i++) - ; - /* compute number of xtermSetenv() calls below */ - envsize = 1; /* (NULL terminating entry) */ - envsize += 3; /* TERM, WINDOWID, DISPLAY */ + /* copy the environment before Setenving */ + for (i = 0; environ[i] != NULL; i++) ; + /* compute number of xtermSetenv() calls below */ + envsize = 1; /* (NULL terminating entry) */ + envsize += 3; /* TERM, WINDOWID, DISPLAY */ #ifdef HAVE_UTMP - envsize += 1; /* LOGNAME */ + envsize += 1; /* LOGNAME */ #endif /* HAVE_UTMP */ #ifdef USE_SYSV_ENVVARS - envsize += 2; /* COLUMNS, LINES */ + envsize += 2; /* COLUMNS, LINES */ #ifdef HAVE_UTMP - envsize += 2; /* HOME, SHELL */ + envsize += 2; /* HOME, SHELL */ #endif /* HAVE_UTMP */ #ifdef OWN_TERMINFO_DIR - envsize += 1; /* TERMINFO */ + envsize += 1; /* TERMINFO */ #endif #else /* USE_SYSV_ENVVARS */ - envsize += 1; /* TERMCAP */ + envsize += 1; /* TERMCAP */ #endif /* USE_SYSV_ENVVARS */ - envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *)); - memmove( (char *)envnew, (char *)environ, i * sizeof(char *)); - environ = envnew; - xtermSetenv ("TERM=", TermName); - if(!TermName) - *newtc = 0; - - sprintf (buf, "%lu", - ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen))))); - xtermSetenv ("WINDOWID=", buf); + envnew = (char **) calloc((unsigned) i + envsize, sizeof(char *)); + memmove((char *) envnew, (char *) environ, i * sizeof(char *)); + environ = envnew; + xtermSetenv("TERM=", TermName); + if (!TermName) + *newtc = 0; + + sprintf(buf, "%lu", + ((unsigned long) XtWindow(XtParent(CURRENT_EMU(screen))))); + xtermSetenv("WINDOWID=", buf); - /* put the display into the environment of the shell*/ - xtermSetenv ("DISPLAY=", XDisplayString (screen->display)); + /* put the display into the environment of the shell */ + xtermSetenv("DISPLAY=", XDisplayString(screen->display)); - signal(SIGTERM, SIG_DFL); + signal(SIGTERM, SIG_DFL); -#ifndef AMOEBA - /* this is the time to go and set up stdin, out, and err - */ - { + /* this is the time to go and set up stdin, out, and err + */ + { #if defined(CRAY) && (OSMAJORVERSION >= 6) - (void) close(tty); - (void) close(0); + (void) close(tty); + (void) close(0); - if (open ("/dev/tty", O_RDWR)) { - fprintf(stderr, "cannot open /dev/tty: %s\n", strerror(errno)); - exit(1); - } - (void) close(1); - (void) close(2); - dup(0); - dup(0); + if (open("/dev/tty", O_RDWR)) { + SysError(ERROR_OPDEVTTY); + } + (void) close(1); + (void) close(2); + dup(0); + dup(0); #else - /* dup the tty */ - for (i = 0; i <= 2; i++) - if (i != tty) { - (void) close(i); - (void) dup(tty); - } - + /* dup the tty */ + for (i = 0; i <= 2; i++) + if (i != tty) { + (void) close(i); + (void) dup(tty); + } #ifndef ATT - /* and close the tty */ - if (tty > 2) - (void) close(tty); + /* and close the tty */ + if (tty > 2) + (void) close(tty); #endif #endif /* CRAY */ - } + } #if !defined(USE_SYSV_PGRP) #ifdef TIOCSCTTY - setsid(); - ioctl(0, TIOCSCTTY, 0); + setsid(); + ioctl(0, TIOCSCTTY, 0); #endif - ioctl(0, TIOCSPGRP, (char *)&pgrp); - setpgrp(0,0); - close(open(ttydev, O_WRONLY, 0)); - setpgrp (0, pgrp); + ioctl(0, TIOCSPGRP, (char *) &pgrp); + setpgrp(0, 0); + close(open(ttydev, O_WRONLY)); + setpgrp(0, pgrp); #if defined(__QNX__) - tcsetpgrp( 0, pgrp /*setsid()*/ ); + tcsetpgrp(0, pgrp /*setsid() */ ); #endif #endif /* !USE_SYSV_PGRP */ -#endif /* AMOEBA */ - #ifdef Lynx - { - struct termio t; - if (ioctl(0, TCGETA, &t) >= 0) - { - /* this gets lost somewhere on our way... */ - t.c_oflag |= OPOST; - ioctl(0, TCSETA, &t); - } + { + struct termio t; + if (ioctl(0, TCGETA, &t) >= 0) { + /* this gets lost somewhere on our way... */ + t.c_oflag |= OPOST; + ioctl(0, TCSETA, &t); } + } #endif #ifdef HAVE_UTMP - pw = getpwuid(screen->uid); - login_name = NULL; - if (pw && pw->pw_name) { + pw = getpwuid(screen->uid); + login_name = NULL; + if (pw && pw->pw_name) { #ifdef HAVE_GETLOGIN - /* - * If the value from getlogin() differs from the value we - * get by looking in the password file, check if it does - * correspond to the same uid. If so, allow that as an - * alias for the uid. - * - * Of course getlogin() will fail if we're started from - * a window-manager, since there's no controlling terminal - * to fuss with. In that case, try to get something useful - * from the user's $LOGNAME or $USER environment variables. - */ - if (((login_name = getlogin()) != NULL - || (login_name = getenv("LOGNAME")) != NULL - || (login_name = getenv("USER")) != NULL) - && strcmp(login_name, pw->pw_name)) { - struct passwd *pw2 = getpwnam(login_name); - if (pw2 != 0 - && pw->pw_uid != pw2->pw_uid) { - login_name = NULL; - } + /* + * If the value from getlogin() differs from the value we + * get by looking in the password file, check if it does + * correspond to the same uid. If so, allow that as an + * alias for the uid. + * + * Of course getlogin() will fail if we're started from + * a window-manager, since there's no controlling terminal + * to fuss with. In that case, try to get something useful + * from the user's $LOGNAME or $USER environment variables. + */ + if (((login_name = getlogin()) != NULL + || (login_name = getenv("LOGNAME")) != NULL + || (login_name = getenv("USER")) != NULL) + && strcmp(login_name, pw->pw_name)) { + struct passwd *pw2 = getpwnam(login_name); + if (pw2 != 0 + && pw->pw_uid != pw2->pw_uid) { + login_name = NULL; } -#endif - if (login_name == NULL) - login_name = pw->pw_name; - if (login_name != NULL) - login_name = x_strdup(login_name); - } - if (login_name != NULL) { - xtermSetenv ("LOGNAME=", login_name); /* for POSIX */ } +#endif + if (login_name == NULL) + login_name = pw->pw_name; + if (login_name != NULL) + login_name = x_strdup(login_name); + } + if (login_name != NULL) { + xtermSetenv("LOGNAME=", login_name); /* for POSIX */ + } #ifdef USE_SYSV_UTMP - /* Set up our utmp entry now. We need to do it here - ** for the following reasons: - ** - It needs to have our correct process id (for - ** login). - ** - If our parent was to set it after the fork(), - ** it might make it out before we need it. - ** - We need to do it before we go and change our - ** user and group id's. - */ - (void) setutent (); - /* set up entry to search for */ - bzero((char *)&utmp, sizeof(utmp)); - (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof (utmp.ut_id)); - - utmp.ut_type = DEAD_PROCESS; - - /* position to entry in utmp file */ - /* Test return value: beware of entries left behind: PSz 9 Mar 00 */ - if (! ( utret = getutid(&utmp) ) ) { + /* Set up our utmp entry now. We need to do it here + * for the following reasons: + * - It needs to have our correct process id (for + * login). + * - If our parent was to set it after the fork(), + * it might make it out before we need it. + * - We need to do it before we go and change our + * user and group id's. + */ + (void) setutent(); + /* set up entry to search for */ + bzero((char *) &utmp, sizeof(utmp)); + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); + + utmp.ut_type = DEAD_PROCESS; + + /* position to entry in utmp file */ + /* Test return value: beware of entries left behind: PSz 9 Mar 00 */ + if (!(utret = getutid(&utmp))) { + (void) setutent(); + utmp.ut_type = USER_PROCESS; + if (!(utret = getutid(&utmp))) { (void) setutent(); - utmp.ut_type = USER_PROCESS; - if (! ( utret = getutid(&utmp) ) ) { - (void) setutent(); - } } + } #if OPT_TRACE - if ( ! utret ) - TRACE(("getutid: NULL\n")); - else - TRACE(("getutid: pid=%d type=%d user=%s line=%s id=%s\n", - utret->ut_pid, utret->ut_type, utret->ut_user, - utret->ut_line, utret->ut_id)); + if (!utret) + TRACE(("getutid: NULL\n")); + else + TRACE(("getutid: pid=%d type=%d user=%s line=%s id=%s\n", + utret->ut_pid, utret->ut_type, utret->ut_user, + utret->ut_line, utret->ut_id)); #endif - /* set up the new entry */ - utmp.ut_type = USER_PROCESS; + /* set up the new entry */ + utmp.ut_type = USER_PROCESS; #ifdef HAVE_UTMP_UT_XSTATUS - utmp.ut_xstatus = 2; + utmp.ut_xstatus = 2; #endif - (void) strncpy(utmp.ut_user, - (login_name != NULL) ? login_name : "????", - sizeof(utmp.ut_user)); - - /* why are we copying this string again? (see above) */ - (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); - (void) strncpy (utmp.ut_line, - my_pty_name(ttydev), sizeof (utmp.ut_line)); + (void) strncpy(utmp.ut_user, + (login_name != NULL) ? login_name : "????", + sizeof(utmp.ut_user)); + /* why are we copying this string again? (see above) */ + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); + (void) strncpy(utmp.ut_line, + my_pty_name(ttydev), sizeof(utmp.ut_line)); #ifdef HAVE_UTMP_UT_HOST - (void) strncpy(buf, DisplayString(screen->display), - sizeof(buf)); + (void) strncpy(buf, DisplayString(screen->display), sizeof(buf)); #ifndef linux - { - char *disfin = strrchr(buf, ':'); - if (disfin) - *disfin = '\0'; - } + { + char *disfin = strrchr(buf, ':'); + if (disfin) + *disfin = '\0'; + } #endif - (void) strncpy(utmp.ut_host, buf, sizeof(utmp.ut_host)); + (void) strncpy(utmp.ut_host, buf, sizeof(utmp.ut_host)); #endif - (void) strncpy(utmp.ut_name, login_name, sizeof(utmp.ut_name)); + (void) strncpy(utmp.ut_name, + (login_name) ? login_name : "????", + sizeof(utmp.ut_name)); - utmp.ut_pid = getpid(); + utmp.ut_pid = getpid(); #if defined(HAVE_UTMP_UT_XTIME) #if defined(HAVE_UTMP_UT_SESSION) - utmp.ut_session = getsid(0); + utmp.ut_session = getsid(0); #endif - utmp.ut_xtime = time ((time_t *) 0); - utmp.ut_tv.tv_usec = 0; + utmp.ut_xtime = time((time_t *) 0); + utmp.ut_tv.tv_usec = 0; #else - utmp.ut_time = time ((time_t *) 0); + utmp.ut_time = time((time_t *) 0); #endif - /* write out the entry */ - if (!resource.utmpInhibit) { - errno = 0; - pututline(&utmp); - TRACE(("pututline: %d %d %s\n", - resource.utmpInhibit, - errno, strerror(errno))); - } + /* write out the entry */ + if (!resource.utmpInhibit) { + errno = 0; + pututline(&utmp); + TRACE(("pututline: %d %d %s\n", + resource.utmpInhibit, + errno, strerror(errno))); + } #ifdef WTMP #if defined(SVR4) || defined(SCO325) - if (term->misc.login_shell) - updwtmpx(WTMPX_FILE, &utmp); + if (term->misc.login_shell) + updwtmpx(WTMPX_FILE, &utmp); #elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)) - if (term->misc.login_shell) - updwtmp(etc_wtmp, &utmp); + if (term->misc.login_shell) + updwtmp(etc_wtmp, &utmp); #else - if (term->misc.login_shell && - (i = open(etc_wtmp, O_WRONLY|O_APPEND)) >= 0) { - write(i, (char *)&utmp, sizeof(utmp)); - close(i); - } + if (term->misc.login_shell && + (i = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + write(i, (char *) &utmp, sizeof(utmp)); + close(i); + } #endif #endif - /* close the file */ - (void) endutent(); + /* close the file */ + (void) endutent(); -#else /* USE_SYSV_UTMP */ - /* We can now get our ttyslot! We can also set the initial - * utmp entry. - */ - tslot = ttyslot(); - added_utmp_entry = False; - { - if (pw && !resource.utmpInhibit && - (i = open(etc_utmp, O_WRONLY)) >= 0) { - bzero((char *)&utmp, sizeof(utmp)); - (void) strncpy(utmp.ut_line, - my_pty_name(ttydev), - sizeof(utmp.ut_line)); - (void) strncpy(utmp.ut_name, login_name, - sizeof(utmp.ut_name)); -#ifdef MINIX - utmp.ut_pid = getpid(); - utmp.ut_type = USER_PROCESS; -#endif /* MINIX */ +#else /* USE_SYSV_UTMP */ + /* We can now get our ttyslot! We can also set the initial + * utmp entry. + */ + tslot = ttyslot(); + added_utmp_entry = False; + { + if (tslot > 0 && pw && !resource.utmpInhibit && + (i = open(etc_utmp, O_WRONLY)) >= 0) { + bzero((char *) &utmp, sizeof(utmp)); + (void) strncpy(utmp.ut_line, + my_pty_name(ttydev), + sizeof(utmp.ut_line)); + (void) strncpy(utmp.ut_name, login_name, + sizeof(utmp.ut_name)); #ifdef HAVE_UTMP_UT_HOST - (void) strncpy(utmp.ut_host, - XDisplayString (screen->display), - sizeof(utmp.ut_host)); -#endif - /* cast needed on Ultrix 4.4 */ - time((time_t*)&utmp.ut_time); - lseek(i, (long)(tslot * sizeof(utmp)), 0); - write(i, (char *)&utmp, sizeof(utmp)); - close(i); - added_utmp_entry = True; + (void) strncpy(utmp.ut_host, + XDisplayString(screen->display), + sizeof(utmp.ut_host)); +#endif + /* cast needed on Ultrix 4.4 */ + time((time_t *) & utmp.ut_time); + lseek(i, (long) (tslot * sizeof(utmp)), 0); + write(i, (char *) &utmp, sizeof(utmp)); + close(i); + added_utmp_entry = True; #if defined(WTMP) - if (term->misc.login_shell && - (i = open(etc_wtmp, O_WRONLY|O_APPEND)) >= 0) { - int status; - status = write(i, (char *)&utmp, - sizeof(utmp)); - status = close(i); - } + if (term->misc.login_shell && + (i = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + int status; + status = write(i, (char *) &utmp, sizeof(utmp)); + status = close(i); + } #elif defined(MNX_LASTLOG) - if (term->misc.login_shell && - (i = open(_U_LASTLOG, O_WRONLY)) >= 0) { - lseek(i, (long)(screen->uid * - sizeof (utmp)), 0); - write(i, (char *)&utmp, sizeof (utmp)); - close(i); - } + if (term->misc.login_shell && + (i = open(_U_LASTLOG, O_WRONLY)) >= 0) { + lseek(i, (long) (screen->uid * + sizeof(utmp)), 0); + write(i, (char *) &utmp, sizeof(utmp)); + close(i); + } #endif /* WTMP or MNX_LASTLOG */ - } else - tslot = -tslot; - } + } else + tslot = -tslot; + } - /* Let's pass our ttyslot to our parent so that it can - * clean up after us. - */ + /* Let's pass our ttyslot to our parent so that it can + * clean up after us. + */ #ifdef USE_HANDSHAKE - handshake.tty_slot = tslot; + handshake.tty_slot = tslot; #endif /* USE_HANDSHAKE */ #endif /* USE_SYSV_UTMP */ #ifdef USE_LASTLOG - if (term->misc.login_shell && + if (term->misc.login_shell && (i = open(etc_lastlog, O_WRONLY)) >= 0) { - bzero((char *)&lastlog, sizeof (struct lastlog)); - (void) strncpy(lastlog.ll_line, - my_pty_name(ttydev), - sizeof (lastlog.ll_line)); - (void) strncpy(lastlog.ll_host, - XDisplayString (screen->display), - sizeof (lastlog.ll_host)); - time(&lastlog.ll_time); - lseek(i, (long)(screen->uid * - sizeof (struct lastlog)), 0); - write(i, (char *)&lastlog, - sizeof (struct lastlog)); - close(i); - } + bzero((char *) &lastlog, sizeof(struct lastlog)); + (void) strncpy(lastlog.ll_line, + my_pty_name(ttydev), + sizeof(lastlog.ll_line)); + (void) strncpy(lastlog.ll_host, + XDisplayString(screen->display), + sizeof(lastlog.ll_host)); + time(&lastlog.ll_time); + lseek(i, (long) (screen->uid * sizeof(struct lastlog)), 0); + write(i, (char *) &lastlog, sizeof(struct lastlog)); + close(i); + } #endif /* USE_LASTLOG */ +#ifdef __OpenBSD__ + /* Switch to real gid after writing utmp entry */ + utmpGid = getegid(); + if (getgid() != getegid()) { + utmpGid = getegid(); + setegid(getgid()); + } +#endif + #ifdef USE_HANDSHAKE - /* Let our parent know that we set up our utmp entry - * so that it can clean up after us. - */ - handshake.status = UTMP_ADDED; - handshake.error = 0; - strcpy(handshake.buffer, ttydev); - (void)write(cp_pipe[1], (char *)&handshake, sizeof(handshake)); + /* Let our parent know that we set up our utmp entry + * so that it can clean up after us. + */ + handshake.status = UTMP_ADDED; + handshake.error = 0; + strcpy(handshake.buffer, ttydev); + (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); #endif /* USE_HANDSHAKE */ -#endif/* HAVE_UTMP */ +#endif /* HAVE_UTMP */ - (void) setgid (screen->gid); + (void) setgid(screen->gid); #ifdef HAS_BSD_GROUPS - if (geteuid() == 0 && pw) { - if (initgroups (login_name, pw->pw_gid)) { - perror( "initgroups failed" ); - exit (errno); - } + if (geteuid() == 0 && pw) { + if (initgroups(login_name, pw->pw_gid)) { + perror("initgroups failed"); + SysError(ERROR_INIGROUPS); } + } #endif - if (setuid (screen->uid)) { - perror( "setuid failed" ); - exit (errno); - } - + if (setuid(screen->uid)) { + SysError(ERROR_SETUID); + } #ifdef USE_HANDSHAKE - /* mark the pipes as close on exec */ - fcntl(cp_pipe[1], F_SETFD, 1); - fcntl(pc_pipe[0], F_SETFD, 1); - - /* We are at the point where we are going to - * exec our shell (or whatever). Let our parent - * know we arrived safely. - */ - handshake.status = PTY_GOOD; - handshake.error = 0; - (void)strcpy(handshake.buffer, ttydev); - (void)write(cp_pipe[1], (char *)&handshake, sizeof(handshake)); - - if (waiting_for_initial_map) { - i = read (pc_pipe[0], (char *) &handshake, - sizeof(handshake)); - if (i != sizeof(handshake) || - handshake.status != PTY_EXEC) { - /* some very bad problem occurred */ - exit (ERROR_PTY_EXEC); - } - if(handshake.rows > 0 && handshake.cols > 0) { - screen->max_row = handshake.rows; - screen->max_col = handshake.cols; + /* mark the pipes as close on exec */ + fcntl(cp_pipe[1], F_SETFD, 1); + fcntl(pc_pipe[0], F_SETFD, 1); + + /* We are at the point where we are going to + * exec our shell (or whatever). Let our parent + * know we arrived safely. + */ + handshake.status = PTY_GOOD; + handshake.error = 0; + (void) strcpy(handshake.buffer, ttydev); + (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); + + if (waiting_for_initial_map) { + i = read(pc_pipe[0], (char *) &handshake, + sizeof(handshake)); + if (i != sizeof(handshake) || + handshake.status != PTY_EXEC) { + /* some very bad problem occurred */ + exit(ERROR_PTY_EXEC); + } + if (handshake.rows > 0 && handshake.cols > 0) { + screen->max_row = handshake.rows; + screen->max_col = handshake.cols; #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - ts.ts_lines = screen->max_row + 1; - ts.ts_cols = screen->max_col + 1; + ts.ts_lines = screen->max_row + 1; + ts.ts_cols = screen->max_col + 1; #elif defined(TIOCSWINSZ) - ws.ws_row = screen->max_row + 1; - ws.ws_col = screen->max_col + 1; - ws.ws_xpixel = FullWidth(screen); - ws.ws_ypixel = FullHeight(screen); + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); #endif /* sun vs TIOCSWINSZ */ - } } + } #endif /* USE_HANDSHAKE */ #ifdef USE_SYSV_ENVVARS - { + { char numbuf[12]; - sprintf (numbuf, "%d", screen->max_col + 1); + sprintf(numbuf, "%d", screen->max_col + 1); xtermSetenv("COLUMNS=", numbuf); - sprintf (numbuf, "%d", screen->max_row + 1); + sprintf(numbuf, "%d", screen->max_row + 1); xtermSetenv("LINES=", numbuf); - } + } #ifdef HAVE_UTMP - if (pw) { /* SVR4 doesn't provide these */ - if (!getenv("HOME")) - xtermSetenv("HOME=", pw->pw_dir); - if (!getenv("SHELL")) - xtermSetenv("SHELL=", pw->pw_shell); - } + if (pw) { /* SVR4 doesn't provide these */ + if (!getenv("HOME")) + xtermSetenv("HOME=", pw->pw_dir); + if (!getenv("SHELL")) + xtermSetenv("SHELL=", pw->pw_shell); + } #endif /* HAVE_UTMP */ #ifdef OWN_TERMINFO_DIR - xtermSetenv("TERMINFO=", OWN_TERMINFO_DIR); + xtermSetenv("TERMINFO=", OWN_TERMINFO_DIR); #endif #else /* USE_SYSV_ENVVARS */ - if(!TEK4014_ACTIVE(screen) && *newtc) { - strcpy (termcap, newtc); - resize (screen, termcap, newtc); - } - if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { - remove_termcap_entry (newtc, "ti="); - remove_termcap_entry (newtc, "te="); - } - /* - * work around broken termcap entries */ - if (resource.useInsertMode) { - remove_termcap_entry (newtc, "ic="); - /* don't get duplicates */ - remove_termcap_entry (newtc, "im="); - remove_termcap_entry (newtc, "ei="); - remove_termcap_entry (newtc, "mi"); - if(*newtc) - strcat (newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); - } - if (*newtc) { + if (!TEK4014_ACTIVE(screen) && *newtc) { + strcpy(termcap, newtc); + resize(screen, termcap, newtc); + } + if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { + remove_termcap_entry(newtc, "ti="); + remove_termcap_entry(newtc, "te="); + } + /* + * work around broken termcap entries */ + if (resource.useInsertMode) { + remove_termcap_entry(newtc, "ic="); + /* don't get duplicates */ + remove_termcap_entry(newtc, "im="); + remove_termcap_entry(newtc, "ei="); + remove_termcap_entry(newtc, "mi"); + if (*newtc) + strcat(newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); + } + if (*newtc) { #if OPT_INITIAL_ERASE - unsigned len; - remove_termcap_entry (newtc, TERMCAP_ERASE "="); - len = strlen(newtc); - if (len != 0 && newtc[len-1] == ':') - len--; - sprintf(newtc + len, ":%s=\\%03o:", TERMCAP_ERASE, initial_erase & 0377); + unsigned len; + remove_termcap_entry(newtc, TERMCAP_ERASE "="); + len = strlen(newtc); + if (len != 0 && newtc[len - 1] == ':') + len--; + sprintf(newtc + len, ":%s=\\%03o:", + TERMCAP_ERASE, + initial_erase & 0377); #endif - xtermSetenv ("TERMCAP=", newtc); - } + xtermSetenv("TERMCAP=", newtc); + } #endif /* USE_SYSV_ENVVARS */ - - /* need to reset after all the ioctl bashing we did above */ + /* need to reset after all the ioctl bashing we did above */ #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - i = ioctl (0, TIOCSSIZE, &ts); - TRACE(("spawn TIOCSSIZE %dx%d return %d\n", ts.ts_lines, ts.ts_cols, i)); + i = ioctl(0, TIOCSSIZE, &ts); + TRACE(("spawn TIOCSSIZE %dx%d return %d\n", + ts.ts_lines, ts.ts_cols, i)); #elif defined(TIOCSWINSZ) - i = ioctl (0, TIOCSWINSZ, (char *)&ws); - TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", ws.ws_row, ws.ws_col, i)); + i = ioctl(0, TIOCSWINSZ, (char *) &ws); + TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", + ws.ws_row, ws.ws_col, i)); #else - TRACE(("spawn cannot tell pty its size\n")); -#endif /* sun vs TIOCSWINSZ */ - signal(SIGHUP, SIG_DFL); - if (command_to_exec) { - TRACE(("spawning command \"%s\"\n", *command_to_exec)); - execvp(*command_to_exec, command_to_exec); - /* print error message on screen */ - fprintf(stderr, "%s: Can't execvp %s: %s\n", - xterm_name, *command_to_exec, strerror(errno)); - } - -#ifdef USE_SYSV_SIGHUP - /* fix pts sh hanging around */ - signal (SIGHUP, SIG_DFL); -#endif + TRACE(("spawn cannot tell pty its size\n")); +#endif /* sun vs TIOCSWINSZ */ + signal(SIGHUP, SIG_DFL); #ifdef HAVE_UTMP - if(((ptr = getenv("SHELL")) == NULL || *ptr == 0) && - ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) || + if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) || *(ptr = pw->pw_shell) == 0)) -#else /* HAVE_UTMP */ - if(((ptr = getenv("SHELL")) == NULL || *ptr == 0) && - ((pw = getpwuid(screen->uid)) == NULL || +#else /* HAVE_UTMP */ + if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + ((pw = getpwuid(screen->uid)) == NULL || *(ptr = pw->pw_shell) == 0)) -#endif /* HAVE_UTMP */ - ptr = "/bin/sh"; - shname = x_basename(ptr); - shname_minus = (char *)malloc(strlen(shname) + 2); - (void) strcpy(shname_minus, "-"); - (void) strcat(shname_minus, shname); -#if !defined(USE_ANY_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS) - ldisc = XStrCmp("csh", shname + strlen(shname) - 3) == 0 ? - NTTYDISC : 0; - ioctl(0, TIOCSETD, (char *)&ldisc); -#endif /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#endif /* HAVE_UTMP */ + ptr = "/bin/sh"; + shname = x_basename(ptr); -#ifdef USE_LOGIN_DASH_P - if (term->misc.login_shell && pw && added_utmp_entry) - execl (bin_login, "login", "-p", "-f", login_name, 0); +#if OPT_LUIT_PROG + /* + * Use two copies of command_to_exec, in case luit is not actually + * there, or refuses to run. In that case we will fall-through to + * to command that the user gave anyway. + */ + if (command_to_exec_with_luit) { + TRACE(("spawning command \"%s\"\n", *command_to_exec_with_luit)); + execvp(*command_to_exec_with_luit, command_to_exec_with_luit); + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s: %s\n", + xterm_name, *command_to_exec_with_luit, strerror(errno)); + fprintf(stderr, "%s: cannot support your locale.\n", + xterm_name); + } #endif - execlp (ptr, (term->misc.login_shell ? shname_minus : shname), - 0); + if (command_to_exec) { + TRACE(("spawning command \"%s\"\n", *command_to_exec)); + execvp(*command_to_exec, command_to_exec); + if (command_to_exec[1] == 0) + execlp(ptr, shname, "-c", command_to_exec[0], 0); + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s: %s\n", + xterm_name, *command_to_exec, strerror(errno)); + } +#ifdef USE_SYSV_SIGHUP + /* fix pts sh hanging around */ + signal(SIGHUP, SIG_DFL); +#endif - /* Exec failed. */ - fprintf (stderr, "%s: Could not exec %s: %s\n", xterm_name, - ptr, strerror(errno)); - (void) sleep(5); - exit(ERROR_EXEC); - } /* end if in child after fork */ + shname_minus = (char *) malloc(strlen(shname) + 2); + (void) strcpy(shname_minus, "-"); + (void) strcat(shname_minus, shname); +#if !defined(USE_ANY_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS) + ldisc = XStrCmp("csh", shname + strlen(shname) - 3) == 0 ? + NTTYDISC : 0; + ioctl(0, TIOCSETD, (char *) &ldisc); +#endif /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#ifdef USE_LOGIN_DASH_P + if (term->misc.login_shell && pw && added_utmp_entry) + execl(bin_login, "login", "-p", "-f", login_name, (void *) 0); +#endif + execlp(ptr, + (term->misc.login_shell ? shname_minus : shname), + (void *) 0); + + /* Exec failed. */ + fprintf(stderr, "%s: Could not exec %s: %s\n", xterm_name, + ptr, strerror(errno)); + (void) sleep(5); + exit(ERROR_EXEC); + } + /* end if in child after fork */ #ifdef USE_HANDSHAKE - /* Parent process. Let's handle handshaked requests to our - * child process. - */ + /* Parent process. Let's handle handshaked requests to our + * child process. + */ - /* close childs's sides of the pipes */ - close (cp_pipe[1]); - close (pc_pipe[0]); - - for (done = 0; !done; ) { - if (read(cp_pipe[0], (char *) &handshake, sizeof(handshake)) <= 0) { - /* Our child is done talking to us. If it terminated - * due to an error, we will catch the death of child - * and clean up. - */ - break; - } + /* close childs's sides of the pipes */ + close(cp_pipe[1]); + close(pc_pipe[0]); + + for (done = 0; !done;) { + if (read(cp_pipe[0], (char *) &handshake, sizeof(handshake)) <= 0) { + /* Our child is done talking to us. If it terminated + * due to an error, we will catch the death of child + * and clean up. + */ + break; + } - switch(handshake.status) { - case PTY_GOOD: - /* Success! Let's free up resources and - * continue. - */ - done = 1; - break; + switch (handshake.status) { + case PTY_GOOD: + /* Success! Let's free up resources and + * continue. + */ + done = 1; + break; - case PTY_BAD: - /* The open of the pty failed! Let's get - * another one. - */ - (void) close(screen->respond); - if (get_pty(&screen->respond, XDisplayString(screen->display))) { - /* no more ptys! */ - fprintf(stderr, - "%s: child process can find no available ptys: %s\n", - xterm_name, strerror(errno)); - handshake.status = PTY_NOMORE; - write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); - exit (ERROR_PTYS); - } - handshake.status = PTY_NEW; - (void) strcpy(handshake.buffer, ttydev); - write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); - break; + case PTY_BAD: + /* The open of the pty failed! Let's get + * another one. + */ + (void) close(screen->respond); + if (get_pty(&screen->respond, XDisplayString(screen->display))) { + /* no more ptys! */ + fprintf(stderr, + "%s: child process can find no available ptys: %s\n", + xterm_name, strerror(errno)); + handshake.status = PTY_NOMORE; + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + exit(ERROR_PTYS); + } + handshake.status = PTY_NEW; + (void) strcpy(handshake.buffer, ttydev); + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + break; - case PTY_FATALERROR: - errno = handshake.error; - close(cp_pipe[0]); - close(pc_pipe[1]); - SysError(handshake.fatal_error); - - case UTMP_ADDED: - /* The utmp entry was set by our slave. Remember - * this so that we can reset it later. - */ - added_utmp_entry = True; + case PTY_FATALERROR: + errno = handshake.error; + close(cp_pipe[0]); + close(pc_pipe[1]); + SysError(handshake.fatal_error); + /*NOTREACHED */ + + case UTMP_ADDED: + /* The utmp entry was set by our slave. Remember + * this so that we can reset it later. + */ + added_utmp_entry = True; #ifndef USE_SYSV_UTMP - tslot = handshake.tty_slot; -#endif /* USE_SYSV_UTMP */ - free(ttydev); - ttydev = x_strdup(handshake.buffer); - break; - default: - fprintf(stderr, "%s: unexpected handshake status %d\n", - xterm_name, handshake.status); - } - } - /* close our sides of the pipes */ - if (!waiting_for_initial_map) { - close (cp_pipe[0]); - close (pc_pipe[1]); + tslot = handshake.tty_slot; +#endif /* USE_SYSV_UTMP */ + free(ttydev); + ttydev = x_strdup(handshake.buffer); + break; + default: + fprintf(stderr, "%s: unexpected handshake status %d\n", + xterm_name, handshake.status); } + } + /* close our sides of the pipes */ + if (!waiting_for_initial_map) { + close(cp_pipe[0]); + close(pc_pipe[1]); + } #endif /* USE_HANDSHAKE */ - } /* end if no slave */ - - /* - * still in parent (xterm process) - */ + } + /* end if no slave */ + /* + * still in parent (xterm process) + */ #ifdef USE_SYSV_SIGHUP - /* hung sh problem? */ - signal (SIGHUP, SIG_DFL); + /* hung sh problem? */ + signal(SIGHUP, SIG_DFL); #else - signal (SIGHUP, SIG_IGN); + signal(SIGHUP, SIG_IGN); #endif /* @@ -4032,538 +4122,199 @@ */ #if defined(USE_SYSV_SIGNALS) && !defined(SIGTSTP) - signal (SIGINT, SIG_IGN); + signal(SIGINT, SIG_IGN); #ifndef SYSV - /* hung shell problem */ - signal (SIGQUIT, SIG_IGN); + /* hung shell problem */ + signal(SIGQUIT, SIG_IGN); #endif - signal (SIGTERM, SIG_IGN); + signal(SIGTERM, SIG_IGN); #elif defined(SYSV) || defined(__osf__) - /* if we were spawned by a jobcontrol smart shell (like ksh or csh), - * then our pgrp and pid will be the same. If we were spawned by - * a jobcontrol dumb shell (like /bin/sh), then we will be in our - * parent's pgrp, and we must ignore keyboard signals, or we will - * tank on everything. - */ - if (getpid() == getpgrp()) { - (void) signal(SIGINT, Exit); - (void) signal(SIGQUIT, Exit); - (void) signal(SIGTERM, Exit); - } else { - (void) signal(SIGINT, SIG_IGN); - (void) signal(SIGQUIT, SIG_IGN); - (void) signal(SIGTERM, SIG_IGN); - } - (void) signal(SIGPIPE, Exit); -#else /* SYSV */ - signal (SIGINT, Exit); - signal (SIGQUIT, Exit); - signal (SIGTERM, Exit); - signal (SIGPIPE, Exit); -#endif /* USE_SYSV_SIGNALS and not SIGTSTP */ - - return 0; -} /* end spawn */ -#else /* AMOEBA */ -/* manifest constants */ -#define TTY_NTHREADS 2 -#define TTY_INQSIZE 2000 -#define TTY_OUTQSIZE 1000 -#define TTY_THREAD_STACKSIZE 4096 - -#define XWATCHDOG_THREAD_SIZE 4096 - -/* acceptable defaults */ -#define DEF_HOME "/home" -#define DEF_SHELL "/bin/sh" -#define DEF_PATH "/bin:/usr/bin:/profile/util" - -extern capability ttycap; -extern char **environ; -extern struct caplist *capv; - -/* - * Set capability. - * I made this a function since it cannot be a macro. - */ -void -setcap(struct caplist *capvec, int n, char *name, capability *cap) -{ - capvec[n].cl_name = name; - capvec[n].cl_cap = cap; -} - -/* - * Find process descriptor for specified program, - * necessarily running down the user's PATH. - */ -errstat -find_program(char *program, capability *programcap) -{ - errstat err; - - if ((err = name_lookup(program, programcap)) != STD_OK) { - char *path, *name; - char programpath[1024]; - - if ((path = getenv("PATH")) == NULL) - path = DEF_PATH; - name = x_basename(program); - - do { - register char *p = programpath; - register char *n = name; - char *c1 = path; - - while (*path && *path != ':') - *p++ = *path++; - if (path != c1) *p++ = '/'; - if (*path) path++; - while (*n) *p++ = *n++; - *p = '\0'; - if ((err = name_lookup(programpath, programcap)) == STD_OK) - break; - } while (*path); - } - return err; -} - -/* Semaphore on which the main thread blocks until it can do something - * useful (which is made known by a call to WakeupMainThread()). - */ -static semaphore main_sema; - -void -InitMainThread(void) -{ - sema_init(&main_sema, 0); -} - -void -WakeupMainThread(void) -{ - sema_up(&main_sema); -} - -/* - * Spawn off tty threads and fork the login process. - */ -static int spawn(void) -{ - register TScreen *screen = &term->screen; - char *TermName = NULL; - char termcap[TERMCAP_SIZE]; - char newtc[TERMCAP_SIZE]; - char **envnew; /* new environment */ - int envsize; /* elements in new environment */ - char *ptr; - int i, n, ncap; - errstat err; - struct caplist *cl; - char buf[64]; - struct caplist *capvnew; - int ttythread(); - int xwatchdogthread(); - - screen->pid = 2; /* at least > 1 */ - screen->uid = getuid(); - screen->gid = getgid(); - screen->respond = OPEN_MAX + 1; - screen->tty_inq = cb_alloc(TTY_INQSIZE); - screen->tty_outq = cb_alloc(TTY_OUTQSIZE); - - InitMainThread(); - if (!thread_newthread(xwatchdogthread, XWATCHDOG_THREAD_SIZE, 0, 0)) { - fprintf(stderr, "%s: unable to start tty thread.\n", ProgramName); - Exit(1); - } - - /* - * Start tty threads. Ordinarily two should suffice, one for standard - * input and one for standard (error) output. - */ - ttyinit((char *) NULL); - for (i = 0; i < TTY_NTHREADS; i++) { - if (!thread_newthread(ttythread, TTY_THREAD_STACKSIZE, 0, 0)) { - fprintf(stderr, "%s: unable to start tty thread.\n", ProgramName); - Exit(1); - } - } - - /* avoid double MapWindow requests */ - XtSetMappedWhenManaged( XtParent(CURRENT_EMU(screen)), False ); - wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", - False); - - /* realize now so know window size for tty driver */ - if (!TEK4014_ACTIVE(screen)) VTInit(); - -#if OPT_TEK4014 - if (screen->TekEmu) { - envnew = tekterm; - ptr = newtc; - } else -#endif - { - envnew = vtterm; - ptr = termcap; - } - - get_termcap(TermName = resource.term_name, ptr, newtc); - - if (!TermName) { - TermName = *envnew; - while (*envnew != NULL) { - if (get_termcap(*envnew, ptr, newtc)) { - TermName = *envnew; - break; - } - envnew++; - } - } - - /* - * Setup new capability environment. The whole point of the game is - * to redirect the shell's stdin/stdout/stderr and tty to our own - * tty server instead of the initial one. - */ - for (ncap = 4, cl = capv; cl->cl_name != (char *)NULL; cl++) - if (strcmp("STDIN", cl->cl_name) && strcmp("STDOUT", cl->cl_name) - && strcmp("STDERR", cl->cl_name) && strcmp("TTY", cl->cl_name)) - ncap++; - - capvnew = (struct caplist *) - calloc((unsigned) ncap + 1, sizeof(struct caplist)); - setcap(capvnew, 0, "STDIN", &ttycap); - setcap(capvnew, 1, "STDOUT", &ttycap); - setcap(capvnew, 2, "STDERR", &ttycap); - setcap(capvnew, 3, "TTY", &ttycap); - for (n = 4, cl = capv; cl->cl_name != (char *) NULL; cl++) { - if (strcmp("STDIN", cl->cl_name) - && strcmp("STDOUT", cl->cl_name) - && strcmp("STDERR", cl->cl_name) - && strcmp("TTY", cl->cl_name)) - setcap(capvnew, n++, cl->cl_name, cl->cl_cap); - } - setcap(capvnew, ncap, (char *)NULL, (capability *)NULL); - if (n != ncap) { - fprintf(stderr, "%s: bad capability set.\n", ProgramName); - Exit(1); - } - - /* - * Setup environment variables. We add some extra ones to denote - * window id, terminal type, display name, termcap entry, and some - * standard one (which are required by every shell) HOME and SHELL. - * Note that the two shell variables COLUMNS and LINES are not needed - * under Amoeba since the tty server provides an RPC to query the - * window sizes. + /* if we were spawned by a jobcontrol smart shell (like ksh or csh), + * then our pgrp and pid will be the same. If we were spawned by + * a jobcontrol dumb shell (like /bin/sh), then we will be in our + * parent's pgrp, and we must ignore keyboard signals, or we will + * tank on everything. */ - /* copy the environment before Setenving */ - for (i = 0 ; environ[i] != NULL ; i++) - ; - - /* compute number of xtermSetenv() calls below */ - envsize = 1; /* (NULL terminating entry) */ - envsize += 3; /* TERM, WINDOWID, DISPLAY */ - envsize += 2; /* HOME, SHELL */ - envsize += 1; /* TERMCAP */ - envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *)); - bcopy((char *)environ, (char *)envnew, i * sizeof(char *)); - environ = envnew; - xtermSetenv ("TERM=", TermName); - if(!TermName) *newtc = 0; - - sprintf (buf, "%lu", - ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen))))); - xtermSetenv ("WINDOWID=", buf); - - /* put the display into the environment of the shell*/ - xtermSetenv ("DISPLAY=", XDisplayString (screen->display)); - - /* always provide a HOME and SHELL definition */ - if (!getenv("HOME")) xtermSetenv("HOME=", DEF_HOME); - if (!getenv("SHELL")) xtermSetenv("SHELL=", DEF_SHELL); - - if(!TEK4014_ACTIVE(screen) && *newtc) { - strcpy (termcap, newtc); - resize (screen, termcap, newtc); - } - if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { - remove_termcap_entry (newtc, "ti="); - remove_termcap_entry (newtc, "te="); - } - /* work around broken termcap entries */ - if (resource.useInsertMode) { - remove_termcap_entry (newtc, "ic="); - /* don't get duplicates */ - remove_termcap_entry (newtc, "im="); - remove_termcap_entry (newtc, "ei="); - remove_termcap_entry (newtc, "mi"); - if (*newtc) - strcat (newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); - } - if (*newtc) - xtermSetenv ("TERMCAP=", newtc); - - /* - * Execute specified program or shell. Use find_program to - * simulate the same behaviour as the original execvp. - */ - if (command_to_exec) { - capability programcap; - - if (find_program(*command_to_exec, &programcap) != STD_OK) { - fprintf(stderr, "%s: Could not find %s!\n", - xterm_name, *command_to_exec); - exit(ERROR_EXEC); - } - - err = exec_file(&programcap, NILCAP, &ttycap, 0, - command_to_exec, envnew, capvnew, &screen->proccap); - if (err != STD_OK) { - fprintf(stderr, "%s: Could not exec %s!\n", - xterm_name, *command_to_exec); - exit(ERROR_EXEC); - } + if (getpid() == getpgrp()) { + (void) signal(SIGINT, Exit); + (void) signal(SIGQUIT, Exit); + (void) signal(SIGTERM, Exit); } else { - char *shell, *shname, *shname_minus; - capability shellcap; - char *argvec[2]; - - if ((shell = getenv("SHELL")) == NULL) - shell = DEF_SHELL; /* "cannot happen" */ - shname = x_basename(shell); - shname_minus = malloc(strlen(shname) + 2); - (void) strcpy(shname_minus, "-"); - (void) strcat(shname_minus, shname); - - argvec[0] = term->misc.login_shell ? shname_minus : shname; - argvec[1] = NULL; - - if (find_program(shell, &shellcap) != STD_OK) { - fprintf(stderr, "%s: Could not find %s!\n", xterm_name, shell); - exit(ERROR_EXEC); - } - - err = exec_file(&shellcap, NILCAP, &ttycap, 0, argvec, - envnew, capvnew, &screen->proccap); - if (err != STD_OK) { - fprintf(stderr, "%s: Could not exec %s!\n", xterm_name, shell); - exit(ERROR_EXEC); - } - - free(shname_minus); + (void) signal(SIGINT, SIG_IGN); + (void) signal(SIGQUIT, SIG_IGN); + (void) signal(SIGTERM, SIG_IGN); } - free(capvnew); - - signal(SIGINT, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - signal(SIGTERM, SIG_IGN); + (void) signal(SIGPIPE, Exit); +#else /* SYSV */ + signal(SIGINT, Exit); + signal(SIGQUIT, Exit); + signal(SIGTERM, Exit); signal(SIGPIPE, Exit); - return 0; -} - -/* - * X watch-dog thread. This thread unblocks the main - * thread when there's an X event. - */ -xwatchdogthread(void) -{ - register TScreen *screen = &term->screen; - - for (;;) { - int n = _X11TransAmSelect(ConnectionNumber(screen->display), 10); - if (n < 0 && errno != EINTR) { - fprintf(stderr, "%s: X watch dog: Xselect failed: %s\n", - ProgramName, SysErrorMsg(errno)); - Cleanup(1); - } else if (n > 0) - WakeupMainThread(); - threadswitch(); - } -} - -void -SleepMainThread(void) -{ - int remaining; - - /* Wait for at least one event */ - sema_down(&main_sema); +#endif /* USE_SYSV_SIGNALS and not SIGTSTP */ - /* Since the main thread will continue handling all outstanding events - * shortly, we can ignore the remaining wakeups that were done. - */ - if ((remaining = sema_level(&main_sema)) > 1) { - sema_mdown(&main_sema, remaining); - } -} -#endif /* AMOEBA */ + return 0; +} /* end spawn */ SIGNAL_T Exit(int n) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; #ifdef USE_UTEMPTER - if (!resource.utmpInhibit && added_utmp_entry) - removeFromUtmp(); + if (!resource.utmpInhibit && added_utmp_entry) + removeFromUtmp(); #elif defined(HAVE_UTMP) #ifdef USE_SYSV_UTMP -#if defined(UTMPX_FOR_UTMP) - struct utmpx utmp; - struct utmpx *utptr; -#else - struct utmp utmp; - struct utmp *utptr; -#endif + struct UTMP_STR utmp; + struct UTMP_STR *utptr; #if defined(WTMP) && !defined(SVR4) && !(defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0))) - int fd; /* for /etc/wtmp */ + int fd; /* for /etc/wtmp */ #endif - /* don't do this more than once */ - if (xterm_exiting) - SIGNAL_RETURN; - xterm_exiting = True; + /* don't do this more than once */ + if (xterm_exiting) + SIGNAL_RETURN; + xterm_exiting = True; #ifdef PUCC_PTYD - closepty(ttydev, ptydev, (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), screen->respond); + closepty(ttydev, ptydev, (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), screen->respond); #endif /* PUCC_PTYD */ - /* cleanup the utmp entry we forged earlier */ - if (!resource.utmpInhibit + /* cleanup the utmp entry we forged earlier */ + if (!resource.utmpInhibit #ifdef USE_HANDSHAKE /* without handshake, no way to know */ - && added_utmp_entry + && added_utmp_entry #endif /* USE_HANDSHAKE */ - ) { - utmp.ut_type = USER_PROCESS; - (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); - (void) setutent(); - utptr = getutid(&utmp); - /* write it out only if it exists, and the pid's match */ - if (utptr && (utptr->ut_pid == screen->pid)) { - utptr->ut_type = DEAD_PROCESS; + ) { +#ifdef __OpenBSD__ + if (utmpGid != -1) { + /* Switch back to group utmp */ + setegid(utmpGid); + } +#endif + utmp.ut_type = USER_PROCESS; + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); + (void) setutent(); + utptr = getutid(&utmp); + /* write it out only if it exists, and the pid's match */ + if (utptr && (utptr->ut_pid == screen->pid)) { + utptr->ut_type = DEAD_PROCESS; #if defined(HAVE_UTMP_UT_XTIME) #if defined(HAVE_UTMP_UT_SESSION) - utptr->ut_session = getsid(0); + utptr->ut_session = getsid(0); #endif - utptr->ut_xtime = time ((time_t *) 0); - utptr->ut_tv.tv_usec = 0; + utptr->ut_xtime = time((time_t *) 0); + utptr->ut_tv.tv_usec = 0; #else - *utptr->ut_user = 0; - utptr->ut_time = time((time_t *) 0); + *utptr->ut_user = 0; + utptr->ut_time = time((time_t *) 0); #endif - (void) pututline(utptr); + (void) pututline(utptr); #ifdef WTMP #if defined(SVR4) || defined(SCO325) - if (term->misc.login_shell) - updwtmpx(WTMPX_FILE, utptr); + if (term->misc.login_shell) + updwtmpx(WTMPX_FILE, utptr); #elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)) - strncpy (utmp.ut_line, utptr->ut_line, sizeof (utmp.ut_line)); - if (term->misc.login_shell) - updwtmp(etc_wtmp, utptr); + strncpy(utmp.ut_line, utptr->ut_line, sizeof(utmp.ut_line)); + if (term->misc.login_shell) + updwtmp(etc_wtmp, utptr); #else - /* set wtmp entry if wtmp file exists */ - if (term->misc.login_shell && - (fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { - write(fd, utptr, sizeof(*utptr)); - close(fd); - } + /* set wtmp entry if wtmp file exists */ + if (term->misc.login_shell && + (fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + write(fd, utptr, sizeof(*utptr)); + close(fd); + } #endif #endif - } - (void) endutent(); } -#else /* not USE_SYSV_UTMP */ - register int wfd; - struct utmp utmp; - - if (!resource.utmpInhibit && added_utmp_entry && - (am_slave < 0 && tslot > 0 && (wfd = open(etc_utmp, O_WRONLY)) >= 0)){ - bzero((char *)&utmp, sizeof(utmp)); - lseek(wfd, (long)(tslot * sizeof(utmp)), 0); - write(wfd, (char *)&utmp, sizeof(utmp)); - close(wfd); + (void) endutent(); + } +#else /* not USE_SYSV_UTMP */ + register int wfd; + struct utmp utmp; + + if (!resource.utmpInhibit && added_utmp_entry && + (am_slave < 0 && tslot > 0 && (wfd = open(etc_utmp, O_WRONLY)) >= 0)) { + bzero((char *) &utmp, sizeof(utmp)); + lseek(wfd, (long) (tslot * sizeof(utmp)), 0); + write(wfd, (char *) &utmp, sizeof(utmp)); + close(wfd); #ifdef WTMP - if (term->misc.login_shell && - (wfd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { - (void) strncpy(utmp.ut_line, - my_pty_name(ttydev), - sizeof (utmp.ut_line)); - time(&utmp.ut_time); - write(wfd, (char *)&utmp, sizeof(utmp)); - close(wfd); - } -#endif /* WTMP */ + if (term->misc.login_shell && + (wfd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + (void) strncpy(utmp.ut_line, + my_pty_name(ttydev), + sizeof(utmp.ut_line)); + time(&utmp.ut_time); + write(wfd, (char *) &utmp, sizeof(utmp)); + close(wfd); } -#endif /* USE_SYSV_UTMP */ -#endif /* HAVE_UTMP */ -#ifndef AMOEBA - close(screen->respond); /* close explicitly to avoid race with slave side */ -#endif +#endif /* WTMP */ + } +#endif /* USE_SYSV_UTMP */ +#endif /* HAVE_UTMP */ + close(screen->respond); /* close explicitly to avoid race with slave side */ #ifdef ALLOWLOGGING - if(screen->logging) - CloseLog(screen); + if (screen->logging) + CloseLog(screen); #endif -#ifndef AMOEBA - if (am_slave < 0) { - /* restore ownership of tty and pty */ - set_owner (ttydev, 0, 0, 0666); + if (am_slave < 0) { + /* restore ownership of tty and pty */ + set_owner(ttydev, 0, 0, 0666); #if (defined(USE_PTY_DEVICE) && !defined(__sgi) && !defined(__hpux)) - set_owner (ptydev, 0, 0, 0666); + set_owner(ptydev, 0, 0, 0666); #endif - } -#endif /* AMOEBA */ - exit(n); - SIGNAL_RETURN; + } + exit(n); + SIGNAL_RETURN; } /* ARGSUSED */ static void -resize(TScreen *screen, register char *oldtc, char *newtc) +resize(TScreen * screen, register char *oldtc, char *newtc) { #ifndef USE_SYSV_ENVVARS - register char *ptr1, *ptr2; - register size_t i; - register int li_first = 0; - register char *temp; - - TRACE(("resize %s\n", oldtc)); - if ((ptr1 = x_strindex (oldtc, "co#")) == NULL){ - strcat (oldtc, "co#80:"); - ptr1 = x_strindex (oldtc, "co#"); - } - if ((ptr2 = x_strindex (oldtc, "li#")) == NULL){ - strcat (oldtc, "li#24:"); - ptr2 = x_strindex (oldtc, "li#"); - } - if(ptr1 > ptr2) { - li_first++; - temp = ptr1; - ptr1 = ptr2; - ptr2 = temp; - } - ptr1 += 3; - ptr2 += 3; - strncpy (newtc, oldtc, i = ptr1 - oldtc); - temp = newtc + i; - sprintf (temp, "%d", li_first - ? screen->max_row + 1 - : screen->max_col + 1); - temp += strlen(temp); - ptr1 = strchr(ptr1, ':'); - strncpy (temp, ptr1, i = ptr2 - ptr1); - temp += i; - sprintf (temp, "%d", li_first - ? screen->max_col + 1 - : screen->max_row + 1); - ptr2 = strchr(ptr2, ':'); - strcat (temp, ptr2); - TRACE((" ==> %s\n", newtc)); + register char *ptr1, *ptr2; + register size_t i; + register int li_first = 0; + register char *temp; + + TRACE(("resize %s\n", oldtc)); + if ((ptr1 = x_strindex(oldtc, "co#")) == NULL) { + strcat(oldtc, "co#80:"); + ptr1 = x_strindex(oldtc, "co#"); + } + if ((ptr2 = x_strindex(oldtc, "li#")) == NULL) { + strcat(oldtc, "li#24:"); + ptr2 = x_strindex(oldtc, "li#"); + } + if (ptr1 > ptr2) { + li_first++; + temp = ptr1; + ptr1 = ptr2; + ptr2 = temp; + } + ptr1 += 3; + ptr2 += 3; + strncpy(newtc, oldtc, i = ptr1 - oldtc); + temp = newtc + i; + sprintf(temp, "%d", (li_first + ? screen->max_row + 1 + : screen->max_col + 1)); + temp += strlen(temp); + ptr1 = strchr(ptr1, ':'); + strncpy(temp, ptr1, i = ptr2 - ptr1); + temp += i; + sprintf(temp, "%d", (li_first + ? screen->max_col + 1 + : screen->max_row + 1)); + ptr2 = strchr(ptr2, ':'); + strcat(temp, ptr2); + TRACE((" ==> %s\n", newtc)); #endif /* USE_SYSV_ENVVARS */ } @@ -4578,29 +4329,30 @@ nonblocking_wait(void) { #ifdef USE_POSIX_WAIT - pid_t pid; + pid_t pid; - pid = waitpid(-1, NULL, WNOHANG); + pid = waitpid(-1, NULL, WNOHANG); #elif defined(USE_SYSV_SIGNALS) && (defined(CRAY) || !defined(SIGTSTP)) - /* cannot do non-blocking wait */ - int pid = 0; -#else /* defined(USE_SYSV_SIGNALS) && (defined(CRAY) || !defined(SIGTSTP)) */ + /* cannot do non-blocking wait */ + int pid = 0; +#else /* defined(USE_SYSV_SIGNALS) && (defined(CRAY) || !defined(SIGTSTP)) */ #if defined(Lynx) - int status; + int status; #else - union wait status; + union wait status; #endif - register int pid; + register int pid; - pid = wait3 (&status, WNOHANG, (struct rusage *)NULL); + pid = wait3(&status, WNOHANG, (struct rusage *) NULL); #endif /* USE_POSIX_WAIT else */ - return pid; + return pid; } #ifndef VMS /* ARGSUSED */ -static SIGNAL_T reapchild (int n GCC_UNUSED) +static SIGNAL_T +reapchild(int n GCC_UNUSED) { int olderrno = errno; int pid; @@ -4617,12 +4369,13 @@ do { if (pid == term->screen.pid) { #ifdef DEBUG - if (debug) fputs ("Exiting\n", stderr); + if (debug) + fputs("Exiting\n", stderr); #endif if (!hold_screen) - Cleanup (0); + Cleanup(0); } - } while ( (pid=nonblocking_wait()) > 0); + } while ((pid = nonblocking_wait()) > 0); errno = olderrno; SIGNAL_RETURN; @@ -4630,7 +4383,7 @@ #endif /* !VMS */ static void -remove_termcap_entry (char *buf, char *str) +remove_termcap_entry(char *buf, char *str) { char *base = buf; char *first = base; @@ -4649,8 +4402,7 @@ if (*buf != 0) buf++; } - while ((*first++ = *buf++) != 0) - ; + while ((*first++ = *buf++) != 0) ; TRACE(("...removed_termcap_entry('%s', '%s')\n", str, base)); return; } else if (*buf == '\\') { @@ -4675,7 +4427,8 @@ * where setting consists of the words in the modelist followed by a character * or ^char. */ -static int parse_tty_modes (char *s, struct _xttymodes *modelist) +static int +parse_tty_modes(char *s, struct _xttymodes *modelist) { struct _xttymodes *mp; int c; @@ -4683,74 +4436,60 @@ TRACE(("parse_tty_modes\n")); while (1) { - while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; - if (!*s) return count; + while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) + s++; + if (!*s) + return count; for (mp = modelist; mp->name; mp++) { - if (strncmp (s, mp->name, mp->len) == 0) break; + if (strncmp(s, mp->name, mp->len) == 0) + break; } - if (!mp->name) return -1; + if (!mp->name) + return -1; s += mp->len; - while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; - if (!*s) return -1; + while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) + s++; + if (!*s) + return -1; - if ((c = decode_keyvalue(s++, False)) != -1) { + if ((c = decode_keyvalue(&s, False)) != -1) { mp->value = c; mp->set = 1; count++; TRACE(("...parsed #%d: %s=%#x\n", count, mp->name, c)); } - while (*s && isascii(CharOf(*s)) && isgraph(CharOf(*s))) s++; } } -#ifndef VMS /* don't use pipes on OpenVMS */ -int GetBytesAvailable (int fd) +#ifndef VMS /* don't use pipes on OpenVMS */ +int +GetBytesAvailable(int fd) { -#ifdef AMOEBA - /* - * Since this routine is only used to poll X connections - * we can use an internal Xlib routine (oh what ugly). - */ - register TScreen *screen = &term->screen; - int count; - - if (ConnectionNumber(screen->display) != fd) { - Panic("Cannot get bytes available"); - return -1; - } - return _X11TransAmFdBytesReadable(fd, &count) < 0 ? -1 : count; -#elif defined(FIONREAD) +#if defined(FIONREAD) long arg; - ioctl (fd, FIONREAD, (char *) &arg); + ioctl(fd, FIONREAD, (char *) &arg); return (int) arg; #elif defined(__CYGWIN__) fd_set set; - struct timeval timeout = {0, 0}; + struct timeval timeout = + {0, 0}; - FD_ZERO (&set); - FD_SET (fd, &set); - if (select (fd+1, &set, NULL, NULL, &timeout) > 0) - return 1; + FD_ZERO(&set); + FD_SET(fd, &set); + if (select(fd + 1, &set, NULL, NULL, &timeout) > 0) + return 1; else - return 0; -#elif defined(MINIX) - /* The answer doesn't have to be correct. Calling nbio_isinprogress() is - * much cheaper than nbio_select(). - */ - if (nbio_isinprogress(fd, ASIO_READ)) return 0; - else - return 1; #elif defined(FIORDCK) - return (ioctl (fd, FIORDCHK, NULL)); + return (ioctl(fd, FIORDCHK, NULL)); #else /* !FIORDCK */ struct pollfd pollfds[1]; pollfds[0].fd = fd; pollfds[0].events = POLLIN; - return poll (pollfds, 1, 0); + return poll(pollfds, 1, 0); #endif } #endif /* !VMS */ @@ -4762,33 +4501,29 @@ kill_process_group(int pid, int sig) { TRACE(("kill_process_group(pid=%d, sig=%d)\n", pid, sig)); -#ifdef AMOEBA - if (pid != 2) { - fprintf(stderr, "%s: unexpected process id %d.\n", ProgramName, pid); - abort(); - } - ttysendsig(sig); -#elif defined(SVR4) || defined(SYSV) || !defined(X_NOT_POSIX) - return kill (-pid, sig); +#if defined(SVR4) || defined(SYSV) || !defined(X_NOT_POSIX) + return kill(-pid, sig); #else - return killpg (pid, sig); -#endif /* AMOEBA */ + return killpg(pid, sig); +#endif } #if OPT_EBCDIC -int A2E(int x) +int +A2E(int x) { char c; c = x; - __atoe_l(&c,1); + __atoe_l(&c, 1); return c; } -int E2A(int x) +int +E2A(int x) { char c; c = x; - __etoa_l(&c,1); + __etoa_l(&c, 1); return c; } #endif @@ -4803,29 +4538,30 @@ struct _proc_session ps; struct _proc_session_reply rps; -int qsetlogin( char *login, char *ttyname ) +int +qsetlogin(char *login, char *ttyname) { - int v = getsid( getpid() ); + int v = getsid(getpid()); - memset( &ps, 0, sizeof(ps) ); - memset( &rps, 0, sizeof(rps) ); + memset(&ps, 0, sizeof(ps)); + memset(&rps, 0, sizeof(rps)); - ps.type = _PROC_SESSION; - ps.subtype = _PROC_SUB_ACTION1; - ps.sid = v; - strcpy( ps.name, login ); + ps.type = _PROC_SESSION; + ps.subtype = _PROC_SUB_ACTION1; + ps.sid = v; + strcpy(ps.name, login); - Send( 1, &ps, &rps, sizeof(ps), sizeof(rps) ); + Send(1, &ps, &rps, sizeof(ps), sizeof(rps)); - if ( rps.status < 0 ) - return( rps.status ); + if (rps.status < 0) + return (rps.status); - ps.type = _PROC_SESSION; - ps.subtype = _PROC_SUB_ACTION2; - ps.sid = v; - sprintf( ps.name, "//%d%s", getnid(), ttyname ); - Send( 1, &ps, &rps, sizeof(ps), sizeof(rps) ); + ps.type = _PROC_SESSION; + ps.subtype = _PROC_SUB_ACTION2; + ps.sid = v; + sprintf(ps.name, "//%d%s", getnid(), ttyname); + Send(1, &ps, &rps, sizeof(ps), sizeof(rps)); - return( rps.status ); + return (rps.status); } #endif Index: xc/programs/xterm/main.h diff -u xc/programs/xterm/main.h:3.6 xc/programs/xterm/main.h:3.7 --- xc/programs/xterm/main.h:3.6 Sat Sep 8 21:07:26 2001 +++ xc/programs/xterm/main.h Sat Aug 17 15:52:26 2002 @@ -2,7 +2,7 @@ * $Xorg: main.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/main.h,v 3.6 2001/09/09 01:07:26 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/main.h,v 3.7 2002/08/17 19:52:26 dickey Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -36,3 +36,11 @@ #define DEFBORDER 2 #define DEFFACENAME NULL #define DEFFACESIZE 14 + +#ifndef PROJECTROOT +#define PROJECTROOT "/usr/X11R6" +#endif + +#define DEFLOCALEFILTER2(x) #x +#define DEFLOCALEFILTER1(x) DEFLOCALEFILTER2(x) +#define DEFLOCALEFILTER DEFLOCALEFILTER1(PROJECTROOT) "/bin/luit" Index: xc/programs/xterm/menu.c diff -u xc/programs/xterm/menu.c:3.44 xc/programs/xterm/menu.c:3.49 --- xc/programs/xterm/menu.c:3.44 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/menu.c Sat Oct 5 13:57:12 2002 @@ -1,7 +1,7 @@ /* $Xorg: menu.c,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /* -Copyright 1999, 2001 by Thomas E. Dickey +Copyright 1999-2001,2002 by Thomas E. Dickey All Rights Reserved @@ -22,7 +22,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - Copyright 1989 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -46,17 +45,17 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xterm/menu.c,v 3.44 2002/01/05 22:05:03 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/menu.c,v 3.49 2002/10/05 17:57:12 dickey Exp $ */ #include <xterm.h> #include <data.h> #include <menu.h> #include <fontutils.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> #include <X11/Xmu/CharSet.h> +#if defined(HAVE_LIB_XAW) + #include <X11/Xaw/SimpleMenu.h> #include <X11/Xaw/Box.h> #include <X11/Xaw/SmeBSB.h> @@ -67,9 +66,35 @@ #include <X11/Xaw/Form.h> #endif +#elif defined(HAVE_LIB_XAW3D) + +#include <X11/Xaw3d/SimpleMenu.h> +#include <X11/Xaw3d/Box.h> +#include <X11/Xaw3d/SmeBSB.h> +#include <X11/Xaw3d/SmeLine.h> + +#if OPT_TOOLBAR +#include <X11/Xaw3d/MenuButton.h> +#include <X11/Xaw3d/Form.h> +#endif + +#elif defined(HAVE_LIB_NEXTAW) + +#include <X11/neXtaw/SimpleMenu.h> +#include <X11/neXtaw/Box.h> +#include <X11/neXtaw/SmeBSB.h> +#include <X11/neXtaw/SmeLine.h> + +#if OPT_TOOLBAR +#include <X11/neXtaw/MenuButton.h> +#include <X11/neXtaw/Form.h> +#endif + +#endif + #include <stdio.h> #include <signal.h> - +/* *INDENT-OFF* */ static void do_8bit_control PROTO_XT_CALLBACK_ARGS; static void do_allow132 PROTO_XT_CALLBACK_ARGS; static void do_allowsends PROTO_XT_CALLBACK_ARGS; @@ -90,6 +115,7 @@ static void do_marginbell PROTO_XT_CALLBACK_ARGS; static void do_old_fkeys PROTO_XT_CALLBACK_ARGS; static void do_print PROTO_XT_CALLBACK_ARGS; +static void do_print_redir PROTO_XT_CALLBACK_ARGS; static void do_quit PROTO_XT_CALLBACK_ARGS; static void do_redraw PROTO_XT_CALLBACK_ARGS; static void do_reversevideo PROTO_XT_CALLBACK_ARGS; @@ -174,13 +200,15 @@ MenuEntry mainMenuEntries[] = { { "securekbd", do_securekbd, NULL }, { "allowsends", do_allowsends, NULL }, + { "redraw", do_redraw, NULL }, + { "line1", NULL, NULL }, #ifdef ALLOWLOGGING { "logging", do_logging, NULL }, #endif { "print", do_print, NULL }, - { "redraw", do_redraw, NULL }, - { "line1", NULL, NULL }, - { "8-bit control", do_8bit_control, NULL }, + { "print-redirect", do_print_redir, NULL }, + { "line2", NULL, NULL }, + { "8-bit control", do_8bit_control,NULL }, { "backarrow key", do_backarrow, NULL }, #if OPT_NUM_LOCK { "num-lock", do_num_lock, NULL }, @@ -198,14 +226,14 @@ #if OPT_SUNPC_KBD { "sunKeyboard", do_sun_kbd, NULL }, #endif - { "line2", NULL, NULL }, + { "line3", NULL, NULL }, { "suspend", do_suspend, NULL }, { "continue", do_continue, NULL }, { "interrupt", do_interrupt, NULL }, { "hangup", do_hangup, NULL }, { "terminate", do_terminate, NULL }, { "kill", do_kill, NULL }, - { "line3", NULL, NULL }, + { "line4", NULL, NULL }, { "quit", do_quit, NULL }}; MenuEntry vtMenuEntries[] = { @@ -302,6 +330,7 @@ #endif { 0, 0, 0 }, }; +/* *INDENT-ON* */ /* * FIXME: These are global data rather than in the xterm widget because they @@ -322,7 +351,7 @@ * Returns a pointer to the MenuList entry that matches the popup menu. */ static MenuList * -select_menu (Widget w GCC_UNUSED, MenuIndex num) +select_menu(Widget w GCC_UNUSED, MenuIndex num) { #if OPT_TEK4014 && OPT_TOOLBAR while (w != 0) { @@ -339,7 +368,7 @@ * Returns a pointer to the given popup menu shell */ static Widget -obtain_menu (Widget w, MenuIndex num) +obtain_menu(Widget w, MenuIndex num) { return select_menu(w, num)->w; } @@ -348,7 +377,7 @@ * Returns the number of entries in the given popup menu shell */ static Cardinal -sizeof_menu (Widget w, MenuIndex num) +sizeof_menu(Widget w, MenuIndex num) { return select_menu(w, num)->entries; } @@ -358,10 +387,14 @@ */ static Widget -create_menu (Widget w, XtermWidget xtw, MenuIndex num) +create_menu(Widget w, XtermWidget xtw, MenuIndex num) { - static XtCallbackRec cb[2] = { { NULL, NULL }, { NULL, NULL }}; - static Arg arg = { XtNcallback, (XtArgVal) cb }; + static XtCallbackRec cb[2] = + { + {NULL, NULL}, + {NULL, NULL}}; + static Arg arg = + {XtNcallback, (XtArgVal) cb}; Widget m; TScreen *screen = &xtw->screen; @@ -376,24 +409,27 @@ */ #define check_width 9 #define check_height 8 - static unsigned char check_bits[] = { - 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00, - 0x31, 0x00, 0x1b, 0x00, 0x0e, 0x00, 0x04, 0x00 + static unsigned char check_bits[] = + { + 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00, + 0x31, 0x00, 0x1b, 0x00, 0x0e, 0x00, 0x04, 0x00 }; screen->menu_item_bitmap = - XCreateBitmapFromData (XtDisplay(xtw), - RootWindowOfScreen(XtScreen(xtw)), - (char *)check_bits, check_width, check_height); + XCreateBitmapFromData(XtDisplay(xtw), + RootWindowOfScreen(XtScreen(xtw)), + (char *) check_bits, check_width, check_height); } - #if OPT_TOOLBAR m = list->w; if (m == 0) { return m; } #else - m = XtCreatePopupShell (data->internal_name, simpleMenuWidgetClass, toplevel, NULL, 0); + m = XtCreatePopupShell(data->internal_name, + simpleMenuWidgetClass, + toplevel, + NULL, 0); list->w = m; #endif list->entries = nentries; @@ -401,18 +437,19 @@ for (; nentries > 0; nentries--, entries++) { cb[0].callback = (XtCallbackProc) entries->function; cb[0].closure = (caddr_t) entries->name; - entries->widget = XtCreateManagedWidget (entries->name, - (entries->function ? - smeBSBObjectClass : - smeLineObjectClass), m, - &arg, (Cardinal) 1); + entries->widget = XtCreateManagedWidget(entries->name, + (entries->function ? + smeBSBObjectClass : + smeLineObjectClass), m, + &arg, (Cardinal) 1); } /* do not realize at this point */ return m; } -static int indexOfMenu(String menuName) +static int +indexOfMenu(String menuName) { int me; switch (*menuName) { @@ -441,11 +478,11 @@ */ /* ARGSUSED */ -static Bool domenu ( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params, /* mainMenu, vtMenu, or tekMenu */ - Cardinal *param_count) /* 0 or 1 */ +static Bool +domenu(Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params, /* mainMenu, vtMenu, or tekMenu */ + Cardinal * param_count) /* 0 or 1 */ { TScreen *screen = &term->screen; int me; @@ -453,29 +490,30 @@ Widget mw; if (*param_count != 1) { - Bell(XkbBI_MinorError,0); + Bell(XkbBI_MinorError, 0); return False; } if ((me = indexOfMenu(params[0])) < 0) { - Bell(XkbBI_MinorError,0); + Bell(XkbBI_MinorError, 0); return False; } if ((mw = obtain_menu(w, (MenuIndex) me)) == 0 - || sizeof_menu(w, me) == 0) { - mw = create_menu (w, term, (MenuIndex) me); + || sizeof_menu(w, me) == 0) { + mw = create_menu(w, term, (MenuIndex) me); created = (mw != 0); } if (mw == 0) return False; switch (me) { - case mainMenu: + case mainMenu: if (created) { update_securekbd(); update_allowsends(); update_logging(); + update_print_redir(); update_8bit_control(); update_decbkm(); update_num_lock(); @@ -483,22 +521,22 @@ update_delete_del(); update_keyboard_type(); if (screen->terminal_id < 200) { - set_sensitivity (mw, - mainMenuEntries[mainMenu_8bit_ctrl].widget, - FALSE); + set_sensitivity(mw, + mainMenuEntries[mainMenu_8bit_ctrl].widget, + FALSE); } -#if !defined(SIGTSTP) || defined(AMOEBA) - set_sensitivity (mw, - mainMenuEntries[mainMenu_suspend].widget, FALSE); -#endif -#if !defined(SIGCONT) || defined(AMOEBA) - set_sensitivity (mw, - mainMenuEntries[mainMenu_continue].widget, FALSE); +#if !defined(SIGTSTP) + set_sensitivity(mw, + mainMenuEntries[mainMenu_suspend].widget, FALSE); +#endif +#if !defined(SIGCONT) + set_sensitivity(mw, + mainMenuEntries[mainMenu_continue].widget, FALSE); #endif } break; - case vtMenu: + case vtMenu: if (created) { update_scrollbar(); update_jumpscroll(); @@ -520,54 +558,53 @@ update_titeInhibit(); #ifndef NO_ACTIVE_ICON if (!screen->fnt_icon || !screen->iconVwin.window) { - set_sensitivity (mw, - vtMenuEntries[vtMenu_activeicon].widget, - FALSE); - } - else + set_sensitivity(mw, + vtMenuEntries[vtMenu_activeicon].widget, + FALSE); + } else update_activeicon(); #endif /* NO_ACTIVE_ICON */ } break; - case fontMenu: + case fontMenu: if (created) { - set_menu_font (True); - set_sensitivity (mw, - fontMenuEntries[fontMenu_fontescape].widget, - (screen->menu_font_names[fontMenu_fontescape] - ? TRUE : FALSE)); + set_menu_font(True); + set_sensitivity(mw, + fontMenuEntries[fontMenu_fontescape].widget, + (screen->menu_font_names[fontMenu_fontescape] + ? TRUE : FALSE)); #if OPT_BOX_CHARS update_font_boxchars(); - set_sensitivity (mw, - fontMenuEntries[fontMenu_font_boxchars].widget, - True); + set_sensitivity(mw, + fontMenuEntries[fontMenu_font_boxchars].widget, + True); #endif -#if OPT_DEC_SOFTFONT /* FIXME: not implemented */ +#if OPT_DEC_SOFTFONT /* FIXME: not implemented */ update_font_loadable(); - set_sensitivity (mw, - fontMenuEntries[fontMenu_font_loadable].widget, - FALSE); + set_sensitivity(mw, + fontMenuEntries[fontMenu_font_loadable].widget, + FALSE); #endif #if OPT_DEC_CHRSET update_font_doublesize(); if (term->screen.cache_doublesize == 0) - set_sensitivity (mw, + set_sensitivity(mw, fontMenuEntries[fontMenu_font_doublesize].widget, False); #endif } - FindFontSelection (NULL, True); - set_sensitivity (mw, - fontMenuEntries[fontMenu_fontsel].widget, - (screen->menu_font_names[fontMenu_fontsel] - ? TRUE : FALSE)); + FindFontSelection(NULL, True); + set_sensitivity(mw, + fontMenuEntries[fontMenu_fontsel].widget, + (screen->menu_font_names[fontMenu_fontsel] + ? TRUE : FALSE)); break; #if OPT_TEK4014 - case tekMenu: + case tekMenu: if (created) { - set_tekfont_menu_item (screen->cur.fontsize, TRUE); + set_tekfont_menu_item(screen->cur.fontsize, TRUE); update_vtshow(); } break; @@ -576,99 +613,100 @@ return True; } + +void +HandleCreateMenu(Widget w, + XEvent * event, /* unused */ + String * params, /* mainMenu, vtMenu, or tekMenu */ + Cardinal * param_count) /* 0 or 1 */ +{ + (void) domenu(w, event, params, param_count); +} -void HandleCreateMenu ( - Widget w, - XEvent *event, /* unused */ - String *params, /* mainMenu, vtMenu, or tekMenu */ - Cardinal *param_count) /* 0 or 1 */ -{ - (void) domenu (w, event, params, param_count); -} - -void HandlePopupMenu ( - Widget w, - XEvent *event, /* unused */ - String *params, /* mainMenu, vtMenu, or tekMenu */ - Cardinal *param_count) /* 0 or 1 */ +void +HandlePopupMenu(Widget w, + XEvent * event, /* unused */ + String * params, /* mainMenu, vtMenu, or tekMenu */ + Cardinal * param_count) /* 0 or 1 */ { - if (domenu (w, event, params, param_count)) { + if (domenu(w, event, params, param_count)) { #if OPT_TOOLBAR w = select_menu(w, mainMenu)->w; #endif - XtCallActionProc (w, "XawPositionSimpleMenu", event, params, 1); - XtCallActionProc (w, "MenuPopup", event, params, 1); + XtCallActionProc(w, "XawPositionSimpleMenu", event, params, 1); + XtCallActionProc(w, "MenuPopup", event, params, 1); } } - /* * private interfaces - keep out! */ /* ARGSUSED */ -static void handle_send_signal (Widget gw GCC_UNUSED, int sig) +static void +handle_send_signal(Widget gw GCC_UNUSED, int sig) { #ifndef VMS register TScreen *screen = &term->screen; - if (hold_screen > 1) hold_screen = 0; - if (screen->pid > 1) kill_process_group (screen->pid, sig); + if (hold_screen > 1) + hold_screen = 0; + if (screen->pid > 1) + kill_process_group(screen->pid, sig); #endif } - /* * action routines */ /* ARGSUSED */ -void DoSecureKeyboard (Time tp GCC_UNUSED) +void +DoSecureKeyboard(Time tp GCC_UNUSED) { - do_securekbd (vt_shell[mainMenu].w, (XtPointer)0, (XtPointer)0); + do_securekbd(vt_shell[mainMenu].w, (XtPointer) 0, (XtPointer) 0); } -static void do_securekbd ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_securekbd(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; - Time now = CurrentTime; /* XXX - wrong */ + Time now = CurrentTime; /* XXX - wrong */ if (screen->grabbedKbd) { - XUngrabKeyboard (screen->display, now); - ReverseVideo (term); + XUngrabKeyboard(screen->display, now); + ReverseVideo(term); screen->grabbedKbd = FALSE; } else { - if (XGrabKeyboard (screen->display, XtWindow(term), - True, GrabModeAsync, GrabModeAsync, now) + if (XGrabKeyboard(screen->display, XtWindow(term), + True, GrabModeAsync, GrabModeAsync, now) != GrabSuccess) { Bell(XkbBI_MinorError, 100); } else { - ReverseVideo (term); + ReverseVideo(term); screen->grabbedKbd = TRUE; } } update_securekbd(); } - -static void do_allowsends ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_allowsends(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; screen->allowSendEvents = !screen->allowSendEvents; - update_allowsends (); + update_allowsends(); } -static void do_visualbell ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_visualbell(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; @@ -676,10 +714,10 @@ update_visualbell(); } -static void do_poponbell ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_poponbell(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; @@ -688,41 +726,48 @@ } #ifdef ALLOWLOGGING -static void do_logging ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_logging(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; if (screen->logging) { - CloseLog (screen); + CloseLog(screen); } else { - StartLog (screen); + StartLog(screen); } /* update_logging done by CloseLog and StartLog */ } #endif -static void do_print ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_print(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - xtermPrintScreen (TRUE); + xtermPrintScreen(TRUE); } - -static void do_redraw ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_print_redir(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - Redraw (); + setPrinterControlMode(term->screen.printer_controlmode ? 0 : 2); } +static void +do_redraw(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + Redraw(); +} -void show_8bit_control (Bool value) +void +show_8bit_control(Bool value) { if (term->screen.control_eight_bits != value) { term->screen.control_eight_bits = value; @@ -730,47 +775,47 @@ } } -static void do_8bit_control ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) -{ - show_8bit_control(! term->screen.control_eight_bits); +static void +do_8bit_control(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + show_8bit_control(!term->screen.control_eight_bits); } -static void do_backarrow ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_backarrow(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->keyboard.flags ^= MODE_DECBKM; update_decbkm(); } #if OPT_NUM_LOCK -static void do_num_lock ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_num_lock(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - term->misc.real_NumLock = ! term->misc.real_NumLock; + term->misc.real_NumLock = !term->misc.real_NumLock; update_num_lock(); } -static void do_meta_esc ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_meta_esc(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - term->screen.meta_sends_esc = ! term->screen.meta_sends_esc; + term->screen.meta_sends_esc = !term->screen.meta_sends_esc; update_meta_esc(); } #endif -static void do_delete_del ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_delete_del(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { if (xtermDeleteIsDEL()) term->screen.delete_is_del = False; @@ -779,38 +824,38 @@ update_delete_del(); } -static void do_old_fkeys ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_old_fkeys(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { toggle_keyboard_type(keyboardIsLegacy); } #if OPT_HP_FUNC_KEYS -static void do_hp_fkeys ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_hp_fkeys(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { toggle_keyboard_type(keyboardIsHP); } #endif #if OPT_SCO_FUNC_KEYS -static void do_sco_fkeys ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_sco_fkeys(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { toggle_keyboard_type(keyboardIsSCO); } #endif -static void do_sun_fkeys ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_sun_fkeys(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { toggle_keyboard_type(keyboardIsSun); } @@ -819,10 +864,10 @@ /* * This really means "Sun/PC keyboard emulating VT220". */ -static void do_sun_kbd ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_sun_kbd(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { toggle_keyboard_type(keyboardIsVT220); } @@ -833,169 +878,159 @@ * don't get hosed by programs that change their process group */ - /* ARGSUSED */ -static void do_suspend ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_suspend(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { -#if defined(SIGTSTP) && !defined(AMOEBA) - handle_send_signal (gw, SIGTSTP); +#if defined(SIGTSTP) + handle_send_signal(gw, SIGTSTP); #endif } /* ARGSUSED */ -static void do_continue ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_continue(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { -#if defined(SIGCONT) && !defined(AMOEBA) - handle_send_signal (gw, SIGCONT); +#if defined(SIGCONT) + handle_send_signal(gw, SIGCONT); #endif } /* ARGSUSED */ -static void do_interrupt ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_interrupt(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_send_signal (gw, SIGINT); + handle_send_signal(gw, SIGINT); } /* ARGSUSED */ -void do_hangup ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +void +do_hangup(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_send_signal (gw, SIGHUP); + handle_send_signal(gw, SIGHUP); } /* ARGSUSED */ -static void do_terminate ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_terminate(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_send_signal (gw, SIGTERM); + handle_send_signal(gw, SIGTERM); } /* ARGSUSED */ -static void do_kill ( - Widget gw, +static void +do_kill(Widget gw, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - handle_send_signal (gw, SIGKILL); + handle_send_signal(gw, SIGKILL); } -static void do_quit ( - Widget gw GCC_UNUSED, +static void +do_quit(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - Cleanup (0); + Cleanup(0); } - - /* * vt menu callbacks */ -static void do_scrollbar ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_scrollbar(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { ToggleScrollBar(term); } - -static void do_jumpscroll ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_jumpscroll(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; term->flags ^= SMOOTHSCROLL; if (term->flags & SMOOTHSCROLL) { screen->jumpscroll = FALSE; - if (screen->scroll_amt) FlushScroll(screen); + if (screen->scroll_amt) + FlushScroll(screen); } else { screen->jumpscroll = TRUE; } update_jumpscroll(); } - -static void do_reversevideo ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) -{ - ReverseVideo (term); +static void +do_reversevideo(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + ReverseVideo(term); } - -static void do_autowrap ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_autowrap(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->flags ^= WRAPAROUND; update_autowrap(); } - -static void do_reversewrap ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_reversewrap(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->flags ^= REVERSEWRAP; update_reversewrap(); } - -static void do_autolinefeed ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_autolinefeed(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->flags ^= LINEFEED; update_autolinefeed(); } - -static void do_appcursor ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_appcursor(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->keyboard.flags ^= MODE_DECCKM; update_appcursor(); } - -static void do_appkeypad ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_appkeypad(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->keyboard.flags ^= MODE_DECKPAM; update_appkeypad(); } - -static void do_scrollkey ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_scrollkey(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; @@ -1003,35 +1038,32 @@ update_scrollkey(); } - -static void do_scrollttyoutput ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_scrollttyoutput(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; screen->scrollttyoutput = !screen->scrollttyoutput; update_scrollttyoutput(); } - -static void do_allow132 ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_allow132(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; screen->c132 = !screen->c132; update_allow132(); } - -static void do_cursesemul ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_cursesemul(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; @@ -1039,58 +1071,58 @@ update_cursesemul(); } - -static void do_marginbell ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_marginbell(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; - if (!(screen->marginbell = !screen->marginbell)) screen->bellarmed = -1; + if (!(screen->marginbell = !screen->marginbell)) + screen->bellarmed = -1; update_marginbell(); } - #if OPT_TEK4014 -static void handle_tekshow (Widget gw GCC_UNUSED, Bool allowswitch) +static void +handle_tekshow(Widget gw GCC_UNUSED, Bool allowswitch) { register TScreen *screen = &term->screen; - if (!screen->Tshow) { /* not showing, turn on */ - set_tek_visibility (TRUE); - } else if (screen->Vshow || allowswitch) { /* is showing, turn off */ - set_tek_visibility (FALSE); - end_tek_mode (); /* WARNING: this does a longjmp */ + if (!screen->Tshow) { /* not showing, turn on */ + set_tek_visibility(TRUE); + } else if (screen->Vshow || allowswitch) { /* is showing, turn off */ + set_tek_visibility(FALSE); + end_tek_mode(); /* WARNING: this does a longjmp */ } else - Bell(XkbBI_MinorError, 0); + Bell(XkbBI_MinorError, 0); } /* ARGSUSED */ -static void do_tekshow ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekshow(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_tekshow (gw, True); + handle_tekshow(gw, True); } /* ARGSUSED */ -static void do_tekonoff ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekonoff(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_tekshow (gw, False); + handle_tekshow(gw, False); } #endif /* OPT_TEK4014 */ #if OPT_BLINK_CURS /* ARGSUSED */ -static void do_cursorblink ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_cursorblink(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { TScreen *screen = &term->screen; ToggleCursorBlink(screen); @@ -1098,20 +1130,20 @@ #endif /* ARGSUSED */ -static void do_altscreen ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_altscreen(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { TScreen *screen = &term->screen; ToggleAlternate(screen); } /* ARGSUSED */ -static void do_titeInhibit ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_titeInhibit(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { term->misc.titeInhibit = !term->misc.titeInhibit; update_titeInhibit(); @@ -1119,10 +1151,10 @@ #ifndef NO_ACTIVE_ICON /* ARGSUSED */ -static void do_activeicon ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_activeicon(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { TScreen *screen = &term->screen; @@ -1131,76 +1163,72 @@ term->misc.active_icon = !term->misc.active_icon; XtVaSetValues(shell, XtNiconWindow, term->misc.active_icon ? screen->iconVwin.window : None, - NULL); + (XtPointer) 0); update_activeicon(); } } #endif /* NO_ACTIVE_ICON */ -static void do_softreset ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_softreset(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - VTReset (FALSE, FALSE); + VTReset(FALSE, FALSE); } - -static void do_hardreset ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_hardreset(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - VTReset (TRUE, FALSE); + VTReset(TRUE, FALSE); } - -static void do_clearsavedlines ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_clearsavedlines(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - VTReset (TRUE, TRUE); + VTReset(TRUE, TRUE); } - #if OPT_TEK4014 -static void do_tekmode ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekmode(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; - switch_modes (screen->TekEmu); /* switch to tek mode */ + switch_modes(screen->TekEmu); /* switch to tek mode */ } /* ARGSUSED */ -static void do_vthide ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_vthide(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { hide_vt_window(); } #endif /* OPT_TEK4014 */ - /* * vtfont menu */ -static void do_vtfont ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_vtfont(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { char *entryname = (char *) closure; int i; for (i = 0; i < NMENUFONTS; i++) { - if (strcmp (entryname, fontMenuEntries[i].name) == 0) { - SetVTFont (i, True, VT_FONTSET(NULL, NULL, NULL, NULL)); + if (strcmp(entryname, fontMenuEntries[i].name) == 0) { + SetVTFont(i, True, VT_FONTSET(NULL, NULL, NULL, NULL)); return; } } @@ -1208,281 +1236,290 @@ } #if OPT_DEC_CHRSET -static void do_font_doublesize ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_font_doublesize(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { if (term->screen.cache_doublesize != 0) - term->screen.font_doublesize = ! term->screen.font_doublesize; + term->screen.font_doublesize = !term->screen.font_doublesize; update_font_doublesize(); - Redraw (); + Redraw(); } #endif #if OPT_BOX_CHARS -static void do_font_boxchars ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_font_boxchars(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - term->screen.force_box_chars = ! term->screen.force_box_chars; + term->screen.force_box_chars = !term->screen.force_box_chars; update_font_boxchars(); - Redraw (); + Redraw(); } #endif #if OPT_DEC_SOFTFONT -static void do_font_loadable ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_font_loadable(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - term->misc.font_loadable = ! term->misc.font_loadable; + term->misc.font_loadable = !term->misc.font_loadable; update_font_loadable(); } #endif - /* * tek menu */ #if OPT_TEK4014 -static void do_tektextlarge ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tektextlarge(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekSetFontSize (tekMenu_tektextlarge); + TekSetFontSize(tekMenu_tektextlarge); } - -static void do_tektext2 ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tektext2(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekSetFontSize (tekMenu_tektext2); + TekSetFontSize(tekMenu_tektext2); } - -static void do_tektext3 ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tektext3(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekSetFontSize (tekMenu_tektext3); + TekSetFontSize(tekMenu_tektext3); } - -static void do_tektextsmall ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tektextsmall(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekSetFontSize (tekMenu_tektextsmall); + TekSetFontSize(tekMenu_tektextsmall); } - -static void do_tekpage ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekpage(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekSimulatePageButton (False); + TekSimulatePageButton(False); } - -static void do_tekreset ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekreset(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekSimulatePageButton (True); + TekSimulatePageButton(True); } - -static void do_tekcopy ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekcopy(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - TekCopy (); + TekCopy(); } - -static void handle_vtshow (Widget gw GCC_UNUSED, Bool allowswitch) +static void +handle_vtshow(Widget gw GCC_UNUSED, Bool allowswitch) { register TScreen *screen = &term->screen; - if (!screen->Vshow) { /* not showing, turn on */ - set_vt_visibility (TRUE); - } else if (screen->Tshow || allowswitch) { /* is showing, turn off */ - set_vt_visibility (FALSE); - if (!screen->TekEmu && TekRefresh) dorefresh (); - end_vt_mode (); /* WARNING: this does a longjmp... */ + if (!screen->Vshow) { /* not showing, turn on */ + set_vt_visibility(TRUE); + } else if (screen->Tshow || allowswitch) { /* is showing, turn off */ + set_vt_visibility(FALSE); + if (!screen->TekEmu && TekRefresh) + dorefresh(); + end_vt_mode(); /* WARNING: this does a longjmp... */ } else - Bell(XkbBI_MinorError, 0); + Bell(XkbBI_MinorError, 0); } -static void do_vtshow ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_vtshow(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_vtshow (gw, True); + handle_vtshow(gw, True); } -static void do_vtonoff ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_vtonoff(Widget gw, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { - handle_vtshow (gw, False); + handle_vtshow(gw, False); } -static void do_vtmode ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_vtmode(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { register TScreen *screen = &term->screen; - switch_modes (screen->TekEmu); /* switch to vt, or from */ + switch_modes(screen->TekEmu); /* switch to vt, or from */ } - /* ARGSUSED */ -static void do_tekhide ( - Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) +static void +do_tekhide(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) { hide_tek_window(); } #endif /* OPT_TEK4014 */ - - /* * public handler routines */ -static void handle_toggle ( - void (*proc)PROTO_XT_CALLBACK_ARGS, - int var, - String *params, - Cardinal nparams, - Widget w, - XtPointer closure, - XtPointer data) +static void +handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS, + int var, + String * params, + Cardinal nparams, + Widget w, + XtPointer closure, + XtPointer data) { int dir = -2; switch (nparams) { - case 0: + case 0: dir = -1; break; - case 1: - if (XmuCompareISOLatin1 (params[0], "on") == 0) dir = 1; - else if (XmuCompareISOLatin1 (params[0], "off") == 0) dir = 0; - else if (XmuCompareISOLatin1 (params[0], "toggle") == 0) dir = -1; + case 1: + if (XmuCompareISOLatin1(params[0], "on") == 0) + dir = 1; + else if (XmuCompareISOLatin1(params[0], "off") == 0) + dir = 0; + else if (XmuCompareISOLatin1(params[0], "toggle") == 0) + dir = -1; break; } switch (dir) { - case -2: + case -2: Bell(XkbBI_MinorError, 0); break; - case -1: + case -1: (*proc) (w, closure, data); break; - case 0: - if (var) (*proc) (w, closure, data); - else Bell(XkbBI_MinorError, 0); + case 0: + if (var) + (*proc) (w, closure, data); + else + Bell(XkbBI_MinorError, 0); break; - case 1: - if (!var) (*proc) (w, closure, data); - else Bell(XkbBI_MinorError, 0); + case 1: + if (!var) + (*proc) (w, closure, data); + else + Bell(XkbBI_MinorError, 0); break; } return; } + +void +HandleAllowSends(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) +{ + handle_toggle(do_allowsends, (int) term->screen.allowSendEvents, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); +} + +void +HandleSetVisualBell(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) +{ + handle_toggle(do_visualbell, (int) term->screen.visualbell, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); +} -void HandleAllowSends( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) -{ - handle_toggle (do_allowsends, (int) term->screen.allowSendEvents, - params, *param_count, w, (XtPointer)0, (XtPointer)0); -} - -void HandleSetVisualBell( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) -{ - handle_toggle (do_visualbell, (int) term->screen.visualbell, - params, *param_count, w, (XtPointer)0, (XtPointer)0); -} - -void HandleSetPopOnBell( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleSetPopOnBell(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_poponbell, (int) term->screen.poponbell, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_poponbell, (int) term->screen.poponbell, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #ifdef ALLOWLOGGING -void HandleLogging( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleLogging(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_logging, (int) term->screen.logging, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_logging, (int) term->screen.logging, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif /* ARGSUSED */ -void HandlePrint( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandlePrintScreen(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_print(w, (XtPointer)0, (XtPointer)0); + do_print(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleRedraw( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandlePrintControlMode(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) +{ + do_print_redir(w, (XtPointer) 0, (XtPointer) 0); +} + +/* ARGSUSED */ +void +HandleRedraw(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_redraw(w, (XtPointer)0, (XtPointer)0); + do_redraw(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleSendSignal( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleSendSignal(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { + /* *INDENT-OFF* */ static struct sigtab { char *name; int sig; @@ -1503,13 +1540,14 @@ { "kill", SIGKILL }, { NULL, 0 }, }; + /* *INDENT-ON* */ if (*param_count == 1) { struct sigtab *st; for (st = signals; st->name; st++) { - if (XmuCompareISOLatin1 (st->name, params[0]) == 0) { - handle_send_signal (w, st->sig); + if (XmuCompareISOLatin1(st->name, params[0]) == 0) { + handle_send_signal(w, st->sig); return; } } @@ -1520,370 +1558,374 @@ } /* ARGSUSED */ -void HandleQuit( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleQuit(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_quit(w, (XtPointer)0, (XtPointer)0); + do_quit(w, (XtPointer) 0, (XtPointer) 0); } -void Handle8BitControl( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +Handle8BitControl(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_8bit_control, (int) term->screen.control_eight_bits, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_8bit_control, (int) term->screen.control_eight_bits, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleBackarrow( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleBackarrow(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_backarrow, (int) term->keyboard.flags & MODE_DECBKM, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_backarrow, (int) term->keyboard.flags & MODE_DECBKM, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleSunFunctionKeys( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleSunFunctionKeys(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_sun_fkeys, term->keyboard.type == keyboardIsSun, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_sun_fkeys, term->keyboard.type == keyboardIsSun, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #if OPT_NUM_LOCK -void HandleNumLock( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleNumLock(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_num_lock, (int) term->misc.real_NumLock, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_num_lock, (int) term->misc.real_NumLock, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleMetaEsc( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleMetaEsc(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_meta_esc, (int) term->screen.meta_sends_esc, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_meta_esc, (int) term->screen.meta_sends_esc, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif -void HandleDeleteIsDEL( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleDeleteIsDEL(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_delete_del, term->screen.delete_is_del, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_delete_del, term->screen.delete_is_del, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleOldFunctionKeys( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleOldFunctionKeys(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_old_fkeys, term->keyboard.type == keyboardIsLegacy, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_old_fkeys, term->keyboard.type == keyboardIsLegacy, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #if OPT_SUNPC_KBD -void HandleSunKeyboard( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleSunKeyboard(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_sun_kbd, term->keyboard.type == keyboardIsVT220, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_sun_kbd, term->keyboard.type == keyboardIsVT220, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif #if OPT_HP_FUNC_KEYS -void HandleHpFunctionKeys( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleHpFunctionKeys(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_hp_fkeys, term->keyboard.type == keyboardIsHP, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_hp_fkeys, term->keyboard.type == keyboardIsHP, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif #if OPT_SCO_FUNC_KEYS -void HandleScoFunctionKeys( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleScoFunctionKeys(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_sco_fkeys, term->keyboard.type == keyboardIsSCO, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_sco_fkeys, term->keyboard.type == keyboardIsSCO, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif -void HandleScrollbar( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleScrollbar(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_scrollbar, (int) term->screen.fullVwin.sb_info.width, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_scrollbar, (int) term->screen.fullVwin.sb_info.width, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleJumpscroll( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleJumpscroll(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_jumpscroll, (int) term->screen.jumpscroll, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_jumpscroll, (int) term->screen.jumpscroll, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleReverseVideo( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleReverseVideo(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_reversevideo, (int) (term->misc.re_verse0), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_reversevideo, (int) (term->misc.re_verse0), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleAutoWrap( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleAutoWrap(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_autowrap, (int) (term->flags & WRAPAROUND), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_autowrap, (int) (term->flags & WRAPAROUND), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleReverseWrap( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleReverseWrap(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_reversewrap, (int) (term->flags & REVERSEWRAP), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_reversewrap, (int) (term->flags & REVERSEWRAP), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleAutoLineFeed( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleAutoLineFeed(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_autolinefeed, (int) (term->flags & LINEFEED), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_autolinefeed, (int) (term->flags & LINEFEED), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleAppCursor( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleAppCursor(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_appcursor, (int) (term->keyboard.flags & MODE_DECCKM), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_appcursor, (int) (term->keyboard.flags & MODE_DECCKM), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleAppKeypad( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleAppKeypad(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_appkeypad, (int) (term->keyboard.flags & MODE_DECKPAM), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_appkeypad, (int) (term->keyboard.flags & MODE_DECKPAM), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleScrollKey( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleScrollKey(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_scrollkey, (int) term->screen.scrollkey, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_scrollkey, (int) term->screen.scrollkey, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleScrollTtyOutput( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleScrollTtyOutput(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_scrollttyoutput, (int) term->screen.scrollttyoutput, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_scrollttyoutput, (int) term->screen.scrollttyoutput, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleAllow132( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleAllow132(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_allow132, (int) term->screen.c132, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_allow132, (int) term->screen.c132, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleCursesEmul( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleCursesEmul(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_cursesemul, (int) term->screen.curses, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_cursesemul, (int) term->screen.curses, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleMarginBell( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleMarginBell(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_marginbell, (int) term->screen.marginbell, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_marginbell, (int) term->screen.marginbell, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #if OPT_BLINK_CURS -void HandleCursorBlink( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleCursorBlink(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { /* eventually want to see if sensitive or not */ - handle_toggle (do_cursorblink, (int) term->screen.cursor_blink, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_cursorblink, (int) term->screen.cursor_blink, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif -void HandleAltScreen( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleAltScreen(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { /* eventually want to see if sensitive or not */ - handle_toggle (do_altscreen, (int) term->screen.alternate, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_altscreen, (int) term->screen.alternate, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } -void HandleTiteInhibit( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleTiteInhibit(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { /* eventually want to see if sensitive or not */ - handle_toggle (do_titeInhibit, ! ((int) term->misc.titeInhibit), - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_titeInhibit, !((int) term->misc.titeInhibit), + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleSoftReset( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleSoftReset(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_softreset(w, (XtPointer)0, (XtPointer)0); + do_softreset(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleHardReset( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleHardReset(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_hardreset(w, (XtPointer)0, (XtPointer)0); + do_hardreset(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleClearSavedLines( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleClearSavedLines(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_clearsavedlines(w, (XtPointer)0, (XtPointer)0); + do_clearsavedlines(w, (XtPointer) 0, (XtPointer) 0); } #if OPT_DEC_CHRSET -void HandleFontDoublesize( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleFontDoublesize(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_font_doublesize, (int) term->screen.font_doublesize, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_font_doublesize, (int) term->screen.font_doublesize, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif #if OPT_BOX_CHARS -void HandleFontBoxChars( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleFontBoxChars(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_font_boxchars, (int) term->screen.force_box_chars, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_font_boxchars, (int) term->screen.force_box_chars, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif #if OPT_DEC_SOFTFONT -void HandleFontLoading( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleFontLoading(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - handle_toggle (do_font_loadable, (int) term->misc.font_loadable, - params, *param_count, w, (XtPointer)0, (XtPointer)0); + handle_toggle(do_font_loadable, (int) term->misc.font_loadable, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); } #endif #if OPT_TEK4014 -void HandleSetTerminalType( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleSetTerminalType(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { if (*param_count == 1) { switch (params[0][0]) { - case 'v': case 'V': - if (term->screen.TekEmu) do_vtmode (w, (XtPointer)0, (XtPointer)0); + case 'v': + case 'V': + if (term->screen.TekEmu) + do_vtmode(w, (XtPointer) 0, (XtPointer) 0); break; - case 't': case 'T': - if (!term->screen.TekEmu) do_tekmode (w, (XtPointer)0, (XtPointer)0); + case 't': + case 'T': + if (!term->screen.TekEmu) + do_tekmode(w, (XtPointer) 0, (XtPointer) 0); break; - default: + default: Bell(XkbBI_MinorError, 0); } } else { @@ -1891,23 +1933,27 @@ } } -void HandleVisibility( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleVisibility(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { if (*param_count == 2) { switch (params[0][0]) { - case 'v': case 'V': - handle_toggle (do_vtonoff, (int) term->screen.Vshow, - params+1, (*param_count) - 1, w, (XtPointer)0, (XtPointer)0); + case 'v': + case 'V': + handle_toggle(do_vtonoff, (int) term->screen.Vshow, + params + 1, (*param_count) - 1, + w, (XtPointer) 0, (XtPointer) 0); break; - case 't': case 'T': - handle_toggle (do_tekonoff, (int) term->screen.Tshow, - params+1, (*param_count) - 1, w, (XtPointer)0, (XtPointer)0); + case 't': + case 'T': + handle_toggle(do_tekonoff, (int) term->screen.Tshow, + params + 1, (*param_count) - 1, + w, (XtPointer) 0, (XtPointer) 0); break; - default: + default: Bell(XkbBI_MinorError, 0); } } else { @@ -1916,84 +1962,98 @@ } /* ARGSUSED */ -void HandleSetTekText( - Widget w, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleSetTekText(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { - void (*proc)PROTO_XT_CALLBACK_ARGS = 0; + void (*proc) PROTO_XT_CALLBACK_ARGS = 0; switch (*param_count) { - case 0: + case 0: proc = do_tektextlarge; break; - case 1: + case 1: switch (params[0][0]) { - case 'l': case 'L': proc = do_tektextlarge; break; - case '2': proc = do_tektext2; break; - case '3': proc = do_tektext3; break; - case 's': case 'S': proc = do_tektextsmall; break; + case 'l': + case 'L': + proc = do_tektextlarge; + break; + case '2': + proc = do_tektext2; + break; + case '3': + proc = do_tektext3; + break; + case 's': + case 'S': + proc = do_tektextsmall; + break; } break; } - if (proc) (*proc) (w, (XtPointer)0, (XtPointer)0); - else Bell(XkbBI_MinorError, 0); + if (proc) + (*proc) (w, (XtPointer) 0, (XtPointer) 0); + else + Bell(XkbBI_MinorError, 0); } /* ARGSUSED */ -void HandleTekPage( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleTekPage(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_tekpage(w, (XtPointer)0, (XtPointer)0); + do_tekpage(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleTekReset( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleTekReset(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_tekreset(w, (XtPointer)0, (XtPointer)0); + do_tekreset(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ -void HandleTekCopy( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) +void +HandleTekCopy(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * param_count GCC_UNUSED) { - do_tekcopy(w, (XtPointer)0, (XtPointer)0); + do_tekcopy(w, (XtPointer) 0, (XtPointer) 0); } #endif /* OPT_TEK4014 */ void UpdateMenuItem(Widget mi, XtArgVal val) { - static Arg menuArgs = { XtNleftBitmap, (XtArgVal) 0 }; + static Arg menuArgs = + {XtNleftBitmap, (XtArgVal) 0}; - if (mi) { - menuArgs.value = (XtArgVal) ((val) - ? term->screen.menu_item_bitmap - : None); - XtSetValues (mi, &menuArgs, (Cardinal) 1); - } + if (mi) { + menuArgs.value = (XtArgVal) ((val) + ? term->screen.menu_item_bitmap + : None); + XtSetValues(mi, &menuArgs, (Cardinal) 1); + } } void SetItemSensitivity(Widget mi, XtArgVal val) { - static Arg menuArgs = { XtNsensitive, (XtArgVal) 0 }; + static Arg menuArgs = + {XtNsensitive, (XtArgVal) 0}; - if (mi) { - menuArgs.value = (XtArgVal) (val); - XtSetValues (mi, &menuArgs, (Cardinal) 1); - } + if (mi) { + menuArgs.value = (XtArgVal) (val); + XtSetValues(mi, &menuArgs, (Cardinal) 1); + } } #if OPT_TOOLBAR @@ -2003,113 +2063,114 @@ * though on the first popup there will be a little geometry layout jitter, * since the menu is already managed when this callback is invoked. */ -static void InitPopup ( - Widget gw, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) -{ - String params[2]; - Cardinal count = 1; - - params[0] = closure; - params[1] = 0; - TRACE(("InitPopup(%s)\n", params[0])); - - domenu(gw, (XEvent *)0, params, &count); - - XtRemoveCallback(gw, XtNpopupCallback, InitPopup, closure); -} - -static void SetupShell(Widget *menus, MenuList *shell, Widget *menu_tops, int n, int m) -{ - char temp[80]; - char *external_name = 0; - - shell[n].w = XtVaCreatePopupShell (menu_names[n].internal_name, - simpleMenuWidgetClass, - *menus, - XtNgeometry, NULL, - NULL); - - XtAddCallback(shell[n].w, XtNpopupCallback, InitPopup, menu_names[n].internal_name); - XtVaGetValues(shell[n].w, - XtNlabel, &external_name, - NULL); - - TRACE(("...SetupShell(%s) -> %s -> %#lx\n", - menu_names[n].internal_name, - external_name, - (long)shell[n].w)); - - sprintf(temp, "%sButton", menu_names[n].internal_name); - menu_tops[n] = XtVaCreateManagedWidget (temp, - menuButtonWidgetClass, - *menus, - XtNfromHoriz, (m >= 0) ? menu_tops[m] : 0, - XtNmenuName, menu_names[n].internal_name, - XtNlabel, external_name, - NULL); +static void +InitPopup(Widget gw, + XtPointer closure, + XtPointer data GCC_UNUSED) +{ + String params[2]; + Cardinal count = 1; + + params[0] = closure; + params[1] = 0; + TRACE(("InitPopup(%s)\n", params[0])); + + domenu(gw, (XEvent *) 0, params, &count); + + XtRemoveCallback(gw, XtNpopupCallback, InitPopup, closure); +} + +static void +SetupShell(Widget * menus, MenuList * shell, Widget * menu_tops, int n, int m) +{ + char temp[80]; + char *external_name = 0; + + shell[n].w = XtVaCreatePopupShell(menu_names[n].internal_name, + simpleMenuWidgetClass, + *menus, + XtNgeometry, NULL, + (XtPointer) 0); + + XtAddCallback(shell[n].w, XtNpopupCallback, InitPopup, menu_names[n].internal_name); + XtVaGetValues(shell[n].w, + XtNlabel, &external_name, + (XtPointer) 0); + + TRACE(("...SetupShell(%s) -> %s -> %#lx\n", + menu_names[n].internal_name, + external_name, + (long) shell[n].w)); + + sprintf(temp, "%sButton", menu_names[n].internal_name); + menu_tops[n] = XtVaCreateManagedWidget(temp, + menuButtonWidgetClass, + *menus, + XtNfromHoriz, ((m >= 0) + ? menu_tops[m] + : 0), + XtNmenuName, menu_names[n].internal_name, + XtNlabel, external_name, + (XtPointer) 0); } #endif void -SetupMenus(Widget shell, Widget *forms, Widget *menus) +SetupMenus(Widget shell, Widget * forms, Widget * menus) { #if OPT_TOOLBAR - int n; - Widget menu_tops[NUM_POPUP_MENUS]; + int n; + Widget menu_tops[NUM_POPUP_MENUS]; #endif - TRACE(("SetupMenus(%s)\n", shell == toplevel ? "vt100" : "tek4014")); + TRACE(("SetupMenus(%s)\n", shell == toplevel ? "vt100" : "tek4014")); - if (shell == toplevel) { - XawSimpleMenuAddGlobalActions (app_con); - XtRegisterGrabAction (HandlePopupMenu, True, - (ButtonPressMask|ButtonReleaseMask), - GrabModeAsync, GrabModeAsync); - } + if (shell == toplevel) { + XawSimpleMenuAddGlobalActions(app_con); + XtRegisterGrabAction(HandlePopupMenu, True, + (ButtonPressMask | ButtonReleaseMask), + GrabModeAsync, GrabModeAsync); + } #if OPT_TOOLBAR - *forms = XtVaCreateManagedWidget( - "form", - formWidgetClass, shell, - NULL); - xtermAddInput(*forms); - - /* - * Set a nominal value for the preferred pane size, which lets the - * buttons determine the actual height of the menu bar. We don't show - * the grip, because it's too easy to make the toolbar look bad that - * way. - */ - *menus = XtVaCreateManagedWidget( - "menubar", - boxWidgetClass, *forms, - XtNorientation, XtorientHorizontal, - XtNtop, XawChainTop, - XtNbottom, XawChainTop, - XtNleft, XawChainLeft, - XtNright, XawChainLeft, - NULL); - - if (shell == toplevel) { /* vt100 */ - for (n = mainMenu; n <= fontMenu; n++) { - SetupShell(menus, vt_shell, menu_tops, n, n-1); - } + *forms = XtVaCreateManagedWidget("form", + formWidgetClass, shell, + (XtPointer) 0); + xtermAddInput(*forms); + + /* + * Set a nominal value for the preferred pane size, which lets the + * buttons determine the actual height of the menu bar. We don't show + * the grip, because it's too easy to make the toolbar look bad that + * way. + */ + *menus = XtVaCreateManagedWidget("menubar", + boxWidgetClass, *forms, + XtNorientation, XtorientHorizontal, + XtNtop, XawChainTop, + XtNbottom, XawChainTop, + XtNleft, XawChainLeft, + XtNright, XawChainLeft, + (XtPointer) 0); + + if (shell == toplevel) { /* vt100 */ + for (n = mainMenu; n <= fontMenu; n++) { + SetupShell(menus, vt_shell, menu_tops, n, n - 1); } + } #if OPT_TEK4014 - else { /* tek4014 */ - SetupShell(menus, tek_shell, menu_tops, mainMenu, -1); - SetupShell(menus, tek_shell, menu_tops, tekMenu, mainMenu); - } + else { /* tek4014 */ + SetupShell(menus, tek_shell, menu_tops, mainMenu, -1); + SetupShell(menus, tek_shell, menu_tops, tekMenu, mainMenu); + } #endif #else - *forms = shell; - *menus = shell; + *forms = shell; + *menus = shell; #endif - TRACE(("...shell=%#lx\n", (long) shell)); - TRACE(("...forms=%#lx\n", (long) *forms)); - TRACE(("...menus=%#lx\n", (long) *menus)); + TRACE(("...shell=%#lx\n", (long) shell)); + TRACE(("...forms=%#lx\n", (long) *forms)); + TRACE(("...menus=%#lx\n", (long) *menus)); } Index: xc/programs/xterm/menu.h diff -u xc/programs/xterm/menu.h:3.28 xc/programs/xterm/menu.h:3.29 --- xc/programs/xterm/menu.h:3.28 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/menu.h Sun Aug 11 20:36:33 2002 @@ -1,7 +1,7 @@ /* $Xorg: menu.h,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /* -Copyright 1999, 2000, 2001 by Thomas E. Dickey +Copyright 1999-2001, 2002 by Thomas E. Dickey All Rights Reserved @@ -48,7 +48,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xterm/menu.h,v 3.28 2002/01/05 22:05:03 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/menu.h,v 3.29 2002/08/12 00:36:33 dickey Exp $ */ #ifndef included_menu_h #define included_menu_h @@ -98,7 +98,8 @@ extern void HandleNumLock PROTO_XT_ACTIONS_ARGS; extern void HandleOldFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandlePopupMenu PROTO_XT_ACTIONS_ARGS; -extern void HandlePrint PROTO_XT_ACTIONS_ARGS; +extern void HandlePrintControlMode PROTO_XT_ACTIONS_ARGS; +extern void HandlePrintScreen PROTO_XT_ACTIONS_ARGS; extern void HandleQuit PROTO_XT_ACTIONS_ARGS; extern void HandleRedraw PROTO_XT_ACTIONS_ARGS; extern void HandleReverseVideo PROTO_XT_ACTIONS_ARGS; @@ -135,12 +136,14 @@ typedef enum { mainMenu_securekbd, mainMenu_allowsends, + mainMenu_redraw, + mainMenu_line1, #ifdef ALLOWLOGGING mainMenu_logging, #endif mainMenu_print, - mainMenu_redraw, - mainMenu_line1, + mainMenu_print_redir, + mainMenu_line2, mainMenu_8bit_ctrl, mainMenu_backarrow, #if OPT_NUM_LOCK @@ -159,14 +162,14 @@ #if OPT_SUNPC_KBD mainMenu_sun_kbd, #endif - mainMenu_line2, + mainMenu_line3, mainMenu_suspend, mainMenu_continue, mainMenu_interrupt, mainMenu_hangup, mainMenu_terminate, mainMenu_kill, - mainMenu_line3, + mainMenu_line4, mainMenu_quit, mainMenu_LAST } mainMenuIndices; @@ -299,6 +302,11 @@ #else #define update_logging() /*nothing*/ #endif + +#define update_print_redir() \ + update_menu_item (term->screen.mainMenu, \ + mainMenuEntries[mainMenu_print_redir].widget, \ + term->screen.printer_controlmode) #define update_8bit_control() \ update_menu_item (term->screen.mainMenu, \ Index: xc/programs/xterm/minstall.sh diff -u xc/programs/xterm/minstall.sh:1.2 xc/programs/xterm/minstall.sh:1.4 --- xc/programs/xterm/minstall.sh:1.2 Sun Nov 4 21:07:16 2001 +++ xc/programs/xterm/minstall.sh Fri Dec 27 16:05:22 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/minstall.sh,v 1.2 2001/11/05 02:07:16 dickey Exp $ +# $XFree86: xc/programs/xterm/minstall.sh,v 1.4 2002/12/27 21:05:22 dickey Exp $ # # Install manpages, substituting a reasonable section value since XFree86 4.x # doesn't use constants... @@ -14,12 +14,13 @@ OLD_FILE="$2" END_FILE="$3" -suffix=`echo "$END_FILE" | sed -e 's/^[^.]*.//'` +suffix=`echo "$END_FILE" | sed -e 's%^[^.]*.%%'` NEW_FILE=temp$$ -sed -e 's/__vendorversion__/"X Window System"/' \ - -e s@__apploaddir__@/usr/lib/X11/app-defaults@ \ - -e s/__miscmansuffix__/$suffix/ \ +sed -e 's%__vendorversion__%"X Window System"%' \ + -e s%__apploaddir__%/usr/lib/X11/app-defaults% \ + -e s%__mansuffix__%$suffix%g \ + -e s%__miscmansuffix__%$suffix%g \ $OLD_FILE >$NEW_FILE echo "$MINSTALL $OLD_FILE $END_FILE" Index: xc/programs/xterm/misc.c diff -u xc/programs/xterm/misc.c:3.66 xc/programs/xterm/misc.c:3.75 --- xc/programs/xterm/misc.c:3.66 Tue Oct 23 21:21:24 2001 +++ xc/programs/xterm/misc.c Thu Feb 6 18:09:43 2003 @@ -2,11 +2,11 @@ * $Xorg: misc.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/misc.c,v 3.66 2001/10/24 01:21:24 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/misc.c,v 3.75 2003/02/06 23:09:43 dickey Exp $ */ /* * - * Copyright 1999,2000,2001 by Thomas E. Dickey + * Copyright 1999-2002,2003 by Thomas E. Dickey * * All Rights Reserved * @@ -69,7 +69,6 @@ #include <X11/Xatom.h> #include <X11/cursorfont.h> -#include <X11/Shell.h> #include <X11/Xmu/Error.h> #include <X11/Xmu/SysUtil.h> #include <X11/Xmu/WinUtil.h> @@ -91,12 +90,7 @@ #endif #endif -#ifdef AMOEBA -#include <amoeba.h> -#include <module/proc.h> -#endif - -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define environ gblenvp /* circumvent a bug */ #endif @@ -121,23 +115,25 @@ (event.xcrossing.window == XtWindow(XtParent(term)))) #endif -static Boolean ChangeColorsRequest (XtermWidget pTerm, int start, char *names, int final); -static void DoSpecialEnterNotify (XEnterWindowEvent *ev); -static void DoSpecialLeaveNotify (XEnterWindowEvent *ev); -static void selectwindow (TScreen *screen, int flag); -static void unselectwindow (TScreen *screen, int flag); +static Boolean ChangeColorsRequest(XtermWidget pTerm, int start, char + *names, int final); +static void DoSpecialEnterNotify(XEnterWindowEvent * ev); +static void DoSpecialLeaveNotify(XEnterWindowEvent * ev); +static void selectwindow(TScreen * screen, int flag); +static void unselectwindow(TScreen * screen, int flag); +static void Sleep(int msec); void do_xevents(void) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - if (XtAppPending(app_con) + if (XtAppPending(app_con) || #if defined(VMS) || defined(__VMS) screen->display->qlen > 0 #else - GetBytesAvailable (ConnectionNumber(screen->display)) > 0 + GetBytesAvailable(ConnectionNumber(screen->display)) > 0 #endif ) xevents(); @@ -146,114 +142,124 @@ void xevents(void) { - XEvent event; - XtInputMask input_mask; - register TScreen *screen = &term->screen; + XEvent event; + XtInputMask input_mask; + register TScreen *screen = &term->screen; - if(screen->scroll_amt) - FlushScroll(screen); + if (screen->scroll_amt) + FlushScroll(screen); + /* + * process timeouts, relying on the fact that XtAppProcessEvent + * will process the timeout and return without blockng on the + * XEvent queue. Other sources i.e. the pty are handled elsewhere + * with select(). + */ + while ((input_mask = XtAppPending(app_con)) & XtIMTimer) + XtAppProcessEvent(app_con, XtIMTimer); + /* + * If there's no XEvents, don't wait around... + */ + if ((input_mask & XtIMXEvent) != XtIMXEvent) + return; + do { /* - * process timeouts, relying on the fact that XtAppProcessEvent - * will process the timeout and return without blockng on the - * XEvent queue. Other sources i.e. the pty are handled elsewhere - * with select(). + * This check makes xterm hang when in mouse hilite tracking mode. + * We simply ignore all events except for those not passed down to + * this function, e.g., those handled in in_put(). */ - while ((input_mask = XtAppPending(app_con)) & XtIMTimer) - XtAppProcessEvent(app_con, XtIMTimer); + if (waitingForTrackInfo) { + Sleep(10); + return; + } + XtAppNextEvent(app_con, &event); /* - * If there's no XEvents, don't wait around... + * Hack to get around problems with the toolkit throwing away + * eventing during the exclusive grab of the menu popup. By + * looking at the event ourselves we make sure that we can + * do the right thing. */ - if ((input_mask & XtIMXEvent) != XtIMXEvent) - return; - do { - if (waitingForTrackInfo) - return; - XtAppNextEvent (app_con, &event); - /* - * Hack to get around problems with the toolkit throwing away - * eventing during the exclusive grab of the menu popup. By - * looking at the event ourselves we make sure that we can - * do the right thing. - */ - if(OUR_EVENT(event, EnterNotify)) - DoSpecialEnterNotify (&event.xcrossing); - else - if(OUR_EVENT(event, LeaveNotify)) - DoSpecialLeaveNotify (&event.xcrossing); - else if ((screen->send_mouse_pos == ANY_EVENT_MOUSE + if (OUR_EVENT(event, EnterNotify)) + DoSpecialEnterNotify(&event.xcrossing); + else if (OUR_EVENT(event, LeaveNotify)) + DoSpecialLeaveNotify(&event.xcrossing); + else if ((screen->send_mouse_pos == ANY_EVENT_MOUSE #if OPT_DEC_LOCATOR - || screen->send_mouse_pos == DEC_LOCATOR -#endif /* OPT_DEC_LOCATOR */ - ) + || screen->send_mouse_pos == DEC_LOCATOR +#endif /* OPT_DEC_LOCATOR */ + ) && event.xany.type == MotionNotify && event.xcrossing.window == XtWindow(term)) { - SendMousePosition((Widget)term, &event); - continue; - } - - if (!event.xany.send_event || - screen->allowSendEvents || - ((event.xany.type != KeyPress) && - (event.xany.type != KeyRelease) && - (event.xany.type != ButtonPress) && - (event.xany.type != ButtonRelease))) - XtDispatchEvent(&event); - } while ((input_mask = XtAppPending(app_con)) & XtIMXEvent); -} - - -Cursor make_colored_cursor ( - unsigned cursorindex, /* index into font */ - unsigned long fg, /* pixel value */ - unsigned long bg) /* pixel value */ -{ - register TScreen *screen = &term->screen; - Cursor c; - register Display *dpy = screen->display; + SendMousePosition((Widget) term, &event); + continue; + } - c = XCreateFontCursor (dpy, cursorindex); - if (c == (Cursor) 0) return (c); + if (!event.xany.send_event || + screen->allowSendEvents || + ((event.xany.type != KeyPress) && + (event.xany.type != KeyRelease) && + (event.xany.type != ButtonPress) && + (event.xany.type != ButtonRelease))) + XtDispatchEvent(&event); + } while ((input_mask = XtAppPending(app_con)) & XtIMXEvent); +} + +Cursor +make_colored_cursor( + unsigned cursorindex, /* index into font */ + unsigned long fg, /* pixel value */ + unsigned long bg) /* pixel value */ +{ + register TScreen *screen = &term->screen; + Cursor c; + register Display *dpy = screen->display; - recolor_cursor (c, fg, bg); + c = XCreateFontCursor(dpy, cursorindex); + if (c == (Cursor) 0) return (c); + + recolor_cursor(c, fg, bg); + return (c); } /* ARGSUSED */ -void HandleKeyPressed( - Widget w GCC_UNUSED, - XEvent *event, - String *params GCC_UNUSED, - Cardinal *nparams GCC_UNUSED) +void +HandleKeyPressed( + Widget w GCC_UNUSED, + XEvent * event, + String * params GCC_UNUSED, + Cardinal * nparams GCC_UNUSED) { register TScreen *screen = &term->screen; #ifdef ACTIVEWINDOWINPUTONLY if (w == CURRENT_EMU(screen)) #endif - Input (&term->keyboard, screen, &event->xkey, False); + Input(&term->keyboard, screen, &event->xkey, False); } /* ARGSUSED */ -void HandleEightBitKeyPressed( - Widget w GCC_UNUSED, - XEvent *event, - String *params GCC_UNUSED, - Cardinal *nparams GCC_UNUSED) +void +HandleEightBitKeyPressed( + Widget w GCC_UNUSED, + XEvent * event, + String * params GCC_UNUSED, + Cardinal * nparams GCC_UNUSED) { register TScreen *screen = &term->screen; #ifdef ACTIVEWINDOWINPUTONLY if (w == CURRENT_EMU(screen)) #endif - Input (&term->keyboard, screen, &event->xkey, True); + Input(&term->keyboard, screen, &event->xkey, True); } /* ARGSUSED */ -void HandleStringEvent( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *nparams) +void +HandleStringEvent( + Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * nparams) { register TScreen *screen = &term->screen; @@ -262,26 +268,28 @@ return; #endif - if (*nparams != 1) return; + if (*nparams != 1) + return; if ((*params)[0] == '0' && (*params)[1] == 'x' && (*params)[2] != '\0') { Char c, *p; Char hexval[2]; hexval[0] = hexval[1] = 0; - for (p = (Char *)(*params+2); (c = *p); p++) { + for (p = (Char *) (*params + 2); (c = *p); p++) { hexval[0] *= 16; - if (isupper(c)) c = tolower(c); + if (isupper(c)) + c = tolower(c); if (c >= '0' && c <= '9') hexval[0] += c - '0'; else if (c >= 'a' && c <= 'f') hexval[0] += c - 'a' + 10; - else break; + else + break; } if (c == '\0') - StringInput (screen, hexval, 1); - } - else { - StringInput (screen, (Char *)*params, strlen(*params)); + StringInput(screen, hexval, 1); + } else { + StringInput(screen, (Char *) * params, strlen(*params)); } } @@ -298,11 +306,12 @@ * without a specialized converter. (Don't try to use \000, though). */ /* ARGSUSED */ -void HandleInterpret( - Widget w GCC_UNUSED, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *param_count) +void +HandleInterpret( + Widget w GCC_UNUSED, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) { if (*param_count == 1) { char *value = params[0]; @@ -316,7 +325,7 @@ FlushLog(&term->screen); if (have != 0 - && used < have) { + && used < have) { memmove(VTbuffer.ptr + (need - used), VTbuffer.ptr, VTbuffer.cnt * sizeof(*VTbuffer.ptr)); @@ -333,133 +342,137 @@ } } -static void DoSpecialEnterNotify (register XEnterWindowEvent *ev) +static void +DoSpecialEnterNotify(register XEnterWindowEvent * ev) { register TScreen *screen = &term->screen; #ifdef ACTIVEWINDOWINPUTONLY if (ev->window == XtWindow(XtParent(CURRENT_EMU(screen)))) #endif - if (((ev->detail) != NotifyInferior) && - ev->focus && - !(screen->select & FOCUS)) - selectwindow(screen, INWINDOW); + if (((ev->detail) != NotifyInferior) && + ev->focus && + !(screen->select & FOCUS)) + selectwindow(screen, INWINDOW); } /*ARGSUSED*/ -void HandleEnterWindow( - Widget w GCC_UNUSED, - XtPointer eventdata GCC_UNUSED, - XEvent *event GCC_UNUSED, - Boolean *cont GCC_UNUSED) +void +HandleEnterWindow( + Widget w GCC_UNUSED, + XtPointer eventdata GCC_UNUSED, + XEvent * event GCC_UNUSED, + Boolean * cont GCC_UNUSED) { /* NOP since we handled it above */ } - -static void DoSpecialLeaveNotify (register XEnterWindowEvent *ev) +static void +DoSpecialLeaveNotify(register XEnterWindowEvent * ev) { register TScreen *screen = &term->screen; #ifdef ACTIVEWINDOWINPUTONLY if (ev->window == XtWindow(XtParent(CURRENT_EMU(screen)))) #endif - if (((ev->detail) != NotifyInferior) && - ev->focus && - !(screen->select & FOCUS)) - unselectwindow(screen, INWINDOW); + if (((ev->detail) != NotifyInferior) && + ev->focus && + !(screen->select & FOCUS)) + unselectwindow(screen, INWINDOW); } - /*ARGSUSED*/ -void HandleLeaveWindow( - Widget w GCC_UNUSED, - XtPointer eventdata GCC_UNUSED, - XEvent *event GCC_UNUSED, - Boolean *cont GCC_UNUSED) +void +HandleLeaveWindow( + Widget w GCC_UNUSED, + XtPointer eventdata GCC_UNUSED, + XEvent * event GCC_UNUSED, + Boolean * cont GCC_UNUSED) { /* NOP since we handled it above */ } - /*ARGSUSED*/ -void HandleFocusChange( - Widget w GCC_UNUSED, - XtPointer eventdata GCC_UNUSED, - XEvent *ev, - Boolean *cont GCC_UNUSED) -{ - register XFocusChangeEvent *event = (XFocusChangeEvent *)ev; - register TScreen *screen = &term->screen; - - if(event->type == FocusIn) - selectwindow(screen, - (event->detail == NotifyPointer) ? INWINDOW : - FOCUS); - else { - unselectwindow(screen, - (event->detail == NotifyPointer) ? INWINDOW : - FOCUS); - if (screen->grabbedKbd && (event->mode == NotifyUngrab)) { - Bell(XkbBI_Info, 100); - ReverseVideo(term); - screen->grabbedKbd = FALSE; - update_securekbd(); - } +void +HandleFocusChange( + Widget w GCC_UNUSED, + XtPointer eventdata GCC_UNUSED, + XEvent * ev, + Boolean * cont GCC_UNUSED) +{ + register XFocusChangeEvent *event = (XFocusChangeEvent *) ev; + register TScreen *screen = &term->screen; + + if (event->type == FocusIn) + selectwindow(screen, + (event->detail == NotifyPointer) ? INWINDOW : + FOCUS); + else { + unselectwindow(screen, + (event->detail == NotifyPointer) ? INWINDOW : + FOCUS); + if (screen->grabbedKbd && (event->mode == NotifyUngrab)) { + Bell(XkbBI_Info, 100); + ReverseVideo(term); + screen->grabbedKbd = FALSE; + update_securekbd(); } + } } - static void -selectwindow(register TScreen *screen, register int flag) +selectwindow(register TScreen * screen, register int flag) { #if OPT_TEK4014 - if(screen->TekEmu) { - if(!Ttoggled) - TCursorToggle(TOGGLE); - screen->select |= flag; - if(!Ttoggled) - TCursorToggle(TOGGLE); - return; - } else + if (screen->TekEmu) { + if (!Ttoggled) + TCursorToggle(TOGGLE); + screen->select |= flag; + if (!Ttoggled) + TCursorToggle(TOGGLE); + return; + } else #endif - { - if (screen->xic) - XSetICFocus(screen->xic); - - if(screen->cursor_state && - (screen->cursor_col != screen->cur_col || - screen->cursor_row != screen->cur_row)) - HideCursor(); - screen->select |= flag; - if(screen->cursor_state) - ShowCursor(); - return; - } + { + if (screen->xic) + XSetICFocus(screen->xic); + + if (screen->cursor_state && + (screen->cursor_col != screen->cur_col || + screen->cursor_row != screen->cur_row)) + HideCursor(); + screen->select |= flag; + if (screen->cursor_state) + ShowCursor(); + return; + } } static void -unselectwindow(register TScreen *screen, register int flag) +unselectwindow(register TScreen * screen, register int flag) { - if (screen->always_highlight) return; + if (screen->always_highlight) + return; #if OPT_TEK4014 - if(screen->TekEmu) { - if(!Ttoggled) TCursorToggle(TOGGLE); + if (screen->TekEmu) { + if (!Ttoggled) + TCursorToggle(TOGGLE); screen->select &= ~flag; - if(!Ttoggled) TCursorToggle(TOGGLE); + if (!Ttoggled) + TCursorToggle(TOGGLE); } else #endif { if (screen->xic) XUnsetICFocus(screen->xic); screen->select &= ~flag; - if(screen->cursor_state && - (screen->cursor_col != screen->cur_col || - screen->cursor_row != screen->cur_row)) - HideCursor(); - if(screen->cursor_state) - ShowCursor(); + if (screen->cursor_state && + (screen->cursor_col != screen->cur_col || + screen->cursor_row != screen->cur_row)) + HideCursor(); + if (screen->cursor_state) + ShowCursor(); } } @@ -476,17 +489,17 @@ /* has enough time gone by that we are allowed to ring the bell again? */ - if(screen->bellSuppressTime) { - if(screen->bellInProgress) { + if (screen->bellSuppressTime) { + if (screen->bellInProgress) { do_xevents(); - if(screen->bellInProgress) { /* even after new events? */ + if (screen->bellInProgress) { /* even after new events? */ return; } } X_GETTIMEOFDAY(&curtime); - now_msecs = 1000*curtime.tv_sec + curtime.tv_usec/1000; - if(lastBellTime != 0 && now_msecs - lastBellTime >= 0 && - now_msecs - lastBellTime < screen->bellSuppressTime) { + now_msecs = 1000 * curtime.tv_sec + curtime.tv_usec / 1000; + if (lastBellTime != 0 && now_msecs - lastBellTime >= 0 && + now_msecs - lastBellTime < screen->bellSuppressTime) { return; } lastBellTime = now_msecs; @@ -496,7 +509,7 @@ VisualBell(); else #ifdef XKB - XkbStdBell(screen->display,TWindow(screen),percent,which); + XkbStdBell(screen->display, TWindow(screen), percent, which); #else XBell(screen->display, percent); #endif @@ -504,7 +517,7 @@ if (screen->poponbell) XRaiseWindow(screen->display, VShellWindow); - if(screen->bellSuppressTime) { + if (screen->bellSuppressTime) { /* now we change a property and wait for the notify event to come back. If the server is suspending operations while the bell is being emitted (problematic for audio bell), this lets us @@ -526,51 +539,52 @@ gcval.function = GXxor; gcval.foreground = xorPixel; - visualGC = XtGetGC((Widget)term, GCFunction+GCForeground, &gcval); + visualGC = XtGetGC((Widget) term, GCFunction + GCForeground, &gcval); #if OPT_TEK4014 - if(screen->TekEmu) { + if (screen->TekEmu) { XFillRectangle( - screen->display, - TWindow(screen), - visualGC, - 0, 0, - (unsigned) TFullWidth(screen), - (unsigned) TFullHeight(screen)); + screen->display, + TWindow(screen), + visualGC, + 0, 0, + (unsigned) TFullWidth(screen), + (unsigned) TFullHeight(screen)); XFlush(screen->display); XFillRectangle( - screen->display, - TWindow(screen), - visualGC, - 0, 0, - (unsigned) TFullWidth(screen), - (unsigned) TFullHeight(screen)); + screen->display, + TWindow(screen), + visualGC, + 0, 0, + (unsigned) TFullWidth(screen), + (unsigned) TFullHeight(screen)); } else #endif { XFillRectangle( - screen->display, - VWindow(screen), - visualGC, - 0, 0, - (unsigned) FullWidth(screen), - (unsigned) FullHeight(screen)); + screen->display, + VWindow(screen), + visualGC, + 0, 0, + (unsigned) FullWidth(screen), + (unsigned) FullHeight(screen)); XFlush(screen->display); XFillRectangle( - screen->display, - VWindow(screen), - visualGC, - 0, 0, - (unsigned) FullWidth(screen), - (unsigned) FullHeight(screen)); + screen->display, + VWindow(screen), + visualGC, + 0, 0, + (unsigned) FullWidth(screen), + (unsigned) FullHeight(screen)); } } /* ARGSUSED */ -void HandleBellPropertyChange( - Widget w GCC_UNUSED, - XtPointer data GCC_UNUSED, - XEvent *ev, - Boolean *more GCC_UNUSED) +void +HandleBellPropertyChange( + Widget w GCC_UNUSED, + XtPointer data GCC_UNUSED, + XEvent * ev, + Boolean * more GCC_UNUSED) { register TScreen *screen = &term->screen; @@ -579,37 +593,64 @@ } } +Window +WMFrameWindow(XtermWidget termw) +{ + Window win_root, win_current, *children; + Window win_parent = 0; + unsigned int nchildren; + + win_current = XtWindow(termw); + + /* find the parent which is child of root */ + do { + if (win_parent) + win_current = win_parent; + XQueryTree((&termw->screen)->display, + win_current, + &win_root, + &win_parent, + &children, + &nchildren); + XFree(children); + } while (win_root != win_parent); + + return win_current; +} #if OPT_MAXIMIZE /*ARGSUSED*/ -void HandleDeIconify ( - Widget gw, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *nparams GCC_UNUSED) +void +HandleDeIconify( + Widget gw, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * nparams GCC_UNUSED) { if (IsXtermWidget(gw)) { - register TScreen *screen = &((XtermWidget)gw)->screen; + register TScreen *screen = &((XtermWidget) gw)->screen; XMapWindow(screen->display, VShellWindow); } } /*ARGSUSED*/ -void HandleIconify ( - Widget gw, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *nparams GCC_UNUSED) +void +HandleIconify( + Widget gw, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * nparams GCC_UNUSED) { if (IsXtermWidget(gw)) { - register TScreen *screen = &((XtermWidget)gw)->screen; + register TScreen *screen = &((XtermWidget) gw)->screen; XIconifyWindow(screen->display, VShellWindow, DefaultScreen(screen->display)); } } -int QueryMaximize(TScreen *screen, unsigned *width, unsigned *height) +int +QueryMaximize(TScreen * screen, unsigned *width, unsigned *height) { XSizeHints hints; long supp = 0; @@ -620,33 +661,33 @@ unsigned root_depth; if (XGetGeometry(screen->display, - XDefaultRootWindow(screen->display), - &root_win, - &root_x, - &root_y, - width, - height, - &root_border, - &root_depth)) { + XDefaultRootWindow(screen->display), + &root_win, + &root_x, + &root_y, + width, + height, + &root_border, + &root_depth)) { TRACE(("QueryMaximize: XGetGeometry position %d,%d size %d,%d border %d\n", - root_x, - root_y, - *width, - *height, - root_border)); + root_x, + root_y, + *width, + *height, + root_border)); *width -= (screen->border * 2), - *height -= (screen->border * 2); + *height -= (screen->border * 2); hints.flags = PMaxSize; if (XGetWMNormalHints(screen->display, - VShellWindow, - &hints, - &supp) - && (hints.flags & PMaxSize) != 0) { + VShellWindow, + &hints, + &supp) + && (hints.flags & PMaxSize) != 0) { TRACE(("QueryMaximize: WM hints max_w %#x max_h %#x\n", - hints.max_width, - hints.max_height)); + hints.max_width, + hints.max_height)); if ((unsigned) hints.max_width < *width) *width = hints.max_width; @@ -658,11 +699,11 @@ return 0; } -void RequestMaximize (XtermWidget termw, int maximize) +void +RequestMaximize(XtermWidget termw, int maximize) { - register TScreen *screen = &termw->screen; + register TScreen *screen = &termw->screen; XWindowAttributes win_attrs; - Position root_x, root_y; unsigned root_width, root_height; if (maximize) { @@ -670,29 +711,28 @@ if (QueryMaximize(screen, &root_width, &root_height)) { if (XGetWindowAttributes(screen->display, - VShellWindow, + WMFrameWindow(termw), &win_attrs)) { - XtTranslateCoords(toplevel, 0, 0, &root_x, &root_y); if (screen->restore_data != True - || screen->restore_width != root_width - || screen->restore_height != root_height) { + || screen->restore_width != root_width + || screen->restore_height != root_height) { screen->restore_data = True; - screen->restore_x = root_x - win_attrs.x; - screen->restore_y = root_y - win_attrs.y; + screen->restore_x = win_attrs.x; + screen->restore_y = win_attrs.y; screen->restore_width = win_attrs.width; screen->restore_height = win_attrs.height; TRACE(("HandleMaximize: save window position %d,%d size %d,%d\n", - screen->restore_x, - screen->restore_y, - screen->restore_width, - screen->restore_height)); + screen->restore_x, + screen->restore_y, + screen->restore_width, + screen->restore_height)); } XMoveResizeWindow(screen->display, VShellWindow, - 0, /* x */ - 0, /* y */ + 0, /* x */ + 0, /* y */ root_width, root_height); } @@ -700,10 +740,10 @@ } else { if (screen->restore_data) { TRACE(("HandleRestoreSize: position %d,%d size %d,%d\n", - screen->restore_x, - screen->restore_y, - screen->restore_width, - screen->restore_height)); + screen->restore_x, + screen->restore_y, + screen->restore_width, + screen->restore_height)); screen->restore_data = False; XMoveResizeWindow(screen->display, VShellWindow, @@ -716,26 +756,28 @@ } /*ARGSUSED*/ -void HandleMaximize ( - Widget gw, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *nparams GCC_UNUSED) +void +HandleMaximize( + Widget gw, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * nparams GCC_UNUSED) { if (IsXtermWidget(gw)) { - RequestMaximize((XtermWidget)gw, 1); + RequestMaximize((XtermWidget) gw, 1); } } /*ARGSUSED*/ -void HandleRestoreSize ( - Widget gw, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *nparams GCC_UNUSED) +void +HandleRestoreSize( + Widget gw, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * nparams GCC_UNUSED) { if (IsXtermWidget(gw)) { - RequestMaximize((XtermWidget)gw, 0); + RequestMaximize((XtermWidget) gw, 0); } } #endif /* OPT_MAXIMIZE */ @@ -743,31 +785,34 @@ void Redraw(void) { - register TScreen *screen = &term->screen; - XExposeEvent event; - - event.type = Expose; - event.display = screen->display; - event.x = 0; - event.y = 0; - event.count = 0; - - if(VWindow(screen)) { - event.window = VWindow(screen); - event.width = term->core.width; - event.height = term->core.height; - (*term->core.widget_class->core_class.expose)((Widget)term, (XEvent *)&event, NULL); - if(ScrollbarWidth(screen)) - (*screen->scrollWidget->core.widget_class->core_class.expose)(screen->scrollWidget, (XEvent *)&event, NULL); - } + register TScreen *screen = &term->screen; + XExposeEvent event; -#if OPT_TEK4014 - if(TWindow(screen) && screen->Tshow) { - event.window = TWindow(screen); - event.width = tekWidget->core.width; - event.height = tekWidget->core.height; - TekExpose ((Widget)tekWidget, (XEvent *)&event, NULL); + event.type = Expose; + event.display = screen->display; + event.x = 0; + event.y = 0; + event.count = 0; + + if (VWindow(screen)) { + event.window = VWindow(screen); + event.width = term->core.width; + event.height = term->core.height; + (*term->core.widget_class->core_class.expose) ((Widget) term, + (XEvent *) & event, + NULL); + if (ScrollbarWidth(screen)) { + (screen->scrollWidget->core.widget_class->core_class.expose) + (screen->scrollWidget, (XEvent *) & event, NULL); } + } +#if OPT_TEK4014 + if (TWindow(screen) && screen->Tshow) { + event.window = TWindow(screen); + event.width = tekWidget->core.width; + event.height = tekWidget->core.height; + TekExpose((Widget) tekWidget, (XEvent *) & event, NULL); + } #endif } @@ -802,16 +847,24 @@ struct stat sb; #ifdef VMS - if((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { - fprintf(stderr, "%s: cannot open %s: %d:%s\n", xterm_name, path, errno, SysErrorMsg(errno)); + if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { + fprintf(stderr, "%s: cannot open %s: %d:%s\n", + xterm_name, + path, + errno, + SysErrorMsg(errno)); return -1; } chown(path, uid, gid); #else if ((access(path, F_OK) != 0 && (errno != ENOENT)) - || (!(creat_as(uid, gid, append, path, 0644))) - || ((fd = open(path, O_WRONLY | O_APPEND, 0644)) < 0)) { - fprintf(stderr, "%s: cannot open %s: %d:%s\n", xterm_name, path, errno, SysErrorMsg(errno)); + || (!(creat_as(uid, gid, append, path, 0644))) + || ((fd = open(path, O_WRONLY | O_APPEND)) < 0)) { + fprintf(stderr, "%s: cannot open %s: %d:%s\n", + xterm_name, + path, + errno, + SysErrorMsg(errno)); return -1; } #endif @@ -821,8 +874,8 @@ * we do any damage, and that it is not world-writable. */ if (fstat(fd, &sb) < 0 - || (int) sb.st_uid != uid - || (sb.st_mode & 022) != 0) { + || (int) sb.st_uid != uid + || (sb.st_mode & 022) != 0) { fprintf(stderr, "%s: you do not own %s\n", xterm_name, path); close(fd); return -1; @@ -854,18 +907,19 @@ int childstat = 0; #ifndef HAVE_WAITPID int waited; - SIGNAL_T (*chldfunc) (int); + SIGNAL_T(*chldfunc) (int); chldfunc = signal(SIGCHLD, SIG_DFL); #endif /* HAVE_WAITPID */ pid = fork(); - switch (pid) - { + switch (pid) { case 0: /* child */ setgid(gid); setuid(uid); - fd = open(pathname, O_WRONLY|O_CREAT|(append ? O_APPEND : O_EXCL), mode); + fd = open(pathname, + O_WRONLY | O_CREAT | (append ? O_APPEND : O_EXCL), + mode); if (fd >= 0) { close(fd); _exit(0); @@ -887,23 +941,24 @@ #endif /* ERESTARTSYS */ break; } -#else /* HAVE_WAITPID */ +#else /* HAVE_WAITPID */ waited = wait(&childstat); signal(SIGCHLD, chldfunc); /* - Since we had the signal handler uninstalled for a while, - we might have missed the termination of our screen child. - If we can check for this possibility without hanging, do so. - */ + Since we had the signal handler uninstalled for a while, + we might have missed the termination of our screen child. + If we can check for this possibility without hanging, do so. + */ do if (waited == term->screen.pid) Cleanup(0); - while ( (waited=nonblocking_wait()) > 0); + while ((waited = nonblocking_wait()) > 0) ; #endif /* HAVE_WAITPID */ #ifndef WIFEXITED #define WIFEXITED(status) ((status & 0xff) != 0) #endif - if (WIFEXITED(childstat)) retval = 1; + if (WIFEXITED(childstat)) + retval = 1; return retval; } } @@ -917,160 +972,193 @@ */ #ifdef ALLOWLOGFILEEXEC -static SIGNAL_T logpipe (int sig GCC_UNUSED) +static SIGNAL_T +logpipe(int sig GCC_UNUSED) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; #ifdef SYSV - (void) signal(SIGPIPE, SIG_IGN); -#endif /* SYSV */ - if(screen->logging) - CloseLog(screen); + (void) signal(SIGPIPE, SIG_IGN); +#endif /* SYSV */ + if (screen->logging) + CloseLog(screen); } #endif /* ALLOWLOGFILEEXEC */ void -StartLog(register TScreen *screen) +StartLog(register TScreen * screen) { - static char *log_default; + static char *log_default; #ifdef ALLOWLOGFILEEXEC - register char *cp; - register int i = 0; + register char *cp; + register int i = 0; #endif /* ALLOWLOGFILEEXEC */ - if(screen->logging || (screen->inhibit & I_LOG)) + if (screen->logging || (screen->inhibit & I_LOG)) + return; +#ifdef VMS /* file name is fixed in VMS variant */ + screen->logfd = open(XTERM_VMS_LOGFILE, + O_CREAT | O_TRUNC | O_APPEND | O_RDWR, + 0640); + if (screen->logfd < 0) + return; /* open failed */ +#else /*VMS */ + if (screen->logfile == NULL || *screen->logfile == 0) { + if (screen->logfile) + free(screen->logfile); + if (log_default == NULL) { +#if defined(HAVE_GETHOSTNAME) && defined(HAVE_STRFTIME) + char log_def_name[512]; /* see sprintf below */ + char hostname[255 + 1]; /* Internet standard limit (RFC 1035): + ``To simplify implementations, the + total length of a domain name (i.e., + label octets and label length + octets) is restricted to 255 octets + or less.'' */ + char yyyy_mm_dd_hh_mm_ss[4 + 5 * (1 + 2) + 1]; + time_t now; + struct tm *ltm; + + (void) time(&now); + ltm = (struct tm *) localtime(&now); + if ((gethostname(hostname, sizeof(hostname)) == 0) && + (strftime(yyyy_mm_dd_hh_mm_ss, + sizeof(yyyy_mm_dd_hh_mm_ss), + "%Y.%m.%d.%H.%M.%S", ltm) > 0)) { + (void) sprintf(log_def_name, "Xterm.log.%.255s.%.20s.XXXXXX", + hostname, yyyy_mm_dd_hh_mm_ss); + } +#else + const char *log_def_name = "XtermLog.XXXXXX"; +#endif + if ((log_default = x_strdup(log_def_name)) == NULL) return; -#ifdef VMS /* file name is fixed in VMS variant */ - screen->logfd = open(XTERM_VMS_LOGFILE, O_CREAT|O_TRUNC|O_APPEND|O_RDWR, 0640); - if(screen->logfd < 0)return; /* open failed */ -#else /*VMS*/ - if(screen->logfile == NULL || *screen->logfile == 0) { - if(screen->logfile) - free(screen->logfile); - if(log_default == NULL) { - if ((log_default = x_strdup(log_def_name)) == NULL) - return; - mktemp(log_default); - } - if((screen->logfile = x_strdup(log_default)) == 0) - return; + + mktemp(log_default); } - if(*screen->logfile == '|') { /* exec command */ + if ((screen->logfile = x_strdup(log_default)) == 0) + return; + } + if (*screen->logfile == '|') { /* exec command */ #ifdef ALLOWLOGFILEEXEC - /* - * Warning, enabling this "feature" allows arbitrary programs - * to be run. If ALLOWLOGFILECHANGES is enabled, this can be - * done through escape sequences.... You have been warned. - */ - int p[2]; - static char *shell; - register struct passwd *pw; - - if(pipe(p) < 0 || (i = fork()) < 0) - return; - if(i == 0) { /* child */ - /* - * Close our output (we won't be talking back to the - * parent), and redirect our child's output to the - * original stderr. - */ - close(p[1]); - dup2(p[0], 0); - close(p[0]); - dup2(fileno(stderr), 1); - dup2(fileno(stderr), 2); - - close(fileno(stderr)); - close(ConnectionNumber(screen->display)); - close(screen->respond); - - if ((((cp = getenv("SHELL")) == NULL || *cp == 0) - && ((pw = getpwuid(screen->uid)) == NULL - || *(cp = pw->pw_shell) == 0)) - || (shell = (char *)malloc(strlen(cp) + 1)) == 0) - shell = "/bin/sh"; - else - strcpy(shell, cp); - - signal(SIGHUP, SIG_DFL); - signal(SIGCHLD, SIG_DFL); - - /* (this is redundant) */ - setgid(screen->gid); - setuid(screen->uid); - - execl(shell, shell, "-c", &screen->logfile[1], 0); + /* + * Warning, enabling this "feature" allows arbitrary programs + * to be run. If ALLOWLOGFILECHANGES is enabled, this can be + * done through escape sequences.... You have been warned. + */ + int p[2]; + static char *shell; + register struct passwd *pw; - fprintf(stderr, "%s: Can't exec `%s'\n", xterm_name, - &screen->logfile[1]); - exit(ERROR_LOGEXEC); - } - close(p[0]); - screen->logfd = p[1]; - signal(SIGPIPE, logpipe); + if (pipe(p) < 0 || (i = fork()) < 0) + return; + if (i == 0) { /* child */ + /* + * Close our output (we won't be talking back to the + * parent), and redirect our child's output to the + * original stderr. + */ + close(p[1]); + dup2(p[0], 0); + close(p[0]); + dup2(fileno(stderr), 1); + dup2(fileno(stderr), 2); + + close(fileno(stderr)); + close(ConnectionNumber(screen->display)); + close(screen->respond); + + if ((((cp = getenv("SHELL")) == NULL || *cp == 0) + && ((pw = getpwuid(screen->uid)) == NULL + || *(cp = pw->pw_shell) == 0)) + || (shell = (char *) malloc(strlen(cp) + 1)) == 0) + shell = "/bin/sh"; + else + strcpy(shell, cp); + + signal(SIGHUP, SIG_DFL); + signal(SIGCHLD, SIG_DFL); + + /* (this is redundant) */ + setgid(screen->gid); + setuid(screen->uid); + + execl(shell, shell, "-c", &screen->logfile[1], (void *) 0); + + fprintf(stderr, "%s: Can't exec `%s'\n", xterm_name, + &screen->logfile[1]); + exit(ERROR_LOGEXEC); + } + close(p[0]); + screen->logfd = p[1]; + signal(SIGPIPE, logpipe); #else - Bell(XkbBI_Info,0); - Bell(XkbBI_Info,0); - return; + Bell(XkbBI_Info, 0); + Bell(XkbBI_Info, 0); + return; #endif - } else { - if ((screen->logfd = open_userfile(screen->uid, screen->gid, screen->logfile, (log_default != 0))) < 0) - return; - } -#endif /*VMS*/ - screen->logstart = CURRENT_EMU_VAL(screen, Tbuffer->ptr, VTbuffer.ptr); - screen->logging = TRUE; - update_logging(); + } else { + if ((screen->logfd = open_userfile(screen->uid, + screen->gid, + screen->logfile, + (log_default != 0))) < 0) + return; + } +#endif /*VMS */ + screen->logstart = CURRENT_EMU_VAL(screen, Tbuffer->ptr, VTbuffer.ptr); + screen->logging = TRUE; + update_logging(); } void -CloseLog(register TScreen *screen) +CloseLog(register TScreen * screen) { - if(!screen->logging || (screen->inhibit & I_LOG)) - return; - FlushLog(screen); - close(screen->logfd); - screen->logging = FALSE; - update_logging(); + if (!screen->logging || (screen->inhibit & I_LOG)) + return; + FlushLog(screen); + close(screen->logfd); + screen->logging = FALSE; + update_logging(); } void -FlushLog(register TScreen *screen) +FlushLog(register TScreen * screen) { - register IChar *cp; - register int i; + register IChar *cp; + register int i; -#ifdef VMS /* avoid logging output loops which otherwise occur sometimes - when there is no output and cp/screen->logstart are 1 apart */ - if(!tt_new_output)return; - tt_new_output = FALSE; +#ifdef VMS /* avoid logging output loops which otherwise occur sometimes + when there is no output and cp/screen->logstart are 1 apart */ + if (!tt_new_output) + return; + tt_new_output = FALSE; #endif /* VMS */ - cp = CURRENT_EMU_VAL(screen, Tbuffer->ptr, VTbuffer.ptr); - if (screen->logstart != 0 - && (i = cp - screen->logstart) > 0) { + cp = CURRENT_EMU_VAL(screen, Tbuffer->ptr, VTbuffer.ptr); + if (screen->logstart != 0 + && (i = cp - screen->logstart) > 0) { #if OPT_WIDE_CHARS - Char temp[80]; - IChar code; - unsigned n; - while (i-- > 0) { - code = *(screen->logstart)++; - if (screen->utf8_mode) { - n = convertFromUTF8(code & 0xffff, temp); - } else { - temp[0] = code; - n = 1; - while (i > 0 && n < sizeof(temp)) { - i--; - temp[n++] = *(screen->logstart)++; - } - } - write(screen->logfd, temp, n); + Char temp[80]; + IChar code; + unsigned n; + while (i-- > 0) { + code = *(screen->logstart)++; + if (screen->utf8_mode) { + n = convertFromUTF8(code & 0xffff, temp); + } else { + temp[0] = code; + n = 1; + while (i > 0 && n < sizeof(temp)) { + i--; + temp[n++] = *(screen->logstart)++; } + } + write(screen->logfd, temp, n); + } #else - write(screen->logfd, (char *)screen->logstart, i); + write(screen->logfd, (char *) screen->logstart, i); #endif - } - screen->logstart = DecodedData(CURRENT_EMU_VAL(screen, Tbuffer, &VTbuffer)); + } + screen->logstart = DecodedData(CURRENT_EMU_VAL(screen, Tbuffer, &VTbuffer)); } #endif /* ALLOWLOGGING */ @@ -1078,23 +1166,24 @@ /***====================================================================***/ #if OPT_ISO_COLORS -static void ReportAnsiColorRequest(XtermWidget pTerm, int colornum, int final) +static void +ReportAnsiColorRequest(XtermWidget pTerm, int colornum, int final) { - XColor color; - Colormap cmap = pTerm->core.colormap; - char buffer[80]; - - TRACE(("ReportAnsiColorRequest %d\n", colornum)); - color.pixel = GET_COLOR_RES(pTerm->screen.Acolors[colornum]); - XQueryColor(term->screen.display, cmap, &color); - sprintf(buffer, "4;%d;rgb:%04x/%04x/%04x", - colornum, - color.red, - color.green, - color.blue); - unparseputc1(OSC, pTerm->screen.respond); - unparseputs(buffer, pTerm->screen.respond); - unparseputc1(final, pTerm->screen.respond); + XColor color; + Colormap cmap = pTerm->core.colormap; + char buffer[80]; + + TRACE(("ReportAnsiColorRequest %d\n", colornum)); + color.pixel = GET_COLOR_RES(pTerm->screen.Acolors[colornum]); + XQueryColor(term->screen.display, cmap, &color); + sprintf(buffer, "4;%d;rgb:%04x/%04x/%04x", + colornum, + color.red, + color.green, + color.blue); + unparseputc1(OSC, pTerm->screen.respond); + unparseputs(buffer, pTerm->screen.respond); + unparseputc1(final, pTerm->screen.respond); } /* @@ -1105,18 +1194,18 @@ * Return FALSE if not able to find or allocate a color. */ static int -find_closest_color(Display *display, Colormap cmap, XColor *def) +find_closest_color(Display * display, Colormap cmap, XColor * def) { - double tmp, distance, closestDistance; - int i, closest, numFound, cmap_size; - XColor *colortable; - XVisualInfo template, *visInfoPtr; - char *found; - int attempts; + double tmp, distance, closestDistance; + int i, closest, numFound, cmap_size; + XColor *colortable; + XVisualInfo template, *visInfoPtr; + char *found; + int attempts; template.visualid = XVisualIDFromVisual(DefaultVisual(display, - XDefaultScreen(display))); - visInfoPtr = XGetVisualInfo(display, (long)VisualIDMask, + XDefaultScreen(display))); + visInfoPtr = XGetVisualInfo(display, (long) VisualIDMask, &template, &numFound); if (numFound < 1) { /* FindClosestColor couldn't lookup visual */ @@ -1124,21 +1213,21 @@ } cmap_size = visInfoPtr->colormap_size; - XFree((char *)visInfoPtr); - colortable = (XColor *)malloc(cmap_size * sizeof(XColor)); + XFree((char *) visInfoPtr); + colortable = (XColor *) malloc(cmap_size * sizeof(XColor)); if (!colortable) { - return FALSE; /* out of memory */ + return FALSE; /* out of memory */ } - found = (char *)calloc(cmap_size, sizeof(char)); + found = (char *) calloc(cmap_size, sizeof(char)); if (!found) { free(colortable); - return FALSE; /* out of memory */ + return FALSE; /* out of memory */ } - for (i = 0; i < cmap_size; i++) { - colortable[i].pixel = (unsigned long)i; + for (i = 0; i < cmap_size; i++) { + colortable[i].pixel = (unsigned long) i; } - XQueryColors (display, cmap, colortable, cmap_size); + XQueryColors(display, cmap, colortable, cmap_size); /* * Find the color that best approximates the desired one, then @@ -1147,7 +1236,7 @@ * might change it) or else it was already freed. Try again, * over and over again, until something succeeds. */ - for(attempts = 0; attempts < cmap_size; attempts++) { + for (attempts = 0; attempts < cmap_size; attempts++) { closestDistance = 1e30; closest = 0; for (i = 0; i < cmap_size; i++) { @@ -1157,14 +1246,13 @@ * as the objective function; this accounts for differences * in the color sensitivity of the eye. */ - tmp = .30 * (((int)def->red) - (int)colortable[i].red); + tmp = .30 * (((int) def->red) - (int) colortable[i].red); distance = tmp * tmp; - tmp = .61 * (((int)def->green) - (int)colortable[i].green); + tmp = .61 * (((int) def->green) - (int) colortable[i].green); distance += tmp * tmp; - tmp = .11 * (((int)def->blue) - (int)colortable[i].blue); + tmp = .11 * (((int) def->blue) - (int) colortable[i].blue); distance += tmp * tmp; - if (distance < closestDistance) - { + if (distance < closestDistance) { closest = i; closestDistance = distance; } @@ -1187,51 +1275,52 @@ } static Boolean -AllocateAnsiColor( - XtermWidget pTerm, - ColorRes *res, - char *spec) -{ -XColor def; -register TScreen *screen = &pTerm->screen; -Colormap cmap = pTerm->core.colormap; +AllocateAnsiColor(XtermWidget pTerm, + ColorRes * res, + char *spec) +{ + XColor def; + register TScreen *screen = &pTerm->screen; + Colormap cmap = pTerm->core.colormap; if (XParseColor(screen->display, cmap, spec, &def) - && (XAllocColor(screen->display, cmap, &def) - || find_closest_color(screen->display, cmap, &def))) { + && (XAllocColor(screen->display, cmap, &def) + || find_closest_color(screen->display, cmap, &def))) { SET_COLOR_RES(res, def.pixel); - TRACE(("AllocateAnsiColor %s (pixel %#lx)\n", spec, def.pixel)); - return(TRUE); + TRACE(("AllocateAnsiColor[%d] %s (pixel %#lx)\n", + (res - screen->Acolors), spec, def.pixel)); + res->mode = True; + return (TRUE); } TRACE(("AllocateAnsiColor %s (failed)\n", spec)); - return(FALSE); + return (FALSE); } #if OPT_COLOR_RES Pixel -xtermGetColorRes(ColorRes *res) +xtermGetColorRes(ColorRes * res) { - if (!res->mode) { - if (AllocateAnsiColor(term, res, res->resource)) { - res->mode = True; - } else { - res->value = term->screen.foreground; - res->mode = -True; - fprintf(stderr, - "%s: Cannot allocate color %s\n", - xterm_name, - res->resource); - } + if (!res->mode) { + TRACE(("xtermGetColorRes for Acolors[%d]\n", + res - term->screen.Acolors)); + if (!AllocateAnsiColor(term, res, res->resource)) { + res->value = term->screen.foreground; + res->mode = -True; + fprintf(stderr, + "%s: Cannot allocate color %s\n", + xterm_name, + res->resource); } - return res->value; + } + return res->value; } #endif static Boolean ChangeAnsiColorRequest( - XtermWidget pTerm, - register char *buf, - int final) + XtermWidget pTerm, + register char *buf, + int final) { char *name; int color; @@ -1255,16 +1344,19 @@ } if (!strcmp(name, "?")) ReportAnsiColorRequest(pTerm, color, final); - else if (!AllocateAnsiColor(pTerm, &(pTerm->screen.Acolors[color]), name)) - break; - /* FIXME: free old color somehow? We aren't for the other color - * change style (dynamic colors). - */ - r = True; + else { + TRACE(("ChangeAnsiColor for Acolors[%d]\n", color)); + if (!AllocateAnsiColor(pTerm, &(pTerm->screen.Acolors[color]), name)) + break; + /* FIXME: free old color somehow? We aren't for the other color + * change style (dynamic colors). + */ + r = True; + } } if (r) ChangeAnsiColors(pTerm); - return(r); + return (r); } #else #define find_closest_color(display, cmap, def) 0 @@ -1273,162 +1365,173 @@ /***====================================================================***/ void -do_osc(Char *oscbuf, int len GCC_UNUSED, int final) +do_osc(Char * oscbuf, int len GCC_UNUSED, int final) { - register TScreen *screen = &(term->screen); - register int mode; - register Char *cp; - int state = 0; - char *buf = 0; - - /* - * Lines should be of the form <OSC> number ; string <ST>, however - * older xterms can accept <BEL> as a final character. We will respond - * with the same final character as the application sends to make this - * work better with shell scripts, which may have trouble reading an - * <ESC><backslash>, which is the 7-bit equivalent to <ST>. - */ - mode = 0; - for (cp = oscbuf; *cp != '\0'; cp++) { - switch (state) { - case 0: - if (isdigit(*cp)) { - mode = 10 * mode + (*cp - '0'); - if (mode > 65535) - return; - break; - } - /* FALLTHRU */ - case 1: - if (*cp != ';') - return; - state = 2; - break; - case 2: - buf = (char *)cp; - state = 3; - /* FALLTHRU */ - default: - if (ansi_table[CharOf(*cp)] != CASE_PRINT) - return; - } - } - if (buf == 0) return; + register TScreen *screen = &(term->screen); + register int mode; + register Char *cp; + int state = 0; + char *buf = 0; - switch(mode) { - case 0: /* new icon name and title*/ - Changename(buf); - Changetitle(buf); - break; - - case 1: /* new icon name only */ - Changename(buf); - break; - - case 2: /* new title only */ - Changetitle(buf); + /* + * Lines should be of the form <OSC> number ; string <ST>, however + * older xterms can accept <BEL> as a final character. We will respond + * with the same final character as the application sends to make this + * work better with shell scripts, which may have trouble reading an + * <ESC><backslash>, which is the 7-bit equivalent to <ST>. + */ + mode = 0; + for (cp = oscbuf; *cp != '\0'; cp++) { + switch (state) { + case 0: + if (isdigit(*cp)) { + mode = 10 * mode + (*cp - '0'); + if (mode > 65535) + return; break; + } + /* FALLTHRU */ + case 1: + if (*cp != ';') + return; + state = 2; + break; + case 2: + buf = (char *) cp; + state = 3; + /* FALLTHRU */ + default: + if (ansi_table[CharOf(*cp)] != CASE_PRINT) + return; + } + } + if (buf == 0) + return; - case 3: /* change X property */ - ChangeXprop(buf); - break; + switch (mode) { + case 0: /* new icon name and title */ + Changename(buf); + Changetitle(buf); + break; + + case 1: /* new icon name only */ + Changename(buf); + break; + + case 2: /* new title only */ + Changetitle(buf); + break; + + case 3: /* change X property */ + ChangeXprop(buf); + break; #if OPT_ISO_COLORS - case 4: - ChangeAnsiColorRequest(term, buf, final); - break; -#endif - case 10: case 11: case 12: - case 13: case 14: case 15: - case 16: case 17: - if (term->misc.dynamicColors) - ChangeColorsRequest(term, mode-10, buf, final); - break; + case 4: + ChangeAnsiColorRequest(term, buf, final); + break; +#endif + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + if (term->misc.dynamicColors) + ChangeColorsRequest(term, mode - 10, buf, final); + break; + + case 30: + case 31: + /* reserved for Konsole (Stephan Binner <Stephan.Binner@gmx.de>) */ + break; #ifdef ALLOWLOGGING - case 46: /* new log file */ + case 46: /* new log file */ #ifdef ALLOWLOGFILECHANGES - /* - * Warning, enabling this feature allows people to overwrite - * arbitrary files accessible to the person running xterm. - */ - if (buf != 0 - && strcmp(buf, "?") - && ((cp = malloc((unsigned)strlen(buf) + 1)) != NULL)) { - strcpy(cp, buf); - if(screen->logfile) - free(screen->logfile); - screen->logfile = cp; - break; - } + /* + * Warning, enabling this feature allows people to overwrite + * arbitrary files accessible to the person running xterm. + */ + if (buf != 0 + && strcmp(buf, "?") + && ((cp = malloc((unsigned) strlen(buf) + 1)) != NULL)) { + strcpy(cp, buf); + if (screen->logfile) + free(screen->logfile); + screen->logfile = cp; + break; + } #endif - Bell(XkbBI_Info,0); - Bell(XkbBI_Info,0); - break; + Bell(XkbBI_Info, 0); + Bell(XkbBI_Info, 0); + break; #endif /* ALLOWLOGGING */ - case 50: - if (buf != 0 && !strcmp(buf, "?")) { - int num = screen->menu_font_number; - - unparseputc1(OSC, screen->respond); - unparseputs("50", screen->respond); - - if ((buf = screen->menu_font_names[num]) != 0) { - unparseputc(';', screen->respond); - unparseputs(buf, screen->respond); - } - unparseputc1(final, screen->respond); - } else { - /* - * If the font specification is a "#", followed by an - * optional sign and optional number, lookup the - * corresponding menu font entry. - */ - if (buf != 0 && *buf == '#') { - int num = screen->menu_font_number; - int rel = 0; - - if (*++buf == '+') { - rel = 1; - buf++; - } else if (*buf == '-') { - rel = -1; - buf++; - } + case 50: + if (buf != 0 && !strcmp(buf, "?")) { + int num = screen->menu_font_number; + + unparseputc1(OSC, screen->respond); + unparseputs("50", screen->respond); + + if ((buf = screen->menu_font_names[num]) != 0) { + unparseputc(';', screen->respond); + unparseputs(buf, screen->respond); + } + unparseputc1(final, screen->respond); + } else { + /* + * If the font specification is a "#", followed by an + * optional sign and optional number, lookup the + * corresponding menu font entry. + */ + if (buf != 0 && *buf == '#') { + int num = screen->menu_font_number; + int rel = 0; + + if (*++buf == '+') { + rel = 1; + buf++; + } else if (*buf == '-') { + rel = -1; + buf++; + } - if (isdigit(CharOf(*buf))) { - int val = atoi(buf); - if (rel > 0) - num += val; - else if (rel < 0) - num -= val; - else - num = val; - } else if (rel) { - num += rel; - } else { - num = 0; - } + if (isdigit(CharOf(*buf))) { + int val = atoi(buf); + if (rel > 0) + num += val; + else if (rel < 0) + num -= val; + else + num = val; + } else if (rel) { + num += rel; + } else { + num = 0; + } - if (num < 0 - || num > fontMenu_lastBuiltin - || (buf = screen->menu_font_names[num]) == 0) { - Bell(XkbBI_MinorError,0); - break; - } - } - SetVTFont (fontMenu_fontescape, True, VT_FONTSET(buf, NULL, NULL, NULL)); + if (num < 0 + || num > fontMenu_lastBuiltin + || (buf = screen->menu_font_names[num]) == 0) { + Bell(XkbBI_MinorError, 0); + break; } - break; - case 51: - /* reserved for Emacs shell (Rob Myoff <mayoff@dqd.com>) */ - break; + } + SetVTFont(fontMenu_fontescape, True, VT_FONTSET(buf, NULL, NULL, NULL)); + } + break; + case 51: + /* reserved for Emacs shell (Rob Myoff <mayoff@dqd.com>) */ + break; /* * One could write code to send back the display and host names, * but that could potentially open a fairly nasty security hole. */ - } + } } #ifdef SunXK_F36 @@ -1437,281 +1540,297 @@ #define MAX_UDK 35 #endif static struct { - char *str; - int len; - } user_keys[MAX_UDK]; + char *str; + int len; +} user_keys[MAX_UDK]; +/* + * Parse one nibble of a hex byte from the OSC string. We have removed the + * string-terminator (replacing it with a null), so the only other delimiter + * that is expected is semicolon. Ignore other characters (Ray Neuman says + * "real" terminals accept commas in the string definitions). + */ static int -hexvalue(int c) +udk_value(char **cp) { - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'A' && c <= 'F') return c - 'A' + 10; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - return -1; + int c; + + for (;;) { + if ((c = **cp) != '\0') + *cp = *cp + 1; + if (c == ';' || c == '\0') + return -1; + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + } } void reset_decudk(void) { - int n; - for (n = 0; n < MAX_UDK; n++) { - if (user_keys[n].str != 0) { - free(user_keys[n].str); - user_keys[n].str = 0; - user_keys[n].len = 0; - } + int n; + for (n = 0; n < MAX_UDK; n++) { + if (user_keys[n].str != 0) { + free(user_keys[n].str); + user_keys[n].str = 0; + user_keys[n].len = 0; } + } } void -do_dcs(Char *dcsbuf, size_t dcslen) +do_dcs(Char * dcsbuf, size_t dcslen) { - TScreen *screen = &term->screen; - char reply[BUFSIZ]; - char *cp = (char *)dcsbuf; - Bool okay; - Bool clear_all; - Bool lock_keys; + TScreen *screen = &term->screen; + char reply[BUFSIZ]; + char *cp = (char *) dcsbuf; + Bool okay; + Bool clear_all; + Bool lock_keys; - TRACE(("do_dcs(%s:%d)\n", (char *)dcsbuf, dcslen)); - - if (dcslen != strlen(cp)) - /* shouldn't have nulls in the string */ - return; + TRACE(("do_dcs(%s:%d)\n", (char *) dcsbuf, dcslen)); - switch (*cp) { /* intermediate character, or parameter */ - case '$': /* DECRQSS */ - okay = True; + if (dcslen != strlen(cp)) + /* shouldn't have nulls in the string */ + return; - cp++; - if (*cp++ == 'q') { - if (!strcmp(cp, "\"q")) { /* DECSCA */ - sprintf(reply, "%d%s", - (screen->protected_mode == DEC_PROTECT) - && (term->flags & PROTECTED) ? 1 : 0, - cp); - } else if (!strcmp(cp, "\"p")) { /* DECSCL */ - sprintf(reply, "%d%s%s", - (screen->ansi_level ? - screen->ansi_level : 1) + 60, - (screen->ansi_level >= 2) - ? (screen->control_eight_bits - ? ";0" : ";1") - : "", - cp); - } else if (!strcmp(cp, "r")) { /* DECSTBM */ - sprintf(reply, "%d;%dr", - screen->top_marg + 1, - screen->bot_marg + 1); - } else if (!strcmp(cp, "m")) { /* SGR */ - strcpy(reply, "0"); - if (term->flags & BOLD) - strcat(reply, ";1"); - if (term->flags & UNDERLINE) - strcat(reply, ";4"); - if (term->flags & BLINK) - strcat(reply, ";5"); - if (term->flags & INVERSE) - strcat(reply, ";7"); - if (term->flags & INVISIBLE) - strcat(reply, ";8"); - if_OPT_EXT_COLORS(screen,{ - if (term->flags & FG_COLOR) { - if (term->cur_foreground >= 16) - sprintf(reply+strlen(reply), - ";38;5;%d", term->cur_foreground); - else - sprintf(reply+strlen(reply), - ";%d%d", - term->cur_foreground >= 8 ? 9 : 3, - term->cur_foreground >= 8 ? - term->cur_foreground - 8 : - term->cur_foreground); - } - if (term->flags & BG_COLOR) { - if (term->cur_background >= 16) - sprintf(reply+strlen(reply), - ";48;5;%d", term->cur_foreground); - else - sprintf(reply+strlen(reply), - ";%d%d", - term->cur_background >= 8 ? 10 : 4, - term->cur_background >= 8 ? - term->cur_background - 8 : - term->cur_background); - } - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - if (term->flags & FG_COLOR) - sprintf(reply+strlen(reply), - ";%d%d", - term->cur_foreground >= 8 ? 9 : 3, - term->cur_foreground >= 8 ? - term->cur_foreground - 8 : - term->cur_foreground); - if (term->flags & BG_COLOR) - sprintf(reply+strlen(reply), - ";%d%d", - term->cur_background >= 8 ? 10 : 4, - term->cur_background >= 8 ? - term->cur_background - 8 : - term->cur_background); - }) - strcat(reply, "m"); - } else - okay = False; - - unparseputc1(DCS, screen->respond); - unparseputc(okay ? '1' : '0', screen->respond); - unparseputc('$', screen->respond); - unparseputc('r', screen->respond); - if (okay) - cp = reply; - unparseputs(cp, screen->respond); - unparseputc1(ST, screen->respond); - } else { - unparseputc(CAN, screen->respond); - } - break; + switch (*cp) { /* intermediate character, or parameter */ + case '$': /* DECRQSS */ + okay = True; + + cp++; + if (*cp++ == 'q') { + if (!strcmp(cp, "\"q")) { /* DECSCA */ + sprintf(reply, "%d%s", + (screen->protected_mode == DEC_PROTECT) + && (term->flags & PROTECTED) ? 1 : 0, + cp); + } else if (!strcmp(cp, "\"p")) { /* DECSCL */ + sprintf(reply, "%d%s%s", + (screen->ansi_level ? + screen->ansi_level : 1) + 60, + (screen->ansi_level >= 2) + ? (screen->control_eight_bits + ? ";0" : ";1") + : "", + cp); + } else if (!strcmp(cp, "r")) { /* DECSTBM */ + sprintf(reply, "%d;%dr", + screen->top_marg + 1, + screen->bot_marg + 1); + } else if (!strcmp(cp, "m")) { /* SGR */ + strcpy(reply, "0"); + if (term->flags & BOLD) + strcat(reply, ";1"); + if (term->flags & UNDERLINE) + strcat(reply, ";4"); + if (term->flags & BLINK) + strcat(reply, ";5"); + if (term->flags & INVERSE) + strcat(reply, ";7"); + if (term->flags & INVISIBLE) + strcat(reply, ";8"); + if_OPT_EXT_COLORS(screen, { + if (term->flags & FG_COLOR) { + if (term->cur_foreground >= 16) + sprintf(reply + strlen(reply), + ";38;5;%d", term->cur_foreground); + else + sprintf(reply + strlen(reply), + ";%d%d", + term->cur_foreground >= 8 ? 9 : 3, + term->cur_foreground >= 8 ? + term->cur_foreground - 8 : + term->cur_foreground); + } + if (term->flags & BG_COLOR) { + if (term->cur_background >= 16) + sprintf(reply + strlen(reply), + ";48;5;%d", term->cur_foreground); + else + sprintf(reply + strlen(reply), + ";%d%d", + term->cur_background >= 8 ? 10 : 4, + term->cur_background >= 8 ? + term->cur_background - 8 : + term->cur_background); + } + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + if (term->flags & FG_COLOR) + sprintf(reply + strlen(reply), + ";%d%d", + term->cur_foreground >= 8 ? 9 : 3, + term->cur_foreground >= 8 ? + term->cur_foreground - 8 : + term->cur_foreground); + if (term->flags & BG_COLOR) + sprintf(reply + strlen(reply), + ";%d%d", + term->cur_background >= 8 ? 10 : 4, + term->cur_background >= 8 ? + term->cur_background - 8 : + term->cur_background); + }); + strcat(reply, "m"); + } else + okay = False; + + unparseputc1(DCS, screen->respond); + unparseputc(okay ? '1' : '0', screen->respond); + unparseputc('$', screen->respond); + unparseputc('r', screen->respond); + if (okay) + cp = reply; + unparseputs(cp, screen->respond); + unparseputc1(ST, screen->respond); + } else { + unparseputc(CAN, screen->respond); + } + break; #if OPT_TCAP_QUERY - case '+': - cp++; - if (*cp == 'q') { - unsigned state; - int code; - char *tmp; - - ++cp; - code = xtermcapKeycode(cp, &state); - unparseputc1(DCS, screen->respond); - unparseputc(code >= 0 ? '1' : '0', screen->respond); - unparseputc('+', screen->respond); - unparseputc('r', screen->respond); - for (tmp = cp; *tmp; ++tmp) - unparseputc(*tmp, screen->respond); - if (code >= 0) { - unparseputc('=', screen->respond); - screen->tc_query = code; - /* XK_COLORS is a fake code for the "Co" entry (maximum - * number of colors) */ - if (code == XK_COLORS) { + case '+': + cp++; + if (*cp == 'q') { + unsigned state; + int code; + char *tmp; + + ++cp; + code = xtermcapKeycode(cp, &state); + unparseputc1(DCS, screen->respond); + unparseputc(code >= 0 ? '1' : '0', screen->respond); + unparseputc('+', screen->respond); + unparseputc('r', screen->respond); + for (tmp = cp; *tmp; ++tmp) + unparseputc(*tmp, screen->respond); + if (code >= 0) { + unparseputc('=', screen->respond); + screen->tc_query = code; + /* XK_COLORS is a fake code for the "Co" entry (maximum + * number of colors) */ + if (code == XK_COLORS) { # if OPT_256_COLORS - unparseputc('2', screen->respond); - unparseputc('5', screen->respond); - unparseputc('6', screen->respond); + unparseputc('2', screen->respond); + unparseputc('5', screen->respond); + unparseputc('6', screen->respond); # elif OPT_88_COLORS - unparseputc('8', screen->respond); - unparseputc('8', screen->respond); + unparseputc('8', screen->respond); + unparseputc('8', screen->respond); # else - unparseputc('1', screen->respond); - unparseputc('6', screen->respond); + unparseputc('1', screen->respond); + unparseputc('6', screen->respond); # endif - } - else { - XKeyEvent event; - event.state = state; - Input(&(term->keyboard), screen, &event, False); - } - screen->tc_query = -1; - } - unparseputc1(ST, screen->respond); + } else { + XKeyEvent event; + event.state = state; + Input(&(term->keyboard), screen, &event, False); } - break; + screen->tc_query = -1; + } + unparseputc1(ST, screen->respond); + } + break; #endif - default: - if (isdigit(CharOf(*cp))) { /* digits are DECUDK, otherwise ignore */ - clear_all = True; - lock_keys = True; - - if (*cp == '0') { - cp++; - } else if (*cp == '1') { - cp++; - clear_all = False; - } + default: + if (isdigit(CharOf(*cp))) { /* digits are DECUDK, otherwise ignore */ + clear_all = True; + lock_keys = True; - if (*cp == ';') - cp++; - else if (*cp != '|') - return; - - if (*cp == '0') { - cp++; - } else if (*cp == '1') { - cp++; - lock_keys = False; - } + if (*cp == '0') { + cp++; + } else if (*cp == '1') { + cp++; + clear_all = False; + } + + if (*cp == ';') + cp++; + else if (*cp != '|') + return; - if (*cp++ != '|') - return; + if (*cp == '0') { + cp++; + } else if (*cp == '1') { + cp++; + lock_keys = False; + } - if (clear_all) - reset_decudk(); + if (*cp++ != '|') + return; - while (*cp) { - char *str = (char *)malloc(strlen(cp) + 2); - unsigned key = 0; - int len = 0; - - while (isdigit(CharOf(*cp))) - key = (key * 10) + (*cp++ - '0'); - if (*cp == '/') { - cp++; - while (*cp != ';' && *cp != '\0') { - int hi = hexvalue(*cp++); - int lo = hexvalue(*cp++); - if (hi < 0 || lo < 0) - return; - str[len++] = (hi << 4) | lo; - } - } - if (len > 0 && key < MAX_UDK) { - if (user_keys[key].str != 0) - free(user_keys[key].str); - user_keys[key].str = str; - user_keys[key].len = len; - } else { - free(str); - } - if (*cp == ';') - cp++; - } + if (clear_all) + reset_decudk(); + + while (*cp) { + char *base = cp; + char *str = (char *) malloc(strlen(cp) + 2); + unsigned key = 0; + int lo, hi; + int len = 0; + + while (isdigit(CharOf(*cp))) + key = (key * 10) + (*cp++ - '0'); + if (*cp == '/') { + cp++; + while ((hi = udk_value(&cp)) >= 0 + && (lo = udk_value(&cp)) >= 0) { + str[len++] = (hi << 4) | lo; + } } - break; + if (len > 0 && key < MAX_UDK) { + if (user_keys[key].str != 0) + free(user_keys[key].str); + user_keys[key].str = str; + user_keys[key].len = len; + } else { + free(str); + } + if (*cp == ';') + cp++; + if (cp == base) /* badly-formed sequence - bail out */ + break; + } } + break; + } } char * udk_lookup(int keycode, int *len) { - if (keycode >= 0 && keycode < MAX_UDK) { - *len = user_keys[keycode].len; - return user_keys[keycode].str; - } - return 0; + if (keycode >= 0 && keycode < MAX_UDK) { + *len = user_keys[keycode].len; + return user_keys[keycode].str; + } + return 0; } static void -ChangeGroup(String attribute, char * value) +ChangeGroup(String attribute, char *value) { - Arg args[1]; - char *name = (value != 0) ? (char *)value : ""; + Arg args[1]; + char *name = (value != 0) ? (char *) value : ""; - TRACE(("ChangeGroup(attribute=%s, value=%s)\n", attribute, name)); + TRACE(("ChangeGroup(attribute=%s, value=%s)\n", attribute, name)); #if OPT_SAME_NAME - /* If the attribute isn't going to change, then don't bother... */ + /* If the attribute isn't going to change, then don't bother... */ - if( sameName ) { - char *buf; - XtSetArg( args[0], attribute, &buf ); - XtGetValues( toplevel, args, 1 ); - if (strcmp(name, buf) == 0) - return; - } + if (sameName) { + char *buf; + XtSetArg(args[0], attribute, &buf); + XtGetValues(toplevel, args, 1); + if (strcmp(name, buf) == 0) + return; + } #endif /* OPT_SAME_NAME */ - XtSetArg( args[0], attribute, name ); - XtSetValues( toplevel, args, 1 ); + XtSetArg(args[0], attribute, name); + XtSetValues(toplevel, args, 1); } void @@ -1719,26 +1838,26 @@ { if (name == 0) name = ""; -#if OPT_ZICONBEEP /* If warning should be given then give it */ - if ( zIconBeep && zIconBeep_flagged ) { - char *newname = (char *)malloc(strlen(name)+ 4 + 1); +#if OPT_ZICONBEEP /* If warning should be given then give it */ + if (zIconBeep && zIconBeep_flagged) { + char *newname = (char *) malloc(strlen(name) + 4 + 1); if (!newname) { fprintf(stderr, "malloc failed in Changename\n"); return; } strcpy(newname, "*** "); strcat(newname, name); - ChangeGroup( XtNiconName, newname ); + ChangeGroup(XtNiconName, newname); free(newname); } else #endif /* OPT_ZICONBEEP */ - ChangeGroup( XtNiconName, name ); + ChangeGroup(XtNiconName, name); } void Changetitle(register char *name) { - ChangeGroup( XtNtitle, name ); + ChangeGroup(XtNtitle, name); } #define Strlen(s) strlen((char *)(s)) @@ -1750,72 +1869,73 @@ Window w = XtWindow(toplevel); XTextProperty text_prop; Atom aprop; - Char *pchEndPropName = (Char *)strchr(buf,'='); + Char *pchEndPropName = (Char *) strchr(buf, '='); if (pchEndPropName) *pchEndPropName = '\0'; aprop = XInternAtom(dpy, buf, False); if (pchEndPropName == NULL) { - /* no "=value" given, so delete the property */ + /* no "=value" given, so delete the property */ XDeleteProperty(dpy, w, aprop); } else { - text_prop.value = pchEndPropName+1; + text_prop.value = pchEndPropName + 1; text_prop.encoding = XA_STRING; text_prop.format = 8; text_prop.nitems = Strlen(text_prop.value); - XSetTextProperty(dpy,w,&text_prop,aprop); + XSetTextProperty(dpy, w, &text_prop, aprop); } } /***====================================================================***/ -ScrnColors *pOldColors= NULL; +ScrnColors *pOldColors = NULL; static Boolean GetOldColors(XtermWidget pTerm) { -int i; + int i; if (pOldColors == NULL) { - pOldColors = (ScrnColors *)XtMalloc(sizeof(ScrnColors)); + pOldColors = (ScrnColors *) XtMalloc(sizeof(ScrnColors)); if (pOldColors == NULL) { - fprintf(stderr,"allocation failure in GetOldColors\n"); - return(FALSE); + fprintf(stderr, "allocation failure in GetOldColors\n"); + return (FALSE); } pOldColors->which = 0; for (i = 0; i < NCOLORS; i++) { pOldColors->colors[i] = 0; pOldColors->names[i] = NULL; } - GetColors(pTerm,pOldColors); + GetColors(pTerm, pOldColors); } - return(TRUE); + return (TRUE); } -static void ReportColorRequest(XtermWidget pTerm, int ndx, int final) +static void +ReportColorRequest(XtermWidget pTerm, int ndx, int final) { - XColor color; - Colormap cmap = pTerm->core.colormap; - char buffer[80]; - - GetOldColors(pTerm); - color.pixel = pOldColors->colors[ndx]; - TRACE(("ReportColors %d: %#lx\n", ndx, pOldColors->colors[ndx])); - XQueryColor(term->screen.display, cmap, &color); - sprintf(buffer, "%d;rgb:%04x/%04x/%04x", ndx + 10, - color.red, - color.green, - color.blue); - unparseputc1(OSC, pTerm->screen.respond); - unparseputs(buffer, pTerm->screen.respond); - unparseputc1(final, pTerm->screen.respond); + XColor color; + Colormap cmap = pTerm->core.colormap; + char buffer[80]; + + GetOldColors(pTerm); + color.pixel = pOldColors->colors[ndx]; + TRACE(("ReportColors %d: %#lx\n", ndx, pOldColors->colors[ndx])); + XQueryColor(term->screen.display, cmap, &color); + sprintf(buffer, "%d;rgb:%04x/%04x/%04x", ndx + 10, + color.red, + color.green, + color.blue); + unparseputc1(OSC, pTerm->screen.respond); + unparseputs(buffer, pTerm->screen.respond); + unparseputc1(final, pTerm->screen.respond); } static Boolean UpdateOldColors( - XtermWidget pTerm GCC_UNUSED, - ScrnColors *pNew) + XtermWidget pTerm GCC_UNUSED, + ScrnColors * pNew) { -int i; + int i; /* if we were going to free old colors, this would be the place to * do it. I've decided not to (for now), because it seems likely @@ -1836,123 +1956,125 @@ pOldColors->colors[i] = pNew->colors[i]; } } - return(TRUE); + return (TRUE); } void ReverseOldColors(void) { -register ScrnColors *pOld= pOldColors; -Pixel tmpPix; -char *tmpName; + register ScrnColors *pOld = pOldColors; + Pixel tmpPix; + char *tmpName; if (pOld) { /* change text cursor, if necesary */ if (pOld->colors[TEXT_CURSOR] == pOld->colors[TEXT_FG]) { - pOld->colors[TEXT_CURSOR] = pOld->colors[TEXT_BG]; + pOld->colors[TEXT_CURSOR] = pOld->colors[TEXT_BG]; if (pOld->names[TEXT_CURSOR]) { XtFree(pOldColors->names[TEXT_CURSOR]); pOld->names[TEXT_CURSOR] = NULL; } if (pOld->names[TEXT_BG]) { - tmpName = XtMalloc(strlen(pOld->names[TEXT_BG])+1); + tmpName = XtMalloc(strlen(pOld->names[TEXT_BG]) + 1); if (tmpName) { - strcpy(tmpName,pOld->names[TEXT_BG]); - pOld->names[TEXT_CURSOR]= tmpName; + strcpy(tmpName, pOld->names[TEXT_BG]); + pOld->names[TEXT_CURSOR] = tmpName; } } } - EXCHANGE(pOld->colors[TEXT_FG], pOld->colors[TEXT_BG], tmpPix); - EXCHANGE(pOld->names[TEXT_FG], pOld->names[TEXT_BG], tmpName); + EXCHANGE(pOld->colors[TEXT_FG], pOld->colors[TEXT_BG], tmpPix); + EXCHANGE(pOld->names[TEXT_FG], pOld->names[TEXT_BG], tmpName); - EXCHANGE(pOld->colors[MOUSE_FG],pOld->colors[MOUSE_BG], tmpPix); - EXCHANGE(pOld->names[MOUSE_FG], pOld->names[MOUSE_BG], tmpName); + EXCHANGE(pOld->colors[MOUSE_FG], pOld->colors[MOUSE_BG], tmpPix); + EXCHANGE(pOld->names[MOUSE_FG], pOld->names[MOUSE_BG], tmpName); - EXCHANGE(pOld->colors[TEK_FG], pOld->colors[TEK_BG], tmpPix); - EXCHANGE(pOld->names[TEK_FG], pOld->names[TEK_BG], tmpName); + EXCHANGE(pOld->colors[TEK_FG], pOld->colors[TEK_BG], tmpPix); + EXCHANGE(pOld->names[TEK_FG], pOld->names[TEK_BG], tmpName); } return; } static Boolean AllocateColor( - XtermWidget pTerm, - ScrnColors *pNew, - int ndx, - char *name) -{ -XColor def; -register TScreen *screen = &pTerm->screen; -Colormap cmap = pTerm->core.colormap; -char *newName; + XtermWidget pTerm, + ScrnColors * pNew, + int ndx, + char *name) +{ + XColor def; + register TScreen *screen = &pTerm->screen; + Colormap cmap = pTerm->core.colormap; + char *newName; if (XParseColor(screen->display, cmap, name, &def) - && (XAllocColor(screen->display, cmap, &def) - || find_closest_color(screen->display, cmap, &def)) - && (newName = XtMalloc(strlen(name)+1)) != 0) { + && (XAllocColor(screen->display, cmap, &def) + || find_closest_color(screen->display, cmap, &def)) + && (newName = XtMalloc(strlen(name) + 1)) != 0) { SET_COLOR_VALUE(pNew, ndx, def.pixel); strcpy(newName, name); SET_COLOR_NAME(pNew, ndx, newName); TRACE(("AllocateColor #%d: %s (pixel %#lx)\n", ndx, newName, def.pixel)); - return(TRUE); + return (TRUE); } TRACE(("AllocateColor #%d: %s (failed)\n", ndx, name)); - return(FALSE); + return (FALSE); } static Boolean ChangeColorsRequest( - XtermWidget pTerm, - int start, - register char *names, - int final) -{ -char *thisName; -ScrnColors newColors; -int i, ndx; + XtermWidget pTerm, + int start, + register char *names, + int final) +{ + char *thisName; + ScrnColors newColors; + int i, ndx; TRACE(("ChangeColorsRequest start=%d, names='%s'\n", start, names)); if ((pOldColors == NULL) - && (!GetOldColors(pTerm))) { - return(FALSE); + && (!GetOldColors(pTerm))) { + return (FALSE); } newColors.which = 0; for (i = 0; i < NCOLORS; i++) { newColors.names[i] = NULL; } for (i = start; i < NCOLORS; i++) { - if (term->misc.re_verse) ndx = OPPOSITE_COLOR(i); - else ndx = i; + if (term->misc.re_verse) + ndx = OPPOSITE_COLOR(i); + else + ndx = i; if ((names == NULL) || (names[0] == '\0')) { newColors.names[ndx] = NULL; - } - else { + } else { if (names[0] == ';') - thisName= NULL; - else thisName= names; + thisName = NULL; + else + thisName = names; names = strchr(names, ';'); if (names != NULL) { - *names= '\0'; + *names = '\0'; names++; } if (thisName != 0 && !strcmp(thisName, "?")) ReportColorRequest(pTerm, ndx, final); else if (!pOldColors->names[ndx] - || (thisName - && strcmp(thisName, pOldColors->names[ndx]))) { + || (thisName + && strcmp(thisName, pOldColors->names[ndx]))) { AllocateColor(pTerm, &newColors, ndx, thisName); } } } if (newColors.which == 0) - return(TRUE); + return (TRUE); ChangeColors(pTerm, &newColors); UpdateOldColors(pTerm, &newColors); - return(TRUE); + return (TRUE); } /***====================================================================***/ @@ -1964,87 +2086,148 @@ Panic(char *s GCC_UNUSED, int a GCC_UNUSED) { #ifdef DEBUG - if(debug) { - fprintf(stderr, "%s: PANIC!\t", xterm_name); - fprintf(stderr, s, a); - fputs("\r\n", stderr); - fflush(stderr); - } -#endif /* DEBUG */ + if (debug) { + fprintf(stderr, "%s: PANIC!\t", xterm_name); + fprintf(stderr, s, a); + fputs("\r\n", stderr); + fflush(stderr); + } +#endif /* DEBUG */ } -char *SysErrorMsg (int n) +char * +SysErrorMsg(int n) { register char *s = strerror(n); return s ? s : "unknown error"; } -void -SysError (int i) -{ - int oerrno; - - oerrno = errno; - /* perror(3) write(2)s to file descriptor 2 */ - fprintf (stderr, "%s: Error %d, errno %d: ", xterm_name, i, oerrno); - fprintf (stderr, "%s\n", SysErrorMsg (oerrno)); - Cleanup(i); -} - void -Error (int i) +SysError(int i) { - fprintf (stderr, "%s: Error %d\n", xterm_name, i); - Cleanup(i); + static const char *table[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ,"main: ioctl() failed on FIONBIO" /* 11 */ + ,"main: ioctl() failed on F_GETFL" /* 12 */ + ,"main: ioctl() failed on F_SETFL" /* 13 */ + ,"spawn: open() failed on /dev/tty" /* 14 */ + ,"spawn: ioctl() failed on TIOCGETP" /* 15 */ + ,0 + ,"spawn: ptsname() failed" /* 17 */ + ,"spawn: open() failed on ptsname" /* 18 */ + ,"spawn: ioctl() failed on I_PUSH/\"ptem\"" /* 19 */ + ,"spawn: ioctl() failed on I_PUSH/\"consem\"" /* 20 */ + ,"spawn: ioctl() failed on I_PUSH/\"ldterm\"" /* 21 */ + ,"spawn: ioctl() failed on I_PUSH/\"ttcompat\"" /* 22 */ + ,"spawn: ioctl() failed on TIOCSETP" /* 23 */ + ,"spawn: ioctl() failed on TIOCSETC" /* 24 */ + ,"spawn: ioctl() failed on TIOCSETD" /* 25 */ + ,"spawn: ioctl() failed on TIOCSLTC" /* 26 */ + ,"spawn: ioctl() failed on TIOCLSET" /* 27 */ + ,"spawn: initgroups() failed" /* 28 */ + ,"spawn: fork() failed" /* 29 */ + ,"spawn: exec() failed" /* 30 */ + ,0 + ,"get_pty: not enough ptys" /* 32 */ + ,0 + ,"waiting for initial map" /* 34 */ + ,"spawn: setuid() failed" /* 35 */ + ,"spawn: can't initialize window" /* 36 */ + ,0, 0, 0, 0, 0, 0, 0, 0, 0 + ,"spawn: ioctl() failed on TIOCKSET" /* 46 */ + ,"spawn: ioctl() failed on TIOCKSETC" /* 47 */ + ,"spawn: realloc of ttydev failed" /* 48 */ + ,"luit: command-line malloc failed" /* 49 */ + ,"in_put: select() failed" /* 50 */ + ,0, 0, 0 + ,"VTInit: can't initialize window" /* 54 */ + ,0, 0 + ,"HandleKeymapChange: malloc failed" /* 57 */ + ,0, 0 + ,"Tinput: select() failed" /* 60 */ + ,0, 0, 0 + ,"TekInit: can't initialize window" /* 64 */ + ,0, 0, 0, 0, 0, 0 + ,"SaltTextAway: malloc() failed" /* 71 */ + ,0, 0, 0, 0, 0, 0, 0, 0 + ,"StartLog: exec() failed" /* 80 */ + ,0, 0 + ,"xerror: XError event" /* 83 */ + ,"xioerror: X I/O error" /* 84 */ + ,0, 0, 0, 0, 0 + ,"Alloc: calloc() failed on base" /* 90 */ + ,"Alloc: calloc() failed on rows" /* 91 */ + ,"ScreenResize: realloc() failed on alt base" /* 92 */ + ,0, 0, 0 + ,"ScreenResize: malloc() or realloc() failed" /* 96 */ + ,0, 0, 0, 0, 0 + ,"ScrnPointers: malloc/realloc() failed" /* 102 */ + ,0, 0, 0, 0, 0, 0, 0 + ,"ScrollBarOn: realloc() failed on base" /* 110 */ + ,"ScrollBarOn: realloc() failed on rows" /* 111 */ + ,0, 0, 0, 0, 0, 0, 0, 0, 0 + ,"my_memmove: malloc/realloc failed" /* 121 */ + }; + int oerrno; + + oerrno = errno; + fprintf(stderr, "%s: Error %d, errno %d: ", xterm_name, i, oerrno); + fprintf(stderr, "%s\n", SysErrorMsg(oerrno)); + if ((Cardinal) i < XtNumber(table) && table[i] != 0) { + fprintf(stderr, "Reason: %s\n", table[i]); + } + Cleanup(i); } static void -Sleep (int msec) +Sleep(int msec) { - static struct timeval select_timeout; + static struct timeval select_timeout; - select_timeout.tv_sec = 0; - select_timeout.tv_usec = msec * 1000; - select(0, 0, 0, 0, &select_timeout); + select_timeout.tv_sec = 0; + select_timeout.tv_usec = msec * 1000; + select(0, 0, 0, 0, &select_timeout); } /* * cleanup by sending SIGHUP to client processes */ void -Cleanup (int code) +Cleanup(int code) { - static Boolean cleaning; - register TScreen *screen; + static Boolean cleaning; + register TScreen *screen; - if (cleaning) { - hold_screen = 0; - return; - } - cleaning = TRUE; - - TRACE(("Cleanup %d\n", code)); + if (cleaning) { + hold_screen = 0; + return; + } + cleaning = TRUE; - screen = &term->screen; + TRACE(("Cleanup %d\n", code)); - if (hold_screen) { - hold_screen = 2; - while (hold_screen) { - xevents(); - Sleep(10); - } - } + screen = &term->screen; - if (screen->pid > 1) { - (void) kill_process_group (screen->pid, SIGHUP); + if (hold_screen) { + hold_screen = 2; + while (hold_screen) { + xevents(); + Sleep(10); } -#ifdef AMOEBA - if (!NULLPORT(&screen->proccap.cap_port)) - (void) pro_stun(&screen->proccap, -1L); - cb_close(screen->tty_outq); - cb_close(screen->tty_inq); + } +#if OPT_SESSION_MGT + if (resource.sessionMgt) { + XtVaSetValues(toplevel, + XtNjoinSession, False, + (XtPointer *) 0); + } #endif - Exit (code); + + if (screen->pid > 1) { + (void) kill_process_group(screen->pid, SIGHUP); + } + Exit(code); } /* @@ -2055,95 +2238,99 @@ * to have to do a realloc(). */ void -xtermSetenv (register char *var, register char *value) +xtermSetenv(register char *var, register char *value) { - register int envindex = 0; - register size_t len = strlen(var); + register int envindex = 0; + register size_t len = strlen(var); - TRACE(("xtermSetenv(var=%s, value=%s)\n", var, value)); + TRACE(("xtermSetenv(var=%s, value=%s)\n", var, value)); - while (environ [envindex] != NULL) { - if (strncmp (environ [envindex], var, len) == 0) { - /* found it */ - environ[envindex] = (char *)malloc ((unsigned)len + strlen (value) + 1); - strcpy (environ [envindex], var); - strcat (environ [envindex], value); - return; - } - envindex ++; + while (environ[envindex] != NULL) { + if (strncmp(environ[envindex], var, len) == 0) { + /* found it */ + environ[envindex] = (char *) malloc((unsigned) len + + strlen(value) + 1); + strcpy(environ[envindex], var); + strcat(environ[envindex], value); + return; } + envindex++; + } - TRACE(("...expanding env to %d\n", envindex+1)); + TRACE(("...expanding env to %d\n", envindex + 1)); - environ [envindex] = (char *) malloc ((unsigned)len + strlen (value) + 1); - (void) strcpy (environ [envindex], var); - strcat (environ [envindex], value); - environ [++envindex] = NULL; + environ[envindex] = (char *) malloc((unsigned) len + strlen(value) + 1); + (void) strcpy(environ[envindex], var); + strcat(environ[envindex], value); + environ[++envindex] = NULL; } /*ARGSUSED*/ int -xerror(Display *d, register XErrorEvent *ev) +xerror(Display * d, register XErrorEvent * ev) { - fprintf (stderr, "%s: warning, error event received:\n", xterm_name); - (void) XmuPrintDefaultErrorMessage (d, ev, stderr); - Exit (ERROR_XERROR); - return 0; /* appease the compiler */ + fprintf(stderr, "%s: warning, error event received:\n", xterm_name); + (void) XmuPrintDefaultErrorMessage(d, ev, stderr); + Exit(ERROR_XERROR); + return 0; /* appease the compiler */ } /*ARGSUSED*/ int -xioerror(Display *dpy) +xioerror(Display * dpy) { - (void) fprintf (stderr, - "%s: fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n", - xterm_name, errno, SysErrorMsg (errno), - DisplayString (dpy)); + (void) fprintf(stderr, + "%s: fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n", + xterm_name, errno, SysErrorMsg(errno), + DisplayString(dpy)); Exit(ERROR_XIOERROR); - return 0; /* appease the compiler */ + return 0; /* appease the compiler */ } -extern char *ProgramName; - -void xt_error(String message) +void +xt_error(String message) { - (void) fprintf (stderr, "%s Xt error: %s\n", ProgramName, message); + (void) fprintf(stderr, "%s Xt error: %s\n", ProgramName, message); exit(1); } int XStrCmp(char *s1, char *s2) { - if (s1 && s2) return(strcmp(s1, s2)); - if (s1 && *s1) return(1); - if (s2 && *s2) return(-1); - return(0); + if (s1 && s2) + return (strcmp(s1, s2)); + if (s1 && *s1) + return (1); + if (s2 && *s2) + return (-1); + return (0); } #if OPT_TEK4014 -static void withdraw_window (Display *dpy, Window w, int scr) +static void +withdraw_window(Display * dpy, Window w, int scr) { - TRACE(("withdraw_window %#lx\n", (long)w)); - (void) XmuUpdateMapHints (dpy, w, NULL); - XWithdrawWindow (dpy, w, scr); + TRACE(("withdraw_window %#lx\n", (long) w)); + (void) XmuUpdateMapHints(dpy, w, NULL); + XWithdrawWindow(dpy, w, scr); return; } #endif - -void set_vt_visibility (Boolean on) +void +set_vt_visibility(Boolean on) { register TScreen *screen = &term->screen; TRACE(("set_vt_visibility(%d)\n", on)); if (on) { if (!screen->Vshow && term) { - VTInit (); - XtMapWidget (XtParent(term)); + VTInit(); + XtMapWidget(XtParent(term)); #if OPT_TOOLBAR /* we need both of these during initialization */ - XtMapWidget (SHELL_OF(term)); + XtMapWidget(SHELL_OF(term)); #endif screen->Vshow = TRUE; } @@ -2151,9 +2338,9 @@ #if OPT_TEK4014 else { if (screen->Vshow && term) { - withdraw_window (XtDisplay (term), - XtWindow(SHELL_OF(term)), - XScreenNumberOfScreen(XtScreen(term))); + withdraw_window(XtDisplay(term), + XtWindow(SHELL_OF(term)), + XScreenNumberOfScreen(XtScreen(term))); screen->Vshow = FALSE; } } @@ -2167,9 +2354,8 @@ } #if OPT_TEK4014 -extern Atom wm_delete_window; /* for ICCCM delete window */ - -void set_tek_visibility (Boolean on) +void +set_tek_visibility(Boolean on) { register TScreen *screen = &term->screen; @@ -2177,21 +2363,21 @@ if (on) { if (!screen->Tshow && (tekWidget || TekInit())) { Widget tekParent = SHELL_OF(tekWidget); - XtRealizeWidget (tekParent); - XtMapWidget (tekParent); + XtRealizeWidget(tekParent); + XtMapWidget(tekParent); XtOverrideTranslations(tekParent, XtParseTranslationTable ("<Message>WM_PROTOCOLS: DeleteWindow()")); - (void) XSetWMProtocols (XtDisplay(tekParent), - XtWindow(tekParent), - &wm_delete_window, 1); + (void) XSetWMProtocols(XtDisplay(tekParent), + XtWindow(tekParent), + &wm_delete_window, 1); screen->Tshow = TRUE; } } else { if (screen->Tshow && tekWidget) { - withdraw_window (XtDisplay (tekWidget), - XtWindow(SHELL_OF(tekWidget)), - XScreenNumberOfScreen(XtScreen(tekWidget))); + withdraw_window(XtDisplay(tekWidget), + XtWindow(SHELL_OF(tekWidget)), + XScreenNumberOfScreen(XtScreen(tekWidget))); screen->Tshow = FALSE; } } @@ -2203,14 +2389,15 @@ return; } -void end_tek_mode (void) +void +end_tek_mode(void) { register TScreen *screen = &term->screen; if (screen->TekEmu) { #ifdef ALLOWLOGGING if (screen->logging) { - FlushLog (screen); + FlushLog(screen); screen->logstart = DecodedData(&VTbuffer); } #endif @@ -2219,13 +2406,14 @@ return; } -void end_vt_mode (void) +void +end_vt_mode(void) { register TScreen *screen = &term->screen; if (!screen->TekEmu) { #ifdef ALLOWLOGGING - if(screen->logging && TekPtyData()) { + if (screen->logging && TekPtyData()) { FlushLog(screen); screen->logstart = DecodedData(Tbuffer); } @@ -2236,30 +2424,163 @@ return; } -void switch_modes (Bool tovt) /* if true, then become vt mode */ +void +switch_modes(Bool tovt) /* if true, then become vt mode */ { if (tovt) { - if (TekRefresh) dorefresh(); - end_tek_mode (); /* WARNING: this does a longjmp... */ + if (TekRefresh) + dorefresh(); + end_tek_mode(); /* WARNING: this does a longjmp... */ } else { - end_vt_mode (); /* WARNING: this does a longjmp... */ + end_vt_mode(); /* WARNING: this does a longjmp... */ } } -void hide_vt_window (void) +void +hide_vt_window(void) { register TScreen *screen = &term->screen; - set_vt_visibility (FALSE); - if (!screen->TekEmu) switch_modes (False); /* switch to tek mode */ + set_vt_visibility(FALSE); + if (!screen->TekEmu) + switch_modes(False); /* switch to tek mode */ } -void hide_tek_window (void) +void +hide_tek_window(void) { register TScreen *screen = &term->screen; - set_tek_visibility (FALSE); - TekRefresh = (TekLink *)0; - if (screen->TekEmu) switch_modes (True); /* does longjmp to vt mode */ + set_tek_visibility(FALSE); + TekRefresh = (TekLink *) 0; + if (screen->TekEmu) + switch_modes(True); /* does longjmp to vt mode */ } #endif /* OPT_TEK4014 */ + +static const char * +skip_punct(const char *s) +{ + while (*s == '-' || *s == '/' || *s == '+' || *s == '#' || *s == '%') { + ++s; + } + return s; +} + +static int +cmp_options(const void *a, const void *b) +{ + return strcmp(skip_punct(((const OptionHelp *) a)->opt), + skip_punct(((const OptionHelp *) b)->opt)); +} + +static int +cmp_resources(const void *a, const void *b) +{ + return strcmp(((const XrmOptionDescRec *) a)->option, + ((const XrmOptionDescRec *) b)->option); +} + +XrmOptionDescRec * +sortedOptDescs(XrmOptionDescRec * descs, Cardinal res_count) +{ + static XrmOptionDescRec *res_array = 0; + + if (res_array == 0) { + Cardinal j; + + /* make a sorted index to 'resources' */ + res_array = (XrmOptionDescRec *) calloc(res_count, sizeof(*res_array)); + for (j = 0; j < res_count; j++) + res_array[j] = descs[j]; + qsort(res_array, res_count, sizeof(*res_array), cmp_resources); + } + return res_array; +} + +/* + * The first time this is called, construct sorted index to the main program's + * list of options, taking into account the on/off options which will be + * compressed into one token. It's a lot simpler to do it this way than + * maintain the list in sorted form with lots of ifdef's. + */ +OptionHelp * +sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs) +{ + static OptionHelp *opt_array = 0; + + if (opt_array == 0) { + Cardinal opt_count, j, k; +#if OPT_TRACE + XrmOptionDescRec *res_array = sortedOptDescs(descs, numDescs); + int code; + char *mesg; +#else + (void) k; + (void) descs; + (void) numDescs; +#endif + + /* count 'options' and make a sorted index to it */ + for (opt_count = 0; options[opt_count].opt != 0; ++opt_count) { + ; + } + opt_array = (OptionHelp *) calloc(opt_count + 1, sizeof(OptionHelp)); + for (j = 0; j < opt_count; j++) + opt_array[j] = options[j]; + qsort(opt_array, opt_count, sizeof(OptionHelp), cmp_options); + + /* supply the "turn on/off" strings if needed */ +#if OPT_TRACE + for (j = 0; j < opt_count; j++) { + if (!strncmp(opt_array[j].opt, "-/+", 3)) { + char *name = opt_array[j].opt + 3; + for (k = 0; k < numDescs; ++k) { + char *value = res_array[k].value; + if (res_array[k].option[0] == '-') { + code = -1; + } else if (res_array[k].option[0] == '+') { + code = 1; + } else { + code = 0; + } + if (x_strindex(opt_array[j].desc, "inhibit") != 0) + code = -code; + if (code != 0 + && res_array[k].value != 0 + && !strcmp(name, res_array[k].option + 1)) { + if (((code < 0) && !strcmp(value, "on")) + || ((code > 0) && !strcmp(value, "off")) + || ((code > 0) && !strcmp(value, "0"))) { + mesg = "turn on/off"; + } else { + mesg = "turn off/on"; + } + if (strncmp(mesg, opt_array[j].desc, strlen(mesg))) { + if (strncmp(opt_array[j].desc, "turn ", 5)) { + char *s = malloc(strlen(mesg) + + 2 + + strlen(opt_array[j].desc)); + if (s != 0) { + sprintf(s, "%s %s", mesg, opt_array[j].desc); + opt_array[j].desc = s; + } + } else { + TRACE(("OOPS ")); + } + } + TRACE(("%s: %s %s: %s (%s)\n", + mesg, + res_array[k].option, + res_array[k].value, + opt_array[j].opt, + opt_array[j].desc)); + break; + } + } + } + } +#endif + } + return opt_array; +} Index: xc/programs/xterm/os2main.c diff -u xc/programs/xterm/os2main.c:3.49 xc/programs/xterm/os2main.c:3.57 --- xc/programs/xterm/os2main.c:3.49 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/os2main.c Fri Dec 27 16:05:22 2002 @@ -3,13 +3,12 @@ */ #ifndef lint -static char *rid="$XConsortium: main.c,v 1.227.1.2 95/06/29 18:13:15 kaleb Exp $"; +static char *rid = "$XConsortium: main.c,v 1.227.1.2 95/06/29 18:13:15 kaleb Exp $"; #endif /* lint */ -/* $XFree86: xc/programs/xterm/os2main.c,v 3.49 2002/01/05 22:05:03 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/os2main.c,v 3.57 2002/12/27 21:05:22 dickey Exp $ */ /*********************************************************** - Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy @@ -33,7 +32,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. - Copyright 1987, 1988 by Digital Equipment Corporation, Maynard. All Rights Reserved @@ -55,31 +53,35 @@ SOFTWARE. ******************************************************************/ - -/* main.c */ - -#ifdef __EMX__ +/* os2main.c */ #define INCL_DOSFILEMGR #define INCL_DOSDEVIOCTL #define INCL_DOSSEMAPHORES +#define I_NEED_OS2_H #include <os2.h> -#endif +#define XTERM_MAIN #include <version.h> #include <xterm.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> #include <X11/cursorfont.h> #ifdef I18N #include <X11/Xlocale.h> #endif #if OPT_TOOLBAR + +#if defined(HAVE_LIB_XAW) #include <X11/Xaw/Form.h> +#elif defined(HAVE_LIB_XAW3D) +#include <X11/Xaw3d/Form.h> +#elif defined(HAVE_LIB_NEXTAW) +#include <X11/neXtaw/Form.h> #endif +#endif /* OPT_TOOLBAR */ + #include <pwd.h> #include <ctype.h> @@ -90,23 +92,54 @@ #include <xstrings.h> #include <xterm_io.h> -int setpgrp(pid_t pid ,gid_t pgid) {} -int chown(const char* fn, pid_t pid, gid_t gid) {} -char *ttyname(int fd) { return "/dev/tty"; } +#if OPT_WIDE_CHARS +#include <charclass.h> +#include <wcwidth.h> +#endif +int +setpgrp(pid_t pid, gid_t pgid) +{ + return 0; +} + +int +chown(const char *fn, pid_t pid, gid_t gid) +{ + return 0; +} + +char * +ttyname(int fd) +{ + return "/dev/tty"; +} + #include <sys/stat.h> -#include <sys/param.h> /* for NOFILE */ +#include <sys/param.h> /* for NOFILE */ #include <stdio.h> #include <signal.h> -static SIGNAL_T reapchild (int n); -static int spawn (void); -static void get_terminal (void); -static void resize (TScreen *s, char *oldtc, char *newtc); +static SIGNAL_T reapchild(int n); +static int spawn(void); +static void get_terminal(void); +static void resize(TScreen * s, char *oldtc, char *newtc); +static void set_owner(char *device, int uid, int gid, int mode); static Bool added_utmp_entry = False; -static char **command_to_exec; +/* +** Ordinarily it should be okay to omit the assignment in the following +** statement. Apparently the c89 compiler on AIX 4.1.3 has a bug, or does +** it? Without the assignment though the compiler will init command_to_exec +** to 0xffffffff instead of NULL; and subsequent usage, e.g. in spawn() to +** SEGV. +*/ +static char **command_to_exec = NULL; + +#if OPT_LUIT_PROG +static char **command_to_exec_with_luit = NULL; +#endif /* The following structures are initialized in main() in order ** to eliminate any assumptions about the internal order of their @@ -118,38 +151,38 @@ #ifndef CEOF #define CEOF CONTROL('D') #endif -#ifndef CSUSP -#define CSUSP CONTROL('Z') -#endif -#ifndef CQUIT -#define CQUIT CONTROL('\\') -#endif #ifndef CEOL #define CEOL 0 -#endif -#ifndef CNUL -#define CNUL 0 #endif -#ifndef CSWTCH -#define CSWTCH 0 +#ifndef CFLUSH +#define CFLUSH CONTROL('O') #endif #ifndef CLNEXT #define CLNEXT CONTROL('V') #endif -#ifndef CWERASE -#define CWERASE CONTROL('W') +#ifndef CNUL +#define CNUL 0 #endif +#ifndef CQUIT +#define CQUIT CONTROL('\\') +#endif #ifndef CRPRNT #define CRPRNT CONTROL('R') #endif -#ifndef CFLUSH -#define CFLUSH CONTROL('O') +#ifndef CSTART +#define CSTART CONTROL('Q') #endif #ifndef CSTOP #define CSTOP CONTROL('S') #endif -#ifndef CSTART -#define CSTART CONTROL('Q') +#ifndef CSUSP +#define CSUSP CONTROL('Z') +#endif +#ifndef CSWTCH +#define CSWTCH 0 +#endif +#ifndef CWERASE +#define CWERASE CONTROL('W') #endif /* @@ -157,57 +190,54 @@ * SVR4 has only termio.c_cc, but it includes everything from ltchars. */ static int override_tty_modes = 0; +/* *INDENT-OFF* */ struct _xttymodes { char *name; size_t len; int set; char value; } ttymodelist[] = { -{ "intr", 4, 0, '\0' }, /* tchars.t_intrc ; VINTR */ + { "intr", 4, 0, '\0' }, /* tchars.t_intrc ; VINTR */ #define XTTYMODE_intr 0 -{ "quit", 4, 0, '\0' }, /* tchars.t_quitc ; VQUIT */ + { "quit", 4, 0, '\0' }, /* tchars.t_quitc ; VQUIT */ #define XTTYMODE_quit 1 -{ "erase", 5, 0, '\0' }, /* sgttyb.sg_erase ; VERASE */ + { "erase", 5, 0, '\0' }, /* sgttyb.sg_erase ; VERASE */ #define XTTYMODE_erase 2 -{ "kill", 4, 0, '\0' }, /* sgttyb.sg_kill ; VKILL */ + { "kill", 4, 0, '\0' }, /* sgttyb.sg_kill ; VKILL */ #define XTTYMODE_kill 3 -{ "eof", 3, 0, '\0' }, /* tchars.t_eofc ; VEOF */ + { "eof", 3, 0, '\0' }, /* tchars.t_eofc ; VEOF */ #define XTTYMODE_eof 4 -{ "eol", 3, 0, '\0' }, /* VEOL */ + { "eol", 3, 0, '\0' }, /* VEOL */ #define XTTYMODE_eol 5 -{ "swtch", 5, 0, '\0' }, /* VSWTCH */ + { "swtch", 5, 0, '\0' }, /* VSWTCH */ #define XTTYMODE_swtch 6 -{ "start", 5, 0, '\0' }, /* tchars.t_startc */ + { "start", 5, 0, '\0' }, /* tchars.t_startc */ #define XTTYMODE_start 7 -{ "stop", 4, 0, '\0' }, /* tchars.t_stopc */ + { "stop", 4, 0, '\0' }, /* tchars.t_stopc */ #define XTTYMODE_stop 8 -{ "brk", 3, 0, '\0' }, /* tchars.t_brkc */ + { "brk", 3, 0, '\0' }, /* tchars.t_brkc */ #define XTTYMODE_brk 9 -{ "susp", 4, 0, '\0' }, /* ltchars.t_suspc ; VSUSP */ + { "susp", 4, 0, '\0' }, /* ltchars.t_suspc ; VSUSP */ #define XTTYMODE_susp 10 -{ "dsusp", 5, 0, '\0' }, /* ltchars.t_dsuspc ; VDSUSP */ + { "dsusp", 5, 0, '\0' }, /* ltchars.t_dsuspc ; VDSUSP */ #define XTTYMODE_dsusp 11 -{ "rprnt", 5, 0, '\0' }, /* ltchars.t_rprntc ; VREPRINT */ + { "rprnt", 5, 0, '\0' }, /* ltchars.t_rprntc ; VREPRINT */ #define XTTYMODE_rprnt 12 -{ "flush", 5, 0, '\0' }, /* ltchars.t_flushc ; VDISCARD */ + { "flush", 5, 0, '\0' }, /* ltchars.t_flushc ; VDISCARD */ #define XTTYMODE_flush 13 -{ "weras", 5, 0, '\0' }, /* ltchars.t_werasc ; VWERASE */ + { "weras", 5, 0, '\0' }, /* ltchars.t_werasc ; VWERASE */ #define XTTYMODE_weras 14 -{ "lnext", 5, 0, '\0' }, /* ltchars.t_lnextc ; VLNEXT */ + { "lnext", 5, 0, '\0' }, /* ltchars.t_lnextc ; VLNEXT */ #define XTTYMODE_lnext 15 -{ NULL, 0, 0, '\0' }, /* end of data */ + { NULL, 0, 0, '\0' }, /* end of data */ }; +/* *INDENT-ON* */ -static int parse_tty_modes (char *s, struct _xttymodes *modelist); +static int parse_tty_modes(char *s, struct _xttymodes *modelist); static int inhibit; static char passedPty[2]; /* name if pty if slave */ - -#ifdef __EMX__ -#define TIOCCONS 108 -#endif - static int Console; #include <X11/Xmu/SysUtil.h> /* XmuGetHostname */ #define MIT_CONSOLE_LEN 12 @@ -218,88 +248,61 @@ static int tslot; static jmp_buf env; -char *ProgramName; - -static struct _resource { - char *xterm_name; - char *icon_geometry; - char *title; - char *icon_name; - char *term_name; - char *tty_modes; - Boolean hold_screen; /* true if we keep window open */ - Boolean utmpInhibit; - Boolean messages; - Boolean sunFunctionKeys; /* %%% should be widget resource? */ -#if OPT_SUNPC_KBD - Boolean sunKeyboard; -#endif -#if OPT_HP_FUNC_KEYS - Boolean hpFunctionKeys; -#endif - Boolean wait_for_map; - Boolean useInsertMode; -#if OPT_ZICONBEEP - int zIconBeep; /* beep level when output while iconified */ -#endif -#if OPT_SAME_NAME - Boolean sameName; /* Don't change the title or icon name if it is - * the same. This prevents flicker on the - * screen at the cost of an extra request to - * the server. - */ -#endif -} resource; - /* used by VT (charproc.c) */ -#define offset(field) XtOffsetOf(struct _resource, field) +#define offset(field) XtOffsetOf(XTERM_RESOURCE, field) -static XtResource application_resources[] = { +static XtResource application_resources[] = +{ {"name", "Name", XtRString, sizeof(char *), - offset(xterm_name), XtRString, DFT_TERMTYPE}, + offset(xterm_name), XtRString, DFT_TERMTYPE}, {"iconGeometry", "IconGeometry", XtRString, sizeof(char *), - offset(icon_geometry), XtRString, (caddr_t) NULL}, + offset(icon_geometry), XtRString, (caddr_t) NULL}, {XtNtitle, XtCTitle, XtRString, sizeof(char *), - offset(title), XtRString, (caddr_t) NULL}, + offset(title), XtRString, (caddr_t) NULL}, {XtNiconName, XtCIconName, XtRString, sizeof(char *), - offset(icon_name), XtRString, (caddr_t) NULL}, + offset(icon_name), XtRString, (caddr_t) NULL}, {"termName", "TermName", XtRString, sizeof(char *), - offset(term_name), XtRString, (caddr_t) NULL}, + offset(term_name), XtRString, (caddr_t) NULL}, {"ttyModes", "TtyModes", XtRString, sizeof(char *), - offset(tty_modes), XtRString, (caddr_t) NULL}, - {"hold", "Hold", XtRBoolean, sizeof (Boolean), - offset(hold_screen), XtRString, "false"}, - {"utmpInhibit", "UtmpInhibit", XtRBoolean, sizeof (Boolean), - offset(utmpInhibit), XtRString, "false"}, - {"messages", "Messages", XtRBoolean, sizeof (Boolean), - offset(messages), XtRString, "true"}, - {"sunFunctionKeys", "SunFunctionKeys", XtRBoolean, sizeof (Boolean), - offset(sunFunctionKeys), XtRString, "false"}, + offset(tty_modes), XtRString, (caddr_t) NULL}, + {"hold", "Hold", XtRBoolean, sizeof(Boolean), + offset(hold_screen), XtRString, "false"}, + {"utmpInhibit", "UtmpInhibit", XtRBoolean, sizeof(Boolean), + offset(utmpInhibit), XtRString, "false"}, + {"messages", "Messages", XtRBoolean, sizeof(Boolean), + offset(messages), XtRString, "true"}, + {"sunFunctionKeys", "SunFunctionKeys", XtRBoolean, sizeof(Boolean), + offset(sunFunctionKeys), XtRString, "false"}, #if OPT_SUNPC_KBD - {"sunKeyboard", "SunKeyboard", XtRBoolean, sizeof (Boolean), - offset(sunKeyboard), XtRString, "false"}, + {"sunKeyboard", "SunKeyboard", XtRBoolean, sizeof(Boolean), + offset(sunKeyboard), XtRString, "false"}, #endif #if OPT_HP_FUNC_KEYS - {"hpFunctionKeys", "HpFunctionKeys", XtRBoolean, sizeof (Boolean), - offset(hpFunctionKeys), XtRString, "false"}, + {"hpFunctionKeys", "HpFunctionKeys", XtRBoolean, sizeof(Boolean), + offset(hpFunctionKeys), XtRString, "false"}, #endif - {"waitForMap", "WaitForMap", XtRBoolean, sizeof (Boolean), - offset(wait_for_map), XtRString, "false"}, - {"useInsertMode", "UseInsertMode", XtRBoolean, sizeof (Boolean), - offset(useInsertMode), XtRString, "false"}, + {"waitForMap", "WaitForMap", XtRBoolean, sizeof(Boolean), + offset(wait_for_map), XtRString, "false"}, + {"useInsertMode", "UseInsertMode", XtRBoolean, sizeof(Boolean), + offset(useInsertMode), XtRString, "false"}, #if OPT_ZICONBEEP - {"zIconBeep", "ZIconBeep", XtRInt, sizeof (int), - offset(zIconBeep), XtRImmediate, 0}, + {"zIconBeep", "ZIconBeep", XtRInt, sizeof(int), + offset(zIconBeep), XtRImmediate, 0}, #endif #if OPT_SAME_NAME - {"sameName", "SameName", XtRBoolean, sizeof (Boolean), - offset(sameName), XtRString, "true"}, + {"sameName", "SameName", XtRBoolean, sizeof(Boolean), + offset(sameName), XtRString, "true"}, +#endif +#if OPT_SESSION_MGT + {"sessionMgt", "SessionMgt", XtRBoolean, sizeof(Boolean), + offset(sessionMgt), XtRString, "true"}, #endif }; #undef offset -static char *fallback_resources[] = { +static char *fallback_resources[] = +{ "*SimpleMenu*menuLabel.vertSpace: 100", "*SimpleMenu*HorizontalMargins: 16", "*SimpleMenu*Sme.height: 16", @@ -315,7 +318,7 @@ /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XrmParseCommand is let loose. */ - +/* *INDENT-OFF* */ static XrmOptionDescRec optionDescList[] = { {"-geometry", "*vt100.geometry",XrmoptionSepArg, (caddr_t) NULL}, {"-132", "*c132", XrmoptionNoArg, (caddr_t) "on"}, @@ -423,6 +426,12 @@ {"-u8", "*utf8", XrmoptionNoArg, (caddr_t) "2"}, {"+u8", "*utf8", XrmoptionNoArg, (caddr_t) "0"}, #endif +#if OPT_LUIT_PROG +{"-lc", "*locale", XrmoptionNoArg, (caddr_t) "True"}, +{"+lc", "*locale", XrmoptionNoArg, (caddr_t) "False"}, +{"-lcc", "*localeFilter",XrmoptionSepArg, (caddr_t) NULL}, +{"-en", "*locale", XrmoptionSepArg, (caddr_t) NULL}, +#endif {"-ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "off"}, {"+ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "on"}, {"-ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "on"}, @@ -436,23 +445,30 @@ #if OPT_WIDE_CHARS {"-wc", "*wideChars", XrmoptionNoArg, (caddr_t) "on"}, {"+wc", "*wideChars", XrmoptionNoArg, (caddr_t) "off"}, +{"-cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "on"}, +{"+cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "off"}, #endif {"-wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "on"}, {"+wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "off"}, #if OPT_ZICONBEEP -{"-ziconbeep", "*zIconBeep", XrmoptionSepArg, (caddr_t) NULL}, +{"-ziconbeep", "*zIconBeep", XrmoptionSepArg, (caddr_t) NULL}, #endif #if OPT_SAME_NAME {"-samename", "*sameName", XrmoptionNoArg, (caddr_t) "on"}, {"+samename", "*sameName", XrmoptionNoArg, (caddr_t) "off"}, #endif +#if OPT_SESSION_MGT +{"-sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "on"}, +{"+sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "off"}, +#endif /* options that we process ourselves */ {"-help", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, {"-version", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, {"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, {"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, +{"-into", NULL, XrmoptionSkipArg, (caddr_t) NULL}, /* bogus old compatibility stuff for which there are - standard XtAppInitialize options now */ + standard XtOpenApplication options now */ {"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, {"#", ".iconGeometry",XrmoptionStickyArg, (caddr_t) NULL}, {"-T", ".title", XrmoptionSepArg, (caddr_t) NULL}, @@ -464,7 +480,7 @@ {"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, }; -static OptionHelp options[] = { +static OptionHelp xtermOptions[] = { { "-version", "print the version number" }, { "-help", "print out this message" }, { "-display displayname", "X server to contact" }, @@ -476,7 +492,7 @@ { "-bw number", "border width in pixels" }, { "-fn fontname", "normal text font" }, { "-fb fontname", "bold text font" }, -{ "-/+fbb", "turn on/off bold font's box checking"}, +{ "-/+fbb", "turn on/off normal/bold font comparison inhibit"}, { "-/+fbx", "turn off/on linedrawing characters"}, #ifdef XRENDERFONT { "-fa pattern", "FreeType font-selection pattern" }, @@ -491,10 +507,10 @@ { "-class string", "class string (XTerm)" }, { "-title string", "title string" }, { "-xrm resourcestring", "additional resource specifications" }, -{ "-/+132", "turn on/off column switch inhibiting" }, +{ "-/+132", "turn on/off 80/132 column switching" }, { "-/+ah", "turn on/off always highlight" }, #ifndef NO_ACTIVE_ICON -{ "-/+ai", "turn on/off active icon" }, +{ "-/+ai", "turn off/on active icon" }, { "-fi fontname", "icon font for active icon" }, #endif /* NO_ACTIVE_ICON */ { "-b number", "internal border in pixels" }, @@ -510,7 +526,7 @@ { "-/+cu", "turn on/off curses emulation" }, { "-/+dc", "turn off/on dynamic color selection" }, #if OPT_HIGHLIGHT_COLOR -{ "-hc", "selection background color" }, +{ "-hc color", "selection background color" }, #endif #if OPT_HP_FUNC_KEYS { "-/+hf", "turn on/off HP Function Key escape codes" }, @@ -531,7 +547,7 @@ { "-/+mesg", "forbid/allow messages" }, { "-ms color", "pointer color" }, { "-nb number", "margin bell in characters from right end" }, -{ "-/+nul", "turn on/off display of underlining" }, +{ "-/+nul", "turn off/on display of underlining" }, { "-/+aw", "turn on/off auto wraparound" }, { "-/+pc", "turn on/off PC-style bold colors" }, { "-/+rw", "turn on/off reverse wraparound" }, @@ -558,12 +574,17 @@ #if OPT_WIDE_CHARS { "-/+u8", "turn on/off UTF-8 mode (implies wide-characters)" }, #endif +#if OPT_LUIT_PROG +{ "-/+lc", "turn on/off locale mode using luit" }, +{ "-lcc path", "filename of locale converter (" DEFLOCALEFILTER ")" }, +#endif { "-/+ulc", "turn off/on display of underline as color" }, { "-/+ut", "turn on/off utmp inhibit (not supported)" }, { "-/+vb", "turn on/off visual bell" }, { "-/+pob", "turn on/off pop on bell" }, #if OPT_WIDE_CHARS { "-/+wc", "turn on/off wide-character mode" }, +{ "-/+cjk_width", "turn on/off legacy CJK width convention" }, #endif { "-/+wf", "turn on/off wait for map before command exec" }, { "-e command args ...", "command to execute" }, @@ -575,13 +596,18 @@ { "-n string", "icon name for window" }, { "-C", "intercept console messages" }, { "-Sccn", "slave mode on \"ttycc\", file descriptor \"n\"" }, +{ "-into windowId", "use the window id given to -into as the parent window rather than the default root window" }, #if OPT_ZICONBEEP { "-ziconbeep percent", "beep and flag icon of window having hidden output" }, #endif #if OPT_SAME_NAME { "-/+samename", "turn on/off the no-flicker option for title and icon name" }, #endif +#if OPT_SESSION_MGT +{ "-/+sm", "turn on/off the session-management support" }, +#endif { NULL, NULL }}; +/* *INDENT-ON* */ /*debug FILE *confd;*/ /*static void opencons() @@ -598,29 +624,94 @@ fclose(confd); } */ -static char *message[] = { -"Fonts should be fixed width and, if both normal and bold are specified, should", -"have the same size. If only a normal font is specified, it will be used for", -"both normal and bold text (by doing overstriking). The -e option, if given,", -"must appear at the end of the command line, otherwise the user's default shell", -"will be started. Options that start with a plus sign (+) restore the default.", -NULL}; +static char *message[] = +{ + "Fonts should be fixed width and, if both normal and bold are specified, should", + "have the same size. If only a normal font is specified, it will be used for", + "both normal and bold text (by doing overstriking). The -e option, if given,", + "must appear at the end of the command line, otherwise the user's default shell", + "will be started. Options that start with a plus sign (+) restore the default.", + NULL}; + +/* + * Decode a key-definition. This combines the termcap and ttyModes, for + * comparison. Note that octal escapes in ttyModes are done by the normal + * resource translation. Also, ttyModes allows '^-' as a synonym for disabled. + */ +static int +decode_keyvalue(char **ptr, int termcap) +{ + char *string = *ptr; + int value = -1; -static Boolean get_termcap(char *name, char *buffer, char *resized) + TRACE(("...decode '%s'\n", string)); + if (*string == '^') { + switch (*++string) { + case '?': + value = A2E(127); + break; + case '-': + if (!termcap) { + errno = 0; +#if defined(_POSIX_VDISABLE) && defined(HAVE_UNISTD_H) + value = _POSIX_VDISABLE; +#endif +#if defined(_PC_VDISABLE) + if (value == -1) { + value = fpathconf(0, _PC_VDISABLE); + if (value == -1) { + if (errno != 0) + break; /* skip this (error) */ + value = 0377; + } + } +#elif defined(VDISABLE) + if (value == -1) + value = VDISABLE; +#endif + break; + } + /* FALLTHRU */ + default: + value = CONTROL(*string); + break; + } + ++string; + } else if (termcap && (*string == '\\')) { + char *d; + int temp = strtol(string + 1, &d, 8); + if (temp > 0 && d != string) { + value = temp; + string = d; + } + } else { + value = CharOf(*string); + ++string; + } + *ptr = string; + return value; +} + +/* + * If we're linked to terminfo, tgetent() will return an empty buffer. We + * cannot use that to adjust the $TERMCAP variable. + */ +static Boolean +get_termcap(char *name, char *buffer, char *resized) { register TScreen *screen = &term->screen; - *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ + *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ if (name != 0) { - if (tgetent (buffer, name) == 1) { + if (tgetent(buffer, name) == 1) { TRACE(("get_termcap(%s) succeeded (%s)\n", name, - *buffer - ? "ok:termcap, we can update $TERMCAP" - : "assuming this is terminfo")); + (*buffer + ? "ok:termcap, we can update $TERMCAP" + : "assuming this is terminfo"))); if (*buffer) { if (!TEK4014_ACTIVE(screen)) { - resize (screen, buffer, resized); + resize(screen, buffer, resized); } } return True; @@ -631,579 +722,588 @@ return False; } -static int abbrev (char *tst, char *cmp, size_t need) +static int +abbrev(char *tst, char *cmp, size_t need) { - size_t len = strlen(tst); - return ((len >= need) && (!strncmp(tst, cmp, len))); + size_t len = strlen(tst); + return ((len >= need) && (!strncmp(tst, cmp, len))); } -static void Syntax (char *badOption) +static void +Syntax(char *badOption) { OptionHelp *opt; + OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList)); int col; - fprintf (stderr, "%s: bad command line option \"%s\"\r\n\n", - ProgramName, badOption); + fprintf(stderr, "%s: bad command line option \"%s\"\r\n\n", + ProgramName, badOption); - fprintf (stderr, "usage: %s", ProgramName); + fprintf(stderr, "usage: %s", ProgramName); col = 8 + strlen(ProgramName); - for (opt = options; opt->opt; opt++) { - int len = 3 + strlen(opt->opt); /* space [ string ] */ + for (opt = list; opt->opt; opt++) { + int len = 3 + strlen(opt->opt); /* space [ string ] */ if (col + len > 79) { - fprintf (stderr, "\r\n "); /* 3 spaces */ + fprintf(stderr, "\r\n "); /* 3 spaces */ col = 3; } - fprintf (stderr, " [%s]", opt->opt); + fprintf(stderr, " [%s]", opt->opt); col += len; } - fprintf (stderr, "\r\n\nType %s -help for a full description.\r\n\n", - ProgramName); - exit (1); + fprintf(stderr, "\r\n\nType %s -help for a full description.\r\n\n", + ProgramName); + exit(1); } -static void Version (void) +static void +Version(void) { printf("%s(%d)\n", XFREE86_VERSION, XTERM_PATCH); fflush(stdout); } -static void Help (void) +static void +Help(void) { OptionHelp *opt; + OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList)); char **cpp; - fprintf (stderr, "%s(%d) usage:\n %s [-options ...] [-e command args]\n\n", - XFREE86_VERSION, XTERM_PATCH, ProgramName); - fprintf (stderr, "where options include:\n"); - for (opt = options; opt->opt; opt++) { - fprintf (stderr, " %-28s %s\n", opt->opt, opt->desc); + fprintf(stderr, + "%s(%d) usage:\n %s [-options ...] [-e command args]\n\n", + XFREE86_VERSION, XTERM_PATCH, ProgramName); + fprintf(stderr, "where options include:\n"); + for (opt = list; opt->opt; opt++) { + fprintf(stderr, " %-28s %s\n", opt->opt, opt->desc); } - putc ('\n', stderr); + putc('\n', stderr); for (cpp = message; *cpp; cpp++) { - fputs (*cpp, stderr); - putc ('\n', stderr); + fputs(*cpp, stderr); + putc('\n', stderr); } - putc ('\n', stderr); + putc('\n', stderr); fflush(stderr); } /* ARGSUSED */ static Boolean -ConvertConsoleSelection( - Widget w GCC_UNUSED, - Atom *selection GCC_UNUSED, - Atom *target GCC_UNUSED, - Atom *type GCC_UNUSED, - XtPointer *value GCC_UNUSED, - unsigned long *length GCC_UNUSED, - int *format GCC_UNUSED) +ConvertConsoleSelection(Widget w GCC_UNUSED, + Atom * selection GCC_UNUSED, + Atom * target GCC_UNUSED, + Atom * type GCC_UNUSED, + XtPointer * value GCC_UNUSED, + unsigned long *length GCC_UNUSED, + int *format GCC_UNUSED) { /* we don't save console output, so can't offer it */ return False; } -Arg ourTopLevelShellArgs[] = { - { XtNallowShellResize, (XtArgVal) TRUE }, - { XtNinput, (XtArgVal) TRUE }, -}; -int number_ourTopLevelShellArgs = 2; +#if OPT_SESSION_MGT +static void +die_callback(Widget w GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + XtPointer call_data GCC_UNUSED) +{ + Cleanup(0); +} + +static void +save_callback(Widget w GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + XtPointer call_data) +{ + XtCheckpointToken token = (XtCheckpointToken) call_data; + /* we have nothing to save */ + token->save_success = True; +} +#endif /* OPT_SESSION_MGT */ -Bool waiting_for_initial_map; +#if OPT_WIDE_CHARS +int (*my_wcwidth) (wchar_t); +#endif /* * DeleteWindow(): Action proc to implement ICCCM delete_window. */ /* ARGSUSED */ static void -DeleteWindow( - Widget w, - XEvent *event GCC_UNUSED, - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +DeleteWindow(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { #if OPT_TEK4014 - if (w == toplevel) { - if (term->screen.Tshow) - hide_vt_window(); - else - do_hangup(w, (XtPointer)0, (XtPointer)0); - } else - if (term->screen.Vshow) - hide_tek_window(); + if (w == toplevel) { + if (term->screen.Tshow) + hide_vt_window(); + else + do_hangup(w, (XtPointer) 0, (XtPointer) 0); + } else if (term->screen.Vshow) + hide_tek_window(); else #endif - do_hangup(w, (XtPointer)0, (XtPointer)0); + do_hangup(w, (XtPointer) 0, (XtPointer) 0); } /* ARGSUSED */ static void -KeyboardMapping( - Widget w GCC_UNUSED, - XEvent *event, - String *params GCC_UNUSED, - Cardinal *num_params GCC_UNUSED) +KeyboardMapping(Widget w GCC_UNUSED, + XEvent * event, + String * params GCC_UNUSED, + Cardinal * num_params GCC_UNUSED) { switch (event->type) { - case MappingNotify: - XRefreshKeyboardMapping(&event->xmapping); - break; + case MappingNotify: + XRefreshKeyboardMapping(&event->xmapping); + break; } } - -XtActionsRec actionProcs[] = { - { "DeleteWindow", DeleteWindow }, - { "KeyboardMapping", KeyboardMapping }, -}; - -Atom wm_delete_window; - -#ifdef __EMX__ -int ptioctl(int fd, int func, void* data) +XtActionsRec actionProcs[] = { - APIRET rc; - ULONG len; - struct pt_termios pt; - struct termio *t; - int i; - - switch (func) { - case TCGETA: - rc = DosDevIOCtl(fd,XFREE86_PTY, func, - NULL, 0, NULL, - (ULONG*)&pt, sizeof(struct pt_termios), &len); - if (rc) return -1; - t = (struct termio*)data; - t->c_iflag = pt.c_iflag; - t->c_oflag = pt.c_oflag; - t->c_cflag = pt.c_cflag; - t->c_lflag = pt.c_lflag; - for (i=0; i<NCC; i++) - t->c_cc[i] = pt.c_cc[i]; - return 0; - case TCSETA: - case TCSETAW: - case TCSETAF: - t = (struct termio*)data; - pt.c_iflag = t->c_iflag; - pt.c_oflag = t->c_oflag; - pt.c_cflag = t->c_cflag; - pt.c_lflag = t->c_lflag; - - for (i=0; i<NCC; i++) - pt.c_cc[i] = t->c_cc[i]; - if (func==TCSETA) - i = XTY_TIOCSETA; - else if (func==TCSETAW) - i = XTY_TIOCSETAW; - else - i = XTY_TIOCSETAF; - rc = DosDevIOCtl(fd,XFREE86_PTY, i, - (ULONG*)&pt, sizeof(struct pt_termios), &len, - NULL, 0, NULL); - return (rc) ? -1 : 0; - case TIOCCONS: - return DosDevIOCtl(fd,XFREE86_PTY, XTY_TIOCCONS, - (ULONG*)data, sizeof(ULONG), &len, - NULL, 0, NULL); - case TIOCSWINSZ: - return DosDevIOCtl(fd,XFREE86_PTY, XTY_TIOCSWINSZ, - (ULONG*)data, sizeof(struct winsize), &len, - NULL, 0, NULL); - case TIOCGWINSZ: - return DosDevIOCtl(fd,XFREE86_PTY, XTY_TIOCGWINSZ, - NULL, 0, NULL, - (ULONG*)data, sizeof(struct winsize), &len); - case XTY_ENADUP: - i = 1; - return DosDevIOCtl(fd,XFREE86_PTY, XTY_ENADUP, - (ULONG*)&i, sizeof(ULONG), &len, - NULL, 0, NULL); - case XTY_TRACE: - i = 2; - return DosDevIOCtl(fd,XFREE86_PTY, XTY_TRACE, - (ULONG*)&i, sizeof(ULONG), &len, - NULL, 0, NULL); - case PTMS_GETPTY: - i = 1; - return DosDevIOCtl(fd,XFREE86_PTY, PTMS_GETPTY, - (ULONG*)&i, sizeof(ULONG), &len, - (UCHAR*)data, 14, &len); - default: - return -1; - } -} -#endif /* __EMX__ */ + {"DeleteWindow", DeleteWindow}, + {"KeyboardMapping", KeyboardMapping}, +}; char **gblenvp; extern char **environ; int -main (int argc, char **argv, char **envp) +main(int argc, char **argv ENVP_ARG) { - Widget form_top, menu_top; - register TScreen *screen; - int mode; - char *my_class = DEFCLASS; - - /* Do these first, since we may not be able to open the display */ - ProgramName = argv[0]; - TRACE_OPTS(options, optionDescList, XtNumber(optionDescList)); - TRACE_ARGV("Before XtAppInitialize", argv); - if (argc > 1) { - int n; - int unique = 2; - Boolean quit = True; - - for (n = 1; n < argc; n++) { - TRACE(("parsing %s\n", argv[n])); - if (abbrev(argv[n], "-version", unique)) { - Version(); - } else if (abbrev(argv[n], "-help", unique)) { - Help(); - } else if (abbrev(argv[n], "-class", 3)) { - if ((my_class = argv[++n]) == 0) { - Help(); - } else { - quit = False; - } - unique = 3; - } else { - quit = False; - unique = 3; - } + Widget form_top, menu_top; + register TScreen *screen; + int mode; + char *my_class = DEFCLASS; + Window winToEmbedInto = None; + + /* Do these first, since we may not be able to open the display */ + ProgramName = argv[0]; + TRACE_OPTS(xtermOptions, optionDescList, XtNumber(optionDescList)); + TRACE_ARGV("Before XtOpenApplication", argv); + if (argc > 1) { + int n; + int unique = 2; + Boolean quit = True; + + for (n = 1; n < argc; n++) { + TRACE(("parsing %s\n", argv[n])); + if (abbrev(argv[n], "-version", unique)) { + Version(); + } else if (abbrev(argv[n], "-help", unique)) { + Help(); + } else if (abbrev(argv[n], "-class", 3)) { + if ((my_class = argv[++n]) == 0) { + Help(); + } else { + quit = False; } - if (quit) - exit(0); + unique = 3; + } else { + quit = False; + unique = 3; + } } + if (quit) + exit(0); + } - /* XXX: for some obscure reason EMX seems to lose the value of - * the environ variable, don't understand why, so save it recently - */ - gblenvp = envp; + /* XXX: for some obscure reason EMX seems to lose the value of + * the environ variable, don't understand why, so save it recently + */ + gblenvp = envp; #ifdef I18N - setlocale(LC_ALL, NULL); + setlocale(LC_ALL, NULL); #endif /*debug opencons();*/ - - ttydev = (char *) malloc (PTMS_BUFSZ); - ptydev = (char *) malloc (PTMS_BUFSZ); - if (!ttydev || !ptydev) { - fprintf (stderr, - "%s: unable to allocate memory for ttydev or ptydev\n", - ProgramName); - exit (1); - } - strcpy (ttydev, TTYDEV); - strcpy (ptydev, PTYDEV); + ttydev = (char *) malloc(PTMS_BUFSZ); + ptydev = (char *) malloc(PTMS_BUFSZ); + if (!ttydev || !ptydev) { + fprintf(stderr, + "%s: unable to allocate memory for ttydev or ptydev\n", + ProgramName); + exit(1); + } + strcpy(ttydev, TTYDEV); + strcpy(ptydev, PTYDEV); - /* Initialization is done here rather than above in order - ** to prevent any assumptions about the order of the contents - ** of the various terminal structures (which may change from - ** implementation to implementation). - */ - d_tio.c_iflag = ICRNL|IXON; - d_tio.c_oflag = OPOST|ONLCR|TAB3; - d_tio.c_cflag = B38400|CS8|CREAD|PARENB|HUPCL; - d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; - d_tio.c_line = 0; - d_tio.c_cc[VINTR] = CONTROL('C'); /* '^C' */ - d_tio.c_cc[VERASE] = 0x7f; /* DEL */ - d_tio.c_cc[VKILL] = CONTROL('U'); /* '^U' */ - d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */ - d_tio.c_cc[VEOF] = CEOF; /* '^D' */ - d_tio.c_cc[VEOL] = CEOL; /* '^@' */ - - /* Init the Toolkit. */ - { - XtSetErrorHandler(xt_error); - toplevel = XtAppInitialize (&app_con, my_class, - optionDescList, - XtNumber(optionDescList), - &argc, argv, fallback_resources, - NULL, 0); - XtSetErrorHandler((XtErrorHandler)0); - - XtGetApplicationResources(toplevel, (XtPointer) &resource, - application_resources, - XtNumber(application_resources), NULL, 0); - } + /* Initialization is done here rather than above in order + * to prevent any assumptions about the order of the contents + * of the various terminal structures (which may change from + * implementation to implementation). + */ + d_tio.c_iflag = ICRNL | IXON; + d_tio.c_oflag = OPOST | ONLCR | TAB3; + d_tio.c_cflag = B38400 | CS8 | CREAD | PARENB | HUPCL; + d_tio.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK; + d_tio.c_line = 0; + d_tio.c_cc[VINTR] = CONTROL('C'); /* '^C' */ + d_tio.c_cc[VERASE] = 0x7f; /* DEL */ + d_tio.c_cc[VKILL] = CONTROL('U'); /* '^U' */ + d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */ + d_tio.c_cc[VEOF] = CEOF; /* '^D' */ + d_tio.c_cc[VEOL] = CEOL; /* '^@' */ + + /* Init the Toolkit. */ + XtSetErrorHandler(xt_error); +#if OPT_SESSION_MGT + toplevel = XtOpenApplication(&app_con, my_class, + optionDescList, + XtNumber(optionDescList), + &argc, argv, fallback_resources, + sessionShellWidgetClass, + NULL, 0); +#else + toplevel = XtAppInitialize(&app_con, my_class, + optionDescList, + XtNumber(optionDescList), + &argc, argv, fallback_resources, + NULL, 0); +#endif /* OPT_SESSION_MGT */ + XtSetErrorHandler((XtErrorHandler) 0); + + XtGetApplicationResources(toplevel, (XtPointer) & resource, + application_resources, + XtNumber(application_resources), NULL, 0); - waiting_for_initial_map = resource.wait_for_map; + waiting_for_initial_map = resource.wait_for_map; - /* - * ICCCM delete_window. - */ - XtAppAddActions(app_con, actionProcs, XtNumber(actionProcs)); + /* + * ICCCM delete_window. + */ + XtAppAddActions(app_con, actionProcs, XtNumber(actionProcs)); - /* - * fill in terminal modes - */ - if (resource.tty_modes) { - int n = parse_tty_modes (resource.tty_modes, ttymodelist); - if (n < 0) { - fprintf (stderr, "%s: bad tty modes \"%s\"\n", - ProgramName, resource.tty_modes); - } else if (n > 0) { - override_tty_modes = 1; - } + /* + * fill in terminal modes + */ + if (resource.tty_modes) { + int n = parse_tty_modes(resource.tty_modes, ttymodelist); + if (n < 0) { + fprintf(stderr, "%s: bad tty modes \"%s\"\n", + ProgramName, resource.tty_modes); + } else if (n > 0) { + override_tty_modes = 1; } - + } #if OPT_ZICONBEEP - zIconBeep = resource.zIconBeep; - zIconBeep_flagged = False; - if ( zIconBeep > 100 || zIconBeep < -100 ) { - zIconBeep = 0; /* was 100, but I prefer to defaulting off. */ - fprintf( stderr, "a number between -100 and 100 is required for zIconBeep. 0 used by default\n"); - } + zIconBeep = resource.zIconBeep; + zIconBeep_flagged = False; + if (zIconBeep > 100 || zIconBeep < -100) { + zIconBeep = 0; /* was 100, but I prefer to defaulting off. */ + fprintf(stderr, + "a number between -100 and 100 is required for zIconBeep. 0 used by default\n"); + } #endif /* OPT_ZICONBEEP */ #if OPT_SAME_NAME - sameName = resource.sameName; + sameName = resource.sameName; #endif - hold_screen = resource.hold_screen ? 1 : 0; - xterm_name = resource.xterm_name; - if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE; - if (resource.icon_geometry != NULL) { - int scr, junk; - int ix, iy; - Arg args[2]; - - for(scr = 0; /* yyuucchh */ - XtScreen(toplevel) != ScreenOfDisplay(XtDisplay(toplevel),scr); - scr++); - - args[0].name = XtNiconX; - args[1].name = XtNiconY; - XGeometry(XtDisplay(toplevel), scr, resource.icon_geometry, "", - 0, 0, 0, 0, 0, &ix, &iy, &junk, &junk); - args[0].value = (XtArgVal) ix; - args[1].value = (XtArgVal) iy; - XtSetValues( toplevel, args, 2); - } + hold_screen = resource.hold_screen ? 1 : 0; + xterm_name = resource.xterm_name; + if (strcmp(xterm_name, "-") == 0) + xterm_name = DFT_TERMTYPE; + if (resource.icon_geometry != NULL) { + int scr, junk; + int ix, iy; + Arg args[2]; + + for (scr = 0; /* yyuucchh */ + XtScreen(toplevel) != ScreenOfDisplay(XtDisplay(toplevel), scr); + scr++) ; + + args[0].name = XtNiconX; + args[1].name = XtNiconY; + XGeometry(XtDisplay(toplevel), scr, resource.icon_geometry, "", + 0, 0, 0, 0, 0, &ix, &iy, &junk, &junk); + args[0].value = (XtArgVal) ix; + args[1].value = (XtArgVal) iy; + XtSetValues(toplevel, args, 2); + } - XtSetValues (toplevel, ourTopLevelShellArgs, - number_ourTopLevelShellArgs); + XtSetValues(toplevel, ourTopLevelShellArgs, + number_ourTopLevelShellArgs); #if OPT_WIDE_CHARS - /* seems as good a place as any */ - init_classtab(); + /* seems as good a place as any */ + init_classtab(); #endif - /* Parse the rest of the command line */ - TRACE_ARGV("After XtAppInitialize", argv); - for (argc--, argv++ ; argc > 0 ; argc--, argv++) { - if(**argv != '-') Syntax (*argv); - - TRACE(("parsing %s\n", argv[0])); - switch(argv[0][1]) { - case 'h': /* -help */ - Help(); - continue; - case 'v': /* -version */ - Version(); - continue; - case 'C': - { - struct stat sbuf; - - /* Must be owner and have read/write permission. - xdm cooperates to give the console the right user. */ - if ( !stat("/dev/console", &sbuf) && - (sbuf.st_uid == getuid()) && - !access("/dev/console", R_OK|W_OK)) - { - Console = TRUE; - } else - Console = FALSE; - } - continue; - case 'S': - if (sscanf(*argv + 2, "%c%c%d", passedPty, passedPty+1, - &am_slave) != 3) - Syntax(*argv); - continue; + /* Parse the rest of the command line */ + TRACE_ARGV("After XtOpenApplication", argv); + for (argc--, argv++; argc > 0; argc--, argv++) { + if (**argv != '-') + Syntax(*argv); + + TRACE(("parsing %s\n", argv[0])); + switch (argv[0][1]) { + case 'h': /* -help */ + Help(); + continue; + case 'v': /* -version */ + Version(); + continue; + case 'C': + { + struct stat sbuf; + + /* Must be owner and have read/write permission. + xdm cooperates to give the console the right user. */ + if (!stat("/dev/console", &sbuf) && + (sbuf.st_uid == getuid()) && + !access("/dev/console", R_OK | W_OK)) { + Console = TRUE; + } else + Console = FALSE; + } + continue; + case 'S': + if (sscanf(*argv + 2, "%c%c%d", passedPty, passedPty + 1, + &am_slave) != 3) + Syntax(*argv); + continue; #ifdef DEBUG - case 'D': - debug = TRUE; - continue; -#endif /* DEBUG */ - case 'c': /* -class param */ + case 'D': + debug = TRUE; + continue; +#endif /* DEBUG */ + case 'c': /* -class param */ + if (strcmp(argv[0] + 1, "class") == 0) argc--, argv++; - continue; - case 'e': - if (argc <= 1) Syntax (*argv); - command_to_exec = ++argv; - break; - default: - Syntax (*argv); + else + Syntax(*argv); + continue; + case 'e': + if (argc <= 1) + Syntax(*argv); + command_to_exec = ++argv; + break; + case 'i': + if (argc <= 1) { + Syntax(*argv); + } else { + char *endPtr; + --argc; + ++argv; + winToEmbedInto = (Window) strtol(argv[0], &endPtr, 10); } break; - } -#if OPT_WIDE_CHARS - /* Test whether UTF-8 mode should be active by default */ - { - char *s; - - if (((s = getenv("LC_ALL")) != 0 && *s != '\0') || - ((s = getenv("LC_CTYPE")) != 0 && *s != '\0') || - ((s = getenv("LANG")) != 0 && *s != '\0')) { - if (strstr(s, "UTF-8")) - defaultUTF8[0] = '2'; - } + default: + Syntax(*argv); } -#endif + break; + } - SetupMenus(toplevel, &form_top, &menu_top); + SetupMenus(toplevel, &form_top, &menu_top); - term = (XtermWidget) XtVaCreateManagedWidget( - "vt100", xtermWidgetClass, form_top, + term = (XtermWidget) XtVaCreateManagedWidget("vt100", xtermWidgetClass, + form_top, #if OPT_TOOLBAR - XtNmenuBar, menu_top, - XtNresizable, True, - XtNfromVert, menu_top, - XtNleft, XawChainLeft, - XtNright, XawChainRight, - XtNbottom, XawChainBottom, + XtNmenuBar, menu_top, + XtNresizable, True, + XtNfromVert, menu_top, + XtNleft, XawChainLeft, + XtNright, XawChainRight, + XtNbottom, XawChainBottom, #endif - 0); - /* this causes the initialize method to be called */ + (XtPointer) 0); + /* this causes the initialize method to be called */ #if OPT_HP_FUNC_KEYS - init_keyboard_type(keyboardIsHP, resource.hpFunctionKeys); + init_keyboard_type(keyboardIsHP, resource.hpFunctionKeys); #endif - init_keyboard_type(keyboardIsSun, resource.sunFunctionKeys); + init_keyboard_type(keyboardIsSun, resource.sunFunctionKeys); #if OPT_SUNPC_KBD - init_keyboard_type(keyboardIsVT220, resource.sunKeyboard); + init_keyboard_type(keyboardIsVT220, resource.sunKeyboard); #endif - screen = &term->screen; + screen = &term->screen; - inhibit = 0; + inhibit = 0; #ifdef ALLOWLOGGING - if (term->misc.logInhibit) inhibit |= I_LOG; + if (term->misc.logInhibit) + inhibit |= I_LOG; #endif - if (term->misc.signalInhibit) inhibit |= I_SIGNAL; + if (term->misc.signalInhibit) + inhibit |= I_SIGNAL; #if OPT_TEK4014 - if (term->misc.tekInhibit) inhibit |= I_TEK; + if (term->misc.tekInhibit) + inhibit |= I_TEK; #endif -/* - * Set title and icon name if not specified - */ +#if OPT_WIDE_CHARS + my_wcwidth = &mk_wcwidth; + if (term->misc.cjk_width) + my_wcwidth = &mk_wcwidth_cjk; +#endif - if (command_to_exec) { - Arg args[2]; +#if OPT_SESSION_MGT + if (resource.sessionMgt) { + TRACE(("Enabling session-management callbacks\n")); + XtAddCallback(toplevel, XtNdieCallback, die_callback, NULL); + XtAddCallback(toplevel, XtNsaveCallback, save_callback, NULL); + } +#endif - if (!resource.title) { - if (command_to_exec) { - resource.title = x_basename (command_to_exec[0]); - } /* else not reached */ - } + /* + * Set title and icon name if not specified + */ + if (command_to_exec) { + Arg args[2]; - if (!resource.icon_name) - resource.icon_name = resource.title; - XtSetArg (args[0], XtNtitle, resource.title); - XtSetArg (args[1], XtNiconName, resource.icon_name); - - TRACE(("setting:\n\ttitle \"%s\"\n\ticon \"%s\"\n\tbased on command \"%s\"\n", - resource.title, - resource.icon_name, - *command_to_exec)); + if (!resource.title) { + if (command_to_exec) { + resource.title = x_basename(command_to_exec[0]); + } /* else not reached */ + } + + if (!resource.icon_name) + resource.icon_name = resource.title; + XtSetArg(args[0], XtNtitle, resource.title); + XtSetArg(args[1], XtNiconName, resource.icon_name); + + TRACE(("setting:\n\ttitle \"%s\"\n\ticon \"%s\"\n\tbased on command \"%s\"\n", + resource.title, + resource.icon_name, + *command_to_exec)); - XtSetValues (toplevel, args, 2); + XtSetValues(toplevel, args, 2); + } +#if OPT_LUIT_PROG + if (term->misc.callfilter) { + int u = (term->misc.use_encoding ? 2 : 0); + if (command_to_exec) { + int n; + char **c; + for (n = 0, c = command_to_exec; *c; n++, c++) ; + c = malloc((n + 3 + u) * sizeof(char *)); + if (c == NULL) + SysError(ERROR_LUMALLOC); + memcpy(c + 2 + u, command_to_exec, (n + 1) * sizeof(char *)); + c[0] = term->misc.localefilter; + if (u) { + c[1] = "-encoding"; + c[2] = term->misc.locale_str; + } + c[1 + u] = "--"; + command_to_exec_with_luit = c; + } else { + static char *luit[4]; + luit[0] = term->misc.localefilter; + if (u) { + luit[1] = "-encoding"; + luit[2] = term->misc.locale_str; + luit[3] = NULL; + } else + luit[1] = NULL; + command_to_exec_with_luit = luit; } - + } +#endif #if OPT_TEK4014 - if(inhibit & I_TEK) - screen->TekEmu = FALSE; + if (inhibit & I_TEK) + screen->TekEmu = FALSE; - if(screen->TekEmu && !TekInit()) - exit(ERROR_INIT); + if (screen->TekEmu && !TekInit()) + exit(ERROR_INIT); #endif #ifdef DEBUG { /* Set up stderr properly. Opening this log file cannot be - done securely by a privileged xterm process (although we try), - so the debug feature is disabled by default. */ + done securely by a privileged xterm process (although we try), + so the debug feature is disabled by default. */ int i = -1; - if(debug) { - creat_as (getuid(), getgid(), True, "xterm.debug.log", 0666); - i = open ("xterm.debug.log", O_WRONLY | O_TRUNC, 0666); + if (debug) { + creat_as(getuid(), getgid(), True, "xterm.debug.log", 0666); + i = open("xterm.debug.log", O_WRONLY | O_TRUNC); } - if(i >= 0) { - dup2(i,2); + if (i >= 0) { + dup2(i, 2); - /* mark this file as close on exec */ - (void) fcntl(i, F_SETFD, 1); + /* mark this file as close on exec */ + (void) fcntl(i, F_SETFD, 1); } } -#endif /* DEBUG */ +#endif /* DEBUG */ - /* open a terminal for client */ - get_terminal (); + /* open a terminal for client */ + get_terminal(); - spawn (); + spawn(); - /* Child process is out there, let's catch its termination */ - (void) signal (SIGCHLD, reapchild); + /* Child process is out there, let's catch its termination */ + (void) signal(SIGCHLD, reapchild); - /* Realize procs have now been executed */ + /* Realize procs have now been executed */ - if (am_slave >= 0) { /* Write window id so master end can read and use */ - char buf[80]; + if (am_slave >= 0) { /* Write window id so master end can read and use */ + char buf[80]; - buf[0] = '\0'; - sprintf (buf, "%lx\n", XtWindow (XtParent (CURRENT_EMU(screen)))); - write (screen->respond, buf, strlen (buf)); - } + buf[0] = '\0'; + sprintf(buf, "%lx\n", XtWindow(XtParent(CURRENT_EMU(screen)))); + write(screen->respond, buf, strlen(buf)); + } - screen->inhibit = inhibit; + screen->inhibit = inhibit; - if (0 > (mode = fcntl(screen->respond, F_GETFL, 0))) - Error(1); - mode |= O_NDELAY; - - if (fcntl(screen->respond, F_SETFL, mode)) - Error(1); - - FD_ZERO (&pty_mask); - FD_ZERO (&X_mask); - FD_ZERO (&Select_mask); - FD_SET (screen->respond, &pty_mask); - FD_SET (ConnectionNumber(screen->display), &X_mask); - FD_SET (screen->respond, &Select_mask); - FD_SET (ConnectionNumber(screen->display), &Select_mask); - max_plus1 = (screen->respond < ConnectionNumber(screen->display)) ? - (1 + ConnectionNumber(screen->display)) : - (1 + screen->respond); + if (0 > (mode = fcntl(screen->respond, F_GETFL, 0))) + SysError(ERROR_F_GETFL); + mode |= O_NDELAY; + + if (fcntl(screen->respond, F_SETFL, mode)) + SysError(ERROR_F_SETFL); + + FD_ZERO(&pty_mask); + FD_ZERO(&X_mask); + FD_ZERO(&Select_mask); + FD_SET(screen->respond, &pty_mask); + FD_SET(ConnectionNumber(screen->display), &X_mask); + FD_SET(screen->respond, &Select_mask); + FD_SET(ConnectionNumber(screen->display), &Select_mask); + max_plus1 = ((screen->respond < ConnectionNumber(screen->display)) + ? (1 + ConnectionNumber(screen->display)) + : (1 + screen->respond)); #ifdef DEBUG - if (debug) printf ("debugging on\n"); -#endif /* DEBUG */ - XSetErrorHandler(xerror); - XSetIOErrorHandler(xioerror); + if (debug) + printf("debugging on\n"); +#endif /* DEBUG */ + XSetErrorHandler(xerror); + XSetIOErrorHandler(xioerror); #ifdef ALLOWLOGGING - if (term->misc.log_on) { - StartLog(screen); - } + if (term->misc.log_on) { + StartLog(screen); + } #endif - for( ; ; ) { + + if (winToEmbedInto != None) { + XtRealizeWidget(toplevel); + /* + * This should probably query the tree or check the attributes of + * winToEmbedInto in order to verify that it exists, but I'm still not + * certain what is the best way to do it -GPS + */ + XReparentWindow(XtDisplay(toplevel), + XtWindow(toplevel), + winToEmbedInto, 0, 0); + } + + for (;;) { #if OPT_TEK4014 - if(screen->TekEmu) - TekRun(); - else + if (screen->TekEmu) + TekRun(); + else #endif - VTRun(); - } - return 0; + VTRun(); + } + return 0; } /* @@ -1215,23 +1315,23 @@ static int pty_search(int *pty) { - char namebuf[PTMS_BUFSZ]; + char namebuf[PTMS_BUFSZ]; - /* ask the PTY manager */ - int fd = open("/dev/ptms$",0); - if (fd && ptioctl(fd,PTMS_GETPTY,namebuf)==0) { - strcpy(ttydev,namebuf); - strcpy(ptydev,namebuf); - *x_basename(ttydev) = 't'; - close (fd); - if ((*pty = open(ptydev, O_RDWR)) >= 0) { + /* ask the PTY manager */ + int fd = open("/dev/ptms$", 0); + if (fd && ptioctl(fd, PTMS_GETPTY, namebuf) == 0) { + strcpy(ttydev, namebuf); + strcpy(ptydev, namebuf); + *x_basename(ttydev) = 't'; + close(fd); + if ((*pty = open(ptydev, O_RDWR)) >= 0) { #ifdef PTYDEBUG - ptioctl(*pty,XTY_TRACE,0); + ptioctl(*pty, XTY_TRACE, 0); #endif - return 0; - } + return 0; } - return 1; + } + return 1; } /* @@ -1243,22 +1343,22 @@ * has problems, we can re-enter this function and get another one. */ static int -get_pty (int *pty) +get_pty(int *pty) { - return pty_search(pty); + return pty_search(pty); } /* * sets up X and initializes the terminal structure except for term.buf.fildes. */ static void -get_terminal (void) +get_terminal(void) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - screen->arrow = make_colored_cursor (XC_left_ptr, - screen->mousecolor, - screen->mousecolorback); + screen->arrow = make_colored_cursor(XC_left_ptr, + screen->mousecolor, + screen->mousecolorback); } /* @@ -1275,14 +1375,15 @@ */ #if OPT_TEK4014 -static char *tekterm[] = { - "tek4014", - "tek4015", /* 4014 with APL character set support */ - "tek4012", /* 4010 with lower case */ - "tek4013", /* 4012 with APL character set support */ - "tek4010", /* small screen, upper-case only */ - "dumb", - 0 +static char *tekterm[] = +{ + "tek4014", + "tek4015", /* 4014 with APL character set support */ + "tek4012", /* 4010 with lower case */ + "tek4013", /* 4012 with APL character set support */ + "tek4010", /* small screen, upper-case only */ + "dumb", + 0 }; #endif @@ -1293,32 +1394,38 @@ * The VT420 has up to 48 lines on the screen. */ -static char *vtterm[] = { +static char *vtterm[] = +{ #ifdef USE_X11TERM - "x11term", /* for people who want special term name */ + "x11term", /* for people who want special term name */ #endif - DFT_TERMTYPE, /* for people who want special term name */ - "xterm", /* the prefered name, should be fastest */ - "vt102", - "vt100", - "ansi", - "dumb", - 0 + DFT_TERMTYPE, /* for people who want special term name */ + "xterm", /* the prefered name, should be fastest */ + "vt102", + "vt100", + "ansi", + "dumb", + 0 }; /* ARGSUSED */ -static SIGNAL_T hungtty(int i GCC_UNUSED) +static SIGNAL_T +hungtty(int i GCC_UNUSED) { - longjmp(env, 1); - SIGNAL_RETURN; + longjmp(env, 1); + SIGNAL_RETURN; } struct { - int rows; - int cols; -} handshake = {-1,-1}; + int rows; + int cols; +} handshake = { -void first_map_occurred (void) + -1, -1 +}; + +void +first_map_occurred(void) { register TScreen *screen = &term->screen; handshake.rows = screen->max_row; @@ -1326,418 +1433,448 @@ waiting_for_initial_map = False; } +static void +set_owner(char *device, int uid, int gid, int mode) +{ + if (chown(device, uid, gid) < 0) { + if (errno != ENOENT + && getuid() == 0) { + fprintf(stderr, "Cannot chown %s to %d,%d: %s\n", + device, uid, gid, strerror(errno)); + } + } + chmod(device, mode); +} + #define THE_PARENT 1 #define THE_CHILD 2 int whoami = -1; -SIGNAL_T killit(int sig) +SIGNAL_T +killit(int sig) { - switch (whoami) { - case -1: - signal(sig,killit); - kill(-getpid(),sig); - break; - case THE_PARENT: - wait(NULL); - signal(SIGTERM,SIG_DFL); - kill(-getpid(),SIGTERM); - Exit(0); - break; - case THE_CHILD: - signal(SIGTERM,SIG_DFL); - kill(-getppid(),SIGTERM); - Exit(0); - break; - } + switch (whoami) { + case -1: + signal(sig, killit); + kill(-getpid(), sig); + break; + case THE_PARENT: + wait(NULL); + signal(SIGTERM, SIG_DFL); + kill(-getpid(), SIGTERM); + Exit(0); + break; + case THE_CHILD: + signal(SIGTERM, SIG_DFL); + kill(-getppid(), SIGTERM); + Exit(0); + break; + } - SIGNAL_RETURN; + SIGNAL_RETURN; } static int -spawn (void) +spawn(void) /* * Inits pty and tty and forks a login process. * Does not close fd Xsocket. * If slave, the pty named in passedPty is already open for use */ { - register TScreen *screen = &term->screen; - int Xsocket = ConnectionNumber(screen->display); + register TScreen *screen = &term->screen; + int Xsocket = ConnectionNumber(screen->display); - int tty = -1; - struct termio tio; - int status; - - char termcap[TERMCAP_SIZE], newtc[TERMCAP_SIZE]; - char *TermName = NULL; - char *ptr, *shname, buf[64]; - int i, no_dev_tty = FALSE, envsize; - char *dev_tty_name = (char *) 0; - struct winsize ws; - int pgrp = getpid(); - char numbuf[12], **envnew; - - screen->uid = getuid(); - screen->gid = getgid(); - - if (am_slave >= 0) { - screen->respond = am_slave; - ptydev[strlen(ptydev) - 2] = - ttydev[strlen(ttydev) - 2] = passedPty[0]; - ptydev[strlen(ptydev) - 1] = - ttydev[strlen(ttydev) - 1] = passedPty[1]; + int tty = -1; + struct termio tio; + int status; + + char termcap[TERMCAP_SIZE], newtc[TERMCAP_SIZE]; + char *TermName = NULL; + char *ptr, *shname, buf[64]; + int i, no_dev_tty = FALSE, envsize; + char *dev_tty_name = (char *) 0; + struct winsize ws; + int pgrp = getpid(); + char numbuf[12], **envnew; + + screen->uid = getuid(); + screen->gid = getgid(); + + if (am_slave >= 0) { + screen->respond = am_slave; + ptydev[strlen(ptydev) - 2] = + ttydev[strlen(ttydev) - 2] = passedPty[0]; + ptydev[strlen(ptydev) - 1] = + ttydev[strlen(ttydev) - 1] = passedPty[1]; + + setgid(screen->gid); + setuid(screen->uid); + } else { + Bool tty_got_hung; - setgid (screen->gid); - setuid (screen->uid); + /* + * Sometimes /dev/tty hangs on open (as in the case of a pty + * that has gone away). Simply make up some reasonable + * defaults. + */ + + signal(SIGALRM, hungtty); + alarm(2); /* alarm(1) might return too soon */ + if (!setjmp(env)) { + tty = open("/dev/tty", O_RDWR); + alarm(0); + tty_got_hung = False; } else { - Bool tty_got_hung; + tty_got_hung = True; + tty = -1; + errno = ENXIO; + } + signal(SIGALRM, SIG_DFL); - /* - * Sometimes /dev/tty hangs on open (as in the case of a pty - * that has gone away). Simply make up some reasonable - * defaults. - */ - - signal(SIGALRM, hungtty); - alarm(2); /* alarm(1) might return too soon */ - if (! setjmp(env)) { - tty = open ("/dev/tty", O_RDWR, 0); - alarm(0); - tty_got_hung = False; - } else { - tty_got_hung = True; - tty = -1; - errno = ENXIO; - } - signal(SIGALRM, SIG_DFL); + /* + * Check results and ignore current control terminal if + * necessary. ENXIO is what is normally returned if there is + * no controlling terminal, but some systems (e.g. SunOS 4.0) + * seem to return EIO. Solaris 2.3 is said to return EINVAL. + */ + if (tty < 0) { + if (tty_got_hung || errno == ENXIO || errno == EIO || + errno == EINVAL || errno == ENOTTY) { + no_dev_tty = TRUE; + tio = d_tio; + } else { + SysError(ERROR_OPDEVTTY); + } + } else { - /* - * Check results and ignore current control terminal if - * necessary. ENXIO is what is normally returned if there is - * no controlling terminal, but some systems (e.g. SunOS 4.0) - * seem to return EIO. Solaris 2.3 is said to return EINVAL. - */ - if (tty < 0) { - if (tty_got_hung || errno == ENXIO || errno == EIO || - errno == EINVAL || errno == ENOTTY) { - no_dev_tty = TRUE; - tio = d_tio; - } else { - SysError(ERROR_OPDEVTTY); - } - } else { - /* Get a copy of the current terminal's state, - * if we can. Some systems (e.g., SVR4 and MacII) - * may not have a controlling terminal at this point - * if started directly from xdm or xinit, - * in which case we just use the defaults as above. - */ -/**/ if(ioctl(tty, TCGETA, &tio) == -1) - tio = d_tio; - - close (tty); - /* tty is no longer an open fd! */ - tty = -1; - } + /* Get a copy of the current terminal's state, + * if we can. Some systems (e.g., SVR4 and MacII) + * may not have a controlling terminal at this point + * if started directly from xdm or xinit, + * in which case we just use the defaults as above. + */ + if (ioctl(tty, TCGETA, &tio) == -1) + tio = d_tio; - if (get_pty (&screen->respond)) { - /* no ptys! */ - exit (ERROR_PTYS); - } + close(tty); + /* tty is no longer an open fd! */ + tty = -1; } - /* avoid double MapWindow requests */ - XtSetMappedWhenManaged(XtParent(CURRENT_EMU(screen)), False ); + if (get_pty(&screen->respond)) { + /* no ptys! */ + exit(ERROR_PTYS); + } + } - wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", - False); + /* avoid double MapWindow requests */ + XtSetMappedWhenManaged(XtParent(CURRENT_EMU(screen)), False); - if (!TEK4014_ACTIVE(screen)) - VTInit(); /* realize now so know window size for tty driver */ + wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", + False); - if (Console) { - /* - * Inform any running xconsole program - * that we are going to steal the console. - */ - XmuGetHostname (mit_console_name + MIT_CONSOLE_LEN, 255); - mit_console = XInternAtom(screen->display, mit_console_name, False); - /* the user told us to be the console, so we can use CurrentTime */ - XtOwnSelection(XtParent(CURRENT_EMU(screen)), - mit_console, CurrentTime, - ConvertConsoleSelection, NULL, NULL); - } -#if OPT_TEK4014 - if(screen->TekEmu) { - envnew = tekterm; - ptr = newtc; - } - else -#endif - { - envnew = vtterm; - ptr = termcap; - } + if (!TEK4014_ACTIVE(screen)) + VTInit(); /* realize now so know window size for tty driver */ + if (Console) { /* - * This used to exit if no termcap entry was found for the specified - * terminal name. That's a little unfriendly, so instead we'll allow - * the program to proceed (but not to set $TERMCAP) if the termcap - * entry is not found. + * Inform any running xconsole program + * that we are going to steal the console. */ - get_termcap(TermName = resource.term_name, ptr, newtc); + XmuGetHostname(mit_console_name + MIT_CONSOLE_LEN, 255); + mit_console = XInternAtom(screen->display, mit_console_name, False); + /* the user told us to be the console, so we can use CurrentTime */ + XtOwnSelection(XtParent(CURRENT_EMU(screen)), + mit_console, CurrentTime, + ConvertConsoleSelection, NULL, NULL); + } +#if OPT_TEK4014 + if (screen->TekEmu) { + envnew = tekterm; + ptr = newtc; + } else +#endif + { + envnew = vtterm; + ptr = termcap; + } - /* - * This block is invoked only if there was no terminal name specified - * by the command-line option "-tn". - */ - if (!TermName) { - TermName = *envnew; - while (*envnew != NULL) { - if (get_termcap(*envnew, ptr, newtc)) { - TermName = *envnew; - break; - } - envnew++; + /* + * This used to exit if no termcap entry was found for the specified + * terminal name. That's a little unfriendly, so instead we'll allow + * the program to proceed (but not to set $TERMCAP) if the termcap + * entry is not found. + */ + get_termcap(TermName = resource.term_name, ptr, newtc); + + /* + * This block is invoked only if there was no terminal name specified + * by the command-line option "-tn". + */ + if (!TermName) { + TermName = *envnew; + while (*envnew != NULL) { + if (get_termcap(*envnew, ptr, newtc)) { + TermName = *envnew; + break; } + envnew++; } + } - /* tell tty how big window is */ + /* tell tty how big window is */ #if OPT_TEK4014 - if(TEK4014_ACTIVE(screen)) { - ws.ws_row = 38; - ws.ws_col = 81; - ws.ws_xpixel = TFullWidth(screen); - ws.ws_ypixel = TFullHeight(screen); - } else + if (TEK4014_ACTIVE(screen)) { + ws.ws_row = 38; + ws.ws_col = 81; + ws.ws_xpixel = TFullWidth(screen); + ws.ws_ypixel = TFullHeight(screen); + } else +#endif + { + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); + } + + if (am_slave < 0) { + + char sema[40]; + HEV sev; + /* start a child process + * use an event sema for sync + */ + sprintf(sema, "\\SEM32\\xterm%s", &ptydev[8]); + if (DosCreateEventSem(sema, &sev, DC_SEM_SHARED, FALSE)) + SysError(ERROR_FORK); + + switch ((screen->pid = fork())) { + case -1: /* error */ + SysError(ERROR_FORK); + default: /* parent */ + whoami = THE_PARENT; + DosWaitEventSem(sev, 1000L); + DosCloseEventSem(sev); + break; + case 0: /* child */ + whoami = THE_CHILD; + +/*debug fclose(confd); +opencons();*/ + /* we don't need the socket, or the pty master anymore */ + close(ConnectionNumber(screen->display)); + close(screen->respond); + + /* Now is the time to set up our process group and + * open up the pty slave. + */ + if ((tty = open(ttydev, O_RDWR)) < 0) { + /* dumm gelaufen */ + fprintf(stderr, "Cannot open slave side of PTY\n"); + exit(1); + } + + /* use the same tty name that everyone else will use + * (from ttyname) + */ +#ifdef EMXNOTBOGUS + if ((ptr = ttyname(tty)) != 0) { + /* it may be bigger */ + ttydev = realloc(ttydev, + (unsigned) (strlen(ptr) + 1)); + if (ttydev == NULL) { + SysError(ERROR_SPREALLOC); + } + (void) strcpy(ttydev, ptr); + } +#else + ptr = ttydev; #endif - { + /* for safety: enable DUPs */ + ptioctl(tty, XTY_ENADUP, 0); + + /* change ownership of tty to real group and user id */ + set_owner(ttydev, screen->uid, screen->gid, + (resource.messages ? 0622 : 0600)); + + /* for the xf86sup-pty, we set the pty to bypass: OS/2 does + * not have a line discipline structure + */ + { + struct termio t, t1; + if (ptioctl(tty, TCGETA, (char *) &t) < 0) + t = d_tio; + + t.c_iflag = ICRNL; + t.c_oflag = OPOST | ONLCR; + t.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK; + + /* ignore error code, user will see it :-) */ + ptioctl(tty, TCSETA, (char *) &t); + + /* set the console mode */ + if (Console) { + int on = 1; + if (ioctl(tty, TIOCCONS, (char *) &on) == -1) + fprintf(stderr, "%s: cannot open console\n", xterm_name); + } + } + + signal(SIGCHLD, SIG_DFL); + signal(SIGHUP, SIG_IGN); + + /* restore various signals to their defaults */ + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + + /* copy the environment before Setenving */ + for (i = 0; gblenvp[i] != NULL; i++) ; + + /* compute number of xtermSetenv() calls below */ + envsize = 1; /* (NULL terminating entry) */ + envsize += 3; /* TERM, WINDOWID, DISPLAY */ + envsize += 2; /* COLUMNS, LINES */ + + envnew = (char **) calloc((unsigned) i + envsize, sizeof(char *)); + memmove((char *) envnew, (char *) gblenvp, i * sizeof(char *)); + gblenvp = envnew; + xtermSetenv("TERM=", TermName); + if (!TermName) + *newtc = 0; + + sprintf(buf, "%lu", + ((unsigned long) XtWindow(XtParent(CURRENT_EMU(screen))))); + xtermSetenv("WINDOWID=", buf); + + /* put the display into the environment of the shell */ + xtermSetenv("DISPLAY=", XDisplayString(screen->display)); + + signal(SIGTERM, SIG_DFL); + + /* this is the time to go and set up stdin, out, and err + */ + /* dup the tty */ + for (i = 0; i <= 2; i++) + if (i != tty) { + (void) close(i); + (void) dup(tty); + } + + /* and close the tty */ + if (tty > 2) + (void) close(tty); + + setpgrp(0, pgrp); + setgid(screen->gid); + setuid(screen->uid); + + if (handshake.rows > 0 && handshake.cols > 0) { + screen->max_row = handshake.rows; + screen->max_col = handshake.cols; ws.ws_row = screen->max_row + 1; ws.ws_col = screen->max_col + 1; ws.ws_xpixel = FullWidth(screen); ws.ws_ypixel = FullHeight(screen); - } + } + + sprintf(numbuf, "%d", screen->max_col + 1); + xtermSetenv("COLUMNS=", numbuf); + sprintf(numbuf, "%d", screen->max_row + 1); + xtermSetenv("LINES=", numbuf); + + /* reconstruct dead environ variable */ + environ = gblenvp; + + /* need to reset after all the ioctl bashing we did above */ + ptioctl(0, TIOCSWINSZ, (char *) &ws); - if (am_slave < 0) { + signal(SIGHUP, SIG_DFL); + /* okay everything seems right, so tell the parent, we are going */ + { char sema[40]; HEV sev; - /* start a child process - * use an event sema for sync - */ - sprintf(sema,"\\SEM32\\xterm%s",&ptydev[8]); - if (DosCreateEventSem(sema,&sev,DC_SEM_SHARED,FALSE)) - SysError(ERROR_FORK); - - switch ((screen->pid = fork())) { - case -1: /* error */ - SysError (ERROR_FORK); - default: /* parent */ - whoami = THE_PARENT; - DosWaitEventSem(sev,1000l); - DosCloseEventSem(sev); - break; - case 0: /* child */ - whoami = THE_CHILD; + sprintf(sema, "\\SEM32\\xterm%s", &ttydev[8]); + DosOpenEventSem(sema, &sev); + DosPostEventSem(sev); + DosCloseEventSem(sev); + } -/*debug fclose(confd); -opencons();*/ - /* we don't need the socket, or the pty master anymore */ - close (ConnectionNumber(screen->display)); - close (screen->respond); - - /* Now is the time to set up our process group and - * open up the pty slave. - */ - if ((tty = open(ttydev, O_RDWR, 0)) < 0) { - /* dumm gelaufen */ - fprintf(stderr, "Cannot open slave side of PTY\n"); - exit(1); - } - - /* use the same tty name that everyone else will use - * (from ttyname) - */ -#ifdef EMXNOTBOGUS - if ((ptr = ttyname(tty)) != 0) - { - /* it may be bigger */ - ttydev = realloc (ttydev, - (unsigned) (strlen(ptr) + 1)); - (void) strcpy(ttydev, ptr); - } -#else - ptr = ttydev; +#if OPT_LUIT_PROG + /* + * Use two copies of command_to_exec, in case luit is not actually + * there, or refuses to run. In that case we will fall-through to + * to command that the user gave anyway. + */ + if (command_to_exec_with_luit) { + TRACE(("spawning command \"%s\"\n", *command_to_exec_with_luit)); + execvp(*command_to_exec_with_luit, command_to_exec_with_luit); + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s: %s\n", + xterm_name, *command_to_exec_with_luit, strerror(errno)); + fprintf(stderr, "%s: cannot support your locale.\n", + xterm_name); + } #endif - /* for safety: enable DUPs */ - ptioctl(tty,XTY_ENADUP,0); - - /* change ownership of tty to real group and user id */ - chown (ttydev, screen->uid, screen->gid); + if (command_to_exec) { + TRACE(("spawning command \"%s\"\n", *command_to_exec)); + execvpe(*command_to_exec, command_to_exec, gblenvp); + + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s\n", + xterm_name, *command_to_exec); + } - /* change protection of tty */ - chmod (ttydev, (resource.messages? 0622 : 0600)); - - /* for the xf86sup-pty, we set the pty to bypass: OS/2 does - * not have a line discipline structure - */ - { - struct termio t,t1; - if (ptioctl(tty, TCGETA, (char*)&t) < 0) - t = d_tio; - - t.c_iflag = ICRNL; - t.c_oflag = OPOST|ONLCR; - t.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; - - /* ignore error code, user will see it :-) */ - ptioctl(tty, TCSETA, (char*)&t); - - /* set the console mode */ - if (Console) { - int on = 1; - if (ioctl (tty, TIOCCONS, (char *)&on) == -1) - fprintf(stderr, "%s: cannot open console\n", xterm_name); - } - } - - signal (SIGCHLD, SIG_DFL); - signal (SIGHUP, SIG_IGN); - - /* restore various signals to their defaults */ - signal (SIGINT, SIG_DFL); - signal (SIGQUIT, SIG_DFL); - signal (SIGTERM, SIG_DFL); - - /* copy the environment before Setenving */ - for (i = 0 ; gblenvp [i] != NULL ; i++) - ; - - /* compute number of xtermSetenv() calls below */ - envsize = 1; /* (NULL terminating entry) */ - envsize += 3; /* TERM, WINDOWID, DISPLAY */ - envsize += 2; /* COLUMNS, LINES */ - - envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *)); - memmove( (char *)envnew, (char *)gblenvp, i * sizeof(char *)); - gblenvp = envnew; - xtermSetenv ("TERM=", TermName); - if(!TermName) - *newtc = 0; - - sprintf (buf, "%lu", - ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen))))); - xtermSetenv ("WINDOWID=", buf); - - /* put the display into the environment of the shell*/ - xtermSetenv ("DISPLAY=", XDisplayString (screen->display)); - - signal(SIGTERM, SIG_DFL); - - /* this is the time to go and set up stdin, out, and err - */ - /* dup the tty */ - for (i = 0; i <= 2; i++) - if (i != tty) { - (void) close(i); - (void) dup(tty); - } - - /* and close the tty */ - if (tty > 2) - (void) close(tty); - - setpgrp (0, pgrp); - setgid (screen->gid); - setuid (screen->uid); - - if (handshake.rows > 0 && handshake.cols > 0) { - screen->max_row = handshake.rows; - screen->max_col = handshake.cols; - ws.ws_row = screen->max_row + 1; - ws.ws_col = screen->max_col + 1; - ws.ws_xpixel = FullWidth(screen); - ws.ws_ypixel = FullHeight(screen); - } - - sprintf (numbuf, "%d", screen->max_col + 1); - xtermSetenv("COLUMNS=", numbuf); - sprintf (numbuf, "%d", screen->max_row + 1); - xtermSetenv("LINES=", numbuf); - - /* reconstruct dead environ variable */ - environ = gblenvp; - - /* need to reset after all the ioctl bashing we did above */ - ptioctl (0, TIOCSWINSZ, (char *)&ws); - - signal(SIGHUP, SIG_DFL); - - /* okay everything seems right, so tell the parent, we are going */ - { - char sema[40]; - HEV sev; - sprintf(sema,"\\SEM32\\xterm%s",&ttydev[8]); - DosOpenEventSem(sema,&sev); - DosPostEventSem(sev); - DosCloseEventSem(sev); - } - - if (command_to_exec) { - TRACE(("spawning command \"%s\"\n", *command_to_exec)); - execvpe(*command_to_exec, command_to_exec, - gblenvp); - - /* print error message on screen */ - fprintf(stderr, "%s: Can't execvp %s\n", - xterm_name, *command_to_exec); - } - - /* use a layered mechanism to find a shell */ - ptr = getenv("X11SHELL"); - if (!ptr) ptr = getenv("SHELL"); - if (!ptr) ptr = getenv("OS2_SHELL"); - if (!ptr) ptr = "SORRY_NO_SHELL_FOUND"; - - shname = x_basename(ptr); - if (command_to_exec) { - char *exargv[10]; /*XXX*/ - - exargv[0] = ptr; - exargv[1] = "/C"; - exargv[2] = command_to_exec[0]; - exargv[3] = command_to_exec[1]; - exargv[4] = command_to_exec[2]; - exargv[5] = command_to_exec[3]; - exargv[6] = command_to_exec[4]; - exargv[7] = command_to_exec[5]; - exargv[8] = command_to_exec[6]; - exargv[9] = 0; - execvpe(exargv[0],exargv,gblenvp); + /* use a layered mechanism to find a shell */ + ptr = getenv("X11SHELL"); + if (!ptr) + ptr = getenv("SHELL"); + if (!ptr) + ptr = getenv("OS2_SHELL"); + if (!ptr) + ptr = "SORRY_NO_SHELL_FOUND"; + + shname = x_basename(ptr); + if (command_to_exec) { + char *exargv[10]; /*XXX */ + + exargv[0] = ptr; + exargv[1] = "/C"; + exargv[2] = command_to_exec[0]; + exargv[3] = command_to_exec[1]; + exargv[4] = command_to_exec[2]; + exargv[5] = command_to_exec[3]; + exargv[6] = command_to_exec[4]; + exargv[7] = command_to_exec[5]; + exargv[8] = command_to_exec[6]; + exargv[9] = 0; + execvpe(exargv[0], exargv, gblenvp); /* - execvpe(*command_to_exec, command_to_exec, - gblenvp); + execvpe(*command_to_exec, command_to_exec, gblenvp); */ - /* print error message on screen */ - fprintf(stderr, "%s: Can't execvp %s\n", - xterm_name, *command_to_exec); - } else { - execlpe (ptr, shname, 0, gblenvp); - - /* Exec failed. */ - fprintf (stderr, "%s: Could not exec %s!\n", - xterm_name, ptr); - } - sleep(5); - - /* preventively shoot the parent */ - kill (-getppid(),SIGTERM); - - exit(ERROR_EXEC); - } /* endcase */ - } /* !am_slave */ + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s\n", + xterm_name, *command_to_exec); + } else { + execlpe(ptr, shname, 0, gblenvp); + + /* Exec failed. */ + fprintf(stderr, "%s: Could not exec %s!\n", + xterm_name, ptr); + } + sleep(5); + + /* preventively shoot the parent */ + kill(-getppid(), SIGTERM); - signal (SIGHUP, SIG_IGN); + exit(ERROR_EXEC); + } /* endcase */ + } + /* !am_slave */ + signal(SIGHUP, SIG_IGN); /* * Unfortunately, System V seems to have trouble divorcing the child process * from the process group of xterm. This is a problem because hitting the @@ -1745,42 +1882,38 @@ * don't ignore the signals. This is annoying. */ -/* signal (SIGINT, SIG_IGN);*/ - signal(SIGINT, killit); - signal(SIGTERM, killit); - - /* hung shell problem */ - signal (SIGQUIT, SIG_IGN); -/* signal (SIGTERM, SIG_IGN);*/ - return 0; -} /* end spawn */ +/* signal (SIGINT, SIG_IGN);*/ + signal(SIGINT, killit); + signal(SIGTERM, killit); + + /* hung shell problem */ + signal(SIGQUIT, SIG_IGN); +/* signal (SIGTERM, SIG_IGN);*/ + return 0; +} /* end spawn */ SIGNAL_T Exit(int n) { - register TScreen *screen = &term->screen; - int pty = term->screen.respond; /* file descriptor of pty */ - close(pty); /* close explicitly to avoid race with slave side */ + register TScreen *screen = &term->screen; + int pty = term->screen.respond; /* file descriptor of pty */ + close(pty); /* close explicitly to avoid race with slave side */ #ifdef ALLOWLOGGING - if(screen->logging) - CloseLog(screen); + if (screen->logging) + CloseLog(screen); #endif - if (am_slave < 0) { - /* restore ownership of tty and pty */ - chown (ttydev, 0, 0); - chown (ptydev, 0, 0); - - /* restore modes of tty and pty */ - chmod (ttydev, 0666); - chmod (ptydev, 0666); - } - exit(n); - SIGNAL_RETURN; + if (am_slave < 0) { + /* restore ownership of tty and pty */ + set_owner(ttydev, 0, 0, 0666); + set_owner(ptydev, 0, 0, 0666); + } + exit(n); + SIGNAL_RETURN; } /* ARGSUSED */ static void -resize(TScreen *screen, register char *oldtc, register char *newtc) +resize(TScreen * screen, register char *oldtc, char *newtc) { } @@ -1792,15 +1925,17 @@ int nonblocking_wait(void) { - pid_t pid; + pid_t pid; - pid = waitpid(-1, NULL, WNOHANG); - return pid; + pid = waitpid(-1, NULL, WNOHANG); + return pid; } /* ARGSUSED */ -static SIGNAL_T reapchild (int n GCC_UNUSED) +static SIGNAL_T +reapchild(int n GCC_UNUSED) { + int olderrno = errno; int pid; pid = wait(NULL); @@ -1813,13 +1948,15 @@ do { if (pid == term->screen.pid) { #ifdef DEBUG - if (debug) fputs ("Exiting\n", stderr); + if (debug) + fputs("Exiting\n", stderr); #endif if (!hold_screen) - Cleanup (0); + Cleanup(0); } - } while ( (pid=nonblocking_wait()) > 0); + } while ((pid = nonblocking_wait()) > 0); + errno = olderrno; SIGNAL_RETURN; } @@ -1831,51 +1968,47 @@ * where setting consists of the words in the modelist followed by a character * or ^char. */ -static int parse_tty_modes (char *s, struct _xttymodes *modelist) +static int +parse_tty_modes(char *s, struct _xttymodes *modelist) { struct _xttymodes *mp; int c; int count = 0; + TRACE(("parse_tty_modes\n")); while (1) { - while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; - if (!*s) return count; + while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) + s++; + if (!*s) + return count; for (mp = modelist; mp->name; mp++) { - if (strncmp (s, mp->name, mp->len) == 0) break; + if (strncmp(s, mp->name, mp->len) == 0) + break; } - if (!mp->name) return -1; + if (!mp->name) + return -1; s += mp->len; - while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; - if (!*s) return -1; - - if (*s == '^') { + while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; - c = ((*s == '?') ? 0177 : CONTROL(*s)); - if (*s == '-') { - errno = 0; - c = fpathconf(0, _PC_VDISABLE); - if (c == -1) { - if (errno != 0) - continue; /* skip this (error) */ - c = 0377; - } - } - } else { - c = *s; + if (!*s) + return -1; + + if ((c = decode_keyvalue(&s, False)) != -1) { + mp->value = c; + mp->set = 1; + count++; + TRACE(("...parsed #%d: %s=%#x\n", count, mp->name, c)); } - mp->value = c; - mp->set = 1; - count++; - s++; } } -int GetBytesAvailable (int fd) +int +GetBytesAvailable(int fd) { long arg; - ioctl (fd, FIONREAD, (char *) &arg); + ioctl(fd, FIONREAD, (char *) &arg); return (int) arg; } @@ -1884,6 +2017,83 @@ int kill_process_group(int pid, int sig) +{ + return kill(-pid, sig); +} + +int +ptioctl(int fd, int func, void *data) { - return kill (-pid, sig); + APIRET rc; + ULONG len; + struct pt_termios pt; + struct termio *t; + int i; + + switch (func) { + case TCGETA: + rc = DosDevIOCtl(fd, XFREE86_PTY, func, + NULL, 0, NULL, + (ULONG *) & pt, sizeof(struct pt_termios), &len); + if (rc) + return -1; + t = (struct termio *) data; + t->c_iflag = pt.c_iflag; + t->c_oflag = pt.c_oflag; + t->c_cflag = pt.c_cflag; + t->c_lflag = pt.c_lflag; + for (i = 0; i < NCC; i++) + t->c_cc[i] = pt.c_cc[i]; + return 0; + case TCSETA: + case TCSETAW: + case TCSETAF: + t = (struct termio *) data; + pt.c_iflag = t->c_iflag; + pt.c_oflag = t->c_oflag; + pt.c_cflag = t->c_cflag; + pt.c_lflag = t->c_lflag; + + for (i = 0; i < NCC; i++) + pt.c_cc[i] = t->c_cc[i]; + if (func == TCSETA) + i = XTY_TIOCSETA; + else if (func == TCSETAW) + i = XTY_TIOCSETAW; + else + i = XTY_TIOCSETAF; + rc = DosDevIOCtl(fd, XFREE86_PTY, i, + (ULONG *) & pt, sizeof(struct pt_termios), &len, + NULL, 0, NULL); + return (rc) ? -1 : 0; + case TIOCCONS: + return DosDevIOCtl(fd, XFREE86_PTY, XTY_TIOCCONS, + (ULONG *) data, sizeof(ULONG), &len, + NULL, 0, NULL); + case TIOCSWINSZ: + return DosDevIOCtl(fd, XFREE86_PTY, XTY_TIOCSWINSZ, + (ULONG *) data, sizeof(struct winsize), &len, + NULL, 0, NULL); + case TIOCGWINSZ: + return DosDevIOCtl(fd, XFREE86_PTY, XTY_TIOCGWINSZ, + NULL, 0, NULL, + (ULONG *) data, sizeof(struct winsize), &len); + case XTY_ENADUP: + i = 1; + return DosDevIOCtl(fd, XFREE86_PTY, XTY_ENADUP, + (ULONG *) & i, sizeof(ULONG), &len, + NULL, 0, NULL); + case XTY_TRACE: + i = 2; + return DosDevIOCtl(fd, XFREE86_PTY, XTY_TRACE, + (ULONG *) & i, sizeof(ULONG), &len, + NULL, 0, NULL); + case PTMS_GETPTY: + i = 1; + return DosDevIOCtl(fd, XFREE86_PTY, PTMS_GETPTY, + (ULONG *) & i, sizeof(ULONG), &len, + (UCHAR *) data, 14, &len); + default: + return -1; + } } Index: xc/programs/xterm/print.c diff -u xc/programs/xterm/print.c:1.16 xc/programs/xterm/print.c:1.19 --- xc/programs/xterm/print.c:1.16 Mon Jun 12 22:28:40 2000 +++ xc/programs/xterm/print.c Sun Aug 11 20:36:33 2002 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/print.c,v 1.16 2000/06/13 02:28:40 dawes Exp $ + * $XFree86: xc/programs/xterm/print.c,v 1.19 2002/08/12 00:36:33 dickey Exp $ */ /************************************************************ -Copyright 1997-2000 by Thomas E. Dickey +Copyright 1997-2000,2002 by Thomas E. Dickey All Rights Reserved @@ -36,6 +36,7 @@ #include <xterm.h> #include <data.h> +#include <menu.h> #include <error.h> #include <stdio.h> @@ -59,47 +60,54 @@ #define VMS_TEMP_PRINT_FILE "sys$scratch:xterm_print.txt" #endif -static void charToPrinter (int chr); -static void printLine (int row, int chr); -static void send_CharSet (int row); -static void send_SGR (unsigned attr, int fg, int bg); -static void stringToPrinter (char * str); +static void charToPrinter(int chr); +static void printLine(int row, int chr); +static void send_CharSet(int row); +static void send_SGR(unsigned attr, int fg, int bg); +static void stringToPrinter(char *str); static FILE *Printer; static int Printer_pid; static int initialized; -static void closePrinter(void) +static void +closePrinter(void) { + if (xtermHasPrinter() != 0) { #ifdef VMS - register TScreen *screen = &term->screen; + TScreen *screen = &term->screen; + char pcommand[256]; - (void)sprintf(pcommand,"%s %s;", - screen->printer_command, - VMS_TEMP_PRINT_FILE); + (void) sprintf(pcommand, "%s %s;", + screen->printer_command, + VMS_TEMP_PRINT_FILE); #endif if (Printer != 0) { - fclose(Printer); - TRACE(("closed printer, waiting...\n")); -#ifdef VMS /* This is a quick hack, really should use spawn and check status - or system services and go straight to the queue */ - (void) system(pcommand); + fclose(Printer); + TRACE(("closed printer, waiting...\n")); +#ifdef VMS /* This is a quick hack, really should use + spawn and check status or system services + and go straight to the queue */ + (void) system(pcommand); #else /* VMS */ - while (nonblocking_wait() > 0) + while (nonblocking_wait() > 0) #endif /* VMS */ - ; - Printer = 0; - initialized = 0; - TRACE(("closed printer\n")); + ; + Printer = 0; + initialized = 0; + TRACE(("closed printer\n")); } + } } -static void printCursorLine(void) +static void +printCursorLine(void) { - register TScreen *screen = &term->screen; - TRACE(("printCursorLine\n")); - printLine(screen->cur_row, '\n'); + TScreen *screen = &term->screen; + + TRACE(("printCursorLine\n")); + printLine(screen->cur_row, '\n'); } /* @@ -107,149 +115,143 @@ * happens with a line that is entirely blank. This function prints the * characters that xterm would allow as a selection (which may include blanks). */ -static void printLine(int row, int chr) +static void +printLine(int row, int chr) { - register TScreen *screen = &term->screen; - Char *c = SCRN_BUF_CHARS(screen, row); - Char *a = SCRN_BUF_ATTRS(screen, row); - Char attr = 0; - unsigned ch; - int last = screen->max_col + 1; - int col; + TScreen *screen = &term->screen; + Char *c = SCRN_BUF_CHARS(screen, row); + Char *a = SCRN_BUF_ATTRS(screen, row); + Char attr = 0; + unsigned ch; + int last = screen->max_col + 1; + int col; #if OPT_ISO_COLORS && OPT_PRINT_COLORS #if OPT_EXT_COLORS - register Char *fbf = 0; - register Char *fbb = 0; + Char *fbf = 0; + Char *fbb = 0; +#define ColorOf(col) ((fbf[col] << 8) | fbb[col]) #else - register Char *fb = 0; + Char *fb = 0; +#define ColorOf(col) (fb[col]) #endif #endif - int fg = -1, last_fg = -1; - int bg = -1, last_bg = -1; - int cs = CSET_IN; - int last_cs = CSET_IN; - - TRACE(("printLine(row=%d, top=%d:%d, chr=%d):%s\n", - row, screen->topline, screen->max_row, chr, - visibleChars(PAIRED_CHARS(c, - screen->utf8_mode - ? SCRN_BUF_WIDEC(screen,row) - : 0), last))); - - if_OPT_EXT_COLORS(screen,{ - fbf = SCRN_BUF_FGRND(screen, row); - fbb = SCRN_BUF_BGRND(screen, row); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fb = SCRN_BUF_COLOR(screen, row); - }) - while (last > 0) { - if ((a[last-1] & CHARDRAWN) == 0) - last--; - else - break; - } - if (last) { - if (screen->print_attributes) { - send_CharSet(row); - send_SGR(0,-1,-1); - } - for (col = 0; col < last; col++) { - ch = c[col]; - if_OPT_WIDE_CHARS(screen,{ - ch = getXtermCell (screen, row, col); - }) + int fg = -1, last_fg = -1; + int bg = -1, last_bg = -1; + int cs = CSET_IN; + int last_cs = CSET_IN; + + TRACE(("printLine(row=%d, top=%d:%d, chr=%d):%s\n", + row, screen->topline, screen->max_row, chr, + visibleChars(PAIRED_CHARS(c, + screen->utf8_mode + ? SCRN_BUF_WIDEC(screen, row) + : 0), last))); + + if_OPT_EXT_COLORS(screen, { + fbf = SCRN_BUF_FGRND(screen, row); + fbb = SCRN_BUF_BGRND(screen, row); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + fb = SCRN_BUF_COLOR(screen, row); + }); + while (last > 0) { + if ((a[last - 1] & CHARDRAWN) == 0) + last--; + else + break; + } + if (last) { + if (screen->print_attributes) { + send_CharSet(row); + send_SGR(0, -1, -1); + } + for (col = 0; col < last; col++) { + ch = c[col]; + if_OPT_WIDE_CHARS(screen, { + ch = getXtermCell(screen, row, col); + }); #if OPT_PRINT_COLORS - if_OPT_EXT_COLORS(screen,{ - if (screen->print_attributes > 1) { - fg = (a[col] & FG_COLOR) - ? extract_fg((fbf[col]<<8)|(fbb[col]), a[col]) - : -1; - bg = (a[col] & BG_COLOR) - ? extract_bg((fbf[col]<<8)|(fbb[col]), a[col]) - : -1; - } - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - if (screen->print_attributes > 1) { - fg = (a[col] & FG_COLOR) - ? extract_fg(fb[col], a[col]) - : -1; - bg = (a[col] & BG_COLOR) - ? extract_bg(fb[col], a[col]) - : -1; - } - }) + if (screen->colorMode) { + if (screen->print_attributes > 1) { + fg = (a[col] & FG_COLOR) + ? extract_fg(ColorOf(col), a[col]) + : -1; + bg = (a[col] & BG_COLOR) + ? extract_bg(ColorOf(col), a[col]) + : -1; + } + } #endif - if ((((a[col] & SGR_MASK) != attr) + if ((((a[col] & SGR_MASK) != attr) #if OPT_PRINT_COLORS - || (last_fg != fg) || (last_bg != bg) + || (last_fg != fg) || (last_bg != bg) #endif - ) - && ch) { - attr = (a[col] & SGR_MASK); - last_fg = fg; - last_bg = bg; - if (screen->print_attributes) - send_SGR(attr, fg, bg); - } + ) + && ch) { + attr = (a[col] & SGR_MASK); + last_fg = fg; + last_bg = bg; + if (screen->print_attributes) + send_SGR(attr, fg, bg); + } - if (ch == 0) - ch = ' '; + if (ch == 0) + ch = ' '; #if OPT_WIDE_CHARS - if (screen->utf8_mode) - cs = CSET_IN; - else -#endif - cs = (ch >= ' ' && ch != 0x7f) ? CSET_IN : CSET_OUT; - if (last_cs != cs) { - if (screen->print_attributes) { - charToPrinter((cs == CSET_OUT) - ? SHIFT_OUT - : SHIFT_IN); - } - last_cs = cs; - } - - /* FIXME: we shouldn't have to map back from the - * alternate character set, except that the - * corresponding charset information is not encoded - * into the CSETS array. - */ - charToPrinter((cs == CSET_OUT) - ? (ch == 0x7f ? 0x5f : (ch + 0x5f)) - : ch); - } + if (screen->utf8_mode) + cs = CSET_IN; + else +#endif + cs = (ch >= ' ' && ch != 0x7f) ? CSET_IN : CSET_OUT; + if (last_cs != cs) { if (screen->print_attributes) { - send_SGR(0,-1,-1); - if (cs != CSET_IN) - charToPrinter(SHIFT_IN); + charToPrinter((cs == CSET_OUT) + ? SHIFT_OUT + : SHIFT_IN); } - } - if (screen->print_attributes) - charToPrinter('\r'); - charToPrinter(chr); -} + last_cs = cs; + } -void xtermPrintScreen(Boolean use_DECPEX) -{ - register TScreen *screen = &term->screen; - Boolean extent = (use_DECPEX && screen->printer_extent); - int top = extent ? 0 : screen->top_marg; - int bot = extent ? screen->max_row : screen->bot_marg; - int was_open = initialized; - - TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot)); - - while (top <= bot) - printLine(top++, '\n'); - if (screen->printer_formfeed) - charToPrinter('\f'); - - if (!was_open || screen->printer_autoclose) { - closePrinter(); - } + /* FIXME: we shouldn't have to map back from the + * alternate character set, except that the + * corresponding charset information is not encoded + * into the CSETS array. + */ + charToPrinter((cs == CSET_OUT) + ? (ch == 0x7f ? 0x5f : (ch + 0x5f)) + : ch); + } + if (screen->print_attributes) { + send_SGR(0, -1, -1); + if (cs != CSET_IN) + charToPrinter(SHIFT_IN); + } + } + if (screen->print_attributes) + charToPrinter('\r'); + charToPrinter(chr); +} + +void +xtermPrintScreen(Boolean use_DECPEX) +{ + TScreen *screen = &term->screen; + Boolean extent = (use_DECPEX && screen->printer_extent); + int top = extent ? 0 : screen->top_marg; + int bot = extent ? screen->max_row : screen->bot_marg; + int was_open = initialized; + + TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot)); + + while (top <= bot) + printLine(top++, '\n'); + if (screen->printer_formfeed) + charToPrinter('\f'); + + if (!was_open || screen->printer_autoclose) { + closePrinter(); + } } /* @@ -260,160 +262,165 @@ static void xtermPrintEverything(void) { - register TScreen *screen = &term->screen; - int top = 0; - int bot = screen->max_row; - int was_open = initialized; - - if (! screen->altbuf) - top = - screen->savedlines; - - TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot)); - while (top <= bot) - printLine(top++, '\n'); - if (screen->printer_formfeed) - charToPrinter('\f'); - - if (!was_open || screen->printer_autoclose) { - closePrinter(); - } + TScreen *screen = &term->screen; + int top = 0; + int bot = screen->max_row; + int was_open = initialized; + + if (!screen->altbuf) + top = -screen->savedlines; + + TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot)); + while (top <= bot) + printLine(top++, '\n'); + if (screen->printer_formfeed) + charToPrinter('\f'); + + if (!was_open || screen->printer_autoclose) { + closePrinter(); + } } -static void send_CharSet(int row) +static void +send_CharSet(int row) { #if OPT_DEC_CHRSET - register TScreen *screen = &term->screen; - char *msg = 0; + TScreen *screen = &term->screen; + char *msg = 0; - switch (SCRN_BUF_CSETS(screen, row)[0]) { - case CSET_SWL: - msg = "\033#5"; - break; - case CSET_DHL_TOP: - msg = "\033#3"; - break; - case CSET_DHL_BOT: - msg = "\033#4"; - break; - case CSET_DWL: - msg = "\033#6"; - break; - } - if (msg != 0) - stringToPrinter(msg); + switch (SCRN_BUF_CSETS(screen, row)[0]) { + case CSET_SWL: + msg = "\033#5"; + break; + case CSET_DHL_TOP: + msg = "\033#3"; + break; + case CSET_DHL_BOT: + msg = "\033#4"; + break; + case CSET_DWL: + msg = "\033#6"; + break; + } + if (msg != 0) + stringToPrinter(msg); #endif /* OPT_DEC_CHRSET */ } -static void send_SGR(unsigned attr, int fg, int bg) +static void +send_SGR(unsigned attr, int fg, int bg) { - char msg[80]; - strcpy(msg, "\033[0"); - if (attr & BOLD) - strcat(msg, ";1"); - if (attr & UNDERLINE) - strcat(msg, ";4"); /* typo? DEC documents this as '2' */ - if (attr & BLINK) - strcat(msg, ";5"); - if (attr & INVERSE) /* typo? DEC documents this as invisible */ - strcat(msg, ";7"); + char msg[80]; + strcpy(msg, "\033[0"); + if (attr & BOLD) + strcat(msg, ";1"); + if (attr & UNDERLINE) + strcat(msg, ";4"); /* typo? DEC documents this as '2' */ + if (attr & BLINK) + strcat(msg, ";5"); + if (attr & INVERSE) /* typo? DEC documents this as invisible */ + strcat(msg, ";7"); #if OPT_PRINT_COLORS - if (bg >= 0) { - sprintf(msg + strlen(msg), ";%d", (bg < 8) ? (40 + bg) : (92 + bg)); - } - if (fg >= 0) { + if (bg >= 0) { + sprintf(msg + strlen(msg), ";%d", (bg < 8) ? (40 + bg) : (92 + bg)); + } + if (fg >= 0) { #if OPT_PC_COLORS - if (term->screen.boldColors - && fg > 8 - && (attr & BOLD) != 0) - fg -= 8; + if (term->screen.boldColors + && fg > 8 + && (attr & BOLD) != 0) + fg -= 8; #endif - sprintf(msg + strlen(msg), ";%d", (fg < 8) ? (30 + fg) : (82 + fg)); - } + sprintf(msg + strlen(msg), ";%d", (fg < 8) ? (30 + fg) : (82 + fg)); + } #endif - strcat(msg, "m"); - stringToPrinter(msg); + strcat(msg, "m"); + stringToPrinter(msg); } /* * This implementation only knows how to write to a pipe. */ -static void charToPrinter(int chr) +static void +charToPrinter(int chr) { - if (!initialized) { + TScreen *screen = &term->screen; + + if (!initialized && xtermHasPrinter()) { #if defined(VMS) - /* - * This implementation only knows how to write to a file. When - * the file is closed the print command executes. Print - * command must be of the form: - * print/que=name/delete [/otherflags]. - */ - Printer = fopen(VMS_TEMP_PRINT_FILE, "w"); + /* + * This implementation only knows how to write to a file. When the + * file is closed the print command executes. Print command must be of + * the form: + * print/que=name/delete [/otherflags]. + */ + Printer = fopen(VMS_TEMP_PRINT_FILE, "w"); #else - /* - * This implementation only knows how to write to a pipe. - */ - FILE *input; - int my_pipe[2]; - int c; - register TScreen *screen = &term->screen; - - if (pipe(my_pipe)) - SysError (ERROR_FORK); - if ((Printer_pid = fork()) < 0) - SysError (ERROR_FORK); - - if (Printer_pid == 0) { - TRACE(((char *)0)); - close(my_pipe[1]); /* printer is silent */ - close (screen->respond); - - close(fileno(stdout)); - dup2(fileno(stderr), 1); - - if (fileno(stderr) != 2) { - dup2(fileno(stderr), 2); - close(fileno(stderr)); - } - - setgid (screen->gid); /* don't want privileges! */ - setuid (screen->uid); - - Printer = popen(screen->printer_command, "w"); - input = fdopen(my_pipe[0], "r"); - while ((c = fgetc(input)) != EOF) { - fputc(c, Printer); - if (isForm(c)) - fflush(Printer); - } - pclose(Printer); - exit(0); - } else { - close(my_pipe[0]); /* won't read from printer */ - Printer = fdopen(my_pipe[1], "w"); - TRACE(("opened printer from pid %d/%d\n", - (int)getpid(), Printer_pid)); - } -#endif - initialized++; + /* + * This implementation only knows how to write to a pipe. + */ + FILE *input; + int my_pipe[2]; + int c; + + if (pipe(my_pipe)) + SysError(ERROR_FORK); + if ((Printer_pid = fork()) < 0) + SysError(ERROR_FORK); + + if (Printer_pid == 0) { + TRACE(((char *) 0)); + close(my_pipe[1]); /* printer is silent */ + close(screen->respond); + + close(fileno(stdout)); + dup2(fileno(stderr), 1); + + if (fileno(stderr) != 2) { + dup2(fileno(stderr), 2); + close(fileno(stderr)); + } + + setgid(screen->gid); /* don't want privileges! */ + setuid(screen->uid); + + Printer = popen(screen->printer_command, "w"); + input = fdopen(my_pipe[0], "r"); + while ((c = fgetc(input)) != EOF) { + fputc(c, Printer); + if (isForm(c)) + fflush(Printer); + } + pclose(Printer); + exit(0); + } else { + close(my_pipe[0]); /* won't read from printer */ + Printer = fdopen(my_pipe[1], "w"); + TRACE(("opened printer from pid %d/%d\n", + (int) getpid(), Printer_pid)); } - if (Printer != 0) { +#endif + initialized++; + } + if (Printer != 0) { #if OPT_WIDE_CHARS - if (chr > 127) { - Char temp[10]; - *convertToUTF8(temp, chr) = 0; - fputs((char *)temp, Printer); - } else -#endif - fputc(chr, Printer); - if (isForm(chr)) - fflush(Printer); - } + if (chr > 127) { + Char temp[10]; + *convertToUTF8(temp, chr) = 0; + fputs((char *) temp, Printer); + } else +#endif + fputc(chr, Printer); + if (isForm(chr)) + fflush(Printer); + } } -static void stringToPrinter(char *str) +static void +stringToPrinter(char *str) { - while (*str) - charToPrinter(*str++); + while (*str) + charToPrinter(*str++); } /* @@ -422,48 +429,43 @@ * VT330/VT340 Programmer Reference Manual EK-VT3XX-TP-001 (Digital Equipment * Corp., March 1987). */ -void xtermMediaControl (int param, int private_seq) +void +xtermMediaControl(int param, int private_seq) { - register TScreen *screen = &term->screen; + TRACE(("MediaCopy param=%d, private=%d\n", param, private_seq)); - TRACE(("MediaCopy param=%d, private=%d\n", param, private_seq)); - - if (private_seq) { - switch (param) { - case 1: - printCursorLine(); - break; - case 4: - screen->printer_controlmode = 0; - TRACE(("Reset autoprint mode\n")); - break; - case 5: - screen->printer_controlmode = 1; - TRACE(("Set autoprint mode\n")); - break; - case 10: /* VT320 */ - xtermPrintScreen(FALSE); - break; - case 11: /* VT320 */ - xtermPrintEverything(); - break; - } - } else { - switch (param) { - case -1: - case 0: - xtermPrintScreen(TRUE); - break; - case 4: - screen->printer_controlmode = 0; - TRACE(("Reset printer controller mode\n")); - break; - case 5: - screen->printer_controlmode = 2; - TRACE(("Set printer controller mode\n")); - break; - } + if (private_seq) { + switch (param) { + case 1: + printCursorLine(); + break; + case 4: + setPrinterControlMode(0); + break; + case 5: + setPrinterControlMode(1); + break; + case 10: /* VT320 */ + xtermPrintScreen(FALSE); + break; + case 11: /* VT320 */ + xtermPrintEverything(); + break; + } + } else { + switch (param) { + case -1: + case 0: + xtermPrintScreen(TRUE); + break; + case 4: + setPrinterControlMode(0); + break; + case 5: + setPrinterControlMode(2); + break; } + } } /* @@ -472,20 +474,21 @@ * autowrap occurs. The printed line ends with a CR and the character (LF, FF * or VT) that moved the cursor off the previous line. */ -void xtermAutoPrint(int chr) +void +xtermAutoPrint(int chr) { - register TScreen *screen = &term->screen; + TScreen *screen = &term->screen; - if (screen->printer_controlmode == 1) { - TRACE(("AutoPrint %d\n", chr)); - printLine(screen->cursor_row, chr); - if (Printer != 0) - fflush(Printer); - } + if (screen->printer_controlmode == 1) { + TRACE(("AutoPrint %d\n", chr)); + printLine(screen->cursor_row, chr); + if (Printer != 0) + fflush(Printer); + } } /* - * When in printer controller mode, the terminal send received characters to + * When in printer controller mode, the terminal sends received characters to * the printer without displaying them on the screen. The terminal sends all * characters and control sequences to the printer, except NUL, XON, XOFF, and * the printer controller sequences. @@ -496,66 +499,101 @@ */ #define LB '[' -int xtermPrinterControl(int chr) +int +xtermPrinterControl(int chr) { - register TScreen *screen = &term->screen; + TScreen *screen = &term->screen; + /* *INDENT-OFF* */ + static struct { + Char seq[5]; + int active; + } tbl[] = { + { { CSI, '5', 'i' }, 2 }, + { { CSI, '4', 'i' }, 0 }, + { { ESC, LB, '5', 'i' }, 2 }, + { { ESC, LB, '4', 'i' }, 0 }, + }; + /* *INDENT-ON* */ + + static Char bfr[10]; + static size_t length; + size_t n; + + TRACE(("In printer:%04X\n", chr)); + + switch (chr) { + case 0: + case CTRL('Q'): + case CTRL('S'): + return 0; /* ignored by application */ + + case CSI: + case ESC: + case '[': + case '4': + case '5': + case 'i': + bfr[length++] = chr; + for (n = 0; n < sizeof(tbl) / sizeof(tbl[0]); n++) { + size_t len = Strlen(tbl[n].seq); + + if (length == len + && Strcmp(bfr, tbl[n].seq) == 0) { + setPrinterControlMode(tbl[n].active); + if (screen->printer_autoclose + && screen->printer_controlmode == 0) + closePrinter(); + length = 0; + return 0; + } else if (len > length + && Strncmp(bfr, tbl[n].seq, length) == 0) { + return 0; + } + } + length--; - static struct { - Char seq[5]; - int active; - } tbl[] = { - { { CSI, '5', 'i' }, 2 }, - { { CSI, '4', 'i' }, 0 }, - { { ESC, LB, '5', 'i' }, 2 }, - { { ESC, LB, '4', 'i' }, 0 }, - }; - - static Char bfr[10]; - static size_t length; - size_t n; + /* FALLTHRU */ - TRACE(("In printer:%d\n", chr)); + default: + for (n = 0; n < length; n++) + charToPrinter(bfr[n]); + bfr[0] = chr; + length = 1; + return 0; + } +} - switch (chr) { - case 0: - case CTRL('Q'): - case CTRL('S'): - return 0; /* ignored by application */ - - case CSI: - case ESC: - case '[': - case '4': - case '5': - case 'i': - bfr[length++] = chr; - for (n = 0; n < sizeof(tbl)/sizeof(tbl[0]); n++) { - size_t len = Strlen(tbl[n].seq); - - if (length == len - && Strcmp(bfr, tbl[n].seq) == 0) { - screen->printer_controlmode = tbl[n].active; - TRACE(("Set printer controller mode %sactive\n", - tbl[n].active ? "" : "in")); - if (screen->printer_autoclose - && screen->printer_controlmode == 0) - closePrinter(); - length = 0; - return 0; - } else if (len > length - && Strncmp(bfr, tbl[n].seq, length) == 0) { - return 0; - } - } - length--; +/* + * If there is no printer command, we will ignore printer controls. + */ +Boolean +xtermHasPrinter(void) +{ + TScreen *screen = &term->screen; - /* FALLTHRU */ + return (strlen(screen->printer_command) != 0); +} - default: - for (n = 0; n < length; n++) - charToPrinter(bfr[n]); - bfr[0] = chr; - length = 1; - return 0; - } +#define showPrinterControlMode(mode) \ + (((mode) == 0) \ + ? "normal" \ + : ((mode) == 1 \ + ? "autoprint" \ + : "printer controller")) + +void +setPrinterControlMode(int mode) +{ + if (xtermHasPrinter() + && term->screen.printer_controlmode != mode) { + TRACE(("%s %s mode\n", + (mode + ? "set" + : "reset"), + (mode + ? showPrinterControlMode(mode) + : showPrinterControlMode(term->screen.printer_controlmode)))); + term->screen.printer_controlmode = mode; + update_print_redir(); + } } Index: xc/programs/xterm/ptydata.c diff -u xc/programs/xterm/ptydata.c:1.14 xc/programs/xterm/ptydata.c:1.17 --- xc/programs/xterm/ptydata.c:1.14 Wed Aug 15 05:59:26 2001 +++ xc/programs/xterm/ptydata.c Sat Oct 5 13:57:12 2002 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/ptydata.c,v 1.14 2001/08/15 09:59:26 alanh Exp $ + * $XFree86: xc/programs/xterm/ptydata.c,v 1.17 2002/10/05 17:57:12 dickey Exp $ */ /************************************************************ -Copyright 1999-2000 by Thomas E. Dickey +Copyright 1999-2001,2002 by Thomas E. Dickey All Rights Reserved @@ -51,30 +51,19 @@ #endif #endif -int getPtyData(TScreen *screen, fd_set *select_mask, PtyData *data) +int +getPtyData(TScreen * screen, fd_set * select_mask, PtyData * data) { int i; -#ifndef AMOEBA - if (FD_ISSET (screen->respond, select_mask)) -#else - if ((data->cnt = cb_full(screen->tty_outq)) > 0) -#endif - { + if (FD_ISSET(screen->respond, select_mask)) { #ifdef ALLOWLOGGING if (screen->logging) FlushLog(screen); #endif /* set data->ptr here, in case we need it outside this chunk */ data->ptr = DecodedData(data); -#ifndef AMOEBA data->cnt = read(screen->respond, (char *) data->buf, BUF_SIZE); -#else - if ((data->cnt = cb_gets(screen->tty_outq, data->buf, data->cnt, BUF_SIZE)) == 0) { - errno = EIO; - data->cnt = -1; - } -#endif if (data->cnt <= 0) { /* * Yes, I know this is a majorly f*ugly hack, however it seems to @@ -83,15 +72,15 @@ * (and now CYGWIN, alanh@xfree86.org 08/15/01 */ #if (defined(i386) && defined(SVR4) && defined(sun)) || defined(__CYGWIN__) - if (errno == EIO || errno == 0 ) + if (errno == EIO || errno == 0) #else if (errno == EIO) #endif - Cleanup (0); + Cleanup(0); else if (!E_TEST(errno)) Panic("input: read returned unexpected error (%d)\n", errno); } else if (data->cnt == 0) { -#if defined(MINIX) || defined(__EMX__) +#if defined(__UNIXOS2__) Cleanup(0); #else Panic("input: read returned zero\n", 0); @@ -106,13 +95,13 @@ if (c < 0x80) { /* We received an ASCII character */ if (screen->utf_count > 0) - data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ + data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ data->buf2[j++] = c; screen->utf_count = 0; } else if (c < 0xc0) { /* We received a continuation byte */ if (screen->utf_count < 1) { - data->buf2[j++] = UCS_REPL; /* ... unexpectedly */ + data->buf2[j++] = UCS_REPL; /* ... unexpectedly */ } else { /* Check for overlong UTF-8 sequences for which a shorter * encoding would exist and replace them with UCS_REPL. @@ -132,12 +121,14 @@ /* value would be >0xffff */ screen->utf_char = UCS_REPL; } else { - screen->utf_char <<= 6; - screen->utf_char |= (c & 0x3f); + screen->utf_char <<= 6; + screen->utf_char |= (c & 0x3f); } - if ((screen->utf_char >= 0xd800 && screen->utf_char <= 0xdfff) || - (screen->utf_char == 0xfffe) || (screen->utf_char == 0xffff)) { - screen->utf_char = UCS_REPL; + if ((screen->utf_char >= 0xd800 && + screen->utf_char <= 0xdfff) || + (screen->utf_char == 0xfffe) || + (screen->utf_char == 0xffff)) { + screen->utf_char = UCS_REPL; } screen->utf_count--; if (screen->utf_count == 0) @@ -146,12 +137,12 @@ } else { /* We received a sequence start byte */ if (screen->utf_count > 0) - data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ + data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ if (c < 0xe0) { screen->utf_count = 1; screen->utf_char = (c & 0x1f); if (!(c & 0x1e)) - screen->utf_char = UCS_REPL; /* overlong sequence */ + screen->utf_char = UCS_REPL; /* overlong sequence */ } else if (c < 0xf0) { screen->utf_count = 2; screen->utf_char = (c & 0x0f); @@ -169,16 +160,16 @@ screen->utf_count = 0; } } - } /* for (i = 0; i < data->cnt; i++) */ + } /* for (i = 0; i < data->cnt; i++) */ TRACE(("UTF-8 count %d, char %04X input %d/%d bytes\n", - screen->utf_count, - screen->utf_char, - data->cnt, j)); + screen->utf_count, + screen->utf_char, + data->cnt, j)); data->cnt = j; } else { for (i = 0; i < data->cnt; i++) data->ptr[i] = data->buf[i]; - } /* if (screen->utf8_mode) else */ + } /* if (screen->utf8_mode) else */ #endif /* read from pty was successful */ if (!screen->output_eight_bits) { @@ -188,7 +179,8 @@ } #if OPT_TRACE for (i = 0; i < data->cnt; i++) { - if (!(i%8)) TRACE(("%s", i ? "\n " : "READ")); + if (!(i % 8)) + TRACE(("%s", i ? "\n " : "READ")); TRACE((" %04X", data->ptr[i])); } TRACE(("\n")); @@ -199,7 +191,8 @@ return 0; } -void initPtyData(PtyData *data) +void +initPtyData(PtyData * data) { data->cnt = 0; data->ptr = DecodedData(data); @@ -208,13 +201,15 @@ /* * Tells how much we have used out of the current buffer */ -unsigned usedPtyData(PtyData *data) +unsigned +usedPtyData(PtyData * data) { return (data->ptr - DecodedData(data)); } #if OPT_WIDE_CHARS -Char * convertToUTF8(Char *lp, unsigned c) +Char * +convertToUTF8(Char * lp, unsigned c) { if (c < 0x80) { /* 0******* */ *lp++ = (c); @@ -236,7 +231,8 @@ /* * Write data back to the PTY */ -void writePtyData(int f, IChar *d, unsigned len) +void +writePtyData(int f, IChar * d, unsigned len) { static Char *dbuf; static unsigned dlen; @@ -244,7 +240,7 @@ if (dlen <= len) { dlen = n; - dbuf = (Char *)XtRealloc((char *)dbuf, dlen); + dbuf = (Char *) XtRealloc((char *) dbuf, dlen); } for (n = 0; n < len; n++) Index: xc/programs/xterm/ptyx.h diff -u xc/programs/xterm/ptyx.h:3.91 xc/programs/xterm/ptyx.h:3.100 --- xc/programs/xterm/ptyx.h:3.91 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/ptyx.h Tue Feb 25 18:36:55 2003 @@ -2,7 +2,7 @@ * $Xorg: ptyx.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/ptyx.h,v 3.91 2002/01/05 22:05:03 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/ptyx.h,v 3.100 2003/02/25 23:36:55 dickey Exp $ */ /* * Copyright 1999,2000,2001,2002 by Thomas E. Dickey @@ -67,12 +67,13 @@ /* @(#)ptyx.h X10/6.6 11/10/86 */ #include <X11/IntrinsicP.h> +#include <X11/Shell.h> /* for XtNdieCallback, etc. */ +#include <X11/StringDefs.h> /* for standard resource names */ #include <X11/Xmu/Misc.h> /* For Max() and Min(). */ #include <X11/Xfuncs.h> #include <X11/Xosdefs.h> #include <X11/Xmu/Converters.h> #ifdef XRENDERFONT -#include <X11/extensions/Xrender.h> #include <X11/Xft/Xft.h> #endif @@ -85,17 +86,6 @@ #define MyStackFree(pointer, stack_cache_array) \ if ((pointer) != ((char *)(stack_cache_array))) free(pointer) -#ifdef AMOEBA -/* Avoid name clashes with standard Amoeba types: */ -#define event am_event_t -#define interval am_interval_t -#include <amoeba.h> -#include <semaphore.h> -#include <circbuf.h> -#undef event -#undef interval -#endif - /* ** System V definitions */ @@ -125,7 +115,7 @@ #define USE_PTY_DEVICE 1 #define USE_PTY_SEARCH 1 -#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) +#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__NetBSD__) #undef USE_PTY_DEVICE #undef USE_PTY_SEARCH #define USE_PTS_DEVICE 1 @@ -177,11 +167,11 @@ #ifdef __hpux #define PTYCHAR1 "zyxwvutsrqp" #else /* !__hpux */ -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define PTYCHAR1 "pq" #else #define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" -#endif /* !__EMX__ */ +#endif /* !__UNIXOS2__ */ #endif /* !__hpux */ #endif /* !PTYCHAR1 */ @@ -492,16 +482,20 @@ #define OPT_HIGHLIGHT_COLOR 1 /* true if xterm supports color highlighting */ #endif +#ifndef OPT_LUIT_PROG +#define OPT_LUIT_PROG 0 /* true if xterm supports luit */ +#endif + #ifndef OPT_MAXIMIZE #define OPT_MAXIMIZE 1 /* add actions for iconify ... maximize */ #endif -#ifndef OPT_NUM_LOCK -#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ +#ifndef OPT_MOD_FKEYS +#define OPT_MOD_FKEYS 1 /* modify cursor- and function-keys in normal mode */ #endif -#ifndef OPT_SAME_NAME -#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ +#ifndef OPT_NUM_LOCK +#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ #endif #ifndef OPT_PC_COLORS @@ -512,10 +506,26 @@ #define OPT_PRINT_COLORS 1 /* true if we print color information */ #endif +#ifndef OPT_READLINE +#define OPT_READLINE 0 /* mouse-click/paste support for readline */ +#endif + +#ifndef OPT_SAME_NAME +#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ +#endif + #ifndef OPT_SCO_FUNC_KEYS #define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ #endif +#ifndef OPT_SESSION_MGT +#if defined(XtNdieCallback) && defined(XtNsaveCallback) +#define OPT_SESSION_MGT 1 +#else +#define OPT_SESSION_MGT 0 +#endif +#endif + #ifndef OPT_SHIFT_FONTS #define OPT_SHIFT_FONTS 1 /* true if xterm interprets fontsize-shifting */ #endif @@ -560,27 +570,38 @@ #if OPT_AIX_COLORS && !OPT_ISO_COLORS /* You must have ANSI/ISO colors to support AIX colors */ -#undef OPT_AIX_COLORS +#undef OPT_AIX_COLORS +#define OPT_AIX_COLORS 0 #endif #if OPT_PC_COLORS && !OPT_ISO_COLORS /* You must have ANSI/ISO colors to support PC colors */ -#undef OPT_PC_COLORS +#undef OPT_PC_COLORS +#define OPT_PC_COLORS 0 +#endif + +#if OPT_PRINT_COLORS && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to be able to print them */ +#undef OPT_PRINT_COLORS +#define OPT_PRINT_COLORS 0 #endif #if OPT_256_COLORS && !OPT_ISO_COLORS /* You must have ANSI/ISO colors to support 256 colors */ -#undef OPT_256_COLORS +#undef OPT_256_COLORS +#define OPT_256_COLORS 0 #endif #if OPT_88_COLORS && !OPT_ISO_COLORS /* You must have ANSI/ISO colors to support 88 colors */ -#undef OPT_88_COLORS +#undef OPT_88_COLORS +#define OPT_88_COLORS 0 #endif #if OPT_88_COLORS && OPT_256_COLORS /* 256 colors supersedes 88 colors */ -#undef OPT_88_COLORS +#undef OPT_88_COLORS +#define OPT_88_COLORS 0 #endif /***====================================================================***/ @@ -636,7 +657,7 @@ /* Define a fake XK code, we need it for the fake color response in * xtermcapKeycode(). */ -#ifdef OPT_TCAP_QUERY +#if OPT_TCAP_QUERY # define XK_COLORS 0x0003 #endif @@ -717,6 +738,10 @@ #define CurFontWidth(screen, row) FontWidth(screen) #endif +#if OPT_LUIT_PROG && !OPT_WIDE_CHARS +#error Luit requires the wide-chars configuration +#endif + /* the number of pointers per row in 'ScrnBuf' */ #if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS #define MAX_PTRS term->num_ptrs @@ -1012,11 +1037,6 @@ #if OPT_TCAP_QUERY int tc_query; #endif -#ifdef AMOEBA - capability proccap; /* process capability */ - struct circbuf *tty_inq; /* tty server input queue */ - struct circbuf *tty_outq; /* tty server output queue */ -#endif long pid; /* pid of process on far side */ int uid; /* user id of actual person */ int gid; /* group id of actual person */ @@ -1030,6 +1050,7 @@ Pixel mousecolorback; /* Mouse color background */ #if OPT_ISO_COLORS ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ + int veryBoldColors; /* modifier for boldColors */ Boolean boldColors; /* can we make bold colors? */ Boolean colorMode; /* are we using color mode? */ Boolean colorULMode; /* use color for underline? */ @@ -1050,6 +1071,7 @@ #endif #if OPT_WIDE_CHARS Boolean wide_chars; /* true when 16-bit chars */ + Boolean vt100_graphics; /* true to allow vt100-graphics */ int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ int utf_count; /* state of utf_char */ IChar utf_char; /* in-progress character */ @@ -1059,6 +1081,14 @@ unsigned long event_mask; unsigned short send_mouse_pos; /* user wants mouse transition */ /* and position information */ +#if OPT_READLINE + unsigned click1_moves; + unsigned paste_moves; + unsigned dclick3_deletes; + unsigned paste_brackets; + unsigned paste_quotes; + unsigned paste_literal_nl; +#endif /* OPT_READLINE */ #if OPT_DEC_LOCATOR Boolean locator_reset; /* turn mouse off after 1 report? */ Boolean locator_pixels; /* report in pixels? */ @@ -1077,6 +1107,7 @@ Boolean visualbell; /* visual bell mode */ Boolean poponbell; /* pop on bell mode */ Boolean allowSendEvents;/* SendEvent mode */ + Boolean allowWindowOps; /* WindowOps mode */ Boolean awaitInput; /* select-timeout mode */ Boolean grabbedKbd; /* keyboard is grabbed */ #ifdef ALLOWLOGGING @@ -1103,9 +1134,7 @@ Boolean printer_extent; /* print complete page */ Boolean printer_formfeed; /* print formfeed per function */ int printer_controlmode; /* 0=off, 1=auto, 2=controller */ -#if OPT_PRINT_COLORS int print_attributes; /* 0=off, 1=normal, 2=color */ -#endif Boolean fnt_prop; /* true if proportional fonts */ Boolean fnt_boxes; /* true if font has box-chars */ @@ -1280,7 +1309,7 @@ XftFont *renderFontBold; XftDraw *renderDraw; #endif -#ifdef OPT_INPUT_METHOD +#if OPT_INPUT_METHOD XFontSet fs; /* fontset for XIM preedit */ int fs_ascent; /* ascent of fs */ #endif @@ -1296,8 +1325,17 @@ Dimension menu_height; /* ...and its height */ #endif } TekPart; - +#if OPT_READLINE +#define SCREEN_FLAG(screenp,f) (1&(screenp)->f) +#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) +#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= ~1L) +#define SCREEN_FLAG_save(screenp,f) \ + ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) +#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) +#else +#define SCREEN_FLAG(screenp,f) (0) +#endif /* meaning of bits in screen.select flag */ #define INWINDOW 01 /* the mouse is in one of the windows */ @@ -1321,6 +1359,7 @@ #if OPT_INITIAL_ERASE int reset_DECBKM; /* reset should set DECBKM */ #endif + int modify_cursor_keys; /* how to handle modifiers */ } TKeyboard; typedef struct _Misc { @@ -1331,7 +1370,14 @@ #if OPT_WIDE_CHARS char *f_w; char *f_wb; + Boolean cjk_width; /* true when CJK width convention is turned on */ #endif +#if OPT_LUIT_PROG + Boolean callfilter; /* true to invoke luit */ + Boolean use_encoding; /* true to use -encoding option for luit */ + char *locale_str; /* "locale" resource */ + char *localefilter; /* path for luit */ +#endif #if OPT_INPUT_METHOD char *f_x; #endif @@ -1423,8 +1469,11 @@ #define N_MARGINBELL 10 -#define MAX_TABS 320 + +#define TAB_BITS_SHIFT 5 /* 2**5 == 32 */ +#define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) #define TAB_ARRAY_SIZE 10 /* number of ints to provide MAX_TABS bits */ +#define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) typedef unsigned Tabs [TAB_ARRAY_SIZE]; Index: xc/programs/xterm/resize.c diff -u xc/programs/xterm/resize.c:3.51 xc/programs/xterm/resize.c:3.55 --- xc/programs/xterm/resize.c:3.51 Tue Oct 9 17:52:40 2001 +++ xc/programs/xterm/resize.c Fri Dec 27 16:05:23 2002 @@ -2,7 +2,7 @@ * $Xorg: resize.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/resize.c,v 3.51 2001/10/09 21:52:40 alanh Exp $ */ +/* $XFree86: xc/programs/xterm/resize.c,v 3.55 2002/12/27 21:05:23 dickey Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -27,7 +27,6 @@ * SOFTWARE. */ - /* resize.c */ #include <xterm.h> @@ -40,7 +39,7 @@ #define CANT_OPEN_DEV_TTY #endif -#ifndef USE_TERMINFO /* avoid conflict with configure script */ +#ifndef USE_TERMINFO /* avoid conflict with configure script */ #if defined(__QNX__) || defined(SCO) || defined(sco) || defined(linux) || defined(__OpenBSD__) #define USE_TERMINFO #endif @@ -71,12 +70,6 @@ #define bzero(s, n) memset(s, 0, n) #endif -#ifdef MINIX -#ifndef IUCLC -#define IUCLC 0 -#endif -#endif - #ifdef __MVS__ #define ESCAPE(string) "\047" string #else @@ -92,46 +85,53 @@ #define SHELL_UNKNOWN 0 #define SHELL_C 1 #define SHELL_BOURNE 2 +/* *INDENT-OFF* */ struct { - char *name; - int type; + char *name; + int type; } shell_list[] = { - { "csh", SHELL_C }, /* vanilla cshell */ - { "tcsh", SHELL_C }, - { "jcsh", SHELL_C }, - { "sh", SHELL_BOURNE }, /* vanilla Bourne shell */ - { "ksh", SHELL_BOURNE }, /* Korn shell (from AT&T toolchest) */ - { "ksh-i", SHELL_BOURNE }, /* other name for latest Korn shell */ - { "bash", SHELL_BOURNE }, /* GNU Bourne again shell */ - { "jsh", SHELL_BOURNE }, - { NULL, SHELL_BOURNE } /* default (same as xterm's) */ + { "csh", SHELL_C }, /* vanilla cshell */ + { "tcsh", SHELL_C }, + { "jcsh", SHELL_C }, + { "sh", SHELL_BOURNE }, /* vanilla Bourne shell */ + { "ksh", SHELL_BOURNE }, /* Korn shell (from AT&T toolchest) */ + { "ksh-i", SHELL_BOURNE }, /* other name for latest Korn shell */ + { "bash", SHELL_BOURNE }, /* GNU Bourne again shell */ + { "jsh", SHELL_BOURNE }, + { NULL, SHELL_BOURNE } /* default (same as xterm's) */ }; +/* *INDENT-ON* */ -char *emuname[EMULATIONS] = { - "VT100", - "Sun", +char *emuname[EMULATIONS] = +{ + "VT100", + "Sun", }; char *myname; int shell_type = SHELL_UNKNOWN; -char *getsize[EMULATIONS] = { - ESCAPE("7") ESCAPE("[r") ESCAPE("[999;999H") ESCAPE("[6n"), - ESCAPE("[18t"), +char *getsize[EMULATIONS] = +{ + ESCAPE("7") ESCAPE("[r") ESCAPE("[999;999H") ESCAPE("[6n"), + ESCAPE("[18t"), }; #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) #elif defined(TIOCSWINSZ) -char *getwsize[EMULATIONS] = { /* size in pixels */ - 0, - ESCAPE("[14t"), +char *getwsize[EMULATIONS] = +{ /* size in pixels */ + 0, + ESCAPE("[14t"), }; -#endif /* sun vs TIOCSWINSZ */ -char *restore[EMULATIONS] = { - ESCAPE("8"), - 0, +#endif /* sun vs TIOCSWINSZ */ +char *restore[EMULATIONS] = +{ + ESCAPE("8"), + 0, }; char *setname = ""; -char *setsize[EMULATIONS] = { - 0, - ESCAPE("[8;%s;%st"), +char *setsize[EMULATIONS] = +{ + 0, + ESCAPE("[8;%s;%st"), }; #ifdef USE_ANY_SYSV_TERMIO @@ -140,11 +140,12 @@ struct termios tioorig; #else struct sgttyb sgorig; -#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ -char *size[EMULATIONS] = { - ESCAPE("[%d;%dR"), - ESCAPE("[8;%d;%dt"), +char *size[EMULATIONS] = +{ + ESCAPE("[%d;%dR"), + ESCAPE("[8;%d;%dt"), }; char sunname[] = "sunsize"; int tty; @@ -152,19 +153,20 @@ #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) #elif defined(TIOCSWINSZ) -char *wsize[EMULATIONS] = { - 0, - ESCAPE("[4;%hd;%hdt"), +char *wsize[EMULATIONS] = +{ + 0, + ESCAPE("[4;%hd;%hdt"), }; -#endif /* sun vs TIOCSWINSZ */ +#endif /* sun vs TIOCSWINSZ */ -static SIGNAL_T onintr (int sig); -static SIGNAL_T resize_timeout (int sig); -static int checkdigits (char *str); -static void Usage (void); -static void readstring (FILE *fp, char *buf, char *str); +static SIGNAL_T onintr(int sig); +static SIGNAL_T resize_timeout(int sig); +static int checkdigits(char *str); +static void Usage(void); +static void readstring(FILE * fp, char *buf, char *str); -#undef US /* may conflict with curses.h */ +#undef US /* may conflict with curses.h */ #ifdef USE_TERMCAP #ifdef HAVE_TERMCAP_H @@ -184,344 +186,374 @@ #ifdef HAVE_NCURSES_TERM_H #include <ncurses/term.h> #else -#include <term.h> /* tgetent() */ -#endif /*CYGWIN*/ +#include <term.h> /* tgetent() */ +#endif /*CYGWIN */ #endif #endif /* HAVE_TERMCAP_H */ #endif #define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ +#ifdef USE_TERMCAP +static void +print_termcap(const char *termcap) +{ + int ch; + + putchar('\''); + while ((ch = *termcap++) != '\0') { + switch (ch & 0xff) { + case 127: /* undo bug in GNU termcap */ + printf("^?"); + break; + case '\'': /* must escape anyway (unlikely) */ + /* FALLTHRU */ + case '!': /* must escape for SunOS csh */ + putchar('\\'); + /* FALLTHRU */ + default: + putchar(ch); + break; + } + } + putchar('\''); +} +#endif /* USE_TERMCAP */ + /* resets termcap string to reflect current screen size */ int -main (int argc, char **argv) +main(int argc, char **argv ENVP_ARG) { - register char *ptr, *env; - register int emu = VT100; - char *shell; - struct passwd *pw; - int i; - int rows, cols; + register char *ptr, *env; + register int emu = VT100; + char *shell; + struct passwd *pw; + int i; + int rows, cols; #ifdef USE_ANY_SYSV_TERMIO - struct termio tio; + struct termio tio; #elif defined(USE_TERMIOS) - struct termios tio; + struct termios tio; #else - struct sgttyb sg; -#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ + struct sgttyb sg; +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ #ifdef USE_TERMCAP - int ok_tcap = 1; - char termcap [TERMCAP_SIZE]; - char newtc [TERMCAP_SIZE]; + int ok_tcap = 1; + char termcap[TERMCAP_SIZE]; + char newtc[TERMCAP_SIZE]; #endif /* USE_TERMCAP */ - char buf[BUFSIZ]; + char buf[BUFSIZ]; #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - struct ttysize ts; + struct ttysize ts; #elif defined(TIOCSWINSZ) - struct winsize ws; -#endif /* sun vs TIOCSWINSZ */ - char *name_of_tty; + struct winsize ws; +#endif /* sun vs TIOCSWINSZ */ + char *name_of_tty; #ifdef CANT_OPEN_DEV_TTY - extern char *ttyname(); + extern char *ttyname(); #endif - - myname = x_basename(argv[0]); - if(strcmp(myname, sunname) == 0) - emu = SUN; - for(argv++, argc-- ; argc > 0 && **argv == '-' ; argv++, argc--) { - switch((*argv)[1]) { - case 's': /* Sun emulation */ - if(emu == SUN) - Usage(); /* Never returns */ - emu = SUN; - break; - case 'u': /* Bourne (Unix) shell */ - shell_type = SHELL_BOURNE; - break; - case 'c': /* C shell */ - shell_type = SHELL_C; - break; - default: - Usage(); /* Never returns */ - } - } - - if (SHELL_UNKNOWN == shell_type) { - /* Find out what kind of shell this user is running. - * This is the same algorithm that xterm uses. - */ - if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && - (((pw = getpwuid(getuid())) == NULL) || - *(ptr = pw->pw_shell) == 0)) - /* this is the same default that xterm uses */ - ptr = "/bin/sh"; - - shell = x_basename(ptr); - - /* now that we know, what kind is it? */ - for (i = 0; shell_list[i].name; i++) - if (!strcmp(shell_list[i].name, shell)) - break; - shell_type = shell_list[i].type; - } - if(argc == 2) { - if(!setsize[emu]) { - fprintf(stderr, - "%s: Can't set window size under %s emulation\n", - myname, emuname[emu]); - exit(1); - } - if(!checkdigits(argv[0]) || !checkdigits(argv[1])) - Usage(); /* Never returns */ - } else if(argc != 0) + myname = x_basename(argv[0]); + if (strcmp(myname, sunname) == 0) + emu = SUN; + for (argv++, argc--; argc > 0 && **argv == '-'; argv++, argc--) { + switch ((*argv)[1]) { + case 's': /* Sun emulation */ + if (emu == SUN) Usage(); /* Never returns */ + emu = SUN; + break; + case 'u': /* Bourne (Unix) shell */ + shell_type = SHELL_BOURNE; + break; + case 'c': /* C shell */ + shell_type = SHELL_C; + break; + default: + Usage(); /* Never returns */ + } + } + + if (SHELL_UNKNOWN == shell_type) { + /* Find out what kind of shell this user is running. + * This is the same algorithm that xterm uses. + */ + if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + (((pw = getpwuid(getuid())) == NULL) || + *(ptr = pw->pw_shell) == 0)) + /* this is the same default that xterm uses */ + ptr = "/bin/sh"; + + shell = x_basename(ptr); + + /* now that we know, what kind is it? */ + for (i = 0; shell_list[i].name; i++) + if (!strcmp(shell_list[i].name, shell)) + break; + shell_type = shell_list[i].type; + } + + if (argc == 2) { + if (!setsize[emu]) { + fprintf(stderr, + "%s: Can't set window size under %s emulation\n", + myname, emuname[emu]); + exit(1); + } + if (!checkdigits(argv[0]) || !checkdigits(argv[1])) + Usage(); /* Never returns */ + } else if (argc != 0) + Usage(); /* Never returns */ #ifdef CANT_OPEN_DEV_TTY - if ((name_of_tty = ttyname(fileno(stderr))) == NULL) + if ((name_of_tty = ttyname(fileno(stderr))) == NULL) #endif - name_of_tty = "/dev/tty"; + name_of_tty = "/dev/tty"; - if ((ttyfp = fopen (name_of_tty, "r+")) == NULL) { - fprintf (stderr, "%s: can't open terminal %s\n", - myname, name_of_tty); - exit (1); - } - tty = fileno(ttyfp); + if ((ttyfp = fopen(name_of_tty, "r+")) == NULL) { + fprintf(stderr, "%s: can't open terminal %s\n", + myname, name_of_tty); + exit(1); + } + tty = fileno(ttyfp); #ifdef USE_TERMCAP - if(!(env = getenv("TERM")) || !*env) { - env = DFT_TERMTYPE; - if(SHELL_BOURNE == shell_type) - setname = "TERM=xterm;\nexport TERM;\n"; - else - setname = "setenv TERM xterm;\n"; - } - termcap[0] = 0; /* ...just in case we've accidentally gotten terminfo */ - if(tgetent (termcap, env) <= 0 || termcap[0] == 0) - ok_tcap = 0; + if (!(env = getenv("TERM")) || !*env) { + env = DFT_TERMTYPE; + if (SHELL_BOURNE == shell_type) + setname = "TERM=xterm;\nexport TERM;\n"; + else + setname = "setenv TERM xterm;\n"; + } + termcap[0] = 0; /* ...just in case we've accidentally gotten terminfo */ + if (tgetent(termcap, env) <= 0 || termcap[0] == 0) + ok_tcap = 0; #endif /* USE_TERMCAP */ #ifdef USE_TERMINFO - if(!(env = getenv("TERM")) || !*env) { - env = DFT_TERMTYPE; - if(SHELL_BOURNE == shell_type) - setname = "TERM=xterm;\nexport TERM;\n"; - else setname = "setenv TERM xterm;\n"; - } -#endif /* USE_TERMINFO */ + if (!(env = getenv("TERM")) || !*env) { + env = DFT_TERMTYPE; + if (SHELL_BOURNE == shell_type) + setname = "TERM=xterm;\nexport TERM;\n"; + else + setname = "setenv TERM xterm;\n"; + } +#endif /* USE_TERMINFO */ #ifdef USE_ANY_SYSV_TERMIO - ioctl (tty, TCGETA, &tioorig); - tio = tioorig; - tio.c_iflag &= ~(ICRNL | IUCLC); - tio.c_lflag &= ~(ICANON | ECHO); - tio.c_cflag |= CS8; - tio.c_cc[VMIN] = 6; - tio.c_cc[VTIME] = 1; + ioctl(tty, TCGETA, &tioorig); + tio = tioorig; + tio.c_iflag &= ~(ICRNL | IUCLC); + tio.c_lflag &= ~(ICANON | ECHO); + tio.c_cflag |= CS8; + tio.c_cc[VMIN] = 6; + tio.c_cc[VTIME] = 1; #elif defined(USE_TERMIOS) - tcgetattr(tty, &tioorig); - tio = tioorig; - tio.c_iflag &= ~ICRNL; - tio.c_lflag &= ~(ICANON | ECHO); - tio.c_cflag |= CS8; - tio.c_cc[VMIN] = 6; - tio.c_cc[VTIME] = 1; -#else /* not USE_TERMIOS */ - ioctl (tty, TIOCGETP, &sgorig); - sg = sgorig; - sg.sg_flags |= RAW; - sg.sg_flags &= ~ECHO; -#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ - signal(SIGINT, onintr); - signal(SIGQUIT, onintr); - signal(SIGTERM, onintr); + tcgetattr(tty, &tioorig); + tio = tioorig; + tio.c_iflag &= ~ICRNL; + tio.c_lflag &= ~(ICANON | ECHO); + tio.c_cflag |= CS8; + tio.c_cc[VMIN] = 6; + tio.c_cc[VTIME] = 1; +#else /* not USE_TERMIOS */ + ioctl(tty, TIOCGETP, &sgorig); + sg = sgorig; + sg.sg_flags |= RAW; + sg.sg_flags &= ~ECHO; +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ + signal(SIGINT, onintr); + signal(SIGQUIT, onintr); + signal(SIGTERM, onintr); #ifdef USE_ANY_SYSV_TERMIO - ioctl (tty, TCSETAW, &tio); + ioctl(tty, TCSETAW, &tio); #elif defined(USE_TERMIOS) - tcsetattr(tty, TCSADRAIN, &tio); -#else /* not USE_TERMIOS */ - ioctl (tty, TIOCSETP, &sg); -#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ - - if (argc == 2) { - sprintf (buf, setsize[emu], argv[0], argv[1]); - write(tty, buf, strlen(buf)); - } - write(tty, getsize[emu], strlen(getsize[emu])); - readstring(ttyfp, buf, size[emu]); - if(sscanf (buf, size[emu], &rows, &cols) != 2) { - fprintf(stderr, "%s: Can't get rows and columns\r\n", myname); - onintr(0); - } - if(restore[emu]) - write(tty, restore[emu], strlen(restore[emu])); + tcsetattr(tty, TCSADRAIN, &tio); +#else /* not USE_TERMIOS */ + ioctl(tty, TIOCSETP, &sg); +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ + + if (argc == 2) { + sprintf(buf, setsize[emu], argv[0], argv[1]); + write(tty, buf, strlen(buf)); + } + write(tty, getsize[emu], strlen(getsize[emu])); + readstring(ttyfp, buf, size[emu]); + if (sscanf(buf, size[emu], &rows, &cols) != 2) { + fprintf(stderr, "%s: Can't get rows and columns\r\n", myname); + onintr(0); + } + if (restore[emu]) + write(tty, restore[emu], strlen(restore[emu])); #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - /* finally, set the tty's window size */ - if (ioctl (tty, TIOCGSIZE, &ts) != -1) { - ts.ts_lines = rows; - ts.ts_cols = cols; - ioctl (tty, TIOCSSIZE, &ts); - } + /* finally, set the tty's window size */ + if (ioctl(tty, TIOCGSIZE, &ts) != -1) { + ts.ts_lines = rows; + ts.ts_cols = cols; + ioctl(tty, TIOCSSIZE, &ts); + } #elif defined(TIOCSWINSZ) - /* finally, set the tty's window size */ - if(getwsize[emu]) { - /* get the window size in pixels */ - write (tty, getwsize[emu], strlen (getwsize[emu])); - readstring(ttyfp, buf, wsize[emu]); - if(sscanf (buf, wsize[emu], &ws.ws_xpixel, &ws.ws_ypixel) != 2) { - fprintf(stderr, "%s: Can't get window size\r\n", myname); - onintr(0); - } - ws.ws_row = rows; - ws.ws_col = cols; - ioctl (tty, TIOCSWINSZ, &ws); - } else if (ioctl (tty, TIOCGWINSZ, &ws) != -1) { - /* we don't have any way of directly finding out - the current height & width of the window in pixels. We try - our best by computing the font height and width from the "old" - struct winsize values, and multiplying by these ratios...*/ - if (ws.ws_col != 0) - ws.ws_xpixel = cols * (ws.ws_xpixel / ws.ws_col); - if (ws.ws_row != 0) - ws.ws_ypixel = rows * (ws.ws_ypixel / ws.ws_row); - ws.ws_row = rows; - ws.ws_col = cols; - ioctl (tty, TIOCSWINSZ, &ws); - } -#endif /* sun vs TIOCSWINSZ */ + /* finally, set the tty's window size */ + if (getwsize[emu]) { + /* get the window size in pixels */ + write(tty, getwsize[emu], strlen(getwsize[emu])); + readstring(ttyfp, buf, wsize[emu]); + if (sscanf(buf, wsize[emu], &ws.ws_xpixel, &ws.ws_ypixel) != 2) { + fprintf(stderr, "%s: Can't get window size\r\n", myname); + onintr(0); + } + ws.ws_row = rows; + ws.ws_col = cols; + ioctl(tty, TIOCSWINSZ, &ws); + } else if (ioctl(tty, TIOCGWINSZ, &ws) != -1) { + /* we don't have any way of directly finding out + the current height & width of the window in pixels. We try + our best by computing the font height and width from the "old" + struct winsize values, and multiplying by these ratios... */ + if (ws.ws_col != 0) + ws.ws_xpixel = cols * (ws.ws_xpixel / ws.ws_col); + if (ws.ws_row != 0) + ws.ws_ypixel = rows * (ws.ws_ypixel / ws.ws_row); + ws.ws_row = rows; + ws.ws_col = cols; + ioctl(tty, TIOCSWINSZ, &ws); + } +#endif /* sun vs TIOCSWINSZ */ #ifdef USE_ANY_SYSV_TERMIO - ioctl (tty, TCSETAW, &tioorig); + ioctl(tty, TCSETAW, &tioorig); #elif defined(USE_TERMIOS) - tcsetattr(tty, TCSADRAIN, &tioorig); -#else /* not USE_TERMIOS */ - ioctl (tty, TIOCSETP, &sgorig); -#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ - signal(SIGINT, SIG_DFL); - signal(SIGQUIT, SIG_DFL); - signal(SIGTERM, SIG_DFL); + tcsetattr(tty, TCSADRAIN, &tioorig); +#else /* not USE_TERMIOS */ + ioctl(tty, TIOCSETP, &sgorig); +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); #ifdef USE_TERMCAP - if (ok_tcap) { - /* update termcap string */ - /* first do columns */ - if ((ptr = x_strindex (termcap, "co#")) == NULL) { - fprintf(stderr, "%s: No `co#'\n", myname); - exit (1); - } - - i = ptr - termcap + 3; - strncpy (newtc, termcap, i); - sprintf (newtc + i, "%d", cols); - ptr = strchr(ptr, ':'); - strcat (newtc, ptr); - - /* now do lines */ - if ((ptr = x_strindex (newtc, "li#")) == NULL) { - fprintf(stderr, "%s: No `li#'\n", myname); - exit (1); - } - - i = ptr - newtc + 3; - strncpy (termcap, newtc, i); - sprintf (termcap + i, "%d", rows); - ptr = strchr(ptr, ':'); - strcat (termcap, ptr); - } + if (ok_tcap) { + /* update termcap string */ + /* first do columns */ + if ((ptr = x_strindex(termcap, "co#")) == NULL) { + fprintf(stderr, "%s: No `co#'\n", myname); + exit(1); + } + + i = ptr - termcap + 3; + strncpy(newtc, termcap, i); + sprintf(newtc + i, "%d", cols); + ptr = strchr(ptr, ':'); + strcat(newtc, ptr); + + /* now do lines */ + if ((ptr = x_strindex(newtc, "li#")) == NULL) { + fprintf(stderr, "%s: No `li#'\n", myname); + exit(1); + } + + i = ptr - newtc + 3; + strncpy(termcap, newtc, i); + sprintf(termcap + i, "%d", rows); + ptr = strchr(ptr, ':'); + strcat(termcap, ptr); + } #endif /* USE_TERMCAP */ - if(SHELL_BOURNE == shell_type) { + if (SHELL_BOURNE == shell_type) { #ifdef USE_TERMCAP - if (ok_tcap) - printf ("%sTERMCAP='%s';\n", - setname, termcap); + if (ok_tcap) { + printf("%sTERMCAP=", setname); + print_termcap(termcap); + printf(";\nexport TERMCAP;\n"); + } #endif /* USE_TERMCAP */ #ifdef USE_TERMINFO - printf ("%sCOLUMNS=%d;\nLINES=%d;\nexport COLUMNS LINES;\n", - setname, cols, rows); -#endif /* USE_TERMINFO */ + printf("%sCOLUMNS=%d;\nLINES=%d;\nexport COLUMNS LINES;\n", + setname, cols, rows); +#endif /* USE_TERMINFO */ - } else { /* not Bourne shell */ + } else { /* not Bourne shell */ #ifdef USE_TERMCAP - if (ok_tcap) - printf ("set noglob;\n%ssetenv TERMCAP '%s';\nunset noglob;\n", - setname, termcap); + if (ok_tcap) { + printf("set noglob;\n%ssetenv TERMCAP ", setname); + print_termcap(termcap); + printf(";\nunset noglob;\n"); + } #endif /* USE_TERMCAP */ #ifdef USE_TERMINFO - printf ("set noglob;\n%ssetenv COLUMNS '%d';\nsetenv LINES '%d';\nunset noglob;\n", - setname, cols, rows); -#endif /* USE_TERMINFO */ - } - exit(0); + printf("set noglob;\n%ssetenv COLUMNS '%d';\nsetenv LINES '%d';\nunset noglob;\n", + setname, cols, rows); +#endif /* USE_TERMINFO */ + } + exit(0); } static int checkdigits(register char *str) { - while(*str) { - if(!isdigit(CharOf(*str))) - return(0); - str++; - } - return(1); + while (*str) { + if (!isdigit(CharOf(*str))) + return (0); + str++; + } + return (1); } static void -readstring(register FILE *fp, register char *buf, char *str) +readstring(register FILE * fp, register char *buf, char *str) { - register int last, c; -#if !defined(USG) && !defined(AMOEBA) && !defined(MINIX) && !defined(__EMX__) - /* What is the advantage of setitimer() over alarm()? */ - struct itimerval it; + register int last, c; +#if !defined(USG) && !defined(__UNIXOS2__) + /* What is the advantage of setitimer() over alarm()? */ + struct itimerval it; #endif - signal(SIGALRM, resize_timeout); -#if defined(USG) || defined(AMOEBA) || defined(MINIX) || defined(__EMX__) - alarm (TIMEOUT); + signal(SIGALRM, resize_timeout); +#if defined(USG) || defined(__UNIXOS2__) + alarm(TIMEOUT); #else - bzero((char *)&it, sizeof(struct itimerval)); - it.it_value.tv_sec = TIMEOUT; - setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); -#endif - if ((c = getc(fp)) == 0233) { /* meta-escape, CSI */ - *buf++ = c = ESCAPE("")[0]; - *buf++ = '['; - } else { - *buf++ = c; - } - if(c != *str) { - fprintf(stderr, "%s: unknown character, exiting.\r\n", myname); - onintr(0); - } - last = str[strlen(str) - 1]; - while((*buf++ = getc(fp)) != last) - ; -#if defined(USG) || defined(AMOEBA) || defined(MINIX) || defined(__EMX__) - alarm (0); + bzero((char *) &it, sizeof(struct itimerval)); + it.it_value.tv_sec = TIMEOUT; + setitimer(ITIMER_REAL, &it, (struct itimerval *) NULL); +#endif + if ((c = getc(fp)) == 0233) { /* meta-escape, CSI */ + *buf++ = c = ESCAPE("")[0]; + *buf++ = '['; + } else { + *buf++ = c; + } + if (c != *str) { + fprintf(stderr, "%s: unknown character, exiting.\r\n", myname); + onintr(0); + } + last = str[strlen(str) - 1]; + while ((*buf++ = getc(fp)) != last) ; +#if defined(USG) || defined(__UNIXOS2__) + alarm(0); #else - bzero((char *)&it, sizeof(struct itimerval)); - setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); + bzero((char *) &it, sizeof(struct itimerval)); + setitimer(ITIMER_REAL, &it, (struct itimerval *) NULL); #endif - *buf = 0; + *buf = 0; } static void Usage(void) { - fprintf(stderr, strcmp(myname, sunname) == 0 ? - "Usage: %s [rows cols]\n" : - "Usage: %s [-u] [-c] [-s [rows cols]]\n", myname); - exit(1); + fprintf(stderr, strcmp(myname, sunname) == 0 ? + "Usage: %s [rows cols]\n" : + "Usage: %s [-u] [-c] [-s [rows cols]]\n", myname); + exit(1); } static SIGNAL_T resize_timeout(int sig) { - fprintf(stderr, "\n%s: Time out occurred\r\n", myname); - onintr(sig); + fprintf(stderr, "\n%s: Time out occurred\r\n", myname); + onintr(sig); } /* ARGSUSED */ @@ -529,11 +561,11 @@ onintr(int sig GCC_UNUSED) { #ifdef USE_ANY_SYSV_TERMIO - ioctl (tty, TCSETAW, &tioorig); + ioctl(tty, TCSETAW, &tioorig); #elif defined(USE_TERMIOS) - tcsetattr (tty, TCSADRAIN, &tioorig); -#else /* not USE_TERMIOS */ - ioctl (tty, TIOCSETP, &sgorig); -#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ - exit(1); + tcsetattr(tty, TCSADRAIN, &tioorig); +#else /* not USE_TERMIOS */ + ioctl(tty, TIOCSETP, &sgorig); +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ + exit(1); } Index: xc/programs/xterm/resize.man diff -u xc/programs/xterm/resize.man:1.9 xc/programs/xterm/resize.man:1.10 --- xc/programs/xterm/resize.man:1.9 Sun Mar 11 19:54:17 2001 +++ xc/programs/xterm/resize.man Sat Aug 17 15:52:27 2002 @@ -1,8 +1,8 @@ .\" $Xorg: resize.man,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ .\" -.\" updated by Thomas E. Dickey for XFree86, Februrary 1998. +.\" updated by Thomas E. Dickey for XFree86, 1998-2002. .\" -.\" $XFree86: xc/programs/xterm/resize.man,v 1.9 2001/03/12 00:54:17 dickey Exp $ +.\" $XFree86: xc/programs/xterm/resize.man,v 1.10 2002/08/17 19:52:27 dickey Exp $ .TH RESIZE 1 __vendorversion__ .SH NAME resize \- set TERMCAP and terminal settings to current xterm window size Index: xc/programs/xterm/screen.c diff -u xc/programs/xterm/screen.c:3.57 xc/programs/xterm/screen.c:3.60 --- xc/programs/xterm/screen.c:3.57 Sat Sep 8 21:07:26 2001 +++ xc/programs/xterm/screen.c Fri Dec 27 16:05:23 2002 @@ -3,7 +3,7 @@ */ /* - * Copyright 1999-2000 by Thomas E. Dickey + * Copyright 1999-2000,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -54,7 +54,7 @@ * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/screen.c,v 3.57 2001/09/09 01:07:26 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/screen.c,v 3.60 2002/12/27 21:05:23 dickey Exp $ */ /* screen.c */ @@ -82,31 +82,32 @@ * with the intention of being able to change the total number of pointers per * row according to whether the user wants color or not. */ -ScrnBuf Allocate (int nrow, int ncol, Char **addr) +ScrnBuf +Allocate(int nrow, int ncol, Char ** addr) { - ScrnBuf base; - Char *tmp; - int i, j, k; - size_t entries = MAX_PTRS * nrow; - size_t length = BUF_PTRS * nrow * ncol; - - if ((base = (ScrnBuf) calloc (entries, sizeof (char *))) == 0) - SysError (ERROR_SCALLOC); - - if ((tmp = (Char *)calloc (length, sizeof(Char))) == 0) - SysError (ERROR_SCALLOC2); - - *addr = tmp; - for (i = k = 0; i < nrow; i++) { - base[k] = 0; /* per-line flags */ - k += BUF_HEAD; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - base[k++] = tmp; - tmp += ncol; - } + ScrnBuf base; + Char *tmp; + int i, j, k; + size_t entries = MAX_PTRS * nrow; + size_t length = BUF_PTRS * nrow * ncol; + + if ((base = (ScrnBuf) calloc(entries, sizeof(char *))) == 0) + SysError(ERROR_SCALLOC); + + if ((tmp = (Char *) calloc(length, sizeof(Char))) == 0) + SysError(ERROR_SCALLOC2); + + *addr = tmp; + for (i = k = 0; i < nrow; i++) { + base[k] = 0; /* per-line flags */ + k += BUF_HEAD; + for (j = BUF_HEAD; j < MAX_PTRS; j++) { + base[k++] = tmp; + tmp += ncol; } + } - return (base); + return (base); } /* @@ -115,98 +116,97 @@ * (Return value only necessary with SouthWestGravity.) */ static int -Reallocate( - ScrnBuf *sbuf, - Char **sbufaddr, - int nrow, - int ncol, - int oldrow, - int oldcol) +Reallocate(ScrnBuf * sbuf, + Char ** sbufaddr, + int nrow, + int ncol, + int oldrow, + int oldcol) { - ScrnBuf base; - Char *tmp; - int i, j, k, minrows; - size_t mincols; - Char *oldbuf; - int move_down = 0, move_up = 0; - size_t entries = MAX_PTRS * nrow; - size_t length = BUF_PTRS * nrow * ncol; - - if (sbuf == NULL || *sbuf == NULL) { - return 0; - } - - oldbuf = *sbufaddr; - - /* - * Special case if oldcol == ncol - straight forward realloc and - * update of the additional lines in sbuf - * - * FIXME: this is a good idea, but doesn't seem to be implemented. - * -gildea - */ - - /* - * realloc sbuf, the pointers to all the lines. - * If the screen shrinks, remove lines off the top of the buffer - * if resizeGravity resource says to do so. - */ - if (nrow < oldrow - && term->misc.resizeGravity == SouthWestGravity) { - /* Remove lines off the top of the buffer if necessary. */ - move_up = (oldrow - nrow) - - (term->screen.max_row - term->screen.cur_row); - if (move_up < 0) - move_up = 0; - /* Overlapping memmove here! */ - memmove( *sbuf, *sbuf + (move_up * MAX_PTRS), - MAX_PTRS * (oldrow - move_up) * sizeof((*sbuf)[0]) ); - } - *sbuf = (ScrnBuf) realloc((char *) (*sbuf), entries * sizeof(char *)); - if (*sbuf == 0) - SysError(ERROR_RESIZE); - base = *sbuf; - - /* - * create the new buffer space and copy old buffer contents there - * line by line. - */ - if ((tmp = (Char *)calloc(length, sizeof(Char))) == 0) - SysError(ERROR_SREALLOC); - *sbufaddr = tmp; - minrows = (oldrow < nrow) ? oldrow : nrow; - mincols = (oldcol < ncol) ? oldcol : ncol; - if (nrow > oldrow - && term->misc.resizeGravity == SouthWestGravity) { - /* move data down to bottom of expanded screen */ - move_down = Min(nrow - oldrow, term->screen.savedlines); - tmp += (ncol * move_down * BUF_PTRS); - } - - for (i = k = 0; i < minrows; i++) { - k += BUF_HEAD; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - memcpy(tmp, base[k++], mincols); - tmp += ncol; - } - } - - /* - * update the pointers in sbuf - */ - for (i = k = 0, tmp = *sbufaddr; i < nrow; i++) { - for (j = 0; j < BUF_HEAD; j++) - base[k++] = 0; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - base[k++] = tmp; - tmp += ncol; - } + ScrnBuf base; + Char *tmp; + int i, j, k, minrows; + size_t mincols; + Char *oldbuf; + int move_down = 0, move_up = 0; + size_t entries = MAX_PTRS * nrow; + size_t length = BUF_PTRS * nrow * ncol; + + if (sbuf == NULL || *sbuf == NULL) { + return 0; + } + + oldbuf = *sbufaddr; + + /* + * Special case if oldcol == ncol - straight forward realloc and + * update of the additional lines in sbuf + * + * FIXME: this is a good idea, but doesn't seem to be implemented. + * -gildea + */ + + /* + * realloc sbuf, the pointers to all the lines. + * If the screen shrinks, remove lines off the top of the buffer + * if resizeGravity resource says to do so. + */ + if (nrow < oldrow + && term->misc.resizeGravity == SouthWestGravity) { + /* Remove lines off the top of the buffer if necessary. */ + move_up = (oldrow - nrow) + - (term->screen.max_row - term->screen.cur_row); + if (move_up < 0) + move_up = 0; + /* Overlapping memmove here! */ + memmove(*sbuf, *sbuf + (move_up * MAX_PTRS), + MAX_PTRS * (oldrow - move_up) * sizeof((*sbuf)[0])); + } + *sbuf = (ScrnBuf) realloc((char *) (*sbuf), entries * sizeof(char *)); + if (*sbuf == 0) + SysError(ERROR_RESIZE); + base = *sbuf; + + /* + * create the new buffer space and copy old buffer contents there + * line by line. + */ + if ((tmp = (Char *) calloc(length, sizeof(Char))) == 0) + SysError(ERROR_SREALLOC); + *sbufaddr = tmp; + minrows = (oldrow < nrow) ? oldrow : nrow; + mincols = (oldcol < ncol) ? oldcol : ncol; + if (nrow > oldrow + && term->misc.resizeGravity == SouthWestGravity) { + /* move data down to bottom of expanded screen */ + move_down = Min(nrow - oldrow, term->screen.savedlines); + tmp += (ncol * move_down * BUF_PTRS); + } + + for (i = k = 0; i < minrows; i++) { + k += BUF_HEAD; + for (j = BUF_HEAD; j < MAX_PTRS; j++) { + memcpy(tmp, base[k++], mincols); + tmp += ncol; + } + } + + /* + * update the pointers in sbuf + */ + for (i = k = 0, tmp = *sbufaddr; i < nrow; i++) { + for (j = 0; j < BUF_HEAD; j++) + base[k++] = 0; + for (j = BUF_HEAD; j < MAX_PTRS; j++) { + base[k++] = tmp; + tmp += ncol; } + } - /* Now free the old buffer */ - free(oldbuf); + /* Now free the old buffer */ + free(oldbuf); - return move_down ? move_down : -move_up; /* convert to rows */ + return move_down ? move_down : -move_up; /* convert to rows */ } int last_written_row = -1; @@ -217,246 +217,256 @@ * to match flags. */ void -ScreenWrite ( - TScreen *screen, - PAIRED_CHARS(Char *str, Char *str2), - unsigned flags, - unsigned cur_fg_bg, - int len) /* length of string */ +ScreenWrite(TScreen * screen, + PAIRED_CHARS(Char * str, Char * str2), + unsigned flags, + unsigned cur_fg_bg, + int len) /* length of string */ { #if OPT_ISO_COLORS #if OPT_EXT_COLORS - Char *fbf = 0; - Char *fbb = 0; + Char *fbf = 0; + Char *fbb = 0; #else - Char *fb = 0; + Char *fb = 0; #endif #endif #if OPT_DEC_CHRSET - Char *cb = 0; + Char *cb = 0; #endif - int length = len; /* workaround for compiler bug? */ - Char *attrs; - int avail = screen->max_col - screen->cur_col + 1; - Char *col; - int wrappedbit; + int length = len; /* workaround for compiler bug? */ + Char *attrs; + int avail = screen->max_col - screen->cur_col + 1; + Char *col; + int wrappedbit; #if OPT_WIDE_CHARS - Char starcol, starcol2; - Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0; + Char starcol, starcol2; + Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0; #endif - + #if OPT_WIDE_CHARS - int real_width = visual_width(PAIRED_CHARS(str, str2), length); + int real_width = visual_width(PAIRED_CHARS(str, str2), length); #else - int real_width = length; + int real_width = length; #endif - if (length > avail) - length = avail; - if (length <= 0) - return; - - col = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col; - attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col; - - if_OPT_WIDE_CHARS(screen,{ - comb1l = SCRN_BUF_COM1L(screen, screen->cur_row) + screen->cur_col; - comb1h = SCRN_BUF_COM1H(screen, screen->cur_row) + screen->cur_col; - comb2l = SCRN_BUF_COM2L(screen, screen->cur_row) + screen->cur_col; - comb2h = SCRN_BUF_COM2H(screen, screen->cur_row) + screen->cur_col; - }) - - if_OPT_EXT_COLORS(screen,{ - fbf = SCRN_BUF_FGRND(screen, screen->cur_row) + screen->cur_col; - fbb = SCRN_BUF_BGRND(screen, screen->cur_row) + screen->cur_col; - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fb = SCRN_BUF_COLOR(screen, screen->cur_row) + screen->cur_col; - }) - if_OPT_DEC_CHRSET({ - cb = SCRN_BUF_CSETS(screen, screen->cur_row) + screen->cur_col; - }) + if (length > avail) + length = avail; + if (length <= 0) + return; + + col = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col; + attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col; + + if_OPT_WIDE_CHARS(screen, { + comb1l = SCRN_BUF_COM1L(screen, screen->cur_row) + screen->cur_col; + comb1h = SCRN_BUF_COM1H(screen, screen->cur_row) + screen->cur_col; + comb2l = SCRN_BUF_COM2L(screen, screen->cur_row) + screen->cur_col; + comb2h = SCRN_BUF_COM2H(screen, screen->cur_row) + screen->cur_col; + }); + + if_OPT_EXT_COLORS(screen, { + fbf = SCRN_BUF_FGRND(screen, screen->cur_row) + screen->cur_col; + fbb = SCRN_BUF_BGRND(screen, screen->cur_row) + screen->cur_col; + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + fb = SCRN_BUF_COLOR(screen, screen->cur_row) + screen->cur_col; + }); + if_OPT_DEC_CHRSET({ + cb = SCRN_BUF_CSETS(screen, screen->cur_row) + screen->cur_col; + }); - wrappedbit = ScrnTstWrapped(screen, screen->cur_row); + wrappedbit = ScrnTstWrapped(screen, screen->cur_row); #if OPT_WIDE_CHARS - starcol = *col; - starcol2 = col[length-1]; + starcol = *col; + starcol2 = col[length - 1]; #endif - /* write blanks if we're writing invisible text */ - if (flags & INVISIBLE) { - memset(col, ' ', length); - } else { - memcpy(col, str, length); /* This can stand for the present. If it - is wrong, we will scribble over it */ - } + /* write blanks if we're writing invisible text */ + if (flags & INVISIBLE) { + memset(col, ' ', length); + } else { + memcpy(col, str, length); /* This can stand for the present. If it + is wrong, we will scribble over it */ + } #define ERROR_1 0x20 #define ERROR_2 0x00 - if_OPT_WIDE_CHARS(screen,{ + if_OPT_WIDE_CHARS(screen, { - Char *wc; + Char *wc; - if (real_width != length) { - Char *c = col; - wc = SCRN_BUF_WIDEC(screen, screen->cur_row); - wc += screen->cur_col; - if (screen->cur_col && starcol == HIDDEN_LO && *wc == HIDDEN_HI - && iswide(c[-1] | (wc[-1] << 8))) { - c[-1] = ERROR_1; - wc[-1] = ERROR_2; - } - /* if we are overwriting the right hand half of a - wide character, make the other half vanish */ - while (length) { - int ch = *str; - if (str2) ch |= *str2 << 8; - - *c = *str; - c++; str++; - - if (str2) { *wc = *str2; str2++; } else *wc = 0; - wc++; - length--; - - if (iswide(ch)) { - *c = HIDDEN_LO; *wc = HIDDEN_HI; - c++; wc++; - } - } - - if (*c == HIDDEN_LO && *wc == HIDDEN_HI && c[-1] == HIDDEN_LO && wc[-1] == HIDDEN_HI) { - *c = ERROR_1; - *wc = ERROR_2; - } - /* if we are overwriting the left hand half of a - wide character, make the other half vanish */ - } - - else { - - if ((wc = SCRN_BUF_WIDEC(screen, screen->cur_row)) != 0) { - wc += screen->cur_col; - if (screen->cur_col && starcol == HIDDEN_LO && *wc == HIDDEN_HI - && iswide(col[-1] | (wc[-1] << 8))) { - col[-1] = ERROR_1; - wc[-1] = ERROR_2; - } - /* if we are overwriting the right hand half of a - wide character, make the other half vanish */ - if (col[length] == HIDDEN_LO && wc[length] == HIDDEN_HI && - iswide(starcol2 | (wc[length-1]<<8))) { - col[length] = ERROR_1; - wc[length] = ERROR_2; - } - /* if we are overwriting the left hand half of a - wide character, make the other half vanish */ - if ((flags & INVISIBLE) || (str2 == 0)) - memset(wc, 0, length); - else - memcpy(wc, str2, length); + if (real_width != length) { + Char *c = col; + wc = SCRN_BUF_WIDEC(screen, screen->cur_row); + wc += screen->cur_col; + if (screen->cur_col && starcol == HIDDEN_LO && *wc == HIDDEN_HI + && iswide(c[-1] | (wc[-1] << 8))) { + c[-1] = ERROR_1; + wc[-1] = ERROR_2; + } + /* if we are overwriting the right hand half of a + wide character, make the other half vanish */ + while (length) { + int ch = *str; + if (str2) + ch |= *str2 << 8; + + *c = *str; + c++; + str++; + + if (str2) { + *wc = *str2; + str2++; + } else + *wc = 0; + wc++; + length--; + + if (iswide(ch)) { + *c = HIDDEN_LO; + *wc = HIDDEN_HI; + c++; + wc++; } - } - }) + } - flags &= ATTRIBUTES; - flags |= CHARDRAWN; - memset( attrs, flags, real_width); - - if_OPT_WIDE_CHARS(screen,{ - memset( comb1l, 0, real_width); - memset( comb2l, 0, real_width); - memset( comb1h, 0, real_width); - memset( comb2h, 0, real_width); - }) - if_OPT_EXT_COLORS(screen,{ - memset( fbf, cur_fg_bg >> 8, real_width); - memset( fbb, cur_fg_bg & 0xff, real_width); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - memset( fb, cur_fg_bg, real_width); - }) - if_OPT_DEC_CHRSET({ - memset( cb, curXtermChrSet(screen->cur_row), real_width); - }) + if (*c == HIDDEN_LO + && *wc == HIDDEN_HI + && c[-1] == HIDDEN_LO + && wc[-1] == HIDDEN_HI) { + *c = ERROR_1; + *wc = ERROR_2; + } + /* if we are overwriting the left hand half of a + wide character, make the other half vanish */ + } - if (wrappedbit) - ScrnSetWrapped(screen, screen->cur_row); - else - ScrnClrWrapped(screen, screen->cur_row); + else { - last_written_col = screen->cur_col + real_width - 1; - last_written_row = screen->cur_row; + if ((wc = SCRN_BUF_WIDEC(screen, screen->cur_row)) != 0) { + wc += screen->cur_col; + if (screen->cur_col && starcol == HIDDEN_LO && *wc == HIDDEN_HI + && iswide(col[-1] | (wc[-1] << 8))) { + col[-1] = ERROR_1; + wc[-1] = ERROR_2; + } + /* if we are overwriting the right hand half of a + wide character, make the other half vanish */ + if (col[length] == HIDDEN_LO && wc[length] == HIDDEN_HI && + iswide(starcol2 | (wc[length - 1] << 8))) { + col[length] = ERROR_1; + wc[length] = ERROR_2; + } + /* if we are overwriting the left hand half of a + wide character, make the other half vanish */ + if ((flags & INVISIBLE) || (str2 == 0)) + memset(wc, 0, length); + else + memcpy(wc, str2, length); + } + } + }); - if_OPT_XMC_GLITCH(screen,{ - Resolve_XMC(screen); - }) + flags &= ATTRIBUTES; + flags |= CHARDRAWN; + memset(attrs, flags, real_width); + + if_OPT_WIDE_CHARS(screen, { + memset(comb1l, 0, real_width); + memset(comb2l, 0, real_width); + memset(comb1h, 0, real_width); + memset(comb2h, 0, real_width); + }); + if_OPT_EXT_COLORS(screen, { + memset(fbf, cur_fg_bg >> 8, real_width); + memset(fbb, cur_fg_bg & 0xff, real_width); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + memset(fb, cur_fg_bg, real_width); + }); + if_OPT_DEC_CHRSET({ + memset(cb, curXtermChrSet(screen->cur_row), real_width); + }); + + if (wrappedbit) + ScrnSetWrapped(screen, screen->cur_row); + else + ScrnClrWrapped(screen, screen->cur_row); + + last_written_col = screen->cur_col + real_width - 1; + last_written_row = screen->cur_row; + + if_OPT_XMC_GLITCH(screen, { + Resolve_XMC(screen); + }); } /* * Saves pointers to the n lines beginning at sb + where, and clears the lines */ static void -ScrnClearLines (TScreen *screen, ScrnBuf sb, int where, int n, int size) +ScrnClearLines(TScreen * screen, ScrnBuf sb, int where, int n, int size) { - int i, j; - size_t len = ScrnPointers(screen, n); - int last = (n * MAX_PTRS); - - /* save n lines at where */ - memcpy ( (char *) screen->save_ptr, - (char *) &sb[MAX_PTRS * where], - len); - - /* clear contents of old rows */ - if (TERM_COLOR_FLAGS) { - int flags = TERM_COLOR_FLAGS; - for (i = 0; i < last; i += MAX_PTRS) { - for (j = 0; j < MAX_PTRS; j++) { - if (j < BUF_HEAD) - screen->save_ptr[i+j] = 0; - else if (j == OFF_ATTRS) - memset(screen->save_ptr[i+j], flags, size); + int i, j; + size_t len = ScrnPointers(screen, n); + int last = (n * MAX_PTRS); + + /* save n lines at where */ + memcpy((char *) screen->save_ptr, + (char *) &sb[MAX_PTRS * where], + len); + + /* clear contents of old rows */ + if (TERM_COLOR_FLAGS) { + int flags = TERM_COLOR_FLAGS; + for (i = 0; i < last; i += MAX_PTRS) { + for (j = 0; j < MAX_PTRS; j++) { + if (j < BUF_HEAD) + screen->save_ptr[i + j] = 0; + else if (j == OFF_ATTRS) + memset(screen->save_ptr[i + j], flags, size); #if OPT_ISO_COLORS #if OPT_EXT_COLORS - else if (j == OFF_FGRND) - memset(screen->save_ptr[i+j], term->sgr_foreground, size); - else if (j == OFF_BGRND) - memset(screen->save_ptr[i+j], term->cur_background, size); + else if (j == OFF_FGRND) + memset(screen->save_ptr[i + j], term->sgr_foreground, size); + else if (j == OFF_BGRND) + memset(screen->save_ptr[i + j], term->cur_background, size); #else - else if (j == OFF_COLOR) - memset(screen->save_ptr[i+j], xtermColorPair(), size); + else if (j == OFF_COLOR) + memset(screen->save_ptr[i + j], xtermColorPair(), size); #endif #endif - else - bzero( screen->save_ptr[i+j], size); - } - } - } else { - for (i = 0; i < last; i += MAX_PTRS) { - for (j = 0; j < BUF_HEAD; j++) - screen->save_ptr[i+j] = 0; - for (j = BUF_HEAD; j < MAX_PTRS; j++) - bzero (screen->save_ptr[i+j], size); - } + else + bzero(screen->save_ptr[i + j], size); + } + } + } else { + for (i = 0; i < last; i += MAX_PTRS) { + for (j = 0; j < BUF_HEAD; j++) + screen->save_ptr[i + j] = 0; + for (j = BUF_HEAD; j < MAX_PTRS; j++) + bzero(screen->save_ptr[i + j], size); } + } } size_t -ScrnPointers (TScreen *screen, size_t len) +ScrnPointers(TScreen * screen, size_t len) { - len *= (MAX_PTRS * sizeof(Char *)); + len *= (MAX_PTRS * sizeof(Char *)); - if (len > screen->save_len) { - if (screen->save_len) - screen->save_ptr = (Char **)realloc(screen->save_ptr, len); - else - screen->save_ptr = (Char **)malloc(len); - screen->save_len = len; - if (screen->save_ptr == 0) - SysError (ERROR_SAVE_PTR); - } - return len; + if (len > screen->save_len) { + if (screen->save_len) + screen->save_ptr = (Char **) realloc(screen->save_ptr, len); + else + screen->save_ptr = (Char **) malloc(len); + screen->save_len = len; + if (screen->save_ptr == 0) + SysError(ERROR_SAVE_PTR); + } + return len; } /* @@ -465,30 +475,30 @@ * Requires: 0 <= where < where + n <= last */ void -ScrnInsertLine (TScreen *screen, ScrnBuf sb, int last, int where, int n, int size) +ScrnInsertLine(TScreen * screen, ScrnBuf sb, int last, int where, int n, int size) { - size_t len = ScrnPointers(screen, n); + size_t len = ScrnPointers(screen, n); - /* save n lines at bottom */ - ScrnClearLines(screen, sb, (last -= n - 1), n, size); + /* save n lines at bottom */ + ScrnClearLines(screen, sb, (last -= n - 1), n, size); - /* - * WARNING, overlapping copy operation. Move down lines (pointers). - * - * +----|---------|--------+ - * - * is copied in the array to: - * - * +--------|---------|----+ - */ - memmove( (char *) &sb [MAX_PTRS * (where + n)], - (char *) &sb [MAX_PTRS * where], - MAX_PTRS * sizeof (char *) * (last - where)); - - /* reuse storage for new lines at where */ - memcpy ( (char *) &sb[MAX_PTRS * where], - (char *) screen->save_ptr, - len); + /* + * WARNING, overlapping copy operation. Move down lines (pointers). + * + * +----|---------|--------+ + * + * is copied in the array to: + * + * +--------|---------|----+ + */ + memmove((char *) &sb[MAX_PTRS * (where + n)], + (char *) &sb[MAX_PTRS * where], + MAX_PTRS * sizeof(char *) * (last - where)); + + /* reuse storage for new lines at where */ + memcpy((char *) &sb[MAX_PTRS * where], + (char *) screen->save_ptr, + len); } /* @@ -497,19 +507,19 @@ * Requires 0 <= where < where + n < = last */ void -ScrnDeleteLine (TScreen *screen, ScrnBuf sb, int last, int where, int n, int size) +ScrnDeleteLine(TScreen * screen, ScrnBuf sb, int last, int where, int n, int size) { - ScrnClearLines(screen, sb, where, n, size); + ScrnClearLines(screen, sb, where, n, size); - /* move up lines */ - memmove( (char *) &sb[MAX_PTRS * where], - (char *) &sb[MAX_PTRS * (where + n)], - MAX_PTRS * sizeof (char *) * ((last -= n - 1) - where)); - - /* reuse storage for new bottom lines */ - memcpy ( (char *) &sb[MAX_PTRS * last], - (char *)screen->save_ptr, - MAX_PTRS * sizeof(char *) * n); + /* move up lines */ + memmove((char *) &sb[MAX_PTRS * where], + (char *) &sb[MAX_PTRS * (where + n)], + MAX_PTRS * sizeof(char *) * ((last -= n - 1) - where)); + + /* reuse storage for new bottom lines */ + memcpy((char *) &sb[MAX_PTRS * last], + (char *) screen->save_ptr, + MAX_PTRS * sizeof(char *) * n); } /* @@ -517,148 +527,148 @@ * row. */ void -ScrnInsertChar (TScreen *screen, int n) +ScrnInsertChar(TScreen * screen, int n) { - ScrnBuf sb = screen->visbuf; - int size = screen->max_col + 1; - int row = screen->cur_row; - int col = screen->cur_col; - int i, j; - Char *ptr = BUF_CHARS(sb, row); - Char *attrs = BUF_ATTRS(sb, row); - int wrappedbit = ScrnTstWrapped(screen, row); - int flags = CHARDRAWN | TERM_COLOR_FLAGS; - size_t nbytes; - - if (size - (col + n) <= 0) { - if ((n = size - col) <= 0) { - return; - } - } - nbytes = (size - (col + n)); - - ScrnClrWrapped(screen, row); /* make sure the bit isn't moved */ - for (i = size - 1; i >= col + n; i--) { - ptr[i] = ptr[j = i - n]; - attrs[i] = attrs[j]; - } - - for (i=col; i<col+n; i++) - ptr[i] = ' '; - for (i=col; i<col+n; i++) - attrs[i] = flags; - if_OPT_EXT_COLORS(screen,{ - ptr = BUF_FGRND(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, term->sgr_foreground, n); - ptr = BUF_BGRND(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, term->cur_background, n); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - ptr = BUF_COLOR(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, xtermColorPair(), n); - }) - if_OPT_DEC_CHRSET({ - ptr = BUF_CSETS(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, curXtermChrSet(row), n); - }) - if_OPT_WIDE_CHARS(screen,{ - ptr = BUF_WIDEC(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, 0, n); - - ptr = BUF_COM1L(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, 0, n); - - ptr = BUF_COM1H(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, 0, n); - - ptr = BUF_COM2L(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, 0, n); - - ptr = BUF_COM2H(sb, row); - memmove(ptr + col + n, ptr + col, nbytes); - memset(ptr + col, 0, n); - }) - - if (wrappedbit) - ScrnSetWrapped(screen, row); - else - ScrnClrWrapped(screen, row); + ScrnBuf sb = screen->visbuf; + int size = screen->max_col + 1; + int row = screen->cur_row; + int col = screen->cur_col; + int i, j; + Char *ptr = BUF_CHARS(sb, row); + Char *attrs = BUF_ATTRS(sb, row); + int wrappedbit = ScrnTstWrapped(screen, row); + int flags = CHARDRAWN | TERM_COLOR_FLAGS; + size_t nbytes; + + if (size - (col + n) <= 0) { + if ((n = size - col) <= 0) { + return; + } + } + nbytes = (size - (col + n)); + + ScrnClrWrapped(screen, row); /* make sure the bit isn't moved */ + for (i = size - 1; i >= col + n; i--) { + ptr[i] = ptr[j = i - n]; + attrs[i] = attrs[j]; + } + + for (i = col; i < col + n; i++) + ptr[i] = ' '; + for (i = col; i < col + n; i++) + attrs[i] = flags; + if_OPT_EXT_COLORS(screen, { + ptr = BUF_FGRND(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, term->sgr_foreground, n); + ptr = BUF_BGRND(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, term->cur_background, n); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + ptr = BUF_COLOR(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, xtermColorPair(), n); + }); + if_OPT_DEC_CHRSET({ + ptr = BUF_CSETS(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, curXtermChrSet(row), n); + }); + if_OPT_WIDE_CHARS(screen, { + ptr = BUF_WIDEC(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, 0, n); + + ptr = BUF_COM1L(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, 0, n); + + ptr = BUF_COM1H(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, 0, n); + + ptr = BUF_COM2L(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, 0, n); + + ptr = BUF_COM2H(sb, row); + memmove(ptr + col + n, ptr + col, nbytes); + memset(ptr + col, 0, n); + }); + + if (wrappedbit) + ScrnSetWrapped(screen, row); + else + ScrnClrWrapped(screen, row); } /* * Deletes n characters at current row, col. */ void -ScrnDeleteChar (TScreen *screen, int n) +ScrnDeleteChar(TScreen * screen, int n) { - ScrnBuf sb = screen->visbuf; - int size = screen->max_col + 1; - int row = screen->cur_row; - int col = screen->cur_col; - Char *ptr = BUF_CHARS(sb, row); - Char *attrs = BUF_ATTRS(sb, row); - size_t nbytes; - - if (size - (col + n) <= 0) { - if ((n = size - col) <= 0) { - return; - } - } - nbytes = (size - (col + n)); - - memmove (ptr + col, ptr + col + n, nbytes); - memmove (attrs + col, attrs + col + n, nbytes); - bzero (ptr + size - n, n); - memset (attrs + size - n, TERM_COLOR_FLAGS, n); - - if_OPT_EXT_COLORS(screen,{ - ptr = BUF_FGRND(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, term->sgr_foreground, n); - ptr = BUF_BGRND(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, term->cur_background, n); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - ptr = BUF_COLOR(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, xtermColorPair(), n); - }) - if_OPT_DEC_CHRSET({ - ptr = BUF_CSETS(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, curXtermChrSet(row), n); - }) - if_OPT_WIDE_CHARS(screen,{ - ptr = BUF_WIDEC(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, 0, n); - - ptr = BUF_COM1L(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, 0, n); - - ptr = BUF_COM1H(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, 0, n); - - ptr = BUF_COM2L(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, 0, n); - - ptr = BUF_COM2H(sb, row); - memmove(ptr + col, ptr + col + n, nbytes); - memset(ptr + size - n, 0, n); - }) - ScrnClrWrapped(screen, row); + ScrnBuf sb = screen->visbuf; + int size = screen->max_col + 1; + int row = screen->cur_row; + int col = screen->cur_col; + Char *ptr = BUF_CHARS(sb, row); + Char *attrs = BUF_ATTRS(sb, row); + size_t nbytes; + + if (size - (col + n) <= 0) { + if ((n = size - col) <= 0) { + return; + } + } + nbytes = (size - (col + n)); + + memmove(ptr + col, ptr + col + n, nbytes); + memmove(attrs + col, attrs + col + n, nbytes); + bzero(ptr + size - n, n); + memset(attrs + size - n, TERM_COLOR_FLAGS, n); + + if_OPT_EXT_COLORS(screen, { + ptr = BUF_FGRND(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, term->sgr_foreground, n); + ptr = BUF_BGRND(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, term->cur_background, n); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + ptr = BUF_COLOR(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, xtermColorPair(), n); + }); + if_OPT_DEC_CHRSET({ + ptr = BUF_CSETS(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, curXtermChrSet(row), n); + }); + if_OPT_WIDE_CHARS(screen, { + ptr = BUF_WIDEC(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, 0, n); + + ptr = BUF_COM1L(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, 0, n); + + ptr = BUF_COM1H(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, 0, n); + + ptr = BUF_COM2L(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, 0, n); + + ptr = BUF_COM2H(sb, row); + memmove(ptr + col, ptr + col + n, nbytes); + memset(ptr + size - n, 0, n); + }); + ScrnClrWrapped(screen, row); } /* @@ -669,381 +679,392 @@ * all dimensions are based on single-characters. */ void -ScrnRefresh ( - TScreen *screen, - int toprow, - int leftcol, - int nrows, - int ncols, - Bool force -) /* ... leading/trailing spaces */ +ScrnRefresh(TScreen * screen, + int toprow, + int leftcol, + int nrows, + int ncols, + Bool force) /* ... leading/trailing spaces */ { - int y = toprow * FontHeight(screen) + screen->border; - int row; - int topline = screen->topline; - int maxrow = toprow + nrows - 1; - int scrollamt = screen->scroll_amt; - int max = screen->max_row; - int gc_changes = 0; + int y = toprow * FontHeight(screen) + screen->border; + int row; + int topline = screen->topline; + int maxrow = toprow + nrows - 1; + int scrollamt = screen->scroll_amt; + int max = screen->max_row; + int gc_changes = 0; #ifdef __CYGWIN__ - static char first_time = 1; + static char first_time = 1; #endif - static int recurse = 0; + static int recurse = 0; - TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s\n", - toprow, leftcol, - nrows, ncols, - force ? " force" : "")); + TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s\n", + toprow, leftcol, + nrows, ncols, + force ? " force" : "")); - if(screen->cursor_col >= leftcol + if (screen->cursor_col >= leftcol && screen->cursor_col <= (leftcol + ncols - 1) && screen->cursor_row >= toprow + topline && screen->cursor_row <= maxrow + topline) - screen->cursor_state = OFF; + screen->cursor_state = OFF; - for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { + for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { #if OPT_ISO_COLORS #if OPT_EXT_COLORS - Char *fbf = 0; - Char *fbb = 0; + Char *fbf = 0; + Char *fbb = 0; +#define ColorOf(col) ((fbf[col] << 8) | fbb[col]) #else - Char *fb = 0; + Char *fb = 0; +#define ColorOf(col) (fb[col]) #endif #endif #if OPT_DEC_CHRSET - Char *cb = 0; + Char *cb = 0; #endif #if OPT_WIDE_CHARS - int wideness = 0; - Char *widec = 0; + int wideness = 0; + Char *widec = 0; #define WIDEC_PTR(cell) widec ? &widec[cell] : 0 #endif - Char cs = 0; - Char *chars; - Char *attrs; - int col = leftcol; - int maxcol = leftcol + ncols - 1; - int hi_col = maxcol; - int lastind; - int flags; - int fg_bg = 0, fg = 0, bg = 0; - int x; - GC gc; - Boolean hilite; - - if (row < screen->top_marg || row > screen->bot_marg) - lastind = row; - else - lastind = row - scrollamt; - - if (lastind < 0 || lastind > max) - continue; - - chars = SCRN_BUF_CHARS(screen, lastind + topline); - attrs = SCRN_BUF_ATTRS(screen, lastind + topline); - - if_OPT_DEC_CHRSET({ - cb = SCRN_BUF_CSETS(screen, lastind + topline); - }) - - if_OPT_WIDE_CHARS(screen,{ - widec = SCRN_BUF_WIDEC(screen, lastind + topline); - }) - - if_OPT_WIDE_CHARS(screen,{ - /* This fixes an infinite recursion bug, that leads - to display anomalies. It seems to be related to - problems with the selection. */ - if (recurse < 3) { - /* adjust to redraw all of a widechar if we just wanted - to draw the right hand half */ - if (iswide(chars[leftcol - 1] | (widec[leftcol -1]<<8)) && - (chars[leftcol] | (widec[leftcol]<<8))==HIDDEN_CHAR) - { - leftcol--; - ncols++; - col = leftcol; - } - } else { - fprintf(stderr, "This should not happen. Why is it so?\n"); - } - }) - - if (row < screen->startHRow || row > screen->endHRow || - (row == screen->startHRow && maxcol < screen->startHCol) || - (row == screen->endHRow && col >= screen->endHCol)) - { + Char cs = 0; + Char *chars; + Char *attrs; + int col = leftcol; + int maxcol = leftcol + ncols - 1; + int hi_col = maxcol; + int lastind; + int flags; + int test; + int fg_bg = 0, fg = 0, bg = 0; + int x; + GC gc; + Boolean hilite; + + if (row < screen->top_marg || row > screen->bot_marg) + lastind = row; + else + lastind = row - scrollamt; + + TRACE(("ScrnRefresh row=%d lastind=%d/%d\n", row, lastind, max)); + if (lastind < 0 || lastind > max) + continue; + + chars = SCRN_BUF_CHARS(screen, lastind + topline); + attrs = SCRN_BUF_ATTRS(screen, lastind + topline); + + if_OPT_DEC_CHRSET({ + cb = SCRN_BUF_CSETS(screen, lastind + topline); + }); + + if_OPT_WIDE_CHARS(screen, { + widec = SCRN_BUF_WIDEC(screen, lastind + topline); + }); + + if_OPT_WIDE_CHARS(screen, { + /* This fixes an infinite recursion bug, that leads + to display anomalies. It seems to be related to + problems with the selection. */ + if (recurse < 3) { + /* adjust to redraw all of a widechar if we just wanted + to draw the right hand half */ + if (iswide(chars[leftcol - 1] | (widec[leftcol - 1] << 8)) && + (chars[leftcol] | (widec[leftcol] << 8)) == HIDDEN_CHAR) { + leftcol--; + ncols++; + col = leftcol; + } + } else { + fprintf(stderr, "This should not happen. Why is it so?\n"); + } + }); + + if (row < screen->startHRow || row > screen->endHRow || + (row == screen->startHRow && maxcol < screen->startHCol) || + (row == screen->endHRow && col >= screen->endHCol)) { #if OPT_DEC_CHRSET - /* - * Temporarily change dimensions to double-sized characters so - * we can reuse the recursion on this function. - */ - if (CSET_DOUBLE(*cb)) { - col /= 2; - maxcol /= 2; - } -#endif - /* row does not intersect selection; don't hilite */ - if (!force) { - while (col <= maxcol && (attrs[col] & ~BOLD) == 0 && - (chars[col] & ~040) == 0) - col++; - - while (col <= maxcol && (attrs[maxcol] & ~BOLD) == 0 && - (chars[maxcol] & ~040) == 0) - maxcol--; - } + /* + * Temporarily change dimensions to double-sized characters so + * we can reuse the recursion on this function. + */ + if (CSET_DOUBLE(*cb)) { + col /= 2; + maxcol /= 2; + } +#endif + /* row does not intersect selection; don't hilite */ + if (!force) { + while (col <= maxcol && (attrs[col] & ~BOLD) == 0 && + (chars[col] & ~040) == 0) + col++; + + while (col <= maxcol && (attrs[maxcol] & ~BOLD) == 0 && + (chars[maxcol] & ~040) == 0) + maxcol--; + } #if OPT_DEC_CHRSET - if (CSET_DOUBLE(*cb)) { - col *= 2; - maxcol *= 2; - } -#endif - hilite = False; - } - else { - /* row intersects selection; split into pieces of single type */ - if (row == screen->startHRow && col < screen->startHCol) { - recurse++; - ScrnRefresh(screen, row, col, 1, screen->startHCol - col, - force); - col = screen->startHCol; - } - if (row == screen->endHRow && maxcol >= screen->endHCol) { - recurse++; - ScrnRefresh(screen, row, screen->endHCol, 1, - maxcol - screen->endHCol + 1, force); - maxcol = screen->endHCol - 1; - } - - /* - * If we're highlighting because the user is doing cut/paste, - * trim the trailing blanks from the highlighted region so we're - * showing the actual extent of the text that'll be cut. If - * we're selecting a blank line, we'll highlight one column - * anyway. - * - * We don't do this if the mouse-hilite mode is set because that - * would be too confusing. - * - * The default if the highlightSelection resource isn't set will - * highlight the whole width of the terminal, which is easy to - * see, but harder to use (because trailing blanks aren't as - * apparent). - */ - if (screen->highlight_selection + if (CSET_DOUBLE(*cb)) { + col *= 2; + maxcol *= 2; + } +#endif + hilite = False; + } else { + /* row intersects selection; split into pieces of single type */ + if (row == screen->startHRow && col < screen->startHCol) { + recurse++; + ScrnRefresh(screen, row, col, 1, screen->startHCol - col, + force); + col = screen->startHCol; + } + if (row == screen->endHRow && maxcol >= screen->endHCol) { + recurse++; + ScrnRefresh(screen, row, screen->endHCol, 1, + maxcol - screen->endHCol + 1, force); + maxcol = screen->endHCol - 1; + } + + /* + * If we're highlighting because the user is doing cut/paste, + * trim the trailing blanks from the highlighted region so we're + * showing the actual extent of the text that'll be cut. If + * we're selecting a blank line, we'll highlight one column + * anyway. + * + * We don't do this if the mouse-hilite mode is set because that + * would be too confusing. + * + * The default if the highlightSelection resource isn't set will + * highlight the whole width of the terminal, which is easy to + * see, but harder to use (because trailing blanks aren't as + * apparent). + */ + if (screen->highlight_selection && screen->send_mouse_pos != VT200_HIGHLIGHT_MOUSE) { - hi_col = screen->max_col; - while (hi_col > 0 && !(attrs[hi_col] & CHARDRAWN)) - hi_col--; - } - - /* remaining piece should be hilited */ - hilite = True; - } - - if (col > maxcol) continue; - - /* - * Go back to double-sized character dimensions if the line has - * double-width characters. Note that 'hi_col' is already in the - * right units. - */ - if_OPT_DEC_CHRSET({ - if (CSET_DOUBLE(*cb)) { - col /= 2; - maxcol /= 2; - } - cs = cb[col]; - }) + hi_col = screen->max_col; + while (hi_col > 0 && !(attrs[hi_col] & CHARDRAWN)) + hi_col--; + } + + /* remaining piece should be hilited */ + hilite = True; + } + + if (col > maxcol) + continue; - flags = attrs[col]; + /* + * Go back to double-sized character dimensions if the line has + * double-width characters. Note that 'hi_col' is already in the + * right units. + */ + if_OPT_DEC_CHRSET({ + if (CSET_DOUBLE(*cb)) { + col /= 2; + maxcol /= 2; + } + cs = cb[col]; + }); + + flags = attrs[col]; #if OPT_WIDE_CHARS - if (widec) - wideness = iswide(chars[col] | (widec[col]<<8)); - else - wideness = 0; -#endif - if_OPT_EXT_COLORS(screen,{ - fbf = SCRN_BUF_FGRND(screen, lastind + topline); - fbb = SCRN_BUF_BGRND(screen, lastind + topline); - fg_bg = (fbf[col] << 8) | (fbb[col]); - /* this combines them, then splits them again. but - extract_fg does more, so seems reasonable */ - fg = extract_fg(fg_bg, flags); - bg = extract_bg(fg_bg, flags); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fb = SCRN_BUF_COLOR(screen, lastind + topline); - fg_bg = fb[col]; - fg = extract_fg(fg_bg, flags); - bg = extract_bg(fg_bg, flags); - }) - gc = updatedXtermGC(screen, flags, fg_bg, hilite); - gc_changes |= (flags & (FG_COLOR|BG_COLOR)); - - x = CurCursorX(screen, row + topline, col); - lastind = col; - - for (; col <= maxcol; col++) { - if ((attrs[col] != flags) - || (hilite && (col > hi_col)) -#if OPT_ISO_COLORS -#if OPT_EXT_COLORS - || ((flags & FG_COLOR) && (extract_fg((fbf[col]<<8)|fbb[col],attrs[col]) != fg)) - || ((flags & BG_COLOR) && (extract_bg((fbf[col]<<8)|fbb[col],attrs[col]) != bg)) -#else - || ((flags & FG_COLOR) && (extract_fg(fb[col],attrs[col]) != fg)) - || ((flags & BG_COLOR) && (extract_bg(fb[col],attrs[col]) != bg)) + if (widec) + wideness = iswide(chars[col] | (widec[col] << 8)); + else + wideness = 0; #endif + if_OPT_EXT_COLORS(screen, { + fbf = SCRN_BUF_FGRND(screen, lastind + topline); + fbb = SCRN_BUF_BGRND(screen, lastind + topline); + fg_bg = ColorOf(col); + /* this combines them, then splits them again. but + extract_fg does more, so seems reasonable */ + fg = extract_fg(fg_bg, flags); + bg = extract_bg(fg_bg, flags); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + fb = SCRN_BUF_COLOR(screen, lastind + topline); + fg_bg = ColorOf(col); + fg = extract_fg(fg_bg, flags); + bg = extract_bg(fg_bg, flags); + }); + + gc = updatedXtermGC(screen, flags, fg_bg, hilite); + gc_changes |= (flags & (FG_COLOR | BG_COLOR)); + + x = CurCursorX(screen, row + topline, col); + lastind = col; + + for (; col <= maxcol; col++) { + if ((attrs[col] != flags) + || (hilite && (col > hi_col)) +#if OPT_ISO_COLORS + || ((flags & FG_COLOR) + && (extract_fg(ColorOf(col), attrs[col]) != fg)) + || ((flags & BG_COLOR) + && (extract_bg(ColorOf(col), attrs[col]) != bg)) #endif #if OPT_WIDE_CHARS - || (widec - && ((iswide(chars[col] | (widec[col]<<8))) != wideness) - && !((chars[col] | (widec[col]<<8))==HIDDEN_CHAR)) + || (widec + && ((iswide(chars[col] | (widec[col] << 8))) != wideness) + && !((chars[col] | (widec[col] << 8)) == HIDDEN_CHAR)) #endif #if OPT_DEC_CHRSET - || (cb[col] != cs) + || (cb[col] != cs) #endif - ) { - TRACE(("%s @%d, calling drawXtermText %d..%d:%s\n", - __FILE__, __LINE__, - lastind, col, - visibleChars( - PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), - col - lastind))); - x = drawXtermText(screen, flags, gc, x, y, - cs, - PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), - col - lastind, 0); - - if_OPT_WIDE_CHARS(screen, - { - int i; - Char *comb1l = BUF_COM1L(screen->visbuf, row + topline); - Char *comb2l = BUF_COM2L(screen->visbuf, row + topline); - Char *comb1h = BUF_COM1H(screen->visbuf, row + topline); - Char *comb2h = BUF_COM2H(screen->visbuf, row + topline); - for (i = lastind ; i < col; i++) { - int my_x = CurCursorX(screen, row + topline, i); - int base = chars[i] | (widec[i] << 8); - int comb1 = comb1l[i] | (comb1h[i] << 8); - int comb2 = comb2l[i] | (comb2h[i] << 8); - - if (iswide(base)) my_x = CurCursorX(screen, row + topline, i-1); - - if (comb1 != 0) { - drawXtermText(screen, flags, gc, my_x, y, cs, - PAIRED_CHARS(comb1l+i, comb1h+i), 1, iswide(base)); - } - - if (comb2 != 0) { - drawXtermText(screen, flags, gc, my_x, y, cs, - PAIRED_CHARS(comb2l+i, comb2h+i), 1, iswide(base)); - } - } - }) - - resetXtermGC(screen, flags, hilite); - - lastind = col; - - if (hilite && (col > hi_col)) - hilite = False; - - flags = attrs[col]; - if_OPT_EXT_COLORS(screen,{ - fg_bg = (fbf[col]<<8) | fbb[col]; - fg = extract_fg(fg_bg, flags); - bg = extract_bg(fg_bg, flags); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fg_bg = fb[col]; - fg = extract_fg(fg_bg, flags); - bg = extract_bg(fg_bg, flags); - }) - if_OPT_DEC_CHRSET({ - cs = cb[col]; - }) + ) { + TRACE(("ScrnRefresh looping drawXtermText %d..%d:%s\n", + lastind, col, + visibleChars(PAIRED_CHARS(&chars[lastind], + WIDEC_PTR(lastind)), + col - lastind))); + + test = flags; + checkVeryBoldColors(test, fg); + + x = drawXtermText(screen, test, gc, x, y, + cs, + PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), + col - lastind, 0); + + if_OPT_WIDE_CHARS(screen, { + int i; + Char *comb1l = BUF_COM1L(screen->visbuf, row + topline); + Char *comb2l = BUF_COM2L(screen->visbuf, row + topline); + Char *comb1h = BUF_COM1H(screen->visbuf, row + topline); + Char *comb2h = BUF_COM2H(screen->visbuf, row + topline); + for (i = lastind; i < col; i++) { + int my_x = CurCursorX(screen, row + topline, i); + int base = chars[i] | (widec[i] << 8); + int comb1 = comb1l[i] | (comb1h[i] << 8); + int comb2 = comb2l[i] | (comb2h[i] << 8); + + if (iswide(base)) + my_x = CurCursorX(screen, row + topline, i - 1); + + if (comb1 != 0) { + drawXtermText(screen, test, gc, my_x, y, cs, + PAIRED_CHARS(comb1l + i, comb1h + i), + 1, iswide(base)); + } + + if (comb2 != 0) { + drawXtermText(screen, test, gc, my_x, y, cs, + PAIRED_CHARS(comb2l + i, comb2h + i), + 1, iswide(base)); + } + } + }); + + resetXtermGC(screen, flags, hilite); + + lastind = col; + + if (hilite && (col > hi_col)) + hilite = False; + + flags = attrs[col]; + if_OPT_EXT_COLORS(screen, { + fg_bg = ColorOf(col); + fg = extract_fg(fg_bg, flags); + bg = extract_bg(fg_bg, flags); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + fg_bg = ColorOf(col); + fg = extract_fg(fg_bg, flags); + bg = extract_bg(fg_bg, flags); + }); + if_OPT_DEC_CHRSET({ + cs = cb[col]; + }); #if OPT_WIDE_CHARS - if (widec) - wideness = iswide(chars[col] | (widec[col]<<8)); + if (widec) + wideness = iswide(chars[col] | (widec[col] << 8)); #endif - gc = updatedXtermGC(screen, flags, fg_bg, hilite); - gc_changes |= (flags & (FG_COLOR|BG_COLOR)); - } - if(chars[col] == 0) { + gc = updatedXtermGC(screen, flags, fg_bg, hilite); + gc_changes |= (flags & (FG_COLOR | BG_COLOR)); + } + + if (chars[col] == 0) { #if OPT_WIDE_CHARS - if (widec == 0 || widec[col] == 0) + if (widec == 0 || widec[col] == 0) #endif - chars[col] = ' '; - } - } + chars[col] = ' '; + } + } - TRACE(("%s @%d, calling drawXtermText %d..%d:%s\n", - __FILE__, __LINE__, - lastind, col, - visibleChars(PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), col - lastind))); - drawXtermText(screen, flags, gc, x, y, - cs, - PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), - col - lastind, 0); - - if_OPT_WIDE_CHARS(screen, { - int i; - Char *comb1l = BUF_COM1L(screen->visbuf, row + topline); - Char *comb2l = BUF_COM2L(screen->visbuf, row + topline); - Char *comb1h = BUF_COM1H(screen->visbuf, row + topline); - Char *comb2h = BUF_COM2H(screen->visbuf, row + topline); - for (i = lastind ; i < col; i++) { - int my_x = CurCursorX(screen, row + topline, i); - int base = chars[i] | (widec[i] << 8); - int comb1 = comb1l[i] | (comb1h[i] << 8); - int comb2 = comb2l[i] | (comb2h[i] << 8); - - if (iswide(base)) my_x = CurCursorX(screen, row + topline, i-1); - - if (comb1 != 0) { - drawXtermText(screen, flags, gc, my_x, y, cs, - PAIRED_CHARS(comb1l+i, comb1h+i), 1, iswide(base)); - } + TRACE(("ScrnRefresh calling drawXtermText %d..%d:%s\n", + lastind, col, + visibleChars(PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), + col - lastind))); + + test = flags; + checkVeryBoldColors(test, fg); + + drawXtermText(screen, test, gc, x, y, + cs, + PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), + col - lastind, 0); + + if_OPT_WIDE_CHARS(screen, { + int i; + Char *comb1l = BUF_COM1L(screen->visbuf, row + topline); + Char *comb2l = BUF_COM2L(screen->visbuf, row + topline); + Char *comb1h = BUF_COM1H(screen->visbuf, row + topline); + Char *comb2h = BUF_COM2H(screen->visbuf, row + topline); + for (i = lastind; i < col; i++) { + int my_x = CurCursorX(screen, row + topline, i); + int base = chars[i] | (widec[i] << 8); + int comb1 = comb1l[i] | (comb1h[i] << 8); + int comb2 = comb2l[i] | (comb2h[i] << 8); + + if (iswide(base)) + my_x = CurCursorX(screen, row + topline, i - 1); + + if (comb1 != 0) { + drawXtermText(screen, test, gc, my_x, y, cs, + PAIRED_CHARS(comb1l + i, comb1h + i), + 1, iswide(base)); + } - if (comb2 != 0) { - drawXtermText(screen, flags, gc, my_x, y, cs, - PAIRED_CHARS(comb2l+i, comb2h+i), 1, iswide(base)); - } + if (comb2 != 0) { + drawXtermText(screen, test, gc, my_x, y, cs, + PAIRED_CHARS(comb2l + i, comb2h + i), + 1, iswide(base)); } - }) + } + }); - resetXtermGC(screen, flags, hilite); - } + resetXtermGC(screen, flags, hilite); + } - /* - * If we're in color mode, reset the various GC's to the current - * screen foreground and background so that other functions (e.g., - * ClearRight) will get the correct colors. - */ - if_OPT_ISO_COLORS(screen,{ - if (gc_changes & FG_COLOR) - SGR_Foreground(term->cur_foreground); - if (gc_changes & BG_COLOR) - SGR_Background(term->cur_background); - }) + /* + * If we're in color mode, reset the various GC's to the current + * screen foreground and background so that other functions (e.g., + * ClearRight) will get the correct colors. + */ + if_OPT_ISO_COLORS(screen, { + if (gc_changes & FG_COLOR) + SGR_Foreground(term->cur_foreground); + if (gc_changes & BG_COLOR) + SGR_Background(term->cur_background); + }); #if defined(__CYGWIN__) && defined(TIOCSWINSZ) - if (first_time == 1) { - struct winsize ws; + if (first_time == 1) { + struct winsize ws; - first_time = 0; - ws.ws_row = nrows; - ws.ws_col = ncols; - ws.ws_xpixel = term->core.width; - ws.ws_ypixel = term->core.height; - ioctl (screen->respond, TIOCSWINSZ, (char *)&ws); - } + first_time = 0; + ws.ws_row = nrows; + ws.ws_col = ncols; + ws.ws_xpixel = term->core.width; + ws.ws_ypixel = term->core.height; + ioctl(screen->respond, TIOCSWINSZ, (char *) &ws); + } #endif - recurse--; + recurse--; } /* @@ -1051,39 +1072,38 @@ * Requires first <= last; first, last are rows of screen->buf. */ void -ClearBufRows ( - TScreen *screen, - int first, - int last) +ClearBufRows(TScreen * screen, + int first, + int last) { - ScrnBuf buf = screen->visbuf; - int len = screen->max_col + 1; - int row; - int flags = TERM_COLOR_FLAGS; - - TRACE(("ClearBufRows %d..%d\n", first, last)); - for (row = first; row <= last; row++) { - ScrnClrWrapped(screen, row); - bzero (BUF_CHARS(buf, row), len); - memset(BUF_ATTRS(buf, row), flags, len); - if_OPT_EXT_COLORS(screen,{ - memset(BUF_FGRND(buf, row), term->sgr_foreground, len); - memset(BUF_BGRND(buf, row), term->cur_background, len); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - memset(BUF_COLOR(buf, row), xtermColorPair(), len); - }) - if_OPT_DEC_CHRSET({ - memset(BUF_CSETS(buf, row), 0, len); - }) - if_OPT_WIDE_CHARS(screen,{ - memset(BUF_WIDEC(buf, row), 0, len); - memset(BUF_COM1L(buf, row), 0, len); - memset(BUF_COM1H(buf, row), 0, len); - memset(BUF_COM2L(buf, row), 0, len); - memset(BUF_COM2H(buf, row), 0, len); - }) - } + ScrnBuf buf = screen->visbuf; + int len = screen->max_col + 1; + int row; + int flags = TERM_COLOR_FLAGS; + + TRACE(("ClearBufRows %d..%d\n", first, last)); + for (row = first; row <= last; row++) { + ScrnClrWrapped(screen, row); + bzero(BUF_CHARS(buf, row), len); + memset(BUF_ATTRS(buf, row), flags, len); + if_OPT_EXT_COLORS(screen, { + memset(BUF_FGRND(buf, row), term->sgr_foreground, len); + memset(BUF_BGRND(buf, row), term->cur_background, len); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + memset(BUF_COLOR(buf, row), xtermColorPair(), len); + }); + if_OPT_DEC_CHRSET({ + memset(BUF_CSETS(buf, row), 0, len); + }); + if_OPT_WIDE_CHARS(screen, { + memset(BUF_WIDEC(buf, row), 0, len); + memset(BUF_COM1L(buf, row), 0, len); + memset(BUF_COM1H(buf, row), 0, len); + memset(BUF_COM2L(buf, row), 0, len); + memset(BUF_COM2H(buf, row), 0, len); + }); + } } /* @@ -1103,170 +1123,175 @@ 8. Returns 0 */ int -ScreenResize ( - TScreen *screen, - int width, - int height, - unsigned *flags) +ScreenResize(TScreen * screen, + int width, + int height, + unsigned *flags) { - int code; - int rows, cols; - int border = 2 * screen->border; - int move_down_by; + int code; + int rows, cols; + int border = 2 * screen->border; + int move_down_by; #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - struct ttysize ts; + struct ttysize ts; #elif defined(TIOCSWINSZ) - struct winsize ws; -#endif /* sun vs TIOCSWINSZ */ - Window tw = VWindow (screen); + struct winsize ws; +#endif /* sun vs TIOCSWINSZ */ + Window tw = VWindow(screen); + + TRACE(("ScreenResize %dx%d\n", height, width)); + + /* clear the right and bottom internal border because of NorthWest + gravity might have left junk on the right and bottom edges */ + if (width >= FullWidth(screen)) { + XClearArea(screen->display, tw, + FullWidth(screen), 0, /* right edge */ + 0, height, /* from top to bottom */ + False); + } + if (height >= FullHeight(screen)) { + XClearArea(screen->display, tw, + 0, FullHeight(screen), /* bottom */ + width, 0, /* all across the bottom */ + False); + } + + /* round so that it is unlikely the screen will change size on */ + /* small mouse movements. */ + rows = (height + FontHeight(screen) / 2 - border) / + FontHeight(screen); + cols = (width + FontWidth(screen) / 2 - border - ScrollbarWidth(screen)) / + FontWidth(screen); + if (rows < 1) + rows = 1; + if (cols < 1) + cols = 1; + + /* update buffers if the screen has changed size */ + if (screen->max_row != rows - 1 || screen->max_col != cols - 1) { + int savelines = screen->scrollWidget + ? screen->savelines : 0; + int delta_rows = rows - (screen->max_row + 1); + + TRACE(("...ScreenResize chars %dx%d\n", rows, cols)); + + if (screen->cursor_state) + HideCursor(); + if (screen->alternate + && term->misc.resizeGravity == SouthWestGravity) + /* swap buffer pointers back to make all this hair work */ + SwitchBufPtrs(screen); + if (screen->altbuf) + (void) Reallocate(&screen->altbuf, + &screen->abuf_address, + rows, + cols, + screen->max_row + 1, + screen->max_col + 1); + move_down_by = Reallocate(&screen->allbuf, + &screen->sbuf_address, + rows + savelines, cols, + screen->max_row + 1 + savelines, + screen->max_col + 1); + screen->visbuf = &screen->allbuf[MAX_PTRS * savelines]; + + screen->max_row += delta_rows; + screen->max_col = cols - 1; + + if (term->misc.resizeGravity == SouthWestGravity) { + screen->savedlines -= move_down_by; + if (screen->savedlines < 0) + screen->savedlines = 0; + if (screen->savedlines > screen->savelines) + screen->savedlines = screen->savelines; + if (screen->topline < -screen->savedlines) + screen->topline = -screen->savedlines; + screen->cur_row += move_down_by; + screen->cursor_row += move_down_by; + ScrollSelection(screen, move_down_by); + + if (screen->alternate) + SwitchBufPtrs(screen); /* put the pointers back */ + } + + /* adjust scrolling region */ + screen->top_marg = 0; + screen->bot_marg = screen->max_row; + *flags &= ~ORIGIN; + + if (screen->cur_row > screen->max_row) + screen->cur_row = screen->max_row; + if (screen->cur_col > screen->max_col) + screen->cur_col = screen->max_col; + + screen->fullVwin.height = height - border; + screen->fullVwin.width = width - border - screen->fullVwin.sb_info.width; + + } else if (FullHeight(screen) == height && FullWidth(screen) == width) + return (0); /* nothing has changed at all */ - TRACE(("ScreenResize %dx%d\n", height, width)); + screen->fullVwin.fullheight = height; + screen->fullVwin.fullwidth = width; - /* clear the right and bottom internal border because of NorthWest - gravity might have left junk on the right and bottom edges */ - if (width >= FullWidth(screen)) { - XClearArea (screen->display, tw, - FullWidth(screen), 0, /* right edge */ - 0, height, /* from top to bottom */ - False); - } - if (height >= FullHeight(screen)) { - XClearArea (screen->display, tw, - 0, FullHeight(screen), /* bottom */ - width, 0, /* all across the bottom */ - False); - } + if (screen->scrollWidget) + ResizeScrollBar(screen); - /* round so that it is unlikely the screen will change size on */ - /* small mouse movements. */ - rows = (height + FontHeight(screen) / 2 - border) / - FontHeight(screen); - cols = (width + FontWidth(screen) / 2 - border - ScrollbarWidth(screen)) / - FontWidth(screen); - if (rows < 1) rows = 1; - if (cols < 1) cols = 1; - - /* update buffers if the screen has changed size */ - if (screen->max_row != rows - 1 || screen->max_col != cols - 1) { - int savelines = screen->scrollWidget - ? screen->savelines : 0; - int delta_rows = rows - (screen->max_row + 1); - - TRACE(("...ScreenResize chars %dx%d\n", rows, cols)); - - if(screen->cursor_state) - HideCursor(); - if ( screen->alternate - && term->misc.resizeGravity == SouthWestGravity ) - /* swap buffer pointers back to make all this hair work */ - SwitchBufPtrs(screen); - if (screen->altbuf) - (void) Reallocate(&screen->altbuf, &screen->abuf_address, - rows, cols, screen->max_row + 1, screen->max_col + 1); - move_down_by = Reallocate(&screen->allbuf, - &screen->sbuf_address, - rows + savelines, cols, - screen->max_row + 1 + savelines, - screen->max_col + 1); - screen->visbuf = &screen->allbuf[MAX_PTRS * savelines]; - - screen->max_row += delta_rows; - screen->max_col = cols - 1; - - if (term->misc.resizeGravity == SouthWestGravity) { - screen->savedlines -= move_down_by; - if (screen->savedlines < 0) - screen->savedlines = 0; - if (screen->savedlines > screen->savelines) - screen->savedlines = screen->savelines; - if (screen->topline < -screen->savedlines) - screen->topline = -screen->savedlines; - screen->cur_row += move_down_by; - screen->cursor_row += move_down_by; - ScrollSelection(screen, move_down_by); + ResizeSelection(screen, rows, cols); - if (screen->alternate) - SwitchBufPtrs(screen); /* put the pointers back */ - } - - /* adjust scrolling region */ - screen->top_marg = 0; - screen->bot_marg = screen->max_row; - *flags &= ~ORIGIN; - - if (screen->cur_row > screen->max_row) - screen->cur_row = screen->max_row; - if (screen->cur_col > screen->max_col) - screen->cur_col = screen->max_col; - - screen->fullVwin.height = height - border; - screen->fullVwin.width = width - border - screen->fullVwin.sb_info.width; - - } else if(FullHeight(screen) == height && FullWidth(screen) == width) - return(0); /* nothing has changed at all */ - - screen->fullVwin.fullheight = height; - screen->fullVwin.fullwidth = width; - - if(screen->scrollWidget) - ResizeScrollBar(screen); - - ResizeSelection (screen, rows, cols); - #ifndef NO_ACTIVE_ICON - if (screen->iconVwin.window) { - XWindowChanges changes; - screen->iconVwin.width = - (screen->max_col + 1) * screen->iconVwin.f_width; - - screen->iconVwin.height = - (screen->max_row + 1) * screen->iconVwin.f_height; - - changes.width = screen->iconVwin.fullwidth = - screen->iconVwin.width + 2 * screen->border; - - changes.height = screen->iconVwin.fullheight = - screen->iconVwin.height + 2 * screen->border; - - XConfigureWindow(XtDisplay(term), screen->iconVwin.window, - CWWidth|CWHeight,&changes); - } + if (screen->iconVwin.window) { + XWindowChanges changes; + screen->iconVwin.width = + (screen->max_col + 1) * screen->iconVwin.f_width; + + screen->iconVwin.height = + (screen->max_row + 1) * screen->iconVwin.f_height; + + changes.width = screen->iconVwin.fullwidth = + screen->iconVwin.width + 2 * screen->border; + + changes.height = screen->iconVwin.fullheight = + screen->iconVwin.height + 2 * screen->border; + + XConfigureWindow(XtDisplay(term), screen->iconVwin.window, + CWWidth | CWHeight, &changes); + } #endif /* NO_ACTIVE_ICON */ #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) - /* Set tty's idea of window size */ - ts.ts_lines = rows; - ts.ts_cols = cols; - code = ioctl (screen->respond, TIOCSSIZE, &ts); - TRACE(("return %d from TIOCSSIZE %dx%d\n", code, rows, cols)); + /* Set tty's idea of window size */ + ts.ts_lines = rows; + ts.ts_cols = cols; + code = ioctl(screen->respond, TIOCSSIZE, &ts); + TRACE(("return %d from TIOCSSIZE %dx%d\n", code, rows, cols)); #ifdef SIGWINCH - if(screen->pid > 1) { - int pgrp; + if (screen->pid > 1) { + int pgrp; - if (ioctl (screen->respond, TIOCGPGRP, &pgrp) != -1) - kill_process_group(pgrp, SIGWINCH); - } -#endif /* SIGWINCH */ + if (ioctl(screen->respond, TIOCGPGRP, &pgrp) != -1) + kill_process_group(pgrp, SIGWINCH); + } +#endif /* SIGWINCH */ #elif defined(TIOCSWINSZ) - /* Set tty's idea of window size */ - ws.ws_row = rows; - ws.ws_col = cols; - ws.ws_xpixel = width; - ws.ws_ypixel = height; - code = ioctl (screen->respond, TIOCSWINSZ, (char *)&ws); - TRACE(("return %d from TIOCSWINSZ %dx%d\n", code, rows, cols)); -#ifdef notdef /* change to SIGWINCH if this doesn't work for you */ - if(screen->pid > 1) { - int pgrp; - - if (ioctl (screen->respond, TIOCGPGRP, &pgrp) != -1) - kill_process_group(pgrp, SIGWINCH); - } -#endif /* SIGWINCH */ + /* Set tty's idea of window size */ + ws.ws_row = rows; + ws.ws_col = cols; + ws.ws_xpixel = width; + ws.ws_ypixel = height; + code = ioctl(screen->respond, TIOCSWINSZ, (char *) &ws); + TRACE(("return %d from TIOCSWINSZ %dx%d\n", code, rows, cols)); +#ifdef notdef /* change to SIGWINCH if this doesn't work for you */ + if (screen->pid > 1) { + int pgrp; + + if (ioctl(screen->respond, TIOCGPGRP, &pgrp) != -1) + kill_process_group(pgrp, SIGWINCH); + } +#endif /* SIGWINCH */ #else - TRACE(("ScreenResize cannot do anything to pty\n")); -#endif /* sun vs TIOCSWINSZ */ - return (0); + TRACE(("ScreenResize cannot do anything to pty\n")); +#endif /* sun vs TIOCSWINSZ */ + return (0); } /* @@ -1274,28 +1299,27 @@ * nonnull. */ Bool -non_blank_line( - ScrnBuf sb, - int row, - int col, - int len) +non_blank_line(ScrnBuf sb, + int row, + int col, + int len) { - int i; - Char *ptr = BUF_CHARS(sb, row); + int i; + Char *ptr = BUF_CHARS(sb, row); - for (i = col; i < len; i++) { + for (i = col; i < len; i++) { + if (ptr[i]) + return True; + } + + if_OPT_WIDE_CHARS((&(term->screen)), { + if ((ptr = BUF_WIDEC(sb, row)) != 0) { + for (i = col; i < len; i++) { if (ptr[i]) - return True; + return True; + } } - - if_OPT_WIDE_CHARS((&(term->screen)),{ - if ((ptr = BUF_WIDEC(sb, row)) != 0) { - for (i = col; i < len; i++) { - if (ptr[i]) - return True; - } - } - }) + }); - return False; + return False; } Index: xc/programs/xterm/scrollbar.c diff -u xc/programs/xterm/scrollbar.c:3.31 xc/programs/xterm/scrollbar.c:3.36 --- xc/programs/xterm/scrollbar.c:3.31 Sat Sep 8 21:07:26 2001 +++ xc/programs/xterm/scrollbar.c Fri Dec 27 16:05:23 2002 @@ -2,10 +2,10 @@ * $Xorg: scrollbar.c,v 1.4 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/scrollbar.c,v 3.31 2001/09/09 01:07:26 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/scrollbar.c,v 3.36 2002/12/27 21:05:23 dickey Exp $ */ /* - * Copyright 2000,2001 by Thomas E. Dickey + * Copyright 2000-2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -59,10 +59,14 @@ #include <xterm.h> #include <X11/Xatom.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> +#if defined(HAVE_LIB_XAW) #include <X11/Xaw/Scrollbar.h> +#elif defined(HAVE_LIB_XAW3D) +#include <X11/Xaw3d/Scrollbar.h> +#elif defined(HAVE_LIB_NEXTAW) +#include <X11/neXtaw/Scrollbar.h> +#endif #include <data.h> #include <error.h> @@ -74,7 +78,6 @@ static void ScrollTextTo PROTO_XT_CALLBACK_ARGS; static void ScrollTextUpDownBy PROTO_XT_CALLBACK_ARGS; - /* resize the text window for a terminal screen, modifying the * appropriate WM_SIZE_HINTS and taking advantage of bit gravity. */ @@ -82,378 +85,378 @@ static void ResizeScreen(XtermWidget xw, int min_width, int min_height) { - TScreen *screen = &xw->screen; + TScreen *screen = &xw->screen; #ifndef nothack - XSizeHints sizehints; - long supp; + XSizeHints sizehints; + long supp; #endif - XtGeometryResult geomreqresult; - Dimension reqWidth, reqHeight, repWidth, repHeight; + XtGeometryResult geomreqresult; + Dimension reqWidth, reqHeight, repWidth, repHeight; #ifndef NO_ACTIVE_ICON - struct _vtwin *saveWin = screen->whichVwin; + struct _vtwin *saveWin = screen->whichVwin; - /* all units here want to be in the normal font units */ - screen->whichVwin = &screen->fullVwin; + /* all units here want to be in the normal font units */ + screen->whichVwin = &screen->fullVwin; #endif /* NO_ACTIVE_ICON */ - /* - * I'm going to try to explain, as I understand it, why we - * have to do XGetWMNormalHints and XSetWMNormalHints here, - * although I can't guarantee that I've got it right. - * - * In a correctly written toolkit program, the Shell widget - * parses the user supplied geometry argument. However, - * because of the way xterm does things, the VT100 widget does - * the parsing of the geometry option, not the Shell widget. - * The result of this is that the Shell widget doesn't set the - * correct window manager hints, and doesn't know that the - * user has specified a geometry. - * - * The XtVaSetValues call below tells the Shell widget to - * change its hints. However, since it's confused about the - * hints to begin with, it doesn't get them all right when it - * does the SetValues -- it undoes some of what the VT100 - * widget did when it originally set the hints. - * - * To fix this, we do the following: - * - * 1. Get the sizehints directly from the window, going around - * the (confused) shell widget. - * 2. Call XtVaSetValues to let the shell widget know which - * hints have changed. Note that this may not even be - * necessary, since we're going to right ahead after that - * and set the hints ourselves, but it's good to put it - * here anyway, so that when we finally do fix the code so - * that the Shell does the right thing with hints, we - * already have the XtVaSetValues in place. - * 3. We set the sizehints directly, this fixing up whatever - * damage was done by the Shell widget during the - * XtVaSetValues. - * - * Gross, huh? - * - * The correct fix is to redo VTRealize, VTInitialize and - * VTSetValues so that font processing happens early enough to - * give back responsibility for the size hints to the Shell. - * - * Someday, we hope to have time to do this. Someday, we hope - * to have time to completely rewrite xterm. - */ + /* + * I'm going to try to explain, as I understand it, why we + * have to do XGetWMNormalHints and XSetWMNormalHints here, + * although I can't guarantee that I've got it right. + * + * In a correctly written toolkit program, the Shell widget + * parses the user supplied geometry argument. However, + * because of the way xterm does things, the VT100 widget does + * the parsing of the geometry option, not the Shell widget. + * The result of this is that the Shell widget doesn't set the + * correct window manager hints, and doesn't know that the + * user has specified a geometry. + * + * The XtVaSetValues call below tells the Shell widget to + * change its hints. However, since it's confused about the + * hints to begin with, it doesn't get them all right when it + * does the SetValues -- it undoes some of what the VT100 + * widget did when it originally set the hints. + * + * To fix this, we do the following: + * + * 1. Get the sizehints directly from the window, going around + * the (confused) shell widget. + * 2. Call XtVaSetValues to let the shell widget know which + * hints have changed. Note that this may not even be + * necessary, since we're going to right ahead after that + * and set the hints ourselves, but it's good to put it + * here anyway, so that when we finally do fix the code so + * that the Shell does the right thing with hints, we + * already have the XtVaSetValues in place. + * 3. We set the sizehints directly, this fixing up whatever + * damage was done by the Shell widget during the + * XtVaSetValues. + * + * Gross, huh? + * + * The correct fix is to redo VTRealize, VTInitialize and + * VTSetValues so that font processing happens early enough to + * give back responsibility for the size hints to the Shell. + * + * Someday, we hope to have time to do this. Someday, we hope + * to have time to completely rewrite xterm. + */ - TRACE(("ResizeScreen(min_width=%d, min_height=%d) xw=%#lx\n", - min_width, min_height, (long) xw)); + TRACE(("ResizeScreen(min_width=%d, min_height=%d) xw=%#lx\n", + min_width, min_height, (long) xw)); #ifndef nothack - /* - * NOTE: If you change the way any of the hints are calculated - * below, make sure you change the calculation both in the - * sizehints assignments and in the XtVaSetValues. - */ - - if (! XGetWMNormalHints(screen->display, XtWindow(XtParent(xw)), - &sizehints, &supp)) - bzero(&sizehints, sizeof(sizehints)); - sizehints.base_width = min_width; - sizehints.base_height = min_height; - sizehints.width_inc = FontWidth(screen); - sizehints.height_inc = FontHeight(screen); - sizehints.min_width = sizehints.base_width + sizehints.width_inc; - sizehints.min_height = sizehints.base_height + sizehints.height_inc; - sizehints.flags |= (PBaseSize|PMinSize|PResizeInc); - /* These are obsolete, but old clients may use them */ - sizehints.width = (screen->max_col + 1) * FontWidth(screen) - + min_width; - sizehints.height = (screen->max_row + 1) * FontHeight(screen) - + min_height; + /* + * NOTE: If you change the way any of the hints are calculated + * below, make sure you change the calculation both in the + * sizehints assignments and in the XtVaSetValues. + */ + + if (!XGetWMNormalHints(screen->display, XtWindow(XtParent(xw)), + &sizehints, &supp)) + bzero(&sizehints, sizeof(sizehints)); + sizehints.base_width = min_width; + sizehints.base_height = min_height; + sizehints.width_inc = FontWidth(screen); + sizehints.height_inc = FontHeight(screen); + sizehints.min_width = sizehints.base_width + sizehints.width_inc; + sizehints.min_height = sizehints.base_height + sizehints.height_inc; + sizehints.flags |= (PBaseSize | PMinSize | PResizeInc); + /* These are obsolete, but old clients may use them */ + sizehints.width = (screen->max_col + 1) * FontWidth(screen) + + min_width; + sizehints.height = (screen->max_row + 1) * FontHeight(screen) + + min_height; #endif - /* - * Note: width and height are not set here because they are - * obsolete. - */ - XtVaSetValues(XtParent(xw), - XtNbaseWidth, min_width, - XtNbaseHeight, min_height, - XtNwidthInc, FontWidth(screen), - XtNheightInc, FontHeight(screen), - XtNminWidth, min_width + FontWidth(screen), - XtNminHeight, min_height + FontHeight(screen), - NULL); - - reqWidth = screen->fullVwin.f_width * (screen->max_col + 1) + min_width; - reqHeight = screen->fullVwin.f_height * (screen->max_row + 1) + min_height; - - TRACE(("...requesting screensize chars %dx%d, pixels %dx%d\n", - (screen->max_row + 1), - (screen->max_col + 1), - reqHeight, reqWidth)); - - geomreqresult = XtMakeResizeRequest ((Widget)xw, reqWidth, reqHeight, - &repWidth, &repHeight); - - if (geomreqresult == XtGeometryAlmost) { - TRACE(("...almost, retry screensize %dx%d\n", repHeight, repWidth)); - geomreqresult = XtMakeResizeRequest ((Widget)xw, repWidth, - repHeight, NULL, NULL); - } - XSync(screen->display, FALSE); /* synchronize */ - if(XtAppPending(app_con)) - xevents(); + /* + * Note: width and height are not set here because they are + * obsolete. + */ + XtVaSetValues(XtParent(xw), + XtNbaseWidth, min_width, + XtNbaseHeight, min_height, + XtNwidthInc, FontWidth(screen), + XtNheightInc, FontHeight(screen), + XtNminWidth, min_width + FontWidth(screen), + XtNminHeight, min_height + FontHeight(screen), + (XtPointer) 0); + + reqWidth = screen->fullVwin.f_width * (screen->max_col + 1) + min_width; + reqHeight = screen->fullVwin.f_height * (screen->max_row + 1) + min_height; + + TRACE(("...requesting screensize chars %dx%d, pixels %dx%d\n", + (screen->max_row + 1), + (screen->max_col + 1), + reqHeight, reqWidth)); + + geomreqresult = XtMakeResizeRequest((Widget) xw, reqWidth, reqHeight, + &repWidth, &repHeight); + + if (geomreqresult == XtGeometryAlmost) { + TRACE(("...almost, retry screensize %dx%d\n", repHeight, repWidth)); + geomreqresult = XtMakeResizeRequest((Widget) xw, repWidth, + repHeight, NULL, NULL); + } + XSync(screen->display, FALSE); /* synchronize */ + if (XtAppPending(app_con)) + xevents(); #ifndef nothack - XSetWMNormalHints(screen->display, XtWindow(XtParent(xw)), &sizehints); + XSetWMNormalHints(screen->display, XtWindow(XtParent(xw)), &sizehints); #endif #ifndef NO_ACTIVE_ICON - screen->whichVwin = saveWin; + screen->whichVwin = saveWin; #endif /* NO_ACTIVE_ICON */ } -void DoResizeScreen (XtermWidget xw) +void +DoResizeScreen(XtermWidget xw) { int border = 2 * xw->screen.border; - ResizeScreen (xw, border + xw->screen.fullVwin.sb_info.width, border); + ResizeScreen(xw, border + xw->screen.fullVwin.sb_info.width, border); } - static Widget CreateScrollBar(XtermWidget xw, int x, int y, int height) { - Widget scrollWidget; - Arg args[6]; + Widget scrollWidget; + Arg args[6]; - XtSetArg(args[0], XtNx, x); - XtSetArg(args[1], XtNy, y); - XtSetArg(args[2], XtNheight, height); - XtSetArg(args[3], XtNreverseVideo, xw->misc.re_verse); - XtSetArg(args[4], XtNorientation, XtorientVertical); - XtSetArg(args[5], XtNborderWidth, 1); - - scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass, - (Widget)xw, args, XtNumber(args)); - XtAddCallback (scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0); - XtAddCallback (scrollWidget, XtNjumpProc, ScrollTextTo, 0); - return (scrollWidget); + XtSetArg(args[0], XtNx, x); + XtSetArg(args[1], XtNy, y); + XtSetArg(args[2], XtNheight, height); + XtSetArg(args[3], XtNreverseVideo, xw->misc.re_verse); + XtSetArg(args[4], XtNorientation, XtorientVertical); + XtSetArg(args[5], XtNborderWidth, 1); + + scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass, + (Widget) xw, args, XtNumber(args)); + XtAddCallback(scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0); + XtAddCallback(scrollWidget, XtNjumpProc, ScrollTextTo, 0); + return (scrollWidget); } - void ScrollBarReverseVideo(Widget scrollWidget) { - SbInfo *sb = &(term->screen.fullVwin.sb_info); - Arg args[4]; - Cardinal nargs = XtNumber(args); - - /* - * Remember the scrollbar's original colors. - */ - if (sb->rv_cached == False) { - XtSetArg(args[0], XtNbackground, &(sb->bg)); - XtSetArg(args[1], XtNforeground, &(sb->fg)); - XtSetArg(args[2], XtNborderColor, &(sb->bdr)); - XtSetArg(args[3], XtNborderPixmap, &(sb->bdpix)); - XtGetValues (scrollWidget, args, nargs); - sb->rv_cached = True; - sb->rv_active = 0; - } + SbInfo *sb = &(term->screen.fullVwin.sb_info); + Arg args[4]; + Cardinal nargs = XtNumber(args); + + /* + * Remember the scrollbar's original colors. + */ + if (sb->rv_cached == False) { + XtSetArg(args[0], XtNbackground, &(sb->bg)); + XtSetArg(args[1], XtNforeground, &(sb->fg)); + XtSetArg(args[2], XtNborderColor, &(sb->bdr)); + XtSetArg(args[3], XtNborderPixmap, &(sb->bdpix)); + XtGetValues(scrollWidget, args, nargs); + sb->rv_cached = True; + sb->rv_active = 0; + } - sb->rv_active = !(sb->rv_active); - XtSetArg(args[!(sb->rv_active)], XtNbackground, sb->bg); - XtSetArg(args[ (sb->rv_active)], XtNforeground, sb->fg); - nargs = 2; /* don't set border_pixmap */ - if (sb->bdpix == XtUnspecifiedPixmap) { /* if not pixmap then pixel */ - if (sb->rv_active) { /* keep border visible */ - XtSetArg(args[2], XtNborderColor, args[1].value); - } else { - XtSetArg(args[2], XtNborderColor, sb->bdr); - } - nargs = 3; + sb->rv_active = !(sb->rv_active); + XtSetArg(args[!(sb->rv_active)], XtNbackground, sb->bg); + XtSetArg(args[(sb->rv_active)], XtNforeground, sb->fg); + nargs = 2; /* don't set border_pixmap */ + if (sb->bdpix == XtUnspecifiedPixmap) { /* if not pixmap then pixel */ + if (sb->rv_active) { /* keep border visible */ + XtSetArg(args[2], XtNborderColor, args[1].value); + } else { + XtSetArg(args[2], XtNborderColor, sb->bdr); } - XtSetValues (scrollWidget, args, nargs); + nargs = 3; + } + XtSetValues(scrollWidget, args, nargs); } - void ScrollBarDrawThumb(Widget scrollWidget) { - TScreen *screen = &term->screen; - int thumbTop, thumbHeight, totalHeight; + TScreen *screen = &term->screen; + int thumbTop, thumbHeight, totalHeight; - thumbTop = screen->topline + screen->savedlines; - thumbHeight = screen->max_row + 1; - totalHeight = thumbHeight + screen->savedlines; - - XawScrollbarSetThumb(scrollWidget, - ((float)thumbTop) / totalHeight, - ((float)thumbHeight) / totalHeight); + thumbTop = screen->topline + screen->savedlines; + thumbHeight = screen->max_row + 1; + totalHeight = thumbHeight + screen->savedlines; + + XawScrollbarSetThumb(scrollWidget, + ((float) thumbTop) / totalHeight, + ((float) thumbHeight) / totalHeight); } void -ResizeScrollBar(TScreen *screen) +ResizeScrollBar(TScreen * screen) { - XtConfigureWidget( - screen->scrollWidget, + XtConfigureWidget( + screen->scrollWidget, #ifdef SCROLLBAR_RIGHT - (term->misc.useRight) - ? (screen->fullVwin.fullwidth - - screen->scrollWidget->core.width - - screen->scrollWidget->core.border_width) - : -1, + (term->misc.useRight) + ? (screen->fullVwin.fullwidth - + screen->scrollWidget->core.width - + screen->scrollWidget->core.border_width) + : -1, #else - -1, + -1, #endif - -1, - screen->scrollWidget->core.width, - screen->fullVwin.height + screen->border * 2, - screen->scrollWidget->core.border_width); - ScrollBarDrawThumb(screen->scrollWidget); + -1, + screen->scrollWidget->core.width, + screen->fullVwin.height + screen->border * 2, + screen->scrollWidget->core.border_width); + ScrollBarDrawThumb(screen->scrollWidget); } void -WindowScroll(TScreen *screen, int top) +WindowScroll(TScreen * screen, int top) { - int i, lines; - int scrolltop, scrollheight, refreshtop; - int x = 0; - - if (top < -screen->savedlines) - top = -screen->savedlines; - else if (top > 0) - top = 0; - if((i = screen->topline - top) == 0) { - ScrollBarDrawThumb(screen->scrollWidget); - return; - } + int i, lines; + int scrolltop, scrollheight, refreshtop; + int x = 0; + + if (top < -screen->savedlines) + top = -screen->savedlines; + else if (top > 0) + top = 0; + if ((i = screen->topline - top) == 0) { + ScrollBarDrawThumb(screen->scrollWidget); + return; + } - if(screen->cursor_state) - HideCursor(); - lines = i > 0 ? i : -i; - if(lines > screen->max_row + 1) - lines = screen->max_row + 1; - scrollheight = screen->max_row - lines + 1; - if(i > 0) - refreshtop = scrolltop = 0; - else { - scrolltop = lines; - refreshtop = scrollheight; - } - x = OriginX(screen); - scrolling_copy_area(screen, scrolltop, scrollheight, -i); - screen->topline = top; - - ScrollSelection(screen, i); - - XClearArea( - screen->display, - VWindow(screen), - (int) x, - (int) refreshtop * FontHeight(screen) + screen->border, - (unsigned) Width(screen), - (unsigned) lines * FontHeight(screen), - FALSE); - ScrnRefresh(screen, refreshtop, 0, lines, screen->max_col + 1, False); + if (screen->cursor_state) + HideCursor(); + lines = i > 0 ? i : -i; + if (lines > screen->max_row + 1) + lines = screen->max_row + 1; + scrollheight = screen->max_row - lines + 1; + if (i > 0) + refreshtop = scrolltop = 0; + else { + scrolltop = lines; + refreshtop = scrollheight; + } + x = OriginX(screen); + scrolling_copy_area(screen, scrolltop, scrollheight, -i); + screen->topline = top; + + ScrollSelection(screen, i); + + XClearArea( + screen->display, + VWindow(screen), + (int) x, + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) lines * FontHeight(screen), + FALSE); + ScrnRefresh(screen, refreshtop, 0, lines, screen->max_col + 1, False); - ScrollBarDrawThumb(screen->scrollWidget); + ScrollBarDrawThumb(screen->scrollWidget); } void -ScrollBarOn (XtermWidget xw, int init, int doalloc) +ScrollBarOn(XtermWidget xw, int init, int doalloc) { - TScreen *screen = &xw->screen; - int i, j, k; + TScreen *screen = &xw->screen; + int i, j, k; - if(screen->fullVwin.sb_info.width) - return; - - if (init) { /* then create it only */ - if (screen->scrollWidget) return; - - /* make it a dummy size and resize later */ - if ((screen->scrollWidget = CreateScrollBar (xw, -1, -1, 5)) - == NULL) { - Bell(XkbBI_MinorError,0); - return; - } + if (screen->fullVwin.sb_info.width) + return; + if (init) { /* then create it only */ + if (screen->scrollWidget) return; - } - - if (!screen->scrollWidget) { - Bell (XkbBI_MinorError,0); - Bell (XkbBI_MinorError,0); + /* make it a dummy size and resize later */ + if ((screen->scrollWidget = CreateScrollBar(xw, -1, -1, 5)) + == NULL) { + Bell(XkbBI_MinorError, 0); return; } + + return; - if (doalloc && screen->allbuf) { - /* FIXME: this is not integrated well with Allocate */ - if((screen->allbuf = - (ScrnBuf) realloc((char *) screen->visbuf, - (unsigned) MAX_PTRS*(screen->max_row + 2 + - screen->savelines) * - sizeof(char *))) - == NULL) - Error (ERROR_SBRALLOC); - screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines]; - memmove( (char *)screen->visbuf, (char *)screen->allbuf, - MAX_PTRS * (screen->max_row + 2) * sizeof (char *)); - for (i = k = 0; i < screen->savelines; i++) { - k += BUF_HEAD; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - if((screen->allbuf[k++] = - (Char *)calloc((unsigned) screen->max_col + 1, sizeof(Char))) == - NULL) - Error (ERROR_SBRALLOC2); - } + } + + if (!screen->scrollWidget) { + Bell(XkbBI_MinorError, 0); + Bell(XkbBI_MinorError, 0); + return; + } + + if (doalloc && screen->allbuf) { + /* FIXME: this is not integrated well with Allocate */ + if ((screen->allbuf = + (ScrnBuf) realloc((char *) screen->visbuf, + (unsigned) MAX_PTRS * (screen->max_row + 2 + + screen->savelines) * + sizeof(char *))) + == NULL) + SysError(ERROR_SBRALLOC); + screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines]; + memmove((char *) screen->visbuf, (char *) screen->allbuf, + MAX_PTRS * (screen->max_row + 2) * sizeof(char *)); + for (i = k = 0; i < screen->savelines; i++) { + k += BUF_HEAD; + for (j = BUF_HEAD; j < MAX_PTRS; j++) { + if ((screen->allbuf[k++] = + (Char *) calloc((unsigned) screen->max_col + 1, + sizeof(Char)) + ) == NULL) + SysError(ERROR_SBRALLOC2); } } + } - ResizeScrollBar (screen); - xtermAddInput(screen->scrollWidget); - XtRealizeWidget (screen->scrollWidget); - TRACE_TRANS("scrollbar", screen->scrollWidget); - - screen->fullVwin.sb_info.rv_cached = False; - screen->fullVwin.sb_info.width = screen->scrollWidget->core.width + - screen->scrollWidget->core.border_width; + ResizeScrollBar(screen); + xtermAddInput(screen->scrollWidget); + XtRealizeWidget(screen->scrollWidget); + TRACE_TRANS("scrollbar", screen->scrollWidget); + + screen->fullVwin.sb_info.rv_cached = False; + screen->fullVwin.sb_info.width = screen->scrollWidget->core.width + + screen->scrollWidget->core.border_width; - ScrollBarDrawThumb(screen->scrollWidget); - DoResizeScreen (xw); + ScrollBarDrawThumb(screen->scrollWidget); + DoResizeScreen(xw); #ifdef SCROLLBAR_RIGHT - /* - * Adjust the scrollbar position if we're asked to turn on scrollbars - * for the first time after the xterm is already running. That makes - * the window grow after we've initially configured the scrollbar's - * position. (There must be a better way). - */ - if (term->misc.useRight - && screen->fullVwin.fullwidth < term->core.width) - XtVaSetValues(screen->scrollWidget, - XtNx, screen->fullVwin.fullwidth - screen->scrollWidget->core.border_width, - NULL); + /* + * Adjust the scrollbar position if we're asked to turn on scrollbars + * for the first time after the xterm is already running. That makes + * the window grow after we've initially configured the scrollbar's + * position. (There must be a better way). + */ + if (term->misc.useRight + && screen->fullVwin.fullwidth < term->core.width) + XtVaSetValues(screen->scrollWidget, + XtNx, screen->fullVwin.fullwidth - screen->scrollWidget->core.border_width, + (XtPointer) 0); #endif - XtMapWidget(screen->scrollWidget); - update_scrollbar (); - if (screen->visbuf) { - XClearWindow (screen->display, XtWindow (term)); - Redraw (); - } + XtMapWidget(screen->scrollWidget); + update_scrollbar(); + if (screen->visbuf) { + XClearWindow(screen->display, XtWindow(term)); + Redraw(); + } } void -ScrollBarOff(TScreen *screen) +ScrollBarOff(TScreen * screen) { - if(!screen->fullVwin.sb_info.width) - return; - XtUnmapWidget(screen->scrollWidget); - screen->fullVwin.sb_info.width = 0; - DoResizeScreen (term); - update_scrollbar (); - if (screen->visbuf) { - XClearWindow (screen->display, XtWindow (term)); - Redraw (); - } + if (!screen->fullVwin.sb_info.width) + return; + XtUnmapWidget(screen->scrollWidget); + screen->fullVwin.sb_info.width = 0; + DoResizeScreen(term); + update_scrollbar(); + if (screen->visbuf) { + XClearWindow(screen->display, XtWindow(term)); + Redraw(); + } } /* @@ -465,9 +468,9 @@ TScreen *screen = &w->screen; if (screen->fullVwin.sb_info.width) { - ScrollBarOff (screen); + ScrollBarOff(screen); } else { - ScrollBarOn (w, FALSE, FALSE); + ScrollBarOn(w, FALSE, FALSE); } update_scrollbar(); } @@ -475,14 +478,14 @@ /*ARGSUSED*/ static void ScrollTextTo( - Widget scrollbarWidget GCC_UNUSED, - XtPointer client_data GCC_UNUSED, - XtPointer call_data) -{ - float *topPercent = (float *) call_data; - TScreen *screen = &term->screen; - int thumbTop; /* relative to first saved line */ - int newTopLine; + Widget scrollbarWidget GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + XtPointer call_data) +{ + float *topPercent = (float *) call_data; + TScreen *screen = &term->screen; + int thumbTop; /* relative to first saved line */ + int newTopLine; /* screen->savedlines : Number of offscreen text lines, @@ -490,82 +493,83 @@ screen->topline : -Number of lines above the last screen->max_row+1 lines */ - thumbTop = (int) (*topPercent * (screen->savedlines + screen->max_row+1)); - newTopLine = thumbTop - screen->savedlines; - WindowScroll(screen, newTopLine); + thumbTop = (int) (*topPercent * (screen->savedlines + screen->max_row + 1)); + newTopLine = thumbTop - screen->savedlines; + WindowScroll(screen, newTopLine); } /*ARGSUSED*/ static void ScrollTextUpDownBy( - Widget scrollbarWidget GCC_UNUSED, - XtPointer client_data GCC_UNUSED, - XtPointer call_data) -{ - long pixels = (long) call_data; - - TScreen *screen = &term->screen; - int rowOnScreen, newTopLine; - - rowOnScreen = pixels / FontHeight(screen); - if (rowOnScreen == 0) { - if (pixels < 0) - rowOnScreen = -1; - else if (pixels > 0) - rowOnScreen = 1; - } - newTopLine = screen->topline + rowOnScreen; - WindowScroll(screen, newTopLine); + Widget scrollbarWidget GCC_UNUSED, + XtPointer client_data GCC_UNUSED, + XtPointer call_data) +{ + long pixels = (long) call_data; + + TScreen *screen = &term->screen; + int rowOnScreen, newTopLine; + + rowOnScreen = pixels / FontHeight(screen); + if (rowOnScreen == 0) { + if (pixels < 0) + rowOnScreen = -1; + else if (pixels > 0) + rowOnScreen = 1; + } + newTopLine = screen->topline + rowOnScreen; + WindowScroll(screen, newTopLine); } - /* * assume that b is lower case and allow plural */ static int -specialcmplowerwiths (char *a, char *b) +specialcmplowerwiths(char *a, char *b) { char ca, cb; - if (!a || !b) return 0; + if (!a || !b) + return 0; while (1) { ca = char2lower(*a); cb = *b; - if (ca != cb || ca == '\0') break; /* if not eq else both nul */ + if (ca != cb || ca == '\0') + break; /* if not eq else both nul */ a++, b++; } if (cb == '\0' && (ca == '\0' || (ca == 's' && a[1] == '\0'))) - return 1; + return 1; return 0; } static long -params_to_pixels (TScreen *screen, String *params, Cardinal n) +params_to_pixels(TScreen * screen, String * params, Cardinal n) { int mult = 1; char *s; switch (n > 2 ? 2 : n) { - case 2: + case 2: s = params[1]; - if (specialcmplowerwiths (s, "page")) { + if (specialcmplowerwiths(s, "page")) { mult = (screen->max_row + 1) * FontHeight(screen); - } else if (specialcmplowerwiths (s, "halfpage")) { + } else if (specialcmplowerwiths(s, "halfpage")) { mult = ((screen->max_row + 1) * FontHeight(screen)) >> 1; - } else if (specialcmplowerwiths (s, "pixel")) { + } else if (specialcmplowerwiths(s, "pixel")) { mult = 1; } else { /* else assume that it is Line */ mult = FontHeight(screen); } - mult *= atoi (params[0]); + mult *= atoi(params[0]); break; - case 1: - mult = atoi (params[0]) * FontHeight(screen); /* lines */ + case 1: + mult = atoi(params[0]) * FontHeight(screen); /* lines */ break; - default: + default: mult = screen->scrolllines * FontHeight(screen); break; } @@ -573,43 +577,44 @@ } static long -AmountToScroll(Widget gw, String *params, Cardinal nparams) +AmountToScroll(Widget gw, String * params, Cardinal nparams) { if (IsXtermWidget(gw)) { - TScreen *screen = &((XtermWidget)gw)->screen; + TScreen *screen = &((XtermWidget) gw)->screen; if (nparams > 2 - && screen->send_mouse_pos != MOUSE_OFF) + && screen->send_mouse_pos != MOUSE_OFF) return 0; - return params_to_pixels (screen, params, nparams); + return params_to_pixels(screen, params, nparams); } return 0; } /*ARGSUSED*/ -void HandleScrollForward ( - Widget gw, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *nparams) +void +HandleScrollForward( + Widget gw, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * nparams) { long amount; if ((amount = AmountToScroll(gw, params, *nparams)) != 0) { - ScrollTextUpDownBy (gw, (XtPointer) 0, (XtPointer)amount); + ScrollTextUpDownBy(gw, (XtPointer) 0, (XtPointer) amount); } } - /*ARGSUSED*/ -void HandleScrollBack ( - Widget gw, - XEvent *event GCC_UNUSED, - String *params, - Cardinal *nparams) +void +HandleScrollBack( + Widget gw, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * nparams) { long amount; if ((amount = -AmountToScroll(gw, params, *nparams)) != 0) { - ScrollTextUpDownBy (gw, (XtPointer) 0, (XtPointer)amount); + ScrollTextUpDownBy(gw, (XtPointer) 0, (XtPointer) amount); } } Index: xc/programs/xterm/tabs.c diff -u xc/programs/xterm/tabs.c:3.9 xc/programs/xterm/tabs.c:3.10 --- xc/programs/xterm/tabs.c:3.9 Wed Jan 17 18:46:39 2001 +++ xc/programs/xterm/tabs.c Mon Mar 25 20:46:40 2002 @@ -1,11 +1,11 @@ /* - * $XFree86: xc/programs/xterm/tabs.c,v 3.9 2001/01/17 23:46:39 dawes Exp $ + * $XFree86: xc/programs/xterm/tabs.c,v 3.10 2002/03/26 01:46:40 dickey Exp $ */ /* $Xorg: tabs.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ /* - * Copyright 2000 by Thomas E. Dickey + * Copyright 2000,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -65,7 +65,7 @@ * be fixed sometime. */ #define TAB_INDEX(n) ((n) >> 5) -#define TAB_MASK(n) (1 << ((n) & 31)) +#define TAB_MASK(n) (1 << ((n) & (TAB_BITS_WIDTH-1))) #define SET_TAB(tabs,n) tabs[TAB_INDEX(n)] |= TAB_MASK(n) #define CLR_TAB(tabs,n) tabs[TAB_INDEX(n)] &= ~TAB_MASK(n) @@ -77,15 +77,14 @@ void TabReset(Tabs tabs) { - register int i; + register int i; - for (i=0; i<TAB_ARRAY_SIZE; ++i) - tabs[i] = 0; + for (i = 0; i < TAB_ARRAY_SIZE; ++i) + tabs[i] = 0; - for (i=0; i<MAX_TABS; i+=8) - TabSet(tabs, i); -} - + for (i = 0; i < MAX_TABS; i += 8) + TabSet(tabs, i); +} /* * places a tabstop at col @@ -93,7 +92,7 @@ void TabSet(Tabs tabs, int col) { - SET_TAB(tabs,col); + SET_TAB(tabs, col); } /* @@ -102,7 +101,7 @@ void TabClear(Tabs tabs, int col) { - CLR_TAB(tabs,col); + CLR_TAB(tabs, col); } /* @@ -111,19 +110,19 @@ * A tabstop at col is ignored. */ int -TabNext (Tabs tabs, int col) +TabNext(Tabs tabs, int col) { - register TScreen *screen = &term->screen; + register TScreen *screen = &term->screen; - if(screen->curses && screen->do_wrap && (term->flags & WRAPAROUND)) { - xtermIndex(screen, 1); - col = screen->cur_col = screen->do_wrap = 0; - } - for (++col; col<MAX_TABS; ++col) - if (TST_TAB(tabs,col)) - return (col); + if (screen->curses && screen->do_wrap && (term->flags & WRAPAROUND)) { + xtermIndex(screen, 1); + col = screen->cur_col = screen->do_wrap = 0; + } + for (++col; col < MAX_TABS; ++col) + if (TST_TAB(tabs, col)) + return (col); - return (MAX_TABS - 1); + return (MAX_TABS - 1); } /* @@ -132,13 +131,13 @@ * A tabstop at col is ignored. */ int -TabPrev (Tabs tabs, int col) +TabPrev(Tabs tabs, int col) { - for (--col; col >= 0; --col) - if (TST_TAB(tabs,col)) - return (col); + for (--col; col >= 0; --col) + if (TST_TAB(tabs, col)) + return (col); - return (0); + return (0); } /* @@ -147,14 +146,14 @@ Boolean TabToNextStop(void) { - register TScreen *screen = &term->screen; - int saved_column = screen->cur_col; + register TScreen *screen = &term->screen; + int saved_column = screen->cur_col; - screen->cur_col = TabNext(term->tabs, screen->cur_col); - if (screen->cur_col > CurMaxCol(screen, screen->cur_row)) - screen->cur_col = CurMaxCol(screen, screen->cur_row); + screen->cur_col = TabNext(term->tabs, screen->cur_col); + if (screen->cur_col > CurMaxCol(screen, screen->cur_row)) + screen->cur_col = CurMaxCol(screen, screen->cur_row); - return (screen->cur_col > saved_column); + return (screen->cur_col > saved_column); } /* @@ -163,22 +162,22 @@ Boolean TabToPrevStop(void) { - register TScreen *screen = &term->screen; - int saved_column = screen->cur_col; + register TScreen *screen = &term->screen; + int saved_column = screen->cur_col; - screen->cur_col = TabPrev(term->tabs, screen->cur_col); + screen->cur_col = TabPrev(term->tabs, screen->cur_col); - return (screen->cur_col < saved_column); + return (screen->cur_col < saved_column); } /* * clears all tabs */ void -TabZonk (Tabs tabs) +TabZonk(Tabs tabs) { - register int i; + register int i; - for (i=0; i<TAB_ARRAY_SIZE; ++i) - tabs[i] = 0; + for (i = 0; i < TAB_ARRAY_SIZE; ++i) + tabs[i] = 0; } Index: xc/programs/xterm/terminfo diff -u xc/programs/xterm/terminfo:3.45 xc/programs/xterm/terminfo:3.46 --- xc/programs/xterm/terminfo:3.45 Wed Apr 11 21:02:51 2001 +++ xc/programs/xterm/terminfo Sat Aug 24 14:54:39 2002 @@ -5,7 +5,7 @@ # XFree86 updates/notes/new entries (including xterm-8bit, xterm-16color) # - Thomas E. Dickey # -# $XFree86: xc/programs/xterm/terminfo,v 3.45 2001/04/12 01:02:51 dickey Exp $ +# $XFree86: xc/programs/xterm/terminfo,v 3.46 2002/08/24 18:54:39 dickey Exp $ # # Special Capabilities: # -------------------- @@ -99,13 +99,13 @@ xterm-xfree86|xterm-new|xterm terminal emulator (XFree86), npc, kDC=\E[3;2~, - kEND=\EO2F, - kHOM=\EO2H, + kEND=\E[1;2F, + kHOM=\E[1;2H, kIC=\E[2;2~, - kLFT=\EO2D, + kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, - kRIT=\EO2C, + kRIT=\E[1;2C, kb2=\EOE, kcbt=\E[Z, kcub1=\EOD, Index: xc/programs/xterm/testxmc.c diff -u xc/programs/xterm/testxmc.c:3.8 xc/programs/xterm/testxmc.c:3.9 --- xc/programs/xterm/testxmc.c:3.8 Mon Jun 12 22:28:41 2000 +++ xc/programs/xterm/testxmc.c Mon Mar 25 20:46:40 2002 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/testxmc.c,v 3.8 2000/06/13 02:28:41 dawes Exp $ + * $XFree86: xc/programs/xterm/testxmc.c,v 3.9 2002/03/26 01:46:40 dickey Exp $ */ /************************************************************ -Copyright 1997-2000 by Thomas E. Dickey +Copyright 1997-2000,2002 by Thomas E. Dickey All Rights Reserved @@ -64,9 +64,11 @@ * INVERSE 1 * UNDERLINE 2 * BOLD 4 + * BLINK 8 * * The default is `1' (INVERSE). Some terminals emit glitches for - * underline. + * underline. Just for completeness, we recognize all of the video + * attributes. * * xmcInline (class XmcInline) * When true, limits the extent of an SGR change to the current line. @@ -91,120 +93,132 @@ #define MARK_ON(a) (my_attrs & a) != 0 && (term->flags & (whichone = a)) == 0 #define MARK_OFF(a) (my_attrs & a) != 0 && (term->flags & (whichone = a)) != 0 -void Mark_XMC(register TScreen *screen, int param) +void +Mark_XMC(register TScreen * screen, int param) { - static IChar *glitch; - Boolean found = FALSE; - Char my_attrs = (screen->xmc_attributes & XMC_FLAGS); - Char whichone = 0; - - if (glitch == 0) { - unsigned len = screen->xmc_glitch; - glitch = (IChar *)malloc(len * sizeof(IChar)); - while (len--) - glitch[len] = XMC_GLITCH; - } - switch (param) { - case -1:/* DEFAULT */ - case 0: /* FALLTHRU */ - found = MARK_OFF((term->flags & XMC_FLAGS)); - break; - case 1: - found = MARK_ON(BOLD); - break; - case 4: - found = MARK_ON(UNDERLINE); - break; - case 7: - found = MARK_ON(INVERSE); - break; - case 22: - found = MARK_OFF(BOLD); - break; - case 24: - found = MARK_OFF(UNDERLINE); - break; - case 27: - found = MARK_OFF(INVERSE); - break; - } - - /* - * Write a glitch with the attributes temporarily set to the new(er) - * ones. - */ - if (found) { - unsigned save = term->flags; - term->flags ^= whichone; - TRACE(("XMC Writing glitch (%d/%d) after SGR %d\n", my_attrs, whichone, param)); - dotext(screen, '?', glitch, screen->xmc_glitch); - term->flags = save; - } + static IChar *glitch; + Boolean found = FALSE; + Char my_attrs = (screen->xmc_attributes & XMC_FLAGS); + Char whichone = 0; + + if (glitch == 0) { + unsigned len = screen->xmc_glitch; + glitch = (IChar *) malloc(len * sizeof(IChar)); + while (len--) + glitch[len] = XMC_GLITCH; + } + switch (param) { + case -1: /* DEFAULT */ + case 0: /* FALLTHRU */ + found = MARK_OFF((term->flags & XMC_FLAGS)); + break; + case 1: + found = MARK_ON(BOLD); + break; + case 4: + found = MARK_ON(UNDERLINE); + break; + case 5: + found = MARK_ON(BLINK); + break; + case 7: + found = MARK_ON(INVERSE); + break; + case 22: + found = MARK_OFF(BOLD); + break; + case 24: + found = MARK_OFF(UNDERLINE); + break; + case 25: + found = MARK_OFF(BLINK); + break; + case 27: + found = MARK_OFF(INVERSE); + break; + } + + /* + * Write a glitch with the attributes temporarily set to the new(er) + * ones. + */ + if (found) { + unsigned save = term->flags; + term->flags ^= whichone; + TRACE(("XMC Writing glitch (%d/%d) after SGR %d\n", my_attrs, + whichone, param)); + dotext(screen, '?', glitch, screen->xmc_glitch); + term->flags = save; + } } /* * Force a glitch on cursor movement when we're in standout mode and not at the * end of a line. */ -void Jump_XMC(register TScreen *screen) +void +Jump_XMC(register TScreen * screen) { - if (!screen->move_sgr_ok - && screen->cur_col <= CurMaxCol(screen, screen->cur_row)) { - Mark_XMC(screen, -1); - } + if (!screen->move_sgr_ok + && screen->cur_col <= CurMaxCol(screen, screen->cur_row)) { + Mark_XMC(screen, -1); + } } /* * After writing text to the screen, resolve mismatch between the current * location and any attributes that would have been set by preceding locations. */ -void Resolve_XMC(register TScreen *screen) +void +Resolve_XMC(register TScreen * screen) { - Boolean changed = False; - Char start; - Char my_attrs = (screen->xmc_attributes & XMC_FLAGS); - int row = screen->cur_row; - int col = screen->cur_col; - - /* Find the preceding cell. - */ - if (getXtermCell(screen, row, col) != XMC_GLITCH) { - if (col != 0) { - col--; - } else if (!screen->xmc_inline && row != 0) { - row--; - col = CurMaxCol(screen, row); - } - } - start = (SCRN_BUF_ATTRS(screen, row)[col] & my_attrs); - - /* Now propagate the starting state until we reach a cell which holds - * a glitch. - */ - for (;;) { - if (col < CurMaxCol(screen, row)) { - col++; - } else if (!screen->xmc_inline && row < screen->max_row) { - row++; - col = 0; - } else - break; - if (getXtermCell(screen, row, col) == XMC_GLITCH) - break; - if ((SCRN_BUF_ATTRS(screen, row)[col] & my_attrs) != start) { - SCRN_BUF_ATTRS(screen, row)[col] = start | - (SCRN_BUF_ATTRS(screen, row)[col] & ~my_attrs); - changed = True; - } - } - - TRACE(("XMC %s (%s:%d/%d) from %d,%d to %d,%d\n", - changed ? "Ripple" : "Nochange", - term->flags & my_attrs ? "on" : "off", - my_attrs, start, - screen->cur_row, screen->cur_col, row, col)); - - if (changed) { - ScrnRefresh (screen, screen->cur_row, 0, row + 1 - screen->cur_row, screen->max_col + 1, True); - } + Boolean changed = False; + Char start; + Char my_attrs = (screen->xmc_attributes & XMC_FLAGS); + int row = screen->cur_row; + int col = screen->cur_col; + + /* Find the preceding cell. + */ + if (getXtermCell(screen, row, col) != XMC_GLITCH) { + if (col != 0) { + col--; + } else if (!screen->xmc_inline && row != 0) { + row--; + col = CurMaxCol(screen, row); + } + } + start = (SCRN_BUF_ATTRS(screen, row)[col] & my_attrs); + + /* Now propagate the starting state until we reach a cell which holds + * a glitch. + */ + for (;;) { + if (col < CurMaxCol(screen, row)) { + col++; + } else if (!screen->xmc_inline && row < screen->max_row) { + row++; + col = 0; + } else + break; + if (getXtermCell(screen, row, col) == XMC_GLITCH) + break; + if ((SCRN_BUF_ATTRS(screen, row)[col] & my_attrs) != start) { + SCRN_BUF_ATTRS(screen, row)[col] = start | + (SCRN_BUF_ATTRS(screen, row)[col] & ~my_attrs); + changed = True; + } + } + + TRACE(("XMC %s (%s:%d/%d) from %d,%d to %d,%d\n", + changed ? "Ripple" : "Nochange", + term->flags & my_attrs ? "on" : "off", + my_attrs, start, + screen->cur_row, screen->cur_col, + row, col)); + + if (changed) { + ScrnRefresh(screen, screen->cur_row, 0, row + 1 - screen->cur_row, + screen->max_col + 1, True); + } } Index: xc/programs/xterm/trace.c diff -u xc/programs/xterm/trace.c:3.14 xc/programs/xterm/trace.c:3.16 --- xc/programs/xterm/trace.c:3.14 Sun Nov 4 21:07:16 2001 +++ xc/programs/xterm/trace.c Sat Oct 5 13:57:13 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/trace.c,v 3.14 2001/11/05 02:07:16 dickey Exp $ + * $XFree86: xc/programs/xterm/trace.c,v 3.16 2002/10/05 17:57:13 dickey Exp $ */ /************************************************************ @@ -34,8 +34,6 @@ #include <xterm.h> /* for definition of GCC_UNUSED */ #include <trace.h> -#include <X11/StringDefs.h> - #include <time.h> #include <stdlib.h> #include <unistd.h> @@ -187,7 +185,7 @@ XtVaGetValues(w, XtNtranslations, &xlations, XtNaccelerators, &xcelerat, - NULL); + (XtPointer) 0); TRACE(("... xlations %#08lx\n", (long) xlations)); TRACE(("... xcelerat %#08lx\n", (long) xcelerat)); result = _XtPrintXlations(w, xlations, xcelerat, True); @@ -209,20 +207,6 @@ } } -static int -cmp_options(const void *a, const void *b) -{ - return strcmp(((const OptionHelp *) a)->opt, - ((const OptionHelp *) b)->opt); -} - -static int -cmp_resources(const void *a, const void *b) -{ - return strcmp(((const XrmOptionDescRec *) a)->option, - ((const XrmOptionDescRec *) b)->option); -} - static char * parse_option(char *dst, char *src, char first) { @@ -299,29 +283,16 @@ void TraceOptions(OptionHelp * options, XrmOptionDescRec * resources, Cardinal res_count) { - OptionHelp *opt_array; - size_t opt_count, j, k; - XrmOptionDescRec *res_array; + OptionHelp *opt_array = sortedOpts(options, resources, res_count); + size_t j, k; + XrmOptionDescRec *res_array = sortedOptDescs(resources, res_count); Boolean first, found; TRACE(("Checking options-tables for inconsistencies:\n")); - /* count 'options' and make a sorted index to it */ - for (opt_count = 0; options[opt_count].opt != 0; ++opt_count) ; - opt_array = (OptionHelp *) calloc(opt_count, sizeof(OptionHelp)); - for (j = 0; j < opt_count; j++) - opt_array[j] = options[j]; - qsort(opt_array, opt_count, sizeof(OptionHelp), cmp_options); - - /* make a sorted index to 'resources' */ - res_array = (XrmOptionDescRec *) calloc(res_count, sizeof(*res_array)); - for (j = 0; j < res_count; j++) - res_array[j] = resources[j]; - qsort(res_array, res_count, sizeof(*res_array), cmp_resources); - #if 0 TRACE(("Options listed in help-message:\n")); - for (j = 0; j < opt_count; j++) + for (j = 0; options[j].opt != 0; j++) TRACE(("%5d %-28s %s\n", j, opt_array[j].opt, opt_array[j].desc)); TRACE(("Options listed in resource-table:\n")); for (j = 0; j < res_count; j++) @@ -329,7 +300,7 @@ #endif /* list all options[] not found in resources[] */ - for (j = 0, first = True; j < opt_count; j++) { + for (j = 0, first = True; options[j].opt != 0; j++) { found = False; for (k = 0; k < res_count; k++) { if (same_option(&opt_array[j], &res_array[k])) { @@ -350,7 +321,7 @@ /* list all resources[] not found in options[] */ for (j = 0, first = True; j < res_count; j++) { found = False; - for (k = 0; k < opt_count; k++) { + for (k = 0; options[k].opt != 0; k++) { if (same_option(&opt_array[k], &res_array[j])) { found = True; break; @@ -365,7 +336,7 @@ } } - TRACE(("Resource list items that will be ignored by XtAppInitialize:\n")); + TRACE(("Resource list items that will be ignored by XtOpenApplication:\n")); for (j = 0; j < res_count; j++) { switch (res_array[j].argKind) { case XrmoptionSkipArg: Index: xc/programs/xterm/ttysvr.c diff -u xc/programs/xterm/ttysvr.c:3.3 xc/programs/xterm/ttysvr.c:removed --- xc/programs/xterm/ttysvr.c:3.3 Sun Oct 25 02:12:53 1998 +++ xc/programs/xterm/ttysvr.c Thu Feb 27 12:36:11 2003 @@ -1,536 +0,0 @@ -/* $XFree86: xc/programs/xterm/ttysvr.c,v 3.3 1998/10/25 07:12:53 dawes Exp $ */ -/* - * - * ttysvr.c - * - * Simple tty server for xterm. Most of it is taken from Siebren's aterm. - * - * Author: - * Leendert van Doorn, 1992 - */ - -#include <ptyx.h> -#include <data.h> -#include <error.h> -#include <stdio.h> - -extern char *ProgramName; - -#ifdef AMOEBA -#include <sys/types.h> -#include <ailamoeba.h> -#include <signal.h> -#include <exception.h> -#include <thread.h> -#include <cmdreg.h> -#include <stdcom.h> -#include <stderr.h> -#include <limits.h> -#include <module/proc.h> -#include <file.h> -#include <fault.h> -#include <posix/termios.h> -#include <class/tios.h> -#include <server/tty/tty.h> -#include <module/name.h> -#include <module/rnd.h> - - -/* - * AIL stuff - */ -#define SAME_ENDIAN(w) (((w)&_AIL_ENDIAN) == (_ailword & _AIL_ENDIAN) ) - -extern char *tc_marshal(); -extern char *tc_unmarshal(); -extern void millisleep(); - -#define CTRL(c) ((c) & 0x1f) - -/* - * Tty input data structure. - * This is a separate buffer in which the edited line is built. - */ -static char tty_line[_POSIX_MAX_CANON+1]; -static char *tty_ptr; -static int tty_left; - -/* - * A global flags which denotes whether we're busy with exiting. This - * prevents two cleanups to be running (one from ttythread, and one - * from the main stream code as a result of a failed _XAmSelect). - */ -int exiting = False; - -/* - * Mutexes to prevent concurrent reads/writes - */ -static mutex read_mutex; -static mutex write_mutex; - -port ttyport; -capability ttycap; -capability ttyintcap; -struct termios tios; - -/* - * Initialize the TTY structures. - * Publish the tty capability when a name is provided. - */ -void -ttyinit(name) - char *name; -{ - mu_init(&read_mutex); - mu_init(&write_mutex); - - uniqport(&ttyport); - priv2pub(&ttyport, &ttycap.cap_port); - - if (name != NULL) { - errstat err; - (void) name_delete(name); - if ((err = name_append(name, &ttycap)) != STD_OK) { - fprintf(stderr, "%s: cannot append %s: %s\n", - ProgramName, name, err_why(err)); - Exit(1); - } - } - - tios.c_iflag = ICRNL | IXON; - tios.c_oflag = OPOST; - tios.c_cflag = CREAD | CS8 | B9600; - tios.c_lflag = ECHO | ECHOE | ECHOK | ICANON | ISIG; - - tios.c_cc[VEOF] = CTRL('D'); - tios.c_cc[VEOL] = _POSIX_VDISABLE; - tios.c_cc[VERASE] = CTRL('H'); - tios.c_cc[VINTR] = CTRL('C'); - tios.c_cc[VKILL] = CTRL('U'); - tios.c_cc[VMIN] = 1; - tios.c_cc[VQUIT] = CTRL('\\'); - tios.c_cc[VSUSP] = _POSIX_VDISABLE; - tios.c_cc[VTIME] = 0; - tios.c_cc[VSTART] = CTRL('Q'); - tios.c_cc[VSTOP] = CTRL('S'); -} - -/* ARGSUSED */ -static void -ttycatcher(sig, us, extra) - signum sig; - thread_ustate *us; - char *extra; -{ - *((int *)extra) = True; -} - -void -ttythread() -{ - TScreen *screen = &term->screen; - struct circbuf *iq, *oq; - header hdr; - char *buf; - int n, cause, detail; - int signalled; - struct termios ttios; - - oq = screen->tty_outq; - iq = screen->tty_inq; - buf = (char *)malloc(BUFSIZ); - if (buf == (char *)NULL) { - fprintf(stderr, "%s: cannot malloc tty server buffer.\n", - ProgramName); - Exit(1); - } - - sig_catch((signum) SIG_TRANS, ttycatcher, (char *) &signalled); - for (;;) { - if (exiting) { /* shell disappeared */ - if (cause == TERM_STUNNED) - fprintf(stderr, "%s: stun code %d\n", ProgramName, detail); - else if (cause == TERM_EXCEPTION) - fprintf(stderr, "%s: exception code %d\n", ProgramName, detail); - else if (cause != TERM_NORMAL) - fprintf(stderr, "%s: termination cause %d, detail %d\n", - ProgramName, cause, detail); - Cleanup(0); - } - - signalled = False; - do { - hdr.h_port = ttyport; - n = getreq(&hdr, (bufptr) buf, BUFSIZ); - } while (ERR_CONVERT(n) == RPC_ABORTED); - if (ERR_STATUS(n)) { - fprintf(stderr, "%s: get request failed (%s)\n", - ProgramName, err_why(ERR_CONVERT(n))); - Cleanup(1); - } - - switch (hdr.h_command) { - case FSQ_CREATE: - hdr.h_status = STD_OK; - n = 0; - break; - case FSQ_READ: - if (!(tios.c_cflag & CREAD)) { - hdr.h_status = STD_NOTNOW; - n = 0; - break; - } - while (!signalled) { - if (mu_trylock(&read_mutex, -1) < 0) - continue; - hdr.h_size = ttycanonread(buf, (int)hdr.h_size, &signalled); - hdr.h_extra = tty_left > 0 ? FSE_MOREDATA : FSE_NOMOREDATA; - mu_unlock(&read_mutex); - break; - } - n = hdr.h_size; - hdr.h_status = signalled ? STD_INTR : STD_OK; - break; - case FSQ_WRITE: - mu_lock(&write_mutex); - n = ttywrite(buf, n); - mu_unlock(&write_mutex); - hdr.h_size = n; - hdr.h_status = STD_OK; - n = 0; - break; - case TTQ_CLOSE: - case TTQ_STATUS: - case TTQ_CONTROL: - case TTQ_TIME_READ: - hdr.h_status = STD_COMBAD; - n = 0; - break; - case TIOS_SETATTR: - (void) tc_unmarshal(buf, &ttios, SAME_ENDIAN(hdr.h_size)); - if (tios_check(&ttios)) { - hdr.h_status = STD_OK; - tios = ttios; - } else - hdr.h_status = STD_ARGBAD; - n = 0; - break; - case TIOS_GETATTR: - n = tc_marshal(buf, tios, SAME_ENDIAN(hdr.h_extra)) - buf; - hdr.h_status = STD_OK; - break; - case TIOS_SENDBREAK: - case TIOS_DRAIN: - case TIOS_FLUSH: - case TIOS_FLOW: - hdr.h_status = STD_OK; - n = 0; - break; - case TIOS_GETWSIZE: - hdr.h_extra = screen->max_col + 1; - hdr.h_size = screen->max_row + 1; - hdr.h_status = STD_OK; - n = 0; - break; - case STD_AGE: - case STD_COPY: - case STD_RESTRICT: - hdr.h_status = STD_COMBAD; - n = 0; - break; - case STD_TOUCH: - hdr.h_status = STD_OK; - n = 0; - break; - case STD_DESTROY: - hdr.h_status = STD_DENIED; - n = 0; - break; - case STD_INFO: - hdr.h_status = STD_OK; - strcpy(buf, "+ Xterm tty server"); - n = strlen(buf); - break; - case PS_CHECKPOINT: - exiting = True; - cb_putc(oq, '\0'); - WakeupMainThread(); - cause = hdr.h_extra; - detail = hdr.h_offset; - hdr.h_status = STD_OK; - n = 0; - break; - case PS_SWAPPROC: - hdr.h_status = STD_OK; - n = 0; - break; - case TTQ_INTCAP: - if (n == sizeof(capability)) { - hdr.h_status = STD_OK; - bcopy(buf, (char *)&ttyintcap, sizeof(capability)); - } else - hdr.h_status = STD_ARGBAD; - n = 0; - break; - default: - hdr.h_status = STD_COMBAD; - n = 0; - } - putrep(&hdr, (bufptr) buf, n); - } -} - -int -tios_check(tp) - struct termios *tp; -{ - register int i, j; - - /* - * Check that all chars in th c_cc array are - * different, except VTIME and VMIN - */ - for (i = 0; i < sizeof(tp->c_cc); ++i) { - if (i != VTIME && i != VMIN) for (j = 0; j < i; ++j) - if (j != VTIME && j != VMIN && - tp->c_cc[i] == tp->c_cc[j] && tp->c_cc[i] != _POSIX_VDISABLE) - return False; - } - - /* cannot change byte size */ - if ((tp->c_cflag & CSIZE) != CS8) - return False; - return True; -} - -void -erasechar(oq, n, echo) - struct circbuf *oq; - int n, echo; -{ - register int rcol; - - if (!echo) return; - if (n > 0) { - rcol = n - 1; - cb_putc(oq, '\b'); - if (tios.c_lflag & ECHOE) - cb_puts(oq, " \b", 2); - } else - cb_putc(oq, CTRL('G')); - WakeupMainThread(); -} - -void -linekill(oq, n, echo) - struct circbuf *oq; - int n, echo; -{ - register int rcol; - - if (!echo) return; - if (n > 0) { - for (rcol = n-1; rcol >= 0; rcol--) { - cb_putc(oq, '\b'); - if (tios.c_lflag & ECHOK) - cb_puts(oq, " \b", 2); - } - } else - cb_putc(oq, CTRL('G')); - WakeupMainThread(); -} - -/* - * Canonize - */ -#define ISSET(t, flag) (((t).c_lflag & flag) != 0) - -void -canonize(signalled) - int *signalled; -{ - TScreen *screen = &term->screen; - struct circbuf *iq, *oq; - int ch, n; - int stop; - - n = 0; - oq = screen->tty_outq; - iq = screen->tty_inq; - - for (stop = False; !stop; ) { - /* get a character, depending on canonisation */ - if (!ISSET(tios, ICANON)) { - /* - * No canonization - */ - int time = tios.c_cc[VTIME] * 100; /* inter-byte delay (in msec) */ - - ch = time ? cb_trygetc(iq, time) : cb_trygetc(iq, -1); - if (ch < 0 || *signalled) - break; - } else { - /* - * Canonized input - */ - ch = cb_trygetc(iq, -1); - if (ch == -1) - break; - } - - /* ICANON may have changed while we waited for the first character */ - if (!ISSET(tios, ICANON)) { - int min = tios.c_cc[VMIN]; /* minimum characters to read */ - - if (ISSET(tios, ECHO)) cb_putc(oq, ch); - tty_line[n++] = ch; - if (n >= sizeof(tty_line) || (min > 0 && n >= min)) - break; - } else { - if (tios.c_iflag & ISTRIP) ch &= 0x7f; - if (ch == tios.c_cc[VEOF]) { - stop = True; - } else if (ch == tios.c_cc[VERASE]) { - /* erase a single character */ - erasechar(oq, n, ISSET(tios, ECHO)); - if (n != 0) n--; - } else if (ch == tios.c_cc[VKILL]) { - /* erase a whole line */ - linekill(oq, n, ISSET(tios, ECHO)); - n = 0; - } else { - if (n > sizeof(tty_line)) { - cb_putc(oq, CTRL('G')); - continue; - } - if (ch == '\r' || ch == '\n' || ch == tios.c_cc[VEOL]) { - if (tios.c_iflag & ICRNL) - ch = '\n'; - else if (tios.c_iflag & INLCR) - ch = '\r'; - if (ch == '\n' && tios.c_iflag & ICRNL) - cb_putc(oq, '\r'); - stop = True; - } - if (ISSET(tios, ECHO)) cb_putc(oq, ch); - tty_line[n++] = ch; - } - } - } - if (ISSET(tios, ECHO)) WakeupMainThread(); - tty_left = n; - tty_ptr = tty_line; -} - -/* - * Canonized tty read - */ -int -ttycanonread(buf, size, signalled) - char *buf; - size_t size; - int *signalled; -{ - if (tty_left == 0) - canonize(signalled); - if (size > tty_left) - size = tty_left; - strncpy(buf, tty_ptr, size); - tty_ptr += size; - tty_left -= size; - return size; -} - -/* - * Write data to tty - */ -int -ttywrite(buf, size) - char *buf; - int size; -{ - TScreen *screen = &term->screen; - struct circbuf *oq; - int ch, i; - - oq = screen->tty_outq; - for (i = 0; i < size; i++) { - if ((ch = buf[i]) == '\n' && tios.c_iflag & ICRNL) - cb_putc(oq, '\r'); - cb_putc(oq, ch); - if (ch == '\n') { - /* Provide a wakeup for each line. Otherwise the circular buffer - * could be filled (thus blocking us) without the main thread - * knowing it can already process some data. - */ - WakeupMainThread(); - } - } - WakeupMainThread(); - return size; -} - -static void -flush_read() -{ - TScreen *screen = &term->screen; - struct circbuf *iq; - char *p; - int n; - - iq = screen->tty_inq; - cb_putc(iq, '\n'); - mu_lock(&read_mutex); - while ((n = cb_getp(iq, &p, 0/*don't block*/)) > 0) - cb_getpdone(iq, n); - tty_left = 0; - mu_unlock(&read_mutex); - WakeupMainThread(); -} - -/* - * Before characters are pushed onto the input stream of the shell - * process some of them may need some pre-processing. For example, - * interrupt should be processed as soon as possible to obtain the - * desired effect. This routine deals with key strokes that have - * such special properties. - */ -int -ttypreprocess(ch) - int ch; -{ - if ((tios.c_lflag & ISIG) && ch == tios.c_cc[VQUIT]) { - if (!(tios.c_lflag & NOFLSH)) flush_read(); - ttysendsig(SIGQUIT); - return 1; - } - if ((tios.c_lflag & ISIG) && ch == tios.c_cc[VINTR]) { - if (!(tios.c_lflag & NOFLSH)) flush_read(); - ttysendsig(SIGINT); - return 1; - } - return 0; -} - -/* - * Send Unix signal to shell - */ -ttysendsig(sig) - int sig; -{ - header hdr; - long tout; - - if (!(tios.c_lflag & ISIG)) - return; - if (NULLPORT(&ttyintcap.cap_port)) - return; - hdr.h_port = ttyintcap.cap_port; - hdr.h_priv = ttyintcap.cap_priv; - hdr.h_extra = sig; - hdr.h_command = TTI_SIGNAL; - tout = timeout(2000L); - trans(&hdr, NILBUF, 0, &hdr, NILBUF, 0); - timeout(tout); -} -#endif /* AMOEBA */ Index: xc/programs/xterm/util.c diff -u xc/programs/xterm/util.c:3.69 xc/programs/xterm/util.c:3.73 --- xc/programs/xterm/util.c:3.69 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/util.c Fri Dec 27 16:05:23 2002 @@ -2,10 +2,10 @@ * $Xorg: util.c,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/util.c,v 3.69 2002/01/05 22:05:03 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/util.c,v 3.73 2002/12/27 21:05:23 dickey Exp $ */ /* - * Copyright 1999,2000,2001,2002 by Thomas E. Dickey + * Copyright 1999-2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -72,122 +72,130 @@ #include <stdio.h> #include <ctype.h> -extern Bool waiting_for_initial_map; +static int ClearInLine(TScreen * screen, int row, int col, int len); +static int handle_translated_exposure(TScreen * screen, + int rect_x, + int rect_y, + unsigned rect_width, + unsigned rect_height); +static void ClearLeft(TScreen * screen); +static void CopyWait(TScreen * screen); +static void horizontal_copy_area(TScreen * screen, + int firstchar, + int nchars, + int amount); +static void vertical_copy_area(TScreen * screen, + int firstline, + int nlines, + int amount); -static int ClearInLine (TScreen *screen, int row, int col, int len); -static int handle_translated_exposure (TScreen *screen, int rect_x, int rect_y, unsigned rect_width, unsigned rect_height); -static void ClearLeft (TScreen *screen); -static void CopyWait (TScreen *screen); -static void horizontal_copy_area (TScreen *screen, int firstchar, int nchars, int amount); -static void vertical_copy_area (TScreen *screen, int firstline, int nlines, int amount); - /* * These routines are used for the jump scroll feature */ void -FlushScroll(TScreen *screen) +FlushScroll(TScreen * screen) { - int i; - int shift = -screen->topline; - int bot = screen->max_row - shift; - int refreshtop; - int refreshheight; - int scrolltop; - int scrollheight; - - if(screen->cursor_state) - HideCursor(); - if(screen->scroll_amt > 0) { - refreshheight = screen->refresh_amt; - scrollheight = screen->bot_marg - screen->top_marg - - refreshheight + 1; - if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > - (i = screen->max_row - screen->scroll_amt + 1)) - refreshtop = i; - if(screen->scrollWidget && !screen->alternate - && screen->top_marg == 0) { - scrolltop = 0; - if((scrollheight += shift) > i) - scrollheight = i; - if((i = screen->bot_marg - bot) > 0 && - (refreshheight -= i) < screen->scroll_amt) - refreshheight = screen->scroll_amt; - if((i = screen->savedlines) < screen->savelines) { - if((i += screen->scroll_amt) > - screen->savelines) - i = screen->savelines; - screen->savedlines = i; - ScrollBarDrawThumb(screen->scrollWidget); - } - } else { - scrolltop = screen->top_marg + shift; - if((i = bot - (screen->bot_marg - screen->refresh_amt + - screen->scroll_amt)) > 0) { - if(bot < screen->bot_marg) - refreshheight = screen->scroll_amt + i; - } else { - scrollheight += i; - refreshheight = screen->scroll_amt; - if((i = screen->top_marg + screen->scroll_amt - - 1 - bot) > 0) { - refreshtop += i; - refreshheight -= i; - } - } - } + int i; + int shift = -screen->topline; + int bot = screen->max_row - shift; + int refreshtop; + int refreshheight; + int scrolltop; + int scrollheight; + + if (screen->cursor_state) + HideCursor(); + if (screen->scroll_amt > 0) { + refreshheight = screen->refresh_amt; + scrollheight = screen->bot_marg - screen->top_marg - + refreshheight + 1; + if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > + (i = screen->max_row - screen->scroll_amt + 1)) + refreshtop = i; + if (screen->scrollWidget && !screen->alternate + && screen->top_marg == 0) { + scrolltop = 0; + if ((scrollheight += shift) > i) + scrollheight = i; + if ((i = screen->bot_marg - bot) > 0 && + (refreshheight -= i) < screen->scroll_amt) + refreshheight = screen->scroll_amt; + if ((i = screen->savedlines) < screen->savelines) { + if ((i += screen->scroll_amt) > + screen->savelines) + i = screen->savelines; + screen->savedlines = i; + ScrollBarDrawThumb(screen->scrollWidget); + } } else { - refreshheight = -screen->refresh_amt; - scrollheight = screen->bot_marg - screen->top_marg - - refreshheight + 1; - refreshtop = screen->top_marg + shift; - scrolltop = refreshtop + refreshheight; - if((i = screen->bot_marg - bot) > 0) - scrollheight -= i; - if((i = screen->top_marg + refreshheight - 1 - bot) > 0) - refreshheight -= i; - } - scrolling_copy_area(screen, scrolltop+screen->scroll_amt, - scrollheight, screen->scroll_amt); - ScrollSelection(screen, -(screen->scroll_amt)); - screen->scroll_amt = 0; - screen->refresh_amt = 0; - if(refreshheight > 0) { - ClearCurBackground(screen, - (int) refreshtop * FontHeight(screen) + screen->border, - (int) OriginX(screen), - (unsigned) refreshheight * FontHeight(screen), - (unsigned) Width(screen)); - ScrnRefresh(screen, refreshtop, 0, refreshheight, - screen->max_col + 1, False); + scrolltop = screen->top_marg + shift; + if ((i = bot - (screen->bot_marg - screen->refresh_amt + + screen->scroll_amt)) > 0) { + if (bot < screen->bot_marg) + refreshheight = screen->scroll_amt + i; + } else { + scrollheight += i; + refreshheight = screen->scroll_amt; + if ((i = screen->top_marg + screen->scroll_amt - + 1 - bot) > 0) { + refreshtop += i; + refreshheight -= i; + } + } } + } else { + refreshheight = -screen->refresh_amt; + scrollheight = screen->bot_marg - screen->top_marg - + refreshheight + 1; + refreshtop = screen->top_marg + shift; + scrolltop = refreshtop + refreshheight; + if ((i = screen->bot_marg - bot) > 0) + scrollheight -= i; + if ((i = screen->top_marg + refreshheight - 1 - bot) > 0) + refreshheight -= i; + } + scrolling_copy_area(screen, scrolltop + screen->scroll_amt, + scrollheight, screen->scroll_amt); + ScrollSelection(screen, -(screen->scroll_amt)); + screen->scroll_amt = 0; + screen->refresh_amt = 0; + if (refreshheight > 0) { + ClearCurBackground(screen, + (int) refreshtop * FontHeight(screen) + screen->border, + (int) OriginX(screen), + (unsigned) refreshheight * FontHeight(screen), + (unsigned) Width(screen)); + ScrnRefresh(screen, refreshtop, 0, refreshheight, + screen->max_col + 1, False); + } } int -AddToRefresh(TScreen *screen) +AddToRefresh(TScreen * screen) { - int amount = screen->refresh_amt; - int row = screen->cur_row; + int amount = screen->refresh_amt; + int row = screen->cur_row; - if(amount == 0) - return(0); - if(amount > 0) { - int bottom; - - if(row == (bottom = screen->bot_marg) - amount) { - screen->refresh_amt++; - return(1); - } - return(row >= bottom - amount + 1 && row <= bottom); - } else { - int top; + if (amount == 0) + return (0); + if (amount > 0) { + int bottom; - amount = -amount; - if(row == (top = screen->top_marg) + amount) { - screen->refresh_amt--; - return(1); - } - return(row <= top + amount - 1 && row >= top); + if (row == (bottom = screen->bot_marg) - amount) { + screen->refresh_amt++; + return (1); } + return (row >= bottom - amount + 1 && row <= bottom); + } else { + int top; + + amount = -amount; + if (row == (top = screen->top_marg) + amount) { + screen->refresh_amt--; + return (1); + } + return (row <= top + amount - 1 && row >= top); + } } /* @@ -197,66 +205,66 @@ * requires: amount > 0 */ void -xtermScroll(TScreen *screen, int amount) +xtermScroll(TScreen * screen, int amount) { - int i = screen->bot_marg - screen->top_marg + 1; - int shift; - int bot; - int refreshtop = 0; - int refreshheight; - int scrolltop; - int scrollheight; - - if(screen->cursor_state) - HideCursor(); - if (amount > i) - amount = i; - if(screen->jumpscroll) { - if(screen->scroll_amt > 0) { - if(screen->refresh_amt + amount > i) - FlushScroll(screen); - screen->scroll_amt += amount; - screen->refresh_amt += amount; + int i = screen->bot_marg - screen->top_marg + 1; + int shift; + int bot; + int refreshtop = 0; + int refreshheight; + int scrolltop; + int scrollheight; + + if (screen->cursor_state) + HideCursor(); + if (amount > i) + amount = i; + if (screen->jumpscroll) { + if (screen->scroll_amt > 0) { + if (screen->refresh_amt + amount > i) + FlushScroll(screen); + screen->scroll_amt += amount; + screen->refresh_amt += amount; } else { - if(screen->scroll_amt < 0) - FlushScroll(screen); - screen->scroll_amt = amount; - screen->refresh_amt = amount; + if (screen->scroll_amt < 0) + FlushScroll(screen); + screen->scroll_amt = amount; + screen->refresh_amt = amount; } refreshheight = 0; } else { ScrollSelection(screen, -(amount)); if (amount == i) { - ClearScreen(screen); - return; + ClearScreen(screen); + return; } shift = -screen->topline; bot = screen->max_row - shift; scrollheight = i - amount; refreshheight = amount; - if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > - (i = screen->max_row - refreshheight + 1)) - refreshtop = i; - if(screen->scrollWidget && !screen->alternate - && screen->top_marg == 0) { - scrolltop = 0; - if((scrollheight += shift) > i) - scrollheight = i; - if((i = screen->savedlines) < screen->savelines) { - if((i += amount) > screen->savelines) - i = screen->savelines; - screen->savedlines = i; - ScrollBarDrawThumb(screen->scrollWidget); - } + if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > + (i = screen->max_row - refreshheight + 1)) + refreshtop = i; + if (screen->scrollWidget && !screen->alternate + && screen->top_marg == 0) { + scrolltop = 0; + if ((scrollheight += shift) > i) + scrollheight = i; + if ((i = screen->savedlines) < screen->savelines) { + if ((i += amount) > screen->savelines) + i = screen->savelines; + screen->savedlines = i; + ScrollBarDrawThumb(screen->scrollWidget); + } } else { - scrolltop = screen->top_marg + shift; - if((i = screen->bot_marg - bot) > 0) { - scrollheight -= i; - if((i = screen->top_marg + amount - 1 - bot) >= 0) { - refreshtop += i; - refreshheight -= i; - } + scrolltop = screen->top_marg + shift; + if ((i = screen->bot_marg - bot) > 0) { + scrollheight -= i; + if ((i = screen->top_marg + amount - 1 - bot) >= 0) { + refreshtop += i; + refreshheight -= i; } + } } if (screen->multiscroll && amount == 1 && @@ -266,31 +274,30 @@ CopyWait(screen); screen->scrolls++; } - scrolling_copy_area(screen, scrolltop+amount, scrollheight, amount); - if(refreshheight > 0) { - ClearCurBackground(screen, - (int) refreshtop * FontHeight(screen) + screen->border, - (int) OriginX(screen), - (unsigned) refreshheight * FontHeight(screen), - (unsigned) Width(screen)); - if(refreshheight > shift) - refreshheight = shift; + scrolling_copy_area(screen, scrolltop + amount, scrollheight, amount); + if (refreshheight > 0) { + ClearCurBackground(screen, + (int) refreshtop * FontHeight(screen) + screen->border, + (int) OriginX(screen), + (unsigned) refreshheight * FontHeight(screen), + (unsigned) Width(screen)); + if (refreshheight > shift) + refreshheight = shift; } } - if(screen->scrollWidget && !screen->alternate && screen->top_marg == 0) - ScrnDeleteLine(screen, screen->allbuf, - screen->bot_marg + screen->savelines, 0, - amount, screen->max_col + 1); - else - ScrnDeleteLine(screen, screen->visbuf, - screen->bot_marg, screen->top_marg, - amount, screen->max_col + 1); - if(refreshheight > 0) - ScrnRefresh(screen, refreshtop, 0, refreshheight, - screen->max_col + 1, False); + if (screen->scrollWidget && !screen->alternate && screen->top_marg == 0) + ScrnDeleteLine(screen, screen->allbuf, + screen->bot_marg + screen->savelines, 0, + amount, screen->max_col + 1); + else + ScrnDeleteLine(screen, screen->visbuf, + screen->bot_marg, screen->top_marg, + amount, screen->max_col + 1); + if (refreshheight > 0) + ScrnRefresh(screen, refreshtop, 0, refreshheight, + screen->max_col + 1, False); } - /* * Reverse scrolls the screen by amount lines, erases top, doesn't alter * cursor position (i.e. cursor moves up amount relative to text). @@ -298,44 +305,44 @@ * Requires: amount > 0 */ void -RevScroll(TScreen *screen, int amount) +RevScroll(TScreen * screen, int amount) { - int i = screen->bot_marg - screen->top_marg + 1; - int shift; - int bot; - int refreshtop; - int refreshheight; - int scrolltop; - int scrollheight; - - if(screen->cursor_state) - HideCursor(); - if (amount > i) - amount = i; - if(screen->jumpscroll) { - if(screen->scroll_amt < 0) { - if(-screen->refresh_amt + amount > i) - FlushScroll(screen); - screen->scroll_amt -= amount; - screen->refresh_amt -= amount; + int i = screen->bot_marg - screen->top_marg + 1; + int shift; + int bot; + int refreshtop; + int refreshheight; + int scrolltop; + int scrollheight; + + if (screen->cursor_state) + HideCursor(); + if (amount > i) + amount = i; + if (screen->jumpscroll) { + if (screen->scroll_amt < 0) { + if (-screen->refresh_amt + amount > i) + FlushScroll(screen); + screen->scroll_amt -= amount; + screen->refresh_amt -= amount; } else { - if(screen->scroll_amt > 0) - FlushScroll(screen); - screen->scroll_amt = -amount; - screen->refresh_amt = -amount; + if (screen->scroll_amt > 0) + FlushScroll(screen); + screen->scroll_amt = -amount; + screen->refresh_amt = -amount; } } else { shift = -screen->topline; bot = screen->max_row - shift; refreshheight = amount; scrollheight = screen->bot_marg - screen->top_marg - - refreshheight + 1; + refreshheight + 1; refreshtop = screen->top_marg + shift; scrolltop = refreshtop + refreshheight; - if((i = screen->bot_marg - bot) > 0) - scrollheight -= i; - if((i = screen->top_marg + refreshheight - 1 - bot) > 0) - refreshheight -= i; + if ((i = screen->bot_marg - bot) > 0) + scrollheight -= i; + if ((i = screen->top_marg + refreshheight - 1 - bot) > 0) + refreshheight -= i; if (screen->multiscroll && amount == 1 && screen->topline == 0 && screen->top_marg == 0 && @@ -344,13 +351,13 @@ CopyWait(screen); screen->scrolls++; } - scrolling_copy_area(screen, scrolltop-amount, scrollheight, -amount); - if(refreshheight > 0) { - ClearCurBackground(screen, - (int) refreshtop * FontHeight(screen) + screen->border, - (int) OriginX(screen), - (unsigned) refreshheight * FontHeight(screen), - (unsigned) Width(screen)); + scrolling_copy_area(screen, scrolltop - amount, scrollheight, -amount); + if (refreshheight > 0) { + ClearCurBackground(screen, + (int) refreshtop * FontHeight(screen) + screen->border, + (int) OriginX(screen), + (unsigned) refreshheight * FontHeight(screen), + (unsigned) Width(screen)); } } ScrnInsertLine(screen, screen->visbuf, screen->bot_marg, screen->top_marg, @@ -363,56 +370,56 @@ * bottom margin are lost. */ void -InsertLine (TScreen *screen, int n) +InsertLine(TScreen * screen, int n) { - int i; - int shift; - int bot; - int refreshtop; - int refreshheight; - int scrolltop; - int scrollheight; - - if (screen->cur_row < screen->top_marg || - screen->cur_row > screen->bot_marg) - return; - if(screen->cursor_state) - HideCursor(); - screen->do_wrap = 0; - if (n > (i = screen->bot_marg - screen->cur_row + 1)) - n = i; - if(screen->jumpscroll) { - if(screen->scroll_amt <= 0 && - screen->cur_row <= -screen->refresh_amt) { - if(-screen->refresh_amt + n > screen->max_row + 1) - FlushScroll(screen); - screen->scroll_amt -= n; - screen->refresh_amt -= n; - } else if(screen->scroll_amt) + int i; + int shift; + int bot; + int refreshtop; + int refreshheight; + int scrolltop; + int scrollheight; + + if (screen->cur_row < screen->top_marg || + screen->cur_row > screen->bot_marg) + return; + if (screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (i = screen->bot_marg - screen->cur_row + 1)) + n = i; + if (screen->jumpscroll) { + if (screen->scroll_amt <= 0 && + screen->cur_row <= -screen->refresh_amt) { + if (-screen->refresh_amt + n > screen->max_row + 1) FlushScroll(screen); + screen->scroll_amt -= n; + screen->refresh_amt -= n; + } else if (screen->scroll_amt) + FlushScroll(screen); } - if(!screen->scroll_amt) { + if (!screen->scroll_amt) { shift = -screen->topline; bot = screen->max_row - shift; refreshheight = n; scrollheight = screen->bot_marg - screen->cur_row - refreshheight + 1; refreshtop = screen->cur_row + shift; scrolltop = refreshtop + refreshheight; - if((i = screen->bot_marg - bot) > 0) - scrollheight -= i; - if((i = screen->cur_row + refreshheight - 1 - bot) > 0) - refreshheight -= i; - vertical_copy_area(screen, scrolltop-n, scrollheight, -n); - if(refreshheight > 0) { - ClearCurBackground(screen, - (int) refreshtop * FontHeight(screen) + screen->border, - (int) OriginX(screen), - (unsigned) refreshheight * FontHeight(screen), - (unsigned) Width(screen)); + if ((i = screen->bot_marg - bot) > 0) + scrollheight -= i; + if ((i = screen->cur_row + refreshheight - 1 - bot) > 0) + refreshheight -= i; + vertical_copy_area(screen, scrolltop - n, scrollheight, -n); + if (refreshheight > 0) { + ClearCurBackground(screen, + (int) refreshtop * FontHeight(screen) + screen->border, + (int) OriginX(screen), + (unsigned) refreshheight * FontHeight(screen), + (unsigned) Width(screen)); } } - ScrnInsertLine(screen, screen->visbuf, screen->bot_marg, screen->cur_row, n, - screen->max_col + 1); + ScrnInsertLine(screen, screen->visbuf, screen->bot_marg, screen->cur_row, + n, screen->max_col + 1); } /* @@ -420,232 +427,232 @@ * at the cursor's position, lines added at bottom margin are blank. */ void -DeleteLine(TScreen *screen, int n) +DeleteLine(TScreen * screen, int n) { - int i; - int shift; - int bot; - int refreshtop; - int refreshheight; - int scrolltop; - int scrollheight; - - if (screen->cur_row < screen->top_marg || - screen->cur_row > screen->bot_marg) - return; - if(screen->cursor_state) - HideCursor(); - screen->do_wrap = 0; - if (n > (i = screen->bot_marg - screen->cur_row + 1)) - n = i; - if(screen->jumpscroll) { - if(screen->scroll_amt >= 0 && screen->cur_row == screen->top_marg) { - if(screen->refresh_amt + n > screen->max_row + 1) - FlushScroll(screen); - screen->scroll_amt += n; - screen->refresh_amt += n; - } else if(screen->scroll_amt) + int i; + int shift; + int bot; + int refreshtop; + int refreshheight; + int scrolltop; + int scrollheight; + + if (screen->cur_row < screen->top_marg || + screen->cur_row > screen->bot_marg) + return; + if (screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (i = screen->bot_marg - screen->cur_row + 1)) + n = i; + if (screen->jumpscroll) { + if (screen->scroll_amt >= 0 && screen->cur_row == screen->top_marg) { + if (screen->refresh_amt + n > screen->max_row + 1) FlushScroll(screen); + screen->scroll_amt += n; + screen->refresh_amt += n; + } else if (screen->scroll_amt) + FlushScroll(screen); } - if(!screen->scroll_amt) { + if (!screen->scroll_amt) { shift = -screen->topline; bot = screen->max_row - shift; scrollheight = i - n; refreshheight = n; - if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > - (i = screen->max_row - refreshheight + 1)) - refreshtop = i; - if(screen->scrollWidget && !screen->alternate && screen->cur_row == 0) { - scrolltop = 0; - if((scrollheight += shift) > i) - scrollheight = i; - if((i = screen->savedlines) < screen->savelines) { - if((i += n) > screen->savelines) - i = screen->savelines; - screen->savedlines = i; - ScrollBarDrawThumb(screen->scrollWidget); - } + if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > + (i = screen->max_row - refreshheight + 1)) + refreshtop = i; + if (screen->scrollWidget && !screen->alternate && screen->cur_row == 0) { + scrolltop = 0; + if ((scrollheight += shift) > i) + scrollheight = i; + if ((i = screen->savedlines) < screen->savelines) { + if ((i += n) > screen->savelines) + i = screen->savelines; + screen->savedlines = i; + ScrollBarDrawThumb(screen->scrollWidget); + } } else { - scrolltop = screen->cur_row + shift; - if((i = screen->bot_marg - bot) > 0) { - scrollheight -= i; - if((i = screen->cur_row + n - 1 - bot) >= 0) { - refreshheight -= i; - } + scrolltop = screen->cur_row + shift; + if ((i = screen->bot_marg - bot) > 0) { + scrollheight -= i; + if ((i = screen->cur_row + n - 1 - bot) >= 0) { + refreshheight -= i; } + } } - vertical_copy_area(screen, scrolltop+n, scrollheight, n); - if(refreshheight > 0) { - ClearCurBackground(screen, - (int) refreshtop * FontHeight(screen) + screen->border, - (int) OriginX(screen), - (unsigned) refreshheight * FontHeight(screen), - (unsigned) Width(screen)); + vertical_copy_area(screen, scrolltop + n, scrollheight, n); + if (refreshheight > 0) { + ClearCurBackground(screen, + (int) refreshtop * FontHeight(screen) + screen->border, + (int) OriginX(screen), + (unsigned) refreshheight * FontHeight(screen), + (unsigned) Width(screen)); } } - /* adjust screen->buf */ - if(screen->scrollWidget && !screen->alternate && screen->cur_row == 0) - ScrnDeleteLine(screen, screen->allbuf, - screen->bot_marg + screen->savelines, 0, - n, screen->max_col + 1); - else - ScrnDeleteLine(screen, screen->visbuf, - screen->bot_marg, screen->cur_row, - n, screen->max_col + 1); + /* adjust screen->buf */ + if (screen->scrollWidget && !screen->alternate && screen->cur_row == 0) + ScrnDeleteLine(screen, screen->allbuf, + screen->bot_marg + screen->savelines, 0, + n, screen->max_col + 1); + else + ScrnDeleteLine(screen, screen->visbuf, + screen->bot_marg, screen->cur_row, + n, screen->max_col + 1); } /* * Insert n blanks at the cursor's position, no wraparound */ void -InsertChar (TScreen *screen, int n) +InsertChar(TScreen * screen, int n) { - register int width; + register int width; - if(screen->cursor_state) - HideCursor(); - screen->do_wrap = 0; - if (n > (width = screen->max_col + 1 - screen->cur_col)) - n = width; - - if(screen->cur_row - screen->topline <= screen->max_row) { - if(!AddToRefresh(screen)) { - int col = screen->max_col + 1 - n; - if(screen->scroll_amt) - FlushScroll(screen); + if (screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (width = screen->max_col + 1 - screen->cur_col)) + n = width; + + if (screen->cur_row - screen->topline <= screen->max_row) { + if (!AddToRefresh(screen)) { + int col = screen->max_col + 1 - n; + if (screen->scroll_amt) + FlushScroll(screen); #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, screen->cur_row)[0])) { - col = (screen->max_col + 1) / 2 - n; - } -#endif - /* - * prevent InsertChar from shifting the end of a line over - * if it is being appended to - */ - if (non_blank_line (screen->visbuf, screen->cur_row, - screen->cur_col, screen->max_col + 1)) - horizontal_copy_area(screen, screen->cur_col, - col - screen->cur_col, - n); - - ClearCurBackground( - screen, - CursorY (screen, screen->cur_row), - CurCursorX (screen, screen->cur_row, screen->cur_col), - FontHeight(screen), - n * CurFontWidth(screen,screen->cur_row)); + if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, screen->cur_row)[0])) { + col = (screen->max_col + 1) / 2 - n; } +#endif + /* + * prevent InsertChar from shifting the end of a line over + * if it is being appended to + */ + if (non_blank_line(screen->visbuf, screen->cur_row, + screen->cur_col, screen->max_col + 1)) + horizontal_copy_area(screen, screen->cur_col, + col - screen->cur_col, + n); + + ClearCurBackground( + screen, + CursorY(screen, screen->cur_row), + CurCursorX(screen, screen->cur_row, screen->cur_col), + FontHeight(screen), + n * CurFontWidth(screen, screen->cur_row)); } - /* adjust screen->buf */ - ScrnInsertChar(screen, n); + } + /* adjust screen->buf */ + ScrnInsertChar(screen, n); } /* * Deletes n chars at the cursor's position, no wraparound. */ void -DeleteChar (TScreen *screen, int n) +DeleteChar(TScreen * screen, int n) { - int width; + int width; - if(screen->cursor_state) - HideCursor(); - screen->do_wrap = 0; - if (n > (width = screen->max_col + 1 - screen->cur_col)) - n = width; - - if(screen->cur_row - screen->topline <= screen->max_row) { - if(!AddToRefresh(screen)) { - int col = screen->max_col + 1 - n; - if(screen->scroll_amt) - FlushScroll(screen); + if (screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (width = screen->max_col + 1 - screen->cur_col)) + n = width; + + if (screen->cur_row - screen->topline <= screen->max_row) { + if (!AddToRefresh(screen)) { + int col = screen->max_col + 1 - n; + if (screen->scroll_amt) + FlushScroll(screen); #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, screen->cur_row)[0])) { - col = (screen->max_col + 1) / 2 - n; - } -#endif - horizontal_copy_area(screen, screen->cur_col+n, - col - screen->cur_col, - -n); - - ClearCurBackground ( - screen, - CursorY (screen, screen->cur_row), - CurCursorX(screen, screen->cur_row, col), - FontHeight(screen), - n * CurFontWidth(screen,screen->cur_row)); + if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, screen->cur_row)[0])) { + col = (screen->max_col + 1) / 2 - n; } +#endif + horizontal_copy_area(screen, screen->cur_col + n, + col - screen->cur_col, + -n); + + ClearCurBackground( + screen, + CursorY(screen, screen->cur_row), + CurCursorX(screen, screen->cur_row, col), + FontHeight(screen), + n * CurFontWidth(screen, screen->cur_row)); } - /* adjust screen->buf */ - ScrnDeleteChar (screen, n); + } + /* adjust screen->buf */ + ScrnDeleteChar(screen, n); } /* * Clear from cursor position to beginning of display, inclusive. */ static void -ClearAbove (TScreen *screen) +ClearAbove(TScreen * screen) { - if (screen->protected_mode != OFF_PROTECT) { - int row; - for (row = 0; row <= screen->max_row; row++) - ClearInLine(screen, row, 0, screen->max_col + 1); - } else { - int top, height; + if (screen->protected_mode != OFF_PROTECT) { + int row; + for (row = 0; row <= screen->max_row; row++) + ClearInLine(screen, row, 0, screen->max_col + 1); + } else { + int top, height; - if(screen->cursor_state) - HideCursor(); - if((top = -screen->topline) <= screen->max_row) { - if(screen->scroll_amt) - FlushScroll(screen); - if((height = screen->cur_row + top) > screen->max_row) - height = screen->max_row; - if((height -= top) > 0) { - ClearCurBackground(screen, - top * FontHeight(screen) + screen->border, - OriginX(screen), - height * FontHeight(screen), - Width(screen)); - } - } - ClearBufRows(screen, 0, screen->cur_row - 1); + if (screen->cursor_state) + HideCursor(); + if ((top = -screen->topline) <= screen->max_row) { + if (screen->scroll_amt) + FlushScroll(screen); + if ((height = screen->cur_row + top) > screen->max_row) + height = screen->max_row; + if ((height -= top) > 0) { + ClearCurBackground(screen, + top * FontHeight(screen) + screen->border, + OriginX(screen), + height * FontHeight(screen), + Width(screen)); + } } + ClearBufRows(screen, 0, screen->cur_row - 1); + } - if(screen->cur_row - screen->topline <= screen->max_row) - ClearLeft(screen); + if (screen->cur_row - screen->topline <= screen->max_row) + ClearLeft(screen); } /* * Clear from cursor position to end of display, inclusive. */ static void -ClearBelow (TScreen *screen) +ClearBelow(TScreen * screen) { - ClearRight(screen, -1); + ClearRight(screen, -1); - if (screen->protected_mode != OFF_PROTECT) { - int row; - for (row = screen->cur_row + 1; row <= screen->max_row; row++) - ClearInLine(screen, row, 0, screen->max_col + 1); - } else { - int top; + if (screen->protected_mode != OFF_PROTECT) { + int row; + for (row = screen->cur_row + 1; row <= screen->max_row; row++) + ClearInLine(screen, row, 0, screen->max_col + 1); + } else { + int top; - if((top = screen->cur_row - screen->topline) <= screen->max_row) { - if(screen->scroll_amt) - FlushScroll(screen); - if(++top <= screen->max_row) { - ClearCurBackground(screen, - top * FontHeight(screen) + screen->border, - OriginX(screen), - (screen->max_row - top + 1) * FontHeight(screen), - Width(screen)); - } - } - ClearBufRows(screen, screen->cur_row + 1, screen->max_row); + if ((top = screen->cur_row - screen->topline) <= screen->max_row) { + if (screen->scroll_amt) + FlushScroll(screen); + if (++top <= screen->max_row) { + ClearCurBackground(screen, + top * FontHeight(screen) + screen->border, + OriginX(screen), + (screen->max_row - top + 1) * FontHeight(screen), + Width(screen)); + } } + ClearBufRows(screen, screen->cur_row + 1, screen->max_row); + } } /* @@ -653,102 +660,103 @@ * protected characters were found, 0 otherwise. */ static int -ClearInLine(TScreen *screen, int row, int col, int len) +ClearInLine(TScreen * screen, int row, int col, int len) { - int rc = 1; - int flags = TERM_COLOR_FLAGS; + int rc = 1; + int flags = TERM_COLOR_FLAGS; - /* - * If we're clearing to the end of the line, we won't count this as - * "drawn" characters. We'll only do cut/paste on "drawn" characters, - * so this has the effect of suppressing trailing blanks from a - * selection. - */ - if (col + len < screen->max_col + 1) { - flags |= CHARDRAWN; - } else { - len = screen->max_col + 1 - col; - } + /* + * If we're clearing to the end of the line, we won't count this as + * "drawn" characters. We'll only do cut/paste on "drawn" characters, + * so this has the effect of suppressing trailing blanks from a + * selection. + */ + if (col + len < screen->max_col + 1) { + flags |= CHARDRAWN; + } else { + len = screen->max_col + 1 - col; + } - /* If we've marked protected text on the screen, we'll have to - * check each time we do an erase. - */ - if (screen->protected_mode != OFF_PROTECT) { - int n; - Char *attrs = SCRN_BUF_ATTRS(screen, row) + col; - int saved_mode = screen->protected_mode; - Bool done; - - /* disable this branch during recursion */ - screen->protected_mode = OFF_PROTECT; - - do { - done = True; - for (n = 0; n < len; n++) { - if (attrs[n] & PROTECTED) { - rc = 0; /* found a protected segment */ - if (n != 0) - ClearInLine(screen, row, col, n); - while ((n < len) - && (attrs[n] & PROTECTED)) - n++; - done = False; - break; - } - } - /* setup for another segment, past the protected text */ - if (!done) { - attrs += n; - col += n; - len -= n; - } - } while (!done); - - screen->protected_mode = saved_mode; - if (len <= 0) - return 0; - } - /* fall through to the final non-protected segment */ - - if(screen->cursor_state) - HideCursor(); - screen->do_wrap = 0; - - if (row - screen->topline <= screen->max_row) { - if(!AddToRefresh(screen)) { - if(screen->scroll_amt) - FlushScroll(screen); - ClearCurBackground ( - screen, - CursorY (screen, row), - CurCursorX (screen, row, col), - FontHeight(screen), - len * CurFontWidth(screen,row)); + /* If we've marked protected text on the screen, we'll have to + * check each time we do an erase. + */ + if (screen->protected_mode != OFF_PROTECT) { + int n; + Char *attrs = SCRN_BUF_ATTRS(screen, row) + col; + int saved_mode = screen->protected_mode; + Bool done; + + /* disable this branch during recursion */ + screen->protected_mode = OFF_PROTECT; + + do { + done = True; + for (n = 0; n < len; n++) { + if (attrs[n] & PROTECTED) { + rc = 0; /* found a protected segment */ + if (n != 0) + ClearInLine(screen, row, col, n); + while ((n < len) + && (attrs[n] & PROTECTED)) + n++; + done = False; + break; } + } + /* setup for another segment, past the protected text */ + if (!done) { + attrs += n; + col += n; + len -= n; + } + } while (!done); + + screen->protected_mode = saved_mode; + if (len <= 0) + return 0; + } + /* fall through to the final non-protected segment */ + + if (screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + + if (row - screen->topline <= screen->max_row) { + if (!AddToRefresh(screen)) { + if (screen->scroll_amt) + FlushScroll(screen); + ClearCurBackground( + screen, + CursorY(screen, row), + CurCursorX(screen, row, col), + FontHeight(screen), + len * CurFontWidth(screen, row)); } + } - memset(SCRN_BUF_CHARS(screen, row) + col, ' ', len); - memset(SCRN_BUF_ATTRS(screen, row) + col, flags, len); + memset(SCRN_BUF_CHARS(screen, row) + col, ' ', len); + memset(SCRN_BUF_ATTRS(screen, row) + col, flags, len); - if_OPT_EXT_COLORS(screen,{ - memset(SCRN_BUF_FGRND(screen, row) + col, term->sgr_foreground, len); - memset(SCRN_BUF_BGRND(screen, row) + col, term->cur_background, len); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - memset(SCRN_BUF_COLOR(screen, row) + col, xtermColorPair(), len); - }) - if_OPT_DEC_CHRSET({ - memset(SCRN_BUF_CSETS(screen, row) + col, curXtermChrSet(screen->cur_row), len); - }) - if_OPT_WIDE_CHARS(screen,{ - memset(SCRN_BUF_WIDEC(screen, row) + col, 0, len); - memset(SCRN_BUF_COM1L(screen, row) + col, 0, len); - memset(SCRN_BUF_COM1H(screen, row) + col, 0, len); - memset(SCRN_BUF_COM2L(screen, row) + col, 0, len); - memset(SCRN_BUF_COM2H(screen, row) + col, 0, len); - }) + if_OPT_EXT_COLORS(screen, { + memset(SCRN_BUF_FGRND(screen, row) + col, term->sgr_foreground, len); + memset(SCRN_BUF_BGRND(screen, row) + col, term->cur_background, len); + }); + if_OPT_ISO_TRADITIONAL_COLORS(screen, { + memset(SCRN_BUF_COLOR(screen, row) + col, xtermColorPair(), len); + }); + if_OPT_DEC_CHRSET({ + memset(SCRN_BUF_CSETS(screen, row) + col, + curXtermChrSet(screen->cur_row), len); + }); + if_OPT_WIDE_CHARS(screen, { + memset(SCRN_BUF_WIDEC(screen, row) + col, 0, len); + memset(SCRN_BUF_COM1L(screen, row) + col, 0, len); + memset(SCRN_BUF_COM1H(screen, row) + col, 0, len); + memset(SCRN_BUF_COM2L(screen, row) + col, 0, len); + memset(SCRN_BUF_COM2H(screen, row) + col, 0, len); + }); - return rc; + return rc; } /* @@ -756,60 +764,60 @@ * position. */ void -ClearRight (TScreen *screen, int n) +ClearRight(TScreen * screen, int n) { - int len = (screen->max_col - screen->cur_col + 1); + int len = (screen->max_col - screen->cur_col + 1); - if (n < 0) /* the remainder of the line */ - n = screen->max_col + 1; - if (n == 0) /* default for 'ECH' */ - n = 1; + if (n < 0) /* the remainder of the line */ + n = screen->max_col + 1; + if (n == 0) /* default for 'ECH' */ + n = 1; - if (len > n) - len = n; + if (len > n) + len = n; - (void) ClearInLine(screen, screen->cur_row, screen->cur_col, len); + (void) ClearInLine(screen, screen->cur_row, screen->cur_col, len); - /* with the right part cleared, we can't be wrapping */ - ScrnClrWrapped(screen, screen->cur_row); + /* with the right part cleared, we can't be wrapping */ + ScrnClrWrapped(screen, screen->cur_row); } /* * Clear first part of cursor's line, inclusive. */ static void -ClearLeft (TScreen *screen) +ClearLeft(TScreen * screen) { - (void) ClearInLine(screen, screen->cur_row, 0, screen->cur_col + 1); + (void) ClearInLine(screen, screen->cur_row, 0, screen->cur_col + 1); } /* * Erase the cursor's line. */ static void -ClearLine(TScreen *screen) +ClearLine(TScreen * screen) { - (void) ClearInLine(screen, screen->cur_row, 0, screen->max_col + 1); + (void) ClearInLine(screen, screen->cur_row, 0, screen->max_col + 1); } void -ClearScreen(TScreen *screen) +ClearScreen(TScreen * screen) { - int top; + int top; - if(screen->cursor_state) - HideCursor(); - screen->do_wrap = 0; - if((top = -screen->topline) <= screen->max_row) { - if(screen->scroll_amt) - FlushScroll(screen); - ClearCurBackground(screen, - top * FontHeight(screen) + screen->border, - OriginX(screen), - (screen->max_row - top + 1) * FontHeight(screen), - Width(screen)); - } - ClearBufRows (screen, 0, screen->max_row); + if (screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if ((top = -screen->topline) <= screen->max_row) { + if (screen->scroll_amt) + FlushScroll(screen); + ClearCurBackground(screen, + top * FontHeight(screen) + screen->border, + OriginX(screen), + (screen->max_row - top + 1) * FontHeight(screen), + Width(screen)); + } + ClearBufRows(screen, 0, screen->max_row); } /* @@ -818,30 +826,27 @@ * ignore the protected flags. */ void -do_erase_line( - TScreen *screen, - int param, - int mode) +do_erase_line(TScreen * screen, int param, int mode) { - int saved_mode = screen->protected_mode; + int saved_mode = screen->protected_mode; - if (saved_mode == DEC_PROTECT - && saved_mode != mode) - screen->protected_mode = OFF_PROTECT; - - switch (param) { - case -1: /* DEFAULT */ - case 0: - ClearRight(screen, -1); - break; - case 1: - ClearLeft(screen); - break; - case 2: - ClearLine(screen); - break; - } - screen->protected_mode = saved_mode; + if (saved_mode == DEC_PROTECT + && saved_mode != mode) + screen->protected_mode = OFF_PROTECT; + + switch (param) { + case -1: /* DEFAULT */ + case 0: + ClearRight(screen, -1); + break; + case 1: + ClearLeft(screen); + break; + case 2: + ClearLine(screen); + break; + } + screen->protected_mode = saved_mode; } /* @@ -851,121 +856,117 @@ * protected mode flag in the screen data (it's slower). */ void -do_erase_display( - TScreen *screen, - int param, - int mode) +do_erase_display(TScreen * screen, int param, int mode) { - int saved_mode = screen->protected_mode; - - if (saved_mode == DEC_PROTECT - && saved_mode != mode) - screen->protected_mode = OFF_PROTECT; - - switch (param) { - case -1: /* DEFAULT */ - case 0: - if (screen->cur_row == 0 - && screen->cur_col == 0) { - screen->protected_mode = saved_mode; - do_erase_display(screen, 2, mode); - saved_mode = screen->protected_mode; - } else - ClearBelow(screen); - break; - - case 1: - if (screen->cur_row == screen->max_row - && screen->cur_col == screen->max_col) { - screen->protected_mode = saved_mode; - do_erase_display(screen, 2, mode); - saved_mode = screen->protected_mode; - } else - ClearAbove(screen); - break; + int saved_mode = screen->protected_mode; - case 2: - /* - * We use 'ClearScreen()' throughout the remainder of the - * program for places where we don't care if the characters are - * protected or not. So we modify the logic around this call - * on 'ClearScreen()' to handle protected characters. - */ - if (screen->protected_mode != OFF_PROTECT) { - int row; - int rc = 1; - for (row = 0; row <= screen->max_row; row++) - rc &= ClearInLine(screen, row, 0, screen->max_col + 1); - if (rc != 0) - saved_mode = OFF_PROTECT; - } else { - ClearScreen(screen); - } - break; + if (saved_mode == DEC_PROTECT + && saved_mode != mode) + screen->protected_mode = OFF_PROTECT; + + switch (param) { + case -1: /* DEFAULT */ + case 0: + if (screen->cur_row == 0 + && screen->cur_col == 0) { + screen->protected_mode = saved_mode; + do_erase_display(screen, 2, mode); + saved_mode = screen->protected_mode; + } else + ClearBelow(screen); + break; + + case 1: + if (screen->cur_row == screen->max_row + && screen->cur_col == screen->max_col) { + screen->protected_mode = saved_mode; + do_erase_display(screen, 2, mode); + saved_mode = screen->protected_mode; + } else + ClearAbove(screen); + break; - case 3: - /* xterm addition - erase saved lines. */ - screen->savedlines = 0; - ScrollBarDrawThumb( screen->scrollWidget ); - break; + case 2: + /* + * We use 'ClearScreen()' throughout the remainder of the + * program for places where we don't care if the characters are + * protected or not. So we modify the logic around this call + * on 'ClearScreen()' to handle protected characters. + */ + if (screen->protected_mode != OFF_PROTECT) { + int row; + int rc = 1; + for (row = 0; row <= screen->max_row; row++) + rc &= ClearInLine(screen, row, 0, screen->max_col + 1); + if (rc != 0) + saved_mode = OFF_PROTECT; + } else { + ClearScreen(screen); } - screen->protected_mode = saved_mode; + break; + + case 3: + /* xterm addition - erase saved lines. */ + screen->savedlines = 0; + ScrollBarDrawThumb(screen->scrollWidget); + break; + } + screen->protected_mode = saved_mode; } static void -CopyWait(TScreen *screen) +CopyWait(TScreen * screen) { - XEvent reply; - XEvent *rep = &reply; + XEvent reply; + XEvent *rep = &reply; + + while (1) { + XWindowEvent(screen->display, VWindow(screen), + ExposureMask, &reply); + switch (reply.type) { + case Expose: + HandleExposure(screen, &reply); + break; + case NoExpose: + case GraphicsExpose: + if (screen->incopy <= 0) { + screen->incopy = 1; + if (screen->scrolls > 0) + screen->scrolls--; + } + if (reply.type == GraphicsExpose) + HandleExposure(screen, &reply); - while (1) { - XWindowEvent (screen->display, VWindow(screen), - ExposureMask, &reply); - switch (reply.type) { - case Expose: - HandleExposure (screen, &reply); - break; - case NoExpose: - case GraphicsExpose: - if (screen->incopy <= 0) { - screen->incopy = 1; - if (screen->scrolls > 0) - screen->scrolls--; - } - if (reply.type == GraphicsExpose) - HandleExposure (screen, &reply); - - if ((reply.type == NoExpose) || - ((XExposeEvent *)rep)->count == 0) { - if (screen->incopy <= 0 && screen->scrolls > 0) - screen->scrolls--; - if (screen->scrolls == 0) { - screen->incopy = 0; - return; - } - screen->incopy = -1; - } - break; + if ((reply.type == NoExpose) || + ((XExposeEvent *) rep)->count == 0) { + if (screen->incopy <= 0 && screen->scrolls > 0) + screen->scrolls--; + if (screen->scrolls == 0) { + screen->incopy = 0; + return; } + screen->incopy = -1; + } + break; } + } } /* * used by vertical_copy_area and and horizontal_copy_area */ static void -copy_area( - TScreen *screen, - int src_x, - int src_y, - unsigned width, - unsigned height, - int dest_x, - int dest_y) +copy_area(TScreen * screen, + int src_x, + int src_y, + unsigned width, + unsigned height, + int dest_x, + int dest_y) { /* wait for previous CopyArea to complete unless multiscroll is enabled and active */ - if (screen->incopy && screen->scrolls == 0) + if (screen->incopy && screen->scrolls == 0) CopyWait(screen); screen->incopy = -1; @@ -987,38 +988,36 @@ * use when inserting or deleting characters on the current line */ static void -horizontal_copy_area( - TScreen *screen, - int firstchar, /* char pos on screen to start copying at */ - int nchars, - int amount) /* number of characters to move right */ +horizontal_copy_area(TScreen * screen, + int firstchar, /* char pos on screen to start copying at */ + int nchars, + int amount) /* number of characters to move right */ { int src_x = CurCursorX(screen, screen->cur_row, firstchar); int src_y = CursorY(screen, screen->cur_row); copy_area(screen, src_x, src_y, - (unsigned)nchars * CurFontWidth(screen,screen->cur_row), + (unsigned) nchars * CurFontWidth(screen, screen->cur_row), FontHeight(screen), - src_x + amount*CurFontWidth(screen,screen->cur_row), src_y); + src_x + amount * CurFontWidth(screen, screen->cur_row), src_y); } /* * use when inserting or deleting lines from the screen */ static void -vertical_copy_area( - TScreen *screen, - int firstline, /* line on screen to start copying at */ - int nlines, - int amount) /* number of lines to move up (neg=down) */ +vertical_copy_area(TScreen * screen, + int firstline, /* line on screen to start copying at */ + int nlines, + int amount) /* number of lines to move up (neg=down) */ { - if(nlines > 0) { + if (nlines > 0) { int src_x = OriginX(screen); int src_y = firstline * FontHeight(screen) + screen->border; copy_area(screen, src_x, src_y, - (unsigned)Width(screen), nlines*FontHeight(screen), - src_x, src_y - amount*FontHeight(screen)); + (unsigned) Width(screen), nlines * FontHeight(screen), + src_x, src_y - amount * FontHeight(screen)); } } @@ -1026,14 +1025,13 @@ * use when scrolling the entire screen */ void -scrolling_copy_area( - TScreen *screen, - int firstline, /* line on screen to start copying at */ - int nlines, - int amount) /* number of lines to move up (neg=down) */ +scrolling_copy_area(TScreen * screen, + int firstline, /* line on screen to start copying at */ + int nlines, + int amount) /* number of lines to move up (neg=down) */ { - if(nlines > 0) { + if (nlines > 0) { vertical_copy_area(screen, firstline, nlines, amount); } } @@ -1043,11 +1041,9 @@ * Returns 1 iff the area where the cursor was got refreshed. */ int -HandleExposure ( - TScreen *screen, - XEvent *event) +HandleExposure(TScreen * screen, XEvent * event) { - XExposeEvent *reply = (XExposeEvent *)event; + XExposeEvent *reply = (XExposeEvent *) event; #ifndef NO_ACTIVE_ICON if (reply->window == screen->iconVwin.window) @@ -1057,22 +1053,22 @@ #endif /* NO_ACTIVE_ICON */ /* if not doing CopyArea or if this is a GraphicsExpose, don't translate */ - if(!screen->incopy || event->type != Expose) - return handle_translated_exposure (screen, reply->x, reply->y, - reply->width, reply->height); + if (!screen->incopy || event->type != Expose) + return handle_translated_exposure(screen, reply->x, reply->y, + reply->width, reply->height); else { /* compute intersection of area being copied with area being exposed. */ int both_x1 = Max(screen->copy_src_x, reply->x); int both_y1 = Max(screen->copy_src_y, reply->y); - int both_x2 = Min(screen->copy_src_x+screen->copy_width, - (unsigned)(reply->x+reply->width)); - int both_y2 = Min(screen->copy_src_y+screen->copy_height, - (unsigned)(reply->y+reply->height)); + int both_x2 = Min(screen->copy_src_x + screen->copy_width, + (unsigned) (reply->x + reply->width)); + int both_y2 = Min(screen->copy_src_y + screen->copy_height, + (unsigned) (reply->y + reply->height)); int value = 0; /* was anything copied affected? */ - if(both_x2 > both_x1 && both_y2 > both_y1) { + if (both_x2 > both_x1 && both_y2 > both_y1) { /* do the copied area */ value = handle_translated_exposure (screen, reply->x + screen->copy_dest_x - screen->copy_src_x, @@ -1080,11 +1076,11 @@ reply->width, reply->height); } /* was anything not copied affected? */ - if(reply->x < both_x1 || reply->y < both_y1 - || reply->x+reply->width > both_x2 - || reply->y+reply->height > both_y2) - value = handle_translated_exposure (screen, reply->x, reply->y, - reply->width, reply->height); + if (reply->x < both_x1 || reply->y < both_y1 + || reply->x + reply->width > both_x2 + || reply->y + reply->height > both_y2) + value = handle_translated_exposure(screen, reply->x, reply->y, + reply->width, reply->height); return value; } @@ -1096,272 +1092,267 @@ * The rectangle passed in is pixel coordinates. */ static int -handle_translated_exposure ( - TScreen *screen, - int rect_x, - int rect_y, - unsigned rect_width, - unsigned rect_height) -{ - int toprow, leftcol, nrows, ncols; - - TRACE(("handle_translated_exposure (%d,%d) - (%d,%d)\n", - rect_y, rect_x, rect_height, rect_width)); - - toprow = (rect_y - screen->border) / FontHeight(screen); - if(toprow < 0) - toprow = 0; - leftcol = (rect_x - OriginX(screen)) - / CurFontWidth(screen,screen->cur_row); - if(leftcol < 0) - leftcol = 0; - nrows = (rect_y + rect_height - 1 - screen->border) / - FontHeight(screen) - toprow + 1; - ncols = (rect_x + rect_width - 1 - OriginX(screen)) / - FontWidth(screen) - leftcol + 1; - toprow -= screen->scrolls; - if (toprow < 0) { - nrows += toprow; - toprow = 0; - } - if (toprow + nrows - 1 > screen->max_row) - nrows = screen->max_row - toprow + 1; - if (leftcol + ncols - 1 > screen->max_col) - ncols = screen->max_col - leftcol + 1; - - if (nrows > 0 && ncols > 0) { - ScrnRefresh (screen, toprow, leftcol, nrows, ncols, False); - if (waiting_for_initial_map) { - first_map_occurred (); - } - if (screen->cur_row >= toprow && - screen->cur_row < toprow + nrows && - screen->cur_col >= leftcol && - screen->cur_col < leftcol + ncols) - return (1); +handle_translated_exposure(TScreen * screen, + int rect_x, + int rect_y, + unsigned rect_width, + unsigned rect_height) +{ + int toprow, leftcol, nrows, ncols; + + TRACE(("handle_translated_exposure (%d,%d) - (%d,%d)\n", + rect_y, rect_x, rect_height, rect_width)); + + toprow = (rect_y - screen->border) / FontHeight(screen); + if (toprow < 0) + toprow = 0; + leftcol = (rect_x - OriginX(screen)) + / CurFontWidth(screen, screen->cur_row); + if (leftcol < 0) + leftcol = 0; + nrows = (rect_y + rect_height - 1 - screen->border) / + FontHeight(screen) - toprow + 1; + ncols = (rect_x + rect_width - 1 - OriginX(screen)) / + FontWidth(screen) - leftcol + 1; + toprow -= screen->scrolls; + if (toprow < 0) { + nrows += toprow; + toprow = 0; + } + if (toprow + nrows - 1 > screen->max_row) + nrows = screen->max_row - toprow + 1; + if (leftcol + ncols - 1 > screen->max_col) + ncols = screen->max_col - leftcol + 1; + + if (nrows > 0 && ncols > 0) { + ScrnRefresh(screen, toprow, leftcol, nrows, ncols, False); + if (waiting_for_initial_map) { + first_map_occurred(); + } + if (screen->cur_row >= toprow && + screen->cur_row < toprow + nrows && + screen->cur_col >= leftcol && + screen->cur_col < leftcol + ncols) + return (1); - } - return (0); + } + return (0); } /***====================================================================***/ void -GetColors(XtermWidget tw, ScrnColors *pColors) +GetColors(XtermWidget tw, ScrnColors * pColors) { - TScreen *screen = &tw->screen; + TScreen *screen = &tw->screen; - pColors->which= 0; - SET_COLOR_VALUE(pColors,TEXT_FG, screen->foreground); - SET_COLOR_VALUE(pColors,TEXT_BG, tw->core.background_pixel); - SET_COLOR_VALUE(pColors,TEXT_CURSOR, screen->cursorcolor); - SET_COLOR_VALUE(pColors,MOUSE_FG, screen->mousecolor); - SET_COLOR_VALUE(pColors,MOUSE_BG, screen->mousecolorback); + pColors->which = 0; + SET_COLOR_VALUE(pColors, TEXT_FG, screen->foreground); + SET_COLOR_VALUE(pColors, TEXT_BG, tw->core.background_pixel); + SET_COLOR_VALUE(pColors, TEXT_CURSOR, screen->cursorcolor); + SET_COLOR_VALUE(pColors, MOUSE_FG, screen->mousecolor); + SET_COLOR_VALUE(pColors, MOUSE_BG, screen->mousecolorback); #if OPT_HIGHLIGHT_COLOR - SET_COLOR_VALUE(pColors,HIGHLIGHT_BG, screen->highlightcolor); + SET_COLOR_VALUE(pColors, HIGHLIGHT_BG, screen->highlightcolor); #endif #if OPT_TEK4014 - SET_COLOR_VALUE(pColors,TEK_FG, screen->Tforeground); - SET_COLOR_VALUE(pColors,TEK_BG, screen->Tbackground); + SET_COLOR_VALUE(pColors, TEK_FG, screen->Tforeground); + SET_COLOR_VALUE(pColors, TEK_BG, screen->Tbackground); #endif } void -ChangeColors(XtermWidget tw, ScrnColors *pNew) +ChangeColors(XtermWidget tw, ScrnColors * pNew) { - TScreen *screen = &tw->screen; + TScreen *screen = &tw->screen; #if OPT_TEK4014 - Window tek = TWindow(screen); + Window tek = TWindow(screen); #endif - if (COLOR_DEFINED(pNew,TEXT_BG)) { - tw->core.background_pixel= COLOR_VALUE(pNew,TEXT_BG); - } - - if (COLOR_DEFINED(pNew,TEXT_CURSOR)) { - screen->cursorcolor= COLOR_VALUE(pNew,TEXT_CURSOR); - } - else if ((screen->cursorcolor == screen->foreground)&& - (COLOR_DEFINED(pNew,TEXT_FG))) { - screen->cursorcolor= COLOR_VALUE(pNew,TEXT_FG); - } + if (COLOR_DEFINED(pNew, TEXT_BG)) { + tw->core.background_pixel = COLOR_VALUE(pNew, TEXT_BG); + } - if (COLOR_DEFINED(pNew,TEXT_FG)) { - Pixel fg= COLOR_VALUE(pNew,TEXT_FG); - screen->foreground= fg; - XSetForeground(screen->display,NormalGC(screen),fg); - XSetBackground(screen->display,ReverseGC(screen),fg); - XSetForeground(screen->display,NormalBoldGC(screen),fg); - XSetBackground(screen->display,ReverseBoldGC(screen),fg); - } + if (COLOR_DEFINED(pNew, TEXT_CURSOR)) { + screen->cursorcolor = COLOR_VALUE(pNew, TEXT_CURSOR); + } else if ((screen->cursorcolor == screen->foreground) && + (COLOR_DEFINED(pNew, TEXT_FG))) { + screen->cursorcolor = COLOR_VALUE(pNew, TEXT_FG); + } - if (COLOR_DEFINED(pNew,TEXT_BG)) { - Pixel bg= COLOR_VALUE(pNew,TEXT_BG); - tw->core.background_pixel= bg; - XSetBackground(screen->display,NormalGC(screen),bg); - XSetForeground(screen->display,ReverseGC(screen),bg); - XSetBackground(screen->display,NormalBoldGC(screen),bg); - XSetForeground(screen->display,ReverseBoldGC(screen),bg); - XSetWindowBackground(screen->display, VWindow(screen), - tw->core.background_pixel); - } + if (COLOR_DEFINED(pNew, TEXT_FG)) { + Pixel fg = COLOR_VALUE(pNew, TEXT_FG); + screen->foreground = fg; + XSetForeground(screen->display, NormalGC(screen), fg); + XSetBackground(screen->display, ReverseGC(screen), fg); + XSetForeground(screen->display, NormalBoldGC(screen), fg); + XSetBackground(screen->display, ReverseBoldGC(screen), fg); + } - if (COLOR_DEFINED(pNew,MOUSE_FG)||(COLOR_DEFINED(pNew,MOUSE_BG))) { - if (COLOR_DEFINED(pNew,MOUSE_FG)) - screen->mousecolor= COLOR_VALUE(pNew,MOUSE_FG); - if (COLOR_DEFINED(pNew,MOUSE_BG)) - screen->mousecolorback= COLOR_VALUE(pNew,MOUSE_BG); + if (COLOR_DEFINED(pNew, TEXT_BG)) { + Pixel bg = COLOR_VALUE(pNew, TEXT_BG); + tw->core.background_pixel = bg; + XSetBackground(screen->display, NormalGC(screen), bg); + XSetForeground(screen->display, ReverseGC(screen), bg); + XSetBackground(screen->display, NormalBoldGC(screen), bg); + XSetForeground(screen->display, ReverseBoldGC(screen), bg); + XSetWindowBackground(screen->display, VWindow(screen), + tw->core.background_pixel); + } - recolor_cursor (screen->pointer_cursor, - screen->mousecolor, screen->mousecolorback); - recolor_cursor (screen->arrow, - screen->mousecolor, screen->mousecolorback); - XDefineCursor(screen->display, VWindow(screen), - screen->pointer_cursor); + if (COLOR_DEFINED(pNew, MOUSE_FG) || (COLOR_DEFINED(pNew, MOUSE_BG))) { + if (COLOR_DEFINED(pNew, MOUSE_FG)) + screen->mousecolor = COLOR_VALUE(pNew, MOUSE_FG); + if (COLOR_DEFINED(pNew, MOUSE_BG)) + screen->mousecolorback = COLOR_VALUE(pNew, MOUSE_BG); + + recolor_cursor(screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + recolor_cursor(screen->arrow, + screen->mousecolor, screen->mousecolorback); + XDefineCursor(screen->display, VWindow(screen), + screen->pointer_cursor); #if OPT_HIGHLIGHT_COLOR - if (COLOR_DEFINED(pNew,HIGHLIGHT_BG)) { - screen->highlightcolor= COLOR_VALUE(pNew,HIGHLIGHT_BG); + if (COLOR_DEFINED(pNew, HIGHLIGHT_BG)) { + screen->highlightcolor = COLOR_VALUE(pNew, HIGHLIGHT_BG); } #endif #if OPT_TEK4014 - if(tek) - XDefineCursor(screen->display, tek, screen->arrow); + if (tek) + XDefineCursor(screen->display, tek, screen->arrow); #endif - } - + } #if OPT_TEK4014 - if ((tek)&&(COLOR_DEFINED(pNew,TEK_FG)||COLOR_DEFINED(pNew,TEK_BG))) { - ChangeTekColors(screen,pNew); - } + if ((tek) && (COLOR_DEFINED(pNew, TEK_FG) || COLOR_DEFINED(pNew, TEK_BG))) { + ChangeTekColors(screen, pNew); + } #endif - set_cursor_gcs(screen); - XClearWindow(screen->display, VWindow(screen)); - ScrnRefresh (screen, 0, 0, screen->max_row + 1, - screen->max_col + 1, False); + set_cursor_gcs(screen); + XClearWindow(screen->display, VWindow(screen)); + ScrnRefresh(screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); #if OPT_TEK4014 - if(screen->Tshow) { - XClearWindow(screen->display, tek); - TekExpose((Widget)NULL, (XEvent *)NULL, (Region)NULL); - } + if (screen->Tshow) { + XClearWindow(screen->display, tek); + TekExpose((Widget) NULL, (XEvent *) NULL, (Region) NULL); + } #endif } void ChangeAnsiColors(XtermWidget tw) { - TScreen *screen = &tw->screen; + TScreen *screen = &tw->screen; - XClearWindow(screen->display, VWindow(screen)); - ScrnRefresh (screen, 0, 0, - screen->max_row + 1, - screen->max_col + 1, False); + XClearWindow(screen->display, VWindow(screen)); + ScrnRefresh(screen, 0, 0, + screen->max_row + 1, + screen->max_col + 1, False); } /***====================================================================***/ void -ReverseVideo (XtermWidget termw) +ReverseVideo(XtermWidget termw) { - TScreen *screen = &termw->screen; - GC tmpGC; - Pixel tmp; + TScreen *screen = &termw->screen; + GC tmpGC; + Pixel tmp; #if OPT_TEK4014 - Window tek = TWindow(screen); + Window tek = TWindow(screen); #endif - /* - * Swap SGR foreground and background colors. By convention, these are - * the colors assigned to "black" (SGR #0) and "white" (SGR #7). Also, - * SGR #8 and SGR #15 are the bold (or bright) versions of SGR #0 and - * #7, respectively. - * - * We don't swap colors that happen to match the screen's foreground - * and background because that tends to produce bizarre effects. - */ - if_OPT_ISO_COLORS(screen,{ - ColorRes tmp2; - EXCHANGE( screen->Acolors[0], screen->Acolors[7], tmp2 ) - EXCHANGE( screen->Acolors[8], screen->Acolors[15], tmp2 ) - }) - - tmp = termw->core.background_pixel; - if(screen->cursorcolor == screen->foreground) - screen->cursorcolor = tmp; - termw->core.background_pixel = screen->foreground; - screen->foreground = tmp; - - EXCHANGE( screen->mousecolor, screen->mousecolorback, tmp ) - EXCHANGE( NormalGC(screen), ReverseGC(screen), tmpGC ) - EXCHANGE( NormalBoldGC(screen), ReverseBoldGC(screen), tmpGC ) - + /* + * Swap SGR foreground and background colors. By convention, these are + * the colors assigned to "black" (SGR #0) and "white" (SGR #7). Also, + * SGR #8 and SGR #15 are the bold (or bright) versions of SGR #0 and + * #7, respectively. + * + * We don't swap colors that happen to match the screen's foreground + * and background because that tends to produce bizarre effects. + */ + if_OPT_ISO_COLORS(screen, { + ColorRes tmp2; + EXCHANGE(screen->Acolors[0], screen->Acolors[7], tmp2) + EXCHANGE(screen->Acolors[8], screen->Acolors[15], tmp2) + }); + + tmp = termw->core.background_pixel; + if (screen->cursorcolor == screen->foreground) + screen->cursorcolor = tmp; + termw->core.background_pixel = screen->foreground; + screen->foreground = tmp; + + EXCHANGE(screen->mousecolor, screen->mousecolorback, tmp) + EXCHANGE(NormalGC(screen), ReverseGC(screen), tmpGC) + EXCHANGE(NormalBoldGC(screen), ReverseBoldGC(screen), tmpGC) #ifndef NO_ACTIVE_ICON tmpGC = screen->iconVwin.normalGC; - screen->iconVwin.normalGC = screen->iconVwin.reverseGC; - screen->iconVwin.reverseGC = tmpGC; + screen->iconVwin.normalGC = screen->iconVwin.reverseGC; + screen->iconVwin.reverseGC = tmpGC; - tmpGC = screen->iconVwin.normalboldGC; - screen->iconVwin.normalboldGC = screen->iconVwin.reverseboldGC; - screen->iconVwin.reverseboldGC = tmpGC; + tmpGC = screen->iconVwin.normalboldGC; + screen->iconVwin.normalboldGC = screen->iconVwin.reverseboldGC; + screen->iconVwin.reverseboldGC = tmpGC; #endif /* NO_ACTIVE_ICON */ - recolor_cursor (screen->pointer_cursor, - screen->mousecolor, screen->mousecolorback); - recolor_cursor (screen->arrow, - screen->mousecolor, screen->mousecolorback); + recolor_cursor(screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + recolor_cursor(screen->arrow, + screen->mousecolor, screen->mousecolorback); - termw->misc.re_verse = !termw->misc.re_verse; + termw->misc.re_verse = !termw->misc.re_verse; - XDefineCursor(screen->display, VWindow(screen), screen->pointer_cursor); + XDefineCursor(screen->display, VWindow(screen), screen->pointer_cursor); #if OPT_TEK4014 - if(tek) - XDefineCursor(screen->display, tek, screen->arrow); + if (tek) + XDefineCursor(screen->display, tek, screen->arrow); #endif - if(screen->scrollWidget) - ScrollBarReverseVideo(screen->scrollWidget); + if (screen->scrollWidget) + ScrollBarReverseVideo(screen->scrollWidget); - XSetWindowBackground(screen->display, VWindow(screen), termw->core.background_pixel); + XSetWindowBackground(screen->display, VWindow(screen), termw->core.background_pixel); - /* the shell-window's background will be used in the first repainting - * on resizing - */ - XSetWindowBackground(screen->display, VShellWindow, termw->core.background_pixel); + /* the shell-window's background will be used in the first repainting + * on resizing + */ + XSetWindowBackground(screen->display, VShellWindow, termw->core.background_pixel); #if OPT_TEK4014 - if(tek) { - TekReverseVideo(screen); - } + if (tek) { + TekReverseVideo(screen); + } #endif - XClearWindow(screen->display, VWindow(screen)); - ScrnRefresh (screen, 0, 0, screen->max_row + 1, - screen->max_col + 1, False); + XClearWindow(screen->display, VWindow(screen)); + ScrnRefresh(screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); #if OPT_TEK4014 - if(screen->Tshow) { - XClearWindow(screen->display, tek); - TekExpose((Widget)NULL, (XEvent *)NULL, (Region)NULL); - } + if (screen->Tshow) { + XClearWindow(screen->display, tek); + TekExpose((Widget) NULL, (XEvent *) NULL, (Region) NULL); + } #endif - ReverseOldColors(); - update_reversevideo(); + ReverseOldColors(); + update_reversevideo(); } void -recolor_cursor ( - Cursor cursor, /* X cursor ID to set */ - unsigned long fg, /* pixel indexes to look up */ - unsigned long bg) /* pixel indexes to look up */ +recolor_cursor(Cursor cursor, /* X cursor ID to set */ + unsigned long fg, /* pixel indexes to look up */ + unsigned long bg) /* pixel indexes to look up */ { TScreen *screen = &term->screen; Display *dpy = screen->display; - XColor colordefs[2]; /* 0 is foreground, 1 is background */ + XColor colordefs[2]; /* 0 is foreground, 1 is background */ colordefs[0].pixel = fg; colordefs[1].pixel = bg; - XQueryColors (dpy, DefaultColormap (dpy, DefaultScreen (dpy)), - colordefs, 2); - XRecolorCursor (dpy, cursor, colordefs, colordefs+1); + XQueryColors(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), + colordefs, 2); + XRecolorCursor(dpy, cursor, colordefs, colordefs + 1); return; } @@ -1381,35 +1372,31 @@ { #define CACHE_SIZE 4 static struct { - XftColor color; - int use; + XftColor color; + int use; } cache[CACHE_SIZE]; - static int use; - int i; - int oldest, oldestuse; - XColor color; - + static int use; + int i; + int oldest, oldestuse; + XColor color; + oldestuse = 0x7fffffff; oldest = 0; - for (i = 0; i < CACHE_SIZE; i++) - { - if (cache[i].use) - { - if (cache[i].color.pixel == pixel) - { + for (i = 0; i < CACHE_SIZE; i++) { + if (cache[i].use) { + if (cache[i].color.pixel == pixel) { cache[i].use = ++use; return &cache[i].color; } } - if (cache[i].use < oldestuse) - { + if (cache[i].use < oldestuse) { oldestuse = cache[i].use; oldest = i; } } i = oldest; color.pixel = pixel; - XQueryColor (term->screen.display, term->core.colormap, &color); + XQueryColor(term->screen.display, term->core.colormap, &color); cache[i].color.color.red = color.red; cache[i].color.color.green = color.green; cache[i].color.color.blue = color.blue; @@ -1424,408 +1411,413 @@ * Draws text with the specified combination of bold/underline */ int -drawXtermText( - TScreen *screen, - unsigned flags, - GC gc, - int x, - int y, - int chrset, - PAIRED_CHARS(Char *text, Char *text2), - Cardinal len, - int on_wide) +drawXtermText(TScreen * screen, + unsigned flags, + GC gc, + int x, + int y, + int chrset, + PAIRED_CHARS(Char * text, Char * text2), + Cardinal len, + int on_wide) { int real_length = len; int draw_len; #ifdef XRENDERFONT - if (screen->renderFont) - { - Display *dpy = screen->display; - XftFont *font; - XGCValues values; - - if (!screen->renderDraw) - { - int scr; - Drawable draw = VWindow(screen); - Visual *visual; - - scr = DefaultScreen (dpy); - visual = DefaultVisual (dpy, scr); - screen->renderDraw = XftDrawCreate (dpy, draw, visual, - DefaultColormap (dpy, scr)); + if (screen->renderFont) { + Display *dpy = screen->display; + XftFont *font; + XGCValues values; + + if (!screen->renderDraw) { + int scr; + Drawable draw = VWindow(screen); + Visual *visual; + + scr = DefaultScreen(dpy); + visual = DefaultVisual(dpy, scr); + screen->renderDraw = XftDrawCreate(dpy, draw, visual, + DefaultColormap(dpy, scr)); } - if ((flags & (BOLD|BLINK)) && screen->renderFontBold) + if ((flags & (BOLD | BLINK)) && screen->renderFontBold) font = screen->renderFontBold; else font = screen->renderFont; - XGetGCValues (dpy, gc, GCForeground|GCBackground, &values); - XftDrawRect (screen->renderDraw, - getColor (values.background), - x, y, - len * FontWidth(screen), FontHeight(screen)); - + XGetGCValues(dpy, gc, GCForeground | GCBackground, &values); + XftDrawRect(screen->renderDraw, + getColor(values.background), + x, y, + len * FontWidth(screen), FontHeight(screen)); + y += font->ascent; #if OPT_WIDE_CHARS - if (text2) - { - static XftChar16 *sbuf; - static unsigned slen; - unsigned n; + if (text2) { + static XftChar16 *sbuf; + static unsigned slen; + unsigned n; - if (slen < len) - { + if (slen < len) { slen = (len + 1) * 2; - sbuf = (XftChar16 *) XtRealloc ((char *) sbuf, slen * sizeof (XftChar16)); + sbuf = (XftChar16 *) XtRealloc((char *) sbuf, slen * sizeof(XftChar16)); } for (n = 0; n < len; n++) - sbuf[n] = *text++| (*text2++ << 8); - XftDrawString16 (screen->renderDraw, - getColor (values.foreground), - font, - x, y, sbuf, len); - } - else + sbuf[n] = *text++ | (*text2++ << 8); + XftDrawString16(screen->renderDraw, + getColor(values.foreground), + font, + x, y, sbuf, len); + } else #endif { - XftDrawString8 (screen->renderDraw, - getColor (values.foreground), - font, - x, y, (unsigned char *) text, len); + XftDrawString8(screen->renderDraw, + getColor(values.foreground), + font, + x, y, (unsigned char *) text, len); } return x + len * FontWidth(screen); } #endif #if OPT_WIDE_CHARS - /* - * It's simpler to pass in a null pointer for text2 in places where - * we only use codes through 255. Fix text2 here so we can increment - * it, etc. - */ - if (text2 == 0) { - static Char *dbuf; - static unsigned dlen; - if (dlen <= len) { - dlen = (len + 1) * 2; - dbuf = (Char *)XtRealloc((char *)dbuf, dlen); - memset(dbuf, 0, dlen); - } - text2 = dbuf; + /* + * It's simpler to pass in a null pointer for text2 in places where + * we only use codes through 255. Fix text2 here so we can increment + * it, etc. + */ + if (text2 == 0) { + static Char *dbuf; + static unsigned dlen; + if (dlen <= len) { + dlen = (len + 1) * 2; + dbuf = (Char *) XtRealloc((char *) dbuf, dlen); + memset(dbuf, 0, dlen); } + text2 = dbuf; + } #endif #if OPT_DEC_CHRSET - if (CSET_DOUBLE(chrset)) { - /* We could try drawing double-size characters in the icon, but - * given that the icon font is usually nil or nil2, there - * doesn't seem to be much point. - */ - GC gc2 = (!IsIcon(screen) && screen->font_doublesize) - ? xterm_DoubleGC(chrset, flags, gc) - : 0; - - TRACE(("DRAWTEXT%c[%4d,%4d] (%d) %d:%.*s\n", - screen->cursor_state == OFF ? ' ' : '*', - y, x, chrset, len, (int)len, text)); - - if (gc2 != 0) { /* draw actual double-sized characters */ - XFontStruct *fs = screen->double_fonts[xterm_Double_index(chrset, flags)].fs; - XRectangle rect, *rp = ▭ - Cardinal nr = 1; - int adjust; - - SAVE_FONT_INFO (screen); - screen->fnt_wide *= 2; - - rect.x = 0; - rect.y = 0; - rect.width = len * screen->fnt_wide; - rect.height = FontHeight(screen); - - switch (chrset) { - case CSET_DHL_TOP: - rect.y = - (rect.height / 2); - y -= rect.y; - screen->fnt_high *= 2; - break; - case CSET_DHL_BOT: - rect.y = (rect.height / 2); - y -= rect.y; - screen->fnt_high *= 2; - break; - default: - nr = 0; - break; - } - - /* - * Though it is the right "size", a given bold font may - * be shifted up by a pixel or two. Shift it back into - * the clipping rectangle. - */ - if (nr != 0) { - adjust = fs->ascent - + fs->descent - - (2 * FontHeight(screen)); - rect.y -= adjust; - y += adjust; - } - - if (nr) - XSetClipRectangles(screen->display, gc2, - x, y, rp, nr, YXBanded); - else - XSetClipMask(screen->display, gc2, None); - - /* - * If we're trying to use proportional font, or if the - * font server didn't give us what we asked for wrt - * width, position each character independently. - */ - if (screen->fnt_prop - || (fs->min_bounds.width != fs->max_bounds.width) - || (fs->min_bounds.width != 2 * FontWidth(screen))) - { - while (len--) { - x = drawXtermText(screen, flags, gc2, - x, y, 0, - PAIRED_CHARS(text++, text2++), - 1, on_wide); - x += FontWidth(screen); - } - } else { - x = drawXtermText(screen, flags, gc2, - x, y, 0, - PAIRED_CHARS(text, text2), - len, on_wide); - x += len * FontWidth(screen); - } + if (CSET_DOUBLE(chrset)) { + /* We could try drawing double-size characters in the icon, but + * given that the icon font is usually nil or nil2, there + * doesn't seem to be much point. + */ + GC gc2 = ((!IsIcon(screen) && screen->font_doublesize) + ? xterm_DoubleGC(chrset, flags, gc) + : 0); + + TRACE(("DRAWTEXT%c[%4d,%4d] (%d) %d:%.*s\n", + screen->cursor_state == OFF ? ' ' : '*', + y, x, chrset, len, (int) len, text)); + + if (gc2 != 0) { /* draw actual double-sized characters */ + XFontStruct *fs = + screen->double_fonts[xterm_Double_index(chrset, flags)].fs; + XRectangle rect, *rp = ▭ + Cardinal nr = 1; + int adjust; + + SAVE_FONT_INFO(screen); + screen->fnt_wide *= 2; + + rect.x = 0; + rect.y = 0; + rect.width = len * screen->fnt_wide; + rect.height = FontHeight(screen); + + switch (chrset) { + case CSET_DHL_TOP: + rect.y = -(rect.height / 2); + y -= rect.y; + screen->fnt_high *= 2; + break; + case CSET_DHL_BOT: + rect.y = (rect.height / 2); + y -= rect.y; + screen->fnt_high *= 2; + break; + default: + nr = 0; + break; + } + + /* + * Though it is the right "size", a given bold font may + * be shifted up by a pixel or two. Shift it back into + * the clipping rectangle. + */ + if (nr != 0) { + adjust = fs->ascent + + fs->descent + - (2 * FontHeight(screen)); + rect.y -= adjust; + y += adjust; + } + + if (nr) + XSetClipRectangles(screen->display, gc2, + x, y, rp, nr, YXBanded); + else + XSetClipMask(screen->display, gc2, None); + + /* + * If we're trying to use proportional font, or if the + * font server didn't give us what we asked for wrt + * width, position each character independently. + */ + if (screen->fnt_prop + || (fs->min_bounds.width != fs->max_bounds.width) + || (fs->min_bounds.width != 2 * FontWidth(screen))) { + while (len--) { + x = drawXtermText(screen, flags, gc2, + x, y, 0, + PAIRED_CHARS(text++, text2++), + 1, on_wide); + x += FontWidth(screen); + } + } else { + x = drawXtermText(screen, flags, gc2, + x, y, 0, + PAIRED_CHARS(text, text2), + len, on_wide); + x += len * FontWidth(screen); + } - TRACE(("drewtext [%4d,%4d]\n", y, x)); - SAVE_FONT_INFO (screen); + TRACE(("drewtext [%4d,%4d]\n", y, x)); + SAVE_FONT_INFO(screen); - } else { /* simulate double-sized characters */ + } else { /* simulate double-sized characters */ #if OPT_WIDE_CHARS - Char *wide = 0; + Char *wide = 0; #endif - unsigned need = 2 * len; - Char *temp = (Char *) malloc(need); - int n = 0; - if_OPT_WIDE_CHARS(screen,{ - wide = (Char *)malloc(need); - }) - while (len--) { - if_OPT_WIDE_CHARS(screen,{ - wide[n] = *text2++; - wide[n+1] = 0; - }) - temp[n++] = *text++; - temp[n++] = ' '; - } - x = drawXtermText(screen, flags, gc, x, y, 0, PAIRED_CHARS(temp, wide), n, on_wide); - free(temp); - if_OPT_WIDE_CHARS(screen,{ - free(wide); - }) - } - return x; + unsigned need = 2 * len; + Char *temp = (Char *) malloc(need); + int n = 0; + if_OPT_WIDE_CHARS(screen, { + wide = (Char *) malloc(need); + }); + while (len--) { + if_OPT_WIDE_CHARS(screen, { + wide[n] = *text2++; + wide[n + 1] = 0; + }); + temp[n++] = *text++; + temp[n++] = ' '; + } + x = drawXtermText(screen, + flags, + gc, + x, y, + 0, + PAIRED_CHARS(temp, wide), + n, + on_wide); + free(temp); + if_OPT_WIDE_CHARS(screen, { + free(wide); + }); } + return x; + } #endif - /* - * If we're asked to display a proportional font, do this with a fixed - * pitch. Yes, it's ugly. But we cannot distinguish the use of xterm - * as a dumb terminal vs its use as in fullscreen programs such as vi. - */ - if (screen->fnt_prop) { - int adj, width; - GC fillGC = gc; /* might be cursorGC */ - XFontStruct *fs = (flags & (BOLD|BLINK)) - ? screen->fnt_bold - : screen->fnt_norm; - screen->fnt_prop = False; + /* + * If we're asked to display a proportional font, do this with a fixed + * pitch. Yes, it's ugly. But we cannot distinguish the use of xterm + * as a dumb terminal vs its use as in fullscreen programs such as vi. + */ + if (screen->fnt_prop) { + int adj, width; + GC fillGC = gc; /* might be cursorGC */ + XFontStruct *fs = (flags & (BOLD | BLINK)) + ? screen->fnt_bold + : screen->fnt_norm; + screen->fnt_prop = False; #define GC_PAIRS(a,b) \ if (gc == a) fillGC = b; \ if (gc == b) fillGC = a - /* - * Fill the area where we'll write the characters, otherwise - * we'll get gaps between them. The cursor is a special case, - * because the XFillRectangle call only uses the foreground, - * while we've set the cursor color in the background. So we - * need a special GC for that. - */ - if (gc == screen->cursorGC - || gc == screen->reversecursorGC) - fillGC = screen->fillCursorGC; - GC_PAIRS(NormalGC(screen), ReverseGC(screen)); - GC_PAIRS(NormalBoldGC(screen), ReverseBoldGC(screen)); - - XFillRectangle (screen->display, VWindow(screen), fillGC, - x, y, len * FontWidth(screen), FontHeight(screen)); - - while (len--) { - width = XTextWidth(fs, (char *)text, 1); - adj = (FontWidth(screen) - width) / 2; - (void)drawXtermText(screen, flags, gc, x + adj, y, - chrset, - PAIRED_CHARS(text++, text2++), 1, on_wide); - x += FontWidth(screen); - } - screen->fnt_prop = True; - return x; + /* + * Fill the area where we'll write the characters, otherwise + * we'll get gaps between them. The cursor is a special case, + * because the XFillRectangle call only uses the foreground, + * while we've set the cursor color in the background. So we + * need a special GC for that. + */ + if (gc == screen->cursorGC + || gc == screen->reversecursorGC) + fillGC = screen->fillCursorGC; + GC_PAIRS(NormalGC(screen), ReverseGC(screen)); + GC_PAIRS(NormalBoldGC(screen), ReverseBoldGC(screen)); + + XFillRectangle(screen->display, VWindow(screen), fillGC, + x, y, len * FontWidth(screen), FontHeight(screen)); + + while (len--) { + width = XTextWidth(fs, (char *) text, 1); + adj = (FontWidth(screen) - width) / 2; + (void) drawXtermText(screen, flags, gc, x + adj, y, + chrset, + PAIRED_CHARS(text++, text2++), 1, on_wide); + x += FontWidth(screen); } + screen->fnt_prop = True; + return x; + } - /* If the font is complete, draw it as-is */ - if (screen->fnt_boxes && !screen->force_box_chars) { - TRACE(("drawtext%c[%4d,%4d] (%d) %d:%s\n", - screen->cursor_state == OFF ? ' ' : '*', - y, x, chrset, len, - visibleChars(PAIRED_CHARS(text, text2), len))); - y += FontAscent(screen); + /* If the font is complete, draw it as-is */ + if (screen->fnt_boxes && !screen->force_box_chars) { + TRACE(("drawXtermText%c[%4d,%4d] (%d) %d:%s\n", + screen->cursor_state == OFF ? ' ' : '*', + y, x, chrset, len, + visibleChars(PAIRED_CHARS(text, text2), len))); + y += FontAscent(screen); #if OPT_WIDE_CHARS - if (screen->wide_chars) { - int ascent_adjust = 0; - static XChar2b *sbuf; - static Cardinal slen; - Cardinal n; - int ch = text[0] | (text2[0] << 8); - int wideness = (on_wide || iswide(ch)!=0) && (screen->fnt_dwd!=NULL); - unsigned char *endtext = text + len; - if (slen < len) { - slen = (len + 1) * 2; - sbuf = (XChar2b *)XtRealloc((char *)sbuf, slen * sizeof(*sbuf)); - } - for (n = 0; n < len; n++) { - sbuf[n].byte2 = *text; - sbuf[n].byte1 = *text2; - text++; text2++; - if (wideness) { - /* filter out those pesky fake characters. */ - while (text < endtext - && *text == HIDDEN_HI - && *text2 == HIDDEN_LO) { - text++; text2++; - len--; - } - } - } - /* This is probably wrong. But it works. */ - draw_len = len; - if (wideness && (screen->fnt_dwd->fid || screen->fnt_dwdb->fid)) { - draw_len = real_length = len * 2; - if (flags & (BOLD|BLINK) && screen->fnt_dwdb->fid) { - XSetFont(screen->display, gc, screen->fnt_dwdb->fid); - ascent_adjust = screen->fnt_dwdb->ascent - screen->fnt_norm->ascent; - } - else { - XSetFont(screen->display, gc, screen->fnt_dwd->fid); - ascent_adjust = screen->fnt_dwd->ascent - screen->fnt_norm->ascent; - } - /* fix ascent */ - } - else if (flags & (BOLD|BLINK) && screen->fnt_bold->fid) - XSetFont(screen->display, gc, screen->fnt_bold->fid); - else - XSetFont(screen->display, gc, screen->fnt_norm->fid); - - if (my_wcwidth(ch) == 0) - XDrawString16(screen->display, - VWindow(screen), gc, - x, y + ascent_adjust, - sbuf, n); - else - XDrawImageString16(screen->display, - VWindow(screen), gc, - x, y + ascent_adjust, - sbuf, n); - - } else -#endif - { - XDrawImageString(screen->display, VWindow(screen), gc, - x, y, (char *)text, len); - draw_len = len; - if ((flags & (BOLD|BLINK)) && screen->enbolden) { + if (screen->wide_chars) { + int ascent_adjust = 0; + static XChar2b *sbuf; + static Cardinal slen; + Cardinal n; + int ch = text[0] | (text2[0] << 8); + int wideness = (on_wide || iswide(ch) != 0) + && (screen->fnt_dwd != NULL); + unsigned char *endtext = text + len; + if (slen < len) { + slen = (len + 1) * 2; + sbuf = (XChar2b *) XtRealloc((char *) sbuf, slen * sizeof(*sbuf)); + } + for (n = 0; n < len; n++) { + sbuf[n].byte2 = *text; + sbuf[n].byte1 = *text2; + text++; + text2++; + if (wideness) { + /* filter out those pesky fake characters. */ + while (text < endtext + && *text == HIDDEN_HI + && *text2 == HIDDEN_LO) { + text++; + text2++; + len--; + } + } + } + /* This is probably wrong. But it works. */ + draw_len = len; + if (wideness + && (screen->fnt_dwd->fid || screen->fnt_dwdb->fid)) { + draw_len = real_length = len * 2; + if ((flags & (BOLD | BLINK)) != 0 + && screen->fnt_dwdb->fid) { + XSetFont(screen->display, gc, screen->fnt_dwdb->fid); + ascent_adjust = screen->fnt_dwdb->ascent - screen->fnt_norm->ascent; + } else { + XSetFont(screen->display, gc, screen->fnt_dwd->fid); + ascent_adjust = screen->fnt_dwd->ascent - screen->fnt_norm->ascent; + } + /* fix ascent */ + } else if ((flags & (BOLD | BLINK)) != 0 + && screen->fnt_bold->fid) + XSetFont(screen->display, gc, screen->fnt_bold->fid); + else + XSetFont(screen->display, gc, screen->fnt_norm->fid); + + if (my_wcwidth(ch) == 0) + XDrawString16(screen->display, + VWindow(screen), gc, + x, y + ascent_adjust, + sbuf, n); + else + XDrawImageString16(screen->display, + VWindow(screen), gc, + x, y + ascent_adjust, + sbuf, n); + + } else +#endif + { + XDrawImageString(screen->display, VWindow(screen), gc, + x, y, (char *) text, len); + draw_len = len; + if ((flags & (BOLD | BLINK)) && screen->enbolden) { #if OPT_CLIP_BOLD - /* - * This special case is a couple of percent slower, but - * avoids a lot of pixel trash in rxcurses' hanoi.cmd - * demo (e.g., 10x20 font). - */ - if (screen->fnt_wide > 2) { - XRectangle clip; - int clip_x = x; - int clip_y = y - FontHeight(screen) + FontDescent(screen); - clip.x = 0; - clip.y = 0; - clip.height = FontHeight(screen); - clip.width = screen->fnt_wide * len; - XSetClipRectangles(screen->display, gc, - clip_x, clip_y, - &clip, 1, Unsorted); - } + /* + * This special case is a couple of percent slower, but + * avoids a lot of pixel trash in rxcurses' hanoi.cmd + * demo (e.g., 10x20 font). + */ + if (screen->fnt_wide > 2) { + XRectangle clip; + int clip_x = x; + int clip_y = y - FontHeight(screen) + FontDescent(screen); + clip.x = 0; + clip.y = 0; + clip.height = FontHeight(screen); + clip.width = screen->fnt_wide * len; + XSetClipRectangles(screen->display, gc, + clip_x, clip_y, + &clip, 1, Unsorted); + } #endif - XDrawString(screen->display, VWindow(screen), gc, - x + 1, y, (char *)text, len); + XDrawString(screen->display, VWindow(screen), gc, + x + 1, y, (char *) text, len); #if OPT_CLIP_BOLD - XSetClipMask(screen->display, gc, None); + XSetClipMask(screen->display, gc, None); #endif - } - } + } + } - if ((flags & UNDERLINE) && screen->underline) { - if (FontDescent(screen) > 1) - y++; - XDrawLine(screen->display, VWindow(screen), gc, - x, y, x + draw_len * screen->fnt_wide - 1, y); - } + if ((flags & UNDERLINE) && screen->underline) { + if (FontDescent(screen) > 1) + y++; + XDrawLine(screen->display, VWindow(screen), gc, + x, y, x + draw_len * screen->fnt_wide - 1, y); + } #if OPT_BOX_CHARS #define DrawX(col) x + (col * (screen->fnt_wide)) #define DrawSegment(first,last) (void)drawXtermText(screen, flags, gc, DrawX(first), y, chrset, PAIRED_CHARS(text+first, text2+first), last-first, on_wide) - } else { /* fill in missing box-characters */ - XFontStruct *font = (flags & BOLD) - ? screen->fnt_bold - : screen->fnt_norm; - Cardinal last, first = 0; - Boolean save_force = screen->force_box_chars; - screen->fnt_boxes = True; - for (last = 0; last < len; last++) { - unsigned ch = text[last]; - Boolean isMissing; + } else { /* fill in missing box-characters */ + XFontStruct *font = ((flags & BOLD) + ? screen->fnt_bold + : screen->fnt_norm); + Cardinal last, first = 0; + Boolean save_force = screen->force_box_chars; + screen->fnt_boxes = True; + for (last = 0; last < len; last++) { + unsigned ch = text[last]; + Boolean isMissing; #if OPT_WIDE_CHARS - if (text2 != 0) - ch |= (text2[last] << 8); - isMissing = (ch != HIDDEN_CHAR) - && (xtermMissingChar(ch, - ((on_wide || iswide(ch)) && screen->fnt_dwd) - ? screen->fnt_dwd - : font)); + if (text2 != 0) + ch |= (text2[last] << 8); + isMissing = (ch != HIDDEN_CHAR) + && (xtermMissingChar(ch, + ((on_wide || iswide(ch)) && screen->fnt_dwd) + ? screen->fnt_dwd + : font)); #else - isMissing = xtermMissingChar(ch, font); + isMissing = xtermMissingChar(ch, font); #endif - if (isMissing) { - if (last > first) { - screen->force_box_chars = False; - DrawSegment(first,last); - screen->force_box_chars = save_force; - } - xtermDrawBoxChar(screen, ch, flags, gc, DrawX(last), y); - first = last + 1; - } - } + if (isMissing) { if (last > first) { - screen->force_box_chars = False; - DrawSegment(first,last); + screen->force_box_chars = False; + DrawSegment(first, last); + screen->force_box_chars = save_force; } - screen->fnt_boxes = False; - screen->force_box_chars = save_force; -#endif + xtermDrawBoxChar(screen, ch, flags, gc, DrawX(last), y); + first = last + 1; + } } + if (last > first) { + screen->force_box_chars = False; + DrawSegment(first, last); + } + screen->fnt_boxes = False; + screen->force_box_chars = save_force; +#endif + } - return x + real_length * FontWidth(screen); + return x + real_length * FontWidth(screen); } /* @@ -1834,46 +1826,46 @@ * current screen foreground and background colors. */ GC -updatedXtermGC( - TScreen *screen, - int flags, - int fg_bg, - Bool hilite) +updatedXtermGC(TScreen * screen, int flags, int fg_bg, Bool hilite) { - Pixel fg_pix = getXtermForeground(flags,extract_fg(fg_bg,flags)); - Pixel bg_pix = getXtermBackground(flags,extract_bg(fg_bg,flags)); + int my_fg = extract_fg(fg_bg, flags); + int my_bg = extract_bg(fg_bg, flags); + Pixel fg_pix = getXtermForeground(flags, my_fg); + Pixel bg_pix = getXtermBackground(flags, my_bg); #if OPT_HIGHLIGHT_COLOR - Pixel hi_pix = screen->highlightcolor; + Pixel hi_pix = screen->highlightcolor; #endif - GC gc; + GC gc; + + checkVeryBoldColors(flags, my_fg); - if (ReverseOrHilite(screen, flags, hilite)) { - if (flags & (BOLD|BLINK)) - gc = ReverseBoldGC(screen); - else - gc = ReverseGC(screen); + if (ReverseOrHilite(screen, flags, hilite)) { + if (flags & (BOLD | BLINK)) + gc = ReverseBoldGC(screen); + else + gc = ReverseGC(screen); #if OPT_HIGHLIGHT_COLOR - if (hi_pix != screen->foreground - && hi_pix != fg_pix - && hi_pix != bg_pix - && hi_pix != term->dft_foreground) { - bg_pix = fg_pix; - fg_pix = hi_pix; - } + if (hi_pix != screen->foreground + && hi_pix != fg_pix + && hi_pix != bg_pix + && hi_pix != term->dft_foreground) { + bg_pix = fg_pix; + fg_pix = hi_pix; + } #endif - XSetForeground(screen->display, gc, bg_pix); - XSetBackground(screen->display, gc, fg_pix); - } else { - if (flags & (BOLD|BLINK)) - gc = NormalBoldGC(screen); - else - gc = NormalGC(screen); + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + } else { + if (flags & (BOLD | BLINK)) + gc = NormalBoldGC(screen); + else + gc = NormalGC(screen); - XSetForeground(screen->display, gc, fg_pix); - XSetBackground(screen->display, gc, bg_pix); - } - return gc; + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } + return gc; } /* @@ -1882,33 +1874,32 @@ * duplicates some logic, but only modifies 1/4 as many GC's. */ void -resetXtermGC( - TScreen *screen, - int flags, - Bool hilite) -{ - Pixel fg_pix = getXtermForeground(flags,term->cur_foreground); - Pixel bg_pix = getXtermBackground(flags,term->cur_background); - GC gc; - - if (ReverseOrHilite(screen, flags, hilite)) { - if (flags & (BOLD|BLINK)) - gc = ReverseBoldGC(screen); - else - gc = ReverseGC(screen); +resetXtermGC(TScreen * screen, int flags, Bool hilite) +{ + Pixel fg_pix = getXtermForeground(flags, term->cur_foreground); + Pixel bg_pix = getXtermBackground(flags, term->cur_background); + GC gc; - XSetForeground(screen->display, gc, bg_pix); - XSetBackground(screen->display, gc, fg_pix); + checkVeryBoldColors(flags, term->cur_foreground); - } else { - if (flags & (BOLD|BLINK)) - gc = NormalBoldGC(screen); - else - gc = NormalGC(screen); + if (ReverseOrHilite(screen, flags, hilite)) { + if (flags & (BOLD | BLINK)) + gc = ReverseBoldGC(screen); + else + gc = ReverseGC(screen); - XSetForeground(screen->display, gc, fg_pix); - XSetBackground(screen->display, gc, bg_pix); - } + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + + } else { + if (flags & (BOLD | BLINK)) + gc = NormalBoldGC(screen); + else + gc = NormalGC(screen); + + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } } #if OPT_ISO_COLORS @@ -1917,22 +1908,20 @@ * BOLD or UNDERLINE color-mode active, those will be used. */ int -extract_fg ( - unsigned color, - unsigned flags) -{ - int fg = (int)ExtractForeground(color); - - if (term->screen.colorAttrMode - || (fg == (int)ExtractBackground(color))) { - if (term->screen.colorULMode && (flags & UNDERLINE)) - fg = COLOR_UL; - if (term->screen.colorBDMode && (flags & BOLD)) - fg = COLOR_BD; - if (term->screen.colorBLMode && (flags & BLINK)) - fg = COLOR_BL; - } - return fg; +extract_fg(unsigned color, unsigned flags) +{ + int fg = (int) ExtractForeground(color); + + if (term->screen.colorAttrMode + || (fg == (int) ExtractBackground(color))) { + if (term->screen.colorULMode && (flags & UNDERLINE)) + fg = COLOR_UL; + if (term->screen.colorBDMode && (flags & BOLD)) + fg = COLOR_BD; + if (term->screen.colorBLMode && (flags & BLINK)) + fg = COLOR_BL; + } + return fg; } /* @@ -1940,18 +1929,16 @@ * If we've got INVERSE color-mode active, that will be used. */ int -extract_bg ( - unsigned color, - unsigned flags) -{ - int bg = (int)ExtractBackground(color); - - if (term->screen.colorAttrMode - || (bg == (int)ExtractForeground(color))) { - if (term->screen.colorRVMode && (flags & INVERSE)) - bg = COLOR_RV; - } - return bg; +extract_bg(unsigned color, unsigned flags) +{ + int bg = (int) ExtractBackground(color); + + if (term->screen.colorAttrMode + || (bg == (int) ExtractForeground(color))) { + if (term->screen.colorRVMode && (flags & INVERSE)) + bg = COLOR_RV; + } + return bg; } /* @@ -1964,39 +1951,40 @@ * attribute colors. */ unsigned -makeColorPair (int fg, int bg) +makeColorPair(int fg, int bg) { - unsigned my_bg = (bg >= 0) && (bg < NUM_ANSI_COLORS) ? (unsigned) bg : 0; - unsigned my_fg = (fg >= 0) && (fg < NUM_ANSI_COLORS) ? (unsigned) fg : my_bg; + unsigned my_bg = (bg >= 0) && (bg < NUM_ANSI_COLORS) ? (unsigned) bg : 0; + unsigned my_fg = (fg >= 0) && (fg < NUM_ANSI_COLORS) ? (unsigned) fg : my_bg; #if OPT_EXT_COLORS - return (my_fg << 8) | my_bg; + return (my_fg << 8) | my_bg; #else - return (my_fg << 4) | my_bg; + return (my_fg << 4) | my_bg; #endif } /* * Using the "current" SGR background, clear a rectangle. */ -void ClearCurBackground( - TScreen *screen, - int top, - int left, - unsigned height, - unsigned width) -{ - XSetWindowBackground( - screen->display, - VWindow(screen), - getXtermBackground(term->flags, term->cur_background)); - - XClearArea (screen->display, VWindow(screen), - left, top, width, height, FALSE); - - XSetWindowBackground( - screen->display, - VWindow(screen), - getXtermBackground(term->flags, MAXCOLORS)); +void +ClearCurBackground( + TScreen * screen, + int top, + int left, + unsigned height, + unsigned width) +{ + XSetWindowBackground( + screen->display, + VWindow(screen), + getXtermBackground(term->flags, term->cur_background)); + + XClearArea(screen->display, VWindow(screen), + left, top, width, height, FALSE); + + XSetWindowBackground( + screen->display, + VWindow(screen), + getXtermBackground(term->flags, MAXCOLORS)); } #endif /* OPT_ISO_COLORS */ @@ -2004,115 +1992,122 @@ /* * Returns a single 8/16-bit number for the given cell */ -unsigned getXtermCell (TScreen *screen, int row, int col) +unsigned +getXtermCell(TScreen * screen, int row, int col) { unsigned ch = SCRN_BUF_CHARS(screen, row)[col]; - if_OPT_WIDE_CHARS(screen,{ + if_OPT_WIDE_CHARS(screen, { ch |= (SCRN_BUF_WIDEC(screen, row)[col] << 8); - }) + }); return ch; } -unsigned getXtermCellComb1 (TScreen *screen, int row, int col) +unsigned +getXtermCellComb1(TScreen * screen, int row, int col) { unsigned ch = SCRN_BUF_COM1L(screen, row)[col]; ch |= (SCRN_BUF_COM1H(screen, row)[col] << 8); return ch; } - -unsigned getXtermCellComb2 (TScreen *screen, int row, int col) +unsigned +getXtermCellComb2(TScreen * screen, int row, int col) { unsigned ch = SCRN_BUF_COM2L(screen, row)[col]; ch |= (SCRN_BUF_COM2H(screen, row)[col] << 8); return ch; } - /* * Sets a single 8/16-bit number for the given cell */ -void putXtermCell (TScreen *screen, int row, int col, int ch) +void +putXtermCell(TScreen * screen, int row, int col, int ch) { SCRN_BUF_CHARS(screen, row)[col] = ch; - if_OPT_WIDE_CHARS(screen,{ + if_OPT_WIDE_CHARS(screen, { SCRN_BUF_WIDEC(screen, row)[col] = (ch >> 8); SCRN_BUF_COM1L(screen, row)[col] = 0; SCRN_BUF_COM1H(screen, row)[col] = 0; SCRN_BUF_COM2L(screen, row)[col] = 0; SCRN_BUF_COM2H(screen, row)[col] = 0; - }) + }); } /* - * Add a the combining character for the given cell + * Add a combining character for the given cell */ -void addXtermCombining (TScreen *screen, int row, int col, int ch) +void +addXtermCombining(TScreen * screen, int row, int col, unsigned ch) { if (!SCRN_BUF_COM1L(screen, row)[col] - && !SCRN_BUF_COM1H(screen, row)[col]) { - SCRN_BUF_COM1L(screen, row)[col] = ch & 0xff; - SCRN_BUF_COM1H(screen, row)[col] = ch >> 8; + && !SCRN_BUF_COM1H(screen, row)[col]) { + SCRN_BUF_COM1L(screen, row)[col] = ch & 0xff; + SCRN_BUF_COM1H(screen, row)[col] = ch >> 8; } else if (!SCRN_BUF_COM2H(screen, row)[col]) { - SCRN_BUF_COM2L(screen, row)[col] = ch & 0xff; - SCRN_BUF_COM2H(screen, row)[col] = ch >> 8; + SCRN_BUF_COM2L(screen, row)[col] = ch & 0xff; + SCRN_BUF_COM2H(screen, row)[col] = ch >> 8; } } #endif #ifdef HAVE_CONFIG_H #ifdef USE_MY_MEMMOVE -char * my_memmove(char * s1, char * s2, size_t n) +char * +my_memmove(char *s1, char *s2, size_t n) { - if (n != 0) { - if ((s1+n > s2) && (s2+n > s1)) { - static char *bfr; - static size_t length; - size_t j; - if (length < n) { - length = (n * 3) / 2; - bfr = (bfr != 0) - ? realloc(bfr, length) - : malloc(length); - if (bfr == NULL) - SysError(ERROR_MMALLOC); - } - for (j = 0; j < n; j++) - bfr[j] = s2[j]; - s2 = bfr; - } - while (n-- != 0) - s1[n] = s2[n]; + if (n != 0) { + if ((s1 + n > s2) && (s2 + n > s1)) { + static char *bfr; + static size_t length; + size_t j; + if (length < n) { + length = (n * 3) / 2; + bfr = ((bfr != 0) + ? realloc(bfr, length) + : malloc(length)); + if (bfr == NULL) + SysError(ERROR_MMALLOC); + } + for (j = 0; j < n; j++) + bfr[j] = s2[j]; + s2 = bfr; } - return s1; + while (n-- != 0) + s1[n] = s2[n]; + } + return s1; } #endif /* USE_MY_MEMMOVE */ #ifndef HAVE_STRERROR -char *my_strerror(int n) +char * +my_strerror(int n) { - extern char *sys_errlist[]; - extern int sys_nerr; - if (n > 0 && n < sys_nerr) - return sys_errlist[n]; - return "?"; + extern char *sys_errlist[]; + extern int sys_nerr; + if (n > 0 && n < sys_nerr) + return sys_errlist[n]; + return "?"; } #endif #endif -int char2lower(int ch) +int +char2lower(int ch) { - if (isascii(ch) && isupper(ch)) { /* lowercasify */ + if (isascii(ch) && isupper(ch)) { /* lowercasify */ #ifdef _tolower - ch = _tolower (ch); + ch = _tolower(ch); #else - ch = tolower (ch); + ch = tolower(ch); #endif - } - return ch; + } + return ch; } -void update_keyboard_type(void) +void +update_keyboard_type(void) { update_delete_del(); update_old_fkeys(); @@ -2122,7 +2117,8 @@ update_sun_kbd(); } -void set_keyboard_type(xtermKeyboardType type, Bool set) +void +set_keyboard_type(xtermKeyboardType type, Bool set) { xtermKeyboardType save = term->keyboard.type; @@ -2137,7 +2133,8 @@ } } -void toggle_keyboard_type(xtermKeyboardType type) +void +toggle_keyboard_type(xtermKeyboardType type) { xtermKeyboardType save = term->keyboard.type; @@ -2152,7 +2149,8 @@ } } -void init_keyboard_type(xtermKeyboardType type, Bool set) +void +init_keyboard_type(xtermKeyboardType type, Bool set) { static Bool wasSet = False; Index: xc/programs/xterm/version.h diff -u xc/programs/xterm/version.h:3.77 xc/programs/xterm/version.h:3.86 --- xc/programs/xterm/version.h:3.77 Mon Jan 7 20:40:29 2002 +++ xc/programs/xterm/version.h Tue Feb 25 18:36:55 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/version.h,v 3.77 2002/01/08 01:40:29 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/version.h,v 3.86 2003/02/25 23:36:55 dickey Exp $ */ /* * These definitions are used to build the string that's printed in response to @@ -6,5 +6,5 @@ * XFree86 to which this version of xterm has been built. The number in * parentheses is my patch number (T.Dickey). */ -#define XTERM_PATCH 165 -#define XFREE86_VERSION "XFree86 4.2.0" +#define XTERM_PATCH 174 +#define XFREE86_VERSION "XFree86 4.2.99.903" Index: xc/programs/xterm/wcwidth.c diff -u xc/programs/xterm/wcwidth.c:1.3 xc/programs/xterm/wcwidth.c:1.5 --- xc/programs/xterm/wcwidth.c:1.3 Sun Jul 29 18:08:16 2001 +++ xc/programs/xterm/wcwidth.c Sun Sep 29 20:39:06 2002 @@ -1,18 +1,70 @@ -/* $XFree86: xc/programs/xterm/wcwidth.c,v 1.3 2001/07/29 22:08:16 tsi Exp $ */ +/* $XFree86: xc/programs/xterm/wcwidth.c,v 1.5 2002/09/30 00:39:06 dickey Exp $ */ /* - * This is an implementation of wcwidth() and wcswidth() as defined in - * "The Single UNIX Specification, Version 2, The Open Group, 1997" - * <http://www.UNIX-systems.org/online.html> + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. * - * Markus Kuhn -- 2001-01-12 -- public domain + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2002-05-08 (Unicode 3.2) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ #include <wcwidth.h> -#define wcwidth my_wcwidth struct interval { - unsigned short first; - unsigned short last; + int first; + int last; }; /* auxiliary function for binary search in interval table */ @@ -36,7 +88,7 @@ } -/* The following functions define the column width of an ISO 10646 +/* The following two functions define the column width of an ISO 10646 * character as follows: * * - The null character (U+0000) has a column width of 0. @@ -55,7 +107,7 @@ * have a column width of 0. * * - Spacing characters in the East Asian Wide (W) or East Asian - * FullWidth (F) category as defined in Unicode Technical + * Full-width (F) category as defined in Unicode Technical * Report #11 have a column width of 2. * * - All remaining characters (including all printable @@ -66,11 +118,12 @@ * in ISO 10646. */ -int wcwidth(wchar_t ucs) +int mk_wcwidth(wchar_t ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated with "uniset +cat=Me +cat=Mn +cat=Cf +1160-11FF +200B c" */ static const struct interval combining[] = { - { 0x0300, 0x034E }, { 0x0360, 0x0362 }, { 0x0483, 0x0486 }, + { 0x0300, 0x034F }, { 0x0360, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 }, { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 }, @@ -98,12 +151,16 @@ { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, - { 0x1160, 0x11FF }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, - { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, { 0x18A9, 0x18A9 }, - { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x206A, 0x206F }, - { 0x20D0, 0x20E3 }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, - { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, - { 0xFFF9, 0xFFFB } + { 0x1160, 0x11FF }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, + { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, + { 0x18A9, 0x18A9 }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, + { 0x2060, 0x2063 }, { 0x206A, 0x206F }, { 0x20D0, 0x20EA }, + { 0x302A, 0x302F }, { 0x3099, 0x309A }, { 0xFB1E, 0xFB1E }, + { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, + { 0xFFF9, 0xFFFB }, { 0x1D167, 0x1D169 }, { 0x1D173, 0x1D182 }, + { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, { 0xE0001, 0xE0001 }, + { 0xE0020, 0xE007F } }; /* test for 8-bit control characters */ @@ -119,26 +176,27 @@ /* if we arrive here, ucs is not a combining or C0/C1 control character */ - return 1 + + return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ - (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a && + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) || /* CJK ... Yi */ (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ - (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */ + (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ (ucs >= 0xffe0 && ucs <= 0xffe6) || (ucs >= 0x20000 && ucs <= 0x2ffff))); } -int wcswidth(const wchar_t *pwcs, size_t n) +int mk_wcswidth(const wchar_t *pwcs, size_t n) { int w, width = 0; for (;*pwcs && n-- > 0; pwcs++) - if ((w = wcwidth(*pwcs)) < 0) + if ((w = mk_wcwidth(*pwcs)) < 0) return -1; else width += w; @@ -148,20 +206,21 @@ /* - * The following function is the same as wcwidth(), except that - * spacing characters in the East Asian Ambiguous (A) category as - * defined in Unicode Technical Report #11 have a column width of 2. - * This experimental variant might be useful for users of CJK legacy - * encodings who want to migrate to UCS. It is not otherwise - * recommended for general use. + * The following functions are the same as mk_wcwidth() and + * mk_wcwidth_cjk(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. */ -static int wcwidth_cjk(wchar_t ucs) +int mk_wcwidth_cjk(wchar_t ucs) { /* sorted list of non-overlapping intervals of East Asian Ambiguous - * characters */ + * characters, generated with "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, - { 0x00AA, 0x00AA }, { 0x00AD, 0x00AD }, { 0x00B0, 0x00B4 }, + { 0x00AA, 0x00AA }, { 0x00AD, 0x00AE }, { 0x00B0, 0x00B4 }, { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, @@ -170,46 +229,47 @@ { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, - { 0x0148, 0x014A }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, - { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD }, - { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD }, - { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, - { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F }, - { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, - { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2021 }, - { 0x2025, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, - { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x2074, 0x2074 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, - { 0x2113, 0x2113 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, - { 0x212B, 0x212B }, { 0x2154, 0x2155 }, { 0x215B, 0x215B }, - { 0x215E, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, - { 0x2190, 0x2199 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, - { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, - { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, - { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, - { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, - { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, - { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, - { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, - { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, - { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, - { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24BF }, - { 0x24D0, 0x24E9 }, { 0x2500, 0x254B }, { 0x2550, 0x2574 }, - { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, - { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, - { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, - { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, - { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, - { 0x260E, 0x260F }, { 0x261C, 0x261C }, { 0x261E, 0x261E }, - { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, - { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D }, - { 0x266F, 0x266F }, { 0x300A, 0x300B }, { 0x301A, 0x301B }, - { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD } + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x24FE }, + { 0x2500, 0x254B }, { 0x2550, 0x2573 }, { 0x2580, 0x258F }, + { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, + { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, + { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, + { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, + { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xFFFD, 0xFFFD } }; /* binary search in table of non-spacing characters */ @@ -217,16 +277,16 @@ sizeof(ambiguous) / sizeof(struct interval) - 1)) return 2; - return wcwidth(ucs); + return mk_wcwidth(ucs); } -int wcswidth_cjk(const wchar_t *pwcs, size_t n) +int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) { int w, width = 0; for (;*pwcs && n-- > 0; pwcs++) - if ((w = wcwidth_cjk(*pwcs)) < 0) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) return -1; else width += w; Index: xc/programs/xterm/wcwidth.h diff -u xc/programs/xterm/wcwidth.h:1.2 xc/programs/xterm/wcwidth.h:1.4 --- xc/programs/xterm/wcwidth.h:1.2 Mon Jun 18 15:09:27 2001 +++ xc/programs/xterm/wcwidth.h Sun Sep 29 20:39:07 2002 @@ -1,12 +1,15 @@ -/* $XFree86: xc/programs/xterm/wcwidth.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/wcwidth.h,v 1.4 2002/09/30 00:39:07 dickey Exp $ */ #ifndef included_wcwidth_h #define included_wcwidth_h 1 #include <stddef.h> -extern int my_wcwidth(wchar_t ucs); -extern int wcswidth(const wchar_t *pwcs, size_t n); -extern int wcswidth_cjk(const wchar_t *pwcs, size_t n); +extern int mk_wcswidth(const wchar_t * pwcs, size_t n); +extern int mk_wcswidth_cjk(const wchar_t * pwcs, size_t n); +extern int mk_wcwidth(wchar_t ucs); +extern int mk_wcwidth_cjk(wchar_t ucs); +extern int wcswidth(const wchar_t * pwcs, size_t n); +extern int wcswidth_cjk(const wchar_t * pwcs, size_t n); #endif /* included_wcwidth_h */ Index: xc/programs/xterm/xcharmouse.h diff -u xc/programs/xterm/xcharmouse.h:1.2 xc/programs/xterm/xcharmouse.h:1.3 --- xc/programs/xterm/xcharmouse.h:1.2 Mon Sep 27 02:30:23 1999 +++ xc/programs/xterm/xcharmouse.h Sat Aug 24 14:54:39 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/xcharmouse.h,v 1.2 1999/09/27 06:30:23 dawes Exp $ + * $XFree86: xc/programs/xterm/xcharmouse.h,v 1.3 2002/08/24 18:54:39 dickey Exp $ */ /************************************************************ @@ -27,13 +27,14 @@ ********************************************************/ - #ifndef included_xcharmouse_h #define included_xcharmouse_h /* * Macros for dpmodes * J. Bacon, acadix@execpc.com, June 1998 + * Steve Wall, September 1999 + * Ilya Zakharevich, August 2002 */ /* DECSET arguments for turning on mouse reporting modes */ @@ -43,6 +44,13 @@ #define SET_BTN_EVENT_MOUSE 1002 #define SET_ANY_EVENT_MOUSE 1003 +#define SET_BUTTON1_MOVE_POINT 2001 /* click1 emit Esc seq to move point*/ +#define SET_BUTTON2_MOVE_POINT 2002 /* press2 emit Esc seq to move point*/ +#define SET_DBUTTON3_DELETE 2003 /* Double click-3 deletes */ +#define SET_PASTE_IN_BRACKET 2004 /* Surround paste by escapes */ +#define SET_PASTE_QUOTE 2005 /* Quote each char during paste */ +#define SET_PASTE_LITERAL_NL 2006 /* Paste "\n" as C-j */ + #if OPT_DEC_LOCATOR /* Bit fields for screen->locator_events */ @@ -52,17 +60,17 @@ /* Special values for screen->loc_filter_* */ #define LOC_FILTER_POS -1 -#endif /* OPT_DEC_LOCATOR */ +#endif /* OPT_DEC_LOCATOR */ /* Values for screen->send_mouse_pos */ enum { - MOUSE_OFF - , X10_MOUSE - , VT200_MOUSE - , VT200_HIGHLIGHT_MOUSE - , BTN_EVENT_MOUSE - , ANY_EVENT_MOUSE - , DEC_LOCATOR + MOUSE_OFF + ,X10_MOUSE + ,VT200_MOUSE + ,VT200_HIGHLIGHT_MOUSE + ,BTN_EVENT_MOUSE + ,ANY_EVENT_MOUSE + ,DEC_LOCATOR }; #endif /* included_xcharmouse_h */ Index: xc/programs/xterm/xstrings.c diff -u xc/programs/xterm/xstrings.c:1.2 xc/programs/xterm/xstrings.c:1.5 --- xc/programs/xterm/xstrings.c:1.2 Mon Jun 18 15:09:27 2001 +++ xc/programs/xterm/xstrings.c Sat Aug 17 15:52:27 2002 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/xterm/xstrings.c,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/xstrings.c,v 1.5 2002/08/17 19:52:27 dickey Exp $ */ /************************************************************ -Copyright 2000,2001 by Thomas E. Dickey +Copyright 2000-2001,2002 by Thomas E. Dickey All Rights Reserved @@ -36,6 +36,7 @@ #include <sys/types.h> #include <string.h> +#include <ctype.h> #include <xstrings.h> @@ -45,27 +46,46 @@ char *cp; cp = strrchr(name, '/'); -#ifdef __EMX__ +#ifdef __UNIXOS2__ if (cp == 0) cp = strrchr(name, '\\'); #endif return (cp ? cp + 1 : name); } +int +x_strcasecmp(const char *s1, const char *s2) +{ + unsigned len = strlen(s1); + + if (len != strlen(s2)) + return 1; + + while (len-- != 0) { + if (toupper(*s1) != toupper(*s2)) + return 1; + s1++, s2++; + } + + return 0; +} + /* * Allocates a copy of a string */ char * -x_strdup(char *s) +x_strdup(const char *s) { + char *result = 0; + if (s != 0) { char *t = malloc(strlen(s) + 1); if (t != 0) { strcpy(t, s); } - s = t; + result = t; } - return s; + return result; } /* @@ -84,4 +104,39 @@ s1 = ++s3; } return (NULL); +} + +/* + * Trims leading/trailing spaces from the string, returns a copy of it if it + * is modified. + */ +char * +x_strtrim(char *s) +{ + char *base = s; + char *d; + + if (s != 0 && *s != '\0') { + char *t = x_strdup(base); + s = t; + d = s; + while (isspace(*s)) { + ++s; + } + while ((*d++ = *s++) != '\0') { + ; + } + if (*t != '\0') { + s = t + strlen(t); + while (s != t && isspace(s[-1])) { + *--s = '\0'; + } + } + if (!strcmp(t, base)) { + free(t); + } else { + base = t; + } + } + return base; } Index: xc/programs/xterm/xstrings.h diff -u xc/programs/xterm/xstrings.h:1.2 xc/programs/xterm/xstrings.h:1.4 --- xc/programs/xterm/xstrings.h:1.2 Mon Jun 18 15:09:27 2001 +++ xc/programs/xterm/xstrings.h Sat Aug 17 15:52:27 2002 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/xterm/xstrings.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/xstrings.h,v 1.4 2002/08/17 19:52:27 dickey Exp $ */ /************************************************************ -Copyright 2000,2001 by Thomas E. Dickey +Copyright 2000-2001,2002 by Thomas E. Dickey All Rights Reserved @@ -36,7 +36,9 @@ #define included_xstrings_h 1 extern char *x_basename(char *name); -extern char * x_strdup(char *s); +extern char *x_strdup(const char *s); extern char *x_strindex(char *s1, char *s2); +extern char *x_strtrim(char *s); +extern int x_strcasecmp(const char *s1, const char *s2); #endif /* included_xstrings_h */ Index: xc/programs/xterm/xterm.dat diff -u xc/programs/xterm/xterm.dat:1.3 xc/programs/xterm/xterm.dat:1.4 --- xc/programs/xterm/xterm.dat:1.3 Sat Dec 30 14:15:47 2000 +++ xc/programs/xterm/xterm.dat Sun Sep 29 20:39:07 2002 @@ -1,11 +1,14 @@ -! $XFree86: xc/programs/xterm/xterm.dat,v 1.3 2000/12/30 19:15:47 dickey Exp $ +! $XFree86: xc/programs/xterm/xterm.dat,v 1.4 2002/09/30 00:39:07 dickey Exp $ ! *title: Xterm *iconName: Xterm *c132: TRUE *scrollBar: on *saveLines: 1000 -XTerm.JoinSession:False + +! This is nonsense: if the xterm has no session management capabilities, +! it is useless, and if it does, it is harmful. +!XTerm.JoinSession:False ! turn off NumLock support - there is some conflict or problem on VMS *numLock: false Index: xc/programs/xterm/xterm.h diff -u xc/programs/xterm/xterm.h:3.78 xc/programs/xterm/xterm.h:3.87 --- xc/programs/xterm/xterm.h:3.78 Mon Jan 7 16:02:44 2002 +++ xc/programs/xterm/xterm.h Tue Feb 25 18:36:55 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/xterm.h,v 3.78 2002/01/07 21:02:44 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/xterm.h,v 3.87 2003/02/25 23:36:55 dickey Exp $ */ /************************************************************ @@ -46,13 +46,19 @@ #endif #ifndef GCC_UNUSED -#define GCC_UNUSED /* nothing */ +#define GCC_UNUSED /* nothing */ #endif +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + #include <X11/Xos.h> #ifndef HAVE_CONFIG_H +#define HAVE_LIB_XAW 1 + #ifdef CSRG_BASED /* Get definition of BSD */ #include <sys/param.h> @@ -84,7 +90,7 @@ #endif #if defined(hpux) && !defined(__hpux) -#define __hpux 1 /* HPUX 11.0 does not define this */ +#define __hpux 1 /* HPUX 11.0 does not define this */ #endif #ifdef USE_POSIX_TERMIOS @@ -92,7 +98,7 @@ #define HAVE_TCGETATTR 1 #endif -#if defined(__EMX__) || defined(__CYGWIN__) || defined(SCO) || defined(sco) +#if defined(__UNIXOS2__) || defined(SCO) || defined(sco) #define USE_TERMCAP 1 #endif @@ -127,7 +133,7 @@ #define USE_LASTLOG #endif -#if defined(AMOEBA) || defined(SCO) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(__QNX__) || defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || defined(__CYGWIN__) +#if defined(SCO) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(__QNX__) || defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || defined(__CYGWIN__) #define USE_POSIX_WAIT #endif @@ -206,6 +212,10 @@ #undef HAVE_WAITPID #endif +#ifndef OPT_WIDE_CHARS +#define OPT_WIDE_CHARS 0 +#endif + #if OPT_WIDE_CHARS #define HIDDEN_HI 0xff #define HIDDEN_LO 0xff @@ -244,7 +254,7 @@ #include <sys/types.h> #if defined(USE_XPOLL_H) && defined(AIXV3) && defined(NFDBITS) -#undef NFDBITS /* conflict between X11/Xpoll.h and sys/select.h */ +#undef NFDBITS /* conflict between X11/Xpoll.h and sys/select.h */ #endif #include <sys/select.h> @@ -256,6 +266,7 @@ /***====================================================================***/ #define XtNallowSendEvents "allowSendEvents" +#define XtNallowWindowOps "allowWindowOps" #define XtNalwaysHighlight "alwaysHighlight" #define XtNalwaysUseMods "alwaysUseMods" #define XtNanswerbackString "answerbackString" @@ -272,6 +283,7 @@ #define XtNc132 "c132" #define XtNcacheDoublesize "cacheDoublesize" #define XtNcharClass "charClass" +#define XtNcjkWidth "cjkWidth" #define XtNcolorAttrMode "colorAttrMode" #define XtNcolorBDMode "colorBDMode" #define XtNcolorBLMode "colorBLMode" @@ -306,6 +318,8 @@ #define XtNjumpScroll "jumpScroll" #define XtNkeyboardDialect "keyboardDialect" #define XtNlimitResize "limitResize" +#define XtNlocale "locale" +#define XtNlocaleFilter "localeFilter" #define XtNlogFile "logFile" #define XtNlogInhibit "logInhibit" #define XtNlogging "logging" @@ -314,6 +328,7 @@ #define XtNmenuBar "menuBar" #define XtNmenuHeight "menuHeight" #define XtNmetaSendsEscape "metaSendsEscape" +#define XtNmodifyCursorKeys "modifyCursorKeys" #define XtNmultiClickTime "multiClickTime" #define XtNmultiScroll "multiScroll" #define XtNnMarginBell "nMarginBell" @@ -349,7 +364,9 @@ #define XtNtrimSelection "trimSelection" #define XtNunderLine "underLine" #define XtNutf8 "utf8" +#define XtNveryBoldColors "veryBoldColors" #define XtNvisualBell "visualBell" +#define XtNvt100Graphics "vt100Graphics" #define XtNwideBoldFont "wideBoldFont" #define XtNwideChars "wideChars" #define XtNwideFont "wideFont" @@ -360,6 +377,7 @@ #define XtNxmcMoveSGR "xmcMoveSGR" #define XtCAllowSendEvents "AllowSendEvents" +#define XtCAllowWindowOps "AllowWindowOps" #define XtCAlwaysHighlight "AlwaysHighlight" #define XtCAlwaysUseMods "AlwaysUseMods" #define XtCAnswerbackString "AnswerbackString" @@ -375,6 +393,7 @@ #define XtCC132 "C132" #define XtCCacheDoublesize "CacheDoublesize" #define XtCCharClass "CharClass" +#define XtCCjkWidth "CjkWidth" #define XtCColorMode "ColorMode" #define XtCColumn "Column" #define XtCCtrlFKeys "CtrlFKeys" @@ -400,6 +419,8 @@ #define XtCJumpScroll "JumpScroll" #define XtCKeyboardDialect "KeyboardDialect" #define XtCLimitResize "LimitResize" +#define XtCLocale "Locale" +#define XtCLocaleFilter "LocaleFilter" #define XtCLogInhibit "LogInhibit" #define XtCLogfile "Logfile" #define XtCLogging "Logging" @@ -408,6 +429,7 @@ #define XtCMenuBar "MenuBar" #define XtCMenuHeight "MenuHeight" #define XtCMetaSendsEscape "MetaSendsEscape" +#define XtCModifyCursorKeys "ModifyCursorKeys" #define XtCMultiClickTime "MultiClickTime" #define XtCMultiScroll "MultiScroll" #define XtCNumLock "NumLock" @@ -437,6 +459,7 @@ #define XtCTrimSelection "TrimSelection" #define XtCUnderLine "UnderLine" #define XtCUtf8 "Utf8" +#define XtCVT100Graphics "VT100Graphics" #define XtCVisualBell "VisualBell" #define XtCWideBoldFont "WideBoldFont" #define XtCWideChars "WideChars" @@ -447,7 +470,7 @@ #define XtCXmcInline "XmcInline" #define XtCXmcMoveSGR "XmcMoveSGR" -#ifdef NO_ACTIVE_ICON +#if defined(NO_ACTIVE_ICON) && !defined(XtNgeometry) #define XtNgeometry "geometry" #define XtCGeometry "Geometry" #endif @@ -464,7 +487,7 @@ /***====================================================================***/ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -498,6 +521,7 @@ extern void HandleSelectSet PROTO_XT_ACTIONS_ARGS; extern void HandleSelectStart PROTO_XT_ACTIONS_ARGS; extern void HandleStartExtend PROTO_XT_ACTIONS_ARGS; +extern void ReadLineButton PROTO_XT_ACTIONS_ARGS; extern void ResizeSelection (TScreen *screen, int rows, int cols); extern void ScrollSelection (TScreen* screen, int amount); extern void TrackMouse (int func, int startrow, int startcol, int firstrow, int lastrow); @@ -588,12 +612,13 @@ #endif /* main.c */ -#ifndef __EMX__ -extern int main (int argc, char **argv); +#ifndef __UNIXOS2__ +#define ENVP_ARG /**/ #else -extern int main (int argc, char **argv,char **envp); +#define ENVP_ARG , char **envp #endif +extern int main (int argc, char **argv ENVP_ARG); extern int GetBytesAvailable (int fd); extern int kill_process_group (int pid, int sig); extern int nonblocking_wait (void); @@ -603,12 +628,19 @@ extern SIGNAL_T Exit (int n); #endif +#if OPT_WIDE_CHARS +extern int (*my_wcwidth)(wchar_t); +#endif + /* menu.c */ extern void do_hangup PROTO_XT_CALLBACK_ARGS; extern void show_8bit_control (Bool value); /* misc.c */ extern Cursor make_colored_cursor (unsigned cursorindex, unsigned long fg, unsigned long bg); +extern OptionHelp * sortedOpts(OptionHelp *, XrmOptionDescRec *, Cardinal); +extern Window WMFrameWindow(XtermWidget termw); +extern XrmOptionDescRec * sortedOptDescs(XrmOptionDescRec *, Cardinal); extern char *SysErrorMsg (int n); extern char *udk_lookup (int keycode, int *len); extern int XStrCmp (char *s1, char *s2); @@ -621,7 +653,6 @@ extern void Changename (char *name); extern void Changetitle (char *name); extern void Cleanup (int code); -extern void Error (int i); extern void HandleBellPropertyChange PROTO_XT_EV_HANDLER_ARGS; extern void HandleEightBitKeyPressed PROTO_XT_ACTIONS_ARGS; extern void HandleEnterWindow PROTO_XT_EV_HANDLER_ARGS; @@ -633,7 +664,7 @@ extern void Panic (char *s, int a); extern void Redraw (void); extern void ReverseOldColors (void); -extern void SysError (int i); +extern void SysError (int i) GCC_NORETURN; extern void VisualBell (void); extern void do_dcs (Char *buf, size_t len); extern void do_osc (Char *buf, int len, int final); @@ -669,7 +700,9 @@ #endif /* print.c */ +extern Boolean xtermHasPrinter (void); extern int xtermPrinterControl (int chr); +extern void setPrinterControlMode (int mode); extern void xtermAutoPrint (int chr); extern void xtermMediaControl (int param, int private_seq); extern void xtermPrintScreen (Boolean use_DECPEX); @@ -733,7 +766,7 @@ extern void TabClear (Tabs tabs, int col); extern void TabReset (Tabs tabs); extern void TabSet (Tabs tabs, int col); -extern void TabZonk (Tabs tabs); +extern void TabZonk (Tabs tabs); /* util.c */ extern GC updatedXtermGC (TScreen *screen, int flags, int fg_bg, Bool hilite); @@ -802,6 +835,19 @@ #define ExtractBackground(color) (color & 0xf) #endif +#define checkVeryBoldAttr(flags, fg, code, attr) \ + if ((flags & FG_COLOR) != 0 \ + && (screen->veryBoldColors & attr) == 0 \ + && (flags & attr) != 0 \ + && (fg == code)) \ + flags &= ~(attr) + +#define checkVeryBoldColors(flags, fg) \ + checkVeryBoldAttr(flags, fg, COLOR_RV, INVERSE); \ + checkVeryBoldAttr(flags, fg, COLOR_UL, UNDERLINE); \ + checkVeryBoldAttr(flags, fg, COLOR_BD, BOLD); \ + checkVeryBoldAttr(flags, fg, COLOR_BL, BLINK) + #else /* !OPT_ISO_COLORS */ #define ClearCurBackground(screen, top, left, height, width) \ @@ -817,6 +863,8 @@ #define makeColorPair(fg, bg) 0 #define xtermColorPair() 0 +#define checkVeryBoldColors(flags, fg) /* nothing */ + #endif /* OPT_ISO_COLORS */ #if OPT_DEC_CHRSET @@ -832,7 +880,7 @@ extern unsigned getXtermCell (TScreen *screen, int row, int col); extern unsigned getXtermCellComb1 (TScreen *screen, int row, int col); extern unsigned getXtermCellComb2 (TScreen *screen, int row, int col); -extern void addXtermCombining (TScreen *screen, int row, int col, int ch); +extern void addXtermCombining (TScreen *screen, int row, int col, unsigned ch); extern void putXtermCell (TScreen *screen, int row, int col, int ch); #else #define getXtermCell(screen,row,col) SCRN_BUF_CHARS(screen, row)[col] @@ -851,7 +899,7 @@ #define visual_width(a, b) (b) #endif -#ifdef __cplusplus +#ifdef __cplusplus } #endif Index: xc/programs/xterm/xterm.log.html diff -u xc/programs/xterm/xterm.log.html:1.79 xc/programs/xterm/xterm.log.html:1.92 --- xc/programs/xterm/xterm.log.html:1.79 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/xterm.log.html Tue Feb 25 18:36:55 2003 @@ -1,7 +1,7 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- ***************************************************************************** - * Copyright 1996,1997,1998,1999,2000,2001,2002 by Thomas E. Dickey * + * Copyright 1996-2002,2003 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * @@ -20,16 +20,17 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ***************************************************************************** - $XFree86: xc/programs/xterm/xterm.log.html,v 1.79 2002/01/05 22:05:03 dickey Exp $ + $XFree86: xc/programs/xterm/xterm.log.html,v 1.92 2003/02/25 23:36:55 dickey Exp $ --> <HTML> <HEAD> <TITLE>XTERM - Change Log +
-Copyright 1997,1998,1999,2000,2001 by Thomas E. Dickey

Contents

@@ -42,6 +43,15 @@ xc/programs/Xserver/hw/xfree86). +

Patch #174 - 2003/2/25 - XFree86 4.2.99.903

+
    +
  • work-around for XFree86 bug which made XDefineCursor() + on a shell-window no longer work. The tek4014 emulation used this. + Use the next lower window (report by Karl Rudolf Bauchspiess). + +
  • add a resource setting to control whether the extended window + operations should be allowed, e.g., resize, iconify, report + window attributes. This is to accommodate people who are not + capable of using a pager to view log-files. +
+ +

Patch #173 - 2003/2/6 - XFree86 4.2.99.902

+
    +
  • reset mouse mode to normal on a full reset. This does not apply + to mouse hilite tracking mode, of course (see ctlseqs.ms). + +
  • add a time-delay at the point where mouse hilite tracking mode + choses to not handle X events, to avoid runaway CPU usage + (report by D Hugh Redelmeier). + +
  • check for illegal character in DECUDK string, quit if detected. +
+ +

Patch #172 - 2002/12/27 - XFree86 4.2.99.3

+
    +
  • fixes to make repainting of 256-color example work properly + (reports by Abigail Brady and Scott A Crosby). +
      +
    • set flag in AllocateAnsiColor() to ensure the color + is allocated once only. +
    • fix check in ScrnRefresh, which was comparing + background colors only if the ANSI foreground colors also were set. +
    + +
  • merge Error() calls and some exit() calls + into SysError(), and change that to add the brief + explanation for each error code which is provided in the manpage. + Change a few SysError(), calls to avoid using code 1, to + avoid confusion with exit status from places that do not use + SysError(). + +
  • simplify logic used to open a debug logfile as the standard error. + +
  • modify the -e option so that if it fails, xterm will + check if only one argument follows, e.g., it was quoted, and then + retry using sh -c. + +
  • modify parsing of DECUDK string parameter to allow a comma between + pairs of hexadecimal digits (Ray Neuman <raymond@one.com.au> + reports that "real" terminals accept this; perhaps they simply + ignore unexpected characters). + +
  • fix a few problems with the $TERMCAP string generated + by resize: +
      +
    • for Bourne shell, add an export command. + This was missing as far back as X11R5. +
    • escape exclamation marks, used in xterm's reset string. +
    • translate literal \177\ to "^?". +
    + +
  • improve configure check for tgetent() to work when + $TERMCAP has been set to a specific entry. + +
  • modify minstall.sh to use "%" rather than "@", + to avoid problems with AFS (report by Zdenek Sekera). + +
  • list fatal error codes from error.h in the manpage, + remove unused codes in error.h. + +
  • use more explicit wording for manpage list of color resources, + since at least one user confused the generic names such as "black" + with the names in rgb.txt (the latter are now used). + +
  • minor fix to description of 1003 mouse mode in ctlseqs.ms + (Larry Riedel). +
+ +

Patch #171 - 2002/12/12 - XFree86 4.2.99.3

+
    +
  • modify parser tables to improve detection of malformed control + sequences, making xterm behave more like a real DEC terminal + (patch by Paul Williams). + +
  • update comment in input.c to document + Meta as a modifier for escape sequences (patch by D + Roland Walker). + +
  • add ifdef'd code for logging option which adds the hostname and a + timestamp to the generated logfile name. The ifdef's are setup + with the configure script (patch by Nelson Beebe). + +
  • remove xevents() call from the end of + BlinkCursor(), to fix an occasional problem + which caused xterm to pause until a key was pressed. + The reason for this was that there was no check to ensure that + there really were events for xevents() to process. + (patch by Semen A Ustimenko <semenu@FreeBSD.org>). + +
  • remove unused mode-params from open() calls that do + not create a file. + +
  • modify configure script to put new items first on + $CPPFLAGS and $CFLAGS to avoid conflict + with environment's -I and -D options. + +
  • update config.guess, config.sub + +
  • resync with XFree86 CVS: +
      +
    • fix va_args glitches for xterm/libfontconfig: 0 == (void*)0 + isn't true for all platforms (Egbert Eich). +
    • initialise ProgramName in xterm's main before referencing it + (#5473, Peter Valchev). +
    • some cleanup of Imakefile ifdef's (Marc La France). +
    +
+ +

Patch #170 - 2002/10/13 - XFree86 4.2.1

+
    +
  • correct an off-by-one allocating data for sorted help message. + +
  • modify configure script to check for Xpm library, on which XFree86 + Xaw library depends. + +
  • update config.guess, config.sub +
+ +

Patch #169 - 2002/10/5 - XFree86 4.2.1

+
    +
  • modify wording of some options in help message to make them use + -/+ consistently with respect to "on/off" or "off/on". + +
  • sort options list which is displayed in help- and syntax-messages + at runtime to simplify maintenance. + +
  • remove support for Amoeba and Minix (Juliusz Chroboczek noted it + was removed from XFree86 server; there have been no users since + 1996). + +
  • add configure script option --disable-session-mgt + to control whether the session management code should be compiled-in + (request by H Merijn Brand). + +
  • ifdef'd the session-management changes with + OPT_SESSION_MGT, to accommodate X11R5 which predates + the related definitions. + +
  • fix decode_keyvalue(), which did not properly parse + multiple settings as needed for the ttyModes resource, + since it did not skip over the parsed data. + +
  • fix an option-parsing conflict between -class and + -cjk_width (Nam SungHyun) + +
  • add a missing null in XtVaSetValues() call used in + Cleanup() (Nam SungHyun) +
+ +

Patch #168 - 2002/9/29 - XFree86 4.2.1

+
    +
  • improve data reported for control sequence that requests window + position by taking into account the window decorations, e.g., + border and title (patch by Jess Thrysoee <jess@thrysoee.dk>). + +
  • add -cjk_width and corresponding resource + cjkWidth (patch by Jungshik Shin + <jshin@mailaps.org>). + +
  • add -into option, for embedding xterm in a Tcl/Tk + application (patch by George Peter Staplin <georgeps@xmission.com>). + +
  • add simple session management (XSM) client capabilities to xterm. + So a session manager such as, e.g., xsm, should be able to respawn or + kill xterms without the help of an SM proxy (like smproxy), which is + a hack and almost always buggy (patch by David Madore). + +
  • fix conflict between ifdef's for OPT_DEC_LOCATOR and + OPT_READLINE in button.c (reported by Ilya Zakharevich). + +
  • fix for inconsistent use of struct utmp versus + struct utmpx introduced in patch #167 (patches by Paul + Gilmartin, Marc La France). + +
  • modify logic for metaSendsEscape to allow it to work + in a setup where the Meta-key is not recognized as a modifier by + the key-translations logic (from a discussion of eightBitInput + with H.J.Lu, however Vincent Lefevre reported this in January). + +
  • use null pointer values consistently, rather than literal "0", for + ending variable-length argument lists, e.g., for + execlp() (based on patch by Matthieu Herrb). + +
  • correct logic of ChangeAnsiColorRequest(), which would + do a screen repaint after replying to a request for information. + +
  • improve scripts in vttests to work with systems whose shells support + echo -n and have, as does Debian, an unrelated + print utility. + +
  • add vttests/acolors.sh to demonstrate OSC 4, which queries or + sets ANSI colors. + +
  • fixes for ctlseqs.ms (Pavel Roskin, Ilya Zakharevich). + +
  • typos in xterm manpage (Jens Schweikhardt) + +
  • remove a redundant GCC_UNUSED from InitPopup() (Nam SungHyun) +
+ +

Patch #167 - 2002/8/24 - XFree86 4.2.0

+
    +
  • correct ifdef's for USE_TERMCAP to match cygwin + configuration. + +
  • fix several places in ctlseqs.ms which had no boxes around the + literal text (report by Ilya Zakharevich). + +
  • integrated patch from Ilya Zakharevich to extend mouse support for + readline (ifdef'd with OPT_READLINE). + +
  • modify terminfo description to match default for + modifyCursorKeys resource. + +
  • add modifyCursorKeys resource to control how the + shift- and similar modifiers are used to make a cursor escape + sequence. The default makes a modified escape sequence always start + with CSI and puts the modifier as the second parameter, to avoid + confusing applications that would interpret the first parameter as a + repeat count. The original behavior can be obtained by setting the + resource to 0 (from newsgroup discussion with Stephen J Turnbull + and Jeffrey Altman). + +
  • correct missing initializations for appdefaultCursor + and appdefaultKeypad resources. + +
  • add configure option --enable-luit and ifdef'd the + luit-related code with OPT_LUIT_PROG. + +
  • integrate patch by Tomohiro KUBOTA from + http://www.xfree86.org/pipermail/i18n/2002-July/003378.html which + modifies xterm to invoke luit. + +
  • update wcwidth.c to match Markus Kuhn's 2002-05-18 version. + +
  • correct limit-checking in ComputeSelect() to handle + selections that extend off the visible area; rather + than modify the parameters to TrackText(), use + ScrollSelection() to update the highlighting limits. + (reported by Yegappan Lakshmanan and Nelson Beebe, + patch by Alexander V Lukyanov). + +
  • correct manpage description of tiXtraScroll resource + (reported by Tony Finch). + +
  • changes from OpenBSD: +
      +
    • Make xterm setgid utmp to be able to update utmp even + with root privileges revoked. +
    • If not updating utmp, revoke group privileges totally too. +
    + +
  • changes from NetBSD: +
      +
    • Check that the return value from ttyslot() is greater than 0 + before writing the utmp file. + Fixes w's "w: Stale utmp entry: <user> <tty> <pty>" errors. +
    • Use openpty() to deal with new pty naming scheme. +
    + +
  • add print-redir action and menu entry to allow user to + switch terminal in/out of printer controller mode. It appears from + the manual that a real vt220 would not switch back to normal mode, so + another mechanism is used (addresses Debian #37517). + +
  • check if printerCommand resource string is empty, use + this to allow user to disable printer function. + +
  • trim trailing blanks from resource strings. + +
  • check return value from ptsname(), which may return + null for example if someone has changed the permissions of /dev/pts + to zero (Debian #121899). + +
  • modify OS/2 version to use __UNIXOS2__ definition + rather than __EMX__, related cleanup (patch by Holger + Veit). + +
  • used modified indent 2.0 + (patch 20020428) + to reformat most of the C source files, to simplify maintenance. + +
  • fix a couple of places where there were leading tabs on + symbol-definition lines in Imakefile (Marc La France from report by + Tony Finch) + +
  • add imake variable (TraceXTerm) to allow building debug version + (Egbert Eich). +
+ +

Patch #166 - 2002/03/25 - XFree86 4.2.0

+
    +
  • correct a bug in selection: double clicking on a word which + was partly scrolled off the screen may select that text (report + by Vincent Lefevre <vincent@vinc17.org>). + +
  • implement veryBoldColors resource to control whether + the corresponding video attribute such as bold is + displayed when using colorBDMode, etc. (request by Josh + Howard <jrh@vicor-nb.com>). + +
  • define escape sequences for function keys F21-F35 (patch by Steve Wall). + +
  • change the colors for the 256-color model, making them less skewed + toward black (patch by Steve Wall). + +
  • add vt100Graphics resource + (see patch #115, + based on discussion with Glenn Maynard). + +
  • ifdef'd Xaw/Xaw3d/neXtaw includes separately to avoid potential + incompatibilities between these flavors of Athena widgets. + +
  • add configure check for XFree86 4.x Xaw library, whose geometry + management is broken, to avoid trying to use it for toolbar + configuration. + +
  • updates to configure script from vile and lynx to allow + configure.in to be compiled with autoconf 2.5x + +
  • add a check for null pointer return by ptsname() + (newsgroup posting from Mike Silva <mikesilva@lucent.com>). + +
  • fill in a few details needed to allow UTF-8 mode to switch on/off + after startup. This requires that wideChars resource be + set. (based on comments in 4 Aug 2001 by Alexey Marinichev + <lyosha@lyosha.2y.net>). + +
  • remove duplicate install rules that make directories, e.g., so installing + manpage will not create app-defaults directory. + +
  • add comment in in do_osc(), reserving cases 30 and 31 + for for Konsole (request by Stephan Binner + <Stephan.Binner@gmx.de>). + +
  • fixes for ctlseqs.ms and xterm.man + (patch by Werner LEMBERG <wl@gnu.org>). + +
  • add check for monochrome display, disabling colorMode in that + case (fixes Debian #134130). + +
  • resync with XFree86 CVS: +
      +
    • Fix some xterm build warnings on *BSD (David Dawes). +
    • Only use SA_RESTART in xterm when it's available (Frank Liu). +
    • Fix incorrect code in signal handlers in most of the clients, + xterm and xdm not done yet (Matthieu Herrb). +
    +
+

Patch #165 - 2002/01/05 - XFree86 4.1.0

  • modify uxterm script to strip encoding part from @@ -333,7 +704,8 @@

    Patch #160 - 2001/10/7 - XFree86 4.1.0

      -
    • modify logic in main.c (see patch #145) to avoid generating the +
    • modify logic in main.c + (see patch #145) to avoid generating the same identifier, for example, for /dev/tty1 and /dev/pts/1, which is used to denote an entry in the utmp file (Debian bug report #84676), A similar fix was also sent by Jerome Borsboom @@ -1589,7 +1961,8 @@ utmp exit status (reports by Dave Ellement, Jeremie Petit, Tomas Vanhala). -
    • amend treatment of ALT key (see patch #94) so that if ALT is used +
    • amend treatment of ALT key + (see patch #94) so that if ALT is used as a modifier in key translations, then no parameter will be sent in escape sequences for Sun/PC function keys (request by Dr Werner Fink). @@ -1665,7 +2038,7 @@ redirect all their messages to one particular xterm: it is more pleasant to do this with xterm resources than with explicit calls to the mesg program (patch, description by David Madore - <madore@clipper.ens.fr>). + <david.madore@ens.fr>).

    Patch #119 - 1999/10/16 - XFree86 3.9.16c

    @@ -2403,7 +2776,7 @@ providing user applications a means of determining the version of xterm for feature comparison (request by Bram Moolenaar). -
  • make xterm respond to secondary DA when the decTerminalId +
  • make xterm respond to secondary DA when the decTerminalID is set for VT100.
  • limit user-defined keys (DECUDK) to VT220-style keyboard @@ -2420,7 +2793,7 @@ reflect the actual configuration, the terminfo kdch1 string is not (request by Dirk H Hohndel <hohndel@suse.de>) -
  • improve scripts in vttest to work with newer shells that do not +
  • improve scripts in vttests to work with newer shells that do not use 'echo -n'.
  • add fonts.sh example script Index: xc/programs/xterm/xterm.man diff -u xc/programs/xterm/xterm.man:3.81 xc/programs/xterm/xterm.man:3.90 --- xc/programs/xterm/xterm.man:3.81 Sat Jan 5 17:05:03 2002 +++ xc/programs/xterm/xterm.man Tue Feb 25 18:36:56 2003 @@ -1,7 +1,7 @@ .\" $Xorg: xterm.man,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ .\" .\" -.\" Copyright 1996,1997,1998,1999,2000,2001,2002 by Thomas E. Dickey +.\" Copyright 1996-2002,2003 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -31,16 +31,16 @@ .\" .\" .\" Copyright 1989 The Open Group -.\" +.\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. -.\" +.\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -48,15 +48,15 @@ .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. -.\" +.\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xterm/xterm.man,v 3.81 2002/01/05 22:05:03 dickey Exp $ +.\" $XFree86: xc/programs/xterm/xterm.man,v 3.90 2003/02/25 23:36:56 dickey Exp $ .\" -.\" updated by Thomas E. Dickey for XFree86, July 1996. +.\" updated by Thomas E. Dickey for XFree86, July 1996 - August 2002. .TH XTERM 1 __vendorversion__ .SH NAME xterm \- terminal emulator for X @@ -66,8 +66,9 @@ .SH DESCRIPTION The \fIxterm\fP program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 (VTxxx) and Tektronix 4014 -compatible terminals for programs that can't -use the window system directly. If the underlying operating system supports +compatible terminals for programs that cannot +use the window system directly. +If the underlying operating system supports terminal resizing capabilities (for example, the SIGWINCH signal in systems derived from 4.3bsd), \fIxterm\fP will use the facilities to notify programs running in the window whenever it is resized. @@ -76,11 +77,13 @@ can edit text in one and look at graphics in the other at the same time. To maintain the correct aspect ratio (height/width), Tektronix graphics will be restricted to the largest box with a 4014's aspect ratio that will fit in -the window. This box is located in the upper left area of the window. +the window. +This box is located in the upper left area of the window. .PP Although both windows may be displayed at the same time, one of them is considered the ``active'' window for receiving keyboard input and terminal -output. This is the window that contains the text cursor. +output. +This is the window that contains the text cursor. The active window can be chosen through escape sequences, the ``VT Options'' menu in the VTxxx window, and the ``Tek Options'' menu in the 4014 window. @@ -137,7 +140,8 @@ .IR xterm ). .PP Not all of the features described in this manual are necessarily available in -this version of xterm. Some (e.g., the non-VT220 extensions) are available +this version of xterm. +Some (e.g., the non-VT220 extensions) are available only if they were compiled in, though the most commonly-used are in the default configuration. .SH "OTHER FEATURES" @@ -211,38 +215,43 @@ .B \-ah This option indicates that .I xterm -should always highlight the text cursor. By default, +should always highlight the text cursor. +By default, .I xterm will display a hollow text cursor whenever the focus is lost or the pointer leaves the window. .TP 8 -.B \+ah +.B +ah This option indicates that .I xterm should do text cursor highlighting based on focus. .TP 8 .B \-ai This option disables active icon support if that feature was compiled -into xterm. This is equivalent to setting the \fIvt100\fP resource +into xterm. +This is equivalent to setting the \fIvt100\fP resource \fBactiveIcon\fP to FALSE. .TP 8 -.B \+ai +.B +ai This option enables active icon support if that feature was compiled -into xterm. This is equivalent to setting the \fIvt100\fP resource +into xterm. +This is equivalent to setting the \fIvt100\fP resource \fBactiveIcon\fP to TRUE. .TP 8 .B \-aw -This option indicates that auto-wraparound should be allowed. This +This option indicates that auto-wraparound should be allowed. +This allows the cursor to automatically wrap to the beginning of the next line when when it is at the rightmost position of a line and text is output. .TP 8 -.B \+aw +.B +aw This option indicates that auto-wraparound should not be allowed. .TP 8 .BI \-b " number" This option specifies the size of the inner border (the distance between -the outer edge of the characters and the window border) in pixels. The +the outer edge of the characters and the window border) in pixels. +The default is 2. .TP 8 .B +bc @@ -263,7 +272,7 @@ Set the \fIvt100\fP resource \fBcolorBDMode\fR to FALSE, disabling the display of characters with bold attribute as color .TP 8 -.B "\+bdc" +.B "+bdc" Set the \fIvt100\fP resource \fBcolorBDMode\fR to TRUE, enabling the display of characters with bold attribute as color rather than bold @@ -271,13 +280,27 @@ .B "\-cb" Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to FALSE. .TP 8 -.B "\+cb" +.B "+cb" Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to TRUE. .TP 8 .B "\-cc \fIcharacterclassrange\fP:\fIvalue\fP[,...]" This sets classes indicated by the given ranges for using in selecting by -words. See the section specifying character classes. +words. +See the section specifying character classes. +.TP 8 +.B "\-cjk_width" +Set the \fBcjkWidth\fP resource to ``true''. +When turned on, characters with East Asian Ambiguous (A) category in UTR 11 +have a column width of 2. +Othrwise, they have a column width of 1. +This may be useful for some legacy CJK text +terminal-based programs assuming box drawings and others to have a column +width of 2. +The default is ``false'' .TP 8 +.B "+cjk_width" +Reset the \fBcjkWidth\fP resource. +.TP 8 .BI \-class " string" This option allows you to override \fIxterm\fP's resource class. Normally it is ``XTerm'', but @@ -286,7 +309,7 @@ .B "\-cm" This option disables recognition of ANSI color-change escape sequences. .TP 8 -.B "\+cm" +.B "+cm" This option enables recognition of ANSI color-change escape sequences. This is the same as the \fIvt100\fP resource \fBcolorMode\fP. .TP 8 @@ -294,11 +317,12 @@ This option indicates that newlines should not be cut in line-mode selections. .TP 8 -.B \+cn +.B +cn This option indicates that newlines should be cut in line-mode selections. .TP 8 .BI \-cr " color" -This option specifies the color to use for text cursor. The default is to +This option specifies the color to use for text cursor. +The default is to use the same foreground color that is used for text. .TP 8 .B \-cu @@ -313,7 +337,7 @@ .IR curses (3x) cursor motion package. .TP 8 -.B \+cu +.B +cu This option indicates that \fIxterm\fP should not work around the .IR more (1) bug mentioned above. @@ -326,16 +350,24 @@ the Tektronix emulator foreground and background colors, and highlight color. .TP 8 -.B "\+dc" +.B "+dc" This option enables the escape sequence to change dynamic colors. .TP 8 .BI \-e " program \fP[ \fIarguments \fP.\|.\|. ]\fI" This option specifies the program (and its command line arguments) to be -run in the \fIxterm\fP window. It also sets the window title and icon +run in the \fIxterm\fP window. +It also sets the window title and icon name to be the basename of the program being executed if neither \fI\-T\fP nor \fI\-n\fP are given on the command line. \fBThis must be the last option on the command line.\fP .TP 8 +.BI \-en " encoding" +This options determines the encoding on which \fIxterm\fP runs. +Encodings other than UTF-8 are supported by using \fBluit\fR. +The \fB\-lc\fR option should be used instead of \fB\-en\fR for +systems with locale support. +This corresponds to the \fBlocale\fR resource. +.TP 8 .BI \-fb " font" This option specifies a font to be used when displaying bold text. This font must be the same height and width as the normal font. @@ -353,7 +385,7 @@ This option indicates that \fIxterm\fP should compare normal and bold fonts bounding boxes to ensure they are compatible. .TP 8 -.BI \+fbb +.BI +fbb This option indicates that \fIxterm\fP should not compare normal and bold fonts bounding boxes to ensure they are compatible. .TP 8 @@ -362,7 +394,7 @@ normal and bold fonts have VT100 line-drawing characters. If any are missing, xterm will draw the characters directly. .TP 8 -.BI \+fbx +.BI +fbx This option indicates that \fIxterm\fP should assume that the normal and bold fonts have VT100 line-drawing characters. .TP 8 @@ -381,7 +413,7 @@ By default, it will attempt to use a font twice as wide as the font that will be used to draw normal text. -If no doublewidth font is found, it will improvise, by stretching +If no doublewidth font is found, it will improvise, by stretching the normal font. This corresponds to the \fBwideFont\fP resource. .TP 8 @@ -390,7 +422,7 @@ By default, it will attempt to use a font twice as wide as the font that will be used to draw bold text. -If no doublewidth font is found, it will improvise, by stretching +If no doublewidth font is found, it will improvise, by stretching the bold font. This corresponds to the \fBwideBoldFont\fP resource. .TP 8 @@ -401,14 +433,15 @@ .TP 8 .BI \-hc " color" This option specifies the color to use for the background of -selected or otherwise highlighted text. If not specified, +selected or otherwise highlighted text. +If not specified, reverse video is used. .TP 8 .BI \-hf This option indicates that HP Function Key escape codes should be generated for function keys. .TP 8 -.BI \+hf +.BI +hf This option indicates that HP Function Key escape codes should not be generated for function keys. .TP 8 @@ -418,7 +451,7 @@ It will wait until you use the window manager to destroy/kill the window, or if you use the menu entries that send a signal, e.g., HUP or KILL. .TP 8 -.BI \+hold +.BI +hold Turn off the \fBhold\fP resource, i.e., xterm will immediately destroy its window when the shell command completes. .TP 8 @@ -426,7 +459,7 @@ Turn on the \fBptyInitialErase\fP resource, i.e., use the pseudo-terminal's sense of the stty erase value. .TP 8 -.B \+ie +.B +ie Turn off the \fBptyInitialErase\fP resource, i.e., set the stty erase value using the \fBkb\fP string from the termcap entry as a reference, if available. @@ -434,35 +467,77 @@ .B \-im Turn on the \fBuseInsertMode\fP resource. .TP 8 -.B \+im +.B +im Turn off the \fBuseInsertMode\fP resource. .TP 8 +.BI \-into " windowId" +Given an X window identifier (a decimal integer), +xterm will reparent its top-level shell widget to that window. +This is used to embed xterm within other applications. +.TP 8 .B \-j -This option indicates that \fIxterm\fP should do jump scrolling. Normally, +This option indicates that \fIxterm\fP should do jump scrolling. +Normally, text is scrolled one line at a time; this option allows \fIxterm\fP to move -multiple lines at a time so that it doesn't fall as far behind. Its use is -strongly recommended since it make \fIxterm\fP much faster when scanning -through large amounts of text. The VT100 escape sequences for enabling and +multiple lines at a time so that it does not fall as far behind. +Its use is +strongly recommended since it makes \fIxterm\fP much faster when scanning +through large amounts of text. +The VT100 escape sequences for enabling and disabling smooth scroll as well as the ``VT Options'' menu can be used to turn this feature on or off. .TP 8 -.B \+j +.B +j This option indicates that \fIxterm\fP should not do jump scrolling. .TP 8 .B \-l Turn logging on. Normally logging is not supported, due to security concerns. Some versions of \fIxterm\fP may have logging enabled. +The logfile is written to the directory from which xterm is +invoked. +The filename is generated, of the form +.sp + XtermLog.\fIXXXXXX\fR +.sp +or +.sp + Xterm.log.\fIhostname.yyyy.mm.dd.hh.mm.ss.XXXXXX\fR +.sp +depending on how xterm was built. .TP 8 -.B \+l +.B +l Turn logging off. .TP 8 +.B \-lc +Turn on support of various encodings according to users' +LC_CTYPE locale setting, i.e., LC_ALL, LC_CTYPE, or LANG variables. +This is achieved by turning on UTF-8 mode and by invoking \fBluit\fR for +conversion between locale encodings and UTF-8. +(\fBluit\fR is not +invoked in UTF-8 locales.) All you need is an iso10646-1 font +regardless of your locale and encoding. +This corresponds to the \fBlocale\fR resource. +.sp +The actual list of encodings which are supported is determined by \fBluit\fR. +Consult the \fBluit\fR manual page for futher details. +.TP 8 +.B +lc +Turn off support of automatic selection of locale encodings. +Conventional 8bit mode or, in UTF-8 locales or with \-u8 option, +UTF-8 mode will be used. +.TP 8 +.BI \-lcc " path" +File name for the encoding converter from/to locale encodings +and UTF-8 which is used with \-lc option or \fBlocale\fR resource. +This corresponds to the \fBlocaleFilter\fR resource. +.TP 8 .B \-leftbar Force scrollbar to the left side of VT100 screen. This is the default, unless you have set the rightScrollBar resource. .TP 8 -.BI \-lf " filename +.BI \-lf " filename" Specify the log-filename. See the \fB\-l\fP option. .TP 8 @@ -475,55 +550,58 @@ does not provide a way to specify the command to run in the new shell. If you specify both, \fIxterm\fP uses \fB\-ls\fP. .TP 8 -.B \+ls +.B +ls This option indicates that the shell that is started should not be a login shell (i.e. it will be a normal ``subshell''). .TP 8 .B \-mb This option indicates that \fIxterm\fP should ring a margin bell when -the user types near the right end of a line. This option can be turned on +the user types near the right end of a line. +This option can be turned on and off from the ``VT Options'' menu. .TP 8 -.B \+mb +.B +mb This option indicates that margin bell should not be rung. .TP 8 -.B "\-mc milliseconds" +.BI \-mc " milliseconds" This option specifies the maximum time between multi-click selections. .TP 8 .B \-mesg Turn off the \fBmessages\fP resource, i.e., disallow write access to the terminal. .TP 8 -.B \+mesg +.B +mesg Turn on the \fBmessages\fP resource, i.e., allow write access to the terminal. .TP 8 .BI \-ms " color" -This option specifies the color to be used for the pointer cursor. The default +This option specifies the color to be used for the pointer cursor. +The default is to use the foreground color. .TP 8 .BI \-nb " number" This option specifies the number of characters from the right end of a line -at which the margin bell, if enabled, will ring. The default is 10. +at which the margin bell, if enabled, will ring. +The default is 10. .TP 8 .B "\-nul" This option disables the display of underlining. .TP 8 -.B "\+nul" +.B "+nul" This option enables the display of underlining. .TP 8 .B \-pc This option enables the PC-style use of bold colors (see boldColors resource). .TP 8 -.B \+pc +.B +pc This option disables the PC-style use of bold colors. .TP 8 .B \-pob This option indicates that the window should be raised whenever a Control-G is received. .TP 8 -.B \+pob +.B +pob This option indicates that the window should not be raised whenever a Control-G is received. .TP 8 @@ -533,17 +611,20 @@ .B "\-rvc" This option disables the display of characters with reverse attribute as color. .TP 8 -.B "\+rvc" +.B "+rvc" This option enables the display of characters with reverse attribute as color. .TP 8 .B \-rw -This option indicates that reverse-wraparound should be allowed. This allows +This option indicates that reverse-wraparound should be allowed. +This allows the cursor to back up from the leftmost column of one line to the rightmost -column of the previous line. This is very useful for editing long shell -command lines and is encouraged. This option can be turned on and off from +column of the previous line. +This is very useful for editing long shell +command lines and is encouraged. +This option can be turned on and off from the ``VT Options'' menu. .TP 8 -.B \+rw +.B +rw This option indicates that reverse-wraparound should not be allowed. .TP 8 .B \-s @@ -553,33 +634,36 @@ and is typically useful when running across a very large internet or many gateways. .TP 8 -.B \+s +.B +s This option indicates that \fIxterm\fP should scroll synchronously. .TP 8 .B \-samename -Doesn't send title and icon name change requests when the request -would have no effect: the name isn't changed. This has the advantage +Does not send title and icon name change requests when the request +would have no effect: the name is not changed. +This has the advantage of preventing flicker and the disadvantage of requiring an extra -round trip to the server to find out the previous value. In practice +round trip to the server to find out the previous value. +In practice this should never be a problem. .TP 8 -.B \+samename +.B +samename Always send title and icon name change requests. .TP 8 .B \-sb This option indicates that some number of lines that are scrolled off the top of the window should be saved and that a scrollbar should be displayed so that -those lines can be viewed. This option may be turned on and off from the +those lines can be viewed. +This option may be turned on and off from the ``VT Options'' menu. .TP 8 -.B \+sb +.B +sb This option indicates that a scrollbar should not be displayed. .TP 8 .B \-sf This option indicates that Sun Function Key escape codes should be generated for function keys. .TP 8 -.B \+sf +.B +sf This option indicates that the standard escape codes should be generated for function keys. .TP 8 @@ -588,7 +672,7 @@ reposition the screen to the bottom of the scrolling region. This option can be turned on and off from the ``VT Options'' menu. .TP 8 -.B \+si +.B +si This option indicates that output to a window should cause it to scroll to the bottom. .TP 8 @@ -598,29 +682,40 @@ cause the window to be repositioned automatically in the normal position at the bottom of the scroll region. .TP 8 -.B \+sk +.B +sk This option indicates that pressing a key while using the scrollbar should not cause the window to be repositioned. .TP 8 .BI \-sl " number" This option specifies the number of lines to save that have been scrolled -off the top of the screen. The default is 64. +off the top of the screen. +The default is 64. .TP 8 +.B \-sm +This option, corresponding to the \fIsessionMgt\fR resource, +indicates that \fIxterm\fR should +set up session manager callbacks. +.TP 8 +.B +sm +This option indicates that \fIxterm\fR should +not set up session manager callbacks. +.TP 8 .B \-sp This option indicates that Sun/PC keyboard should be assumed, providing mapping for keypad `+' to `,', and CTRL-F1 to F13, CTRL-F2 to F14, etc. .TP 8 -.B \+sp +.B +sp This option indicates that the standard escape codes should be generated for keypad and function keys. .TP 8 .B \-t This option indicates that \fIxterm\fP should start in Tektronix mode, rather -than in VT102 mode. Switching between the two windows is done using the +than in VT102 mode. +Switching between the two windows is done using the ``Options'' menus. .TP 8 -.B \+t +.B +t This option indicates that \fIxterm\fP should start in VT102 mode. .TP 8 .BI \-ti " term_id" @@ -636,37 +731,47 @@ .BI \-tm " string" This option specifies a series of terminal setting keywords followed by the characters that should be bound to those functions, similar to the \fIstty\fP -program. Allowable keywords include: intr, quit, erase, kill, eof, +program. +Allowable keywords include: intr, quit, erase, kill, eof, eol, swtch, start, stop, brk, susp, dsusp, rprnt, flush, weras, and lnext. Control characters may be specified as ^char (e.g., ^c or ^u) and ^? may be used to indicate delete (127). .TP 8 .BI \-tn " name" This option specifies the name of the terminal type to be set in the TERM -environment variable. This terminal type must exist in the \fItermcap(5)\fP +environment variable. +This terminal type must exist in the \fItermcap(5)\fP database and should have \fIli#\fP and \fIco#\fP entries. .TP 8 .B \-u8 This option sets the \fButf8\fP resource. When \fButf8\fP is set, xterm interprets incoming data as UTF-8. -This sets \fBwideChars\fP as a side-effect. +This sets \fBwideChars\fP as a side-effect, +but UTF-8 mode set by this option prevents it from being turned off. +If you must turn it on and off, use the \fBwideChars\fP resource. +Note this option and the \fButf8\fR resource are +overridden by the \-lc and \-en options and \fBlocale\fR resource. +Instead, please use ``\-lc'' option or ``locale: true'' resource +in UTF-8 locales when your operating system supports locale, +or ``\-en UTF-8'' option or ``locale: UTF-8'' resource +when your operating system does not support locale. .TP 8 -.B \+u8 +.B +u8 This option resets the \fButf8\fP resource. .TP 8 .B "\-ulc" This option disables the display of characters with underline attribute as color rather than with underlining. .TP 8 -.B "\+ulc" +.B "+ulc" This option enables the display of characters with underline attribute as color rather than with underlining. .TP 8 .B \-ut -This option indicates that \fIxterm\fP shouldn't write a record into the +This option indicates that \fIxterm\fP should not write a record into the the system \fIutmp\fP log file. .TP 8 -.B \+ut +.B +ut This option indicates that \fIxterm\fP should write a record into the system \fIutmp\fP log file. .TP 8 @@ -675,24 +780,28 @@ Instead of ringing the terminal bell whenever a Control-G is received, the window will be flashed. .TP 8 -.B \+vb +.B +vb This option indicates that a visual bell should not be used. .TP 8 .B \-wc This option sets the \fBwideChars\fP resource. When \fBwideChars\fP is set, xterm maintains internal structures for 16-bit characters. +If you do not set this resource to ``true'', +xterm will ignore the escape sequence which turns UTF-8 mode on and off. +The default is ``false''. .TP 8 -.B \+wc +.B +wc This option resets the \fBwideChars\fP resource. .TP 8 .B \-wf This option indicates that \fIxterm\fP should wait for the window to be mapped the first time before starting the subprocess so that the initial terminal -size settings and environment variables are correct. It is the application's +size settings and environment variables are correct. +It is the application's responsibility to catch subsequent terminal size changes. .TP 8 -.B \+wf +.B +wf This option indicates that \fIxterm\fP show not wait before starting the subprocess. .TP 8 @@ -706,10 +815,13 @@ (A similar feature was in x10 xterm.) .TP 8 .B \-C -This option indicates that this window should receive console output. This -is not supported on all systems. To obtain console output, you must be the +This option indicates that this window should receive console output. +This +is not supported on all systems. +To obtain console output, you must be the owner of the console device, and you must have read and write permission -for it. If you are running X under \fIxdm\fP on the console screen you may +for it. +If you are running X under \fIxdm\fP on the console screen you may need to have the session startup and reset programs explicitly change the ownership of the console device in order to get this option to work. .TP 8 @@ -732,7 +844,8 @@ .fi .PP The following command line arguments are provided for compatibility with -older versions. They may not be supported in the next release as the X +older versions. +They may not be supported in the next release as the X Toolkit provides standard options that accomplish the same task. .TP 8 .B "%\fIgeom\fP" @@ -755,7 +868,8 @@ .TP 8 .B \-r This option indicates that reverse video should be simulated by swapping -the foreground and background colors. It is equivalent to +the foreground and background colors. +It is equivalent to \fB\-rv\fP. .TP 8 .BI \-w " number" @@ -780,11 +894,13 @@ This option specifies the X server to contact; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-fg \fIcolor\fP -This option specifies the color to use for displaying text. The default is +This option specifies the color to use for displaying text. +The default is ``black.'' .TP 8 .B \-fn \fIfont\fP -This option specifies the font to be used for displaying normal text. The +This option specifies the font to be used for displaying normal text. +The default is \fIfixed\fP. .TP 8 .B \-geometry \fIgeometry\fP @@ -804,18 +920,20 @@ This option indicates that reverse video should be simulated by swapping the foreground and background colors. .TP 8 -.B \+rv +.B +rv Disable the simulation of reverse video by swapping foreground and background colors. .TP 8 .B \-title \fIstring\fP This option specifies the window title string, which may be displayed by -window managers if the user so chooses. The default title is the command +window managers if the user so chooses. +The default title is the command line specified after the \fB\-e\fP option, if any, otherwise the application name. .TP 8 .B \-xrm \fIresourcestring\fP -This option specifies a resource string to be used. This is especially +This option specifies a resource string to be used. +This is especially useful for setting resources that do not have separate command line options. .SH RESOURCES The program understands all of the core X Toolkit resource names and @@ -845,10 +963,12 @@ It is not necessarily obeyed by all window managers. .TP 8 .B "iconName (\fPclass\fB IconName)" -Specifies the icon name. The default is the application name. +Specifies the icon name. +The default is the application name. .TP 8 .B "messages (\fPclass\fB Messages)" -Specifies whether write access to the terminal is allowed initially. See +Specifies whether write access to the terminal is allowed initially. +See .BR mesg (1). The default is ``true''. .TP 8 @@ -863,12 +983,21 @@ The default is ``false''. .TP 8 .B "sameName (\fPclass\fB SameName)" -If the value of this resource is ``true'', xterm doesn't send +If the value of this resource is ``true'', xterm does not send title and icon name change requests when the request -would have no effect: the name isn't changed. This has the advantage +would have no effect: the name is not changed. +This has the advantage of preventing flicker and the disadvantage of requiring an extra -round trip to the server to find out the previous value. In practice -this should never be a problem. The default is ``true''. +round trip to the server to find out the previous value. +In practice +this should never be a problem. +The default is ``true''. +.TP 8 +.B "sessionMgt (\fPclass\fB SessionMgt)" +If the value of this resource is ``true'', +xterm sets up session manager callbacks +for \fBXtNdieCallback\fR and \fBXtNsaveCallback\fR. +The default is ``true''. .TP 8 .B "sunFunctionKeys (\fPclass\fB SunFunctionKeys)" Specifies whether or not Sun Function Key escape codes should be generated for @@ -894,7 +1023,8 @@ .TP 8 .B "ttyModes (\fPclass\fB TtyModes)" Specifies a string containing terminal setting keywords and the characters -to which they may be bound. Allowable keywords include: +to which they may be bound. +Allowable keywords include: intr, quit, erase, @@ -922,11 +1052,12 @@ the default terminal settings without having to do an \fIstty\fP every time an \fIxterm\fP is started. Note, however, that the stty program on a given host may use different -keywords; xterm's table is builtin. +keywords; \fIxterm\fR's table is builtin. .TP 8 -.B "useInsertMode (\fPclass\fB UseInsertMode) +.B "useInsertMode (\fPclass\fB UseInsertMode)" Force use of insert mode by adding appropriate entries to the TERMCAP -environment variable. This is useful if the system termcap is broken. +environment variable. +This is useful if the system termcap is broken. The default is ``false.'' .TP 8 .B "utmpInhibit (\fPclass\fB UtmpInhibit)" @@ -936,7 +1067,8 @@ .TP 8 .B "waitForMap (\fPclass\fB WaitForMap)" Specifies whether or not \fIxterm\fP should wait for the initial window map -before starting the subprocess. The default is ``false.'' +before starting the subprocess. +The default is ``false.'' .TP 8 .B "zIconBeep (\fPclass\fB ZIconBeep)" Same as \-ziconbeep command line argument. @@ -945,7 +1077,7 @@ and have "***" prepended to their icon titles. Most window managers will detect this change immediately, showing you which window has the output. -(A similar feature was in x10 xterm.) +(A similar feature was in x10 \fIxterm\fR.) .sp .PP The following resources are specified as part of the \fIvt100\fP widget (class @@ -953,32 +1085,41 @@ .TP 8 .B "activeIcon (\fPclass\fB ActiveIcon)" Specifies whether or not active icon windows are to be used when the -\fIxterm\fP window is iconified, if this feature is compiled into xterm. +\fIxterm\fP window is iconified, if this feature is compiled into \fIxterm\fR. The active icon is a miniature representation of the content of the -window and will update as the content changes. Not all window managers -necessarily support application icon windows. Some window managers -will allow you to enter keystrokes into the active icon window. The +window and will update as the content changes. +Not all window managers +necessarily support application icon windows. +Some window managers +will allow you to enter keystrokes into the active icon window. +The default is ``false.'' .TP 8 .B "allowSendEvents (\fPclass\fB AllowSendEvents)" Specifies whether or not synthetic key and button events (generated using the X protocol SendEvent request) should be interpreted or discarded. -The default is ``false'' meaning they are discarded. Note that allowing +The default is ``false'' meaning they are discarded. +Note that allowing such events creates a very large security hole. +.TP +.B "allowWindowOps (\fPclass\fB AllowWindowOps)" +Specifies whether extended window control sequences (as used in dtterm) +for should be allowed. .TP 8 .B "answerbackString (\fPclass\fB AnswerbackString)" -Specifies the string that xterm sends in response to an ENQ (control/E) +Specifies the string that \fIxterm\fR sends in response to an ENQ (control/E) character from the host. The default is a blank string, i.e., ``''. A hardware VT100 implements this feature as a setup option. .TP 8 .B "alwaysHighlight (\fPclass\fB AlwaysHighlight)" Specifies whether or not \fIxterm\fP should always display a highlighted -text cursor. By default, a hollow text cursor is displayed whenever the +text cursor. +By default, a hollow text cursor is displayed whenever the pointer moves out of the window or the window loses the input focus. .TP 8 .B "alwaysUseMods (\fPclass\fB AlwaysUseMods)" -Override the \fBnumLock\fP resource, telling xterm to use the Alt and Meta +Override the \fBnumLock\fP resource, telling \fIxterm\fR to use the Alt and Meta modifiers as to construct parameters for function key sequences even if those modifiers appear in the translations resource. .TP 8 @@ -991,11 +1132,12 @@ The default is ``false.'' .TP 8 .B "autoWrap (\fPclass\fB AutoWrap)" -Specifies whether or not auto-wraparound should be enabled. The +Specifies whether or not auto-wraparound should be enabled. +The default is ``true.'' .TP 8 .B "awaitInput (\fPclass\fB AwaitInput)" -Specifies whether or not the xterm uses a 50 millisecond timeout to +Specifies whether or not the \fIxterm\fR uses a 50 millisecond timeout to await input (i.e., to support the Xaw3d arrow scrollbar). The default is ``false.'' .TP 8 @@ -1008,12 +1150,15 @@ Pressing the control key toggles this behavior. .TP 8 .B "background (\fPclass\fB Background)" -Specifies the color to use for the background of the window. The default is +Specifies the color to use for the background of the window. +The default is ``white.'' .TP 8 .B "bellSuppressTime (\fPclass\fB BellSuppressTime)" Number of milliseconds after a bell command is sent during which additional -bells will be suppressed. Default is 200. If set non-zero, +bells will be suppressed. +Default is 200. +If set non-zero, additional bells will also be suppressed until the server reports that processing of the first bell has been completed; this feature is most useful with @@ -1042,9 +1187,11 @@ .B "brokenSelections (\fPclass\fB BrokenSelections)" If true, \fIxterm\fP in 8-bit mode will interpret .B STRING -selections as carrying text in the current locale's encoding. Normally +selections as carrying text in the current locale's encoding. +Normally .B STRING -selections carry ISO-8859-1 encoded text. Setting this resource to +selections carry ISO-8859-1 encoded text. +Setting this resource to ``true'' violates the ICCCM; it may, however, be useful for interacting with some broken X clients. The default is ``false.'' @@ -1067,20 +1214,31 @@ .TP 8 .B "cacheDoublesize (\fPclass\fB CacheDoublesize)" Specifies the maximum number of double-sized fonts which are cached by -xterm. +\fIxterm\fR. The default (8) may be too large for some X terminals with limited memory. Set this to zero to disable doublesize fonts altogether. .TP 8 .B "charClass (\fPclass\fB CharClass)" Specifies comma-separated lists of character class bindings of the form -[\fIlow\fP\-]\fIhigh\fP:\fIvalue\fP. These are used in determining which +[\fIlow\fP\-]\fIhigh\fP:\fIvalue\fP. +These are used in determining which sets of characters should be treated the same when doing cut and paste. See the section on specifying character classes. .TP 8 +.B "cjkWidth (\fPclass\fB CjkWidth)" +Specifies whether \fIxterm\fP should follow +the traditional East Asian width convention. +When turned on, characters with East Asian Ambiguous (A) category in UTR +11 have a column width of 2. +You may have to set this option to ``true'' +if you have some old East Asian terminal based programs that assume that +line-drawing characters have a column width of 2. +.TP 8 .B "curses (\fPclass\fB Curses)" Specifies whether or not the last column bug in .IR more (1) -should be worked around. See the \fB\-cu\fP option for details. +should be worked around. +See the \fB\-cu\fP option for details. The default is ``false.'' .TP 8 .B "colorAttrMode (\fPclass\fB ColorMode)" @@ -1097,22 +1255,24 @@ .TP 8 .B "colorBDMode (\fPclass\fB ColorMode)" Specifies whether characters with the bold attribute should be displayed in -color or as bold characters. Note that setting ``colorMode'' off disables +color or as bold characters. +Note that setting \fBcolorMode\fR off disables all colors, including bold. .TP 8 .B "colorBLMode (\fPclass\fB ColorMode)" Specifies whether characters with the blink attribute should be displayed in color. -Note that setting ``colorMode'' off disables all colors, including this. +Note that setting \fBcolorMode\fR off disables all colors, including this. .TP 8 .B "colorRVMode (\fPclass\fB ColorMode)" Specifies whether characters with the reverse attribute should be displayed in color. -Note that setting ``colorMode'' off disables all colors, including this. +Note that setting \fBcolorMode\fR off disables all colors, including this. .TP 8 .B "colorULMode (\fPclass\fB ColorMode)" Specifies whether characters with the underline attribute should be displayed -in color or as underlined characters. Note that setting ``colorMode'' off +in color or as underlined characters. +Note that setting \fBcolorMode\fR off disables all colors, including underlining. .TP 8 .B "color0 (\fPclass\fB Color0)" @@ -1130,8 +1290,11 @@ .B "color6 (\fPclass\fB Color6)" .TP 8 .B "color7 (\fPclass\fB Color7)" -These specify the colors for the ISO 6429 extension. The defaults are, -respectively, black, red, green, yellow, blue, magenta, cyan, and white. +These specify the colors for the ISO 6429 extension. +The defaults are, +respectively, black, red3, green3, yellow3, blue3, magenta3, cyan3, and gray90. +The default shades of color are chosen to allow the colors 8-15 +to be used as brighter versions. .TP 8 .B "color8 (\fPclass\fB Color8)" .TP 8 @@ -1149,15 +1312,17 @@ .TP 8 .B "color15 (\fPclass\fB Color15)" These specify the colors for the ISO 6429 extension if the bold attribute -is also enabled. The defaults are, respectively, black, red, green, +is also enabled. +The default resource values are, respectively, gray30, red, green, yellow, blue, magenta, cyan, and white. .TP 8 .B "color16 (\fPclass\fB Color16)" .TP 8 through .TP 8 -.B "color255 \fPclass\fB Color255)" -These specify the colors for the 256-color extension. The defaults for +.B "color255 (\fPclass\fB Color255)" +These specify the colors for the 256-color extension. +The default resource values are for colors 16 through 231 to make a 6x6x6 color cube, and colors 232 through 255 to make a grayscale ramp. .TP 8 @@ -1189,7 +1354,8 @@ The default is ``false.'' .TP 8 .B "cursorColor (\fPclass\fB CursorColor)" -Specifies the color to use for the text cursor. The default is ``black.'' +Specifies the color to use for the text cursor. +The default is ``black.'' .TP 8 .B "cursorOffTime (\fPclass\fB CursorOffTime)" Specifies the duration of the "off" part of the cursor blink cycle-time @@ -1203,7 +1369,8 @@ .TP 8 .B "highlightColor (\fPclass\fB HighlightColor)" Specifies the color to use for the background of selected or otherwise -highlighted text. If not specified, reverse video is used. +highlighted text. +If not specified, reverse video is used. .TP 8 .B "decTerminalID (\fPclass\fB DecTerminalID)" Specifies the emulation level (100=VT100, 220=VT220, etc.), used to determine @@ -1236,24 +1403,26 @@ .TP 8 .B "eightBitOutput (\fPclass\fB EightBitOutput\fP)" Specifies whether or not eight-bit characters sent from the host should be -accepted as is or stripped when printed. The default is ``true,'' +accepted as is or stripped when printed. +The default is ``true,'' which means that they are accepted as is. .TP 8 -.B "faceName" (\fPclass\fB FaceName)" +.B "faceName (\fPclass\fB FaceName)" Specify the pattern for fonts selected from the FreeType -library if support for that library was compiled into xterm. +library if support for that library was compiled into \fIxterm\fR. There is no default. If not specified, or if there is no match for both normal and bold fonts, -xterm uses the \fBfont\fP and related resources. +\fIxterm\fR uses the \fBfont\fP and related resources. .TP 8 -.B "faceSize" (\fPclass\fB FaceSize)" +.B "faceSize (\fPclass\fB FaceSize)" Specify the pointsize for fonts selected from the FreeType -library if support for that library was compiled into xterm. +library if support for that library was compiled into \fIxterm\fR. The default is ``14.'' .TP 8 .B "font (\fPclass\fB Font)" -Specifies the name of the normal font. The default is ``fixed.'' +Specifies the name of the normal font. +The default is ``fixed.'' .TP 8 .B "font1 (\fPclass\fB Font1)" Specifies the name of the first alternative font. @@ -1290,9 +1459,11 @@ The default is ``false.'' .TP 8 .B "foreground (\fPclass\fB Foreground)" -Specifies the color to use for displaying text in the window. Setting the +Specifies the color to use for displaying text in the window. +Setting the class name instead of the instance name is an easy way to have everything -that would normally appear in the text color change color. The default +that would normally appear in the text color change color. +The default is ``black.'' .TP 8 .B "freeBoldBox (\fPclass\fB Boolean)" @@ -1300,7 +1471,7 @@ normal and bold fonts are compatible. If ``false'', \fIxterm\fP compares them and will reject choices of bold fonts that do not match the size of the normal font. -The default is ``false.'' +The default is ``false'', which means that the comparison is performed. .TP 8 .B "geometry (\fPclass\fB Geometry)" Specifies the preferred size and position of the VT102 window. @@ -1311,7 +1482,7 @@ If ``true'', \fIxterm\fP highlights only the positions that contain text that can be selected. The default is ``false.'' -.PP +.sp Depending on the way your applications write to the screen, there may be trailing blanks on a line. \fIXterm\fP stores data as it is shown on the screen. @@ -1326,7 +1497,8 @@ which ignores termcap and always sends ESC F to move to the lower left corner. ``true'' causes \fIxterm\fP to interpret ESC F as a request to move to the -lower left corner of the screen. The default is ``false.'' +lower left corner of the screen. +The default is ``false.'' .TP 8 .B "i18nSelections (\fPclass\fB I18nSelections)" If false, \fIxterm\fP will never request the targets @@ -1338,24 +1510,29 @@ .TP 8 .B "iconBorderColor (\fPclass\fB BorderColor)" Specifies the border color for the active icon window if this feature -is compiled into xterm. Not all window managers will make the icon +is compiled into \fIxterm\fR. +Not all window managers will make the icon border visible. .TP 8 .B "iconBorderWidth (\fPclass\fB BorderWidth)" Specifies the border width for the active icon window if this feature -is compiled into xterm. The default is 0 (no border). Not all window +is compiled into \fIxterm\fR. +The default is 0 (no border). +Not all window managers will make the border visible. .TP 8 .B "iconFont (\fPclass\fB IconFont)" Specifies the font for the miniature active icon window, if this feature -is compiled into xterm. The default is "nil2". +is compiled into \fIxterm\fR. +The default is "nil2". .TP 8 .B "internalBorder (\fPclass\fB BorderWidth)" Specifies the number of pixels between the characters and the window border. The default is 2. .TP 8 .B "jumpScroll (\fPclass\fB JumpScroll)" -Specifies whether or not jump scroll should be used. The default is ``true.'' +Specifies whether or not jump scroll should be used. +The default is ``true.'' .TP 8 .B "keyboardDialect (\fPclass\fB KeyboardDialect)" Specifies the initial keyboard dialect, as well as the default value when @@ -1369,13 +1546,42 @@ the display dimensions. The default is ``1''. .TP 8 +.B "locale (\fPclass\fB Locale)" +Specifies how to use \fBluit\fR, an encoding converter between UTF-8 +and locale encodings. +If this is ``true'', \fIxterm\fR will use the +encoding specified by the users' LC_CTYPE locale (i.e., LC_ALL, +LC_CTYPE, or LANG variables) as far as possible. +This is realized +by always enabling UTF-8 mode and invoking \fBluit\fR in non-UTF-8 +locales. +If this is ``medium'', \fIxterm\fR will follow users' +LC_CTYPE locale only for UTF-8, east Asian, and Thai locales, +where the encodings were not supported by conventional 8bit mode +with changing fonts. +For other locales, \fIxterm\fR will use conventional 8bit mode. +If this is ``no'', \fIxterm\fR will use conventional 8bit mode +or UTF-8 mode according to \fButf8\fR resource or \-u8 option. +Any other value such as ``UTF-8'' and ``ISO8859-2'' will be assumed +to be an encoding name; \fBluit\fR will be invoked to support the encoding. +The actual list of supported encodings depends on \fBluit\fR. +The default is ``medium''. +.TP 8 +.B "localeFilter (\fPclass\fB LocaleFilter)" +Specifies the file name for the encoding converter from/to locale +encodings and UTF-8 which is used with the \fB\-lc\fR option or \fBlocale\fR resource. +The help message shown by ``xterm \-help'' lists the default value, +which depends on your system configuration. +.TP 8 .B "loginShell (\fPclass\fB LoginShell)" Specifies whether or not the shell to be run in the window should be started -as a login shell. The default is ``false.'' +as a login shell. +The default is ``false.'' .TP 8 .B "marginBell (\fPclass\fB MarginBell)" Specifies whether or not the bell should be run when the user types near the -right margin. The default is ``false.'' +right margin. +The default is ``false.'' .TP 8 .B "metaSendsEscape (\fPclass\fB MetaSendsEscape\fP)" If ``true'', Meta characters are converted into a two-character @@ -1386,9 +1592,20 @@ to the \fBeightBitInput\fP resource. The default is ``false.'' .TP 8 +.B "modifyCursorKeys (\fPclass\fB ModifyCursorKeys\fP)" +Tells how to handle the special case where +control-, shift-, alt- or meta-modifiers are used to add a parameter to +the escape sequence returned by a cursor-key. +Set it to 0 to use the old/obsolete behavior. +Set it to 1 to prefix modified sequences with CSI. +Set it to 2 to force the modifier to be the second parameter. +Set it to 3 to mark the sequence with a '>' to hint that it is private. +The default is ``2''. +.TP 8 .B "multiClickTime (\fPclass\fB MultiClickTime)" Specifies the maximum time in milliseconds between multi-click select -events. The default is 250 milliseconds. +events. +The default is 250 milliseconds. .TP 8 .B "multiScroll (\fPclass\fB MultiScroll)" Specifies whether or not scrolling should be done asynchronously. @@ -1399,7 +1616,7 @@ bell should be rung, when enabled. .TP 8 .B "numLock (\fPclass\fB NumLock)" -If ``true'', xterm checks if NumLock is used as a modifier (see \fIxmodmap\fP(1)). +If ``true'', \fIxterm\fR checks if NumLock is used as a modifier (see \fIxmodmap\fP(1)). If so, this modifier is used to simplify the logic when implementing special NumLock for the \fBsunKeyboard\fP resource. Also (when \fBsunKeyboard\fP is false), similar logic is used to find the @@ -1407,25 +1624,30 @@ The default is ``true.'' .TP 8 .B "oldXtermFKeys (\fPclass\fB OldXtermFKeys)" -If ``true'', xterm will use old-style control sequences for function keys F1 to F4, -for compatibility with X Consortium xterm. Otherwise, it uses the VT100-style +If ``true'', \fIxterm\fR will use old-style control sequences for function keys F1 to F4, +for compatibility with X Consortium \fIxterm\fR. +Otherwise, it uses the VT100-style codes for PF1 to PF4. The default is ``false.'' .TP 8 .B "pointerColor (\fPclass\fB PointerColor)" -Specifies the foreground color of the pointer. The default is +Specifies the foreground color of the pointer. +The default is ``XtDefaultForeground.'' .TP 8 .B "pointerColorBackground (\fPclass\fB PointerColorBackground)" -Specifies the background color of the pointer. The default is +Specifies the background color of the pointer. +The default is ``XtDefaultBackground.'' .TP 8 .B "pointerShape (\fPclass\fB Cursor)" -Specifies the name of the shape of the pointer. The default is ``xterm.'' +Specifies the name of the shape of the pointer. +The default is ``xterm.'' .TP 8 .B "popOnBell (\fPclass\fB PopOnBell)" Specifies whether the window whould be raised when Control-G is -received. The default is ``false.'' +received. +The default is ``false.'' .TP 8 .B "printAttributes (\fPclass\fB PrintAttributes)" Specifies whether to print graphic attributes along with the text. @@ -1438,7 +1660,7 @@ The default is ``1.'' .TP 8 .B "printerAutoClose (\fPclass\fB PrinterAutoClose)" -If ``true'', xterm will close the printer (a pipe) when the application switches +If ``true'', \fIxterm\fR will close the printer (a pipe) when the application switches the printer offline with a Media Copy command. The default is ``false.'' .TP 8 @@ -1448,6 +1670,7 @@ will open a pipe when the first MC (Media Copy) command is initiated. The default is ``lpr.'' +If the resource value is given as a blank string, the printer is disabled. .TP 8 .B "printerControlMode (\fPclass\fB PrinterControlMode)" Specifies the printer control mode. @@ -1472,22 +1695,29 @@ .TP 8 .B "resizeGravity (\fPclass\fB ResizeGravity)" Affects the behavior when the window is resized to be taller or -shorter. \fBNorthWest\fP -specifies that the top line of text on the screen stay fixed. If the window +shorter. +\fBNorthWest\fP +specifies that the top line of text on the screen stay fixed. +If the window is made shorter, lines are dropped from the bottom; if the window is -made taller, blank lines are added at the bottom. This is compatible -with the behavior in R4. \fBSouthWest\fP (the default) specifies that -the bottom line of text on the screen stay fixed. If the window is +made taller, blank lines are added at the bottom. +This is compatible +with the behavior in R4. +\fBSouthWest\fP (the default) specifies that +the bottom line of text on the screen stay fixed. +If the window is made taller, additional saved lines will be scrolled down onto the screen; if the window is made shorter, lines will be scrolled off the top of the screen, and the top saved lines will be dropped. .TP 8 .B "reverseVideo (\fPclass\fB ReverseVideo)" -Specifies whether or not reverse video should be simulated. The default is +Specifies whether or not reverse video should be simulated. +The default is ``false.'' .TP 8 .B "reverseWrap (\fPclass\fB ReverseWrap)" -Specifies whether or not reverse-wraparound should be enabled. The default is +Specifies whether or not reverse-wraparound should be enabled. +The default is ``false.'' .TP 8 .B "rightScrollBar (\fPclass\fB RightScrollBar)" @@ -1497,20 +1727,24 @@ .TP 8 .B "saveLines (\fPclass\fB SaveLines)" Specifies the number of lines to save beyond the top of the screen when a -scrollbar is turned on. The default is 64. +scrollbar is turned on. +The default is 64. .TP 8 .B "scrollBar (\fPclass\fB ScrollBar)" -Specifies whether or not the scrollbar should be displayed. The default is +Specifies whether or not the scrollbar should be displayed. +The default is ``false.'' .TP 8 .B "scrollKey (\fPclass\fB ScrollCond)" Specifies whether or not pressing a key should automatically cause the -scrollbar to go to the bottom of the scrolling region. The default is +scrollbar to go to the bottom of the scrolling region. +The default is ``false.'' .TP 8 .B "scrollLines (\fPclass\fB ScrollLines)" Specifies the number of lines that the \fIscroll-back\fP and -\fIscroll-forw\fP actions should use as a default. The default value is 1. +\fIscroll-forw\fP actions should use as a default. +The default value is 1. .TP 8 .B "scrollTtyOutput (\fPclass\fB ScrollCond)" Specifies whether or not output to the terminal should automatically cause @@ -1526,7 +1760,8 @@ .TP 8 .B "signalInhibit (\fPclass\fB SignalInhibit)" Specifies whether or not the entries in the ``Main Options'' menu for sending -signals to \fIxterm\fP should be disallowed. The default is ``false.'' +signals to \fIxterm\fP should be disallowed. +The default is ``false.'' .TP 8 .B "tekGeometry (\fPclass\fB Geometry)" Specifies the preferred size and position of the Tektronix window. @@ -1534,13 +1769,16 @@ .B "tekInhibit (\fPclass\fB TekInhibit)" Specifies whether or not the escape sequence to enter -Tektronix mode should be ignored. The default is +Tektronix mode should be ignored. +The default is ``false.'' .TP 8 .B "tekSmall (\fPclass\fB TekSmall)" Specifies whether or not the Tektronix mode window should start in its smallest -size if no explicit geometry is given. This is useful when running \fIxterm\fP -on displays with small screens. The default is ``false.'' +size if no explicit geometry is given. +This is useful when running \fIxterm\fP +on displays with small screens. +The default is ``false.'' .TP 8 .B "tekStartup (\fPclass\fB TekStartup)" Specifies whether or not \fIxterm\fP should start up in Tektronix mode. @@ -1549,7 +1787,8 @@ .B "titeInhibit (\fPclass\fB TiteInhibit)" Specifies whether or not \fIxterm\fP should remove \fIti\fP and \fIte\fP termcap entries (used to switch between alternate screens on startup of many -screen-oriented programs) from the TERMCAP string. If set, +screen-oriented programs) from the TERMCAP string. +If set, \fIxterm\fP also ignores the escape sequence to switch to the alternate screen. \fIXterm\fP supports terminfo in a different way, supporting composite control @@ -1558,8 +1797,8 @@ .TP 8 .B "tiXtraScroll (\fPclass\fB TiXtraScroll)" Specifies whether \fIxterm\fP should scroll to a new page when processing -the \fIti\fP termcap entry, i.e., the privde modes 47, 1047 or 1049. -This is only in effect if \fItiteInhibit\fP is ``false'', +the \fIti\fP termcap entry, i.e., the private modes 47, 1047 or 1049. +This is only in effect if \fItiteInhibit\fP is ``true'', because the intent of this option is to provide a picture of the full-screen application's display on the scrollback without wiping out the text that would be shown before the application was initialized. @@ -1567,7 +1806,8 @@ .TP 8 .B "translations (\fPclass\fB Translations)" Specifies the key and button bindings for menus, selections, ``programmed -strings,'' etc. See \fBACTIONS\fP below. +strings,'' etc. +See \fBACTIONS\fP below. .TP 8 .B "trimSelection (\fPclass\fB TrimSelection)" If you set \fBhighlightSelection\fP, @@ -1584,7 +1824,8 @@ .TP 8 .B "underLine (\fPclass\fB UnderLine)" This specifies whether or not text with the underline attribute should be -underlined. It may be desirable to disable underlining when color is being +underlined. +It may be desirable to disable underlining when color is being used for the underline attribute. .TP 8 .B "utf8 (\fPclass\fB Utf8)" @@ -1593,17 +1834,33 @@ When set via a resource, \fIxterm\fP cannot be switched via control sequences out of UTF-8 mode. The default is ``0'' (off). Any other value will turn on UTF-8 mode. +See the \fBlocale\fR resource for non-UTF-8 locales. +.TP 8 +.B "veryBoldColors (\fPclass\fB ColorMode)" +Specifies whether to combine video attributes with colors specified by +\fBcolorBD\fR, \fBcolorBL\fR and \fBcolorUL\fR. +The resource value is the sum of values for each attribute: +2 for underline, +4 for bold and +8 for blink. +The default is ``0.'' .TP 8 .B "visualBell (\fPclass\fB VisualBell)" -Specifies whether or not a visible bell (i.e. flashing) should be used instead -of an audible bell when Control-G is received. The default is ``false.'' +Specifies whether or not a visible bell (i.e., flashing) should be used instead +of an audible bell when Control-G is received. +The default is ``false.'' +.TP 8 +.B "vt100Graphics (\fPclass\fB VT100Graphics)" +This specifies whether \fIxterm\fP will interpret VT100 graphic character +escape sequences while in UTF-8 mode. +The default is ``true'', to provide support for various legacy applications. .TP 8 .B "wideBoldFont (\fPclass\fB WideBoldFont)" This option specifies the font to be used for displaying bold wide text. By default, it will attempt to use a font twice as wide as the font that will be used to draw bold text. -If no doublewidth font is found, it will improvise, by stretching +If no doublewidth font is found, it will improvise, by stretching the bold font. .TP 8 .B "wideChars (\fPclass\fB WideChars)" @@ -1615,7 +1872,7 @@ By default, it will attempt to use a font twice as wide as the font that will be used to draw normal text. -If no doublewidth font is found, it will improvise, by stretching +If no doublewidth font is found, it will improvise, by stretching the normal font. .TP 8 .B "ximFont (\fPclass\fB XimFont)" @@ -1668,8 +1925,11 @@ .sp .PP The resources that may be specified for the various menus are described in -the documentation for the Athena \fBSimpleMenu\fP widget. The name and classes +the documentation for the Athena \fBSimpleMenu\fP widget. +The name and classes of the entries in each of the menus are listed below. +Resources named "\fBline\fR\fIN\fR" where \fIN\fR is a number +are separators with class \fBSmeLine\fR. .PP The \fImainMenu\fP has the following entries: .TP 8 @@ -1679,17 +1939,17 @@ .B "allowsends (\fPclass\fB SmeBSB)" This entry invokes the \fBallow-send-events(toggle)\fP action. .TP 8 +.B "redraw (\fPclass\fB SmeBSB)" +This entry invokes the \fBredraw()\fP action. +.TP 8 .B "logging (\fPclass\fB SmeBSB)" This entry invokes the \fBlogging(toggle)\fP action. .TP 8 .B "print (\fPclass\fB SmeBSB)" This entry invokes the \fBprint()\fP action. -.TP 8 -.B "redraw (\fPclass\fB SmeBSB)" -This entry invokes the \fBredraw()\fP action. .TP 8 -.B "line1 (\fPclass\fB SmeLine)" -This is a separator. +.B "print-redir (\fPclass\fB SmeBSB)" +This entry invokes the \fBprint-redir()\fP action. .TP 8 .B "8-bit-control (\fPclass\fB SmeBSB)" This entry invokes the \fBset-8-bit-control(toggle)\fP action. @@ -1721,9 +1981,6 @@ .B "sunKeyboard (\fPclass\fB SmeBSB)" This entry invokes the \fBsunKeyboard(toggle)\fP action. .TP 8 -.B "line2 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "suspend (\fPclass\fB SmeBSB)" This entry invokes the \fBsend-signal(tstp)\fP action on systems that support job control. @@ -1744,9 +2001,6 @@ .B "kill (\fPclass\fB SmeBSB)" This entry invokes the \fBsend-signal(kill)\fP action. .TP 8 -.B "line3 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "quit (\fPclass\fB SmeBSB)" This entry invokes the \fBquit()\fP action. .sp @@ -1806,13 +2060,11 @@ .TP 8 .B "activeicon (\fPclass\fB SmeBSB)" This entry toggles active icons on and off if this feature was -compiled into \fIxterm\fP. It is enabled only if \fIxterm\fP +compiled into \fIxterm\fP. +It is enabled only if \fIxterm\fP was started with the command line option +ai or the \fBactiveIcon\fP resource is set to ``True.'' .TP 8 -.B "line1 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "softreset (\fPclass\fB SmeBSB)" This entry invokes the \fBsoft-reset()\fP action. .TP 8 @@ -1822,9 +2074,6 @@ .B "clearsavedlines (\fPclass\fB SmeBSB)" This entry invokes the \fBclear-saved-lines()\fP action. .TP 8 -.B "line2 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "tekshow (\fPclass\fB SmeBSB)" This entry invokes the \fBset-visibility(tek,toggle)\fP action. .TP 8 @@ -1867,9 +2116,6 @@ .B "fontsel (\fPclass\fB SmeBSB)" This entry invokes the \fBset-vt-font(s)\fP action. .TP 8 -.B "line1 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "font-linedrawing (\fPclass\fB SmeBSB)" This entry invokes the \fBset-font-linedrawing(s)\fP action. .TP 8 @@ -1891,9 +2137,6 @@ .B "tektextsmall (\fPclass\fB SmeBSB)" This entry invokes the \fBset-tek-text(s)\fP action. .TP 8 -.B "line1 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "tekpage (\fPclass\fB SmeBSB)" This entry invokes the \fBtek-page()\fP action. .TP 8 @@ -1903,9 +2146,6 @@ .B "tekcopy (\fPclass\fB SmeBSB)" This entry invokes the \fBtek-copy()\fP action. .TP 8 -.B "line2 (\fPclass\fB SmeLine)" -This is a separator. -.TP 8 .B "vtshow (\fPclass\fB SmeBSB)" This entry invokes the \fBset-visibility(vt,toggle)\fP action. .TP 8 @@ -1926,7 +2166,8 @@ Specifies the color to use for the background of the scrollbar. .TP 8 .B "foreground (\fPclass\fB Foreground)" -Specifies the color to use for the foreground of the scrollbar. The ``thumb'' +Specifies the color to use for the foreground of the scrollbar. +The ``thumb'' of the scrollbar is a simple checkerboard pattern alternating pixels for foreground and background color. .SH "POINTER USAGE" @@ -1946,8 +2187,11 @@ and releasing the button. The selected text is highlighted and is saved in the global cut buffer and made the PRIMARY selection when -the button is released. Double-clicking selects by words. Triple-clicking -selects by lines. Quadruple-clicking goes back to characters, etc. +the button is released. +Double-clicking selects by words. +Triple-clicking +selects by lines. +Quadruple-clicking goes back to characters, etc. Multiple-click is determined by the time from button up to button down, so you can change the selection unit in the middle of a selection. Logical words and lines selected by double- or triple-clicking may wrap @@ -1967,11 +2211,13 @@ you can swap ``right'' and ``left'' everywhere in the rest of this paragraph.) If pressed while closer to the right edge of the selection than the left, it extends/contracts the -right edge of the selection. If you contract the selection past +right edge of the selection. +If you contract the selection past the left edge of the selection, .I xterm assumes you really meant the left edge, restores the original selection, then -extends/contracts the left edge of the selection. Extension starts in the +extends/contracts the left edge of the selection. +Extension starts in the selection unit mode that the last selection or extension was performed in; you can multiple-click to cycle through them. @@ -2090,7 +2336,8 @@ entry in the command section clears the Tektronix window. .SH SECURITY .PP -X environments differ in their security consciousness. Most servers, run +X environments differ in their security consciousness. +Most servers, run under \fIxdm\fP, are capable of using a ``magic cookie'' authorization scheme that can provide a reasonable level of security for many people. If your server is only using a host-based mechanism to control access to @@ -2100,7 +2347,8 @@ basic services of the X protocol to snoop on your activities, potentially capturing a transcript of everything you type at the keyboard. This is of particular concern when you want to type in a password or other -sensitive data. The best solution to this problem is to use a better +sensitive data. +The best solution to this problem is to use a better authorization mechanism that host-based control, but a simple mechanism exists for protecting keyboard input in \fIxterm\fP. .PP @@ -2110,43 +2358,54 @@ When an application prompts you for a password (or other sensitive data), you can enable \fBSecure Keyboard\fP using the menu, type in the data, and then disable \fBSecure Keyboard\fP using -the menu again. Only one X client at a time can secure the keyboard, -so when you attempt to enable \fBSecure Keyboard\fP it may fail. In -this case, the bell will sound. If the \fBSecure Keyboard\fP succeeds, +the menu again. +Only one X client at a time can secure the keyboard, +so when you attempt to enable \fBSecure Keyboard\fP it may fail. +In +this case, the bell will sound. +If the \fBSecure Keyboard\fP succeeds, the foreground and background colors will be exchanged (as if you selected the \fBReverse Video\fP entry in the \fBModes\fP menu); -they will be exchanged again when you exit secure mode. If the colors +they will be exchanged again when you exit secure mode. +If the colors do \fInot\fP switch, then -you should be \fIvery\fP suspicious that you are being spoofed. If +you should be \fIvery\fP suspicious that you are being spoofed. +If the application you are running displays a prompt before asking for the password, it is safest to enter secure mode \fIbefore\fP the prompt gets displayed, and to make sure that the prompt gets displayed correctly (in the new colors), to minimize the probability of -spoofing. You can also bring up the menu again and make sure that a check +spoofing. +You can also bring up the menu again and make sure that a check mark appears next to the entry. .PP \fBSecure Keyboard\fP mode will be disabled automatically if your xterm window becomes iconified (or otherwise unmapped), or if you start up a reparenting window manager (that places a title bar or other decoration -around the window) while in \fBSecure Keyboard\fP mode. (This is a +around the window) while in \fBSecure Keyboard\fP mode. +(This is a feature of the X protocol not easily overcome.) When this happens, the foreground and background colors will be switched back and the bell will sound in warning. .SH "CHARACTER CLASSES" Clicking the middle mouse button twice in rapid succession will cause all -characters of the same class (e.g. letters, white space, punctuation) to be -selected. Since different people have different preferences for what should +characters of the same class (e.g., letters, white space, punctuation) to be +selected. +Since different people have different preferences for what should be selected (for example, should filenames be selected as a whole or only the separate subnames), the default mapping can be overridden through the use of the \fIcharClass\fP (class \fICharClass\fP) resource. .PP This resource is a series of comma-separated -of \fIrange\fP:\fIvalue\fP pairs. The +of \fIrange\fP:\fIvalue\fP pairs. +The \fIrange\fP is either a single number or \fIlow\fP-\fIhigh\fP in the range of 0 to 65535, corresponding to the code for the character or characters to be -set. The \fIvalue\fP is arbitrary, although the default table uses the -character number of the first character occurring in the set. When not in +set. +The \fIvalue\fP is arbitrary, although the default table uses the +character number of the first character occurring in the set. +When not in UTF-8 mode, only the first 256 bytes of this table will be used. .PP The default table starts as follows - @@ -2164,6 +2423,7 @@ /* CAN EM SUB ESC FS GS RS US */ 1, 1, 1, 1, 1, 1, 1, 1, /* SP ! " # $ % & ' */ +.\" " <- for emacs autocolor to work well :-) 32, 33, 34, 35, 36, 37, 38, 39, /* ( ) * + , \- . / */ 40, 41, 42, 43, 44, 45, 46, 47, @@ -2225,13 +2485,15 @@ .sp For example, the string ``33:48,37:48,45-47:48,64:48'' indicates that the exclamation mark, percent sign, dash, period, slash, and ampersand characters -should be treated the same way as characters and numbers. This is useful +should be treated the same way as characters and numbers. +This is useful for cutting and pasting electronic mailing addresses and filenames. .SH ACTIONS It is possible to rebind keys (or sequences of keys) to arbitrary strings for input, by changing the translations for the vt100 or tek4014 widgets. Changing the translations for events other than key and button events -is not expected, and will cause unpredictable behavior. The following +is not expected, and will cause unpredictable behavior. +The following actions are provided for using within the \fIvt100\fP or \fItek4014\fP \fBtranslations\fP resources: .TP 8 @@ -2275,7 +2537,8 @@ .TP 8 .B "hard-reset()" This action resets the scrolling region, tabs, window size, and cursor keys -and clears the screen. It is also invoked from the \fBhardreset\fP +and clears the screen. +It is also invoked from the \fBhardreset\fP entry in \fIvtMenu\fP. .TP 8 .B "ignore()" @@ -2295,9 +2558,12 @@ .TP 8 .B "insert-selection(\fIsourcename\fP [, ...])" This action inserts the string found in the selection or cutbuffer indicated -by \fIsourcename\fP. Sources are checked in the order given (case is -significant) until one is found. Commonly-used selections include: -\fIPRIMARY\fP, \fISECONDARY\fP, and \fICLIPBOARD\fP. Cut buffers are +by \fIsourcename\fP. +Sources are checked in the order given (case is +significant) until one is found. +Commonly-used selections include: +\fIPRIMARY\fP, \fISECONDARY\fP, and \fICLIPBOARD\fP. +Cut buffers are typically named \fICUT_BUFFER0\fP through \fICUT_BUFFER7\fP. .TP 8 .B "insert-seven-bit()" @@ -2305,8 +2571,10 @@ .TP 8 .B "interpret(\fIcontrol-sequence\fP)" Interpret the given control sequence locally, i.e., without passing it to -the host. This works by inserting the control sequence at the front -of the input buffer. Use "\\" to escape octal digits in the string. +the host. +This works by inserting the control sequence at the front +of the input buffer. +Use "\\" to escape octal digits in the string. Xt does not allow you to put a null character (i.e., "\\000") in the string. .TP 8 .B "keymap(\fIname\fP)" @@ -2325,7 +2593,8 @@ This action toggles the state of the \fBmetaSendsEscape\fP resource. .TP 8 .B "popup-menu(\fImenuname\fP)" -This action displays the specified popup menu. Valid names (case is +This action displays the specified popup menu. +Valid names (case is significant) include: \fImainMenu\fP, \fIvtMenu\fP, \fIfontMenu\fP, and \fItekMenu\fP. .TP 8 @@ -2333,8 +2602,15 @@ This action prints the window and is also invoked by the \fIprint\fP entry in \fImainMenu\fP. .TP 8 +.B "print-redir()" +This action toggles the \fBprinterControlMode\fR between 0 and 2. +The corresponding popup menu entry is useful for switching the printer +off if you happen to change your mind after deciding to print random +binary files on the terminal. +.TP 8 .B "quit()" -This action sends a SIGHUP to the subprogram and exits. It is also invoked +This action sends a SIGHUP to the subprogram and exits. +It is also invoked by the \fBquit\fP entry in \fImainMenu\fP. .TP 8 .B "redraw()" @@ -2346,7 +2622,8 @@ .TP 8 .B "scroll-back(\fIcount\fP [,\fIunits\fP [,\fImouse\fP] ])" This action scrolls the text window backward so that text that had previously -scrolled off the top of the screen is now visible. The \fIcount\fP argument +scrolled off the top of the screen is now visible. +The \fIcount\fP argument indicates the number of \fIunits\fP (which may be \fIpage\fP, \fIhalfpage\fP, \fIpixel\fP, or \fIline\fP) by which to scroll. If the third parameter \fImouse\fP is given, the action is ignored when @@ -2374,7 +2651,8 @@ cutbuffers specified by \fIdestname\fP. .TP 8 .B "select-extend()" -This action tracks the pointer and extends the selection. It +This action tracks the pointer and extends the selection. +It should only be bound to Motion events. .TP 8 .B "select-set()" @@ -2382,7 +2660,8 @@ without affecting the selection mode. .TP 8 .B "select-start()" -This action begins text selection at the current pointer location. See +This action begins text selection at the current pointer location. +See the section on \fBPOINTER USAGE\fP for information on making selections. .TP 8 .B "send-signal(\fIsigname\fP)" @@ -2396,7 +2675,8 @@ .BR terminate , and .BR kill -entries in \fImainMenu\fP. Allowable signal names are (case is +entries in \fImainMenu\fP. +Allowable signal names are (case is not significant): \fItstp\fP (if supported by the operating system), \fIsuspend\fP (same as \fItstp\fP), \fIcont\fP @@ -2442,10 +2722,6 @@ .B "set-font-doublesize(\fIon/off/toggle\fP)" This action toggles the \fBfontDoublesize\fP resource and is also invoked by the \fBfont-doublesize\fP entry in \fIfontMenu\fP. -.\" .TP 8 -.\" .B "set-font-loadable(\fIon/off/toggle\fP)" -.\" This action toggles the \fBfontLoadable\fP resource and is also invoked by -.\" the \fBfont-loadable\fP entry in \fIfontMenu\fP. .TP 8 .B "set-hp-function-keys(\fIon/off/toggle\fP)" This action toggles the \fBhpFunctionKeys\fP resource and is also invoked by @@ -2456,7 +2732,7 @@ \fBjumpscroll\fP entry in \fIvtMenu\fP. .TP 8 .B "set-font-linedrawing(\fIon/off/toggle\fP)" -This action toggles the xterm's state regarding whether the current font +This action toggles the \fIxterm\fR's state regarding whether the current font has line-drawing characters and whether it should draw them directly. It is also invoked by the \fBfont-linedrawing\fP entry in \fIfontMenu\fP. .TP 8 @@ -2513,12 +2789,14 @@ .B "set-tek-text(\fIlarge/2/3/small\fP)" This action sets font used in the Tektronix window to the value of the resources \fBtektextlarge\fP, \fBtektext2\fP, \fBtektext3\fP, and -\fBtektextsmall\fP according to the argument. It is also by the entries +\fBtektextsmall\fP according to the argument. +It is also by the entries of the same names as the resources in \fItekMenu\fP. .TP 8 .B "set-terminal-type(\fItype\fP)" This action directs output to either the \fIvt\fP or \fItek\fP windows, -according to the \fItype\fP string. It is also invoked by the +according to the \fItype\fP string. +It is also invoked by the \fBtekmode\fP entry in \fIvtMenu\fP and the \fBvtmode\fP entry in \fItekMenu\fP. .TP 8 @@ -2528,7 +2806,8 @@ .TP 8 .B "set-visibility(\fIvt/tek\fP,\fIon/off/toggle\fP)" This action controls whether or not the \fIvt\fP or \fItek\fP windows are -visible. It is also invoked from the \fBtekshow\fP and \fBvthide\fP entries +visible. +It is also invoked from the \fBtekshow\fP and \fBvthide\fP entries in \fIvtMenu\fP and the \fBvtshow\fP and \fBtekhide\fP entries in \fItekMenu\fP. .TP 8 @@ -2568,7 +2847,8 @@ .B "string(\fIstring\fP)" This action inserts the specified text string as if it had been typed. Quotation is necessary if the string contains whitespace or -non-alphanumeric characters. If the string argument begins with the +non-alphanumeric characters. +If the string argument begins with the characters ``0x'', it is interpreted as a hex character constant. .TP 8 @@ -2616,8 +2896,6 @@ The default bindings in the VT102 window are: .sp .in +4 -.DS -.TA 2.5i .ta 2.5i .nf Shift Prior:scroll-back(1,halfpage) \\n\\ @@ -2662,15 +2940,12 @@ :select-end(PRIMARY, CUT_BUFFER0) \\n\\ :bell(0) .fi -.DE .sp .in -4 .PP The default bindings in the Tektronix window are: .sp .in +4 -.DS -.TA 2.5i .ta 2.5i .nf ~Meta: insert-seven-bit() \\n\\ @@ -2690,7 +2965,6 @@ Shift ~Meta: gin-press(R) \\n\\ ~Meta: gin-press(r) .fi -.DE .sp .in -4 .PP @@ -2699,8 +2973,6 @@ .sp .in +4 .nf -.DS -.TA .5i 1.5i .ta .5i 1.5i .nf *VT100.Translations: #override F13: keymap(dbx) @@ -2711,7 +2983,6 @@ F19: string("continue") string(0x0d) \\n\\ F20: string("print ") insert-selection(PRIMARY, CUT_BUFFER0) .fi -.DE .sp .in -4 .SH "CONTROL SEQUENCES AND KEYBOARD" @@ -2775,18 +3046,243 @@ .in -10 in your .Xdefaults file to automatically turn on color in \fIxterm\fP and similar applications. -.SH "SEE ALSO" -resize(1), X(__miscmansuffix__), pty(4), tty(4) +.SH ERROR MESSAGES +Most of the fatal error messages from \fIxterm\fP use the following format: +.RS +xterm: Error \fIXXX\fP, errno \fIYYY\fP: \fIZZZ\fP +.RE +The \fIXXX\fP codes (which are used by \fIxterm\fP as its exit-code) +are listed below, with a brief explanation. +.TP 5 +1 +is used for miscellaneous errors, usually accompanied by a specific message, +.TP +11 +ERROR_FIONBIO .br -\fIXterm Control Sequences\fP -(this is the file ctlseqs.ms). -.sp -http://dickey.his.com/xterm/xterm.html +main: ioctl() failed on FIONBIO +.TP +12 +ERROR_F_GETFL +.br +main: ioctl() failed on F_GETFL +.TP +13 +ERROR_F_SETFL +.br +main: ioctl() failed on F_SETFL +.TP +14 +ERROR_OPDEVTTY +.br +spawn: open() failed on /dev/tty +.TP +15 +ERROR_TIOCGETP +.br +spawn: ioctl() failed on TIOCGETP +.TP +17 +ERROR_PTSNAME +.br +spawn: ptsname() failed +.TP +18 +ERROR_OPPTSNAME +.br +spawn: open() failed on ptsname +.TP +19 +ERROR_PTEM +.br +spawn: ioctl() failed on I_PUSH/"ptem" +.TP +20 +ERROR_CONSEM +.br +spawn: ioctl() failed on I_PUSH/"consem" +.TP +21 +ERROR_LDTERM +.br +spawn: ioctl() failed on I_PUSH/"ldterm" +.TP +22 +ERROR_TTCOMPAT +.br +spawn: ioctl() failed on I_PUSH/"ttcompat" +.TP +23 +ERROR_TIOCSETP +.br +spawn: ioctl() failed on TIOCSETP +.TP +24 +ERROR_TIOCSETC +.br +spawn: ioctl() failed on TIOCSETC +.TP +25 +ERROR_TIOCSETD +.br +spawn: ioctl() failed on TIOCSETD +.TP +26 +ERROR_TIOCSLTC +.br +spawn: ioctl() failed on TIOCSLTC +.TP +27 +ERROR_TIOCLSET +.br +spawn: ioctl() failed on TIOCLSET +.TP +28 +ERROR_INIGROUPS +.br +spawn: initgroups() failed +.TP +29 +ERROR_FORK +.br +spawn: fork() failed +.TP +30 +ERROR_EXEC +.br +spawn: exec() failed +.TP +32 +ERROR_PTYS +.br +get_pty: not enough ptys +.TP +34 +ERROR_PTY_EXEC +.br +waiting for initial map +.TP +35 +ERROR_SETUID +.br +spawn: setuid() failed +.TP +36 +ERROR_INIT +.br +spawn: can't initialize window +.TP +46 +ERROR_TIOCKSET +.br +spawn: ioctl() failed on TIOCKSET +.TP +47 +ERROR_TIOCKSETC +.br +spawn: ioctl() failed on TIOCKSETC +.TP +48 +ERROR_SPREALLOC +.br +spawn: realloc of ttydev failed +.TP +49 +ERROR_LUMALLOC +.br +luit: command-line malloc failed +.TP +50 +ERROR_SELECT +.br +in_put: select() failed +.TP +54 +ERROR_VINIT +.br +VTInit: can't initialize window +.TP +57 +ERROR_KMMALLOC1 +.br +HandleKeymapChange: malloc failed +.TP +60 +ERROR_TSELECT +.br +Tinput: select() failed +.TP +64 +ERROR_TINIT +.br +TekInit: can't initialize window +.TP +71 +ERROR_BMALLOC2 +.br +SaltTextAway: malloc() failed +.TP +80 +ERROR_LOGEXEC +.br +StartLog: exec() failed +.TP +83 +ERROR_XERROR +.br +xerror: XError event +.TP +84 +ERROR_XIOERROR +.br +xioerror: X I/O error +.TP +90 +ERROR_SCALLOC +.br +Alloc: calloc() failed on base +.TP +91 +ERROR_SCALLOC2 +.br +Alloc: calloc() failed on rows +.TP +92 +ERROR_SREALLOC +.br +ScreenResize: realloc() failed on alt base +.TP +96 +ERROR_RESIZE +.br +ScreenResize: malloc() or realloc() failed +.TP +102 +ERROR_SAVE_PTR +.br +ScrnPointers: malloc/realloc() failed +.TP +110 +ERROR_SBRALLOC +.br +ScrollBarOn: realloc() failed on base +.TP +111 +ERROR_SBRALLOC2 +.br +ScrollBarOn: realloc() failed on rows +.TP +121 +ERROR_MMALLOC +.br +my_memmove: malloc/realloc failed .SH BUGS .PP -Large pastes do not work on some systems. This is not a bug in +Large pastes do not work on some systems. +This is not a bug in \fIxterm\fP; it is a bug in the pseudo terminal driver of those -systems. \fIxterm\fP feeds large pastes to the pty only as fast as the pty +systems. +\fIxterm\fP feeds large pastes to the pty only as fast as the pty will accept data, but some pty drivers do not return enough information to know if the write has succeeded. .PP @@ -2794,12 +3290,21 @@ .I xterm starts. .PP -This program still needs to be rewritten. It should be split into very +This program still needs to be rewritten. +It should be split into very modular sections, with the various emulators being completely separate -widgets that don't know about each other. Ideally, you'd like to be able to +widgets that do not know about each other. +Ideally, you'd like to be able to pick and choose emulator widgets and stick them into a single control widget. .PP There needs to be a dialog box to allow entry of the Tek COPY file name. +.SH "SEE ALSO" +resize(1), luit(1), X(__miscmansuffix__), pty(4), tty(4) +.br +\fIXterm Control Sequences\fP +(this is the file ctlseqs.ms). +.sp +http://invisible-island.net/xterm/xterm.html .SH AUTHORS Far too many people, including: .sp @@ -2810,7 +3315,7 @@ Jim Gettys (MIT-Athena), Bob Scheifler (MIT X Consortium), Doug Mink (SAO), Steve Pitschke (Stellar), Ron Newman (MIT-Athena), Jim Fulton (MIT X Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena), -Jason Bacon , -Stephen P. Wall , +Jason Bacon, +Stephen P. Wall, David Wexelblat, and Thomas Dickey (XFree86 Project). Index: xc/programs/xterm/xterm_io.h diff -u xc/programs/xterm/xterm_io.h:1.7 xc/programs/xterm/xterm_io.h:1.9 --- xc/programs/xterm/xterm_io.h:1.7 Mon Jan 7 16:02:44 2002 +++ xc/programs/xterm/xterm_io.h Sat Oct 5 13:57:14 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/xterm_io.h,v 1.7 2002/01/07 21:02:44 dawes Exp $ + * $XFree86: xc/programs/xterm/xterm_io.h,v 1.9 2002/10/05 17:57:14 dickey Exp $ */ /* @@ -43,11 +43,6 @@ * FIXME: some, such as those defining USE_TERMIOS should be moved to xterm.h * as they are integrated with the configure script. */ -#ifdef AMOEBA -#define USE_TERMIOS -#define _POSIX_SOURCE -#endif - #ifdef CSRG_BASED #define USE_TERMIOS #endif @@ -59,7 +54,7 @@ #define USE_SYSV_TERMIO #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ #define USE_SYSV_TERMIO #endif @@ -81,11 +76,6 @@ #undef SYSV /* pretend to be bsd (sgtty.h) */ #endif /* macII */ -#ifdef MINIX -#define USE_SYSV_TERMIO -#define USE_TERMIOS -#endif - #ifdef __MVS__ #define SVR4 #define USE_POSIX_TERMIOS @@ -180,7 +170,8 @@ #define TIOCSPGRP (_IOW('t', 118, pid_t)) #endif -#ifdef __EMX__ +#ifdef __UNIXOS2__ + #define XFREE86_PTY 0x76 #define XTY_TIOCSETA 0x48 @@ -199,6 +190,7 @@ #define NCCS 11 #endif +#define TIOCCONS 108 #define TIOCSWINSZ 113 #define TIOCGWINSZ 117 @@ -219,10 +211,12 @@ unsigned short ws_ypixel; /* vertical size, pixels */ }; +#ifdef XTERM_MAIN extern int ptioctl(int fd, int func, void* data); #define ioctl ptioctl +#endif -#endif /* __EMX__ */ +#endif /* __UNIXOS2__ */ #ifdef __hpux #include /* defines TIOCSLTC */ @@ -243,12 +237,6 @@ #undef FIOCLEX #undef FIONCLEX #endif /* macII */ - -#ifdef MINIX -#define termio termios -#define TCGETA TCGETS -#define TCSETAW TCSETSW -#endif #ifdef __QNX__ #undef TIOCSLTC /* conflicts with */ Index: xc/programs/xterm/xtermcfg.hin diff -u xc/programs/xterm/xtermcfg.hin:3.39 xc/programs/xterm/xtermcfg.hin:3.42 --- xc/programs/xterm/xtermcfg.hin:3.39 Sun Oct 7 21:08:11 2001 +++ xc/programs/xterm/xtermcfg.hin Sun Dec 8 17:31:50 2002 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.39 2001/10/08 01:08:11 dickey Exp $ + * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.42 2002/12/08 22:31:50 dickey Exp $ */ /************************************************************ -Copyright 1997-2000 by Thomas E. Dickey +Copyright 1997-2001,2002 by Thomas E. Dickey All Rights Reserved @@ -39,12 +39,17 @@ #undef DFT_COLORMODE /* AC_ARG_WITH(default-color-mode) */ #undef DFT_DECID /* AC_ARG_WITH(default-terminal-id) */ #undef DFT_TERMTYPE /* AC_ARG_WITH(default-term-type) */ +#undef HAVE_GETHOSTNAME /* AC_CHECK_FUNCS(gethostname) */ #undef HAVE_GETLOGIN /* AC_CHECK_FUNCS(getlogin) */ #undef HAVE_LASTLOG_H /* CF_LASTLOG */ +#undef HAVE_LIB_NEXTAW /* CF_X_ATHENA(--with-neXtaw) */ +#undef HAVE_LIB_XAW /* CF_X_ATHENA */ +#undef HAVE_LIB_XAW3D /* CF_X_ATHENA(--with-Xaw3d) */ #undef HAVE_NCURSES_TERM_H /* AC_CHECK_HEADERS(ncurses/term.h) */ #undef HAVE_PATHS_H /* CF_LASTLOG */ #undef HAVE_STDLIB_H /* AC_CHECK_HEADERS(stdlib.h) */ #undef HAVE_STRERROR /* AC_CHECK_FUNCS(strerror) */ +#undef HAVE_STRFTIME /* AC_CHECK_FUNCS(strftime) */ #undef HAVE_SYS_TIME_H /* AC_HEADER_TIME */ #undef HAVE_SYS_WAIT_H /* AC_HEADER_SYS_WAIT */ #undef HAVE_TCGETATTR /* AC_CHECK_FUNCS(tcgetattr) */ @@ -77,6 +82,7 @@ #undef OPT_INITIAL_ERASE /* CF_ARG_DISABLE(initial-erase) */ #undef OPT_INPUT_METHOD /* CF_ARG_DISABLE(input-method) */ #undef OPT_ISO_COLORS /* CF_ARG_DISABLE(ansi-color) */ +#undef OPT_LUIT_PROG /* CF_ARG_ENABLE(luit) */ #undef OPT_MAXIMIZE /* CF_ARG_DISABLE(maximize) */ #undef OPT_NUM_LOCK /* CF_ARG_DISABLE(num-lock) */ #undef OPT_PC_COLORS /* CF_ARG_DISABLE(pc-color) */ @@ -87,7 +93,7 @@ #undef OPT_TOOLBAR /* CF_ARG_ENABLE(toolbar) */ #undef OPT_TRACE /* CF_ARG_ENABLE(trace) */ #undef OPT_VT52_MODE /* CF_ARG_DISABLE(vt52) */ -#undef OPT_WIDE_CHARS /* CF_ARG_ENABLE(wide-chars) */ +#undef OPT_WIDE_CHARS /* CF_ARG_OPTION(wide-chars) */ #undef OPT_XMC_GLITCH /* CF_ARG_ENABLE(xmc-glitch) */ #undef OPT_ZICONBEEP /* CF_ARG_DISABLE(ziconbeep) */ #undef OWN_TERMINFO_DIR /* AC_ARG_WITH(own-terminfo) */ Index: xc/programs/xterm/xutf8.c diff -u xc/programs/xterm/xutf8.c:1.1 xc/programs/xterm/xutf8.c:1.3 --- xc/programs/xterm/xutf8.c:1.1 Mon Jun 18 15:09:28 2001 +++ xc/programs/xterm/xutf8.c Wed Oct 9 12:38:20 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/xutf8.c,v 1.1 2001/06/18 19:09:28 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/xutf8.c,v 1.3 2002/10/09 16:38:20 tsi Exp $ */ /* Copyright (c) 2001 by Juliusz Chroboczek @@ -30,16 +30,19 @@ #include +#ifndef X_HAVE_UTF8_STRING + +#undef XA_UTF8_STRING #define KEYSYM2UCS_INCLUDED + #include "keysym2ucs.c" -#ifndef X_HAVE_UTF8_STRING -#undef XA_UTF8_STRING -Atom _xa_utf8_string(Display *dpy) +Atom +_xa_utf8_string(Display * dpy) { static AtomPtr p = NULL; - if(p == NULL) + if (p == NULL) p = XmuMakeAtom("UTF8_STRING"); return XmuInternAtom(dpy, p); @@ -49,14 +52,14 @@ static int utf8countBytes(int c) { - if(c < 0) + if (c < 0) return 0; - if(c <= 0x7F) { + if (c <= 0x7F) { return 1; - } else if(c <= 0x7FF) { + } else if (c <= 0x7FF) { return 2; - } else if(c <= 0xFFFF) { + } else if (c <= 0xFFFF) { return 3; } else return 4; @@ -65,17 +68,17 @@ static void utf8insert(char *dest, int c, int *len_return) { - if(c < 0) + if (c < 0) return; - if(c <= 0x7F) { - dest[0] = c; - *len_return = 1; - } else if(c <= 0x7FF) { + if (c <= 0x7F) { + dest[0] = c; + *len_return = 1; + } else if (c <= 0x7FF) { dest[0] = 0xC0 | ((c >> 6) & 0x1F); dest[1] = 0x80 | (c & 0x3F); - *len_return = 2; - } else if(c <= 0xFFFF) { + *len_return = 2; + } else if (c <= 0xFFFF) { dest[0] = 0xE0 | ((c >> 12) & 0x0F); dest[1] = 0x80 | ((c >> 6) & 0x3F); dest[2] = 0x80 | (c & 0x3F); @@ -93,8 +96,8 @@ l1countUtf8Bytes(char *s, int len) { int l = 0; - while(len > 0) { - if((*s & 0x80) == 0) + while (len > 0) { + if ((*s & 0x80) == 0) l++; else l += 2; @@ -105,10 +108,10 @@ } static void -l1utf8copy (char *d, char *s, int len) +l1utf8copy(char *d, char *s, int len) { int l; - while(len > 0) { + while (len > 0) { utf8insert(d, (*s) & 0xFF, &l); d += l; s++; @@ -117,22 +120,22 @@ } static void -utf8l1strcpy (char *d, char *s) +utf8l1strcpy(char *d, char *s) { #define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) - while(*s) { - if((*s & 0x80) == 0) + while (*s) { + if ((*s & 0x80) == 0) *d++ = *s++; - else if((*s & 0x7C) == 0x40) { - if((s[1] & 0x80) == 0) { - s++; /* incorrect UTF-8 */ - continue; - } else if((*s & 0x7C) == 0x40) { - *d++ = ((*s & 0x03) << 6) | (s[1] & 0x3F); - s += 2; + else if ((*s & 0x7C) == 0x40) { + if ((s[1] & 0x80) == 0) { + s++; /* incorrect UTF-8 */ + continue; + } else if ((*s & 0x7C) == 0x40) { + *d++ = ((*s & 0x03) << 6) | (s[1] & 0x3F); + s += 2; } else { - *d++ = '?'; - SKIP; + *d++ = '?'; + SKIP; } } else { *d++ = '?'; @@ -149,20 +152,20 @@ { #define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) int len = 0; - while(*s) { - if((*s & 0x80) == 0) { + while (*s) { + if ((*s & 0x80) == 0) { s++; len++; - } else if((*s & 0x7C) == 0x40) { - if((s[1] & 0x80) == 0) { - s++; - continue; - } else if((*s & 0x7C) == 0x40) { - len++; - s += 2; + } else if ((*s & 0x7C) == 0x40) { + if ((s[1] & 0x80) == 0) { + s++; + continue; + } else if ((*s & 0x7C) == 0x40) { + len++; + s += 2; } else { - len++; - SKIP; + len++; + SKIP; } } else { len++; @@ -174,11 +177,10 @@ } int -Xutf8TextPropertyToTextList( - Display *dpy, - const XTextProperty *tp, - char ***list_return, - int *count_return) +Xutf8TextPropertyToTextList(Display * dpy, + const XTextProperty * tp, + char ***list_return, + int *count_return) { int utf8; char **list; @@ -189,12 +191,12 @@ int datalen = (int) tp->nitems; int len; - if(tp->format != 8) + if (tp->format != 8) return XConverterNotFound; - if(tp->encoding == XA_STRING) + if (tp->encoding == XA_STRING) utf8 = 0; - else if(tp->encoding == XA_UTF8_STRING(dpy)) + else if (tp->encoding == XA_UTF8_STRING(dpy)) utf8 = 1; else return XConverterNotFound; @@ -207,27 +209,29 @@ nelements = 1; for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { - if (*cp == '\0') nelements++; + if (*cp == '\0') + nelements++; } - list = (char **) malloc (nelements * sizeof (char *)); - if (!list) return XNoMemory; + list = (char **) malloc(nelements * sizeof(char *)); + if (!list) + return XNoMemory; - if(utf8) + if (utf8) len = datalen; else - len = l1countUtf8Bytes((char*)tp->value, datalen); + len = l1countUtf8Bytes((char *) tp->value, datalen); - start = (char *) malloc ((len + 1) * sizeof (char)); + start = (char *) malloc((len + 1) * sizeof(char)); if (!start) { - free ((char *) list); + free((char *) list); return XNoMemory; } - if(utf8) - memcpy(start, (char*)tp->value, datalen); + if (utf8) + memcpy(start, (char *) tp->value, datalen); else - l1utf8copy(start, (char*)tp->value, datalen); + l1utf8copy(start, (char *) tp->value, datalen); start[len] = '\0'; for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) { @@ -245,26 +249,25 @@ } int -Xutf8TextListToTextProperty( - Display *dpy, - char **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) +Xutf8TextListToTextProperty(Display * dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty * text_prop) { XTextProperty proto; unsigned int nbytes; int i; - if(style != XStringStyle && - style != XCompoundTextStyle && - style != XStdICCTextStyle && - style != XUTF8StringStyle) + if (style != XStringStyle && + style != XCompoundTextStyle && + style != XStdICCTextStyle && + style != XUTF8StringStyle) return XConverterNotFound; - if(style == XUTF8StringStyle) { + if (style == XUTF8StringStyle) { for (i = 0, nbytes = 0; i < count; i++) { - nbytes += (unsigned) ((list[i] ? strlen (list[i]) : 0) + 1); + nbytes += (unsigned) ((list[i] ? strlen(list[i]) : 0) + 1); } } else { for (i = 0, nbytes = 0; i < count; i++) { @@ -272,9 +275,9 @@ } } - if(style == XCompoundTextStyle) + if (style == XCompoundTextStyle) proto.encoding = XA_COMPOUND_TEXT(dpy); - else if(style == XUTF8StringStyle) + else if (style == XUTF8StringStyle) proto.encoding = XA_UTF8_STRING(dpy); else proto.encoding = XA_STRING; @@ -286,27 +289,29 @@ proto.value = NULL; if (nbytes > 0) { - register char *buf = malloc (nbytes); - if (!buf) return XNoMemory; + register char *buf = malloc(nbytes); + if (!buf) + return XNoMemory; proto.value = (unsigned char *) buf; for (i = 0; i < count; i++) { char *arg = list[i]; if (arg) { - if(style == XUTF8StringStyle) { - strcpy(buf, arg); - } else { - utf8l1strcpy(buf, arg); - } - buf += (strlen(buf) + 1); + if (style == XUTF8StringStyle) { + strcpy(buf, arg); + } else { + utf8l1strcpy(buf, arg); + } + buf += (strlen(buf) + 1); } else { *buf++ = '\0'; } } } else { - proto.value = (unsigned char *) malloc (1); /* easier for client */ - if (!proto.value) return XNoMemory; + proto.value = (unsigned char *) malloc(1); /* easier for client */ + if (!proto.value) + return XNoMemory; proto.value[0] = '\0'; } @@ -316,13 +321,12 @@ } int -Xutf8LookupString( - XIC ic GCC_UNUSED, - register XKeyEvent *ev, - char *buffer, - int nbytes, - KeySym *keysym_return, - Status *status_return) +Xutf8LookupString(XIC ic GCC_UNUSED, + register XKeyEvent * ev, + char *buffer, + int nbytes, + KeySym * keysym_return, + Status * status_return) { int rc; KeySym keysym; @@ -331,14 +335,14 @@ rc = XLookupString(ev, buffer, nbytes, &keysym, NULL); - if(rc > 0) { + if (rc > 0) { codepoint = buffer[0] & 0xFF; } else { codepoint = keysym2ucs(keysym); } - if(codepoint < 0) { - if(keysym == None) { + if (codepoint < 0) { + if (keysym == None) { *status_return = XLookupNone; } else { *status_return = XLookupKeySym; @@ -347,14 +351,14 @@ return 0; } - if(nbytes < utf8countBytes(codepoint)) { + if (nbytes < utf8countBytes(codepoint)) { *status_return = XBufferOverflow; return utf8countBytes(codepoint); } utf8insert(buffer, codepoint, &len); - if(keysym != None) { + if (keysym != None) { *keysym_return = keysym; *status_return = XLookupBoth; } else { @@ -364,7 +368,8 @@ } #else /* X_HAVE_UTF8_STRING */ /* Silence the compiler */ -void xutf8_dummy(void) +void +xutf8_dummy(void) { return; } Index: xc/programs/xterm/vttests/16colors.sh diff -u xc/programs/xterm/vttests/16colors.sh:1.3 xc/programs/xterm/vttests/16colors.sh:1.4 --- xc/programs/xterm/vttests/16colors.sh:1.3 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/16colors.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/16colors.sh,v 1.3 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/16colors.sh,v 1.4 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/3/27) # Show a simple 16-color test pattern. It is a little more confusing than @@ -12,6 +12,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xterm/vttests/256colors2.pl diff -u xc/programs/xterm/vttests/256colors2.pl:1.1 xc/programs/xterm/vttests/256colors2.pl:1.2 --- xc/programs/xterm/vttests/256colors2.pl:1.1 Sun Jul 11 04:49:54 1999 +++ xc/programs/xterm/vttests/256colors2.pl Mon Mar 25 20:46:43 2002 @@ -1,6 +1,6 @@ #!/usr/bin/perl # Author: Todd Larason -# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ # use the resources for colors 0-15 - usually more-or-less a # reproduction of the standard ANSI colors, but possibly more @@ -12,9 +12,9 @@ for ($blue = 0; $blue < 6; $blue++) { printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", 16 + ($red * 36) + ($green * 6) + $blue, - int ($red * 42.5), - int ($green * 42.5), - int ($blue * 42.5)); + ($red ? ($red * 40 + 55) : 0), + ($green ? ($green * 40 + 55) : 0), + ($blue ? ($blue * 40 + 55) : 0)); } } } Index: xc/programs/xterm/vttests/8colors.sh diff -u xc/programs/xterm/vttests/8colors.sh:1.3 xc/programs/xterm/vttests/8colors.sh:1.4 --- xc/programs/xterm/vttests/8colors.sh:1.3 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/8colors.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/8colors.sh,v 1.3 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/8colors.sh,v 1.4 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/3/27) # Show a simple 8-color test pattern @@ -9,6 +9,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xterm/vttests/acolors.sh diff -u /dev/null xc/programs/xterm/vttests/acolors.sh:1.1 --- /dev/null Thu Feb 27 12:36:15 2003 +++ xc/programs/xterm/vttests/acolors.sh Sun Sep 29 20:39:08 2002 @@ -0,0 +1,58 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/acolors.sh,v 1.1 2002/09/30 00:39:08 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Demonstrate the use of the control sequence for changing ANSI colors. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +LIST="00 30 80 d0 ff" + +exec /dev/tty +read original +stty $old +original=${original}${SUF} + +trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 +$CMD "${ESC}[0;1;34mThis message is BLUE" +$CMD "${ESC}[0;1;31mThis message is RED ${ESC}[0;31m(sometimes)" +$CMD "${ESC}[0;1;32mThis message is GREEN${ESC}[0m" +while true +do + for R in $LIST + do + for G in $LIST + do + for B in $LIST + do + # color "9" is bold-red + test $R != 00 && test $G = 00 && test $B = 00 && $CMD $OPT "" >/dev/tty + $CMD $OPT "${ESC}]4;9;rgb:$R/$G/$B${SUF}" >/dev/tty + sleep 1 + done + done + done +done Index: xc/programs/xterm/vttests/doublechars.sh diff -u xc/programs/xterm/vttests/doublechars.sh:1.3 xc/programs/xterm/vttests/doublechars.sh:1.4 --- xc/programs/xterm/vttests/doublechars.sh:1.3 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/doublechars.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.3 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.4 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/7/7) # Illustrate the use of double-size characters by drawing successive lines in @@ -13,6 +13,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xterm/vttests/dynamic.sh diff -u xc/programs/xterm/vttests/dynamic.sh:1.3 xc/programs/xterm/vttests/dynamic.sh:1.4 --- xc/programs/xterm/vttests/dynamic.sh:1.3 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/dynamic.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/dynamic.sh,v 1.3 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/dynamic.sh,v 1.4 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/3/27) # Demonstrate the use of dynamic colors by setting the background successively @@ -10,6 +10,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xterm/vttests/fonts.sh diff -u xc/programs/xterm/vttests/fonts.sh:1.2 xc/programs/xterm/vttests/fonts.sh:1.3 --- xc/programs/xterm/vttests/fonts.sh:1.2 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/fonts.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/fonts.sh,v 1.2 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/fonts.sh,v 1.3 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/3/27) # Demonstrate the use of dynamic colors by setting the background successively @@ -10,6 +10,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xterm/vttests/resize.sh diff -u xc/programs/xterm/vttests/resize.sh:1.3 xc/programs/xterm/vttests/resize.sh:1.4 --- xc/programs/xterm/vttests/resize.sh:1.3 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/resize.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/resize.sh,v 1.3 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/resize.sh,v 1.4 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/3/27) # Obtain the current screen size, then resize the terminal to the nominal @@ -10,6 +10,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xterm/vttests/title.sh diff -u xc/programs/xterm/vttests/title.sh:1.4 xc/programs/xterm/vttests/title.sh:1.5 --- xc/programs/xterm/vttests/title.sh:1.4 Fri Oct 27 14:31:17 2000 +++ xc/programs/xterm/vttests/title.sh Sun Sep 29 20:39:08 2002 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/vttests/title.sh,v 1.4 2000/10/27 18:31:17 dawes Exp $ +# $XFree86: xc/programs/xterm/vttests/title.sh,v 1.5 2002/09/30 00:39:08 dickey Exp $ # # -- Thomas Dickey (1999/3/27) # Obtain the current title of the window, set up a simple clock which runs @@ -10,6 +10,8 @@ OPT='-n' SUF='' TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && for verb in printf print ; do rm -f $TMP eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null Index: xc/programs/xtrap/chparse.c diff -u xc/programs/xtrap/chparse.c:1.2 xc/programs/xtrap/chparse.c:1.3 --- xc/programs/xtrap/chparse.c:1.2 Mon Jan 7 15:38:31 2002 +++ xc/programs/xtrap/chparse.c Wed Sep 18 13:11:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/chparse.c,v 1.2 2002/01/07 20:38:31 dawes Exp $ */ +/* $XFree86: xc/programs/xtrap/chparse.c,v 1.3 2002/09/18 17:11:57 tsi Exp $ */ /***************************************************************************** Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA @@ -59,6 +59,7 @@ #include #include #endif +#include #include #include "chparse.h" Index: xc/programs/xtrap/xtrapinfo.c diff -u xc/programs/xtrap/xtrapinfo.c:1.1 xc/programs/xtrap/xtrapinfo.c:1.2 --- xc/programs/xtrap/xtrapinfo.c:1.1 Fri Nov 2 18:29:34 2001 +++ xc/programs/xtrap/xtrapinfo.c Wed Sep 18 13:11:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapinfo.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapinfo.c,v 1.2 2002/09/18 17:11:57 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -51,6 +51,7 @@ * */ #include +#include #include #include Index: xc/programs/xtrap/xtrapproto.c diff -u xc/programs/xtrap/xtrapproto.c:1.2 xc/programs/xtrap/xtrapproto.c:1.3 --- xc/programs/xtrap/xtrapproto.c:1.2 Wed Nov 7 23:00:15 2001 +++ xc/programs/xtrap/xtrapproto.c Wed Sep 18 13:11:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapproto.c,v 1.2 2001/11/08 04:00:15 tsi Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapproto.c,v 1.3 2002/09/18 17:11:57 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -50,6 +50,7 @@ * */ #include +#include #include #include Index: xc/programs/xtrap/xtrapreset.c diff -u xc/programs/xtrap/xtrapreset.c:1.1 xc/programs/xtrap/xtrapreset.c:1.2 --- xc/programs/xtrap/xtrapreset.c:1.1 Fri Nov 2 18:29:34 2001 +++ xc/programs/xtrap/xtrapreset.c Wed Sep 18 13:11:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapreset.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapreset.c,v 1.2 2002/09/18 17:11:57 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -51,6 +51,7 @@ * */ #include +#include #include #include Index: xc/programs/xtrap/xtrapstats.c diff -u xc/programs/xtrap/xtrapstats.c:1.1 xc/programs/xtrap/xtrapstats.c:1.2 --- xc/programs/xtrap/xtrapstats.c:1.1 Fri Nov 2 18:29:34 2001 +++ xc/programs/xtrap/xtrapstats.c Wed Sep 18 13:11:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapstats.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapstats.c,v 1.2 2002/09/18 17:11:57 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -51,6 +51,7 @@ * */ #include +#include #include #include #include Index: xc/programs/xvidtune/Xvidtune.ad diff -u xc/programs/xvidtune/Xvidtune.ad:3.11 xc/programs/xvidtune/Xvidtune.ad:3.12 --- xc/programs/xvidtune/Xvidtune.ad:3.11 Sat Jan 10 22:48:47 1998 +++ xc/programs/xvidtune/Xvidtune.ad Wed Feb 19 13:55:22 2003 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xvidtune/Xvidtune.ad,v 3.11 1998/01/11 03:48:47 dawes Exp $ +! $XFree86: xc/programs/xvidtune/Xvidtune.ad,v 3.12 2003/02/19 18:55:22 eich Exp $ ! *adInstalled: true *borderWidth: 0 @@ -107,6 +107,7 @@ *Abort.label: Abort Test Now *WarnOK.label: OK *WarnCancel.label: Cancel +*NoTuneOK.label: OK *Left.label: Left *Right.label: Right *Wider.label: Wider @@ -134,7 +135,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n\ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n\ DEALINGS IN THE SOFTWARE.\n\n - +*NoTuneLabel.label: Video modes are not tunable on this chip.\n *S3-form.fromVert: Buttons2-form Index: xc/programs/xvidtune/xvidtune.c diff -u xc/programs/xvidtune/xvidtune.c:3.31 xc/programs/xvidtune/xvidtune.c:3.33 --- xc/programs/xvidtune/xvidtune.c:3.31 Sat Dec 8 13:53:17 2001 +++ xc/programs/xvidtune/xvidtune.c Fri Feb 21 23:08:44 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.31 2001/12/08 18:53:17 herrb Exp $ */ +/* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.33 2003/02/22 04:08:44 tsi Exp $ */ /* @@ -226,6 +226,14 @@ return TRUE; } +static Bool +ModeSettable(void) +{ + if (AppRes.field[HTotal].val == 0 || AppRes.field[VTotal].val == 0) + return FALSE; + return TRUE; +} + static int hitError = 0; static int (*xtErrorfunc)(Display *, XErrorEvent *); @@ -400,6 +408,9 @@ static void UpdateSyncRates(Bool dolabels) { + if (!ModeSettable()) + return; + AppRes.field[HSyncRate].val = AppRes.field[PixelClock].val * 1000 / AppRes.field[HTotal].val; AppRes.field[VSyncRate].val = AppRes.field[HSyncRate].val * 1000 / @@ -980,6 +991,17 @@ } static void +AckNoTune (Widget w, XtPointer client, XtPointer call) +{ + CleanUp(XtDisplay(w)); +#if XtSpecificationRelease < 6 + exit (0); +#else + XtAppSetExitFlag (XtWidgetToApplicationContext (w)); +#endif +} + +static void displayWarning(Widget top) { Widget w, popup, popupBox; @@ -1023,8 +1045,33 @@ } +static void +displayNoTune(Widget top) +{ + Widget w, popup, popupBox; + + popup = XtCreateWidget ("Notice", formWidgetClass, top, NULL, 0); + popupBox = XtVaCreateManagedWidget( + "WarningBox", + boxWidgetClass, + popup, + NULL); + + w = XtVaCreateManagedWidget( "NoTuneLabel", + labelWidgetClass, + popupBox, + NULL); + + w = XtVaCreateManagedWidget( "NoTuneOK", + commandWidgetClass, + popupBox, + NULL); + XtAddCallback (w, XtNcallback, AckNoTune, (XtPointer)popup); + XtManageChild (popup); +} + #if 0 static void s3Special(Widget top) @@ -1101,7 +1148,6 @@ }; form = XtCreateWidget ("form", formWidgetClass, top, NULL, 0); - for (i = 0; i < 14; i++) forms[i] = XtCreateWidget (form_names[i], formWidgetClass, form, NULL, 0); @@ -1169,7 +1215,7 @@ forms[7], NULL); XtAddCallback (w, XtNcallback, AdjustCB, (XtPointer)-VTotal); - + (void) sprintf (buf, "%04x", AppRes.field[Flags].val); wids[0] = XtCreateWidget ("Flags-label", labelWidgetClass, forms[8], NULL, 0); @@ -1447,7 +1493,8 @@ Widget top; XtAppContext app; Display* dpy; - + Bool modeSettable = TRUE; + static XtActionsRec actions[] = { { "xvidtune-quit", QuitAction }, { "xvidtune-restore", RestoreAction }, { "xvidtune-show", ShowAction }, @@ -1581,7 +1628,13 @@ : focus-in()\n: focus-out()\n\ : select-start()\n"); - CreateHierarchy (top); + if (!ModeSettable()) { + printf("Video are not settable on this chip\n"); + displayNoTune(top); + modeSettable = FALSE; + } else + CreateHierarchy (top); + XtAppAddActions (app, actions, XtNumber(actions)); @@ -1597,7 +1650,10 @@ (void) XSetWMProtocols (dpy, XtWindow (top), &wm_delete_window, 1); XtMapWidget (top); - displayWarning(top); + + if (modeSettable) + displayWarning(top); + /* really we should run our own event dispatching here until the * warning has been read... */ Index: xc/programs/xvinfo/xvinfo.c diff -u xc/programs/xvinfo/xvinfo.c:1.7 xc/programs/xvinfo/xvinfo.c:1.8 --- xc/programs/xvinfo/xvinfo.c:1.7 Sat Oct 27 23:34:43 2001 +++ xc/programs/xvinfo/xvinfo.c Tue Jan 22 18:05:43 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xvinfo/xvinfo.c,v 1.7 2001/10/28 03:34:43 tsi Exp $ */ +/* $XFree86: xc/programs/xvinfo/xvinfo.c,v 1.8 2002/01/22 23:05:43 mvojkovi Exp $ */ #include #include @@ -239,7 +239,7 @@ if(formats[n].type == XvRGB) { fprintf(stdout, " depth: %i\n", - formats[n].depth == XvRGB); + formats[n].depth); fprintf(stdout, " red, green, blue masks: " "0x%x, 0x%x, 0x%x\n", Index: xc/programs/xwd/multiVis.c diff -u xc/programs/xwd/multiVis.c:1.7 xc/programs/xwd/multiVis.c:1.8 --- xc/programs/xwd/multiVis.c:1.7 Fri Dec 14 15:02:34 2001 +++ xc/programs/xwd/multiVis.c Tue Dec 10 17:38:50 2002 @@ -34,7 +34,7 @@ from The Open Group. ------------------------------------------------------------------------ **/ -/* $XFree86: xc/programs/xwd/multiVis.c,v 1.7 2001/12/14 20:02:34 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/multiVis.c,v 1.8 2002/12/10 22:38:50 tsi Exp $ */ #include #include @@ -988,6 +988,7 @@ int y_vis; int width; int height; + int border_width; Visual *vis; Colormap cmap; Window parent; Index: xc/programs/xwd/xwd.c diff -u xc/programs/xwd/xwd.c:3.10 xc/programs/xwd/xwd.c:3.12 --- xc/programs/xwd/xwd.c:3.10 Fri Dec 14 15:02:34 2001 +++ xc/programs/xwd/xwd.c Wed Sep 18 20:19:56 2002 @@ -25,7 +25,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xwd/xwd.c,v 3.10 2001/12/14 20:02:34 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/xwd.c,v 3.12 2002/09/19 00:19:56 dawes Exp $ */ /* * xwd.c MIT Project Athena, X Window system window raster image dumper. @@ -201,17 +201,19 @@ */ if (!target_win) { target_win = Select_Window(dpy); - if (target_win != None && !frame_only) { - Window root; - int dummyi; - unsigned int dummy; + } + + if (target_win != None && !frame_only) { + Window root; + int dummyi; + unsigned int dummy; - if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, + if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, &dummy, &dummy, &dummy, &dummy) && - target_win != root) + target_win != root) { target_win = XmuClientWindow (dpy, target_win); } - } + } /* @@ -461,7 +463,7 @@ if (*(char *) &swaptest) { _swaplong((char *) &header, sizeof(header)); for (i = 0; i < ncolors; i++) { - _swaplong((char *) &colors[i].pixel, sizeof(long)); + _swaplong((char *) &colors[i].pixel, sizeof(CARD32)); _swapshort((char *) &colors[i].red, 3 * sizeof(short)); } } Index: xc/programs/xwd/xwd.man diff -u xc/programs/xwd/xwd.man:1.8 xc/programs/xwd/xwd.man:1.9 --- xc/programs/xwd/xwd.man:1.8 Fri Dec 14 15:02:34 2001 +++ xc/programs/xwd/xwd.man Mon Apr 22 16:53:10 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xwd/xwd.man,v 1.8 2001/12/14 20:02:34 dawes Exp $ +.\" $XFree86: xc/programs/xwd/xwd.man,v 1.9 2002/04/22 20:53:10 herrb Exp $ .\" .TH XWD 1 __xorgversion__ .SH NAME @@ -126,7 +126,7 @@ .B XWDFile.h X Window Dump File format definition file. .SH SEE ALSO -xwud(1), xpr(1), X(__miscmansuffix__) +xwud(1), X(__miscmansuffix__) .SH AUTHORS Tony Della Fera, Digital Equipment Corp., MIT Project Athena .br Index: xc/programs/xwud/xwud.man diff -u xc/programs/xwud/xwud.man:1.8 xc/programs/xwud/xwud.man:1.9 --- xc/programs/xwud/xwud.man:1.8 Fri Dec 14 15:02:35 2001 +++ xc/programs/xwud/xwud.man Mon Apr 22 16:53:11 2002 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xwud/xwud.man,v 1.8 2001/12/14 20:02:35 dawes Exp $ +.\" $XFree86: xc/programs/xwud/xwud.man,v 1.9 2002/04/22 20:53:11 herrb Exp $ .\" .TH XWUD 1 __xorgversion__ .SH NAME @@ -90,8 +90,7 @@ .B "-plane \fInumber\fP" You can select a single bit plane of the image to display with this option. Planes are numbered with zero being the least -significant bit. This option can be used to figure out which plane to -pass to \fIxpr(1)\fP for printing. +significant bit. .PP .TP 8 .B -raw @@ -146,7 +145,7 @@ xwud doesn't handle big/deep images very well on servers that don't have the BIG-REQUESTS extension. .SH SEE ALSO -xwd(1), xpr(1), xstdcmap(1), X(__miscmansuffix__) +xwd(1), xstdcmap(1), X(__miscmansuffix__) .SH AUTHOR Bob Scheifler, MIT X Consortium Index: xc/util/compress/compress.c diff -u xc/util/compress/compress.c:3.2 xc/util/compress/compress.c:3.3 --- xc/util/compress/compress.c:3.2 Sat May 31 09:51:39 1997 +++ xc/util/compress/compress.c Fri May 31 14:46:14 2002 @@ -18,6 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +/* $XFree86: xc/util/compress/compress.c,v 3.3 2002/05/31 18:46:14 dawes Exp $ */ #ifndef lint char copyright[] = @@ -490,7 +491,7 @@ zcat_flg = 1; } -#if defined(BSD4_2) && !defined(__EMX__) +#if defined(BSD4_2) && !defined(__UNIXOS2__) /* 4.2BSD dependent - take it out if not */ setlinebuf( stderr ); #endif /* BSD4_2 */ @@ -692,7 +693,7 @@ fprintf(stderr, "%s: ", *fileptr); } -#ifdef __EMX__ +#ifdef __UNIXOS2__ /* force setting binary mode */ _fsetmode(stdin,"b"); _fsetmode(stdout,"b"); @@ -715,7 +716,7 @@ } } } else { /* Standard input */ -#ifdef __EMX__ +#ifdef __UNIXOS2__ /* force setting binary mode */ _fsetmode(stdin,"b"); _fsetmode(stdout,"b"); @@ -1373,13 +1374,13 @@ mode = statbuf.st_mode & 07777; if (chmod(ofname, mode)) /* Copy modes */ perror(ofname); -#ifndef __EMX__ +#ifndef __UNIXOS2__ chown(ofname, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ #endif timep[0] = statbuf.st_atime; timep[1] = statbuf.st_mtime; utime(ofname, timep); /* Update last accessed and modified times */ -#ifdef __EMX__ +#ifdef __UNIXOS2__ fclose(stdin); #endif if (unlink(ifname)) /* Remove input file */ Index: xc/util/memleak/find-rtns.sh diff -u xc/util/memleak/find-rtns.sh:1.2 xc/util/memleak/find-rtns.sh:1.4 --- xc/util/memleak/find-rtns.sh:1.2 Fri Feb 16 08:24:10 2001 +++ xc/util/memleak/find-rtns.sh Sun Jun 30 22:26:08 2002 @@ -8,6 +8,8 @@ # # Usage: find-routines {leak-tracing-output-files} # +# $XFree86: xc/util/memleak/find-rtns.sh,v 1.4 2002/07/01 02:26:08 tsi Exp $ +# TMP1=find-routine.tmp1 TMP=find-routine.tmp @@ -15,6 +17,9 @@ OBJ=$1 shift echo 'set width 500' > $TMP1 +# To load shared libs set breakpoint and run +echo 'break main' >> $TMP1 +echo 'r' >> $TMP1 for i in `grep '\(return stack:\)\|\(allocated at\)' $* | tr ' ' '\012' | grep 0x | sort -u`; Index: xc/util/memleak/fmalloc.c diff -u xc/util/memleak/fmalloc.c:3.13 xc/util/memleak/fmalloc.c:3.14 --- xc/util/memleak/fmalloc.c:3.13 Fri Dec 14 15:02:36 2001 +++ xc/util/memleak/fmalloc.c Thu Apr 4 09:06:00 2002 @@ -26,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/util/memleak/fmalloc.c,v 3.13 2001/12/14 20:02:36 dawes Exp $ */ +/* $XFree86: xc/util/memleak/fmalloc.c,v 3.14 2002/04/04 14:06:00 eich Exp $ */ /* @@ -154,6 +154,8 @@ static int activeMemoryTotal; static int activeMemoryCount; static int deadMemoryTotal; +static int unreferencedAllocatedTotal; +static int unreferencedAllocatedCount; int FindLeakWarnMiddlePointers = 0; unsigned long FindLeakAllocBreakpoint = ~0; @@ -161,6 +163,7 @@ unsigned long FindLeakTime; int FindLeakCheckAlways = 0; int FindLeakValidateAlways = 0; +int FindPrintAllocations = 0; static void MarkActiveBlock (); static int tree_insert (), tree_delete (); @@ -302,8 +305,11 @@ if (!t) return; SweepActiveTree (t->left); - if (!t->marked) + if (!t->marked) { + unreferencedAllocatedTotal += t->desiredsize; + unreferencedAllocatedCount++; MemError ("Unreferenced allocated", t, FALSE); + } else if (!(t->marked & REFERENCED_HEAD)) MemError ("Referenced allocated middle", t, FALSE); SweepActiveTree (t->right); @@ -545,8 +551,11 @@ void CheckMemory () { +#if 0 mem foo; + unreferencedAllocatedTotal = 0; + unreferencedAllocatedCount = 0; foo = 1; fprintf (stderr, "\nCheckMemory\n"); fprintf (stderr, "Static Memory Area: 0x%lx to 0x%lx\n", @@ -565,8 +574,12 @@ SweepFreedMemory (); fprintf (stderr, "%d bytes freed memory still held from %d allocations\n", freedMemoryTotal, freedMemoryCount); + fprintf (stderr, + "%d bytes of allocated memory not referenced from %d allocations\n", + unreferencedAllocatedTotal,unreferencedAllocatedCount); deadMemoryTotal = freedMemoryTotal; fprintf (stderr, "CheckMemory done\n"); +#endif } /* @@ -653,7 +666,14 @@ getStackTrace (h->returnStack, MAX_RETURN_STACK); #endif AddActiveBlock (h); - return (char *) DataForHead(h); + ret = (char *) DataForHead(h); + if (FindPrintAllocations) { + fprintf(stderr,"Allocated %i bytes at 0x%lx\n",desiredsize,ret); +#ifdef HAS_GET_RETURN_ADDRESS + PrintReturnStack ("at",h->returnStack); +#endif + } + return ret; } void @@ -706,6 +726,11 @@ ValidateActiveMemory (); ValidateFreedMemory (); } + if (FindPrintAllocations) { + fprintf(stderr,"Freed at: 0x%lx\n",p); + PrintReturnStack ("at",h->returnStack); + } + } char * @@ -756,6 +781,13 @@ #endif AddFreedBlock (h); } + } + if (FindPrintAllocations) { + fprintf(stderr,"Freed at: 0x%lx\n",old); + fprintf(stderr,"Reallocated: %i bytes at: 0x%lx\n",desiredsize,new); +#ifdef HAS_GET_RETURN_ADDRESS + PrintReturnStack ("at", h->returnStack); +#endif } return new; }